2 lines
3.4 KiB
JavaScript
2 lines
3.4 KiB
JavaScript
|
"use strict";var e=Object.defineProperty,o=Object.defineProperties,t=Object.getOwnPropertyDescriptors,n=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,c=(o,t,n)=>t in o?e(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n;const l=require("../../../../common/vendor.js");if(!Array){(l.resolveComponent("wd-icon")+l.resolveComponent("wd-transition"))()}Math||((()=>"../wd-icon/wd-icon.js")+(()=>"../wd-transition/wd-transition.js"))();const a=l.defineComponent((u=((e,o)=>{for(var t in o||(o={}))s.call(o,t)&&c(e,t,o[t]);if(n)for(var t of n(o))r.call(o,t)&&c(e,t,o[t]);return e})({},{name:"wd-popover",options:{virtualHost:!0,addGlobalClass:!0,styleIsolation:"shared"}}),p={props:l.popoverProps,emits:["update:modelValue","menuclick","change","open","close"],setup(e,{expose:o,emit:t}){const n=e,s=t,r=l.inject(l.queueKey,null),c="popover",{proxy:a}=l.getCurrentInstance();l.watch((()=>n.content),(e=>{const{mode:o}=n;"normal"===o&&"string"!=typeof e||"menu"===o&&l.isArray(e)})),l.watch((()=>n.placement),(()=>{u.init(n.placement,n.visibleArrow,c)})),l.watch((()=>n.modelValue),(e=>{e&&(u.control(n.placement,n.offset),r&&r.closeOther?r.closeOther(a):l.closeOther(a)),u.showStyle.value=e?"display: inline-block;":"display: none;",s("change",{show:e}),s(e?"open":"close")})),l.onMounted((()=>{u.init(n.placement,n.visibleArrow,c)})),l.onBeforeMount((()=>{r&&r.pushToQueue?r.pushToQueue(a):l.pushToQueue(a),u.showStyle.value=n.modelValue?"opacity: 1;":"opacity: 0;"})),l.onBeforeUnmount((()=>{r&&r.removeFromQueue?r.removeFromQueue(a):l.removeFromQueue(a)}));const u=l.usePopover();function p(e){s("update:modelValue",!1),s("menuclick",{item:n.content[e],index:e})}function i(){n.disabled||s("update:modelValue",!n.modelValue)}return o({open:function(){s("update:modelValue",!0)},close:function(){s("update:modelValue",!1)}}),(e,o)=>l.e({a:!e.useContentSlot&&"normal"===e.mode},e.useContentSlot||"normal"!==e.mode?{}:{b:l.t(e.content)},{c:!e.useContentSlot&&"menu"===e.mode&&"object"==typeof e.content},e.useContentSlot||"menu"!==e.mode||"object"!=typeof e.content?{}:{d:l.f(e.content,((e,o,t)=>l.e({a:e.iconClass},e.iconClass?{b:"717384ce-0-"+t,c:l.p({name:e.iconClass,"custom-class":"wd-popover__icon"})}:{},{d:l.t(e.content),e:o,f:l.o((e=>p(o)),o)})))},{e:l.n(`wd-popover__container ${e.customPop}`),f:n.visibleArrow},n.visibleArrow?{g:l.n(`wd-popover__arrow ${l.unref(u).arrowClass.value} ${e.customArrow}`),h:l.s(l.unref(u).arrowStyle.value)}:{},{i:!e.useContentSlot&&"normal"===e.mode},e.useContentSlot||"normal"!==e.mode?{}:{j:l.t(e.content)},{k:!e.useContentSlot&&"menu"===e.mode},e.useContentSlot||"menu"!==e.mode?{}:{l:l.f(e.content,((e,o,t)=>l.e({a:"object"==typeof e&&e.iconClass},"object"==typeof e&&e.iconClass?{b:"717384ce-2-"+t+",717384ce-1",c:l.p({name:e.iconClass,"custom-class":"wd-popover__icon"})}:{},{d:l.t("object"==typeof e&&e.content?e.content:""),e:o,f:l.o((e=>p(o)),o),g:l.s(0===o?"border-top: none":"")})))},{m:l.n(`wd-popover__container ${e.customPop}`),n:e.showClose},e.showClose?{o:l.o(i),p:l.p({name:"close","custom-class":"wd-popover__close-icon"})}:{},{q:l.p({"custom-class":"wd-popover__pos","custom-style":l.unref(u).popStyle.value,show:e.modelValue,name:"fade",duration:200}),r:l.o(i),s:l.n(`wd-popover ${e.customClass}`),t:l.s(e.customStyle),v:l.o(((...e)=>l.unref(u).noop&&l.unref(u).noop(...e)))})}},o(u,t(p))));var u,p;const i=l._export_sfc(a,[["__scopeId","data-v-717384ce"]]);wx.createComponent(i);
|