@sankhyalabs/ezui 5.22.0-dev.4 → 5.22.0-dev.41

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 (232) hide show
  1. package/dist/cjs/DataBinder-3b083480.js +445 -0
  2. package/dist/cjs/FocusResolver-885f2173.js +35 -0
  3. package/dist/cjs/ez-button.cjs.entry.js +11 -5
  4. package/dist/cjs/ez-card-item_3.cjs.entry.js +21 -6
  5. package/dist/cjs/ez-chart.cjs.entry.js +1 -1
  6. package/dist/cjs/ez-check.cjs.entry.js +1 -1
  7. package/dist/cjs/ez-collapsible-box.cjs.entry.js +1 -1
  8. package/dist/cjs/ez-combo-box.cjs.entry.js +64 -11
  9. package/dist/cjs/ez-custom-form-input_2.cjs.entry.js +33 -4
  10. package/dist/cjs/ez-date-input.cjs.entry.js +12 -3
  11. package/dist/cjs/ez-date-time-input.cjs.entry.js +9 -3
  12. package/dist/cjs/ez-dialog.cjs.entry.js +9 -1
  13. package/dist/cjs/{ez-dropdown.cjs.entry.js → ez-dropdown_2.cjs.entry.js} +75 -8
  14. package/dist/cjs/ez-form-view.cjs.entry.js +5 -4
  15. package/dist/cjs/ez-form.cjs.entry.js +4 -324
  16. package/dist/cjs/ez-grid.cjs.entry.js +14742 -70307
  17. package/dist/cjs/ez-list.cjs.entry.js +6 -7
  18. package/dist/cjs/ez-modal-container.cjs.entry.js +2 -1
  19. package/dist/cjs/ez-modal.cjs.entry.js +19 -4
  20. package/dist/cjs/ez-multi-selection-list.cjs.entry.js +1 -1
  21. package/dist/cjs/ez-number-input.cjs.entry.js +13 -1
  22. package/dist/cjs/ez-popup.cjs.entry.js +21 -2
  23. package/dist/cjs/ez-scroller_2.cjs.entry.js +3 -3
  24. package/dist/cjs/ez-search.cjs.entry.js +66 -33
  25. package/dist/cjs/ez-sidebar-navigator.cjs.entry.js +1 -1
  26. package/dist/cjs/ez-split-button.cjs.entry.js +2 -2
  27. package/dist/cjs/ez-split-item.cjs.entry.js +1 -1
  28. package/dist/cjs/ez-text-area.cjs.entry.js +67 -5
  29. package/dist/cjs/ez-text-input.cjs.entry.js +51 -5
  30. package/dist/cjs/ez-time-input.cjs.entry.js +6 -0
  31. package/dist/cjs/ezui.cjs.js +1 -1
  32. package/dist/cjs/index-9e5554cb.js +2 -6
  33. package/dist/cjs/loader.cjs.js +1 -1
  34. package/dist/collection/collection-manifest.json +1 -1
  35. package/dist/collection/components/ez-button/ez-button.css +21 -11
  36. package/dist/collection/components/ez-button/ez-button.js +12 -6
  37. package/dist/collection/components/ez-card-item/ez-card-item.css +60 -10
  38. package/dist/collection/components/ez-card-item/ez-card-item.js +30 -3
  39. package/dist/collection/components/ez-check/ez-check.css +1 -6
  40. package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +2 -2
  41. package/dist/collection/components/ez-combo-box/ez-combo-box.css +1 -1
  42. package/dist/collection/components/ez-combo-box/ez-combo-box.js +109 -13
  43. package/dist/collection/components/ez-date-input/ez-date-input.css +1 -1
  44. package/dist/collection/components/ez-date-input/ez-date-input.js +38 -4
  45. package/dist/collection/components/ez-date-time-input/ez-date-time-input.css +1 -1
  46. package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +35 -4
  47. package/dist/collection/components/ez-dialog/ez-dialog.js +9 -1
  48. package/dist/collection/components/ez-dropdown/ez-dropdown.js +33 -8
  49. package/dist/collection/components/ez-filter-input/ez-filter-input.js +35 -4
  50. package/dist/collection/components/ez-form/ez-form.js +1 -0
  51. package/dist/collection/components/ez-form-view/custom-input/ez-custom-form-input.js +47 -5
  52. package/dist/collection/components/ez-form-view/fieldbuilder/templates/SearchInput.tpl.js +3 -2
  53. package/dist/collection/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.js +2 -2
  54. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +238 -55
  55. package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +107 -5
  56. package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +222 -42
  57. package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.js +16 -0
  58. package/dist/collection/components/ez-grid/controller/ag-grid/editor/EzCellEditor.js +8 -0
  59. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/ComboBox.tpl.js +2 -0
  60. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/DateInput.tpl.js +1 -0
  61. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/NumberInput.tpl.js +1 -0
  62. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/Search.tpl.js +4 -0
  63. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/TextInput.tpl.js +4 -1
  64. package/dist/collection/components/ez-grid/controller/ag-grid/test/constants/GridEditionMock.js +2 -0
  65. package/dist/collection/components/ez-grid/ez-grid.css +17 -7
  66. package/dist/collection/components/ez-grid/ez-grid.js +181 -7
  67. package/dist/collection/components/ez-list/ez-list.css +2 -1
  68. package/dist/collection/components/ez-list/ez-list.js +6 -7
  69. package/dist/collection/components/ez-modal/ez-modal.css +1 -1
  70. package/dist/collection/components/ez-modal/ez-modal.js +36 -3
  71. package/dist/collection/components/ez-modal-container/ez-modal-container.js +20 -1
  72. package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.js +1 -1
  73. package/dist/collection/components/ez-number-input/ez-number-input.js +49 -1
  74. package/dist/collection/components/ez-popup/ez-popup.css +5 -1
  75. package/dist/collection/components/ez-popup/ez-popup.js +38 -1
  76. package/dist/collection/components/ez-scroller/ez-scroller.css +1 -0
  77. package/dist/collection/components/ez-search/ez-search.css +21 -10
  78. package/dist/collection/components/ez-search/ez-search.js +147 -34
  79. package/dist/collection/components/ez-sidebar-button/ez-sidebar-button.css +3 -0
  80. package/dist/collection/components/ez-sidebar-button/ez-sidebar-button.js +1 -1
  81. package/dist/collection/components/ez-sidebar-navigator/ez-sidebar-navigator.css +3 -1
  82. package/dist/collection/components/ez-split-button/ez-split-button.css +48 -12
  83. package/dist/collection/components/ez-split-button/ez-split-button.js +3 -3
  84. package/dist/collection/components/ez-split-panel/structure/item/ez-split-item.css +1 -0
  85. package/dist/collection/components/ez-text-area/ez-text-area.css +73 -28
  86. package/dist/collection/components/ez-text-area/ez-text-area.js +103 -3
  87. package/dist/collection/components/ez-text-input/ez-text-input.css +41 -71
  88. package/dist/collection/components/ez-text-input/ez-text-input.js +86 -4
  89. package/dist/collection/components/ez-time-input/ez-time-input.js +24 -0
  90. package/dist/collection/sw.js +46 -0
  91. package/dist/collection/utils/FocusResolver.js +31 -0
  92. package/dist/collection/utils/form/DataBinder.js +20 -5
  93. package/dist/collection/utils/interfaces/AbstractFieldMetadata.js +1 -1
  94. package/dist/collection/utils/validators/recordvalidator/IInvalidCells.js +1 -0
  95. package/dist/collection/utils/validators/recordvalidator/RecordValidationProcessor.js +7 -1
  96. package/dist/custom-elements/index.js +15623 -70811
  97. package/dist/esm/DataBinder-02fa9bb9.js +441 -0
  98. package/dist/esm/FocusResolver-1ccbf850.js +33 -0
  99. package/dist/esm/ez-button.entry.js +11 -5
  100. package/dist/esm/ez-card-item_3.entry.js +21 -6
  101. package/dist/esm/ez-chart.entry.js +1 -1
  102. package/dist/esm/ez-check.entry.js +1 -1
  103. package/dist/esm/ez-collapsible-box.entry.js +1 -1
  104. package/dist/esm/ez-combo-box.entry.js +65 -12
  105. package/dist/esm/ez-custom-form-input_2.entry.js +34 -5
  106. package/dist/esm/ez-date-input.entry.js +12 -3
  107. package/dist/esm/ez-date-time-input.entry.js +9 -3
  108. package/dist/esm/ez-dialog.entry.js +9 -1
  109. package/dist/esm/{ez-dropdown.entry.js → ez-dropdown_2.entry.js} +75 -9
  110. package/dist/esm/ez-form-view.entry.js +5 -4
  111. package/dist/esm/ez-form.entry.js +3 -323
  112. package/dist/esm/ez-grid.entry.js +14685 -70250
  113. package/dist/esm/ez-list.entry.js +6 -7
  114. package/dist/esm/ez-modal-container.entry.js +2 -1
  115. package/dist/esm/ez-modal.entry.js +19 -4
  116. package/dist/esm/ez-multi-selection-list.entry.js +1 -1
  117. package/dist/esm/ez-number-input.entry.js +13 -1
  118. package/dist/esm/ez-popup.entry.js +21 -2
  119. package/dist/esm/ez-scroller_2.entry.js +3 -3
  120. package/dist/esm/ez-search.entry.js +66 -33
  121. package/dist/esm/ez-sidebar-navigator.entry.js +1 -1
  122. package/dist/esm/ez-split-button.entry.js +2 -2
  123. package/dist/esm/ez-split-item.entry.js +1 -1
  124. package/dist/esm/ez-text-area.entry.js +67 -5
  125. package/dist/esm/ez-text-input.entry.js +51 -5
  126. package/dist/esm/ez-time-input.entry.js +6 -0
  127. package/dist/esm/ezui.js +1 -1
  128. package/dist/esm/index-5a720e56.js +2 -6
  129. package/dist/esm/loader.js +1 -1
  130. package/dist/ezui/ezui.esm.js +1 -1
  131. package/dist/ezui/p-076e868b.entry.js +1 -0
  132. package/dist/ezui/p-0e1cc2d1.entry.js +1 -0
  133. package/dist/ezui/p-16e21a40.entry.js +1 -0
  134. package/dist/ezui/p-2de9f0aa.entry.js +1 -0
  135. package/dist/ezui/p-3b546374.entry.js +1 -0
  136. package/dist/ezui/p-3cc9b84a.entry.js +1 -0
  137. package/dist/ezui/p-3d38bfea.entry.js +1 -0
  138. package/dist/ezui/p-455e737c.js +1 -0
  139. package/dist/ezui/p-554522db.entry.js +1 -0
  140. package/dist/ezui/p-57528846.entry.js +1 -0
  141. package/dist/ezui/p-6bc25bc8.entry.js +1 -0
  142. package/dist/ezui/p-70f1c812.entry.js +1 -0
  143. package/dist/ezui/p-7f5afb1f.entry.js +1 -0
  144. package/dist/ezui/p-802dc63e.entry.js +1 -0
  145. package/dist/ezui/p-880f73ea.entry.js +309 -0
  146. package/dist/ezui/p-8f026744.entry.js +1 -0
  147. package/dist/ezui/p-940760bf.entry.js +1 -0
  148. package/dist/ezui/p-a4ee2991.entry.js +1 -0
  149. package/dist/ezui/{p-82ac8b06.entry.js → p-a563df31.entry.js} +1 -1
  150. package/dist/ezui/p-a921e3e7.entry.js +1 -0
  151. package/dist/ezui/p-b858fc6e.entry.js +1 -0
  152. package/dist/ezui/p-be34c77f.entry.js +1 -0
  153. package/dist/ezui/{p-9aa27e69.entry.js → p-bef7daac.entry.js} +1 -1
  154. package/dist/ezui/p-bfc30e61.entry.js +1 -0
  155. package/dist/ezui/p-bfc59380.entry.js +1 -0
  156. package/dist/ezui/p-d960a031.entry.js +1 -0
  157. package/dist/ezui/p-dc628ed3.js +1 -0
  158. package/dist/ezui/{p-33792b2b.entry.js → p-e18d9e6a.entry.js} +1 -1
  159. package/dist/ezui/p-e3ec7422.entry.js +1 -0
  160. package/dist/ezui/{p-31674f8e.entry.js → p-e7395eae.entry.js} +1 -1
  161. package/dist/types/components/ez-button/ez-button.d.ts +2 -1
  162. package/dist/types/components/ez-card-item/ez-card-item.d.ts +5 -0
  163. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +12 -1
  164. package/dist/types/components/ez-date-input/ez-date-input.d.ts +6 -1
  165. package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +6 -1
  166. package/dist/types/components/ez-dialog/ez-dialog.d.ts +2 -0
  167. package/dist/types/components/ez-dropdown/ez-dropdown.d.ts +4 -0
  168. package/dist/types/components/ez-dropdown/structure/DropdownItem.d.ts +1 -1
  169. package/dist/types/components/ez-filter-input/ez-filter-input.d.ts +6 -1
  170. package/dist/types/components/ez-form-view/custom-input/ez-custom-form-input.d.ts +7 -1
  171. package/dist/types/components/ez-form-view/fieldbuilder/templates/SearchInput.tpl.d.ts +1 -1
  172. package/dist/types/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.d.ts +1 -1
  173. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +56 -4
  174. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +32 -4
  175. package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +23 -1
  176. package/dist/types/components/ez-grid/controller/ag-grid/GridEditionManager.d.ts +33 -7
  177. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.d.ts +4 -1
  178. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellRender.d.ts +1 -1
  179. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.d.ts +1 -1
  180. package/dist/types/components/ez-grid/controller/ag-grid/components/cellRendererStatus.d.ts +1 -1
  181. package/dist/types/components/ez-grid/controller/ag-grid/components/selectionHeader.d.ts +1 -1
  182. package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellEditor.d.ts +2 -1
  183. package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellRender.d.ts +1 -1
  184. package/dist/types/components/ez-grid/controller/ag-grid/editor/IUICellEditor.d.ts +1 -0
  185. package/dist/types/components/ez-grid/controller/ag-grid/mock/Server.d.ts +1 -1
  186. package/dist/types/components/ez-grid/ez-grid.d.ts +27 -1
  187. package/dist/types/components/ez-modal/ez-modal.d.ts +6 -0
  188. package/dist/types/components/ez-modal-container/ez-modal-container.d.ts +4 -0
  189. package/dist/types/components/ez-number-input/ez-number-input.d.ts +8 -0
  190. package/dist/types/components/ez-popup/ez-popup.d.ts +7 -0
  191. package/dist/types/components/ez-search/ez-search.d.ts +23 -2
  192. package/dist/types/components/ez-split-button/ez-split-button.d.ts +1 -1
  193. package/dist/types/components/ez-text-area/ez-text-area.d.ts +17 -0
  194. package/dist/types/components/ez-text-input/ez-text-input.d.ts +9 -0
  195. package/dist/types/components/ez-time-input/ez-time-input.d.ts +4 -0
  196. package/dist/types/components.d.ts +211 -10
  197. package/dist/types/utils/FocusResolver.d.ts +5 -0
  198. package/dist/types/utils/customEditor/interfaces/ICustomEditor.d.ts +2 -0
  199. package/dist/types/utils/form/DataBinder.d.ts +3 -0
  200. package/dist/types/utils/validators/recordvalidator/IInvalidCells.d.ts +5 -0
  201. package/dist/types/utils/validators/recordvalidator/RecordValidationProcessor.d.ts +1 -1
  202. package/package.json +12 -4
  203. package/dist/cjs/RecordValidationProcessor-4c893e04.js +0 -102
  204. package/dist/cjs/ez-skeleton.cjs.entry.js +0 -67
  205. package/dist/esm/RecordValidationProcessor-b00b8b77.js +0 -99
  206. package/dist/esm/ez-skeleton.entry.js +0 -63
  207. package/dist/ezui/p-034e21ca.entry.js +0 -1
  208. package/dist/ezui/p-044d46d5.entry.js +0 -1
  209. package/dist/ezui/p-04f24913.js +0 -1
  210. package/dist/ezui/p-24ca32a3.entry.js +0 -1
  211. package/dist/ezui/p-2af4e2de.entry.js +0 -1
  212. package/dist/ezui/p-36180f4d.entry.js +0 -1
  213. package/dist/ezui/p-5fefcdc9.entry.js +0 -1
  214. package/dist/ezui/p-752c4069.entry.js +0 -1
  215. package/dist/ezui/p-81cffa53.entry.js +0 -1
  216. package/dist/ezui/p-81f99ace.entry.js +0 -1
  217. package/dist/ezui/p-8eef0f70.entry.js +0 -1
  218. package/dist/ezui/p-9634631d.entry.js +0 -1
  219. package/dist/ezui/p-9a11e223.entry.js +0 -1
  220. package/dist/ezui/p-9a23d513.entry.js +0 -1
  221. package/dist/ezui/p-9c2e2d68.entry.js +0 -1
  222. package/dist/ezui/p-a35b41e6.entry.js +0 -1
  223. package/dist/ezui/p-b0e71d23.entry.js +0 -1
  224. package/dist/ezui/p-b150ccd3.entry.js +0 -304
  225. package/dist/ezui/p-c3b7a23e.entry.js +0 -1
  226. package/dist/ezui/p-cd1a2e6b.entry.js +0 -1
  227. package/dist/ezui/p-dbeee5aa.entry.js +0 -1
  228. package/dist/ezui/p-de870657.entry.js +0 -1
  229. package/dist/ezui/p-e151e795.entry.js +0 -1
  230. package/dist/ezui/p-ee9315ff.entry.js +0 -1
  231. package/dist/ezui/p-f1c3f85d.entry.js +0 -1
  232. package/dist/ezui/p-f291db18.entry.js +0 -1
@@ -1,53 +1,144 @@
1
- import { UserInterface } from "@sankhyalabs/core";
2
- import { KeyCode } from "ag-grid-community";
3
- import { RecordValidationProcessor } from "../../../../utils/validators/recordvalidator/RecordValidationProcessor";
4
- import EzCellEditor from "./editor/EzCellEditor";
5
- import EzGridCustomCellEditor from "./components/EzGridCustomCellEditor";
6
- import EzGridCustomCellRender from "./components/EzGridCustomCellRender";
1
+ import { LockManager, LockManagerOperation, UserInterface } from '@sankhyalabs/core';
2
+ import { KeyCode, } from "@ag-grid-community/core";
3
+ import { RecordValidationProcessor } from '../../../../utils/validators/recordvalidator/RecordValidationProcessor';
4
+ import EzCellEditor from './editor/EzCellEditor';
5
+ import EzGridCustomCellEditor from './components/EzGridCustomCellEditor';
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) {
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: () => { },
13
- getMessageForField: () => null
13
+ markAsInvalid: (invalidField, recordId) => { this.pushInvalidCell(invalidField, recordId); },
14
+ getMessageForField: () => null,
14
15
  }, recordsValidator);
15
16
  this._useEnterLikeTab = useEnterLikeTab;
16
17
  this._editionIsDisabled = editionIsDisabled;
18
+ this._enableContinuousInsert = enableContinuousInsert;
19
+ this._enableGridInsert = enableGridInsert;
17
20
  this._customEditors = customEditors;
18
21
  this._customRenders = customRenders;
22
+ this._lockerId = lockerId;
19
23
  }
20
24
  configureGrid(options) {
21
25
  this._gridOptions = options;
22
26
  options.readOnlyEdit = true;
23
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
+ };
24
43
  options.onCellKeyDown = evt => {
25
44
  if (evt.event && evt["column"]) {
26
45
  this.onCellKeyDown(evt);
27
46
  }
28
47
  };
48
+ options.isRowSelectable = (node) => this.isSelectableRow(node);
49
+ options.onCellFocused = () => this.lockFocusWhenAddRow();
29
50
  return options;
30
51
  }
31
- proceedAutoSave() {
32
- if (!this._dataUnit.isDirty()) {
33
- this.saveSuccess();
52
+ updateCurrentEditorGuiValue(updatedRowValue) {
53
+ const editorInstances = this._gridOptions.api.getCellEditorInstances();
54
+ if (!editorInstances || !editorInstances.length)
55
+ return;
56
+ const currentEditor = editorInstances[0];
57
+ const fieldMetadata = currentEditor.getFieldMetadata();
58
+ const fieldName = fieldMetadata.name;
59
+ const value = updatedRowValue[fieldName];
60
+ currentEditor.setGuiValue(value);
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)) {
34
70
  return;
35
71
  }
36
- if (!this._isGridEdition || this._dataUnit.hasNewRecord()) {
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)) {
37
74
  return;
38
75
  }
39
- const currentRercord = this._dataUnit.getSelectedRecord();
40
- if (currentRercord == undefined) {
76
+ api.clearFocusedCell();
77
+ if (!lastCell || (rowNode === null || rowNode === void 0 ? void 0 : rowNode.rowIndex) == undefined) {
41
78
  return;
42
79
  }
43
- this._recordValidationProcessor
44
- .validate()
45
- .then(() => {
46
- this._dataUnit.saveData()
47
- .then(() => this.saveSuccess())
48
- .catch(reason => this.saveFail(reason));
49
- })
50
- .catch(reason => this.saveFail(reason));
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
+ canContinuousInsert() {
105
+ var _a;
106
+ return this._enableContinuousInsert && (this._dataUnit.records.length - 1) === ((_a = this._lastCellEdited) === null || _a === void 0 ? void 0 : _a.rowIndex);
107
+ }
108
+ async proceedAutoSave() {
109
+ if (!this._dataUnit.isDirty()) {
110
+ this.saveSuccess();
111
+ return true;
112
+ }
113
+ const currentRecord = this._dataUnit.getSelectedRecord();
114
+ if (currentRecord == undefined) {
115
+ return true;
116
+ }
117
+ this.clearInvalidCells(false);
118
+ try {
119
+ await this._recordValidationProcessor.validate(true);
120
+ await this.saveDataUnit();
121
+ this.saveSuccess();
122
+ return true;
123
+ }
124
+ catch (reason) {
125
+ this.saveFail(reason);
126
+ return false;
127
+ }
128
+ }
129
+ async saveDataUnit() {
130
+ await this._dataUnit.saveData();
131
+ return true;
132
+ }
133
+ async recordValidate() {
134
+ if (!this._dataUnit.isDirty())
135
+ return;
136
+ try {
137
+ this.clearInvalidCells(false);
138
+ await this._recordValidationProcessor.validate(false);
139
+ }
140
+ catch (error) { }
141
+ this._gridOptions.api.refreshCells({ force: true });
51
142
  }
52
143
  navigateByEnterKey(keyboardEvent) {
53
144
  const backwards = keyboardEvent.shiftKey;
@@ -71,6 +162,13 @@ export default class GridEditionManager {
71
162
  return { ezCellEditor: EzCellEditor };
72
163
  }
73
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
+ }
74
172
  if (this.isSecondClick(cellClicked)) {
75
173
  api.startEditingCell({ rowIndex: cellClicked.rowIndex, colKey: cellClicked.column.getColId() });
76
174
  }
@@ -80,6 +178,9 @@ export default class GridEditionManager {
80
178
  col.cellEditor = 'ezCellEditor';
81
179
  col.editable = params => this.canEdit(params);
82
180
  col.suppressKeyboardEvent = (params) => {
181
+ if (params.event.key === KeyCode.ESCAPE && params.editing) {
182
+ return this._dataUnit.isDirty();
183
+ }
83
184
  return params.event.key === KeyCode.ENTER;
84
185
  };
85
186
  col.cellEditorSelector = (params) => {
@@ -109,10 +210,21 @@ export default class GridEditionManager {
109
210
  return col;
110
211
  }
111
212
  getRequiredFields() {
112
- return this._gridOptions.columnApi.getAllDisplayedColumns().filter(c => {
113
- const fieldDefinition = this._dataUnit.getField(c.getColId());
114
- return fieldDefinition && fieldDefinition.required;
115
- }).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;
116
228
  }
117
229
  saveSuccess() {
118
230
  var _a;
@@ -125,18 +237,20 @@ export default class GridEditionManager {
125
237
  this._isGridEdition = false;
126
238
  }
127
239
  saveFail(reason) {
128
- this.focusOnCell(this._lastCellEdited);
240
+ var _a;
241
+ this.focusOnCell((_a = this._lastCellOpened) !== null && _a !== void 0 ? _a : this._lastCellEdited);
129
242
  this._isGridEdition = false;
130
243
  if (reason) {
131
- Promise.reject(reason);
244
+ throw reason;
132
245
  }
133
246
  }
134
247
  focusOnCell(cell) {
248
+ var _a;
135
249
  if (cell == undefined) {
136
250
  return;
137
251
  }
138
252
  const { rowIndex, column } = cell;
139
- this._gridOptions.api.getDisplayedRowAtIndex(rowIndex).setSelected(true, true);
253
+ (_a = this._gridOptions.api.getDisplayedRowAtIndex(rowIndex)) === null || _a === void 0 ? void 0 : _a.setSelected(true, true);
140
254
  this._gridOptions.api.clearRangeSelection();
141
255
  this._gridOptions.api.addCellRange({ rowStartIndex: rowIndex, rowEndIndex: rowIndex, columns: [column] });
142
256
  this._gridOptions.api.startEditingCell({ colKey: column.getColId(), rowIndex });
@@ -176,9 +290,10 @@ export default class GridEditionManager {
176
290
  }
177
291
  }
178
292
  else {
293
+ const actualRowIndex = rowIndex;
179
294
  rowIndex = rowIndex + 1;
180
295
  if (rowIndex >= this._dataUnit.records.length) {
181
- rowIndex = 0;
296
+ rowIndex = !this._enableGridInsert ? 0 : actualRowIndex;
182
297
  }
183
298
  }
184
299
  this._targetEditionCell = new TargetEdition(rowIndex, column, true);
@@ -191,6 +306,9 @@ export default class GridEditionManager {
191
306
  this.moveEditionVertically(api, 1);
192
307
  }
193
308
  moveEditionVertically(api, offset) {
309
+ if (this._dataUnit.hasNewRecord() && this._isGridEdition) {
310
+ return;
311
+ }
194
312
  const editionCell = api.getEditingCells()[0];
195
313
  if (!editionCell) {
196
314
  return;
@@ -235,28 +353,90 @@ export default class GridEditionManager {
235
353
  return true;
236
354
  }
237
355
  onCellEditRequest(event) {
238
- const fieldName = event.colDef.field;
356
+ var _a;
239
357
  const value = event.newValue;
240
- if (event.oldValue != value) {
241
- if (value instanceof Promise) {
242
- const fieldDescriptor = this._dataUnit.getField(event.colDef.colId);
243
- event.node.setData(Object.assign(Object.assign({}, event.data), { [fieldName]: (fieldDescriptor === null || fieldDescriptor === void 0 ? void 0 : fieldDescriptor.userInterface) === UserInterface.SEARCH ? value : event.oldValue }));
244
- value.then(resolved => event.node.setData(Object.assign(Object.assign({}, event.data), { [fieldName]: resolved })));
245
- }
246
- else {
247
- event.node.setData(Object.assign(Object.assign({}, event.data), { [fieldName]: value }));
248
- }
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) {
249
382
  this._isGridEdition = true;
250
- this._dataUnit.setFieldValue(fieldName, value, [event.data.__record__id__]);
383
+ this._dataUnit.setFieldValue(fieldName, newValue, [event.data.__record__id__], { suppressCreateNewRecord: true });
251
384
  this._lastCellEdited = { rowIndex: event.rowIndex, column: event.column, rowPinned: undefined };
252
385
  }
253
386
  }
254
387
  setCellEditors(customEditors) {
388
+ var _a, _b;
255
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));
256
394
  }
257
395
  setCellRenders(customRenders) {
258
396
  this._customRenders = customRenders;
259
397
  }
398
+ pushInvalidCell(invalidField, recordId) {
399
+ this._invalidCells.push({ field: invalidField, recordId });
400
+ this._nextInvalidCell = this._invalidCells[0];
401
+ }
402
+ getInvalidCells() {
403
+ return this._invalidCells;
404
+ }
405
+ getNextInvalidCell() {
406
+ return this._nextInvalidCell;
407
+ }
408
+ async processContinuousInsert() {
409
+ if (!this.canContinuousInsert())
410
+ return;
411
+ this._dataUnit.addRecord();
412
+ }
413
+ clearInvalidCells(stopEdition) {
414
+ this._invalidCells = [];
415
+ this._nextInvalidCell = undefined;
416
+ if (stopEdition) {
417
+ this._isGridEdition = false;
418
+ }
419
+ }
420
+ setEnableContinuousInsert(enable) {
421
+ this._enableContinuousInsert = enable;
422
+ }
423
+ hasInvalidField(fieldName, recordId) {
424
+ if (!this.hasInvalidCell())
425
+ return false;
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;
430
+ }
431
+ hasInvalidCell() {
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)
437
+ return false;
438
+ return true;
439
+ }
260
440
  }
261
441
  class TargetEdition {
262
442
  constructor(rowIndex, column, backwards) {
@@ -1,6 +1,8 @@
1
1
  import { HTMLBuilder } from "@sankhyalabs/core";
2
2
  import { CustomEditorSource } from "../../../../../utils/customEditor/interfaces/ICustomEditor";
3
3
  import EzCellEditor from "../editor/EzCellEditor";
4
+ import { getViewPortHeight } from "../editor/GridEditorUtils";
5
+ import FocusResolver from "../../../../../utils/FocusResolver";
4
6
  export default class EzGridCustomCellEditor extends EzCellEditor {
5
7
  init(params) {
6
8
  var _a, _b;
@@ -11,6 +13,8 @@ export default class EzGridCustomCellEditor extends EzCellEditor {
11
13
  this._defaultGui = this.getDefaultGui();
12
14
  const fieldMetadata = super.getFieldMetadata();
13
15
  this._params = {
16
+ cellPossition: getViewPortHeight(params.eGridCell),
17
+ eGridCell: params.eGridCell,
14
18
  value: params.value,
15
19
  charPress: params.charPress,
16
20
  currentEditor: this._defaultGui,
@@ -48,12 +52,24 @@ export default class EzGridCustomCellEditor extends EzCellEditor {
48
52
  const element = HTMLBuilder.parseElement(editorElement);
49
53
  return element;
50
54
  }
55
+ this._customGui = editorElement;
51
56
  return editorElement;
52
57
  }
53
58
  setValue(value) {
54
59
  this._value = value;
55
60
  }
56
61
  getValue() {
62
+ var _a, _b;
63
+ if ((_a = this._customGui) === null || _a === void 0 ? void 0 : _a.getValue)
64
+ return this._customGui.getValue();
65
+ if ((_b = this._customGui) === null || _b === void 0 ? void 0 : _b.hasAttribute('value'))
66
+ return this._customGui.value;
57
67
  return this._value;
58
68
  }
69
+ afterGuiAttached() {
70
+ this.focusIn();
71
+ }
72
+ focusIn() {
73
+ FocusResolver.resolveFocus(this._customGui);
74
+ }
59
75
  }
@@ -44,6 +44,14 @@ export default class EzCellEditor {
44
44
  getValue() {
45
45
  return this._gui.valueGetter != undefined ? this._gui.valueGetter() : this._gui.value;
46
46
  }
47
+ setGuiValue(value) {
48
+ if (this._gui.valueSetter != undefined) {
49
+ this._gui.valueSetter(value);
50
+ }
51
+ else {
52
+ this._gui.value = value;
53
+ }
54
+ }
47
55
  isPopup() {
48
56
  return this._gui.isPopUp;
49
57
  }
@@ -17,7 +17,9 @@ export const buildComboBox = ({ required, props, eGridCell }) => {
17
17
  mode="slim"
18
18
  />`);
19
19
  combo.options = options;
20
+ combo.stopPropagateEnterKeyEvent = true;
20
21
  combo.listOptionsPosition = { verticalPosition: 29, bottomLimit: getViewPortHeight(eGridCell), hardPosition: true };
22
+ combo.autoFocus = true;
21
23
  return combo;
22
24
  };
23
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
  }
@@ -9,7 +9,11 @@ export const buildSearch = ({ name, required, readOnly, eGridCell, dataUnit }) =
9
9
  />`);
10
10
  const loader = ApplicationContext.getContextValue("__EZUI__SEARCH__OPTION__LOADER__");
11
11
  ezSearch.optionLoader = (argument) => loader(argument, name, dataUnit);
12
+ ezSearch.ensureClearButtonVisible = true;
13
+ ezSearch.suppressPreLoad = true;
12
14
  ezSearch.listOptionsPosition = { verticalPosition: 29, bottomLimit: getViewPortHeight(eGridCell), hardPosition: true };
15
+ ezSearch.stopPropagateEnterKeyEvent = true;
16
+ ezSearch.autoFocus = true;
13
17
  ezSearch.valueGetter = () => ezSearch.getValueAsync();
14
18
  return ezSearch;
15
19
  };
@@ -2,12 +2,14 @@ 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
- return HTMLBuilder.parseElement(`<ez-text-input
5
+ const textInput = 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;
11
13
  };
12
14
  export const buildTextAreaInput = ({ eGridCell, editionManager }) => {
13
15
  const element = HTMLBuilder.parseElement(`<ez-text-area
@@ -17,6 +19,7 @@ export const buildTextAreaInput = ({ eGridCell, editionManager }) => {
17
19
  element.addEventListener('keydown', event => handlePressEnterEvent(event, element, editionManager));
18
20
  setElementInitialWidth(eGridCell, element);
19
21
  element.isPopUp = true;
22
+ element.autoFocus = true;
20
23
  return element;
21
24
  };
22
25
  function setElementInitialWidth(eGridCell, element) {
@@ -36,5 +36,7 @@ export function buildOptions(dataUnit) {
36
36
  serverURL: '',
37
37
  statusResolver: {},
38
38
  useEnterLikeTab: true,
39
+ enableContinuousInsert: false,
40
+ enableGridInsert: false,
39
41
  });
40
42
  }
@@ -99,14 +99,8 @@
99
99
  }
100
100
 
101
101
  .grid-header__pagination{
102
- width: 30%;
103
- min-width: 100px;
104
102
  justify-content: flex-end;
105
- flex-wrap: wrap;
106
- }
107
-
108
- .grid-header__left-container{
109
- width: 70%
103
+ flex-wrap: nowrap;
110
104
  }
111
105
 
112
106
  .grid-header__pagination-label {
@@ -117,3 +111,19 @@
117
111
  .overflowed {
118
112
  display: none;
119
113
  }
114
+
115
+ .pagination-contracted {
116
+ width: 100px;
117
+ }
118
+
119
+ .pagination-expanded{
120
+ min-width: 150px;
121
+ }
122
+
123
+ .left__header-contracted {
124
+ width: calc(100% - 100px);
125
+ }
126
+
127
+ .left__header-expanded{
128
+ flex-grow: 1;
129
+ }