vue-devui 1.0.0-beta.9 → 1.0.0-rc.1

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 (294) hide show
  1. package/README.md +100 -72
  2. package/accordion/index.es.js +525 -39
  3. package/accordion/index.umd.js +1 -1
  4. package/accordion/style.css +1 -1
  5. package/alert/index.es.js +34 -37
  6. package/alert/index.umd.js +1 -1
  7. package/alert/style.css +1 -1
  8. package/{time-axis → auto-complete}/index.d.ts +0 -0
  9. package/auto-complete/index.es.js +983 -0
  10. package/auto-complete/index.umd.js +1 -0
  11. package/auto-complete/package.json +7 -0
  12. package/auto-complete/style.css +1 -0
  13. package/back-top/index.es.js +5 -3
  14. package/back-top/index.umd.js +1 -1
  15. package/badge/index.es.js +13 -19
  16. package/badge/index.umd.js +1 -1
  17. package/badge/style.css +1 -1
  18. package/breadcrumb/index.es.js +2 -1
  19. package/button/index.es.js +296 -117
  20. package/button/index.umd.js +1 -1
  21. package/button/style.css +1 -1
  22. package/carousel/index.es.js +43 -57
  23. package/carousel/index.umd.js +1 -1
  24. package/cascader/index.es.js +5412 -784
  25. package/cascader/index.umd.js +27 -1
  26. package/cascader/style.css +1 -1
  27. package/checkbox/style.css +1 -1
  28. package/{toast → color-picker}/index.d.ts +0 -0
  29. package/color-picker/index.es.js +8196 -0
  30. package/color-picker/index.umd.js +27 -0
  31. package/color-picker/package.json +7 -0
  32. package/color-picker/style.css +1 -0
  33. package/comment/index.es.js +42 -13
  34. package/comment/index.umd.js +1 -1
  35. package/comment/style.css +1 -1
  36. package/countdown/index.es.js +27 -17
  37. package/countdown/index.umd.js +1 -1
  38. package/countdown/style.css +1 -1
  39. package/date-picker/index.es.js +48 -66
  40. package/date-picker/index.umd.js +1 -1
  41. package/date-picker/style.css +1 -1
  42. package/dragdrop/index.es.js +135 -10
  43. package/dragdrop/index.umd.js +1 -1
  44. package/drawer/index.es.js +169 -223
  45. package/drawer/index.umd.js +1 -1
  46. package/drawer/style.css +1 -1
  47. package/dropdown/index.es.js +463 -300
  48. package/dropdown/index.umd.js +1 -1
  49. package/dropdown/style.css +1 -1
  50. package/editable-select/index.es.js +293 -5660
  51. package/editable-select/index.umd.js +1 -27
  52. package/editable-select/style.css +1 -1
  53. package/form/index.es.js +6210 -531
  54. package/form/index.umd.js +27 -1
  55. package/form/style.css +1 -1
  56. package/fullscreen/index.es.js +112 -133
  57. package/fullscreen/index.umd.js +1 -1
  58. package/fullscreen/style.css +1 -1
  59. package/gantt/index.es.js +6 -18
  60. package/gantt/index.umd.js +1 -1
  61. package/gantt/style.css +1 -1
  62. package/grid/index.es.js +1 -1
  63. package/grid/style.css +1 -1
  64. package/icon/index.es.js +39 -56
  65. package/icon/index.umd.js +1 -1
  66. package/image-preview/index.es.js +35 -16
  67. package/image-preview/index.umd.js +1 -1
  68. package/input/index.es.js +4 -5
  69. package/input/index.umd.js +1 -1
  70. package/input/style.css +1 -1
  71. package/input-icon/index.es.js +42 -41
  72. package/input-icon/index.umd.js +1 -1
  73. package/input-icon/style.css +1 -1
  74. package/input-number/index.es.js +46 -56
  75. package/input-number/index.umd.js +1 -1
  76. package/input-number/style.css +1 -1
  77. package/list/index.d.ts +7 -0
  78. package/list/index.es.js +39 -0
  79. package/list/index.umd.js +1 -0
  80. package/{toast → list}/package.json +1 -1
  81. package/list/style.css +1 -0
  82. package/loading/index.es.js +2 -2
  83. package/modal/index.es.js +304 -765
  84. package/modal/index.umd.js +1 -1
  85. package/modal/style.css +1 -1
  86. package/nav-sprite/index.es.js +1 -675
  87. package/nav-sprite/index.umd.js +1 -1
  88. package/notification/index.d.ts +7 -0
  89. package/notification/index.es.js +284 -0
  90. package/notification/index.umd.js +1 -0
  91. package/notification/package.json +7 -0
  92. package/notification/style.css +1 -0
  93. package/nuxt/components/Accordion.js +3 -0
  94. package/nuxt/components/Alert.js +3 -0
  95. package/nuxt/components/Anchor.js +3 -0
  96. package/nuxt/components/Aside.js +3 -0
  97. package/nuxt/components/AutoComplete.js +3 -0
  98. package/nuxt/components/Avatar.js +3 -0
  99. package/nuxt/components/BackTop.js +3 -0
  100. package/nuxt/components/Badge.js +3 -0
  101. package/nuxt/components/Breadcrumb.js +3 -0
  102. package/nuxt/components/Button.js +3 -0
  103. package/nuxt/components/Card.js +3 -0
  104. package/nuxt/components/Carousel.js +3 -0
  105. package/nuxt/components/CarouselItem.js +3 -0
  106. package/nuxt/components/Cascader.js +3 -0
  107. package/nuxt/components/Checkbox.js +3 -0
  108. package/nuxt/components/Col.js +3 -0
  109. package/nuxt/components/ColorPicker.js +3 -0
  110. package/nuxt/components/Column.js +3 -0
  111. package/nuxt/components/Comment.js +3 -0
  112. package/nuxt/components/Content.js +3 -0
  113. package/nuxt/components/Countdown.js +3 -0
  114. package/nuxt/components/DatePicker.js +3 -0
  115. package/nuxt/components/Drawer.js +3 -0
  116. package/nuxt/components/DrawerService.js +3 -0
  117. package/nuxt/components/Dropdown.js +3 -0
  118. package/nuxt/components/DropdownMenu.js +3 -0
  119. package/nuxt/components/EditableSelect.js +3 -0
  120. package/nuxt/components/FixedOverlay.js +3 -0
  121. package/nuxt/components/FlexibleOverlay.js +3 -0
  122. package/nuxt/components/Footer.js +3 -0
  123. package/nuxt/components/Form.js +3 -0
  124. package/nuxt/components/FormControl.js +3 -0
  125. package/nuxt/components/FormItem.js +3 -0
  126. package/nuxt/components/FormLabel.js +3 -0
  127. package/nuxt/components/FormOperation.js +3 -0
  128. package/nuxt/components/Fullscreen.js +3 -0
  129. package/nuxt/components/Gantt.js +3 -0
  130. package/nuxt/components/Header.js +3 -0
  131. package/nuxt/components/IFileOptions.js +3 -0
  132. package/nuxt/components/IUploadOptions.js +3 -0
  133. package/nuxt/components/Icon.js +2 -0
  134. package/nuxt/components/ImagePreviewService.js +3 -0
  135. package/nuxt/components/Input.js +3 -0
  136. package/nuxt/components/InputIcon.js +3 -0
  137. package/nuxt/components/InputNumber.js +3 -0
  138. package/nuxt/components/Layout.js +3 -0
  139. package/nuxt/components/List.js +3 -0
  140. package/nuxt/components/ListItem.js +3 -0
  141. package/nuxt/components/Loading.js +3 -0
  142. package/nuxt/components/LoadingService.js +3 -0
  143. package/nuxt/components/Modal.js +3 -0
  144. package/nuxt/components/NavSprite.js +2 -0
  145. package/nuxt/components/Notification.js +3 -0
  146. package/nuxt/components/NotificationService.js +3 -0
  147. package/nuxt/components/Pagination.js +3 -0
  148. package/nuxt/components/Panel.js +3 -0
  149. package/nuxt/components/PanelBody.js +3 -0
  150. package/nuxt/components/PanelFooter.js +3 -0
  151. package/nuxt/components/PanelHeader.js +3 -0
  152. package/nuxt/components/Popover.js +3 -0
  153. package/nuxt/components/Progress.js +3 -0
  154. package/nuxt/components/QuadrantDiagram.js +3 -0
  155. package/nuxt/components/Radio.js +3 -0
  156. package/nuxt/components/RadioGroup.js +3 -0
  157. package/nuxt/components/Rate.js +3 -0
  158. package/nuxt/components/ReadTip.js +3 -0
  159. package/nuxt/components/Result.js +3 -0
  160. package/nuxt/components/Row.js +3 -0
  161. package/nuxt/components/Search.js +3 -0
  162. package/nuxt/components/Select.js +3 -0
  163. package/nuxt/components/Skeleton.js +3 -0
  164. package/nuxt/components/SkeletonItem.js +3 -0
  165. package/nuxt/components/Slider.js +3 -0
  166. package/nuxt/components/Splitter.js +3 -0
  167. package/nuxt/components/Statistic.js +3 -0
  168. package/nuxt/components/Status.js +3 -0
  169. package/nuxt/components/StepsGuide.js +3 -0
  170. package/nuxt/components/StickSlider.js +3 -0
  171. package/nuxt/components/Sticky.js +2 -0
  172. package/nuxt/components/Switch.js +3 -0
  173. package/nuxt/components/Table.js +3 -0
  174. package/nuxt/components/Tabs.js +3 -0
  175. package/nuxt/components/Tag.js +3 -0
  176. package/nuxt/components/TagInput.js +3 -0
  177. package/nuxt/components/Textarea.js +3 -0
  178. package/nuxt/components/TimePicker.js +3 -0
  179. package/nuxt/components/Timeline.js +3 -0
  180. package/nuxt/components/TimelineItem.js +3 -0
  181. package/nuxt/components/Tooltip.js +3 -0
  182. package/nuxt/components/Transfer.js +3 -0
  183. package/nuxt/components/Tree.js +3 -0
  184. package/nuxt/components/TreeSelect.js +3 -0
  185. package/nuxt/components/Upload.js +3 -0
  186. package/nuxt/components/UploadStatus.js +3 -0
  187. package/nuxt/components/alertProps.js +3 -0
  188. package/nuxt/components/badgeProps.js +3 -0
  189. package/nuxt/components/buttonProps.js +3 -0
  190. package/nuxt/components/dropdownMenuProps.js +3 -0
  191. package/nuxt/components/fixedOverlayProps.js +3 -0
  192. package/nuxt/components/flexibleOverlayProps.js +3 -0
  193. package/nuxt/components/fullscreenProps.js +3 -0
  194. package/nuxt/components/iconProps.js +2 -0
  195. package/nuxt/components/notificationProps.js +3 -0
  196. package/nuxt/components/overlayEmits.js +3 -0
  197. package/nuxt/components/overlayProps.js +3 -0
  198. package/nuxt/components/paginationProps.js +3 -0
  199. package/nuxt/components/panelProps.js +3 -0
  200. package/nuxt/components/popoverProps.js +3 -0
  201. package/nuxt/components/searchProps.js +3 -0
  202. package/nuxt/components/tooltipProps.js +3 -0
  203. package/nuxt/components/uploadProps.js +3 -0
  204. package/nuxt/index.js +13 -0
  205. package/overlay/index.es.js +156 -205
  206. package/overlay/index.umd.js +1 -1
  207. package/overlay/style.css +1 -1
  208. package/package.json +12 -55
  209. package/pagination/index.es.js +11 -13
  210. package/pagination/index.umd.js +1 -1
  211. package/pagination/style.css +1 -1
  212. package/panel/index.es.js +48 -35
  213. package/panel/index.umd.js +1 -1
  214. package/popover/index.es.js +5954 -189
  215. package/popover/index.umd.js +27 -1
  216. package/popover/style.css +1 -1
  217. package/progress/index.es.js +8 -8
  218. package/progress/index.umd.js +3 -3
  219. package/quadrant-diagram/index.es.js +5405 -166
  220. package/quadrant-diagram/index.umd.js +27 -1
  221. package/radio/index.es.js +8 -14
  222. package/radio/index.umd.js +1 -1
  223. package/radio/style.css +1 -1
  224. package/read-tip/index.es.js +6 -3
  225. package/read-tip/style.css +1 -1
  226. package/result/index.es.js +38 -52
  227. package/result/index.umd.js +1 -1
  228. package/ripple/index.es.js +10 -6
  229. package/search/index.es.js +5428 -200
  230. package/search/index.umd.js +27 -1
  231. package/search/style.css +1 -1
  232. package/select/index.es.js +43 -42
  233. package/select/index.umd.js +1 -1
  234. package/select/style.css +1 -1
  235. package/skeleton/index.es.js +17 -17
  236. package/skeleton/index.umd.js +1 -1
  237. package/slider/index.es.js +4 -6
  238. package/slider/index.umd.js +1 -1
  239. package/slider/style.css +1 -1
  240. package/splitter/index.es.js +5896 -39
  241. package/splitter/index.umd.js +27 -1
  242. package/splitter/style.css +1 -1
  243. package/statistic/index.es.js +19 -32
  244. package/statistic/index.umd.js +1 -1
  245. package/statistic/style.css +1 -1
  246. package/status/index.es.js +1 -4
  247. package/status/index.umd.js +1 -1
  248. package/status/style.css +1 -1
  249. package/steps-guide/index.es.js +6 -3
  250. package/sticky/index.umd.js +1 -1
  251. package/style.css +1 -1
  252. package/table/index.es.js +753 -358
  253. package/table/index.umd.js +1 -1
  254. package/table/style.css +1 -1
  255. package/tabs/index.es.js +3 -4
  256. package/tabs/index.umd.js +1 -1
  257. package/tabs/style.css +1 -1
  258. package/tag/index.es.js +4 -3
  259. package/tag/index.umd.js +1 -1
  260. package/tag/style.css +1 -1
  261. package/tag-input/index.es.js +4 -14
  262. package/tag-input/index.umd.js +1 -1
  263. package/textarea/style.css +1 -1
  264. package/{theme → theme/theme.scss} +0 -0
  265. package/time-picker/index.es.js +309 -123
  266. package/time-picker/index.umd.js +1 -1
  267. package/time-picker/style.css +1 -1
  268. package/timeline/index.d.ts +7 -0
  269. package/{time-axis → timeline}/index.es.js +65 -77
  270. package/timeline/index.umd.js +1 -0
  271. package/{time-axis → timeline}/package.json +1 -1
  272. package/timeline/style.css +1 -0
  273. package/tooltip/index.es.js +5805 -141
  274. package/tooltip/index.umd.js +27 -1
  275. package/tooltip/style.css +1 -1
  276. package/transfer/index.es.js +6521 -630
  277. package/transfer/index.umd.js +27 -1
  278. package/transfer/style.css +1 -1
  279. package/tree/index.es.js +5781 -193
  280. package/tree/index.umd.js +27 -1
  281. package/tree/style.css +1 -1
  282. package/tree-select/index.es.js +138 -39
  283. package/tree-select/index.umd.js +1 -1
  284. package/tree-select/style.css +1 -1
  285. package/upload/index.es.js +450 -2669
  286. package/upload/index.umd.js +1 -1
  287. package/upload/style.css +1 -1
  288. package/vue-devui.es.js +14414 -14096
  289. package/vue-devui.umd.js +19 -19
  290. package/time-axis/index.umd.js +0 -1
  291. package/time-axis/style.css +0 -1
  292. package/toast/index.es.js +0 -2059
  293. package/toast/index.umd.js +0 -1
  294. package/toast/style.css +0 -1
@@ -21,2073 +21,318 @@ 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, getCurrentInstance, ref, computed, watch, nextTick, onUnmounted, mergeProps, createApp, toRefs, withDirectives, resolveComponent, createTextVNode, resolveDirective, Fragment, isVNode } from "vue";
25
- var toast = "";
26
- const toastProps = {
27
- value: {
28
- type: Array,
29
- required: true,
30
- default: () => []
24
+ import { defineComponent, toRefs, createVNode, computed, watch, Transition, reactive, createApp, onUnmounted, mergeProps, isVNode, ref, withDirectives, resolveComponent, resolveDirective } from "vue";
25
+ const notificationProps = {
26
+ modelValue: {
27
+ type: Boolean,
28
+ default: false
31
29
  },
32
- life: {
33
- type: Number,
34
- default: null
30
+ title: {
31
+ type: String,
32
+ default: ""
35
33
  },
36
- lifeMode: {
34
+ type: {
37
35
  type: String,
38
- default: "global"
36
+ default: "normal"
39
37
  },
40
- sticky: {
41
- type: Boolean,
42
- default: false
38
+ duration: {
39
+ type: Number,
40
+ default: 3e3
43
41
  },
44
- style: {
45
- type: Object,
46
- default: () => ({})
42
+ onClose: {
43
+ type: Function
44
+ }
45
+ };
46
+ const iconProps = {
47
+ name: {
48
+ type: String,
49
+ default: "",
50
+ required: true
47
51
  },
48
- styleClass: {
49
- type: String
52
+ size: {
53
+ type: String,
54
+ default: "inherit"
50
55
  },
51
- onCloseEvent: {
52
- type: Function
56
+ color: {
57
+ type: String,
58
+ default: "inherit"
53
59
  },
54
- onValueChange: {
55
- type: Function
60
+ classPrefix: {
61
+ type: String,
62
+ default: "icon"
56
63
  }
57
64
  };
58
65
  var Icon = defineComponent({
59
66
  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
- },
67
+ props: iconProps,
78
68
  setup(props) {
79
- return __spreadValues({}, props);
80
- },
81
- render() {
82
69
  const {
83
70
  name,
84
71
  size,
85
72
  color,
86
73
  classPrefix
87
- } = this;
88
- return /^((https?):)?\/\//.test(name) ? createVNode("img", {
89
- "src": name,
90
- "alt": name.split("/")[name.split("/").length - 1],
91
- "style": {
92
- width: size
93
- }
94
- }, null) : createVNode("i", {
95
- "class": `${classPrefix} ${classPrefix}-${name}`,
96
- "style": {
97
- fontSize: size,
98
- color
99
- }
100
- }, null);
74
+ } = toRefs(props);
75
+ return () => {
76
+ return /^((https?):)?\/\//.test(name.value) ? createVNode("img", {
77
+ "src": name.value,
78
+ "alt": name.value.split("/")[name.value.split("/").length - 1],
79
+ "style": {
80
+ width: size.value,
81
+ verticalAlign: "text-bottom"
82
+ }
83
+ }, null) : createVNode("i", {
84
+ "class": `${classPrefix.value} ${classPrefix.value}-${name.value}`,
85
+ "style": {
86
+ fontSize: size.value,
87
+ color: color.value
88
+ }
89
+ }, null);
90
+ };
101
91
  }
102
92
  });
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
- },
93
+ var Close = defineComponent({
112
94
  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)
95
+ setup(props, {
96
+ emit
97
+ }) {
98
+ return () => createVNode("div", {
99
+ "class": "devui-notification-icon-close",
100
+ "onClick": (e) => emit("click", e)
122
101
  }, [createVNode(Icon, {
123
102
  "name": "close",
124
103
  "size": "14px"
125
104
  }, null)]);
126
105
  }
127
106
  });
128
- var ToastImage = defineComponent({
129
- name: "DToastImage",
107
+ var TypeIcon = defineComponent({
130
108
  props: {
131
- prefixCls: String,
132
- severity: String
109
+ type: {
110
+ type: String,
111
+ default: "normal"
112
+ }
133
113
  },
134
- render() {
114
+ setup(props) {
135
115
  const {
136
- prefixCls,
137
- severity
138
- } = this;
139
- const wrapperCls = [`${prefixCls}-image`, `${prefixCls}-image-${severity || "common"}`];
116
+ type
117
+ } = toRefs(props);
118
+ const classes = computed(() => ({
119
+ "devui-notification-image": true,
120
+ [`devui-notification-image-${type.value}`]: true
121
+ }));
140
122
  const severityIconMap = {
141
123
  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]);
153
- }
154
- });
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;
337
- };
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;
374
- }
375
- return func.apply(void 0, arguments);
376
- };
377
- }
378
- function constant(value) {
379
- return function() {
380
- return value;
381
- };
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];
467
- }
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
- };
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);
510
- }
511
- }
512
- return object;
513
- });
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);
524
- }
525
- return result;
526
- }
527
- var argsTag$3 = "[object Arguments]";
528
- function baseIsArguments(value) {
529
- return isObjectLike(value) && baseGetTag(value) == argsTag$3;
530
- }
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");
538
- };
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);
635
- }
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;
710
- }
711
- }
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
- }
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;
744
- }
745
- return this;
746
- }
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]);
753
- }
754
- }
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]);
124
+ success: "right-o",
125
+ warning: "warning-o",
126
+ error: "error-o"
127
+ };
128
+ return () => createVNode("span", {
129
+ "class": classes.value
130
+ }, [type.value !== "normal" && createVNode(Icon, {
131
+ "name": severityIconMap[type.value],
132
+ "size": "16px"
133
+ }, null)]);
1692
134
  }
1693
- return result;
1694
135
  });
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;
136
+ function useNotification(props) {
137
+ const classes = computed(() => ({
138
+ "devui-notification-item-container": true,
139
+ [`devui-notification-message-${props.type}`]: true
140
+ }));
141
+ return { classes };
142
+ }
143
+ function useEvent(props, emit) {
144
+ let timer = null;
145
+ let timestamp;
146
+ const close2 = () => {
147
+ var _a;
148
+ clearTimeout(timer);
149
+ timer = null;
150
+ (_a = props.onClose) == null ? void 0 : _a.call(props);
151
+ emit("update:modelValue", false);
152
+ };
153
+ const interrupt = () => {
154
+ if (timer) {
155
+ clearTimeout(timer);
156
+ timer = null;
157
+ }
158
+ };
159
+ const removeReset = () => {
160
+ if (!props.modelValue) {
161
+ const remainTime = props.duration - (Date.now() - timestamp);
162
+ timer = setTimeout(close2, remainTime);
163
+ }
164
+ };
165
+ const handleDestroy = () => {
166
+ emit("destroy");
167
+ };
168
+ watch(() => props.modelValue, (val) => {
169
+ if (val) {
170
+ timestamp = Date.now();
171
+ if (props.duration) {
172
+ timer = setTimeout(close2, props.duration);
173
+ }
1747
174
  }
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) {
175
+ });
176
+ return { interrupt, removeReset, close: close2, handleDestroy };
177
+ }
178
+ var notification = "";
179
+ var Notification = defineComponent({
180
+ name: "DNotification",
181
+ props: notificationProps,
182
+ emits: ["update:modelValue", "destroy"],
183
+ setup(props, {
184
+ emit,
185
+ slots
186
+ }) {
1766
187
  const {
1767
- onCloseEvent,
1768
- onHidden,
1769
- onValueChange
1770
- } = useToastEvent();
188
+ modelValue,
189
+ title,
190
+ type
191
+ } = toRefs(props);
1771
192
  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
- });
193
+ classes
194
+ } = useNotification(props);
195
+ const {
196
+ interrupt,
197
+ removeReset,
198
+ close: close2,
199
+ handleDestroy
200
+ } = useEvent(props, emit);
201
+ return () => createVNode(Transition, {
202
+ "name": "notification-fade",
203
+ "onAfterLeave": handleDestroy
1799
204
  }, {
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);
205
+ default: () => {
206
+ var _a;
207
+ return [modelValue.value && createVNode("div", {
208
+ "class": "devui-notification"
209
+ }, [createVNode("div", {
210
+ "class": classes.value,
211
+ "onMouseenter": interrupt,
212
+ "onMouseleave": removeReset
213
+ }, [createVNode("div", {
214
+ "class": "devui-notification-item"
215
+ }, [createVNode(Close, {
216
+ "onClick": close2
217
+ }, null), title.value && createVNode(TypeIcon, {
218
+ "type": type.value
219
+ }, null), createVNode("div", {
220
+ "class": "devui-notification-message"
221
+ }, [createVNode("span", {
222
+ "class": "devui-notification-title"
223
+ }, [title.value]), createVNode("span", {
224
+ "class": "devui-notification-content"
225
+ }, [(_a = slots.default) == null ? void 0 : _a.call(slots)])])])])])];
1817
226
  }
1818
227
  });
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);
228
+ }
229
+ });
230
+ function _isSlot(s) {
231
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
232
+ }
233
+ const defaultOptions = {
234
+ modelValue: false,
235
+ duration: 3e3,
236
+ type: "normal"
237
+ };
238
+ function initInstance(props, content) {
239
+ const container = document.createElement("div");
240
+ const app = createApp({
241
+ setup() {
242
+ onUnmounted(() => {
243
+ document.body.removeChild(container);
244
+ });
245
+ return () => createVNode(Notification, mergeProps(props, {
246
+ "onDestroy": app.unmount
247
+ }), _isSlot(content) ? content : {
248
+ default: () => [content]
249
+ });
1932
250
  }
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);
251
+ });
252
+ document.body.appendChild(container);
253
+ app.mount(container);
254
+ return app;
255
+ }
256
+ function close(props, originOnClose) {
257
+ props.modelValue = false;
258
+ originOnClose == null ? void 0 : originOnClose();
259
+ }
260
+ class NotificationService {
261
+ static open(options) {
262
+ const originOnClose = options.onClose || null;
263
+ const content = options.content;
264
+ let timer;
265
+ delete options.content;
266
+ const props = reactive(__spreadProps(__spreadValues(__spreadValues({}, defaultOptions), options), {
267
+ onClose: () => {
268
+ close(props, originOnClose);
1941
269
  }
270
+ }));
271
+ initInstance(props, content);
272
+ props.modelValue = true;
273
+ clearTimeout(timer);
274
+ if (options.duration) {
275
+ timer = setTimeout(props.onClose, options.duration);
1942
276
  }
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
277
  }
2028
- });
2029
- function createToastApp(props) {
2030
- return createApp(Toast, props);
2031
278
  }
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
- };
279
+ class IUploadOptions {
280
+ constructor() {
281
+ __publicField(this, "uri");
282
+ __publicField(this, "method");
283
+ __publicField(this, "maximumSize");
284
+ __publicField(this, "headers");
285
+ __publicField(this, "authToken");
286
+ __publicField(this, "authTokenHeader");
287
+ __publicField(this, "additionalParameter");
288
+ __publicField(this, "fileFieldName");
289
+ __publicField(this, "checkSameName");
290
+ __publicField(this, "withCredentials");
291
+ __publicField(this, "responseType");
2049
292
  }
2050
293
  }
2051
- Toast.install = function(app) {
2052
- app.component(Toast.name, Toast);
2053
- };
2054
- var UploadStatus;
2055
- (function(UploadStatus2) {
294
+ class IFileOptions {
295
+ constructor() {
296
+ __publicField(this, "accept");
297
+ __publicField(this, "multiple");
298
+ __publicField(this, "webkitdirectory");
299
+ }
300
+ }
301
+ var UploadStatus = /* @__PURE__ */ ((UploadStatus2) => {
2056
302
  UploadStatus2[UploadStatus2["preLoad"] = 0] = "preLoad";
2057
303
  UploadStatus2[UploadStatus2["uploading"] = 1] = "uploading";
2058
304
  UploadStatus2[UploadStatus2["uploaded"] = 2] = "uploaded";
2059
305
  UploadStatus2[UploadStatus2["failed"] = 3] = "failed";
2060
- })(UploadStatus || (UploadStatus = {}));
306
+ return UploadStatus2;
307
+ })(UploadStatus || {});
2061
308
  const uploadProps = {
309
+ accept: {
310
+ type: String
311
+ },
312
+ webkitdirectory: {
313
+ type: Boolean,
314
+ default: false
315
+ },
2062
316
  uploadOptions: {
2063
- type: Object,
2064
- required: true
317
+ type: Object
2065
318
  },
2066
- fileOptions: {
2067
- type: Object,
2068
- required: true
319
+ multiple: {
320
+ type: Boolean,
321
+ default: false
2069
322
  },
2070
323
  autoUpload: {
2071
324
  type: Boolean,
2072
- default: false
325
+ default: true
2073
326
  },
2074
- placeholderText: {
327
+ placeholder: {
2075
328
  type: String,
2076
329
  default: "\u9009\u62E9\u6587\u4EF6"
2077
330
  },
2078
- uploadText: {
2079
- type: String,
2080
- default: "\u4E0A\u4F20"
2081
- },
2082
- uploadedFiles: {
331
+ modelValue: {
2083
332
  type: Array,
2084
333
  default: () => []
2085
334
  },
2086
- withoutBtn: {
2087
- type: Boolean,
2088
- default: false
2089
- },
2090
- enableDrop: {
335
+ droppable: {
2091
336
  type: Boolean,
2092
337
  default: false
2093
338
  },
@@ -2101,10 +346,6 @@ const uploadProps = {
2101
346
  type: Boolean,
2102
347
  default: false
2103
348
  },
2104
- showTip: {
2105
- type: Boolean,
2106
- default: false
2107
- },
2108
349
  onChange: {
2109
350
  type: Function
2110
351
  },
@@ -2120,96 +361,125 @@ const uploadProps = {
2120
361
  type: Function,
2121
362
  default: void 0
2122
363
  },
2123
- errorEvent: {
364
+ deleteUploadedFile: {
2124
365
  type: Function,
2125
366
  default: void 0
2126
367
  },
2127
- successEvent: {
368
+ "on-error": {
2128
369
  type: Function,
2129
370
  default: void 0
2130
371
  },
2131
- deleteUploadedFileEvent: {
372
+ "on-success": {
2132
373
  type: Function,
2133
374
  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
375
  },
2173
376
  oneTimeUpload: {
2174
377
  type: Boolean,
2175
378
  default: false
2176
- },
2177
- disabled: {
2178
- type: Boolean,
2179
- default: false
2180
- },
2181
- beforeUpload: {
2182
- type: Function
2183
- },
2184
- fileDrop: {
2185
- type: Function,
2186
- default: void 0
2187
- },
2188
- fileOver: {
2189
- type: Function,
2190
- default: void 0
2191
- },
2192
- fileSelect: {
2193
- type: Function,
2194
- default: void 0
2195
- },
2196
- errorEvent: {
2197
- type: Function,
2198
- default: void 0
2199
- },
2200
- successEvent: {
2201
- type: Function,
2202
- default: void 0
2203
- },
2204
- deleteUploadedFileEvent: {
2205
- type: Function,
2206
- default: void 0
2207
- },
2208
- setCustomUploadOptions: {
2209
- type: Function,
2210
- default: void 0
2211
379
  }
2212
380
  };
381
+ 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`;
382
+ const getBeyondMaximalFileSizeMsg = (filename, maximalSize) => {
383
+ 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`;
384
+ };
385
+ const getNotAllowedFileTypeMsg = (filename, scope) => {
386
+ 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`;
387
+ };
388
+ const getExistSameNameFilesMsg = (sameNames) => {
389
+ return `\u60A8\u4E0A\u4F20\u7684 "${sameNames}" \u5B58\u5728\u91CD\u540D\u6587\u4EF6, \u8BF7\u91CD\u65B0\u9009\u62E9\u6587\u4EF6`;
390
+ };
391
+ const useSelectFiles = () => {
392
+ const BEYOND_MAXIMAL_FILE_SIZE_MSG = ref("");
393
+ const simulateClickEvent = (input) => {
394
+ const evt = document.createEvent("MouseEvents");
395
+ evt.initMouseEvent("click", true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
396
+ input.dispatchEvent(evt);
397
+ };
398
+ const selectFiles = ({ multiple, accept, webkitdirectory }) => {
399
+ return new Promise((resolve) => {
400
+ const tempNode = document.getElementById("d-upload-temp");
401
+ if (tempNode) {
402
+ document.body.removeChild(tempNode);
403
+ }
404
+ const input = document.createElement("input");
405
+ input.style.position = "fixed";
406
+ input.style.left = "-2000px";
407
+ input.style.top = "-2000px";
408
+ input.setAttribute("id", "d-upload-temp");
409
+ input.setAttribute("type", "file");
410
+ if (multiple) {
411
+ input.setAttribute("multiple", "");
412
+ }
413
+ if (accept) {
414
+ input.setAttribute("accept", accept);
415
+ }
416
+ if (webkitdirectory) {
417
+ input.setAttribute("webkitdirectory", "");
418
+ }
419
+ input.addEventListener("change", (event) => {
420
+ resolve(Array.prototype.slice.call(event.target.files));
421
+ });
422
+ document.body.appendChild(input);
423
+ simulateClickEvent(input);
424
+ });
425
+ };
426
+ const isAllowedFileType = (accept, file) => {
427
+ if (accept) {
428
+ const acceptArr = accept.split(",");
429
+ const baseMimeType = file.type.replace(/\/.*$/, "");
430
+ return acceptArr.some((type) => {
431
+ const validType = type.trim();
432
+ if (validType.startsWith(".")) {
433
+ return file.name.toLowerCase().indexOf(validType.toLowerCase(), file.name.toLowerCase().length - validType.toLowerCase().length) > -1;
434
+ } else if (/\/\*$/.test(validType)) {
435
+ return baseMimeType === validType.replace(/\/.*$/, "");
436
+ }
437
+ return file.type === validType;
438
+ });
439
+ }
440
+ return true;
441
+ };
442
+ const beyondMaximalSize = (fileSize, maximumSize) => {
443
+ if (maximumSize) {
444
+ return fileSize > 1024 * 1024 * maximumSize;
445
+ }
446
+ return false;
447
+ };
448
+ const _validateFiles = (file, accept, uploadOptions) => {
449
+ if (!isAllowedFileType(accept, file)) {
450
+ return {
451
+ checkError: true,
452
+ errorMsg: getNotAllowedFileTypeMsg(file.name, accept)
453
+ };
454
+ }
455
+ if (uploadOptions && beyondMaximalSize(file.size, uploadOptions.maximumSize)) {
456
+ return {
457
+ checkError: true,
458
+ errorMsg: getBeyondMaximalFileSizeMsg(file.name, uploadOptions.maximumSize)
459
+ };
460
+ }
461
+ return { checkError: false, errorMsg: void 0 };
462
+ };
463
+ const triggerSelectFiles = (fileOptions) => {
464
+ const { multiple, accept, webkitdirectory } = fileOptions;
465
+ return selectFiles({ multiple, accept, webkitdirectory });
466
+ };
467
+ const triggerDropFiles = (files) => {
468
+ return Promise.resolve(files);
469
+ };
470
+ const checkAllFilesSize = (fileSize, maximumSize) => {
471
+ if (beyondMaximalSize(fileSize, maximumSize)) {
472
+ BEYOND_MAXIMAL_FILE_SIZE_MSG.value = getAllFilesBeyondMaximalFileSizeMsg(maximumSize);
473
+ return { checkError: true, errorMsg: BEYOND_MAXIMAL_FILE_SIZE_MSG.value };
474
+ }
475
+ };
476
+ return {
477
+ triggerSelectFiles,
478
+ _validateFiles,
479
+ triggerDropFiles,
480
+ checkAllFilesSize
481
+ };
482
+ };
2213
483
  class FileUploader {
2214
484
  constructor(file, uploadOptions) {
2215
485
  __publicField(this, "xhr");
@@ -2224,17 +494,7 @@ class FileUploader {
2224
494
  }
2225
495
  send(uploadFiles) {
2226
496
  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;
497
+ const { uri, method, headers, authToken, authTokenHeader, additionalParameter, fileFieldName, withCredentials, responseType } = this.uploadOptions;
2238
498
  const authTokenHeader_ = authTokenHeader || "Authorization";
2239
499
  const fileFieldName_ = fileFieldName || "file";
2240
500
  this.xhr = new XMLHttpRequest();
@@ -2411,412 +671,24 @@ const useUpload = () => {
2411
671
  _oneTimeUpload
2412
672
  };
2413
673
  };
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
- };
2514
- }
2515
- return { checkError: false, errorMsg: void 0 };
2516
- };
2517
- const triggerSelectFiles = (fileOptions) => {
2518
- const { multiple, accept, webkitdirectory } = fileOptions;
2519
- return selectFiles({ multiple, accept, webkitdirectory });
2520
- };
2521
- const triggerDropFiles = (files) => {
2522
- return Promise.resolve(files);
2523
- };
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
- }
2529
- };
2530
- return {
2531
- triggerSelectFiles,
2532
- _validateFiles,
2533
- triggerDropFiles,
2534
- checkAllFilesSize
2535
- };
2536
- };
2537
674
  var upload = "";
2538
675
  var Upload = defineComponent({
2539
- name: "DSingleUpload",
676
+ name: "DUpload",
2540
677
  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;
2648
- }
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
- };
2690
- },
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
- })])]);
2797
- }
2798
- });
2799
- function _isSlot(s) {
2800
- return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
2801
- }
2802
- var MultiUpload = defineComponent({
2803
- name: "DMultipleUpload",
2804
- props: multiUploadProps,
2805
- emits: ["fileDrop", "fileOver", "fileSelect", "successEvent", "errorEvent", "deleteUploadedFileEvent", "update:uploadedFiles"],
678
+ emits: ["fileDrop", "fileOver", "fileSelect", "deleteUploadedFile", "update:modelValue"],
2806
679
  setup(props, ctx) {
2807
680
  const {
2808
681
  uploadOptions,
2809
- fileOptions,
2810
- placeholderText,
682
+ placeholder,
2811
683
  autoUpload,
2812
- withoutBtn,
2813
- uploadText,
2814
684
  disabled,
2815
685
  beforeUpload,
2816
- enableDrop,
686
+ droppable,
2817
687
  oneTimeUpload,
2818
- showTip,
2819
- uploadedFiles
688
+ modelValue,
689
+ multiple,
690
+ accept,
691
+ webkitdirectory
2820
692
  } = toRefs(props);
2821
693
  const {
2822
694
  triggerSelectFiles,
@@ -2825,7 +697,6 @@ var MultiUpload = defineComponent({
2825
697
  checkAllFilesSize
2826
698
  } = useSelectFiles();
2827
699
  const {
2828
- getFiles,
2829
700
  fileUploaders,
2830
701
  addFile,
2831
702
  getFullFiles,
@@ -2837,20 +708,18 @@ var MultiUpload = defineComponent({
2837
708
  getSameNameFiles
2838
709
  } = useUpload();
2839
710
  const isDropOVer = ref(false);
2840
- const uploadTips = ref("");
711
+ ref("");
2841
712
  const alertMsg = (errorMsg) => {
2842
- ToastService.open({
2843
- value: [{
2844
- severity: "warn",
2845
- content: errorMsg
2846
- }]
713
+ NotificationService.open({
714
+ type: "warning",
715
+ content: errorMsg
2847
716
  });
2848
717
  };
2849
718
  const checkValid = () => {
2850
719
  let totalFileSize = 0;
2851
720
  fileUploaders.value.forEach((fileUploader) => {
2852
721
  totalFileSize += fileUploader.file.size;
2853
- const checkResult = _validateFiles(fileUploader.file, fileOptions.value.accept, fileUploader.uploadOptions);
722
+ const checkResult = _validateFiles(fileUploader.file, accept.value, fileUploader.uploadOptions);
2854
723
  if (checkResult && checkResult.checkError) {
2855
724
  deleteFile(fileUploader.file);
2856
725
  alertMsg(checkResult.errorMsg);
@@ -2869,17 +738,20 @@ var MultiUpload = defineComponent({
2869
738
  resetSameNameFiles();
2870
739
  promise.then((files) => {
2871
740
  files.forEach((file) => {
741
+ if (!multiple.value) {
742
+ removeFiles();
743
+ }
2872
744
  addFile(file, uploadOptions.value);
2873
745
  });
2874
746
  checkValid();
2875
747
  const sameNameFiles = getSameNameFiles();
2876
- if (uploadOptions.value.checkSameName && sameNameFiles.length) {
748
+ if (uploadOptions.value && uploadOptions.value.checkSameName && sameNameFiles.length) {
2877
749
  alertMsg(getExistSameNameFilesMsg(sameNameFiles));
2878
750
  }
2879
751
  const selectedFiles = fileUploaders.value.filter((fileUploader) => fileUploader.status === UploadStatus.preLoad).map((fileUploader) => fileUploader.file);
2880
752
  ctx.emit("fileSelect", selectedFiles);
2881
753
  if (autoUpload.value) {
2882
- upload2();
754
+ fileUpload();
2883
755
  }
2884
756
  }).catch((error) => {
2885
757
  alertMsg(error.message);
@@ -2889,7 +761,11 @@ var MultiUpload = defineComponent({
2889
761
  if (disabled.value) {
2890
762
  return;
2891
763
  }
2892
- _dealFiles(triggerSelectFiles(fileOptions.value));
764
+ _dealFiles(triggerSelectFiles({
765
+ accept: accept.value,
766
+ multiple: multiple.value,
767
+ webkitdirectory: webkitdirectory.value
768
+ }));
2893
769
  };
2894
770
  const onFileDrop = (files) => {
2895
771
  isDropOVer.value = false;
@@ -2900,16 +776,19 @@ var MultiUpload = defineComponent({
2900
776
  isDropOVer.value = event;
2901
777
  ctx.emit("fileOver", event);
2902
778
  };
2903
- const onDeleteFile = (event, file) => {
2904
- event.stopPropagation();
2905
- deleteFile(file);
2906
- };
2907
779
  const deleteUploadedFile = (file) => {
2908
- const newUploadedFiles = uploadedFiles.value.filter((uploadedFile) => {
780
+ const newUploadedFiles = modelValue.value.filter((uploadedFile) => {
2909
781
  return uploadedFile.name !== file.name;
2910
782
  });
2911
- ctx.emit("deleteUploadedFileEvent", file);
2912
- ctx.emit("update:uploadedFiles", newUploadedFiles);
783
+ ctx.emit("deleteUploadedFile", file);
784
+ ctx.emit("update:modelValue", newUploadedFiles);
785
+ };
786
+ const onDeleteFile = (event, file, status) => {
787
+ event.stopPropagation();
788
+ if (status === UploadStatus.uploaded) {
789
+ deleteUploadedFile(file);
790
+ }
791
+ deleteFile(file);
2913
792
  };
2914
793
  const canUpload = () => {
2915
794
  let uploadResult = Promise.resolve(true);
@@ -2936,163 +815,69 @@ var MultiUpload = defineComponent({
2936
815
  }
2937
816
  const uploadObservable = oneTimeUpload.value ? _oneTimeUpload() : upload2(fileUploader);
2938
817
  uploadObservable.then((results) => {
2939
- ctx.emit("successEvent", results);
818
+ props["on-success"] && props["on-success"](results);
2940
819
  const newFiles = results.map((result) => result.file);
2941
- const newUploadedFiles = [...newFiles, ...uploadedFiles.value];
2942
- ctx.emit("update:uploadedFiles", newUploadedFiles);
820
+ const newUploadedFiles = [...newFiles, ...modelValue.value];
821
+ ctx.emit("update:modelValue", newUploadedFiles);
2943
822
  }).catch((error) => {
2944
- ctx.emit("errorEvent", error);
823
+ props["on-error"] && props["on-error"](error);
2945
824
  });
2946
825
  });
2947
826
  };
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++;
2960
- }
2961
- });
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";
2976
- }
2977
- };
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;
2985
- });
2986
- };
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
827
+ return () => {
828
+ var _a, _b, _c, _d;
829
+ return createVNode("div", null, [withDirectives(createVNode("div", {
830
+ "class": "devui-upload",
831
+ "style": `border: ${isDropOVer.value ? "1px solid #15bf15" : "0"}`
832
+ }, [((_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)) ? createVNode("div", {
833
+ "onClick": handleClick
834
+ }, [ctx.slots.default()]) : createVNode("div", {
835
+ "class": `devui-input-group ${disabled.value ? "disabled" : ""}`,
836
+ "onClick": handleClick
837
+ }, [fileUploaders.value.length === 0 && createVNode("div", {
838
+ "class": "devui-form-control devui-upload-placeholder"
839
+ }, [placeholder.value]), fileUploaders.value.length > 0 && createVNode("ul", {
840
+ "class": "devui-form-control devui-files-list"
841
+ }, [fileUploaders.value.map((fileUploader, index2) => createVNode("li", {
842
+ "key": index2,
843
+ "class": "devui-file-item devui-file-tag",
844
+ "style": "display: inline-block; margin: 0 2px 2px 0",
845
+ "title": fileUploader.file.name
846
+ }, [createVNode("span", {
847
+ "class": `devui-filename ${fileUploader.status === UploadStatus.failed ? "devui-failed-color" : ""}`
848
+ }, [fileUploader.file.name]), createVNode(resolveComponent("d-icon"), {
849
+ "name": "close",
850
+ "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" : ""}`,
851
+ "onClick": (event) => onDeleteFile(event, fileUploader.file, fileUploader.status)
852
+ }, null), fileUploader.status === UploadStatus.uploading && createVNode("div", {
853
+ "class": "icon devui-upload-progress"
854
+ }, [createVNode(resolveComponent("d-progress"), {
855
+ "isCircle": true,
856
+ "percentage": fileUploader.percentage,
857
+ "barbgcolor": "#50D4AB",
858
+ "strokeWidth": 8,
859
+ "showContent": false
860
+ }, null)]), fileUploader.status === UploadStatus.failed && createVNode(resolveComponent("d-icon"), {
861
+ "name": "running",
862
+ "onClick": fileUpload
863
+ }, null), fileUploader.status === UploadStatus.uploaded && createVNode(resolveComponent("d-icon"), {
864
+ "name": "right",
865
+ "color": "#50d4ab"
866
+ }, null)]))]), createVNode("span", {
867
+ "class": "devui-input-group-addon"
868
+ }, [createVNode(resolveComponent("d-icon"), {
869
+ "name": "more-operate",
870
+ "color": "#252b3a"
871
+ }, null)])])]), [[resolveDirective("file-drop"), {
872
+ droppable,
873
+ isSingle: !multiple,
874
+ onFileDrop,
875
+ onFileOver
876
+ }]]), createVNode("div", null, [(_d = (_c = ctx.slots)["uploaded-files"]) == null ? void 0 : _d.call(_c, {
877
+ uploadedFiles: modelValue.value,
878
+ deleteFile: deleteUploadedFile
879
+ })])]);
3009
880
  };
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
881
  }
3097
882
  });
3098
883
  const getTransfer = (event) => {
@@ -3147,14 +932,14 @@ const onDrop = (el, binding) => {
3147
932
  if (isSingle) {
3148
933
  onFileDrop && onFileDrop([transfer.files[0]]);
3149
934
  } else {
3150
- onFileDrop && onFileDrop(transfer.files);
935
+ onFileDrop && onFileDrop(Array.from(transfer.files));
3151
936
  }
3152
937
  });
3153
938
  };
3154
939
  const fileDropDirective = {
3155
940
  mounted: (el, binding) => {
3156
- const { enableDrop } = binding.value;
3157
- if (!enableDrop) {
941
+ const { droppable } = binding.value;
942
+ if (!droppable) {
3158
943
  return;
3159
944
  }
3160
945
  onDragOver(el, binding);
@@ -3162,17 +947,13 @@ const fileDropDirective = {
3162
947
  onDrop(el, binding);
3163
948
  }
3164
949
  };
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
950
  var index = {
3171
951
  title: "Upload \u4E0A\u4F20",
3172
952
  category: "\u6570\u636E\u5F55\u5165",
3173
953
  status: "100%",
3174
954
  install(app) {
3175
- app.use(Upload);
955
+ app.directive("file-drop", fileDropDirective);
956
+ app.component(Upload.name, Upload);
3176
957
  }
3177
958
  };
3178
- export { MultiUpload, Upload, index as default };
959
+ export { IFileOptions, IUploadOptions, Upload, UploadStatus, index as default, uploadProps };