@sankhyalabs/ezui 5.21.2 → 5.22.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/dist/cjs/ICustomRender-6fafffce.js +13 -0
  2. package/dist/cjs/ez-actions-button.cjs.entry.js +1 -0
  3. package/dist/cjs/ez-chart.cjs.entry.js +433 -0
  4. package/dist/cjs/ez-collapsible-box.cjs.entry.js +1 -0
  5. package/dist/cjs/ez-combo-box.cjs.entry.js +1 -0
  6. package/dist/cjs/{ez-text-edit.cjs.entry.js → ez-custom-form-input_2.cjs.entry.js} +99 -0
  7. package/dist/cjs/ez-form-view.cjs.entry.js +34 -3
  8. package/dist/cjs/ez-form.cjs.entry.js +77 -2
  9. package/dist/cjs/ez-grid.cjs.entry.js +313 -39
  10. package/dist/cjs/ez-list.cjs.entry.js +10 -2
  11. package/dist/cjs/ez-number-input.cjs.entry.js +37 -31
  12. package/dist/cjs/ez-scroller_2.cjs.entry.js +222 -0
  13. package/dist/cjs/ez-search.cjs.entry.js +39 -32
  14. package/dist/cjs/ez-sidebar-navigator.cjs.entry.js +92 -0
  15. package/dist/cjs/ez-split-item.cjs.entry.js +1 -0
  16. package/dist/cjs/{ez-scroller_3.cjs.entry.js → ez-tree.cjs.entry.js} +0 -215
  17. package/dist/cjs/ezui.cjs.js +1 -1
  18. package/dist/cjs/index-a7b0c73d.js +16 -4
  19. package/dist/cjs/loader.cjs.js +1 -1
  20. package/dist/collection/collection-manifest.json +3 -0
  21. package/dist/collection/components/ez-chart/components/BarChart.js +27 -0
  22. package/dist/collection/components/ez-chart/components/ColumnChart.js +27 -0
  23. package/dist/collection/components/ez-chart/components/DonutChart.js +42 -0
  24. package/dist/collection/components/ez-chart/components/LineChart.js +27 -0
  25. package/dist/collection/components/ez-chart/components/PieChart.js +45 -0
  26. package/dist/collection/components/ez-chart/components/index.js +5 -0
  27. package/dist/collection/components/ez-chart/ez-chart.css +5 -0
  28. package/dist/collection/components/ez-chart/ez-chart.js +284 -0
  29. package/dist/collection/components/ez-chart/interfaces/ChartAxis.js +1 -0
  30. package/dist/collection/components/ez-chart/interfaces/ChartContext.js +14 -0
  31. package/dist/collection/components/ez-chart/interfaces/ChartOptions.js +1 -0
  32. package/dist/collection/components/ez-chart/interfaces/ChartSerie.js +1 -0
  33. package/dist/collection/components/ez-chart/interfaces/ChartStrategies.js +1 -0
  34. package/dist/collection/components/ez-chart/interfaces/ChartType.js +8 -0
  35. package/dist/collection/components/ez-chart/interfaces/index.js +5 -0
  36. package/dist/collection/components/ez-chart/test/mock-chart.js +137 -0
  37. package/dist/collection/components/ez-chart/types/BaseHighChartsRender.js +146 -0
  38. package/dist/collection/components/ez-form/ez-form.js +130 -4
  39. package/dist/collection/components/ez-form-view/custom-input/ez-custom-form-input.js +278 -0
  40. package/dist/collection/components/ez-form-view/ez-form-view.js +110 -1
  41. package/dist/collection/components/ez-form-view/fieldbuilder/templates/NumberInput.tpl.js +3 -2
  42. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +51 -22
  43. package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +6 -1
  44. package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +35 -1
  45. package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.js +59 -0
  46. package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellRender.js +40 -0
  47. package/dist/collection/components/ez-grid/controller/ag-grid/components/test/constants/EzGridCustomCellEditorConstants.js +11 -0
  48. package/dist/collection/components/ez-grid/controller/ag-grid/components/test/constants/EzGridCustomCellRenderConstants.js +11 -0
  49. package/dist/collection/components/ez-grid/controller/ag-grid/editor/EzCellEditor.js +10 -3
  50. package/dist/collection/components/ez-grid/controller/ag-grid/editor/EzCellRender.js +40 -0
  51. package/dist/collection/components/ez-grid/controller/ag-grid/editor/IUICellRender.js +1 -0
  52. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/NumberInput.tpl.js +3 -2
  53. package/dist/collection/components/ez-grid/controller/ag-grid/test/constants/GridEditionMock.js +40 -0
  54. package/dist/collection/components/ez-grid/ez-grid.js +237 -12
  55. package/dist/collection/components/ez-grid/interfaces/ICustomFormatter.js +1 -0
  56. package/dist/collection/components/ez-grid/interfaces/index.js +1 -0
  57. package/dist/collection/components/ez-grid/test/resources/gridDataUnit.js +19 -0
  58. package/dist/collection/components/ez-list/ez-list.js +28 -2
  59. package/dist/collection/components/ez-number-input/ez-number-input.js +46 -31
  60. package/dist/collection/components/ez-search/ez-search.js +38 -32
  61. package/dist/collection/components/ez-sidebar-button/ez-sidebar-button.css +6 -2
  62. package/dist/collection/components/ez-sidebar-button/ez-sidebar-button.js +1 -1
  63. package/dist/collection/components/ez-sidebar-navigator/ez-sidebar-navigator.css +180 -0
  64. package/dist/collection/components/ez-sidebar-navigator/ez-sidebar-navigator.js +293 -0
  65. package/dist/collection/components/ez-sidebar-navigator/interfaces/ModeMenuEnum.js +5 -0
  66. package/dist/collection/components/ez-sidebar-navigator/interfaces/SizeMenuEnum.js +6 -0
  67. package/dist/collection/components/ez-sidebar-navigator/interfaces/TypeMenuEnum.js +6 -0
  68. package/dist/collection/components/ez-sidebar-navigator/interfaces/index.js +3 -0
  69. package/dist/collection/components/ez-sidebar-navigator/messages/constants.js +5 -0
  70. package/dist/collection/utils/customEditor/interfaces/ICustomEditor.js +5 -0
  71. package/dist/collection/utils/customEditor/interfaces/ICustomEditorInfo.js +1 -0
  72. package/dist/collection/utils/customRender/interfaces/ICustomRender.js +5 -0
  73. package/dist/collection/utils/customRender/interfaces/ICustomRenderInfo.js +1 -0
  74. package/dist/collection/utils/form/DataBinder.js +26 -0
  75. package/dist/collection/utils/form/test/DataBinder.test.js +41 -4
  76. package/dist/collection/utils/form/test/resources/metadataTest.js +15 -0
  77. package/dist/collection/utils/index.js +2 -0
  78. package/dist/custom-elements/index.d.ts +18 -0
  79. package/dist/custom-elements/index.js +1145 -117
  80. package/dist/esm/ICustomRender-875b5a40.js +13 -0
  81. package/dist/esm/ez-actions-button.entry.js +1 -0
  82. package/dist/esm/ez-chart.entry.js +429 -0
  83. package/dist/esm/ez-collapsible-box.entry.js +1 -0
  84. package/dist/esm/ez-combo-box.entry.js +1 -0
  85. package/dist/esm/{ez-text-edit.entry.js → ez-custom-form-input_2.entry.js} +101 -3
  86. package/dist/esm/ez-form-view.entry.js +34 -3
  87. package/dist/esm/ez-form.entry.js +78 -3
  88. package/dist/esm/ez-grid.entry.js +313 -39
  89. package/dist/esm/ez-list.entry.js +10 -2
  90. package/dist/esm/ez-number-input.entry.js +38 -32
  91. package/dist/esm/ez-scroller_2.entry.js +217 -0
  92. package/dist/esm/ez-search.entry.js +39 -32
  93. package/dist/esm/ez-sidebar-navigator.entry.js +88 -0
  94. package/dist/esm/ez-split-item.entry.js +1 -0
  95. package/dist/esm/{ez-scroller_3.entry.js → ez-tree.entry.js} +3 -216
  96. package/dist/esm/ezui.js +1 -1
  97. package/dist/esm/index-baa5e267.js +16 -4
  98. package/dist/esm/loader.js +1 -1
  99. package/dist/ezui/ezui.esm.js +1 -1
  100. package/dist/ezui/p-12ae1104.entry.js +1 -0
  101. package/dist/ezui/p-2097d0cf.entry.js +1 -0
  102. package/dist/ezui/p-3b4eeeb6.entry.js +1 -0
  103. package/dist/ezui/p-4607fb89.js +1 -0
  104. package/dist/ezui/p-4d5235f1.entry.js +1 -0
  105. package/dist/ezui/p-5056284a.entry.js +1 -0
  106. package/dist/ezui/p-7922142b.entry.js +1 -0
  107. package/dist/ezui/{p-fbee26ec.entry.js → p-816cece6.entry.js} +2 -2
  108. package/dist/ezui/p-84e439b9.entry.js +1 -0
  109. package/dist/ezui/p-8888d9ed.entry.js +1 -0
  110. package/dist/ezui/p-922ac38b.entry.js +1 -0
  111. package/dist/ezui/p-9ab22a07.entry.js +1 -0
  112. package/dist/ezui/p-a31b9c90.entry.js +1 -0
  113. package/dist/ezui/p-bcb53f27.entry.js +1 -0
  114. package/dist/ezui/p-ecc2c1ec.entry.js +1 -0
  115. package/dist/ezui/p-ffef392d.entry.js +1 -0
  116. package/dist/types/components/ez-chart/components/BarChart.d.ts +9 -0
  117. package/dist/types/components/ez-chart/components/ColumnChart.d.ts +9 -0
  118. package/dist/types/components/ez-chart/components/DonutChart.d.ts +9 -0
  119. package/dist/types/components/ez-chart/components/LineChart.d.ts +9 -0
  120. package/dist/types/components/ez-chart/components/PieChart.d.ts +9 -0
  121. package/dist/types/components/ez-chart/components/index.d.ts +5 -0
  122. package/dist/types/components/ez-chart/ez-chart.d.ts +58 -0
  123. package/dist/types/components/ez-chart/interfaces/ChartAxis.d.ts +7 -0
  124. package/dist/types/components/ez-chart/interfaces/ChartContext.d.ts +11 -0
  125. package/dist/types/components/ez-chart/interfaces/ChartOptions.d.ts +10 -0
  126. package/dist/types/components/ez-chart/interfaces/ChartSerie.d.ts +20 -0
  127. package/dist/types/components/ez-chart/interfaces/ChartStrategies.d.ts +7 -0
  128. package/dist/types/components/ez-chart/interfaces/ChartType.d.ts +7 -0
  129. package/dist/types/components/ez-chart/interfaces/index.d.ts +5 -0
  130. package/dist/types/components/ez-chart/types/BaseHighChartsRender.d.ts +15 -0
  131. package/dist/types/components/ez-form/ez-form.d.ts +20 -1
  132. package/dist/types/components/ez-form-view/custom-input/ez-custom-form-input.d.ts +48 -0
  133. package/dist/types/components/ez-form-view/ez-form-view.d.ts +16 -1
  134. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +37 -0
  135. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +13 -4
  136. package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +1 -0
  137. package/dist/types/components/ez-grid/controller/ag-grid/GridEditionManager.d.ts +7 -1
  138. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.d.ts +19 -0
  139. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellRender.d.ts +14 -0
  140. package/dist/types/components/ez-grid/controller/ag-grid/components/test/constants/EzGridCustomCellEditorConstants.d.ts +11 -0
  141. package/dist/types/components/ez-grid/controller/ag-grid/components/test/constants/EzGridCustomCellRenderConstants.d.ts +11 -0
  142. package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellEditor.d.ts +6 -0
  143. package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellRender.d.ts +15 -0
  144. package/dist/types/components/ez-grid/controller/ag-grid/editor/IUICellRender.d.ts +10 -0
  145. package/dist/types/components/ez-grid/controller/ag-grid/test/constants/GridEditionMock.d.ts +6 -0
  146. package/dist/types/components/ez-grid/ez-grid.d.ts +35 -1
  147. package/dist/types/components/ez-grid/interfaces/ICustomFormatter.d.ts +5 -0
  148. package/dist/types/components/ez-grid/interfaces/index.d.ts +1 -0
  149. package/dist/types/components/ez-grid/test/resources/gridDataUnit.d.ts +2 -0
  150. package/dist/types/components/ez-list/ez-list.d.ts +5 -0
  151. package/dist/types/components/ez-number-input/ez-number-input.d.ts +3 -0
  152. package/dist/types/components/ez-search/ez-search.d.ts +4 -2
  153. package/dist/types/components/ez-sidebar-navigator/ez-sidebar-navigator.d.ts +57 -0
  154. package/dist/types/components/ez-sidebar-navigator/interfaces/ModeMenuEnum.d.ts +4 -0
  155. package/dist/types/components/ez-sidebar-navigator/interfaces/SizeMenuEnum.d.ts +5 -0
  156. package/dist/types/components/ez-sidebar-navigator/interfaces/TypeMenuEnum.d.ts +5 -0
  157. package/dist/types/components/ez-sidebar-navigator/interfaces/index.d.ts +3 -0
  158. package/dist/types/components/ez-sidebar-navigator/messages/constants.d.ts +5 -0
  159. package/dist/types/components.d.ts +334 -5
  160. package/dist/types/utils/customEditor/interfaces/ICustomEditor.d.ts +31 -0
  161. package/dist/types/utils/customEditor/interfaces/ICustomEditorInfo.d.ts +5 -0
  162. package/dist/types/utils/customRender/interfaces/ICustomRender.d.ts +29 -0
  163. package/dist/types/utils/customRender/interfaces/ICustomRenderInfo.d.ts +5 -0
  164. package/dist/types/utils/form/DataBinder.d.ts +3 -0
  165. package/dist/types/utils/form/test/resources/metadataTest.d.ts +2 -0
  166. package/dist/types/utils/index.d.ts +2 -0
  167. package/package.json +2 -1
  168. package/react/components.d.ts +3 -0
  169. package/react/components.js +3 -0
  170. package/react/components.js.map +1 -1
  171. package/dist/ezui/p-0447d17c.entry.js +0 -1
  172. package/dist/ezui/p-20ec22c0.entry.js +0 -1
  173. package/dist/ezui/p-2a1a0e04.entry.js +0 -1
  174. package/dist/ezui/p-637f69f2.entry.js +0 -1
  175. package/dist/ezui/p-786559c5.entry.js +0 -1
  176. package/dist/ezui/p-7c770f14.entry.js +0 -1
  177. package/dist/ezui/p-91f626d3.entry.js +0 -1
  178. package/dist/ezui/p-99ead599.entry.js +0 -1
  179. package/dist/ezui/p-b567fa8c.entry.js +0 -1
  180. package/dist/ezui/p-bae3d0aa.entry.js +0 -1
  181. package/dist/ezui/p-db77a984.entry.js +0 -1
@@ -15,6 +15,8 @@ export class EzGrid {
15
15
  constructor() {
16
16
  this._gridController = new AgGridController(false);
17
17
  this._messageFilterAppliedSuccess = 'Filtro de coluna aplicado com sucesso!';
18
+ this._customEditor = new Map();
19
+ this._customRenders = new Map();
18
20
  this._paginationInfo = undefined;
19
21
  this._paginationChangedByKeyboard = true;
20
22
  this._showSelectionCounter = false;
@@ -22,6 +24,7 @@ export class EzGrid {
22
24
  this._currentPageSelected = undefined;
23
25
  this._selectionCount = undefined;
24
26
  this._hasLeftButtons = false;
27
+ this._customFormatters = new Map();
25
28
  this.multipleSelection = undefined;
26
29
  this.config = undefined;
27
30
  this.selectionToastConfig = undefined;
@@ -32,6 +35,7 @@ export class EzGrid {
32
35
  this.useEnterLikeTab = false;
33
36
  this.recordsValidator = undefined;
34
37
  this.canEdit = true;
38
+ this.autoFocus = true;
35
39
  }
36
40
  /**
37
41
  * Aplica a definição de colunas.
@@ -93,6 +97,63 @@ export class EzGrid {
93
97
  async filterColumns(search) {
94
98
  return Promise.resolve(this._gridController.getColumnsState().filter(col => matches(col.label, search)));
95
99
  }
100
+ /**
101
+ * Registra um editor customizado para campos da grade e formulário.
102
+ */
103
+ async addCustomEditor(fieldName, customEditor, detailContext) {
104
+ const newCustomEditor = new Map(this._customEditor);
105
+ newCustomEditor.set(fieldName, {
106
+ customEditor,
107
+ detailContext,
108
+ });
109
+ this._customEditor = newCustomEditor;
110
+ this._gridController.setCellEditors(newCustomEditor);
111
+ }
112
+ /**
113
+ * Registra um render customizado para colunas da grid.
114
+ */
115
+ async addGridCustomRender(fieldName, customRender, detailContext) {
116
+ const newCustomRenders = new Map(this._customRenders);
117
+ newCustomRenders.set(fieldName, { customRender, detailContext });
118
+ this._customRenders = newCustomRenders;
119
+ this._gridController.setCellRenders(newCustomRenders);
120
+ }
121
+ /**
122
+ * Registra um formatador de valores para uma coluna da grid.
123
+ */
124
+ async addCustomValueFormatter(columnName, customFormatter) {
125
+ if (!columnName || !customFormatter) {
126
+ return;
127
+ }
128
+ const newCustomFormatters = new Map(this._customFormatters);
129
+ newCustomFormatters.set(columnName, customFormatter);
130
+ this._customFormatters = newCustomFormatters;
131
+ this._gridController.setCustomFormatters(newCustomFormatters);
132
+ }
133
+ /**
134
+ * Remove o formatador de valores de uma coluna da grid.
135
+ */
136
+ async removeCustomValueFormatter(columnName) {
137
+ if (!columnName) {
138
+ return;
139
+ }
140
+ const newCustomFormatters = new Map(this._customFormatters);
141
+ newCustomFormatters.delete(columnName);
142
+ this._customFormatters = newCustomFormatters;
143
+ this._gridController.setCustomFormatters(newCustomFormatters);
144
+ }
145
+ /**
146
+ * Atualiza linhas da grade.
147
+ */
148
+ async refreshSelectedRows() {
149
+ this._gridController.refreshSelectedRows();
150
+ }
151
+ /**
152
+ * Retorna o formatador customizado da coluna caso exista.
153
+ */
154
+ async getCustomValueFormatter(columnName) {
155
+ return this._customFormatters.get(columnName);
156
+ }
96
157
  /**
97
158
  * Atribui o foco para a grade.
98
159
  */
@@ -252,7 +313,9 @@ export class EzGrid {
252
313
  const dataInfo = { dataUnit: this.dataUnit };
253
314
  ElementIDUtils.addIDInfo(this._element, null, dataInfo);
254
315
  const dtInfo = { id: 'ezGrid' };
255
- ElementIDUtils.addIDInfo(this._refPaginationControl, 'pagination', dtInfo);
316
+ if (this._refPaginationControl) {
317
+ ElementIDUtils.addIDInfo(this._refPaginationControl, 'pagination', dtInfo);
318
+ }
256
319
  }
257
320
  previousPage() {
258
321
  if (this.dataUnit) {
@@ -272,14 +335,10 @@ export class EzGrid {
272
335
  (_a = this._gridApi) === null || _a === void 0 ? void 0 : _a.clearRangeSelection();
273
336
  }
274
337
  getPaginationControl() {
275
- if (this._paginationInfo) {
276
- const { currentPage, hasMore } = this._paginationInfo;
277
- return [
278
- h("div", { class: "ez-text ez-text--primary ez-text--medium ez-margin-right--medium", ref: (element) => (this._refPaginationLabel = element) }, h("span", { class: "grid-header__pagination-label" }, h("strong", { class: "ez-text ez-text--primary ez-text--medium" }, this._getActualPageLabel()), this._getRemainingPageLabel())),
279
- h("div", { id: "grid-pagination-tooltip", ref: (element) => (this._refPaginationLabelTooltip = element), class: "ez-flex ez-margin-right--medium" }, h("ez-button", { size: "small", class: "ez-margin-right--medium", iconName: "chevron-left", mode: "icon", enabled: currentPage > 0, onClick: () => this.previousPage(), label: "P\u00E1gina anterior" }), h("ez-button", { size: "small", iconName: "chevron-right", mode: "icon", enabled: hasMore, onClick: () => this.nextPage(), label: "Pr\u00F3xima P\u00E1gina" })),
280
- ];
281
- }
282
- return null;
338
+ if (!this._paginationInfo)
339
+ return null;
340
+ const { currentPage, hasMore } = this._paginationInfo;
341
+ return (h("div", { class: "grid-header__container grid-header__pagination", ref: ref => (this._refPaginationControl = ref) }, h("div", { class: "ez-text ez-text--primary ez-text--medium ez-margin-right--medium", ref: (element) => (this._refPaginationLabel = element) }, h("span", { class: "grid-header__pagination-label" }, h("strong", { class: "ez-text ez-text--primary ez-text--medium" }, this._getActualPageLabel()), this._getRemainingPageLabel())), h("div", { id: "grid-pagination-tooltip", ref: (element) => (this._refPaginationLabelTooltip = element), class: "ez-flex ez-margin-right--medium" }, h("ez-button", { size: "small", class: "ez-margin-right--medium", iconName: "chevron-left", mode: "icon", enabled: currentPage > 0, onClick: () => this.previousPage(), label: "P\u00E1gina anterior" }), h("ez-button", { size: "small", iconName: "chevron-right", mode: "icon", enabled: hasMore, onClick: () => this.nextPage(), label: "Pr\u00F3xima P\u00E1gina" }))));
283
342
  }
284
343
  componentDidLoad() {
285
344
  this._gridController.initDatagrid(this._container, {
@@ -301,6 +360,8 @@ export class EzGrid {
301
360
  useEnterLikeTab: this.useEnterLikeTab,
302
361
  recordsValidator: this.recordsValidator,
303
362
  editionIsDisabled: () => !this.canEdit,
363
+ customFormatters: this._customFormatters,
364
+ autoFocus: this.autoFocus,
304
365
  onRefresh: () => {
305
366
  if (this.dataUnit) {
306
367
  this.setSelection(this.dataUnit.getSelectionInfo());
@@ -321,7 +382,7 @@ export class EzGrid {
321
382
  }
322
383
  handlePaginationChange(selectFirstRecord, paginationInfo) {
323
384
  var _a;
324
- if (selectFirstRecord !== false) {
385
+ if (selectFirstRecord !== false && this.autoFocus) {
325
386
  if (((_a = this._paginationInfo) === null || _a === void 0 ? void 0 : _a.currentPage) > (paginationInfo === null || paginationInfo === void 0 ? void 0 : paginationInfo.currentPage) && this._paginationChangedByKeyboard) {
326
387
  this._gridController.setFocusLastRow();
327
388
  }
@@ -391,6 +452,9 @@ export class EzGrid {
391
452
  if (!this.dataUnit.name.includes("InMemoryDataUnit"))
392
453
  return;
393
454
  }
455
+ componentDidUpdate() {
456
+ this._gridController.setAutoFocus(this.autoFocus);
457
+ }
394
458
  getDataSource() {
395
459
  var _a;
396
460
  return (_a = this.columnfilterDataSource) !== null && _a !== void 0 ? _a : new InMemoryFilterColumnDataSource(this.dataUnit);
@@ -400,7 +464,7 @@ export class EzGrid {
400
464
  }
401
465
  render() {
402
466
  var _a;
403
- return (h(Host, { "no-header": this.hideHeader() }, h("div", { class: "grid__container ez-grid", ref: elem => (this._container = elem) }), h("div", { class: "ez-box ez-box--shadow ez-padding--medium grid-header" }, h("filter-column", { class: "grid-header__popover", noHeaderTaskBar: !this._hasLeftButtons, dataSource: this.getDataSource(), dataUnit: this.dataUnit, gridHeaderHidden: this.hideHeader(), ref: (element) => (this._filterColumn = element) }), h("div", { class: "grid-header__position" }, h("div", { class: "grid-header__container grid-header__left-container" }, h("slot", { name: "leftButtons" })), h("div", { class: "grid-header__container grid-header__pagination", ref: ref => (this._refPaginationControl = ref) }, this.getPaginationControl()))), h("div", { ref: (ref) => (this._gridSelectionCounter = ref), class: `grid__selection-counter ez-elevation--4
467
+ return (h(Host, { "no-header": this.hideHeader() }, h("div", { class: "grid__container ez-grid", ref: elem => (this._container = elem) }), h("div", { class: "ez-box ez-box--shadow ez-padding--medium grid-header" }, h("filter-column", { class: "grid-header__popover", noHeaderTaskBar: !this._hasLeftButtons, dataSource: this.getDataSource(), dataUnit: this.dataUnit, gridHeaderHidden: this.hideHeader(), ref: (element) => (this._filterColumn = element) }), h("div", { class: "grid-header__position" }, h("div", { class: "grid-header__container grid-header__left-container" }, h("slot", { name: "leftButtons" })), this.getPaginationControl())), h("div", { ref: (ref) => (this._gridSelectionCounter = ref), class: `grid__selection-counter ez-elevation--4
404
468
  ${this._showSelectionCounter ? 'grid__selection-counter--opened' : ''}
405
469
  ` }, h(SelectionCounter, { selectionCount: this._selectionCount, currentPageSelected: this._currentPageSelected, paginationInfo: this._paginationInfo, canSelectAll: (_a = this.selectionToastConfig) === null || _a === void 0 ? void 0 : _a.canSelectAll, allRecordSelected: this._isAllSelection, onSelectAll: () => this.onSelectAllRecords(), onSelectPage: () => this.onSelectPageRecords(), onClearAll: () => this.onClearSelectedRecords(), onClose: () => (this._showSelectionCounter = false) })), h("div", { class: "grid__footer" }, h("slot", { name: "footer" }))));
406
470
  }
@@ -612,6 +676,24 @@ export class EzGrid {
612
676
  "attribute": "can-edit",
613
677
  "reflect": false,
614
678
  "defaultValue": "true"
679
+ },
680
+ "autoFocus": {
681
+ "type": "boolean",
682
+ "mutable": false,
683
+ "complexType": {
684
+ "original": "boolean",
685
+ "resolved": "boolean",
686
+ "references": {}
687
+ },
688
+ "required": false,
689
+ "optional": true,
690
+ "docs": {
691
+ "tags": [],
692
+ "text": "Define se a grid ser\u00E1 focada ao ser carregada."
693
+ },
694
+ "attribute": "auto-focus",
695
+ "reflect": false,
696
+ "defaultValue": "true"
615
697
  }
616
698
  };
617
699
  }
@@ -623,7 +705,8 @@ export class EzGrid {
623
705
  "_isAllSelection": {},
624
706
  "_currentPageSelected": {},
625
707
  "_selectionCount": {},
626
- "_hasLeftButtons": {}
708
+ "_hasLeftButtons": {},
709
+ "_customFormatters": {}
627
710
  };
628
711
  }
629
712
  static get events() {
@@ -958,6 +1041,148 @@ export class EzGrid {
958
1041
  "tags": []
959
1042
  }
960
1043
  },
1044
+ "addCustomEditor": {
1045
+ "complexType": {
1046
+ "signature": "(fieldName: string, customEditor: ICustomEditor, detailContext?: string) => Promise<void>",
1047
+ "parameters": [{
1048
+ "tags": [],
1049
+ "text": ""
1050
+ }, {
1051
+ "tags": [],
1052
+ "text": ""
1053
+ }, {
1054
+ "tags": [],
1055
+ "text": ""
1056
+ }],
1057
+ "references": {
1058
+ "Promise": {
1059
+ "location": "global"
1060
+ },
1061
+ "ICustomEditor": {
1062
+ "location": "import",
1063
+ "path": "../../utils/customEditor/interfaces/ICustomEditor"
1064
+ }
1065
+ },
1066
+ "return": "Promise<void>"
1067
+ },
1068
+ "docs": {
1069
+ "text": "Registra um editor customizado para campos da grade e formul\u00E1rio.",
1070
+ "tags": []
1071
+ }
1072
+ },
1073
+ "addGridCustomRender": {
1074
+ "complexType": {
1075
+ "signature": "(fieldName: string, customRender: ICustomRender, detailContext?: string) => Promise<void>",
1076
+ "parameters": [{
1077
+ "tags": [],
1078
+ "text": ""
1079
+ }, {
1080
+ "tags": [],
1081
+ "text": ""
1082
+ }, {
1083
+ "tags": [],
1084
+ "text": ""
1085
+ }],
1086
+ "references": {
1087
+ "Promise": {
1088
+ "location": "global"
1089
+ },
1090
+ "ICustomRender": {
1091
+ "location": "import",
1092
+ "path": "../../utils/customRender/interfaces/ICustomRender"
1093
+ }
1094
+ },
1095
+ "return": "Promise<void>"
1096
+ },
1097
+ "docs": {
1098
+ "text": "Registra um render customizado para colunas da grid.",
1099
+ "tags": []
1100
+ }
1101
+ },
1102
+ "addCustomValueFormatter": {
1103
+ "complexType": {
1104
+ "signature": "(columnName: string, customFormatter: ICustomFormatter) => Promise<void>",
1105
+ "parameters": [{
1106
+ "tags": [],
1107
+ "text": ""
1108
+ }, {
1109
+ "tags": [],
1110
+ "text": ""
1111
+ }],
1112
+ "references": {
1113
+ "Promise": {
1114
+ "location": "global"
1115
+ },
1116
+ "ICustomFormatter": {
1117
+ "location": "import",
1118
+ "path": "./interfaces"
1119
+ }
1120
+ },
1121
+ "return": "Promise<void>"
1122
+ },
1123
+ "docs": {
1124
+ "text": "Registra um formatador de valores para uma coluna da grid.",
1125
+ "tags": []
1126
+ }
1127
+ },
1128
+ "removeCustomValueFormatter": {
1129
+ "complexType": {
1130
+ "signature": "(columnName: string) => Promise<void>",
1131
+ "parameters": [{
1132
+ "tags": [],
1133
+ "text": ""
1134
+ }],
1135
+ "references": {
1136
+ "Promise": {
1137
+ "location": "global"
1138
+ }
1139
+ },
1140
+ "return": "Promise<void>"
1141
+ },
1142
+ "docs": {
1143
+ "text": "Remove o formatador de valores de uma coluna da grid.",
1144
+ "tags": []
1145
+ }
1146
+ },
1147
+ "refreshSelectedRows": {
1148
+ "complexType": {
1149
+ "signature": "() => Promise<void>",
1150
+ "parameters": [],
1151
+ "references": {
1152
+ "Promise": {
1153
+ "location": "global"
1154
+ }
1155
+ },
1156
+ "return": "Promise<void>"
1157
+ },
1158
+ "docs": {
1159
+ "text": "Atualiza linhas da grade.",
1160
+ "tags": []
1161
+ }
1162
+ },
1163
+ "getCustomValueFormatter": {
1164
+ "complexType": {
1165
+ "signature": "(columnName: string) => Promise<ICustomFormatter | undefined>",
1166
+ "parameters": [{
1167
+ "tags": [],
1168
+ "text": ""
1169
+ }],
1170
+ "references": {
1171
+ "Promise": {
1172
+ "location": "global"
1173
+ },
1174
+ "ICustomFormatter": {
1175
+ "location": "import",
1176
+ "path": "./interfaces"
1177
+ }
1178
+ },
1179
+ "return": "Promise<ICustomFormatter>"
1180
+ },
1181
+ "docs": {
1182
+ "text": "Retorna o formatador customizado da coluna caso exista.",
1183
+ "tags": []
1184
+ }
1185
+ },
961
1186
  "setFocus": {
962
1187
  "complexType": {
963
1188
  "signature": "() => Promise<void>",
@@ -1,3 +1,4 @@
1
1
  export * from './ISelection';
2
2
  export * from './ISelectionToastConfig';
3
3
  export * from './IColumnFilter';
4
+ export * from './ICustomFormatter';
@@ -0,0 +1,19 @@
1
+ import { DataType, DataUnit, StringUtils } from "@sankhyalabs/core";
2
+ export function getDataUnit() {
3
+ const dataUnit = new DataUnit('EzGridDU');
4
+ dataUnit.pageSize = 3;
5
+ dataUnit.metadata = {
6
+ name: "exemplo.datagrid",
7
+ label: "Exemplo data grid",
8
+ fields: [
9
+ { name: "PRODUTO", label: "Produto", dataType: DataType.TEXT },
10
+ { name: "QUANTIDADE", label: "Quantidade", dataType: DataType.NUMBER }
11
+ ]
12
+ };
13
+ dataUnit.records = [
14
+ { __record__id__: StringUtils.generateUUID(), "PRODUTO": "Mamão", "QUANTIDADE": 1 },
15
+ { __record__id__: StringUtils.generateUUID(), "PRODUTO": "Mexerica", "QUANTIDADE": 2 }
16
+ ];
17
+ dataUnit.selectFirst();
18
+ return dataUnit;
19
+ }
@@ -514,6 +514,9 @@ export class EzList {
514
514
  }
515
515
  return h("div", { class: className, innerHTML: customContent });
516
516
  }
517
+ doubleClickItem(item) {
518
+ this.ezDoubleClick.emit(item);
519
+ }
517
520
  render() {
518
521
  return (h(Host, { ref: el => (this._element = el) }, this.useGroups ? (h("div", { class: "group-container", ref: el => (this._groupContainer = el), tabIndex: 0, onKeyDown: event => {
519
522
  this.keyDownHandler(event);
@@ -523,7 +526,9 @@ export class EzList {
523
526
  'hover-feedback': this.hoverFeedback,
524
527
  }, key: 'item_' + item.id }, {
525
528
  [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: ElementIDUtils.getInternalIDInfo(`ezListItem__${StringUtils.replaceAccentuatedChars(item.label)}`),
526
- }), h("div", { class: 'draggable' + (item.selected == true ? ' selected-item ' : '') + (this.ezSelectable == true ? ' selectable ' : ''), onClick: () => {
529
+ }), h("div", { class: 'draggable' + (item.selected == true ? ' selected-item ' : '') + (this.ezSelectable == true ? ' selectable ' : ''), onDblClick: () => {
530
+ this.doubleClickItem(item);
531
+ }, onClick: () => {
527
532
  this.setSelection(item);
528
533
  }, onDragLeave: () => {
529
534
  group.sort ? undefined : this.removeOverClass();
@@ -537,7 +542,9 @@ export class EzList {
537
542
  } }, h("div", { class: "draggable-list" }, this._listItems.map((item, index) => (h("li", Object.assign({ id: 'item_' + item.id, class: {
538
543
  'selectable-container': this.ezSelectable,
539
544
  'hover-feedback': this.hoverFeedback,
540
- }, key: 'item_' + item.id }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: ElementIDUtils.getInternalIDInfo(`ezListItem__${StringUtils.replaceAccentuatedChars(item.label)}`) }), h("div", { class: 'draggable' + (item.selected == true ? ' selected-item ' : '') + (this.ezSelectable == true ? ' selectable ' : ''), onDragStart: () => this.onDragStart({ item: item, index: index }), onClick: () => {
545
+ }, key: 'item_' + item.id }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: ElementIDUtils.getInternalIDInfo(`ezListItem__${StringUtils.replaceAccentuatedChars(item.label)}`) }), h("div", { class: 'draggable' + (item.selected == true ? ' selected-item ' : '') + (this.ezSelectable == true ? ' selectable ' : ''), onDragStart: () => this.onDragStart({ item: item, index: index }), onDblClick: () => {
546
+ this.doubleClickItem(item);
547
+ }, onClick: () => {
541
548
  this.setSelection(item);
542
549
  }, onDragLeave: () => this.removeOverClass(), onDragOver: event => this.onDragOverItem(event), onDragEnd: () => this.onDragEnd(), onDrop: event => this.onDrop(event, { item: item, index: index }), draggable: this.ezDraggable }, h("div", { class: "item-content" }, this.listMode === 'regular' ? (h(Fragment, null, this.ezDraggable ? h("span", { class: "draggable-icon" }) : undefined, !!this.itemLeftSlotBuilder && this.getContainerItemBuilder('left', item), h("p", { title: item.label, class: "person-name text--ellipsis" }, item.label))) : (h(Fragment, null, this.ezDraggable ? h("span", { class: "draggable-icon" }) : undefined, h("ez-check", { label: item.label, value: item.check, onEzChange: evt => this.ezCheckChange.emit({ id: item.id, label: item.label, check: evt.detail }) })))), !!this.itemSlotBuilder && this.getContainerItemBuilder('right', item))))), h("div", { class: "last-droppable-space", onDragLeave: () => this.removeOverClass(), onDragOver: event => {
543
550
  this.onDragOverLastIndex(event);
@@ -787,6 +794,25 @@ export class EzList {
787
794
  }
788
795
  }
789
796
  }
797
+ }, {
798
+ "method": "ezDoubleClick",
799
+ "name": "ezDoubleClick",
800
+ "bubbles": true,
801
+ "cancelable": true,
802
+ "composed": true,
803
+ "docs": {
804
+ "tags": [],
805
+ "text": "Emitido quando ocorre um duplo clique em um item da lista."
806
+ },
807
+ "complexType": {
808
+ "original": "ListItem",
809
+ "resolved": "ListItem",
810
+ "references": {
811
+ "ListItem": {
812
+ "location": "local"
813
+ }
814
+ }
815
+ }
790
816
  }];
791
817
  }
792
818
  static get methods() {
@@ -1,4 +1,4 @@
1
- import { ElementIDUtils, NumberUtils } from "@sankhyalabs/core";
1
+ import { ElementIDUtils, NumberUtils, StringUtils } from "@sankhyalabs/core";
2
2
  import { h } from "@stencil/core";
3
3
  import CSSVarsUtils from "../../utils/CSSVarsUtils";
4
4
  export class EzNumberInput {
@@ -6,6 +6,7 @@ export class EzNumberInput {
6
6
  this._focused = false;
7
7
  this._changePending = false;
8
8
  this._valuePromiseCallbacks = [];
9
+ this._value = undefined;
9
10
  this.label = undefined;
10
11
  this.value = undefined;
11
12
  this.enabled = true;
@@ -61,35 +62,42 @@ export class EzNumberInput {
61
62
  }
62
63
  observeValue(newValue, oldValue) {
63
64
  if (this._textInput && newValue != oldValue) {
64
- const newValueValidated = this.validateValue(newValue);
65
- const oldValueValidated = this.validateValue(oldValue);
66
- if (newValueValidated === null) {
67
- this._textInput.value = '';
68
- }
69
- if (newValueValidated != oldValueValidated) {
70
- const textValue = this.getTextValue(newValueValidated) || '';
71
- if ((this._textInput.value || '') !== textValue) {
72
- const parsedNumber = this.getParsedNumber(textValue);
73
- if (parsedNumber !== undefined || !this._focused) {
74
- this._textInput.value = textValue;
75
- this._focused = false;
76
- this.errorMessage = "";
77
- }
78
- }
79
- const valueEmitted = newValueValidated === null ? undefined : newValueValidated;
80
- this.ezChange.emit(valueEmitted);
81
- }
65
+ this.handleNewValue(newValue, oldValue);
82
66
  }
83
67
  this._changePending = false;
84
68
  }
69
+ observePrecision() {
70
+ if (this._textInput) {
71
+ this.setInputValue();
72
+ }
73
+ }
74
+ handleNewValue(newValue, oldValue) {
75
+ const newValueValidated = this.validateValue(newValue);
76
+ const oldValueValidated = this.validateValue(oldValue);
77
+ if (newValueValidated === null) {
78
+ this._value = '';
79
+ }
80
+ if (newValueValidated === oldValueValidated) {
81
+ return;
82
+ }
83
+ const textValue = this.getTextValue(newValueValidated) || '';
84
+ const parsedNumber = this.getParsedNumber(textValue);
85
+ if ((this._value || '') !== textValue && (parsedNumber !== undefined || !this._focused)) {
86
+ this._value = textValue;
87
+ this._focused = false;
88
+ this.errorMessage = "";
89
+ }
90
+ const valueEmitted = newValueValidated === null ? undefined : newValueValidated;
91
+ this.ezChange.emit(valueEmitted);
92
+ }
85
93
  validateValue(value) {
86
94
  return isNaN(value) || value === undefined ? null : value;
87
95
  }
88
96
  getTextValue(value) {
89
- if (value != undefined) {
90
- return this.precision > 0 ? NumberUtils.format(value.toString(), Number(this.precision), Number(this.prettyPrecision)) : value.toString();
91
- }
92
- return undefined;
97
+ if (value == undefined)
98
+ return undefined;
99
+ let textValue = this.precision >= 0 ? NumberUtils.format(value.toString(), Number(this.precision), Number(this.prettyPrecision)) : value.toString();
100
+ return (this.precision === 0) ? StringUtils.replaceAll(textValue, ".", "") : textValue;
93
101
  }
94
102
  changeValue(newValue) {
95
103
  this.errorMessage = "";
@@ -140,17 +148,13 @@ export class EzNumberInput {
140
148
  this.ezStartChange.emit({ waitmessage: "", blocking: false });
141
149
  }
142
150
  }
143
- getParsedNumber(value) {
144
- var _a;
145
- if (value === void 0) {
146
- value = (_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value;
147
- }
151
+ getParsedNumber(value = this._textInput.value) {
148
152
  return (value === null || value === void 0 ? void 0 : value.trim()) ? NumberUtils.stringToNumber(value) : undefined;
149
153
  }
150
154
  setInputValue() {
151
155
  const textValue = this.getTextValue(this.value) || '';
152
- if ((this._textInput.value || '') !== textValue) {
153
- this._textInput.value = textValue;
156
+ if ((this._value || '') !== textValue) {
157
+ this._value = textValue;
154
158
  }
155
159
  }
156
160
  componentDidLoad() {
@@ -159,7 +163,7 @@ export class EzNumberInput {
159
163
  }
160
164
  render() {
161
165
  ElementIDUtils.addIDInfoIfNotExists(this._elem, 'input');
162
- return (h("ez-text-input", { class: "number__input", "data-element-id": ElementIDUtils.getInternalIDInfo("textInput"), ref: elem => this._textInput = elem, "data-slave-mode": "true", label: this.label, onBlur: () => this.handleBlur(), onInput: () => this.handleInput(), restrict: this.precision > 0 ? "0123456789-,." : "0123456789-", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, canShowError: this.canShowError }));
166
+ return (h("ez-text-input", { class: "number__input", "data-element-id": ElementIDUtils.getInternalIDInfo("textInput"), ref: elem => this._textInput = elem, "data-slave-mode": "true", label: this.label, onBlur: () => this.handleBlur(), onInput: () => this.handleInput(), restrict: this.precision > 0 ? "0123456789-,." : "0123456789-", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, canShowError: this.canShowError, value: this._value }));
163
167
  }
164
168
  static get is() { return "ez-number-input"; }
165
169
  static get encapsulation() { return "shadow"; }
@@ -316,6 +320,11 @@ export class EzNumberInput {
316
320
  }
317
321
  };
318
322
  }
323
+ static get states() {
324
+ return {
325
+ "_value": {}
326
+ };
327
+ }
319
328
  static get events() {
320
329
  return [{
321
330
  "method": "ezChange",
@@ -455,6 +464,12 @@ export class EzNumberInput {
455
464
  }, {
456
465
  "propName": "value",
457
466
  "methodName": "observeValue"
467
+ }, {
468
+ "propName": "precision",
469
+ "methodName": "observePrecision"
470
+ }, {
471
+ "propName": "prettyPrecision",
472
+ "methodName": "observePrecision"
458
473
  }];
459
474
  }
460
475
  }