@sankhyalabs/ezui 1.1.139 → 1.1.142

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 (61) hide show
  1. package/dist/cjs/ez-date-input.cjs.entry.js +16 -5
  2. package/dist/cjs/ez-date-time-input.cjs.entry.js +7 -1
  3. package/dist/cjs/ez-form.cjs.entry.js +53 -8
  4. package/dist/cjs/ez-grid.cjs.entry.js +11 -5
  5. package/dist/cjs/ez-number-input.cjs.entry.js +8 -1
  6. package/dist/cjs/ez-text-area.cjs.entry.js +35 -22
  7. package/dist/cjs/ez-text-input.cjs.entry.js +11 -9
  8. package/dist/cjs/ez-time-input.cjs.entry.js +5 -0
  9. package/dist/cjs/ez-upload.cjs.entry.js +28 -9
  10. package/dist/collection/components/ez-date-input/ez-date-input.js +49 -5
  11. package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +40 -1
  12. package/dist/collection/components/ez-form/DataBinder.js +54 -8
  13. package/dist/collection/components/ez-form/ez-form.js +0 -1
  14. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +10 -4
  15. package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +3 -3
  16. package/dist/collection/components/ez-number-input/ez-number-input.js +41 -1
  17. package/dist/collection/components/ez-text-area/ez-text-area.js +35 -22
  18. package/dist/collection/components/ez-text-input/ez-text-input.js +11 -9
  19. package/dist/collection/components/ez-time-input/ez-time-input.js +38 -0
  20. package/dist/collection/components/ez-upload/RemoteFile.js +6 -1
  21. package/dist/collection/components/ez-upload/ez-upload.js +36 -8
  22. package/dist/custom-elements/index.js +175 -61
  23. package/dist/esm/ez-date-input.entry.js +16 -5
  24. package/dist/esm/ez-date-time-input.entry.js +7 -1
  25. package/dist/esm/ez-form.entry.js +54 -9
  26. package/dist/esm/ez-grid.entry.js +12 -6
  27. package/dist/esm/ez-number-input.entry.js +8 -1
  28. package/dist/esm/ez-text-area.entry.js +35 -22
  29. package/dist/esm/ez-text-input.entry.js +11 -9
  30. package/dist/esm/ez-time-input.entry.js +5 -0
  31. package/dist/esm/ez-upload.entry.js +28 -9
  32. package/dist/ezui/ezui.esm.js +1 -1
  33. package/dist/ezui/p-140f7085.entry.js +1 -0
  34. package/dist/ezui/{p-51cdfa9e.entry.js → p-1b2bf15d.entry.js} +5 -5
  35. package/dist/ezui/p-24e98dc1.entry.js +1 -0
  36. package/dist/ezui/p-49fdfa4b.entry.js +1 -0
  37. package/dist/ezui/p-4fdceb7d.entry.js +1 -0
  38. package/dist/ezui/p-7746460e.entry.js +1 -0
  39. package/dist/ezui/p-87808290.entry.js +1 -0
  40. package/dist/ezui/p-b524dfca.entry.js +1 -0
  41. package/dist/ezui/p-ec21ecce.entry.js +1 -0
  42. package/dist/types/components/ez-date-input/ez-date-input.d.ts +12 -1
  43. package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +11 -0
  44. package/dist/types/components/ez-form/DataBinder.d.ts +1 -0
  45. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +2 -0
  46. package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +2 -2
  47. package/dist/types/components/ez-number-input/ez-number-input.d.ts +11 -0
  48. package/dist/types/components/ez-text-area/ez-text-area.d.ts +4 -3
  49. package/dist/types/components/ez-text-input/ez-text-input.d.ts +1 -1
  50. package/dist/types/components/ez-time-input/ez-time-input.d.ts +10 -0
  51. package/dist/types/components/ez-upload/ez-upload.d.ts +5 -0
  52. package/dist/types/components.d.ts +36 -0
  53. package/package.json +1 -1
  54. package/dist/ezui/p-248361f5.entry.js +0 -1
  55. package/dist/ezui/p-347b145b.entry.js +0 -1
  56. package/dist/ezui/p-9b82c2fe.entry.js +0 -1
  57. package/dist/ezui/p-b8d64970.entry.js +0 -1
  58. package/dist/ezui/p-c620258b.entry.js +0 -1
  59. package/dist/ezui/p-cb73bee7.entry.js +0 -1
  60. package/dist/ezui/p-db0981c1.entry.js +0 -1
  61. package/dist/ezui/p-ec8419f1.entry.js +0 -1
@@ -1,6 +1,6 @@
1
1
  import { HTMLElement as HTMLElement$1, createEvent, h, forceUpdate, Host, proxyCustomElement } from '@stencil/core/internal/client';
2
2
  export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
3
- import { FloatingManager, DateUtils, TimeFormatter, UserInterface, Action, ApplicationContext, DataUnitAction, DataUnit, NumberUtils, DataType, StringUtils, MaskFormatter } from '@sankhyalabs/core';
3
+ import { FloatingManager, DateUtils, TimeFormatter, UserInterface, Action, WaitingChangeException, ApplicationContext, DataUnitAction, DataUnit, NumberUtils, DataType, StringUtils, MaskFormatter } from '@sankhyalabs/core';
4
4
  import { UserInterface as UserInterface$1, SortMode } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
5
5
 
6
6
  const ezApplicationCss = "";
@@ -844,6 +844,8 @@ let EzDateInput$1 = class extends HTMLElement$1 {
844
844
  this.__registerHost();
845
845
  this.__attachShadow();
846
846
  this.ezChange = createEvent(this, "ezChange", 7);
847
+ this.ezStartChange = createEvent(this, "ezStartChange", 7);
848
+ this.ezCancelWaitingChange = createEvent(this, "ezCancelWaitingChange", 7);
847
849
  /**
848
850
  * Deixa o campo disponível ou não para uso.
849
851
  */
@@ -857,11 +859,16 @@ let EzDateInput$1 = class extends HTMLElement$1 {
857
859
  this._textInput.label = this.label;
858
860
  }
859
861
  observeErrorMessage() {
860
- this._textInput.errorMessage = this.errorMessage;
861
- }
862
- observeValue() {
863
862
  if (this._textInput) {
864
- this._textInput.value = this.getTextValue(this.value);
863
+ this._textInput.errorMessage = this.errorMessage;
864
+ }
865
+ }
866
+ observeValue(newValue, oldValue) {
867
+ if (newValue != oldValue) {
868
+ if (this._textInput) {
869
+ this.errorMessage = "";
870
+ this._textInput.value = this.getTextValue(this.value);
871
+ }
865
872
  }
866
873
  }
867
874
  /**
@@ -911,12 +918,16 @@ let EzDateInput$1 = class extends HTMLElement$1 {
911
918
  }
912
919
  }
913
920
  else {
921
+ this.ezCancelWaitingChange.emit();
914
922
  this._textInput.errorMessage = "O valor digitado não é uma data válida";
915
923
  }
916
924
  }
917
925
  getTextValue(d) {
918
926
  return d ? new Intl.DateTimeFormat("pt-BR").format(d) : undefined;
919
927
  }
928
+ startChange() {
929
+ this.ezStartChange.emit({ waitmessage: "", blocking: false });
930
+ }
920
931
  componentDidLoad() {
921
932
  CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
922
933
  }
@@ -924,7 +935,7 @@ let EzDateInput$1 = class extends HTMLElement$1 {
924
935
  return (h(Host, null, h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseDate(), onKeyDown: event => {
925
936
  if (event.key === "H" || event.key === "h")
926
937
  this.changeValue(new Date());
927
- }, label: this.label, value: this.getTextValue(this.value), restrict: "0123456789/", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, slaveMode: true }, h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })), h("ez-calendar", { onEzChange: (event) => { this.hideCalendar(); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem })));
938
+ }, label: this.label, value: this.getTextValue(this.value), onInput: () => this.startChange(), restrict: "0123456789/", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, slaveMode: true }, h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })), h("ez-calendar", { onEzChange: (event) => { this.hideCalendar(); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem })));
928
939
  }
929
940
  get _elem() { return this; }
930
941
  static get watchers() { return {
@@ -943,6 +954,8 @@ let EzDateTimeInput$1 = class extends HTMLElement$1 {
943
954
  this.__registerHost();
944
955
  this.__attachShadow();
945
956
  this.ezChange = createEvent(this, "ezChange", 7);
957
+ this.ezStartChange = createEvent(this, "ezStartChange", 7);
958
+ this.ezCancelWaitingChange = createEvent(this, "ezCancelWaitingChange", 7);
946
959
  /**
947
960
  * Deixa o campo disponível ou não para uso.
948
961
  */
@@ -1048,6 +1061,7 @@ let EzDateTimeInput$1 = class extends HTMLElement$1 {
1048
1061
  }
1049
1062
  }
1050
1063
  else {
1064
+ this.ezCancelWaitingChange.emit();
1051
1065
  this._textInput.errorMessage = "O valor digitado não é uma data válida";
1052
1066
  }
1053
1067
  }
@@ -1062,11 +1076,14 @@ let EzDateTimeInput$1 = class extends HTMLElement$1 {
1062
1076
  };
1063
1077
  return d ? (new Intl.DateTimeFormat('pt-BR', this.showSeconds ? optionsSecond : options).format(d)) : undefined;
1064
1078
  }
1079
+ startChange() {
1080
+ this.ezStartChange.emit({ waitmessage: "", blocking: false });
1081
+ }
1065
1082
  componentDidLoad() {
1066
1083
  CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
1067
1084
  }
1068
1085
  render() {
1069
- return (h(Host, null, h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseDate(), onKeyDown: event => { this.onChangeKeyDown(event); }, label: this.label, value: this.getTextValue(this.value), restrict: "0123456789/: ", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, onFocus: () => this.onFocused(), onClick: () => this.onClicked(), slaveMode: true }, h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })), h("ez-calendar", { onEzChange: (event) => { this.changeValue(this._calendar.value); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem, time: true, showSeconds: this.showSeconds })));
1086
+ return (h(Host, null, h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseDate(), onKeyDown: event => { this.onChangeKeyDown(event); }, label: this.label, value: this.getTextValue(this.value), restrict: "0123456789/: ", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, onInput: () => this.startChange(), onFocus: () => this.onFocused(), onClick: () => this.onClicked(), slaveMode: true }, h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })), h("ez-calendar", { onEzChange: (event) => { this.changeValue(this._calendar.value); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem, time: true, showSeconds: this.showSeconds })));
1070
1087
  }
1071
1088
  get _elem() { return this; }
1072
1089
  static get watchers() { return {
@@ -1880,11 +1897,7 @@ class DataBinder {
1880
1897
  this._dataUnit.unsubscribe(this.onDataUnitEvent);
1881
1898
  }
1882
1899
  updateValue(fieldName, field) {
1883
- const oldValue = field["value"];
1884
- const newValue = this._dataUnit.getFieldValue(fieldName);
1885
- if (oldValue != newValue) {
1886
- field["value"] = newValue;
1887
- }
1900
+ field["value"] = this._dataUnit.getFieldValue(fieldName);
1888
1901
  }
1889
1902
  updateBind(fieldName, field) {
1890
1903
  const oldBind = this._fields.get(fieldName);
@@ -1892,21 +1905,53 @@ class DataBinder {
1892
1905
  oldBind.destroy();
1893
1906
  }
1894
1907
  field["value"] = this._dataUnit.getFieldValue(fieldName);
1895
- this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, waitingChange) => this.changeStarted(fieldName, waitingChange), (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
1908
+ this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, waitingChange) => this.changeStarted(fieldName, waitingChange), (fieldName) => this.cancelWaitingChange(fieldName), (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
1896
1909
  this.bindSearchOptionsLoader(fieldName, field);
1897
1910
  this.applyEzUploadContext(fieldName, field);
1898
1911
  }
1899
1912
  changeStarted(fieldName, waitingChange) {
1913
+ /**
1914
+ * se o waitingChange não é blocante, add um event listener pra
1915
+ * fazer o accept da promise
1916
+ *
1917
+ * se não tiver promise no waitingChange, eu crio uma e resolvo no bind
1918
+ *
1919
+ *
1920
+ */
1900
1921
  if (this._dataUnit.records.length === 0) {
1901
1922
  this._dataUnit.addRecord();
1902
1923
  }
1924
+ if (!waitingChange.blocking && waitingChange.promise == undefined) {
1925
+ const bind = this._fields.get(fieldName);
1926
+ if (bind) {
1927
+ waitingChange.promise = new Promise((resolve, reject) => {
1928
+ bind.waitingChangePromiseResolve = resolve;
1929
+ bind.waitingChangePromiseReject = reject;
1930
+ });
1931
+ }
1932
+ }
1903
1933
  this._dataUnit.startChange(fieldName, waitingChange);
1904
1934
  }
1935
+ cancelWaitingChange(fieldName) {
1936
+ if (this._dataUnit.waitingForChange(fieldName)) {
1937
+ this._dataUnit.cancelWaitingChange(fieldName);
1938
+ const bind = this._fields.get(fieldName);
1939
+ if (bind) {
1940
+ bind.rejectWaitingChange(new WaitingChangeException("Change canceled", fieldName));
1941
+ }
1942
+ }
1943
+ }
1905
1944
  setFieldValue(fieldName, newValue) {
1906
1945
  if (this._dataUnit.records.length === 0) {
1907
1946
  this._dataUnit.addRecord();
1908
1947
  }
1909
1948
  this._dataUnit.setFieldValue(fieldName, newValue);
1949
+ if (this._dataUnit.waitingForChange(fieldName)) {
1950
+ const bind = this._fields.get(fieldName);
1951
+ if (bind) {
1952
+ bind.acceptWaitingChange();
1953
+ }
1954
+ }
1910
1955
  }
1911
1956
  bindSearchOptionsLoader(fieldName, field) {
1912
1957
  if (field.nodeName === "EZ-SEARCH" && field["optionLoader"] == undefined) {
@@ -1935,18 +1980,36 @@ class DataBinder {
1935
1980
  class Bind {
1936
1981
  constructor() {
1937
1982
  this.startChangeEventName = "ezStartChange";
1983
+ this.cancelWaitingChangeEventName = "ezCancelWaitingChange";
1938
1984
  this.changeEventName = "ezChange";
1939
1985
  }
1940
1986
  destroy() {
1941
1987
  this.field.removeEventListener(this.startChangeEventName, this.startChangeListener);
1988
+ this.field.removeEventListener(this.cancelWaitingChangeEventName, this.cancelWaitingChangeListener);
1942
1989
  this.field.removeEventListener(this.changeEventName, this.changeListener);
1943
1990
  }
1944
- static create(fieldName, field, startChangeCallback, changeCallback) {
1991
+ acceptWaitingChange() {
1992
+ if (this.waitingChangePromiseResolve) {
1993
+ this.waitingChangePromiseResolve();
1994
+ this.waitingChangePromiseReject = undefined;
1995
+ this.waitingChangePromiseResolve = undefined;
1996
+ }
1997
+ }
1998
+ rejectWaitingChange(reason) {
1999
+ if (this.waitingChangePromiseReject) {
2000
+ this.waitingChangePromiseReject(reason);
2001
+ this.waitingChangePromiseReject = undefined;
2002
+ this.waitingChangePromiseResolve = undefined;
2003
+ }
2004
+ }
2005
+ static create(fieldName, field, startChangeCallback, cancelWaitingChangeCallback, changeCallback) {
1945
2006
  const b = new Bind();
1946
2007
  b.field = field;
1947
2008
  b.fieldName = fieldName;
1948
2009
  b.startChangeListener = (evt) => { startChangeCallback(fieldName, evt.detail); };
1949
2010
  b.field.addEventListener(b.startChangeEventName, b.startChangeListener);
2011
+ b.cancelWaitingChangeListener = () => { cancelWaitingChangeCallback(fieldName); };
2012
+ b.field.addEventListener(b.cancelWaitingChangeEventName, b.cancelWaitingChangeListener);
1950
2013
  b.changeListener = (evt) => { changeCallback(fieldName, evt.detail); };
1951
2014
  b.field.addEventListener(b.changeEventName, b.changeListener);
1952
2015
  return b;
@@ -2091,7 +2154,6 @@ let EzForm$1 = class extends HTMLElement$1 {
2091
2154
  }
2092
2155
  }
2093
2156
  if (action.type === Action.RECORDS_ADDED) {
2094
- debugger;
2095
2157
  const metadata = selectFormMetadata(this._store.getState());
2096
2158
  const defaultValues = metadata.getDefaultValues();
2097
2159
  if (defaultValues) {
@@ -112169,7 +112231,7 @@ class DataSource {
112169
112231
  }
112170
112232
  }
112171
112233
  else {
112172
- this.loadData({ limit: params.api.paginationGetPageSize(), offset: params.request.startRow, quickFilter: this._quickFilterTerm })
112234
+ this.loadData({ limit: params.api.paginationGetPageSize(), offset: params.request.startRow, quickFilter: this._quickFilter })
112173
112235
  .then(data => params.success(data))
112174
112236
  .catch(() => params.fail());
112175
112237
  }
@@ -112188,14 +112250,16 @@ class DataSource {
112188
112250
  }
112189
112251
  });
112190
112252
  }
112191
- setQuickFilter(term) {
112192
- this._quickFilterTerm = term;
112253
+ setQuickFilter(term, fields) {
112254
+ this._quickFilter = { term, fields };
112193
112255
  }
112194
112256
  }
112195
112257
 
112196
112258
  class AgGridController {
112197
112259
  constructor(enterprise) {
112198
112260
  this.DEFAULT_ROW_HEIGHT = 25;
112261
+ this.CHECK_BOX_COL_ID = "checkBoxColumn";
112262
+ this.RECORD_ARCHIVE_COL_ID = "__RECORD_ARCHIVE__";
112199
112263
  this._menuItems = [];
112200
112264
  this._idAttribName = "__record__id__";
112201
112265
  this._isFirstRecordOfPage = true;
@@ -112219,6 +112283,7 @@ class AgGridController {
112219
112283
  ;
112220
112284
  initDatagrid(container, options) {
112221
112285
  if (this._grid === undefined) {
112286
+ agGridEnterprise_cjs.LicenseManager.setLicenseKey(ApplicationContext.getContextValue("__EZUI__GRID_LICENSE__"));
112222
112287
  this._columnStateChangeCallback = options.onColumnStateChange;
112223
112288
  this._selectionChangeCallback = options.onSelectionChange;
112224
112289
  this._paginationChangeCallback = options.onPaginationChange;
@@ -112364,7 +112429,7 @@ class AgGridController {
112364
112429
  const colDefs = [];
112365
112430
  if (showCheckSelection) {
112366
112431
  colDefs.push({
112367
- colId: "checkBoxColumn",
112432
+ colId: this.CHECK_BOX_COL_ID,
112368
112433
  headerName: "",
112369
112434
  checkboxSelection: true,
112370
112435
  headerCheckboxSelection: false,
@@ -112455,7 +112520,10 @@ class AgGridController {
112455
112520
  this._gridOptions.api.paginationGoToPage(page);
112456
112521
  }
112457
112522
  quickFilter(term) {
112458
- this._dataSource.setQuickFilter(term);
112523
+ this._dataSource.setQuickFilter(term, this._gridOptions.columnApi
112524
+ .getAllColumns()
112525
+ .filter(col => col.isVisible() && ![this.CHECK_BOX_COL_ID, this.RECORD_ARCHIVE_COL_ID].includes(col.getColId()))
112526
+ .map(col => col.getColId()));
112459
112527
  this.goToPage(0);
112460
112528
  this._gridOptions.api.refreshServerSideStore({ purge: true });
112461
112529
  }
@@ -113632,6 +113700,8 @@ let EzNumberInput$1 = class extends HTMLElement$1 {
113632
113700
  this.__registerHost();
113633
113701
  this.__attachShadow();
113634
113702
  this.ezChange = createEvent(this, "ezChange", 7);
113703
+ this.ezStartChange = createEvent(this, "ezStartChange", 7);
113704
+ this.ezCancelWaitingChange = createEvent(this, "ezCancelWaitingChange", 7);
113635
113705
  /**
113636
113706
  * Deixa o campo disponível ou não para uso.
113637
113707
  */
@@ -113681,6 +113751,7 @@ let EzNumberInput$1 = class extends HTMLElement$1 {
113681
113751
  parseNumber() {
113682
113752
  const parsedNumber = this._textInput.value ? NumberUtils.stringToNumber(this._textInput.value) : undefined;
113683
113753
  if (parsedNumber !== undefined && isNaN(parsedNumber)) {
113754
+ this.ezCancelWaitingChange.emit();
113684
113755
  this.errorMessage = "O valor digitado não é um número válido";
113685
113756
  }
113686
113757
  else {
@@ -113688,6 +113759,7 @@ let EzNumberInput$1 = class extends HTMLElement$1 {
113688
113759
  this.changeValue(parsedNumber);
113689
113760
  }
113690
113761
  catch (e) {
113762
+ this.ezCancelWaitingChange.emit();
113691
113763
  this.errorMessage = e.message;
113692
113764
  return;
113693
113765
  }
@@ -113699,11 +113771,14 @@ let EzNumberInput$1 = class extends HTMLElement$1 {
113699
113771
  }
113700
113772
  return undefined;
113701
113773
  }
113774
+ startChange() {
113775
+ this.ezStartChange.emit({ waitmessage: "", blocking: false });
113776
+ }
113702
113777
  componentDidLoad() {
113703
113778
  CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
113704
113779
  }
113705
113780
  render() {
113706
- return (h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseNumber(), label: this.label, value: this.getTextValue(this.value), restrict: this.precision > 0 ? "0123456789-,." : "0123456789-", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, slaveMode: true }));
113781
+ return (h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseNumber(), label: this.label, onInput: () => this.startChange(), value: this.getTextValue(this.value), restrict: this.precision > 0 ? "0123456789-,." : "0123456789-", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, slaveMode: true }));
113707
113782
  }
113708
113783
  get _elem() { return this; }
113709
113784
  static get watchers() { return {
@@ -114186,11 +114261,17 @@ let EzTextArea$1 = class extends HTMLElement$1 {
114186
114261
  (_b = this._messageBoxElem) === null || _b === void 0 ? void 0 : _b.classList.remove('hasError');
114187
114262
  }
114188
114263
  }
114189
- observeValue() {
114190
- this._inputElem.value = this.value == undefined ? "" : this.value;
114191
- this.handleChange();
114192
- this.adjustFloatingLabel();
114193
- this.ezChange.emit(this.value);
114264
+ observeValue(newValue, oldValue) {
114265
+ if (this._inputElem) {
114266
+ if (newValue != oldValue) {
114267
+ if (this.canChangeValue()) {
114268
+ this._inputElem.value = this.value || "";
114269
+ }
114270
+ this.adjustFloatingLabel();
114271
+ this.errorMessage = "";
114272
+ this.ezChange.emit(this.value);
114273
+ }
114274
+ }
114194
114275
  }
114195
114276
  observeMode() {
114196
114277
  if (this._initialRows == undefined) {
@@ -114208,6 +114289,27 @@ let EzTextArea$1 = class extends HTMLElement$1 {
114208
114289
  this._initialRows = rows;
114209
114290
  }
114210
114291
  }
114292
+ //---------------------------------------------
114293
+ // Public methods
114294
+ //---------------------------------------------
114295
+ /**
114296
+ * Faz o foco no componente de input
114297
+ */
114298
+ async setFocus() {
114299
+ this._inputElem.focus();
114300
+ }
114301
+ /**
114302
+ * Remove o foco no componente de input
114303
+ */
114304
+ async setBlur() {
114305
+ this._inputElem.blur();
114306
+ }
114307
+ //---------------------------------------------
114308
+ // Private methods
114309
+ //---------------------------------------------
114310
+ canChangeValue() {
114311
+ return this._inputElem && (this.value || "") !== this._inputElem.value;
114312
+ }
114211
114313
  adjustFloatingLabel() {
114212
114314
  if (this.label && this._labelElem) {
114213
114315
  const hasValue = this.value && this.value.toString().length > 0;
@@ -114228,21 +114330,6 @@ let EzTextArea$1 = class extends HTMLElement$1 {
114228
114330
  return this._hostElement.shadowRoot.activeElement !== null;
114229
114331
  }
114230
114332
  //---------------------------------------------
114231
- // Public methods
114232
- //---------------------------------------------
114233
- /**
114234
- * Faz o foco no componente de input
114235
- */
114236
- async setFocus() {
114237
- this._inputElem.focus();
114238
- }
114239
- /**
114240
- * Remove o foco no componente de input
114241
- */
114242
- async setBlur() {
114243
- this._inputElem.blur();
114244
- }
114245
- //---------------------------------------------
114246
114333
  // Event handlers
114247
114334
  //---------------------------------------------
114248
114335
  handleFocusout() {
@@ -114252,8 +114339,9 @@ let EzTextArea$1 = class extends HTMLElement$1 {
114252
114339
  }
114253
114340
  }
114254
114341
  handleChange() {
114255
- this.errorMessage = "";
114256
- this.value = this._inputElem.value;
114342
+ if (this.canChangeValue()) {
114343
+ this.value = this._inputElem.value;
114344
+ }
114257
114345
  }
114258
114346
  handleFocus() {
114259
114347
  if (this.label && this._labelElem && !this._labelElem.classList.contains("textarea__label--floated")) {
@@ -114336,17 +114424,19 @@ let EzTextInput$1 = class extends HTMLElement$1 {
114336
114424
  }
114337
114425
  }
114338
114426
  }
114339
- observeValue() {
114427
+ observeValue(newValue, oldValue) {
114340
114428
  if (this._inputElem) {
114341
- this._inputElem.value = this.value || "";
114342
- }
114343
- this.handleChange();
114344
- this.adjustFloatingLabel();
114345
- if (this.slaveMode) {
114346
- return;
114429
+ if (newValue != oldValue) {
114430
+ this._inputElem.value = this.value || "";
114431
+ this.handleChange();
114432
+ this.adjustFloatingLabel();
114433
+ if (this.slaveMode) {
114434
+ return;
114435
+ }
114436
+ this.errorMessage = "";
114437
+ this.ezChange.emit(this.value);
114438
+ }
114347
114439
  }
114348
- this.errorMessage = "";
114349
- this.ezChange.emit(this.value);
114350
114440
  }
114351
114441
  adjustFloatingLabel() {
114352
114442
  if (this.label && this._labelElem) {
@@ -114509,6 +114599,8 @@ let EzTimeInput$1 = class extends HTMLElement$1 {
114509
114599
  this.__registerHost();
114510
114600
  this.__attachShadow();
114511
114601
  this.ezChange = createEvent(this, "ezChange", 7);
114602
+ this.ezStartChange = createEvent(this, "ezStartChange", 7);
114603
+ this.ezCancelWaitingChange = createEvent(this, "ezCancelWaitingChange", 7);
114512
114604
  /**
114513
114605
  * Deixa o campo disponível ou não para digitação.
114514
114606
  */
@@ -114569,10 +114661,12 @@ let EzTimeInput$1 = class extends HTMLElement$1 {
114569
114661
  this.prepareValue(this.viewValue);
114570
114662
  if (this.viewValue && !TimeFormatter.validateTime(this.viewValue, this.showSeconds)) {
114571
114663
  this._oldViewValue = this.viewValue;
114664
+ this.ezCancelWaitingChange.emit();
114572
114665
  this.errorMessage = "Favor inserir um horário válido.";
114573
114666
  }
114574
114667
  else {
114575
114668
  if (this.viewValue === this._oldViewValue) {
114669
+ this.ezCancelWaitingChange.emit();
114576
114670
  return;
114577
114671
  }
114578
114672
  this._oldViewValue = this.viewValue;
@@ -114591,6 +114685,7 @@ let EzTimeInput$1 = class extends HTMLElement$1 {
114591
114685
  }
114592
114686
  }
114593
114687
  handleChange() {
114688
+ this.ezStartChange.emit({ waitmessage: "", blocking: false });
114594
114689
  this.viewValue = this._inputElem.value;
114595
114690
  this.value = NumberUtils.stringToNumber(this.viewValue.replace(/\D/g, ""));
114596
114691
  }
@@ -114750,7 +114845,12 @@ class RemoteFile {
114750
114845
  }
114751
114846
  const response = xhr.response;
114752
114847
  if (response) {
114753
- resolve(JSON.parse(response));
114848
+ try {
114849
+ resolve(JSON.parse(response));
114850
+ }
114851
+ catch (error) {
114852
+ reject(`Servidor não retornou um objeto válido: ${response}.\n${error}`);
114853
+ }
114754
114854
  }
114755
114855
  }
114756
114856
  };
@@ -114804,6 +114904,7 @@ let EzUpload$1 = class extends HTMLElement$1 {
114804
114904
  this.__attachShadow();
114805
114905
  this.ezChange = createEvent(this, "ezChange", 7);
114806
114906
  this.ezStartChange = createEvent(this, "ezStartChange", 7);
114907
+ this.ezCancelWaitingChange = createEvent(this, "ezCancelWaitingChange", 7);
114807
114908
  this._filePointers = new Map();
114808
114909
  /**
114809
114910
  * Deixa o campo disponível ou não para digitação.
@@ -114892,14 +114993,27 @@ let EzUpload$1 = class extends HTMLElement$1 {
114892
114993
  }
114893
114994
  }
114894
114995
  async doAddFile(file) {
114895
- if (this.validateFile(file)) {
114896
- this.ezStartChange.emit({ waitmessage: "Há arquivos sendo enviados. Por favor aguarde a conclusão ou cancele o envio." });
114897
- const uploadingFile = new RemoteFile(file);
114898
- this._filePointers.set(file.name, uploadingFile);
114899
- uploadingFile.upload(this.urlUpload, this._requestHeaders, (file) => this.updateFeedback(file))
114900
- .then((files) => files.forEach(ezFile => this.finishUpload(ezFile)))
114901
- .catch(msg => this.showError(msg));
114902
- forceUpdate(this);
114996
+ try {
114997
+ if (this.validateFile(file)) {
114998
+ this.ezStartChange.emit({ waitmessage: "Há arquivos sendo enviados. Por favor aguarde a conclusão ou cancele o envio.", blocking: true });
114999
+ const uploadingFile = new RemoteFile(file);
115000
+ const oldPointer = this._filePointers.get(file.name);
115001
+ if (oldPointer && this.isRemoteFile(oldPointer)) {
115002
+ oldPointer.abortUpload();
115003
+ }
115004
+ this._filePointers.set(file.name, uploadingFile);
115005
+ uploadingFile.upload(this.urlUpload, this._requestHeaders, (file) => this.updateFeedback(file))
115006
+ .then((files) => files.forEach(ezFile => this.finishUpload(ezFile)))
115007
+ .catch(msg => {
115008
+ this.ezCancelWaitingChange.emit();
115009
+ this.showError(msg);
115010
+ });
115011
+ forceUpdate(this);
115012
+ }
115013
+ }
115014
+ catch (error) {
115015
+ this.ezCancelWaitingChange.emit();
115016
+ throw error;
114903
115017
  }
114904
115018
  }
114905
115019
  finishUpload(ezFile) {
@@ -8,6 +8,8 @@ let EzDateInput = class {
8
8
  constructor(hostRef) {
9
9
  registerInstance(this, hostRef);
10
10
  this.ezChange = createEvent(this, "ezChange", 7);
11
+ this.ezStartChange = createEvent(this, "ezStartChange", 7);
12
+ this.ezCancelWaitingChange = createEvent(this, "ezCancelWaitingChange", 7);
11
13
  /**
12
14
  * Deixa o campo disponível ou não para uso.
13
15
  */
@@ -21,11 +23,16 @@ let EzDateInput = class {
21
23
  this._textInput.label = this.label;
22
24
  }
23
25
  observeErrorMessage() {
24
- this._textInput.errorMessage = this.errorMessage;
25
- }
26
- observeValue() {
27
26
  if (this._textInput) {
28
- this._textInput.value = this.getTextValue(this.value);
27
+ this._textInput.errorMessage = this.errorMessage;
28
+ }
29
+ }
30
+ observeValue(newValue, oldValue) {
31
+ if (newValue != oldValue) {
32
+ if (this._textInput) {
33
+ this.errorMessage = "";
34
+ this._textInput.value = this.getTextValue(this.value);
35
+ }
29
36
  }
30
37
  }
31
38
  /**
@@ -75,12 +82,16 @@ let EzDateInput = class {
75
82
  }
76
83
  }
77
84
  else {
85
+ this.ezCancelWaitingChange.emit();
78
86
  this._textInput.errorMessage = "O valor digitado não é uma data válida";
79
87
  }
80
88
  }
81
89
  getTextValue(d) {
82
90
  return d ? new Intl.DateTimeFormat("pt-BR").format(d) : undefined;
83
91
  }
92
+ startChange() {
93
+ this.ezStartChange.emit({ waitmessage: "", blocking: false });
94
+ }
84
95
  componentDidLoad() {
85
96
  CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
86
97
  }
@@ -88,7 +99,7 @@ let EzDateInput = class {
88
99
  return (h(Host, null, h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseDate(), onKeyDown: event => {
89
100
  if (event.key === "H" || event.key === "h")
90
101
  this.changeValue(new Date());
91
- }, label: this.label, value: this.getTextValue(this.value), restrict: "0123456789/", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, slaveMode: true }, h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })), h("ez-calendar", { onEzChange: (event) => { this.hideCalendar(); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem })));
102
+ }, label: this.label, value: this.getTextValue(this.value), onInput: () => this.startChange(), restrict: "0123456789/", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, slaveMode: true }, h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })), h("ez-calendar", { onEzChange: (event) => { this.hideCalendar(); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem })));
92
103
  }
93
104
  get _elem() { return getElement(this); }
94
105
  static get watchers() { return {
@@ -8,6 +8,8 @@ let EzDateTimeInput = class {
8
8
  constructor(hostRef) {
9
9
  registerInstance(this, hostRef);
10
10
  this.ezChange = createEvent(this, "ezChange", 7);
11
+ this.ezStartChange = createEvent(this, "ezStartChange", 7);
12
+ this.ezCancelWaitingChange = createEvent(this, "ezCancelWaitingChange", 7);
11
13
  /**
12
14
  * Deixa o campo disponível ou não para uso.
13
15
  */
@@ -113,6 +115,7 @@ let EzDateTimeInput = class {
113
115
  }
114
116
  }
115
117
  else {
118
+ this.ezCancelWaitingChange.emit();
116
119
  this._textInput.errorMessage = "O valor digitado não é uma data válida";
117
120
  }
118
121
  }
@@ -127,11 +130,14 @@ let EzDateTimeInput = class {
127
130
  };
128
131
  return d ? (new Intl.DateTimeFormat('pt-BR', this.showSeconds ? optionsSecond : options).format(d)) : undefined;
129
132
  }
133
+ startChange() {
134
+ this.ezStartChange.emit({ waitmessage: "", blocking: false });
135
+ }
130
136
  componentDidLoad() {
131
137
  CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
132
138
  }
133
139
  render() {
134
- return (h(Host, null, h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseDate(), onKeyDown: event => { this.onChangeKeyDown(event); }, label: this.label, value: this.getTextValue(this.value), restrict: "0123456789/: ", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, onFocus: () => this.onFocused(), onClick: () => this.onClicked(), slaveMode: true }, h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })), h("ez-calendar", { onEzChange: (event) => { this.changeValue(this._calendar.value); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem, time: true, showSeconds: this.showSeconds })));
140
+ return (h(Host, null, h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseDate(), onKeyDown: event => { this.onChangeKeyDown(event); }, label: this.label, value: this.getTextValue(this.value), restrict: "0123456789/: ", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, onInput: () => this.startChange(), onFocus: () => this.onFocused(), onClick: () => this.onClicked(), slaveMode: true }, h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })), h("ez-calendar", { onEzChange: (event) => { this.changeValue(this._calendar.value); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem, time: true, showSeconds: this.showSeconds })));
135
141
  }
136
142
  get _elem() { return getElement(this); }
137
143
  static get watchers() { return {