vue-devui 1.0.0-rc.8 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +188 -149
- package/alert/index.es.js +14 -9
- package/alert/index.umd.js +1 -1
- package/alert/style.css +1 -1
- package/auto-complete/index.es.js +8392 -418
- package/auto-complete/index.umd.js +29 -5
- package/auto-complete/style.css +1 -1
- package/avatar/index.es.js +59 -74
- package/avatar/index.umd.js +1 -1
- package/badge/index.es.js +10 -4
- package/badge/index.umd.js +1 -1
- package/badge/style.css +1 -1
- package/button/index.es.js +191 -53
- package/button/index.umd.js +17 -17
- package/button/style.css +1 -1
- package/card/index.es.js +7 -3
- package/card/index.umd.js +1 -1
- package/card/style.css +1 -1
- package/checkbox/index.es.js +8050 -241
- 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 +24 -7
- package/drawer/index.umd.js +1 -1
- package/drawer/style.css +1 -1
- package/dropdown/index.es.js +190 -165
- package/dropdown/index.umd.js +1 -1
- package/dropdown/style.css +1 -1
- package/editable-select/index.es.js +785 -145
- package/editable-select/index.umd.js +1 -1
- package/editable-select/style.css +1 -1
- package/form/index.es.js +399 -300
- package/form/index.umd.js +16 -16
- package/form/style.css +1 -1
- package/fullscreen/index.es.js +2 -2
- package/fullscreen/index.umd.js +1 -1
- package/grid/index.es.js +8 -6
- package/grid/index.umd.js +1 -1
- package/icon/index.es.js +185 -23
- package/icon/index.umd.js +1 -1
- package/icon/style.css +1 -0
- package/image-preview/index.es.js +2 -2
- package/image-preview/index.umd.js +1 -1
- package/image-preview/style.css +1 -1
- package/input/index.es.js +8220 -45
- package/input/index.umd.js +27 -1
- package/input/style.css +1 -1
- package/input-number/index.es.js +279 -204
- package/input-number/index.umd.js +1 -1
- package/input-number/style.css +1 -1
- package/layout/index.es.js +3 -3
- package/layout/index.umd.js +1 -1
- package/loading/index.es.js +53 -53
- 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 +8319 -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 +451 -173
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/notification/index.es.js +212 -70
- package/notification/index.umd.js +1 -1
- package/notification/style.css +1 -1
- package/nuxt/components/CheckboxButton.js +3 -0
- 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/Icon.js +1 -0
- package/nuxt/components/IconGroup.js +3 -0
- package/nuxt/components/LABEL_DATA.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/Option.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/iconProps.js +1 -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/svgIconProps.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 +89 -142
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +8 -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 +262 -229
- package/popover/index.umd.js +15 -15
- package/popover/style.css +1 -1
- package/progress/index.es.js +2 -2
- package/progress/index.umd.js +2 -2
- package/progress/style.css +1 -1
- package/radio/index.es.js +7954 -156
- package/radio/index.umd.js +27 -1
- package/radio/style.css +1 -1
- package/rate/index.es.js +16 -8
- package/rate/index.umd.js +1 -1
- package/rate/style.css +1 -1
- package/result/index.es.js +170 -22
- package/result/index.umd.js +1 -1
- package/result/style.css +1 -1
- package/search/index.es.js +3829 -1042
- package/search/index.umd.js +18 -18
- package/search/style.css +1 -1
- package/select/index.es.js +9202 -495
- package/select/index.umd.js +27 -1
- package/select/style.css +1 -1
- package/skeleton/index.es.js +89 -263
- package/skeleton/index.umd.js +1 -1
- package/skeleton/style.css +1 -1
- package/slider/index.es.js +118 -145
- package/slider/index.umd.js +1 -1
- package/slider/style.css +1 -1
- package/splitter/index.es.js +454 -233
- package/splitter/index.umd.js +13 -13
- 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 +6 -2
- 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 +7787 -62
- package/switch/index.umd.js +27 -1
- package/switch/style.css +1 -1
- package/table/index.es.js +5225 -1726
- package/table/index.umd.js +18 -18
- package/table/style.css +1 -1
- package/tabs/index.es.js +303 -102
- package/tabs/index.umd.js +1 -1
- package/tabs/style.css +1 -1
- package/tag/index.es.js +11 -8
- package/tag/index.umd.js +1 -1
- package/tag/style.css +1 -1
- package/textarea/index.es.js +7876 -41
- package/textarea/index.umd.js +35 -1
- 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 +9607 -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 +170 -22
- package/timeline/index.umd.js +1 -1
- package/timeline/style.css +1 -1
- package/tooltip/index.es.js +286 -238
- package/tooltip/index.umd.js +14 -14
- package/tooltip/style.css +1 -1
- package/tree/index.es.js +11342 -793
- package/tree/index.umd.js +27 -1
- package/tree/style.css +1 -1
- package/upload/index.es.js +458 -102
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +20475 -11072
- package/vue-devui.umd.js +31 -24
- package/date-picker/index.es.js +0 -1097
- 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/FormControl.js +0 -3
- package/nuxt/components/FormLabel.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, createVNode,
|
|
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,6 +43,7 @@ const notificationProps = {
|
|
|
43
43
|
type: Function
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
|
+
const DEFAULT_PREFIX = "icon";
|
|
46
47
|
const iconProps = {
|
|
47
48
|
name: {
|
|
48
49
|
type: String,
|
|
@@ -50,46 +51,48 @@ const iconProps = {
|
|
|
50
51
|
required: true
|
|
51
52
|
},
|
|
52
53
|
size: {
|
|
53
|
-
type: String,
|
|
54
|
+
type: [Number, String],
|
|
54
55
|
default: "inherit"
|
|
55
56
|
},
|
|
56
57
|
color: {
|
|
57
58
|
type: String,
|
|
58
59
|
default: "inherit"
|
|
59
60
|
},
|
|
61
|
+
component: {
|
|
62
|
+
type: Object,
|
|
63
|
+
default: null
|
|
64
|
+
},
|
|
60
65
|
classPrefix: {
|
|
61
66
|
type: String,
|
|
62
|
-
default:
|
|
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]
|
|
63
79
|
}
|
|
64
80
|
};
|
|
65
|
-
|
|
66
|
-
name:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
"alt": name.value.split("/")[name.value.split("/").length - 1],
|
|
79
|
-
"style": {
|
|
80
|
-
width: size.value,
|
|
81
|
-
verticalAlign: "text-bottom"
|
|
82
|
-
}
|
|
83
|
-
}, null) : createVNode("i", {
|
|
84
|
-
"class": `${classPrefix.value} ${classPrefix.value}-${name.value}`,
|
|
85
|
-
"style": {
|
|
86
|
-
fontSize: size.value,
|
|
87
|
-
color: color.value
|
|
88
|
-
}
|
|
89
|
-
}, null);
|
|
90
|
-
};
|
|
81
|
+
const svgIconProps = {
|
|
82
|
+
name: {
|
|
83
|
+
type: String,
|
|
84
|
+
default: "",
|
|
85
|
+
required: true
|
|
86
|
+
},
|
|
87
|
+
color: {
|
|
88
|
+
type: String,
|
|
89
|
+
default: "inherit"
|
|
90
|
+
},
|
|
91
|
+
size: {
|
|
92
|
+
type: [Number, String],
|
|
93
|
+
default: "inherit"
|
|
91
94
|
}
|
|
92
|
-
}
|
|
95
|
+
};
|
|
93
96
|
function createBem(namespace, element, modifier) {
|
|
94
97
|
let cls = namespace;
|
|
95
98
|
if (element) {
|
|
@@ -100,8 +103,8 @@ function createBem(namespace, element, modifier) {
|
|
|
100
103
|
}
|
|
101
104
|
return cls;
|
|
102
105
|
}
|
|
103
|
-
function useNamespace(block) {
|
|
104
|
-
const namespace = `devui-${block}`;
|
|
106
|
+
function useNamespace(block, needDot = false) {
|
|
107
|
+
const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
|
|
105
108
|
const b = () => createBem(namespace);
|
|
106
109
|
const e = (element) => element ? createBem(namespace, element) : "";
|
|
107
110
|
const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
|
|
@@ -113,6 +116,141 @@ function useNamespace(block) {
|
|
|
113
116
|
em
|
|
114
117
|
};
|
|
115
118
|
}
|
|
119
|
+
var icon = "";
|
|
120
|
+
var svgIcon = defineComponent({
|
|
121
|
+
name: "DSvgIcon",
|
|
122
|
+
props: svgIconProps,
|
|
123
|
+
setup(props) {
|
|
124
|
+
const {
|
|
125
|
+
name,
|
|
126
|
+
color,
|
|
127
|
+
size
|
|
128
|
+
} = toRefs(props);
|
|
129
|
+
const ns2 = useNamespace("svg-icon");
|
|
130
|
+
const iconName = computed(() => `#icon-${name.value}`);
|
|
131
|
+
const iconSize = computed(() => {
|
|
132
|
+
return typeof size.value === "number" ? `${size.value}px` : size.value;
|
|
133
|
+
});
|
|
134
|
+
const styles = {
|
|
135
|
+
width: iconSize.value,
|
|
136
|
+
height: iconSize.value
|
|
137
|
+
};
|
|
138
|
+
return () => {
|
|
139
|
+
return createVNode("svg", {
|
|
140
|
+
"class": ns2.b(),
|
|
141
|
+
"style": styles
|
|
142
|
+
}, [createVNode("use", {
|
|
143
|
+
"xlink:href": iconName.value,
|
|
144
|
+
"fill": color.value
|
|
145
|
+
}, null)]);
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
function isUrl(value) {
|
|
150
|
+
return /^((http|https):)?\/\//.test(value);
|
|
151
|
+
}
|
|
152
|
+
function useIconDom(props, ctx) {
|
|
153
|
+
const {
|
|
154
|
+
component,
|
|
155
|
+
name,
|
|
156
|
+
size,
|
|
157
|
+
color,
|
|
158
|
+
classPrefix,
|
|
159
|
+
rotate
|
|
160
|
+
} = toRefs(props);
|
|
161
|
+
const ns2 = useNamespace("icon");
|
|
162
|
+
const iconSize = computed(() => {
|
|
163
|
+
return typeof size.value === "number" ? `${size.value}px` : size.value;
|
|
164
|
+
});
|
|
165
|
+
const IconComponent = component.value ? resolveDynamicComponent(component.value) : resolveDynamicComponent(svgIcon);
|
|
166
|
+
const imgIconDom = () => {
|
|
167
|
+
return createVNode("img", mergeProps({
|
|
168
|
+
"src": name.value,
|
|
169
|
+
"alt": name.value.split("/")[name.value.split("/").length - 1],
|
|
170
|
+
"class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns2.m("spin")],
|
|
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
|
+
}
|
|
207
|
+
var Icon = defineComponent({
|
|
208
|
+
name: "DIcon",
|
|
209
|
+
props: iconProps,
|
|
210
|
+
emits: ["click"],
|
|
211
|
+
setup(props, ctx) {
|
|
212
|
+
const {
|
|
213
|
+
disabled,
|
|
214
|
+
operable
|
|
215
|
+
} = toRefs(props);
|
|
216
|
+
const {
|
|
217
|
+
iconDom
|
|
218
|
+
} = useIconDom(props, ctx);
|
|
219
|
+
const ns2 = useNamespace("icon");
|
|
220
|
+
const wrapClassed = computed(() => ({
|
|
221
|
+
[ns2.e("container")]: true,
|
|
222
|
+
[ns2.m("disabled")]: disabled.value,
|
|
223
|
+
[ns2.m("operable")]: operable.value,
|
|
224
|
+
[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);
|
|
231
|
+
};
|
|
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)]);
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
var iconGroup = "";
|
|
242
|
+
defineComponent({
|
|
243
|
+
name: "DIconGroup",
|
|
244
|
+
setup(_, ctx) {
|
|
245
|
+
const ns2 = useNamespace("icon-group");
|
|
246
|
+
return () => {
|
|
247
|
+
var _a, _b;
|
|
248
|
+
return createVNode("div", {
|
|
249
|
+
"class": ns2.b()
|
|
250
|
+
}, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
});
|
|
116
254
|
var Close = defineComponent({
|
|
117
255
|
emits: ["click"],
|
|
118
256
|
setup(props, {
|
|
@@ -129,15 +267,20 @@ var Close = defineComponent({
|
|
|
129
267
|
}
|
|
130
268
|
});
|
|
131
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
|
+
};
|
|
132
276
|
function SuccessIcon() {
|
|
133
|
-
return createVNode("svg", {
|
|
277
|
+
return createVNode("svg", mergeProps({
|
|
134
278
|
"width": "16px",
|
|
135
279
|
"height": "16px",
|
|
136
280
|
"viewBox": "0 0 16 16",
|
|
137
281
|
"version": "1.1",
|
|
138
|
-
"xmlns": "http://www.w3.org/2000/svg"
|
|
139
|
-
|
|
140
|
-
}, [createVNode("defs", null, [createVNode("polygon", {
|
|
282
|
+
"xmlns": "http://www.w3.org/2000/svg"
|
|
283
|
+
}, XLINK), [createVNode("defs", null, [createVNode("polygon", {
|
|
141
284
|
"id": "path-s",
|
|
142
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"
|
|
143
286
|
}, null)]), createVNode("g", {
|
|
@@ -149,30 +292,26 @@ function SuccessIcon() {
|
|
|
149
292
|
}, [createVNode("mask", {
|
|
150
293
|
"id": "mask-2",
|
|
151
294
|
"fill": "white"
|
|
152
|
-
}, [createVNode("use", {
|
|
153
|
-
"xlink:href": "#path-s"
|
|
154
|
-
}, null)]), createVNode("use", {
|
|
295
|
+
}, [createVNode("use", XLINK_HREF, null)]), createVNode("use", mergeProps({
|
|
155
296
|
"id": "Mask",
|
|
156
|
-
"class": ns.e("image-success-path")
|
|
157
|
-
|
|
158
|
-
}, null)])]);
|
|
297
|
+
"class": ns.e("image-success-path")
|
|
298
|
+
}, XLINK_HREF), null)])]);
|
|
159
299
|
}
|
|
160
300
|
function WarningIcon() {
|
|
161
|
-
return createVNode("svg", {
|
|
301
|
+
return createVNode("svg", mergeProps({
|
|
162
302
|
"width": "16px",
|
|
163
303
|
"height": "16px",
|
|
164
304
|
"viewBox": "0 0 16 16",
|
|
165
305
|
"version": "1.1",
|
|
166
|
-
"xmlns": "http://www.w3.org/2000/svg"
|
|
167
|
-
|
|
168
|
-
}, [createVNode("g", {
|
|
306
|
+
"xmlns": "http://www.w3.org/2000/svg"
|
|
307
|
+
}, XLINK), [createVNode("g", {
|
|
169
308
|
"stroke": "none",
|
|
170
309
|
"stroke-width": "1",
|
|
171
310
|
"fill": "none",
|
|
172
311
|
"fill-rule": "evenodd"
|
|
173
312
|
}, [createVNode("path", {
|
|
174
313
|
"class": ns.e("warning-outer"),
|
|
175
|
-
"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"
|
|
176
315
|
}, null), createVNode("path", {
|
|
177
316
|
"class": ns.e("warning-inner"),
|
|
178
317
|
"stroke-width": "0.3",
|
|
@@ -181,14 +320,13 @@ function WarningIcon() {
|
|
|
181
320
|
}, null)])]);
|
|
182
321
|
}
|
|
183
322
|
function InfoIcon() {
|
|
184
|
-
return createVNode("svg", {
|
|
323
|
+
return createVNode("svg", mergeProps({
|
|
185
324
|
"width": "16px",
|
|
186
325
|
"height": "16px",
|
|
187
326
|
"viewBox": "0 0 16 16",
|
|
188
327
|
"version": "1.1",
|
|
189
|
-
"xmlns": "http://www.w3.org/2000/svg"
|
|
190
|
-
|
|
191
|
-
}, [createVNode("g", {
|
|
328
|
+
"xmlns": "http://www.w3.org/2000/svg"
|
|
329
|
+
}, XLINK), [createVNode("g", {
|
|
192
330
|
"id": "info",
|
|
193
331
|
"stroke": "none",
|
|
194
332
|
"stroke-width": "1",
|
|
@@ -201,14 +339,13 @@ function InfoIcon() {
|
|
|
201
339
|
}, null)])]);
|
|
202
340
|
}
|
|
203
341
|
function ErrorIcon() {
|
|
204
|
-
return createVNode("svg", {
|
|
342
|
+
return createVNode("svg", mergeProps({
|
|
205
343
|
"width": "16px",
|
|
206
344
|
"height": "16px",
|
|
207
345
|
"viewBox": "0 0 16 16",
|
|
208
346
|
"version": "1.1",
|
|
209
|
-
"xmlns": "http://www.w3.org/2000/svg"
|
|
210
|
-
|
|
211
|
-
}, [createVNode("defs", null, [createVNode("polygon", {
|
|
347
|
+
"xmlns": "http://www.w3.org/2000/svg"
|
|
348
|
+
}, XLINK), [createVNode("defs", null, [createVNode("polygon", {
|
|
212
349
|
"id": "path-e",
|
|
213
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"
|
|
214
351
|
}, null)]), createVNode("g", {
|
|
@@ -220,13 +357,10 @@ function ErrorIcon() {
|
|
|
220
357
|
}, [createVNode("mask", {
|
|
221
358
|
"id": "mask-2",
|
|
222
359
|
"fill": "white"
|
|
223
|
-
}, [createVNode("use", {
|
|
224
|
-
"xlink:href": "#path-e"
|
|
225
|
-
}, null)]), createVNode("use", {
|
|
360
|
+
}, [createVNode("use", XLINK_HREF, null)]), createVNode("use", mergeProps({
|
|
226
361
|
"id": "Mask",
|
|
227
|
-
"class": ns.e("image-error-path")
|
|
228
|
-
|
|
229
|
-
}, null)])]);
|
|
362
|
+
"class": ns.e("image-error-path")
|
|
363
|
+
}, XLINK_HREF), null)])]);
|
|
230
364
|
}
|
|
231
365
|
var TypeIcon = defineComponent({
|
|
232
366
|
props: {
|
|
@@ -261,7 +395,7 @@ function useEvent(props, emit) {
|
|
|
261
395
|
let timestamp;
|
|
262
396
|
const close2 = () => {
|
|
263
397
|
var _a;
|
|
264
|
-
clearTimeout(timer);
|
|
398
|
+
timer && clearTimeout(timer);
|
|
265
399
|
timer = null;
|
|
266
400
|
(_a = props.onClose) == null ? void 0 : _a.call(props);
|
|
267
401
|
emit("update:modelValue", false);
|
|
@@ -273,7 +407,7 @@ function useEvent(props, emit) {
|
|
|
273
407
|
}
|
|
274
408
|
};
|
|
275
409
|
const removeReset = () => {
|
|
276
|
-
if (
|
|
410
|
+
if (props.modelValue) {
|
|
277
411
|
const remainTime = props.duration - (Date.now() - timestamp);
|
|
278
412
|
timer = setTimeout(close2, remainTime);
|
|
279
413
|
}
|
|
@@ -322,7 +456,9 @@ var Notification = defineComponent({
|
|
|
322
456
|
default: () => {
|
|
323
457
|
var _a;
|
|
324
458
|
return [modelValue.value && createVNode("div", {
|
|
325
|
-
"class": ns2.b()
|
|
459
|
+
"class": ns2.b(),
|
|
460
|
+
"onClick": withModifiers(() => ({}), ["stop"]),
|
|
461
|
+
"onPointerup": withModifiers(() => ({}), ["stop"])
|
|
326
462
|
}, [createVNode("div", {
|
|
327
463
|
"class": classes.value,
|
|
328
464
|
"onMouseenter": interrupt,
|
|
@@ -354,13 +490,24 @@ const defaultOptions = {
|
|
|
354
490
|
};
|
|
355
491
|
function initInstance(props, content) {
|
|
356
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
|
+
}
|
|
357
503
|
const app = createApp({
|
|
358
504
|
setup() {
|
|
359
505
|
onUnmounted(() => {
|
|
360
506
|
document.body.removeChild(container);
|
|
361
507
|
});
|
|
362
508
|
return () => createVNode(Notification, mergeProps(props, {
|
|
363
|
-
"onDestroy": app.unmount
|
|
509
|
+
"onDestroy": app.unmount,
|
|
510
|
+
"style": [`top: ${offset_Top}px`]
|
|
364
511
|
}), _isSlot(content) ? content : {
|
|
365
512
|
default: () => [content]
|
|
366
513
|
});
|
|
@@ -378,7 +525,6 @@ class NotificationService {
|
|
|
378
525
|
static open(options) {
|
|
379
526
|
const originOnClose = options.onClose || null;
|
|
380
527
|
const content = options.content;
|
|
381
|
-
let timer;
|
|
382
528
|
delete options.content;
|
|
383
529
|
const props = reactive(__spreadProps(__spreadValues(__spreadValues({}, defaultOptions), options), {
|
|
384
530
|
onClose: () => {
|
|
@@ -387,10 +533,6 @@ class NotificationService {
|
|
|
387
533
|
}));
|
|
388
534
|
initInstance(props, content);
|
|
389
535
|
props.modelValue = true;
|
|
390
|
-
clearTimeout(timer);
|
|
391
|
-
if (options.duration) {
|
|
392
|
-
timer = setTimeout(props.onClose, options.duration);
|
|
393
|
-
}
|
|
394
536
|
}
|
|
395
537
|
}
|
|
396
538
|
class IUploadOptions {
|
|
@@ -443,7 +585,7 @@ const uploadProps = {
|
|
|
443
585
|
},
|
|
444
586
|
placeholder: {
|
|
445
587
|
type: String,
|
|
446
|
-
default: "
|
|
588
|
+
default: ""
|
|
447
589
|
},
|
|
448
590
|
modelValue: {
|
|
449
591
|
type: Array,
|
|
@@ -482,30 +624,40 @@ const uploadProps = {
|
|
|
482
624
|
type: Function,
|
|
483
625
|
default: void 0
|
|
484
626
|
},
|
|
485
|
-
|
|
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: {
|
|
486
640
|
type: Function,
|
|
487
641
|
default: void 0
|
|
488
642
|
},
|
|
489
|
-
|
|
643
|
+
onPreview: {
|
|
490
644
|
type: Function,
|
|
491
645
|
default: void 0
|
|
492
646
|
},
|
|
493
647
|
oneTimeUpload: {
|
|
494
648
|
type: Boolean,
|
|
495
649
|
default: false
|
|
650
|
+
},
|
|
651
|
+
limit: {
|
|
652
|
+
type: Number,
|
|
653
|
+
default: 0
|
|
654
|
+
},
|
|
655
|
+
httpRequest: {
|
|
656
|
+
type: Function,
|
|
657
|
+
default: void 0
|
|
496
658
|
}
|
|
497
659
|
};
|
|
498
|
-
const
|
|
499
|
-
const getBeyondMaximalFileSizeMsg = (filename, maximalSize) => {
|
|
500
|
-
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`;
|
|
501
|
-
};
|
|
502
|
-
const getNotAllowedFileTypeMsg = (filename, scope) => {
|
|
503
|
-
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`;
|
|
504
|
-
};
|
|
505
|
-
const getExistSameNameFilesMsg = (sameNames) => {
|
|
506
|
-
return `\u60A8\u4E0A\u4F20\u7684 "${sameNames}" \u5B58\u5728\u91CD\u540D\u6587\u4EF6, \u8BF7\u91CD\u65B0\u9009\u62E9\u6587\u4EF6`;
|
|
507
|
-
};
|
|
508
|
-
const useSelectFiles = () => {
|
|
660
|
+
const useSelectFiles = (t) => {
|
|
509
661
|
const BEYOND_MAXIMAL_FILE_SIZE_MSG = ref("");
|
|
510
662
|
const simulateClickEvent = (input) => {
|
|
511
663
|
const evt = document.createEvent("MouseEvents");
|
|
@@ -566,13 +718,13 @@ const useSelectFiles = () => {
|
|
|
566
718
|
if (!isAllowedFileType(accept, file)) {
|
|
567
719
|
return {
|
|
568
720
|
checkError: true,
|
|
569
|
-
errorMsg: getNotAllowedFileTypeMsg(file.name, accept)
|
|
721
|
+
errorMsg: t("getNotAllowedFileTypeMsg")(file.name, accept)
|
|
570
722
|
};
|
|
571
723
|
}
|
|
572
724
|
if (uploadOptions && beyondMaximalSize(file.size, uploadOptions.maximumSize)) {
|
|
573
725
|
return {
|
|
574
726
|
checkError: true,
|
|
575
|
-
errorMsg: getBeyondMaximalFileSizeMsg(file.name, uploadOptions.maximumSize || 0)
|
|
727
|
+
errorMsg: t("getBeyondMaximalFileSizeMsg")(file.name, uploadOptions.maximumSize || 0)
|
|
576
728
|
};
|
|
577
729
|
}
|
|
578
730
|
return { checkError: false, errorMsg: void 0 };
|
|
@@ -586,7 +738,7 @@ const useSelectFiles = () => {
|
|
|
586
738
|
};
|
|
587
739
|
const checkAllFilesSize = (fileSize, maximumSize) => {
|
|
588
740
|
if (beyondMaximalSize(fileSize, maximumSize)) {
|
|
589
|
-
BEYOND_MAXIMAL_FILE_SIZE_MSG.value = getAllFilesBeyondMaximalFileSizeMsg(maximumSize);
|
|
741
|
+
BEYOND_MAXIMAL_FILE_SIZE_MSG.value = t("getAllFilesBeyondMaximalFileSizeMsg")(maximumSize);
|
|
590
742
|
return { checkError: true, errorMsg: BEYOND_MAXIMAL_FILE_SIZE_MSG.value };
|
|
591
743
|
}
|
|
592
744
|
};
|
|
@@ -792,11 +944,182 @@ const useUpload = () => {
|
|
|
792
944
|
};
|
|
793
945
|
};
|
|
794
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
|
+
}
|
|
795
1116
|
var Upload = defineComponent({
|
|
796
1117
|
name: "DUpload",
|
|
797
1118
|
props: uploadProps,
|
|
798
1119
|
emits: ["fileDrop", "fileOver", "fileSelect", "deleteUploadedFile", "update:modelValue"],
|
|
799
1120
|
setup(props, ctx) {
|
|
1121
|
+
const app = getCurrentInstance();
|
|
1122
|
+
const t = createI18nTranslate("DUpload", app);
|
|
800
1123
|
const {
|
|
801
1124
|
uploadOptions,
|
|
802
1125
|
placeholder,
|
|
@@ -808,7 +1131,9 @@ var Upload = defineComponent({
|
|
|
808
1131
|
modelValue,
|
|
809
1132
|
multiple,
|
|
810
1133
|
accept,
|
|
811
|
-
webkitdirectory
|
|
1134
|
+
webkitdirectory,
|
|
1135
|
+
limit,
|
|
1136
|
+
httpRequest
|
|
812
1137
|
} = toRefs(props);
|
|
813
1138
|
const ns2 = useNamespace("upload");
|
|
814
1139
|
const inputGroupNs = useNamespace("input-group");
|
|
@@ -819,7 +1144,7 @@ var Upload = defineComponent({
|
|
|
819
1144
|
_validateFiles,
|
|
820
1145
|
triggerDropFiles,
|
|
821
1146
|
checkAllFilesSize
|
|
822
|
-
} = useSelectFiles();
|
|
1147
|
+
} = useSelectFiles(t);
|
|
823
1148
|
const {
|
|
824
1149
|
fileUploaders,
|
|
825
1150
|
addFile,
|
|
@@ -831,7 +1156,8 @@ var Upload = defineComponent({
|
|
|
831
1156
|
_oneTimeUpload,
|
|
832
1157
|
getSameNameFiles
|
|
833
1158
|
} = useUpload();
|
|
834
|
-
const
|
|
1159
|
+
const isDropOver = ref(false);
|
|
1160
|
+
const selectedFiles = ref([]);
|
|
835
1161
|
const alertMsg = (errorMsg) => {
|
|
836
1162
|
NotificationService.open({
|
|
837
1163
|
type: "warning",
|
|
@@ -859,7 +1185,7 @@ var Upload = defineComponent({
|
|
|
859
1185
|
}
|
|
860
1186
|
};
|
|
861
1187
|
const onFileOver = (event) => {
|
|
862
|
-
|
|
1188
|
+
isDropOver.value = event;
|
|
863
1189
|
ctx.emit("fileOver", event);
|
|
864
1190
|
};
|
|
865
1191
|
const deleteUploadedFile = (file) => {
|
|
@@ -870,7 +1196,7 @@ var Upload = defineComponent({
|
|
|
870
1196
|
ctx.emit("update:modelValue", newUploadedFiles);
|
|
871
1197
|
};
|
|
872
1198
|
const onDeleteFile = (event, file, status) => {
|
|
873
|
-
event.stopPropagation();
|
|
1199
|
+
event == null ? void 0 : event.stopPropagation();
|
|
874
1200
|
if (status === UploadStatus.uploaded) {
|
|
875
1201
|
deleteUploadedFile(file);
|
|
876
1202
|
}
|
|
@@ -899,20 +1225,33 @@ var Upload = defineComponent({
|
|
|
899
1225
|
removeFiles();
|
|
900
1226
|
return;
|
|
901
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
|
+
}
|
|
902
1233
|
const uploadObservable = oneTimeUpload.value ? _oneTimeUpload() : upload2(fileUploader);
|
|
1234
|
+
props.onProgress && props.onProgress(selectedFiles.value, modelValue.value);
|
|
903
1235
|
uploadObservable == null ? void 0 : uploadObservable.then((results) => {
|
|
904
|
-
props
|
|
1236
|
+
props.onSuccess && props.onSuccess(results);
|
|
905
1237
|
const newFiles = results.map((result) => result.file);
|
|
906
1238
|
const newUploadedFiles = [...newFiles, ...modelValue.value];
|
|
907
1239
|
ctx.emit("update:modelValue", newUploadedFiles);
|
|
1240
|
+
props.onChange && props.onChange(newFiles, newUploadedFiles);
|
|
908
1241
|
}).catch((error) => {
|
|
909
|
-
props
|
|
1242
|
+
props.onError && props.onError(error);
|
|
1243
|
+
props.onChange && props.onChange([error.file], modelValue.value);
|
|
910
1244
|
});
|
|
911
1245
|
});
|
|
912
1246
|
};
|
|
913
1247
|
const _dealFiles = (promise) => {
|
|
914
1248
|
resetSameNameFiles();
|
|
915
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);
|
|
916
1255
|
files.forEach((file) => {
|
|
917
1256
|
if (!multiple.value) {
|
|
918
1257
|
removeFiles();
|
|
@@ -922,10 +1261,10 @@ var Upload = defineComponent({
|
|
|
922
1261
|
checkValid();
|
|
923
1262
|
const sameNameFiles = getSameNameFiles();
|
|
924
1263
|
if ((uploadOptions == null ? void 0 : uploadOptions.value) && uploadOptions.value.checkSameName && sameNameFiles.length) {
|
|
925
|
-
alertMsg(getExistSameNameFilesMsg(sameNameFiles));
|
|
1264
|
+
alertMsg(t("getExistSameNameFilesMsg")(sameNameFiles));
|
|
926
1265
|
}
|
|
927
|
-
|
|
928
|
-
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);
|
|
929
1268
|
if (autoUpload.value) {
|
|
930
1269
|
fileUpload();
|
|
931
1270
|
}
|
|
@@ -944,15 +1283,31 @@ var Upload = defineComponent({
|
|
|
944
1283
|
}));
|
|
945
1284
|
};
|
|
946
1285
|
const onFileDrop = (files) => {
|
|
947
|
-
|
|
1286
|
+
isDropOver.value = false;
|
|
948
1287
|
_dealFiles(triggerDropFiles(files));
|
|
949
1288
|
ctx.emit("fileDrop", files);
|
|
950
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
|
+
});
|
|
951
1306
|
return () => {
|
|
952
1307
|
var _a, _b, _c, _d;
|
|
953
1308
|
return createVNode("div", null, [withDirectives(createVNode("div", {
|
|
954
1309
|
"class": ns2.b(),
|
|
955
|
-
"style": `border: ${
|
|
1310
|
+
"style": `border: ${isDropOver.value ? "1px solid #15bf15" : "0"}`
|
|
956
1311
|
}, [((_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)) ? createVNode("div", {
|
|
957
1312
|
"onClick": handleClick
|
|
958
1313
|
}, [ctx.slots.default()]) : createVNode("div", {
|
|
@@ -960,13 +1315,14 @@ var Upload = defineComponent({
|
|
|
960
1315
|
"onClick": handleClick
|
|
961
1316
|
}, [fileUploaders.value.length === 0 && createVNode("div", {
|
|
962
1317
|
"class": [formControlNs.b(), ns2.e("placeholder")]
|
|
963
|
-
}, [placeholder.value]), fileUploaders.value.length > 0 && createVNode("ul", {
|
|
1318
|
+
}, [placeholder.value || t("placeholder")]), fileUploaders.value.length > 0 && createVNode("ul", {
|
|
964
1319
|
"class": [formControlNs.b(), ns2.e("files-list")]
|
|
965
1320
|
}, [fileUploaders.value.map((fileUploader, index2) => createVNode("li", {
|
|
966
1321
|
"key": index2,
|
|
967
1322
|
"class": [ns2.e("file-item"), ns2.e("file-tag")],
|
|
968
|
-
"style": "display: inline-block;
|
|
969
|
-
"title": fileUploader.file.name
|
|
1323
|
+
"style": "display: inline-block;",
|
|
1324
|
+
"title": fileUploader.file.name,
|
|
1325
|
+
"onClick": (event) => clickSelectedFile(event, fileUploader.file)
|
|
970
1326
|
}, [createVNode("span", {
|
|
971
1327
|
"class": [ns2.e("filename"), fileUploader.status === UploadStatus.failed ? ns2.m("failed-color") : ""]
|
|
972
1328
|
}, [fileUploader.file.name]), createVNode(resolveComponent("d-icon"), {
|