@sankhyalabs/ezui 0.0.0-bugfix-dev-59880.4 → 0.0.0-bugfix-dev-KB-59889.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 (47) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/ez-form-view.cjs.entry.js +3 -4
  3. package/dist/cjs/ez-form.cjs.entry.js +26 -0
  4. package/dist/cjs/ez-grid.cjs.entry.js +27 -4
  5. package/dist/cjs/ez-number-input.cjs.entry.js +12 -9
  6. package/dist/cjs/ez-tabselector.cjs.entry.js +34 -29
  7. package/dist/cjs/ezui.cjs.js +1 -1
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/collection/components/ez-form-view/ez-form-view.js +1 -1
  10. package/dist/collection/components/ez-form-view/fieldbuilder/templates/NumberInput.tpl.js +2 -3
  11. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +17 -0
  12. package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +1 -0
  13. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/NumberInput.tpl.js +2 -3
  14. package/dist/collection/components/ez-grid/ez-grid.css +1 -0
  15. package/dist/collection/components/ez-grid/ez-grid.js +22 -0
  16. package/dist/collection/components/ez-number-input/ez-number-input.js +12 -14
  17. package/dist/collection/components/ez-tabselector/ez-tabselector.js +34 -29
  18. package/dist/collection/utils/form/DataBinder.js +26 -0
  19. package/dist/collection/utils/form/test/DataBinder.test.js +41 -4
  20. package/dist/collection/utils/form/test/resources/metadataTest.js +15 -0
  21. package/dist/custom-elements/index.js +104 -48
  22. package/dist/esm/ez-form-view.entry.js +3 -4
  23. package/dist/esm/ez-form.entry.js +27 -1
  24. package/dist/esm/ez-grid.entry.js +27 -4
  25. package/dist/esm/ez-number-input.entry.js +12 -9
  26. package/dist/esm/ez-tabselector.entry.js +34 -29
  27. package/dist/esm/ezui.js +1 -1
  28. package/dist/esm/loader.js +1 -1
  29. package/dist/ezui/ezui.esm.js +1 -1
  30. package/dist/ezui/p-13727aec.entry.js +1 -0
  31. package/dist/ezui/p-1ee2479b.entry.js +1 -0
  32. package/dist/ezui/p-2dcb50d4.entry.js +1 -0
  33. package/dist/ezui/{p-34190f80.entry.js → p-362c3c80.entry.js} +1 -1
  34. package/dist/ezui/p-99f46950.entry.js +1 -0
  35. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +1 -0
  36. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +3 -0
  37. package/dist/types/components/ez-grid/ez-grid.d.ts +4 -0
  38. package/dist/types/components/ez-number-input/ez-number-input.d.ts +0 -1
  39. package/dist/types/components/ez-tabselector/ez-tabselector.d.ts +3 -2
  40. package/dist/types/components.d.ts +4 -0
  41. package/dist/types/utils/form/DataBinder.d.ts +3 -0
  42. package/dist/types/utils/form/test/resources/metadataTest.d.ts +2 -0
  43. package/package.json +1 -1
  44. package/dist/ezui/p-3b9e5664.entry.js +0 -1
  45. package/dist/ezui/p-3d688432.entry.js +0 -1
  46. package/dist/ezui/p-77362d3a.entry.js +0 -1
  47. package/dist/ezui/p-cc2dc4f4.entry.js +0 -1
@@ -153,6 +153,12 @@ export class EzGrid {
153
153
  async getCustomValueFormatter(columnName) {
154
154
  return this._customFormatters.get(columnName);
155
155
  }
156
+ /**
157
+ * Atribui o foco para a grade.
158
+ */
159
+ async setFocus() {
160
+ this._gridController.setFocus();
161
+ }
156
162
  observeConfig(config) {
157
163
  this._gridController.setColumnsState(config === null || config === void 0 ? void 0 : config.columns);
158
164
  }
@@ -1150,6 +1156,22 @@ export class EzGrid {
1150
1156
  "text": "Retorna o formatador customizado da coluna caso exista.",
1151
1157
  "tags": []
1152
1158
  }
1159
+ },
1160
+ "setFocus": {
1161
+ "complexType": {
1162
+ "signature": "() => Promise<void>",
1163
+ "parameters": [],
1164
+ "references": {
1165
+ "Promise": {
1166
+ "location": "global"
1167
+ }
1168
+ },
1169
+ "return": "Promise<void>"
1170
+ },
1171
+ "docs": {
1172
+ "text": "Atribui o foco para a grade.",
1173
+ "tags": []
1174
+ }
1153
1175
  }
1154
1176
  };
1155
1177
  }
@@ -6,7 +6,6 @@ export class EzNumberInput {
6
6
  this._focused = false;
7
7
  this._changePending = false;
8
8
  this._valuePromiseCallbacks = [];
9
- this._value = undefined;
10
9
  this.label = undefined;
11
10
  this.value = undefined;
12
11
  this.enabled = true;
@@ -65,14 +64,14 @@ export class EzNumberInput {
65
64
  const newValueValidated = this.validateValue(newValue);
66
65
  const oldValueValidated = this.validateValue(oldValue);
67
66
  if (newValueValidated === null) {
68
- this._value = '';
67
+ this._textInput.value = '';
69
68
  }
70
69
  if (newValueValidated != oldValueValidated) {
71
70
  const textValue = this.getTextValue(newValueValidated) || '';
72
- if ((this._value || '') !== textValue) {
71
+ if ((this._textInput.value || '') !== textValue) {
73
72
  const parsedNumber = this.getParsedNumber(textValue);
74
73
  if (parsedNumber !== undefined || !this._focused) {
75
- this._value = textValue;
74
+ this._textInput.value = textValue;
76
75
  this._focused = false;
77
76
  this.errorMessage = "";
78
77
  }
@@ -93,7 +92,7 @@ export class EzNumberInput {
93
92
  }
94
93
  getTextValue(value) {
95
94
  if (value != undefined) {
96
- return this.precision >= 0 ? NumberUtils.format(value.toString(), Number(this.precision), Number(this.prettyPrecision)) : value.toString();
95
+ return this.precision > 0 ? NumberUtils.format(value.toString(), Number(this.precision), Number(this.prettyPrecision)) : value.toString();
97
96
  }
98
97
  return undefined;
99
98
  }
@@ -146,13 +145,17 @@ export class EzNumberInput {
146
145
  this.ezStartChange.emit({ waitmessage: "", blocking: false });
147
146
  }
148
147
  }
149
- getParsedNumber(value = this._value) {
148
+ getParsedNumber(value) {
149
+ var _a;
150
+ if (value === void 0) {
151
+ value = (_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value;
152
+ }
150
153
  return (value === null || value === void 0 ? void 0 : value.trim()) ? NumberUtils.stringToNumber(value) : undefined;
151
154
  }
152
155
  setInputValue() {
153
156
  const textValue = this.getTextValue(this.value) || '';
154
- if ((this._value || '') !== textValue) {
155
- this._value = textValue;
157
+ if ((this._textInput.value || '') !== textValue) {
158
+ this._textInput.value = textValue;
156
159
  }
157
160
  }
158
161
  componentDidLoad() {
@@ -161,7 +164,7 @@ export class EzNumberInput {
161
164
  }
162
165
  render() {
163
166
  ElementIDUtils.addIDInfoIfNotExists(this._elem, 'input');
164
- return (h("ez-text-input", { class: "number__input", "data-element-id": ElementIDUtils.getInternalIDInfo("textInput"), ref: elem => this._textInput = elem, "data-slave-mode": "true", label: this.label, onBlur: () => this.handleBlur(), onInput: () => this.handleInput(), restrict: this.precision > 0 ? "0123456789-,." : "0123456789-", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, canShowError: this.canShowError, value: this._value }));
167
+ return (h("ez-text-input", { class: "number__input", "data-element-id": ElementIDUtils.getInternalIDInfo("textInput"), ref: elem => this._textInput = elem, "data-slave-mode": "true", label: this.label, onBlur: () => this.handleBlur(), onInput: () => this.handleInput(), restrict: this.precision > 0 ? "0123456789-,." : "0123456789-", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, canShowError: this.canShowError }));
165
168
  }
166
169
  static get is() { return "ez-number-input"; }
167
170
  static get encapsulation() { return "shadow"; }
@@ -318,11 +321,6 @@ export class EzNumberInput {
318
321
  }
319
322
  };
320
323
  }
321
- static get states() {
322
- return {
323
- "_value": {}
324
- };
325
- }
326
324
  static get events() {
327
325
  return [{
328
326
  "method": "ezChange",
@@ -58,9 +58,13 @@ export class EzTabselector {
58
58
  this.selectedTab = undefined;
59
59
  this.tabs = undefined;
60
60
  }
61
- observeTabs(newValue) {
61
+ observeTabs(newValue, oldValue) {
62
62
  if (newValue && typeof newValue !== "string") {
63
63
  this._processedTabs = newValue;
64
+ return;
65
+ }
66
+ if (newValue !== oldValue) {
67
+ this.processesTabs();
64
68
  }
65
69
  }
66
70
  handleTabClick(tab) {
@@ -70,36 +74,37 @@ export class EzTabselector {
70
74
  this.ezChange.emit(tab);
71
75
  this.setFocusedBtn(false, tab.index);
72
76
  }
73
- componentWillRender() {
74
- if (!this._processedTabs) {
75
- if (this.tabs) {
76
- if (Array.isArray(this.tabs)) {
77
- this._processedTabs = [...this.tabs];
78
- }
79
- else {
80
- this._processedTabs = [];
81
- this.tabs.split(",").forEach((label) => {
82
- label = label.trim();
83
- this._processedTabs.push({ label, tabKey: label, index: this._processedTabs.length });
84
- this.buildElementIdTab(this._processedTabs);
85
- });
86
- }
77
+ componentWillLoad() {
78
+ this.processesTabs();
79
+ }
80
+ processesTabs() {
81
+ if (this.tabs) {
82
+ if (Array.isArray(this.tabs)) {
83
+ this._processedTabs = [...this.tabs];
84
+ }
85
+ else {
86
+ this._processedTabs = [];
87
+ this.tabs.split(",").forEach((label) => {
88
+ label = label.trim();
89
+ this._processedTabs.push({ label, tabKey: label, index: this._processedTabs.length });
90
+ this.buildElementIdTab(this._processedTabs);
91
+ });
87
92
  }
88
- this._hostElem.querySelectorAll("ez-tab").forEach((elem) => {
89
- const tabKey = elem.getAttribute("tabKey");
90
- const label = elem.getAttribute("label");
91
- const leftIcon = elem.getAttribute("leftIcon");
92
- const rightIcon = elem.getAttribute("rightIcon");
93
- const tab = { label, tabKey, leftIcon, rightIcon, index: this._processedTabs.length };
94
- const content = elem.firstChild;
95
- if (content) {
96
- content.setAttribute("slot", "tab" + tab.index);
97
- this._hostElem.appendChild(content);
98
- }
99
- this._processedTabs.push(tab);
100
- this.buildElementIdTab(this._processedTabs);
101
- });
102
93
  }
94
+ this._hostElem.querySelectorAll("ez-tab").forEach((elem) => {
95
+ const tabKey = elem.getAttribute("tabKey");
96
+ const label = elem.getAttribute("label");
97
+ const leftIcon = elem.getAttribute("leftIcon");
98
+ const rightIcon = elem.getAttribute("rightIcon");
99
+ const tab = { label, tabKey, leftIcon, rightIcon, index: this._processedTabs.length };
100
+ const content = elem.firstChild;
101
+ if (content) {
102
+ content.setAttribute("slot", "tab" + tab.index);
103
+ this._hostElem.appendChild(content);
104
+ }
105
+ this._processedTabs.push(tab);
106
+ this.buildElementIdTab(this._processedTabs);
107
+ });
103
108
  }
104
109
  componentDidRender() {
105
110
  this.updateScroll();
@@ -35,6 +35,13 @@ export default class DataBinder {
35
35
  this.applyDefaultValues();
36
36
  this._dataUnit.subscribe(this.onDataUnitEvent);
37
37
  this._dataUnit.addInterceptor(this);
38
+ this.setContextDataBinder(dataUnit);
39
+ }
40
+ setContextDataBinder(dataUnit) {
41
+ const dataBindersByDataUnit = ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__") || new Map();
42
+ const dataBinders = [...(dataBindersByDataUnit.get(dataUnit.dataUnitId) || []), this];
43
+ dataBindersByDataUnit.set(dataUnit.dataUnitId, dataBinders);
44
+ ApplicationContext.setContextValue("__DATABINDER_BY_DATAUNIT__", dataBindersByDataUnit);
38
45
  }
39
46
  applyDefaultValues() {
40
47
  const recordIds = (this._dataUnit.getAddedRecords() || []).map(r => r.__record__id__);
@@ -61,9 +68,17 @@ export default class DataBinder {
61
68
  getMessageForField: field => this.getErrorMessage(field)
62
69
  }, recordsValidator);
63
70
  }
71
+ disconnectDataUnit() {
72
+ const dataBindersByDataUnit = ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__") || new Map();
73
+ const dataBinders = dataBindersByDataUnit.get(this._dataUnit.dataUnitId);
74
+ const dataBindersFiltered = dataBinders.filter((dataBinder) => JSON.stringify(dataBinder) !== JSON.stringify(this));
75
+ dataBindersByDataUnit.set(this._dataUnit.dataUnitId, dataBindersFiltered);
76
+ ApplicationContext.setContextValue("__DATABINDER_BY_DATAUNIT__", dataBindersByDataUnit);
77
+ }
64
78
  onDisconnectedCallback() {
65
79
  this._dataUnit.unsubscribe(this.onDataUnitEvent);
66
80
  this._dataUnit.removeInterceptor(this);
81
+ this.disconnectDataUnit();
67
82
  }
68
83
  getCurrentRecordId() {
69
84
  const record = this._dataUnit.getSelectedRecord();
@@ -110,6 +125,17 @@ export default class DataBinder {
110
125
  validate() {
111
126
  return this._recordValidatorProcessor.validate();
112
127
  }
128
+ static async validateByDataunit(dataUnit) {
129
+ try {
130
+ const dataBindersByDataUnit = ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__");
131
+ const dataBinders = dataBindersByDataUnit.get(dataUnit.dataUnitId) || [];
132
+ await Promise.all(dataBinders.map((dataBinder) => dataBinder.validate()));
133
+ return true;
134
+ }
135
+ catch (_a) {
136
+ return false;
137
+ }
138
+ }
113
139
  updateErrorMessage(fieldName, field, message) {
114
140
  if (message == undefined) {
115
141
  message = this._dataUnit.getInvalidMessage(this.getCurrentRecordId(), fieldName);
@@ -1,9 +1,46 @@
1
- import { DataUnit } from "@sankhyalabs/core";
1
+ import { ApplicationContext, DataUnit } from "@sankhyalabs/core";
2
2
  import DataBinder from "../DataBinder";
3
+ import { metadataTest } from "./resources/metadataTest";
3
4
  describe('DataBinder', () => {
5
+ let dataBinder;
6
+ let dataUnit;
7
+ beforeEach(() => {
8
+ dataUnit = new DataUnit();
9
+ dataUnit.metadata = metadataTest;
10
+ dataUnit.addRecord();
11
+ dataUnit.selectFirst();
12
+ dataBinder = new DataBinder(dataUnit);
13
+ });
4
14
  it('constructor', async () => {
5
- const du = new DataUnit();
6
- const db = new DataBinder(du);
7
- expect(db).toBeTruthy();
15
+ expect(dataBinder).toBeTruthy();
16
+ });
17
+ it('ApplicationContext should be filled', () => {
18
+ const dataBindersByDataUnit = ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__") || new Map();
19
+ expect(dataBindersByDataUnit.get(dataUnit.dataUnitId).length).toBeGreaterThan(0);
20
+ });
21
+ it('ApplicationContext should be filled with two binders', () => {
22
+ new DataBinder(dataUnit);
23
+ const dataBindersByDataUnit = ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__") || new Map();
24
+ expect(dataBindersByDataUnit.get(dataUnit.dataUnitId).length).toBe(2);
25
+ });
26
+ it('should be invalid for empty fields', async () => {
27
+ const isValid = await DataBinder.validateByDataunit(dataUnit);
28
+ dataBinder['_recordValidatorProcessor'] = {
29
+ validate: () => Promise.reject(),
30
+ };
31
+ expect(isValid).toBe(false);
32
+ });
33
+ it('should be valid for filled fields', async () => {
34
+ await dataUnit.setFieldValue('NAME', 'João');
35
+ dataBinder['_recordValidatorProcessor'] = {
36
+ validate: () => Promise.resolve(),
37
+ };
38
+ const isValid = await DataBinder.validateByDataunit(dataUnit);
39
+ expect(isValid).toBe(true);
40
+ });
41
+ it('should be remove dataBinder on disconnected', async () => {
42
+ dataBinder.onDisconnectedCallback();
43
+ const dataBindersByDataUnit = ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__") || new Map();
44
+ expect(dataBindersByDataUnit.get(dataUnit.dataUnitId).length).toBe(0);
8
45
  });
9
46
  });
@@ -0,0 +1,15 @@
1
+ import { DataType, UserInterface } from "@sankhyalabs/core";
2
+ export const metadataTest = {
3
+ "name": "clients",
4
+ "label": "clients",
5
+ "fields": [
6
+ {
7
+ "name": "NAME",
8
+ "label": "Nome",
9
+ "dataType": DataType.TEXT,
10
+ "userInterface": UserInterface.SHORTTEXT,
11
+ "readOnly": false,
12
+ "required": true
13
+ },
14
+ ]
15
+ };
@@ -1,6 +1,6 @@
1
1
  import { HTMLElement as HTMLElement$1, createEvent, h, Host, forceUpdate, Fragment, proxyCustomElement } from '@stencil/core/internal/client';
2
2
  export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
3
- import { UserInterface, DateUtils as DateUtils$1, Action, WaitingChangeException, ApplicationContext, DataUnitAction, FloatingManager, ElementIDUtils, ObjectUtils as ObjectUtils$1, JSUtils, StringUtils as StringUtils$1, HTMLBuilder, TimeFormatter, DataUnit, NumberUtils as NumberUtils$1, MaskFormatter, DataType, SortMode, FieldComparator, ArrayUtils as ArrayUtils$1, OverflowWatcher, OVERFLOWED_CLASS_NAME, KeyboardManager } from '@sankhyalabs/core';
3
+ import { UserInterface, DateUtils as DateUtils$1, Action, ApplicationContext, WaitingChangeException, DataUnitAction, FloatingManager, ElementIDUtils, ObjectUtils as ObjectUtils$1, JSUtils, StringUtils as StringUtils$1, HTMLBuilder, TimeFormatter, DataUnit, NumberUtils as NumberUtils$1, MaskFormatter, DataType, SortMode, FieldComparator, ArrayUtils as ArrayUtils$1, OverflowWatcher, OVERFLOWED_CLASS_NAME, KeyboardManager } from '@sankhyalabs/core';
4
4
  import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
5
5
 
6
6
  // Unique ID creation requires a high quality random # generator. In the browser we therefore
@@ -616,6 +616,13 @@ class DataBinder {
616
616
  this.applyDefaultValues();
617
617
  this._dataUnit.subscribe(this.onDataUnitEvent);
618
618
  this._dataUnit.addInterceptor(this);
619
+ this.setContextDataBinder(dataUnit);
620
+ }
621
+ setContextDataBinder(dataUnit) {
622
+ const dataBindersByDataUnit = ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__") || new Map();
623
+ const dataBinders = [...(dataBindersByDataUnit.get(dataUnit.dataUnitId) || []), this];
624
+ dataBindersByDataUnit.set(dataUnit.dataUnitId, dataBinders);
625
+ ApplicationContext.setContextValue("__DATABINDER_BY_DATAUNIT__", dataBindersByDataUnit);
619
626
  }
620
627
  applyDefaultValues() {
621
628
  const recordIds = (this._dataUnit.getAddedRecords() || []).map(r => r.__record__id__);
@@ -642,9 +649,17 @@ class DataBinder {
642
649
  getMessageForField: field => this.getErrorMessage(field)
643
650
  }, recordsValidator);
644
651
  }
652
+ disconnectDataUnit() {
653
+ const dataBindersByDataUnit = ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__") || new Map();
654
+ const dataBinders = dataBindersByDataUnit.get(this._dataUnit.dataUnitId);
655
+ const dataBindersFiltered = dataBinders.filter((dataBinder) => JSON.stringify(dataBinder) !== JSON.stringify(this));
656
+ dataBindersByDataUnit.set(this._dataUnit.dataUnitId, dataBindersFiltered);
657
+ ApplicationContext.setContextValue("__DATABINDER_BY_DATAUNIT__", dataBindersByDataUnit);
658
+ }
645
659
  onDisconnectedCallback() {
646
660
  this._dataUnit.unsubscribe(this.onDataUnitEvent);
647
661
  this._dataUnit.removeInterceptor(this);
662
+ this.disconnectDataUnit();
648
663
  }
649
664
  getCurrentRecordId() {
650
665
  const record = this._dataUnit.getSelectedRecord();
@@ -691,6 +706,17 @@ class DataBinder {
691
706
  validate() {
692
707
  return this._recordValidatorProcessor.validate();
693
708
  }
709
+ static async validateByDataunit(dataUnit) {
710
+ try {
711
+ const dataBindersByDataUnit = ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__");
712
+ const dataBinders = dataBindersByDataUnit.get(dataUnit.dataUnitId) || [];
713
+ await Promise.all(dataBinders.map((dataBinder) => dataBinder.validate()));
714
+ return true;
715
+ }
716
+ catch (_a) {
717
+ return false;
718
+ }
719
+ }
694
720
  updateErrorMessage(fieldName, field, message) {
695
721
  if (message == undefined) {
696
722
  message = this._dataUnit.getInvalidMessage(this.getCurrentRecordId(), fieldName);
@@ -4929,9 +4955,8 @@ const buildFile = ({ name, label, readOnly, contextName, props }) => {
4929
4955
  };
4930
4956
 
4931
4957
  const buildDecimal$1 = ({ name, label, readOnly, props, contextName, canShowError }) => {
4932
- var _a, _b;
4933
- const precision = Number((_a = props === null || props === void 0 ? void 0 : props.precision) !== null && _a !== void 0 ? _a : 2);
4934
- const prettyPrecision = Number((_b = props === null || props === void 0 ? void 0 : props.prettyPrecision) !== null && _b !== void 0 ? _b : precision);
4958
+ const precision = Number((props === null || props === void 0 ? void 0 : props.precision) || 2);
4959
+ const prettyPrecision = Number((props === null || props === void 0 ? void 0 : props.prettyPrecision) || precision);
4935
4960
  return buildNumeric$1(name, label, readOnly, precision, prettyPrecision, contextName, canShowError);
4936
4961
  };
4937
4962
  const buildInteger$1 = ({ name, label, readOnly, contextName, canShowError }) => {
@@ -5040,7 +5065,7 @@ const EzFormView$1 = class extends HTMLElement$1 {
5040
5065
  */
5041
5066
  async setFieldProp(fieldName, propName, value) {
5042
5067
  const fields = this.fields.map(field => {
5043
- if (field.name === fieldName && (value || value === 0)) {
5068
+ if (field.name === fieldName) {
5044
5069
  field.props = field.props || {};
5045
5070
  field.props[propName] = value;
5046
5071
  }
@@ -124034,6 +124059,7 @@ class DataSource {
124034
124059
  else {
124035
124060
  this._controller.selectRows(selectionInfo.recordIds, true);
124036
124061
  }
124062
+ this._controller.setFocusFirstRow();
124037
124063
  }
124038
124064
  getRows(params) {
124039
124065
  if (this.needReload(params)) {
@@ -124420,9 +124446,8 @@ const buildDateTime = ({ readOnly }) => {
124420
124446
  };
124421
124447
 
124422
124448
  const buildDecimal = ({ readOnly, props }) => {
124423
- var _a, _b;
124424
- const precision = Number((_a = props === null || props === void 0 ? void 0 : props.precision) !== null && _a !== void 0 ? _a : 2);
124425
- const prettyPrecision = Number((_b = props === null || props === void 0 ? void 0 : props.prettyPrecision) !== null && _b !== void 0 ? _b : precision);
124449
+ const precision = Number((props === null || props === void 0 ? void 0 : props.precision) || 2);
124450
+ const prettyPrecision = Number((props === null || props === void 0 ? void 0 : props.prettyPrecision) || precision);
124426
124451
  return buildNumeric(readOnly, precision, prettyPrecision);
124427
124452
  };
124428
124453
  const buildInteger = ({ readOnly }) => {
@@ -125052,6 +125077,7 @@ class AgGridController {
125052
125077
  }
125053
125078
  initDatagrid(container, options) {
125054
125079
  var _a;
125080
+ this._container = container;
125055
125081
  if (this._grid === undefined) {
125056
125082
  LicenseManager.setLicenseKey(ApplicationContext.getContextValue('__EZUI__GRID_LICENSE__'));
125057
125083
  this._columnStateChangeCallback = options.onColumnStateChange;
@@ -125406,11 +125432,27 @@ class AgGridController {
125406
125432
  }
125407
125433
  this._gridOptions.api.refreshServerSide({ purge: true });
125408
125434
  }
125435
+ focusOnGridContainer() {
125436
+ this._container.setAttribute('tabindex', '-1');
125437
+ this._container.focus();
125438
+ }
125439
+ setFocus() {
125440
+ var _a, _b;
125441
+ if ((_b = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.records) === null || _b === void 0 ? void 0 : _b.length) {
125442
+ this.setFocusFirstRow();
125443
+ }
125444
+ else {
125445
+ this.focusOnGridContainer();
125446
+ }
125447
+ }
125409
125448
  setFocusFirstRow() {
125410
125449
  const firstRow = this._gridOptions.api.getDisplayedRowAtIndex(0);
125411
125450
  if (firstRow) {
125412
125451
  this.setFocusOnRow(firstRow.rowIndex);
125413
125452
  }
125453
+ else {
125454
+ this.focusOnGridContainer();
125455
+ }
125414
125456
  }
125415
125457
  setFocusLastRow() {
125416
125458
  const lastRow = this._gridOptions.api.getDisplayedRowAtIndex(this._gridOptions.api.getLastDisplayedRow());
@@ -126014,7 +126056,7 @@ class InMemoryFilterColumnDataSource {
126014
126056
  }
126015
126057
  }
126016
126058
 
126017
- const ezGridCss = ".sc-ez-grid-h{display:grid;grid-template-rows:auto 1fr auto;height:100%;width:100%;--ez-grid__header--background-color:var(--background--xlight, #FFF);--ez-grid__selection-counter--z-index:var(--visible, 1);--ez-grid__container--shadow:0 0 16px 0 rgb(0 38 111 / 12%);--ez-grid--min-height:300px;min-height:var(--ez-grid--min-height)}.grid-header.sc-ez-grid{display:grid;justify-content:space-between;align-items:center;grid-row-start:1;grid-template-columns:1fr;background-color:var(--ez-grid__header--background-color, #FFF)}.grid__container.sc-ez-grid{padding-top:15px;margin-top:-12px;box-shadow:var(--ez-grid__container--shadow);background-color:var(--ez-grid__header--background-color)}.grid-header__popover.sc-ez-grid{position:relative;top:var(--space--sm, 16px)}.grid-header__container.sc-ez-grid{display:flex;align-items:center}.grid-header__position.sc-ez-grid{display:flex;align-items:center;justify-content:space-between}.grid__selection-counter.sc-ez-grid{position:fixed;white-space:nowrap;transform:translate(-50%, 0px);left:50%;opacity:0;bottom:-100%;transition:opacity 0.1s, bottom 0.5s}.grid__selection-counter--opened.sc-ez-grid{opacity:1;bottom:0px}.grid__btn-close.sc-ez-grid{display:flex;align-items:center;justify-content:center;padding:0;outline:none;width:20px;height:20px;border:none;background-color:unset;cursor:pointer}.grid__btn-clear.sc-ez-grid{--ez-button--link-color:var(--color--alert-warning-900, #8C6B00);--ez-button--link--hover-color:var(--color--alert-warning-900, #8C6B00)}[no-header].sc-ez-grid-h .grid-header.sc-ez-grid{height:0;padding:0}.grid-header__pagination.sc-ez-grid{width:30%;min-width:100px;justify-content:flex-end;flex-wrap:wrap}.grid-header__left-container.sc-ez-grid{width:70%}.grid-header__pagination-label.sc-ez-grid{width:100%;white-space:nowrap}.overflowed.sc-ez-grid{display:none}";
126059
+ const ezGridCss = ".sc-ez-grid-h{display:grid;grid-template-rows:auto 1fr auto;height:100%;width:100%;--ez-grid__header--background-color:var(--background--xlight, #FFF);--ez-grid__selection-counter--z-index:var(--visible, 1);--ez-grid__container--shadow:0 0 16px 0 rgb(0 38 111 / 12%);--ez-grid--min-height:300px;min-height:var(--ez-grid--min-height)}.grid-header.sc-ez-grid{display:grid;justify-content:space-between;align-items:center;grid-row-start:1;grid-template-columns:1fr;background-color:var(--ez-grid__header--background-color, #FFF)}.grid__container.sc-ez-grid{padding-top:15px;margin-top:-12px;outline:none;box-shadow:var(--ez-grid__container--shadow);background-color:var(--ez-grid__header--background-color)}.grid-header__popover.sc-ez-grid{position:relative;top:var(--space--sm, 16px)}.grid-header__container.sc-ez-grid{display:flex;align-items:center}.grid-header__position.sc-ez-grid{display:flex;align-items:center;justify-content:space-between}.grid__selection-counter.sc-ez-grid{position:fixed;white-space:nowrap;transform:translate(-50%, 0px);left:50%;opacity:0;bottom:-100%;transition:opacity 0.1s, bottom 0.5s}.grid__selection-counter--opened.sc-ez-grid{opacity:1;bottom:0px}.grid__btn-close.sc-ez-grid{display:flex;align-items:center;justify-content:center;padding:0;outline:none;width:20px;height:20px;border:none;background-color:unset;cursor:pointer}.grid__btn-clear.sc-ez-grid{--ez-button--link-color:var(--color--alert-warning-900, #8C6B00);--ez-button--link--hover-color:var(--color--alert-warning-900, #8C6B00)}[no-header].sc-ez-grid-h .grid-header.sc-ez-grid{height:0;padding:0}.grid-header__pagination.sc-ez-grid{width:30%;min-width:100px;justify-content:flex-end;flex-wrap:wrap}.grid-header__left-container.sc-ez-grid{width:70%}.grid-header__pagination-label.sc-ez-grid{width:100%;white-space:nowrap}.overflowed.sc-ez-grid{display:none}";
126018
126060
 
126019
126061
  const windowInstace$1 = window;
126020
126062
  const matches = (text, filter) => {
@@ -126171,6 +126213,12 @@ const EzGrid$1 = class extends HTMLElement$1 {
126171
126213
  async getCustomValueFormatter(columnName) {
126172
126214
  return this._customFormatters.get(columnName);
126173
126215
  }
126216
+ /**
126217
+ * Atribui o foco para a grade.
126218
+ */
126219
+ async setFocus() {
126220
+ this._gridController.setFocus();
126221
+ }
126174
126222
  observeConfig(config) {
126175
126223
  this._gridController.setColumnsState(config === null || config === void 0 ? void 0 : config.columns);
126176
126224
  }
@@ -127532,7 +127580,6 @@ const EzNumberInput$1 = class extends HTMLElement$1 {
127532
127580
  this._focused = false;
127533
127581
  this._changePending = false;
127534
127582
  this._valuePromiseCallbacks = [];
127535
- this._value = undefined;
127536
127583
  this.label = undefined;
127537
127584
  this.value = undefined;
127538
127585
  this.enabled = true;
@@ -127591,14 +127638,14 @@ const EzNumberInput$1 = class extends HTMLElement$1 {
127591
127638
  const newValueValidated = this.validateValue(newValue);
127592
127639
  const oldValueValidated = this.validateValue(oldValue);
127593
127640
  if (newValueValidated === null) {
127594
- this._value = '';
127641
+ this._textInput.value = '';
127595
127642
  }
127596
127643
  if (newValueValidated != oldValueValidated) {
127597
127644
  const textValue = this.getTextValue(newValueValidated) || '';
127598
- if ((this._value || '') !== textValue) {
127645
+ if ((this._textInput.value || '') !== textValue) {
127599
127646
  const parsedNumber = this.getParsedNumber(textValue);
127600
127647
  if (parsedNumber !== undefined || !this._focused) {
127601
- this._value = textValue;
127648
+ this._textInput.value = textValue;
127602
127649
  this._focused = false;
127603
127650
  this.errorMessage = "";
127604
127651
  }
@@ -127619,7 +127666,7 @@ const EzNumberInput$1 = class extends HTMLElement$1 {
127619
127666
  }
127620
127667
  getTextValue(value) {
127621
127668
  if (value != undefined) {
127622
- return this.precision >= 0 ? NumberUtils$1.format(value.toString(), Number(this.precision), Number(this.prettyPrecision)) : value.toString();
127669
+ return this.precision > 0 ? NumberUtils$1.format(value.toString(), Number(this.precision), Number(this.prettyPrecision)) : value.toString();
127623
127670
  }
127624
127671
  return undefined;
127625
127672
  }
@@ -127672,13 +127719,17 @@ const EzNumberInput$1 = class extends HTMLElement$1 {
127672
127719
  this.ezStartChange.emit({ waitmessage: "", blocking: false });
127673
127720
  }
127674
127721
  }
127675
- getParsedNumber(value = this._value) {
127722
+ getParsedNumber(value) {
127723
+ var _a;
127724
+ if (value === void 0) {
127725
+ value = (_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value;
127726
+ }
127676
127727
  return (value === null || value === void 0 ? void 0 : value.trim()) ? NumberUtils$1.stringToNumber(value) : undefined;
127677
127728
  }
127678
127729
  setInputValue() {
127679
127730
  const textValue = this.getTextValue(this.value) || '';
127680
- if ((this._value || '') !== textValue) {
127681
- this._value = textValue;
127731
+ if ((this._textInput.value || '') !== textValue) {
127732
+ this._textInput.value = textValue;
127682
127733
  }
127683
127734
  }
127684
127735
  componentDidLoad() {
@@ -127687,7 +127738,7 @@ const EzNumberInput$1 = class extends HTMLElement$1 {
127687
127738
  }
127688
127739
  render() {
127689
127740
  ElementIDUtils.addIDInfoIfNotExists(this._elem, 'input');
127690
- return (h("ez-text-input", { class: "number__input", "data-element-id": ElementIDUtils.getInternalIDInfo("textInput"), ref: elem => this._textInput = elem, "data-slave-mode": "true", label: this.label, onBlur: () => this.handleBlur(), onInput: () => this.handleInput(), restrict: this.precision > 0 ? "0123456789-,." : "0123456789-", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, canShowError: this.canShowError, value: this._value }));
127741
+ return (h("ez-text-input", { class: "number__input", "data-element-id": ElementIDUtils.getInternalIDInfo("textInput"), ref: elem => this._textInput = elem, "data-slave-mode": "true", label: this.label, onBlur: () => this.handleBlur(), onInput: () => this.handleInput(), restrict: this.precision > 0 ? "0123456789-,." : "0123456789-", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, canShowError: this.canShowError }));
127691
127742
  }
127692
127743
  get _elem() { return this; }
127693
127744
  static get watchers() { return {
@@ -129993,9 +130044,13 @@ const EzTabselector$1 = class extends HTMLElement$1 {
129993
130044
  this.selectedTab = undefined;
129994
130045
  this.tabs = undefined;
129995
130046
  }
129996
- observeTabs(newValue) {
130047
+ observeTabs(newValue, oldValue) {
129997
130048
  if (newValue && typeof newValue !== "string") {
129998
130049
  this._processedTabs = newValue;
130050
+ return;
130051
+ }
130052
+ if (newValue !== oldValue) {
130053
+ this.processesTabs();
129999
130054
  }
130000
130055
  }
130001
130056
  handleTabClick(tab) {
@@ -130005,36 +130060,37 @@ const EzTabselector$1 = class extends HTMLElement$1 {
130005
130060
  this.ezChange.emit(tab);
130006
130061
  this.setFocusedBtn(false, tab.index);
130007
130062
  }
130008
- componentWillRender() {
130009
- if (!this._processedTabs) {
130010
- if (this.tabs) {
130011
- if (Array.isArray(this.tabs)) {
130012
- this._processedTabs = [...this.tabs];
130013
- }
130014
- else {
130015
- this._processedTabs = [];
130016
- this.tabs.split(",").forEach((label) => {
130017
- label = label.trim();
130018
- this._processedTabs.push({ label, tabKey: label, index: this._processedTabs.length });
130019
- this.buildElementIdTab(this._processedTabs);
130020
- });
130021
- }
130063
+ componentWillLoad() {
130064
+ this.processesTabs();
130065
+ }
130066
+ processesTabs() {
130067
+ if (this.tabs) {
130068
+ if (Array.isArray(this.tabs)) {
130069
+ this._processedTabs = [...this.tabs];
130070
+ }
130071
+ else {
130072
+ this._processedTabs = [];
130073
+ this.tabs.split(",").forEach((label) => {
130074
+ label = label.trim();
130075
+ this._processedTabs.push({ label, tabKey: label, index: this._processedTabs.length });
130076
+ this.buildElementIdTab(this._processedTabs);
130077
+ });
130022
130078
  }
130023
- this._hostElem.querySelectorAll("ez-tab").forEach((elem) => {
130024
- const tabKey = elem.getAttribute("tabKey");
130025
- const label = elem.getAttribute("label");
130026
- const leftIcon = elem.getAttribute("leftIcon");
130027
- const rightIcon = elem.getAttribute("rightIcon");
130028
- const tab = { label, tabKey, leftIcon, rightIcon, index: this._processedTabs.length };
130029
- const content = elem.firstChild;
130030
- if (content) {
130031
- content.setAttribute("slot", "tab" + tab.index);
130032
- this._hostElem.appendChild(content);
130033
- }
130034
- this._processedTabs.push(tab);
130035
- this.buildElementIdTab(this._processedTabs);
130036
- });
130037
130079
  }
130080
+ this._hostElem.querySelectorAll("ez-tab").forEach((elem) => {
130081
+ const tabKey = elem.getAttribute("tabKey");
130082
+ const label = elem.getAttribute("label");
130083
+ const leftIcon = elem.getAttribute("leftIcon");
130084
+ const rightIcon = elem.getAttribute("rightIcon");
130085
+ const tab = { label, tabKey, leftIcon, rightIcon, index: this._processedTabs.length };
130086
+ const content = elem.firstChild;
130087
+ if (content) {
130088
+ content.setAttribute("slot", "tab" + tab.index);
130089
+ this._hostElem.appendChild(content);
130090
+ }
130091
+ this._processedTabs.push(tab);
130092
+ this.buildElementIdTab(this._processedTabs);
130093
+ });
130038
130094
  }
130039
130095
  componentDidRender() {
130040
130096
  this.updateScroll();
@@ -132184,7 +132240,7 @@ const EzLoadingBar = /*@__PURE__*/proxyCustomElement(EzLoadingBar$1, [1,"ez-load
132184
132240
  const EzModal = /*@__PURE__*/proxyCustomElement(EzModal$1, [1,"ez-modal",{"modalSize":[1,"modal-size"],"align":[1],"heightMode":[1,"height-mode"],"opened":[1028],"closeEsc":[4,"close-esc"],"closeOutsideClick":[4,"close-outside-click"],"scrim":[1]}]);
132185
132241
  const EzModalContainer = /*@__PURE__*/proxyCustomElement(EzModalContainer$1, [6,"ez-modal-container",{"modalTitle":[1,"modal-title"],"modalSubTitle":[1,"modal-sub-title"],"showTitleBar":[4,"show-title-bar"],"cancelButtonLabel":[1,"cancel-button-label"],"okButtonLabel":[1,"ok-button-label"],"cancelButtonStatus":[1,"cancel-button-status"],"okButtonStatus":[1,"ok-button-status"]},[[4,"ezCloseModal","handleEzModalAction"]]]);
132186
132242
  const EzMultiSelectionList = /*@__PURE__*/proxyCustomElement(EzMuiltiSelectionList, [2,"ez-multi-selection-list",{"columnName":[1,"column-name"],"dataSource":[16],"useOptions":[1028,"use-options"],"options":[1040],"isTextSearch":[4,"is-text-search"],"filteredOptions":[32],"displayOptions":[32],"viewScenario":[32],"displayOptionToCheckAllItems":[32]}]);
132187
- const EzNumberInput = /*@__PURE__*/proxyCustomElement(EzNumberInput$1, [1,"ez-number-input",{"label":[1],"value":[1538],"enabled":[4],"canShowError":[516,"can-show-error"],"errorMessage":[1537,"error-message"],"precision":[2],"prettyPrecision":[2,"pretty-precision"],"mode":[513],"_value":[32]}]);
132243
+ const EzNumberInput = /*@__PURE__*/proxyCustomElement(EzNumberInput$1, [1,"ez-number-input",{"label":[1],"value":[1538],"enabled":[4],"canShowError":[516,"can-show-error"],"errorMessage":[1537,"error-message"],"precision":[2],"prettyPrecision":[2,"pretty-precision"],"mode":[513]}]);
132188
132244
  const EzPopover = /*@__PURE__*/proxyCustomElement(EzPopover$1, [1,"ez-popover",{"autoClose":[516,"auto-close"],"boxWidth":[513,"box-width"],"opened":[1540],"innerElement":[1537,"inner-element"],"overlayType":[513,"overlay-type"]}]);
132189
132245
  const EzPopup = /*@__PURE__*/proxyCustomElement(EzPopup$1, [1,"ez-popup",{"size":[1],"opened":[1540],"useHeader":[516,"use-header"],"heightMode":[513,"height-mode"],"ezTitle":[1,"ez-title"]}]);
132190
132246
  const EzRadioButton = /*@__PURE__*/proxyCustomElement(EzRadioButton$1, [1,"ez-radio-button",{"value":[1544],"options":[1040],"enabled":[516],"label":[513],"direction":[1537]}]);
@@ -55,9 +55,8 @@ const buildFile = ({ name, label, readOnly, contextName, props }) => {
55
55
  };
56
56
 
57
57
  const buildDecimal = ({ name, label, readOnly, props, contextName, canShowError }) => {
58
- var _a, _b;
59
- const precision = Number((_a = props === null || props === void 0 ? void 0 : props.precision) !== null && _a !== void 0 ? _a : 2);
60
- const prettyPrecision = Number((_b = props === null || props === void 0 ? void 0 : props.prettyPrecision) !== null && _b !== void 0 ? _b : precision);
58
+ const precision = Number((props === null || props === void 0 ? void 0 : props.precision) || 2);
59
+ const prettyPrecision = Number((props === null || props === void 0 ? void 0 : props.prettyPrecision) || precision);
61
60
  return buildNumeric(name, label, readOnly, precision, prettyPrecision, contextName, canShowError);
62
61
  };
63
62
  const buildInteger = ({ name, label, readOnly, contextName, canShowError }) => {
@@ -165,7 +164,7 @@ const EzFormView = class {
165
164
  */
166
165
  async setFieldProp(fieldName, propName, value) {
167
166
  const fields = this.fields.map(field => {
168
- if (field.name === fieldName && (value || value === 0)) {
167
+ if (field.name === fieldName) {
169
168
  field.props = field.props || {};
170
169
  field.props[propName] = value;
171
170
  }