@sankhyalabs/ezui 1.1.38 → 1.1.42
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/cjs/ez-button_16.cjs.entry.js +328 -206
- package/dist/cjs/ez-dialog.cjs.entry.js +4 -4
- package/dist/cjs/ez-popup.cjs.entry.js +3 -3
- package/dist/cjs/ez-toast.cjs.entry.js +37 -0
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +18 -8
- package/dist/collection/components/ez-dialog/ez-dialog.js +16 -12
- package/dist/collection/components/ez-form/assets/trash-can-outline.svg +3 -0
- package/dist/collection/components/ez-form/ez-form.js +9 -0
- package/dist/collection/components/ez-form/subcomponents/DataUnit.js +2 -1
- package/dist/collection/components/ez-form/subcomponents/form-metadata.js +1 -5
- package/dist/collection/components/ez-form/subcomponents/structure/Field.js +2 -3
- package/dist/collection/components/ez-form/subcomponents/structure/NavigationBar.js +6 -3
- package/dist/collection/components/ez-popup/ez-popup.js +5 -5
- package/dist/collection/components/ez-search/ez-search.js +9 -7
- package/dist/collection/components/ez-toast/ez-toast.css +108 -0
- package/dist/collection/components/ez-toast/ez-toast.js +113 -0
- package/dist/collection/components/ez-upload/RemoteFile.js +89 -0
- package/dist/collection/components/ez-upload/ez-upload.css +16 -1
- package/dist/collection/components/ez-upload/ez-upload.js +257 -296
- package/dist/collection/utils/Application.js +34 -0
- package/dist/custom-elements/index.d.ts +6 -0
- package/dist/custom-elements/index.js +375 -219
- package/dist/esm/ez-button_16.entry.js +328 -206
- package/dist/esm/ez-dialog.entry.js +4 -4
- package/dist/esm/ez-popup.entry.js +3 -3
- package/dist/esm/ez-toast.entry.js +33 -0
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/ezui/assets/trash-can-outline.svg +3 -0
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-1ff02df6.entry.js +1 -0
- package/dist/ezui/p-243c6972.entry.js +1 -0
- package/dist/ezui/p-4a87d740.entry.js +1 -0
- package/dist/ezui/p-c3b18332.entry.js +1 -0
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +2 -1
- package/dist/types/components/ez-dialog/ez-dialog.d.ts +3 -3
- package/dist/types/components/ez-form/ez-form.d.ts +2 -0
- package/dist/types/components/ez-popup/ez-popup.d.ts +1 -1
- package/dist/types/components/ez-search/ez-search.d.ts +1 -1
- package/dist/types/components/ez-toast/ez-toast.d.ts +17 -0
- package/dist/types/components/ez-upload/RemoteFile.d.ts +14 -0
- package/dist/types/components/ez-upload/ez-upload.d.ts +51 -57
- package/dist/types/components.d.ts +95 -61
- package/dist/types/utils/Application.d.ts +6 -0
- package/package.json +2 -2
- package/react/components.d.ts +1 -0
- package/react/components.js +1 -0
- package/react/components.js.map +1 -1
- package/dist/ezui/p-40fe4f51.entry.js +0 -1
- package/dist/ezui/p-caa50ec5.entry.js +0 -1
- package/dist/ezui/p-e8a91edd.entry.js +0 -1
|
@@ -1,136 +1,124 @@
|
|
|
1
|
-
import { Component,
|
|
1
|
+
import { Component, h, Prop, Element, Event, Method, Watch, forceUpdate } from '@stencil/core';
|
|
2
|
+
import Application from '../../utils/Application';
|
|
3
|
+
import RemoteFile from './RemoteFile';
|
|
2
4
|
export class EzUpload {
|
|
3
|
-
|
|
4
|
-
this.
|
|
5
|
+
constructor() {
|
|
6
|
+
this._filePointers = new Map();
|
|
7
|
+
/**
|
|
8
|
+
* Deixa o campo disponível ou não para digitação.
|
|
9
|
+
*/
|
|
10
|
+
this.enabled = true;
|
|
5
11
|
}
|
|
6
|
-
|
|
7
|
-
|
|
12
|
+
changeValue(newValue) {
|
|
13
|
+
if (newValue !== this._updatingValue) {
|
|
14
|
+
this._filePointers.forEach(f => {
|
|
15
|
+
if (this.isRemoteFile(f)) {
|
|
16
|
+
f.abortUpload();
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
this._filePointers = new Map();
|
|
20
|
+
this.updateFilePointers();
|
|
21
|
+
}
|
|
22
|
+
this._updatingValue = undefined;
|
|
8
23
|
}
|
|
9
|
-
|
|
10
|
-
this.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
24
|
+
updateFilePointers() {
|
|
25
|
+
if (this.value) {
|
|
26
|
+
this.value.forEach(ezFile => this._filePointers.set(ezFile.name, ezFile));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
normalizeRequestHeaders() {
|
|
30
|
+
this._requestHeaders = new Map();
|
|
31
|
+
if (typeof this.requestheaders == 'string') {
|
|
32
|
+
try {
|
|
33
|
+
this.requestheaders = JSON.parse(this.requestheaders);
|
|
14
34
|
}
|
|
15
|
-
|
|
16
|
-
this.
|
|
17
|
-
alert(this.errorMessage);
|
|
35
|
+
catch (e) {
|
|
36
|
+
this.requestheaders = undefined;
|
|
18
37
|
}
|
|
19
38
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
alert(this.errorMessage);
|
|
23
|
-
}
|
|
39
|
+
for (var key in this.requestheaders) {
|
|
40
|
+
this._requestHeaders.set(key, this.requestheaders[key]);
|
|
24
41
|
}
|
|
25
42
|
}
|
|
26
|
-
|
|
27
|
-
this.
|
|
28
|
-
let isValid = true;
|
|
29
|
-
if (this.maxFileSize >= 0 && file.size > this.maxFileSize) {
|
|
30
|
-
this.errorMessage = 'O tamanho máximo dos arquivos é de ' + this.formatBytes(this.maxFileSize);
|
|
31
|
-
isValid = false;
|
|
32
|
-
}
|
|
33
|
-
this.validatedEvent.emit({ isValid: isValid, fileName: file.name });
|
|
34
|
-
return isValid;
|
|
43
|
+
async addFiles(files) {
|
|
44
|
+
Array.prototype.forEach.call(files, this.addFile.bind(this));
|
|
35
45
|
}
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
let viewFile = newValue.find(f => f.name === file.name);
|
|
45
|
-
if (viewFile) {
|
|
46
|
-
viewFile.progress = progress;
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
xhr.onreadystatechange = () => {
|
|
50
|
-
this.errorMessage = '';
|
|
51
|
-
if (xhr.readyState == 4) {
|
|
52
|
-
clearTimeout(stalledId);
|
|
53
|
-
file.indeterminate = file.uploading = false;
|
|
54
|
-
if (xhr.status === 0) {
|
|
55
|
-
// this.errorMessage = "Servidor indisponível";
|
|
56
|
-
}
|
|
57
|
-
else if (xhr.status >= 500) {
|
|
58
|
-
this.errorMessage = "Erro inesperado no servidor";
|
|
59
|
-
}
|
|
60
|
-
else if (xhr.status >= 400) {
|
|
61
|
-
this.errorMessage = "Operação não permitida";
|
|
62
|
-
}
|
|
63
|
-
if (this.errorMessage && this.errorMessage.length > 0) {
|
|
64
|
-
//TODO
|
|
65
|
-
// Conferir com o time de UX um estado de erro ou remoção da lista
|
|
66
|
-
// this.removeFile(file.name);
|
|
67
|
-
alert(this.errorMessage);
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
if (xhr.response) {
|
|
71
|
-
let response = JSON.parse(xhr.response);
|
|
72
|
-
response.forEach(element => {
|
|
73
|
-
let viewFile = newValue.find(f => f.name === this.decode_utf8(element.name));
|
|
74
|
-
if (viewFile) {
|
|
75
|
-
viewFile.progress = undefined;
|
|
76
|
-
//Validar estado de erro com UX
|
|
77
|
-
viewFile.error = false;
|
|
78
|
-
delete viewFile.xhr;
|
|
79
|
-
viewFile.downloadURL = element.downloadURL;
|
|
80
|
-
viewFile.lastModifiedDate = element.lastModifiedDate;
|
|
81
|
-
viewFile.properties = element.properties;
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
//caso não encontre o elemento na lista
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
this.value = newValue;
|
|
88
|
-
this.fileListChange();
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
let viewFile = newValue.find(f => f.name === file.name);
|
|
92
|
-
viewFile.progress = undefined;
|
|
93
|
-
//Validar estado de erro com UX
|
|
94
|
-
viewFile.error = true;
|
|
46
|
+
async addFile(file) {
|
|
47
|
+
const oldFile = this._filePointers.get(file.name);
|
|
48
|
+
if (oldFile) {
|
|
49
|
+
Application.confirm("Substituir arquivo", `Já existe um arquivo chamado "${file.name}". Deseja substituí-lo?`)
|
|
50
|
+
.then(ok => {
|
|
51
|
+
if (ok) {
|
|
52
|
+
if (this.isRemoteFile(oldFile)) {
|
|
53
|
+
oldFile.abortUpload();
|
|
95
54
|
}
|
|
55
|
+
this.doAddFile(file);
|
|
96
56
|
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
this.removeFile(file.name);
|
|
103
|
-
alert(this.errorMessage);
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
const formData = new FormData();
|
|
107
|
-
formData.append(this.formDataName, file, file.name);
|
|
108
|
-
xhr.open("POST", this.target, true);
|
|
109
|
-
this._configureXhr(xhr);
|
|
110
|
-
file.status = "conectando";
|
|
111
|
-
file.uploading = file.indeterminate = true;
|
|
112
|
-
file.complete = file.abort = file.error = file.held = false;
|
|
113
|
-
xhr.send(formData);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
this.doAddFile(file);
|
|
61
|
+
}
|
|
114
62
|
}
|
|
115
|
-
|
|
116
|
-
|
|
63
|
+
async doAddFile(file) {
|
|
64
|
+
if (this.validateFile(file)) {
|
|
65
|
+
const uploadingFile = new RemoteFile(file);
|
|
66
|
+
this._filePointers.set(file.name, uploadingFile);
|
|
67
|
+
uploadingFile.upload(this.urlupload, this._requestHeaders, (file) => this.updateFeedback(file))
|
|
68
|
+
.then((files) => files.forEach(ezFile => this.finishUpload(ezFile)))
|
|
69
|
+
.catch(msg => this.showError(msg));
|
|
70
|
+
forceUpdate(this);
|
|
71
|
+
}
|
|
117
72
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
73
|
+
finishUpload(ezFile) {
|
|
74
|
+
this._filePointers.set(ezFile.name, ezFile);
|
|
75
|
+
this.updateValue();
|
|
76
|
+
}
|
|
77
|
+
updateValue() {
|
|
78
|
+
this._updatingValue = [];
|
|
79
|
+
this._filePointers.forEach(f => {
|
|
80
|
+
if (!this.isRemoteFile(f)) {
|
|
81
|
+
this._updatingValue.push(f);
|
|
122
82
|
}
|
|
123
|
-
|
|
124
|
-
|
|
83
|
+
});
|
|
84
|
+
this.value = this._updatingValue;
|
|
85
|
+
this.ezChange.emit(this.value);
|
|
86
|
+
}
|
|
87
|
+
buildProgressId(uploading) {
|
|
88
|
+
let sanitizedName = uploading.name.replace(/[^a-z0-9_]/gi, '_');
|
|
89
|
+
return `PROGRESS_${sanitizedName}_${uploading.file.lastModified}`;
|
|
90
|
+
}
|
|
91
|
+
updateFeedback(uf) {
|
|
92
|
+
window.requestAnimationFrame(() => {
|
|
93
|
+
if (this._host) {
|
|
94
|
+
const progress = this._host.shadowRoot.querySelector('#' + this.buildProgressId(uf));
|
|
95
|
+
if (progress) {
|
|
96
|
+
progress.value = uf.progress;
|
|
97
|
+
}
|
|
125
98
|
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
validateFile(file) {
|
|
102
|
+
if (this.maxfiles > 0 && this._filePointers.size >= this.maxfiles) {
|
|
103
|
+
this.showError(`A quantidade máxima de arquivos é ${this.maxfiles}.`);
|
|
104
|
+
return false;
|
|
126
105
|
}
|
|
127
|
-
|
|
128
|
-
|
|
106
|
+
if (file.size === 0) {
|
|
107
|
+
this.showError(`Erro de permissão: O arquivo "${file.name}" não pode ser enviado.`);
|
|
108
|
+
return false;
|
|
129
109
|
}
|
|
130
|
-
if (this.
|
|
131
|
-
|
|
110
|
+
if (!this.urlupload) {
|
|
111
|
+
this.showError("Endereço de upload não informado");
|
|
112
|
+
return false;
|
|
132
113
|
}
|
|
133
|
-
|
|
114
|
+
if (this.maxfilesize >= 0 && file.size > this.maxfilesize) {
|
|
115
|
+
this.showError("O tamanho máximo dos arquivos é de " + this.formatBytes(this.maxfilesize));
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
showError(message) {
|
|
121
|
+
Application.alert("Enviando arquivo", message);
|
|
134
122
|
}
|
|
135
123
|
formatBytes(bytes, decimals = 1) {
|
|
136
124
|
if (bytes === 0)
|
|
@@ -142,117 +130,99 @@ export class EzUpload {
|
|
|
142
130
|
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
|
|
143
131
|
}
|
|
144
132
|
onFileInputChange(event) {
|
|
145
|
-
|
|
133
|
+
const input = event.target;
|
|
134
|
+
this.addFiles(Array.from(input.files));
|
|
146
135
|
this._fileInput.value = '';
|
|
147
136
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
137
|
+
isRemoteFile(item) {
|
|
138
|
+
return "file" in item;
|
|
139
|
+
}
|
|
140
|
+
removeFromList(name) {
|
|
141
|
+
this._filePointers.delete(name);
|
|
142
|
+
this.updateValue();
|
|
143
|
+
}
|
|
144
|
+
removeFile(name) {
|
|
145
|
+
const item = this._filePointers.get(name);
|
|
146
|
+
if (this.isRemoteFile(item)) {
|
|
147
|
+
item.abortUpload();
|
|
148
|
+
this.removeFromList(name);
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
if (this.urldelete) {
|
|
152
|
+
const uploadingFile = new RemoteFile(null);
|
|
153
|
+
this._filePointers.set(item.name, uploadingFile);
|
|
154
|
+
uploadingFile.delete(item, this.urldelete, null)
|
|
155
|
+
.then(_ok => this.removeFromList(name))
|
|
156
|
+
.catch(msg => this.showError(msg));
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
this.removeFromList(name);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
openFilesDialog() {
|
|
164
|
+
if (this.maxfiles > 0 && this._filePointers.size >= this.maxfiles) {
|
|
165
|
+
this.showError(`A quantidade máxima de arquivos é ${this.maxfiles}.`);
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
this._fileInput.click();
|
|
156
169
|
}
|
|
157
|
-
}*/
|
|
158
|
-
decode_utf8(s) {
|
|
159
|
-
return decodeURIComponent(escape(s));
|
|
160
170
|
}
|
|
161
171
|
componentDidLoad() {
|
|
162
|
-
if (this.
|
|
163
|
-
this.
|
|
172
|
+
if (this._dropZone && window.FileList && window.File) {
|
|
173
|
+
this._dropZone.addEventListener('dragover', event => {
|
|
164
174
|
event.stopPropagation();
|
|
165
175
|
event.preventDefault();
|
|
166
176
|
event.dataTransfer.dropEffect = 'copy';
|
|
167
177
|
});
|
|
168
|
-
this.
|
|
178
|
+
this._dropZone.addEventListener('drop', event => {
|
|
169
179
|
event.stopPropagation();
|
|
170
180
|
event.preventDefault();
|
|
171
|
-
this.addFiles(event.dataTransfer.files);
|
|
181
|
+
this.addFiles(Array.from(event.dataTransfer.files));
|
|
172
182
|
});
|
|
173
183
|
}
|
|
174
184
|
}
|
|
175
|
-
|
|
176
|
-
if (
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
if (downloadURL) {
|
|
180
|
-
this.removeFileFromServer(name, downloadURL);
|
|
181
|
-
}
|
|
182
|
-
this.value = [...this.value.filter(function (value) { return value.name !== name; })];
|
|
183
|
-
}
|
|
184
|
-
removeFileFromServer(name, donwloadURL) {
|
|
185
|
-
const xhr = this._createXhr();
|
|
186
|
-
this.errorMessage = '';
|
|
187
|
-
let stalledId;
|
|
188
|
-
xhr.onreadystatechange = () => {
|
|
189
|
-
if (xhr.readyState == 4) {
|
|
190
|
-
clearTimeout(stalledId);
|
|
191
|
-
if (xhr.status === 0) {
|
|
192
|
-
this.errorMessage = "Servidor indisponível";
|
|
193
|
-
}
|
|
194
|
-
else if (xhr.status >= 500) {
|
|
195
|
-
this.errorMessage = "Erro inesperado no servidor";
|
|
196
|
-
}
|
|
197
|
-
else if (xhr.status >= 400) {
|
|
198
|
-
this.errorMessage = "Operação não permitida";
|
|
199
|
-
}
|
|
200
|
-
if (this.errorMessage && this.errorMessage.length > 0) {
|
|
201
|
-
//TODO
|
|
202
|
-
// Conferir com o time de UX um estado de erro ou remoção da lista
|
|
203
|
-
// this.removeFile(file.name);
|
|
204
|
-
alert(this.errorMessage);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
xhr.ontimeout = () => {
|
|
209
|
-
if (this.errorMessage && this.errorMessage.length > 0) {
|
|
210
|
-
alert(this.errorMessage);
|
|
185
|
+
componentWillRender() {
|
|
186
|
+
if (this.value) {
|
|
187
|
+
if (this._filePointers.size < this.value.length) {
|
|
188
|
+
this.updateFilePointers();
|
|
211
189
|
}
|
|
212
|
-
}
|
|
213
|
-
const body = JSON.stringify({
|
|
214
|
-
name: name,
|
|
215
|
-
donwloadURL: donwloadURL,
|
|
216
|
-
});
|
|
217
|
-
xhr.open("DELETE", this.target, true);
|
|
218
|
-
xhr.setRequestHeader('Content-Type', 'application/json');
|
|
219
|
-
this._configureXhr(xhr);
|
|
220
|
-
xhr.send(body);
|
|
190
|
+
}
|
|
221
191
|
}
|
|
222
192
|
render() {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
h("
|
|
226
|
-
h("div", {
|
|
227
|
-
h("
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
193
|
+
return (h("div", { ref: (el) => this._dropZone = el, class: "iu" },
|
|
194
|
+
this.label ? h("label", { class: "iu__label", title: this.label }, this.label) : null,
|
|
195
|
+
h("div", { class: "iu__container", onClick: () => this.openFilesDialog() },
|
|
196
|
+
h("div", { class: "iu__icon-label" },
|
|
197
|
+
h("button", { class: "iu__file-icon" }),
|
|
198
|
+
h("div", { class: "text text--center text--medium text--primary" }, "Arraste e solte ou clique para adicionar arquivos")),
|
|
199
|
+
this.buildFooter()),
|
|
200
|
+
h("input", { ref: (el) => this._fileInput = el, onChange: (ev) => this.onFileInputChange(ev), type: "file", multiple: true, hidden: true })));
|
|
201
|
+
}
|
|
202
|
+
buildFooter() {
|
|
203
|
+
if (this._filePointers.size === 0) {
|
|
204
|
+
return null;
|
|
205
|
+
}
|
|
206
|
+
const items = [];
|
|
207
|
+
this._filePointers.forEach(item => items.push(this.buildFileItem(item)));
|
|
208
|
+
return (h("div", { class: "iu__footer" }, items));
|
|
209
|
+
}
|
|
210
|
+
buildFileItem(item) {
|
|
211
|
+
const fileName = item.name;
|
|
212
|
+
const progress = Number(item['progress']);
|
|
213
|
+
const downloadURL = item['downloadURL'];
|
|
214
|
+
const label = `${fileName} (${this.formatBytes(item.size)})`;
|
|
215
|
+
return (h("div", { class: "iu__item", key: fileName, onClick: evt => evt.stopPropagation() },
|
|
216
|
+
h("div", { class: "iu__item-label modificador" },
|
|
217
|
+
h("div", { title: label, class: "col--stretch align--middle file__name text text--primary text--small text--ellipsis align--middle" }, downloadURL ? h("a", { href: downloadURL, download: true }, label) : label)),
|
|
218
|
+
isNaN(progress)
|
|
219
|
+
?
|
|
220
|
+
null
|
|
221
|
+
:
|
|
222
|
+
h("div", { class: "col col--sd-4 col--stretch align--middle" },
|
|
223
|
+
h("progress", { id: this.buildProgressId(item), value: progress, max: "100" })),
|
|
224
|
+
h("div", { class: "col col--stretch align--middle" },
|
|
225
|
+
h("button", { class: "btn-cancel ", onClick: () => this.removeFile(fileName) }))));
|
|
256
226
|
}
|
|
257
227
|
static get is() { return "ez-upload"; }
|
|
258
228
|
static get encapsulation() { return "shadow"; }
|
|
@@ -263,41 +233,42 @@ export class EzUpload {
|
|
|
263
233
|
"$": ["ez-upload.css"]
|
|
264
234
|
}; }
|
|
265
235
|
static get properties() { return {
|
|
266
|
-
"
|
|
267
|
-
"type": "
|
|
236
|
+
"label": {
|
|
237
|
+
"type": "string",
|
|
268
238
|
"mutable": false,
|
|
269
239
|
"complexType": {
|
|
270
|
-
"original": "
|
|
271
|
-
"resolved": "
|
|
240
|
+
"original": "string",
|
|
241
|
+
"resolved": "string",
|
|
272
242
|
"references": {}
|
|
273
243
|
},
|
|
274
244
|
"required": false,
|
|
275
245
|
"optional": false,
|
|
276
246
|
"docs": {
|
|
277
247
|
"tags": [],
|
|
278
|
-
"text": "
|
|
248
|
+
"text": "Label \u00E9 o t\u00EDtulo do campo"
|
|
279
249
|
},
|
|
280
|
-
"attribute": "
|
|
281
|
-
"reflect":
|
|
250
|
+
"attribute": "label",
|
|
251
|
+
"reflect": false
|
|
282
252
|
},
|
|
283
|
-
"
|
|
284
|
-
"type": "
|
|
253
|
+
"enabled": {
|
|
254
|
+
"type": "boolean",
|
|
285
255
|
"mutable": false,
|
|
286
256
|
"complexType": {
|
|
287
|
-
"original": "
|
|
288
|
-
"resolved": "
|
|
257
|
+
"original": "boolean",
|
|
258
|
+
"resolved": "boolean",
|
|
289
259
|
"references": {}
|
|
290
260
|
},
|
|
291
261
|
"required": false,
|
|
292
262
|
"optional": false,
|
|
293
263
|
"docs": {
|
|
294
264
|
"tags": [],
|
|
295
|
-
"text": "
|
|
265
|
+
"text": "Deixa o campo dispon\u00EDvel ou n\u00E3o para digita\u00E7\u00E3o."
|
|
296
266
|
},
|
|
297
|
-
"attribute": "
|
|
298
|
-
"reflect":
|
|
267
|
+
"attribute": "enabled",
|
|
268
|
+
"reflect": false,
|
|
269
|
+
"defaultValue": "true"
|
|
299
270
|
},
|
|
300
|
-
"
|
|
271
|
+
"maxfilesize": {
|
|
301
272
|
"type": "number",
|
|
302
273
|
"mutable": false,
|
|
303
274
|
"complexType": {
|
|
@@ -309,29 +280,46 @@ export class EzUpload {
|
|
|
309
280
|
"optional": false,
|
|
310
281
|
"docs": {
|
|
311
282
|
"tags": [],
|
|
312
|
-
"text": "Define o
|
|
283
|
+
"text": "Define o tamanho m\u00E1ximo (em bytes) de cada arquivo que pode ser transferido"
|
|
313
284
|
},
|
|
314
|
-
"attribute": "
|
|
315
|
-
"reflect":
|
|
285
|
+
"attribute": "maxfilesize",
|
|
286
|
+
"reflect": false
|
|
316
287
|
},
|
|
317
|
-
"
|
|
318
|
-
"type": "
|
|
288
|
+
"maxfiles": {
|
|
289
|
+
"type": "number",
|
|
319
290
|
"mutable": false,
|
|
320
291
|
"complexType": {
|
|
321
|
-
"original": "
|
|
322
|
-
"resolved": "
|
|
292
|
+
"original": "number",
|
|
293
|
+
"resolved": "number",
|
|
323
294
|
"references": {}
|
|
324
295
|
},
|
|
325
296
|
"required": false,
|
|
326
297
|
"optional": false,
|
|
327
298
|
"docs": {
|
|
328
299
|
"tags": [],
|
|
329
|
-
"text": "Define
|
|
300
|
+
"text": "Define um limite para a quantidade de arquivos"
|
|
330
301
|
},
|
|
331
|
-
"attribute": "
|
|
332
|
-
"reflect":
|
|
302
|
+
"attribute": "maxfiles",
|
|
303
|
+
"reflect": false
|
|
333
304
|
},
|
|
334
|
-
"
|
|
305
|
+
"requestheaders": {
|
|
306
|
+
"type": "any",
|
|
307
|
+
"mutable": false,
|
|
308
|
+
"complexType": {
|
|
309
|
+
"original": "any",
|
|
310
|
+
"resolved": "any",
|
|
311
|
+
"references": {}
|
|
312
|
+
},
|
|
313
|
+
"required": false,
|
|
314
|
+
"optional": false,
|
|
315
|
+
"docs": {
|
|
316
|
+
"tags": [],
|
|
317
|
+
"text": "Headers para a requisi\u00E7\u00E3o Http"
|
|
318
|
+
},
|
|
319
|
+
"attribute": "requestheaders",
|
|
320
|
+
"reflect": false
|
|
321
|
+
},
|
|
322
|
+
"urlupload": {
|
|
335
323
|
"type": "string",
|
|
336
324
|
"mutable": false,
|
|
337
325
|
"complexType": {
|
|
@@ -343,12 +331,12 @@ export class EzUpload {
|
|
|
343
331
|
"optional": false,
|
|
344
332
|
"docs": {
|
|
345
333
|
"tags": [],
|
|
346
|
-
"text": "Define a
|
|
334
|
+
"text": "Define a URL de upload"
|
|
347
335
|
},
|
|
348
|
-
"attribute": "
|
|
349
|
-
"reflect":
|
|
336
|
+
"attribute": "urlupload",
|
|
337
|
+
"reflect": false
|
|
350
338
|
},
|
|
351
|
-
"
|
|
339
|
+
"urldelete": {
|
|
352
340
|
"type": "string",
|
|
353
341
|
"mutable": false,
|
|
354
342
|
"complexType": {
|
|
@@ -360,22 +348,22 @@ export class EzUpload {
|
|
|
360
348
|
"optional": false,
|
|
361
349
|
"docs": {
|
|
362
350
|
"tags": [],
|
|
363
|
-
"text": "Define a URL do
|
|
351
|
+
"text": "Define a URL do dele\u00E7\u00E3o"
|
|
364
352
|
},
|
|
365
|
-
"attribute": "
|
|
366
|
-
"reflect":
|
|
353
|
+
"attribute": "urldelete",
|
|
354
|
+
"reflect": false
|
|
367
355
|
},
|
|
368
356
|
"value": {
|
|
369
357
|
"type": "unknown",
|
|
370
|
-
"mutable":
|
|
358
|
+
"mutable": true,
|
|
371
359
|
"complexType": {
|
|
372
|
-
"original": "Array<
|
|
373
|
-
"resolved": "
|
|
360
|
+
"original": "Array<EzFile>",
|
|
361
|
+
"resolved": "EzFile[]",
|
|
374
362
|
"references": {
|
|
375
363
|
"Array": {
|
|
376
364
|
"location": "global"
|
|
377
365
|
},
|
|
378
|
-
"
|
|
366
|
+
"EzFile": {
|
|
379
367
|
"location": "local"
|
|
380
368
|
}
|
|
381
369
|
}
|
|
@@ -389,51 +377,6 @@ export class EzUpload {
|
|
|
389
377
|
}
|
|
390
378
|
}; }
|
|
391
379
|
static get events() { return [{
|
|
392
|
-
"method": "validatedEvent",
|
|
393
|
-
"name": "validatedEvent",
|
|
394
|
-
"bubbles": true,
|
|
395
|
-
"cancelable": true,
|
|
396
|
-
"composed": true,
|
|
397
|
-
"docs": {
|
|
398
|
-
"tags": [],
|
|
399
|
-
"text": "Evento emitido ao validar um arquivo"
|
|
400
|
-
},
|
|
401
|
-
"complexType": {
|
|
402
|
-
"original": "{ isValid: boolean, fileName: string }",
|
|
403
|
-
"resolved": "{ isValid: boolean; fileName: string; }",
|
|
404
|
-
"references": {}
|
|
405
|
-
}
|
|
406
|
-
}, {
|
|
407
|
-
"method": "initUploadEvent",
|
|
408
|
-
"name": "initUploadEvent",
|
|
409
|
-
"bubbles": true,
|
|
410
|
-
"cancelable": true,
|
|
411
|
-
"composed": true,
|
|
412
|
-
"docs": {
|
|
413
|
-
"tags": [],
|
|
414
|
-
"text": "Evento emitido ao iniciar o upload de um arquivo"
|
|
415
|
-
},
|
|
416
|
-
"complexType": {
|
|
417
|
-
"original": "string",
|
|
418
|
-
"resolved": "string",
|
|
419
|
-
"references": {}
|
|
420
|
-
}
|
|
421
|
-
}, {
|
|
422
|
-
"method": "finishedUploadEvent",
|
|
423
|
-
"name": "finishedUploadEvent",
|
|
424
|
-
"bubbles": true,
|
|
425
|
-
"cancelable": true,
|
|
426
|
-
"composed": true,
|
|
427
|
-
"docs": {
|
|
428
|
-
"tags": [],
|
|
429
|
-
"text": "Evento emitido ao finalizar o upload de um arquivo"
|
|
430
|
-
},
|
|
431
|
-
"complexType": {
|
|
432
|
-
"original": "{ isValid: boolean, fileName: string }",
|
|
433
|
-
"resolved": "{ isValid: boolean; fileName: string; }",
|
|
434
|
-
"references": {}
|
|
435
|
-
}
|
|
436
|
-
}, {
|
|
437
380
|
"method": "ezChange",
|
|
438
381
|
"name": "ezChange",
|
|
439
382
|
"bubbles": true,
|
|
@@ -444,13 +387,13 @@ export class EzUpload {
|
|
|
444
387
|
"text": "Evento emitido ao finalizar o upload de um arquivo"
|
|
445
388
|
},
|
|
446
389
|
"complexType": {
|
|
447
|
-
"original": "
|
|
448
|
-
"resolved": "
|
|
390
|
+
"original": "Array<EzFile>",
|
|
391
|
+
"resolved": "EzFile[]",
|
|
449
392
|
"references": {
|
|
450
393
|
"Array": {
|
|
451
394
|
"location": "global"
|
|
452
395
|
},
|
|
453
|
-
"
|
|
396
|
+
"EzFile": {
|
|
454
397
|
"location": "local"
|
|
455
398
|
}
|
|
456
399
|
}
|
|
@@ -459,12 +402,22 @@ export class EzUpload {
|
|
|
459
402
|
static get methods() { return {
|
|
460
403
|
"addFiles": {
|
|
461
404
|
"complexType": {
|
|
462
|
-
"signature": "(files:
|
|
405
|
+
"signature": "(files: Array<File>) => Promise<void>",
|
|
463
406
|
"parameters": [{
|
|
464
407
|
"tags": [],
|
|
465
408
|
"text": ""
|
|
466
409
|
}],
|
|
467
|
-
"references": {
|
|
410
|
+
"references": {
|
|
411
|
+
"Promise": {
|
|
412
|
+
"location": "global"
|
|
413
|
+
},
|
|
414
|
+
"Array": {
|
|
415
|
+
"location": "global"
|
|
416
|
+
},
|
|
417
|
+
"File": {
|
|
418
|
+
"location": "global"
|
|
419
|
+
}
|
|
420
|
+
},
|
|
468
421
|
"return": "Promise<void>"
|
|
469
422
|
},
|
|
470
423
|
"docs": {
|
|
@@ -473,4 +426,12 @@ export class EzUpload {
|
|
|
473
426
|
}
|
|
474
427
|
}
|
|
475
428
|
}; }
|
|
429
|
+
static get elementRef() { return "_host"; }
|
|
430
|
+
static get watchers() { return [{
|
|
431
|
+
"propName": "value",
|
|
432
|
+
"methodName": "changeValue"
|
|
433
|
+
}, {
|
|
434
|
+
"propName": "requestheaders",
|
|
435
|
+
"methodName": "normalizeRequestHeaders"
|
|
436
|
+
}]; }
|
|
476
437
|
}
|