vue-devui 1.0.0-beta.18 → 1.0.0-beta.20220808

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 (404) hide show
  1. package/README.md +94 -118
  2. package/alert/index.es.js +74 -45
  3. package/alert/index.umd.js +1 -1
  4. package/alert/style.css +1 -1
  5. package/auto-complete/index.es.js +8395 -463
  6. package/auto-complete/index.umd.js +40 -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 +45 -20
  12. package/badge/index.umd.js +1 -1
  13. package/badge/style.css +1 -1
  14. package/button/index.es.js +5751 -156
  15. package/button/index.umd.js +27 -1
  16. package/button/style.css +1 -1
  17. package/card/index.es.js +63 -35
  18. package/card/index.umd.js +1 -1
  19. package/card/style.css +1 -1
  20. package/checkbox/index.es.js +8110 -278
  21. package/checkbox/index.umd.js +38 -1
  22. package/checkbox/style.css +1 -1
  23. package/{accordion → collapse}/index.d.ts +0 -0
  24. package/collapse/index.es.js +195 -0
  25. package/collapse/index.umd.js +1 -0
  26. package/{back-top → collapse}/package.json +1 -1
  27. package/collapse/style.css +1 -0
  28. package/countdown/index.es.js +60 -19
  29. package/countdown/index.umd.js +1 -1
  30. package/{anchor → date-picker-pro}/index.d.ts +0 -0
  31. package/date-picker-pro/index.es.js +12035 -0
  32. package/date-picker-pro/index.umd.js +38 -0
  33. package/date-picker-pro/package.json +7 -0
  34. package/date-picker-pro/style.css +1 -0
  35. package/drawer/index.es.js +191 -5756
  36. package/drawer/index.umd.js +1 -27
  37. package/drawer/style.css +1 -1
  38. package/dropdown/index.es.js +616 -415
  39. package/dropdown/index.umd.js +1 -1
  40. package/dropdown/style.css +1 -1
  41. package/editable-select/index.es.js +779 -211
  42. package/editable-select/index.umd.js +1 -1
  43. package/editable-select/style.css +1 -1
  44. package/form/index.es.js +2405 -2125
  45. package/form/index.umd.js +28 -17
  46. package/form/style.css +1 -1
  47. package/fullscreen/index.es.js +137 -134
  48. package/fullscreen/index.umd.js +1 -1
  49. package/fullscreen/style.css +1 -1
  50. package/grid/index.es.js +105 -103
  51. package/grid/index.umd.js +1 -1
  52. package/grid/style.css +1 -1
  53. package/icon/index.es.js +199 -56
  54. package/icon/index.umd.js +1 -1
  55. package/icon/style.css +1 -0
  56. package/image-preview/index.es.js +67 -54
  57. package/image-preview/index.umd.js +1 -1
  58. package/image-preview/style.css +1 -1
  59. package/input/index.es.js +8268 -144
  60. package/input/index.umd.js +38 -1
  61. package/input/style.css +1 -1
  62. package/input-number/index.es.js +260 -192
  63. package/input-number/index.umd.js +1 -1
  64. package/input-number/style.css +1 -1
  65. package/layout/index.es.js +40 -25
  66. package/layout/index.umd.js +1 -1
  67. package/layout/style.css +1 -1
  68. package/loading/index.es.js +86 -70
  69. package/loading/index.umd.js +1 -1
  70. package/loading/style.css +1 -1
  71. package/{back-top → mention}/index.d.ts +0 -0
  72. package/{color-picker → mention}/index.es.js +3036 -2898
  73. package/mention/index.umd.js +47 -0
  74. package/{anchor → mention}/package.json +1 -1
  75. package/mention/style.css +1 -0
  76. package/{breadcrumb → menu}/index.d.ts +0 -0
  77. package/menu/index.es.js +891 -0
  78. package/menu/index.umd.js +1 -0
  79. package/{toast → menu}/package.json +1 -1
  80. package/menu/style.css +1 -0
  81. package/{carousel → message}/index.d.ts +0 -0
  82. package/message/index.es.js +533 -0
  83. package/message/index.umd.js +1 -0
  84. package/{comment → message}/package.json +1 -1
  85. package/message/style.css +1 -0
  86. package/modal/index.es.js +602 -1061
  87. package/modal/index.umd.js +1 -1
  88. package/modal/style.css +1 -1
  89. package/{cascader → notification}/index.d.ts +0 -0
  90. package/notification/index.es.js +528 -0
  91. package/notification/index.umd.js +1 -0
  92. package/{accordion → notification}/package.json +1 -1
  93. package/notification/style.css +1 -0
  94. package/nuxt/components/ButtonGroup.js +3 -0
  95. package/nuxt/components/CheckboxButton.js +3 -0
  96. package/nuxt/components/CheckboxGroup.js +3 -0
  97. package/nuxt/components/Collapse.js +3 -0
  98. package/nuxt/components/CollapseItem.js +3 -0
  99. package/nuxt/components/DRangeDatePickerPro.js +3 -0
  100. package/nuxt/components/DatePickerPro.js +3 -0
  101. package/nuxt/components/DropdownMenu.js +3 -0
  102. package/nuxt/components/DropdownPropsKey.js +3 -0
  103. package/nuxt/components/FORM_ITEM_TOKEN.js +3 -0
  104. package/nuxt/components/FORM_TOKEN.js +3 -0
  105. package/nuxt/components/IFileOptions.js +3 -0
  106. package/nuxt/components/IUploadOptions.js +3 -0
  107. package/nuxt/components/Icon.js +1 -0
  108. package/nuxt/components/IconGroup.js +3 -0
  109. package/nuxt/components/LABEL_DATA.js +3 -0
  110. package/nuxt/components/LoadingOptions.js +3 -0
  111. package/nuxt/components/Mention.js +3 -0
  112. package/nuxt/components/Menu.js +3 -0
  113. package/nuxt/components/MenuItem.js +3 -0
  114. package/nuxt/components/Message.js +3 -0
  115. package/nuxt/components/Notification.js +3 -0
  116. package/nuxt/components/NotificationService.js +3 -0
  117. package/nuxt/components/Option.js +3 -0
  118. package/nuxt/components/OptionGroup.js +3 -0
  119. package/nuxt/components/PanelBody.js +3 -0
  120. package/nuxt/components/PanelFooter.js +3 -0
  121. package/nuxt/components/PanelHeader.js +3 -0
  122. package/nuxt/components/RadioButton.js +3 -0
  123. package/nuxt/components/Step.js +3 -0
  124. package/nuxt/components/Steps.js +3 -0
  125. package/nuxt/components/SubMenu.js +3 -0
  126. package/nuxt/components/TABLE_TOKEN.js +3 -0
  127. package/nuxt/components/Tab.js +3 -0
  128. package/nuxt/components/TimeSelect.js +3 -0
  129. package/nuxt/components/Timeline.js +3 -0
  130. package/nuxt/components/TimelineItem.js +3 -0
  131. package/nuxt/components/UploadStatus.js +3 -0
  132. package/nuxt/components/alertProps.js +3 -0
  133. package/nuxt/components/animationInjectionKey.js +3 -0
  134. package/nuxt/components/autoCompleteProps.js +3 -0
  135. package/nuxt/components/avatarProps.js +3 -0
  136. package/nuxt/components/badgeProps.js +3 -0
  137. package/nuxt/components/buttonGroupInjectionKey.js +3 -0
  138. package/nuxt/components/buttonGroupProps.js +3 -0
  139. package/nuxt/components/cardProps.js +3 -0
  140. package/nuxt/components/checkboxGroupInjectionKey.js +3 -0
  141. package/nuxt/components/checkboxGroupProps.js +3 -0
  142. package/nuxt/components/checkboxProps.js +3 -0
  143. package/nuxt/components/colProps.js +3 -0
  144. package/nuxt/components/colPropsBaseClass.js +3 -0
  145. package/nuxt/components/colPropsBaseStyle.js +3 -0
  146. package/nuxt/components/collapseItemProps.js +3 -0
  147. package/nuxt/components/collapseProps.js +3 -0
  148. package/nuxt/components/countdownProps.js +3 -0
  149. package/nuxt/components/datePickerProCommonProps.js +3 -0
  150. package/nuxt/components/datePickerProPanelProps.js +3 -0
  151. package/nuxt/components/datePickerProProps.js +3 -0
  152. package/nuxt/components/dropdownMenuProps.js +3 -0
  153. package/nuxt/components/editableSelectProps.js +3 -0
  154. package/nuxt/components/fixedOverlayProps.js +3 -0
  155. package/nuxt/components/flexibleOverlayProps.js +3 -0
  156. package/nuxt/components/formItemProps.js +3 -0
  157. package/nuxt/components/formProps.js +3 -0
  158. package/nuxt/components/fullscreenProps.js +3 -0
  159. package/nuxt/components/iconProps.js +3 -0
  160. package/nuxt/components/imagePreviewProps.js +3 -0
  161. package/nuxt/components/inputProps.js +3 -0
  162. package/nuxt/components/loadingProps.js +3 -0
  163. package/nuxt/components/mentionProps.js +3 -0
  164. package/nuxt/components/messageProps.js +3 -0
  165. package/nuxt/components/modalProps.js +3 -0
  166. package/nuxt/components/notificationProps.js +3 -0
  167. package/nuxt/components/paginationProps.js +3 -0
  168. package/nuxt/components/panelProps.js +3 -0
  169. package/nuxt/components/popoverProps.js +3 -0
  170. package/nuxt/components/progressProps.js +3 -0
  171. package/nuxt/components/rateProps.js +3 -0
  172. package/nuxt/components/resultProps.js +3 -0
  173. package/nuxt/components/roundInjectionKey.js +3 -0
  174. package/nuxt/components/rowProps.js +3 -0
  175. package/nuxt/components/screenSizes.js +3 -0
  176. package/nuxt/components/searchProps.js +3 -0
  177. package/nuxt/components/skeletonItemProps.js +3 -0
  178. package/nuxt/components/skeletonProps.js +3 -0
  179. package/nuxt/components/sliderProps.js +3 -0
  180. package/nuxt/components/splitterProps.js +3 -0
  181. package/nuxt/components/statisticProps.js +3 -0
  182. package/nuxt/components/stepProps.js +3 -0
  183. package/nuxt/components/stepsProps.js +3 -0
  184. package/nuxt/components/svgIconProps.js +3 -0
  185. package/nuxt/components/switchProps.js +3 -0
  186. package/nuxt/components/tableProps.js +3 -0
  187. package/nuxt/components/tabsProps.js +3 -0
  188. package/nuxt/components/tagProps.js +3 -0
  189. package/nuxt/components/textareaProps.js +3 -0
  190. package/nuxt/components/timeAxisProps.js +3 -0
  191. package/nuxt/components/timerPickerPanelProps.js +3 -0
  192. package/nuxt/components/tooltipProps.js +3 -0
  193. package/nuxt/components/treeNodeProps.js +3 -0
  194. package/nuxt/components/treeProps.js +3 -0
  195. package/nuxt/components/uploadProps.js +3 -0
  196. package/overlay/index.es.js +239 -314
  197. package/overlay/index.umd.js +1 -1
  198. package/overlay/style.css +1 -1
  199. package/package.json +44 -87
  200. package/pagination/index.es.js +331 -153
  201. package/pagination/index.umd.js +1 -1
  202. package/pagination/style.css +1 -1
  203. package/panel/index.es.js +45 -32
  204. package/panel/index.umd.js +1 -1
  205. package/panel/style.css +1 -1
  206. package/popover/index.es.js +6034 -215
  207. package/popover/index.umd.js +27 -1
  208. package/popover/style.css +1 -1
  209. package/progress/index.es.js +110 -56
  210. package/progress/index.umd.js +3 -3
  211. package/progress/style.css +1 -1
  212. package/radio/index.es.js +8013 -180
  213. package/radio/index.umd.js +38 -1
  214. package/radio/style.css +1 -1
  215. package/rate/index.es.js +77 -55
  216. package/rate/index.umd.js +1 -1
  217. package/rate/style.css +1 -1
  218. package/result/index.es.js +186 -57
  219. package/result/index.umd.js +1 -1
  220. package/result/style.css +1 -1
  221. package/ripple/index.es.js +52 -60
  222. package/ripple/index.umd.js +1 -1
  223. package/search/index.es.js +3885 -1152
  224. package/search/index.umd.js +29 -18
  225. package/search/style.css +1 -1
  226. package/select/index.es.js +9235 -516
  227. package/select/index.umd.js +38 -1
  228. package/select/style.css +1 -1
  229. package/skeleton/index.es.js +113 -265
  230. package/skeleton/index.umd.js +1 -1
  231. package/skeleton/style.css +1 -1
  232. package/slider/index.es.js +144 -137
  233. package/slider/index.umd.js +1 -1
  234. package/slider/style.css +1 -1
  235. package/splitter/index.es.js +6219 -232
  236. package/splitter/index.umd.js +27 -1
  237. package/splitter/style.css +1 -1
  238. package/statistic/index.es.js +41 -55
  239. package/statistic/index.umd.js +1 -1
  240. package/statistic/style.css +1 -1
  241. package/status/index.es.js +27 -6
  242. package/status/index.umd.js +1 -1
  243. package/status/style.css +1 -1
  244. package/{color-picker → steps}/index.d.ts +0 -0
  245. package/steps/index.es.js +386 -0
  246. package/steps/index.umd.js +1 -0
  247. package/{gantt → steps}/package.json +1 -1
  248. package/steps/style.css +1 -0
  249. package/style.css +1 -1
  250. package/switch/index.es.js +7818 -64
  251. package/switch/index.umd.js +38 -1
  252. package/switch/style.css +1 -1
  253. package/table/index.es.js +11109 -1451
  254. package/table/index.umd.js +38 -1
  255. package/table/style.css +1 -1
  256. package/tabs/index.es.js +356 -144
  257. package/tabs/index.umd.js +1 -1
  258. package/tabs/style.css +1 -1
  259. package/tag/index.es.js +49 -24
  260. package/tag/index.umd.js +1 -1
  261. package/tag/style.css +1 -1
  262. package/textarea/index.es.js +7940 -83
  263. package/textarea/index.umd.js +46 -1
  264. package/textarea/style.css +1 -1
  265. package/time-picker/index.es.js +8953 -632
  266. package/time-picker/index.umd.js +38 -1
  267. package/time-picker/style.css +1 -1
  268. package/{comment → time-select}/index.d.ts +0 -0
  269. package/time-select/index.es.js +9606 -0
  270. package/time-select/index.umd.js +38 -0
  271. package/{breadcrumb → time-select}/package.json +1 -1
  272. package/time-select/style.css +1 -0
  273. package/{date-picker → timeline}/index.d.ts +0 -0
  274. package/timeline/index.es.js +427 -0
  275. package/timeline/index.umd.js +1 -0
  276. package/{carousel → timeline}/package.json +1 -1
  277. package/timeline/style.css +1 -0
  278. package/tooltip/index.es.js +5871 -96
  279. package/tooltip/index.umd.js +27 -1
  280. package/tooltip/style.css +1 -1
  281. package/tree/index.es.js +7601 -2508
  282. package/tree/index.umd.js +29 -18
  283. package/tree/style.css +1 -1
  284. package/upload/index.es.js +849 -6143
  285. package/upload/index.umd.js +1 -27
  286. package/upload/style.css +1 -1
  287. package/vue-devui.es.js +20537 -19051
  288. package/vue-devui.umd.js +41 -19
  289. package/accordion/index.es.js +0 -508
  290. package/accordion/index.umd.js +0 -1
  291. package/accordion/style.css +0 -1
  292. package/anchor/index.es.js +0 -263
  293. package/anchor/index.umd.js +0 -1
  294. package/anchor/style.css +0 -1
  295. package/back-top/index.es.js +0 -128
  296. package/back-top/index.umd.js +0 -1
  297. package/back-top/style.css +0 -1
  298. package/breadcrumb/index.es.js +0 -127
  299. package/breadcrumb/index.umd.js +0 -1
  300. package/breadcrumb/style.css +0 -1
  301. package/carousel/index.es.js +0 -329
  302. package/carousel/index.umd.js +0 -1
  303. package/carousel/style.css +0 -1
  304. package/cascader/index.es.js +0 -5963
  305. package/cascader/index.umd.js +0 -27
  306. package/cascader/package.json +0 -7
  307. package/cascader/style.css +0 -1
  308. package/color-picker/index.umd.js +0 -27
  309. package/color-picker/package.json +0 -7
  310. package/color-picker/style.css +0 -1
  311. package/comment/index.es.js +0 -86
  312. package/comment/index.umd.js +0 -1
  313. package/comment/style.css +0 -1
  314. package/date-picker/index.es.js +0 -1171
  315. package/date-picker/index.umd.js +0 -1
  316. package/date-picker/package.json +0 -7
  317. package/date-picker/style.css +0 -1
  318. package/dragdrop/index.d.ts +0 -7
  319. package/dragdrop/index.es.js +0 -157
  320. package/dragdrop/index.umd.js +0 -1
  321. package/dragdrop/package.json +0 -7
  322. package/gantt/index.d.ts +0 -7
  323. package/gantt/index.es.js +0 -523
  324. package/gantt/index.umd.js +0 -1
  325. package/gantt/style.css +0 -1
  326. package/input-icon/index.d.ts +0 -7
  327. package/input-icon/index.es.js +0 -331
  328. package/input-icon/index.umd.js +0 -1
  329. package/input-icon/package.json +0 -7
  330. package/input-icon/style.css +0 -1
  331. package/nav-sprite/index.d.ts +0 -7
  332. package/nav-sprite/index.es.js +0 -68
  333. package/nav-sprite/index.umd.js +0 -1
  334. package/nav-sprite/package.json +0 -7
  335. package/nuxt/components/Accordion.js +0 -3
  336. package/nuxt/components/Anchor.js +0 -3
  337. package/nuxt/components/BackTop.js +0 -3
  338. package/nuxt/components/Breadcrumb.js +0 -3
  339. package/nuxt/components/Carousel.js +0 -3
  340. package/nuxt/components/CarouselItem.js +0 -3
  341. package/nuxt/components/Cascader.js +0 -3
  342. package/nuxt/components/ColorPicker.js +0 -3
  343. package/nuxt/components/Comment.js +0 -3
  344. package/nuxt/components/DatePicker.js +0 -3
  345. package/nuxt/components/FormControl.js +0 -3
  346. package/nuxt/components/FormLabel.js +0 -3
  347. package/nuxt/components/Gantt.js +0 -3
  348. package/nuxt/components/InputIcon.js +0 -3
  349. package/nuxt/components/NavSprite.js +0 -2
  350. package/nuxt/components/QuadrantDiagram.js +0 -3
  351. package/nuxt/components/ReadTip.js +0 -3
  352. package/nuxt/components/StepsGuide.js +0 -3
  353. package/nuxt/components/StickSlider.js +0 -3
  354. package/nuxt/components/Sticky.js +0 -2
  355. package/nuxt/components/TagInput.js +0 -3
  356. package/nuxt/components/TimeAxis.js +0 -3
  357. package/nuxt/components/TimeAxisItem.js +0 -3
  358. package/nuxt/components/Toast.js +0 -3
  359. package/nuxt/components/ToastService.js +0 -3
  360. package/nuxt/components/Transfer.js +0 -3
  361. package/nuxt/components/TreeSelect.js +0 -3
  362. package/quadrant-diagram/index.d.ts +0 -7
  363. package/quadrant-diagram/index.es.js +0 -5728
  364. package/quadrant-diagram/index.umd.js +0 -27
  365. package/quadrant-diagram/package.json +0 -7
  366. package/quadrant-diagram/style.css +0 -1
  367. package/read-tip/index.d.ts +0 -7
  368. package/read-tip/index.es.js +0 -258
  369. package/read-tip/index.umd.js +0 -1
  370. package/read-tip/package.json +0 -7
  371. package/read-tip/style.css +0 -1
  372. package/steps-guide/index.d.ts +0 -7
  373. package/steps-guide/index.es.js +0 -239
  374. package/steps-guide/index.umd.js +0 -1
  375. package/steps-guide/package.json +0 -7
  376. package/steps-guide/style.css +0 -1
  377. package/sticky/index.d.ts +0 -7
  378. package/sticky/index.es.js +0 -197
  379. package/sticky/index.umd.js +0 -1
  380. package/sticky/package.json +0 -7
  381. package/tag-input/index.d.ts +0 -7
  382. package/tag-input/index.es.js +0 -329
  383. package/tag-input/index.umd.js +0 -1
  384. package/tag-input/package.json +0 -7
  385. package/tag-input/style.css +0 -1
  386. package/time-axis/index.d.ts +0 -7
  387. package/time-axis/index.es.js +0 -299
  388. package/time-axis/index.umd.js +0 -1
  389. package/time-axis/package.json +0 -7
  390. package/time-axis/style.css +0 -1
  391. package/toast/index.d.ts +0 -7
  392. package/toast/index.es.js +0 -5918
  393. package/toast/index.umd.js +0 -27
  394. package/toast/style.css +0 -1
  395. package/transfer/index.d.ts +0 -7
  396. package/transfer/index.es.js +0 -7340
  397. package/transfer/index.umd.js +0 -27
  398. package/transfer/package.json +0 -7
  399. package/transfer/style.css +0 -1
  400. package/tree-select/index.d.ts +0 -7
  401. package/tree-select/index.es.js +0 -623
  402. package/tree-select/index.umd.js +0 -1
  403. package/tree-select/package.json +0 -7
  404. package/tree-select/style.css +0 -1
@@ -0,0 +1,195 @@
1
+ import { defineComponent, provide, reactive, toRefs, createVNode, shallowRef, inject, computed, onMounted, Transition } from "vue";
2
+ const SELECT_TOKEN = Symbol("dCollapse");
3
+ const collapseProps = {
4
+ modelValue: {
5
+ type: [String, Number, Array],
6
+ default: "",
7
+ required: true
8
+ },
9
+ accordion: {
10
+ type: Boolean,
11
+ default: false
12
+ }
13
+ };
14
+ const collapseItemProps = {
15
+ name: {
16
+ type: [String, Number],
17
+ default: "",
18
+ required: true
19
+ },
20
+ title: {
21
+ type: String,
22
+ default: ""
23
+ },
24
+ disabled: {
25
+ type: Boolean,
26
+ default: false
27
+ }
28
+ };
29
+ function createBem(namespace, element, modifier) {
30
+ let cls = namespace;
31
+ if (element) {
32
+ cls += `__${element}`;
33
+ }
34
+ if (modifier) {
35
+ cls += `--${modifier}`;
36
+ }
37
+ return cls;
38
+ }
39
+ function useNamespace(block, needDot = false) {
40
+ const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
41
+ const b = () => createBem(namespace);
42
+ const e = (element) => element ? createBem(namespace, element) : "";
43
+ const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
44
+ const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
45
+ return {
46
+ b,
47
+ e,
48
+ m,
49
+ em
50
+ };
51
+ }
52
+ var collapse = "";
53
+ var Collapse = defineComponent({
54
+ name: "DCollapse",
55
+ props: collapseProps,
56
+ emits: ["change", "update:modelValue"],
57
+ setup(props, ctx) {
58
+ const ns = useNamespace("collapse");
59
+ const scrollbarNs = useNamespace("scrollbar");
60
+ const getLists = (data) => {
61
+ if (!data && data !== 0) {
62
+ return [];
63
+ }
64
+ return Array.isArray(data) ? data : [data];
65
+ };
66
+ const collapseItemClick = (name) => {
67
+ const activeLists = [...getLists(props.modelValue)];
68
+ const itemIndex = activeLists.indexOf(name);
69
+ if (props.accordion) {
70
+ let activeName = name;
71
+ if ((activeLists[0] || activeLists[0] === 0) && activeLists[0] === name) {
72
+ activeName = "";
73
+ }
74
+ ctx.emit("update:modelValue", activeName);
75
+ ctx.emit("change", activeName);
76
+ } else {
77
+ if (itemIndex > -1) {
78
+ activeLists.splice(itemIndex, 1);
79
+ } else {
80
+ activeLists.push(name);
81
+ }
82
+ ctx.emit("update:modelValue", activeLists);
83
+ ctx.emit("change", activeLists);
84
+ }
85
+ };
86
+ provide(SELECT_TOKEN, reactive({
87
+ ...toRefs(props),
88
+ collapseItemClick
89
+ }));
90
+ return () => {
91
+ var _a, _b;
92
+ return createVNode("div", {
93
+ "class": [ns.b(), scrollbarNs.b()]
94
+ }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
95
+ };
96
+ }
97
+ });
98
+ const OpenIcon = () => {
99
+ const svgProps = {
100
+ width: "1em",
101
+ height: "1em",
102
+ viewBox: "0 0 16 16",
103
+ version: "1.1",
104
+ xmlns: "http://www.w3.org/2000/svg",
105
+ "xmlns:xlink": "http://www.w3.org/1999/xlink"
106
+ };
107
+ return createVNode("svg", svgProps, [createVNode("g", {
108
+ "stroke": "none",
109
+ "stroke-width": "1",
110
+ "fill": "none",
111
+ "fill-rule": "evenodd"
112
+ }, [createVNode("path", {
113
+ "d": "M12.1464466,6.85355339 L8.35355339,10.6464466 C8.15829124,10.8417088 7.84170876,10.8417088 7.64644661,10.6464466 L3.85355339,6.85355339 C3.65829124,6.65829124 3.65829124,6.34170876 3.85355339,6.14644661 C3.94732158,6.05267842 4.07449854,6 4.20710678,6 L11.7928932,6 C12.0690356,6 12.2928932,6.22385763 12.2928932,6.5 C12.2928932,6.63260824 12.2402148,6.7597852 12.1464466,6.85355339 Z",
114
+ "fill-rule": "nonzero"
115
+ }, null)])]);
116
+ };
117
+ var CollapseItem = defineComponent({
118
+ name: "DCollapseItem",
119
+ props: collapseItemProps,
120
+ setup(props, ctx) {
121
+ const ns = useNamespace("collapse");
122
+ const transitionNs = useNamespace("collapse-transition");
123
+ const collapseContent = shallowRef();
124
+ const collapse2 = inject(SELECT_TOKEN, null);
125
+ const isOpen = computed(() => {
126
+ if (props.disabled) {
127
+ return false;
128
+ }
129
+ if (Array.isArray(collapse2 == null ? void 0 : collapse2.modelValue)) {
130
+ return Boolean(collapse2 == null ? void 0 : collapse2.modelValue.length) && (collapse2 == null ? void 0 : collapse2.modelValue.includes(props.name));
131
+ } else {
132
+ return Boolean(collapse2 == null ? void 0 : collapse2.modelValue) && (collapse2 == null ? void 0 : collapse2.modelValue) === props.name;
133
+ }
134
+ });
135
+ const handlerTitleClick = (e) => {
136
+ e.preventDefault();
137
+ e.stopPropagation();
138
+ if (!props.disabled) {
139
+ collapse2 == null ? void 0 : collapse2.collapseItemClick(props.name);
140
+ }
141
+ };
142
+ onMounted(() => {
143
+ if (collapseContent.value) {
144
+ const dom = collapseContent.value;
145
+ if (isOpen.value) {
146
+ dom.style.height = `${dom.offsetHeight}px`;
147
+ }
148
+ }
149
+ });
150
+ const enter = (element) => {
151
+ const el = element;
152
+ el.style.height = "";
153
+ const height = el.offsetHeight;
154
+ el.style.height = "0px";
155
+ el.offsetHeight;
156
+ el.style.height = `${height}px`;
157
+ };
158
+ const leave = (element) => {
159
+ const el = element;
160
+ el.style.height = "0px";
161
+ };
162
+ return () => {
163
+ return createVNode("div", {
164
+ "class": ns.e("item")
165
+ }, [createVNode("div", {
166
+ "class": [ns.e("item-title"), ns.m("overflow-ellipsis"), isOpen.value && ns.m("open"), props.disabled && ns.em("item", "disabled")],
167
+ "onClick": handlerTitleClick
168
+ }, [ctx.slots.title ? ctx.slots.title() : props.title, createVNode("span", {
169
+ "class": ns.e("open-icon")
170
+ }, [createVNode(OpenIcon, null, null)])]), createVNode(Transition, {
171
+ "name": transitionNs.b(),
172
+ "onEnter": enter,
173
+ "onLeave": leave
174
+ }, {
175
+ default: () => {
176
+ var _a, _b;
177
+ return [isOpen.value && createVNode("div", {
178
+ "ref": collapseContent,
179
+ "class": ns.e("item-content")
180
+ }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])];
181
+ }
182
+ })]);
183
+ };
184
+ }
185
+ });
186
+ var index = {
187
+ title: "Collapse \u6298\u53E0\u9762\u677F",
188
+ category: "\u6570\u636E\u5C55\u793A",
189
+ status: "100%",
190
+ install(app) {
191
+ app.component(Collapse.name, Collapse);
192
+ app.component(CollapseItem.name, CollapseItem);
193
+ }
194
+ };
195
+ export { Collapse, CollapseItem, collapseItemProps, collapseProps, index as default };
@@ -0,0 +1 @@
1
+ (function(r,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(r=typeof globalThis!="undefined"?globalThis:r||self,e(r.index={},r.Vue))})(this,function(r,e){"use strict";const V=Symbol("dCollapse"),y={modelValue:{type:[String,Number,Array],default:"",required:!0},accordion:{type:Boolean,default:!1}},N={name:{type:[String,Number],default:"",required:!0},title:{type:String,default:""},disabled:{type:Boolean,default:!1}};function p(n,i,s){let c=n;return i&&(c+=`__${i}`),s&&(c+=`--${s}`),c}function h(n,i=!1){const s=i?`.devui-${n}`:`devui-${n}`;return{b:()=>p(s),e:t=>t?p(s,t):"",m:t=>t?p(s,"",t):"",em:(t,u)=>t&&u?p(s,t,u):""}}var I="",g=e.defineComponent({name:"DCollapse",props:y,emits:["change","update:modelValue"],setup(n,i){const s=h("collapse"),c=h("scrollbar"),m=o=>!o&&o!==0?[]:Array.isArray(o)?o:[o],l=o=>{const t=[...m(n.modelValue)],u=t.indexOf(o);if(n.accordion){let f=o;(t[0]||t[0]===0)&&t[0]===o&&(f=""),i.emit("update:modelValue",f),i.emit("change",f)}else u>-1?t.splice(u,1):t.push(o),i.emit("update:modelValue",t),i.emit("change",t)};return e.provide(V,e.reactive({...e.toRefs(n),collapseItemClick:l})),()=>{var o,t;return e.createVNode("div",{class:[s.b(),c.b()]},[(t=(o=i.slots).default)==null?void 0:t.call(o)])}}});const b=()=>{const n={width:"1em",height:"1em",viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"};return e.createVNode("svg",n,[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("path",{d:"M12.1464466,6.85355339 L8.35355339,10.6464466 C8.15829124,10.8417088 7.84170876,10.8417088 7.64644661,10.6464466 L3.85355339,6.85355339 C3.65829124,6.65829124 3.65829124,6.34170876 3.85355339,6.14644661 C3.94732158,6.05267842 4.07449854,6 4.20710678,6 L11.7928932,6 C12.0690356,6 12.2928932,6.22385763 12.2928932,6.5 C12.2928932,6.63260824 12.2402148,6.7597852 12.1464466,6.85355339 Z","fill-rule":"nonzero"},null)])])};var C=e.defineComponent({name:"DCollapseItem",props:N,setup(n,i){const s=h("collapse"),c=h("collapse-transition"),m=e.shallowRef(),l=e.inject(V,null),o=e.computed(()=>n.disabled?!1:Array.isArray(l==null?void 0:l.modelValue)?Boolean(l==null?void 0:l.modelValue.length)&&(l==null?void 0:l.modelValue.includes(n.name)):Boolean(l==null?void 0:l.modelValue)&&(l==null?void 0:l.modelValue)===n.name),t=a=>{a.preventDefault(),a.stopPropagation(),n.disabled||l==null||l.collapseItemClick(n.name)};e.onMounted(()=>{if(m.value){const a=m.value;o.value&&(a.style.height=`${a.offsetHeight}px`)}});const u=a=>{const d=a;d.style.height="";const w=d.offsetHeight;d.style.height="0px",d.offsetHeight,d.style.height=`${w}px`},f=a=>{const d=a;d.style.height="0px"};return()=>e.createVNode("div",{class:s.e("item")},[e.createVNode("div",{class:[s.e("item-title"),s.m("overflow-ellipsis"),o.value&&s.m("open"),n.disabled&&s.em("item","disabled")],onClick:t},[i.slots.title?i.slots.title():n.title,e.createVNode("span",{class:s.e("open-icon")},[e.createVNode(b,null,null)])]),e.createVNode(e.Transition,{name:c.b(),onEnter:u,onLeave:f},{default:()=>{var a,d;return[o.value&&e.createVNode("div",{ref:m,class:s.e("item-content")},[(d=(a=i.slots).default)==null?void 0:d.call(a)])]}})])}}),v={title:"Collapse \u6298\u53E0\u9762\u677F",category:"\u6570\u636E\u5C55\u793A",status:"100%",install(n){n.component(g.name,g),n.component(C.name,C)}};r.Collapse=g,r.CollapseItem=C,r.collapseItemProps=N,r.collapseProps=y,r.default=v,Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "back-top",
2
+ "name": "collapse",
3
3
  "version": "0.0.0",
4
4
  "main": "index.umd.js",
5
5
  "module": "index.es.js",
@@ -0,0 +1 @@
1
+ @charset "UTF-8";.devui-collapse{font-size:var(--devui-font-size, 14px);background:var(--devui-base-bg, #ffffff);width:100%;overflow-y:auto;box-shadow:var(--devui-shadow-length-base, 0 1px 4px 0) var(--devui-shadow, rgba(37, 43, 58, .2))}:host{display:block}.devui-collapse__item .devui-collapse--overflow-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.devui-collapse__item-title{display:block;height:45px;width:100%;padding:0 28px 0 20px;font-weight:400;line-height:45px;color:var(--devui-text, #252b3a);background-color:var(--devui-base-bg, #ffffff);cursor:pointer}.devui-collapse__item-title.devui-collapse__item--disabled{color:var(--devui-disabled-text, #adb0b8);cursor:not-allowed}.devui-collapse__item-title:not(.devui-collapse__item--disabled):hover{background:var(--devui-list-item-hover-bg, #f2f2f3);color:var(--devui-list-item-hover-text, #252b3a)}.devui-collapse__item>.devui-collapse__item-title{position:relative}.devui-collapse__item>.devui-collapse__item-title>.devui-collapse__open-icon{display:inline-block;text-indent:0;pointer-events:none;position:absolute;right:10px;top:14px;width:16px;height:16px;line-height:16px;transition:transform ease-out .4s}.devui-collapse__item>.devui-collapse__item-title>.devui-collapse__open-icon svg{width:16px;height:16px}.devui-collapse__item>.devui-collapse__item-title>.devui-collapse__open-icon svg path{fill:var(--devui-text-weak, #575d6c)}.devui-collapse__item>.devui-collapse__item-title.devui-collapse--open>.devui-collapse__open-icon{transform:rotate(180deg);transform-origin:center}.devui-collapse__item-content{padding:0 12px 0 20px;line-height:1.5;color:var(--devui-text-weak, #575d6c)}.devui-collapse-transition-leave-active{transition:all .4s ease-in-out;animation:panelUpOut .4s ease-in-out;animation-fill-mode:both}.devui-collapse-transition-enter-active{transition:all .4s ease-in-out;animation:panelUpIn .4s ease-in-out;animation-fill-mode:both}@keyframes panelUpOut{0%{transform:scaleY(1);transform-origin:0% 0%;opacity:1}to{transform:scaleY(0);transform-origin:0% 0%;opacity:0}}@keyframes panelUpIn{0%{transform:scaleY(0);transform-origin:0% 0%;opacity:0}to{transform:scaleY(1);transform-origin:0% 0%;opacity:1}}
@@ -23,9 +23,16 @@ const countdownProps = {
23
23
  }
24
24
  }
25
25
  };
26
- var countdown = "";
27
26
  const getFormatTime = (leftTime) => {
28
- const timeformat = /* @__PURE__ */ new Map([["Y", 0], ["M", 0], ["D", 0], ["H", 0], ["m", 0], ["s", 0], ["S", 0]]);
27
+ const timeformat = /* @__PURE__ */ new Map([
28
+ ["Y", 0],
29
+ ["M", 0],
30
+ ["D", 0],
31
+ ["H", 0],
32
+ ["m", 0],
33
+ ["s", 0],
34
+ ["S", 0]
35
+ ]);
29
36
  const year = Math.floor(leftTime / (365 * 24 * 60 * 60 * 1e3));
30
37
  const month = Math.floor(leftTime / (30 * 24 * 60 * 60 * 1e3) % 12);
31
38
  const day = Math.floor(leftTime / (24 * 60 * 60 * 1e3) % 30);
@@ -43,19 +50,35 @@ const getFormatTime = (leftTime) => {
43
50
  return timeformat;
44
51
  };
45
52
  const getLegalTime = (s, timeformat) => {
46
- const dateValue = /* @__PURE__ */ new Map([["Y", 0], ["M", 0], ["D", 0], ["H", 0], ["m", 0], ["s", 0], ["S", 0]]);
47
- const m = /* @__PURE__ */ new Map([["Y", 12], ["M", 30], ["D", 24], ["H", 60], ["m", 60], ["s", 1e3], ["S", 1]]);
53
+ const dateValue = /* @__PURE__ */ new Map([
54
+ ["Y", 0],
55
+ ["M", 0],
56
+ ["D", 0],
57
+ ["H", 0],
58
+ ["m", 0],
59
+ ["s", 0],
60
+ ["S", 0]
61
+ ]);
62
+ const m = /* @__PURE__ */ new Map([
63
+ ["Y", 12],
64
+ ["M", 30],
65
+ ["D", 24],
66
+ ["H", 60],
67
+ ["m", 60],
68
+ ["s", 1e3],
69
+ ["S", 1]
70
+ ]);
48
71
  let storage = 0;
49
72
  for (const k of dateValue.keys()) {
50
73
  if (s.has(k)) {
51
- dateValue.set(k, timeformat.get(k) + storage);
74
+ dateValue.set(k, (timeformat.get(k) || 0) + storage);
52
75
  storage = 0;
53
76
  } else {
54
- storage += timeformat.get(k) * m.get(k);
77
+ storage += (timeformat.get(k) || 0) * (m.get(k) || 0);
55
78
  }
56
79
  }
57
- if (!s.has("S") && timeformat.get("S") > 500) {
58
- dateValue.set("s", dateValue.get("s") + 1);
80
+ if (!s.has("S") && (timeformat.get("S") || 0) > 500) {
81
+ dateValue.set("s", (dateValue.get("s") || 0) + 1);
59
82
  }
60
83
  return dateValue;
61
84
  };
@@ -96,12 +119,29 @@ const numFormat = (n, len) => {
96
119
  return str + n;
97
120
  }
98
121
  };
122
+ const intervalTimer = (callback, interval = 0) => {
123
+ let counter = 1;
124
+ let timeoutId;
125
+ const startTime = Date.now();
126
+ function main() {
127
+ const nowTime = Date.now();
128
+ const nextTime = startTime + counter * interval;
129
+ timeoutId = setTimeout(main, interval - (nowTime - nextTime));
130
+ counter += 1;
131
+ callback();
132
+ }
133
+ timeoutId = setTimeout(main, interval);
134
+ return () => {
135
+ clearTimeout(timeoutId);
136
+ };
137
+ };
138
+ var countdown = "";
99
139
  var Countdown = defineComponent({
100
140
  name: "DCountdown",
101
141
  props: countdownProps,
102
142
  emits: ["onChange", "onFinish"],
103
143
  setup(props, ctx) {
104
- const countdown2 = ref();
144
+ const timerCleaner = ref();
105
145
  const s = getDeduplication(props.format);
106
146
  const timeFormat = getTimeSplit(props.format);
107
147
  const timeStr = ref("");
@@ -109,7 +149,7 @@ var Countdown = defineComponent({
109
149
  const fomatMap = /* @__PURE__ */ new Set(["Y", "M", "D", "H", "m", "s", "S"]);
110
150
  const t = timeFormat.reduce((pre, cur) => {
111
151
  if (fomatMap.has(cur.k)) {
112
- return pre + numFormat(legalTime.get(cur.k), cur.n);
152
+ return pre + numFormat(legalTime.get(cur.k) || 0, cur.n);
113
153
  }
114
154
  return pre + cur.k;
115
155
  }, "");
@@ -130,13 +170,16 @@ var Countdown = defineComponent({
130
170
  };
131
171
  const startTime = () => {
132
172
  getTime();
133
- if (countdown2.value)
173
+ if (timerCleaner.value) {
134
174
  return;
135
- countdown2.value = setInterval(() => {
175
+ }
176
+ timerCleaner.value = intervalTimer(() => {
177
+ var _a;
136
178
  const t = getTime();
137
179
  if (t === 0) {
138
180
  ctx.emit("onFinish");
139
- clearInterval(countdown2.value);
181
+ (_a = timerCleaner.value) == null ? void 0 : _a.call(timerCleaner);
182
+ timerCleaner.value = null;
140
183
  }
141
184
  }, s.has("S") ? 100 : 1e3);
142
185
  };
@@ -144,7 +187,8 @@ var Countdown = defineComponent({
144
187
  startTime();
145
188
  });
146
189
  onUnmounted(() => {
147
- clearInterval(countdown2.value);
190
+ var _a;
191
+ (_a = timerCleaner.value) == null ? void 0 : _a.call(timerCleaner);
148
192
  });
149
193
  return () => {
150
194
  return createVNode("div", {
@@ -162,15 +206,12 @@ var Countdown = defineComponent({
162
206
  };
163
207
  }
164
208
  });
165
- Countdown.install = function(app) {
166
- app.component(Countdown.name, Countdown);
167
- };
168
209
  var index = {
169
210
  title: "Countdown \u5012\u8BA1\u65F6",
170
211
  category: "\u6570\u636E\u5C55\u793A",
171
212
  status: "100%",
172
213
  install(app) {
173
- app.use(Countdown);
214
+ app.component(Countdown.name, Countdown);
174
215
  }
175
216
  };
176
- export { Countdown, index as default };
217
+ export { Countdown, countdownProps, index as default };
@@ -1 +1 @@
1
- (function(r,a){typeof exports=="object"&&typeof module!="undefined"?a(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],a):(r=typeof globalThis!="undefined"?globalThis:r||self,a(r.index={},r.Vue))})(this,function(r,a){"use strict";const w={value:{type:Number,required:!0},format:{type:String,default:"HH:mm:ss"},prefix:{type:String,default:""},suffix:{type:String,default:""},valueStyle:{type:Object,default:()=>({})}};var T="";const M=e=>{const t=new Map([["Y",0],["M",0],["D",0],["H",0],["m",0],["s",0],["S",0]]),n=Math.floor(e/(365*24*60*60*1e3)),s=Math.floor(e/(30*24*60*60*1e3)%12),o=Math.floor(e/(24*60*60*1e3)%30),u=Math.floor(e/(60*60*1e3)%24),h=Math.floor(e/(60*1e3)%60),f=Math.floor(e/1e3%60),S=e%1e3;return t.set("Y",n),t.set("M",s),t.set("D",o),t.set("H",u),t.set("m",h),t.set("s",f),t.set("S",S),t},p=(e,t)=>{const n=new Map([["Y",0],["M",0],["D",0],["H",0],["m",0],["s",0],["S",0]]),s=new Map([["Y",12],["M",30],["D",24],["H",60],["m",60],["s",1e3],["S",1]]);let o=0;for(const u of n.keys())e.has(u)?(n.set(u,t.get(u)+o),o=0):o+=t.get(u)*s.get(u);return!e.has("S")&&t.get("S")>500&&n.set("s",n.get("s")+1),n},y=e=>{const t=new Set(["Y","M","D","H","m","s","S"]),n=[];for(let s=0;s<e.length;s++){const o=e[s];n.length===0||n[n.length-1].k!==o||!t.has(o)?n.push({k:o,n:1}):n[n.length-1].n++}return n},v=e=>{const t=new Set(["Y","M","D","H","m","s","S"]),n=new Set;for(let s=0;s<e.length;s++){const o=e[s];t.has(o)&&n.add(o)}return n},D=(e,t)=>{const n=10**t-1;if(e>=n)return e;{const s=t-e.toString().length;let o="";for(let u=0;u<s;u++)o+="0";return o+e}};var l=a.defineComponent({name:"DCountdown",props:w,emits:["onChange","onFinish"],setup(e,t){const n=a.ref(),s=v(e.format),o=y(e.format),u=a.ref(""),h=c=>{const i=new Set(["Y","M","D","H","m","s","S"]),m=o.reduce((d,g)=>i.has(g.k)?d+D(c.get(g.k),g.n):d+g.k,"");u.value=m},f=()=>{const c=new Date(e.value).getTime(),i=c>new Date().getTime()?c-new Date().getTime():0,m=M(i),d=p(s,m);return!t.slots.default&&h(d),t.emit("onChange",{leftTime:i,formatTime:m,legalTime:d}),i},S=()=>{f(),!n.value&&(n.value=setInterval(()=>{f()===0&&(t.emit("onFinish"),clearInterval(n.value))},s.has("S")?100:1e3))};return a.onMounted(()=>{S()}),a.onUnmounted(()=>{clearInterval(n.value)}),()=>a.createVNode("div",{class:"devui-countdown"},[t.slots.default?t.slots.default():a.createVNode("div",{class:"countdown-content",style:e.valueStyle},[a.createVNode("span",{class:"countdown-prefix"},[e.prefix]),a.createVNode("span",{class:"countdown-value"},[u.value]),a.createVNode("span",{class:"countdown-suffix"},[e.suffix])])])}});l.install=function(e){e.component(l.name,l)};var H={title:"Countdown \u5012\u8BA1\u65F6",category:"\u6570\u636E\u5C55\u793A",status:"100%",install(e){e.use(l)}};r.Countdown=l,r.default=H,Object.defineProperty(r,"__esModule",{value:!0}),r[Symbol.toStringTag]="Module"});
1
+ (function(i,u){typeof exports=="object"&&typeof module!="undefined"?u(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],u):(i=typeof globalThis!="undefined"?globalThis:i||self,u(i.index={},i.Vue))})(this,function(i,u){"use strict";const S={value:{type:Number,required:!0},format:{type:String,default:"HH:mm:ss"},prefix:{type:String,default:""},suffix:{type:String,default:""},valueStyle:{type:Object,default:()=>({})}},M=e=>{const n=new Map([["Y",0],["M",0],["D",0],["H",0],["m",0],["s",0],["S",0]]),t=Math.floor(e/(365*24*60*60*1e3)),o=Math.floor(e/(30*24*60*60*1e3)%12),s=Math.floor(e/(24*60*60*1e3)%30),a=Math.floor(e/(60*60*1e3)%24),d=Math.floor(e/(60*1e3)%60),l=Math.floor(e/1e3%60),w=e%1e3;return n.set("Y",t),n.set("M",o),n.set("D",s),n.set("H",a),n.set("m",d),n.set("s",l),n.set("S",w),n},p=(e,n)=>{const t=new Map([["Y",0],["M",0],["D",0],["H",0],["m",0],["s",0],["S",0]]),o=new Map([["Y",12],["M",30],["D",24],["H",60],["m",60],["s",1e3],["S",1]]);let s=0;for(const a of t.keys())e.has(a)?(t.set(a,(n.get(a)||0)+s),s=0):s+=(n.get(a)||0)*(o.get(a)||0);return!e.has("S")&&(n.get("S")||0)>500&&t.set("s",(t.get("s")||0)+1),t},y=e=>{const n=new Set(["Y","M","D","H","m","s","S"]),t=[];for(let o=0;o<e.length;o++){const s=e[o];t.length===0||t[t.length-1].k!==s||!n.has(s)?t.push({k:s,n:1}):t[t.length-1].n++}return t},T=e=>{const n=new Set(["Y","M","D","H","m","s","S"]),t=new Set;for(let o=0;o<e.length;o++){const s=e[o];n.has(s)&&t.add(s)}return t},D=(e,n)=>{const t=10**n-1;if(e>=t)return e;{const o=n-e.toString().length;let s="";for(let a=0;a<o;a++)s+="0";return s+e}},v=(e,n=0)=>{let t=1,o;const s=Date.now();function a(){const d=Date.now(),l=s+t*n;o=setTimeout(a,n-(d-l)),t+=1,e()}return o=setTimeout(a,n),()=>{clearTimeout(o)}};var k="",h=u.defineComponent({name:"DCountdown",props:S,emits:["onChange","onFinish"],setup(e,n){const t=u.ref(),o=T(e.format),s=y(e.format),a=u.ref(""),d=c=>{const r=new Set(["Y","M","D","H","m","s","S"]),m=s.reduce((f,g)=>r.has(g.k)?f+D(c.get(g.k)||0,g.n):f+g.k,"");a.value=m},l=()=>{const c=new Date(e.value).getTime(),r=c>new Date().getTime()?c-new Date().getTime():0,m=M(r),f=p(o,m);return!n.slots.default&&d(f),n.emit("onChange",{leftTime:r,formatTime:m,legalTime:f}),r},w=()=>{l(),!t.value&&(t.value=v(()=>{var r;l()===0&&(n.emit("onFinish"),(r=t.value)==null||r.call(t),t.value=null)},o.has("S")?100:1e3))};return u.onMounted(()=>{w()}),u.onUnmounted(()=>{var c;(c=t.value)==null||c.call(t)}),()=>u.createVNode("div",{class:"devui-countdown"},[n.slots.default?n.slots.default():u.createVNode("div",{class:"countdown-content",style:e.valueStyle},[u.createVNode("span",{class:"countdown-prefix"},[e.prefix]),u.createVNode("span",{class:"countdown-value"},[a.value]),u.createVNode("span",{class:"countdown-suffix"},[e.suffix])])])}}),H={title:"Countdown \u5012\u8BA1\u65F6",category:"\u6570\u636E\u5C55\u793A",status:"100%",install(e){e.component(h.name,h)}};i.Countdown=h,i.countdownProps=S,i.default=H,Object.defineProperties(i,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
File without changes