@sankhyalabs/ezui 5.21.4 → 5.22.0-dev.10

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 (201) 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 +435 -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 +37 -5
  8. package/dist/cjs/ez-form.cjs.entry.js +81 -2
  9. package/dist/cjs/ez-grid.cjs.entry.js +312 -40
  10. package/dist/cjs/ez-list.cjs.entry.js +10 -2
  11. package/dist/cjs/ez-modal-container.cjs.entry.js +2 -1
  12. package/dist/cjs/ez-modal.cjs.entry.js +7 -1
  13. package/dist/cjs/ez-number-input.cjs.entry.js +37 -31
  14. package/dist/cjs/ez-scroller_2.cjs.entry.js +222 -0
  15. package/dist/cjs/ez-search.cjs.entry.js +40 -33
  16. package/dist/cjs/ez-sidebar-navigator.cjs.entry.js +92 -0
  17. package/dist/cjs/ez-split-item.cjs.entry.js +1 -0
  18. package/dist/cjs/ez-tabselector.cjs.entry.js +8 -2
  19. package/dist/cjs/{ez-scroller_3.cjs.entry.js → ez-tree.cjs.entry.js} +0 -215
  20. package/dist/cjs/ezui.cjs.js +1 -1
  21. package/dist/cjs/index-a7b0c73d.js +16 -4
  22. package/dist/cjs/loader.cjs.js +1 -1
  23. package/dist/collection/collection-manifest.json +3 -0
  24. package/dist/collection/components/ez-chart/components/BarChart.js +27 -0
  25. package/dist/collection/components/ez-chart/components/ColumnChart.js +27 -0
  26. package/dist/collection/components/ez-chart/components/DonutChart.js +42 -0
  27. package/dist/collection/components/ez-chart/components/LineChart.js +27 -0
  28. package/dist/collection/components/ez-chart/components/PieChart.js +45 -0
  29. package/dist/collection/components/ez-chart/components/index.js +5 -0
  30. package/dist/collection/components/ez-chart/ez-chart.css +5 -0
  31. package/dist/collection/components/ez-chart/ez-chart.js +286 -0
  32. package/dist/collection/components/ez-chart/interfaces/ChartAxis.js +1 -0
  33. package/dist/collection/components/ez-chart/interfaces/ChartContext.js +14 -0
  34. package/dist/collection/components/ez-chart/interfaces/ChartOptions.js +1 -0
  35. package/dist/collection/components/ez-chart/interfaces/ChartSerie.js +1 -0
  36. package/dist/collection/components/ez-chart/interfaces/ChartStrategies.js +1 -0
  37. package/dist/collection/components/ez-chart/interfaces/ChartType.js +8 -0
  38. package/dist/collection/components/ez-chart/interfaces/index.js +5 -0
  39. package/dist/collection/components/ez-chart/test/mock-chart.js +137 -0
  40. package/dist/collection/components/ez-chart/types/BaseHighChartsRender.js +146 -0
  41. package/dist/collection/components/ez-form/ez-form.js +130 -4
  42. package/dist/collection/components/ez-form-view/custom-input/ez-custom-form-input.js +278 -0
  43. package/dist/collection/components/ez-form-view/ez-form-view.js +110 -1
  44. package/dist/collection/components/ez-form-view/fieldbuilder/templates/NumberInput.tpl.js +3 -2
  45. package/dist/collection/components/ez-form-view/fieldbuilder/templates/SearchInput.tpl.js +3 -2
  46. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +51 -22
  47. package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +6 -1
  48. package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +36 -2
  49. package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.js +59 -0
  50. package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellRender.js +40 -0
  51. package/dist/collection/components/ez-grid/controller/ag-grid/components/test/constants/EzGridCustomCellEditorConstants.js +11 -0
  52. package/dist/collection/components/ez-grid/controller/ag-grid/components/test/constants/EzGridCustomCellRenderConstants.js +11 -0
  53. package/dist/collection/components/ez-grid/controller/ag-grid/editor/EzCellEditor.js +10 -3
  54. package/dist/collection/components/ez-grid/controller/ag-grid/editor/EzCellRender.js +40 -0
  55. package/dist/collection/components/ez-grid/controller/ag-grid/editor/IUICellRender.js +1 -0
  56. package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/NumberInput.tpl.js +3 -2
  57. package/dist/collection/components/ez-grid/controller/ag-grid/test/constants/GridEditionMock.js +40 -0
  58. package/dist/collection/components/ez-grid/ez-grid.js +235 -12
  59. package/dist/collection/components/ez-grid/interfaces/ICustomFormatter.js +1 -0
  60. package/dist/collection/components/ez-grid/interfaces/index.js +1 -0
  61. package/dist/collection/components/ez-grid/test/resources/gridDataUnit.js +19 -0
  62. package/dist/collection/components/ez-list/ez-list.js +28 -2
  63. package/dist/collection/components/ez-modal/ez-modal.js +25 -1
  64. package/dist/collection/components/ez-modal-container/ez-modal-container.js +20 -1
  65. package/dist/collection/components/ez-number-input/ez-number-input.js +46 -31
  66. package/dist/collection/components/ez-search/ez-search.js +39 -33
  67. package/dist/collection/components/ez-sidebar-button/ez-sidebar-button.css +6 -2
  68. package/dist/collection/components/ez-sidebar-button/ez-sidebar-button.js +1 -1
  69. package/dist/collection/components/ez-sidebar-navigator/ez-sidebar-navigator.css +180 -0
  70. package/dist/collection/components/ez-sidebar-navigator/ez-sidebar-navigator.js +293 -0
  71. package/dist/collection/components/ez-sidebar-navigator/interfaces/ModeMenuEnum.js +5 -0
  72. package/dist/collection/components/ez-sidebar-navigator/interfaces/SizeMenuEnum.js +6 -0
  73. package/dist/collection/components/ez-sidebar-navigator/interfaces/TypeMenuEnum.js +6 -0
  74. package/dist/collection/components/ez-sidebar-navigator/interfaces/index.js +3 -0
  75. package/dist/collection/components/ez-sidebar-navigator/messages/constants.js +5 -0
  76. package/dist/collection/components/ez-tabselector/ez-tabselector.js +34 -2
  77. package/dist/collection/utils/customEditor/interfaces/ICustomEditor.js +5 -0
  78. package/dist/collection/utils/customEditor/interfaces/ICustomEditorInfo.js +1 -0
  79. package/dist/collection/utils/customRender/interfaces/ICustomRender.js +5 -0
  80. package/dist/collection/utils/customRender/interfaces/ICustomRenderInfo.js +1 -0
  81. package/dist/collection/utils/form/DataBinder.js +31 -1
  82. package/dist/collection/utils/form/test/DataBinder.test.js +41 -4
  83. package/dist/collection/utils/form/test/resources/metadataTest.js +15 -0
  84. package/dist/collection/utils/index.js +2 -0
  85. package/dist/custom-elements/index.d.ts +18 -0
  86. package/dist/custom-elements/index.js +1173 -127
  87. package/dist/esm/ICustomRender-875b5a40.js +13 -0
  88. package/dist/esm/ez-actions-button.entry.js +1 -0
  89. package/dist/esm/ez-chart.entry.js +431 -0
  90. package/dist/esm/ez-collapsible-box.entry.js +1 -0
  91. package/dist/esm/ez-combo-box.entry.js +1 -0
  92. package/dist/esm/{ez-text-edit.entry.js → ez-custom-form-input_2.entry.js} +101 -3
  93. package/dist/esm/ez-form-view.entry.js +37 -5
  94. package/dist/esm/ez-form.entry.js +82 -3
  95. package/dist/esm/ez-grid.entry.js +312 -40
  96. package/dist/esm/ez-list.entry.js +10 -2
  97. package/dist/esm/ez-modal-container.entry.js +2 -1
  98. package/dist/esm/ez-modal.entry.js +7 -1
  99. package/dist/esm/ez-number-input.entry.js +38 -32
  100. package/dist/esm/ez-scroller_2.entry.js +217 -0
  101. package/dist/esm/ez-search.entry.js +40 -33
  102. package/dist/esm/ez-sidebar-navigator.entry.js +88 -0
  103. package/dist/esm/ez-split-item.entry.js +1 -0
  104. package/dist/esm/ez-tabselector.entry.js +8 -2
  105. package/dist/esm/{ez-scroller_3.entry.js → ez-tree.entry.js} +3 -216
  106. package/dist/esm/ezui.js +1 -1
  107. package/dist/esm/index-baa5e267.js +16 -4
  108. package/dist/esm/loader.js +1 -1
  109. package/dist/ezui/ezui.esm.js +1 -1
  110. package/dist/ezui/p-2097d0cf.entry.js +1 -0
  111. package/dist/ezui/{p-9fbb0f01.entry.js → p-32e553e5.entry.js} +2 -2
  112. package/dist/ezui/p-34b6916c.entry.js +1 -0
  113. package/dist/ezui/p-3b4eeeb6.entry.js +1 -0
  114. package/dist/ezui/p-42533ea4.entry.js +1 -0
  115. package/dist/ezui/p-4607fb89.js +1 -0
  116. package/dist/ezui/p-4d5235f1.entry.js +1 -0
  117. package/dist/ezui/p-5b205c80.entry.js +1 -0
  118. package/dist/ezui/p-7922142b.entry.js +1 -0
  119. package/dist/ezui/p-84e439b9.entry.js +1 -0
  120. package/dist/ezui/p-8888d9ed.entry.js +1 -0
  121. package/dist/ezui/p-922ac38b.entry.js +1 -0
  122. package/dist/ezui/p-a31b9c90.entry.js +1 -0
  123. package/dist/ezui/p-aba3da00.entry.js +1 -0
  124. package/dist/ezui/p-bcb53f27.entry.js +1 -0
  125. package/dist/ezui/p-c0d9c4f8.entry.js +1 -0
  126. package/dist/ezui/p-cdc472cc.entry.js +1 -0
  127. package/dist/ezui/p-ecc2c1ec.entry.js +1 -0
  128. package/dist/ezui/p-fcf0acce.entry.js +1 -0
  129. package/dist/types/components/ez-chart/components/BarChart.d.ts +9 -0
  130. package/dist/types/components/ez-chart/components/ColumnChart.d.ts +9 -0
  131. package/dist/types/components/ez-chart/components/DonutChart.d.ts +9 -0
  132. package/dist/types/components/ez-chart/components/LineChart.d.ts +9 -0
  133. package/dist/types/components/ez-chart/components/PieChart.d.ts +9 -0
  134. package/dist/types/components/ez-chart/components/index.d.ts +5 -0
  135. package/dist/types/components/ez-chart/ez-chart.d.ts +58 -0
  136. package/dist/types/components/ez-chart/interfaces/ChartAxis.d.ts +7 -0
  137. package/dist/types/components/ez-chart/interfaces/ChartContext.d.ts +11 -0
  138. package/dist/types/components/ez-chart/interfaces/ChartOptions.d.ts +10 -0
  139. package/dist/types/components/ez-chart/interfaces/ChartSerie.d.ts +20 -0
  140. package/dist/types/components/ez-chart/interfaces/ChartStrategies.d.ts +7 -0
  141. package/dist/types/components/ez-chart/interfaces/ChartType.d.ts +7 -0
  142. package/dist/types/components/ez-chart/interfaces/index.d.ts +5 -0
  143. package/dist/types/components/ez-chart/types/BaseHighChartsRender.d.ts +15 -0
  144. package/dist/types/components/ez-form/ez-form.d.ts +20 -1
  145. package/dist/types/components/ez-form-view/custom-input/ez-custom-form-input.d.ts +48 -0
  146. package/dist/types/components/ez-form-view/ez-form-view.d.ts +16 -1
  147. package/dist/types/components/ez-form-view/fieldbuilder/templates/SearchInput.tpl.d.ts +1 -1
  148. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +37 -0
  149. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +13 -4
  150. package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +1 -0
  151. package/dist/types/components/ez-grid/controller/ag-grid/GridEditionManager.d.ts +7 -1
  152. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.d.ts +19 -0
  153. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellRender.d.ts +14 -0
  154. package/dist/types/components/ez-grid/controller/ag-grid/components/test/constants/EzGridCustomCellEditorConstants.d.ts +11 -0
  155. package/dist/types/components/ez-grid/controller/ag-grid/components/test/constants/EzGridCustomCellRenderConstants.d.ts +11 -0
  156. package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellEditor.d.ts +6 -0
  157. package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellRender.d.ts +15 -0
  158. package/dist/types/components/ez-grid/controller/ag-grid/editor/IUICellRender.d.ts +10 -0
  159. package/dist/types/components/ez-grid/controller/ag-grid/test/constants/GridEditionMock.d.ts +6 -0
  160. package/dist/types/components/ez-grid/ez-grid.d.ts +34 -1
  161. package/dist/types/components/ez-grid/interfaces/ICustomFormatter.d.ts +5 -0
  162. package/dist/types/components/ez-grid/interfaces/index.d.ts +1 -0
  163. package/dist/types/components/ez-grid/test/resources/gridDataUnit.d.ts +2 -0
  164. package/dist/types/components/ez-list/ez-list.d.ts +5 -0
  165. package/dist/types/components/ez-modal/ez-modal.d.ts +5 -0
  166. package/dist/types/components/ez-modal-container/ez-modal-container.d.ts +4 -0
  167. package/dist/types/components/ez-number-input/ez-number-input.d.ts +3 -0
  168. package/dist/types/components/ez-search/ez-search.d.ts +4 -2
  169. package/dist/types/components/ez-sidebar-navigator/ez-sidebar-navigator.d.ts +57 -0
  170. package/dist/types/components/ez-sidebar-navigator/interfaces/ModeMenuEnum.d.ts +4 -0
  171. package/dist/types/components/ez-sidebar-navigator/interfaces/SizeMenuEnum.d.ts +5 -0
  172. package/dist/types/components/ez-sidebar-navigator/interfaces/TypeMenuEnum.d.ts +5 -0
  173. package/dist/types/components/ez-sidebar-navigator/interfaces/index.d.ts +3 -0
  174. package/dist/types/components/ez-sidebar-navigator/messages/constants.d.ts +5 -0
  175. package/dist/types/components/ez-tabselector/ez-tabselector.d.ts +2 -1
  176. package/dist/types/components.d.ts +351 -5
  177. package/dist/types/utils/customEditor/interfaces/ICustomEditor.d.ts +31 -0
  178. package/dist/types/utils/customEditor/interfaces/ICustomEditorInfo.d.ts +5 -0
  179. package/dist/types/utils/customRender/interfaces/ICustomRender.d.ts +29 -0
  180. package/dist/types/utils/customRender/interfaces/ICustomRenderInfo.d.ts +5 -0
  181. package/dist/types/utils/form/DataBinder.d.ts +5 -0
  182. package/dist/types/utils/form/test/resources/metadataTest.d.ts +2 -0
  183. package/dist/types/utils/index.d.ts +2 -0
  184. package/package.json +2 -1
  185. package/react/components.d.ts +3 -0
  186. package/react/components.js +3 -0
  187. package/react/components.js.map +1 -1
  188. package/dist/ezui/p-0447d17c.entry.js +0 -1
  189. package/dist/ezui/p-20ec22c0.entry.js +0 -1
  190. package/dist/ezui/p-2a1a0e04.entry.js +0 -1
  191. package/dist/ezui/p-2dcb50d4.entry.js +0 -1
  192. package/dist/ezui/p-30775e7f.entry.js +0 -1
  193. package/dist/ezui/p-41ac6cd9.entry.js +0 -1
  194. package/dist/ezui/p-637f69f2.entry.js +0 -1
  195. package/dist/ezui/p-786559c5.entry.js +0 -1
  196. package/dist/ezui/p-91f626d3.entry.js +0 -1
  197. package/dist/ezui/p-99ead599.entry.js +0 -1
  198. package/dist/ezui/p-b567fa8c.entry.js +0 -1
  199. package/dist/ezui/p-bae3d0aa.entry.js +0 -1
  200. package/dist/ezui/p-db77a984.entry.js +0 -1
  201. package/dist/ezui/p-f3c526cc.entry.js +0 -1
@@ -0,0 +1,40 @@
1
+ import { StringUtils } from "@sankhyalabs/core";
2
+ const columnsState = [{
3
+ colId: StringUtils.generateUUID(),
4
+ }];
5
+ const colDef = {
6
+ headerName: 'name',
7
+ checkboxSelection: false,
8
+ };
9
+ export const gridEditionImplementation = {
10
+ getComponents: () => ({}),
11
+ configureGrid: (option) => (Object.assign(Object.assign({}, option), { api: {
12
+ setHeaderHeight: () => { },
13
+ forEachNode: () => { },
14
+ }, context: {}, columnApi: {
15
+ moveColumn: () => { },
16
+ setColumnWidth: () => { },
17
+ setColumnsVisible: () => { },
18
+ applyColumnState: () => { },
19
+ getColumns: () => ([]),
20
+ getColumn: () => ({
21
+ getActualWidth: () => 30,
22
+ getColDef: () => colDef,
23
+ }),
24
+ getColumnState: () => columnsState,
25
+ } }))
26
+ };
27
+ export function buildOptions(dataUnit) {
28
+ return ({
29
+ allowMultipleSelection: true,
30
+ dataUnit,
31
+ onColumnStateChange: () => { },
32
+ onDoubleClick: () => { },
33
+ onPaginationChange: () => { },
34
+ onPaginationUpdate: () => { },
35
+ onSelectionChange: () => { },
36
+ serverURL: '',
37
+ statusResolver: {},
38
+ useEnterLikeTab: true,
39
+ });
40
+ }
@@ -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
  }
@@ -392,6 +453,7 @@ export class EzGrid {
392
453
  return;
393
454
  }
394
455
  componentDidUpdate() {
456
+ this._gridController.setAutoFocus(this.autoFocus);
395
457
  if (this.dataUnit) {
396
458
  this.setSelection(this.dataUnit.getSelectionInfo());
397
459
  }
@@ -405,7 +467,7 @@ export class EzGrid {
405
467
  }
406
468
  render() {
407
469
  var _a;
408
- 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
470
+ 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
409
471
  ${this._showSelectionCounter ? 'grid__selection-counter--opened' : ''}
410
472
  ` }, 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" }))));
411
473
  }
@@ -617,6 +679,24 @@ export class EzGrid {
617
679
  "attribute": "can-edit",
618
680
  "reflect": false,
619
681
  "defaultValue": "true"
682
+ },
683
+ "autoFocus": {
684
+ "type": "boolean",
685
+ "mutable": false,
686
+ "complexType": {
687
+ "original": "boolean",
688
+ "resolved": "boolean",
689
+ "references": {}
690
+ },
691
+ "required": false,
692
+ "optional": true,
693
+ "docs": {
694
+ "tags": [],
695
+ "text": "Define se a grid ser\u00E1 focada ao ser carregada."
696
+ },
697
+ "attribute": "auto-focus",
698
+ "reflect": false,
699
+ "defaultValue": "true"
620
700
  }
621
701
  };
622
702
  }
@@ -628,7 +708,8 @@ export class EzGrid {
628
708
  "_isAllSelection": {},
629
709
  "_currentPageSelected": {},
630
710
  "_selectionCount": {},
631
- "_hasLeftButtons": {}
711
+ "_hasLeftButtons": {},
712
+ "_customFormatters": {}
632
713
  };
633
714
  }
634
715
  static get events() {
@@ -963,6 +1044,148 @@ export class EzGrid {
963
1044
  "tags": []
964
1045
  }
965
1046
  },
1047
+ "addCustomEditor": {
1048
+ "complexType": {
1049
+ "signature": "(fieldName: string, customEditor: ICustomEditor, detailContext?: string) => Promise<void>",
1050
+ "parameters": [{
1051
+ "tags": [],
1052
+ "text": ""
1053
+ }, {
1054
+ "tags": [],
1055
+ "text": ""
1056
+ }, {
1057
+ "tags": [],
1058
+ "text": ""
1059
+ }],
1060
+ "references": {
1061
+ "Promise": {
1062
+ "location": "global"
1063
+ },
1064
+ "ICustomEditor": {
1065
+ "location": "import",
1066
+ "path": "../../utils/customEditor/interfaces/ICustomEditor"
1067
+ }
1068
+ },
1069
+ "return": "Promise<void>"
1070
+ },
1071
+ "docs": {
1072
+ "text": "Registra um editor customizado para campos da grade e formul\u00E1rio.",
1073
+ "tags": []
1074
+ }
1075
+ },
1076
+ "addGridCustomRender": {
1077
+ "complexType": {
1078
+ "signature": "(fieldName: string, customRender: ICustomRender, detailContext?: string) => Promise<void>",
1079
+ "parameters": [{
1080
+ "tags": [],
1081
+ "text": ""
1082
+ }, {
1083
+ "tags": [],
1084
+ "text": ""
1085
+ }, {
1086
+ "tags": [],
1087
+ "text": ""
1088
+ }],
1089
+ "references": {
1090
+ "Promise": {
1091
+ "location": "global"
1092
+ },
1093
+ "ICustomRender": {
1094
+ "location": "import",
1095
+ "path": "../../utils/customRender/interfaces/ICustomRender"
1096
+ }
1097
+ },
1098
+ "return": "Promise<void>"
1099
+ },
1100
+ "docs": {
1101
+ "text": "Registra um render customizado para colunas da grid.",
1102
+ "tags": []
1103
+ }
1104
+ },
1105
+ "addCustomValueFormatter": {
1106
+ "complexType": {
1107
+ "signature": "(columnName: string, customFormatter: ICustomFormatter) => Promise<void>",
1108
+ "parameters": [{
1109
+ "tags": [],
1110
+ "text": ""
1111
+ }, {
1112
+ "tags": [],
1113
+ "text": ""
1114
+ }],
1115
+ "references": {
1116
+ "Promise": {
1117
+ "location": "global"
1118
+ },
1119
+ "ICustomFormatter": {
1120
+ "location": "import",
1121
+ "path": "./interfaces"
1122
+ }
1123
+ },
1124
+ "return": "Promise<void>"
1125
+ },
1126
+ "docs": {
1127
+ "text": "Registra um formatador de valores para uma coluna da grid.",
1128
+ "tags": []
1129
+ }
1130
+ },
1131
+ "removeCustomValueFormatter": {
1132
+ "complexType": {
1133
+ "signature": "(columnName: string) => Promise<void>",
1134
+ "parameters": [{
1135
+ "tags": [],
1136
+ "text": ""
1137
+ }],
1138
+ "references": {
1139
+ "Promise": {
1140
+ "location": "global"
1141
+ }
1142
+ },
1143
+ "return": "Promise<void>"
1144
+ },
1145
+ "docs": {
1146
+ "text": "Remove o formatador de valores de uma coluna da grid.",
1147
+ "tags": []
1148
+ }
1149
+ },
1150
+ "refreshSelectedRows": {
1151
+ "complexType": {
1152
+ "signature": "() => Promise<void>",
1153
+ "parameters": [],
1154
+ "references": {
1155
+ "Promise": {
1156
+ "location": "global"
1157
+ }
1158
+ },
1159
+ "return": "Promise<void>"
1160
+ },
1161
+ "docs": {
1162
+ "text": "Atualiza linhas da grade.",
1163
+ "tags": []
1164
+ }
1165
+ },
1166
+ "getCustomValueFormatter": {
1167
+ "complexType": {
1168
+ "signature": "(columnName: string) => Promise<ICustomFormatter | undefined>",
1169
+ "parameters": [{
1170
+ "tags": [],
1171
+ "text": ""
1172
+ }],
1173
+ "references": {
1174
+ "Promise": {
1175
+ "location": "global"
1176
+ },
1177
+ "ICustomFormatter": {
1178
+ "location": "import",
1179
+ "path": "./interfaces"
1180
+ }
1181
+ },
1182
+ "return": "Promise<ICustomFormatter>"
1183
+ },
1184
+ "docs": {
1185
+ "text": "Retorna o formatador customizado da coluna caso exista.",
1186
+ "tags": []
1187
+ }
1188
+ },
966
1189
  "setFocus": {
967
1190
  "complexType": {
968
1191
  "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() {
@@ -8,6 +8,7 @@ export class EzModal {
8
8
  this.opened = true;
9
9
  this.closeEsc = false;
10
10
  this.closeOutsideClick = false;
11
+ this.closeOutsideLeave = false;
11
12
  this.scrim = "medium";
12
13
  }
13
14
  observeOpened() {
@@ -39,6 +40,11 @@ export class EzModal {
39
40
  this.closeModal();
40
41
  }
41
42
  }
43
+ onMouseLeaveHandler() {
44
+ if (this.closeOutsideLeave) {
45
+ this.closeModal();
46
+ }
47
+ }
42
48
  render() {
43
49
  const positionSufix = this.align === "left" ? "left" : "right";
44
50
  const regularVerticalPaddingClass = this.heightMode === "regular" ? 'modal__vertical-padding' : '';
@@ -46,7 +52,7 @@ export class EzModal {
46
52
  const scrimType = `modal__screen-${this.scrim}`;
47
53
  return (h(Host, null, this.opened
48
54
  ?
49
- h("div", { ref: ref => this._modalRef = ref, class: `modal ${scrimType} ${regularVerticalPaddingClass}`, onMouseDown: evt => this.onMouseDownHandler(evt), tabIndex: -1 }, h("div", { class: `modal__container modal__container--${positionSufix}`, ref: ref => this._overlay = ref }, h("div", { class: `modal__content ${modalContentHeightMode} ${this.modalSize}` }, h("slot", null))))
55
+ h("div", { ref: ref => this._modalRef = ref, class: `modal ${scrimType} ${regularVerticalPaddingClass}`, onMouseDown: evt => this.onMouseDownHandler(evt), tabIndex: -1 }, h("div", { class: `modal__container modal__container--${positionSufix}`, ref: ref => this._overlay = ref }, h("div", { onMouseLeave: () => this.onMouseLeaveHandler(), class: `modal__content ${modalContentHeightMode} ${this.modalSize}` }, h("slot", null))))
50
56
  :
51
57
  undefined));
52
58
  }
@@ -174,6 +180,24 @@ export class EzModal {
174
180
  "reflect": false,
175
181
  "defaultValue": "false"
176
182
  },
183
+ "closeOutsideLeave": {
184
+ "type": "boolean",
185
+ "mutable": false,
186
+ "complexType": {
187
+ "original": "boolean",
188
+ "resolved": "boolean",
189
+ "references": {}
190
+ },
191
+ "required": false,
192
+ "optional": true,
193
+ "docs": {
194
+ "tags": [],
195
+ "text": "Define se o modal ser\u00E1 fechado se o mouse sair para fora do conte\u00FAdo."
196
+ },
197
+ "attribute": "close-outside-leave",
198
+ "reflect": false,
199
+ "defaultValue": "false"
200
+ },
177
201
  "scrim": {
178
202
  "type": "string",
179
203
  "mutable": false,
@@ -11,6 +11,7 @@ export class EzModalContainer {
11
11
  this.okButtonLabel = undefined;
12
12
  this.cancelButtonStatus = undefined;
13
13
  this.okButtonStatus = undefined;
14
+ this.showCloseButton = true;
14
15
  }
15
16
  async handleEzModalAction(event) {
16
17
  var _a;
@@ -47,7 +48,7 @@ export class EzModalContainer {
47
48
  this._closeButton.focus();
48
49
  }
49
50
  render() {
50
- return (h(Host, null, h("button", { class: "ez-modal-container__focus-ctrl", onFocusin: () => this.focusLast() }), h("div", { ref: ref => this._modalRef = ref, tabIndex: -1, class: "ez-modal-container__header-container" }, this.showTitleBar && (h("div", { class: "ez-modal-container__header ez-margin-bottom--large" }, h("div", { class: "ez-col ez-align--middle ez-modal-container__title" }, h("h2", { class: "ez-text ez-title--large ez-title--primary ez-text--bold ez-margin-vertical--extra-small" }, this.modalTitle), this.modalSubTitle && (h("div", { class: "ez-text ez-text--medium ez-text--primary ez-margin-vertical--extra-small" }, this.modalSubTitle))), h("button", { ref: ref => this._closeButton = ref, class: "ez-modal-container__close-button", onClick: () => this.ezModalAction.emit(ModalAction.CLOSE) }, h("ez-icon", { class: "ez-modal-container__close-icon", size: "medium", iconName: "close" }))))), h("div", { class: "ez-modal-container__content" }, h("slot", null)), h("div", { class: "ez-modal-container__footer" }, this.cancelIsVisible() && (h("ez-button", { label: this.cancelButtonLabel, enabled: this.cancelButtonStatus !== ModalButtonStatus.DISABLED, onClick: () => this.ezModalAction.emit(ModalAction.CANCEL) })), this.okIsVisible() && (h("ez-button", { ref: ref => this._okButton = ref, class: "ez-button--primary", label: this.okButtonLabel, enabled: this.okButtonStatus !== ModalButtonStatus.DISABLED, onClick: () => this.ezModalAction.emit(ModalAction.OK) }))), h("button", { class: "ez-modal-container__focus-ctrl", onFocusin: () => this.focusFirst() })));
51
+ return (h(Host, null, h("button", { class: "ez-modal-container__focus-ctrl", onFocusin: () => this.focusLast() }), h("div", { ref: ref => this._modalRef = ref, tabIndex: -1, class: "ez-modal-container__header-container" }, this.showTitleBar && (h("div", { class: "ez-modal-container__header ez-margin-bottom--large" }, h("div", { class: "ez-col ez-align--middle ez-modal-container__title" }, h("h2", { class: "ez-text ez-title--large ez-title--primary ez-text--bold ez-margin-vertical--extra-small" }, this.modalTitle), this.modalSubTitle && (h("div", { class: "ez-text ez-text--medium ez-text--primary ez-margin-vertical--extra-small" }, this.modalSubTitle))), (this.showCloseButton && h("button", { ref: ref => this._closeButton = ref, class: "ez-modal-container__close-button", onClick: () => this.ezModalAction.emit(ModalAction.CLOSE) }, h("ez-icon", { class: "ez-modal-container__close-icon", size: "medium", iconName: "close" })))))), h("div", { class: "ez-modal-container__content" }, h("slot", null)), h("div", { class: "ez-modal-container__footer" }, this.cancelIsVisible() && (h("ez-button", { label: this.cancelButtonLabel, enabled: this.cancelButtonStatus !== ModalButtonStatus.DISABLED, onClick: () => this.ezModalAction.emit(ModalAction.CANCEL) })), this.okIsVisible() && (h("ez-button", { ref: ref => this._okButton = ref, class: "ez-button--primary", label: this.okButtonLabel, enabled: this.okButtonStatus !== ModalButtonStatus.DISABLED, onClick: () => this.ezModalAction.emit(ModalAction.OK) }))), h("button", { class: "ez-modal-container__focus-ctrl", onFocusin: () => this.focusFirst() })));
51
52
  }
52
53
  static get is() { return "ez-modal-container"; }
53
54
  static get encapsulation() { return "scoped"; }
@@ -182,6 +183,24 @@ export class EzModalContainer {
182
183
  },
183
184
  "attribute": "ok-button-status",
184
185
  "reflect": false
186
+ },
187
+ "showCloseButton": {
188
+ "type": "boolean",
189
+ "mutable": false,
190
+ "complexType": {
191
+ "original": "boolean",
192
+ "resolved": "boolean",
193
+ "references": {}
194
+ },
195
+ "required": false,
196
+ "optional": true,
197
+ "docs": {
198
+ "tags": [],
199
+ "text": "Define a visibilidade do bot\u00E3o de fechar."
200
+ },
201
+ "attribute": "show-close-button",
202
+ "reflect": false,
203
+ "defaultValue": "true"
185
204
  }
186
205
  };
187
206
  }