@sankhyalabs/ezui 0.0.0-bugfix-dev-KB-75609.0 → 0.0.0-bugfix-dev-KB-75609.1

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 (105) hide show
  1. package/dist/cjs/DataBinder-aff1dcc7.js +445 -0
  2. package/dist/cjs/FocusResolver-885f2173.js +35 -0
  3. package/dist/cjs/ez-card-item_3.cjs.entry.js +8 -2
  4. package/dist/cjs/ez-combo-box.cjs.entry.js +46 -10
  5. package/dist/cjs/ez-date-input.cjs.entry.js +8 -2
  6. package/dist/cjs/ez-date-time-input.cjs.entry.js +8 -2
  7. package/dist/cjs/ez-dialog.cjs.entry.js +9 -1
  8. package/dist/cjs/ez-form.cjs.entry.js +3 -324
  9. package/dist/cjs/ez-grid.cjs.entry.js +254 -62
  10. package/dist/cjs/ez-number-input.cjs.entry.js +7 -0
  11. package/dist/cjs/ez-search.cjs.entry.js +27 -11
  12. package/dist/cjs/ez-text-area.cjs.entry.js +6 -0
  13. package/dist/cjs/ez-text-input.cjs.entry.js +7 -1
  14. package/dist/cjs/ez-time-input.cjs.entry.js +6 -0
  15. package/dist/cjs/ezui.cjs.js +1 -1
  16. package/dist/cjs/loader.cjs.js +1 -1
  17. package/dist/collection/collection-manifest.json +1 -1
  18. package/dist/collection/components/ez-combo-box/ez-combo-box.js +75 -14
  19. package/dist/collection/components/ez-date-input/ez-date-input.js +35 -4
  20. package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +35 -4
  21. package/dist/collection/components/ez-dialog/ez-dialog.js +9 -1
  22. package/dist/collection/components/ez-filter-input/ez-filter-input.js +35 -4
  23. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +52 -14
  24. package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +3 -0
  25. package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +166 -45
  26. package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.js +7 -0
  27. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/ComboBox.tpl.js +1 -0
  28. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/DateInput.tpl.js +1 -0
  29. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/NumberInput.tpl.js +1 -0
  30. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/Search.tpl.js +1 -0
  31. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/TextInput.tpl.js +4 -1
  32. package/dist/collection/components/ez-grid/ez-grid.js +83 -1
  33. package/dist/collection/components/ez-number-input/ez-number-input.js +25 -0
  34. package/dist/collection/components/ez-search/ez-search.js +54 -13
  35. package/dist/collection/components/ez-text-area/ez-text-area.js +24 -0
  36. package/dist/collection/components/ez-text-input/ez-text-input.css +14 -38
  37. package/dist/collection/components/ez-text-input/ez-text-input.js +24 -0
  38. package/dist/collection/components/ez-time-input/ez-time-input.js +24 -0
  39. package/dist/collection/utils/FocusResolver.js +31 -0
  40. package/dist/collection/utils/form/DataBinder.js +18 -3
  41. package/dist/custom-elements/index.js +442 -102
  42. package/dist/esm/DataBinder-bd240826.js +441 -0
  43. package/dist/esm/FocusResolver-1ccbf850.js +33 -0
  44. package/dist/esm/ez-card-item_3.entry.js +8 -2
  45. package/dist/esm/ez-combo-box.entry.js +47 -11
  46. package/dist/esm/ez-date-input.entry.js +8 -2
  47. package/dist/esm/ez-date-time-input.entry.js +8 -2
  48. package/dist/esm/ez-dialog.entry.js +9 -1
  49. package/dist/esm/ez-form.entry.js +2 -323
  50. package/dist/esm/ez-grid.entry.js +253 -61
  51. package/dist/esm/ez-number-input.entry.js +7 -0
  52. package/dist/esm/ez-search.entry.js +27 -11
  53. package/dist/esm/ez-text-area.entry.js +6 -0
  54. package/dist/esm/ez-text-input.entry.js +7 -1
  55. package/dist/esm/ez-time-input.entry.js +6 -0
  56. package/dist/esm/ezui.js +1 -1
  57. package/dist/esm/loader.js +1 -1
  58. package/dist/ezui/ezui.esm.js +1 -1
  59. package/dist/ezui/p-03a2c7d1.entry.js +1 -0
  60. package/dist/ezui/p-0a75bb05.entry.js +1 -0
  61. package/dist/ezui/{p-37219d42.entry.js → p-0db68715.entry.js} +1 -1
  62. package/dist/ezui/p-19098a3f.entry.js +1 -0
  63. package/dist/ezui/p-1f830a2f.entry.js +1 -0
  64. package/dist/ezui/p-3dd919b7.entry.js +1 -0
  65. package/dist/ezui/p-7bfae0fc.entry.js +1 -0
  66. package/dist/ezui/p-81f06699.js +1 -0
  67. package/dist/ezui/p-97af4b13.entry.js +1 -0
  68. package/dist/ezui/p-9ceefe4d.entry.js +1 -0
  69. package/dist/ezui/{p-c3c3d640.entry.js → p-b0a5c2cd.entry.js} +2 -2
  70. package/dist/ezui/p-d0ca26fe.entry.js +1 -0
  71. package/dist/ezui/p-dc628ed3.js +1 -0
  72. package/dist/ezui/p-ffd246f5.entry.js +1 -0
  73. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +7 -1
  74. package/dist/types/components/ez-date-input/ez-date-input.d.ts +6 -1
  75. package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +6 -1
  76. package/dist/types/components/ez-dialog/ez-dialog.d.ts +2 -0
  77. package/dist/types/components/ez-filter-input/ez-filter-input.d.ts +6 -1
  78. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +10 -0
  79. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +4 -0
  80. package/dist/types/components/ez-grid/controller/ag-grid/GridEditionManager.d.ts +18 -6
  81. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.d.ts +2 -0
  82. package/dist/types/components/ez-grid/controller/ag-grid/editor/IUICellEditor.d.ts +1 -0
  83. package/dist/types/components/ez-grid/ez-grid.d.ts +10 -0
  84. package/dist/types/components/ez-number-input/ez-number-input.d.ts +4 -0
  85. package/dist/types/components/ez-search/ez-search.d.ts +6 -1
  86. package/dist/types/components/ez-text-area/ez-text-area.d.ts +4 -0
  87. package/dist/types/components/ez-text-input/ez-text-input.d.ts +4 -0
  88. package/dist/types/components/ez-time-input/ez-time-input.d.ts +4 -0
  89. package/dist/types/components.d.ts +91 -6
  90. package/dist/types/utils/FocusResolver.d.ts +5 -0
  91. package/dist/types/utils/form/DataBinder.d.ts +3 -0
  92. package/package.json +1 -1
  93. package/dist/cjs/RecordValidationProcessor-10846595.js +0 -108
  94. package/dist/esm/RecordValidationProcessor-9c6cc267.js +0 -105
  95. package/dist/ezui/p-0f3b2e67.entry.js +0 -1
  96. package/dist/ezui/p-49456b34.entry.js +0 -1
  97. package/dist/ezui/p-5a90d7d1.entry.js +0 -1
  98. package/dist/ezui/p-62732269.entry.js +0 -1
  99. package/dist/ezui/p-b95632e8.entry.js +0 -1
  100. package/dist/ezui/p-c25f0e92.entry.js +0 -1
  101. package/dist/ezui/p-d2c06f38.entry.js +0 -1
  102. package/dist/ezui/p-e85c48d7.entry.js +0 -1
  103. package/dist/ezui/p-f0e2ce9d.entry.js +0 -1
  104. package/dist/ezui/p-f299c608.entry.js +0 -1
  105. package/dist/ezui/p-f42855b9.js +0 -1
@@ -39,6 +39,7 @@ export class EzSearch {
39
39
  this.suppressSearch = false;
40
40
  this.ensureClearButtonVisible = false;
41
41
  this.suppressPreLoad = false;
42
+ this.autoFocus = false;
42
43
  }
43
44
  observeErrorMessage() {
44
45
  var _a;
@@ -97,9 +98,9 @@ export class EzSearch {
97
98
  /**
98
99
  * Aplica o foco no campo.
99
100
  */
100
- async setFocus() {
101
+ async setFocus(options) {
101
102
  if (this._textInput) {
102
- this._textInput.setFocus();
103
+ this._textInput.setFocus(options);
103
104
  }
104
105
  }
105
106
  /**
@@ -374,13 +375,14 @@ export class EzSearch {
374
375
  const endHighlight = new RegExp(this._endHighlightTag, 'g');
375
376
  return String(value !== null && value !== void 0 ? value : "").replace(startHighlight, '').replace(endHighlight, '');
376
377
  }
377
- selectOption(newOption) {
378
+ selectOption(newOption, focusOnInput = true) {
378
379
  var _a, _b;
379
380
  const currentValue = this.getSelectedOption(this.value);
380
381
  const newOptionsReplaced = Object.assign(Object.assign({}, newOption), { value: this.replaceHighlight(newOption === null || newOption === void 0 ? void 0 : newOption.value), label: this.replaceHighlight(newOption === null || newOption === void 0 ? void 0 : newOption.label) });
381
- if ((((_a = currentValue === null || currentValue === void 0 ? void 0 : currentValue.value) === null || _a === void 0 ? void 0 : _a.toString()) !== ((_b = newOptionsReplaced === null || newOptionsReplaced === void 0 ? void 0 : newOptionsReplaced.value) === null || _b === void 0 ? void 0 : _b.toString()))
382
- || (currentValue == undefined && newOptionsReplaced != undefined && "value" in newOptionsReplaced)) {
383
- const adjustedOpt = !(newOptionsReplaced === null || newOptionsReplaced === void 0 ? void 0 : newOptionsReplaced.value) ? undefined : newOptionsReplaced;
382
+ const newOptionsFormatted = Object.assign(Object.assign({}, newOptionsReplaced), { value: this.replaceQuotes(newOptionsReplaced === null || newOptionsReplaced === void 0 ? void 0 : newOptionsReplaced.value), label: this.replaceQuotes(newOptionsReplaced === null || newOptionsReplaced === void 0 ? void 0 : newOptionsReplaced.label) });
383
+ if ((((_a = currentValue === null || currentValue === void 0 ? void 0 : currentValue.value) === null || _a === void 0 ? void 0 : _a.toString()) !== ((_b = newOptionsFormatted === null || newOptionsFormatted === void 0 ? void 0 : newOptionsFormatted.value) === null || _b === void 0 ? void 0 : _b.toString()))
384
+ || (currentValue == undefined && newOptionsFormatted != undefined && "value" in newOptionsFormatted)) {
385
+ const adjustedOpt = !(newOptionsFormatted === null || newOptionsFormatted === void 0 ? void 0 : newOptionsFormatted.value) ? undefined : newOptionsFormatted;
384
386
  this.value = adjustedOpt;
385
387
  this._currentValue = adjustedOpt;
386
388
  }
@@ -390,6 +392,11 @@ export class EzSearch {
390
392
  }
391
393
  this._visibleOptions = [];
392
394
  this.clearSource();
395
+ if (focusOnInput) {
396
+ setTimeout(() => {
397
+ this.setFocus();
398
+ }, 0);
399
+ }
393
400
  }
394
401
  loadOptions(mode, argument = "") {
395
402
  this._criteria = argument;
@@ -426,7 +433,7 @@ export class EzSearch {
426
433
  this.value = null;
427
434
  this._currentValue = null;
428
435
  }
429
- controlListWithOnlyOne() {
436
+ controlListWithOnlyOne(focusOnInput = true) {
430
437
  var _a, _b;
431
438
  const source = (_a = this._visibleOptions) === null || _a === void 0 ? void 0 : _a.filter((opt) => opt.label !== "" && opt.value != undefined);
432
439
  if ((source === null || source === void 0 ? void 0 : source.length) > 0) {
@@ -437,7 +444,7 @@ export class EzSearch {
437
444
  value: (_b = source[0].value) === null || _b === void 0 ? void 0 : _b.replace(startHighlight, '').replace(endHighlight, ''),
438
445
  label: title === null || title === void 0 ? void 0 : title.replace(startHighlight, '').replace(endHighlight, '')
439
446
  };
440
- this.selectOption(option);
447
+ this.selectOption(option, focusOnInput);
441
448
  }
442
449
  }
443
450
  controlEmptySearch() {
@@ -563,6 +570,11 @@ export class EzSearch {
563
570
  }
564
571
  });
565
572
  });
573
+ if (this.autoFocus) {
574
+ requestAnimationFrame(() => {
575
+ this.setFocus({ selectText: true });
576
+ });
577
+ }
566
578
  }
567
579
  //---------------------------------------------
568
580
  // Event handlers
@@ -632,12 +644,16 @@ export class EzSearch {
632
644
  }
633
645
  switch (event.key) {
634
646
  case "ArrowDown":
635
- this.nextOption();
636
647
  event.stopPropagation();
648
+ if (this.canShowListOptions())
649
+ event.preventDefault();
650
+ this.nextOption();
637
651
  break;
638
652
  case "ArrowUp":
639
- this.previousOption();
640
653
  event.stopPropagation();
654
+ if (this.canShowListOptions())
655
+ event.preventDefault();
656
+ this.previousOption();
641
657
  break;
642
658
  case "Enter":
643
659
  this.handleEventPropagation(event);
@@ -648,7 +664,7 @@ export class EzSearch {
648
664
  break;
649
665
  case "Tab":
650
666
  this._tabPressed = true;
651
- this.controlListWithOnlyOne();
667
+ this.controlListWithOnlyOne(false);
652
668
  break;
653
669
  }
654
670
  //ATENÇÃO: Existe a necessidade de propagar o evento de teclado.
@@ -1055,6 +1071,24 @@ export class EzSearch {
1055
1071
  "attribute": "suppress-pre-load",
1056
1072
  "reflect": false,
1057
1073
  "defaultValue": "false"
1074
+ },
1075
+ "autoFocus": {
1076
+ "type": "boolean",
1077
+ "mutable": false,
1078
+ "complexType": {
1079
+ "original": "boolean",
1080
+ "resolved": "boolean",
1081
+ "references": {}
1082
+ },
1083
+ "required": false,
1084
+ "optional": false,
1085
+ "docs": {
1086
+ "tags": [],
1087
+ "text": "Se true o campo de texto receber\u00E1 o foco ao ser renderizado."
1088
+ },
1089
+ "attribute": "auto-focus",
1090
+ "reflect": false,
1091
+ "defaultValue": "false"
1058
1092
  }
1059
1093
  };
1060
1094
  }
@@ -1110,11 +1144,18 @@ export class EzSearch {
1110
1144
  },
1111
1145
  "setFocus": {
1112
1146
  "complexType": {
1113
- "signature": "() => Promise<void>",
1114
- "parameters": [],
1147
+ "signature": "(options?: TFocusOptions) => Promise<void>",
1148
+ "parameters": [{
1149
+ "tags": [],
1150
+ "text": ""
1151
+ }],
1115
1152
  "references": {
1116
1153
  "Promise": {
1117
1154
  "location": "global"
1155
+ },
1156
+ "TFocusOptions": {
1157
+ "location": "import",
1158
+ "path": "../ez-text-input/ez-text-input"
1118
1159
  }
1119
1160
  },
1120
1161
  "return": "Promise<void>"
@@ -13,6 +13,7 @@ export class EzTextArea {
13
13
  this.mode = "regular";
14
14
  this.enableResize = false;
15
15
  this.autoRows = false;
16
+ this.autoFocus = false;
16
17
  }
17
18
  observeErrorMessage() {
18
19
  var _a, _b, _c, _d;
@@ -201,6 +202,11 @@ export class EzTextArea {
201
202
  this.observeErrorMessage();
202
203
  this.adjustFloatingLabel();
203
204
  this.observeMode();
205
+ if (this.autoFocus) {
206
+ requestAnimationFrame(() => {
207
+ this.setFocus();
208
+ });
209
+ }
204
210
  }
205
211
  render() {
206
212
  ElementIDUtils.addIDInfoIfNotExists(this._hostElement, 'input');
@@ -384,6 +390,24 @@ export class EzTextArea {
384
390
  "attribute": "auto-rows",
385
391
  "reflect": true,
386
392
  "defaultValue": "false"
393
+ },
394
+ "autoFocus": {
395
+ "type": "boolean",
396
+ "mutable": false,
397
+ "complexType": {
398
+ "original": "boolean",
399
+ "resolved": "boolean",
400
+ "references": {}
401
+ },
402
+ "required": false,
403
+ "optional": false,
404
+ "docs": {
405
+ "tags": [],
406
+ "text": "Se true o campo de texto receber\u00E1 o foco ao ser renderizado."
407
+ },
408
+ "attribute": "auto-focus",
409
+ "reflect": false,
410
+ "defaultValue": "false"
387
411
  }
388
412
  };
389
413
  }
@@ -46,6 +46,9 @@
46
46
  --ez-text-input__input--noborder-color: white;
47
47
  /*@doc Define o padding do input*/
48
48
  --ez-text-input__input--padding: var(--space--medium, 6px);
49
+ /*@doc Define a cor do placeholder do input.*/
50
+ --ez-text-input__placeholder--color: var(--text--secondary, #a2abb9);
51
+
49
52
 
50
53
  /* message box */
51
54
  /*@doc Define o tamanho da fonte da mensagem abaixo do input.*/
@@ -238,45 +241,18 @@ input:read-only {
238
241
  font-weight: bold;
239
242
  }
240
243
 
241
- .input--slim::-webkit-input-placeholder { /* Edge */
242
- /*public*/
243
- font-family: var(--ez-text-input--font-family);
244
- font-size: var(--ez-text-input--font-size);
245
- font-weight: var(--ez-text-input--font-weight);
246
- color: var(--ez-text-input--color);
247
- }
248
-
249
- .input--slim:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
250
- /*public*/
251
- font-family: var(--ez-text-input--font-family);
252
- font-size: var(--ez-text-input--font-size);
253
- font-weight: var(--ez-text-input--font-weight);
254
- color: var(--ez-text-input--color);
255
- }
256
-
257
- .input--slim::-moz-placeholder { /* Mozilla Firefox 19+ */
258
- /*public*/
259
- font-family: var(--ez-text-input--font-family);
260
- font-size: var(--ez-text-input--font-size);
261
- font-weight: var(--ez-text-input--font-weight);
262
- color: var(--ez-text-input--color);
263
- }
264
-
265
- .input--slim:-ms-input-placeholder { /* Internet Explorer 10-11 */
266
- /*public*/
267
- font-family: var(--ez-text-input--font-family);
268
- font-size: var(--ez-text-input--font-size);
269
- font-weight: var(--ez-text-input--font-weight);
270
- color: var(--ez-text-input--color);
271
- }
244
+ .input--slim::-webkit-input-placeholder, /* Edge */
245
+ .input--slim:-moz-placeholder, /* Firefox 4-18 */
246
+ .input--slim::-moz-placeholder, /* Firefox 19+ */
247
+ .input--slim:-ms-input-placeholder, /* IE 10-11 */
248
+ .input--slim::placeholder { /* Modern browsers */
249
+ /*public*/
250
+ font-family: var(--ez-text-input--font-family);
251
+ font-size: var(--ez-text-input--font-size);
252
+ font-weight: var(--ez-text-input--font-weight);
253
+ color: var(--ez-text-input__placeholder--color);
254
+ }
272
255
 
273
- .input--slim::placeholder {
274
- /*public*/
275
- font-family: var(--ez-text-input--font-family);
276
- font-size: var(--ez-text-input--font-size);
277
- font-weight: var(--ez-text-input--font-weight);
278
- color: var(--ez-text-input--color);
279
- }
280
256
 
281
257
  .input--slim:disabled::-webkit-input-placeholder, /* WebKit browsers */
282
258
  .input--slim:disabled:-moz-placeholder, /* Mozilla Firefox 4 to 18 */
@@ -12,6 +12,7 @@ export class EzTextInput {
12
12
  this.mode = "regular";
13
13
  this.noBorder = false;
14
14
  this.password = false;
15
+ this.autoFocus = false;
15
16
  }
16
17
  observeErrorMessage() {
17
18
  if (this._inputElem) {
@@ -202,6 +203,11 @@ export class EzTextInput {
202
203
  this.observeMask();
203
204
  this.adjustFloatingLabel();
204
205
  this.adjustBorderInput();
206
+ if (this.autoFocus) {
207
+ requestAnimationFrame(() => {
208
+ this.setFocus({ selectText: true });
209
+ });
210
+ }
205
211
  this._inputElem.addEventListener('focus', () => {
206
212
  this._inputElem.setSelectionRange(0, this._inputElem.value.length);
207
213
  });
@@ -418,6 +424,24 @@ export class EzTextInput {
418
424
  "attribute": "password",
419
425
  "reflect": false,
420
426
  "defaultValue": "false"
427
+ },
428
+ "autoFocus": {
429
+ "type": "boolean",
430
+ "mutable": false,
431
+ "complexType": {
432
+ "original": "boolean",
433
+ "resolved": "boolean",
434
+ "references": {}
435
+ },
436
+ "required": false,
437
+ "optional": false,
438
+ "docs": {
439
+ "tags": [],
440
+ "text": "Se true o campo receber\u00E1 o foco ao ser renderizado."
441
+ },
442
+ "attribute": "auto-focus",
443
+ "reflect": false,
444
+ "defaultValue": "false"
421
445
  }
422
446
  };
423
447
  }
@@ -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);