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

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 (94) hide show
  1. package/README.md +2 -2
  2. package/auto-complete/index.es.js +29 -8
  3. package/auto-complete/index.umd.js +16 -16
  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 +3 -2
  8. package/button/index.umd.js +6 -6
  9. package/collapse/index.es.js +20 -186
  10. package/collapse/index.umd.js +1 -1
  11. package/collapse/style.css +1 -1
  12. package/countdown/index.es.js +56 -13
  13. package/countdown/index.umd.js +1 -1
  14. package/{date-picker → date-picker-pro}/index.d.ts +0 -0
  15. package/date-picker-pro/index.es.js +10856 -0
  16. package/date-picker-pro/index.umd.js +27 -0
  17. package/date-picker-pro/package.json +7 -0
  18. package/date-picker-pro/style.css +1 -0
  19. package/dropdown/index.es.js +1 -1
  20. package/dropdown/index.umd.js +1 -1
  21. package/editable-select/index.es.js +98 -56
  22. package/editable-select/index.umd.js +1 -1
  23. package/editable-select/style.css +1 -1
  24. package/icon/index.es.js +3 -2
  25. package/icon/index.umd.js +1 -1
  26. package/input/index.es.js +35 -8
  27. package/input/index.umd.js +7 -7
  28. package/input/style.css +1 -1
  29. package/modal/index.es.js +3 -2
  30. package/modal/index.umd.js +1 -1
  31. package/modal/style.css +1 -1
  32. package/notification/index.es.js +3 -2
  33. package/notification/index.umd.js +1 -1
  34. package/nuxt/components/DRangeDatePickerPro.js +3 -0
  35. package/nuxt/components/DatePickerPro.js +3 -0
  36. package/nuxt/components/OptionGroup.js +3 -0
  37. package/nuxt/components/Step.js +3 -0
  38. package/nuxt/components/Steps.js +3 -0
  39. package/nuxt/components/TimePicker.js +3 -0
  40. package/nuxt/components/datePickerProCommonProps.js +3 -0
  41. package/nuxt/components/datePickerProPanelProps.js +3 -0
  42. package/nuxt/components/datePickerProProps.js +3 -0
  43. package/nuxt/components/stepProps.js +3 -0
  44. package/nuxt/components/stepsProps.js +3 -0
  45. package/nuxt/components/timerPickerPanelProps.js +3 -0
  46. package/package.json +1 -1
  47. package/pagination/index.es.js +25 -7
  48. package/pagination/index.umd.js +1 -1
  49. package/result/index.es.js +3 -2
  50. package/result/index.umd.js +1 -1
  51. package/search/index.es.js +39 -10
  52. package/search/index.umd.js +7 -7
  53. package/search/style.css +1 -1
  54. package/select/index.es.js +156 -219
  55. package/select/index.umd.js +13 -13
  56. package/select/style.css +1 -1
  57. package/splitter/index.es.js +27 -7
  58. package/splitter/index.umd.js +10 -10
  59. package/steps/index.d.ts +7 -0
  60. package/steps/index.es.js +385 -0
  61. package/steps/index.umd.js +1 -0
  62. package/{date-picker → steps}/package.json +1 -1
  63. package/steps/style.css +1 -0
  64. package/style.css +1 -1
  65. package/table/index.es.js +542 -267
  66. package/table/index.umd.js +15 -15
  67. package/table/style.css +1 -1
  68. package/tabs/index.es.js +1 -1
  69. package/tabs/index.umd.js +1 -1
  70. package/tabs/style.css +1 -1
  71. package/time-picker/index.d.ts +7 -0
  72. package/{date-picker → time-picker}/index.es.js +1371 -1038
  73. package/time-picker/index.umd.js +27 -0
  74. package/time-picker/package.json +7 -0
  75. package/time-picker/style.css +1 -0
  76. package/time-select/index.es.js +157 -219
  77. package/time-select/index.umd.js +14 -14
  78. package/time-select/style.css +1 -1
  79. package/timeline/index.es.js +3 -2
  80. package/timeline/index.umd.js +1 -1
  81. package/tooltip/index.es.js +1 -1
  82. package/tooltip/index.umd.js +1 -1
  83. package/tree/index.es.js +186 -59
  84. package/tree/index.umd.js +16 -16
  85. package/tree/style.css +1 -1
  86. package/upload/index.es.js +51 -25
  87. package/upload/index.umd.js +1 -1
  88. package/upload/style.css +1 -1
  89. package/vue-devui.es.js +3963 -1421
  90. package/vue-devui.umd.js +23 -23
  91. package/date-picker/index.umd.js +0 -27
  92. package/date-picker/style.css +0 -1
  93. package/nuxt/components/DatePicker.js +0 -3
  94. 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
- }
32
+ var __publicField = (obj, key, value) => {
33
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
34
+ return value;
88
35
  };
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;
208
- };
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 = {
@@ -395,6 +245,7 @@ function useIconDom(props, ctx) {
395
245
  var Icon = defineComponent({
396
246
  name: "DIcon",
397
247
  props: iconProps,
248
+ emits: ["click"],
398
249
  setup(props, ctx) {
399
250
  const {
400
251
  disabled,
@@ -410,10 +261,10 @@ var Icon = defineComponent({
410
261
  [ns2.m("operable")]: operable.value
411
262
  }));
412
263
  const onClick = (e) => {
413
- e.stopImmediatePropagation();
414
264
  if (disabled.value) {
415
- e.preventDefault();
265
+ return;
416
266
  }
267
+ ctx.emit("click", e);
417
268
  };
418
269
  return () => {
419
270
  var _a, _b, _c, _d;
@@ -424,115 +275,861 @@ var Icon = defineComponent({
424
275
  };
425
276
  }
426
277
  });
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
278
+ var iconGroup = "";
279
+ defineComponent({
280
+ name: "DIconGroup",
281
+ setup(_, ctx) {
282
+ const ns2 = useNamespace("icon-group");
283
+ return () => {
284
+ var _a, _b;
285
+ return createVNode("div", {
286
+ "class": ns2.b()
287
+ }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
288
+ };
289
+ }
290
+ });
291
+ function useTimePicker(hh, mm, ss, format2, props) {
292
+ const showPopup = ref(false);
293
+ const devuiTimePicker = ref();
294
+ const inputDom = ref();
295
+ const overlayRef = ref();
296
+ const timePopupDom = ref();
297
+ const timePickerValue = ref("");
298
+ const showClearIcon = ref(false);
299
+ const firsthandActiveTime = ref(`${hh.value}:${mm.value}:${ss.value}`);
300
+ const vModeValue = ref(props.modelValue);
301
+ const formatTime = () => {
302
+ let modelValue = vModeValue.value || "00:00:00";
303
+ if (["hh:mm", "mm:ss"].includes(format2)) {
304
+ modelValue = vModeValue.value || "00:00";
305
+ }
306
+ const timeArr = modelValue.split(":");
307
+ let trueValue = "00:00:00";
308
+ if (format2 === "hh:mm:ss") {
309
+ trueValue = modelValue;
310
+ } else if (format2 === "mm:hh:ss") {
311
+ trueValue = `${timeArr[1]}:${timeArr[0]}:${timeArr[2]}`;
312
+ } else if (format2 === "hh:mm") {
313
+ trueValue = `${timeArr[0]}:${timeArr[1]}:${ss.value}`;
314
+ } else if (format2 === "mm:ss") {
315
+ trueValue = `${hh.value}:${timeArr[0]}:${timeArr[1]}`;
316
+ }
317
+ return trueValue;
318
+ };
319
+ const trueTimeValue = computed(() => {
320
+ return formatTime();
321
+ });
322
+ const setInputValue = (h2, m, s) => {
323
+ if (format2 === "hh:mm:ss") {
324
+ vModeValue.value = `${h2}:${m}:${s}`;
325
+ } else if (format2 === "mm:hh:ss") {
326
+ vModeValue.value = `${m}:${h2}:${s}`;
327
+ } else if (format2 === "hh:mm") {
328
+ vModeValue.value = `${h2}:${m}`;
329
+ } else if (format2 === "mm:ss") {
330
+ vModeValue.value = `${m}:${s}`;
331
+ }
332
+ };
333
+ const initData = () => {
334
+ if (vModeValue.value) {
335
+ firsthandActiveTime.value = props.modelValue;
336
+ const time = vModeValue.value.split(":");
337
+ setInputValue(time[0], time[1], time[2]);
338
+ }
339
+ };
340
+ initData();
341
+ const changeTimeData = ({ activeHour, activeMinute, activeSecond }) => {
342
+ hh.value = activeHour.value || "00";
343
+ mm.value = activeMinute.value || "00";
344
+ ss.value = activeSecond.value || "00";
345
+ firsthandActiveTime.value = `${hh.value}:${mm.value}:${ss.value}`;
346
+ setInputValue(hh.value, mm.value, ss.value);
347
+ };
348
+ const mouseInputFun = () => {
349
+ if (!vModeValue.value) {
350
+ vModeValue.value = "00:00:00";
351
+ }
352
+ const minTimeValueArr = props.minTime.split(":");
353
+ const maxTimeValueArr = props.maxTime.split(":");
354
+ if (vModeValue.value > props.maxTime) {
355
+ firsthandActiveTime.value = props.maxTime;
356
+ setInputValue(maxTimeValueArr[0], maxTimeValueArr[1], maxTimeValueArr[2]);
357
+ } else if (vModeValue.value < props.minTime) {
358
+ firsthandActiveTime.value = props.minTime;
359
+ setInputValue(minTimeValueArr[0], minTimeValueArr[1], minTimeValueArr[2]);
360
+ }
361
+ showPopup.value = true;
362
+ };
363
+ const clickVerifyFun = (e) => {
364
+ e.stopPropagation();
365
+ if (props.disabled || props.readonly) {
366
+ return;
367
+ }
368
+ mouseInputFun();
369
+ };
370
+ onClickOutside(devuiTimePicker, () => {
371
+ showPopup.value = false;
372
+ });
373
+ const clearAll = (e) => {
374
+ e.stopPropagation();
375
+ if (props.minTime !== "00:00:00") {
376
+ const minTimeArr = props.minTime.split(":");
377
+ hh.value = minTimeArr[0];
378
+ mm.value = minTimeArr[1];
379
+ ss.value = minTimeArr[2];
380
+ } else {
381
+ hh.value = "00";
382
+ mm.value = "00";
383
+ ss.value = "00";
384
+ }
385
+ firsthandActiveTime.value = `${hh.value}:${mm.value}:${ss.value}`;
386
+ setInputValue(hh.value, mm.value, ss.value);
387
+ };
388
+ const isOutOpen = () => {
389
+ if (props.autoOpen) {
390
+ mouseInputFun();
391
+ showPopup.value = props.autoOpen;
392
+ }
393
+ };
394
+ const chooseTime = (slotTime) => {
395
+ if (slotTime.type) {
396
+ if (slotTime.type.toLowerCase() === "hh") {
397
+ hh.value = slotTime.time;
398
+ } else if (slotTime.type.toLowerCase() === "mm") {
399
+ mm.value = slotTime.time;
400
+ } else if (slotTime.type.toLowerCase() === "ss") {
401
+ ss.value = slotTime.time;
402
+ }
403
+ firsthandActiveTime.value = `${hh.value}:${mm.value}:${ss.value}`;
404
+ setInputValue(hh.value, mm.value, ss.value);
405
+ } else {
406
+ const timeArr = slotTime.time.split(":");
407
+ hh.value = timeArr[0];
408
+ mm.value = timeArr[1];
409
+ ss.value = timeArr[2];
410
+ firsthandActiveTime.value = `${hh.value}:${mm.value}:${ss.value}`;
411
+ setInputValue(hh.value, mm.value, ss.value);
412
+ }
413
+ };
414
+ return {
415
+ showPopup,
416
+ trueTimeValue,
417
+ devuiTimePicker,
418
+ timePickerValue,
419
+ inputDom,
420
+ timePopupDom,
421
+ showClearIcon,
422
+ firsthandActiveTime,
423
+ vModeValue,
424
+ clickVerifyFun,
425
+ isOutOpen,
426
+ clearAll,
427
+ chooseTime,
428
+ overlayRef,
429
+ changeTimeData
430
+ };
431
+ }
432
+ function initializeTimeData(type4) {
433
+ const timeArr = reactive([]);
434
+ let arrLength = 0;
435
+ if (type4 === "hour") {
436
+ arrLength = 24;
437
+ } else {
438
+ arrLength = 60;
439
+ }
440
+ for (let i = 0; i < arrLength; i++) {
441
+ timeArr.push({
442
+ time: i < 10 ? "0" + i : i + "",
443
+ isActive: false,
444
+ flag: type4,
445
+ isDisabled: false,
446
+ type: type4
447
+ });
448
+ }
449
+ return timeArr;
450
+ }
451
+ const setTimeAstrict = (hourList, minuteList, secondList, minTime, maxTime, format2) => {
452
+ const maxTimeHour = maxTime.split(":")[0];
453
+ const maxTimeMinute = maxTime.split(":")[1];
454
+ const minTimeHour = minTime.split(":")[0];
455
+ const minTimeMinute = minTime.split(":")[1];
456
+ const minTimeSecond = minTime.split(":")[2];
457
+ hourList.map((item) => {
458
+ if (item.time < minTimeHour || item.time > maxTimeHour) {
459
+ item.isDisabled = true;
460
+ }
461
+ });
462
+ if (format2 === "mm:ss") {
463
+ minuteList.map((item) => {
464
+ if (item.time < minTimeMinute || item.time > maxTimeMinute) {
465
+ item.isDisabled = true;
466
+ }
467
+ });
468
+ } else {
469
+ minuteList.map((item) => {
470
+ if (item.time < minTimeMinute) {
471
+ item.isDisabled = true;
472
+ }
473
+ });
474
+ }
475
+ secondList.map((item) => {
476
+ if (item.time < minTimeSecond) {
477
+ item.isDisabled = true;
478
+ }
479
+ });
480
+ };
481
+ const usePopupLine = (hourListRef, minuteListRef, secondListRef, minTime, maxTime, format2, itemHeight, timeListDom, ctx) => {
482
+ const activeTime = ref("00:00:00");
483
+ const activeHour = ref("00");
484
+ const activeMinute = ref("00");
485
+ const activeSecond = ref("00");
486
+ const setItemAstrict = (timeArr, min, max) => {
487
+ timeArr.map((item) => {
488
+ if (min !== "00" && item.time < min) {
489
+ item.isDisabled = true;
490
+ } else if (max !== "00" && item.time > max) {
491
+ item.isDisabled = true;
492
+ } else {
493
+ item.isDisabled = false;
494
+ }
495
+ });
496
+ };
497
+ const getItemAstrict = (item) => {
498
+ let min = "00";
499
+ let max = "00";
500
+ const minTimeHour = minTime.split(":")[0];
501
+ const minTimeMinute = minTime.split(":")[1];
502
+ const minTimeSecond = minTime.split(":")[2];
503
+ const maxTimeHour = maxTime.split(":")[0];
504
+ const maxTimeMinute = maxTime.split(":")[1];
505
+ const maxTimeSecond = maxTime.split(":")[2];
506
+ if (item.flag === "hour") {
507
+ if (item.time === minTimeHour) {
508
+ min = minTimeMinute;
509
+ setItemAstrict(minuteListRef, min, max);
510
+ activeMinute.value < minTimeMinute && setItemAstrict(secondListRef, minTimeSecond, max);
511
+ } else if (item.time === maxTimeHour) {
512
+ max = maxTimeMinute;
513
+ setItemAstrict(minuteListRef, min, max);
514
+ setItemAstrict(secondListRef, min, maxTimeSecond);
515
+ } else {
516
+ setItemAstrict(minuteListRef, min, max);
517
+ setItemAstrict(secondListRef, min, max);
518
+ }
519
+ }
520
+ if (item.flag === "minute" && format2 === "mm:ss") {
521
+ if (item.time === minTimeMinute) {
522
+ min = minTimeSecond;
523
+ setItemAstrict(secondListRef, min, max);
524
+ } else if (item.time === maxTimeMinute) {
525
+ max = maxTimeSecond;
526
+ setItemAstrict(secondListRef, min, max);
527
+ } else {
528
+ setItemAstrict(secondListRef, min, max);
529
+ }
530
+ } else if (item.flag === "minute") {
531
+ if (activeHour.value === minTimeHour && item.time === minTimeMinute) {
532
+ min = minTimeSecond;
533
+ setItemAstrict(secondListRef, min, max);
534
+ } else if (activeHour.value === maxTimeHour && item.time === maxTimeMinute) {
535
+ max = maxTimeSecond;
536
+ setItemAstrict(secondListRef, min, max);
537
+ } else {
538
+ setItemAstrict(secondListRef, min, max);
539
+ }
540
+ }
541
+ };
542
+ const resetTimeActive = (timeArr, itemValue) => {
543
+ timeArr.map((item) => {
544
+ item.isActive = item.time === itemValue;
545
+ });
546
+ };
547
+ const resetTimeAstrict = (timeArr, time) => {
548
+ timeArr.map((item) => {
549
+ if (item.time === time) {
550
+ getItemAstrict(item);
551
+ }
552
+ });
553
+ };
554
+ const resetTimeValue = (time) => {
555
+ const timeValueArr = time.split(":");
556
+ minTime.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
+ if (item.isDisabled) {
647
+ return false;
648
+ } else {
649
+ setTimeActive(item, index2);
650
+ e.target.parentElement.parentElement.scrollTop = index2 * itemHeight;
651
+ }
652
+ ctx.emit("change", { activeHour, activeMinute, activeSecond });
653
+ };
654
+ const getNewTime = () => {
655
+ return { activeTime, activeHour, activeMinute, activeSecond };
656
+ };
657
+ const resetScrollTop = () => {
658
+ for (let i = 0; i < timeListDom.value.children.length; i++) {
659
+ timeListDom.value.children[i].lastElementChild.children[0].scrollTop = 0;
660
+ }
661
+ };
662
+ return {
663
+ activeTime,
664
+ activeHour,
665
+ activeMinute,
666
+ activeSecond,
667
+ activeTimeFun,
668
+ resetTimeValue,
669
+ getNewTime,
670
+ resetScrollTop
671
+ };
672
+ };
673
+ function useTimeScroll() {
674
+ const scrollBoxDom = ref();
675
+ const scrollContentDom = ref();
676
+ const scrollThumbDom = ref();
677
+ const scrollTrackDom = ref();
678
+ const isDown = ref(false);
679
+ const getScrollHeight = () => {
680
+ const thumbHeight = scrollContentDom.value.clientHeight / scrollContentDom.value.scrollHeight * 100;
681
+ scrollThumbDom.value.style.height = thumbHeight + "%";
682
+ };
683
+ const setVirtualScroll = () => {
684
+ const thumbMoveY = scrollContentDom.value.scrollTop * 100 / scrollContentDom.value.clientHeight;
685
+ scrollThumbDom.value.style.transform = `translateY(${thumbMoveY}%)`;
686
+ };
687
+ const clickTrackFun = (e) => {
688
+ const offsetNum = scrollTrackDom.value.getBoundingClientRect().top - e.clientY;
689
+ const offset2 = Math.abs(offsetNum > 0 ? 0 : offsetNum);
690
+ const thumbCenter = scrollThumbDom.value.offsetHeight / 2;
691
+ const thumbPosition = (offset2 - thumbCenter) * 100 / scrollContentDom.value.offsetHeight;
692
+ scrollContentDom.value.scrollTop = thumbPosition * scrollContentDom.value.scrollHeight / 100;
693
+ scrollContentDom.value.style.top = scrollContentDom.value.scrollTop + "px";
694
+ };
695
+ const thumbMouseMove = (e) => {
696
+ const path = e.composedPath && e.composedPath() || e.path;
697
+ if (path.includes(scrollBoxDom.value) || isDown.value) {
698
+ scrollTrackDom.value.style.opacity = 1;
699
+ } else {
700
+ scrollTrackDom.value.style.opacity = 0;
701
+ }
702
+ if (!isDown.value) {
703
+ return;
704
+ }
705
+ clickTrackFun(e);
706
+ };
707
+ const mouseDownThum = () => {
708
+ isDown.value = true;
709
+ scrollTrackDom.value.style.opacity = 1;
710
+ };
711
+ const mouseOutThum = (e) => {
712
+ isDown.value = false;
713
+ thumbMouseMove(e);
714
+ };
715
+ const getScrollWidth = () => {
716
+ var _a;
717
+ const ua = navigator.userAgent;
718
+ let marginRight = -20;
719
+ if (ua.indexOf("Chrome") > -1) {
720
+ marginRight = -8;
721
+ } else {
722
+ const outer = document.createElement("div");
723
+ outer.className = "devui-scrollbar-wrap";
724
+ outer.style.width = "100px";
725
+ outer.style.visibility = "hidden";
726
+ outer.style.position = "absolute";
727
+ outer.style.top = "-9999px";
728
+ document.body.appendChild(outer);
729
+ const widthNoScroll = outer.offsetWidth;
730
+ outer.style.overflow = "scroll";
731
+ const inner = document.createElement("div");
732
+ inner.style.width = "100%";
733
+ outer.appendChild(inner);
734
+ const widthWithScroll = inner.offsetWidth;
735
+ (_a = outer.parentNode) == null ? void 0 : _a.removeChild(outer);
736
+ marginRight = (widthNoScroll - widthWithScroll + 3) * -1;
737
+ }
738
+ return marginRight;
739
+ };
740
+ return {
741
+ scrollThumbDom,
742
+ scrollTrackDom,
743
+ scrollContentDom,
744
+ scrollBoxDom,
745
+ isDown,
746
+ getScrollHeight,
747
+ setVirtualScroll,
748
+ clickTrackFun,
749
+ mouseDownThum,
750
+ mouseOutThum,
751
+ thumbMouseMove,
752
+ getScrollWidth
753
+ };
754
+ }
755
+ var index$3 = "";
756
+ var TimeScroll = defineComponent({
757
+ name: "DTimeScroll",
758
+ props: timePickerProps,
759
+ setup(props, ctx) {
760
+ const ns2 = useNamespace("scroll-box");
761
+ const {
762
+ scrollBoxDom,
763
+ scrollThumbDom,
764
+ scrollTrackDom,
765
+ scrollContentDom,
766
+ isDown,
767
+ getScrollHeight,
768
+ setVirtualScroll,
769
+ clickTrackFun,
770
+ mouseDownThum,
771
+ mouseOutThum,
772
+ thumbMouseMove,
773
+ getScrollWidth
774
+ } = useTimeScroll();
775
+ const marginRight = getScrollWidth();
776
+ onMounted(() => {
777
+ getScrollWidth();
778
+ getScrollHeight();
779
+ scrollBoxDom.value.addEventListener("click", setVirtualScroll);
780
+ scrollContentDom.value.addEventListener("scroll", setVirtualScroll);
781
+ scrollThumbDom.value.addEventListener("mousedown", mouseDownThum);
782
+ document.addEventListener("mouseup", mouseOutThum);
783
+ document.addEventListener("mousemove", thumbMouseMove);
784
+ });
785
+ onBeforeUnmount(() => {
786
+ scrollBoxDom.value.removeEventListener("click", setVirtualScroll);
787
+ scrollContentDom.value.removeEventListener("scroll", setVirtualScroll);
788
+ scrollThumbDom.value.removeEventListener("mousedown", mouseDownThum);
789
+ });
790
+ onUnmounted(() => {
791
+ document.removeEventListener("mouseup", mouseOutThum);
792
+ document.removeEventListener("mousemove", thumbMouseMove);
793
+ });
794
+ return () => {
795
+ var _a, _b;
796
+ return createVNode(Fragment, null, [createVNode("div", {
797
+ "ref": scrollBoxDom,
798
+ "class": ns2.b()
799
+ }, [createVNode("div", {
800
+ "ref": scrollContentDom,
801
+ "class": `box-content ${isDown.value || !props.showAnimation ? "box-content-behavior-auto" : ""}`,
802
+ "style": {
803
+ "margin-right": marginRight + "px"
804
+ }
805
+ }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]), createVNode("div", {
806
+ "ref": scrollTrackDom,
807
+ "class": "box-sroll",
808
+ "onClick": clickTrackFun
809
+ }, [createVNode("div", {
810
+ "ref": scrollThumbDom,
811
+ "class": "scroll-child"
812
+ }, null)])])]);
813
+ };
814
+ }
815
+ });
816
+ var index$2 = "";
817
+ var TimeList = defineComponent({
818
+ name: "DTimeList",
819
+ components: {
820
+ TimeScroll
446
821
  },
447
- prefix: {
448
- type: String,
449
- default: ""
822
+ props: {
823
+ hourList: {
824
+ type: Array,
825
+ default: () => []
826
+ },
827
+ minuteList: {
828
+ type: Array,
829
+ default: () => []
830
+ },
831
+ secondList: {
832
+ type: Array,
833
+ default: () => []
834
+ },
835
+ format: {
836
+ type: String,
837
+ default: "hh:mm:ss"
838
+ },
839
+ minTime: {
840
+ type: String,
841
+ default: "00:00:00"
842
+ },
843
+ maxTime: {
844
+ type: String,
845
+ default: "23:59:59"
846
+ },
847
+ itemHeight: {
848
+ type: Number,
849
+ default: 32
850
+ }
450
851
  },
451
- suffix: {
452
- type: String,
453
- default: ""
852
+ emits: ["change"],
853
+ setup(props, ctx) {
854
+ const ns2 = useNamespace("time-list");
855
+ const timeListDom = ref();
856
+ const {
857
+ getNewTime,
858
+ activeTimeFun,
859
+ resetTimeValue,
860
+ resetScrollTop
861
+ } = usePopupLine(props.hourList, props.minuteList, props.secondList, props.minTime, props.maxTime, props.format, props.itemHeight, timeListDom, ctx);
862
+ const setOuterTime = (time) => {
863
+ resetTimeValue(time);
864
+ };
865
+ const TimeLi = (timeArr) => {
866
+ return timeArr.map((item, index2) => {
867
+ return createVNode("li", {
868
+ "class": `time-li ${item.flag}Id-${index2} ${item.isActive ? "active-li" : ""} ${item.isDisabled ? "disabled-li" : ""}`,
869
+ "onClick": (e) => {
870
+ activeTimeFun(e, item, index2);
871
+ }
872
+ }, [createVNode("span", null, [item.time])]);
873
+ });
874
+ };
875
+ const TimeUl = (timeList) => {
876
+ return createVNode("div", {
877
+ "class": "time-item",
878
+ "style": {
879
+ flex: 1
880
+ }
881
+ }, [createVNode(TimeScroll, null, {
882
+ default: () => [createVNode("ul", {
883
+ "class": "time-ul"
884
+ }, [TimeLi(timeList)])]
885
+ })]);
886
+ };
887
+ const formatTimeUl = () => {
888
+ const timeList = {
889
+ hh: props.hourList,
890
+ mm: props.minuteList,
891
+ ss: props.secondList
892
+ };
893
+ const timeFormatArr = props.format.split(":");
894
+ return timeFormatArr.map((timeItem) => {
895
+ return TimeUl(timeList[timeItem]);
896
+ });
897
+ };
898
+ ctx.expose({
899
+ resetScrollTop,
900
+ setOuterTime,
901
+ getNewTime
902
+ });
903
+ return () => {
904
+ return createVNode("div", {
905
+ "class": ns2.b(),
906
+ "ref": timeListDom
907
+ }, [formatTimeUl()]);
908
+ };
909
+ }
910
+ });
911
+ class View {
912
+ constructor() {
913
+ __publicField(this, "top", "50%");
914
+ __publicField(this, "left", "50%");
915
+ }
916
+ }
917
+ const loadingProps = {
918
+ message: String,
919
+ backdrop: Boolean,
920
+ view: {
921
+ type: Object,
922
+ default: () => new View()
454
923
  },
455
- showPassword: {
924
+ zIndex: Number,
925
+ isFull: {
456
926
  type: Boolean,
457
927
  default: false
928
+ }
929
+ };
930
+ class LoadingOptions {
931
+ constructor() {
932
+ __publicField(this, "target");
933
+ __publicField(this, "message");
934
+ __publicField(this, "loadingTemplateRef");
935
+ __publicField(this, "backdrop", true);
936
+ __publicField(this, "positionType", "relative");
937
+ __publicField(this, "view", new View());
938
+ __publicField(this, "zIndex");
939
+ }
940
+ }
941
+ var loading = "";
942
+ var Loading = defineComponent({
943
+ name: "DLoading",
944
+ inheritAttrs: false,
945
+ props: loadingProps,
946
+ setup(props) {
947
+ const style = {
948
+ top: props.view.top,
949
+ left: props.view.left,
950
+ zIndex: props.zIndex
951
+ };
952
+ if (!props.message) {
953
+ style.background = "none";
954
+ }
955
+ const isShow = ref(false);
956
+ const open = () => {
957
+ isShow.value = true;
958
+ };
959
+ const close = () => {
960
+ isShow.value = false;
961
+ };
962
+ return {
963
+ style,
964
+ isShow,
965
+ open,
966
+ close
967
+ };
458
968
  },
459
- clearable: {
460
- type: Boolean,
461
- default: false
969
+ render() {
970
+ var _a;
971
+ const {
972
+ isShow,
973
+ isFull,
974
+ backdrop,
975
+ style,
976
+ message,
977
+ $slots
978
+ } = this;
979
+ const ns2 = useNamespace("loading");
980
+ return isShow && createVNode("div", {
981
+ "class": [ns2.b(), isFull ? ns2.m("full") : ""]
982
+ }, [((_a = $slots.default) == null ? void 0 : _a.call($slots)) || createVNode("div", {
983
+ "class": ns2.e("wrapper")
984
+ }, [backdrop ? createVNode("div", {
985
+ "class": ns2.e("mask")
986
+ }, null) : null, createVNode("div", {
987
+ "style": style,
988
+ "class": ns2.e("area")
989
+ }, [createVNode("div", {
990
+ "class": ns2.e("busy-default-spinner")
991
+ }, [createVNode("div", {
992
+ "class": ns2.e("bar1")
993
+ }, null), createVNode("div", {
994
+ "class": ns2.e("bar2")
995
+ }, null), createVNode("div", {
996
+ "class": ns2.e("bar3")
997
+ }, null), createVNode("div", {
998
+ "class": ns2.e("bar4")
999
+ }, null)]), message ? createVNode("span", {
1000
+ "class": ns2.e("text")
1001
+ }, [message]) : null])])]);
1002
+ }
1003
+ });
1004
+ const COMPONENT_CONTAINER_SYMBOL = Symbol("dev_component_container");
1005
+ function createComponent(component, props, children = null) {
1006
+ const vnode = h(component, __spreadValues({}, props), children);
1007
+ const container = document.createElement("div");
1008
+ vnode[COMPONENT_CONTAINER_SYMBOL] = container;
1009
+ render(vnode, container);
1010
+ return vnode.component;
1011
+ }
1012
+ function unmountComponent(ComponnetInstance) {
1013
+ render(null, ComponnetInstance == null ? void 0 : ComponnetInstance.vnode[COMPONENT_CONTAINER_SYMBOL]);
1014
+ }
1015
+ const loadingConstructor = defineComponent(Loading);
1016
+ const cacheInstance = /* @__PURE__ */ new WeakSet();
1017
+ const isEmpty = (val) => {
1018
+ if (!val) {
1019
+ return true;
1020
+ }
1021
+ if (Array.isArray(val)) {
1022
+ return val.length === 0;
1023
+ }
1024
+ if (val instanceof Set || val instanceof Map) {
1025
+ return val.size === 0;
1026
+ }
1027
+ if (val instanceof Promise) {
1028
+ return false;
1029
+ }
1030
+ if (typeof val === "object") {
1031
+ try {
1032
+ return Object.keys(val).length === 0;
1033
+ } catch (e) {
1034
+ return false;
1035
+ }
1036
+ }
1037
+ return false;
1038
+ };
1039
+ const getType = (vari) => {
1040
+ return Object.prototype.toString.call(vari).slice(8, -1).toLowerCase();
1041
+ };
1042
+ const isPromise = (value) => {
1043
+ const type4 = getType(value);
1044
+ switch (type4) {
1045
+ case "promise":
1046
+ return [value];
1047
+ case "array":
1048
+ if (value.some((val) => getType(val) !== "promise")) {
1049
+ console.error(new TypeError("Binding values should all be of type Promise"));
1050
+ return "error";
1051
+ }
1052
+ return value;
1053
+ default:
1054
+ return false;
462
1055
  }
463
1056
  };
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
495
- },
496
- extraInfo: {
497
- type: String,
498
- default: ""
1057
+ const unmount = (el) => {
1058
+ cacheInstance.delete(el);
1059
+ el.instance.proxy.close();
1060
+ unmountComponent(el.instance);
1061
+ };
1062
+ const toggleLoading = (el, binding) => {
1063
+ var _a, _b, _c;
1064
+ if (binding.value) {
1065
+ const vals = isPromise(binding.value);
1066
+ if (vals === "error") {
1067
+ return;
1068
+ }
1069
+ (_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);
1070
+ el.appendChild(el.mask);
1071
+ cacheInstance.add(el);
1072
+ if (vals) {
1073
+ Promise.all(vals).catch((err) => {
1074
+ console.error(new Error("Promise handling errors"), err);
1075
+ }).finally(() => {
1076
+ unmount(el);
1077
+ });
1078
+ }
1079
+ } else {
1080
+ unmount(el);
499
1081
  }
500
1082
  };
501
- const FORM_ITEM_TOKEN = Symbol("dFormItem");
502
- const LABEL_DATA = Symbol("labelData");
503
- const formProps = {
504
- data: {
505
- type: Object,
506
- default: () => ({})
1083
+ const removeAttribute = (el) => {
1084
+ el.removeAttribute("zindex");
1085
+ el.removeAttribute("positiontype");
1086
+ el.removeAttribute("backdrop");
1087
+ el.removeAttribute("message");
1088
+ el.removeAttribute("view");
1089
+ el.removeAttribute("loadingtemplateref");
1090
+ };
1091
+ const handleProps = (el, vprops) => {
1092
+ var _a;
1093
+ const props = __spreadValues(__spreadValues({}, new LoadingOptions()), vprops);
1094
+ const loadingTemplateRef = props.loadingTemplateRef;
1095
+ const loadingInstance = createComponent(loadingConstructor, __spreadValues({}, props), loadingTemplateRef ? () => loadingTemplateRef : null);
1096
+ el.style.position = props.positionType;
1097
+ el.options = props;
1098
+ el.instance = loadingInstance;
1099
+ el.mask = (_a = loadingInstance == null ? void 0 : loadingInstance.proxy) == null ? void 0 : _a.$el;
1100
+ };
1101
+ const loadingDirective = {
1102
+ mounted: function(el, binding, vnode) {
1103
+ handleProps(el, vnode.props);
1104
+ removeAttribute(el);
1105
+ !isEmpty(binding.value) && toggleLoading(el, binding);
507
1106
  },
508
- layout: {
1107
+ updated: function(el, binding, vnode) {
1108
+ if (!isEmpty(binding.value) && cacheInstance.has(el) || isEmpty(binding.value) && !cacheInstance.has(el)) {
1109
+ return;
1110
+ }
1111
+ !cacheInstance.has(el) && handleProps(el, vnode.props);
1112
+ removeAttribute(el);
1113
+ toggleLoading(el, binding);
1114
+ }
1115
+ };
1116
+ const buttonProps = {
1117
+ variant: {
509
1118
  type: String,
510
- default: "horizontal"
1119
+ default: "outline"
511
1120
  },
512
- labelSize: {
1121
+ size: {
513
1122
  type: String,
514
1123
  default: "md"
515
1124
  },
516
- labelAlign: {
517
- type: String,
518
- default: "start"
519
- },
520
- rules: {
521
- type: Object
1125
+ color: {
1126
+ type: String
522
1127
  },
523
- messageType: {
1128
+ icon: {
524
1129
  type: String,
525
- default: "popover"
526
- },
527
- popPosition: {
528
- type: Array,
529
- default: ["right", "bottom"]
530
- },
531
- validateOnRuleChange: {
532
- type: Boolean,
533
- default: false
1130
+ default: ""
534
1131
  },
535
- showFeedback: {
1132
+ loading: {
536
1133
  type: Boolean,
537
1134
  default: false
538
1135
  },
@@ -540,21 +1137,17 @@ const formProps = {
540
1137
  type: Boolean,
541
1138
  default: false
542
1139
  },
543
- size: {
1140
+ shape: {
544
1141
  type: String
545
1142
  }
546
1143
  };
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
- }
1144
+ const buttonGroupProps = {
1145
+ size: {
1146
+ type: String,
1147
+ default: "md"
1148
+ }
1149
+ };
1150
+ const buttonGroupInjectionKey = Symbol("d-button-group");
558
1151
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
559
1152
  var lodash = { exports: {} };
560
1153
  /**
@@ -1277,10 +1870,10 @@ var lodash = { exports: {} };
1277
1870
  }();
1278
1871
  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
1872
  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");
1873
+ 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
1874
  var metaMap = WeakMap2 && new WeakMap2();
1282
1875
  var realNames = {};
1283
- var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap2);
1876
+ var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap2);
1284
1877
  var symbolProto = Symbol2 ? Symbol2.prototype : undefined$1, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined$1, symbolToString = symbolProto ? symbolProto.toString : undefined$1;
1285
1878
  function lodash2(value) {
1286
1879
  if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
@@ -1636,7 +2229,7 @@ var lodash = { exports: {} };
1636
2229
  function baseAt(object4, paths) {
1637
2230
  var index2 = -1, length = paths.length, result2 = Array2(length), skip = object4 == null;
1638
2231
  while (++index2 < length) {
1639
- result2[index2] = skip ? undefined$1 : get(object4, paths[index2]);
2232
+ result2[index2] = skip ? undefined$1 : get2(object4, paths[index2]);
1640
2233
  }
1641
2234
  return result2;
1642
2235
  }
@@ -2081,7 +2674,7 @@ var lodash = { exports: {} };
2081
2674
  return matchesStrictComparable(toKey(path), srcValue);
2082
2675
  }
2083
2676
  return function(object4) {
2084
- var objValue = get(object4, path);
2677
+ var objValue = get2(object4, path);
2085
2678
  return objValue === undefined$1 && objValue === srcValue ? hasIn(object4, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
2086
2679
  };
2087
2680
  }
@@ -2972,8 +3565,8 @@ var lodash = { exports: {} };
2972
3565
  return func(number4);
2973
3566
  };
2974
3567
  }
2975
- var createSet = !(Set && 1 / setToArray(new Set([, -0]))[1] == INFINITY) ? noop : function(values2) {
2976
- return new Set(values2);
3568
+ var createSet = !(Set2 && 1 / setToArray(new Set2([, -0]))[1] == INFINITY) ? noop : function(values2) {
3569
+ return new Set2(values2);
2977
3570
  };
2978
3571
  function createToPairs(keysFunc) {
2979
3572
  return function(object4) {
@@ -3272,7 +3865,7 @@ var lodash = { exports: {} };
3272
3865
  return result2;
3273
3866
  };
3274
3867
  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) {
3868
+ 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
3869
  getTag = function(value) {
3277
3870
  var result2 = baseGetTag(value), Ctor = result2 == objectTag ? value.constructor : undefined$1, ctorString = Ctor ? toSource(Ctor) : "";
3278
3871
  if (ctorString) {
@@ -4559,7 +5152,7 @@ var lodash = { exports: {} };
4559
5152
  function isElement(value) {
4560
5153
  return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
4561
5154
  }
4562
- function isEmpty(value) {
5155
+ function isEmpty2(value) {
4563
5156
  if (value == null) {
4564
5157
  return true;
4565
5158
  }
@@ -4814,7 +5407,7 @@ var lodash = { exports: {} };
4814
5407
  function functionsIn(object4) {
4815
5408
  return object4 == null ? [] : baseFunctions(object4, keysIn(object4));
4816
5409
  }
4817
- function get(object4, path, defaultValue) {
5410
+ function get2(object4, path, defaultValue) {
4818
5411
  var result2 = object4 == null ? undefined$1 : baseGet(object4, path);
4819
5412
  return result2 === undefined$1 ? defaultValue : result2;
4820
5413
  }
@@ -5669,7 +6262,7 @@ var lodash = { exports: {} };
5669
6262
  lodash2.forInRight = forInRight;
5670
6263
  lodash2.forOwn = forOwn;
5671
6264
  lodash2.forOwnRight = forOwnRight;
5672
- lodash2.get = get;
6265
+ lodash2.get = get2;
5673
6266
  lodash2.gt = gt;
5674
6267
  lodash2.gte = gte;
5675
6268
  lodash2.has = has;
@@ -5689,7 +6282,7 @@ var lodash = { exports: {} };
5689
6282
  lodash2.isBuffer = isBuffer;
5690
6283
  lodash2.isDate = isDate;
5691
6284
  lodash2.isElement = isElement;
5692
- lodash2.isEmpty = isEmpty;
6285
+ lodash2.isEmpty = isEmpty2;
5693
6286
  lodash2.isEqual = isEqual;
5694
6287
  lodash2.isEqualWith = isEqualWith;
5695
6288
  lodash2.isError = isError;
@@ -5967,6 +6560,366 @@ var lodash = { exports: {} };
5967
6560
  }
5968
6561
  }).call(commonjsGlobal);
5969
6562
  })(lodash, lodash.exports);
6563
+ function useButton(props, ctx) {
6564
+ const ns2 = useNamespace("button");
6565
+ const hasContent = computed(() => ctx.slots.default);
6566
+ const colorMap = {
6567
+ solid: "primary",
6568
+ outline: "secondary",
6569
+ text: "secondary"
6570
+ };
6571
+ const defaultColor = colorMap[props.variant];
6572
+ const buttonGroupConf = inject(buttonGroupInjectionKey, null);
6573
+ const buttonSize = computed(() => {
6574
+ return (buttonGroupConf == null ? void 0 : buttonGroupConf.size.value) || props.size;
6575
+ });
6576
+ const classes = computed(() => ({
6577
+ [ns2.b()]: true,
6578
+ [ns2.m(props.variant)]: true,
6579
+ [`${ns2.m(props.variant)}--${props.color || defaultColor}`]: true,
6580
+ [ns2.m(buttonSize.value)]: true,
6581
+ [ns2.e("icon-wrap")]: props.icon,
6582
+ [ns2.e("icon")]: props.icon && !hasContent.value,
6583
+ [ns2.m("is-loading")]: props.loading,
6584
+ [ns2.m(props.shape || "")]: props.shape && lodash.exports.isString(props.shape) ? true : false
6585
+ }));
6586
+ const iconClass = computed(() => {
6587
+ if (!props.icon) {
6588
+ return "";
6589
+ }
6590
+ const origin = `${ns2.e("icon-fix")} icon`;
6591
+ if (hasContent.value) {
6592
+ return `${origin} clear-right-5`;
6593
+ } else {
6594
+ return origin;
6595
+ }
6596
+ });
6597
+ return { classes, iconClass };
6598
+ }
6599
+ var button = "";
6600
+ var Button = defineComponent({
6601
+ name: "DButton",
6602
+ directives: {
6603
+ dLoading: loadingDirective
6604
+ },
6605
+ props: buttonProps,
6606
+ emits: ["click"],
6607
+ setup(props, ctx) {
6608
+ const {
6609
+ icon: icon2,
6610
+ disabled,
6611
+ loading: loading2
6612
+ } = toRefs(props);
6613
+ const {
6614
+ classes,
6615
+ iconClass
6616
+ } = useButton(props, ctx);
6617
+ const onClick = (e) => {
6618
+ if (loading2.value) {
6619
+ return;
6620
+ }
6621
+ ctx.emit("click", e);
6622
+ };
6623
+ return () => {
6624
+ var _a, _b;
6625
+ return withDirectives(createVNode("button", {
6626
+ "class": classes.value,
6627
+ "disabled": disabled.value,
6628
+ "onClick": onClick
6629
+ }, [icon2.value && createVNode(Icon, {
6630
+ "name": icon2.value,
6631
+ "size": "var(--devui-font-size, 12px)",
6632
+ "color": "",
6633
+ "class": iconClass.value
6634
+ }, null), createVNode("span", {
6635
+ "class": "button-content"
6636
+ }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])]), [[resolveDirective("dLoading"), loading2.value]]);
6637
+ };
6638
+ }
6639
+ });
6640
+ var buttonGroup = "";
6641
+ defineComponent({
6642
+ name: "DButtonGroup",
6643
+ props: buttonGroupProps,
6644
+ setup(props, {
6645
+ slots
6646
+ }) {
6647
+ const ns2 = useNamespace("button-group");
6648
+ provide(buttonGroupInjectionKey, {
6649
+ size: toRef(props, "size")
6650
+ });
6651
+ return () => {
6652
+ return createVNode("div", {
6653
+ "class": ns2.b()
6654
+ }, [slots.default && slots.default()]);
6655
+ };
6656
+ }
6657
+ });
6658
+ var index$1 = "";
6659
+ const camelize = (name) => name.substring(1).replace(/^\S/, (s) => s.toLocaleLowerCase());
6660
+ function get(object4, path) {
6661
+ const keys = path.split(".");
6662
+ let result = object4;
6663
+ keys.forEach((key) => {
6664
+ var _a;
6665
+ result = (_a = result[key]) != null ? _a : "";
6666
+ });
6667
+ return result;
6668
+ }
6669
+ function createI18nTranslate(name, app, newPrefix) {
6670
+ const prefix = newPrefix || camelize(name) + ".";
6671
+ return (path) => {
6672
+ const messages2 = app == null ? void 0 : app.appContext.config.globalProperties.langMessages.value;
6673
+ const message = get(messages2, prefix + path) || get(messages2, path);
6674
+ return message;
6675
+ };
6676
+ }
6677
+ function _isSlot(s) {
6678
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
6679
+ }
6680
+ var TimePopup = defineComponent({
6681
+ name: "DTimePopup",
6682
+ components: {
6683
+ TimeList,
6684
+ Button
6685
+ },
6686
+ props: {
6687
+ showPopup: {
6688
+ type: Boolean,
6689
+ default: false
6690
+ },
6691
+ popupTop: {
6692
+ type: Number,
6693
+ default: -100
6694
+ },
6695
+ popupLeft: {
6696
+ type: Number,
6697
+ default: -100
6698
+ },
6699
+ popupWidth: {
6700
+ type: Number,
6701
+ default: 300
6702
+ },
6703
+ popupFormat: {
6704
+ type: String,
6705
+ default: "hh:mm:ss"
6706
+ },
6707
+ minTime: {
6708
+ type: String,
6709
+ default: "00:00:00"
6710
+ },
6711
+ maxTime: {
6712
+ type: String,
6713
+ default: "23:59:59"
6714
+ },
6715
+ bindData: {
6716
+ type: String,
6717
+ default: "00:00:00"
6718
+ }
6719
+ },
6720
+ emits: ["submitData", "change"],
6721
+ setup(props, ctx) {
6722
+ const app = getCurrentInstance();
6723
+ const t = createI18nTranslate("DTimePopup", app);
6724
+ const ns2 = useNamespace("time-popup");
6725
+ const popupDome = ref();
6726
+ const timeListDom = ref();
6727
+ const hourList = initializeTimeData("hour");
6728
+ const minuteList = initializeTimeData("minute");
6729
+ const secondList = initializeTimeData("second");
6730
+ onMounted(() => {
6731
+ setTimeAstrict(hourList, minuteList, secondList, props.minTime, props.maxTime, props.popupFormat);
6732
+ timeListDom.value.setOuterTime(props.bindData);
6733
+ });
6734
+ watch(() => [props.showPopup, props.bindData], ([showPopup, newTimeVal], [, oldTimeVal]) => {
6735
+ if (showPopup || newTimeVal !== oldTimeVal) {
6736
+ timeListDom.value.setOuterTime(newTimeVal);
6737
+ } else {
6738
+ timeListDom.value.resetScrollTop();
6739
+ }
6740
+ });
6741
+ const changTimeData = () => {
6742
+ return timeListDom.value.getNewTime();
6743
+ };
6744
+ const changeData = (value) => {
6745
+ ctx.emit("change", value);
6746
+ };
6747
+ const subDataFun = (e) => {
6748
+ e.stopPropagation();
6749
+ ctx.emit("submitData");
6750
+ };
6751
+ ctx.expose({
6752
+ changTimeData
6753
+ });
6754
+ return () => {
6755
+ var _a, _b;
6756
+ let _slot;
6757
+ return createVNode(Fragment, null, [createVNode("div", {
6758
+ "ref": popupDome,
6759
+ "class": ns2.b(),
6760
+ "style": {
6761
+ width: props.popupWidth + "px"
6762
+ }
6763
+ }, [createVNode(TimeList, {
6764
+ "ref": timeListDom,
6765
+ "hourList": hourList,
6766
+ "minuteList": minuteList,
6767
+ "secondList": secondList,
6768
+ "minTime": props.minTime,
6769
+ "maxTime": props.maxTime,
6770
+ "format": props.popupFormat,
6771
+ "onChange": changeData
6772
+ }, null), createVNode("div", {
6773
+ "class": ns2.m("btn")
6774
+ }, [createVNode("div", {
6775
+ "class": "popup-slots"
6776
+ }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]), createVNode("div", {
6777
+ "onClick": subDataFun
6778
+ }, [createVNode(Button, {
6779
+ "variant": "solid",
6780
+ "color": "secondary",
6781
+ "size": "sm"
6782
+ }, _isSlot(_slot = t("ok")) ? _slot : {
6783
+ default: () => [_slot]
6784
+ })])])])]);
6785
+ };
6786
+ }
6787
+ });
6788
+ const inputProps = {
6789
+ modelValue: {
6790
+ type: String,
6791
+ default: ""
6792
+ },
6793
+ disabled: {
6794
+ type: Boolean,
6795
+ default: false
6796
+ },
6797
+ error: {
6798
+ type: Boolean,
6799
+ default: false
6800
+ },
6801
+ size: {
6802
+ type: String
6803
+ },
6804
+ validateEvent: {
6805
+ type: Boolean,
6806
+ default: true
6807
+ },
6808
+ prefix: {
6809
+ type: String,
6810
+ default: ""
6811
+ },
6812
+ suffix: {
6813
+ type: String,
6814
+ default: ""
6815
+ },
6816
+ showPassword: {
6817
+ type: Boolean,
6818
+ default: false
6819
+ },
6820
+ clearable: {
6821
+ type: Boolean,
6822
+ default: false
6823
+ },
6824
+ placeholder: {
6825
+ type: String,
6826
+ default: ""
6827
+ }
6828
+ };
6829
+ const formItemProps = {
6830
+ label: {
6831
+ type: String
6832
+ },
6833
+ field: {
6834
+ type: String,
6835
+ default: ""
6836
+ },
6837
+ required: {
6838
+ type: Boolean,
6839
+ default: false
6840
+ },
6841
+ messageType: {
6842
+ type: String
6843
+ },
6844
+ popPosition: {
6845
+ type: Array
6846
+ },
6847
+ rules: {
6848
+ type: [Object, Array]
6849
+ },
6850
+ showFeedback: {
6851
+ type: Boolean,
6852
+ default: void 0
6853
+ },
6854
+ helpTips: {
6855
+ type: String,
6856
+ default: ""
6857
+ },
6858
+ feedbackStatus: {
6859
+ type: String
6860
+ },
6861
+ extraInfo: {
6862
+ type: String,
6863
+ default: ""
6864
+ }
6865
+ };
6866
+ const FORM_ITEM_TOKEN = Symbol("dFormItem");
6867
+ const LABEL_DATA = Symbol("labelData");
6868
+ const formProps = {
6869
+ data: {
6870
+ type: Object,
6871
+ default: () => ({})
6872
+ },
6873
+ layout: {
6874
+ type: String,
6875
+ default: "horizontal"
6876
+ },
6877
+ labelSize: {
6878
+ type: String,
6879
+ default: "md"
6880
+ },
6881
+ labelAlign: {
6882
+ type: String,
6883
+ default: "start"
6884
+ },
6885
+ rules: {
6886
+ type: Object
6887
+ },
6888
+ messageType: {
6889
+ type: String,
6890
+ default: "popover"
6891
+ },
6892
+ popPosition: {
6893
+ type: Array,
6894
+ default: ["right", "bottom"]
6895
+ },
6896
+ validateOnRuleChange: {
6897
+ type: Boolean,
6898
+ default: false
6899
+ },
6900
+ showFeedback: {
6901
+ type: Boolean,
6902
+ default: false
6903
+ },
6904
+ disabled: {
6905
+ type: Boolean,
6906
+ default: false
6907
+ },
6908
+ size: {
6909
+ type: String
6910
+ }
6911
+ };
6912
+ const FORM_TOKEN = Symbol("dForm");
6913
+ function useFieldCollection() {
6914
+ const itemContexts = [];
6915
+ const addItemContext = (field) => {
6916
+ itemContexts.push(field);
6917
+ };
6918
+ const removeItemContext = (field) => {
6919
+ itemContexts.splice(itemContexts.indexOf(field), 1);
6920
+ };
6921
+ return { itemContexts, addItemContext, removeItemContext };
6922
+ }
5970
6923
  function useFormValidation(itemContexts) {
5971
6924
  const getValidateFields = (fields) => {
5972
6925
  if (!itemContexts.length) {
@@ -7855,7 +8808,7 @@ var Schema = /* @__PURE__ */ function() {
7855
8808
  complete(results);
7856
8809
  }, source);
7857
8810
  };
7858
- _proto.getType = function getType(rule) {
8811
+ _proto.getType = function getType2(rule) {
7859
8812
  if (rule.type === void 0 && rule.pattern instanceof RegExp) {
7860
8813
  rule.type = "pattern";
7861
8814
  }
@@ -8177,6 +9130,7 @@ function useInputEvent(isFocus, props, ctx, focus) {
8177
9130
  }
8178
9131
  };
8179
9132
  const onInput = (e) => {
9133
+ ctx.emit("input", e.target.value);
8180
9134
  ctx.emit("update:modelValue", e.target.value);
8181
9135
  };
8182
9136
  const onChange = (e) => {
@@ -8209,12 +9163,14 @@ function useInputFunction(input2) {
8209
9163
  return { select, focus, blur };
8210
9164
  }
8211
9165
  var input = "";
8212
- var Input = defineComponent({
9166
+ var DInput = defineComponent({
8213
9167
  name: "DInput",
8214
9168
  inheritAttrs: false,
8215
9169
  props: inputProps,
8216
9170
  emits: ["update:modelValue", "focus", "blur", "input", "change", "keydown", "clear"],
8217
9171
  setup(props, ctx) {
9172
+ const app = getCurrentInstance();
9173
+ const t = createI18nTranslate("DInput", app);
8218
9174
  const formItemContext = inject(FORM_ITEM_TOKEN, void 0);
8219
9175
  const {
8220
9176
  modelValue
@@ -8280,7 +9236,8 @@ var Input = defineComponent({
8280
9236
  "ref": input2,
8281
9237
  "value": modelValue.value,
8282
9238
  "disabled": inputDisabled.value,
8283
- "class": ns2.e("inner")
9239
+ "class": ns2.e("inner"),
9240
+ "placeholder": props.placeholder || t("placeholder")
8284
9241
  }, otherAttrs, {
8285
9242
  "type": props.showPassword ? passwordVisible.value ? "text" : "password" : "text",
8286
9243
  "onInput": onInput,
@@ -8309,742 +9266,118 @@ var Input = defineComponent({
8309
9266
  };
8310
9267
  }
8311
9268
  });
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
- }
9269
+ var timePicker = "";
9270
+ var TimePicker = defineComponent({
9271
+ name: "DTimePicker",
9272
+ components: {
9273
+ TimePopup,
9274
+ DInput
8659
9275
  },
8660
- setup(props) {
9276
+ props: timePickerProps,
9277
+ emits: ["change", "update:modelValue"],
9278
+ setup(props, ctx) {
9279
+ const ns2 = useNamespace("time-picker");
9280
+ const activeHour = ref("00");
9281
+ const activeMinute = ref("00");
9282
+ const activeSecond = ref("00");
9283
+ const format2 = props.format.toLowerCase();
8661
9284
  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
- }
9285
+ showPopup,
9286
+ trueTimeValue,
9287
+ devuiTimePicker,
9288
+ inputDom,
9289
+ overlayRef,
9290
+ showClearIcon,
9291
+ firsthandActiveTime,
9292
+ chooseTime,
9293
+ clickVerifyFun,
9294
+ isOutOpen,
9295
+ clearAll,
9296
+ timePopupDom,
9297
+ vModeValue,
9298
+ changeTimeData
9299
+ } = useTimePicker(activeHour, activeMinute, activeSecond, format2, props);
9300
+ const selectedTimeChange = () => {
9301
+ showPopup.value = false;
9302
+ ctx.emit("change", trueTimeValue.value);
8711
9303
  };
8712
9304
  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
9305
+ isOutOpen();
8909
9306
  });
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;
9307
+ watch(trueTimeValue, (newValue) => {
9308
+ ctx.emit("update:modelValue", trueTimeValue.value);
9309
+ if (newValue !== props.minTime && newValue !== "00:00") {
9310
+ showClearIcon.value = true;
9311
+ } else {
9312
+ showClearIcon.value = false;
8916
9313
  }
8917
- state.show = false;
8918
- };
8919
- onMounted(() => {
8920
- document.addEventListener("click", documentClick);
8921
- });
8922
- onUnmounted(() => {
8923
- document.removeEventListener("click", documentClick);
8924
9314
  });
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
9315
+ ctx.expose({
9316
+ clearAll,
9317
+ chooseTime
9004
9318
  });
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
9319
  return () => {
9017
9320
  return createVNode("div", {
9018
- "class": "devui-stick-slider",
9019
- "onMousedown": handleMainButtonMouseDown,
9020
- "onMouseup": handleMainButtonMouseUp,
9021
- "onMouseleave": handleMainButtonMouseUp
9321
+ "class": ns2.b(),
9322
+ "ref": devuiTimePicker
9022
9323
  }, [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)]);
9324
+ "ref": inputDom
9325
+ }, [createVNode(DInput, {
9326
+ "modelValue": vModeValue.value,
9327
+ "placeholder": props.placeholder,
9328
+ "disabled": props.disabled,
9329
+ "readonly": props.readonly,
9330
+ "size": props.size,
9331
+ "onFocus": clickVerifyFun
9332
+ }, {
9333
+ suffix: () => createVNode("span", {
9334
+ "class": "time-input-icon"
9335
+ }, [createVNode("span", {
9336
+ "onClick": clearAll,
9337
+ "class": "clear-button"
9338
+ }, [showClearIcon.value ? createVNode(Icon, {
9339
+ "size": "small",
9340
+ "name": "close"
9341
+ }, null) : ""]), createVNode(Icon, {
9342
+ "size": "small",
9343
+ "name": "time"
9344
+ }, null)])
9345
+ })]), createVNode(Transition, {
9346
+ "name": "fade"
9347
+ }, {
9348
+ default: () => [createVNode(FlexibleOverlay, {
9349
+ "modelValue": showPopup.value,
9350
+ "onUpdate:modelValue": ($event) => showPopup.value = $event,
9351
+ "ref": overlayRef,
9352
+ "origin": inputDom.value
9353
+ }, {
9354
+ default: () => [createVNode(TimePopup, {
9355
+ "ref": timePopupDom,
9356
+ "showPopup": showPopup.value,
9357
+ "popupWidth": props.timePickerWidth,
9358
+ "popupFormat": props.format.toLowerCase(),
9359
+ "minTime": props.minTime,
9360
+ "maxTime": props.maxTime,
9361
+ "bindData": firsthandActiveTime.value,
9362
+ "onSubmitData": selectedTimeChange,
9363
+ "onChange": changeTimeData
9364
+ }, {
9365
+ default: () => {
9366
+ var _a, _b;
9367
+ return [(_b = (_a = ctx.slots).customViewTemplate) == null ? void 0 : _b.call(_a)];
9368
+ }
9369
+ })]
9370
+ })]
9371
+ })]);
9035
9372
  };
9036
9373
  }
9037
9374
  });
9038
- DatePicker.install = function(app) {
9039
- app.component(DatePicker.name, DatePicker);
9040
- app.component(StickSlider.name, StickSlider);
9041
- };
9042
9375
  var index = {
9043
- title: "DatePicker \u65E5\u671F\u9009\u62E9\u5668",
9376
+ title: "TimePicker \u65F6\u95F4\u9009\u62E9\u5668",
9044
9377
  category: "\u6570\u636E\u5F55\u5165",
9045
- status: "50%",
9378
+ status: "100%",
9046
9379
  install(app) {
9047
- app.use(DatePicker);
9380
+ app.component(TimePicker.name, TimePicker);
9048
9381
  }
9049
9382
  };
9050
- export { DatePicker, StickSlider, index as default };
9383
+ export { TimePicker, index as default };