@sankhyalabs/ezui 0.0.0-bugfix-dev-KB-77074.0 → 0.0.0-bugfix-dev-kb-77634.0

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 (177) hide show
  1. package/dist/cjs/DataBinder-3b083480.js +445 -0
  2. package/dist/cjs/FocusResolver-885f2173.js +35 -0
  3. package/dist/cjs/ez-button.cjs.entry.js +1 -1
  4. package/dist/cjs/ez-card-item_3.cjs.entry.js +12 -19
  5. package/dist/cjs/ez-chart.cjs.entry.js +1 -1
  6. package/dist/cjs/ez-combo-box.cjs.entry.js +46 -10
  7. package/dist/cjs/ez-custom-form-input_2.cjs.entry.js +3 -2
  8. package/dist/cjs/ez-date-input.cjs.entry.js +8 -2
  9. package/dist/cjs/ez-date-time-input.cjs.entry.js +8 -2
  10. package/dist/cjs/ez-dialog.cjs.entry.js +10 -2
  11. package/dist/cjs/ez-form-view.cjs.entry.js +2 -2
  12. package/dist/cjs/ez-form.cjs.entry.js +5 -325
  13. package/dist/cjs/ez-grid.cjs.entry.js +14614 -70500
  14. package/dist/cjs/ez-icon.cjs.entry.js +1 -1
  15. package/dist/cjs/ez-list.cjs.entry.js +151 -100
  16. package/dist/cjs/ez-modal.cjs.entry.js +1 -1
  17. package/dist/cjs/ez-number-input.cjs.entry.js +7 -0
  18. package/dist/cjs/ez-popover.cjs.entry.js +1 -1
  19. package/dist/cjs/ez-popup.cjs.entry.js +2 -2
  20. package/dist/cjs/ez-search.cjs.entry.js +71 -22
  21. package/dist/cjs/ez-split-button.cjs.entry.js +1 -1
  22. package/dist/cjs/ez-text-area.cjs.entry.js +66 -4
  23. package/dist/cjs/ez-text-input.cjs.entry.js +49 -7
  24. package/dist/cjs/ez-time-input.cjs.entry.js +6 -0
  25. package/dist/cjs/ezui.cjs.js +1 -1
  26. package/dist/cjs/loader.cjs.js +1 -1
  27. package/dist/collection/collection-manifest.json +1 -1
  28. package/dist/collection/components/ez-button/ez-button.css +2 -2
  29. package/dist/collection/components/ez-card-item/ez-card-item.css +14 -5
  30. package/dist/collection/components/ez-combo-box/ez-combo-box.js +75 -14
  31. package/dist/collection/components/ez-date-input/ez-date-input.js +35 -4
  32. package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +35 -4
  33. package/dist/collection/components/ez-dialog/ez-dialog.css +3 -3
  34. package/dist/collection/components/ez-dialog/ez-dialog.js +9 -1
  35. package/dist/collection/components/ez-filter-input/ez-filter-input.css +0 -11
  36. package/dist/collection/components/ez-filter-input/ez-filter-input.js +22 -52
  37. package/dist/collection/components/ez-form/ez-form.js +1 -0
  38. package/dist/collection/components/ez-form-view/custom-input/ez-custom-form-input.js +3 -2
  39. package/dist/collection/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.js +2 -2
  40. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +96 -27
  41. package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +8 -0
  42. package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +164 -46
  43. package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.js +7 -0
  44. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/ComboBox.tpl.js +1 -0
  45. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/DateInput.tpl.js +1 -0
  46. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/NumberInput.tpl.js +1 -0
  47. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/Search.tpl.js +1 -0
  48. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/TextInput.tpl.js +4 -1
  49. package/dist/collection/components/ez-grid/ez-grid.js +90 -3
  50. package/dist/collection/components/ez-icon/ez-icon.css +153 -149
  51. package/dist/collection/components/ez-list/ez-list.css +5 -5
  52. package/dist/collection/components/ez-list/ez-list.js +152 -170
  53. package/dist/collection/components/ez-modal/ez-modal.css +4 -0
  54. package/dist/collection/components/ez-modal/ez-modal.js +2 -2
  55. package/dist/collection/components/ez-number-input/ez-number-input.js +25 -0
  56. package/dist/collection/components/ez-popover/ez-popover.css +3 -10
  57. package/dist/collection/components/ez-popup/ez-popup.css +1 -1
  58. package/dist/collection/components/ez-popup/ez-popup.js +1 -1
  59. package/dist/collection/components/ez-search/ez-search.css +1 -1
  60. package/dist/collection/components/ez-search/ez-search.js +98 -24
  61. package/dist/collection/components/ez-split-button/ez-split-button.css +2 -2
  62. package/dist/collection/components/ez-text-area/ez-text-area.css +49 -0
  63. package/dist/collection/components/ez-text-area/ez-text-area.js +102 -2
  64. package/dist/collection/components/ez-text-input/ez-text-input.css +27 -53
  65. package/dist/collection/components/ez-text-input/ez-text-input.js +84 -6
  66. package/dist/collection/components/ez-time-input/ez-time-input.js +24 -0
  67. package/dist/collection/utils/FocusResolver.js +31 -0
  68. package/dist/collection/utils/form/DataBinder.js +18 -3
  69. package/dist/collection/utils/form/FormMetadata.js +1 -1
  70. package/dist/collection/utils/interfaces/AbstractFieldMetadata.js +1 -1
  71. package/dist/custom-elements/index.js +15294 -70867
  72. package/dist/esm/DataBinder-02fa9bb9.js +441 -0
  73. package/dist/esm/FocusResolver-1ccbf850.js +33 -0
  74. package/dist/esm/ez-button.entry.js +1 -1
  75. package/dist/esm/ez-card-item_3.entry.js +12 -19
  76. package/dist/esm/ez-chart.entry.js +1 -1
  77. package/dist/esm/ez-combo-box.entry.js +47 -11
  78. package/dist/esm/ez-custom-form-input_2.entry.js +3 -2
  79. package/dist/esm/ez-date-input.entry.js +8 -2
  80. package/dist/esm/ez-date-time-input.entry.js +8 -2
  81. package/dist/esm/ez-dialog.entry.js +10 -2
  82. package/dist/esm/ez-form-view.entry.js +2 -2
  83. package/dist/esm/ez-form.entry.js +4 -324
  84. package/dist/esm/ez-grid.entry.js +14584 -70470
  85. package/dist/esm/ez-icon.entry.js +1 -1
  86. package/dist/esm/ez-list.entry.js +152 -101
  87. package/dist/esm/ez-modal.entry.js +1 -1
  88. package/dist/esm/ez-number-input.entry.js +7 -0
  89. package/dist/esm/ez-popover.entry.js +1 -1
  90. package/dist/esm/ez-popup.entry.js +2 -2
  91. package/dist/esm/ez-search.entry.js +71 -22
  92. package/dist/esm/ez-split-button.entry.js +1 -1
  93. package/dist/esm/ez-text-area.entry.js +66 -4
  94. package/dist/esm/ez-text-input.entry.js +49 -7
  95. package/dist/esm/ez-time-input.entry.js +6 -0
  96. package/dist/esm/ezui.js +1 -1
  97. package/dist/esm/loader.js +1 -1
  98. package/dist/ezui/ezui.esm.js +1 -1
  99. package/dist/ezui/p-0a75bb05.entry.js +1 -0
  100. package/dist/ezui/p-0db68715.entry.js +1 -0
  101. package/dist/ezui/p-15d7af92.entry.js +1 -0
  102. package/dist/ezui/p-19098a3f.entry.js +1 -0
  103. package/dist/ezui/p-1f830a2f.entry.js +1 -0
  104. package/dist/ezui/p-2aa8e4b2.entry.js +1 -0
  105. package/dist/ezui/p-2bb2a0c4.entry.js +1 -0
  106. package/dist/ezui/p-3175fe8c.entry.js +1 -0
  107. package/dist/ezui/p-455e737c.js +1 -0
  108. package/dist/ezui/{p-a2e5b8c3.entry.js → p-7409eeaa.entry.js} +1 -1
  109. package/dist/ezui/p-7ed30844.entry.js +1 -0
  110. package/dist/ezui/p-97af4b13.entry.js +1 -0
  111. package/dist/ezui/p-98dc7ce3.entry.js +309 -0
  112. package/dist/ezui/p-a5b91a77.entry.js +1 -0
  113. package/dist/ezui/p-a80b1287.entry.js +1 -0
  114. package/dist/ezui/p-bfad39eb.entry.js +1 -0
  115. package/dist/ezui/p-cd2e78f0.entry.js +1 -0
  116. package/dist/ezui/p-d0ca26fe.entry.js +1 -0
  117. package/dist/ezui/p-d24a7b4c.entry.js +1 -0
  118. package/dist/ezui/p-dc628ed3.js +1 -0
  119. package/dist/ezui/p-dc8b36c3.entry.js +1 -0
  120. package/dist/ezui/p-e5e16038.entry.js +1 -0
  121. package/dist/ezui/p-fec696ab.entry.js +1 -0
  122. package/dist/ezui/p-ffd246f5.entry.js +1 -0
  123. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +7 -1
  124. package/dist/types/components/ez-date-input/ez-date-input.d.ts +6 -1
  125. package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +6 -1
  126. package/dist/types/components/ez-dialog/ez-dialog.d.ts +2 -0
  127. package/dist/types/components/ez-filter-input/ez-filter-input.d.ts +4 -11
  128. package/dist/types/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.d.ts +1 -1
  129. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +12 -0
  130. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +7 -2
  131. package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +2 -1
  132. package/dist/types/components/ez-grid/controller/ag-grid/GridEditionManager.d.ts +19 -7
  133. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.d.ts +3 -1
  134. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellRender.d.ts +1 -1
  135. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.d.ts +1 -1
  136. package/dist/types/components/ez-grid/controller/ag-grid/components/cellRendererStatus.d.ts +1 -1
  137. package/dist/types/components/ez-grid/controller/ag-grid/components/selectionHeader.d.ts +1 -1
  138. package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellEditor.d.ts +1 -1
  139. package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellRender.d.ts +1 -1
  140. package/dist/types/components/ez-grid/controller/ag-grid/editor/IUICellEditor.d.ts +1 -0
  141. package/dist/types/components/ez-grid/controller/ag-grid/mock/Server.d.ts +1 -1
  142. package/dist/types/components/ez-grid/ez-grid.d.ts +11 -1
  143. package/dist/types/components/ez-list/ez-list.d.ts +3 -26
  144. package/dist/types/components/ez-modal/ez-modal.d.ts +1 -1
  145. package/dist/types/components/ez-number-input/ez-number-input.d.ts +4 -0
  146. package/dist/types/components/ez-search/ez-search.d.ts +10 -2
  147. package/dist/types/components/ez-text-area/ez-text-area.d.ts +17 -0
  148. package/dist/types/components/ez-text-input/ez-text-input.d.ts +9 -0
  149. package/dist/types/components/ez-time-input/ez-time-input.d.ts +4 -0
  150. package/dist/types/components.d.ts +109 -44
  151. package/dist/types/utils/FocusResolver.d.ts +5 -0
  152. package/dist/types/utils/form/DataBinder.d.ts +3 -0
  153. package/package.json +11 -4
  154. package/dist/cjs/RecordValidationProcessor-10846595.js +0 -108
  155. package/dist/esm/RecordValidationProcessor-9c6cc267.js +0 -105
  156. package/dist/ezui/p-10820c20.entry.js +0 -1
  157. package/dist/ezui/p-188f1c4c.entry.js +0 -1
  158. package/dist/ezui/p-49456b34.entry.js +0 -1
  159. package/dist/ezui/p-5a90d7d1.entry.js +0 -1
  160. package/dist/ezui/p-5b205c80.entry.js +0 -1
  161. package/dist/ezui/p-62732269.entry.js +0 -1
  162. package/dist/ezui/p-7bc07c31.entry.js +0 -1
  163. package/dist/ezui/p-86b6aa01.entry.js +0 -1
  164. package/dist/ezui/p-9d9ecb7c.entry.js +0 -1
  165. package/dist/ezui/p-abce5219.entry.js +0 -1
  166. package/dist/ezui/p-b3b94f72.entry.js +0 -1
  167. package/dist/ezui/p-b95632e8.entry.js +0 -1
  168. package/dist/ezui/p-bcd47eda.entry.js +0 -1
  169. package/dist/ezui/p-c3c3d640.entry.js +0 -304
  170. package/dist/ezui/p-cdc472cc.entry.js +0 -1
  171. package/dist/ezui/p-d2c06f38.entry.js +0 -1
  172. package/dist/ezui/p-d8f64bb7.entry.js +0 -1
  173. package/dist/ezui/p-dc4ada32.entry.js +0 -1
  174. package/dist/ezui/p-e85c48d7.entry.js +0 -1
  175. package/dist/ezui/p-f299c608.entry.js +0 -1
  176. package/dist/ezui/p-f42855b9.js +0 -1
  177. package/dist/ezui/p-f80ac647.entry.js +0 -1
@@ -7,11 +7,13 @@ export class EzTextInput {
7
7
  this.enabled = true;
8
8
  this.errorMessage = undefined;
9
9
  this.mask = undefined;
10
+ this.cleanValueMask = false;
10
11
  this.canShowError = true;
11
12
  this.restrict = undefined;
12
13
  this.mode = "regular";
13
14
  this.noBorder = false;
14
15
  this.password = false;
16
+ this.autoFocus = false;
15
17
  }
16
18
  observeErrorMessage() {
17
19
  if (this._inputElem) {
@@ -121,7 +123,12 @@ export class EzTextInput {
121
123
  const value = this._inputElem.value;
122
124
  if (value && this._maskFormatter) {
123
125
  try {
124
- this._inputElem.value = this._maskFormatter.format(value);
126
+ if (this.cleanValueMask) {
127
+ this.applyMask(value);
128
+ }
129
+ else {
130
+ this._inputElem.value = this._maskFormatter.format(value);
131
+ }
125
132
  }
126
133
  catch (e) {
127
134
  this.errorMessage = e.message;
@@ -139,8 +146,34 @@ export class EzTextInput {
139
146
  }
140
147
  controlChangeValue() {
141
148
  if (this._inputElem && (this.value || '') !== this._inputElem.value) {
142
- this.value = this._inputElem.value;
149
+ if (this.cleanValueMask) {
150
+ this.value = this._maskFormatter.removeMask(this._inputElem.value);
151
+ }
152
+ else {
153
+ this.value = this._inputElem.value;
154
+ }
155
+ }
156
+ }
157
+ applyMask(value) {
158
+ if (!value || value === "")
159
+ return value;
160
+ if (this._maskFormatter) {
161
+ try {
162
+ const formattedValue = this._maskFormatter.applyMask(this._maskFormatter.removeMask(value));
163
+ if (this._inputElem) {
164
+ this._inputElem.value = formattedValue;
165
+ return this._inputElem.value;
166
+ }
167
+ else {
168
+ this.value = formattedValue;
169
+ return this.value;
170
+ }
171
+ }
172
+ catch (e) {
173
+ this.errorMessage = e.message;
174
+ }
143
175
  }
176
+ return value;
144
177
  }
145
178
  handleChange() {
146
179
  if (!this._inputElem) {
@@ -165,9 +198,9 @@ export class EzTextInput {
165
198
  content.style.justifyContent = "center";
166
199
  content.style.overflow = "hidden";
167
200
  content.style.top = "0px";
201
+ content.style.width = "var(--ez-text-input__icon--width)";
168
202
  content.style.height = this.mode != "slim" ? "var(--ez-text-input--height)" : "var(--ez-text-input--height--slim)";
169
203
  if (slot.name == "leftIcon") {
170
- content.style.width = "var(--ez-text-input__icon--left--width)";
171
204
  content.style.left = "0px";
172
205
  content.style.borderRadius = "var(--ez-text-input--border-radius) 0 0 var(--ez-text-input--border-radius)";
173
206
  this._inputElem.classList.add("icon--left");
@@ -177,7 +210,6 @@ export class EzTextInput {
177
210
  this._contentLeftSlot = content;
178
211
  }
179
212
  else if (slot.name == "rightIcon") {
180
- content.style.width = "var(--ez-text-input__icon--right--width)";
181
213
  content.style.right = "0px";
182
214
  content.style.borderRadius = "0 var(--ez-text-input--border-radius) var(--ez-text-input--border-radius) 0";
183
215
  this._inputElem.classList.add("icon--right");
@@ -203,6 +235,11 @@ export class EzTextInput {
203
235
  this.observeMask();
204
236
  this.adjustFloatingLabel();
205
237
  this.adjustBorderInput();
238
+ if (this.autoFocus) {
239
+ requestAnimationFrame(() => {
240
+ this.setFocus({ selectText: true });
241
+ });
242
+ }
206
243
  this._inputElem.addEventListener('focus', () => {
207
244
  this._inputElem.setSelectionRange(0, this._inputElem.value.length);
208
245
  });
@@ -212,7 +249,12 @@ export class EzTextInput {
212
249
  if (this.value) {
213
250
  if (this._maskFormatter) {
214
251
  try {
215
- this.value = this._maskFormatter.format(this.value);
252
+ if (this.cleanValueMask) {
253
+ this.applyMask(this.value);
254
+ }
255
+ else {
256
+ this.value = this._maskFormatter.format(this.value);
257
+ }
216
258
  }
217
259
  catch (e) {
218
260
  this.errorMessage = e.message;
@@ -228,7 +270,7 @@ export class EzTextInput {
228
270
  ElementIDUtils.addIDInfoIfNotExists(this._hostElement, 'input');
229
271
  return (h(Host, { style: this._hostElement.classList.contains("grid_editor") ? { "height": "100%" } : null }, h("slot", { name: "leftIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } }), this.label && this.mode != "slim" ?
230
272
  h("label", { ref: (el) => this._labelElem = el, class: this.enabled ? "input__label" : "input__label input__label--disabled", onClick: () => this._inputElem.focus(), title: this.label }, this.label)
231
- : null, h("input", { "data-element-id": ElementIDUtils.getInternalIDInfo("input"), onFocus: () => this.doFocus(), ref: (el) => this._inputElem = el, type: this.password ? "password" : "text", class: this.mode === "slim" ? "input--slim" : "", placeholder: this.mode === "slim" && this.label ? this.label : "", value: this.value, disabled: !this.enabled, onInput: () => { this.handleChange(); }, onFocusout: () => { this.handleFocusout(); } }), h("slot", { name: "rightIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } }), this.canShowError && this.mode != "slim" &&
273
+ : null, h("input", { "data-element-id": ElementIDUtils.getInternalIDInfo("input"), onFocus: () => this.doFocus(), ref: (el) => this._inputElem = el, type: this.password ? "password" : "text", class: this.mode === "slim" ? "input--slim" : "", placeholder: this.mode === "slim" && this.label ? this.label : "", value: this.mask && this.cleanValueMask ? this.applyMask(this.value) : this.value, disabled: !this.enabled, onInput: () => { this.handleChange(); }, onFocusout: () => { this.handleFocusout(); } }), h("slot", { name: "rightIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } }), this.canShowError && this.mode != "slim" &&
232
274
  h("span", { class: "message-box", ref: (el) => this._messageBoxElem = el, title: this.errorMessage, "data-element-id": ElementIDUtils.getInternalIDInfo("message_box") }, this.errorMessage)));
233
275
  }
234
276
  static get is() { return "ez-text-input"; }
@@ -331,6 +373,24 @@ export class EzTextInput {
331
373
  "attribute": "mask",
332
374
  "reflect": false
333
375
  },
376
+ "cleanValueMask": {
377
+ "type": "boolean",
378
+ "mutable": false,
379
+ "complexType": {
380
+ "original": "boolean",
381
+ "resolved": "boolean",
382
+ "references": {}
383
+ },
384
+ "required": false,
385
+ "optional": false,
386
+ "docs": {
387
+ "tags": [],
388
+ "text": "Para remover a m\u00E1scara quando fizer um apply no formul\u00E1rio."
389
+ },
390
+ "attribute": "clean-value-mask",
391
+ "reflect": false,
392
+ "defaultValue": "false"
393
+ },
334
394
  "canShowError": {
335
395
  "type": "boolean",
336
396
  "mutable": false,
@@ -419,6 +479,24 @@ export class EzTextInput {
419
479
  "attribute": "password",
420
480
  "reflect": false,
421
481
  "defaultValue": "false"
482
+ },
483
+ "autoFocus": {
484
+ "type": "boolean",
485
+ "mutable": false,
486
+ "complexType": {
487
+ "original": "boolean",
488
+ "resolved": "boolean",
489
+ "references": {}
490
+ },
491
+ "required": false,
492
+ "optional": false,
493
+ "docs": {
494
+ "tags": [],
495
+ "text": "Se true o campo receber\u00E1 o foco ao ser renderizado."
496
+ },
497
+ "attribute": "auto-focus",
498
+ "reflect": false,
499
+ "defaultValue": "false"
422
500
  }
423
501
  };
424
502
  }
@@ -10,6 +10,7 @@ export class EzTimeInput {
10
10
  this.showSeconds = false;
11
11
  this.mode = "regular";
12
12
  this.canShowError = true;
13
+ this.autoFocus = false;
13
14
  }
14
15
  observeErrorMessage() {
15
16
  var _a;
@@ -130,6 +131,11 @@ export class EzTimeInput {
130
131
  //---------------------------------------------
131
132
  componentDidLoad() {
132
133
  CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
134
+ if (this.autoFocus) {
135
+ requestAnimationFrame(() => {
136
+ this.setFocus({ selectText: true });
137
+ });
138
+ }
133
139
  }
134
140
  componentWillLoad() {
135
141
  this.observeShowSeconds();
@@ -281,6 +287,24 @@ export class EzTimeInput {
281
287
  "attribute": "can-show-error",
282
288
  "reflect": true,
283
289
  "defaultValue": "true"
290
+ },
291
+ "autoFocus": {
292
+ "type": "boolean",
293
+ "mutable": false,
294
+ "complexType": {
295
+ "original": "boolean",
296
+ "resolved": "boolean",
297
+ "references": {}
298
+ },
299
+ "required": false,
300
+ "optional": false,
301
+ "docs": {
302
+ "tags": [],
303
+ "text": "Se true o campo de texto receber\u00E1 o foco ao ser renderizado."
304
+ },
305
+ "attribute": "auto-focus",
306
+ "reflect": false,
307
+ "defaultValue": "false"
284
308
  }
285
309
  };
286
310
  }
@@ -0,0 +1,31 @@
1
+ export default class FocusResolver {
2
+ static resolveFocus(element, selectText = true) {
3
+ var _a;
4
+ if (!element)
5
+ return;
6
+ (_a = element.focus) === null || _a === void 0 ? void 0 : _a.call(element);
7
+ if (element.setFocus) {
8
+ element.setFocus({ selectText });
9
+ return;
10
+ }
11
+ this.resolveFocusOnChild(element, selectText);
12
+ }
13
+ static resolveFocusOnChild(element, selectText = true) {
14
+ var _a, _b;
15
+ if (this.isGridCell(element) && element.firstElementChild) {
16
+ this.resolveFocusOnChild(element.firstElementChild);
17
+ return;
18
+ }
19
+ if (!element || !element.classList.contains('hydrated'))
20
+ return;
21
+ const firstChild = element.firstElementChild;
22
+ if (!(firstChild === null || firstChild === void 0 ? void 0 : firstChild.focus) && !(firstChild === null || firstChild === void 0 ? void 0 : firstChild.setFocus))
23
+ return;
24
+ (_a = firstChild === null || firstChild === void 0 ? void 0 : firstChild.focus) === null || _a === void 0 ? void 0 : _a.call(firstChild);
25
+ (_b = firstChild === null || firstChild === void 0 ? void 0 : firstChild.setFocus) === null || _b === void 0 ? void 0 : _b.call(firstChild, { selectText });
26
+ }
27
+ static isGridCell(element) {
28
+ var _a;
29
+ return ((_a = element === null || element === void 0 ? void 0 : element.getAttribute) === null || _a === void 0 ? void 0 : _a.call(element, "role")) === 'gridcell';
30
+ }
31
+ }
@@ -22,6 +22,7 @@ export default class DataBinder {
22
22
  (_a = this._fields) === null || _a === void 0 ? void 0 : _a.forEach(field => {
23
23
  this.updateValue(field.fieldName, field.field);
24
24
  });
25
+ this.clearFieldError(Object.keys(action.payload)[0]);
25
26
  break;
26
27
  case Action.FIELD_INVALIDATED:
27
28
  (_b = this._fields) === null || _b === void 0 ? void 0 : _b.forEach(field => {
@@ -67,11 +68,14 @@ export default class DataBinder {
67
68
  });
68
69
  this._formMetadata = formMetadata;
69
70
  this._recordValidatorProcessor = new RecordValidationProcessor(this._dataUnit, {
70
- getRequiredFields: () => this._formMetadata.getRequiredFields(),
71
+ getRequiredFields: () => this.getFormRequiredFields(),
71
72
  markAsInvalid: field => this.markInvalid(field),
72
73
  getMessageForField: field => this.getErrorMessage(field),
73
74
  }, recordsValidator);
74
75
  }
76
+ getFormRequiredFields() {
77
+ return this._formMetadata.getRequiredFields();
78
+ }
75
79
  disconnectDataUnit() {
76
80
  const dataBindersByDataUnit = ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__") || new Map();
77
81
  const dataBinders = dataBindersByDataUnit.get(this._dataUnit.dataUnitId);
@@ -111,6 +115,14 @@ export default class DataBinder {
111
115
  fieldElement["errorMessage"] = "";
112
116
  });
113
117
  }
118
+ clearFieldError(fieldName) {
119
+ var _a;
120
+ const field = (_a = this._fields.get(fieldName)) === null || _a === void 0 ? void 0 : _a.field;
121
+ if (field["errorMessage"]) {
122
+ field["errorMessage"] = "";
123
+ this._dataUnit.clearInvalid(this.getCurrentRecordId(), fieldName);
124
+ }
125
+ }
114
126
  updateValue(fieldName, field) {
115
127
  const bind = this._fields.get(fieldName);
116
128
  try {
@@ -131,8 +143,7 @@ export default class DataBinder {
131
143
  }
132
144
  static async validateByDataunit(dataUnit) {
133
145
  try {
134
- const dataBindersByDataUnit = ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__");
135
- const dataBinders = dataBindersByDataUnit.get(dataUnit.dataUnitId) || [];
146
+ const dataBinders = this.getDataBindersByDataUnit(dataUnit);
136
147
  await Promise.all(dataBinders.map((dataBinder) => dataBinder.validate()));
137
148
  return true;
138
149
  }
@@ -140,6 +151,10 @@ export default class DataBinder {
140
151
  return false;
141
152
  }
142
153
  }
154
+ static getDataBindersByDataUnit(dataUnit) {
155
+ const dataBindersByDataUnit = ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__");
156
+ return dataBindersByDataUnit.get(dataUnit.dataUnitId) || [];
157
+ }
143
158
  updateErrorMessage(fieldName, field, message) {
144
159
  if (message == undefined) {
145
160
  message = this._dataUnit.getInvalidMessage(this.getCurrentRecordId(), fieldName);
@@ -97,7 +97,7 @@ export const buildFormMetadata = (config, dataUnit, includeDetails = false) => {
97
97
  return;
98
98
  }
99
99
  const descriptor = dataUnit.getField(field.name);
100
- if (descriptor && tabConfig.visible) {
100
+ if (descriptor && descriptor.visible && tabConfig.visible) {
101
101
  if (!sheets.has(tabConfig)) {
102
102
  sheets.set(tabConfig, []);
103
103
  }
@@ -16,6 +16,6 @@ export const buildFieldMetadata = (descriptor, config) => {
16
16
  name, label, group,
17
17
  readOnly, required,
18
18
  props,
19
- userInterface: userInterface || UserInterface.SHORTTEXT
19
+ userInterface: userInterface || UserInterface.SHORTTEXT,
20
20
  };
21
21
  };