@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,63 @@
|
|
|
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, headerStatusUploading, headerStatusUploaded } from './messages.js';
|
|
11
|
+
/**
|
|
12
|
+
* @hidden
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
var UploadStatusVue2 = {
|
|
16
|
+
props: {
|
|
17
|
+
isUploading: Boolean,
|
|
18
|
+
isUploaded: Boolean,
|
|
19
|
+
isUploadFailed: Boolean
|
|
20
|
+
},
|
|
21
|
+
inject: {
|
|
22
|
+
kendoLocalizationService: {
|
|
23
|
+
default: null
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
setup: !isV3 ? undefined : function () {
|
|
28
|
+
var v3 = !!isV3;
|
|
29
|
+
var kendoLocalizationService = inject('kendoLocalizationService', {});
|
|
30
|
+
return {
|
|
31
|
+
v3: v3,
|
|
32
|
+
kendoLocalizationService: kendoLocalizationService
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
render: function render(createElement) {
|
|
36
|
+
var h = gh || createElement;
|
|
37
|
+
var _a = this.$props,
|
|
38
|
+
isUploading = _a.isUploading,
|
|
39
|
+
isUploaded = _a.isUploaded,
|
|
40
|
+
isUploadFailed = _a.isUploadFailed;
|
|
41
|
+
var statusClassName = classNames(!isUploading && !isUploadFailed && isUploaded ? 'k-i-checkmark' : '', !isUploading && isUploadFailed ? 'k-i-exception' : '', isUploading ? 'k-i-loading' : '', 'k-icon');
|
|
42
|
+
var statusText = '';
|
|
43
|
+
var localizationService = provideLocalizationService(this);
|
|
44
|
+
|
|
45
|
+
if (isUploading) {
|
|
46
|
+
statusText = localizationService.toLanguageString(headerStatusUploading, messages[headerStatusUploading]);
|
|
47
|
+
} else if (isUploaded || isUploadFailed) {
|
|
48
|
+
statusText = localizationService.toLanguageString(headerStatusUploaded, messages[headerStatusUploaded]);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return h("div", {
|
|
52
|
+
"class": classNames('k-upload-status', 'k-upload-status-total')
|
|
53
|
+
}, [h("span", {
|
|
54
|
+
"class": statusClassName
|
|
55
|
+
}), statusText]);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* @hidden
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
var UploadStatus = UploadStatusVue2;
|
|
63
|
+
export { UploadStatus, UploadStatusVue2 };
|
|
@@ -0,0 +1,81 @@
|
|
|
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 { GroupedFiles } from './interfaces/FileGroup';
|
|
7
|
+
import { UploadAsyncProps } from './interfaces/UploadAsyncProps';
|
|
8
|
+
/**
|
|
9
|
+
* @hidden
|
|
10
|
+
*/
|
|
11
|
+
export interface UploadUIProps extends UploadAsyncProps {
|
|
12
|
+
className?: string;
|
|
13
|
+
multiple?: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
showFileList?: boolean;
|
|
16
|
+
showActionButtons?: boolean;
|
|
17
|
+
actionsLayout?: string;
|
|
18
|
+
tabIndex?: number;
|
|
19
|
+
accept?: string;
|
|
20
|
+
groupedFiles: GroupedFiles;
|
|
21
|
+
navigationIndex?: number;
|
|
22
|
+
notFocusedIndex?: number;
|
|
23
|
+
list?: any;
|
|
24
|
+
id?: string;
|
|
25
|
+
ariaLabelledBy?: string;
|
|
26
|
+
ariaDescribedBy?: string;
|
|
27
|
+
async?: Object;
|
|
28
|
+
addButtonIndex?: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @hidden
|
|
32
|
+
*/
|
|
33
|
+
export interface UploadUIMethods {
|
|
34
|
+
[key: string]: any;
|
|
35
|
+
onAdd?: (files: FileList) => void;
|
|
36
|
+
onCancel?: (uid: string) => void;
|
|
37
|
+
onRemove?: (uid: string) => void;
|
|
38
|
+
onRetry?: (uid: string) => void;
|
|
39
|
+
onUpload?: () => void;
|
|
40
|
+
onClear?: () => void;
|
|
41
|
+
onFocus?: (event: any) => void;
|
|
42
|
+
onBlur?: (event: any) => void;
|
|
43
|
+
onKeyDown?: (event: KeyboardEvent, isRtl?: boolean) => void;
|
|
44
|
+
onClick?: (navIndex: number | undefined) => void;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* @hidden
|
|
48
|
+
*/
|
|
49
|
+
export interface UploadUIState {
|
|
50
|
+
v3: boolean;
|
|
51
|
+
_container: HTMLDivElement | null;
|
|
52
|
+
_uploadAddButton: any | null;
|
|
53
|
+
_uploadUI: any;
|
|
54
|
+
_navIndex: number;
|
|
55
|
+
_blurTimeout: number | undefined;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* @hidden
|
|
59
|
+
*/
|
|
60
|
+
export interface UploadUIData {
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* @hidden
|
|
64
|
+
*/
|
|
65
|
+
export interface UploadUIComputed {
|
|
66
|
+
[key: string]: any;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @hidden
|
|
70
|
+
*/
|
|
71
|
+
export interface UploadUIAll extends UploadUIMethods, UploadUIState, UploadUIData, UploadUIComputed, Vue2type {
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* @hidden
|
|
75
|
+
*/
|
|
76
|
+
declare let UploadUIVue2: ComponentOptions<Vue2type, DefaultData<UploadUIData>, DefaultMethods<UploadUIAll>, UploadUIComputed, RecordPropsDefinition<UploadUIProps>>;
|
|
77
|
+
/**
|
|
78
|
+
* @hidden
|
|
79
|
+
*/
|
|
80
|
+
declare const UploadUI: DefineComponent<UploadUIProps, any, UploadUIData, UploadUIComputed, UploadUIMethods, {}, {}, {}, string, UploadUIProps, UploadUIProps, {}>;
|
|
81
|
+
export { UploadUI, UploadUIVue2 };
|
|
@@ -0,0 +1,265 @@
|
|
|
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, setRef } from '@progress/kendo-vue-common';
|
|
8
|
+
import { UploadList } from './UploadList.js';
|
|
9
|
+
import { UploadActionButtons } from './UploadActionButtons.js';
|
|
10
|
+
import { UploadDropZone } from './UploadDropZone.js';
|
|
11
|
+
var ADD_BUTTON_NAV_INDEX = -1;
|
|
12
|
+
/**
|
|
13
|
+
* @hidden
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
var UploadUIVue2 = {
|
|
17
|
+
name: 'KendoVueUploadUI',
|
|
18
|
+
props: {
|
|
19
|
+
async: Object,
|
|
20
|
+
className: String,
|
|
21
|
+
multiple: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: true
|
|
24
|
+
},
|
|
25
|
+
disabled: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: false
|
|
28
|
+
},
|
|
29
|
+
showFileList: Boolean,
|
|
30
|
+
showActionButtons: Boolean,
|
|
31
|
+
actionsLayout: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: function _default() {
|
|
34
|
+
return 'end';
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
tabIndex: Number,
|
|
38
|
+
accept: String,
|
|
39
|
+
groupedFiles: {
|
|
40
|
+
type: Object,
|
|
41
|
+
default: function _default() {
|
|
42
|
+
return {};
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
navigationIndex: Number,
|
|
46
|
+
notFocusedIndex: Number,
|
|
47
|
+
list: [String, Function, Object],
|
|
48
|
+
id: String,
|
|
49
|
+
ariaLabelledBy: String,
|
|
50
|
+
ariaDescribedBy: String
|
|
51
|
+
},
|
|
52
|
+
computed: {
|
|
53
|
+
groupsCount: function groupsCount() {
|
|
54
|
+
return Object.keys(this.$props.groupedFiles).length;
|
|
55
|
+
},
|
|
56
|
+
lastGroupIndex: function lastGroupIndex() {
|
|
57
|
+
return this.groupsCount - 1;
|
|
58
|
+
},
|
|
59
|
+
addButtonIndex: function addButtonIndex() {
|
|
60
|
+
return ADD_BUTTON_NAV_INDEX;
|
|
61
|
+
},
|
|
62
|
+
clearButtonIndex: function clearButtonIndex() {
|
|
63
|
+
return this.lastGroupIndex + 1;
|
|
64
|
+
},
|
|
65
|
+
uploadButtonIndex: function uploadButtonIndex() {
|
|
66
|
+
return this.lastGroupIndex + 2;
|
|
67
|
+
},
|
|
68
|
+
isRtl: function isRtl() {
|
|
69
|
+
return this._container && getComputedStyle(this._container).direction === 'rtl' || false;
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
methods: {
|
|
73
|
+
actionElement: function actionElement() {
|
|
74
|
+
if (this.uploadDropZone) {
|
|
75
|
+
return this.uploadDropZone.actionElement();
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
focus: function focus() {
|
|
79
|
+
if (this.uploadDropZone) {
|
|
80
|
+
return this.uploadDropZone.focus();
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
onAdd: function onAdd(files) {
|
|
84
|
+
this.$emit('add', files);
|
|
85
|
+
},
|
|
86
|
+
onRetry: function onRetry(uid) {
|
|
87
|
+
this.$emit('retry', uid);
|
|
88
|
+
},
|
|
89
|
+
onCancel: function onCancel(uid) {
|
|
90
|
+
this.$emit('cancel', uid);
|
|
91
|
+
},
|
|
92
|
+
onClear: function onClear() {
|
|
93
|
+
this.$emit('clear');
|
|
94
|
+
},
|
|
95
|
+
onUpload: function onUpload() {
|
|
96
|
+
this.$emit('upload');
|
|
97
|
+
},
|
|
98
|
+
onRemove: function onRemove(uid) {
|
|
99
|
+
this.$emit('remove', uid);
|
|
100
|
+
},
|
|
101
|
+
onKeyDown: function onKeyDown(event) {
|
|
102
|
+
this.$emit('keydown', event, this.isRtl);
|
|
103
|
+
},
|
|
104
|
+
onFocus: function onFocus(event) {
|
|
105
|
+
this.$emit('focus', event);
|
|
106
|
+
},
|
|
107
|
+
onBlur: function onBlur(event) {
|
|
108
|
+
this.$emit('blur', event);
|
|
109
|
+
},
|
|
110
|
+
onClick: function onClick(navIndex) {
|
|
111
|
+
this.$emit('click', navIndex);
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
// @ts-ignore
|
|
115
|
+
emits: {
|
|
116
|
+
'add': null,
|
|
117
|
+
'retry': null,
|
|
118
|
+
'cancel': null,
|
|
119
|
+
'clear': null,
|
|
120
|
+
'upload': null,
|
|
121
|
+
'remove': null,
|
|
122
|
+
'keydown': null,
|
|
123
|
+
'click': null,
|
|
124
|
+
'focus': null,
|
|
125
|
+
'blur': null
|
|
126
|
+
},
|
|
127
|
+
mounted: function mounted() {
|
|
128
|
+
this._container = this.v3 ? this.containerRef : this.$refs.container;
|
|
129
|
+
this.uploadDropZone = this.v3 ? this.uploadDropZoneRef : this.$refs.uploadDropZone;
|
|
130
|
+
},
|
|
131
|
+
// @ts-ignore
|
|
132
|
+
setup: !isV3 ? undefined : function () {
|
|
133
|
+
var v3 = !!isV3;
|
|
134
|
+
var containerRef = ref(null);
|
|
135
|
+
var uploadDropZoneRef = ref(null);
|
|
136
|
+
return {
|
|
137
|
+
v3: v3,
|
|
138
|
+
containerRef: containerRef,
|
|
139
|
+
uploadDropZoneRef: uploadDropZoneRef
|
|
140
|
+
};
|
|
141
|
+
},
|
|
142
|
+
render: function render(createElement) {
|
|
143
|
+
var _this = this;
|
|
144
|
+
|
|
145
|
+
var h = gh || createElement;
|
|
146
|
+
var _a = this.$props,
|
|
147
|
+
multiple = _a.multiple,
|
|
148
|
+
disabled = _a.disabled,
|
|
149
|
+
tabIndex = _a.tabIndex,
|
|
150
|
+
accept = _a.accept,
|
|
151
|
+
showFileList = _a.showFileList,
|
|
152
|
+
groupedFiles = _a.groupedFiles,
|
|
153
|
+
navigationIndex = _a.navigationIndex,
|
|
154
|
+
showActionButtons = _a.showActionButtons,
|
|
155
|
+
actionsLayout = _a.actionsLayout,
|
|
156
|
+
notFocusedIndex = _a.notFocusedIndex,
|
|
157
|
+
list = _a.list,
|
|
158
|
+
id = _a.id,
|
|
159
|
+
ariaLabelledBy = _a.ariaLabelledBy,
|
|
160
|
+
ariaDescribedBy = _a.ariaDescribedBy,
|
|
161
|
+
async = _a.async;
|
|
162
|
+
var className = classNames('k-widget', 'k-upload', this.$props.className, disabled ? 'k-disabled' : '');
|
|
163
|
+
return h("div", {
|
|
164
|
+
ref: setRef(this, 'container'),
|
|
165
|
+
"class": className,
|
|
166
|
+
onKeydown: this.onKeyDown,
|
|
167
|
+
on: this.v3 ? undefined : {
|
|
168
|
+
"keydown": this.onKeyDown,
|
|
169
|
+
"focus": this.onFocus,
|
|
170
|
+
"blur": this.onBlur
|
|
171
|
+
},
|
|
172
|
+
onFocus: this.onFocus,
|
|
173
|
+
onBlur: this.onBlur
|
|
174
|
+
}, [// @ts-ignore function children
|
|
175
|
+
h(UploadDropZone, {
|
|
176
|
+
id: id,
|
|
177
|
+
attrs: this.v3 ? undefined : {
|
|
178
|
+
id: id,
|
|
179
|
+
ariaLabelledBy: ariaLabelledBy,
|
|
180
|
+
ariaDescribedBy: ariaDescribedBy,
|
|
181
|
+
accept: accept,
|
|
182
|
+
async: async,
|
|
183
|
+
addButtonIndex: this.addButtonIndex,
|
|
184
|
+
navigationIndex: navigationIndex,
|
|
185
|
+
notFocusedIndex: notFocusedIndex,
|
|
186
|
+
tabIndex: tabIndex,
|
|
187
|
+
multiple: multiple,
|
|
188
|
+
fileGroup: groupedFiles,
|
|
189
|
+
disabled: disabled
|
|
190
|
+
},
|
|
191
|
+
ariaLabelledBy: ariaLabelledBy,
|
|
192
|
+
ariaDescribedBy: ariaDescribedBy,
|
|
193
|
+
ref: this.v3 ? function (el) {
|
|
194
|
+
_this.uploadDropZoneRef = el;
|
|
195
|
+
} : 'uploadDropZone',
|
|
196
|
+
accept: accept,
|
|
197
|
+
async: async,
|
|
198
|
+
addButtonIndex: this.addButtonIndex,
|
|
199
|
+
navigationIndex: navigationIndex,
|
|
200
|
+
notFocusedIndex: notFocusedIndex,
|
|
201
|
+
tabIndex: tabIndex,
|
|
202
|
+
multiple: multiple,
|
|
203
|
+
onClick: this.onClick,
|
|
204
|
+
on: this.v3 ? undefined : {
|
|
205
|
+
"click": this.onClick,
|
|
206
|
+
"add": this.onAdd
|
|
207
|
+
},
|
|
208
|
+
onAdd: this.onAdd,
|
|
209
|
+
fileGroup: groupedFiles,
|
|
210
|
+
disabled: disabled
|
|
211
|
+
}), showFileList ? // @ts-ignore function children
|
|
212
|
+
h(UploadList, {
|
|
213
|
+
groupedFiles: groupedFiles,
|
|
214
|
+
attrs: this.v3 ? undefined : {
|
|
215
|
+
groupedFiles: groupedFiles,
|
|
216
|
+
disabled: disabled,
|
|
217
|
+
async: async,
|
|
218
|
+
navigationIndex: navigationIndex,
|
|
219
|
+
list: list
|
|
220
|
+
},
|
|
221
|
+
disabled: disabled,
|
|
222
|
+
async: async,
|
|
223
|
+
navigationIndex: navigationIndex,
|
|
224
|
+
list: list,
|
|
225
|
+
onCancel: this.onCancel,
|
|
226
|
+
on: this.v3 ? undefined : {
|
|
227
|
+
"cancel": this.onCancel,
|
|
228
|
+
"remove": this.onRemove,
|
|
229
|
+
"retry": this.onRetry,
|
|
230
|
+
"click": this.onClick
|
|
231
|
+
},
|
|
232
|
+
onRemove: this.onRemove,
|
|
233
|
+
onRetry: this.onRetry,
|
|
234
|
+
onClick: this.onClick
|
|
235
|
+
}) : undefined, showActionButtons ? // @ts-ignore function children
|
|
236
|
+
h(UploadActionButtons, {
|
|
237
|
+
disabled: disabled,
|
|
238
|
+
attrs: this.v3 ? undefined : {
|
|
239
|
+
disabled: disabled,
|
|
240
|
+
navigationIndex: navigationIndex,
|
|
241
|
+
clearButtonIndex: this.clearButtonIndex,
|
|
242
|
+
uploadButtonIndex: this.uploadButtonIndex,
|
|
243
|
+
actionsLayout: actionsLayout
|
|
244
|
+
},
|
|
245
|
+
navigationIndex: navigationIndex,
|
|
246
|
+
clearButtonIndex: this.clearButtonIndex,
|
|
247
|
+
uploadButtonIndex: this.uploadButtonIndex,
|
|
248
|
+
actionsLayout: actionsLayout,
|
|
249
|
+
onUpload: this.onUpload,
|
|
250
|
+
on: this.v3 ? undefined : {
|
|
251
|
+
"upload": this.onUpload,
|
|
252
|
+
"clear": this.onClear,
|
|
253
|
+
"click": this.onClick
|
|
254
|
+
},
|
|
255
|
+
onClear: this.onClear,
|
|
256
|
+
onClick: this.onClick
|
|
257
|
+
}) : undefined]);
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
/**
|
|
261
|
+
* @hidden
|
|
262
|
+
*/
|
|
263
|
+
|
|
264
|
+
var UploadUI = UploadUIVue2;
|
|
265
|
+
export { UploadUI, UploadUIVue2 };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import { DefineComponent } from 'vue';
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import * as Vue from 'vue';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @hidden
|
|
8
|
+
*/
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
type Vue2type = Vue.default;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @hidden
|
|
14
|
+
*/
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
import { RecordPropsDefinition, ComponentOptions } from 'vue/types/options';
|
|
17
|
+
/**
|
|
18
|
+
* @hidden
|
|
19
|
+
*/
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
export { DefineComponent, RecordPropsDefinition, ComponentOptions, Vue2type };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { UploadHttpHeaders } from './UploadHttpHeaders';
|
|
2
|
+
import { UploadFileInfo } from '../main';
|
|
3
|
+
/**
|
|
4
|
+
* Represents the async properties of the Upload component.
|
|
5
|
+
*/
|
|
6
|
+
export interface UploadAsyncProps {
|
|
7
|
+
/**
|
|
8
|
+
* By default, the selected files are immediately uploaded.
|
|
9
|
+
* To change this behavior, set `autoUpload` to `false`.
|
|
10
|
+
*/
|
|
11
|
+
autoUpload?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* When enabled, all files in the selection are uploaded in one request.
|
|
14
|
+
* Any files that are selected one after the other are uploaded in separate requests.
|
|
15
|
+
*/
|
|
16
|
+
batch?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Configures whether credentials (cookies, headers) will be sent for cross-site requests.
|
|
19
|
+
* Defaults to `true`. Setting `withCredentials` has no effect on same-site requests.
|
|
20
|
+
* To add credentials to the request, use the `saveHeaders` or `removeHeaders` property.
|
|
21
|
+
*/
|
|
22
|
+
withCredentials?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Sets the [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) key which
|
|
25
|
+
* contains the files submitted to `saveUrl`. Defaults to `files`.
|
|
26
|
+
*/
|
|
27
|
+
saveField?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Configures the `HttpHeaders` that are attached to each upload request.
|
|
30
|
+
*/
|
|
31
|
+
saveHeaders?: UploadHttpHeaders;
|
|
32
|
+
/**
|
|
33
|
+
* Sets the [`request`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods) method of the upload request.
|
|
34
|
+
* Defaults to `POST`.
|
|
35
|
+
*/
|
|
36
|
+
saveMethod?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Sets the URL of the endpoint for the upload request.
|
|
39
|
+
* The requested [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) key is named after
|
|
40
|
+
* the `saveField` property and contains the list of files that will be uploaded.
|
|
41
|
+
*/
|
|
42
|
+
saveUrl?: string | ((files: UploadFileInfo[], options: {
|
|
43
|
+
formData: FormData;
|
|
44
|
+
requestOptions: any;
|
|
45
|
+
}, onProgress: (uid: string, event: ProgressEvent) => void) => Promise<{
|
|
46
|
+
uid: string;
|
|
47
|
+
}>);
|
|
48
|
+
/**
|
|
49
|
+
* Sets the expected [response type](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseType)
|
|
50
|
+
* of the server.
|
|
51
|
+
* Used to parse the response appropriately.
|
|
52
|
+
* Defaults to `json`.
|
|
53
|
+
*/
|
|
54
|
+
responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
|
|
55
|
+
/**
|
|
56
|
+
* Sets the [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) key
|
|
57
|
+
* which contains the list of file names that are submitted to `removeUrl`.
|
|
58
|
+
* Defaults to `fileNames`.
|
|
59
|
+
*/
|
|
60
|
+
removeField?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Configures the `HttpHeaders` that are attached to each `remove` request.
|
|
63
|
+
*/
|
|
64
|
+
removeHeaders?: UploadHttpHeaders;
|
|
65
|
+
/**
|
|
66
|
+
* Sets the [request method](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods) of the `remove` request.
|
|
67
|
+
* Defaults to `POST`.
|
|
68
|
+
*/
|
|
69
|
+
removeMethod?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Sets the URL of the endpoint for the `remove` request.
|
|
72
|
+
* The [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) request
|
|
73
|
+
* key is named after the `removeField` property.
|
|
74
|
+
* It contains the list of file names which will be removed.
|
|
75
|
+
*/
|
|
76
|
+
removeUrl?: string | ((files: UploadFileInfo[], options: {
|
|
77
|
+
formData: FormData;
|
|
78
|
+
requestOptions: any;
|
|
79
|
+
}) => Promise<{
|
|
80
|
+
uid: string;
|
|
81
|
+
}>);
|
|
82
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { UploadFileStatus } from './UploadFileStatus';
|
|
2
|
+
/**
|
|
3
|
+
* Contains information which is related to the selected file.
|
|
4
|
+
*/
|
|
5
|
+
export interface UploadFileInfo {
|
|
6
|
+
/**
|
|
7
|
+
* The unique identifier of the group (batch) with one or more files.
|
|
8
|
+
* Has to be set for the initial list of files.
|
|
9
|
+
*/
|
|
10
|
+
uid: string;
|
|
11
|
+
/**
|
|
12
|
+
* The file name.
|
|
13
|
+
*/
|
|
14
|
+
name: string;
|
|
15
|
+
/**
|
|
16
|
+
* The file extension including the leading dot—for example, `.jpg`, `.png`, or other.
|
|
17
|
+
*/
|
|
18
|
+
extension?: string;
|
|
19
|
+
/**
|
|
20
|
+
* The file size in bytes.
|
|
21
|
+
*/
|
|
22
|
+
size?: number;
|
|
23
|
+
/**
|
|
24
|
+
* A list which contains the validation errors (if any).
|
|
25
|
+
*/
|
|
26
|
+
validationErrors?: Array<string>;
|
|
27
|
+
/**
|
|
28
|
+
* The current state of the file—`Failed`, `Selected`, `Uploaded`, or `Uploading`.
|
|
29
|
+
* `Initial` is a special value for `FileState` and is
|
|
30
|
+
* automatically applied to initial files without you having to explicitly set their state.
|
|
31
|
+
*/
|
|
32
|
+
status: UploadFileStatus;
|
|
33
|
+
/**
|
|
34
|
+
* The current upload progress.
|
|
35
|
+
*/
|
|
36
|
+
progress: number;
|
|
37
|
+
/**
|
|
38
|
+
* Gets the raw file instance.
|
|
39
|
+
*/
|
|
40
|
+
getRawFile?: () => File;
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configures the restrictions for the files that can be uploaded.
|
|
3
|
+
*/
|
|
4
|
+
export interface UploadFileRestrictions {
|
|
5
|
+
/**
|
|
6
|
+
* The list of the allowed file extensions.
|
|
7
|
+
* Recognizes entries of both `.type` (for example, `.docx`, `.png`, `.svg`, `.xls`, and others)
|
|
8
|
+
* and `type` (for example, `docx`, `png`, `svg`, `xls`, and others) values.
|
|
9
|
+
*/
|
|
10
|
+
allowedExtensions?: Array<string>;
|
|
11
|
+
/**
|
|
12
|
+
* Defines the maximum file size in bytes.
|
|
13
|
+
*/
|
|
14
|
+
maxFileSize?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Defines the minimum file size in bytes.
|
|
17
|
+
*/
|
|
18
|
+
minFileSize?: number;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lists the possible states of a file.
|
|
3
|
+
*/
|
|
4
|
+
export declare enum UploadFileStatus {
|
|
5
|
+
/**
|
|
6
|
+
* Indicates that the file upload process has failed.
|
|
7
|
+
*/
|
|
8
|
+
UploadFailed = 0,
|
|
9
|
+
/**
|
|
10
|
+
* An initially selected fake file without a set state.
|
|
11
|
+
*/
|
|
12
|
+
Initial = 1,
|
|
13
|
+
/**
|
|
14
|
+
* The file is selected.
|
|
15
|
+
*/
|
|
16
|
+
Selected = 2,
|
|
17
|
+
/**
|
|
18
|
+
* The file is in the process of uploading.
|
|
19
|
+
*/
|
|
20
|
+
Uploading = 3,
|
|
21
|
+
/**
|
|
22
|
+
* The file is successfully uploaded.
|
|
23
|
+
*/
|
|
24
|
+
Uploaded = 4,
|
|
25
|
+
/**
|
|
26
|
+
* The remove process has failed.
|
|
27
|
+
*/
|
|
28
|
+
RemoveFailed = 5,
|
|
29
|
+
/**
|
|
30
|
+
* The file is in the process of removing.
|
|
31
|
+
*/
|
|
32
|
+
Removing = 6
|
|
33
|
+
}
|