vue-devui 1.0.0-rc.9 → 1.0.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.
- package/README.md +163 -149
- package/alert/index.es.js +12 -7
- package/alert/index.umd.js +1 -1
- package/alert/style.css +1 -1
- package/auto-complete/index.es.js +8019 -254
- package/auto-complete/index.umd.js +29 -3
- package/auto-complete/style.css +1 -1
- package/badge/index.es.js +8 -2
- package/badge/index.umd.js +1 -1
- package/badge/style.css +1 -1
- package/button/index.es.js +104 -40
- package/button/index.umd.js +15 -15
- package/button/style.css +1 -1
- package/card/index.es.js +5 -1
- package/card/index.umd.js +1 -1
- package/card/style.css +1 -1
- package/checkbox/index.es.js +7772 -81
- package/checkbox/index.umd.js +27 -1
- package/checkbox/style.css +1 -1
- package/{date-picker → collapse}/index.d.ts +0 -0
- package/collapse/index.es.js +213 -0
- package/collapse/index.umd.js +1 -0
- package/{date-picker → collapse}/package.json +1 -1
- package/collapse/style.css +1 -0
- package/countdown/index.es.js +56 -13
- package/countdown/index.umd.js +1 -1
- package/date-picker-pro/index.d.ts +7 -0
- package/date-picker-pro/index.es.js +12020 -0
- package/date-picker-pro/index.umd.js +27 -0
- package/date-picker-pro/package.json +7 -0
- package/date-picker-pro/style.css +1 -0
- package/drawer/index.es.js +1 -1
- package/drawer/index.umd.js +1 -1
- package/drawer/style.css +1 -1
- package/dropdown/index.es.js +77 -121
- package/dropdown/index.umd.js +1 -1
- package/dropdown/style.css +1 -1
- package/editable-select/index.es.js +324 -104
- package/editable-select/index.umd.js +1 -1
- package/editable-select/style.css +1 -1
- package/form/index.es.js +91 -118
- package/form/index.umd.js +14 -14
- package/form/style.css +1 -1
- package/icon/index.es.js +106 -41
- package/icon/index.umd.js +1 -1
- package/icon/style.css +1 -1
- package/image-preview/style.css +1 -1
- package/input/index.es.js +8088 -169
- package/input/index.umd.js +27 -1
- package/input/style.css +1 -1
- package/input-number/index.es.js +8 -9
- package/input-number/index.umd.js +1 -1
- package/input-number/style.css +1 -1
- package/layout/index.es.js +1 -1
- package/layout/index.umd.js +1 -1
- package/loading/style.css +1 -1
- package/mention/index.d.ts +7 -0
- package/mention/index.es.js +8310 -0
- package/mention/index.umd.js +36 -0
- package/mention/package.json +7 -0
- package/mention/style.css +1 -0
- package/menu/index.d.ts +7 -0
- package/menu/index.es.js +934 -0
- package/menu/index.umd.js +1 -0
- package/menu/package.json +7 -0
- package/menu/style.css +1 -0
- package/message/index.d.ts +7 -0
- package/message/index.es.js +538 -0
- package/message/index.umd.js +1 -0
- package/message/package.json +7 -0
- package/message/style.css +1 -0
- package/modal/index.es.js +275 -185
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/notification/index.es.js +143 -72
- package/notification/index.umd.js +1 -1
- package/notification/style.css +1 -1
- package/nuxt/components/Collapse.js +3 -0
- package/nuxt/components/CollapseItem.js +3 -0
- package/nuxt/components/DRangeDatePickerPro.js +3 -0
- package/nuxt/components/DatePickerPro.js +3 -0
- package/nuxt/components/IconGroup.js +3 -0
- package/nuxt/components/Mention.js +3 -0
- package/nuxt/components/Menu.js +3 -0
- package/nuxt/components/MenuItem.js +3 -0
- package/nuxt/components/Message.js +3 -0
- package/nuxt/components/OptionGroup.js +3 -0
- package/nuxt/components/RadioButton.js +3 -0
- package/nuxt/components/Step.js +3 -0
- package/nuxt/components/Steps.js +3 -0
- package/nuxt/components/SubMenu.js +3 -0
- package/nuxt/components/TABLE_TOKEN.js +3 -0
- package/nuxt/components/TimePicker.js +3 -0
- package/nuxt/components/TimeSelect.js +3 -0
- package/nuxt/components/animationInjectionKey.js +3 -0
- package/nuxt/components/collapseItemProps.js +3 -0
- package/nuxt/components/collapseProps.js +3 -0
- package/nuxt/components/datePickerProCommonProps.js +3 -0
- package/nuxt/components/datePickerProPanelProps.js +3 -0
- package/nuxt/components/datePickerProProps.js +3 -0
- package/nuxt/components/mentionProps.js +3 -0
- package/nuxt/components/messageProps.js +3 -0
- package/nuxt/components/roundInjectionKey.js +3 -0
- package/nuxt/components/skeletonItemProps.js +3 -0
- package/nuxt/components/stepProps.js +3 -0
- package/nuxt/components/stepsProps.js +3 -0
- package/nuxt/components/tableProps.js +3 -0
- package/nuxt/components/timerPickerPanelProps.js +3 -0
- package/nuxt/components/treeNodeProps.js +3 -0
- package/overlay/index.es.js +76 -139
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +6 -3
- package/pagination/index.es.js +175 -7
- package/pagination/index.umd.js +1 -1
- package/pagination/style.css +1 -1
- package/panel/style.css +1 -1
- package/popover/index.es.js +101 -162
- package/popover/index.umd.js +17 -17
- package/popover/style.css +1 -1
- package/progress/style.css +1 -1
- package/radio/index.es.js +7854 -58
- package/radio/index.umd.js +27 -1
- package/radio/style.css +1 -1
- package/rate/style.css +1 -1
- package/result/index.es.js +92 -41
- package/result/index.umd.js +1 -1
- package/result/style.css +1 -1
- package/search/index.es.js +3729 -1206
- package/search/index.umd.js +18 -18
- package/search/style.css +1 -1
- package/select/index.es.js +4426 -2501
- package/select/index.umd.js +17 -17
- package/select/style.css +1 -1
- package/skeleton/index.es.js +87 -261
- package/skeleton/index.umd.js +1 -1
- package/skeleton/style.css +1 -1
- package/slider/index.es.js +116 -143
- package/slider/index.umd.js +1 -1
- package/slider/style.css +1 -1
- package/splitter/index.es.js +256 -147
- package/splitter/index.umd.js +16 -16
- package/splitter/style.css +1 -1
- package/statistic/index.es.js +34 -16
- package/statistic/index.umd.js +1 -1
- package/statistic/style.css +1 -1
- package/status/style.css +1 -1
- package/steps/index.d.ts +7 -0
- package/steps/index.es.js +386 -0
- package/steps/index.umd.js +1 -0
- package/steps/package.json +7 -0
- package/steps/style.css +1 -0
- package/style.css +1 -1
- package/switch/index.es.js +7779 -60
- package/switch/index.umd.js +27 -1
- package/switch/style.css +1 -1
- package/table/index.es.js +4092 -1464
- package/table/index.umd.js +17 -17
- package/table/style.css +1 -1
- package/tabs/index.es.js +224 -77
- package/tabs/index.umd.js +1 -1
- package/tabs/style.css +1 -1
- package/tag/index.es.js +5 -1
- package/tag/index.umd.js +1 -1
- package/tag/style.css +1 -1
- package/textarea/index.es.js +3357 -1064
- package/textarea/index.umd.js +19 -19
- package/textarea/style.css +1 -1
- package/time-picker/index.d.ts +7 -0
- package/time-picker/index.es.js +9549 -0
- package/time-picker/index.umd.js +27 -0
- package/time-picker/package.json +7 -0
- package/time-picker/style.css +1 -0
- package/time-select/index.d.ts +7 -0
- package/time-select/index.es.js +9585 -0
- package/time-select/index.umd.js +27 -0
- package/time-select/package.json +7 -0
- package/time-select/style.css +1 -0
- package/timeline/index.es.js +92 -41
- package/timeline/index.umd.js +1 -1
- package/timeline/style.css +1 -1
- package/tooltip/index.es.js +100 -163
- package/tooltip/index.umd.js +16 -16
- package/tooltip/style.css +1 -1
- package/tree/index.es.js +11036 -608
- package/tree/index.umd.js +27 -1
- package/tree/style.css +1 -1
- package/upload/index.es.js +389 -105
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +17291 -9726
- package/vue-devui.umd.js +24 -23
- package/date-picker/index.es.js +0 -1298
- package/date-picker/index.umd.js +0 -1
- package/date-picker/style.css +0 -1
- package/nuxt/components/DatePicker.js +0 -3
- package/nuxt/components/StickSlider.js +0 -3
- package/nuxt/components/formControlProps.js +0 -3
- package/nuxt/components/overlayEmits.js +0 -3
- package/nuxt/components/overlayProps.js +0 -3
package/upload/index.es.js
CHANGED
|
@@ -21,7 +21,7 @@ var __publicField = (obj, key, value) => {
|
|
|
21
21
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
22
22
|
return value;
|
|
23
23
|
};
|
|
24
|
-
import { defineComponent, toRefs, computed, createVNode, resolveDynamicComponent, mergeProps, watch, Transition, reactive, createApp, onUnmounted, isVNode, ref, withDirectives, resolveComponent, resolveDirective } from "vue";
|
|
24
|
+
import { defineComponent, toRefs, computed, createVNode, resolveDynamicComponent, mergeProps, watch, Transition, reactive, createApp, onUnmounted, isVNode, ref, getCurrentInstance, withDirectives, resolveComponent, resolveDirective } from "vue";
|
|
25
25
|
const notificationProps = {
|
|
26
26
|
modelValue: {
|
|
27
27
|
type: Boolean,
|
|
@@ -43,9 +43,6 @@ const notificationProps = {
|
|
|
43
43
|
type: Function
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
|
-
function isUrl(value) {
|
|
47
|
-
return /^((http|https):)?\/\//.test(value);
|
|
48
|
-
}
|
|
49
46
|
const DEFAULT_PREFIX = "icon";
|
|
50
47
|
const iconProps = {
|
|
51
48
|
name: {
|
|
@@ -68,6 +65,17 @@ const iconProps = {
|
|
|
68
65
|
classPrefix: {
|
|
69
66
|
type: String,
|
|
70
67
|
default: DEFAULT_PREFIX
|
|
68
|
+
},
|
|
69
|
+
operable: {
|
|
70
|
+
type: Boolean,
|
|
71
|
+
default: false
|
|
72
|
+
},
|
|
73
|
+
disabled: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: false
|
|
76
|
+
},
|
|
77
|
+
rotate: {
|
|
78
|
+
type: [Number, String]
|
|
71
79
|
}
|
|
72
80
|
};
|
|
73
81
|
const svgIconProps = {
|
|
@@ -138,51 +146,107 @@ var svgIcon = defineComponent({
|
|
|
138
146
|
};
|
|
139
147
|
}
|
|
140
148
|
});
|
|
149
|
+
function isUrl(value) {
|
|
150
|
+
return /^((http|https):)?\/\//.test(value);
|
|
151
|
+
}
|
|
152
|
+
function useIconDom(props, ctx) {
|
|
153
|
+
const {
|
|
154
|
+
component,
|
|
155
|
+
name,
|
|
156
|
+
size,
|
|
157
|
+
color,
|
|
158
|
+
classPrefix,
|
|
159
|
+
rotate
|
|
160
|
+
} = toRefs(props);
|
|
161
|
+
const ns2 = useNamespace("icon");
|
|
162
|
+
const iconSize = computed(() => {
|
|
163
|
+
return typeof size.value === "number" ? `${size.value}px` : size.value;
|
|
164
|
+
});
|
|
165
|
+
const IconComponent = component.value ? resolveDynamicComponent(component.value) : resolveDynamicComponent(svgIcon);
|
|
166
|
+
const imgIconDom = () => {
|
|
167
|
+
return createVNode("img", mergeProps({
|
|
168
|
+
"src": name.value,
|
|
169
|
+
"alt": name.value.split("/")[name.value.split("/").length - 1],
|
|
170
|
+
"class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns2.m("spin")],
|
|
171
|
+
"style": {
|
|
172
|
+
width: iconSize.value || "",
|
|
173
|
+
transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`,
|
|
174
|
+
verticalAlign: "middle"
|
|
175
|
+
}
|
|
176
|
+
}, ctx.attrs), null);
|
|
177
|
+
};
|
|
178
|
+
const svgIconDom = () => {
|
|
179
|
+
return createVNode(IconComponent, mergeProps({
|
|
180
|
+
"name": name.value,
|
|
181
|
+
"color": color.value,
|
|
182
|
+
"size": iconSize.value,
|
|
183
|
+
"class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns2.m("spin")],
|
|
184
|
+
"style": {
|
|
185
|
+
transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
|
|
186
|
+
}
|
|
187
|
+
}, ctx.attrs), null);
|
|
188
|
+
};
|
|
189
|
+
const fontIconDom = () => {
|
|
190
|
+
const fontIconClass = /^icon-/.test(name.value) ? name.value : `${classPrefix.value}-${name.value}`;
|
|
191
|
+
return createVNode("i", mergeProps({
|
|
192
|
+
"class": [classPrefix.value, fontIconClass, (rotate == null ? void 0 : rotate.value) === "infinite" && ns2.m("spin")],
|
|
193
|
+
"style": {
|
|
194
|
+
fontSize: iconSize.value,
|
|
195
|
+
color: color.value,
|
|
196
|
+
transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
|
|
197
|
+
}
|
|
198
|
+
}, ctx.attrs), null);
|
|
199
|
+
};
|
|
200
|
+
const iconDom = () => {
|
|
201
|
+
return component.value ? svgIconDom() : isUrl(name.value) ? imgIconDom() : fontIconDom();
|
|
202
|
+
};
|
|
203
|
+
return {
|
|
204
|
+
iconDom
|
|
205
|
+
};
|
|
206
|
+
}
|
|
141
207
|
var Icon = defineComponent({
|
|
142
208
|
name: "DIcon",
|
|
143
209
|
props: iconProps,
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}) {
|
|
210
|
+
emits: ["click"],
|
|
211
|
+
setup(props, ctx) {
|
|
147
212
|
const {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
size,
|
|
151
|
-
color,
|
|
152
|
-
classPrefix
|
|
213
|
+
disabled,
|
|
214
|
+
operable
|
|
153
215
|
} = toRefs(props);
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
"alt": name.value.split("/")[name.value.split("/").length - 1],
|
|
169
|
-
"style": {
|
|
170
|
-
width: iconSize.value || ""
|
|
171
|
-
}
|
|
172
|
-
}, attrs), null);
|
|
216
|
+
const {
|
|
217
|
+
iconDom
|
|
218
|
+
} = useIconDom(props, ctx);
|
|
219
|
+
const ns2 = useNamespace("icon");
|
|
220
|
+
const wrapClassed = computed(() => ({
|
|
221
|
+
[ns2.e("container")]: true,
|
|
222
|
+
[ns2.m("disabled")]: disabled.value,
|
|
223
|
+
[ns2.m("operable")]: operable.value
|
|
224
|
+
}));
|
|
225
|
+
const onClick = (e) => {
|
|
226
|
+
if (disabled.value) {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
ctx.emit("click", e);
|
|
173
230
|
};
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
return createVNode("
|
|
177
|
-
"class":
|
|
178
|
-
"
|
|
179
|
-
|
|
180
|
-
color: color.value
|
|
181
|
-
}
|
|
182
|
-
}, attrs), null);
|
|
231
|
+
return () => {
|
|
232
|
+
var _a, _b, _c, _d;
|
|
233
|
+
return createVNode("div", {
|
|
234
|
+
"class": wrapClassed.value,
|
|
235
|
+
"onClick": onClick
|
|
236
|
+
}, [(_b = (_a = ctx.slots).prefix) == null ? void 0 : _b.call(_a), iconDom(), (_d = (_c = ctx.slots).suffix) == null ? void 0 : _d.call(_c)]);
|
|
183
237
|
};
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
var iconGroup = "";
|
|
241
|
+
defineComponent({
|
|
242
|
+
name: "DIconGroup",
|
|
243
|
+
setup(_, ctx) {
|
|
244
|
+
const ns2 = useNamespace("icon-group");
|
|
184
245
|
return () => {
|
|
185
|
-
|
|
246
|
+
var _a, _b;
|
|
247
|
+
return createVNode("div", {
|
|
248
|
+
"class": ns2.b()
|
|
249
|
+
}, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
|
|
186
250
|
};
|
|
187
251
|
}
|
|
188
252
|
});
|
|
@@ -202,15 +266,20 @@ var Close = defineComponent({
|
|
|
202
266
|
}
|
|
203
267
|
});
|
|
204
268
|
const ns = useNamespace("notification");
|
|
269
|
+
const XLINK = {
|
|
270
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
271
|
+
};
|
|
272
|
+
const XLINK_HREF = {
|
|
273
|
+
"xlink:href": "#path-s"
|
|
274
|
+
};
|
|
205
275
|
function SuccessIcon() {
|
|
206
|
-
return createVNode("svg", {
|
|
276
|
+
return createVNode("svg", mergeProps({
|
|
207
277
|
"width": "16px",
|
|
208
278
|
"height": "16px",
|
|
209
279
|
"viewBox": "0 0 16 16",
|
|
210
280
|
"version": "1.1",
|
|
211
|
-
"xmlns": "http://www.w3.org/2000/svg"
|
|
212
|
-
|
|
213
|
-
}, [createVNode("defs", null, [createVNode("polygon", {
|
|
281
|
+
"xmlns": "http://www.w3.org/2000/svg"
|
|
282
|
+
}, XLINK), [createVNode("defs", null, [createVNode("polygon", {
|
|
214
283
|
"id": "path-s",
|
|
215
284
|
"points": "6.53553391 9.77817459 12.1923882 4.12132034 13.6066017 5.53553391 6.53553391 12.6066017 3 9.07106781 4.41421356 7.65685425 6.53553391 9.77817459"
|
|
216
285
|
}, null)]), createVNode("g", {
|
|
@@ -222,30 +291,26 @@ function SuccessIcon() {
|
|
|
222
291
|
}, [createVNode("mask", {
|
|
223
292
|
"id": "mask-2",
|
|
224
293
|
"fill": "white"
|
|
225
|
-
}, [createVNode("use", {
|
|
226
|
-
"xlink:href": "#path-s"
|
|
227
|
-
}, null)]), createVNode("use", {
|
|
294
|
+
}, [createVNode("use", XLINK_HREF, null)]), createVNode("use", mergeProps({
|
|
228
295
|
"id": "Mask",
|
|
229
|
-
"class": ns.e("image-success-path")
|
|
230
|
-
|
|
231
|
-
}, null)])]);
|
|
296
|
+
"class": ns.e("image-success-path")
|
|
297
|
+
}, XLINK_HREF), null)])]);
|
|
232
298
|
}
|
|
233
299
|
function WarningIcon() {
|
|
234
|
-
return createVNode("svg", {
|
|
300
|
+
return createVNode("svg", mergeProps({
|
|
235
301
|
"width": "16px",
|
|
236
302
|
"height": "16px",
|
|
237
303
|
"viewBox": "0 0 16 16",
|
|
238
304
|
"version": "1.1",
|
|
239
|
-
"xmlns": "http://www.w3.org/2000/svg"
|
|
240
|
-
|
|
241
|
-
}, [createVNode("g", {
|
|
305
|
+
"xmlns": "http://www.w3.org/2000/svg"
|
|
306
|
+
}, XLINK), [createVNode("g", {
|
|
242
307
|
"stroke": "none",
|
|
243
308
|
"stroke-width": "1",
|
|
244
309
|
"fill": "none",
|
|
245
310
|
"fill-rule": "evenodd"
|
|
246
311
|
}, [createVNode("path", {
|
|
247
312
|
"class": ns.e("warning-outer"),
|
|
248
|
-
"d": "M8.96244623,0.57254229 L15.8714442,13.4101975 C16.1549662,13.9370117 15.9538562,14.5918482 15.4222523,14.8728158 C15.2642579,14.9563203 15.0879506,15 14.9088903,15 L1.09089441,15 C0.488410063,15 0,14.5159904 0,13.9189343 C0,13.7414873 0.0440768395,13.5667684 0.128340519,13.4101975 L7.03733844,0.57254229 C7.32086049,0.0457280838 7.98165058,-0.153569987 8.51325441,0.127397589 C8.70423071,0.228333932 8.8605922,0.383286648 8.96244623,0.57254229 Z"
|
|
313
|
+
"d": "M8.96244623,0.57254229 L15.8714442,13.4101975 C16.1549662,13.9370117 15.9538562,14.5918482 15.4222523,14.8728158 C15.2642579,14.9563203 15.0879506, 15 14.9088903,15 L1.09089441,15 C0.488410063,15 0,14.5159904 0,13.9189343 C0,13.7414873 0.0440768395,13.5667684 0.128340519,13.4101975 L7.03733844,0.57254229 C7.32086049, 0.0457280838 7.98165058,-0.153569987 8.51325441,0.127397589 C8.70423071, 0.228333932 8.8605922,0.383286648 8.96244623,0.57254229 Z"
|
|
249
314
|
}, null), createVNode("path", {
|
|
250
315
|
"class": ns.e("warning-inner"),
|
|
251
316
|
"stroke-width": "0.3",
|
|
@@ -254,14 +319,13 @@ function WarningIcon() {
|
|
|
254
319
|
}, null)])]);
|
|
255
320
|
}
|
|
256
321
|
function InfoIcon() {
|
|
257
|
-
return createVNode("svg", {
|
|
322
|
+
return createVNode("svg", mergeProps({
|
|
258
323
|
"width": "16px",
|
|
259
324
|
"height": "16px",
|
|
260
325
|
"viewBox": "0 0 16 16",
|
|
261
326
|
"version": "1.1",
|
|
262
|
-
"xmlns": "http://www.w3.org/2000/svg"
|
|
263
|
-
|
|
264
|
-
}, [createVNode("g", {
|
|
327
|
+
"xmlns": "http://www.w3.org/2000/svg"
|
|
328
|
+
}, XLINK), [createVNode("g", {
|
|
265
329
|
"id": "info",
|
|
266
330
|
"stroke": "none",
|
|
267
331
|
"stroke-width": "1",
|
|
@@ -274,14 +338,13 @@ function InfoIcon() {
|
|
|
274
338
|
}, null)])]);
|
|
275
339
|
}
|
|
276
340
|
function ErrorIcon() {
|
|
277
|
-
return createVNode("svg", {
|
|
341
|
+
return createVNode("svg", mergeProps({
|
|
278
342
|
"width": "16px",
|
|
279
343
|
"height": "16px",
|
|
280
344
|
"viewBox": "0 0 16 16",
|
|
281
345
|
"version": "1.1",
|
|
282
|
-
"xmlns": "http://www.w3.org/2000/svg"
|
|
283
|
-
|
|
284
|
-
}, [createVNode("defs", null, [createVNode("polygon", {
|
|
346
|
+
"xmlns": "http://www.w3.org/2000/svg"
|
|
347
|
+
}, XLINK), [createVNode("defs", null, [createVNode("polygon", {
|
|
285
348
|
"id": "path-e",
|
|
286
349
|
"points": "8.07106781 6.65685425 10.8994949 3.82842712 12.3137085 5.24264069 9.48528137 8.07106781 12.3137085 10.8994949 10.8994949 12.3137085 8.07106781 9.48528137 5.24264069 12.3137085 3.82842712 10.8994949 6.65685425 8.07106781 3.82842712 5.24264069 5.24264069 3.82842712"
|
|
287
350
|
}, null)]), createVNode("g", {
|
|
@@ -293,13 +356,10 @@ function ErrorIcon() {
|
|
|
293
356
|
}, [createVNode("mask", {
|
|
294
357
|
"id": "mask-2",
|
|
295
358
|
"fill": "white"
|
|
296
|
-
}, [createVNode("use", {
|
|
297
|
-
"xlink:href": "#path-e"
|
|
298
|
-
}, null)]), createVNode("use", {
|
|
359
|
+
}, [createVNode("use", XLINK_HREF, null)]), createVNode("use", mergeProps({
|
|
299
360
|
"id": "Mask",
|
|
300
|
-
"class": ns.e("image-error-path")
|
|
301
|
-
|
|
302
|
-
}, null)])]);
|
|
361
|
+
"class": ns.e("image-error-path")
|
|
362
|
+
}, XLINK_HREF), null)])]);
|
|
303
363
|
}
|
|
304
364
|
var TypeIcon = defineComponent({
|
|
305
365
|
props: {
|
|
@@ -334,7 +394,7 @@ function useEvent(props, emit) {
|
|
|
334
394
|
let timestamp;
|
|
335
395
|
const close2 = () => {
|
|
336
396
|
var _a;
|
|
337
|
-
clearTimeout(timer);
|
|
397
|
+
timer && clearTimeout(timer);
|
|
338
398
|
timer = null;
|
|
339
399
|
(_a = props.onClose) == null ? void 0 : _a.call(props);
|
|
340
400
|
emit("update:modelValue", false);
|
|
@@ -427,13 +487,24 @@ const defaultOptions = {
|
|
|
427
487
|
};
|
|
428
488
|
function initInstance(props, content) {
|
|
429
489
|
const container = document.createElement("div");
|
|
490
|
+
container.classList.add("notification__warpper");
|
|
491
|
+
const lastChild = document.body.lastElementChild;
|
|
492
|
+
let offset_Top = 50;
|
|
493
|
+
if (lastChild == null ? void 0 : lastChild.classList.contains("notification__warpper")) {
|
|
494
|
+
const notification2 = lastChild.lastElementChild;
|
|
495
|
+
const rects = notification2.getBoundingClientRect();
|
|
496
|
+
const height = rects.height;
|
|
497
|
+
const top = rects.top;
|
|
498
|
+
offset_Top = height + top;
|
|
499
|
+
}
|
|
430
500
|
const app = createApp({
|
|
431
501
|
setup() {
|
|
432
502
|
onUnmounted(() => {
|
|
433
503
|
document.body.removeChild(container);
|
|
434
504
|
});
|
|
435
505
|
return () => createVNode(Notification, mergeProps(props, {
|
|
436
|
-
"onDestroy": app.unmount
|
|
506
|
+
"onDestroy": app.unmount,
|
|
507
|
+
"style": [`top: ${offset_Top}px`]
|
|
437
508
|
}), _isSlot(content) ? content : {
|
|
438
509
|
default: () => [content]
|
|
439
510
|
});
|
|
@@ -461,7 +532,7 @@ class NotificationService {
|
|
|
461
532
|
initInstance(props, content);
|
|
462
533
|
props.modelValue = true;
|
|
463
534
|
clearTimeout(timer);
|
|
464
|
-
if (options.duration) {
|
|
535
|
+
if (options.duration && props.onClose) {
|
|
465
536
|
timer = setTimeout(props.onClose, options.duration);
|
|
466
537
|
}
|
|
467
538
|
}
|
|
@@ -516,7 +587,7 @@ const uploadProps = {
|
|
|
516
587
|
},
|
|
517
588
|
placeholder: {
|
|
518
589
|
type: String,
|
|
519
|
-
default: "
|
|
590
|
+
default: ""
|
|
520
591
|
},
|
|
521
592
|
modelValue: {
|
|
522
593
|
type: Array,
|
|
@@ -555,30 +626,40 @@ const uploadProps = {
|
|
|
555
626
|
type: Function,
|
|
556
627
|
default: void 0
|
|
557
628
|
},
|
|
558
|
-
|
|
629
|
+
onError: {
|
|
630
|
+
type: Function,
|
|
631
|
+
default: void 0
|
|
632
|
+
},
|
|
633
|
+
onSuccess: {
|
|
634
|
+
type: Function,
|
|
635
|
+
default: void 0
|
|
636
|
+
},
|
|
637
|
+
onExceed: {
|
|
638
|
+
type: Function,
|
|
639
|
+
default: void 0
|
|
640
|
+
},
|
|
641
|
+
onProgress: {
|
|
559
642
|
type: Function,
|
|
560
643
|
default: void 0
|
|
561
644
|
},
|
|
562
|
-
|
|
645
|
+
onPreview: {
|
|
563
646
|
type: Function,
|
|
564
647
|
default: void 0
|
|
565
648
|
},
|
|
566
649
|
oneTimeUpload: {
|
|
567
650
|
type: Boolean,
|
|
568
651
|
default: false
|
|
652
|
+
},
|
|
653
|
+
limit: {
|
|
654
|
+
type: Number,
|
|
655
|
+
default: 0
|
|
656
|
+
},
|
|
657
|
+
httpRequest: {
|
|
658
|
+
type: Function,
|
|
659
|
+
default: void 0
|
|
569
660
|
}
|
|
570
661
|
};
|
|
571
|
-
const
|
|
572
|
-
const getBeyondMaximalFileSizeMsg = (filename, maximalSize) => {
|
|
573
|
-
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`;
|
|
574
|
-
};
|
|
575
|
-
const getNotAllowedFileTypeMsg = (filename, scope) => {
|
|
576
|
-
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`;
|
|
577
|
-
};
|
|
578
|
-
const getExistSameNameFilesMsg = (sameNames) => {
|
|
579
|
-
return `\u60A8\u4E0A\u4F20\u7684 "${sameNames}" \u5B58\u5728\u91CD\u540D\u6587\u4EF6, \u8BF7\u91CD\u65B0\u9009\u62E9\u6587\u4EF6`;
|
|
580
|
-
};
|
|
581
|
-
const useSelectFiles = () => {
|
|
662
|
+
const useSelectFiles = (t) => {
|
|
582
663
|
const BEYOND_MAXIMAL_FILE_SIZE_MSG = ref("");
|
|
583
664
|
const simulateClickEvent = (input) => {
|
|
584
665
|
const evt = document.createEvent("MouseEvents");
|
|
@@ -639,13 +720,13 @@ const useSelectFiles = () => {
|
|
|
639
720
|
if (!isAllowedFileType(accept, file)) {
|
|
640
721
|
return {
|
|
641
722
|
checkError: true,
|
|
642
|
-
errorMsg: getNotAllowedFileTypeMsg(file.name, accept)
|
|
723
|
+
errorMsg: t("getNotAllowedFileTypeMsg")(file.name, accept)
|
|
643
724
|
};
|
|
644
725
|
}
|
|
645
726
|
if (uploadOptions && beyondMaximalSize(file.size, uploadOptions.maximumSize)) {
|
|
646
727
|
return {
|
|
647
728
|
checkError: true,
|
|
648
|
-
errorMsg: getBeyondMaximalFileSizeMsg(file.name, uploadOptions.maximumSize || 0)
|
|
729
|
+
errorMsg: t("getBeyondMaximalFileSizeMsg")(file.name, uploadOptions.maximumSize || 0)
|
|
649
730
|
};
|
|
650
731
|
}
|
|
651
732
|
return { checkError: false, errorMsg: void 0 };
|
|
@@ -659,7 +740,7 @@ const useSelectFiles = () => {
|
|
|
659
740
|
};
|
|
660
741
|
const checkAllFilesSize = (fileSize, maximumSize) => {
|
|
661
742
|
if (beyondMaximalSize(fileSize, maximumSize)) {
|
|
662
|
-
BEYOND_MAXIMAL_FILE_SIZE_MSG.value = getAllFilesBeyondMaximalFileSizeMsg(maximumSize);
|
|
743
|
+
BEYOND_MAXIMAL_FILE_SIZE_MSG.value = t("getAllFilesBeyondMaximalFileSizeMsg")(maximumSize);
|
|
663
744
|
return { checkError: true, errorMsg: BEYOND_MAXIMAL_FILE_SIZE_MSG.value };
|
|
664
745
|
}
|
|
665
746
|
};
|
|
@@ -865,11 +946,181 @@ const useUpload = () => {
|
|
|
865
946
|
};
|
|
866
947
|
};
|
|
867
948
|
var upload = "";
|
|
949
|
+
function deepAssign(...objects) {
|
|
950
|
+
const isObject = (obj) => obj && typeof obj === "object";
|
|
951
|
+
return objects.reduce((prev, from) => {
|
|
952
|
+
Object.keys(from).forEach((key) => {
|
|
953
|
+
const pVal = prev[key];
|
|
954
|
+
const oVal = from[key];
|
|
955
|
+
if (Array.isArray(pVal) && Array.isArray(oVal)) {
|
|
956
|
+
prev[key] = Array.from(/* @__PURE__ */ new Set([...oVal, ...pVal]));
|
|
957
|
+
} else if (isObject(pVal) && isObject(oVal)) {
|
|
958
|
+
prev[key] = deepAssign(pVal, oVal);
|
|
959
|
+
} else {
|
|
960
|
+
prev[key] = oVal;
|
|
961
|
+
}
|
|
962
|
+
});
|
|
963
|
+
return prev;
|
|
964
|
+
}, {});
|
|
965
|
+
}
|
|
966
|
+
var zhCN = {
|
|
967
|
+
pagination: {
|
|
968
|
+
totalItemText: "\u6240\u6709\u6761\u76EE",
|
|
969
|
+
goToText: "\u8DF3\u81F3"
|
|
970
|
+
},
|
|
971
|
+
accordion: {
|
|
972
|
+
loading: "\u52A0\u8F7D\u4E2D",
|
|
973
|
+
noData: "\u6CA1\u6709\u6570\u636E"
|
|
974
|
+
},
|
|
975
|
+
autoCompleteDropdown: {
|
|
976
|
+
latestInput: "\u6700\u8FD1\u8F93\u5165"
|
|
977
|
+
},
|
|
978
|
+
cascaderList: {
|
|
979
|
+
noData: "\u6CA1\u6709\u6570\u636E"
|
|
980
|
+
},
|
|
981
|
+
colorPicker: {
|
|
982
|
+
foundationPanel: "\u57FA\u7840\u9762\u677F",
|
|
983
|
+
advancedPanel: "\u9AD8\u7EA7\u9762\u677F"
|
|
984
|
+
},
|
|
985
|
+
datePickerPro: {
|
|
986
|
+
ok: "\u786E\u5B9A",
|
|
987
|
+
placeholder: "\u8BF7\u9009\u62E9\u65E5\u671F",
|
|
988
|
+
month1: "1\u6708",
|
|
989
|
+
month2: "2\u6708",
|
|
990
|
+
month3: "3\u6708",
|
|
991
|
+
month4: "4\u6708",
|
|
992
|
+
month5: "5\u6708",
|
|
993
|
+
month6: "6\u6708",
|
|
994
|
+
month7: "7\u6708",
|
|
995
|
+
month8: "8\u6708",
|
|
996
|
+
month9: "9\u6708",
|
|
997
|
+
month10: "10\u6708",
|
|
998
|
+
month11: "11\u6708",
|
|
999
|
+
month12: "12\u6708",
|
|
1000
|
+
year: "\u5E74",
|
|
1001
|
+
startPlaceholder: "\u8BF7\u9009\u62E9\u5F00\u59CB\u65E5\u671F",
|
|
1002
|
+
endPlaceholder: "\u8BF7\u9009\u62E9\u7ED3\u675F\u65E5\u671F",
|
|
1003
|
+
getWeekDays() {
|
|
1004
|
+
return ["\u65E5", "\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D"];
|
|
1005
|
+
},
|
|
1006
|
+
getTimeArr() {
|
|
1007
|
+
return ["\u65F6", "\u5206", "\u79D2"];
|
|
1008
|
+
},
|
|
1009
|
+
getYearMonthStr(year, month) {
|
|
1010
|
+
return `${year}\u5E74${month}\u6708`;
|
|
1011
|
+
}
|
|
1012
|
+
},
|
|
1013
|
+
editableSelect: {
|
|
1014
|
+
noRelatedRecords: "\u627E\u4E0D\u5230\u76F8\u5173\u8BB0\u5F55",
|
|
1015
|
+
noData: "\u6CA1\u6709\u6570\u636E"
|
|
1016
|
+
},
|
|
1017
|
+
input: {
|
|
1018
|
+
placeholder: "\u8BF7\u8F93\u5165"
|
|
1019
|
+
},
|
|
1020
|
+
splitterBar: {
|
|
1021
|
+
collapse: "\u6536\u8D77",
|
|
1022
|
+
expand: "\u5C55\u5F00"
|
|
1023
|
+
},
|
|
1024
|
+
stepsGuide: {
|
|
1025
|
+
previous: "\u4E0A\u4E00\u6B65",
|
|
1026
|
+
continue: "\u6211\u77E5\u9053\u5566\uFF0C\u7EE7\u7EED",
|
|
1027
|
+
ok: "\u6211\u77E5\u9053\u5566"
|
|
1028
|
+
},
|
|
1029
|
+
table: {
|
|
1030
|
+
selectAll: "\u5168\u9009",
|
|
1031
|
+
ok: "\u786E\u5B9A"
|
|
1032
|
+
},
|
|
1033
|
+
timePopup: {
|
|
1034
|
+
ok: "\u786E\u5B9A"
|
|
1035
|
+
},
|
|
1036
|
+
transfer: {
|
|
1037
|
+
unit: "\u9879",
|
|
1038
|
+
panelUnit: "\u9879",
|
|
1039
|
+
headerUnit: "\u9879",
|
|
1040
|
+
noData: "\u6682\u65E0\u6570\u636E",
|
|
1041
|
+
placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u8BCD\u641C\u7D22"
|
|
1042
|
+
},
|
|
1043
|
+
tree: {
|
|
1044
|
+
loading: "\u52A0\u8F7D\u4E2D",
|
|
1045
|
+
newNode: "\u65B0\u8282\u70B9",
|
|
1046
|
+
selectPlaceholder: "\u8BF7\u9009\u62E9"
|
|
1047
|
+
},
|
|
1048
|
+
upload: {
|
|
1049
|
+
placeholder: "\u9009\u62E9\u6587\u4EF6",
|
|
1050
|
+
getExistSameNameFilesMsg(sameNames) {
|
|
1051
|
+
return `\u60A8\u4E0A\u4F20\u7684 "${sameNames}" \u5B58\u5728\u91CD\u540D\u6587\u4EF6, \u8BF7\u91CD\u65B0\u9009\u62E9\u6587\u4EF6`;
|
|
1052
|
+
},
|
|
1053
|
+
getAllFilesBeyondMaximalFileSizeMsg(maximalSize) {
|
|
1054
|
+
return `\u6700\u5927\u652F\u6301\u4E0A\u4F20${maximalSize}MB\u7684\u6587\u4EF6, \u60A8\u672C\u6B21\u4E0A\u4F20\u7684\u6240\u6709\u6587\u4EF6\u8D85\u8FC7\u53EF\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F`;
|
|
1055
|
+
},
|
|
1056
|
+
getBeyondMaximalFileSizeMsg(filename, maximalSize) {
|
|
1057
|
+
return `\u6700\u5927\u652F\u6301\u4E0A\u4F20${maximalSize}MB\u7684\u6587\u4EF6, \u60A8\u4E0A\u4F20\u7684\u6587\u4EF6"${filename}"\u8D85\u8FC7\u53EF\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F`;
|
|
1058
|
+
},
|
|
1059
|
+
getNotAllowedFileTypeMsg(filename, scope) {
|
|
1060
|
+
return `\u652F\u6301\u7684\u6587\u4EF6\u7C7B\u578B: "${scope}", \u60A8\u4E0A\u4F20\u7684\u6587\u4EF6"${filename}"\u4E0D\u5728\u5141\u8BB8\u8303\u56F4\u5185\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\u6587\u4EF6`;
|
|
1061
|
+
}
|
|
1062
|
+
},
|
|
1063
|
+
search: {
|
|
1064
|
+
placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u5B57"
|
|
1065
|
+
},
|
|
1066
|
+
select: {
|
|
1067
|
+
placeholder: "\u8BF7\u9009\u62E9",
|
|
1068
|
+
noDataText: "\u65E0\u6570\u636E",
|
|
1069
|
+
noMatchText: "\u627E\u4E0D\u5230\u76F8\u5173\u8BB0\u5F55",
|
|
1070
|
+
loadingText: "\u52A0\u8F7D\u4E2D..."
|
|
1071
|
+
},
|
|
1072
|
+
tagInput: {
|
|
1073
|
+
maxTagsText: "\u5DF2\u8FBE\u5230\u6700\u5927\u4E2A\u6570\uFF1A"
|
|
1074
|
+
},
|
|
1075
|
+
timeSelect: {
|
|
1076
|
+
placeholder: "\u8BF7\u9009\u62E9\u65F6\u95F4"
|
|
1077
|
+
}
|
|
1078
|
+
};
|
|
1079
|
+
const lang = ref("zh-CN");
|
|
1080
|
+
let langMessages = reactive({
|
|
1081
|
+
[lang.value]: zhCN
|
|
1082
|
+
});
|
|
1083
|
+
const Locale = {
|
|
1084
|
+
messages() {
|
|
1085
|
+
return langMessages[lang.value];
|
|
1086
|
+
},
|
|
1087
|
+
lang() {
|
|
1088
|
+
return lang.value;
|
|
1089
|
+
},
|
|
1090
|
+
use(newLang, newMessages) {
|
|
1091
|
+
lang.value = newLang;
|
|
1092
|
+
this.add({ [newLang]: newMessages });
|
|
1093
|
+
},
|
|
1094
|
+
add(newMessages = {}) {
|
|
1095
|
+
langMessages = deepAssign(langMessages, newMessages);
|
|
1096
|
+
}
|
|
1097
|
+
};
|
|
1098
|
+
const camelize = (name) => name.substring(1).replace(/^\S/, (s) => s.toLocaleLowerCase());
|
|
1099
|
+
function get(object, path) {
|
|
1100
|
+
const keys = path.split(".");
|
|
1101
|
+
let result = object;
|
|
1102
|
+
keys.forEach((key) => {
|
|
1103
|
+
var _a;
|
|
1104
|
+
result = (_a = result[key]) != null ? _a : "";
|
|
1105
|
+
});
|
|
1106
|
+
return result;
|
|
1107
|
+
}
|
|
1108
|
+
function createI18nTranslate(name, app, newPrefix) {
|
|
1109
|
+
const prefix = newPrefix || camelize(name) + ".";
|
|
1110
|
+
return (path) => {
|
|
1111
|
+
var _a;
|
|
1112
|
+
const messages = ((_a = app == null ? void 0 : app.appContext.config.globalProperties.langMessages) == null ? void 0 : _a.value) || Locale.messages();
|
|
1113
|
+
const message = get(messages, prefix + path) || get(messages, path);
|
|
1114
|
+
return message;
|
|
1115
|
+
};
|
|
1116
|
+
}
|
|
868
1117
|
var Upload = defineComponent({
|
|
869
1118
|
name: "DUpload",
|
|
870
1119
|
props: uploadProps,
|
|
871
1120
|
emits: ["fileDrop", "fileOver", "fileSelect", "deleteUploadedFile", "update:modelValue"],
|
|
872
1121
|
setup(props, ctx) {
|
|
1122
|
+
const app = getCurrentInstance();
|
|
1123
|
+
const t = createI18nTranslate("DUpload", app);
|
|
873
1124
|
const {
|
|
874
1125
|
uploadOptions,
|
|
875
1126
|
placeholder,
|
|
@@ -881,7 +1132,9 @@ var Upload = defineComponent({
|
|
|
881
1132
|
modelValue,
|
|
882
1133
|
multiple,
|
|
883
1134
|
accept,
|
|
884
|
-
webkitdirectory
|
|
1135
|
+
webkitdirectory,
|
|
1136
|
+
limit,
|
|
1137
|
+
httpRequest
|
|
885
1138
|
} = toRefs(props);
|
|
886
1139
|
const ns2 = useNamespace("upload");
|
|
887
1140
|
const inputGroupNs = useNamespace("input-group");
|
|
@@ -892,7 +1145,7 @@ var Upload = defineComponent({
|
|
|
892
1145
|
_validateFiles,
|
|
893
1146
|
triggerDropFiles,
|
|
894
1147
|
checkAllFilesSize
|
|
895
|
-
} = useSelectFiles();
|
|
1148
|
+
} = useSelectFiles(t);
|
|
896
1149
|
const {
|
|
897
1150
|
fileUploaders,
|
|
898
1151
|
addFile,
|
|
@@ -904,7 +1157,8 @@ var Upload = defineComponent({
|
|
|
904
1157
|
_oneTimeUpload,
|
|
905
1158
|
getSameNameFiles
|
|
906
1159
|
} = useUpload();
|
|
907
|
-
const
|
|
1160
|
+
const isDropOver = ref(false);
|
|
1161
|
+
const selectedFiles = ref([]);
|
|
908
1162
|
const alertMsg = (errorMsg) => {
|
|
909
1163
|
NotificationService.open({
|
|
910
1164
|
type: "warning",
|
|
@@ -932,7 +1186,7 @@ var Upload = defineComponent({
|
|
|
932
1186
|
}
|
|
933
1187
|
};
|
|
934
1188
|
const onFileOver = (event) => {
|
|
935
|
-
|
|
1189
|
+
isDropOver.value = event;
|
|
936
1190
|
ctx.emit("fileOver", event);
|
|
937
1191
|
};
|
|
938
1192
|
const deleteUploadedFile = (file) => {
|
|
@@ -943,7 +1197,7 @@ var Upload = defineComponent({
|
|
|
943
1197
|
ctx.emit("update:modelValue", newUploadedFiles);
|
|
944
1198
|
};
|
|
945
1199
|
const onDeleteFile = (event, file, status) => {
|
|
946
|
-
event.stopPropagation();
|
|
1200
|
+
event == null ? void 0 : event.stopPropagation();
|
|
947
1201
|
if (status === UploadStatus.uploaded) {
|
|
948
1202
|
deleteUploadedFile(file);
|
|
949
1203
|
}
|
|
@@ -972,20 +1226,33 @@ var Upload = defineComponent({
|
|
|
972
1226
|
removeFiles();
|
|
973
1227
|
return;
|
|
974
1228
|
}
|
|
1229
|
+
if (typeof (httpRequest == null ? void 0 : httpRequest.value) === "function") {
|
|
1230
|
+
const files = fileUploaders.value.map((tempFileUploader) => tempFileUploader.file);
|
|
1231
|
+
httpRequest.value(files);
|
|
1232
|
+
return;
|
|
1233
|
+
}
|
|
975
1234
|
const uploadObservable = oneTimeUpload.value ? _oneTimeUpload() : upload2(fileUploader);
|
|
1235
|
+
props.onProgress && props.onProgress(selectedFiles.value, modelValue.value);
|
|
976
1236
|
uploadObservable == null ? void 0 : uploadObservable.then((results) => {
|
|
977
|
-
props
|
|
1237
|
+
props.onSuccess && props.onSuccess(results);
|
|
978
1238
|
const newFiles = results.map((result) => result.file);
|
|
979
1239
|
const newUploadedFiles = [...newFiles, ...modelValue.value];
|
|
980
1240
|
ctx.emit("update:modelValue", newUploadedFiles);
|
|
1241
|
+
props.onChange && props.onChange(newFiles, newUploadedFiles);
|
|
981
1242
|
}).catch((error) => {
|
|
982
|
-
props
|
|
1243
|
+
props.onError && props.onError(error);
|
|
1244
|
+
props.onChange && props.onChange([error.file], modelValue.value);
|
|
983
1245
|
});
|
|
984
1246
|
});
|
|
985
1247
|
};
|
|
986
1248
|
const _dealFiles = (promise) => {
|
|
987
1249
|
resetSameNameFiles();
|
|
988
1250
|
promise.then((files) => {
|
|
1251
|
+
if (limit.value && modelValue.value.length + files.length > limit.value) {
|
|
1252
|
+
props.onExceed && props.onExceed(files, modelValue.value);
|
|
1253
|
+
return;
|
|
1254
|
+
}
|
|
1255
|
+
props.onChange && props.onChange(files, modelValue.value);
|
|
989
1256
|
files.forEach((file) => {
|
|
990
1257
|
if (!multiple.value) {
|
|
991
1258
|
removeFiles();
|
|
@@ -995,10 +1262,10 @@ var Upload = defineComponent({
|
|
|
995
1262
|
checkValid();
|
|
996
1263
|
const sameNameFiles = getSameNameFiles();
|
|
997
1264
|
if ((uploadOptions == null ? void 0 : uploadOptions.value) && uploadOptions.value.checkSameName && sameNameFiles.length) {
|
|
998
|
-
alertMsg(getExistSameNameFilesMsg(sameNameFiles));
|
|
1265
|
+
alertMsg(t("getExistSameNameFilesMsg")(sameNameFiles));
|
|
999
1266
|
}
|
|
1000
|
-
|
|
1001
|
-
ctx.emit("fileSelect", selectedFiles);
|
|
1267
|
+
selectedFiles.value = fileUploaders.value.filter((fileUploader) => fileUploader.status === UploadStatus.preLoad).map((fileUploader) => fileUploader.file);
|
|
1268
|
+
ctx.emit("fileSelect", selectedFiles.value);
|
|
1002
1269
|
if (autoUpload.value) {
|
|
1003
1270
|
fileUpload();
|
|
1004
1271
|
}
|
|
@@ -1017,15 +1284,31 @@ var Upload = defineComponent({
|
|
|
1017
1284
|
}));
|
|
1018
1285
|
};
|
|
1019
1286
|
const onFileDrop = (files) => {
|
|
1020
|
-
|
|
1287
|
+
isDropOver.value = false;
|
|
1021
1288
|
_dealFiles(triggerDropFiles(files));
|
|
1022
1289
|
ctx.emit("fileDrop", files);
|
|
1023
1290
|
};
|
|
1291
|
+
const submit = (event, fileUploader) => {
|
|
1292
|
+
fileUpload(event, fileUploader);
|
|
1293
|
+
};
|
|
1294
|
+
const clearFiles = (event) => {
|
|
1295
|
+
fileUploaders.value.forEach((fileUploader) => {
|
|
1296
|
+
onDeleteFile(event, fileUploader.file, fileUploader.status);
|
|
1297
|
+
});
|
|
1298
|
+
};
|
|
1299
|
+
const clickSelectedFile = (event, file) => {
|
|
1300
|
+
event == null ? void 0 : event.stopPropagation();
|
|
1301
|
+
props.onPreview && props.onPreview(file);
|
|
1302
|
+
};
|
|
1303
|
+
ctx.expose({
|
|
1304
|
+
submit,
|
|
1305
|
+
clearFiles
|
|
1306
|
+
});
|
|
1024
1307
|
return () => {
|
|
1025
1308
|
var _a, _b, _c, _d;
|
|
1026
1309
|
return createVNode("div", null, [withDirectives(createVNode("div", {
|
|
1027
1310
|
"class": ns2.b(),
|
|
1028
|
-
"style": `border: ${
|
|
1311
|
+
"style": `border: ${isDropOver.value ? "1px solid #15bf15" : "0"}`
|
|
1029
1312
|
}, [((_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)) ? createVNode("div", {
|
|
1030
1313
|
"onClick": handleClick
|
|
1031
1314
|
}, [ctx.slots.default()]) : createVNode("div", {
|
|
@@ -1033,13 +1316,14 @@ var Upload = defineComponent({
|
|
|
1033
1316
|
"onClick": handleClick
|
|
1034
1317
|
}, [fileUploaders.value.length === 0 && createVNode("div", {
|
|
1035
1318
|
"class": [formControlNs.b(), ns2.e("placeholder")]
|
|
1036
|
-
}, [placeholder.value]), fileUploaders.value.length > 0 && createVNode("ul", {
|
|
1319
|
+
}, [placeholder.value || t("placeholder")]), fileUploaders.value.length > 0 && createVNode("ul", {
|
|
1037
1320
|
"class": [formControlNs.b(), ns2.e("files-list")]
|
|
1038
1321
|
}, [fileUploaders.value.map((fileUploader, index2) => createVNode("li", {
|
|
1039
1322
|
"key": index2,
|
|
1040
1323
|
"class": [ns2.e("file-item"), ns2.e("file-tag")],
|
|
1041
|
-
"style": "display: inline-block;
|
|
1042
|
-
"title": fileUploader.file.name
|
|
1324
|
+
"style": "display: inline-block;",
|
|
1325
|
+
"title": fileUploader.file.name,
|
|
1326
|
+
"onClick": (event) => clickSelectedFile(event, fileUploader.file)
|
|
1043
1327
|
}, [createVNode("span", {
|
|
1044
1328
|
"class": [ns2.e("filename"), fileUploader.status === UploadStatus.failed ? ns2.m("failed-color") : ""]
|
|
1045
1329
|
}, [fileUploader.file.name]), createVNode(resolveComponent("d-icon"), {
|