vue-devui 1.0.0-rc.1 → 1.0.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/README.md +126 -200
  2. package/auto-complete/index.es.js +55 -77
  3. package/auto-complete/index.umd.js +3 -1
  4. package/auto-complete/style.css +1 -1
  5. package/editable-select/index.es.js +118 -162
  6. package/editable-select/index.umd.js +1 -1
  7. package/nuxt/components/tagProps.js +3 -0
  8. package/package.json +1 -1
  9. package/popover/index.es.js +2 -2
  10. package/popover/index.umd.js +4 -4
  11. package/progress/index.es.js +1 -1
  12. package/progress/index.umd.js +1 -1
  13. package/progress/style.css +1 -1
  14. package/radio/index.es.js +8 -2
  15. package/radio/index.umd.js +1 -1
  16. package/radio/style.css +1 -1
  17. package/ripple/index.es.js +43 -42
  18. package/ripple/index.umd.js +1 -1
  19. package/slider/index.es.js +58 -58
  20. package/slider/index.umd.js +1 -1
  21. package/splitter/index.es.js +168 -125
  22. package/splitter/index.umd.js +11 -11
  23. package/style.css +1 -1
  24. package/tag/index.es.js +13 -17
  25. package/tag/index.umd.js +1 -1
  26. package/tag/style.css +1 -1
  27. package/vue-devui.es.js +765 -605
  28. package/vue-devui.umd.js +18 -16
  29. package/accordion/index.d.ts +0 -7
  30. package/accordion/index.es.js +0 -723
  31. package/accordion/index.umd.js +0 -1
  32. package/accordion/package.json +0 -7
  33. package/accordion/style.css +0 -1
  34. package/anchor/index.d.ts +0 -7
  35. package/anchor/index.es.js +0 -263
  36. package/anchor/index.umd.js +0 -1
  37. package/anchor/package.json +0 -7
  38. package/anchor/style.css +0 -1
  39. package/back-top/index.d.ts +0 -7
  40. package/back-top/index.es.js +0 -130
  41. package/back-top/index.umd.js +0 -1
  42. package/back-top/package.json +0 -7
  43. package/back-top/style.css +0 -1
  44. package/breadcrumb/index.d.ts +0 -7
  45. package/breadcrumb/index.es.js +0 -128
  46. package/breadcrumb/index.umd.js +0 -1
  47. package/breadcrumb/package.json +0 -7
  48. package/breadcrumb/style.css +0 -1
  49. package/carousel/index.d.ts +0 -7
  50. package/carousel/index.es.js +0 -314
  51. package/carousel/index.umd.js +0 -1
  52. package/carousel/package.json +0 -7
  53. package/carousel/style.css +0 -1
  54. package/cascader/index.d.ts +0 -7
  55. package/cascader/index.es.js +0 -5971
  56. package/cascader/index.umd.js +0 -27
  57. package/cascader/package.json +0 -7
  58. package/cascader/style.css +0 -1
  59. package/color-picker/index.d.ts +0 -7
  60. package/color-picker/index.es.js +0 -8196
  61. package/color-picker/index.umd.js +0 -27
  62. package/color-picker/package.json +0 -7
  63. package/color-picker/style.css +0 -1
  64. package/date-picker/index.d.ts +0 -7
  65. package/date-picker/index.es.js +0 -1154
  66. package/date-picker/index.umd.js +0 -1
  67. package/date-picker/package.json +0 -7
  68. package/date-picker/style.css +0 -1
  69. package/dragdrop/index.d.ts +0 -7
  70. package/dragdrop/index.es.js +0 -157
  71. package/dragdrop/index.umd.js +0 -1
  72. package/dragdrop/package.json +0 -7
  73. package/drawer/index.d.ts +0 -7
  74. package/drawer/index.es.js +0 -234
  75. package/drawer/index.umd.js +0 -1
  76. package/drawer/package.json +0 -7
  77. package/drawer/style.css +0 -1
  78. package/dropdown/index.d.ts +0 -7
  79. package/dropdown/index.es.js +0 -693
  80. package/dropdown/index.umd.js +0 -1
  81. package/dropdown/package.json +0 -7
  82. package/dropdown/style.css +0 -1
  83. package/form/index.d.ts +0 -7
  84. package/form/index.es.js +0 -7876
  85. package/form/index.umd.js +0 -27
  86. package/form/package.json +0 -7
  87. package/form/style.css +0 -1
  88. package/gantt/index.d.ts +0 -7
  89. package/gantt/index.es.js +0 -523
  90. package/gantt/index.umd.js +0 -1
  91. package/gantt/package.json +0 -7
  92. package/gantt/style.css +0 -1
  93. package/input-icon/index.d.ts +0 -7
  94. package/input-icon/index.es.js +0 -332
  95. package/input-icon/index.umd.js +0 -1
  96. package/input-icon/package.json +0 -7
  97. package/input-icon/style.css +0 -1
  98. package/input-number/index.d.ts +0 -7
  99. package/input-number/index.es.js +0 -229
  100. package/input-number/index.umd.js +0 -1
  101. package/input-number/package.json +0 -7
  102. package/input-number/style.css +0 -1
  103. package/list/index.d.ts +0 -7
  104. package/list/index.es.js +0 -39
  105. package/list/index.umd.js +0 -1
  106. package/list/package.json +0 -7
  107. package/list/style.css +0 -1
  108. package/nav-sprite/index.d.ts +0 -7
  109. package/nav-sprite/index.es.js +0 -68
  110. package/nav-sprite/index.umd.js +0 -1
  111. package/nav-sprite/package.json +0 -7
  112. package/nuxt/components/Accordion.js +0 -3
  113. package/nuxt/components/Anchor.js +0 -3
  114. package/nuxt/components/BackTop.js +0 -3
  115. package/nuxt/components/Breadcrumb.js +0 -3
  116. package/nuxt/components/Carousel.js +0 -3
  117. package/nuxt/components/CarouselItem.js +0 -3
  118. package/nuxt/components/Cascader.js +0 -3
  119. package/nuxt/components/ColorPicker.js +0 -3
  120. package/nuxt/components/Column.js +0 -3
  121. package/nuxt/components/DatePicker.js +0 -3
  122. package/nuxt/components/Drawer.js +0 -3
  123. package/nuxt/components/DrawerService.js +0 -3
  124. package/nuxt/components/Dropdown.js +0 -3
  125. package/nuxt/components/DropdownMenu.js +0 -3
  126. package/nuxt/components/Form.js +0 -3
  127. package/nuxt/components/FormControl.js +0 -3
  128. package/nuxt/components/FormItem.js +0 -3
  129. package/nuxt/components/FormLabel.js +0 -3
  130. package/nuxt/components/FormOperation.js +0 -3
  131. package/nuxt/components/Gantt.js +0 -3
  132. package/nuxt/components/InputIcon.js +0 -3
  133. package/nuxt/components/InputNumber.js +0 -3
  134. package/nuxt/components/List.js +0 -3
  135. package/nuxt/components/ListItem.js +0 -3
  136. package/nuxt/components/NavSprite.js +0 -2
  137. package/nuxt/components/QuadrantDiagram.js +0 -3
  138. package/nuxt/components/Select.js +0 -3
  139. package/nuxt/components/StepsGuide.js +0 -3
  140. package/nuxt/components/StickSlider.js +0 -3
  141. package/nuxt/components/Sticky.js +0 -2
  142. package/nuxt/components/Table.js +0 -3
  143. package/nuxt/components/Tabs.js +0 -3
  144. package/nuxt/components/TimePicker.js +0 -3
  145. package/nuxt/components/Tooltip.js +0 -3
  146. package/nuxt/components/Transfer.js +0 -3
  147. package/nuxt/components/Tree.js +0 -3
  148. package/nuxt/components/TreeSelect.js +0 -3
  149. package/nuxt/components/dropdownMenuProps.js +0 -3
  150. package/nuxt/components/tooltipProps.js +0 -3
  151. package/quadrant-diagram/index.d.ts +0 -7
  152. package/quadrant-diagram/index.es.js +0 -5728
  153. package/quadrant-diagram/index.umd.js +0 -27
  154. package/quadrant-diagram/package.json +0 -7
  155. package/quadrant-diagram/style.css +0 -1
  156. package/select/index.d.ts +0 -7
  157. package/select/index.es.js +0 -706
  158. package/select/index.umd.js +0 -1
  159. package/select/package.json +0 -7
  160. package/select/style.css +0 -1
  161. package/steps-guide/index.d.ts +0 -7
  162. package/steps-guide/index.es.js +0 -242
  163. package/steps-guide/index.umd.js +0 -1
  164. package/steps-guide/package.json +0 -7
  165. package/steps-guide/style.css +0 -1
  166. package/sticky/index.d.ts +0 -7
  167. package/sticky/index.es.js +0 -197
  168. package/sticky/index.umd.js +0 -1
  169. package/sticky/package.json +0 -7
  170. package/table/index.d.ts +0 -7
  171. package/table/index.es.js +0 -2024
  172. package/table/index.umd.js +0 -1
  173. package/table/package.json +0 -7
  174. package/table/style.css +0 -1
  175. package/tabs/index.d.ts +0 -7
  176. package/tabs/index.es.js +0 -194
  177. package/tabs/index.umd.js +0 -1
  178. package/tabs/package.json +0 -7
  179. package/tabs/style.css +0 -1
  180. package/time-picker/index.d.ts +0 -7
  181. package/time-picker/index.es.js +0 -1238
  182. package/time-picker/index.umd.js +0 -1
  183. package/time-picker/package.json +0 -7
  184. package/time-picker/style.css +0 -1
  185. package/tooltip/index.d.ts +0 -7
  186. package/tooltip/index.es.js +0 -5835
  187. package/tooltip/index.umd.js +0 -27
  188. package/tooltip/package.json +0 -7
  189. package/tooltip/style.css +0 -1
  190. package/transfer/index.d.ts +0 -7
  191. package/transfer/index.es.js +0 -7615
  192. package/transfer/index.umd.js +0 -27
  193. package/transfer/package.json +0 -7
  194. package/transfer/style.css +0 -1
  195. package/tree/index.d.ts +0 -7
  196. package/tree/index.es.js +0 -6495
  197. package/tree/index.umd.js +0 -27
  198. package/tree/package.json +0 -7
  199. package/tree/style.css +0 -1
  200. package/tree-select/index.d.ts +0 -7
  201. package/tree-select/index.es.js +0 -627
  202. package/tree-select/index.umd.js +0 -1
  203. package/tree-select/package.json +0 -7
  204. package/tree-select/style.css +0 -1
@@ -1,1238 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
- var __hasOwnProp = Object.prototype.hasOwnProperty;
4
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
- var __spreadValues = (a, b) => {
7
- for (var prop in b || (b = {}))
8
- if (__hasOwnProp.call(b, prop))
9
- __defNormalProp(a, prop, b[prop]);
10
- if (__getOwnPropSymbols)
11
- for (var prop of __getOwnPropSymbols(b)) {
12
- if (__propIsEnum.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- }
15
- return a;
16
- };
17
- var __publicField = (obj, key, value) => {
18
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
19
- return value;
20
- };
21
- import { defineComponent, toRefs, createVNode, reactive, ref, onMounted, onBeforeUnmount, onUnmounted, Fragment, h, render, computed, withDirectives, resolveDirective, watch, createTextVNode } from "vue";
22
- const timePickerProps = {
23
- modelValue: {
24
- type: String,
25
- default: ""
26
- },
27
- placeholder: {
28
- type: String,
29
- default: "00:00:00"
30
- },
31
- disabled: {
32
- type: Boolean,
33
- default: false
34
- },
35
- timePickerWidth: {
36
- type: Number,
37
- default: 212
38
- },
39
- minTime: {
40
- type: String,
41
- default: "00:00:00"
42
- },
43
- maxTime: {
44
- type: String,
45
- default: "23:59:59"
46
- },
47
- format: {
48
- type: String,
49
- default: "hh:mm:ss"
50
- },
51
- autoOpen: {
52
- type: Boolean,
53
- default: false
54
- },
55
- showAnimation: {
56
- type: Boolean,
57
- default: true
58
- }
59
- };
60
- const iconProps = {
61
- name: {
62
- type: String,
63
- default: "",
64
- required: true
65
- },
66
- size: {
67
- type: String,
68
- default: "inherit"
69
- },
70
- color: {
71
- type: String,
72
- default: "inherit"
73
- },
74
- classPrefix: {
75
- type: String,
76
- default: "icon"
77
- }
78
- };
79
- var Icon = defineComponent({
80
- name: "DIcon",
81
- props: iconProps,
82
- setup(props) {
83
- const {
84
- name,
85
- size,
86
- color,
87
- classPrefix
88
- } = toRefs(props);
89
- return () => {
90
- return /^((https?):)?\/\//.test(name.value) ? createVNode("img", {
91
- "src": name.value,
92
- "alt": name.value.split("/")[name.value.split("/").length - 1],
93
- "style": {
94
- width: size.value,
95
- verticalAlign: "text-bottom"
96
- }
97
- }, null) : createVNode("i", {
98
- "class": `${classPrefix.value} ${classPrefix.value}-${name.value}`,
99
- "style": {
100
- fontSize: size.value,
101
- color: color.value
102
- }
103
- }, null);
104
- };
105
- }
106
- });
107
- function getPositionFun(el, left, top) {
108
- const inputDom = el.getBoundingClientRect();
109
- const button2 = window.innerHeight - (inputDom.top + 20);
110
- if (button2 > inputDom.top + 20) {
111
- left.value = inputDom.x;
112
- top.value = inputDom.top + 20 + 10;
113
- } else {
114
- left.value = inputDom.x;
115
- top.value = inputDom.top - 316;
116
- }
117
- }
118
- function initializeTimeData(type) {
119
- const timeArr = reactive([]);
120
- let arrLenght = 0;
121
- if (type == "hour") {
122
- arrLenght = 24;
123
- } else {
124
- arrLenght = 60;
125
- }
126
- for (let i = 0; i < arrLenght; i++) {
127
- timeArr.push({
128
- time: i < 10 ? "0" + i : i + "",
129
- isActive: false,
130
- flag: type,
131
- isDisabled: false
132
- });
133
- }
134
- return timeArr;
135
- }
136
- const setTimeAstrict = (hourList, minuteList, secondList, minTime, maxTime, format) => {
137
- const maxTimeHour = maxTime.split(":")[0];
138
- const maxTimeMinute = maxTime.split(":")[1];
139
- const minTimeHour = minTime.split(":")[0];
140
- const minTimeMinute = minTime.split(":")[1];
141
- const minTimeSecond = minTime.split(":")[2];
142
- hourList.map((item, index2) => {
143
- if (item.time < minTimeHour || item.time > maxTimeHour) {
144
- item.isDisabled = true;
145
- }
146
- });
147
- if (format == "mm:ss") {
148
- minuteList.map((item, index2) => {
149
- if (item.time < minTimeMinute || item.time > maxTimeMinute) {
150
- item.isDisabled = true;
151
- }
152
- });
153
- } else {
154
- minuteList.map((item, index2) => {
155
- if (item.time < minTimeMinute) {
156
- item.isDisabled = true;
157
- }
158
- });
159
- }
160
- secondList.map((item, index2) => {
161
- if (item.time < minTimeSecond) {
162
- item.isDisabled = true;
163
- }
164
- });
165
- };
166
- function useTimePicker(hh, mm, ss, minTime, maxTime, format, autoOpen, disabled, value) {
167
- const isActive = ref(false);
168
- const showPopup = ref(false);
169
- const devuiTimePicker = ref();
170
- const inputDom = ref();
171
- const left = ref(-100);
172
- const top = ref(-100);
173
- const timePopupDom = ref();
174
- const timePickerValue = ref("");
175
- const showClearIcon = ref(false);
176
- const firsthandActiveTime = ref(`${hh.value}:${mm.value}:${ss.value}`);
177
- const vModeValue = ref(value);
178
- const getPopupPosition = () => {
179
- getPositionFun(devuiTimePicker.value, left, top);
180
- };
181
- const clickVerifyFun = (e) => {
182
- e.stopPropagation();
183
- isActive.value = false;
184
- showPopup.value = false;
185
- if (disabled) {
186
- return;
187
- }
188
- const path = e.composedPath && e.composedPath() || e.path;
189
- const inInputDom = path.includes(devuiTimePicker.value);
190
- inInputDom && mouseInIputFun();
191
- };
192
- const mouseInIputFun = () => {
193
- if (firsthandActiveTime.value == "00:00:00") {
194
- const vModelValueArr = value.split(":");
195
- const minTimeValueArr = minTime.split(":");
196
- const maxTimeValueArr = maxTime.split(":");
197
- vModeValue.value == "" ? vModeValue.value = "00:00:00" : "";
198
- if (value > minTime && value < maxTime) {
199
- firsthandActiveTime.value = value;
200
- setInputValue(vModelValueArr[0], vModelValueArr[1], vModelValueArr[2]);
201
- } else if (value > maxTime) {
202
- firsthandActiveTime.value = maxTime;
203
- setInputValue(maxTimeValueArr[0], maxTimeValueArr[1], maxTimeValueArr[2]);
204
- } else {
205
- firsthandActiveTime.value = minTime;
206
- setInputValue(minTimeValueArr[0], minTimeValueArr[1], minTimeValueArr[2]);
207
- }
208
- }
209
- isActive.value = true;
210
- showPopup.value = true;
211
- };
212
- const vModelIsBeyond = () => {
213
- if (vModeValue.value != "" && vModeValue.value < minTime) {
214
- vModeValue.value = minTime;
215
- } else if (vModeValue.value != "" && vModeValue.value > maxTime) {
216
- vModeValue.value = maxTime;
217
- }
218
- const vModelValueArr = vModeValue.value.split(":");
219
- vModeValue.value && setInputValue(vModelValueArr[0], vModelValueArr[1], vModelValueArr[2]);
220
- };
221
- const getTimeValue = (e) => {
222
- e.stopPropagation();
223
- if (showPopup.value) {
224
- hh.value = timePopupDom.value.changTimeData().activeHour.value;
225
- mm.value = timePopupDom.value.changTimeData().activeMinute.value;
226
- ss.value = timePopupDom.value.changTimeData().activeSecond.value;
227
- firsthandActiveTime.value = `${hh.value}:${mm.value}:${ss.value}`;
228
- setInputValue(hh.value, mm.value, ss.value);
229
- }
230
- };
231
- const setInputValue = (hh2, mm2, ss2) => {
232
- if (format == "hh:mm:ss") {
233
- vModeValue.value = `${hh2}:${mm2}:${ss2}`;
234
- } else if (format == "mm:hh:ss") {
235
- vModeValue.value = `${mm2}:${hh2}:${ss2}`;
236
- } else if (format == "hh:mm") {
237
- vModeValue.value = `${hh2}:${mm2}`;
238
- } else if (format == "mm:ss") {
239
- vModeValue.value = `${mm2}:${ss2}`;
240
- }
241
- };
242
- const clearAll = (e) => {
243
- e.stopPropagation();
244
- showPopup.value = false;
245
- if (minTime != "00:00:00") {
246
- const minTimeArr = minTime.split(":");
247
- hh.value = minTimeArr[0];
248
- mm.value = minTimeArr[1];
249
- ss.value = minTimeArr[2];
250
- } else {
251
- hh.value = "00";
252
- mm.value = "00";
253
- ss.value = "00";
254
- }
255
- firsthandActiveTime.value = `${hh.value}:${mm.value}:${ss.value}`;
256
- setInputValue(hh.value, mm.value, ss.value);
257
- };
258
- const isOutOpen = () => {
259
- if (autoOpen) {
260
- const timeArr = vModeValue.value.split(":");
261
- hh.value = timeArr[0];
262
- mm.value = timeArr[1];
263
- ss.value = timeArr[2];
264
- firsthandActiveTime.value = vModeValue.value;
265
- setInputValue(hh.value, mm.value, ss.value);
266
- isActive.value = true;
267
- showPopup.value = autoOpen;
268
- }
269
- };
270
- const chooseTime = (slotTime) => {
271
- if (slotTime.type) {
272
- if (slotTime.type.toLowerCase() == "hh") {
273
- hh.value = slotTime.time;
274
- } else if (slotTime.type.toLowerCase() == "mm") {
275
- mm.value = slotTime.time;
276
- } else if (slotTime.type.toLowerCase() == "ss") {
277
- ss.value = slotTime.time;
278
- }
279
- firsthandActiveTime.value = `${hh.value}:${mm.value}:${ss.value}`;
280
- setInputValue(hh.value, mm.value, ss.value);
281
- } else {
282
- const timeArr = slotTime.time.split(":");
283
- hh.value = timeArr[0];
284
- mm.value = timeArr[1];
285
- ss.value = timeArr[2];
286
- firsthandActiveTime.value = `${hh.value}:${mm.value}:${ss.value}`;
287
- setInputValue(hh.value, mm.value, ss.value);
288
- }
289
- };
290
- return {
291
- isActive,
292
- showPopup,
293
- devuiTimePicker,
294
- timePickerValue,
295
- inputDom,
296
- timePopupDom,
297
- left,
298
- top,
299
- showClearIcon,
300
- firsthandActiveTime,
301
- vModeValue,
302
- getPopupPosition,
303
- getTimeValue,
304
- clickVerifyFun,
305
- isOutOpen,
306
- vModelIsBeyond,
307
- clearAll,
308
- chooseTime
309
- };
310
- }
311
- const usePopupLine = (hourListRef, minuteListRef, secondListRef, minTime, maxTime, format, timeListDom) => {
312
- const activeTime = ref("00:00:00");
313
- const activeHour = ref("00");
314
- const activeMinute = ref("00");
315
- const activeSecond = ref("00");
316
- const activeTimeFun = (e, item, index2) => {
317
- if (item.isDisabled) {
318
- return false;
319
- } else {
320
- setTimeActive(item, index2);
321
- e.target.parentElement.parentElement.scrollTop = index2 * 32;
322
- }
323
- };
324
- const setTimeActive = (item, index2) => {
325
- let activeTimeList = [];
326
- let acitveTimeValue = ref("");
327
- if (item.flag == "hour") {
328
- activeTimeList = hourListRef;
329
- acitveTimeValue = activeHour;
330
- getItemAstrict(item);
331
- } else if (item.flag == "minute") {
332
- activeTimeList = minuteListRef;
333
- acitveTimeValue = activeMinute;
334
- getItemAstrict(item);
335
- } else if (item.flag == "second") {
336
- activeTimeList = secondListRef;
337
- acitveTimeValue = activeSecond;
338
- }
339
- activeTimeList.map((tiemItem, tiemeIndex) => {
340
- tiemItem.isActive = index2 === tiemeIndex;
341
- });
342
- acitveTimeValue.value = activeTimeList[index2].time;
343
- activeTime.value = `${activeHour.value}:${activeMinute.value}:${activeSecond.value}`;
344
- if (activeTime.value < minTime) {
345
- activeTime.value = minTime;
346
- resetTimeValue(minTime);
347
- } else if (format == "mm:ss" && `${activeMinute.value}:${activeSecond.value}` > maxTime.slice(3)) {
348
- const newMinTime = minTime.slice(0, 3) + maxTime.slice(3);
349
- resetTimeValue(newMinTime);
350
- } else if (activeTime.value > maxTime) {
351
- activeTime.value = maxTime;
352
- resetTimeValue(maxTime);
353
- }
354
- };
355
- const getItemAstrict = (item) => {
356
- let min = "00";
357
- let max = "00";
358
- const minTimeHour = minTime.split(":")[0];
359
- const minTimeMinute = minTime.split(":")[1];
360
- const minTimeSecond = minTime.split(":")[2];
361
- const maxTimeHour = maxTime.split(":")[0];
362
- const maxTimeMinute = maxTime.split(":")[1];
363
- const maxTimeSecond = maxTime.split(":")[2];
364
- if (item.flag == "hour") {
365
- if (item.time == minTimeHour) {
366
- min = minTimeMinute;
367
- setItemAstrict(minuteListRef, min, max);
368
- activeMinute.value < minTimeMinute && setItemAstrict(secondListRef, minTimeSecond, max);
369
- } else if (item.time == maxTimeHour) {
370
- max = maxTimeMinute;
371
- setItemAstrict(minuteListRef, min, max);
372
- setItemAstrict(secondListRef, min, maxTimeSecond);
373
- } else {
374
- setItemAstrict(minuteListRef, min, max);
375
- setItemAstrict(secondListRef, min, max);
376
- }
377
- }
378
- if (item.flag == "minute" && format == "mm:ss") {
379
- if (item.time == minTimeMinute) {
380
- min = minTimeSecond;
381
- setItemAstrict(secondListRef, min, max);
382
- } else if (item.time == maxTimeMinute) {
383
- max = maxTimeSecond;
384
- setItemAstrict(secondListRef, min, max);
385
- } else {
386
- setItemAstrict(secondListRef, min, max);
387
- }
388
- } else if (item.flag == "minute") {
389
- if (activeHour.value == minTimeHour && item.time == minTimeMinute) {
390
- min = minTimeSecond;
391
- setItemAstrict(secondListRef, min, max);
392
- } else if (activeHour.value == maxTimeHour && item.time == maxTimeMinute) {
393
- max = maxTimeSecond;
394
- setItemAstrict(secondListRef, min, max);
395
- } else {
396
- setItemAstrict(secondListRef, min, max);
397
- }
398
- }
399
- };
400
- const setItemAstrict = (timeArr, min, max) => {
401
- timeArr.map((itme) => {
402
- if (min != "00" && itme.time < min) {
403
- itme.isDisabled = true;
404
- } else if (max != "00" && itme.time > max) {
405
- itme.isDisabled = true;
406
- } else {
407
- itme.isDisabled = false;
408
- }
409
- });
410
- };
411
- const resetTimeValue = (time) => {
412
- const timeValueArr = time.split(":");
413
- const minTiveArr = minTime.split(":");
414
- let hh = 0;
415
- let mm = 0;
416
- let ss = 0;
417
- if (format == "hh:mm:ss") {
418
- hh = parseInt(timeValueArr[0]);
419
- mm = parseInt(timeValueArr[1]);
420
- ss = parseInt(timeValueArr[2]);
421
- timeListDom.value.children[0].lastElementChild.children[0].scrollTop = hh * 32;
422
- timeListDom.value.children[1].lastElementChild.children[0].scrollTop = mm * 32;
423
- timeListDom.value.children[2].lastElementChild.children[0].scrollTop = ss * 32;
424
- activeHour.value = timeValueArr[0];
425
- activeMinute.value = timeValueArr[1];
426
- activeSecond.value = timeValueArr[2];
427
- resetTimeActive(hourListRef, timeValueArr[0]);
428
- resetTimeActive(minuteListRef, timeValueArr[1]);
429
- resetTimeActive(secondListRef, timeValueArr[2]);
430
- resetTimeAstrict(hourListRef, activeHour.value);
431
- resetTimeAstrict(minuteListRef, activeMinute.value);
432
- } else if (format == "mm:hh:ss") {
433
- hh = parseInt(timeValueArr[0]);
434
- mm = parseInt(timeValueArr[1]);
435
- ss = parseInt(timeValueArr[2]);
436
- timeListDom.value.children[0].lastElementChild.children[0].scrollTop = mm * 32;
437
- timeListDom.value.children[1].lastElementChild.children[0].scrollTop = hh * 32;
438
- timeListDom.value.children[2].lastElementChild.children[0].scrollTop = ss * 32;
439
- activeHour.value = timeValueArr[0];
440
- activeMinute.value = timeValueArr[1];
441
- activeSecond.value = timeValueArr[2];
442
- resetTimeActive(hourListRef, timeValueArr[0]);
443
- resetTimeActive(minuteListRef, timeValueArr[1]);
444
- resetTimeActive(secondListRef, timeValueArr[2]);
445
- resetTimeAstrict(hourListRef, activeHour.value);
446
- resetTimeAstrict(minuteListRef, activeMinute.value);
447
- } else if (format == "hh:mm") {
448
- hh = parseInt(timeValueArr[0]);
449
- mm = parseInt(timeValueArr[1]);
450
- timeListDom.value.children[0].lastElementChild.children[0].scrollTop = hh * 32;
451
- timeListDom.value.children[1].lastElementChild.children[0].scrollTop = mm * 32;
452
- activeHour.value = timeValueArr[0];
453
- activeMinute.value = timeValueArr[1];
454
- resetTimeActive(hourListRef, timeValueArr[0]);
455
- resetTimeActive(minuteListRef, timeValueArr[1]);
456
- resetTimeAstrict(hourListRef, activeHour.value);
457
- } else if (format == "mm:ss") {
458
- mm = parseInt(timeValueArr[1]);
459
- ss = parseInt(timeValueArr[2]);
460
- timeListDom.value.children[0].lastElementChild.children[0].scrollTop = mm * 32;
461
- timeListDom.value.children[1].lastElementChild.children[0].scrollTop = ss * 32;
462
- activeHour.value = minTiveArr[0];
463
- activeMinute.value = timeValueArr[1];
464
- activeSecond.value = timeValueArr[2];
465
- resetTimeActive(minuteListRef, timeValueArr[1]);
466
- resetTimeActive(secondListRef, timeValueArr[2]);
467
- resetTimeAstrict(minuteListRef, activeMinute.value);
468
- }
469
- };
470
- const resetTimeAstrict = (timeArr, time) => {
471
- timeArr.map((item) => {
472
- if (item.time == time) {
473
- getItemAstrict(item);
474
- }
475
- });
476
- };
477
- const resetTimeActive = (timeArr, itemValue) => {
478
- timeArr.map((item) => {
479
- item.isActive = item.time === itemValue;
480
- });
481
- };
482
- const getNewTime = () => {
483
- return { activeTime, activeHour, activeMinute, activeSecond };
484
- };
485
- const resetScrollTop = () => {
486
- for (let i = 0; i < timeListDom.value.children.length; i++) {
487
- timeListDom.value.children[i].lastElementChild.children[0].scrollTop = 0;
488
- }
489
- };
490
- return {
491
- activeTime,
492
- activeHour,
493
- activeMinute,
494
- activeSecond,
495
- activeTimeFun,
496
- resetTimeValue,
497
- getNewTime,
498
- resetScrollTop
499
- };
500
- };
501
- function useTimeScroll() {
502
- const scrollBoxDom = ref();
503
- const scrollContentDom = ref();
504
- const scrollThumbDom = ref();
505
- const scrollTrackDom = ref();
506
- const isDown = ref(false);
507
- const getScrollHeight = () => {
508
- const thumbHeight = scrollContentDom.value.clientHeight / scrollContentDom.value.scrollHeight * 100;
509
- scrollThumbDom.value.style.height = thumbHeight + "%";
510
- };
511
- const setVirtualScroll = () => {
512
- const thumbMoveY = scrollContentDom.value.scrollTop * 100 / scrollContentDom.value.clientHeight;
513
- scrollThumbDom.value.style.transform = `translateY(${thumbMoveY}%)`;
514
- };
515
- const clickTrackFun = (e) => {
516
- const offsetNum = scrollTrackDom.value.getBoundingClientRect().top - e.clientY;
517
- const offset = Math.abs(offsetNum > 0 ? 0 : offsetNum);
518
- const thumbCenter = scrollThumbDom.value.offsetHeight / 2;
519
- const thumbPosition = (offset - thumbCenter) * 100 / scrollContentDom.value.offsetHeight;
520
- scrollContentDom.value.scrollTop = thumbPosition * scrollContentDom.value.scrollHeight / 100;
521
- scrollContentDom.value.style.top = scrollContentDom.value.scrollTop + "px";
522
- };
523
- const mouseDownThum = () => {
524
- isDown.value = true;
525
- scrollTrackDom.value.style.opacity = 1;
526
- };
527
- const mouseOutThum = (e) => {
528
- isDown.value = false;
529
- thumbMouseMove(e);
530
- };
531
- const thumbMouseMove = (e) => {
532
- const path = e.composedPath && e.composedPath() || e.path;
533
- if (path.includes(scrollBoxDom.value) || isDown.value) {
534
- scrollTrackDom.value.style.opacity = 1;
535
- } else {
536
- scrollTrackDom.value.style.opacity = 0;
537
- }
538
- if (!isDown.value) {
539
- return;
540
- }
541
- clickTrackFun(e);
542
- };
543
- const getScrollWidth = () => {
544
- const ua = navigator.userAgent;
545
- let marginRight = -20;
546
- if (ua.indexOf("Chrome") > -1) {
547
- marginRight = -8;
548
- } else {
549
- const outer = document.createElement("div");
550
- outer.className = "devui-scrollbar-wrap";
551
- outer.style.width = "100px";
552
- outer.style.visibility = "hidden";
553
- outer.style.position = "absolute";
554
- outer.style.top = "-9999px";
555
- document.body.appendChild(outer);
556
- const widthNoScroll = outer.offsetWidth;
557
- outer.style.overflow = "scroll";
558
- const inner = document.createElement("div");
559
- inner.style.width = "100%";
560
- outer.appendChild(inner);
561
- const widthWithScroll = inner.offsetWidth;
562
- outer.parentNode.removeChild(outer);
563
- marginRight = (widthNoScroll - widthWithScroll + 3) * -1;
564
- }
565
- return marginRight;
566
- };
567
- return {
568
- scrollThumbDom,
569
- scrollTrackDom,
570
- scrollContentDom,
571
- scrollBoxDom,
572
- isDown,
573
- getScrollHeight,
574
- setVirtualScroll,
575
- clickTrackFun,
576
- mouseDownThum,
577
- mouseOutThum,
578
- thumbMouseMove,
579
- getScrollWidth
580
- };
581
- }
582
- var index$3 = "";
583
- var TimeScroll = defineComponent({
584
- name: "DTimeScroll",
585
- props: timePickerProps,
586
- setup(props, ctx) {
587
- const {
588
- scrollBoxDom,
589
- scrollThumbDom,
590
- scrollTrackDom,
591
- scrollContentDom,
592
- isDown,
593
- getScrollHeight,
594
- setVirtualScroll,
595
- clickTrackFun,
596
- mouseDownThum,
597
- mouseOutThum,
598
- thumbMouseMove,
599
- getScrollWidth
600
- } = useTimeScroll();
601
- const marginRight = getScrollWidth();
602
- onMounted(() => {
603
- getScrollWidth();
604
- getScrollHeight();
605
- scrollBoxDom.value.addEventListener("click", setVirtualScroll);
606
- scrollContentDom.value.addEventListener("scroll", setVirtualScroll);
607
- scrollThumbDom.value.addEventListener("mousedown", mouseDownThum);
608
- document.addEventListener("mouseup", mouseOutThum);
609
- document.addEventListener("mousemove", thumbMouseMove);
610
- });
611
- onBeforeUnmount(() => {
612
- scrollBoxDom.value.removeEventListener("click", setVirtualScroll);
613
- scrollContentDom.value.removeEventListener("scroll", setVirtualScroll);
614
- scrollThumbDom.value.removeEventListener("mousedown", mouseDownThum);
615
- });
616
- onUnmounted(() => {
617
- document.removeEventListener("mouseup", mouseOutThum);
618
- document.removeEventListener("mousemove", thumbMouseMove);
619
- });
620
- return () => {
621
- var _a, _b;
622
- return createVNode(Fragment, null, [createVNode("div", {
623
- "ref": scrollBoxDom,
624
- "class": "devui-scroll-box"
625
- }, [createVNode("div", {
626
- "ref": scrollContentDom,
627
- "class": `box-content ${isDown.value || !props.showAnimation ? "box-content-behavior-auto" : ""}`,
628
- "style": {
629
- "margin-right": marginRight + "px"
630
- }
631
- }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]), createVNode("div", {
632
- "ref": scrollTrackDom,
633
- "class": "box-sroll",
634
- "onClick": clickTrackFun
635
- }, [createVNode("div", {
636
- "ref": scrollThumbDom,
637
- "class": "scroll-child"
638
- }, null)])])]);
639
- };
640
- }
641
- });
642
- var index$2 = "";
643
- var TimeList = defineComponent({
644
- name: "DTimeList",
645
- components: {
646
- TimeScroll
647
- },
648
- props: {
649
- hourList: {
650
- type: Array,
651
- default: () => []
652
- },
653
- minuteList: {
654
- type: Array,
655
- default: () => []
656
- },
657
- secondList: {
658
- type: Array,
659
- default: () => []
660
- },
661
- format: {
662
- type: String,
663
- default: "hh:mm:ss"
664
- },
665
- minTime: {
666
- type: String,
667
- default: "00:00:00"
668
- },
669
- maxTime: {
670
- type: String,
671
- default: "23:59:59"
672
- }
673
- },
674
- setup(props, ctx) {
675
- const timeListDom = ref();
676
- const {
677
- getNewTime,
678
- activeTimeFun,
679
- resetTimeValue,
680
- resetScrollTop
681
- } = usePopupLine(props.hourList, props.minuteList, props.secondList, props.minTime, props.maxTime, props.format, timeListDom);
682
- const setOutoTime = (time) => {
683
- resetTimeValue(time);
684
- };
685
- const TimeLi = (timeArr) => {
686
- return timeArr.map((item, index2) => {
687
- return createVNode("li", {
688
- "class": `time-li ${item.flag}Id-${index2} ${item.isActive ? "active-li" : ""} ${item.isDisabled ? "disabled-li" : ""}`,
689
- "onClick": (e) => {
690
- activeTimeFun(e, item, index2);
691
- }
692
- }, [createVNode("span", null, [item.time])]);
693
- });
694
- };
695
- const TimeUl = (timeList) => {
696
- return createVNode("div", {
697
- "class": "time-item",
698
- "style": {
699
- "flex": 1
700
- }
701
- }, [createVNode(TimeScroll, null, {
702
- default: () => [createVNode("ul", {
703
- "class": "time-ul"
704
- }, [TimeLi(timeList)])]
705
- })]);
706
- };
707
- const formatTimeUl = () => {
708
- const timeList = {
709
- "hh": props.hourList,
710
- "mm": props.minuteList,
711
- "ss": props.secondList
712
- };
713
- const timeFormatArr = props.format.split(":");
714
- return timeFormatArr.map((timeItme) => {
715
- return TimeUl(timeList[timeItme]);
716
- });
717
- };
718
- ctx.expose({
719
- resetScrollTop,
720
- setOutoTime,
721
- getNewTime
722
- });
723
- return () => {
724
- return createVNode("div", {
725
- "class": "devui-time-list",
726
- "ref": timeListDom
727
- }, [formatTimeUl()]);
728
- };
729
- }
730
- });
731
- class View {
732
- constructor() {
733
- __publicField(this, "top", "50%");
734
- __publicField(this, "left", "50%");
735
- }
736
- }
737
- const componentProps = {
738
- message: String,
739
- backdrop: Boolean,
740
- view: {
741
- type: Object,
742
- default: () => new View()
743
- },
744
- zIndex: Number,
745
- isFull: {
746
- type: Boolean,
747
- default: false
748
- }
749
- };
750
- class LoadingProps {
751
- constructor() {
752
- __publicField(this, "target");
753
- __publicField(this, "message");
754
- __publicField(this, "loadingTemplateRef");
755
- __publicField(this, "backdrop", true);
756
- __publicField(this, "positionType", "relative");
757
- __publicField(this, "view", new View());
758
- __publicField(this, "zIndex");
759
- }
760
- }
761
- var loading = "";
762
- var Loading = defineComponent({
763
- name: "DLoading",
764
- inheritAttrs: false,
765
- props: componentProps,
766
- setup(props) {
767
- const style = {
768
- top: props.view.top,
769
- left: props.view.left,
770
- zIndex: props.zIndex
771
- };
772
- if (!props.message) {
773
- style.background = "none";
774
- }
775
- const isShow = ref(false);
776
- const open = () => {
777
- isShow.value = true;
778
- };
779
- const close = () => {
780
- isShow.value = false;
781
- };
782
- return {
783
- style,
784
- isShow,
785
- open,
786
- close
787
- };
788
- },
789
- render() {
790
- var _a;
791
- const {
792
- isShow,
793
- isFull,
794
- backdrop,
795
- style,
796
- message,
797
- $slots
798
- } = this;
799
- return isShow && createVNode("div", {
800
- "class": ["devui-loading-contanier", isFull ? "devui-loading--full" : ""]
801
- }, [((_a = $slots.default) == null ? void 0 : _a.call($slots)) || createVNode("div", {
802
- "class": "devui-loading-wrapper"
803
- }, [backdrop ? createVNode("div", {
804
- "class": "devui-loading-mask"
805
- }, null) : null, createVNode("div", {
806
- "style": style,
807
- "class": "devui-loading-area"
808
- }, [createVNode("div", {
809
- "class": "devui-busy-default-spinner"
810
- }, [createVNode("div", {
811
- "class": "devui-loading-bar1"
812
- }, null), createVNode("div", {
813
- "class": "devui-loading-bar2"
814
- }, null), createVNode("div", {
815
- "class": "devui-loading-bar3"
816
- }, null), createVNode("div", {
817
- "class": "devui-loading-bar4"
818
- }, null)]), message ? createVNode("span", {
819
- "class": "devui-loading-text"
820
- }, [message]) : null])])]);
821
- }
822
- });
823
- const COMPONENT_CONTAINER_SYMBOL = Symbol("dev_component_container");
824
- function createComponent(Component, props, children = null) {
825
- const vnode = h(Component, __spreadValues({}, props), children);
826
- const container = document.createElement("div");
827
- vnode[COMPONENT_CONTAINER_SYMBOL] = container;
828
- render(vnode, container);
829
- return vnode.component;
830
- }
831
- function unmountComponent(ComponnetInstance) {
832
- render(null, ComponnetInstance == null ? void 0 : ComponnetInstance.vnode[COMPONENT_CONTAINER_SYMBOL]);
833
- }
834
- const loadingConstructor = defineComponent(Loading);
835
- const cacheInstance = /* @__PURE__ */ new WeakSet();
836
- const isEmpty = (val) => {
837
- if (!val)
838
- return true;
839
- if (Array.isArray(val))
840
- return val.length === 0;
841
- if (val instanceof Set || val instanceof Map)
842
- return val.size === 0;
843
- if (val instanceof Promise)
844
- return false;
845
- if (typeof val === "object") {
846
- try {
847
- return Object.keys(val).length === 0;
848
- } catch (e) {
849
- return false;
850
- }
851
- }
852
- return false;
853
- };
854
- const getType = (vari) => {
855
- return Object.prototype.toString.call(vari).slice(8, -1).toLowerCase();
856
- };
857
- const isPromise = (value) => {
858
- const type = getType(value);
859
- switch (type) {
860
- case "promise":
861
- return [value];
862
- case "array":
863
- if (value.some((val) => getType(val) !== "promise")) {
864
- console.error(new TypeError("Binding values should all be of type Promise"));
865
- return "error";
866
- }
867
- return value;
868
- default:
869
- return false;
870
- }
871
- };
872
- const unmount = (el) => {
873
- cacheInstance.delete(el);
874
- el.instance.proxy.close();
875
- unmountComponent(el.instance);
876
- };
877
- const toggleLoading = (el, binding) => {
878
- if (binding.value) {
879
- const vals = isPromise(binding.value);
880
- if (vals === "error")
881
- return;
882
- el.instance.proxy.open();
883
- el.appendChild(el.mask);
884
- cacheInstance.add(el);
885
- if (vals) {
886
- Promise.all(vals).catch((err) => {
887
- console.error(new Error("Promise handling errors"), err);
888
- }).finally(() => {
889
- unmount(el);
890
- });
891
- }
892
- } else {
893
- unmount(el);
894
- }
895
- };
896
- const removeAttribute = (el) => {
897
- el.removeAttribute("zindex");
898
- el.removeAttribute("positiontype");
899
- el.removeAttribute("backdrop");
900
- el.removeAttribute("message");
901
- el.removeAttribute("view");
902
- el.removeAttribute("loadingtemplateref");
903
- };
904
- const handleProps = (el, vprops) => {
905
- const props = __spreadValues(__spreadValues({}, new LoadingProps()), vprops);
906
- const loadingTemplateRef = props.loadingTemplateRef;
907
- const loadingInstance = createComponent(loadingConstructor, __spreadValues({}, props), loadingTemplateRef ? () => loadingTemplateRef : null);
908
- el.style.position = props.positionType;
909
- el.options = props;
910
- el.instance = loadingInstance;
911
- el.mask = loadingInstance.proxy.$el;
912
- };
913
- const loadingDirective = {
914
- mounted: function(el, binding, vnode) {
915
- handleProps(el, vnode.props);
916
- removeAttribute(el);
917
- !isEmpty(binding.value) && toggleLoading(el, binding);
918
- },
919
- updated: function(el, binding, vnode) {
920
- if (!isEmpty(binding.value) && cacheInstance.has(el) || isEmpty(binding.value) && !cacheInstance.has(el))
921
- return;
922
- !cacheInstance.has(el) && handleProps(el, vnode.props);
923
- removeAttribute(el);
924
- toggleLoading(el, binding);
925
- }
926
- };
927
- const buttonProps = {
928
- variant: {
929
- type: String,
930
- default: "outline"
931
- },
932
- size: {
933
- type: String,
934
- default: "md"
935
- },
936
- color: {
937
- type: String
938
- },
939
- icon: {
940
- type: String,
941
- default: ""
942
- },
943
- loading: {
944
- type: Boolean,
945
- default: false
946
- },
947
- disabled: {
948
- type: Boolean,
949
- default: false
950
- }
951
- };
952
- function useButton(props, ctx) {
953
- const hasContent = computed(() => ctx.slots.default);
954
- const colorMap = {
955
- solid: "primary",
956
- outline: "secondary",
957
- text: "secondary"
958
- };
959
- const defaultColor = colorMap[props.variant];
960
- const classes = computed(() => ({
961
- "devui-btn": true,
962
- [`devui-btn-${props.variant}`]: true,
963
- [`devui-btn-${props.variant}-${props.color || defaultColor}`]: true,
964
- [`devui-btn-${props.size}`]: true,
965
- "devui-btn-icon-wrap": props.icon,
966
- "devui-btn-icon": props.icon && !hasContent.value && props.variant !== "solid"
967
- }));
968
- const iconClass = computed(() => {
969
- if (!props.icon) {
970
- return;
971
- }
972
- const origin = "devui-icon-fix icon";
973
- if (hasContent.value) {
974
- return `${origin} clear-right-5`;
975
- } else {
976
- return origin;
977
- }
978
- });
979
- return { classes, iconClass };
980
- }
981
- var button = "";
982
- var Button = defineComponent({
983
- name: "DButton",
984
- directives: {
985
- devLoading: loadingDirective
986
- },
987
- props: buttonProps,
988
- emits: ["click"],
989
- setup(props, ctx) {
990
- const {
991
- icon,
992
- disabled,
993
- loading: loading2
994
- } = toRefs(props);
995
- const {
996
- classes,
997
- iconClass
998
- } = useButton(props, ctx);
999
- const onClick = (e) => {
1000
- if (loading2.value) {
1001
- return;
1002
- }
1003
- ctx.emit("click", e);
1004
- };
1005
- return () => {
1006
- var _a, _b;
1007
- return withDirectives(createVNode("button", {
1008
- "class": classes.value,
1009
- "disabled": disabled.value,
1010
- "onClick": onClick
1011
- }, [icon.value && createVNode(Icon, {
1012
- "name": icon.value,
1013
- "size": "12px",
1014
- "color": "",
1015
- "class": iconClass.value
1016
- }, null), createVNode("span", {
1017
- "class": "button-content"
1018
- }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])]), [[resolveDirective("dLoading"), loading2.value]]);
1019
- };
1020
- }
1021
- });
1022
- var index$1 = "";
1023
- var TimePopup = defineComponent({
1024
- name: "DTimePopup",
1025
- components: {
1026
- TimeList,
1027
- Button
1028
- },
1029
- props: {
1030
- showPopup: {
1031
- type: Boolean,
1032
- default: false
1033
- },
1034
- popupTop: {
1035
- type: Number,
1036
- default: -100
1037
- },
1038
- popupLeft: {
1039
- type: Number,
1040
- default: -100
1041
- },
1042
- popupWidth: {
1043
- type: Number,
1044
- default: 300
1045
- },
1046
- popupFormat: {
1047
- type: String,
1048
- default: "hh:mm:ss"
1049
- },
1050
- minTime: {
1051
- type: String,
1052
- default: "00:00:00"
1053
- },
1054
- maxTime: {
1055
- type: String,
1056
- default: "23:59:59"
1057
- },
1058
- bindData: {
1059
- type: String,
1060
- default: "00:00:00"
1061
- }
1062
- },
1063
- emits: ["subData"],
1064
- setup(props, ctx) {
1065
- const popupDome = ref();
1066
- const timeListDom = ref();
1067
- const hourList = initializeTimeData("hour");
1068
- const minuteList = initializeTimeData("minute");
1069
- const secondList = initializeTimeData("second");
1070
- onMounted(() => {
1071
- setTimeAstrict(hourList, minuteList, secondList, props.minTime, props.maxTime, props.popupFormat);
1072
- });
1073
- watch(() => [props.showPopup, props.bindData], ([showPopup, newTimeVal], [oldShowPopup, oldTimeVal]) => {
1074
- if (showPopup || newTimeVal != oldTimeVal) {
1075
- timeListDom.value.setOutoTime(newTimeVal);
1076
- } else {
1077
- timeListDom.value.resetScrollTop();
1078
- }
1079
- });
1080
- const changTimeData = () => {
1081
- return timeListDom.value.getNewTime();
1082
- };
1083
- const subDataFun = (e) => {
1084
- e.stopPropagation();
1085
- ctx.emit("subData");
1086
- };
1087
- ctx.expose({
1088
- changTimeData
1089
- });
1090
- return () => {
1091
- var _a, _b;
1092
- return createVNode(Fragment, null, [createVNode("div", {
1093
- "ref": popupDome,
1094
- "class": `devui-time-popup ${props.showPopup ? "devui-show-time-popup" : ""}`,
1095
- "style": {
1096
- "width": props.popupWidth + "px",
1097
- "top": props.popupTop + "px",
1098
- "left": props.popupLeft + "px"
1099
- }
1100
- }, [createVNode(TimeList, {
1101
- "ref": timeListDom,
1102
- "hourList": hourList,
1103
- "minuteList": minuteList,
1104
- "secondList": secondList,
1105
- "minTime": props.minTime,
1106
- "maxTime": props.maxTime,
1107
- "format": props.popupFormat
1108
- }, null), createVNode("div", {
1109
- "class": "devui-time-popup-btn"
1110
- }, [createVNode("div", {
1111
- "class": "popup-slots"
1112
- }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]), createVNode("div", {
1113
- "onClick": subDataFun
1114
- }, [createVNode(Button, {
1115
- "variant": "common"
1116
- }, {
1117
- default: () => [createTextVNode("\u786E\u5B9A")]
1118
- })])])])]);
1119
- };
1120
- }
1121
- });
1122
- var timePicker = "";
1123
- var TimePicker = defineComponent({
1124
- name: "DTimePicker",
1125
- components: {
1126
- TimePopup
1127
- },
1128
- props: timePickerProps,
1129
- emits: ["selectedTimeChage", "update:modelValue"],
1130
- setup(props, ctx) {
1131
- const activeHour = ref("00");
1132
- const activeMinute = ref("00");
1133
- const activeSecond = ref("00");
1134
- const format = props.format.toLowerCase();
1135
- const {
1136
- isActive,
1137
- showPopup,
1138
- devuiTimePicker,
1139
- inputDom,
1140
- left,
1141
- top,
1142
- showClearIcon,
1143
- firsthandActiveTime,
1144
- chooseTime,
1145
- getTimeValue,
1146
- clickVerifyFun,
1147
- isOutOpen,
1148
- vModelIsBeyond,
1149
- clearAll,
1150
- timePopupDom,
1151
- vModeValue,
1152
- getPopupPosition
1153
- } = useTimePicker(activeHour, activeMinute, activeSecond, props.minTime, props.maxTime, format, props.autoOpen, props.disabled, props.modelValue);
1154
- const selectedTimeChage = (e) => {
1155
- isActive.value = false;
1156
- showPopup.value = false;
1157
- ctx.emit("selectedTimeChage", vModeValue.value);
1158
- };
1159
- onMounted(() => {
1160
- getPopupPosition();
1161
- isOutOpen();
1162
- vModelIsBeyond();
1163
- document.addEventListener("click", clickVerifyFun);
1164
- document.addEventListener("click", getTimeValue);
1165
- document.addEventListener("scroll", getPopupPosition);
1166
- window.addEventListener("resize", getPopupPosition);
1167
- });
1168
- onUnmounted(() => {
1169
- document.removeEventListener("click", clickVerifyFun);
1170
- document.removeEventListener("click", getTimeValue);
1171
- document.removeEventListener("scroll", getPopupPosition);
1172
- window.removeEventListener("resize", getPopupPosition);
1173
- });
1174
- watch(vModeValue, (newValue) => {
1175
- ctx.emit("update:modelValue", vModeValue.value);
1176
- if (newValue != props.minTime && newValue != "00:00") {
1177
- showClearIcon.value = true;
1178
- } else {
1179
- showClearIcon.value = false;
1180
- }
1181
- });
1182
- ctx.expose({
1183
- clearAll,
1184
- chooseTime
1185
- });
1186
- return () => {
1187
- return createVNode(Fragment, null, [createVNode("div", {
1188
- "class": `devui-time-picker ${isActive.value ? "time-picker-active" : ""} ${props.disabled ? "picker-disabled" : ""}`,
1189
- "ref": devuiTimePicker
1190
- }, [createVNode(TimePopup, {
1191
- "ref": timePopupDom,
1192
- "showPopup": showPopup.value,
1193
- "popupTop": top.value,
1194
- "popupLeft": left.value,
1195
- "popupWidth": props.timePickerWidth,
1196
- "popupFormat": props.format.toLowerCase(),
1197
- "minTime": props.minTime,
1198
- "maxTime": props.maxTime,
1199
- "bindData": firsthandActiveTime.value,
1200
- "onSubData": selectedTimeChage
1201
- }, {
1202
- default: () => {
1203
- var _a, _b;
1204
- return [(_b = (_a = ctx.slots).customViewTemplate) == null ? void 0 : _b.call(_a)];
1205
- }
1206
- }), createVNode("input", {
1207
- "ref": inputDom,
1208
- "type": "text",
1209
- "value": vModeValue.value,
1210
- "placeholder": `${props.placeholder}`,
1211
- "disabled": props.disabled,
1212
- "class": "time-input"
1213
- }, null), createVNode("div", {
1214
- "class": "time-input-icon"
1215
- }, [createVNode("div", {
1216
- "onClick": clearAll
1217
- }, [showClearIcon.value ? createVNode(Icon, {
1218
- "size": "small",
1219
- "name": "close"
1220
- }, null) : ""]), createVNode("div", null, [createVNode(Icon, {
1221
- "size": "small",
1222
- "name": "time"
1223
- }, null)])])])]);
1224
- };
1225
- }
1226
- });
1227
- TimePicker.install = function(app) {
1228
- app.component(TimePicker.name, TimePicker);
1229
- };
1230
- var index = {
1231
- title: "TimePicker \u65F6\u95F4\u9009\u62E9\u5668",
1232
- category: "\u6570\u636E\u5F55\u5165",
1233
- status: "90%",
1234
- install(app) {
1235
- app.use(TimePicker);
1236
- }
1237
- };
1238
- export { TimePicker, index as default };