@sankhyalabs/ezui 1.1.141 → 1.1.144

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 (91) hide show
  1. package/dist/cjs/ez-button.cjs.entry.js +1 -1
  2. package/dist/cjs/ez-card-item.cjs.entry.js +44 -0
  3. package/dist/cjs/ez-collapsible-box.cjs.entry.js +3 -2
  4. package/dist/cjs/ez-combo-box.cjs.entry.js +41 -20
  5. package/dist/cjs/ez-date-input.cjs.entry.js +16 -5
  6. package/dist/cjs/ez-date-time-input.cjs.entry.js +7 -1
  7. package/dist/cjs/ez-form.cjs.entry.js +74 -21
  8. package/dist/cjs/ez-grid.cjs.entry.js +2 -0
  9. package/dist/cjs/ez-number-input.cjs.entry.js +8 -1
  10. package/dist/cjs/ez-text-area.cjs.entry.js +35 -22
  11. package/dist/cjs/ez-text-input.cjs.entry.js +11 -9
  12. package/dist/cjs/ez-time-input.cjs.entry.js +5 -0
  13. package/dist/cjs/ez-upload.cjs.entry.js +28 -9
  14. package/dist/cjs/ezui.cjs.js +1 -1
  15. package/dist/cjs/loader.cjs.js +1 -1
  16. package/dist/collection/collection-manifest.json +1 -0
  17. package/dist/collection/components/ez-button/ez-button.css +6 -0
  18. package/dist/collection/components/ez-card-item/ez-card-item.css +115 -0
  19. package/dist/collection/components/ez-card-item/ez-card-item.js +86 -0
  20. package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +4 -0
  21. package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.js +2 -1
  22. package/dist/collection/components/ez-combo-box/ez-combo-box.js +43 -21
  23. package/dist/collection/components/ez-date-input/ez-date-input.js +49 -5
  24. package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +40 -1
  25. package/dist/collection/components/ez-form/DataBinder.js +54 -8
  26. package/dist/collection/components/ez-form/ez-form.js +14 -7
  27. package/dist/collection/components/ez-form/structure/FormSheetMetadata.js +7 -7
  28. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +2 -0
  29. package/dist/collection/components/ez-number-input/ez-number-input.js +41 -1
  30. package/dist/collection/components/ez-text-area/ez-text-area.js +35 -22
  31. package/dist/collection/components/ez-text-input/ez-text-input.js +11 -9
  32. package/dist/collection/components/ez-time-input/ez-time-input.js +38 -0
  33. package/dist/collection/components/ez-upload/RemoteFile.js +6 -1
  34. package/dist/collection/components/ez-upload/ez-upload.js +36 -8
  35. package/dist/custom-elements/index.d.ts +6 -0
  36. package/dist/custom-elements/index.js +275 -94
  37. package/dist/esm/ez-button.entry.js +1 -1
  38. package/dist/esm/ez-card-item.entry.js +40 -0
  39. package/dist/esm/ez-collapsible-box.entry.js +3 -2
  40. package/dist/esm/ez-combo-box.entry.js +41 -20
  41. package/dist/esm/ez-date-input.entry.js +16 -5
  42. package/dist/esm/ez-date-time-input.entry.js +7 -1
  43. package/dist/esm/ez-form.entry.js +75 -22
  44. package/dist/esm/ez-grid.entry.js +2 -0
  45. package/dist/esm/ez-number-input.entry.js +8 -1
  46. package/dist/esm/ez-text-area.entry.js +35 -22
  47. package/dist/esm/ez-text-input.entry.js +11 -9
  48. package/dist/esm/ez-time-input.entry.js +5 -0
  49. package/dist/esm/ez-upload.entry.js +28 -9
  50. package/dist/esm/ezui.js +1 -1
  51. package/dist/esm/loader.js +1 -1
  52. package/dist/ezui/ezui.esm.js +1 -1
  53. package/dist/ezui/p-024df41e.entry.js +1 -0
  54. package/dist/ezui/p-140f7085.entry.js +1 -0
  55. package/dist/ezui/p-24e98dc1.entry.js +1 -0
  56. package/dist/ezui/p-49fdfa4b.entry.js +1 -0
  57. package/dist/ezui/p-4fdceb7d.entry.js +1 -0
  58. package/dist/ezui/p-5a05f1ea.entry.js +1 -0
  59. package/dist/ezui/p-6395ed55.entry.js +1 -0
  60. package/dist/ezui/{p-1b2bf15d.entry.js → p-6816c9ee.entry.js} +1 -1
  61. package/dist/ezui/p-7746460e.entry.js +1 -0
  62. package/dist/ezui/p-b524dfca.entry.js +1 -0
  63. package/dist/ezui/{p-8cb2c629.entry.js → p-c15d4d6f.entry.js} +1 -1
  64. package/dist/ezui/p-c77c0022.entry.js +1 -0
  65. package/dist/ezui/p-ec21ecce.entry.js +1 -0
  66. package/dist/types/components/ez-card-item/ez-card-item.d.ts +23 -0
  67. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +5 -1
  68. package/dist/types/components/ez-date-input/ez-date-input.d.ts +12 -1
  69. package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +11 -0
  70. package/dist/types/components/ez-form/DataBinder.d.ts +1 -0
  71. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +1 -0
  72. package/dist/types/components/ez-number-input/ez-number-input.d.ts +11 -0
  73. package/dist/types/components/ez-text-area/ez-text-area.d.ts +4 -3
  74. package/dist/types/components/ez-text-input/ez-text-input.d.ts +1 -1
  75. package/dist/types/components/ez-time-input/ez-time-input.d.ts +10 -0
  76. package/dist/types/components/ez-upload/ez-upload.d.ts +5 -0
  77. package/dist/types/components.d.ts +53 -0
  78. package/package.json +2 -2
  79. package/react/components.d.ts +1 -0
  80. package/react/components.js +1 -0
  81. package/react/components.js.map +1 -1
  82. package/dist/ezui/p-248361f5.entry.js +0 -1
  83. package/dist/ezui/p-347b145b.entry.js +0 -1
  84. package/dist/ezui/p-9b82c2fe.entry.js +0 -1
  85. package/dist/ezui/p-b8d64970.entry.js +0 -1
  86. package/dist/ezui/p-c620258b.entry.js +0 -1
  87. package/dist/ezui/p-cabe3671.entry.js +0 -1
  88. package/dist/ezui/p-cb73bee7.entry.js +0 -1
  89. package/dist/ezui/p-db0981c1.entry.js +0 -1
  90. package/dist/ezui/p-dd6f4872.entry.js +0 -1
  91. package/dist/ezui/p-ec8419f1.entry.js +0 -1
@@ -16,11 +16,16 @@ export class EzDateInput {
16
16
  this._textInput.label = this.label;
17
17
  }
18
18
  observeErrorMessage() {
19
- this._textInput.errorMessage = this.errorMessage;
20
- }
21
- observeValue() {
22
19
  if (this._textInput) {
23
- this._textInput.value = this.getTextValue(this.value);
20
+ this._textInput.errorMessage = this.errorMessage;
21
+ }
22
+ }
23
+ observeValue(newValue, oldValue) {
24
+ if (newValue != oldValue) {
25
+ if (this._textInput) {
26
+ this.errorMessage = "";
27
+ this._textInput.value = this.getTextValue(this.value);
28
+ }
24
29
  }
25
30
  }
26
31
  /**
@@ -70,19 +75,23 @@ export class EzDateInput {
70
75
  }
71
76
  }
72
77
  else {
78
+ this.ezCancelWaitingChange.emit();
73
79
  this._textInput.errorMessage = "O valor digitado não é uma data válida";
74
80
  }
75
81
  }
76
82
  getTextValue(d) {
77
83
  return d ? new Intl.DateTimeFormat("pt-BR").format(d) : undefined;
78
84
  }
85
+ startChange() {
86
+ this.ezStartChange.emit({ waitmessage: "", blocking: false });
87
+ }
79
88
  componentDidLoad() {
80
89
  CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
81
90
  }
82
91
  render() {
83
92
  return (h(Host, null,
84
93
  h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseDate(), onKeyDown: event => { if (event.key === "H" || event.key === "h")
85
- this.changeValue(new Date()); }, label: this.label, value: this.getTextValue(this.value), restrict: "0123456789/", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, slaveMode: true },
94
+ this.changeValue(new Date()); }, label: this.label, value: this.getTextValue(this.value), onInput: () => this.startChange(), restrict: "0123456789/", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, slaveMode: true },
86
95
  h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })),
87
96
  h("ez-calendar", { onEzChange: (event) => { this.hideCalendar(); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem })));
88
97
  }
@@ -204,6 +213,41 @@ export class EzDateInput {
204
213
  }
205
214
  }
206
215
  }
216
+ }, {
217
+ "method": "ezStartChange",
218
+ "name": "ezStartChange",
219
+ "bubbles": true,
220
+ "cancelable": true,
221
+ "composed": true,
222
+ "docs": {
223
+ "tags": [],
224
+ "text": "Evento emitido ao iniciar a altera\u00E7\u00E3o (remover ou adicionar um arquivo)."
225
+ },
226
+ "complexType": {
227
+ "original": "WaitingChange",
228
+ "resolved": "WaitingChange",
229
+ "references": {
230
+ "WaitingChange": {
231
+ "location": "import",
232
+ "path": "@sankhyalabs/core"
233
+ }
234
+ }
235
+ }
236
+ }, {
237
+ "method": "ezCancelWaitingChange",
238
+ "name": "ezCancelWaitingChange",
239
+ "bubbles": true,
240
+ "cancelable": true,
241
+ "composed": true,
242
+ "docs": {
243
+ "tags": [],
244
+ "text": "Entre o evento ezStartChange e ezChange, se por algum motivo n\u00E3o foi poss\u00EDvel\ncompletar a altera\u00E7\u00E3o, esse evento \u00E9 disparado."
245
+ },
246
+ "complexType": {
247
+ "original": "void",
248
+ "resolved": "void",
249
+ "references": {}
250
+ }
207
251
  }]; }
208
252
  static get methods() { return {
209
253
  "setFocus": {
@@ -108,6 +108,7 @@ export class EzDateTimeInput {
108
108
  }
109
109
  }
110
110
  else {
111
+ this.ezCancelWaitingChange.emit();
111
112
  this._textInput.errorMessage = "O valor digitado não é uma data válida";
112
113
  }
113
114
  }
@@ -122,12 +123,15 @@ export class EzDateTimeInput {
122
123
  };
123
124
  return d ? (new Intl.DateTimeFormat('pt-BR', this.showSeconds ? optionsSecond : options).format(d)) : undefined;
124
125
  }
126
+ startChange() {
127
+ this.ezStartChange.emit({ waitmessage: "", blocking: false });
128
+ }
125
129
  componentDidLoad() {
126
130
  CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
127
131
  }
128
132
  render() {
129
133
  return (h(Host, null,
130
- 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 },
134
+ 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 },
131
135
  h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })),
132
136
  h("ez-calendar", { onEzChange: (event) => { this.changeValue(this._calendar.value); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem, time: true, showSeconds: this.showSeconds })));
133
137
  }
@@ -267,6 +271,41 @@ export class EzDateTimeInput {
267
271
  }
268
272
  }
269
273
  }
274
+ }, {
275
+ "method": "ezStartChange",
276
+ "name": "ezStartChange",
277
+ "bubbles": true,
278
+ "cancelable": true,
279
+ "composed": true,
280
+ "docs": {
281
+ "tags": [],
282
+ "text": "Evento emitido ao iniciar a altera\u00E7\u00E3o (remover ou adicionar um arquivo)."
283
+ },
284
+ "complexType": {
285
+ "original": "WaitingChange",
286
+ "resolved": "WaitingChange",
287
+ "references": {
288
+ "WaitingChange": {
289
+ "location": "import",
290
+ "path": "@sankhyalabs/core"
291
+ }
292
+ }
293
+ }
294
+ }, {
295
+ "method": "ezCancelWaitingChange",
296
+ "name": "ezCancelWaitingChange",
297
+ "bubbles": true,
298
+ "cancelable": true,
299
+ "composed": true,
300
+ "docs": {
301
+ "tags": [],
302
+ "text": "Entre o evento ezStartChange e ezChange, se por algum motivo n\u00E3o foi poss\u00EDvel\ncompletar a altera\u00E7\u00E3o, esse evento \u00E9 disparado."
303
+ },
304
+ "complexType": {
305
+ "original": "void",
306
+ "resolved": "void",
307
+ "references": {}
308
+ }
270
309
  }]; }
271
310
  static get methods() { return {
272
311
  "setFocus": {
@@ -1,4 +1,4 @@
1
- import { ApplicationContext, Action } from "@sankhyalabs/core";
1
+ import { ApplicationContext, Action, WaitingChangeException } from "@sankhyalabs/core";
2
2
  export default class DataBinder {
3
3
  constructor(dataUnit) {
4
4
  this.onDataUnitEvent = (action) => {
@@ -36,11 +36,7 @@ export default class DataBinder {
36
36
  this._dataUnit.unsubscribe(this.onDataUnitEvent);
37
37
  }
38
38
  updateValue(fieldName, field) {
39
- const oldValue = field["value"];
40
- const newValue = this._dataUnit.getFieldValue(fieldName);
41
- if (oldValue != newValue) {
42
- field["value"] = newValue;
43
- }
39
+ field["value"] = this._dataUnit.getFieldValue(fieldName);
44
40
  }
45
41
  updateBind(fieldName, field) {
46
42
  const oldBind = this._fields.get(fieldName);
@@ -48,21 +44,53 @@ export default class DataBinder {
48
44
  oldBind.destroy();
49
45
  }
50
46
  field["value"] = this._dataUnit.getFieldValue(fieldName);
51
- this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, waitingChange) => this.changeStarted(fieldName, waitingChange), (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
47
+ this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, waitingChange) => this.changeStarted(fieldName, waitingChange), (fieldName) => this.cancelWaitingChange(fieldName), (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
52
48
  this.bindSearchOptionsLoader(fieldName, field);
53
49
  this.applyEzUploadContext(fieldName, field);
54
50
  }
55
51
  changeStarted(fieldName, waitingChange) {
52
+ /**
53
+ * se o waitingChange não é blocante, add um event listener pra
54
+ * fazer o accept da promise
55
+ *
56
+ * se não tiver promise no waitingChange, eu crio uma e resolvo no bind
57
+ *
58
+ *
59
+ */
56
60
  if (this._dataUnit.records.length === 0) {
57
61
  this._dataUnit.addRecord();
58
62
  }
63
+ if (!waitingChange.blocking && waitingChange.promise == undefined) {
64
+ const bind = this._fields.get(fieldName);
65
+ if (bind) {
66
+ waitingChange.promise = new Promise((resolve, reject) => {
67
+ bind.waitingChangePromiseResolve = resolve;
68
+ bind.waitingChangePromiseReject = reject;
69
+ });
70
+ }
71
+ }
59
72
  this._dataUnit.startChange(fieldName, waitingChange);
60
73
  }
74
+ cancelWaitingChange(fieldName) {
75
+ if (this._dataUnit.waitingForChange(fieldName)) {
76
+ this._dataUnit.cancelWaitingChange(fieldName);
77
+ const bind = this._fields.get(fieldName);
78
+ if (bind) {
79
+ bind.rejectWaitingChange(new WaitingChangeException("Change canceled", fieldName));
80
+ }
81
+ }
82
+ }
61
83
  setFieldValue(fieldName, newValue) {
62
84
  if (this._dataUnit.records.length === 0) {
63
85
  this._dataUnit.addRecord();
64
86
  }
65
87
  this._dataUnit.setFieldValue(fieldName, newValue);
88
+ if (this._dataUnit.waitingForChange(fieldName)) {
89
+ const bind = this._fields.get(fieldName);
90
+ if (bind) {
91
+ bind.acceptWaitingChange();
92
+ }
93
+ }
66
94
  }
67
95
  bindSearchOptionsLoader(fieldName, field) {
68
96
  if (field.nodeName === "EZ-SEARCH" && field["optionLoader"] == undefined) {
@@ -91,18 +119,36 @@ export default class DataBinder {
91
119
  class Bind {
92
120
  constructor() {
93
121
  this.startChangeEventName = "ezStartChange";
122
+ this.cancelWaitingChangeEventName = "ezCancelWaitingChange";
94
123
  this.changeEventName = "ezChange";
95
124
  }
96
125
  destroy() {
97
126
  this.field.removeEventListener(this.startChangeEventName, this.startChangeListener);
127
+ this.field.removeEventListener(this.cancelWaitingChangeEventName, this.cancelWaitingChangeListener);
98
128
  this.field.removeEventListener(this.changeEventName, this.changeListener);
99
129
  }
100
- static create(fieldName, field, startChangeCallback, changeCallback) {
130
+ acceptWaitingChange() {
131
+ if (this.waitingChangePromiseResolve) {
132
+ this.waitingChangePromiseResolve();
133
+ this.waitingChangePromiseReject = undefined;
134
+ this.waitingChangePromiseResolve = undefined;
135
+ }
136
+ }
137
+ rejectWaitingChange(reason) {
138
+ if (this.waitingChangePromiseReject) {
139
+ this.waitingChangePromiseReject(reason);
140
+ this.waitingChangePromiseReject = undefined;
141
+ this.waitingChangePromiseResolve = undefined;
142
+ }
143
+ }
144
+ static create(fieldName, field, startChangeCallback, cancelWaitingChangeCallback, changeCallback) {
101
145
  const b = new Bind();
102
146
  b.field = field;
103
147
  b.fieldName = fieldName;
104
148
  b.startChangeListener = (evt) => { startChangeCallback(fieldName, evt.detail); };
105
149
  b.field.addEventListener(b.startChangeEventName, b.startChangeListener);
150
+ b.cancelWaitingChangeListener = () => { cancelWaitingChangeCallback(fieldName); };
151
+ b.field.addEventListener(b.cancelWaitingChangeEventName, b.cancelWaitingChangeListener);
106
152
  b.changeListener = (evt) => { changeCallback(fieldName, evt.detail); };
107
153
  b.field.addEventListener(b.changeEventName, b.changeListener);
108
154
  return b;
@@ -45,12 +45,20 @@ export class EzForm {
45
45
  requiredFields.forEach(field => {
46
46
  const value = record[field];
47
47
  const fieldElem = this._element.querySelector(`[data-field-name=${field}]`);
48
- if (value === null || value === undefined || value === "") {
49
- invalidFields.push(field);
50
- fieldElem["errorMessage"] = "Essa informação é obrigatória";
51
- }
52
- else {
53
- fieldElem["errorMessage"] = "";
48
+ /**
49
+ * TODO: fieldElem vai ser vazio quando o campo está em uma aba que
50
+ * está escondida.
51
+ * Temos que tratar esse caso para apresentar a mensagem de erro
52
+ * na aba, isso será tratado no card: https://sankhya.atlassian.net/browse/SKA-44182
53
+ */
54
+ if (fieldElem) {
55
+ if (value === null || value === undefined || value === "") {
56
+ invalidFields.push(field);
57
+ fieldElem["errorMessage"] = "Essa informação é obrigatória";
58
+ }
59
+ else {
60
+ fieldElem["errorMessage"] = "";
61
+ }
54
62
  }
55
63
  });
56
64
  const isValid = invalidFields.length === 0;
@@ -100,7 +108,6 @@ export class EzForm {
100
108
  }
101
109
  }
102
110
  if (action.type === Action.RECORDS_ADDED) {
103
- debugger;
104
111
  const metadata = selectFormMetadata(this._store.getState());
105
112
  const defaultValues = metadata.getDefaultValues();
106
113
  if (defaultValues) {
@@ -45,7 +45,7 @@ export const buildFromDataUnit = (dataUnit) => {
45
45
  .filter(descriptor => descriptor.required)
46
46
  .map(descriptor => descriptor.name),
47
47
  cleanOnCopyFields: visibleFields
48
- .filter(descriptor => { var _a; return (_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.cleanOnCopy; })
48
+ .filter(descriptor => { var _a, _b; return ((_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.cleanOnCopy) || ((_b = descriptor.properties) === null || _b === void 0 ? void 0 : _b.autoNum); })
49
49
  .map(descriptor => descriptor.name),
50
50
  defaultValues
51
51
  });
@@ -57,7 +57,7 @@ function getTabConfig(tab, sheets) {
57
57
  return tabConfig || { label: tab, visible: true };
58
58
  }
59
59
  function sortTabs(a, b) {
60
- return a[0].label == 'Geral' ? -1 : (a[0].order || 10000) - (b[0].order || 10000);
60
+ return a[0].label == '__main' ? -1 : (a[0].order || 10000) - (b[0].order || 10000);
61
61
  }
62
62
  export const buildFromConfig = (fields, dataUnit) => {
63
63
  const sheets = new Map();
@@ -65,9 +65,9 @@ export const buildFromConfig = (fields, dataUnit) => {
65
65
  const cleanOnCopyFields = [];
66
66
  const defaultValues = {};
67
67
  fields.forEach(config => {
68
- var _a, _b;
68
+ var _a, _b, _c;
69
69
  if (config.visible !== false) {
70
- const tabConfig = getTabConfig(config.tab || "Geral", sheets);
70
+ const tabConfig = getTabConfig(config.tab || "__main", sheets);
71
71
  const descriptor = dataUnit.getField(config.name);
72
72
  if (descriptor && tabConfig.visible) {
73
73
  if (!sheets.has(tabConfig)) {
@@ -78,11 +78,11 @@ export const buildFromConfig = (fields, dataUnit) => {
78
78
  if (isRequired) {
79
79
  requiredFields.push(config.name);
80
80
  }
81
- const clearOnCopy = config.cleanOnCopy === undefined ? (_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.cleanOnCopy : config.cleanOnCopy;
81
+ const clearOnCopy = config.cleanOnCopy === undefined ? (((_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.cleanOnCopy) || ((_b = descriptor.properties) === null || _b === void 0 ? void 0 : _b.autoNum)) : config.cleanOnCopy;
82
82
  if (clearOnCopy) {
83
83
  cleanOnCopyFields.push(config.name);
84
84
  }
85
- const defaultValue = config.defaultValue === undefined ? (_b = descriptor.properties) === null || _b === void 0 ? void 0 : _b.defaultValue : config.defaultValue;
85
+ const defaultValue = config.defaultValue === undefined ? (_c = descriptor.properties) === null || _c === void 0 ? void 0 : _c.defaultValue : config.defaultValue;
86
86
  if (defaultValue) {
87
87
  defaultValues[config.name] = config.defaultValue;
88
88
  }
@@ -108,7 +108,7 @@ export const buildFromConfig = (fields, dataUnit) => {
108
108
  .sort(sortTabs)
109
109
  .forEach(([key, value]) => {
110
110
  metadata.addSheet({
111
- label: key.label,
111
+ label: (key.label === "__main") ? "Principal" : key.label,
112
112
  name: key.label,
113
113
  items: Array.from(value.values()),
114
114
  requiredFields,
@@ -11,6 +11,7 @@ export default class AgGridController {
11
11
  this.DEFAULT_ROW_HEIGHT = 25;
12
12
  this.CHECK_BOX_COL_ID = "checkBoxColumn";
13
13
  this.RECORD_ARCHIVE_COL_ID = "__RECORD_ARCHIVE__";
14
+ this.BLOCK_LOAD_DEBOUNCE = 400;
14
15
  this._menuItems = [];
15
16
  this._idAttribName = "__record__id__";
16
17
  this._isFirstRecordOfPage = true;
@@ -54,6 +55,7 @@ export default class AgGridController {
54
55
  rowSelection: this._multipleSelection ? "multiple" : "single",
55
56
  serverSideDatasource: this._dataSource,
56
57
  sortingOrder: ['desc', 'asc', null],
58
+ blockLoadDebounceMillis: this.BLOCK_LOAD_DEBOUNCE,
57
59
  getRowNodeId: this._dataUnit ? (params) => typeof params === "string" ? params : params[this._idAttribName] : undefined,
58
60
  getMainMenuItems: (params) => {
59
61
  const column = params.column;
@@ -52,6 +52,7 @@ export class EzNumberInput {
52
52
  parseNumber() {
53
53
  const parsedNumber = this._textInput.value ? NumberUtils.stringToNumber(this._textInput.value) : undefined;
54
54
  if (parsedNumber !== undefined && isNaN(parsedNumber)) {
55
+ this.ezCancelWaitingChange.emit();
55
56
  this.errorMessage = "O valor digitado não é um número válido";
56
57
  }
57
58
  else {
@@ -59,6 +60,7 @@ export class EzNumberInput {
59
60
  this.changeValue(parsedNumber);
60
61
  }
61
62
  catch (e) {
63
+ this.ezCancelWaitingChange.emit();
62
64
  this.errorMessage = e.message;
63
65
  return;
64
66
  }
@@ -70,11 +72,14 @@ export class EzNumberInput {
70
72
  }
71
73
  return undefined;
72
74
  }
75
+ startChange() {
76
+ this.ezStartChange.emit({ waitmessage: "", blocking: false });
77
+ }
73
78
  componentDidLoad() {
74
79
  CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
75
80
  }
76
81
  render() {
77
- 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 }));
82
+ 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 }));
78
83
  }
79
84
  static get is() { return "ez-number-input"; }
80
85
  static get encapsulation() { return "shadow"; }
@@ -222,6 +227,41 @@ export class EzNumberInput {
222
227
  "resolved": "number",
223
228
  "references": {}
224
229
  }
230
+ }, {
231
+ "method": "ezStartChange",
232
+ "name": "ezStartChange",
233
+ "bubbles": true,
234
+ "cancelable": true,
235
+ "composed": true,
236
+ "docs": {
237
+ "tags": [],
238
+ "text": "Evento emitido ao iniciar a altera\u00E7\u00E3o (remover ou adicionar um arquivo)."
239
+ },
240
+ "complexType": {
241
+ "original": "WaitingChange",
242
+ "resolved": "WaitingChange",
243
+ "references": {
244
+ "WaitingChange": {
245
+ "location": "import",
246
+ "path": "@sankhyalabs/core"
247
+ }
248
+ }
249
+ }
250
+ }, {
251
+ "method": "ezCancelWaitingChange",
252
+ "name": "ezCancelWaitingChange",
253
+ "bubbles": true,
254
+ "cancelable": true,
255
+ "composed": true,
256
+ "docs": {
257
+ "tags": [],
258
+ "text": "Entre o evento ezStartChange e ezChange, se por algum motivo n\u00E3o foi poss\u00EDvel\ncompletar a altera\u00E7\u00E3o, esse evento \u00E9 disparado."
259
+ },
260
+ "complexType": {
261
+ "original": "void",
262
+ "resolved": "void",
263
+ "references": {}
264
+ }
225
265
  }]; }
226
266
  static get methods() { return {
227
267
  "setFocus": {
@@ -30,11 +30,17 @@ export class EzTextArea {
30
30
  (_b = this._messageBoxElem) === null || _b === void 0 ? void 0 : _b.classList.remove('hasError');
31
31
  }
32
32
  }
33
- observeValue() {
34
- this._inputElem.value = this.value == undefined ? "" : this.value;
35
- this.handleChange();
36
- this.adjustFloatingLabel();
37
- this.ezChange.emit(this.value);
33
+ observeValue(newValue, oldValue) {
34
+ if (this._inputElem) {
35
+ if (newValue != oldValue) {
36
+ if (this.canChangeValue()) {
37
+ this._inputElem.value = this.value || "";
38
+ }
39
+ this.adjustFloatingLabel();
40
+ this.errorMessage = "";
41
+ this.ezChange.emit(this.value);
42
+ }
43
+ }
38
44
  }
39
45
  observeMode() {
40
46
  if (this._initialRows == undefined) {
@@ -52,6 +58,27 @@ export class EzTextArea {
52
58
  this._initialRows = rows;
53
59
  }
54
60
  }
61
+ //---------------------------------------------
62
+ // Public methods
63
+ //---------------------------------------------
64
+ /**
65
+ * Faz o foco no componente de input
66
+ */
67
+ async setFocus() {
68
+ this._inputElem.focus();
69
+ }
70
+ /**
71
+ * Remove o foco no componente de input
72
+ */
73
+ async setBlur() {
74
+ this._inputElem.blur();
75
+ }
76
+ //---------------------------------------------
77
+ // Private methods
78
+ //---------------------------------------------
79
+ canChangeValue() {
80
+ return this._inputElem && (this.value || "") !== this._inputElem.value;
81
+ }
55
82
  adjustFloatingLabel() {
56
83
  if (this.label && this._labelElem) {
57
84
  const hasValue = this.value && this.value.toString().length > 0;
@@ -72,21 +99,6 @@ export class EzTextArea {
72
99
  return this._hostElement.shadowRoot.activeElement !== null;
73
100
  }
74
101
  //---------------------------------------------
75
- // Public methods
76
- //---------------------------------------------
77
- /**
78
- * Faz o foco no componente de input
79
- */
80
- async setFocus() {
81
- this._inputElem.focus();
82
- }
83
- /**
84
- * Remove o foco no componente de input
85
- */
86
- async setBlur() {
87
- this._inputElem.blur();
88
- }
89
- //---------------------------------------------
90
102
  // Event handlers
91
103
  //---------------------------------------------
92
104
  handleFocusout() {
@@ -96,8 +108,9 @@ export class EzTextArea {
96
108
  }
97
109
  }
98
110
  handleChange() {
99
- this.errorMessage = "";
100
- this.value = this._inputElem.value;
111
+ if (this.canChangeValue()) {
112
+ this.value = this._inputElem.value;
113
+ }
101
114
  }
102
115
  handleFocus() {
103
116
  if (this.label && this._labelElem && !this._labelElem.classList.contains("textarea__label--floated")) {
@@ -43,17 +43,19 @@ export class EzTextInput {
43
43
  }
44
44
  }
45
45
  }
46
- observeValue() {
46
+ observeValue(newValue, oldValue) {
47
47
  if (this._inputElem) {
48
- this._inputElem.value = this.value || "";
49
- }
50
- this.handleChange();
51
- this.adjustFloatingLabel();
52
- if (this.slaveMode) {
53
- return;
48
+ if (newValue != oldValue) {
49
+ this._inputElem.value = this.value || "";
50
+ this.handleChange();
51
+ this.adjustFloatingLabel();
52
+ if (this.slaveMode) {
53
+ return;
54
+ }
55
+ this.errorMessage = "";
56
+ this.ezChange.emit(this.value);
57
+ }
54
58
  }
55
- this.errorMessage = "";
56
- this.ezChange.emit(this.value);
57
59
  }
58
60
  adjustFloatingLabel() {
59
61
  if (this.label && this._labelElem) {
@@ -63,10 +63,12 @@ export class EzTimeInput {
63
63
  this.prepareValue(this.viewValue);
64
64
  if (this.viewValue && !TimeFormatter.validateTime(this.viewValue, this.showSeconds)) {
65
65
  this._oldViewValue = this.viewValue;
66
+ this.ezCancelWaitingChange.emit();
66
67
  this.errorMessage = "Favor inserir um horário válido.";
67
68
  }
68
69
  else {
69
70
  if (this.viewValue === this._oldViewValue) {
71
+ this.ezCancelWaitingChange.emit();
70
72
  return;
71
73
  }
72
74
  this._oldViewValue = this.viewValue;
@@ -85,6 +87,7 @@ export class EzTimeInput {
85
87
  }
86
88
  }
87
89
  handleChange() {
90
+ this.ezStartChange.emit({ waitmessage: "", blocking: false });
88
91
  this.viewValue = this._inputElem.value;
89
92
  this.value = NumberUtils.stringToNumber(this.viewValue.replace(/\D/g, ""));
90
93
  }
@@ -257,6 +260,41 @@ export class EzTimeInput {
257
260
  "resolved": "number",
258
261
  "references": {}
259
262
  }
263
+ }, {
264
+ "method": "ezStartChange",
265
+ "name": "ezStartChange",
266
+ "bubbles": true,
267
+ "cancelable": true,
268
+ "composed": true,
269
+ "docs": {
270
+ "tags": [],
271
+ "text": "Evento emitido ao iniciar a altera\u00E7\u00E3o (remover ou adicionar um arquivo)."
272
+ },
273
+ "complexType": {
274
+ "original": "WaitingChange",
275
+ "resolved": "WaitingChange",
276
+ "references": {
277
+ "WaitingChange": {
278
+ "location": "import",
279
+ "path": "@sankhyalabs/core"
280
+ }
281
+ }
282
+ }
283
+ }, {
284
+ "method": "ezCancelWaitingChange",
285
+ "name": "ezCancelWaitingChange",
286
+ "bubbles": true,
287
+ "cancelable": true,
288
+ "composed": true,
289
+ "docs": {
290
+ "tags": [],
291
+ "text": "Entre o evento ezStartChange e ezChange, se por algum motivo n\u00E3o foi poss\u00EDvel\ncompletar a altera\u00E7\u00E3o, esse evento \u00E9 disparado."
292
+ },
293
+ "complexType": {
294
+ "original": "void",
295
+ "resolved": "void",
296
+ "references": {}
297
+ }
260
298
  }]; }
261
299
  static get methods() { return {
262
300
  "setFocus": {
@@ -43,7 +43,12 @@ export default class RemoteFile {
43
43
  }
44
44
  const response = xhr.response;
45
45
  if (response) {
46
- resolve(JSON.parse(response));
46
+ try {
47
+ resolve(JSON.parse(response));
48
+ }
49
+ catch (error) {
50
+ reject(`Servidor não retornou um objeto válido: ${response}.\n${error}`);
51
+ }
47
52
  }
48
53
  }
49
54
  };