@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,176 @@
|
|
|
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 { UploadFileStatus } from './interfaces/UploadFileStatus.js';
|
|
10
|
+
import { provideLocalizationService } from '@progress/kendo-vue-intl';
|
|
11
|
+
import { messages, cancel, retry, remove } from './messages.js';
|
|
12
|
+
/**
|
|
13
|
+
* @hidden
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
var UploadListActionButtonVue2 = {
|
|
17
|
+
name: 'KendoVueUploadListActionButton',
|
|
18
|
+
props: {
|
|
19
|
+
progress: Number,
|
|
20
|
+
uid: String,
|
|
21
|
+
status: Number,
|
|
22
|
+
async: Object,
|
|
23
|
+
disabled: Boolean
|
|
24
|
+
},
|
|
25
|
+
// @ts-ignore
|
|
26
|
+
emits: {
|
|
27
|
+
'cancel': null,
|
|
28
|
+
'retry': null,
|
|
29
|
+
'remove': null
|
|
30
|
+
},
|
|
31
|
+
inject: {
|
|
32
|
+
kendoLocalizationService: {
|
|
33
|
+
default: null
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
data: function data() {
|
|
37
|
+
return {
|
|
38
|
+
retryFocused: false,
|
|
39
|
+
actionFocused: false
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
methods: {
|
|
43
|
+
actionButtonTitle: function actionButtonTitle(status, localizationService) {
|
|
44
|
+
if (status === UploadFileStatus.Uploading) {
|
|
45
|
+
return localizationService.toLanguageString(cancel, messages[cancel]);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return localizationService.toLanguageString(remove, messages[remove]);
|
|
49
|
+
},
|
|
50
|
+
retryButtonTitle: function retryButtonTitle(localizationService) {
|
|
51
|
+
return localizationService.toLanguageString(retry, messages[retry]);
|
|
52
|
+
},
|
|
53
|
+
buttonClassNames: function buttonClassNames(type) {
|
|
54
|
+
return classNames('k-button k-button-icon k-flat k-upload-action', this.$props.disabled ? 'k-disabled' : '', this.actionFocused && type === 'action' || this.retryFocused && type === 'retry' ? 'k-focus' : '');
|
|
55
|
+
},
|
|
56
|
+
onRetryFocus: function onRetryFocus() {
|
|
57
|
+
this.retryFocused = true;
|
|
58
|
+
},
|
|
59
|
+
onRetryBlur: function onRetryBlur() {
|
|
60
|
+
this.retryFocused = false;
|
|
61
|
+
},
|
|
62
|
+
onActionFocus: function onActionFocus() {
|
|
63
|
+
this.actionFocused = true;
|
|
64
|
+
},
|
|
65
|
+
onActionBlur: function onActionBlur() {
|
|
66
|
+
this.actionFocused = false;
|
|
67
|
+
},
|
|
68
|
+
onActionClick: function onActionClick() {
|
|
69
|
+
var _a = this.$props,
|
|
70
|
+
status = _a.status,
|
|
71
|
+
uid = _a.uid,
|
|
72
|
+
disabled = _a.disabled;
|
|
73
|
+
|
|
74
|
+
if (disabled || status === UploadFileStatus.Removing) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (status === UploadFileStatus.Uploading) {
|
|
79
|
+
this.$emit('cancel', uid);
|
|
80
|
+
} else {
|
|
81
|
+
this.$emit('remove', uid);
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
onRetryClick: function onRetryClick() {
|
|
85
|
+
var _a = this.$props,
|
|
86
|
+
uid = _a.uid,
|
|
87
|
+
disabled = _a.disabled;
|
|
88
|
+
|
|
89
|
+
if (disabled) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
this.$emit('retry', uid);
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
// @ts-ignore
|
|
97
|
+
setup: !isV3 ? undefined : function () {
|
|
98
|
+
var v3 = !!isV3;
|
|
99
|
+
var kendoLocalizationService = inject('kendoLocalizationService', {});
|
|
100
|
+
return {
|
|
101
|
+
v3: v3,
|
|
102
|
+
kendoLocalizationService: kendoLocalizationService
|
|
103
|
+
};
|
|
104
|
+
},
|
|
105
|
+
render: function render(createElement) {
|
|
106
|
+
var h = gh || createElement;
|
|
107
|
+
var _a = this.$props,
|
|
108
|
+
status = _a.status,
|
|
109
|
+
progress = _a.progress;
|
|
110
|
+
var actionButtonClassNames = classNames('k-icon', status === UploadFileStatus.Uploading ? 'k-cancel k-i-deny' : '', status !== UploadFileStatus.Uploading ? 'k-delete k-i-x' : '');
|
|
111
|
+
var isRetryVisible = status === UploadFileStatus.UploadFailed;
|
|
112
|
+
var isProgressVisible = status === UploadFileStatus.Uploading;
|
|
113
|
+
var isActionHidden = (status === UploadFileStatus.Uploaded || status === UploadFileStatus.Initial) && !this.$props.async.removeUrl;
|
|
114
|
+
var localizationService = provideLocalizationService(this);
|
|
115
|
+
var percent = '%';
|
|
116
|
+
return h("strong", {
|
|
117
|
+
"class": 'k-upload-status'
|
|
118
|
+
}, [isProgressVisible ? h("span", {
|
|
119
|
+
"class": 'k-upload-pct'
|
|
120
|
+
}, [progress, percent]) : undefined, isRetryVisible ? h("button", {
|
|
121
|
+
type: "button",
|
|
122
|
+
attrs: this.v3 ? undefined : {
|
|
123
|
+
type: "button",
|
|
124
|
+
tabindex: -1
|
|
125
|
+
},
|
|
126
|
+
tabindex: -1,
|
|
127
|
+
"class": this.buttonClassNames('retry'),
|
|
128
|
+
onFocus: this.onRetryFocus,
|
|
129
|
+
on: this.v3 ? undefined : {
|
|
130
|
+
"focus": this.onRetryFocus,
|
|
131
|
+
"blur": this.onRetryBlur,
|
|
132
|
+
"click": this.onRetryClick
|
|
133
|
+
},
|
|
134
|
+
onBlur: this.onRetryBlur,
|
|
135
|
+
onClick: this.onRetryClick
|
|
136
|
+
}, [h("span", {
|
|
137
|
+
"aria-label": this.retryButtonTitle(localizationService),
|
|
138
|
+
attrs: this.v3 ? undefined : {
|
|
139
|
+
"aria-label": this.retryButtonTitle(localizationService),
|
|
140
|
+
title: this.retryButtonTitle(localizationService)
|
|
141
|
+
},
|
|
142
|
+
title: this.retryButtonTitle(localizationService),
|
|
143
|
+
"class": 'k-icon k-retry k-i-refresh-sm'
|
|
144
|
+
})]) : undefined, !isActionHidden ? h("button", {
|
|
145
|
+
type: "button",
|
|
146
|
+
attrs: this.v3 ? undefined : {
|
|
147
|
+
type: "button",
|
|
148
|
+
tabindex: -1
|
|
149
|
+
},
|
|
150
|
+
tabindex: -1,
|
|
151
|
+
"class": this.buttonClassNames('action'),
|
|
152
|
+
onFocus: this.onActionFocus,
|
|
153
|
+
on: this.v3 ? undefined : {
|
|
154
|
+
"focus": this.onActionFocus,
|
|
155
|
+
"blur": this.onActionBlur,
|
|
156
|
+
"click": this.onActionClick
|
|
157
|
+
},
|
|
158
|
+
onBlur: this.onActionBlur,
|
|
159
|
+
onClick: this.onActionClick
|
|
160
|
+
}, [h("span", {
|
|
161
|
+
"aria-label": this.actionButtonTitle(status, localizationService),
|
|
162
|
+
attrs: this.v3 ? undefined : {
|
|
163
|
+
"aria-label": this.actionButtonTitle(status, localizationService),
|
|
164
|
+
title: this.actionButtonTitle(status, localizationService)
|
|
165
|
+
},
|
|
166
|
+
title: this.actionButtonTitle(status, localizationService),
|
|
167
|
+
"class": actionButtonClassNames
|
|
168
|
+
})]) : undefined]);
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* @hidden
|
|
173
|
+
*/
|
|
174
|
+
|
|
175
|
+
var UploadListActionButton = UploadListActionButtonVue2;
|
|
176
|
+
export { UploadListActionButton, UploadListActionButtonVue2 };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { DefineComponent, RecordPropsDefinition, ComponentOptions, Vue2type } from './additionalTypes';
|
|
2
|
+
declare type DefaultData<V> = object | ((this: V) => UploadListGroupData);
|
|
3
|
+
declare type DefaultMethods<V> = {
|
|
4
|
+
[key: string]: (this: V, ...args: any[]) => any;
|
|
5
|
+
};
|
|
6
|
+
import { UploadFileInfo } from './interfaces/UploadFileInfo';
|
|
7
|
+
import { UploadAsyncProps } from './interfaces/UploadAsyncProps';
|
|
8
|
+
/**
|
|
9
|
+
* @hidden
|
|
10
|
+
*/
|
|
11
|
+
export interface UploadListGroupProps {
|
|
12
|
+
files: Array<UploadFileInfo>;
|
|
13
|
+
async: UploadAsyncProps;
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
navigationIndex: number | undefined;
|
|
16
|
+
list?: any;
|
|
17
|
+
index: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @hidden
|
|
21
|
+
*/
|
|
22
|
+
export interface UploadListGroupMethods {
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @hidden
|
|
27
|
+
*/
|
|
28
|
+
export interface UploadListGroupState {
|
|
29
|
+
v3: boolean;
|
|
30
|
+
_element: HTMLLIElement | null;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @hidden
|
|
34
|
+
*/
|
|
35
|
+
export interface UploadListGroupData {
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @hidden
|
|
39
|
+
*/
|
|
40
|
+
export interface UploadListGroupComputed {
|
|
41
|
+
[key: string]: any;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* @hidden
|
|
45
|
+
*/
|
|
46
|
+
export interface UploadListGroupAll extends UploadListGroupMethods, UploadListGroupState, UploadListGroupData, UploadListGroupComputed, Vue2type {
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* @hidden
|
|
50
|
+
*/
|
|
51
|
+
declare let UploadListGroupVue2: ComponentOptions<Vue2type, DefaultData<UploadListGroupData>, DefaultMethods<UploadListGroupAll>, UploadListGroupComputed, RecordPropsDefinition<UploadListGroupProps>>;
|
|
52
|
+
/**
|
|
53
|
+
* @hidden
|
|
54
|
+
*/
|
|
55
|
+
declare const UploadListGroup: DefineComponent<UploadListGroupProps, any, UploadListGroupData, UploadListGroupComputed, UploadListGroupMethods, {}, {}, {}, string, UploadListGroupProps, UploadListGroupProps, {}>;
|
|
56
|
+
export { UploadListGroup, UploadListGroupVue2 };
|
|
@@ -0,0 +1,150 @@
|
|
|
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 { canUseDOM, classNames, getTemplate, setRef } from '@progress/kendo-vue-common';
|
|
8
|
+
import { UploadFileStatus } from './interfaces/UploadFileStatus.js';
|
|
9
|
+
import { UploadListSingleItem } from './UploadListSingleItem.js';
|
|
10
|
+
import { UploadListMultiItem } from './UploadListMultiItem.js';
|
|
11
|
+
import utils from './utils/utils.js';
|
|
12
|
+
/**
|
|
13
|
+
* @hidden
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
var UploadListGroupVue2 = {
|
|
17
|
+
name: 'KendoVueUploadListGroup',
|
|
18
|
+
props: {
|
|
19
|
+
files: Array,
|
|
20
|
+
async: Object,
|
|
21
|
+
disabled: Boolean,
|
|
22
|
+
navigationIndex: Number,
|
|
23
|
+
list: [String, Function, Object],
|
|
24
|
+
index: Number
|
|
25
|
+
},
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
emits: {
|
|
28
|
+
'cancel': null,
|
|
29
|
+
'click': null,
|
|
30
|
+
'retry': null,
|
|
31
|
+
'remove': null
|
|
32
|
+
},
|
|
33
|
+
mounted: function mounted() {
|
|
34
|
+
this._element = this.v3 ? this.elementRef : this.$refs.element;
|
|
35
|
+
},
|
|
36
|
+
updated: function updated() {
|
|
37
|
+
var _a = this.$props,
|
|
38
|
+
navigationIndex = _a.navigationIndex,
|
|
39
|
+
index = _a.index;
|
|
40
|
+
|
|
41
|
+
if (navigationIndex === index && this._element && canUseDOM && document.activeElement !== this._element) {
|
|
42
|
+
this._element.focus();
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
methods: {
|
|
46
|
+
onClick: function onClick() {
|
|
47
|
+
this.$emit('click', this.$props.index);
|
|
48
|
+
},
|
|
49
|
+
onRetry: function onRetry(uid) {
|
|
50
|
+
this.$emit('retry', uid);
|
|
51
|
+
},
|
|
52
|
+
onRemove: function onRemove(uid) {
|
|
53
|
+
this.$emit('remove', uid);
|
|
54
|
+
},
|
|
55
|
+
onCancel: function onCancel(uid) {
|
|
56
|
+
this.$emit('cancel', uid);
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
// @ts-ignore
|
|
60
|
+
setup: !isV3 ? undefined : function () {
|
|
61
|
+
var v3 = !!isV3;
|
|
62
|
+
var elementRef = ref(null);
|
|
63
|
+
return {
|
|
64
|
+
v3: v3,
|
|
65
|
+
elementRef: elementRef
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
render: function render(createElement) {
|
|
69
|
+
var h = gh || createElement;
|
|
70
|
+
var _a = this.$props,
|
|
71
|
+
files = _a.files,
|
|
72
|
+
async = _a.async,
|
|
73
|
+
disabled = _a.disabled,
|
|
74
|
+
navigationIndex = _a.navigationIndex,
|
|
75
|
+
index = _a.index,
|
|
76
|
+
list = _a.list;
|
|
77
|
+
var firstFile = files[0];
|
|
78
|
+
var isFileSuccess = firstFile.status === UploadFileStatus.Uploaded || firstFile.status === UploadFileStatus.Initial;
|
|
79
|
+
var liClassName = classNames('k-file', utils.filesHaveValidationErrors(files) ? 'k-file-invalid' : '', firstFile.status === UploadFileStatus.UploadFailed || firstFile.status === UploadFileStatus.RemoveFailed ? 'k-file-error' : '', firstFile.status === UploadFileStatus.Uploading ? 'k-file-progress' : '', isFileSuccess ? 'k-file-success' : '', navigationIndex === index ? 'k-focus' : '');
|
|
80
|
+
var itemComponent;
|
|
81
|
+
var defaultItemRendering = files.length === 1 ? // @ts-ignore
|
|
82
|
+
h(UploadListSingleItem, {
|
|
83
|
+
files: files,
|
|
84
|
+
attrs: this.v3 ? undefined : {
|
|
85
|
+
files: files,
|
|
86
|
+
async: async,
|
|
87
|
+
disabled: disabled
|
|
88
|
+
},
|
|
89
|
+
async: async,
|
|
90
|
+
disabled: disabled,
|
|
91
|
+
onCancel: this.onCancel,
|
|
92
|
+
on: this.v3 ? undefined : {
|
|
93
|
+
"cancel": this.onCancel,
|
|
94
|
+
"remove": this.onRemove,
|
|
95
|
+
"retry": this.onRetry
|
|
96
|
+
},
|
|
97
|
+
onRemove: this.onRemove,
|
|
98
|
+
onRetry: this.onRetry
|
|
99
|
+
}) : // @ts-ignore
|
|
100
|
+
h(UploadListMultiItem, {
|
|
101
|
+
files: files,
|
|
102
|
+
attrs: this.v3 ? undefined : {
|
|
103
|
+
files: files,
|
|
104
|
+
async: async,
|
|
105
|
+
disabled: disabled
|
|
106
|
+
},
|
|
107
|
+
async: async,
|
|
108
|
+
disabled: disabled,
|
|
109
|
+
onCancel: this.onCancel,
|
|
110
|
+
on: this.v3 ? undefined : {
|
|
111
|
+
"cancel": this.onCancel,
|
|
112
|
+
"remove": this.onRemove,
|
|
113
|
+
"retry": this.onRetry
|
|
114
|
+
},
|
|
115
|
+
onRemove: this.onRemove,
|
|
116
|
+
onRetry: this.onRetry
|
|
117
|
+
});
|
|
118
|
+
itemComponent = getTemplate.call(this, {
|
|
119
|
+
h: h,
|
|
120
|
+
template: this.$props.list,
|
|
121
|
+
defaultRendering: defaultItemRendering,
|
|
122
|
+
additionalProps: this.$props,
|
|
123
|
+
additionalListeners: {
|
|
124
|
+
retry: this.onRetry,
|
|
125
|
+
remove: this.onRemove,
|
|
126
|
+
cancel: this.onCancel
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
return h("li", {
|
|
130
|
+
ref: setRef(this, 'element'),
|
|
131
|
+
"class": liClassName,
|
|
132
|
+
"data-uid": firstFile.uid,
|
|
133
|
+
attrs: this.v3 ? undefined : {
|
|
134
|
+
"data-uid": firstFile.uid,
|
|
135
|
+
tabindex: -1
|
|
136
|
+
},
|
|
137
|
+
tabindex: -1,
|
|
138
|
+
onClick: this.onClick,
|
|
139
|
+
on: this.v3 ? undefined : {
|
|
140
|
+
"click": this.onClick
|
|
141
|
+
}
|
|
142
|
+
}, [itemComponent]);
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* @hidden
|
|
147
|
+
*/
|
|
148
|
+
|
|
149
|
+
var UploadListGroup = UploadListGroupVue2;
|
|
150
|
+
export { UploadListGroup, UploadListGroupVue2 };
|
|
@@ -0,0 +1,44 @@
|
|
|
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 { UploadListItemProps } from './interfaces/UploadListItemProps';
|
|
7
|
+
/**
|
|
8
|
+
* @hidden
|
|
9
|
+
*/
|
|
10
|
+
export interface UploadListMultiItemMethods {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* @hidden
|
|
15
|
+
*/
|
|
16
|
+
export interface UploadListMultiItemState {
|
|
17
|
+
v3: boolean;
|
|
18
|
+
_element: HTMLLIElement | null;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* @hidden
|
|
22
|
+
*/
|
|
23
|
+
export interface UploadListMultiItemData {
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @hidden
|
|
27
|
+
*/
|
|
28
|
+
export interface UploadListMultiItemComputed {
|
|
29
|
+
[key: string]: any;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* @hidden
|
|
33
|
+
*/
|
|
34
|
+
export interface UploadListMultiItemAll extends UploadListMultiItemMethods, UploadListMultiItemState, UploadListMultiItemData, UploadListMultiItemComputed, Vue2type {
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @hidden
|
|
38
|
+
*/
|
|
39
|
+
declare let UploadListMultiItemVue2: ComponentOptions<Vue2type, DefaultData<UploadListMultiItemData>, DefaultMethods<UploadListMultiItemAll>, UploadListMultiItemComputed, RecordPropsDefinition<UploadListItemProps>>;
|
|
40
|
+
/**
|
|
41
|
+
* @hidden
|
|
42
|
+
*/
|
|
43
|
+
declare const UploadListMultiItem: DefineComponent<UploadListItemProps, any, UploadListMultiItemData, UploadListMultiItemComputed, UploadListMultiItemMethods, {}, {}, {}, string, UploadListItemProps, UploadListItemProps, {}>;
|
|
44
|
+
export { UploadListMultiItem, UploadListMultiItemVue2 };
|
|
@@ -0,0 +1,172 @@
|
|
|
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 utils from './utils/utils.js';
|
|
10
|
+
import { provideLocalizationService } from '@progress/kendo-vue-intl';
|
|
11
|
+
import { messages, total, files as filesM, statusUploadFailed, statusUploaded } from './messages.js';
|
|
12
|
+
import { UploadListActionButton } from './UploadListActionButton.js';
|
|
13
|
+
/**
|
|
14
|
+
* @hidden
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
var UploadListMultiItemVue2 = {
|
|
18
|
+
name: 'KendoVueUploadListMultiItem',
|
|
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
|
+
getFileValidationMessage: function getFileValidationMessage(file) {
|
|
46
|
+
var localizationService = provideLocalizationService(this);
|
|
47
|
+
var validationMessage = '';
|
|
48
|
+
|
|
49
|
+
if (file.validationErrors && file.validationErrors.length > 0) {
|
|
50
|
+
var messageKey = "upload.".concat(file.validationErrors[0]);
|
|
51
|
+
validationMessage = localizationService.toLanguageString(messageKey, messages[messageKey]);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return validationMessage;
|
|
55
|
+
},
|
|
56
|
+
progress: function progress() {
|
|
57
|
+
var files = this.$props.files;
|
|
58
|
+
var sum = 0;
|
|
59
|
+
files.forEach(function (file) {
|
|
60
|
+
sum += file.progress || 0;
|
|
61
|
+
});
|
|
62
|
+
return sum / files.length;
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
// @ts-ignore
|
|
66
|
+
setup: !isV3 ? undefined : function () {
|
|
67
|
+
var v3 = !!isV3;
|
|
68
|
+
var kendoLocalizationService = inject('kendoLocalizationService', {});
|
|
69
|
+
return {
|
|
70
|
+
v3: v3,
|
|
71
|
+
kendoLocalizationService: kendoLocalizationService
|
|
72
|
+
};
|
|
73
|
+
},
|
|
74
|
+
render: function render(createElement) {
|
|
75
|
+
var h = gh || createElement;
|
|
76
|
+
var _a = this.$props,
|
|
77
|
+
files = _a.files,
|
|
78
|
+
disabled = _a.disabled,
|
|
79
|
+
async = _a.async;
|
|
80
|
+
var itemClassName = classNames('k-file-multiple');
|
|
81
|
+
|
|
82
|
+
var _b = utils.getFileStatus(files),
|
|
83
|
+
isUploaded = _b[1],
|
|
84
|
+
isUploadFailed = _b[2],
|
|
85
|
+
isUploadValidationFailed = _b[3];
|
|
86
|
+
|
|
87
|
+
var localizationService = provideLocalizationService(this);
|
|
88
|
+
var totalMessage = localizationService.toLanguageString(total, messages[total]);
|
|
89
|
+
var filesMessage = localizationService.toLanguageString(filesM, messages[filesM]);
|
|
90
|
+
var uploadFailedMessage = localizationService.toLanguageString(statusUploadFailed, messages[statusUploadFailed]);
|
|
91
|
+
var successMessage = localizationService.toLanguageString(statusUploaded, messages[statusUploaded]);
|
|
92
|
+
var progress = this.progress();
|
|
93
|
+
var showProgressBar = !isUploadValidationFailed && !isUploaded && !isUploadFailed;
|
|
94
|
+
|
|
95
|
+
var mapFiles = function mapFiles() {
|
|
96
|
+
return files.map(function (file) {
|
|
97
|
+
return h("span", {
|
|
98
|
+
key: file.name,
|
|
99
|
+
"class": 'k-file-name-size-wrapper'
|
|
100
|
+
}, [h("span", {
|
|
101
|
+
"class": 'k-file-name',
|
|
102
|
+
title: file.name,
|
|
103
|
+
attrs: this.v3 ? undefined : {
|
|
104
|
+
title: file.name
|
|
105
|
+
}
|
|
106
|
+
}, [file.name]), utils.fileHasValidationErrors(file) ? h("span", {
|
|
107
|
+
"class": 'k-file-validation-message k-text-error'
|
|
108
|
+
}, [this.getFileValidationMessage(file)]) : h("span", {
|
|
109
|
+
key: "".concat(file.name, "-size"),
|
|
110
|
+
"class": 'k-file-size'
|
|
111
|
+
}, [utils.getTotalFilesSizeMessage([file])])]);
|
|
112
|
+
}, this);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
return h("div", {
|
|
116
|
+
"class": itemClassName
|
|
117
|
+
}, [h("div", {
|
|
118
|
+
"class": 'k-progressbar',
|
|
119
|
+
style: {
|
|
120
|
+
transition: 'opacity 1s ease-in-out',
|
|
121
|
+
opacity: showProgressBar ? 1 : 0
|
|
122
|
+
}
|
|
123
|
+
}, [h("span", {
|
|
124
|
+
"class": 'k-progress',
|
|
125
|
+
style: {
|
|
126
|
+
width: (progress || 0) + '%'
|
|
127
|
+
}
|
|
128
|
+
})]), h("span", {
|
|
129
|
+
"class": 'k-multiple-files-group-wrapper'
|
|
130
|
+
}, [h("span", {
|
|
131
|
+
"class": 'k-file-group k-icon k-i-copy'
|
|
132
|
+
})]), h("span", {
|
|
133
|
+
"class": "k-multiple-files-wrapper"
|
|
134
|
+
}, [mapFiles.call(this), !isUploadFailed ? progress !== 100 ? h("span", {
|
|
135
|
+
"class": 'k-file-information'
|
|
136
|
+
}, ["".concat(totalMessage, ": ").concat(files.length, " ").concat(filesMessage, ", ").concat(utils.getTotalFilesSizeMessage(files))]) : h("span", {
|
|
137
|
+
"class": 'k-file-information k-text-success'
|
|
138
|
+
}, ["".concat(files.length, " ").concat(successMessage)]) : h("span", {
|
|
139
|
+
"class": 'k-file-validation-message k-text-error'
|
|
140
|
+
}, ["".concat(files.length, " ").concat(uploadFailedMessage)])]), // @ts-ignore function children
|
|
141
|
+
h(UploadListActionButton, {
|
|
142
|
+
uid: files[0].uid,
|
|
143
|
+
attrs: this.v3 ? undefined : {
|
|
144
|
+
uid: files[0].uid,
|
|
145
|
+
status: files[0].status,
|
|
146
|
+
progress: progress,
|
|
147
|
+
files: files,
|
|
148
|
+
disabled: disabled,
|
|
149
|
+
async: async
|
|
150
|
+
},
|
|
151
|
+
status: files[0].status,
|
|
152
|
+
progress: progress,
|
|
153
|
+
files: files,
|
|
154
|
+
disabled: disabled,
|
|
155
|
+
async: async,
|
|
156
|
+
onCancel: this.onCancel,
|
|
157
|
+
on: this.v3 ? undefined : {
|
|
158
|
+
"cancel": this.onCancel,
|
|
159
|
+
"remove": this.onRemove,
|
|
160
|
+
"retry": this.onRetry
|
|
161
|
+
},
|
|
162
|
+
onRemove: this.onRemove,
|
|
163
|
+
onRetry: this.onRetry
|
|
164
|
+
})]);
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* @hidden
|
|
169
|
+
*/
|
|
170
|
+
|
|
171
|
+
var UploadListMultiItem = UploadListMultiItemVue2;
|
|
172
|
+
export { UploadListMultiItem, UploadListMultiItemVue2 };
|
|
@@ -0,0 +1,44 @@
|
|
|
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 { UploadListItemProps } from './interfaces/UploadListItemProps';
|
|
7
|
+
/**
|
|
8
|
+
* @hidden
|
|
9
|
+
*/
|
|
10
|
+
export interface UploadListSingleItemMethods {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* @hidden
|
|
15
|
+
*/
|
|
16
|
+
export interface UploadListSingleItemState {
|
|
17
|
+
v3: boolean;
|
|
18
|
+
_element: HTMLLIElement | null;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* @hidden
|
|
22
|
+
*/
|
|
23
|
+
export interface UploadListSingleItemData {
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @hidden
|
|
27
|
+
*/
|
|
28
|
+
export interface UploadListSingleItemComputed {
|
|
29
|
+
[key: string]: any;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* @hidden
|
|
33
|
+
*/
|
|
34
|
+
export interface UploadListSingleItemAll extends UploadListSingleItemMethods, UploadListSingleItemState, UploadListSingleItemData, UploadListSingleItemComputed, Vue2type {
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @hidden
|
|
38
|
+
*/
|
|
39
|
+
declare let UploadListSingleItemVue2: ComponentOptions<Vue2type, DefaultData<UploadListSingleItemData>, DefaultMethods<UploadListSingleItemAll>, UploadListSingleItemComputed, RecordPropsDefinition<UploadListItemProps>>;
|
|
40
|
+
/**
|
|
41
|
+
* @hidden
|
|
42
|
+
*/
|
|
43
|
+
declare const UploadListSingleItem: DefineComponent<UploadListItemProps, any, UploadListSingleItemData, UploadListSingleItemComputed, UploadListSingleItemMethods, {}, {}, {}, string, UploadListItemProps, UploadListItemProps, {}>;
|
|
44
|
+
export { UploadListSingleItem, UploadListSingleItemVue2 };
|