@sankhyalabs/ezui 0.0.0-bugfix-dev-KB-77126.0 → 0.0.0-bugfix-dev-KB-77074.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 (149) hide show
  1. package/dist/cjs/RecordValidationProcessor-10846595.js +108 -0
  2. package/dist/cjs/ez-card-item_3.cjs.entry.js +19 -12
  3. package/dist/cjs/ez-chart.cjs.entry.js +1 -1
  4. package/dist/cjs/ez-combo-box.cjs.entry.js +10 -46
  5. package/dist/cjs/ez-date-input.cjs.entry.js +2 -8
  6. package/dist/cjs/ez-date-time-input.cjs.entry.js +2 -8
  7. package/dist/cjs/ez-dialog.cjs.entry.js +2 -10
  8. package/dist/cjs/ez-form-view.cjs.entry.js +2 -2
  9. package/dist/cjs/ez-form.cjs.entry.js +324 -4
  10. package/dist/cjs/ez-grid.cjs.entry.js +70542 -14645
  11. package/dist/cjs/ez-list.cjs.entry.js +100 -151
  12. package/dist/cjs/ez-number-input.cjs.entry.js +0 -7
  13. package/dist/cjs/ez-popover.cjs.entry.js +1 -1
  14. package/dist/cjs/ez-popup.cjs.entry.js +1 -1
  15. package/dist/cjs/ez-search.cjs.entry.js +12 -28
  16. package/dist/cjs/ez-text-area.cjs.entry.js +4 -66
  17. package/dist/cjs/ez-text-input.cjs.entry.js +7 -49
  18. package/dist/cjs/ez-time-input.cjs.entry.js +0 -6
  19. package/dist/cjs/ezui.cjs.js +1 -1
  20. package/dist/cjs/loader.cjs.js +1 -1
  21. package/dist/collection/collection-manifest.json +1 -1
  22. package/dist/collection/components/ez-card-item/ez-card-item.css +5 -14
  23. package/dist/collection/components/ez-combo-box/ez-combo-box.js +14 -75
  24. package/dist/collection/components/ez-date-input/ez-date-input.js +4 -35
  25. package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +4 -35
  26. package/dist/collection/components/ez-dialog/ez-dialog.css +3 -3
  27. package/dist/collection/components/ez-dialog/ez-dialog.js +1 -9
  28. package/dist/collection/components/ez-filter-input/ez-filter-input.css +11 -0
  29. package/dist/collection/components/ez-filter-input/ez-filter-input.js +52 -22
  30. package/dist/collection/components/ez-form/ez-form.js +0 -1
  31. package/dist/collection/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.js +2 -2
  32. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +25 -80
  33. package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +0 -8
  34. package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +46 -167
  35. package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.js +0 -7
  36. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/ComboBox.tpl.js +0 -1
  37. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/DateInput.tpl.js +0 -1
  38. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/NumberInput.tpl.js +0 -1
  39. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/Search.tpl.js +0 -1
  40. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/TextInput.tpl.js +1 -4
  41. package/dist/collection/components/ez-grid/ez-grid.js +3 -90
  42. package/dist/collection/components/ez-list/ez-list.css +5 -5
  43. package/dist/collection/components/ez-list/ez-list.js +170 -152
  44. package/dist/collection/components/ez-number-input/ez-number-input.js +0 -25
  45. package/dist/collection/components/ez-popover/ez-popover.css +10 -3
  46. package/dist/collection/components/ez-popup/ez-popup.js +1 -1
  47. package/dist/collection/components/ez-search/ez-search.css +1 -1
  48. package/dist/collection/components/ez-search/ez-search.js +14 -55
  49. package/dist/collection/components/ez-text-area/ez-text-area.css +0 -49
  50. package/dist/collection/components/ez-text-area/ez-text-area.js +2 -102
  51. package/dist/collection/components/ez-text-input/ez-text-input.css +53 -27
  52. package/dist/collection/components/ez-text-input/ez-text-input.js +6 -84
  53. package/dist/collection/components/ez-time-input/ez-time-input.js +0 -24
  54. package/dist/collection/utils/form/DataBinder.js +3 -18
  55. package/dist/collection/utils/interfaces/AbstractFieldMetadata.js +1 -1
  56. package/dist/custom-elements/index.js +70890 -15272
  57. package/dist/esm/RecordValidationProcessor-9c6cc267.js +105 -0
  58. package/dist/esm/ez-card-item_3.entry.js +19 -12
  59. package/dist/esm/ez-chart.entry.js +1 -1
  60. package/dist/esm/ez-combo-box.entry.js +11 -47
  61. package/dist/esm/ez-date-input.entry.js +2 -8
  62. package/dist/esm/ez-date-time-input.entry.js +2 -8
  63. package/dist/esm/ez-dialog.entry.js +2 -10
  64. package/dist/esm/ez-form-view.entry.js +2 -2
  65. package/dist/esm/ez-form.entry.js +323 -3
  66. package/dist/esm/ez-grid.entry.js +70542 -14645
  67. package/dist/esm/ez-list.entry.js +101 -152
  68. package/dist/esm/ez-number-input.entry.js +0 -7
  69. package/dist/esm/ez-popover.entry.js +1 -1
  70. package/dist/esm/ez-popup.entry.js +1 -1
  71. package/dist/esm/ez-search.entry.js +12 -28
  72. package/dist/esm/ez-text-area.entry.js +4 -66
  73. package/dist/esm/ez-text-input.entry.js +7 -49
  74. package/dist/esm/ez-time-input.entry.js +0 -6
  75. package/dist/esm/ezui.js +1 -1
  76. package/dist/esm/loader.js +1 -1
  77. package/dist/ezui/ezui.esm.js +1 -1
  78. package/dist/ezui/p-188f1c4c.entry.js +1 -0
  79. package/dist/ezui/p-49456b34.entry.js +1 -0
  80. package/dist/ezui/p-5a90d7d1.entry.js +1 -0
  81. package/dist/ezui/p-5b205c80.entry.js +1 -0
  82. package/dist/ezui/p-62732269.entry.js +1 -0
  83. package/dist/ezui/p-86b6aa01.entry.js +1 -0
  84. package/dist/ezui/p-b3b94f72.entry.js +1 -0
  85. package/dist/ezui/p-b95632e8.entry.js +1 -0
  86. package/dist/ezui/p-bcd47eda.entry.js +1 -0
  87. package/dist/ezui/p-c3c3d640.entry.js +304 -0
  88. package/dist/ezui/p-cdc472cc.entry.js +1 -0
  89. package/dist/ezui/p-d2c06f38.entry.js +1 -0
  90. package/dist/ezui/p-d8f64bb7.entry.js +1 -0
  91. package/dist/ezui/p-dc4ada32.entry.js +1 -0
  92. package/dist/ezui/p-e85c48d7.entry.js +1 -0
  93. package/dist/ezui/p-f299c608.entry.js +1 -0
  94. package/dist/ezui/p-f42855b9.js +1 -0
  95. package/dist/ezui/p-f80ac647.entry.js +1 -0
  96. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +1 -7
  97. package/dist/types/components/ez-date-input/ez-date-input.d.ts +1 -6
  98. package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +1 -6
  99. package/dist/types/components/ez-dialog/ez-dialog.d.ts +0 -2
  100. package/dist/types/components/ez-filter-input/ez-filter-input.d.ts +11 -4
  101. package/dist/types/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.d.ts +1 -1
  102. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +0 -12
  103. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +2 -7
  104. package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +1 -2
  105. package/dist/types/components/ez-grid/controller/ag-grid/GridEditionManager.d.ts +7 -19
  106. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.d.ts +1 -3
  107. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellRender.d.ts +1 -1
  108. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.d.ts +1 -1
  109. package/dist/types/components/ez-grid/controller/ag-grid/components/cellRendererStatus.d.ts +1 -1
  110. package/dist/types/components/ez-grid/controller/ag-grid/components/selectionHeader.d.ts +1 -1
  111. package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellEditor.d.ts +1 -1
  112. package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellRender.d.ts +1 -1
  113. package/dist/types/components/ez-grid/controller/ag-grid/editor/IUICellEditor.d.ts +0 -1
  114. package/dist/types/components/ez-grid/controller/ag-grid/mock/Server.d.ts +1 -1
  115. package/dist/types/components/ez-grid/ez-grid.d.ts +1 -11
  116. package/dist/types/components/ez-list/ez-list.d.ts +26 -3
  117. package/dist/types/components/ez-number-input/ez-number-input.d.ts +0 -4
  118. package/dist/types/components/ez-search/ez-search.d.ts +1 -6
  119. package/dist/types/components/ez-text-area/ez-text-area.d.ts +0 -17
  120. package/dist/types/components/ez-text-input/ez-text-input.d.ts +0 -9
  121. package/dist/types/components/ez-time-input/ez-time-input.d.ts +0 -4
  122. package/dist/types/components.d.ts +42 -107
  123. package/dist/types/utils/form/DataBinder.d.ts +0 -3
  124. package/package.json +4 -11
  125. package/dist/cjs/DataBinder-3b083480.js +0 -445
  126. package/dist/cjs/FocusResolver-885f2173.js +0 -35
  127. package/dist/collection/utils/FocusResolver.js +0 -31
  128. package/dist/esm/DataBinder-02fa9bb9.js +0 -441
  129. package/dist/esm/FocusResolver-1ccbf850.js +0 -33
  130. package/dist/ezui/p-0a75bb05.entry.js +0 -1
  131. package/dist/ezui/p-0db68715.entry.js +0 -1
  132. package/dist/ezui/p-19098a3f.entry.js +0 -1
  133. package/dist/ezui/p-1f830a2f.entry.js +0 -1
  134. package/dist/ezui/p-2aa8e4b2.entry.js +0 -1
  135. package/dist/ezui/p-3dd919b7.entry.js +0 -1
  136. package/dist/ezui/p-455e737c.js +0 -1
  137. package/dist/ezui/p-8d0f02c7.entry.js +0 -309
  138. package/dist/ezui/p-91266ddd.entry.js +0 -1
  139. package/dist/ezui/p-97af4b13.entry.js +0 -1
  140. package/dist/ezui/p-a5b91a77.entry.js +0 -1
  141. package/dist/ezui/p-a80b1287.entry.js +0 -1
  142. package/dist/ezui/p-b54e17d2.entry.js +0 -1
  143. package/dist/ezui/p-bfad39eb.entry.js +0 -1
  144. package/dist/ezui/p-c27b2e17.entry.js +0 -1
  145. package/dist/ezui/p-cd2e78f0.entry.js +0 -1
  146. package/dist/ezui/p-d0ca26fe.entry.js +0 -1
  147. package/dist/ezui/p-dc628ed3.js +0 -1
  148. package/dist/ezui/p-ffd246f5.entry.js +0 -1
  149. package/dist/types/utils/FocusResolver.d.ts +0 -5
@@ -38,13 +38,12 @@ const EzComboBox = class {
38
38
  this.suppressSearch = false;
39
39
  this.optionLoader = undefined;
40
40
  this.suppressEmptyOption = false;
41
- this.stopPropagateEnterKeyEvent = true;
41
+ this.stopPropagateEnterKeyEvent = false;
42
42
  this.canShowError = true;
43
43
  this.mode = "regular";
44
44
  this.hideErrorOnFocusOut = true;
45
45
  this.listOptionsPosition = undefined;
46
46
  this.isTextSearch = false;
47
- this.autoFocus = false;
48
47
  }
49
48
  observeErrorMessage() {
50
49
  var _a;
@@ -107,9 +106,9 @@ const EzComboBox = class {
107
106
  /**
108
107
  * Aplica o foco no campo.
109
108
  */
110
- async setFocus(options) {
109
+ async setFocus() {
111
110
  if (this._textInput) {
112
- this._textInput.setFocus(options);
111
+ this._textInput.setFocus();
113
112
  }
114
113
  }
115
114
  /**
@@ -269,15 +268,11 @@ const EzComboBox = class {
269
268
  : undefined, index.h("span", { class: "item__label " + (this.showOptionValue ? "item__label--bold" : ""), title: opt.label }, opt.label));
270
269
  }
271
270
  showOptions() {
272
- var _a, _b;
273
271
  if (!this.enabled)
274
272
  return;
275
273
  if (this.isOptionsVisible()) {
276
274
  return;
277
275
  }
278
- const valueString = (_b = (_a = this.value) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : this.value;
279
- const indexValue = this._visibleOptions.findIndex(option => option.value === valueString);
280
- this._preSelection = indexValue === -1 ? 0 : indexValue;
281
276
  if (!!this._resizeObserver)
282
277
  this._resizeObserver.observe(this._textInput);
283
278
  this._floatingID = core.FloatingManager.float(this._listWrapper, this._listContainer, { autoClose: true, isFixed: true, backClickListener: () => this.hideOptions() });
@@ -319,26 +314,11 @@ const EzComboBox = class {
319
314
  liElem.scrollIntoView({ behavior: "smooth", block: "nearest" });
320
315
  });
321
316
  }
322
- selectCurrentOption(focusOnInput = true) {
317
+ selectCurrentOption() {
323
318
  if (this._preSelection !== undefined) {
324
- this.selectOption(this._visibleOptions[this._preSelection], focusOnInput);
319
+ this.selectOption(this._visibleOptions[this._preSelection]);
325
320
  this._preSelection = undefined;
326
321
  }
327
- else {
328
- this.controlListWithOnlyOne(focusOnInput);
329
- }
330
- }
331
- controlListWithOnlyOne(focusOnInput = true) {
332
- var _a;
333
- const source = (_a = this._visibleOptions) === null || _a === void 0 ? void 0 : _a.filter((opt) => opt.label !== "" && opt.value != undefined);
334
- if ((source === null || source === void 0 ? void 0 : source.length) > 0) {
335
- let title = core.StringUtils.decodeHtmlEntities(source[0].label);
336
- const option = {
337
- value: source[0].value,
338
- label: title,
339
- };
340
- this.selectOption(option, focusOnInput);
341
- }
342
322
  }
343
323
  updateSource(source) {
344
324
  this._startLoading = false;
@@ -364,7 +344,7 @@ const EzComboBox = class {
364
344
  }
365
345
  }
366
346
  }
367
- selectOption(newOption, focusOnInput = true) {
347
+ selectOption(newOption) {
368
348
  var _a, _b;
369
349
  const currentValue = this.getSelectedOption(this.value);
370
350
  if ((((_a = currentValue === null || currentValue === void 0 ? void 0 : currentValue.value) === null || _a === void 0 ? void 0 : _a.toString()) !== ((_b = newOption === null || newOption === void 0 ? void 0 : newOption.value) === null || _b === void 0 ? void 0 : _b.toString()))
@@ -375,11 +355,6 @@ const EzComboBox = class {
375
355
  else {
376
356
  this.resetOptions();
377
357
  }
378
- if (focusOnInput) {
379
- setTimeout(() => {
380
- this.setFocus();
381
- }, 0);
382
- }
383
358
  }
384
359
  loadOptions(mode, argument = "") {
385
360
  this._criteria = argument;
@@ -463,11 +438,6 @@ const EzComboBox = class {
463
438
  }
464
439
  });
465
440
  });
466
- if (this.autoFocus) {
467
- requestAnimationFrame(() => {
468
- this.setFocus({ selectText: true });
469
- });
470
- }
471
441
  }
472
442
  //---------------------------------------------
473
443
  // Event handlers
@@ -522,24 +492,18 @@ const EzComboBox = class {
522
492
  }
523
493
  switch (event.key) {
524
494
  case "ArrowDown":
525
- event.stopPropagation();
526
- if (this.canShowListOptions())
527
- event.preventDefault();
528
495
  this.showOptions();
529
496
  this.nextOption();
497
+ event.stopPropagation();
530
498
  break;
531
499
  case "ArrowUp":
532
- event.stopPropagation();
533
- if (this.canShowListOptions())
534
- event.preventDefault();
535
500
  this.showOptions();
536
501
  this.previousOption();
502
+ event.stopPropagation();
537
503
  break;
538
504
  case "Enter":
539
505
  this.handleEventPropagation(event);
540
- if (this.isOptionsVisible()) {
541
- this.selectCurrentOption();
542
- }
506
+ this.selectCurrentOption();
543
507
  break;
544
508
  case "Escape":
545
509
  if (this.isOptionsVisible()) {
@@ -551,7 +515,7 @@ const EzComboBox = class {
551
515
  case "Tab":
552
516
  this._tabPressed = true;
553
517
  if (this.isOptionsVisible()) {
554
- this.selectCurrentOption(false);
518
+ this.selectCurrentOption();
555
519
  }
556
520
  this.resetOptions();
557
521
  break;
@@ -23,7 +23,6 @@ const EzDateInput = class {
23
23
  this.errorMessage = undefined;
24
24
  this.mode = "regular";
25
25
  this.canShowError = true;
26
- this.autoFocus = false;
27
26
  }
28
27
  observeLabel() {
29
28
  if (this._textInput) {
@@ -60,8 +59,8 @@ const EzDateInput = class {
60
59
  /**
61
60
  * Aplica o foco no campo.
62
61
  */
63
- async setFocus(options) {
64
- this._textInput.setFocus(options);
62
+ async setFocus() {
63
+ this._textInput.setFocus();
65
64
  }
66
65
  /**
67
66
  * Remove o foco do campo.
@@ -179,11 +178,6 @@ const EzDateInput = class {
179
178
  componentDidLoad() {
180
179
  CSSVarsUtils.CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
181
180
  this.setInputValue();
182
- if (this.autoFocus) {
183
- requestAnimationFrame(() => {
184
- this.setFocus({ selectText: true });
185
- });
186
- }
187
181
  }
188
182
  render() {
189
183
  core.ElementIDUtils.addIDInfoIfNotExists(this._elem, 'input');
@@ -24,7 +24,6 @@ const EzDateTimeInput = class {
24
24
  this.showSeconds = false;
25
25
  this.mode = "regular";
26
26
  this.canShowError = true;
27
- this.autoFocus = false;
28
27
  }
29
28
  observeLabel() {
30
29
  if (this._textInput) {
@@ -61,8 +60,8 @@ const EzDateTimeInput = class {
61
60
  /**
62
61
  * Aplica o foco no campo.
63
62
  */
64
- async setFocus(options) {
65
- this._textInput.setFocus(options);
63
+ async setFocus() {
64
+ this._textInput.setFocus();
66
65
  }
67
66
  /**
68
67
  * Remove o foco do campo.
@@ -229,11 +228,6 @@ const EzDateTimeInput = class {
229
228
  componentDidLoad() {
230
229
  CSSVarsUtils.CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
231
230
  this.setInputValue();
232
- if (this.autoFocus) {
233
- requestAnimationFrame(() => {
234
- this.setFocus({ selectText: true });
235
- });
236
- }
237
231
  }
238
232
  render() {
239
233
  core.ElementIDUtils.addIDInfoIfNotExists(this._elem, 'input');
@@ -5,9 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-a7b0c73d.js');
6
6
  const DialogType = require('./DialogType-2114c337.js');
7
7
  const core = require('@sankhyalabs/core');
8
- const FocusResolver = require('./FocusResolver-885f2173.js');
9
8
 
10
- const ezDialogCss = ":host{--dialog__container-padding:var(--space--sm, 24px);--dialog__btn__close--background-color:var(--title--primary, #2b3a54);--dialog__btn__no--padding-right:var(--space--large, 24px);--dialog__btn__close__image:url('data:image/svg+xml;utf8,<svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" xmlns=\"http://www.w3.org/2000/svg%22%3E<path d=\"M 7.0060773,5.995511 11.461972,1.5397722 c 0.132856,-0.1328413 0.207547,-0.3130253 0.207547,-0.5009046 0,-0.18786999 -0.07469,-0.3680541 -0.207547,-0.5009048 -0.132857,-0.13284126 -0.31302,-0.20748126 -0.500927,-0.20748126 -0.187812,0 -0.36807,0.07464 -0.500926,0.20748126 L 6.0042244,4.9937015 1.5482921,0.5379628 C 1.4154357,0.40512154 1.2352533,0.33048154 1.0473657,0.33048154 c -0.18787813,0 -0.36807,0.07464 -0.50092647,0.20748126 -0.13285646,0.1328507 -0.20749026,0.31303481 -0.20749026,0.5009048 0,0.1878793 0.0746338,0.3680633 0.20749026,0.5009046 L 5.0023715,5.995511 0.54643923,10.452213 c -0.0676086,0.06534 -0.12151598,0.14352 -0.15859681,0.229916 -0.0370714,0.08639 -0.0565645,0.1794 -0.0573369,0.27335 -7.724e-4,0.09404 0.0171873,0.187331 0.0528423,0.274293 0.0356455,0.08705 0.0882688,0.166087 0.15479148,0.23256 0.0665321,0.06648 0.14562277,0.11897 0.2326735,0.154567 0.0870507,0.0356 0.18031463,0.05344 0.2743433,0.05259 0.094029,-8.5e-4 0.1869528,-0.02049 0.2733331,-0.0576 0.08639,-0.0372 0.1645078,-0.09121 0.2298029,-0.158817 L 6.0042244,6.9973204 10.460119,11.453078 c 0.132856,0.132851 0.313114,0.207444 0.500926,0.207444 0.187907,0 0.36807,-0.07459 0.500927,-0.207444 0.132856,-0.13285 0.207547,-0.313006 0.207547,-0.500904 0,-0.187898 -0.07469,-0.368054 -0.207547,-0.500905 z\"/></svg>');--dialog__title--font-pattern:var(--font-pattern, \"Roboto\");--dialog__title--padding-left:var(--space--small, 6px);--dialog__title__container--padding-bottom:var(--space--medium, 12px);--dialog__title--weight--large:var(--text-weight--large, 600);--dialog__body--font-pattern:var(--font-pattern, \"Roboto\");--dialog__body--text-shadow:var(--text-shadow, \"0 0 0 #353535, 0 0 1px transparent\");--dialog__body--text-weight--medium:var(--text-weight--medium, 400);--dialog__body--padding-bottom:var(--space--medium, 12px);--dialog__body--font-size:var(--text--medium, 14px);--dialog__body--color:var(--text--primary, #626e82);--dialog__icon--color:var(--text--inverted, #fff);--dialog__critical--background-color:var(--color--alert-error-800, #BD0025);--dialog__warning--background-color:var(--color--alert-warning-500, #EFB103);--dialog__success--background-color:var(--color--alert-success-500, #00523c);--dialog-z-index:var(--elevation--100, 100);--dialog--warning__image:url('data: image/svg+xml;utf8,<svg width=\"15\" height=\"15\" viewBox=\"0 0 15 15\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M 7.5,0 0,13 h 15 z m 0,2.73684 5.1341,8.89476 H 2.36591 Z M 6.81818,5.47368 V 8.21053 H 8.18182 V 5.47368 Z m 0,4.10527 V 10.9474 H 8.18182 V 9.57895\"/></svg>');--dialog--critical__image:url('data: image/svg+xml;utf8,<svg width=\"13\" height=\"13\" viewBox=\"0 0 13 13\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M 7.6534493,6.4948538 12.762051,1.3864299 C 12.914368,1.2341297 13,1.027552 13,0.81215179 13,0.59676225 12.914369,0.39018443 12.762051,0.23787352 12.609733,0.08557341 12.40318,0 12.187747,0 11.972425,0 11.765762,0.08557341 11.613445,0.23787352 L 6.5048431,5.3462975 1.3961977,0.23787352 C 1.2438802,0.08557341 1.0373043,0 0.82189458,0 0.60649572,0 0.39990901,0.08557341 0.24759147,0.23787352 0.09527396,0.39018443 0.00970766,0.59676225 0.00970766,0.81215179 c 0,0.21540021 0.0855663,0.42197791 0.23788381,0.57427811 L 5.3562369,6.4948538 0.24759147,11.604381 c -0.0775121,0.07492 -0.13931586,0.164543 -0.18182835,0.263595 -0.04250169,0.09905 -0.064850182,0.205678 -0.0657357237,0.313391 -8.8554258e-4,0.107813 0.0197049337,0.214771 0.0605827337,0.314472 0.04086693,0.0998 0.10119858,0.190415 0.17746563,0.266625 0.0762779,0.07622 0.16695386,0.136398 0.26675594,0.177208 0.099802,0.04082 0.20672745,0.06127 0.31452961,0.06029 0.1078025,-9.53e-4 0.21433799,-0.0235 0.31337139,-0.06604 0.099045,-0.04265 0.1886052,-0.104571 0.263465,-0.182081 L 6.5048431,7.6434102 11.613445,12.751855 c 0.152317,0.152312 0.35898,0.237831 0.574302,0.237831 0.215433,0 0.421986,-0.08552 0.574304,-0.237831 C 12.914368,12.599545 13,12.393 13,12.177578 13,11.962157 12.91437,11.75561 12.762051,11.603299 Z\"/></svg>')}h2{margin-block-start:0;margin-block-end:0;margin-inline-start:0px;margin-inline-end:0px}.overlay{position:fixed;display:flex;top:0px;z-index:var(--dialog-z-index);left:0px;width:100%;box-sizing:border-box;height:100vh;background-color:rgba(var(--rgb-background--overlay), var(--opacity--soft));backdrop-filter:blur(var(--background-blur--medium))}.dialog{display:flex;width:80%;position:absolute;top:50%;left:50%;margin-right:-50%;box-sizing:border-box;transform:translate(-50%, -50%);box-shadow:0px 0px 16px rgba(0, 38, 111, 0.122)}@media screen and (min-width: 768px){.dialog{width:50%}}@media screen and (min-width: 992px){.dialog{width:33.33333%}}.dialog__container{width:100%;background:#FFFF;border-radius:0px 6px 6px 0px;box-sizing:border-box;padding:var(--dialog__container-padding)}.dialog__container--default{border-radius:6px 6px 6px 6px}.dialog__critical--indicator{box-sizing:border-box;width:12px;border-radius:6px 0px 0px 6px;background-color:var(--dialog__critical--background-color)}.dialog__warning--indicator{width:12px;border-radius:6px 0px 0px 6px;box-sizing:border-box;background-color:var(--dialog__warning--background-color)}.dialog__success--indicator{width:12px;border-radius:6px 0px 0px 6px;box-sizing:border-box;background-color:var(--dialog__success--background-color)}.message{font-size:var(--dialog__body--font-size);font-weight:var(--dialog__body--text-weight--medium);font-family:var(--dialog__body--font-pattern);text-shadow:var(--dialog__body--text-shadow);padding-bottom:var(--dialog__body--padding-bottom);color:var(--dialog__body--color);max-height:30vh;content-visibility:auto;margin-bottom:var(--space--medium);overflow-y:auto}.changeable__icon{background:var(--dialog__warning--background-color);--ez-icon--color:var(--dialog__icon--color);display:grid;place-items:center;width:26px;height:26px;border-radius:50%}.changeable__icon.critical{background:var(--dialog__critical--background-color)}.title{display:flex;font-family:var(--dialog__title--font-pattern);margin:0;font-weight:var(--dialog__title--weight--large);line-height:0;color:var(--title--primary)}.title__container{display:flex;padding-bottom:var(--dialog__title__container--padding-bottom)}.title__box{display:flex;width:100%;align-items:center;align-self:center}.title__label{padding-left:var(--dialog__title--padding-left)}.title__label--no-icon{padding-left:0}.title-icon--critical{background-color:var(--dialog__critical--background-color)}.title-icon--success{background-color:var(--dialog__success--background-color)}.title-icon--warn{background-color:var(--dialog__warning--background-color)}.btn-close{justify-content:flex-end;align-self:flex-start;align-items:flex-start;display:flex;outline:none;width:10%;border:none;background-color:unset;cursor:pointer}.btn-close::after{content:'';display:flex;background-color:var(--dialog__btn__close--background-color);width:12px;height:12px;-webkit-mask-image:var(--dialog__btn__close__image);mask-image:var(--dialog__btn__close__image)}.title-icon::after{content:'';display:flex;background-color:#FFFF;width:15px;height:15px;-webkit-mask-image:var(--dialog--warning__image);mask-image:var(--dialog--warning__image)}.button-yes-no__container{display:flex;box-sizing:border-box;align-self:center;align-items:center;justify-content:flex-end}.button__cancel{padding-right:var(--dialog__btn__no--padding-right)}.button__confirm{--ez-button--background-color:var(--color--primary);--ez-button--color:var(--color--inverted);--ez-button--hover--background-color:var(--color--primary-600);--ez-button--hover-color:var(--color--inverted)}.button__confirm--danger{--ez-button--background-color:var(--color--alert-error-800, #BD0025);--ez-button--color:var(--color--inverted);--ez-button--hover--background-color:var(--color-alert--error-900, #a10020);--ez-button--hover-color:var(--color--inverted)}.button__confirm--container{display:flex;justify-content:flex-end}.row{width:100%;display:flex;flex-wrap:wrap}.col{display:flex;flex-wrap:wrap;align-self:flex-start;box-sizing:border-box}.col--stretch{align-self:stretch}.col--undefined{width:unset}.col--nowrap{flex-wrap:nowrap}@media screen and (min-width: 320px){.col--sd-1{width:8.33333%}.col--sd-2{width:16.66667%}.col--sd-3{width:25%}.col--sd-4{width:33.33333%}.col--sd-5{width:41.66667%}.col--sd-6{width:50%}.col--sd-7{width:58.33333%}.col--sd-8{width:66.66667%}.col--sd-9{width:75%}.col--sd-10{width:83.33333%}.col--sd-11{width:91.66667%}.col--sd-12{width:100%}}@media screen and (min-width: 480px){.col--pn-1{width:8.33333%}.col--pn-2{width:16.66667%}.col--pn-3{width:25%}.col--pn-4{width:33.33333%}.col--pn-5{width:41.66667%}.col--pn-6{width:50%}.col--pn-7{width:58.33333%}.col--pn-8{width:66.66667%}.col--pn-9{width:75%}.col--pn-10{width:83.33333%}.col--pn-11{width:91.66667%}.col--pn-12{width:100%}}@media screen and (min-width: 768px){.col--tb-1{width:8.33333%}.col--tb-2{width:16.66667%}.col--tb-3{width:25%}.col--tb-4{width:33.33333%}.col--tb-5{width:41.66667%}.col--tb-6{width:50%}.col--tb-7{width:58.33333%}.col--tb-8{width:66.66667%}.col--tb-9{width:75%}.col--tb-10{width:83.33333%}.col--tb-11{width:91.66667%}.col--tb-12{width:100%}}@media screen and (min-width: 992px){.col--md-1{width:8.33333%}.col--md-2{width:16.66667%}.col--md-3{width:25%}.col--md-4{width:33.33333%}.col--md-5{width:41.66667%}.col--md-6{width:50%}.col--md-7{width:58.33333%}.col--md-8{width:66.66667%}.col--md-9{width:75%}.col--md-10{width:83.33333%}.col--md-11{width:91.66667%}.col--md-12{width:100%}}@media screen and (min-width: 1200px){.col--ld-1{width:8.33333%}.col--ld-2{width:16.66667%}.col--ld-3{width:25%}.col--ld-4{width:33.33333%}.col--ld-5{width:41.66667%}.col--ld-6{width:50%}.col--ld-7{width:58.33333%}.col--ld-8{width:66.66667%}.col--ld-9{width:75%}.col--ld-10{width:83.33333%}.col--ld-11{width:91.66667%}.col--ld-12{width:100%}}";
9
+ const ezDialogCss = ":host{--dialog__container-padding:var(--space--large, 24px);--dialog__btn__close--background-color:var(--title--primary, #2b3a54);--dialog__btn__no--padding-right:var(--space--large, 24px);--dialog__btn__close__image:url('data:image/svg+xml;utf8,<svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" xmlns=\"http://www.w3.org/2000/svg%22%3E<path d=\"M 7.0060773,5.995511 11.461972,1.5397722 c 0.132856,-0.1328413 0.207547,-0.3130253 0.207547,-0.5009046 0,-0.18786999 -0.07469,-0.3680541 -0.207547,-0.5009048 -0.132857,-0.13284126 -0.31302,-0.20748126 -0.500927,-0.20748126 -0.187812,0 -0.36807,0.07464 -0.500926,0.20748126 L 6.0042244,4.9937015 1.5482921,0.5379628 C 1.4154357,0.40512154 1.2352533,0.33048154 1.0473657,0.33048154 c -0.18787813,0 -0.36807,0.07464 -0.50092647,0.20748126 -0.13285646,0.1328507 -0.20749026,0.31303481 -0.20749026,0.5009048 0,0.1878793 0.0746338,0.3680633 0.20749026,0.5009046 L 5.0023715,5.995511 0.54643923,10.452213 c -0.0676086,0.06534 -0.12151598,0.14352 -0.15859681,0.229916 -0.0370714,0.08639 -0.0565645,0.1794 -0.0573369,0.27335 -7.724e-4,0.09404 0.0171873,0.187331 0.0528423,0.274293 0.0356455,0.08705 0.0882688,0.166087 0.15479148,0.23256 0.0665321,0.06648 0.14562277,0.11897 0.2326735,0.154567 0.0870507,0.0356 0.18031463,0.05344 0.2743433,0.05259 0.094029,-8.5e-4 0.1869528,-0.02049 0.2733331,-0.0576 0.08639,-0.0372 0.1645078,-0.09121 0.2298029,-0.158817 L 6.0042244,6.9973204 10.460119,11.453078 c 0.132856,0.132851 0.313114,0.207444 0.500926,0.207444 0.187907,0 0.36807,-0.07459 0.500927,-0.207444 0.132856,-0.13285 0.207547,-0.313006 0.207547,-0.500904 0,-0.187898 -0.07469,-0.368054 -0.207547,-0.500905 z\"/></svg>');--dialog__title--font-pattern:var(--font-pattern, \"Roboto\");--dialog__title--padding-left:var(--space--small, 6px);--dialog__title__container--padding-bottom:var(--space--medium, 12px);--dialog__title--weight--large:var(--text-weight--large, 600);--dialog__body--font-pattern:var(--font-pattern, \"Roboto\");--dialog__body--text-shadow:var(--text-shadow, \"0 0 0 #353535, 0 0 1px transparent\");--dialog__body--text-weight--medium:var(--text-weight--medium, 400);--dialog__body--padding-bottom:var(--space--large, 24px);--dialog__body--font-size:var(--text--medium, 14px);--dialog__body--color:var(--text--primary, #626e82);--dialog__icon--color:var(--text--inverted, #fff);--dialog__critical--background-color:var(--color--alert-error-800, #BD0025);--dialog__warning--background-color:var(--color--alert-warning-500, #EFB103);--dialog__success--background-color:var(--color--alert-success-500, #00523c);--dialog-z-index:var(--elevation--100, 100);--dialog--warning__image:url('data: image/svg+xml;utf8,<svg width=\"15\" height=\"15\" viewBox=\"0 0 15 15\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M 7.5,0 0,13 h 15 z m 0,2.73684 5.1341,8.89476 H 2.36591 Z M 6.81818,5.47368 V 8.21053 H 8.18182 V 5.47368 Z m 0,4.10527 V 10.9474 H 8.18182 V 9.57895\"/></svg>');--dialog--critical__image:url('data: image/svg+xml;utf8,<svg width=\"13\" height=\"13\" viewBox=\"0 0 13 13\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M 7.6534493,6.4948538 12.762051,1.3864299 C 12.914368,1.2341297 13,1.027552 13,0.81215179 13,0.59676225 12.914369,0.39018443 12.762051,0.23787352 12.609733,0.08557341 12.40318,0 12.187747,0 11.972425,0 11.765762,0.08557341 11.613445,0.23787352 L 6.5048431,5.3462975 1.3961977,0.23787352 C 1.2438802,0.08557341 1.0373043,0 0.82189458,0 0.60649572,0 0.39990901,0.08557341 0.24759147,0.23787352 0.09527396,0.39018443 0.00970766,0.59676225 0.00970766,0.81215179 c 0,0.21540021 0.0855663,0.42197791 0.23788381,0.57427811 L 5.3562369,6.4948538 0.24759147,11.604381 c -0.0775121,0.07492 -0.13931586,0.164543 -0.18182835,0.263595 -0.04250169,0.09905 -0.064850182,0.205678 -0.0657357237,0.313391 -8.8554258e-4,0.107813 0.0197049337,0.214771 0.0605827337,0.314472 0.04086693,0.0998 0.10119858,0.190415 0.17746563,0.266625 0.0762779,0.07622 0.16695386,0.136398 0.26675594,0.177208 0.099802,0.04082 0.20672745,0.06127 0.31452961,0.06029 0.1078025,-9.53e-4 0.21433799,-0.0235 0.31337139,-0.06604 0.099045,-0.04265 0.1886052,-0.104571 0.263465,-0.182081 L 6.5048431,7.6434102 11.613445,12.751855 c 0.152317,0.152312 0.35898,0.237831 0.574302,0.237831 0.215433,0 0.421986,-0.08552 0.574304,-0.237831 C 12.914368,12.599545 13,12.393 13,12.177578 13,11.962157 12.91437,11.75561 12.762051,11.603299 Z\"/></svg>')}h2{margin-block-start:0;margin-block-end:0;margin-inline-start:0px;margin-inline-end:0px}.overlay{position:fixed;display:flex;top:0px;z-index:var(--dialog-z-index);left:0px;width:100%;box-sizing:border-box;height:100vh;background-color:rgba(var(--rgb-background--overlay), var(--opacity--soft));backdrop-filter:blur(var(--background-blur--medium))}.dialog{display:flex;width:80%;position:absolute;top:50%;left:50%;margin-right:-50%;box-sizing:border-box;transform:translate(-50%, -50%);box-shadow:0px 0px 16px rgba(0, 38, 111, 0.122)}@media screen and (min-width: 768px){.dialog{width:50%}}@media screen and (min-width: 992px){.dialog{width:33.33333%}}.dialog__container{width:100%;background:#FFFF;border-radius:0px 6px 6px 0px;box-sizing:border-box;padding:var(--dialog__container-padding)}.dialog__container--default{border-radius:6px 6px 6px 6px}.dialog__critical--indicator{box-sizing:border-box;width:12px;border-radius:6px 0px 0px 6px;background-color:var(--dialog__critical--background-color)}.dialog__warning--indicator{width:12px;border-radius:6px 0px 0px 6px;box-sizing:border-box;background-color:var(--dialog__warning--background-color)}.dialog__success--indicator{width:12px;border-radius:6px 0px 0px 6px;box-sizing:border-box;background-color:var(--dialog__success--background-color)}.message{font-size:var(--dialog__body--font-size);font-weight:var(--dialog__body--text-weight--medium);font-family:var(--dialog__body--font-pattern);text-shadow:var(--dialog__body--text-shadow);padding-bottom:var(--dialog__body--padding-bottom);color:var(--dialog__body--color);max-height:30vh;content-visibility:auto;margin-bottom:24px;overflow-y:auto}.changeable__icon{background:var(--dialog__warning--background-color);--ez-icon--color:var(--dialog__icon--color);display:grid;place-items:center;width:26px;height:26px;border-radius:50%}.changeable__icon.critical{background:var(--dialog__critical--background-color)}.title{display:flex;font-family:var(--dialog__title--font-pattern);margin:0;font-weight:var(--dialog__title--weight--large);line-height:0;color:var(--title--primary)}.title__container{display:flex;padding-bottom:var(--dialog__title__container--padding-bottom)}.title__box{display:flex;width:100%;align-items:center;align-self:center}.title__label{padding-left:var(--dialog__title--padding-left)}.title__label--no-icon{padding-left:0}.title-icon--critical{background-color:var(--dialog__critical--background-color)}.title-icon--success{background-color:var(--dialog__success--background-color)}.title-icon--warn{background-color:var(--dialog__warning--background-color)}.btn-close{justify-content:flex-end;align-self:flex-start;align-items:flex-start;display:flex;outline:none;width:10%;border:none;background-color:unset;cursor:pointer}.btn-close::after{content:'';display:flex;background-color:var(--dialog__btn__close--background-color);width:12px;height:12px;-webkit-mask-image:var(--dialog__btn__close__image);mask-image:var(--dialog__btn__close__image)}.title-icon::after{content:'';display:flex;background-color:#FFFF;width:15px;height:15px;-webkit-mask-image:var(--dialog--warning__image);mask-image:var(--dialog--warning__image)}.button-yes-no__container{display:flex;box-sizing:border-box;align-self:center;align-items:center;justify-content:flex-end}.button__cancel{padding-right:var(--dialog__btn__no--padding-right)}.button__confirm{--ez-button--background-color:var(--color--primary);--ez-button--color:var(--color--inverted);--ez-button--hover--background-color:var(--color--primary-600);--ez-button--hover-color:var(--color--inverted)}.button__confirm--danger{--ez-button--background-color:var(--color--alert-error-800, #BD0025);--ez-button--color:var(--color--inverted);--ez-button--hover--background-color:var(--color-alert--error-900, #a10020);--ez-button--hover-color:var(--color--inverted)}.button__confirm--container{display:flex;justify-content:flex-end}.row{width:100%;display:flex;flex-wrap:wrap}.col{display:flex;flex-wrap:wrap;align-self:flex-start;box-sizing:border-box}.col--stretch{align-self:stretch}.col--undefined{width:unset}.col--nowrap{flex-wrap:nowrap}@media screen and (min-width: 320px){.col--sd-1{width:8.33333%}.col--sd-2{width:16.66667%}.col--sd-3{width:25%}.col--sd-4{width:33.33333%}.col--sd-5{width:41.66667%}.col--sd-6{width:50%}.col--sd-7{width:58.33333%}.col--sd-8{width:66.66667%}.col--sd-9{width:75%}.col--sd-10{width:83.33333%}.col--sd-11{width:91.66667%}.col--sd-12{width:100%}}@media screen and (min-width: 480px){.col--pn-1{width:8.33333%}.col--pn-2{width:16.66667%}.col--pn-3{width:25%}.col--pn-4{width:33.33333%}.col--pn-5{width:41.66667%}.col--pn-6{width:50%}.col--pn-7{width:58.33333%}.col--pn-8{width:66.66667%}.col--pn-9{width:75%}.col--pn-10{width:83.33333%}.col--pn-11{width:91.66667%}.col--pn-12{width:100%}}@media screen and (min-width: 768px){.col--tb-1{width:8.33333%}.col--tb-2{width:16.66667%}.col--tb-3{width:25%}.col--tb-4{width:33.33333%}.col--tb-5{width:41.66667%}.col--tb-6{width:50%}.col--tb-7{width:58.33333%}.col--tb-8{width:66.66667%}.col--tb-9{width:75%}.col--tb-10{width:83.33333%}.col--tb-11{width:91.66667%}.col--tb-12{width:100%}}@media screen and (min-width: 992px){.col--md-1{width:8.33333%}.col--md-2{width:16.66667%}.col--md-3{width:25%}.col--md-4{width:33.33333%}.col--md-5{width:41.66667%}.col--md-6{width:50%}.col--md-7{width:58.33333%}.col--md-8{width:66.66667%}.col--md-9{width:75%}.col--md-10{width:83.33333%}.col--md-11{width:91.66667%}.col--md-12{width:100%}}@media screen and (min-width: 1200px){.col--ld-1{width:8.33333%}.col--ld-2{width:16.66667%}.col--ld-3{width:25%}.col--ld-4{width:33.33333%}.col--ld-5{width:41.66667%}.col--ld-6{width:50%}.col--ld-7{width:58.33333%}.col--ld-8{width:66.66667%}.col--ld-9{width:75%}.col--ld-10{width:83.33333%}.col--ld-11{width:91.66667%}.col--ld-12{width:100%}}";
11
10
 
12
11
  class Message {
13
12
  constructor(title, message, dialogType, confirm, icon, labelCancel, labelConfirm, btnConfirmDanger, callBack, beforeClose) {
@@ -175,7 +174,6 @@ const EzDialog = class {
175
174
  const dialog = this._element.shadowRoot.querySelector('.overlay .dialog');
176
175
  if (dialog instanceof HTMLDivElement) {
177
176
  dialog.style.outline = 'none';
178
- this._lastActiveElement = document.activeElement;
179
177
  dialog.focus();
180
178
  }
181
179
  }
@@ -188,13 +186,7 @@ const EzDialog = class {
188
186
  focusOnPrimaryButton() {
189
187
  const btnConfirm = this._element.shadowRoot.querySelector(`#${this.PRIMARY_BUTTON_ID}`);
190
188
  const buttonElement = btnConfirm === null || btnConfirm === void 0 ? void 0 : btnConfirm.shadowRoot.querySelector('button');
191
- requestAnimationFrame(() => {
192
- buttonElement === null || buttonElement === void 0 ? void 0 : buttonElement.focus();
193
- });
194
- }
195
- disconnectedCallback() {
196
- FocusResolver.FocusResolver.resolveFocus(this._lastActiveElement);
197
- this._lastActiveElement = undefined;
189
+ buttonElement === null || buttonElement === void 0 ? void 0 : buttonElement.focus();
198
190
  }
199
191
  render() {
200
192
  if (this.opened && this._currentMessage) {
@@ -83,9 +83,9 @@ const buildTextArea = ({ name, label, readOnly, contextName, rows, canShowError
83
83
  index.h("ez-text-area", { enabled: !readOnly, label: label, "data-field-name": name, "data-context-name": contextName, rows: rows, canShowError: canShowError })));
84
84
  };
85
85
 
86
- const buildTextInput = ({ name, label, readOnly, contextName, canShowError, props }) => {
86
+ const buildTextInput = ({ name, label, readOnly, contextName, canShowError }) => {
87
87
  return (index.h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" },
88
- index.h("ez-text-input", { label: label, "data-field-name": name, "data-context-name": contextName, key: name, enabled: !readOnly, canShowError: canShowError, mask: props === null || props === void 0 ? void 0 : props.mask, "clean-value-mask": props === null || props === void 0 ? void 0 : props.cleanValueMask })));
88
+ index.h("ez-text-input", { label: label, "data-field-name": name, "data-context-name": contextName, key: name, enabled: !readOnly, canShowError: canShowError })));
89
89
  };
90
90
 
91
91
  const uiBuilders = new Map();
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-a7b0c73d.js');
6
6
  const core = require('@sankhyalabs/core');
7
- const DataBinder = require('./DataBinder-3b083480.js');
7
+ const RecordValidationProcessor = require('./RecordValidationProcessor-10846595.js');
8
8
  require('./ApplicationUtils-c9d1205c.js');
9
9
  require('./DialogType-2114c337.js');
10
10
 
@@ -109,7 +109,7 @@ const buildFormMetadata = (config, dataUnit, includeDetails = false) => {
109
109
  if (!sheets.has(tabConfig)) {
110
110
  sheets.set(tabConfig, []);
111
111
  }
112
- const formField = DataBinder.buildFieldMetadata(descriptor, field);
112
+ const formField = RecordValidationProcessor.buildFieldMetadata(descriptor, field);
113
113
  sheets.get(tabConfig).push(formField);
114
114
  if (formField.required) {
115
115
  requiredFields.push(field.name);
@@ -183,6 +183,327 @@ const buildDetailSheet = (child) => {
183
183
  };
184
184
  };
185
185
 
186
+ class DataBinder {
187
+ constructor(dataUnit) {
188
+ this.onDataUnitEvent = (action) => {
189
+ var _a, _b;
190
+ switch (action.type) {
191
+ case core.Action.DATA_LOADED:
192
+ case core.Action.DATA_SAVED:
193
+ case core.Action.RECORDS_REMOVED:
194
+ case core.Action.RECORDS_ADDED:
195
+ case core.Action.RECORDS_COPIED:
196
+ case core.Action.EDITION_CANCELED:
197
+ case core.Action.SELECTION_CHANGED:
198
+ case core.Action.NEXT_SELECTED:
199
+ case core.Action.PREVIOUS_SELECTED:
200
+ this.clearInvalid();
201
+ case core.Action.DATA_CHANGED:
202
+ case core.Action.CHANGE_UNDONE:
203
+ case core.Action.CHANGE_REDONE:
204
+ case core.Action.RECORD_LOADED:
205
+ (_a = this._fields) === null || _a === void 0 ? void 0 : _a.forEach(field => {
206
+ this.updateValue(field.fieldName, field.field);
207
+ });
208
+ break;
209
+ case core.Action.FIELD_INVALIDATED:
210
+ (_b = this._fields) === null || _b === void 0 ? void 0 : _b.forEach(field => {
211
+ this.updateErrorMessage(field.fieldName, field.field);
212
+ });
213
+ break;
214
+ }
215
+ };
216
+ this._uuid = core.StringUtils.generateUUID();
217
+ this._fields = new Map();
218
+ this._dataUnit = dataUnit;
219
+ this.applyDefaultValues();
220
+ this._dataUnit.subscribe(this.onDataUnitEvent);
221
+ this._dataUnit.addInterceptor(this);
222
+ this.setContextDataBinder(dataUnit);
223
+ }
224
+ get dataBinderId() {
225
+ return this._uuid;
226
+ }
227
+ setContextDataBinder(dataUnit) {
228
+ const dataBindersByDataUnit = core.ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__") || new Map();
229
+ const dataBinders = [...(dataBindersByDataUnit.get(dataUnit.dataUnitId) || []), this];
230
+ dataBindersByDataUnit.set(dataUnit.dataUnitId, dataBinders);
231
+ core.ApplicationContext.setContextValue("__DATABINDER_BY_DATAUNIT__", dataBindersByDataUnit);
232
+ }
233
+ applyDefaultValues() {
234
+ const recordIds = (this._dataUnit.getAddedRecords() || []).map(r => r.__record__id__);
235
+ if (recordIds.length > 0) {
236
+ const defaultValues = this.getDefaultValues();
237
+ if (defaultValues) {
238
+ Object.keys(defaultValues).forEach(field => {
239
+ this._dataUnit.setFieldValue(field, defaultValues[field], recordIds);
240
+ });
241
+ }
242
+ }
243
+ }
244
+ bind(fields, currentContextName, formMetadata, recordsValidator) {
245
+ fields.forEach(fieldElement => {
246
+ const { fieldName, contextName } = fieldElement.dataset;
247
+ if (contextName == undefined || contextName === currentContextName) {
248
+ this.updateBind(fieldName, fieldElement);
249
+ }
250
+ });
251
+ this._formMetadata = formMetadata;
252
+ this._recordValidatorProcessor = new RecordValidationProcessor.RecordValidationProcessor(this._dataUnit, {
253
+ getRequiredFields: () => this._formMetadata.getRequiredFields(),
254
+ markAsInvalid: field => this.markInvalid(field),
255
+ getMessageForField: field => this.getErrorMessage(field),
256
+ }, recordsValidator);
257
+ }
258
+ disconnectDataUnit() {
259
+ const dataBindersByDataUnit = core.ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__") || new Map();
260
+ const dataBinders = dataBindersByDataUnit.get(this._dataUnit.dataUnitId);
261
+ const dataBindersFiltered = dataBinders.filter((dataBinder) => dataBinder.dataBinderId !== this.dataBinderId);
262
+ dataBindersByDataUnit.set(this._dataUnit.dataUnitId, dataBindersFiltered);
263
+ core.ApplicationContext.setContextValue("__DATABINDER_BY_DATAUNIT__", dataBindersByDataUnit);
264
+ }
265
+ onDisconnectedCallback() {
266
+ this._dataUnit.unsubscribe(this.onDataUnitEvent);
267
+ this._dataUnit.removeInterceptor(this);
268
+ this.disconnectDataUnit();
269
+ }
270
+ getCurrentRecordId() {
271
+ const record = this._dataUnit.getSelectedRecord();
272
+ return record === null || record === void 0 ? void 0 : record.__record__id__;
273
+ }
274
+ markInvalid(field) {
275
+ if (this._fields.has(field.name)) {
276
+ const fieldElement = this._fields.get(field.name).field;
277
+ this.updateErrorMessage(field.name, fieldElement, field.message);
278
+ }
279
+ }
280
+ setFocus(fieldName) {
281
+ if (!this._fields.has(fieldName)) {
282
+ return;
283
+ }
284
+ const fieldElement = this._fields.get(fieldName).field;
285
+ if (typeof fieldElement["setFocus"] != "function") {
286
+ return;
287
+ }
288
+ fieldElement["setFocus"]();
289
+ }
290
+ clearInvalid(recordId) {
291
+ this._dataUnit.clearInvalid(recordId);
292
+ this._fields.forEach(fieldBinder => {
293
+ const fieldElement = fieldBinder.field;
294
+ fieldElement["errorMessage"] = "";
295
+ });
296
+ }
297
+ updateValue(fieldName, field) {
298
+ const bind = this._fields.get(fieldName);
299
+ try {
300
+ if (bind) {
301
+ bind.listen = false;
302
+ }
303
+ field["value"] = this._dataUnit.getFieldValue(fieldName);
304
+ this.updateErrorMessage(fieldName, field);
305
+ }
306
+ finally {
307
+ if (bind) {
308
+ bind.listen = true;
309
+ }
310
+ }
311
+ }
312
+ validate() {
313
+ return this._recordValidatorProcessor.validate();
314
+ }
315
+ static async validateByDataunit(dataUnit) {
316
+ try {
317
+ const dataBindersByDataUnit = core.ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__");
318
+ const dataBinders = dataBindersByDataUnit.get(dataUnit.dataUnitId) || [];
319
+ await Promise.all(dataBinders.map((dataBinder) => dataBinder.validate()));
320
+ return true;
321
+ }
322
+ catch (_a) {
323
+ return false;
324
+ }
325
+ }
326
+ updateErrorMessage(fieldName, field, message) {
327
+ if (message == undefined) {
328
+ message = this._dataUnit.getInvalidMessage(this.getCurrentRecordId(), fieldName);
329
+ }
330
+ if (!field["errorMessage"]) {
331
+ field["errorMessage"] = message;
332
+ }
333
+ }
334
+ getErrorMessage(fieldName) {
335
+ if (this._fields.has(fieldName)) {
336
+ const fieldElement = this._fields.get(fieldName).field;
337
+ return fieldElement["errorMessage"];
338
+ }
339
+ return undefined;
340
+ }
341
+ updateBind(fieldName, field) {
342
+ const oldBind = this._fields.get(fieldName);
343
+ if (oldBind) {
344
+ oldBind.destroy();
345
+ }
346
+ this.bindSearchOptionsLoader(fieldName, field);
347
+ field["value"] = this._dataUnit.getFieldValue(fieldName);
348
+ this.updateErrorMessage(fieldName, field);
349
+ this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, waitingChange) => this.changeStarted(fieldName, waitingChange), (fieldName) => this.cancelWaitingChange(fieldName), (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
350
+ this.applyEzUploadContext(fieldName, field);
351
+ }
352
+ changeStarted(fieldName, waitingChange) {
353
+ /**
354
+ * se o waitingChange não é blocante, add um event listener pra
355
+ * fazer o accept da promise
356
+ *
357
+ * se não tiver promise no waitingChange, eu crio uma e resolvo no bind
358
+ *
359
+ *
360
+ */
361
+ if (this._dataUnit.records.length === 0) {
362
+ this._dataUnit.addRecord();
363
+ }
364
+ if (!waitingChange.blocking && waitingChange.promise == undefined) {
365
+ const bind = this._fields.get(fieldName);
366
+ if (bind) {
367
+ waitingChange.promise = new Promise((resolve, reject) => {
368
+ bind.waitingChangePromiseResolve = resolve;
369
+ bind.waitingChangePromiseReject = reject;
370
+ });
371
+ }
372
+ }
373
+ this._dataUnit.startChange(fieldName, waitingChange);
374
+ }
375
+ cancelWaitingChange(fieldName) {
376
+ if (this._dataUnit.waitingForChange(fieldName)) {
377
+ this._dataUnit.cancelWaitingChange(fieldName);
378
+ const bind = this._fields.get(fieldName);
379
+ if (bind) {
380
+ bind.rejectWaitingChange(new core.WaitingChangeException("Change canceled", fieldName));
381
+ }
382
+ }
383
+ }
384
+ setFieldValue(fieldName, newValue) {
385
+ if (this._dataUnit.records.length === 0) {
386
+ this._dataUnit.addRecord();
387
+ }
388
+ this._dataUnit.clearInvalid(this.getCurrentRecordId(), fieldName);
389
+ const record = this._dataUnit.getSelectedRecord();
390
+ this._dataUnit.setFieldValue(fieldName, newValue, record ? [record.__record__id__] : undefined);
391
+ if (this._dataUnit.waitingForChange(fieldName)) {
392
+ const bind = this._fields.get(fieldName);
393
+ if (bind) {
394
+ bind.acceptWaitingChange();
395
+ }
396
+ }
397
+ }
398
+ bindSearchOptionsLoader(fieldName, field) {
399
+ if (field.nodeName === "EZ-SEARCH" && field["optionLoader"] == undefined) {
400
+ const loader = core.ApplicationContext.getContextValue("__EZUI__SEARCH__OPTION__LOADER__");
401
+ if (loader) {
402
+ field["optionLoader"] = (arg) => {
403
+ return loader(arg, fieldName, this._dataUnit);
404
+ };
405
+ }
406
+ }
407
+ }
408
+ applyEzUploadContext(fieldName, field) {
409
+ var _a, _b;
410
+ if (field.nodeName === "EZ-UPLOAD") {
411
+ field["urlUpload"] = core.ApplicationContext.getContextValue("__EZUI__UPLOAD__ADD__URL__");
412
+ field["urlDelete"] = core.ApplicationContext.getContextValue("__EZUI__UPLOAD__DEL__URL__");
413
+ const descriptor = this._dataUnit.getField(fieldName);
414
+ const destination = (_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.DESTINATION;
415
+ if (destination) {
416
+ field["requestHeaders"] = { XTRAINF: `{"destination": "${destination}"}` };
417
+ }
418
+ field["maxFiles"] = ((_b = descriptor.properties) === null || _b === void 0 ? void 0 : _b.MAX_FILES) || 0;
419
+ }
420
+ }
421
+ interceptAction(action) {
422
+ if (action.type === core.Action.RECORDS_COPIED) {
423
+ const cleanFields = this._formMetadata.getCleanOnCopyFields();
424
+ if (cleanFields) {
425
+ const records = action.payload;
426
+ return new core.DataUnitAction(core.Action.RECORDS_COPIED, records.map(record => {
427
+ const newRecord = Object.assign({}, record);
428
+ cleanFields.forEach(fieldName => delete newRecord[fieldName]);
429
+ return newRecord;
430
+ }));
431
+ }
432
+ }
433
+ if (action.type === core.Action.SAVING_DATA) {
434
+ return new Promise((resolve) => {
435
+ this.validate()
436
+ .then(() => resolve(action))
437
+ .catch(() => { });
438
+ });
439
+ }
440
+ if (action.type === core.Action.RECORDS_ADDED) {
441
+ const defaultValues = this.getDefaultValues();
442
+ if (defaultValues) {
443
+ const records = action.payload;
444
+ return new core.DataUnitAction(core.Action.RECORDS_ADDED, records.map(record => {
445
+ return Object.assign(Object.assign({}, record), defaultValues);
446
+ }));
447
+ }
448
+ }
449
+ return action;
450
+ }
451
+ getDefaultValues() {
452
+ var _a;
453
+ const rawDefaultValues = (_a = this._formMetadata) === null || _a === void 0 ? void 0 : _a.getDefaultValues();
454
+ if (rawDefaultValues) {
455
+ const defaultValues = {};
456
+ for (const field in rawDefaultValues) {
457
+ defaultValues[field] = this._dataUnit.valueFromString(field, rawDefaultValues[field]);
458
+ }
459
+ return defaultValues;
460
+ }
461
+ return undefined;
462
+ }
463
+ }
464
+ class Bind {
465
+ constructor() {
466
+ this.listen = true;
467
+ this.startChangeEventName = "ezStartChange";
468
+ this.cancelWaitingChangeEventName = "ezCancelWaitingChange";
469
+ this.changeEventName = "ezChange";
470
+ }
471
+ destroy() {
472
+ this.field.removeEventListener(this.startChangeEventName, this.startChangeListener);
473
+ this.field.removeEventListener(this.cancelWaitingChangeEventName, this.cancelWaitingChangeListener);
474
+ this.field.removeEventListener(this.changeEventName, this.changeListener);
475
+ }
476
+ acceptWaitingChange() {
477
+ if (this.waitingChangePromiseResolve) {
478
+ this.waitingChangePromiseResolve();
479
+ this.waitingChangePromiseReject = undefined;
480
+ this.waitingChangePromiseResolve = undefined;
481
+ }
482
+ }
483
+ rejectWaitingChange(reason) {
484
+ if (this.waitingChangePromiseReject) {
485
+ this.waitingChangePromiseReject(reason);
486
+ this.waitingChangePromiseReject = undefined;
487
+ this.waitingChangePromiseResolve = undefined;
488
+ }
489
+ }
490
+ static create(fieldName, field, startChangeCallback, cancelWaitingChangeCallback, changeCallback) {
491
+ const b = new Bind();
492
+ b.field = field;
493
+ b.fieldName = fieldName;
494
+ b.startChangeListener = (evt) => { if (b.listen)
495
+ startChangeCallback(fieldName, evt.detail); };
496
+ b.field.addEventListener(b.startChangeEventName, b.startChangeListener);
497
+ b.cancelWaitingChangeListener = () => { if (b.listen)
498
+ cancelWaitingChangeCallback(fieldName); };
499
+ b.field.addEventListener(b.cancelWaitingChangeEventName, b.cancelWaitingChangeListener);
500
+ b.changeListener = (evt) => { if (b.listen)
501
+ changeCallback(fieldName, evt.detail); };
502
+ b.field.addEventListener(b.changeEventName, b.changeListener);
503
+ return b;
504
+ }
505
+ }
506
+
186
507
  /**
187
508
  * Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js
188
509
  *
@@ -646,9 +967,8 @@ const EzForm = class {
646
967
  if (this.dataUnit === undefined) {
647
968
  this.dataUnit = new core.DataUnit("ez-form");
648
969
  }
649
- this.dataUnit.unsubscribe(this.onDataUnitAction);
650
970
  this.dataUnit.subscribe(this.onDataUnitAction);
651
- this._dataBinder = new DataBinder.DataBinder(this.dataUnit);
971
+ this._dataBinder = new DataBinder(this.dataUnit);
652
972
  this._store = createStore(formReducer);
653
973
  this._store.subscribe(() => index.forceUpdate(this));
654
974
  this._staticFields = Array.from(this._element.querySelectorAll("[data-field-name]"));