ninemoon-ui 0.0.27 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/dist/components/alert/alert.d.ts +3 -11
  2. package/dist/components/alert/alertcomponent.vue.d.ts +22 -11
  3. package/dist/components/badge/badge.vue.d.ts +2 -0
  4. package/dist/components/carousel/carousel.vue.d.ts +29 -3
  5. package/dist/components/{tree/tree.vue.d.ts → carousel/clickbutton.vue.d.ts} +6 -19
  6. package/dist/components/check/checkbox.vue.d.ts +24 -16
  7. package/dist/components/check/checkgroup.vue.d.ts +15 -3
  8. package/dist/components/date/datepicker.vue.d.ts +28 -6
  9. package/dist/components/date/datepickerRange.vue.d.ts +15 -4
  10. package/dist/components/form/form.vue.d.ts +7 -20
  11. package/dist/components/form/formlabel.vue.d.ts +3 -3
  12. package/dist/components/form/type.d.ts +11 -0
  13. package/dist/components/icon/add.vue.d.ts +2 -0
  14. package/dist/components/icon/alertTip.vue.d.ts +2 -0
  15. package/dist/components/icon/arrow.vue.d.ts +2 -0
  16. package/dist/components/icon/calendar.vue.d.ts +2 -0
  17. package/dist/components/icon/close.vue.d.ts +2 -0
  18. package/dist/components/icon/dateArrow.vue.d.ts +2 -0
  19. package/dist/components/icon/dateArrowplus.vue.d.ts +2 -0
  20. package/dist/components/icon/delete.vue.d.ts +2 -0
  21. package/dist/components/icon/ellipsis.vue.d.ts +2 -0
  22. package/dist/components/icon/errTip.vue.d.ts +2 -0
  23. package/dist/components/icon/eye.vue.d.ts +2 -0
  24. package/dist/components/icon/infoTip.vue.d.ts +2 -0
  25. package/dist/components/icon/minus.vue.d.ts +2 -0
  26. package/dist/components/icon/successTip.vue.d.ts +2 -0
  27. package/dist/components/icon/turnleft.vue.d.ts +2 -0
  28. package/dist/components/icon/turnright.vue.d.ts +2 -0
  29. package/dist/components/icon/warnTip.vue.d.ts +2 -0
  30. package/dist/components/input/input.vue.d.ts +13 -8
  31. package/dist/components/loadding/loadcomponent.vue.d.ts +24 -4
  32. package/dist/components/loadding/loadding.d.ts +12 -19
  33. package/dist/components/menu/menu.vue.d.ts +13 -3
  34. package/dist/components/message/message.d.ts +68 -14
  35. package/dist/components/message/messagecomponent.vue.d.ts +5 -13
  36. package/dist/components/numberInput/numberinput.vue.d.ts +3 -3
  37. package/dist/components/pagination/pagination.vue.d.ts +24 -0
  38. package/dist/components/popover/poparrow.d.ts +55 -0
  39. package/dist/components/popover/popover.vue.d.ts +10 -4
  40. package/dist/components/radio/radiobox.vue.d.ts +24 -16
  41. package/dist/components/radio/radiogroup.vue.d.ts +15 -3
  42. package/dist/components/scrollBar/movebar.vue.d.ts +2 -2
  43. package/dist/components/scrollBar/scrollBar.vue.d.ts +12 -16
  44. package/dist/components/scrollloading/scrolllead.d.ts +18 -11
  45. package/dist/components/select/select.vue.d.ts +15 -1
  46. package/dist/components/select/selectoption.vue.d.ts +18 -6
  47. package/dist/components/switch/switch.vue.d.ts +14 -14
  48. package/dist/components/table/table.vue.d.ts +20 -9
  49. package/dist/components/table/tableItem.vue.d.ts +10 -4
  50. package/dist/components/tabs/tabs.vue.d.ts +14 -1
  51. package/dist/dialog.css +9 -0
  52. package/dist/directives/arrowKeys.d.ts +10 -0
  53. package/dist/directives/drag.d.ts +20 -0
  54. package/dist/directives/escape.d.ts +7 -0
  55. package/dist/directives/outsideclick.d.ts +14 -0
  56. package/dist/directives/watchwindow.d.ts +13 -0
  57. package/dist/directives/wheel.d.ts +12 -0
  58. package/dist/directives/whitespaceclick.d.ts +12 -0
  59. package/dist/index.css +1186 -873
  60. package/dist/index.d.ts +831 -401
  61. package/dist/index.es.js +22 -23
  62. package/dist/index.umd.js +4019 -3764
  63. package/dist/js/arrow/arrow.js +17 -0
  64. package/dist/js/badge/badge.js +9 -16
  65. package/dist/js/calendar/calendar.js +87 -0
  66. package/dist/js/carousel/carousel.js +101 -117
  67. package/dist/js/carousel/carouselitem.js +1 -7
  68. package/dist/js/check/checkbox.js +38 -4
  69. package/dist/js/check/checkgroup.js +40 -51
  70. package/dist/js/date/datepicker.js +146 -150
  71. package/dist/js/date/datepickerRange.js +265 -354
  72. package/dist/js/dateArrowplus/dateArrowplus.js +25 -0
  73. package/dist/js/delete/delete.js +19 -0
  74. package/dist/js/dialog/dialog.js +41 -57
  75. package/dist/js/form/form.js +30 -38
  76. package/dist/js/form/formlabel.js +99 -130
  77. package/dist/js/image/image.js +199 -149
  78. package/dist/js/index/index.js +605 -507
  79. package/dist/js/input/input.js +60 -43
  80. package/dist/js/menu/menu.js +47 -20
  81. package/dist/js/numberInput/numberinput.js +52 -60
  82. package/dist/js/pagination/pagination.js +125 -156
  83. package/dist/js/popover/popover.js +238 -134
  84. package/dist/js/radio/radiobox.js +37 -4
  85. package/dist/js/radio/radiogroup.js +15 -51
  86. package/dist/js/scrollBar/scrollBar.js +100 -56
  87. package/dist/js/select/select.js +155 -70
  88. package/dist/js/select/selectoption.js +45 -4
  89. package/dist/js/shapeFlag/shapeFlag.js +17 -0
  90. package/dist/js/switch/switch.js +14 -14
  91. package/dist/js/table/table.js +165 -111
  92. package/dist/js/table/tableItem.js +1 -1
  93. package/dist/js/tabs/tabs.js +57 -59
  94. package/dist/js/upload/upload.js +8 -23
  95. package/dist/tabs.css +3 -3
  96. package/dist/types/shapeFlag.d.ts +13 -0
  97. package/dist/{components/utils → utils}/tool.d.ts +11 -4
  98. package/package.json +1 -1
  99. package/dist/badge.css +0 -27
  100. package/dist/carousel.css +0 -13
  101. package/dist/checkgroup.css +0 -41
  102. package/dist/datepickerRange.css +0 -79
  103. package/dist/image.css +0 -8
  104. package/dist/js/getcalendar/getcalendar.js +0 -48
  105. package/dist/js/tree/tree.js +0 -72
  106. package/dist/js/tree/treeleaf.js +0 -116
  107. package/dist/radiogroup.css +0 -44
  108. package/dist/scrollBar.css +0 -37
  109. package/dist/select.css +0 -20
@@ -1,208 +1,188 @@
1
- import { defineComponent, ref, watch, onUnmounted, openBlock, createBlock, Teleport, createElementVNode, createVNode, TransitionGroup, withCtx, createElementBlock, Fragment, renderList, normalizeClass, createCommentVNode, resolveDynamicComponent, h, createApp, reactive, toDisplayString, nextTick, defineAsyncComponent } from "vue";
2
- const _hoisted_1$2 = { class: "tdd-pointer-events-none tdd-fixed tdd-right-0 tdd-left-0 tdd-bottom-0 tdd-top-4 tdd-z-2000 tdd-space-y-5" };
3
- const _hoisted_2$1 = { class: "tdd-pointer-events-auto tdd-inline-flex tdd-items-center tdd-space-x-3 tdd-bg-white tdd-p-3 tdd-text-sm tdd-text-word3 tdd-drop-shadow" };
4
- const _hoisted_3$1 = {
5
- key: 0,
6
- class: "tdd-h-4 tdd-w-4 tdd-fill-white",
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => {
4
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ return value;
6
+ };
7
+ import { openBlock, createElementBlock, createElementVNode, defineComponent, ref, onUnmounted, createBlock, Teleport, createVNode, TransitionGroup, withCtx, Fragment, renderList, normalizeClass, resolveDynamicComponent, createTextVNode, toDisplayString, createCommentVNode, createApp, isVNode, watch, computed, Transition, withDirectives, withModifiers, unref, reactive, defineAsyncComponent } from "vue";
8
+ const _export_sfc = (sfc, props) => {
9
+ const target = sfc.__vccOpts || sfc;
10
+ for (const [key, val] of props) {
11
+ target[key] = val;
12
+ }
13
+ return target;
14
+ };
15
+ const _sfc_main$8 = {};
16
+ const _hoisted_1$8 = {
17
+ xmlns: "http://www.w3.org/2000/svg",
18
+ width: "24",
19
+ height: "24",
20
+ viewBox: "0 0 24 24",
21
+ fill: "inherit"
22
+ };
23
+ function _sfc_render$5(_ctx, _cache) {
24
+ return openBlock(), createElementBlock("svg", _hoisted_1$8, _cache[0] || (_cache[0] = [
25
+ createElementVNode("g", null, [
26
+ createElementVNode("path", {
27
+ "fill-rule": "evenodd",
28
+ "clip-rule": "evenodd",
29
+ d: "M16.7782 7.22943C16.4824 6.93364 16.0046 6.93364 15.7088 7.22943L12 10.9306L8.29124 7.22184C7.99545 6.92605 7.51763 6.92605 7.22184 7.22184C6.92605 7.51763 6.92605 7.99545 7.22184 8.29124L10.9306 12L7.22184 15.7088C6.92605 16.0046 6.92605 16.4824 7.22184 16.7782C7.51763 17.0739 7.99545 17.0739 8.29124 16.7782L12 13.0694L15.7088 16.7782C16.0046 17.0739 16.4824 17.0739 16.7782 16.7782C17.0739 16.4824 17.0739 16.0046 16.7782 15.7088L13.0694 12L16.7782 8.29124C17.0664 8.00303 17.0664 7.51763 16.7782 7.22943Z",
30
+ fill: "inherit"
31
+ })
32
+ ], -1)
33
+ ]));
34
+ }
35
+ const CloseIcon = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$5]]);
36
+ const _sfc_main$7 = {};
37
+ const _hoisted_1$7 = {
7
38
  viewBox: "0 0 1024 1024",
8
39
  version: "1.1",
9
40
  xmlns: "http://www.w3.org/2000/svg"
10
41
  };
11
- const _hoisted_4$1 = {
12
- key: 1,
13
- class: "tdd-h-4 tdd-w-4 tdd-fill-white",
42
+ function _sfc_render$4(_ctx, _cache) {
43
+ return openBlock(), createElementBlock("svg", _hoisted_1$7, _cache[0] || (_cache[0] = [
44
+ createElementVNode("path", { d: "M883.2 247.466667c-17.066667-17.066667-44.8-17.066667-59.733333 0L409.6 665.6l-209.066667-204.8c-17.066667-17.066667-44.8-17.066667-59.733333 0-17.066667 17.066667-17.066667 44.8 0 59.733333l238.933333 234.666667c8.533333 8.533333 19.2 12.8 29.866667 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8l443.733333-448c17.066667-17.066667 17.066667-42.666667 0-59.733333z" }, null, -1)
45
+ ]));
46
+ }
47
+ const successTip = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$4]]);
48
+ const _sfc_main$6 = {};
49
+ const _hoisted_1$6 = {
14
50
  viewBox: "0 0 1024 1024",
15
51
  version: "1.1",
16
52
  xmlns: "http://www.w3.org/2000/svg"
17
53
  };
18
- const _hoisted_5$1 = {
19
- key: 2,
20
- class: "tdd-h-4 tdd-w-4 tdd-fill-white",
54
+ function _sfc_render$3(_ctx, _cache) {
55
+ return openBlock(), createElementBlock("svg", _hoisted_1$6, _cache[0] || (_cache[0] = [
56
+ createElementVNode("path", { d: "M556.8 512L832 236.8c12.8-12.8 12.8-32 0-44.8-12.8-12.8-32-12.8-44.8 0L512 467.2l-275.2-277.333333c-12.8-12.8-32-12.8-44.8 0-12.8 12.8-12.8 32 0 44.8l275.2 277.333333-277.333333 275.2c-12.8 12.8-12.8 32 0 44.8 6.4 6.4 14.933333 8.533333 23.466666 8.533333s17.066667-2.133333 23.466667-8.533333L512 556.8 787.2 832c6.4 6.4 14.933333 8.533333 23.466667 8.533333s17.066667-2.133333 23.466666-8.533333c12.8-12.8 12.8-32 0-44.8L556.8 512z" }, null, -1)
57
+ ]));
58
+ }
59
+ const errTip = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$3]]);
60
+ const _sfc_main$5 = {};
61
+ const _hoisted_1$5 = {
21
62
  viewBox: "0 0 1024 1024",
22
63
  version: "1.1",
23
64
  xmlns: "http://www.w3.org/2000/svg"
24
65
  };
25
- const _hoisted_6$1 = {
26
- key: 3,
27
- class: "tdd-h-4 tdd-w-4 tdd-fill-white",
66
+ function _sfc_render$2(_ctx, _cache) {
67
+ return openBlock(), createElementBlock("svg", _hoisted_1$5, _cache[0] || (_cache[0] = [
68
+ createElementVNode("path", { d: "M512 320m-42.666667 0a42.666667 42.666667 0 1 0 85.333334 0 42.666667 42.666667 0 1 0-85.333334 0Z" }, null, -1),
69
+ createElementVNode("path", { d: "M512 437.333333c-17.066667 0-32 14.933333-32 32v234.666667c0 17.066667 14.933333 32 32 32s32-14.933333 32-32V469.333333c0-17.066667-14.933333-32-32-32z" }, null, -1)
70
+ ]));
71
+ }
72
+ const warnTip = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$2]]);
73
+ const _sfc_main$4 = {};
74
+ const _hoisted_1$4 = {
28
75
  viewBox: "0 0 1024 1024",
29
76
  version: "1.1",
30
77
  xmlns: "http://www.w3.org/2000/svg"
31
78
  };
32
- const _hoisted_7$1 = ["onClick"];
33
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
79
+ function _sfc_render$1(_ctx, _cache) {
80
+ return openBlock(), createElementBlock("svg", _hoisted_1$4, _cache[0] || (_cache[0] = [
81
+ createElementVNode("path", { d: "M800 625.066667V448c0-117.333333-70.4-217.6-170.666667-262.4-4.266667-61.866667-55.466667-110.933333-117.333333-110.933333s-113.066667 49.066667-117.333333 110.933333c-100.266667 44.8-170.666667 145.066667-170.666667 262.4v177.066667c-57.6 46.933333-85.333333 110.933333-85.333333 185.6 0 17.066667 14.933333 32 32 32h206.933333c14.933333 61.866667 70.4 106.666667 134.4 106.666666s119.466667-44.8 134.4-106.666666H853.333333c17.066667 0 32-14.933333 32-32 0-76.8-27.733333-138.666667-85.333333-185.6zM512 138.666667c19.2 0 36.266667 10.666667 44.8 25.6-14.933333-2.133333-29.866667-4.266667-44.8-4.266667-14.933333 0-29.866667 2.133333-44.8 4.266667 8.533333-14.933333 25.6-25.6 44.8-25.6z m0 746.666666c-29.866667 0-55.466667-17.066667-66.133333-42.666666h134.4c-12.8 25.6-38.4 42.666667-68.266667 42.666666z m-307.2-106.666666c6.4-46.933333 29.866667-83.2 70.4-113.066667 8.533333-6.4 12.8-14.933333 12.8-25.6v-192c0-123.733333 100.266667-224 224-224S736 324.266667 736 448v192c0 10.666667 4.266667 19.2 12.8 25.6 40.533333 29.866667 64 66.133333 70.4 113.066667H204.8z" }, null, -1)
82
+ ]));
83
+ }
84
+ const infoTip = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$1]]);
85
+ const _hoisted_1$3 = { class: "pointer-events-none fixed right-0 left-0 bottom-0 top-4 z-2000 space-y-5" };
86
+ const _hoisted_2$1 = { class: "pointer-events-auto inline-flex items-center space-x-3 bg-white p-3 text-sm text-word3 drop-shadow" };
87
+ const _hoisted_3$1 = { class: "flex-1" };
88
+ const _hoisted_4$1 = ["onClick"];
89
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
34
90
  __name: "messagecomponent",
35
91
  setup(__props, { expose: __expose }) {
36
- const messageList = ref([]);
37
- const hidden = (index2) => {
38
- cancelAnimationFrame(deletehandle.value);
39
- messageList.value.splice(index2, 1);
40
- };
41
- const success = (option) => {
42
- dealConfig(option, "success");
43
- };
44
- const error = (option) => {
45
- dealConfig(option, "error");
92
+ const typeIcons = {
93
+ success: successTip,
94
+ error: errTip,
95
+ warning: warnTip,
96
+ info: infoTip
46
97
  };
47
- const warning = (option) => {
48
- dealConfig(option, "warning");
98
+ const messageQueue = ref([]);
99
+ const dealConfig = (options) => {
100
+ const id = options.id ?? Date.now();
101
+ const existingIndex = messageQueue.value.findIndex((m) => m.id === id);
102
+ if (existingIndex > -1) {
103
+ const msg = messageQueue.value[existingIndex];
104
+ msg.content = options.content ?? msg.content;
105
+ msg.duration = options.duration ?? msg.duration;
106
+ msg.showClose = options.showClose ?? msg.showClose;
107
+ resetTimer(msg);
108
+ return;
109
+ }
110
+ const newMessage = {
111
+ id,
112
+ ...options
113
+ };
114
+ messageQueue.value.push(newMessage);
115
+ setupAutoClose(newMessage);
49
116
  };
50
- const info = (option) => {
51
- dealConfig(option, "info");
117
+ const setupAutoClose = (msg) => {
118
+ if (msg.duration <= 0)
119
+ return;
120
+ msg.timer = setTimeout(() => {
121
+ removeMessage(msg.id);
122
+ }, msg.duration);
52
123
  };
53
- const dealConfig = (options, type) => {
54
- let option = options || {};
55
- option.type = type;
56
- option.during = option.during !== void 0 && option.during !== null && option.during >= 0 ? option.during : 3e3;
57
- if (option.key) {
58
- let rewriteFlag = false;
59
- for (let i = 0; i < messageList.value.length; i++) {
60
- if (messageList.value[i].key === option.key) {
61
- messageList.value[i].text = option.text;
62
- messageList.value[i].during = option.during;
63
- messageList.value[i].endtime = option.during + (/* @__PURE__ */ new Date()).getTime();
64
- messageList.value[i].type = option.type;
65
- messageList.value[i].vnode = option.vnode;
66
- rewriteFlag = true;
67
- break;
68
- }
69
- }
70
- if (rewriteFlag === false) {
71
- option.type = type;
72
- const config = {
73
- type: option.type || "info",
74
- showClose: option.showClose || false,
75
- during: 0,
76
- endtime: 0 + (/* @__PURE__ */ new Date()).getTime(),
77
- text: option.text,
78
- key: option.key,
79
- vnode: option.vnode
80
- };
81
- messageList.value.push(config);
82
- }
83
- } else {
84
- const config = {
85
- type: option.type || "info",
86
- showClose: option.showClose || false,
87
- during: option.during,
88
- endtime: option.during + (/* @__PURE__ */ new Date()).getTime(),
89
- text: option.text,
90
- key: option.during + (/* @__PURE__ */ new Date()).getTime(),
91
- vnode: option.vnode
92
- };
93
- messageList.value.push(config);
94
- }
124
+ const resetTimer = (msg) => {
125
+ if (msg.timer)
126
+ clearTimeout(msg.timer);
127
+ setupAutoClose(msg);
95
128
  };
96
- const deletehandle = ref(-1);
97
- watch(
98
- messageList,
99
- (newdata) => {
100
- cancelAnimationFrame(deletehandle.value);
101
- if (newdata.length === 0)
102
- return;
103
- for (let i = 0; i < newdata.length; i++) {
104
- if (newdata[i].during > 0) {
105
- const loop = () => {
106
- deletehandle.value = requestAnimationFrame(loop);
107
- if ((/* @__PURE__ */ new Date()).getTime() >= newdata[i].endtime) {
108
- cancelAnimationFrame(deletehandle.value);
109
- messageList.value.splice(i, 1);
110
- }
111
- };
112
- loop();
113
- break;
114
- }
115
- }
116
- },
117
- { deep: true }
118
- );
119
- const contentRender = (props) => {
120
- if (Array.isArray(props.c.vnode)) {
121
- return props.c.vnode.map((v) => {
122
- return createBlock(
123
- resolveDynamicComponent(v)
124
- );
125
- });
126
- } else if (props.c.vnode) {
127
- return createBlock(
128
- resolveDynamicComponent(props.c.vnode)
129
- );
130
- } else {
131
- return h(
132
- "div",
133
- {},
134
- props.c.text
135
- );
129
+ const removeMessage = (id) => {
130
+ const index2 = messageQueue.value.findIndex((m) => m.id === id);
131
+ if (index2 > -1) {
132
+ const msg = messageQueue.value[index2];
133
+ if (msg.timer)
134
+ clearTimeout(msg.timer);
135
+ messageQueue.value.splice(index2, 1);
136
136
  }
137
137
  };
138
138
  onUnmounted(() => {
139
- messageList.value.length = 0;
139
+ messageQueue.value.forEach((msg) => {
140
+ if (msg.timer)
141
+ clearTimeout(msg.timer);
142
+ });
143
+ messageQueue.value = [];
140
144
  });
141
145
  __expose({
142
- success,
143
- error,
144
- warning,
145
- info,
146
146
  dealConfig
147
147
  });
148
148
  return (_ctx, _cache) => {
149
149
  return openBlock(), createBlock(Teleport, { to: "body" }, [
150
- createElementVNode("div", _hoisted_1$2, [
150
+ createElementVNode("div", _hoisted_1$3, [
151
151
  createVNode(TransitionGroup, { name: "message" }, {
152
152
  default: withCtx(() => [
153
- (openBlock(true), createElementBlock(Fragment, null, renderList(messageList.value, (i, d) => {
153
+ (openBlock(true), createElementBlock(Fragment, null, renderList(messageQueue.value, (item) => {
154
154
  return openBlock(), createElementBlock("div", {
155
- class: "tdd-w-full tdd-text-center",
156
- key: i.key
155
+ class: "w-full text-center",
156
+ key: item.id
157
157
  }, [
158
158
  createElementVNode("div", _hoisted_2$1, [
159
159
  createElementVNode("div", {
160
- class: normalizeClass(["tdd-flex tdd-h-5 tdd-w-5 tdd-items-center tdd-justify-center tdd-rounded-full", {
161
- "tdd-bg-green-400": i.type === "success",
162
- "tdd-bg-red-400": i.type === "error",
163
- "tdd-bg-yellow-400": i.type === "warning",
164
- "tdd-bg-gray-400": i.type === "info"
160
+ class: normalizeClass(["flex h-5 w-5 items-center justify-center rounded-full", {
161
+ "bg-green-400": item.type === "success",
162
+ "bg-red-400": item.type === "error",
163
+ "bg-yellow-400": item.type === "warning",
164
+ "bg-gray-400": item.type === "info"
165
165
  }])
166
166
  }, [
167
- i.type === "success" ? (openBlock(), createElementBlock("svg", _hoisted_3$1, _cache[0] || (_cache[0] = [
168
- createElementVNode("path", { d: "M883.2 247.466667c-17.066667-17.066667-44.8-17.066667-59.733333 0L409.6 665.6l-209.066667-204.8c-17.066667-17.066667-44.8-17.066667-59.733333 0-17.066667 17.066667-17.066667 44.8 0 59.733333l238.933333 234.666667c8.533333 8.533333 19.2 12.8 29.866667 12.8 10.666667 0 21.333333-4.266667 29.866667-12.8l443.733333-448c17.066667-17.066667 17.066667-42.666667 0-59.733333z" }, null, -1)
169
- ]))) : createCommentVNode("", true),
170
- i.type === "error" ? (openBlock(), createElementBlock("svg", _hoisted_4$1, _cache[1] || (_cache[1] = [
171
- createElementVNode("path", { d: "M556.8 512L832 236.8c12.8-12.8 12.8-32 0-44.8-12.8-12.8-32-12.8-44.8 0L512 467.2l-275.2-277.333333c-12.8-12.8-32-12.8-44.8 0-12.8 12.8-12.8 32 0 44.8l275.2 277.333333-277.333333 275.2c-12.8 12.8-12.8 32 0 44.8 6.4 6.4 14.933333 8.533333 23.466666 8.533333s17.066667-2.133333 23.466667-8.533333L512 556.8 787.2 832c6.4 6.4 14.933333 8.533333 23.466667 8.533333s17.066667-2.133333 23.466666-8.533333c12.8-12.8 12.8-32 0-44.8L556.8 512z" }, null, -1)
172
- ]))) : createCommentVNode("", true),
173
- i.type === "warning" ? (openBlock(), createElementBlock("svg", _hoisted_5$1, _cache[2] || (_cache[2] = [
174
- createElementVNode("path", { d: "M512 320m-42.666667 0a42.666667 42.666667 0 1 0 85.333334 0 42.666667 42.666667 0 1 0-85.333334 0Z" }, null, -1),
175
- createElementVNode("path", { d: "M512 437.333333c-17.066667 0-32 14.933333-32 32v234.666667c0 17.066667 14.933333 32 32 32s32-14.933333 32-32V469.333333c0-17.066667-14.933333-32-32-32z" }, null, -1)
176
- ]))) : createCommentVNode("", true),
177
- i.type === "info" ? (openBlock(), createElementBlock("svg", _hoisted_6$1, _cache[3] || (_cache[3] = [
178
- createElementVNode("path", { d: "M800 625.066667V448c0-117.333333-70.4-217.6-170.666667-262.4-4.266667-61.866667-55.466667-110.933333-117.333333-110.933333s-113.066667 49.066667-117.333333 110.933333c-100.266667 44.8-170.666667 145.066667-170.666667 262.4v177.066667c-57.6 46.933333-85.333333 110.933333-85.333333 185.6 0 17.066667 14.933333 32 32 32h206.933333c14.933333 61.866667 70.4 106.666667 134.4 106.666666s119.466667-44.8 134.4-106.666666H853.333333c17.066667 0 32-14.933333 32-32 0-76.8-27.733333-138.666667-85.333333-185.6zM512 138.666667c19.2 0 36.266667 10.666667 44.8 25.6-14.933333-2.133333-29.866667-4.266667-44.8-4.266667-14.933333 0-29.866667 2.133333-44.8 4.266667 8.533333-14.933333 25.6-25.6 44.8-25.6z m0 746.666666c-29.866667 0-55.466667-17.066667-66.133333-42.666666h134.4c-12.8 25.6-38.4 42.666667-68.266667 42.666666z m-307.2-106.666666c6.4-46.933333 29.866667-83.2 70.4-113.066667 8.533333-6.4 12.8-14.933333 12.8-25.6v-192c0-123.733333 100.266667-224 224-224S736 324.266667 736 448v192c0 10.666667 4.266667 19.2 12.8 25.6 40.533333 29.866667 64 66.133333 70.4 113.066667H204.8z" }, null, -1)
179
- ]))) : createCommentVNode("", true)
167
+ (openBlock(), createBlock(resolveDynamicComponent(typeIcons[item.type]), { class: "h-4 w-4 fill-white" }))
180
168
  ], 2),
181
- createVNode(contentRender, { c: i }, null, 8, ["c"]),
182
- i.showClose ? (openBlock(), createElementBlock("button", {
169
+ createElementVNode("div", _hoisted_3$1, [
170
+ item.contentType === 1 << 0 ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
171
+ createTextVNode(toDisplayString(item.content), 1)
172
+ ], 64)) : createCommentVNode("", true),
173
+ item.contentType === 1 << 1 ? (openBlock(), createBlock(resolveDynamicComponent(item.content), { key: 1 })) : createCommentVNode("", true),
174
+ item.contentType === 1 << 2 ? (openBlock(true), createElementBlock(Fragment, { key: 2 }, renderList(item.content, (itemitem) => {
175
+ return openBlock(), createBlock(resolveDynamicComponent(itemitem));
176
+ }), 256)) : createCommentVNode("", true)
177
+ ]),
178
+ item.showClose ? (openBlock(), createElementBlock("button", {
183
179
  key: 0,
184
180
  type: "button",
185
- class: "tdd-appearance-none",
186
- onClick: ($event) => hidden(d)
187
- }, _cache[4] || (_cache[4] = [
188
- createElementVNode("svg", {
189
- class: "tdd-h-5 tdd-w-5 tdd-fill-gray-600",
190
- xmlns: "http://www.w3.org/2000/svg",
191
- width: "24",
192
- height: "24",
193
- viewBox: "0 0 24 24",
194
- fill: "none"
195
- }, [
196
- createElementVNode("g", null, [
197
- createElementVNode("path", {
198
- "fill-rule": "evenodd",
199
- "clip-rule": "evenodd",
200
- d: "M16.7782 7.22943C16.4824 6.93364 16.0046 6.93364 15.7088 7.22943L12 10.9306L8.29124 7.22184C7.99545 6.92605 7.51763 6.92605 7.22184 7.22184C6.92605 7.51763 6.92605 7.99545 7.22184 8.29124L10.9306 12L7.22184 15.7088C6.92605 16.0046 6.92605 16.4824 7.22184 16.7782C7.51763 17.0739 7.99545 17.0739 8.29124 16.7782L12 13.0694L15.7088 16.7782C16.0046 17.0739 16.4824 17.0739 16.7782 16.7782C17.0739 16.4824 17.0739 16.0046 16.7782 15.7088L13.0694 12L16.7782 8.29124C17.0664 8.00303 17.0664 7.51763 16.7782 7.22943Z",
201
- fill: "inherit"
202
- })
203
- ])
204
- ], -1)
205
- ]), 8, _hoisted_7$1)) : createCommentVNode("", true)
181
+ class: "appearance-none fill-gray-600",
182
+ onClick: ($event) => removeMessage(item.id)
183
+ }, [
184
+ createVNode(CloseIcon)
185
+ ], 8, _hoisted_4$1)) : createCommentVNode("", true)
206
186
  ])
207
187
  ]);
208
188
  }), 128))
@@ -214,150 +194,225 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
214
194
  };
215
195
  }
216
196
  });
217
- let instance$1;
218
- const initHandle$1 = () => {
219
- instance$1 = createApp(_sfc_main$2).mount(document.createElement("div"));
197
+ const modelOption = {
198
+ duration: 3e3,
199
+ showClose: false
220
200
  };
221
- const MessageCom = (options) => {
222
- if (!instance$1) {
223
- initHandle$1();
201
+ const _MessageClass = class _MessageClass {
202
+ constructor() {
203
+ _MessageClass.instance = createApp(_sfc_main$3).mount(document.createElement("div"));
224
204
  }
225
- instance$1.dealConfig(options, options.type);
226
- return instance$1;
227
- };
228
- MessageCom.success = (options) => {
229
- let option = {
230
- type: "success"
231
- };
232
- if (typeof options === "string" || typeof options === "number") {
233
- Object.assign(option, {
234
- text: options
235
- });
236
- } else if (typeof options === "object") {
237
- Object.assign(option, options);
205
+ static getInstance() {
206
+ if (!this.instance) {
207
+ new _MessageClass();
208
+ }
209
+ return this.instance;
238
210
  }
239
- return MessageCom(option);
240
- };
241
- MessageCom.warning = (options) => {
242
- let option = {
243
- type: "warning"
244
- };
245
- if (typeof options === "string" || typeof options === "number") {
246
- Object.assign(option, {
247
- text: options
248
- });
249
- } else if (typeof options === "object") {
250
- Object.assign(option, options);
211
+ static mixconfig(defaultoption, options) {
212
+ if (typeof options === "string" || typeof options === "number") {
213
+ return Object.assign(defaultoption, modelOption, {
214
+ content: options,
215
+ contentType: 1 << 0
216
+ });
217
+ } else {
218
+ if (Array.isArray(options.content)) {
219
+ return Object.assign(defaultoption, modelOption, options, {
220
+ contentType: 1 << 2
221
+ });
222
+ } else if (isVNode(options.content)) {
223
+ return Object.assign(defaultoption, modelOption, options, {
224
+ contentType: 1 << 1
225
+ });
226
+ } else {
227
+ return Object.assign(defaultoption, modelOption, options, {
228
+ contentType: 1 << 0
229
+ });
230
+ }
231
+ }
251
232
  }
252
- return MessageCom(option);
253
- };
254
- MessageCom.error = (options) => {
255
- let option = {
256
- type: "error"
257
- };
258
- if (typeof options === "string" || typeof options === "number") {
259
- Object.assign(option, {
260
- text: options
261
- });
262
- } else if (typeof options === "object") {
263
- Object.assign(option, options);
233
+ static pushMessage(options) {
234
+ const instance = this.getInstance();
235
+ instance.dealConfig(options);
236
+ }
237
+ static success(options) {
238
+ const config = this.mixconfig({ type: "success" }, options);
239
+ this.pushMessage(config);
240
+ }
241
+ static warning(options) {
242
+ const config = this.mixconfig({ type: "warning" }, options);
243
+ this.pushMessage(config);
244
+ }
245
+ static error(options) {
246
+ const config = this.mixconfig({ type: "error" }, options);
247
+ this.pushMessage(config);
248
+ }
249
+ static info(options) {
250
+ const config = this.mixconfig({ type: "info" }, options);
251
+ this.pushMessage(config);
252
+ }
253
+ static destroy() {
254
+ if (this.instance) {
255
+ this.instance.$el.remove();
256
+ this.instance = null;
257
+ }
264
258
  }
265
- return MessageCom(option);
266
259
  };
267
- MessageCom.info = (options) => {
268
- let option = {
269
- type: "info"
270
- };
271
- if (typeof options === "string" || typeof options === "number") {
272
- Object.assign(option, {
273
- text: options
274
- });
275
- } else if (typeof options === "object") {
276
- Object.assign(option, options);
260
+ __publicField(_MessageClass, "instance");
261
+ let MessageClass = _MessageClass;
262
+ const handlerStack = [];
263
+ let isGlobalListenerAttached = false;
264
+ const globalEscapeHandler = (event) => {
265
+ if (event.key !== "Escape")
266
+ return;
267
+ const activeHandler = handlerStack[handlerStack.length - 1];
268
+ if (activeHandler) {
269
+ event.preventDefault();
270
+ activeHandler(event);
277
271
  }
278
- return MessageCom(option);
279
272
  };
280
- const _hoisted_1$1 = {
281
- key: 0,
282
- class: "tdd-fixed tdd-top-0 tdd-right-0 tdd-left-0 tdd-bottom-0 tdd-z-1000 tdd-flex tdd-items-center tdd-justify-center"
273
+ const createEscapeDirective = (options) => {
274
+ const config = {
275
+ onEscape: () => {
276
+ },
277
+ ...options
278
+ };
279
+ const bindEvents = (el, binding) => {
280
+ const thisHandler = (e) => {
281
+ e.preventDefault();
282
+ config.onEscape(e);
283
+ };
284
+ handlerStack.push(thisHandler);
285
+ el.__Escape_Handler__ = thisHandler;
286
+ if (!isGlobalListenerAttached) {
287
+ document.addEventListener("keydown", globalEscapeHandler);
288
+ isGlobalListenerAttached = true;
289
+ }
290
+ };
291
+ const unbindEvents = (el) => {
292
+ if (el.__Escape_Handler__) {
293
+ const index2 = handlerStack.indexOf(el.__Escape_Handler__);
294
+ if (index2 !== -1)
295
+ handlerStack.splice(index2, 1);
296
+ if (handlerStack.length === 0 && isGlobalListenerAttached) {
297
+ document.removeEventListener("keydown", globalEscapeHandler);
298
+ isGlobalListenerAttached = false;
299
+ }
300
+ delete el.__Escape_Handler__;
301
+ }
302
+ };
303
+ return {
304
+ mounted(el, binding) {
305
+ bindEvents(el);
306
+ },
307
+ updated(el, binding) {
308
+ if (el.__Escape_Handler__) {
309
+ const index2 = handlerStack.indexOf(el.__Escape_Handler__);
310
+ if (index2 !== -1)
311
+ handlerStack.splice(index2, 1);
312
+ }
313
+ const newHandler = (e) => {
314
+ e.preventDefault();
315
+ config.onEscape(e);
316
+ };
317
+ handlerStack.push(newHandler);
318
+ el.__Escape_Handler__ = newHandler;
319
+ },
320
+ beforeUnmount(el) {
321
+ unbindEvents(el);
322
+ }
323
+ };
283
324
  };
284
- const _hoisted_2 = {
285
- key: 0,
286
- class: "tdd-absolute tdd-top-0 tdd-right-0 tdd-left-0 tdd-bottom-0 tdd-bg-black tdd-bg-opacity-30"
325
+ const _sfc_main$2 = {};
326
+ const _hoisted_1$2 = {
327
+ class: "fill-current",
328
+ viewBox: "0 0 1024 1024",
329
+ version: "1.1",
330
+ xmlns: "http://www.w3.org/2000/svg"
287
331
  };
288
- const _hoisted_3 = { class: "tdd-z-20 tdd-w-96 tdd-rounded tdd-bg-white tdd-px-4 tdd-pt-8 tdd-pb-9 tdd-drop-shadow" };
289
- const _hoisted_4 = { class: "tdd-flex tdd-justify-center" };
290
- const _hoisted_5 = { class: "tdd-ml-1 tdd-text-lg tdd-leading-6 tdd-text-word3" };
291
- const _hoisted_6 = { class: "tdd-my-4 tdd-text-sm tdd-text-word3 tdd-text-center" };
292
- const _hoisted_7 = { class: "tdd-space-x-2.5 tdd-text-center tdd-text-xs" };
332
+ function _sfc_render(_ctx, _cache) {
333
+ return openBlock(), createElementBlock("svg", _hoisted_1$2, _cache[0] || (_cache[0] = [
334
+ createElementVNode("path", { d: "M512 74.666667c241.066667 0 437.333333 196.266667 437.333333 437.333333S753.066667 949.333333 512 949.333333 74.666667 753.066667 74.666667 512 270.933333 74.666667 512 74.666667z m0 341.333333c-17.066667 0-32 14.933333-32 32v300.8c2.133333 17.066667 14.933333 29.866667 32 29.866667s32-14.933333 32-32V445.866667c-2.133333-17.066667-14.933333-29.866667-32-29.866667z m0-160c-23.466667 0-42.666667 19.2-42.666667 42.666667s19.2 42.666667 42.666667 42.666666 42.666667-19.2 42.666667-42.666666-19.2-42.666667-42.666667-42.666667z" }, null, -1)
335
+ ]));
336
+ }
337
+ const tipIcon = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render]]);
338
+ const _hoisted_1$1 = { class: "z-20 w-96 rounded bg-white px-4 pt-8 pb-9 drop-shadow mt-[20vh] mx-auto" };
339
+ const _hoisted_2 = { class: "flex justify-center" };
340
+ const _hoisted_3 = { class: "h-6 w-6 text-yellow-400" };
341
+ const _hoisted_4 = { class: "ml-1 text-lg leading-6 text-word3" };
342
+ const _hoisted_5 = { class: "my-4 text-sm text-word3 text-center" };
343
+ const _hoisted_6 = { class: "space-x-2.5 text-center text-xs" };
293
344
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
294
345
  __name: "alertcomponent",
346
+ props: {
347
+ callback: { type: Function },
348
+ title: {},
349
+ content: {},
350
+ sureword: {},
351
+ cancelword: {},
352
+ bgshow: { type: Boolean },
353
+ onClose: { type: Function },
354
+ onConfirm: { type: Function },
355
+ showAlert: { type: Boolean }
356
+ },
295
357
  setup(__props, { expose: __expose }) {
296
- const myoption = reactive({
297
- title: "",
298
- content: "",
299
- sureword: "确定",
300
- cancelword: "取消",
301
- bgshow: false
302
- });
303
- const showTip = ref(false);
304
- const action = ref(null);
305
- const callback = ref(() => {
358
+ const props = __props;
359
+ const vEsc = createEscapeDirective({
360
+ onEscape: () => {
361
+ props.onClose();
362
+ }
306
363
  });
307
- const ActionHandle = (value = null) => {
308
- action.value = value;
309
- CloseHandle();
310
- };
311
- const CloseHandle = () => {
312
- if (!showTip.value)
313
- return;
314
- showTip.value = false;
315
- callback.value(action.value);
364
+ const visible = ref(false);
365
+ const stopwatch = watch(
366
+ () => props.showAlert,
367
+ (newVal) => {
368
+ visible.value = newVal;
369
+ stopwatch();
370
+ }
371
+ );
372
+ const setVisible = (value) => {
373
+ visible.value = value;
316
374
  };
317
- __expose({
318
- showTip,
319
- myoption,
320
- callback
321
- });
375
+ __expose({ setVisible });
376
+ const bgshow = computed(() => props.bgshow);
322
377
  return (_ctx, _cache) => {
323
378
  return openBlock(), createBlock(Teleport, { to: "body" }, [
324
- showTip.value ? (openBlock(), createElementBlock("div", _hoisted_1$1, [
325
- myoption.bgshow ? (openBlock(), createElementBlock("div", _hoisted_2)) : createCommentVNode("", true),
326
- createElementVNode("div", _hoisted_3, [
327
- createElementVNode("div", _hoisted_4, [
328
- _cache[2] || (_cache[2] = createElementVNode("div", { class: "tdd-h-6 tdd-w-6 tdd-text-yellow-400" }, [
329
- createElementVNode("svg", {
330
- class: "tdd-fill-current tdd-w-full tdd-h-full",
331
- viewBox: "0 0 1024 1024",
332
- version: "1.1",
333
- xmlns: "http://www.w3.org/2000/svg",
334
- "p-id": "2512"
335
- }, [
336
- createElementVNode("path", {
337
- d: "M512 74.666667c241.066667 0 437.333333 196.266667 437.333333 437.333333S753.066667 949.333333 512 949.333333 74.666667 753.066667 74.666667 512 270.933333 74.666667 512 74.666667z m0 341.333333c-17.066667 0-32 14.933333-32 32v300.8c2.133333 17.066667 14.933333 29.866667 32 29.866667s32-14.933333 32-32V445.866667c-2.133333-17.066667-14.933333-29.866667-32-29.866667z m0-160c-23.466667 0-42.666667 19.2-42.666667 42.666667s19.2 42.666667 42.666667 42.666666 42.666667-19.2 42.666667-42.666666-19.2-42.666667-42.666667-42.666667z",
338
- "p-id": "2513"
339
- })
379
+ createVNode(Transition, { name: "alertOpecity" }, {
380
+ default: withCtx(() => [
381
+ visible.value ? withDirectives((openBlock(), createElementBlock("div", {
382
+ key: 0,
383
+ class: normalizeClass(["fixed top-0 right-0 left-0 bottom-0 z-1000", { "bg-black bg-opacity-30": bgshow.value }]),
384
+ onClick: _cache[2] || (_cache[2] = withModifiers(($event) => props.onClose(), ["self"]))
385
+ }, [
386
+ createElementVNode("div", _hoisted_1$1, [
387
+ createElementVNode("div", _hoisted_2, [
388
+ createElementVNode("div", _hoisted_3, [
389
+ createVNode(tipIcon, { class: "w-full h-full" })
390
+ ]),
391
+ createElementVNode("div", _hoisted_4, toDisplayString(props.title), 1)
392
+ ]),
393
+ createElementVNode("div", _hoisted_5, toDisplayString(props.content), 1),
394
+ createElementVNode("div", _hoisted_6, [
395
+ createElementVNode("div", {
396
+ class: "h-8 px-4 rounded border text-word6 inline-block leading-8 cursor-pointer",
397
+ onClick: _cache[0] || (_cache[0] = ($event) => props.onClose())
398
+ }, toDisplayString(props.cancelword), 1),
399
+ createElementVNode("div", {
400
+ class: "h-8 px-4 rounded bg-blue-light text-white inline-block leading-8 cursor-pointer",
401
+ onClick: _cache[1] || (_cache[1] = ($event) => props.onConfirm())
402
+ }, toDisplayString(props.sureword), 1)
340
403
  ])
341
- ], -1)),
342
- createElementVNode("div", _hoisted_5, toDisplayString(myoption.title), 1)
343
- ]),
344
- createElementVNode("div", _hoisted_6, toDisplayString(myoption.content), 1),
345
- createElementVNode("div", _hoisted_7, [
346
- createElementVNode("div", {
347
- class: "tdd-h-8 tdd-px-4 tdd-rounded tdd-border tdd-text-word6 tdd-inline-block tdd-leading-8 tdd-cursor-pointer",
348
- onClick: _cache[0] || (_cache[0] = ($event) => ActionHandle("cancel"))
349
- }, toDisplayString(myoption.cancelword), 1),
350
- createElementVNode("div", {
351
- class: "tdd-h-8 tdd-px-4 tdd-rounded tdd-bg-blue-light tdd-text-white tdd-inline-block tdd-leading-8 tdd-cursor-pointer",
352
- onClick: _cache[1] || (_cache[1] = ($event) => ActionHandle())
353
- }, toDisplayString(myoption.sureword), 1)
354
- ])
355
- ])
356
- ])) : createCommentVNode("", true)
404
+ ])
405
+ ], 2)), [
406
+ [unref(vEsc)]
407
+ ]) : createCommentVNode("", true)
408
+ ]),
409
+ _: 1
410
+ })
357
411
  ]);
358
412
  };
359
413
  }
360
414
  });
415
+ const alertcomponent_vue_vue_type_style_index_0_lang = "";
361
416
  const defaultOption = {
362
417
  title: "",
363
418
  content: "",
@@ -365,89 +420,60 @@ const defaultOption = {
365
420
  cancelword: "取消",
366
421
  bgshow: false
367
422
  };
368
- let instance, CurrentMsg, msgQue = [];
369
- const defaultCallBack = (action) => {
370
- const { callback, resolve, reject } = CurrentMsg;
371
- if (typeof callback === "function") {
372
- callback(action);
373
- } else if (resolve) {
374
- if (action) {
375
- reject(action);
376
- } else {
377
- resolve();
378
- }
379
- }
380
- };
381
- const initHandle = () => {
382
- instance = createApp(_sfc_main$1).mount(document.createElement("div"));
383
- instance.callback = defaultCallBack;
384
- };
385
- const showAlertHandle = () => {
386
- if (!instance) {
387
- initHandle();
388
- }
389
- if (!instance.showTip) {
390
- if (msgQue.length > 0) {
391
- CurrentMsg = msgQue.shift();
392
- let mixinOptions = CurrentMsg.options;
393
- for (const key in mixinOptions) {
394
- if (mixinOptions.hasOwnProperty(key)) {
395
- instance.myoption[key] = mixinOptions[key];
423
+ function AlertFunction(alertoptions) {
424
+ return new Promise((resolve, reject) => {
425
+ const alertProps = reactive({
426
+ ...defaultOption,
427
+ ...alertoptions,
428
+ showAlert: false,
429
+ callback: (action) => {
430
+ if (action) {
431
+ reject(action);
432
+ } else {
433
+ resolve();
396
434
  }
435
+ },
436
+ onClose: () => {
437
+ instance.setVisible(false);
438
+ setTimeout(() => {
439
+ unmount();
440
+ reject("user cancel");
441
+ }, 300);
442
+ },
443
+ onConfirm: () => {
444
+ instance.setVisible(false);
445
+ setTimeout(() => {
446
+ unmount();
447
+ resolve();
448
+ }, 300);
397
449
  }
398
- if (mixinOptions.callback === void 0) {
399
- instance.callback = defaultCallBack;
400
- }
401
- let CallBack = instance.callback;
402
- instance.callback = (action) => {
403
- CallBack(action);
404
- showAlertHandle();
405
- };
406
- nextTick(() => {
407
- instance.showTip = true;
408
- });
409
- }
410
- }
411
- };
412
- const AlertCom = (options, callback) => {
413
- if (options.callback && !callback) {
414
- callback = options.callback;
415
- }
416
- if (typeof Promise !== "undefined") {
417
- return new Promise((resolve, reject) => {
418
- msgQue.push({
419
- options: Object.assign({}, defaultOption, options),
420
- callback,
421
- resolve,
422
- reject
423
- });
424
- showAlertHandle();
425
450
  });
426
- } else {
427
- msgQue.push({
428
- options: Object.assign({}, defaultOption, options),
429
- callback
451
+ const alertApp = createApp(_sfc_main$1, alertProps);
452
+ const container = document.createElement("div");
453
+ const instance = alertApp.mount(container);
454
+ const unmount = () => {
455
+ alertApp.unmount();
456
+ };
457
+ requestAnimationFrame(() => {
458
+ instance.setVisible(true);
430
459
  });
431
- }
432
- showAlertHandle();
433
- };
434
- const _hoisted_1 = { class: "tdd-mt-3 tdd-text-sm tdd-font-medium tdd-text-word9" };
460
+ });
461
+ }
462
+ const _hoisted_1 = { class: "mt-3 text-sm font-medium text-word9" };
435
463
  const _sfc_main = /* @__PURE__ */ defineComponent({
436
464
  __name: "loadcomponent",
437
- setup(__props, { expose: __expose }) {
438
- const loaddingWord = ref("数据加载中,请稍后...");
439
- const fullScreen = ref(false);
440
- __expose({
441
- loaddingWord,
442
- fullScreen
443
- });
465
+ props: {
466
+ loadingText: {},
467
+ fullScreen: { type: Boolean }
468
+ },
469
+ setup(__props) {
444
470
  return (_ctx, _cache) => {
445
471
  return openBlock(), createElementBlock("div", {
446
- class: normalizeClass(["tdd-top-0 tdd-right-0 tdd-left-0 tdd-bottom-0 tdd-z-50 tdd-flex tdd-h-full tdd-w-full tdd-flex-col tdd-items-center tdd-justify-center tdd-bg-white tdd-bg-opacity-90", fullScreen.value ? "fixed" : "absolute"])
472
+ class: normalizeClass(["top-0 right-0 left-0 bottom-0 z-50 flex h-full w-full flex-col items-center justify-center bg-white bg-opacity-90", _ctx.fullScreen ? "fixed" : "absolute"])
447
473
  }, [
448
- _cache[0] || (_cache[0] = createElementVNode("div", { class: "tdd-relative tdd-flex tdd-justify-center tdd-w-10 tdd-h-10" }, [
474
+ _cache[0] || (_cache[0] = createElementVNode("div", { class: "relative flex justify-center w-10 h-10" }, [
449
475
  createElementVNode("svg", {
450
- class: "circular tdd-stroke-wordblue",
476
+ class: "circular stroke-wordblue",
451
477
  viewBox: "25 25 50 50"
452
478
  }, [
453
479
  createElementVNode("circle", {
@@ -461,67 +487,94 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
461
487
  })
462
488
  ])
463
489
  ], -1)),
464
- createElementVNode("div", _hoisted_1, toDisplayString(loaddingWord.value), 1)
490
+ createElementVNode("div", _hoisted_1, toDisplayString(_ctx.loadingText), 1)
465
491
  ], 2);
466
492
  };
467
493
  }
468
494
  });
469
495
  const loadcomponent_vue_vue_type_style_index_0_lang = "";
470
- const installHandle = () => createApp(_sfc_main).mount(document.createElement("div"));
496
+ const LOCK_CLASS_NAME = "overflow-hidden";
497
+ const LOADING_TEXT_ATTR = "loading-text";
498
+ function createLoadingInstance(options) {
499
+ const app = createApp(_sfc_main, options);
500
+ const mountNode = document.createElement("div");
501
+ return app.mount(mountNode);
502
+ }
471
503
  const LibLoad = {
472
- beforeMount(el, binding) {
473
- if (!el.instance) {
474
- el.instance = installHandle();
475
- }
476
- if (el.getAttribute("loadding-text")) {
477
- el.instance.loaddingWord = el.getAttribute("loadding-text");
478
- }
479
- el.instance.fullScreen = binding.modifiers.fullScreen || false;
480
- },
481
504
  mounted(el, binding) {
482
505
  if (binding.value) {
483
- if (binding.modifiers.fullScreen) {
484
- appendHandle(el, document.body);
485
- if (binding.modifiers.lock) {
486
- document.body.classList.add("tdd-overflow-hidden");
487
- }
488
- } else {
489
- appendHandle(el);
490
- }
506
+ const modifiers = binding.modifiers;
507
+ el.__loading_instance__ = createLoadingInstance({
508
+ loadingText: el.getAttribute(LOADING_TEXT_ATTR) || "加载中...",
509
+ fullScreen: !!modifiers.fullScreen
510
+ });
511
+ handleLoadingState(el, binding, true);
491
512
  }
492
513
  },
493
- beforeUpdate(el, binding) {
514
+ updated(el, binding) {
494
515
  if (binding.value !== binding.oldValue) {
495
- if (el.getAttribute("loadding-text")) {
496
- el.instance.loaddingWord = el.getAttribute("loadding-text");
497
- }
498
- if (binding.modifiers.fullScreen) {
499
- binding.value ? appendHandle(el, document.body) : removeHandle(el, document.body);
500
- if (binding.modifiers.lock) {
501
- binding.value ? document.body.classList.add("tdd-overflow-hidden") : document.body.classList.remove("tdd-overflow-hidden");
502
- }
503
- } else {
504
- binding.value ? appendHandle(el) : removeHandle(el);
505
- }
516
+ handleLoadingState(el, binding, binding.value);
517
+ }
518
+ },
519
+ beforeUnmount(el) {
520
+ var _a;
521
+ if (el.__loading_instance__) {
522
+ cleanupLoadingState(el, document.body);
523
+ (_a = el.__loading_instance__) == null ? void 0 : _a.$el.remove();
524
+ delete el.__loading_instance__;
506
525
  }
507
526
  }
508
527
  };
509
- const appendHandle = (el, root) => {
510
- if (root) {
511
- root.appendChild(el.instance.$el);
528
+ function handleLoadingState(el, binding, show) {
529
+ const modifiers = binding.modifiers;
530
+ const target = modifiers.fullScreen ? document.body : el;
531
+ if (show) {
532
+ applyLoadingState(el, target, modifiers);
512
533
  } else {
513
- el.style.display = "relative";
514
- el.appendChild(el.instance.$el);
534
+ cleanupLoadingState(el, target, modifiers);
515
535
  }
516
- };
517
- const removeHandle = (el, root) => {
518
- if (root) {
519
- root.removeChild(el.instance.$el);
536
+ }
537
+ function applyLoadingState(el, container, modifiers) {
538
+ if (!el.__loading_instance__) {
539
+ el.__loading_instance__ = createLoadingInstance({
540
+ loadingText: el.getAttribute(LOADING_TEXT_ATTR) || "加载中...",
541
+ fullScreen: !!modifiers.fullScreen
542
+ });
543
+ }
544
+ if (container === el) {
545
+ el.__original_display__ = el.style.display;
546
+ el.style.position = "relative";
547
+ }
548
+ if (!container.contains(el.__loading_instance__.$el)) {
549
+ container.appendChild(el.__loading_instance__.$el);
550
+ }
551
+ if (modifiers.lock && modifiers.fullScreen) {
552
+ document.documentElement.classList.add(LOCK_CLASS_NAME);
553
+ }
554
+ }
555
+ function cleanupLoadingState(el, container, modifiers) {
556
+ if (!el.__loading_instance__)
557
+ return;
558
+ const loadingElement = el.__loading_instance__.$el;
559
+ if (loadingElement && loadingElement.parentNode === container) {
560
+ try {
561
+ container.removeChild(loadingElement);
562
+ } catch (error) {
563
+ console.warn("安全移除加载元素失败:", error);
564
+ }
520
565
  } else {
521
- el.style.display = "";
522
- el.removeChild(el.instance.$el);
566
+ console.warn("加载元素不存在于容器中,可能已提前移除");
523
567
  }
524
- };
568
+ if (container === el && el.__original_display__) {
569
+ el.style.position = "";
570
+ el.style.display = el.__original_display__;
571
+ delete el.__original_display__;
572
+ }
573
+ if ((modifiers == null ? void 0 : modifiers.lock) && (modifiers == null ? void 0 : modifiers.fullScreen)) {
574
+ document.documentElement.classList.remove(LOCK_CLASS_NAME);
575
+ }
576
+ delete el.__loading_instance__;
577
+ }
525
578
  function debounce(func, wait) {
526
579
  let timeout;
527
580
  return function() {
@@ -655,49 +708,53 @@ function getNewArray(array, subGroupLength) {
655
708
  }
656
709
  return newArray;
657
710
  }
658
- function getScrollWidth() {
659
- const outer = document.createElement("div");
660
- outer.className = "el-scrollbar__wrap";
661
- outer.style.visibility = "hidden";
662
- outer.style.width = "100px";
663
- outer.style.position = "absolute";
664
- outer.style.top = "-9999px";
665
- document.body.appendChild(outer);
666
- const widthnoscroll = outer.offsetWidth;
667
- outer.style.overflow = "scroll";
668
- const inner = document.createElement("div");
669
- inner.style.width = "100%";
670
- outer.appendChild(inner);
671
- const widthwithscroll = inner.offsetWidth;
672
- outer.parentNode.removeChild(outer);
673
- let scrollbarwidth = widthnoscroll - widthwithscroll;
674
- return scrollbarwidth;
675
- }
676
- function resizeHandler(entries) {
677
- for (const entry of entries) {
678
- const listeners = entry.target.__resizeListeners__ || [];
679
- if (listeners.length) {
680
- listeners.forEach((fn) => {
681
- fn();
682
- });
683
- }
684
- }
685
- }
686
- const addResizeListener = function(element, fn) {
687
- if (!element.__resizeListeners__) {
688
- element.__resizeListeners__ = [];
689
- element.__ro__ = new ResizeObserver(resizeHandler);
690
- element.__ro__.observe(element);
691
- window.ro = element.__ro__;
692
- }
693
- element.__resizeListeners__.push(fn);
711
+ const formatDate = (date) => {
712
+ if (!date)
713
+ return "";
714
+ const d = date instanceof Date ? date : new Date(date);
715
+ if (isNaN(d.getTime()))
716
+ return "";
717
+ return [
718
+ d.getFullYear(),
719
+ pad(d.getMonth() + 1),
720
+ pad(d.getDate())
721
+ ].join("-");
694
722
  };
695
- const removeResizeListener = function(element, fn) {
696
- if (!element || !element.__resizeListeners__)
697
- return;
698
- element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1);
699
- if (!element.__resizeListeners__.length) {
700
- element.__ro__.disconnect();
723
+ const pad = (n) => n.toString().padStart(2, "0");
724
+ const checkinputDate = (input, success, fail) => {
725
+ try {
726
+ input = input.trim();
727
+ if (!input) {
728
+ success(null);
729
+ return;
730
+ }
731
+ const dateRegex = /^(\d{4})[-/\.](\d{1,2})[-/\.]?(\d{1,2})?$/;
732
+ if (!dateRegex.test(input)) {
733
+ throw new Error("日期格式错误");
734
+ }
735
+ const [, yearStr, monthStr, dayStr] = input.match(dateRegex);
736
+ const year = parseInt(yearStr, 10);
737
+ const month = parseInt(monthStr, 10);
738
+ const day = dayStr ? parseInt(dayStr, 10) : 1;
739
+ if (year < 1970 || year > 2100)
740
+ throw new Error("年份超出范围");
741
+ if (month < 1 || month > 12)
742
+ throw new Error("无效月份");
743
+ const lastDayOfMonth = new Date(year, month, 0).getDate();
744
+ const safeDay = Math.min(day, lastDayOfMonth);
745
+ if (safeDay !== day) {
746
+ fail();
747
+ return;
748
+ }
749
+ const newDate = new Date(year, month - 1, safeDay);
750
+ if (newDate.getFullYear() !== year || newDate.getMonth() + 1 !== month || newDate.getDate() !== safeDay) {
751
+ fail();
752
+ return;
753
+ }
754
+ const formatted = formatDate(newDate);
755
+ success(formatted);
756
+ } catch (error) {
757
+ fail();
701
758
  }
702
759
  };
703
760
  const on = function() {
@@ -714,43 +771,85 @@ const off = function() {
714
771
  }
715
772
  };
716
773
  }();
717
- function createAndAppendElementWithId(id) {
718
- if (!document.getElementById(id)) {
719
- const element = document.createElement("div");
720
- element.id = id;
721
- document.body.appendChild(element);
722
- }
723
- }
724
- const scrolllead = {
725
- beforeMount(el, binding) {
726
- function scrollhandle(e) {
727
- const threshold = binding.value.threshold || 0;
728
- if (binding.modifiers.top) {
729
- if (el.scrollTop <= threshold) {
730
- binding.value.fc(e);
731
- }
732
- } else {
733
- let { bottom } = el.getBoundingClientRect();
734
- if (window.innerHeight - bottom > threshold) {
735
- binding.value.fc(e);
736
- }
774
+ const useResizeObserver = (callback) => {
775
+ let observer = null;
776
+ const observe = (el) => {
777
+ observer = new ResizeObserver(callback);
778
+ observer.observe(el);
779
+ };
780
+ const unobserve = (el) => {
781
+ observer == null ? void 0 : observer.unobserve(el);
782
+ observer == null ? void 0 : observer.disconnect();
783
+ };
784
+ return { observe, unobserve };
785
+ };
786
+ const DEFAULT_DEBOUNCE_WAIT = 100;
787
+ const DEFAULT_HOLD = 0;
788
+ const createScrollDirective = (options) => {
789
+ const config = {
790
+ throttleTime: DEFAULT_DEBOUNCE_WAIT,
791
+ threshold: DEFAULT_HOLD,
792
+ edge: "bottom",
793
+ onWheel: () => {
794
+ },
795
+ ...options
796
+ };
797
+ const checkEdgeProximity = (el, edge) => {
798
+ const { scrollTop, scrollHeight, clientHeight } = el;
799
+ const threshold = config.threshold;
800
+ const epsilon = 0.1;
801
+ if (scrollHeight <= clientHeight) {
802
+ return edge === "top" ? scrollTop === 0 : true;
803
+ }
804
+ const maxScroll = scrollHeight - clientHeight;
805
+ switch (edge) {
806
+ case "top":
807
+ return scrollTop <= threshold + epsilon;
808
+ case "bottom": {
809
+ const remaining = maxScroll - scrollTop;
810
+ return remaining <= threshold + epsilon;
737
811
  }
812
+ default:
813
+ return false;
738
814
  }
739
- el._scroll_ = throttle(scrollhandle, 200);
740
- document.addEventListener("wheel", el._scroll_);
741
- },
742
- // beforeUpdate(el: selfDom, binding: bindingType) {},
743
- updated(el, binding) {
744
- if (binding.value.ableLoading === false) {
745
- document.removeEventListener("wheel", el._scroll_);
746
- } else {
747
- document.addEventListener("wheel", el._scroll_);
815
+ };
816
+ const bindEvents = (el, binding) => {
817
+ const isScrollable = el.scrollHeight > el.clientHeight;
818
+ if (!isScrollable)
819
+ return;
820
+ if (el._scroll_handlers_)
821
+ return;
822
+ const wheelDom = throttle(() => {
823
+ if (checkEdgeProximity(el, config.edge)) {
824
+ config.onWheel();
825
+ }
826
+ }, config.throttleTime);
827
+ el._scroll_handlers_ = {
828
+ wheel: wheelDom
829
+ };
830
+ el.addEventListener("wheel", el._scroll_handlers_.wheel);
831
+ };
832
+ const unbindEvents = (el) => {
833
+ if (el._scroll_handlers_) {
834
+ el.removeEventListener("wheel", el._scroll_handlers_.wheel);
835
+ delete el._scroll_handlers_;
748
836
  }
749
- },
750
- beforeUnmount(el) {
751
- document.removeEventListener("wheel", el._scroll_);
752
- delete el._scroll_;
753
- }
837
+ };
838
+ return {
839
+ mounted(el, binding) {
840
+ bindEvents(el);
841
+ },
842
+ updated(el, binding) {
843
+ if (binding.value.ableLoading === false) {
844
+ unbindEvents(el);
845
+ } else {
846
+ bindEvents(el);
847
+ }
848
+ },
849
+ beforeUnmount(el) {
850
+ unbindEvents(el);
851
+ }
852
+ };
754
853
  };
755
854
  const tailwind = "";
756
855
  const LibDialog = defineAsyncComponent(() => import("../dialog/dialog.js"));
@@ -780,7 +879,6 @@ const LibScrollBar = defineAsyncComponent(() => import("../scrollBar/scrollBar.j
780
879
  const LibCarousel = defineAsyncComponent(() => import("../carousel/carousel.js"));
781
880
  const LibCarouselItem = defineAsyncComponent(() => import("../carousel/carouselitem.js"));
782
881
  const LibSwitch = defineAsyncComponent(() => import("../switch/switch.js"));
783
- const LibTree = defineAsyncComponent(() => import("../tree/tree.js"));
784
882
  const index = {
785
883
  install(app) {
786
884
  app.component("LibDialog", LibDialog);
@@ -809,46 +907,46 @@ const index = {
809
907
  app.component("LibCarousel", LibCarousel);
810
908
  app.component("LibCarouselItem", LibCarouselItem);
811
909
  app.component("LibSwitch", LibSwitch);
812
- app.component("LibTree", LibTree);
813
910
  app.directive("loadding", LibLoad);
814
911
  }
815
912
  };
816
913
  export {
817
914
  LibRadioBox as A,
818
915
  LibRadioGroup as B,
819
- LibCheckGroup as C,
820
- LibCheckBox as D,
821
- LibUpload as E,
822
- LibTabs as F,
823
- LibTabsPane as G,
824
- LibScrollBar as H,
825
- AlertCom as I,
826
- LibLoad as J,
827
- scrolllead as K,
916
+ CloseIcon as C,
917
+ LibCheckGroup as D,
918
+ LibCheckBox as E,
919
+ LibUpload as F,
920
+ LibTabs as G,
921
+ LibTabsPane as H,
922
+ LibScrollBar as I,
923
+ AlertFunction as J,
924
+ LibLoad as K,
828
925
  LibDialog as L,
829
- MessageCom as M,
830
- LibCarousel as N,
831
- LibCarouselItem as O,
832
- LibSwitch as P,
833
- LibTree as Q,
834
- off as a,
835
- getScrollWidth as b,
836
- createAndAppendElementWithId as c,
926
+ MessageClass as M,
927
+ createScrollDirective as N,
928
+ LibCarousel as O,
929
+ LibCarouselItem as P,
930
+ LibSwitch as Q,
931
+ _export_sfc as _,
932
+ checkinputDate as a,
933
+ off as b,
934
+ createEscapeDirective as c,
837
935
  debounce as d,
838
- addResizeListener as e,
839
- LibForm as f,
936
+ useResizeObserver as e,
937
+ formatDate as f,
840
938
  getNewArray as g,
841
- LibFormLabel as h,
939
+ LibForm as h,
842
940
  index as i,
843
- LibInput as j,
844
- LibSelect as k,
845
- LibSelectOption as l,
846
- LibTable as m,
847
- LibTableItem as n,
941
+ LibFormLabel as j,
942
+ LibInput as k,
943
+ LibSelect as l,
944
+ LibSelectOption as m,
945
+ LibTable as n,
848
946
  on as o,
849
- LibImage as p,
850
- LibDatePicker as q,
851
- removeResizeListener as r,
947
+ LibTableItem as p,
948
+ LibImage as q,
949
+ LibDatePicker as r,
852
950
  LibDatePickerRange as s,
853
951
  throttle as t,
854
952
  usePotion as u,