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

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 (403) 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 +8349 -426
  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 +45 -20
  12. package/badge/index.umd.js +1 -1
  13. package/badge/style.css +1 -1
  14. package/button/index.es.js +5743 -127
  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 +8070 -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 +213 -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 +12018 -0
  32. package/date-picker-pro/index.umd.js +27 -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 +184 -5736
  36. package/drawer/index.umd.js +1 -27
  37. package/drawer/style.css +1 -1
  38. package/dropdown/index.es.js +615 -396
  39. package/dropdown/index.umd.js +1 -1
  40. package/dropdown/style.css +1 -1
  41. package/editable-select/index.es.js +786 -195
  42. package/editable-select/index.umd.js +1 -1
  43. package/editable-select/style.css +1 -1
  44. package/form/index.es.js +2360 -2094
  45. package/form/index.umd.js +17 -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 +101 -86
  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 +55 -31
  57. package/image-preview/index.umd.js +1 -1
  58. package/image-preview/style.css +1 -1
  59. package/input/index.es.js +8254 -144
  60. package/input/index.umd.js +27 -1
  61. package/input/style.css +1 -1
  62. package/input-number/index.es.js +270 -187
  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 +74 -35
  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 +2983 -2861
  73. package/mention/index.umd.js +36 -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 +870 -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 +538 -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 +598 -1025
  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 +545 -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 +7974 -157
  213. package/radio/index.umd.js +27 -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 +47 -42
  222. package/ripple/index.umd.js +1 -1
  223. package/search/index.es.js +3868 -1149
  224. package/search/index.umd.js +18 -18
  225. package/search/style.css +1 -1
  226. package/select/index.es.js +9191 -493
  227. package/select/index.umd.js +27 -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 +6220 -226
  236. package/splitter/index.umd.js +27 -1
  237. package/splitter/style.css +1 -1
  238. package/statistic/index.es.js +41 -34
  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 +7804 -64
  251. package/switch/index.umd.js +27 -1
  252. package/switch/style.css +1 -1
  253. package/table/index.es.js +11010 -1367
  254. package/table/index.umd.js +27 -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 +7924 -83
  263. package/textarea/index.umd.js +35 -1
  264. package/textarea/style.css +1 -1
  265. package/time-picker/index.es.js +8914 -602
  266. package/time-picker/index.umd.js +27 -1
  267. package/time-picker/style.css +1 -1
  268. package/{comment → time-select}/index.d.ts +0 -0
  269. package/{transfer → time-select}/index.es.js +4912 -2667
  270. package/time-select/index.umd.js +27 -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 +7556 -2491
  282. package/tree/index.umd.js +18 -18
  283. package/tree/style.css +1 -1
  284. package/upload/index.es.js +865 -6117
  285. package/upload/index.umd.js +1 -27
  286. package/upload/style.css +1 -1
  287. package/vue-devui.es.js +20283 -18856
  288. package/vue-devui.umd.js +30 -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.umd.js +0 -27
  397. package/transfer/package.json +0 -7
  398. package/transfer/style.css +0 -1
  399. package/tree-select/index.d.ts +0 -7
  400. package/tree-select/index.es.js +0 -623
  401. package/tree-select/index.umd.js +0 -1
  402. package/tree-select/package.json +0 -7
  403. package/tree-select/style.css +0 -1
@@ -1,1171 +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
- import { defineComponent, inject, computed, ref, watch, createVNode, withDirectives, mergeProps, resolveDirective, resolveComponent, createTextVNode, reactive, onMounted, onUnmounted } from "vue";
18
- const getDateTime = (d) => {
19
- const year = d.getFullYear();
20
- const month = d.getMonth() + 1;
21
- const date = d.getDate();
22
- const day = d.getDay();
23
- const hour = d.getHours();
24
- const minute = d.getMinutes();
25
- const second = d.getSeconds();
26
- const ms = d.getMilliseconds();
27
- return [year, month, date, day, hour, minute, second, ms];
28
- };
29
- const fixStart = (n, m, max = 2, ch = "0") => {
30
- return (n + "").padStart(Math.min(m.length, max), ch);
31
- };
32
- const formatDate = (fmt, d) => {
33
- const usage = getDateTime(d);
34
- let res = fmt;
35
- res = res.replace(/y+/g, (m) => {
36
- const year = usage[0] + "";
37
- if (m.length === 2) {
38
- return year.substring(2);
39
- }
40
- return year;
41
- });
42
- res = res.replace(/M+/g, (m) => fixStart(usage[1], m));
43
- res = res.replace(/d+/g, (m) => fixStart(usage[2], m));
44
- res = res.replace(/h+/g, (m) => fixStart(usage[4], m));
45
- res = res.replace(/m+/g, (m) => fixStart(usage[5], m));
46
- res = res.replace(/s+/g, (m) => fixStart(usage[6], m));
47
- return res;
48
- };
49
- const formatRange$1 = (fmt, a, b, conn = "-") => {
50
- const ab = [a, b];
51
- if (a.getTime() > b.getTime()) {
52
- ab.reverse();
53
- }
54
- return `${formatDate(fmt, ab[0])} ${conn} ${formatDate(fmt, ab[1])}`;
55
- };
56
- const isIn = (a, b) => {
57
- if (!b) {
58
- return false;
59
- }
60
- while (a) {
61
- if (a === b) {
62
- return true;
63
- }
64
- a = a.parentNode;
65
- }
66
- return false;
67
- };
68
- const invokeFunction = (fn, ...args) => {
69
- if (typeof fn === "function") {
70
- fn(...args);
71
- }
72
- };
73
- const getHumanDate = (d) => {
74
- const year = d.getFullYear();
75
- const month = d.getMonth() + 1;
76
- const date = d.getDate();
77
- const day = d.getDay();
78
- const hour = d.getHours();
79
- const minute = d.getMinutes();
80
- const second = d.getSeconds();
81
- const ms = d.getMilliseconds();
82
- return {
83
- year,
84
- y: year,
85
- month,
86
- M: month,
87
- date,
88
- d: date,
89
- day,
90
- hour,
91
- H: hour,
92
- h: hour,
93
- minute,
94
- m: minute,
95
- second,
96
- s: second,
97
- ms
98
- };
99
- };
100
- const getMonthDays = (year, month) => {
101
- const first = new Date(year, month - 1, 1);
102
- const last = new Date(year, month, 0);
103
- const dates = [];
104
- let day = first.getDay();
105
- while (day > 0) {
106
- day -= 1;
107
- dates.push({ date: new Date(year, month - 1, -day), current: -1 });
108
- }
109
- day = last.getDate() - first.getDate();
110
- for (let i = 0; i <= day; i++) {
111
- const date = new Date(first);
112
- date.setDate(i + 1);
113
- dates.push({ date, current: 0 });
114
- }
115
- day = last.getDay();
116
- let tail = last;
117
- for (let i = day; i < 6; i++) {
118
- tail = new Date(year, month, i - day + 1);
119
- dates.push({ date: tail, current: 1 });
120
- }
121
- if (dates.length < 42) {
122
- day = tail.getDate();
123
- for (let i = 1; i <= 7; i++) {
124
- tail = new Date(year, month, day + i);
125
- dates.push({ date: tail, current: 1 });
126
- }
127
- }
128
- return dates;
129
- };
130
- const getMonthWeeklyDays = (date = new Date()) => {
131
- if (!(date instanceof Date)) {
132
- date = new Date();
133
- }
134
- const { year, month } = getHumanDate(date);
135
- const days = getMonthDays(year, month);
136
- const dayRows = [];
137
- while (days.length > 0) {
138
- dayRows.push(days.splice(0, 7));
139
- }
140
- return dayRows;
141
- };
142
- const WEEK_DAYS = ["\u65E5", "\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D"];
143
- const invokeCallback = (cb, ...args) => {
144
- typeof cb === "function" && cb(...args);
145
- };
146
- const subDateMonth = (a, b) => {
147
- const am = a.getFullYear() * 12 + a.getMonth();
148
- const bm = b.getFullYear() * 12 + b.getMonth();
149
- return am - bm;
150
- };
151
- const ONE_DAY = 1e3 * 60 * 60 * 24;
152
- const subDateDay = (a, b) => {
153
- const ad = new Date(a.getFullYear(), a.getMonth(), a.getDate()).getTime();
154
- const bd = new Date(b.getFullYear(), b.getMonth(), b.getDate()).getTime();
155
- return (ad - bd) / ONE_DAY;
156
- };
157
- const compareDate = (small, big, mode, min) => {
158
- if (!small || !big) {
159
- return true;
160
- }
161
- if (mode === "year") {
162
- return big.getFullYear() - small.getFullYear() > min;
163
- } else {
164
- return subDateMonth(big, small) > min;
165
- }
166
- };
167
- const parseDate = (str) => {
168
- if (!str || typeof str !== "string") {
169
- return null;
170
- }
171
- const [dateStr = "", timeStr = ""] = str.split(/([ ]|T)+/);
172
- if (!dateStr) {
173
- return null;
174
- }
175
- const [y, m, d] = dateStr.split(/[^\d]+/);
176
- const year = _parseInt(y), month = _parseInt(m), date = _parseInt(d) || 1;
177
- if (!year || !month) {
178
- return null;
179
- }
180
- const time = parseTime(timeStr);
181
- return new Date(year, month - 1, date, ...time);
182
- };
183
- const _parseInt = (str, dftVal) => {
184
- if (!str || typeof str !== "string") {
185
- return dftVal;
186
- }
187
- const n = parseInt(str);
188
- if (isNaN(n)) {
189
- return dftVal;
190
- }
191
- return n;
192
- };
193
- const parseTime = (str) => {
194
- const [h, m, s, ms] = str.split(/[\:\.]+/);
195
- return [_parseInt(h, 0), _parseInt(m, 0), _parseInt(s, 0), _parseInt(ms, 0)];
196
- };
197
- const compareDateSort = (d1, d2, type = "d") => {
198
- const t1 = dateCounter(d1, type), t2 = dateCounter(d2, type);
199
- return t1 < t2 ? -1 : t1 > t2 ? 1 : 0;
200
- };
201
- const dateCounter = (date, type) => {
202
- switch (type) {
203
- case "y":
204
- return date.getFullYear();
205
- case "m":
206
- return date.getFullYear() * 12 + date.getMonth();
207
- }
208
- return date.getTime() / ONE_DAY >> 0;
209
- };
210
- const betweenDate = (date, left, right) => {
211
- if (left instanceof Date && compareDateSort(left, date, "d") > 0) {
212
- return false;
213
- }
214
- if (right instanceof Date && compareDateSort(date, right, "d") > 0) {
215
- return false;
216
- }
217
- return true;
218
- };
219
- const inputProps = {
220
- placeholder: {
221
- type: String,
222
- default: void 0
223
- },
224
- disabled: {
225
- type: Boolean,
226
- default: false
227
- },
228
- autoFocus: {
229
- type: Boolean,
230
- default: false
231
- },
232
- maxLength: {
233
- type: Number,
234
- default: Number.MAX_SAFE_INTEGER
235
- },
236
- cssClass: {
237
- type: String,
238
- default: ""
239
- },
240
- error: {
241
- type: Boolean,
242
- default: false
243
- },
244
- size: {
245
- type: String,
246
- default: ""
247
- },
248
- showPassword: {
249
- type: Boolean,
250
- default: false
251
- },
252
- modelValue: {
253
- type: String,
254
- default: ""
255
- },
256
- "update:modelValue": {
257
- type: Function,
258
- default: void 0
259
- },
260
- onChange: {
261
- type: Function,
262
- default: void 0
263
- },
264
- onKeydown: {
265
- type: Function,
266
- default: void 0
267
- },
268
- onFocus: {
269
- type: Function,
270
- default: void 0
271
- },
272
- onBlur: {
273
- type: Function,
274
- default: void 0
275
- }
276
- };
277
- var input = "";
278
- const formItemInjectionKey = Symbol("dFormItem");
279
- const dFormItemEvents = {
280
- blur: "d.form.blur",
281
- change: "d.form.change",
282
- input: "d.form.input"
283
- };
284
- var Input = defineComponent({
285
- name: "DInput",
286
- directives: {
287
- focus: {
288
- mounted: function(el, binding) {
289
- if (binding.value) {
290
- el.focus();
291
- }
292
- }
293
- }
294
- },
295
- props: inputProps,
296
- emits: ["update:modelValue", "focus", "blur", "change", "keydown"],
297
- setup(props, ctx) {
298
- const formItem = inject(formItemInjectionKey, {});
299
- const hasFormItem = Object.keys(formItem).length > 0;
300
- const sizeCls = computed(() => `devui-input-${props.size}`);
301
- const showPwdIcon = ref(false);
302
- const inputType = ref("text");
303
- const inputCls = computed(() => {
304
- return {
305
- error: props.error,
306
- [props.cssClass]: true,
307
- "devui-input-restore": showPwdIcon.value,
308
- [sizeCls.value]: props.size !== ""
309
- };
310
- });
311
- const showPreviewIcon = computed(() => inputType.value === "password");
312
- watch(() => props.showPassword, (flg) => {
313
- inputType.value = flg ? "password" : "text";
314
- showPwdIcon.value = props.showPassword;
315
- }, {
316
- immediate: true
317
- });
318
- const onInput = ($event) => {
319
- ctx.emit("update:modelValue", $event.target.value);
320
- hasFormItem && formItem.formItemMitt.emit(dFormItemEvents.input);
321
- }, onFocus = () => {
322
- ctx.emit("focus");
323
- }, onBlur = () => {
324
- ctx.emit("blur");
325
- hasFormItem && formItem.formItemMitt.emit(dFormItemEvents.blur);
326
- }, onChange = ($event) => {
327
- ctx.emit("change", $event.target.value);
328
- hasFormItem && formItem.formItemMitt.emit(dFormItemEvents.change);
329
- }, onKeydown = ($event) => {
330
- ctx.emit("keydown", $event);
331
- }, onChangeInputType = () => {
332
- inputType.value = inputType.value === "password" ? "text" : "password";
333
- };
334
- return {
335
- inputCls,
336
- inputType,
337
- showPreviewIcon,
338
- showPwdIcon,
339
- onInput,
340
- onFocus,
341
- onBlur,
342
- onChange,
343
- onKeydown,
344
- onChangeInputType
345
- };
346
- },
347
- render() {
348
- const {
349
- modelValue,
350
- showPreviewIcon,
351
- showPwdIcon,
352
- inputCls,
353
- inputType,
354
- maxLength,
355
- autoFocus,
356
- placeholder,
357
- disabled,
358
- onInput,
359
- onFocus,
360
- onBlur,
361
- onChange,
362
- onKeydown,
363
- onChangeInputType
364
- } = this;
365
- return createVNode("div", {
366
- "class": "devui-input__wrap"
367
- }, [withDirectives(createVNode("input", mergeProps({
368
- dinput: true
369
- }, {
370
- "value": modelValue,
371
- "disabled": disabled,
372
- "type": inputType,
373
- "maxlength": maxLength,
374
- "placeholder": placeholder,
375
- "class": inputCls,
376
- "onInput": onInput,
377
- "onFocus": onFocus,
378
- "onBlur": onBlur,
379
- "onChange": onChange,
380
- "onKeydown": onKeydown
381
- }), null), [[resolveDirective("focus"), autoFocus]]), showPwdIcon && createVNode("div", {
382
- "class": "devui-input__preview",
383
- "onClick": onChangeInputType
384
- }, [showPreviewIcon ? createVNode(resolveComponent("d-icon"), {
385
- "name": "preview-forbidden",
386
- "size": "12px",
387
- "key": 1
388
- }, null) : createVNode(resolveComponent("d-icon"), {
389
- "name": "preview",
390
- "size": "12px",
391
- "key": 2
392
- }, null)])]);
393
- }
394
- });
395
- Input.install = function(app) {
396
- app.component(Input.name, Input);
397
- };
398
- var Icon = defineComponent({
399
- name: "DIcon",
400
- props: {
401
- name: {
402
- type: String,
403
- required: true
404
- },
405
- size: {
406
- type: String,
407
- default: "inherit"
408
- },
409
- color: {
410
- type: String,
411
- default: "inherit"
412
- },
413
- classPrefix: {
414
- type: String,
415
- default: "icon"
416
- }
417
- },
418
- setup(props) {
419
- return __spreadValues({}, props);
420
- },
421
- render() {
422
- const {
423
- name,
424
- size,
425
- color,
426
- classPrefix
427
- } = this;
428
- return /^((https?):)?\/\//.test(name) ? createVNode("img", {
429
- "src": name,
430
- "alt": name.split("/")[name.split("/").length - 1],
431
- "style": {
432
- width: size,
433
- verticalAlign: "text-bottom"
434
- }
435
- }, null) : createVNode("i", {
436
- "class": `${classPrefix} ${classPrefix}-${name}`,
437
- "style": {
438
- fontSize: size,
439
- color
440
- }
441
- }, null);
442
- }
443
- });
444
- Icon.install = function(app) {
445
- app.component(Icon.name, Icon);
446
- };
447
- const handleCalendarSwitchState = (state, index2, pos, date) => {
448
- switch (index2) {
449
- case 0:
450
- const preYear = new Date(date);
451
- preYear.setFullYear(preYear.getFullYear() - 1);
452
- pos === 0 ? state.current = preYear : state.next = preYear;
453
- break;
454
- case 1:
455
- const preMonth = new Date(date);
456
- preMonth.setMonth(preMonth.getMonth() - 1);
457
- pos === 0 ? state.current = preMonth : state.next = preMonth;
458
- break;
459
- case 2:
460
- const nextMonth = new Date(date);
461
- nextMonth.setMonth(nextMonth.getMonth() + 1);
462
- pos === 0 ? state.current = nextMonth : state.next = nextMonth;
463
- break;
464
- case 3:
465
- const nextYear = new Date(date);
466
- nextYear.setFullYear(nextYear.getFullYear() + 1);
467
- pos === 0 ? state.current = nextYear : state.next = nextYear;
468
- break;
469
- }
470
- };
471
- const formatValue = (state, props) => {
472
- const { format = "y/MM/dd", range, rangeSpliter = "-" } = props || {};
473
- if (range) {
474
- if (!state.start) {
475
- return "";
476
- } else if (!state.end) {
477
- return formatDate(format, state.start);
478
- }
479
- if (state.end < state.start) {
480
- const end = state.end;
481
- state.end = state.start;
482
- state.start = end;
483
- }
484
- return formatRange$1(format, state.start, state.end, rangeSpliter);
485
- } else {
486
- if (!state.start) {
487
- return "";
488
- }
489
- return formatDate(format, state.start);
490
- }
491
- };
492
- const formatPlaceholder = (props) => {
493
- if (!props)
494
- return "";
495
- const format = props.format || `y/MM/dd`;
496
- const sp = props.rangeSpliter || "-";
497
- return props.range ? `${format} ${sp} ${format}` : format;
498
- };
499
- const getDateKey = (date) => {
500
- return date.toDateString();
501
- };
502
- const cellClassName = (props, day, base = "cell") => {
503
- if (!betweenDate(day.date, props.dateMin, props.dateMax)) {
504
- return `${base} disabled`;
505
- } else if (day.current !== 0) {
506
- return `${base} not-current`;
507
- }
508
- const key = getDateKey(day.date);
509
- if (props.type === "range") {
510
- if (props.dateStart) {
511
- if (getDateKey(props.dateStart) === key) {
512
- return `${base} selected`;
513
- }
514
- if (props.dateEnd && getDateKey(props.dateEnd) === key) {
515
- return `${base} selected`;
516
- }
517
- const innerEnd = props.dateEnd || props.dateHover;
518
- if (innerEnd) {
519
- const range = innerEnd > props.dateStart ? [props.dateStart, innerEnd] : [innerEnd, props.dateStart];
520
- if (day.date > range[0] && day.date < range[1]) {
521
- return `${base} innerday`;
522
- }
523
- }
524
- }
525
- return base;
526
- } else {
527
- return props.dateStart && getDateKey(props.dateStart) === key ? `${base} selected` : base;
528
- }
529
- };
530
- const trigEvent = (props, day) => {
531
- if (!betweenDate(day.date, props.dateMin, props.dateMax)) {
532
- return;
533
- }
534
- if (props.type === "range") {
535
- if (!props.dateStart) {
536
- invokeCallback(props.onSelectStart, day.date);
537
- } else if (!props.dateEnd) {
538
- if (subDateDay(props.dateStart, day.date) !== 0) {
539
- invokeCallback(props.onSelectEnd, day.date);
540
- typeof props.onChange === "function" && props.onChange(props.type, props);
541
- }
542
- } else {
543
- invokeCallback(props.onReset, day.date);
544
- }
545
- } else {
546
- invokeCallback(props.onSelected, day.date);
547
- typeof props.onChange === "function" && props.onChange(props.type, props);
548
- }
549
- };
550
- const handleDateEnter = (props, day) => {
551
- if (day.current !== 0) {
552
- return;
553
- }
554
- const { dateMin, dateMax } = props;
555
- if (dateMin && subDateDay(day.date, dateMin) < 0) {
556
- return;
557
- }
558
- if (dateMax && subDateDay(dateMax, day.date) < 0) {
559
- return;
560
- }
561
- if (props.type === "range") {
562
- const key = getDateKey(day.date);
563
- if (!props.dateStart || getDateKey(props.dateStart) === key || props.dateEnd) {
564
- return;
565
- }
566
- invokeCallback(props.onSelecting, day.date);
567
- }
568
- };
569
- const Year = (props) => {
570
- const {
571
- color = "#585d6b",
572
- rotate = 0
573
- } = props;
574
- return createVNode("svg", {
575
- "style": {
576
- transform: `rotate(${rotate}deg)`
577
- },
578
- "width": "10px",
579
- "height": "10px",
580
- "viewBox": "0 0 10 10",
581
- "version": "1.1",
582
- "xmlns": "http://www.w3.org/2000/svg"
583
- }, [createVNode("g", {
584
- "fill": color,
585
- "transform": "translate(-1.000000, -1.000000)"
586
- }, [createVNode("path", {
587
- "d": "M11,1.83333333 L11,10.1666667 L7,7.38833333 L7,10.1666667 L1,6 L7,1.83333333 L7,4.61033333 L11,1.83333333 Z"
588
- }, null)])]);
589
- };
590
- const Month = (props) => {
591
- const {
592
- color = "#585d6b",
593
- rotate = 0
594
- } = props;
595
- return createVNode("svg", {
596
- "style": {
597
- transform: `rotate(${rotate}deg)`
598
- },
599
- "width": "6px",
600
- "height": "10px",
601
- "viewBox": "0 0 6 10",
602
- "version": "1.1",
603
- "xmlns": "http://www.w3.org/2000/svg"
604
- }, [createVNode("g", {
605
- "fill": color,
606
- "transform": "translate(-3.000000, -1.000000)"
607
- }, [createVNode("polygon", {
608
- "points": "6 3 10.1666667 9 1.83333333 9"
609
- }, null)])]);
610
- };
611
- var index$6 = "";
612
- const Item = (props) => {
613
- const {
614
- button: Btn,
615
- disabled = false,
616
- rotate = 0,
617
- date,
618
- pos
619
- } = props;
620
- const color = disabled ? "#cfd0d3" : "#585d6b";
621
- const className = `${disabled ? "disabled" : ""}`;
622
- const handleClick = disabled ? void 0 : () => invokeCallback(props.cb, date, pos);
623
- return createVNode("a", {
624
- "class": className,
625
- "onClick": handleClick
626
- }, [createVNode(Btn, {
627
- "color": color,
628
- "rotate": rotate
629
- }, null)]);
630
- };
631
- const Title = (props) => {
632
- const {
633
- date
634
- } = props;
635
- return createVNode("a", {
636
- "class": "title"
637
- }, [`${date.getFullYear()}\u5E74${(date.getMonth() + 1 + "").padStart(2, "0")}\u6708`]);
638
- };
639
- const CalendarToolbar = (props) => {
640
- const {
641
- type,
642
- current,
643
- compare,
644
- pos,
645
- dateMax,
646
- dateMin,
647
- onPreviousYear,
648
- onPreviousMonth,
649
- onNextMonth,
650
- onNextYear
651
- } = props;
652
- const dis = [false, false, false, false];
653
- if (type === "range") {
654
- if (pos === 1) {
655
- dis[0] = !compareDate(compare, current, "year", 1);
656
- dis[1] = !compareDate(compare, current, "month", 1);
657
- dis[2] = !compareDate(current, dateMax, "month", 0);
658
- dis[3] = !compareDate(current, dateMax, "year", 0);
659
- } else {
660
- dis[0] = !compareDate(dateMin, current, "year", 0);
661
- dis[1] = !compareDate(dateMin, current, "month", 0);
662
- dis[2] = !compareDate(current, compare, "month", 1);
663
- dis[3] = !compareDate(current, compare, "year", 1);
664
- }
665
- } else {
666
- dis[0] = !compareDate(dateMin, current, "year", 0);
667
- dis[1] = !compareDate(dateMin, current, "month", 0);
668
- dis[2] = !compareDate(current, dateMax, "month", 0);
669
- dis[3] = !compareDate(current, dateMax, "year", 0);
670
- }
671
- return createVNode("div", {
672
- "class": "devui-calendar-toolbar"
673
- }, [createVNode(Item, {
674
- "disabled": dis[0],
675
- "date": current,
676
- "pos": pos,
677
- "button": Year,
678
- "cb": onPreviousYear
679
- }, null), createVNode(Item, {
680
- "disabled": dis[1],
681
- "date": current,
682
- "pos": pos,
683
- "button": Month,
684
- "rotate": -90,
685
- "cb": onPreviousMonth
686
- }, null), createVNode(Title, {
687
- "date": current
688
- }, null), createVNode(Item, {
689
- "disabled": dis[2],
690
- "date": current,
691
- "pos": pos,
692
- "button": Month,
693
- "rotate": 90,
694
- "cb": onNextMonth
695
- }, null), createVNode(Item, {
696
- "disabled": dis[3],
697
- "date": current,
698
- "pos": pos,
699
- "button": Year,
700
- "rotate": 180,
701
- "cb": onNextYear
702
- }, null)]);
703
- };
704
- const TodayDefault = (props) => {
705
- const {
706
- onSelected = () => 0,
707
- disabled = false
708
- } = props;
709
- return createVNode("div", {
710
- "class": `today-container ${disabled ? "disabled" : ""}`
711
- }, [createVNode("button", {
712
- "class": "today-button",
713
- "disabled": disabled,
714
- "onClick": disabled ? void 0 : () => onSelected(new Date())
715
- }, [createTextVNode("\u4ECA\u5929")])]);
716
- };
717
- var index$5 = "";
718
- const CalendarDatePanel = (props) => {
719
- const today = new Date();
720
- return createVNode("div", {
721
- "class": "devui-calendar-panel"
722
- }, [createVNode(CalendarToolbar, {
723
- "current": props.current,
724
- "compare": props.compare,
725
- "pos": props.pos,
726
- "type": props.type,
727
- "showTime": props.showTime,
728
- "onPreviousYear": props.onPreviousYear,
729
- "onPreviousMonth": props.onPreviousMonth,
730
- "onNextMonth": props.onNextMonth,
731
- "onNextYear": props.onNextYear,
732
- "dateMax": props.dateMax,
733
- "dateMin": props.dateMin
734
- }, null), createVNode("ol", {
735
- "class": "head row"
736
- }, [WEEK_DAYS.map((day) => createVNode("li", {
737
- "class": "cell"
738
- }, [day]))]), createVNode("ul", {
739
- "class": "body"
740
- }, [getMonthWeeklyDays(props.current).map((row) => createVNode("li", {
741
- "class": "row"
742
- }, [row.map((day) => {
743
- return createVNode("span", {
744
- "class": cellClassName(props, day),
745
- "onClick": () => trigEvent(props, day),
746
- "onMouseenter": () => handleDateEnter(props, day)
747
- }, [day.date.getDate()]);
748
- })]))]), props.type !== "range" ? createVNode(TodayDefault, {
749
- "disabled": !betweenDate(today, props.dateMin, props.dateMax),
750
- "onSelected": (today2) => {
751
- typeof props.onToday === "function" && props.onToday(today2, 0);
752
- }
753
- }, null) : null]);
754
- };
755
- var index$4 = "";
756
- const VerticalSlider = defineComponent({
757
- props: {
758
- size: {
759
- type: Number,
760
- default: 26
761
- },
762
- items: {
763
- type: Array
764
- },
765
- selectedIndex: {
766
- type: Number
767
- },
768
- className: {
769
- type: String
770
- },
771
- itemClassNormal: {
772
- type: String
773
- },
774
- itemClassSelected: {
775
- type: String
776
- },
777
- onChange: {
778
- type: Function
779
- }
780
- },
781
- setup(props) {
782
- const {
783
- items = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
784
- selectedIndex = 0,
785
- size = 26,
786
- className = "",
787
- itemClassNormal = "",
788
- itemClassSelected = "selected",
789
- onChange
790
- } = props || {};
791
- let max_y = 0, min_y = 0;
792
- const container = ref();
793
- const movbar = ref();
794
- let pos_start = null;
795
- let pos_cache = null;
796
- const state = reactive({
797
- selectedIndex,
798
- barOpacity: 0,
799
- x: 0,
800
- y: 0,
801
- transition: "none"
802
- });
803
- const handleMouseDown = (e) => {
804
- e.stopPropagation();
805
- e.preventDefault();
806
- pos_start = [e.clientX, e.clientY];
807
- state.transition = "none";
808
- };
809
- const handleMouseMove = (e) => {
810
- e.stopPropagation();
811
- e.preventDefault();
812
- if (!pos_start || !pos_cache) {
813
- return;
814
- }
815
- state.x = pos_cache[0] + e.clientX - pos_start[0];
816
- state.y = Math.min(max_y, Math.max(min_y, pos_cache[1] + e.clientY - pos_start[1]));
817
- state.selectedIndex = (max_y - state.y + size / 2) / size >> 0;
818
- };
819
- const handleMouseUp = (e) => {
820
- e.stopPropagation();
821
- e.preventDefault();
822
- pos_start = null;
823
- state.y = max_y - state.selectedIndex * size;
824
- state.transition = "transform 0.1s";
825
- pos_cache[0] = state.x;
826
- pos_cache[1] = state.y;
827
- if (typeof onChange === "function") {
828
- const idx = state.selectedIndex;
829
- const val = items[idx];
830
- onChange(val, idx);
831
- }
832
- };
833
- onMounted(() => {
834
- const {
835
- height: ch
836
- } = container.value.getBoundingClientRect();
837
- const {
838
- height: mh
839
- } = movbar.value.getBoundingClientRect();
840
- max_y = (ch - size) / 2;
841
- min_y = (ch + size) / 2 - mh;
842
- pos_cache = [0, max_y - state.selectedIndex * size];
843
- state.x = pos_cache[0];
844
- state.y = pos_cache[1];
845
- state.barOpacity = 1;
846
- state.transition = "transform 0.1s";
847
- });
848
- return () => {
849
- return createVNode("div", {
850
- "ref": container,
851
- "class": `devui-vertical-slider ${className}`
852
- }, [createVNode("div", {
853
- "ref": movbar,
854
- "class": "movable-bar",
855
- "style": {
856
- opacity: state.barOpacity,
857
- transform: `translateY(${state.y}px)`,
858
- transition: state.transition
859
- }
860
- }, [items.map((c, i) => {
861
- const className2 = i === state.selectedIndex ? itemClassSelected : itemClassNormal;
862
- return createVNode("span", {
863
- "class": `slider-item ${className2}`,
864
- "style": {
865
- height: `${size}px`,
866
- lineHeight: `${size}px`
867
- }
868
- }, [c]);
869
- })]), createVNode("div", {
870
- "class": "slider-mask",
871
- "onMousedown": handleMouseDown,
872
- "onMousemove": handleMouseMove,
873
- "onMouseup": handleMouseUp,
874
- "onMouseout": handleMouseUp
875
- }, null)]);
876
- };
877
- }
878
- });
879
- var index$3 = "";
880
- const TimePicker = defineComponent({
881
- props: {
882
- time: {
883
- type: Date
884
- }
885
- },
886
- setup(props) {
887
- const {
888
- time = new Date()
889
- } = props || {};
890
- const state = reactive({
891
- hour: time.getHours(),
892
- minute: time.getMinutes(),
893
- second: time.getSeconds()
894
- });
895
- const hours = Array(24).fill(0).map((_, i) => `${i}`.padStart(2, "0"));
896
- const minutes = Array(60).fill(0).map((_, i) => `${i}`.padStart(2, "0"));
897
- return () => {
898
- return createVNode("div", {
899
- "class": "devui-calendar-timepicker"
900
- }, [createVNode("div", {
901
- "class": "head"
902
- }, [createVNode("div", {
903
- "class": "chars"
904
- }, [createVNode("span", null, [state.hour.toString().padStart(2, "0"), createTextVNode(":"), state.minute.toString().padStart(2, "0"), createTextVNode(":"), state.second.toString().padStart(2, "0")])])]), createVNode("div", {
905
- "class": "select"
906
- }, [createVNode(VerticalSlider, {
907
- "items": hours,
908
- "selectedIndex": state.hour,
909
- "onChange": (_, idx) => state.hour = idx
910
- }, null), createVNode(VerticalSlider, {
911
- "items": minutes,
912
- "selectedIndex": state.minute,
913
- "onChange": (_, idx) => state.minute = idx
914
- }, null), createVNode(VerticalSlider, {
915
- "items": minutes,
916
- "selectedIndex": state.second,
917
- "onChange": (_, idx) => state.second = idx
918
- }, null)])]);
919
- };
920
- }
921
- });
922
- var index$2 = "";
923
- const Calendar = (props) => {
924
- const {
925
- showTime = false
926
- } = props;
927
- let {
928
- current
929
- } = props;
930
- if (!(current instanceof Date)) {
931
- current = new Date();
932
- }
933
- if (props.type === "range") {
934
- let {
935
- next
936
- } = props;
937
- if (!(next instanceof Date)) {
938
- next = new Date(current.getFullYear(), current.getMonth() + 1, 1);
939
- }
940
- return createVNode("div", {
941
- "class": "devui-calendar-container"
942
- }, [createVNode(CalendarDatePanel, mergeProps(props, {
943
- "pos": 0,
944
- "current": current,
945
- "compare": next
946
- }), null), showTime ? createVNode(TimePicker, {
947
- "time": current
948
- }, null) : null, createVNode(CalendarDatePanel, mergeProps(props, {
949
- "pos": 1,
950
- "current": next,
951
- "compare": current
952
- }), null), showTime ? createVNode(TimePicker, {
953
- "time": next
954
- }, null) : null]);
955
- } else {
956
- return createVNode("div", {
957
- "class": "devui-calendar-container"
958
- }, [createVNode(CalendarDatePanel, mergeProps(props, {
959
- "pos": 0,
960
- "current": current
961
- }), null), showTime ? createVNode(TimePicker, {
962
- "time": current
963
- }, null) : null]);
964
- }
965
- };
966
- var datePicker = "";
967
- const formatRange = (state) => {
968
- const [start, end] = [state.start, state.end].sort((a, b) => a.getTime() - b.getTime());
969
- state.start = start;
970
- state.end = end;
971
- if (compareDateSort(start, end, "m") !== 0) {
972
- state.current = start;
973
- state.next = end;
974
- } else {
975
- if (compareDateSort(start, state.current) < 0) {
976
- state.current = start;
977
- }
978
- if (compareDateSort(state.next, end) < 0) {
979
- state.next = end;
980
- }
981
- }
982
- };
983
- var DatePicker = defineComponent({
984
- name: "DDatepicker",
985
- props: {
986
- selectedDateChange: {
987
- type: Function
988
- },
989
- autoClose: {
990
- type: Boolean,
991
- default: false
992
- },
993
- range: {
994
- type: Boolean,
995
- default: false
996
- },
997
- showTime: {
998
- type: Boolean,
999
- default: false
1000
- },
1001
- format: {
1002
- type: String,
1003
- default: "y/MM/dd"
1004
- },
1005
- rangeSpliter: {
1006
- type: String,
1007
- default: "-"
1008
- },
1009
- attachInputDom: {
1010
- type: String
1011
- },
1012
- dateMin: {
1013
- type: String
1014
- },
1015
- dateMax: {
1016
- type: String
1017
- }
1018
- },
1019
- setup(props) {
1020
- const panel = ref(null);
1021
- const input2 = ref(null);
1022
- const current = parseDate(props.dateMin) || new Date();
1023
- const next = new Date(current.getFullYear(), current.getMonth() + 1, 1);
1024
- const state = reactive({
1025
- show: false,
1026
- value: "",
1027
- placeholder: formatPlaceholder(props),
1028
- current,
1029
- next
1030
- });
1031
- state.value = formatValue(state, props);
1032
- state.placeholder = formatPlaceholder(props);
1033
- const documentClick = (e) => {
1034
- e.stopPropagation();
1035
- if (isIn(e.target, panel.value) || isIn(e.target, input2.value)) {
1036
- return;
1037
- }
1038
- state.show = false;
1039
- };
1040
- onMounted(() => {
1041
- document.addEventListener("click", documentClick);
1042
- });
1043
- onUnmounted(() => {
1044
- document.removeEventListener("click", documentClick);
1045
- });
1046
- return () => {
1047
- return createVNode("div", {
1048
- "class": "devui-datepicker-container"
1049
- }, [createVNode("div", {
1050
- "class": "input-container",
1051
- "ref": input2
1052
- }, [createVNode(Input, {
1053
- "ref": input2,
1054
- "class": "datepicker-input",
1055
- "modelValue": state.value,
1056
- "placeholder": state.placeholder,
1057
- "onFocus": () => state.show = true
1058
- }, null), createVNode(Icon, {
1059
- "size": "small",
1060
- "name": "calendar",
1061
- "class": "datepicker-input-icon"
1062
- }, null)]), createVNode("div", {
1063
- "class": "devui-datepicker-panel",
1064
- "ref": panel
1065
- }, [state.show ? createVNode(Calendar, {
1066
- "type": props.range ? "range" : "select",
1067
- "showTime": props.showTime,
1068
- "current": state.current,
1069
- "next": state.next,
1070
- "dateMin": parseDate(props.dateMin),
1071
- "dateMax": parseDate(props.dateMax),
1072
- "dateStart": state.start,
1073
- "dateEnd": state.end,
1074
- "dateHover": state.hover,
1075
- "onReset": (date) => {
1076
- state.end = state.hover = void 0;
1077
- state.start = date;
1078
- },
1079
- "onChange": () => {
1080
- state.value = formatValue(state, props);
1081
- state.placeholder = formatPlaceholder(props);
1082
- invokeFunction(props.selectedDateChange, state.value);
1083
- if (props.autoClose) {
1084
- state.show = false;
1085
- }
1086
- },
1087
- "onToday": (date) => {
1088
- state.current = date;
1089
- state.start = date;
1090
- state.value = formatValue(state, props);
1091
- state.placeholder = formatPlaceholder(props);
1092
- invokeFunction(props.selectedDateChange, state.value);
1093
- if (props.autoClose) {
1094
- state.show = false;
1095
- }
1096
- },
1097
- "onSelected": (date) => {
1098
- state.start = date;
1099
- if (compareDateSort(state.current, date) !== 0) {
1100
- state.current = date;
1101
- }
1102
- },
1103
- "onSelectStart": (date) => state.start = date,
1104
- "onSelectEnd": (date) => {
1105
- state.end = date;
1106
- formatRange(state);
1107
- },
1108
- "onSelecting": (date) => state.hover = date,
1109
- "onPreviousYear": (date, pos) => handleCalendarSwitchState(state, 0, pos, date),
1110
- "onPreviousMonth": (date, pos) => handleCalendarSwitchState(state, 1, pos, date),
1111
- "onNextMonth": (date, pos) => handleCalendarSwitchState(state, 2, pos, date),
1112
- "onNextYear": (date, pos) => handleCalendarSwitchState(state, 3, pos, date)
1113
- }, null) : null])]);
1114
- };
1115
- }
1116
- });
1117
- var index$1 = "";
1118
- const StickSlider = defineComponent({
1119
- name: "DStickSlider",
1120
- props: {},
1121
- setup() {
1122
- const state = reactive({
1123
- showButtons: false,
1124
- selectedIndex: 0
1125
- });
1126
- const reset = () => {
1127
- state.showButtons = false;
1128
- };
1129
- const handleMainButtonMouseDown = (e) => {
1130
- e.stopPropagation();
1131
- state.showButtons = true;
1132
- };
1133
- const handleMainButtonMouseUp = (e) => {
1134
- e.stopPropagation();
1135
- reset();
1136
- };
1137
- return () => {
1138
- return createVNode("div", {
1139
- "class": "devui-stick-slider",
1140
- "onMousedown": handleMainButtonMouseDown,
1141
- "onMouseup": handleMainButtonMouseUp,
1142
- "onMouseleave": handleMainButtonMouseUp
1143
- }, [createVNode("div", {
1144
- "class": "sub-buttons",
1145
- "style": {
1146
- display: state.showButtons ? "" : "none"
1147
- }
1148
- }, [Array(16).fill(null).map((_, i) => {
1149
- return createVNode("div", {
1150
- "class": `button ${i === state.selectedIndex ? "selected" : ""}`,
1151
- "onMouseenter": () => state.selectedIndex = i
1152
- }, [i]);
1153
- })]), createVNode("div", {
1154
- "class": "main-button"
1155
- }, null)]);
1156
- };
1157
- }
1158
- });
1159
- DatePicker.install = function(app) {
1160
- app.component(DatePicker.name, DatePicker);
1161
- app.component(StickSlider.name, StickSlider);
1162
- };
1163
- var index = {
1164
- title: "DatePicker \u65E5\u671F\u9009\u62E9\u5668",
1165
- category: "\u6570\u636E\u5F55\u5165",
1166
- status: "50%",
1167
- install(app) {
1168
- app.use(DatePicker);
1169
- }
1170
- };
1171
- export { DatePicker, StickSlider, index as default };