vue-devui 1.0.0-rc.9 → 1.0.2
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 +189 -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 +8036 -260
- 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 +110 -45
- 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 +7778 -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 +12022 -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 +22 -5
- package/drawer/index.umd.js +1 -1
- package/drawer/style.css +1 -1
- package/dropdown/index.es.js +92 -123
- package/dropdown/index.umd.js +1 -1
- package/dropdown/style.css +1 -1
- package/editable-select/index.es.js +374 -149
- package/editable-select/index.umd.js +1 -1
- package/editable-select/style.css +1 -1
- package/form/index.es.js +102 -123
- package/form/index.umd.js +14 -14
- package/form/style.css +1 -1
- package/icon/index.es.js +107 -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 +8097 -170
- package/input/index.umd.js +27 -1
- package/input/style.css +1 -1
- package/input-number/index.es.js +34 -32
- 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/index.es.js +51 -51
- package/loading/index.umd.js +1 -1
- package/loading/style.css +1 -1
- package/mention/index.d.ts +7 -0
- package/mention/index.es.js +8326 -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 +921 -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 +539 -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 +390 -185
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/notification/index.es.js +148 -79
- 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/paginationInjectionKey.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 +87 -140
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +7 -4
- package/pagination/index.es.js +10180 -129
- package/pagination/index.umd.js +27 -1
- package/pagination/style.css +1 -1
- package/panel/index.es.js +4 -0
- package/panel/index.umd.js +1 -1
- package/panel/style.css +1 -1
- package/popover/index.es.js +111 -164
- package/popover/index.umd.js +16 -16
- package/popover/style.css +1 -1
- package/progress/style.css +1 -1
- package/radio/index.es.js +7860 -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 +93 -41
- package/result/index.umd.js +1 -1
- package/result/style.css +1 -1
- package/search/index.es.js +3737 -1206
- package/search/index.umd.js +18 -18
- package/search/style.css +1 -1
- package/select/index.es.js +4446 -2499
- 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 +284 -152
- 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/index.es.js +4 -0
- package/status/index.umd.js +1 -1
- package/status/style.css +1 -1
- package/steps/index.d.ts +7 -0
- package/steps/index.es.js +387 -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 +7785 -60
- package/switch/index.umd.js +27 -1
- package/switch/style.css +1 -1
- package/table/index.es.js +4224 -1502
- package/table/index.umd.js +17 -17
- package/table/style.css +1 -1
- package/tabs/index.es.js +281 -83
- 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 +3362 -1061
- 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 +9610 -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 +93 -41
- package/timeline/index.umd.js +1 -1
- package/timeline/style.css +1 -1
- package/tooltip/index.es.js +127 -168
- package/tooltip/index.umd.js +16 -16
- package/tooltip/style.css +1 -1
- package/tree/index.es.js +11045 -607
- package/tree/index.umd.js +27 -1
- package/tree/style.css +1 -1
- package/upload/index.es.js +394 -111
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +19687 -11762
- 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/Loading.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, withModifiers, 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,108 @@ 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
|
-
|
|
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
|
+
[ns2.m("no-slots")]: !Object.keys(ctx.slots).length
|
|
225
|
+
}));
|
|
226
|
+
const onClick = (e) => {
|
|
227
|
+
if (disabled.value) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
ctx.emit("click", e);
|
|
173
231
|
};
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
return createVNode("
|
|
177
|
-
"class":
|
|
178
|
-
"
|
|
179
|
-
|
|
180
|
-
color: color.value
|
|
181
|
-
}
|
|
182
|
-
}, attrs), null);
|
|
232
|
+
return () => {
|
|
233
|
+
var _a, _b, _c, _d;
|
|
234
|
+
return createVNode("div", {
|
|
235
|
+
"class": wrapClassed.value,
|
|
236
|
+
"onClick": onClick
|
|
237
|
+
}, [(_b = (_a = ctx.slots).prefix) == null ? void 0 : _b.call(_a), iconDom(), (_d = (_c = ctx.slots).suffix) == null ? void 0 : _d.call(_c)]);
|
|
183
238
|
};
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
var iconGroup = "";
|
|
242
|
+
defineComponent({
|
|
243
|
+
name: "DIconGroup",
|
|
244
|
+
setup(_, ctx) {
|
|
245
|
+
const ns2 = useNamespace("icon-group");
|
|
184
246
|
return () => {
|
|
185
|
-
|
|
247
|
+
var _a, _b;
|
|
248
|
+
return createVNode("div", {
|
|
249
|
+
"class": ns2.b()
|
|
250
|
+
}, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
|
|
186
251
|
};
|
|
187
252
|
}
|
|
188
253
|
});
|
|
@@ -202,15 +267,20 @@ var Close = defineComponent({
|
|
|
202
267
|
}
|
|
203
268
|
});
|
|
204
269
|
const ns = useNamespace("notification");
|
|
270
|
+
const XLINK = {
|
|
271
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
272
|
+
};
|
|
273
|
+
const XLINK_HREF = {
|
|
274
|
+
"xlink:href": "#path-s"
|
|
275
|
+
};
|
|
205
276
|
function SuccessIcon() {
|
|
206
|
-
return createVNode("svg", {
|
|
277
|
+
return createVNode("svg", mergeProps({
|
|
207
278
|
"width": "16px",
|
|
208
279
|
"height": "16px",
|
|
209
280
|
"viewBox": "0 0 16 16",
|
|
210
281
|
"version": "1.1",
|
|
211
|
-
"xmlns": "http://www.w3.org/2000/svg"
|
|
212
|
-
|
|
213
|
-
}, [createVNode("defs", null, [createVNode("polygon", {
|
|
282
|
+
"xmlns": "http://www.w3.org/2000/svg"
|
|
283
|
+
}, XLINK), [createVNode("defs", null, [createVNode("polygon", {
|
|
214
284
|
"id": "path-s",
|
|
215
285
|
"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
286
|
}, null)]), createVNode("g", {
|
|
@@ -222,30 +292,26 @@ function SuccessIcon() {
|
|
|
222
292
|
}, [createVNode("mask", {
|
|
223
293
|
"id": "mask-2",
|
|
224
294
|
"fill": "white"
|
|
225
|
-
}, [createVNode("use", {
|
|
226
|
-
"xlink:href": "#path-s"
|
|
227
|
-
}, null)]), createVNode("use", {
|
|
295
|
+
}, [createVNode("use", XLINK_HREF, null)]), createVNode("use", mergeProps({
|
|
228
296
|
"id": "Mask",
|
|
229
|
-
"class": ns.e("image-success-path")
|
|
230
|
-
|
|
231
|
-
}, null)])]);
|
|
297
|
+
"class": ns.e("image-success-path")
|
|
298
|
+
}, XLINK_HREF), null)])]);
|
|
232
299
|
}
|
|
233
300
|
function WarningIcon() {
|
|
234
|
-
return createVNode("svg", {
|
|
301
|
+
return createVNode("svg", mergeProps({
|
|
235
302
|
"width": "16px",
|
|
236
303
|
"height": "16px",
|
|
237
304
|
"viewBox": "0 0 16 16",
|
|
238
305
|
"version": "1.1",
|
|
239
|
-
"xmlns": "http://www.w3.org/2000/svg"
|
|
240
|
-
|
|
241
|
-
}, [createVNode("g", {
|
|
306
|
+
"xmlns": "http://www.w3.org/2000/svg"
|
|
307
|
+
}, XLINK), [createVNode("g", {
|
|
242
308
|
"stroke": "none",
|
|
243
309
|
"stroke-width": "1",
|
|
244
310
|
"fill": "none",
|
|
245
311
|
"fill-rule": "evenodd"
|
|
246
312
|
}, [createVNode("path", {
|
|
247
313
|
"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"
|
|
314
|
+
"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
315
|
}, null), createVNode("path", {
|
|
250
316
|
"class": ns.e("warning-inner"),
|
|
251
317
|
"stroke-width": "0.3",
|
|
@@ -254,14 +320,13 @@ function WarningIcon() {
|
|
|
254
320
|
}, null)])]);
|
|
255
321
|
}
|
|
256
322
|
function InfoIcon() {
|
|
257
|
-
return createVNode("svg", {
|
|
323
|
+
return createVNode("svg", mergeProps({
|
|
258
324
|
"width": "16px",
|
|
259
325
|
"height": "16px",
|
|
260
326
|
"viewBox": "0 0 16 16",
|
|
261
327
|
"version": "1.1",
|
|
262
|
-
"xmlns": "http://www.w3.org/2000/svg"
|
|
263
|
-
|
|
264
|
-
}, [createVNode("g", {
|
|
328
|
+
"xmlns": "http://www.w3.org/2000/svg"
|
|
329
|
+
}, XLINK), [createVNode("g", {
|
|
265
330
|
"id": "info",
|
|
266
331
|
"stroke": "none",
|
|
267
332
|
"stroke-width": "1",
|
|
@@ -274,14 +339,13 @@ function InfoIcon() {
|
|
|
274
339
|
}, null)])]);
|
|
275
340
|
}
|
|
276
341
|
function ErrorIcon() {
|
|
277
|
-
return createVNode("svg", {
|
|
342
|
+
return createVNode("svg", mergeProps({
|
|
278
343
|
"width": "16px",
|
|
279
344
|
"height": "16px",
|
|
280
345
|
"viewBox": "0 0 16 16",
|
|
281
346
|
"version": "1.1",
|
|
282
|
-
"xmlns": "http://www.w3.org/2000/svg"
|
|
283
|
-
|
|
284
|
-
}, [createVNode("defs", null, [createVNode("polygon", {
|
|
347
|
+
"xmlns": "http://www.w3.org/2000/svg"
|
|
348
|
+
}, XLINK), [createVNode("defs", null, [createVNode("polygon", {
|
|
285
349
|
"id": "path-e",
|
|
286
350
|
"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
351
|
}, null)]), createVNode("g", {
|
|
@@ -293,13 +357,10 @@ function ErrorIcon() {
|
|
|
293
357
|
}, [createVNode("mask", {
|
|
294
358
|
"id": "mask-2",
|
|
295
359
|
"fill": "white"
|
|
296
|
-
}, [createVNode("use", {
|
|
297
|
-
"xlink:href": "#path-e"
|
|
298
|
-
}, null)]), createVNode("use", {
|
|
360
|
+
}, [createVNode("use", XLINK_HREF, null)]), createVNode("use", mergeProps({
|
|
299
361
|
"id": "Mask",
|
|
300
|
-
"class": ns.e("image-error-path")
|
|
301
|
-
|
|
302
|
-
}, null)])]);
|
|
362
|
+
"class": ns.e("image-error-path")
|
|
363
|
+
}, XLINK_HREF), null)])]);
|
|
303
364
|
}
|
|
304
365
|
var TypeIcon = defineComponent({
|
|
305
366
|
props: {
|
|
@@ -334,7 +395,7 @@ function useEvent(props, emit) {
|
|
|
334
395
|
let timestamp;
|
|
335
396
|
const close2 = () => {
|
|
336
397
|
var _a;
|
|
337
|
-
clearTimeout(timer);
|
|
398
|
+
timer && clearTimeout(timer);
|
|
338
399
|
timer = null;
|
|
339
400
|
(_a = props.onClose) == null ? void 0 : _a.call(props);
|
|
340
401
|
emit("update:modelValue", false);
|
|
@@ -346,7 +407,7 @@ function useEvent(props, emit) {
|
|
|
346
407
|
}
|
|
347
408
|
};
|
|
348
409
|
const removeReset = () => {
|
|
349
|
-
if (
|
|
410
|
+
if (props.modelValue) {
|
|
350
411
|
const remainTime = props.duration - (Date.now() - timestamp);
|
|
351
412
|
timer = setTimeout(close2, remainTime);
|
|
352
413
|
}
|
|
@@ -395,7 +456,9 @@ var Notification = defineComponent({
|
|
|
395
456
|
default: () => {
|
|
396
457
|
var _a;
|
|
397
458
|
return [modelValue.value && createVNode("div", {
|
|
398
|
-
"class": ns2.b()
|
|
459
|
+
"class": ns2.b(),
|
|
460
|
+
"onClick": withModifiers(() => ({}), ["stop"]),
|
|
461
|
+
"onPointerup": withModifiers(() => ({}), ["stop"])
|
|
399
462
|
}, [createVNode("div", {
|
|
400
463
|
"class": classes.value,
|
|
401
464
|
"onMouseenter": interrupt,
|
|
@@ -427,13 +490,24 @@ const defaultOptions = {
|
|
|
427
490
|
};
|
|
428
491
|
function initInstance(props, content) {
|
|
429
492
|
const container = document.createElement("div");
|
|
493
|
+
container.classList.add("notification__warpper");
|
|
494
|
+
const lastChild = document.body.lastElementChild;
|
|
495
|
+
let offset_Top = 50;
|
|
496
|
+
if (lastChild == null ? void 0 : lastChild.classList.contains("notification__warpper")) {
|
|
497
|
+
const notification2 = lastChild.lastElementChild;
|
|
498
|
+
const rects = notification2.getBoundingClientRect();
|
|
499
|
+
const height = rects.height;
|
|
500
|
+
const top = rects.top;
|
|
501
|
+
offset_Top = height + top;
|
|
502
|
+
}
|
|
430
503
|
const app = createApp({
|
|
431
504
|
setup() {
|
|
432
505
|
onUnmounted(() => {
|
|
433
506
|
document.body.removeChild(container);
|
|
434
507
|
});
|
|
435
508
|
return () => createVNode(Notification, mergeProps(props, {
|
|
436
|
-
"onDestroy": app.unmount
|
|
509
|
+
"onDestroy": app.unmount,
|
|
510
|
+
"style": [`top: ${offset_Top}px`]
|
|
437
511
|
}), _isSlot(content) ? content : {
|
|
438
512
|
default: () => [content]
|
|
439
513
|
});
|
|
@@ -451,7 +525,6 @@ class NotificationService {
|
|
|
451
525
|
static open(options) {
|
|
452
526
|
const originOnClose = options.onClose || null;
|
|
453
527
|
const content = options.content;
|
|
454
|
-
let timer;
|
|
455
528
|
delete options.content;
|
|
456
529
|
const props = reactive(__spreadProps(__spreadValues(__spreadValues({}, defaultOptions), options), {
|
|
457
530
|
onClose: () => {
|
|
@@ -460,10 +533,6 @@ class NotificationService {
|
|
|
460
533
|
}));
|
|
461
534
|
initInstance(props, content);
|
|
462
535
|
props.modelValue = true;
|
|
463
|
-
clearTimeout(timer);
|
|
464
|
-
if (options.duration) {
|
|
465
|
-
timer = setTimeout(props.onClose, options.duration);
|
|
466
|
-
}
|
|
467
536
|
}
|
|
468
537
|
}
|
|
469
538
|
class IUploadOptions {
|
|
@@ -516,7 +585,7 @@ const uploadProps = {
|
|
|
516
585
|
},
|
|
517
586
|
placeholder: {
|
|
518
587
|
type: String,
|
|
519
|
-
default: "
|
|
588
|
+
default: ""
|
|
520
589
|
},
|
|
521
590
|
modelValue: {
|
|
522
591
|
type: Array,
|
|
@@ -555,30 +624,40 @@ const uploadProps = {
|
|
|
555
624
|
type: Function,
|
|
556
625
|
default: void 0
|
|
557
626
|
},
|
|
558
|
-
|
|
627
|
+
onError: {
|
|
628
|
+
type: Function,
|
|
629
|
+
default: void 0
|
|
630
|
+
},
|
|
631
|
+
onSuccess: {
|
|
632
|
+
type: Function,
|
|
633
|
+
default: void 0
|
|
634
|
+
},
|
|
635
|
+
onExceed: {
|
|
636
|
+
type: Function,
|
|
637
|
+
default: void 0
|
|
638
|
+
},
|
|
639
|
+
onProgress: {
|
|
559
640
|
type: Function,
|
|
560
641
|
default: void 0
|
|
561
642
|
},
|
|
562
|
-
|
|
643
|
+
onPreview: {
|
|
563
644
|
type: Function,
|
|
564
645
|
default: void 0
|
|
565
646
|
},
|
|
566
647
|
oneTimeUpload: {
|
|
567
648
|
type: Boolean,
|
|
568
649
|
default: false
|
|
650
|
+
},
|
|
651
|
+
limit: {
|
|
652
|
+
type: Number,
|
|
653
|
+
default: 0
|
|
654
|
+
},
|
|
655
|
+
httpRequest: {
|
|
656
|
+
type: Function,
|
|
657
|
+
default: void 0
|
|
569
658
|
}
|
|
570
659
|
};
|
|
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 = () => {
|
|
660
|
+
const useSelectFiles = (t) => {
|
|
582
661
|
const BEYOND_MAXIMAL_FILE_SIZE_MSG = ref("");
|
|
583
662
|
const simulateClickEvent = (input) => {
|
|
584
663
|
const evt = document.createEvent("MouseEvents");
|
|
@@ -639,13 +718,13 @@ const useSelectFiles = () => {
|
|
|
639
718
|
if (!isAllowedFileType(accept, file)) {
|
|
640
719
|
return {
|
|
641
720
|
checkError: true,
|
|
642
|
-
errorMsg: getNotAllowedFileTypeMsg(file.name, accept)
|
|
721
|
+
errorMsg: t("getNotAllowedFileTypeMsg")(file.name, accept)
|
|
643
722
|
};
|
|
644
723
|
}
|
|
645
724
|
if (uploadOptions && beyondMaximalSize(file.size, uploadOptions.maximumSize)) {
|
|
646
725
|
return {
|
|
647
726
|
checkError: true,
|
|
648
|
-
errorMsg: getBeyondMaximalFileSizeMsg(file.name, uploadOptions.maximumSize || 0)
|
|
727
|
+
errorMsg: t("getBeyondMaximalFileSizeMsg")(file.name, uploadOptions.maximumSize || 0)
|
|
649
728
|
};
|
|
650
729
|
}
|
|
651
730
|
return { checkError: false, errorMsg: void 0 };
|
|
@@ -659,7 +738,7 @@ const useSelectFiles = () => {
|
|
|
659
738
|
};
|
|
660
739
|
const checkAllFilesSize = (fileSize, maximumSize) => {
|
|
661
740
|
if (beyondMaximalSize(fileSize, maximumSize)) {
|
|
662
|
-
BEYOND_MAXIMAL_FILE_SIZE_MSG.value = getAllFilesBeyondMaximalFileSizeMsg(maximumSize);
|
|
741
|
+
BEYOND_MAXIMAL_FILE_SIZE_MSG.value = t("getAllFilesBeyondMaximalFileSizeMsg")(maximumSize);
|
|
663
742
|
return { checkError: true, errorMsg: BEYOND_MAXIMAL_FILE_SIZE_MSG.value };
|
|
664
743
|
}
|
|
665
744
|
};
|
|
@@ -865,11 +944,182 @@ const useUpload = () => {
|
|
|
865
944
|
};
|
|
866
945
|
};
|
|
867
946
|
var upload = "";
|
|
947
|
+
function deepAssign(...objects) {
|
|
948
|
+
const isObject = (obj) => obj && typeof obj === "object";
|
|
949
|
+
return objects.reduce((prev, from) => {
|
|
950
|
+
Object.keys(from).forEach((key) => {
|
|
951
|
+
const pVal = prev[key];
|
|
952
|
+
const oVal = from[key];
|
|
953
|
+
if (Array.isArray(pVal) && Array.isArray(oVal)) {
|
|
954
|
+
prev[key] = Array.from(/* @__PURE__ */ new Set([...oVal, ...pVal]));
|
|
955
|
+
} else if (isObject(pVal) && isObject(oVal)) {
|
|
956
|
+
prev[key] = deepAssign(pVal, oVal);
|
|
957
|
+
} else {
|
|
958
|
+
prev[key] = oVal;
|
|
959
|
+
}
|
|
960
|
+
});
|
|
961
|
+
return prev;
|
|
962
|
+
}, {});
|
|
963
|
+
}
|
|
964
|
+
var zhCN = {
|
|
965
|
+
pagination: {
|
|
966
|
+
totalItemText: "\u6240\u6709\u6761\u76EE",
|
|
967
|
+
goToText: "\u8DF3\u81F3",
|
|
968
|
+
perPage: "\u6761/\u9875"
|
|
969
|
+
},
|
|
970
|
+
accordion: {
|
|
971
|
+
loading: "\u52A0\u8F7D\u4E2D",
|
|
972
|
+
noData: "\u6CA1\u6709\u6570\u636E"
|
|
973
|
+
},
|
|
974
|
+
autoCompleteDropdown: {
|
|
975
|
+
latestInput: "\u6700\u8FD1\u8F93\u5165"
|
|
976
|
+
},
|
|
977
|
+
cascaderList: {
|
|
978
|
+
noData: "\u6CA1\u6709\u6570\u636E"
|
|
979
|
+
},
|
|
980
|
+
colorPicker: {
|
|
981
|
+
foundationPanel: "\u57FA\u7840\u9762\u677F",
|
|
982
|
+
advancedPanel: "\u9AD8\u7EA7\u9762\u677F"
|
|
983
|
+
},
|
|
984
|
+
datePickerPro: {
|
|
985
|
+
ok: "\u786E\u5B9A",
|
|
986
|
+
placeholder: "\u8BF7\u9009\u62E9\u65E5\u671F",
|
|
987
|
+
month1: "1\u6708",
|
|
988
|
+
month2: "2\u6708",
|
|
989
|
+
month3: "3\u6708",
|
|
990
|
+
month4: "4\u6708",
|
|
991
|
+
month5: "5\u6708",
|
|
992
|
+
month6: "6\u6708",
|
|
993
|
+
month7: "7\u6708",
|
|
994
|
+
month8: "8\u6708",
|
|
995
|
+
month9: "9\u6708",
|
|
996
|
+
month10: "10\u6708",
|
|
997
|
+
month11: "11\u6708",
|
|
998
|
+
month12: "12\u6708",
|
|
999
|
+
year: "\u5E74",
|
|
1000
|
+
startPlaceholder: "\u8BF7\u9009\u62E9\u5F00\u59CB\u65E5\u671F",
|
|
1001
|
+
endPlaceholder: "\u8BF7\u9009\u62E9\u7ED3\u675F\u65E5\u671F",
|
|
1002
|
+
getWeekDays() {
|
|
1003
|
+
return ["\u65E5", "\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D"];
|
|
1004
|
+
},
|
|
1005
|
+
getTimeArr() {
|
|
1006
|
+
return ["\u65F6", "\u5206", "\u79D2"];
|
|
1007
|
+
},
|
|
1008
|
+
getYearMonthStr(year, month) {
|
|
1009
|
+
return `${year}\u5E74${month}\u6708`;
|
|
1010
|
+
}
|
|
1011
|
+
},
|
|
1012
|
+
editableSelect: {
|
|
1013
|
+
noRelatedRecords: "\u627E\u4E0D\u5230\u76F8\u5173\u8BB0\u5F55",
|
|
1014
|
+
noData: "\u6CA1\u6709\u6570\u636E"
|
|
1015
|
+
},
|
|
1016
|
+
input: {
|
|
1017
|
+
placeholder: "\u8BF7\u8F93\u5165"
|
|
1018
|
+
},
|
|
1019
|
+
splitterBar: {
|
|
1020
|
+
collapse: "\u6536\u8D77",
|
|
1021
|
+
expand: "\u5C55\u5F00"
|
|
1022
|
+
},
|
|
1023
|
+
stepsGuide: {
|
|
1024
|
+
previous: "\u4E0A\u4E00\u6B65",
|
|
1025
|
+
continue: "\u6211\u77E5\u9053\u5566\uFF0C\u7EE7\u7EED",
|
|
1026
|
+
ok: "\u6211\u77E5\u9053\u5566"
|
|
1027
|
+
},
|
|
1028
|
+
table: {
|
|
1029
|
+
selectAll: "\u5168\u9009",
|
|
1030
|
+
ok: "\u786E\u5B9A"
|
|
1031
|
+
},
|
|
1032
|
+
timePopup: {
|
|
1033
|
+
ok: "\u786E\u5B9A"
|
|
1034
|
+
},
|
|
1035
|
+
transfer: {
|
|
1036
|
+
unit: "\u9879",
|
|
1037
|
+
panelUnit: "\u9879",
|
|
1038
|
+
headerUnit: "\u9879",
|
|
1039
|
+
noData: "\u6682\u65E0\u6570\u636E",
|
|
1040
|
+
placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u8BCD\u641C\u7D22"
|
|
1041
|
+
},
|
|
1042
|
+
tree: {
|
|
1043
|
+
loading: "\u52A0\u8F7D\u4E2D",
|
|
1044
|
+
newNode: "\u65B0\u8282\u70B9",
|
|
1045
|
+
selectPlaceholder: "\u8BF7\u9009\u62E9"
|
|
1046
|
+
},
|
|
1047
|
+
upload: {
|
|
1048
|
+
placeholder: "\u9009\u62E9\u6587\u4EF6",
|
|
1049
|
+
getExistSameNameFilesMsg(sameNames) {
|
|
1050
|
+
return `\u60A8\u4E0A\u4F20\u7684 "${sameNames}" \u5B58\u5728\u91CD\u540D\u6587\u4EF6, \u8BF7\u91CD\u65B0\u9009\u62E9\u6587\u4EF6`;
|
|
1051
|
+
},
|
|
1052
|
+
getAllFilesBeyondMaximalFileSizeMsg(maximalSize) {
|
|
1053
|
+
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`;
|
|
1054
|
+
},
|
|
1055
|
+
getBeyondMaximalFileSizeMsg(filename, maximalSize) {
|
|
1056
|
+
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`;
|
|
1057
|
+
},
|
|
1058
|
+
getNotAllowedFileTypeMsg(filename, scope) {
|
|
1059
|
+
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`;
|
|
1060
|
+
}
|
|
1061
|
+
},
|
|
1062
|
+
search: {
|
|
1063
|
+
placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u5B57"
|
|
1064
|
+
},
|
|
1065
|
+
select: {
|
|
1066
|
+
placeholder: "\u8BF7\u9009\u62E9",
|
|
1067
|
+
noDataText: "\u65E0\u6570\u636E",
|
|
1068
|
+
noMatchText: "\u627E\u4E0D\u5230\u76F8\u5173\u8BB0\u5F55",
|
|
1069
|
+
loadingText: "\u52A0\u8F7D\u4E2D..."
|
|
1070
|
+
},
|
|
1071
|
+
tagInput: {
|
|
1072
|
+
maxTagsText: "\u5DF2\u8FBE\u5230\u6700\u5927\u4E2A\u6570\uFF1A"
|
|
1073
|
+
},
|
|
1074
|
+
timeSelect: {
|
|
1075
|
+
placeholder: "\u8BF7\u9009\u62E9\u65F6\u95F4"
|
|
1076
|
+
}
|
|
1077
|
+
};
|
|
1078
|
+
const lang = ref("zh-CN");
|
|
1079
|
+
let langMessages = reactive({
|
|
1080
|
+
[lang.value]: zhCN
|
|
1081
|
+
});
|
|
1082
|
+
const Locale = {
|
|
1083
|
+
messages() {
|
|
1084
|
+
return langMessages[lang.value];
|
|
1085
|
+
},
|
|
1086
|
+
lang() {
|
|
1087
|
+
return lang.value;
|
|
1088
|
+
},
|
|
1089
|
+
use(newLang, newMessages) {
|
|
1090
|
+
lang.value = newLang;
|
|
1091
|
+
this.add({ [newLang]: newMessages });
|
|
1092
|
+
},
|
|
1093
|
+
add(newMessages = {}) {
|
|
1094
|
+
langMessages = deepAssign(langMessages, newMessages);
|
|
1095
|
+
}
|
|
1096
|
+
};
|
|
1097
|
+
const camelize = (name) => name.substring(1).replace(/^\S/, (s) => s.toLocaleLowerCase());
|
|
1098
|
+
function get(object, path) {
|
|
1099
|
+
const keys = path.split(".");
|
|
1100
|
+
let result = object;
|
|
1101
|
+
keys.forEach((key) => {
|
|
1102
|
+
var _a;
|
|
1103
|
+
result = (_a = result[key]) != null ? _a : "";
|
|
1104
|
+
});
|
|
1105
|
+
return result;
|
|
1106
|
+
}
|
|
1107
|
+
function createI18nTranslate(name, app, newPrefix) {
|
|
1108
|
+
const prefix = newPrefix || camelize(name) + ".";
|
|
1109
|
+
return (path) => {
|
|
1110
|
+
var _a;
|
|
1111
|
+
const messages = ((_a = app == null ? void 0 : app.appContext.config.globalProperties.langMessages) == null ? void 0 : _a.value) || Locale.messages();
|
|
1112
|
+
const message = get(messages, prefix + path) || get(messages, path);
|
|
1113
|
+
return message;
|
|
1114
|
+
};
|
|
1115
|
+
}
|
|
868
1116
|
var Upload = defineComponent({
|
|
869
1117
|
name: "DUpload",
|
|
870
1118
|
props: uploadProps,
|
|
871
1119
|
emits: ["fileDrop", "fileOver", "fileSelect", "deleteUploadedFile", "update:modelValue"],
|
|
872
1120
|
setup(props, ctx) {
|
|
1121
|
+
const app = getCurrentInstance();
|
|
1122
|
+
const t = createI18nTranslate("DUpload", app);
|
|
873
1123
|
const {
|
|
874
1124
|
uploadOptions,
|
|
875
1125
|
placeholder,
|
|
@@ -881,7 +1131,9 @@ var Upload = defineComponent({
|
|
|
881
1131
|
modelValue,
|
|
882
1132
|
multiple,
|
|
883
1133
|
accept,
|
|
884
|
-
webkitdirectory
|
|
1134
|
+
webkitdirectory,
|
|
1135
|
+
limit,
|
|
1136
|
+
httpRequest
|
|
885
1137
|
} = toRefs(props);
|
|
886
1138
|
const ns2 = useNamespace("upload");
|
|
887
1139
|
const inputGroupNs = useNamespace("input-group");
|
|
@@ -892,7 +1144,7 @@ var Upload = defineComponent({
|
|
|
892
1144
|
_validateFiles,
|
|
893
1145
|
triggerDropFiles,
|
|
894
1146
|
checkAllFilesSize
|
|
895
|
-
} = useSelectFiles();
|
|
1147
|
+
} = useSelectFiles(t);
|
|
896
1148
|
const {
|
|
897
1149
|
fileUploaders,
|
|
898
1150
|
addFile,
|
|
@@ -904,7 +1156,8 @@ var Upload = defineComponent({
|
|
|
904
1156
|
_oneTimeUpload,
|
|
905
1157
|
getSameNameFiles
|
|
906
1158
|
} = useUpload();
|
|
907
|
-
const
|
|
1159
|
+
const isDropOver = ref(false);
|
|
1160
|
+
const selectedFiles = ref([]);
|
|
908
1161
|
const alertMsg = (errorMsg) => {
|
|
909
1162
|
NotificationService.open({
|
|
910
1163
|
type: "warning",
|
|
@@ -932,7 +1185,7 @@ var Upload = defineComponent({
|
|
|
932
1185
|
}
|
|
933
1186
|
};
|
|
934
1187
|
const onFileOver = (event) => {
|
|
935
|
-
|
|
1188
|
+
isDropOver.value = event;
|
|
936
1189
|
ctx.emit("fileOver", event);
|
|
937
1190
|
};
|
|
938
1191
|
const deleteUploadedFile = (file) => {
|
|
@@ -943,7 +1196,7 @@ var Upload = defineComponent({
|
|
|
943
1196
|
ctx.emit("update:modelValue", newUploadedFiles);
|
|
944
1197
|
};
|
|
945
1198
|
const onDeleteFile = (event, file, status) => {
|
|
946
|
-
event.stopPropagation();
|
|
1199
|
+
event == null ? void 0 : event.stopPropagation();
|
|
947
1200
|
if (status === UploadStatus.uploaded) {
|
|
948
1201
|
deleteUploadedFile(file);
|
|
949
1202
|
}
|
|
@@ -972,20 +1225,33 @@ var Upload = defineComponent({
|
|
|
972
1225
|
removeFiles();
|
|
973
1226
|
return;
|
|
974
1227
|
}
|
|
1228
|
+
if (typeof (httpRequest == null ? void 0 : httpRequest.value) === "function") {
|
|
1229
|
+
const files = fileUploaders.value.map((tempFileUploader) => tempFileUploader.file);
|
|
1230
|
+
httpRequest.value(files);
|
|
1231
|
+
return;
|
|
1232
|
+
}
|
|
975
1233
|
const uploadObservable = oneTimeUpload.value ? _oneTimeUpload() : upload2(fileUploader);
|
|
1234
|
+
props.onProgress && props.onProgress(selectedFiles.value, modelValue.value);
|
|
976
1235
|
uploadObservable == null ? void 0 : uploadObservable.then((results) => {
|
|
977
|
-
props
|
|
1236
|
+
props.onSuccess && props.onSuccess(results);
|
|
978
1237
|
const newFiles = results.map((result) => result.file);
|
|
979
1238
|
const newUploadedFiles = [...newFiles, ...modelValue.value];
|
|
980
1239
|
ctx.emit("update:modelValue", newUploadedFiles);
|
|
1240
|
+
props.onChange && props.onChange(newFiles, newUploadedFiles);
|
|
981
1241
|
}).catch((error) => {
|
|
982
|
-
props
|
|
1242
|
+
props.onError && props.onError(error);
|
|
1243
|
+
props.onChange && props.onChange([error.file], modelValue.value);
|
|
983
1244
|
});
|
|
984
1245
|
});
|
|
985
1246
|
};
|
|
986
1247
|
const _dealFiles = (promise) => {
|
|
987
1248
|
resetSameNameFiles();
|
|
988
1249
|
promise.then((files) => {
|
|
1250
|
+
if (limit.value && modelValue.value.length + files.length > limit.value) {
|
|
1251
|
+
props.onExceed && props.onExceed(files, modelValue.value);
|
|
1252
|
+
return;
|
|
1253
|
+
}
|
|
1254
|
+
props.onChange && props.onChange(files, modelValue.value);
|
|
989
1255
|
files.forEach((file) => {
|
|
990
1256
|
if (!multiple.value) {
|
|
991
1257
|
removeFiles();
|
|
@@ -995,10 +1261,10 @@ var Upload = defineComponent({
|
|
|
995
1261
|
checkValid();
|
|
996
1262
|
const sameNameFiles = getSameNameFiles();
|
|
997
1263
|
if ((uploadOptions == null ? void 0 : uploadOptions.value) && uploadOptions.value.checkSameName && sameNameFiles.length) {
|
|
998
|
-
alertMsg(getExistSameNameFilesMsg(sameNameFiles));
|
|
1264
|
+
alertMsg(t("getExistSameNameFilesMsg")(sameNameFiles));
|
|
999
1265
|
}
|
|
1000
|
-
|
|
1001
|
-
ctx.emit("fileSelect", selectedFiles);
|
|
1266
|
+
selectedFiles.value = fileUploaders.value.filter((fileUploader) => fileUploader.status === UploadStatus.preLoad).map((fileUploader) => fileUploader.file);
|
|
1267
|
+
ctx.emit("fileSelect", selectedFiles.value);
|
|
1002
1268
|
if (autoUpload.value) {
|
|
1003
1269
|
fileUpload();
|
|
1004
1270
|
}
|
|
@@ -1017,15 +1283,31 @@ var Upload = defineComponent({
|
|
|
1017
1283
|
}));
|
|
1018
1284
|
};
|
|
1019
1285
|
const onFileDrop = (files) => {
|
|
1020
|
-
|
|
1286
|
+
isDropOver.value = false;
|
|
1021
1287
|
_dealFiles(triggerDropFiles(files));
|
|
1022
1288
|
ctx.emit("fileDrop", files);
|
|
1023
1289
|
};
|
|
1290
|
+
const submit = (event, fileUploader) => {
|
|
1291
|
+
fileUpload(event, fileUploader);
|
|
1292
|
+
};
|
|
1293
|
+
const clearFiles = (event) => {
|
|
1294
|
+
fileUploaders.value.forEach((fileUploader) => {
|
|
1295
|
+
onDeleteFile(event, fileUploader.file, fileUploader.status);
|
|
1296
|
+
});
|
|
1297
|
+
};
|
|
1298
|
+
const clickSelectedFile = (event, file) => {
|
|
1299
|
+
event == null ? void 0 : event.stopPropagation();
|
|
1300
|
+
props.onPreview && props.onPreview(file);
|
|
1301
|
+
};
|
|
1302
|
+
ctx.expose({
|
|
1303
|
+
submit,
|
|
1304
|
+
clearFiles
|
|
1305
|
+
});
|
|
1024
1306
|
return () => {
|
|
1025
1307
|
var _a, _b, _c, _d;
|
|
1026
1308
|
return createVNode("div", null, [withDirectives(createVNode("div", {
|
|
1027
1309
|
"class": ns2.b(),
|
|
1028
|
-
"style": `border: ${
|
|
1310
|
+
"style": `border: ${isDropOver.value ? "1px solid #15bf15" : "0"}`
|
|
1029
1311
|
}, [((_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)) ? createVNode("div", {
|
|
1030
1312
|
"onClick": handleClick
|
|
1031
1313
|
}, [ctx.slots.default()]) : createVNode("div", {
|
|
@@ -1033,13 +1315,14 @@ var Upload = defineComponent({
|
|
|
1033
1315
|
"onClick": handleClick
|
|
1034
1316
|
}, [fileUploaders.value.length === 0 && createVNode("div", {
|
|
1035
1317
|
"class": [formControlNs.b(), ns2.e("placeholder")]
|
|
1036
|
-
}, [placeholder.value]), fileUploaders.value.length > 0 && createVNode("ul", {
|
|
1318
|
+
}, [placeholder.value || t("placeholder")]), fileUploaders.value.length > 0 && createVNode("ul", {
|
|
1037
1319
|
"class": [formControlNs.b(), ns2.e("files-list")]
|
|
1038
1320
|
}, [fileUploaders.value.map((fileUploader, index2) => createVNode("li", {
|
|
1039
1321
|
"key": index2,
|
|
1040
1322
|
"class": [ns2.e("file-item"), ns2.e("file-tag")],
|
|
1041
|
-
"style": "display: inline-block;
|
|
1042
|
-
"title": fileUploader.file.name
|
|
1323
|
+
"style": "display: inline-block;",
|
|
1324
|
+
"title": fileUploader.file.name,
|
|
1325
|
+
"onClick": (event) => clickSelectedFile(event, fileUploader.file)
|
|
1043
1326
|
}, [createVNode("span", {
|
|
1044
1327
|
"class": [ns2.e("filename"), fileUploader.status === UploadStatus.failed ? ns2.m("failed-color") : ""]
|
|
1045
1328
|
}, [fileUploader.file.name]), createVNode(resolveComponent("d-icon"), {
|