@progress/kendo-vue-upload 3.5.0 → 3.5.1-dev.202208100944
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/cdn/js/kendo-vue-upload.js +1 -1
- package/dist/es/UploadListMultiItem.js +5 -5
- package/dist/es/UploadListSingleItem.js +1 -1
- package/dist/es/interfaces/BaseUploadEvent.js +1 -0
- package/dist/es/interfaces/FileGroup.js +1 -0
- package/dist/es/interfaces/UploadActionsLayout.js +1 -0
- package/dist/es/interfaces/UploadAdditionalData.js +1 -0
- package/dist/es/interfaces/UploadAsyncProps.js +1 -0
- package/dist/es/interfaces/UploadFileInfo.js +1 -0
- package/dist/es/interfaces/UploadFileRestrictions.js +1 -0
- package/dist/es/interfaces/UploadHttpHeaders.js +1 -0
- package/dist/es/interfaces/UploadListItemProps.js +1 -0
- package/dist/es/interfaces/UploadOnAddEvent.js +1 -0
- package/dist/es/interfaces/UploadOnBeforeRemoveEvent.js +1 -0
- package/dist/es/interfaces/UploadOnBeforeUploadEvent.js +1 -0
- package/dist/es/interfaces/UploadOnCancelEvent.js +1 -0
- package/dist/es/interfaces/UploadOnProgressEvent.js +1 -0
- package/dist/es/interfaces/UploadOnRemoveEvent.js +1 -0
- package/dist/es/interfaces/UploadOnStatusChangeEvent.js +1 -0
- package/dist/es/interfaces/UploadProps.js +1 -0
- package/dist/es/interfaces/UploadResponse.js +1 -0
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/utils/connectionUtils.d.ts +3 -3
- package/dist/es/utils/stateUtils.d.ts +3 -3
- package/dist/es/utils/utils.d.ts +3 -3
- package/dist/es/utils/validationUtils.d.ts +3 -3
- package/dist/esm/ExternalDropZone.d.ts +121 -0
- package/dist/esm/ExternalDropZone.js +169 -0
- package/dist/esm/Upload.d.ts +50 -0
- package/dist/esm/Upload.js +787 -0
- package/dist/esm/UploadActionButtons.d.ts +59 -0
- package/dist/esm/UploadActionButtons.js +165 -0
- package/dist/esm/UploadAddButton.d.ts +67 -0
- package/dist/esm/UploadAddButton.js +165 -0
- package/dist/esm/UploadDropZone.d.ts +61 -0
- package/dist/esm/UploadDropZone.js +288 -0
- package/dist/esm/UploadInput.d.ts +56 -0
- package/dist/esm/UploadInput.js +116 -0
- package/dist/esm/UploadList.d.ts +58 -0
- package/dist/esm/UploadList.js +103 -0
- package/dist/esm/UploadListActionButton.d.ts +56 -0
- package/dist/esm/UploadListActionButton.js +176 -0
- package/dist/esm/UploadListGroup.d.ts +56 -0
- package/dist/esm/UploadListGroup.js +150 -0
- package/dist/esm/UploadListMultiItem.d.ts +44 -0
- package/dist/esm/UploadListMultiItem.js +172 -0
- package/dist/esm/UploadListSingleItem.d.ts +44 -0
- package/dist/esm/UploadListSingleItem.js +228 -0
- package/dist/esm/UploadNavigation.d.ts +46 -0
- package/dist/esm/UploadNavigation.js +348 -0
- package/dist/esm/UploadStatus.d.ts +53 -0
- package/dist/esm/UploadStatus.js +63 -0
- package/dist/esm/UploadUI.d.ts +81 -0
- package/dist/esm/UploadUI.js +265 -0
- package/dist/esm/additionalTypes.ts +21 -0
- package/dist/esm/interfaces/BaseUploadEvent.d.ts +9 -0
- package/dist/esm/interfaces/BaseUploadEvent.js +1 -0
- package/dist/esm/interfaces/FileGroup.d.ts +7 -0
- package/dist/esm/interfaces/FileGroup.js +1 -0
- package/dist/esm/interfaces/UploadActionsLayout.d.ts +4 -0
- package/dist/esm/interfaces/UploadActionsLayout.js +1 -0
- package/dist/esm/interfaces/UploadAdditionalData.d.ts +6 -0
- package/dist/esm/interfaces/UploadAdditionalData.js +1 -0
- package/dist/esm/interfaces/UploadAsyncProps.d.ts +82 -0
- package/dist/esm/interfaces/UploadAsyncProps.js +1 -0
- package/dist/esm/interfaces/UploadFileInfo.d.ts +41 -0
- package/dist/esm/interfaces/UploadFileInfo.js +1 -0
- package/dist/esm/interfaces/UploadFileRestrictions.d.ts +19 -0
- package/dist/esm/interfaces/UploadFileRestrictions.js +1 -0
- package/dist/esm/interfaces/UploadFileStatus.d.ts +33 -0
- package/dist/esm/interfaces/UploadFileStatus.js +34 -0
- package/dist/esm/interfaces/UploadHttpHeaders.d.ts +6 -0
- package/dist/esm/interfaces/UploadHttpHeaders.js +1 -0
- package/dist/esm/interfaces/UploadListItemProps.d.ts +19 -0
- package/dist/esm/interfaces/UploadListItemProps.js +1 -0
- package/dist/esm/interfaces/UploadOnAddEvent.d.ts +15 -0
- package/dist/esm/interfaces/UploadOnAddEvent.js +1 -0
- package/dist/esm/interfaces/UploadOnBeforeRemoveEvent.d.ts +21 -0
- package/dist/esm/interfaces/UploadOnBeforeRemoveEvent.js +1 -0
- package/dist/esm/interfaces/UploadOnBeforeUploadEvent.d.ts +21 -0
- package/dist/esm/interfaces/UploadOnBeforeUploadEvent.js +1 -0
- package/dist/esm/interfaces/UploadOnCancelEvent.d.ts +10 -0
- package/dist/esm/interfaces/UploadOnCancelEvent.js +1 -0
- package/dist/esm/interfaces/UploadOnProgressEvent.d.ts +15 -0
- package/dist/esm/interfaces/UploadOnProgressEvent.js +1 -0
- package/dist/esm/interfaces/UploadOnRemoveEvent.d.ts +20 -0
- package/dist/esm/interfaces/UploadOnRemoveEvent.js +1 -0
- package/dist/esm/interfaces/UploadOnStatusChangeEvent.d.ts +20 -0
- package/dist/esm/interfaces/UploadOnStatusChangeEvent.js +1 -0
- package/dist/esm/interfaces/UploadProps.d.ts +114 -0
- package/dist/esm/interfaces/UploadProps.js +1 -0
- package/dist/esm/interfaces/UploadResponse.d.ts +25 -0
- package/dist/esm/interfaces/UploadResponse.js +1 -0
- package/dist/esm/main.d.ts +25 -0
- package/dist/esm/main.js +9 -0
- package/dist/esm/messages/index.d.ts +100 -0
- package/dist/esm/messages/index.js +101 -0
- package/dist/esm/package-metadata.d.ts +5 -0
- package/dist/esm/package-metadata.js +11 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/utils/connectionUtils.d.ts +17 -0
- package/dist/esm/utils/connectionUtils.js +78 -0
- package/dist/esm/utils/stateUtils.d.ts +26 -0
- package/dist/esm/utils/stateUtils.js +83 -0
- package/dist/esm/utils/utils.d.ts +17 -0
- package/dist/esm/utils/utils.js +128 -0
- package/dist/esm/utils/validationUtils.d.ts +7 -0
- package/dist/esm/utils/validationUtils.js +50 -0
- package/dist/npm/ExternalDropZone.js +6 -6
- package/dist/npm/Upload.js +5 -5
- package/dist/npm/UploadActionButtons.js +4 -4
- package/dist/npm/UploadAddButton.js +3 -3
- package/dist/npm/UploadDropZone.js +2 -2
- package/dist/npm/UploadInput.js +1 -1
- package/dist/npm/UploadList.js +1 -1
- package/dist/npm/UploadListActionButton.js +3 -3
- package/dist/npm/UploadListGroup.js +2 -2
- package/dist/npm/UploadListMultiItem.js +8 -8
- package/dist/npm/UploadListSingleItem.js +4 -4
- package/dist/npm/UploadStatus.js +3 -3
- package/dist/npm/UploadUI.js +2 -2
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/utils/connectionUtils.d.ts +3 -3
- package/dist/npm/utils/stateUtils.d.ts +3 -3
- package/dist/npm/utils/utils.d.ts +3 -3
- package/dist/npm/utils/utils.js +2 -2
- package/dist/npm/utils/validationUtils.d.ts +3 -3
- package/package.json +4 -4
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import * as Vue from 'vue';
|
|
3
|
+
var allVue = Vue;
|
|
4
|
+
var gh = allVue.h;
|
|
5
|
+
var isV3 = allVue.version && allVue.version[0] === '3';
|
|
6
|
+
var ref = allVue.ref;
|
|
7
|
+
var inject = allVue.inject;
|
|
8
|
+
import { classNames } from '@progress/kendo-vue-common';
|
|
9
|
+
import { provideLocalizationService } from '@progress/kendo-vue-intl';
|
|
10
|
+
import { messages, statusUploaded, statusUploadFailed } from './messages.js';
|
|
11
|
+
import utils from './utils/utils.js';
|
|
12
|
+
import { UploadListActionButton } from './UploadListActionButton.js';
|
|
13
|
+
/**
|
|
14
|
+
* @hidden
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
var UploadListSingleItemVue2 = {
|
|
18
|
+
name: 'KendoVueUploadListSingleItem',
|
|
19
|
+
props: {
|
|
20
|
+
files: Array,
|
|
21
|
+
disabled: Boolean,
|
|
22
|
+
async: Object
|
|
23
|
+
},
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
emits: {
|
|
26
|
+
'cancel': null,
|
|
27
|
+
'retry': null,
|
|
28
|
+
'remove': null
|
|
29
|
+
},
|
|
30
|
+
inject: {
|
|
31
|
+
kendoLocalizationService: {
|
|
32
|
+
default: null
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
methods: {
|
|
36
|
+
onRetry: function onRetry(uid) {
|
|
37
|
+
this.$emit('retry', uid);
|
|
38
|
+
},
|
|
39
|
+
onRemove: function onRemove(uid) {
|
|
40
|
+
this.$emit('remove', uid);
|
|
41
|
+
},
|
|
42
|
+
onCancel: function onCancel(uid) {
|
|
43
|
+
this.$emit('cancel', uid);
|
|
44
|
+
},
|
|
45
|
+
getFileExtension: function getFileExtension(file) {
|
|
46
|
+
return file.extension ? file.extension.substring(1) : '';
|
|
47
|
+
},
|
|
48
|
+
getFileValidationMessage: function getFileValidationMessage(file, isUploadFailed) {
|
|
49
|
+
var localizationService = provideLocalizationService(this);
|
|
50
|
+
var validationMessage = '';
|
|
51
|
+
|
|
52
|
+
if (isUploadFailed) {
|
|
53
|
+
validationMessage = localizationService.toLanguageString(statusUploadFailed, messages[statusUploadFailed]);
|
|
54
|
+
} else if (file.validationErrors && file.validationErrors.length > 0) {
|
|
55
|
+
var messageKey = "upload.".concat(file.validationErrors[0]);
|
|
56
|
+
validationMessage = localizationService.toLanguageString(messageKey, messages[messageKey]);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return validationMessage;
|
|
60
|
+
},
|
|
61
|
+
getFileExtensionIcon: function getFileExtensionIcon(file) {
|
|
62
|
+
switch (file.extension) {
|
|
63
|
+
case '.png':
|
|
64
|
+
case '.jpg':
|
|
65
|
+
case '.jpeg':
|
|
66
|
+
case '.tiff':
|
|
67
|
+
case '.bmp':
|
|
68
|
+
case '.gif':
|
|
69
|
+
return 'k-i-file-image';
|
|
70
|
+
|
|
71
|
+
case '.mp3':
|
|
72
|
+
case '.mp4':
|
|
73
|
+
case '.wav':
|
|
74
|
+
return 'k-i-file-audio';
|
|
75
|
+
|
|
76
|
+
case '.mkv':
|
|
77
|
+
case '.webm':
|
|
78
|
+
case '.flv':
|
|
79
|
+
case '.gifv':
|
|
80
|
+
case '.avi':
|
|
81
|
+
case '.wmv':
|
|
82
|
+
return 'k-i-file-video';
|
|
83
|
+
|
|
84
|
+
case '.txt':
|
|
85
|
+
return 'k-i-file-txt';
|
|
86
|
+
|
|
87
|
+
case '.pdf':
|
|
88
|
+
return 'k-i-file-pdf';
|
|
89
|
+
|
|
90
|
+
case '.ppt':
|
|
91
|
+
case '.pptx':
|
|
92
|
+
return 'k-i-file-presentation';
|
|
93
|
+
|
|
94
|
+
case '.csv':
|
|
95
|
+
case '.xls':
|
|
96
|
+
case '.xlsx':
|
|
97
|
+
return 'k-i-file-data';
|
|
98
|
+
|
|
99
|
+
case '.html':
|
|
100
|
+
case '.css':
|
|
101
|
+
case '.js':
|
|
102
|
+
case '.ts':
|
|
103
|
+
return 'k-i-file-programming';
|
|
104
|
+
|
|
105
|
+
case '.exe':
|
|
106
|
+
return 'k-i-file-config';
|
|
107
|
+
|
|
108
|
+
case '.zip':
|
|
109
|
+
case '.rar':
|
|
110
|
+
return 'k-i-file-zip';
|
|
111
|
+
|
|
112
|
+
default:
|
|
113
|
+
return 'k-i-file';
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
// @ts-ignore
|
|
118
|
+
setup: !isV3 ? undefined : function () {
|
|
119
|
+
var v3 = !!isV3;
|
|
120
|
+
var kendoLocalizationService = inject('kendoLocalizationService', {});
|
|
121
|
+
return {
|
|
122
|
+
v3: v3,
|
|
123
|
+
kendoLocalizationService: kendoLocalizationService
|
|
124
|
+
};
|
|
125
|
+
},
|
|
126
|
+
render: function render(createElement) {
|
|
127
|
+
var h = gh || createElement;
|
|
128
|
+
var _a = this.$props,
|
|
129
|
+
files = _a.files,
|
|
130
|
+
disabled = _a.disabled,
|
|
131
|
+
async = _a.async;
|
|
132
|
+
var file = files[0];
|
|
133
|
+
var itemClassName = classNames('k-file-single');
|
|
134
|
+
|
|
135
|
+
var _b = utils.getFileStatus([file]),
|
|
136
|
+
isUploaded = _b[1],
|
|
137
|
+
isUploadFailed = _b[2],
|
|
138
|
+
isUploadValidationFailed = _b[3];
|
|
139
|
+
|
|
140
|
+
var showProgressBar = !isUploadValidationFailed && !isUploaded && !isUploadFailed;
|
|
141
|
+
|
|
142
|
+
var renderValidationError = function renderValidationError(currentFile, isCurrentUploadFailed) {
|
|
143
|
+
return h("span", {
|
|
144
|
+
"class": 'k-file-name-size-wrapper',
|
|
145
|
+
key: '2'
|
|
146
|
+
}, [h("span", {
|
|
147
|
+
"class": 'k-file-name k-file-name-invalid',
|
|
148
|
+
title: currentFile.name,
|
|
149
|
+
attrs: this.v3 ? undefined : {
|
|
150
|
+
title: currentFile.name
|
|
151
|
+
}
|
|
152
|
+
}, [currentFile.name]), h("span", {
|
|
153
|
+
"class": 'k-file-validation-message k-text-error'
|
|
154
|
+
}, [this.getFileValidationMessage(currentFile, isCurrentUploadFailed)])]);
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
var renderFileDetails = function renderFileDetails(currentFile) {
|
|
158
|
+
var localizationService = provideLocalizationService(this);
|
|
159
|
+
var successMessage = localizationService.toLanguageString(statusUploaded, messages[statusUploaded]);
|
|
160
|
+
return h("span", {
|
|
161
|
+
"class": 'k-file-name-size-wrapper',
|
|
162
|
+
key: '2'
|
|
163
|
+
}, [h("span", {
|
|
164
|
+
"class": 'k-file-name',
|
|
165
|
+
title: currentFile.name,
|
|
166
|
+
attrs: this.v3 ? undefined : {
|
|
167
|
+
title: currentFile.name
|
|
168
|
+
}
|
|
169
|
+
}, [currentFile.name]), currentFile.progress !== 100 ? h("span", {
|
|
170
|
+
"class": 'k-file-size'
|
|
171
|
+
}, [utils.getTotalFilesSizeMessage([currentFile])]) : h("span", {
|
|
172
|
+
"class": 'k-file-validation-message k-text-success'
|
|
173
|
+
}, [successMessage])]);
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
return h("div", {
|
|
177
|
+
"class": itemClassName
|
|
178
|
+
}, [h("div", {
|
|
179
|
+
"class": 'k-progressbar',
|
|
180
|
+
style: {
|
|
181
|
+
transition: 'opacity 1s ease-in-out',
|
|
182
|
+
opacity: showProgressBar ? 1 : 0
|
|
183
|
+
}
|
|
184
|
+
}, [h("span", {
|
|
185
|
+
"class": 'k-progress',
|
|
186
|
+
style: {
|
|
187
|
+
width: (file.progress || 0) + '%'
|
|
188
|
+
}
|
|
189
|
+
})]), h("span", {
|
|
190
|
+
"class": 'k-file-group-wrapper',
|
|
191
|
+
key: '1'
|
|
192
|
+
}, [h("span", {
|
|
193
|
+
"class": 'k-file-group k-icon ' + this.getFileExtensionIcon(file)
|
|
194
|
+
}), h("span", {
|
|
195
|
+
"class": 'k-file-state'
|
|
196
|
+
})]), isUploadValidationFailed || isUploadFailed ? renderValidationError.call(this, file, isUploadFailed) : renderFileDetails.call(this, file), // @ts-ignore function children
|
|
197
|
+
h(UploadListActionButton, {
|
|
198
|
+
uid: file.uid,
|
|
199
|
+
attrs: this.v3 ? undefined : {
|
|
200
|
+
uid: file.uid,
|
|
201
|
+
status: file.status,
|
|
202
|
+
progress: file.progress,
|
|
203
|
+
files: files,
|
|
204
|
+
disabled: disabled,
|
|
205
|
+
async: async
|
|
206
|
+
},
|
|
207
|
+
status: file.status,
|
|
208
|
+
progress: file.progress,
|
|
209
|
+
files: files,
|
|
210
|
+
disabled: disabled,
|
|
211
|
+
async: async,
|
|
212
|
+
onCancel: this.onCancel,
|
|
213
|
+
on: this.v3 ? undefined : {
|
|
214
|
+
"cancel": this.onCancel,
|
|
215
|
+
"remove": this.onRemove,
|
|
216
|
+
"retry": this.onRetry
|
|
217
|
+
},
|
|
218
|
+
onRemove: this.onRemove,
|
|
219
|
+
onRetry: this.onRetry
|
|
220
|
+
})]);
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* @hidden
|
|
225
|
+
*/
|
|
226
|
+
|
|
227
|
+
var UploadListSingleItem = UploadListSingleItemVue2;
|
|
228
|
+
export { UploadListSingleItem, UploadListSingleItemVue2 };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { DefineComponent, RecordPropsDefinition, ComponentOptions, Vue2type } from './additionalTypes';
|
|
2
|
+
declare type DefaultData<V> = object | ((this: V) => {});
|
|
3
|
+
declare type DefaultMethods<V> = {
|
|
4
|
+
[key: string]: (this: V, ...args: any[]) => any;
|
|
5
|
+
};
|
|
6
|
+
import { UploadUIProps } from './UploadUI';
|
|
7
|
+
/**
|
|
8
|
+
* @hidden
|
|
9
|
+
*/
|
|
10
|
+
export interface UploadNavigationMethods {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* @hidden
|
|
15
|
+
*/
|
|
16
|
+
export interface UploadNavigationState {
|
|
17
|
+
v3: boolean;
|
|
18
|
+
_uploadUI: any | null;
|
|
19
|
+
_blurTimeout: number | undefined;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @hidden
|
|
23
|
+
*/
|
|
24
|
+
export interface UploadNavigationData {
|
|
25
|
+
currentNavIndex: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @hidden
|
|
29
|
+
*/
|
|
30
|
+
export interface UploadNavigationComputed {
|
|
31
|
+
[key: string]: any;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* @hidden
|
|
35
|
+
*/
|
|
36
|
+
export interface UploadNavigationAll extends UploadNavigationMethods, UploadNavigationState, UploadNavigationData, UploadNavigationComputed, Vue2type {
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @hidden
|
|
40
|
+
*/
|
|
41
|
+
declare let UploadNavigationVue2: ComponentOptions<Vue2type, DefaultData<UploadNavigationData>, DefaultMethods<UploadNavigationAll>, UploadNavigationComputed, RecordPropsDefinition<UploadUIProps>>;
|
|
42
|
+
/**
|
|
43
|
+
* @hidden
|
|
44
|
+
*/
|
|
45
|
+
declare const UploadNavigation: DefineComponent<UploadUIProps, any, UploadNavigationData, UploadNavigationComputed, UploadNavigationMethods, {}, {}, {}, string, UploadUIProps, UploadUIProps, {}>;
|
|
46
|
+
export { UploadNavigation, UploadNavigationVue2 };
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import * as Vue from 'vue';
|
|
3
|
+
var allVue = Vue;
|
|
4
|
+
var gh = allVue.h;
|
|
5
|
+
var isV3 = allVue.version && allVue.version[0] === '3';
|
|
6
|
+
var ref = allVue.ref;
|
|
7
|
+
import { Keys } from '@progress/kendo-vue-common';
|
|
8
|
+
import { UploadUI } from './UploadUI.js';
|
|
9
|
+
/**
|
|
10
|
+
* @hidden
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
var NOT_FOCUSED_INDEX = -2;
|
|
14
|
+
/**
|
|
15
|
+
* @hidden
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
var DEFAULT_INDEX = -1;
|
|
19
|
+
/**
|
|
20
|
+
* @hidden
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
var UploadNavigationVue2 = {
|
|
24
|
+
name: 'KendoVueUploadNavigation',
|
|
25
|
+
props: {
|
|
26
|
+
async: Object,
|
|
27
|
+
className: String,
|
|
28
|
+
multiple: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: true
|
|
31
|
+
},
|
|
32
|
+
disabled: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: false
|
|
35
|
+
},
|
|
36
|
+
showFileList: Boolean,
|
|
37
|
+
showActionButtons: Boolean,
|
|
38
|
+
actionsLayout: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: function _default() {
|
|
41
|
+
return 'end';
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
tabIndex: Number,
|
|
45
|
+
accept: String,
|
|
46
|
+
groupedFiles: {
|
|
47
|
+
type: Object,
|
|
48
|
+
default: function _default() {
|
|
49
|
+
return {};
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
notFocusedIndex: Number,
|
|
53
|
+
list: [String, Function, Object],
|
|
54
|
+
id: String,
|
|
55
|
+
ariaLabelledBy: String,
|
|
56
|
+
ariaDescribedBy: String
|
|
57
|
+
},
|
|
58
|
+
// @ts-ignore
|
|
59
|
+
emits: {
|
|
60
|
+
'add': null,
|
|
61
|
+
'cancel': null,
|
|
62
|
+
'clear': null,
|
|
63
|
+
'upload': null,
|
|
64
|
+
'retry': null,
|
|
65
|
+
'remove': null
|
|
66
|
+
},
|
|
67
|
+
data: function data() {
|
|
68
|
+
return {
|
|
69
|
+
currentNavIndex: NOT_FOCUSED_INDEX
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
updated: function updated() {// const prevGroupLength = Object.keys(prevProps.groupedFiles).length;
|
|
73
|
+
// const groupLength = Object.keys(this.$props.groupedFiles).length;
|
|
74
|
+
// if (prevGroupLength > groupLength && this.navIndex > DEFAULT_INDEX) {
|
|
75
|
+
// this.navIndex = this.navIndex - (prevGroupLength - groupLength);
|
|
76
|
+
// }
|
|
77
|
+
},
|
|
78
|
+
methods: {
|
|
79
|
+
actionElement: function actionElement() {
|
|
80
|
+
if (this._uploadUI) {
|
|
81
|
+
return this._uploadUI.actionElement();
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
navIndex: function navIndex(_navIndex) {
|
|
85
|
+
if (_navIndex === undefined) {
|
|
86
|
+
return this.currentNavIndex;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
var prevNavIndex = this.navIndex;
|
|
90
|
+
this.currentNavIndex = _navIndex;
|
|
91
|
+
|
|
92
|
+
if (_navIndex !== prevNavIndex) {
|
|
93
|
+
this.$forceUpdate();
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
focus: function focus() {
|
|
97
|
+
if (this._uploadUI) {
|
|
98
|
+
this._uploadUI.focus();
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
onKeyDown: function onKeyDown(event, isRtl) {
|
|
102
|
+
var navIndex = this.navIndex();
|
|
103
|
+
var groupKeys = Object.keys(this.$props.groupedFiles);
|
|
104
|
+
var maxFileIndex = groupKeys.length - 1;
|
|
105
|
+
var maxNavIndex = this.$props.autoUpload || groupKeys.length === 0 ? maxFileIndex : maxFileIndex + 1;
|
|
106
|
+
var cancelButtonIndex = maxFileIndex + 1;
|
|
107
|
+
var uploadButtonIndex = cancelButtonIndex + 1;
|
|
108
|
+
var prevIndex = navIndex === NOT_FOCUSED_INDEX ? DEFAULT_INDEX : navIndex;
|
|
109
|
+
var nextIndex = navIndex;
|
|
110
|
+
|
|
111
|
+
switch (event.keyCode) {
|
|
112
|
+
case Keys.up:
|
|
113
|
+
event.preventDefault();
|
|
114
|
+
|
|
115
|
+
if (navIndex > -1) {
|
|
116
|
+
nextIndex = prevIndex - 1;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
break;
|
|
120
|
+
|
|
121
|
+
case Keys.down:
|
|
122
|
+
event.preventDefault();
|
|
123
|
+
|
|
124
|
+
if (navIndex < maxNavIndex) {
|
|
125
|
+
nextIndex = prevIndex + 1;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
break;
|
|
129
|
+
|
|
130
|
+
case Keys.left:
|
|
131
|
+
event.preventDefault();
|
|
132
|
+
|
|
133
|
+
if (isRtl) {
|
|
134
|
+
if (navIndex === cancelButtonIndex) {
|
|
135
|
+
nextIndex = prevIndex + 1;
|
|
136
|
+
}
|
|
137
|
+
} else {
|
|
138
|
+
if (navIndex === uploadButtonIndex) {
|
|
139
|
+
nextIndex = prevIndex - 1;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
break;
|
|
144
|
+
|
|
145
|
+
case Keys.right:
|
|
146
|
+
event.preventDefault();
|
|
147
|
+
|
|
148
|
+
if (isRtl) {
|
|
149
|
+
if (navIndex === uploadButtonIndex) {
|
|
150
|
+
nextIndex = prevIndex - 1;
|
|
151
|
+
}
|
|
152
|
+
} else {
|
|
153
|
+
if (navIndex === cancelButtonIndex) {
|
|
154
|
+
nextIndex = prevIndex + 1;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
break;
|
|
159
|
+
|
|
160
|
+
case Keys.enter:
|
|
161
|
+
if (navIndex === DEFAULT_INDEX || navIndex === NOT_FOCUSED_INDEX) {
|
|
162
|
+
if (this.actionElement()) {
|
|
163
|
+
this.actionElement().$el.click();
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (navIndex >= 0 && navIndex <= maxFileIndex) {
|
|
168
|
+
this.onRetry(groupKeys[navIndex]);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
break;
|
|
172
|
+
|
|
173
|
+
case Keys.space:
|
|
174
|
+
event.preventDefault();
|
|
175
|
+
|
|
176
|
+
if (navIndex === DEFAULT_INDEX || navIndex === NOT_FOCUSED_INDEX) {
|
|
177
|
+
if (this.actionElement()) {
|
|
178
|
+
this.actionElement().$el.click();
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
break;
|
|
183
|
+
|
|
184
|
+
case Keys.tab:
|
|
185
|
+
nextIndex = NOT_FOCUSED_INDEX;
|
|
186
|
+
break;
|
|
187
|
+
|
|
188
|
+
case Keys.delete:
|
|
189
|
+
if (navIndex >= 0 && navIndex <= maxFileIndex) {
|
|
190
|
+
nextIndex = prevIndex - 1;
|
|
191
|
+
this.onRemove(groupKeys[navIndex]);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
break;
|
|
195
|
+
|
|
196
|
+
case Keys.esc:
|
|
197
|
+
if (navIndex >= 0 && navIndex <= maxFileIndex) {
|
|
198
|
+
nextIndex = prevIndex - 1;
|
|
199
|
+
this.onCancel(groupKeys[navIndex]);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
break;
|
|
203
|
+
|
|
204
|
+
default:
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
this.navIndex(nextIndex);
|
|
208
|
+
},
|
|
209
|
+
onCancel: function onCancel(uid) {
|
|
210
|
+
this.$emit('cancel', uid);
|
|
211
|
+
},
|
|
212
|
+
onClear: function onClear() {
|
|
213
|
+
this.navIndex(DEFAULT_INDEX);
|
|
214
|
+
this.$emit('clear');
|
|
215
|
+
},
|
|
216
|
+
onUpload: function onUpload() {
|
|
217
|
+
this.navIndex(DEFAULT_INDEX);
|
|
218
|
+
this.$emit('upload');
|
|
219
|
+
},
|
|
220
|
+
onRetry: function onRetry(uid) {
|
|
221
|
+
this.$emit('retry', uid);
|
|
222
|
+
},
|
|
223
|
+
onRemove: function onRemove(uid) {
|
|
224
|
+
this.navIndex(this.navIndex() > DEFAULT_INDEX ? this.navIndex() - 1 : DEFAULT_INDEX);
|
|
225
|
+
this.$emit('remove', uid);
|
|
226
|
+
},
|
|
227
|
+
onAdd: function onAdd(files) {
|
|
228
|
+
this.navIndex(DEFAULT_INDEX);
|
|
229
|
+
this.$emit('add', files);
|
|
230
|
+
},
|
|
231
|
+
onClick: function onClick(navIndex) {
|
|
232
|
+
this.navIndex(navIndex);
|
|
233
|
+
},
|
|
234
|
+
onFocus: function onFocus() {
|
|
235
|
+
if (this._blurTimeout) {
|
|
236
|
+
clearTimeout(this._blurTimeout);
|
|
237
|
+
this._blurTimeout = undefined;
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
onBlurTimeout: function onBlurTimeout() {
|
|
241
|
+
this.navIndex(NOT_FOCUSED_INDEX);
|
|
242
|
+
this._blurTimeout = undefined;
|
|
243
|
+
},
|
|
244
|
+
onBlur: function onBlur() {
|
|
245
|
+
clearTimeout(this._blurTimeout);
|
|
246
|
+
this._blurTimeout = window.setTimeout(this.onBlurTimeout);
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
mounted: function mounted() {
|
|
250
|
+
this._uploadUI = this.v3 ? this.uploadUIRef : this.$refs.uploadUI;
|
|
251
|
+
},
|
|
252
|
+
// @ts-ignore
|
|
253
|
+
setup: !isV3 ? undefined : function () {
|
|
254
|
+
var v3 = !!isV3;
|
|
255
|
+
var uploadUIRef = ref(null);
|
|
256
|
+
return {
|
|
257
|
+
v3: v3,
|
|
258
|
+
uploadUIRef: uploadUIRef
|
|
259
|
+
};
|
|
260
|
+
},
|
|
261
|
+
render: function render(createElement) {
|
|
262
|
+
var _this = this;
|
|
263
|
+
|
|
264
|
+
var h = gh || createElement;
|
|
265
|
+
var _a = this.$props,
|
|
266
|
+
multiple = _a.multiple,
|
|
267
|
+
disabled = _a.disabled,
|
|
268
|
+
showFileList = _a.showFileList,
|
|
269
|
+
showActionButtons = _a.showActionButtons,
|
|
270
|
+
actionsLayout = _a.actionsLayout,
|
|
271
|
+
tabIndex = _a.tabIndex,
|
|
272
|
+
accept = _a.accept,
|
|
273
|
+
groupedFiles = _a.groupedFiles,
|
|
274
|
+
list = _a.list,
|
|
275
|
+
id = _a.id,
|
|
276
|
+
ariaLabelledBy = _a.ariaLabelledBy,
|
|
277
|
+
ariaDescribedBy = _a.ariaDescribedBy,
|
|
278
|
+
async = _a.async;
|
|
279
|
+
return (// @ts-ignore function children
|
|
280
|
+
h(UploadUI, {
|
|
281
|
+
ref: this.v3 ? function (el) {
|
|
282
|
+
_this.uploadUIRef = el;
|
|
283
|
+
} : 'uploadUI',
|
|
284
|
+
"class": this.$props.className,
|
|
285
|
+
onKeydown: this.onKeyDown,
|
|
286
|
+
on: this.v3 ? undefined : {
|
|
287
|
+
"keydown": this.onKeyDown,
|
|
288
|
+
"add": this.onAdd,
|
|
289
|
+
"clear": this.onClear,
|
|
290
|
+
"upload": this.onUpload,
|
|
291
|
+
"remove": this.onRemove,
|
|
292
|
+
"retry": this.onRetry,
|
|
293
|
+
"cancel": this.onCancel,
|
|
294
|
+
"click": this.onClick,
|
|
295
|
+
"focus": this.onFocus,
|
|
296
|
+
"blur": this.onBlur
|
|
297
|
+
},
|
|
298
|
+
navigationIndex: this.currentNavIndex,
|
|
299
|
+
attrs: this.v3 ? undefined : {
|
|
300
|
+
navigationIndex: this.currentNavIndex,
|
|
301
|
+
notFocusedIndex: NOT_FOCUSED_INDEX,
|
|
302
|
+
multiple: multiple,
|
|
303
|
+
disabled: disabled,
|
|
304
|
+
showFileList: showFileList,
|
|
305
|
+
showActionButtons: showActionButtons,
|
|
306
|
+
actionsLayout: actionsLayout,
|
|
307
|
+
tabIndex: tabIndex,
|
|
308
|
+
accept: accept,
|
|
309
|
+
groupedFiles: groupedFiles,
|
|
310
|
+
list: list,
|
|
311
|
+
id: id,
|
|
312
|
+
ariaLabelledBy: ariaLabelledBy,
|
|
313
|
+
ariaDescribedBy: ariaDescribedBy,
|
|
314
|
+
async: async
|
|
315
|
+
},
|
|
316
|
+
notFocusedIndex: NOT_FOCUSED_INDEX,
|
|
317
|
+
onAdd: this.onAdd,
|
|
318
|
+
onClear: this.onClear,
|
|
319
|
+
onUpload: this.onUpload,
|
|
320
|
+
onRemove: this.onRemove,
|
|
321
|
+
onRetry: this.onRetry,
|
|
322
|
+
onCancel: this.onCancel,
|
|
323
|
+
onClick: this.onClick,
|
|
324
|
+
onFocus: this.onFocus,
|
|
325
|
+
onBlur: this.onBlur,
|
|
326
|
+
multiple: multiple,
|
|
327
|
+
disabled: disabled,
|
|
328
|
+
showFileList: showFileList,
|
|
329
|
+
showActionButtons: showActionButtons,
|
|
330
|
+
actionsLayout: actionsLayout,
|
|
331
|
+
tabIndex: tabIndex,
|
|
332
|
+
accept: accept,
|
|
333
|
+
groupedFiles: groupedFiles,
|
|
334
|
+
list: list,
|
|
335
|
+
id: id,
|
|
336
|
+
ariaLabelledBy: ariaLabelledBy,
|
|
337
|
+
ariaDescribedBy: ariaDescribedBy,
|
|
338
|
+
async: async
|
|
339
|
+
})
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
/**
|
|
344
|
+
* @hidden
|
|
345
|
+
*/
|
|
346
|
+
|
|
347
|
+
var UploadNavigation = UploadNavigationVue2;
|
|
348
|
+
export { UploadNavigation, UploadNavigationVue2 };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { DefineComponent, RecordPropsDefinition, ComponentOptions, Vue2type } from './additionalTypes';
|
|
2
|
+
declare type DefaultData<V> = object | ((this: V) => {});
|
|
3
|
+
declare type DefaultMethods<V> = {
|
|
4
|
+
[key: string]: (this: V, ...args: any[]) => any;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* @hidden
|
|
8
|
+
*/
|
|
9
|
+
export interface UploadStatusProps {
|
|
10
|
+
isUploading: boolean;
|
|
11
|
+
isUploaded: boolean;
|
|
12
|
+
isUploadFailed: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @hidden
|
|
16
|
+
*/
|
|
17
|
+
export interface UploadStatusMethods {
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* @hidden
|
|
22
|
+
*/
|
|
23
|
+
export interface UploadStatusState {
|
|
24
|
+
v3: boolean;
|
|
25
|
+
_uploadUI: any;
|
|
26
|
+
_navIndex: number;
|
|
27
|
+
_blurTimeout: number | undefined;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @hidden
|
|
31
|
+
*/
|
|
32
|
+
export interface UploadStatusData {
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @hidden
|
|
36
|
+
*/
|
|
37
|
+
export interface UploadStatusComputed {
|
|
38
|
+
[key: string]: any;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @hidden
|
|
42
|
+
*/
|
|
43
|
+
export interface UploadStatusAll extends UploadStatusMethods, UploadStatusState, UploadStatusData, UploadStatusComputed, Vue2type {
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* @hidden
|
|
47
|
+
*/
|
|
48
|
+
declare let UploadStatusVue2: ComponentOptions<Vue2type, DefaultData<UploadStatusData>, DefaultMethods<UploadStatusAll>, UploadStatusComputed, RecordPropsDefinition<UploadStatusProps>>;
|
|
49
|
+
/**
|
|
50
|
+
* @hidden
|
|
51
|
+
*/
|
|
52
|
+
declare const UploadStatus: DefineComponent<UploadStatusProps, any, UploadStatusData, UploadStatusComputed, UploadStatusMethods, {}, {}, {}, string, UploadStatusProps, UploadStatusProps, {}>;
|
|
53
|
+
export { UploadStatus, UploadStatusVue2 };
|