@sankhyalabs/ezui 5.22.0-dev.37 → 5.22.0-dev.39

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 (221) hide show
  1. package/dist/cjs/DataBinder-aff1dcc7.js +445 -0
  2. package/dist/cjs/FocusResolver-885f2173.js +35 -0
  3. package/dist/cjs/ez-actions-button.cjs.entry.js +1 -1
  4. package/dist/cjs/ez-alert-list.cjs.entry.js +1 -1
  5. package/dist/cjs/ez-alert.cjs.entry.js +1 -1
  6. package/dist/cjs/ez-application.cjs.entry.js +1 -1
  7. package/dist/cjs/ez-badge.cjs.entry.js +1 -1
  8. package/dist/cjs/ez-breadcrumb.cjs.entry.js +1 -1
  9. package/dist/cjs/ez-button.cjs.entry.js +1 -1
  10. package/dist/cjs/ez-calendar.cjs.entry.js +1 -1
  11. package/dist/cjs/ez-card-item_3.cjs.entry.js +9 -3
  12. package/dist/cjs/ez-chart.cjs.entry.js +1 -1
  13. package/dist/cjs/ez-check.cjs.entry.js +1 -1
  14. package/dist/cjs/ez-chip.cjs.entry.js +1 -1
  15. package/dist/cjs/ez-collapsible-box.cjs.entry.js +1 -1
  16. package/dist/cjs/ez-combo-box.cjs.entry.js +47 -11
  17. package/dist/cjs/ez-custom-form-input_2.cjs.entry.js +2 -2
  18. package/dist/cjs/ez-date-input.cjs.entry.js +9 -3
  19. package/dist/cjs/ez-date-time-input.cjs.entry.js +9 -3
  20. package/dist/cjs/ez-dialog.cjs.entry.js +10 -2
  21. package/dist/cjs/ez-dropdown_2.cjs.entry.js +1 -1
  22. package/dist/cjs/ez-file-item.cjs.entry.js +1 -1
  23. package/dist/cjs/ez-form-view.cjs.entry.js +1 -1
  24. package/dist/cjs/ez-form.cjs.entry.js +4 -325
  25. package/dist/cjs/ez-grid.cjs.entry.js +255 -63
  26. package/dist/cjs/ez-guide-navigator.cjs.entry.js +1 -1
  27. package/dist/cjs/ez-icon.cjs.entry.js +1 -1
  28. package/dist/cjs/ez-list.cjs.entry.js +1 -1
  29. package/dist/cjs/ez-loading-bar.cjs.entry.js +1 -1
  30. package/dist/cjs/ez-modal-container.cjs.entry.js +1 -1
  31. package/dist/cjs/ez-modal.cjs.entry.js +1 -1
  32. package/dist/cjs/ez-multi-selection-list.cjs.entry.js +1 -1
  33. package/dist/cjs/ez-number-input.cjs.entry.js +8 -1
  34. package/dist/cjs/ez-popover.cjs.entry.js +1 -1
  35. package/dist/cjs/ez-popup.cjs.entry.js +1 -1
  36. package/dist/cjs/ez-radio-button.cjs.entry.js +1 -1
  37. package/dist/cjs/ez-scroller_2.cjs.entry.js +1 -1
  38. package/dist/cjs/ez-search.cjs.entry.js +29 -13
  39. package/dist/cjs/ez-sidebar-navigator.cjs.entry.js +1 -1
  40. package/dist/cjs/ez-split-button.cjs.entry.js +1 -1
  41. package/dist/cjs/ez-split-item.cjs.entry.js +1 -1
  42. package/dist/cjs/ez-split-panel.cjs.entry.js +1 -1
  43. package/dist/cjs/ez-tabselector.cjs.entry.js +1 -1
  44. package/dist/cjs/ez-text-area.cjs.entry.js +7 -1
  45. package/dist/cjs/ez-text-input.cjs.entry.js +8 -2
  46. package/dist/cjs/ez-time-input.cjs.entry.js +7 -1
  47. package/dist/cjs/ez-toast.cjs.entry.js +1 -1
  48. package/dist/cjs/ez-tree.cjs.entry.js +1 -1
  49. package/dist/cjs/ez-upload.cjs.entry.js +1 -1
  50. package/dist/cjs/ez-view-stack.cjs.entry.js +1 -1
  51. package/dist/cjs/ezui.cjs.js +2 -2
  52. package/dist/cjs/filter-column.cjs.entry.js +1 -1
  53. package/dist/cjs/{index-a7b0c73d.js → index-9e5554cb.js} +3 -0
  54. package/dist/cjs/loader.cjs.js +2 -2
  55. package/dist/collection/collection-manifest.json +1 -1
  56. package/dist/collection/components/ez-combo-box/ez-combo-box.js +75 -14
  57. package/dist/collection/components/ez-date-input/ez-date-input.js +35 -4
  58. package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +35 -4
  59. package/dist/collection/components/ez-dialog/ez-dialog.js +9 -1
  60. package/dist/collection/components/ez-filter-input/ez-filter-input.js +35 -4
  61. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +52 -14
  62. package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +3 -0
  63. package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +166 -45
  64. package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.js +7 -0
  65. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/ComboBox.tpl.js +1 -0
  66. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/DateInput.tpl.js +1 -0
  67. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/NumberInput.tpl.js +1 -0
  68. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/Search.tpl.js +1 -0
  69. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/TextInput.tpl.js +4 -1
  70. package/dist/collection/components/ez-grid/ez-grid.js +83 -1
  71. package/dist/collection/components/ez-number-input/ez-number-input.js +25 -0
  72. package/dist/collection/components/ez-search/ez-search.js +55 -14
  73. package/dist/collection/components/ez-text-area/ez-text-area.js +24 -0
  74. package/dist/collection/components/ez-text-input/ez-text-input.css +14 -38
  75. package/dist/collection/components/ez-text-input/ez-text-input.js +24 -0
  76. package/dist/collection/components/ez-time-input/ez-time-input.js +24 -0
  77. package/dist/collection/utils/FocusResolver.js +31 -0
  78. package/dist/collection/utils/form/DataBinder.js +18 -3
  79. package/dist/custom-elements/index.js +443 -103
  80. package/dist/esm/DataBinder-bd240826.js +441 -0
  81. package/dist/esm/FocusResolver-1ccbf850.js +33 -0
  82. package/dist/esm/ez-actions-button.entry.js +1 -1
  83. package/dist/esm/ez-alert-list.entry.js +1 -1
  84. package/dist/esm/ez-alert.entry.js +1 -1
  85. package/dist/esm/ez-application.entry.js +1 -1
  86. package/dist/esm/ez-badge.entry.js +1 -1
  87. package/dist/esm/ez-breadcrumb.entry.js +1 -1
  88. package/dist/esm/ez-button.entry.js +1 -1
  89. package/dist/esm/ez-calendar.entry.js +1 -1
  90. package/dist/esm/ez-card-item_3.entry.js +9 -3
  91. package/dist/esm/ez-chart.entry.js +1 -1
  92. package/dist/esm/ez-check.entry.js +1 -1
  93. package/dist/esm/ez-chip.entry.js +1 -1
  94. package/dist/esm/ez-collapsible-box.entry.js +1 -1
  95. package/dist/esm/ez-combo-box.entry.js +48 -12
  96. package/dist/esm/ez-custom-form-input_2.entry.js +2 -2
  97. package/dist/esm/ez-date-input.entry.js +9 -3
  98. package/dist/esm/ez-date-time-input.entry.js +9 -3
  99. package/dist/esm/ez-dialog.entry.js +10 -2
  100. package/dist/esm/ez-dropdown_2.entry.js +1 -1
  101. package/dist/esm/ez-file-item.entry.js +1 -1
  102. package/dist/esm/ez-form-view.entry.js +1 -1
  103. package/dist/esm/ez-form.entry.js +3 -324
  104. package/dist/esm/ez-grid.entry.js +254 -62
  105. package/dist/esm/ez-guide-navigator.entry.js +1 -1
  106. package/dist/esm/ez-icon.entry.js +1 -1
  107. package/dist/esm/ez-list.entry.js +1 -1
  108. package/dist/esm/ez-loading-bar.entry.js +1 -1
  109. package/dist/esm/ez-modal-container.entry.js +1 -1
  110. package/dist/esm/ez-modal.entry.js +1 -1
  111. package/dist/esm/ez-multi-selection-list.entry.js +1 -1
  112. package/dist/esm/ez-number-input.entry.js +8 -1
  113. package/dist/esm/ez-popover.entry.js +1 -1
  114. package/dist/esm/ez-popup.entry.js +1 -1
  115. package/dist/esm/ez-radio-button.entry.js +1 -1
  116. package/dist/esm/ez-scroller_2.entry.js +1 -1
  117. package/dist/esm/ez-search.entry.js +29 -13
  118. package/dist/esm/ez-sidebar-navigator.entry.js +1 -1
  119. package/dist/esm/ez-split-button.entry.js +1 -1
  120. package/dist/esm/ez-split-item.entry.js +1 -1
  121. package/dist/esm/ez-split-panel.entry.js +1 -1
  122. package/dist/esm/ez-tabselector.entry.js +1 -1
  123. package/dist/esm/ez-text-area.entry.js +7 -1
  124. package/dist/esm/ez-text-input.entry.js +8 -2
  125. package/dist/esm/ez-time-input.entry.js +7 -1
  126. package/dist/esm/ez-toast.entry.js +1 -1
  127. package/dist/esm/ez-tree.entry.js +1 -1
  128. package/dist/esm/ez-upload.entry.js +1 -1
  129. package/dist/esm/ez-view-stack.entry.js +1 -1
  130. package/dist/esm/ezui.js +3 -3
  131. package/dist/esm/filter-column.entry.js +1 -1
  132. package/dist/esm/{index-baa5e267.js → index-5a720e56.js} +3 -1
  133. package/dist/esm/loader.js +3 -3
  134. package/dist/ezui/ezui.esm.js +1 -1
  135. package/dist/ezui/{p-44caad9a.entry.js → p-0378416a.entry.js} +1 -1
  136. package/dist/ezui/{p-5b205c80.entry.js → p-044d46d5.entry.js} +1 -1
  137. package/dist/ezui/p-076e868b.entry.js +1 -0
  138. package/dist/ezui/{p-b54e17d2.entry.js → p-0e1cc2d1.entry.js} +1 -1
  139. package/dist/ezui/{p-1285c902.entry.js → p-11b09aa1.entry.js} +1 -1
  140. package/dist/ezui/{p-77a4bd35.entry.js → p-11bfeca3.entry.js} +1 -1
  141. package/dist/ezui/p-16e21a40.entry.js +1 -0
  142. package/dist/ezui/{p-8888d9ed.entry.js → p-1b08bf3c.entry.js} +1 -1
  143. package/dist/ezui/p-2c3ac210.entry.js +1 -0
  144. package/dist/ezui/{p-abce5219.entry.js → p-2de9f0aa.entry.js} +1 -1
  145. package/dist/ezui/{p-baf80b13.entry.js → p-30951bd7.entry.js} +1 -1
  146. package/dist/ezui/{p-a2e5b8c3.entry.js → p-3b546374.entry.js} +1 -1
  147. package/dist/ezui/{p-37219d42.entry.js → p-3cc9b84a.entry.js} +1 -1
  148. package/dist/ezui/p-3d38bfea.entry.js +1 -0
  149. package/dist/ezui/{p-7bc07c31.entry.js → p-3f8c33e0.entry.js} +1 -1
  150. package/dist/ezui/{p-cdc472cc.entry.js → p-52100a6e.entry.js} +1 -1
  151. package/dist/ezui/{p-6d79930d.entry.js → p-554522db.entry.js} +1 -1
  152. package/dist/ezui/{p-1f50fa05.entry.js → p-6b51c9cc.entry.js} +1 -1
  153. package/dist/ezui/p-6bc25bc8.entry.js +1 -0
  154. package/dist/ezui/p-6ec40dec.entry.js +1 -0
  155. package/dist/ezui/{p-5ed81457.entry.js → p-6fc26622.entry.js} +1 -1
  156. package/dist/ezui/{p-f9e551de.entry.js → p-70f1c812.entry.js} +1 -1
  157. package/dist/ezui/{p-555c9018.entry.js → p-7567ccdd.entry.js} +1 -1
  158. package/dist/ezui/{p-bfad39eb.entry.js → p-7f5afb1f.entry.js} +1 -1
  159. package/dist/ezui/p-802dc63e.entry.js +1 -0
  160. package/dist/ezui/{p-1e7a8633.entry.js → p-81461d2f.entry.js} +1 -1
  161. package/dist/ezui/p-81f06699.js +1 -0
  162. package/dist/ezui/{p-8df1ca33.entry.js → p-82fa4b09.entry.js} +1 -1
  163. package/dist/ezui/{p-bcb53f27.entry.js → p-868b56f7.entry.js} +1 -1
  164. package/dist/ezui/{p-09de35a2.entry.js → p-91ccae0c.entry.js} +1 -1
  165. package/dist/ezui/{p-c0d9c4f8.entry.js → p-92748142.entry.js} +1 -1
  166. package/dist/ezui/p-940760bf.entry.js +1 -0
  167. package/dist/ezui/{p-c4320a39.entry.js → p-a563df31.entry.js} +1 -1
  168. package/dist/ezui/{p-990b4318.entry.js → p-a921e3e7.entry.js} +1 -1
  169. package/dist/ezui/{p-17be134a.entry.js → p-b2f6bc0a.entry.js} +1 -1
  170. package/dist/ezui/{p-c3045972.entry.js → p-b858fc6e.entry.js} +1 -1
  171. package/dist/ezui/p-be34c77f.entry.js +1 -0
  172. package/dist/ezui/{p-e347df9c.entry.js → p-bef7daac.entry.js} +1 -1
  173. package/dist/ezui/p-bfc30e61.entry.js +1 -0
  174. package/dist/ezui/p-bfc59380.entry.js +1 -0
  175. package/dist/ezui/{p-9f5fa3f9.entry.js → p-c2b20f78.entry.js} +1 -1
  176. package/dist/ezui/p-dc628ed3.js +1 -0
  177. package/dist/ezui/{p-a80b1287.entry.js → p-dfca5946.entry.js} +1 -1
  178. package/dist/ezui/{p-7fdd479f.entry.js → p-e18d9e6a.entry.js} +1 -1
  179. package/dist/ezui/{p-9d9ecb7c.entry.js → p-e3ec7422.entry.js} +1 -1
  180. package/dist/ezui/{p-23a36bb6.js → p-e4c7eb39.js} +2 -2
  181. package/dist/ezui/{p-0306dff7.entry.js → p-e6b38ade.entry.js} +1 -1
  182. package/dist/ezui/{p-90bcd2ba.entry.js → p-e7395eae.entry.js} +1 -1
  183. package/dist/ezui/{p-650e4b6d.entry.js → p-f1c2c19e.entry.js} +1 -1
  184. package/dist/ezui/{p-6e429cff.entry.js → p-fc194825.entry.js} +1 -1
  185. package/dist/ezui/{p-c3c3d640.entry.js → p-fc8b1807.entry.js} +2 -2
  186. package/dist/ezui/p-fe10f986.entry.js +1 -0
  187. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +7 -1
  188. package/dist/types/components/ez-date-input/ez-date-input.d.ts +6 -1
  189. package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +6 -1
  190. package/dist/types/components/ez-dialog/ez-dialog.d.ts +2 -0
  191. package/dist/types/components/ez-filter-input/ez-filter-input.d.ts +6 -1
  192. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +10 -0
  193. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +4 -0
  194. package/dist/types/components/ez-grid/controller/ag-grid/GridEditionManager.d.ts +18 -6
  195. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.d.ts +2 -0
  196. package/dist/types/components/ez-grid/controller/ag-grid/editor/IUICellEditor.d.ts +1 -0
  197. package/dist/types/components/ez-grid/ez-grid.d.ts +10 -0
  198. package/dist/types/components/ez-number-input/ez-number-input.d.ts +4 -0
  199. package/dist/types/components/ez-search/ez-search.d.ts +6 -1
  200. package/dist/types/components/ez-text-area/ez-text-area.d.ts +4 -0
  201. package/dist/types/components/ez-text-input/ez-text-input.d.ts +4 -0
  202. package/dist/types/components/ez-time-input/ez-time-input.d.ts +4 -0
  203. package/dist/types/components.d.ts +91 -6
  204. package/dist/types/utils/FocusResolver.d.ts +5 -0
  205. package/dist/types/utils/form/DataBinder.d.ts +3 -0
  206. package/package.json +1 -1
  207. package/dist/cjs/RecordValidationProcessor-10846595.js +0 -108
  208. package/dist/esm/RecordValidationProcessor-9c6cc267.js +0 -105
  209. package/dist/ezui/p-0f3b2e67.entry.js +0 -1
  210. package/dist/ezui/p-10820c20.entry.js +0 -1
  211. package/dist/ezui/p-49456b34.entry.js +0 -1
  212. package/dist/ezui/p-5a90d7d1.entry.js +0 -1
  213. package/dist/ezui/p-62732269.entry.js +0 -1
  214. package/dist/ezui/p-b3b94f72.entry.js +0 -1
  215. package/dist/ezui/p-b95632e8.entry.js +0 -1
  216. package/dist/ezui/p-bc2f844e.entry.js +0 -1
  217. package/dist/ezui/p-c25f0e92.entry.js +0 -1
  218. package/dist/ezui/p-d2c06f38.entry.js +0 -1
  219. package/dist/ezui/p-e85c48d7.entry.js +0 -1
  220. package/dist/ezui/p-f299c608.entry.js +0 -1
  221. package/dist/ezui/p-f42855b9.js +0 -1
@@ -1,6 +1,7 @@
1
1
  import { h, forceUpdate, } from '@stencil/core';
2
2
  import { DialogType } from "./DialogType";
3
3
  import { ElementIDUtils, FloatingManager } from "@sankhyalabs/core";
4
+ import FocusResolver from '../../utils/FocusResolver';
4
5
  class Message {
5
6
  constructor(title, message, dialogType, confirm, icon, labelCancel, labelConfirm, btnConfirmDanger, callBack, beforeClose) {
6
7
  this.title = title;
@@ -164,6 +165,7 @@ export class EzDialog {
164
165
  const dialog = this._element.shadowRoot.querySelector('.overlay .dialog');
165
166
  if (dialog instanceof HTMLDivElement) {
166
167
  dialog.style.outline = 'none';
168
+ this._lastActiveElement = document.activeElement;
167
169
  dialog.focus();
168
170
  }
169
171
  }
@@ -176,7 +178,13 @@ export class EzDialog {
176
178
  focusOnPrimaryButton() {
177
179
  const btnConfirm = this._element.shadowRoot.querySelector(`#${this.PRIMARY_BUTTON_ID}`);
178
180
  const buttonElement = btnConfirm === null || btnConfirm === void 0 ? void 0 : btnConfirm.shadowRoot.querySelector('button');
179
- buttonElement === null || buttonElement === void 0 ? void 0 : buttonElement.focus();
181
+ requestAnimationFrame(() => {
182
+ buttonElement === null || buttonElement === void 0 ? void 0 : buttonElement.focus();
183
+ });
184
+ }
185
+ disconnectedCallback() {
186
+ FocusResolver.resolveFocus(this._lastActiveElement);
187
+ this._lastActiveElement = undefined;
180
188
  }
181
189
  render() {
182
190
  if (this.opened && this._currentMessage) {
@@ -21,6 +21,7 @@ export class EzFilterInput {
21
21
  this.mode = "regular";
22
22
  this.asyncSearch = false;
23
23
  this.canShowError = true;
24
+ this.autoFocus = false;
24
25
  }
25
26
  observeLabel() {
26
27
  if (this._textInput) {
@@ -41,8 +42,8 @@ export class EzFilterInput {
41
42
  /**
42
43
  * Aplica o foco no campo.
43
44
  */
44
- async setFocus() {
45
- this._textInput.setFocus();
45
+ async setFocus(options) {
46
+ this._textInput.setFocus(options);
46
47
  }
47
48
  /**
48
49
  * Remove o foco do campo.
@@ -95,6 +96,11 @@ export class EzFilterInput {
95
96
  }
96
97
  componentDidLoad() {
97
98
  CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
99
+ if (this.autoFocus) {
100
+ requestAnimationFrame(() => {
101
+ this.setFocus({ selectText: true });
102
+ });
103
+ }
98
104
  }
99
105
  render() {
100
106
  ElementIDUtils.addIDInfoIfNotExists(this._elem, 'input');
@@ -253,6 +259,24 @@ export class EzFilterInput {
253
259
  "attribute": "can-show-error",
254
260
  "reflect": true,
255
261
  "defaultValue": "true"
262
+ },
263
+ "autoFocus": {
264
+ "type": "boolean",
265
+ "mutable": false,
266
+ "complexType": {
267
+ "original": "boolean",
268
+ "resolved": "boolean",
269
+ "references": {}
270
+ },
271
+ "required": false,
272
+ "optional": false,
273
+ "docs": {
274
+ "tags": [],
275
+ "text": "Se true o campo de texto receber\u00E1 o foco ao ser renderizado."
276
+ },
277
+ "attribute": "auto-focus",
278
+ "reflect": false,
279
+ "defaultValue": "false"
256
280
  }
257
281
  };
258
282
  }
@@ -308,11 +332,18 @@ export class EzFilterInput {
308
332
  return {
309
333
  "setFocus": {
310
334
  "complexType": {
311
- "signature": "() => Promise<void>",
312
- "parameters": [],
335
+ "signature": "(options?: TFocusOptions) => Promise<void>",
336
+ "parameters": [{
337
+ "tags": [],
338
+ "text": ""
339
+ }],
313
340
  "references": {
314
341
  "Promise": {
315
342
  "location": "global"
343
+ },
344
+ "TFocusOptions": {
345
+ "location": "import",
346
+ "path": "../ez-text-input/ez-text-input"
316
347
  }
317
348
  },
318
349
  "return": "Promise<void>"
@@ -1,4 +1,4 @@
1
- import { ApplicationContext, DataType, MaskFormatter, NumberUtils, SortMode, StringUtils, UserInterface, } from '@sankhyalabs/core';
1
+ import { ApplicationContext, DataType, LockManager, MaskFormatter, NumberUtils, SortMode, StringUtils, UserInterface, } from '@sankhyalabs/core';
2
2
  import { Grid, } from 'ag-grid-community';
3
3
  import { Grid as EnterpriseGrid, LicenseManager } from 'ag-grid-enterprise';
4
4
  import DataSource from './DataSource';
@@ -121,6 +121,7 @@ export default class AgGridController {
121
121
  var _a;
122
122
  this._options = options;
123
123
  this._container = container;
124
+ const lockerId = options.enableLockManger ? LockManager.addLockManagerCtxId(this._container) : null;
124
125
  if (this._grid === undefined) {
125
126
  LicenseManager.setLicenseKey(ApplicationContext.getContextValue('__EZUI__GRID_LICENSE__'));
126
127
  this._columnStateChangeCallback = options.onColumnStateChange;
@@ -128,7 +129,7 @@ export default class AgGridController {
128
129
  this._doubleClickCallBack = options.onDoubleClick;
129
130
  this._multipleSelection = options.allowMultipleSelection;
130
131
  this._dataUnit = options.dataUnit;
131
- this._editionManager = new GridEditionManager(this._dataUnit, options.useEnterLikeTab, options.recordsValidator, options.editionIsDisabled, options.customEditors || this._customEditors, options.customRenders || this._customRenders, options.enableContinuousInsert, options.enableGridInsert);
132
+ this._editionManager = new GridEditionManager(this._dataUnit, options.useEnterLikeTab, options.recordsValidator, options.editionIsDisabled, options.customEditors || this._customEditors, options.customRenders || this._customRenders, options.enableContinuousInsert, options.enableGridInsert, lockerId);
132
133
  this._statusResolver = options.statusResolver;
133
134
  if (this._dataUnit) {
134
135
  this._dataUnit.sortingProvider = this;
@@ -491,7 +492,7 @@ export default class AgGridController {
491
492
  r.setData(data);
492
493
  });
493
494
  this._gridOptions.api.refreshCells({ force: true });
494
- const invalidCell = this._editionManager.getInvalidCell();
495
+ const invalidCell = this._editionManager.getNextInvalidCell();
495
496
  if (invalidCell) {
496
497
  const rowNode = this._gridOptions.api.getRowNode(invalidCell.recordId);
497
498
  if (rowNode && invalidCell.field) {
@@ -511,6 +512,7 @@ export default class AgGridController {
511
512
  if (this._grid === undefined) {
512
513
  throw new Error('Erro interno: Grid ainda não inicializado.');
513
514
  }
515
+ this._gridOptions.api.clearRangeSelection();
514
516
  this._gridOptions.api.refreshServerSide({ purge: true });
515
517
  this._options.onRefresh();
516
518
  if (scrollToSelectedRow)
@@ -533,12 +535,15 @@ export default class AgGridController {
533
535
  }
534
536
  setFocus() {
535
537
  var _a, _b;
536
- if ((_b = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.records) === null || _b === void 0 ? void 0 : _b.length) {
537
- this.setFocusFirstRow();
538
- }
539
- else {
538
+ if (!((_b = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.records) === null || _b === void 0 ? void 0 : _b.length)) {
540
539
  this.focusOnGridContainer();
540
+ return;
541
541
  }
542
+ if (!this._dataUnit.getSelectedRecord()) {
543
+ this.setFocusFirstRow();
544
+ return;
545
+ }
546
+ this.syncSelectWithDataUnit();
542
547
  }
543
548
  setAutoFocus(autoFocus) {
544
549
  var _a;
@@ -582,6 +587,23 @@ export default class AgGridController {
582
587
  this.startEditionOnRowByIndex(newRowIndex);
583
588
  }
584
589
  }
590
+ syncSelectWithDataUnit() {
591
+ const rowNode = this._gridOptions.api.getRowNode(this._dataUnit.getSelectedRecord().__record__id__);
592
+ if ((rowNode === null || rowNode === void 0 ? void 0 : rowNode.rowIndex) < 0)
593
+ return;
594
+ const rowRange = this._gridOptions.api.getCellRanges().find(row => row.startRow.rowIndex === rowNode.rowIndex);
595
+ if ((rowRange === null || rowRange === void 0 ? void 0 : rowRange.columns.length) > 0) {
596
+ if (this._dataUnit.hasNewRecord()) {
597
+ this.startEdition(rowNode.rowIndex, rowRange.columns[0]);
598
+ return;
599
+ }
600
+ this.focusByCollAndRow(rowRange.columns[0], rowNode.rowIndex);
601
+ this._gridOptions.api.addCellRange({ rowStartIndex: rowNode.rowIndex, rowEndIndex: rowNode.rowIndex, columns: rowRange.columns });
602
+ return;
603
+ }
604
+ this._gridOptions.api.clearRangeSelection();
605
+ this.setFocusOnRow(rowNode.rowIndex);
606
+ }
585
607
  startEdition(rowIndex, firstCol) {
586
608
  this._gridOptions.api.clearRangeSelection();
587
609
  this._gridOptions.api.addCellRange({ rowStartIndex: rowIndex, rowEndIndex: rowIndex, columns: [firstCol] });
@@ -612,6 +634,7 @@ export default class AgGridController {
612
634
  let displayedColumns = this._gridOptions.columnApi.getAllDisplayedColumns();
613
635
  let firstColl = displayedColumns.find(column => column.getColDef().headerName !== '');
614
636
  this.focusByCollAndRow(firstColl, rowIndex);
637
+ this._gridOptions.api.addCellRange({ rowStartIndex: rowIndex, rowEndIndex: rowIndex, columns: [firstColl] });
615
638
  }
616
639
  focusByCollAndRow(firstCell, rowIndex) {
617
640
  this._gridOptions.api.ensureColumnVisible(firstCell);
@@ -651,6 +674,14 @@ export default class AgGridController {
651
674
  this._gridOptions.api.setColumnDefs(this._colDefs);
652
675
  }
653
676
  }
677
+ hideSelectionColumn() {
678
+ var _a, _b;
679
+ (_b = (_a = this._gridOptions) === null || _a === void 0 ? void 0 : _a.columnApi) === null || _b === void 0 ? void 0 : _b.setColumnVisible(this.CHECK_BOX_COL_ID, false);
680
+ }
681
+ showSelectionColumn() {
682
+ var _a, _b;
683
+ (_b = (_a = this._gridOptions) === null || _a === void 0 ? void 0 : _a.columnApi) === null || _b === void 0 ? void 0 : _b.setColumnVisible(this.CHECK_BOX_COL_ID, true);
684
+ }
654
685
  getColumnsDef() {
655
686
  if (this._grid === undefined) {
656
687
  throw new Error('Erro interno: Grid ainda não inicializado.');
@@ -935,18 +966,24 @@ export default class AgGridController {
935
966
  return false;
936
967
  }
937
968
  onSelectionChange(event) {
969
+ var _a, _b;
970
+ const selectedRowId = (_b = (_a = event.api.getSelectedNodes()) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.id;
971
+ const isNewRecord = this._dataUnit.isNewRecord(selectedRowId);
938
972
  if (!this._selectionChangeCallback)
939
973
  return;
940
974
  clearTimeout(this._selectionChangeDeboucing);
941
- this._selectionChangeDeboucing = window.setTimeout(() => {
942
- this.handleExecuteProceedAutosave();
975
+ this._selectionChangeDeboucing = window.setTimeout(async () => {
976
+ const saveSuccess = (!isNewRecord && selectedRowId) ? await this.handleExecuteProceedAutosave() : true;
977
+ if (!saveSuccess)
978
+ return;
943
979
  this.processBuildSelectionChangeCallback(event);
944
980
  }, 0);
945
981
  }
946
- handleExecuteProceedAutosave() {
982
+ async handleExecuteProceedAutosave() {
947
983
  if (this._gridShowDom) {
948
- this._editionManager.proceedAutoSave();
984
+ return await this._editionManager.proceedAutoSave();
949
985
  }
986
+ return true;
950
987
  }
951
988
  processBuildSelectionChangeCallback(event) {
952
989
  if (this._dataUnit) {
@@ -971,7 +1008,7 @@ export default class AgGridController {
971
1008
  });
972
1009
  }
973
1010
  onRowDoubleClick(evt) {
974
- if (this._doubleClickCallBack) {
1011
+ if (this._doubleClickCallBack && (!this._options.enableGridInsert || !this._dataUnit.hasNewRecord())) {
975
1012
  this._doubleClickCallBack(evt.data);
976
1013
  }
977
1014
  }
@@ -987,13 +1024,11 @@ export default class AgGridController {
987
1024
  }
988
1025
  }
989
1026
  setCellEditors(customEditors) {
990
- var _a;
991
1027
  if (!this._editionManager) {
992
1028
  this._customEditors = customEditors;
993
1029
  return;
994
1030
  }
995
1031
  this._editionManager.setCellEditors(customEditors);
996
- (_a = this._gridOptions) === null || _a === void 0 ? void 0 : _a.api.redrawRows();
997
1032
  }
998
1033
  setCellRenders(customRenders) {
999
1034
  var _a;
@@ -1016,4 +1051,7 @@ export default class AgGridController {
1016
1051
  destroy() {
1017
1052
  this.observer.disconnect();
1018
1053
  }
1054
+ stopEdit() {
1055
+ this._gridOptions.api.stopEditing();
1056
+ }
1019
1057
  }
@@ -6,12 +6,14 @@ export default class DataSource {
6
6
  this._controller.clearInvalidCells();
7
7
  this.handleRefreshOrReload(action);
8
8
  this._controller.processContinuousInsert();
9
+ this._controller.showSelectionColumn();
9
10
  }
10
11
  handleEditionCanceled(action) {
11
12
  if (this._options.enableGridInsert) {
12
13
  this._controller.processEditionCanceled();
13
14
  }
14
15
  this.handleRefreshOrReload(action);
16
+ this._controller.showSelectionColumn();
15
17
  }
16
18
  handleSavingCanceled(action) {
17
19
  var _a, _b, _c, _d;
@@ -66,6 +68,7 @@ export default class DataSource {
66
68
  }
67
69
  handleRecordsAdded() {
68
70
  if (this._options.enableGridInsert) {
71
+ this._controller.hideSelectionColumn();
69
72
  this._controller.refresh();
70
73
  this.focusOnNewRecord();
71
74
  }
@@ -1,15 +1,16 @@
1
- import { UserInterface } from '@sankhyalabs/core';
1
+ import { LockManager, LockManagerOperation, UserInterface } from '@sankhyalabs/core';
2
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';
7
8
  export default class GridEditionManager {
8
- constructor(dataUnit, useEnterLikeTab, recordsValidator, editionIsDisabled, customEditors, customRenders, enableContinuousInsert, enableGridInsert) {
9
+ constructor(dataUnit, useEnterLikeTab, recordsValidator, editionIsDisabled, customEditors, customRenders, enableContinuousInsert, enableGridInsert, lockerId) {
9
10
  this._dataUnit = dataUnit;
10
11
  this._recordValidationProcessor = new RecordValidationProcessor(this._dataUnit, {
11
12
  getRequiredFields: () => this.getRequiredFields(),
12
- markAsInvalid: (invalidField, recordId) => { this.setInvalidCell(invalidField, recordId); },
13
+ markAsInvalid: (invalidField, recordId) => { this.pushInvalidCell(invalidField, recordId); },
13
14
  getMessageForField: () => null,
14
15
  }, recordsValidator);
15
16
  this._useEnterLikeTab = useEnterLikeTab;
@@ -18,16 +19,34 @@ export default class GridEditionManager {
18
19
  this._enableGridInsert = enableGridInsert;
19
20
  this._customEditors = customEditors;
20
21
  this._customRenders = customRenders;
22
+ this._lockerId = lockerId;
21
23
  }
22
24
  configureGrid(options) {
23
25
  this._gridOptions = options;
24
26
  options.readOnlyEdit = true;
25
27
  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
+ };
26
43
  options.onCellKeyDown = evt => {
27
44
  if (evt.event && evt["column"]) {
28
45
  this.onCellKeyDown(evt);
29
46
  }
30
47
  };
48
+ options.isRowSelectable = (node) => this.isSelectableRow(node);
49
+ options.onCellFocused = () => this.lockFocusWhenAddRow();
31
50
  return options;
32
51
  }
33
52
  updateCurrentEditorGuiValue(updatedRowValue) {
@@ -40,37 +59,82 @@ export default class GridEditionManager {
40
59
  const value = updatedRowValue[fieldName];
41
60
  currentEditor.setGuiValue(value);
42
61
  }
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
+ }
43
104
  canContinuousInsert() {
44
105
  var _a;
45
106
  return this._enableContinuousInsert && (this._dataUnit.records.length - 1) === ((_a = this._lastCellEdited) === null || _a === void 0 ? void 0 : _a.rowIndex);
46
107
  }
47
- proceedAutoSave() {
108
+ async proceedAutoSave() {
48
109
  if (!this._dataUnit.isDirty()) {
49
110
  this.saveSuccess();
50
- return;
111
+ return true;
51
112
  }
52
- if (!this._isGridEdition) {
53
- return;
113
+ const currentRecord = this._dataUnit.getSelectedRecord();
114
+ if (currentRecord == undefined) {
115
+ return true;
54
116
  }
55
- const currentRercord = this._dataUnit.getSelectedRecord();
56
- if (currentRercord == undefined) {
57
- return;
117
+ this.clearInvalidCells(false);
118
+ try {
119
+ await this._recordValidationProcessor.validate(true);
120
+ await this.saveDataUnit();
121
+ this.saveSuccess();
122
+ return true;
58
123
  }
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));
124
+ catch (reason) {
125
+ this.saveFail(reason);
126
+ return false;
127
+ }
128
+ }
129
+ async saveDataUnit() {
130
+ await this._dataUnit.saveData();
131
+ return true;
68
132
  }
69
133
  async recordValidate() {
70
134
  if (!this._dataUnit.isDirty())
71
135
  return;
72
136
  try {
73
- this._invalidCell = undefined;
137
+ this.clearInvalidCells(false);
74
138
  await this._recordValidationProcessor.validate(false);
75
139
  }
76
140
  catch (error) { }
@@ -98,6 +162,13 @@ export default class GridEditionManager {
98
162
  return { ezCellEditor: EzCellEditor };
99
163
  }
100
164
  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
+ }
101
172
  if (this.isSecondClick(cellClicked)) {
102
173
  api.startEditingCell({ rowIndex: cellClicked.rowIndex, colKey: cellClicked.column.getColId() });
103
174
  }
@@ -107,6 +178,9 @@ export default class GridEditionManager {
107
178
  col.cellEditor = 'ezCellEditor';
108
179
  col.editable = params => this.canEdit(params);
109
180
  col.suppressKeyboardEvent = (params) => {
181
+ if (params.event.key === KeyCode.ESCAPE && params.editing) {
182
+ return this._dataUnit.isDirty();
183
+ }
110
184
  return params.event.key === KeyCode.ENTER;
111
185
  };
112
186
  col.cellEditorSelector = (params) => {
@@ -136,10 +210,21 @@ export default class GridEditionManager {
136
210
  return col;
137
211
  }
138
212
  getRequiredFields() {
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());
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;
143
228
  }
144
229
  saveSuccess() {
145
230
  var _a;
@@ -152,10 +237,11 @@ export default class GridEditionManager {
152
237
  this._isGridEdition = false;
153
238
  }
154
239
  saveFail(reason) {
155
- this.focusOnCell(this._lastCellEdited);
240
+ var _a;
241
+ this.focusOnCell((_a = this._lastCellOpened) !== null && _a !== void 0 ? _a : this._lastCellEdited);
156
242
  this._isGridEdition = false;
157
243
  if (reason) {
158
- Promise.reject(reason);
244
+ throw reason;
159
245
  }
160
246
  }
161
247
  focusOnCell(cell) {
@@ -220,6 +306,9 @@ export default class GridEditionManager {
220
306
  this.moveEditionVertically(api, 1);
221
307
  }
222
308
  moveEditionVertically(api, offset) {
309
+ if (this._dataUnit.hasNewRecord() && this._isGridEdition) {
310
+ return;
311
+ }
223
312
  const editionCell = api.getEditingCells()[0];
224
313
  if (!editionCell) {
225
314
  return;
@@ -264,41 +353,66 @@ export default class GridEditionManager {
264
353
  return true;
265
354
  }
266
355
  onCellEditRequest(event) {
267
- const fieldName = event.colDef.field;
356
+ var _a;
268
357
  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
- }
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
+ 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) {
278
382
  this._isGridEdition = true;
279
- this._dataUnit.setFieldValue(fieldName, value, [event.data.__record__id__], { suppressCreateNewRecord: true });
383
+ this._dataUnit.setFieldValue(fieldName, newValue, [event.data.__record__id__], { suppressCreateNewRecord: true });
280
384
  this._lastCellEdited = { rowIndex: event.rowIndex, column: event.column, rowPinned: undefined };
281
385
  }
282
386
  }
283
387
  setCellEditors(customEditors) {
388
+ var _a, _b;
284
389
  this._customEditors = customEditors;
390
+ if (!customEditors.has((_b = (_a = this._lastCellOpened) === null || _a === void 0 ? void 0 : _a.column) === null || _b === void 0 ? void 0 : _b.getColId()))
391
+ return;
392
+ this._gridOptions.api.stopEditing();
393
+ window.requestAnimationFrame(() => this.focusOnCell(this._lastCellOpened));
285
394
  }
286
395
  setCellRenders(customRenders) {
287
396
  this._customRenders = customRenders;
288
397
  }
289
- setInvalidCell(invalidCell, recordId) {
290
- this._invalidCell = { field: invalidCell, recordId };
398
+ pushInvalidCell(invalidField, recordId) {
399
+ this._invalidCells.push({ field: invalidField, recordId });
400
+ this._nextInvalidCell = this._invalidCells[0];
401
+ }
402
+ getInvalidCells() {
403
+ return this._invalidCells;
291
404
  }
292
- getInvalidCell() {
293
- return this._invalidCell;
405
+ getNextInvalidCell() {
406
+ return this._nextInvalidCell;
294
407
  }
295
- processContinuousInsert() {
408
+ async processContinuousInsert() {
296
409
  if (!this.canContinuousInsert())
297
410
  return;
298
411
  this._dataUnit.addRecord();
299
412
  }
300
413
  clearInvalidCells(stopEdition) {
301
- this._invalidCell = undefined;
414
+ this._invalidCells = [];
415
+ this._nextInvalidCell = undefined;
302
416
  if (stopEdition) {
303
417
  this._isGridEdition = false;
304
418
  }
@@ -309,10 +423,17 @@ export default class GridEditionManager {
309
423
  hasInvalidField(fieldName, recordId) {
310
424
  if (!this.hasInvalidCell())
311
425
  return false;
312
- return this._invalidCell.field.name === fieldName && this._invalidCell.recordId === recordId;
426
+ this._nextInvalidCell = this._invalidCells[0];
427
+ const containsFieldName = this._nextInvalidCell.field.name === fieldName;
428
+ const containsRecordId = this._nextInvalidCell.recordId === recordId;
429
+ return containsFieldName && containsRecordId;
313
430
  }
314
431
  hasInvalidCell() {
315
- if (!this._invalidCell || !this._invalidCell.field || !this._invalidCell.recordId)
432
+ var _a, _b, _c;
433
+ const hasInvalidCell = ((_a = this._invalidCells) === null || _a === void 0 ? void 0 : _a.length) > 0;
434
+ const hasField = (_b = this._invalidCells) === null || _b === void 0 ? void 0 : _b.filter(invalidCell => { invalidCell.field; });
435
+ const hasRecordId = (_c = this._invalidCells) === null || _c === void 0 ? void 0 : _c.filter(invalidCell => { invalidCell.recordId; });
436
+ if (!hasInvalidCell || !hasField || !hasRecordId)
316
437
  return false;
317
438
  return true;
318
439
  }
@@ -2,6 +2,7 @@ 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";
5
6
  export default class EzGridCustomCellEditor extends EzCellEditor {
6
7
  init(params) {
7
8
  var _a, _b;
@@ -65,4 +66,10 @@ export default class EzGridCustomCellEditor extends EzCellEditor {
65
66
  return this._customGui.value;
66
67
  return this._value;
67
68
  }
69
+ afterGuiAttached() {
70
+ this.focusIn();
71
+ }
72
+ focusIn() {
73
+ FocusResolver.resolveFocus(this._customGui);
74
+ }
68
75
  }
@@ -19,6 +19,7 @@ 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;
22
23
  return combo;
23
24
  };
24
25
  export const buildSwitch = (fieldMetadata) => {
@@ -7,6 +7,7 @@ export const buildDate = () => {
7
7
  data-is-fixed="true"
8
8
  />`);
9
9
  dateInput.valueGetter = () => dateInput.getValueAsync();
10
+ dateInput.autoFocus = true;
10
11
  return dateInput;
11
12
  };
12
13
  export const buildTime = ({ readOnly }) => {
@@ -17,5 +17,6 @@ function buildNumeric(readOnly, precision, prettyPrecision) {
17
17
  mode="slim"
18
18
  />`);
19
19
  input.valueGetter = () => input.getValueAsync();
20
+ input.autoFocus = true;
20
21
  return input;
21
22
  }