vue-devui 1.0.0-rc.11 → 1.0.0-rc.14

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 (115) hide show
  1. package/README.md +160 -149
  2. package/auto-complete/index.es.js +182 -10
  3. package/auto-complete/index.umd.js +18 -18
  4. package/auto-complete/style.css +1 -1
  5. package/badge/index.es.js +3 -1
  6. package/badge/index.umd.js +1 -1
  7. package/button/index.es.js +5 -3
  8. package/button/index.umd.js +6 -6
  9. package/button/style.css +1 -1
  10. package/checkbox/index.es.js +1 -1
  11. package/checkbox/index.umd.js +4 -4
  12. package/checkbox/style.css +1 -1
  13. package/collapse/index.es.js +20 -186
  14. package/collapse/index.umd.js +1 -1
  15. package/collapse/style.css +1 -1
  16. package/countdown/index.es.js +56 -13
  17. package/countdown/index.umd.js +1 -1
  18. package/{date-picker → date-picker-pro}/index.d.ts +0 -0
  19. package/date-picker-pro/index.es.js +12016 -0
  20. package/date-picker-pro/index.umd.js +27 -0
  21. package/date-picker-pro/package.json +7 -0
  22. package/date-picker-pro/style.css +1 -0
  23. package/dropdown/index.es.js +9 -2
  24. package/dropdown/index.umd.js +1 -1
  25. package/editable-select/index.es.js +248 -56
  26. package/editable-select/index.umd.js +1 -1
  27. package/editable-select/style.css +1 -1
  28. package/form/index.es.js +1 -1
  29. package/form/index.umd.js +4 -4
  30. package/icon/index.es.js +5 -3
  31. package/icon/index.umd.js +1 -1
  32. package/icon/style.css +1 -1
  33. package/image-preview/style.css +1 -1
  34. package/input/index.es.js +193 -15
  35. package/input/index.umd.js +14 -14
  36. package/input/style.css +1 -1
  37. package/input-number/index.es.js +1 -4
  38. package/input-number/index.umd.js +1 -1
  39. package/layout/index.es.js +1 -1
  40. package/layout/index.umd.js +1 -1
  41. package/modal/index.es.js +5 -3
  42. package/modal/index.umd.js +1 -1
  43. package/modal/style.css +1 -1
  44. package/notification/index.es.js +32 -34
  45. package/notification/index.umd.js +1 -1
  46. package/notification/style.css +1 -1
  47. package/nuxt/components/DRangeDatePickerPro.js +3 -0
  48. package/nuxt/components/DatePickerPro.js +3 -0
  49. package/nuxt/components/OptionGroup.js +3 -0
  50. package/nuxt/components/Step.js +3 -0
  51. package/nuxt/components/Steps.js +3 -0
  52. package/nuxt/components/TimePicker.js +3 -0
  53. package/nuxt/components/datePickerProCommonProps.js +3 -0
  54. package/nuxt/components/datePickerProPanelProps.js +3 -0
  55. package/nuxt/components/datePickerProProps.js +3 -0
  56. package/nuxt/components/stepProps.js +3 -0
  57. package/nuxt/components/stepsProps.js +3 -0
  58. package/nuxt/components/timerPickerPanelProps.js +3 -0
  59. package/package.json +1 -1
  60. package/pagination/index.es.js +175 -7
  61. package/pagination/index.umd.js +1 -1
  62. package/radio/index.es.js +1 -1
  63. package/radio/index.umd.js +4 -4
  64. package/result/index.es.js +5 -3
  65. package/result/index.umd.js +1 -1
  66. package/result/style.css +1 -1
  67. package/search/index.es.js +198 -18
  68. package/search/index.umd.js +13 -13
  69. package/search/style.css +1 -1
  70. package/select/index.es.js +382 -258
  71. package/select/index.umd.js +15 -15
  72. package/select/style.css +1 -1
  73. package/splitter/index.es.js +182 -12
  74. package/splitter/index.umd.js +13 -13
  75. package/steps/index.d.ts +7 -0
  76. package/steps/index.es.js +386 -0
  77. package/steps/index.umd.js +1 -0
  78. package/{date-picker → steps}/package.json +1 -1
  79. package/steps/style.css +1 -0
  80. package/style.css +1 -1
  81. package/switch/index.es.js +1 -1
  82. package/switch/index.umd.js +4 -4
  83. package/table/index.es.js +851 -294
  84. package/table/index.umd.js +16 -16
  85. package/table/style.css +1 -1
  86. package/tabs/index.es.js +22 -12
  87. package/tabs/index.umd.js +1 -1
  88. package/tabs/style.css +1 -1
  89. package/textarea/index.es.js +3 -2
  90. package/textarea/index.umd.js +6 -6
  91. package/time-picker/index.d.ts +7 -0
  92. package/{date-picker → time-picker}/index.es.js +1537 -1040
  93. package/time-picker/index.umd.js +27 -0
  94. package/time-picker/package.json +7 -0
  95. package/time-picker/style.css +1 -0
  96. package/time-select/index.es.js +383 -258
  97. package/time-select/index.umd.js +16 -16
  98. package/time-select/style.css +1 -1
  99. package/timeline/index.es.js +5 -3
  100. package/timeline/index.umd.js +1 -1
  101. package/timeline/style.css +1 -1
  102. package/tooltip/index.es.js +1 -1
  103. package/tooltip/index.umd.js +1 -1
  104. package/tree/index.es.js +551 -88
  105. package/tree/index.umd.js +15 -15
  106. package/tree/style.css +1 -1
  107. package/upload/index.es.js +230 -57
  108. package/upload/index.umd.js +1 -1
  109. package/upload/style.css +1 -1
  110. package/vue-devui.es.js +14310 -11217
  111. package/vue-devui.umd.js +23 -23
  112. package/date-picker/index.umd.js +0 -27
  113. package/date-picker/style.css +0 -1
  114. package/nuxt/components/DatePicker.js +0 -3
  115. package/nuxt/components/StickSlider.js +0 -3
@@ -29,208 +29,58 @@ var __objRest = (source, exclude) => {
29
29
  }
30
30
  return target;
31
31
  };
32
- import { defineComponent, toRefs, computed, createVNode, resolveDynamicComponent, mergeProps, watch, provide, reactive, onUnmounted, Transition, ref, unref, nextTick, Comment, Text, h, Fragment, inject, withDirectives, cloneVNode, onMounted, Teleport, createTextVNode, onBeforeUnmount, shallowRef } from "vue";
33
- import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
34
- const getDateTime = (d) => {
35
- const year = d.getFullYear();
36
- const month = d.getMonth() + 1;
37
- const date4 = d.getDate();
38
- const day = d.getDay();
39
- const hour = d.getHours();
40
- const minute = d.getMinutes();
41
- const second = d.getSeconds();
42
- const ms = d.getMilliseconds();
43
- return [year, month, date4, day, hour, minute, second, ms];
44
- };
45
- const fixStart = (n, m, max = 2, ch = "0") => {
46
- return (n + "").padStart(Math.min(m.length, max), ch);
47
- };
48
- const formatDate = (fmt, d) => {
49
- const usage = getDateTime(d);
50
- let res = fmt;
51
- res = res.replace(/y+/g, (m) => {
52
- const year = usage[0] + "";
53
- if (m.length === 2) {
54
- return year.substring(2);
55
- }
56
- return year;
57
- });
58
- res = res.replace(/M+/g, (m) => fixStart(usage[1], m));
59
- res = res.replace(/d+/g, (m) => fixStart(usage[2], m));
60
- res = res.replace(/h+/g, (m) => fixStart(usage[4], m));
61
- res = res.replace(/m+/g, (m) => fixStart(usage[5], m));
62
- res = res.replace(/s+/g, (m) => fixStart(usage[6], m));
63
- return res;
64
- };
65
- const formatRange$1 = (fmt, a, b, conn = "-") => {
66
- const ab = [a, b];
67
- if (a.getTime() > b.getTime()) {
68
- ab.reverse();
69
- }
70
- return `${formatDate(fmt, ab[0])} ${conn} ${formatDate(fmt, ab[1])}`;
71
- };
72
- const isIn = (a, b) => {
73
- if (!b) {
74
- return false;
75
- }
76
- while (a) {
77
- if (a === b) {
78
- return true;
79
- }
80
- a = a.parentNode;
81
- }
82
- return false;
83
- };
84
- const invokeFunction = (fn, ...args) => {
85
- if (typeof fn === "function") {
86
- fn(...args);
87
- }
88
- };
89
- const getHumanDate = (d) => {
90
- const year = d.getFullYear();
91
- const month = d.getMonth() + 1;
92
- const date4 = d.getDate();
93
- const day = d.getDay();
94
- const hour = d.getHours();
95
- const minute = d.getMinutes();
96
- const second = d.getSeconds();
97
- const ms = d.getMilliseconds();
98
- return {
99
- year,
100
- y: year,
101
- month,
102
- M: month,
103
- date: date4,
104
- d: date4,
105
- day,
106
- hour,
107
- H: hour,
108
- h: hour,
109
- minute,
110
- m: minute,
111
- second,
112
- s: second,
113
- ms
114
- };
115
- };
116
- const getMonthDays = (year, month) => {
117
- const first = new Date(year, month - 1, 1);
118
- const last = new Date(year, month, 0);
119
- const dates = [];
120
- let day = first.getDay();
121
- while (day > 0) {
122
- day -= 1;
123
- dates.push({ date: new Date(year, month - 1, -day), current: -1 });
124
- }
125
- day = last.getDate() - first.getDate();
126
- for (let i = 0; i <= day; i++) {
127
- const date4 = new Date(first);
128
- date4.setDate(i + 1);
129
- dates.push({ date: date4, current: 0 });
130
- }
131
- day = last.getDay();
132
- let tail = last;
133
- for (let i = day; i < 6; i++) {
134
- tail = new Date(year, month, i - day + 1);
135
- dates.push({ date: tail, current: 1 });
136
- }
137
- if (dates.length < 42) {
138
- day = tail.getDate();
139
- for (let i = 1; i <= 7; i++) {
140
- tail = new Date(year, month, day + i);
141
- dates.push({ date: tail, current: 1 });
142
- }
143
- }
144
- return dates;
145
- };
146
- const getMonthWeeklyDays = (date4 = new Date()) => {
147
- if (!(date4 instanceof Date)) {
148
- date4 = new Date();
149
- }
150
- const { year, month } = getHumanDate(date4);
151
- const days = getMonthDays(year, month);
152
- const dayRows = [];
153
- while (days.length > 0) {
154
- dayRows.push(days.splice(0, 7));
155
- }
156
- return dayRows;
157
- };
158
- const WEEK_DAYS = ["\u65E5", "\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D"];
159
- const invokeCallback = (cb, ...args) => {
160
- typeof cb === "function" && cb(...args);
161
- };
162
- const subDateMonth = (a, b) => {
163
- const am = a.getFullYear() * 12 + a.getMonth();
164
- const bm = b.getFullYear() * 12 + b.getMonth();
165
- return am - bm;
166
- };
167
- const ONE_DAY = 1e3 * 60 * 60 * 24;
168
- const subDateDay = (a, b) => {
169
- const ad = new Date(a.getFullYear(), a.getMonth(), a.getDate()).getTime();
170
- const bd = new Date(b.getFullYear(), b.getMonth(), b.getDate()).getTime();
171
- return (ad - bd) / ONE_DAY;
172
- };
173
- const compareDate = (small, big, mode, min) => {
174
- if (!small || !big) {
175
- return true;
176
- }
177
- if (mode === "year") {
178
- return big.getFullYear() - small.getFullYear() > min;
179
- } else {
180
- return subDateMonth(big, small) > min;
181
- }
182
- };
183
- const parseDate = (str) => {
184
- if (!str || typeof str !== "string") {
185
- return null;
186
- }
187
- const [dateStr = "", timeStr = ""] = str.split(/([ ]|T)+/);
188
- if (!dateStr) {
189
- return null;
190
- }
191
- const [y, m, d] = dateStr.split(/[^\d]+/);
192
- const year = _parseInt(y), month = _parseInt(m), date4 = _parseInt(d) || 1;
193
- if (!year || !month) {
194
- return null;
195
- }
196
- const time = parseTime(timeStr);
197
- return new Date(year, month - 1, date4, ...time);
198
- };
199
- const _parseInt = (str, dftVal) => {
200
- if (!str || typeof str !== "string") {
201
- return dftVal;
202
- }
203
- const n = parseInt(str);
204
- if (isNaN(n)) {
205
- return dftVal;
206
- }
207
- return n;
32
+ var __publicField = (obj, key, value) => {
33
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
34
+ return value;
208
35
  };
209
- const parseTime = (str) => {
210
- const [h2, m, s, ms] = str.split(/[\:\.]+/);
211
- return [_parseInt(h2, 0), _parseInt(m, 0), _parseInt(s, 0), _parseInt(ms, 0)];
212
- };
213
- const compareDateSort = (d1, d2, type4 = "d") => {
214
- const t1 = dateCounter(d1, type4), t2 = dateCounter(d2, type4);
215
- return t1 < t2 ? -1 : t1 > t2 ? 1 : 0;
216
- };
217
- const dateCounter = (date4, type4) => {
218
- switch (type4) {
219
- case "y":
220
- return date4.getFullYear();
221
- case "m":
222
- return date4.getFullYear() * 12 + date4.getMonth();
223
- }
224
- return date4.getTime() / ONE_DAY >> 0;
225
- };
226
- const betweenDate = (date4, left, right) => {
227
- if (left instanceof Date && compareDateSort(left, date4, "d") > 0) {
228
- return false;
229
- }
230
- if (right instanceof Date && compareDateSort(date4, right, "d") > 0) {
231
- return false;
36
+ import { defineComponent, toRefs, computed, createVNode, resolveDynamicComponent, mergeProps, ref, reactive, onMounted, onBeforeUnmount, onUnmounted, Fragment, h, render, inject, withDirectives, resolveDirective, provide, toRef, getCurrentInstance, watch, isVNode, Transition, unref, nextTick, Comment, Text, cloneVNode, Teleport, createTextVNode, shallowRef } from "vue";
37
+ import { onClickOutside } from "@vueuse/core";
38
+ import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
39
+ const timePickerProps = {
40
+ modelValue: {
41
+ type: String,
42
+ default: ""
43
+ },
44
+ placeholder: {
45
+ type: String,
46
+ default: "00:00:00"
47
+ },
48
+ disabled: {
49
+ type: Boolean,
50
+ default: false
51
+ },
52
+ timePickerWidth: {
53
+ type: Number,
54
+ default: 212
55
+ },
56
+ minTime: {
57
+ type: String,
58
+ default: "00:00:00"
59
+ },
60
+ maxTime: {
61
+ type: String,
62
+ default: "23:59:59"
63
+ },
64
+ format: {
65
+ type: String,
66
+ default: "hh:mm:ss"
67
+ },
68
+ autoOpen: {
69
+ type: Boolean,
70
+ default: false
71
+ },
72
+ showAnimation: {
73
+ type: Boolean,
74
+ default: true
75
+ },
76
+ size: {
77
+ type: String,
78
+ default: "md"
79
+ },
80
+ readonly: {
81
+ type: Boolean,
82
+ default: false
232
83
  }
233
- return true;
234
84
  };
235
85
  const DEFAULT_PREFIX = "icon";
236
86
  const iconProps = {
@@ -359,7 +209,8 @@ function useIconDom(props, ctx) {
359
209
  "class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns2.m("spin")],
360
210
  "style": {
361
211
  width: iconSize.value || "",
362
- transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
212
+ transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`,
213
+ verticalAlign: "middle"
363
214
  }
364
215
  }, ctx.attrs), null);
365
216
  };
@@ -395,6 +246,7 @@ function useIconDom(props, ctx) {
395
246
  var Icon = defineComponent({
396
247
  name: "DIcon",
397
248
  props: iconProps,
249
+ emits: ["click"],
398
250
  setup(props, ctx) {
399
251
  const {
400
252
  disabled,
@@ -410,10 +262,10 @@ var Icon = defineComponent({
410
262
  [ns2.m("operable")]: operable.value
411
263
  }));
412
264
  const onClick = (e) => {
413
- e.stopImmediatePropagation();
414
265
  if (disabled.value) {
415
- e.preventDefault();
266
+ return;
416
267
  }
268
+ ctx.emit("click", e);
417
269
  };
418
270
  return () => {
419
271
  var _a, _b, _c, _d;
@@ -424,115 +276,871 @@ var Icon = defineComponent({
424
276
  };
425
277
  }
426
278
  });
427
- const inputProps = {
428
- modelValue: {
429
- type: String,
430
- default: ""
431
- },
432
- disabled: {
433
- type: Boolean,
434
- default: false
435
- },
436
- error: {
437
- type: Boolean,
438
- default: false
439
- },
440
- size: {
441
- type: String
442
- },
443
- validateEvent: {
444
- type: Boolean,
445
- default: true
446
- },
447
- prefix: {
448
- type: String,
449
- default: ""
279
+ var iconGroup = "";
280
+ defineComponent({
281
+ name: "DIconGroup",
282
+ setup(_, ctx) {
283
+ const ns2 = useNamespace("icon-group");
284
+ return () => {
285
+ var _a, _b;
286
+ return createVNode("div", {
287
+ "class": ns2.b()
288
+ }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
289
+ };
290
+ }
291
+ });
292
+ function useTimePicker(hh, mm, ss, format2, props) {
293
+ const showPopup = ref(false);
294
+ const devuiTimePicker = ref();
295
+ const inputDom = ref();
296
+ const overlayRef = ref();
297
+ const timePopupDom = ref();
298
+ const timePickerValue = ref("");
299
+ const showClearIcon = ref(false);
300
+ const firsthandActiveTime = ref(`${hh.value}:${mm.value}:${ss.value}`);
301
+ const vModeValue = ref(props.modelValue);
302
+ const formatTime = () => {
303
+ let modelValue = vModeValue.value || "00:00:00";
304
+ if (["hh:mm", "mm:ss"].includes(format2)) {
305
+ modelValue = vModeValue.value || "00:00";
306
+ }
307
+ const timeArr = modelValue.split(":");
308
+ let trueValue = "00:00:00";
309
+ if (format2 === "hh:mm:ss") {
310
+ trueValue = modelValue;
311
+ } else if (format2 === "mm:hh:ss") {
312
+ trueValue = `${timeArr[1]}:${timeArr[0]}:${timeArr[2]}`;
313
+ } else if (format2 === "hh:mm") {
314
+ trueValue = `${timeArr[0]}:${timeArr[1]}:${ss.value}`;
315
+ } else if (format2 === "mm:ss") {
316
+ trueValue = `${hh.value}:${timeArr[0]}:${timeArr[1]}`;
317
+ }
318
+ return trueValue;
319
+ };
320
+ const trueTimeValue = computed(() => {
321
+ return formatTime();
322
+ });
323
+ const setInputValue = (h2, m, s) => {
324
+ if (format2 === "hh:mm:ss") {
325
+ vModeValue.value = `${h2}:${m}:${s}`;
326
+ } else if (format2 === "mm:hh:ss") {
327
+ vModeValue.value = `${m}:${h2}:${s}`;
328
+ } else if (format2 === "hh:mm") {
329
+ vModeValue.value = `${h2}:${m}`;
330
+ } else if (format2 === "mm:ss") {
331
+ vModeValue.value = `${m}:${s}`;
332
+ }
333
+ };
334
+ const initData = () => {
335
+ if (vModeValue.value) {
336
+ firsthandActiveTime.value = props.modelValue;
337
+ const time = vModeValue.value.split(":");
338
+ setInputValue(time[0], time[1], time[2]);
339
+ }
340
+ };
341
+ initData();
342
+ const changeTimeData = ({ activeHour, activeMinute, activeSecond }) => {
343
+ hh.value = activeHour.value || "00";
344
+ mm.value = activeMinute.value || "00";
345
+ ss.value = activeSecond.value || "00";
346
+ firsthandActiveTime.value = `${hh.value}:${mm.value}:${ss.value}`;
347
+ setInputValue(hh.value, mm.value, ss.value);
348
+ };
349
+ const mouseInputFun = () => {
350
+ if (!vModeValue.value) {
351
+ vModeValue.value = "00:00:00";
352
+ }
353
+ const minTimeValueArr = props.minTime.split(":");
354
+ const maxTimeValueArr = props.maxTime.split(":");
355
+ if (vModeValue.value > props.maxTime) {
356
+ firsthandActiveTime.value = props.maxTime;
357
+ setInputValue(maxTimeValueArr[0], maxTimeValueArr[1], maxTimeValueArr[2]);
358
+ } else if (vModeValue.value < props.minTime) {
359
+ firsthandActiveTime.value = props.minTime;
360
+ setInputValue(minTimeValueArr[0], minTimeValueArr[1], minTimeValueArr[2]);
361
+ }
362
+ showPopup.value = true;
363
+ };
364
+ const clickVerifyFun = (e) => {
365
+ e.stopPropagation();
366
+ if (props.disabled || props.readonly) {
367
+ return;
368
+ }
369
+ mouseInputFun();
370
+ };
371
+ onClickOutside(devuiTimePicker, () => {
372
+ showPopup.value = false;
373
+ });
374
+ const clearAll = (e) => {
375
+ e.stopPropagation();
376
+ if (props.minTime !== "00:00:00") {
377
+ const minTimeArr = props.minTime.split(":");
378
+ hh.value = minTimeArr[0];
379
+ mm.value = minTimeArr[1];
380
+ ss.value = minTimeArr[2];
381
+ } else {
382
+ hh.value = "00";
383
+ mm.value = "00";
384
+ ss.value = "00";
385
+ }
386
+ firsthandActiveTime.value = `${hh.value}:${mm.value}:${ss.value}`;
387
+ setInputValue(hh.value, mm.value, ss.value);
388
+ };
389
+ const isOutOpen = () => {
390
+ if (props.autoOpen) {
391
+ mouseInputFun();
392
+ showPopup.value = props.autoOpen;
393
+ }
394
+ };
395
+ const chooseTime = (slotTime) => {
396
+ if (slotTime.type) {
397
+ if (slotTime.type.toLowerCase() === "hh") {
398
+ hh.value = slotTime.time;
399
+ } else if (slotTime.type.toLowerCase() === "mm") {
400
+ mm.value = slotTime.time;
401
+ } else if (slotTime.type.toLowerCase() === "ss") {
402
+ ss.value = slotTime.time;
403
+ }
404
+ firsthandActiveTime.value = `${hh.value}:${mm.value}:${ss.value}`;
405
+ setInputValue(hh.value, mm.value, ss.value);
406
+ } else {
407
+ const timeArr = slotTime.time.split(":");
408
+ hh.value = timeArr[0];
409
+ mm.value = timeArr[1];
410
+ ss.value = timeArr[2];
411
+ firsthandActiveTime.value = `${hh.value}:${mm.value}:${ss.value}`;
412
+ setInputValue(hh.value, mm.value, ss.value);
413
+ }
414
+ };
415
+ return {
416
+ showPopup,
417
+ trueTimeValue,
418
+ devuiTimePicker,
419
+ timePickerValue,
420
+ inputDom,
421
+ timePopupDom,
422
+ showClearIcon,
423
+ firsthandActiveTime,
424
+ vModeValue,
425
+ clickVerifyFun,
426
+ isOutOpen,
427
+ clearAll,
428
+ chooseTime,
429
+ overlayRef,
430
+ changeTimeData
431
+ };
432
+ }
433
+ function initializeTimeData(type4) {
434
+ const timeArr = reactive([]);
435
+ let arrLength = 0;
436
+ if (type4 === "hour") {
437
+ arrLength = 24;
438
+ } else {
439
+ arrLength = 60;
440
+ }
441
+ for (let i = 0; i < arrLength; i++) {
442
+ timeArr.push({
443
+ time: i < 10 ? "0" + i : i + "",
444
+ isActive: false,
445
+ flag: type4,
446
+ isDisabled: false,
447
+ type: type4
448
+ });
449
+ }
450
+ return timeArr;
451
+ }
452
+ const setTimeAstrict = (hourList, minuteList, secondList, minTime, maxTime, format2) => {
453
+ const maxTimeHour = maxTime.split(":")[0];
454
+ const maxTimeMinute = maxTime.split(":")[1];
455
+ const minTimeHour = minTime.split(":")[0];
456
+ const minTimeMinute = minTime.split(":")[1];
457
+ const minTimeSecond = minTime.split(":")[2];
458
+ hourList.map((item) => {
459
+ if (item.time < minTimeHour || item.time > maxTimeHour) {
460
+ item.isDisabled = true;
461
+ }
462
+ });
463
+ if (format2 === "mm:ss") {
464
+ minuteList.map((item) => {
465
+ if (item.time < minTimeMinute || item.time > maxTimeMinute) {
466
+ item.isDisabled = true;
467
+ }
468
+ });
469
+ } else {
470
+ minuteList.map((item) => {
471
+ if (item.time < minTimeMinute) {
472
+ item.isDisabled = true;
473
+ }
474
+ });
475
+ }
476
+ secondList.map((item) => {
477
+ if (item.time < minTimeSecond) {
478
+ item.isDisabled = true;
479
+ }
480
+ });
481
+ };
482
+ const usePopupLine = (hourListRef, minuteListRef, secondListRef, minTime, maxTime, format2, itemHeight, timeListDom, ctx) => {
483
+ const activeTime = ref("00:00:00");
484
+ const activeHour = ref("00");
485
+ const activeMinute = ref("00");
486
+ const activeSecond = ref("00");
487
+ const setItemAstrict = (timeArr, min, max) => {
488
+ timeArr.map((item) => {
489
+ if (min !== "00" && item.time < min) {
490
+ item.isDisabled = true;
491
+ } else if (max !== "00" && item.time > max) {
492
+ item.isDisabled = true;
493
+ } else {
494
+ item.isDisabled = false;
495
+ }
496
+ });
497
+ };
498
+ const getItemAstrict = (item) => {
499
+ let min = "00";
500
+ let max = "00";
501
+ const minTimeHour = minTime.split(":")[0];
502
+ const minTimeMinute = minTime.split(":")[1];
503
+ const minTimeSecond = minTime.split(":")[2];
504
+ const maxTimeHour = maxTime.split(":")[0];
505
+ const maxTimeMinute = maxTime.split(":")[1];
506
+ const maxTimeSecond = maxTime.split(":")[2];
507
+ if (item.flag === "hour") {
508
+ if (item.time === minTimeHour) {
509
+ min = minTimeMinute;
510
+ setItemAstrict(minuteListRef, min, max);
511
+ activeMinute.value < minTimeMinute && setItemAstrict(secondListRef, minTimeSecond, max);
512
+ } else if (item.time === maxTimeHour) {
513
+ max = maxTimeMinute;
514
+ setItemAstrict(minuteListRef, min, max);
515
+ setItemAstrict(secondListRef, min, maxTimeSecond);
516
+ } else {
517
+ setItemAstrict(minuteListRef, min, max);
518
+ setItemAstrict(secondListRef, min, max);
519
+ }
520
+ }
521
+ if (item.flag === "minute" && format2 === "mm:ss") {
522
+ if (item.time === minTimeMinute) {
523
+ min = minTimeSecond;
524
+ setItemAstrict(secondListRef, min, max);
525
+ } else if (item.time === maxTimeMinute) {
526
+ max = maxTimeSecond;
527
+ setItemAstrict(secondListRef, min, max);
528
+ } else {
529
+ setItemAstrict(secondListRef, min, max);
530
+ }
531
+ } else if (item.flag === "minute") {
532
+ if (activeHour.value === minTimeHour && item.time === minTimeMinute) {
533
+ min = minTimeSecond;
534
+ setItemAstrict(secondListRef, min, max);
535
+ } else if (activeHour.value === maxTimeHour && item.time === maxTimeMinute) {
536
+ max = maxTimeSecond;
537
+ setItemAstrict(secondListRef, min, max);
538
+ } else {
539
+ setItemAstrict(secondListRef, min, max);
540
+ }
541
+ }
542
+ };
543
+ const resetTimeActive = (timeArr, itemValue) => {
544
+ timeArr.map((item) => {
545
+ item.isActive = item.time === itemValue;
546
+ });
547
+ };
548
+ const resetTimeAstrict = (timeArr, time) => {
549
+ timeArr.map((item) => {
550
+ if (item.time === time) {
551
+ getItemAstrict(item);
552
+ }
553
+ });
554
+ };
555
+ const resetTimeValue = (time) => {
556
+ const timeValueArr = time.split(":");
557
+ let hh = 0;
558
+ let mm = 0;
559
+ let ss = 0;
560
+ if (format2 === "hh:mm:ss") {
561
+ hh = parseInt(timeValueArr[0]);
562
+ mm = parseInt(timeValueArr[1]);
563
+ ss = parseInt(timeValueArr[2]);
564
+ timeListDom.value.children[0].lastElementChild.children[0].scrollTop = hh * itemHeight;
565
+ timeListDom.value.children[1].lastElementChild.children[0].scrollTop = mm * itemHeight;
566
+ timeListDom.value.children[2].lastElementChild.children[0].scrollTop = ss * itemHeight;
567
+ activeHour.value = timeValueArr[0];
568
+ activeMinute.value = timeValueArr[1];
569
+ activeSecond.value = timeValueArr[2];
570
+ resetTimeActive(hourListRef, timeValueArr[0]);
571
+ resetTimeActive(minuteListRef, timeValueArr[1]);
572
+ resetTimeActive(secondListRef, timeValueArr[2]);
573
+ resetTimeAstrict(hourListRef, activeHour.value);
574
+ resetTimeAstrict(minuteListRef, activeMinute.value);
575
+ } else if (format2 === "mm:hh:ss") {
576
+ hh = parseInt(timeValueArr[0]);
577
+ mm = parseInt(timeValueArr[1]);
578
+ ss = parseInt(timeValueArr[2]);
579
+ timeListDom.value.children[0].lastElementChild.children[0].scrollTop = mm * itemHeight;
580
+ timeListDom.value.children[1].lastElementChild.children[0].scrollTop = hh * itemHeight;
581
+ timeListDom.value.children[2].lastElementChild.children[0].scrollTop = ss * itemHeight;
582
+ activeHour.value = timeValueArr[0];
583
+ activeMinute.value = timeValueArr[1];
584
+ activeSecond.value = timeValueArr[2];
585
+ resetTimeActive(hourListRef, timeValueArr[0]);
586
+ resetTimeActive(minuteListRef, timeValueArr[1]);
587
+ resetTimeActive(secondListRef, timeValueArr[2]);
588
+ resetTimeAstrict(hourListRef, activeHour.value);
589
+ resetTimeAstrict(minuteListRef, activeMinute.value);
590
+ } else if (format2 === "hh:mm") {
591
+ hh = parseInt(timeValueArr[0]);
592
+ mm = parseInt(timeValueArr[1]);
593
+ timeListDom.value.children[0].lastElementChild.children[0].scrollTop = hh * itemHeight;
594
+ timeListDom.value.children[1].lastElementChild.children[0].scrollTop = mm * itemHeight;
595
+ activeHour.value = timeValueArr[0];
596
+ activeMinute.value = timeValueArr[1];
597
+ activeSecond.value = timeValueArr[2];
598
+ resetTimeActive(hourListRef, timeValueArr[0]);
599
+ resetTimeActive(minuteListRef, timeValueArr[1]);
600
+ resetTimeAstrict(hourListRef, activeHour.value);
601
+ } else if (format2 === "mm:ss") {
602
+ mm = parseInt(timeValueArr[1]);
603
+ ss = parseInt(timeValueArr[2]);
604
+ timeListDom.value.children[0].lastElementChild.children[0].scrollTop = mm * itemHeight;
605
+ timeListDom.value.children[1].lastElementChild.children[0].scrollTop = ss * itemHeight;
606
+ activeHour.value = timeValueArr[0];
607
+ activeMinute.value = timeValueArr[1];
608
+ activeSecond.value = timeValueArr[2];
609
+ resetTimeActive(minuteListRef, timeValueArr[1]);
610
+ resetTimeActive(secondListRef, timeValueArr[2]);
611
+ resetTimeAstrict(minuteListRef, activeMinute.value);
612
+ }
613
+ };
614
+ const setTimeActive = (item, index2) => {
615
+ let activeTimeList = [];
616
+ let activeTimeValue = ref("");
617
+ if (item.flag === "hour") {
618
+ activeTimeList = hourListRef;
619
+ activeTimeValue = activeHour;
620
+ getItemAstrict(item);
621
+ } else if (item.flag === "minute") {
622
+ activeTimeList = minuteListRef;
623
+ activeTimeValue = activeMinute;
624
+ getItemAstrict(item);
625
+ } else if (item.flag === "second") {
626
+ activeTimeList = secondListRef;
627
+ activeTimeValue = activeSecond;
628
+ }
629
+ activeTimeList.map((timeItem, timeIndex) => {
630
+ timeItem.isActive = index2 === timeIndex;
631
+ });
632
+ activeTimeValue.value = activeTimeList[index2].time;
633
+ activeTime.value = `${activeHour.value}:${activeMinute.value}:${activeSecond.value}`;
634
+ if (activeTime.value < minTime) {
635
+ activeTime.value = minTime;
636
+ resetTimeValue(minTime);
637
+ } else if (format2 === "mm:ss" && `${activeMinute.value}:${activeSecond.value}` > maxTime.slice(3)) {
638
+ const newMinTime = minTime.slice(0, 3) + maxTime.slice(3);
639
+ resetTimeValue(newMinTime);
640
+ } else if (activeTime.value > maxTime) {
641
+ activeTime.value = maxTime;
642
+ resetTimeValue(maxTime);
643
+ }
644
+ };
645
+ const activeTimeFun = (e, item, index2) => {
646
+ var _a, _b;
647
+ if (item.isDisabled) {
648
+ return false;
649
+ } else {
650
+ setTimeActive(item, index2);
651
+ if ((_a = e == null ? void 0 : e.target) == null ? void 0 : _a.parentElement) {
652
+ const pdom = (_b = e == null ? void 0 : e.target) == null ? void 0 : _b.parentElement;
653
+ pdom && pdom.parentElement && (pdom.parentElement.scrollTop = index2 * itemHeight);
654
+ }
655
+ }
656
+ ctx.emit("change", { activeHour, activeMinute, activeSecond });
657
+ };
658
+ const getNewTime = () => {
659
+ return { activeTime, activeHour, activeMinute, activeSecond };
660
+ };
661
+ const resetScrollTop = () => {
662
+ for (let i = 0; i < timeListDom.value.children.length; i++) {
663
+ timeListDom.value.children[i].lastElementChild.children[0].scrollTop = 0;
664
+ }
665
+ };
666
+ return {
667
+ activeTime,
668
+ activeHour,
669
+ activeMinute,
670
+ activeSecond,
671
+ activeTimeFun,
672
+ resetTimeValue,
673
+ getNewTime,
674
+ resetScrollTop
675
+ };
676
+ };
677
+ function useTimeScroll() {
678
+ const scrollBoxDom = ref(null);
679
+ const scrollContentDom = ref(null);
680
+ const scrollThumbDom = ref(null);
681
+ const scrollTrackDom = ref(null);
682
+ const isDown = ref(false);
683
+ const getScrollHeight = () => {
684
+ var _a, _b;
685
+ const thumbHeight = (((_a = scrollContentDom.value) == null ? void 0 : _a.clientHeight) || 0) / (((_b = scrollContentDom.value) == null ? void 0 : _b.scrollHeight) || 0) * 100;
686
+ scrollThumbDom.value && (scrollThumbDom.value.style.height = thumbHeight + "%");
687
+ };
688
+ const setVirtualScroll = () => {
689
+ var _a, _b;
690
+ const thumbMoveY = (((_a = scrollContentDom.value) == null ? void 0 : _a.scrollTop) || 0) * 100 / (((_b = scrollContentDom.value) == null ? void 0 : _b.clientHeight) || 0);
691
+ scrollThumbDom.value && (scrollThumbDom.value.style.transform = `translateY(${thumbMoveY}%)`);
692
+ };
693
+ const clickTrackFun = (e) => {
694
+ var _a, _b, _c, _d, _e;
695
+ const offsetNum = (((_c = (_b = (_a = scrollTrackDom.value) == null ? void 0 : _a.getBoundingClientRect) == null ? void 0 : _b.call(_a)) == null ? void 0 : _c.top) || 0) - e.clientY;
696
+ const offset2 = Math.abs(offsetNum > 0 ? 0 : offsetNum);
697
+ const thumbCenter = (((_d = scrollThumbDom.value) == null ? void 0 : _d.offsetHeight) || 0) / 2;
698
+ const thumbPosition = (offset2 - thumbCenter) * 100 / (((_e = scrollContentDom.value) == null ? void 0 : _e.offsetHeight) || 0);
699
+ if (scrollContentDom.value) {
700
+ scrollContentDom.value.scrollTop = thumbPosition * scrollContentDom.value.scrollHeight / 100;
701
+ scrollContentDom.value.style.top = scrollContentDom.value.scrollTop + "px";
702
+ }
703
+ };
704
+ const thumbMouseMove = (e) => {
705
+ const path = e.composedPath && e.composedPath() || e.path;
706
+ if (scrollBoxDom.value && path.includes(scrollBoxDom.value) || isDown.value) {
707
+ scrollTrackDom.value && (scrollTrackDom.value.style.opacity = "1");
708
+ } else {
709
+ scrollTrackDom.value && (scrollTrackDom.value.style.opacity = "0");
710
+ }
711
+ if (!isDown.value) {
712
+ return;
713
+ }
714
+ clickTrackFun(e);
715
+ };
716
+ const mouseDownThum = () => {
717
+ isDown.value = true;
718
+ scrollTrackDom.value && (scrollTrackDom.value.style.opacity = "1");
719
+ };
720
+ const mouseOutThum = (e) => {
721
+ isDown.value = false;
722
+ thumbMouseMove(e);
723
+ };
724
+ const getScrollWidth = () => {
725
+ var _a;
726
+ const ua = navigator.userAgent;
727
+ let marginRight = -20;
728
+ if (ua.indexOf("Chrome") > -1) {
729
+ marginRight = -8;
730
+ } else {
731
+ const outer = document.createElement("div");
732
+ outer.className = "devui-scrollbar-wrap";
733
+ outer.style.width = "100px";
734
+ outer.style.visibility = "hidden";
735
+ outer.style.position = "absolute";
736
+ outer.style.top = "-9999px";
737
+ document.body.appendChild(outer);
738
+ const widthNoScroll = outer.offsetWidth;
739
+ outer.style.overflow = "scroll";
740
+ const inner = document.createElement("div");
741
+ inner.style.width = "100%";
742
+ outer.appendChild(inner);
743
+ const widthWithScroll = inner.offsetWidth;
744
+ (_a = outer.parentNode) == null ? void 0 : _a.removeChild(outer);
745
+ marginRight = (widthNoScroll - widthWithScroll + 3) * -1;
746
+ }
747
+ return marginRight;
748
+ };
749
+ return {
750
+ scrollThumbDom,
751
+ scrollTrackDom,
752
+ scrollContentDom,
753
+ scrollBoxDom,
754
+ isDown,
755
+ getScrollHeight,
756
+ setVirtualScroll,
757
+ clickTrackFun,
758
+ mouseDownThum,
759
+ mouseOutThum,
760
+ thumbMouseMove,
761
+ getScrollWidth
762
+ };
763
+ }
764
+ var index$3 = "";
765
+ var TimeScroll = defineComponent({
766
+ name: "DTimeScroll",
767
+ props: timePickerProps,
768
+ setup(props, ctx) {
769
+ const ns2 = useNamespace("scroll-box");
770
+ const {
771
+ scrollBoxDom,
772
+ scrollThumbDom,
773
+ scrollTrackDom,
774
+ scrollContentDom,
775
+ isDown,
776
+ getScrollHeight,
777
+ setVirtualScroll,
778
+ clickTrackFun,
779
+ mouseDownThum,
780
+ mouseOutThum,
781
+ thumbMouseMove,
782
+ getScrollWidth
783
+ } = useTimeScroll();
784
+ const marginRight = getScrollWidth();
785
+ onMounted(() => {
786
+ var _a, _b, _c;
787
+ getScrollWidth();
788
+ getScrollHeight();
789
+ (_a = scrollBoxDom.value) == null ? void 0 : _a.addEventListener("click", setVirtualScroll);
790
+ (_b = scrollContentDom.value) == null ? void 0 : _b.addEventListener("scroll", setVirtualScroll);
791
+ (_c = scrollThumbDom.value) == null ? void 0 : _c.addEventListener("mousedown", mouseDownThum);
792
+ document.addEventListener("mouseup", mouseOutThum);
793
+ document.addEventListener("mousemove", thumbMouseMove);
794
+ });
795
+ onBeforeUnmount(() => {
796
+ var _a, _b, _c;
797
+ (_a = scrollBoxDom.value) == null ? void 0 : _a.removeEventListener("click", setVirtualScroll);
798
+ (_b = scrollContentDom.value) == null ? void 0 : _b.removeEventListener("scroll", setVirtualScroll);
799
+ (_c = scrollThumbDom.value) == null ? void 0 : _c.removeEventListener("mousedown", mouseDownThum);
800
+ });
801
+ onUnmounted(() => {
802
+ document.removeEventListener("mouseup", mouseOutThum);
803
+ document.removeEventListener("mousemove", thumbMouseMove);
804
+ });
805
+ return () => {
806
+ var _a, _b;
807
+ return createVNode(Fragment, null, [createVNode("div", {
808
+ "ref": scrollBoxDom,
809
+ "class": ns2.b()
810
+ }, [createVNode("div", {
811
+ "ref": scrollContentDom,
812
+ "class": `box-content ${isDown.value || !props.showAnimation ? "box-content-behavior-auto" : ""}`,
813
+ "style": {
814
+ "margin-right": marginRight + "px"
815
+ }
816
+ }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]), createVNode("div", {
817
+ "ref": scrollTrackDom,
818
+ "class": "box-sroll",
819
+ "onClick": clickTrackFun
820
+ }, [createVNode("div", {
821
+ "ref": scrollThumbDom,
822
+ "class": "scroll-child"
823
+ }, null)])])]);
824
+ };
825
+ }
826
+ });
827
+ var index$2 = "";
828
+ var TimeList = defineComponent({
829
+ name: "DTimeList",
830
+ components: {
831
+ TimeScroll
450
832
  },
451
- suffix: {
452
- type: String,
453
- default: ""
833
+ props: {
834
+ hourList: {
835
+ type: Array,
836
+ default: () => []
837
+ },
838
+ minuteList: {
839
+ type: Array,
840
+ default: () => []
841
+ },
842
+ secondList: {
843
+ type: Array,
844
+ default: () => []
845
+ },
846
+ format: {
847
+ type: String,
848
+ default: "hh:mm:ss"
849
+ },
850
+ minTime: {
851
+ type: String,
852
+ default: "00:00:00"
853
+ },
854
+ maxTime: {
855
+ type: String,
856
+ default: "23:59:59"
857
+ },
858
+ itemHeight: {
859
+ type: Number,
860
+ default: 32
861
+ }
454
862
  },
455
- showPassword: {
456
- type: Boolean,
457
- default: false
863
+ emits: ["change"],
864
+ setup(props, ctx) {
865
+ const ns2 = useNamespace("time-list");
866
+ const timeListDom = ref();
867
+ const {
868
+ getNewTime,
869
+ activeTimeFun,
870
+ resetTimeValue,
871
+ resetScrollTop
872
+ } = usePopupLine(props.hourList, props.minuteList, props.secondList, props.minTime, props.maxTime, props.format, props.itemHeight, timeListDom, ctx);
873
+ const setOuterTime = (time) => {
874
+ resetTimeValue(time);
875
+ };
876
+ const TimeLi = (timeArr) => {
877
+ return timeArr.map((item, index2) => {
878
+ return createVNode("li", {
879
+ "class": `time-li ${item.flag}Id-${index2} ${item.isActive ? "active-li" : ""} ${item.isDisabled ? "disabled-li" : ""}`,
880
+ "onClick": (e) => {
881
+ activeTimeFun(e, item, index2);
882
+ }
883
+ }, [createVNode("span", null, [item.time])]);
884
+ });
885
+ };
886
+ const TimeUl = (timeList) => {
887
+ return createVNode("div", {
888
+ "class": "time-item",
889
+ "style": {
890
+ flex: 1
891
+ }
892
+ }, [createVNode(TimeScroll, null, {
893
+ default: () => [createVNode("ul", {
894
+ "class": "time-ul"
895
+ }, [TimeLi(timeList)])]
896
+ })]);
897
+ };
898
+ const formatTimeUl = () => {
899
+ const timeList = {
900
+ hh: props.hourList,
901
+ mm: props.minuteList,
902
+ ss: props.secondList
903
+ };
904
+ const timeFormatArr = props.format.split(":");
905
+ return timeFormatArr.map((timeItem) => {
906
+ return TimeUl(timeList[timeItem]);
907
+ });
908
+ };
909
+ ctx.expose({
910
+ resetScrollTop,
911
+ setOuterTime,
912
+ getNewTime
913
+ });
914
+ return () => {
915
+ return createVNode("div", {
916
+ "class": ns2.b(),
917
+ "ref": timeListDom
918
+ }, [formatTimeUl()]);
919
+ };
920
+ }
921
+ });
922
+ class View {
923
+ constructor() {
924
+ __publicField(this, "top", "50%");
925
+ __publicField(this, "left", "50%");
926
+ }
927
+ }
928
+ const loadingProps = {
929
+ message: String,
930
+ backdrop: Boolean,
931
+ view: {
932
+ type: Object,
933
+ default: () => new View()
458
934
  },
459
- clearable: {
935
+ zIndex: Number,
936
+ isFull: {
460
937
  type: Boolean,
461
938
  default: false
462
939
  }
463
940
  };
464
- const formItemProps = {
465
- label: {
466
- type: String
467
- },
468
- field: {
469
- type: String,
470
- default: ""
471
- },
472
- required: {
473
- type: Boolean,
474
- default: false
475
- },
476
- messageType: {
477
- type: String
478
- },
479
- popPosition: {
480
- type: Array
481
- },
482
- rules: {
483
- type: [Object, Array]
484
- },
485
- showFeedback: {
486
- type: Boolean,
487
- default: void 0
488
- },
489
- helpTips: {
490
- type: String,
491
- default: ""
492
- },
493
- feedbackStatus: {
494
- type: String
941
+ class LoadingOptions {
942
+ constructor() {
943
+ __publicField(this, "target");
944
+ __publicField(this, "message");
945
+ __publicField(this, "loadingTemplateRef");
946
+ __publicField(this, "backdrop", true);
947
+ __publicField(this, "positionType", "relative");
948
+ __publicField(this, "view", new View());
949
+ __publicField(this, "zIndex");
950
+ }
951
+ }
952
+ var loading = "";
953
+ var Loading = defineComponent({
954
+ name: "DLoading",
955
+ inheritAttrs: false,
956
+ props: loadingProps,
957
+ setup(props) {
958
+ const style = {
959
+ top: props.view.top,
960
+ left: props.view.left,
961
+ zIndex: props.zIndex
962
+ };
963
+ if (!props.message) {
964
+ style.background = "none";
965
+ }
966
+ const isShow = ref(false);
967
+ const open = () => {
968
+ isShow.value = true;
969
+ };
970
+ const close = () => {
971
+ isShow.value = false;
972
+ };
973
+ return {
974
+ style,
975
+ isShow,
976
+ open,
977
+ close
978
+ };
495
979
  },
496
- extraInfo: {
497
- type: String,
498
- default: ""
980
+ render() {
981
+ var _a;
982
+ const {
983
+ isShow,
984
+ isFull,
985
+ backdrop,
986
+ style,
987
+ message,
988
+ $slots
989
+ } = this;
990
+ const ns2 = useNamespace("loading");
991
+ return isShow && createVNode("div", {
992
+ "class": [ns2.b(), isFull ? ns2.m("full") : ""]
993
+ }, [((_a = $slots.default) == null ? void 0 : _a.call($slots)) || createVNode("div", {
994
+ "class": ns2.e("wrapper")
995
+ }, [backdrop ? createVNode("div", {
996
+ "class": ns2.e("mask")
997
+ }, null) : null, createVNode("div", {
998
+ "style": style,
999
+ "class": ns2.e("area")
1000
+ }, [createVNode("div", {
1001
+ "class": ns2.e("busy-default-spinner")
1002
+ }, [createVNode("div", {
1003
+ "class": ns2.e("bar1")
1004
+ }, null), createVNode("div", {
1005
+ "class": ns2.e("bar2")
1006
+ }, null), createVNode("div", {
1007
+ "class": ns2.e("bar3")
1008
+ }, null), createVNode("div", {
1009
+ "class": ns2.e("bar4")
1010
+ }, null)]), message ? createVNode("span", {
1011
+ "class": ns2.e("text")
1012
+ }, [message]) : null])])]);
1013
+ }
1014
+ });
1015
+ const COMPONENT_CONTAINER_SYMBOL = Symbol("dev_component_container");
1016
+ function createComponent(component, props, children = null) {
1017
+ const vnode = h(component, __spreadValues({}, props), children);
1018
+ const container = document.createElement("div");
1019
+ vnode[COMPONENT_CONTAINER_SYMBOL] = container;
1020
+ render(vnode, container);
1021
+ return vnode.component;
1022
+ }
1023
+ function unmountComponent(ComponnetInstance) {
1024
+ render(null, ComponnetInstance == null ? void 0 : ComponnetInstance.vnode[COMPONENT_CONTAINER_SYMBOL]);
1025
+ }
1026
+ const loadingConstructor = defineComponent(Loading);
1027
+ const cacheInstance = /* @__PURE__ */ new WeakSet();
1028
+ const isEmpty = (val) => {
1029
+ if (!val) {
1030
+ return true;
1031
+ }
1032
+ if (Array.isArray(val)) {
1033
+ return val.length === 0;
1034
+ }
1035
+ if (val instanceof Set || val instanceof Map) {
1036
+ return val.size === 0;
1037
+ }
1038
+ if (val instanceof Promise) {
1039
+ return false;
1040
+ }
1041
+ if (typeof val === "object") {
1042
+ try {
1043
+ return Object.keys(val).length === 0;
1044
+ } catch (e) {
1045
+ return false;
1046
+ }
1047
+ }
1048
+ return false;
1049
+ };
1050
+ const getType = (vari) => {
1051
+ return Object.prototype.toString.call(vari).slice(8, -1).toLowerCase();
1052
+ };
1053
+ const isPromise = (value) => {
1054
+ const type4 = getType(value);
1055
+ switch (type4) {
1056
+ case "promise":
1057
+ return [value];
1058
+ case "array":
1059
+ if (value.some((val) => getType(val) !== "promise")) {
1060
+ console.error(new TypeError("Binding values should all be of type Promise"));
1061
+ return "error";
1062
+ }
1063
+ return value;
1064
+ default:
1065
+ return false;
1066
+ }
1067
+ };
1068
+ const unmount = (el) => {
1069
+ cacheInstance.delete(el);
1070
+ el.instance.proxy.close();
1071
+ unmountComponent(el.instance);
1072
+ };
1073
+ const toggleLoading = (el, binding) => {
1074
+ var _a, _b, _c;
1075
+ if (binding.value) {
1076
+ const vals = isPromise(binding.value);
1077
+ if (vals === "error") {
1078
+ return;
1079
+ }
1080
+ (_c = (_b = (_a = el == null ? void 0 : el.instance) == null ? void 0 : _a.proxy) == null ? void 0 : _b.open) == null ? void 0 : _c.call(_b);
1081
+ el.appendChild(el.mask);
1082
+ cacheInstance.add(el);
1083
+ if (vals) {
1084
+ Promise.all(vals).catch((err) => {
1085
+ console.error(new Error("Promise handling errors"), err);
1086
+ }).finally(() => {
1087
+ unmount(el);
1088
+ });
1089
+ }
1090
+ } else {
1091
+ unmount(el);
499
1092
  }
500
1093
  };
501
- const FORM_ITEM_TOKEN = Symbol("dFormItem");
502
- const LABEL_DATA = Symbol("labelData");
503
- const formProps = {
504
- data: {
505
- type: Object,
506
- default: () => ({})
1094
+ const removeAttribute = (el) => {
1095
+ el.removeAttribute("zindex");
1096
+ el.removeAttribute("positiontype");
1097
+ el.removeAttribute("backdrop");
1098
+ el.removeAttribute("message");
1099
+ el.removeAttribute("view");
1100
+ el.removeAttribute("loadingtemplateref");
1101
+ };
1102
+ const handleProps = (el, vprops) => {
1103
+ var _a;
1104
+ const props = __spreadValues(__spreadValues({}, new LoadingOptions()), vprops);
1105
+ const loadingTemplateRef = props.loadingTemplateRef;
1106
+ const loadingInstance = createComponent(loadingConstructor, __spreadValues({}, props), loadingTemplateRef ? () => loadingTemplateRef : null);
1107
+ el.style.position = props.positionType;
1108
+ el.options = props;
1109
+ el.instance = loadingInstance;
1110
+ el.mask = (_a = loadingInstance == null ? void 0 : loadingInstance.proxy) == null ? void 0 : _a.$el;
1111
+ };
1112
+ const loadingDirective = {
1113
+ mounted: function(el, binding, vnode) {
1114
+ handleProps(el, vnode.props);
1115
+ removeAttribute(el);
1116
+ !isEmpty(binding.value) && toggleLoading(el, binding);
507
1117
  },
508
- layout: {
1118
+ updated: function(el, binding, vnode) {
1119
+ if (!isEmpty(binding.value) && cacheInstance.has(el) || isEmpty(binding.value) && !cacheInstance.has(el)) {
1120
+ return;
1121
+ }
1122
+ !cacheInstance.has(el) && handleProps(el, vnode.props);
1123
+ removeAttribute(el);
1124
+ toggleLoading(el, binding);
1125
+ }
1126
+ };
1127
+ const buttonProps = {
1128
+ variant: {
509
1129
  type: String,
510
- default: "horizontal"
1130
+ default: "outline"
511
1131
  },
512
- labelSize: {
1132
+ size: {
513
1133
  type: String,
514
1134
  default: "md"
515
1135
  },
516
- labelAlign: {
517
- type: String,
518
- default: "start"
519
- },
520
- rules: {
521
- type: Object
1136
+ color: {
1137
+ type: String
522
1138
  },
523
- messageType: {
1139
+ icon: {
524
1140
  type: String,
525
- default: "popover"
526
- },
527
- popPosition: {
528
- type: Array,
529
- default: ["right", "bottom"]
530
- },
531
- validateOnRuleChange: {
532
- type: Boolean,
533
- default: false
1141
+ default: ""
534
1142
  },
535
- showFeedback: {
1143
+ loading: {
536
1144
  type: Boolean,
537
1145
  default: false
538
1146
  },
@@ -540,21 +1148,17 @@ const formProps = {
540
1148
  type: Boolean,
541
1149
  default: false
542
1150
  },
543
- size: {
1151
+ shape: {
544
1152
  type: String
545
1153
  }
546
1154
  };
547
- const FORM_TOKEN = Symbol("dForm");
548
- function useFieldCollection() {
549
- const itemContexts = [];
550
- const addItemContext = (field) => {
551
- itemContexts.push(field);
552
- };
553
- const removeItemContext = (field) => {
554
- itemContexts.splice(itemContexts.indexOf(field), 1);
555
- };
556
- return { itemContexts, addItemContext, removeItemContext };
557
- }
1155
+ const buttonGroupProps = {
1156
+ size: {
1157
+ type: String,
1158
+ default: "md"
1159
+ }
1160
+ };
1161
+ const buttonGroupInjectionKey = Symbol("d-button-group");
558
1162
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
559
1163
  var lodash = { exports: {} };
560
1164
  /**
@@ -1277,10 +1881,10 @@ var lodash = { exports: {} };
1277
1881
  }();
1278
1882
  var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
1279
1883
  var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined$1, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse;
1280
- var DataView = getNative(context, "DataView"), Map2 = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set = getNative(context, "Set"), WeakMap2 = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create");
1884
+ var DataView = getNative(context, "DataView"), Map2 = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set2 = getNative(context, "Set"), WeakMap2 = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create");
1281
1885
  var metaMap = WeakMap2 && new WeakMap2();
1282
1886
  var realNames = {};
1283
- var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap2);
1887
+ var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap2);
1284
1888
  var symbolProto = Symbol2 ? Symbol2.prototype : undefined$1, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined$1, symbolToString = symbolProto ? symbolProto.toString : undefined$1;
1285
1889
  function lodash2(value) {
1286
1890
  if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
@@ -1636,7 +2240,7 @@ var lodash = { exports: {} };
1636
2240
  function baseAt(object4, paths) {
1637
2241
  var index2 = -1, length = paths.length, result2 = Array2(length), skip = object4 == null;
1638
2242
  while (++index2 < length) {
1639
- result2[index2] = skip ? undefined$1 : get(object4, paths[index2]);
2243
+ result2[index2] = skip ? undefined$1 : get2(object4, paths[index2]);
1640
2244
  }
1641
2245
  return result2;
1642
2246
  }
@@ -2081,7 +2685,7 @@ var lodash = { exports: {} };
2081
2685
  return matchesStrictComparable(toKey(path), srcValue);
2082
2686
  }
2083
2687
  return function(object4) {
2084
- var objValue = get(object4, path);
2688
+ var objValue = get2(object4, path);
2085
2689
  return objValue === undefined$1 && objValue === srcValue ? hasIn(object4, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
2086
2690
  };
2087
2691
  }
@@ -2972,8 +3576,8 @@ var lodash = { exports: {} };
2972
3576
  return func(number4);
2973
3577
  };
2974
3578
  }
2975
- var createSet = !(Set && 1 / setToArray(new Set([, -0]))[1] == INFINITY) ? noop : function(values2) {
2976
- return new Set(values2);
3579
+ var createSet = !(Set2 && 1 / setToArray(new Set2([, -0]))[1] == INFINITY) ? noop : function(values2) {
3580
+ return new Set2(values2);
2977
3581
  };
2978
3582
  function createToPairs(keysFunc) {
2979
3583
  return function(object4) {
@@ -3272,7 +3876,7 @@ var lodash = { exports: {} };
3272
3876
  return result2;
3273
3877
  };
3274
3878
  var getTag = baseGetTag;
3275
- if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set && getTag(new Set()) != setTag || WeakMap2 && getTag(new WeakMap2()) != weakMapTag) {
3879
+ if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap2 && getTag(new WeakMap2()) != weakMapTag) {
3276
3880
  getTag = function(value) {
3277
3881
  var result2 = baseGetTag(value), Ctor = result2 == objectTag ? value.constructor : undefined$1, ctorString = Ctor ? toSource(Ctor) : "";
3278
3882
  if (ctorString) {
@@ -4559,7 +5163,7 @@ var lodash = { exports: {} };
4559
5163
  function isElement(value) {
4560
5164
  return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
4561
5165
  }
4562
- function isEmpty(value) {
5166
+ function isEmpty2(value) {
4563
5167
  if (value == null) {
4564
5168
  return true;
4565
5169
  }
@@ -4814,7 +5418,7 @@ var lodash = { exports: {} };
4814
5418
  function functionsIn(object4) {
4815
5419
  return object4 == null ? [] : baseFunctions(object4, keysIn(object4));
4816
5420
  }
4817
- function get(object4, path, defaultValue) {
5421
+ function get2(object4, path, defaultValue) {
4818
5422
  var result2 = object4 == null ? undefined$1 : baseGet(object4, path);
4819
5423
  return result2 === undefined$1 ? defaultValue : result2;
4820
5424
  }
@@ -5669,7 +6273,7 @@ var lodash = { exports: {} };
5669
6273
  lodash2.forInRight = forInRight;
5670
6274
  lodash2.forOwn = forOwn;
5671
6275
  lodash2.forOwnRight = forOwnRight;
5672
- lodash2.get = get;
6276
+ lodash2.get = get2;
5673
6277
  lodash2.gt = gt;
5674
6278
  lodash2.gte = gte;
5675
6279
  lodash2.has = has;
@@ -5689,7 +6293,7 @@ var lodash = { exports: {} };
5689
6293
  lodash2.isBuffer = isBuffer;
5690
6294
  lodash2.isDate = isDate;
5691
6295
  lodash2.isElement = isElement;
5692
- lodash2.isEmpty = isEmpty;
6296
+ lodash2.isEmpty = isEmpty2;
5693
6297
  lodash2.isEqual = isEqual;
5694
6298
  lodash2.isEqualWith = isEqualWith;
5695
6299
  lodash2.isError = isError;
@@ -5967,6 +6571,516 @@ var lodash = { exports: {} };
5967
6571
  }
5968
6572
  }).call(commonjsGlobal);
5969
6573
  })(lodash, lodash.exports);
6574
+ function useButton(props, ctx) {
6575
+ const ns2 = useNamespace("button");
6576
+ const hasContent = computed(() => ctx.slots.default);
6577
+ const colorMap = {
6578
+ solid: "primary",
6579
+ outline: "secondary",
6580
+ text: "secondary"
6581
+ };
6582
+ const defaultColor = colorMap[props.variant];
6583
+ const buttonGroupConf = inject(buttonGroupInjectionKey, null);
6584
+ const buttonSize = computed(() => {
6585
+ return (buttonGroupConf == null ? void 0 : buttonGroupConf.size.value) || props.size;
6586
+ });
6587
+ const classes = computed(() => ({
6588
+ [ns2.b()]: true,
6589
+ [ns2.m(props.variant)]: true,
6590
+ [`${ns2.m(props.variant)}--${props.color || defaultColor}`]: true,
6591
+ [ns2.m(buttonSize.value)]: true,
6592
+ [ns2.e("icon-wrap")]: props.icon,
6593
+ [ns2.e("icon")]: props.icon && !hasContent.value,
6594
+ [ns2.m("is-loading")]: props.loading,
6595
+ [ns2.m(props.shape || "")]: props.shape && lodash.exports.isString(props.shape) ? true : false
6596
+ }));
6597
+ const iconClass = computed(() => {
6598
+ if (!props.icon) {
6599
+ return "";
6600
+ }
6601
+ const origin = `${ns2.e("icon-fix")} icon`;
6602
+ if (hasContent.value) {
6603
+ return `${origin} clear-right-5`;
6604
+ } else {
6605
+ return origin;
6606
+ }
6607
+ });
6608
+ return { classes, iconClass };
6609
+ }
6610
+ var button = "";
6611
+ var Button = defineComponent({
6612
+ name: "DButton",
6613
+ directives: {
6614
+ dLoading: loadingDirective
6615
+ },
6616
+ props: buttonProps,
6617
+ emits: ["click"],
6618
+ setup(props, ctx) {
6619
+ const {
6620
+ icon: icon2,
6621
+ disabled,
6622
+ loading: loading2
6623
+ } = toRefs(props);
6624
+ const {
6625
+ classes,
6626
+ iconClass
6627
+ } = useButton(props, ctx);
6628
+ const onClick = (e) => {
6629
+ if (loading2.value) {
6630
+ return;
6631
+ }
6632
+ ctx.emit("click", e);
6633
+ };
6634
+ return () => {
6635
+ var _a, _b;
6636
+ return withDirectives(createVNode("button", {
6637
+ "class": classes.value,
6638
+ "disabled": disabled.value,
6639
+ "onClick": onClick
6640
+ }, [icon2.value && createVNode(Icon, {
6641
+ "name": icon2.value,
6642
+ "size": "var(--devui-font-size, 12px)",
6643
+ "color": "",
6644
+ "class": iconClass.value
6645
+ }, null), createVNode("span", {
6646
+ "class": "button-content"
6647
+ }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])]), [[resolveDirective("dLoading"), loading2.value]]);
6648
+ };
6649
+ }
6650
+ });
6651
+ var buttonGroup = "";
6652
+ defineComponent({
6653
+ name: "DButtonGroup",
6654
+ props: buttonGroupProps,
6655
+ setup(props, {
6656
+ slots
6657
+ }) {
6658
+ const ns2 = useNamespace("button-group");
6659
+ provide(buttonGroupInjectionKey, {
6660
+ size: toRef(props, "size")
6661
+ });
6662
+ return () => {
6663
+ return createVNode("div", {
6664
+ "class": ns2.b()
6665
+ }, [slots.default && slots.default()]);
6666
+ };
6667
+ }
6668
+ });
6669
+ var index$1 = "";
6670
+ function deepAssign(...objects) {
6671
+ const isObject2 = (obj) => obj && typeof obj === "object";
6672
+ return objects.reduce((prev, from) => {
6673
+ Object.keys(from).forEach((key) => {
6674
+ const pVal = prev[key];
6675
+ const oVal = from[key];
6676
+ if (Array.isArray(pVal) && Array.isArray(oVal)) {
6677
+ prev[key] = Array.from(/* @__PURE__ */ new Set([...oVal, ...pVal]));
6678
+ } else if (isObject2(pVal) && isObject2(oVal)) {
6679
+ prev[key] = deepAssign(pVal, oVal);
6680
+ } else {
6681
+ prev[key] = oVal;
6682
+ }
6683
+ });
6684
+ return prev;
6685
+ }, {});
6686
+ }
6687
+ var zhCN = {
6688
+ pagination: {
6689
+ totalItemText: "\u6240\u6709\u6761\u76EE",
6690
+ goToText: "\u8DF3\u81F3"
6691
+ },
6692
+ accordion: {
6693
+ loading: "\u52A0\u8F7D\u4E2D",
6694
+ noData: "\u6CA1\u6709\u6570\u636E"
6695
+ },
6696
+ autoCompleteDropdown: {
6697
+ latestInput: "\u6700\u8FD1\u8F93\u5165"
6698
+ },
6699
+ cascaderList: {
6700
+ noData: "\u6CA1\u6709\u6570\u636E"
6701
+ },
6702
+ colorPicker: {
6703
+ foundationPanel: "\u57FA\u7840\u9762\u677F",
6704
+ advancedPanel: "\u9AD8\u7EA7\u9762\u677F"
6705
+ },
6706
+ datePickerPro: {
6707
+ ok: "\u786E\u5B9A",
6708
+ placeholder: "\u8BF7\u9009\u62E9\u65E5\u671F",
6709
+ month1: "1\u6708",
6710
+ month2: "2\u6708",
6711
+ month3: "3\u6708",
6712
+ month4: "4\u6708",
6713
+ month5: "5\u6708",
6714
+ month6: "6\u6708",
6715
+ month7: "7\u6708",
6716
+ month8: "8\u6708",
6717
+ month9: "9\u6708",
6718
+ month10: "10\u6708",
6719
+ month11: "11\u6708",
6720
+ month12: "12\u6708",
6721
+ year: "\u5E74",
6722
+ startPlaceholder: "\u8BF7\u9009\u62E9\u5F00\u59CB\u65E5\u671F",
6723
+ endPlaceholder: "\u8BF7\u9009\u62E9\u7ED3\u675F\u65E5\u671F",
6724
+ getWeekDays() {
6725
+ return ["\u65E5", "\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D"];
6726
+ },
6727
+ getTimeArr() {
6728
+ return ["\u65F6", "\u5206", "\u79D2"];
6729
+ },
6730
+ getYearMonthStr(year, month) {
6731
+ return `${year}\u5E74${month}\u6708`;
6732
+ }
6733
+ },
6734
+ editableSelect: {
6735
+ noRelatedRecords: "\u627E\u4E0D\u5230\u76F8\u5173\u8BB0\u5F55",
6736
+ noData: "\u6CA1\u6709\u6570\u636E"
6737
+ },
6738
+ input: {
6739
+ placeholder: "\u8BF7\u8F93\u5165"
6740
+ },
6741
+ splitterBar: {
6742
+ collapse: "\u6536\u8D77",
6743
+ expand: "\u5C55\u5F00"
6744
+ },
6745
+ stepsGuide: {
6746
+ previous: "\u4E0A\u4E00\u6B65",
6747
+ continue: "\u6211\u77E5\u9053\u5566\uFF0C\u7EE7\u7EED",
6748
+ ok: "\u6211\u77E5\u9053\u5566"
6749
+ },
6750
+ table: {
6751
+ selectAll: "\u5168\u9009",
6752
+ ok: "\u786E\u5B9A"
6753
+ },
6754
+ timePopup: {
6755
+ ok: "\u786E\u5B9A"
6756
+ },
6757
+ transfer: {
6758
+ unit: "\u9879",
6759
+ panelUnit: "\u9879",
6760
+ headerUnit: "\u9879",
6761
+ noData: "\u6682\u65E0\u6570\u636E",
6762
+ placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u8BCD\u641C\u7D22"
6763
+ },
6764
+ tree: {
6765
+ loading: "\u52A0\u8F7D\u4E2D",
6766
+ newNode: "\u65B0\u8282\u70B9",
6767
+ selectPlaceholder: "\u8BF7\u9009\u62E9"
6768
+ },
6769
+ upload: {
6770
+ placeholder: "\u9009\u62E9\u6587\u4EF6",
6771
+ getExistSameNameFilesMsg(sameNames) {
6772
+ return `\u60A8\u4E0A\u4F20\u7684 "${sameNames}" \u5B58\u5728\u91CD\u540D\u6587\u4EF6, \u8BF7\u91CD\u65B0\u9009\u62E9\u6587\u4EF6`;
6773
+ },
6774
+ getAllFilesBeyondMaximalFileSizeMsg(maximalSize) {
6775
+ return `\u6700\u5927\u652F\u6301\u4E0A\u4F20${maximalSize}MB\u7684\u6587\u4EF6, \u60A8\u672C\u6B21\u4E0A\u4F20\u7684\u6240\u6709\u6587\u4EF6\u8D85\u8FC7\u53EF\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F`;
6776
+ },
6777
+ getBeyondMaximalFileSizeMsg(filename, maximalSize) {
6778
+ return `\u6700\u5927\u652F\u6301\u4E0A\u4F20${maximalSize}MB\u7684\u6587\u4EF6, \u60A8\u4E0A\u4F20\u7684\u6587\u4EF6"${filename}"\u8D85\u8FC7\u53EF\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F`;
6779
+ },
6780
+ getNotAllowedFileTypeMsg(filename, scope) {
6781
+ return `\u652F\u6301\u7684\u6587\u4EF6\u7C7B\u578B: "${scope}", \u60A8\u4E0A\u4F20\u7684\u6587\u4EF6"${filename}"\u4E0D\u5728\u5141\u8BB8\u8303\u56F4\u5185\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\u6587\u4EF6`;
6782
+ }
6783
+ },
6784
+ search: {
6785
+ placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u5B57"
6786
+ },
6787
+ select: {
6788
+ placeholder: "\u8BF7\u9009\u62E9",
6789
+ noDataText: "\u65E0\u6570\u636E",
6790
+ noMatchText: "\u627E\u4E0D\u5230\u76F8\u5173\u8BB0\u5F55",
6791
+ loadingText: "\u52A0\u8F7D\u4E2D..."
6792
+ },
6793
+ tagInput: {
6794
+ maxTagsText: "\u5DF2\u8FBE\u5230\u6700\u5927\u4E2A\u6570\uFF1A"
6795
+ },
6796
+ timeSelect: {
6797
+ placeholder: "\u8BF7\u9009\u62E9\u65F6\u95F4"
6798
+ }
6799
+ };
6800
+ const lang = ref("zh-CN");
6801
+ let langMessages = reactive({
6802
+ [lang.value]: zhCN
6803
+ });
6804
+ const Locale = {
6805
+ messages() {
6806
+ return langMessages[lang.value];
6807
+ },
6808
+ lang() {
6809
+ return lang.value;
6810
+ },
6811
+ use(newLang, newMessages2) {
6812
+ lang.value = newLang;
6813
+ this.add({ [newLang]: newMessages2 });
6814
+ },
6815
+ add(newMessages2 = {}) {
6816
+ langMessages = deepAssign(langMessages, newMessages2);
6817
+ }
6818
+ };
6819
+ const camelize = (name) => name.substring(1).replace(/^\S/, (s) => s.toLocaleLowerCase());
6820
+ function get(object4, path) {
6821
+ const keys = path.split(".");
6822
+ let result = object4;
6823
+ keys.forEach((key) => {
6824
+ var _a;
6825
+ result = (_a = result[key]) != null ? _a : "";
6826
+ });
6827
+ return result;
6828
+ }
6829
+ function createI18nTranslate(name, app, newPrefix) {
6830
+ const prefix = newPrefix || camelize(name) + ".";
6831
+ return (path) => {
6832
+ var _a;
6833
+ const messages2 = ((_a = app == null ? void 0 : app.appContext.config.globalProperties.langMessages) == null ? void 0 : _a.value) || Locale.messages();
6834
+ const message = get(messages2, prefix + path) || get(messages2, path);
6835
+ return message;
6836
+ };
6837
+ }
6838
+ function _isSlot(s) {
6839
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
6840
+ }
6841
+ var TimePopup = defineComponent({
6842
+ name: "DTimePopup",
6843
+ components: {
6844
+ TimeList,
6845
+ Button
6846
+ },
6847
+ props: {
6848
+ showPopup: {
6849
+ type: Boolean,
6850
+ default: false
6851
+ },
6852
+ popupTop: {
6853
+ type: Number,
6854
+ default: -100
6855
+ },
6856
+ popupLeft: {
6857
+ type: Number,
6858
+ default: -100
6859
+ },
6860
+ popupWidth: {
6861
+ type: Number,
6862
+ default: 300
6863
+ },
6864
+ popupFormat: {
6865
+ type: String,
6866
+ default: "hh:mm:ss"
6867
+ },
6868
+ minTime: {
6869
+ type: String,
6870
+ default: "00:00:00"
6871
+ },
6872
+ maxTime: {
6873
+ type: String,
6874
+ default: "23:59:59"
6875
+ },
6876
+ bindData: {
6877
+ type: String,
6878
+ default: "00:00:00"
6879
+ }
6880
+ },
6881
+ emits: ["submitData", "change"],
6882
+ setup(props, ctx) {
6883
+ const app = getCurrentInstance();
6884
+ const t = createI18nTranslate("DTimePopup", app);
6885
+ const ns2 = useNamespace("time-popup");
6886
+ const popupDome = ref();
6887
+ const timeListDom = ref();
6888
+ const hourList = initializeTimeData("hour");
6889
+ const minuteList = initializeTimeData("minute");
6890
+ const secondList = initializeTimeData("second");
6891
+ onMounted(() => {
6892
+ setTimeAstrict(hourList, minuteList, secondList, props.minTime, props.maxTime, props.popupFormat);
6893
+ timeListDom.value.setOuterTime(props.bindData);
6894
+ });
6895
+ watch(() => [props.showPopup, props.bindData], ([showPopup, newTimeVal], [, oldTimeVal]) => {
6896
+ if (showPopup || newTimeVal !== oldTimeVal) {
6897
+ timeListDom.value.setOuterTime(newTimeVal);
6898
+ } else {
6899
+ timeListDom.value.resetScrollTop();
6900
+ }
6901
+ });
6902
+ const changTimeData = () => {
6903
+ return timeListDom.value.getNewTime();
6904
+ };
6905
+ const changeData = (value) => {
6906
+ ctx.emit("change", value);
6907
+ };
6908
+ const subDataFun = (e) => {
6909
+ e.stopPropagation();
6910
+ ctx.emit("submitData");
6911
+ };
6912
+ ctx.expose({
6913
+ changTimeData
6914
+ });
6915
+ return () => {
6916
+ var _a, _b;
6917
+ let _slot;
6918
+ return createVNode(Fragment, null, [createVNode("div", {
6919
+ "ref": popupDome,
6920
+ "class": ns2.b(),
6921
+ "style": {
6922
+ width: props.popupWidth + "px"
6923
+ }
6924
+ }, [createVNode(TimeList, {
6925
+ "ref": timeListDom,
6926
+ "hourList": hourList,
6927
+ "minuteList": minuteList,
6928
+ "secondList": secondList,
6929
+ "minTime": props.minTime,
6930
+ "maxTime": props.maxTime,
6931
+ "format": props.popupFormat,
6932
+ "onChange": changeData
6933
+ }, null), createVNode("div", {
6934
+ "class": ns2.m("btn")
6935
+ }, [createVNode("div", {
6936
+ "class": "popup-slots"
6937
+ }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]), createVNode("div", {
6938
+ "onClick": subDataFun
6939
+ }, [createVNode(Button, {
6940
+ "variant": "solid",
6941
+ "color": "secondary",
6942
+ "size": "sm"
6943
+ }, _isSlot(_slot = t("ok")) ? _slot : {
6944
+ default: () => [_slot]
6945
+ })])])])]);
6946
+ };
6947
+ }
6948
+ });
6949
+ const inputProps = {
6950
+ modelValue: {
6951
+ type: String,
6952
+ default: ""
6953
+ },
6954
+ disabled: {
6955
+ type: Boolean,
6956
+ default: false
6957
+ },
6958
+ error: {
6959
+ type: Boolean,
6960
+ default: false
6961
+ },
6962
+ size: {
6963
+ type: String
6964
+ },
6965
+ validateEvent: {
6966
+ type: Boolean,
6967
+ default: true
6968
+ },
6969
+ prefix: {
6970
+ type: String,
6971
+ default: ""
6972
+ },
6973
+ suffix: {
6974
+ type: String,
6975
+ default: ""
6976
+ },
6977
+ showPassword: {
6978
+ type: Boolean,
6979
+ default: false
6980
+ },
6981
+ clearable: {
6982
+ type: Boolean,
6983
+ default: false
6984
+ },
6985
+ placeholder: {
6986
+ type: String,
6987
+ default: ""
6988
+ }
6989
+ };
6990
+ const formItemProps = {
6991
+ label: {
6992
+ type: String
6993
+ },
6994
+ field: {
6995
+ type: String,
6996
+ default: ""
6997
+ },
6998
+ required: {
6999
+ type: Boolean,
7000
+ default: false
7001
+ },
7002
+ messageType: {
7003
+ type: String
7004
+ },
7005
+ popPosition: {
7006
+ type: Array
7007
+ },
7008
+ rules: {
7009
+ type: [Object, Array]
7010
+ },
7011
+ showFeedback: {
7012
+ type: Boolean,
7013
+ default: void 0
7014
+ },
7015
+ helpTips: {
7016
+ type: String,
7017
+ default: ""
7018
+ },
7019
+ feedbackStatus: {
7020
+ type: String
7021
+ },
7022
+ extraInfo: {
7023
+ type: String,
7024
+ default: ""
7025
+ }
7026
+ };
7027
+ const FORM_ITEM_TOKEN = Symbol("dFormItem");
7028
+ const LABEL_DATA = Symbol("labelData");
7029
+ const formProps = {
7030
+ data: {
7031
+ type: Object,
7032
+ default: () => ({})
7033
+ },
7034
+ layout: {
7035
+ type: String,
7036
+ default: "horizontal"
7037
+ },
7038
+ labelSize: {
7039
+ type: String,
7040
+ default: "md"
7041
+ },
7042
+ labelAlign: {
7043
+ type: String,
7044
+ default: "start"
7045
+ },
7046
+ rules: {
7047
+ type: Object
7048
+ },
7049
+ messageType: {
7050
+ type: String,
7051
+ default: "popover"
7052
+ },
7053
+ popPosition: {
7054
+ type: Array,
7055
+ default: ["right", "bottom"]
7056
+ },
7057
+ validateOnRuleChange: {
7058
+ type: Boolean,
7059
+ default: false
7060
+ },
7061
+ showFeedback: {
7062
+ type: Boolean,
7063
+ default: false
7064
+ },
7065
+ disabled: {
7066
+ type: Boolean,
7067
+ default: false
7068
+ },
7069
+ size: {
7070
+ type: String
7071
+ }
7072
+ };
7073
+ const FORM_TOKEN = Symbol("dForm");
7074
+ function useFieldCollection() {
7075
+ const itemContexts = [];
7076
+ const addItemContext = (field) => {
7077
+ itemContexts.push(field);
7078
+ };
7079
+ const removeItemContext = (field) => {
7080
+ itemContexts.splice(itemContexts.indexOf(field), 1);
7081
+ };
7082
+ return { itemContexts, addItemContext, removeItemContext };
7083
+ }
5970
7084
  function useFormValidation(itemContexts) {
5971
7085
  const getValidateFields = (fields) => {
5972
7086
  if (!itemContexts.length) {
@@ -7855,7 +8969,7 @@ var Schema = /* @__PURE__ */ function() {
7855
8969
  complete(results);
7856
8970
  }, source);
7857
8971
  };
7858
- _proto.getType = function getType(rule) {
8972
+ _proto.getType = function getType2(rule) {
7859
8973
  if (rule.type === void 0 && rule.pattern instanceof RegExp) {
7860
8974
  rule.type = "pattern";
7861
8975
  }
@@ -7955,7 +9069,7 @@ function useFormItemValidate(props, _rules) {
7955
9069
  return rule.trigger === triggerVal;
7956
9070
  }
7957
9071
  }).map((_a) => {
7958
- var _b = _a, { trigger } = _b, rule = __objRest(_b, ["trigger"]);
9072
+ var rule = __objRest(_a, []);
7959
9073
  return rule;
7960
9074
  });
7961
9075
  };
@@ -8177,6 +9291,7 @@ function useInputEvent(isFocus, props, ctx, focus) {
8177
9291
  }
8178
9292
  };
8179
9293
  const onInput = (e) => {
9294
+ ctx.emit("input", e.target.value);
8180
9295
  ctx.emit("update:modelValue", e.target.value);
8181
9296
  };
8182
9297
  const onChange = (e) => {
@@ -8209,12 +9324,14 @@ function useInputFunction(input2) {
8209
9324
  return { select, focus, blur };
8210
9325
  }
8211
9326
  var input = "";
8212
- var Input = defineComponent({
9327
+ var DInput = defineComponent({
8213
9328
  name: "DInput",
8214
9329
  inheritAttrs: false,
8215
9330
  props: inputProps,
8216
9331
  emits: ["update:modelValue", "focus", "blur", "input", "change", "keydown", "clear"],
8217
9332
  setup(props, ctx) {
9333
+ const app = getCurrentInstance();
9334
+ const t = createI18nTranslate("DInput", app);
8218
9335
  const formItemContext = inject(FORM_ITEM_TOKEN, void 0);
8219
9336
  const {
8220
9337
  modelValue
@@ -8280,7 +9397,8 @@ var Input = defineComponent({
8280
9397
  "ref": input2,
8281
9398
  "value": modelValue.value,
8282
9399
  "disabled": inputDisabled.value,
8283
- "class": ns2.e("inner")
9400
+ "class": ns2.e("inner"),
9401
+ "placeholder": props.placeholder || t("placeholder")
8284
9402
  }, otherAttrs, {
8285
9403
  "type": props.showPassword ? passwordVisible.value ? "text" : "password" : "text",
8286
9404
  "onInput": onInput,
@@ -8309,742 +9427,121 @@ var Input = defineComponent({
8309
9427
  };
8310
9428
  }
8311
9429
  });
8312
- var iconGroup = "";
8313
- defineComponent({
8314
- name: "DIconGroup",
8315
- setup(_, ctx) {
8316
- const ns2 = useNamespace("icon-group");
8317
- return () => {
8318
- var _a, _b;
8319
- return createVNode("div", {
8320
- "class": ns2.b()
8321
- }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
8322
- };
8323
- }
8324
- });
8325
- const handleCalendarSwitchState = (state, index2, pos, date4) => {
8326
- switch (index2) {
8327
- case 0:
8328
- const preYear = new Date(date4);
8329
- preYear.setFullYear(preYear.getFullYear() - 1);
8330
- pos === 0 ? state.current = preYear : state.next = preYear;
8331
- break;
8332
- case 1:
8333
- const preMonth = new Date(date4);
8334
- preMonth.setMonth(preMonth.getMonth() - 1);
8335
- pos === 0 ? state.current = preMonth : state.next = preMonth;
8336
- break;
8337
- case 2:
8338
- const nextMonth = new Date(date4);
8339
- nextMonth.setMonth(nextMonth.getMonth() + 1);
8340
- pos === 0 ? state.current = nextMonth : state.next = nextMonth;
8341
- break;
8342
- case 3:
8343
- const nextYear = new Date(date4);
8344
- nextYear.setFullYear(nextYear.getFullYear() + 1);
8345
- pos === 0 ? state.current = nextYear : state.next = nextYear;
8346
- break;
8347
- }
8348
- };
8349
- const formatValue = (state, props) => {
8350
- const { format: format2 = "y/MM/dd", range: range3, rangeSpliter = "-" } = props || {};
8351
- if (range3) {
8352
- if (!state.start) {
8353
- return "";
8354
- } else if (!state.end) {
8355
- return formatDate(format2, state.start);
8356
- }
8357
- if (state.end < state.start) {
8358
- const end = state.end;
8359
- state.end = state.start;
8360
- state.start = end;
8361
- }
8362
- return formatRange$1(format2, state.start, state.end, rangeSpliter);
8363
- } else {
8364
- if (!state.start) {
8365
- return "";
8366
- }
8367
- return formatDate(format2, state.start);
8368
- }
8369
- };
8370
- const formatPlaceholder = (props) => {
8371
- if (!props) {
8372
- return "";
8373
- }
8374
- const format2 = props.format || `y/MM/dd`;
8375
- const sp = props.rangeSpliter || "-";
8376
- return props.range ? `${format2} ${sp} ${format2}` : format2;
8377
- };
8378
- const getDateKey = (date4) => {
8379
- return date4.toDateString();
8380
- };
8381
- const cellClassName = (props, day, base = "cell") => {
8382
- if (!betweenDate(day.date, props.dateMin, props.dateMax)) {
8383
- return `${base} disabled`;
8384
- } else if (day.current !== 0) {
8385
- return `${base} not-current`;
8386
- }
8387
- const key = getDateKey(day.date);
8388
- if (props.type === "range") {
8389
- if (props.dateStart) {
8390
- if (getDateKey(props.dateStart) === key) {
8391
- return `${base} selected`;
8392
- }
8393
- if (props.dateEnd && getDateKey(props.dateEnd) === key) {
8394
- return `${base} selected`;
8395
- }
8396
- const innerEnd = props.dateEnd || props.dateHover;
8397
- if (innerEnd) {
8398
- const range3 = innerEnd > props.dateStart ? [props.dateStart, innerEnd] : [innerEnd, props.dateStart];
8399
- if (day.date > range3[0] && day.date < range3[1]) {
8400
- return `${base} innerday`;
8401
- }
8402
- }
8403
- }
8404
- return base;
8405
- } else {
8406
- return props.dateStart && getDateKey(props.dateStart) === key ? `${base} selected` : base;
8407
- }
8408
- };
8409
- const trigEvent = (props, day) => {
8410
- if (!betweenDate(day.date, props.dateMin, props.dateMax)) {
8411
- return;
8412
- }
8413
- if (props.type === "range") {
8414
- if (!props.dateStart) {
8415
- invokeCallback(props.onSelectStart, day.date);
8416
- } else if (!props.dateEnd) {
8417
- if (subDateDay(props.dateStart, day.date) !== 0) {
8418
- invokeCallback(props.onSelectEnd, day.date);
8419
- typeof props.onChange === "function" && props.onChange(props.type, props);
8420
- }
8421
- } else {
8422
- invokeCallback(props.onReset, day.date);
8423
- }
8424
- } else {
8425
- invokeCallback(props.onSelected, day.date);
8426
- typeof props.onChange === "function" && props.onChange(props.type, props);
8427
- }
8428
- };
8429
- const handleDateEnter = (props, day) => {
8430
- if (day.current !== 0) {
8431
- return;
8432
- }
8433
- const { dateMin, dateMax } = props;
8434
- if (dateMin && subDateDay(day.date, dateMin) < 0) {
8435
- return;
8436
- }
8437
- if (dateMax && subDateDay(dateMax, day.date) < 0) {
8438
- return;
8439
- }
8440
- if (props.type === "range") {
8441
- const key = getDateKey(day.date);
8442
- if (!props.dateStart || getDateKey(props.dateStart) === key || props.dateEnd) {
8443
- return;
8444
- }
8445
- invokeCallback(props.onSelecting, day.date);
8446
- }
8447
- };
8448
- const Year = (props) => {
8449
- const {
8450
- color = "#585d6b",
8451
- rotate = 0
8452
- } = props;
8453
- return createVNode("svg", {
8454
- "style": {
8455
- transform: `rotate(${rotate}deg)`
8456
- },
8457
- "width": "10px",
8458
- "height": "10px",
8459
- "viewBox": "0 0 10 10",
8460
- "version": "1.1",
8461
- "xmlns": "http://www.w3.org/2000/svg"
8462
- }, [createVNode("g", {
8463
- "fill": color,
8464
- "transform": "translate(-1.000000, -1.000000)"
8465
- }, [createVNode("path", {
8466
- "d": "M11,1.83333333 L11,10.1666667 L7,7.38833333 L7,10.1666667 L1,6 L7,1.83333333 L7,4.61033333 L11,1.83333333 Z"
8467
- }, null)])]);
8468
- };
8469
- const Month = (props) => {
8470
- const {
8471
- color = "#585d6b",
8472
- rotate = 0
8473
- } = props;
8474
- return createVNode("svg", {
8475
- "style": {
8476
- transform: `rotate(${rotate}deg)`
8477
- },
8478
- "width": "6px",
8479
- "height": "10px",
8480
- "viewBox": "0 0 6 10",
8481
- "version": "1.1",
8482
- "xmlns": "http://www.w3.org/2000/svg"
8483
- }, [createVNode("g", {
8484
- "fill": color,
8485
- "transform": "translate(-3.000000, -1.000000)"
8486
- }, [createVNode("polygon", {
8487
- "points": "6 3 10.1666667 9 1.83333333 9"
8488
- }, null)])]);
8489
- };
8490
- var index$6 = "";
8491
- const Item = (props) => {
8492
- const {
8493
- button: Btn,
8494
- disabled = false,
8495
- rotate = 0,
8496
- date: date4,
8497
- pos
8498
- } = props;
8499
- const color = disabled ? "#cfd0d3" : "#585d6b";
8500
- const className = `${disabled ? "disabled" : ""}`;
8501
- const handleClick = disabled ? void 0 : () => invokeCallback(props.cb, date4, pos);
8502
- return createVNode("a", {
8503
- "class": className,
8504
- "onClick": handleClick
8505
- }, [createVNode(Btn, {
8506
- "color": color,
8507
- "rotate": rotate
8508
- }, null)]);
8509
- };
8510
- const Title = (props) => {
8511
- const {
8512
- date: date4
8513
- } = props;
8514
- return createVNode("a", {
8515
- "class": "title"
8516
- }, [`${date4.getFullYear()}\u5E74${(date4.getMonth() + 1 + "").padStart(2, "0")}\u6708`]);
8517
- };
8518
- const CalendarToolbar = (props) => {
8519
- const {
8520
- type: type4,
8521
- current,
8522
- compare,
8523
- pos,
8524
- dateMax,
8525
- dateMin,
8526
- onPreviousYear,
8527
- onPreviousMonth,
8528
- onNextMonth,
8529
- onNextYear
8530
- } = props;
8531
- const dis = [false, false, false, false];
8532
- if (type4 === "range") {
8533
- if (pos === 1) {
8534
- dis[0] = !compareDate(compare, current, "year", 1);
8535
- dis[1] = !compareDate(compare, current, "month", 1);
8536
- dis[2] = !compareDate(current, dateMax, "month", 0);
8537
- dis[3] = !compareDate(current, dateMax, "year", 0);
8538
- } else {
8539
- dis[0] = !compareDate(dateMin, current, "year", 0);
8540
- dis[1] = !compareDate(dateMin, current, "month", 0);
8541
- dis[2] = !compareDate(current, compare, "month", 1);
8542
- dis[3] = !compareDate(current, compare, "year", 1);
8543
- }
8544
- } else {
8545
- dis[0] = !compareDate(dateMin, current, "year", 0);
8546
- dis[1] = !compareDate(dateMin, current, "month", 0);
8547
- dis[2] = !compareDate(current, dateMax, "month", 0);
8548
- dis[3] = !compareDate(current, dateMax, "year", 0);
8549
- }
8550
- return createVNode("div", {
8551
- "class": "devui-calendar-toolbar"
8552
- }, [createVNode(Item, {
8553
- "disabled": dis[0],
8554
- "date": current,
8555
- "pos": pos,
8556
- "button": Year,
8557
- "cb": onPreviousYear
8558
- }, null), createVNode(Item, {
8559
- "disabled": dis[1],
8560
- "date": current,
8561
- "pos": pos,
8562
- "button": Month,
8563
- "rotate": -90,
8564
- "cb": onPreviousMonth
8565
- }, null), createVNode(Title, {
8566
- "date": current
8567
- }, null), createVNode(Item, {
8568
- "disabled": dis[2],
8569
- "date": current,
8570
- "pos": pos,
8571
- "button": Month,
8572
- "rotate": 90,
8573
- "cb": onNextMonth
8574
- }, null), createVNode(Item, {
8575
- "disabled": dis[3],
8576
- "date": current,
8577
- "pos": pos,
8578
- "button": Year,
8579
- "rotate": 180,
8580
- "cb": onNextYear
8581
- }, null)]);
8582
- };
8583
- const TodayDefault = (props) => {
8584
- const {
8585
- onSelected = () => 0,
8586
- disabled = false
8587
- } = props;
8588
- return createVNode("div", {
8589
- "class": `today-container ${disabled ? "disabled" : ""}`
8590
- }, [createVNode("button", {
8591
- "class": "today-button",
8592
- "disabled": disabled,
8593
- "onClick": disabled ? void 0 : () => onSelected(new Date())
8594
- }, [createTextVNode("\u4ECA\u5929")])]);
8595
- };
8596
- var index$5 = "";
8597
- const CalendarDatePanel = (props) => {
8598
- const today = new Date();
8599
- return createVNode("div", {
8600
- "class": "devui-calendar-panel"
8601
- }, [createVNode(CalendarToolbar, {
8602
- "current": props.current,
8603
- "compare": props.compare,
8604
- "pos": props.pos,
8605
- "type": props.type,
8606
- "showTime": props.showTime,
8607
- "onPreviousYear": props.onPreviousYear,
8608
- "onPreviousMonth": props.onPreviousMonth,
8609
- "onNextMonth": props.onNextMonth,
8610
- "onNextYear": props.onNextYear,
8611
- "dateMax": props.dateMax,
8612
- "dateMin": props.dateMin
8613
- }, null), createVNode("ol", {
8614
- "class": "head row"
8615
- }, [WEEK_DAYS.map((day) => createVNode("li", {
8616
- "class": "cell"
8617
- }, [day]))]), createVNode("ul", {
8618
- "class": "body"
8619
- }, [getMonthWeeklyDays(props.current).map((row) => createVNode("li", {
8620
- "class": "row"
8621
- }, [row.map((day) => {
8622
- return createVNode("span", {
8623
- "class": cellClassName(props, day),
8624
- "onClick": () => trigEvent(props, day),
8625
- "onMouseenter": () => handleDateEnter(props, day)
8626
- }, [day.date.getDate()]);
8627
- })]))]), props.type !== "range" ? createVNode(TodayDefault, {
8628
- "disabled": !betweenDate(today, props.dateMin, props.dateMax),
8629
- "onSelected": (today2) => {
8630
- typeof props.onToday === "function" && props.onToday(today2, 0);
8631
- }
8632
- }, null) : null]);
8633
- };
8634
- var index$4 = "";
8635
- const VerticalSlider = defineComponent({
8636
- props: {
8637
- size: {
8638
- type: Number,
8639
- default: 26
8640
- },
8641
- items: {
8642
- type: Array
8643
- },
8644
- selectedIndex: {
8645
- type: Number
8646
- },
8647
- className: {
8648
- type: String
8649
- },
8650
- itemClassNormal: {
8651
- type: String
8652
- },
8653
- itemClassSelected: {
8654
- type: String
8655
- },
8656
- onChange: {
8657
- type: Function
8658
- }
9430
+ var timePicker = "";
9431
+ var TimePicker = defineComponent({
9432
+ name: "DTimePicker",
9433
+ components: {
9434
+ TimePopup,
9435
+ DInput
8659
9436
  },
8660
- setup(props) {
9437
+ props: timePickerProps,
9438
+ emits: ["change", "update:modelValue"],
9439
+ setup(props, ctx) {
9440
+ const ns2 = useNamespace("time-picker");
9441
+ const activeHour = ref("00");
9442
+ const activeMinute = ref("00");
9443
+ const activeSecond = ref("00");
9444
+ const format2 = props.format.toLowerCase();
9445
+ const position = ref(["bottom-start", "top-start"]);
8661
9446
  const {
8662
- items = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
8663
- selectedIndex = 0,
8664
- size = 26,
8665
- className = "",
8666
- itemClassNormal = "",
8667
- itemClassSelected = "selected",
8668
- onChange
8669
- } = props || {};
8670
- let max_y = 0, min_y = 0;
8671
- const container = ref();
8672
- const movbar = ref();
8673
- let pos_start = null;
8674
- let pos_cache = null;
8675
- const state = reactive({
8676
- selectedIndex,
8677
- barOpacity: 0,
8678
- x: 0,
8679
- y: 0,
8680
- transition: "none"
8681
- });
8682
- const handleMouseDown = (e) => {
8683
- e.stopPropagation();
8684
- e.preventDefault();
8685
- pos_start = [e.clientX, e.clientY];
8686
- state.transition = "none";
8687
- };
8688
- const handleMouseMove = (e) => {
8689
- e.stopPropagation();
8690
- e.preventDefault();
8691
- if (!pos_start || !pos_cache) {
8692
- return;
8693
- }
8694
- state.x = pos_cache[0] + e.clientX - pos_start[0];
8695
- state.y = Math.min(max_y, Math.max(min_y, pos_cache[1] + e.clientY - pos_start[1]));
8696
- state.selectedIndex = (max_y - state.y + size / 2) / size >> 0;
8697
- };
8698
- const handleMouseUp = (e) => {
8699
- e.stopPropagation();
8700
- e.preventDefault();
8701
- pos_start = null;
8702
- state.y = max_y - state.selectedIndex * size;
8703
- state.transition = "transform 0.1s";
8704
- pos_cache[0] = state.x;
8705
- pos_cache[1] = state.y;
8706
- if (typeof onChange === "function") {
8707
- const idx = state.selectedIndex;
8708
- const val = items[idx];
8709
- onChange(val, idx);
8710
- }
9447
+ showPopup,
9448
+ trueTimeValue,
9449
+ devuiTimePicker,
9450
+ inputDom,
9451
+ overlayRef,
9452
+ showClearIcon,
9453
+ firsthandActiveTime,
9454
+ chooseTime,
9455
+ clickVerifyFun,
9456
+ isOutOpen,
9457
+ clearAll,
9458
+ timePopupDom,
9459
+ vModeValue,
9460
+ changeTimeData
9461
+ } = useTimePicker(activeHour, activeMinute, activeSecond, format2, props);
9462
+ const selectedTimeChange = () => {
9463
+ showPopup.value = false;
9464
+ ctx.emit("change", trueTimeValue.value);
8711
9465
  };
8712
9466
  onMounted(() => {
8713
- const {
8714
- height: ch
8715
- } = container.value.getBoundingClientRect();
8716
- const {
8717
- height: mh
8718
- } = movbar.value.getBoundingClientRect();
8719
- max_y = (ch - size) / 2;
8720
- min_y = (ch + size) / 2 - mh;
8721
- pos_cache = [0, max_y - state.selectedIndex * size];
8722
- state.x = pos_cache[0];
8723
- state.y = pos_cache[1];
8724
- state.barOpacity = 1;
8725
- state.transition = "transform 0.1s";
8726
- });
8727
- return () => {
8728
- return createVNode("div", {
8729
- "ref": container,
8730
- "class": `devui-vertical-slider ${className}`
8731
- }, [createVNode("div", {
8732
- "ref": movbar,
8733
- "class": "movable-bar",
8734
- "style": {
8735
- opacity: state.barOpacity,
8736
- transform: `translateY(${state.y}px)`,
8737
- transition: state.transition
8738
- }
8739
- }, [items.map((c, i) => {
8740
- const className2 = i === state.selectedIndex ? itemClassSelected : itemClassNormal;
8741
- return createVNode("span", {
8742
- "class": `slider-item ${className2}`,
8743
- "style": {
8744
- height: `${size}px`,
8745
- lineHeight: `${size}px`
8746
- }
8747
- }, [c]);
8748
- })]), createVNode("div", {
8749
- "class": "slider-mask",
8750
- "onMousedown": handleMouseDown,
8751
- "onMousemove": handleMouseMove,
8752
- "onMouseup": handleMouseUp,
8753
- "onMouseout": handleMouseUp
8754
- }, null)]);
8755
- };
8756
- }
8757
- });
8758
- var index$3 = "";
8759
- const TimePicker = defineComponent({
8760
- props: {
8761
- time: {
8762
- type: Date
8763
- }
8764
- },
8765
- setup(props) {
8766
- const {
8767
- time = new Date()
8768
- } = props || {};
8769
- const state = reactive({
8770
- hour: time.getHours(),
8771
- minute: time.getMinutes(),
8772
- second: time.getSeconds()
8773
- });
8774
- const hours = Array(24).fill(0).map((_, i) => `${i}`.padStart(2, "0"));
8775
- const minutes = Array(60).fill(0).map((_, i) => `${i}`.padStart(2, "0"));
8776
- return () => {
8777
- return createVNode("div", {
8778
- "class": "devui-calendar-timepicker"
8779
- }, [createVNode("div", {
8780
- "class": "head"
8781
- }, [createVNode("div", {
8782
- "class": "chars"
8783
- }, [createVNode("span", null, [state.hour.toString().padStart(2, "0"), createTextVNode(":"), state.minute.toString().padStart(2, "0"), createTextVNode(":"), state.second.toString().padStart(2, "0")])])]), createVNode("div", {
8784
- "class": "select"
8785
- }, [createVNode(VerticalSlider, {
8786
- "items": hours,
8787
- "selectedIndex": state.hour,
8788
- "onChange": (_, idx) => state.hour = idx
8789
- }, null), createVNode(VerticalSlider, {
8790
- "items": minutes,
8791
- "selectedIndex": state.minute,
8792
- "onChange": (_, idx) => state.minute = idx
8793
- }, null), createVNode(VerticalSlider, {
8794
- "items": minutes,
8795
- "selectedIndex": state.second,
8796
- "onChange": (_, idx) => state.second = idx
8797
- }, null)])]);
8798
- };
8799
- }
8800
- });
8801
- var index$2 = "";
8802
- const Calendar = (props) => {
8803
- const {
8804
- showTime = false
8805
- } = props;
8806
- let {
8807
- current
8808
- } = props;
8809
- if (!(current instanceof Date)) {
8810
- current = new Date();
8811
- }
8812
- if (props.type === "range") {
8813
- let {
8814
- next
8815
- } = props;
8816
- if (!(next instanceof Date)) {
8817
- next = new Date(current.getFullYear(), current.getMonth() + 1, 1);
8818
- }
8819
- return createVNode("div", {
8820
- "class": "devui-calendar-container"
8821
- }, [createVNode(CalendarDatePanel, mergeProps(props, {
8822
- "pos": 0,
8823
- "current": current,
8824
- "compare": next
8825
- }), null), showTime ? createVNode(TimePicker, {
8826
- "time": current
8827
- }, null) : null, createVNode(CalendarDatePanel, mergeProps(props, {
8828
- "pos": 1,
8829
- "current": next,
8830
- "compare": current
8831
- }), null), showTime ? createVNode(TimePicker, {
8832
- "time": next
8833
- }, null) : null]);
8834
- } else {
8835
- return createVNode("div", {
8836
- "class": "devui-calendar-container"
8837
- }, [createVNode(CalendarDatePanel, mergeProps(props, {
8838
- "pos": 0,
8839
- "current": current
8840
- }), null), showTime ? createVNode(TimePicker, {
8841
- "time": current
8842
- }, null) : null]);
8843
- }
8844
- };
8845
- var datePicker = "";
8846
- const formatRange = (state) => {
8847
- const [start, end] = [state.start, state.end].sort((a, b) => a.getTime() - b.getTime());
8848
- state.start = start;
8849
- state.end = end;
8850
- if (compareDateSort(start, end, "m") !== 0) {
8851
- state.current = start;
8852
- state.next = end;
8853
- } else {
8854
- if (compareDateSort(start, state.current) < 0) {
8855
- state.current = start;
8856
- }
8857
- if (compareDateSort(state.next, end) < 0) {
8858
- state.next = end;
8859
- }
8860
- }
8861
- };
8862
- var DatePicker = defineComponent({
8863
- name: "DDatepicker",
8864
- props: {
8865
- selectedDateChange: {
8866
- type: Function
8867
- },
8868
- autoClose: {
8869
- type: Boolean,
8870
- default: false
8871
- },
8872
- range: {
8873
- type: Boolean,
8874
- default: false
8875
- },
8876
- showTime: {
8877
- type: Boolean,
8878
- default: false
8879
- },
8880
- format: {
8881
- type: String,
8882
- default: "y/MM/dd"
8883
- },
8884
- rangeSpliter: {
8885
- type: String,
8886
- default: "-"
8887
- },
8888
- attachInputDom: {
8889
- type: String
8890
- },
8891
- dateMin: {
8892
- type: String
8893
- },
8894
- dateMax: {
8895
- type: String
8896
- }
8897
- },
8898
- setup(props) {
8899
- const panel = ref(null);
8900
- const input2 = ref(null);
8901
- const current = parseDate(props.dateMin) || new Date();
8902
- const next = new Date(current.getFullYear(), current.getMonth() + 1, 1);
8903
- const state = reactive({
8904
- show: false,
8905
- value: "",
8906
- placeholder: formatPlaceholder(props),
8907
- current,
8908
- next
9467
+ isOutOpen();
8909
9468
  });
8910
- state.value = formatValue(state, props);
8911
- state.placeholder = formatPlaceholder(props);
8912
- const documentClick = (e) => {
8913
- e.stopPropagation();
8914
- if (isIn(e.target, panel.value) || isIn(e.target, input2.value)) {
8915
- return;
9469
+ watch(trueTimeValue, (newValue) => {
9470
+ ctx.emit("update:modelValue", trueTimeValue.value);
9471
+ if (newValue !== props.minTime && newValue !== "00:00") {
9472
+ showClearIcon.value = true;
9473
+ } else {
9474
+ showClearIcon.value = false;
8916
9475
  }
8917
- state.show = false;
8918
- };
8919
- onMounted(() => {
8920
- document.addEventListener("click", documentClick);
8921
- });
8922
- onUnmounted(() => {
8923
- document.removeEventListener("click", documentClick);
8924
9476
  });
8925
- return () => {
8926
- return createVNode("div", {
8927
- "class": "devui-datepicker-container"
8928
- }, [createVNode("div", {
8929
- "class": "input-container",
8930
- "ref": input2
8931
- }, [createVNode(Input, {
8932
- "ref": input2,
8933
- "class": "datepicker-input",
8934
- "modelValue": state.value,
8935
- "placeholder": state.placeholder,
8936
- "onFocus": () => state.show = true
8937
- }, null), createVNode(Icon, {
8938
- "size": "small",
8939
- "name": "calendar",
8940
- "class": "datepicker-input-icon"
8941
- }, null)]), createVNode("div", {
8942
- "class": "devui-datepicker-panel",
8943
- "ref": panel
8944
- }, [state.show ? createVNode(Calendar, {
8945
- "type": props.range ? "range" : "select",
8946
- "showTime": props.showTime,
8947
- "current": state.current,
8948
- "next": state.next,
8949
- "dateMin": parseDate(props.dateMin),
8950
- "dateMax": parseDate(props.dateMax),
8951
- "dateStart": state.start,
8952
- "dateEnd": state.end,
8953
- "dateHover": state.hover,
8954
- "onReset": (date4) => {
8955
- state.end = state.hover = void 0;
8956
- state.start = date4;
8957
- },
8958
- "onChange": () => {
8959
- state.value = formatValue(state, props);
8960
- state.placeholder = formatPlaceholder(props);
8961
- invokeFunction(props.selectedDateChange, state.value);
8962
- if (props.autoClose) {
8963
- state.show = false;
8964
- }
8965
- },
8966
- "onToday": (date4) => {
8967
- state.current = date4;
8968
- state.start = date4;
8969
- state.value = formatValue(state, props);
8970
- state.placeholder = formatPlaceholder(props);
8971
- invokeFunction(props.selectedDateChange, state.value);
8972
- if (props.autoClose) {
8973
- state.show = false;
8974
- }
8975
- },
8976
- "onSelected": (date4) => {
8977
- state.start = date4;
8978
- if (compareDateSort(state.current, date4) !== 0) {
8979
- state.current = date4;
8980
- }
8981
- },
8982
- "onSelectStart": (date4) => state.start = date4,
8983
- "onSelectEnd": (date4) => {
8984
- state.end = date4;
8985
- formatRange(state);
8986
- },
8987
- "onSelecting": (date4) => state.hover = date4,
8988
- "onPreviousYear": (date4, pos) => handleCalendarSwitchState(state, 0, pos, date4),
8989
- "onPreviousMonth": (date4, pos) => handleCalendarSwitchState(state, 1, pos, date4),
8990
- "onNextMonth": (date4, pos) => handleCalendarSwitchState(state, 2, pos, date4),
8991
- "onNextYear": (date4, pos) => handleCalendarSwitchState(state, 3, pos, date4)
8992
- }, null) : null])]);
8993
- };
8994
- }
8995
- });
8996
- var index$1 = "";
8997
- const StickSlider = defineComponent({
8998
- name: "DStickSlider",
8999
- props: {},
9000
- setup() {
9001
- const state = reactive({
9002
- showButtons: false,
9003
- selectedIndex: 0
9477
+ ctx.expose({
9478
+ clearAll,
9479
+ chooseTime
9004
9480
  });
9005
- const reset = () => {
9006
- state.showButtons = false;
9007
- };
9008
- const handleMainButtonMouseDown = (e) => {
9009
- e.stopPropagation();
9010
- state.showButtons = true;
9011
- };
9012
- const handleMainButtonMouseUp = (e) => {
9013
- e.stopPropagation();
9014
- reset();
9015
- };
9016
9481
  return () => {
9017
9482
  return createVNode("div", {
9018
- "class": "devui-stick-slider",
9019
- "onMousedown": handleMainButtonMouseDown,
9020
- "onMouseup": handleMainButtonMouseUp,
9021
- "onMouseleave": handleMainButtonMouseUp
9483
+ "class": ns2.b(),
9484
+ "ref": devuiTimePicker
9022
9485
  }, [createVNode("div", {
9023
- "class": "sub-buttons",
9024
- "style": {
9025
- display: state.showButtons ? "" : "none"
9026
- }
9027
- }, [Array(16).fill(null).map((_, i) => {
9028
- return createVNode("div", {
9029
- "class": `button ${i === state.selectedIndex ? "selected" : ""}`,
9030
- "onMouseenter": () => state.selectedIndex = i
9031
- }, [i]);
9032
- })]), createVNode("div", {
9033
- "class": "main-button"
9034
- }, null)]);
9486
+ "ref": inputDom
9487
+ }, [createVNode(DInput, {
9488
+ "modelValue": vModeValue.value,
9489
+ "placeholder": props.placeholder,
9490
+ "disabled": props.disabled,
9491
+ "readonly": props.readonly,
9492
+ "size": props.size,
9493
+ "onFocus": clickVerifyFun
9494
+ }, {
9495
+ suffix: () => createVNode("span", {
9496
+ "class": "time-input-icon"
9497
+ }, [createVNode("span", {
9498
+ "onClick": clearAll,
9499
+ "class": "clear-button"
9500
+ }, [showClearIcon.value ? createVNode(Icon, {
9501
+ "size": "small",
9502
+ "name": "close"
9503
+ }, null) : ""]), createVNode(Icon, {
9504
+ "size": "small",
9505
+ "name": "time"
9506
+ }, null)])
9507
+ })]), createVNode(Transition, {
9508
+ "name": "fade"
9509
+ }, {
9510
+ default: () => [createVNode(FlexibleOverlay, {
9511
+ "modelValue": showPopup.value,
9512
+ "onUpdate:modelValue": ($event) => showPopup.value = $event,
9513
+ "ref": overlayRef,
9514
+ "origin": inputDom.value,
9515
+ "position": position.value,
9516
+ "align": "start"
9517
+ }, {
9518
+ default: () => [createVNode(TimePopup, {
9519
+ "ref": timePopupDom,
9520
+ "showPopup": showPopup.value,
9521
+ "popupWidth": props.timePickerWidth,
9522
+ "popupFormat": props.format.toLowerCase(),
9523
+ "minTime": props.minTime,
9524
+ "maxTime": props.maxTime,
9525
+ "bindData": firsthandActiveTime.value,
9526
+ "onSubmitData": selectedTimeChange,
9527
+ "onChange": changeTimeData
9528
+ }, {
9529
+ default: () => {
9530
+ var _a, _b;
9531
+ return [(_b = (_a = ctx.slots).customViewTemplate) == null ? void 0 : _b.call(_a)];
9532
+ }
9533
+ })]
9534
+ })]
9535
+ })]);
9035
9536
  };
9036
9537
  }
9037
9538
  });
9038
- DatePicker.install = function(app) {
9039
- app.component(DatePicker.name, DatePicker);
9040
- app.component(StickSlider.name, StickSlider);
9041
- };
9042
9539
  var index = {
9043
- title: "DatePicker \u65E5\u671F\u9009\u62E9\u5668",
9540
+ title: "TimePicker \u65F6\u95F4\u9009\u62E9\u5668",
9044
9541
  category: "\u6570\u636E\u5F55\u5165",
9045
- status: "50%",
9542
+ status: "100%",
9046
9543
  install(app) {
9047
- app.use(DatePicker);
9544
+ app.component(TimePicker.name, TimePicker);
9048
9545
  }
9049
9546
  };
9050
- export { DatePicker, StickSlider, index as default };
9547
+ export { TimePicker, index as default };