@volverjs/ui-vue 0.0.8-beta.9 → 0.0.9-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/components/VvAlertGroup/VvAlertGroup.es.js +41 -5
- package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.es.js +72 -41
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvDialog/VvDialog.es.js +33 -1
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.es.js +71 -40
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +10 -2
- package/dist/components/index.es.js +105 -42
- package/dist/components/index.umd.js +1 -1
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/package.json +28 -28
- package/src/assets/icons/detailed.json +1 -1
- package/src/assets/icons/normal.json +1 -1
- package/src/assets/icons/simple.json +1 -1
- package/src/components/VvAlertGroup/VvAlertGroup.vue +28 -0
- package/src/components/VvAlertGroup/index.ts +11 -1
- package/src/components/VvCombobox/VvCombobox.vue +1 -1
- package/src/components/VvDialog/VvDialog.vue +20 -0
- package/src/components/VvDialog/index.ts +13 -1
- package/src/components/VvDropdown/VvDropdown.vue +84 -48
|
@@ -350,7 +350,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
350
350
|
"beforeExpand",
|
|
351
351
|
"beforeCollapse",
|
|
352
352
|
"afterExpand",
|
|
353
|
-
"afterCollapse"
|
|
353
|
+
"afterCollapse",
|
|
354
|
+
"before-enter",
|
|
355
|
+
"after-leave",
|
|
356
|
+
"enter",
|
|
357
|
+
"after-enter",
|
|
358
|
+
"enter-cancelled",
|
|
359
|
+
"before-leave",
|
|
360
|
+
"leave",
|
|
361
|
+
"leave-cancelled"
|
|
354
362
|
],
|
|
355
363
|
setup(__props, { expose: __expose, emit }) {
|
|
356
364
|
const props = __props;
|
|
@@ -369,16 +377,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
369
377
|
localReferenceEl.value = newValue;
|
|
370
378
|
}
|
|
371
379
|
});
|
|
372
|
-
const
|
|
373
|
-
const onChangeDropdownCustomPosition = () => {
|
|
374
|
-
var _a;
|
|
375
|
-
dropdownCustomPosition.value = (_a = window.getComputedStyle(floatingEl.value).getPropertyValue("--dropdown-custom-position")) == null ? void 0 : _a.trim();
|
|
376
|
-
};
|
|
380
|
+
const hasCustomPosition = ref(false);
|
|
377
381
|
onMounted(() => {
|
|
378
|
-
useMutationObserver(
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
+
useMutationObserver(
|
|
383
|
+
floatingEl.value,
|
|
384
|
+
() => {
|
|
385
|
+
var _a;
|
|
386
|
+
hasCustomPosition.value = ((_a = window.getComputedStyle(floatingEl.value).getPropertyValue("--dropdown-custom-position")) == null ? void 0 : _a.trim()) === "true";
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
attributeFilter: ["style"],
|
|
390
|
+
window
|
|
391
|
+
}
|
|
392
|
+
);
|
|
382
393
|
});
|
|
383
394
|
const middleware = computed(() => {
|
|
384
395
|
const toReturn = [];
|
|
@@ -455,8 +466,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
455
466
|
}
|
|
456
467
|
);
|
|
457
468
|
const dropdownPlacement = computed(() => {
|
|
458
|
-
if (
|
|
459
|
-
return
|
|
469
|
+
if (hasCustomPosition.value) {
|
|
470
|
+
return void 0;
|
|
460
471
|
}
|
|
461
472
|
return {
|
|
462
473
|
position: strategy.value,
|
|
@@ -467,29 +478,24 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
467
478
|
width: props.triggerWidth && referenceEl.value ? `${referenceEl.value.offsetWidth}px` : void 0
|
|
468
479
|
};
|
|
469
480
|
});
|
|
470
|
-
const side = computed(
|
|
471
|
-
|
|
472
|
-
|
|
481
|
+
const side = computed(
|
|
482
|
+
() => placement.value.split("-")[0]
|
|
483
|
+
);
|
|
484
|
+
const arrowPlacement = computed(() => {
|
|
485
|
+
var _a, _b, _c, _d, _e;
|
|
486
|
+
if (hasCustomPosition.value) {
|
|
487
|
+
return void 0;
|
|
488
|
+
}
|
|
489
|
+
const staticSide = {
|
|
473
490
|
top: "bottom",
|
|
474
491
|
right: "left",
|
|
475
492
|
bottom: "top",
|
|
476
493
|
left: "right"
|
|
477
|
-
}
|
|
478
|
-
);
|
|
479
|
-
const arrowPlacement = computed(() => {
|
|
480
|
-
var _a, _b, _c, _d;
|
|
481
|
-
if ((dropdownCustomPosition == null ? void 0 : dropdownCustomPosition.value) === "true") {
|
|
482
|
-
return {};
|
|
483
|
-
}
|
|
484
|
-
if (["bottom", "top"].includes(staticSide.value)) {
|
|
485
|
-
return {
|
|
486
|
-
right: `${((_a = middlewareData.value.arrow) == null ? void 0 : _a.x) ?? 0}px`,
|
|
487
|
-
[staticSide.value]: `${-(((_b = arrowEl.value) == null ? void 0 : _b.offsetWidth) ?? 0) / 2}px`
|
|
488
|
-
};
|
|
489
|
-
}
|
|
494
|
+
}[side.value];
|
|
490
495
|
return {
|
|
491
|
-
|
|
492
|
-
|
|
496
|
+
left: ((_a = middlewareData.value.arrow) == null ? void 0 : _a.x) !== void 0 ? `${(_b = middlewareData.value.arrow) == null ? void 0 : _b.x}px` : void 0,
|
|
497
|
+
top: ((_c = middlewareData.value.arrow) == null ? void 0 : _c.y) !== void 0 ? `${(_d = middlewareData.value.arrow) == null ? void 0 : _d.y}px` : void 0,
|
|
498
|
+
[staticSide]: `${-(((_e = arrowEl.value) == null ? void 0 : _e.offsetWidth) ?? 0) / 2}px`
|
|
493
499
|
};
|
|
494
500
|
});
|
|
495
501
|
const modelValue = useVModel(props, "modelValue", emit);
|
|
@@ -516,7 +522,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
516
522
|
const init = (el) => {
|
|
517
523
|
referenceEl.value = el;
|
|
518
524
|
};
|
|
519
|
-
__expose({
|
|
525
|
+
__expose({
|
|
526
|
+
toggle,
|
|
527
|
+
show,
|
|
528
|
+
hide,
|
|
529
|
+
init,
|
|
530
|
+
customPosition: hasCustomPosition
|
|
531
|
+
});
|
|
520
532
|
watch(expanded, (newValue) => {
|
|
521
533
|
if (newValue && props.autofocusFirst) {
|
|
522
534
|
nextTick(() => {
|
|
@@ -650,11 +662,33 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
650
662
|
htmlEl == null ? void 0 : htmlEl.click();
|
|
651
663
|
}
|
|
652
664
|
});
|
|
653
|
-
const
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
665
|
+
const dropdownTransitionHandlers = {
|
|
666
|
+
"before-enter": () => {
|
|
667
|
+
emit(expanded.value ? "beforeExpand" : "beforeCollapse");
|
|
668
|
+
emit("before-enter");
|
|
669
|
+
},
|
|
670
|
+
"after-leave": () => {
|
|
671
|
+
emit(expanded.value ? "afterExpand" : "afterCollapse");
|
|
672
|
+
emit("after-leave");
|
|
673
|
+
},
|
|
674
|
+
enter: () => {
|
|
675
|
+
emit("enter");
|
|
676
|
+
},
|
|
677
|
+
"after-enter": () => {
|
|
678
|
+
emit("after-enter");
|
|
679
|
+
},
|
|
680
|
+
"enter-cancelled": () => {
|
|
681
|
+
emit("enter-cancelled");
|
|
682
|
+
},
|
|
683
|
+
"before-leave": () => {
|
|
684
|
+
emit("before-leave");
|
|
685
|
+
},
|
|
686
|
+
leave: () => {
|
|
687
|
+
emit("leave");
|
|
688
|
+
},
|
|
689
|
+
"leave-cancelled": () => {
|
|
690
|
+
emit("leave-cancelled");
|
|
691
|
+
}
|
|
658
692
|
};
|
|
659
693
|
return (_ctx, _cache) => {
|
|
660
694
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
@@ -664,10 +698,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
664
698
|
]),
|
|
665
699
|
_: 3
|
|
666
700
|
}),
|
|
667
|
-
createVNode(Transition, mergeProps({ name: _ctx.transitionName }, toHandlers({
|
|
668
|
-
beforeEnter: onTransitionBeforeEnter,
|
|
669
|
-
onAfterLeave: onTransitionAfterLeave
|
|
670
|
-
})), {
|
|
701
|
+
createVNode(Transition, mergeProps({ name: _ctx.transitionName }, toHandlers(dropdownTransitionHandlers)), {
|
|
671
702
|
default: withCtx(() => [
|
|
672
703
|
withDirectives(createElementVNode("div", {
|
|
673
704
|
ref_key: "floatingEl",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("@floating-ui/vue"),require("nanoid"),require("@vueuse/core"),require("mitt")):"function"==typeof define&&define.amd?define(["vue","@floating-ui/vue","nanoid","@vueuse/core","mitt"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvDropdown=t(e.vue,e.vue$1,e.nanoid,e.core,e.mitt)}(this,(function(e,t,o,r,l){"use strict";var
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("@floating-ui/vue"),require("nanoid"),require("@vueuse/core"),require("mitt")):"function"==typeof define&&define.amd?define(["vue","@floating-ui/vue","nanoid","@vueuse/core","mitt"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvDropdown=t(e.vue,e.vue$1,e.nanoid,e.core,e.mitt)}(this,(function(e,t,o,r,l){"use strict";var a=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(a||{}),n=(e=>(e.topStart="top-start",e.topEnd="top-end",e.bottomStart="bottom-start",e.bottomEnd="bottom-end",e.leftStart="left-start",e.leftEnd="left-end",e.rightStart="right-start",e.rightEnd="right-end",e))(n||{}),u=(e=>(e.before="before",e.after="after",e))(u||{}),i=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(i||{}),d=(e=>(e.listbox="listbox",e.menu="menu",e))(d||{}),s=(e=>(e.option="option",e.presentation="presentation",e))(s||{});const f=Symbol.for("dropdownTrigger"),p=Symbol.for("dropdownItem");Boolean,Boolean,Boolean;u.before;const c={id:[String,Number]},v={placement:{type:String,default:a.bottom,validator:e=>Object.values(a).includes(e)||Object.values(n).includes(e)},strategy:{type:String,default:"absolute",validator:e=>["fixed","absolute"].includes(e)},transitionName:{type:String},offset:{type:[Number,String,Object],default:0},shift:{type:[Boolean,Object],default:!1},flip:{type:[Boolean,Object],default:!0},size:{type:[Boolean,Object],default:()=>({padding:10})},autoPlacement:{type:[Boolean,Object],default:!1},arrow:{type:Boolean,default:!1},keepOpen:{type:Boolean,default:!1},autofocusFirst:{type:Boolean,default:!0},triggerWidth:{type:Boolean}};i.button;const m={...c,...v,modifiers:{type:[String,Array],default:"mobile"},modelValue:{type:Boolean,default:void 0},reference:{type:Object,default:null},role:{type:String,default:d.menu,validator:e=>Object.values(d).includes(e)}};const b=["id","tabindex","role","aria-labelledby"];return e.defineComponent({name:"VvDropdown",inheritAttrs:!1,props:m,emits:["update:modelValue","beforeExpand","beforeCollapse","afterExpand","afterCollapse","before-enter","after-leave","enter","after-enter","enter-cancelled","before-leave","leave","leave-cancelled"],setup(a,{expose:n,emit:u}){const i=a,{id:c}=e.toRefs(i),v=(t=>e.computed((()=>String((null==t?void 0:t.value)||o.nanoid()))))(c),m=e.useAttrs(),g=e.ref("auto"),h=e.ref("auto"),y=e.ref(null),x=e.ref(),w=e.ref(null),S=e.ref(null),E=e.computed({get:()=>i.reference??y.value,set:e=>{y.value=e}}),k=e.ref(!1);e.onMounted((()=>{r.useMutationObserver(x.value,(()=>{var e;k.value="true"===(null==(e=window.getComputedStyle(x.value).getPropertyValue("--dropdown-custom-position"))?void 0:e.trim())}),{attributeFilter:["style"],window:window})}));const P=e.computed((()=>{const e=[];if(i.autoPlacement?"boolean"==typeof i.autoPlacement?e.push(t.autoPlacement()):e.push(t.autoPlacement(i.autoPlacement)):i.flip&&("boolean"==typeof i.flip?e.push(t.flip()):e.push(t.flip(i.flip))),i.shift&&("boolean"==typeof i.shift?e.push(t.shift()):e.push(t.shift(i.shift))),i.size){const o=({availableWidth:e,availableHeight:t})=>{g.value=`${e}px`,h.value=`${t}px`};"boolean"==typeof i.size?e.push(t.size({apply:o})):e.push(t.size({...i.size,apply:o}))}return i.offset&&(e.push(t.offset(Number(i.offset))),["string","number"].includes(typeof i.offset)?e.push(t.offset(Number(i.offset))):e.push(t.offset(i.offset))),i.arrow&&e.push(t.arrow({element:w})),e})),{x:$,y:B,strategy:O,middlewareData:z,placement:V}=t.useFloating(E,x,{whileElementsMounted:t.autoUpdate,placement:e.computed((()=>i.placement)),strategy:e.computed((()=>i.strategy)),middleware:P}),C=e.computed((()=>{if(!k.value)return{position:O.value,top:`${B.value??0}px`,left:`${$.value??0}px`,maxWidth:g.value,maxHeight:h.value,width:i.triggerWidth&&E.value?`${E.value.offsetWidth}px`:void 0}})),j=e.computed((()=>V.value.split("-")[0])),A=e.computed((()=>{var e,t,o,r,l;if(k.value)return;const a={top:"bottom",right:"left",bottom:"top",left:"right"}[j.value];return{left:void 0!==(null==(e=z.value.arrow)?void 0:e.x)?`${null==(t=z.value.arrow)?void 0:t.x}px`:void 0,top:void 0!==(null==(o=z.value.arrow)?void 0:o.y)?`${null==(r=z.value.arrow)?void 0:r.y}px`:void 0,[a]:-((null==(l=w.value)?void 0:l.offsetWidth)??0)/2+"px"}})),N=r.useVModel(i,"modelValue",u),D=e.ref(!1),_=e.computed({get:()=>N.value??D.value,set:e=>{void 0!==N.value?N.value=e:D.value=e}}),R=()=>{_.value=!0},T=()=>{_.value=!1},F=()=>{_.value=!_.value},W=e=>{E.value=e};n({toggle:F,show:R,hide:T,init:W,customPosition:k}),e.watch(_,(t=>{t&&i.autofocusFirst&&e.nextTick((()=>{const e=Q(x.value);e.length>0&&e[0].focus({preventScroll:!0})}))})),r.onClickOutside(x,(()=>{i.keepOpen||(_.value=!1)}),{ignore:[E]});const q=e.computed((()=>{var e,t;return(null==(t=null==(e=E.value)?void 0:e.getAttribute)?void 0:t.call(e,"id"))??void 0})),K=e.computed((()=>({"aria-controls":v.value,"aria-haspopup":!0,"aria-expanded":_.value}))),{component:M,bus:H}=function({reference:t,id:o,expanded:r,aria:a}){const n=l(),u=e.defineComponent({name:"VvDropdownTriggerProvider",setup(){e.provide(f,{reference:t,id:o,expanded:r,aria:a,bus:n})},render(){var t,o;return e.h(e.Fragment,{},null==(o=(t=this.$slots).default)?void 0:o.call(t))}});return{bus:n,component:u}}({reference:E,id:v,expanded:_,aria:K});H.on("click",F);const{role:U,modifiers:I}=e.toRefs(i),{itemRole:G}=function({role:t,expanded:o}){const r=e.computed((()=>t.value===d.listbox?s.option:s.presentation));return e.provide(p,{role:r,expanded:o}),{itemRole:r}}({role:U,expanded:_}),J=function(t,o,r){return e.computed((()=>{const l={[t]:!0},a="string"==typeof(null==o?void 0:o.value)?o.value.split(" "):null==o?void 0:o.value;return a&&Array.isArray(a)&&a.forEach((e=>{e&&(l[`${t}--${e}`]=!0)})),r&&Object.keys(r.value).forEach((o=>{l[`${t}--${o}`]=e.unref(r.value[o])})),l}))}("vv-dropdown",I,e.computed((()=>({arrow:i.arrow})))),{focused:L}=r.useFocusWithin(x);function Q(e){return e?[...e.querySelectorAll('a[href], button, input, textarea, select, details,[tabindex]:not([tabindex="-1"])')].filter((e=>!e.hasAttribute("disabled")&&!e.getAttribute("aria-hidden"))):[]}r.onKeyStroke("Escape",(e=>{_.value&&(e.preventDefault(),T())})),r.onKeyStroke("ArrowDown",(t=>{_.value&&L.value&&(t.preventDefault(),e.nextTick((()=>{if(L.value){const e=Q(x.value);if(0===e.length||!document.activeElement)return;const t=e.indexOf(document.activeElement);t<e.length-1?e[t+1].focus({preventScroll:!0}):e[0].focus({preventScroll:!0})}})))})),r.onKeyStroke("ArrowUp",(t=>{_.value&&L.value&&(t.preventDefault(),e.nextTick((()=>{if(L.value){const e=Q(x.value);if(0===e.length||!document.activeElement)return;const t=e.indexOf(document.activeElement);t>0?e[t-1].focus({preventScroll:!0}):e[e.length-1].focus({preventScroll:!0})}})))})),r.onKeyStroke([" ","Enter"],(e=>{const t=e.target;_.value&&L.value&&t&&(null==t||t.click())}));const X={"before-enter":()=>{u(_.value?"beforeExpand":"beforeCollapse"),u("before-enter")},"after-leave":()=>{u(_.value?"afterExpand":"afterCollapse"),u("after-leave")},enter:()=>{u("enter")},"after-enter":()=>{u("after-enter")},"enter-cancelled":()=>{u("enter-cancelled")},"before-leave":()=>{u("before-leave")},leave:()=>{u("leave")},"leave-cancelled":()=>{u("leave-cancelled")}};return(t,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(M),null,{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps({init:W,show:R,hide:T,toggle:F,expanded:e.unref(_),aria:e.unref(K)})))])),_:3}),e.createVNode(e.Transition,e.mergeProps({name:t.transitionName},e.toHandlers(X)),{default:e.withCtx((()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"floatingEl",ref:x,style:e.normalizeStyle(e.unref(C)),class:e.normalizeClass(e.unref(J))},[i.arrow?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"arrowEl",ref:w,style:e.normalizeStyle(e.unref(A)),class:"vv-dropdown__arrow"},null,4)):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"before",e.normalizeProps(e.guardReactiveProps({expanded:e.unref(_)}))),e.createElementVNode("div",e.mergeProps(e.unref(m),{id:e.unref(v),ref_key:"listEl",ref:S,tabindex:e.unref(_)?void 0:-1,role:e.unref(U),"aria-labelledby":e.unref(q),class:"vv-dropdown__list"}),[e.renderSlot(t.$slots,"items",e.normalizeProps(e.guardReactiveProps({role:e.unref(G)})))],16,b),e.renderSlot(t.$slots,"after",e.normalizeProps(e.guardReactiveProps({expanded:e.unref(_)})))],6),[[e.vShow,e.unref(_)]])])),_:3},16,["name"])],64))}})}));
|
|
@@ -112,8 +112,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
112
112
|
show: () => void;
|
|
113
113
|
hide: () => void;
|
|
114
114
|
init: (el: HTMLElement) => void;
|
|
115
|
-
|
|
116
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "beforeExpand" | "beforeCollapse" | "afterExpand" | "afterCollapse")[], "update:modelValue" | "beforeExpand" | "beforeCollapse" | "afterExpand" | "afterCollapse", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
115
|
+
customPosition: Ref<boolean>;
|
|
116
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "before-enter" | "after-leave" | "enter" | "after-enter" | "enter-cancelled" | "before-leave" | "leave" | "leave-cancelled" | "beforeExpand" | "beforeCollapse" | "afterExpand" | "afterCollapse")[], "update:modelValue" | "before-enter" | "after-leave" | "enter" | "after-enter" | "enter-cancelled" | "before-leave" | "leave" | "leave-cancelled" | "beforeExpand" | "beforeCollapse" | "afterExpand" | "afterCollapse", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
117
117
|
modifiers: {
|
|
118
118
|
type: globalThis.PropType<string | string[]>;
|
|
119
119
|
default: string;
|
|
@@ -222,7 +222,15 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
222
222
|
};
|
|
223
223
|
id: (StringConstructor | NumberConstructor)[];
|
|
224
224
|
}>> & {
|
|
225
|
+
onEnter?: ((...args: any[]) => any) | undefined;
|
|
226
|
+
onLeave?: ((...args: any[]) => any) | undefined;
|
|
225
227
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
228
|
+
"onBefore-enter"?: ((...args: any[]) => any) | undefined;
|
|
229
|
+
"onAfter-leave"?: ((...args: any[]) => any) | undefined;
|
|
230
|
+
"onAfter-enter"?: ((...args: any[]) => any) | undefined;
|
|
231
|
+
"onEnter-cancelled"?: ((...args: any[]) => any) | undefined;
|
|
232
|
+
"onBefore-leave"?: ((...args: any[]) => any) | undefined;
|
|
233
|
+
"onLeave-cancelled"?: ((...args: any[]) => any) | undefined;
|
|
226
234
|
onBeforeExpand?: ((...args: any[]) => any) | undefined;
|
|
227
235
|
onBeforeCollapse?: ((...args: any[]) => any) | undefined;
|
|
228
236
|
onAfterExpand?: ((...args: any[]) => any) | undefined;
|
|
@@ -2425,7 +2425,15 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
2425
2425
|
"beforeExpand",
|
|
2426
2426
|
"beforeCollapse",
|
|
2427
2427
|
"afterExpand",
|
|
2428
|
-
"afterCollapse"
|
|
2428
|
+
"afterCollapse",
|
|
2429
|
+
"before-enter",
|
|
2430
|
+
"after-leave",
|
|
2431
|
+
"enter",
|
|
2432
|
+
"after-enter",
|
|
2433
|
+
"enter-cancelled",
|
|
2434
|
+
"before-leave",
|
|
2435
|
+
"leave",
|
|
2436
|
+
"leave-cancelled"
|
|
2429
2437
|
],
|
|
2430
2438
|
setup(__props, { expose: __expose, emit }) {
|
|
2431
2439
|
const props = __props;
|
|
@@ -2444,16 +2452,19 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
2444
2452
|
localReferenceEl.value = newValue;
|
|
2445
2453
|
}
|
|
2446
2454
|
});
|
|
2447
|
-
const
|
|
2448
|
-
const onChangeDropdownCustomPosition = () => {
|
|
2449
|
-
var _a;
|
|
2450
|
-
dropdownCustomPosition.value = (_a = window.getComputedStyle(floatingEl.value).getPropertyValue("--dropdown-custom-position")) == null ? void 0 : _a.trim();
|
|
2451
|
-
};
|
|
2455
|
+
const hasCustomPosition = ref(false);
|
|
2452
2456
|
onMounted(() => {
|
|
2453
|
-
useMutationObserver(
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
+
useMutationObserver(
|
|
2458
|
+
floatingEl.value,
|
|
2459
|
+
() => {
|
|
2460
|
+
var _a;
|
|
2461
|
+
hasCustomPosition.value = ((_a = window.getComputedStyle(floatingEl.value).getPropertyValue("--dropdown-custom-position")) == null ? void 0 : _a.trim()) === "true";
|
|
2462
|
+
},
|
|
2463
|
+
{
|
|
2464
|
+
attributeFilter: ["style"],
|
|
2465
|
+
window
|
|
2466
|
+
}
|
|
2467
|
+
);
|
|
2457
2468
|
});
|
|
2458
2469
|
const middleware = computed(() => {
|
|
2459
2470
|
const toReturn = [];
|
|
@@ -2530,8 +2541,8 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
2530
2541
|
}
|
|
2531
2542
|
);
|
|
2532
2543
|
const dropdownPlacement = computed(() => {
|
|
2533
|
-
if (
|
|
2534
|
-
return
|
|
2544
|
+
if (hasCustomPosition.value) {
|
|
2545
|
+
return void 0;
|
|
2535
2546
|
}
|
|
2536
2547
|
return {
|
|
2537
2548
|
position: strategy.value,
|
|
@@ -2542,29 +2553,24 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
2542
2553
|
width: props.triggerWidth && referenceEl.value ? `${referenceEl.value.offsetWidth}px` : void 0
|
|
2543
2554
|
};
|
|
2544
2555
|
});
|
|
2545
|
-
const side = computed(
|
|
2546
|
-
|
|
2547
|
-
|
|
2556
|
+
const side = computed(
|
|
2557
|
+
() => placement.value.split("-")[0]
|
|
2558
|
+
);
|
|
2559
|
+
const arrowPlacement = computed(() => {
|
|
2560
|
+
var _a, _b, _c, _d, _e;
|
|
2561
|
+
if (hasCustomPosition.value) {
|
|
2562
|
+
return void 0;
|
|
2563
|
+
}
|
|
2564
|
+
const staticSide = {
|
|
2548
2565
|
top: "bottom",
|
|
2549
2566
|
right: "left",
|
|
2550
2567
|
bottom: "top",
|
|
2551
2568
|
left: "right"
|
|
2552
|
-
}
|
|
2553
|
-
);
|
|
2554
|
-
const arrowPlacement = computed(() => {
|
|
2555
|
-
var _a, _b, _c, _d;
|
|
2556
|
-
if ((dropdownCustomPosition == null ? void 0 : dropdownCustomPosition.value) === "true") {
|
|
2557
|
-
return {};
|
|
2558
|
-
}
|
|
2559
|
-
if (["bottom", "top"].includes(staticSide.value)) {
|
|
2560
|
-
return {
|
|
2561
|
-
right: `${((_a = middlewareData.value.arrow) == null ? void 0 : _a.x) ?? 0}px`,
|
|
2562
|
-
[staticSide.value]: `${-(((_b = arrowEl.value) == null ? void 0 : _b.offsetWidth) ?? 0) / 2}px`
|
|
2563
|
-
};
|
|
2564
|
-
}
|
|
2569
|
+
}[side.value];
|
|
2565
2570
|
return {
|
|
2566
|
-
|
|
2567
|
-
|
|
2571
|
+
left: ((_a = middlewareData.value.arrow) == null ? void 0 : _a.x) !== void 0 ? `${(_b = middlewareData.value.arrow) == null ? void 0 : _b.x}px` : void 0,
|
|
2572
|
+
top: ((_c = middlewareData.value.arrow) == null ? void 0 : _c.y) !== void 0 ? `${(_d = middlewareData.value.arrow) == null ? void 0 : _d.y}px` : void 0,
|
|
2573
|
+
[staticSide]: `${-(((_e = arrowEl.value) == null ? void 0 : _e.offsetWidth) ?? 0) / 2}px`
|
|
2568
2574
|
};
|
|
2569
2575
|
});
|
|
2570
2576
|
const modelValue = useVModel(props, "modelValue", emit);
|
|
@@ -2591,7 +2597,13 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
2591
2597
|
const init = (el) => {
|
|
2592
2598
|
referenceEl.value = el;
|
|
2593
2599
|
};
|
|
2594
|
-
__expose({
|
|
2600
|
+
__expose({
|
|
2601
|
+
toggle,
|
|
2602
|
+
show,
|
|
2603
|
+
hide,
|
|
2604
|
+
init,
|
|
2605
|
+
customPosition: hasCustomPosition
|
|
2606
|
+
});
|
|
2595
2607
|
watch(expanded, (newValue) => {
|
|
2596
2608
|
if (newValue && props.autofocusFirst) {
|
|
2597
2609
|
nextTick(() => {
|
|
@@ -2725,11 +2737,33 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
2725
2737
|
htmlEl == null ? void 0 : htmlEl.click();
|
|
2726
2738
|
}
|
|
2727
2739
|
});
|
|
2728
|
-
const
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2740
|
+
const dropdownTransitionHandlers = {
|
|
2741
|
+
"before-enter": () => {
|
|
2742
|
+
emit(expanded.value ? "beforeExpand" : "beforeCollapse");
|
|
2743
|
+
emit("before-enter");
|
|
2744
|
+
},
|
|
2745
|
+
"after-leave": () => {
|
|
2746
|
+
emit(expanded.value ? "afterExpand" : "afterCollapse");
|
|
2747
|
+
emit("after-leave");
|
|
2748
|
+
},
|
|
2749
|
+
enter: () => {
|
|
2750
|
+
emit("enter");
|
|
2751
|
+
},
|
|
2752
|
+
"after-enter": () => {
|
|
2753
|
+
emit("after-enter");
|
|
2754
|
+
},
|
|
2755
|
+
"enter-cancelled": () => {
|
|
2756
|
+
emit("enter-cancelled");
|
|
2757
|
+
},
|
|
2758
|
+
"before-leave": () => {
|
|
2759
|
+
emit("before-leave");
|
|
2760
|
+
},
|
|
2761
|
+
leave: () => {
|
|
2762
|
+
emit("leave");
|
|
2763
|
+
},
|
|
2764
|
+
"leave-cancelled": () => {
|
|
2765
|
+
emit("leave-cancelled");
|
|
2766
|
+
}
|
|
2733
2767
|
};
|
|
2734
2768
|
return (_ctx, _cache) => {
|
|
2735
2769
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
@@ -2739,10 +2773,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
2739
2773
|
]),
|
|
2740
2774
|
_: 3
|
|
2741
2775
|
}),
|
|
2742
|
-
createVNode(Transition, mergeProps({ name: _ctx.transitionName }, toHandlers({
|
|
2743
|
-
beforeEnter: onTransitionBeforeEnter,
|
|
2744
|
-
onAfterLeave: onTransitionAfterLeave
|
|
2745
|
-
})), {
|
|
2776
|
+
createVNode(Transition, mergeProps({ name: _ctx.transitionName }, toHandlers(dropdownTransitionHandlers)), {
|
|
2746
2777
|
default: withCtx(() => [
|
|
2747
2778
|
withDirectives(createElementVNode("div", {
|
|
2748
2779
|
ref_key: "floatingEl",
|
|
@@ -3729,7 +3760,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
3729
3760
|
renderSlot(_ctx.$slots, "dropdown::after", {}, () => {
|
|
3730
3761
|
var _a;
|
|
3731
3762
|
return [
|
|
3732
|
-
((_a = unref(dropdownEl)) == null ? void 0 : _a.
|
|
3763
|
+
((_a = unref(dropdownEl)) == null ? void 0 : _a.customPosition) ? (openBlock(), createBlock(_sfc_main$g, {
|
|
3733
3764
|
key: 0,
|
|
3734
3765
|
label: "Close",
|
|
3735
3766
|
modifiers: "secondary",
|
|
@@ -3805,7 +3836,19 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
3805
3836
|
};
|
|
3806
3837
|
}
|
|
3807
3838
|
});
|
|
3808
|
-
const VvDialogEvents = [
|
|
3839
|
+
const VvDialogEvents = [
|
|
3840
|
+
"open",
|
|
3841
|
+
"close",
|
|
3842
|
+
"update:modelValue",
|
|
3843
|
+
"before-enter",
|
|
3844
|
+
"after-leave",
|
|
3845
|
+
"enter",
|
|
3846
|
+
"after-enter",
|
|
3847
|
+
"enter-cancelled",
|
|
3848
|
+
"before-leave",
|
|
3849
|
+
"leave",
|
|
3850
|
+
"leave-cancelled"
|
|
3851
|
+
];
|
|
3809
3852
|
const VvDialogProps = {
|
|
3810
3853
|
...IdProps,
|
|
3811
3854
|
/**
|
|
@@ -3882,11 +3925,31 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
3882
3925
|
var _a;
|
|
3883
3926
|
(_a = dialogEl.value) == null ? void 0 : _a.showModal();
|
|
3884
3927
|
emit("open");
|
|
3928
|
+
emit("before-enter");
|
|
3885
3929
|
},
|
|
3886
3930
|
"after-leave": () => {
|
|
3887
3931
|
var _a;
|
|
3888
3932
|
(_a = dialogEl.value) == null ? void 0 : _a.close();
|
|
3889
3933
|
emit("close");
|
|
3934
|
+
emit("after-leave");
|
|
3935
|
+
},
|
|
3936
|
+
enter: () => {
|
|
3937
|
+
emit("enter");
|
|
3938
|
+
},
|
|
3939
|
+
"after-enter": () => {
|
|
3940
|
+
emit("after-enter");
|
|
3941
|
+
},
|
|
3942
|
+
"enter-cancelled": () => {
|
|
3943
|
+
emit("enter-cancelled");
|
|
3944
|
+
},
|
|
3945
|
+
"before-leave": () => {
|
|
3946
|
+
emit("before-leave");
|
|
3947
|
+
},
|
|
3948
|
+
leave: () => {
|
|
3949
|
+
emit("leave");
|
|
3950
|
+
},
|
|
3951
|
+
"leave-cancelled": () => {
|
|
3952
|
+
emit("leave-cancelled");
|
|
3890
3953
|
}
|
|
3891
3954
|
};
|
|
3892
3955
|
onClickOutside(modalWrapper, () => {
|