@sankhyalabs/ezui 1.1.120 → 1.1.121

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.
@@ -1,6 +1,6 @@
1
1
  import { HTMLElement as HTMLElement$1, createEvent, h, forceUpdate, Host, getAssetPath, setAssetPath, proxyCustomElement } from '@stencil/core/internal/client';
2
2
  export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
3
- import { FloatingManager, DateUtils, TimeFormatter, UserInterface, ApplicationContext, Action, DataUnitAction, DataUnit, DataType, StringUtils, NumberUtils, MaskFormatter } from '@sankhyalabs/core';
3
+ import { FloatingManager, DateUtils, TimeFormatter, UserInterface, Action, ApplicationContext, DataUnitAction, DataUnit, DataType, StringUtils, NumberUtils, MaskFormatter } from '@sankhyalabs/core';
4
4
  import { UserInterface as UserInterface$1, SortMode } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
5
5
 
6
6
  const ezActionChipCss = ":host{--ez-action-chip--height:36px;--ez-action-chip--border-radius:var(--border--radius-large, 24px);--ez-action-chip__border:1px solid;--ez-action-chip__border-color-strokes:var(--color--strokes, #DCE0E8);--ez-action-chip--font-size:var(--text--medium, 14px);--ez-action-chip--font-family:var(--font-pattern, Arial);--ez-action-chip--font-weight:var(--text-weight--large, 500);--ez-action-chip__label--title--primary:var(--title--primary, #919191);--ez-action-chip__label-color--disable-secondary:var(--color--disable-secondary, #F2F5F8);--ez-action-chip__label__default--background-color--hover:var(--color--primary-200, #f2faf8);--ez-action-chip__label__default--border-color--hover:var(--color--primary-600, #007a5a)}.label__container{width:fit-content;display:flex;flex-wrap:wrap;position:relative;background-color:#FFFFFF;align-items:center;align-self:center;cursor:pointer;color:var(--ez-action-chip__label--title--primary);fill:var(--ez-action-chip__label--title--primary);border:var(--ez-action-chip__border);border-radius:var(--ez-action-chip--border-radius);border-color:var(--ez-action-chip__border-color-strokes);padding-right:var(--space--medium, 12px);padding-left:var(--space--medium, 12px)}.label__container:hover{border-color:var(--ez-action-chip__label__default--border-color--hover);background-color:var(--ez-action-chip__label__default--background-color--hover)}label{display:flex;align-items:center;font-weight:var(--text-weight--large, 600);cursor:pointer;height:var(--ez-action-chip--height);font-family:var(--ez-action-chip--font-family);font-size:var(--ez-action-chip--font-size)}";
@@ -1179,7 +1179,7 @@ const buildSearch = ({ name, label, readOnly, required }) => {
1179
1179
 
1180
1180
  const buildFile = ({ name, label, readOnly }) => {
1181
1181
  return (h("div", { class: "col col--sd-12 padding-horizontal--small" },
1182
- h("ez-upload", { enabled: !readOnly, label: label, urlUpload: "", requestHeaders: "", maxFiles: 10, "data-field-name": name, key: name })));
1182
+ h("ez-upload", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
1183
1183
  };
1184
1184
 
1185
1185
  const buildDate = ({ name, label, readOnly }) => {
@@ -1733,30 +1733,56 @@ class DataBinder {
1733
1733
  constructor(dataUnit) {
1734
1734
  this._fields = new Map();
1735
1735
  this._dataUnit = dataUnit;
1736
- this._dataUnit.subscribe(_action => {
1736
+ this._dataUnit.subscribe(action => {
1737
1737
  var _a;
1738
- (_a = this._fields) === null || _a === void 0 ? void 0 : _a.forEach(field => {
1739
- this.updateValue(field.fieldName, field.field);
1740
- });
1738
+ switch (action.type) {
1739
+ case Action.DATA_LOADED:
1740
+ case Action.DATA_SAVED:
1741
+ case Action.RECORDS_REMOVED:
1742
+ case Action.RECORDS_ADDED:
1743
+ case Action.RECORDS_COPIED:
1744
+ case Action.DATA_CHANGED:
1745
+ case Action.EDITION_CANCELED:
1746
+ case Action.CHANGE_UNDONE:
1747
+ case Action.CHANGE_REDONE:
1748
+ case Action.SELECTION_CHANGED:
1749
+ case Action.NEXT_SELECTED:
1750
+ case Action.PREVIOUS_SELECTED:
1751
+ (_a = this._fields) === null || _a === void 0 ? void 0 : _a.forEach(field => {
1752
+ this.updateValue(field.fieldName, field.field);
1753
+ });
1754
+ break;
1755
+ }
1741
1756
  });
1742
1757
  }
1743
1758
  bind(fields) {
1744
1759
  fields.forEach(fieldElement => {
1745
1760
  const fieldName = fieldElement.dataset.fieldName;
1746
1761
  this.updateBind(fieldName, fieldElement);
1747
- this.updateValue(fieldName, fieldElement);
1748
1762
  });
1749
1763
  }
1750
1764
  updateValue(fieldName, field) {
1751
- field["value"] = this._dataUnit.getFieldValue(fieldName);
1765
+ const oldValue = field["value"];
1766
+ const newValue = this._dataUnit.getFieldValue(fieldName);
1767
+ if (oldValue != newValue) {
1768
+ field["value"] = newValue;
1769
+ }
1752
1770
  }
1753
1771
  updateBind(fieldName, field) {
1754
1772
  const oldBind = this._fields.get(fieldName);
1755
1773
  if (oldBind) {
1756
1774
  oldBind.destroy();
1757
1775
  }
1758
- this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
1776
+ field["value"] = this._dataUnit.getFieldValue(fieldName);
1777
+ this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, waitingChange) => this.changeStarted(fieldName, waitingChange), (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
1759
1778
  this.bindSearchOptionsLoader(fieldName, field);
1779
+ this.applyEzUploadContext(fieldName, field);
1780
+ }
1781
+ changeStarted(fieldName, waitingChange) {
1782
+ if (this._dataUnit.records.length === 0) {
1783
+ this._dataUnit.addRecord();
1784
+ }
1785
+ this._dataUnit.startChange(fieldName, waitingChange);
1760
1786
  }
1761
1787
  setFieldValue(fieldName, newValue) {
1762
1788
  if (this._dataUnit.records.length === 0) {
@@ -1774,19 +1800,37 @@ class DataBinder {
1774
1800
  }
1775
1801
  }
1776
1802
  }
1803
+ applyEzUploadContext(fieldName, field) {
1804
+ var _a, _b;
1805
+ if (field.nodeName === "EZ-UPLOAD") {
1806
+ field["urlUpload"] = ApplicationContext.getContextValue("__EZUI__UPLOAD__ADD__URL__");
1807
+ field["urlDelete"] = ApplicationContext.getContextValue("__EZUI__UPLOAD__DEL__URL__");
1808
+ const descriptor = this._dataUnit.getField(fieldName);
1809
+ const destination = (_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.DESTINATION;
1810
+ if (destination) {
1811
+ field["requestHeaders"] = { XTRAINF: `{"destination": "${destination}"}` };
1812
+ }
1813
+ field["maxFiles"] = ((_b = descriptor.properties) === null || _b === void 0 ? void 0 : _b.MAX_FILES) || 0;
1814
+ }
1815
+ }
1777
1816
  }
1778
1817
  class Bind {
1818
+ constructor() {
1819
+ this.startChangeEventName = "ezStartChange";
1820
+ this.changeEventName = "ezChange";
1821
+ }
1779
1822
  destroy() {
1780
- this.field.removeEventListener(this.eventName, this.eventListener);
1823
+ this.field.removeEventListener(this.startChangeEventName, this.startChangeListener);
1824
+ this.field.removeEventListener(this.changeEventName, this.changeListener);
1781
1825
  }
1782
- static create(fieldName, field, callback) {
1826
+ static create(fieldName, field, startChangeCallback, changeCallback) {
1783
1827
  const b = new Bind();
1784
- b.fieldName = fieldName;
1785
1828
  b.field = field;
1786
- //FIXME: Verificar se o field é um EzField
1787
- b.eventListener = (evt) => { callback(fieldName, evt.detail); };
1788
- b.eventName = "ezChange";
1789
- b.field.addEventListener(b.eventName, b.eventListener);
1829
+ b.fieldName = fieldName;
1830
+ b.startChangeListener = (evt) => { startChangeCallback(fieldName, evt.detail); };
1831
+ b.field.addEventListener(b.startChangeEventName, b.startChangeListener);
1832
+ b.changeListener = (evt) => { changeCallback(fieldName, evt.detail); };
1833
+ b.field.addEventListener(b.changeEventName, b.changeListener);
1790
1834
  return b;
1791
1835
  }
1792
1836
  }
@@ -114385,6 +114429,7 @@ let EzUpload$1 = class extends HTMLElement$1 {
114385
114429
  this.__registerHost();
114386
114430
  this.__attachShadow();
114387
114431
  this.ezChange = createEvent(this, "ezChange", 7);
114432
+ this.ezStartChange = createEvent(this, "ezStartChange", 7);
114388
114433
  this._filePointers = new Map();
114389
114434
  /**
114390
114435
  * Deixa o campo disponível ou não para digitação.
@@ -114392,6 +114437,9 @@ let EzUpload$1 = class extends HTMLElement$1 {
114392
114437
  this.enabled = true;
114393
114438
  }
114394
114439
  changeValue(newValue) {
114440
+ //Observamos o mundo externo, se um novo valor foi atribuído,
114441
+ //precisamos cancelar a alteração anterior, isso envolve, percorrer
114442
+ //a lista de ponteiros e cancelar todos os uploads em andamento.
114395
114443
  if (newValue !== this._updatingValue) {
114396
114444
  this._filePointers.forEach(f => {
114397
114445
  if (this.isRemoteFile(f)) {
@@ -114400,8 +114448,8 @@ let EzUpload$1 = class extends HTMLElement$1 {
114400
114448
  });
114401
114449
  this._filePointers = new Map();
114402
114450
  this.updateFilePointers();
114451
+ this._updatingValue = undefined;
114403
114452
  }
114404
- this._updatingValue = undefined;
114405
114453
  }
114406
114454
  updateFilePointers() {
114407
114455
  if (this.value) {
@@ -114471,6 +114519,7 @@ let EzUpload$1 = class extends HTMLElement$1 {
114471
114519
  }
114472
114520
  async doAddFile(file) {
114473
114521
  if (this.validateFile(file)) {
114522
+ this.ezStartChange.emit({ waitmessage: "Há arquivos sendo enviados. Por favor aguarde a conclusão ou cancele o envio." });
114474
114523
  const uploadingFile = new RemoteFile(file);
114475
114524
  this._filePointers.set(file.name, uploadingFile);
114476
114525
  uploadingFile.upload(this.urlUpload, this._requestHeaders, (file) => this.updateFeedback(file))
@@ -114490,8 +114539,10 @@ let EzUpload$1 = class extends HTMLElement$1 {
114490
114539
  this._updatingValue.push(f);
114491
114540
  }
114492
114541
  });
114493
- this.value = this._updatingValue;
114494
- this.ezChange.emit(this.value);
114542
+ if (this._filePointers.size === this._updatingValue.length) {
114543
+ this.value = this._updatingValue;
114544
+ this.ezChange.emit(this.value);
114545
+ }
114495
114546
  }
114496
114547
  buildProgressId(uploading) {
114497
114548
  let sanitizedName = uploading.name.replace(/[^a-z0-9_]/gi, "_");
@@ -114910,49 +114961,23 @@ let TestDu$1 = class extends HTMLElement$1 {
114910
114961
  super();
114911
114962
  this.__registerHost();
114912
114963
  }
114913
- /*private _ezButton// : HTMLEzButton;
114914
- private _ezComboBox// : HTMLEzComboBox;
114915
- private _ezDateInput// : HTMLEzDateInput;
114916
- private _ezDateTimeInput// : HTMLEzDateTimeInput;
114917
- private _ezNumberInput// : HTMLEzNumberInput
114918
- private _ezSearch// : HTMLEzSearch
114919
- private _ezUpload// : HTMLEzUpload
114920
- private _ezFilterInput// : HTMLEzFilterInput*/
114921
114964
  componentWillLoad() {
114965
+ ApplicationContext.setContextValue("__EZUI__UPLOAD__ADD__URL__", "http://localhost:8080/mge/ez.uploading");
114922
114966
  this.dataUnit = new DataUnit("testes_com_formulario");
114967
+ this.dataUnit.subscribe(() => this.isDirty = this.dataUnit.isDirty());
114923
114968
  this.dataUnit.metadata = {
114924
114969
  name: "dd://br.com.sankhya.fin.cad.movimentacaoFinanceira/Financeiro",
114925
114970
  label: "Parceiro",
114926
114971
  fields: [
114927
114972
  {
114928
- name: "CODPARC",
114929
- label: "Parceiro",
114930
- dataType: DataType.NUMBER,
114931
- userInterface: UserInterface.SEARCH,
114932
- required: true,
114933
- properties: {}
114934
- },
114935
- {
114936
- name: "RECDESP",
114937
- label: "Receita/Despesa",
114938
- dataType: DataType.TEXT,
114939
- userInterface: UserInterface.OPTIONSELECTOR,
114940
- required: true,
114941
- properties: { options: `{"-1": "Despesa", "1": "Receita"}` }
114942
- },
114943
- {
114944
- name: "P",
114945
- label: "pera",
114946
- dataType: DataType.TEXT,
114947
- userInterface: UserInterface.OPTIONSELECTOR,
114948
- properties: { options: `{"M": "Madura", "V": "Verde", "P": "Passada"}` }
114949
- },
114950
- {
114951
- name: "ME",
114952
- label: "ME",
114953
- dataType: DataType.NUMBER,
114954
- userInterface: UserInterface.DECIMALNUMBER,
114955
- properties: { precision: 4, prettyPrecision: 1 }
114973
+ name: "ANEXO",
114974
+ label: "Anexo",
114975
+ dataType: DataType.OBJECT,
114976
+ userInterface: UserInterface.FILE,
114977
+ properties: {
114978
+ DESTINATION: "MULTIFILE",
114979
+ MAX_FILES: "2"
114980
+ }
114956
114981
  }
114957
114982
  ]
114958
114983
  };
@@ -114970,9 +114995,23 @@ let TestDu$1 = class extends HTMLElement$1 {
114970
114995
  total: 100,
114971
114996
  hasMore: true
114972
114997
  }));
114998
+ this.dataUnit.saveLoader = (_dataUnit, changes) => {
114999
+ const savedRecords = [];
115000
+ changes.forEach(change => {
115001
+ savedRecords.push(Object.assign(Object.assign({}, change.record), change.updatingFields));
115002
+ });
115003
+ return Promise.resolve(savedRecords);
115004
+ };
115005
+ }
115006
+ save() {
115007
+ this.dataUnit.saveData().catch(e => {
115008
+ if (e.kind === "WAITING_CHANGE_ERROR") {
115009
+ ApplicationUtils.alert(`Alterando campo ${e.fieldName}`, e.message);
115010
+ }
115011
+ });
114973
115012
  }
114974
115013
  render() {
114975
- return (h("ez-form", { dataUnit: this.dataUnit }));
115014
+ return (h("div", null, h("button", { onClick: () => this.dataUnit.loadData() }, "Carregar"), h("button", { onClick: () => this.save(), disabled: !this.isDirty }, "Salvar"), h("ez-form", { dataUnit: this.dataUnit })));
114976
115015
  }
114977
115016
  static get style() { return testDuCss; }
114978
115017
  };
@@ -115006,7 +115045,7 @@ const EzToast = /*@__PURE__*/proxyCustomElement(EzToast$1, [1,"ez-toast",{"messa
115006
115045
  const EzUpload = /*@__PURE__*/proxyCustomElement(EzUpload$1, [1,"ez-upload",{"label":[1],"enabled":[4],"maxFileSize":[2,"max-file-size"],"maxFiles":[2,"max-files"],"requestHeaders":[8,"request-headers"],"urlUpload":[1,"url-upload"],"urlDelete":[1,"url-delete"],"value":[1040]}]);
115007
115046
  const GridConfig = /*@__PURE__*/proxyCustomElement(GridConfig$1, [2,"grid-config",{"selectedTab":[1025,"selected-tab"],"columns":[1040]}]);
115008
115047
  const SelectBox = /*@__PURE__*/proxyCustomElement(SelectBox$1, [1,"select-box",{"selectedOption":[1,"selected-option"]}]);
115009
- const TestDu = /*@__PURE__*/proxyCustomElement(TestDu$1, [0,"test-du"]);
115048
+ const TestDu = /*@__PURE__*/proxyCustomElement(TestDu$1, [0,"test-du",{"isDirty":[32]}]);
115010
115049
  const defineCustomElements = (opts) => {
115011
115050
  if (typeof customElements !== 'undefined') {
115012
115051
  [
@@ -1,5 +1,5 @@
1
1
  import { h, r as registerInstance, f as forceUpdate, H as Host, g as getElement } from './index-6b8bfbeb.js';
2
- import { UserInterface, ApplicationContext, Action, DataUnitAction, DataUnit } from '@sankhyalabs/core';
2
+ import { UserInterface, Action, ApplicationContext, DataUnitAction, DataUnit } from '@sankhyalabs/core';
3
3
  import { A as ApplicationUtils } from './ApplicationUtils-3ca0e68d.js';
4
4
 
5
5
  const buildTextArea = ({ name, label, readOnly }) => {
@@ -44,7 +44,7 @@ const buildSearch = ({ name, label, readOnly, required }) => {
44
44
 
45
45
  const buildFile = ({ name, label, readOnly }) => {
46
46
  return (h("div", { class: "col col--sd-12 padding-horizontal--small" },
47
- h("ez-upload", { enabled: !readOnly, label: label, urlUpload: "", requestHeaders: "", maxFiles: 10, "data-field-name": name, key: name })));
47
+ h("ez-upload", { enabled: !readOnly, label: label, "data-field-name": name, key: name })));
48
48
  };
49
49
 
50
50
  const buildDate = ({ name, label, readOnly }) => {
@@ -598,30 +598,56 @@ class DataBinder {
598
598
  constructor(dataUnit) {
599
599
  this._fields = new Map();
600
600
  this._dataUnit = dataUnit;
601
- this._dataUnit.subscribe(_action => {
601
+ this._dataUnit.subscribe(action => {
602
602
  var _a;
603
- (_a = this._fields) === null || _a === void 0 ? void 0 : _a.forEach(field => {
604
- this.updateValue(field.fieldName, field.field);
605
- });
603
+ switch (action.type) {
604
+ case Action.DATA_LOADED:
605
+ case Action.DATA_SAVED:
606
+ case Action.RECORDS_REMOVED:
607
+ case Action.RECORDS_ADDED:
608
+ case Action.RECORDS_COPIED:
609
+ case Action.DATA_CHANGED:
610
+ case Action.EDITION_CANCELED:
611
+ case Action.CHANGE_UNDONE:
612
+ case Action.CHANGE_REDONE:
613
+ case Action.SELECTION_CHANGED:
614
+ case Action.NEXT_SELECTED:
615
+ case Action.PREVIOUS_SELECTED:
616
+ (_a = this._fields) === null || _a === void 0 ? void 0 : _a.forEach(field => {
617
+ this.updateValue(field.fieldName, field.field);
618
+ });
619
+ break;
620
+ }
606
621
  });
607
622
  }
608
623
  bind(fields) {
609
624
  fields.forEach(fieldElement => {
610
625
  const fieldName = fieldElement.dataset.fieldName;
611
626
  this.updateBind(fieldName, fieldElement);
612
- this.updateValue(fieldName, fieldElement);
613
627
  });
614
628
  }
615
629
  updateValue(fieldName, field) {
616
- field["value"] = this._dataUnit.getFieldValue(fieldName);
630
+ const oldValue = field["value"];
631
+ const newValue = this._dataUnit.getFieldValue(fieldName);
632
+ if (oldValue != newValue) {
633
+ field["value"] = newValue;
634
+ }
617
635
  }
618
636
  updateBind(fieldName, field) {
619
637
  const oldBind = this._fields.get(fieldName);
620
638
  if (oldBind) {
621
639
  oldBind.destroy();
622
640
  }
623
- this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
641
+ field["value"] = this._dataUnit.getFieldValue(fieldName);
642
+ this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, waitingChange) => this.changeStarted(fieldName, waitingChange), (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
624
643
  this.bindSearchOptionsLoader(fieldName, field);
644
+ this.applyEzUploadContext(fieldName, field);
645
+ }
646
+ changeStarted(fieldName, waitingChange) {
647
+ if (this._dataUnit.records.length === 0) {
648
+ this._dataUnit.addRecord();
649
+ }
650
+ this._dataUnit.startChange(fieldName, waitingChange);
625
651
  }
626
652
  setFieldValue(fieldName, newValue) {
627
653
  if (this._dataUnit.records.length === 0) {
@@ -639,19 +665,37 @@ class DataBinder {
639
665
  }
640
666
  }
641
667
  }
668
+ applyEzUploadContext(fieldName, field) {
669
+ var _a, _b;
670
+ if (field.nodeName === "EZ-UPLOAD") {
671
+ field["urlUpload"] = ApplicationContext.getContextValue("__EZUI__UPLOAD__ADD__URL__");
672
+ field["urlDelete"] = ApplicationContext.getContextValue("__EZUI__UPLOAD__DEL__URL__");
673
+ const descriptor = this._dataUnit.getField(fieldName);
674
+ const destination = (_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.DESTINATION;
675
+ if (destination) {
676
+ field["requestHeaders"] = { XTRAINF: `{"destination": "${destination}"}` };
677
+ }
678
+ field["maxFiles"] = ((_b = descriptor.properties) === null || _b === void 0 ? void 0 : _b.MAX_FILES) || 0;
679
+ }
680
+ }
642
681
  }
643
682
  class Bind {
683
+ constructor() {
684
+ this.startChangeEventName = "ezStartChange";
685
+ this.changeEventName = "ezChange";
686
+ }
644
687
  destroy() {
645
- this.field.removeEventListener(this.eventName, this.eventListener);
688
+ this.field.removeEventListener(this.startChangeEventName, this.startChangeListener);
689
+ this.field.removeEventListener(this.changeEventName, this.changeListener);
646
690
  }
647
- static create(fieldName, field, callback) {
691
+ static create(fieldName, field, startChangeCallback, changeCallback) {
648
692
  const b = new Bind();
649
- b.fieldName = fieldName;
650
693
  b.field = field;
651
- //FIXME: Verificar se o field é um EzField
652
- b.eventListener = (evt) => { callback(fieldName, evt.detail); };
653
- b.eventName = "ezChange";
654
- b.field.addEventListener(b.eventName, b.eventListener);
694
+ b.fieldName = fieldName;
695
+ b.startChangeListener = (evt) => { startChangeCallback(fieldName, evt.detail); };
696
+ b.field.addEventListener(b.startChangeEventName, b.startChangeListener);
697
+ b.changeListener = (evt) => { changeCallback(fieldName, evt.detail); };
698
+ b.field.addEventListener(b.changeEventName, b.changeListener);
655
699
  return b;
656
700
  }
657
701
  }
@@ -97,6 +97,7 @@ let EzUpload = class {
97
97
  constructor(hostRef) {
98
98
  registerInstance(this, hostRef);
99
99
  this.ezChange = createEvent(this, "ezChange", 7);
100
+ this.ezStartChange = createEvent(this, "ezStartChange", 7);
100
101
  this._filePointers = new Map();
101
102
  /**
102
103
  * Deixa o campo disponível ou não para digitação.
@@ -104,6 +105,9 @@ let EzUpload = class {
104
105
  this.enabled = true;
105
106
  }
106
107
  changeValue(newValue) {
108
+ //Observamos o mundo externo, se um novo valor foi atribuído,
109
+ //precisamos cancelar a alteração anterior, isso envolve, percorrer
110
+ //a lista de ponteiros e cancelar todos os uploads em andamento.
107
111
  if (newValue !== this._updatingValue) {
108
112
  this._filePointers.forEach(f => {
109
113
  if (this.isRemoteFile(f)) {
@@ -112,8 +116,8 @@ let EzUpload = class {
112
116
  });
113
117
  this._filePointers = new Map();
114
118
  this.updateFilePointers();
119
+ this._updatingValue = undefined;
115
120
  }
116
- this._updatingValue = undefined;
117
121
  }
118
122
  updateFilePointers() {
119
123
  if (this.value) {
@@ -183,6 +187,7 @@ let EzUpload = class {
183
187
  }
184
188
  async doAddFile(file) {
185
189
  if (this.validateFile(file)) {
190
+ this.ezStartChange.emit({ waitmessage: "Há arquivos sendo enviados. Por favor aguarde a conclusão ou cancele o envio." });
186
191
  const uploadingFile = new RemoteFile(file);
187
192
  this._filePointers.set(file.name, uploadingFile);
188
193
  uploadingFile.upload(this.urlUpload, this._requestHeaders, (file) => this.updateFeedback(file))
@@ -202,8 +207,10 @@ let EzUpload = class {
202
207
  this._updatingValue.push(f);
203
208
  }
204
209
  });
205
- this.value = this._updatingValue;
206
- this.ezChange.emit(this.value);
210
+ if (this._filePointers.size === this._updatingValue.length) {
211
+ this.value = this._updatingValue;
212
+ this.ezChange.emit(this.value);
213
+ }
207
214
  }
208
215
  buildProgressId(uploading) {
209
216
  let sanitizedName = uploading.name.replace(/[^a-z0-9_]/gi, "_");
package/dist/esm/ezui.js CHANGED
@@ -13,5 +13,5 @@ const patchBrowser = () => {
13
13
  };
14
14
 
15
15
  patchBrowser().then(options => {
16
- return bootstrapLazy([["ez-grid",[[6,"ez-grid",{"multipleSelection":[4,"multiple-selection"],"pageSize":[2,"page-size"],"serverUrl":[1,"server-url"],"dataUnit":[16],"_navigationHasPrevious":[32],"_navigationHasNext":[32],"_navigationFirstRow":[32],"_navigationLastRow":[32],"_navigationTotalRows":[32],"_popUpVisible":[32],"setColumnsDef":[64],"addColumnMenuItem":[64],"setColumnsState":[64],"setData":[64],"getSelection":[64],"getColumnsState":[64],"getColumns":[64],"refresh":[64],"quickFilter":[64]}]]],["ez-dialog",[[1,"ez-dialog",{"confirm":[1028],"critical":[1028],"message":[1025],"opened":[1540],"personalizedIconPath":[1025,"personalized-icon-path"],"ezTitle":[1025,"ez-title"],"handleButtonClick":[64],"show":[64]}]]],["ez-filter-input",[[1,"ez-filter-input",{"label":[1],"value":[1537],"enabled":[4],"loading":[516],"errorMessage":[1537,"error-message"],"restrict":[1],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-action-chip",[[1,"ez-action-chip",{"label":[513],"enabled":[516]}]]],["ez-application",[[0,"ez-application"]]],["ez-label-chip",[[1,"ez-label-chip",{"label":[513],"enabled":[516],"removable":[516],"value":[1540],"setFocus":[64],"setBlur":[64]}]]],["ez-popover",[[1,"ez-popover",{"autoClose":[516,"auto-close"],"top":[1537],"left":[1537],"bottom":[1537],"right":[1537],"boxWidth":[513,"box-width"],"opened":[1540],"innerElement":[1537,"inner-element"],"updatePosition":[64],"show":[64],"hide":[64]}]]],["ez-popup",[[1,"ez-popup",{"size":[1],"opened":[1540],"useHeader":[1540,"use-header"],"ezTitle":[1,"ez-title"]}]]],["ez-toast",[[1,"ez-toast",{"message":[1025],"fadeTime":[1026,"fade-time"],"useIcon":[1028,"use-icon"],"canClose":[1028,"can-close"],"show":[64]}]]],["grid-config",[[2,"grid-config",{"selectedTab":[1025,"selected-tab"],"columns":[1040]}]]],["ez-modal",[[1,"ez-modal",{"modalSize":[1,"modal-size"],"align":[1],"opened":[1028],"closeEsc":[4,"close-esc"],"closeOutsideClick":[4,"close-outside-click"]}]]],["ez-text-input",[[1,"ez-text-input",{"label":[513],"value":[1537],"enabled":[516],"loading":[516],"errorMessage":[1537,"error-message"],"mask":[1],"canShowError":[516,"can-show-error"],"restrict":[1],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-date-input",[[1,"ez-date-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-date-time-input",[[1,"ez-date-time-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-search",[[1,"ez-search",{"value":[1537],"label":[1537],"enabled":[1540],"errorMessage":[1537,"error-message"],"optionLoader":[16],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"],"suppressEmptyOption":[4,"suppress-empty-option"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-time-input",[[1,"ez-time-input",{"label":[513],"viewValue":[1537,"view-value"],"value":[1026],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-number-input",[[1,"ez-number-input",{"label":[1],"value":[1538],"enabled":[4],"errorMessage":[1537,"error-message"],"precision":[2],"prettyPrecision":[2,"pretty-precision"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-collapsible-box",[[1,"ez-collapsible-box",{"value":[1540],"label":[513],"headerSize":[513,"header-size"],"iconPlacement":[513,"icon-placement"],"showHide":[64]}]]],["test-du",[[0,"test-du"]]],["select-box",[[1,"select-box",{"selectedOption":[1,"selected-option"]}]]],["ez-list",[[1,"ez-list",{"dataSource":[1040],"useGroups":[1540,"use-groups"],"ezDraggable":[1028,"ez-draggable"],"ezSelectable":[1028,"ez-selectable"],"itemSlotBuilder":[1040],"_listItems":[32],"_listGroupItems":[32],"setSelection":[64],"getSelection":[64],"getList":[64]}]]],["ez-text-area",[[1,"ez-text-area",{"label":[513],"value":[1537],"enabled":[516],"loading":[516],"errorMessage":[1537,"error-message"],"rows":[1538],"canShowError":[516,"can-show-error"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-upload",[[1,"ez-upload",{"label":[1],"enabled":[4],"maxFileSize":[2,"max-file-size"],"maxFiles":[2,"max-files"],"requestHeaders":[8,"request-headers"],"urlUpload":[1,"url-upload"],"urlDelete":[1,"url-delete"],"value":[1040],"addFiles":[64],"setFocus":[64],"setBlur":[64]}]]],["ez-button",[[1,"ez-button",{"label":[513],"enabled":[516],"mode":[513],"image":[513],"iconName":[513,"icon-name"],"size":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-calendar",[[1,"ez-calendar",{"value":[1040],"floating":[516],"time":[516],"showSeconds":[516,"show-seconds"],"show":[64],"fitVertical":[64],"hide":[64]}]]],["ez-check",[[1,"ez-check",{"label":[513],"value":[1540],"enabled":[516],"mode":[513],"getMode":[64],"setFocus":[64]}]]],["ez-tabselector",[[1,"ez-tabselector",{"selectedIndex":[1538,"selected-index"],"selectedTab":[1537,"selected-tab"],"tabs":[1]}]]],["ez-combo-box",[[1,"ez-combo-box",{"value":[1537],"label":[513],"enabled":[516],"options":[1040],"errorMessage":[1537,"error-message"],"searchMode":[4,"search-mode"],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"],"optionLoader":[16],"suppressEmptyOption":[4,"suppress-empty-option"],"canShowError":[516,"can-show-error"],"mode":[513],"_preSelection":[32],"_visibleOptions":[32],"setFocus":[64],"setBlur":[64]}]]],["ez-icon",[[1,"ez-icon",{"size":[513],"href":[513],"iconName":[513,"icon-name"]}]]],["ez-form",[[0,"ez-form",{"dataUnit":[1040],"config":[16],"submit":[64],"cancel":[64],"validate":[64]}]]]], options);
16
+ return bootstrapLazy([["ez-grid",[[6,"ez-grid",{"multipleSelection":[4,"multiple-selection"],"pageSize":[2,"page-size"],"serverUrl":[1,"server-url"],"dataUnit":[16],"_navigationHasPrevious":[32],"_navigationHasNext":[32],"_navigationFirstRow":[32],"_navigationLastRow":[32],"_navigationTotalRows":[32],"_popUpVisible":[32],"setColumnsDef":[64],"addColumnMenuItem":[64],"setColumnsState":[64],"setData":[64],"getSelection":[64],"getColumnsState":[64],"getColumns":[64],"refresh":[64],"quickFilter":[64]}]]],["ez-dialog",[[1,"ez-dialog",{"confirm":[1028],"critical":[1028],"message":[1025],"opened":[1540],"personalizedIconPath":[1025,"personalized-icon-path"],"ezTitle":[1025,"ez-title"],"handleButtonClick":[64],"show":[64]}]]],["ez-filter-input",[[1,"ez-filter-input",{"label":[1],"value":[1537],"enabled":[4],"loading":[516],"errorMessage":[1537,"error-message"],"restrict":[1],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-action-chip",[[1,"ez-action-chip",{"label":[513],"enabled":[516]}]]],["ez-application",[[0,"ez-application"]]],["ez-label-chip",[[1,"ez-label-chip",{"label":[513],"enabled":[516],"removable":[516],"value":[1540],"setFocus":[64],"setBlur":[64]}]]],["ez-popover",[[1,"ez-popover",{"autoClose":[516,"auto-close"],"top":[1537],"left":[1537],"bottom":[1537],"right":[1537],"boxWidth":[513,"box-width"],"opened":[1540],"innerElement":[1537,"inner-element"],"updatePosition":[64],"show":[64],"hide":[64]}]]],["ez-popup",[[1,"ez-popup",{"size":[1],"opened":[1540],"useHeader":[1540,"use-header"],"ezTitle":[1,"ez-title"]}]]],["ez-toast",[[1,"ez-toast",{"message":[1025],"fadeTime":[1026,"fade-time"],"useIcon":[1028,"use-icon"],"canClose":[1028,"can-close"],"show":[64]}]]],["grid-config",[[2,"grid-config",{"selectedTab":[1025,"selected-tab"],"columns":[1040]}]]],["ez-modal",[[1,"ez-modal",{"modalSize":[1,"modal-size"],"align":[1],"opened":[1028],"closeEsc":[4,"close-esc"],"closeOutsideClick":[4,"close-outside-click"]}]]],["ez-text-input",[[1,"ez-text-input",{"label":[513],"value":[1537],"enabled":[516],"loading":[516],"errorMessage":[1537,"error-message"],"mask":[1],"canShowError":[516,"can-show-error"],"restrict":[1],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-date-input",[[1,"ez-date-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-date-time-input",[[1,"ez-date-time-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-search",[[1,"ez-search",{"value":[1537],"label":[1537],"enabled":[1540],"errorMessage":[1537,"error-message"],"optionLoader":[16],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"],"suppressEmptyOption":[4,"suppress-empty-option"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-time-input",[[1,"ez-time-input",{"label":[513],"viewValue":[1537,"view-value"],"value":[1026],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-number-input",[[1,"ez-number-input",{"label":[1],"value":[1538],"enabled":[4],"errorMessage":[1537,"error-message"],"precision":[2],"prettyPrecision":[2,"pretty-precision"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-collapsible-box",[[1,"ez-collapsible-box",{"value":[1540],"label":[513],"headerSize":[513,"header-size"],"iconPlacement":[513,"icon-placement"],"showHide":[64]}]]],["test-du",[[0,"test-du",{"isDirty":[32]}]]],["select-box",[[1,"select-box",{"selectedOption":[1,"selected-option"]}]]],["ez-list",[[1,"ez-list",{"dataSource":[1040],"useGroups":[1540,"use-groups"],"ezDraggable":[1028,"ez-draggable"],"ezSelectable":[1028,"ez-selectable"],"itemSlotBuilder":[1040],"_listItems":[32],"_listGroupItems":[32],"setSelection":[64],"getSelection":[64],"getList":[64]}]]],["ez-text-area",[[1,"ez-text-area",{"label":[513],"value":[1537],"enabled":[516],"loading":[516],"errorMessage":[1537,"error-message"],"rows":[1538],"canShowError":[516,"can-show-error"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-upload",[[1,"ez-upload",{"label":[1],"enabled":[4],"maxFileSize":[2,"max-file-size"],"maxFiles":[2,"max-files"],"requestHeaders":[8,"request-headers"],"urlUpload":[1,"url-upload"],"urlDelete":[1,"url-delete"],"value":[1040],"addFiles":[64],"setFocus":[64],"setBlur":[64]}]]],["ez-button",[[1,"ez-button",{"label":[513],"enabled":[516],"mode":[513],"image":[513],"iconName":[513,"icon-name"],"size":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-calendar",[[1,"ez-calendar",{"value":[1040],"floating":[516],"time":[516],"showSeconds":[516,"show-seconds"],"show":[64],"fitVertical":[64],"hide":[64]}]]],["ez-check",[[1,"ez-check",{"label":[513],"value":[1540],"enabled":[516],"mode":[513],"getMode":[64],"setFocus":[64]}]]],["ez-tabselector",[[1,"ez-tabselector",{"selectedIndex":[1538,"selected-index"],"selectedTab":[1537,"selected-tab"],"tabs":[1]}]]],["ez-combo-box",[[1,"ez-combo-box",{"value":[1537],"label":[513],"enabled":[516],"options":[1040],"errorMessage":[1537,"error-message"],"searchMode":[4,"search-mode"],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"],"optionLoader":[16],"suppressEmptyOption":[4,"suppress-empty-option"],"canShowError":[516,"can-show-error"],"mode":[513],"_preSelection":[32],"_visibleOptions":[32],"setFocus":[64],"setBlur":[64]}]]],["ez-icon",[[1,"ez-icon",{"size":[513],"href":[513],"iconName":[513,"icon-name"]}]]],["ez-form",[[0,"ez-form",{"dataUnit":[1040],"config":[16],"submit":[64],"cancel":[64],"validate":[64]}]]]], options);
17
17
  });
@@ -10,7 +10,7 @@ const patchEsm = () => {
10
10
  const defineCustomElements = (win, options) => {
11
11
  if (typeof window === 'undefined') return Promise.resolve();
12
12
  return patchEsm().then(() => {
13
- return bootstrapLazy([["ez-grid",[[6,"ez-grid",{"multipleSelection":[4,"multiple-selection"],"pageSize":[2,"page-size"],"serverUrl":[1,"server-url"],"dataUnit":[16],"_navigationHasPrevious":[32],"_navigationHasNext":[32],"_navigationFirstRow":[32],"_navigationLastRow":[32],"_navigationTotalRows":[32],"_popUpVisible":[32],"setColumnsDef":[64],"addColumnMenuItem":[64],"setColumnsState":[64],"setData":[64],"getSelection":[64],"getColumnsState":[64],"getColumns":[64],"refresh":[64],"quickFilter":[64]}]]],["ez-dialog",[[1,"ez-dialog",{"confirm":[1028],"critical":[1028],"message":[1025],"opened":[1540],"personalizedIconPath":[1025,"personalized-icon-path"],"ezTitle":[1025,"ez-title"],"handleButtonClick":[64],"show":[64]}]]],["ez-filter-input",[[1,"ez-filter-input",{"label":[1],"value":[1537],"enabled":[4],"loading":[516],"errorMessage":[1537,"error-message"],"restrict":[1],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-action-chip",[[1,"ez-action-chip",{"label":[513],"enabled":[516]}]]],["ez-application",[[0,"ez-application"]]],["ez-label-chip",[[1,"ez-label-chip",{"label":[513],"enabled":[516],"removable":[516],"value":[1540],"setFocus":[64],"setBlur":[64]}]]],["ez-popover",[[1,"ez-popover",{"autoClose":[516,"auto-close"],"top":[1537],"left":[1537],"bottom":[1537],"right":[1537],"boxWidth":[513,"box-width"],"opened":[1540],"innerElement":[1537,"inner-element"],"updatePosition":[64],"show":[64],"hide":[64]}]]],["ez-popup",[[1,"ez-popup",{"size":[1],"opened":[1540],"useHeader":[1540,"use-header"],"ezTitle":[1,"ez-title"]}]]],["ez-toast",[[1,"ez-toast",{"message":[1025],"fadeTime":[1026,"fade-time"],"useIcon":[1028,"use-icon"],"canClose":[1028,"can-close"],"show":[64]}]]],["grid-config",[[2,"grid-config",{"selectedTab":[1025,"selected-tab"],"columns":[1040]}]]],["ez-modal",[[1,"ez-modal",{"modalSize":[1,"modal-size"],"align":[1],"opened":[1028],"closeEsc":[4,"close-esc"],"closeOutsideClick":[4,"close-outside-click"]}]]],["ez-text-input",[[1,"ez-text-input",{"label":[513],"value":[1537],"enabled":[516],"loading":[516],"errorMessage":[1537,"error-message"],"mask":[1],"canShowError":[516,"can-show-error"],"restrict":[1],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-date-input",[[1,"ez-date-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-date-time-input",[[1,"ez-date-time-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-search",[[1,"ez-search",{"value":[1537],"label":[1537],"enabled":[1540],"errorMessage":[1537,"error-message"],"optionLoader":[16],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"],"suppressEmptyOption":[4,"suppress-empty-option"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-time-input",[[1,"ez-time-input",{"label":[513],"viewValue":[1537,"view-value"],"value":[1026],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-number-input",[[1,"ez-number-input",{"label":[1],"value":[1538],"enabled":[4],"errorMessage":[1537,"error-message"],"precision":[2],"prettyPrecision":[2,"pretty-precision"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-collapsible-box",[[1,"ez-collapsible-box",{"value":[1540],"label":[513],"headerSize":[513,"header-size"],"iconPlacement":[513,"icon-placement"],"showHide":[64]}]]],["test-du",[[0,"test-du"]]],["select-box",[[1,"select-box",{"selectedOption":[1,"selected-option"]}]]],["ez-list",[[1,"ez-list",{"dataSource":[1040],"useGroups":[1540,"use-groups"],"ezDraggable":[1028,"ez-draggable"],"ezSelectable":[1028,"ez-selectable"],"itemSlotBuilder":[1040],"_listItems":[32],"_listGroupItems":[32],"setSelection":[64],"getSelection":[64],"getList":[64]}]]],["ez-text-area",[[1,"ez-text-area",{"label":[513],"value":[1537],"enabled":[516],"loading":[516],"errorMessage":[1537,"error-message"],"rows":[1538],"canShowError":[516,"can-show-error"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-upload",[[1,"ez-upload",{"label":[1],"enabled":[4],"maxFileSize":[2,"max-file-size"],"maxFiles":[2,"max-files"],"requestHeaders":[8,"request-headers"],"urlUpload":[1,"url-upload"],"urlDelete":[1,"url-delete"],"value":[1040],"addFiles":[64],"setFocus":[64],"setBlur":[64]}]]],["ez-button",[[1,"ez-button",{"label":[513],"enabled":[516],"mode":[513],"image":[513],"iconName":[513,"icon-name"],"size":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-calendar",[[1,"ez-calendar",{"value":[1040],"floating":[516],"time":[516],"showSeconds":[516,"show-seconds"],"show":[64],"fitVertical":[64],"hide":[64]}]]],["ez-check",[[1,"ez-check",{"label":[513],"value":[1540],"enabled":[516],"mode":[513],"getMode":[64],"setFocus":[64]}]]],["ez-tabselector",[[1,"ez-tabselector",{"selectedIndex":[1538,"selected-index"],"selectedTab":[1537,"selected-tab"],"tabs":[1]}]]],["ez-combo-box",[[1,"ez-combo-box",{"value":[1537],"label":[513],"enabled":[516],"options":[1040],"errorMessage":[1537,"error-message"],"searchMode":[4,"search-mode"],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"],"optionLoader":[16],"suppressEmptyOption":[4,"suppress-empty-option"],"canShowError":[516,"can-show-error"],"mode":[513],"_preSelection":[32],"_visibleOptions":[32],"setFocus":[64],"setBlur":[64]}]]],["ez-icon",[[1,"ez-icon",{"size":[513],"href":[513],"iconName":[513,"icon-name"]}]]],["ez-form",[[0,"ez-form",{"dataUnit":[1040],"config":[16],"submit":[64],"cancel":[64],"validate":[64]}]]]], options);
13
+ return bootstrapLazy([["ez-grid",[[6,"ez-grid",{"multipleSelection":[4,"multiple-selection"],"pageSize":[2,"page-size"],"serverUrl":[1,"server-url"],"dataUnit":[16],"_navigationHasPrevious":[32],"_navigationHasNext":[32],"_navigationFirstRow":[32],"_navigationLastRow":[32],"_navigationTotalRows":[32],"_popUpVisible":[32],"setColumnsDef":[64],"addColumnMenuItem":[64],"setColumnsState":[64],"setData":[64],"getSelection":[64],"getColumnsState":[64],"getColumns":[64],"refresh":[64],"quickFilter":[64]}]]],["ez-dialog",[[1,"ez-dialog",{"confirm":[1028],"critical":[1028],"message":[1025],"opened":[1540],"personalizedIconPath":[1025,"personalized-icon-path"],"ezTitle":[1025,"ez-title"],"handleButtonClick":[64],"show":[64]}]]],["ez-filter-input",[[1,"ez-filter-input",{"label":[1],"value":[1537],"enabled":[4],"loading":[516],"errorMessage":[1537,"error-message"],"restrict":[1],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-action-chip",[[1,"ez-action-chip",{"label":[513],"enabled":[516]}]]],["ez-application",[[0,"ez-application"]]],["ez-label-chip",[[1,"ez-label-chip",{"label":[513],"enabled":[516],"removable":[516],"value":[1540],"setFocus":[64],"setBlur":[64]}]]],["ez-popover",[[1,"ez-popover",{"autoClose":[516,"auto-close"],"top":[1537],"left":[1537],"bottom":[1537],"right":[1537],"boxWidth":[513,"box-width"],"opened":[1540],"innerElement":[1537,"inner-element"],"updatePosition":[64],"show":[64],"hide":[64]}]]],["ez-popup",[[1,"ez-popup",{"size":[1],"opened":[1540],"useHeader":[1540,"use-header"],"ezTitle":[1,"ez-title"]}]]],["ez-toast",[[1,"ez-toast",{"message":[1025],"fadeTime":[1026,"fade-time"],"useIcon":[1028,"use-icon"],"canClose":[1028,"can-close"],"show":[64]}]]],["grid-config",[[2,"grid-config",{"selectedTab":[1025,"selected-tab"],"columns":[1040]}]]],["ez-modal",[[1,"ez-modal",{"modalSize":[1,"modal-size"],"align":[1],"opened":[1028],"closeEsc":[4,"close-esc"],"closeOutsideClick":[4,"close-outside-click"]}]]],["ez-text-input",[[1,"ez-text-input",{"label":[513],"value":[1537],"enabled":[516],"loading":[516],"errorMessage":[1537,"error-message"],"mask":[1],"canShowError":[516,"can-show-error"],"restrict":[1],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-date-input",[[1,"ez-date-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-date-time-input",[[1,"ez-date-time-input",{"label":[513],"value":[1040],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-search",[[1,"ez-search",{"value":[1537],"label":[1537],"enabled":[1540],"errorMessage":[1537,"error-message"],"optionLoader":[16],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"],"suppressEmptyOption":[4,"suppress-empty-option"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-time-input",[[1,"ez-time-input",{"label":[513],"viewValue":[1537,"view-value"],"value":[1026],"enabled":[516],"errorMessage":[1537,"error-message"],"showSeconds":[516,"show-seconds"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-number-input",[[1,"ez-number-input",{"label":[1],"value":[1538],"enabled":[4],"errorMessage":[1537,"error-message"],"precision":[2],"prettyPrecision":[2,"pretty-precision"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-collapsible-box",[[1,"ez-collapsible-box",{"value":[1540],"label":[513],"headerSize":[513,"header-size"],"iconPlacement":[513,"icon-placement"],"showHide":[64]}]]],["test-du",[[0,"test-du",{"isDirty":[32]}]]],["select-box",[[1,"select-box",{"selectedOption":[1,"selected-option"]}]]],["ez-list",[[1,"ez-list",{"dataSource":[1040],"useGroups":[1540,"use-groups"],"ezDraggable":[1028,"ez-draggable"],"ezSelectable":[1028,"ez-selectable"],"itemSlotBuilder":[1040],"_listItems":[32],"_listGroupItems":[32],"setSelection":[64],"getSelection":[64],"getList":[64]}]]],["ez-text-area",[[1,"ez-text-area",{"label":[513],"value":[1537],"enabled":[516],"loading":[516],"errorMessage":[1537,"error-message"],"rows":[1538],"canShowError":[516,"can-show-error"],"mode":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-upload",[[1,"ez-upload",{"label":[1],"enabled":[4],"maxFileSize":[2,"max-file-size"],"maxFiles":[2,"max-files"],"requestHeaders":[8,"request-headers"],"urlUpload":[1,"url-upload"],"urlDelete":[1,"url-delete"],"value":[1040],"addFiles":[64],"setFocus":[64],"setBlur":[64]}]]],["ez-button",[[1,"ez-button",{"label":[513],"enabled":[516],"mode":[513],"image":[513],"iconName":[513,"icon-name"],"size":[513],"setFocus":[64],"setBlur":[64]}]]],["ez-calendar",[[1,"ez-calendar",{"value":[1040],"floating":[516],"time":[516],"showSeconds":[516,"show-seconds"],"show":[64],"fitVertical":[64],"hide":[64]}]]],["ez-check",[[1,"ez-check",{"label":[513],"value":[1540],"enabled":[516],"mode":[513],"getMode":[64],"setFocus":[64]}]]],["ez-tabselector",[[1,"ez-tabselector",{"selectedIndex":[1538,"selected-index"],"selectedTab":[1537,"selected-tab"],"tabs":[1]}]]],["ez-combo-box",[[1,"ez-combo-box",{"value":[1537],"label":[513],"enabled":[516],"options":[1040],"errorMessage":[1537,"error-message"],"searchMode":[4,"search-mode"],"showSelectedValue":[4,"show-selected-value"],"showOptionValue":[4,"show-option-value"],"optionLoader":[16],"suppressEmptyOption":[4,"suppress-empty-option"],"canShowError":[516,"can-show-error"],"mode":[513],"_preSelection":[32],"_visibleOptions":[32],"setFocus":[64],"setBlur":[64]}]]],["ez-icon",[[1,"ez-icon",{"size":[513],"href":[513],"iconName":[513,"icon-name"]}]]],["ez-form",[[0,"ez-form",{"dataUnit":[1040],"config":[16],"submit":[64],"cancel":[64],"validate":[64]}]]]], options);
14
14
  });
15
15
  };
16
16
 
@@ -1,5 +1,6 @@
1
1
  import { r as registerInstance, h } from './index-6b8bfbeb.js';
2
- import { DataUnit, DataType, UserInterface } from '@sankhyalabs/core';
2
+ import { ApplicationContext, DataUnit, DataType, UserInterface } from '@sankhyalabs/core';
3
+ import { A as ApplicationUtils } from './ApplicationUtils-3ca0e68d.js';
3
4
 
4
5
  const testDuCss = ":host{display:block}";
5
6
 
@@ -7,49 +8,23 @@ let TestDu = class {
7
8
  constructor(hostRef) {
8
9
  registerInstance(this, hostRef);
9
10
  }
10
- /*private _ezButton// : HTMLEzButton;
11
- private _ezComboBox// : HTMLEzComboBox;
12
- private _ezDateInput// : HTMLEzDateInput;
13
- private _ezDateTimeInput// : HTMLEzDateTimeInput;
14
- private _ezNumberInput// : HTMLEzNumberInput
15
- private _ezSearch// : HTMLEzSearch
16
- private _ezUpload// : HTMLEzUpload
17
- private _ezFilterInput// : HTMLEzFilterInput*/
18
11
  componentWillLoad() {
12
+ ApplicationContext.setContextValue("__EZUI__UPLOAD__ADD__URL__", "http://localhost:8080/mge/ez.uploading");
19
13
  this.dataUnit = new DataUnit("testes_com_formulario");
14
+ this.dataUnit.subscribe(() => this.isDirty = this.dataUnit.isDirty());
20
15
  this.dataUnit.metadata = {
21
16
  name: "dd://br.com.sankhya.fin.cad.movimentacaoFinanceira/Financeiro",
22
17
  label: "Parceiro",
23
18
  fields: [
24
19
  {
25
- name: "CODPARC",
26
- label: "Parceiro",
27
- dataType: DataType.NUMBER,
28
- userInterface: UserInterface.SEARCH,
29
- required: true,
30
- properties: {}
31
- },
32
- {
33
- name: "RECDESP",
34
- label: "Receita/Despesa",
35
- dataType: DataType.TEXT,
36
- userInterface: UserInterface.OPTIONSELECTOR,
37
- required: true,
38
- properties: { options: `{"-1": "Despesa", "1": "Receita"}` }
39
- },
40
- {
41
- name: "P",
42
- label: "pera",
43
- dataType: DataType.TEXT,
44
- userInterface: UserInterface.OPTIONSELECTOR,
45
- properties: { options: `{"M": "Madura", "V": "Verde", "P": "Passada"}` }
46
- },
47
- {
48
- name: "ME",
49
- label: "ME",
50
- dataType: DataType.NUMBER,
51
- userInterface: UserInterface.DECIMALNUMBER,
52
- properties: { precision: 4, prettyPrecision: 1 }
20
+ name: "ANEXO",
21
+ label: "Anexo",
22
+ dataType: DataType.OBJECT,
23
+ userInterface: UserInterface.FILE,
24
+ properties: {
25
+ DESTINATION: "MULTIFILE",
26
+ MAX_FILES: "2"
27
+ }
53
28
  }
54
29
  ]
55
30
  };
@@ -67,9 +42,23 @@ let TestDu = class {
67
42
  total: 100,
68
43
  hasMore: true
69
44
  }));
45
+ this.dataUnit.saveLoader = (_dataUnit, changes) => {
46
+ const savedRecords = [];
47
+ changes.forEach(change => {
48
+ savedRecords.push(Object.assign(Object.assign({}, change.record), change.updatingFields));
49
+ });
50
+ return Promise.resolve(savedRecords);
51
+ };
52
+ }
53
+ save() {
54
+ this.dataUnit.saveData().catch(e => {
55
+ if (e.kind === "WAITING_CHANGE_ERROR") {
56
+ ApplicationUtils.alert(`Alterando campo ${e.fieldName}`, e.message);
57
+ }
58
+ });
70
59
  }
71
60
  render() {
72
- return (h("ez-form", { dataUnit: this.dataUnit }));
61
+ return (h("div", null, h("button", { onClick: () => this.dataUnit.loadData() }, "Carregar"), h("button", { onClick: () => this.save(), disabled: !this.isDirty }, "Salvar"), h("ez-form", { dataUnit: this.dataUnit })));
73
62
  }
74
63
  };
75
64
  TestDu.style = testDuCss;