@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
@@ -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,143 +3532,215 @@ 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 });
3493
- }
3494
- addFiles(files) {
3495
- Array.prototype.forEach.call(files, this.addFile.bind(this));
3637
+ updatePointers(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
+ if (newValue) {
3646
+ newValue.forEach(ezFile => this._filePointers.set(ezFile.name, ezFile));
3647
+ }
3648
+ }
3649
+ this._updatingValue = undefined;
3496
3650
  }
3497
- addFile(file) {
3498
- this.errorMessage = undefined;
3499
- if (this.validateFile(file)) {
3500
- if (this.target) {
3501
- this._uploadFile(file);
3651
+ normalizeRequestHeaders() {
3652
+ this._requestHeaders = new Map();
3653
+ if (typeof this.requestheaders == 'string') {
3654
+ try {
3655
+ this.requestheaders = JSON.parse(this.requestheaders);
3502
3656
  }
3503
- else {
3504
- this.errorMessage = "Endereço de upload não informado";
3505
- alert(this.errorMessage);
3657
+ catch (e) {
3658
+ this.requestheaders = undefined;
3506
3659
  }
3507
3660
  }
3508
- else {
3509
- if (this.errorMessage && this.errorMessage.length > 0) {
3510
- alert(this.errorMessage);
3511
- }
3661
+ for (var key in this.requestheaders) {
3662
+ this._requestHeaders.set(key, this.requestheaders[key]);
3512
3663
  }
3513
3664
  }
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
- this.value = [];
3527
- this.value.push({ name: file.name, size: file.size, xhr: file.xhr, strSize: this.formatBytes(file.size) });
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 = this.value.find(f => f.name === file.name);
3533
- if (viewFile) {
3534
- viewFile.progress = progress;
3535
- }
3536
- this.value = [...this.value];
3537
- };
3538
- xhr.onreadystatechange = () => {
3539
- this.errorMessage = '';
3540
- if (xhr.readyState == 4) {
3541
- clearTimeout(stalledId);
3542
- file.indeterminate = file.uploading = false;
3543
- if (xhr.status === 0) ;
3544
- else if (xhr.status >= 500) {
3545
- this.errorMessage = "Erro inesperado no servidor";
3546
- }
3547
- else if (xhr.status >= 400) {
3548
- this.errorMessage = "Operação não permitida";
3549
- }
3550
- if (this.errorMessage && this.errorMessage.length > 0) {
3551
- //TODO
3552
- // Conferir com o time de UX um estado de erro ou remoção da lista
3553
- // this.removeFile(file.name);
3554
- alert(this.errorMessage);
3555
- }
3556
- else {
3557
- if (xhr.response) {
3558
- let response = JSON.parse(xhr.response);
3559
- response.forEach(element => {
3560
- let viewFile = this.value.find(f => f.name === this.decode_utf8(element.name));
3561
- if (viewFile) {
3562
- viewFile.progress = undefined;
3563
- //Validar estado de erro com UX
3564
- viewFile.error = false;
3565
- delete viewFile.xhr;
3566
- viewFile.downloadUrl = element.downloadURL;
3567
- viewFile.lastModifiedDate = element.lastModifiedDate;
3568
- viewFile.properties = element.properties;
3569
- }
3570
- });
3571
- this.value = [...this.value];
3572
- this.fileListChange();
3573
- }
3574
- else {
3575
- let viewFile = this.value.find(f => f.name === file.name);
3576
- viewFile.progress = undefined;
3577
- //Validar estado de erro com UX
3578
- viewFile.error = true;
3665
+ async addFiles(files) {
3666
+ Array.prototype.forEach.call(files, this.addFile.bind(this));
3667
+ }
3668
+ async addFile(file) {
3669
+ const oldFile = this._filePointers.get(file.name);
3670
+ if (oldFile) {
3671
+ Application.confirm("Substituir arquivo", `Já existe um arquivo chamado "${file.name}". Deseja substituí-lo?`)
3672
+ .then(ok => {
3673
+ if (ok) {
3674
+ if (this.isRemoteFile(oldFile)) {
3675
+ oldFile.abortUpload();
3579
3676
  }
3677
+ this.doAddFile(file);
3580
3678
  }
3679
+ });
3680
+ }
3681
+ else {
3682
+ this.doAddFile(file);
3683
+ }
3684
+ }
3685
+ async doAddFile(file) {
3686
+ if (this.validateFile(file)) {
3687
+ const uploadingFile = new RemoteFile(file);
3688
+ this._filePointers.set(file.name, uploadingFile);
3689
+ uploadingFile.upload(this.urlupload, this._requestHeaders, (file) => this.updateFeedback(file))
3690
+ .then((files) => files.forEach(ezFile => this.finishUpload(ezFile)))
3691
+ .catch(msg => this.showError(msg));
3692
+ index.forceUpdate(this);
3693
+ }
3694
+ }
3695
+ finishUpload(ezFile) {
3696
+ this._filePointers.set(ezFile.name, ezFile);
3697
+ this.updateValue();
3698
+ }
3699
+ updateValue() {
3700
+ this._updatingValue = [];
3701
+ this._filePointers.forEach(f => {
3702
+ if (!this.isRemoteFile(f)) {
3703
+ this._updatingValue.push(f);
3581
3704
  }
3582
- };
3583
- xhr.ontimeout = () => {
3584
- if (this.errorMessage && this.errorMessage.length > 0) {
3585
- this.errorMessage.concat(" / Tempo expirado");
3586
- this.removeFile(file.name);
3587
- alert(this.errorMessage);
3588
- }
3589
- };
3590
- const formData = new FormData();
3591
- formData.append(this.formDataName, file, file.name);
3592
- xhr.open("POST", this.target, true);
3593
- this._configureXhr(xhr);
3594
- file.status = "conectando";
3595
- file.uploading = file.indeterminate = true;
3596
- file.complete = file.abort = file.error = file.held = false;
3597
- xhr.send(formData);
3598
- }
3599
- _createXhr() {
3600
- return new XMLHttpRequest();
3601
- }
3602
- _configureXhr(xhr) {
3603
- if (typeof this.headers == 'string') {
3604
- try {
3605
- this.headers = JSON.parse(this.headers);
3606
- }
3607
- catch (e) {
3608
- this.headers = undefined;
3705
+ });
3706
+ this.value = this._updatingValue;
3707
+ this.ezChange.emit(this.value);
3708
+ }
3709
+ buildProgressId(uploading) {
3710
+ let sanitizedName = uploading.name.replace(/[^a-z0-9_]/gi, '_');
3711
+ return `PROGRESS_${sanitizedName}_${uploading.file.lastModified}`;
3712
+ }
3713
+ updateFeedback(uf) {
3714
+ window.requestAnimationFrame(() => {
3715
+ if (this._host) {
3716
+ const progress = this._host.shadowRoot.querySelector('#' + this.buildProgressId(uf));
3717
+ if (progress) {
3718
+ progress.value = uf.progress;
3719
+ }
3609
3720
  }
3721
+ });
3722
+ }
3723
+ validateFile(file) {
3724
+ if (this.maxfiles > 0 && this._filePointers.size >= this.maxfiles) {
3725
+ this.showError(`A quantidade máxima de arquivos é ${this.maxfiles}.`);
3726
+ return false;
3610
3727
  }
3611
- for (var key in this.headers) {
3612
- xhr.setRequestHeader(key, this.headers[key]);
3728
+ if (file.size === 0) {
3729
+ this.showError(`Erro de permissão: O arquivo "${file.name}" não pode ser enviado.`);
3730
+ return false;
3613
3731
  }
3614
- if (this.timeout) {
3615
- xhr.timeout = this.timeout;
3732
+ if (!this.urlupload) {
3733
+ this.showError("Endereço de upload não informado");
3734
+ return false;
3616
3735
  }
3617
- xhr.withCredentials = this.withCredentials;
3736
+ if (this.maxfilesize >= 0 && file.size > this.maxfilesize) {
3737
+ this.showError("O tamanho máximo dos arquivos é de " + this.formatBytes(this.maxfilesize));
3738
+ return false;
3739
+ }
3740
+ return true;
3741
+ }
3742
+ showError(message) {
3743
+ Application.alert("Enviando arquivo", message);
3618
3744
  }
3619
3745
  formatBytes(bytes, decimals = 1) {
3620
3746
  if (bytes === 0)
@@ -3626,96 +3752,85 @@ let EzUpload = class {
3626
3752
  return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
3627
3753
  }
3628
3754
  onFileInputChange(event) {
3629
- this.addFiles(event.target.files);
3755
+ const input = event.target;
3756
+ this.addFiles(Array.from(input.files));
3630
3757
  this._fileInput.value = '';
3631
3758
  }
3632
- /*componentWillLoad() {
3633
- if (this.fileList?.length > 0) {
3634
- this.fileList.forEach(item => {
3635
- if (item.size) {
3636
- item.strSize = this.formatBytes(item.size);
3637
- }
3638
- })
3639
- this.fileList = [...this.fileList];
3759
+ isRemoteFile(item) {
3760
+ return "file" in item;
3761
+ }
3762
+ removeFromList(name) {
3763
+ this._filePointers.delete(name);
3764
+ this.updateValue();
3765
+ }
3766
+ removeFile(name) {
3767
+ const item = this._filePointers.get(name);
3768
+ if (this.isRemoteFile(item)) {
3769
+ item.abortUpload();
3770
+ this.removeFromList(name);
3771
+ }
3772
+ else {
3773
+ if (this.urldelete) {
3774
+ const uploadingFile = new RemoteFile(null);
3775
+ this._filePointers.set(item.name, uploadingFile);
3776
+ uploadingFile.delete(item, this.urldelete, null)
3777
+ .then(_ok => this.removeFromList(name))
3778
+ .catch(msg => this.showError(msg));
3779
+ }
3780
+ else {
3781
+ this.removeFromList(name);
3782
+ }
3640
3783
  }
3641
- }*/
3642
- decode_utf8(s) {
3643
- return decodeURIComponent(escape(s));
3644
3784
  }
3645
3785
  componentDidLoad() {
3646
- if (this.dropZone && window.FileList && window.File) {
3647
- this.dropZone.addEventListener('dragover', event => {
3786
+ if (this._dropZone && window.FileList && window.File) {
3787
+ this._dropZone.addEventListener('dragover', event => {
3648
3788
  event.stopPropagation();
3649
3789
  event.preventDefault();
3650
3790
  event.dataTransfer.dropEffect = 'copy';
3651
3791
  });
3652
- this.dropZone.addEventListener('drop', event => {
3792
+ this._dropZone.addEventListener('drop', event => {
3653
3793
  event.stopPropagation();
3654
3794
  event.preventDefault();
3655
- this.addFiles(event.dataTransfer.files);
3795
+ this.addFiles(Array.from(event.dataTransfer.files));
3656
3796
  });
3657
3797
  }
3658
3798
  }
3659
- removeFile(name, xhr, downloadURL) {
3660
- if (xhr) {
3661
- xhr.abort();
3799
+ openFilesDialog() {
3800
+ if (this.maxfiles > 0 && this._filePointers.size >= this.maxfiles) {
3801
+ this.showError(`A quantidade máxima de arquivos é ${this.maxfiles}.`);
3662
3802
  }
3663
- if (downloadURL) {
3664
- this.removeFileFromServer(name, downloadURL);
3803
+ else {
3804
+ this._fileInput.click();
3665
3805
  }
3666
- this.value = [...this.value.filter(function (value) { return value.name !== name; })];
3667
- }
3668
- removeFileFromServer(name, donwloadURL) {
3669
- const xhr = this._createXhr();
3670
- this.errorMessage = '';
3671
- let stalledId;
3672
- xhr.onreadystatechange = () => {
3673
- if (xhr.readyState == 4) {
3674
- clearTimeout(stalledId);
3675
- if (xhr.status === 0) {
3676
- this.errorMessage = "Servidor indisponível";
3677
- }
3678
- else if (xhr.status >= 500) {
3679
- this.errorMessage = "Erro inesperado no servidor";
3680
- }
3681
- else if (xhr.status >= 400) {
3682
- this.errorMessage = "Operação não permitida";
3683
- }
3684
- if (this.errorMessage && this.errorMessage.length > 0) {
3685
- //TODO
3686
- // Conferir com o time de UX um estado de erro ou remoção da lista
3687
- // this.removeFile(file.name);
3688
- alert(this.errorMessage);
3689
- }
3690
- }
3691
- };
3692
- xhr.ontimeout = () => {
3693
- if (this.errorMessage && this.errorMessage.length > 0) {
3694
- alert(this.errorMessage);
3695
- }
3696
- };
3697
- const body = JSON.stringify({
3698
- name: name,
3699
- donwloadURL: donwloadURL,
3700
- });
3701
- xhr.open("DELETE", this.target, true);
3702
- xhr.setRequestHeader('Content-Type', 'application/json');
3703
- this._configureXhr(xhr);
3704
- xhr.send(body);
3705
3806
  }
3706
3807
  render() {
3707
- var _a;
3708
- 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 ?
3709
- index.h("div", { class: "iu__footer" }, this.value.map(file => {
3710
- return (index.h("div", { class: "iu__item" }, index.h("div", { class: "iu__item-label" + (file.progress ? " modificador " : " modificador ") }, file.downloadUrl ?
3711
- index.h("div", { title: file.name + "(" + file.strSize + ")", class: "file__name text text--primary text--small text--ellipsis align--middle" }, index.h("a", { href: file.downloadUrl, download: true }, file.name, " (", file.strSize, ")"))
3712
- :
3713
- index.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 ?
3714
- index.h("div", { class: "col col--sd-4 col--stretch align--middle" }, index.h("progress", { value: file.progress, max: "100" }))
3715
- : undefined, index.h("div", { class: "col col--stretch align--middle" }, index.h("button", { class: "btn-cancel ", onClick: () => this.removeFile(file.name, file.xhr) }))));
3716
- }))
3717
- : undefined))), index.h("input", { ref: (el) => this._fileInput = el, type: "file", id: "fileInput", hidden: true, onChange: (ev) => this.onFileInputChange(ev), multiple: true })));
3808
+ 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 })));
3718
3809
  }
3810
+ buildFooter() {
3811
+ if (this._filePointers.size === 0) {
3812
+ return null;
3813
+ }
3814
+ const items = [];
3815
+ this._filePointers.forEach(item => items.push(this.buildFileItem(item)));
3816
+ return (index.h("div", { class: "iu__footer" }, items));
3817
+ }
3818
+ buildFileItem(item) {
3819
+ const fileName = item.name;
3820
+ const progress = Number(item['progress']);
3821
+ const downloadURL = item['downloadURL'];
3822
+ const label = `${fileName} (${this.formatBytes(item.size)})`;
3823
+ 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)
3824
+ ?
3825
+ null
3826
+ :
3827
+ 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) }))));
3828
+ }
3829
+ get _host() { return index.getElement(this); }
3830
+ static get watchers() { return {
3831
+ "value": ["updatePointers"],
3832
+ "requestheaders": ["normalizeRequestHeaders"]
3833
+ }; }
3719
3834
  };
3720
3835
  EzUpload.style = ezUploadCss;
3721
3836
 
@@ -3741,11 +3856,6 @@ let FormMetadata = class {
3741
3856
  properties.push({ name: "options", value: JSON.stringify(objOpts) });
3742
3857
  }
3743
3858
  else if (userInterface === "FILE") {
3744
- /*<URL>http://localhost:8080/2a3skw-graphql/uploadFiles</URL>
3745
- <HEADERS>
3746
- <HEADER NAME="Authorization">dsfs</HEADER>
3747
- </HEADER>
3748
- </field> */
3749
3859
  const urlElement = element.querySelector('URL');
3750
3860
  const headersElement = element.querySelectorAll('HEADERS>HEADER');
3751
3861
  if (urlElement) {
@@ -3758,6 +3868,7 @@ let FormMetadata = class {
3758
3868
  });
3759
3869
  properties.push({ name: "HEADERS", value: JSON.stringify(headers) });
3760
3870
  }
3871
+ this.addPropertyIfExists(properties, element, "maxfiles");
3761
3872
  }
3762
3873
  else {
3763
3874
  if (!label) {