ep-craft 0.1.32 → 0.1.34
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/dist/components/button/index.d.ts +12 -0
- package/dist/components/button-group/index.d.ts +3 -2
- package/dist/components/button-group/index.js +7 -3
- package/dist/components/button-group/src/button-group.d.ts +48 -0
- package/dist/components/button-group/src/button-group.js +7 -0
- package/dist/components/button-group/src/button-group.vue.d.ts +16 -0
- package/dist/components/button-group/src/button-group.vue.js +42 -0
- package/dist/components/button-group/src/button-group2.vue.js +4 -0
- package/dist/components/checkbox/index.js +6 -5
- package/dist/components/collection/index.d.ts +8 -0
- package/dist/components/collection/src/collection-item.vue.d.ts +2 -0
- package/dist/components/collection/src/collection-item.vue.js +10 -0
- package/dist/components/collection/src/collection-item2.vue.js +8 -0
- package/dist/components/collection/src/collection.d.ts +39 -0
- package/dist/components/collection/src/collection.js +52 -0
- package/dist/components/collection/src/collection.vue.d.ts +2 -0
- package/dist/components/collection/src/collection.vue.js +10 -0
- package/dist/components/collection/src/collection2.vue.js +7 -0
- package/dist/components/collection/src/tokens.d.ts +18 -0
- package/dist/components/divider/index.d.ts +24 -2
- package/dist/components/divider/index.js +8 -3
- package/dist/components/divider/src/divider.d.ts +30 -0
- package/dist/components/divider/src/divider.js +34 -0
- package/dist/components/divider/src/divider.vue.d.ts +24 -0
- package/dist/components/divider/src/divider.vue.js +39 -0
- package/dist/components/divider/src/divider2.vue.js +4 -0
- package/dist/components/dropdown/index.d.ts +3017 -3
- package/dist/components/dropdown/index.js +23 -3
- package/dist/components/dropdown/src/dropdown-item-impl.vue.d.ts +79 -0
- package/dist/components/dropdown/src/dropdown-item-impl.vue.js +40 -0
- package/dist/components/dropdown/src/dropdown-item-impl2.vue.js +68 -0
- package/dist/components/dropdown/src/dropdown-item.vue.d.ts +169 -0
- package/dist/components/dropdown/src/dropdown-item.vue.js +35 -0
- package/dist/components/dropdown/src/dropdown-item2.vue.js +63 -0
- package/dist/components/dropdown/src/dropdown-menu.vue.d.ts +27 -0
- package/dist/components/dropdown/src/dropdown-menu.vue.js +24 -0
- package/dist/components/dropdown/src/dropdown-menu2.vue.js +75 -0
- package/dist/components/dropdown/src/dropdown.d.ts +200 -0
- package/dist/components/dropdown/src/dropdown.js +201 -0
- package/dist/components/dropdown/src/dropdown.vue.d.ts +1126 -0
- package/dist/components/dropdown/src/dropdown.vue.js +127 -0
- package/dist/components/dropdown/src/dropdown2.vue.js +127 -0
- package/dist/components/dropdown/src/instance.d.ts +2 -0
- package/dist/components/dropdown/src/tokens.d.ts +13 -0
- package/dist/components/dropdown/src/tokens.js +5 -0
- package/dist/components/dropdown/src/useDropdown.d.ts +5 -0
- package/dist/components/dropdown/src/useDropdown.js +15 -0
- package/dist/components/dropdown-item/index.d.ts +1 -4
- package/dist/components/dropdown-menu/index.d.ts +1 -4
- package/dist/components/index.js +129 -131
- package/dist/components/popover/index.d.ts +121 -3
- package/dist/components/popover/index.js +19 -4
- package/dist/components/popover/src/directive.d.ts +4 -0
- package/dist/components/popover/src/directive.js +15 -0
- package/dist/components/popover/src/popover.d.ts +291 -0
- package/dist/components/popover/src/popover.js +168 -0
- package/dist/components/popover/src/popover.vue.d.ts +53 -0
- package/dist/components/popover/src/popover.vue.js +125 -0
- package/dist/components/popover/src/popover2.vue.js +4 -0
- package/dist/components/progress/index.d.ts +35 -2
- package/dist/components/progress/index.js +10 -4
- package/dist/components/progress/src/progress.d.ts +97 -0
- package/dist/components/progress/src/progress.js +104 -0
- package/dist/components/progress/src/progress.vue.d.ts +30 -0
- package/dist/components/progress/src/progress.vue.js +179 -0
- package/dist/components/progress/src/progress2.vue.js +4 -0
- package/dist/components/roving-focus-group/index.d.ts +14 -0
- package/dist/components/roving-focus-group/index.js +15 -0
- package/dist/components/roving-focus-group/src/roving-focus-group-impl.vue.d.ts +50 -0
- package/dist/components/roving-focus-group/src/roving-focus-group-impl.vue.js +10 -0
- package/dist/components/roving-focus-group/src/roving-focus-group-impl2.vue.js +115 -0
- package/dist/components/roving-focus-group/src/roving-focus-group.d.ts +56 -0
- package/dist/components/roving-focus-group/src/roving-focus-group.js +43 -0
- package/dist/components/roving-focus-group/src/roving-focus-group.vue.d.ts +67 -0
- package/dist/components/roving-focus-group/src/roving-focus-group.vue.js +13 -0
- package/dist/components/roving-focus-group/src/roving-focus-group2.vue.js +21 -0
- package/dist/components/roving-focus-group/src/roving-focus-item.vue.d.ts +43 -0
- package/dist/components/roving-focus-group/src/roving-focus-item.vue.js +20 -0
- package/dist/components/roving-focus-group/src/roving-focus-item2.vue.js +78 -0
- package/dist/components/roving-focus-group/src/tokens.d.ts +28 -0
- package/dist/components/roving-focus-group/src/tokens.js +5 -0
- package/dist/components/roving-focus-group/src/utils.d.ts +8 -0
- package/dist/components/roving-focus-group/src/utils.js +28 -0
- package/dist/components/table/index.d.ts +56 -3
- package/dist/components/table/index.js +20 -4
- package/dist/components/table/src/composables/use-scrollbar.d.ts +6 -0
- package/dist/components/table/src/composables/use-scrollbar.js +24 -0
- package/dist/components/table/src/config.d.ts +87 -0
- package/dist/components/table/src/config.js +210 -0
- package/dist/components/table/src/filter-panel.vue.d.ts +837 -0
- package/dist/components/table/src/filter-panel.vue.js +130 -0
- package/dist/components/table/src/filter-panel2.vue.js +155 -0
- package/dist/components/table/src/h-helper.d.ts +13 -0
- package/dist/components/table/src/h-helper.js +30 -0
- package/dist/components/table/src/layout-observer.d.ts +8 -0
- package/dist/components/table/src/layout-observer.js +49 -0
- package/dist/components/table/src/store/current.d.ts +15 -0
- package/dist/components/table/src/store/current.js +45 -0
- package/dist/components/table/src/store/expand.d.ts +14 -0
- package/dist/components/table/src/store/expand.js +55 -0
- package/dist/components/table/src/store/helper.d.ts +548 -0
- package/dist/components/table/src/store/helper.js +61 -0
- package/dist/components/table/src/store/index.d.ts +1107 -0
- package/dist/components/table/src/store/index.js +123 -0
- package/dist/components/table/src/store/tree.d.ts +27 -0
- package/dist/components/table/src/store/tree.js +153 -0
- package/dist/components/table/src/store/watcher.d.ts +88 -0
- package/dist/components/table/src/store/watcher.js +483 -0
- package/dist/components/table/src/table/defaults.d.ts +560 -0
- package/dist/components/table/src/table/defaults.js +236 -0
- package/dist/components/table/src/table/key-render-helper.d.ts +2 -0
- package/dist/components/table/src/table/key-render-helper.js +18 -0
- package/dist/components/table/src/table/style-helper.d.ts +51 -0
- package/dist/components/table/src/table/style-helper.js +169 -0
- package/dist/components/table/src/table/utils-helper.d.ts +16 -0
- package/dist/components/table/src/table/utils-helper.js +36 -0
- package/dist/components/table/src/table-body/defaults.d.ts +39 -0
- package/dist/components/table/src/table-body/defaults.js +25 -0
- package/dist/components/table/src/table-body/events-helper.d.ts +19 -0
- package/dist/components/table/src/table-body/events-helper.js +126 -0
- package/dist/components/table/src/table-body/index.d.ts +84 -0
- package/dist/components/table/src/table-body/index.js +77 -0
- package/dist/components/table/src/table-body/render-helper.d.ts +18 -0
- package/dist/components/table/src/table-body/render-helper.js +188 -0
- package/dist/components/table/src/table-body/styles-helper.d.ts +15 -0
- package/dist/components/table/src/table-body/styles-helper.js +98 -0
- package/dist/components/table/src/table-body/td-wrapper.vue.d.ts +33 -0
- package/dist/components/table/src/table-body/td-wrapper.vue.js +26 -0
- package/dist/components/table/src/table-body/td-wrapper2.vue.js +4 -0
- package/dist/components/table/src/table-column/defaults.d.ts +348 -0
- package/dist/components/table/src/table-column/defaults.js +152 -0
- package/dist/components/table/src/table-column/index.d.ts +2 -0
- package/dist/components/table/src/table-column/index.vue.d.ts +32 -0
- package/dist/components/table/src/table-column/index.vue.js +161 -0
- package/dist/components/table/src/table-column/index2.vue.js +4 -0
- package/dist/components/table/src/table-column/render-helper.d.ts +17 -0
- package/dist/components/table/src/table-column/render-helper.js +116 -0
- package/dist/components/table/src/table-column/watcher-helper.d.ts +8 -0
- package/dist/components/table/src/table-column/watcher-helper.js +85 -0
- package/dist/components/table/src/table-footer/index.d.ts +79 -0
- package/dist/components/table/src/table-footer/index.js +110 -0
- package/dist/components/table/src/table-footer/mapState-helper.d.ts +9 -0
- package/dist/components/table/src/table-footer/mapState-helper.js +16 -0
- package/dist/components/table/src/table-footer/style-helper.d.ts +9 -0
- package/dist/components/table/src/table-footer/style-helper.js +42 -0
- package/dist/components/table/src/table-header/event-helper.d.ts +14 -0
- package/dist/components/table/src/table-header/event-helper.js +113 -0
- package/dist/components/table/src/table-header/index.d.ts +361 -0
- package/dist/components/table/src/table-header/index.js +255 -0
- package/dist/components/table/src/table-header/style.helper.d.ts +10 -0
- package/dist/components/table/src/table-header/style.helper.js +73 -0
- package/dist/components/table/src/table-header/utils-helper.d.ts +10 -0
- package/dist/components/table/src/table-header/utils-helper.js +45 -0
- package/dist/components/table/src/table-layout.d.ts +37 -0
- package/dist/components/table/src/table-layout.js +144 -0
- package/dist/components/table/src/table.vue.d.ts +734 -0
- package/dist/components/table/src/table.vue.js +443 -0
- package/dist/components/table/src/table2.vue.js +4 -0
- package/dist/components/table/src/tableColumn.d.ts +2 -0
- package/dist/components/table/src/tokens.d.ts +3 -0
- package/dist/components/table/src/tokens.js +4 -0
- package/dist/components/table/src/util.d.ts +55 -0
- package/dist/components/table/src/util.js +310 -0
- package/dist/components/table-column/index.d.ts +40 -3
- package/dist/components/table-column/index.js +6 -3
- package/dist/components/upload/index.d.ts +45 -2
- package/dist/components/upload/index.js +23 -4
- package/dist/components/upload/src/ajax.d.ts +9 -0
- package/dist/components/upload/src/ajax.js +58 -0
- package/dist/components/upload/src/constants.d.ts +5 -0
- package/dist/components/upload/src/constants.js +4 -0
- package/dist/components/upload/src/upload-content.d.ts +136 -0
- package/dist/components/upload/src/upload-content.js +53 -0
- package/dist/components/upload/src/upload-content.vue.d.ts +38 -0
- package/dist/components/upload/src/upload-content.vue.js +186 -0
- package/dist/components/upload/src/upload-content2.vue.js +4 -0
- package/dist/components/upload/src/upload-dragger.d.ts +22 -0
- package/dist/components/upload/src/upload-dragger.js +19 -0
- package/dist/components/upload/src/upload-dragger.vue.d.ts +19 -0
- package/dist/components/upload/src/upload-dragger.vue.js +91 -0
- package/dist/components/upload/src/upload-dragger2.vue.js +4 -0
- package/dist/components/upload/src/upload-list.d.ts +45 -0
- package/dist/components/upload/src/upload-list.js +39 -0
- package/dist/components/upload/src/upload-list.vue.d.ts +28 -0
- package/dist/components/upload/src/upload-list.vue.js +182 -0
- package/dist/components/upload/src/upload-list2.vue.js +4 -0
- package/dist/components/upload/src/upload.d.ts +361 -0
- package/dist/components/upload/src/upload.js +216 -0
- package/dist/components/upload/src/upload.vue.d.ts +64 -0
- package/dist/components/upload/src/upload.vue.js +150 -0
- package/dist/components/upload/src/upload2.vue.js +4 -0
- package/dist/components/upload/src/use-handlers.d.ts +60 -0
- package/dist/components/upload/src/use-handlers.js +111 -0
- package/dist/directives/mousewheel/index.js +28 -0
- package/dist/ep-craft.js +277 -236
- package/dist/index.d.ts +67 -0
- package/dist/utils/dom/event.js +12 -11
- package/dist/utils/objects.js +10 -9
- package/dist/utils/vue/install.js +21 -18
- package/dist/utils/vue/refs.js +8 -0
- package/dist/vendored-components.d.ts +1 -1
- package/dist/vendored-components.js +44 -4
- package/package.json +1 -1
- package/dist/components/dropdown-item/index.js +0 -6
- package/dist/components/dropdown-menu/index.js +0 -6
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { NOOP as e } from "@vue/shared";
|
|
2
|
+
import "lodash-unified";
|
|
3
|
+
import "@vueuse/core";
|
|
4
|
+
import { mutable as o } from "../../../utils/typescript.js";
|
|
5
|
+
import "@element-plus/icons-vue";
|
|
6
|
+
import { buildProps as a, definePropType as t } from "../../../utils/vue/props/runtime.js";
|
|
7
|
+
import "vue";
|
|
8
|
+
import { ajaxUpload as n } from "./ajax.js";
|
|
9
|
+
const i = ["text", "picture", "picture-card"];
|
|
10
|
+
let p = 1;
|
|
11
|
+
const g = () => Date.now() + p++, l = a({
|
|
12
|
+
/**
|
|
13
|
+
* @description request URL
|
|
14
|
+
*/
|
|
15
|
+
action: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: "#"
|
|
18
|
+
},
|
|
19
|
+
/**
|
|
20
|
+
* @description request headers
|
|
21
|
+
*/
|
|
22
|
+
headers: {
|
|
23
|
+
type: t(Object)
|
|
24
|
+
},
|
|
25
|
+
/**
|
|
26
|
+
* @description set upload request method
|
|
27
|
+
*/
|
|
28
|
+
method: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: "post"
|
|
31
|
+
},
|
|
32
|
+
/**
|
|
33
|
+
* @description additions options of request
|
|
34
|
+
*/
|
|
35
|
+
data: {
|
|
36
|
+
type: t([Object, Function, Promise]),
|
|
37
|
+
default: () => o({})
|
|
38
|
+
},
|
|
39
|
+
/**
|
|
40
|
+
* @description whether uploading multiple files is permitted
|
|
41
|
+
*/
|
|
42
|
+
multiple: Boolean,
|
|
43
|
+
/**
|
|
44
|
+
* @description key name for uploaded file
|
|
45
|
+
*/
|
|
46
|
+
name: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: "file"
|
|
49
|
+
},
|
|
50
|
+
/**
|
|
51
|
+
* @description whether to activate drag and drop mode
|
|
52
|
+
*/
|
|
53
|
+
drag: Boolean,
|
|
54
|
+
/**
|
|
55
|
+
* @description whether cookies are sent
|
|
56
|
+
*/
|
|
57
|
+
withCredentials: Boolean,
|
|
58
|
+
/**
|
|
59
|
+
* @description whether to show the uploaded file list
|
|
60
|
+
*/
|
|
61
|
+
showFileList: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
default: !0
|
|
64
|
+
},
|
|
65
|
+
/**
|
|
66
|
+
* @description accepted [file types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-accept), will not work when `thumbnail-mode === true`
|
|
67
|
+
*/
|
|
68
|
+
accept: {
|
|
69
|
+
type: String,
|
|
70
|
+
default: ""
|
|
71
|
+
},
|
|
72
|
+
/**
|
|
73
|
+
* @description default uploaded files
|
|
74
|
+
*/
|
|
75
|
+
fileList: {
|
|
76
|
+
type: t(Array),
|
|
77
|
+
default: () => o([])
|
|
78
|
+
},
|
|
79
|
+
/**
|
|
80
|
+
* @description whether to auto upload file
|
|
81
|
+
*/
|
|
82
|
+
autoUpload: {
|
|
83
|
+
type: Boolean,
|
|
84
|
+
default: !0
|
|
85
|
+
},
|
|
86
|
+
/**
|
|
87
|
+
* @description type of file list
|
|
88
|
+
*/
|
|
89
|
+
listType: {
|
|
90
|
+
type: String,
|
|
91
|
+
values: i,
|
|
92
|
+
default: "text"
|
|
93
|
+
},
|
|
94
|
+
/**
|
|
95
|
+
* @description override default xhr behavior, allowing you to implement your own upload-file's request
|
|
96
|
+
*/
|
|
97
|
+
httpRequest: {
|
|
98
|
+
type: t(Function),
|
|
99
|
+
default: n
|
|
100
|
+
},
|
|
101
|
+
/**
|
|
102
|
+
* @description whether to disable upload
|
|
103
|
+
*/
|
|
104
|
+
disabled: {
|
|
105
|
+
type: Boolean,
|
|
106
|
+
default: void 0
|
|
107
|
+
},
|
|
108
|
+
/**
|
|
109
|
+
* @description maximum number of uploads allowed
|
|
110
|
+
*/
|
|
111
|
+
limit: Number,
|
|
112
|
+
/**
|
|
113
|
+
* @description whether to support uploading directory
|
|
114
|
+
*/
|
|
115
|
+
directory: Boolean
|
|
116
|
+
}), P = a({
|
|
117
|
+
...l,
|
|
118
|
+
/**
|
|
119
|
+
* @description hook function before uploading with the file to be uploaded as its parameter. If `false` is returned or a `Promise` is returned and then is rejected, uploading will be aborted
|
|
120
|
+
*/
|
|
121
|
+
beforeUpload: {
|
|
122
|
+
type: t(Function),
|
|
123
|
+
default: e
|
|
124
|
+
},
|
|
125
|
+
/**
|
|
126
|
+
* @description hook function before removing a file with the file and file list as its parameters. If `false` is returned or a `Promise` is returned and then is rejected, removing will be aborted
|
|
127
|
+
*/
|
|
128
|
+
beforeRemove: {
|
|
129
|
+
type: t(Function)
|
|
130
|
+
},
|
|
131
|
+
/**
|
|
132
|
+
* @description hook function when files are removed
|
|
133
|
+
*/
|
|
134
|
+
onRemove: {
|
|
135
|
+
type: t(Function),
|
|
136
|
+
default: e
|
|
137
|
+
},
|
|
138
|
+
/**
|
|
139
|
+
* @description hook function when select file or upload file success or upload file fail
|
|
140
|
+
*/
|
|
141
|
+
onChange: {
|
|
142
|
+
type: t(Function),
|
|
143
|
+
default: e
|
|
144
|
+
},
|
|
145
|
+
/**
|
|
146
|
+
* @description hook function when clicking the uploaded files
|
|
147
|
+
*/
|
|
148
|
+
onPreview: {
|
|
149
|
+
type: t(Function),
|
|
150
|
+
default: e
|
|
151
|
+
},
|
|
152
|
+
/**
|
|
153
|
+
* @description hook function when uploaded successfully
|
|
154
|
+
*/
|
|
155
|
+
onSuccess: {
|
|
156
|
+
type: t(Function),
|
|
157
|
+
default: e
|
|
158
|
+
},
|
|
159
|
+
/**
|
|
160
|
+
* @description hook function when some progress occurs
|
|
161
|
+
*/
|
|
162
|
+
onProgress: {
|
|
163
|
+
type: t(Function),
|
|
164
|
+
default: e
|
|
165
|
+
},
|
|
166
|
+
/**
|
|
167
|
+
* @description hook function when some errors occurs
|
|
168
|
+
*/
|
|
169
|
+
onError: {
|
|
170
|
+
type: t(Function),
|
|
171
|
+
default: e
|
|
172
|
+
},
|
|
173
|
+
/**
|
|
174
|
+
* @description hook function when limit is exceeded
|
|
175
|
+
*/
|
|
176
|
+
onExceed: {
|
|
177
|
+
type: t(Function),
|
|
178
|
+
default: e
|
|
179
|
+
},
|
|
180
|
+
/**
|
|
181
|
+
* @description set HTML attribute: crossorigin.
|
|
182
|
+
*/
|
|
183
|
+
crossorigin: {
|
|
184
|
+
type: t(String)
|
|
185
|
+
}
|
|
186
|
+
}), r = {
|
|
187
|
+
action: "#",
|
|
188
|
+
method: "post",
|
|
189
|
+
data: () => o({}),
|
|
190
|
+
name: "file",
|
|
191
|
+
showFileList: !0,
|
|
192
|
+
accept: "",
|
|
193
|
+
fileList: () => o([]),
|
|
194
|
+
autoUpload: !0,
|
|
195
|
+
listType: "text",
|
|
196
|
+
httpRequest: n,
|
|
197
|
+
disabled: void 0
|
|
198
|
+
}, b = {
|
|
199
|
+
...r,
|
|
200
|
+
beforeUpload: e,
|
|
201
|
+
onRemove: e,
|
|
202
|
+
onChange: e,
|
|
203
|
+
onPreview: e,
|
|
204
|
+
onSuccess: e,
|
|
205
|
+
onProgress: e,
|
|
206
|
+
onError: e,
|
|
207
|
+
onExceed: e
|
|
208
|
+
};
|
|
209
|
+
export {
|
|
210
|
+
g as genFileId,
|
|
211
|
+
l as uploadBaseProps,
|
|
212
|
+
r as uploadBasePropsDefaults,
|
|
213
|
+
i as uploadListTypes,
|
|
214
|
+
P as uploadProps,
|
|
215
|
+
b as uploadPropsDefaults
|
|
216
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { UploadProps } from './upload';
|
|
2
|
+
declare var __VLS_8: {
|
|
3
|
+
file: import("./upload").UploadFile;
|
|
4
|
+
index: number;
|
|
5
|
+
}, __VLS_15: {}, __VLS_17: {}, __VLS_24: {}, __VLS_26: {}, __VLS_28: {}, __VLS_30: {}, __VLS_39: {
|
|
6
|
+
file: import("./upload").UploadFile;
|
|
7
|
+
index: number;
|
|
8
|
+
};
|
|
9
|
+
type __VLS_Slots = {} & {
|
|
10
|
+
file?: (props: typeof __VLS_8) => any;
|
|
11
|
+
} & {
|
|
12
|
+
trigger?: (props: typeof __VLS_15) => any;
|
|
13
|
+
} & {
|
|
14
|
+
default?: (props: typeof __VLS_17) => any;
|
|
15
|
+
} & {
|
|
16
|
+
trigger?: (props: typeof __VLS_24) => any;
|
|
17
|
+
} & {
|
|
18
|
+
default?: (props: typeof __VLS_26) => any;
|
|
19
|
+
} & {
|
|
20
|
+
default?: (props: typeof __VLS_28) => any;
|
|
21
|
+
} & {
|
|
22
|
+
tip?: (props: typeof __VLS_30) => any;
|
|
23
|
+
} & {
|
|
24
|
+
file?: (props: typeof __VLS_39) => any;
|
|
25
|
+
};
|
|
26
|
+
declare const __VLS_component: import("vue").DefineComponent<UploadProps, {
|
|
27
|
+
/** @description cancel upload request */
|
|
28
|
+
abort: (file?: import("./upload").UploadFile) => void;
|
|
29
|
+
/** @description upload the file list manually */
|
|
30
|
+
submit: () => void;
|
|
31
|
+
/** @description clear the file list */
|
|
32
|
+
clearFiles: (states?: import("./upload").UploadStatus[]) => void;
|
|
33
|
+
/** @description select the file manually */
|
|
34
|
+
handleStart: (rawFile: import("./upload").UploadRawFile) => void;
|
|
35
|
+
/** @description remove the file manually */
|
|
36
|
+
handleRemove: (file: import("./upload").UploadFile | import("./upload").UploadRawFile) => void;
|
|
37
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<UploadProps> & Readonly<{}>, {
|
|
38
|
+
data: import("../../../utils").Awaitable<import("./upload").UploadData> | ((rawFile: import("./upload").UploadRawFile) => import("../../../utils").Awaitable<import("./upload").UploadData>);
|
|
39
|
+
name: string;
|
|
40
|
+
disabled: boolean;
|
|
41
|
+
onChange: import("./upload").UploadHooks["onChange"];
|
|
42
|
+
onProgress: import("./upload").UploadHooks["onProgress"];
|
|
43
|
+
onError: import("./upload").UploadHooks["onError"];
|
|
44
|
+
method: string;
|
|
45
|
+
beforeUpload: import("./upload").UploadHooks["beforeUpload"];
|
|
46
|
+
onRemove: import("./upload").UploadHooks["onRemove"];
|
|
47
|
+
onPreview: import("./upload").UploadHooks["onPreview"];
|
|
48
|
+
onSuccess: import("./upload").UploadHooks["onSuccess"];
|
|
49
|
+
onExceed: import("./upload").UploadHooks["onExceed"];
|
|
50
|
+
action: string;
|
|
51
|
+
showFileList: boolean;
|
|
52
|
+
accept: string;
|
|
53
|
+
fileList: import("./upload").UploadUserFile[];
|
|
54
|
+
autoUpload: boolean;
|
|
55
|
+
listType: import("./upload").ListType;
|
|
56
|
+
httpRequest: import("./upload").UploadRequestHandler;
|
|
57
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
58
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
59
|
+
export default _default;
|
|
60
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
61
|
+
new (): {
|
|
62
|
+
$slots: S;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { defineComponent as U, shallowRef as T, computed as h, onBeforeUnmount as D, provide as N, toRef as V, openBlock as u, createElementBlock as j, createBlock as c, unref as l, createSlots as F, withCtx as s, createVNode as q, mergeProps as $, renderSlot as t, createCommentVNode as i, mergeDefaults as H } from "vue";
|
|
2
|
+
import "../../form/index.js";
|
|
3
|
+
import { uploadContextKey as K } from "./constants.js";
|
|
4
|
+
import R from "./upload-list.vue.js";
|
|
5
|
+
import w from "./upload-content.vue.js";
|
|
6
|
+
import { useHandlers as O } from "./use-handlers.js";
|
|
7
|
+
import { uploadPropsDefaults as z } from "./upload.js";
|
|
8
|
+
import { useFormDisabled as A } from "../../form/src/hooks/use-form-common-props.js";
|
|
9
|
+
const x = /* @__PURE__ */ U({
|
|
10
|
+
name: "ElUpload",
|
|
11
|
+
__name: "upload",
|
|
12
|
+
props: /* @__PURE__ */ H({
|
|
13
|
+
beforeUpload: { type: Function },
|
|
14
|
+
beforeRemove: { type: Function },
|
|
15
|
+
onRemove: { type: Function },
|
|
16
|
+
onChange: { type: Function },
|
|
17
|
+
onPreview: { type: Function },
|
|
18
|
+
onSuccess: { type: Function },
|
|
19
|
+
onProgress: { type: Function },
|
|
20
|
+
onError: { type: Function },
|
|
21
|
+
onExceed: { type: Function },
|
|
22
|
+
crossorigin: {},
|
|
23
|
+
action: {},
|
|
24
|
+
headers: {},
|
|
25
|
+
method: {},
|
|
26
|
+
data: { type: [Promise, Function] },
|
|
27
|
+
multiple: { type: Boolean },
|
|
28
|
+
name: {},
|
|
29
|
+
drag: { type: Boolean },
|
|
30
|
+
withCredentials: { type: Boolean },
|
|
31
|
+
showFileList: { type: Boolean },
|
|
32
|
+
accept: {},
|
|
33
|
+
fileList: {},
|
|
34
|
+
autoUpload: { type: Boolean },
|
|
35
|
+
listType: {},
|
|
36
|
+
httpRequest: { type: Function },
|
|
37
|
+
disabled: { type: Boolean },
|
|
38
|
+
limit: {},
|
|
39
|
+
directory: { type: Boolean }
|
|
40
|
+
}, z),
|
|
41
|
+
setup(o, { expose: b }) {
|
|
42
|
+
const r = o, v = A(), p = T(), {
|
|
43
|
+
abort: k,
|
|
44
|
+
submit: B,
|
|
45
|
+
clearFiles: P,
|
|
46
|
+
uploadFiles: n,
|
|
47
|
+
handleStart: y,
|
|
48
|
+
handleError: C,
|
|
49
|
+
handleRemove: a,
|
|
50
|
+
handleSuccess: E,
|
|
51
|
+
handleProgress: L,
|
|
52
|
+
revokeFileObjectURL: S
|
|
53
|
+
} = O(r, p), d = h(() => r.listType === "picture-card"), g = h(() => ({
|
|
54
|
+
...r,
|
|
55
|
+
fileList: n.value,
|
|
56
|
+
onStart: y,
|
|
57
|
+
onProgress: L,
|
|
58
|
+
onSuccess: E,
|
|
59
|
+
onError: C,
|
|
60
|
+
onRemove: a
|
|
61
|
+
}));
|
|
62
|
+
return D(() => {
|
|
63
|
+
n.value.forEach(S);
|
|
64
|
+
}), N(K, {
|
|
65
|
+
accept: V(r, "accept")
|
|
66
|
+
}), b({
|
|
67
|
+
/** @description cancel upload request */
|
|
68
|
+
abort: k,
|
|
69
|
+
/** @description upload the file list manually */
|
|
70
|
+
submit: B,
|
|
71
|
+
/** @description clear the file list */
|
|
72
|
+
clearFiles: P,
|
|
73
|
+
/** @description select the file manually */
|
|
74
|
+
handleStart: y,
|
|
75
|
+
/** @description remove the file manually */
|
|
76
|
+
handleRemove: a
|
|
77
|
+
}), (e, G) => (u(), j("div", null, [
|
|
78
|
+
d.value && o.showFileList ? (u(), c(R, {
|
|
79
|
+
key: 0,
|
|
80
|
+
disabled: l(v),
|
|
81
|
+
"list-type": o.listType,
|
|
82
|
+
files: l(n),
|
|
83
|
+
crossorigin: o.crossorigin,
|
|
84
|
+
"handle-preview": o.onPreview,
|
|
85
|
+
onRemove: l(a)
|
|
86
|
+
}, F({
|
|
87
|
+
append: s(() => [
|
|
88
|
+
q(w, $({
|
|
89
|
+
ref_key: "uploadRef",
|
|
90
|
+
ref: p
|
|
91
|
+
}, g.value), {
|
|
92
|
+
default: s(() => [
|
|
93
|
+
e.$slots.trigger ? t(e.$slots, "trigger", {}, void 0, void 0, 0) : i("", !0),
|
|
94
|
+
!e.$slots.trigger && e.$slots.default ? t(e.$slots, "default", {}, void 0, void 0, 1) : i("", !0)
|
|
95
|
+
]),
|
|
96
|
+
_: 3
|
|
97
|
+
}, 16)
|
|
98
|
+
]),
|
|
99
|
+
_: 2
|
|
100
|
+
}, [
|
|
101
|
+
e.$slots.file ? {
|
|
102
|
+
name: "default",
|
|
103
|
+
fn: s(({ file: f, index: m }) => [
|
|
104
|
+
t(e.$slots, "file", {
|
|
105
|
+
file: f,
|
|
106
|
+
index: m
|
|
107
|
+
})
|
|
108
|
+
]),
|
|
109
|
+
key: "0"
|
|
110
|
+
} : void 0
|
|
111
|
+
]), 1032, ["disabled", "list-type", "files", "crossorigin", "handle-preview", "onRemove"])) : i("", !0),
|
|
112
|
+
!d.value || d.value && !o.showFileList ? (u(), c(w, $({
|
|
113
|
+
key: 1,
|
|
114
|
+
ref_key: "uploadRef",
|
|
115
|
+
ref: p
|
|
116
|
+
}, g.value), {
|
|
117
|
+
default: s(() => [
|
|
118
|
+
e.$slots.trigger ? t(e.$slots, "trigger", {}, void 0, void 0, 0) : i("", !0),
|
|
119
|
+
!e.$slots.trigger && e.$slots.default ? t(e.$slots, "default", {}, void 0, void 0, 1) : i("", !0)
|
|
120
|
+
]),
|
|
121
|
+
_: 3
|
|
122
|
+
}, 16)) : i("", !0),
|
|
123
|
+
e.$slots.trigger ? t(e.$slots, "default", {}, void 0, void 0, 2) : i("", !0),
|
|
124
|
+
t(e.$slots, "tip"),
|
|
125
|
+
!d.value && o.showFileList ? (u(), c(R, {
|
|
126
|
+
key: 3,
|
|
127
|
+
disabled: l(v),
|
|
128
|
+
"list-type": o.listType,
|
|
129
|
+
files: l(n),
|
|
130
|
+
crossorigin: o.crossorigin,
|
|
131
|
+
"handle-preview": o.onPreview,
|
|
132
|
+
onRemove: l(a)
|
|
133
|
+
}, F({ _: 2 }, [
|
|
134
|
+
e.$slots.file ? {
|
|
135
|
+
name: "default",
|
|
136
|
+
fn: s(({ file: f, index: m }) => [
|
|
137
|
+
t(e.$slots, "file", {
|
|
138
|
+
file: f,
|
|
139
|
+
index: m
|
|
140
|
+
})
|
|
141
|
+
]),
|
|
142
|
+
key: "0"
|
|
143
|
+
} : void 0
|
|
144
|
+
]), 1032, ["disabled", "list-type", "files", "crossorigin", "handle-preview", "onRemove"])) : i("", !0)
|
|
145
|
+
]));
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
export {
|
|
149
|
+
x as default
|
|
150
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { ShallowRef } from 'vue';
|
|
2
|
+
import type { UploadContentInstance } from './upload-content';
|
|
3
|
+
import type { UploadFile, UploadProps, UploadRawFile, UploadStatus } from './upload';
|
|
4
|
+
export declare const useHandlers: (props: UploadProps & Required<Pick<UploadProps, "listType" | "onChange" | "onError" | "onProgress" | "onSuccess" | "onRemove">>, uploadRef: ShallowRef<UploadContentInstance | undefined>) => {
|
|
5
|
+
/** @description two-way binding ref from props `fileList` */
|
|
6
|
+
uploadFiles: import("vue").Ref<{
|
|
7
|
+
name: string;
|
|
8
|
+
percentage?: number | undefined;
|
|
9
|
+
status: UploadStatus;
|
|
10
|
+
size?: number | undefined;
|
|
11
|
+
response?: unknown;
|
|
12
|
+
uid: number;
|
|
13
|
+
url?: string | undefined;
|
|
14
|
+
raw?: {
|
|
15
|
+
uid: number;
|
|
16
|
+
isDirectory?: boolean | undefined;
|
|
17
|
+
readonly lastModified: number;
|
|
18
|
+
readonly name: string;
|
|
19
|
+
readonly webkitRelativePath: string;
|
|
20
|
+
readonly size: number;
|
|
21
|
+
readonly type: string;
|
|
22
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
23
|
+
bytes: () => Promise<Uint8Array<ArrayBuffer>>;
|
|
24
|
+
slice: (start?: number, end?: number, contentType?: string) => Blob;
|
|
25
|
+
stream: () => ReadableStream<Uint8Array<ArrayBuffer>>;
|
|
26
|
+
text: () => Promise<string>;
|
|
27
|
+
} | undefined;
|
|
28
|
+
}[], {
|
|
29
|
+
name: string;
|
|
30
|
+
percentage?: number | undefined;
|
|
31
|
+
status: UploadStatus;
|
|
32
|
+
size?: number | undefined;
|
|
33
|
+
response?: unknown;
|
|
34
|
+
uid: number;
|
|
35
|
+
url?: string | undefined;
|
|
36
|
+
raw?: {
|
|
37
|
+
uid: number;
|
|
38
|
+
isDirectory?: boolean | undefined;
|
|
39
|
+
readonly lastModified: number;
|
|
40
|
+
readonly name: string;
|
|
41
|
+
readonly webkitRelativePath: string;
|
|
42
|
+
readonly size: number;
|
|
43
|
+
readonly type: string;
|
|
44
|
+
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
45
|
+
bytes: () => Promise<Uint8Array<ArrayBuffer>>;
|
|
46
|
+
slice: (start?: number, end?: number, contentType?: string) => Blob;
|
|
47
|
+
stream: () => ReadableStream<Uint8Array<ArrayBuffer>>;
|
|
48
|
+
text: () => Promise<string>;
|
|
49
|
+
} | undefined;
|
|
50
|
+
}[]>;
|
|
51
|
+
abort: (file?: UploadFile) => void;
|
|
52
|
+
clearFiles: (states?: UploadStatus[]) => void;
|
|
53
|
+
handleError: (err: import("./ajax").UploadAjaxError, rawFile: UploadRawFile) => void;
|
|
54
|
+
handleProgress: (evt: import("./upload").UploadProgressEvent, rawFile: UploadRawFile) => void;
|
|
55
|
+
handleStart: (rawFile: UploadRawFile) => void;
|
|
56
|
+
handleSuccess: (response: any, rawFile: UploadRawFile) => unknown;
|
|
57
|
+
handleRemove: (file: UploadFile | UploadRawFile) => void;
|
|
58
|
+
submit: () => void;
|
|
59
|
+
revokeFileObjectURL: (file: UploadFile) => void;
|
|
60
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { watch as d, nextTick as U } from "vue";
|
|
2
|
+
import { isNil as O } from "lodash-unified";
|
|
3
|
+
import { useVModel as j } from "@vueuse/core";
|
|
4
|
+
import "@vue/shared";
|
|
5
|
+
import { throwError as w, debugWarn as S } from "../../../utils/error.js";
|
|
6
|
+
import "@element-plus/icons-vue";
|
|
7
|
+
import { genFileId as v } from "./upload.js";
|
|
8
|
+
const m = "ElUpload", f = (u) => {
|
|
9
|
+
var n;
|
|
10
|
+
(n = u.url) != null && n.startsWith("blob:") && URL.revokeObjectURL(u.url);
|
|
11
|
+
}, M = (u, n) => {
|
|
12
|
+
const o = j(
|
|
13
|
+
u,
|
|
14
|
+
"fileList",
|
|
15
|
+
void 0,
|
|
16
|
+
{ passive: !0 }
|
|
17
|
+
), s = (e) => o.value.find((t) => t.uid === e.uid);
|
|
18
|
+
function i(e) {
|
|
19
|
+
var t;
|
|
20
|
+
(t = n.value) == null || t.abort(e);
|
|
21
|
+
}
|
|
22
|
+
function b(e = ["ready", "uploading", "success", "fail"]) {
|
|
23
|
+
o.value = o.value.filter(
|
|
24
|
+
(t) => !e.includes(t.status)
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
function l(e) {
|
|
28
|
+
o.value = o.value.filter(
|
|
29
|
+
(t) => t.uid !== e.uid
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
const c = (e) => {
|
|
33
|
+
U(() => u.onChange(e, o.value));
|
|
34
|
+
}, h = (e, t) => {
|
|
35
|
+
const r = s(t);
|
|
36
|
+
r && (console.error(e), r.status = "fail", l(r), u.onError(e, r, o.value), c(r));
|
|
37
|
+
}, g = (e, t) => {
|
|
38
|
+
const r = s(t);
|
|
39
|
+
r && (u.onProgress(e, r, o.value), r.status = "uploading", r.percentage = Math.round(e.percent));
|
|
40
|
+
}, R = (e, t) => {
|
|
41
|
+
const r = s(t);
|
|
42
|
+
r && (r.status = "success", r.response = e, u.onSuccess(e, r, o.value), c(r));
|
|
43
|
+
}, y = (e) => {
|
|
44
|
+
O(e.uid) && (e.uid = v());
|
|
45
|
+
const t = {
|
|
46
|
+
name: e.name,
|
|
47
|
+
percentage: 0,
|
|
48
|
+
status: "ready",
|
|
49
|
+
size: e.size,
|
|
50
|
+
raw: e,
|
|
51
|
+
uid: e.uid
|
|
52
|
+
};
|
|
53
|
+
if (u.listType === "picture-card" || u.listType === "picture")
|
|
54
|
+
try {
|
|
55
|
+
t.url = URL.createObjectURL(e);
|
|
56
|
+
} catch (r) {
|
|
57
|
+
S(m, r.message), u.onError(r, t, o.value);
|
|
58
|
+
}
|
|
59
|
+
o.value = [...o.value, t], c(t);
|
|
60
|
+
}, F = async (e) => {
|
|
61
|
+
const t = e instanceof File ? s(e) : e;
|
|
62
|
+
t || w(m, "file to be removed not found");
|
|
63
|
+
const r = (a) => {
|
|
64
|
+
i(a), l(a), u.onRemove(a, o.value), f(a);
|
|
65
|
+
};
|
|
66
|
+
u.beforeRemove ? await u.beforeRemove(t, o.value) !== !1 && r(t) : r(t);
|
|
67
|
+
};
|
|
68
|
+
function E() {
|
|
69
|
+
o.value.filter(({ status: e }) => e === "ready").forEach(({ raw: e }) => {
|
|
70
|
+
var t;
|
|
71
|
+
return e && ((t = n.value) == null ? void 0 : t.upload(e));
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
return d(
|
|
75
|
+
() => u.listType,
|
|
76
|
+
(e) => {
|
|
77
|
+
e !== "picture-card" && e !== "picture" || (o.value = o.value.map((t) => {
|
|
78
|
+
const { raw: r, url: a } = t;
|
|
79
|
+
if (!a && r)
|
|
80
|
+
try {
|
|
81
|
+
t.url = URL.createObjectURL(r);
|
|
82
|
+
} catch (L) {
|
|
83
|
+
u.onError(L, t, o.value);
|
|
84
|
+
}
|
|
85
|
+
return t;
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
), d(
|
|
89
|
+
o,
|
|
90
|
+
(e) => {
|
|
91
|
+
for (const t of e)
|
|
92
|
+
t.uid || (t.uid = v()), t.status || (t.status = "success");
|
|
93
|
+
},
|
|
94
|
+
{ immediate: !0, deep: !0 }
|
|
95
|
+
), {
|
|
96
|
+
/** @description two-way binding ref from props `fileList` */
|
|
97
|
+
uploadFiles: o,
|
|
98
|
+
abort: i,
|
|
99
|
+
clearFiles: b,
|
|
100
|
+
handleError: h,
|
|
101
|
+
handleProgress: g,
|
|
102
|
+
handleStart: y,
|
|
103
|
+
handleSuccess: R,
|
|
104
|
+
handleRemove: F,
|
|
105
|
+
submit: E,
|
|
106
|
+
revokeFileObjectURL: f
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
export {
|
|
110
|
+
M as useHandlers
|
|
111
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import t from "normalize-wheel-es";
|
|
2
|
+
const l = "_Mousewheel", u = function(e, o) {
|
|
3
|
+
if (e && e.addEventListener) {
|
|
4
|
+
a(e);
|
|
5
|
+
const r = function(s) {
|
|
6
|
+
const n = t(s);
|
|
7
|
+
o && Reflect.apply(o, this, [s, n]);
|
|
8
|
+
};
|
|
9
|
+
e[l] = { wheelHandler: r }, e.addEventListener("wheel", r, { passive: !0 });
|
|
10
|
+
}
|
|
11
|
+
}, a = (e) => {
|
|
12
|
+
var o;
|
|
13
|
+
(o = e[l]) != null && o.wheelHandler && (e.removeEventListener("wheel", e[l].wheelHandler), e[l] = null);
|
|
14
|
+
}, h = {
|
|
15
|
+
beforeMount(e, o) {
|
|
16
|
+
u(e, o.value);
|
|
17
|
+
},
|
|
18
|
+
unmounted(e) {
|
|
19
|
+
a(e);
|
|
20
|
+
},
|
|
21
|
+
updated(e, o) {
|
|
22
|
+
o.value !== o.oldValue && u(e, o.value);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
l as SCOPE,
|
|
27
|
+
h as default
|
|
28
|
+
};
|