@sankhyalabs/ezui 0.0.0-bugfix-dev-KB-78812-2.0 → 0.0.0-bugfix-dev-KB-76362.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/dist/cjs/RecordValidationProcessor-10846595.js +108 -0
  2. package/dist/cjs/ez-button.cjs.entry.js +1 -1
  3. package/dist/cjs/ez-card-item_3.cjs.entry.js +19 -12
  4. package/dist/cjs/ez-chart.cjs.entry.js +1 -1
  5. package/dist/cjs/ez-combo-box.cjs.entry.js +10 -46
  6. package/dist/cjs/ez-custom-form-input_2.cjs.entry.js +2 -3
  7. package/dist/cjs/ez-date-input.cjs.entry.js +2 -8
  8. package/dist/cjs/ez-date-time-input.cjs.entry.js +2 -8
  9. package/dist/cjs/ez-dialog.cjs.entry.js +2 -10
  10. package/dist/cjs/ez-form-view.cjs.entry.js +2 -2
  11. package/dist/cjs/ez-form.cjs.entry.js +325 -5
  12. package/dist/cjs/ez-grid.cjs.entry.js +70518 -14636
  13. package/dist/cjs/ez-icon.cjs.entry.js +1 -1
  14. package/dist/cjs/ez-list.cjs.entry.js +100 -151
  15. package/dist/cjs/ez-modal.cjs.entry.js +1 -1
  16. package/dist/cjs/ez-number-input.cjs.entry.js +0 -7
  17. package/dist/cjs/ez-popover.cjs.entry.js +1 -1
  18. package/dist/cjs/ez-popup.cjs.entry.js +1 -1
  19. package/dist/cjs/ez-search.cjs.entry.js +22 -67
  20. package/dist/cjs/ez-split-button.cjs.entry.js +1 -1
  21. package/dist/cjs/ez-split-panel.cjs.entry.js +4 -14
  22. package/dist/cjs/ez-text-area.cjs.entry.js +4 -66
  23. package/dist/cjs/ez-text-input.cjs.entry.js +7 -49
  24. package/dist/cjs/ez-time-input.cjs.entry.js +0 -6
  25. package/dist/cjs/ezui.cjs.js +1 -1
  26. package/dist/cjs/loader.cjs.js +1 -1
  27. package/dist/collection/collection-manifest.json +1 -1
  28. package/dist/collection/components/ez-button/ez-button.css +2 -2
  29. package/dist/collection/components/ez-card-item/ez-card-item.css +5 -14
  30. package/dist/collection/components/ez-combo-box/ez-combo-box.js +14 -75
  31. package/dist/collection/components/ez-date-input/ez-date-input.js +4 -35
  32. package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +4 -35
  33. package/dist/collection/components/ez-dialog/ez-dialog.css +3 -3
  34. package/dist/collection/components/ez-dialog/ez-dialog.js +1 -9
  35. package/dist/collection/components/ez-filter-input/ez-filter-input.css +11 -0
  36. package/dist/collection/components/ez-filter-input/ez-filter-input.js +52 -22
  37. package/dist/collection/components/ez-form/ez-form.js +0 -1
  38. package/dist/collection/components/ez-form-view/custom-input/ez-custom-form-input.js +2 -3
  39. package/dist/collection/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.js +2 -2
  40. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +27 -100
  41. package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +0 -8
  42. package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +46 -164
  43. package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.js +0 -7
  44. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/ComboBox.tpl.js +0 -1
  45. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/DateInput.tpl.js +0 -1
  46. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/NumberInput.tpl.js +0 -1
  47. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/Search.tpl.js +0 -1
  48. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/TextInput.tpl.js +1 -4
  49. package/dist/collection/components/ez-grid/ez-grid.js +3 -90
  50. package/dist/collection/components/ez-icon/ez-icon.css +149 -153
  51. package/dist/collection/components/ez-list/ez-list.css +5 -5
  52. package/dist/collection/components/ez-list/ez-list.js +170 -152
  53. package/dist/collection/components/ez-modal/ez-modal.css +0 -4
  54. package/dist/collection/components/ez-modal/ez-modal.js +2 -2
  55. package/dist/collection/components/ez-number-input/ez-number-input.js +0 -25
  56. package/dist/collection/components/ez-popover/ez-popover.css +10 -3
  57. package/dist/collection/components/ez-popup/ez-popup.css +8 -4
  58. package/dist/collection/components/ez-search/ez-search.css +1 -1
  59. package/dist/collection/components/ez-search/ez-search.js +24 -94
  60. package/dist/collection/components/ez-split-button/ez-split-button.css +2 -2
  61. package/dist/collection/components/ez-split-panel/ez-split-panel.js +4 -35
  62. package/dist/collection/components/ez-text-area/ez-text-area.css +0 -49
  63. package/dist/collection/components/ez-text-area/ez-text-area.js +2 -102
  64. package/dist/collection/components/ez-text-input/ez-text-input.css +53 -27
  65. package/dist/collection/components/ez-text-input/ez-text-input.js +6 -84
  66. package/dist/collection/components/ez-time-input/ez-time-input.js +0 -24
  67. package/dist/collection/utils/form/DataBinder.js +3 -18
  68. package/dist/collection/utils/form/FormMetadata.js +1 -1
  69. package/dist/collection/utils/interfaces/AbstractFieldMetadata.js +1 -1
  70. package/dist/custom-elements/index.js +71099 -15536
  71. package/dist/esm/RecordValidationProcessor-9c6cc267.js +105 -0
  72. package/dist/esm/ez-button.entry.js +1 -1
  73. package/dist/esm/ez-card-item_3.entry.js +19 -12
  74. package/dist/esm/ez-chart.entry.js +1 -1
  75. package/dist/esm/ez-combo-box.entry.js +11 -47
  76. package/dist/esm/ez-custom-form-input_2.entry.js +2 -3
  77. package/dist/esm/ez-date-input.entry.js +2 -8
  78. package/dist/esm/ez-date-time-input.entry.js +2 -8
  79. package/dist/esm/ez-dialog.entry.js +2 -10
  80. package/dist/esm/ez-form-view.entry.js +2 -2
  81. package/dist/esm/ez-form.entry.js +324 -4
  82. package/dist/esm/ez-grid.entry.js +70545 -14663
  83. package/dist/esm/ez-icon.entry.js +1 -1
  84. package/dist/esm/ez-list.entry.js +101 -152
  85. package/dist/esm/ez-modal.entry.js +1 -1
  86. package/dist/esm/ez-number-input.entry.js +0 -7
  87. package/dist/esm/ez-popover.entry.js +1 -1
  88. package/dist/esm/ez-popup.entry.js +1 -1
  89. package/dist/esm/ez-search.entry.js +22 -67
  90. package/dist/esm/ez-split-button.entry.js +1 -1
  91. package/dist/esm/ez-split-panel.entry.js +5 -15
  92. package/dist/esm/ez-text-area.entry.js +4 -66
  93. package/dist/esm/ez-text-input.entry.js +7 -49
  94. package/dist/esm/ez-time-input.entry.js +0 -6
  95. package/dist/esm/ezui.js +1 -1
  96. package/dist/esm/loader.js +1 -1
  97. package/dist/ezui/ezui.esm.js +1 -1
  98. package/dist/ezui/p-00687830.entry.js +1 -0
  99. package/dist/ezui/p-044d46d5.entry.js +1 -0
  100. package/dist/ezui/p-11b09aa1.entry.js +1 -0
  101. package/dist/ezui/p-190c190f.entry.js +304 -0
  102. package/dist/ezui/p-2de9f0aa.entry.js +1 -0
  103. package/dist/ezui/p-36180f4d.entry.js +1 -0
  104. package/dist/ezui/{p-2f53435e.entry.js → p-3b546374.entry.js} +1 -1
  105. package/dist/ezui/p-3f8c33e0.entry.js +1 -0
  106. package/dist/ezui/p-52100a6e.entry.js +1 -0
  107. package/dist/ezui/p-5a40c77a.entry.js +1 -0
  108. package/dist/ezui/p-61059f6b.entry.js +1 -0
  109. package/dist/ezui/p-68267f59.entry.js +1 -0
  110. package/dist/ezui/p-823cc11b.entry.js +1 -0
  111. package/dist/ezui/p-85b500bb.entry.js +1 -0
  112. package/dist/ezui/p-8ac13678.entry.js +1 -0
  113. package/dist/ezui/p-940760bf.entry.js +1 -0
  114. package/dist/ezui/p-9e08ddb0.entry.js +1 -0
  115. package/dist/ezui/p-b2a1398f.entry.js +1 -0
  116. package/dist/ezui/p-ba5f4ee7.entry.js +1 -0
  117. package/dist/ezui/p-d40b93a7.entry.js +1 -0
  118. package/dist/ezui/p-d4aba783.entry.js +1 -0
  119. package/dist/ezui/p-e3ec7422.entry.js +1 -0
  120. package/dist/ezui/p-f291db18.entry.js +1 -0
  121. package/dist/ezui/p-f42855b9.js +1 -0
  122. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +1 -7
  123. package/dist/types/components/ez-date-input/ez-date-input.d.ts +1 -6
  124. package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +1 -6
  125. package/dist/types/components/ez-dialog/ez-dialog.d.ts +0 -2
  126. package/dist/types/components/ez-filter-input/ez-filter-input.d.ts +11 -4
  127. package/dist/types/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.d.ts +1 -1
  128. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +0 -12
  129. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +2 -7
  130. package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +1 -2
  131. package/dist/types/components/ez-grid/controller/ag-grid/GridEditionManager.d.ts +7 -19
  132. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.d.ts +1 -3
  133. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellRender.d.ts +1 -1
  134. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.d.ts +1 -1
  135. package/dist/types/components/ez-grid/controller/ag-grid/components/cellRendererStatus.d.ts +1 -1
  136. package/dist/types/components/ez-grid/controller/ag-grid/components/selectionHeader.d.ts +1 -1
  137. package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellEditor.d.ts +1 -1
  138. package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellRender.d.ts +1 -1
  139. package/dist/types/components/ez-grid/controller/ag-grid/editor/IUICellEditor.d.ts +0 -1
  140. package/dist/types/components/ez-grid/controller/ag-grid/mock/Server.d.ts +1 -1
  141. package/dist/types/components/ez-grid/ez-grid.d.ts +1 -11
  142. package/dist/types/components/ez-list/ez-list.d.ts +26 -3
  143. package/dist/types/components/ez-modal/ez-modal.d.ts +1 -1
  144. package/dist/types/components/ez-number-input/ez-number-input.d.ts +0 -4
  145. package/dist/types/components/ez-search/ez-search.d.ts +2 -10
  146. package/dist/types/components/ez-split-panel/ez-split-panel.d.ts +0 -4
  147. package/dist/types/components/ez-text-area/ez-text-area.d.ts +0 -17
  148. package/dist/types/components/ez-text-input/ez-text-input.d.ts +0 -9
  149. package/dist/types/components/ez-time-input/ez-time-input.d.ts +0 -4
  150. package/dist/types/components.d.ts +44 -114
  151. package/dist/types/utils/form/DataBinder.d.ts +0 -3
  152. package/package.json +4 -11
  153. package/dist/cjs/DataBinder-3b083480.js +0 -445
  154. package/dist/cjs/FocusResolver-885f2173.js +0 -35
  155. package/dist/collection/components/ez-split-panel/interfaces/IPanelSizeInfo.js +0 -1
  156. package/dist/collection/utils/FocusResolver.js +0 -31
  157. package/dist/esm/DataBinder-02fa9bb9.js +0 -441
  158. package/dist/esm/FocusResolver-1ccbf850.js +0 -33
  159. package/dist/ezui/p-16e21a40.entry.js +0 -1
  160. package/dist/ezui/p-33675dae.entry.js +0 -1
  161. package/dist/ezui/p-397e3026.entry.js +0 -1
  162. package/dist/ezui/p-3af64edd.entry.js +0 -1
  163. package/dist/ezui/p-3c10cd94.entry.js +0 -1
  164. package/dist/ezui/p-3cc9b84a.entry.js +0 -1
  165. package/dist/ezui/p-3d38bfea.entry.js +0 -1
  166. package/dist/ezui/p-455e737c.js +0 -1
  167. package/dist/ezui/p-46a46507.entry.js +0 -1
  168. package/dist/ezui/p-6bc25bc8.entry.js +0 -1
  169. package/dist/ezui/p-6bda82d1.entry.js +0 -1
  170. package/dist/ezui/p-6d31c43c.entry.js +0 -1
  171. package/dist/ezui/p-7f5afb1f.entry.js +0 -1
  172. package/dist/ezui/p-8f026744.entry.js +0 -1
  173. package/dist/ezui/p-9fddffe3.entry.js +0 -309
  174. package/dist/ezui/p-a4ee2991.entry.js +0 -1
  175. package/dist/ezui/p-aa7779d0.entry.js +0 -1
  176. package/dist/ezui/p-be34c77f.entry.js +0 -1
  177. package/dist/ezui/p-bfc30e61.entry.js +0 -1
  178. package/dist/ezui/p-bfc59380.entry.js +0 -1
  179. package/dist/ezui/p-d960a031.entry.js +0 -1
  180. package/dist/ezui/p-dc628ed3.js +0 -1
  181. package/dist/ezui/p-dfca5946.entry.js +0 -1
  182. package/dist/ezui/p-efbe0b73.entry.js +0 -1
  183. package/dist/types/components/ez-split-panel/interfaces/IPanelSizeInfo.d.ts +0 -9
  184. package/dist/types/utils/FocusResolver.d.ts +0 -5
@@ -1,16 +1,15 @@
1
- import { LockManager, LockManagerOperation, UserInterface } from '@sankhyalabs/core';
2
- import { KeyCode, } from "@ag-grid-community/core";
1
+ import { UserInterface } from '@sankhyalabs/core';
2
+ import { KeyCode, } from 'ag-grid-community';
3
3
  import { RecordValidationProcessor } from '../../../../utils/validators/recordvalidator/RecordValidationProcessor';
4
4
  import EzCellEditor from './editor/EzCellEditor';
5
5
  import EzGridCustomCellEditor from './components/EzGridCustomCellEditor';
6
6
  import EzGridCustomCellRender from './components/EzGridCustomCellRender';
7
- import { DataBinder } from '../../../../utils';
8
7
  export default class GridEditionManager {
9
- constructor(dataUnit, useEnterLikeTab, recordsValidator, editionIsDisabled, customEditors, customRenders, enableContinuousInsert, enableGridInsert, lockerId) {
8
+ constructor(dataUnit, useEnterLikeTab, recordsValidator, editionIsDisabled, customEditors, customRenders, enableContinuousInsert, enableGridInsert) {
10
9
  this._dataUnit = dataUnit;
11
10
  this._recordValidationProcessor = new RecordValidationProcessor(this._dataUnit, {
12
11
  getRequiredFields: () => this.getRequiredFields(),
13
- markAsInvalid: (invalidField, recordId) => { this.pushInvalidCell(invalidField, recordId); },
12
+ markAsInvalid: (invalidField, recordId) => { this.setInvalidCell(invalidField, recordId); },
14
13
  getMessageForField: () => null,
15
14
  }, recordsValidator);
16
15
  this._useEnterLikeTab = useEnterLikeTab;
@@ -19,34 +18,16 @@ export default class GridEditionManager {
19
18
  this._enableGridInsert = enableGridInsert;
20
19
  this._customEditors = customEditors;
21
20
  this._customRenders = customRenders;
22
- this._lockerId = lockerId;
23
21
  }
24
22
  configureGrid(options) {
25
23
  this._gridOptions = options;
26
24
  options.readOnlyEdit = true;
27
25
  options.onCellEditRequest = evt => this.onCellEditRequest(evt);
28
- options.onCellEditingStarted = async (evt) => {
29
- var _a;
30
- if (this._dataUnit.hasNewRecord()) {
31
- this.handleCellEditingStartedRowAdd(evt);
32
- }
33
- else {
34
- this._lastCellOpened = this._lastCellEdited = { rowIndex: evt.rowIndex, column: evt.column, rowPinned: undefined };
35
- }
36
- (_a = this._currentEditLock) === null || _a === void 0 ? void 0 : _a.call(this);
37
- this._currentEditLock = LockManager.lock(this._lockerId, LockManagerOperation.TASKBAR_CLICK);
38
- };
39
- options.onCellEditingStopped = () => {
40
- var _a;
41
- (_a = this._currentEditLock) === null || _a === void 0 ? void 0 : _a.call(this);
42
- };
43
26
  options.onCellKeyDown = evt => {
44
27
  if (evt.event && evt["column"]) {
45
28
  this.onCellKeyDown(evt);
46
29
  }
47
30
  };
48
- options.isRowSelectable = (node) => this.isSelectableRow(node);
49
- options.onCellFocused = () => this.lockFocusWhenAddRow();
50
31
  return options;
51
32
  }
52
33
  updateCurrentEditorGuiValue(updatedRowValue) {
@@ -59,82 +40,37 @@ export default class GridEditionManager {
59
40
  const value = updatedRowValue[fieldName];
60
41
  currentEditor.setGuiValue(value);
61
42
  }
62
- lockFocusWhenAddRow() {
63
- var _a, _b, _c, _d;
64
- const api = this._gridOptions.api;
65
- const newFocusCell = api.getFocusedCell();
66
- const rowIndex = newFocusCell === null || newFocusCell === void 0 ? void 0 : newFocusCell.rowIndex;
67
- const recordId = (_b = (_a = this._dataUnit.getAddedRecords()) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.__record__id__;
68
- const rowNode = api.getRowNode(recordId);
69
- if (!this._dataUnit.hasNewRecord() || rowIndex == (rowNode === null || rowNode === void 0 ? void 0 : rowNode.rowIndex)) {
70
- return;
71
- }
72
- const lastCell = (_d = (_c = this._lastCellOpened) !== null && _c !== void 0 ? _c : this._lastCellEdited) !== null && _d !== void 0 ? _d : this._lastCellClicked;
73
- if ((lastCell === null || lastCell === void 0 ? void 0 : lastCell.rowIndex) < (rowNode === null || rowNode === void 0 ? void 0 : rowNode.rowIndex)) {
74
- return;
75
- }
76
- api.clearFocusedCell();
77
- if (!lastCell || (rowNode === null || rowNode === void 0 ? void 0 : rowNode.rowIndex) == undefined) {
78
- return;
79
- }
80
- lastCell.rowIndex = rowNode === null || rowNode === void 0 ? void 0 : rowNode.rowIndex;
81
- this.focusOnCell(lastCell);
82
- }
83
- handleCellEditingStartedRowAdd(evt) {
84
- var _a, _b, _c, _d, _e;
85
- const nodeId = (_a = evt.node) === null || _a === void 0 ? void 0 : _a.id;
86
- const addedRecordId = (_c = (_b = this._dataUnit.getAddedRecords()) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.__record__id__;
87
- if (nodeId == addedRecordId) {
88
- this._lastCellOpened = this._lastCellEdited = { rowIndex: evt.rowIndex, column: evt === null || evt === void 0 ? void 0 : evt.column, rowPinned: undefined };
89
- return;
90
- }
91
- evt.api.stopEditing();
92
- const rowIndex = (_d = evt.api.getRowNode(addedRecordId)) === null || _d === void 0 ? void 0 : _d.rowIndex;
93
- this._lastCellOpened = this._lastCellEdited = { rowIndex: rowIndex, column: (_e = this._lastCellEdited) === null || _e === void 0 ? void 0 : _e.column, rowPinned: undefined };
94
- }
95
- isSelectableRow(node) {
96
- if (!this._dataUnit.hasNewRecord()) {
97
- return true;
98
- }
99
- if (!this._dataUnit.isNewRecord(node.id)) {
100
- return false;
101
- }
102
- return true;
103
- }
104
43
  canContinuousInsert() {
105
44
  var _a;
106
45
  return this._enableContinuousInsert && (this._dataUnit.records.length - 1) === ((_a = this._lastCellEdited) === null || _a === void 0 ? void 0 : _a.rowIndex);
107
46
  }
108
- async proceedAutoSave() {
47
+ proceedAutoSave() {
109
48
  if (!this._dataUnit.isDirty()) {
110
49
  this.saveSuccess();
111
- return true;
112
- }
113
- const currentRecord = this._dataUnit.getSelectedRecord();
114
- if (currentRecord == undefined) {
115
- return true;
50
+ return;
116
51
  }
117
- this.clearInvalidCells(false);
118
- try {
119
- await this._recordValidationProcessor.validate(true);
120
- await this.saveDataUnit();
121
- this.saveSuccess();
122
- return true;
52
+ if (!this._isGridEdition) {
53
+ return;
123
54
  }
124
- catch (reason) {
125
- this.saveFail(reason);
126
- return false;
55
+ const currentRercord = this._dataUnit.getSelectedRecord();
56
+ if (currentRercord == undefined) {
57
+ return;
127
58
  }
128
- }
129
- async saveDataUnit() {
130
- await this._dataUnit.saveData();
131
- return true;
59
+ this._invalidCell = undefined;
60
+ this._recordValidationProcessor
61
+ .validate(true)
62
+ .then(() => {
63
+ this._dataUnit.saveData()
64
+ .then(() => this.saveSuccess())
65
+ .catch(reason => this.saveFail(reason));
66
+ })
67
+ .catch(reason => this.saveFail(reason));
132
68
  }
133
69
  async recordValidate() {
134
70
  if (!this._dataUnit.isDirty())
135
71
  return;
136
72
  try {
137
- this.clearInvalidCells(false);
73
+ this._invalidCell = undefined;
138
74
  await this._recordValidationProcessor.validate(false);
139
75
  }
140
76
  catch (error) { }
@@ -162,13 +98,6 @@ export default class GridEditionManager {
162
98
  return { ezCellEditor: EzCellEditor };
163
99
  }
164
100
  verifyClickToEdition(api, cellClicked) {
165
- var _a, _b;
166
- const selectedRecordID = (_a = this._dataUnit.getSelectedRecord()) === null || _a === void 0 ? void 0 : _a.__record__id__;
167
- if (this._dataUnit.hasNewRecord() && selectedRecordID) {
168
- const dataUnitRecordIndex = (_b = api.getRowNode(selectedRecordID)) === null || _b === void 0 ? void 0 : _b.rowIndex;
169
- if (dataUnitRecordIndex != cellClicked.rowIndex)
170
- return;
171
- }
172
101
  if (this.isSecondClick(cellClicked)) {
173
102
  api.startEditingCell({ rowIndex: cellClicked.rowIndex, colKey: cellClicked.column.getColId() });
174
103
  }
@@ -178,9 +107,6 @@ export default class GridEditionManager {
178
107
  col.cellEditor = 'ezCellEditor';
179
108
  col.editable = params => this.canEdit(params);
180
109
  col.suppressKeyboardEvent = (params) => {
181
- if (params.event.key === KeyCode.ESCAPE && params.editing) {
182
- return this._dataUnit.isDirty();
183
- }
184
110
  return params.event.key === KeyCode.ENTER;
185
111
  };
186
112
  col.cellEditorSelector = (params) => {
@@ -210,21 +136,10 @@ export default class GridEditionManager {
210
136
  return col;
211
137
  }
212
138
  getRequiredFields() {
213
- const formRequiredFields = this.getFormRequiredFields();
214
- return this._gridOptions.columnApi.getAllDisplayedColumns()
215
- .filter(column => {
216
- const fieldDefinition = this._dataUnit.getField(column.getColId());
217
- return (fieldDefinition && fieldDefinition.required) || formRequiredFields.includes(column.getColId());
218
- })
219
- .map(column => column.getColId());
220
- }
221
- getFormRequiredFields() {
222
- const formRequiredFields = [];
223
- const dataBinders = DataBinder.getDataBindersByDataUnit(this._dataUnit);
224
- dataBinders.forEach(dataBinder => {
225
- formRequiredFields.push(...dataBinder.getFormRequiredFields());
226
- });
227
- return formRequiredFields;
139
+ return this._gridOptions.columnApi.getAllDisplayedColumns().filter(c => {
140
+ const fieldDefinition = this._dataUnit.getField(c.getColId());
141
+ return fieldDefinition && fieldDefinition.required;
142
+ }).map(c => c.getColId());
228
143
  }
229
144
  saveSuccess() {
230
145
  var _a;
@@ -237,11 +152,10 @@ export default class GridEditionManager {
237
152
  this._isGridEdition = false;
238
153
  }
239
154
  saveFail(reason) {
240
- var _a;
241
- this.focusOnCell((_a = this._lastCellOpened) !== null && _a !== void 0 ? _a : this._lastCellEdited);
155
+ this.focusOnCell(this._lastCellEdited);
242
156
  this._isGridEdition = false;
243
157
  if (reason) {
244
- throw reason;
158
+ Promise.reject(reason);
245
159
  }
246
160
  }
247
161
  focusOnCell(cell) {
@@ -306,9 +220,6 @@ export default class GridEditionManager {
306
220
  this.moveEditionVertically(api, 1);
307
221
  }
308
222
  moveEditionVertically(api, offset) {
309
- if (this._dataUnit.hasNewRecord() && this._isGridEdition) {
310
- return;
311
- }
312
223
  const editionCell = api.getEditingCells()[0];
313
224
  if (!editionCell) {
314
225
  return;
@@ -353,63 +264,41 @@ export default class GridEditionManager {
353
264
  return true;
354
265
  }
355
266
  onCellEditRequest(event) {
356
- var _a;
357
- const value = event.newValue;
358
- if (event.oldValue == value) {
359
- (_a = this._currentEditLock) === null || _a === void 0 ? void 0 : _a.call(this);
360
- return;
361
- }
362
- if (value instanceof Promise) {
363
- this.handlePromiseValue(event, value);
364
- return;
365
- }
366
- this.updateCellValue(event, value);
367
- }
368
- async handlePromiseValue(event, value) {
369
- const fieldName = event.colDef.field;
370
- const fieldDescriptor = this._dataUnit.getField(event.colDef.colId);
371
- const initialValue = (fieldDescriptor === null || fieldDescriptor === void 0 ? void 0 : fieldDescriptor.userInterface) === UserInterface.SEARCH ? value : event.oldValue;
372
- event.node.setData(Object.assign(Object.assign({}, event.data), { [fieldName]: initialValue }));
373
- const resolved = await value;
374
- return this.updateCellValue(event, resolved);
375
- }
376
- updateCellValue(event, newValue) {
377
- var _a;
378
267
  const fieldName = event.colDef.field;
379
- event.node.setData(Object.assign(Object.assign({}, event.data), { [fieldName]: newValue }));
380
- (_a = this._currentEditLock) === null || _a === void 0 ? void 0 : _a.call(this);
381
- if (event.oldValue !== newValue) {
268
+ const value = event.newValue;
269
+ if (event.oldValue != value) {
270
+ if (value instanceof Promise) {
271
+ const fieldDescriptor = this._dataUnit.getField(event.colDef.colId);
272
+ event.node.setData(Object.assign(Object.assign({}, event.data), { [fieldName]: (fieldDescriptor === null || fieldDescriptor === void 0 ? void 0 : fieldDescriptor.userInterface) === UserInterface.SEARCH ? value : event.oldValue }));
273
+ value.then(resolved => event.node.setData(Object.assign(Object.assign({}, event.data), { [fieldName]: resolved })));
274
+ }
275
+ else {
276
+ event.node.setData(Object.assign(Object.assign({}, event.data), { [fieldName]: value }));
277
+ }
382
278
  this._isGridEdition = true;
383
- this._dataUnit.setFieldValue(fieldName, newValue, [event.data.__record__id__], { suppressCreateNewRecord: true });
279
+ this._dataUnit.setFieldValue(fieldName, value, [event.data.__record__id__], { suppressCreateNewRecord: true });
384
280
  this._lastCellEdited = { rowIndex: event.rowIndex, column: event.column, rowPinned: undefined };
385
281
  }
386
282
  }
387
283
  setCellEditors(customEditors) {
388
- var _a;
389
284
  this._customEditors = customEditors;
390
- (_a = this._gridOptions) === null || _a === void 0 ? void 0 : _a.api.stopEditing();
391
285
  }
392
286
  setCellRenders(customRenders) {
393
287
  this._customRenders = customRenders;
394
288
  }
395
- pushInvalidCell(invalidField, recordId) {
396
- this._invalidCells.push({ field: invalidField, recordId });
397
- this._nextInvalidCell = this._invalidCells[0];
398
- }
399
- getInvalidCells() {
400
- return this._invalidCells;
289
+ setInvalidCell(invalidCell, recordId) {
290
+ this._invalidCell = { field: invalidCell, recordId };
401
291
  }
402
- getNextInvalidCell() {
403
- return this._nextInvalidCell;
292
+ getInvalidCell() {
293
+ return this._invalidCell;
404
294
  }
405
- async processContinuousInsert() {
295
+ processContinuousInsert() {
406
296
  if (!this.canContinuousInsert())
407
297
  return;
408
298
  this._dataUnit.addRecord();
409
299
  }
410
300
  clearInvalidCells(stopEdition) {
411
- this._invalidCells = [];
412
- this._nextInvalidCell = undefined;
301
+ this._invalidCell = undefined;
413
302
  if (stopEdition) {
414
303
  this._isGridEdition = false;
415
304
  }
@@ -420,17 +309,10 @@ export default class GridEditionManager {
420
309
  hasInvalidField(fieldName, recordId) {
421
310
  if (!this.hasInvalidCell())
422
311
  return false;
423
- this._nextInvalidCell = this._invalidCells[0];
424
- const containsFieldName = this._nextInvalidCell.field.name === fieldName;
425
- const containsRecordId = this._nextInvalidCell.recordId === recordId;
426
- return containsFieldName && containsRecordId;
312
+ return this._invalidCell.field.name === fieldName && this._invalidCell.recordId === recordId;
427
313
  }
428
314
  hasInvalidCell() {
429
- var _a, _b, _c;
430
- const hasInvalidCell = ((_a = this._invalidCells) === null || _a === void 0 ? void 0 : _a.length) > 0;
431
- const hasField = (_b = this._invalidCells) === null || _b === void 0 ? void 0 : _b.filter(invalidCell => { invalidCell.field; });
432
- const hasRecordId = (_c = this._invalidCells) === null || _c === void 0 ? void 0 : _c.filter(invalidCell => { invalidCell.recordId; });
433
- if (!hasInvalidCell || !hasField || !hasRecordId)
315
+ if (!this._invalidCell || !this._invalidCell.field || !this._invalidCell.recordId)
434
316
  return false;
435
317
  return true;
436
318
  }
@@ -2,7 +2,6 @@ import { HTMLBuilder } from "@sankhyalabs/core";
2
2
  import { CustomEditorSource } from "../../../../../utils/customEditor/interfaces/ICustomEditor";
3
3
  import EzCellEditor from "../editor/EzCellEditor";
4
4
  import { getViewPortHeight } from "../editor/GridEditorUtils";
5
- import FocusResolver from "../../../../../utils/FocusResolver";
6
5
  export default class EzGridCustomCellEditor extends EzCellEditor {
7
6
  init(params) {
8
7
  var _a, _b;
@@ -66,10 +65,4 @@ export default class EzGridCustomCellEditor extends EzCellEditor {
66
65
  return this._customGui.value;
67
66
  return this._value;
68
67
  }
69
- afterGuiAttached() {
70
- this.focusIn();
71
- }
72
- focusIn() {
73
- FocusResolver.resolveFocus(this._customGui);
74
- }
75
68
  }
@@ -19,7 +19,6 @@ export const buildComboBox = ({ required, props, eGridCell }) => {
19
19
  combo.options = options;
20
20
  combo.stopPropagateEnterKeyEvent = true;
21
21
  combo.listOptionsPosition = { verticalPosition: 29, bottomLimit: getViewPortHeight(eGridCell), hardPosition: true };
22
- combo.autoFocus = true;
23
22
  return combo;
24
23
  };
25
24
  export const buildSwitch = (fieldMetadata) => {
@@ -7,7 +7,6 @@ export const buildDate = () => {
7
7
  data-is-fixed="true"
8
8
  />`);
9
9
  dateInput.valueGetter = () => dateInput.getValueAsync();
10
- dateInput.autoFocus = true;
11
10
  return dateInput;
12
11
  };
13
12
  export const buildTime = ({ readOnly }) => {
@@ -17,6 +17,5 @@ function buildNumeric(readOnly, precision, prettyPrecision) {
17
17
  mode="slim"
18
18
  />`);
19
19
  input.valueGetter = () => input.getValueAsync();
20
- input.autoFocus = true;
21
20
  return input;
22
21
  }
@@ -13,7 +13,6 @@ export const buildSearch = ({ name, required, readOnly, eGridCell, dataUnit }) =
13
13
  ezSearch.suppressPreLoad = true;
14
14
  ezSearch.listOptionsPosition = { verticalPosition: 29, bottomLimit: getViewPortHeight(eGridCell), hardPosition: true };
15
15
  ezSearch.stopPropagateEnterKeyEvent = true;
16
- ezSearch.autoFocus = true;
17
16
  ezSearch.valueGetter = () => ezSearch.getValueAsync();
18
17
  return ezSearch;
19
18
  };
@@ -2,14 +2,12 @@ import { HTMLBuilder } from "@sankhyalabs/core";
2
2
  const MINIMIUM_WIDTH_TEXTAREA = 210;
3
3
  const PADDING_VALUE_TEXTAREA = 12;
4
4
  export const buildTextInput = ({ name, contextName }) => {
5
- const textInput = HTMLBuilder.parseElement(`<ez-text-input
5
+ return HTMLBuilder.parseElement(`<ez-text-input
6
6
  class="ez-grid grid_editor"
7
7
  data-field-name=${name}
8
8
  data-context-name=${contextName}
9
9
  mode="slim"
10
10
  />`);
11
- textInput.autoFocus = true;
12
- return textInput;
13
11
  };
14
12
  export const buildTextAreaInput = ({ eGridCell, editionManager }) => {
15
13
  const element = HTMLBuilder.parseElement(`<ez-text-area
@@ -19,7 +17,6 @@ export const buildTextAreaInput = ({ eGridCell, editionManager }) => {
19
17
  element.addEventListener('keydown', event => handlePressEnterEvent(event, element, editionManager));
20
18
  setElementInitialWidth(eGridCell, element);
21
19
  element.isPopUp = true;
22
- element.autoFocus = true;
23
20
  return element;
24
21
  };
25
22
  function setElementInitialWidth(eGridCell, element) {
@@ -39,7 +39,6 @@ export class EzGrid {
39
39
  this.paginationCounterMode = 'show';
40
40
  this.enableGridInsert = false;
41
41
  this.enableContinuousInsert = true;
42
- this.enableLockManger = true;
43
42
  }
44
43
  /**
45
44
  * Aplica a definição de colunas.
@@ -164,18 +163,6 @@ export class EzGrid {
164
163
  async setFocus() {
165
164
  this._gridController.setFocus();
166
165
  }
167
- /**
168
- * Para a edição da grade.
169
- */
170
- async stopEdit() {
171
- this._gridController.stopEdit();
172
- }
173
- async checkStopEditOutsideClick(event) {
174
- var _a;
175
- if ((_a = this._container) === null || _a === void 0 ? void 0 : _a.contains(event.target))
176
- return;
177
- this._gridController.stopEdit();
178
- }
179
166
  observeConfig(config) {
180
167
  this._gridController.setColumnsState(config === null || config === void 0 ? void 0 : config.columns);
181
168
  }
@@ -201,9 +188,6 @@ export class EzGrid {
201
188
  this.setSelection(this.dataUnit.getSelectionInfo());
202
189
  }
203
190
  }
204
- async handleClick(event) {
205
- this.checkStopEditOutsideClick(event);
206
- }
207
191
  setSelection(selectionInfo) {
208
192
  var _a;
209
193
  this._selectionCount = (_a = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.length) !== null && _a !== void 0 ? _a : 0;
@@ -359,7 +343,7 @@ export class EzGrid {
359
343
  resetPaginationState() {
360
344
  var _a;
361
345
  this._paginationChangedByKeyboard = false;
362
- (_a = this._gridController) === null || _a === void 0 ? void 0 : _a.resetPaginationState();
346
+ (_a = this._gridApi) === null || _a === void 0 ? void 0 : _a.clearRangeSelection();
363
347
  }
364
348
  resolvePaginationClassMode() {
365
349
  if (this.paginationCounterMode == 'show')
@@ -400,8 +384,7 @@ export class EzGrid {
400
384
  if (this.dataUnit) {
401
385
  this.setSelection(this.dataUnit.getSelectionInfo());
402
386
  }
403
- },
404
- enableLockManger: this.enableLockManger
387
+ }
405
388
  });
406
389
  if (this.config) {
407
390
  this.observeConfig(this.config);
@@ -473,13 +456,8 @@ export class EzGrid {
473
456
  this._refPaginationLabelTooltip.removeAttribute('data-tooltip');
474
457
  }
475
458
  disconnectedCallback() {
476
- var _a, _b;
477
- (_a = this._headerOverflowWatcher) === null || _a === void 0 ? void 0 : _a.destroy();
478
- (_b = this._gridController) === null || _b === void 0 ? void 0 : _b.destroy();
479
- }
480
- connectedCallback() {
481
459
  var _a;
482
- (_a = this._gridController) === null || _a === void 0 ? void 0 : _a.registryListeners();
460
+ (_a = this._headerOverflowWatcher) === null || _a === void 0 ? void 0 : _a.destroy();
483
461
  }
484
462
  componentWillRender() {
485
463
  this.configSelectionCounter();
@@ -800,24 +778,6 @@ export class EzGrid {
800
778
  "attribute": "enable-continuous-insert",
801
779
  "reflect": false,
802
780
  "defaultValue": "true"
803
- },
804
- "enableLockManger": {
805
- "type": "boolean",
806
- "mutable": false,
807
- "complexType": {
808
- "original": "boolean",
809
- "resolved": "boolean",
810
- "references": {}
811
- },
812
- "required": false,
813
- "optional": true,
814
- "docs": {
815
- "tags": [],
816
- "text": "Ativa inser\u00E7\u00E3o de registros no modo grade."
817
- },
818
- "attribute": "enable-lock-manger",
819
- "reflect": false,
820
- "defaultValue": "true"
821
781
  }
822
782
  };
823
783
  }
@@ -1322,47 +1282,6 @@ export class EzGrid {
1322
1282
  "text": "Atribui o foco para a grade.",
1323
1283
  "tags": []
1324
1284
  }
1325
- },
1326
- "stopEdit": {
1327
- "complexType": {
1328
- "signature": "() => Promise<void>",
1329
- "parameters": [],
1330
- "references": {
1331
- "Promise": {
1332
- "location": "global"
1333
- }
1334
- },
1335
- "return": "Promise<void>"
1336
- },
1337
- "docs": {
1338
- "text": "Para a edi\u00E7\u00E3o da grade.",
1339
- "tags": []
1340
- }
1341
- },
1342
- "checkStopEditOutsideClick": {
1343
- "complexType": {
1344
- "signature": "(event: MouseEvent) => Promise<void>",
1345
- "parameters": [{
1346
- "tags": [],
1347
- "text": ""
1348
- }],
1349
- "references": {
1350
- "Promise": {
1351
- "location": "global"
1352
- },
1353
- "MouseEvent": {
1354
- "location": "global"
1355
- },
1356
- "Node": {
1357
- "location": "global"
1358
- }
1359
- },
1360
- "return": "Promise<void>"
1361
- },
1362
- "docs": {
1363
- "text": "",
1364
- "tags": []
1365
- }
1366
1285
  }
1367
1286
  };
1368
1287
  }
@@ -1386,12 +1305,6 @@ export class EzGrid {
1386
1305
  "target": undefined,
1387
1306
  "capture": false,
1388
1307
  "passive": false
1389
- }, {
1390
- "name": "click",
1391
- "method": "handleClick",
1392
- "target": undefined,
1393
- "capture": true,
1394
- "passive": false
1395
1308
  }];
1396
1309
  }
1397
1310
  }