vue-devui 1.0.0-beta.2 → 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 (455) hide show
  1. package/README.md +163 -172
  2. package/alert/index.d.ts +7 -0
  3. package/alert/index.es.js +79 -51
  4. package/alert/index.umd.js +1 -1
  5. package/alert/style.css +1 -1
  6. package/auto-complete/index.d.ts +7 -0
  7. package/auto-complete/index.es.js +9044 -0
  8. package/auto-complete/index.umd.js +29 -0
  9. package/auto-complete/package.json +7 -0
  10. package/auto-complete/style.css +1 -0
  11. package/avatar/index.d.ts +7 -0
  12. package/avatar/index.es.js +154 -147
  13. package/avatar/index.umd.js +1 -1
  14. package/avatar/style.css +1 -1
  15. package/badge/index.d.ts +7 -0
  16. package/badge/index.es.js +46 -21
  17. package/badge/index.umd.js +1 -1
  18. package/badge/style.css +1 -1
  19. package/button/index.d.ts +7 -0
  20. package/button/index.es.js +5927 -131
  21. package/button/index.umd.js +27 -1
  22. package/button/style.css +1 -1
  23. package/card/index.d.ts +7 -0
  24. package/card/index.es.js +64 -36
  25. package/card/index.umd.js +1 -1
  26. package/card/style.css +1 -1
  27. package/checkbox/index.d.ts +7 -0
  28. package/checkbox/index.es.js +8082 -232
  29. package/checkbox/index.umd.js +27 -1
  30. package/checkbox/style.css +1 -1
  31. package/collapse/index.d.ts +7 -0
  32. package/collapse/index.es.js +213 -0
  33. package/collapse/index.umd.js +1 -0
  34. package/{cascader → collapse}/package.json +1 -1
  35. package/collapse/style.css +1 -0
  36. package/countdown/index.d.ts +7 -0
  37. package/countdown/index.es.js +217 -0
  38. package/countdown/index.umd.js +1 -0
  39. package/{accordion → countdown}/package.json +1 -1
  40. package/countdown/style.css +1 -0
  41. package/date-picker-pro/index.d.ts +7 -0
  42. package/date-picker-pro/index.es.js +12018 -0
  43. package/date-picker-pro/index.umd.js +27 -0
  44. package/date-picker-pro/package.json +7 -0
  45. package/date-picker-pro/style.css +1 -0
  46. package/drawer/index.d.ts +7 -0
  47. package/drawer/index.es.js +203 -139
  48. package/drawer/index.umd.js +1 -1
  49. package/drawer/style.css +1 -1
  50. package/dropdown/index.d.ts +7 -0
  51. package/dropdown/index.es.js +754 -0
  52. package/dropdown/index.umd.js +1 -0
  53. package/{carousel → dropdown}/package.json +1 -1
  54. package/dropdown/style.css +1 -0
  55. package/editable-select/index.d.ts +7 -0
  56. package/editable-select/index.es.js +912 -442
  57. package/editable-select/index.umd.js +1 -1
  58. package/editable-select/style.css +1 -1
  59. package/form/index.d.ts +7 -0
  60. package/form/index.es.js +2415 -1985
  61. package/form/index.umd.js +18 -18
  62. package/form/style.css +1 -1
  63. package/fullscreen/index.d.ts +7 -0
  64. package/fullscreen/index.es.js +138 -125
  65. package/fullscreen/index.umd.js +1 -1
  66. package/fullscreen/style.css +1 -1
  67. package/grid/index.d.ts +7 -0
  68. package/grid/index.es.js +284 -0
  69. package/grid/index.umd.js +1 -0
  70. package/{toast → grid}/package.json +1 -1
  71. package/grid/style.css +1 -0
  72. package/icon/index.d.ts +7 -0
  73. package/icon/index.es.js +200 -56
  74. package/icon/index.umd.js +1 -1
  75. package/icon/style.css +1 -0
  76. package/image-preview/index.d.ts +7 -0
  77. package/image-preview/index.es.js +142 -39
  78. package/image-preview/index.umd.js +1 -1
  79. package/image-preview/style.css +1 -1
  80. package/index.d.ts +7 -0
  81. package/input/index.d.ts +7 -0
  82. package/input/index.es.js +8255 -145
  83. package/input/index.umd.js +27 -1
  84. package/input/style.css +1 -1
  85. package/input-number/index.d.ts +7 -0
  86. package/input-number/index.es.js +270 -186
  87. package/input-number/index.umd.js +1 -1
  88. package/input-number/style.css +1 -1
  89. package/layout/index.d.ts +7 -0
  90. package/layout/index.es.js +41 -26
  91. package/layout/index.umd.js +1 -1
  92. package/layout/style.css +1 -1
  93. package/loading/index.d.ts +7 -0
  94. package/loading/index.es.js +77 -38
  95. package/loading/index.umd.js +1 -1
  96. package/loading/style.css +1 -1
  97. package/mention/index.d.ts +7 -0
  98. package/mention/index.es.js +8310 -0
  99. package/mention/index.umd.js +36 -0
  100. package/mention/package.json +7 -0
  101. package/mention/style.css +1 -0
  102. package/menu/index.d.ts +7 -0
  103. package/menu/index.es.js +870 -0
  104. package/menu/index.umd.js +1 -0
  105. package/{anchor → menu}/package.json +1 -1
  106. package/menu/style.css +1 -0
  107. package/message/index.d.ts +7 -0
  108. package/message/index.es.js +538 -0
  109. package/message/index.umd.js +1 -0
  110. package/message/package.json +7 -0
  111. package/message/style.css +1 -0
  112. package/modal/index.d.ts +7 -0
  113. package/modal/index.es.js +607 -841
  114. package/modal/index.umd.js +1 -1
  115. package/modal/style.css +1 -1
  116. package/notification/index.d.ts +7 -0
  117. package/notification/index.es.js +545 -0
  118. package/notification/index.umd.js +1 -0
  119. package/notification/package.json +7 -0
  120. package/notification/style.css +1 -0
  121. package/nuxt/components/Alert.js +3 -0
  122. package/nuxt/components/Aside.js +3 -0
  123. package/nuxt/components/AutoComplete.js +3 -0
  124. package/nuxt/components/Avatar.js +3 -0
  125. package/nuxt/components/Badge.js +3 -0
  126. package/nuxt/components/Button.js +3 -0
  127. package/nuxt/components/ButtonGroup.js +3 -0
  128. package/nuxt/components/Card.js +3 -0
  129. package/nuxt/components/Checkbox.js +3 -0
  130. package/nuxt/components/CheckboxButton.js +3 -0
  131. package/nuxt/components/CheckboxGroup.js +3 -0
  132. package/nuxt/components/Col.js +3 -0
  133. package/nuxt/components/Collapse.js +3 -0
  134. package/nuxt/components/CollapseItem.js +3 -0
  135. package/nuxt/components/Column.js +3 -0
  136. package/nuxt/components/Content.js +3 -0
  137. package/nuxt/components/Countdown.js +3 -0
  138. package/nuxt/components/DRangeDatePickerPro.js +3 -0
  139. package/nuxt/components/DatePickerPro.js +3 -0
  140. package/nuxt/components/Drawer.js +3 -0
  141. package/nuxt/components/DrawerService.js +3 -0
  142. package/nuxt/components/Dropdown.js +3 -0
  143. package/nuxt/components/DropdownMenu.js +3 -0
  144. package/nuxt/components/DropdownPropsKey.js +3 -0
  145. package/nuxt/components/EditableSelect.js +3 -0
  146. package/nuxt/components/FORM_ITEM_TOKEN.js +3 -0
  147. package/nuxt/components/FORM_TOKEN.js +3 -0
  148. package/nuxt/components/FixedOverlay.js +3 -0
  149. package/nuxt/components/FlexibleOverlay.js +3 -0
  150. package/nuxt/components/Footer.js +3 -0
  151. package/nuxt/components/Form.js +3 -0
  152. package/nuxt/components/FormItem.js +3 -0
  153. package/nuxt/components/FormOperation.js +3 -0
  154. package/nuxt/components/Fullscreen.js +3 -0
  155. package/nuxt/components/Header.js +3 -0
  156. package/nuxt/components/IFileOptions.js +3 -0
  157. package/nuxt/components/IUploadOptions.js +3 -0
  158. package/nuxt/components/Icon.js +3 -0
  159. package/nuxt/components/IconGroup.js +3 -0
  160. package/nuxt/components/ImagePreviewService.js +3 -0
  161. package/nuxt/components/Input.js +3 -0
  162. package/nuxt/components/InputNumber.js +3 -0
  163. package/nuxt/components/LABEL_DATA.js +3 -0
  164. package/nuxt/components/Layout.js +3 -0
  165. package/nuxt/components/Loading.js +3 -0
  166. package/nuxt/components/LoadingOptions.js +3 -0
  167. package/nuxt/components/LoadingService.js +3 -0
  168. package/nuxt/components/Mention.js +3 -0
  169. package/nuxt/components/Menu.js +3 -0
  170. package/nuxt/components/MenuItem.js +3 -0
  171. package/nuxt/components/Message.js +3 -0
  172. package/nuxt/components/Modal.js +3 -0
  173. package/nuxt/components/Notification.js +3 -0
  174. package/nuxt/components/NotificationService.js +3 -0
  175. package/nuxt/components/Option.js +3 -0
  176. package/nuxt/components/OptionGroup.js +3 -0
  177. package/nuxt/components/Pagination.js +3 -0
  178. package/nuxt/components/Panel.js +3 -0
  179. package/nuxt/components/PanelBody.js +3 -0
  180. package/nuxt/components/PanelFooter.js +3 -0
  181. package/nuxt/components/PanelHeader.js +3 -0
  182. package/nuxt/components/Popover.js +3 -0
  183. package/nuxt/components/Progress.js +3 -0
  184. package/nuxt/components/Radio.js +3 -0
  185. package/nuxt/components/RadioButton.js +3 -0
  186. package/nuxt/components/RadioGroup.js +3 -0
  187. package/nuxt/components/Rate.js +3 -0
  188. package/nuxt/components/Result.js +3 -0
  189. package/nuxt/components/Row.js +3 -0
  190. package/nuxt/components/Search.js +3 -0
  191. package/nuxt/components/Select.js +3 -0
  192. package/nuxt/components/Skeleton.js +3 -0
  193. package/nuxt/components/SkeletonItem.js +3 -0
  194. package/nuxt/components/Slider.js +3 -0
  195. package/nuxt/components/Splitter.js +3 -0
  196. package/nuxt/components/Statistic.js +3 -0
  197. package/nuxt/components/Status.js +3 -0
  198. package/nuxt/components/Step.js +3 -0
  199. package/nuxt/components/Steps.js +3 -0
  200. package/nuxt/components/SubMenu.js +3 -0
  201. package/nuxt/components/Switch.js +3 -0
  202. package/nuxt/components/TABLE_TOKEN.js +3 -0
  203. package/nuxt/components/Tab.js +3 -0
  204. package/nuxt/components/Table.js +3 -0
  205. package/nuxt/components/Tabs.js +3 -0
  206. package/nuxt/components/Tag.js +3 -0
  207. package/nuxt/components/Textarea.js +3 -0
  208. package/nuxt/components/TimePicker.js +3 -0
  209. package/nuxt/components/TimeSelect.js +3 -0
  210. package/nuxt/components/Timeline.js +3 -0
  211. package/nuxt/components/TimelineItem.js +3 -0
  212. package/nuxt/components/Tooltip.js +3 -0
  213. package/nuxt/components/Tree.js +3 -0
  214. package/nuxt/components/Upload.js +3 -0
  215. package/nuxt/components/UploadStatus.js +3 -0
  216. package/nuxt/components/alertProps.js +3 -0
  217. package/nuxt/components/animationInjectionKey.js +3 -0
  218. package/nuxt/components/autoCompleteProps.js +3 -0
  219. package/nuxt/components/avatarProps.js +3 -0
  220. package/nuxt/components/badgeProps.js +3 -0
  221. package/nuxt/components/buttonGroupInjectionKey.js +3 -0
  222. package/nuxt/components/buttonGroupProps.js +3 -0
  223. package/nuxt/components/buttonProps.js +3 -0
  224. package/nuxt/components/cardProps.js +3 -0
  225. package/nuxt/components/checkboxGroupInjectionKey.js +3 -0
  226. package/nuxt/components/checkboxGroupProps.js +3 -0
  227. package/nuxt/components/checkboxProps.js +3 -0
  228. package/nuxt/components/colProps.js +3 -0
  229. package/nuxt/components/colPropsBaseClass.js +3 -0
  230. package/nuxt/components/colPropsBaseStyle.js +3 -0
  231. package/nuxt/components/collapseItemProps.js +3 -0
  232. package/nuxt/components/collapseProps.js +3 -0
  233. package/nuxt/components/countdownProps.js +3 -0
  234. package/nuxt/components/datePickerProCommonProps.js +3 -0
  235. package/nuxt/components/datePickerProPanelProps.js +3 -0
  236. package/nuxt/components/datePickerProProps.js +3 -0
  237. package/nuxt/components/dropdownMenuProps.js +3 -0
  238. package/nuxt/components/editableSelectProps.js +3 -0
  239. package/nuxt/components/fixedOverlayProps.js +3 -0
  240. package/nuxt/components/flexibleOverlayProps.js +3 -0
  241. package/nuxt/components/formItemProps.js +3 -0
  242. package/nuxt/components/formProps.js +3 -0
  243. package/nuxt/components/fullscreenProps.js +3 -0
  244. package/nuxt/components/iconProps.js +3 -0
  245. package/nuxt/components/imagePreviewProps.js +3 -0
  246. package/nuxt/components/inputProps.js +3 -0
  247. package/nuxt/components/loadingProps.js +3 -0
  248. package/nuxt/components/mentionProps.js +3 -0
  249. package/nuxt/components/messageProps.js +3 -0
  250. package/nuxt/components/modalProps.js +3 -0
  251. package/nuxt/components/notificationProps.js +3 -0
  252. package/nuxt/components/paginationProps.js +3 -0
  253. package/nuxt/components/panelProps.js +3 -0
  254. package/nuxt/components/popoverProps.js +3 -0
  255. package/nuxt/components/progressProps.js +3 -0
  256. package/nuxt/components/rateProps.js +3 -0
  257. package/nuxt/components/resultProps.js +3 -0
  258. package/nuxt/components/roundInjectionKey.js +3 -0
  259. package/nuxt/components/rowProps.js +3 -0
  260. package/nuxt/components/screenSizes.js +3 -0
  261. package/nuxt/components/searchProps.js +3 -0
  262. package/nuxt/components/skeletonItemProps.js +3 -0
  263. package/nuxt/components/skeletonProps.js +3 -0
  264. package/nuxt/components/sliderProps.js +3 -0
  265. package/nuxt/components/splitterProps.js +3 -0
  266. package/nuxt/components/statisticProps.js +3 -0
  267. package/nuxt/components/stepProps.js +3 -0
  268. package/nuxt/components/stepsProps.js +3 -0
  269. package/nuxt/components/svgIconProps.js +3 -0
  270. package/nuxt/components/switchProps.js +3 -0
  271. package/nuxt/components/tableProps.js +3 -0
  272. package/nuxt/components/tabsProps.js +3 -0
  273. package/nuxt/components/tagProps.js +3 -0
  274. package/nuxt/components/textareaProps.js +3 -0
  275. package/nuxt/components/timeAxisProps.js +3 -0
  276. package/nuxt/components/timerPickerPanelProps.js +3 -0
  277. package/nuxt/components/tooltipProps.js +3 -0
  278. package/nuxt/components/treeNodeProps.js +3 -0
  279. package/nuxt/components/treeProps.js +3 -0
  280. package/nuxt/components/uploadProps.js +3 -0
  281. package/nuxt/index.js +13 -0
  282. package/overlay/index.d.ts +7 -0
  283. package/overlay/index.es.js +245 -303
  284. package/overlay/index.umd.js +1 -1
  285. package/overlay/style.css +1 -1
  286. package/package.json +16 -84
  287. package/pagination/index.d.ts +7 -0
  288. package/pagination/index.es.js +333 -155
  289. package/pagination/index.umd.js +1 -1
  290. package/pagination/style.css +1 -1
  291. package/panel/index.d.ts +7 -0
  292. package/panel/index.es.js +48 -35
  293. package/panel/index.umd.js +1 -1
  294. package/panel/style.css +1 -1
  295. package/popover/index.d.ts +7 -0
  296. package/popover/index.es.js +6035 -204
  297. package/popover/index.umd.js +27 -1
  298. package/popover/style.css +1 -1
  299. package/progress/index.d.ts +7 -0
  300. package/progress/index.es.js +111 -57
  301. package/progress/index.umd.js +3 -3
  302. package/progress/style.css +1 -1
  303. package/radio/index.d.ts +7 -0
  304. package/radio/index.es.js +7976 -159
  305. package/radio/index.umd.js +27 -1
  306. package/radio/style.css +1 -1
  307. package/rate/index.d.ts +7 -0
  308. package/rate/index.es.js +78 -56
  309. package/rate/index.umd.js +1 -1
  310. package/rate/style.css +1 -1
  311. package/result/index.d.ts +7 -0
  312. package/result/index.es.js +248 -0
  313. package/result/index.umd.js +1 -0
  314. package/{sticky → result}/package.json +1 -1
  315. package/result/style.css +1 -0
  316. package/ripple/index.d.ts +7 -0
  317. package/ripple/index.es.js +51 -43
  318. package/ripple/index.umd.js +1 -1
  319. package/search/index.d.ts +7 -0
  320. package/search/index.es.js +8411 -450
  321. package/search/index.umd.js +27 -1
  322. package/search/style.css +1 -1
  323. package/select/index.d.ts +7 -0
  324. package/select/index.es.js +9295 -561
  325. package/select/index.umd.js +27 -1
  326. package/select/style.css +1 -1
  327. package/skeleton/index.d.ts +7 -0
  328. package/skeleton/index.es.js +115 -145
  329. package/skeleton/index.umd.js +1 -1
  330. package/skeleton/style.css +1 -1
  331. package/slider/index.d.ts +7 -0
  332. package/slider/index.es.js +148 -142
  333. package/slider/index.umd.js +1 -1
  334. package/slider/style.css +1 -1
  335. package/splitter/index.d.ts +7 -0
  336. package/splitter/index.es.js +6301 -167
  337. package/splitter/index.umd.js +27 -1
  338. package/splitter/style.css +1 -1
  339. package/statistic/index.d.ts +7 -0
  340. package/statistic/index.es.js +274 -0
  341. package/statistic/index.umd.js +1 -0
  342. package/statistic/package.json +7 -0
  343. package/statistic/style.css +1 -0
  344. package/status/index.d.ts +7 -0
  345. package/status/index.es.js +29 -8
  346. package/status/index.umd.js +1 -1
  347. package/status/style.css +1 -1
  348. package/steps/index.d.ts +7 -0
  349. package/steps/index.es.js +386 -0
  350. package/steps/index.umd.js +1 -0
  351. package/steps/package.json +7 -0
  352. package/steps/style.css +1 -0
  353. package/style.css +1 -1
  354. package/switch/index.d.ts +7 -0
  355. package/switch/index.es.js +7805 -65
  356. package/switch/index.umd.js +27 -1
  357. package/switch/style.css +1 -1
  358. package/table/index.d.ts +7 -0
  359. package/table/index.es.js +11423 -207
  360. package/table/index.umd.js +27 -1
  361. package/table/style.css +1 -1
  362. package/tabs/index.d.ts +7 -0
  363. package/tabs/index.es.js +356 -143
  364. package/tabs/index.umd.js +1 -1
  365. package/tabs/style.css +1 -1
  366. package/tag/index.d.ts +7 -0
  367. package/tag/index.es.js +156 -0
  368. package/tag/index.umd.js +1 -0
  369. package/tag/package.json +7 -0
  370. package/tag/style.css +1 -0
  371. package/textarea/index.d.ts +7 -0
  372. package/textarea/index.es.js +7973 -0
  373. package/textarea/index.umd.js +35 -0
  374. package/textarea/package.json +7 -0
  375. package/textarea/style.css +1 -0
  376. package/{theme → theme/theme.scss} +0 -0
  377. package/time-picker/index.d.ts +7 -0
  378. package/time-picker/index.es.js +9101 -581
  379. package/time-picker/index.umd.js +27 -1
  380. package/time-picker/style.css +1 -1
  381. package/time-select/index.d.ts +7 -0
  382. package/time-select/index.es.js +9585 -0
  383. package/time-select/index.umd.js +27 -0
  384. package/{breadcrumb → time-select}/package.json +1 -1
  385. package/time-select/style.css +1 -0
  386. package/timeline/index.d.ts +7 -0
  387. package/timeline/index.es.js +427 -0
  388. package/timeline/index.umd.js +1 -0
  389. package/timeline/package.json +7 -0
  390. package/timeline/style.css +1 -0
  391. package/tooltip/index.d.ts +7 -0
  392. package/tooltip/index.es.js +5870 -141
  393. package/tooltip/index.umd.js +27 -1
  394. package/tooltip/style.css +1 -1
  395. package/tree/index.d.ts +7 -0
  396. package/tree/index.es.js +11438 -654
  397. package/tree/index.umd.js +27 -1
  398. package/tree/style.css +1 -1
  399. package/upload/index.d.ts +7 -0
  400. package/upload/index.es.js +981 -2719
  401. package/upload/index.umd.js +1 -1
  402. package/upload/style.css +1 -1
  403. package/vue-devui.es.js +22794 -16605
  404. package/vue-devui.umd.js +31 -20
  405. package/accordion/index.es.js +0 -190
  406. package/accordion/index.umd.js +0 -1
  407. package/accordion/style.css +0 -1
  408. package/anchor/index.es.js +0 -263
  409. package/anchor/index.umd.js +0 -1
  410. package/anchor/style.css +0 -1
  411. package/breadcrumb/index.es.js +0 -127
  412. package/breadcrumb/index.umd.js +0 -1
  413. package/breadcrumb/style.css +0 -1
  414. package/carousel/index.es.js +0 -328
  415. package/carousel/index.umd.js +0 -1
  416. package/carousel/style.css +0 -1
  417. package/cascader/index.es.js +0 -187
  418. package/cascader/index.umd.js +0 -1
  419. package/cascader/style.css +0 -1
  420. package/date-picker/index.es.js +0 -1171
  421. package/date-picker/index.umd.js +0 -1
  422. package/date-picker/package.json +0 -7
  423. package/date-picker/style.css +0 -1
  424. package/nav-sprite/index.es.js +0 -742
  425. package/nav-sprite/index.umd.js +0 -1
  426. package/nav-sprite/package.json +0 -7
  427. package/quadrant-diagram/index.es.js +0 -489
  428. package/quadrant-diagram/index.umd.js +0 -1
  429. package/quadrant-diagram/package.json +0 -7
  430. package/quadrant-diagram/style.css +0 -1
  431. package/steps-guide/index.es.js +0 -211
  432. package/steps-guide/index.umd.js +0 -1
  433. package/steps-guide/package.json +0 -7
  434. package/steps-guide/style.css +0 -1
  435. package/sticky/index.es.js +0 -197
  436. package/sticky/index.umd.js +0 -1
  437. package/tag-input/index.es.js +0 -341
  438. package/tag-input/index.umd.js +0 -1
  439. package/tag-input/package.json +0 -7
  440. package/tag-input/style.css +0 -1
  441. package/time-axis/index.es.js +0 -79
  442. package/time-axis/index.umd.js +0 -1
  443. package/time-axis/package.json +0 -7
  444. package/time-axis/style.css +0 -1
  445. package/toast/index.es.js +0 -2059
  446. package/toast/index.umd.js +0 -1
  447. package/toast/style.css +0 -1
  448. package/transfer/index.es.js +0 -1446
  449. package/transfer/index.umd.js +0 -1
  450. package/transfer/package.json +0 -7
  451. package/transfer/style.css +0 -1
  452. package/tree-select/index.es.js +0 -203
  453. package/tree-select/index.umd.js +0 -1
  454. package/tree-select/package.json +0 -7
  455. package/tree-select/style.css +0 -1
@@ -21,2073 +21,579 @@ var __publicField = (obj, key, value) => {
21
21
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
22
22
  return value;
23
23
  };
24
- import { defineComponent, createVNode, Fragment, getCurrentInstance, ref, computed, watch, nextTick, onUnmounted, mergeProps, createApp, toRefs, withDirectives, resolveComponent, createTextVNode, resolveDirective, isVNode } from "vue";
25
- var toast = "";
26
- const toastProps = {
27
- value: {
28
- type: Array,
29
- required: true,
30
- default: () => []
24
+ import { defineComponent, toRefs, computed, createVNode, resolveDynamicComponent, mergeProps, watch, Transition, reactive, createApp, onUnmounted, isVNode, ref, getCurrentInstance, withDirectives, resolveComponent, resolveDirective } from "vue";
25
+ const notificationProps = {
26
+ modelValue: {
27
+ type: Boolean,
28
+ default: false
29
+ },
30
+ title: {
31
+ type: String,
32
+ default: ""
33
+ },
34
+ type: {
35
+ type: String,
36
+ default: "normal"
31
37
  },
32
- life: {
38
+ duration: {
33
39
  type: Number,
40
+ default: 3e3
41
+ },
42
+ onClose: {
43
+ type: Function
44
+ }
45
+ };
46
+ const DEFAULT_PREFIX = "icon";
47
+ const iconProps = {
48
+ name: {
49
+ type: String,
50
+ default: "",
51
+ required: true
52
+ },
53
+ size: {
54
+ type: [Number, String],
55
+ default: "inherit"
56
+ },
57
+ color: {
58
+ type: String,
59
+ default: "inherit"
60
+ },
61
+ component: {
62
+ type: Object,
34
63
  default: null
35
64
  },
36
- lifeMode: {
65
+ classPrefix: {
37
66
  type: String,
38
- default: "global"
67
+ default: DEFAULT_PREFIX
39
68
  },
40
- sticky: {
69
+ operable: {
41
70
  type: Boolean,
42
71
  default: false
43
72
  },
44
- style: {
45
- type: Object,
46
- default: () => ({})
73
+ disabled: {
74
+ type: Boolean,
75
+ default: false
47
76
  },
48
- styleClass: {
49
- type: String
77
+ rotate: {
78
+ type: [Number, String]
79
+ }
80
+ };
81
+ const svgIconProps = {
82
+ name: {
83
+ type: String,
84
+ default: "",
85
+ required: true
50
86
  },
51
- onCloseEvent: {
52
- type: Function
87
+ color: {
88
+ type: String,
89
+ default: "inherit"
53
90
  },
54
- onValueChange: {
55
- type: Function
91
+ size: {
92
+ type: [Number, String],
93
+ default: "inherit"
56
94
  }
57
95
  };
58
- var Icon = defineComponent({
59
- name: "DIcon",
60
- props: {
61
- name: {
62
- type: String,
63
- required: true
64
- },
65
- size: {
66
- type: String,
67
- default: "inherit"
68
- },
69
- color: {
70
- type: String,
71
- default: "inherit"
72
- },
73
- classPrefix: {
74
- type: String,
75
- default: "icon"
76
- }
77
- },
96
+ function createBem(namespace, element, modifier) {
97
+ let cls = namespace;
98
+ if (element) {
99
+ cls += `__${element}`;
100
+ }
101
+ if (modifier) {
102
+ cls += `--${modifier}`;
103
+ }
104
+ return cls;
105
+ }
106
+ function useNamespace(block, needDot = false) {
107
+ const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
108
+ const b = () => createBem(namespace);
109
+ const e = (element) => element ? createBem(namespace, element) : "";
110
+ const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
111
+ const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
112
+ return {
113
+ b,
114
+ e,
115
+ m,
116
+ em
117
+ };
118
+ }
119
+ var icon = "";
120
+ var svgIcon = defineComponent({
121
+ name: "DSvgIcon",
122
+ props: svgIconProps,
78
123
  setup(props) {
79
- return __spreadValues({}, props);
80
- },
81
- render() {
82
124
  const {
83
125
  name,
84
- size,
85
126
  color,
86
- classPrefix
87
- } = this;
88
- return createVNode(Fragment, null, [/^((https?):)?\/\//.test(name) ? createVNode("img", {
89
- "src": name,
90
- "alt": name.split("/")[name.split("/").length - 1],
127
+ size
128
+ } = toRefs(props);
129
+ const ns2 = useNamespace("svg-icon");
130
+ const iconName = computed(() => `#icon-${name.value}`);
131
+ const iconSize = computed(() => {
132
+ return typeof size.value === "number" ? `${size.value}px` : size.value;
133
+ });
134
+ const styles = {
135
+ width: iconSize.value,
136
+ height: iconSize.value
137
+ };
138
+ return () => {
139
+ return createVNode("svg", {
140
+ "class": ns2.b(),
141
+ "style": styles
142
+ }, [createVNode("use", {
143
+ "xlink:href": iconName.value,
144
+ "fill": color.value
145
+ }, null)]);
146
+ };
147
+ }
148
+ });
149
+ function isUrl(value) {
150
+ return /^((http|https):)?\/\//.test(value);
151
+ }
152
+ function useIconDom(props, ctx) {
153
+ const {
154
+ component,
155
+ name,
156
+ size,
157
+ color,
158
+ classPrefix,
159
+ rotate
160
+ } = toRefs(props);
161
+ const ns2 = useNamespace("icon");
162
+ const iconSize = computed(() => {
163
+ return typeof size.value === "number" ? `${size.value}px` : size.value;
164
+ });
165
+ const IconComponent = component.value ? resolveDynamicComponent(component.value) : resolveDynamicComponent(svgIcon);
166
+ const imgIconDom = () => {
167
+ return createVNode("img", mergeProps({
168
+ "src": name.value,
169
+ "alt": name.value.split("/")[name.value.split("/").length - 1],
170
+ "class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns2.m("spin")],
91
171
  "style": {
92
- width: size
172
+ width: iconSize.value || "",
173
+ transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`,
174
+ verticalAlign: "middle"
93
175
  }
94
- }, null) : createVNode("i", {
95
- "class": `${classPrefix} ${classPrefix}-${name}`,
176
+ }, ctx.attrs), null);
177
+ };
178
+ const svgIconDom = () => {
179
+ return createVNode(IconComponent, mergeProps({
180
+ "name": name.value,
181
+ "color": color.value,
182
+ "size": iconSize.value,
183
+ "class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns2.m("spin")],
96
184
  "style": {
97
- fontSize: size,
98
- color
185
+ transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
99
186
  }
100
- }, null)]);
187
+ }, ctx.attrs), null);
188
+ };
189
+ const fontIconDom = () => {
190
+ const fontIconClass = /^icon-/.test(name.value) ? name.value : `${classPrefix.value}-${name.value}`;
191
+ return createVNode("i", mergeProps({
192
+ "class": [classPrefix.value, fontIconClass, (rotate == null ? void 0 : rotate.value) === "infinite" && ns2.m("spin")],
193
+ "style": {
194
+ fontSize: iconSize.value,
195
+ color: color.value,
196
+ transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
197
+ }
198
+ }, ctx.attrs), null);
199
+ };
200
+ const iconDom = () => {
201
+ return component.value ? svgIconDom() : isUrl(name.value) ? imgIconDom() : fontIconDom();
202
+ };
203
+ return {
204
+ iconDom
205
+ };
206
+ }
207
+ var Icon = defineComponent({
208
+ name: "DIcon",
209
+ props: iconProps,
210
+ emits: ["click"],
211
+ setup(props, ctx) {
212
+ const {
213
+ disabled,
214
+ operable
215
+ } = toRefs(props);
216
+ const {
217
+ iconDom
218
+ } = useIconDom(props, ctx);
219
+ const ns2 = useNamespace("icon");
220
+ const wrapClassed = computed(() => ({
221
+ [ns2.e("container")]: true,
222
+ [ns2.m("disabled")]: disabled.value,
223
+ [ns2.m("operable")]: operable.value
224
+ }));
225
+ const onClick = (e) => {
226
+ if (disabled.value) {
227
+ return;
228
+ }
229
+ ctx.emit("click", e);
230
+ };
231
+ return () => {
232
+ var _a, _b, _c, _d;
233
+ return createVNode("div", {
234
+ "class": wrapClassed.value,
235
+ "onClick": onClick
236
+ }, [(_b = (_a = ctx.slots).prefix) == null ? void 0 : _b.call(_a), iconDom(), (_d = (_c = ctx.slots).suffix) == null ? void 0 : _d.call(_c)]);
237
+ };
101
238
  }
102
239
  });
103
- Icon.install = function(app) {
104
- app.component(Icon.name, Icon);
105
- };
106
- var ToastIconClose = defineComponent({
107
- name: "DToastIconClose",
108
- props: {
109
- prefixCls: String,
110
- onClick: Function
111
- },
240
+ var iconGroup = "";
241
+ defineComponent({
242
+ name: "DIconGroup",
243
+ setup(_, ctx) {
244
+ const ns2 = useNamespace("icon-group");
245
+ return () => {
246
+ var _a, _b;
247
+ return createVNode("div", {
248
+ "class": ns2.b()
249
+ }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
250
+ };
251
+ }
252
+ });
253
+ var Close = defineComponent({
112
254
  emits: ["click"],
113
- render() {
114
- const {
115
- prefixCls,
116
- $emit
117
- } = this;
118
- const wrapperCls = `${prefixCls}-icon-close`;
119
- return createVNode("div", {
120
- "class": wrapperCls,
121
- "onClick": (e) => $emit("click", e)
255
+ setup(props, {
256
+ emit
257
+ }) {
258
+ const ns2 = useNamespace("notification");
259
+ return () => createVNode("div", {
260
+ "class": ns2.e("icon-close"),
261
+ "onClick": (e) => emit("click", e)
122
262
  }, [createVNode(Icon, {
123
263
  "name": "close",
124
264
  "size": "14px"
125
265
  }, null)]);
126
266
  }
127
267
  });
128
- var ToastImage = defineComponent({
129
- name: "DToastImage",
268
+ const ns = useNamespace("notification");
269
+ const XLINK = {
270
+ "xmlns:xlink": "http://www.w3.org/1999/xlink"
271
+ };
272
+ const XLINK_HREF = {
273
+ "xlink:href": "#path-s"
274
+ };
275
+ function SuccessIcon() {
276
+ return createVNode("svg", mergeProps({
277
+ "width": "16px",
278
+ "height": "16px",
279
+ "viewBox": "0 0 16 16",
280
+ "version": "1.1",
281
+ "xmlns": "http://www.w3.org/2000/svg"
282
+ }, XLINK), [createVNode("defs", null, [createVNode("polygon", {
283
+ "id": "path-s",
284
+ "points": "6.53553391 9.77817459 12.1923882 4.12132034 13.6066017 5.53553391 6.53553391 12.6066017 3 9.07106781 4.41421356 7.65685425 6.53553391 9.77817459"
285
+ }, null)]), createVNode("g", {
286
+ "id": "correct",
287
+ "stroke": "none",
288
+ "stroke-width": "1",
289
+ "fill": "none",
290
+ "fill-rule": "evenodd"
291
+ }, [createVNode("mask", {
292
+ "id": "mask-2",
293
+ "fill": "white"
294
+ }, [createVNode("use", XLINK_HREF, null)]), createVNode("use", mergeProps({
295
+ "id": "Mask",
296
+ "class": ns.e("image-success-path")
297
+ }, XLINK_HREF), null)])]);
298
+ }
299
+ function WarningIcon() {
300
+ return createVNode("svg", mergeProps({
301
+ "width": "16px",
302
+ "height": "16px",
303
+ "viewBox": "0 0 16 16",
304
+ "version": "1.1",
305
+ "xmlns": "http://www.w3.org/2000/svg"
306
+ }, XLINK), [createVNode("g", {
307
+ "stroke": "none",
308
+ "stroke-width": "1",
309
+ "fill": "none",
310
+ "fill-rule": "evenodd"
311
+ }, [createVNode("path", {
312
+ "class": ns.e("warning-outer"),
313
+ "d": "M8.96244623,0.57254229 L15.8714442,13.4101975 C16.1549662,13.9370117 15.9538562,14.5918482 15.4222523,14.8728158 C15.2642579,14.9563203 15.0879506, 15 14.9088903,15 L1.09089441,15 C0.488410063,15 0,14.5159904 0,13.9189343 C0,13.7414873 0.0440768395,13.5667684 0.128340519,13.4101975 L7.03733844,0.57254229 C7.32086049, 0.0457280838 7.98165058,-0.153569987 8.51325441,0.127397589 C8.70423071, 0.228333932 8.8605922,0.383286648 8.96244623,0.57254229 Z"
314
+ }, null), createVNode("path", {
315
+ "class": ns.e("warning-inner"),
316
+ "stroke-width": "0.3",
317
+ "fill-rule": "nonzero",
318
+ "d": "M8.87894737,13 L7.08947368,13 L7.08947368,11.2105263 L8.87894737,11.2105263 L8.87894737,13 Z M8.62102372,9.86842105 L7.32800539,9.86842105 L7,4.5 L8.96842105,4.5 L8.62102372,9.86842105 Z"
319
+ }, null)])]);
320
+ }
321
+ function InfoIcon() {
322
+ return createVNode("svg", mergeProps({
323
+ "width": "16px",
324
+ "height": "16px",
325
+ "viewBox": "0 0 16 16",
326
+ "version": "1.1",
327
+ "xmlns": "http://www.w3.org/2000/svg"
328
+ }, XLINK), [createVNode("g", {
329
+ "id": "info",
330
+ "stroke": "none",
331
+ "stroke-width": "1",
332
+ "fill": "none",
333
+ "fill-rule": "evenodd"
334
+ }, [createVNode("path", {
335
+ "class": ns.e("image-info-path"),
336
+ "d": "M7,13 L7,6 L9,6 L9,13 L7,13 Z M7,5 L7,3 L9,3 L9,5 L7,5 Z",
337
+ "id": "info"
338
+ }, null)])]);
339
+ }
340
+ function ErrorIcon() {
341
+ return createVNode("svg", mergeProps({
342
+ "width": "16px",
343
+ "height": "16px",
344
+ "viewBox": "0 0 16 16",
345
+ "version": "1.1",
346
+ "xmlns": "http://www.w3.org/2000/svg"
347
+ }, XLINK), [createVNode("defs", null, [createVNode("polygon", {
348
+ "id": "path-e",
349
+ "points": "8.07106781 6.65685425 10.8994949 3.82842712 12.3137085 5.24264069 9.48528137 8.07106781 12.3137085 10.8994949 10.8994949 12.3137085 8.07106781 9.48528137 5.24264069 12.3137085 3.82842712 10.8994949 6.65685425 8.07106781 3.82842712 5.24264069 5.24264069 3.82842712"
350
+ }, null)]), createVNode("g", {
351
+ "id": "error",
352
+ "stroke": "none",
353
+ "stroke-width": "1",
354
+ "fill": "none",
355
+ "fill-rule": "evenodd"
356
+ }, [createVNode("mask", {
357
+ "id": "mask-2",
358
+ "fill": "white"
359
+ }, [createVNode("use", XLINK_HREF, null)]), createVNode("use", mergeProps({
360
+ "id": "Mask",
361
+ "class": ns.e("image-error-path")
362
+ }, XLINK_HREF), null)])]);
363
+ }
364
+ var TypeIcon = defineComponent({
130
365
  props: {
131
- prefixCls: String,
132
- severity: String
366
+ type: {
367
+ type: String,
368
+ default: "normal"
369
+ }
133
370
  },
134
- render() {
371
+ setup(props) {
135
372
  const {
136
- prefixCls,
137
- severity
138
- } = this;
139
- const wrapperCls = [`${prefixCls}-image`, `${prefixCls}-image-${severity || "common"}`];
140
- const severityIconMap = {
141
- info: "info-o",
142
- success: "right-o",
143
- warn: "warning-o",
144
- error: "error-o"
145
- };
146
- const showIcon = () => severity !== "common";
147
- return createVNode("span", {
148
- "class": wrapperCls
149
- }, [showIcon() ? createVNode(Icon, {
150
- "name": severityIconMap[severity],
151
- "size": "14px"
152
- }, null) : null]);
373
+ type
374
+ } = toRefs(props);
375
+ const ns2 = useNamespace("notification");
376
+ const classes = computed(() => ({
377
+ [ns2.e("image")]: true,
378
+ [ns2.em("image", type.value)]: true
379
+ }));
380
+ return () => createVNode("span", {
381
+ "class": classes.value
382
+ }, [type.value && type.value !== "normal" && (type.value === "success" && createVNode(SuccessIcon, null, null) || type.value === "info" && createVNode(InfoIcon, null, null) || type.value === "warning" && createVNode(WarningIcon, null, null) || type.value === "error" && createVNode(ErrorIcon, null, null))]);
153
383
  }
154
384
  });
155
- var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
156
- var freeGlobal$1 = freeGlobal;
157
- var freeSelf = typeof self == "object" && self && self.Object === Object && self;
158
- var root = freeGlobal$1 || freeSelf || Function("return this")();
159
- var root$1 = root;
160
- var Symbol$1 = root$1.Symbol;
161
- var Symbol$2 = Symbol$1;
162
- var objectProto$f = Object.prototype;
163
- var hasOwnProperty$c = objectProto$f.hasOwnProperty;
164
- var nativeObjectToString$1 = objectProto$f.toString;
165
- var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0;
166
- function getRawTag(value) {
167
- var isOwn = hasOwnProperty$c.call(value, symToStringTag$1), tag = value[symToStringTag$1];
168
- try {
169
- value[symToStringTag$1] = void 0;
170
- var unmasked = true;
171
- } catch (e) {
172
- }
173
- var result = nativeObjectToString$1.call(value);
174
- if (unmasked) {
175
- if (isOwn) {
176
- value[symToStringTag$1] = tag;
177
- } else {
178
- delete value[symToStringTag$1];
179
- }
180
- }
181
- return result;
182
- }
183
- var objectProto$e = Object.prototype;
184
- var nativeObjectToString = objectProto$e.toString;
185
- function objectToString(value) {
186
- return nativeObjectToString.call(value);
187
- }
188
- var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
189
- var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0;
190
- function baseGetTag(value) {
191
- if (value == null) {
192
- return value === void 0 ? undefinedTag : nullTag;
193
- }
194
- return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
195
- }
196
- function isObjectLike(value) {
197
- return value != null && typeof value == "object";
198
- }
199
- var symbolTag$3 = "[object Symbol]";
200
- function isSymbol(value) {
201
- return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag$3;
202
- }
203
- function arrayMap(array, iteratee) {
204
- var index2 = -1, length = array == null ? 0 : array.length, result = Array(length);
205
- while (++index2 < length) {
206
- result[index2] = iteratee(array[index2], index2, array);
207
- }
208
- return result;
209
- }
210
- var isArray = Array.isArray;
211
- var isArray$1 = isArray;
212
- var INFINITY$1 = 1 / 0;
213
- var symbolProto$2 = Symbol$2 ? Symbol$2.prototype : void 0, symbolToString = symbolProto$2 ? symbolProto$2.toString : void 0;
214
- function baseToString(value) {
215
- if (typeof value == "string") {
216
- return value;
217
- }
218
- if (isArray$1(value)) {
219
- return arrayMap(value, baseToString) + "";
220
- }
221
- if (isSymbol(value)) {
222
- return symbolToString ? symbolToString.call(value) : "";
223
- }
224
- var result = value + "";
225
- return result == "0" && 1 / value == -INFINITY$1 ? "-0" : result;
226
- }
227
- var reWhitespace = /\s/;
228
- function trimmedEndIndex(string) {
229
- var index2 = string.length;
230
- while (index2-- && reWhitespace.test(string.charAt(index2))) {
231
- }
232
- return index2;
233
- }
234
- var reTrimStart = /^\s+/;
235
- function baseTrim(string) {
236
- return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
237
- }
238
- function isObject(value) {
239
- var type = typeof value;
240
- return value != null && (type == "object" || type == "function");
241
- }
242
- var NAN = 0 / 0;
243
- var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
244
- var reIsBinary = /^0b[01]+$/i;
245
- var reIsOctal = /^0o[0-7]+$/i;
246
- var freeParseInt = parseInt;
247
- function toNumber(value) {
248
- if (typeof value == "number") {
249
- return value;
250
- }
251
- if (isSymbol(value)) {
252
- return NAN;
253
- }
254
- if (isObject(value)) {
255
- var other = typeof value.valueOf == "function" ? value.valueOf() : value;
256
- value = isObject(other) ? other + "" : other;
257
- }
258
- if (typeof value != "string") {
259
- return value === 0 ? value : +value;
260
- }
261
- value = baseTrim(value);
262
- var isBinary = reIsBinary.test(value);
263
- return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
264
- }
265
- function identity(value) {
266
- return value;
267
- }
268
- var asyncTag = "[object AsyncFunction]", funcTag$2 = "[object Function]", genTag$1 = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
269
- function isFunction(value) {
270
- if (!isObject(value)) {
271
- return false;
272
- }
273
- var tag = baseGetTag(value);
274
- return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
275
- }
276
- var coreJsData = root$1["__core-js_shared__"];
277
- var coreJsData$1 = coreJsData;
278
- var maskSrcKey = function() {
279
- var uid = /[^.]+$/.exec(coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO || "");
280
- return uid ? "Symbol(src)_1." + uid : "";
281
- }();
282
- function isMasked(func) {
283
- return !!maskSrcKey && maskSrcKey in func;
284
- }
285
- var funcProto$2 = Function.prototype;
286
- var funcToString$2 = funcProto$2.toString;
287
- function toSource(func) {
288
- if (func != null) {
289
- try {
290
- return funcToString$2.call(func);
291
- } catch (e) {
292
- }
293
- try {
294
- return func + "";
295
- } catch (e) {
296
- }
297
- }
298
- return "";
299
- }
300
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
301
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
302
- var funcProto$1 = Function.prototype, objectProto$d = Object.prototype;
303
- var funcToString$1 = funcProto$1.toString;
304
- var hasOwnProperty$b = objectProto$d.hasOwnProperty;
305
- var reIsNative = RegExp("^" + funcToString$1.call(hasOwnProperty$b).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
306
- function baseIsNative(value) {
307
- if (!isObject(value) || isMasked(value)) {
308
- return false;
309
- }
310
- var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
311
- return pattern.test(toSource(value));
312
- }
313
- function getValue(object, key) {
314
- return object == null ? void 0 : object[key];
315
- }
316
- function getNative(object, key) {
317
- var value = getValue(object, key);
318
- return baseIsNative(value) ? value : void 0;
319
- }
320
- var WeakMap = getNative(root$1, "WeakMap");
321
- var WeakMap$1 = WeakMap;
322
- var objectCreate = Object.create;
323
- var baseCreate = function() {
324
- function object() {
325
- }
326
- return function(proto) {
327
- if (!isObject(proto)) {
328
- return {};
329
- }
330
- if (objectCreate) {
331
- return objectCreate(proto);
332
- }
333
- object.prototype = proto;
334
- var result = new object();
335
- object.prototype = void 0;
336
- return result;
385
+ function useNotification(props) {
386
+ const classes = computed(() => ({
387
+ "devui-notification-item-container": true,
388
+ [`devui-notification-message-${props.type}`]: true
389
+ }));
390
+ return { classes };
391
+ }
392
+ function useEvent(props, emit) {
393
+ let timer = null;
394
+ let timestamp;
395
+ const close2 = () => {
396
+ var _a;
397
+ timer && clearTimeout(timer);
398
+ timer = null;
399
+ (_a = props.onClose) == null ? void 0 : _a.call(props);
400
+ emit("update:modelValue", false);
337
401
  };
338
- }();
339
- var baseCreate$1 = baseCreate;
340
- function apply(func, thisArg, args) {
341
- switch (args.length) {
342
- case 0:
343
- return func.call(thisArg);
344
- case 1:
345
- return func.call(thisArg, args[0]);
346
- case 2:
347
- return func.call(thisArg, args[0], args[1]);
348
- case 3:
349
- return func.call(thisArg, args[0], args[1], args[2]);
350
- }
351
- return func.apply(thisArg, args);
352
- }
353
- function copyArray(source, array) {
354
- var index2 = -1, length = source.length;
355
- array || (array = Array(length));
356
- while (++index2 < length) {
357
- array[index2] = source[index2];
358
- }
359
- return array;
360
- }
361
- var HOT_COUNT = 800, HOT_SPAN = 16;
362
- var nativeNow = Date.now;
363
- function shortOut(func) {
364
- var count = 0, lastCalled = 0;
365
- return function() {
366
- var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
367
- lastCalled = stamp;
368
- if (remaining > 0) {
369
- if (++count >= HOT_COUNT) {
370
- return arguments[0];
371
- }
372
- } else {
373
- count = 0;
402
+ const interrupt = () => {
403
+ if (timer) {
404
+ clearTimeout(timer);
405
+ timer = null;
374
406
  }
375
- return func.apply(void 0, arguments);
376
- };
377
- }
378
- function constant(value) {
379
- return function() {
380
- return value;
381
407
  };
382
- }
383
- var defineProperty = function() {
384
- try {
385
- var func = getNative(Object, "defineProperty");
386
- func({}, "", {});
387
- return func;
388
- } catch (e) {
389
- }
390
- }();
391
- var defineProperty$1 = defineProperty;
392
- var baseSetToString = !defineProperty$1 ? identity : function(func, string) {
393
- return defineProperty$1(func, "toString", {
394
- "configurable": true,
395
- "enumerable": false,
396
- "value": constant(string),
397
- "writable": true
398
- });
399
- };
400
- var baseSetToString$1 = baseSetToString;
401
- var setToString = shortOut(baseSetToString$1);
402
- var setToString$1 = setToString;
403
- function arrayEach(array, iteratee) {
404
- var index2 = -1, length = array == null ? 0 : array.length;
405
- while (++index2 < length) {
406
- if (iteratee(array[index2], index2, array) === false) {
407
- break;
408
- }
409
- }
410
- return array;
411
- }
412
- var MAX_SAFE_INTEGER$1 = 9007199254740991;
413
- var reIsUint = /^(?:0|[1-9]\d*)$/;
414
- function isIndex(value, length) {
415
- var type = typeof value;
416
- length = length == null ? MAX_SAFE_INTEGER$1 : length;
417
- return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
418
- }
419
- function baseAssignValue(object, key, value) {
420
- if (key == "__proto__" && defineProperty$1) {
421
- defineProperty$1(object, key, {
422
- "configurable": true,
423
- "enumerable": true,
424
- "value": value,
425
- "writable": true
426
- });
427
- } else {
428
- object[key] = value;
429
- }
430
- }
431
- function eq(value, other) {
432
- return value === other || value !== value && other !== other;
433
- }
434
- var objectProto$c = Object.prototype;
435
- var hasOwnProperty$a = objectProto$c.hasOwnProperty;
436
- function assignValue(object, key, value) {
437
- var objValue = object[key];
438
- if (!(hasOwnProperty$a.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
439
- baseAssignValue(object, key, value);
440
- }
441
- }
442
- function copyObject(source, props, object, customizer) {
443
- var isNew = !object;
444
- object || (object = {});
445
- var index2 = -1, length = props.length;
446
- while (++index2 < length) {
447
- var key = props[index2];
448
- var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
449
- if (newValue === void 0) {
450
- newValue = source[key];
451
- }
452
- if (isNew) {
453
- baseAssignValue(object, key, newValue);
454
- } else {
455
- assignValue(object, key, newValue);
456
- }
457
- }
458
- return object;
459
- }
460
- var nativeMax$1 = Math.max;
461
- function overRest(func, start, transform) {
462
- start = nativeMax$1(start === void 0 ? func.length - 1 : start, 0);
463
- return function() {
464
- var args = arguments, index2 = -1, length = nativeMax$1(args.length - start, 0), array = Array(length);
465
- while (++index2 < length) {
466
- array[index2] = args[start + index2];
408
+ const removeReset = () => {
409
+ if (!props.modelValue) {
410
+ const remainTime = props.duration - (Date.now() - timestamp);
411
+ timer = setTimeout(close2, remainTime);
467
412
  }
468
- index2 = -1;
469
- var otherArgs = Array(start + 1);
470
- while (++index2 < start) {
471
- otherArgs[index2] = args[index2];
472
- }
473
- otherArgs[start] = transform(array);
474
- return apply(func, this, otherArgs);
475
413
  };
476
- }
477
- function baseRest(func, start) {
478
- return setToString$1(overRest(func, start, identity), func + "");
479
- }
480
- var MAX_SAFE_INTEGER = 9007199254740991;
481
- function isLength(value) {
482
- return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
483
- }
484
- function isArrayLike(value) {
485
- return value != null && isLength(value.length) && !isFunction(value);
486
- }
487
- function isIterateeCall(value, index2, object) {
488
- if (!isObject(object)) {
489
- return false;
490
- }
491
- var type = typeof index2;
492
- if (type == "number" ? isArrayLike(object) && isIndex(index2, object.length) : type == "string" && index2 in object) {
493
- return eq(object[index2], value);
494
- }
495
- return false;
496
- }
497
- function createAssigner(assigner) {
498
- return baseRest(function(object, sources) {
499
- var index2 = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : void 0, guard = length > 2 ? sources[2] : void 0;
500
- customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : void 0;
501
- if (guard && isIterateeCall(sources[0], sources[1], guard)) {
502
- customizer = length < 3 ? void 0 : customizer;
503
- length = 1;
504
- }
505
- object = Object(object);
506
- while (++index2 < length) {
507
- var source = sources[index2];
508
- if (source) {
509
- assigner(object, source, index2, customizer);
414
+ const handleDestroy = () => {
415
+ emit("destroy");
416
+ };
417
+ watch(() => props.modelValue, (val) => {
418
+ if (val) {
419
+ timestamp = Date.now();
420
+ if (props.duration) {
421
+ timer = setTimeout(close2, props.duration);
510
422
  }
511
423
  }
512
- return object;
513
424
  });
514
- }
515
- var objectProto$b = Object.prototype;
516
- function isPrototype(value) {
517
- var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$b;
518
- return value === proto;
519
- }
520
- function baseTimes(n, iteratee) {
521
- var index2 = -1, result = Array(n);
522
- while (++index2 < n) {
523
- result[index2] = iteratee(index2);
425
+ return { interrupt, removeReset, close: close2, handleDestroy };
426
+ }
427
+ var notification = "";
428
+ var Notification = defineComponent({
429
+ name: "DNotification",
430
+ props: notificationProps,
431
+ emits: ["update:modelValue", "destroy"],
432
+ setup(props, {
433
+ emit,
434
+ slots
435
+ }) {
436
+ const {
437
+ modelValue,
438
+ title,
439
+ type
440
+ } = toRefs(props);
441
+ const {
442
+ classes
443
+ } = useNotification(props);
444
+ const {
445
+ interrupt,
446
+ removeReset,
447
+ close: close2,
448
+ handleDestroy
449
+ } = useEvent(props, emit);
450
+ const ns2 = useNamespace("notification");
451
+ return () => createVNode(Transition, {
452
+ "name": "notification-fade",
453
+ "onAfterLeave": handleDestroy
454
+ }, {
455
+ default: () => {
456
+ var _a;
457
+ return [modelValue.value && createVNode("div", {
458
+ "class": ns2.b()
459
+ }, [createVNode("div", {
460
+ "class": classes.value,
461
+ "onMouseenter": interrupt,
462
+ "onMouseleave": removeReset
463
+ }, [createVNode("div", {
464
+ "class": ns2.e("item")
465
+ }, [createVNode(Close, {
466
+ "onClick": close2
467
+ }, null), title.value && createVNode(TypeIcon, {
468
+ "type": type.value
469
+ }, null), createVNode("div", {
470
+ "class": ns2.e("message")
471
+ }, [createVNode("span", {
472
+ "class": ns2.e("title")
473
+ }, [title.value]), createVNode("span", {
474
+ "class": ns2.e("content")
475
+ }, [(_a = slots.default) == null ? void 0 : _a.call(slots)])])])])])];
476
+ }
477
+ });
524
478
  }
525
- return result;
526
- }
527
- var argsTag$3 = "[object Arguments]";
528
- function baseIsArguments(value) {
529
- return isObjectLike(value) && baseGetTag(value) == argsTag$3;
479
+ });
480
+ function _isSlot(s) {
481
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
530
482
  }
531
- var objectProto$a = Object.prototype;
532
- var hasOwnProperty$9 = objectProto$a.hasOwnProperty;
533
- var propertyIsEnumerable$1 = objectProto$a.propertyIsEnumerable;
534
- var isArguments = baseIsArguments(function() {
535
- return arguments;
536
- }()) ? baseIsArguments : function(value) {
537
- return isObjectLike(value) && hasOwnProperty$9.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
483
+ const defaultOptions = {
484
+ modelValue: false,
485
+ duration: 3e3,
486
+ type: "normal"
538
487
  };
539
- var isArguments$1 = isArguments;
540
- function stubFalse() {
541
- return false;
542
- }
543
- var freeExports$2 = typeof exports == "object" && exports && !exports.nodeType && exports;
544
- var freeModule$2 = freeExports$2 && typeof module == "object" && module && !module.nodeType && module;
545
- var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
546
- var Buffer$1 = moduleExports$2 ? root$1.Buffer : void 0;
547
- var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : void 0;
548
- var isBuffer = nativeIsBuffer || stubFalse;
549
- var isBuffer$1 = isBuffer;
550
- var argsTag$2 = "[object Arguments]", arrayTag$2 = "[object Array]", boolTag$3 = "[object Boolean]", dateTag$3 = "[object Date]", errorTag$2 = "[object Error]", funcTag$1 = "[object Function]", mapTag$5 = "[object Map]", numberTag$3 = "[object Number]", objectTag$4 = "[object Object]", regexpTag$3 = "[object RegExp]", setTag$5 = "[object Set]", stringTag$3 = "[object String]", weakMapTag$2 = "[object WeakMap]";
551
- var arrayBufferTag$3 = "[object ArrayBuffer]", dataViewTag$4 = "[object DataView]", float32Tag$2 = "[object Float32Array]", float64Tag$2 = "[object Float64Array]", int8Tag$2 = "[object Int8Array]", int16Tag$2 = "[object Int16Array]", int32Tag$2 = "[object Int32Array]", uint8Tag$2 = "[object Uint8Array]", uint8ClampedTag$2 = "[object Uint8ClampedArray]", uint16Tag$2 = "[object Uint16Array]", uint32Tag$2 = "[object Uint32Array]";
552
- var typedArrayTags = {};
553
- typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] = typedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] = typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] = typedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] = typedArrayTags[uint32Tag$2] = true;
554
- typedArrayTags[argsTag$2] = typedArrayTags[arrayTag$2] = typedArrayTags[arrayBufferTag$3] = typedArrayTags[boolTag$3] = typedArrayTags[dataViewTag$4] = typedArrayTags[dateTag$3] = typedArrayTags[errorTag$2] = typedArrayTags[funcTag$1] = typedArrayTags[mapTag$5] = typedArrayTags[numberTag$3] = typedArrayTags[objectTag$4] = typedArrayTags[regexpTag$3] = typedArrayTags[setTag$5] = typedArrayTags[stringTag$3] = typedArrayTags[weakMapTag$2] = false;
555
- function baseIsTypedArray(value) {
556
- return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
557
- }
558
- function baseUnary(func) {
559
- return function(value) {
560
- return func(value);
561
- };
562
- }
563
- var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
564
- var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
565
- var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
566
- var freeProcess = moduleExports$1 && freeGlobal$1.process;
567
- var nodeUtil = function() {
568
- try {
569
- var types = freeModule$1 && freeModule$1.require && freeModule$1.require("util").types;
570
- if (types) {
571
- return types;
572
- }
573
- return freeProcess && freeProcess.binding && freeProcess.binding("util");
574
- } catch (e) {
575
- }
576
- }();
577
- var nodeUtil$1 = nodeUtil;
578
- var nodeIsTypedArray = nodeUtil$1 && nodeUtil$1.isTypedArray;
579
- var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
580
- var isTypedArray$1 = isTypedArray;
581
- var objectProto$9 = Object.prototype;
582
- var hasOwnProperty$8 = objectProto$9.hasOwnProperty;
583
- function arrayLikeKeys(value, inherited) {
584
- var isArr = isArray$1(value), isArg = !isArr && isArguments$1(value), isBuff = !isArr && !isArg && isBuffer$1(value), isType = !isArr && !isArg && !isBuff && isTypedArray$1(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
585
- for (var key in value) {
586
- if ((inherited || hasOwnProperty$8.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) {
587
- result.push(key);
588
- }
589
- }
590
- return result;
591
- }
592
- function overArg(func, transform) {
593
- return function(arg) {
594
- return func(transform(arg));
595
- };
596
- }
597
- var nativeKeys = overArg(Object.keys, Object);
598
- var nativeKeys$1 = nativeKeys;
599
- var objectProto$8 = Object.prototype;
600
- var hasOwnProperty$7 = objectProto$8.hasOwnProperty;
601
- function baseKeys(object) {
602
- if (!isPrototype(object)) {
603
- return nativeKeys$1(object);
604
- }
605
- var result = [];
606
- for (var key in Object(object)) {
607
- if (hasOwnProperty$7.call(object, key) && key != "constructor") {
608
- result.push(key);
609
- }
610
- }
611
- return result;
612
- }
613
- function keys(object) {
614
- return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
615
- }
616
- function nativeKeysIn(object) {
617
- var result = [];
618
- if (object != null) {
619
- for (var key in Object(object)) {
620
- result.push(key);
621
- }
622
- }
623
- return result;
624
- }
625
- var objectProto$7 = Object.prototype;
626
- var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
627
- function baseKeysIn(object) {
628
- if (!isObject(object)) {
629
- return nativeKeysIn(object);
630
- }
631
- var isProto = isPrototype(object), result = [];
632
- for (var key in object) {
633
- if (!(key == "constructor" && (isProto || !hasOwnProperty$6.call(object, key)))) {
634
- result.push(key);
488
+ function initInstance(props, content) {
489
+ const container = document.createElement("div");
490
+ container.classList.add("notification__warpper");
491
+ const lastChild = document.body.lastElementChild;
492
+ let offset_Top = 50;
493
+ if (lastChild == null ? void 0 : lastChild.classList.contains("notification__warpper")) {
494
+ const notification2 = lastChild.lastElementChild;
495
+ const rects = notification2.getBoundingClientRect();
496
+ const height = rects.height;
497
+ const top = rects.top;
498
+ offset_Top = height + top;
499
+ }
500
+ const app = createApp({
501
+ setup() {
502
+ onUnmounted(() => {
503
+ document.body.removeChild(container);
504
+ });
505
+ return () => createVNode(Notification, mergeProps(props, {
506
+ "onDestroy": app.unmount,
507
+ "style": [`top: ${offset_Top}px`]
508
+ }), _isSlot(content) ? content : {
509
+ default: () => [content]
510
+ });
635
511
  }
636
- }
637
- return result;
638
- }
639
- function keysIn(object) {
640
- return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
641
- }
642
- var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/;
643
- function isKey(value, object) {
644
- if (isArray$1(value)) {
645
- return false;
646
- }
647
- var type = typeof value;
648
- if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) {
649
- return true;
650
- }
651
- return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
652
- }
653
- var nativeCreate = getNative(Object, "create");
654
- var nativeCreate$1 = nativeCreate;
655
- function hashClear() {
656
- this.__data__ = nativeCreate$1 ? nativeCreate$1(null) : {};
657
- this.size = 0;
658
- }
659
- function hashDelete(key) {
660
- var result = this.has(key) && delete this.__data__[key];
661
- this.size -= result ? 1 : 0;
662
- return result;
663
- }
664
- var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
665
- var objectProto$6 = Object.prototype;
666
- var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
667
- function hashGet(key) {
668
- var data = this.__data__;
669
- if (nativeCreate$1) {
670
- var result = data[key];
671
- return result === HASH_UNDEFINED$2 ? void 0 : result;
672
- }
673
- return hasOwnProperty$5.call(data, key) ? data[key] : void 0;
674
- }
675
- var objectProto$5 = Object.prototype;
676
- var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
677
- function hashHas(key) {
678
- var data = this.__data__;
679
- return nativeCreate$1 ? data[key] !== void 0 : hasOwnProperty$4.call(data, key);
680
- }
681
- var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
682
- function hashSet(key, value) {
683
- var data = this.__data__;
684
- this.size += this.has(key) ? 0 : 1;
685
- data[key] = nativeCreate$1 && value === void 0 ? HASH_UNDEFINED$1 : value;
686
- return this;
687
- }
688
- function Hash(entries) {
689
- var index2 = -1, length = entries == null ? 0 : entries.length;
690
- this.clear();
691
- while (++index2 < length) {
692
- var entry = entries[index2];
693
- this.set(entry[0], entry[1]);
694
- }
695
- }
696
- Hash.prototype.clear = hashClear;
697
- Hash.prototype["delete"] = hashDelete;
698
- Hash.prototype.get = hashGet;
699
- Hash.prototype.has = hashHas;
700
- Hash.prototype.set = hashSet;
701
- function listCacheClear() {
702
- this.__data__ = [];
703
- this.size = 0;
704
- }
705
- function assocIndexOf(array, key) {
706
- var length = array.length;
707
- while (length--) {
708
- if (eq(array[length][0], key)) {
709
- return length;
512
+ });
513
+ document.body.appendChild(container);
514
+ app.mount(container);
515
+ return app;
516
+ }
517
+ function close(props, originOnClose) {
518
+ props.modelValue = false;
519
+ originOnClose == null ? void 0 : originOnClose();
520
+ }
521
+ class NotificationService {
522
+ static open(options) {
523
+ const originOnClose = options.onClose || null;
524
+ const content = options.content;
525
+ let timer;
526
+ delete options.content;
527
+ const props = reactive(__spreadProps(__spreadValues(__spreadValues({}, defaultOptions), options), {
528
+ onClose: () => {
529
+ close(props, originOnClose);
530
+ }
531
+ }));
532
+ initInstance(props, content);
533
+ props.modelValue = true;
534
+ clearTimeout(timer);
535
+ if (options.duration && props.onClose) {
536
+ timer = setTimeout(props.onClose, options.duration);
710
537
  }
711
538
  }
712
- return -1;
713
- }
714
- var arrayProto = Array.prototype;
715
- var splice = arrayProto.splice;
716
- function listCacheDelete(key) {
717
- var data = this.__data__, index2 = assocIndexOf(data, key);
718
- if (index2 < 0) {
719
- return false;
720
- }
721
- var lastIndex = data.length - 1;
722
- if (index2 == lastIndex) {
723
- data.pop();
724
- } else {
725
- splice.call(data, index2, 1);
726
- }
727
- --this.size;
728
- return true;
729
- }
730
- function listCacheGet(key) {
731
- var data = this.__data__, index2 = assocIndexOf(data, key);
732
- return index2 < 0 ? void 0 : data[index2][1];
733
- }
734
- function listCacheHas(key) {
735
- return assocIndexOf(this.__data__, key) > -1;
736
539
  }
737
- function listCacheSet(key, value) {
738
- var data = this.__data__, index2 = assocIndexOf(data, key);
739
- if (index2 < 0) {
740
- ++this.size;
741
- data.push([key, value]);
742
- } else {
743
- data[index2][1] = value;
540
+ class IUploadOptions {
541
+ constructor() {
542
+ __publicField(this, "uri");
543
+ __publicField(this, "method");
544
+ __publicField(this, "maximumSize");
545
+ __publicField(this, "headers");
546
+ __publicField(this, "authToken");
547
+ __publicField(this, "authTokenHeader");
548
+ __publicField(this, "additionalParameter");
549
+ __publicField(this, "fileFieldName");
550
+ __publicField(this, "checkSameName");
551
+ __publicField(this, "withCredentials");
552
+ __publicField(this, "responseType");
744
553
  }
745
- return this;
746
554
  }
747
- function ListCache(entries) {
748
- var index2 = -1, length = entries == null ? 0 : entries.length;
749
- this.clear();
750
- while (++index2 < length) {
751
- var entry = entries[index2];
752
- this.set(entry[0], entry[1]);
555
+ class IFileOptions {
556
+ constructor() {
557
+ __publicField(this, "accept");
558
+ __publicField(this, "multiple");
559
+ __publicField(this, "webkitdirectory");
753
560
  }
754
561
  }
755
- ListCache.prototype.clear = listCacheClear;
756
- ListCache.prototype["delete"] = listCacheDelete;
757
- ListCache.prototype.get = listCacheGet;
758
- ListCache.prototype.has = listCacheHas;
759
- ListCache.prototype.set = listCacheSet;
760
- var Map = getNative(root$1, "Map");
761
- var Map$1 = Map;
762
- function mapCacheClear() {
763
- this.size = 0;
764
- this.__data__ = {
765
- "hash": new Hash(),
766
- "map": new (Map$1 || ListCache)(),
767
- "string": new Hash()
768
- };
769
- }
770
- function isKeyable(value) {
771
- var type = typeof value;
772
- return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
773
- }
774
- function getMapData(map, key) {
775
- var data = map.__data__;
776
- return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
777
- }
778
- function mapCacheDelete(key) {
779
- var result = getMapData(this, key)["delete"](key);
780
- this.size -= result ? 1 : 0;
781
- return result;
782
- }
783
- function mapCacheGet(key) {
784
- return getMapData(this, key).get(key);
785
- }
786
- function mapCacheHas(key) {
787
- return getMapData(this, key).has(key);
788
- }
789
- function mapCacheSet(key, value) {
790
- var data = getMapData(this, key), size = data.size;
791
- data.set(key, value);
792
- this.size += data.size == size ? 0 : 1;
793
- return this;
794
- }
795
- function MapCache(entries) {
796
- var index2 = -1, length = entries == null ? 0 : entries.length;
797
- this.clear();
798
- while (++index2 < length) {
799
- var entry = entries[index2];
800
- this.set(entry[0], entry[1]);
801
- }
802
- }
803
- MapCache.prototype.clear = mapCacheClear;
804
- MapCache.prototype["delete"] = mapCacheDelete;
805
- MapCache.prototype.get = mapCacheGet;
806
- MapCache.prototype.has = mapCacheHas;
807
- MapCache.prototype.set = mapCacheSet;
808
- var FUNC_ERROR_TEXT$2 = "Expected a function";
809
- function memoize(func, resolver) {
810
- if (typeof func != "function" || resolver != null && typeof resolver != "function") {
811
- throw new TypeError(FUNC_ERROR_TEXT$2);
812
- }
813
- var memoized = function() {
814
- var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
815
- if (cache.has(key)) {
816
- return cache.get(key);
817
- }
818
- var result = func.apply(this, args);
819
- memoized.cache = cache.set(key, result) || cache;
820
- return result;
821
- };
822
- memoized.cache = new (memoize.Cache || MapCache)();
823
- return memoized;
824
- }
825
- memoize.Cache = MapCache;
826
- var MAX_MEMOIZE_SIZE = 500;
827
- function memoizeCapped(func) {
828
- var result = memoize(func, function(key) {
829
- if (cache.size === MAX_MEMOIZE_SIZE) {
830
- cache.clear();
831
- }
832
- return key;
833
- });
834
- var cache = result.cache;
835
- return result;
836
- }
837
- var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
838
- var reEscapeChar = /\\(\\)?/g;
839
- var stringToPath = memoizeCapped(function(string) {
840
- var result = [];
841
- if (string.charCodeAt(0) === 46) {
842
- result.push("");
843
- }
844
- string.replace(rePropName, function(match, number, quote, subString) {
845
- result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
846
- });
847
- return result;
848
- });
849
- var stringToPath$1 = stringToPath;
850
- function toString(value) {
851
- return value == null ? "" : baseToString(value);
852
- }
853
- function castPath(value, object) {
854
- if (isArray$1(value)) {
855
- return value;
856
- }
857
- return isKey(value, object) ? [value] : stringToPath$1(toString(value));
858
- }
859
- var INFINITY = 1 / 0;
860
- function toKey(value) {
861
- if (typeof value == "string" || isSymbol(value)) {
862
- return value;
863
- }
864
- var result = value + "";
865
- return result == "0" && 1 / value == -INFINITY ? "-0" : result;
866
- }
867
- function baseGet(object, path) {
868
- path = castPath(path, object);
869
- var index2 = 0, length = path.length;
870
- while (object != null && index2 < length) {
871
- object = object[toKey(path[index2++])];
872
- }
873
- return index2 && index2 == length ? object : void 0;
874
- }
875
- function arrayPush(array, values) {
876
- var index2 = -1, length = values.length, offset = array.length;
877
- while (++index2 < length) {
878
- array[offset + index2] = values[index2];
879
- }
880
- return array;
881
- }
882
- var spreadableSymbol = Symbol$2 ? Symbol$2.isConcatSpreadable : void 0;
883
- function isFlattenable(value) {
884
- return isArray$1(value) || isArguments$1(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
885
- }
886
- function baseFlatten(array, depth, predicate, isStrict, result) {
887
- var index2 = -1, length = array.length;
888
- predicate || (predicate = isFlattenable);
889
- result || (result = []);
890
- while (++index2 < length) {
891
- var value = array[index2];
892
- if (depth > 0 && predicate(value)) {
893
- if (depth > 1) {
894
- baseFlatten(value, depth - 1, predicate, isStrict, result);
895
- } else {
896
- arrayPush(result, value);
897
- }
898
- } else if (!isStrict) {
899
- result[result.length] = value;
900
- }
901
- }
902
- return result;
903
- }
904
- function flatten(array) {
905
- var length = array == null ? 0 : array.length;
906
- return length ? baseFlatten(array, 1) : [];
907
- }
908
- function flatRest(func) {
909
- return setToString$1(overRest(func, void 0, flatten), func + "");
910
- }
911
- var getPrototype = overArg(Object.getPrototypeOf, Object);
912
- var getPrototype$1 = getPrototype;
913
- var objectTag$3 = "[object Object]";
914
- var funcProto = Function.prototype, objectProto$4 = Object.prototype;
915
- var funcToString = funcProto.toString;
916
- var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
917
- var objectCtorString = funcToString.call(Object);
918
- function isPlainObject(value) {
919
- if (!isObjectLike(value) || baseGetTag(value) != objectTag$3) {
920
- return false;
921
- }
922
- var proto = getPrototype$1(value);
923
- if (proto === null) {
924
- return true;
925
- }
926
- var Ctor = hasOwnProperty$3.call(proto, "constructor") && proto.constructor;
927
- return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
928
- }
929
- function baseSlice(array, start, end) {
930
- var index2 = -1, length = array.length;
931
- if (start < 0) {
932
- start = -start > length ? 0 : length + start;
933
- }
934
- end = end > length ? length : end;
935
- if (end < 0) {
936
- end += length;
937
- }
938
- length = start > end ? 0 : end - start >>> 0;
939
- start >>>= 0;
940
- var result = Array(length);
941
- while (++index2 < length) {
942
- result[index2] = array[index2 + start];
943
- }
944
- return result;
945
- }
946
- function stackClear() {
947
- this.__data__ = new ListCache();
948
- this.size = 0;
949
- }
950
- function stackDelete(key) {
951
- var data = this.__data__, result = data["delete"](key);
952
- this.size = data.size;
953
- return result;
954
- }
955
- function stackGet(key) {
956
- return this.__data__.get(key);
957
- }
958
- function stackHas(key) {
959
- return this.__data__.has(key);
960
- }
961
- var LARGE_ARRAY_SIZE = 200;
962
- function stackSet(key, value) {
963
- var data = this.__data__;
964
- if (data instanceof ListCache) {
965
- var pairs = data.__data__;
966
- if (!Map$1 || pairs.length < LARGE_ARRAY_SIZE - 1) {
967
- pairs.push([key, value]);
968
- this.size = ++data.size;
969
- return this;
970
- }
971
- data = this.__data__ = new MapCache(pairs);
972
- }
973
- data.set(key, value);
974
- this.size = data.size;
975
- return this;
976
- }
977
- function Stack(entries) {
978
- var data = this.__data__ = new ListCache(entries);
979
- this.size = data.size;
980
- }
981
- Stack.prototype.clear = stackClear;
982
- Stack.prototype["delete"] = stackDelete;
983
- Stack.prototype.get = stackGet;
984
- Stack.prototype.has = stackHas;
985
- Stack.prototype.set = stackSet;
986
- function baseAssign(object, source) {
987
- return object && copyObject(source, keys(source), object);
988
- }
989
- function baseAssignIn(object, source) {
990
- return object && copyObject(source, keysIn(source), object);
991
- }
992
- var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
993
- var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
994
- var moduleExports = freeModule && freeModule.exports === freeExports;
995
- var Buffer2 = moduleExports ? root$1.Buffer : void 0, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : void 0;
996
- function cloneBuffer(buffer, isDeep) {
997
- if (isDeep) {
998
- return buffer.slice();
999
- }
1000
- var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
1001
- buffer.copy(result);
1002
- return result;
1003
- }
1004
- function arrayFilter(array, predicate) {
1005
- var index2 = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
1006
- while (++index2 < length) {
1007
- var value = array[index2];
1008
- if (predicate(value, index2, array)) {
1009
- result[resIndex++] = value;
1010
- }
1011
- }
1012
- return result;
1013
- }
1014
- function stubArray() {
1015
- return [];
1016
- }
1017
- var objectProto$3 = Object.prototype;
1018
- var propertyIsEnumerable = objectProto$3.propertyIsEnumerable;
1019
- var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
1020
- var getSymbols = !nativeGetSymbols$1 ? stubArray : function(object) {
1021
- if (object == null) {
1022
- return [];
1023
- }
1024
- object = Object(object);
1025
- return arrayFilter(nativeGetSymbols$1(object), function(symbol) {
1026
- return propertyIsEnumerable.call(object, symbol);
1027
- });
1028
- };
1029
- var getSymbols$1 = getSymbols;
1030
- function copySymbols(source, object) {
1031
- return copyObject(source, getSymbols$1(source), object);
1032
- }
1033
- var nativeGetSymbols = Object.getOwnPropertySymbols;
1034
- var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
1035
- var result = [];
1036
- while (object) {
1037
- arrayPush(result, getSymbols$1(object));
1038
- object = getPrototype$1(object);
1039
- }
1040
- return result;
1041
- };
1042
- var getSymbolsIn$1 = getSymbolsIn;
1043
- function copySymbolsIn(source, object) {
1044
- return copyObject(source, getSymbolsIn$1(source), object);
1045
- }
1046
- function baseGetAllKeys(object, keysFunc, symbolsFunc) {
1047
- var result = keysFunc(object);
1048
- return isArray$1(object) ? result : arrayPush(result, symbolsFunc(object));
1049
- }
1050
- function getAllKeys(object) {
1051
- return baseGetAllKeys(object, keys, getSymbols$1);
1052
- }
1053
- function getAllKeysIn(object) {
1054
- return baseGetAllKeys(object, keysIn, getSymbolsIn$1);
1055
- }
1056
- var DataView = getNative(root$1, "DataView");
1057
- var DataView$1 = DataView;
1058
- var Promise$1 = getNative(root$1, "Promise");
1059
- var Promise$2 = Promise$1;
1060
- var Set = getNative(root$1, "Set");
1061
- var Set$1 = Set;
1062
- var mapTag$4 = "[object Map]", objectTag$2 = "[object Object]", promiseTag = "[object Promise]", setTag$4 = "[object Set]", weakMapTag$1 = "[object WeakMap]";
1063
- var dataViewTag$3 = "[object DataView]";
1064
- var dataViewCtorString = toSource(DataView$1), mapCtorString = toSource(Map$1), promiseCtorString = toSource(Promise$2), setCtorString = toSource(Set$1), weakMapCtorString = toSource(WeakMap$1);
1065
- var getTag = baseGetTag;
1066
- if (DataView$1 && getTag(new DataView$1(new ArrayBuffer(1))) != dataViewTag$3 || Map$1 && getTag(new Map$1()) != mapTag$4 || Promise$2 && getTag(Promise$2.resolve()) != promiseTag || Set$1 && getTag(new Set$1()) != setTag$4 || WeakMap$1 && getTag(new WeakMap$1()) != weakMapTag$1) {
1067
- getTag = function(value) {
1068
- var result = baseGetTag(value), Ctor = result == objectTag$2 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
1069
- if (ctorString) {
1070
- switch (ctorString) {
1071
- case dataViewCtorString:
1072
- return dataViewTag$3;
1073
- case mapCtorString:
1074
- return mapTag$4;
1075
- case promiseCtorString:
1076
- return promiseTag;
1077
- case setCtorString:
1078
- return setTag$4;
1079
- case weakMapCtorString:
1080
- return weakMapTag$1;
1081
- }
1082
- }
1083
- return result;
1084
- };
1085
- }
1086
- var getTag$1 = getTag;
1087
- var objectProto$2 = Object.prototype;
1088
- var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
1089
- function initCloneArray(array) {
1090
- var length = array.length, result = new array.constructor(length);
1091
- if (length && typeof array[0] == "string" && hasOwnProperty$2.call(array, "index")) {
1092
- result.index = array.index;
1093
- result.input = array.input;
1094
- }
1095
- return result;
1096
- }
1097
- var Uint8Array2 = root$1.Uint8Array;
1098
- var Uint8Array$1 = Uint8Array2;
1099
- function cloneArrayBuffer(arrayBuffer) {
1100
- var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
1101
- new Uint8Array$1(result).set(new Uint8Array$1(arrayBuffer));
1102
- return result;
1103
- }
1104
- function cloneDataView(dataView, isDeep) {
1105
- var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
1106
- return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
1107
- }
1108
- var reFlags = /\w*$/;
1109
- function cloneRegExp(regexp) {
1110
- var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
1111
- result.lastIndex = regexp.lastIndex;
1112
- return result;
1113
- }
1114
- var symbolProto$1 = Symbol$2 ? Symbol$2.prototype : void 0, symbolValueOf$1 = symbolProto$1 ? symbolProto$1.valueOf : void 0;
1115
- function cloneSymbol(symbol) {
1116
- return symbolValueOf$1 ? Object(symbolValueOf$1.call(symbol)) : {};
1117
- }
1118
- function cloneTypedArray(typedArray, isDeep) {
1119
- var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
1120
- return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
1121
- }
1122
- var boolTag$2 = "[object Boolean]", dateTag$2 = "[object Date]", mapTag$3 = "[object Map]", numberTag$2 = "[object Number]", regexpTag$2 = "[object RegExp]", setTag$3 = "[object Set]", stringTag$2 = "[object String]", symbolTag$2 = "[object Symbol]";
1123
- var arrayBufferTag$2 = "[object ArrayBuffer]", dataViewTag$2 = "[object DataView]", float32Tag$1 = "[object Float32Array]", float64Tag$1 = "[object Float64Array]", int8Tag$1 = "[object Int8Array]", int16Tag$1 = "[object Int16Array]", int32Tag$1 = "[object Int32Array]", uint8Tag$1 = "[object Uint8Array]", uint8ClampedTag$1 = "[object Uint8ClampedArray]", uint16Tag$1 = "[object Uint16Array]", uint32Tag$1 = "[object Uint32Array]";
1124
- function initCloneByTag(object, tag, isDeep) {
1125
- var Ctor = object.constructor;
1126
- switch (tag) {
1127
- case arrayBufferTag$2:
1128
- return cloneArrayBuffer(object);
1129
- case boolTag$2:
1130
- case dateTag$2:
1131
- return new Ctor(+object);
1132
- case dataViewTag$2:
1133
- return cloneDataView(object, isDeep);
1134
- case float32Tag$1:
1135
- case float64Tag$1:
1136
- case int8Tag$1:
1137
- case int16Tag$1:
1138
- case int32Tag$1:
1139
- case uint8Tag$1:
1140
- case uint8ClampedTag$1:
1141
- case uint16Tag$1:
1142
- case uint32Tag$1:
1143
- return cloneTypedArray(object, isDeep);
1144
- case mapTag$3:
1145
- return new Ctor();
1146
- case numberTag$2:
1147
- case stringTag$2:
1148
- return new Ctor(object);
1149
- case regexpTag$2:
1150
- return cloneRegExp(object);
1151
- case setTag$3:
1152
- return new Ctor();
1153
- case symbolTag$2:
1154
- return cloneSymbol(object);
1155
- }
1156
- }
1157
- function initCloneObject(object) {
1158
- return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate$1(getPrototype$1(object)) : {};
1159
- }
1160
- var mapTag$2 = "[object Map]";
1161
- function baseIsMap(value) {
1162
- return isObjectLike(value) && getTag$1(value) == mapTag$2;
1163
- }
1164
- var nodeIsMap = nodeUtil$1 && nodeUtil$1.isMap;
1165
- var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
1166
- var isMap$1 = isMap;
1167
- var setTag$2 = "[object Set]";
1168
- function baseIsSet(value) {
1169
- return isObjectLike(value) && getTag$1(value) == setTag$2;
1170
- }
1171
- var nodeIsSet = nodeUtil$1 && nodeUtil$1.isSet;
1172
- var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
1173
- var isSet$1 = isSet;
1174
- var CLONE_DEEP_FLAG$2 = 1, CLONE_FLAT_FLAG$1 = 2, CLONE_SYMBOLS_FLAG$2 = 4;
1175
- var argsTag$1 = "[object Arguments]", arrayTag$1 = "[object Array]", boolTag$1 = "[object Boolean]", dateTag$1 = "[object Date]", errorTag$1 = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag$1 = "[object Map]", numberTag$1 = "[object Number]", objectTag$1 = "[object Object]", regexpTag$1 = "[object RegExp]", setTag$1 = "[object Set]", stringTag$1 = "[object String]", symbolTag$1 = "[object Symbol]", weakMapTag = "[object WeakMap]";
1176
- var arrayBufferTag$1 = "[object ArrayBuffer]", dataViewTag$1 = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
1177
- var cloneableTags = {};
1178
- cloneableTags[argsTag$1] = cloneableTags[arrayTag$1] = cloneableTags[arrayBufferTag$1] = cloneableTags[dataViewTag$1] = cloneableTags[boolTag$1] = cloneableTags[dateTag$1] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag$1] = cloneableTags[numberTag$1] = cloneableTags[objectTag$1] = cloneableTags[regexpTag$1] = cloneableTags[setTag$1] = cloneableTags[stringTag$1] = cloneableTags[symbolTag$1] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
1179
- cloneableTags[errorTag$1] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
1180
- function baseClone(value, bitmask, customizer, key, object, stack) {
1181
- var result, isDeep = bitmask & CLONE_DEEP_FLAG$2, isFlat = bitmask & CLONE_FLAT_FLAG$1, isFull = bitmask & CLONE_SYMBOLS_FLAG$2;
1182
- if (customizer) {
1183
- result = object ? customizer(value, key, object, stack) : customizer(value);
1184
- }
1185
- if (result !== void 0) {
1186
- return result;
1187
- }
1188
- if (!isObject(value)) {
1189
- return value;
1190
- }
1191
- var isArr = isArray$1(value);
1192
- if (isArr) {
1193
- result = initCloneArray(value);
1194
- if (!isDeep) {
1195
- return copyArray(value, result);
1196
- }
1197
- } else {
1198
- var tag = getTag$1(value), isFunc = tag == funcTag || tag == genTag;
1199
- if (isBuffer$1(value)) {
1200
- return cloneBuffer(value, isDeep);
1201
- }
1202
- if (tag == objectTag$1 || tag == argsTag$1 || isFunc && !object) {
1203
- result = isFlat || isFunc ? {} : initCloneObject(value);
1204
- if (!isDeep) {
1205
- return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
1206
- }
1207
- } else {
1208
- if (!cloneableTags[tag]) {
1209
- return object ? value : {};
1210
- }
1211
- result = initCloneByTag(value, tag, isDeep);
1212
- }
1213
- }
1214
- stack || (stack = new Stack());
1215
- var stacked = stack.get(value);
1216
- if (stacked) {
1217
- return stacked;
1218
- }
1219
- stack.set(value, result);
1220
- if (isSet$1(value)) {
1221
- value.forEach(function(subValue) {
1222
- result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
1223
- });
1224
- } else if (isMap$1(value)) {
1225
- value.forEach(function(subValue, key2) {
1226
- result.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
1227
- });
1228
- }
1229
- var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
1230
- var props = isArr ? void 0 : keysFunc(value);
1231
- arrayEach(props || value, function(subValue, key2) {
1232
- if (props) {
1233
- key2 = subValue;
1234
- subValue = value[key2];
1235
- }
1236
- assignValue(result, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
1237
- });
1238
- return result;
1239
- }
1240
- var CLONE_DEEP_FLAG$1 = 1, CLONE_SYMBOLS_FLAG$1 = 4;
1241
- function cloneDeep(value) {
1242
- return baseClone(value, CLONE_DEEP_FLAG$1 | CLONE_SYMBOLS_FLAG$1);
1243
- }
1244
- var HASH_UNDEFINED = "__lodash_hash_undefined__";
1245
- function setCacheAdd(value) {
1246
- this.__data__.set(value, HASH_UNDEFINED);
1247
- return this;
1248
- }
1249
- function setCacheHas(value) {
1250
- return this.__data__.has(value);
1251
- }
1252
- function SetCache(values) {
1253
- var index2 = -1, length = values == null ? 0 : values.length;
1254
- this.__data__ = new MapCache();
1255
- while (++index2 < length) {
1256
- this.add(values[index2]);
1257
- }
1258
- }
1259
- SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
1260
- SetCache.prototype.has = setCacheHas;
1261
- function arraySome(array, predicate) {
1262
- var index2 = -1, length = array == null ? 0 : array.length;
1263
- while (++index2 < length) {
1264
- if (predicate(array[index2], index2, array)) {
1265
- return true;
1266
- }
1267
- }
1268
- return false;
1269
- }
1270
- function cacheHas(cache, key) {
1271
- return cache.has(key);
1272
- }
1273
- var COMPARE_PARTIAL_FLAG$3 = 1, COMPARE_UNORDERED_FLAG$1 = 2;
1274
- function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
1275
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, arrLength = array.length, othLength = other.length;
1276
- if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
1277
- return false;
1278
- }
1279
- var arrStacked = stack.get(array);
1280
- var othStacked = stack.get(other);
1281
- if (arrStacked && othStacked) {
1282
- return arrStacked == other && othStacked == array;
1283
- }
1284
- var index2 = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$1 ? new SetCache() : void 0;
1285
- stack.set(array, other);
1286
- stack.set(other, array);
1287
- while (++index2 < arrLength) {
1288
- var arrValue = array[index2], othValue = other[index2];
1289
- if (customizer) {
1290
- var compared = isPartial ? customizer(othValue, arrValue, index2, other, array, stack) : customizer(arrValue, othValue, index2, array, other, stack);
1291
- }
1292
- if (compared !== void 0) {
1293
- if (compared) {
1294
- continue;
1295
- }
1296
- result = false;
1297
- break;
1298
- }
1299
- if (seen) {
1300
- if (!arraySome(other, function(othValue2, othIndex) {
1301
- if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
1302
- return seen.push(othIndex);
1303
- }
1304
- })) {
1305
- result = false;
1306
- break;
1307
- }
1308
- } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
1309
- result = false;
1310
- break;
1311
- }
1312
- }
1313
- stack["delete"](array);
1314
- stack["delete"](other);
1315
- return result;
1316
- }
1317
- function mapToArray(map) {
1318
- var index2 = -1, result = Array(map.size);
1319
- map.forEach(function(value, key) {
1320
- result[++index2] = [key, value];
1321
- });
1322
- return result;
1323
- }
1324
- function setToArray(set) {
1325
- var index2 = -1, result = Array(set.size);
1326
- set.forEach(function(value) {
1327
- result[++index2] = value;
1328
- });
1329
- return result;
1330
- }
1331
- var COMPARE_PARTIAL_FLAG$2 = 1, COMPARE_UNORDERED_FLAG = 2;
1332
- var boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", mapTag = "[object Map]", numberTag = "[object Number]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]";
1333
- var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]";
1334
- var symbolProto = Symbol$2 ? Symbol$2.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
1335
- function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
1336
- switch (tag) {
1337
- case dataViewTag:
1338
- if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
1339
- return false;
1340
- }
1341
- object = object.buffer;
1342
- other = other.buffer;
1343
- case arrayBufferTag:
1344
- if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array$1(object), new Uint8Array$1(other))) {
1345
- return false;
1346
- }
1347
- return true;
1348
- case boolTag:
1349
- case dateTag:
1350
- case numberTag:
1351
- return eq(+object, +other);
1352
- case errorTag:
1353
- return object.name == other.name && object.message == other.message;
1354
- case regexpTag:
1355
- case stringTag:
1356
- return object == other + "";
1357
- case mapTag:
1358
- var convert = mapToArray;
1359
- case setTag:
1360
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2;
1361
- convert || (convert = setToArray);
1362
- if (object.size != other.size && !isPartial) {
1363
- return false;
1364
- }
1365
- var stacked = stack.get(object);
1366
- if (stacked) {
1367
- return stacked == other;
1368
- }
1369
- bitmask |= COMPARE_UNORDERED_FLAG;
1370
- stack.set(object, other);
1371
- var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
1372
- stack["delete"](object);
1373
- return result;
1374
- case symbolTag:
1375
- if (symbolValueOf) {
1376
- return symbolValueOf.call(object) == symbolValueOf.call(other);
1377
- }
1378
- }
1379
- return false;
1380
- }
1381
- var COMPARE_PARTIAL_FLAG$1 = 1;
1382
- var objectProto$1 = Object.prototype;
1383
- var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
1384
- function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
1385
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
1386
- if (objLength != othLength && !isPartial) {
1387
- return false;
1388
- }
1389
- var index2 = objLength;
1390
- while (index2--) {
1391
- var key = objProps[index2];
1392
- if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) {
1393
- return false;
1394
- }
1395
- }
1396
- var objStacked = stack.get(object);
1397
- var othStacked = stack.get(other);
1398
- if (objStacked && othStacked) {
1399
- return objStacked == other && othStacked == object;
1400
- }
1401
- var result = true;
1402
- stack.set(object, other);
1403
- stack.set(other, object);
1404
- var skipCtor = isPartial;
1405
- while (++index2 < objLength) {
1406
- key = objProps[index2];
1407
- var objValue = object[key], othValue = other[key];
1408
- if (customizer) {
1409
- var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
1410
- }
1411
- if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
1412
- result = false;
1413
- break;
1414
- }
1415
- skipCtor || (skipCtor = key == "constructor");
1416
- }
1417
- if (result && !skipCtor) {
1418
- var objCtor = object.constructor, othCtor = other.constructor;
1419
- if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
1420
- result = false;
1421
- }
1422
- }
1423
- stack["delete"](object);
1424
- stack["delete"](other);
1425
- return result;
1426
- }
1427
- var COMPARE_PARTIAL_FLAG = 1;
1428
- var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]";
1429
- var objectProto = Object.prototype;
1430
- var hasOwnProperty = objectProto.hasOwnProperty;
1431
- function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
1432
- var objIsArr = isArray$1(object), othIsArr = isArray$1(other), objTag = objIsArr ? arrayTag : getTag$1(object), othTag = othIsArr ? arrayTag : getTag$1(other);
1433
- objTag = objTag == argsTag ? objectTag : objTag;
1434
- othTag = othTag == argsTag ? objectTag : othTag;
1435
- var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
1436
- if (isSameTag && isBuffer$1(object)) {
1437
- if (!isBuffer$1(other)) {
1438
- return false;
1439
- }
1440
- objIsArr = true;
1441
- objIsObj = false;
1442
- }
1443
- if (isSameTag && !objIsObj) {
1444
- stack || (stack = new Stack());
1445
- return objIsArr || isTypedArray$1(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
1446
- }
1447
- if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
1448
- var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
1449
- if (objIsWrapped || othIsWrapped) {
1450
- var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
1451
- stack || (stack = new Stack());
1452
- return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
1453
- }
1454
- }
1455
- if (!isSameTag) {
1456
- return false;
1457
- }
1458
- stack || (stack = new Stack());
1459
- return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
1460
- }
1461
- function baseIsEqual(value, other, bitmask, customizer, stack) {
1462
- if (value === other) {
1463
- return true;
1464
- }
1465
- if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
1466
- return value !== value && other !== other;
1467
- }
1468
- return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
1469
- }
1470
- function createBaseFor(fromRight) {
1471
- return function(object, iteratee, keysFunc) {
1472
- var index2 = -1, iterable = Object(object), props = keysFunc(object), length = props.length;
1473
- while (length--) {
1474
- var key = props[fromRight ? length : ++index2];
1475
- if (iteratee(iterable[key], key, iterable) === false) {
1476
- break;
1477
- }
1478
- }
1479
- return object;
1480
- };
1481
- }
1482
- var baseFor = createBaseFor();
1483
- var baseFor$1 = baseFor;
1484
- var now = function() {
1485
- return root$1.Date.now();
1486
- };
1487
- var now$1 = now;
1488
- var FUNC_ERROR_TEXT$1 = "Expected a function";
1489
- var nativeMax = Math.max, nativeMin = Math.min;
1490
- function debounce(func, wait, options) {
1491
- var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
1492
- if (typeof func != "function") {
1493
- throw new TypeError(FUNC_ERROR_TEXT$1);
1494
- }
1495
- wait = toNumber(wait) || 0;
1496
- if (isObject(options)) {
1497
- leading = !!options.leading;
1498
- maxing = "maxWait" in options;
1499
- maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
1500
- trailing = "trailing" in options ? !!options.trailing : trailing;
1501
- }
1502
- function invokeFunc(time) {
1503
- var args = lastArgs, thisArg = lastThis;
1504
- lastArgs = lastThis = void 0;
1505
- lastInvokeTime = time;
1506
- result = func.apply(thisArg, args);
1507
- return result;
1508
- }
1509
- function leadingEdge(time) {
1510
- lastInvokeTime = time;
1511
- timerId = setTimeout(timerExpired, wait);
1512
- return leading ? invokeFunc(time) : result;
1513
- }
1514
- function remainingWait(time) {
1515
- var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
1516
- return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
1517
- }
1518
- function shouldInvoke(time) {
1519
- var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
1520
- return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
1521
- }
1522
- function timerExpired() {
1523
- var time = now$1();
1524
- if (shouldInvoke(time)) {
1525
- return trailingEdge(time);
1526
- }
1527
- timerId = setTimeout(timerExpired, remainingWait(time));
1528
- }
1529
- function trailingEdge(time) {
1530
- timerId = void 0;
1531
- if (trailing && lastArgs) {
1532
- return invokeFunc(time);
1533
- }
1534
- lastArgs = lastThis = void 0;
1535
- return result;
1536
- }
1537
- function cancel() {
1538
- if (timerId !== void 0) {
1539
- clearTimeout(timerId);
1540
- }
1541
- lastInvokeTime = 0;
1542
- lastArgs = lastCallTime = lastThis = timerId = void 0;
1543
- }
1544
- function flush() {
1545
- return timerId === void 0 ? result : trailingEdge(now$1());
1546
- }
1547
- function debounced() {
1548
- var time = now$1(), isInvoking = shouldInvoke(time);
1549
- lastArgs = arguments;
1550
- lastThis = this;
1551
- lastCallTime = time;
1552
- if (isInvoking) {
1553
- if (timerId === void 0) {
1554
- return leadingEdge(lastCallTime);
1555
- }
1556
- if (maxing) {
1557
- clearTimeout(timerId);
1558
- timerId = setTimeout(timerExpired, wait);
1559
- return invokeFunc(lastCallTime);
1560
- }
1561
- }
1562
- if (timerId === void 0) {
1563
- timerId = setTimeout(timerExpired, wait);
1564
- }
1565
- return result;
1566
- }
1567
- debounced.cancel = cancel;
1568
- debounced.flush = flush;
1569
- return debounced;
1570
- }
1571
- function assignMergeValue(object, key, value) {
1572
- if (value !== void 0 && !eq(object[key], value) || value === void 0 && !(key in object)) {
1573
- baseAssignValue(object, key, value);
1574
- }
1575
- }
1576
- function isArrayLikeObject(value) {
1577
- return isObjectLike(value) && isArrayLike(value);
1578
- }
1579
- function safeGet(object, key) {
1580
- if (key === "constructor" && typeof object[key] === "function") {
1581
- return;
1582
- }
1583
- if (key == "__proto__") {
1584
- return;
1585
- }
1586
- return object[key];
1587
- }
1588
- function toPlainObject(value) {
1589
- return copyObject(value, keysIn(value));
1590
- }
1591
- function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
1592
- var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
1593
- if (stacked) {
1594
- assignMergeValue(object, key, stacked);
1595
- return;
1596
- }
1597
- var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : void 0;
1598
- var isCommon = newValue === void 0;
1599
- if (isCommon) {
1600
- var isArr = isArray$1(srcValue), isBuff = !isArr && isBuffer$1(srcValue), isTyped = !isArr && !isBuff && isTypedArray$1(srcValue);
1601
- newValue = srcValue;
1602
- if (isArr || isBuff || isTyped) {
1603
- if (isArray$1(objValue)) {
1604
- newValue = objValue;
1605
- } else if (isArrayLikeObject(objValue)) {
1606
- newValue = copyArray(objValue);
1607
- } else if (isBuff) {
1608
- isCommon = false;
1609
- newValue = cloneBuffer(srcValue, true);
1610
- } else if (isTyped) {
1611
- isCommon = false;
1612
- newValue = cloneTypedArray(srcValue, true);
1613
- } else {
1614
- newValue = [];
1615
- }
1616
- } else if (isPlainObject(srcValue) || isArguments$1(srcValue)) {
1617
- newValue = objValue;
1618
- if (isArguments$1(objValue)) {
1619
- newValue = toPlainObject(objValue);
1620
- } else if (!isObject(objValue) || isFunction(objValue)) {
1621
- newValue = initCloneObject(srcValue);
1622
- }
1623
- } else {
1624
- isCommon = false;
1625
- }
1626
- }
1627
- if (isCommon) {
1628
- stack.set(srcValue, newValue);
1629
- mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
1630
- stack["delete"](srcValue);
1631
- }
1632
- assignMergeValue(object, key, newValue);
1633
- }
1634
- function baseMerge(object, source, srcIndex, customizer, stack) {
1635
- if (object === source) {
1636
- return;
1637
- }
1638
- baseFor$1(source, function(srcValue, key) {
1639
- stack || (stack = new Stack());
1640
- if (isObject(srcValue)) {
1641
- baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
1642
- } else {
1643
- var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : void 0;
1644
- if (newValue === void 0) {
1645
- newValue = srcValue;
1646
- }
1647
- assignMergeValue(object, key, newValue);
1648
- }
1649
- }, keysIn);
1650
- }
1651
- function last(array) {
1652
- var length = array == null ? 0 : array.length;
1653
- return length ? array[length - 1] : void 0;
1654
- }
1655
- function parent(object, path) {
1656
- return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
1657
- }
1658
- function isEqual(value, other) {
1659
- return baseIsEqual(value, other);
1660
- }
1661
- var merge = createAssigner(function(object, source, srcIndex) {
1662
- baseMerge(object, source, srcIndex);
1663
- });
1664
- var merge$1 = merge;
1665
- function baseUnset(object, path) {
1666
- path = castPath(path, object);
1667
- object = parent(object, path);
1668
- return object == null || delete object[toKey(last(path))];
1669
- }
1670
- function customOmitClone(value) {
1671
- return isPlainObject(value) ? void 0 : value;
1672
- }
1673
- var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4;
1674
- var omit = flatRest(function(object, paths) {
1675
- var result = {};
1676
- if (object == null) {
1677
- return result;
1678
- }
1679
- var isDeep = false;
1680
- paths = arrayMap(paths, function(path) {
1681
- path = castPath(path, object);
1682
- isDeep || (isDeep = path.length > 1);
1683
- return path;
1684
- });
1685
- copyObject(object, getAllKeysIn(object), result);
1686
- if (isDeep) {
1687
- result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
1688
- }
1689
- var length = paths.length;
1690
- while (length--) {
1691
- baseUnset(result, paths[length]);
1692
- }
1693
- return result;
1694
- });
1695
- var omit$1 = omit;
1696
- var FUNC_ERROR_TEXT = "Expected a function";
1697
- function throttle(func, wait, options) {
1698
- var leading = true, trailing = true;
1699
- if (typeof func != "function") {
1700
- throw new TypeError(FUNC_ERROR_TEXT);
1701
- }
1702
- if (isObject(options)) {
1703
- leading = "leading" in options ? !!options.leading : leading;
1704
- trailing = "trailing" in options ? !!options.trailing : trailing;
1705
- }
1706
- return debounce(func, wait, {
1707
- "leading": leading,
1708
- "maxWait": wait,
1709
- "trailing": trailing
1710
- });
1711
- }
1712
- function useToastConstant() {
1713
- const ANIMATION_NAME2 = "slide-in";
1714
- const ANIMATION_TIME2 = 300;
1715
- const ID_PREFIX2 = "toast-message";
1716
- return {
1717
- ANIMATION_TIME: ANIMATION_TIME2,
1718
- ANIMATION_NAME: ANIMATION_NAME2,
1719
- ID_PREFIX: ID_PREFIX2
1720
- };
1721
- }
1722
- const { ANIMATION_TIME: ANIMATION_TIME$1 } = useToastConstant();
1723
- function useToastEvent() {
1724
- const ctx = getCurrentInstance();
1725
- function onCloseEvent(msg) {
1726
- ctx.emit("closeEvent", msg);
1727
- }
1728
- function onValueChange(msgs) {
1729
- ctx.emit("valueChange", msgs);
1730
- }
1731
- function onHidden() {
1732
- setTimeout(() => {
1733
- var _a, _b;
1734
- return (_b = (_a = ctx.attrs).onHidden) == null ? void 0 : _b.call(_a);
1735
- }, ANIMATION_TIME$1);
1736
- }
1737
- return { onCloseEvent, onValueChange, onHidden };
1738
- }
1739
- function useToastHelper() {
1740
- function severityDelay(msg) {
1741
- switch (msg.severity) {
1742
- case "warn":
1743
- case "error":
1744
- return 1e4;
1745
- default:
1746
- return 5e3;
1747
- }
1748
- }
1749
- return { severityDelay };
1750
- }
1751
- let toastZIndex = 1060;
1752
- function toastIncrease() {
1753
- toastZIndex++;
1754
- }
1755
- const {
1756
- ANIMATION_NAME,
1757
- ANIMATION_TIME,
1758
- ID_PREFIX
1759
- } = useToastConstant();
1760
- var Toast = defineComponent({
1761
- name: "DToast",
1762
- inheritAttrs: false,
1763
- props: toastProps,
1764
- emits: ["closeEvent", "valueChange"],
1765
- setup(props, ctx) {
1766
- const {
1767
- onCloseEvent,
1768
- onHidden,
1769
- onValueChange
1770
- } = useToastEvent();
1771
- const {
1772
- severityDelay
1773
- } = useToastHelper();
1774
- const removeThrottle = throttle(remove, ANIMATION_TIME);
1775
- const messages = ref([]);
1776
- const msgAnimations = ref([]);
1777
- const containerRef = ref();
1778
- const msgItemRefs = ref([]);
1779
- let timestamp = Date.now();
1780
- let timeout;
1781
- const timeoutArr = [];
1782
- const defaultLife = computed(() => {
1783
- if (props.life !== null)
1784
- return props.life;
1785
- if (messages.value.length > 0)
1786
- return severityDelay(messages.value[0]);
1787
- return 5e3;
1788
- });
1789
- watch(() => props.value, (value) => {
1790
- if (value.length === 0)
1791
- return;
1792
- if (hasMsgAnimation()) {
1793
- initValue();
1794
- }
1795
- nextTick(() => {
1796
- initValue(value);
1797
- handleValueChange();
1798
- });
1799
- }, {
1800
- deep: true,
1801
- immediate: true
1802
- });
1803
- watch(messages, (value) => {
1804
- value.length === 0 && msgAnimations.value.length > 0 && (msgAnimations.value = []);
1805
- });
1806
- watch(msgAnimations, (value, oldValue) => {
1807
- oldValue.length > 0 && value.length === 0 && onHidden();
1808
- });
1809
- onUnmounted(() => {
1810
- if (props.sticky) {
1811
- return;
1812
- }
1813
- if (props.lifeMode === "single") {
1814
- timeoutArr.forEach((t) => t && clearTimeout(t));
1815
- } else {
1816
- clearTimeout(timeout);
1817
- }
1818
- });
1819
- function initValue(value = []) {
1820
- const cloneValue = cloneDeep(value);
1821
- messages.value = cloneValue.map((v, i) => merge$1(v, {
1822
- id: `${ID_PREFIX}-${i}`
1823
- }));
1824
- msgAnimations.value = [];
1825
- }
1826
- function handleValueChange() {
1827
- toastIncrease();
1828
- setTimeout(() => {
1829
- messages.value.forEach((msg) => msgAnimations.value.push(msg));
1830
- }, 0);
1831
- if (props.sticky)
1832
- return;
1833
- if (timeout) {
1834
- timeout = clearTimeout(timeout);
1835
- }
1836
- if (timeoutArr.length > 0) {
1837
- timeoutArr.splice(0).forEach((t) => clearTimeout(t));
1838
- }
1839
- timestamp = Date.now();
1840
- if (props.lifeMode === "single") {
1841
- setTimeout(() => {
1842
- messages.value.forEach((msg, i) => {
1843
- timeoutArr[i] = setTimeout(() => singleModeRemove(msg, i), msg.life || severityDelay(msg));
1844
- });
1845
- });
1846
- } else {
1847
- timeout = setTimeout(() => removeAll(), defaultLife.value);
1848
- }
1849
- }
1850
- function singleModeRemove(msg, i) {
1851
- removeMsgAnimation(msg);
1852
- setTimeout(() => {
1853
- onCloseEvent(msg);
1854
- if (hasMsgAnimation()) {
1855
- messages.value.splice(i, 1);
1856
- } else {
1857
- messages.value = [];
1858
- }
1859
- onValueChange(messages.value);
1860
- }, ANIMATION_TIME);
1861
- }
1862
- function interrupt(i) {
1863
- if (!msgAnimations.value.includes(messages.value[i]))
1864
- return;
1865
- if (props.lifeMode === "single") {
1866
- if (timeoutArr[i]) {
1867
- timeoutArr[i] = clearTimeout(timeoutArr[i]);
1868
- }
1869
- } else {
1870
- resetDelay(() => {
1871
- messages.value.forEach((msg, _i) => i !== _i && removeMsgAnimation(msg));
1872
- });
1873
- }
1874
- }
1875
- function resetDelay(fn) {
1876
- if (!props.sticky && timeout) {
1877
- timeout = clearTimeout(timeout);
1878
- const remainTime = defaultLife.value - (Date.now() - timestamp);
1879
- timeout = setTimeout(() => fn(), remainTime);
1880
- }
1881
- }
1882
- function remove(i) {
1883
- if (props.lifeMode === "single" && timeoutArr[i]) {
1884
- timeoutArr[i] = clearTimeout(timeoutArr[i]);
1885
- timeoutArr.splice(i, 1);
1886
- }
1887
- removeMsgAnimation(messages.value[i]);
1888
- setTimeout(() => {
1889
- onCloseEvent(messages.value[i]);
1890
- messages.value.splice(i, 1);
1891
- onValueChange(messages.value);
1892
- if (props.lifeMode === "global") {
1893
- removeReset();
1894
- }
1895
- }, ANIMATION_TIME);
1896
- }
1897
- function removeAll() {
1898
- if (messages.value.length > 0) {
1899
- msgAnimations.value = [];
1900
- setTimeout(() => {
1901
- messages.value.forEach((msg) => onCloseEvent(msg));
1902
- messages.value = [];
1903
- onValueChange(messages.value);
1904
- }, ANIMATION_TIME);
1905
- }
1906
- }
1907
- function removeReset(i, msg) {
1908
- const removed = messages.value.findIndex((_msg) => _msg === msg) === -1;
1909
- if (removed || msg !== void 0 && !msgAnimations.value.includes(msg)) {
1910
- return;
1911
- }
1912
- if (props.lifeMode === "single") {
1913
- const msgLife = msg.life || severityDelay(msg);
1914
- const remainTime = msgLife - (Date.now() - timestamp);
1915
- timeoutArr[i] = setTimeout(() => singleModeRemove(msg, i), remainTime);
1916
- } else {
1917
- resetDelay(() => removeAll());
1918
- }
1919
- }
1920
- function removeIndexThrottle(i) {
1921
- if (i < msgItemRefs.value.length && i > -1) {
1922
- removeThrottle(i);
1923
- }
1924
- }
1925
- function removeMsgThrottle(msg) {
1926
- const ignoreDiffKeys = ["id"];
1927
- const index2 = messages.value.findIndex((_msg) => isEqual(omit$1(_msg, ignoreDiffKeys), omit$1(msg, ignoreDiffKeys)));
1928
- removeIndexThrottle(index2);
1929
- }
1930
- function removeMsgAnimation(msg) {
1931
- msgAnimations.value = msgAnimations.value.filter((_msg) => _msg !== msg);
1932
- }
1933
- function close(params) {
1934
- if (params === void 0) {
1935
- return removeAll();
1936
- }
1937
- if (typeof params === "number") {
1938
- removeIndexThrottle(params);
1939
- } else {
1940
- removeMsgThrottle(params);
1941
- }
1942
- }
1943
- function msgItemRef(i) {
1944
- return msgItemRefs.value[i];
1945
- }
1946
- function hasMsgAnimation() {
1947
- return msgAnimations.value.length > 0;
1948
- }
1949
- return {
1950
- messages,
1951
- msgAnimations,
1952
- containerRef,
1953
- msgItemRefs,
1954
- interrupt,
1955
- removeReset,
1956
- removeThrottle,
1957
- close,
1958
- msgItemRef
1959
- };
1960
- },
1961
- render() {
1962
- const {
1963
- style: extraStyle,
1964
- styleClass: extraClass,
1965
- messages,
1966
- msgAnimations,
1967
- msgItemRefs,
1968
- life,
1969
- interrupt,
1970
- removeReset,
1971
- removeThrottle,
1972
- $attrs,
1973
- $slots
1974
- } = this;
1975
- const prefixCls = "devui-toast";
1976
- const wrapperStyles = [`z-index: ${toastZIndex}`, extraStyle];
1977
- const wrapperCls = [prefixCls, extraClass];
1978
- const msgCls = (msg) => [`${prefixCls}-item-container`, `${prefixCls}-message-${msg.severity}`, {
1979
- [ANIMATION_NAME]: msgAnimations.includes(msg)
1980
- }];
1981
- const showClose = (msg) => !(!msg.summary && life !== null);
1982
- const showImage = (msg) => msg.severity !== "common";
1983
- const showSummary = (msg) => !!msg.summary;
1984
- const showContent = (msg) => !!msg.content;
1985
- const showDetail = (msg) => !showContent(msg) && !!msg.detail;
1986
- const msgContent = (msg) => {
1987
- var _a;
1988
- if (typeof msg.content === "function") {
1989
- return msg.content(msg);
1990
- }
1991
- if ([null, void 0].includes(msg.content)) {
1992
- return null;
1993
- }
1994
- const slotPrefix = "slot:";
1995
- const isSlot = String(msg.content).startsWith(slotPrefix);
1996
- if (isSlot) {
1997
- return (_a = $slots[msg.content.slice(slotPrefix.length)]) == null ? void 0 : _a.call($slots, msg);
1998
- }
1999
- return msg.content;
2000
- };
2001
- return createVNode("div", mergeProps({
2002
- "ref": "containerRef",
2003
- "style": wrapperStyles,
2004
- "class": wrapperCls
2005
- }, $attrs), [messages.map((msg, i) => createVNode("div", {
2006
- "ref": (el) => msgItemRefs[i] = el,
2007
- "key": msg.id,
2008
- "class": msgCls(msg),
2009
- "aria-live": "polite",
2010
- "onMouseenter": () => interrupt(i),
2011
- "onMouseleave": () => removeReset(i, msg)
2012
- }, [createVNode("div", {
2013
- "class": `${prefixCls}-item`
2014
- }, [showClose(msg) ? createVNode(ToastIconClose, {
2015
- "prefixCls": prefixCls,
2016
- "onClick": () => removeThrottle(i)
2017
- }, null) : null, showImage(msg) ? createVNode(ToastImage, {
2018
- "prefixCls": prefixCls,
2019
- "severity": msg.severity
2020
- }, null) : null, createVNode("div", {
2021
- "class": "devui-toast-message"
2022
- }, [showSummary(msg) ? createVNode("span", {
2023
- "class": "devui-toast-title"
2024
- }, [msg.summary]) : null, showContent(msg) ? msgContent(msg) : null, showDetail(msg) ? createVNode("p", {
2025
- "innerHTML": msg.detail
2026
- }, null) : null])])]))]);
2027
- }
2028
- });
2029
- function createToastApp(props) {
2030
- return createApp(Toast, props);
2031
- }
2032
- class ToastService {
2033
- static open(props) {
2034
- let $body = document.body;
2035
- let $div = document.createElement("div");
2036
- $body.appendChild($div);
2037
- let app = createToastApp(__spreadProps(__spreadValues({}, props != null ? props : {}), { onHidden: () => app == null ? void 0 : app.unmount() }));
2038
- let toastInstance = app.mount($div);
2039
- onUnmounted(() => {
2040
- $body.removeChild($div);
2041
- $body = null;
2042
- $div = null;
2043
- app = null;
2044
- toastInstance = null;
2045
- }, toastInstance.$);
2046
- return {
2047
- toastInstance
2048
- };
2049
- }
2050
- }
2051
- Toast.install = function(app) {
2052
- app.component(Toast.name, Toast);
2053
- };
2054
- var UploadStatus;
2055
- (function(UploadStatus2) {
562
+ var UploadStatus = /* @__PURE__ */ ((UploadStatus2) => {
2056
563
  UploadStatus2[UploadStatus2["preLoad"] = 0] = "preLoad";
2057
564
  UploadStatus2[UploadStatus2["uploading"] = 1] = "uploading";
2058
565
  UploadStatus2[UploadStatus2["uploaded"] = 2] = "uploaded";
2059
566
  UploadStatus2[UploadStatus2["failed"] = 3] = "failed";
2060
- })(UploadStatus || (UploadStatus = {}));
567
+ return UploadStatus2;
568
+ })(UploadStatus || {});
2061
569
  const uploadProps = {
2062
- uploadOptions: {
2063
- type: Object,
2064
- required: true
570
+ accept: {
571
+ type: String
2065
572
  },
2066
- fileOptions: {
2067
- type: Object,
2068
- required: true
573
+ webkitdirectory: {
574
+ type: Boolean,
575
+ default: false
2069
576
  },
2070
- autoUpload: {
577
+ uploadOptions: {
578
+ type: Object
579
+ },
580
+ multiple: {
2071
581
  type: Boolean,
2072
582
  default: false
2073
583
  },
2074
- placeholderText: {
2075
- type: String,
2076
- default: "\u9009\u62E9\u6587\u4EF6"
584
+ autoUpload: {
585
+ type: Boolean,
586
+ default: true
2077
587
  },
2078
- uploadText: {
588
+ placeholder: {
2079
589
  type: String,
2080
- default: "\u4E0A\u4F20"
590
+ default: ""
2081
591
  },
2082
- uploadedFiles: {
592
+ modelValue: {
2083
593
  type: Array,
2084
594
  default: () => []
2085
595
  },
2086
- withoutBtn: {
2087
- type: Boolean,
2088
- default: false
2089
- },
2090
- enableDrop: {
596
+ droppable: {
2091
597
  type: Boolean,
2092
598
  default: false
2093
599
  },
@@ -2101,10 +607,6 @@ const uploadProps = {
2101
607
  type: Boolean,
2102
608
  default: false
2103
609
  },
2104
- showTip: {
2105
- type: Boolean,
2106
- default: false
2107
- },
2108
610
  onChange: {
2109
611
  type: Function
2110
612
  },
@@ -2120,96 +622,135 @@ const uploadProps = {
2120
622
  type: Function,
2121
623
  default: void 0
2122
624
  },
2123
- errorEvent: {
2124
- type: Function,
2125
- default: void 0
2126
- },
2127
- successEvent: {
625
+ deleteUploadedFile: {
2128
626
  type: Function,
2129
627
  default: void 0
2130
628
  },
2131
- deleteUploadedFileEvent: {
629
+ onError: {
2132
630
  type: Function,
2133
631
  default: void 0
2134
- }
2135
- };
2136
- const multiUploadProps = {
2137
- uploadOptions: {
2138
- type: Object,
2139
- required: true
2140
- },
2141
- fileOptions: {
2142
- type: Object,
2143
- required: true
2144
- },
2145
- autoUpload: {
2146
- type: Boolean,
2147
- default: false
2148
- },
2149
- withoutBtn: {
2150
- type: Boolean,
2151
- default: false
2152
- },
2153
- showTip: {
2154
- type: Boolean,
2155
- default: false
2156
- },
2157
- uploadedFiles: {
2158
- type: Array,
2159
- default: () => []
2160
- },
2161
- enableDrop: {
2162
- type: Boolean,
2163
- default: false
2164
- },
2165
- placeholderText: {
2166
- type: String,
2167
- default: "\u9009\u62E9\u6587\u4EF6"
2168
- },
2169
- uploadText: {
2170
- type: String,
2171
- default: "\u4E0A\u4F20"
2172
- },
2173
- oneTimeUpload: {
2174
- type: Boolean,
2175
- default: false
2176
- },
2177
- disabled: {
2178
- type: Boolean,
2179
- default: false
2180
632
  },
2181
- beforeUpload: {
2182
- type: Function
2183
- },
2184
- fileDrop: {
633
+ onSuccess: {
2185
634
  type: Function,
2186
635
  default: void 0
2187
636
  },
2188
- fileOver: {
637
+ onExceed: {
2189
638
  type: Function,
2190
639
  default: void 0
2191
640
  },
2192
- fileSelect: {
641
+ onProgress: {
2193
642
  type: Function,
2194
643
  default: void 0
2195
644
  },
2196
- errorEvent: {
645
+ onPreview: {
2197
646
  type: Function,
2198
647
  default: void 0
2199
648
  },
2200
- successEvent: {
2201
- type: Function,
2202
- default: void 0
649
+ oneTimeUpload: {
650
+ type: Boolean,
651
+ default: false
2203
652
  },
2204
- deleteUploadedFileEvent: {
2205
- type: Function,
2206
- default: void 0
653
+ limit: {
654
+ type: Number,
655
+ default: 0
2207
656
  },
2208
- setCustomUploadOptions: {
657
+ httpRequest: {
2209
658
  type: Function,
2210
659
  default: void 0
2211
660
  }
2212
661
  };
662
+ const useSelectFiles = (t) => {
663
+ const BEYOND_MAXIMAL_FILE_SIZE_MSG = ref("");
664
+ const simulateClickEvent = (input) => {
665
+ const evt = document.createEvent("MouseEvents");
666
+ evt.initMouseEvent("click", true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
667
+ input.dispatchEvent(evt);
668
+ };
669
+ const selectFiles = ({ multiple, accept, webkitdirectory }) => {
670
+ return new Promise((resolve) => {
671
+ const tempNode = document.getElementById("d-upload-temp");
672
+ if (tempNode) {
673
+ document.body.removeChild(tempNode);
674
+ }
675
+ const input = document.createElement("input");
676
+ input.style.position = "fixed";
677
+ input.style.left = "-2000px";
678
+ input.style.top = "-2000px";
679
+ input.setAttribute("id", "d-upload-temp");
680
+ input.setAttribute("type", "file");
681
+ if (multiple) {
682
+ input.setAttribute("multiple", "");
683
+ }
684
+ if (accept) {
685
+ input.setAttribute("accept", accept);
686
+ }
687
+ if (webkitdirectory) {
688
+ input.setAttribute("webkitdirectory", "");
689
+ }
690
+ input.addEventListener("change", (event) => {
691
+ resolve(Array.prototype.slice.call(event.target.files));
692
+ });
693
+ document.body.appendChild(input);
694
+ simulateClickEvent(input);
695
+ });
696
+ };
697
+ const isAllowedFileType = (accept, file) => {
698
+ if (accept) {
699
+ const acceptArr = accept.split(",");
700
+ const baseMimeType = file.type.replace(/\/.*$/, "");
701
+ return acceptArr.some((type) => {
702
+ const validType = type.trim();
703
+ if (validType.startsWith(".")) {
704
+ return file.name.toLowerCase().indexOf(validType.toLowerCase(), file.name.toLowerCase().length - validType.toLowerCase().length) > -1;
705
+ } else if (/\/\*$/.test(validType)) {
706
+ return baseMimeType === validType.replace(/\/.*$/, "");
707
+ }
708
+ return file.type === validType;
709
+ });
710
+ }
711
+ return true;
712
+ };
713
+ const beyondMaximalSize = (fileSize, maximumSize) => {
714
+ if (maximumSize) {
715
+ return fileSize > 1024 * 1024 * maximumSize;
716
+ }
717
+ return false;
718
+ };
719
+ const _validateFiles = (file, accept, uploadOptions) => {
720
+ if (!isAllowedFileType(accept, file)) {
721
+ return {
722
+ checkError: true,
723
+ errorMsg: t("getNotAllowedFileTypeMsg")(file.name, accept)
724
+ };
725
+ }
726
+ if (uploadOptions && beyondMaximalSize(file.size, uploadOptions.maximumSize)) {
727
+ return {
728
+ checkError: true,
729
+ errorMsg: t("getBeyondMaximalFileSizeMsg")(file.name, uploadOptions.maximumSize || 0)
730
+ };
731
+ }
732
+ return { checkError: false, errorMsg: void 0 };
733
+ };
734
+ const triggerSelectFiles = (fileOptions) => {
735
+ const { multiple, accept, webkitdirectory } = fileOptions;
736
+ return selectFiles({ multiple, accept, webkitdirectory });
737
+ };
738
+ const triggerDropFiles = (files) => {
739
+ return Promise.resolve(files);
740
+ };
741
+ const checkAllFilesSize = (fileSize, maximumSize) => {
742
+ if (beyondMaximalSize(fileSize, maximumSize)) {
743
+ BEYOND_MAXIMAL_FILE_SIZE_MSG.value = t("getAllFilesBeyondMaximalFileSizeMsg")(maximumSize);
744
+ return { checkError: true, errorMsg: BEYOND_MAXIMAL_FILE_SIZE_MSG.value };
745
+ }
746
+ };
747
+ return {
748
+ triggerSelectFiles,
749
+ _validateFiles,
750
+ triggerDropFiles,
751
+ checkAllFilesSize
752
+ };
753
+ };
2213
754
  class FileUploader {
2214
755
  constructor(file, uploadOptions) {
2215
756
  __publicField(this, "xhr");
@@ -2224,21 +765,11 @@ class FileUploader {
2224
765
  }
2225
766
  send(uploadFiles) {
2226
767
  return new Promise((resolve, reject) => {
2227
- const {
2228
- uri,
2229
- method,
2230
- headers,
2231
- authToken,
2232
- authTokenHeader,
2233
- additionalParameter,
2234
- fileFieldName,
2235
- withCredentials,
2236
- responseType
2237
- } = this.uploadOptions;
768
+ const { uri, method, headers, authToken, authTokenHeader, additionalParameter, fileFieldName, withCredentials, responseType } = this.uploadOptions || {};
2238
769
  const authTokenHeader_ = authTokenHeader || "Authorization";
2239
770
  const fileFieldName_ = fileFieldName || "file";
2240
771
  this.xhr = new XMLHttpRequest();
2241
- this.xhr.open(method || "POST", uri);
772
+ this.xhr.open(method || "POST", uri || "");
2242
773
  if (withCredentials) {
2243
774
  this.xhr.withCredentials = withCredentials;
2244
775
  }
@@ -2250,7 +781,8 @@ class FileUploader {
2250
781
  }
2251
782
  if (headers) {
2252
783
  Object.keys(headers).forEach((key) => {
2253
- this.xhr.setRequestHeader(key, headers[key]);
784
+ var _a;
785
+ (_a = this.xhr) == null ? void 0 : _a.setRequestHeader(key, headers[key]);
2254
786
  });
2255
787
  }
2256
788
  this.xhr.upload.onprogress = (e) => {
@@ -2264,19 +796,21 @@ class FileUploader {
2264
796
  this.xhr = null;
2265
797
  };
2266
798
  this.xhr.onerror = () => {
2267
- this.response = this.xhr.response;
799
+ var _a, _b;
800
+ this.response = (_a = this.xhr) == null ? void 0 : _a.response;
2268
801
  this.status = UploadStatus.failed;
2269
- reject({ file: this.file, response: this.xhr.response });
802
+ reject({ file: this.file, response: (_b = this.xhr) == null ? void 0 : _b.response });
2270
803
  };
2271
804
  this.xhr.onload = () => {
2272
- if (this.xhr.readyState === 4 && this.xhr.status >= 200 && this.xhr.status < 300) {
805
+ var _a, _b, _c;
806
+ if (((_a = this.xhr) == null ? void 0 : _a.readyState) === 4 && this.xhr.status >= 200 && this.xhr.status < 300) {
2273
807
  this.response = this.xhr.response;
2274
808
  this.status = UploadStatus.uploaded;
2275
809
  resolve({ file: this.file, response: this.xhr.response });
2276
810
  } else {
2277
- this.response = this.xhr.response;
811
+ this.response = (_b = this.xhr) == null ? void 0 : _b.response;
2278
812
  this.status = UploadStatus.failed;
2279
- reject({ file: this.file, response: this.xhr.response });
813
+ reject({ file: this.file, response: (_c = this.xhr) == null ? void 0 : _c.response });
2280
814
  }
2281
815
  };
2282
816
  });
@@ -2373,459 +907,246 @@ const useUpload = () => {
2373
907
  }));
2374
908
  }
2375
909
  if (uploads.length > 0) {
2376
- return Promise.resolve(uploads);
2377
- }
2378
- return Promise.reject("no files");
2379
- };
2380
- const _oneTimeUpload = () => {
2381
- const uploads = fileUploaders.value.filter((fileUploader) => fileUploader.status !== UploadStatus.uploaded);
2382
- return dealOneTimeUploadFiles(uploads);
2383
- };
2384
- const deleteFile = (file) => {
2385
- const deleteUploadFile = fileUploaders.value.find((fileUploader) => fileUploader.file === file);
2386
- deleteUploadFile.cancel();
2387
- fileUploaders.value = fileUploaders.value.filter((fileUploader) => {
2388
- return file !== fileUploader.file;
2389
- });
2390
- };
2391
- const removeFiles = () => {
2392
- fileUploaders.value = [];
2393
- filesWithSameName.value = [];
2394
- };
2395
- const getSameNameFiles = () => {
2396
- return filesWithSameName.value.join();
2397
- };
2398
- const resetSameNameFiles = () => {
2399
- filesWithSameName.value = [];
2400
- };
2401
- return {
2402
- fileUploaders,
2403
- getFiles,
2404
- addFile,
2405
- getFullFiles,
2406
- deleteFile,
2407
- upload: upload2,
2408
- removeFiles,
2409
- getSameNameFiles,
2410
- resetSameNameFiles,
2411
- _oneTimeUpload
2412
- };
2413
- };
2414
- const i18nText = {
2415
- warning: "\u63D0\u9192",
2416
- upload: "\u4E0A\u4F20",
2417
- chooseFile: "\u9009\u62E9\u6587\u4EF6",
2418
- chooseFiles: "\u9009\u62E9\u591A\u4E2A\u6587\u4EF6",
2419
- preload: "\u9884\u52A0\u8F7D",
2420
- uploading: "\u4E0A\u4F20\u4E2D...",
2421
- uploaded: "\u5DF2\u4E0A\u4F20",
2422
- uploadFailed: "\u4E0A\u4F20\u5931\u8D25",
2423
- uploadSuccess: "\u4E0A\u4F20\u6210\u529F!",
2424
- delete: "\u5220\u9664",
2425
- reUpload: "\u91CD\u65B0\u4E0A\u4F20",
2426
- cancelUpload: "\u53D6\u6D88\u4E0A\u4F20"
2427
- };
2428
- const getFailedFilesCount = (failedCount) => `${failedCount}\u4E2A\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25\uFF01`;
2429
- const getUploadingFilesCount = (uploadingCount, filesCount) => `${uploadingCount}/${filesCount}\u6B63\u5728\u4E0A\u4F20`;
2430
- const getSelectedFilesCount = (filesCount) => `\u5DF2\u6DFB\u52A0${filesCount}\u4E2A\u6587\u4EF6`;
2431
- const getAllFilesBeyondMaximalFileSizeMsg = (maximalSize) => `\u6700\u5927\u652F\u6301\u4E0A\u4F20${maximalSize}MB\u7684\u6587\u4EF6, \u60A8\u672C\u6B21\u4E0A\u4F20\u7684\u6240\u6709\u6587\u4EF6\u8D85\u8FC7\u53EF\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F`;
2432
- const getBeyondMaximalFileSizeMsg = (filename, maximalSize) => {
2433
- return `\u6700\u5927\u652F\u6301\u4E0A\u4F20${maximalSize}MB\u7684\u6587\u4EF6, \u60A8\u4E0A\u4F20\u7684\u6587\u4EF6"${filename}"\u8D85\u8FC7\u53EF\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F`;
2434
- };
2435
- const getNotAllowedFileTypeMsg = (filename, scope) => {
2436
- return `\u652F\u6301\u7684\u6587\u4EF6\u7C7B\u578B: "${scope}", \u60A8\u4E0A\u4F20\u7684\u6587\u4EF6"${filename}"\u4E0D\u5728\u5141\u8BB8\u8303\u56F4\u5185\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\u6587\u4EF6`;
2437
- };
2438
- const getExistSameNameFilesMsg = (sameNames) => {
2439
- return `\u60A8\u4E0A\u4F20\u7684 "${sameNames}" \u5B58\u5728\u91CD\u540D\u6587\u4EF6, \u8BF7\u91CD\u65B0\u9009\u62E9\u6587\u4EF6`;
2440
- };
2441
- const useSelectFiles = () => {
2442
- const BEYOND_MAXIMAL_FILE_SIZE_MSG = ref("");
2443
- const simulateClickEvent = (input) => {
2444
- const evt = document.createEvent("MouseEvents");
2445
- evt.initMouseEvent("click", true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
2446
- input.dispatchEvent(evt);
2447
- };
2448
- const selectFiles = ({
2449
- multiple,
2450
- accept,
2451
- webkitdirectory
2452
- }) => {
2453
- return new Promise((resolve) => {
2454
- const tempNode = document.getElementById("d-upload-temp");
2455
- if (tempNode) {
2456
- document.body.removeChild(tempNode);
2457
- }
2458
- const input = document.createElement("input");
2459
- input.style.position = "fixed";
2460
- input.style.left = "-2000px";
2461
- input.style.top = "-2000px";
2462
- input.setAttribute("id", "d-upload-temp");
2463
- input.setAttribute("type", "file");
2464
- if (multiple) {
2465
- input.setAttribute("multiple", "");
2466
- }
2467
- if (accept) {
2468
- input.setAttribute("accept", accept);
2469
- }
2470
- if (webkitdirectory) {
2471
- input.setAttribute("webkitdirectory", "");
2472
- }
2473
- input.addEventListener("change", (event) => {
2474
- resolve(Array.prototype.slice.call(event.target.files));
2475
- });
2476
- document.body.appendChild(input);
2477
- simulateClickEvent(input);
2478
- });
2479
- };
2480
- const isAllowedFileType = (accept, file) => {
2481
- if (accept) {
2482
- const acceptArr = accept.split(",");
2483
- const baseMimeType = file.type.replace(/\/.*$/, "");
2484
- return acceptArr.some((type) => {
2485
- const validType = type.trim();
2486
- if (validType.startsWith(".")) {
2487
- return file.name.toLowerCase().indexOf(validType.toLowerCase(), file.name.toLowerCase().length - validType.toLowerCase().length) > -1;
2488
- } else if (/\/\*$/.test(validType)) {
2489
- return baseMimeType === validType.replace(/\/.*$/, "");
2490
- }
2491
- return file.type === validType;
2492
- });
2493
- }
2494
- return true;
2495
- };
2496
- const beyondMaximalSize = (fileSize, maximumSize) => {
2497
- if (maximumSize) {
2498
- return fileSize > 1024 * 1024 * maximumSize;
2499
- }
2500
- return false;
2501
- };
2502
- const _validateFiles = (file, accept, uploadOptions) => {
2503
- if (!isAllowedFileType(accept, file)) {
2504
- return {
2505
- checkError: true,
2506
- errorMsg: getNotAllowedFileTypeMsg(file.name, accept)
2507
- };
2508
- }
2509
- if (uploadOptions && beyondMaximalSize(file.size, uploadOptions.maximumSize)) {
2510
- return {
2511
- checkError: true,
2512
- errorMsg: getBeyondMaximalFileSizeMsg(file.name, uploadOptions.maximumSize)
2513
- };
910
+ return Promise.resolve(uploads);
2514
911
  }
2515
- return { checkError: false, errorMsg: void 0 };
912
+ return Promise.reject("no files");
2516
913
  };
2517
- const triggerSelectFiles = (fileOptions) => {
2518
- const { multiple, accept, webkitdirectory } = fileOptions;
2519
- return selectFiles({ multiple, accept, webkitdirectory });
914
+ const _oneTimeUpload = () => {
915
+ const uploads = fileUploaders.value.filter((fileUploader) => fileUploader.status !== UploadStatus.uploaded);
916
+ return dealOneTimeUploadFiles(uploads);
2520
917
  };
2521
- const triggerDropFiles = (files) => {
2522
- return Promise.resolve(files);
918
+ const deleteFile = (file) => {
919
+ const deleteUploadFile = fileUploaders.value.find((fileUploader) => fileUploader.file === file);
920
+ deleteUploadFile == null ? void 0 : deleteUploadFile.cancel();
921
+ fileUploaders.value = fileUploaders.value.filter((fileUploader) => {
922
+ return file !== fileUploader.file;
923
+ });
2523
924
  };
2524
- const checkAllFilesSize = (fileSize, maximumSize) => {
2525
- if (beyondMaximalSize(fileSize, maximumSize)) {
2526
- BEYOND_MAXIMAL_FILE_SIZE_MSG.value = getAllFilesBeyondMaximalFileSizeMsg(maximumSize);
2527
- return { checkError: true, errorMsg: BEYOND_MAXIMAL_FILE_SIZE_MSG.value };
2528
- }
925
+ const removeFiles = () => {
926
+ fileUploaders.value = [];
927
+ filesWithSameName.value = [];
928
+ };
929
+ const getSameNameFiles = () => {
930
+ return filesWithSameName.value.join();
931
+ };
932
+ const resetSameNameFiles = () => {
933
+ filesWithSameName.value = [];
2529
934
  };
2530
935
  return {
2531
- triggerSelectFiles,
2532
- _validateFiles,
2533
- triggerDropFiles,
2534
- checkAllFilesSize
936
+ fileUploaders,
937
+ getFiles,
938
+ addFile,
939
+ getFullFiles,
940
+ deleteFile,
941
+ upload: upload2,
942
+ removeFiles,
943
+ getSameNameFiles,
944
+ resetSameNameFiles,
945
+ _oneTimeUpload
2535
946
  };
2536
947
  };
2537
948
  var upload = "";
2538
- var Upload = defineComponent({
2539
- name: "DSingleUpload",
2540
- props: uploadProps,
2541
- emits: ["fileDrop", "fileOver", "fileSelect", "successEvent", "errorEvent", "deleteUploadedFileEvent", "update:uploadedFiles"],
2542
- setup(props, ctx) {
2543
- const {
2544
- uploadOptions,
2545
- fileOptions,
2546
- placeholderText,
2547
- autoUpload,
2548
- withoutBtn,
2549
- uploadText,
2550
- disabled,
2551
- beforeUpload,
2552
- enableDrop,
2553
- showTip,
2554
- uploadedFiles
2555
- } = toRefs(props);
2556
- const isDropOVer = ref(false);
2557
- const {
2558
- getFiles,
2559
- fileUploaders,
2560
- addFile,
2561
- getFullFiles,
2562
- deleteFile,
2563
- upload: upload2,
2564
- removeFiles
2565
- } = useUpload();
2566
- const {
2567
- triggerSelectFiles,
2568
- _validateFiles,
2569
- triggerDropFiles
2570
- } = useSelectFiles();
2571
- const filename = computed(() => (getFiles()[0] || {}).name || "");
2572
- const alertMsg = (errorMsg) => {
2573
- ToastService.open({
2574
- value: [{
2575
- severity: "warn",
2576
- content: errorMsg
2577
- }]
2578
- });
2579
- };
2580
- const canUpload = () => {
2581
- let uploadResult = Promise.resolve(true);
2582
- if (beforeUpload.value) {
2583
- const result = beforeUpload.value(getFullFiles()[0] || {});
2584
- if (typeof result !== "undefined") {
2585
- if (result.then) {
2586
- uploadResult = result;
2587
- } else {
2588
- uploadResult = Promise.resolve(result);
2589
- }
2590
- }
2591
- }
2592
- return uploadResult;
2593
- };
2594
- const fileUpload = () => {
2595
- canUpload().then((canUpload2) => {
2596
- if (!canUpload2) {
2597
- return;
2598
- }
2599
- upload2().then((results) => {
2600
- ctx.emit("successEvent", results);
2601
- const newFiles = results.map((result) => result.file);
2602
- const newUploadedFiles = [...newFiles, ...uploadedFiles.value];
2603
- ctx.emit("update:uploadedFiles", newUploadedFiles);
2604
- }).catch((error) => {
2605
- console.error(error);
2606
- if (fileUploaders.value[0]) {
2607
- fileUploaders.value[0].percentage = 0;
2608
- }
2609
- ctx.emit("errorEvent", error);
2610
- });
2611
- });
2612
- };
2613
- const checkValid = () => {
2614
- fileUploaders.value.forEach((fileUploader) => {
2615
- const checkResult = _validateFiles(fileUploader.file, fileOptions.value.accept, fileUploader.uploadOptions);
2616
- if (checkResult.checkError) {
2617
- deleteFile(fileUploader.file);
2618
- alertMsg(checkResult.errorMsg);
2619
- }
2620
- });
2621
- };
2622
- const _dealFiles = (promise) => {
2623
- promise.then((files) => {
2624
- var _a;
2625
- files.forEach((file2) => {
2626
- removeFiles();
2627
- addFile(file2, uploadOptions.value);
2628
- });
2629
- checkValid();
2630
- const file = (_a = fileUploaders.value[0]) == null ? void 0 : _a.file;
2631
- if (props.onChange) {
2632
- props.onChange(file);
2633
- }
2634
- if (file) {
2635
- ctx.emit("fileSelect", file);
2636
- }
2637
- if (autoUpload.value) {
2638
- fileUpload();
2639
- }
2640
- }).catch((error) => {
2641
- alertMsg(error.message);
2642
- });
2643
- };
2644
- const handleClick = () => {
2645
- var _a;
2646
- if (disabled.value || fileUploaders.value[0] && ((_a = fileUploaders.value[0]) == null ? void 0 : _a.status) === UploadStatus.uploading) {
2647
- return;
949
+ function deepAssign(...objects) {
950
+ const isObject = (obj) => obj && typeof obj === "object";
951
+ return objects.reduce((prev, from) => {
952
+ Object.keys(from).forEach((key) => {
953
+ const pVal = prev[key];
954
+ const oVal = from[key];
955
+ if (Array.isArray(pVal) && Array.isArray(oVal)) {
956
+ prev[key] = Array.from(/* @__PURE__ */ new Set([...oVal, ...pVal]));
957
+ } else if (isObject(pVal) && isObject(oVal)) {
958
+ prev[key] = deepAssign(pVal, oVal);
959
+ } else {
960
+ prev[key] = oVal;
2648
961
  }
2649
- _dealFiles(triggerSelectFiles(fileOptions.value));
2650
- };
2651
- const onDeleteFile = (event) => {
2652
- event.stopPropagation();
2653
- const files = getFiles();
2654
- deleteFile(files[0]);
2655
- };
2656
- const deleteUploadedFile = (file) => {
2657
- const newUploadedFiles = uploadedFiles.value.filter((uploadedFile) => {
2658
- return uploadedFile.name !== file.name;
2659
- });
2660
- ctx.emit("deleteUploadedFileEvent", file);
2661
- ctx.emit("update:uploadedFiles", newUploadedFiles);
2662
- };
2663
- const onFileDrop = (files) => {
2664
- isDropOVer.value = false;
2665
- _dealFiles(triggerDropFiles(files));
2666
- ctx.emit("fileDrop", files[0]);
2667
- };
2668
- const onFileOver = (event) => {
2669
- isDropOVer.value = event;
2670
- ctx.emit("fileOver", event);
2671
- };
2672
- return {
2673
- placeholderText,
2674
- filename,
2675
- autoUpload,
2676
- withoutBtn,
2677
- fileUploaders,
2678
- uploadText,
2679
- handleClick,
2680
- onDeleteFile,
2681
- fileUpload,
2682
- enableDrop,
2683
- onFileDrop,
2684
- onFileOver,
2685
- isDropOVer,
2686
- showTip,
2687
- uploadedFiles,
2688
- deleteUploadedFile
2689
- };
962
+ });
963
+ return prev;
964
+ }, {});
965
+ }
966
+ var zhCN = {
967
+ pagination: {
968
+ totalItemText: "\u6240\u6709\u6761\u76EE",
969
+ goToText: "\u8DF3\u81F3"
2690
970
  },
2691
- render() {
2692
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
2693
- const {
2694
- placeholderText,
2695
- filename,
2696
- autoUpload,
2697
- withoutBtn,
2698
- fileUploaders,
2699
- uploadText,
2700
- handleClick,
2701
- onDeleteFile,
2702
- fileUpload,
2703
- enableDrop,
2704
- onFileDrop,
2705
- onFileOver,
2706
- isDropOVer,
2707
- disabled,
2708
- showTip,
2709
- uploadedFiles,
2710
- deleteUploadedFile
2711
- } = this;
2712
- return createVNode("div", null, [withDirectives(createVNode("div", {
2713
- "class": "devui-upload",
2714
- "style": `border: ${isDropOVer ? "1px solid #15bf15" : "0"}`
2715
- }, [((_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)) ? createVNode("div", {
2716
- "onClick": handleClick
2717
- }, [this.$slots.default()]) : createVNode("div", {
2718
- "class": `devui-input-group ${disabled || ((_c = fileUploaders[0]) == null ? void 0 : _c.status) === UploadStatus.uploading ? "disabled" : ""}`,
2719
- "onClick": handleClick
2720
- }, [createVNode("div", {
2721
- "class": "devui-form-control devui-files-list"
2722
- }, [!filename && createVNode("div", {
2723
- "class": "devui-file-item devui-upload-placeholder"
2724
- }, [placeholderText]), !!filename && createVNode("div", {
2725
- "class": "devui-file-tag devui-file-item",
2726
- "title": filename,
2727
- "style": "display: inline-block; margin: 0 2px 2px 0"
2728
- }, [createVNode("span", {
2729
- "class": `devui-filename ${((_d = fileUploaders[0]) == null ? void 0 : _d.status) === UploadStatus.failed ? "devui-failed-color" : ""}`
2730
- }, [filename]), createVNode(resolveComponent("d-icon"), {
2731
- "name": "close",
2732
- "class": `${((_e = fileUploaders[0]) == null ? void 0 : _e.status) === UploadStatus.failed ? "devui-upload-delete-file-button" : ""} ${((_f = fileUploaders[0]) == null ? void 0 : _f.status) === UploadStatus.uploading || ((_g = fileUploaders[0]) == null ? void 0 : _g.status) === UploadStatus.uploaded ? "devui-uploading-delete" : ""}`,
2733
- "onClick": (event) => onDeleteFile(event)
2734
- }, null), ((_h = fileUploaders[0]) == null ? void 0 : _h.status) === UploadStatus.uploading && createVNode("div", {
2735
- "class": "icon devui-upload-progress"
2736
- }, [createVNode(resolveComponent("d-progress"), {
2737
- "isCircle": true,
2738
- "percentage": fileUploaders[0].percentage,
2739
- "barbgcolor": "#50D4AB",
2740
- "strokeWidth": 8,
2741
- "showContent": false
2742
- }, null)]), fileUploaders[0].status === UploadStatus.failed && createVNode(resolveComponent("d-icon"), {
2743
- "name": "running",
2744
- "onClick": fileUpload
2745
- }, null), fileUploaders[0].status === UploadStatus.uploaded && createVNode(resolveComponent("d-icon"), {
2746
- "name": "right",
2747
- "color": "#50d4ab"
2748
- }, null)])]), createVNode("span", {
2749
- "class": "devui-input-group-addon"
2750
- }, [createVNode(resolveComponent("d-icon"), {
2751
- "name": "more-operate",
2752
- "color": "#252b3a"
2753
- }, null)])]), !autoUpload && !withoutBtn && createVNode(resolveComponent("d-button"), {
2754
- "style": "marginLeft: 8px",
2755
- "bsStyle": "common",
2756
- "onClick": fileUpload,
2757
- "disabled": disabled || ((_i = fileUploaders[0]) == null ? void 0 : _i.status) === UploadStatus.uploading
2758
- }, {
2759
- default: () => {
2760
- var _a2, _b2, _c2, _d2;
2761
- return [(!fileUploaders[0] || !((_a2 = fileUploaders[0]) == null ? void 0 : _a2.status)) && createVNode("span", null, [uploadText]), ((_b2 = fileUploaders[0]) == null ? void 0 : _b2.status) === UploadStatus.uploading && createVNode("span", null, [createTextVNode("\u4E0A\u4F20\u4E2D...")]), ((_c2 = fileUploaders[0]) == null ? void 0 : _c2.status) === UploadStatus.uploaded && createVNode("span", null, [createTextVNode("\u5DF2\u4E0A\u4F20")]), ((_d2 = fileUploaders[0]) == null ? void 0 : _d2.status) === UploadStatus.failed && createVNode("span", null, [createTextVNode("\u4E0A\u4F20\u5931\u8D25")])];
2762
- }
2763
- })]), [[resolveDirective("file-drop"), {
2764
- enableDrop,
2765
- isSingle: true,
2766
- onFileDrop,
2767
- onFileOver
2768
- }]]), showTip && createVNode("div", {
2769
- "class": "devui-upload-tip"
2770
- }, [((_j = fileUploaders[0]) == null ? void 0 : _j.status) === UploadStatus.uploading && createVNode("span", {
2771
- "class": "devui-loading"
2772
- }, [i18nText.uploading]), ((_k = fileUploaders[0]) == null ? void 0 : _k.status) === UploadStatus.uploaded && createVNode("div", {
2773
- "class": "devui-loaded"
2774
- }, [createVNode(resolveComponent("d-icon"), {
2775
- "name": "right-o",
2776
- "color": "#50d4ab"
2777
- }, null), createVNode("span", {
2778
- "style": "vertical-align: middle"
2779
- }, [i18nText.uploadSuccess])]), ((_l = fileUploaders[0]) == null ? void 0 : _l.status) === UploadStatus.failed && createVNode("div", {
2780
- "class": "devui-upload-failed"
2781
- }, [createVNode(resolveComponent("d-icon"), {
2782
- "name": "info-o",
2783
- "color": "#f66f6a"
2784
- }, null), createVNode("span", {
2785
- "style": "vertical-align: middle"
2786
- }, [createVNode("span", {
2787
- "style": "margin-right: 8px"
2788
- }, [i18nText.uploadFailed]), createVNode("a", {
2789
- "onClick": fileUpload
2790
- }, [i18nText.reUpload])])])]), createVNode("div", null, [(_n = (_m = this.$slots).preloadFiles) == null ? void 0 : _n.call(_m, {
2791
- fileUploaders,
2792
- deleteFile: onDeleteFile
2793
- })]), createVNode("div", null, [(_p = (_o = this.$slots).uploadedFiles) == null ? void 0 : _p.call(_o, {
2794
- uploadedFiles,
2795
- deleteFile: deleteUploadedFile
2796
- })])]);
971
+ accordion: {
972
+ loading: "\u52A0\u8F7D\u4E2D",
973
+ noData: "\u6CA1\u6709\u6570\u636E"
974
+ },
975
+ autoCompleteDropdown: {
976
+ latestInput: "\u6700\u8FD1\u8F93\u5165"
977
+ },
978
+ cascaderList: {
979
+ noData: "\u6CA1\u6709\u6570\u636E"
980
+ },
981
+ colorPicker: {
982
+ foundationPanel: "\u57FA\u7840\u9762\u677F",
983
+ advancedPanel: "\u9AD8\u7EA7\u9762\u677F"
984
+ },
985
+ datePickerPro: {
986
+ ok: "\u786E\u5B9A",
987
+ placeholder: "\u8BF7\u9009\u62E9\u65E5\u671F",
988
+ month1: "1\u6708",
989
+ month2: "2\u6708",
990
+ month3: "3\u6708",
991
+ month4: "4\u6708",
992
+ month5: "5\u6708",
993
+ month6: "6\u6708",
994
+ month7: "7\u6708",
995
+ month8: "8\u6708",
996
+ month9: "9\u6708",
997
+ month10: "10\u6708",
998
+ month11: "11\u6708",
999
+ month12: "12\u6708",
1000
+ year: "\u5E74",
1001
+ startPlaceholder: "\u8BF7\u9009\u62E9\u5F00\u59CB\u65E5\u671F",
1002
+ endPlaceholder: "\u8BF7\u9009\u62E9\u7ED3\u675F\u65E5\u671F",
1003
+ getWeekDays() {
1004
+ return ["\u65E5", "\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D"];
1005
+ },
1006
+ getTimeArr() {
1007
+ return ["\u65F6", "\u5206", "\u79D2"];
1008
+ },
1009
+ getYearMonthStr(year, month) {
1010
+ return `${year}\u5E74${month}\u6708`;
1011
+ }
1012
+ },
1013
+ editableSelect: {
1014
+ noRelatedRecords: "\u627E\u4E0D\u5230\u76F8\u5173\u8BB0\u5F55",
1015
+ noData: "\u6CA1\u6709\u6570\u636E"
1016
+ },
1017
+ input: {
1018
+ placeholder: "\u8BF7\u8F93\u5165"
1019
+ },
1020
+ splitterBar: {
1021
+ collapse: "\u6536\u8D77",
1022
+ expand: "\u5C55\u5F00"
1023
+ },
1024
+ stepsGuide: {
1025
+ previous: "\u4E0A\u4E00\u6B65",
1026
+ continue: "\u6211\u77E5\u9053\u5566\uFF0C\u7EE7\u7EED",
1027
+ ok: "\u6211\u77E5\u9053\u5566"
1028
+ },
1029
+ table: {
1030
+ selectAll: "\u5168\u9009",
1031
+ ok: "\u786E\u5B9A"
1032
+ },
1033
+ timePopup: {
1034
+ ok: "\u786E\u5B9A"
1035
+ },
1036
+ transfer: {
1037
+ unit: "\u9879",
1038
+ panelUnit: "\u9879",
1039
+ headerUnit: "\u9879",
1040
+ noData: "\u6682\u65E0\u6570\u636E",
1041
+ placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u8BCD\u641C\u7D22"
1042
+ },
1043
+ tree: {
1044
+ loading: "\u52A0\u8F7D\u4E2D",
1045
+ newNode: "\u65B0\u8282\u70B9",
1046
+ selectPlaceholder: "\u8BF7\u9009\u62E9"
1047
+ },
1048
+ upload: {
1049
+ placeholder: "\u9009\u62E9\u6587\u4EF6",
1050
+ getExistSameNameFilesMsg(sameNames) {
1051
+ return `\u60A8\u4E0A\u4F20\u7684 "${sameNames}" \u5B58\u5728\u91CD\u540D\u6587\u4EF6, \u8BF7\u91CD\u65B0\u9009\u62E9\u6587\u4EF6`;
1052
+ },
1053
+ getAllFilesBeyondMaximalFileSizeMsg(maximalSize) {
1054
+ return `\u6700\u5927\u652F\u6301\u4E0A\u4F20${maximalSize}MB\u7684\u6587\u4EF6, \u60A8\u672C\u6B21\u4E0A\u4F20\u7684\u6240\u6709\u6587\u4EF6\u8D85\u8FC7\u53EF\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F`;
1055
+ },
1056
+ getBeyondMaximalFileSizeMsg(filename, maximalSize) {
1057
+ return `\u6700\u5927\u652F\u6301\u4E0A\u4F20${maximalSize}MB\u7684\u6587\u4EF6, \u60A8\u4E0A\u4F20\u7684\u6587\u4EF6"${filename}"\u8D85\u8FC7\u53EF\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F`;
1058
+ },
1059
+ getNotAllowedFileTypeMsg(filename, scope) {
1060
+ return `\u652F\u6301\u7684\u6587\u4EF6\u7C7B\u578B: "${scope}", \u60A8\u4E0A\u4F20\u7684\u6587\u4EF6"${filename}"\u4E0D\u5728\u5141\u8BB8\u8303\u56F4\u5185\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\u6587\u4EF6`;
1061
+ }
1062
+ },
1063
+ search: {
1064
+ placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u5B57"
1065
+ },
1066
+ select: {
1067
+ placeholder: "\u8BF7\u9009\u62E9",
1068
+ noDataText: "\u65E0\u6570\u636E",
1069
+ noMatchText: "\u627E\u4E0D\u5230\u76F8\u5173\u8BB0\u5F55",
1070
+ loadingText: "\u52A0\u8F7D\u4E2D..."
1071
+ },
1072
+ tagInput: {
1073
+ maxTagsText: "\u5DF2\u8FBE\u5230\u6700\u5927\u4E2A\u6570\uFF1A"
1074
+ },
1075
+ timeSelect: {
1076
+ placeholder: "\u8BF7\u9009\u62E9\u65F6\u95F4"
2797
1077
  }
1078
+ };
1079
+ const lang = ref("zh-CN");
1080
+ let langMessages = reactive({
1081
+ [lang.value]: zhCN
2798
1082
  });
2799
- function _isSlot(s) {
2800
- return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
1083
+ const Locale = {
1084
+ messages() {
1085
+ return langMessages[lang.value];
1086
+ },
1087
+ lang() {
1088
+ return lang.value;
1089
+ },
1090
+ use(newLang, newMessages) {
1091
+ lang.value = newLang;
1092
+ this.add({ [newLang]: newMessages });
1093
+ },
1094
+ add(newMessages = {}) {
1095
+ langMessages = deepAssign(langMessages, newMessages);
1096
+ }
1097
+ };
1098
+ const camelize = (name) => name.substring(1).replace(/^\S/, (s) => s.toLocaleLowerCase());
1099
+ function get(object, path) {
1100
+ const keys = path.split(".");
1101
+ let result = object;
1102
+ keys.forEach((key) => {
1103
+ var _a;
1104
+ result = (_a = result[key]) != null ? _a : "";
1105
+ });
1106
+ return result;
1107
+ }
1108
+ function createI18nTranslate(name, app, newPrefix) {
1109
+ const prefix = newPrefix || camelize(name) + ".";
1110
+ return (path) => {
1111
+ var _a;
1112
+ const messages = ((_a = app == null ? void 0 : app.appContext.config.globalProperties.langMessages) == null ? void 0 : _a.value) || Locale.messages();
1113
+ const message = get(messages, prefix + path) || get(messages, path);
1114
+ return message;
1115
+ };
2801
1116
  }
2802
- var MultiUpload = defineComponent({
2803
- name: "DMultipleUpload",
2804
- props: multiUploadProps,
2805
- emits: ["fileDrop", "fileOver", "fileSelect", "successEvent", "errorEvent", "deleteUploadedFileEvent", "update:uploadedFiles"],
1117
+ var Upload = defineComponent({
1118
+ name: "DUpload",
1119
+ props: uploadProps,
1120
+ emits: ["fileDrop", "fileOver", "fileSelect", "deleteUploadedFile", "update:modelValue"],
2806
1121
  setup(props, ctx) {
1122
+ const app = getCurrentInstance();
1123
+ const t = createI18nTranslate("DUpload", app);
2807
1124
  const {
2808
1125
  uploadOptions,
2809
- fileOptions,
2810
- placeholderText,
1126
+ placeholder,
2811
1127
  autoUpload,
2812
- withoutBtn,
2813
- uploadText,
2814
1128
  disabled,
2815
1129
  beforeUpload,
2816
- enableDrop,
1130
+ droppable,
2817
1131
  oneTimeUpload,
2818
- showTip,
2819
- uploadedFiles
1132
+ modelValue,
1133
+ multiple,
1134
+ accept,
1135
+ webkitdirectory,
1136
+ limit,
1137
+ httpRequest
2820
1138
  } = toRefs(props);
1139
+ const ns2 = useNamespace("upload");
1140
+ const inputGroupNs = useNamespace("input-group");
1141
+ const formControlNs = useNamespace("form-control");
1142
+ const inputGroupAddOnNs = useNamespace("input-group-addon");
2821
1143
  const {
2822
1144
  triggerSelectFiles,
2823
1145
  _validateFiles,
2824
1146
  triggerDropFiles,
2825
1147
  checkAllFilesSize
2826
- } = useSelectFiles();
1148
+ } = useSelectFiles(t);
2827
1149
  const {
2828
- getFiles,
2829
1150
  fileUploaders,
2830
1151
  addFile,
2831
1152
  getFullFiles,
@@ -2836,21 +1157,20 @@ var MultiUpload = defineComponent({
2836
1157
  _oneTimeUpload,
2837
1158
  getSameNameFiles
2838
1159
  } = useUpload();
2839
- const isDropOVer = ref(false);
2840
- const uploadTips = ref("");
1160
+ const isDropOver = ref(false);
1161
+ const selectedFiles = ref([]);
2841
1162
  const alertMsg = (errorMsg) => {
2842
- ToastService.open({
2843
- value: [{
2844
- severity: "warn",
2845
- content: errorMsg
2846
- }]
1163
+ NotificationService.open({
1164
+ type: "warning",
1165
+ content: errorMsg
2847
1166
  });
2848
1167
  };
2849
1168
  const checkValid = () => {
1169
+ var _a;
2850
1170
  let totalFileSize = 0;
2851
1171
  fileUploaders.value.forEach((fileUploader) => {
2852
1172
  totalFileSize += fileUploader.file.size;
2853
- const checkResult = _validateFiles(fileUploader.file, fileOptions.value.accept, fileUploader.uploadOptions);
1173
+ const checkResult = _validateFiles(fileUploader.file, (accept == null ? void 0 : accept.value) || "", fileUploader.uploadOptions);
2854
1174
  if (checkResult && checkResult.checkError) {
2855
1175
  deleteFile(fileUploader.file);
2856
1176
  alertMsg(checkResult.errorMsg);
@@ -2858,68 +1178,40 @@ var MultiUpload = defineComponent({
2858
1178
  }
2859
1179
  });
2860
1180
  if (oneTimeUpload.value) {
2861
- const checkResult = checkAllFilesSize(totalFileSize, uploadOptions.value.maximumSize);
1181
+ const checkResult = checkAllFilesSize(totalFileSize, ((_a = uploadOptions == null ? void 0 : uploadOptions.value) == null ? void 0 : _a.maximumSize) || 0);
2862
1182
  if (checkResult && checkResult.checkError) {
2863
1183
  removeFiles();
2864
1184
  alertMsg(checkResult.errorMsg);
2865
1185
  }
2866
1186
  }
2867
1187
  };
2868
- const _dealFiles = (promise) => {
2869
- resetSameNameFiles();
2870
- promise.then((files) => {
2871
- files.forEach((file) => {
2872
- addFile(file, uploadOptions.value);
2873
- });
2874
- checkValid();
2875
- const sameNameFiles = getSameNameFiles();
2876
- if (uploadOptions.value.checkSameName && sameNameFiles.length) {
2877
- alertMsg(getExistSameNameFilesMsg(sameNameFiles));
2878
- }
2879
- const selectedFiles = fileUploaders.value.filter((fileUploader) => fileUploader.status === UploadStatus.preLoad).map((fileUploader) => fileUploader.file);
2880
- ctx.emit("fileSelect", selectedFiles);
2881
- if (autoUpload.value) {
2882
- upload2();
2883
- }
2884
- }).catch((error) => {
2885
- alertMsg(error.message);
2886
- });
2887
- };
2888
- const handleClick = () => {
2889
- if (disabled.value) {
2890
- return;
2891
- }
2892
- _dealFiles(triggerSelectFiles(fileOptions.value));
2893
- };
2894
- const onFileDrop = (files) => {
2895
- isDropOVer.value = false;
2896
- _dealFiles(triggerDropFiles(files));
2897
- ctx.emit("fileDrop", files);
2898
- };
2899
1188
  const onFileOver = (event) => {
2900
- isDropOVer.value = event;
1189
+ isDropOver.value = event;
2901
1190
  ctx.emit("fileOver", event);
2902
1191
  };
2903
- const onDeleteFile = (event, file) => {
2904
- event.stopPropagation();
2905
- deleteFile(file);
2906
- };
2907
1192
  const deleteUploadedFile = (file) => {
2908
- const newUploadedFiles = uploadedFiles.value.filter((uploadedFile) => {
1193
+ const newUploadedFiles = modelValue.value.filter((uploadedFile) => {
2909
1194
  return uploadedFile.name !== file.name;
2910
1195
  });
2911
- ctx.emit("deleteUploadedFileEvent", file);
2912
- ctx.emit("update:uploadedFiles", newUploadedFiles);
1196
+ ctx.emit("deleteUploadedFile", file);
1197
+ ctx.emit("update:modelValue", newUploadedFiles);
1198
+ };
1199
+ const onDeleteFile = (event, file, status) => {
1200
+ event == null ? void 0 : event.stopPropagation();
1201
+ if (status === UploadStatus.uploaded) {
1202
+ deleteUploadedFile(file);
1203
+ }
1204
+ deleteFile(file);
2913
1205
  };
2914
1206
  const canUpload = () => {
2915
1207
  let uploadResult = Promise.resolve(true);
2916
- if (beforeUpload.value) {
2917
- const result = beforeUpload.value(getFullFiles());
1208
+ if (beforeUpload == null ? void 0 : beforeUpload.value) {
1209
+ const result = beforeUpload == null ? void 0 : beforeUpload.value(getFullFiles());
2918
1210
  if (typeof result !== "undefined") {
2919
- if (result.then) {
2920
- uploadResult = result;
2921
- } else {
1211
+ if (typeof result === "boolean") {
2922
1212
  uploadResult = Promise.resolve(result);
1213
+ } else {
1214
+ uploadResult = result;
2923
1215
  }
2924
1216
  }
2925
1217
  }
@@ -2934,165 +1226,139 @@ var MultiUpload = defineComponent({
2934
1226
  removeFiles();
2935
1227
  return;
2936
1228
  }
1229
+ if (typeof (httpRequest == null ? void 0 : httpRequest.value) === "function") {
1230
+ const files = fileUploaders.value.map((tempFileUploader) => tempFileUploader.file);
1231
+ httpRequest.value(files);
1232
+ return;
1233
+ }
2937
1234
  const uploadObservable = oneTimeUpload.value ? _oneTimeUpload() : upload2(fileUploader);
2938
- uploadObservable.then((results) => {
2939
- ctx.emit("successEvent", results);
1235
+ props.onProgress && props.onProgress(selectedFiles.value, modelValue.value);
1236
+ uploadObservable == null ? void 0 : uploadObservable.then((results) => {
1237
+ props.onSuccess && props.onSuccess(results);
2940
1238
  const newFiles = results.map((result) => result.file);
2941
- const newUploadedFiles = [...newFiles, ...uploadedFiles.value];
2942
- ctx.emit("update:uploadedFiles", newUploadedFiles);
1239
+ const newUploadedFiles = [...newFiles, ...modelValue.value];
1240
+ ctx.emit("update:modelValue", newUploadedFiles);
1241
+ props.onChange && props.onChange(newFiles, newUploadedFiles);
2943
1242
  }).catch((error) => {
2944
- ctx.emit("errorEvent", error);
1243
+ props.onError && props.onError(error);
1244
+ props.onChange && props.onChange([error.file], modelValue.value);
2945
1245
  });
2946
1246
  });
2947
1247
  };
2948
- const getStatus = () => {
2949
- let uploadingCount = 0;
2950
- let uploadedCount = 0;
2951
- let failedCount = 0;
2952
- const filesCount = fileUploaders.value.length;
2953
- fileUploaders.value.forEach((fileUploader) => {
2954
- if (fileUploader.status === UploadStatus.uploading) {
2955
- uploadingCount++;
2956
- } else if (fileUploader.status === UploadStatus.uploaded) {
2957
- uploadedCount++;
2958
- } else if (fileUploader.status === UploadStatus.failed) {
2959
- failedCount++;
1248
+ const _dealFiles = (promise) => {
1249
+ resetSameNameFiles();
1250
+ promise.then((files) => {
1251
+ if (limit.value && modelValue.value.length + files.length > limit.value) {
1252
+ props.onExceed && props.onExceed(files, modelValue.value);
1253
+ return;
1254
+ }
1255
+ props.onChange && props.onChange(files, modelValue.value);
1256
+ files.forEach((file) => {
1257
+ if (!multiple.value) {
1258
+ removeFiles();
1259
+ }
1260
+ addFile(file, uploadOptions == null ? void 0 : uploadOptions.value);
1261
+ });
1262
+ checkValid();
1263
+ const sameNameFiles = getSameNameFiles();
1264
+ if ((uploadOptions == null ? void 0 : uploadOptions.value) && uploadOptions.value.checkSameName && sameNameFiles.length) {
1265
+ alertMsg(t("getExistSameNameFilesMsg")(sameNameFiles));
2960
1266
  }
1267
+ selectedFiles.value = fileUploaders.value.filter((fileUploader) => fileUploader.status === UploadStatus.preLoad).map((fileUploader) => fileUploader.file);
1268
+ ctx.emit("fileSelect", selectedFiles.value);
1269
+ if (autoUpload.value) {
1270
+ fileUpload();
1271
+ }
1272
+ }).catch((error) => {
1273
+ alertMsg(error.message);
2961
1274
  });
2962
- if (failedCount > 0) {
2963
- uploadTips.value = getFailedFilesCount(failedCount);
2964
- return "failed";
2965
- }
2966
- if (uploadingCount > 0) {
2967
- uploadTips.value = getUploadingFilesCount(uploadingCount, filesCount);
2968
- return "uploading";
2969
- }
2970
- if (uploadedCount === filesCount && uploadedCount !== 0) {
2971
- return "uploaded";
2972
- }
2973
- if (filesCount !== 0) {
2974
- uploadTips.value = getSelectedFilesCount(filesCount);
2975
- return "selected";
1275
+ };
1276
+ const handleClick = () => {
1277
+ if (disabled.value) {
1278
+ return;
2976
1279
  }
1280
+ _dealFiles(triggerSelectFiles({
1281
+ accept: accept == null ? void 0 : accept.value,
1282
+ multiple: multiple.value,
1283
+ webkitdirectory: webkitdirectory.value
1284
+ }));
2977
1285
  };
2978
- const cancelUpload = () => {
2979
- fileUploaders.value = fileUploaders.value.map((fileUploader) => {
2980
- if (fileUploader.status === UploadStatus.uploading) {
2981
- fileUploader.cancel();
2982
- fileUploader.status = UploadStatus.failed;
2983
- }
2984
- return fileUploader;
1286
+ const onFileDrop = (files) => {
1287
+ isDropOver.value = false;
1288
+ _dealFiles(triggerDropFiles(files));
1289
+ ctx.emit("fileDrop", files);
1290
+ };
1291
+ const submit = (event, fileUploader) => {
1292
+ fileUpload(event, fileUploader);
1293
+ };
1294
+ const clearFiles = (event) => {
1295
+ fileUploaders.value.forEach((fileUploader) => {
1296
+ onDeleteFile(event, fileUploader.file, fileUploader.status);
2985
1297
  });
2986
1298
  };
2987
- return {
2988
- uploadOptions,
2989
- fileOptions,
2990
- placeholderText,
2991
- autoUpload,
2992
- withoutBtn,
2993
- uploadText,
2994
- disabled,
2995
- beforeUpload,
2996
- enableDrop,
2997
- isDropOVer,
2998
- onFileDrop,
2999
- onFileOver,
3000
- handleClick,
3001
- fileUploaders,
3002
- onDeleteFile,
3003
- fileUpload,
3004
- showTip,
3005
- getStatus,
3006
- uploadTips,
3007
- cancelUpload,
3008
- deleteUploadedFile
1299
+ const clickSelectedFile = (event, file) => {
1300
+ event == null ? void 0 : event.stopPropagation();
1301
+ props.onPreview && props.onPreview(file);
1302
+ };
1303
+ ctx.expose({
1304
+ submit,
1305
+ clearFiles
1306
+ });
1307
+ return () => {
1308
+ var _a, _b, _c, _d;
1309
+ return createVNode("div", null, [withDirectives(createVNode("div", {
1310
+ "class": ns2.b(),
1311
+ "style": `border: ${isDropOver.value ? "1px solid #15bf15" : "0"}`
1312
+ }, [((_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)) ? createVNode("div", {
1313
+ "onClick": handleClick
1314
+ }, [ctx.slots.default()]) : createVNode("div", {
1315
+ "class": [inputGroupNs.b(), disabled.value ? "disabled" : ""],
1316
+ "onClick": handleClick
1317
+ }, [fileUploaders.value.length === 0 && createVNode("div", {
1318
+ "class": [formControlNs.b(), ns2.e("placeholder")]
1319
+ }, [placeholder.value || t("placeholder")]), fileUploaders.value.length > 0 && createVNode("ul", {
1320
+ "class": [formControlNs.b(), ns2.e("files-list")]
1321
+ }, [fileUploaders.value.map((fileUploader, index2) => createVNode("li", {
1322
+ "key": index2,
1323
+ "class": [ns2.e("file-item"), ns2.e("file-tag")],
1324
+ "style": "display: inline-block;",
1325
+ "title": fileUploader.file.name,
1326
+ "onClick": (event) => clickSelectedFile(event, fileUploader.file)
1327
+ }, [createVNode("span", {
1328
+ "class": [ns2.e("filename"), fileUploader.status === UploadStatus.failed ? ns2.m("failed-color") : ""]
1329
+ }, [fileUploader.file.name]), createVNode(resolveComponent("d-icon"), {
1330
+ "name": "close",
1331
+ "class": [(fileUploader == null ? void 0 : fileUploader.status) === UploadStatus.failed ? ns2.e("delete-file-button") : "", (fileUploader == null ? void 0 : fileUploader.status) === UploadStatus.uploading || (fileUploader == null ? void 0 : fileUploader.status) === UploadStatus.uploaded ? ns2.e("delete") : ""],
1332
+ "onClick": (event) => onDeleteFile(event, fileUploader.file, fileUploader.status)
1333
+ }, null), fileUploader.status === UploadStatus.uploading && createVNode("div", {
1334
+ "class": ["icon", ns2.e("progress")]
1335
+ }, [createVNode(resolveComponent("d-progress"), {
1336
+ "isCircle": true,
1337
+ "percentage": fileUploader.percentage,
1338
+ "barbgcolor": "#50D4AB",
1339
+ "strokeWidth": 8,
1340
+ "showContent": false
1341
+ }, null)]), fileUploader.status === UploadStatus.failed && createVNode(resolveComponent("d-icon"), {
1342
+ "name": "running",
1343
+ "onClick": fileUpload
1344
+ }, null), fileUploader.status === UploadStatus.uploaded && createVNode(resolveComponent("d-icon"), {
1345
+ "name": "right",
1346
+ "color": "#50d4ab"
1347
+ }, null)]))]), createVNode("span", {
1348
+ "class": inputGroupAddOnNs.b()
1349
+ }, [createVNode(resolveComponent("d-icon"), {
1350
+ "name": "more-operate",
1351
+ "color": "#252b3a"
1352
+ }, null)])])]), [[resolveDirective("file-drop"), {
1353
+ droppable,
1354
+ isSingle: !multiple,
1355
+ onFileDrop,
1356
+ onFileOver
1357
+ }]]), createVNode("div", null, [(_d = (_c = ctx.slots)["uploaded-files"]) == null ? void 0 : _d.call(_c, {
1358
+ uploadedFiles: modelValue.value,
1359
+ deleteFile: deleteUploadedFile
1360
+ })])]);
3009
1361
  };
3010
- },
3011
- render() {
3012
- var _a, _b, _c, _d, _e, _f;
3013
- const {
3014
- placeholderText,
3015
- autoUpload,
3016
- withoutBtn,
3017
- uploadText,
3018
- disabled,
3019
- beforeUpload,
3020
- enableDrop,
3021
- isDropOVer,
3022
- onFileDrop,
3023
- onFileOver,
3024
- handleClick,
3025
- fileUploaders,
3026
- onDeleteFile,
3027
- fileUpload,
3028
- showTip,
3029
- getStatus,
3030
- uploadTips,
3031
- cancelUpload,
3032
- uploadedFiles,
3033
- deleteUploadedFile
3034
- } = this;
3035
- return createVNode(Fragment, null, [withDirectives(createVNode("div", {
3036
- "class": "devui-upload",
3037
- "style": `border: ${isDropOVer ? "1px solid #15bf15" : "0"}`
3038
- }, [((_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)) ? createVNode("div", {
3039
- "onClick": handleClick
3040
- }, [this.$slots.default()]) : createVNode("div", {
3041
- "class": `devui-input-group ${disabled ? "disabled" : ""}`,
3042
- "onClick": handleClick
3043
- }, [fileUploaders.length === 0 && createVNode("div", {
3044
- "class": "devui-form-control devui-upload-placeholder"
3045
- }, [placeholderText]), fileUploaders.length > 0 && createVNode("ul", {
3046
- "class": "devui-form-control devui-files-list"
3047
- }, [fileUploaders.map((fileUploader, index2) => createVNode("li", {
3048
- "key": index2,
3049
- "class": "devui-file-item devui-file-tag",
3050
- "style": "display: inline-block; margin: 0 2px 2px 0",
3051
- "title": fileUploader.file.name
3052
- }, [createVNode("span", {
3053
- "class": `evui-filename ${fileUploader.status === UploadStatus.failed ? "devui-failed-color" : ""}`
3054
- }, [fileUploader.file.name]), createVNode(resolveComponent("d-icon"), {
3055
- "name": "close",
3056
- "class": `${(fileUploader == null ? void 0 : fileUploader.status) === UploadStatus.failed ? "devui-upload-delete-file-button" : ""} ${(fileUploader == null ? void 0 : fileUploader.status) === UploadStatus.uploading || (fileUploader == null ? void 0 : fileUploader.status) === UploadStatus.uploaded ? "devui-uploading-delete" : ""}`,
3057
- "onClick": (event) => onDeleteFile(event, fileUploader.file)
3058
- }, null), fileUploader.status === UploadStatus.uploading && createVNode("div", {
3059
- "class": "icon devui-upload-progress"
3060
- }, [createVNode(resolveComponent("d-progress"), {
3061
- "isCircle": true,
3062
- "percentage": fileUploader.percentage,
3063
- "barbgcolor": "#50D4AB",
3064
- "strokeWidth": 8,
3065
- "showContent": false
3066
- }, null)]), fileUploader.status === UploadStatus.failed && createVNode(resolveComponent("d-icon"), {
3067
- "name": "running",
3068
- "onClick": fileUpload
3069
- }, null), fileUploader.status === UploadStatus.uploaded && createVNode(resolveComponent("d-icon"), {
3070
- "name": "right",
3071
- "color": "#50d4ab"
3072
- }, null)]))]), createVNode("span", {
3073
- "class": "devui-input-group-addon"
3074
- }, [createVNode(resolveComponent("d-icon"), {
3075
- "name": "more-operate",
3076
- "color": "#252b3a"
3077
- }, null)])]), !autoUpload && !withoutBtn && createVNode(resolveComponent("d-button"), {
3078
- "style": "marginLeft: 8px",
3079
- "bsStyle": "common",
3080
- "disabled": disabled,
3081
- "onClick": fileUpload
3082
- }, _isSlot(uploadText) ? uploadText : {
3083
- default: () => [uploadText]
3084
- })]), [[resolveDirective("file-drop"), {
3085
- enableDrop,
3086
- isSingle: false,
3087
- onFileDrop,
3088
- onFileOver
3089
- }]]), createVNode("div", null, [(_d = (_c = this.$slots).preloadFiles) == null ? void 0 : _d.call(_c, {
3090
- fileUploaders,
3091
- deleteFile: onDeleteFile
3092
- })]), createVNode("div", null, [(_f = (_e = this.$slots).uploadedFiles) == null ? void 0 : _f.call(_e, {
3093
- uploadedFiles,
3094
- deleteFile: deleteUploadedFile
3095
- })])]);
3096
1362
  }
3097
1363
  });
3098
1364
  const getTransfer = (event) => {
@@ -3147,14 +1413,14 @@ const onDrop = (el, binding) => {
3147
1413
  if (isSingle) {
3148
1414
  onFileDrop && onFileDrop([transfer.files[0]]);
3149
1415
  } else {
3150
- onFileDrop && onFileDrop(transfer.files);
1416
+ onFileDrop && onFileDrop(Array.from(transfer.files));
3151
1417
  }
3152
1418
  });
3153
1419
  };
3154
1420
  const fileDropDirective = {
3155
1421
  mounted: (el, binding) => {
3156
- const { enableDrop } = binding.value;
3157
- if (!enableDrop) {
1422
+ const { droppable } = binding.value;
1423
+ if (!droppable) {
3158
1424
  return;
3159
1425
  }
3160
1426
  onDragOver(el, binding);
@@ -3162,17 +1428,13 @@ const fileDropDirective = {
3162
1428
  onDrop(el, binding);
3163
1429
  }
3164
1430
  };
3165
- Upload.install = function(app) {
3166
- app.directive("file-drop", fileDropDirective);
3167
- app.component(Upload.name, Upload);
3168
- app.component(MultiUpload.name, MultiUpload);
3169
- };
3170
1431
  var index = {
3171
1432
  title: "Upload \u4E0A\u4F20",
3172
1433
  category: "\u6570\u636E\u5F55\u5165",
3173
- status: "80%",
1434
+ status: "100%",
3174
1435
  install(app) {
3175
- app.use(Upload);
1436
+ app.directive("file-drop", fileDropDirective);
1437
+ app.component(Upload.name, Upload);
3176
1438
  }
3177
1439
  };
3178
- export { MultiUpload, Upload, index as default };
1440
+ export { IFileOptions, IUploadOptions, Upload, UploadStatus, index as default, uploadProps };