@zeedhi/teknisa-components-common 3.1.0 → 3.3.0

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 (128) hide show
  1. package/dist/teknisa-components-common.es.js +3537 -0
  2. package/dist/teknisa-components-common.es.js.map +1 -0
  3. package/dist/types/components/tek-breadcrumb-header/breadcrumb-header.d.ts +2 -2
  4. package/dist/types/components/tek-breadcrumb-header/interfaces.d.ts +1 -1
  5. package/dist/types/components/tek-datasource/tek-memory-datasource.d.ts +1 -21
  6. package/dist/types/components/tek-datasource/tek-rest-datasource.d.ts +6 -28
  7. package/dist/types/components/tek-grid/filter-helper.d.ts +2 -2
  8. package/dist/types/components/tek-grid/grid-filter-button.d.ts +1 -0
  9. package/dist/types/components/tek-grid/grouped-data-manager.d.ts +8 -1
  10. package/dist/types/components/tek-grid/interfaces.d.ts +8 -1
  11. package/dist/types/components/tek-grid/tek-grid-controller.d.ts +19 -17
  12. package/dist/types/components/tek-grid/tek-grid-data-editor.d.ts +11 -0
  13. package/dist/types/components/tek-grid/tek-grid-toolbar-provider/export-options/multi-option.d.ts +1 -1
  14. package/dist/types/components/tek-grid/tek-grid-toolbar-provider/tek-grid-toolbar-provider.d.ts +8 -1
  15. package/dist/types/components/tek-grid/tek-grid.d.ts +22 -5
  16. package/dist/types/components/tek-loading/interfaces.d.ts +1 -1
  17. package/dist/types/components/tek-loading/loading.d.ts +1 -1
  18. package/dist/types/components/tek-user-info/TekUserInfoController.d.ts +4 -4
  19. package/dist/types/utils/extract-properties/extract-properties.d.ts +1 -0
  20. package/dist/types/utils/index.d.ts +2 -0
  21. package/dist/types/utils/report-filter/report-filter.d.ts +12 -0
  22. package/package.json +30 -12
  23. package/coverage/clover.xml +0 -6
  24. package/coverage/coverage-final.json +0 -1
  25. package/coverage/lcov-report/base.css +0 -224
  26. package/coverage/lcov-report/block-navigation.js +0 -87
  27. package/coverage/lcov-report/favicon.png +0 -0
  28. package/coverage/lcov-report/index.html +0 -101
  29. package/coverage/lcov-report/prettify.css +0 -1
  30. package/coverage/lcov-report/prettify.js +0 -2
  31. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  32. package/coverage/lcov-report/sorter.js +0 -210
  33. package/coverage/lcov-report/tests/__helpers__/component-event-helper.ts.html +0 -100
  34. package/coverage/lcov-report/tests/__helpers__/create-component.ts.html +0 -109
  35. package/coverage/lcov-report/tests/__helpers__/find-component.ts.html +0 -139
  36. package/coverage/lcov-report/tests/__helpers__/flush-promises-helper.ts.html +0 -94
  37. package/coverage/lcov-report/tests/__helpers__/get-child-helper.ts.html +0 -166
  38. package/coverage/lcov-report/tests/__helpers__/index.html +0 -221
  39. package/coverage/lcov-report/tests/__helpers__/index.ts.html +0 -106
  40. package/coverage/lcov-report/tests/__helpers__/mock-created-helper.ts.html +0 -121
  41. package/coverage/lcov-report/tests/__helpers__/spy-on-all-methods.ts.html +0 -223
  42. package/coverage/lcov.info +0 -0
  43. package/dist/teknisa-components-common.js +0 -3808
  44. package/dist/teknisa-components-common.min.js +0 -3808
  45. package/dist/types/components/tek-grid/grouped-view-navigator.d.ts +0 -14
  46. package/environments.json +0 -26
  47. package/jest.config.cjs +0 -23
  48. package/src/components/index.ts +0 -101
  49. package/src/components/tek-breadcrumb-header/breadcrumb-header.ts +0 -29
  50. package/src/components/tek-breadcrumb-header/interfaces.ts +0 -7
  51. package/src/components/tek-datasource/index.ts +0 -3
  52. package/src/components/tek-datasource/interfaces.ts +0 -36
  53. package/src/components/tek-datasource/tek-memory-datasource.ts +0 -314
  54. package/src/components/tek-datasource/tek-rest-datasource.ts +0 -224
  55. package/src/components/tek-grid/columns-searcher.ts +0 -22
  56. package/src/components/tek-grid/dynamic-filter-datasource-factory.ts +0 -20
  57. package/src/components/tek-grid/filter-helper.ts +0 -20
  58. package/src/components/tek-grid/grid-filter-button.ts +0 -421
  59. package/src/components/tek-grid/grouped-data-manager.ts +0 -448
  60. package/src/components/tek-grid/grouped-data-navigator.ts +0 -66
  61. package/src/components/tek-grid/grouped-data-selector.ts +0 -40
  62. package/src/components/tek-grid/index.ts +0 -18
  63. package/src/components/tek-grid/interfaces.ts +0 -329
  64. package/src/components/tek-grid/keymap-grouped.ts +0 -20
  65. package/src/components/tek-grid/layout-options.ts +0 -248
  66. package/src/components/tek-grid/tek-grid-column.ts +0 -193
  67. package/src/components/tek-grid/tek-grid-columns-button/tek-grid-columns-button-controller.ts +0 -28
  68. package/src/components/tek-grid/tek-grid-columns-button/tek-grid-columns-button.ts +0 -38
  69. package/src/components/tek-grid/tek-grid-controller.ts +0 -140
  70. package/src/components/tek-grid/tek-grid-events.ts +0 -105
  71. package/src/components/tek-grid/tek-grid-toolbar-provider/export-options/button-option.ts +0 -26
  72. package/src/components/tek-grid/tek-grid-toolbar-provider/export-options/index.ts +0 -3
  73. package/src/components/tek-grid/tek-grid-toolbar-provider/export-options/interfaces.ts +0 -6
  74. package/src/components/tek-grid/tek-grid-toolbar-provider/export-options/multi-option.ts +0 -85
  75. package/src/components/tek-grid/tek-grid-toolbar-provider/index.ts +0 -2
  76. package/src/components/tek-grid/tek-grid-toolbar-provider/tek-grid-toolbar-provider.ts +0 -365
  77. package/src/components/tek-grid/tek-grid.ts +0 -1122
  78. package/src/components/tek-loading/interfaces.ts +0 -7
  79. package/src/components/tek-loading/loading.ts +0 -27
  80. package/src/components/tek-user-info/TekUserInfoController.ts +0 -87
  81. package/src/components/tek-user-info/interfaces.ts +0 -21
  82. package/src/components/tek-user-info/tek-user-info-list.ts +0 -64
  83. package/src/components/tek-user-info/tek-user-info.ts +0 -337
  84. package/src/error/tek-grid-delete-rows-error.ts +0 -15
  85. package/src/error/teknisa-common-error.ts +0 -8
  86. package/src/utils/config/config.ts +0 -8
  87. package/src/utils/index.ts +0 -3
  88. package/src/utils/is-filled-object/is-filled-object.ts +0 -5
  89. package/src/utils/is-nil.ts +0 -3
  90. package/tests/__helpers__/component-event-helper.ts +0 -5
  91. package/tests/__helpers__/create-component.ts +0 -8
  92. package/tests/__helpers__/find-component.ts +0 -18
  93. package/tests/__helpers__/flush-promises-helper.ts +0 -3
  94. package/tests/__helpers__/get-child-helper.ts +0 -27
  95. package/tests/__helpers__/index.ts +0 -7
  96. package/tests/__helpers__/mock-created-helper.ts +0 -12
  97. package/tests/__helpers__/spy-on-all-methods.ts +0 -46
  98. package/tests/__mocks__/@zeedhi/core/i18n.js +0 -75
  99. package/tests/__mocks__/@zeedhi/core.js +0 -5
  100. package/tests/unit/components/tek-breadcrumb-header/tek-breadcrumb-header.spec.ts +0 -43
  101. package/tests/unit/components/tek-datasource/memory-datasource.spec.ts +0 -463
  102. package/tests/unit/components/tek-datasource/rest-datasource.spec.ts +0 -362
  103. package/tests/unit/components/tek-grid/button-option.spec.ts +0 -49
  104. package/tests/unit/components/tek-grid/columns-searcher.spec.ts +0 -112
  105. package/tests/unit/components/tek-grid/dynamic-filter-datasource-factory.spec.ts +0 -90
  106. package/tests/unit/components/tek-grid/filter-helper.spec.ts +0 -56
  107. package/tests/unit/components/tek-grid/grid-filter-button.spec.ts +0 -842
  108. package/tests/unit/components/tek-grid/grouped-data-manager.spec.ts +0 -593
  109. package/tests/unit/components/tek-grid/grouped-data-navigator.spec.ts +0 -143
  110. package/tests/unit/components/tek-grid/grouped-data-selector.spec.ts +0 -136
  111. package/tests/unit/components/tek-grid/keymap-grouped.spec.ts +0 -20
  112. package/tests/unit/components/tek-grid/layout-options.spec.ts +0 -1020
  113. package/tests/unit/components/tek-grid/tek-grid-column.spec.ts +0 -318
  114. package/tests/unit/components/tek-grid/tek-grid-columns-button.spec.ts +0 -229
  115. package/tests/unit/components/tek-grid/tek-grid-controller.spec.ts +0 -253
  116. package/tests/unit/components/tek-grid/tek-grid-events.spec.ts +0 -186
  117. package/tests/unit/components/tek-grid/tek-grid-toolbar-provider.spec.ts +0 -34
  118. package/tests/unit/components/tek-grid/tek-grid.spec.ts +0 -897
  119. package/tests/unit/components/tek-grid/tek-memory-datasource.spec.ts +0 -482
  120. package/tests/unit/components/tek-grid/tek-rest-datasource.spec.ts +0 -422
  121. package/tests/unit/components/tek-loading/loading.spec.ts +0 -29
  122. package/tests/unit/components/tek-user-info/TekUserInfoContoller.spec.ts +0 -220
  123. package/tests/unit/components/tek-user-info/tek-user-info-list.spec.ts +0 -96
  124. package/tests/unit/components/tek-user-info/tek-user-info.spec.ts +0 -442
  125. package/tests/unit/utils/mock-console.ts +0 -18
  126. package/tests/unit/utils/setup.ts +0 -5
  127. package/tsconfig.build.json +0 -7
  128. package/tsconfig.eslint.json +0 -9
@@ -1,3808 +0,0 @@
1
- import { DatasourceFactory, MemoryDatasource, URL, Utils, RestDatasource, Metadata, DateHelper, I18n, Messages, Config, Accessor, Loader, Http } from '@zeedhi/core';
2
- import { ComponentRender, Loading as Loading$1, GridColumnEditable, Button, ModalService, NonInitializedError, DataNavigator, GridEditableEvents, DataSelector, Iterable, TableActionBuilder, IterableTable, ViewNavigator, DataEditorWithAdd, KeyMapMerger, KeyMapNavigation, KeyMapEditing, IterableColumnsButtonController, IterableColumnsButton, List } from '@zeedhi/common';
3
- import debounce from 'lodash.debounce';
4
- import clonedeep from 'lodash.clonedeep';
5
- import { UserInfo } from '@zeedhi/zd-user-info-common';
6
-
7
- /**
8
- * BreadcrumbHeader join breadcrumb and title
9
- */
10
- class BreadcrumbHeader extends ComponentRender {
11
- breadcrumb;
12
- title = '';
13
- rightSlot = [];
14
- constructor(props) {
15
- super(props);
16
- this.breadcrumb = this.getBreadcrumbProperties(props.breadcrumb);
17
- this.title = this.getInitValue('title', props.title, this.title);
18
- this.rightSlot = props.rightSlot || this.rightSlot;
19
- }
20
- getBreadcrumbProperties(breadcrumb) {
21
- return {
22
- ...breadcrumb,
23
- name: breadcrumb.name,
24
- component: 'ZdBreadcrumb',
25
- divider: '>',
26
- };
27
- }
28
- }
29
-
30
- // biome-ignore format: Preserve the legacy embedded GIF without rewriting a very large literal.
31
- const loading = 'data:image/gif;base64,R0lGODlhlgCWAPf/AC1oxPa+ADarU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ghijiiCSWaOKJKKao4oostujiizDGKOOMNNZo44045qjjjjz26OOPQAYp5JBEFmnkkUgmqSRVAQEAIfkEBQQA/wAsAAAAAJYAlgAACPEA/wkcSLCgwYMIEypcyLChw4cQI0qcSLGixYsYM2rcyLGjx48gQ4ocSbKkyZMoU6pcybKly5cwY8qcSbOmzZs4c+rcybOnz59AgwodSrSo0aNIkypdyrSp06dQo0qdSrWq1atYs2rdyrWr169gw4odS7as2bNo06pdy7at27dw48qdS7eu3bt48+rdy7ev37+AAwseTLiw4cOIEytezLix48eQI0ueTLmy5cuYM2vezLmz58+gQ4seTbq06dOoU6tezbq169ewY8ueTbu27du4c+vezbu379/AgwsfTry48ePIkytfzry58+fQo0ufbjggACH5BAUEAP8ALAAAAAABAAEAAAgEAP8FBAA7';
32
- /**
33
- * Teknisa component
34
- */
35
- class Loading extends Loading$1 {
36
- /**
37
- * Text shown in the loading overlay.
38
- */
39
- text = '';
40
- /**
41
- * Loading image.
42
- */
43
- image = loading;
44
- constructor(props) {
45
- super(props);
46
- this.text = this.getInitValue('text', props.text, this.text);
47
- this.image = this.getInitValue('image', props.image, this.image);
48
- }
49
- }
50
-
51
- const DynamicFilterOperations = {
52
- CONTAINS: true,
53
- NOT_CONTAINS: true,
54
- EQUALS: true,
55
- NOT_EQUALS: true,
56
- GREATER_THAN: true,
57
- LESS_THAN: true,
58
- GREATER_THAN_EQUALS: true,
59
- LESS_THAN_EQUALS: true,
60
- IN: true,
61
- NOT_IN: true,
62
- BETWEEN: true,
63
- };
64
- const DynamicFilterRelations = {
65
- AND: true,
66
- OR: true,
67
- };
68
-
69
- class TekMemoryDatasource extends MemoryDatasource {
70
- /**
71
- * Dynamic Filter Operations
72
- */
73
- dynamicFilterOperations = DynamicFilterOperations;
74
- /**
75
- * Dynamic Filter Relations
76
- */
77
- dynamicFilterRelations = DynamicFilterRelations;
78
- /**
79
- * Dynamic Filter applied flag
80
- */
81
- dynamicFilterApplied = '';
82
- /**
83
- * Create new datasource
84
- * @param props Datasource properties
85
- */
86
- constructor(props) {
87
- super(props);
88
- if (!this.watchUrl) {
89
- this.dynamicFilter = this.getInitValue('dynamicFilter', props.dynamicFilter, {});
90
- this.searchJoin = this.getInitValue('searchJoin', props.searchJoin, {});
91
- }
92
- this.createAccessors();
93
- this.createObjAccessors(this.dynamicFilter, 'dynamicFilter');
94
- this.createObjAccessors(this.searchJoin, 'searchJoin');
95
- }
96
- updateReservedKeys() {
97
- this.reservedKeys.dynamic_filter = true;
98
- this.reservedKeys.search_join = true;
99
- }
100
- updateInternalProperties(datasource = {}) {
101
- if (!this.watchUrl)
102
- return;
103
- this.updateReservedKeys();
104
- super.updateInternalProperties(datasource);
105
- const queryString = URL.getParsedQueryStringFromUrl();
106
- this.dynamicFilter = this.getEncodedParam(queryString.dynamic_filter, datasource.dynamicFilter);
107
- this.searchJoin = this.getEncodedParam(queryString.search_join, datasource.searchJoin);
108
- }
109
- getEncodedParam(urlParam, datasourceParam = {}) {
110
- return urlParam ? JSON.parse(atob(urlParam)) : datasourceParam;
111
- }
112
- getQueryStringValues() {
113
- const values = super.getQueryStringValues();
114
- if (this.dynamicFilter && Object.keys(this.dynamicFilter).length) {
115
- values.dynamic_filter = btoa(JSON.stringify(this.dynamicFilter));
116
- }
117
- if (this.searchJoin && Object.keys(this.searchJoin).length) {
118
- values.search_join = btoa(JSON.stringify(this.searchJoin));
119
- }
120
- return values;
121
- }
122
- getUrlQueryString() {
123
- const superQueryString = super.getUrlQueryString();
124
- const query = URL.getParsedQueryStringFromUrl();
125
- let dynamicFilterQuerystring = '';
126
- if (query.dynamic_filter) {
127
- dynamicFilterQuerystring = `&${URL.getFormattedQueryString({
128
- dynamic_filter: query.dynamic_filter,
129
- })}`;
130
- }
131
- let searchJoinQuerystring = '';
132
- if (query.search_join) {
133
- searchJoinQuerystring = `&${URL.getFormattedQueryString({
134
- search_join: query.search_join,
135
- })}`;
136
- }
137
- return superQueryString + dynamicFilterQuerystring + searchJoinQuerystring;
138
- }
139
- /**
140
- * Adds a new dynamic filter position or replace if exists
141
- * @param column Dynamic Filter column name
142
- * @param value Dynamic Filter value
143
- * @returns Promise with data collection
144
- */
145
- addDynamicFilter(column, value) {
146
- if (this.isValidDynamicFilterValue(column, value)) {
147
- this.dynamicFilter[column] = value;
148
- return this.updateDynamicFilter();
149
- }
150
- return this.removeDynamicFilter(column);
151
- }
152
- /**
153
- * Removes a dynamic filter position
154
- * @param column Dynamic Filter column name
155
- * @returns Promise with data collection
156
- */
157
- removeDynamicFilter(column) {
158
- delete this.dynamicFilter[column];
159
- return this.updateDynamicFilter();
160
- }
161
- /**
162
- * Sets new dynamic filter value
163
- * @param filter Dynamic Filter value
164
- * @returns Promise with data collection
165
- */
166
- setDynamicFilter(filter) {
167
- this.dynamicFilter = {};
168
- Object.keys(filter).forEach((column) => {
169
- if (this.isValidDynamicFilterValue(column, filter[column])) {
170
- this.dynamicFilter[column] = filter[column];
171
- }
172
- else {
173
- delete this.dynamicFilter[column];
174
- }
175
- });
176
- return this.updateDynamicFilter();
177
- }
178
- /**
179
- * Clears Dynamic filter value
180
- * @returns Promise with data collection
181
- */
182
- clearDynamicFilter() {
183
- this.dynamicFilter = {};
184
- return this.updateDynamicFilter();
185
- }
186
- /**
187
- * Resets page and selected rows and tries to update the url
188
- * @returns Promise with data collection
189
- */
190
- async updateDynamicFilter() {
191
- this.page = this.firstPage;
192
- this.selectedRows = [];
193
- this.visibleSelectedRows = [];
194
- if (this.watchUrl) {
195
- if (this.dynamicFilter && Object.keys(this.dynamicFilter).length) {
196
- URL.updateQueryString({
197
- dynamic_filter: btoa(JSON.stringify(this.dynamicFilter)),
198
- });
199
- }
200
- else {
201
- URL.updateQueryString({
202
- dynamic_filter: undefined,
203
- });
204
- }
205
- }
206
- return this.get();
207
- }
208
- /**
209
- * Checks if a filter value is valid
210
- * @param value Filter value
211
- * @returns Is valid filter value
212
- */
213
- isValidDynamicFilterValue(column, value) {
214
- return (!this.reservedKeys[column] &&
215
- value &&
216
- value.length > 0 &&
217
- value.every((filterValue) => this.dynamicFilterOperations[filterValue.operation] &&
218
- this.dynamicFilterRelations[filterValue.relation] &&
219
- filterValue.value !== '' &&
220
- filterValue.value !== null));
221
- }
222
- clone() {
223
- return {
224
- ...super.clone(),
225
- dynamicFilter: this.dynamicFilter,
226
- searchJoin: this.searchJoin,
227
- type: 'tek-memory',
228
- };
229
- }
230
- /**
231
- * Updates filtered data
232
- */
233
- updateFilteredData() {
234
- // first apply filters (simple and dynamic)
235
- this.filteredData = Object.keys(this.filter).length
236
- ? this.allData.filter((row) => this.getRowByFilter(row))
237
- : Array.from(this.allData);
238
- if (this.dynamicFilter && Object.keys(this.dynamicFilter).length) {
239
- this.filteredData = this.filteredData.filter((row) => this.getRowByDynamicFilter(row));
240
- }
241
- const searchWithoutSearchJoin = (row) => {
242
- const searchRow = { ...row };
243
- if (this.searchJoin) {
244
- // do not search on columns with searchJoin
245
- Object.keys(this.searchJoin).forEach((key) => delete searchRow[key]);
246
- }
247
- return this.getRowBySearch(searchRow);
248
- };
249
- // only after do the search
250
- const searchData = this.search ? this.filteredData.filter(searchWithoutSearchJoin) : this.filteredData;
251
- let searchIds = searchData.map((row) => row[this.uniqueKey]);
252
- if (this.searchJoin && Object.keys(this.searchJoin).length) {
253
- const searchJoinData = this.filteredData.filter((row) => this.getRowBySearchJoin(row));
254
- // get the ids from search and searchJoin
255
- searchIds = searchIds.concat(searchJoinData.map((row) => row[this.uniqueKey])).sort();
256
- }
257
- // filter filteredData using searchIds
258
- this.filteredData = this.allData.filter((row) => searchIds.indexOf(row[this.uniqueKey]) !== -1);
259
- }
260
- getRowByDynamicFilter(row) {
261
- let filtered;
262
- try {
263
- Object.keys(this.dynamicFilter).forEach((key) => {
264
- const filterItems = this.dynamicFilter[key];
265
- filterItems.forEach((item) => {
266
- if (filtered === false && item.relation === 'AND')
267
- return;
268
- if (filtered === true && item.relation === 'OR')
269
- return;
270
- const columnValue = Utils.normalize(row[key].toString());
271
- let value = '';
272
- if (Array.isArray(item.value)) {
273
- value = item.value.map((val) => Utils.normalize(val.toString()));
274
- switch (item.operation) {
275
- case 'IN':
276
- filtered = value.includes(columnValue);
277
- break;
278
- case 'NOT_IN':
279
- filtered = !value.includes(columnValue);
280
- break;
281
- case 'BETWEEN':
282
- filtered =
283
- (Number(columnValue) || columnValue) >= (Number(value[0]) || value[0]) &&
284
- (Number(columnValue) || columnValue) <= (Number(value[1]) || value[1]);
285
- break;
286
- default:
287
- break;
288
- }
289
- }
290
- else {
291
- value = Utils.normalize(item.value.toString());
292
- switch (item.operation) {
293
- case 'CONTAINS':
294
- filtered = columnValue.indexOf(value) !== -1;
295
- break;
296
- case 'NOT_CONTAINS':
297
- filtered = columnValue.indexOf(value) === -1;
298
- break;
299
- case 'EQUALS':
300
- filtered = columnValue === value;
301
- break;
302
- case 'NOT_EQUALS':
303
- filtered = columnValue !== value;
304
- break;
305
- case 'GREATER_THAN':
306
- filtered = (Number(columnValue) || columnValue) > (Number(value) || value);
307
- break;
308
- case 'LESS_THAN':
309
- filtered = (Number(columnValue) || columnValue) < (Number(value) || value);
310
- break;
311
- case 'GREATER_THAN_EQUALS':
312
- filtered = (Number(columnValue) || columnValue) >= (Number(value) || value);
313
- break;
314
- case 'LESS_THAN_EQUALS':
315
- filtered = (Number(columnValue) || columnValue) <= (Number(value) || value);
316
- break;
317
- default:
318
- break;
319
- }
320
- }
321
- });
322
- });
323
- }
324
- catch {
325
- // do nothing
326
- }
327
- return filtered;
328
- }
329
- getRowBySearchJoin(row) {
330
- return Object.keys(this.searchJoin).some((key) => this.searchJoin[key].includes(row[key]));
331
- }
332
- hasFilter(columnName) {
333
- return this.dynamicFilter[columnName] && this.dynamicFilter[columnName].length > 0;
334
- }
335
- }
336
- DatasourceFactory.register('tek-memory', TekMemoryDatasource);
337
-
338
- class TekRestDatasource extends RestDatasource {
339
- /**
340
- * Dynamic Filter Operations
341
- */
342
- dynamicFilterOperations = DynamicFilterOperations;
343
- /**
344
- * Dynamic Filter Relations
345
- */
346
- dynamicFilterRelations = DynamicFilterRelations;
347
- /**
348
- * Dynamic Filter applied flag
349
- */
350
- dynamicFilterApplied = '';
351
- /**
352
- * Create new datasource
353
- * @param props Datasource properties
354
- */
355
- constructor(props) {
356
- super({ ...props, lazyLoad: true });
357
- if (!this.watchUrl) {
358
- this.dynamicFilter = this.getInitValue('dynamicFilter', props.dynamicFilter, {});
359
- this.searchJoin = this.getInitValue('searchJoin', props.searchJoin, {});
360
- }
361
- this.lazyLoad = this.getInitValue('lazyLoad', props.lazyLoad, this.lazyLoad);
362
- this.createAccessors();
363
- this.createObjAccessors(this.dynamicFilter, 'dynamicFilter');
364
- this.createObjAccessors(this.searchJoin, 'searchJoin');
365
- }
366
- updateReservedKeys() {
367
- this.reservedKeys.dynamic_filter = true;
368
- this.reservedKeys.search_join = true;
369
- }
370
- updateInternalProperties(datasource = {}) {
371
- if (!this.watchUrl)
372
- return;
373
- this.updateReservedKeys();
374
- super.updateInternalProperties(datasource);
375
- const queryString = URL.getParsedQueryStringFromUrl();
376
- this.dynamicFilter = this.getEncodedParam(queryString.dynamic_filter, datasource.dynamicFilter);
377
- this.searchJoin = this.getEncodedParam(queryString.search_join, datasource.searchJoin);
378
- }
379
- getEncodedParam(urlParam, datasourceParam = {}) {
380
- return urlParam ? JSON.parse(atob(urlParam)) : datasourceParam;
381
- }
382
- getQueryStringValues() {
383
- const values = super.getQueryStringValues();
384
- if (this.dynamicFilter && Object.keys(this.dynamicFilter).length) {
385
- values.dynamic_filter = btoa(JSON.stringify(this.dynamicFilter));
386
- }
387
- if (this.searchJoin && Object.keys(this.searchJoin).length) {
388
- values.search_join = btoa(JSON.stringify(this.searchJoin));
389
- }
390
- return values;
391
- }
392
- getUrlQueryString() {
393
- const superQueryString = super.getUrlQueryString();
394
- const query = URL.getParsedQueryStringFromUrl();
395
- let dynamicFilterQuerystring = '';
396
- if (query.dynamic_filter) {
397
- dynamicFilterQuerystring = `&${URL.getFormattedQueryString({
398
- dynamic_filter: query.dynamic_filter,
399
- })}`;
400
- }
401
- let searchJoinQuerystring = '';
402
- if (query.search_join) {
403
- searchJoinQuerystring = `&${URL.getFormattedQueryString({
404
- search_join: query.search_join,
405
- })}`;
406
- }
407
- return superQueryString + dynamicFilterQuerystring + searchJoinQuerystring;
408
- }
409
- /**
410
- * Adds a new dynamic filter position or replace if exists
411
- * @param column Dynamic Filter column name
412
- * @param value Dynamic Filter value
413
- * @returns Promise with data collection
414
- */
415
- addDynamicFilter(column, value) {
416
- if (this.isValidDynamicFilterValue(column, value)) {
417
- this.dynamicFilter[column] = value;
418
- return this.updateDynamicFilter();
419
- }
420
- return this.removeDynamicFilter(column);
421
- }
422
- /**
423
- * Removes a dynamic filter position
424
- * @param column Dynamic Filter column name
425
- * @returns Promise with data collection
426
- */
427
- removeDynamicFilter(column) {
428
- delete this.dynamicFilter[column];
429
- return this.updateDynamicFilter();
430
- }
431
- /**
432
- * Sets new dynamic filter value
433
- * @param filter Dynamic Filter value
434
- * @returns Promise with data collection
435
- */
436
- setDynamicFilter(filter) {
437
- this.dynamicFilter = {};
438
- Object.keys(filter).forEach((column) => {
439
- if (this.isValidDynamicFilterValue(column, filter[column])) {
440
- this.dynamicFilter[column] = filter[column];
441
- }
442
- else {
443
- delete this.dynamicFilter[column];
444
- }
445
- });
446
- return this.updateDynamicFilter();
447
- }
448
- /**
449
- * Clears Dynamic filter value
450
- * @returns Promise with data collection
451
- */
452
- clearDynamicFilter() {
453
- this.dynamicFilter = {};
454
- return this.updateDynamicFilter();
455
- }
456
- /**
457
- * Resets page and selected rows and tries to update the url
458
- * @returns Promise with data collection
459
- */
460
- async updateDynamicFilter() {
461
- this.page = this.firstPage;
462
- this.selectedRows = [];
463
- this.visibleSelectedRows = [];
464
- if (this.watchUrl) {
465
- if (this.dynamicFilter && Object.keys(this.dynamicFilter).length) {
466
- URL.updateQueryString({
467
- dynamic_filter: btoa(JSON.stringify(this.dynamicFilter)),
468
- });
469
- }
470
- else {
471
- URL.updateQueryString({
472
- dynamic_filter: undefined,
473
- });
474
- }
475
- }
476
- return this.get();
477
- }
478
- /**
479
- * Checks if a filter value is valid
480
- * @param value Filter value
481
- * @returns Is valid filter value
482
- */
483
- isValidDynamicFilterValue(column, value) {
484
- return (!this.reservedKeys[column] &&
485
- value &&
486
- value.length > 0 &&
487
- value.every((filterValue) => this.dynamicFilterOperations[filterValue.operation] &&
488
- this.dynamicFilterRelations[filterValue.relation] &&
489
- filterValue.value !== '' &&
490
- filterValue.value !== null));
491
- }
492
- /**
493
- * Retrieves request params
494
- */
495
- getRequestParams() {
496
- const requestParams = super.getRequestParams();
497
- const isNotEmptyObj = (obj) => !!(obj && Object.keys(obj).length);
498
- const isValid = this.dynamicFilter &&
499
- Object.keys(this.dynamicFilter).every((column) => {
500
- const value = this.dynamicFilter[column];
501
- return value && value.length > 0 && this.isValidDynamicFilterValue(column, value);
502
- });
503
- if (isNotEmptyObj(this.dynamicFilter) && isValid) {
504
- requestParams.dynamic_filter = btoa(JSON.stringify(this.dynamicFilter));
505
- }
506
- if (isNotEmptyObj(this.searchJoin)) {
507
- requestParams.search_join = btoa(JSON.stringify(this.searchJoin));
508
- }
509
- return requestParams;
510
- }
511
- hasFilter(columnName) {
512
- return this.dynamicFilter[columnName] && this.dynamicFilter[columnName].length > 0;
513
- }
514
- clone() {
515
- return {
516
- ...super.clone(),
517
- dynamicFilter: this.dynamicFilter,
518
- searchJoin: this.searchJoin,
519
- type: 'tek-rest',
520
- };
521
- }
522
- }
523
- DatasourceFactory.register('tek-rest', TekRestDatasource);
524
-
525
- class ButtonOption {
526
- config;
527
- constructor(config) {
528
- this.config = config;
529
- }
530
- buildComponent(grid) {
531
- const { type, label, portrait = true, iconName } = this.config;
532
- const orientation = portrait ? 'portrait' : 'landscape';
533
- return {
534
- label,
535
- iconName,
536
- name: `${grid.name}_export_${type}_${orientation}`,
537
- component: 'ZdButton',
538
- flat: true,
539
- events: {
540
- click: () => grid.getReport(type, portrait),
541
- },
542
- };
543
- }
544
- }
545
-
546
- class MultiOption {
547
- config;
548
- constructor(config) {
549
- this.config = config;
550
- }
551
- formatName(id, type, grid) {
552
- return `${grid.name}_export_${type}_${id}`;
553
- }
554
- buildTooltip(option, type, grid) {
555
- const { label } = option;
556
- return {
557
- name: this.formatName(`tooltip_${label}`, type, grid),
558
- component: 'ZdTooltip',
559
- bottom: true,
560
- label,
561
- children: [],
562
- };
563
- }
564
- buildButton(option, type, grid) {
565
- const { cssClass, label, iconName, reportParams } = option;
566
- const { portrait: optionPortrait, rowObj } = reportParams || {};
567
- return {
568
- name: this.formatName(`button_${label}`, type, grid),
569
- component: 'ZdButton',
570
- cssClass,
571
- icon: true,
572
- iconName,
573
- events: {
574
- click: () => grid.getReport(type, optionPortrait, rowObj),
575
- },
576
- };
577
- }
578
- buildDivider(option, type, grid) {
579
- const { label } = option;
580
- return {
581
- name: this.formatName(`divider_${label}`, type, grid),
582
- component: 'ZdDivider',
583
- cssClass: 'zd-my-1',
584
- vertical: true,
585
- };
586
- }
587
- buildComponent(grid) {
588
- const { type, label, multiOption } = this.config;
589
- const optionComponents = multiOption.flatMap((option) => [
590
- {
591
- ...this.buildTooltip(option, type, grid),
592
- children: [this.buildButton(option, type, grid)],
593
- },
594
- this.buildDivider(option, type, grid),
595
- ]);
596
- optionComponents.pop();
597
- const text = {
598
- name: this.formatName('text', type, grid),
599
- component: 'ZdText',
600
- cssClass: 'zd-display-flex zd-align-center zd-flex-grow-1 tek-grid-export-multioption-text',
601
- events: {
602
- click: ({ event }) => event?.stopPropagation(),
603
- },
604
- text: label || '',
605
- };
606
- const result = {
607
- name: this.formatName('row', type, grid),
608
- component: 'ZdRow',
609
- cssClass: 'zd-display-flex zd-ma-0 zd-py-0 zd-gap-x-1 tek-grid-export-multioption-row',
610
- children: [text, ...optionComponents],
611
- };
612
- return result;
613
- }
614
- }
615
-
616
- /**
617
- * Base Teknisa error
618
- */
619
- class TeknisaCommonError extends Error {
620
- constructor(message) {
621
- super(`[Teknisa Common err]: ${message}`);
622
- }
623
- }
624
-
625
- /**
626
- * TekGridDelete rows error
627
- */
628
- class TekGridDeleteRowsError extends TeknisaCommonError {
629
- constructor() {
630
- super("TekGrid can't automatically delete rows when selectAllPages property is true." +
631
- ' You should delete them manually using the beforeDelete event and preventing' +
632
- ' the default execution');
633
- this.name = 'TekGridDeleteRowsError';
634
- }
635
- }
636
-
637
- class TekGridToolbarProvider {
638
- grid;
639
- groupsVisibility;
640
- constructor(grid, groupsVisibility) {
641
- this.grid = grid;
642
- this.groupsVisibility = groupsVisibility;
643
- }
644
- atoms = {
645
- TITLE: '_gridTitle',
646
- HIDE_BUTTON: '_hideButton',
647
- ADD_BUTTON: '_addButton',
648
- DELETE_BUTTON: '_deleteButton',
649
- REFRESH_BUTTON: '_refreshButton',
650
- COLUMNS_BUTTON: '_columnsButton',
651
- LAYOUT_BUTTON: '_layout_options',
652
- EXPORT_BUTTON: '_exportButton',
653
- ACTIONS_BUTTON: '_actionsButton',
654
- SAVE_BUTTON: '_saveButton',
655
- CANCEL_BUTTON: '_cancelButton',
656
- SEARCH: '_gridSearch',
657
- FILTER_BUTTON: '_filterButton',
658
- FILTER_MODAL: '-filter-modal',
659
- FILTER_FORM: '-filter-form',
660
- EXPORT_DROPDOWN: '_export_dropdown',
661
- ACTIONS_DROPDOWN: '_actions_dropdown',
662
- HIDE_TOOLTIP: '_hideTooltip',
663
- TOOLBAR_DIV: '_toolbarDiv',
664
- NOT_EDITING_SPAN: '_notEditingSpan',
665
- ADD_TOOLTIP: '_add_tooltip',
666
- DELETE_TOOLTIP: '_delete_tooltip',
667
- DIVIDER1: '_divider1',
668
- REFRESH_TOOLTIP: '_refresh_tooltip',
669
- DIVIDER2: '_divider2',
670
- COLUMNS_TOOLTIP: '_columns_button_tooltip',
671
- DIVIDER_ACTIONS: '_dividerActions',
672
- DIVIDER3: '_divider3',
673
- FILTER_TOOLTIP: '_filter_tooltip',
674
- };
675
- getAtomName(key) {
676
- return `${this.grid.name}${this.atoms[key]}`;
677
- }
678
- getAtomInstance(key) {
679
- return Metadata.getInstance(`${this.grid.name}${this.atoms[key]}`);
680
- }
681
- getOption(config) {
682
- if (config.multiOption)
683
- return new MultiOption(config);
684
- return new ButtonOption(config);
685
- }
686
- getExportConfigButtons() {
687
- return this.grid.exportConfig.map((config) => {
688
- const option = this.getOption(config);
689
- return option.buildComponent(this.grid);
690
- });
691
- }
692
- hideButtonClick({ event }) {
693
- if (!event.defaultPrevented) {
694
- const instance = Metadata.getInstance(`${this.grid.name}_toolbarDiv`);
695
- if (instance) {
696
- instance.isVisible = !instance.isVisible;
697
- }
698
- }
699
- }
700
- cancelChanges({ event }) {
701
- this.grid.callEvent('beforeCancel', { component: this.grid, event });
702
- if (!event.defaultPrevented) {
703
- const cancel = async () => {
704
- await this.grid.cancelEditedRows();
705
- this.grid.editingNewRows = false;
706
- };
707
- cancel();
708
- this.grid.callEvent('afterCancel', { component: this.grid });
709
- }
710
- }
711
- saveChanges({ event }) {
712
- this.grid.callEvent('beforeSave', { component: this.grid, event });
713
- if (!event.defaultPrevented) {
714
- const save = async () => {
715
- await this.grid.saveEditedRows();
716
- this.grid.editingNewRows = false;
717
- };
718
- save();
719
- this.grid.callEvent('afterSave', { component: this.grid });
720
- }
721
- }
722
- addButtonClick({ event }) {
723
- if (this.grid.editNewRowsOnly) {
724
- this.grid.editingNewRows = true;
725
- }
726
- this.grid.callEvent('addClick', { component: this.grid, event });
727
- }
728
- deleteButtonClick({ event }) {
729
- this.grid.callEvent('beforeDelete', { component: this.grid, event });
730
- if (!event.defaultPrevented) {
731
- if (this.grid.selectAllPages) {
732
- throw new TekGridDeleteRowsError();
733
- }
734
- this.grid.deleteRows();
735
- this.grid.callEvent('afterDelete', { component: this.grid });
736
- }
737
- }
738
- reloadGrid({ event }) {
739
- this.grid.callEvent('beforeReload', { component: this.grid, event });
740
- if (event?.defaultPrevented)
741
- return;
742
- this.grid.reload();
743
- }
744
- getProperties() {
745
- const exportConfigButtons = this.getExportConfigButtons();
746
- return [
747
- {
748
- name: this.getAtomName('TITLE'),
749
- component: 'ZdText',
750
- cssClass: 'toolbar-title',
751
- tag: 'h2',
752
- text: this.grid.title,
753
- title: this.grid.title,
754
- },
755
- {
756
- name: `${this.grid.name}_spacer`,
757
- component: 'VSpacer',
758
- },
759
- {
760
- name: this.getAtomName('HIDE_TOOLTIP'),
761
- component: 'ZdTooltip',
762
- label: `{{GridController_${this.grid.name}.tooltipName}}`,
763
- bottom: true,
764
- children: [
765
- {
766
- name: this.getAtomName('HIDE_BUTTON'),
767
- component: 'ZdButton',
768
- flat: true,
769
- icon: true,
770
- iconName: 'mdi-chevron-right',
771
- color: 'grey',
772
- isVisible: `{{GridController_${this.grid.name}.isNotEditing}}`,
773
- cssClass: `{{GridController_${this.grid.name}.toolbarClass}}`,
774
- events: {
775
- click: this.hideButtonClick.bind(this),
776
- },
777
- },
778
- ],
779
- },
780
- {
781
- name: this.getAtomName('TOOLBAR_DIV'),
782
- component: 'ZdTag',
783
- tag: 'div',
784
- cssStyle: 'display: flex; align-items: center',
785
- isVisible: `{{GridController_${this.grid.name}.showToolbar}}`,
786
- children: [
787
- {
788
- name: this.getAtomName('NOT_EDITING_SPAN'),
789
- component: 'ZdTag',
790
- tag: 'span',
791
- cssStyle: 'display: flex',
792
- isVisible: `{{GridController_${this.grid.name}.isNotEditing}}`,
793
- children: [
794
- {
795
- name: this.getAtomName('ADD_TOOLTIP'),
796
- component: 'ZdTooltip',
797
- label: 'TEKGRID_ADD',
798
- bottom: true,
799
- children: [
800
- {
801
- name: this.getAtomName('ADD_BUTTON'),
802
- component: 'ZdButton',
803
- icon: true,
804
- iconName: 'mdi-plus-box',
805
- isVisible: `{{GridController_${this.grid.name}.showAddButton}}`,
806
- events: {
807
- click: this.addButtonClick.bind(this),
808
- },
809
- },
810
- ],
811
- },
812
- {
813
- name: this.getAtomName('DELETE_TOOLTIP'),
814
- component: 'ZdTooltip',
815
- label: 'TEKGRID_DELETE',
816
- bottom: true,
817
- children: [
818
- {
819
- name: this.getAtomName('DELETE_BUTTON'),
820
- component: 'ZdButton',
821
- icon: true,
822
- iconName: 'mdi-trash-can-outline',
823
- isVisible: `{{GridController_${this.grid.name}.showDeleteButton}}`,
824
- disabled: `{{GridController_${this.grid.name}.disableDeleteButton}}`,
825
- events: {
826
- click: this.deleteButtonClick.bind(this),
827
- },
828
- },
829
- ],
830
- },
831
- {
832
- name: this.getAtomName('DIVIDER1'),
833
- component: 'ZdDivider',
834
- cssClass: 'toolbar-divider',
835
- vertical: true,
836
- isVisible: `{{GridController_${this.grid.name}.showDivider1}}`,
837
- },
838
- {
839
- name: this.getAtomName('REFRESH_TOOLTIP'),
840
- component: 'ZdTooltip',
841
- label: 'TEKGRID_REFRESH',
842
- bottom: true,
843
- children: [
844
- {
845
- name: this.getAtomName('REFRESH_BUTTON'),
846
- component: 'ZdButton',
847
- icon: true,
848
- iconName: 'refresh',
849
- isVisible: `{{GridController_${this.grid.name}.showReloadButton}}`,
850
- events: {
851
- click: this.reloadGrid.bind(this),
852
- },
853
- },
854
- ],
855
- },
856
- {
857
- name: this.getAtomName('DIVIDER2'),
858
- component: 'ZdDivider',
859
- cssClass: 'toolbar-divider',
860
- vertical: true,
861
- isVisible: `{{GridController_${this.grid.name}.showDivider2}}`,
862
- },
863
- {
864
- name: this.getAtomName('COLUMNS_BUTTON'),
865
- component: 'TekGridColumnsButton',
866
- isVisible: `{{GridController_${this.grid.name}.showColumnsButton}}`,
867
- iterableComponentName: this.grid.name,
868
- hideGroups: this.groupsVisibility === 'hide',
869
- ignoreColumns: `{{GridController_${this.grid.name}.columnsButtonIgnore}}`,
870
- },
871
- {
872
- name: this.getAtomName('LAYOUT_BUTTON'),
873
- component: 'TekGridLayoutOptions',
874
- isVisible: `{{GridController_${this.grid.name}.showLayoutOptionsButton}}`,
875
- },
876
- {
877
- name: this.getAtomName('DIVIDER_ACTIONS'),
878
- component: 'ZdDivider',
879
- cssClass: 'toolbar-divider',
880
- vertical: true,
881
- isVisible: `{{GridController_${this.grid.name}.showActionAndExportButton}}`,
882
- },
883
- {
884
- name: this.getAtomName('EXPORT_DROPDOWN'),
885
- component: 'ZdDropdown',
886
- cssClass: 'tekgrid-actions-dropdown',
887
- offsetY: true,
888
- activator: {
889
- name: this.getAtomName('EXPORT_BUTTON'),
890
- component: 'ZdButton',
891
- icon: true,
892
- iconName: 'mdi-file-download-outline',
893
- isVisible: `{{GridController_${this.grid.name}.showExportButton}}`,
894
- },
895
- children: this.grid.exportActions || exportConfigButtons,
896
- },
897
- {
898
- name: this.getAtomName('ACTIONS_DROPDOWN'),
899
- component: 'ZdDropdown',
900
- cssClass: 'tekgrid-actions-dropdown',
901
- offsetY: true,
902
- activator: {
903
- name: this.getAtomName('ACTIONS_BUTTON'),
904
- component: 'ZdButton',
905
- icon: true,
906
- iconName: 'mdi-dots-vertical',
907
- isVisible: `{{GridController_${this.grid.name}.showActionsButton}}`,
908
- },
909
- children: this.grid.actions,
910
- },
911
- {
912
- name: this.getAtomName('DIVIDER3'),
913
- component: 'ZdDivider',
914
- cssClass: 'toolbar-divider',
915
- vertical: true,
916
- isVisible: `{{GridController_${this.grid.name}.showDivider3}}`,
917
- },
918
- ],
919
- },
920
- {
921
- name: this.getAtomName('SAVE_BUTTON'),
922
- component: 'ZdButton',
923
- label: 'TEKGRID_SAVE',
924
- isVisible: `{{GridController_${this.grid.name}.showEditButtons}}`,
925
- small: true,
926
- events: {
927
- click: this.saveChanges.bind(this),
928
- },
929
- },
930
- {
931
- name: this.getAtomName('CANCEL_BUTTON'),
932
- component: 'ZdButton',
933
- label: 'TEKGRID_CANCEL',
934
- outline: true,
935
- cssClass: 'zd-mx-2',
936
- isVisible: `{{GridController_${this.grid.name}.showEditButtons}}`,
937
- small: true,
938
- events: {
939
- click: this.cancelChanges.bind(this),
940
- },
941
- },
942
- {
943
- name: this.getAtomName('SEARCH'),
944
- component: 'ZdSearch',
945
- cssClass: 'zd-grid-search',
946
- iterableComponentName: `${this.grid.name}`,
947
- isVisible: `{{GridController_${this.grid.name}.showSearchInput}}`,
948
- },
949
- {
950
- name: this.getAtomName('FILTER_TOOLTIP'),
951
- component: 'ZdTooltip',
952
- label: 'TEKGRID_FILTER',
953
- bottom: true,
954
- children: [
955
- {
956
- name: this.getAtomName('FILTER_BUTTON'),
957
- component: 'TekGridFilterButton',
958
- grid: this.grid,
959
- gridName: this.grid.name,
960
- showCheckboxAll: this.grid.showCheckboxAllFilter,
961
- isVisible: `{{GridController_${this.grid.name}.showFilterButton}}`,
962
- },
963
- ],
964
- },
965
- ],
966
- },
967
- ];
968
- }
969
- }
970
-
971
- class ColumnsSearcher {
972
- async searchColumn(columns, search) {
973
- const lookupColumns = columns.filter((column) => !!column.componentProps?.datasource && !column.skipLookupSearch);
974
- const searchJoin = {};
975
- if (search) {
976
- const promises = lookupColumns.map(async (column) => {
977
- const searchData = await column.memorySearch(search);
978
- const lookupId = column.componentProps.datasource.uniqueKey;
979
- searchJoin[column.name] = searchData.map((row) => row[lookupId]);
980
- });
981
- await Promise.all(promises);
982
- }
983
- return searchJoin;
984
- }
985
- }
986
-
987
- class DynamicFilterDatasourceFactory {
988
- factory(options) {
989
- return DatasourceFactory.factory({
990
- data: this.getFilterOptionsData(options),
991
- loadAll: true,
992
- translate: ['text'],
993
- });
994
- }
995
- getFilterOptionsData(options) {
996
- const optionsKeys = Object.keys(options);
997
- return optionsKeys.map((item) => ({
998
- text: `TEKGRID_${item}`,
999
- value: item,
1000
- }));
1001
- }
1002
- }
1003
-
1004
- class TekFilterHelper {
1005
- static getLabel(name) {
1006
- return DateHelper.getLabel(name);
1007
- }
1008
- static getValue(name, column) {
1009
- return DateHelper.getValue(name, column.componentProps.dateFormat);
1010
- }
1011
- static register(name, label, fn) {
1012
- DateHelper.register(name, label, fn);
1013
- }
1014
- static unregister(name) {
1015
- DateHelper.unregister(name);
1016
- }
1017
- }
1018
-
1019
- /**
1020
- * Base class for TekGrid column
1021
- */
1022
- class TekGridColumn extends GridColumnEditable {
1023
- /* filter component props */
1024
- filterProps = [];
1025
- /* column can be use to filter */
1026
- filterable = true;
1027
- /* Index of the column inside filter modal */
1028
- filterIndex;
1029
- /* should not consider lookup column on search */
1030
- skipLookupSearch = false;
1031
- /* column is grouped */
1032
- groupedValue = false;
1033
- /* column group is opened */
1034
- groupOpenedValue = false;
1035
- /* Value to show when grouped value is empty */
1036
- groupLabelForEmptyValue = '';
1037
- /* column has aggregation */
1038
- aggregationValue;
1039
- /* column is visible */
1040
- isVisibleValue = true;
1041
- /**
1042
- * Defines if the column should store the componentProps datasource.data in memory
1043
- */
1044
- storeData = true;
1045
- grid;
1046
- /* istanbul ignore next */
1047
- /**
1048
- * Creates a new TekGrid Column.
1049
- * @param props TekGrid column properties
1050
- */
1051
- constructor(props, grid) {
1052
- super(props);
1053
- this.grid = grid;
1054
- this.isVisible = this.getInitValue('isVisible', props.isVisible, this.isVisible);
1055
- this.filterProps = this.getInitValue('filterProps', props.filterProps, this.filterProps);
1056
- this.filterable = this.getInitValue('filterable', props.filterable, this.filterable);
1057
- this.filterIndex = this.getInitValue('filterIndex', props.filterIndex, this.filterIndex);
1058
- this.skipLookupSearch = this.getInitValue('skipLookupSearch', props.skipLookupSearch, this.skipLookupSearch);
1059
- this.grouped = this.getInitValue('grouped', props.grouped, this.grouped);
1060
- this.groupOpened = this.getInitValue('groupOpened', props.groupOpened, this.groupOpened);
1061
- this.aggregation = this.getInitValue('aggregation', props.aggregation, this.aggregation);
1062
- this.groupLabelForEmptyValue = this.getInitValue('groupLabelForEmptyValue', props.groupLabelForEmptyValue, this.groupLabelForEmptyValue);
1063
- this.storeData = this.getInitValue('storeData', props.storeData, this.storeData);
1064
- this.createAccessors();
1065
- }
1066
- async getBatchLookupData(lookupColumn, values) {
1067
- const batch = [];
1068
- const dataToLookup = [];
1069
- values.forEach((value) => {
1070
- if (this.lookupData[value]) {
1071
- batch.push(this.lookupData[value]);
1072
- return;
1073
- }
1074
- const dataIndex = this.lookupDatasource.data.findIndex((row) => row[lookupColumn] === value);
1075
- if (dataIndex !== -1) {
1076
- this.lookupData[value] = this.lookupDatasource.data[dataIndex];
1077
- batch.push(this.lookupData[value]);
1078
- return;
1079
- }
1080
- dataToLookup.push(value);
1081
- });
1082
- if (dataToLookup.length > 0) {
1083
- await this.lookupFn(lookupColumn, dataToLookup);
1084
- dataToLookup.forEach((value) => {
1085
- const row = this.lookupData[value];
1086
- if (row)
1087
- batch.push(row);
1088
- });
1089
- }
1090
- return batch;
1091
- }
1092
- /**
1093
- * Memory search, without changing lookupDatasource
1094
- */
1095
- async memorySearch(search) {
1096
- if (!this.lookupDatasource) {
1097
- throw new Error("Can't search in a column that doesn't have a datasource");
1098
- }
1099
- let { data } = this.lookupDatasource;
1100
- if (this.storeData) {
1101
- if (!data.length) {
1102
- data = await this.lookupDatasource.get();
1103
- }
1104
- }
1105
- else {
1106
- // datasource without the lookup filters
1107
- const defaultDs = DatasourceFactory.factory({
1108
- ...this.componentProps.datasource,
1109
- lazyLoad: true,
1110
- loadAll: true,
1111
- });
1112
- defaultDs.initialize();
1113
- data = await defaultDs.get();
1114
- }
1115
- const { dataText } = this.componentProps;
1116
- const searchIn = Array.isArray(dataText) ? dataText : [dataText];
1117
- // get datasource as memory
1118
- const datasource = DatasourceFactory.factory({
1119
- searchIn,
1120
- data,
1121
- type: 'memory',
1122
- loadAll: true,
1123
- });
1124
- datasource.initialize();
1125
- return datasource.setSearch(search);
1126
- }
1127
- get grouped() {
1128
- return this.groupedValue;
1129
- }
1130
- set grouped(value) {
1131
- const changed = value !== this.groupedValue;
1132
- this.groupedValue = value;
1133
- if (changed) {
1134
- this.changeGrouping();
1135
- }
1136
- }
1137
- get aggregation() {
1138
- return this.aggregationValue;
1139
- }
1140
- set aggregation(value) {
1141
- const changed = value !== this.aggregationValue;
1142
- this.aggregationValue = value;
1143
- if (changed) {
1144
- this.changeGrouping();
1145
- }
1146
- }
1147
- get groupOpened() {
1148
- return this.groupOpenedValue;
1149
- }
1150
- set groupOpened(value) {
1151
- const changed = value !== this.groupOpenedValue;
1152
- this.groupOpenedValue = value;
1153
- if (changed) {
1154
- this.changeGrouping();
1155
- }
1156
- }
1157
- /* istanbul ignore next */
1158
- // @ts-expect-error
1159
- get isVisible() {
1160
- return this.isVisibleValue && !this.grouped;
1161
- }
1162
- /* istanbul ignore next */
1163
- set isVisible(value) {
1164
- this.isVisibleValue = value;
1165
- }
1166
- changeGrouping() {
1167
- // wait for grid.constructor to be fully executed
1168
- setTimeout(() => {
1169
- this.grid.updateGrouping();
1170
- });
1171
- }
1172
- }
1173
-
1174
- /**
1175
- * Base class for TekGrid Filter Button component
1176
- */
1177
- class TekGridFilterButton extends Button {
1178
- gridName;
1179
- grid;
1180
- showCheckboxAll = false;
1181
- filterModal;
1182
- filterFormInputs = {};
1183
- constructor(props) {
1184
- super(props);
1185
- this.gridName = this.getInitValue('gridName', props.gridName, this.gridName);
1186
- this.grid = this.getInitValue('grid', props.grid, undefined);
1187
- this.showCheckboxAll = this.getInitValue('showCheckboxAll', props.showCheckboxAll, this.showCheckboxAll);
1188
- this.createAccessors();
1189
- if (!this.grid)
1190
- this.loadGrid();
1191
- }
1192
- loadGrid(gridName) {
1193
- if (gridName)
1194
- this.gridName = gridName;
1195
- if (!this.gridName)
1196
- return;
1197
- this.grid = Metadata.getInstances(this.gridName)[0];
1198
- }
1199
- click(event) {
1200
- this.callEvent('click', { component: this, event });
1201
- this.grid.callEvent('filterClick', { component: this.grid, event });
1202
- if (!event?.defaultPrevented) {
1203
- this.createFilterFromColumns.call(this);
1204
- }
1205
- }
1206
- loadFilterValues({ component }) {
1207
- const changedCompNames = [];
1208
- const { datasource } = this.grid;
1209
- if (datasource instanceof TekRestDatasource || datasource instanceof TekMemoryDatasource) {
1210
- const { dynamicFilter } = datasource;
1211
- const newDynamicFilter = { ...this.grid.defaultFilter, ...dynamicFilter };
1212
- Object.keys(newDynamicFilter).forEach((column) => {
1213
- if (newDynamicFilter[column] && newDynamicFilter[column].length > 0) {
1214
- newDynamicFilter[column].forEach((filterItem, index) => {
1215
- const relation = filterItem.relation || 'AND';
1216
- const operation = filterItem.operation || 'CONTAINS';
1217
- const compName = `${this.grid.name}-filter-${relation}-${operation}-${column}-${index}`;
1218
- changedCompNames.push(compName);
1219
- component.value[compName] = filterItem.value;
1220
- let helperValue = '';
1221
- const columnObj = this.grid.getColumn(column);
1222
- if (columnObj instanceof TekGridColumn) {
1223
- const { filterProps } = columnObj;
1224
- if (!Array.isArray(filterProps)) {
1225
- helperValue = filterProps.helperValue || '';
1226
- }
1227
- else {
1228
- filterProps.forEach((prop) => {
1229
- if ((prop.relation || 'AND') === relation && (prop.operation || 'CONTAINS') === operation) {
1230
- helperValue = prop.helperValue || '';
1231
- }
1232
- });
1233
- }
1234
- const inputObj = Metadata.getInstances(compName);
1235
- if (helperValue && inputObj.length && inputObj[0]) {
1236
- inputObj[0].hint = TekFilterHelper.getLabel(helperValue);
1237
- }
1238
- }
1239
- });
1240
- }
1241
- });
1242
- }
1243
- else {
1244
- const { filter } = datasource;
1245
- const newFilter = { ...this.grid.defaultFilter, ...filter };
1246
- Object.keys(newFilter).forEach((item) => {
1247
- if (newFilter[item]) {
1248
- const compName = `${this.grid.name}-filter-AND-CONTAINS-${item}-0`;
1249
- changedCompNames.push(compName);
1250
- component.value[compName] = newFilter[item];
1251
- }
1252
- });
1253
- }
1254
- Object.keys(component.value).forEach((compName) => {
1255
- if (changedCompNames.indexOf(compName) === -1) {
1256
- component.value[compName] = null;
1257
- }
1258
- });
1259
- }
1260
- hideFilterModal() {
1261
- this.filterModal.hide();
1262
- }
1263
- destroyFilterModal() {
1264
- if (this.filterModal)
1265
- this.filterModal.destroy();
1266
- }
1267
- createFilterFromColumns() {
1268
- if (!this.filterModal) {
1269
- const originalProps = {
1270
- height: 'auto',
1271
- maxHeight: '18.75rem',
1272
- persistent: true,
1273
- title: 'FILTER',
1274
- };
1275
- const mergeModalFilterProps = Object.assign(originalProps, this.grid.modalFilterProps);
1276
- const filterModalDef = {
1277
- name: `${this.grid.name}-filter-modal`,
1278
- persistent: mergeModalFilterProps.persistent,
1279
- grid: mergeModalFilterProps.grid,
1280
- cssClass: mergeModalFilterProps.cssClass,
1281
- cssStyle: mergeModalFilterProps.cssStyle,
1282
- draggable: mergeModalFilterProps.draggable,
1283
- dragHandle: mergeModalFilterProps.dragHandle,
1284
- fullscreen: mergeModalFilterProps.fullscreen,
1285
- light: mergeModalFilterProps.light,
1286
- dark: mergeModalFilterProps.dark,
1287
- escKeydownStop: false,
1288
- children: [
1289
- {
1290
- name: `${this.grid.name}-filter-header-container`,
1291
- component: 'ZdContainer',
1292
- cssClass: 'zd-pa-0 zd-display-flex',
1293
- children: [
1294
- {
1295
- name: `${this.grid.name}-filter-title`,
1296
- component: 'ZdText',
1297
- cssStyle: `color: ${'var(--v-primary-base);'}`,
1298
- text: mergeModalFilterProps.title,
1299
- tag: 'h3',
1300
- },
1301
- {
1302
- name: `${this.grid.name}-filter-spacer`,
1303
- component: 'VSpacer',
1304
- },
1305
- {
1306
- name: `${this.grid.name}-filter-close-button`,
1307
- component: 'ZdModalCloseButton',
1308
- small: true,
1309
- modalName: `${this.grid.name}-filter-modal`,
1310
- },
1311
- ],
1312
- },
1313
- {
1314
- name: `${this.grid.name}-filter-content-container`,
1315
- component: 'ZdContainer',
1316
- scrollView: true,
1317
- cssClass: 'zd-my-2 zd-pa-0 tek-grid-filter-content-container',
1318
- maxHeight: mergeModalFilterProps.maxHeight,
1319
- height: mergeModalFilterProps.height,
1320
- children: [
1321
- {
1322
- name: `${this.grid.name}-filter-form`,
1323
- component: 'ZdForm',
1324
- cssClass: 'zd-my-2 zd-pa-0',
1325
- children: this.getFilterModalComponents(),
1326
- events: {
1327
- onMounted: this.loadFilterValues.bind(this),
1328
- },
1329
- },
1330
- ],
1331
- },
1332
- {
1333
- name: `${this.grid.name}-filter-footer-container`,
1334
- component: 'ZdContainer',
1335
- cssClass: 'zd-pa-0',
1336
- children: [
1337
- {
1338
- name: `${this.grid.name}-filter-footer`,
1339
- component: 'ZdFooter',
1340
- color: 'transparent',
1341
- padless: true,
1342
- leftSlot: [
1343
- {
1344
- name: `${this.grid.name}-filter-clearButton`,
1345
- component: 'ZdButton',
1346
- label: 'CLEAR',
1347
- outline: true,
1348
- events: {
1349
- click: this.clearFilter.bind(this),
1350
- },
1351
- },
1352
- ],
1353
- rightSlot: [
1354
- {
1355
- name: `${this.grid.name}-filter-cancelButton`,
1356
- component: 'ZdButton',
1357
- label: 'CANCEL',
1358
- keyMap: {
1359
- esc: {
1360
- event: this.hideFilterModal.bind(this),
1361
- focus: true,
1362
- visible: true,
1363
- input: true,
1364
- stop: true,
1365
- },
1366
- },
1367
- outline: true,
1368
- events: {
1369
- click: this.hideFilterModal.bind(this),
1370
- },
1371
- },
1372
- {
1373
- name: `${this.grid.name}-filter-okButton`,
1374
- component: 'ZdButton',
1375
- label: 'OK',
1376
- events: {
1377
- click: this.applyFilter.bind(this),
1378
- },
1379
- keyMap: {
1380
- 'mod+enter': {
1381
- event: this.applyFilter.bind(this),
1382
- focus: true,
1383
- input: true,
1384
- stop: true,
1385
- visible: true,
1386
- },
1387
- },
1388
- },
1389
- ],
1390
- },
1391
- ],
1392
- },
1393
- ],
1394
- };
1395
- this.filterModal = ModalService.create(filterModalDef);
1396
- }
1397
- else {
1398
- this.loadFilterValues({ component: Metadata.getInstance(`${this.grid.name}-filter-form`) });
1399
- }
1400
- this.filterModal.show();
1401
- }
1402
- onBeforeDestroy() {
1403
- super.onBeforeDestroy();
1404
- this.destroyFilterModal();
1405
- }
1406
- formatFormValue(filterForm) {
1407
- // TODO: add this logic when SelectMultiple is implemented
1408
- // return Object.keys(filterForm.value).reduce((result, item) => {
1409
- // try {
1410
- // const itemInstance = filterForm.getChildInstance<Input>(item);
1411
- // if (!(itemInstance instanceof SelectMultiple) || !itemInstance.checkboxAll) return result;
1412
- // // when selectmultiple with checkboxAll, should either remove it from the filter or
1413
- // // change the value to T, depending on selectAllCompatibilityMode
1414
- // if ((Config as ITekConfig).selectAllCompatibilityMode) {
1415
- // result[item] = 'T';
1416
- // return result;
1417
- // }
1418
- // delete result[item];
1419
- // return result;
1420
- // } catch (e) {
1421
- // return result;
1422
- // }
1423
- // }, { ...filterForm.value });
1424
- return filterForm.value;
1425
- }
1426
- async applyFilter({ event }) {
1427
- const filterForm = Metadata.getInstance(`${this.grid.name}-filter-form`);
1428
- const isFormValid = await filterForm.validate();
1429
- if (isFormValid.valid) {
1430
- const { datasource } = this.grid;
1431
- const filter = {};
1432
- const formValue = this.formatFormValue(filterForm);
1433
- if (datasource instanceof TekRestDatasource || datasource instanceof TekMemoryDatasource) {
1434
- Object.keys(formValue).forEach((item) => {
1435
- const itemValue = formValue[item];
1436
- if (itemValue && !(Array.isArray(itemValue) && !itemValue.length)) {
1437
- const relationAndOperationAndName = item.split(`${this.grid.name}-filter-`)[1];
1438
- const [relation, operation] = relationAndOperationAndName.split('-');
1439
- let columnName = relationAndOperationAndName.split(`${relation}-${operation}-`)[1];
1440
- columnName = columnName.split('-').slice(0, -1).join('-'); // remove index
1441
- if (!filter[columnName]) {
1442
- filter[columnName] = [];
1443
- }
1444
- const value = itemValue;
1445
- filter[columnName].push({
1446
- relation,
1447
- operation,
1448
- value,
1449
- });
1450
- }
1451
- });
1452
- datasource.dynamicFilter = filter;
1453
- this.setFilter(filter, event, datasource.setDynamicFilter.bind(datasource));
1454
- }
1455
- else {
1456
- Object.keys(formValue).forEach((item) => {
1457
- let columnName = item.split(`${this.grid.name}-filter-AND-CONTAINS-`)[1];
1458
- columnName = columnName.split('-').slice(0, -1).join('-'); // remove index
1459
- const itemValue = formValue[item];
1460
- if (itemValue && !(Array.isArray(itemValue) && !itemValue.length)) {
1461
- filter[columnName] = itemValue;
1462
- }
1463
- });
1464
- datasource.filter = filter;
1465
- this.setFilter(filter, event, datasource.setFilter.bind(datasource));
1466
- }
1467
- this.grid.changeLayout(event);
1468
- }
1469
- }
1470
- setFilter(filter, event, filterFn) {
1471
- this.grid.callEvent('beforeApplyFilter', { component: this.grid, event });
1472
- if (event.defaultPrevented)
1473
- return;
1474
- filterFn(filter);
1475
- this.hideFilterModal();
1476
- }
1477
- clearFilter() {
1478
- const filterForm = Metadata.getInstance(`${this.grid.name}-filter-form`);
1479
- Object.keys(filterForm.value).forEach((item) => {
1480
- filterForm.value[item] = null;
1481
- });
1482
- }
1483
- sortFilterIndex(col1, col2) {
1484
- const index1 = col1.filterIndex !== undefined ? col1.filterIndex : Number.MAX_SAFE_INTEGER;
1485
- const index2 = col2.filterIndex !== undefined ? col2.filterIndex : Number.MAX_SAFE_INTEGER;
1486
- return index1 - index2;
1487
- }
1488
- getFilterModalComponents() {
1489
- const filterColumns = [];
1490
- let columnComponentName;
1491
- [...this.grid.columns].sort(this.sortFilterIndex).forEach((column) => {
1492
- const filterProps = Array.isArray(column.filterProps) ? column.filterProps : [column.filterProps];
1493
- if (column.filterable && filterProps && filterProps.length > 0) {
1494
- this.filterFormInputs[column.name] = [];
1495
- filterProps.forEach((filterItem, index) => {
1496
- const { datasource } = this.grid;
1497
- if (datasource instanceof TekRestDatasource || datasource instanceof TekMemoryDatasource) {
1498
- const relation = filterItem.relation || 'AND';
1499
- const operation = filterItem.operation || 'CONTAINS';
1500
- columnComponentName = `${this.grid.name}-filter-${relation}-${operation}-${column.name}-${index}`;
1501
- }
1502
- else {
1503
- columnComponentName = `${this.grid.name}-filter-AND-CONTAINS-${column.name}-${index}`;
1504
- }
1505
- this.filterFormInputs[column.name].push(columnComponentName);
1506
- const { dataValueOut, ...componentProps } = column.componentProps || {};
1507
- const newColumnComponent = {
1508
- label: column.label,
1509
- ...componentProps,
1510
- ...filterItem,
1511
- name: columnComponentName,
1512
- };
1513
- if (filterItem.helperOptions) {
1514
- if (!newColumnComponent.events)
1515
- newColumnComponent.events = {};
1516
- newColumnComponent.events.change = this.changeHelperEvent.bind(this, column);
1517
- }
1518
- if (newColumnComponent.component === 'ZdSelectMultiple') {
1519
- newColumnComponent.showCheckboxAll = newColumnComponent.showCheckboxAll ?? this.showCheckboxAll;
1520
- }
1521
- filterColumns.push(newColumnComponent);
1522
- });
1523
- }
1524
- });
1525
- return filterColumns;
1526
- }
1527
- changeHelperEvent(column, { component }) {
1528
- const { helperValue } = component;
1529
- const componentName = component.name;
1530
- if (!Array.isArray(column.filterProps)) {
1531
- column.filterProps.helperValue = helperValue;
1532
- }
1533
- else {
1534
- column.filterProps.forEach((prop) => {
1535
- const relationAndOperationAndName = componentName.split(`${this.grid.name}-filter-`)[1];
1536
- const [relation, operation] = relationAndOperationAndName.split('-');
1537
- if ((prop.relation || 'AND') === relation && (prop.operation || 'CONTAINS') === operation) {
1538
- prop.helperValue = helperValue;
1539
- }
1540
- });
1541
- }
1542
- }
1543
- }
1544
-
1545
- const isFilledObject = (obj) => {
1546
- return !!obj && typeof obj === 'object' && !Array.isArray(obj) && !!Object.keys(obj).length;
1547
- };
1548
-
1549
- function isNil(value) {
1550
- return value === null || value === undefined;
1551
- }
1552
-
1553
- class GroupedDataManager {
1554
- grid;
1555
- summaryColumns = [];
1556
- groups = [];
1557
- summary = {};
1558
- groupedData = [];
1559
- groupColumnNames = [];
1560
- groupColumns = [];
1561
- originalDatasourceLoadAll;
1562
- originalDatasourceLimit;
1563
- viewUpdateScrollData;
1564
- viewUpdateFixedColumns;
1565
- constructor(grid) {
1566
- this.grid = grid;
1567
- }
1568
- setViewUpdateFixedColumns(fn) {
1569
- this.viewUpdateFixedColumns = fn;
1570
- }
1571
- setViewUpdateScrollData(fn) {
1572
- this.viewUpdateScrollData = fn;
1573
- }
1574
- /**
1575
- * Tasks that should be finished before loading the grid data
1576
- */
1577
- tasksBeforeLoad = [];
1578
- registerTask(task) {
1579
- this.tasksBeforeLoad.push(task);
1580
- }
1581
- request = () => {
1582
- throw new NonInitializedError(this.constructor.name);
1583
- };
1584
- debounceUpdateGrouping = () => {
1585
- throw new NonInitializedError(this.constructor.name);
1586
- };
1587
- /**
1588
- * Loads grid data after resolving all tasks
1589
- */
1590
- async loadAfterTasks() {
1591
- Promise.all(this.tasksBeforeLoad.map((promise) => promise.catch(() => undefined)));
1592
- this.tasksBeforeLoad = [];
1593
- return this.request();
1594
- }
1595
- initializeDebounceFunctions() {
1596
- this.request = debounce(() => {
1597
- this.grid.reload();
1598
- }, 500);
1599
- this.debounceUpdateGrouping = debounce((lazyLoad = false) => {
1600
- this.updateGroupedData(lazyLoad);
1601
- }, 100);
1602
- }
1603
- /**
1604
- * Initializes grid groups, summary columns and registers the grid datasource callback
1605
- * @param lazyLoad defines if the grid should automatically load data after updating the datasource
1606
- */
1607
- initializeGrouping(lazyLoad) {
1608
- this.initializeDebounceFunctions();
1609
- this.initGroups();
1610
- this.initSummaryColumns();
1611
- this.originalDatasourceLoadAll = this.grid.datasource.loadAll;
1612
- this.originalDatasourceLimit = this.grid.datasource.limit;
1613
- this.grid.datasource.registerGetCallback((data) => this.onGet(data));
1614
- this.updateGrouping(lazyLoad);
1615
- }
1616
- onGet(data) {
1617
- if (this.isGrouped()) {
1618
- this.buildGroupedData();
1619
- }
1620
- return data;
1621
- }
1622
- resetFooterVariables(group) {
1623
- this.summaryColumns.forEach((column) => {
1624
- group.footer[column.name] = {
1625
- count: 0,
1626
- sum: undefined,
1627
- avg: undefined,
1628
- min: undefined,
1629
- max: undefined,
1630
- };
1631
- });
1632
- }
1633
- initGroups() {
1634
- this.groups = [];
1635
- this.groupColumns.forEach((column) => {
1636
- const newGroup = {
1637
- column,
1638
- name: column.name,
1639
- label: column.label,
1640
- lastValue: undefined,
1641
- initialized: false,
1642
- footer: {},
1643
- };
1644
- this.resetFooterVariables(newGroup);
1645
- this.groups.push(newGroup);
1646
- });
1647
- }
1648
- getGroupedData() {
1649
- return this.groupedData;
1650
- }
1651
- initSummaryColumns() {
1652
- this.summaryColumns = this.grid.columns.filter((column) => !!column.aggregation && !column.grouped);
1653
- this.summary = {};
1654
- }
1655
- /**
1656
- * Calls updateGroupedData with debounce
1657
- */
1658
- updateGrouping(lazyLoad) {
1659
- this.debounceUpdateGrouping(lazyLoad);
1660
- }
1661
- /**
1662
- * Inits summary columns, updates the grid datasource and, if needed, reloads the grid data
1663
- */
1664
- async updateGroupedData(lazyLoad) {
1665
- this.initSummaryColumns();
1666
- this.updateGridDatasource();
1667
- if (!lazyLoad) {
1668
- await this.loadAfterTasks();
1669
- }
1670
- if (this.grid.virtualScroll && this.viewUpdateScrollData) {
1671
- this.viewUpdateScrollData();
1672
- }
1673
- if (this.viewUpdateFixedColumns) {
1674
- this.viewUpdateFixedColumns();
1675
- }
1676
- }
1677
- /**
1678
- * When using groups, should update the grid datasource order to reflect the group order
1679
- * If the grid is not grouped, should not update the datasource order
1680
- */
1681
- updateGridDatasource() {
1682
- this.groupedData = [];
1683
- this.groupColumns = this.grid.columns.filter((column) => column.grouped);
1684
- this.groupColumnNames = this.groupColumns.map((column) => column.name);
1685
- if (this.isGrouped()) {
1686
- if (this.groupColumns.length) {
1687
- const order = this.getOrder(this.groupColumnNames, this.grid.datasource.order);
1688
- this.grid.datasource.order = order;
1689
- }
1690
- this.grid.datasource.loadAll = true;
1691
- return;
1692
- }
1693
- this.grid.datasource.loadAll = this.originalDatasourceLoadAll;
1694
- this.grid.datasource.limit = this.originalDatasourceLimit;
1695
- }
1696
- /**
1697
- * Returns the order to be used in the grid datasource based on the group column names and the grid order
1698
- */
1699
- getOrder(groupColumnNames, gridOrder) {
1700
- const groupOrderColumns = groupColumnNames.map((column) => `${column}.asc`);
1701
- const otherOrderColumns = gridOrder.filter((column) => groupColumnNames.indexOf(column.split('.')[0]) === -1);
1702
- return [...groupOrderColumns, ...otherOrderColumns];
1703
- }
1704
- /**
1705
- * Returns the summary data for the group
1706
- */
1707
- getSummaryData(group) {
1708
- const summaryData = {};
1709
- this.summaryColumns.forEach((column) => {
1710
- const { aggregation } = column;
1711
- const currentGroup = group[column.name];
1712
- if (!currentGroup) {
1713
- summaryData[column.name] = 0;
1714
- return;
1715
- }
1716
- if (aggregation === 'COUNT') {
1717
- summaryData[column.name] = currentGroup.count;
1718
- }
1719
- else if (aggregation === 'SUM') {
1720
- summaryData[column.name] = currentGroup.sum;
1721
- }
1722
- else if (aggregation === 'AVG') {
1723
- if (currentGroup.avg) {
1724
- summaryData[column.name] = currentGroup.avg;
1725
- }
1726
- else if (typeof currentGroup.sum === 'number') {
1727
- summaryData[column.name] = currentGroup.sum / currentGroup.count;
1728
- }
1729
- }
1730
- else if (aggregation === 'MIN') {
1731
- summaryData[column.name] = currentGroup.min;
1732
- }
1733
- else {
1734
- // if (aggregation === 'MAX') {
1735
- summaryData[column.name] = currentGroup.max;
1736
- }
1737
- });
1738
- return summaryData;
1739
- }
1740
- /**
1741
- * Adds group footers to the grouped data
1742
- */
1743
- addGroupFooters(groupIndex) {
1744
- if (this.summaryColumns.length === 0) {
1745
- return;
1746
- }
1747
- for (let i = this.groups.length - 1; i >= groupIndex; i -= 1) {
1748
- if (this.groups[i].initialized) {
1749
- const groupFooterRow = {
1750
- groupFooter: true,
1751
- groupIndex: i,
1752
- groupHeaders: [],
1753
- groupLabel: this.groups[i].lastGroupHeaderRow.groupLabel,
1754
- groupValue: this.groups[i].lastGroupHeaderRow.groupValue,
1755
- ...this.getSummaryData(this.groups[i].footer),
1756
- };
1757
- // add header for outer groups
1758
- for (let g = 0; g < i; g += 1) {
1759
- const { lastGroupHeaderRow } = this.groups[g];
1760
- if (lastGroupHeaderRow) {
1761
- groupFooterRow.groupHeaders.push(lastGroupHeaderRow);
1762
- }
1763
- }
1764
- this.groupedData.push(groupFooterRow);
1765
- }
1766
- }
1767
- }
1768
- getGroupValue(group, row) {
1769
- const groupColumn = this.grid.getColumn(group.column.name);
1770
- const cellsApplied = this.grid.getAppliedConditions({ row, column: groupColumn });
1771
- if (!isFilledObject(cellsApplied)) {
1772
- this.grid.reapplyConditions(row);
1773
- }
1774
- const groupValue = groupColumn.formatterByRow(row, cellsApplied);
1775
- return groupValue;
1776
- }
1777
- addGroupHeader(row, group, index) {
1778
- const groupValue = this.getGroupValue(group, row) || group.column.groupLabelForEmptyValue;
1779
- const groupHeaderRow = {
1780
- group: true,
1781
- groupRow: row,
1782
- groupColumnName: group.column.name,
1783
- groupHeader: true,
1784
- groupIndex: index,
1785
- groupLabel: I18n.translate(group.label),
1786
- groupValue,
1787
- groupOpened: group.column.groupOpened || this.grid.groupsOpened,
1788
- groupHeaders: [],
1789
- children: [],
1790
- };
1791
- // add header for outer groups to the added row
1792
- for (let i = 0; i < index; i += 1) {
1793
- groupHeaderRow.groupHeaders.push(this.groups[i].lastGroupHeaderRow);
1794
- }
1795
- group.lastGroupHeaderRow = groupHeaderRow;
1796
- group.initialized = true;
1797
- this.groupedData.push(groupHeaderRow);
1798
- }
1799
- calcSummaryValues(column, summary, row) {
1800
- const rowValue = row[column.name];
1801
- if (isNil(rowValue))
1802
- return;
1803
- summary.count += 1;
1804
- if (this.grid.events.calcSummary) {
1805
- this.grid.calcSummary(column, summary, row);
1806
- return;
1807
- }
1808
- if (summary.min === undefined)
1809
- summary.min = rowValue;
1810
- if (summary.max === undefined)
1811
- summary.max = rowValue;
1812
- summary.min = rowValue < summary.min ? rowValue : summary.min;
1813
- summary.max = rowValue > summary.max ? rowValue : summary.max;
1814
- if (typeof rowValue === 'number') {
1815
- summary.sum = (summary.sum || 0) + rowValue;
1816
- }
1817
- }
1818
- calcSummary(row) {
1819
- if (this.summaryColumns.length === 0)
1820
- return;
1821
- this.summaryColumns.forEach((column) => {
1822
- const columnName = column.name;
1823
- if (isNil(this.summary[columnName])) {
1824
- this.summary[columnName] = {
1825
- count: 0,
1826
- sum: undefined,
1827
- avg: undefined,
1828
- min: undefined,
1829
- max: undefined,
1830
- };
1831
- }
1832
- this.calcSummaryValues(column, this.summary[columnName], row);
1833
- this.groups.forEach((group) => {
1834
- this.calcSummaryValues(column, group.footer[columnName], row);
1835
- });
1836
- });
1837
- }
1838
- addSummary() {
1839
- if (this.summaryColumns.length === 0)
1840
- return;
1841
- const summaryRow = {
1842
- groupFooter: true,
1843
- groupSummary: true,
1844
- ...this.getSummaryData(this.summary),
1845
- };
1846
- this.groupedData.push(summaryRow);
1847
- }
1848
- /**
1849
- * It takes a flat array of data and groups it by the group columns specified in
1850
- * the grid.
1851
- */
1852
- buildGroupedData() {
1853
- this.initGroups();
1854
- this.initSummaryColumns();
1855
- this.groupedData = [];
1856
- const data = this.grid.getData();
1857
- data.forEach((row) => {
1858
- let groupBreak = false;
1859
- this.groups.forEach((group, index) => {
1860
- const groupValue = row[group.name];
1861
- if (group.lastValue !== groupValue || groupBreak) {
1862
- if (!groupBreak) {
1863
- this.addGroupFooters(index);
1864
- }
1865
- group.lastValue = groupValue;
1866
- this.resetFooterVariables(group);
1867
- this.addGroupHeader(row, group, index);
1868
- groupBreak = true;
1869
- }
1870
- });
1871
- this.groups.forEach((group) => {
1872
- group.lastGroupHeaderRow.children.push(row);
1873
- });
1874
- this.groupedData.push({
1875
- ...row,
1876
- groupHeaders: this.groups.map((group) => group.lastGroupHeaderRow).filter(Boolean),
1877
- });
1878
- this.calcSummary(row);
1879
- });
1880
- if (this.groupedData.length > 0) {
1881
- this.addGroupFooters(0);
1882
- if (this.grid.showSummaryTotal) {
1883
- this.addSummary();
1884
- }
1885
- }
1886
- }
1887
- openGroup(group) {
1888
- group.groupOpened = !group.groupOpened;
1889
- if (this.grid.virtualScroll && this.viewUpdateScrollData)
1890
- this.viewUpdateScrollData();
1891
- }
1892
- isItemVisible(row) {
1893
- return !row.groupHeaders || !row.groupHeaders.length || row.groupHeaders.every((group) => group.groupOpened);
1894
- }
1895
- isGrouped() {
1896
- return !!this.groupColumnNames.length || (this.grid.showSummaryTotal && !!this.summaryColumns.length);
1897
- }
1898
- isColumnSearchable(column) {
1899
- return !this.grid.searchVisibleOnly || column.isVisible || column.grouped;
1900
- }
1901
- directionalLeft() {
1902
- const { currentRow } = this.grid.datasource;
1903
- if (currentRow.group && currentRow.groupOpened) {
1904
- currentRow.groupOpened = false;
1905
- return;
1906
- }
1907
- if (this.grid.cellSelection || !currentRow.groupHeaders?.length)
1908
- return;
1909
- const newCurrentRow = currentRow.groupHeaders[currentRow.groupHeaders.length - 1];
1910
- this.grid.setCurrentRow(newCurrentRow);
1911
- }
1912
- directionalRight() {
1913
- const { currentRow } = this.grid.datasource;
1914
- if (!currentRow.group || currentRow.groupOpened)
1915
- return;
1916
- currentRow.groupOpened = true;
1917
- }
1918
- }
1919
-
1920
- class GroupedDataNavigator {
1921
- dataNavigator;
1922
- grid;
1923
- constructor(grid) {
1924
- this.dataNavigator = new DataNavigator(grid);
1925
- this.grid = grid;
1926
- }
1927
- navigatePageUp() {
1928
- this.dataNavigator.navigatePageUp();
1929
- }
1930
- navigatePageDown() {
1931
- this.dataNavigator.navigatePageDown();
1932
- }
1933
- navigateDatasource(direction) {
1934
- if (!this.grid.isGrouped()) {
1935
- this.dataNavigator.navigateDatasource(direction);
1936
- return;
1937
- }
1938
- this.navigateGroupedDatasource(direction);
1939
- }
1940
- getRowIndex(groupedData, index) {
1941
- if (index !== undefined)
1942
- return index;
1943
- const { currentRow } = this.grid.datasource;
1944
- return groupedData.findIndex((row) => {
1945
- if (currentRow.group) {
1946
- return row.group && row.groupValue === currentRow.groupValue;
1947
- }
1948
- const rowKey = this.grid.getRowKey(row);
1949
- const currentRowKey = this.grid.getRowKey(currentRow);
1950
- return rowKey && rowKey === currentRowKey;
1951
- });
1952
- }
1953
- navigateGroupedDatasource(direction, index) {
1954
- const groupedData = this.grid.getGroupedData();
1955
- const up = direction === 'up';
1956
- if (!groupedData.length || (up && index === -1) || (!up && index === groupedData.length))
1957
- return;
1958
- let rowIndex = this.getRowIndex(groupedData, index);
1959
- if (up && rowIndex === -1)
1960
- rowIndex = groupedData.length;
1961
- const nextIndex = rowIndex + (up ? -1 : 1);
1962
- const newRow = groupedData[nextIndex];
1963
- if (!newRow || !this.grid.isItemVisible(newRow) || newRow.groupFooter) {
1964
- this.navigateGroupedDatasource(direction, nextIndex);
1965
- return;
1966
- }
1967
- this.grid.setCurrentRow(newRow);
1968
- }
1969
- }
1970
-
1971
- const tuple = (...args) => args;
1972
- const columnAggregationValues = tuple('SUM', 'MIN', 'MAX', 'AVG', 'COUNT', undefined);
1973
-
1974
- class KeyMapGrouped {
1975
- getMap(instance) {
1976
- return {
1977
- left: {
1978
- event: instance.directionalLeft.bind(instance),
1979
- stop: true,
1980
- active: true,
1981
- },
1982
- right: {
1983
- event: instance.directionalRight.bind(instance),
1984
- stop: true,
1985
- active: true,
1986
- },
1987
- };
1988
- }
1989
- }
1990
-
1991
- class TekGridController {
1992
- grid;
1993
- openToolbar = true;
1994
- constructor(grid) {
1995
- this.grid = grid;
1996
- this.openToolbar = this.grid.toolbarOpened;
1997
- }
1998
- get gridTitle() {
1999
- return this.grid.title;
2000
- }
2001
- get showAddButton() {
2002
- return this.grid.addButton;
2003
- }
2004
- get showDeleteButton() {
2005
- return this.grid.deleteButton !== 'none';
2006
- }
2007
- get showFilterButton() {
2008
- return this.grid.filterButton;
2009
- }
2010
- get showModalFilterProps() {
2011
- return this.grid.modalFilterProps;
2012
- }
2013
- get showSearchInput() {
2014
- return this.grid.showSearch;
2015
- }
2016
- get showToolbar() {
2017
- return this.openToolbar;
2018
- }
2019
- set showToolbar(value) {
2020
- this.openToolbar = value;
2021
- }
2022
- get toolbarClass() {
2023
- return !this.openToolbar ? 'is-rotated' : '';
2024
- }
2025
- get tooltipName() {
2026
- return !this.openToolbar ? 'TEKGRID_SHOW' : 'TEKGRID_HIDE';
2027
- }
2028
- get showReloadButton() {
2029
- return this.grid.showReload;
2030
- }
2031
- get showDivider2() {
2032
- return (this.showReloadButton &&
2033
- (this.showLayoutOptionsButton ||
2034
- this.showColumnsButton ||
2035
- this.showActionsButton ||
2036
- this.showExportButton ||
2037
- this.showSearchInput));
2038
- }
2039
- get showColumnsButton() {
2040
- return this.grid.columnsButton;
2041
- }
2042
- get columnsButtonIgnore() {
2043
- return this.grid.columnsButtonIgnore;
2044
- }
2045
- get showLayoutOptionsButton() {
2046
- return this.grid.showLayoutOptions;
2047
- }
2048
- get showDivider1() {
2049
- return ((this.showAddButton || this.showDeleteButton) &&
2050
- (this.showReloadButton ||
2051
- this.showLayoutOptionsButton ||
2052
- this.showColumnsButton ||
2053
- this.showActionsButton ||
2054
- this.showExportButton ||
2055
- this.showSearchInput));
2056
- }
2057
- get showActionsButton() {
2058
- return this.grid.actions.length > 0;
2059
- }
2060
- get showExportButton() {
2061
- return this.grid.showExport;
2062
- }
2063
- get showActionAndExportButton() {
2064
- return ((this.showLayoutOptionsButton || this.showColumnsButton) &&
2065
- (this.showActionsButton || this.showExportButton || this.showSearchInput));
2066
- }
2067
- get showDivider3() {
2068
- return (this.showActionsButton || this.showExportButton) && this.showSearchInput;
2069
- }
2070
- get isEditing() {
2071
- return this.grid.editing;
2072
- }
2073
- get showEditButtons() {
2074
- return this.isEditing && this.grid.showEditButtons;
2075
- }
2076
- get isNotEditing() {
2077
- return !this.isEditing;
2078
- }
2079
- get disableDeleteButton() {
2080
- if (this.grid.deleteButton === 'selection') {
2081
- if (this.grid.selectAllPages) {
2082
- const { allSelected, except } = this.grid.selectionState;
2083
- return (allSelected && except.length === this.grid.datasource.total) || (!allSelected && except.length === 0);
2084
- }
2085
- return this.grid.selectedRows.length === 0;
2086
- }
2087
- if (this.grid.deleteButton === 'currentRow') {
2088
- return !this.grid.datasource.currentRow[this.grid.datasource.uniqueKey];
2089
- }
2090
- return false;
2091
- }
2092
- }
2093
-
2094
- class TekGridEvents extends GridEditableEvents {
2095
- tekGrid;
2096
- /**
2097
- * Flag to prevent row click
2098
- */
2099
- preventRowClick = false;
2100
- preventRowDoubleClick = false;
2101
- constructor(tekGrid) {
2102
- super(tekGrid);
2103
- this.tekGrid = tekGrid;
2104
- }
2105
- calcSummary(column, summary, row) {
2106
- this.tekGrid.callEvent('calcSummary', {
2107
- component: this.tekGrid,
2108
- column,
2109
- columnName: column.name,
2110
- summary,
2111
- row,
2112
- rowValue: row[column.name],
2113
- });
2114
- }
2115
- rowDoubleClick(row, event, element) {
2116
- if (!this.preventRowDoubleClick) {
2117
- this.tekGrid.datasource.currentRow = row;
2118
- this.tekGrid.callEvent('rowDoubleClick', {
2119
- event,
2120
- element,
2121
- row,
2122
- component: this.tekGrid,
2123
- column: undefined,
2124
- });
2125
- }
2126
- this.preventRowDoubleClick = false;
2127
- }
2128
- /**
2129
- * Dispatches group row click event
2130
- * @param row Grid row
2131
- * @param event DOM event
2132
- * @param element DOM Element
2133
- */
2134
- groupRowClick(row, event, element) {
2135
- if (!this.preventRowClick) {
2136
- this.tekGrid.callEvent('groupRowClick', {
2137
- event,
2138
- element,
2139
- row,
2140
- component: this.tekGrid,
2141
- column: undefined,
2142
- });
2143
- }
2144
- this.preventRowClick = false;
2145
- }
2146
- groupRowDoubleClick(row, event, element) {
2147
- if (!this.preventRowDoubleClick) {
2148
- this.tekGrid.callEvent('groupRowDoubleClick', {
2149
- event,
2150
- element,
2151
- row,
2152
- component: this.tekGrid,
2153
- column: undefined,
2154
- });
2155
- }
2156
- this.preventRowDoubleClick = false;
2157
- }
2158
- /**
2159
- * Dispatches group select/unselect event
2160
- * @param row Group row
2161
- * @param isSelected Row is selected
2162
- * @param event DOM event
2163
- * @param element DOM Element
2164
- */
2165
- selectGroupClick(row, isSelected, event, element) {
2166
- if (isSelected) {
2167
- this.tekGrid.callEvent('groupSelected', {
2168
- event,
2169
- element,
2170
- row,
2171
- component: this.tekGrid,
2172
- column: undefined,
2173
- });
2174
- }
2175
- else {
2176
- this.tekGrid.callEvent('groupUnselected', {
2177
- event,
2178
- element,
2179
- row,
2180
- component: this.tekGrid,
2181
- column: undefined,
2182
- });
2183
- }
2184
- }
2185
- }
2186
-
2187
- class GroupedDataSelector extends DataSelector {
2188
- selectAll(isSelected) {
2189
- if (!this.iterable.selectable)
2190
- return;
2191
- this.iterable.selectionState = { allSelected: isSelected, except: [] };
2192
- const data = this.getData();
2193
- if (!isSelected) {
2194
- data.forEach((row) => {
2195
- const index = this.iterable.selectedRows.indexOf(row);
2196
- if (index > -1) {
2197
- this.iterable.selectedRows.splice(index, 1);
2198
- }
2199
- });
2200
- return;
2201
- }
2202
- data.forEach((row) => {
2203
- if (this.callDisableSelection(row))
2204
- return;
2205
- const key = this.iterable.getRowKey(row);
2206
- if (key && this.iterable.selectedRows.indexOf(row) === -1) {
2207
- this.iterable.selectedRows.push(row);
2208
- }
2209
- });
2210
- }
2211
- getData() {
2212
- if (this.iterable.isGrouped()) {
2213
- return this.iterable.getGroupedData();
2214
- }
2215
- return this.iterable.getData();
2216
- }
2217
- }
2218
-
2219
- /* TekGrid Class */
2220
- class TekGrid extends Iterable {
2221
- tableActionBuilder;
2222
- iterableTable;
2223
- dataSelector;
2224
- tekGridEvents;
2225
- dataNavigator;
2226
- viewNavigator;
2227
- keyMapMerger;
2228
- dataEditor;
2229
- columnsSearcher;
2230
- groupedDataManager;
2231
- tekGridToolbarProvider;
2232
- /* Grid Title */
2233
- title = '';
2234
- /* Show Add button */
2235
- addButton = false;
2236
- /* Show Delete button */
2237
- deleteButton = 'none';
2238
- /* Show Delete button */
2239
- actions = [];
2240
- /* Show edit button */
2241
- showEditButtons = true;
2242
- /* Show Filter button */
2243
- filterButton = false;
2244
- /* Show SearchInput */
2245
- showSearch = true;
2246
- /* Show Column Filter button */
2247
- columnFilterButton = false;
2248
- /* Show Columns button */
2249
- columnsButton = false;
2250
- /* Defines if the grid is the unique grid on screen */
2251
- mainGrid = true;
2252
- /* Columns to be ignored on columns button */
2253
- columnsButtonIgnore = [];
2254
- /**
2255
- * Enables column dragging
2256
- * @public
2257
- */
2258
- dragColumns = true;
2259
- /**
2260
- * Enables column resizing
2261
- * @public
2262
- */
2263
- resizeColumns = true;
2264
- /**
2265
- * Enables layout saving
2266
- * @public
2267
- */
2268
- showLayoutOptions = true;
2269
- xlsDefaultType;
2270
- modalFilterProps = {
2271
- name: this.name,
2272
- height: 'auto',
2273
- persistent: true,
2274
- cssClass: '',
2275
- cssStyle: '',
2276
- dark: false,
2277
- draggable: false,
2278
- fullscreen: false,
2279
- dragHandle: '',
2280
- title: 'FILTER',
2281
- };
2282
- /**
2283
- * Show export button
2284
- */
2285
- showExport = false;
2286
- /**
2287
- * Show refresh button
2288
- */
2289
- showReload = true;
2290
- /**
2291
- * Export config
2292
- */
2293
- exportConfig = [
2294
- {
2295
- type: 'pdf',
2296
- label: I18n.translate('TEKGRID_EXPORT_AS', { type: 'PDF' }),
2297
- multiOption: [
2298
- { label: I18n.translate('TEKGRID_PORTRAIT'), iconName: 'mdi-file-outline' },
2299
- {
2300
- label: I18n.translate('TEKGRID_LANDSCAPE'),
2301
- iconName: 'mdi-file-outline',
2302
- cssClass: 'tek-grid-export-landscape',
2303
- reportParams: { portrait: false },
2304
- },
2305
- ],
2306
- },
2307
- {
2308
- type: 'xls',
2309
- label: I18n.translate('TEKGRID_EXPORT_AS', {
2310
- type: 'XLS',
2311
- }),
2312
- },
2313
- {
2314
- type: 'xls2',
2315
- label: I18n.translate('TEKGRID_EXPORT_AS', {
2316
- type: `XLS ${I18n.translate('TEKGRID_WITH_GROUPS')}`,
2317
- }),
2318
- },
2319
- {
2320
- type: 'xls3',
2321
- label: I18n.translate('TEKGRID_EXPORT_AS', {
2322
- type: `XLS ${I18n.translate('TEKGRID_GRID_MIRROR')}`,
2323
- }),
2324
- },
2325
- {
2326
- type: 'csv',
2327
- label: I18n.translate('TEKGRID_EXPORT_AS', { type: 'CSV' }),
2328
- },
2329
- ];
2330
- /**
2331
- * Actions to overwrite the default export config
2332
- */
2333
- exportActions;
2334
- /**
2335
- * Groups should be opened by default after building
2336
- */
2337
- groupsOpened = false;
2338
- /**
2339
- * Show Total summary
2340
- */
2341
- showSummaryTotal = true;
2342
- editNewRowsOnly = false;
2343
- keyShortcutKeyMapping;
2344
- showCheckboxAllFilter = Config.gridShowCheckboxAllFilter || false;
2345
- defaultFilter = {};
2346
- toolbarOpened = true;
2347
- reportTitle = '';
2348
- editing = false;
2349
- currentColumn = null;
2350
- selectedRows = [];
2351
- selectionState = {
2352
- allSelected: false,
2353
- except: [],
2354
- };
2355
- rowStyleConditions;
2356
- selectAllPages = Config.gridSelectAllPages;
2357
- selectable = false;
2358
- disableSelection;
2359
- cellSelection = false;
2360
- toolbarSlot = [{ name: '<<NAME>>_gridSearch', component: 'ZdSearch' }];
2361
- footerSlot = [
2362
- { name: '<<NAME>>_iterablePagination', component: 'ZdIterablePagination' },
2363
- {
2364
- name: '<<NAME>>_iterableInfoDiv',
2365
- component: 'ZdTag',
2366
- cssClass: 'zd-grid-div-footer',
2367
- tag: 'div',
2368
- children: [
2369
- {
2370
- name: '<<NAME>>_iterablePageSize',
2371
- component: 'ZdIterablePageSize',
2372
- iterableComponentName: '<<NAME>>',
2373
- },
2374
- {
2375
- name: '<<NAME>>_iterablePageInfo',
2376
- component: 'ZdIterablePageInfo',
2377
- iterableComponentName: '<<NAME>>',
2378
- },
2379
- ],
2380
- },
2381
- ];
2382
- noResultsText = 'NO_RESULT';
2383
- noResultSlot = [
2384
- {
2385
- name: '<<NAME>>_no-result',
2386
- component: 'ZdText',
2387
- cssClass: 'no-result',
2388
- text: this.noResultsText,
2389
- },
2390
- ];
2391
- errorSlot = [];
2392
- dense = true;
2393
- headerBackground = '';
2394
- headerCellTextColor = '';
2395
- height = 'auto';
2396
- loadingText = 'LOADING';
2397
- maxHeight = 'none';
2398
- maxWidth = 'none';
2399
- minHeight = 'auto';
2400
- minWidth = 'auto';
2401
- noDataText = 'NO_DATA';
2402
- noDataSlot = [
2403
- {
2404
- name: '<<NAME>>_no-data',
2405
- component: 'ZdText',
2406
- cssClass: 'no-data',
2407
- text: this.noDataText,
2408
- },
2409
- ];
2410
- showFooter = true;
2411
- showHeader = true;
2412
- showSelectAll = true;
2413
- width = '100%';
2414
- backgroundColor = 'transparent';
2415
- canEditRow;
2416
- showCancelColumn = false;
2417
- doubleClickEdit = false;
2418
- singleEdit = false;
2419
- editingNewRows = false;
2420
- defaultLazy = false;
2421
- toolbarSlotProps = false;
2422
- filterRelationsDatasource;
2423
- filterOperationsDatasource;
2424
- /**
2425
- * TekGrid class constructor
2426
- * @param props TekGrid properties
2427
- */
2428
- constructor(props) {
2429
- super(props);
2430
- this.title = this.getInitValue('title', props.title, this.title);
2431
- this.addButton = this.getInitValue('addButton', props.addButton, this.addButton);
2432
- this.deleteButton = this.getInitValue('deleteButton', props.deleteButton, this.deleteButton);
2433
- this.filterButton = this.getInitValue('filterButton', props.filterButton, this.filterButton);
2434
- this.showSearch = this.getInitValue('showSearch', props.showSearch, this.showSearch);
2435
- this.columnFilterButton = this.getInitValue('columnFilterButton', props.columnFilterButton, this.columnFilterButton);
2436
- this.columnsButton = this.getInitValue('columnsButton', props.columnsButton, this.columnsButton);
2437
- this.columnsButtonIgnore = this.getInitValue('columnsButtonIgnore', props.columnsButtonIgnore, this.columnsButtonIgnore);
2438
- this.showEditButtons = this.getInitValue('showEditButtons', props.showEditButtons, this.showEditButtons);
2439
- this.dragColumns = this.getInitValue('dragColumns', props.dragColumns, this.dragColumns);
2440
- this.resizeColumns = this.getInitValue('resizeColumns', props.resizeColumns, this.resizeColumns);
2441
- this.showLayoutOptions = this.getInitValue('showLayoutOptions', props.showLayoutOptions, this.showLayoutOptions);
2442
- this.xlsDefaultType = this.getInitValue('xlsDefaultType', props.xlsDefaultType, this.xlsDefaultType);
2443
- this.showExport = this.getInitValue('showExport', props.showExport, this.showExport);
2444
- this.showReload = this.getInitValue('showReload', props.showReload, this.showReload);
2445
- this.exportConfig = this.getInitValue('exportConfig', props.exportConfig, this.exportConfig);
2446
- this.modalFilterProps = this.getInitValue('modalFilterProps', props.modalFilterProps, this.modalFilterProps);
2447
- this.exportActions = props.exportActions || this.exportActions;
2448
- this.groupsOpened = this.getInitValue('groupsOpened', props.groupsOpened, this.groupsOpened);
2449
- this.showSummaryTotal = this.getInitValue('showSummaryTotal', props.showSummaryTotal, this.showSummaryTotal);
2450
- this.showCheckboxAllFilter = this.getInitValue('showCheckboxAllFilter', props.showCheckboxAllFilter, this.showCheckboxAllFilter);
2451
- this.defaultFilter = this.getInitValue('defaultFilter', props.defaultFilter, this.defaultFilter);
2452
- this.toolbarOpened = this.getInitValue('toolbarOpened', props.toolbarOpened, this.toolbarOpened);
2453
- this.editNewRowsOnly = this.getInitValue('editNewRowsOnly', props.editNewRowsOnly, this.editNewRowsOnly);
2454
- this.mainGrid = this.getInitValue('mainGrid', props.mainGrid, this.mainGrid);
2455
- this.reportTitle = this.getInitValue('reportTitle', props.reportTitle, this.reportTitle);
2456
- this.actions = props.actions || this.actions;
2457
- this.toolbarSlotProps = props.toolbarSlot !== undefined;
2458
- this.cellSelection = this.getInitValue('cellSelection', props.cellSelection, this.cellSelection);
2459
- this.dense = this.getInitValue('dense', props.dense, this.dense);
2460
- this.disableSelection = this.getInitValue('disableSelection', props.disableSelection, this.disableSelection);
2461
- this.dragColumns = this.getInitValue('dragColumns', props.dragColumns, this.dragColumns);
2462
- this.fillHeight = this.getInitValue('fillHeight', props.fillHeight, this.fillHeight);
2463
- this.headerCellTextColor = this.getInitValue('headerCellTextColor', props.headerCellTextColor, this.headerCellTextColor);
2464
- this.height = this.getInitValue('height', props.height, this.height);
2465
- this.loadingText = this.getInitValue('loadingText', props.loadingText, this.loadingText);
2466
- this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
2467
- this.maxWidth = this.getInitValue('maxWidth', props.maxWidth, this.maxWidth);
2468
- this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
2469
- this.minWidth = this.getInitValue('minWidth', props.minWidth, this.minWidth);
2470
- this.noDataText = this.getInitValue('noDataText', props.noDataText, this.noDataText);
2471
- this.noResultsText = this.getInitValue('noResultsText', props.noResultsText, this.noResultsText);
2472
- this.resizeColumns = this.getInitValue('resizeColumns', props.resizeColumns, this.resizeColumns);
2473
- this.rowStyleConditions = this.getInitValue('rowStyleConditions', props.rowStyleConditions, this.rowStyleConditions);
2474
- this.selectable = this.getInitValue('selectable', props.selectable, this.selectable);
2475
- this.selectAllPages = this.getInitValue('selectAllPages', props.selectAllPages, this.selectAllPages);
2476
- this.showFooter = this.getInitValue('showFooter', props.showFooter, this.showFooter);
2477
- this.showHeader = this.getInitValue('showHeader', props.showHeader, this.showHeader);
2478
- this.showSelectAll = this.getInitValue('showSelectAll', props.showSelectAll, this.showSelectAll);
2479
- this.width = this.getInitValue('width', props.width, this.width);
2480
- this.backgroundColor = this.getInitValue('backgroundColor', props.backgroundColor, this.backgroundColor);
2481
- // headerBackground defaults to the backgroundColor, unless backgroundColor is transparent
2482
- const defaultHeaderBackground = this.backgroundColor === 'transparent' ? '' : this.backgroundColor;
2483
- this.headerBackground = this.getInitValue('headerBackground', props.headerBackground, defaultHeaderBackground);
2484
- this.doubleClickEdit = this.getInitValue('doubleClickEdit', props.doubleClickEdit, this.doubleClickEdit);
2485
- this.singleEdit = this.getInitValue('singleEdit', props.singleEdit, this.singleEdit);
2486
- this.showCancelColumn = this.getInitValue('showCancelColumn', props.showCancelColumn, this.showCancelColumn);
2487
- this.canEditRow = this.getInitValue('canEditRow', props.canEditRow, this.canEditRow);
2488
- this.editingNewRows = this.getInitValue('editingNewRows', props.editingNewRows, this.editingNewRows);
2489
- this.toolbarSlot = props.toolbarSlot || this.toolbarSlot;
2490
- this.footerSlot = props.footerSlot || this.footerSlot;
2491
- this.noDataSlot = props.noDataSlot || this.noDataSlot;
2492
- this.noResultSlot = props.noResultSlot || this.noResultSlot;
2493
- this.errorSlot = props.errorSlot || this.errorSlot;
2494
- this.noDataSlot = this.changeDefaultSlotNames(this.noDataSlot);
2495
- this.footerSlot = this.changeDefaultSlotNames(this.footerSlot);
2496
- this.toolbarSlot = this.changeDefaultSlotNames(this.toolbarSlot);
2497
- this.noResultSlot = this.changeDefaultSlotNames(this.noResultSlot);
2498
- this.errorSlot = this.changeDefaultSlotNames(this.errorSlot);
2499
- this.defaultLazy = this.getDefaultLazy(props);
2500
- if (this.deleteButton === 'selection') {
2501
- this.selectable = true;
2502
- }
2503
- this.tableActionBuilder = new TableActionBuilder(this);
2504
- this.iterableTable = new IterableTable(this);
2505
- this.dataSelector = new GroupedDataSelector(this);
2506
- this.tekGridEvents = new TekGridEvents(this);
2507
- this.dataNavigator = new GroupedDataNavigator(this);
2508
- this.viewNavigator = new ViewNavigator();
2509
- this.dataEditor = new DataEditorWithAdd(this);
2510
- this.columnsSearcher = new ColumnsSearcher();
2511
- this.groupedDataManager = new GroupedDataManager(this);
2512
- this.tekGridToolbarProvider = new TekGridToolbarProvider(this, 'show');
2513
- }
2514
- initializeDatasource(props) {
2515
- let datasourceProps = clonedeep(props.datasource);
2516
- // if using accessor, get props from the controller
2517
- if (typeof props.datasource === 'string' && Accessor.isAccessorDefinition(props.datasource)) {
2518
- const [controller, accessor] = Accessor.getAccessor(props.datasource);
2519
- const instance = Loader.getInstance(controller);
2520
- datasourceProps = instance[accessor];
2521
- }
2522
- this.datasource = DatasourceFactory.factory({
2523
- ...datasourceProps,
2524
- searchIn: props.datasource?.searchIn || `{{IterableController_${this.name}.searchIn}}`,
2525
- lazyLoad: true,
2526
- });
2527
- }
2528
- columnHasFilter(columnName) {
2529
- return this.datasource.hasFilter(columnName);
2530
- }
2531
- registerTask(task) {
2532
- this.groupedDataManager.registerTask(task);
2533
- }
2534
- async loadAfterTasks() {
2535
- return this.groupedDataManager.loadAfterTasks();
2536
- }
2537
- calcSummary(column, columnNamesummary, row) {
2538
- this.tekGridEvents.calcSummary(column, columnNamesummary, row);
2539
- }
2540
- getDefaultLazy(props) {
2541
- if (typeof props.datasource === 'object') {
2542
- return props.datasource.lazyLoad;
2543
- }
2544
- if (typeof props.datasource === 'string' && Accessor.isAccessorDefinition(props.datasource)) {
2545
- const [controller, accessor] = Accessor.getAccessor(props.datasource);
2546
- const instance = Loader.getInstance(controller);
2547
- return instance[accessor].lazyLoad || false;
2548
- }
2549
- return false;
2550
- }
2551
- initializeGrouping(lazyLoad) {
2552
- this.groupedDataManager.initializeGrouping(lazyLoad);
2553
- }
2554
- updateGrouping() {
2555
- return this.groupedDataManager.updateGrouping();
2556
- }
2557
- updateGroupedData(lazyLoad) {
2558
- return this.groupedDataManager.updateGroupedData(lazyLoad);
2559
- }
2560
- buildGroupedData() {
2561
- this.groupedDataManager.buildGroupedData();
2562
- }
2563
- openGroup(group) {
2564
- this.groupedDataManager.openGroup(group);
2565
- }
2566
- isItemVisible(row) {
2567
- return this.groupedDataManager.isItemVisible(row);
2568
- }
2569
- isGrouped() {
2570
- return this.groupedDataManager.isGrouped();
2571
- }
2572
- isColumnSearchable(column) {
2573
- return this.groupedDataManager.isColumnSearchable(column);
2574
- }
2575
- getGroupedData() {
2576
- return this.groupedDataManager.getGroupedData();
2577
- }
2578
- directionalLeft(param) {
2579
- this.groupedDataManager.directionalLeft(param);
2580
- this.viewNavigator.navigateLeft(param);
2581
- }
2582
- directionalRight(param) {
2583
- this.groupedDataManager.directionalRight(param);
2584
- this.viewNavigator.navigateRight(param);
2585
- }
2586
- getReport() {
2587
- throw new Error('Method not implemented.');
2588
- }
2589
- setViewUpdateFixedColumns(fn) {
2590
- this.groupedDataManager.setViewUpdateFixedColumns(fn);
2591
- }
2592
- setViewUpdateScrollData(fn) {
2593
- this.groupedDataManager.setViewUpdateScrollData(fn);
2594
- }
2595
- onCreated() {
2596
- this.createGridController();
2597
- this.addCancelColumn();
2598
- super.onCreated();
2599
- Loader.addController(`GridController_${this.name}`, TekGridController, [this]);
2600
- if (!this.toolbarSlotProps)
2601
- this.toolbarSlot = this.tekGridToolbarProvider.getProperties();
2602
- this.createDynamicFilterDatasources();
2603
- }
2604
- createDynamicFilterDatasources() {
2605
- if (!(this.datasource instanceof TekRestDatasource || this.datasource instanceof TekMemoryDatasource))
2606
- return;
2607
- const datasourceFactory = new DynamicFilterDatasourceFactory();
2608
- this.filterRelationsDatasource = datasourceFactory.factory(this.datasource.dynamicFilterRelations);
2609
- this.filterOperationsDatasource = datasourceFactory.factory(this.datasource.dynamicFilterOperations);
2610
- }
2611
- onMounted(element) {
2612
- super.onMounted(element);
2613
- this.keyMapMerger = new KeyMapMerger(this, [KeyMapNavigation, KeyMapEditing, KeyMapGrouped]);
2614
- this.keyMapMerger.bind(element);
2615
- this.initializeGrouping(this.defaultLazy);
2616
- }
2617
- onBeforeDestroy() {
2618
- super.onBeforeDestroy();
2619
- this.keyMapMerger.unbind();
2620
- }
2621
- createColumn(column) {
2622
- return new TekGridColumn(column, this);
2623
- }
2624
- getConditionalProps({ row, column }) {
2625
- const rowStyle = this.getRowStyleConditions(row);
2626
- const cellsApplied = this.getAppliedConditions({ row, column });
2627
- return { ...rowStyle, ...cellsApplied };
2628
- }
2629
- changeOrder(sortBy) {
2630
- return this.iterableTable.changeOrder(sortBy);
2631
- }
2632
- selectCell(row, column) {
2633
- this.iterableTable.selectCell(row, column);
2634
- }
2635
- reapplyRowStyleConditions(row) {
2636
- return this.iterableTable.reapplyRowStyleConditions(row);
2637
- }
2638
- getRowStyleConditions(row) {
2639
- return this.iterableTable.getRowStyleConditions(row);
2640
- }
2641
- deleteRows() {
2642
- return this.iterableTable.deleteRows();
2643
- }
2644
- selectAll(isSelected) {
2645
- this.dataSelector.selectAll(isSelected);
2646
- }
2647
- toggleRow(row) {
2648
- this.dataSelector.toggleRow(row);
2649
- }
2650
- selectRow(row, select) {
2651
- this.dataSelector.selectRow(row, select);
2652
- }
2653
- callDisableSelection(row) {
2654
- return this.dataSelector.callDisableSelection(row);
2655
- }
2656
- selectClick(row, isSelected, event, element) {
2657
- this.dataSelector.selectClick(row, isSelected, event, element);
2658
- }
2659
- selectAllClick(isSelected, event, element) {
2660
- this.dataSelector.selectAllClick(isSelected, event, element);
2661
- }
2662
- navigatePageUp() {
2663
- this.dataNavigator.navigatePageUp();
2664
- }
2665
- navigatePageDown() {
2666
- this.dataNavigator.navigatePageDown();
2667
- }
2668
- setViewNavigate(viewNavigate) {
2669
- this.viewNavigator.setViewNavigate(viewNavigate);
2670
- }
2671
- navigateLeft(params) {
2672
- if (!this.cellSelection)
2673
- return;
2674
- this.viewNavigator.navigateLeft(params);
2675
- }
2676
- navigateRight(params) {
2677
- if (!this.cellSelection)
2678
- return;
2679
- this.viewNavigator.navigateRight(params);
2680
- }
2681
- navigateUp() {
2682
- this.viewNavigator.navigateUp();
2683
- }
2684
- navigateDown() {
2685
- this.viewNavigator.navigateDown();
2686
- }
2687
- navigateDatasource(direction) {
2688
- this.dataNavigator.navigateDatasource(direction);
2689
- }
2690
- getActionComponent(actionComponent, column, row, parentPath) {
2691
- return this.tableActionBuilder.getActionComponent(actionComponent, column, row, parentPath);
2692
- }
2693
- createGridController() {
2694
- this.dataEditor.createGridController();
2695
- }
2696
- addCancelColumn() {
2697
- this.dataEditor.addCancelColumn();
2698
- }
2699
- getCancelColumnProps() {
2700
- return this.dataEditor.getCancelColumnProps();
2701
- }
2702
- isAdded(row) {
2703
- return this.dataEditor.isAdded(row);
2704
- }
2705
- cancelAddedRow(key) {
2706
- return this.dataEditor.cancelAddedRow(key);
2707
- }
2708
- cancelAddedRows() {
2709
- return this.dataEditor.cancelAddedRows();
2710
- }
2711
- getAddedRows() {
2712
- return this.dataEditor.getAddedRows();
2713
- }
2714
- addNewRow(row, position) {
2715
- return this.dataEditor.addNewRow(row, position);
2716
- }
2717
- getVisibleValue(row, column) {
2718
- return this.dataEditor.getVisibleValue(row, column);
2719
- }
2720
- getEditableComponent(column, row) {
2721
- return this.dataEditor.getEditableComponent(column, row);
2722
- }
2723
- isEdited(column, row) {
2724
- return this.dataEditor.isEdited(column, row);
2725
- }
2726
- isValid(column, row, revalidate) {
2727
- return this.dataEditor.isValid(column, row, revalidate);
2728
- }
2729
- checkValid(column, row) {
2730
- return this.dataEditor.checkValid(column, row);
2731
- }
2732
- isGridValid(revalidate) {
2733
- return this.dataEditor.isGridValid(revalidate);
2734
- }
2735
- getComponent(key, columnName) {
2736
- return this.dataEditor.getComponent(key, columnName);
2737
- }
2738
- updateRow(newRow) {
2739
- this.dataEditor.updateRow(newRow);
2740
- }
2741
- updateCell(rowKey, columnName, value) {
2742
- this.dataEditor.updateCell(rowKey, columnName, value);
2743
- }
2744
- setViewEnterEdit(fn) {
2745
- this.dataEditor.setViewEnterEdit(fn);
2746
- }
2747
- enterEdit(rowKey, columnName) {
2748
- this.dataEditor.enterEdit(rowKey, columnName);
2749
- }
2750
- cancelEditedRows() {
2751
- return this.dataEditor.cancelEditedRows();
2752
- }
2753
- saveEditedRows(revalidate) {
2754
- return this.dataEditor.saveEditedRows(revalidate);
2755
- }
2756
- reapplyCanEditRow(row) {
2757
- return this.dataEditor.reapplyCanEditRow(row);
2758
- }
2759
- getCanEditRow(row) {
2760
- return this.dataEditor.getCanEditRow(row);
2761
- }
2762
- getEditedRows(revalidate, silent) {
2763
- return this.dataEditor.getEditedRows(revalidate, silent);
2764
- }
2765
- getEditedRow(row) {
2766
- return this.dataEditor.getEditedRow(row);
2767
- }
2768
- rowClick(row, event, element) {
2769
- this.tekGridEvents.rowClick(row, event, element);
2770
- }
2771
- rowDoubleClick(row, event, element) {
2772
- this.tekGridEvents.rowDoubleClick(row, event, element);
2773
- }
2774
- cellDoubleClick(row, column, event, element) {
2775
- this.tekGridEvents.cellDoubleClick(row, column, event, element);
2776
- }
2777
- inlineEdit(row, column, event, element) {
2778
- this.tekGridEvents.inlineEdit(row, column, event, element);
2779
- }
2780
- cellClick(row, column, event, element) {
2781
- this.tekGridEvents.cellClick(row, column, event, element);
2782
- }
2783
- cellClickEvent(row, column, event, element) {
2784
- this.tekGridEvents.cellClickEvent(row, column, event, element);
2785
- }
2786
- groupRowClick(row, event, element) {
2787
- this.tekGridEvents.groupRowClick(row, event, element);
2788
- }
2789
- groupRowDoubleClick(row, event, element) {
2790
- this.tekGridEvents.groupRowDoubleClick(row, event, element);
2791
- }
2792
- selectGroupClick(row, isSelected, event, element) {
2793
- this.tekGridEvents.selectGroupClick(row, isSelected, event, element);
2794
- }
2795
- async setSearch(search) {
2796
- const { datasource } = this;
2797
- if (datasource instanceof TekRestDatasource || datasource instanceof TekMemoryDatasource) {
2798
- datasource.searchJoin = await this.columnsSearcher.searchColumn(this.columns, search);
2799
- }
2800
- datasource.page = 1;
2801
- return datasource.setSearch(search);
2802
- }
2803
- getAtomInstance(key) {
2804
- return this.tekGridToolbarProvider.getAtomInstance(key);
2805
- }
2806
- getAtomName(key) {
2807
- return this.tekGridToolbarProvider.getAtomName(key);
2808
- }
2809
- }
2810
- Messages.add({
2811
- 'pt-BR': {
2812
- translation: {
2813
- TEKGRID_CONTAINS: 'contém',
2814
- TEKGRID_NOT_CONTAINS: 'não contém',
2815
- TEKGRID_EQUALS: 'é igual a',
2816
- TEKGRID_NOT_EQUALS: 'é diferente de',
2817
- TEKGRID_GREATER_THAN: 'é maior que',
2818
- TEKGRID_LESS_THAN: 'é menor que',
2819
- TEKGRID_GREATER_THAN_EQUALS: 'é maior ou igual a',
2820
- TEKGRID_LESS_THAN_EQUALS: 'é menor ou igual a',
2821
- TEKGRID_IN: 'um dos valores',
2822
- TEKGRID_NOT_IN: 'nenhum dos valores',
2823
- TEKGRID_BETWEEN: 'está entre',
2824
- TEKGRID_AND: 'e',
2825
- TEKGRID_OR: 'ou',
2826
- TEKGRID_HIDE: 'Esconder Ações',
2827
- TEKGRID_SHOW: 'Mostrar Ações',
2828
- TEKGRID_ADD: 'Adicionar',
2829
- TEKGRID_DELETE: 'Excluir',
2830
- TEKGRID_REFRESH: 'Atualizar',
2831
- TEKGRID_COLUMNS: 'Colunas',
2832
- TEKGRID_SAVE: 'Salvar',
2833
- TEKGRID_CANCEL: 'Cancelar',
2834
- TEKGRID_APPLY: 'Aplicar',
2835
- TEKGRID_FILTER: 'Filtro',
2836
- TEKGRID_MULTIPLE_VALUE_HINT: 'Separe valores usando ";"',
2837
- TEKGRID_EXPORT: 'Exportar',
2838
- TEKGRID_EXPORT_AS: 'Exportar como {{ type }}',
2839
- TEKGRID_PORTRAIT: 'Retrato',
2840
- TEKGRID_LANDSCAPE: 'Paisagem',
2841
- TEKGRID_COLUMN_VISIBLE: 'Visível',
2842
- TEKGRID_COLUMN_GROUPED: 'Grupo',
2843
- TEKGRID_COLUMN_AGGREGATION: 'Totalização',
2844
- TEKGRID_COLUMN_LABEL: 'Rótulo',
2845
- TEKGRID_COLUMN_ALIGNMENT: 'Alinhamento',
2846
- TEKGRID_COLUMN_GROUP_OPENED: 'Aberto (grupo)',
2847
- TEKGRID_COLUMN_ORDER: 'Ordem',
2848
- TEKGRID_COLUMN_ORDER_DIRECTION: 'Direção (ordem)',
2849
- TEKGRID_AGGREGATION_SUM: 'Soma',
2850
- TEKGRID_AGGREGATION_AVG: 'Média',
2851
- TEKGRID_AGGREGATION_MAX: 'Máximo',
2852
- TEKGRID_AGGREGATION_MIN: 'Mínimo',
2853
- TEKGRID_AGGREGATION_COUNT: 'Contador',
2854
- TEKGRID_MORE_OPTIONS: 'Mais opções',
2855
- TEKGRID_COLUMNS_OPTIONS: 'Configuração de colunas',
2856
- TEKGRID_CLOSE: 'Fechar',
2857
- TEKGRID_FIXED_COLUMNS: 'Colunas fixadas',
2858
- TEKGRID_VISIBLE_COLUMNS: 'Colunas visíveis',
2859
- TEKGRID_GROUPED_COLUMNS: 'Colunas agrupadas',
2860
- TEKGRID_ORDER: 'Ordem',
2861
- TEKGRID_OTHER_COLUMNS: 'Outras colunas',
2862
- TEKGRID_DROP_COLUMNS: 'Arraste colunas aqui',
2863
- TEKGRID_DETAILS_FOR: 'Detalhes para:',
2864
- TEKGRID_LEFT: 'Esquerda',
2865
- TEKGRID_CENTER: 'Centro',
2866
- TEKGRID_RIGHT: 'Direita',
2867
- TEKGRID_ASC: 'Crescente',
2868
- TEKGRID_DESC: 'Decrescente',
2869
- TEKGRID_SELECT_COLUMN: '(selecione uma ou mais colunas)',
2870
- TEKGRID_SELECT_ALL: 'Selecionar todas',
2871
- TEKGRID_HELPERVALUE_TODAY: 'Hoje',
2872
- TEKGRID_HELPERVALUE_TOMORROW: 'Amanhã',
2873
- TEKGRID_HELPERVALUE_YESTERDAY: 'Ontem',
2874
- TEKGRID_HELPERVALUE_LAST_7_DAYS: 'Últimos 7 Dias',
2875
- TEKGRID_HELPERVALUE_NEXT_7_DAYS: 'Próximos 7 Dias',
2876
- TEKGRID_HELPERVALUE_CURRENT_WEEK: 'Semana Atual',
2877
- TEKGRID_HELPERVALUE_CURRENT_MONTH: 'Mês Atual',
2878
- TEKGRID_HELPERVALUE_CURRENT_YEAR: 'Ano Atual',
2879
- TEKGRID_WITH_GROUPS: '(Com grupos)',
2880
- TEKGRID_GRID_MIRROR: '(Espelho do grid)',
2881
- TEKGRID_NO_DATA: 'Não há dados para gerar o relatório',
2882
- },
2883
- },
2884
- 'en-US': {
2885
- translation: {
2886
- TEKGRID_CONTAINS: 'contains',
2887
- TEKGRID_NOT_CONTAINS: 'does not contain',
2888
- TEKGRID_EQUALS: 'is equal to',
2889
- TEKGRID_NOT_EQUALS: 'is different from',
2890
- TEKGRID_GREATER_THAN: 'is greater than',
2891
- TEKGRID_LESS_THAN: 'is less than',
2892
- TEKGRID_GREATER_THAN_EQUALS: 'is greater or equals to',
2893
- TEKGRID_LESS_THAN_EQUALS: 'is less or equals to',
2894
- TEKGRID_IN: 'is in',
2895
- TEKGRID_NOT_IN: 'is not in',
2896
- TEKGRID_BETWEEN: 'is between',
2897
- TEKGRID_AND: 'and',
2898
- TEKGRID_OR: 'or',
2899
- TEKGRID_HIDE: 'Hide Actions',
2900
- TEKGRID_SHOW: 'Show Actions',
2901
- TEKGRID_ADD: 'Add',
2902
- TEKGRID_DELETE: 'Delete',
2903
- TEKGRID_REFRESH: 'Refresh',
2904
- TEKGRID_COLUMNS: 'Columns',
2905
- TEKGRID_SAVE: 'Save',
2906
- TEKGRID_CANCEL: 'Cancel',
2907
- TEKGRID_APPLY: 'Apply',
2908
- TEKGRID_FILTER: 'Filter',
2909
- TEKGRID_MULTIPLE_VALUE_HINT: 'Separate values using ";"',
2910
- TEKGRID_EXPORT: 'Export',
2911
- TEKGRID_EXPORT_AS: 'Export as {{ type }}',
2912
- TEKGRID_PORTRAIT: 'Portrait',
2913
- TEKGRID_LANDSCAPE: 'Landscape',
2914
- TEKGRID_COLUMN_VISIBLE: 'Visible',
2915
- TEKGRID_COLUMN_GROUPED: 'Grouped',
2916
- TEKGRID_COLUMN_AGGREGATION: 'Aggregation',
2917
- TEKGRID_COLUMN_LABEL: 'Label',
2918
- TEKGRID_COLUMN_ALIGNMENT: 'Alignment',
2919
- TEKGRID_COLUMN_GROUP_OPENED: 'Opened (group)',
2920
- TEKGRID_COLUMN_ORDER: 'Order',
2921
- TEKGRID_COLUMN_ORDER_DIRECTION: 'Direction (order)',
2922
- TEKGRID_AGGREGATION_SUM: 'Sum',
2923
- TEKGRID_AGGREGATION_AVG: 'Average',
2924
- TEKGRID_AGGREGATION_MAX: 'Maximum',
2925
- TEKGRID_AGGREGATION_MIN: 'Minimum',
2926
- TEKGRID_AGGREGATION_COUNT: 'Count',
2927
- TEKGRID_MORE_OPTIONS: 'More options',
2928
- TEKGRID_COLUMNS_OPTIONS: 'Columns configuration',
2929
- TEKGRID_CLOSE: 'Close',
2930
- TEKGRID_FIXED_COLUMNS: 'Fixed columns',
2931
- TEKGRID_VISIBLE_COLUMNS: 'Visible columns',
2932
- TEKGRID_GROUPED_COLUMNS: 'Grouped columns',
2933
- TEKGRID_ORDER: 'Order',
2934
- TEKGRID_OTHER_COLUMNS: 'Other columns',
2935
- TEKGRID_DROP_COLUMNS: 'Drop columns here',
2936
- TEKGRID_DETAILS_FOR: 'Details for:',
2937
- TEKGRID_LEFT: 'Left',
2938
- TEKGRID_CENTER: 'Center',
2939
- TEKGRID_RIGHT: 'Right',
2940
- TEKGRID_ASC: 'Ascending',
2941
- TEKGRID_DESC: 'Descending',
2942
- TEKGRID_SELECT_COLUMN: '(select one or more columns)',
2943
- TEKGRID_SELECT_ALL: 'Select all',
2944
- TEKGRID_HELPERVALUE_TODAY: 'Today',
2945
- TEKGRID_HELPERVALUE_TOMORROW: 'Tomorrow',
2946
- TEKGRID_HELPERVALUE_YESTERDAY: 'Yesterday',
2947
- TEKGRID_HELPERVALUE_LAST_7_DAYS: 'Last 7 Days',
2948
- TEKGRID_HELPERVALUE_NEXT_7_DAYS: 'Next 7 Days',
2949
- TEKGRID_HELPERVALUE_CURRENT_WEEK: 'Current Week',
2950
- TEKGRID_HELPERVALUE_CURRENT_MONTH: 'Current Month',
2951
- TEKGRID_HELPERVALUE_CURRENT_YEAR: 'Current Year',
2952
- TEKGRID_WITH_GROUPS: '(With groups)',
2953
- TEKGRID_GRID_MIRROR: '(Grid mirror)',
2954
- TEKGRID_NO_DATA: 'There is no data to generate the report',
2955
- },
2956
- },
2957
- 'es-CL': {
2958
- translation: {
2959
- TEKGRID_CONTAINS: 'contiene',
2960
- TEKGRID_NOT_CONTAINS: 'no contiene',
2961
- TEKGRID_EQUALS: 'igual',
2962
- TEKGRID_NOT_EQUALS: 'es diferente de',
2963
- TEKGRID_GREATER_THAN: 'es mayor que',
2964
- TEKGRID_LESS_THAN: 'es menor que',
2965
- TEKGRID_GREATER_THAN_EQUALS: 'es mayor o igual que',
2966
- TEKGRID_LESS_THAN_EQUALS: 'es menor o igual que',
2967
- TEKGRID_IN: 'uno de los valores',
2968
- TEKGRID_NOT_IN: 'ninguno de los valores',
2969
- TEKGRID_BETWEEN: 'está entre',
2970
- TEKGRID_AND: 'e',
2971
- TEKGRID_OR: 'o',
2972
- TEKGRID_HIDE: 'Ocultar Acciones',
2973
- TEKGRID_SHOW: 'Mostrar Acciones',
2974
- TEKGRID_ADD: 'Añadir',
2975
- TEKGRID_DELETE: 'Eliminar',
2976
- TEKGRID_REFRESH: 'Actualizar',
2977
- TEKGRID_COLUMNS: 'Colunas',
2978
- TEKGRID_SAVE: 'Guardar',
2979
- TEKGRID_CANCEL: 'Cancelar',
2980
- TEKGRID_APPLY: 'Aplicar',
2981
- TEKGRID_FILTER: 'Filtro',
2982
- TEKGRID_MULTIPLE_VALUE_HINT: 'Separe los valores usando ";"',
2983
- TEKGRID_EXPORT: 'Exportar',
2984
- TEKGRID_EXPORT_AS: 'Exportar como {{ type }}',
2985
- TEKGRID_PORTRAIT: 'Vertical',
2986
- TEKGRID_LANDSCAPE: 'Horizontal',
2987
- TEKGRID_COLUMN_VISIBLE: 'Visible',
2988
- TEKGRID_COLUMN_GROUPED: 'Grupo',
2989
- TEKGRID_COLUMN_AGGREGATION: 'Totalización',
2990
- TEKGRID_COLUMN_LABEL: 'Etiqueta',
2991
- TEKGRID_COLUMN_ALIGNMENT: 'alineación',
2992
- TEKGRID_COLUMN_GROUP_OPENED: 'Abierto (grupo)',
2993
- TEKGRID_COLUMN_ORDER: 'Orden',
2994
- TEKGRID_COLUMN_ORDER_DIRECTION: 'Dirección (orden)',
2995
- TEKGRID_AGGREGATION_SUM: 'Suma',
2996
- TEKGRID_AGGREGATION_AVG: 'Media',
2997
- TEKGRID_AGGREGATION_MAX: 'Máximo',
2998
- TEKGRID_AGGREGATION_MIN: 'Mínimo',
2999
- TEKGRID_AGGREGATION_COUNT: 'Contar',
3000
- TEKGRID_MORE_OPTIONS: 'Mas opciones',
3001
- TEKGRID_COLUMNS_OPTIONS: 'Configuración de columna',
3002
- TEKGRID_CLOSE: 'Cerrar',
3003
- TEKGRID_FIXED_COLUMNS: 'Columnas fijas',
3004
- TEKGRID_VISIBLE_COLUMNS: 'Columnas visibles',
3005
- TEKGRID_GROUPED_COLUMNS: 'Columnas agrupadas',
3006
- TEKGRID_ORDER: 'Orden',
3007
- TEKGRID_OTHER_COLUMNS: 'Otras columnas',
3008
- TEKGRID_DROP_COLUMNS: 'Arrastra columnas aquí',
3009
- TEKGRID_DETAILS_FOR: 'Detalles para',
3010
- TEKGRID_LEFT: 'Izquierda',
3011
- TEKGRID_CENTER: 'Centro',
3012
- TEKGRID_RIGHT: 'Derecha',
3013
- TEKGRID_ASC: 'Creciente',
3014
- TEKGRID_DESC: 'Decreciente',
3015
- TEKGRID_SELECT_COLUMN: '(seleccione una o más columnas)',
3016
- TEKGRID_SELECT_ALL: 'Seleccionar todas',
3017
- TEKGRID_HELPERVALUE_TODAY: 'Hoy',
3018
- TEKGRID_HELPERVALUE_TOMORROW: 'Mañana',
3019
- TEKGRID_HELPERVALUE_YESTERDAY: 'Ayer',
3020
- TEKGRID_HELPERVALUE_LAST_7_DAYS: 'Últimos 7 días',
3021
- TEKGRID_HELPERVALUE_NEXT_7_DAYS: 'Próximos 7 días',
3022
- TEKGRID_HELPERVALUE_CURRENT_WEEK: 'Semana actual',
3023
- TEKGRID_HELPERVALUE_CURRENT_MONTH: 'Mes actual',
3024
- TEKGRID_HELPERVALUE_CURRENT_YEAR: 'Año actual',
3025
- TEKGRID_WITH_GROUPS: '(Con grupos)',
3026
- TEKGRID_GRID_MIRROR: '(Espejo de grid)',
3027
- TEKGRID_NO_DATA: 'No hay datos para generar el reporte',
3028
- },
3029
- },
3030
- });
3031
- Messages.add({
3032
- 'pt-BR': {
3033
- translation: {
3034
- NO_NOTIFICATIONS: 'Nenhuma Notificação',
3035
- MARK_ALL_AS_READ: 'Marcar todas como lidas',
3036
- NOTIFICATIONS: 'Notificações',
3037
- SEE_ALL_NOTIFICATIONS: 'Ver todas notificações',
3038
- UNAVAILABLE_IMAGE: 'Imagem indisponível',
3039
- REFRESH: 'Atualizar',
3040
- ACTIONS: 'Ações',
3041
- FILTER: 'Filtro',
3042
- LAYOUT: 'Layout: ',
3043
- NEW_LAYOUT: 'Novo layout',
3044
- DEFAULT_LAYOUT: 'Padrão',
3045
- LAYOUT_MODIFIED: 'O layout atual foi modificado. Crie um novo layout, sobrescreva um existente ou descarte as alterações', // eslint-disable-line
3046
- LAYOUT_NOT_MODIFIED: 'Crie um novo layout ou aplique um dos layouts já existentes',
3047
- LAYOUT_DISCART_CHANGES: 'Descartar alterações',
3048
- },
3049
- },
3050
- 'en-US': {
3051
- translation: {
3052
- NO_NOTIFICATIONS: 'No Notifications',
3053
- MARK_ALL_AS_READ: 'Mark all as read',
3054
- NOTIFICATIONS: 'Notifications',
3055
- SEE_ALL_NOTIFICATIONS: 'See all notifications',
3056
- UNAVAILABLE_IMAGE: 'Unavailable image',
3057
- REFRESH: 'Refresh',
3058
- ACTIONS: 'Actions',
3059
- FILTER: 'Filter',
3060
- LAYOUT: 'Layout: ',
3061
- NEW_LAYOUT: 'New layout',
3062
- DEFAULT_LAYOUT: 'Default',
3063
- LAYOUT_MODIFIED: 'The current layout has been modified. Create a new layout, overwrite an existing one or discard changes', // eslint-disable-line
3064
- LAYOUT_NOT_MODIFIED: 'Create a new layout or apply one of the existing layouts',
3065
- LAYOUT_DISCART_CHANGES: 'Discard changes',
3066
- },
3067
- },
3068
- 'es-CL': {
3069
- translation: {
3070
- NO_NOTIFICATIONS: 'Sin Notificación',
3071
- MARK_ALL_AS_READ: 'Marcar todo como leído',
3072
- NOTIFICATIONS: 'Notificaciones',
3073
- SEE_ALL_NOTIFICATIONS: 'Ver todas las notificaciones',
3074
- UNAVAILABLE_IMAGE: 'Imagen no disponible',
3075
- REFRESH: 'Actualizar',
3076
- ACTIONS: 'Acciones',
3077
- FILTER: 'Filtro',
3078
- LAYOUT: 'Disposición: ',
3079
- NEW_LAYOUT: 'Nueva disposición',
3080
- DEFAULT_LAYOUT: 'Default',
3081
- LAYOUT_MODIFIED: 'La disposición actual ha sido modificada. Cree una nueva disposición, sobrescriba una existente o descarte los cambios', // eslint-disable-line
3082
- LAYOUT_NOT_MODIFIED: 'Cree una nueva disposición o aplique una de las disposiciones existentes',
3083
- LAYOUT_DISCART_CHANGES: 'Descartar los cambios',
3084
- },
3085
- },
3086
- });
3087
-
3088
- class TekGridLayoutOptions extends ComponentRender {
3089
- currentLayoutName = '';
3090
- layoutEdited = false;
3091
- layouts = {};
3092
- layoutNames = [];
3093
- viewApplyLayout;
3094
- viewGetCurrentLayout;
3095
- originalColumnProps = [];
3096
- originalDatasourceOrder = [];
3097
- originalDatasourceDynamicFilter = {};
3098
- originalDatasourceFilter = {};
3099
- grid;
3100
- getParentGrid() {
3101
- let { parent } = this;
3102
- while (parent && !(parent.constructor === Iterable || parent.constructor.prototype instanceof Iterable)) {
3103
- parent = parent.parent;
3104
- }
3105
- return parent;
3106
- }
3107
- async onMounted(element) {
3108
- super.onMounted(element);
3109
- this.grid = this.getParentGrid();
3110
- this.originalDatasourceOrder = [...this.grid.datasource.order];
3111
- this.originalDatasourceDynamicFilter = {
3112
- ...this.grid.datasource.dynamicFilter,
3113
- };
3114
- this.originalDatasourceFilter = { ...this.grid.datasource.filter };
3115
- this.originalColumnProps = this.grid.columns.map((column) => ({
3116
- name: column.name,
3117
- label: column.label,
3118
- align: column.align,
3119
- isVisible: column.isVisible,
3120
- minWidth: column.minWidth,
3121
- maxWidth: column.maxWidth,
3122
- width: column.width,
3123
- fixed: column.fixed,
3124
- grouped: column.grouped,
3125
- groupOpened: column.groupOpened,
3126
- aggregation: column.aggregation,
3127
- filterHelperValue: this.getHelperValue(column),
3128
- }));
3129
- let layoutsInfo = {};
3130
- const promise = this.loadLayoutsInfo();
3131
- if (this.grid instanceof TekGrid) {
3132
- this.grid.registerTask(promise);
3133
- }
3134
- layoutsInfo = await promise;
3135
- if (layoutsInfo.layouts) {
3136
- this.layouts = layoutsInfo.layouts;
3137
- this.layoutNames = Object.keys(this.layouts);
3138
- if (layoutsInfo.currentLayoutName) {
3139
- this.currentLayoutName = layoutsInfo.currentLayoutName;
3140
- this.applyLayout(this.currentLayoutName, false);
3141
- }
3142
- }
3143
- }
3144
- async loadLayoutsInfo() {
3145
- const eventFunction = this.events.loadLayouts || this.grid.events.loadLayouts;
3146
- if (eventFunction && typeof eventFunction === 'function') {
3147
- return eventFunction({ component: this.grid });
3148
- }
3149
- if (Config.loadGridLayoutsEndPoint) {
3150
- const route = Config.loadGridLayoutsEndPoint;
3151
- const response = await Http.get(`${route}?id=${this.grid.name}`);
3152
- const responseData = response.data.data;
3153
- return responseData.length && responseData[0] ? responseData[0].layouts : responseData.layouts || {};
3154
- }
3155
- return JSON.parse(localStorage.getItem(this.grid.name) || '{}');
3156
- }
3157
- getHelperValue(column) {
3158
- if (column instanceof TekGridColumn) {
3159
- if (!Array.isArray(column.filterProps))
3160
- return column.filterProps.helperValue;
3161
- return column.filterProps.map((prop) => prop.helperValue);
3162
- }
3163
- return '';
3164
- }
3165
- newLayout(layout) {
3166
- this.fixColumns(layout);
3167
- this.currentLayoutName = layout.name;
3168
- this.addLayout(layout);
3169
- this.layoutEdited = false;
3170
- }
3171
- addLayout(layout) {
3172
- this.fixColumns(layout);
3173
- this.layouts[layout.name] = layout;
3174
- this.saveLayouts();
3175
- }
3176
- discardChanges() {
3177
- const layoutSelected = this.layouts[this.currentLayoutName];
3178
- if (this.viewApplyLayout) {
3179
- this.viewApplyLayout(layoutSelected);
3180
- }
3181
- this.layoutEdited = false;
3182
- }
3183
- applyLayout(name, save = true) {
3184
- this.currentLayoutName = name;
3185
- const layoutSelected = this.layouts[name];
3186
- if (this.viewApplyLayout) {
3187
- this.viewApplyLayout(layoutSelected);
3188
- }
3189
- if (save) {
3190
- this.saveLayouts();
3191
- }
3192
- this.layoutEdited = false;
3193
- }
3194
- saveLayouts() {
3195
- this.layoutNames = Object.keys(this.layouts);
3196
- const layoutInfo = {
3197
- currentLayoutName: this.currentLayoutName,
3198
- layouts: this.layouts,
3199
- };
3200
- const eventFunction = this.events.saveLayouts || this.grid.events.saveLayouts;
3201
- if (eventFunction && typeof eventFunction === 'function') {
3202
- eventFunction({ component: this.grid, layouts: layoutInfo });
3203
- }
3204
- else if (Config.saveGridLayoutsEndPoint) {
3205
- const route = Config.saveGridLayoutsEndPoint;
3206
- Http.post(route, { id: this.grid.name, layouts: layoutInfo });
3207
- }
3208
- else {
3209
- localStorage.setItem(this.grid.name, JSON.stringify(layoutInfo));
3210
- }
3211
- }
3212
- deleteLayout(name) {
3213
- if (this.currentLayoutName === name) {
3214
- this.currentLayoutName = '';
3215
- this.applyLayout(this.currentLayoutName, false);
3216
- }
3217
- delete this.layouts[name];
3218
- this.saveLayouts();
3219
- }
3220
- updateLayout(name, layout) {
3221
- this.fixColumns(layout);
3222
- this.currentLayoutName = name;
3223
- layout.name = name;
3224
- this.layouts[layout.name] = layout;
3225
- this.saveLayouts();
3226
- this.layoutEdited = false;
3227
- }
3228
- updateDefaultLayout(layout) {
3229
- this.fixColumns(layout);
3230
- this.originalDatasourceOrder = layout.order || this.originalDatasourceOrder;
3231
- this.originalDatasourceDynamicFilter = layout.dynamicFilter || this.originalDatasourceDynamicFilter;
3232
- this.originalDatasourceFilter = layout.filter || this.originalDatasourceFilter;
3233
- if (layout.columns) {
3234
- this.originalColumnProps = layout.columns.map((column) => {
3235
- const originalColumnIdx = this.originalColumnProps.findIndex((item) => item.name === column.name);
3236
- const originalColumn = originalColumnIdx !== -1 ? this.originalColumnProps[originalColumnIdx] : {};
3237
- return {
3238
- ...originalColumn,
3239
- ...column,
3240
- };
3241
- });
3242
- }
3243
- if (this.currentLayoutName === '') {
3244
- this.applyLayout(this.currentLayoutName, false);
3245
- }
3246
- }
3247
- fixColumns(layout) {
3248
- const hasLayoutColumns = !!layout.columns;
3249
- layout.columns = layout.columns || [];
3250
- const layoutColumnNames = layout.columns.map((layoutColumn) => layoutColumn.name);
3251
- this.grid.columns.forEach((gridColumn) => {
3252
- if (!hasLayoutColumns || layoutColumnNames.indexOf(gridColumn.name) === -1) {
3253
- layout.columns.push({
3254
- name: gridColumn.name,
3255
- label: gridColumn.label,
3256
- align: gridColumn.align,
3257
- isVisible: !hasLayoutColumns && gridColumn.isVisible,
3258
- width: gridColumn.width,
3259
- minWidth: gridColumn.minWidth,
3260
- maxWidth: gridColumn.maxWidth,
3261
- fixed: gridColumn.fixed,
3262
- grouped: gridColumn.grouped,
3263
- groupOpened: gridColumn.groupOpened,
3264
- aggregation: gridColumn.aggregation,
3265
- filterHelperValue: this.getHelperValue(gridColumn),
3266
- });
3267
- }
3268
- });
3269
- }
3270
- }
3271
-
3272
- class TekGridColumnsButtonController extends IterableColumnsButtonController {
3273
- changeGroupedColumn(column, { component, event, element }) {
3274
- column.grouped = component.value;
3275
- if (!column.grouped) {
3276
- const index = this.iterableComponent.datasource.order.indexOf(`${column.name}.asc`);
3277
- this.iterableComponent.datasource.order.splice(index, 1);
3278
- }
3279
- this.iterableComponent.changeLayout(event, element);
3280
- }
3281
- changeAggregationColumn(column, { component, event, element }) {
3282
- const newValue = component.value || undefined;
3283
- if (column.aggregation !== newValue) {
3284
- this.iterableComponent.changeLayout(event, element);
3285
- }
3286
- column.aggregation = newValue;
3287
- }
3288
- showHideTekColumn(column, { component, event, element }) {
3289
- if (!component.value && column.grouped)
3290
- column.grouped = false;
3291
- column.isVisible = component.value;
3292
- this.iterableComponent.changeLayout(event, element);
3293
- }
3294
- }
3295
-
3296
- /**
3297
- * Base class for TekGrid Columns Button component
3298
- */
3299
- class TekGridColumnsButton extends IterableColumnsButton {
3300
- hideGroups = false;
3301
- constructor(props) {
3302
- super(props);
3303
- this.hideGroups = this.getInitValue('hideGroups', props.hideGroups, this.hideGroups);
3304
- this.createAccessors();
3305
- }
3306
- onCreated() {
3307
- super.onCreated();
3308
- Loader.addController(`IterableColumnsButtonController_${this.name}`, TekGridColumnsButtonController, [
3309
- this.iterableComponent,
3310
- ]);
3311
- this.controller = Loader.getInstance(`IterableColumnsButtonController_${this.name}`);
3312
- }
3313
- aggregationDataSet = [];
3314
- getAggregationSelectData() {
3315
- if (!this.aggregationDataSet.length) {
3316
- this.aggregationDataSet = columnAggregationValues.filter(Boolean).map((value) => ({
3317
- text: I18n.translate(`TEKGRID_AGGREGATION_${value}`),
3318
- value,
3319
- }));
3320
- }
3321
- return this.aggregationDataSet;
3322
- }
3323
- }
3324
-
3325
- class TekUserInfoController {
3326
- component;
3327
- get versionInfo() {
3328
- return this.component.versionInfo;
3329
- }
3330
- constructor(component) {
3331
- this.component = component;
3332
- }
3333
- get name() {
3334
- return this.versionInfo?.name || '';
3335
- }
3336
- set name(value) {
3337
- if (!this.versionInfo)
3338
- return;
3339
- this.versionInfo.name = value;
3340
- }
3341
- get version() {
3342
- return this.versionInfo?.version || '';
3343
- }
3344
- set version(value) {
3345
- if (!this.versionInfo)
3346
- return;
3347
- this.versionInfo.version = value;
3348
- }
3349
- get hasDefaultEmail() {
3350
- return !!this.component.defaultEmail;
3351
- }
3352
- get hasAboutImage() {
3353
- return !!this.component.aboutImage;
3354
- }
3355
- mergeText(name, version) {
3356
- return `<li>${name} - <b>${version}</b></li>`;
3357
- }
3358
- get mainVersion() {
3359
- if (!this.versionInfo?.name || !this.versionInfo.version)
3360
- return '';
3361
- return `${this.versionInfo.name} - <b>${this.versionInfo.version}</b>`;
3362
- }
3363
- getItems(tab) {
3364
- if (!this.versionInfo)
3365
- return [];
3366
- const tabInfo = this.versionInfo[tab];
3367
- return `<ul>${tabInfo.map((item) => this.mergeText(item.name, item.version)).join('')}</ul>`;
3368
- }
3369
- get frontendItems() {
3370
- return this.getItems('frontend');
3371
- }
3372
- get backendItems() {
3373
- return this.getItems('backend');
3374
- }
3375
- get modulesItems() {
3376
- return this.getItems('modules');
3377
- }
3378
- get showReportError() {
3379
- const { reportError } = this.component.visibleItems;
3380
- return reportError || reportError === undefined;
3381
- }
3382
- get showVersionInfo() {
3383
- const { versionInfo } = this.component.visibleItems;
3384
- return versionInfo || versionInfo === undefined;
3385
- }
3386
- get showAbout() {
3387
- const { about } = this.component.visibleItems;
3388
- return about || about === undefined;
3389
- }
3390
- }
3391
-
3392
- class TekUserInfo extends UserInfo {
3393
- aboutModal;
3394
- reportModal;
3395
- /**
3396
- * Data about the application version
3397
- */
3398
- versionInfo = null;
3399
- /**
3400
- * Default email address to be defined in the Report Bug form
3401
- */
3402
- defaultEmail = '';
3403
- /**
3404
- * Url from which the version info will be retrieved
3405
- */
3406
- versionUrl = '';
3407
- /**
3408
- * Path to the image to be shown on about modal
3409
- */
3410
- aboutImage = '';
3411
- propBottomSlot;
3412
- constructor(props) {
3413
- super(props);
3414
- this.versionInfo = this.getInitValue('versionInfo', props.versionInfo, this.versionInfo);
3415
- this.defaultEmail = this.getInitValue('defaultEmail', props.defaultEmail, this.defaultEmail);
3416
- this.versionUrl = this.getInitValue('versionUrl', props.versionUrl, this.versionUrl);
3417
- this.aboutImage = this.getInitValue('aboutImage', props.aboutImage, this.aboutImage);
3418
- this.createAccessors();
3419
- this.propBottomSlot = props.bottomSlot;
3420
- }
3421
- getBottomSlot() {
3422
- return [
3423
- {
3424
- name: `${this.name}_bottom_list`,
3425
- component: 'TekUserInfoList',
3426
- parentName: this.name,
3427
- },
3428
- ];
3429
- }
3430
- onAboutClick() {
3431
- if (!this.aboutModal) {
3432
- this.aboutModal = ModalService.create({
3433
- name: `${this.name}_about_modal`,
3434
- cssClass: 'about-modal',
3435
- grid: { cols: 8, sm: 4, lg: 5 },
3436
- children: [
3437
- {
3438
- name: `${this.name}_about_header`,
3439
- component: 'ZdHeader',
3440
- color: 'transparent',
3441
- padless: true,
3442
- elevation: 0,
3443
- rightSlot: [
3444
- {
3445
- name: `${this.name}_about_close_button`,
3446
- component: 'ZdModalCloseButton',
3447
- small: true,
3448
- modalName: `${this.name}_about_modal`,
3449
- },
3450
- ],
3451
- },
3452
- {
3453
- name: `${this.name}_about_row`,
3454
- component: 'ZdTag',
3455
- tag: 'div',
3456
- cssClass: 'zd-justify-center zd-px-6',
3457
- isVisible: `{{TekUserInfoController_${this.componentId}.hasAboutImage}}`,
3458
- children: [
3459
- {
3460
- name: `${this.name}_about_image`,
3461
- component: 'ZdImage',
3462
- width: '100%',
3463
- src: this.aboutImage,
3464
- },
3465
- ],
3466
- },
3467
- {
3468
- name: `${this.name}_version_tabs`,
3469
- cssClass: 'zd-pt-3 zd-tekUserInfo-tab',
3470
- component: 'ZdTabs',
3471
- tabs: [
3472
- {
3473
- name: `${this.name}_version_frontend_tab`,
3474
- tabTitle: 'Frontend',
3475
- children: this.getVersionTree('frontend'),
3476
- },
3477
- {
3478
- name: `${this.name}_version_backend_tab`,
3479
- tabTitle: 'Backend',
3480
- children: this.getVersionTree('backend'),
3481
- },
3482
- {
3483
- name: `${this.name}_version_modules_tab`,
3484
- tabTitle: 'Modules',
3485
- children: this.getVersionTree('modules'),
3486
- },
3487
- ],
3488
- },
3489
- ],
3490
- });
3491
- }
3492
- this.aboutModal.show();
3493
- }
3494
- getVersionTree(tab) {
3495
- if (!this.versionInfo)
3496
- return [];
3497
- const main = {
3498
- name: `${this.name}_version_${tab}_main`,
3499
- component: 'ZdText',
3500
- text: `{{TekUserInfoController_${this.componentId}.mainVersion}}`,
3501
- };
3502
- const itemsComponent = {
3503
- name: `${this.name}_version_${tab}`,
3504
- component: 'ZdText',
3505
- cssClass: 'zd-pl-4',
3506
- text: `{{TekUserInfoController_${this.componentId}.${tab}Items}}`,
3507
- };
3508
- return [main, itemsComponent];
3509
- }
3510
- onReportClick() {
3511
- if (!this.reportModal) {
3512
- this.reportModal = ModalService.create({
3513
- name: `${this.name}_report_modal`,
3514
- children: [
3515
- {
3516
- name: `${this.name}_report_header`,
3517
- component: 'ZdHeader',
3518
- color: 'transparent',
3519
- padless: true,
3520
- elevation: 0,
3521
- leftSlot: [
3522
- {
3523
- name: `${this.name}_report_title`,
3524
- component: 'ZdText',
3525
- text: 'TEKUSERINFO_REPORT_ERROR',
3526
- cssClass: 'zd-theme-font-title',
3527
- },
3528
- ],
3529
- rightSlot: [
3530
- {
3531
- name: `${this.name}_report_close_button`,
3532
- component: 'ZdModalCloseButton',
3533
- small: true,
3534
- modalName: `${this.name}_report_modal`,
3535
- },
3536
- ],
3537
- },
3538
- {
3539
- name: `${this.name}_report_form`,
3540
- component: 'ZdForm',
3541
- cssClass: 'zd-pt-4',
3542
- children: [
3543
- {
3544
- name: 'report_email',
3545
- component: 'ZdTextInput',
3546
- label: 'E-mail',
3547
- grid: {
3548
- cols: '12',
3549
- },
3550
- value: this.defaultEmail,
3551
- readonly: `{{TekUserInfoController_${this.componentId}.hasDefaultEmail}}`,
3552
- validations: {
3553
- required: {},
3554
- email: {},
3555
- },
3556
- },
3557
- {
3558
- name: 'report_cc',
3559
- component: 'ZdTextInput',
3560
- label: 'CC',
3561
- placeholder: 'TEKUSERINFO_EMAIL_PLACEHOLDER',
3562
- grid: {
3563
- cols: '12',
3564
- },
3565
- },
3566
- {
3567
- name: 'report_type',
3568
- component: 'ZdSelect',
3569
- label: 'TEKUSERINFO_TYPE',
3570
- dataValue: 'value',
3571
- dataText: 'text',
3572
- datasource: {
3573
- uniqueKey: 'value',
3574
- translate: true,
3575
- data: [
3576
- { value: '0', text: 'TEKUSERINFO_ERROR' },
3577
- { value: '1', text: 'TEKUSERINFO_IMPROVEMENT' },
3578
- ],
3579
- },
3580
- grid: {
3581
- cols: '12',
3582
- },
3583
- validations: {
3584
- required: {},
3585
- },
3586
- },
3587
- {
3588
- name: 'report_description',
3589
- component: 'ZdTextarea',
3590
- label: 'TEKUSERINFO_DESCRIPTION',
3591
- grid: {
3592
- cols: '12',
3593
- },
3594
- validations: {
3595
- required: {},
3596
- },
3597
- },
3598
- ],
3599
- },
3600
- {
3601
- name: `${this.name}_report_footer`,
3602
- component: 'ZdFooter',
3603
- color: 'transparent',
3604
- padless: true,
3605
- rightSlot: [
3606
- {
3607
- name: `${this.name}_report_cancel`,
3608
- component: 'ZdButton',
3609
- label: 'TEKUSERINFO_CANCEL',
3610
- outline: true,
3611
- events: {
3612
- click: () => { this.reportModal?.hide(); },
3613
- },
3614
- },
3615
- {
3616
- name: `${this.name}_report_send`,
3617
- component: 'ZdButton',
3618
- label: 'TEKUSERINFO_SEND',
3619
- events: {
3620
- click: (args) => this.onSendReport(args),
3621
- },
3622
- },
3623
- ],
3624
- },
3625
- ],
3626
- });
3627
- }
3628
- this.reportModal.show();
3629
- }
3630
- async onSendReport({ event, element }) {
3631
- if (!this.reportModal)
3632
- return;
3633
- const form = Metadata.getInstance(`${this.name}_report_form`);
3634
- const validation = await form.validate();
3635
- if (!validation.valid)
3636
- return;
3637
- this.callEvent('onSendReport', {
3638
- event, element, component: this, form,
3639
- });
3640
- this.reportModal.hide();
3641
- }
3642
- onCreated() {
3643
- super.onCreated();
3644
- Loader.addController(`TekUserInfoController_${this.componentId}`, TekUserInfoController, [this]);
3645
- this.bottomSlot = this.propBottomSlot ? this.propBottomSlot : this.getBottomSlot();
3646
- }
3647
- async onMounted(element) {
3648
- super.onMounted(element);
3649
- if (this.versionUrl) {
3650
- const res = await Http.get(this.versionUrl);
3651
- this.versionInfo = res.data.versionInfo;
3652
- }
3653
- }
3654
- }
3655
- Messages.add({
3656
- 'pt-BR': {
3657
- translation: {
3658
- TEKUSERINFO_ABOUT: 'Sobre',
3659
- TEKUSERINFO_REPORT_ERROR: 'Reportar Erro',
3660
- TEKUSERINFO_EMAIL_PLACEHOLDER: 'Separe e-mails usando ";"',
3661
- TEKUSERINFO_TYPE: 'Tipo',
3662
- TEKUSERINFO_ERROR: 'Erro',
3663
- TEKUSERINFO_IMPROVEMENT: 'Melhoria',
3664
- TEKUSERINFO_DESCRIPTION: 'Descrição',
3665
- TEKUSERINFO_CANCEL: 'Cancelar',
3666
- TEKUSERINFO_SEND: 'Enviar',
3667
- },
3668
- },
3669
- 'en-US': {
3670
- translation: {
3671
- TEKUSERINFO_ABOUT: 'About',
3672
- TEKUSERINFO_REPORT_ERROR: 'Report Bug',
3673
- TEKUSERINFO_EMAIL_PLACEHOLDER: 'Separate e-mails using ";"',
3674
- TEKUSERINFO_TYPE: 'Type',
3675
- TEKUSERINFO_ERROR: 'Bug',
3676
- TEKUSERINFO_IMPROVEMENT: 'Improvement',
3677
- TEKUSERINFO_DESCRIPTION: 'Description',
3678
- TEKUSERINFO_CANCEL: 'Cancel',
3679
- TEKUSERINFO_SEND: 'Send',
3680
- },
3681
- },
3682
- 'es-CL': {
3683
- translation: {
3684
- TEKUSERINFO_ABOUT: 'Sobre',
3685
- TEKUSERINFO_REPORT_ERROR: 'Reportar Error',
3686
- TEKUSERINFO_EMAIL_PLACEHOLDER: 'Separar e-mails usando ";"',
3687
- TEKUSERINFO_TYPE: 'Tipo',
3688
- TEKUSERINFO_ERROR: 'Error',
3689
- TEKUSERINFO_IMPROVEMENT: 'Mejora',
3690
- TEKUSERINFO_DESCRIPTION: 'Descripción',
3691
- TEKUSERINFO_CANCEL: 'Cancelar',
3692
- TEKUSERINFO_SEND: 'Enviar',
3693
- },
3694
- },
3695
- });
3696
-
3697
- class TekUserInfoList extends List {
3698
- /**
3699
- * Name of the user info component
3700
- */
3701
- parentName = '';
3702
- dense = true;
3703
- constructor(props) {
3704
- super(props);
3705
- this.parentName = props.parentName || '';
3706
- }
3707
- onCreated() {
3708
- super.onCreated();
3709
- this.items = this.getItems();
3710
- }
3711
- getItems() {
3712
- const parent = this.parentName ? Metadata.getInstance(this.parentName) : this.parent;
3713
- if (!(parent instanceof TekUserInfo)) {
3714
- throw Error(`Could not find the TekUserInfo component associated with ${this.name} TekUserInfoList`);
3715
- }
3716
- return [
3717
- {
3718
- name: `${parent.name}_version`,
3719
- component: 'ZdListItem',
3720
- title: `{{TekUserInfoController_${parent.componentId}.name}}`,
3721
- subtitle: `{{TekUserInfoController_${parent.componentId}.version}}`,
3722
- isVisible: `{{TekUserInfoController_${parent.componentId}.showVersionInfo}}`,
3723
- cssClass: 'zd-px-2',
3724
- },
3725
- {
3726
- name: `${parent.name}_about`,
3727
- component: 'ZdListItem',
3728
- title: 'TEKUSERINFO_ABOUT',
3729
- prependIcon: 'infoOutline',
3730
- cssClass: 'zd-px-2',
3731
- isVisible: `{{TekUserInfoController_${parent.componentId}.showAbout}}`,
3732
- events: {
3733
- click: () => parent.onAboutClick(),
3734
- },
3735
- },
3736
- {
3737
- name: `${parent.name}_report`,
3738
- component: 'ZdListItem',
3739
- title: 'TEKUSERINFO_REPORT_ERROR',
3740
- prependIcon: 'mdi-ladybug',
3741
- cssClass: 'zd-px-2',
3742
- isVisible: `{{TekUserInfoController_${parent.componentId}.showReportError}}`,
3743
- events: {
3744
- click: () => parent.onReportClick(),
3745
- },
3746
- },
3747
- ];
3748
- }
3749
- }
3750
-
3751
- Messages.add({
3752
- 'pt-BR': {
3753
- translation: {
3754
- NO_NOTIFICATIONS: 'Nenhuma Notificação',
3755
- MARK_ALL_AS_READ: 'Marcar todas como lidas',
3756
- NOTIFICATIONS: 'Notificações',
3757
- SEE_ALL_NOTIFICATIONS: 'Ver todas notificações',
3758
- UNAVAILABLE_IMAGE: 'Imagem indisponível',
3759
- REFRESH: 'Atualizar',
3760
- ACTIONS: 'Ações',
3761
- FILTER: 'Filtro',
3762
- LAYOUT: 'Layout: ',
3763
- NEW_LAYOUT: 'Novo layout',
3764
- DEFAULT_LAYOUT: 'Padrão',
3765
- LAYOUT_MODIFIED: 'O layout atual foi modificado. Crie um novo layout, sobrescreva um existente ou descarte as alterações', // eslint-disable-line
3766
- LAYOUT_NOT_MODIFIED: 'Crie um novo layout ou aplique um dos layouts já existentes',
3767
- LAYOUT_DISCART_CHANGES: 'Descartar alterações',
3768
- },
3769
- },
3770
- 'en-US': {
3771
- translation: {
3772
- NO_NOTIFICATIONS: 'No Notifications',
3773
- MARK_ALL_AS_READ: 'Mark all as read',
3774
- NOTIFICATIONS: 'Notifications',
3775
- SEE_ALL_NOTIFICATIONS: 'See all notifications',
3776
- UNAVAILABLE_IMAGE: 'Unavailable image',
3777
- REFRESH: 'Refresh',
3778
- ACTIONS: 'Actions',
3779
- FILTER: 'Filter',
3780
- LAYOUT: 'Layout: ',
3781
- NEW_LAYOUT: 'New layout',
3782
- DEFAULT_LAYOUT: 'Default',
3783
- LAYOUT_MODIFIED: 'The current layout has been modified. Create a new layout, overwrite an existing one or discard changes', // eslint-disable-line
3784
- LAYOUT_NOT_MODIFIED: 'Create a new layout or apply one of the existing layouts',
3785
- LAYOUT_DISCART_CHANGES: 'Discard changes',
3786
- },
3787
- },
3788
- 'es-CL': {
3789
- translation: {
3790
- NO_NOTIFICATIONS: 'Sin Notificación',
3791
- MARK_ALL_AS_READ: 'Marcar todo como leído',
3792
- NOTIFICATIONS: 'Notificaciones',
3793
- SEE_ALL_NOTIFICATIONS: 'Ver todas las notificaciones',
3794
- UNAVAILABLE_IMAGE: 'Imagen no disponible',
3795
- REFRESH: 'Actualizar',
3796
- ACTIONS: 'Acciones',
3797
- FILTER: 'Filtro',
3798
- LAYOUT: 'Disposición: ',
3799
- NEW_LAYOUT: 'Nueva disposición',
3800
- DEFAULT_LAYOUT: 'Default',
3801
- LAYOUT_MODIFIED: 'La disposición actual ha sido modificada. Cree una nueva disposición, sobrescriba una existente o descarte los cambios', // eslint-disable-line
3802
- LAYOUT_NOT_MODIFIED: 'Cree una nueva disposición o aplique una de las disposiciones existentes',
3803
- LAYOUT_DISCART_CHANGES: 'Descartar los cambios',
3804
- },
3805
- },
3806
- });
3807
-
3808
- export { BreadcrumbHeader, ButtonOption, ColumnsSearcher, DynamicFilterDatasourceFactory, DynamicFilterOperations, DynamicFilterRelations, GroupedDataManager, GroupedDataNavigator, GroupedDataSelector, KeyMapGrouped, Loading, MultiOption, TekFilterHelper, TekGrid, TekGridColumn, TekGridColumnsButton, TekGridColumnsButtonController, TekGridController, TekGridEvents, TekGridFilterButton, TekGridLayoutOptions, TekGridToolbarProvider, TekMemoryDatasource, TekRestDatasource, TekUserInfo, TekUserInfoList, columnAggregationValues, isFilledObject, isNil };