vue-devui 1.0.0-beta.8 → 1.0.0-rc.0

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 (278) hide show
  1. package/README.md +81 -66
  2. package/accordion/index.es.js +522 -39
  3. package/accordion/index.umd.js +1 -1
  4. package/accordion/style.css +1 -1
  5. package/alert/index.es.js +6 -7
  6. package/alert/index.umd.js +1 -1
  7. package/alert/style.css +1 -1
  8. package/{toast → auto-complete}/index.d.ts +0 -0
  9. package/auto-complete/index.es.js +976 -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 +1 -1
  14. package/back-top/index.umd.js +1 -1
  15. package/badge/index.es.js +12 -18
  16. package/badge/index.umd.js +1 -1
  17. package/button/index.es.js +262 -82
  18. package/button/index.umd.js +1 -1
  19. package/button/style.css +1 -1
  20. package/carousel/index.es.js +7 -6
  21. package/carousel/index.umd.js +1 -1
  22. package/cascader/index.es.js +5392 -772
  23. package/cascader/index.umd.js +27 -1
  24. package/checkbox/style.css +1 -1
  25. package/color-picker/index.d.ts +7 -0
  26. package/color-picker/index.es.js +8187 -0
  27. package/color-picker/index.umd.js +27 -0
  28. package/color-picker/package.json +7 -0
  29. package/color-picker/style.css +1 -0
  30. package/comment/index.es.js +42 -13
  31. package/comment/index.umd.js +1 -1
  32. package/comment/style.css +1 -1
  33. package/countdown/index.es.js +27 -18
  34. package/countdown/index.umd.js +1 -1
  35. package/countdown/style.css +1 -1
  36. package/date-picker/index.es.js +10 -11
  37. package/date-picker/index.umd.js +1 -1
  38. package/date-picker/style.css +1 -1
  39. package/dragdrop/index.es.js +135 -10
  40. package/dragdrop/index.umd.js +1 -1
  41. package/drawer/index.es.js +169 -223
  42. package/drawer/index.umd.js +1 -1
  43. package/drawer/style.css +1 -1
  44. package/dropdown/index.es.js +408 -300
  45. package/dropdown/index.umd.js +1 -1
  46. package/dropdown/style.css +1 -1
  47. package/editable-select/index.es.js +275 -5610
  48. package/editable-select/index.umd.js +1 -27
  49. package/editable-select/style.css +1 -1
  50. package/form/index.es.js +6129 -461
  51. package/form/index.umd.js +27 -1
  52. package/form/style.css +1 -1
  53. package/fullscreen/index.es.js +110 -118
  54. package/fullscreen/index.umd.js +1 -1
  55. package/fullscreen/style.css +1 -1
  56. package/gantt/index.es.js +6 -18
  57. package/gantt/index.umd.js +1 -1
  58. package/gantt/style.css +1 -1
  59. package/grid/index.es.js +1 -1
  60. package/grid/style.css +1 -1
  61. package/icon/index.es.js +2 -1
  62. package/icon/index.umd.js +1 -1
  63. package/image-preview/index.es.js +77 -19
  64. package/image-preview/index.umd.js +1 -1
  65. package/image-preview/style.css +1 -1
  66. package/input/index.es.js +4 -5
  67. package/input/index.umd.js +1 -1
  68. package/input/style.css +1 -1
  69. package/input-icon/index.es.js +6 -6
  70. package/input-icon/index.umd.js +1 -1
  71. package/input-icon/style.css +1 -1
  72. package/input-number/index.es.js +2 -1
  73. package/input-number/index.umd.js +1 -1
  74. package/list/index.d.ts +7 -0
  75. package/list/index.es.js +39 -0
  76. package/list/index.umd.js +1 -0
  77. package/{toast → list}/package.json +1 -1
  78. package/list/style.css +1 -0
  79. package/loading/index.es.js +2 -2
  80. package/modal/index.es.js +293 -759
  81. package/modal/index.umd.js +1 -1
  82. package/modal/style.css +1 -1
  83. package/nav-sprite/index.es.js +1 -675
  84. package/nav-sprite/index.umd.js +1 -1
  85. package/notification/index.d.ts +7 -0
  86. package/notification/index.es.js +286 -0
  87. package/notification/index.umd.js +1 -0
  88. package/notification/package.json +7 -0
  89. package/notification/style.css +1 -0
  90. package/nuxt/components/Accordion.js +3 -0
  91. package/nuxt/components/Alert.js +3 -0
  92. package/nuxt/components/Anchor.js +3 -0
  93. package/nuxt/components/Aside.js +3 -0
  94. package/nuxt/components/AutoComplete.js +3 -0
  95. package/nuxt/components/Avatar.js +3 -0
  96. package/nuxt/components/BackTop.js +3 -0
  97. package/nuxt/components/Badge.js +3 -0
  98. package/nuxt/components/Breadcrumb.js +3 -0
  99. package/nuxt/components/Button.js +3 -0
  100. package/nuxt/components/Card.js +3 -0
  101. package/nuxt/components/Carousel.js +3 -0
  102. package/nuxt/components/CarouselItem.js +3 -0
  103. package/nuxt/components/Cascader.js +3 -0
  104. package/nuxt/components/Checkbox.js +3 -0
  105. package/nuxt/components/Col.js +3 -0
  106. package/nuxt/components/ColorPicker.js +3 -0
  107. package/nuxt/components/Column.js +3 -0
  108. package/nuxt/components/Comment.js +3 -0
  109. package/nuxt/components/Content.js +3 -0
  110. package/nuxt/components/Countdown.js +3 -0
  111. package/nuxt/components/DatePicker.js +3 -0
  112. package/nuxt/components/Drawer.js +3 -0
  113. package/nuxt/components/DrawerService.js +3 -0
  114. package/nuxt/components/Dropdown.js +3 -0
  115. package/nuxt/components/DropdownMenu.js +3 -0
  116. package/nuxt/components/EditableSelect.js +3 -0
  117. package/nuxt/components/FixedOverlay.js +3 -0
  118. package/nuxt/components/FlexibleOverlay.js +3 -0
  119. package/nuxt/components/Footer.js +3 -0
  120. package/nuxt/components/Form.js +3 -0
  121. package/nuxt/components/FormControl.js +3 -0
  122. package/nuxt/components/FormItem.js +3 -0
  123. package/nuxt/components/FormLabel.js +3 -0
  124. package/nuxt/components/FormOperation.js +3 -0
  125. package/nuxt/components/Fullscreen.js +3 -0
  126. package/nuxt/components/Gantt.js +3 -0
  127. package/nuxt/components/Header.js +3 -0
  128. package/nuxt/components/IFileOptions.js +3 -0
  129. package/nuxt/components/IUploadOptions.js +3 -0
  130. package/nuxt/components/Icon.js +2 -0
  131. package/nuxt/components/ImagePreviewService.js +3 -0
  132. package/nuxt/components/Input.js +3 -0
  133. package/nuxt/components/InputIcon.js +3 -0
  134. package/nuxt/components/InputNumber.js +3 -0
  135. package/nuxt/components/Layout.js +3 -0
  136. package/nuxt/components/List.js +3 -0
  137. package/nuxt/components/ListItem.js +3 -0
  138. package/nuxt/components/Loading.js +3 -0
  139. package/nuxt/components/LoadingService.js +3 -0
  140. package/nuxt/components/Modal.js +3 -0
  141. package/nuxt/components/NavSprite.js +2 -0
  142. package/nuxt/components/Notification.js +3 -0
  143. package/nuxt/components/NotificationService.js +3 -0
  144. package/nuxt/components/Pagination.js +3 -0
  145. package/nuxt/components/Panel.js +3 -0
  146. package/nuxt/components/Popover.js +3 -0
  147. package/nuxt/components/Progress.js +3 -0
  148. package/nuxt/components/QuadrantDiagram.js +3 -0
  149. package/nuxt/components/Radio.js +3 -0
  150. package/nuxt/components/RadioGroup.js +3 -0
  151. package/nuxt/components/Rate.js +3 -0
  152. package/nuxt/components/ReadTip.js +3 -0
  153. package/nuxt/components/Result.js +3 -0
  154. package/nuxt/components/Row.js +3 -0
  155. package/nuxt/components/Search.js +3 -0
  156. package/nuxt/components/Select.js +3 -0
  157. package/nuxt/components/Skeleton.js +3 -0
  158. package/nuxt/components/SkeletonItem.js +3 -0
  159. package/nuxt/components/Slider.js +3 -0
  160. package/nuxt/components/Splitter.js +3 -0
  161. package/nuxt/components/Statistic.js +3 -0
  162. package/nuxt/components/Status.js +3 -0
  163. package/nuxt/components/StepsGuide.js +3 -0
  164. package/nuxt/components/StickSlider.js +3 -0
  165. package/nuxt/components/Sticky.js +2 -0
  166. package/nuxt/components/Switch.js +3 -0
  167. package/nuxt/components/Table.js +3 -0
  168. package/nuxt/components/Tabs.js +3 -0
  169. package/nuxt/components/Tag.js +3 -0
  170. package/nuxt/components/TagInput.js +3 -0
  171. package/nuxt/components/Textarea.js +3 -0
  172. package/nuxt/components/TimeAxis.js +3 -0
  173. package/nuxt/components/TimeAxisItem.js +3 -0
  174. package/nuxt/components/TimePicker.js +3 -0
  175. package/nuxt/components/Tooltip.js +3 -0
  176. package/nuxt/components/Transfer.js +3 -0
  177. package/nuxt/components/Tree.js +3 -0
  178. package/nuxt/components/TreeSelect.js +3 -0
  179. package/nuxt/components/Upload.js +3 -0
  180. package/nuxt/components/UploadStatus.js +3 -0
  181. package/nuxt/components/badgeProps.js +3 -0
  182. package/nuxt/components/buttonProps.js +3 -0
  183. package/nuxt/components/dropdownMenuProps.js +3 -0
  184. package/nuxt/components/fixedOverlayProps.js +3 -0
  185. package/nuxt/components/flexibleOverlayProps.js +3 -0
  186. package/nuxt/components/notificationProps.js +3 -0
  187. package/nuxt/components/overlayEmits.js +3 -0
  188. package/nuxt/components/overlayProps.js +3 -0
  189. package/nuxt/components/popoverProps.js +3 -0
  190. package/nuxt/components/tooltipProps.js +3 -0
  191. package/nuxt/components/uploadProps.js +3 -0
  192. package/nuxt/index.js +13 -0
  193. package/overlay/index.es.js +142 -198
  194. package/overlay/index.umd.js +1 -1
  195. package/overlay/style.css +1 -1
  196. package/package.json +10 -18
  197. package/pagination/index.es.js +1 -1
  198. package/pagination/style.css +1 -1
  199. package/panel/index.es.js +3 -3
  200. package/panel/index.umd.js +1 -1
  201. package/popover/index.es.js +5947 -189
  202. package/popover/index.umd.js +27 -1
  203. package/popover/style.css +1 -1
  204. package/progress/index.es.js +8 -8
  205. package/progress/index.umd.js +3 -3
  206. package/quadrant-diagram/index.es.js +5405 -166
  207. package/quadrant-diagram/index.umd.js +27 -1
  208. package/radio/index.es.js +5 -5
  209. package/radio/index.umd.js +1 -1
  210. package/radio/style.css +1 -1
  211. package/read-tip/index.es.js +17 -4
  212. package/read-tip/index.umd.js +1 -1
  213. package/read-tip/style.css +1 -1
  214. package/result/index.es.js +2 -1
  215. package/result/index.umd.js +1 -1
  216. package/ripple/index.es.js +1 -1
  217. package/search/index.es.js +5432 -198
  218. package/search/index.umd.js +27 -1
  219. package/search/style.css +1 -1
  220. package/select/index.es.js +3 -2
  221. package/select/index.umd.js +1 -1
  222. package/select/style.css +1 -1
  223. package/slider/index.es.js +2 -5
  224. package/slider/index.umd.js +1 -1
  225. package/slider/style.css +1 -1
  226. package/splitter/index.es.js +5881 -36
  227. package/splitter/index.umd.js +27 -1
  228. package/splitter/style.css +1 -1
  229. package/statistic/index.d.ts +7 -0
  230. package/statistic/index.es.js +267 -0
  231. package/statistic/index.umd.js +1 -0
  232. package/statistic/package.json +7 -0
  233. package/statistic/style.css +1 -0
  234. package/status/index.es.js +1 -1
  235. package/status/index.umd.js +1 -1
  236. package/status/style.css +1 -1
  237. package/steps-guide/index.es.js +8 -6
  238. package/steps-guide/index.umd.js +1 -1
  239. package/sticky/index.umd.js +1 -1
  240. package/style.css +1 -1
  241. package/table/index.es.js +698 -358
  242. package/table/index.umd.js +1 -1
  243. package/table/style.css +1 -1
  244. package/tabs/index.es.js +3 -4
  245. package/tabs/index.umd.js +1 -1
  246. package/tabs/style.css +1 -1
  247. package/tag/index.es.js +2 -2
  248. package/tag/index.umd.js +1 -1
  249. package/tag/style.css +1 -1
  250. package/tag-input/index.es.js +0 -12
  251. package/tag-input/index.umd.js +1 -1
  252. package/textarea/style.css +1 -1
  253. package/{theme → theme/theme.scss} +0 -0
  254. package/time-axis/index.es.js +2 -1
  255. package/time-axis/index.umd.js +1 -1
  256. package/time-picker/index.es.js +269 -84
  257. package/time-picker/index.umd.js +1 -1
  258. package/time-picker/style.css +1 -1
  259. package/tooltip/index.es.js +5798 -141
  260. package/tooltip/index.umd.js +27 -1
  261. package/tooltip/style.css +1 -1
  262. package/transfer/index.es.js +6522 -635
  263. package/transfer/index.umd.js +27 -1
  264. package/transfer/style.css +1 -1
  265. package/tree/index.es.js +5775 -192
  266. package/tree/index.umd.js +27 -1
  267. package/tree/style.css +1 -1
  268. package/tree-select/index.es.js +130 -35
  269. package/tree-select/index.umd.js +1 -1
  270. package/tree-select/style.css +1 -1
  271. package/upload/index.es.js +463 -2680
  272. package/upload/index.umd.js +1 -1
  273. package/upload/style.css +1 -1
  274. package/vue-devui.es.js +14630 -14010
  275. package/vue-devui.umd.js +18 -18
  276. package/toast/index.es.js +0 -2059
  277. package/toast/index.umd.js +0 -1
  278. package/toast/style.css +0 -1
@@ -21,37 +21,25 @@ 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: () => []
31
- },
32
- life: {
33
- type: Number,
34
- default: null
35
- },
36
- lifeMode: {
37
- type: String,
38
- default: "global"
39
- },
40
- sticky: {
24
+ import { defineComponent, createVNode, toRefs, computed, watch, Transition, reactive, createApp, onUnmounted, mergeProps, isVNode, ref, withDirectives, resolveComponent, resolveDirective } from "vue";
25
+ const notificationProps = {
26
+ modelValue: {
41
27
  type: Boolean,
42
28
  default: false
43
29
  },
44
- style: {
45
- type: Object,
46
- default: () => ({})
30
+ title: {
31
+ type: String,
32
+ default: ""
47
33
  },
48
- styleClass: {
49
- type: String
34
+ type: {
35
+ type: String,
36
+ default: "normal"
50
37
  },
51
- onCloseEvent: {
52
- type: Function
38
+ duration: {
39
+ type: Number,
40
+ default: 3e3
53
41
  },
54
- onValueChange: {
42
+ onClose: {
55
43
  type: Function
56
44
  }
57
45
  };
@@ -89,7 +77,8 @@ var Icon = defineComponent({
89
77
  "src": name,
90
78
  "alt": name.split("/")[name.split("/").length - 1],
91
79
  "style": {
92
- width: size
80
+ width: size,
81
+ verticalAlign: "text-bottom"
93
82
  }
94
83
  }, null) : createVNode("i", {
95
84
  "class": `${classPrefix} ${classPrefix}-${name}`,
@@ -103,2112 +92,395 @@ var Icon = defineComponent({
103
92
  Icon.install = function(app) {
104
93
  app.component(Icon.name, Icon);
105
94
  };
106
- var ToastIconClose = defineComponent({
107
- name: "DToastIconClose",
108
- props: {
109
- prefixCls: String,
110
- onClick: Function
111
- },
95
+ var Close = defineComponent({
112
96
  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)
97
+ setup(props, {
98
+ emit
99
+ }) {
100
+ return () => createVNode("div", {
101
+ "class": "devui-notification-icon-close",
102
+ "onClick": (e) => emit("click", e)
122
103
  }, [createVNode(Icon, {
123
104
  "name": "close",
124
105
  "size": "14px"
125
106
  }, null)]);
126
107
  }
127
108
  });
128
- var ToastImage = defineComponent({
129
- name: "DToastImage",
109
+ var TypeIcon = defineComponent({
130
110
  props: {
131
- prefixCls: String,
132
- severity: String
111
+ type: {
112
+ type: String,
113
+ default: "normal"
114
+ }
133
115
  },
134
- render() {
116
+ setup(props) {
135
117
  const {
136
- prefixCls,
137
- severity
138
- } = this;
139
- const wrapperCls = [`${prefixCls}-image`, `${prefixCls}-image-${severity || "common"}`];
118
+ type
119
+ } = toRefs(props);
120
+ const classes = computed(() => ({
121
+ "devui-notification-image": true,
122
+ [`devui-notification-image-${type.value}`]: true
123
+ }));
140
124
  const severityIconMap = {
141
125
  info: "info-o",
142
126
  success: "right-o",
143
- warn: "warning-o",
127
+ warning: "warning-o",
144
128
  error: "error-o"
145
129
  };
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]);
130
+ return () => createVNode("span", {
131
+ "class": classes.value
132
+ }, [type.value !== "normal" && createVNode(Icon, {
133
+ "name": severityIconMap[type.value],
134
+ "size": "16px"
135
+ }, null)]);
153
136
  }
154
137
  });
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];
138
+ function useNotification(props) {
139
+ const classes = computed(() => ({
140
+ "devui-notification-item-container": true,
141
+ [`devui-notification-message-${props.type}`]: true
142
+ }));
143
+ return { classes };
144
+ }
145
+ function useEvent(props, emit) {
146
+ let timer = null;
147
+ let timestamp;
148
+ const close2 = () => {
149
+ var _a;
150
+ clearTimeout(timer);
151
+ timer = null;
152
+ (_a = props.onClose) == null ? void 0 : _a.call(props);
153
+ emit("update:modelValue", false);
154
+ };
155
+ const interrupt = () => {
156
+ if (timer) {
157
+ clearTimeout(timer);
158
+ timer = null;
159
+ }
160
+ };
161
+ const removeReset = () => {
162
+ if (!props.modelValue) {
163
+ const remainTime = props.duration - (Date.now() - timestamp);
164
+ timer = setTimeout(close2, remainTime);
165
+ }
166
+ };
167
+ const handleDestroy = () => {
168
+ emit("destroy");
169
+ };
170
+ watch(() => props.modelValue, (val) => {
171
+ if (val) {
172
+ timestamp = Date.now();
173
+ if (props.duration) {
174
+ timer = setTimeout(close2, props.duration);
175
+ }
179
176
  }
177
+ });
178
+ return { interrupt, removeReset, close: close2, handleDestroy };
179
+ }
180
+ var notification = "";
181
+ var Notification = defineComponent({
182
+ name: "DNotification",
183
+ props: notificationProps,
184
+ emits: ["update:modelValue", "destroy"],
185
+ setup(props, {
186
+ emit,
187
+ slots
188
+ }) {
189
+ const {
190
+ modelValue,
191
+ title,
192
+ type
193
+ } = toRefs(props);
194
+ const {
195
+ classes
196
+ } = useNotification(props);
197
+ const {
198
+ interrupt,
199
+ removeReset,
200
+ close: close2,
201
+ handleDestroy
202
+ } = useEvent(props, emit);
203
+ return () => createVNode(Transition, {
204
+ "name": "notification-fade",
205
+ "onAfterLeave": handleDestroy
206
+ }, {
207
+ default: () => {
208
+ var _a;
209
+ return [modelValue.value && createVNode("div", {
210
+ "class": "devui-notification"
211
+ }, [createVNode("div", {
212
+ "class": classes.value,
213
+ "onMouseenter": interrupt,
214
+ "onMouseleave": removeReset
215
+ }, [createVNode("div", {
216
+ "class": "devui-notification-item"
217
+ }, [createVNode(Close, {
218
+ "onClick": close2
219
+ }, null), title.value && createVNode(TypeIcon, {
220
+ "type": type.value
221
+ }, null), createVNode("div", {
222
+ "class": "devui-notification-message"
223
+ }, [createVNode("span", {
224
+ "class": "devui-notification-title"
225
+ }, [title.value]), createVNode("span", {
226
+ "class": "devui-notification-content"
227
+ }, [(_a = slots.default) == null ? void 0 : _a.call(slots)])])])])])];
228
+ }
229
+ });
180
230
  }
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;
231
+ });
232
+ function _isSlot(s) {
233
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
284
234
  }
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) {
235
+ const defaultOptions = {
236
+ modelValue: false,
237
+ duration: 3e3,
238
+ type: "normal"
239
+ };
240
+ function initInstance(props, content) {
241
+ const container = document.createElement("div");
242
+ const app = createApp({
243
+ setup() {
244
+ onUnmounted(() => {
245
+ document.body.removeChild(container);
246
+ });
247
+ return () => createVNode(Notification, mergeProps(props, {
248
+ "onDestroy": app.unmount
249
+ }), _isSlot(content) ? content : {
250
+ default: () => [content]
251
+ });
292
252
  }
293
- try {
294
- return func + "";
295
- } catch (e) {
253
+ });
254
+ document.body.appendChild(container);
255
+ app.mount(container);
256
+ return app;
257
+ }
258
+ function close(props, originOnClose) {
259
+ props.modelValue = false;
260
+ originOnClose == null ? void 0 : originOnClose();
261
+ }
262
+ class NotificationService {
263
+ static open(options) {
264
+ const originOnClose = options.onClose || null;
265
+ const content = options.content;
266
+ let timer;
267
+ delete options.content;
268
+ const props = reactive(__spreadProps(__spreadValues(__spreadValues({}, defaultOptions), options), {
269
+ onClose: () => {
270
+ close(props, originOnClose);
271
+ }
272
+ }));
273
+ initInstance(props, content);
274
+ props.modelValue = true;
275
+ clearTimeout(timer);
276
+ if (options.duration) {
277
+ timer = setTimeout(props.onClose, options.duration);
296
278
  }
297
279
  }
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
280
  }
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]);
281
+ class IUploadOptions {
282
+ constructor() {
283
+ __publicField(this, "uri");
284
+ __publicField(this, "method");
285
+ __publicField(this, "maximumSize");
286
+ __publicField(this, "headers");
287
+ __publicField(this, "authToken");
288
+ __publicField(this, "authTokenHeader");
289
+ __publicField(this, "additionalParameter");
290
+ __publicField(this, "fileFieldName");
291
+ __publicField(this, "checkSameName");
292
+ __publicField(this, "withCredentials");
293
+ __publicField(this, "responseType");
350
294
  }
351
- return func.apply(thisArg, args);
352
295
  }
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];
296
+ class IFileOptions {
297
+ constructor() {
298
+ __publicField(this, "accept");
299
+ __publicField(this, "multiple");
300
+ __publicField(this, "webkitdirectory");
358
301
  }
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
302
  }
383
- var defineProperty = function() {
384
- try {
385
- var func = getNative(Object, "defineProperty");
386
- func({}, "", {});
387
- return func;
388
- } catch (e) {
303
+ var UploadStatus = /* @__PURE__ */ ((UploadStatus2) => {
304
+ UploadStatus2[UploadStatus2["preLoad"] = 0] = "preLoad";
305
+ UploadStatus2[UploadStatus2["uploading"] = 1] = "uploading";
306
+ UploadStatus2[UploadStatus2["uploaded"] = 2] = "uploaded";
307
+ UploadStatus2[UploadStatus2["failed"] = 3] = "failed";
308
+ return UploadStatus2;
309
+ })(UploadStatus || {});
310
+ const uploadProps = {
311
+ accept: {
312
+ type: String
313
+ },
314
+ webkitdirectory: {
315
+ type: Boolean,
316
+ default: false
317
+ },
318
+ uploadOptions: {
319
+ type: Object
320
+ },
321
+ multiple: {
322
+ type: Boolean,
323
+ default: false
324
+ },
325
+ autoUpload: {
326
+ type: Boolean,
327
+ default: true
328
+ },
329
+ placeholder: {
330
+ type: String,
331
+ default: "\u9009\u62E9\u6587\u4EF6"
332
+ },
333
+ modelValue: {
334
+ type: Array,
335
+ default: () => []
336
+ },
337
+ droppable: {
338
+ type: Boolean,
339
+ default: false
340
+ },
341
+ beforeUpload: {
342
+ type: Function
343
+ },
344
+ dynamicUploadOptionsFn: {
345
+ type: Function
346
+ },
347
+ disabled: {
348
+ type: Boolean,
349
+ default: false
350
+ },
351
+ onChange: {
352
+ type: Function
353
+ },
354
+ fileDrop: {
355
+ type: Function,
356
+ default: void 0
357
+ },
358
+ fileOver: {
359
+ type: Function,
360
+ default: void 0
361
+ },
362
+ fileSelect: {
363
+ type: Function,
364
+ default: void 0
365
+ },
366
+ deleteUploadedFile: {
367
+ type: Function,
368
+ default: void 0
369
+ },
370
+ "on-error": {
371
+ type: Function,
372
+ default: void 0
373
+ },
374
+ "on-success": {
375
+ type: Function,
376
+ default: void 0
377
+ },
378
+ oneTimeUpload: {
379
+ type: Boolean,
380
+ default: false
389
381
  }
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
382
  };
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
383
+ 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`;
384
+ const getBeyondMaximalFileSizeMsg = (filename, maximalSize) => {
385
+ 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`;
386
+ };
387
+ const getNotAllowedFileTypeMsg = (filename, scope) => {
388
+ 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`;
389
+ };
390
+ const getExistSameNameFilesMsg = (sameNames) => {
391
+ return `\u60A8\u4E0A\u4F20\u7684 "${sameNames}" \u5B58\u5728\u91CD\u540D\u6587\u4EF6, \u8BF7\u91CD\u65B0\u9009\u62E9\u6587\u4EF6`;
392
+ };
393
+ const useSelectFiles = () => {
394
+ const BEYOND_MAXIMAL_FILE_SIZE_MSG = ref("");
395
+ const simulateClickEvent = (input) => {
396
+ const evt = document.createEvent("MouseEvents");
397
+ evt.initMouseEvent("click", true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
398
+ input.dispatchEvent(evt);
399
+ };
400
+ const selectFiles = ({ multiple, accept, webkitdirectory }) => {
401
+ return new Promise((resolve) => {
402
+ const tempNode = document.getElementById("d-upload-temp");
403
+ if (tempNode) {
404
+ document.body.removeChild(tempNode);
405
+ }
406
+ const input = document.createElement("input");
407
+ input.style.position = "fixed";
408
+ input.style.left = "-2000px";
409
+ input.style.top = "-2000px";
410
+ input.setAttribute("id", "d-upload-temp");
411
+ input.setAttribute("type", "file");
412
+ if (multiple) {
413
+ input.setAttribute("multiple", "");
414
+ }
415
+ if (accept) {
416
+ input.setAttribute("accept", accept);
417
+ }
418
+ if (webkitdirectory) {
419
+ input.setAttribute("webkitdirectory", "");
420
+ }
421
+ input.addEventListener("change", (event) => {
422
+ resolve(Array.prototype.slice.call(event.target.files));
423
+ });
424
+ document.body.appendChild(input);
425
+ simulateClickEvent(input);
426
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];
427
+ };
428
+ const isAllowedFileType = (accept, file) => {
429
+ if (accept) {
430
+ const acceptArr = accept.split(",");
431
+ const baseMimeType = file.type.replace(/\/.*$/, "");
432
+ return acceptArr.some((type) => {
433
+ const validType = type.trim();
434
+ if (validType.startsWith(".")) {
435
+ return file.name.toLowerCase().indexOf(validType.toLowerCase(), file.name.toLowerCase().length - validType.toLowerCase().length) > -1;
436
+ } else if (/\/\*$/.test(validType)) {
437
+ return baseMimeType === validType.replace(/\/.*$/, "");
438
+ }
439
+ return file.type === validType;
440
+ });
472
441
  }
473
- otherArgs[start] = transform(array);
474
- return apply(func, this, otherArgs);
442
+ return true;
475
443
  };
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)) {
444
+ const beyondMaximalSize = (fileSize, maximumSize) => {
445
+ if (maximumSize) {
446
+ return fileSize > 1024 * 1024 * maximumSize;
447
+ }
489
448
  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;
449
+ };
450
+ const _validateFiles = (file, accept, uploadOptions) => {
451
+ if (!isAllowedFileType(accept, file)) {
452
+ return {
453
+ checkError: true,
454
+ errorMsg: getNotAllowedFileTypeMsg(file.name, accept)
455
+ };
504
456
  }
505
- object = Object(object);
506
- while (++index2 < length) {
507
- var source = sources[index2];
508
- if (source) {
509
- assigner(object, source, index2, customizer);
510
- }
457
+ if (uploadOptions && beyondMaximalSize(file.size, uploadOptions.maximumSize)) {
458
+ return {
459
+ checkError: true,
460
+ errorMsg: getBeyondMaximalFileSizeMsg(file.name, uploadOptions.maximumSize)
461
+ };
511
462
  }
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;
463
+ return { checkError: false, errorMsg: void 0 };
1480
464
  };
1481
- }
1482
- var baseFor = createBaseFor();
1483
- var baseFor$1 = baseFor;
1484
- var now = function() {
1485
- return root$1.Date.now();
1486
- };
1487
- var now$1 = now;
1488
- var FUNC_ERROR_TEXT$1 = "Expected a function";
1489
- var nativeMax = Math.max, nativeMin = Math.min;
1490
- function debounce(func, wait, options) {
1491
- var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
1492
- if (typeof func != "function") {
1493
- throw new TypeError(FUNC_ERROR_TEXT$1);
1494
- }
1495
- wait = toNumber(wait) || 0;
1496
- if (isObject(options)) {
1497
- leading = !!options.leading;
1498
- maxing = "maxWait" in options;
1499
- maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
1500
- trailing = "trailing" in options ? !!options.trailing : trailing;
1501
- }
1502
- function invokeFunc(time) {
1503
- var args = lastArgs, thisArg = lastThis;
1504
- lastArgs = lastThis = void 0;
1505
- lastInvokeTime = time;
1506
- result = func.apply(thisArg, args);
1507
- return result;
1508
- }
1509
- function leadingEdge(time) {
1510
- lastInvokeTime = time;
1511
- timerId = setTimeout(timerExpired, wait);
1512
- return leading ? invokeFunc(time) : result;
1513
- }
1514
- function remainingWait(time) {
1515
- var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
1516
- return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
1517
- }
1518
- function shouldInvoke(time) {
1519
- var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
1520
- return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
1521
- }
1522
- function timerExpired() {
1523
- var time = now$1();
1524
- if (shouldInvoke(time)) {
1525
- return trailingEdge(time);
1526
- }
1527
- timerId = setTimeout(timerExpired, remainingWait(time));
1528
- }
1529
- function trailingEdge(time) {
1530
- timerId = void 0;
1531
- if (trailing && lastArgs) {
1532
- return invokeFunc(time);
1533
- }
1534
- lastArgs = lastThis = void 0;
1535
- return result;
1536
- }
1537
- function cancel() {
1538
- if (timerId !== void 0) {
1539
- clearTimeout(timerId);
1540
- }
1541
- lastInvokeTime = 0;
1542
- lastArgs = lastCallTime = lastThis = timerId = void 0;
1543
- }
1544
- function flush() {
1545
- return timerId === void 0 ? result : trailingEdge(now$1());
1546
- }
1547
- function debounced() {
1548
- var time = now$1(), isInvoking = shouldInvoke(time);
1549
- lastArgs = arguments;
1550
- lastThis = this;
1551
- lastCallTime = time;
1552
- if (isInvoking) {
1553
- if (timerId === void 0) {
1554
- return leadingEdge(lastCallTime);
1555
- }
1556
- if (maxing) {
1557
- clearTimeout(timerId);
1558
- timerId = setTimeout(timerExpired, wait);
1559
- return invokeFunc(lastCallTime);
1560
- }
1561
- }
1562
- if (timerId === void 0) {
1563
- timerId = setTimeout(timerExpired, wait);
1564
- }
1565
- return result;
1566
- }
1567
- debounced.cancel = cancel;
1568
- debounced.flush = flush;
1569
- return debounced;
1570
- }
1571
- function assignMergeValue(object, key, value) {
1572
- if (value !== void 0 && !eq(object[key], value) || value === void 0 && !(key in object)) {
1573
- baseAssignValue(object, key, value);
1574
- }
1575
- }
1576
- function isArrayLikeObject(value) {
1577
- return isObjectLike(value) && isArrayLike(value);
1578
- }
1579
- function safeGet(object, key) {
1580
- if (key === "constructor" && typeof object[key] === "function") {
1581
- return;
1582
- }
1583
- if (key == "__proto__") {
1584
- return;
1585
- }
1586
- return object[key];
1587
- }
1588
- function toPlainObject(value) {
1589
- return copyObject(value, keysIn(value));
1590
- }
1591
- function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
1592
- var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
1593
- if (stacked) {
1594
- assignMergeValue(object, key, stacked);
1595
- return;
1596
- }
1597
- var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : void 0;
1598
- var isCommon = newValue === void 0;
1599
- if (isCommon) {
1600
- var isArr = isArray$1(srcValue), isBuff = !isArr && isBuffer$1(srcValue), isTyped = !isArr && !isBuff && isTypedArray$1(srcValue);
1601
- newValue = srcValue;
1602
- if (isArr || isBuff || isTyped) {
1603
- if (isArray$1(objValue)) {
1604
- newValue = objValue;
1605
- } else if (isArrayLikeObject(objValue)) {
1606
- newValue = copyArray(objValue);
1607
- } else if (isBuff) {
1608
- isCommon = false;
1609
- newValue = cloneBuffer(srcValue, true);
1610
- } else if (isTyped) {
1611
- isCommon = false;
1612
- newValue = cloneTypedArray(srcValue, true);
1613
- } else {
1614
- newValue = [];
1615
- }
1616
- } else if (isPlainObject(srcValue) || isArguments$1(srcValue)) {
1617
- newValue = objValue;
1618
- if (isArguments$1(objValue)) {
1619
- newValue = toPlainObject(objValue);
1620
- } else if (!isObject(objValue) || isFunction(objValue)) {
1621
- newValue = initCloneObject(srcValue);
1622
- }
1623
- } else {
1624
- isCommon = false;
1625
- }
1626
- }
1627
- if (isCommon) {
1628
- stack.set(srcValue, newValue);
1629
- mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
1630
- stack["delete"](srcValue);
1631
- }
1632
- assignMergeValue(object, key, newValue);
1633
- }
1634
- function baseMerge(object, source, srcIndex, customizer, stack) {
1635
- if (object === source) {
1636
- return;
1637
- }
1638
- baseFor$1(source, function(srcValue, key) {
1639
- stack || (stack = new Stack());
1640
- if (isObject(srcValue)) {
1641
- baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
1642
- } else {
1643
- var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : void 0;
1644
- if (newValue === void 0) {
1645
- newValue = srcValue;
1646
- }
1647
- assignMergeValue(object, key, newValue);
1648
- }
1649
- }, keysIn);
1650
- }
1651
- function last(array) {
1652
- var length = array == null ? 0 : array.length;
1653
- return length ? array[length - 1] : void 0;
1654
- }
1655
- function parent(object, path) {
1656
- return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
1657
- }
1658
- function isEqual(value, other) {
1659
- return baseIsEqual(value, other);
1660
- }
1661
- var merge = createAssigner(function(object, source, srcIndex) {
1662
- baseMerge(object, source, srcIndex);
1663
- });
1664
- var merge$1 = merge;
1665
- function baseUnset(object, path) {
1666
- path = castPath(path, object);
1667
- object = parent(object, path);
1668
- return object == null || delete object[toKey(last(path))];
1669
- }
1670
- function customOmitClone(value) {
1671
- return isPlainObject(value) ? void 0 : value;
1672
- }
1673
- var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4;
1674
- var omit = flatRest(function(object, paths) {
1675
- var result = {};
1676
- if (object == null) {
1677
- return result;
1678
- }
1679
- var isDeep = false;
1680
- paths = arrayMap(paths, function(path) {
1681
- path = castPath(path, object);
1682
- isDeep || (isDeep = path.length > 1);
1683
- return path;
1684
- });
1685
- copyObject(object, getAllKeysIn(object), result);
1686
- if (isDeep) {
1687
- result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
1688
- }
1689
- var length = paths.length;
1690
- while (length--) {
1691
- baseUnset(result, paths[length]);
1692
- }
1693
- return result;
1694
- });
1695
- var omit$1 = omit;
1696
- var FUNC_ERROR_TEXT = "Expected a function";
1697
- function throttle(func, wait, options) {
1698
- var leading = true, trailing = true;
1699
- if (typeof func != "function") {
1700
- throw new TypeError(FUNC_ERROR_TEXT);
1701
- }
1702
- if (isObject(options)) {
1703
- leading = "leading" in options ? !!options.leading : leading;
1704
- trailing = "trailing" in options ? !!options.trailing : trailing;
1705
- }
1706
- return debounce(func, wait, {
1707
- "leading": leading,
1708
- "maxWait": wait,
1709
- "trailing": trailing
1710
- });
1711
- }
1712
- function useToastConstant() {
1713
- const ANIMATION_NAME2 = "slide-in";
1714
- const ANIMATION_TIME2 = 300;
1715
- const ID_PREFIX2 = "toast-message";
1716
- return {
1717
- ANIMATION_TIME: ANIMATION_TIME2,
1718
- ANIMATION_NAME: ANIMATION_NAME2,
1719
- ID_PREFIX: ID_PREFIX2
465
+ const triggerSelectFiles = (fileOptions) => {
466
+ const { multiple, accept, webkitdirectory } = fileOptions;
467
+ return selectFiles({ multiple, accept, webkitdirectory });
468
+ };
469
+ const triggerDropFiles = (files) => {
470
+ return Promise.resolve(files);
471
+ };
472
+ const checkAllFilesSize = (fileSize, maximumSize) => {
473
+ if (beyondMaximalSize(fileSize, maximumSize)) {
474
+ BEYOND_MAXIMAL_FILE_SIZE_MSG.value = getAllFilesBeyondMaximalFileSizeMsg(maximumSize);
475
+ return { checkError: true, errorMsg: BEYOND_MAXIMAL_FILE_SIZE_MSG.value };
476
+ }
477
+ };
478
+ return {
479
+ triggerSelectFiles,
480
+ _validateFiles,
481
+ triggerDropFiles,
482
+ checkAllFilesSize
1720
483
  };
1721
- }
1722
- const { ANIMATION_TIME: ANIMATION_TIME$1 } = useToastConstant();
1723
- function useToastEvent() {
1724
- const ctx = getCurrentInstance();
1725
- function onCloseEvent(msg) {
1726
- ctx.emit("closeEvent", msg);
1727
- }
1728
- function onValueChange(msgs) {
1729
- ctx.emit("valueChange", msgs);
1730
- }
1731
- function onHidden() {
1732
- setTimeout(() => {
1733
- var _a, _b;
1734
- return (_b = (_a = ctx.attrs).onHidden) == null ? void 0 : _b.call(_a);
1735
- }, ANIMATION_TIME$1);
1736
- }
1737
- return { onCloseEvent, onValueChange, onHidden };
1738
- }
1739
- function useToastHelper() {
1740
- function severityDelay(msg) {
1741
- switch (msg.severity) {
1742
- case "warn":
1743
- case "error":
1744
- return 1e4;
1745
- default:
1746
- return 5e3;
1747
- }
1748
- }
1749
- return { severityDelay };
1750
- }
1751
- let toastZIndex = 1060;
1752
- function toastIncrease() {
1753
- toastZIndex++;
1754
- }
1755
- const {
1756
- ANIMATION_NAME,
1757
- ANIMATION_TIME,
1758
- ID_PREFIX
1759
- } = useToastConstant();
1760
- var Toast = defineComponent({
1761
- name: "DToast",
1762
- inheritAttrs: false,
1763
- props: toastProps,
1764
- emits: ["closeEvent", "valueChange"],
1765
- setup(props, ctx) {
1766
- const {
1767
- onCloseEvent,
1768
- onHidden,
1769
- onValueChange
1770
- } = useToastEvent();
1771
- const {
1772
- severityDelay
1773
- } = useToastHelper();
1774
- const removeThrottle = throttle(remove, ANIMATION_TIME);
1775
- const messages = ref([]);
1776
- const msgAnimations = ref([]);
1777
- const containerRef = ref();
1778
- const msgItemRefs = ref([]);
1779
- let timestamp = Date.now();
1780
- let timeout;
1781
- const timeoutArr = [];
1782
- const defaultLife = computed(() => {
1783
- if (props.life !== null)
1784
- return props.life;
1785
- if (messages.value.length > 0)
1786
- return severityDelay(messages.value[0]);
1787
- return 5e3;
1788
- });
1789
- watch(() => props.value, (value) => {
1790
- if (value.length === 0)
1791
- return;
1792
- if (hasMsgAnimation()) {
1793
- initValue();
1794
- }
1795
- nextTick(() => {
1796
- initValue(value);
1797
- handleValueChange();
1798
- });
1799
- }, {
1800
- deep: true,
1801
- immediate: true
1802
- });
1803
- watch(messages, (value) => {
1804
- value.length === 0 && msgAnimations.value.length > 0 && (msgAnimations.value = []);
1805
- });
1806
- watch(msgAnimations, (value, oldValue) => {
1807
- oldValue.length > 0 && value.length === 0 && onHidden();
1808
- });
1809
- onUnmounted(() => {
1810
- if (props.sticky) {
1811
- return;
1812
- }
1813
- if (props.lifeMode === "single") {
1814
- timeoutArr.forEach((t) => t && clearTimeout(t));
1815
- } else {
1816
- clearTimeout(timeout);
1817
- }
1818
- });
1819
- function initValue(value = []) {
1820
- const cloneValue = cloneDeep(value);
1821
- messages.value = cloneValue.map((v, i) => merge$1(v, {
1822
- id: `${ID_PREFIX}-${i}`
1823
- }));
1824
- msgAnimations.value = [];
1825
- }
1826
- function handleValueChange() {
1827
- toastIncrease();
1828
- setTimeout(() => {
1829
- messages.value.forEach((msg) => msgAnimations.value.push(msg));
1830
- }, 0);
1831
- if (props.sticky)
1832
- return;
1833
- if (timeout) {
1834
- timeout = clearTimeout(timeout);
1835
- }
1836
- if (timeoutArr.length > 0) {
1837
- timeoutArr.splice(0).forEach((t) => clearTimeout(t));
1838
- }
1839
- timestamp = Date.now();
1840
- if (props.lifeMode === "single") {
1841
- setTimeout(() => {
1842
- messages.value.forEach((msg, i) => {
1843
- timeoutArr[i] = setTimeout(() => singleModeRemove(msg, i), msg.life || severityDelay(msg));
1844
- });
1845
- });
1846
- } else {
1847
- timeout = setTimeout(() => removeAll(), defaultLife.value);
1848
- }
1849
- }
1850
- function singleModeRemove(msg, i) {
1851
- removeMsgAnimation(msg);
1852
- setTimeout(() => {
1853
- onCloseEvent(msg);
1854
- if (hasMsgAnimation()) {
1855
- messages.value.splice(i, 1);
1856
- } else {
1857
- messages.value = [];
1858
- }
1859
- onValueChange(messages.value);
1860
- }, ANIMATION_TIME);
1861
- }
1862
- function interrupt(i) {
1863
- if (!msgAnimations.value.includes(messages.value[i]))
1864
- return;
1865
- if (props.lifeMode === "single") {
1866
- if (timeoutArr[i]) {
1867
- timeoutArr[i] = clearTimeout(timeoutArr[i]);
1868
- }
1869
- } else {
1870
- resetDelay(() => {
1871
- messages.value.forEach((msg, _i) => i !== _i && removeMsgAnimation(msg));
1872
- });
1873
- }
1874
- }
1875
- function resetDelay(fn) {
1876
- if (!props.sticky && timeout) {
1877
- timeout = clearTimeout(timeout);
1878
- const remainTime = defaultLife.value - (Date.now() - timestamp);
1879
- timeout = setTimeout(() => fn(), remainTime);
1880
- }
1881
- }
1882
- function remove(i) {
1883
- if (props.lifeMode === "single" && timeoutArr[i]) {
1884
- timeoutArr[i] = clearTimeout(timeoutArr[i]);
1885
- timeoutArr.splice(i, 1);
1886
- }
1887
- removeMsgAnimation(messages.value[i]);
1888
- setTimeout(() => {
1889
- onCloseEvent(messages.value[i]);
1890
- messages.value.splice(i, 1);
1891
- onValueChange(messages.value);
1892
- if (props.lifeMode === "global") {
1893
- removeReset();
1894
- }
1895
- }, ANIMATION_TIME);
1896
- }
1897
- function removeAll() {
1898
- if (messages.value.length > 0) {
1899
- msgAnimations.value = [];
1900
- setTimeout(() => {
1901
- messages.value.forEach((msg) => onCloseEvent(msg));
1902
- messages.value = [];
1903
- onValueChange(messages.value);
1904
- }, ANIMATION_TIME);
1905
- }
1906
- }
1907
- function removeReset(i, msg) {
1908
- const removed = messages.value.findIndex((_msg) => _msg === msg) === -1;
1909
- if (removed || msg !== void 0 && !msgAnimations.value.includes(msg)) {
1910
- return;
1911
- }
1912
- if (props.lifeMode === "single") {
1913
- const msgLife = msg.life || severityDelay(msg);
1914
- const remainTime = msgLife - (Date.now() - timestamp);
1915
- timeoutArr[i] = setTimeout(() => singleModeRemove(msg, i), remainTime);
1916
- } else {
1917
- resetDelay(() => removeAll());
1918
- }
1919
- }
1920
- function removeIndexThrottle(i) {
1921
- if (i < msgItemRefs.value.length && i > -1) {
1922
- removeThrottle(i);
1923
- }
1924
- }
1925
- function removeMsgThrottle(msg) {
1926
- const ignoreDiffKeys = ["id"];
1927
- const index2 = messages.value.findIndex((_msg) => isEqual(omit$1(_msg, ignoreDiffKeys), omit$1(msg, ignoreDiffKeys)));
1928
- removeIndexThrottle(index2);
1929
- }
1930
- function removeMsgAnimation(msg) {
1931
- msgAnimations.value = msgAnimations.value.filter((_msg) => _msg !== msg);
1932
- }
1933
- function close(params) {
1934
- if (params === void 0) {
1935
- return removeAll();
1936
- }
1937
- if (typeof params === "number") {
1938
- removeIndexThrottle(params);
1939
- } else {
1940
- removeMsgThrottle(params);
1941
- }
1942
- }
1943
- function msgItemRef(i) {
1944
- return msgItemRefs.value[i];
1945
- }
1946
- function hasMsgAnimation() {
1947
- return msgAnimations.value.length > 0;
1948
- }
1949
- return {
1950
- messages,
1951
- msgAnimations,
1952
- containerRef,
1953
- msgItemRefs,
1954
- interrupt,
1955
- removeReset,
1956
- removeThrottle,
1957
- close,
1958
- msgItemRef
1959
- };
1960
- },
1961
- render() {
1962
- const {
1963
- style: extraStyle,
1964
- styleClass: extraClass,
1965
- messages,
1966
- msgAnimations,
1967
- msgItemRefs,
1968
- life,
1969
- interrupt,
1970
- removeReset,
1971
- removeThrottle,
1972
- $attrs,
1973
- $slots
1974
- } = this;
1975
- const prefixCls = "devui-toast";
1976
- const wrapperStyles = [`z-index: ${toastZIndex}`, extraStyle];
1977
- const wrapperCls = [prefixCls, extraClass];
1978
- const msgCls = (msg) => [`${prefixCls}-item-container`, `${prefixCls}-message-${msg.severity}`, {
1979
- [ANIMATION_NAME]: msgAnimations.includes(msg)
1980
- }];
1981
- const showClose = (msg) => !(!msg.summary && life !== null);
1982
- const showImage = (msg) => msg.severity !== "common";
1983
- const showSummary = (msg) => !!msg.summary;
1984
- const showContent = (msg) => !!msg.content;
1985
- const showDetail = (msg) => !showContent(msg) && !!msg.detail;
1986
- const msgContent = (msg) => {
1987
- var _a;
1988
- if (typeof msg.content === "function") {
1989
- return msg.content(msg);
1990
- }
1991
- if ([null, void 0].includes(msg.content)) {
1992
- return null;
1993
- }
1994
- const slotPrefix = "slot:";
1995
- const isSlot = String(msg.content).startsWith(slotPrefix);
1996
- if (isSlot) {
1997
- return (_a = $slots[msg.content.slice(slotPrefix.length)]) == null ? void 0 : _a.call($slots, msg);
1998
- }
1999
- return msg.content;
2000
- };
2001
- return createVNode("div", mergeProps({
2002
- "ref": "containerRef",
2003
- "style": wrapperStyles,
2004
- "class": wrapperCls
2005
- }, $attrs), [messages.map((msg, i) => createVNode("div", {
2006
- "ref": (el) => msgItemRefs[i] = el,
2007
- "key": msg.id,
2008
- "class": msgCls(msg),
2009
- "aria-live": "polite",
2010
- "onMouseenter": () => interrupt(i),
2011
- "onMouseleave": () => removeReset(i, msg)
2012
- }, [createVNode("div", {
2013
- "class": `${prefixCls}-item`
2014
- }, [showClose(msg) ? createVNode(ToastIconClose, {
2015
- "prefixCls": prefixCls,
2016
- "onClick": () => removeThrottle(i)
2017
- }, null) : null, showImage(msg) ? createVNode(ToastImage, {
2018
- "prefixCls": prefixCls,
2019
- "severity": msg.severity
2020
- }, null) : null, createVNode("div", {
2021
- "class": "devui-toast-message"
2022
- }, [showSummary(msg) ? createVNode("span", {
2023
- "class": "devui-toast-title"
2024
- }, [msg.summary]) : null, showContent(msg) ? msgContent(msg) : null, showDetail(msg) ? createVNode("p", {
2025
- "innerHTML": msg.detail
2026
- }, null) : null])])]))]);
2027
- }
2028
- });
2029
- function createToastApp(props) {
2030
- return createApp(Toast, props);
2031
- }
2032
- class ToastService {
2033
- static open(props) {
2034
- let $body = document.body;
2035
- let $div = document.createElement("div");
2036
- $body.appendChild($div);
2037
- let app = createToastApp(__spreadProps(__spreadValues({}, props != null ? props : {}), { onHidden: () => app == null ? void 0 : app.unmount() }));
2038
- let toastInstance = app.mount($div);
2039
- onUnmounted(() => {
2040
- $body.removeChild($div);
2041
- $body = null;
2042
- $div = null;
2043
- app = null;
2044
- toastInstance = null;
2045
- }, toastInstance.$);
2046
- return {
2047
- toastInstance
2048
- };
2049
- }
2050
- }
2051
- Toast.install = function(app) {
2052
- app.component(Toast.name, Toast);
2053
- };
2054
- var UploadStatus;
2055
- (function(UploadStatus2) {
2056
- UploadStatus2[UploadStatus2["preLoad"] = 0] = "preLoad";
2057
- UploadStatus2[UploadStatus2["uploading"] = 1] = "uploading";
2058
- UploadStatus2[UploadStatus2["uploaded"] = 2] = "uploaded";
2059
- UploadStatus2[UploadStatus2["failed"] = 3] = "failed";
2060
- })(UploadStatus || (UploadStatus = {}));
2061
- const uploadProps = {
2062
- uploadOptions: {
2063
- type: Object,
2064
- required: true
2065
- },
2066
- fileOptions: {
2067
- type: Object,
2068
- required: true
2069
- },
2070
- autoUpload: {
2071
- type: Boolean,
2072
- default: false
2073
- },
2074
- placeholderText: {
2075
- type: String,
2076
- default: "\u9009\u62E9\u6587\u4EF6"
2077
- },
2078
- uploadText: {
2079
- type: String,
2080
- default: "\u4E0A\u4F20"
2081
- },
2082
- uploadedFiles: {
2083
- type: Array,
2084
- default: () => []
2085
- },
2086
- withoutBtn: {
2087
- type: Boolean,
2088
- default: false
2089
- },
2090
- enableDrop: {
2091
- type: Boolean,
2092
- default: false
2093
- },
2094
- beforeUpload: {
2095
- type: Function
2096
- },
2097
- dynamicUploadOptionsFn: {
2098
- type: Function
2099
- },
2100
- disabled: {
2101
- type: Boolean,
2102
- default: false
2103
- },
2104
- showTip: {
2105
- type: Boolean,
2106
- default: false
2107
- },
2108
- onChange: {
2109
- type: Function
2110
- },
2111
- fileDrop: {
2112
- type: Function,
2113
- default: void 0
2114
- },
2115
- fileOver: {
2116
- type: Function,
2117
- default: void 0
2118
- },
2119
- fileSelect: {
2120
- type: Function,
2121
- default: void 0
2122
- },
2123
- errorEvent: {
2124
- type: Function,
2125
- default: void 0
2126
- },
2127
- successEvent: {
2128
- type: Function,
2129
- default: void 0
2130
- },
2131
- deleteUploadedFileEvent: {
2132
- type: Function,
2133
- default: void 0
2134
- }
2135
- };
2136
- const multiUploadProps = {
2137
- uploadOptions: {
2138
- type: Object,
2139
- required: true
2140
- },
2141
- fileOptions: {
2142
- type: Object,
2143
- required: true
2144
- },
2145
- autoUpload: {
2146
- type: Boolean,
2147
- default: false
2148
- },
2149
- withoutBtn: {
2150
- type: Boolean,
2151
- default: false
2152
- },
2153
- showTip: {
2154
- type: Boolean,
2155
- default: false
2156
- },
2157
- uploadedFiles: {
2158
- type: Array,
2159
- default: () => []
2160
- },
2161
- enableDrop: {
2162
- type: Boolean,
2163
- default: false
2164
- },
2165
- placeholderText: {
2166
- type: String,
2167
- default: "\u9009\u62E9\u6587\u4EF6"
2168
- },
2169
- uploadText: {
2170
- type: String,
2171
- default: "\u4E0A\u4F20"
2172
- },
2173
- oneTimeUpload: {
2174
- type: Boolean,
2175
- default: false
2176
- },
2177
- disabled: {
2178
- type: Boolean,
2179
- default: false
2180
- },
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
- }
2212
484
  };
2213
485
  class FileUploader {
2214
486
  constructor(file, uploadOptions) {
@@ -2224,17 +496,7 @@ class FileUploader {
2224
496
  }
2225
497
  send(uploadFiles) {
2226
498
  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;
499
+ const { uri, method, headers, authToken, authTokenHeader, additionalParameter, fileFieldName, withCredentials, responseType } = this.uploadOptions;
2238
500
  const authTokenHeader_ = authTokenHeader || "Authorization";
2239
501
  const fileFieldName_ = fileFieldName || "file";
2240
502
  this.xhr = new XMLHttpRequest();
@@ -2411,412 +673,24 @@ const useUpload = () => {
2411
673
  _oneTimeUpload
2412
674
  };
2413
675
  };
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
676
  var upload = "";
2538
677
  var Upload = defineComponent({
2539
- name: "DSingleUpload",
678
+ name: "DUpload",
2540
679
  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"],
680
+ emits: ["fileDrop", "fileOver", "fileSelect", "deleteUploadedFile", "update:modelValue"],
2806
681
  setup(props, ctx) {
2807
682
  const {
2808
683
  uploadOptions,
2809
- fileOptions,
2810
- placeholderText,
684
+ placeholder,
2811
685
  autoUpload,
2812
- withoutBtn,
2813
- uploadText,
2814
686
  disabled,
2815
687
  beforeUpload,
2816
- enableDrop,
688
+ droppable,
2817
689
  oneTimeUpload,
2818
- showTip,
2819
- uploadedFiles
690
+ modelValue,
691
+ multiple,
692
+ accept,
693
+ webkitdirectory
2820
694
  } = toRefs(props);
2821
695
  const {
2822
696
  triggerSelectFiles,
@@ -2825,7 +699,6 @@ var MultiUpload = defineComponent({
2825
699
  checkAllFilesSize
2826
700
  } = useSelectFiles();
2827
701
  const {
2828
- getFiles,
2829
702
  fileUploaders,
2830
703
  addFile,
2831
704
  getFullFiles,
@@ -2837,20 +710,18 @@ var MultiUpload = defineComponent({
2837
710
  getSameNameFiles
2838
711
  } = useUpload();
2839
712
  const isDropOVer = ref(false);
2840
- const uploadTips = ref("");
713
+ ref("");
2841
714
  const alertMsg = (errorMsg) => {
2842
- ToastService.open({
2843
- value: [{
2844
- severity: "warn",
2845
- content: errorMsg
2846
- }]
715
+ NotificationService.open({
716
+ type: "warning",
717
+ content: errorMsg
2847
718
  });
2848
719
  };
2849
720
  const checkValid = () => {
2850
721
  let totalFileSize = 0;
2851
722
  fileUploaders.value.forEach((fileUploader) => {
2852
723
  totalFileSize += fileUploader.file.size;
2853
- const checkResult = _validateFiles(fileUploader.file, fileOptions.value.accept, fileUploader.uploadOptions);
724
+ const checkResult = _validateFiles(fileUploader.file, accept.value, fileUploader.uploadOptions);
2854
725
  if (checkResult && checkResult.checkError) {
2855
726
  deleteFile(fileUploader.file);
2856
727
  alertMsg(checkResult.errorMsg);
@@ -2869,17 +740,20 @@ var MultiUpload = defineComponent({
2869
740
  resetSameNameFiles();
2870
741
  promise.then((files) => {
2871
742
  files.forEach((file) => {
743
+ if (!multiple.value) {
744
+ removeFiles();
745
+ }
2872
746
  addFile(file, uploadOptions.value);
2873
747
  });
2874
748
  checkValid();
2875
749
  const sameNameFiles = getSameNameFiles();
2876
- if (uploadOptions.value.checkSameName && sameNameFiles.length) {
750
+ if (uploadOptions.value && uploadOptions.value.checkSameName && sameNameFiles.length) {
2877
751
  alertMsg(getExistSameNameFilesMsg(sameNameFiles));
2878
752
  }
2879
753
  const selectedFiles = fileUploaders.value.filter((fileUploader) => fileUploader.status === UploadStatus.preLoad).map((fileUploader) => fileUploader.file);
2880
754
  ctx.emit("fileSelect", selectedFiles);
2881
755
  if (autoUpload.value) {
2882
- upload2();
756
+ fileUpload();
2883
757
  }
2884
758
  }).catch((error) => {
2885
759
  alertMsg(error.message);
@@ -2889,7 +763,11 @@ var MultiUpload = defineComponent({
2889
763
  if (disabled.value) {
2890
764
  return;
2891
765
  }
2892
- _dealFiles(triggerSelectFiles(fileOptions.value));
766
+ _dealFiles(triggerSelectFiles({
767
+ accept: accept.value,
768
+ multiple: multiple.value,
769
+ webkitdirectory: webkitdirectory.value
770
+ }));
2893
771
  };
2894
772
  const onFileDrop = (files) => {
2895
773
  isDropOVer.value = false;
@@ -2900,16 +778,19 @@ var MultiUpload = defineComponent({
2900
778
  isDropOVer.value = event;
2901
779
  ctx.emit("fileOver", event);
2902
780
  };
2903
- const onDeleteFile = (event, file) => {
2904
- event.stopPropagation();
2905
- deleteFile(file);
2906
- };
2907
781
  const deleteUploadedFile = (file) => {
2908
- const newUploadedFiles = uploadedFiles.value.filter((uploadedFile) => {
782
+ const newUploadedFiles = modelValue.value.filter((uploadedFile) => {
2909
783
  return uploadedFile.name !== file.name;
2910
784
  });
2911
- ctx.emit("deleteUploadedFileEvent", file);
2912
- ctx.emit("update:uploadedFiles", newUploadedFiles);
785
+ ctx.emit("deleteUploadedFile", file);
786
+ ctx.emit("update:modelValue", newUploadedFiles);
787
+ };
788
+ const onDeleteFile = (event, file, status) => {
789
+ event.stopPropagation();
790
+ if (status === UploadStatus.uploaded) {
791
+ deleteUploadedFile(file);
792
+ }
793
+ deleteFile(file);
2913
794
  };
2914
795
  const canUpload = () => {
2915
796
  let uploadResult = Promise.resolve(true);
@@ -2936,163 +817,69 @@ var MultiUpload = defineComponent({
2936
817
  }
2937
818
  const uploadObservable = oneTimeUpload.value ? _oneTimeUpload() : upload2(fileUploader);
2938
819
  uploadObservable.then((results) => {
2939
- ctx.emit("successEvent", results);
820
+ props["on-success"] && props["on-success"](results);
2940
821
  const newFiles = results.map((result) => result.file);
2941
- const newUploadedFiles = [...newFiles, ...uploadedFiles.value];
2942
- ctx.emit("update:uploadedFiles", newUploadedFiles);
822
+ const newUploadedFiles = [...newFiles, ...modelValue.value];
823
+ ctx.emit("update:modelValue", newUploadedFiles);
2943
824
  }).catch((error) => {
2944
- ctx.emit("errorEvent", error);
825
+ props["on-error"] && props["on-error"](error);
2945
826
  });
2946
827
  });
2947
828
  };
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
829
+ return () => {
830
+ var _a, _b, _c, _d;
831
+ return createVNode("div", null, [withDirectives(createVNode("div", {
832
+ "class": "devui-upload",
833
+ "style": `border: ${isDropOVer.value ? "1px solid #15bf15" : "0"}`
834
+ }, [((_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)) ? createVNode("div", {
835
+ "onClick": handleClick
836
+ }, [ctx.slots.default()]) : createVNode("div", {
837
+ "class": `devui-input-group ${disabled.value ? "disabled" : ""}`,
838
+ "onClick": handleClick
839
+ }, [fileUploaders.value.length === 0 && createVNode("div", {
840
+ "class": "devui-form-control devui-upload-placeholder"
841
+ }, [placeholder.value]), fileUploaders.value.length > 0 && createVNode("ul", {
842
+ "class": "devui-form-control devui-files-list"
843
+ }, [fileUploaders.value.map((fileUploader, index2) => createVNode("li", {
844
+ "key": index2,
845
+ "class": "devui-file-item devui-file-tag",
846
+ "style": "display: inline-block; margin: 0 2px 2px 0",
847
+ "title": fileUploader.file.name
848
+ }, [createVNode("span", {
849
+ "class": `devui-filename ${fileUploader.status === UploadStatus.failed ? "devui-failed-color" : ""}`
850
+ }, [fileUploader.file.name]), createVNode(resolveComponent("d-icon"), {
851
+ "name": "close",
852
+ "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" : ""}`,
853
+ "onClick": (event) => onDeleteFile(event, fileUploader.file, fileUploader.status)
854
+ }, null), fileUploader.status === UploadStatus.uploading && createVNode("div", {
855
+ "class": "icon devui-upload-progress"
856
+ }, [createVNode(resolveComponent("d-progress"), {
857
+ "isCircle": true,
858
+ "percentage": fileUploader.percentage,
859
+ "barbgcolor": "#50D4AB",
860
+ "strokeWidth": 8,
861
+ "showContent": false
862
+ }, null)]), fileUploader.status === UploadStatus.failed && createVNode(resolveComponent("d-icon"), {
863
+ "name": "running",
864
+ "onClick": fileUpload
865
+ }, null), fileUploader.status === UploadStatus.uploaded && createVNode(resolveComponent("d-icon"), {
866
+ "name": "right",
867
+ "color": "#50d4ab"
868
+ }, null)]))]), createVNode("span", {
869
+ "class": "devui-input-group-addon"
870
+ }, [createVNode(resolveComponent("d-icon"), {
871
+ "name": "more-operate",
872
+ "color": "#252b3a"
873
+ }, null)])])]), [[resolveDirective("file-drop"), {
874
+ droppable,
875
+ isSingle: !multiple,
876
+ onFileDrop,
877
+ onFileOver
878
+ }]]), createVNode("div", null, [(_d = (_c = ctx.slots)["uploaded-files"]) == null ? void 0 : _d.call(_c, {
879
+ uploadedFiles: modelValue.value,
880
+ deleteFile: deleteUploadedFile
881
+ })])]);
3009
882
  };
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
883
  }
3097
884
  });
3098
885
  const getTransfer = (event) => {
@@ -3147,14 +934,14 @@ const onDrop = (el, binding) => {
3147
934
  if (isSingle) {
3148
935
  onFileDrop && onFileDrop([transfer.files[0]]);
3149
936
  } else {
3150
- onFileDrop && onFileDrop(transfer.files);
937
+ onFileDrop && onFileDrop(Array.from(transfer.files));
3151
938
  }
3152
939
  });
3153
940
  };
3154
941
  const fileDropDirective = {
3155
942
  mounted: (el, binding) => {
3156
- const { enableDrop } = binding.value;
3157
- if (!enableDrop) {
943
+ const { droppable } = binding.value;
944
+ if (!droppable) {
3158
945
  return;
3159
946
  }
3160
947
  onDragOver(el, binding);
@@ -3162,17 +949,13 @@ const fileDropDirective = {
3162
949
  onDrop(el, binding);
3163
950
  }
3164
951
  };
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
952
  var index = {
3171
953
  title: "Upload \u4E0A\u4F20",
3172
954
  category: "\u6570\u636E\u5F55\u5165",
3173
955
  status: "100%",
3174
956
  install(app) {
3175
- app.use(Upload);
957
+ app.directive("file-drop", fileDropDirective);
958
+ app.component(Upload.name, Upload);
3176
959
  }
3177
960
  };
3178
- export { MultiUpload, Upload, index as default };
961
+ export { IFileOptions, IUploadOptions, Upload, UploadStatus, index as default, uploadProps };