@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,288 @@
|
|
|
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 { UploadAddButton } from './UploadAddButton.js';
|
|
10
|
+
import { provideLocalizationService } from '@progress/kendo-vue-intl';
|
|
11
|
+
import { messages, dropFilesHere } from './messages.js';
|
|
12
|
+
import utils from './utils/utils.js';
|
|
13
|
+
import { UploadStatus } from './UploadStatus.js';
|
|
14
|
+
/**
|
|
15
|
+
* @hidden
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
var TIME_TO_CHECK_DRAG = 100;
|
|
19
|
+
/**
|
|
20
|
+
* @hidden
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
var UploadDropZoneVue2 = {
|
|
24
|
+
name: 'KendoVueUploadDropZone',
|
|
25
|
+
props: {
|
|
26
|
+
addButtonIndex: Number,
|
|
27
|
+
async: Object,
|
|
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
|
+
navigationIndex: Number,
|
|
53
|
+
notFocusedIndex: Number,
|
|
54
|
+
list: [String, Function, Object],
|
|
55
|
+
id: String,
|
|
56
|
+
ariaLabelledBy: String,
|
|
57
|
+
ariaDescribedBy: String,
|
|
58
|
+
fileGroup: Object
|
|
59
|
+
},
|
|
60
|
+
// @ts-ignore
|
|
61
|
+
emits: {
|
|
62
|
+
'add': null,
|
|
63
|
+
'click': null
|
|
64
|
+
},
|
|
65
|
+
inject: {
|
|
66
|
+
kendoLocalizationService: {
|
|
67
|
+
default: null
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
data: function data() {
|
|
71
|
+
return {
|
|
72
|
+
currentDocumentActive: false,
|
|
73
|
+
currentElementActive: false
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
created: function created() {
|
|
77
|
+
this.currentElementActive = false;
|
|
78
|
+
},
|
|
79
|
+
mounted: function mounted() {
|
|
80
|
+
this.uploadAddButton = this.v3 ? this.uploadAddButtonRef : this.$refs.uploadAddButton;
|
|
81
|
+
document.addEventListener('dragenter', this.onDocumentDragEnter);
|
|
82
|
+
document.addEventListener('dragover', this.onDocumentDragOver);
|
|
83
|
+
},
|
|
84
|
+
destroyed: !!isV3 ? undefined : function () {
|
|
85
|
+
document.removeEventListener('dragenter', this.onDocumentDragEnter);
|
|
86
|
+
document.removeEventListener('dragover', this.onDocumentDragOver);
|
|
87
|
+
},
|
|
88
|
+
// @ts-ignore
|
|
89
|
+
unmounted: function unmounted() {
|
|
90
|
+
document.removeEventListener('dragenter', this.onDocumentDragEnter);
|
|
91
|
+
document.removeEventListener('dragover', this.onDocumentDragOver);
|
|
92
|
+
},
|
|
93
|
+
// @ts-ignore
|
|
94
|
+
setup: !isV3 ? undefined : function () {
|
|
95
|
+
var v3 = !!isV3;
|
|
96
|
+
var uploadAddButtonRef = ref(null);
|
|
97
|
+
var kendoLocalizationService = inject('kendoLocalizationService', {});
|
|
98
|
+
return {
|
|
99
|
+
v3: v3,
|
|
100
|
+
uploadAddButtonRef: uploadAddButtonRef,
|
|
101
|
+
kendoLocalizationService: kendoLocalizationService
|
|
102
|
+
};
|
|
103
|
+
},
|
|
104
|
+
computed: {
|
|
105
|
+
dropZoneClasses: function dropZoneClasses() {
|
|
106
|
+
return {
|
|
107
|
+
'k-dropzone': true,
|
|
108
|
+
'k-dropzone-active': this.currentDocumentActive,
|
|
109
|
+
'k-dropzone-hovered': this.currentElementActive
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
methods: {
|
|
114
|
+
actionElement: function actionElement() {
|
|
115
|
+
if (this.uploadAddButton) {
|
|
116
|
+
return this.uploadAddButton.uploadInput;
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
focus: function focus() {
|
|
120
|
+
if (this.uploadAddButton) {
|
|
121
|
+
return this.uploadAddButton.focus();
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
onDocumentDragEnter: function onDocumentDragEnter() {
|
|
125
|
+
var _this = this;
|
|
126
|
+
|
|
127
|
+
if (!this.currentDocumentActive) {
|
|
128
|
+
this.currentDocumentActive = true;
|
|
129
|
+
|
|
130
|
+
var documentInterval = function documentInterval() {
|
|
131
|
+
if (_this.isDragOver(_this._lastDocumentDragOver)) {
|
|
132
|
+
_this.currentDocumentActive = false;
|
|
133
|
+
clearInterval(_this._documentInterval);
|
|
134
|
+
_this._documentInterval = null;
|
|
135
|
+
_this._lastDocumentDragOver = null;
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
this._documentInterval = setInterval(documentInterval, TIME_TO_CHECK_DRAG);
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
onDocumentDragOver: function onDocumentDragOver() {
|
|
143
|
+
this._lastDocumentDragOver = new Date();
|
|
144
|
+
},
|
|
145
|
+
onElementDragEnter: function onElementDragEnter() {
|
|
146
|
+
var _this = this;
|
|
147
|
+
|
|
148
|
+
if (!this.currentElementActive) {
|
|
149
|
+
this.currentElementActive = true;
|
|
150
|
+
|
|
151
|
+
var elementInterval = function elementInterval() {
|
|
152
|
+
if (_this.isDragOver(_this._lastElementDragOver)) {
|
|
153
|
+
_this.currentElementActive = false;
|
|
154
|
+
clearInterval(_this._elementInterval);
|
|
155
|
+
_this._elementInterval = null;
|
|
156
|
+
_this._lastElementDragOver = null;
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
this._elementInterval = setInterval(elementInterval, TIME_TO_CHECK_DRAG);
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
onElementDragOver: function onElementDragOver(event) {
|
|
164
|
+
event.preventDefault();
|
|
165
|
+
this._lastElementDragOver = new Date();
|
|
166
|
+
},
|
|
167
|
+
onDrop: function onDrop(event) {
|
|
168
|
+
event.preventDefault();
|
|
169
|
+
var droppedFiles = event.dataTransfer.files;
|
|
170
|
+
|
|
171
|
+
if (droppedFiles.length > 0 && !this.$props.disabled) {
|
|
172
|
+
this.$emit('add', droppedFiles);
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
isDragOver: function isDragOver(prevDate) {
|
|
176
|
+
return new Date().getTime() - (prevDate || new Date()).getTime() > TIME_TO_CHECK_DRAG;
|
|
177
|
+
},
|
|
178
|
+
onClick: function onClick(eventIndex) {
|
|
179
|
+
this.$emit('click', eventIndex);
|
|
180
|
+
},
|
|
181
|
+
onAdd: function onAdd(files) {
|
|
182
|
+
this.$emit('add', files);
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
render: function render(createElement) {
|
|
186
|
+
var h = gh || createElement;
|
|
187
|
+
var _a = this.$props,
|
|
188
|
+
multiple = _a.multiple,
|
|
189
|
+
disabled = _a.disabled,
|
|
190
|
+
tabIndex = _a.tabIndex,
|
|
191
|
+
fileGroup = _a.fileGroup,
|
|
192
|
+
accept = _a.accept,
|
|
193
|
+
showFileList = _a.showFileList,
|
|
194
|
+
groupedFiles = _a.groupedFiles,
|
|
195
|
+
navigationIndex = _a.navigationIndex,
|
|
196
|
+
showActionButtons = _a.showActionButtons,
|
|
197
|
+
actionsLayout = _a.actionsLayout,
|
|
198
|
+
notFocusedIndex = _a.notFocusedIndex,
|
|
199
|
+
list = _a.list,
|
|
200
|
+
id = _a.id,
|
|
201
|
+
ariaLabelledBy = _a.ariaLabelledBy,
|
|
202
|
+
ariaDescribedBy = _a.ariaDescribedBy;
|
|
203
|
+
var localizationService = provideLocalizationService(this);
|
|
204
|
+
var dropFilesMessage = localizationService.toLanguageString(dropFilesHere, messages[dropFilesHere]);
|
|
205
|
+
|
|
206
|
+
var _b = utils.getFileStatus(fileGroup),
|
|
207
|
+
isUploading = _b[0],
|
|
208
|
+
isUploaded = _b[1],
|
|
209
|
+
isUploadFailed = _b[2],
|
|
210
|
+
isUploadValidationFailed = _b[3];
|
|
211
|
+
|
|
212
|
+
var dropZoneClassName = classNames('k-dropzone-hint', {// Unsure about that, since it hides the "Drop Files Message" when we remove all uploaded components.
|
|
213
|
+
// 'k-hidden': this.isDragged && !this.elementActive
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
var addButtonComponent = function addButtonComponent() {
|
|
217
|
+
var _this = this;
|
|
218
|
+
|
|
219
|
+
return (// @ts-ignore function children
|
|
220
|
+
h(UploadAddButton, {
|
|
221
|
+
id: id,
|
|
222
|
+
attrs: this.v3 ? undefined : {
|
|
223
|
+
id: id,
|
|
224
|
+
ariaLabelledBy: ariaLabelledBy,
|
|
225
|
+
ariaDescribedBy: ariaDescribedBy,
|
|
226
|
+
accept: accept,
|
|
227
|
+
async: this.async,
|
|
228
|
+
addButtonIndex: this.addButtonIndex,
|
|
229
|
+
navigationIndex: navigationIndex,
|
|
230
|
+
notFocusedIndex: notFocusedIndex,
|
|
231
|
+
tabIndex: tabIndex,
|
|
232
|
+
multiple: multiple,
|
|
233
|
+
disabled: disabled
|
|
234
|
+
},
|
|
235
|
+
ariaLabelledBy: ariaLabelledBy,
|
|
236
|
+
ariaDescribedBy: ariaDescribedBy,
|
|
237
|
+
ref: this.v3 ? function (el) {
|
|
238
|
+
_this.uploadAddButtonRef = el;
|
|
239
|
+
} : 'uploadAddButton',
|
|
240
|
+
accept: accept,
|
|
241
|
+
async: this.async,
|
|
242
|
+
addButtonIndex: this.addButtonIndex,
|
|
243
|
+
navigationIndex: navigationIndex,
|
|
244
|
+
notFocusedIndex: notFocusedIndex,
|
|
245
|
+
tabIndex: tabIndex,
|
|
246
|
+
multiple: multiple,
|
|
247
|
+
disabled: disabled,
|
|
248
|
+
onClick: this.onClick,
|
|
249
|
+
on: this.v3 ? undefined : {
|
|
250
|
+
"click": this.onClick,
|
|
251
|
+
"add": this.onAdd
|
|
252
|
+
},
|
|
253
|
+
onAdd: this.onAdd
|
|
254
|
+
})
|
|
255
|
+
);
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
return h("div", {
|
|
259
|
+
"class": this.dropZoneClasses,
|
|
260
|
+
onDrop: this.onDrop,
|
|
261
|
+
on: this.v3 ? undefined : {
|
|
262
|
+
"drop": this.onDrop,
|
|
263
|
+
"dragenter": this.onElementDragEnter,
|
|
264
|
+
"dragover": this.onElementDragOver
|
|
265
|
+
},
|
|
266
|
+
onDragenter: this.onElementDragEnter,
|
|
267
|
+
onDragover: this.onElementDragOver
|
|
268
|
+
}, [addButtonComponent.call(this), isUploading || isUploaded || isUploadFailed || isUploadValidationFailed ? // @ts-ignore function children
|
|
269
|
+
h(UploadStatus, {
|
|
270
|
+
isUploading: isUploading,
|
|
271
|
+
attrs: this.v3 ? undefined : {
|
|
272
|
+
isUploading: isUploading,
|
|
273
|
+
isUploaded: isUploaded,
|
|
274
|
+
isUploadFailed: isUploadFailed
|
|
275
|
+
},
|
|
276
|
+
isUploaded: isUploaded,
|
|
277
|
+
isUploadFailed: isUploadFailed
|
|
278
|
+
}) : h("div", {
|
|
279
|
+
"class": dropZoneClassName
|
|
280
|
+
}, [dropFilesMessage])]);
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
/**
|
|
284
|
+
* @hidden
|
|
285
|
+
*/
|
|
286
|
+
|
|
287
|
+
var UploadDropZone = UploadDropZoneVue2;
|
|
288
|
+
export { UploadDropZone, UploadDropZoneVue2 };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { DefineComponent, RecordPropsDefinition, ComponentOptions, Vue2type } from './additionalTypes';
|
|
2
|
+
declare type DefaultData<V> = object | ((this: V) => UploadInputData);
|
|
3
|
+
declare type DefaultMethods<V> = {
|
|
4
|
+
[key: string]: (this: V, ...args: any[]) => any;
|
|
5
|
+
};
|
|
6
|
+
import { UploadAsyncProps } from './interfaces/UploadAsyncProps';
|
|
7
|
+
/**
|
|
8
|
+
* @hidden
|
|
9
|
+
*/
|
|
10
|
+
export interface UploadInputProps {
|
|
11
|
+
async: UploadAsyncProps;
|
|
12
|
+
multiple?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
accept?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @hidden
|
|
18
|
+
*/
|
|
19
|
+
export interface UploadInputMethods {
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
focus: () => any;
|
|
22
|
+
onClick: () => any;
|
|
23
|
+
actionElement: () => any;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @hidden
|
|
27
|
+
*/
|
|
28
|
+
export interface UploadInputState {
|
|
29
|
+
v3: boolean;
|
|
30
|
+
_input: HTMLInputElement | null;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @hidden
|
|
34
|
+
*/
|
|
35
|
+
export interface UploadInputData {
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @hidden
|
|
39
|
+
*/
|
|
40
|
+
export interface UploadInputComputed {
|
|
41
|
+
[key: string]: any;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* @hidden
|
|
45
|
+
*/
|
|
46
|
+
export interface UploadInputAll extends UploadInputMethods, UploadInputState, UploadInputData, UploadInputComputed, Vue2type {
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* @hidden
|
|
50
|
+
*/
|
|
51
|
+
declare let UploadInputVue2: ComponentOptions<Vue2type, DefaultData<UploadInputData>, DefaultMethods<UploadInputAll>, UploadInputComputed, RecordPropsDefinition<UploadInputProps>>;
|
|
52
|
+
/**
|
|
53
|
+
* @hidden
|
|
54
|
+
*/
|
|
55
|
+
declare const UploadInput: DefineComponent<UploadInputProps, any, UploadInputData, UploadInputComputed, UploadInputMethods, {}, {}, {}, string, UploadInputProps, UploadInputProps, {}>;
|
|
56
|
+
export { UploadInput, UploadInputVue2 };
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import { setRef } from '@progress/kendo-vue-common';
|
|
3
|
+
import * as Vue from 'vue';
|
|
4
|
+
var allVue = Vue;
|
|
5
|
+
var gh = allVue.h;
|
|
6
|
+
var isV3 = allVue.version && allVue.version[0] === '3';
|
|
7
|
+
var ref = allVue.ref;
|
|
8
|
+
var CHROME_REGEX = /(chrome)[ \/]([\w.]+)/i;
|
|
9
|
+
var SAFARI_REGEX = /(webkit)[ \/]([\w.]+)/i;
|
|
10
|
+
/**
|
|
11
|
+
* @hidden
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
var UploadInputVue2 = {
|
|
15
|
+
name: 'KendoVueUploadInput',
|
|
16
|
+
props: {
|
|
17
|
+
async: Object,
|
|
18
|
+
multiple: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: undefined
|
|
21
|
+
},
|
|
22
|
+
disabled: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: undefined
|
|
25
|
+
},
|
|
26
|
+
accept: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: undefined
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
// @ts-ignore
|
|
32
|
+
emits: {
|
|
33
|
+
'mousedown': null,
|
|
34
|
+
'add': null
|
|
35
|
+
},
|
|
36
|
+
mounted: function mounted() {
|
|
37
|
+
this._input = this.v3 ? this.inputRef : this.$refs.input;
|
|
38
|
+
},
|
|
39
|
+
methods: {
|
|
40
|
+
onMouseDown: function onMouseDown(e) {
|
|
41
|
+
this.$emit('mousedown', e);
|
|
42
|
+
},
|
|
43
|
+
onAdd: function onAdd() {
|
|
44
|
+
var ua = navigator.userAgent;
|
|
45
|
+
var input = this._input;
|
|
46
|
+
|
|
47
|
+
if (input) {
|
|
48
|
+
if (input.files) {
|
|
49
|
+
this.$emit('add', input.files);
|
|
50
|
+
}
|
|
51
|
+
/*
|
|
52
|
+
Chrome and Internet Explorer do not trigger a `change` event
|
|
53
|
+
when a file with the same name is selected a number of consecutive times.
|
|
54
|
+
As a workaround, clear the input value after handling the file.
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
if (!(!ua.match(CHROME_REGEX) && ua.match(SAFARI_REGEX))) {
|
|
59
|
+
input.type = '';
|
|
60
|
+
input.type = 'file';
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
actionElement: function actionElement() {
|
|
65
|
+
return this._input;
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
// @ts-ignore
|
|
69
|
+
setup: !isV3 ? undefined : function () {
|
|
70
|
+
var v3 = !!isV3;
|
|
71
|
+
var inputRef = ref(null);
|
|
72
|
+
return {
|
|
73
|
+
v3: v3,
|
|
74
|
+
inputRef: inputRef
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
render: function render(createElement) {
|
|
78
|
+
var h = gh || createElement;
|
|
79
|
+
var _a = this.$props,
|
|
80
|
+
multiple = _a.multiple,
|
|
81
|
+
async = _a.async,
|
|
82
|
+
disabled = _a.disabled,
|
|
83
|
+
accept = _a.accept;
|
|
84
|
+
return h("input", {
|
|
85
|
+
ref: setRef(this, 'input'),
|
|
86
|
+
autocomplete: 'off',
|
|
87
|
+
attrs: this.v3 ? undefined : {
|
|
88
|
+
autocomplete: 'off',
|
|
89
|
+
name: async.saveField,
|
|
90
|
+
accept: accept,
|
|
91
|
+
type: 'file',
|
|
92
|
+
tabindex: -1,
|
|
93
|
+
multiple: multiple,
|
|
94
|
+
disabled: disabled
|
|
95
|
+
},
|
|
96
|
+
name: async.saveField,
|
|
97
|
+
accept: accept,
|
|
98
|
+
type: 'file',
|
|
99
|
+
tabindex: -1,
|
|
100
|
+
multiple: multiple,
|
|
101
|
+
disabled: disabled,
|
|
102
|
+
onChange: this.onAdd,
|
|
103
|
+
on: this.v3 ? undefined : {
|
|
104
|
+
"change": this.onAdd,
|
|
105
|
+
"mousedown": this.onMouseDown
|
|
106
|
+
},
|
|
107
|
+
onMousedown: this.onMouseDown
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* @hidden
|
|
113
|
+
*/
|
|
114
|
+
|
|
115
|
+
var UploadInput = UploadInputVue2;
|
|
116
|
+
export { UploadInput, UploadInputVue2 };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { DefineComponent, RecordPropsDefinition, ComponentOptions, Vue2type } from './additionalTypes';
|
|
2
|
+
declare type DefaultData<V> = object | ((this: V) => UploadListData);
|
|
3
|
+
declare type DefaultMethods<V> = {
|
|
4
|
+
[key: string]: (this: V, ...args: any[]) => any;
|
|
5
|
+
};
|
|
6
|
+
import { GroupedFiles } from './interfaces/FileGroup';
|
|
7
|
+
import { UploadAsyncProps } from './interfaces/UploadAsyncProps';
|
|
8
|
+
/**
|
|
9
|
+
* @hidden
|
|
10
|
+
*/
|
|
11
|
+
export interface UploadListProps {
|
|
12
|
+
groupedFiles: GroupedFiles;
|
|
13
|
+
async: UploadAsyncProps;
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
navigationIndex?: number;
|
|
16
|
+
list?: any;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @hidden
|
|
20
|
+
*/
|
|
21
|
+
export interface UploadListMethods {
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
onRetry: (uid: string) => void;
|
|
24
|
+
onRemove: (uid: string) => void;
|
|
25
|
+
onCancel: (uid: string) => void;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @hidden
|
|
29
|
+
*/
|
|
30
|
+
export interface UploadListState {
|
|
31
|
+
v3: boolean;
|
|
32
|
+
_input: HTMLInputElement | null;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @hidden
|
|
36
|
+
*/
|
|
37
|
+
export interface UploadListData {
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* @hidden
|
|
41
|
+
*/
|
|
42
|
+
export interface UploadListComputed {
|
|
43
|
+
[key: string]: any;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* @hidden
|
|
47
|
+
*/
|
|
48
|
+
export interface UploadListAll extends UploadListMethods, UploadListState, UploadListData, UploadListComputed, Vue2type {
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* @hidden
|
|
52
|
+
*/
|
|
53
|
+
declare let UploadListVue2: ComponentOptions<Vue2type, DefaultData<UploadListData>, DefaultMethods<UploadListAll>, UploadListComputed, RecordPropsDefinition<UploadListProps>>;
|
|
54
|
+
/**
|
|
55
|
+
* @hidden
|
|
56
|
+
*/
|
|
57
|
+
declare const UploadList: DefineComponent<UploadListProps, any, UploadListData, UploadListComputed, UploadListMethods, {}, {}, {}, string, UploadListProps, UploadListProps, {}>;
|
|
58
|
+
export { UploadList, UploadListVue2 };
|
|
@@ -0,0 +1,103 @@
|
|
|
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 { classNames } from '@progress/kendo-vue-common';
|
|
8
|
+
import { UploadListGroup } from './UploadListGroup.js';
|
|
9
|
+
/**
|
|
10
|
+
* @hidden
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
var UploadListVue2 = {
|
|
14
|
+
name: 'KendoVueUploadList',
|
|
15
|
+
props: {
|
|
16
|
+
groupedFiles: Object,
|
|
17
|
+
async: Object,
|
|
18
|
+
disabled: Boolean,
|
|
19
|
+
navigationIndex: {
|
|
20
|
+
type: Number,
|
|
21
|
+
default: undefined
|
|
22
|
+
},
|
|
23
|
+
list: [String, Function, Object]
|
|
24
|
+
},
|
|
25
|
+
// @ts-ignore
|
|
26
|
+
emits: {
|
|
27
|
+
'cancel': null,
|
|
28
|
+
'click': null,
|
|
29
|
+
'retry': null,
|
|
30
|
+
'remove': null
|
|
31
|
+
},
|
|
32
|
+
methods: {
|
|
33
|
+
onClick: function onClick(navIndex) {
|
|
34
|
+
this.$emit('click', navIndex);
|
|
35
|
+
},
|
|
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
|
+
},
|
|
46
|
+
// @ts-ignore
|
|
47
|
+
setup: !isV3 ? undefined : function () {
|
|
48
|
+
var v3 = !!isV3;
|
|
49
|
+
return {
|
|
50
|
+
v3: v3
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
render: function render(createElement) {
|
|
54
|
+
var h = gh || createElement;
|
|
55
|
+
var _a = this.$props,
|
|
56
|
+
groupedFiles = _a.groupedFiles,
|
|
57
|
+
navigationIndex = _a.navigationIndex,
|
|
58
|
+
async = _a.async,
|
|
59
|
+
disabled = _a.disabled,
|
|
60
|
+
list = _a.list;
|
|
61
|
+
var ulClassName = classNames('k-upload-files', 'k-reset');
|
|
62
|
+
return h("ul", {
|
|
63
|
+
"class": ulClassName
|
|
64
|
+
}, [Object.keys(groupedFiles).map(function (key, index) {
|
|
65
|
+
var files = groupedFiles[key];
|
|
66
|
+
return (// @ts-ignore function children
|
|
67
|
+
h(UploadListGroup, {
|
|
68
|
+
key: key,
|
|
69
|
+
files: files,
|
|
70
|
+
attrs: this.v3 ? undefined : {
|
|
71
|
+
files: files,
|
|
72
|
+
index: index,
|
|
73
|
+
navigationIndex: navigationIndex,
|
|
74
|
+
async: async,
|
|
75
|
+
disabled: disabled,
|
|
76
|
+
list: list
|
|
77
|
+
},
|
|
78
|
+
index: index,
|
|
79
|
+
navigationIndex: navigationIndex,
|
|
80
|
+
async: async,
|
|
81
|
+
disabled: disabled,
|
|
82
|
+
list: list,
|
|
83
|
+
onCancel: this.onCancel,
|
|
84
|
+
on: this.v3 ? undefined : {
|
|
85
|
+
"cancel": this.onCancel,
|
|
86
|
+
"click": this.onClick,
|
|
87
|
+
"remove": this.onRemove,
|
|
88
|
+
"retry": this.onRetry
|
|
89
|
+
},
|
|
90
|
+
onClick: this.onClick,
|
|
91
|
+
onRemove: this.onRemove,
|
|
92
|
+
onRetry: this.onRetry
|
|
93
|
+
})
|
|
94
|
+
);
|
|
95
|
+
}, this)]);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* @hidden
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
var UploadList = UploadListVue2;
|
|
103
|
+
export { UploadList, UploadListVue2 };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { DefineComponent, RecordPropsDefinition, ComponentOptions, Vue2type } from './additionalTypes';
|
|
2
|
+
declare type DefaultData<V> = object | ((this: V) => UploadListActionButtonData);
|
|
3
|
+
declare type DefaultMethods<V> = {
|
|
4
|
+
[key: string]: (this: V, ...args: any[]) => any;
|
|
5
|
+
};
|
|
6
|
+
import { UploadAsyncProps } from './interfaces/UploadAsyncProps';
|
|
7
|
+
import { UploadFileStatus } from './interfaces/UploadFileStatus';
|
|
8
|
+
/**
|
|
9
|
+
* @hidden
|
|
10
|
+
*/
|
|
11
|
+
export interface UploadListActionButtonProps {
|
|
12
|
+
progress: number;
|
|
13
|
+
uid: string;
|
|
14
|
+
status: UploadFileStatus;
|
|
15
|
+
async: UploadAsyncProps;
|
|
16
|
+
disabled: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @hidden
|
|
20
|
+
*/
|
|
21
|
+
export interface UploadListActionButtonMethods {
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @hidden
|
|
26
|
+
*/
|
|
27
|
+
export interface UploadListActionButtonState {
|
|
28
|
+
v3: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @hidden
|
|
32
|
+
*/
|
|
33
|
+
export interface UploadListActionButtonData {
|
|
34
|
+
retryFocused: boolean;
|
|
35
|
+
actionFocused: boolean;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @hidden
|
|
39
|
+
*/
|
|
40
|
+
export interface UploadListActionButtonComputed {
|
|
41
|
+
[key: string]: any;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* @hidden
|
|
45
|
+
*/
|
|
46
|
+
export interface UploadListActionButtonAll extends UploadListActionButtonMethods, UploadListActionButtonState, UploadListActionButtonData, UploadListActionButtonComputed, Vue2type {
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* @hidden
|
|
50
|
+
*/
|
|
51
|
+
declare let UploadListActionButtonVue2: ComponentOptions<Vue2type, DefaultData<UploadListActionButtonData>, DefaultMethods<UploadListActionButtonAll>, UploadListActionButtonComputed, RecordPropsDefinition<UploadListActionButtonProps>>;
|
|
52
|
+
/**
|
|
53
|
+
* @hidden
|
|
54
|
+
*/
|
|
55
|
+
declare const UploadListActionButton: DefineComponent<UploadListActionButtonProps, any, UploadListActionButtonData, UploadListActionButtonComputed, UploadListActionButtonMethods, {}, {}, {}, string, UploadListActionButtonProps, UploadListActionButtonProps, {}>;
|
|
56
|
+
export { UploadListActionButton, UploadListActionButtonVue2 };
|