@dao-style/core 0.3.1 → 0.3.2

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.
@@ -17,7 +17,7 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, renderSlot, createCommentVNode, createElementVNode, unref, resolveComponent, Fragment, createBlock, createTextVNode, toDisplayString, ref, inject, watchEffect, mergeProps, provide, readonly, toRefs, createVNode, withCtx, watch, onBeforeUnmount, Transition, withModifiers, normalizeStyle, withDirectives, vShow, withKeys, getCurrentInstance, onMounted, Teleport, nextTick, reactive, resolveDynamicComponent, createSlots, renderList, getCurrentScope, onScopeDispose, vModelText, onUnmounted, h, toRef } from "vue";
20
+ import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, renderSlot, createCommentVNode, createElementVNode, unref, resolveComponent, Fragment, createBlock, createTextVNode, toDisplayString, ref, inject, watchEffect, mergeProps, provide, readonly, toRefs, withKeys, normalizeStyle, withDirectives, vShow, watch, getCurrentInstance, onMounted, onBeforeUnmount, Teleport, createVNode, Transition, withCtx, nextTick, resolveDynamicComponent, createSlots, withModifiers, reactive, renderList, getCurrentScope, onScopeDispose, vModelText, onUnmounted, h, toRef } from "vue";
21
21
  import { isArray as isArray$2, isSet, looseIndexOf, looseEqual, isFunction as isFunction$1, NOOP } from "@vue/shared";
22
22
  import { useI18n } from "vue-i18n";
23
23
  var common = "";
@@ -35,6 +35,10 @@ const _sfc_main$Q = defineComponent({
35
35
  type: String,
36
36
  default: ""
37
37
  },
38
+ size: {
39
+ type: String,
40
+ default: "md"
41
+ },
38
42
  type: {
39
43
  type: String,
40
44
  default: "button",
@@ -60,7 +64,11 @@ const _sfc_main$Q = defineComponent({
60
64
  const _hoisted_1$A = ["disabled"];
61
65
  function _sfc_render$M(_ctx, _cache, $props, $setup, $data, $options) {
62
66
  return openBlock(), createElementBlock("button", {
63
- class: normalizeClass(["dao-action-icon", `dao-action-icon--type-${_ctx.type}`]),
67
+ class: normalizeClass([
68
+ "dao-action-icon",
69
+ `dao-action-icon--type-${_ctx.type}`,
70
+ `dao-action-icon--size-${_ctx.size}`
71
+ ]),
64
72
  disabled: _ctx.realDisabled,
65
73
  onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
66
74
  }, [
@@ -128,7 +136,7 @@ const _hoisted_1$z = {
128
136
  key: 1,
129
137
  class: "dao-icon dao-svg-icon"
130
138
  };
131
- const _hoisted_2$o = ["xlink:href"];
139
+ const _hoisted_2$p = ["xlink:href"];
132
140
  function _sfc_render$L(_ctx, _cache, $props, $setup, $data, $options) {
133
141
  return _ctx.useFont ? (openBlock(), createElementBlock("i", {
134
142
  key: 0,
@@ -136,7 +144,7 @@ function _sfc_render$L(_ctx, _cache, $props, $setup, $data, $options) {
136
144
  }, null, 2)) : (openBlock(), createElementBlock("svg", _hoisted_1$z, [
137
145
  createElementVNode("use", {
138
146
  "xlink:href": `#${_ctx.name}`
139
- }, null, 8, _hoisted_2$o)
147
+ }, null, 8, _hoisted_2$p)
140
148
  ]));
141
149
  }
142
150
  var DaoIcon = /* @__PURE__ */ _export_sfc(_sfc_main$P, [["render", _sfc_render$L]]);
@@ -237,7 +245,7 @@ const _sfc_main$O = defineComponent({
237
245
  }
238
246
  });
239
247
  const _hoisted_1$y = ["disabled"];
240
- const _hoisted_2$n = {
248
+ const _hoisted_2$o = {
241
249
  key: 1,
242
250
  class: "dao-btn__text"
243
251
  };
@@ -255,7 +263,7 @@ function _sfc_render$K(_ctx, _cache, $props, $setup, $data, $options) {
255
263
  "use-font": _ctx.isIconLeftFont,
256
264
  name: _ctx.realIconLeft
257
265
  }, null, 8, ["class", "use-font", "name"])) : createCommentVNode("", true),
258
- _ctx.$slots.default ? (openBlock(), createElementBlock("span", _hoisted_2$n, [
266
+ _ctx.$slots.default ? (openBlock(), createElementBlock("span", _hoisted_2$o, [
259
267
  renderSlot(_ctx.$slots, "default")
260
268
  ])) : createCommentVNode("", true),
261
269
  _ctx.realIconRight ? (openBlock(), createBlock(_component_dao_icon, {
@@ -312,7 +320,7 @@ const _hoisted_1$w = {
312
320
  key: 0,
313
321
  class: "dao-card-header"
314
322
  };
315
- const _hoisted_2$m = {
323
+ const _hoisted_2$n = {
316
324
  key: 0,
317
325
  class: "dao-card-header-item"
318
326
  };
@@ -326,7 +334,7 @@ function _sfc_render$I(_ctx, _cache, $props, $setup, $data, $options) {
326
334
  _ctx.type !== "headless" ? (openBlock(), createElementBlock("div", _hoisted_1$w, [
327
335
  renderSlot(_ctx.$slots, "header", {}, () => [
328
336
  renderSlot(_ctx.$slots, "header-prefix"),
329
- _ctx.icon || _ctx.$slots.icon ? (openBlock(), createElementBlock("div", _hoisted_2$m, [
337
+ _ctx.icon || _ctx.$slots.icon ? (openBlock(), createElementBlock("div", _hoisted_2$n, [
330
338
  renderSlot(_ctx.$slots, "icon", {}, () => [
331
339
  _ctx.icon ? (openBlock(), createBlock(_component_dao_icon, {
332
340
  key: 0,
@@ -558,7 +566,7 @@ const _sfc_main$K = defineComponent({
558
566
  }
559
567
  });
560
568
  const _hoisted_1$u = ["disabled", "indeterminate", "checked"];
561
- const _hoisted_2$l = /* @__PURE__ */ createElementVNode("span", { class: "dao-checkbox-inner" }, null, -1);
569
+ const _hoisted_2$m = /* @__PURE__ */ createElementVNode("span", { class: "dao-checkbox-inner" }, null, -1);
562
570
  const _hoisted_3$d = {
563
571
  key: 0,
564
572
  class: "dao-checkbox__label"
@@ -587,7 +595,7 @@ function _sfc_render$G(_ctx, _cache, $props, $setup, $data, $options) {
587
595
  checked: _ctx.currentChecked,
588
596
  onChange: _cache[0] || (_cache[0] = (...args) => _ctx.change && _ctx.change(...args))
589
597
  }), null, 16, _hoisted_1$u),
590
- _hoisted_2$l
598
+ _hoisted_2$m
591
599
  ], 2),
592
600
  _ctx.hasLabel ? (openBlock(), createElementBlock("span", _hoisted_3$d, [
593
601
  _ctx.$slots.default ? (openBlock(), createElementBlock("span", _hoisted_4$a, [
@@ -645,865 +653,216 @@ function _sfc_render$F(_ctx, _cache, $props, $setup, $data, $options) {
645
653
  ], 2);
646
654
  }
647
655
  var checkboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["render", _sfc_render$F]]);
648
- const _sfc_main$I = defineComponent({
649
- name: "DaoDialogHeader",
650
- components: {
651
- DaoActionIcon
652
- },
653
- props: {
654
- showClose: {
655
- type: Boolean,
656
- default: true
657
- },
658
- title: {
659
- type: String,
660
- default: ""
661
- }
662
- },
663
- emits: ["close"],
664
- setup(props, { emit }) {
665
- const onClose = () => emit("close");
666
- return {
667
- onClose
668
- };
656
+ var top = "top";
657
+ var bottom = "bottom";
658
+ var right = "right";
659
+ var left = "left";
660
+ var auto = "auto";
661
+ var basePlacements = [top, bottom, right, left];
662
+ var start = "start";
663
+ var end = "end";
664
+ var clippingParents = "clippingParents";
665
+ var viewport = "viewport";
666
+ var popper = "popper";
667
+ var reference = "reference";
668
+ var variationPlacements = /* @__PURE__ */ basePlacements.reduce(function(acc, placement) {
669
+ return acc.concat([placement + "-" + start, placement + "-" + end]);
670
+ }, []);
671
+ var placements$1 = /* @__PURE__ */ [].concat(basePlacements, [auto]).reduce(function(acc, placement) {
672
+ return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
673
+ }, []);
674
+ var beforeRead = "beforeRead";
675
+ var read = "read";
676
+ var afterRead = "afterRead";
677
+ var beforeMain = "beforeMain";
678
+ var main = "main";
679
+ var afterMain = "afterMain";
680
+ var beforeWrite = "beforeWrite";
681
+ var write = "write";
682
+ var afterWrite = "afterWrite";
683
+ var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
684
+ function getNodeName(element) {
685
+ return element ? (element.nodeName || "").toLowerCase() : null;
686
+ }
687
+ function getWindow(node) {
688
+ if (node == null) {
689
+ return window;
669
690
  }
670
- });
671
- const _hoisted_1$t = { class: "dao-dialog__header" };
672
- function _sfc_render$E(_ctx, _cache, $props, $setup, $data, $options) {
673
- const _component_dao_action_icon = resolveComponent("dao-action-icon");
674
- return openBlock(), createElementBlock("div", _hoisted_1$t, [
675
- renderSlot(_ctx.$slots, "default", {}, () => [
676
- createElementVNode("span", null, [
677
- renderSlot(_ctx.$slots, "title", {}, () => [
678
- createTextVNode(toDisplayString(_ctx.title), 1)
679
- ])
680
- ]),
681
- _ctx.showClose ? (openBlock(), createBlock(_component_dao_action_icon, {
682
- key: 0,
683
- class: "dao-action-icon--close",
684
- name: "icon-close",
685
- onClick: _ctx.onClose
686
- }, null, 8, ["onClick"])) : createCommentVNode("", true)
687
- ])
688
- ]);
691
+ if (node.toString() !== "[object Window]") {
692
+ var ownerDocument = node.ownerDocument;
693
+ return ownerDocument ? ownerDocument.defaultView || window : window;
694
+ }
695
+ return node;
689
696
  }
690
- var DialogHeader = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["render", _sfc_render$E]]);
691
- const _sfc_main$H = defineComponent({
692
- name: "DaoDialogFooter",
693
- components: {
694
- DaoButton
695
- },
696
- props: {
697
- textConfirm: {
698
- type: String,
699
- default: "\u786E\u5B9A"
700
- },
701
- textCancel: {
702
- type: String,
703
- default: "\u53D6\u6D88"
704
- },
705
- confirmDisabled: {
706
- type: Boolean,
707
- default: false
697
+ function isElement(node) {
698
+ var OwnElement = getWindow(node).Element;
699
+ return node instanceof OwnElement || node instanceof Element;
700
+ }
701
+ function isHTMLElement(node) {
702
+ var OwnElement = getWindow(node).HTMLElement;
703
+ return node instanceof OwnElement || node instanceof HTMLElement;
704
+ }
705
+ function isShadowRoot(node) {
706
+ if (typeof ShadowRoot === "undefined") {
707
+ return false;
708
+ }
709
+ var OwnElement = getWindow(node).ShadowRoot;
710
+ return node instanceof OwnElement || node instanceof ShadowRoot;
711
+ }
712
+ function applyStyles(_ref) {
713
+ var state = _ref.state;
714
+ Object.keys(state.elements).forEach(function(name) {
715
+ var style = state.styles[name] || {};
716
+ var attributes = state.attributes[name] || {};
717
+ var element = state.elements[name];
718
+ if (!isHTMLElement(element) || !getNodeName(element)) {
719
+ return;
708
720
  }
709
- },
710
- emits: ["confirm", "cancel"],
711
- setup(props, { emit }) {
712
- const { confirmDisabled } = toRefs(props);
713
- const onConfirm = () => {
714
- if (!confirmDisabled.value) {
715
- emit("confirm");
721
+ Object.assign(element.style, style);
722
+ Object.keys(attributes).forEach(function(name2) {
723
+ var value = attributes[name2];
724
+ if (value === false) {
725
+ element.removeAttribute(name2);
726
+ } else {
727
+ element.setAttribute(name2, value === true ? "" : value);
716
728
  }
717
- };
718
- const onCancel = () => {
719
- emit("cancel");
720
- };
721
- return {
722
- onConfirm,
723
- onCancel
724
- };
725
- }
726
- });
727
- const _hoisted_1$s = { class: "dao-dialog__footer" };
728
- function _sfc_render$D(_ctx, _cache, $props, $setup, $data, $options) {
729
- const _component_dao_button = resolveComponent("dao-button");
730
- return openBlock(), createElementBlock("div", _hoisted_1$s, [
731
- renderSlot(_ctx.$slots, "default", {}, () => [
732
- createVNode(_component_dao_button, {
733
- type: "ghost",
734
- class: "dao-dialog__footer__cancel-btn",
735
- onClick: _ctx.onCancel
736
- }, {
737
- default: withCtx(() => [
738
- createTextVNode(toDisplayString(_ctx.textCancel), 1)
739
- ]),
740
- _: 1
741
- }, 8, ["onClick"]),
742
- createVNode(_component_dao_button, {
743
- type: "primary",
744
- disabled: _ctx.confirmDisabled,
745
- onClick: _ctx.onConfirm
746
- }, {
747
- default: withCtx(() => [
748
- createTextVNode(toDisplayString(_ctx.textConfirm), 1)
749
- ]),
750
- _: 1
751
- }, 8, ["disabled", "onClick"])
752
- ])
753
- ]);
729
+ });
730
+ });
754
731
  }
755
- var DialogFooter = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["render", _sfc_render$D]]);
756
- var dialog_scss_vue_type_style_index_0_src_lang = "";
757
- const DIALOG_NUM_ATTR = "dao-dialog__num";
758
- const DIALOG_MINIMUM_PADDING = "20px";
759
- const DIALOG_DEFAULT_PADDING_TOP = "100px";
760
- const DIALOG_DEFAULT_PADDING_BOTTOM = "20px";
761
- const KEYBOARD_EVENT_NAME$1 = "keydown";
762
- const _sfc_main$G = defineComponent({
763
- name: "DaoDialog",
764
- components: {
765
- DialogHeader,
766
- DialogFooter
767
- },
768
- props: {
769
- modelValue: {
770
- type: Boolean,
771
- default: false
772
- },
773
- header: {
774
- type: [String, Boolean],
775
- default: ""
776
- },
777
- footer: {
778
- type: Boolean,
779
- default: true
780
- },
781
- size: {
782
- type: String,
783
- default: "md"
784
- },
785
- containerClass: {
786
- type: String,
787
- default: ""
788
- },
789
- closeOnClickOutside: {
790
- type: Boolean,
791
- default: false
792
- },
793
- closeOnPressEscape: {
794
- type: Boolean,
795
- default: true
796
- },
797
- lockScroll: {
798
- type: Boolean,
799
- default: true
800
- },
801
- top: {
802
- type: String,
803
- default: DIALOG_DEFAULT_PADDING_TOP
804
- },
805
- bottom: {
806
- type: String,
807
- default: DIALOG_DEFAULT_PADDING_BOTTOM
808
- },
809
- middle: {
810
- type: Boolean,
811
- default: false
812
- },
813
- textConfirm: {
814
- type: String,
815
- default: void 0
816
- },
817
- textCancel: {
818
- type: String,
819
- default: void 0
732
+ function effect$2(_ref2) {
733
+ var state = _ref2.state;
734
+ var initialStyles = {
735
+ popper: {
736
+ position: state.options.strategy,
737
+ left: "0",
738
+ top: "0",
739
+ margin: "0"
820
740
  },
821
- confirmDisabled: {
822
- type: Boolean,
823
- default: false
741
+ arrow: {
742
+ position: "absolute"
824
743
  },
825
- showClose: {
826
- type: Boolean,
827
- default: true
828
- }
829
- },
830
- emits: [
831
- "change",
832
- "before-open",
833
- "cancel",
834
- "update:modelValue",
835
- "opened",
836
- "confirm",
837
- "before-close",
838
- "closed"
839
- ],
840
- setup(props, { emit }) {
841
- const {
842
- modelValue,
843
- middle,
844
- top: top2,
845
- bottom: bottom2,
846
- containerClass,
847
- size,
848
- header: header2,
849
- lockScroll,
850
- closeOnPressEscape,
851
- closeOnClickOutside
852
- } = toRefs(props);
853
- const { t } = useI18n();
854
- const textContent = computed(() => {
855
- var _a2, _b2;
856
- return {
857
- confirm: (_a2 = props.textConfirm) != null ? _a2 : t("core.dialog.confirm"),
858
- cancel: (_b2 = props.textCancel) != null ? _b2 : t("core.dialog.cancel")
859
- };
860
- });
861
- const computedPaddingTop = computed(() => middle.value ? DIALOG_MINIMUM_PADDING : top2.value);
862
- const computedPaddingBottom = computed(() => middle.value ? DIALOG_MINIMUM_PADDING : bottom2.value);
863
- const computedContainerClass = computed(() => [
864
- containerClass.value,
865
- `dao-dialog--size-${size.value}`
866
- ]);
867
- const showHeader = computed(() => typeof header2.value === "boolean" ? header2.value : true);
868
- const headerTitle = computed(() => typeof header2.value === "string" ? header2.value : "");
869
- watch(modelValue, (newV) => {
870
- emit("change", newV);
871
- });
872
- const lockWindowScroll = () => {
873
- if (!lockScroll.value) {
874
- return;
875
- }
876
- const bodyDialogNum = Number(document.body.getAttribute(DIALOG_NUM_ATTR) || 0);
877
- document.body.setAttribute(DIALOG_NUM_ATTR, String(bodyDialogNum + 1));
878
- document.body.style.overflow = "hidden";
879
- };
880
- const onClose = () => {
881
- emit("update:modelValue", false);
882
- };
883
- const onCancel = () => {
884
- emit("cancel");
885
- onClose();
886
- };
887
- const onKeyDown = (event) => {
888
- if (event.code === "Escape" && closeOnPressEscape.value) {
889
- onCancel();
890
- }
891
- };
892
- const unLockWindowScroll = () => {
893
- if (!lockScroll.value) {
744
+ reference: {}
745
+ };
746
+ Object.assign(state.elements.popper.style, initialStyles.popper);
747
+ state.styles = initialStyles;
748
+ if (state.elements.arrow) {
749
+ Object.assign(state.elements.arrow.style, initialStyles.arrow);
750
+ }
751
+ return function() {
752
+ Object.keys(state.elements).forEach(function(name) {
753
+ var element = state.elements[name];
754
+ var attributes = state.attributes[name] || {};
755
+ var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]);
756
+ var style = styleProperties.reduce(function(style2, property) {
757
+ style2[property] = "";
758
+ return style2;
759
+ }, {});
760
+ if (!isHTMLElement(element) || !getNodeName(element)) {
894
761
  return;
895
762
  }
896
- const specDialogNum = Number(document.body.getAttribute(DIALOG_NUM_ATTR)) - 1;
897
- if (specDialogNum < 1) {
898
- document.body.removeAttribute(DIALOG_NUM_ATTR);
899
- document.body.style.overflow = "";
900
- } else {
901
- document.body.setAttribute(DIALOG_NUM_ATTR, String(specDialogNum));
902
- }
903
- };
904
- let currentDialogOpened = false;
905
- const onBeforeEnter = () => {
906
- document.addEventListener(KEYBOARD_EVENT_NAME$1, onKeyDown);
907
- lockWindowScroll();
908
- currentDialogOpened = true;
909
- emit("before-open");
910
- };
911
- const onAfterEnter = () => {
912
- emit("opened");
913
- };
914
- const onConfirm = () => {
915
- emit("confirm");
916
- onClose();
917
- };
918
- const onWrapperMousedown = () => {
919
- if (closeOnClickOutside.value) {
920
- onCancel();
921
- }
922
- };
923
- const onBeforeLeave = () => {
924
- emit("before-close");
925
- };
926
- const onAfterLeave = () => {
927
- document.removeEventListener(KEYBOARD_EVENT_NAME$1, onKeyDown);
928
- unLockWindowScroll();
929
- currentDialogOpened = false;
930
- emit("closed");
931
- };
932
- onBeforeUnmount(() => {
933
- if (currentDialogOpened) {
934
- onAfterLeave();
935
- }
763
+ Object.assign(element.style, style);
764
+ Object.keys(attributes).forEach(function(attribute) {
765
+ element.removeAttribute(attribute);
766
+ });
936
767
  });
937
- return {
938
- computedPaddingTop,
939
- computedPaddingBottom,
940
- computedContainerClass,
941
- headerTitle,
942
- showHeader,
943
- textContent,
944
- onBeforeEnter,
945
- onAfterEnter,
946
- onConfirm,
947
- onCancel,
948
- onWrapperMousedown,
949
- onBeforeLeave,
950
- onAfterLeave
951
- };
952
- }
953
- });
954
- const _hoisted_1$r = { class: "dao-dialog__body" };
955
- function _sfc_render$C(_ctx, _cache, $props, $setup, $data, $options) {
956
- const _component_dialog_header = resolveComponent("dialog-header");
957
- const _component_dialog_footer = resolveComponent("dialog-footer");
958
- return openBlock(), createBlock(Transition, {
959
- appear: "",
960
- name: "dao-dialog",
961
- onBeforeEnter: _ctx.onBeforeEnter,
962
- onAfterEnter: _ctx.onAfterEnter,
963
- onBeforeLeave: _ctx.onBeforeLeave,
964
- onAfterLeave: _ctx.onAfterLeave
965
- }, {
966
- default: withCtx(() => [
967
- _ctx.modelValue ? (openBlock(), createElementBlock("div", {
968
- key: 0,
969
- class: normalizeClass(["dao-dialog__backdrop", { "dao-dialog__backdrop--middle": _ctx.middle }]),
970
- onMousedown: _cache[0] || (_cache[0] = withModifiers((...args) => _ctx.onWrapperMousedown && _ctx.onWrapperMousedown(...args), ["self"]))
971
- }, [
972
- createElementVNode("div", {
973
- class: normalizeClass(["dao-dialog__container", _ctx.computedContainerClass]),
974
- style: normalizeStyle({
975
- "margin-top": _ctx.computedPaddingTop,
976
- "margin-bottom": _ctx.computedPaddingBottom
977
- })
978
- }, [
979
- _ctx.showHeader ? (openBlock(), createBlock(_component_dialog_header, {
980
- key: 0,
981
- title: _ctx.headerTitle,
982
- "show-close": _ctx.showClose,
983
- onClose: _ctx.onCancel
984
- }, {
985
- default: withCtx(() => [
986
- renderSlot(_ctx.$slots, "header")
987
- ]),
988
- _: 3
989
- }, 8, ["title", "show-close", "onClose"])) : createCommentVNode("", true),
990
- createElementVNode("div", _hoisted_1$r, [
991
- renderSlot(_ctx.$slots, "default")
992
- ]),
993
- _ctx.footer ? (openBlock(), createBlock(_component_dialog_footer, {
994
- key: 1,
995
- "text-confirm": _ctx.textContent.confirm,
996
- "text-cancel": _ctx.textContent.cancel,
997
- "confirm-disabled": _ctx.confirmDisabled,
998
- onConfirm: _ctx.onConfirm,
999
- onCancel: _ctx.onCancel
1000
- }, {
1001
- default: withCtx(() => [
1002
- renderSlot(_ctx.$slots, "footer")
1003
- ]),
1004
- _: 3
1005
- }, 8, ["text-confirm", "text-cancel", "confirm-disabled", "onConfirm", "onCancel"])) : createCommentVNode("", true)
1006
- ], 6)
1007
- ], 34)) : createCommentVNode("", true)
1008
- ]),
1009
- _: 3
1010
- }, 8, ["onBeforeEnter", "onAfterEnter", "onBeforeLeave", "onAfterLeave"]);
768
+ };
1011
769
  }
1012
- var dialog = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["render", _sfc_render$C]]);
1013
- const drawerProps = {
1014
- modelValue: {
1015
- type: Boolean,
1016
- default: false
1017
- },
1018
- hideHeader: {
1019
- type: Boolean,
1020
- default: false
1021
- },
1022
- hideFooter: {
1023
- type: Boolean,
1024
- default: false
1025
- },
1026
- hideMask: {
1027
- type: Boolean,
1028
- default: false
1029
- },
1030
- hideCloseIcon: {
1031
- type: Boolean,
1032
- default: false
1033
- },
1034
- title: {
1035
- type: String,
1036
- default: ""
1037
- },
1038
- size: {
1039
- type: String,
1040
- default: "md"
1041
- },
1042
- cancelText: {
1043
- type: String,
1044
- default: void 0
1045
- },
1046
- confirmText: {
1047
- type: String,
1048
- default: void 0
1049
- }
770
+ var applyStyles$1 = {
771
+ name: "applyStyles",
772
+ enabled: true,
773
+ phase: "write",
774
+ fn: applyStyles,
775
+ effect: effect$2,
776
+ requires: ["computeStyles"]
1050
777
  };
1051
- const getFocusElementRange = (elementNode) => {
1052
- const focusedElementOrigin = document.activeElement;
1053
- let firstTab = null;
1054
- let lastTab = null;
1055
- const focusableElementsString = 'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [tabindex="0"], [contenteditable]';
1056
- if (elementNode) {
1057
- const focusableElements = Array.from(elementNode.querySelectorAll(focusableElementsString));
1058
- firstTab = focusableElements[0];
1059
- lastTab = focusableElements[focusableElements.length - 1];
1060
- firstTab == null ? void 0 : firstTab.focus();
1061
- }
1062
- return {
1063
- lastTab,
1064
- firstTab,
1065
- focusedElementOrigin
778
+ function getBasePlacement(placement) {
779
+ return placement.split("-")[0];
780
+ }
781
+ function getBoundingClientRect(element, includeScale) {
782
+ var rect = element.getBoundingClientRect();
783
+ var scaleX = 1;
784
+ var scaleY = 1;
785
+ return {
786
+ width: rect.width / scaleX,
787
+ height: rect.height / scaleY,
788
+ top: rect.top / scaleY,
789
+ right: rect.right / scaleX,
790
+ bottom: rect.bottom / scaleY,
791
+ left: rect.left / scaleX,
792
+ x: rect.left / scaleX,
793
+ y: rect.top / scaleY
1066
794
  };
1067
- };
1068
- const trapTabKey = (e, firstTab, lastTab) => {
1069
- if (e.code === "Tab") {
1070
- if (e.shiftKey) {
1071
- if (document.activeElement === firstTab) {
1072
- e.preventDefault();
1073
- lastTab.focus();
795
+ }
796
+ function getLayoutRect(element) {
797
+ var clientRect = getBoundingClientRect(element);
798
+ var width = element.offsetWidth;
799
+ var height = element.offsetHeight;
800
+ if (Math.abs(clientRect.width - width) <= 1) {
801
+ width = clientRect.width;
802
+ }
803
+ if (Math.abs(clientRect.height - height) <= 1) {
804
+ height = clientRect.height;
805
+ }
806
+ return {
807
+ x: element.offsetLeft,
808
+ y: element.offsetTop,
809
+ width,
810
+ height
811
+ };
812
+ }
813
+ function contains(parent, child) {
814
+ var rootNode = child.getRootNode && child.getRootNode();
815
+ if (parent.contains(child)) {
816
+ return true;
817
+ } else if (rootNode && isShadowRoot(rootNode)) {
818
+ var next = child;
819
+ do {
820
+ if (next && parent.isSameNode(next)) {
821
+ return true;
1074
822
  }
1075
- } else if (document.activeElement === lastTab) {
1076
- e.preventDefault();
1077
- firstTab.focus();
823
+ next = next.parentNode || next.host;
824
+ } while (next);
825
+ }
826
+ return false;
827
+ }
828
+ function getComputedStyle(element) {
829
+ return getWindow(element).getComputedStyle(element);
830
+ }
831
+ function isTableElement(element) {
832
+ return ["table", "td", "th"].indexOf(getNodeName(element)) >= 0;
833
+ }
834
+ function getDocumentElement(element) {
835
+ return ((isElement(element) ? element.ownerDocument : element.document) || window.document).documentElement;
836
+ }
837
+ function getParentNode(element) {
838
+ if (getNodeName(element) === "html") {
839
+ return element;
840
+ }
841
+ return element.assignedSlot || element.parentNode || (isShadowRoot(element) ? element.host : null) || getDocumentElement(element);
842
+ }
843
+ function getTrueOffsetParent(element) {
844
+ if (!isHTMLElement(element) || getComputedStyle(element).position === "fixed") {
845
+ return null;
846
+ }
847
+ return element.offsetParent;
848
+ }
849
+ function getContainingBlock(element) {
850
+ var isFirefox = navigator.userAgent.toLowerCase().indexOf("firefox") !== -1;
851
+ var isIE = navigator.userAgent.indexOf("Trident") !== -1;
852
+ if (isIE && isHTMLElement(element)) {
853
+ var elementCss = getComputedStyle(element);
854
+ if (elementCss.position === "fixed") {
855
+ return null;
1078
856
  }
1079
857
  }
1080
- };
1081
- var drawer_vue_vue_type_style_index_0_lang = "";
1082
- const KEYBOARD_EVENT_NAME = "keydown";
1083
- const _sfc_main$F = defineComponent({
1084
- name: "DaoDrawer",
1085
- components: {
1086
- DaoButton,
1087
- DaoActionIcon
1088
- },
1089
- props: drawerProps,
1090
- emits: ["update:modelValue", "close", "confirm"],
1091
- setup(props, { emit }) {
1092
- const { t } = useI18n();
1093
- const { modelValue, size } = toRefs(props);
1094
- const visible = ref(false);
1095
- const wrapVisible = ref(false);
1096
- const drawerRef = ref(null);
1097
- const textContent = computed(() => {
1098
- var _a2, _b2;
1099
- return {
1100
- confirm: (_a2 = props.confirmText) != null ? _a2 : t("core.drawer.confirm"),
1101
- cancel: (_b2 = props.cancelText) != null ? _b2 : t("core.drawer.cancel")
1102
- };
1103
- });
1104
- let focusElement = {
1105
- firstTab: null,
1106
- lastTab: null,
1107
- focusedElementOrigin: null
1108
- };
1109
- const wrapClassList = computed(() => [
1110
- "dao-drawer__wrap",
1111
- {
1112
- "dao-drawer__wrap--hide": !wrapVisible.value
1113
- }
1114
- ]);
1115
- const contentClassList = computed(() => [
1116
- "dao-drawer",
1117
- `dao-drawer-${size.value}`
1118
- ]);
1119
- const checkMasksVisible = () => {
1120
- const masks = document.getElementsByClassName("dao-drawer__mask") || [];
1121
- return !Array.from(masks).some((v) => v.style.display === "");
1122
- };
1123
- const lockWindowScroll = () => {
1124
- document.body.style.overflow = "hidden";
1125
- document.body.tabIndex = -1;
1126
- };
1127
- const unLockWindowScroll = () => {
1128
- if (checkMasksVisible()) {
1129
- document.body.style.overflow = "";
1130
- }
1131
- };
1132
- const close = () => {
1133
- visible.value = false;
1134
- emit("update:modelValue", false);
1135
- emit("close");
1136
- };
1137
- const handleWrapClick = (event) => {
1138
- const { target } = event;
1139
- const className = target.getAttribute("class");
1140
- if (className && className.indexOf("dao-drawer__wrap") > -1) {
1141
- close();
1142
- }
1143
- };
1144
- const handleWrapVisible = (v) => {
1145
- if (!v) {
1146
- setTimeout(() => {
1147
- wrapVisible.value = v;
1148
- }, 100);
1149
- } else {
1150
- wrapVisible.value = v;
1151
- }
1152
- };
1153
- const confirm = () => {
1154
- visible.value = false;
1155
- emit("update:modelValue", false);
1156
- emit("confirm");
1157
- };
1158
- const setLastFocusElement = () => {
1159
- if (focusElement.focusedElementOrigin instanceof HTMLElement) {
1160
- focusElement.focusedElementOrigin.focus();
1161
- }
1162
- };
1163
- const onHandleKeyDown = (e) => {
1164
- if (e.code === "Escape") {
1165
- close();
1166
- }
1167
- if (!focusElement.firstTab || !focusElement.lastTab) {
1168
- return;
1169
- }
1170
- trapTabKey(e, focusElement.firstTab, focusElement.lastTab);
1171
- };
1172
- const onBeforeEnter = () => {
1173
- focusElement = getFocusElementRange(drawerRef.value);
1174
- lockWindowScroll();
1175
- document.addEventListener(KEYBOARD_EVENT_NAME, onHandleKeyDown);
1176
- };
1177
- const onAfterLeave = () => {
1178
- setLastFocusElement();
1179
- unLockWindowScroll();
1180
- document.removeEventListener(KEYBOARD_EVENT_NAME, onHandleKeyDown);
1181
- };
1182
- watch(modelValue, (v) => {
1183
- visible.value = v;
1184
- handleWrapVisible(v);
1185
- }, { immediate: true });
1186
- return {
1187
- visible,
1188
- drawerRef,
1189
- wrapClassList,
1190
- contentClassList,
1191
- textContent,
1192
- close,
1193
- confirm,
1194
- handleWrapClick,
1195
- onBeforeEnter,
1196
- onAfterLeave
1197
- };
1198
- }
1199
- });
1200
- const _hoisted_1$q = { class: "dao-drawer__content" };
1201
- const _hoisted_2$k = {
1202
- key: 0,
1203
- class: "dao-drawer__header"
1204
- };
1205
- const _hoisted_3$c = { class: "dao-drawer__header-group" };
1206
- const _hoisted_4$9 = { class: "dao-drawer__body" };
1207
- const _hoisted_5$7 = {
1208
- key: 1,
1209
- class: "dao-drawer__footer"
1210
- };
1211
- const _hoisted_6$5 = { class: "dao-drawer__footer-group" };
1212
- function _sfc_render$B(_ctx, _cache, $props, $setup, $data, $options) {
1213
- const _component_dao_action_icon = resolveComponent("dao-action-icon");
1214
- const _component_dao_button = resolveComponent("dao-button");
1215
- return openBlock(), createElementBlock("div", null, [
1216
- createVNode(Transition, { name: "fade-in" }, {
1217
- default: withCtx(() => [
1218
- !_ctx.hideMask ? withDirectives((openBlock(), createElementBlock("div", {
1219
- key: 0,
1220
- class: "dao-drawer__mask",
1221
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.close && _ctx.close(...args)),
1222
- onKeydown: _cache[1] || (_cache[1] = (...args) => _ctx.close && _ctx.close(...args))
1223
- }, null, 544)), [
1224
- [vShow, _ctx.visible]
1225
- ]) : createCommentVNode("", true)
1226
- ]),
1227
- _: 1
1228
- }),
1229
- createElementVNode("div", {
1230
- ref: "drawerRef",
1231
- class: normalizeClass(_ctx.wrapClassList),
1232
- onClick: _cache[2] || (_cache[2] = (...args) => _ctx.handleWrapClick && _ctx.handleWrapClick(...args)),
1233
- onKeydown: _cache[3] || (_cache[3] = (...args) => _ctx.handleWrapClick && _ctx.handleWrapClick(...args))
1234
- }, [
1235
- createVNode(Transition, {
1236
- name: "slide-in-right",
1237
- onAfterEnter: _ctx.onBeforeEnter,
1238
- onAfterLeave: _ctx.onAfterLeave
1239
- }, {
1240
- default: withCtx(() => [
1241
- withDirectives(createElementVNode("div", {
1242
- class: normalizeClass(_ctx.contentClassList)
1243
- }, [
1244
- createElementVNode("div", _hoisted_1$q, [
1245
- !_ctx.hideHeader ? (openBlock(), createElementBlock("div", _hoisted_2$k, [
1246
- renderSlot(_ctx.$slots, "header", {}, () => [
1247
- createElementVNode("div", _hoisted_3$c, [
1248
- createElementVNode("span", null, toDisplayString(_ctx.title), 1),
1249
- !_ctx.hideCloseIcon ? (openBlock(), createBlock(_component_dao_action_icon, {
1250
- key: 0,
1251
- class: "dao-action-icon--close",
1252
- name: "icon-close",
1253
- onClick: _ctx.close
1254
- }, null, 8, ["onClick"])) : createCommentVNode("", true)
1255
- ])
1256
- ])
1257
- ])) : createCommentVNode("", true),
1258
- createElementVNode("div", _hoisted_4$9, [
1259
- renderSlot(_ctx.$slots, "default")
1260
- ]),
1261
- !_ctx.hideFooter ? (openBlock(), createElementBlock("div", _hoisted_5$7, [
1262
- renderSlot(_ctx.$slots, "footer", {}, () => [
1263
- createElementVNode("div", _hoisted_6$5, [
1264
- createVNode(_component_dao_button, {
1265
- type: "ghost",
1266
- class: "footer-cancel-btn footer-btn",
1267
- onClick: _ctx.close
1268
- }, {
1269
- default: withCtx(() => [
1270
- createTextVNode(toDisplayString(_ctx.textContent.cancel), 1)
1271
- ]),
1272
- _: 1
1273
- }, 8, ["onClick"]),
1274
- createVNode(_component_dao_button, {
1275
- class: "footer-btn",
1276
- onClick: _ctx.confirm
1277
- }, {
1278
- default: withCtx(() => [
1279
- createTextVNode(toDisplayString(_ctx.textContent.confirm), 1)
1280
- ]),
1281
- _: 1
1282
- }, 8, ["onClick"])
1283
- ])
1284
- ])
1285
- ])) : createCommentVNode("", true)
1286
- ])
1287
- ], 2), [
1288
- [vShow, _ctx.visible]
1289
- ])
1290
- ]),
1291
- _: 3
1292
- }, 8, ["onAfterEnter", "onAfterLeave"])
1293
- ], 34)
1294
- ]);
1295
- }
1296
- var drawer = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["render", _sfc_render$B]]);
1297
- var top = "top";
1298
- var bottom = "bottom";
1299
- var right = "right";
1300
- var left = "left";
1301
- var auto = "auto";
1302
- var basePlacements = [top, bottom, right, left];
1303
- var start = "start";
1304
- var end = "end";
1305
- var clippingParents = "clippingParents";
1306
- var viewport = "viewport";
1307
- var popper = "popper";
1308
- var reference = "reference";
1309
- var variationPlacements = /* @__PURE__ */ basePlacements.reduce(function(acc, placement) {
1310
- return acc.concat([placement + "-" + start, placement + "-" + end]);
1311
- }, []);
1312
- var placements$1 = /* @__PURE__ */ [].concat(basePlacements, [auto]).reduce(function(acc, placement) {
1313
- return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
1314
- }, []);
1315
- var beforeRead = "beforeRead";
1316
- var read = "read";
1317
- var afterRead = "afterRead";
1318
- var beforeMain = "beforeMain";
1319
- var main = "main";
1320
- var afterMain = "afterMain";
1321
- var beforeWrite = "beforeWrite";
1322
- var write = "write";
1323
- var afterWrite = "afterWrite";
1324
- var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
1325
- function getNodeName(element) {
1326
- return element ? (element.nodeName || "").toLowerCase() : null;
1327
- }
1328
- function getWindow(node) {
1329
- if (node == null) {
1330
- return window;
1331
- }
1332
- if (node.toString() !== "[object Window]") {
1333
- var ownerDocument = node.ownerDocument;
1334
- return ownerDocument ? ownerDocument.defaultView || window : window;
1335
- }
1336
- return node;
1337
- }
1338
- function isElement(node) {
1339
- var OwnElement = getWindow(node).Element;
1340
- return node instanceof OwnElement || node instanceof Element;
1341
- }
1342
- function isHTMLElement(node) {
1343
- var OwnElement = getWindow(node).HTMLElement;
1344
- return node instanceof OwnElement || node instanceof HTMLElement;
1345
- }
1346
- function isShadowRoot(node) {
1347
- if (typeof ShadowRoot === "undefined") {
1348
- return false;
1349
- }
1350
- var OwnElement = getWindow(node).ShadowRoot;
1351
- return node instanceof OwnElement || node instanceof ShadowRoot;
1352
- }
1353
- function applyStyles(_ref) {
1354
- var state = _ref.state;
1355
- Object.keys(state.elements).forEach(function(name) {
1356
- var style = state.styles[name] || {};
1357
- var attributes = state.attributes[name] || {};
1358
- var element = state.elements[name];
1359
- if (!isHTMLElement(element) || !getNodeName(element)) {
1360
- return;
1361
- }
1362
- Object.assign(element.style, style);
1363
- Object.keys(attributes).forEach(function(name2) {
1364
- var value = attributes[name2];
1365
- if (value === false) {
1366
- element.removeAttribute(name2);
1367
- } else {
1368
- element.setAttribute(name2, value === true ? "" : value);
1369
- }
1370
- });
1371
- });
1372
- }
1373
- function effect$2(_ref2) {
1374
- var state = _ref2.state;
1375
- var initialStyles = {
1376
- popper: {
1377
- position: state.options.strategy,
1378
- left: "0",
1379
- top: "0",
1380
- margin: "0"
1381
- },
1382
- arrow: {
1383
- position: "absolute"
1384
- },
1385
- reference: {}
1386
- };
1387
- Object.assign(state.elements.popper.style, initialStyles.popper);
1388
- state.styles = initialStyles;
1389
- if (state.elements.arrow) {
1390
- Object.assign(state.elements.arrow.style, initialStyles.arrow);
1391
- }
1392
- return function() {
1393
- Object.keys(state.elements).forEach(function(name) {
1394
- var element = state.elements[name];
1395
- var attributes = state.attributes[name] || {};
1396
- var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]);
1397
- var style = styleProperties.reduce(function(style2, property) {
1398
- style2[property] = "";
1399
- return style2;
1400
- }, {});
1401
- if (!isHTMLElement(element) || !getNodeName(element)) {
1402
- return;
1403
- }
1404
- Object.assign(element.style, style);
1405
- Object.keys(attributes).forEach(function(attribute) {
1406
- element.removeAttribute(attribute);
1407
- });
1408
- });
1409
- };
1410
- }
1411
- var applyStyles$1 = {
1412
- name: "applyStyles",
1413
- enabled: true,
1414
- phase: "write",
1415
- fn: applyStyles,
1416
- effect: effect$2,
1417
- requires: ["computeStyles"]
1418
- };
1419
- function getBasePlacement(placement) {
1420
- return placement.split("-")[0];
1421
- }
1422
- function getBoundingClientRect(element, includeScale) {
1423
- var rect = element.getBoundingClientRect();
1424
- var scaleX = 1;
1425
- var scaleY = 1;
1426
- return {
1427
- width: rect.width / scaleX,
1428
- height: rect.height / scaleY,
1429
- top: rect.top / scaleY,
1430
- right: rect.right / scaleX,
1431
- bottom: rect.bottom / scaleY,
1432
- left: rect.left / scaleX,
1433
- x: rect.left / scaleX,
1434
- y: rect.top / scaleY
1435
- };
1436
- }
1437
- function getLayoutRect(element) {
1438
- var clientRect = getBoundingClientRect(element);
1439
- var width = element.offsetWidth;
1440
- var height = element.offsetHeight;
1441
- if (Math.abs(clientRect.width - width) <= 1) {
1442
- width = clientRect.width;
1443
- }
1444
- if (Math.abs(clientRect.height - height) <= 1) {
1445
- height = clientRect.height;
1446
- }
1447
- return {
1448
- x: element.offsetLeft,
1449
- y: element.offsetTop,
1450
- width,
1451
- height
1452
- };
1453
- }
1454
- function contains(parent, child) {
1455
- var rootNode = child.getRootNode && child.getRootNode();
1456
- if (parent.contains(child)) {
1457
- return true;
1458
- } else if (rootNode && isShadowRoot(rootNode)) {
1459
- var next = child;
1460
- do {
1461
- if (next && parent.isSameNode(next)) {
1462
- return true;
1463
- }
1464
- next = next.parentNode || next.host;
1465
- } while (next);
1466
- }
1467
- return false;
1468
- }
1469
- function getComputedStyle(element) {
1470
- return getWindow(element).getComputedStyle(element);
1471
- }
1472
- function isTableElement(element) {
1473
- return ["table", "td", "th"].indexOf(getNodeName(element)) >= 0;
1474
- }
1475
- function getDocumentElement(element) {
1476
- return ((isElement(element) ? element.ownerDocument : element.document) || window.document).documentElement;
1477
- }
1478
- function getParentNode(element) {
1479
- if (getNodeName(element) === "html") {
1480
- return element;
1481
- }
1482
- return element.assignedSlot || element.parentNode || (isShadowRoot(element) ? element.host : null) || getDocumentElement(element);
1483
- }
1484
- function getTrueOffsetParent(element) {
1485
- if (!isHTMLElement(element) || getComputedStyle(element).position === "fixed") {
1486
- return null;
1487
- }
1488
- return element.offsetParent;
1489
- }
1490
- function getContainingBlock(element) {
1491
- var isFirefox = navigator.userAgent.toLowerCase().indexOf("firefox") !== -1;
1492
- var isIE = navigator.userAgent.indexOf("Trident") !== -1;
1493
- if (isIE && isHTMLElement(element)) {
1494
- var elementCss = getComputedStyle(element);
1495
- if (elementCss.position === "fixed") {
1496
- return null;
1497
- }
1498
- }
1499
- var currentNode = getParentNode(element);
1500
- while (isHTMLElement(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) {
1501
- var css = getComputedStyle(currentNode);
1502
- if (css.transform !== "none" || css.perspective !== "none" || css.contain === "paint" || ["transform", "perspective"].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === "filter" || isFirefox && css.filter && css.filter !== "none") {
1503
- return currentNode;
1504
- } else {
1505
- currentNode = currentNode.parentNode;
1506
- }
858
+ var currentNode = getParentNode(element);
859
+ while (isHTMLElement(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) {
860
+ var css = getComputedStyle(currentNode);
861
+ if (css.transform !== "none" || css.perspective !== "none" || css.contain === "paint" || ["transform", "perspective"].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === "filter" || isFirefox && css.filter && css.filter !== "none") {
862
+ return currentNode;
863
+ } else {
864
+ currentNode = currentNode.parentNode;
865
+ }
1507
866
  }
1508
867
  return null;
1509
868
  }
@@ -2313,800 +1672,1657 @@ function order(modifiers) {
2313
1672
  }
2314
1673
  }
2315
1674
  });
2316
- result.push(modifier);
2317
- }
2318
- modifiers.forEach(function(modifier) {
2319
- if (!visited.has(modifier.name)) {
2320
- sort(modifier);
2321
- }
2322
- });
2323
- return result;
2324
- }
2325
- function orderModifiers(modifiers) {
2326
- var orderedModifiers = order(modifiers);
2327
- return modifierPhases.reduce(function(acc, phase) {
2328
- return acc.concat(orderedModifiers.filter(function(modifier) {
2329
- return modifier.phase === phase;
2330
- }));
2331
- }, []);
2332
- }
2333
- function debounce(fn2) {
2334
- var pending;
2335
- return function() {
2336
- if (!pending) {
2337
- pending = new Promise(function(resolve) {
2338
- Promise.resolve().then(function() {
2339
- pending = void 0;
2340
- resolve(fn2());
1675
+ result.push(modifier);
1676
+ }
1677
+ modifiers.forEach(function(modifier) {
1678
+ if (!visited.has(modifier.name)) {
1679
+ sort(modifier);
1680
+ }
1681
+ });
1682
+ return result;
1683
+ }
1684
+ function orderModifiers(modifiers) {
1685
+ var orderedModifiers = order(modifiers);
1686
+ return modifierPhases.reduce(function(acc, phase) {
1687
+ return acc.concat(orderedModifiers.filter(function(modifier) {
1688
+ return modifier.phase === phase;
1689
+ }));
1690
+ }, []);
1691
+ }
1692
+ function debounce(fn2) {
1693
+ var pending;
1694
+ return function() {
1695
+ if (!pending) {
1696
+ pending = new Promise(function(resolve) {
1697
+ Promise.resolve().then(function() {
1698
+ pending = void 0;
1699
+ resolve(fn2());
1700
+ });
1701
+ });
1702
+ }
1703
+ return pending;
1704
+ };
1705
+ }
1706
+ function mergeByName(modifiers) {
1707
+ var merged = modifiers.reduce(function(merged2, current) {
1708
+ var existing = merged2[current.name];
1709
+ merged2[current.name] = existing ? Object.assign({}, existing, current, {
1710
+ options: Object.assign({}, existing.options, current.options),
1711
+ data: Object.assign({}, existing.data, current.data)
1712
+ }) : current;
1713
+ return merged2;
1714
+ }, {});
1715
+ return Object.keys(merged).map(function(key) {
1716
+ return merged[key];
1717
+ });
1718
+ }
1719
+ var DEFAULT_OPTIONS = {
1720
+ placement: "bottom",
1721
+ modifiers: [],
1722
+ strategy: "absolute"
1723
+ };
1724
+ function areValidElements() {
1725
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1726
+ args[_key] = arguments[_key];
1727
+ }
1728
+ return !args.some(function(element) {
1729
+ return !(element && typeof element.getBoundingClientRect === "function");
1730
+ });
1731
+ }
1732
+ function popperGenerator(generatorOptions) {
1733
+ if (generatorOptions === void 0) {
1734
+ generatorOptions = {};
1735
+ }
1736
+ var _generatorOptions = generatorOptions, _generatorOptions$def = _generatorOptions.defaultModifiers, defaultModifiers2 = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, _generatorOptions$def2 = _generatorOptions.defaultOptions, defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
1737
+ return function createPopper2(reference2, popper2, options) {
1738
+ if (options === void 0) {
1739
+ options = defaultOptions;
1740
+ }
1741
+ var state = {
1742
+ placement: "bottom",
1743
+ orderedModifiers: [],
1744
+ options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
1745
+ modifiersData: {},
1746
+ elements: {
1747
+ reference: reference2,
1748
+ popper: popper2
1749
+ },
1750
+ attributes: {},
1751
+ styles: {}
1752
+ };
1753
+ var effectCleanupFns = [];
1754
+ var isDestroyed = false;
1755
+ var instance = {
1756
+ state,
1757
+ setOptions: function setOptions(setOptionsAction) {
1758
+ var options2 = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction;
1759
+ cleanupModifierEffects();
1760
+ state.options = Object.assign({}, defaultOptions, state.options, options2);
1761
+ state.scrollParents = {
1762
+ reference: isElement(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
1763
+ popper: listScrollParents(popper2)
1764
+ };
1765
+ var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers2, state.options.modifiers)));
1766
+ state.orderedModifiers = orderedModifiers.filter(function(m) {
1767
+ return m.enabled;
1768
+ });
1769
+ runModifierEffects();
1770
+ return instance.update();
1771
+ },
1772
+ forceUpdate: function forceUpdate() {
1773
+ if (isDestroyed) {
1774
+ return;
1775
+ }
1776
+ var _state$elements = state.elements, reference3 = _state$elements.reference, popper3 = _state$elements.popper;
1777
+ if (!areValidElements(reference3, popper3)) {
1778
+ return;
1779
+ }
1780
+ state.rects = {
1781
+ reference: getCompositeRect(reference3, getOffsetParent(popper3), state.options.strategy === "fixed"),
1782
+ popper: getLayoutRect(popper3)
1783
+ };
1784
+ state.reset = false;
1785
+ state.placement = state.options.placement;
1786
+ state.orderedModifiers.forEach(function(modifier) {
1787
+ return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
1788
+ });
1789
+ for (var index2 = 0; index2 < state.orderedModifiers.length; index2++) {
1790
+ if (state.reset === true) {
1791
+ state.reset = false;
1792
+ index2 = -1;
1793
+ continue;
1794
+ }
1795
+ var _state$orderedModifie = state.orderedModifiers[index2], fn2 = _state$orderedModifie.fn, _state$orderedModifie2 = _state$orderedModifie.options, _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2, name = _state$orderedModifie.name;
1796
+ if (typeof fn2 === "function") {
1797
+ state = fn2({
1798
+ state,
1799
+ options: _options,
1800
+ name,
1801
+ instance
1802
+ }) || state;
1803
+ }
1804
+ }
1805
+ },
1806
+ update: debounce(function() {
1807
+ return new Promise(function(resolve) {
1808
+ instance.forceUpdate();
1809
+ resolve(state);
1810
+ });
1811
+ }),
1812
+ destroy: function destroy() {
1813
+ cleanupModifierEffects();
1814
+ isDestroyed = true;
1815
+ }
1816
+ };
1817
+ if (!areValidElements(reference2, popper2)) {
1818
+ return instance;
1819
+ }
1820
+ instance.setOptions(options).then(function(state2) {
1821
+ if (!isDestroyed && options.onFirstUpdate) {
1822
+ options.onFirstUpdate(state2);
1823
+ }
1824
+ });
1825
+ function runModifierEffects() {
1826
+ state.orderedModifiers.forEach(function(_ref3) {
1827
+ var name = _ref3.name, _ref3$options = _ref3.options, options2 = _ref3$options === void 0 ? {} : _ref3$options, effect2 = _ref3.effect;
1828
+ if (typeof effect2 === "function") {
1829
+ var cleanupFn = effect2({
1830
+ state,
1831
+ name,
1832
+ instance,
1833
+ options: options2
1834
+ });
1835
+ var noopFn = function noopFn2() {
1836
+ };
1837
+ effectCleanupFns.push(cleanupFn || noopFn);
1838
+ }
1839
+ });
1840
+ }
1841
+ function cleanupModifierEffects() {
1842
+ effectCleanupFns.forEach(function(fn2) {
1843
+ return fn2();
1844
+ });
1845
+ effectCleanupFns = [];
1846
+ }
1847
+ return instance;
1848
+ };
1849
+ }
1850
+ var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1];
1851
+ var createPopper = /* @__PURE__ */ popperGenerator({
1852
+ defaultModifiers
1853
+ });
1854
+ const _sfc_main$I = defineComponent({
1855
+ name: "PopperContent",
1856
+ props: {
1857
+ popperId: {
1858
+ type: String,
1859
+ default: ""
1860
+ },
1861
+ popperClass: {
1862
+ type: String,
1863
+ default: ""
1864
+ },
1865
+ isOpen: {
1866
+ type: Boolean,
1867
+ default: false
1868
+ },
1869
+ theme: {
1870
+ type: String,
1871
+ default: ""
1872
+ },
1873
+ visibleArrow: {
1874
+ type: Boolean,
1875
+ default: true
1876
+ },
1877
+ width: {
1878
+ type: [Number, String],
1879
+ default: 0
1880
+ },
1881
+ autoHide: Boolean
1882
+ },
1883
+ emits: ["hide"],
1884
+ setup(props) {
1885
+ const { width } = toRefs(props);
1886
+ const contentInnerStyle = computed(() => {
1887
+ const style = {};
1888
+ let widthValue = width.value;
1889
+ if (widthValue) {
1890
+ if (typeof widthValue === "number") {
1891
+ widthValue = `${widthValue}px`;
1892
+ }
1893
+ style.minWidth = widthValue;
1894
+ }
1895
+ return style;
1896
+ });
1897
+ return {
1898
+ contentInnerStyle
1899
+ };
1900
+ }
1901
+ });
1902
+ const _hoisted_1$t = ["id", "aria-hidden", "tabindex"];
1903
+ const _hoisted_2$l = {
1904
+ ref: "arrow",
1905
+ class: "dao-popper-arrow"
1906
+ };
1907
+ const _hoisted_3$c = /* @__PURE__ */ createElementVNode("svg", {
1908
+ class: "dao-popper-arrow-viewbox",
1909
+ viewBox: "0 0 15 15"
1910
+ }, [
1911
+ /* @__PURE__ */ createElementVNode("path", {
1912
+ class: "pt-popper-arrow-border",
1913
+ d: "M4 7.5L14 -1L14 16Z",
1914
+ opacity: "0.1"
1915
+ }),
1916
+ /* @__PURE__ */ createElementVNode("path", {
1917
+ class: "pt-popper-arrow-fill",
1918
+ d: "M6 7.5L15 -1L15 16Z"
1919
+ })
1920
+ ], -1);
1921
+ const _hoisted_4$9 = [
1922
+ _hoisted_3$c
1923
+ ];
1924
+ function _sfc_render$E(_ctx, _cache, $props, $setup, $data, $options) {
1925
+ return openBlock(), createElementBlock("div", {
1926
+ id: _ctx.popperId,
1927
+ ref: "popover",
1928
+ class: normalizeClass([
1929
+ "dao-popper",
1930
+ _ctx.theme,
1931
+ _ctx.popperClass
1932
+ ]),
1933
+ "aria-hidden": _ctx.isOpen ? "false" : "true",
1934
+ tabindex: _ctx.autoHide ? 0 : void 0,
1935
+ onKeydown: _cache[0] || (_cache[0] = withKeys(($event) => _ctx.autoHide && _ctx.$emit("hide"), ["esc"]))
1936
+ }, [
1937
+ createElementVNode("div", {
1938
+ class: "dao-popper-inner",
1939
+ style: normalizeStyle(_ctx.contentInnerStyle)
1940
+ }, [
1941
+ renderSlot(_ctx.$slots, "default")
1942
+ ], 4),
1943
+ withDirectives(createElementVNode("div", _hoisted_2$l, _hoisted_4$9, 512), [
1944
+ [vShow, _ctx.visibleArrow]
1945
+ ])
1946
+ ], 42, _hoisted_1$t);
1947
+ }
1948
+ var PopperContent = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["render", _sfc_render$E]]);
1949
+ var PopperProps = {
1950
+ modelValue: {
1951
+ type: Boolean,
1952
+ default: false
1953
+ },
1954
+ content: {
1955
+ type: String,
1956
+ default: ""
1957
+ },
1958
+ appendTo: {
1959
+ type: [String, Boolean, Object],
1960
+ default: "root"
1961
+ },
1962
+ boundary: {
1963
+ type: [String, Object],
1964
+ default: "clippingParents"
1965
+ },
1966
+ delay: {
1967
+ type: [Number, Object, String],
1968
+ default: () => ({ show: 0, hide: 100 })
1969
+ },
1970
+ offset: {
1971
+ type: [Number, String],
1972
+ default: 16
1973
+ },
1974
+ width: {
1975
+ type: [Number, String],
1976
+ default: 0
1977
+ },
1978
+ placement: {
1979
+ type: String,
1980
+ default: "bottom",
1981
+ validator: (value) => placements$2.includes(value)
1982
+ },
1983
+ trigger: {
1984
+ type: [String, Array],
1985
+ default: "hover"
1986
+ },
1987
+ visibleArrow: {
1988
+ type: Boolean,
1989
+ default: true
1990
+ },
1991
+ popperClass: {
1992
+ type: String,
1993
+ default: ""
1994
+ },
1995
+ popperOptions: {
1996
+ type: Object,
1997
+ default: () => ({})
1998
+ },
1999
+ disabled: {
2000
+ type: Boolean,
2001
+ default: false
2002
+ },
2003
+ transition: {
2004
+ type: String,
2005
+ default: ""
2006
+ }
2007
+ };
2008
+ var popper_vue_vue_type_style_index_0_lang = "";
2009
+ let counter = 1;
2010
+ const on = (element, event, handler) => {
2011
+ if (element && event && handler) {
2012
+ element.addEventListener(event, handler, false);
2013
+ }
2014
+ };
2015
+ const off = (element, event, handler) => {
2016
+ if (element && event && handler) {
2017
+ element.removeEventListener(event, handler, false);
2018
+ }
2019
+ };
2020
+ function updatePopperOptions(popperInstance, modifiers, popperOptions = {}) {
2021
+ let _modifiers;
2022
+ if (Array.isArray(modifiers)) {
2023
+ _modifiers = modifiers;
2024
+ } else {
2025
+ _modifiers = [modifiers];
2026
+ }
2027
+ popperInstance.setOptions((options) => {
2028
+ var _a2, _b2;
2029
+ return __spreadProps(__spreadValues(__spreadValues({}, options), popperOptions), {
2030
+ modifiers: [
2031
+ ...(_a2 = options.modifiers) != null ? _a2 : [],
2032
+ ...(_b2 = popperOptions.modifiers) != null ? _b2 : [],
2033
+ ..._modifiers
2034
+ ]
2035
+ });
2036
+ });
2037
+ }
2038
+ function getActualRoot(app) {
2039
+ var _a2, _b2, _c, _d, _e, _f, _g, _h;
2040
+ let internalRoot = "body";
2041
+ if (!app) {
2042
+ return internalRoot;
2043
+ }
2044
+ let ele = (_f = (_c = (_b2 = (_a2 = app == null ? void 0 : app.root) == null ? void 0 : _a2.appContext) == null ? void 0 : _b2.app) == null ? void 0 : _c._container) != null ? _f : (_e = (_d = app == null ? void 0 : app.root) == null ? void 0 : _d.vnode) == null ? void 0 : _e.el;
2045
+ if ((ele == null ? void 0 : ele.nodeType) !== Node.ELEMENT_NODE && (ele == null ? void 0 : ele.nodeType) !== Node.DOCUMENT_FRAGMENT_NODE && (ele == null ? void 0 : ele.nodeType) !== Node.DOCUMENT_NODE) {
2046
+ ele = ele == null ? void 0 : ele.parentNode;
2047
+ }
2048
+ const rootNode = (_g = ele == null ? void 0 : ele.getRootNode) == null ? void 0 : _g.call(ele);
2049
+ if (rootNode) {
2050
+ internalRoot = (_h = rootNode.body) != null ? _h : rootNode;
2051
+ }
2052
+ return internalRoot;
2053
+ }
2054
+ const _sfc_main$H = defineComponent({
2055
+ name: "DaoPopper",
2056
+ components: {
2057
+ PopperContent
2058
+ },
2059
+ props: PopperProps,
2060
+ emits: ["update:modelValue", "show", "hide", "after-show", "after-hide"],
2061
+ setup(props, { slots, emit }) {
2062
+ const {
2063
+ modelValue,
2064
+ popperOptions,
2065
+ placement,
2066
+ trigger,
2067
+ disabled,
2068
+ offset: offset2,
2069
+ delay,
2070
+ boundary,
2071
+ visibleArrow,
2072
+ appendTo
2073
+ } = toRefs(props);
2074
+ counter += 1;
2075
+ const popperId = ref(`popper_${counter}`);
2076
+ const reference2 = ref(null);
2077
+ const popper2 = ref(null);
2078
+ const isOpen = ref(false);
2079
+ const actualAppendTo = ref("body");
2080
+ const isTelDisabled = ref(false);
2081
+ watch(appendTo, () => {
2082
+ const unrefAppendTo = unref(appendTo);
2083
+ if (unrefAppendTo === false) {
2084
+ isTelDisabled.value = true;
2085
+ } else if (unrefAppendTo === "root") {
2086
+ const vm = getCurrentInstance();
2087
+ if (vm == null ? void 0 : vm.root.isMounted) {
2088
+ actualAppendTo.value = getActualRoot(vm);
2089
+ } else {
2090
+ isTelDisabled.value = true;
2091
+ actualAppendTo.value = "body";
2092
+ onMounted(() => {
2093
+ actualAppendTo.value = getActualRoot(vm);
2094
+ isTelDisabled.value = false;
2095
+ });
2096
+ }
2097
+ } else {
2098
+ actualAppendTo.value = unrefAppendTo;
2099
+ }
2100
+ }, { immediate: true });
2101
+ const instance = getCurrentInstance();
2102
+ let popperInstance;
2103
+ let _targetNode;
2104
+ let _popperNode;
2105
+ let _arrowNode;
2106
+ let _scheduleTimer;
2107
+ const themeClass = computed(() => {
2108
+ var _a2, _b2;
2109
+ return (_b2 = (_a2 = instance == null ? void 0 : instance.proxy) == null ? void 0 : _a2.$options.daoPopperTheme) != null ? _b2 : "";
2110
+ });
2111
+ const showDelay = computed(() => {
2112
+ const unrefDelay = unref(delay);
2113
+ if (typeof unrefDelay === "object") {
2114
+ return unrefDelay.show || 0;
2115
+ }
2116
+ return unrefDelay || 0;
2117
+ });
2118
+ const hideDelay = computed(() => {
2119
+ const unrefDelay = unref(delay);
2120
+ if (typeof unrefDelay === "object") {
2121
+ return unrefDelay.hide || 0;
2122
+ }
2123
+ return unrefDelay || 0;
2124
+ });
2125
+ const createPopper$1 = async () => {
2126
+ var _a2;
2127
+ if (popperInstance == null ? void 0 : popperInstance.destroy) {
2128
+ popperInstance.destroy();
2129
+ }
2130
+ const unrefVisibleArrow = unref(visibleArrow);
2131
+ const unrefOffset = unref(offset2);
2132
+ const modifiers = [
2133
+ preventOverflow$1,
2134
+ offsetModifier,
2135
+ flip$1,
2136
+ {
2137
+ name: "preventOverflow",
2138
+ options: {
2139
+ boundary: unref(boundary),
2140
+ rootBoundary: "viewport",
2141
+ padding: {
2142
+ top: 2,
2143
+ bottom: 2,
2144
+ left: 5,
2145
+ right: 5
2146
+ }
2147
+ }
2148
+ }
2149
+ ];
2150
+ if (unrefVisibleArrow && _arrowNode) {
2151
+ modifiers.push(arrow$1, {
2152
+ name: "arrow",
2153
+ options: {
2154
+ element: _arrowNode
2155
+ }
2156
+ });
2157
+ }
2158
+ if (unrefOffset) {
2159
+ const offsetValue = [0, Number(unrefOffset)];
2160
+ modifiers.push({
2161
+ name: "offset",
2162
+ options: {
2163
+ offset: offsetValue
2164
+ }
2165
+ });
2166
+ }
2167
+ modifiers.push(...((_a2 = unref(popperOptions)) == null ? void 0 : _a2.modifiers) || []);
2168
+ const ppOptions = __spreadProps(__spreadValues({
2169
+ strategy: "fixed",
2170
+ placement: unref(placement)
2171
+ }, unref(popperOptions)), {
2172
+ modifiers
2173
+ });
2174
+ if (_targetNode && _popperNode) {
2175
+ popperInstance = createPopper(_targetNode, _popperNode, ppOptions);
2176
+ }
2177
+ await nextTick();
2178
+ isOpen.value = true;
2179
+ popperInstance == null ? void 0 : popperInstance.update();
2180
+ };
2181
+ const updatePopper = (fn2) => {
2182
+ if (popperInstance) {
2183
+ if (fn2) {
2184
+ fn2();
2185
+ }
2186
+ popperInstance == null ? void 0 : popperInstance.update();
2187
+ return;
2188
+ }
2189
+ createPopper$1();
2190
+ };
2191
+ const destroyPopper = () => {
2192
+ if (popperInstance) {
2193
+ popperInstance.destroy();
2194
+ popperInstance = null;
2195
+ }
2196
+ };
2197
+ const showPopper = () => {
2198
+ if (unref(isOpen)) {
2199
+ return;
2200
+ }
2201
+ if (popperInstance) {
2202
+ isOpen.value = true;
2203
+ updatePopperOptions(popperInstance, {
2204
+ name: "eventListeners",
2205
+ enabled: true
2206
+ });
2207
+ emit("after-show");
2208
+ }
2209
+ updatePopper();
2210
+ };
2211
+ const hidePopper = () => {
2212
+ if (!unref(isOpen)) {
2213
+ return;
2214
+ }
2215
+ isOpen.value = false;
2216
+ if (popperInstance) {
2217
+ updatePopperOptions(popperInstance, {
2218
+ name: "eventListeners",
2219
+ enabled: false
2220
+ });
2221
+ }
2222
+ emit("after-hide");
2223
+ };
2224
+ const show = () => {
2225
+ if (unref(disabled)) {
2226
+ return;
2227
+ }
2228
+ clearTimeout(_scheduleTimer);
2229
+ emit("show");
2230
+ const delayValue = unref(showDelay);
2231
+ if (!delayValue) {
2232
+ showPopper();
2233
+ } else {
2234
+ _scheduleTimer = setTimeout(showPopper, Number(delayValue));
2235
+ }
2236
+ };
2237
+ const hide = () => {
2238
+ if (unref(disabled)) {
2239
+ return;
2240
+ }
2241
+ clearTimeout(_scheduleTimer);
2242
+ emit("hide");
2243
+ const delayValue = unref(hideDelay);
2244
+ if (!delayValue) {
2245
+ hidePopper();
2246
+ } else {
2247
+ _scheduleTimer = setTimeout(hidePopper, Number(delayValue));
2248
+ }
2249
+ };
2250
+ const toggle = () => {
2251
+ if (unref(isOpen)) {
2252
+ hide();
2253
+ } else {
2254
+ show();
2255
+ }
2256
+ };
2257
+ const handleDocumentClick = (e) => {
2258
+ let { target } = e;
2259
+ if (e.composed) {
2260
+ const composedPath = e.composedPath();
2261
+ if (composedPath.length) {
2262
+ [target] = composedPath;
2263
+ }
2264
+ }
2265
+ if (!unref(isOpen)) {
2266
+ return;
2267
+ }
2268
+ if (!(_popperNode == null ? void 0 : _popperNode.contains(target)) && !(_targetNode == null ? void 0 : _targetNode.contains(target))) {
2269
+ hide();
2270
+ }
2271
+ };
2272
+ const operateEventListeners = (fn2) => {
2273
+ let unrefTrigger = unref(trigger);
2274
+ if (unrefTrigger === "manual") {
2275
+ return;
2276
+ }
2277
+ if (!Array.isArray(unrefTrigger)) {
2278
+ unrefTrigger = [unrefTrigger];
2279
+ }
2280
+ unrefTrigger.forEach((triggerType) => {
2281
+ switch (triggerType) {
2282
+ case "click":
2283
+ fn2(_targetNode, "click", toggle);
2284
+ fn2(document, "click", handleDocumentClick);
2285
+ break;
2286
+ case "hover":
2287
+ fn2(_targetNode, "mouseenter", show);
2288
+ fn2(_popperNode, "mouseenter", show);
2289
+ fn2(_targetNode, "mouseleave", hide);
2290
+ fn2(_popperNode, "mouseleave", hide);
2291
+ break;
2292
+ case "focus":
2293
+ fn2(_targetNode, "focusin", show);
2294
+ fn2(_popperNode, "focusin", show);
2295
+ fn2(_targetNode, "focusout", hide);
2296
+ fn2(_popperNode, "focusout", hide);
2297
+ break;
2298
+ }
2299
+ });
2300
+ };
2301
+ const addEventListeners = () => {
2302
+ operateEventListeners(on);
2303
+ };
2304
+ const removeEventListeners = () => {
2305
+ operateEventListeners(off);
2306
+ };
2307
+ const init = () => {
2308
+ var _a2, _b2, _c, _d;
2309
+ if (!slots.default) {
2310
+ throw new Error("Trigger must be provided");
2311
+ }
2312
+ _targetNode = (_a2 = unref(reference2)) == null ? void 0 : _a2.firstElementChild;
2313
+ _popperNode = (_b2 = unref(popper2)) == null ? void 0 : _b2.$el;
2314
+ _arrowNode = (_d = (_c = unref(popper2)) == null ? void 0 : _c.$refs) == null ? void 0 : _d.arrow;
2315
+ addEventListeners();
2316
+ if (unref(isOpen) || unref(modelValue)) {
2317
+ showPopper();
2318
+ }
2319
+ };
2320
+ const destroyOffsetWatcher = watch(offset2, (newV) => {
2321
+ if (popperInstance) {
2322
+ updatePopper(() => {
2323
+ if (popperInstance) {
2324
+ updatePopperOptions(popperInstance, {
2325
+ name: "offset",
2326
+ options: {
2327
+ offset: [0, Number(newV)]
2328
+ }
2329
+ });
2330
+ }
2331
+ });
2332
+ }
2333
+ });
2334
+ const destroyModelWatcher = watch(modelValue, () => {
2335
+ if (unref(disabled) || unref(trigger) !== "manual") {
2336
+ return;
2337
+ }
2338
+ if (unref(modelValue)) {
2339
+ show();
2340
+ } else {
2341
+ hide();
2342
+ }
2343
+ });
2344
+ const destroyOpenWatcher = watch(isOpen, (newV) => {
2345
+ emit("update:modelValue", newV);
2346
+ });
2347
+ const destroyBoundaryWatcher = watch(boundary, (newV) => {
2348
+ if (popperInstance) {
2349
+ updatePopper(() => {
2350
+ if (popperInstance) {
2351
+ updatePopperOptions(popperInstance, {
2352
+ name: "preventOverflow",
2353
+ options: {
2354
+ boundary: newV
2355
+ }
2356
+ });
2357
+ }
2341
2358
  });
2342
- });
2343
- }
2344
- return pending;
2345
- };
2346
- }
2347
- function mergeByName(modifiers) {
2348
- var merged = modifiers.reduce(function(merged2, current) {
2349
- var existing = merged2[current.name];
2350
- merged2[current.name] = existing ? Object.assign({}, existing, current, {
2351
- options: Object.assign({}, existing.options, current.options),
2352
- data: Object.assign({}, existing.data, current.data)
2353
- }) : current;
2354
- return merged2;
2355
- }, {});
2356
- return Object.keys(merged).map(function(key) {
2357
- return merged[key];
2358
- });
2359
- }
2360
- var DEFAULT_OPTIONS = {
2361
- placement: "bottom",
2362
- modifiers: [],
2363
- strategy: "absolute"
2364
- };
2365
- function areValidElements() {
2366
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2367
- args[_key] = arguments[_key];
2359
+ }
2360
+ });
2361
+ const destroyPlacementWatcher = watch(placement, (newV) => {
2362
+ if (popperInstance) {
2363
+ updatePopper(() => {
2364
+ if (popperInstance) {
2365
+ updatePopperOptions(popperInstance, [], {
2366
+ placement: newV
2367
+ });
2368
+ }
2369
+ });
2370
+ }
2371
+ });
2372
+ const destroyArrowWatcher = watch(visibleArrow, (newVal) => {
2373
+ if (popperInstance) {
2374
+ updatePopper(() => {
2375
+ if (popperInstance && _arrowNode) {
2376
+ updatePopperOptions(popperInstance, [
2377
+ arrow$1,
2378
+ {
2379
+ name: "arrow",
2380
+ enabled: newVal,
2381
+ options: {
2382
+ element: _arrowNode
2383
+ }
2384
+ }
2385
+ ]);
2386
+ }
2387
+ });
2388
+ }
2389
+ });
2390
+ const destroyPopperOptionWatcher = watch(popperOptions, (newV) => {
2391
+ if (popperInstance) {
2392
+ updatePopper(() => {
2393
+ if (popperInstance) {
2394
+ updatePopperOptions(popperInstance, [], newV);
2395
+ }
2396
+ });
2397
+ }
2398
+ });
2399
+ onMounted(() => {
2400
+ init();
2401
+ });
2402
+ onBeforeUnmount(() => {
2403
+ destroyOffsetWatcher();
2404
+ destroyModelWatcher();
2405
+ destroyOpenWatcher();
2406
+ destroyBoundaryWatcher();
2407
+ destroyPlacementWatcher();
2408
+ destroyArrowWatcher();
2409
+ destroyPopperOptionWatcher();
2410
+ removeEventListeners();
2411
+ destroyPopper();
2412
+ });
2413
+ return {
2414
+ isOpen,
2415
+ popper: popper2,
2416
+ reference: reference2,
2417
+ popperId,
2418
+ themeClass,
2419
+ hide,
2420
+ actualAppendTo,
2421
+ isTelDisabled
2422
+ };
2368
2423
  }
2369
- return !args.some(function(element) {
2370
- return !(element && typeof element.getBoundingClientRect === "function");
2371
- });
2424
+ });
2425
+ function _sfc_render$D(_ctx, _cache, $props, $setup, $data, $options) {
2426
+ const _component_popper_content = resolveComponent("popper-content");
2427
+ return openBlock(), createElementBlock("div", {
2428
+ ref: "reference",
2429
+ class: normalizeClass([
2430
+ "dao-popper-target",
2431
+ {
2432
+ "dao-popper-target--open": _ctx.isOpen
2433
+ }
2434
+ ])
2435
+ }, [
2436
+ renderSlot(_ctx.$slots, "default"),
2437
+ (openBlock(), createBlock(Teleport, {
2438
+ to: _ctx.actualAppendTo,
2439
+ disabled: _ctx.isTelDisabled
2440
+ }, [
2441
+ createVNode(Transition, { name: _ctx.transition }, {
2442
+ default: withCtx(() => [
2443
+ withDirectives(createVNode(_component_popper_content, {
2444
+ ref: "popper",
2445
+ theme: _ctx.themeClass,
2446
+ "popper-id": _ctx.popperId,
2447
+ "visible-arrow": _ctx.visibleArrow,
2448
+ "is-open": _ctx.isOpen,
2449
+ width: _ctx.width,
2450
+ "popper-class": _ctx.popperClass
2451
+ }, {
2452
+ default: withCtx(() => [
2453
+ renderSlot(_ctx.$slots, "content", {}, () => [
2454
+ createTextVNode(toDisplayString(_ctx.content), 1)
2455
+ ])
2456
+ ]),
2457
+ _: 3
2458
+ }, 8, ["theme", "popper-id", "visible-arrow", "is-open", "width", "popper-class"]), [
2459
+ [vShow, _ctx.isOpen]
2460
+ ])
2461
+ ]),
2462
+ _: 3
2463
+ }, 8, ["name"])
2464
+ ], 8, ["to", "disabled"]))
2465
+ ], 2);
2372
2466
  }
2373
- function popperGenerator(generatorOptions) {
2374
- if (generatorOptions === void 0) {
2375
- generatorOptions = {};
2467
+ var DaoPopper = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["render", _sfc_render$D]]);
2468
+ var tooltipProps = __spreadProps(__spreadValues({}, PopperProps), {
2469
+ offset: {
2470
+ type: [Number, String],
2471
+ default: 10
2472
+ }
2473
+ });
2474
+ var tooltip_scss_vue_type_style_index_0_src_lang = "";
2475
+ const _sfc_main$G = defineComponent(__spreadProps(__spreadValues({}, DaoPopper), {
2476
+ name: "DaoTooltip",
2477
+ props: tooltipProps,
2478
+ daoPopperTheme: "dao-tooltip"
2479
+ }));
2480
+ var popover_scss_vue_type_style_index_0_src_lang = "";
2481
+ const _sfc_main$F = defineComponent(__spreadProps(__spreadValues({}, DaoPopper), {
2482
+ name: "DaoPopover",
2483
+ props: PopperProps,
2484
+ daoPopperTheme: "dao-popover"
2485
+ }));
2486
+ const placements = [
2487
+ "auto",
2488
+ "auto-start",
2489
+ "auto-end",
2490
+ "top",
2491
+ "top-start",
2492
+ "top-end",
2493
+ "right",
2494
+ "right-start",
2495
+ "right-end",
2496
+ "bottom",
2497
+ "bottom-start",
2498
+ "bottom-end",
2499
+ "left",
2500
+ "left-start",
2501
+ "left-end"
2502
+ ];
2503
+ const ellipsisProps = {
2504
+ type: {
2505
+ type: String,
2506
+ default: "tooltip"
2507
+ },
2508
+ manual: {
2509
+ type: Boolean,
2510
+ default: false
2511
+ },
2512
+ force: {
2513
+ type: Boolean,
2514
+ default: false
2515
+ },
2516
+ disabled: {
2517
+ type: Boolean,
2518
+ default: false
2519
+ },
2520
+ content: {
2521
+ type: String,
2522
+ default: ""
2523
+ },
2524
+ width: {
2525
+ type: Number,
2526
+ default: 200
2527
+ },
2528
+ ellipsisPlacement: {
2529
+ type: String,
2530
+ default: "bottom-start",
2531
+ validator: (value) => placements.includes(value)
2532
+ },
2533
+ appendTo: {
2534
+ type: [String, Boolean, Object],
2535
+ default: "root"
2536
+ },
2537
+ popperClass: {
2538
+ type: String,
2539
+ default: ""
2540
+ },
2541
+ offset: {
2542
+ type: [Number, String],
2543
+ default: 10
2544
+ },
2545
+ delay: {
2546
+ type: [Number, Object, String],
2547
+ default: () => ({ show: 0, hide: 100 })
2376
2548
  }
2377
- var _generatorOptions = generatorOptions, _generatorOptions$def = _generatorOptions.defaultModifiers, defaultModifiers2 = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, _generatorOptions$def2 = _generatorOptions.defaultOptions, defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
2378
- return function createPopper2(reference2, popper2, options) {
2379
- if (options === void 0) {
2380
- options = defaultOptions;
2381
- }
2382
- var state = {
2383
- placement: "bottom",
2384
- orderedModifiers: [],
2385
- options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
2386
- modifiersData: {},
2387
- elements: {
2388
- reference: reference2,
2389
- popper: popper2
2390
- },
2391
- attributes: {},
2392
- styles: {}
2393
- };
2394
- var effectCleanupFns = [];
2395
- var isDestroyed = false;
2396
- var instance = {
2397
- state,
2398
- setOptions: function setOptions(setOptionsAction) {
2399
- var options2 = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction;
2400
- cleanupModifierEffects();
2401
- state.options = Object.assign({}, defaultOptions, state.options, options2);
2402
- state.scrollParents = {
2403
- reference: isElement(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
2404
- popper: listScrollParents(popper2)
2405
- };
2406
- var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers2, state.options.modifiers)));
2407
- state.orderedModifiers = orderedModifiers.filter(function(m) {
2408
- return m.enabled;
2409
- });
2410
- runModifierEffects();
2411
- return instance.update();
2412
- },
2413
- forceUpdate: function forceUpdate() {
2414
- if (isDestroyed) {
2415
- return;
2416
- }
2417
- var _state$elements = state.elements, reference3 = _state$elements.reference, popper3 = _state$elements.popper;
2418
- if (!areValidElements(reference3, popper3)) {
2419
- return;
2420
- }
2421
- state.rects = {
2422
- reference: getCompositeRect(reference3, getOffsetParent(popper3), state.options.strategy === "fixed"),
2423
- popper: getLayoutRect(popper3)
2424
- };
2425
- state.reset = false;
2426
- state.placement = state.options.placement;
2427
- state.orderedModifiers.forEach(function(modifier) {
2428
- return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
2429
- });
2430
- for (var index2 = 0; index2 < state.orderedModifiers.length; index2++) {
2431
- if (state.reset === true) {
2432
- state.reset = false;
2433
- index2 = -1;
2434
- continue;
2435
- }
2436
- var _state$orderedModifie = state.orderedModifiers[index2], fn2 = _state$orderedModifie.fn, _state$orderedModifie2 = _state$orderedModifie.options, _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2, name = _state$orderedModifie.name;
2437
- if (typeof fn2 === "function") {
2438
- state = fn2({
2439
- state,
2440
- options: _options,
2441
- name,
2442
- instance
2443
- }) || state;
2444
- }
2445
- }
2446
- },
2447
- update: debounce(function() {
2448
- return new Promise(function(resolve) {
2449
- instance.forceUpdate();
2450
- resolve(state);
2451
- });
2452
- }),
2453
- destroy: function destroy() {
2454
- cleanupModifierEffects();
2455
- isDestroyed = true;
2549
+ };
2550
+ var ellipsis_vue_vue_type_style_index_0_lang = "";
2551
+ const _sfc_main$E = defineComponent({
2552
+ name: "DaoEllipsis",
2553
+ components: {
2554
+ Tooltip: _sfc_main$G,
2555
+ Popover: _sfc_main$F
2556
+ },
2557
+ props: ellipsisProps,
2558
+ setup(props) {
2559
+ const disabled = ref(true);
2560
+ const tooltipRef = ref();
2561
+ const ComponentType = computed(() => props.type === "tooltip" ? _sfc_main$G : _sfc_main$F);
2562
+ const isOpen = computed(() => {
2563
+ var _a2, _b2, _c, _d;
2564
+ return (_d = (_c = (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.$) == null ? void 0 : _b2.ctx) == null ? void 0 : _c.isOpen) != null ? _d : false;
2565
+ });
2566
+ const isEllipsis = ref(false);
2567
+ const update = (ele) => {
2568
+ isEllipsis.value = ((ele == null ? void 0 : ele.offsetWidth) || 0) < ((ele == null ? void 0 : ele.scrollWidth) || 0);
2569
+ if (props.disabled) {
2570
+ disabled.value = true;
2571
+ return;
2572
+ }
2573
+ if (props.force) {
2574
+ disabled.value = false;
2575
+ return;
2456
2576
  }
2577
+ disabled.value = !isEllipsis.value;
2457
2578
  };
2458
- if (!areValidElements(reference2, popper2)) {
2459
- return instance;
2460
- }
2461
- instance.setOptions(options).then(function(state2) {
2462
- if (!isDestroyed && options.onFirstUpdate) {
2463
- options.onFirstUpdate(state2);
2579
+ function onMouseOver(e) {
2580
+ var _a2;
2581
+ let path = (_a2 = e == null ? void 0 : e.path) != null ? _a2 : [];
2582
+ if (e.composedPath) {
2583
+ path = e.composedPath();
2464
2584
  }
2465
- });
2466
- function runModifierEffects() {
2467
- state.orderedModifiers.forEach(function(_ref3) {
2468
- var name = _ref3.name, _ref3$options = _ref3.options, options2 = _ref3$options === void 0 ? {} : _ref3$options, effect2 = _ref3.effect;
2469
- if (typeof effect2 === "function") {
2470
- var cleanupFn = effect2({
2471
- state,
2472
- name,
2473
- instance,
2474
- options: options2
2475
- });
2476
- var noopFn = function noopFn2() {
2477
- };
2478
- effectCleanupFns.push(cleanupFn || noopFn);
2585
+ const count = path.length;
2586
+ let index2 = 0;
2587
+ while (index2 < count) {
2588
+ const target = path[index2];
2589
+ if (target.scrollWidth) {
2590
+ update(target);
2591
+ break;
2479
2592
  }
2480
- });
2593
+ index2 += 1;
2594
+ }
2481
2595
  }
2482
- function cleanupModifierEffects() {
2483
- effectCleanupFns.forEach(function(fn2) {
2484
- return fn2();
2485
- });
2486
- effectCleanupFns = [];
2596
+ return {
2597
+ ns: "dao-ellipsis",
2598
+ disabled,
2599
+ onMouseOver,
2600
+ tooltipRef,
2601
+ isOpen,
2602
+ isEllipsis,
2603
+ Tooltip: _sfc_main$G,
2604
+ ComponentType
2605
+ };
2606
+ }
2607
+ });
2608
+ const _hoisted_1$s = { key: 1 };
2609
+ function _sfc_render$C(_ctx, _cache, $props, $setup, $data, $options) {
2610
+ return openBlock(), createBlock(resolveDynamicComponent(_ctx.ComponentType), {
2611
+ ref: "ComponentRef",
2612
+ disabled: _ctx.disabled,
2613
+ "visible-arrow": false,
2614
+ placement: _ctx.ellipsisPlacement,
2615
+ offset: _ctx.offset,
2616
+ class: normalizeClass([_ctx.ns]),
2617
+ "append-to": _ctx.appendTo,
2618
+ delay: _ctx.delay,
2619
+ "popper-class": [`${_ctx.ns}-popper`, _ctx.popperClass].join(" "),
2620
+ width: _ctx.width
2621
+ }, createSlots({
2622
+ default: withCtx(() => [
2623
+ createElementVNode("span", {
2624
+ class: normalizeClass([
2625
+ !_ctx.manual && `${_ctx.ns}--auto-mode`
2626
+ ]),
2627
+ onMouseover: _cache[0] || (_cache[0] = (...args) => _ctx.onMouseOver && _ctx.onMouseOver(...args))
2628
+ }, [
2629
+ renderSlot(_ctx.$slots, "default")
2630
+ ], 34)
2631
+ ]),
2632
+ _: 2
2633
+ }, [
2634
+ !_ctx.disabled ? {
2635
+ name: "content",
2636
+ fn: withCtx(() => [
2637
+ _ctx.$slots.content ? renderSlot(_ctx.$slots, "content", {
2638
+ key: 0,
2639
+ show: _ctx.isOpen,
2640
+ ellipsis: _ctx.isEllipsis
2641
+ }) : _ctx.content ? (openBlock(), createElementBlock("span", _hoisted_1$s, toDisplayString(_ctx.content), 1)) : renderSlot(_ctx.$slots, "default", { key: 2 })
2642
+ ])
2643
+ } : void 0
2644
+ ]), 1032, ["disabled", "placement", "offset", "class", "append-to", "delay", "popper-class", "width"]);
2645
+ }
2646
+ var DaoEllipsis = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["render", _sfc_render$C]]);
2647
+ const _sfc_main$D = defineComponent({
2648
+ name: "DaoDialogHeader",
2649
+ components: {
2650
+ DaoActionIcon,
2651
+ DaoEllipsis
2652
+ },
2653
+ props: {
2654
+ showClose: {
2655
+ type: Boolean,
2656
+ default: true
2657
+ },
2658
+ title: {
2659
+ type: String,
2660
+ default: ""
2487
2661
  }
2488
- return instance;
2489
- };
2662
+ },
2663
+ emits: ["close"],
2664
+ setup(props, { emit }) {
2665
+ const onClose = () => emit("close");
2666
+ return {
2667
+ onClose
2668
+ };
2669
+ }
2670
+ });
2671
+ const _hoisted_1$r = { class: "dao-dialog__header" };
2672
+ const _hoisted_2$k = { class: "dao-dialog__header--title" };
2673
+ function _sfc_render$B(_ctx, _cache, $props, $setup, $data, $options) {
2674
+ const _component_dao_ellipsis = resolveComponent("dao-ellipsis");
2675
+ const _component_dao_action_icon = resolveComponent("dao-action-icon");
2676
+ return openBlock(), createElementBlock("div", _hoisted_1$r, [
2677
+ renderSlot(_ctx.$slots, "default", {}, () => [
2678
+ createElementVNode("span", _hoisted_2$k, [
2679
+ renderSlot(_ctx.$slots, "before-title"),
2680
+ createVNode(_component_dao_ellipsis, { class: "dao-dialog__header--title-main" }, {
2681
+ default: withCtx(() => [
2682
+ renderSlot(_ctx.$slots, "title", {}, () => [
2683
+ createTextVNode(toDisplayString(_ctx.title), 1)
2684
+ ])
2685
+ ]),
2686
+ _: 3
2687
+ }),
2688
+ renderSlot(_ctx.$slots, "after-title")
2689
+ ]),
2690
+ _ctx.showClose ? (openBlock(), createBlock(_component_dao_action_icon, {
2691
+ key: 0,
2692
+ class: "dao-action-icon--close",
2693
+ name: "icon-close",
2694
+ onClick: _ctx.onClose
2695
+ }, null, 8, ["onClick"])) : createCommentVNode("", true)
2696
+ ])
2697
+ ]);
2490
2698
  }
2491
- var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1];
2492
- var createPopper = /* @__PURE__ */ popperGenerator({
2493
- defaultModifiers
2494
- });
2495
- const _sfc_main$E = defineComponent({
2496
- name: "PopperContent",
2699
+ var DialogHeader = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["render", _sfc_render$B]]);
2700
+ const _sfc_main$C = defineComponent({
2701
+ name: "DaoDialogFooter",
2702
+ components: {
2703
+ DaoButton
2704
+ },
2497
2705
  props: {
2498
- popperId: {
2706
+ textConfirm: {
2499
2707
  type: String,
2500
- default: ""
2708
+ default: "\u786E\u5B9A"
2501
2709
  },
2502
- popperClass: {
2710
+ textCancel: {
2503
2711
  type: String,
2504
- default: ""
2712
+ default: "\u53D6\u6D88"
2505
2713
  },
2506
- isOpen: {
2714
+ confirmDisabled: {
2507
2715
  type: Boolean,
2508
2716
  default: false
2509
2717
  },
2510
- theme: {
2511
- type: String,
2512
- default: ""
2513
- },
2514
- visibleArrow: {
2718
+ confirmLoading: {
2515
2719
  type: Boolean,
2516
- default: true
2517
- },
2518
- width: {
2519
- type: [Number, String],
2520
- default: 0
2521
- },
2522
- autoHide: Boolean
2720
+ default: false
2721
+ }
2523
2722
  },
2524
- emits: ["hide"],
2525
- setup(props) {
2526
- const { width } = toRefs(props);
2527
- const contentInnerStyle = computed(() => {
2528
- const style = {};
2529
- let widthValue = width.value;
2530
- if (widthValue) {
2531
- if (typeof widthValue === "number") {
2532
- widthValue = `${widthValue}px`;
2533
- }
2534
- style.minWidth = widthValue;
2723
+ emits: ["confirm", "cancel"],
2724
+ setup(props, { emit }) {
2725
+ const { confirmDisabled } = toRefs(props);
2726
+ const onConfirm = () => {
2727
+ if (!confirmDisabled.value) {
2728
+ emit("confirm");
2535
2729
  }
2536
- return style;
2537
- });
2730
+ };
2731
+ const onCancel = () => {
2732
+ emit("cancel");
2733
+ };
2538
2734
  return {
2539
- contentInnerStyle
2735
+ onConfirm,
2736
+ onCancel
2540
2737
  };
2541
2738
  }
2542
2739
  });
2543
- const _hoisted_1$p = ["id", "aria-hidden", "tabindex"];
2544
- const _hoisted_2$j = {
2545
- ref: "arrow",
2546
- class: "dao-popper-arrow"
2547
- };
2548
- const _hoisted_3$b = /* @__PURE__ */ createElementVNode("svg", {
2549
- class: "dao-popper-arrow-viewbox",
2550
- viewBox: "0 0 15 15"
2551
- }, [
2552
- /* @__PURE__ */ createElementVNode("path", {
2553
- class: "pt-popper-arrow-border",
2554
- d: "M4 7.5L14 -1L14 16Z",
2555
- opacity: "0.1"
2556
- }),
2557
- /* @__PURE__ */ createElementVNode("path", {
2558
- class: "pt-popper-arrow-fill",
2559
- d: "M6 7.5L15 -1L15 16Z"
2560
- })
2561
- ], -1);
2562
- const _hoisted_4$8 = [
2563
- _hoisted_3$b
2564
- ];
2740
+ const _hoisted_1$q = { class: "dao-dialog__footer" };
2565
2741
  function _sfc_render$A(_ctx, _cache, $props, $setup, $data, $options) {
2566
- return openBlock(), createElementBlock("div", {
2567
- id: _ctx.popperId,
2568
- ref: "popover",
2569
- class: normalizeClass([
2570
- "dao-popper",
2571
- _ctx.theme,
2572
- _ctx.popperClass
2573
- ]),
2574
- "aria-hidden": _ctx.isOpen ? "false" : "true",
2575
- tabindex: _ctx.autoHide ? 0 : void 0,
2576
- onKeydown: _cache[0] || (_cache[0] = withKeys(($event) => _ctx.autoHide && _ctx.$emit("hide"), ["esc"]))
2577
- }, [
2578
- createElementVNode("div", {
2579
- class: "dao-popper-inner",
2580
- style: normalizeStyle(_ctx.contentInnerStyle)
2581
- }, [
2582
- renderSlot(_ctx.$slots, "default")
2583
- ], 4),
2584
- withDirectives(createElementVNode("div", _hoisted_2$j, _hoisted_4$8, 512), [
2585
- [vShow, _ctx.visibleArrow]
2742
+ const _component_dao_button = resolveComponent("dao-button");
2743
+ return openBlock(), createElementBlock("div", _hoisted_1$q, [
2744
+ renderSlot(_ctx.$slots, "default", {}, () => [
2745
+ createVNode(_component_dao_button, {
2746
+ type: "ghost",
2747
+ class: "dao-dialog__footer__cancel-btn",
2748
+ onClick: _ctx.onCancel
2749
+ }, {
2750
+ default: withCtx(() => [
2751
+ createTextVNode(toDisplayString(_ctx.textCancel), 1)
2752
+ ]),
2753
+ _: 1
2754
+ }, 8, ["onClick"]),
2755
+ createVNode(_component_dao_button, {
2756
+ type: "primary",
2757
+ loading: _ctx.confirmLoading,
2758
+ disabled: _ctx.confirmDisabled,
2759
+ onClick: _ctx.onConfirm
2760
+ }, {
2761
+ default: withCtx(() => [
2762
+ createTextVNode(toDisplayString(_ctx.textConfirm), 1)
2763
+ ]),
2764
+ _: 1
2765
+ }, 8, ["loading", "disabled", "onClick"])
2586
2766
  ])
2587
- ], 42, _hoisted_1$p);
2588
- }
2589
- var PopperContent = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["render", _sfc_render$A]]);
2590
- var PopperProps = {
2591
- modelValue: {
2592
- type: Boolean,
2593
- default: false
2594
- },
2595
- content: {
2596
- type: String,
2597
- default: ""
2598
- },
2599
- appendTo: {
2600
- type: [String, Boolean, Object],
2601
- default: "root"
2602
- },
2603
- boundary: {
2604
- type: [String, Object],
2605
- default: "clippingParents"
2606
- },
2607
- delay: {
2608
- type: [Number, Object, String],
2609
- default: () => ({ show: 0, hide: 100 })
2610
- },
2611
- offset: {
2612
- type: [Number, String],
2613
- default: 16
2614
- },
2615
- width: {
2616
- type: [Number, String],
2617
- default: 0
2618
- },
2619
- placement: {
2620
- type: String,
2621
- default: "bottom",
2622
- validator: (value) => placements$2.includes(value)
2623
- },
2624
- trigger: {
2625
- type: [String, Array],
2626
- default: "hover"
2627
- },
2628
- visibleArrow: {
2629
- type: Boolean,
2630
- default: true
2631
- },
2632
- popperClass: {
2633
- type: String,
2634
- default: ""
2635
- },
2636
- popperOptions: {
2637
- type: Object,
2638
- default: () => ({})
2639
- },
2640
- disabled: {
2641
- type: Boolean,
2642
- default: false
2643
- },
2644
- transition: {
2645
- type: String,
2646
- default: ""
2647
- }
2648
- };
2649
- var popper_vue_vue_type_style_index_0_lang = "";
2650
- let counter = 1;
2651
- const on = (element, event, handler) => {
2652
- if (element && event && handler) {
2653
- element.addEventListener(event, handler, false);
2654
- }
2655
- };
2656
- const off = (element, event, handler) => {
2657
- if (element && event && handler) {
2658
- element.removeEventListener(event, handler, false);
2659
- }
2660
- };
2661
- function updatePopperOptions(popperInstance, modifiers, popperOptions = {}) {
2662
- let _modifiers;
2663
- if (Array.isArray(modifiers)) {
2664
- _modifiers = modifiers;
2665
- } else {
2666
- _modifiers = [modifiers];
2667
- }
2668
- popperInstance.setOptions((options) => {
2669
- var _a2, _b2;
2670
- return __spreadProps(__spreadValues(__spreadValues({}, options), popperOptions), {
2671
- modifiers: [
2672
- ...(_a2 = options.modifiers) != null ? _a2 : [],
2673
- ...(_b2 = popperOptions.modifiers) != null ? _b2 : [],
2674
- ..._modifiers
2675
- ]
2676
- });
2677
- });
2678
- }
2679
- function getActualRoot(app) {
2680
- var _a2, _b2, _c, _d, _e, _f, _g, _h;
2681
- let internalRoot = "body";
2682
- if (!app) {
2683
- return internalRoot;
2684
- }
2685
- let ele = (_f = (_c = (_b2 = (_a2 = app == null ? void 0 : app.root) == null ? void 0 : _a2.appContext) == null ? void 0 : _b2.app) == null ? void 0 : _c._container) != null ? _f : (_e = (_d = app == null ? void 0 : app.root) == null ? void 0 : _d.vnode) == null ? void 0 : _e.el;
2686
- if ((ele == null ? void 0 : ele.nodeType) !== Node.ELEMENT_NODE && (ele == null ? void 0 : ele.nodeType) !== Node.DOCUMENT_FRAGMENT_NODE && (ele == null ? void 0 : ele.nodeType) !== Node.DOCUMENT_NODE) {
2687
- ele = ele == null ? void 0 : ele.parentNode;
2688
- }
2689
- const rootNode = (_g = ele == null ? void 0 : ele.getRootNode) == null ? void 0 : _g.call(ele);
2690
- if (rootNode) {
2691
- internalRoot = (_h = rootNode.body) != null ? _h : rootNode;
2692
- }
2693
- return internalRoot;
2767
+ ]);
2694
2768
  }
2695
- const _sfc_main$D = defineComponent({
2696
- name: "DaoPopper",
2769
+ var DialogFooter = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["render", _sfc_render$A]]);
2770
+ var dialog_scss_vue_type_style_index_0_src_lang = "";
2771
+ const DIALOG_NUM_ATTR = "dao-dialog__num";
2772
+ const DIALOG_MINIMUM_PADDING = "20px";
2773
+ const DIALOG_DEFAULT_PADDING_TOP = "100px";
2774
+ const DIALOG_DEFAULT_PADDING_BOTTOM = "20px";
2775
+ const KEYBOARD_EVENT_NAME$1 = "keydown";
2776
+ const _sfc_main$B = defineComponent({
2777
+ name: "DaoDialog",
2697
2778
  components: {
2698
- PopperContent
2779
+ DialogHeader,
2780
+ DialogFooter
2781
+ },
2782
+ props: {
2783
+ modelValue: {
2784
+ type: Boolean,
2785
+ default: false
2786
+ },
2787
+ header: {
2788
+ type: [String, Boolean],
2789
+ default: ""
2790
+ },
2791
+ footer: {
2792
+ type: Boolean,
2793
+ default: true
2794
+ },
2795
+ size: {
2796
+ type: String,
2797
+ default: "md"
2798
+ },
2799
+ containerClass: {
2800
+ type: String,
2801
+ default: ""
2802
+ },
2803
+ closeOnClickOutside: {
2804
+ type: Boolean,
2805
+ default: false
2806
+ },
2807
+ closeOnPressEscape: {
2808
+ type: Boolean,
2809
+ default: true
2810
+ },
2811
+ lockScroll: {
2812
+ type: Boolean,
2813
+ default: true
2814
+ },
2815
+ top: {
2816
+ type: String,
2817
+ default: DIALOG_DEFAULT_PADDING_TOP
2818
+ },
2819
+ bottom: {
2820
+ type: String,
2821
+ default: DIALOG_DEFAULT_PADDING_BOTTOM
2822
+ },
2823
+ middle: {
2824
+ type: Boolean,
2825
+ default: false
2826
+ },
2827
+ textConfirm: {
2828
+ type: String,
2829
+ default: void 0
2830
+ },
2831
+ textCancel: {
2832
+ type: String,
2833
+ default: void 0
2834
+ },
2835
+ confirmDisabled: {
2836
+ type: Boolean,
2837
+ default: false
2838
+ },
2839
+ confirmLoading: {
2840
+ type: Boolean,
2841
+ default: false
2842
+ },
2843
+ showClose: {
2844
+ type: Boolean,
2845
+ default: true
2846
+ }
2699
2847
  },
2700
- props: PopperProps,
2701
- emits: ["update:modelValue", "show", "hide", "after-show", "after-hide"],
2702
- setup(props, { slots, emit }) {
2848
+ emits: [
2849
+ "change",
2850
+ "before-open",
2851
+ "cancel",
2852
+ "update:modelValue",
2853
+ "opened",
2854
+ "confirm",
2855
+ "before-close",
2856
+ "closed"
2857
+ ],
2858
+ setup(props, { emit }) {
2703
2859
  const {
2704
2860
  modelValue,
2705
- popperOptions,
2706
- placement,
2707
- trigger,
2708
- disabled,
2709
- offset: offset2,
2710
- delay,
2711
- boundary,
2712
- visibleArrow,
2713
- appendTo
2861
+ middle,
2862
+ top: top2,
2863
+ bottom: bottom2,
2864
+ containerClass,
2865
+ size,
2866
+ header: header2,
2867
+ lockScroll,
2868
+ closeOnPressEscape,
2869
+ closeOnClickOutside
2714
2870
  } = toRefs(props);
2715
- counter += 1;
2716
- const popperId = ref(`popper_${counter}`);
2717
- const reference2 = ref(null);
2718
- const popper2 = ref(null);
2719
- const isOpen = ref(false);
2720
- const actualAppendTo = ref("body");
2721
- const isTelDisabled = ref(false);
2722
- watch(appendTo, () => {
2723
- const unrefAppendTo = unref(appendTo);
2724
- if (unrefAppendTo === false) {
2725
- isTelDisabled.value = true;
2726
- } else if (unrefAppendTo === "root") {
2727
- const vm = getCurrentInstance();
2728
- if (vm == null ? void 0 : vm.root.isMounted) {
2729
- actualAppendTo.value = getActualRoot(vm);
2730
- } else {
2731
- isTelDisabled.value = true;
2732
- actualAppendTo.value = "body";
2733
- onMounted(() => {
2734
- actualAppendTo.value = getActualRoot(vm);
2735
- isTelDisabled.value = false;
2736
- });
2737
- }
2738
- } else {
2739
- actualAppendTo.value = unrefAppendTo;
2740
- }
2741
- }, { immediate: true });
2742
- const instance = getCurrentInstance();
2743
- let popperInstance;
2744
- let _targetNode;
2745
- let _popperNode;
2746
- let _arrowNode;
2747
- let _scheduleTimer;
2748
- const themeClass = computed(() => {
2871
+ const { t } = useI18n();
2872
+ const textContent = computed(() => {
2749
2873
  var _a2, _b2;
2750
- return (_b2 = (_a2 = instance == null ? void 0 : instance.proxy) == null ? void 0 : _a2.$options.daoPopperTheme) != null ? _b2 : "";
2751
- });
2752
- const showDelay = computed(() => {
2753
- const unrefDelay = unref(delay);
2754
- if (typeof unrefDelay === "object") {
2755
- return unrefDelay.show || 0;
2756
- }
2757
- return unrefDelay || 0;
2874
+ return {
2875
+ confirm: (_a2 = props.textConfirm) != null ? _a2 : t("core.dialog.confirm"),
2876
+ cancel: (_b2 = props.textCancel) != null ? _b2 : t("core.dialog.cancel")
2877
+ };
2758
2878
  });
2759
- const hideDelay = computed(() => {
2760
- const unrefDelay = unref(delay);
2761
- if (typeof unrefDelay === "object") {
2762
- return unrefDelay.hide || 0;
2763
- }
2764
- return unrefDelay || 0;
2879
+ const computedPaddingTop = computed(() => middle.value ? DIALOG_MINIMUM_PADDING : top2.value);
2880
+ const computedPaddingBottom = computed(() => middle.value ? DIALOG_MINIMUM_PADDING : bottom2.value);
2881
+ const computedContainerClass = computed(() => [
2882
+ containerClass.value,
2883
+ `dao-dialog--size-${size.value}`
2884
+ ]);
2885
+ const showHeader = computed(() => typeof header2.value === "boolean" ? header2.value : true);
2886
+ const headerTitle = computed(() => typeof header2.value === "string" ? header2.value : "");
2887
+ watch(modelValue, (newV) => {
2888
+ emit("change", newV);
2765
2889
  });
2766
- const createPopper$1 = async () => {
2767
- var _a2;
2768
- if (popperInstance == null ? void 0 : popperInstance.destroy) {
2769
- popperInstance.destroy();
2770
- }
2771
- const unrefVisibleArrow = unref(visibleArrow);
2772
- const unrefOffset = unref(offset2);
2773
- const modifiers = [
2774
- preventOverflow$1,
2775
- offsetModifier,
2776
- flip$1,
2777
- {
2778
- name: "preventOverflow",
2779
- options: {
2780
- boundary: unref(boundary),
2781
- rootBoundary: "viewport",
2782
- padding: {
2783
- top: 2,
2784
- bottom: 2,
2785
- left: 5,
2786
- right: 5
2787
- }
2788
- }
2789
- }
2790
- ];
2791
- if (unrefVisibleArrow && _arrowNode) {
2792
- modifiers.push(arrow$1, {
2793
- name: "arrow",
2794
- options: {
2795
- element: _arrowNode
2796
- }
2797
- });
2798
- }
2799
- if (unrefOffset) {
2800
- const offsetValue = [0, Number(unrefOffset)];
2801
- modifiers.push({
2802
- name: "offset",
2803
- options: {
2804
- offset: offsetValue
2805
- }
2806
- });
2807
- }
2808
- modifiers.push(...((_a2 = unref(popperOptions)) == null ? void 0 : _a2.modifiers) || []);
2809
- const ppOptions = __spreadProps(__spreadValues({
2810
- strategy: "fixed",
2811
- placement: unref(placement)
2812
- }, unref(popperOptions)), {
2813
- modifiers
2814
- });
2815
- if (_targetNode && _popperNode) {
2816
- popperInstance = createPopper(_targetNode, _popperNode, ppOptions);
2817
- }
2818
- await nextTick();
2819
- isOpen.value = true;
2820
- popperInstance == null ? void 0 : popperInstance.update();
2821
- };
2822
- const updatePopper = (fn2) => {
2823
- if (popperInstance) {
2824
- if (fn2) {
2825
- fn2();
2826
- }
2827
- popperInstance == null ? void 0 : popperInstance.update();
2890
+ const lockWindowScroll = () => {
2891
+ if (!lockScroll.value) {
2828
2892
  return;
2829
2893
  }
2830
- createPopper$1();
2831
- };
2832
- const destroyPopper = () => {
2833
- if (popperInstance) {
2834
- popperInstance.destroy();
2835
- popperInstance = null;
2836
- }
2894
+ const bodyDialogNum = Number(document.body.getAttribute(DIALOG_NUM_ATTR) || 0);
2895
+ document.body.setAttribute(DIALOG_NUM_ATTR, String(bodyDialogNum + 1));
2896
+ document.body.style.overflow = "hidden";
2837
2897
  };
2838
- const showPopper = () => {
2839
- if (unref(isOpen)) {
2840
- return;
2841
- }
2842
- if (popperInstance) {
2843
- isOpen.value = true;
2844
- updatePopperOptions(popperInstance, {
2845
- name: "eventListeners",
2846
- enabled: true
2847
- });
2848
- emit("after-show");
2849
- }
2850
- updatePopper();
2898
+ const onClose = () => {
2899
+ emit("update:modelValue", false);
2851
2900
  };
2852
- const hidePopper = () => {
2853
- if (!unref(isOpen)) {
2854
- return;
2855
- }
2856
- isOpen.value = false;
2857
- if (popperInstance) {
2858
- updatePopperOptions(popperInstance, {
2859
- name: "eventListeners",
2860
- enabled: false
2861
- });
2901
+ const onCancel = () => {
2902
+ emit("cancel");
2903
+ onClose();
2904
+ };
2905
+ const onKeyDown = (event) => {
2906
+ if (event.code === "Escape" && closeOnPressEscape.value) {
2907
+ onCancel();
2862
2908
  }
2863
- emit("after-hide");
2864
2909
  };
2865
- const show = () => {
2866
- if (unref(disabled)) {
2910
+ const unLockWindowScroll = () => {
2911
+ if (!lockScroll.value) {
2867
2912
  return;
2868
2913
  }
2869
- clearTimeout(_scheduleTimer);
2870
- emit("show");
2871
- const delayValue = unref(showDelay);
2872
- if (!delayValue) {
2873
- showPopper();
2914
+ const specDialogNum = Number(document.body.getAttribute(DIALOG_NUM_ATTR)) - 1;
2915
+ if (specDialogNum < 1) {
2916
+ document.body.removeAttribute(DIALOG_NUM_ATTR);
2917
+ document.body.style.overflow = "";
2874
2918
  } else {
2875
- _scheduleTimer = setTimeout(showPopper, Number(delayValue));
2919
+ document.body.setAttribute(DIALOG_NUM_ATTR, String(specDialogNum));
2876
2920
  }
2877
2921
  };
2878
- const hide = () => {
2879
- if (unref(disabled)) {
2880
- return;
2922
+ let currentDialogOpened = false;
2923
+ const onBeforeEnter = () => {
2924
+ document.addEventListener(KEYBOARD_EVENT_NAME$1, onKeyDown);
2925
+ lockWindowScroll();
2926
+ currentDialogOpened = true;
2927
+ emit("before-open");
2928
+ };
2929
+ const onAfterEnter = () => {
2930
+ emit("opened");
2931
+ };
2932
+ const onConfirm = () => {
2933
+ emit("confirm");
2934
+ onClose();
2935
+ };
2936
+ const onWrapperMousedown = () => {
2937
+ if (closeOnClickOutside.value) {
2938
+ onCancel();
2881
2939
  }
2882
- clearTimeout(_scheduleTimer);
2883
- emit("hide");
2884
- const delayValue = unref(hideDelay);
2885
- if (!delayValue) {
2886
- hidePopper();
2887
- } else {
2888
- _scheduleTimer = setTimeout(hidePopper, Number(delayValue));
2940
+ };
2941
+ const onBeforeLeave = () => {
2942
+ emit("before-close");
2943
+ };
2944
+ const onAfterLeave = () => {
2945
+ document.removeEventListener(KEYBOARD_EVENT_NAME$1, onKeyDown);
2946
+ unLockWindowScroll();
2947
+ currentDialogOpened = false;
2948
+ emit("closed");
2949
+ };
2950
+ onBeforeUnmount(() => {
2951
+ if (currentDialogOpened) {
2952
+ onAfterLeave();
2889
2953
  }
2954
+ });
2955
+ return {
2956
+ computedPaddingTop,
2957
+ computedPaddingBottom,
2958
+ computedContainerClass,
2959
+ headerTitle,
2960
+ showHeader,
2961
+ textContent,
2962
+ onBeforeEnter,
2963
+ onAfterEnter,
2964
+ onConfirm,
2965
+ onCancel,
2966
+ onWrapperMousedown,
2967
+ onBeforeLeave,
2968
+ onAfterLeave
2890
2969
  };
2891
- const toggle = () => {
2892
- if (unref(isOpen)) {
2893
- hide();
2894
- } else {
2895
- show();
2970
+ }
2971
+ });
2972
+ const _hoisted_1$p = { class: "dao-dialog__body" };
2973
+ function _sfc_render$z(_ctx, _cache, $props, $setup, $data, $options) {
2974
+ const _component_dialog_header = resolveComponent("dialog-header");
2975
+ const _component_dialog_footer = resolveComponent("dialog-footer");
2976
+ return openBlock(), createBlock(Transition, {
2977
+ appear: "",
2978
+ name: "dao-dialog",
2979
+ onBeforeEnter: _ctx.onBeforeEnter,
2980
+ onAfterEnter: _ctx.onAfterEnter,
2981
+ onBeforeLeave: _ctx.onBeforeLeave,
2982
+ onAfterLeave: _ctx.onAfterLeave
2983
+ }, {
2984
+ default: withCtx(() => [
2985
+ _ctx.modelValue ? (openBlock(), createElementBlock("div", {
2986
+ key: 0,
2987
+ class: normalizeClass(["dao-dialog__backdrop", { "dao-dialog__backdrop--middle": _ctx.middle }]),
2988
+ onMousedown: _cache[0] || (_cache[0] = withModifiers((...args) => _ctx.onWrapperMousedown && _ctx.onWrapperMousedown(...args), ["self"]))
2989
+ }, [
2990
+ createElementVNode("div", {
2991
+ class: normalizeClass(["dao-dialog__container", _ctx.computedContainerClass]),
2992
+ style: normalizeStyle({
2993
+ "margin-top": _ctx.computedPaddingTop,
2994
+ "margin-bottom": _ctx.computedPaddingBottom
2995
+ })
2996
+ }, [
2997
+ _ctx.showHeader ? (openBlock(), createBlock(_component_dialog_header, {
2998
+ key: 0,
2999
+ title: _ctx.headerTitle,
3000
+ "show-close": _ctx.showClose,
3001
+ onClose: _ctx.onCancel
3002
+ }, {
3003
+ "before-title": withCtx(() => [
3004
+ renderSlot(_ctx.$slots, "before-title")
3005
+ ]),
3006
+ title: withCtx(() => [
3007
+ renderSlot(_ctx.$slots, "title")
3008
+ ]),
3009
+ "after-title": withCtx(() => [
3010
+ renderSlot(_ctx.$slots, "after-title")
3011
+ ]),
3012
+ default: withCtx(() => [
3013
+ renderSlot(_ctx.$slots, "header")
3014
+ ]),
3015
+ _: 3
3016
+ }, 8, ["title", "show-close", "onClose"])) : createCommentVNode("", true),
3017
+ createElementVNode("div", _hoisted_1$p, [
3018
+ renderSlot(_ctx.$slots, "default")
3019
+ ]),
3020
+ _ctx.footer ? (openBlock(), createBlock(_component_dialog_footer, {
3021
+ key: 1,
3022
+ "text-confirm": _ctx.textContent.confirm,
3023
+ "text-cancel": _ctx.textContent.cancel,
3024
+ "confirm-disabled": _ctx.confirmDisabled,
3025
+ "confirm-loading": _ctx.confirmLoading,
3026
+ onConfirm: _ctx.onConfirm,
3027
+ onCancel: _ctx.onCancel
3028
+ }, {
3029
+ default: withCtx(() => [
3030
+ renderSlot(_ctx.$slots, "footer")
3031
+ ]),
3032
+ _: 3
3033
+ }, 8, ["text-confirm", "text-cancel", "confirm-disabled", "confirm-loading", "onConfirm", "onCancel"])) : createCommentVNode("", true)
3034
+ ], 6)
3035
+ ], 34)) : createCommentVNode("", true)
3036
+ ]),
3037
+ _: 3
3038
+ }, 8, ["onBeforeEnter", "onAfterEnter", "onBeforeLeave", "onAfterLeave"]);
3039
+ }
3040
+ var dialog = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["render", _sfc_render$z]]);
3041
+ const drawerProps = {
3042
+ modelValue: {
3043
+ type: Boolean,
3044
+ default: false
3045
+ },
3046
+ hideHeader: {
3047
+ type: Boolean,
3048
+ default: false
3049
+ },
3050
+ hideFooter: {
3051
+ type: Boolean,
3052
+ default: false
3053
+ },
3054
+ hideMask: {
3055
+ type: Boolean,
3056
+ default: false
3057
+ },
3058
+ hideCloseIcon: {
3059
+ type: Boolean,
3060
+ default: false
3061
+ },
3062
+ title: {
3063
+ type: String,
3064
+ default: ""
3065
+ },
3066
+ size: {
3067
+ type: String,
3068
+ default: "md"
3069
+ },
3070
+ cancelText: {
3071
+ type: String,
3072
+ default: void 0
3073
+ },
3074
+ confirmText: {
3075
+ type: String,
3076
+ default: void 0
3077
+ }
3078
+ };
3079
+ const getFocusElementRange = (elementNode) => {
3080
+ const focusedElementOrigin = document.activeElement;
3081
+ let firstTab = null;
3082
+ let lastTab = null;
3083
+ const focusableElementsString = 'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [tabindex="0"], [contenteditable]';
3084
+ if (elementNode) {
3085
+ const focusableElements = Array.from(elementNode.querySelectorAll(focusableElementsString));
3086
+ firstTab = focusableElements[0];
3087
+ lastTab = focusableElements[focusableElements.length - 1];
3088
+ firstTab == null ? void 0 : firstTab.focus();
3089
+ }
3090
+ return {
3091
+ lastTab,
3092
+ firstTab,
3093
+ focusedElementOrigin
3094
+ };
3095
+ };
3096
+ const trapTabKey = (e, firstTab, lastTab) => {
3097
+ if (e.code === "Tab") {
3098
+ if (e.shiftKey) {
3099
+ if (document.activeElement === firstTab) {
3100
+ e.preventDefault();
3101
+ lastTab.focus();
3102
+ }
3103
+ } else if (document.activeElement === lastTab) {
3104
+ e.preventDefault();
3105
+ firstTab.focus();
3106
+ }
3107
+ }
3108
+ };
3109
+ var drawer_vue_vue_type_style_index_0_lang = "";
3110
+ const KEYBOARD_EVENT_NAME = "keydown";
3111
+ const _sfc_main$A = defineComponent({
3112
+ name: "DaoDrawer",
3113
+ components: {
3114
+ DaoButton,
3115
+ DaoActionIcon
3116
+ },
3117
+ props: drawerProps,
3118
+ emits: ["update:modelValue", "close", "confirm"],
3119
+ setup(props, { emit }) {
3120
+ const { t } = useI18n();
3121
+ const { modelValue, size } = toRefs(props);
3122
+ const visible = ref(false);
3123
+ const wrapVisible = ref(false);
3124
+ const drawerRef = ref(null);
3125
+ const textContent = computed(() => {
3126
+ var _a2, _b2;
3127
+ return {
3128
+ confirm: (_a2 = props.confirmText) != null ? _a2 : t("core.drawer.confirm"),
3129
+ cancel: (_b2 = props.cancelText) != null ? _b2 : t("core.drawer.cancel")
3130
+ };
3131
+ });
3132
+ let focusElement = {
3133
+ firstTab: null,
3134
+ lastTab: null,
3135
+ focusedElementOrigin: null
3136
+ };
3137
+ const wrapClassList = computed(() => [
3138
+ "dao-drawer__wrap",
3139
+ {
3140
+ "dao-drawer__wrap--hide": !wrapVisible.value
3141
+ }
3142
+ ]);
3143
+ const contentClassList = computed(() => [
3144
+ "dao-drawer",
3145
+ `dao-drawer-${size.value}`
3146
+ ]);
3147
+ const checkMasksVisible = () => {
3148
+ const masks = document.getElementsByClassName("dao-drawer__mask") || [];
3149
+ return !Array.from(masks).some((v) => v.style.display === "");
3150
+ };
3151
+ const lockWindowScroll = () => {
3152
+ document.body.style.overflow = "hidden";
3153
+ document.body.tabIndex = -1;
3154
+ };
3155
+ const unLockWindowScroll = () => {
3156
+ if (checkMasksVisible()) {
3157
+ document.body.style.overflow = "";
2896
3158
  }
2897
3159
  };
2898
- const handleDocumentClick = (e) => {
2899
- let { target } = e;
2900
- if (e.composed) {
2901
- const composedPath = e.composedPath();
2902
- if (composedPath.length) {
2903
- [target] = composedPath;
2904
- }
2905
- }
2906
- if (!unref(isOpen)) {
2907
- return;
2908
- }
2909
- if (!(_popperNode == null ? void 0 : _popperNode.contains(target)) && !(_targetNode == null ? void 0 : _targetNode.contains(target))) {
2910
- hide();
2911
- }
3160
+ const close = () => {
3161
+ visible.value = false;
3162
+ emit("update:modelValue", false);
3163
+ emit("close");
2912
3164
  };
2913
- const operateEventListeners = (fn2) => {
2914
- let unrefTrigger = unref(trigger);
2915
- if (unrefTrigger === "manual") {
2916
- return;
2917
- }
2918
- if (!Array.isArray(unrefTrigger)) {
2919
- unrefTrigger = [unrefTrigger];
3165
+ const handleWrapClick = (event) => {
3166
+ const { target } = event;
3167
+ const className = target.getAttribute("class");
3168
+ if (className && className.indexOf("dao-drawer__wrap") > -1) {
3169
+ close();
2920
3170
  }
2921
- unrefTrigger.forEach((triggerType) => {
2922
- switch (triggerType) {
2923
- case "click":
2924
- fn2(_targetNode, "click", toggle);
2925
- fn2(document, "click", handleDocumentClick);
2926
- break;
2927
- case "hover":
2928
- fn2(_targetNode, "mouseenter", show);
2929
- fn2(_popperNode, "mouseenter", show);
2930
- fn2(_targetNode, "mouseleave", hide);
2931
- fn2(_popperNode, "mouseleave", hide);
2932
- break;
2933
- case "focus":
2934
- fn2(_targetNode, "focusin", show);
2935
- fn2(_popperNode, "focusin", show);
2936
- fn2(_targetNode, "focusout", hide);
2937
- fn2(_popperNode, "focusout", hide);
2938
- break;
2939
- }
2940
- });
2941
3171
  };
2942
- const addEventListeners = () => {
2943
- operateEventListeners(on);
3172
+ const handleWrapVisible = (v) => {
3173
+ if (!v) {
3174
+ setTimeout(() => {
3175
+ wrapVisible.value = v;
3176
+ }, 100);
3177
+ } else {
3178
+ wrapVisible.value = v;
3179
+ }
2944
3180
  };
2945
- const removeEventListeners = () => {
2946
- operateEventListeners(off);
3181
+ const confirm = () => {
3182
+ visible.value = false;
3183
+ emit("update:modelValue", false);
3184
+ emit("confirm");
2947
3185
  };
2948
- const init = () => {
2949
- var _a2, _b2, _c, _d;
2950
- if (!slots.default) {
2951
- throw new Error("Trigger must be provided");
2952
- }
2953
- _targetNode = (_a2 = unref(reference2)) == null ? void 0 : _a2.firstElementChild;
2954
- _popperNode = (_b2 = unref(popper2)) == null ? void 0 : _b2.$el;
2955
- _arrowNode = (_d = (_c = unref(popper2)) == null ? void 0 : _c.$refs) == null ? void 0 : _d.arrow;
2956
- addEventListeners();
2957
- if (unref(isOpen) || unref(modelValue)) {
2958
- showPopper();
3186
+ const setLastFocusElement = () => {
3187
+ if (focusElement.focusedElementOrigin instanceof HTMLElement) {
3188
+ focusElement.focusedElementOrigin.focus();
2959
3189
  }
2960
3190
  };
2961
- const destroyOffsetWatcher = watch(offset2, (newV) => {
2962
- if (popperInstance) {
2963
- updatePopper(() => {
2964
- if (popperInstance) {
2965
- updatePopperOptions(popperInstance, {
2966
- name: "offset",
2967
- options: {
2968
- offset: [0, Number(newV)]
2969
- }
2970
- });
2971
- }
2972
- });
3191
+ const onHandleKeyDown = (e) => {
3192
+ if (e.code === "Escape") {
3193
+ close();
2973
3194
  }
2974
- });
2975
- const destroyModelWatcher = watch(modelValue, () => {
2976
- if (unref(disabled) || unref(trigger) !== "manual") {
3195
+ if (!focusElement.firstTab || !focusElement.lastTab) {
2977
3196
  return;
2978
3197
  }
2979
- if (unref(modelValue)) {
2980
- show();
2981
- } else {
2982
- hide();
2983
- }
2984
- });
2985
- const destroyOpenWatcher = watch(isOpen, (newV) => {
2986
- emit("update:modelValue", newV);
2987
- });
2988
- const destroyBoundaryWatcher = watch(boundary, (newV) => {
2989
- if (popperInstance) {
2990
- updatePopper(() => {
2991
- if (popperInstance) {
2992
- updatePopperOptions(popperInstance, {
2993
- name: "preventOverflow",
2994
- options: {
2995
- boundary: newV
2996
- }
2997
- });
2998
- }
2999
- });
3000
- }
3001
- });
3002
- const destroyPlacementWatcher = watch(placement, (newV) => {
3003
- if (popperInstance) {
3004
- updatePopper(() => {
3005
- if (popperInstance) {
3006
- updatePopperOptions(popperInstance, [], {
3007
- placement: newV
3008
- });
3009
- }
3010
- });
3011
- }
3012
- });
3013
- const destroyArrowWatcher = watch(visibleArrow, (newVal) => {
3014
- if (popperInstance) {
3015
- updatePopper(() => {
3016
- if (popperInstance && _arrowNode) {
3017
- updatePopperOptions(popperInstance, [
3018
- arrow$1,
3019
- {
3020
- name: "arrow",
3021
- enabled: newVal,
3022
- options: {
3023
- element: _arrowNode
3024
- }
3025
- }
3026
- ]);
3027
- }
3028
- });
3029
- }
3030
- });
3031
- const destroyPopperOptionWatcher = watch(popperOptions, (newV) => {
3032
- if (popperInstance) {
3033
- updatePopper(() => {
3034
- if (popperInstance) {
3035
- updatePopperOptions(popperInstance, [], newV);
3036
- }
3037
- });
3038
- }
3039
- });
3040
- onMounted(() => {
3041
- init();
3042
- });
3043
- onBeforeUnmount(() => {
3044
- destroyOffsetWatcher();
3045
- destroyModelWatcher();
3046
- destroyOpenWatcher();
3047
- destroyBoundaryWatcher();
3048
- destroyPlacementWatcher();
3049
- destroyArrowWatcher();
3050
- destroyPopperOptionWatcher();
3051
- removeEventListeners();
3052
- destroyPopper();
3053
- });
3198
+ trapTabKey(e, focusElement.firstTab, focusElement.lastTab);
3199
+ };
3200
+ const onBeforeEnter = () => {
3201
+ focusElement = getFocusElementRange(drawerRef.value);
3202
+ lockWindowScroll();
3203
+ document.addEventListener(KEYBOARD_EVENT_NAME, onHandleKeyDown);
3204
+ };
3205
+ const onAfterLeave = () => {
3206
+ setLastFocusElement();
3207
+ unLockWindowScroll();
3208
+ document.removeEventListener(KEYBOARD_EVENT_NAME, onHandleKeyDown);
3209
+ };
3210
+ watch(modelValue, (v) => {
3211
+ visible.value = v;
3212
+ handleWrapVisible(v);
3213
+ }, { immediate: true });
3054
3214
  return {
3055
- isOpen,
3056
- popper: popper2,
3057
- reference: reference2,
3058
- popperId,
3059
- themeClass,
3060
- hide,
3061
- actualAppendTo,
3062
- isTelDisabled
3215
+ visible,
3216
+ drawerRef,
3217
+ wrapClassList,
3218
+ contentClassList,
3219
+ textContent,
3220
+ close,
3221
+ confirm,
3222
+ handleWrapClick,
3223
+ onBeforeEnter,
3224
+ onAfterLeave
3063
3225
  };
3064
3226
  }
3065
3227
  });
3066
- function _sfc_render$z(_ctx, _cache, $props, $setup, $data, $options) {
3067
- const _component_popper_content = resolveComponent("popper-content");
3068
- return openBlock(), createElementBlock("div", {
3069
- ref: "reference",
3070
- class: normalizeClass([
3071
- "dao-popper-target",
3072
- {
3073
- "dao-popper-target--open": _ctx.isOpen
3074
- }
3075
- ])
3076
- }, [
3077
- renderSlot(_ctx.$slots, "default"),
3078
- (openBlock(), createBlock(Teleport, {
3079
- to: _ctx.actualAppendTo,
3080
- disabled: _ctx.isTelDisabled
3228
+ const _hoisted_1$o = { class: "dao-drawer__content" };
3229
+ const _hoisted_2$j = {
3230
+ key: 0,
3231
+ class: "dao-drawer__header"
3232
+ };
3233
+ const _hoisted_3$b = { class: "dao-drawer__header-group" };
3234
+ const _hoisted_4$8 = { class: "dao-drawer__body" };
3235
+ const _hoisted_5$7 = {
3236
+ key: 1,
3237
+ class: "dao-drawer__footer"
3238
+ };
3239
+ const _hoisted_6$5 = { class: "dao-drawer__footer-group" };
3240
+ function _sfc_render$y(_ctx, _cache, $props, $setup, $data, $options) {
3241
+ const _component_dao_action_icon = resolveComponent("dao-action-icon");
3242
+ const _component_dao_button = resolveComponent("dao-button");
3243
+ return openBlock(), createElementBlock("div", null, [
3244
+ createVNode(Transition, { name: "fade-in" }, {
3245
+ default: withCtx(() => [
3246
+ !_ctx.hideMask ? withDirectives((openBlock(), createElementBlock("div", {
3247
+ key: 0,
3248
+ class: "dao-drawer__mask",
3249
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.close && _ctx.close(...args)),
3250
+ onKeydown: _cache[1] || (_cache[1] = (...args) => _ctx.close && _ctx.close(...args))
3251
+ }, null, 544)), [
3252
+ [vShow, _ctx.visible]
3253
+ ]) : createCommentVNode("", true)
3254
+ ]),
3255
+ _: 1
3256
+ }),
3257
+ createElementVNode("div", {
3258
+ ref: "drawerRef",
3259
+ class: normalizeClass(_ctx.wrapClassList),
3260
+ onClick: _cache[2] || (_cache[2] = (...args) => _ctx.handleWrapClick && _ctx.handleWrapClick(...args)),
3261
+ onKeydown: _cache[3] || (_cache[3] = (...args) => _ctx.handleWrapClick && _ctx.handleWrapClick(...args))
3081
3262
  }, [
3082
- createVNode(Transition, { name: _ctx.transition }, {
3263
+ createVNode(Transition, {
3264
+ name: "slide-in-right",
3265
+ onAfterEnter: _ctx.onBeforeEnter,
3266
+ onAfterLeave: _ctx.onAfterLeave
3267
+ }, {
3083
3268
  default: withCtx(() => [
3084
- withDirectives(createVNode(_component_popper_content, {
3085
- ref: "popper",
3086
- theme: _ctx.themeClass,
3087
- "popper-id": _ctx.popperId,
3088
- "visible-arrow": _ctx.visibleArrow,
3089
- "is-open": _ctx.isOpen,
3090
- width: _ctx.width,
3091
- "popper-class": _ctx.popperClass
3092
- }, {
3093
- default: withCtx(() => [
3094
- renderSlot(_ctx.$slots, "content", {}, () => [
3095
- createTextVNode(toDisplayString(_ctx.content), 1)
3096
- ])
3097
- ]),
3098
- _: 3
3099
- }, 8, ["theme", "popper-id", "visible-arrow", "is-open", "width", "popper-class"]), [
3100
- [vShow, _ctx.isOpen]
3269
+ withDirectives(createElementVNode("div", {
3270
+ class: normalizeClass(_ctx.contentClassList)
3271
+ }, [
3272
+ createElementVNode("div", _hoisted_1$o, [
3273
+ !_ctx.hideHeader ? (openBlock(), createElementBlock("div", _hoisted_2$j, [
3274
+ renderSlot(_ctx.$slots, "header", {}, () => [
3275
+ createElementVNode("div", _hoisted_3$b, [
3276
+ createElementVNode("span", null, toDisplayString(_ctx.title), 1),
3277
+ !_ctx.hideCloseIcon ? (openBlock(), createBlock(_component_dao_action_icon, {
3278
+ key: 0,
3279
+ class: "dao-action-icon--close",
3280
+ name: "icon-close",
3281
+ onClick: _ctx.close
3282
+ }, null, 8, ["onClick"])) : createCommentVNode("", true)
3283
+ ])
3284
+ ])
3285
+ ])) : createCommentVNode("", true),
3286
+ createElementVNode("div", _hoisted_4$8, [
3287
+ renderSlot(_ctx.$slots, "default")
3288
+ ]),
3289
+ !_ctx.hideFooter ? (openBlock(), createElementBlock("div", _hoisted_5$7, [
3290
+ renderSlot(_ctx.$slots, "footer", {}, () => [
3291
+ createElementVNode("div", _hoisted_6$5, [
3292
+ createVNode(_component_dao_button, {
3293
+ type: "ghost",
3294
+ class: "footer-cancel-btn footer-btn",
3295
+ onClick: _ctx.close
3296
+ }, {
3297
+ default: withCtx(() => [
3298
+ createTextVNode(toDisplayString(_ctx.textContent.cancel), 1)
3299
+ ]),
3300
+ _: 1
3301
+ }, 8, ["onClick"]),
3302
+ createVNode(_component_dao_button, {
3303
+ class: "footer-btn",
3304
+ onClick: _ctx.confirm
3305
+ }, {
3306
+ default: withCtx(() => [
3307
+ createTextVNode(toDisplayString(_ctx.textContent.confirm), 1)
3308
+ ]),
3309
+ _: 1
3310
+ }, 8, ["onClick"])
3311
+ ])
3312
+ ])
3313
+ ])) : createCommentVNode("", true)
3314
+ ])
3315
+ ], 2), [
3316
+ [vShow, _ctx.visible]
3101
3317
  ])
3102
3318
  ]),
3103
3319
  _: 3
3104
- }, 8, ["name"])
3105
- ], 8, ["to", "disabled"]))
3106
- ], 2);
3320
+ }, 8, ["onAfterEnter", "onAfterLeave"])
3321
+ ], 34)
3322
+ ]);
3107
3323
  }
3108
- var DaoPopper = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["render", _sfc_render$z]]);
3109
- const _sfc_main$C = defineComponent({
3324
+ var drawer = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["render", _sfc_render$y]]);
3325
+ const _sfc_main$z = defineComponent({
3110
3326
  name: "DaoDropdown",
3111
3327
  components: {
3112
3328
  DaoPopper
@@ -3162,8 +3378,8 @@ const _sfc_main$C = defineComponent({
3162
3378
  };
3163
3379
  }
3164
3380
  });
3165
- const _hoisted_1$o = { tabindex: "0" };
3166
- function _sfc_render$y(_ctx, _cache, $props, $setup, $data, $options) {
3381
+ const _hoisted_1$n = { tabindex: "0" };
3382
+ function _sfc_render$x(_ctx, _cache, $props, $setup, $data, $options) {
3167
3383
  const _component_dao_popper = resolveComponent("dao-popper");
3168
3384
  return openBlock(), createBlock(_component_dao_popper, {
3169
3385
  ref: "popper",
@@ -3180,27 +3396,27 @@ function _sfc_render$y(_ctx, _cache, $props, $setup, $data, $options) {
3180
3396
  renderSlot(_ctx.$slots, "menu")
3181
3397
  ]),
3182
3398
  default: withCtx(() => [
3183
- createElementVNode("div", _hoisted_1$o, [
3399
+ createElementVNode("div", _hoisted_1$n, [
3184
3400
  renderSlot(_ctx.$slots, "default")
3185
3401
  ])
3186
3402
  ]),
3187
3403
  _: 3
3188
3404
  }, 8, ["placement", "append-to", "trigger", "offset", "model-value"]);
3189
3405
  }
3190
- var DaoDropdown = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["render", _sfc_render$y]]);
3406
+ var DaoDropdown = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["render", _sfc_render$x]]);
3191
3407
  var dropdownMenu_vue_vue_type_style_index_0_lang = "";
3192
- const _sfc_main$B = defineComponent({
3408
+ const _sfc_main$y = defineComponent({
3193
3409
  name: "DaoDropdownMenu"
3194
3410
  });
3195
- const _hoisted_1$n = { class: "dao-dropdown-menu" };
3196
- function _sfc_render$x(_ctx, _cache, $props, $setup, $data, $options) {
3197
- return openBlock(), createElementBlock("ul", _hoisted_1$n, [
3411
+ const _hoisted_1$m = { class: "dao-dropdown-menu" };
3412
+ function _sfc_render$w(_ctx, _cache, $props, $setup, $data, $options) {
3413
+ return openBlock(), createElementBlock("ul", _hoisted_1$m, [
3198
3414
  renderSlot(_ctx.$slots, "default")
3199
3415
  ]);
3200
3416
  }
3201
- var DaoDropdownMenu = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["render", _sfc_render$x]]);
3417
+ var DaoDropdownMenu = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["render", _sfc_render$w]]);
3202
3418
  var dropdownItem_vue_vue_type_style_index_0_lang = "";
3203
- const _sfc_main$A = defineComponent({
3419
+ const _sfc_main$x = defineComponent({
3204
3420
  name: "DaoDropdownItem",
3205
3421
  props: {
3206
3422
  type: {
@@ -3249,12 +3465,12 @@ const _sfc_main$A = defineComponent({
3249
3465
  };
3250
3466
  }
3251
3467
  });
3252
- function _sfc_render$w(_ctx, _cache, $props, $setup, $data, $options) {
3468
+ function _sfc_render$v(_ctx, _cache, $props, $setup, $data, $options) {
3253
3469
  return openBlock(), createElementBlock("li", mergeProps({ class: _ctx.classList }, _ctx.itemAttrs), [
3254
3470
  _ctx.type !== "divider" ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("", true)
3255
3471
  ], 16);
3256
3472
  }
3257
- var DaoDropdownItem = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["render", _sfc_render$w]]);
3473
+ var DaoDropdownItem = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["render", _sfc_render$v]]);
3258
3474
  const expansionProps = {
3259
3475
  modelValue: {
3260
3476
  type: [String, Symbol, Array]
@@ -3283,7 +3499,7 @@ const expansionItemProps = {
3283
3499
  }
3284
3500
  };
3285
3501
  var expansion_vue_vue_type_style_index_0_lang = "";
3286
- const _sfc_main$z = defineComponent({
3502
+ const _sfc_main$w = defineComponent({
3287
3503
  name: "DaoExpansion",
3288
3504
  props: expansionProps,
3289
3505
  emits: ["update:modelValue", "change"],
@@ -3375,193 +3591,14 @@ const _sfc_main$z = defineComponent({
3375
3591
  };
3376
3592
  }
3377
3593
  });
3378
- function _sfc_render$v(_ctx, _cache, $props, $setup, $data, $options) {
3594
+ function _sfc_render$u(_ctx, _cache, $props, $setup, $data, $options) {
3379
3595
  return openBlock(), createElementBlock("div", {
3380
3596
  class: normalizeClass(_ctx.classList)
3381
3597
  }, [
3382
3598
  renderSlot(_ctx.$slots, "default")
3383
3599
  ], 2);
3384
3600
  }
3385
- var expansion = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["render", _sfc_render$v]]);
3386
- var tooltipProps = __spreadProps(__spreadValues({}, PopperProps), {
3387
- offset: {
3388
- type: [Number, String],
3389
- default: 10
3390
- }
3391
- });
3392
- var tooltip_scss_vue_type_style_index_0_src_lang = "";
3393
- const _sfc_main$y = defineComponent(__spreadProps(__spreadValues({}, DaoPopper), {
3394
- name: "DaoTooltip",
3395
- props: tooltipProps,
3396
- daoPopperTheme: "dao-tooltip"
3397
- }));
3398
- var popover_scss_vue_type_style_index_0_src_lang = "";
3399
- const _sfc_main$x = defineComponent(__spreadProps(__spreadValues({}, DaoPopper), {
3400
- name: "DaoPopover",
3401
- props: PopperProps,
3402
- daoPopperTheme: "dao-popover"
3403
- }));
3404
- const placements = [
3405
- "auto",
3406
- "auto-start",
3407
- "auto-end",
3408
- "top",
3409
- "top-start",
3410
- "top-end",
3411
- "right",
3412
- "right-start",
3413
- "right-end",
3414
- "bottom",
3415
- "bottom-start",
3416
- "bottom-end",
3417
- "left",
3418
- "left-start",
3419
- "left-end"
3420
- ];
3421
- const ellipsisProps = {
3422
- type: {
3423
- type: String,
3424
- default: "tooltip"
3425
- },
3426
- manual: {
3427
- type: Boolean,
3428
- default: false
3429
- },
3430
- force: {
3431
- type: Boolean,
3432
- default: false
3433
- },
3434
- disabled: {
3435
- type: Boolean,
3436
- default: false
3437
- },
3438
- content: {
3439
- type: String,
3440
- default: ""
3441
- },
3442
- width: {
3443
- type: Number,
3444
- default: 200
3445
- },
3446
- ellipsisPlacement: {
3447
- type: String,
3448
- default: "bottom-start",
3449
- validator: (value) => placements.includes(value)
3450
- },
3451
- appendTo: {
3452
- type: [String, Boolean, Object],
3453
- default: "root"
3454
- },
3455
- popperClass: {
3456
- type: String,
3457
- default: ""
3458
- },
3459
- offset: {
3460
- type: [Number, String],
3461
- default: 10
3462
- },
3463
- delay: {
3464
- type: [Number, Object, String],
3465
- default: () => ({ show: 0, hide: 100 })
3466
- }
3467
- };
3468
- var ellipsis_vue_vue_type_style_index_0_lang = "";
3469
- const _sfc_main$w = defineComponent({
3470
- name: "DaoEllipsis",
3471
- components: {
3472
- Tooltip: _sfc_main$y,
3473
- Popover: _sfc_main$x
3474
- },
3475
- props: ellipsisProps,
3476
- setup(props) {
3477
- const disabled = ref(true);
3478
- const tooltipRef = ref();
3479
- const ComponentType = computed(() => props.type === "tooltip" ? _sfc_main$y : _sfc_main$x);
3480
- const isOpen = computed(() => {
3481
- var _a2, _b2, _c, _d;
3482
- return (_d = (_c = (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.$) == null ? void 0 : _b2.ctx) == null ? void 0 : _c.isOpen) != null ? _d : false;
3483
- });
3484
- const isEllipsis = ref(false);
3485
- const update = (ele) => {
3486
- isEllipsis.value = ((ele == null ? void 0 : ele.offsetWidth) || 0) < ((ele == null ? void 0 : ele.scrollWidth) || 0);
3487
- if (props.disabled) {
3488
- disabled.value = true;
3489
- return;
3490
- }
3491
- if (props.force) {
3492
- disabled.value = false;
3493
- return;
3494
- }
3495
- disabled.value = !isEllipsis.value;
3496
- };
3497
- function onMouseOver(e) {
3498
- var _a2;
3499
- let path = (_a2 = e == null ? void 0 : e.path) != null ? _a2 : [];
3500
- if (e.composedPath) {
3501
- path = e.composedPath();
3502
- }
3503
- const count = path.length;
3504
- let index2 = 0;
3505
- while (index2 < count) {
3506
- const target = path[index2];
3507
- if (target.scrollWidth) {
3508
- update(target);
3509
- break;
3510
- }
3511
- index2 += 1;
3512
- }
3513
- }
3514
- return {
3515
- ns: "dao-ellipsis",
3516
- disabled,
3517
- onMouseOver,
3518
- tooltipRef,
3519
- isOpen,
3520
- isEllipsis,
3521
- Tooltip: _sfc_main$y,
3522
- ComponentType
3523
- };
3524
- }
3525
- });
3526
- const _hoisted_1$m = { key: 1 };
3527
- function _sfc_render$u(_ctx, _cache, $props, $setup, $data, $options) {
3528
- return openBlock(), createBlock(resolveDynamicComponent(_ctx.ComponentType), {
3529
- ref: "ComponentRef",
3530
- disabled: _ctx.disabled,
3531
- "visible-arrow": false,
3532
- placement: _ctx.ellipsisPlacement,
3533
- offset: _ctx.offset,
3534
- class: normalizeClass([_ctx.ns]),
3535
- "append-to": _ctx.appendTo,
3536
- delay: _ctx.delay,
3537
- "popper-class": [`${_ctx.ns}-popper`, _ctx.popperClass].join(" "),
3538
- width: _ctx.width
3539
- }, createSlots({
3540
- default: withCtx(() => [
3541
- createElementVNode("span", {
3542
- class: normalizeClass([
3543
- !_ctx.manual && `${_ctx.ns}--auto-mode`
3544
- ]),
3545
- onMouseover: _cache[0] || (_cache[0] = (...args) => _ctx.onMouseOver && _ctx.onMouseOver(...args))
3546
- }, [
3547
- renderSlot(_ctx.$slots, "default")
3548
- ], 34)
3549
- ]),
3550
- _: 2
3551
- }, [
3552
- !_ctx.disabled ? {
3553
- name: "content",
3554
- fn: withCtx(() => [
3555
- _ctx.$slots.content ? renderSlot(_ctx.$slots, "content", {
3556
- key: 0,
3557
- show: _ctx.isOpen,
3558
- ellipsis: _ctx.isEllipsis
3559
- }) : _ctx.content ? (openBlock(), createElementBlock("span", _hoisted_1$m, toDisplayString(_ctx.content), 1)) : renderSlot(_ctx.$slots, "default", { key: 2 })
3560
- ])
3561
- } : void 0
3562
- ]), 1032, ["disabled", "placement", "offset", "class", "append-to", "delay", "popper-class", "width"]);
3563
- }
3564
- var DaoEllipsis = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["render", _sfc_render$u]]);
3601
+ var expansion = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["render", _sfc_render$u]]);
3565
3602
  var expansionItem_vue_vue_type_style_index_0_lang = "";
3566
3603
  const _sfc_main$v = defineComponent({
3567
3604
  name: "DaoExpansionItem",
@@ -3796,7 +3833,7 @@ var formItem_vue_vue_type_style_index_0_lang = "";
3796
3833
  const _sfc_main$t = defineComponent({
3797
3834
  name: "DaoFormItem",
3798
3835
  components: {
3799
- DaoTooltip: _sfc_main$y,
3836
+ DaoTooltip: _sfc_main$G,
3800
3837
  DaoEllipsis
3801
3838
  },
3802
3839
  props: {
@@ -8846,7 +8883,7 @@ var components = /* @__PURE__ */ Object.freeze({
8846
8883
  NavItem: navItem,
8847
8884
  NavSub: navSub,
8848
8885
  Pagination: DaoPagination,
8849
- Popover: _sfc_main$x,
8886
+ Popover: _sfc_main$F,
8850
8887
  Popper: DaoPopper,
8851
8888
  Progress: progress,
8852
8889
  Radio: radio,
@@ -8860,7 +8897,7 @@ var components = /* @__PURE__ */ Object.freeze({
8860
8897
  TabItem: tabItem,
8861
8898
  Tag: DaoTag,
8862
8899
  Toolbar: toolbar,
8863
- Tooltip: _sfc_main$y,
8900
+ Tooltip: _sfc_main$G,
8864
8901
  TextButton: _sfc_main$2,
8865
8902
  DaoEllipsis,
8866
8903
  Transfer: transfer,
@@ -8979,4 +9016,4 @@ var index = {
8979
9016
  install,
8980
9017
  locale
8981
9018
  };
8982
- export { DaoActionIcon as ActionIcon, breadcrumb as Breadcrumb, DaoBreadcrumbItem as BreadcrumbItem, DaoButton as Button, buttonGroup as ButtonGroup, card as Card, cardItem as CardItem, DaoCheckbox as Checkbox, checkboxGroup as CheckboxGroup, DaoEllipsis, dialog as Dialog, DialogFooter, DialogHeader, drawer as Drawer, DaoDropdown as Dropdown, DaoDropdownItem as DropdownItem, DaoDropdownMenu as DropdownMenu, expansion as Expansion, expansionItem as ExpansionItem, form as Form, formGroup as FormGroup, formItem as FormItem, header as Header, DaoIcon as Icon, DaoInput as Input, message as Message, nav as Nav, navHead as NavHead, navItem as NavItem, navSub as NavSub, DaoOption as Option, DaoPagination as Pagination, _sfc_main$x as Popover, DaoPopper as Popper, progress as Progress, radio as Radio, radioGroup as RadioGroup, DaoSelect as Select, _switch as Switch, tabItem as TabItem, _sfc_main$8 as TabNav, table as Table, tabs as Tabs, DaoTag as Tag, _sfc_main$2 as TextButton, toolbar as Toolbar, _sfc_main$y as Tooltip, transfer as Transfer, transferPanel as TransferPanel, index as default, formClassNames, formKey, formProps };
9019
+ export { DaoActionIcon as ActionIcon, breadcrumb as Breadcrumb, DaoBreadcrumbItem as BreadcrumbItem, DaoButton as Button, buttonGroup as ButtonGroup, card as Card, cardItem as CardItem, DaoCheckbox as Checkbox, checkboxGroup as CheckboxGroup, DaoEllipsis, dialog as Dialog, DialogFooter, DialogHeader, drawer as Drawer, DaoDropdown as Dropdown, DaoDropdownItem as DropdownItem, DaoDropdownMenu as DropdownMenu, expansion as Expansion, expansionItem as ExpansionItem, form as Form, formGroup as FormGroup, formItem as FormItem, header as Header, DaoIcon as Icon, DaoInput as Input, message as Message, nav as Nav, navHead as NavHead, navItem as NavItem, navSub as NavSub, DaoOption as Option, DaoPagination as Pagination, _sfc_main$F as Popover, DaoPopper as Popper, progress as Progress, radio as Radio, radioGroup as RadioGroup, DaoSelect as Select, _switch as Switch, tabItem as TabItem, _sfc_main$8 as TabNav, table as Table, tabs as Tabs, DaoTag as Tag, _sfc_main$2 as TextButton, toolbar as Toolbar, _sfc_main$G as Tooltip, transfer as Transfer, transferPanel as TransferPanel, index as default, formClassNames, formKey, formProps };