@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.
Files changed (54) hide show
  1. package/dist/cjs/ez-button_16.cjs.entry.js +328 -206
  2. package/dist/cjs/ez-dialog.cjs.entry.js +4 -4
  3. package/dist/cjs/ez-popup.cjs.entry.js +3 -3
  4. package/dist/cjs/ez-toast.cjs.entry.js +37 -0
  5. package/dist/cjs/ezui.cjs.js +1 -1
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/collection/collection-manifest.json +2 -1
  8. package/dist/collection/components/ez-combo-box/ez-combo-box.js +18 -8
  9. package/dist/collection/components/ez-dialog/ez-dialog.js +16 -12
  10. package/dist/collection/components/ez-form/assets/trash-can-outline.svg +3 -0
  11. package/dist/collection/components/ez-form/ez-form.js +9 -0
  12. package/dist/collection/components/ez-form/subcomponents/DataUnit.js +2 -1
  13. package/dist/collection/components/ez-form/subcomponents/form-metadata.js +1 -5
  14. package/dist/collection/components/ez-form/subcomponents/structure/Field.js +2 -3
  15. package/dist/collection/components/ez-form/subcomponents/structure/NavigationBar.js +6 -3
  16. package/dist/collection/components/ez-popup/ez-popup.js +5 -5
  17. package/dist/collection/components/ez-search/ez-search.js +9 -7
  18. package/dist/collection/components/ez-toast/ez-toast.css +108 -0
  19. package/dist/collection/components/ez-toast/ez-toast.js +113 -0
  20. package/dist/collection/components/ez-upload/RemoteFile.js +89 -0
  21. package/dist/collection/components/ez-upload/ez-upload.css +16 -1
  22. package/dist/collection/components/ez-upload/ez-upload.js +257 -296
  23. package/dist/collection/utils/Application.js +34 -0
  24. package/dist/custom-elements/index.d.ts +6 -0
  25. package/dist/custom-elements/index.js +375 -219
  26. package/dist/esm/ez-button_16.entry.js +328 -206
  27. package/dist/esm/ez-dialog.entry.js +4 -4
  28. package/dist/esm/ez-popup.entry.js +3 -3
  29. package/dist/esm/ez-toast.entry.js +33 -0
  30. package/dist/esm/ezui.js +1 -1
  31. package/dist/esm/loader.js +1 -1
  32. package/dist/ezui/assets/trash-can-outline.svg +3 -0
  33. package/dist/ezui/ezui.esm.js +1 -1
  34. package/dist/ezui/p-1ff02df6.entry.js +1 -0
  35. package/dist/ezui/p-243c6972.entry.js +1 -0
  36. package/dist/ezui/p-4a87d740.entry.js +1 -0
  37. package/dist/ezui/p-c3b18332.entry.js +1 -0
  38. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +2 -1
  39. package/dist/types/components/ez-dialog/ez-dialog.d.ts +3 -3
  40. package/dist/types/components/ez-form/ez-form.d.ts +2 -0
  41. package/dist/types/components/ez-popup/ez-popup.d.ts +1 -1
  42. package/dist/types/components/ez-search/ez-search.d.ts +1 -1
  43. package/dist/types/components/ez-toast/ez-toast.d.ts +17 -0
  44. package/dist/types/components/ez-upload/RemoteFile.d.ts +14 -0
  45. package/dist/types/components/ez-upload/ez-upload.d.ts +51 -57
  46. package/dist/types/components.d.ts +95 -61
  47. package/dist/types/utils/Application.d.ts +6 -0
  48. package/package.json +2 -2
  49. package/react/components.d.ts +1 -0
  50. package/react/components.js +1 -0
  51. package/react/components.js.map +1 -1
  52. package/dist/ezui/p-40fe4f51.entry.js +0 -1
  53. package/dist/ezui/p-caa50ec5.entry.js +0 -1
  54. package/dist/ezui/p-e8a91edd.entry.js +0 -1
@@ -319,12 +319,18 @@ let EzComboBox = class {
319
319
  }
320
320
  getText() {
321
321
  let text = '';
322
- const selected = this.value;
322
+ const selected = this.getSelectedOption();
323
323
  if (selected) {
324
324
  text = this.showselectedvalue ? `${selected.value} - ${selected.label}` : selected.label;
325
325
  }
326
326
  return text;
327
327
  }
328
+ getSelectedOption() {
329
+ if (typeof this.value === 'string' || this.value instanceof String) {
330
+ return this._visibleOptions.find(o => o.value === this.value);
331
+ }
332
+ return this.value;
333
+ }
328
334
  updateVisibleOptions() {
329
335
  let opts = this._source || [];
330
336
  if (!this.searchmode && this._criteria) {
@@ -393,9 +399,11 @@ let EzComboBox = class {
393
399
  }
394
400
  }
395
401
  selectOption(opt) {
396
- if (this.value !== opt) {
397
- this.value = !(opt === null || opt === void 0 ? void 0 : opt.value) ? null : opt;
398
- this.ezChange.emit(this.value);
402
+ const currentOpt = this.getSelectedOption();
403
+ if (currentOpt !== opt) {
404
+ const adjustedOpt = !(opt === null || opt === void 0 ? void 0 : opt.value) ? null : opt;
405
+ this.value = adjustedOpt;
406
+ this.ezChange.emit(adjustedOpt);
399
407
  }
400
408
  else {
401
409
  this.internalUpdate();
@@ -2130,11 +2138,48 @@ function showHideNavBtn(state, { buttonName, status }) {
2130
2138
  return Object.assign(Object.assign({}, state), { visibleButtons });
2131
2139
  }
2132
2140
 
2133
- function removeHandler(dataUnit) {
2134
- if (confirm("Tem certeza que deseja Remover?")) {
2135
- dataUnit.remove();
2141
+ class Application {
2142
+ static async showDialog(title, message, icon = null, confirm, critical = false) {
2143
+ return new Promise(resolve => {
2144
+ let dialog = document.querySelector("ez-dialog");
2145
+ if (!dialog) {
2146
+ dialog = document.createElement("ez-dialog");
2147
+ window.document.body.appendChild(dialog);
2148
+ }
2149
+ dialog.ezTitle = title;
2150
+ dialog.message = message;
2151
+ dialog.critical = critical;
2152
+ dialog.confirm = confirm;
2153
+ dialog.personalizedIconPath = icon;
2154
+ dialog.oppened = true;
2155
+ dialog.addEventListener("ezChange", (evt) => resolve(evt.detail));
2156
+ });
2157
+ }
2158
+ static async alert(title, message, icon = null) {
2159
+ return Application.showDialog(title, message, icon, false, false);
2160
+ }
2161
+ static async confirm(title, message, icon = null, critical = false) {
2162
+ return Application.showDialog(title, message, icon, true, critical);
2163
+ }
2164
+ static async info(message) {
2165
+ let toast = document.querySelector("ez-toast");
2166
+ if (!toast) {
2167
+ toast = document.createElement("ez-toast");
2168
+ window.document.body.appendChild(toast);
2169
+ }
2170
+ toast.message = message;
2171
+ toast.fadeTime = 4000;
2172
+ toast.show();
2136
2173
  }
2137
2174
  }
2175
+
2176
+ function removeHandler(dataUnit) {
2177
+ Application.confirm("Exclusão de registro", "Tem certeza que deseja Remover?", null, true).then(ok => {
2178
+ if (ok) {
2179
+ dataUnit.remove();
2180
+ }
2181
+ });
2182
+ }
2138
2183
  const NavigationBar = ({ dataUnit: du, buttonProps, enabled }) => {
2139
2184
  if (buttonProps.previousVisible
2140
2185
  || buttonProps.nextVisible
@@ -2468,7 +2513,7 @@ class DataUnit {
2468
2513
  });
2469
2514
  const result = this.recordsValidator.validateRecords(this, recordsToValidate, triggedBy);
2470
2515
  if (result.message) {
2471
- alert(result.message);
2516
+ Application.info(result.message);
2472
2517
  }
2473
2518
  return result.isValid;
2474
2519
  }
@@ -2546,10 +2591,9 @@ const Field = ({ dataUnit, field, forceScroll, enabled }) => {
2546
2591
  const target = getProp(properties, 'URL');
2547
2592
  const strHeaders = getProp(properties, 'HEADERS');
2548
2593
  const headers = strHeaders ? JSON.parse(strHeaders) : {};
2594
+ const maxfiles = Number(getProp(properties, "maxfiles") || 0);
2549
2595
  return (index.h("div", { class: "col col--sd-12 padding--small" },
2550
- index.h("ez-upload", { onEzChange: (event) => {
2551
- changeFieldHandler(event.target['value']);
2552
- }, target: target, headers: headers, value: value })));
2596
+ index.h("ez-upload", { value: value, label: formattedLabel, enabled: isEnabled, onEzChange: (event) => changeFieldHandler(event.detail), urlupload: target, requestheaders: headers, maxfiles: maxfiles })));
2553
2597
  case 'DATE':
2554
2598
  return index.h("div", { class: "col col--sd-12 col--tb-3 padding--small" }, loadingData ? index.h("place-holder", null) :
2555
2599
  index.h("ez-date-input", { value: !value ? null : DateUtils.clearTime(value), label: formattedLabel, enabled: isEnabled, onEzChange: (event) => changeFieldHandler(event.target['value']), errormessage: errorMessage, ref: elem => scrollToView(forceScroll, elem), key: key }));
@@ -2643,6 +2687,7 @@ let EzForm = class {
2643
2687
  this._dataUnits = new Map();
2644
2688
  this._duSources = new Map();
2645
2689
  this._tabPositionByField = new Map();
2690
+ this._duToLoad = [];
2646
2691
  }
2647
2692
  cleanPreparedMetadata() {
2648
2693
  this._preparedMetadata = undefined;
@@ -2782,6 +2827,9 @@ let EzForm = class {
2782
2827
  };
2783
2828
  this._preparedMetadata = metadata.map((form, index) => {
2784
2829
  const du = form.dataUnit;
2830
+ if (form.autoLoad) {
2831
+ this._duToLoad.push(du);
2832
+ }
2785
2833
  this.decorateDU(du);
2786
2834
  const duName = du.name;
2787
2835
  this._duSources.set(duName, du);
@@ -2823,6 +2871,10 @@ let EzForm = class {
2823
2871
  }
2824
2872
  }
2825
2873
  }
2874
+ componentDidRender() {
2875
+ this._duToLoad.forEach(du => du.load());
2876
+ this._duToLoad = [];
2877
+ }
2826
2878
  loadSearch(argument, context) {
2827
2879
  const fieldSearchExecutor = this.parseExecutor(this.fieldsearchexecutor);
2828
2880
  if (fieldSearchExecutor) {
@@ -2864,6 +2916,7 @@ let EzForm = class {
2864
2916
  render() {
2865
2917
  return this._preparedMetadata ? index.h(FormSheet, { enabled: this.enabled, store: this._store, source: this._preparedMetadata, parentName: "__MAIN__FORM__", dataUnitBuilder: (du, parentDataUnit) => this.buildDataUnit(du, parentDataUnit) }) : null;
2866
2918
  }
2919
+ static get assetsDirs() { return ["assets"]; }
2867
2920
  get _host() { return index.getElement(this); }
2868
2921
  static get watchers() { return {
2869
2922
  "metadata": ["cleanPreparedMetadata"]
@@ -2961,8 +3014,9 @@ let EzSearch = class {
2961
3014
  }
2962
3015
  }
2963
3016
  onComboChange(evt) {
2964
- this.value = this._comboElement.value;
2965
- this.ezChange.emit(this.value);
3017
+ evt.stopPropagation();
3018
+ this.value = evt.detail;
3019
+ this.ezChange.emit(evt.detail);
2966
3020
  }
2967
3021
  render() {
2968
3022
  return (index.h("ez-combo-box", { ref: elem => this._comboElement = elem, value: this.value, label: this.label, enabled: this.enabled, errormessage: this.errormessage, optionloader: this.optionloader, searchmode: true, onEzChange: evt => this.onComboChange(evt), showselectedvalue: this.showselectedvalue, showoptionvalue: this.showoptionvalue }));
@@ -3478,142 +3532,218 @@ let EzTextInput = class {
3478
3532
  };
3479
3533
  EzTextInput.style = ezTextInputCss;
3480
3534
 
3481
- const ezUploadCss = ":host{--iu--height:42px;--iu--width:100%;--iu__icon--width:48px;--iu__container--background-color:var(--background--medium, #d2dce9);--iu__color--primary:var(--color--primary, #008561);--iu--padding--extra-small:var(--space--extra-small, 3px);--iu--padding--small:var(--space--small, 6px);--iu--padding--medium:var(--space--medium, 12px);--iu--padding--large:var(--space--large, 24px);--iu--border-radius:var(--border--radius-medium, 12px);--iu__border--color:var(--color-strokes, #DCE0E8);--iu__input--border:var(--border--medium, 2px solid);--iu--text-shadow:var(--text-shadow, 0 0 0 #353535, 0 0 1px transparent);--iu--text--primary:var(--text-primary, #626e82);--iu--font-size:var(--text--medium, 14px);--iu--font-family:var(--font-pattern, Arial);--iu--font-weight:var(--text-weight--large, 500);display:flex;flex-wrap:wrap;position:relative;font-family:var(--iu--font-family);font-size:var(--iu--font-size);width:var(--iu--width);font-weight:var(--iu--font-weight)}.iu{display:flex;flex-wrap:wrap;background-color:var(--iu__container--background-color);padding:var(--iu--padding--small);width:100%;border-radius:12px;box-sizing:border-box}.iu__container{width:100%;height:100%;display:flex;flex-wrap:wrap;justify-content:center;align-items:center;border:2px dashed var(--iu__border--color);border-radius:6px;box-sizing:border-box}.iu__footer{display:flex;flex-wrap:wrap;justify-content:flex-start;width:100%;padding:0 var(--iu--padding--medium) var(--iu--padding--medium) var(--iu--padding--medium);box-sizing:border-box}.iu__item{display:flex;width:100%;justify-content:flex-start;align-items:center;align-self:center;padding-bottom:var(--iu--padding--extra-small);box-sizing:border-box;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.iu__item-label{display:flex;max-width:80%;align-self:stretch;align-items:center}.file__name{font-weight:200}.box__content{width:100%;justify-content:center;align-items:center;height:100%;border:1px dashed var(--iu__border--color);border-radius:6px;box-sizing:border-box}.box__container{display:flex;flex-wrap:wrap;background-color:var(--iu__container--background-color);padding:6px;width:100%;border-radius:12px}a:-webkit-any-link{color:#008561;fill:#008561;cursor:pointer;text-decoration:none}progress[value]{display:flex;width:100%;appearance:none;border:1px solid var(--iu__border--color);height:12px;justify-content:flex-start;align-items:center;border-radius:3px;position:relative}progress[value]::-webkit-progress-bar{display:flex;-webkit-appearance:none;width:100%;background-color:rgb(255, 255, 255);border-radius:2px;padding:2px}progress[value]::-webkit-progress-value{display:flex;width:100%;background-color:var(--iu__color--primary)}.text--center{text-align:center}.align--middle{align-self:center;align-items:center}.text{font-family:\"Sora\", \"Algerian\";text-shadow:0 0 0 #353535, 0 0 1px transparent}.text--primary{color:var(--iu--text--primary);text-shadow:var(--iu--text-shadow)}.text--ellipsis{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.text--medium{font-size:14px}.text--small{font-size:12px}.btn-cancel{outline:none;border:none;background-color:unset;cursor:pointer}.btn-cancel::after{content:'';display:flex;background-color:var(--text--primary, #008561);width:8px;height:8px;clip-path:path(\"M 8,0.8 7.2,0 4,3.2 0.8,0 0,0.8 3.2,4 0,7.2 0.8,8 4,4.8 7.2,8 8,7.2 4.8,4 Z\")}.iu__file-icon{outline:none;border:none;background-color:unset;cursor:pointer}.iu__file-icon::after{content:'';display:flex;background-color:var(--text--primary, #626e82);width:9px;height:11px;clip-path:path(\"M 1.2272719,8.4999999 V 2.75 c 0,-1.1045695 1.4652499,-2 3.2727273,-2 1.8074777,0 3.2727281,0.8954305 3.2727281,2 V 8.9999999 C 7.7727273,9.690356 6.8569456,10.25 5.7272719,10.25 4.5975985,10.25 3.6818174,9.690356 3.6818174,8.9999999 V 3.75 c 0,-0.2761425 0.3663125,-0.5 0.8181818,-0.5 0.4518694,0 0.8181818,0.2238575 0.8181818,0.5 V 8.4999999 H 6.5454537 V 3.75 C 6.5454537,3.059644 5.6296725,2.5 4.4999992,2.5 3.3703258,2.5 2.4545446,3.059644 2.4545446,3.75 V 8.9999999 C 2.4545446,10.10457 3.9197945,11 5.7272719,11 7.5347496,11 9,10.10457 9,8.9999999 V 2.75 C 9,1.231217 6.9852809,0 4.4999992,0 2.0147181,5e-7 0,1.231217 0,2.75 v 5.7499999 z\")}.iu__icon-label{justify-content:center;display:flex;cursor:pointer;padding:var(--iu--padding--large) 0px;box-sizing:border-box}.row{width:100%;display:flex;flex-wrap:wrap}.col{display:flex;flex-wrap:wrap;align-self:flex-start;box-sizing:border-box}.col--stretch{align-self:stretch}.col--undefined{width:unset}.col--nowrap{flex-wrap:nowrap}@media screen and (min-width: 320px){.col--sd-1{width:8.33333%}.col--sd-2{width:16.66667%}.col--sd-3{width:25%}.col--sd-4{width:33.33333%}.col--sd-5{width:41.66667%}.col--sd-6{width:50%}.col--sd-7{width:58.33333%}.col--sd-8{width:66.66667%}.col--sd-9{width:75%}.col--sd-10{width:83.33333%}.col--sd-11{width:91.66667%}.col--sd-12{width:100%}}@media screen and (min-width: 480px){.col--pn-1{width:8.33333%}.col--pn-2{width:16.66667%}.col--pn-3{width:25%}.col--pn-4{width:33.33333%}.col--pn-5{width:41.66667%}.col--pn-6{width:50%}.col--pn-7{width:58.33333%}.col--pn-8{width:66.66667%}.col--pn-9{width:75%}.col--pn-10{width:83.33333%}.col--pn-11{width:91.66667%}.col--pn-12{width:100%}}@media screen and (min-width: 768px){.col--tb-1{width:8.33333%}.col--tb-2{width:16.66667%}.col--tb-3{width:25%}.col--tb-4{width:33.33333%}.col--tb-5{width:41.66667%}.col--tb-6{width:50%}.col--tb-7{width:58.33333%}.col--tb-8{width:66.66667%}.col--tb-9{width:75%}.col--tb-10{width:83.33333%}.col--tb-11{width:91.66667%}.col--tb-12{width:100%}}@media screen and (min-width: 992px){.col--md-1{width:8.33333%}.col--md-2{width:16.66667%}.col--md-3{width:25%}.col--md-4{width:33.33333%}.col--md-5{width:41.66667%}.col--md-6{width:50%}.col--md-7{width:58.33333%}.col--md-8{width:66.66667%}.col--md-9{width:75%}.col--md-10{width:83.33333%}.col--md-11{width:91.66667%}.col--md-12{width:100%}}@media screen and (min-width: 1200px){.col--ld-1{width:8.33333%}.col--ld-2{width:16.66667%}.col--ld-3{width:25%}.col--ld-4{width:33.33333%}.col--ld-5{width:41.66667%}.col--ld-6{width:50%}.col--ld-7{width:58.33333%}.col--ld-8{width:66.66667%}.col--ld-9{width:75%}.col--ld-10{width:83.33333%}.col--ld-11{width:91.66667%}.col--ld-12{width:100%}}";
3535
+ class RemoteFile {
3536
+ constructor(file) {
3537
+ this.file = file;
3538
+ this.size = file.size;
3539
+ this.name = file.name;
3540
+ }
3541
+ abortUpload() {
3542
+ if (this._uploadingXhr) {
3543
+ this._aborted = true;
3544
+ this._uploadingXhr.abort();
3545
+ this._uploadingXhr = undefined;
3546
+ }
3547
+ }
3548
+ isUploading() {
3549
+ return this._uploadingXhr !== undefined;
3550
+ }
3551
+ async upload(server, headers, updateCallBack) {
3552
+ return new Promise((resolve, reject) => {
3553
+ const xhr = new XMLHttpRequest();
3554
+ this._uploadingXhr = xhr;
3555
+ this._aborted = false;
3556
+ this.progress = 0;
3557
+ xhr.upload.onprogress = (e) => {
3558
+ const loaded = e.loaded;
3559
+ const total = e.total;
3560
+ this.progress = ~~((loaded / total) * 100);
3561
+ updateCallBack(this, loaded, total);
3562
+ };
3563
+ xhr.onreadystatechange = () => {
3564
+ if (xhr.readyState == 4) {
3565
+ this._uploadingXhr = undefined;
3566
+ const status = xhr.status;
3567
+ if (!this._aborted) {
3568
+ if (status === 0) {
3569
+ reject("Servidor indisponível");
3570
+ }
3571
+ else if (status >= 500) {
3572
+ reject("Erro inesperado no servidor");
3573
+ }
3574
+ else if (status >= 400) {
3575
+ reject("Operação não permitida");
3576
+ }
3577
+ }
3578
+ const response = xhr.response;
3579
+ if (response) {
3580
+ resolve(JSON.parse(response));
3581
+ }
3582
+ }
3583
+ };
3584
+ xhr.ontimeout = () => {
3585
+ reject("Tempo limite de transferência atingido.");
3586
+ };
3587
+ const formData = new FormData();
3588
+ formData.append("ARQUIVO", this.file, this.file.name);
3589
+ xhr.open("POST", server, true);
3590
+ if (headers) {
3591
+ headers.forEach((value, key) => xhr.setRequestHeader(key, value));
3592
+ }
3593
+ xhr.send(formData);
3594
+ });
3595
+ }
3596
+ async delete(item, server, headers) {
3597
+ return new Promise((resolve, reject) => {
3598
+ const xhr = new XMLHttpRequest();
3599
+ xhr.onreadystatechange = () => {
3600
+ if (xhr.readyState == 4) {
3601
+ if (xhr.status === 0) {
3602
+ reject("Servidor indisponível");
3603
+ }
3604
+ else if (xhr.status >= 500) {
3605
+ reject("Erro inesperado no servidor");
3606
+ }
3607
+ else if (xhr.status >= 400) {
3608
+ reject("Operação não permitida");
3609
+ }
3610
+ resolve(true);
3611
+ }
3612
+ };
3613
+ xhr.ontimeout = () => {
3614
+ reject("Tempo limite de remoção atingido.");
3615
+ };
3616
+ xhr.open("DELETE", server, true);
3617
+ if (headers) {
3618
+ headers.forEach((value, key) => xhr.setRequestHeader(key, value));
3619
+ }
3620
+ xhr.send(JSON.stringify(item));
3621
+ });
3622
+ }
3623
+ }
3624
+
3625
+ const ezUploadCss = ":host{--iu--height:42px;--iu--width:100%;--iu__icon--width:48px;--iu__container--background-color:var(--background--medium, #d2dce9);--iu__color--primary:var(--color--primary, #008561);--iu--padding--extra-small:var(--space--extra-small, 3px);--iu--padding--small:var(--space--small, 6px);--iu--padding--medium:var(--space--medium, 12px);--iu--padding--large:var(--space--large, 24px);--iu--border-radius:var(--border--radius-medium, 12px);--iu__border--color:var(--color-strokes, #DCE0E8);--iu__input--border:var(--border--medium, 2px solid);--iu--text-shadow:var(--text-shadow, 0 0 0 #353535, 0 0 1px transparent);--iu--text--primary:var(--text-primary, #626e82);--iu--font-size:var(--text--medium, 14px);--iu--font-family:var(--font-pattern, Arial);--iu--font-weight:var(--text-weight--large, 500);display:flex;flex-wrap:wrap;position:relative;font-family:var(--iu--font-family);font-size:var(--iu--font-size);width:var(--iu--width);font-weight:var(--iu--font-weight)}.iu{display:flex;flex-wrap:wrap;background-color:var(--iu__container--background-color);padding:var(--iu--padding--small);width:100%;border-radius:12px;box-sizing:border-box}.iu__container{width:100%;display:flex;flex-wrap:wrap;justify-content:center;align-items:center;border:2px dashed var(--iu__border--color);border-radius:6px;box-sizing:border-box}.iu__footer{display:flex;flex-wrap:wrap;justify-content:flex-start;width:100%;padding:0 var(--iu--padding--medium) var(--iu--padding--medium) var(--iu--padding--medium);box-sizing:border-box}.iu__item{display:flex;width:100%;justify-content:flex-start;align-items:center;align-self:center;padding-bottom:var(--iu--padding--extra-small);box-sizing:border-box;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.iu__item-label{display:flex;max-width:80%;align-self:stretch;align-items:center}.file__name{font-weight:200}.box__content{width:100%;justify-content:center;align-items:center;height:100%;border:1px dashed var(--iu__border--color);border-radius:6px;box-sizing:border-box}.box__container{display:flex;flex-wrap:wrap;background-color:var(--iu__container--background-color);padding:6px;width:100%;border-radius:12px}a:-webkit-any-link{color:#008561;fill:#008561;cursor:pointer;text-decoration:none}progress[value]{display:flex;width:100%;appearance:none;border:1px solid var(--iu__border--color);height:12px;justify-content:flex-start;align-items:center;border-radius:3px;position:relative}progress[value]::-webkit-progress-bar{display:flex;-webkit-appearance:none;width:100%;background-color:rgb(255, 255, 255);border-radius:2px;padding:2px}progress[value]::-webkit-progress-value{display:flex;width:100%;background-color:var(--iu__color--primary)}.text--center{text-align:center}.align--middle{align-self:center;align-items:center}.text{font-family:\"Sora\", \"Algerian\";text-shadow:0 0 0 #353535, 0 0 1px transparent}.text--primary{color:var(--iu--text--primary);text-shadow:var(--iu--text-shadow)}.text--ellipsis{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.text--medium{font-size:14px}.text--small{font-size:12px}.btn-cancel{outline:none;border:none;background-color:unset;cursor:pointer}.btn-cancel::after{content:'';display:flex;background-color:var(--text--primary, #008561);width:8px;height:8px;clip-path:path(\"M 8,0.8 7.2,0 4,3.2 0.8,0 0,0.8 3.2,4 0,7.2 0.8,8 4,4.8 7.2,8 8,7.2 4.8,4 Z\")}.iu__label{padding:var(--space--small);padding-top:0;box-sizing:border-box;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--iu--font-family);font-size:var(--text--extra-small);font-weight:var( --iu--font-weight);color:var(--iu--text--primary);text-shadow:var(--iu--text-shadow)}.iu__file-icon{outline:none;border:none;background-color:unset;cursor:pointer}.iu__file-icon::after{content:'';display:flex;background-color:var(--text--primary, #626e82);width:9px;height:11px;clip-path:path(\"M 1.2272719,8.4999999 V 2.75 c 0,-1.1045695 1.4652499,-2 3.2727273,-2 1.8074777,0 3.2727281,0.8954305 3.2727281,2 V 8.9999999 C 7.7727273,9.690356 6.8569456,10.25 5.7272719,10.25 4.5975985,10.25 3.6818174,9.690356 3.6818174,8.9999999 V 3.75 c 0,-0.2761425 0.3663125,-0.5 0.8181818,-0.5 0.4518694,0 0.8181818,0.2238575 0.8181818,0.5 V 8.4999999 H 6.5454537 V 3.75 C 6.5454537,3.059644 5.6296725,2.5 4.4999992,2.5 3.3703258,2.5 2.4545446,3.059644 2.4545446,3.75 V 8.9999999 C 2.4545446,10.10457 3.9197945,11 5.7272719,11 7.5347496,11 9,10.10457 9,8.9999999 V 2.75 C 9,1.231217 6.9852809,0 4.4999992,0 2.0147181,5e-7 0,1.231217 0,2.75 v 5.7499999 z\")}.iu__icon-label{justify-content:center;display:flex;cursor:pointer;padding:var(--iu--padding--large) 0px;box-sizing:border-box}.row{width:100%;display:flex;flex-wrap:wrap}.col{display:flex;flex-wrap:wrap;align-self:flex-start;box-sizing:border-box}.col--stretch{align-self:stretch}.col--undefined{width:unset}.col--nowrap{flex-wrap:nowrap}@media screen and (min-width: 320px){.col--sd-1{width:8.33333%}.col--sd-2{width:16.66667%}.col--sd-3{width:25%}.col--sd-4{width:33.33333%}.col--sd-5{width:41.66667%}.col--sd-6{width:50%}.col--sd-7{width:58.33333%}.col--sd-8{width:66.66667%}.col--sd-9{width:75%}.col--sd-10{width:83.33333%}.col--sd-11{width:91.66667%}.col--sd-12{width:100%}}@media screen and (min-width: 480px){.col--pn-1{width:8.33333%}.col--pn-2{width:16.66667%}.col--pn-3{width:25%}.col--pn-4{width:33.33333%}.col--pn-5{width:41.66667%}.col--pn-6{width:50%}.col--pn-7{width:58.33333%}.col--pn-8{width:66.66667%}.col--pn-9{width:75%}.col--pn-10{width:83.33333%}.col--pn-11{width:91.66667%}.col--pn-12{width:100%}}@media screen and (min-width: 768px){.col--tb-1{width:8.33333%}.col--tb-2{width:16.66667%}.col--tb-3{width:25%}.col--tb-4{width:33.33333%}.col--tb-5{width:41.66667%}.col--tb-6{width:50%}.col--tb-7{width:58.33333%}.col--tb-8{width:66.66667%}.col--tb-9{width:75%}.col--tb-10{width:83.33333%}.col--tb-11{width:91.66667%}.col--tb-12{width:100%}}@media screen and (min-width: 992px){.col--md-1{width:8.33333%}.col--md-2{width:16.66667%}.col--md-3{width:25%}.col--md-4{width:33.33333%}.col--md-5{width:41.66667%}.col--md-6{width:50%}.col--md-7{width:58.33333%}.col--md-8{width:66.66667%}.col--md-9{width:75%}.col--md-10{width:83.33333%}.col--md-11{width:91.66667%}.col--md-12{width:100%}}@media screen and (min-width: 1200px){.col--ld-1{width:8.33333%}.col--ld-2{width:16.66667%}.col--ld-3{width:25%}.col--ld-4{width:33.33333%}.col--ld-5{width:41.66667%}.col--ld-6{width:50%}.col--ld-7{width:58.33333%}.col--ld-8{width:66.66667%}.col--ld-9{width:75%}.col--ld-10{width:83.33333%}.col--ld-11{width:91.66667%}.col--ld-12{width:100%}}";
3482
3626
 
3483
3627
  let EzUpload = class {
3484
3628
  constructor(hostRef) {
3485
3629
  index.registerInstance(this, hostRef);
3486
- this.validatedEvent = index.createEvent(this, "validatedEvent", 7);
3487
- this.initUploadEvent = index.createEvent(this, "initUploadEvent", 7);
3488
- this.finishedUploadEvent = index.createEvent(this, "finishedUploadEvent", 7);
3489
3630
  this.ezChange = index.createEvent(this, "ezChange", 7);
3631
+ this._filePointers = new Map();
3632
+ /**
3633
+ * Deixa o campo disponível ou não para digitação.
3634
+ */
3635
+ this.enabled = true;
3490
3636
  }
3491
- fileListChange() {
3492
- this.ezChange.emit({ value: this.value });
3637
+ changeValue(newValue) {
3638
+ if (newValue !== this._updatingValue) {
3639
+ this._filePointers.forEach(f => {
3640
+ if (this.isRemoteFile(f)) {
3641
+ f.abortUpload();
3642
+ }
3643
+ });
3644
+ this._filePointers = new Map();
3645
+ this.updateFilePointers();
3646
+ }
3647
+ this._updatingValue = undefined;
3493
3648
  }
3494
- addFiles(files) {
3495
- Array.prototype.forEach.call(files, this.addFile.bind(this));
3649
+ updateFilePointers() {
3650
+ if (this.value) {
3651
+ this.value.forEach(ezFile => this._filePointers.set(ezFile.name, ezFile));
3652
+ }
3496
3653
  }
3497
- addFile(file) {
3498
- this.errorMessage = undefined;
3499
- if (this.validateFile(file)) {
3500
- if (this.target) {
3501
- this._uploadFile(file);
3654
+ normalizeRequestHeaders() {
3655
+ this._requestHeaders = new Map();
3656
+ if (typeof this.requestheaders == 'string') {
3657
+ try {
3658
+ this.requestheaders = JSON.parse(this.requestheaders);
3502
3659
  }
3503
- else {
3504
- this.errorMessage = "Endereço de upload não informado";
3505
- alert(this.errorMessage);
3660
+ catch (e) {
3661
+ this.requestheaders = undefined;
3506
3662
  }
3507
3663
  }
3508
- else {
3509
- if (this.errorMessage && this.errorMessage.length > 0) {
3510
- alert(this.errorMessage);
3511
- }
3664
+ for (var key in this.requestheaders) {
3665
+ this._requestHeaders.set(key, this.requestheaders[key]);
3512
3666
  }
3513
3667
  }
3514
- validateFile(file) {
3515
- this.errorMessage = '';
3516
- let isValid = true;
3517
- if (this.maxFileSize >= 0 && file.size > this.maxFileSize) {
3518
- this.errorMessage = 'O tamanho máximo dos arquivos é de ' + this.formatBytes(this.maxFileSize);
3519
- isValid = false;
3520
- }
3521
- this.validatedEvent.emit({ isValid: isValid, fileName: file.name });
3522
- return isValid;
3523
- }
3524
- _uploadFile(file) {
3525
- const xhr = (file.xhr = this._createXhr());
3526
- const newValue = this.value ? [...this.value] : [];
3527
- newValue.push({ name: file.name, size: file.size, xhr: file.xhr });
3528
- let stalledId;
3529
- xhr.upload.onprogress = (e) => {
3530
- clearTimeout(stalledId);
3531
- const loaded = e.loaded, total = e.total, progress = ~~((loaded / total) * 100);
3532
- let viewFile = newValue.find(f => f.name === file.name);
3533
- if (viewFile) {
3534
- viewFile.progress = progress;
3535
- }
3536
- };
3537
- xhr.onreadystatechange = () => {
3538
- this.errorMessage = '';
3539
- if (xhr.readyState == 4) {
3540
- clearTimeout(stalledId);
3541
- file.indeterminate = file.uploading = false;
3542
- if (xhr.status === 0) ;
3543
- else if (xhr.status >= 500) {
3544
- this.errorMessage = "Erro inesperado no servidor";
3545
- }
3546
- else if (xhr.status >= 400) {
3547
- this.errorMessage = "Operação não permitida";
3548
- }
3549
- if (this.errorMessage && this.errorMessage.length > 0) {
3550
- //TODO
3551
- // Conferir com o time de UX um estado de erro ou remoção da lista
3552
- // this.removeFile(file.name);
3553
- alert(this.errorMessage);
3554
- }
3555
- else {
3556
- if (xhr.response) {
3557
- let response = JSON.parse(xhr.response);
3558
- response.forEach(element => {
3559
- let viewFile = newValue.find(f => f.name === this.decode_utf8(element.name));
3560
- if (viewFile) {
3561
- viewFile.progress = undefined;
3562
- //Validar estado de erro com UX
3563
- viewFile.error = false;
3564
- delete viewFile.xhr;
3565
- viewFile.downloadURL = element.downloadURL;
3566
- viewFile.lastModifiedDate = element.lastModifiedDate;
3567
- viewFile.properties = element.properties;
3568
- }
3569
- });
3570
- this.value = newValue;
3571
- this.fileListChange();
3572
- }
3573
- else {
3574
- let viewFile = newValue.find(f => f.name === file.name);
3575
- viewFile.progress = undefined;
3576
- //Validar estado de erro com UX
3577
- viewFile.error = true;
3668
+ async addFiles(files) {
3669
+ Array.prototype.forEach.call(files, this.addFile.bind(this));
3670
+ }
3671
+ async addFile(file) {
3672
+ const oldFile = this._filePointers.get(file.name);
3673
+ if (oldFile) {
3674
+ Application.confirm("Substituir arquivo", `Já existe um arquivo chamado "${file.name}". Deseja substituí-lo?`)
3675
+ .then(ok => {
3676
+ if (ok) {
3677
+ if (this.isRemoteFile(oldFile)) {
3678
+ oldFile.abortUpload();
3578
3679
  }
3680
+ this.doAddFile(file);
3579
3681
  }
3682
+ });
3683
+ }
3684
+ else {
3685
+ this.doAddFile(file);
3686
+ }
3687
+ }
3688
+ async doAddFile(file) {
3689
+ if (this.validateFile(file)) {
3690
+ const uploadingFile = new RemoteFile(file);
3691
+ this._filePointers.set(file.name, uploadingFile);
3692
+ uploadingFile.upload(this.urlupload, this._requestHeaders, (file) => this.updateFeedback(file))
3693
+ .then((files) => files.forEach(ezFile => this.finishUpload(ezFile)))
3694
+ .catch(msg => this.showError(msg));
3695
+ index.forceUpdate(this);
3696
+ }
3697
+ }
3698
+ finishUpload(ezFile) {
3699
+ this._filePointers.set(ezFile.name, ezFile);
3700
+ this.updateValue();
3701
+ }
3702
+ updateValue() {
3703
+ this._updatingValue = [];
3704
+ this._filePointers.forEach(f => {
3705
+ if (!this.isRemoteFile(f)) {
3706
+ this._updatingValue.push(f);
3580
3707
  }
3581
- };
3582
- xhr.ontimeout = () => {
3583
- if (this.errorMessage && this.errorMessage.length > 0) {
3584
- this.errorMessage.concat(" / Tempo expirado");
3585
- this.removeFile(file.name);
3586
- alert(this.errorMessage);
3587
- }
3588
- };
3589
- const formData = new FormData();
3590
- formData.append(this.formDataName, file, file.name);
3591
- xhr.open("POST", this.target, true);
3592
- this._configureXhr(xhr);
3593
- file.status = "conectando";
3594
- file.uploading = file.indeterminate = true;
3595
- file.complete = file.abort = file.error = file.held = false;
3596
- xhr.send(formData);
3597
- }
3598
- _createXhr() {
3599
- return new XMLHttpRequest();
3600
- }
3601
- _configureXhr(xhr) {
3602
- if (typeof this.headers == 'string') {
3603
- try {
3604
- this.headers = JSON.parse(this.headers);
3605
- }
3606
- catch (e) {
3607
- this.headers = undefined;
3708
+ });
3709
+ this.value = this._updatingValue;
3710
+ this.ezChange.emit(this.value);
3711
+ }
3712
+ buildProgressId(uploading) {
3713
+ let sanitizedName = uploading.name.replace(/[^a-z0-9_]/gi, '_');
3714
+ return `PROGRESS_${sanitizedName}_${uploading.file.lastModified}`;
3715
+ }
3716
+ updateFeedback(uf) {
3717
+ window.requestAnimationFrame(() => {
3718
+ if (this._host) {
3719
+ const progress = this._host.shadowRoot.querySelector('#' + this.buildProgressId(uf));
3720
+ if (progress) {
3721
+ progress.value = uf.progress;
3722
+ }
3608
3723
  }
3724
+ });
3725
+ }
3726
+ validateFile(file) {
3727
+ if (this.maxfiles > 0 && this._filePointers.size >= this.maxfiles) {
3728
+ this.showError(`A quantidade máxima de arquivos é ${this.maxfiles}.`);
3729
+ return false;
3609
3730
  }
3610
- for (var key in this.headers) {
3611
- xhr.setRequestHeader(key, this.headers[key]);
3731
+ if (file.size === 0) {
3732
+ this.showError(`Erro de permissão: O arquivo "${file.name}" não pode ser enviado.`);
3733
+ return false;
3612
3734
  }
3613
- if (this.timeout) {
3614
- xhr.timeout = this.timeout;
3735
+ if (!this.urlupload) {
3736
+ this.showError("Endereço de upload não informado");
3737
+ return false;
3615
3738
  }
3616
- xhr.withCredentials = this.withCredentials;
3739
+ if (this.maxfilesize >= 0 && file.size > this.maxfilesize) {
3740
+ this.showError("O tamanho máximo dos arquivos é de " + this.formatBytes(this.maxfilesize));
3741
+ return false;
3742
+ }
3743
+ return true;
3744
+ }
3745
+ showError(message) {
3746
+ Application.alert("Enviando arquivo", message);
3617
3747
  }
3618
3748
  formatBytes(bytes, decimals = 1) {
3619
3749
  if (bytes === 0)
@@ -3625,96 +3755,92 @@ let EzUpload = class {
3625
3755
  return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
3626
3756
  }
3627
3757
  onFileInputChange(event) {
3628
- this.addFiles(event.target.files);
3758
+ const input = event.target;
3759
+ this.addFiles(Array.from(input.files));
3629
3760
  this._fileInput.value = '';
3630
3761
  }
3631
- /*componentWillLoad() {
3632
- if (this.fileList?.length > 0) {
3633
- this.fileList.forEach(item => {
3634
- if (item.size) {
3635
- item.strSize = this.formatBytes(item.size);
3636
- }
3637
- })
3638
- this.fileList = [...this.fileList];
3762
+ isRemoteFile(item) {
3763
+ return "file" in item;
3764
+ }
3765
+ removeFromList(name) {
3766
+ this._filePointers.delete(name);
3767
+ this.updateValue();
3768
+ }
3769
+ removeFile(name) {
3770
+ const item = this._filePointers.get(name);
3771
+ if (this.isRemoteFile(item)) {
3772
+ item.abortUpload();
3773
+ this.removeFromList(name);
3774
+ }
3775
+ else {
3776
+ if (this.urldelete) {
3777
+ const uploadingFile = new RemoteFile(null);
3778
+ this._filePointers.set(item.name, uploadingFile);
3779
+ uploadingFile.delete(item, this.urldelete, null)
3780
+ .then(_ok => this.removeFromList(name))
3781
+ .catch(msg => this.showError(msg));
3782
+ }
3783
+ else {
3784
+ this.removeFromList(name);
3785
+ }
3786
+ }
3787
+ }
3788
+ openFilesDialog() {
3789
+ if (this.maxfiles > 0 && this._filePointers.size >= this.maxfiles) {
3790
+ this.showError(`A quantidade máxima de arquivos é ${this.maxfiles}.`);
3791
+ }
3792
+ else {
3793
+ this._fileInput.click();
3639
3794
  }
3640
- }*/
3641
- decode_utf8(s) {
3642
- return decodeURIComponent(escape(s));
3643
3795
  }
3644
3796
  componentDidLoad() {
3645
- if (this.dropZone && window.FileList && window.File) {
3646
- this.dropZone.addEventListener('dragover', event => {
3797
+ if (this._dropZone && window.FileList && window.File) {
3798
+ this._dropZone.addEventListener('dragover', event => {
3647
3799
  event.stopPropagation();
3648
3800
  event.preventDefault();
3649
3801
  event.dataTransfer.dropEffect = 'copy';
3650
3802
  });
3651
- this.dropZone.addEventListener('drop', event => {
3803
+ this._dropZone.addEventListener('drop', event => {
3652
3804
  event.stopPropagation();
3653
3805
  event.preventDefault();
3654
- this.addFiles(event.dataTransfer.files);
3806
+ this.addFiles(Array.from(event.dataTransfer.files));
3655
3807
  });
3656
3808
  }
3657
3809
  }
3658
- removeFile(name, xhr, downloadURL) {
3659
- if (xhr) {
3660
- xhr.abort();
3661
- }
3662
- if (downloadURL) {
3663
- this.removeFileFromServer(name, downloadURL);
3664
- }
3665
- this.value = [...this.value.filter(function (value) { return value.name !== name; })];
3666
- }
3667
- removeFileFromServer(name, donwloadURL) {
3668
- const xhr = this._createXhr();
3669
- this.errorMessage = '';
3670
- let stalledId;
3671
- xhr.onreadystatechange = () => {
3672
- if (xhr.readyState == 4) {
3673
- clearTimeout(stalledId);
3674
- if (xhr.status === 0) {
3675
- this.errorMessage = "Servidor indisponível";
3676
- }
3677
- else if (xhr.status >= 500) {
3678
- this.errorMessage = "Erro inesperado no servidor";
3679
- }
3680
- else if (xhr.status >= 400) {
3681
- this.errorMessage = "Operação não permitida";
3682
- }
3683
- if (this.errorMessage && this.errorMessage.length > 0) {
3684
- //TODO
3685
- // Conferir com o time de UX um estado de erro ou remoção da lista
3686
- // this.removeFile(file.name);
3687
- alert(this.errorMessage);
3688
- }
3689
- }
3690
- };
3691
- xhr.ontimeout = () => {
3692
- if (this.errorMessage && this.errorMessage.length > 0) {
3693
- alert(this.errorMessage);
3810
+ componentWillRender() {
3811
+ if (this.value) {
3812
+ if (this._filePointers.size < this.value.length) {
3813
+ this.updateFilePointers();
3694
3814
  }
3695
- };
3696
- const body = JSON.stringify({
3697
- name: name,
3698
- donwloadURL: donwloadURL,
3699
- });
3700
- xhr.open("DELETE", this.target, true);
3701
- xhr.setRequestHeader('Content-Type', 'application/json');
3702
- this._configureXhr(xhr);
3703
- xhr.send(body);
3815
+ }
3704
3816
  }
3705
3817
  render() {
3706
- var _a;
3707
- return (index.h(index.Host, null, index.h("slot", null, index.h("div", { ref: (el) => this.dropZone = el, class: "iu" }, index.h("div", { class: "iu__container" }, index.h("div", { onClick: () => this._fileInput.click(), class: "iu__icon-label" }, index.h("button", { class: "iu__file-icon" }), index.h("div", { class: "text text--center text--medium text--primary" }, "Arraste e solte ou clique para anexar arquivo")), ((_a = this.value) === null || _a === void 0 ? void 0 : _a.length) > 0 ?
3708
- index.h("div", { class: "iu__footer" }, this.value.map(file => {
3709
- return (index.h("div", { class: "iu__item" }, index.h("div", { class: "iu__item-label" + (file.progress ? " modificador " : " modificador ") }, file.downloadURL ?
3710
- index.h("div", { title: file.name + "(" + this.formatBytes(file.size) + ")", class: "file__name text text--primary text--small text--ellipsis align--middle" }, index.h("a", { href: file.downloadURL, download: true }, file.name, " (", this.formatBytes(file.size), ")"))
3711
- :
3712
- index.h("div", { title: file.name + "(" + this.formatBytes(file.size) + ")", class: "col--stretch align--middle file__name text text--primary text--small text--ellipsis align--middle " }, file.name, " (", this.formatBytes(file.size), ")")), file.progress ?
3713
- index.h("div", { class: "col col--sd-4 col--stretch align--middle" }, index.h("progress", { value: file.progress, max: "100" }))
3714
- : undefined, index.h("div", { class: "col col--stretch align--middle" }, index.h("button", { class: "btn-cancel ", onClick: () => this.removeFile(file.name, file.xhr) }))));
3715
- }))
3716
- : undefined))), index.h("input", { ref: (el) => this._fileInput = el, type: "file", id: "fileInput", hidden: true, onChange: (ev) => this.onFileInputChange(ev), multiple: true })));
3818
+ return (index.h("div", { ref: (el) => this._dropZone = el, class: "iu" }, this.label ? index.h("label", { class: "iu__label", title: this.label }, this.label) : null, index.h("div", { class: "iu__container", onClick: () => this.openFilesDialog() }, index.h("div", { class: "iu__icon-label" }, index.h("button", { class: "iu__file-icon" }), index.h("div", { class: "text text--center text--medium text--primary" }, "Arraste e solte ou clique para adicionar arquivos")), this.buildFooter()), index.h("input", { ref: (el) => this._fileInput = el, onChange: (ev) => this.onFileInputChange(ev), type: "file", multiple: true, hidden: true })));
3819
+ }
3820
+ buildFooter() {
3821
+ if (this._filePointers.size === 0) {
3822
+ return null;
3823
+ }
3824
+ const items = [];
3825
+ this._filePointers.forEach(item => items.push(this.buildFileItem(item)));
3826
+ return (index.h("div", { class: "iu__footer" }, items));
3827
+ }
3828
+ buildFileItem(item) {
3829
+ const fileName = item.name;
3830
+ const progress = Number(item['progress']);
3831
+ const downloadURL = item['downloadURL'];
3832
+ const label = `${fileName} (${this.formatBytes(item.size)})`;
3833
+ return (index.h("div", { class: "iu__item", key: fileName, onClick: evt => evt.stopPropagation() }, index.h("div", { class: "iu__item-label modificador" }, index.h("div", { title: label, class: "col--stretch align--middle file__name text text--primary text--small text--ellipsis align--middle" }, downloadURL ? index.h("a", { href: downloadURL, download: true }, label) : label)), isNaN(progress)
3834
+ ?
3835
+ null
3836
+ :
3837
+ index.h("div", { class: "col col--sd-4 col--stretch align--middle" }, index.h("progress", { id: this.buildProgressId(item), value: progress, max: "100" })), index.h("div", { class: "col col--stretch align--middle" }, index.h("button", { class: "btn-cancel ", onClick: () => this.removeFile(fileName) }))));
3717
3838
  }
3839
+ get _host() { return index.getElement(this); }
3840
+ static get watchers() { return {
3841
+ "value": ["changeValue"],
3842
+ "requestheaders": ["normalizeRequestHeaders"]
3843
+ }; }
3718
3844
  };
3719
3845
  EzUpload.style = ezUploadCss;
3720
3846
 
@@ -3740,11 +3866,6 @@ let FormMetadata = class {
3740
3866
  properties.push({ name: "options", value: JSON.stringify(objOpts) });
3741
3867
  }
3742
3868
  else if (userInterface === "FILE") {
3743
- /*<URL>http://localhost:8080/2a3skw-graphql/uploadFiles</URL>
3744
- <HEADERS>
3745
- <HEADER NAME="Authorization">dsfs</HEADER>
3746
- </HEADER>
3747
- </field> */
3748
3869
  const urlElement = element.querySelector('URL');
3749
3870
  const headersElement = element.querySelectorAll('HEADERS>HEADER');
3750
3871
  if (urlElement) {
@@ -3757,6 +3878,7 @@ let FormMetadata = class {
3757
3878
  });
3758
3879
  properties.push({ name: "HEADERS", value: JSON.stringify(headers) });
3759
3880
  }
3881
+ this.addPropertyIfExists(properties, element, "maxfiles");
3760
3882
  }
3761
3883
  else {
3762
3884
  if (!label) {