@sankhyalabs/sankhyablocks 1.1.22 → 1.1.25

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 (184) hide show
  1. package/dist/cjs/ApplicationUtils-05b74ee9.js +39 -0
  2. package/dist/cjs/AssetsUtils-7e3c38f9.js +24 -0
  3. package/dist/cjs/CSSVarsUtils-75ca9c64.js +19 -0
  4. package/dist/cjs/ez-action-chip.cjs.entry.js +27 -0
  5. package/dist/cjs/ez-application.cjs.entry.js +26 -0
  6. package/dist/cjs/ez-button_4.cjs.entry.js +660 -0
  7. package/dist/cjs/ez-calendar.cjs.entry.js +223 -0
  8. package/dist/cjs/ez-collapsible-box.cjs.entry.js +47 -0
  9. package/dist/cjs/ez-combo-box.cjs.entry.js +278 -0
  10. package/dist/cjs/ez-date-input.cjs.entry.js +102 -0
  11. package/dist/cjs/ez-date-time-input.cjs.entry.js +145 -0
  12. package/dist/cjs/ez-dialog.cjs.entry.js +89 -0
  13. package/dist/cjs/ez-form.cjs.entry.js +463 -0
  14. package/dist/cjs/ez-grid.cjs.entry.js +647 -0
  15. package/dist/cjs/ez-icon.cjs.entry.js +41 -0
  16. package/dist/cjs/ez-label-chip.cjs.entry.js +104 -0
  17. package/dist/cjs/ez-modal_2.cjs.entry.js +316 -0
  18. package/dist/cjs/ez-number-input.cjs.entry.js +86 -0
  19. package/dist/cjs/ez-popover.cjs.entry.js +120 -0
  20. package/dist/cjs/ez-popup.cjs.entry.js +48 -0
  21. package/dist/cjs/ez-search.cjs.entry.js +64 -0
  22. package/dist/cjs/ez-tabselector.cjs.entry.js +198 -0
  23. package/dist/cjs/ez-text-area.cjs.entry.js +114 -0
  24. package/dist/cjs/ez-text-input.cjs.entry.js +201 -0
  25. package/dist/cjs/ez-time-input.cjs.entry.js +118 -0
  26. package/dist/cjs/ez-toast.cjs.entry.js +44 -0
  27. package/dist/cjs/ez-upload.cjs.entry.js +356 -0
  28. package/dist/cjs/index-682c98b2.js +1771 -0
  29. package/dist/cjs/loader.cjs.js +3 -3
  30. package/dist/cjs/sankhyablocks.cjs.js +3 -3
  31. package/dist/cjs/snk-application.cjs.entry.js +319 -1275
  32. package/dist/cjs/test-du.cjs.entry.js +76 -0
  33. package/dist/collection/collection-manifest.json +37 -2
  34. package/dist/collection/components/snk-application/snk-application.js +8 -4
  35. package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +16 -9
  36. package/dist/{collection/temp → components}/ApplicationUtils.js +37 -31
  37. package/dist/components/AssetsUtils.js +22 -0
  38. package/dist/components/CSSVarsUtils.js +17 -0
  39. package/dist/components/ez-action-chip.js +44 -0
  40. package/dist/components/ez-application.js +39 -0
  41. package/dist/components/ez-button.js +6 -0
  42. package/dist/components/ez-button2.js +105 -0
  43. package/dist/components/ez-calendar.js +6 -0
  44. package/dist/components/ez-calendar2.js +242 -0
  45. package/dist/components/ez-check.js +6 -0
  46. package/dist/components/ez-check2.js +94 -0
  47. package/dist/components/ez-collapsible-box.js +67 -0
  48. package/dist/components/ez-combo-box.js +6 -0
  49. package/dist/components/ez-combo-box2.js +311 -0
  50. package/dist/components/ez-date-input.js +135 -0
  51. package/dist/components/ez-date-time-input.js +179 -0
  52. package/dist/components/ez-dialog.js +124 -0
  53. package/dist/components/ez-form.js +6 -0
  54. package/dist/components/ez-form2.js +485 -0
  55. package/dist/components/ez-grid.js +738 -0
  56. package/dist/components/ez-icon.js +6 -0
  57. package/dist/components/ez-icon2.js +56 -0
  58. package/dist/components/ez-label-chip.js +125 -0
  59. package/dist/components/ez-list.js +6 -0
  60. package/dist/components/ez-list2.js +523 -0
  61. package/dist/components/ez-modal.js +6 -0
  62. package/dist/components/ez-modal2.js +82 -0
  63. package/dist/components/ez-number-input.js +115 -0
  64. package/dist/components/ez-popover.js +145 -0
  65. package/dist/components/ez-popup.js +67 -0
  66. package/dist/components/ez-search.js +100 -0
  67. package/dist/components/ez-tabselector.js +6 -0
  68. package/dist/components/ez-tabselector2.js +213 -0
  69. package/dist/components/ez-text-area.js +137 -0
  70. package/dist/components/ez-text-input.js +6 -0
  71. package/dist/components/ez-text-input2.js +223 -0
  72. package/dist/components/ez-time-input.js +153 -0
  73. package/dist/components/ez-toast.js +64 -0
  74. package/dist/components/ez-upload.js +382 -0
  75. package/dist/components/grid-config.js +6 -0
  76. package/dist/components/grid-config2.js +318 -0
  77. package/dist/components/select-box.js +6 -0
  78. package/dist/components/select-box2.js +47 -0
  79. package/dist/components/snk-application.js +310 -1266
  80. package/dist/components/test-du.js +101 -0
  81. package/dist/esm/ApplicationUtils-e0b6d857.js +37 -0
  82. package/dist/esm/AssetsUtils-6e6624dc.js +22 -0
  83. package/dist/esm/CSSVarsUtils-0787c3f3.js +17 -0
  84. package/dist/esm/ez-action-chip.entry.js +23 -0
  85. package/dist/esm/ez-application.entry.js +22 -0
  86. package/dist/esm/ez-button_4.entry.js +653 -0
  87. package/dist/esm/ez-calendar.entry.js +219 -0
  88. package/dist/esm/ez-collapsible-box.entry.js +43 -0
  89. package/dist/esm/ez-combo-box.entry.js +274 -0
  90. package/dist/esm/ez-date-input.entry.js +98 -0
  91. package/dist/esm/ez-date-time-input.entry.js +141 -0
  92. package/dist/esm/ez-dialog.entry.js +85 -0
  93. package/dist/esm/ez-form.entry.js +459 -0
  94. package/dist/esm/ez-grid.entry.js +643 -0
  95. package/dist/esm/ez-icon.entry.js +37 -0
  96. package/dist/esm/ez-label-chip.entry.js +100 -0
  97. package/dist/esm/ez-modal_2.entry.js +311 -0
  98. package/dist/esm/ez-number-input.entry.js +82 -0
  99. package/dist/esm/ez-popover.entry.js +116 -0
  100. package/dist/esm/ez-popup.entry.js +44 -0
  101. package/dist/esm/ez-search.entry.js +60 -0
  102. package/dist/esm/ez-tabselector.entry.js +194 -0
  103. package/dist/esm/ez-text-area.entry.js +110 -0
  104. package/dist/esm/ez-text-input.entry.js +197 -0
  105. package/dist/esm/ez-time-input.entry.js +114 -0
  106. package/dist/esm/ez-toast.entry.js +40 -0
  107. package/dist/esm/ez-upload.entry.js +352 -0
  108. package/dist/esm/index-35088a3f.js +1740 -0
  109. package/dist/esm/loader.js +3 -3
  110. package/dist/esm/sankhyablocks.js +3 -3
  111. package/dist/esm/snk-application.entry.js +311 -1267
  112. package/dist/esm/test-du.entry.js +72 -0
  113. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-action-chip/ez-action-chip.css +67 -0
  114. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-application/ez-application.css +3 -0
  115. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-button/ez-button.css +180 -0
  116. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-calendar/ez-calendar.css +319 -0
  117. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-check/ez-check.css +327 -0
  118. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +162 -0
  119. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-combo-box/ez-combo-box.css +217 -0
  120. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-date-input/ez-date-input.css +49 -0
  121. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-date-time-input/ez-date-time-input.css +44 -0
  122. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-dialog/ez-dialog.css +527 -0
  123. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-form/ez-form.css +5 -0
  124. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/ez-grid.css +31 -0
  125. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.css +129 -0
  126. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/subcomponents/select-box/select-box.css +10 -0
  127. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-icon/ez-icon.css +176 -0
  128. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-label-chip/ez-label-chip.css +139 -0
  129. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-list/ez-list.css +335 -0
  130. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-modal/ez-modal.css +358 -0
  131. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-number-input/ez-number-input.css +4 -0
  132. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-popover/ez-popover.css +44 -0
  133. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-popup/ez-popup.css +405 -0
  134. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-search/ez-search.css +3 -0
  135. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-tabselector/ez-tabselector.css +138 -0
  136. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-text-area/ez-text-area.css +165 -0
  137. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-text-input/ez-text-input.css +196 -0
  138. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-time-input/ez-time-input.css +10 -0
  139. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-toast/ez-toast.css +127 -0
  140. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-upload/ez-upload.css +568 -0
  141. package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/test-du/test-du.css +3 -0
  142. package/dist/sankhyablocks/p-0183d259.entry.js +1 -0
  143. package/dist/sankhyablocks/p-01f23a70.entry.js +1 -0
  144. package/dist/sankhyablocks/p-07c32f68.entry.js +1 -0
  145. package/dist/sankhyablocks/p-0f90499d.entry.js +1 -0
  146. package/dist/sankhyablocks/p-105724a3.entry.js +1 -0
  147. package/dist/sankhyablocks/p-2ac02d48.entry.js +1 -0
  148. package/dist/sankhyablocks/p-35364a97.entry.js +1 -0
  149. package/dist/sankhyablocks/p-3f6aa9a7.entry.js +1 -0
  150. package/dist/sankhyablocks/p-5f9af495.entry.js +1 -0
  151. package/dist/sankhyablocks/p-60967cf0.js +1 -0
  152. package/dist/sankhyablocks/p-6ce33b60.entry.js +57 -0
  153. package/dist/sankhyablocks/p-70ad6c16.entry.js +1 -0
  154. package/dist/sankhyablocks/p-710bfffe.entry.js +1 -0
  155. package/dist/sankhyablocks/p-735440c1.entry.js +1 -0
  156. package/dist/sankhyablocks/p-811b4b9d.js +1 -0
  157. package/dist/sankhyablocks/p-813fe4f7.js +1 -0
  158. package/dist/sankhyablocks/p-85a9446b.js +2 -0
  159. package/dist/sankhyablocks/p-89a1100f.entry.js +1 -0
  160. package/dist/sankhyablocks/p-8b543003.entry.js +1 -0
  161. package/dist/sankhyablocks/p-9750632b.entry.js +1 -0
  162. package/dist/sankhyablocks/p-a96272f7.entry.js +1 -0
  163. package/dist/sankhyablocks/p-ac8842e5.entry.js +1 -0
  164. package/dist/sankhyablocks/p-ba64cc41.entry.js +1 -0
  165. package/dist/sankhyablocks/p-c1ede043.entry.js +1 -0
  166. package/dist/sankhyablocks/p-d90ebb85.entry.js +1 -0
  167. package/dist/sankhyablocks/p-e17dfaae.entry.js +1 -0
  168. package/dist/sankhyablocks/p-e5355a29.entry.js +1 -0
  169. package/dist/sankhyablocks/p-ef04b633.entry.js +1 -0
  170. package/dist/sankhyablocks/p-f6db07fb.entry.js +1 -0
  171. package/dist/sankhyablocks/p-fcd9bd92.entry.js +1 -0
  172. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  173. package/dist/types/components/snk-application/snk-application.d.ts +1 -1
  174. package/dist/types/components.d.ts +7 -3
  175. package/dist/types/lib/http/data-fetcher/fetchers/dataunit-fetcher.d.ts +1 -0
  176. package/package.json +12 -7
  177. package/react/components.d.ts +29 -0
  178. package/react/components.js +29 -0
  179. package/react/components.js.map +1 -1
  180. package/dist/cjs/index-20a7d705.js +0 -733
  181. package/dist/esm/index-8d3572c4.js +0 -707
  182. package/dist/sankhyablocks/p-5fa264b9.js +0 -1
  183. package/dist/sankhyablocks/p-fe95f2c4.entry.js +0 -57
  184. package/dist/types/temp/ApplicationUtils.d.ts +0 -7
@@ -0,0 +1,643 @@
1
+ import { r as registerInstance, c as createEvent, h, H as Host } from './index-35088a3f.js';
2
+ import { Grid } from 'ag-grid-enterprise';
3
+ import { Grid as Grid$1 } from 'ag-grid-community';
4
+ import { DataType, Action } from '@sankhyalabs/core';
5
+ import { UserInterface, SortMode } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
6
+
7
+ const gridTerms = {
8
+ // for filter panel
9
+ page: "Página",
10
+ more: "mais",
11
+ to: "para",
12
+ of: "de",
13
+ next: "Próximo",
14
+ last: "Último",
15
+ first: "Primeiro",
16
+ previous: "Anterior",
17
+ loadingOoo: "Carregar",
18
+ // for set filter
19
+ selectAll: "Selecionar tudo",
20
+ searchOoo: "Procurar",
21
+ blanks: "Vazio",
22
+ // for number filter and text filter
23
+ filterOoo: "Filtrar",
24
+ applyFilter: "Aplicar filtro",
25
+ // for number filter
26
+ equals: "Igual",
27
+ lessThan: "Menor que",
28
+ greaterThan: "Maior que",
29
+ // for text filter
30
+ contains: "Contém",
31
+ startsWith: "Começa com",
32
+ endsWith: "Termina com",
33
+ // the header of the default group column
34
+ group: "Grupo",
35
+ // tool panel
36
+ columns: "Colunas",
37
+ rowGroupColumns: "Colunas do grupo de linhas",
38
+ rowGroupColumnsEmptyMessage: "Colunas do grupo de linhas vazias",
39
+ valueColumns: "Valores das colunas",
40
+ pivotMode: "Modo pivô",
41
+ groups: "Grupos",
42
+ values: "Valores",
43
+ pivots: "Pivôs",
44
+ valueColumnsEmptyMessage: "Valores de colunas vazias",
45
+ pivotColumnsEmptyMessage: "Pivôs de colunas vazias",
46
+ toolPanelButton: "Botão de painel de ferramentas",
47
+ // other
48
+ noRowsToShow: "Não há registros para mostrar.",
49
+ // enterprise menu
50
+ pinColumn: "Fixar coluna",
51
+ valueAggregation: "Agregar valor",
52
+ autosizeThiscolumn: "Redimensionar esta coluna",
53
+ autosizeAllColumns: "Redimensionar todas colunas",
54
+ groupBy: "Agrupar por",
55
+ ungroupBy: "Desagrupar por",
56
+ resetColumns: "Resetar colunas",
57
+ expandAll: "Expandir tudo",
58
+ collapseAll: "Contrair tudo",
59
+ toolPanel: "Painel de ferramentas",
60
+ export: "Exportar",
61
+ csvExport: "Exportar para CSV",
62
+ excelExport: "Exportar para Excel",
63
+ // enterprise menu pinning
64
+ pinLeft: "Fixar coluna",
65
+ pinRight: "Fixar a direita",
66
+ noPin: "Desfixar coluna",
67
+ // enterprise menu aggregation and status panel
68
+ sum: "Soma",
69
+ min: "Mínimo",
70
+ max: "Máximo",
71
+ none: "Nenhum",
72
+ count: "Contagem",
73
+ average: "Média",
74
+ // standard menu
75
+ copy: "Copiar",
76
+ copyWithHeaders: "Copiar com cabeçalho",
77
+ ctrlC: "Ctrl+C",
78
+ paste: "Colar",
79
+ ctrlV: "Ctrl+V"
80
+ };
81
+
82
+ const HeaderColumnTemplate = `<div class="ag-cell-label-container" role="presentation">
83
+ <span ref="eMenu" class="ag-header-icon ag-header-cell-menu-button" aria-hidden="true"></span>
84
+ <div ref="eLabel" class="ag-header-cell-label" role="presentation" unselectable="on">
85
+ <span ref="eText" class="ag-header-cell-text" unselectable="on"></span>
86
+ <span ref="eFilter" class="ag-header-icon ag-header-label-icon ag-filter-icon" aria-hidden="true"></span>
87
+ <span ref="eSortAsc" class="ag-header-icon ag-header-label-icon ag-sort-ascending-icon" aria-hidden="true"></span>
88
+ <span ref="eSortDesc" class="ag-header-icon ag-header-label-icon ag-sort-descending-icon" aria-hidden="true"></span>
89
+ <span ref="eSortNone" class="ag-header-icon ag-header-label-icon ag-sort-none-icon" aria-hidden="true"></span>
90
+ </div>
91
+ </div>`;
92
+
93
+ class Server {
94
+ constructor(data) {
95
+ this._data = data;
96
+ }
97
+ getData(request) {
98
+ const finalArray = this.sort(this.filter(this._data, request), request);
99
+ return { rowData: finalArray.slice(request.startRow, request.endRow), rowCount: finalArray.length };
100
+ }
101
+ filter(data, _request) {
102
+ return data;
103
+ }
104
+ sort(data, _request) {
105
+ return data;
106
+ }
107
+ }
108
+ /* alasql.options.cache = false;
109
+
110
+ return {
111
+ getData: function (request) {
112
+ var results = executeQuery(request);
113
+
114
+ return {
115
+ success: true,
116
+ rows: results,
117
+ lastRow: getLastRowIndex(request, results),
118
+ };
119
+ },
120
+ };
121
+
122
+ function executeQuery(request) {
123
+ var sql = buildSql(request);
124
+
125
+ console.log("[FakeServer] - about to execute query:", sql);
126
+
127
+ return alasql(sql, [allData]);
128
+ }
129
+
130
+ function buildSql(request) {
131
+ return "SELECT * FROM ?" + orderBySql(request) + limitSql(request);
132
+ }
133
+
134
+ function orderBySql(request) {
135
+ var sortModel = request.sortModel;
136
+
137
+ if (sortModel.length === 0) return "";
138
+
139
+ var sorts = sortModel.map(function (s) {
140
+ return s.colId + " " + s.sort.toUpperCase();
141
+ });
142
+
143
+ return " ORDER BY " + sorts.join(", ");
144
+ }
145
+
146
+ function limitSql(request) {
147
+ var blockSize = request.endRow - request.startRow;
148
+
149
+ return " LIMIT " + (blockSize + 1) + " OFFSET " + request.startRow;
150
+ }
151
+
152
+ function getLastRowIndex(request, results) {
153
+ if (!results || results.length === 0) {
154
+ return null;
155
+ }
156
+
157
+ var currentLastRow = request.startRow + results.length;
158
+
159
+ return currentLastRow <= request.endRow ? currentLastRow : -1;
160
+ }
161
+ }*/
162
+
163
+ class DataSource {
164
+ constructor(dataUnit, serverURL) {
165
+ this._dataUnit = dataUnit;
166
+ this._serverURL = serverURL;
167
+ }
168
+ getRows(params) {
169
+ if (this._useMockedServer) {
170
+ if (this._mockedServer === undefined) {
171
+ this.loadData()
172
+ .then(data => {
173
+ this._mockedServer = new Server(data.rowData);
174
+ params.success(this._mockedServer.getData(params.request));
175
+ })
176
+ .catch(() => params.fail());
177
+ }
178
+ else {
179
+ params.success(this._mockedServer.getData(params.request));
180
+ }
181
+ }
182
+ else {
183
+ this.loadData()
184
+ .then(data => params.success(data))
185
+ .catch(() => params.fail());
186
+ }
187
+ }
188
+ loadData() {
189
+ return new Promise((resolve, reject) => {
190
+ if (this._dataUnit) {
191
+ this._dataUnit.loadData().then(rowData => resolve({ rowData, rowCount: rowData.length }));
192
+ }
193
+ else {
194
+ fetch(this._serverURL)
195
+ .then(response => {
196
+ response.json().then(rowData => resolve({ rowData }));
197
+ })
198
+ .catch(() => reject());
199
+ }
200
+ });
201
+ }
202
+ }
203
+
204
+ class AgGridController {
205
+ constructor(enterprise) {
206
+ this._menuItems = [];
207
+ this._enterprise = enterprise;
208
+ }
209
+ getSort() {
210
+ const sortedColumns = [];
211
+ this._gridOptions.api.getSortModel().forEach(({ colId, sort }) => {
212
+ if (sort) {
213
+ const field = this._dataUnit.getField(colId);
214
+ const mode = sort === "asc" ? SortMode.ASC : SortMode.DESC;
215
+ const sortField = field ? { field: field.name, dataType: field.dataType, mode } : { field: colId, dataType: DataType.TEXT, mode };
216
+ sortedColumns.push(sortField);
217
+ }
218
+ });
219
+ return sortedColumns;
220
+ }
221
+ ;
222
+ initDatagrid(container, options) {
223
+ if (this._grid === undefined) {
224
+ this._columnStateChangeCallback = options.onColumnStateChange;
225
+ this._selectionChangeCallback = options.onSelectionChange;
226
+ this._paginationChangeCallback = options.onPaginationChange;
227
+ this._doubleClickCallBack = options.onDoubleClick;
228
+ this._multipleSelection = options.allowMultipleSelection;
229
+ this._pageSize = options.pageSize;
230
+ this._serverURL = options.serverURL;
231
+ this._dataUnit = options.dataUnit;
232
+ this._dataUnit.sortingProvider = this;
233
+ this._gridOptions = {
234
+ localeText: gridTerms,
235
+ rowModelType: "serverSide",
236
+ serverSideStoreType: "partial",
237
+ rowSelection: this._multipleSelection ? "multiple" : "single",
238
+ serverSideDatasource: new DataSource(this._dataUnit, this._serverURL),
239
+ getRowNodeId: (params) => params.__record__id__,
240
+ getMainMenuItems: (params) => {
241
+ const column = params.column;
242
+ const items = [column.isPinned() ? "clearPinned" : "pinLeft", "separator"];
243
+ this._menuItems.forEach(m => items.push({
244
+ name: m.label,
245
+ action: () => m.action(column.getColId(), m.name)
246
+ }));
247
+ return items;
248
+ },
249
+ onViewportChanged: (evt) => {
250
+ if (this._gridOptions && this._gridOptions.api && evt && evt.api) {
251
+ if (this._dataUnit.getSelection()) {
252
+ this._dataUnit.getSelection().forEach(id => {
253
+ let node = evt.api.getRowNode(id);
254
+ node.setSelected(true);
255
+ });
256
+ }
257
+ }
258
+ }
259
+ };
260
+ this.setOptionsEvents(this._gridOptions);
261
+ this.setOptionsPagination(this._gridOptions);
262
+ this.setOptionsSupress(this._gridOptions);
263
+ if (this._enterprise) {
264
+ this._grid = new Grid(container, this._gridOptions);
265
+ }
266
+ else {
267
+ this._grid = new Grid$1(container, this._gridOptions);
268
+ }
269
+ }
270
+ }
271
+ setOptionsEvents(opt) {
272
+ opt.onSortChanged = e => this.onCallStateChange("sort", e);
273
+ opt.onColumnResized = e => this.onCallStateChange("columnResize", e);
274
+ opt.onColumnPinned = e => this.onCallStateChange("columnPinned", e);
275
+ opt.onColumnMoved = e => this.onCallStateChange("columnMoved", e);
276
+ opt.onColumnVisible = e => this.onCallStateChange("visibleChange", e);
277
+ opt.onSelectionChanged = e => this.onSelectionChange(e);
278
+ opt.onPaginationChanged = () => this.onPaginationChange();
279
+ opt.onRowDoubleClicked = evt => this.onRowDoubleClick(evt);
280
+ }
281
+ setOptionsPagination(opt) {
282
+ opt.pagination = (this._pageSize > -1);
283
+ opt.paginationPageSize = this._pageSize;
284
+ opt.cacheBlockSize = this._pageSize;
285
+ }
286
+ setOptionsSupress(opt) {
287
+ opt.suppressDragLeaveHidesColumns = true;
288
+ opt.suppressPaginationPanel = true;
289
+ opt.suppressMenuHide = true;
290
+ }
291
+ setData(data) {
292
+ if (this._grid === undefined) {
293
+ throw new Error("Erro interno: Grid ainda não inicializado.");
294
+ }
295
+ this._gridOptions.api.setRowData(data);
296
+ }
297
+ refresh() {
298
+ if (this._grid === undefined) {
299
+ throw new Error("Erro interno: Grid ainda não inicializado.");
300
+ }
301
+ this._gridOptions.api.refreshServerSideStore({ purge: false });
302
+ }
303
+ setColumnsDef(cols, showCheckSelection) {
304
+ if (this._grid === undefined) {
305
+ throw new Error("Erro interno: Grid ainda não inicializado.");
306
+ }
307
+ const colDefs = [];
308
+ if (showCheckSelection) {
309
+ colDefs.push({
310
+ headerName: "",
311
+ checkboxSelection: true,
312
+ headerCheckboxSelection: false,
313
+ width: 28,
314
+ suppressMovable: true,
315
+ suppressAutoSize: true,
316
+ suppressMenu: true,
317
+ lockPosition: true
318
+ });
319
+ }
320
+ cols.forEach(c => {
321
+ colDefs.push(this.buildColDef(c));
322
+ });
323
+ this._gridOptions.api.setColumnDefs(colDefs);
324
+ }
325
+ getColumnsDef() {
326
+ if (this._grid === undefined) {
327
+ throw new Error("Erro interno: Grid ainda não inicializado.");
328
+ }
329
+ const colDef = this._gridOptions.columnApi.getAllColumns();
330
+ return colDef.map(c => {
331
+ const def = c.getColDef();
332
+ const colDef = { name: def.field, label: def.headerName };
333
+ this.conditionalSet(colDef, "sortable", def.sortable);
334
+ this.conditionalSet(colDef, "resizable", def.resizable);
335
+ this.conditionalSet(colDef, "sort", def.sort);
336
+ this.conditionalSet(colDef, "sortIndex", def.sortIndex);
337
+ this.conditionalSet(colDef, "width", def.width);
338
+ this.conditionalSet(colDef, "pinned", def.pinned !== null);
339
+ this.conditionalSet(colDef, "hidden", def.hide);
340
+ return colDef;
341
+ });
342
+ }
343
+ setColumnsState(state) {
344
+ if (this._grid === undefined) {
345
+ throw new Error("Erro interno: Grid ainda não inicializado.");
346
+ }
347
+ //TODO neste ponto estamos utilizando um método descontinuado,
348
+ //pelo fato de que o applyColumnState não reordena as colunas conforme
349
+ //o estado passado.
350
+ //https://stackoverflow.com/questions/51488241/ag-grid-how-to-save-and-reload-column-order
351
+ //Assim que for corrigido o applyColumnState devemos substituir o setColumnState por ele.
352
+ // this._gridOptions.columnApi.applyColumnState({ state: state.map(s => this.buildColState(s)) });
353
+ this._gridOptions.columnApi.setColumnState(state.map(s => this.buildColState(s)));
354
+ }
355
+ getColumnsState() {
356
+ if (this._grid === undefined) {
357
+ throw new Error("Erro interno: Grid ainda não inicializado.");
358
+ }
359
+ const colState = this._gridOptions.columnApi.getColumnState();
360
+ return colState.map(s => {
361
+ const def = this._gridOptions.columnApi.getColumn(s.colId).getColDef();
362
+ const label = def.headerName;
363
+ const name = def.checkboxSelection ? "__SELECTION__" : s.colId;
364
+ const colState = { label, name };
365
+ this.conditionalSet(colState, "sort", s.sort);
366
+ this.conditionalSet(colState, "sortIndex", s.sortIndex);
367
+ this.conditionalSet(colState, "width", s.width);
368
+ this.conditionalSet(colState, "pinned", s.pinned !== null);
369
+ this.conditionalSet(colState, "hidden", s.hide);
370
+ return colState;
371
+ }).filter(c => c.name !== "__SELECTION__");
372
+ }
373
+ getSelection() {
374
+ return this._gridOptions.api.getSelectedRows();
375
+ }
376
+ addColumnMenuItem(item) {
377
+ this._menuItems.push(item);
378
+ }
379
+ nextPage() {
380
+ this._gridOptions.api.paginationGoToNextPage();
381
+ }
382
+ previousPage() {
383
+ this._gridOptions.api.paginationGoToPreviousPage();
384
+ }
385
+ buildColDef(source) {
386
+ return {
387
+ headerName: source.label,
388
+ field: source.name,
389
+ sortable: true,
390
+ resizable: true,
391
+ headerComponentParams: {
392
+ template: HeaderColumnTemplate
393
+ },
394
+ valueFormatter: params => {
395
+ return this.getFormatterByColumn(params, source);
396
+ }
397
+ };
398
+ }
399
+ getFormatterByColumn(params, source) {
400
+ var _a, _b;
401
+ if ((source === null || source === void 0 ? void 0 : source.userInterface) === "OPTIONSELECTOR" && source.options) {
402
+ const prop = source === null || source === void 0 ? void 0 : source.options;
403
+ let options;
404
+ if (typeof prop === "string") {
405
+ const parsed = JSON.parse(prop);
406
+ options = Object.keys(parsed).map(key => { return { value: key, label: parsed[key] }; });
407
+ }
408
+ else {
409
+ options = prop;
410
+ }
411
+ let optionSelected;
412
+ options.forEach((option) => {
413
+ if (option.value == params.value) {
414
+ optionSelected = option;
415
+ }
416
+ });
417
+ return optionSelected === null || optionSelected === void 0 ? void 0 : optionSelected.label;
418
+ }
419
+ if ((source === null || source === void 0 ? void 0 : source.userInterface) === "SWITCH") {
420
+ if ((params === null || params === void 0 ? void 0 : params.value) === "S" || (params === null || params === void 0 ? void 0 : params.value) === true) {
421
+ return "Sim";
422
+ }
423
+ else if ((params === null || params === void 0 ? void 0 : params.value) === "N" || (params === null || params === void 0 ? void 0 : params.value) === false) {
424
+ return "Não";
425
+ }
426
+ }
427
+ if ((source === null || source === void 0 ? void 0 : source.userInterface) === "SEARCH") {
428
+ if (params.value !== undefined) {
429
+ return ((_a = params === null || params === void 0 ? void 0 : params.value) === null || _a === void 0 ? void 0 : _a.value) + " - " + ((_b = params === null || params === void 0 ? void 0 : params.value) === null || _b === void 0 ? void 0 : _b.label);
430
+ }
431
+ }
432
+ if ((source === null || source === void 0 ? void 0 : source.userInterface) === UserInterface.DATE || (source === null || source === void 0 ? void 0 : source.userInterface) === UserInterface.DATETIME) {
433
+ if (params.value !== undefined) {
434
+ return params.value.toLocaleDateString();
435
+ }
436
+ }
437
+ }
438
+ buildColState(source) {
439
+ return {
440
+ colId: source.name,
441
+ sort: source.sort,
442
+ sortIndex: source.sortIndex,
443
+ width: source.width,
444
+ pinned: source.pinned ? "left" : null,
445
+ hide: source.hidden
446
+ };
447
+ }
448
+ onCallStateChange(type, e) {
449
+ const finished = !("finished" in e) || e["finished"];
450
+ if (finished && this._columnStateChangeCallback) {
451
+ this._columnStateChangeCallback(type, this.getColumnsState());
452
+ }
453
+ }
454
+ onSelectionChange(e) {
455
+ if (this._selectionChangeCallback) {
456
+ this._selectionChangeCallback(e.api.getSelectedRows());
457
+ }
458
+ }
459
+ onPaginationChange() {
460
+ if (this._paginationChangeCallback) {
461
+ if (this._gridOptions.api) {
462
+ const api = this._gridOptions.api;
463
+ const currentPage = api.paginationGetCurrentPage();
464
+ const isLastPage = api.paginationGetTotalPages() === (currentPage + 1);
465
+ const pageSize = api.paginationGetPageSize();
466
+ const totalRows = api.paginationGetRowCount();
467
+ const pageStart = currentPage * pageSize + 1;
468
+ const pageEnd = Math.min(totalRows, (currentPage + 1) * pageSize);
469
+ this._paginationChangeCallback({
470
+ hasPrevious: currentPage > 0,
471
+ hasNext: !isLastPage,
472
+ currentPage: currentPage + 1,
473
+ pageStart,
474
+ pageEnd,
475
+ totalRows
476
+ });
477
+ }
478
+ }
479
+ }
480
+ onRowDoubleClick(evt) {
481
+ if (this._doubleClickCallBack) {
482
+ this._doubleClickCallBack(evt.data);
483
+ }
484
+ }
485
+ conditionalSet(host, attribute, value) {
486
+ if (value !== null && value !== undefined && value !== false) {
487
+ host[attribute] = value;
488
+ }
489
+ }
490
+ }
491
+
492
+ class DataUnitBridge {
493
+ constructor(gridController, dataUnit) {
494
+ this._gridController = gridController;
495
+ this._dataUnit = dataUnit;
496
+ this._dataUnit.subscribe(action => this.processAction(action));
497
+ }
498
+ processAction(action) {
499
+ switch (action.type) {
500
+ case Action.METADATA_LOADED:
501
+ this._gridController.setColumnsDef(this.buildColumnDefs(), true);
502
+ break;
503
+ case Action.RECORDS_REMOVED:
504
+ case Action.EDITION_CANCELED:
505
+ case Action.RECORDS_ADDED:
506
+ case Action.RECORDS_COPIED:
507
+ case Action.DATA_SAVED:
508
+ this._gridController.refresh();
509
+ break;
510
+ }
511
+ }
512
+ buildColumnDefs() {
513
+ const columnDefs = [];
514
+ if (this._dataUnit.metadata) {
515
+ this._dataUnit.metadata.fields.forEach(f => {
516
+ var _a;
517
+ if (f.visible !== false) {
518
+ columnDefs.push({ label: f.label, name: f.name, userInterface: f.userInterface, options: (_a = this._dataUnit.getField(f.name).properties) === null || _a === void 0 ? void 0 : _a.options });
519
+ }
520
+ });
521
+ }
522
+ return columnDefs;
523
+ }
524
+ }
525
+
526
+ const ezGridCss = ".sc-ez-grid-h{display:grid;grid-template-rows:auto 1fr auto;height:100%;width:100%;--ezgrid__header--background-color:var(--background--xlight, #FFF)}.grid-header.sc-ez-grid{display:flex;justify-content:space-between;align-items:center;background-color:var(--ezgrid__header--background-color, #FFF);z-index:var(--visible)}.grid__container.sc-ez-grid{box-shadow:0 0 16px 0 rgb(0 38 111 / 12%);padding-top:15px;margin-top:-12px;background-color:var(--ezgrid__header--background-color)}.grid-header__container.sc-ez-grid{display:flex;align-items:center}";
527
+
528
+ const EzGrid = class {
529
+ constructor(hostRef) {
530
+ registerInstance(this, hostRef);
531
+ this.ezColumnStateChange = createEvent(this, "ezColumnStateChange", 7);
532
+ this.ezSelectionChange = createEvent(this, "ezSelectionChange", 7);
533
+ this.ezDoubleClick = createEvent(this, "ezDoubleClick", 7);
534
+ this._gridController = new AgGridController(false);
535
+ this._popUpVisible = false;
536
+ /**
537
+ * Determina o número de linhas de cada página. Caso informado o valor -1
538
+ * não haverá paginação.
539
+ */
540
+ this.pageSize = -1;
541
+ }
542
+ /**
543
+ * Método responsável por receber a definição das colunas
544
+ */
545
+ async setColumnsDef(cols) {
546
+ this._gridController.setColumnsDef(cols, this.multipleSelection);
547
+ }
548
+ /**
549
+ * Adiciona item de menu nas colunas.
550
+ */
551
+ async addColumnMenuItem(label, name, action) {
552
+ this._gridController.addColumnMenuItem({ label, name, action });
553
+ }
554
+ /**
555
+ * Método responsável por aplicar estado pré-existente nas colunas do grid.
556
+ */
557
+ async setColumnsState(state) {
558
+ this._gridController.setColumnsState(state);
559
+ }
560
+ /**
561
+ * Método de carga dos registros. Os objetos deste array devem conter atributos
562
+ * para as colunas desejadas.
563
+ */
564
+ async setData(data) {
565
+ this._gridController.setData(data);
566
+ }
567
+ /**
568
+ * Retorna as linhas selecionadas na grade.
569
+ */
570
+ async getSelection() {
571
+ return Promise.resolve(this._gridController.getSelection());
572
+ }
573
+ /**
574
+ * Método retornar o estado atual das colunas do grid.
575
+ */
576
+ async getColumnsState() {
577
+ return Promise.resolve(this._gridController.getColumnsState());
578
+ }
579
+ /**
580
+ * Método retornar o estado atual das colunas do grid.
581
+ */
582
+ async getColumns() {
583
+ return Promise.resolve(this._gridController.getColumnsDef());
584
+ }
585
+ componentWillLoad() {
586
+ if (this.dataUnit) {
587
+ this._dataUnitBridge = new DataUnitBridge(this._gridController, this.dataUnit);
588
+ addEventListener("ezSelectionChange", (evt) => this.dataUnit.setSelection(evt.detail.map((r) => r.__record__id__)));
589
+ }
590
+ }
591
+ componentDidLoad() {
592
+ this._gridController.initDatagrid(this._container, {
593
+ onColumnStateChange: (type, state) => this.ezColumnStateChange.emit({ type, state }),
594
+ onSelectionChange: (selection) => this.ezSelectionChange.emit(selection),
595
+ onPaginationChange: (status) => {
596
+ this._navigationHasPrevious = status.hasPrevious;
597
+ this._navigationHasNext = status.hasNext;
598
+ this._navigationFirstRow = status.pageStart;
599
+ this._navigationLastRow = status.pageEnd;
600
+ this._navigationTotalRows = status.totalRows;
601
+ },
602
+ onDoubleClick: (row) => {
603
+ this.ezDoubleClick.emit(row);
604
+ },
605
+ allowMultipleSelection: this.multipleSelection,
606
+ pageSize: this.pageSize,
607
+ serverURL: this.serverUrl,
608
+ dataUnit: this.dataUnit
609
+ });
610
+ if (this._dataUnitBridge) {
611
+ this._gridController.setColumnsDef(this._dataUnitBridge.buildColumnDefs(), true);
612
+ }
613
+ }
614
+ getPaginationControl() {
615
+ if (this.pageSize === -1) {
616
+ return null;
617
+ }
618
+ return [
619
+ h("div", { class: "text text--primary text--medium margin-right--medium" }, h("strong", { class: "text text--primary text--medium" }, `${this._navigationFirstRow}-${this._navigationLastRow}`), ` de ${this._navigationTotalRows}`),
620
+ h("ez-button", { size: "small", iconName: "chevron-left", class: "margin-right--medium", mode: "icon", enabled: this._navigationHasPrevious, onClick: () => this._gridController.previousPage(), label: "P\u00E1gina anterior" }),
621
+ h("ez-button", { size: "small", iconName: "chevron-right", class: "margin-right--medium", mode: "icon", enabled: this._navigationHasNext, onClick: () => this._gridController.nextPage(), label: "Pr\u00F3xima P\u00E1gina" })
622
+ ];
623
+ }
624
+ applyConfig(cols) {
625
+ this._gridController.setColumnsState(cols);
626
+ this.closeConfig();
627
+ }
628
+ closeConfig() {
629
+ this._popUpVisible = false;
630
+ }
631
+ openConfig() {
632
+ this._gridConfig.columns = this._gridController.getColumnsState().filter(c => c.name);
633
+ this._gridConfig.selectedTab = "Colunas";
634
+ this._popUpVisible = true;
635
+ }
636
+ render() {
637
+ return (h(Host, null, h("div", { class: "box box--shadow padding--medium grid-header" }, h("div", { class: "grid-header__container" }, h("slot", { name: "leftButtons" })), h("div", { class: "grid-header__container" }, this.getPaginationControl(), h("ez-button", { size: "small", iconName: "settings", class: "button--secondary", mode: "icon", onClick: () => { this.openConfig(); } }))), h("div", { class: "grid__container ag-sankhya-theme", ref: elem => this._container = elem }), h("div", { class: "grid__footer" }), h("ez-modal", { modalSize: "small", closeEsc: true, closeOutsideClick: true, opened: this._popUpVisible, onEzCloseModal: () => this._popUpVisible = false }, h("grid-config", { ref: ref => this._gridConfig = ref, selectedTab: "Colunas", onConfigFinish: evt => this.applyConfig(evt.detail), onConfigCancel: _evt => this.closeConfig() }))));
638
+ }
639
+ static get assetsDirs() { return ["../assets"]; }
640
+ };
641
+ EzGrid.style = ezGridCss;
642
+
643
+ export { EzGrid as ez_grid };
@@ -0,0 +1,37 @@
1
+ import { r as registerInstance, h, H as Host } from './index-35088a3f.js';
2
+ import { StringUtils } from '@sankhyalabs/core';
3
+
4
+ const ezIconCss = ":host{display:flex;overflow:hidden;position:relative;--ez-icon--color:var(--icon--color, #ffffff)}svg{display:flex;justify-content:center;align-items:center;fill:var(--ez-icon--color)}.x-small{width:12px;height:12px}.small{width:16px;height:16px}.medium{width:20px;height:20px}.large{width:24px;height:24px}.x-large{width:30px;height:30px}[class^=\"ez-icon-\"],[class*=\" ez-icon-\"]{color:var(--ez-icon--color)}[class^=\"ez-icon-\"],[class*=\" ez-icon-\"]{font-family:'ez-icons' !important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ez-icon-account-outline:before{content:\"\\ea01\"}.ez-icon-account:before{content:\"\\ea02\"}.ez-icon-alert-circle-inverted:before{content:\"\\ea03\"}.ez-icon-alert-circle:before{content:\"\\ea04\"}.ez-icon-alert-mail:before{content:\"\\ea05\"}.ez-icon-alert-outline:before{content:\"\\ea06\"}.ez-icon-alert-popup:before{content:\"\\ea07\"}.ez-icon-apps:before{content:\"\\ea08\"}.ez-icon-arrow_back:before{content:\"\\ea09\"}.ez-icon-bell-inverted:before{content:\"\\ea0a\"}.ez-icon-bell:before{content:\"\\ea0b\"}.ez-icon-business-center:before{content:\"\\ea0c\"}.ez-icon-calendar-text:before{content:\"\\ea0d\"}.ez-icon-calendar:before{content:\"\\ea0e\"}.ez-icon-check-circle-inverted:before{content:\"\\ea0f\"}.ez-icon-check-circle:before{content:\"\\ea10\"}.ez-icon-check:before{content:\"\\ea11\"}.ez-icon-chevron-down:before{content:\"\\ea12\"}.ez-icon-chevron-left:before{content:\"\\ea13\"}.ez-icon-chevron-right:before{content:\"\\ea14\"}.ez-icon-chevron-up:before{content:\"\\ea15\"}.ez-icon-circle--medium:before{content:\"\\ea16\"}.ez-icon-circle:before{content:\"\\ea17\"}.ez-icon-clipboard:before{content:\"\\ea18\"}.ez-icon-close-circle-inverted:before{content:\"\\ea19\"}.ez-icon-close-circle:before{content:\"\\ea1a\"}.ez-icon-close:before{content:\"\\ea1b\"}.ez-icon-comment-inverted:before{content:\"\\ea1c\"}.ez-icon-comment:before{content:\"\\ea1d\"}.ez-icon-configuration:before{content:\"\\ea1e\"}.ez-icon-copy:before{content:\"\\ea1f\"}.ez-icon-crop:before{content:\"\\ea20\"}.ez-icon-delete:before{content:\"\\ea21\"}.ez-icon-description:before{content:\"\\ea22\"}.ez-icon-dot-notification:before{content:\"\\ea23\"}.ez-icon-dots-horizontal:before{content:\"\\ea24\"}.ez-icon-dots-vertical:before{content:\"\\ea25\"}.ez-icon-drag-indicator:before{content:\"\\ea26\"}.ez-icon-edit-file:before{content:\"\\ea27\"}.ez-icon-edit-table:before{content:\"\\ea28\"}.ez-icon-edit-time:before{content:\"\\ea29\"}.ez-icon-edit:before{content:\"\\ea2a\"}.ez-icon-email-inverted:before{content:\"\\ea2b\"}.ez-icon-email:before{content:\"\\ea2c\"}.ez-icon-error-octagon:before{content:\"\\ea2d\"}.ez-icon-expand:before{content:\"\\ea2e\"}.ez-icon-eye-off:before{content:\"\\ea2f\"}.ez-icon-eye:before{content:\"\\ea30\"}.ez-icon-favorite:before{content:\"\\ea31\"}.ez-icon-file-download:before{content:\"\\ea32\"}.ez-icon-file-upload:before{content:\"\\ea33\"}.ez-icon-filter:before{content:\"\\ea34\"}.ez-icon-find-file:before{content:\"\\ea35\"}.ez-icon-find-page:before{content:\"\\ea36\"}.ez-icon-format-color-fill:before{content:\"\\ea37\"}.ez-icon-help-circle-outline:before{content:\"\\ea38\"}.ez-icon-help-inverted:before{content:\"\\ea39\"}.ez-icon-help:before{content:\"\\ea3a\"}.ez-icon-home:before{content:\"\\ea3b\"}.ez-icon-language:before{content:\"\\ea3c\"}.ez-icon-launch:before{content:\"\\ea3d\"}.ez-icon-lightbulb:before{content:\"\\ea3e\"}.ez-icon-list:before{content:\"\\ea3f\"}.ez-icon-loading:before{content:\"\\ea40\"}.ez-icon-lock-outline:before{content:\"\\ea41\"}.ez-icon-lock:before{content:\"\\ea42\"}.ez-icon-menu:before{content:\"\\ea43\"}.ez-icon-minus-circle-inverted:before{content:\"\\ea44\"}.ez-icon-minus:before{content:\"\\ea45\"}.ez-icon-money-off:before{content:\"\\ea46\"}.ez-icon-money:before{content:\"\\ea47\"}.ez-icon-north-west:before{content:\"\\ea48\"}.ez-icon-pause:before{content:\"\\ea49\"}.ez-icon-payments:before{content:\"\\ea4a\"}.ez-icon-play:before{content:\"\\ea4b\"}.ez-icon-plus-circle-inverted:before{content:\"\\ea4c\"}.ez-icon-plus-circle:before{content:\"\\ea4d\"}.ez-icon-plus:before{content:\"\\ea4e\"}.ez-icon-power:before{content:\"\\ea4f\"}.ez-icon-push-pin:before{content:\"\\ea50\"}.ez-icon-restore:before{content:\"\\ea51\"}.ez-icon-return:before{content:\"\\ea52\"}.ez-icon-rotate:before{content:\"\\ea53\"}.ez-icon-save:before{content:\"\\ea54\"}.ez-icon-search:before{content:\"\\ea55\"}.ez-icon-settings-inverted:before{content:\"\\ea56\"}.ez-icon-settings:before{content:\"\\ea57\"}.ez-icon-share:before{content:\"\\ea58\"}.ez-icon-shield:before{content:\"\\ea59\"}.ez-icon-south-east:before{content:\"\\ea5a\"}.ez-icon-success-circle:before{content:\"\\ea5b\"}.ez-icon-sync:before{content:\"\\ea5c\"}.ez-icon-table:before{content:\"\\ea5d\"}.ez-icon-timer-outline:before{content:\"\\ea5e\"}.ez-icon-user-circle:before{content:\"\\ea5f\"}.ez-icon-warning-minus:before{content:\"\\ea60\"}.ez-icon-warning-triangle:before{content:\"\\ea61\"}.x-small--font{font-size:12px}.small--font{font-size:16px}.medium--font{font-size:20px}.large--font{font-size:24px}.x-large--font{font-size:30px}";
5
+
6
+ const EzIcon = class {
7
+ constructor(hostRef) {
8
+ registerInstance(this, hostRef);
9
+ /**
10
+ * Tamanho do ícone
11
+ */
12
+ this.size = 'medium';
13
+ }
14
+ isSprite() {
15
+ return this.href && this.href.indexOf('#') > -1;
16
+ }
17
+ getIconClassName() {
18
+ return `ez-icon-${this.iconName}`;
19
+ }
20
+ getIconContent() {
21
+ if (this.isSprite()) {
22
+ return h("svg", { class: this.size, role: "img" }, h("use", { xlinkHref: this.href }));
23
+ }
24
+ else if (!StringUtils.isEmpty(this.iconName)) {
25
+ return h("span", { class: `icon-content ${this.getIconClassName()} ${this.size}--font` });
26
+ }
27
+ else {
28
+ return h("img", { class: this.size, src: this.href });
29
+ }
30
+ }
31
+ render() {
32
+ return (h(Host, null, this.getIconContent()));
33
+ }
34
+ };
35
+ EzIcon.style = ezIconCss;
36
+
37
+ export { EzIcon as ez_icon };