vue-devui 1.0.0-rc.0 → 1.0.0-rc.11
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 +78 -116
- package/alert/index.es.js +74 -45
- package/alert/index.umd.js +1 -1
- package/alert/style.css +1 -1
- package/auto-complete/index.es.js +8190 -296
- package/auto-complete/index.umd.js +29 -1
- package/auto-complete/style.css +1 -1
- package/avatar/index.es.js +153 -146
- package/avatar/index.umd.js +1 -1
- package/avatar/style.css +1 -1
- package/badge/index.es.js +34 -5
- package/badge/index.umd.js +1 -1
- package/badge/style.css +1 -1
- package/button/index.es.js +5741 -127
- package/button/index.umd.js +27 -1
- package/button/style.css +1 -1
- package/card/index.es.js +63 -35
- package/card/index.umd.js +1 -1
- package/card/style.css +1 -1
- package/checkbox/index.es.js +8068 -255
- package/checkbox/index.umd.js +27 -1
- package/checkbox/style.css +1 -1
- package/{accordion → collapse}/index.d.ts +0 -0
- package/collapse/index.es.js +379 -0
- package/collapse/index.umd.js +1 -0
- package/{anchor → collapse}/package.json +1 -1
- package/collapse/style.css +1 -0
- package/countdown/index.es.js +5 -7
- package/countdown/index.umd.js +1 -1
- package/date-picker/index.es.js +8167 -288
- package/date-picker/index.umd.js +27 -1
- package/date-picker/style.css +1 -1
- package/drawer/index.es.js +31 -4
- package/drawer/index.umd.js +1 -1
- package/drawer/style.css +1 -1
- package/dropdown/index.es.js +297 -181
- package/dropdown/index.umd.js +1 -1
- package/dropdown/style.css +1 -1
- package/editable-select/index.es.js +525 -154
- package/editable-select/index.umd.js +1 -1
- package/editable-select/style.css +1 -1
- package/form/index.es.js +1048 -1176
- package/form/index.umd.js +16 -16
- package/form/style.css +1 -1
- package/fullscreen/index.es.js +42 -21
- package/fullscreen/index.umd.js +1 -1
- package/fullscreen/style.css +1 -1
- package/grid/index.es.js +101 -86
- package/grid/index.umd.js +1 -1
- package/grid/style.css +1 -1
- package/icon/index.es.js +197 -56
- package/icon/index.umd.js +1 -1
- package/icon/style.css +1 -0
- package/image-preview/index.es.js +55 -31
- package/image-preview/index.umd.js +1 -1
- package/image-preview/style.css +1 -1
- package/input/index.es.js +8074 -144
- package/input/index.umd.js +27 -1
- package/input/style.css +1 -1
- package/input-number/index.es.js +269 -183
- package/input-number/index.umd.js +1 -1
- package/input-number/style.css +1 -1
- package/layout/index.es.js +40 -25
- package/layout/index.umd.js +1 -1
- package/layout/style.css +1 -1
- package/loading/index.es.js +74 -35
- package/loading/index.umd.js +1 -1
- package/loading/style.css +1 -1
- package/modal/index.es.js +412 -204
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/notification/index.es.js +307 -57
- package/notification/index.umd.js +1 -1
- package/notification/style.css +1 -1
- package/nuxt/components/ButtonGroup.js +3 -0
- package/nuxt/components/CheckboxButton.js +3 -0
- package/nuxt/components/CheckboxGroup.js +3 -0
- package/nuxt/components/Collapse.js +3 -0
- package/nuxt/components/CollapseItem.js +3 -0
- package/nuxt/components/DropdownPropsKey.js +3 -0
- package/nuxt/components/FORM_ITEM_TOKEN.js +3 -0
- package/nuxt/components/FORM_TOKEN.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/LoadingOptions.js +3 -0
- package/nuxt/components/Option.js +3 -0
- package/nuxt/components/PanelBody.js +3 -0
- package/nuxt/components/PanelFooter.js +3 -0
- package/nuxt/components/PanelHeader.js +3 -0
- package/nuxt/components/RadioButton.js +3 -0
- package/nuxt/components/TABLE_TOKEN.js +3 -0
- package/nuxt/components/Tab.js +3 -0
- package/nuxt/components/TimeSelect.js +3 -0
- package/nuxt/components/Timeline.js +3 -0
- package/nuxt/components/TimelineItem.js +3 -0
- package/nuxt/components/alertProps.js +3 -0
- package/nuxt/components/autoCompleteProps.js +3 -0
- package/nuxt/components/avatarProps.js +3 -0
- package/nuxt/components/buttonGroupInjectionKey.js +3 -0
- package/nuxt/components/buttonGroupProps.js +3 -0
- package/nuxt/components/cardProps.js +3 -0
- package/nuxt/components/checkboxGroupInjectionKey.js +3 -0
- package/nuxt/components/checkboxGroupProps.js +3 -0
- package/nuxt/components/checkboxProps.js +3 -0
- package/nuxt/components/colProps.js +3 -0
- package/nuxt/components/colPropsBaseClass.js +3 -0
- package/nuxt/components/colPropsBaseStyle.js +3 -0
- package/nuxt/components/collapseItemProps.js +3 -0
- package/nuxt/components/collapseProps.js +3 -0
- package/nuxt/components/countdownProps.js +3 -0
- package/nuxt/components/editableSelectProps.js +3 -0
- package/nuxt/components/formItemProps.js +3 -0
- package/nuxt/components/formProps.js +3 -0
- package/nuxt/components/fullscreenProps.js +3 -0
- package/nuxt/components/iconProps.js +3 -0
- package/nuxt/components/imagePreviewProps.js +3 -0
- package/nuxt/components/inputProps.js +3 -0
- package/nuxt/components/loadingProps.js +3 -0
- package/nuxt/components/modalProps.js +3 -0
- package/nuxt/components/paginationProps.js +3 -0
- package/nuxt/components/panelProps.js +3 -0
- package/nuxt/components/progressProps.js +3 -0
- package/nuxt/components/rateProps.js +3 -0
- package/nuxt/components/resultProps.js +3 -0
- package/nuxt/components/rowProps.js +3 -0
- package/nuxt/components/screenSizes.js +3 -0
- package/nuxt/components/searchProps.js +3 -0
- package/nuxt/components/skeletonProps.js +3 -0
- package/nuxt/components/sliderProps.js +3 -0
- package/nuxt/components/splitterProps.js +3 -0
- package/nuxt/components/statisticProps.js +3 -0
- package/nuxt/components/svgIconProps.js +3 -0
- package/nuxt/components/switchProps.js +3 -0
- package/nuxt/components/tableProps.js +3 -0
- package/nuxt/components/tabsProps.js +3 -0
- package/nuxt/components/tagProps.js +3 -0
- package/nuxt/components/textareaProps.js +3 -0
- package/nuxt/components/timeAxisProps.js +3 -0
- package/nuxt/components/treeProps.js +3 -0
- package/overlay/index.es.js +127 -149
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +11 -44
- package/pagination/index.es.js +158 -148
- package/pagination/index.umd.js +1 -1
- package/pagination/style.css +1 -1
- package/panel/index.es.js +45 -32
- package/panel/index.umd.js +1 -1
- package/panel/style.css +1 -1
- package/popover/index.es.js +317 -246
- package/popover/index.umd.js +15 -15
- package/popover/style.css +1 -1
- package/progress/index.es.js +110 -56
- package/progress/index.umd.js +3 -3
- package/progress/style.css +1 -1
- package/radio/index.es.js +7972 -157
- package/radio/index.umd.js +27 -1
- package/radio/style.css +1 -1
- package/rate/index.es.js +77 -55
- package/rate/index.umd.js +1 -1
- package/rate/style.css +1 -1
- package/result/index.es.js +184 -57
- package/result/index.umd.js +1 -1
- package/result/style.css +1 -1
- package/ripple/index.es.js +47 -42
- package/ripple/index.umd.js +1 -1
- package/search/index.es.js +3653 -1122
- package/search/index.umd.js +18 -18
- package/search/style.css +1 -1
- package/select/index.es.js +9170 -596
- package/select/index.umd.js +27 -1
- package/select/style.css +1 -1
- package/skeleton/index.es.js +63 -41
- package/skeleton/index.umd.js +1 -1
- package/skeleton/style.css +1 -1
- package/slider/index.es.js +144 -137
- package/slider/index.umd.js +1 -1
- package/slider/style.css +1 -1
- package/splitter/index.es.js +469 -349
- package/splitter/index.umd.js +15 -15
- package/splitter/style.css +1 -1
- package/statistic/index.es.js +41 -34
- package/statistic/index.umd.js +1 -1
- package/statistic/style.css +1 -1
- package/status/index.es.js +27 -6
- package/status/index.umd.js +1 -1
- package/status/style.css +1 -1
- package/style.css +1 -1
- package/switch/index.es.js +7802 -64
- package/switch/index.umd.js +27 -1
- package/switch/style.css +1 -1
- package/table/index.es.js +10459 -1511
- package/table/index.umd.js +27 -1
- package/table/style.css +1 -1
- package/tabs/index.es.js +344 -141
- package/tabs/index.umd.js +1 -1
- package/tabs/style.css +1 -1
- package/tag/index.es.js +49 -24
- package/tag/index.umd.js +1 -1
- package/tag/style.css +1 -1
- package/textarea/index.es.js +7921 -83
- package/textarea/index.umd.js +35 -1
- package/textarea/style.css +1 -1
- package/{anchor → time-select}/index.d.ts +0 -0
- package/{color-picker → time-select}/index.es.js +4171 -2898
- package/time-select/index.umd.js +27 -0
- package/{breadcrumb → time-select}/package.json +1 -1
- package/time-select/style.css +1 -0
- package/{back-top → timeline}/index.d.ts +0 -0
- package/timeline/index.es.js +425 -0
- package/timeline/index.umd.js +1 -0
- package/{back-top → timeline}/package.json +1 -1
- package/timeline/style.css +1 -0
- package/tooltip/index.es.js +308 -236
- package/tooltip/index.umd.js +15 -15
- package/tooltip/style.css +1 -1
- package/tree/index.es.js +5198 -1850
- package/tree/index.umd.js +18 -18
- package/tree/style.css +1 -1
- package/upload/index.es.js +427 -132
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +12064 -15841
- package/vue-devui.umd.js +30 -20
- package/accordion/index.es.js +0 -720
- package/accordion/index.umd.js +0 -1
- package/accordion/package.json +0 -7
- package/accordion/style.css +0 -1
- package/anchor/index.es.js +0 -263
- package/anchor/index.umd.js +0 -1
- package/anchor/style.css +0 -1
- package/back-top/index.es.js +0 -128
- package/back-top/index.umd.js +0 -1
- package/back-top/style.css +0 -1
- package/breadcrumb/index.d.ts +0 -7
- package/breadcrumb/index.es.js +0 -127
- package/breadcrumb/index.umd.js +0 -1
- package/breadcrumb/style.css +0 -1
- package/carousel/index.d.ts +0 -7
- package/carousel/index.es.js +0 -329
- package/carousel/index.umd.js +0 -1
- package/carousel/package.json +0 -7
- package/carousel/style.css +0 -1
- package/cascader/index.d.ts +0 -7
- package/cascader/index.es.js +0 -5963
- package/cascader/index.umd.js +0 -27
- package/cascader/package.json +0 -7
- package/cascader/style.css +0 -1
- package/color-picker/index.d.ts +0 -7
- package/color-picker/index.umd.js +0 -27
- package/color-picker/package.json +0 -7
- package/color-picker/style.css +0 -1
- package/comment/index.d.ts +0 -7
- package/comment/index.es.js +0 -86
- package/comment/index.umd.js +0 -1
- package/comment/package.json +0 -7
- package/comment/style.css +0 -1
- package/dragdrop/index.d.ts +0 -7
- package/dragdrop/index.es.js +0 -157
- package/dragdrop/index.umd.js +0 -1
- package/dragdrop/package.json +0 -7
- package/gantt/index.d.ts +0 -7
- package/gantt/index.es.js +0 -523
- package/gantt/index.umd.js +0 -1
- package/gantt/package.json +0 -7
- package/gantt/style.css +0 -1
- package/input-icon/index.d.ts +0 -7
- package/input-icon/index.es.js +0 -331
- package/input-icon/index.umd.js +0 -1
- package/input-icon/package.json +0 -7
- package/input-icon/style.css +0 -1
- package/list/index.d.ts +0 -7
- package/list/index.es.js +0 -39
- package/list/index.umd.js +0 -1
- package/list/package.json +0 -7
- package/list/style.css +0 -1
- package/nav-sprite/index.d.ts +0 -7
- package/nav-sprite/index.es.js +0 -68
- package/nav-sprite/index.umd.js +0 -1
- package/nav-sprite/package.json +0 -7
- package/nuxt/components/Accordion.js +0 -3
- package/nuxt/components/Anchor.js +0 -3
- package/nuxt/components/BackTop.js +0 -3
- package/nuxt/components/Breadcrumb.js +0 -3
- package/nuxt/components/Carousel.js +0 -3
- package/nuxt/components/CarouselItem.js +0 -3
- package/nuxt/components/Cascader.js +0 -3
- package/nuxt/components/ColorPicker.js +0 -3
- package/nuxt/components/Comment.js +0 -3
- package/nuxt/components/FormControl.js +0 -3
- package/nuxt/components/FormLabel.js +0 -3
- package/nuxt/components/Gantt.js +0 -3
- package/nuxt/components/InputIcon.js +0 -3
- package/nuxt/components/List.js +0 -3
- package/nuxt/components/ListItem.js +0 -3
- package/nuxt/components/NavSprite.js +0 -2
- package/nuxt/components/QuadrantDiagram.js +0 -3
- package/nuxt/components/ReadTip.js +0 -3
- package/nuxt/components/StepsGuide.js +0 -3
- package/nuxt/components/Sticky.js +0 -2
- package/nuxt/components/TagInput.js +0 -3
- package/nuxt/components/TimeAxis.js +0 -3
- package/nuxt/components/TimeAxisItem.js +0 -3
- package/nuxt/components/TimePicker.js +0 -3
- package/nuxt/components/Transfer.js +0 -3
- package/nuxt/components/TreeSelect.js +0 -3
- package/nuxt/components/overlayEmits.js +0 -3
- package/nuxt/components/overlayProps.js +0 -3
- package/quadrant-diagram/index.d.ts +0 -7
- package/quadrant-diagram/index.es.js +0 -5728
- package/quadrant-diagram/index.umd.js +0 -27
- package/quadrant-diagram/package.json +0 -7
- package/quadrant-diagram/style.css +0 -1
- package/read-tip/index.d.ts +0 -7
- package/read-tip/index.es.js +0 -258
- package/read-tip/index.umd.js +0 -1
- package/read-tip/package.json +0 -7
- package/read-tip/style.css +0 -1
- package/steps-guide/index.d.ts +0 -7
- package/steps-guide/index.es.js +0 -239
- package/steps-guide/index.umd.js +0 -1
- package/steps-guide/package.json +0 -7
- package/steps-guide/style.css +0 -1
- package/sticky/index.d.ts +0 -7
- package/sticky/index.es.js +0 -197
- package/sticky/index.umd.js +0 -1
- package/sticky/package.json +0 -7
- package/tag-input/index.d.ts +0 -7
- package/tag-input/index.es.js +0 -329
- package/tag-input/index.umd.js +0 -1
- package/tag-input/package.json +0 -7
- package/tag-input/style.css +0 -1
- package/time-axis/index.d.ts +0 -7
- package/time-axis/index.es.js +0 -299
- package/time-axis/index.umd.js +0 -1
- package/time-axis/package.json +0 -7
- package/time-axis/style.css +0 -1
- package/time-picker/index.d.ts +0 -7
- package/time-picker/index.es.js +0 -1237
- package/time-picker/index.umd.js +0 -1
- package/time-picker/package.json +0 -7
- package/time-picker/style.css +0 -1
- package/transfer/index.d.ts +0 -7
- package/transfer/index.es.js +0 -7608
- package/transfer/index.umd.js +0 -27
- package/transfer/package.json +0 -7
- package/transfer/style.css +0 -1
- package/tree-select/index.d.ts +0 -7
- package/tree-select/index.es.js +0 -623
- package/tree-select/index.umd.js +0 -1
- package/tree-select/package.json +0 -7
- package/tree-select/style.css +0 -1
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, createVNode,
|
|
24
|
+
import { defineComponent, toRefs, computed, createVNode, resolveDynamicComponent, mergeProps, watch, Transition, reactive, createApp, onUnmounted, isVNode, ref, withDirectives, resolveComponent, resolveDirective } from "vue";
|
|
25
25
|
const notificationProps = {
|
|
26
26
|
modelValue: {
|
|
27
27
|
type: Boolean,
|
|
@@ -43,62 +43,219 @@ const notificationProps = {
|
|
|
43
43
|
type: Function
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
},
|
|
53
|
-
size: {
|
|
54
|
-
type: String,
|
|
55
|
-
default: "inherit"
|
|
56
|
-
},
|
|
57
|
-
color: {
|
|
58
|
-
type: String,
|
|
59
|
-
default: "inherit"
|
|
60
|
-
},
|
|
61
|
-
classPrefix: {
|
|
62
|
-
type: String,
|
|
63
|
-
default: "icon"
|
|
64
|
-
}
|
|
46
|
+
const DEFAULT_PREFIX = "icon";
|
|
47
|
+
const iconProps = {
|
|
48
|
+
name: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: "",
|
|
51
|
+
required: true
|
|
65
52
|
},
|
|
66
|
-
|
|
67
|
-
|
|
53
|
+
size: {
|
|
54
|
+
type: [Number, String],
|
|
55
|
+
default: "inherit"
|
|
56
|
+
},
|
|
57
|
+
color: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: "inherit"
|
|
60
|
+
},
|
|
61
|
+
component: {
|
|
62
|
+
type: Object,
|
|
63
|
+
default: null
|
|
64
|
+
},
|
|
65
|
+
classPrefix: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: DEFAULT_PREFIX
|
|
68
|
+
},
|
|
69
|
+
operable: {
|
|
70
|
+
type: Boolean,
|
|
71
|
+
default: false
|
|
72
|
+
},
|
|
73
|
+
disabled: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: false
|
|
68
76
|
},
|
|
69
|
-
|
|
77
|
+
rotate: {
|
|
78
|
+
type: [Number, String]
|
|
79
|
+
}
|
|
80
|
+
};
|
|
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"
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
function createBem(namespace, element, modifier) {
|
|
97
|
+
let cls = namespace;
|
|
98
|
+
if (element) {
|
|
99
|
+
cls += `__${element}`;
|
|
100
|
+
}
|
|
101
|
+
if (modifier) {
|
|
102
|
+
cls += `--${modifier}`;
|
|
103
|
+
}
|
|
104
|
+
return cls;
|
|
105
|
+
}
|
|
106
|
+
function useNamespace(block, needDot = false) {
|
|
107
|
+
const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
|
|
108
|
+
const b = () => createBem(namespace);
|
|
109
|
+
const e = (element) => element ? createBem(namespace, element) : "";
|
|
110
|
+
const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
|
|
111
|
+
const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
|
|
112
|
+
return {
|
|
113
|
+
b,
|
|
114
|
+
e,
|
|
115
|
+
m,
|
|
116
|
+
em
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
var icon = "";
|
|
120
|
+
var svgIcon = defineComponent({
|
|
121
|
+
name: "DSvgIcon",
|
|
122
|
+
props: svgIconProps,
|
|
123
|
+
setup(props) {
|
|
70
124
|
const {
|
|
71
125
|
name,
|
|
72
|
-
size,
|
|
73
126
|
color,
|
|
74
|
-
|
|
75
|
-
} =
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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")],
|
|
79
171
|
"style": {
|
|
80
|
-
width:
|
|
81
|
-
|
|
172
|
+
width: iconSize.value || "",
|
|
173
|
+
transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
|
|
82
174
|
}
|
|
83
|
-
},
|
|
84
|
-
|
|
175
|
+
}, ctx.attrs), null);
|
|
176
|
+
};
|
|
177
|
+
const svgIconDom = () => {
|
|
178
|
+
return createVNode(IconComponent, mergeProps({
|
|
179
|
+
"name": name.value,
|
|
180
|
+
"color": color.value,
|
|
181
|
+
"size": iconSize.value,
|
|
182
|
+
"class": [(rotate == null ? void 0 : rotate.value) === "infinite" && ns2.m("spin")],
|
|
85
183
|
"style": {
|
|
86
|
-
|
|
87
|
-
|
|
184
|
+
transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
|
|
185
|
+
}
|
|
186
|
+
}, ctx.attrs), null);
|
|
187
|
+
};
|
|
188
|
+
const fontIconDom = () => {
|
|
189
|
+
const fontIconClass = /^icon-/.test(name.value) ? name.value : `${classPrefix.value}-${name.value}`;
|
|
190
|
+
return createVNode("i", mergeProps({
|
|
191
|
+
"class": [classPrefix.value, fontIconClass, (rotate == null ? void 0 : rotate.value) === "infinite" && ns2.m("spin")],
|
|
192
|
+
"style": {
|
|
193
|
+
fontSize: iconSize.value,
|
|
194
|
+
color: color.value,
|
|
195
|
+
transform: `rotate(${rotate == null ? void 0 : rotate.value}deg)`
|
|
196
|
+
}
|
|
197
|
+
}, ctx.attrs), null);
|
|
198
|
+
};
|
|
199
|
+
const iconDom = () => {
|
|
200
|
+
return component.value ? svgIconDom() : isUrl(name.value) ? imgIconDom() : fontIconDom();
|
|
201
|
+
};
|
|
202
|
+
return {
|
|
203
|
+
iconDom
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
var Icon = defineComponent({
|
|
207
|
+
name: "DIcon",
|
|
208
|
+
props: iconProps,
|
|
209
|
+
setup(props, ctx) {
|
|
210
|
+
const {
|
|
211
|
+
disabled,
|
|
212
|
+
operable
|
|
213
|
+
} = toRefs(props);
|
|
214
|
+
const {
|
|
215
|
+
iconDom
|
|
216
|
+
} = useIconDom(props, ctx);
|
|
217
|
+
const ns2 = useNamespace("icon");
|
|
218
|
+
const wrapClassed = computed(() => ({
|
|
219
|
+
[ns2.e("container")]: true,
|
|
220
|
+
[ns2.m("disabled")]: disabled.value,
|
|
221
|
+
[ns2.m("operable")]: operable.value
|
|
222
|
+
}));
|
|
223
|
+
const onClick = (e) => {
|
|
224
|
+
e.stopImmediatePropagation();
|
|
225
|
+
if (disabled.value) {
|
|
226
|
+
e.preventDefault();
|
|
88
227
|
}
|
|
89
|
-
}
|
|
228
|
+
};
|
|
229
|
+
return () => {
|
|
230
|
+
var _a, _b, _c, _d;
|
|
231
|
+
return createVNode("div", {
|
|
232
|
+
"class": wrapClassed.value,
|
|
233
|
+
"onClick": onClick
|
|
234
|
+
}, [(_b = (_a = ctx.slots).prefix) == null ? void 0 : _b.call(_a), iconDom(), (_d = (_c = ctx.slots).suffix) == null ? void 0 : _d.call(_c)]);
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
var iconGroup = "";
|
|
239
|
+
defineComponent({
|
|
240
|
+
name: "DIconGroup",
|
|
241
|
+
setup(_, ctx) {
|
|
242
|
+
const ns2 = useNamespace("icon-group");
|
|
243
|
+
return () => {
|
|
244
|
+
var _a, _b;
|
|
245
|
+
return createVNode("div", {
|
|
246
|
+
"class": ns2.b()
|
|
247
|
+
}, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
|
|
248
|
+
};
|
|
90
249
|
}
|
|
91
250
|
});
|
|
92
|
-
Icon.install = function(app) {
|
|
93
|
-
app.component(Icon.name, Icon);
|
|
94
|
-
};
|
|
95
251
|
var Close = defineComponent({
|
|
96
252
|
emits: ["click"],
|
|
97
253
|
setup(props, {
|
|
98
254
|
emit
|
|
99
255
|
}) {
|
|
256
|
+
const ns2 = useNamespace("notification");
|
|
100
257
|
return () => createVNode("div", {
|
|
101
|
-
"class": "
|
|
258
|
+
"class": ns2.e("icon-close"),
|
|
102
259
|
"onClick": (e) => emit("click", e)
|
|
103
260
|
}, [createVNode(Icon, {
|
|
104
261
|
"name": "close",
|
|
@@ -106,6 +263,106 @@ var Close = defineComponent({
|
|
|
106
263
|
}, null)]);
|
|
107
264
|
}
|
|
108
265
|
});
|
|
266
|
+
const ns = useNamespace("notification");
|
|
267
|
+
function SuccessIcon() {
|
|
268
|
+
return createVNode("svg", {
|
|
269
|
+
"width": "16px",
|
|
270
|
+
"height": "16px",
|
|
271
|
+
"viewBox": "0 0 16 16",
|
|
272
|
+
"version": "1.1",
|
|
273
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
274
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
275
|
+
}, [createVNode("defs", null, [createVNode("polygon", {
|
|
276
|
+
"id": "path-s",
|
|
277
|
+
"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"
|
|
278
|
+
}, null)]), createVNode("g", {
|
|
279
|
+
"id": "correct",
|
|
280
|
+
"stroke": "none",
|
|
281
|
+
"stroke-width": "1",
|
|
282
|
+
"fill": "none",
|
|
283
|
+
"fill-rule": "evenodd"
|
|
284
|
+
}, [createVNode("mask", {
|
|
285
|
+
"id": "mask-2",
|
|
286
|
+
"fill": "white"
|
|
287
|
+
}, [createVNode("use", {
|
|
288
|
+
"xlink:href": "#path-s"
|
|
289
|
+
}, null)]), createVNode("use", {
|
|
290
|
+
"id": "Mask",
|
|
291
|
+
"class": ns.e("image-success-path"),
|
|
292
|
+
"xlink:href": "#path-s"
|
|
293
|
+
}, null)])]);
|
|
294
|
+
}
|
|
295
|
+
function WarningIcon() {
|
|
296
|
+
return createVNode("svg", {
|
|
297
|
+
"width": "16px",
|
|
298
|
+
"height": "16px",
|
|
299
|
+
"viewBox": "0 0 16 16",
|
|
300
|
+
"version": "1.1",
|
|
301
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
302
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
303
|
+
}, [createVNode("g", {
|
|
304
|
+
"stroke": "none",
|
|
305
|
+
"stroke-width": "1",
|
|
306
|
+
"fill": "none",
|
|
307
|
+
"fill-rule": "evenodd"
|
|
308
|
+
}, [createVNode("path", {
|
|
309
|
+
"class": ns.e("warning-outer"),
|
|
310
|
+
"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"
|
|
311
|
+
}, null), createVNode("path", {
|
|
312
|
+
"class": ns.e("warning-inner"),
|
|
313
|
+
"stroke-width": "0.3",
|
|
314
|
+
"fill-rule": "nonzero",
|
|
315
|
+
"d": "M8.87894737,13 L7.08947368,13 L7.08947368,11.2105263 L8.87894737,11.2105263 L8.87894737,13 Z M8.62102372,9.86842105 L7.32800539,9.86842105 L7,4.5 L8.96842105,4.5 L8.62102372,9.86842105 Z"
|
|
316
|
+
}, null)])]);
|
|
317
|
+
}
|
|
318
|
+
function InfoIcon() {
|
|
319
|
+
return createVNode("svg", {
|
|
320
|
+
"width": "16px",
|
|
321
|
+
"height": "16px",
|
|
322
|
+
"viewBox": "0 0 16 16",
|
|
323
|
+
"version": "1.1",
|
|
324
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
325
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
326
|
+
}, [createVNode("g", {
|
|
327
|
+
"id": "info",
|
|
328
|
+
"stroke": "none",
|
|
329
|
+
"stroke-width": "1",
|
|
330
|
+
"fill": "none",
|
|
331
|
+
"fill-rule": "evenodd"
|
|
332
|
+
}, [createVNode("path", {
|
|
333
|
+
"class": ns.e("image-info-path"),
|
|
334
|
+
"d": "M7,13 L7,6 L9,6 L9,13 L7,13 Z M7,5 L7,3 L9,3 L9,5 L7,5 Z",
|
|
335
|
+
"id": "info"
|
|
336
|
+
}, null)])]);
|
|
337
|
+
}
|
|
338
|
+
function ErrorIcon() {
|
|
339
|
+
return createVNode("svg", {
|
|
340
|
+
"width": "16px",
|
|
341
|
+
"height": "16px",
|
|
342
|
+
"viewBox": "0 0 16 16",
|
|
343
|
+
"version": "1.1",
|
|
344
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
345
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
346
|
+
}, [createVNode("defs", null, [createVNode("polygon", {
|
|
347
|
+
"id": "path-e",
|
|
348
|
+
"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"
|
|
349
|
+
}, null)]), createVNode("g", {
|
|
350
|
+
"id": "error",
|
|
351
|
+
"stroke": "none",
|
|
352
|
+
"stroke-width": "1",
|
|
353
|
+
"fill": "none",
|
|
354
|
+
"fill-rule": "evenodd"
|
|
355
|
+
}, [createVNode("mask", {
|
|
356
|
+
"id": "mask-2",
|
|
357
|
+
"fill": "white"
|
|
358
|
+
}, [createVNode("use", {
|
|
359
|
+
"xlink:href": "#path-e"
|
|
360
|
+
}, null)]), createVNode("use", {
|
|
361
|
+
"id": "Mask",
|
|
362
|
+
"class": ns.e("image-error-path"),
|
|
363
|
+
"xlink:href": "#path-e"
|
|
364
|
+
}, null)])]);
|
|
365
|
+
}
|
|
109
366
|
var TypeIcon = defineComponent({
|
|
110
367
|
props: {
|
|
111
368
|
type: {
|
|
@@ -117,22 +374,14 @@ var TypeIcon = defineComponent({
|
|
|
117
374
|
const {
|
|
118
375
|
type
|
|
119
376
|
} = toRefs(props);
|
|
377
|
+
const ns2 = useNamespace("notification");
|
|
120
378
|
const classes = computed(() => ({
|
|
121
|
-
"
|
|
122
|
-
[
|
|
379
|
+
[ns2.e("image")]: true,
|
|
380
|
+
[ns2.em("image", type.value)]: true
|
|
123
381
|
}));
|
|
124
|
-
const severityIconMap = {
|
|
125
|
-
info: "info-o",
|
|
126
|
-
success: "right-o",
|
|
127
|
-
warning: "warning-o",
|
|
128
|
-
error: "error-o"
|
|
129
|
-
};
|
|
130
382
|
return () => createVNode("span", {
|
|
131
383
|
"class": classes.value
|
|
132
|
-
}, [type.value !== "normal" && createVNode(
|
|
133
|
-
"name": severityIconMap[type.value],
|
|
134
|
-
"size": "16px"
|
|
135
|
-
}, null)]);
|
|
384
|
+
}, [type.value && type.value !== "normal" && (type.value === "success" && createVNode(SuccessIcon, null, null) || type.value === "info" && createVNode(InfoIcon, null, null) || type.value === "warning" && createVNode(WarningIcon, null, null) || type.value === "error" && createVNode(ErrorIcon, null, null))]);
|
|
136
385
|
}
|
|
137
386
|
});
|
|
138
387
|
function useNotification(props) {
|
|
@@ -200,6 +449,7 @@ var Notification = defineComponent({
|
|
|
200
449
|
close: close2,
|
|
201
450
|
handleDestroy
|
|
202
451
|
} = useEvent(props, emit);
|
|
452
|
+
const ns2 = useNamespace("notification");
|
|
203
453
|
return () => createVNode(Transition, {
|
|
204
454
|
"name": "notification-fade",
|
|
205
455
|
"onAfterLeave": handleDestroy
|
|
@@ -207,23 +457,23 @@ var Notification = defineComponent({
|
|
|
207
457
|
default: () => {
|
|
208
458
|
var _a;
|
|
209
459
|
return [modelValue.value && createVNode("div", {
|
|
210
|
-
"class":
|
|
460
|
+
"class": ns2.b()
|
|
211
461
|
}, [createVNode("div", {
|
|
212
462
|
"class": classes.value,
|
|
213
463
|
"onMouseenter": interrupt,
|
|
214
464
|
"onMouseleave": removeReset
|
|
215
465
|
}, [createVNode("div", {
|
|
216
|
-
"class": "
|
|
466
|
+
"class": ns2.e("item")
|
|
217
467
|
}, [createVNode(Close, {
|
|
218
468
|
"onClick": close2
|
|
219
469
|
}, null), title.value && createVNode(TypeIcon, {
|
|
220
470
|
"type": type.value
|
|
221
471
|
}, null), createVNode("div", {
|
|
222
|
-
"class": "
|
|
472
|
+
"class": ns2.e("message")
|
|
223
473
|
}, [createVNode("span", {
|
|
224
|
-
"class": "
|
|
474
|
+
"class": ns2.e("title")
|
|
225
475
|
}, [title.value]), createVNode("span", {
|
|
226
|
-
"class": "
|
|
476
|
+
"class": ns2.e("content")
|
|
227
477
|
}, [(_a = slots.default) == null ? void 0 : _a.call(slots)])])])])])];
|
|
228
478
|
}
|
|
229
479
|
});
|
|
@@ -367,17 +617,29 @@ const uploadProps = {
|
|
|
367
617
|
type: Function,
|
|
368
618
|
default: void 0
|
|
369
619
|
},
|
|
370
|
-
|
|
620
|
+
onError: {
|
|
371
621
|
type: Function,
|
|
372
622
|
default: void 0
|
|
373
623
|
},
|
|
374
|
-
|
|
624
|
+
onSuccess: {
|
|
625
|
+
type: Function,
|
|
626
|
+
default: void 0
|
|
627
|
+
},
|
|
628
|
+
onExceed: {
|
|
375
629
|
type: Function,
|
|
376
630
|
default: void 0
|
|
377
631
|
},
|
|
378
632
|
oneTimeUpload: {
|
|
379
633
|
type: Boolean,
|
|
380
634
|
default: false
|
|
635
|
+
},
|
|
636
|
+
limit: {
|
|
637
|
+
type: Number,
|
|
638
|
+
default: 0
|
|
639
|
+
},
|
|
640
|
+
httpRequest: {
|
|
641
|
+
type: Function,
|
|
642
|
+
default: void 0
|
|
381
643
|
}
|
|
382
644
|
};
|
|
383
645
|
const getAllFilesBeyondMaximalFileSizeMsg = (maximalSize) => `\u6700\u5927\u652F\u6301\u4E0A\u4F20${maximalSize}MB\u7684\u6587\u4EF6, \u60A8\u672C\u6B21\u4E0A\u4F20\u7684\u6240\u6709\u6587\u4EF6\u8D85\u8FC7\u53EF\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F`;
|
|
@@ -457,7 +719,7 @@ const useSelectFiles = () => {
|
|
|
457
719
|
if (uploadOptions && beyondMaximalSize(file.size, uploadOptions.maximumSize)) {
|
|
458
720
|
return {
|
|
459
721
|
checkError: true,
|
|
460
|
-
errorMsg: getBeyondMaximalFileSizeMsg(file.name, uploadOptions.maximumSize)
|
|
722
|
+
errorMsg: getBeyondMaximalFileSizeMsg(file.name, uploadOptions.maximumSize || 0)
|
|
461
723
|
};
|
|
462
724
|
}
|
|
463
725
|
return { checkError: false, errorMsg: void 0 };
|
|
@@ -496,11 +758,11 @@ class FileUploader {
|
|
|
496
758
|
}
|
|
497
759
|
send(uploadFiles) {
|
|
498
760
|
return new Promise((resolve, reject) => {
|
|
499
|
-
const { uri, method, headers, authToken, authTokenHeader, additionalParameter, fileFieldName, withCredentials, responseType } = this.uploadOptions;
|
|
761
|
+
const { uri, method, headers, authToken, authTokenHeader, additionalParameter, fileFieldName, withCredentials, responseType } = this.uploadOptions || {};
|
|
500
762
|
const authTokenHeader_ = authTokenHeader || "Authorization";
|
|
501
763
|
const fileFieldName_ = fileFieldName || "file";
|
|
502
764
|
this.xhr = new XMLHttpRequest();
|
|
503
|
-
this.xhr.open(method || "POST", uri);
|
|
765
|
+
this.xhr.open(method || "POST", uri || "");
|
|
504
766
|
if (withCredentials) {
|
|
505
767
|
this.xhr.withCredentials = withCredentials;
|
|
506
768
|
}
|
|
@@ -512,7 +774,8 @@ class FileUploader {
|
|
|
512
774
|
}
|
|
513
775
|
if (headers) {
|
|
514
776
|
Object.keys(headers).forEach((key) => {
|
|
515
|
-
|
|
777
|
+
var _a;
|
|
778
|
+
(_a = this.xhr) == null ? void 0 : _a.setRequestHeader(key, headers[key]);
|
|
516
779
|
});
|
|
517
780
|
}
|
|
518
781
|
this.xhr.upload.onprogress = (e) => {
|
|
@@ -526,19 +789,21 @@ class FileUploader {
|
|
|
526
789
|
this.xhr = null;
|
|
527
790
|
};
|
|
528
791
|
this.xhr.onerror = () => {
|
|
529
|
-
|
|
792
|
+
var _a, _b;
|
|
793
|
+
this.response = (_a = this.xhr) == null ? void 0 : _a.response;
|
|
530
794
|
this.status = UploadStatus.failed;
|
|
531
|
-
reject({ file: this.file, response: this.xhr.response });
|
|
795
|
+
reject({ file: this.file, response: (_b = this.xhr) == null ? void 0 : _b.response });
|
|
532
796
|
};
|
|
533
797
|
this.xhr.onload = () => {
|
|
534
|
-
|
|
798
|
+
var _a, _b, _c;
|
|
799
|
+
if (((_a = this.xhr) == null ? void 0 : _a.readyState) === 4 && this.xhr.status >= 200 && this.xhr.status < 300) {
|
|
535
800
|
this.response = this.xhr.response;
|
|
536
801
|
this.status = UploadStatus.uploaded;
|
|
537
802
|
resolve({ file: this.file, response: this.xhr.response });
|
|
538
803
|
} else {
|
|
539
|
-
this.response = this.xhr.response;
|
|
804
|
+
this.response = (_b = this.xhr) == null ? void 0 : _b.response;
|
|
540
805
|
this.status = UploadStatus.failed;
|
|
541
|
-
reject({ file: this.file, response: this.xhr.response });
|
|
806
|
+
reject({ file: this.file, response: (_c = this.xhr) == null ? void 0 : _c.response });
|
|
542
807
|
}
|
|
543
808
|
};
|
|
544
809
|
});
|
|
@@ -645,7 +910,7 @@ const useUpload = () => {
|
|
|
645
910
|
};
|
|
646
911
|
const deleteFile = (file) => {
|
|
647
912
|
const deleteUploadFile = fileUploaders.value.find((fileUploader) => fileUploader.file === file);
|
|
648
|
-
deleteUploadFile.cancel();
|
|
913
|
+
deleteUploadFile == null ? void 0 : deleteUploadFile.cancel();
|
|
649
914
|
fileUploaders.value = fileUploaders.value.filter((fileUploader) => {
|
|
650
915
|
return file !== fileUploader.file;
|
|
651
916
|
});
|
|
@@ -690,8 +955,14 @@ var Upload = defineComponent({
|
|
|
690
955
|
modelValue,
|
|
691
956
|
multiple,
|
|
692
957
|
accept,
|
|
693
|
-
webkitdirectory
|
|
958
|
+
webkitdirectory,
|
|
959
|
+
limit,
|
|
960
|
+
httpRequest
|
|
694
961
|
} = toRefs(props);
|
|
962
|
+
const ns2 = useNamespace("upload");
|
|
963
|
+
const inputGroupNs = useNamespace("input-group");
|
|
964
|
+
const formControlNs = useNamespace("form-control");
|
|
965
|
+
const inputGroupAddOnNs = useNamespace("input-group-addon");
|
|
695
966
|
const {
|
|
696
967
|
triggerSelectFiles,
|
|
697
968
|
_validateFiles,
|
|
@@ -709,8 +980,7 @@ var Upload = defineComponent({
|
|
|
709
980
|
_oneTimeUpload,
|
|
710
981
|
getSameNameFiles
|
|
711
982
|
} = useUpload();
|
|
712
|
-
const
|
|
713
|
-
ref("");
|
|
983
|
+
const isDropOver = ref(false);
|
|
714
984
|
const alertMsg = (errorMsg) => {
|
|
715
985
|
NotificationService.open({
|
|
716
986
|
type: "warning",
|
|
@@ -718,10 +988,11 @@ var Upload = defineComponent({
|
|
|
718
988
|
});
|
|
719
989
|
};
|
|
720
990
|
const checkValid = () => {
|
|
991
|
+
var _a;
|
|
721
992
|
let totalFileSize = 0;
|
|
722
993
|
fileUploaders.value.forEach((fileUploader) => {
|
|
723
994
|
totalFileSize += fileUploader.file.size;
|
|
724
|
-
const checkResult = _validateFiles(fileUploader.file, accept.value, fileUploader.uploadOptions);
|
|
995
|
+
const checkResult = _validateFiles(fileUploader.file, (accept == null ? void 0 : accept.value) || "", fileUploader.uploadOptions);
|
|
725
996
|
if (checkResult && checkResult.checkError) {
|
|
726
997
|
deleteFile(fileUploader.file);
|
|
727
998
|
alertMsg(checkResult.errorMsg);
|
|
@@ -729,53 +1000,15 @@ var Upload = defineComponent({
|
|
|
729
1000
|
}
|
|
730
1001
|
});
|
|
731
1002
|
if (oneTimeUpload.value) {
|
|
732
|
-
const checkResult = checkAllFilesSize(totalFileSize, uploadOptions.value.maximumSize);
|
|
1003
|
+
const checkResult = checkAllFilesSize(totalFileSize, ((_a = uploadOptions == null ? void 0 : uploadOptions.value) == null ? void 0 : _a.maximumSize) || 0);
|
|
733
1004
|
if (checkResult && checkResult.checkError) {
|
|
734
1005
|
removeFiles();
|
|
735
1006
|
alertMsg(checkResult.errorMsg);
|
|
736
1007
|
}
|
|
737
1008
|
}
|
|
738
1009
|
};
|
|
739
|
-
const _dealFiles = (promise) => {
|
|
740
|
-
resetSameNameFiles();
|
|
741
|
-
promise.then((files) => {
|
|
742
|
-
files.forEach((file) => {
|
|
743
|
-
if (!multiple.value) {
|
|
744
|
-
removeFiles();
|
|
745
|
-
}
|
|
746
|
-
addFile(file, uploadOptions.value);
|
|
747
|
-
});
|
|
748
|
-
checkValid();
|
|
749
|
-
const sameNameFiles = getSameNameFiles();
|
|
750
|
-
if (uploadOptions.value && uploadOptions.value.checkSameName && sameNameFiles.length) {
|
|
751
|
-
alertMsg(getExistSameNameFilesMsg(sameNameFiles));
|
|
752
|
-
}
|
|
753
|
-
const selectedFiles = fileUploaders.value.filter((fileUploader) => fileUploader.status === UploadStatus.preLoad).map((fileUploader) => fileUploader.file);
|
|
754
|
-
ctx.emit("fileSelect", selectedFiles);
|
|
755
|
-
if (autoUpload.value) {
|
|
756
|
-
fileUpload();
|
|
757
|
-
}
|
|
758
|
-
}).catch((error) => {
|
|
759
|
-
alertMsg(error.message);
|
|
760
|
-
});
|
|
761
|
-
};
|
|
762
|
-
const handleClick = () => {
|
|
763
|
-
if (disabled.value) {
|
|
764
|
-
return;
|
|
765
|
-
}
|
|
766
|
-
_dealFiles(triggerSelectFiles({
|
|
767
|
-
accept: accept.value,
|
|
768
|
-
multiple: multiple.value,
|
|
769
|
-
webkitdirectory: webkitdirectory.value
|
|
770
|
-
}));
|
|
771
|
-
};
|
|
772
|
-
const onFileDrop = (files) => {
|
|
773
|
-
isDropOVer.value = false;
|
|
774
|
-
_dealFiles(triggerDropFiles(files));
|
|
775
|
-
ctx.emit("fileDrop", files);
|
|
776
|
-
};
|
|
777
1010
|
const onFileOver = (event) => {
|
|
778
|
-
|
|
1011
|
+
isDropOver.value = event;
|
|
779
1012
|
ctx.emit("fileOver", event);
|
|
780
1013
|
};
|
|
781
1014
|
const deleteUploadedFile = (file) => {
|
|
@@ -786,7 +1019,7 @@ var Upload = defineComponent({
|
|
|
786
1019
|
ctx.emit("update:modelValue", newUploadedFiles);
|
|
787
1020
|
};
|
|
788
1021
|
const onDeleteFile = (event, file, status) => {
|
|
789
|
-
event.stopPropagation();
|
|
1022
|
+
event == null ? void 0 : event.stopPropagation();
|
|
790
1023
|
if (status === UploadStatus.uploaded) {
|
|
791
1024
|
deleteUploadedFile(file);
|
|
792
1025
|
}
|
|
@@ -794,13 +1027,13 @@ var Upload = defineComponent({
|
|
|
794
1027
|
};
|
|
795
1028
|
const canUpload = () => {
|
|
796
1029
|
let uploadResult = Promise.resolve(true);
|
|
797
|
-
if (beforeUpload.value) {
|
|
798
|
-
const result = beforeUpload.value(getFullFiles());
|
|
1030
|
+
if (beforeUpload == null ? void 0 : beforeUpload.value) {
|
|
1031
|
+
const result = beforeUpload == null ? void 0 : beforeUpload.value(getFullFiles());
|
|
799
1032
|
if (typeof result !== "undefined") {
|
|
800
|
-
if (result
|
|
801
|
-
uploadResult = result;
|
|
802
|
-
} else {
|
|
1033
|
+
if (typeof result === "boolean") {
|
|
803
1034
|
uploadResult = Promise.resolve(result);
|
|
1035
|
+
} else {
|
|
1036
|
+
uploadResult = result;
|
|
804
1037
|
}
|
|
805
1038
|
}
|
|
806
1039
|
}
|
|
@@ -815,44 +1048,106 @@ var Upload = defineComponent({
|
|
|
815
1048
|
removeFiles();
|
|
816
1049
|
return;
|
|
817
1050
|
}
|
|
1051
|
+
if (typeof (httpRequest == null ? void 0 : httpRequest.value) === "function") {
|
|
1052
|
+
const files = fileUploaders.value.map((tempFileUploader) => tempFileUploader.file);
|
|
1053
|
+
httpRequest.value(files);
|
|
1054
|
+
return;
|
|
1055
|
+
}
|
|
818
1056
|
const uploadObservable = oneTimeUpload.value ? _oneTimeUpload() : upload2(fileUploader);
|
|
819
|
-
uploadObservable.then((results) => {
|
|
820
|
-
props
|
|
1057
|
+
uploadObservable == null ? void 0 : uploadObservable.then((results) => {
|
|
1058
|
+
props.onSuccess && props.onSuccess(results);
|
|
821
1059
|
const newFiles = results.map((result) => result.file);
|
|
822
1060
|
const newUploadedFiles = [...newFiles, ...modelValue.value];
|
|
823
1061
|
ctx.emit("update:modelValue", newUploadedFiles);
|
|
1062
|
+
props.onChange && props.onChange(newFiles, newUploadedFiles);
|
|
824
1063
|
}).catch((error) => {
|
|
825
|
-
props
|
|
1064
|
+
props.onError && props.onError(error);
|
|
1065
|
+
props.onChange && props.onChange([error.file], modelValue.value);
|
|
826
1066
|
});
|
|
827
1067
|
});
|
|
828
1068
|
};
|
|
1069
|
+
const _dealFiles = (promise) => {
|
|
1070
|
+
resetSameNameFiles();
|
|
1071
|
+
promise.then((files) => {
|
|
1072
|
+
if (limit.value && modelValue.value.length + files.length > limit.value) {
|
|
1073
|
+
props.onExceed && props.onExceed(files, modelValue.value);
|
|
1074
|
+
return;
|
|
1075
|
+
}
|
|
1076
|
+
props.onChange && props.onChange(files, modelValue.value);
|
|
1077
|
+
files.forEach((file) => {
|
|
1078
|
+
if (!multiple.value) {
|
|
1079
|
+
removeFiles();
|
|
1080
|
+
}
|
|
1081
|
+
addFile(file, uploadOptions == null ? void 0 : uploadOptions.value);
|
|
1082
|
+
});
|
|
1083
|
+
checkValid();
|
|
1084
|
+
const sameNameFiles = getSameNameFiles();
|
|
1085
|
+
if ((uploadOptions == null ? void 0 : uploadOptions.value) && uploadOptions.value.checkSameName && sameNameFiles.length) {
|
|
1086
|
+
alertMsg(getExistSameNameFilesMsg(sameNameFiles));
|
|
1087
|
+
}
|
|
1088
|
+
const selectedFiles = fileUploaders.value.filter((fileUploader) => fileUploader.status === UploadStatus.preLoad).map((fileUploader) => fileUploader.file);
|
|
1089
|
+
ctx.emit("fileSelect", selectedFiles);
|
|
1090
|
+
if (autoUpload.value) {
|
|
1091
|
+
fileUpload();
|
|
1092
|
+
}
|
|
1093
|
+
}).catch((error) => {
|
|
1094
|
+
alertMsg(error.message);
|
|
1095
|
+
});
|
|
1096
|
+
};
|
|
1097
|
+
const handleClick = () => {
|
|
1098
|
+
if (disabled.value) {
|
|
1099
|
+
return;
|
|
1100
|
+
}
|
|
1101
|
+
_dealFiles(triggerSelectFiles({
|
|
1102
|
+
accept: accept == null ? void 0 : accept.value,
|
|
1103
|
+
multiple: multiple.value,
|
|
1104
|
+
webkitdirectory: webkitdirectory.value
|
|
1105
|
+
}));
|
|
1106
|
+
};
|
|
1107
|
+
const onFileDrop = (files) => {
|
|
1108
|
+
isDropOver.value = false;
|
|
1109
|
+
_dealFiles(triggerDropFiles(files));
|
|
1110
|
+
ctx.emit("fileDrop", files);
|
|
1111
|
+
};
|
|
1112
|
+
const submit = (event, fileUploader) => {
|
|
1113
|
+
fileUpload(event, fileUploader);
|
|
1114
|
+
};
|
|
1115
|
+
const clearFiles = (event) => {
|
|
1116
|
+
fileUploaders.value.forEach((fileUploader) => {
|
|
1117
|
+
onDeleteFile(event, fileUploader.file, fileUploader.status);
|
|
1118
|
+
});
|
|
1119
|
+
};
|
|
1120
|
+
ctx.expose({
|
|
1121
|
+
submit,
|
|
1122
|
+
clearFiles
|
|
1123
|
+
});
|
|
829
1124
|
return () => {
|
|
830
1125
|
var _a, _b, _c, _d;
|
|
831
1126
|
return createVNode("div", null, [withDirectives(createVNode("div", {
|
|
832
|
-
"class":
|
|
833
|
-
"style": `border: ${
|
|
1127
|
+
"class": ns2.b(),
|
|
1128
|
+
"style": `border: ${isDropOver.value ? "1px solid #15bf15" : "0"}`
|
|
834
1129
|
}, [((_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)) ? createVNode("div", {
|
|
835
1130
|
"onClick": handleClick
|
|
836
1131
|
}, [ctx.slots.default()]) : createVNode("div", {
|
|
837
|
-
"class":
|
|
1132
|
+
"class": [inputGroupNs.b(), disabled.value ? "disabled" : ""],
|
|
838
1133
|
"onClick": handleClick
|
|
839
1134
|
}, [fileUploaders.value.length === 0 && createVNode("div", {
|
|
840
|
-
"class": "
|
|
1135
|
+
"class": [formControlNs.b(), ns2.e("placeholder")]
|
|
841
1136
|
}, [placeholder.value]), fileUploaders.value.length > 0 && createVNode("ul", {
|
|
842
|
-
"class": "
|
|
1137
|
+
"class": [formControlNs.b(), ns2.e("files-list")]
|
|
843
1138
|
}, [fileUploaders.value.map((fileUploader, index2) => createVNode("li", {
|
|
844
1139
|
"key": index2,
|
|
845
|
-
"class": "
|
|
1140
|
+
"class": [ns2.e("file-item"), ns2.e("file-tag")],
|
|
846
1141
|
"style": "display: inline-block; margin: 0 2px 2px 0",
|
|
847
1142
|
"title": fileUploader.file.name
|
|
848
1143
|
}, [createVNode("span", {
|
|
849
|
-
"class":
|
|
1144
|
+
"class": [ns2.e("filename"), fileUploader.status === UploadStatus.failed ? ns2.m("failed-color") : ""]
|
|
850
1145
|
}, [fileUploader.file.name]), createVNode(resolveComponent("d-icon"), {
|
|
851
1146
|
"name": "close",
|
|
852
|
-
"class":
|
|
1147
|
+
"class": [(fileUploader == null ? void 0 : fileUploader.status) === UploadStatus.failed ? ns2.e("delete-file-button") : "", (fileUploader == null ? void 0 : fileUploader.status) === UploadStatus.uploading || (fileUploader == null ? void 0 : fileUploader.status) === UploadStatus.uploaded ? ns2.e("delete") : ""],
|
|
853
1148
|
"onClick": (event) => onDeleteFile(event, fileUploader.file, fileUploader.status)
|
|
854
1149
|
}, null), fileUploader.status === UploadStatus.uploading && createVNode("div", {
|
|
855
|
-
"class": "icon
|
|
1150
|
+
"class": ["icon", ns2.e("progress")]
|
|
856
1151
|
}, [createVNode(resolveComponent("d-progress"), {
|
|
857
1152
|
"isCircle": true,
|
|
858
1153
|
"percentage": fileUploader.percentage,
|
|
@@ -866,7 +1161,7 @@ var Upload = defineComponent({
|
|
|
866
1161
|
"name": "right",
|
|
867
1162
|
"color": "#50d4ab"
|
|
868
1163
|
}, null)]))]), createVNode("span", {
|
|
869
|
-
"class":
|
|
1164
|
+
"class": inputGroupAddOnNs.b()
|
|
870
1165
|
}, [createVNode(resolveComponent("d-icon"), {
|
|
871
1166
|
"name": "more-operate",
|
|
872
1167
|
"color": "#252b3a"
|