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

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 (328) hide show
  1. package/README.md +149 -200
  2. package/alert/index.es.js +46 -15
  3. package/alert/index.umd.js +1 -1
  4. package/alert/style.css +1 -1
  5. package/auto-complete/index.es.js +8166 -287
  6. package/auto-complete/index.umd.js +29 -1
  7. package/auto-complete/style.css +1 -1
  8. package/avatar/index.es.js +153 -146
  9. package/avatar/index.umd.js +1 -1
  10. package/avatar/style.css +1 -1
  11. package/badge/index.es.js +29 -4
  12. package/badge/index.umd.js +1 -1
  13. package/badge/style.css +1 -1
  14. package/button/index.es.js +5726 -111
  15. package/button/index.umd.js +27 -1
  16. package/button/style.css +1 -1
  17. package/card/index.es.js +59 -35
  18. package/card/index.umd.js +1 -1
  19. package/card/style.css +1 -1
  20. package/checkbox/index.es.js +8060 -255
  21. package/checkbox/index.umd.js +27 -1
  22. package/checkbox/style.css +1 -1
  23. package/{accordion → collapse}/index.d.ts +0 -0
  24. package/collapse/index.es.js +379 -0
  25. package/collapse/index.umd.js +1 -0
  26. package/{anchor → collapse}/package.json +1 -1
  27. package/collapse/style.css +1 -0
  28. package/countdown/index.es.js +3 -6
  29. package/countdown/index.umd.js +1 -1
  30. package/date-picker/index.es.js +8130 -242
  31. package/date-picker/index.umd.js +27 -1
  32. package/date-picker/style.css +1 -1
  33. package/drawer/index.es.js +31 -4
  34. package/drawer/index.umd.js +1 -1
  35. package/drawer/style.css +1 -1
  36. package/dropdown/index.es.js +209 -148
  37. package/dropdown/index.umd.js +1 -1
  38. package/dropdown/style.css +1 -1
  39. package/editable-select/index.es.js +521 -153
  40. package/editable-select/index.umd.js +1 -1
  41. package/editable-select/style.css +1 -1
  42. package/form/index.es.js +1040 -1187
  43. package/form/index.umd.js +16 -16
  44. package/form/style.css +1 -1
  45. package/fullscreen/index.es.js +29 -5
  46. package/fullscreen/index.umd.js +1 -1
  47. package/fullscreen/style.css +1 -1
  48. package/grid/index.es.js +101 -86
  49. package/grid/index.umd.js +1 -1
  50. package/grid/style.css +1 -1
  51. package/icon/index.es.js +182 -23
  52. package/icon/index.umd.js +1 -1
  53. package/icon/style.css +1 -0
  54. package/image-preview/index.es.js +53 -30
  55. package/image-preview/index.umd.js +1 -1
  56. package/image-preview/style.css +1 -1
  57. package/input/index.es.js +8066 -144
  58. package/input/index.umd.js +27 -1
  59. package/input/style.css +1 -1
  60. package/input-number/index.es.js +274 -177
  61. package/input-number/index.umd.js +1 -1
  62. package/input-number/style.css +1 -1
  63. package/layout/index.es.js +40 -25
  64. package/layout/index.umd.js +1 -1
  65. package/layout/style.css +1 -1
  66. package/loading/index.es.js +74 -35
  67. package/loading/index.umd.js +1 -1
  68. package/loading/style.css +1 -1
  69. package/modal/index.es.js +374 -171
  70. package/modal/index.umd.js +1 -1
  71. package/modal/style.css +1 -1
  72. package/notification/index.es.js +292 -40
  73. package/notification/index.umd.js +1 -1
  74. package/notification/style.css +1 -1
  75. package/nuxt/components/ButtonGroup.js +3 -0
  76. package/nuxt/components/CheckboxButton.js +3 -0
  77. package/nuxt/components/CheckboxGroup.js +3 -0
  78. package/nuxt/components/Collapse.js +3 -0
  79. package/nuxt/components/CollapseItem.js +3 -0
  80. package/nuxt/components/DropdownPropsKey.js +3 -0
  81. package/nuxt/components/FORM_ITEM_TOKEN.js +3 -0
  82. package/nuxt/components/FORM_TOKEN.js +3 -0
  83. package/nuxt/components/Icon.js +1 -0
  84. package/nuxt/components/IconGroup.js +3 -0
  85. package/nuxt/components/LABEL_DATA.js +3 -0
  86. package/nuxt/components/LoadingOptions.js +3 -0
  87. package/nuxt/components/Option.js +3 -0
  88. package/nuxt/components/RadioButton.js +3 -0
  89. package/nuxt/components/Tab.js +3 -0
  90. package/nuxt/components/autoCompleteProps.js +3 -0
  91. package/nuxt/components/avatarProps.js +3 -0
  92. package/nuxt/components/buttonGroupInjectionKey.js +3 -0
  93. package/nuxt/components/buttonGroupProps.js +3 -0
  94. package/nuxt/components/cardProps.js +3 -0
  95. package/nuxt/components/checkboxGroupInjectionKey.js +3 -0
  96. package/nuxt/components/checkboxGroupProps.js +3 -0
  97. package/nuxt/components/checkboxProps.js +3 -0
  98. package/nuxt/components/colProps.js +3 -0
  99. package/nuxt/components/colPropsBaseClass.js +3 -0
  100. package/nuxt/components/colPropsBaseStyle.js +3 -0
  101. package/nuxt/components/collapseItemProps.js +3 -0
  102. package/nuxt/components/collapseProps.js +3 -0
  103. package/nuxt/components/countdownProps.js +3 -0
  104. package/nuxt/components/editableSelectProps.js +3 -0
  105. package/nuxt/components/formItemProps.js +3 -0
  106. package/nuxt/components/formProps.js +3 -0
  107. package/nuxt/components/iconProps.js +1 -0
  108. package/nuxt/components/imagePreviewProps.js +3 -0
  109. package/nuxt/components/inputProps.js +3 -0
  110. package/nuxt/components/loadingProps.js +3 -0
  111. package/nuxt/components/modalProps.js +3 -0
  112. package/nuxt/components/progressProps.js +3 -0
  113. package/nuxt/components/rateProps.js +3 -0
  114. package/nuxt/components/resultProps.js +3 -0
  115. package/nuxt/components/rowProps.js +3 -0
  116. package/nuxt/components/screenSizes.js +3 -0
  117. package/nuxt/components/skeletonProps.js +3 -0
  118. package/nuxt/components/sliderProps.js +3 -0
  119. package/nuxt/components/splitterProps.js +3 -0
  120. package/nuxt/components/statisticProps.js +3 -0
  121. package/nuxt/components/svgIconProps.js +3 -0
  122. package/nuxt/components/switchProps.js +3 -0
  123. package/nuxt/components/tabsProps.js +3 -0
  124. package/nuxt/components/tagProps.js +3 -0
  125. package/nuxt/components/textareaProps.js +3 -0
  126. package/nuxt/components/timeAxisProps.js +3 -0
  127. package/nuxt/components/treeProps.js +3 -0
  128. package/overlay/index.es.js +104 -133
  129. package/overlay/index.umd.js +1 -1
  130. package/overlay/style.css +1 -1
  131. package/package.json +3 -2
  132. package/pagination/index.es.js +148 -136
  133. package/pagination/index.umd.js +1 -1
  134. package/pagination/style.css +1 -1
  135. package/panel/style.css +1 -1
  136. package/popover/index.es.js +294 -230
  137. package/popover/index.umd.js +15 -15
  138. package/popover/style.css +1 -1
  139. package/progress/index.es.js +110 -56
  140. package/progress/index.umd.js +3 -3
  141. package/progress/style.css +1 -1
  142. package/radio/index.es.js +7959 -146
  143. package/radio/index.umd.js +27 -1
  144. package/radio/style.css +1 -1
  145. package/rate/index.es.js +77 -55
  146. package/rate/index.umd.js +1 -1
  147. package/rate/style.css +1 -1
  148. package/result/index.es.js +169 -27
  149. package/result/index.umd.js +1 -1
  150. package/result/style.css +1 -1
  151. package/ripple/index.es.js +43 -42
  152. package/ripple/index.umd.js +1 -1
  153. package/search/index.es.js +3620 -1095
  154. package/search/index.umd.js +18 -18
  155. package/search/style.css +1 -1
  156. package/select/index.es.js +9131 -584
  157. package/select/index.umd.js +27 -1
  158. package/select/style.css +1 -1
  159. package/skeleton/index.es.js +46 -24
  160. package/skeleton/index.umd.js +1 -1
  161. package/skeleton/style.css +1 -1
  162. package/slider/index.es.js +108 -75
  163. package/slider/index.umd.js +1 -1
  164. package/slider/style.css +1 -1
  165. package/splitter/index.es.js +443 -335
  166. package/splitter/index.umd.js +15 -15
  167. package/splitter/style.css +1 -1
  168. package/statistic/index.es.js +7 -18
  169. package/statistic/index.umd.js +1 -1
  170. package/status/index.es.js +26 -2
  171. package/status/index.umd.js +1 -1
  172. package/status/style.css +1 -1
  173. package/style.css +1 -1
  174. package/switch/index.es.js +7794 -64
  175. package/switch/index.umd.js +27 -1
  176. package/switch/style.css +1 -1
  177. package/table/index.es.js +10038 -1180
  178. package/table/index.umd.js +27 -1
  179. package/table/style.css +1 -1
  180. package/tabs/index.es.js +342 -141
  181. package/tabs/index.umd.js +1 -1
  182. package/tabs/style.css +1 -1
  183. package/tag/index.es.js +47 -23
  184. package/tag/index.umd.js +1 -1
  185. package/tag/style.css +1 -1
  186. package/textarea/index.es.js +7913 -83
  187. package/textarea/index.umd.js +35 -1
  188. package/textarea/style.css +1 -1
  189. package/timeline/index.es.js +176 -37
  190. package/timeline/index.umd.js +1 -1
  191. package/timeline/style.css +1 -1
  192. package/tooltip/index.es.js +285 -220
  193. package/tooltip/index.umd.js +15 -15
  194. package/tooltip/style.css +1 -1
  195. package/tree/index.es.js +4190 -1857
  196. package/tree/index.umd.js +18 -18
  197. package/tree/style.css +1 -1
  198. package/upload/index.es.js +365 -106
  199. package/upload/index.umd.js +1 -1
  200. package/upload/style.css +1 -1
  201. package/vue-devui.es.js +20102 -25264
  202. package/vue-devui.umd.js +25 -15
  203. package/accordion/index.es.js +0 -723
  204. package/accordion/index.umd.js +0 -1
  205. package/accordion/package.json +0 -7
  206. package/accordion/style.css +0 -1
  207. package/anchor/index.d.ts +0 -7
  208. package/anchor/index.es.js +0 -263
  209. package/anchor/index.umd.js +0 -1
  210. package/anchor/style.css +0 -1
  211. package/back-top/index.d.ts +0 -7
  212. package/back-top/index.es.js +0 -130
  213. package/back-top/index.umd.js +0 -1
  214. package/back-top/package.json +0 -7
  215. package/back-top/style.css +0 -1
  216. package/breadcrumb/index.d.ts +0 -7
  217. package/breadcrumb/index.es.js +0 -128
  218. package/breadcrumb/index.umd.js +0 -1
  219. package/breadcrumb/package.json +0 -7
  220. package/breadcrumb/style.css +0 -1
  221. package/carousel/index.d.ts +0 -7
  222. package/carousel/index.es.js +0 -314
  223. package/carousel/index.umd.js +0 -1
  224. package/carousel/package.json +0 -7
  225. package/carousel/style.css +0 -1
  226. package/cascader/index.d.ts +0 -7
  227. package/cascader/index.es.js +0 -5971
  228. package/cascader/index.umd.js +0 -27
  229. package/cascader/package.json +0 -7
  230. package/cascader/style.css +0 -1
  231. package/color-picker/index.d.ts +0 -7
  232. package/color-picker/index.es.js +0 -8196
  233. package/color-picker/index.umd.js +0 -27
  234. package/color-picker/package.json +0 -7
  235. package/color-picker/style.css +0 -1
  236. package/comment/index.d.ts +0 -7
  237. package/comment/index.es.js +0 -86
  238. package/comment/index.umd.js +0 -1
  239. package/comment/package.json +0 -7
  240. package/comment/style.css +0 -1
  241. package/dragdrop/index.d.ts +0 -7
  242. package/dragdrop/index.es.js +0 -157
  243. package/dragdrop/index.umd.js +0 -1
  244. package/dragdrop/package.json +0 -7
  245. package/gantt/index.d.ts +0 -7
  246. package/gantt/index.es.js +0 -523
  247. package/gantt/index.umd.js +0 -1
  248. package/gantt/package.json +0 -7
  249. package/gantt/style.css +0 -1
  250. package/input-icon/index.d.ts +0 -7
  251. package/input-icon/index.es.js +0 -332
  252. package/input-icon/index.umd.js +0 -1
  253. package/input-icon/package.json +0 -7
  254. package/input-icon/style.css +0 -1
  255. package/list/index.d.ts +0 -7
  256. package/list/index.es.js +0 -39
  257. package/list/index.umd.js +0 -1
  258. package/list/package.json +0 -7
  259. package/list/style.css +0 -1
  260. package/nav-sprite/index.d.ts +0 -7
  261. package/nav-sprite/index.es.js +0 -68
  262. package/nav-sprite/index.umd.js +0 -1
  263. package/nav-sprite/package.json +0 -7
  264. package/nuxt/components/Accordion.js +0 -3
  265. package/nuxt/components/Anchor.js +0 -3
  266. package/nuxt/components/BackTop.js +0 -3
  267. package/nuxt/components/Breadcrumb.js +0 -3
  268. package/nuxt/components/Carousel.js +0 -3
  269. package/nuxt/components/CarouselItem.js +0 -3
  270. package/nuxt/components/Cascader.js +0 -3
  271. package/nuxt/components/ColorPicker.js +0 -3
  272. package/nuxt/components/Comment.js +0 -3
  273. package/nuxt/components/FormControl.js +0 -3
  274. package/nuxt/components/FormLabel.js +0 -3
  275. package/nuxt/components/Gantt.js +0 -3
  276. package/nuxt/components/InputIcon.js +0 -3
  277. package/nuxt/components/List.js +0 -3
  278. package/nuxt/components/ListItem.js +0 -3
  279. package/nuxt/components/NavSprite.js +0 -2
  280. package/nuxt/components/QuadrantDiagram.js +0 -3
  281. package/nuxt/components/ReadTip.js +0 -3
  282. package/nuxt/components/StepsGuide.js +0 -3
  283. package/nuxt/components/Sticky.js +0 -2
  284. package/nuxt/components/TagInput.js +0 -3
  285. package/nuxt/components/TimePicker.js +0 -3
  286. package/nuxt/components/Transfer.js +0 -3
  287. package/nuxt/components/TreeSelect.js +0 -3
  288. package/nuxt/components/overlayEmits.js +0 -3
  289. package/nuxt/components/overlayProps.js +0 -3
  290. package/quadrant-diagram/index.d.ts +0 -7
  291. package/quadrant-diagram/index.es.js +0 -5728
  292. package/quadrant-diagram/index.umd.js +0 -27
  293. package/quadrant-diagram/package.json +0 -7
  294. package/quadrant-diagram/style.css +0 -1
  295. package/read-tip/index.d.ts +0 -7
  296. package/read-tip/index.es.js +0 -261
  297. package/read-tip/index.umd.js +0 -1
  298. package/read-tip/package.json +0 -7
  299. package/read-tip/style.css +0 -1
  300. package/steps-guide/index.d.ts +0 -7
  301. package/steps-guide/index.es.js +0 -242
  302. package/steps-guide/index.umd.js +0 -1
  303. package/steps-guide/package.json +0 -7
  304. package/steps-guide/style.css +0 -1
  305. package/sticky/index.d.ts +0 -7
  306. package/sticky/index.es.js +0 -197
  307. package/sticky/index.umd.js +0 -1
  308. package/sticky/package.json +0 -7
  309. package/tag-input/index.d.ts +0 -7
  310. package/tag-input/index.es.js +0 -331
  311. package/tag-input/index.umd.js +0 -1
  312. package/tag-input/package.json +0 -7
  313. package/tag-input/style.css +0 -1
  314. package/time-picker/index.d.ts +0 -7
  315. package/time-picker/index.es.js +0 -1238
  316. package/time-picker/index.umd.js +0 -1
  317. package/time-picker/package.json +0 -7
  318. package/time-picker/style.css +0 -1
  319. package/transfer/index.d.ts +0 -7
  320. package/transfer/index.es.js +0 -7615
  321. package/transfer/index.umd.js +0 -27
  322. package/transfer/package.json +0 -7
  323. package/transfer/style.css +0 -1
  324. package/tree-select/index.d.ts +0 -7
  325. package/tree-select/index.es.js +0 -627
  326. package/tree-select/index.umd.js +0 -1
  327. package/tree-select/package.json +0 -7
  328. 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 };