@sankhyalabs/ezui 5.22.0-dev.3 → 5.22.0-dev.31

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 (246) hide show
  1. package/dist/cjs/{RecordValidationProcessor-4c893e04.js → RecordValidationProcessor-10846595.js} +7 -1
  2. package/dist/cjs/ez-actions-button.cjs.entry.js +1 -1
  3. package/dist/cjs/ez-alert-list.cjs.entry.js +1 -1
  4. package/dist/cjs/ez-alert.cjs.entry.js +1 -1
  5. package/dist/cjs/ez-application.cjs.entry.js +1 -1
  6. package/dist/cjs/ez-badge.cjs.entry.js +1 -1
  7. package/dist/cjs/ez-breadcrumb.cjs.entry.js +1 -1
  8. package/dist/cjs/ez-button.cjs.entry.js +12 -6
  9. package/dist/cjs/ez-calendar.cjs.entry.js +1 -1
  10. package/dist/cjs/ez-card-item_3.cjs.entry.js +14 -5
  11. package/dist/cjs/ez-chart.cjs.entry.js +1 -1
  12. package/dist/cjs/ez-check.cjs.entry.js +2 -2
  13. package/dist/cjs/ez-chip.cjs.entry.js +1 -1
  14. package/dist/cjs/ez-collapsible-box.cjs.entry.js +2 -2
  15. package/dist/cjs/ez-combo-box.cjs.entry.js +20 -3
  16. package/dist/cjs/ez-custom-form-input_2.cjs.entry.js +35 -6
  17. package/dist/cjs/ez-date-input.cjs.entry.js +4 -1
  18. package/dist/cjs/ez-date-time-input.cjs.entry.js +1 -1
  19. package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
  20. package/dist/cjs/ez-dropdown.cjs.entry.js +1 -1
  21. package/dist/cjs/ez-file-item.cjs.entry.js +1 -1
  22. package/dist/cjs/ez-form-view.cjs.entry.js +4 -3
  23. package/dist/cjs/ez-form.cjs.entry.js +3 -3
  24. package/dist/cjs/ez-grid.cjs.entry.js +389 -57
  25. package/dist/cjs/ez-guide-navigator.cjs.entry.js +1 -1
  26. package/dist/cjs/ez-icon.cjs.entry.js +1 -1
  27. package/dist/cjs/ez-list.cjs.entry.js +2 -2
  28. package/dist/cjs/ez-loading-bar.cjs.entry.js +1 -1
  29. package/dist/cjs/ez-modal-container.cjs.entry.js +3 -2
  30. package/dist/cjs/ez-modal.cjs.entry.js +9 -3
  31. package/dist/cjs/ez-multi-selection-list.cjs.entry.js +2 -2
  32. package/dist/cjs/ez-number-input.cjs.entry.js +7 -2
  33. package/dist/cjs/ez-popover.cjs.entry.js +1 -1
  34. package/dist/cjs/ez-popup.cjs.entry.js +10 -3
  35. package/dist/cjs/ez-radio-button.cjs.entry.js +1 -1
  36. package/dist/cjs/ez-scroller_2.cjs.entry.js +4 -4
  37. package/dist/cjs/ez-search.cjs.entry.js +30 -6
  38. package/dist/cjs/ez-sidebar-navigator.cjs.entry.js +2 -2
  39. package/dist/cjs/ez-skeleton.cjs.entry.js +1 -1
  40. package/dist/cjs/ez-split-button.cjs.entry.js +3 -3
  41. package/dist/cjs/ez-split-item.cjs.entry.js +2 -2
  42. package/dist/cjs/ez-split-panel.cjs.entry.js +1 -1
  43. package/dist/cjs/ez-tabselector.cjs.entry.js +9 -3
  44. package/dist/cjs/ez-text-area.cjs.entry.js +1 -1
  45. package/dist/cjs/ez-text-input.cjs.entry.js +1 -1
  46. package/dist/cjs/ez-time-input.cjs.entry.js +1 -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/components/ez-button/ez-button.css +13 -2
  56. package/dist/collection/components/ez-button/ez-button.js +12 -6
  57. package/dist/collection/components/ez-card-item/ez-card-item.css +60 -10
  58. package/dist/collection/components/ez-card-item/ez-card-item.js +30 -3
  59. package/dist/collection/components/ez-check/ez-check.css +1 -6
  60. package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +2 -2
  61. package/dist/collection/components/ez-combo-box/ez-combo-box.js +37 -2
  62. package/dist/collection/components/ez-date-input/ez-date-input.js +3 -0
  63. package/dist/collection/components/ez-form-view/custom-input/ez-custom-form-input.js +47 -5
  64. package/dist/collection/components/ez-form-view/fieldbuilder/templates/SearchInput.tpl.js +3 -2
  65. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +165 -37
  66. package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +99 -5
  67. package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +73 -14
  68. package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.js +9 -0
  69. package/dist/collection/components/ez-grid/controller/ag-grid/editor/EzCellEditor.js +8 -0
  70. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/ComboBox.tpl.js +1 -0
  71. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/Search.tpl.js +3 -0
  72. package/dist/collection/components/ez-grid/controller/ag-grid/test/constants/GridEditionMock.js +2 -0
  73. package/dist/collection/components/ez-grid/ez-grid.css +17 -7
  74. package/dist/collection/components/ez-grid/ez-grid.js +91 -4
  75. package/dist/collection/components/ez-list/ez-list.css +2 -1
  76. package/dist/collection/components/ez-modal/ez-modal.css +1 -1
  77. package/dist/collection/components/ez-modal/ez-modal.js +25 -1
  78. package/dist/collection/components/ez-modal-container/ez-modal-container.js +20 -1
  79. package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.js +1 -1
  80. package/dist/collection/components/ez-number-input/ez-number-input.js +24 -1
  81. package/dist/collection/components/ez-popup/ez-popup.css +5 -1
  82. package/dist/collection/components/ez-popup/ez-popup.js +26 -1
  83. package/dist/collection/components/ez-scroller/ez-scroller.css +1 -0
  84. package/dist/collection/components/ez-search/ez-search.css +19 -8
  85. package/dist/collection/components/ez-search/ez-search.js +82 -4
  86. package/dist/collection/components/ez-sidebar-button/ez-sidebar-button.css +3 -0
  87. package/dist/collection/components/ez-sidebar-button/ez-sidebar-button.js +1 -1
  88. package/dist/collection/components/ez-sidebar-navigator/ez-sidebar-navigator.css +3 -1
  89. package/dist/collection/components/ez-split-button/ez-split-button.css +1 -1
  90. package/dist/collection/components/ez-split-button/ez-split-button.js +3 -3
  91. package/dist/collection/components/ez-split-panel/structure/item/ez-split-item.css +1 -0
  92. package/dist/collection/components/ez-tabselector/ez-tabselector.js +34 -2
  93. package/dist/collection/utils/form/DataBinder.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 +558 -106
  97. package/dist/esm/{RecordValidationProcessor-b00b8b77.js → RecordValidationProcessor-9c6cc267.js} +7 -1
  98. package/dist/esm/ez-actions-button.entry.js +1 -1
  99. package/dist/esm/ez-alert-list.entry.js +1 -1
  100. package/dist/esm/ez-alert.entry.js +1 -1
  101. package/dist/esm/ez-application.entry.js +1 -1
  102. package/dist/esm/ez-badge.entry.js +1 -1
  103. package/dist/esm/ez-breadcrumb.entry.js +1 -1
  104. package/dist/esm/ez-button.entry.js +12 -6
  105. package/dist/esm/ez-calendar.entry.js +1 -1
  106. package/dist/esm/ez-card-item_3.entry.js +14 -5
  107. package/dist/esm/ez-chart.entry.js +1 -1
  108. package/dist/esm/ez-check.entry.js +2 -2
  109. package/dist/esm/ez-chip.entry.js +1 -1
  110. package/dist/esm/ez-collapsible-box.entry.js +2 -2
  111. package/dist/esm/ez-combo-box.entry.js +20 -3
  112. package/dist/esm/ez-custom-form-input_2.entry.js +36 -7
  113. package/dist/esm/ez-date-input.entry.js +4 -1
  114. package/dist/esm/ez-date-time-input.entry.js +1 -1
  115. package/dist/esm/ez-dialog.entry.js +1 -1
  116. package/dist/esm/ez-dropdown.entry.js +1 -1
  117. package/dist/esm/ez-file-item.entry.js +1 -1
  118. package/dist/esm/ez-form-view.entry.js +4 -3
  119. package/dist/esm/ez-form.entry.js +3 -3
  120. package/dist/esm/ez-grid.entry.js +389 -57
  121. package/dist/esm/ez-guide-navigator.entry.js +1 -1
  122. package/dist/esm/ez-icon.entry.js +1 -1
  123. package/dist/esm/ez-list.entry.js +2 -2
  124. package/dist/esm/ez-loading-bar.entry.js +1 -1
  125. package/dist/esm/ez-modal-container.entry.js +3 -2
  126. package/dist/esm/ez-modal.entry.js +9 -3
  127. package/dist/esm/ez-multi-selection-list.entry.js +2 -2
  128. package/dist/esm/ez-number-input.entry.js +7 -2
  129. package/dist/esm/ez-popover.entry.js +1 -1
  130. package/dist/esm/ez-popup.entry.js +10 -3
  131. package/dist/esm/ez-radio-button.entry.js +1 -1
  132. package/dist/esm/ez-scroller_2.entry.js +4 -4
  133. package/dist/esm/ez-search.entry.js +30 -6
  134. package/dist/esm/ez-sidebar-navigator.entry.js +2 -2
  135. package/dist/esm/ez-skeleton.entry.js +1 -1
  136. package/dist/esm/ez-split-button.entry.js +3 -3
  137. package/dist/esm/ez-split-item.entry.js +2 -2
  138. package/dist/esm/ez-split-panel.entry.js +1 -1
  139. package/dist/esm/ez-tabselector.entry.js +9 -3
  140. package/dist/esm/ez-text-area.entry.js +1 -1
  141. package/dist/esm/ez-text-input.entry.js +1 -1
  142. package/dist/esm/ez-time-input.entry.js +1 -1
  143. package/dist/esm/ez-toast.entry.js +1 -1
  144. package/dist/esm/ez-tree.entry.js +1 -1
  145. package/dist/esm/ez-upload.entry.js +1 -1
  146. package/dist/esm/ez-view-stack.entry.js +1 -1
  147. package/dist/esm/ezui.js +3 -3
  148. package/dist/esm/filter-column.entry.js +1 -1
  149. package/dist/esm/{index-baa5e267.js → index-5a720e56.js} +3 -1
  150. package/dist/esm/loader.js +3 -3
  151. package/dist/ezui/ezui.esm.js +1 -1
  152. package/dist/ezui/{p-44caad9a.entry.js → p-0378416a.entry.js} +1 -1
  153. package/dist/ezui/{p-5b205c80.entry.js → p-044d46d5.entry.js} +1 -1
  154. package/dist/ezui/{p-1285c902.entry.js → p-11b09aa1.entry.js} +1 -1
  155. package/dist/ezui/{p-77a4bd35.entry.js → p-11bfeca3.entry.js} +1 -1
  156. package/dist/ezui/{p-828e449a.entry.js → p-190c190f.entry.js} +2 -2
  157. package/dist/ezui/{p-8888d9ed.entry.js → p-1b08bf3c.entry.js} +1 -1
  158. package/dist/ezui/p-1bd07c43.entry.js +1 -0
  159. package/dist/ezui/p-2480e948.entry.js +1 -0
  160. package/dist/ezui/{p-af95cd16.entry.js → p-24ca32a3.entry.js} +1 -1
  161. package/dist/ezui/{p-baf80b13.entry.js → p-30951bd7.entry.js} +1 -1
  162. package/dist/ezui/{p-e85c48d7.entry.js → p-36180f4d.entry.js} +1 -1
  163. package/dist/ezui/{p-7bc07c31.entry.js → p-3f8c33e0.entry.js} +1 -1
  164. package/dist/ezui/{p-3b4eeeb6.entry.js → p-4b5f83a4.entry.js} +1 -1
  165. package/dist/ezui/p-52100a6e.entry.js +1 -0
  166. package/dist/ezui/p-554522db.entry.js +1 -0
  167. package/dist/ezui/{p-1f50fa05.entry.js → p-6b51c9cc.entry.js} +1 -1
  168. package/dist/ezui/p-6ec40dec.entry.js +1 -0
  169. package/dist/ezui/{p-5ed81457.entry.js → p-6fc26622.entry.js} +1 -1
  170. package/dist/ezui/p-70f1c812.entry.js +1 -0
  171. package/dist/ezui/{p-555c9018.entry.js → p-7567ccdd.entry.js} +1 -1
  172. package/dist/ezui/p-7946f2d4.entry.js +1 -0
  173. package/dist/ezui/{p-1e7a8633.entry.js → p-81461d2f.entry.js} +1 -1
  174. package/dist/ezui/{p-072e6347.entry.js → p-82ac8b06.entry.js} +1 -1
  175. package/dist/ezui/{p-8df1ca33.entry.js → p-82fa4b09.entry.js} +1 -1
  176. package/dist/ezui/{p-bcb53f27.entry.js → p-868b56f7.entry.js} +1 -1
  177. package/dist/ezui/p-8ac13678.entry.js +1 -0
  178. package/dist/ezui/{p-85c8baae.entry.js → p-8eef0f70.entry.js} +1 -1
  179. package/dist/ezui/p-9174ab3c.entry.js +1 -0
  180. package/dist/ezui/{p-09de35a2.entry.js → p-91ccae0c.entry.js} +1 -1
  181. package/dist/ezui/p-92748142.entry.js +1 -0
  182. package/dist/ezui/p-940760bf.entry.js +1 -0
  183. package/dist/ezui/{p-fcf0acce.entry.js → p-a7490128.entry.js} +1 -1
  184. package/dist/ezui/p-a921e3e7.entry.js +1 -0
  185. package/dist/ezui/{p-9050d2cd.entry.js → p-b0e71d23.entry.js} +1 -1
  186. package/dist/ezui/{p-17be134a.entry.js → p-b2f6bc0a.entry.js} +1 -1
  187. package/dist/ezui/p-b858fc6e.entry.js +1 -0
  188. package/dist/ezui/p-b9fa2526.entry.js +1 -0
  189. package/dist/ezui/{p-84e439b9.entry.js → p-bef7daac.entry.js} +1 -1
  190. package/dist/ezui/{p-9f5fa3f9.entry.js → p-c2b20f78.entry.js} +1 -1
  191. package/dist/ezui/{p-5bd5e68f.entry.js → p-c3b7a23e.entry.js} +1 -1
  192. package/dist/ezui/{p-a80b1287.entry.js → p-dfca5946.entry.js} +1 -1
  193. package/dist/ezui/p-e03c2774.entry.js +1 -0
  194. package/dist/ezui/p-e18d9e6a.entry.js +1 -0
  195. package/dist/ezui/{p-23a36bb6.js → p-e4c7eb39.js} +2 -2
  196. package/dist/ezui/{p-0306dff7.entry.js → p-e6b38ade.entry.js} +1 -1
  197. package/dist/ezui/{p-922ac38b.entry.js → p-e7395eae.entry.js} +1 -1
  198. package/dist/ezui/{p-650e4b6d.entry.js → p-f1c2c19e.entry.js} +1 -1
  199. package/dist/ezui/{p-49456b34.entry.js → p-f291db18.entry.js} +1 -1
  200. package/dist/ezui/p-f42855b9.js +1 -0
  201. package/dist/ezui/p-f5ffadb1.entry.js +1 -0
  202. package/dist/ezui/{p-6e429cff.entry.js → p-fc194825.entry.js} +1 -1
  203. package/dist/ezui/p-ff233029.entry.js +1 -0
  204. package/dist/types/components/ez-button/ez-button.d.ts +2 -1
  205. package/dist/types/components/ez-card-item/ez-card-item.d.ts +5 -0
  206. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +5 -0
  207. package/dist/types/components/ez-form-view/custom-input/ez-custom-form-input.d.ts +7 -1
  208. package/dist/types/components/ez-form-view/fieldbuilder/templates/SearchInput.tpl.d.ts +1 -1
  209. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +44 -4
  210. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +25 -2
  211. package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +21 -0
  212. package/dist/types/components/ez-grid/controller/ag-grid/GridEditionManager.d.ts +20 -6
  213. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.d.ts +1 -0
  214. package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellEditor.d.ts +1 -0
  215. package/dist/types/components/ez-grid/ez-grid.d.ts +16 -0
  216. package/dist/types/components/ez-modal/ez-modal.d.ts +5 -0
  217. package/dist/types/components/ez-modal-container/ez-modal-container.d.ts +4 -0
  218. package/dist/types/components/ez-number-input/ez-number-input.d.ts +4 -0
  219. package/dist/types/components/ez-popup/ez-popup.d.ts +6 -0
  220. package/dist/types/components/ez-search/ez-search.d.ts +15 -0
  221. package/dist/types/components/ez-split-button/ez-split-button.d.ts +1 -1
  222. package/dist/types/components/ez-tabselector/ez-tabselector.d.ts +2 -1
  223. package/dist/types/components.d.ts +101 -4
  224. package/dist/types/utils/customEditor/interfaces/ICustomEditor.d.ts +2 -0
  225. package/dist/types/utils/validators/recordvalidator/IInvalidCells.d.ts +5 -0
  226. package/dist/types/utils/validators/recordvalidator/RecordValidationProcessor.d.ts +1 -1
  227. package/package.json +1 -1
  228. package/dist/ezui/p-04f24913.js +0 -1
  229. package/dist/ezui/p-12ae1104.entry.js +0 -1
  230. package/dist/ezui/p-13d2fe2d.entry.js +0 -1
  231. package/dist/ezui/p-2097d0cf.entry.js +0 -1
  232. package/dist/ezui/p-2dcb50d4.entry.js +0 -1
  233. package/dist/ezui/p-30775e7f.entry.js +0 -1
  234. package/dist/ezui/p-3faa2b46.entry.js +0 -1
  235. package/dist/ezui/p-4d5235f1.entry.js +0 -1
  236. package/dist/ezui/p-784fe207.entry.js +0 -1
  237. package/dist/ezui/p-7922142b.entry.js +0 -1
  238. package/dist/ezui/p-7af81663.entry.js +0 -1
  239. package/dist/ezui/p-9ab22a07.entry.js +0 -1
  240. package/dist/ezui/p-a31b9c90.entry.js +0 -1
  241. package/dist/ezui/p-bae4e180.entry.js +0 -1
  242. package/dist/ezui/p-bc2f844e.entry.js +0 -1
  243. package/dist/ezui/p-bf79aaa1.entry.js +0 -1
  244. package/dist/ezui/p-d9401ea0.entry.js +0 -1
  245. package/dist/ezui/p-ecc2c1ec.entry.js +0 -1
  246. package/dist/ezui/p-f3c526cc.entry.js +0 -1
@@ -1,5 +1,5 @@
1
1
  import { ApplicationContext, DataType, MaskFormatter, NumberUtils, SortMode, StringUtils, UserInterface, } from '@sankhyalabs/core';
2
- import { Grid } from 'ag-grid-community';
2
+ import { Grid, } from 'ag-grid-community';
3
3
  import { Grid as EnterpriseGrid, LicenseManager } from 'ag-grid-enterprise';
4
4
  import DataSource from './DataSource';
5
5
  import { EzGridCustomHeader } from './components/EzGridCustomHeader';
@@ -41,6 +41,8 @@ export default class AgGridController {
41
41
  this._filteredColumns = new Map();
42
42
  this._filterColumnleftPosition = 0;
43
43
  this._customFormatters = new Map();
44
+ this._gridShowDom = false;
45
+ this.peddingExecutionsOnGridShow = [];
44
46
  this._enterprise = enterprise;
45
47
  }
46
48
  getGridConfig() {
@@ -126,7 +128,7 @@ export default class AgGridController {
126
128
  this._doubleClickCallBack = options.onDoubleClick;
127
129
  this._multipleSelection = options.allowMultipleSelection;
128
130
  this._dataUnit = options.dataUnit;
129
- this._editionManager = new GridEditionManager(this._dataUnit, options.useEnterLikeTab, options.recordsValidator, options.editionIsDisabled, options.customEditors || this._customEditors, options.customRenders || this._customRenders);
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);
130
132
  this._statusResolver = options.statusResolver;
131
133
  if (this._dataUnit) {
132
134
  this._dataUnit.sortingProvider = this;
@@ -146,6 +148,9 @@ export default class AgGridController {
146
148
  defaultColDef: {
147
149
  headerClass: 'ez-grid__cell-header',
148
150
  cellClass: 'ez-grid__cell-body',
151
+ cellClassRules: {
152
+ 'invalidValue': (params) => this._editionManager.hasInvalidField(params.colDef.field, params.data["__record__id__"]),
153
+ },
149
154
  cellStyle: {
150
155
  height: '100%'
151
156
  }
@@ -176,10 +181,6 @@ export default class AgGridController {
176
181
  else {
177
182
  this._grid = new Grid(container, this._gridOptions);
178
183
  }
179
- container.addEventListener('focusout', (event) => {
180
- if (!container.contains(event.relatedTarget))
181
- this._gridOptions.api.clearFocusedCell();
182
- });
183
184
  const selection = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getSelectionInfo();
184
185
  if (selection === null || selection === void 0 ? void 0 : selection.isAllRecords()) {
185
186
  this.selectAll(true);
@@ -189,6 +190,23 @@ export default class AgGridController {
189
190
  }
190
191
  this._gridOptions.api.setHeaderHeight(this.getHeaderRowHeight());
191
192
  this._customFormatters = options.customFormatters;
193
+ const observerCallback = (entries) => {
194
+ entries.forEach(entry => {
195
+ if (entry.isIntersecting) {
196
+ this._gridShowDom = true;
197
+ this.peddingExecutionsOnGridShow.forEach(func => func());
198
+ this.peddingExecutionsOnGridShow = [];
199
+ }
200
+ else {
201
+ this._gridShowDom = false;
202
+ }
203
+ });
204
+ };
205
+ this.observer = new IntersectionObserver(observerCallback, {
206
+ root: null,
207
+ threshold: 0.1
208
+ });
209
+ this.observer.observe(container);
192
210
  }
193
211
  }
194
212
  processFormatterCellCallback(params) {
@@ -379,10 +397,17 @@ export default class AgGridController {
379
397
  throw new Error('Erro interno: Grid ainda não inicializado.');
380
398
  }
381
399
  }
382
- updateRows() {
400
+ updateRows(rows) {
383
401
  if (this._grid === undefined) {
384
402
  throw new Error('Erro interno: Grid ainda não inicializado.');
385
403
  }
404
+ rows === null || rows === void 0 ? void 0 : rows.forEach(row => this.updateRowData(row));
405
+ }
406
+ updateRowData(row) {
407
+ const node = this._gridOptions.api.getRowNode(row[this._idAttribName]);
408
+ node.setData(Object.assign({}, row));
409
+ this._editionManager.updateCurrentEditorGuiValue(row);
410
+ this._editionManager.recordValidate();
386
411
  }
387
412
  selectAll(quietly = false) {
388
413
  try {
@@ -465,14 +490,42 @@ export default class AgGridController {
465
490
  });
466
491
  r.setData(data);
467
492
  });
493
+ this._gridOptions.api.refreshCells({ force: true });
494
+ const invalidCell = this._editionManager.getInvalidCell();
495
+ if (invalidCell) {
496
+ const rowNode = this._gridOptions.api.getRowNode(invalidCell.recordId);
497
+ if (rowNode && invalidCell.field) {
498
+ this.startEdition(rowNode.rowIndex, this._gridOptions.columnApi.getColumn(invalidCell.field.name));
499
+ }
500
+ }
468
501
  }
469
502
  }
470
- refresh() {
503
+ savingCanceled(fields, recordId) {
504
+ const displayedColumns = this._gridOptions.columnApi.getAllDisplayedColumns();
505
+ const rowIndex = this._gridOptions.api.getRowNode(recordId).rowIndex;
506
+ const columnFocus = displayedColumns.find(column => this.isColumnEditable(rowIndex, column) && fields.find(field => field.name === column.getColId()));
507
+ this.focusByCollAndRow(columnFocus, rowIndex);
508
+ this.startEdition(rowIndex, columnFocus);
509
+ }
510
+ refresh(scrollToSelectedRow = false) {
471
511
  if (this._grid === undefined) {
472
512
  throw new Error('Erro interno: Grid ainda não inicializado.');
473
513
  }
474
514
  this._gridOptions.api.refreshServerSide({ purge: true });
475
515
  this._options.onRefresh();
516
+ if (scrollToSelectedRow)
517
+ this.scrollToSelectedRow();
518
+ }
519
+ scrollToSelectedRow() {
520
+ const rowNode = this._gridOptions.api.getSelectedNodes();
521
+ if (!rowNode || rowNode.length === 0)
522
+ return;
523
+ if (this._gridShowDom) {
524
+ this._gridOptions.api.ensureNodeVisible(rowNode[0]);
525
+ }
526
+ else {
527
+ this.peddingExecutionsOnGridShow.push(() => this._gridOptions.api.ensureNodeVisible(rowNode[0]));
528
+ }
476
529
  }
477
530
  focusOnGridContainer() {
478
531
  this._container.setAttribute('tabindex', '-1');
@@ -491,6 +544,14 @@ export default class AgGridController {
491
544
  var _a;
492
545
  (_a = this._dataSource) === null || _a === void 0 ? void 0 : _a.setAutoFocus(autoFocus);
493
546
  }
547
+ setEnableGridInsert(enable) {
548
+ var _a;
549
+ (_a = this._dataSource) === null || _a === void 0 ? void 0 : _a.setEnableGridInsert(enable);
550
+ }
551
+ setEnableContinuousInsert(enable) {
552
+ var _a;
553
+ (_a = this._editionManager) === null || _a === void 0 ? void 0 : _a.setEnableContinuousInsert(enable);
554
+ }
494
555
  setFocusFirstRow() {
495
556
  const firstRow = this._gridOptions.api.getDisplayedRowAtIndex(0);
496
557
  if (firstRow) {
@@ -506,9 +567,53 @@ export default class AgGridController {
506
567
  this.setFocusOnRow(lastRow.rowIndex);
507
568
  }
508
569
  }
570
+ startEditionOnRowByIndex(rowIndex) {
571
+ this._dataUnit.setSelectionByIndex([rowIndex]);
572
+ const firstCol = this.getFirstEditableColl(rowIndex);
573
+ if (!firstCol)
574
+ return;
575
+ this.focusByCollAndRow(firstCol, rowIndex);
576
+ this.startEdition(rowIndex, firstCol);
577
+ }
578
+ startEditionOnLastRow() {
579
+ var _a;
580
+ if (this._gridShowDom) {
581
+ const newRowIndex = ((_a = this._dataUnit.records) === null || _a === void 0 ? void 0 : _a.length) - 1;
582
+ this.startEditionOnRowByIndex(newRowIndex);
583
+ }
584
+ }
585
+ startEdition(rowIndex, firstCol) {
586
+ this._gridOptions.api.clearRangeSelection();
587
+ this._gridOptions.api.addCellRange({ rowStartIndex: rowIndex, rowEndIndex: rowIndex, columns: [firstCol] });
588
+ this._gridOptions.api.setFocusedCell(rowIndex, firstCol);
589
+ this._gridOptions.api.startEditingCell({ rowIndex, colKey: firstCol });
590
+ const cellEditor = this._gridOptions.api.getCellEditorInstances()[0];
591
+ if (cellEditor) {
592
+ cellEditor.focusIn();
593
+ }
594
+ }
595
+ getFirstEditableColl(rowIndex) {
596
+ try {
597
+ const displayedColumns = this._gridOptions.columnApi.getAllDisplayedColumns();
598
+ return displayedColumns.find(column => this.isColumnEditable(rowIndex, column));
599
+ }
600
+ catch (e) {
601
+ console.warn(e);
602
+ }
603
+ }
604
+ isColumnEditable(rowIndex, column) {
605
+ if (column.getColDef().headerName === '' || rowIndex === -1)
606
+ return false;
607
+ const rowId = this._dataUnit.records[rowIndex][this._idAttribName];
608
+ const rowNode = this._gridOptions.api.getRowNode(rowId);
609
+ return column.isCellEditable(rowNode);
610
+ }
509
611
  setFocusOnRow(rowIndex) {
510
612
  let displayedColumns = this._gridOptions.columnApi.getAllDisplayedColumns();
511
- let firstCell = displayedColumns.find(column => column.getColDef().headerName !== '');
613
+ let firstColl = displayedColumns.find(column => column.getColDef().headerName !== '');
614
+ this.focusByCollAndRow(firstColl, rowIndex);
615
+ }
616
+ focusByCollAndRow(firstCell, rowIndex) {
512
617
  this._gridOptions.api.ensureColumnVisible(firstCell);
513
618
  this._gridOptions.api.ensureIndexVisible(rowIndex);
514
619
  this._gridOptions.api.setFocusedCell(rowIndex, firstCell);
@@ -830,36 +935,41 @@ export default class AgGridController {
830
935
  return false;
831
936
  }
832
937
  onSelectionChange(event) {
833
- if (this._selectionChangeCallback) {
834
- clearTimeout(this._selectionChangeDeboucing);
835
- this._selectionChangeDeboucing = window.setTimeout(() => {
836
- this._editionManager.proceedAutoSave();
837
- if (this._dataUnit) {
838
- if (event.context.selectionChangeQuietly) {
839
- const selectionInfo = this._dataUnit;
840
- this._selectionChangeCallback({
841
- selection: selectionInfo.records,
842
- selectionHeaderStatus: this.getSelectionHeaderStatus(),
843
- });
844
- }
845
- else {
846
- this._dataUnit.updatePageSelection(this._gridOptions.api.getSelectedRows().map((r) => r.__record__id__)).then(selectionInfo => {
847
- this._selectionChangeCallback({
848
- selection: selectionInfo.records,
849
- selectionHeaderStatus: this.getSelectionHeaderStatus(),
850
- });
851
- });
852
- }
853
- }
854
- else {
855
- this._selectionChangeCallback({
856
- selection: this._gridOptions.api.getSelectedRows(),
857
- selectionHeaderStatus: this.getSelectionHeaderStatus(),
858
- });
859
- }
860
- }, 0);
938
+ if (!this._selectionChangeCallback)
939
+ return;
940
+ clearTimeout(this._selectionChangeDeboucing);
941
+ this._selectionChangeDeboucing = window.setTimeout(() => {
942
+ this.handleExecuteProceedAutosave();
943
+ this.processBuildSelectionChangeCallback(event);
944
+ }, 0);
945
+ }
946
+ handleExecuteProceedAutosave() {
947
+ if (this._gridShowDom) {
948
+ this._editionManager.proceedAutoSave();
861
949
  }
862
950
  }
951
+ processBuildSelectionChangeCallback(event) {
952
+ if (this._dataUnit) {
953
+ this.handleBuildSelectionChangeWithDU(event.context.selectionChangeQuietly);
954
+ return;
955
+ }
956
+ this.buildSelectionChangeCallback(this._gridOptions.api.getSelectedRows());
957
+ }
958
+ handleBuildSelectionChangeWithDU(quietly) {
959
+ if (quietly) {
960
+ this.buildSelectionChangeCallback(this._dataUnit.records);
961
+ return;
962
+ }
963
+ this._dataUnit.updatePageSelection(this._gridOptions.api.getSelectedRows()
964
+ .map((r) => r.__record__id__))
965
+ .then(selectionInfo => this.buildSelectionChangeCallback(selectionInfo.records));
966
+ }
967
+ buildSelectionChangeCallback(records) {
968
+ this._selectionChangeCallback({
969
+ selection: records,
970
+ selectionHeaderStatus: this.getSelectionHeaderStatus(),
971
+ });
972
+ }
863
973
  onRowDoubleClick(evt) {
864
974
  if (this._doubleClickCallBack) {
865
975
  this._doubleClickCallBack(evt.data);
@@ -870,6 +980,12 @@ export default class AgGridController {
870
980
  host[attribute] = value;
871
981
  }
872
982
  }
983
+ processEditionCanceled() {
984
+ this.clearInvalidCells(true);
985
+ if (this._gridShowDom) {
986
+ this._dataUnit.clearSelection();
987
+ }
988
+ }
873
989
  setCellEditors(customEditors) {
874
990
  var _a;
875
991
  if (!this._editionManager) {
@@ -888,4 +1004,16 @@ export default class AgGridController {
888
1004
  this._editionManager.setCellRenders(customRenders);
889
1005
  (_a = this._gridOptions) === null || _a === void 0 ? void 0 : _a.api.redrawRows();
890
1006
  }
1007
+ clearInvalidCells(stopEdition) {
1008
+ if (!this._editionManager)
1009
+ return;
1010
+ this._editionManager.clearInvalidCells(stopEdition);
1011
+ this._gridOptions.api.refreshCells({ force: true });
1012
+ }
1013
+ processContinuousInsert() {
1014
+ this._editionManager.processContinuousInsert();
1015
+ }
1016
+ destroy() {
1017
+ this.observer.disconnect();
1018
+ }
891
1019
  }
@@ -2,6 +2,87 @@ import { Action, ObjectUtils } from '@sankhyalabs/core';
2
2
  import { EZ_GRID_LOADING_SOURCE } from "../../../../utils/constants";
3
3
  import { DataSourceInterceptor } from "./DataSourceInterceptor";
4
4
  export default class DataSource {
5
+ handleDataSaved(action) {
6
+ this._controller.clearInvalidCells();
7
+ this.handleRefreshOrReload(action);
8
+ this._controller.processContinuousInsert();
9
+ }
10
+ handleEditionCanceled(action) {
11
+ if (this._options.enableGridInsert) {
12
+ this._controller.processEditionCanceled();
13
+ }
14
+ this.handleRefreshOrReload(action);
15
+ }
16
+ handleSavingCanceled(action) {
17
+ var _a, _b, _c, _d;
18
+ if (!((_a = action.payload) === null || _a === void 0 ? void 0 : _a.fields) || !((_b = action.payload) === null || _b === void 0 ? void 0 : _b.recordId))
19
+ return;
20
+ this._controller.savingCanceled((_c = action.payload) === null || _c === void 0 ? void 0 : _c.fields, (_d = action.payload) === null || _d === void 0 ? void 0 : _d.recordId);
21
+ }
22
+ handleDataChanged(action) {
23
+ if (!this._options.enableGridInsert) {
24
+ this.handleRefresh(action);
25
+ return;
26
+ }
27
+ this.updateGridRowNodes(this.createRecordIdList(action));
28
+ }
29
+ createRecordIdList(action) {
30
+ var _a, _b;
31
+ if ((_a = action.payload) === null || _a === void 0 ? void 0 : _a.records)
32
+ return (_b = action.payload) === null || _b === void 0 ? void 0 : _b.records;
33
+ return this._dataUnit.getSelectedRecord() ? [this._dataUnit.getSelectedRecord().__record__id__] : [];
34
+ }
35
+ /**
36
+ * Nesse ponto, o registro já se encontra atualizado no DU,
37
+ * basta então passar seu valor para que a garde possa atualizar sua linha.
38
+ */
39
+ updateGridRowNodes(recordIDList) {
40
+ const recordsToUpdate = recordIDList === null || recordIDList === void 0 ? void 0 : recordIDList.map(id => this.getRecordById(id));
41
+ this._controller.updateRows(recordsToUpdate);
42
+ }
43
+ getRecordById(recordId) {
44
+ return this._dataUnit.records.find(record => record['__record__id__'] === recordId);
45
+ }
46
+ /**
47
+ * Em caso de necessidade de reload (isWaitingToReload), eh preciso chamar o dataUnit.gotoPage, pois ele aplica tambem a ordenacao dos registros,
48
+ * enquanto que o _controller.refresh apenas recarrega os dados na ordem que atua.
49
+ */
50
+ handleRefreshOrReload(action) {
51
+ if (this._dataUnit.isWaitingToReload()) {
52
+ this.handleReload();
53
+ return;
54
+ }
55
+ this.handleRefresh(action);
56
+ }
57
+ handleReload() {
58
+ this._dataUnit.setWaitingToReload(false);
59
+ this._dataUnit.gotoPage(0);
60
+ }
61
+ handleRefresh(action) {
62
+ if (this.isSilentChange(action)) {
63
+ return;
64
+ }
65
+ this._controller.refresh(action.type === Action.DATA_SAVED);
66
+ }
67
+ handleRecordsAdded() {
68
+ if (this._options.enableGridInsert) {
69
+ this._controller.refresh();
70
+ this.focusOnNewRecord();
71
+ }
72
+ }
73
+ focusOnNewRecord() {
74
+ /**
75
+ * O SetTimeout eh utilizado pois é preciso aguardar que o novo registro seja renderizado na grade.
76
+ * Tentamos utilizar a api da grade para adicionar um event listener, porém na versão que utilizamos, não existe
77
+ * algo que resolva nosso cenário.
78
+ *
79
+ * Sugiro no futuro utilizar algo como o applyServerSideTransaction, porém será preciso lidar com os handlers
80
+ * e callbacks implementados no AgGridController e GridEditionManager.
81
+ */
82
+ setTimeout(() => {
83
+ this._controller.startEditionOnLastRow();
84
+ }, 1000);
85
+ }
5
86
  updateLoadedRecords(action) {
6
87
  const records = action.payload;
7
88
  if ((records === null || records === void 0 ? void 0 : records.length) > 0) {
@@ -53,15 +134,22 @@ export default class DataSource {
53
134
  this._options.onPaginationUpdate(this._dataUnit.getPaginationInfo());
54
135
  }
55
136
  break;
56
- case Action.RECORDS_REMOVED:
137
+ case Action.RECORDS_ADDED:
138
+ case Action.RECORDS_COPIED:
139
+ this.handleRecordsAdded();
140
+ break;
57
141
  case Action.DATA_SAVED:
142
+ this.handleDataSaved(action);
143
+ break;
58
144
  case Action.EDITION_CANCELED:
145
+ this.handleEditionCanceled(action);
146
+ break;
59
147
  case Action.DATA_CHANGED:
60
148
  case Action.DATA_RESOLVED:
61
- if (this.isSilentChange(action)) {
62
- return;
63
- }
64
- this._controller.refresh();
149
+ this.handleDataChanged(action);
150
+ break;
151
+ case Action.RECORDS_REMOVED:
152
+ this.handleRefresh(action);
65
153
  break;
66
154
  case Action.SELECTION_CHANGED:
67
155
  case Action.NEXT_SELECTED:
@@ -71,6 +159,9 @@ export default class DataSource {
71
159
  case Action.RECORD_LOADED:
72
160
  this.updateLoadedRecords(action);
73
161
  break;
162
+ case Action.SAVING_CANCELED:
163
+ this.handleSavingCanceled(action);
164
+ break;
74
165
  }
75
166
  };
76
167
  this._dataUnit = dataUnit;
@@ -92,6 +183,9 @@ export default class DataSource {
92
183
  setAutoFocus(autoFocus) {
93
184
  this._options.autoFocus = autoFocus;
94
185
  }
186
+ setEnableGridInsert(enable) {
187
+ this._options.enableGridInsert = enable;
188
+ }
95
189
  getRows(params) {
96
190
  if (this.needReload(params)) {
97
191
  this._lastLoadingParams = params;
@@ -1,19 +1,21 @@
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 { 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';
7
7
  export default class GridEditionManager {
8
- constructor(dataUnit, useEnterLikeTab, recordsValidator, editionIsDisabled, customEditors, customRenders) {
8
+ constructor(dataUnit, useEnterLikeTab, recordsValidator, editionIsDisabled, customEditors, customRenders, enableContinuousInsert, enableGridInsert) {
9
9
  this._dataUnit = dataUnit;
10
10
  this._recordValidationProcessor = new RecordValidationProcessor(this._dataUnit, {
11
11
  getRequiredFields: () => this.getRequiredFields(),
12
- markAsInvalid: () => { },
13
- getMessageForField: () => null
12
+ markAsInvalid: (invalidField, recordId) => { this.setInvalidCell(invalidField, recordId); },
13
+ getMessageForField: () => null,
14
14
  }, recordsValidator);
15
15
  this._useEnterLikeTab = useEnterLikeTab;
16
16
  this._editionIsDisabled = editionIsDisabled;
17
+ this._enableContinuousInsert = enableContinuousInsert;
18
+ this._enableGridInsert = enableGridInsert;
17
19
  this._customEditors = customEditors;
18
20
  this._customRenders = customRenders;
19
21
  }
@@ -28,20 +30,35 @@ export default class GridEditionManager {
28
30
  };
29
31
  return options;
30
32
  }
33
+ updateCurrentEditorGuiValue(updatedRowValue) {
34
+ const editorInstances = this._gridOptions.api.getCellEditorInstances();
35
+ if (!editorInstances || !editorInstances.length)
36
+ return;
37
+ const currentEditor = editorInstances[0];
38
+ const fieldMetadata = currentEditor.getFieldMetadata();
39
+ const fieldName = fieldMetadata.name;
40
+ const value = updatedRowValue[fieldName];
41
+ currentEditor.setGuiValue(value);
42
+ }
43
+ canContinuousInsert() {
44
+ var _a;
45
+ return this._enableContinuousInsert && (this._dataUnit.records.length - 1) === ((_a = this._lastCellEdited) === null || _a === void 0 ? void 0 : _a.rowIndex);
46
+ }
31
47
  proceedAutoSave() {
32
48
  if (!this._dataUnit.isDirty()) {
33
49
  this.saveSuccess();
34
50
  return;
35
51
  }
36
- if (!this._isGridEdition || this._dataUnit.hasNewRecord()) {
52
+ if (!this._isGridEdition) {
37
53
  return;
38
54
  }
39
55
  const currentRercord = this._dataUnit.getSelectedRecord();
40
56
  if (currentRercord == undefined) {
41
57
  return;
42
58
  }
59
+ this._invalidCell = undefined;
43
60
  this._recordValidationProcessor
44
- .validate()
61
+ .validate(true)
45
62
  .then(() => {
46
63
  this._dataUnit.saveData()
47
64
  .then(() => this.saveSuccess())
@@ -49,6 +66,16 @@ export default class GridEditionManager {
49
66
  })
50
67
  .catch(reason => this.saveFail(reason));
51
68
  }
69
+ async recordValidate() {
70
+ if (!this._dataUnit.isDirty())
71
+ return;
72
+ try {
73
+ this._invalidCell = undefined;
74
+ await this._recordValidationProcessor.validate(false);
75
+ }
76
+ catch (error) { }
77
+ this._gridOptions.api.refreshCells({ force: true });
78
+ }
52
79
  navigateByEnterKey(keyboardEvent) {
53
80
  const backwards = keyboardEvent.shiftKey;
54
81
  if (this._useEnterLikeTab) {
@@ -132,11 +159,12 @@ export default class GridEditionManager {
132
159
  }
133
160
  }
134
161
  focusOnCell(cell) {
162
+ var _a;
135
163
  if (cell == undefined) {
136
164
  return;
137
165
  }
138
166
  const { rowIndex, column } = cell;
139
- this._gridOptions.api.getDisplayedRowAtIndex(rowIndex).setSelected(true, true);
167
+ (_a = this._gridOptions.api.getDisplayedRowAtIndex(rowIndex)) === null || _a === void 0 ? void 0 : _a.setSelected(true, true);
140
168
  this._gridOptions.api.clearRangeSelection();
141
169
  this._gridOptions.api.addCellRange({ rowStartIndex: rowIndex, rowEndIndex: rowIndex, columns: [column] });
142
170
  this._gridOptions.api.startEditingCell({ colKey: column.getColId(), rowIndex });
@@ -176,9 +204,10 @@ export default class GridEditionManager {
176
204
  }
177
205
  }
178
206
  else {
207
+ const actualRowIndex = rowIndex;
179
208
  rowIndex = rowIndex + 1;
180
209
  if (rowIndex >= this._dataUnit.records.length) {
181
- rowIndex = 0;
210
+ rowIndex = !this._enableGridInsert ? 0 : actualRowIndex;
182
211
  }
183
212
  }
184
213
  this._targetEditionCell = new TargetEdition(rowIndex, column, true);
@@ -247,7 +276,7 @@ export default class GridEditionManager {
247
276
  event.node.setData(Object.assign(Object.assign({}, event.data), { [fieldName]: value }));
248
277
  }
249
278
  this._isGridEdition = true;
250
- this._dataUnit.setFieldValue(fieldName, value, [event.data.__record__id__]);
279
+ this._dataUnit.setFieldValue(fieldName, value, [event.data.__record__id__], { suppressCreateNewRecord: true });
251
280
  this._lastCellEdited = { rowIndex: event.rowIndex, column: event.column, rowPinned: undefined };
252
281
  }
253
282
  }
@@ -257,6 +286,36 @@ export default class GridEditionManager {
257
286
  setCellRenders(customRenders) {
258
287
  this._customRenders = customRenders;
259
288
  }
289
+ setInvalidCell(invalidCell, recordId) {
290
+ this._invalidCell = { field: invalidCell, recordId };
291
+ }
292
+ getInvalidCell() {
293
+ return this._invalidCell;
294
+ }
295
+ processContinuousInsert() {
296
+ if (!this.canContinuousInsert())
297
+ return;
298
+ this._dataUnit.addRecord();
299
+ }
300
+ clearInvalidCells(stopEdition) {
301
+ this._invalidCell = undefined;
302
+ if (stopEdition) {
303
+ this._isGridEdition = false;
304
+ }
305
+ }
306
+ setEnableContinuousInsert(enable) {
307
+ this._enableContinuousInsert = enable;
308
+ }
309
+ hasInvalidField(fieldName, recordId) {
310
+ if (!this.hasInvalidCell())
311
+ return false;
312
+ return this._invalidCell.field.name === fieldName && this._invalidCell.recordId === recordId;
313
+ }
314
+ hasInvalidCell() {
315
+ if (!this._invalidCell || !this._invalidCell.field || !this._invalidCell.recordId)
316
+ return false;
317
+ return true;
318
+ }
260
319
  }
261
320
  class TargetEdition {
262
321
  constructor(rowIndex, column, backwards) {
@@ -1,6 +1,7 @@
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";
4
5
  export default class EzGridCustomCellEditor extends EzCellEditor {
5
6
  init(params) {
6
7
  var _a, _b;
@@ -11,6 +12,8 @@ export default class EzGridCustomCellEditor extends EzCellEditor {
11
12
  this._defaultGui = this.getDefaultGui();
12
13
  const fieldMetadata = super.getFieldMetadata();
13
14
  this._params = {
15
+ cellPossition: getViewPortHeight(params.eGridCell),
16
+ eGridCell: params.eGridCell,
14
17
  value: params.value,
15
18
  charPress: params.charPress,
16
19
  currentEditor: this._defaultGui,
@@ -48,12 +51,18 @@ export default class EzGridCustomCellEditor extends EzCellEditor {
48
51
  const element = HTMLBuilder.parseElement(editorElement);
49
52
  return element;
50
53
  }
54
+ this._customGui = editorElement;
51
55
  return editorElement;
52
56
  }
53
57
  setValue(value) {
54
58
  this._value = value;
55
59
  }
56
60
  getValue() {
61
+ var _a, _b;
62
+ if ((_a = this._customGui) === null || _a === void 0 ? void 0 : _a.getValue)
63
+ return this._customGui.getValue();
64
+ if ((_b = this._customGui) === null || _b === void 0 ? void 0 : _b.hasAttribute('value'))
65
+ return this._customGui.value;
57
66
  return this._value;
58
67
  }
59
68
  }
@@ -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,6 +17,7 @@ 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 };
21
22
  return combo;
22
23
  };
@@ -9,7 +9,10 @@ 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;
13
16
  ezSearch.valueGetter = () => ezSearch.getValueAsync();
14
17
  return ezSearch;
15
18
  };
@@ -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
  }