@sankhyalabs/ezui 1.1.37 → 1.1.41

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 +318 -207
  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 +246 -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 +364 -219
  26. package/dist/esm/ez-button_16.entry.js +318 -207
  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-4a87d740.entry.js +1 -0
  36. package/dist/ezui/p-c3b18332.entry.js +1 -0
  37. package/dist/ezui/p-e9784201.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 +49 -58
  46. package/dist/types/components.d.ts +95 -61
  47. package/dist/types/utils/Application.d.ts +6 -0
  48. package/package.json +1 -1
  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-964a1871.entry.js +0 -1
  54. package/dist/ezui/p-caa50ec5.entry.js +0 -1
@@ -315,12 +315,18 @@ let EzComboBox = class {
315
315
  }
316
316
  getText() {
317
317
  let text = '';
318
- const selected = this.value;
318
+ const selected = this.getSelectedOption();
319
319
  if (selected) {
320
320
  text = this.showselectedvalue ? `${selected.value} - ${selected.label}` : selected.label;
321
321
  }
322
322
  return text;
323
323
  }
324
+ getSelectedOption() {
325
+ if (typeof this.value === 'string' || this.value instanceof String) {
326
+ return this._visibleOptions.find(o => o.value === this.value);
327
+ }
328
+ return this.value;
329
+ }
324
330
  updateVisibleOptions() {
325
331
  let opts = this._source || [];
326
332
  if (!this.searchmode && this._criteria) {
@@ -389,9 +395,11 @@ let EzComboBox = class {
389
395
  }
390
396
  }
391
397
  selectOption(opt) {
392
- if (this.value !== opt) {
393
- this.value = !(opt === null || opt === void 0 ? void 0 : opt.value) ? null : opt;
394
- this.ezChange.emit(this.value);
398
+ const currentOpt = this.getSelectedOption();
399
+ if (currentOpt !== opt) {
400
+ const adjustedOpt = !(opt === null || opt === void 0 ? void 0 : opt.value) ? null : opt;
401
+ this.value = adjustedOpt;
402
+ this.ezChange.emit(adjustedOpt);
395
403
  }
396
404
  else {
397
405
  this.internalUpdate();
@@ -2126,11 +2134,48 @@ function showHideNavBtn(state, { buttonName, status }) {
2126
2134
  return Object.assign(Object.assign({}, state), { visibleButtons });
2127
2135
  }
2128
2136
 
2129
- function removeHandler(dataUnit) {
2130
- if (confirm("Tem certeza que deseja Remover?")) {
2131
- dataUnit.remove();
2137
+ class Application {
2138
+ static async showDialog(title, message, icon = null, confirm, critical = false) {
2139
+ return new Promise(resolve => {
2140
+ let dialog = document.querySelector("ez-dialog");
2141
+ if (!dialog) {
2142
+ dialog = document.createElement("ez-dialog");
2143
+ window.document.body.appendChild(dialog);
2144
+ }
2145
+ dialog.ezTitle = title;
2146
+ dialog.message = message;
2147
+ dialog.critical = critical;
2148
+ dialog.confirm = confirm;
2149
+ dialog.personalizedIconPath = icon;
2150
+ dialog.oppened = true;
2151
+ dialog.addEventListener("ezChange", (evt) => resolve(evt.detail));
2152
+ });
2153
+ }
2154
+ static async alert(title, message, icon = null) {
2155
+ return Application.showDialog(title, message, icon, false, false);
2156
+ }
2157
+ static async confirm(title, message, icon = null, critical = false) {
2158
+ return Application.showDialog(title, message, icon, true, critical);
2159
+ }
2160
+ static async info(message) {
2161
+ let toast = document.querySelector("ez-toast");
2162
+ if (!toast) {
2163
+ toast = document.createElement("ez-toast");
2164
+ window.document.body.appendChild(toast);
2165
+ }
2166
+ toast.message = message;
2167
+ toast.fadeTime = 4000;
2168
+ toast.show();
2132
2169
  }
2133
2170
  }
2171
+
2172
+ function removeHandler(dataUnit) {
2173
+ Application.confirm("Exclusão de registro", "Tem certeza que deseja Remover?", null, true).then(ok => {
2174
+ if (ok) {
2175
+ dataUnit.remove();
2176
+ }
2177
+ });
2178
+ }
2134
2179
  const NavigationBar = ({ dataUnit: du, buttonProps, enabled }) => {
2135
2180
  if (buttonProps.previousVisible
2136
2181
  || buttonProps.nextVisible
@@ -2464,7 +2509,7 @@ class DataUnit {
2464
2509
  });
2465
2510
  const result = this.recordsValidator.validateRecords(this, recordsToValidate, triggedBy);
2466
2511
  if (result.message) {
2467
- alert(result.message);
2512
+ Application.info(result.message);
2468
2513
  }
2469
2514
  return result.isValid;
2470
2515
  }
@@ -2542,10 +2587,9 @@ const Field = ({ dataUnit, field, forceScroll, enabled }) => {
2542
2587
  const target = getProp(properties, 'URL');
2543
2588
  const strHeaders = getProp(properties, 'HEADERS');
2544
2589
  const headers = strHeaders ? JSON.parse(strHeaders) : {};
2590
+ const maxfiles = Number(getProp(properties, "maxfiles") || 0);
2545
2591
  return (h("div", { class: "col col--sd-12 padding--small" },
2546
- h("ez-upload", { onEzChange: (event) => {
2547
- changeFieldHandler(event.target['value']);
2548
- }, target: target, headers: headers, value: value })));
2592
+ h("ez-upload", { value: value, label: formattedLabel, enabled: isEnabled, onEzChange: (event) => changeFieldHandler(event.detail), urlupload: target, requestheaders: headers, maxfiles: maxfiles })));
2549
2593
  case 'DATE':
2550
2594
  return h("div", { class: "col col--sd-12 col--tb-3 padding--small" }, loadingData ? h("place-holder", null) :
2551
2595
  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 }));
@@ -2639,6 +2683,7 @@ let EzForm = class {
2639
2683
  this._dataUnits = new Map();
2640
2684
  this._duSources = new Map();
2641
2685
  this._tabPositionByField = new Map();
2686
+ this._duToLoad = [];
2642
2687
  }
2643
2688
  cleanPreparedMetadata() {
2644
2689
  this._preparedMetadata = undefined;
@@ -2778,6 +2823,9 @@ let EzForm = class {
2778
2823
  };
2779
2824
  this._preparedMetadata = metadata.map((form, index) => {
2780
2825
  const du = form.dataUnit;
2826
+ if (form.autoLoad) {
2827
+ this._duToLoad.push(du);
2828
+ }
2781
2829
  this.decorateDU(du);
2782
2830
  const duName = du.name;
2783
2831
  this._duSources.set(duName, du);
@@ -2819,6 +2867,10 @@ let EzForm = class {
2819
2867
  }
2820
2868
  }
2821
2869
  }
2870
+ componentDidRender() {
2871
+ this._duToLoad.forEach(du => du.load());
2872
+ this._duToLoad = [];
2873
+ }
2822
2874
  loadSearch(argument, context) {
2823
2875
  const fieldSearchExecutor = this.parseExecutor(this.fieldsearchexecutor);
2824
2876
  if (fieldSearchExecutor) {
@@ -2860,6 +2912,7 @@ let EzForm = class {
2860
2912
  render() {
2861
2913
  return this._preparedMetadata ? h(FormSheet, { enabled: this.enabled, store: this._store, source: this._preparedMetadata, parentName: "__MAIN__FORM__", dataUnitBuilder: (du, parentDataUnit) => this.buildDataUnit(du, parentDataUnit) }) : null;
2862
2914
  }
2915
+ static get assetsDirs() { return ["assets"]; }
2863
2916
  get _host() { return getElement(this); }
2864
2917
  static get watchers() { return {
2865
2918
  "metadata": ["cleanPreparedMetadata"]
@@ -2957,8 +3010,9 @@ let EzSearch = class {
2957
3010
  }
2958
3011
  }
2959
3012
  onComboChange(evt) {
2960
- this.value = this._comboElement.value;
2961
- this.ezChange.emit(this.value);
3013
+ evt.stopPropagation();
3014
+ this.value = evt.detail;
3015
+ this.ezChange.emit(evt.detail);
2962
3016
  }
2963
3017
  render() {
2964
3018
  return (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 }));
@@ -3474,143 +3528,215 @@ let EzTextInput = class {
3474
3528
  };
3475
3529
  EzTextInput.style = ezTextInputCss;
3476
3530
 
3477
- 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%}}";
3531
+ class RemoteFile {
3532
+ constructor(file) {
3533
+ this.file = file;
3534
+ this.size = file.size;
3535
+ this.name = file.name;
3536
+ }
3537
+ abortUpload() {
3538
+ if (this._uploadingXhr) {
3539
+ this._aborted = true;
3540
+ this._uploadingXhr.abort();
3541
+ this._uploadingXhr = undefined;
3542
+ }
3543
+ }
3544
+ isUploading() {
3545
+ return this._uploadingXhr !== undefined;
3546
+ }
3547
+ async upload(server, headers, updateCallBack) {
3548
+ return new Promise((resolve, reject) => {
3549
+ const xhr = new XMLHttpRequest();
3550
+ this._uploadingXhr = xhr;
3551
+ this._aborted = false;
3552
+ this.progress = 0;
3553
+ xhr.upload.onprogress = (e) => {
3554
+ const loaded = e.loaded;
3555
+ const total = e.total;
3556
+ this.progress = ~~((loaded / total) * 100);
3557
+ updateCallBack(this, loaded, total);
3558
+ };
3559
+ xhr.onreadystatechange = () => {
3560
+ if (xhr.readyState == 4) {
3561
+ this._uploadingXhr = undefined;
3562
+ const status = xhr.status;
3563
+ if (!this._aborted) {
3564
+ if (status === 0) {
3565
+ reject("Servidor indisponível");
3566
+ }
3567
+ else if (status >= 500) {
3568
+ reject("Erro inesperado no servidor");
3569
+ }
3570
+ else if (status >= 400) {
3571
+ reject("Operação não permitida");
3572
+ }
3573
+ }
3574
+ const response = xhr.response;
3575
+ if (response) {
3576
+ resolve(JSON.parse(response));
3577
+ }
3578
+ }
3579
+ };
3580
+ xhr.ontimeout = () => {
3581
+ reject("Tempo limite de transferência atingido.");
3582
+ };
3583
+ const formData = new FormData();
3584
+ formData.append("ARQUIVO", this.file, this.file.name);
3585
+ xhr.open("POST", server, true);
3586
+ if (headers) {
3587
+ headers.forEach((value, key) => xhr.setRequestHeader(key, value));
3588
+ }
3589
+ xhr.send(formData);
3590
+ });
3591
+ }
3592
+ async delete(item, server, headers) {
3593
+ return new Promise((resolve, reject) => {
3594
+ const xhr = new XMLHttpRequest();
3595
+ xhr.onreadystatechange = () => {
3596
+ if (xhr.readyState == 4) {
3597
+ if (xhr.status === 0) {
3598
+ reject("Servidor indisponível");
3599
+ }
3600
+ else if (xhr.status >= 500) {
3601
+ reject("Erro inesperado no servidor");
3602
+ }
3603
+ else if (xhr.status >= 400) {
3604
+ reject("Operação não permitida");
3605
+ }
3606
+ resolve(true);
3607
+ }
3608
+ };
3609
+ xhr.ontimeout = () => {
3610
+ reject("Tempo limite de remoção atingido.");
3611
+ };
3612
+ xhr.open("DELETE", server, true);
3613
+ if (headers) {
3614
+ headers.forEach((value, key) => xhr.setRequestHeader(key, value));
3615
+ }
3616
+ xhr.send(JSON.stringify(item));
3617
+ });
3618
+ }
3619
+ }
3620
+
3621
+ 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%}}";
3478
3622
 
3479
3623
  let EzUpload = class {
3480
3624
  constructor(hostRef) {
3481
3625
  registerInstance(this, hostRef);
3482
- this.validatedEvent = createEvent(this, "validatedEvent", 7);
3483
- this.initUploadEvent = createEvent(this, "initUploadEvent", 7);
3484
- this.finishedUploadEvent = createEvent(this, "finishedUploadEvent", 7);
3485
3626
  this.ezChange = createEvent(this, "ezChange", 7);
3627
+ this._filePointers = new Map();
3628
+ /**
3629
+ * Deixa o campo disponível ou não para digitação.
3630
+ */
3631
+ this.enabled = true;
3486
3632
  }
3487
- fileListChange() {
3488
- this.ezChange.emit({ value: this.value });
3489
- }
3490
- addFiles(files) {
3491
- Array.prototype.forEach.call(files, this.addFile.bind(this));
3633
+ updatePointers(newValue) {
3634
+ if (newValue !== this._updatingValue) {
3635
+ this._filePointers.forEach(f => {
3636
+ if (this.isRemoteFile(f)) {
3637
+ f.abortUpload();
3638
+ }
3639
+ });
3640
+ this._filePointers = new Map();
3641
+ if (newValue) {
3642
+ newValue.forEach(ezFile => this._filePointers.set(ezFile.name, ezFile));
3643
+ }
3644
+ }
3645
+ this._updatingValue = undefined;
3492
3646
  }
3493
- addFile(file) {
3494
- this.errorMessage = undefined;
3495
- if (this.validateFile(file)) {
3496
- if (this.target) {
3497
- this._uploadFile(file);
3647
+ normalizeRequestHeaders() {
3648
+ this._requestHeaders = new Map();
3649
+ if (typeof this.requestheaders == 'string') {
3650
+ try {
3651
+ this.requestheaders = JSON.parse(this.requestheaders);
3498
3652
  }
3499
- else {
3500
- this.errorMessage = "Endereço de upload não informado";
3501
- alert(this.errorMessage);
3653
+ catch (e) {
3654
+ this.requestheaders = undefined;
3502
3655
  }
3503
3656
  }
3504
- else {
3505
- if (this.errorMessage && this.errorMessage.length > 0) {
3506
- alert(this.errorMessage);
3507
- }
3657
+ for (var key in this.requestheaders) {
3658
+ this._requestHeaders.set(key, this.requestheaders[key]);
3508
3659
  }
3509
3660
  }
3510
- validateFile(file) {
3511
- this.errorMessage = '';
3512
- let isValid = true;
3513
- if (this.maxFileSize >= 0 && file.size > this.maxFileSize) {
3514
- this.errorMessage = 'O tamanho máximo dos arquivos é de ' + this.formatBytes(this.maxFileSize);
3515
- isValid = false;
3516
- }
3517
- this.validatedEvent.emit({ isValid: isValid, fileName: file.name });
3518
- return isValid;
3519
- }
3520
- _uploadFile(file) {
3521
- const xhr = (file.xhr = this._createXhr());
3522
- this.value = [];
3523
- this.value.push({ name: file.name, size: file.size, xhr: file.xhr, strSize: this.formatBytes(file.size) });
3524
- let stalledId;
3525
- xhr.upload.onprogress = (e) => {
3526
- clearTimeout(stalledId);
3527
- const loaded = e.loaded, total = e.total, progress = ~~((loaded / total) * 100);
3528
- let viewFile = this.value.find(f => f.name === file.name);
3529
- if (viewFile) {
3530
- viewFile.progress = progress;
3531
- }
3532
- this.value = [...this.value];
3533
- };
3534
- xhr.onreadystatechange = () => {
3535
- this.errorMessage = '';
3536
- if (xhr.readyState == 4) {
3537
- clearTimeout(stalledId);
3538
- file.indeterminate = file.uploading = false;
3539
- if (xhr.status === 0) ;
3540
- else if (xhr.status >= 500) {
3541
- this.errorMessage = "Erro inesperado no servidor";
3542
- }
3543
- else if (xhr.status >= 400) {
3544
- this.errorMessage = "Operação não permitida";
3545
- }
3546
- if (this.errorMessage && this.errorMessage.length > 0) {
3547
- //TODO
3548
- // Conferir com o time de UX um estado de erro ou remoção da lista
3549
- // this.removeFile(file.name);
3550
- alert(this.errorMessage);
3551
- }
3552
- else {
3553
- if (xhr.response) {
3554
- let response = JSON.parse(xhr.response);
3555
- response.forEach(element => {
3556
- let viewFile = this.value.find(f => f.name === this.decode_utf8(element.name));
3557
- if (viewFile) {
3558
- viewFile.progress = undefined;
3559
- //Validar estado de erro com UX
3560
- viewFile.error = false;
3561
- delete viewFile.xhr;
3562
- viewFile.downloadUrl = element.downloadURL;
3563
- viewFile.lastModifiedDate = element.lastModifiedDate;
3564
- viewFile.properties = element.properties;
3565
- }
3566
- });
3567
- this.value = [...this.value];
3568
- this.fileListChange();
3569
- }
3570
- else {
3571
- let viewFile = this.value.find(f => f.name === file.name);
3572
- viewFile.progress = undefined;
3573
- //Validar estado de erro com UX
3574
- viewFile.error = true;
3661
+ async addFiles(files) {
3662
+ Array.prototype.forEach.call(files, this.addFile.bind(this));
3663
+ }
3664
+ async addFile(file) {
3665
+ const oldFile = this._filePointers.get(file.name);
3666
+ if (oldFile) {
3667
+ Application.confirm("Substituir arquivo", `Já existe um arquivo chamado "${file.name}". Deseja substituí-lo?`)
3668
+ .then(ok => {
3669
+ if (ok) {
3670
+ if (this.isRemoteFile(oldFile)) {
3671
+ oldFile.abortUpload();
3575
3672
  }
3673
+ this.doAddFile(file);
3576
3674
  }
3675
+ });
3676
+ }
3677
+ else {
3678
+ this.doAddFile(file);
3679
+ }
3680
+ }
3681
+ async doAddFile(file) {
3682
+ if (this.validateFile(file)) {
3683
+ const uploadingFile = new RemoteFile(file);
3684
+ this._filePointers.set(file.name, uploadingFile);
3685
+ uploadingFile.upload(this.urlupload, this._requestHeaders, (file) => this.updateFeedback(file))
3686
+ .then((files) => files.forEach(ezFile => this.finishUpload(ezFile)))
3687
+ .catch(msg => this.showError(msg));
3688
+ forceUpdate(this);
3689
+ }
3690
+ }
3691
+ finishUpload(ezFile) {
3692
+ this._filePointers.set(ezFile.name, ezFile);
3693
+ this.updateValue();
3694
+ }
3695
+ updateValue() {
3696
+ this._updatingValue = [];
3697
+ this._filePointers.forEach(f => {
3698
+ if (!this.isRemoteFile(f)) {
3699
+ this._updatingValue.push(f);
3577
3700
  }
3578
- };
3579
- xhr.ontimeout = () => {
3580
- if (this.errorMessage && this.errorMessage.length > 0) {
3581
- this.errorMessage.concat(" / Tempo expirado");
3582
- this.removeFile(file.name);
3583
- alert(this.errorMessage);
3584
- }
3585
- };
3586
- const formData = new FormData();
3587
- formData.append(this.formDataName, file, file.name);
3588
- xhr.open("POST", this.target, true);
3589
- this._configureXhr(xhr);
3590
- file.status = "conectando";
3591
- file.uploading = file.indeterminate = true;
3592
- file.complete = file.abort = file.error = file.held = false;
3593
- xhr.send(formData);
3594
- }
3595
- _createXhr() {
3596
- return new XMLHttpRequest();
3597
- }
3598
- _configureXhr(xhr) {
3599
- if (typeof this.headers == 'string') {
3600
- try {
3601
- this.headers = JSON.parse(this.headers);
3602
- }
3603
- catch (e) {
3604
- this.headers = undefined;
3701
+ });
3702
+ this.value = this._updatingValue;
3703
+ this.ezChange.emit(this.value);
3704
+ }
3705
+ buildProgressId(uploading) {
3706
+ let sanitizedName = uploading.name.replace(/[^a-z0-9_]/gi, '_');
3707
+ return `PROGRESS_${sanitizedName}_${uploading.file.lastModified}`;
3708
+ }
3709
+ updateFeedback(uf) {
3710
+ window.requestAnimationFrame(() => {
3711
+ if (this._host) {
3712
+ const progress = this._host.shadowRoot.querySelector('#' + this.buildProgressId(uf));
3713
+ if (progress) {
3714
+ progress.value = uf.progress;
3715
+ }
3605
3716
  }
3717
+ });
3718
+ }
3719
+ validateFile(file) {
3720
+ if (this.maxfiles > 0 && this._filePointers.size >= this.maxfiles) {
3721
+ this.showError(`A quantidade máxima de arquivos é ${this.maxfiles}.`);
3722
+ return false;
3606
3723
  }
3607
- for (var key in this.headers) {
3608
- xhr.setRequestHeader(key, this.headers[key]);
3724
+ if (file.size === 0) {
3725
+ this.showError(`Erro de permissão: O arquivo "${file.name}" não pode ser enviado.`);
3726
+ return false;
3609
3727
  }
3610
- if (this.timeout) {
3611
- xhr.timeout = this.timeout;
3728
+ if (!this.urlupload) {
3729
+ this.showError("Endereço de upload não informado");
3730
+ return false;
3612
3731
  }
3613
- xhr.withCredentials = this.withCredentials;
3732
+ if (this.maxfilesize >= 0 && file.size > this.maxfilesize) {
3733
+ this.showError("O tamanho máximo dos arquivos é de " + this.formatBytes(this.maxfilesize));
3734
+ return false;
3735
+ }
3736
+ return true;
3737
+ }
3738
+ showError(message) {
3739
+ Application.alert("Enviando arquivo", message);
3614
3740
  }
3615
3741
  formatBytes(bytes, decimals = 1) {
3616
3742
  if (bytes === 0)
@@ -3622,96 +3748,85 @@ let EzUpload = class {
3622
3748
  return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
3623
3749
  }
3624
3750
  onFileInputChange(event) {
3625
- this.addFiles(event.target.files);
3751
+ const input = event.target;
3752
+ this.addFiles(Array.from(input.files));
3626
3753
  this._fileInput.value = '';
3627
3754
  }
3628
- /*componentWillLoad() {
3629
- if (this.fileList?.length > 0) {
3630
- this.fileList.forEach(item => {
3631
- if (item.size) {
3632
- item.strSize = this.formatBytes(item.size);
3633
- }
3634
- })
3635
- this.fileList = [...this.fileList];
3755
+ isRemoteFile(item) {
3756
+ return "file" in item;
3757
+ }
3758
+ removeFromList(name) {
3759
+ this._filePointers.delete(name);
3760
+ this.updateValue();
3761
+ }
3762
+ removeFile(name) {
3763
+ const item = this._filePointers.get(name);
3764
+ if (this.isRemoteFile(item)) {
3765
+ item.abortUpload();
3766
+ this.removeFromList(name);
3767
+ }
3768
+ else {
3769
+ if (this.urldelete) {
3770
+ const uploadingFile = new RemoteFile(null);
3771
+ this._filePointers.set(item.name, uploadingFile);
3772
+ uploadingFile.delete(item, this.urldelete, null)
3773
+ .then(_ok => this.removeFromList(name))
3774
+ .catch(msg => this.showError(msg));
3775
+ }
3776
+ else {
3777
+ this.removeFromList(name);
3778
+ }
3636
3779
  }
3637
- }*/
3638
- decode_utf8(s) {
3639
- return decodeURIComponent(escape(s));
3640
3780
  }
3641
3781
  componentDidLoad() {
3642
- if (this.dropZone && window.FileList && window.File) {
3643
- this.dropZone.addEventListener('dragover', event => {
3782
+ if (this._dropZone && window.FileList && window.File) {
3783
+ this._dropZone.addEventListener('dragover', event => {
3644
3784
  event.stopPropagation();
3645
3785
  event.preventDefault();
3646
3786
  event.dataTransfer.dropEffect = 'copy';
3647
3787
  });
3648
- this.dropZone.addEventListener('drop', event => {
3788
+ this._dropZone.addEventListener('drop', event => {
3649
3789
  event.stopPropagation();
3650
3790
  event.preventDefault();
3651
- this.addFiles(event.dataTransfer.files);
3791
+ this.addFiles(Array.from(event.dataTransfer.files));
3652
3792
  });
3653
3793
  }
3654
3794
  }
3655
- removeFile(name, xhr, downloadURL) {
3656
- if (xhr) {
3657
- xhr.abort();
3795
+ openFilesDialog() {
3796
+ if (this.maxfiles > 0 && this._filePointers.size >= this.maxfiles) {
3797
+ this.showError(`A quantidade máxima de arquivos é ${this.maxfiles}.`);
3658
3798
  }
3659
- if (downloadURL) {
3660
- this.removeFileFromServer(name, downloadURL);
3799
+ else {
3800
+ this._fileInput.click();
3661
3801
  }
3662
- this.value = [...this.value.filter(function (value) { return value.name !== name; })];
3663
- }
3664
- removeFileFromServer(name, donwloadURL) {
3665
- const xhr = this._createXhr();
3666
- this.errorMessage = '';
3667
- let stalledId;
3668
- xhr.onreadystatechange = () => {
3669
- if (xhr.readyState == 4) {
3670
- clearTimeout(stalledId);
3671
- if (xhr.status === 0) {
3672
- this.errorMessage = "Servidor indisponível";
3673
- }
3674
- else if (xhr.status >= 500) {
3675
- this.errorMessage = "Erro inesperado no servidor";
3676
- }
3677
- else if (xhr.status >= 400) {
3678
- this.errorMessage = "Operação não permitida";
3679
- }
3680
- if (this.errorMessage && this.errorMessage.length > 0) {
3681
- //TODO
3682
- // Conferir com o time de UX um estado de erro ou remoção da lista
3683
- // this.removeFile(file.name);
3684
- alert(this.errorMessage);
3685
- }
3686
- }
3687
- };
3688
- xhr.ontimeout = () => {
3689
- if (this.errorMessage && this.errorMessage.length > 0) {
3690
- alert(this.errorMessage);
3691
- }
3692
- };
3693
- const body = JSON.stringify({
3694
- name: name,
3695
- donwloadURL: donwloadURL,
3696
- });
3697
- xhr.open("DELETE", this.target, true);
3698
- xhr.setRequestHeader('Content-Type', 'application/json');
3699
- this._configureXhr(xhr);
3700
- xhr.send(body);
3701
3802
  }
3702
3803
  render() {
3703
- var _a;
3704
- return (h(Host, null, h("slot", null, h("div", { ref: (el) => this.dropZone = el, class: "iu" }, h("div", { class: "iu__container" }, h("div", { onClick: () => this._fileInput.click(), class: "iu__icon-label" }, h("button", { class: "iu__file-icon" }), 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 ?
3705
- h("div", { class: "iu__footer" }, this.value.map(file => {
3706
- return (h("div", { class: "iu__item" }, h("div", { class: "iu__item-label" + (file.progress ? " modificador " : " modificador ") }, file.downloadUrl ?
3707
- h("div", { title: file.name + "(" + file.strSize + ")", class: "file__name text text--primary text--small text--ellipsis align--middle" }, h("a", { href: file.downloadUrl, download: true }, file.name, " (", file.strSize, ")"))
3708
- :
3709
- h("div", { title: file.name + "(" + file.strSize + ")", class: "col--stretch align--middle file__name text text--primary text--small text--ellipsis align--middle " }, file.name, " (", file.strSize, ")")), file.progress ?
3710
- h("div", { class: "col col--sd-4 col--stretch align--middle" }, h("progress", { value: file.progress, max: "100" }))
3711
- : undefined, h("div", { class: "col col--stretch align--middle" }, h("button", { class: "btn-cancel ", onClick: () => this.removeFile(file.name, file.xhr) }))));
3712
- }))
3713
- : undefined))), h("input", { ref: (el) => this._fileInput = el, type: "file", id: "fileInput", hidden: true, onChange: (ev) => this.onFileInputChange(ev), multiple: true })));
3804
+ return (h("div", { ref: (el) => this._dropZone = el, class: "iu" }, this.label ? h("label", { class: "iu__label", title: this.label }, this.label) : null, h("div", { class: "iu__container", onClick: () => this.openFilesDialog() }, h("div", { class: "iu__icon-label" }, h("button", { class: "iu__file-icon" }), h("div", { class: "text text--center text--medium text--primary" }, "Arraste e solte ou clique para adicionar arquivos")), this.buildFooter()), h("input", { ref: (el) => this._fileInput = el, onChange: (ev) => this.onFileInputChange(ev), type: "file", multiple: true, hidden: true })));
3714
3805
  }
3806
+ buildFooter() {
3807
+ if (this._filePointers.size === 0) {
3808
+ return null;
3809
+ }
3810
+ const items = [];
3811
+ this._filePointers.forEach(item => items.push(this.buildFileItem(item)));
3812
+ return (h("div", { class: "iu__footer" }, items));
3813
+ }
3814
+ buildFileItem(item) {
3815
+ const fileName = item.name;
3816
+ const progress = Number(item['progress']);
3817
+ const downloadURL = item['downloadURL'];
3818
+ const label = `${fileName} (${this.formatBytes(item.size)})`;
3819
+ return (h("div", { class: "iu__item", key: fileName, onClick: evt => evt.stopPropagation() }, h("div", { class: "iu__item-label modificador" }, 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)), isNaN(progress)
3820
+ ?
3821
+ null
3822
+ :
3823
+ h("div", { class: "col col--sd-4 col--stretch align--middle" }, h("progress", { id: this.buildProgressId(item), value: progress, max: "100" })), h("div", { class: "col col--stretch align--middle" }, h("button", { class: "btn-cancel ", onClick: () => this.removeFile(fileName) }))));
3824
+ }
3825
+ get _host() { return getElement(this); }
3826
+ static get watchers() { return {
3827
+ "value": ["updatePointers"],
3828
+ "requestheaders": ["normalizeRequestHeaders"]
3829
+ }; }
3715
3830
  };
3716
3831
  EzUpload.style = ezUploadCss;
3717
3832
 
@@ -3737,11 +3852,6 @@ let FormMetadata = class {
3737
3852
  properties.push({ name: "options", value: JSON.stringify(objOpts) });
3738
3853
  }
3739
3854
  else if (userInterface === "FILE") {
3740
- /*<URL>http://localhost:8080/2a3skw-graphql/uploadFiles</URL>
3741
- <HEADERS>
3742
- <HEADER NAME="Authorization">dsfs</HEADER>
3743
- </HEADER>
3744
- </field> */
3745
3855
  const urlElement = element.querySelector('URL');
3746
3856
  const headersElement = element.querySelectorAll('HEADERS>HEADER');
3747
3857
  if (urlElement) {
@@ -3754,6 +3864,7 @@ let FormMetadata = class {
3754
3864
  });
3755
3865
  properties.push({ name: "HEADERS", value: JSON.stringify(headers) });
3756
3866
  }
3867
+ this.addPropertyIfExists(properties, element, "maxfiles");
3757
3868
  }
3758
3869
  else {
3759
3870
  if (!label) {