@zeedhi/teknisa-components-common 1.114.0 → 3.0.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 (88) hide show
  1. package/.package.json +40 -0
  2. package/dist/teknisa-components-common.js +112 -0
  3. package/dist/teknisa-components-common.min.js +112 -0
  4. package/dist/types/components/index.d.ts +2 -0
  5. package/{types → dist/types}/components/tek-breadcrumb-header/breadcrumb-header.d.ts +12 -12
  6. package/{types → dist/types}/components/tek-breadcrumb-header/interfaces.d.ts +6 -6
  7. package/{types → dist/types}/error/delete-rows-error.d.ts +6 -6
  8. package/dist/types/index.d.ts +1 -0
  9. package/environments.json +14 -0
  10. package/package.json +26 -18
  11. package/src/components/index.ts +108 -0
  12. package/src/components/tek-breadcrumb-header/breadcrumb-header.ts +29 -0
  13. package/src/components/tek-breadcrumb-header/interfaces.ts +7 -0
  14. package/src/error/delete-rows-error.ts +11 -0
  15. package/src/index.ts +1 -0
  16. package/tests/__helpers__/component-event-helper.ts +1 -1
  17. package/tests/__helpers__/get-child-helper.ts +1 -1
  18. package/tests/__helpers__/mock-created-helper.ts +1 -1
  19. package/tests/unit/components/crud/crud-button.spec.ts +1 -1
  20. package/tests/unit/components/tek-datasource/memory-datasource.spec.ts +1 -11
  21. package/tests/unit/components/tek-datasource/rest-datasource.spec.ts +5 -7
  22. package/tests/unit/components/tek-drag-grid/tek-drag-grid.spec.ts +1 -1
  23. package/tests/unit/components/tek-grid/grid-column.spec.ts +4 -4
  24. package/tests/unit/components/tek-grid/grid-filter-button.spec.ts +17 -11
  25. package/tests/unit/components/tek-grid/grid.spec.ts +45 -721
  26. package/tests/unit/components/tek-grid/layout_options.spec.ts +5 -7
  27. package/tests/unit/components/tek-user-info/tek-user-info-list.spec.ts +1 -1
  28. package/tests/unit/components/tek-user-info/tek-user-info.spec.ts +10 -14
  29. package/tests/unit/components/tree-grid/tree-grid.spec.ts +4 -28
  30. package/tests/unit/utils/grid-base/export-options/multi-option.spec.ts +2 -2
  31. package/tests/unit/utils/grid-base/grid-controller.spec.ts +17 -152
  32. package/tsconfig.build.json +7 -0
  33. package/dist/tek-components-common.esm.js +0 -4830
  34. package/dist/tek-components-common.umd.js +0 -4867
  35. package/tests/unit/utils/grid-base/delete-rows-error.spec.ts +0 -24
  36. package/types/components/crud/crud-add-button.d.ts +0 -38
  37. package/types/components/crud/crud-button.d.ts +0 -27
  38. package/types/components/crud/crud-cancel-button.d.ts +0 -28
  39. package/types/components/crud/crud-delete-button.d.ts +0 -42
  40. package/types/components/crud/crud-form.d.ts +0 -46
  41. package/types/components/crud/crud-save-button.d.ts +0 -24
  42. package/types/components/crud/interfaces.d.ts +0 -15
  43. package/types/components/index.d.ts +0 -41
  44. package/types/components/tek-card-title/card-title.d.ts +0 -14
  45. package/types/components/tek-card-title/interfaces.d.ts +0 -9
  46. package/types/components/tek-datasource/interfaces.d.ts +0 -16
  47. package/types/components/tek-datasource/memory-datasource.d.ts +0 -100
  48. package/types/components/tek-datasource/rest-datasource.d.ts +0 -103
  49. package/types/components/tek-drag-grid/interfaces.d.ts +0 -7
  50. package/types/components/tek-drag-grid/tek-drag-grid.d.ts +0 -36
  51. package/types/components/tek-grid/filter-helper.d.ts +0 -7
  52. package/types/components/tek-grid/grid-column.d.ts +0 -45
  53. package/types/components/tek-grid/grid-columns-button-controller.d.ts +0 -8
  54. package/types/components/tek-grid/grid-columns-button.d.ts +0 -12
  55. package/types/components/tek-grid/grid-filter-button.d.ts +0 -31
  56. package/types/components/tek-grid/grid.d.ts +0 -267
  57. package/types/components/tek-grid/interfaces.d.ts +0 -203
  58. package/types/components/tek-grid/layout-options.d.ts +0 -31
  59. package/types/components/tek-image/image.d.ts +0 -55
  60. package/types/components/tek-image/interfaces.d.ts +0 -12
  61. package/types/components/tek-iterable-carousel/interfaces.d.ts +0 -5
  62. package/types/components/tek-iterable-carousel/iterable-carousel.d.ts +0 -13
  63. package/types/components/tek-iterable-component-render/interfaces.d.ts +0 -3
  64. package/types/components/tek-iterable-component-render/iterable-component-render.d.ts +0 -10
  65. package/types/components/tek-loading/interfaces.d.ts +0 -6
  66. package/types/components/tek-loading/loading.d.ts +0 -24
  67. package/types/components/tek-notifications/interfaces.d.ts +0 -22
  68. package/types/components/tek-notifications/notifications.d.ts +0 -35
  69. package/types/components/tek-product-card/interfaces.d.ts +0 -19
  70. package/types/components/tek-product-card/product-card.d.ts +0 -66
  71. package/types/components/tek-tree-grid/interfaces.d.ts +0 -30
  72. package/types/components/tek-tree-grid/tree-grid.d.ts +0 -102
  73. package/types/components/tek-user-info/TekUserInfoController.d.ts +0 -21
  74. package/types/components/tek-user-info/interfaces.d.ts +0 -27
  75. package/types/components/tek-user-info/tek-user-info-list.d.ts +0 -31
  76. package/types/components/tek-user-info/tek-user-info.d.ts +0 -37
  77. package/types/error/incomplete-groups-error.d.ts +0 -8
  78. package/types/index.d.ts +0 -2
  79. package/types/utils/config/config.d.ts +0 -7
  80. package/types/utils/extract-properties.d.ts +0 -7
  81. package/types/utils/grid-base/export-options/button-option.d.ts +0 -16
  82. package/types/utils/grid-base/export-options/index.d.ts +0 -3
  83. package/types/utils/grid-base/export-options/interfaces.d.ts +0 -5
  84. package/types/utils/grid-base/export-options/multi-option.d.ts +0 -12
  85. package/types/utils/grid-base/grid-base.d.ts +0 -59
  86. package/types/utils/grid-base/grid-controller.d.ts +0 -27
  87. package/types/utils/index.d.ts +0 -6
  88. package/types/utils/report-filter/report-filter.d.ts +0 -12
@@ -1,4830 +0,0 @@
1
- import { KeyMap, I18n, FormatterParserProvider, Messages, Metadata, DatasourceFactory, MemoryDatasource, URL, Utils, RestDatasource, Config, Accessor, Loader, DateHelper, Http, Singleton, VersionService } from '@zeedhi/core';
2
- import { Form, Button, Tooltip, GridEditable, Grid, ComponentRender, Iterable, Carousel, IterableComponentRender as IterableComponentRender$1, Loading as Loading$1, GridColumnEditable, Report, EmptyDataError, AlertService, ColumnNotFoundError, IterableColumnsButtonController, IterableColumnsButton, ModalService, SelectMultiple, TreeGridEditable, List } from '@zeedhi/common';
3
- import debounce from 'lodash.debounce';
4
- import merge from 'lodash.merge';
5
- import { UserInfo } from '@zeedhi/zd-user-info-common';
6
- import { Draggable } from '@zeedhi/zd-drag-grid-common';
7
-
8
- /**
9
- * Form to be used on Crud operations
10
- */
11
- class CrudForm extends Form {
12
- /**
13
- * Create new Crud Form
14
- * @param props component properties
15
- */
16
- constructor(props) {
17
- super(props);
18
- /**
19
- * Form edit state
20
- */
21
- this.editing = false;
22
- if (Object.keys(this.value).length > 0) {
23
- this.setValue(this.value);
24
- }
25
- }
26
- setValue(value, autoSave = true) {
27
- this.value = value;
28
- this.unSavedValue = value;
29
- if (autoSave)
30
- this.saveEdit();
31
- }
32
- /**
33
- * Cancel edit and return value to original
34
- */
35
- cancelEdit() {
36
- this.editing = false;
37
- if (this.beforeEditValue) {
38
- this.value = this.beforeEditValue;
39
- }
40
- }
41
- /**
42
- * SaveEdit
43
- */
44
- saveEdit() {
45
- this.editing = false;
46
- this.beforeEditValue = Object.assign({}, this.unSavedValue);
47
- }
48
- /**
49
- * Update value using child input value
50
- * @param child child input
51
- * @param value input value
52
- */
53
- updateChild(child, value) {
54
- const valueKeys = Object.keys(this.value);
55
- const formChanged = valueKeys.some((key) => {
56
- const currValue = this.value[key];
57
- const prevValue = this.beforeEditValue ? this.beforeEditValue[key] : null;
58
- return this.nullCast(currValue) !== this.nullCast(prevValue);
59
- });
60
- if (!formChanged) {
61
- this.editing = false;
62
- return;
63
- }
64
- this.value[child.name] = value;
65
- this.editing = true;
66
- }
67
- nullCast(value) {
68
- return ['', null, undefined].includes(value) ? null : value;
69
- }
70
- onMounted(element) {
71
- this.cancelEdit();
72
- super.onMounted(element);
73
- element.addEventListener('focus', this.focus.bind(this), true);
74
- }
75
- /**
76
- * Form is focused
77
- */
78
- focus() {
79
- if (!this.beforeEditValue) {
80
- this.beforeEditValue = Object.assign({}, this.value);
81
- }
82
- }
83
- }
84
-
85
- /**
86
- * Button to be used on Crud Forms
87
- */
88
- class CrudButton extends Button {
89
- /**
90
- * Create new Crud Button
91
- * @param props component properties
92
- */
93
- constructor(props) {
94
- super(props);
95
- this.tooltipDefault = { name: 'crud-button-tooltip', component: 'ZdTooltip', bottom: true };
96
- this.clickShortcutKey = props.clickShortcutKey;
97
- this.tooltip = new Tooltip(Object.assign(Object.assign({}, this.tooltipDefault), props.tooltip));
98
- if (this.clickShortcutKey) {
99
- this.keyMap = Object.assign(Object.assign({}, this.keyMap), { [this.clickShortcutKey]: {
100
- event: this.shortcutClick.bind(this),
101
- stop: true,
102
- active: true,
103
- input: true,
104
- } });
105
- }
106
- }
107
- shortcutClick({ event, element }) {
108
- if (!this.disabled) {
109
- this.click(event, element);
110
- }
111
- }
112
- initKeyMap(parentElement) {
113
- KeyMap.bind(this.keyMap, this, parentElement);
114
- }
115
- /**
116
- * Return if parent (form or grid) is editing
117
- */
118
- get parentIsEditing() {
119
- if (this.parent instanceof CrudForm) {
120
- return this.parent.editing;
121
- }
122
- if (this.parent instanceof GridEditable) {
123
- return this.parent.editing;
124
- }
125
- return false;
126
- }
127
- }
128
-
129
- /**
130
- * Button to be used on Crud Forms
131
- */
132
- class CrudAddButton extends CrudButton {
133
- /**
134
- * Create new Crud Add Button
135
- * @param props component properties
136
- */
137
- constructor(props) {
138
- super(Object.assign(Object.assign({}, props), { clickShortcutKey: props.clickShortcutKey || 'f2' }));
139
- /**
140
- * Button tooltip
141
- */
142
- this.defaultTooltip = 'ADD';
143
- /**
144
- * Button flat
145
- */
146
- this.defaultFlat = true;
147
- /**
148
- * Button icon
149
- */
150
- this.defaultIcon = true;
151
- /**
152
- * Button icon name
153
- */
154
- this.defaultIconName = 'plus';
155
- /**
156
- * Button icon color
157
- */
158
- this.defaultColor = '#666';
159
- this.flat = props.flat !== undefined ? this.flat : this.defaultFlat;
160
- this.icon = props.icon !== undefined ? this.icon : this.defaultIcon;
161
- this.iconName = props.iconName !== undefined ? this.iconName : this.defaultIconName;
162
- this.color = props.color !== undefined ? this.color : this.defaultColor;
163
- this.tooltip.label = this.tooltip.label || `${I18n.translate(this.defaultTooltip)} (${props.clickShortcutKey || 'f2'})`;
164
- }
165
- /**
166
- * Triggered when the component is clicked.
167
- * @param event DOM event
168
- * @param element Element clicked
169
- */
170
- click(event, element) {
171
- super.click(event, element);
172
- }
173
- }
174
-
175
- /**
176
- * Button to be used on Crud Forms
177
- */
178
- class CrudCancelButton extends CrudButton {
179
- /**
180
- * Create new Crud Cancel Button
181
- * @param props component properties
182
- */
183
- constructor(props) {
184
- super(Object.assign(Object.assign({}, props), { clickShortcutKey: props.clickShortcutKey || 'esc' }));
185
- /**
186
- * Button label
187
- */
188
- this.defaultLabel = 'CANCEL';
189
- /**
190
- * Button outline
191
- */
192
- this.defaultOutline = true;
193
- this.label = props.label ? this.label : this.defaultLabel;
194
- this.outline = props.outline !== undefined ? this.outline : this.defaultOutline;
195
- this.tooltip.label = this.tooltip.label || `${I18n.translate(this.defaultLabel)} (${props.clickShortcutKey || 'esc'})`;
196
- }
197
- /**
198
- * Triggered when the component is clicked.
199
- * @param event DOM event
200
- * @param element Element clicked
201
- */
202
- click(event, element) {
203
- if (this.parent instanceof CrudForm) {
204
- super.click(event, element);
205
- if (!event.defaultPrevented) {
206
- this.parent.cancelEdit();
207
- }
208
- }
209
- else if (this.parent instanceof GridEditable) {
210
- super.click(event, element);
211
- if (!event.defaultPrevented) {
212
- this.parent.cancelEditedRows();
213
- }
214
- }
215
- }
216
- get disabled() {
217
- return !this.parentIsEditing;
218
- }
219
- set disabled(_value) {
220
- // do nothing
221
- }
222
- }
223
-
224
- /**
225
- * Button to be used on Crud Forms
226
- */
227
- class CrudDeleteButton extends CrudButton {
228
- /**
229
- * Create new Crud Delete Button
230
- * @param props component properties
231
- */
232
- constructor(props) {
233
- super(Object.assign(Object.assign({}, props), { clickShortcutKey: props.clickShortcutKey || 'ctrl+d' }));
234
- /**
235
- * Button tooltip
236
- */
237
- this.defaultTooltip = 'DELETE';
238
- /**
239
- * Button flat
240
- */
241
- this.defaultFlat = true;
242
- /**
243
- * Button icon
244
- */
245
- this.defaultIcon = true;
246
- /**
247
- * Button icon name
248
- */
249
- this.defaultIconName = 'trashCanOutline';
250
- /**
251
- * Button icon color
252
- */
253
- this.defaultColor = '#666';
254
- this.flat = props.flat !== undefined ? this.flat : this.defaultFlat;
255
- this.icon = props.icon !== undefined ? this.icon : this.defaultIcon;
256
- this.iconName = props.iconName !== undefined ? this.iconName : this.defaultIconName;
257
- this.color = props.color !== undefined ? this.color : this.defaultColor;
258
- const label = `${I18n.translate(this.defaultTooltip)} (${props.clickShortcutKey || 'ctrl+d'})`;
259
- this.tooltip.label = this.tooltip.label || label;
260
- }
261
- /**
262
- * Triggered when the component is clicked.
263
- * @param event DOM event
264
- * @param element Element clicked
265
- */
266
- click(event, element) {
267
- super.click(event, element);
268
- }
269
- get parentHasCurrentRow() {
270
- if (!(this.parent instanceof Grid))
271
- return false;
272
- const grid = this.parent;
273
- return !grid.selectable && grid.datasource.currentRow[grid.datasource.uniqueKey];
274
- }
275
- get parentHasSelectedRows() {
276
- if (!(this.parent instanceof Grid))
277
- return false;
278
- const grid = this.parent;
279
- return grid.selectable && grid.selectedRows.length !== 0;
280
- }
281
- get disabled() {
282
- return this.parentIsEditing || (!this.parentHasCurrentRow && !this.parentHasSelectedRows);
283
- }
284
- set disabled(_value) {
285
- // do nothing
286
- }
287
- }
288
-
289
- /**
290
- * Button to be used on Crud Forms
291
- */
292
- class CrudSaveButton extends CrudButton {
293
- /**
294
- * Create new Crud Save Button
295
- * @param props component properties
296
- */
297
- constructor(props) {
298
- super(Object.assign(Object.assign({}, props), { clickShortcutKey: props.clickShortcutKey || 'ctrl+enter' }));
299
- /**
300
- * Button label
301
- */
302
- this.defaultLabel = 'SAVE';
303
- this.label = this.label || this.defaultLabel;
304
- const label = `${I18n.translate(this.defaultLabel)} (${props.clickShortcutKey || 'ctrl+enter'})`;
305
- this.tooltip.label = this.tooltip.label || label;
306
- }
307
- /**
308
- * Triggered when the component is clicked.
309
- * @param event DOM event
310
- * @param element Element clicked
311
- */
312
- click(event, element) {
313
- if (this.parent instanceof CrudForm) {
314
- const form = this.parent;
315
- if (form.validate()) {
316
- super.click(event, element);
317
- if (!event.defaultPrevented) {
318
- form.saveEdit();
319
- }
320
- }
321
- }
322
- else if (this.parent instanceof GridEditable) {
323
- super.click(event, element);
324
- if (!event.defaultPrevented) {
325
- this.parent.saveEditedRows();
326
- }
327
- }
328
- }
329
- get disabled() {
330
- return !this.parentIsEditing;
331
- }
332
- set disabled(_value) {
333
- // do nothing
334
- }
335
- }
336
-
337
- /**
338
- * BreadcrumbHeader join breadcrumb and title
339
- */
340
- class BreadcrumbHeader extends ComponentRender {
341
- constructor(props) {
342
- super(props);
343
- this.title = '';
344
- this.rightSlot = [];
345
- this.breadcrumb = this.getBreadcrumbProperties(props.breadcrumb);
346
- this.title = this.getInitValue('title', props.title, this.title);
347
- this.rightSlot = props.rightSlot || this.rightSlot;
348
- }
349
- getBreadcrumbProperties(breadcrumb) {
350
- return Object.assign(Object.assign({}, breadcrumb), { name: breadcrumb.name, component: 'ZdBreadcrumb', divider: '>' });
351
- }
352
- }
353
-
354
- /**
355
- * CardTitle component join an icon, title, rightSlot and a divider
356
- */
357
- class CardTitle extends ComponentRender {
358
- constructor(props) {
359
- super(props);
360
- this.title = '';
361
- this.subtitle = '';
362
- this.iconName = '';
363
- this.rightSlot = [];
364
- this.showDivider = true;
365
- this.to = '';
366
- this.title = this.getInitValue('title', props.title, this.title);
367
- this.subtitle = this.getInitValue('subtitle', props.subtitle, this.subtitle);
368
- this.iconName = this.getInitValue('iconName', props.iconName, this.iconName);
369
- this.rightSlot = props.rightSlot || this.rightSlot;
370
- this.showDivider = this.getInitValue('showDivider', props.showDivider, this.showDivider);
371
- this.to = this.getInitValue('to', props.to, this.to);
372
- this.createAccessors();
373
- }
374
- }
375
-
376
- /**
377
- * Teknisa component
378
- */
379
- class Image extends ComponentRender {
380
- /**
381
- * Creates a new instance of ImgLink
382
- * @param props Image Link props
383
- */
384
- constructor(props) {
385
- super(props);
386
- /**
387
- * Route path
388
- */
389
- this.to = '';
390
- /**
391
- * Image source.
392
- */
393
- this.src = '';
394
- /**
395
- * Defines the component height. Possible values for this property can be
396
- * <samp>'auto', '100%', '400px' or 400</samp>
397
- */
398
- this.height = 'auto';
399
- /**
400
- * Defines the component min height. Possible values for this property can be
401
- * <samp>'auto', '100%', '400px' or 400</samp>
402
- */
403
- this.minHeight = 'auto';
404
- /**
405
- * Defines the component max height. Possible values for this property can be
406
- * <samp>'auto', '100%', '400px' or 400</samp>
407
- */
408
- this.maxHeight = 'none';
409
- /**
410
- * Set component height to fill all space available
411
- */
412
- this.fillHeight = false;
413
- /**
414
- * Defines the component width. Possible values for this property can be
415
- * <samp>'auto', '100%', '400px' or 400</samp>
416
- */
417
- this.width = 'auto';
418
- /**
419
- * Defines the component min width. Possible values for this property can be
420
- * <samp>'auto', '100%', '400px' or 400</samp>
421
- */
422
- this.minWidth = 'auto';
423
- /**
424
- * Defines the component max height. Possible values for this property can be
425
- * <samp>'auto', '100%', '400px' or 400</samp>
426
- */
427
- this.maxWidth = 'none';
428
- this.to = this.getInitValue('to', props.to, this.to);
429
- this.src = this.getInitValue('src', props.src, this.src);
430
- this.height = this.getInitValue('height', props.height, this.height);
431
- this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
432
- this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
433
- this.fillHeight = this.getInitValue('fillHeight', props.fillHeight, this.fillHeight);
434
- this.width = this.getInitValue('width', props.width, this.width);
435
- this.minWidth = this.getInitValue('minWidth', props.minWidth, this.minWidth);
436
- this.maxWidth = this.getInitValue('maxWidth', props.maxWidth, this.maxWidth);
437
- this.createAccessors();
438
- }
439
- load(event, element) {
440
- this.callEvent('load', { event, element, component: this });
441
- }
442
- }
443
-
444
- /**
445
- * Teknisa product card component
446
- */
447
- class ProductCard extends ComponentRender {
448
- /**
449
- * Creates a new instance of ProductCard
450
- * @param props Product Card props
451
- */
452
- constructor(props) {
453
- super(props);
454
- /**
455
- * Route path.
456
- */
457
- this.to = '';
458
- /**
459
- * Product Id.
460
- */
461
- this.id = '';
462
- /**
463
- * Image source Product.
464
- */
465
- this.src = '';
466
- /**
467
- * Product name.
468
- */
469
- this.productName = '';
470
- /**
471
- * Path to image to be shown when error
472
- */
473
- this.errorImagePath = '';
474
- /**
475
- * Text to be shown when error
476
- */
477
- this.errorImageText = 'UNAVAILABLE_IMAGE';
478
- /**
479
- * Card width
480
- */
481
- this.width = '';
482
- /**
483
- * Sets the height for the component.
484
- */
485
- this.height = 'auto';
486
- /**
487
- * Sets the maximum height for the component.
488
- */
489
- this.maxHeight = 'none';
490
- /**
491
- * Sets the minimum height for the component.
492
- */
493
- this.minHeight = 'none';
494
- this.currencyFormatterFn = FormatterParserProvider.getFormatter('ZdCurrency');
495
- this.id = this.getInitValue('id', props.id, this.id);
496
- this.productName = this.getInitValue('productName', props.productName, this.productName);
497
- this.productSupplier = this.getInitValue('productSupplier', props.productSupplier, this.productSupplier);
498
- this.productBrand = this.getInitValue('productBrand', props.productBrand, this.productBrand);
499
- this.productPrice = this.getInitValue('productPrice', props.productPrice, this.productPrice);
500
- this.to = this.getInitValue('to', props.to, this.to);
501
- this.src = this.getInitValue('src', props.src, this.src);
502
- this.errorImagePath = this.getInitValue('errorImagePath', props.errorImagePath, this.errorImagePath);
503
- this.errorImageText = this.getInitValue('errorImageText', props.errorImageText, this.errorImageText);
504
- this.width = this.getInitValue('width', props.width, this.width);
505
- this.height = this.getInitValue('height', props.height, this.height);
506
- this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
507
- this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
508
- this.createAccessors();
509
- }
510
- get productPriceFormat() {
511
- const price = +(this.productPrice || 0);
512
- return this.currencyFormatterFn(price);
513
- }
514
- }
515
-
516
- /**
517
- * Base class for IterableComponentRender component.
518
- * This component uses every row returned by Iterable.datasource to render
519
- * components defined by componentMetadata property.
520
- * If the data inside the datasource is changed you should perform
521
- * a datasource.get() to force updating the rendered components.
522
- */
523
- class IterableComponentRender extends Iterable {
524
- }
525
-
526
- /**
527
- * Base class for IterableCarousel component.
528
- * This component uses every row returned by IterableComponentRender.datasource to render
529
- * slides defined by componentMetadata property, inside a carousel component.
530
- */
531
- class IterableCarousel extends Carousel {
532
- constructor(props) {
533
- super(props);
534
- this.iterable = new IterableComponentRender$1(Object.assign(Object.assign({}, props.iterable), { name: `${props.name}_iterable`, component: 'TekIterableComponentRender' }));
535
- }
536
- get children() {
537
- var _a, _b;
538
- return ((_b = (_a = this.iterable) === null || _a === void 0 ? void 0 : _a.datasource) === null || _b === void 0 ? void 0 : _b.data.map(this.iterable.getComponentMetadata.bind(this.iterable))) || [];
539
- }
540
- set children(value) {
541
- if (value && value.length) {
542
- throw new Error('You should not change children when using IterableCarousel');
543
- }
544
- }
545
- }
546
-
547
- // eslint-disable-next-line
548
- const loading = 'data:image/gif;base64,R0lGODlhlgCWAPf/AC1oxPa+ADarUdmsFEB/m0yTcjiMhEafWjFova2SNDZotX10VsOfJDlosFZnge25BnJtXTukVWVmaFh1eIuOZ1x0ZEFopHpyWGFpcS5ow+q2CVNnhmVnZvW9AW5qYUyKXUJnofW+AKWNOV9mcS9owZuGQTporlCGXbWXLmNrazxnqeKyDoGDZVFniFZ6ZNSpGJ+IPoR4Ud+wEURnnmtpYklnlll5YbGUMcagIk5njmhnZWpoZGF0aWBmbkdnmbyaKUtnlEaBfWdmZTNou0WUW5WDRFtmeGZmZ82kHqecTXqIdzRouGJmbPC6BIB2VDxnrGNmakyHYPO8AkxnkUh0qmRpZl9wZVxndmRmaVhnffS9AqmPN09ni96vEUmQWzBowC1ow2FtZVR3gl5ndFGCYEVnnF1mdGR9i1dnf7qZK4l7TnRvXOK1FD6eV8ijIG6Cgl58lF1rfEBnpFVsi1pmeo5+Sk56dz9np5OCRjaqUi5pxNarFndwWmN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JZr7rnopqvuuuy26+678MYr77z01mvvvfjmq+++/Pbr778AByzwwAQXbPDBCCes8MIMN+zwwxBHLPHEFFds8cUYZ6zxxhx37PHHIIcs8sgkl2zyySinrPLKLLfs8sswxyzzzDTXbPPN3gYEACH5BAkEAP8ALAAAAACWAJYAAAj/AP8JHEiwoMGDCBMqXMiwocOHECNKnEixosWLGDNq3Mixo8ePIEOKHEmypMmTKFOqXMmypcuXMGPKnEmzps2bOHPq3Mmzp8+fQIMKHUq0qNGjSJMqXcq0qdOnUKNKnUq1qtWrWLNq3cr155ExDjZsyDKiK8weU4R9AcAWTCgTLcyulFBrCdu7eAHITSmhEpi8gPeirJEBcGDBJR0UNpwXMUksChgfdhxyg+TJlD/eudw480cmdjnf9fxxDAnRo0l3vII6teqNZhajfs1xBILWemlrlNAAt+6NNXz/zjji9OzhGSu1Rp6RSW/RzDOaicw5esZJrqpbx4iFiynZd0mYgtiuEQuaSndMmJAzhY4E8vDjy59Pv779+/jz69/Pv7///wAGKOCABBZo4IEIJqjgggw26OCDEEYo4YQUVmjhhRhmqOGGHHbo4YcghijiiCSWaOKJKKao4oostujiizDGKOOMNNZo44045qjjjjz26OOPQAYp5JBEFmnkkUgmqSRVAQEAIfkEBQQA/wAsAAAAAJYAlgAACPEA/wkcSLCgwYMIEypcyLChw4cQI0qcSLGixYsYM2rcyLGjx48gQ4ocSbKkyZMoU6pcybKly5cwY8qcSbOmzZs4c+rcybOnz59AgwodSrSo0aNIkypdyrSp06dQo0qdSrWq1atYs2rdyrWr169gw4odS7as2bNo06pdy7at27dw48qdS7eu3bt48+rdy7ev37+AAwseTLiw4cOIEytezLix48eQI0ueTLmy5cuYM2vezLmz58+gQ4seTbq06dOoU6tezbq169ewY8ueTbu27du4c+vezbu379/AgwsfTry48ePIkytfzry58+fQo0ufbjggACH5BAUEAP8ALAAAAAABAAEAAAgEAP8FBAA7';
549
- /**
550
- * Teknisa component
551
- */
552
- class Loading extends Loading$1 {
553
- /**
554
- * Creates a new instance of TekLoading
555
- * @param props Image Link props
556
- */
557
- constructor(props) {
558
- super(props);
559
- /**
560
- * text to show in Loader Overlay
561
- */
562
- this.text = '';
563
- /**
564
- * zIndex value.
565
- */
566
- this.zIndex = '999';
567
- /**
568
- * loading path.
569
- */
570
- this.image = loading;
571
- this.text = this.getInitValue('text', props.text, this.text);
572
- this.zIndex = this.getInitValue('zIndex', props.zIndex, this.zIndex);
573
- this.image = this.getInitValue('image', props.image, this.image);
574
- }
575
- }
576
-
577
- /**
578
- * Notifications component is used to show notifications
579
- */
580
- class Notifications extends Iterable {
581
- constructor(props) {
582
- super(props);
583
- this.allNotificationsPath = '';
584
- this.cardTitle = {
585
- name: 'notification-card-title',
586
- component: 'TekCardTitle',
587
- title: 'NOTIFICATIONS',
588
- rightSlot: [
589
- {
590
- name: 'mark-read-tag',
591
- component: 'ZdTag',
592
- tag: 'a',
593
- events: {
594
- click: this.markAsRead.bind(this),
595
- },
596
- children: [
597
- {
598
- name: 'mark-read-text',
599
- cssClass: 'mark-read-text',
600
- component: 'ZdText',
601
- text: 'MARK_ALL_AS_READ',
602
- },
603
- ],
604
- },
605
- ],
606
- };
607
- this.allNotificationsPath = this.getInitValue('allNotificationsPath', props.allNotificationsPath, this.allNotificationsPath);
608
- this.createAccessors();
609
- }
610
- markAsRead({ event, element }) {
611
- this.callEvent('markAllAsReadClick', { event, element, component: this });
612
- }
613
- showAll(event, element) {
614
- this.callEvent('showAllClick', { event, element, component: this });
615
- }
616
- notificationClick(event, notification, element) {
617
- this.callEvent('notificationClick', {
618
- event, notification, element, component: this,
619
- });
620
- }
621
- }
622
-
623
- const tuple = (...args) => args;
624
- const columnAggregationValues = tuple('SUM', 'MIN', 'MAX', 'AVG', 'COUNT', undefined);
625
-
626
- /*! *****************************************************************************
627
- Copyright (c) Microsoft Corporation.
628
-
629
- Permission to use, copy, modify, and/or distribute this software for any
630
- purpose with or without fee is hereby granted.
631
-
632
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
633
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
634
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
635
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
636
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
637
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
638
- PERFORMANCE OF THIS SOFTWARE.
639
- ***************************************************************************** */
640
-
641
- function __decorate(decorators, target, key, desc) {
642
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
643
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
644
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
645
- return c > 3 && r && Object.defineProperty(target, key, r), r;
646
- }
647
-
648
- function __awaiter(thisArg, _arguments, P, generator) {
649
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
650
- return new (P || (P = Promise))(function (resolve, reject) {
651
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
652
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
653
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
654
- step((generator = generator.apply(thisArg, _arguments || [])).next());
655
- });
656
- }
657
-
658
- /**
659
- * Class to translate a TekRestDatasource dynamicFilter to the ZhReports format
660
- */
661
- class ReportFilter {
662
- constructor(filter) {
663
- this.filter = {};
664
- this.messages = {
665
- CONTAINS: 'TEKGRID_CONTAINS',
666
- NOT_CONTAINS: 'TEKGRID_NOT_CONTAINS',
667
- EQUALS: 'TEKGRID_EQUALS',
668
- NOT_EQUAL: 'TEKGRID_NOT_EQUALS',
669
- GREATER_THAN: 'TEKGRID_GREATER_THAN',
670
- LESS_THAN: 'TEKGRID_LESS_THAN',
671
- GREATER_THAN_EQUALS: 'TEKGRID_GREATER_THAN_EQUALS',
672
- LESS_THAN_EQUALS: 'TEKGRID_LESS_THAN_EQUALS',
673
- IN: 'TEKGRID_IN',
674
- NOT_IN: 'TEKGRID_NOT_IN',
675
- BETWEEN: 'TEKGRID_BETWEEN',
676
- AND: 'TEKGRID_AND',
677
- OR: 'TEKGRID_OR',
678
- };
679
- this.filter = filter;
680
- }
681
- build() {
682
- return Object.keys(this.filter).map((key) => {
683
- const items = this.filter[key];
684
- const words = [];
685
- items.forEach((item, index) => {
686
- const operation = this.messages[item.operation];
687
- words.push(I18n.translate(operation));
688
- words.push(item.value);
689
- const isLast = index === items.length - 1;
690
- if (!isLast) {
691
- const next = items[index + 1];
692
- const relation = this.messages[next.relation];
693
- words.push(I18n.translate(relation));
694
- }
695
- });
696
- const value = words.join(' ').trim();
697
- return {
698
- value,
699
- label: key,
700
- };
701
- });
702
- }
703
- }
704
-
705
- /**
706
- * Delete rows error
707
- */
708
- class TekGridDeleteRowsError extends Error {
709
- constructor() {
710
- super('TekGrid can\'t automatically delete rows when selectAllPages property is true.'
711
- + ' You should delete them manually using the beforeDelete event and preventing'
712
- + ' the default execution');
713
- this.name = 'TekGridDeleteRowsError';
714
- }
715
- }
716
-
717
- class ButtonOption {
718
- constructor(config) {
719
- this.config = config;
720
- }
721
- buildComponent(grid) {
722
- const { type, label, portrait = true, iconName, } = this.config;
723
- const orientation = portrait ? 'portrait' : 'landscape';
724
- return {
725
- label,
726
- iconName,
727
- name: `${grid.name}_export_${type}_${orientation}`,
728
- component: 'ZdButton',
729
- flat: true,
730
- events: {
731
- click: () => grid.getReport(type, portrait),
732
- },
733
- };
734
- }
735
- }
736
-
737
- class MultiOption {
738
- constructor(config) {
739
- this.config = config;
740
- }
741
- formatName(id, type, grid) {
742
- return `${grid.name}_export_${type}_${id}`;
743
- }
744
- buildTooltip(option, type, grid) {
745
- const { label } = option;
746
- return {
747
- name: this.formatName(`tooltip_${label}`, type, grid),
748
- component: 'ZdTooltip',
749
- bottom: true,
750
- label,
751
- children: [],
752
- };
753
- }
754
- buildButton(option, type, grid) {
755
- const { cssClass, label, iconName, reportParams, } = option;
756
- const { portrait: optionPortrait, rowObj } = reportParams || {};
757
- return {
758
- name: this.formatName(`button_${label}`, type, grid),
759
- component: 'ZdButton',
760
- cssClass,
761
- icon: true,
762
- iconName,
763
- events: {
764
- click: () => grid.getReport(type, optionPortrait, rowObj),
765
- },
766
- };
767
- }
768
- buildDivider(option, type, grid) {
769
- const { label } = option;
770
- return {
771
- name: this.formatName(`divider_${label}`, type, grid),
772
- component: 'ZdDivider',
773
- cssClass: 'zd-my-1',
774
- vertical: true,
775
- };
776
- }
777
- buildComponent(grid) {
778
- const { type, label, multiOption, } = this.config;
779
- const optionComponents = multiOption.map((option) => ([
780
- Object.assign(Object.assign({}, this.buildTooltip(option, type, grid)), { children: [
781
- this.buildButton(option, type, grid),
782
- ] }),
783
- this.buildDivider(option, type, grid),
784
- ]))
785
- .flat();
786
- optionComponents.pop();
787
- const text = {
788
- name: this.formatName('text', type, grid),
789
- component: 'ZdText',
790
- cssClass: 'zd-display-flex zd-align-center zd-flex-grow-1 tek-grid-export-multioption-text',
791
- events: {
792
- click: ({ event }) => event === null || event === void 0 ? void 0 : event.stopPropagation(),
793
- },
794
- text: label || '',
795
- };
796
- const result = {
797
- name: this.formatName('row', type, grid),
798
- component: 'ZdRow',
799
- cssClass: 'zd-display-flex zd-ma-0 zd-py-0 zd-gap-x-1 tek-grid-export-multioption-row',
800
- children: [text, ...optionComponents],
801
- };
802
- return result;
803
- }
804
- }
805
-
806
- class GridBase {
807
- constructor(grid) {
808
- this.exportConfigButtons = [];
809
- this.defaultToolbar = {};
810
- this.atoms = {
811
- TITLE: '_gridTitle',
812
- HIDE_BUTTON: '_hideButton',
813
- ADD_BUTTON: '_addButton',
814
- DELETE_BUTTON: '_deleteButton',
815
- REFRESH_BUTTON: '_refreshButton',
816
- COLUMNS_BUTTON: '_columnsButton',
817
- LAYOUT_BUTTON: '_layout_options',
818
- EXPORT_BUTTON: '_exportButton',
819
- ACTIONS_BUTTON: '_actionsButton',
820
- SAVE_BUTTON: '_saveButton',
821
- CANCEL_BUTTON: '_cancelButton',
822
- SEARCH: '_gridSearch',
823
- FILTER_BUTTON: '_filterButton',
824
- FILTER_MODAL: '-filter-modal',
825
- FILTER_FORM: '-filter-form',
826
- EXPORT_DROPDOWN: '_export_dropdown',
827
- ACTIONS_DROPDOWN: '_actions_dropdown',
828
- };
829
- this.grid = grid;
830
- this.exportConfigButtons = this.getExportConfigButtons();
831
- this.initializeDefaultToolbarItems();
832
- }
833
- getOption(config) {
834
- if (config.multiOption)
835
- return new MultiOption(config);
836
- return new ButtonOption(config);
837
- }
838
- getExportConfigButtons() {
839
- return this.grid.exportConfig.map((config) => {
840
- const option = this.getOption(config);
841
- return option.buildComponent(this.grid);
842
- });
843
- }
844
- initializeDefaultToolbarItems() {
845
- this.defaultToolbar = {
846
- title: () => ({
847
- name: `${this.grid.name}_title`,
848
- component: 'ZdText',
849
- cssClass: 'toolbar-title',
850
- tag: 'h2',
851
- text: this.grid.title,
852
- title: this.grid.title,
853
- }),
854
- hideButton: () => ({
855
- name: `${this.grid.name}_hideTooltip`,
856
- component: 'ZdTooltip',
857
- label: 'TEKGRID_HIDE',
858
- bottom: true,
859
- children: [
860
- {
861
- name: `${this.grid.name}_hideButton`,
862
- component: 'ZdIcon',
863
- iconName: 'mdi-chevron-right',
864
- isVisible: `{{GridController_${this.grid.componentId}.showHideButton}}`,
865
- cssClass: '',
866
- events: {
867
- click: this.hideButtonClick.bind(this),
868
- },
869
- },
870
- ],
871
- }),
872
- addButton: () => ({
873
- name: `${this.grid.name}_add_tooltip`,
874
- component: 'ZdTooltip',
875
- label: 'TEKGRID_ADD',
876
- bottom: true,
877
- children: [
878
- {
879
- name: `${this.grid.name}_addButton`,
880
- component: 'ZdButton',
881
- icon: true,
882
- iconName: 'add',
883
- isVisible: `{{GridController_${this.grid.componentId}.showAddButton}}`,
884
- events: {
885
- click: this.addButtonClick.bind(this),
886
- },
887
- },
888
- ],
889
- }),
890
- deleteButton: () => ({
891
- name: `${this.grid.name}_delete_tooltip`,
892
- component: 'ZdTooltip',
893
- label: 'TEKGRID_DELETE',
894
- bottom: true,
895
- children: [
896
- {
897
- name: `${this.grid.name}_deleteButton`,
898
- component: 'ZdButton',
899
- icon: true,
900
- iconName: 'delete',
901
- isVisible: `{{GridController_${this.grid.componentId}.showDeleteButton}}`,
902
- disabled: `{{GridController_${this.grid.componentId}.disableDeleteButton}}`,
903
- events: {
904
- click: this.deleteButtonClick.bind(this),
905
- },
906
- },
907
- ],
908
- }),
909
- divider: (index) => ({
910
- name: `${this.grid.name}_divider${index}`,
911
- component: 'ZdDivider',
912
- cssClass: 'toolbar-divider',
913
- vertical: true,
914
- isVisible: `{{GridController_${this.grid.componentId}.showDivider}}`,
915
- }),
916
- refreshButton: () => ({
917
- name: `${this.grid.name}_refresh_tooltip`,
918
- component: 'ZdTooltip',
919
- label: 'TEKGRID_REFRESH',
920
- bottom: true,
921
- children: [
922
- {
923
- name: `${this.grid.name}_refreshButton`,
924
- component: 'ZdButton',
925
- icon: true,
926
- iconName: 'refresh',
927
- isVisible: `{{GridController_${this.grid.componentId}.showReloadButton}}`,
928
- events: {
929
- click: this.reloadGrid.bind(this),
930
- },
931
- },
932
- ],
933
- }),
934
- optionsDivider: (index) => ({
935
- name: `${this.grid.name}_options_divider${index}`,
936
- component: 'ZdDivider',
937
- cssClass: 'toolbar-divider',
938
- vertical: true,
939
- isVisible: `{{GridController_${this.grid.componentId}.showOptionsDivider}}`,
940
- }),
941
- columnsButton: () => ({
942
- name: `${this.grid.name}_columns_button_tooltip`,
943
- component: 'ZdTooltip',
944
- label: 'TEKGRID_COLUMNS',
945
- bottom: true,
946
- children: [
947
- {
948
- name: `${this.grid.name}_columnsButton`,
949
- component: 'TekGridColumnsButton',
950
- isVisible: `{{GridController_${this.grid.componentId}.showColumnsButton}}`,
951
- iterableComponentName: this.grid.name,
952
- hideGroups: !(this.grid instanceof TekGrid),
953
- ignoreColumns: `{{GridController_${this.grid.componentId}.columnsButtonIgnore}}`,
954
- },
955
- ],
956
- }),
957
- layoutOptions: () => ({
958
- name: `${this.grid.name}_layout_options`,
959
- component: 'TekGridLayoutOptions',
960
- isVisible: `{{GridController_${this.grid.componentId}.showLayoutOptionsButton}}`,
961
- }),
962
- exportDropdown: () => ({
963
- name: `${this.grid.name}_export_dropdown`,
964
- component: 'ZdDropdown',
965
- cssClass: 'tekgrid-actions-dropdown',
966
- offsetY: true,
967
- activator: {
968
- name: `${this.grid.name}_exportButton`,
969
- component: 'ZdButton',
970
- icon: true,
971
- iconName: 'fileDownload',
972
- isVisible: `{{GridController_${this.grid.componentId}.showExportButton}}`,
973
- },
974
- children: this.grid.exportActions || this.exportConfigButtons,
975
- }),
976
- actionsDivider: (index) => ({
977
- name: `${this.grid.name}_actions_divider${index}`,
978
- component: 'ZdDivider',
979
- cssClass: 'toolbar-divider',
980
- vertical: true,
981
- isVisible: `{{GridController_${this.grid.componentId}.showActionsButton}}`,
982
- }),
983
- actionsDropdown: () => ({
984
- name: `${this.grid.name}_actions_tooltip`,
985
- component: 'ZdTooltip',
986
- label: 'TEKGRID_ACTIONS',
987
- bottom: true,
988
- children: [
989
- {
990
- name: `${this.grid.name}_actions_dropdown`,
991
- component: 'ZdDropdown',
992
- cssClass: 'tekgrid-actions-dropdown',
993
- offsetY: true,
994
- activator: {
995
- name: `${this.grid.name}_actionsButton`,
996
- component: 'ZdButton',
997
- icon: true,
998
- iconName: 'more',
999
- isVisible: `{{GridController_${this.grid.componentId}.showActionsButton}}`,
1000
- },
1001
- children: this.grid.actions,
1002
- },
1003
- ],
1004
- }),
1005
- saveButton: () => ({
1006
- name: `${this.grid.name}_saveButton`,
1007
- component: 'ZdButton',
1008
- label: 'TEKGRID_SAVE',
1009
- isVisible: `{{GridController_${this.grid.componentId}.showEditButtons}}`,
1010
- small: true,
1011
- events: {
1012
- click: this.saveChanges.bind(this),
1013
- },
1014
- }),
1015
- cancelButton: () => ({
1016
- name: `${this.grid.name}_cancelButton`,
1017
- component: 'ZdButton',
1018
- label: 'TEKGRID_CANCEL',
1019
- outline: true,
1020
- cssClass: 'zd-mx-2',
1021
- isVisible: `{{GridController_${this.grid.componentId}.showEditButtons}}`,
1022
- small: true,
1023
- events: {
1024
- click: this.cancelChanges.bind(this),
1025
- },
1026
- }),
1027
- gridSearch: () => ({
1028
- name: `${this.grid.name}_gridSearch`,
1029
- component: 'ZdSearch',
1030
- cssClass: 'zd-grid-search',
1031
- iterableComponentName: `${this.grid.name}`,
1032
- isVisible: `{{GridController_${this.grid.componentId}.showSearchInput}}`,
1033
- }),
1034
- filterButton: () => ({
1035
- name: `${this.grid.name}_filter_tooltip`,
1036
- component: 'ZdTooltip',
1037
- label: 'TEKGRID_FILTER',
1038
- bottom: true,
1039
- children: [
1040
- {
1041
- name: `${this.grid.name}_filterButton`,
1042
- component: 'TekGridFilterButton',
1043
- grid: this.grid,
1044
- gridName: this.grid.name,
1045
- showCheckboxAll: this.grid.showCheckboxAllFilter,
1046
- isVisible: `{{GridController_${this.grid.componentId}.showFilterButton}}`,
1047
- events: {
1048
- onCreated: this.loadFilterButton.bind(this),
1049
- },
1050
- },
1051
- ],
1052
- }),
1053
- };
1054
- }
1055
- processUserToolbarItems(toolbarDivChildren) {
1056
- this.grid.toolbarConfig.forEach((item, index) => {
1057
- if (typeof item === 'object' && item.component) {
1058
- toolbarDivChildren.push(item);
1059
- }
1060
- else if (typeof item === 'string') {
1061
- const toolbarToPropertyMap = {
1062
- addButton: 'addButton',
1063
- deleteButton: 'deleteButton',
1064
- refreshButton: 'refreshButton',
1065
- columnsButton: 'columnsButton',
1066
- layoutOptions: 'layoutButton',
1067
- exportDropdown: 'exportButton',
1068
- actionsDropdown: 'actionsButton',
1069
- gridSearch: 'searchInput',
1070
- filterButton: 'filterButton',
1071
- };
1072
- const gridProperty = toolbarToPropertyMap[item];
1073
- if (gridProperty && !this.grid[gridProperty]) {
1074
- this.grid[gridProperty] = true;
1075
- }
1076
- const itemFactory = this.defaultToolbar[item];
1077
- if (itemFactory) {
1078
- const predefinedItem = itemFactory(index);
1079
- if (predefinedItem) {
1080
- toolbarDivChildren.push(predefinedItem);
1081
- }
1082
- }
1083
- else {
1084
- console.warn(`Predefined toolbar item "${item}" not found.`);
1085
- }
1086
- }
1087
- else {
1088
- console.warn('Invalid item in toolbarConfig:', item);
1089
- }
1090
- });
1091
- }
1092
- /**
1093
- * Adiciona os itens padrão da toolbar quando nenhuma configuração é fornecida.
1094
- * @param toolbarDivChildren Array para adicionar os componentes da toolbar.
1095
- */
1096
- addDefaultToolbarItems(toolbarDivChildren) {
1097
- const defaultItems = [
1098
- 'addButton', 'deleteButton', 'divider', 'refreshButton', 'optionsDivider',
1099
- 'columnsButton', 'layoutOptions', 'exportDropdown', 'actionsDivider', 'actionsDropdown',
1100
- 'saveButton', 'cancelButton', 'divider', 'gridSearch', 'filterButton',
1101
- ];
1102
- defaultItems.forEach((itemName, index) => {
1103
- const itemFactory = this.defaultToolbar[itemName];
1104
- if (itemFactory) {
1105
- const predefinedItem = itemFactory(index);
1106
- if (predefinedItem) {
1107
- toolbarDivChildren.push(predefinedItem);
1108
- }
1109
- }
1110
- });
1111
- }
1112
- /**
1113
- * Cria os componentes que serão renderizados na toolbar do grid.
1114
- */
1115
- createToolbarProps() {
1116
- var _a, _b, _c, _d;
1117
- const toolbarItems = [];
1118
- const toolbarDivChildren = [];
1119
- const title = (_b = (_a = this.defaultToolbar).title) === null || _b === void 0 ? void 0 : _b.call(_a);
1120
- const hideButton = (_d = (_c = this.defaultToolbar).hideButton) === null || _d === void 0 ? void 0 : _d.call(_c);
1121
- if (title)
1122
- toolbarItems.push(title);
1123
- if (hideButton)
1124
- toolbarItems.push(hideButton);
1125
- if (this.grid.toolbarConfig && this.grid.toolbarConfig.length > 0) {
1126
- this.processUserToolbarItems(toolbarDivChildren);
1127
- }
1128
- else {
1129
- this.addDefaultToolbarItems(toolbarDivChildren);
1130
- }
1131
- toolbarItems.push({
1132
- name: `${this.grid.name}_toolbarDiv`,
1133
- component: 'ZdTag',
1134
- tag: 'div',
1135
- cssStyle: 'display: flex; align-items: center',
1136
- cssClass: `{{GridController_${this.grid.componentId}.toolbarVisible}}`,
1137
- isVisible: true,
1138
- children: toolbarDivChildren,
1139
- });
1140
- return toolbarItems;
1141
- }
1142
- loadFilterButton({ component }) {
1143
- this.filterButton = component;
1144
- }
1145
- hideButtonClick({ event }) {
1146
- if (!event.defaultPrevented) {
1147
- const instance = Metadata.getInstance(`${this.grid.name}_toolbarDiv`);
1148
- const icon = Metadata.getInstance(`${this.grid.name}_hideButton`);
1149
- const tooltip = Metadata.getInstance(`${this.grid.name}_hideTooltip`);
1150
- if (instance) {
1151
- instance.cssClass = instance.cssClass === 'toolbar-visible'
1152
- ? ''
1153
- : 'toolbar-visible';
1154
- icon.cssClass = icon.cssClass === 'is-rotated'
1155
- ? ''
1156
- : 'is-rotated';
1157
- tooltip.label = tooltip.label === 'TEKGRID_HIDE'
1158
- ? 'TEKGRID_SHOW'
1159
- : 'TEKGRID_HIDE';
1160
- }
1161
- }
1162
- }
1163
- addButtonClick({ event }) {
1164
- if (this.grid.editNewRowsOnly) {
1165
- this.grid.editingNewRows = true;
1166
- }
1167
- this.grid.callEvent('addClick', { component: this.grid, event });
1168
- }
1169
- deleteButtonClick({ event }) {
1170
- this.grid.callEvent('beforeDelete', { component: this.grid, event });
1171
- if (!event.defaultPrevented) {
1172
- if (this.grid.selectAllPages) {
1173
- throw new TekGridDeleteRowsError();
1174
- }
1175
- this.grid.deleteRows();
1176
- this.grid.callEvent('afterDelete', { component: this.grid });
1177
- }
1178
- }
1179
- reloadGrid({ event }) {
1180
- this.grid.callEvent('beforeReload', { component: this.grid, event });
1181
- if (event && event.defaultPrevented)
1182
- return;
1183
- this.grid.reload();
1184
- }
1185
- saveChanges({ event }) {
1186
- this.grid.callEvent('beforeSave', { component: this.grid, event });
1187
- if (!event.defaultPrevented) {
1188
- const save = (() => __awaiter(this, void 0, void 0, function* () {
1189
- yield this.grid.saveEditedRows();
1190
- this.grid.editingNewRows = false;
1191
- }));
1192
- save();
1193
- this.grid.callEvent('afterSave', { component: this.grid });
1194
- }
1195
- }
1196
- cancelChanges({ event }) {
1197
- this.grid.callEvent('beforeCancel', { component: this.grid, event });
1198
- if (!event.defaultPrevented) {
1199
- const cancel = (() => __awaiter(this, void 0, void 0, function* () {
1200
- yield this.grid.cancelEditedRows();
1201
- this.grid.editingNewRows = false;
1202
- }));
1203
- cancel();
1204
- this.grid.callEvent('afterCancel', { component: this.grid });
1205
- }
1206
- }
1207
- hideFilterModal() {
1208
- this.filterButton.hideFilterModal();
1209
- }
1210
- getFilterRelationsDatasource() {
1211
- return DatasourceFactory.factory({
1212
- data: this.getFilterOptionsData('relations'),
1213
- loadAll: true,
1214
- translate: ['text'],
1215
- });
1216
- }
1217
- getFilterOperationsDatasource() {
1218
- return DatasourceFactory.factory({
1219
- data: this.getFilterOptionsData('operations'),
1220
- loadAll: true,
1221
- translate: ['text'],
1222
- });
1223
- }
1224
- getFilterOptionsData(prop) {
1225
- const { datasource } = this.grid;
1226
- if (datasource instanceof TekRestDatasource || datasource instanceof TekMemoryDatasource) {
1227
- let options;
1228
- if (prop === 'relations') {
1229
- options = Object.keys(datasource.dynamicFilterRelations);
1230
- }
1231
- else {
1232
- options = Object.keys(datasource.dynamicFilterOperations);
1233
- }
1234
- return options.map((item) => ({
1235
- text: `TEKGRID_${item}`,
1236
- value: item,
1237
- }));
1238
- }
1239
- return [];
1240
- }
1241
- setSearch(search) {
1242
- return __awaiter(this, void 0, void 0, function* () {
1243
- const { datasource } = this.grid;
1244
- if (datasource instanceof TekRestDatasource || datasource instanceof TekMemoryDatasource) {
1245
- const lookupColumns = this.grid.columns.filter((column) => !!column.componentProps.datasource && !column.skipLookupSearch);
1246
- const searchJoin = {};
1247
- if (search) {
1248
- const promises = lookupColumns.map((column) => __awaiter(this, void 0, void 0, function* () {
1249
- const searchData = yield column.memorySearch(search);
1250
- const lookupId = column.componentProps.datasource.uniqueKey;
1251
- searchJoin[column.name] = searchData.map((row) => row[lookupId]);
1252
- }));
1253
- yield Promise.all(promises);
1254
- }
1255
- datasource.searchJoin = searchJoin;
1256
- }
1257
- datasource.page = 1;
1258
- return datasource.setSearch(search);
1259
- });
1260
- }
1261
- getAtomInstance(key) {
1262
- return Metadata.getInstance(`${this.grid.name}${this.atoms[key]}`);
1263
- }
1264
- getFilterInputs(columnName) {
1265
- return this.filterButton.getFilterInputs(columnName);
1266
- }
1267
- }
1268
- Messages.add({
1269
- 'pt-BR': {
1270
- translation: {
1271
- TEKGRID_CONTAINS: 'contém',
1272
- TEKGRID_NOT_CONTAINS: 'não contém',
1273
- TEKGRID_EQUALS: 'é igual a',
1274
- TEKGRID_NOT_EQUALS: 'é diferente de',
1275
- TEKGRID_GREATER_THAN: 'é maior que',
1276
- TEKGRID_LESS_THAN: 'é menor que',
1277
- TEKGRID_GREATER_THAN_EQUALS: 'é maior ou igual a',
1278
- TEKGRID_LESS_THAN_EQUALS: 'é menor ou igual a',
1279
- TEKGRID_IN: 'um dos valores',
1280
- TEKGRID_NOT_IN: 'nenhum dos valores',
1281
- TEKGRID_BETWEEN: 'está entre',
1282
- TEKGRID_AND: 'e',
1283
- TEKGRID_OR: 'ou',
1284
- TEKGRID_HIDE: 'Esconder Ações',
1285
- TEKGRID_SHOW: 'Mostrar Ações',
1286
- TEKGRID_ADD: 'Adicionar',
1287
- TEKGRID_DELETE: 'Excluir',
1288
- TEKGRID_REFRESH: 'Atualizar',
1289
- TEKGRID_COLUMNS: 'Colunas',
1290
- TEKGRID_ACTIONS: 'Ações',
1291
- TEKGRID_SAVE: 'Salvar',
1292
- TEKGRID_CANCEL: 'Cancelar',
1293
- TEKGRID_APPLY: 'Aplicar',
1294
- TEKGRID_FILTER: 'Filtro',
1295
- TEKGRID_MULTIPLE_VALUE_HINT: 'Separe valores usando ";"',
1296
- TEKGRID_EXPORT: 'Exportar',
1297
- TEKGRID_EXPORT_AS: 'Exportar como {{ type }}',
1298
- TEKGRID_PORTRAIT: 'Retrato',
1299
- TEKGRID_LANDSCAPE: 'Paisagem',
1300
- TEKGRID_COLUMN_VISIBLE: 'Visível',
1301
- TEKGRID_COLUMN_GROUPED: 'Grupo',
1302
- TEKGRID_COLUMN_AGGREGATION: 'Totalização',
1303
- TEKGRID_COLUMN_LABEL: 'Rótulo',
1304
- TEKGRID_COLUMN_ALIGNMENT: 'Alinhamento',
1305
- TEKGRID_COLUMN_GROUP_OPENED: 'Aberto (grupo)',
1306
- TEKGRID_COLUMN_ORDER: 'Ordem',
1307
- TEKGRID_COLUMN_ORDER_DIRECTION: 'Direção (ordem)',
1308
- TEKGRID_AGGREGATION_SUM: 'Soma',
1309
- TEKGRID_AGGREGATION_AVG: 'Média',
1310
- TEKGRID_AGGREGATION_MAX: 'Máximo',
1311
- TEKGRID_AGGREGATION_MIN: 'Mínimo',
1312
- TEKGRID_AGGREGATION_COUNT: 'Contador',
1313
- TEKGRID_MORE_OPTIONS: 'Mais opções',
1314
- TEKGRID_COLUMNS_OPTIONS: 'Configuração de colunas',
1315
- TEKGRID_CLOSE: 'Fechar',
1316
- TEKGRID_FIXED_COLUMNS: 'Colunas fixadas',
1317
- TEKGRID_VISIBLE_COLUMNS: 'Colunas visíveis',
1318
- TEKGRID_GROUPED_COLUMNS: 'Colunas agrupadas',
1319
- TEKGRID_ORDER: 'Ordem',
1320
- TEKGRID_OTHER_COLUMNS: 'Outras colunas',
1321
- TEKGRID_DROP_COLUMNS: 'Arraste colunas aqui',
1322
- TEKGRID_DETAILS_FOR: 'Detalhes para:',
1323
- TEKGRID_LEFT: 'Esquerda',
1324
- TEKGRID_CENTER: 'Centro',
1325
- TEKGRID_RIGHT: 'Direita',
1326
- TEKGRID_ASC: 'Crescente',
1327
- TEKGRID_DESC: 'Decrescente',
1328
- TEKGRID_SELECT_COLUMN: '(selecione uma ou mais colunas)',
1329
- TEKGRID_SELECT_ALL: 'Selecionar todas',
1330
- TEKGRID_HELPERVALUE_TODAY: 'Hoje',
1331
- TEKGRID_HELPERVALUE_TOMORROW: 'Amanhã',
1332
- TEKGRID_HELPERVALUE_YESTERDAY: 'Ontem',
1333
- TEKGRID_HELPERVALUE_LAST_7_DAYS: 'Últimos 7 Dias',
1334
- TEKGRID_HELPERVALUE_NEXT_7_DAYS: 'Próximos 7 Dias',
1335
- TEKGRID_HELPERVALUE_CURRENT_WEEK: 'Semana Atual',
1336
- TEKGRID_HELPERVALUE_CURRENT_MONTH: 'Mês Atual',
1337
- TEKGRID_HELPERVALUE_CURRENT_YEAR: 'Ano Atual',
1338
- TEKGRID_WITH_GROUPS: '(Com grupos)',
1339
- TEKGRID_GRID_MIRROR: '(Espelho do grid)',
1340
- TEKGRID_NO_DATA: 'Não há dados para exportar',
1341
- },
1342
- },
1343
- 'en-US': {
1344
- translation: {
1345
- TEKGRID_CONTAINS: 'contains',
1346
- TEKGRID_NOT_CONTAINS: 'does not contain',
1347
- TEKGRID_EQUALS: 'is equal to',
1348
- TEKGRID_NOT_EQUALS: 'is different from',
1349
- TEKGRID_GREATER_THAN: 'is greater than',
1350
- TEKGRID_LESS_THAN: 'is less than',
1351
- TEKGRID_GREATER_THAN_EQUALS: 'is greater or equals to',
1352
- TEKGRID_LESS_THAN_EQUALS: 'is less or equals to',
1353
- TEKGRID_IN: 'is in',
1354
- TEKGRID_NOT_IN: 'is not in',
1355
- TEKGRID_BETWEEN: 'is between',
1356
- TEKGRID_AND: 'and',
1357
- TEKGRID_OR: 'or',
1358
- TEKGRID_HIDE: 'Hide Actions',
1359
- TEKGRID_SHOW: 'Show Actions',
1360
- TEKGRID_ADD: 'Add',
1361
- TEKGRID_DELETE: 'Delete',
1362
- TEKGRID_REFRESH: 'Refresh',
1363
- TEKGRID_COLUMNS: 'Columns',
1364
- TEKGRID_ACTIONS: 'Actions',
1365
- TEKGRID_SAVE: 'Save',
1366
- TEKGRID_CANCEL: 'Cancel',
1367
- TEKGRID_APPLY: 'Apply',
1368
- TEKGRID_FILTER: 'Filter',
1369
- TEKGRID_MULTIPLE_VALUE_HINT: 'Separate values using ";"',
1370
- TEKGRID_EXPORT: 'Export',
1371
- TEKGRID_EXPORT_AS: 'Export as {{ type }}',
1372
- TEKGRID_PORTRAIT: 'Portrait',
1373
- TEKGRID_LANDSCAPE: 'Landscape',
1374
- TEKGRID_COLUMN_VISIBLE: 'Visible',
1375
- TEKGRID_COLUMN_GROUPED: 'Grouped',
1376
- TEKGRID_COLUMN_AGGREGATION: 'Aggregation',
1377
- TEKGRID_COLUMN_LABEL: 'Label',
1378
- TEKGRID_COLUMN_ALIGNMENT: 'Alignment',
1379
- TEKGRID_COLUMN_GROUP_OPENED: 'Opened (group)',
1380
- TEKGRID_COLUMN_ORDER: 'Order',
1381
- TEKGRID_COLUMN_ORDER_DIRECTION: 'Direction (order)',
1382
- TEKGRID_AGGREGATION_SUM: 'Sum',
1383
- TEKGRID_AGGREGATION_AVG: 'Average',
1384
- TEKGRID_AGGREGATION_MAX: 'Maximum',
1385
- TEKGRID_AGGREGATION_MIN: 'Minimum',
1386
- TEKGRID_AGGREGATION_COUNT: 'Count',
1387
- TEKGRID_MORE_OPTIONS: 'More options',
1388
- TEKGRID_COLUMNS_OPTIONS: 'Columns configuration',
1389
- TEKGRID_CLOSE: 'Close',
1390
- TEKGRID_FIXED_COLUMNS: 'Fixed columns',
1391
- TEKGRID_VISIBLE_COLUMNS: 'Visible columns',
1392
- TEKGRID_GROUPED_COLUMNS: 'Grouped columns',
1393
- TEKGRID_ORDER: 'Order',
1394
- TEKGRID_OTHER_COLUMNS: 'Other columns',
1395
- TEKGRID_DROP_COLUMNS: 'Drop columns here',
1396
- TEKGRID_DETAILS_FOR: 'Details for:',
1397
- TEKGRID_LEFT: 'Left',
1398
- TEKGRID_CENTER: 'Center',
1399
- TEKGRID_RIGHT: 'Right',
1400
- TEKGRID_ASC: 'Ascending',
1401
- TEKGRID_DESC: 'Descending',
1402
- TEKGRID_SELECT_COLUMN: '(select one or more columns)',
1403
- TEKGRID_SELECT_ALL: 'Select all',
1404
- TEKGRID_HELPERVALUE_TODAY: 'Today',
1405
- TEKGRID_HELPERVALUE_TOMORROW: 'Tomorrow',
1406
- TEKGRID_HELPERVALUE_YESTERDAY: 'Yesterday',
1407
- TEKGRID_HELPERVALUE_LAST_7_DAYS: 'Last 7 Days',
1408
- TEKGRID_HELPERVALUE_NEXT_7_DAYS: 'Next 7 Days',
1409
- TEKGRID_HELPERVALUE_CURRENT_WEEK: 'Current Week',
1410
- TEKGRID_HELPERVALUE_CURRENT_MONTH: 'Current Month',
1411
- TEKGRID_HELPERVALUE_CURRENT_YEAR: 'Current Year',
1412
- TEKGRID_WITH_GROUPS: '(With groups)',
1413
- TEKGRID_GRID_MIRROR: '(Grid mirror)',
1414
- TEKGRID_NO_DATA: 'There is no data to export',
1415
- },
1416
- },
1417
- 'es-CL': {
1418
- translation: {
1419
- TEKGRID_CONTAINS: 'contiene',
1420
- TEKGRID_NOT_CONTAINS: 'no contiene',
1421
- TEKGRID_EQUALS: 'igual',
1422
- TEKGRID_NOT_EQUALS: 'es diferente de',
1423
- TEKGRID_GREATER_THAN: 'es mayor que',
1424
- TEKGRID_LESS_THAN: 'es menor que',
1425
- TEKGRID_GREATER_THAN_EQUALS: 'es mayor o igual que',
1426
- TEKGRID_LESS_THAN_EQUALS: 'es menor o igual que',
1427
- TEKGRID_IN: 'uno de los valores',
1428
- TEKGRID_NOT_IN: 'ninguno de los valores',
1429
- TEKGRID_BETWEEN: 'está entre',
1430
- TEKGRID_AND: 'e',
1431
- TEKGRID_OR: 'o',
1432
- TEKGRID_HIDE: 'Ocultar Acciones',
1433
- TEKGRID_SHOW: 'Mostrar Acciones',
1434
- TEKGRID_ADD: 'Añadir',
1435
- TEKGRID_DELETE: 'Eliminar',
1436
- TEKGRID_REFRESH: 'Actualizar',
1437
- TEKGRID_COLUMNS: 'Colunas',
1438
- TEKGRID_ACTIONS: 'Acciónes',
1439
- TEKGRID_SAVE: 'Guardar',
1440
- TEKGRID_CANCEL: 'Cancelar',
1441
- TEKGRID_APPLY: 'Aplicar',
1442
- TEKGRID_FILTER: 'Filtro',
1443
- TEKGRID_MULTIPLE_VALUE_HINT: 'Separe los valores usando ";"',
1444
- TEKGRID_EXPORT: 'Exportar',
1445
- TEKGRID_EXPORT_AS: 'Exportar como {{ type }}',
1446
- TEKGRID_PORTRAIT: 'Vertical',
1447
- TEKGRID_LANDSCAPE: 'Horizontal',
1448
- TEKGRID_COLUMN_VISIBLE: 'Visible',
1449
- TEKGRID_COLUMN_GROUPED: 'Grupo',
1450
- TEKGRID_COLUMN_AGGREGATION: 'Totalización',
1451
- TEKGRID_COLUMN_LABEL: 'Etiqueta',
1452
- TEKGRID_COLUMN_ALIGNMENT: 'alineación',
1453
- TEKGRID_COLUMN_GROUP_OPENED: 'Abierto (grupo)',
1454
- TEKGRID_COLUMN_ORDER: 'Orden',
1455
- TEKGRID_COLUMN_ORDER_DIRECTION: 'Dirección (orden)',
1456
- TEKGRID_AGGREGATION_SUM: 'Suma',
1457
- TEKGRID_AGGREGATION_AVG: 'Media',
1458
- TEKGRID_AGGREGATION_MAX: 'Máximo',
1459
- TEKGRID_AGGREGATION_MIN: 'Mínimo',
1460
- TEKGRID_AGGREGATION_COUNT: 'Contar',
1461
- TEKGRID_MORE_OPTIONS: 'Mas opciones',
1462
- TEKGRID_COLUMNS_OPTIONS: 'Configuración de columna',
1463
- TEKGRID_CLOSE: 'Cerrar',
1464
- TEKGRID_FIXED_COLUMNS: 'Columnas fijas',
1465
- TEKGRID_VISIBLE_COLUMNS: 'Columnas visibles',
1466
- TEKGRID_GROUPED_COLUMNS: 'Columnas agrupadas',
1467
- TEKGRID_ORDER: 'Orden',
1468
- TEKGRID_OTHER_COLUMNS: 'Otras columnas',
1469
- TEKGRID_DROP_COLUMNS: 'Arrastra columnas aquí',
1470
- TEKGRID_DETAILS_FOR: 'Detalles para',
1471
- TEKGRID_LEFT: 'Izquierda',
1472
- TEKGRID_CENTER: 'Centro',
1473
- TEKGRID_RIGHT: 'Derecha',
1474
- TEKGRID_ASC: 'Creciente',
1475
- TEKGRID_DESC: 'Decreciente',
1476
- TEKGRID_SELECT_COLUMN: '(seleccione una o más columnas)',
1477
- TEKGRID_SELECT_ALL: 'Seleccionar todas',
1478
- TEKGRID_HELPERVALUE_TODAY: 'Hoy',
1479
- TEKGRID_HELPERVALUE_TOMORROW: 'Mañana',
1480
- TEKGRID_HELPERVALUE_YESTERDAY: 'Ayer',
1481
- TEKGRID_HELPERVALUE_LAST_7_DAYS: 'Últimos 7 días',
1482
- TEKGRID_HELPERVALUE_NEXT_7_DAYS: 'Próximos 7 días',
1483
- TEKGRID_HELPERVALUE_CURRENT_WEEK: 'Semana actual',
1484
- TEKGRID_HELPERVALUE_CURRENT_MONTH: 'Mes actual',
1485
- TEKGRID_HELPERVALUE_CURRENT_YEAR: 'Año actual',
1486
- TEKGRID_WITH_GROUPS: '(Con grupos)',
1487
- TEKGRID_GRID_MIRROR: '(Espejo de grid)',
1488
- TEKGRID_NO_DATA: 'No hay datos para exportar',
1489
- },
1490
- },
1491
- });
1492
-
1493
- class GridController {
1494
- constructor(grid) {
1495
- this.openToolbar = true;
1496
- this.grid = grid;
1497
- this.openToolbar = this.grid.toolbarOpened;
1498
- }
1499
- get gridTitle() {
1500
- return this.grid.title;
1501
- }
1502
- get showAddButton() {
1503
- return this.grid.addButton && !this.isEditing;
1504
- }
1505
- get showDeleteButton() {
1506
- return this.grid.deleteButton !== 'none' && !this.isEditing;
1507
- }
1508
- get showFilterButton() {
1509
- return this.grid.filterButton;
1510
- }
1511
- get showModalFilterProps() {
1512
- return this.grid.modalFilterProps;
1513
- }
1514
- get showSearchInput() {
1515
- return this.grid.showSearch;
1516
- }
1517
- get showReloadButton() {
1518
- return this.grid.showReload && !this.isEditing;
1519
- }
1520
- get showColumnsButton() {
1521
- return this.grid.columnsButton && !this.isEditing;
1522
- }
1523
- get columnsButtonIgnore() {
1524
- return this.grid.columnsButtonIgnore;
1525
- }
1526
- get showLayoutOptionsButton() {
1527
- return this.grid.showLayoutOptions && !this.isEditing;
1528
- }
1529
- get showDivider() {
1530
- return !this.isEditing;
1531
- }
1532
- get showOptionsDivider() {
1533
- return (this.grid.columnsButton || this.grid.showLayoutOptions || this.grid.showExport)
1534
- && !this.isEditing;
1535
- }
1536
- get showHideButton() {
1537
- return this.grid.showHideButton;
1538
- }
1539
- get showActionsButton() {
1540
- return this.grid.actions.length > 0 && !this.isEditing;
1541
- }
1542
- get showExportButton() {
1543
- return this.grid.showExport && !this.isEditing;
1544
- }
1545
- get showActionAndExportButton() {
1546
- return ((this.showLayoutOptionsButton || this.showColumnsButton)
1547
- && (this.showActionsButton || this.showExportButton || this.showSearchInput)) && !this.isEditing;
1548
- }
1549
- get isEditing() {
1550
- return this.grid.editing;
1551
- }
1552
- get showEditButtons() {
1553
- return this.isEditing && this.grid.showEditButtons;
1554
- }
1555
- get isNotEditing() {
1556
- return !this.isEditing;
1557
- }
1558
- get disableDeleteButton() {
1559
- if (this.grid.deleteButton === 'selection') {
1560
- if (this.grid.selectAllPages) {
1561
- const { allSelected, except } = this.grid.selectionState;
1562
- return (allSelected && except.length === this.grid.datasource.total)
1563
- || (!allSelected && except.length === 0);
1564
- }
1565
- return this.grid.selectedRows.length === 0;
1566
- }
1567
- if (this.grid.deleteButton === 'currentRow') {
1568
- return !this.grid.datasource.currentRow[this.grid.datasource.uniqueKey];
1569
- }
1570
- return false;
1571
- }
1572
- }
1573
-
1574
- /**
1575
- * Extracts properties from an object based on a list of properties
1576
- * @param obj object whose properties will be extracted
1577
- * @param props array of strings with the properties to be extracted
1578
- * @returns object containing the extracted properties
1579
- */
1580
- const extractProperties = (obj, props) => {
1581
- const result = {};
1582
- props.forEach((prop) => {
1583
- if (obj[prop] !== undefined) {
1584
- result[prop] = obj[prop];
1585
- }
1586
- });
1587
- return result;
1588
- };
1589
-
1590
- const DynamicFilterOperations = {
1591
- CONTAINS: true,
1592
- NOT_CONTAINS: true,
1593
- EQUALS: true,
1594
- NOT_EQUALS: true,
1595
- GREATER_THAN: true,
1596
- LESS_THAN: true,
1597
- GREATER_THAN_EQUALS: true,
1598
- LESS_THAN_EQUALS: true,
1599
- IN: true,
1600
- NOT_IN: true,
1601
- BETWEEN: true,
1602
- };
1603
- const DynamicFilterRelations = {
1604
- AND: true,
1605
- OR: true,
1606
- };
1607
-
1608
- class TekMemoryDatasource extends MemoryDatasource {
1609
- /**
1610
- * Create new datasource
1611
- * @param props Datasource properties
1612
- */
1613
- constructor(props) {
1614
- super(props);
1615
- /**
1616
- * Dynamic Filter Operations
1617
- */
1618
- this.dynamicFilterOperations = DynamicFilterOperations;
1619
- /**
1620
- * Dynamic Filter Relations
1621
- */
1622
- this.dynamicFilterRelations = DynamicFilterRelations;
1623
- /**
1624
- * Dynamic Filter applied flag
1625
- */
1626
- this.dynamicFilterApplied = '';
1627
- if (!this.watchUrl) {
1628
- this.dynamicFilter = this.getInitValue('dynamicFilter', props.dynamicFilter, {});
1629
- this.searchJoin = this.getInitValue('searchJoin', props.searchJoin, {});
1630
- }
1631
- this.createAccessors();
1632
- this.createObjAccessors(this.dynamicFilter, 'dynamicFilter');
1633
- this.createObjAccessors(this.searchJoin, 'searchJoin');
1634
- this.get();
1635
- }
1636
- updateReservedKeys() {
1637
- this.reservedKeys.dynamic_filter = true;
1638
- this.reservedKeys.search_join = true;
1639
- }
1640
- updateInternalProperties(datasource = {}) {
1641
- if (!this.watchUrl)
1642
- return;
1643
- this.updateReservedKeys();
1644
- super.updateInternalProperties(datasource);
1645
- const queryString = URL.getParsedQueryStringFromUrl();
1646
- this.dynamicFilter = this.getEncodedParam(queryString.dynamic_filter, datasource.dynamicFilter);
1647
- this.searchJoin = this.getEncodedParam(queryString.search_join, datasource.searchJoin);
1648
- }
1649
- getEncodedParam(urlParam, datasourceParam = {}) {
1650
- return urlParam ? JSON.parse(atob(urlParam)) : datasourceParam;
1651
- }
1652
- getQueryStringValues() {
1653
- const values = super.getQueryStringValues();
1654
- if (this.dynamicFilter && Object.keys(this.dynamicFilter).length) {
1655
- values.dynamic_filter = btoa(JSON.stringify(this.dynamicFilter));
1656
- }
1657
- if (this.searchJoin && Object.keys(this.searchJoin).length) {
1658
- values.search_join = btoa(JSON.stringify(this.searchJoin));
1659
- }
1660
- return values;
1661
- }
1662
- getUrlQueryString() {
1663
- const superQueryString = super.getUrlQueryString();
1664
- const query = URL.getParsedQueryStringFromUrl();
1665
- let dynamicFilterQuerystring = '';
1666
- if (query.dynamic_filter) {
1667
- dynamicFilterQuerystring = `&${URL.getFormattedQueryString({
1668
- dynamic_filter: query.dynamic_filter,
1669
- })}`;
1670
- }
1671
- let searchJoinQuerystring = '';
1672
- if (query.search_join) {
1673
- searchJoinQuerystring = `&${URL.getFormattedQueryString({
1674
- search_join: query.search_join,
1675
- })}`;
1676
- }
1677
- return superQueryString + dynamicFilterQuerystring + searchJoinQuerystring;
1678
- }
1679
- /**
1680
- * Allows the comunication between the base filter and the dynamic filter
1681
- * @param filtroDinamico
1682
- * @returns
1683
- */
1684
- setBaseFilter(filtroDinamico) {
1685
- return this.setDynamicFilter(filtroDinamico);
1686
- }
1687
- /**
1688
- * Adds a new dynamic filter position or replace if exists
1689
- * @param column Dynamic Filter column name
1690
- * @param value Dynamic Filter value
1691
- * @returns Promise with data collection
1692
- */
1693
- addDynamicFilter(column, value) {
1694
- if (this.isValidDynamicFilterValue(column, value)) {
1695
- this.dynamicFilter[column] = value;
1696
- return this.updateDynamicFilter();
1697
- }
1698
- return this.removeDynamicFilter(column);
1699
- }
1700
- /**
1701
- * Removes a dynamic filter position
1702
- * @param column Dynamic Filter column name
1703
- * @returns Promise with data collection
1704
- */
1705
- removeDynamicFilter(column) {
1706
- delete this.dynamicFilter[column];
1707
- return this.updateDynamicFilter();
1708
- }
1709
- /**
1710
- * Sets new dynamic filter value
1711
- * @param filter Dynamic Filter value
1712
- * @returns Promise with data collection
1713
- */
1714
- setDynamicFilter(filter) {
1715
- this.dynamicFilter = {};
1716
- Object.keys(filter).forEach((column) => {
1717
- if (this.isValidDynamicFilterValue(column, filter[column])) {
1718
- this.dynamicFilter[column] = filter[column];
1719
- }
1720
- else {
1721
- delete this.dynamicFilter[column];
1722
- }
1723
- });
1724
- return this.updateDynamicFilter();
1725
- }
1726
- /**
1727
- * Clears Dynamic filter value
1728
- * @returns Promise with data collection
1729
- */
1730
- clearDynamicFilter() {
1731
- this.dynamicFilter = {};
1732
- return this.updateDynamicFilter();
1733
- }
1734
- /**
1735
- * Resets page and selected rows and tries to update the url
1736
- * @returns Promise with data collection
1737
- */
1738
- updateDynamicFilter() {
1739
- return __awaiter(this, void 0, void 0, function* () {
1740
- this.page = this.firstPage;
1741
- this.selectedRows = [];
1742
- this.visibleSelectedRows = [];
1743
- if (this.watchUrl) {
1744
- if (this.dynamicFilter && Object.keys(this.dynamicFilter).length) {
1745
- URL.updateQueryString({
1746
- dynamic_filter: btoa(JSON.stringify(this.dynamicFilter)),
1747
- });
1748
- }
1749
- else {
1750
- URL.updateQueryString({
1751
- dynamic_filter: undefined,
1752
- });
1753
- }
1754
- }
1755
- return this.get();
1756
- });
1757
- }
1758
- /**
1759
- * Checks if a filter value is valid
1760
- * @param value Filter value
1761
- * @returns Is valid filter value
1762
- */
1763
- isValidDynamicFilterValue(column, value) {
1764
- if (!Array.isArray(value))
1765
- return false;
1766
- return !this.reservedKeys[column]
1767
- && value.length > 0
1768
- && value.every((filterValue) => filterValue
1769
- && this.dynamicFilterOperations[filterValue.operation]
1770
- && this.dynamicFilterRelations[filterValue.relation]
1771
- && filterValue.value !== ''
1772
- && filterValue.value !== null);
1773
- }
1774
- clone() {
1775
- return Object.assign(Object.assign({}, super.clone()), { dynamicFilter: this.dynamicFilter, searchJoin: this.searchJoin, type: 'tek-memory' });
1776
- }
1777
- /**
1778
- * Updates filtered data
1779
- */
1780
- updateFilteredData() {
1781
- // first apply filters (simple and dynamic)
1782
- this.filteredData = Object.keys(this.filter).length
1783
- ? this.allData.filter((row) => this.getRowByFilter(row))
1784
- : Array.from(this.allData);
1785
- if (this.dynamicFilter && Object.keys(this.dynamicFilter).length) {
1786
- this.filteredData = this.filteredData.filter((row) => this.getRowByDynamicFilter(row));
1787
- }
1788
- const searchWithoutSearchJoin = (row) => {
1789
- const searchRow = Object.assign({}, row);
1790
- if (this.searchJoin) {
1791
- // do not search on columns with searchJoin
1792
- Object.keys(this.searchJoin).forEach((key) => delete searchRow[key]);
1793
- }
1794
- return this.getRowBySearch(searchRow);
1795
- };
1796
- // only after do the search
1797
- const searchData = this.search
1798
- ? this.filteredData.filter(searchWithoutSearchJoin)
1799
- : this.filteredData;
1800
- let searchIds = searchData.map((row) => row[this.uniqueKey]);
1801
- if (this.searchJoin && Object.keys(this.searchJoin).length) {
1802
- const searchJoinData = this.filteredData.filter((row) => this.getRowBySearchJoin(row));
1803
- // get the ids from search and searchJoin
1804
- searchIds = searchIds
1805
- .concat(searchJoinData.map((row) => row[this.uniqueKey]))
1806
- .sort();
1807
- }
1808
- // filter filteredData using searchIds
1809
- this.filteredData = this.allData.filter((row) => searchIds.indexOf(row[this.uniqueKey]) !== -1);
1810
- }
1811
- getRowByDynamicFilter(row) {
1812
- let filtered;
1813
- try {
1814
- Object.keys(this.dynamicFilter).forEach((key) => {
1815
- const filterItems = this.dynamicFilter[key];
1816
- filterItems.forEach((item) => {
1817
- if (filtered === false && item.relation === 'AND')
1818
- return;
1819
- if (filtered === true && item.relation === 'OR')
1820
- return;
1821
- const columnValue = Utils.normalize(row[key].toString());
1822
- let value = '';
1823
- if (Array.isArray(item.value)) {
1824
- value = item.value.map((val) => Utils.normalize(val.toString()));
1825
- switch (item.operation) {
1826
- case 'IN':
1827
- filtered = value.includes(columnValue);
1828
- break;
1829
- case 'NOT_IN':
1830
- filtered = !value.includes(columnValue);
1831
- break;
1832
- case 'BETWEEN':
1833
- filtered = (Number(columnValue) || columnValue) >= (Number(value[0]) || value[0])
1834
- && (Number(columnValue) || columnValue) <= (Number(value[1]) || value[1]);
1835
- break;
1836
- default:
1837
- break;
1838
- }
1839
- }
1840
- else {
1841
- value = Utils.normalize(item.value.toString());
1842
- switch (item.operation) {
1843
- case 'CONTAINS':
1844
- filtered = columnValue.indexOf(value) !== -1;
1845
- break;
1846
- case 'NOT_CONTAINS':
1847
- filtered = columnValue.indexOf(value) === -1;
1848
- break;
1849
- case 'EQUALS':
1850
- filtered = columnValue === value;
1851
- break;
1852
- case 'NOT_EQUALS':
1853
- filtered = columnValue !== value;
1854
- break;
1855
- case 'GREATER_THAN':
1856
- filtered = (Number(columnValue) || columnValue) > (Number(value) || value);
1857
- break;
1858
- case 'LESS_THAN':
1859
- filtered = (Number(columnValue) || columnValue) < (Number(value) || value);
1860
- break;
1861
- case 'GREATER_THAN_EQUALS':
1862
- filtered = (Number(columnValue) || columnValue) >= (Number(value) || value);
1863
- break;
1864
- case 'LESS_THAN_EQUALS':
1865
- filtered = (Number(columnValue) || columnValue) <= (Number(value) || value);
1866
- break;
1867
- default:
1868
- break;
1869
- }
1870
- }
1871
- });
1872
- });
1873
- }
1874
- catch (_a) {
1875
- // do nothing
1876
- }
1877
- return filtered;
1878
- }
1879
- getRowBySearchJoin(row) {
1880
- return Object.keys(this.searchJoin).some((key) => this.searchJoin[key].includes(row[key]));
1881
- }
1882
- }
1883
- DatasourceFactory.register('tek-memory', TekMemoryDatasource);
1884
-
1885
- class TekRestDatasource extends RestDatasource {
1886
- /**
1887
- * Create new datasource
1888
- * @param props Datasource properties
1889
- */
1890
- constructor(props) {
1891
- super(Object.assign(Object.assign({}, props), { lazyLoad: true }));
1892
- /**
1893
- * Dynamic Filter Operations
1894
- */
1895
- this.dynamicFilterOperations = DynamicFilterOperations;
1896
- /**
1897
- * Dynamic Filter Relations
1898
- */
1899
- this.dynamicFilterRelations = DynamicFilterRelations;
1900
- /**
1901
- * Dynamic Filter applied flag
1902
- */
1903
- this.dynamicFilterApplied = '';
1904
- if (!this.watchUrl) {
1905
- this.dynamicFilter = this.getInitValue('dynamicFilter', props.dynamicFilter, {});
1906
- this.searchJoin = this.getInitValue('searchJoin', props.searchJoin, {});
1907
- }
1908
- this.lazyLoad = this.getInitValue('lazyLoad', props.lazyLoad, this.lazyLoad);
1909
- this.createAccessors();
1910
- this.createObjAccessors(this.dynamicFilter, 'dynamicFilter');
1911
- this.createObjAccessors(this.searchJoin, 'searchJoin');
1912
- if (!this.lazyLoad) {
1913
- this.get();
1914
- }
1915
- }
1916
- updateReservedKeys() {
1917
- this.reservedKeys.dynamic_filter = true;
1918
- this.reservedKeys.search_join = true;
1919
- }
1920
- updateInternalProperties(datasource = {}) {
1921
- if (!this.watchUrl)
1922
- return;
1923
- this.updateReservedKeys();
1924
- super.updateInternalProperties(datasource);
1925
- const queryString = URL.getParsedQueryStringFromUrl();
1926
- this.dynamicFilter = this.getEncodedParam(queryString.dynamic_filter, datasource.dynamicFilter);
1927
- this.searchJoin = this.getEncodedParam(queryString.search_join, datasource.searchJoin);
1928
- }
1929
- getEncodedParam(urlParam, datasourceParam = {}) {
1930
- return urlParam ? JSON.parse(atob(urlParam)) : datasourceParam;
1931
- }
1932
- getQueryStringValues() {
1933
- const values = super.getQueryStringValues();
1934
- if (this.dynamicFilter && Object.keys(this.dynamicFilter).length) {
1935
- values.dynamic_filter = btoa(JSON.stringify(this.dynamicFilter));
1936
- }
1937
- if (this.searchJoin && Object.keys(this.searchJoin).length) {
1938
- values.search_join = btoa(JSON.stringify(this.searchJoin));
1939
- }
1940
- return values;
1941
- }
1942
- getUrlQueryString() {
1943
- const superQueryString = super.getUrlQueryString();
1944
- const query = URL.getParsedQueryStringFromUrl();
1945
- let dynamicFilterQuerystring = '';
1946
- if (query.dynamic_filter) {
1947
- dynamicFilterQuerystring = `&${URL.getFormattedQueryString({
1948
- dynamic_filter: query.dynamic_filter,
1949
- })}`;
1950
- }
1951
- let searchJoinQuerystring = '';
1952
- if (query.search_join) {
1953
- searchJoinQuerystring = `&${URL.getFormattedQueryString({
1954
- search_join: query.search_join,
1955
- })}`;
1956
- }
1957
- return superQueryString + dynamicFilterQuerystring + searchJoinQuerystring;
1958
- }
1959
- /**
1960
- * Allows the comunication between the base filter and the dynamic filter
1961
- * @param filtroDinamico
1962
- * @returns
1963
- */
1964
- setBaseFilter(filtroDinamico) {
1965
- return this.setDynamicFilter(filtroDinamico);
1966
- }
1967
- /**
1968
- * Adds a new dynamic filter position or replace if exists
1969
- * @param column Dynamic Filter column name
1970
- * @param value Dynamic Filter value
1971
- * @returns Promise with data collection
1972
- */
1973
- addDynamicFilter(column, value) {
1974
- if (this.isValidDynamicFilterValue(column, value)) {
1975
- this.dynamicFilter[column] = value;
1976
- return this.updateDynamicFilter();
1977
- }
1978
- return this.removeDynamicFilter(column);
1979
- }
1980
- /**
1981
- * Removes a dynamic filter position
1982
- * @param column Dynamic Filter column name
1983
- * @returns Promise with data collection
1984
- */
1985
- removeDynamicFilter(column) {
1986
- delete this.dynamicFilter[column];
1987
- return this.updateDynamicFilter();
1988
- }
1989
- /**
1990
- * Sets new dynamic filter value
1991
- * @param filter Dynamic Filter value
1992
- * @returns Promise with data collection
1993
- */
1994
- setDynamicFilter(filter) {
1995
- this.dynamicFilter = {};
1996
- Object.keys(filter).forEach((column) => {
1997
- if (this.isValidDynamicFilterValue(column, filter[column])) {
1998
- this.dynamicFilter[column] = filter[column];
1999
- }
2000
- else {
2001
- delete this.dynamicFilter[column];
2002
- }
2003
- });
2004
- return this.updateDynamicFilter();
2005
- }
2006
- /**
2007
- * Clears Dynamic filter value
2008
- * @returns Promise with data collection
2009
- */
2010
- clearDynamicFilter() {
2011
- this.dynamicFilter = {};
2012
- return this.updateDynamicFilter();
2013
- }
2014
- /**
2015
- * Resets page and selected rows and tries to update the url
2016
- * @returns Promise with data collection
2017
- */
2018
- updateDynamicFilter() {
2019
- return __awaiter(this, void 0, void 0, function* () {
2020
- this.page = this.firstPage;
2021
- this.selectedRows = [];
2022
- this.visibleSelectedRows = [];
2023
- if (this.watchUrl) {
2024
- if (this.dynamicFilter && Object.keys(this.dynamicFilter).length) {
2025
- URL.updateQueryString({
2026
- dynamic_filter: btoa(JSON.stringify(this.dynamicFilter)),
2027
- });
2028
- }
2029
- else {
2030
- URL.updateQueryString({
2031
- dynamic_filter: undefined,
2032
- });
2033
- }
2034
- }
2035
- return this.get();
2036
- });
2037
- }
2038
- /**
2039
- * Checks if a filter value is valid
2040
- * @param value Filter value
2041
- * @returns Is valid filter value
2042
- */
2043
- isValidDynamicFilterValue(column, value) {
2044
- if (!Array.isArray(value))
2045
- return false;
2046
- return !this.reservedKeys[column]
2047
- && value.length > 0
2048
- && value.every((filterValue) => filterValue
2049
- && this.dynamicFilterOperations[filterValue.operation]
2050
- && this.dynamicFilterRelations[filterValue.relation]
2051
- && filterValue.value !== ''
2052
- && filterValue.value !== null);
2053
- }
2054
- /**
2055
- * Retrieves request params
2056
- */
2057
- getRequestParams() {
2058
- const requestParams = super.getRequestParams();
2059
- const isNotEmptyObj = (obj) => !!(obj && Object.keys(obj).length);
2060
- const isValid = this.dynamicFilter && Object.keys(this.dynamicFilter).every((column) => {
2061
- const value = this.dynamicFilter[column];
2062
- return value && value.length > 0 && this.isValidDynamicFilterValue(column, value);
2063
- });
2064
- if (isNotEmptyObj(this.dynamicFilter) && isValid) {
2065
- requestParams.dynamic_filter = btoa(JSON.stringify(this.dynamicFilter));
2066
- }
2067
- if (isNotEmptyObj(this.searchJoin)) {
2068
- requestParams.search_join = btoa(JSON.stringify(this.searchJoin));
2069
- }
2070
- return requestParams;
2071
- }
2072
- clone() {
2073
- return Object.assign(Object.assign({}, super.clone()), { dynamicFilter: this.dynamicFilter, searchJoin: this.searchJoin, type: 'tek-rest' });
2074
- }
2075
- }
2076
- DatasourceFactory.register('tek-rest', TekRestDatasource);
2077
-
2078
- /**
2079
- * Base class for TekGrid column
2080
- */
2081
- class TekGridColumn extends GridColumnEditable {
2082
- /* istanbul ignore next */
2083
- /**
2084
- * Creates a new TekGrid Column.
2085
- * @param props TekGrid column properties
2086
- */
2087
- constructor(props, grid) {
2088
- super(props);
2089
- /* filter component props */
2090
- this.filterProps = [];
2091
- /* column can be use to filter */
2092
- this.filterable = true;
2093
- /* should not consider lookup column on search */
2094
- this.skipLookupSearch = false;
2095
- /* column is grouped */
2096
- this.groupedValue = false;
2097
- /* Value to show when grouped value is empty */
2098
- this.groupLabelForEmptyValue = '';
2099
- /* column is visible */
2100
- this.isVisibleValue = true;
2101
- /**
2102
- * Defines if the column should store the componentProps datasource.data in memory
2103
- */
2104
- this.storeData = true;
2105
- this.lookup = debounce(this.lookupFn, 100);
2106
- this.grid = grid;
2107
- this.isVisible = this.getInitValue('isVisible', props.isVisible, this.isVisible);
2108
- this.filterProps = this.getInitValue('filterProps', props.filterProps, this.filterProps);
2109
- this.filterable = this.getInitValue('filterable', props.filterable, this.filterable);
2110
- this.filterIndex = this.getInitValue('filterIndex', props.filterIndex, this.filterIndex);
2111
- this.skipLookupSearch = this.getInitValue('skipLookupSearch', props.skipLookupSearch, this.skipLookupSearch);
2112
- this.grouped = this.getInitValue('grouped', props.grouped, this.grouped);
2113
- this.groupOpened = this.getInitValue('groupOpened', props.groupOpened, this.groupOpened);
2114
- this.aggregation = this.getInitValue('aggregation', props.aggregation, this.aggregation);
2115
- this.groupLabelForEmptyValue = this.getInitValue('groupLabelForEmptyValue', props.groupLabelForEmptyValue, this.groupLabelForEmptyValue);
2116
- this.storeData = this.getInitValue('storeData', props.storeData, this.storeData);
2117
- this.createAccessors();
2118
- }
2119
- getLookupData(lookupColumn, value) {
2120
- const emptyRow = {};
2121
- if (this.lookupData[value]) {
2122
- return this.lookupData[value];
2123
- }
2124
- this.lookupData[value] = emptyRow;
2125
- const dataIndex = this.lookupDatasource.data.findIndex((row) => row[lookupColumn] === value);
2126
- if (dataIndex !== -1) {
2127
- this.lookupData[value] = this.lookupDatasource.data[dataIndex];
2128
- return this.lookupData[value];
2129
- }
2130
- this.dataToLookup = (this.dataToLookup || []);
2131
- this.dataToLookup.push(value);
2132
- this.lookup(lookupColumn);
2133
- return emptyRow;
2134
- }
2135
- lookupFn(lookupColumn, dataToLookup) {
2136
- return __awaiter(this, void 0, void 0, function* () {
2137
- let data = [];
2138
- this.loading = true;
2139
- if (this.storeData) {
2140
- data = yield this.lookupDatasource.get();
2141
- }
2142
- else {
2143
- const filteredData = Array.from(new Set(dataToLookup || this.dataToLookup)); // remove duplicates
2144
- if (!dataToLookup) {
2145
- this.dataToLookup = [];
2146
- }
2147
- data = yield this.lookupDatasource.addFilter(lookupColumn, filteredData);
2148
- }
2149
- const lookupData = {};
2150
- data.forEach((row) => {
2151
- lookupData[row[lookupColumn]] = row;
2152
- });
2153
- this.lookupData = Object.assign(Object.assign({}, this.lookupData), lookupData);
2154
- this.lookupDataCount += 1;
2155
- this.loading = false;
2156
- });
2157
- }
2158
- getBatchLookupData(lookupColumn, values) {
2159
- return __awaiter(this, void 0, void 0, function* () {
2160
- const batch = [];
2161
- const dataToLookup = [];
2162
- values.forEach((value) => {
2163
- if (this.lookupData[value]) {
2164
- batch.push(this.lookupData[value]);
2165
- return;
2166
- }
2167
- const dataIndex = this.lookupDatasource.data.findIndex((row) => row[lookupColumn] === value);
2168
- if (dataIndex !== -1) {
2169
- this.lookupData[value] = this.lookupDatasource.data[dataIndex];
2170
- batch.push(this.lookupData[value]);
2171
- return;
2172
- }
2173
- dataToLookup.push(value);
2174
- });
2175
- if (dataToLookup.length > 0) {
2176
- yield this.lookupFn(lookupColumn, dataToLookup);
2177
- dataToLookup.forEach((value) => {
2178
- const row = this.lookupData[value];
2179
- if (row)
2180
- batch.push(row);
2181
- });
2182
- }
2183
- return batch;
2184
- });
2185
- }
2186
- /**
2187
- * Memory search, without changing lookupDatasource
2188
- */
2189
- memorySearch(search) {
2190
- return __awaiter(this, void 0, void 0, function* () {
2191
- if (!this.lookupDatasource) {
2192
- throw new Error('Can\'t search in a column that doesn\'t have a datasource');
2193
- }
2194
- let { data } = this.lookupDatasource;
2195
- if (this.storeData) {
2196
- if (!data.length) {
2197
- data = yield this.lookupDatasource.get();
2198
- }
2199
- }
2200
- else {
2201
- // datasource without the lookup filters
2202
- const defaultDs = DatasourceFactory.factory(Object.assign(Object.assign({}, this.componentProps.datasource), { lazyLoad: true, loadAll: true }));
2203
- data = yield defaultDs.get();
2204
- }
2205
- const { dataText } = this.componentProps;
2206
- const searchIn = Array.isArray(dataText) ? dataText : [dataText];
2207
- // get datasource as memory
2208
- const datasource = DatasourceFactory.factory({
2209
- searchIn,
2210
- data,
2211
- type: 'memory',
2212
- loadAll: true,
2213
- });
2214
- return datasource.setSearch(search);
2215
- });
2216
- }
2217
- get grouped() {
2218
- return this.groupedValue;
2219
- }
2220
- set grouped(value) {
2221
- const changed = value !== this.groupedValue;
2222
- this.groupedValue = value;
2223
- if (changed) {
2224
- this.changeGrouping();
2225
- }
2226
- }
2227
- get aggregation() {
2228
- return this.aggregationValue;
2229
- }
2230
- set aggregation(value) {
2231
- const changed = value !== this.aggregationValue;
2232
- this.aggregationValue = value;
2233
- if (changed) {
2234
- this.changeGrouping();
2235
- }
2236
- }
2237
- get groupOpened() {
2238
- return this.groupOpenedValue;
2239
- }
2240
- set groupOpened(value) {
2241
- const changed = value !== this.groupOpenedValue;
2242
- this.groupOpenedValue = value;
2243
- if (changed) {
2244
- this.changeGrouping();
2245
- }
2246
- }
2247
- get isVisible() {
2248
- return this.isVisibleValue && !this.grouped;
2249
- }
2250
- set isVisible(value) {
2251
- this.isVisibleValue = value;
2252
- }
2253
- changeGrouping() {
2254
- // wait for grid.constructor to be fully executed
2255
- setTimeout(() => {
2256
- this.grid.updateGrouping();
2257
- });
2258
- }
2259
- }
2260
-
2261
- /**
2262
- * Thrown when a row has incomplete group information.
2263
- * Provides details about the missing groups and the problematic row.
2264
- */
2265
- class IncompleteGroupsError extends Error {
2266
- constructor(row, missingGroups) {
2267
- const rowPreview = JSON.stringify(row);
2268
- const message = `Row groups are incomplete. Missing groups: ${missingGroups.join(', ')}.\nRow data:\n${rowPreview}`;
2269
- super(message);
2270
- this.name = 'IncompleteGroupsError';
2271
- }
2272
- }
2273
-
2274
- /* TekGrid Class */
2275
- class TekGrid extends GridEditable {
2276
- /**
2277
- * TekGrid class constructor
2278
- * @param props TekGrid properties
2279
- */
2280
- constructor(props) {
2281
- super(props);
2282
- /* Grid Title */
2283
- this.title = '';
2284
- /* Show Add button */
2285
- this.addButton = false;
2286
- /* Show Delete button */
2287
- this.deleteButton = 'none';
2288
- /* Show Delete button */
2289
- this.actions = [];
2290
- /* Show edit button */
2291
- this.showEditButtons = true;
2292
- /* Show Filter button */
2293
- this.filterButton = false;
2294
- /* Show SearchInput */
2295
- this.showSearch = true;
2296
- /* Show Column Filter button */
2297
- this.columnFilterButton = false;
2298
- /* Show Columns button */
2299
- this.columnsButton = false;
2300
- /* Defines if the grid is the unique grid on screen */
2301
- this.mainGrid = true;
2302
- /* Columns to be ignored on columns button */
2303
- this.columnsButtonIgnore = [];
2304
- /* Show Hide button */
2305
- this.showHideButton = true;
2306
- /**
2307
- * Enables column dragging
2308
- * @public
2309
- */
2310
- this.dragColumns = true;
2311
- /**
2312
- * Components that will be rendered on toolbar slot
2313
- */
2314
- this.toolbarConfig = [];
2315
- /**
2316
- * Enables column resizing
2317
- * @public
2318
- */
2319
- this.resizeColumns = true;
2320
- /**
2321
- * Enables layout saving
2322
- * @public
2323
- */
2324
- this.showLayoutOptions = true;
2325
- this.modalFilterProps = {
2326
- name: this.name,
2327
- height: 'auto',
2328
- persistent: true,
2329
- cssClass: '',
2330
- cssStyle: '',
2331
- dark: false,
2332
- draggable: false,
2333
- fullscreen: false,
2334
- dragHandle: '',
2335
- title: 'FILTER',
2336
- };
2337
- /**
2338
- * Show export button
2339
- */
2340
- this.showExport = false;
2341
- /**
2342
- * Show refresh button
2343
- */
2344
- this.showReload = true;
2345
- /**
2346
- * Export config
2347
- */
2348
- this.exportConfig = [
2349
- {
2350
- type: 'pdf',
2351
- label: I18n.translate('TEKGRID_EXPORT_AS', { type: 'PDF' }),
2352
- multiOption: [
2353
- { label: I18n.translate('TEKGRID_PORTRAIT'), iconName: 'mdi-file-outline' },
2354
- {
2355
- label: I18n.translate('TEKGRID_LANDSCAPE'),
2356
- iconName: 'mdi-file-outline',
2357
- cssClass: 'tek-grid-export-landscape',
2358
- reportParams: { portrait: false },
2359
- },
2360
- ],
2361
- },
2362
- {
2363
- type: 'xls',
2364
- label: I18n.translate('TEKGRID_EXPORT_AS', {
2365
- type: 'XLS',
2366
- }),
2367
- },
2368
- {
2369
- type: 'xls2',
2370
- label: I18n.translate('TEKGRID_EXPORT_AS', {
2371
- type: `XLS ${I18n.translate('TEKGRID_WITH_GROUPS')}`,
2372
- }),
2373
- },
2374
- {
2375
- type: 'xls3',
2376
- label: I18n.translate('TEKGRID_EXPORT_AS', {
2377
- type: `XLS ${I18n.translate('TEKGRID_GRID_MIRROR')}`,
2378
- }),
2379
- },
2380
- {
2381
- type: 'csv',
2382
- label: I18n.translate('TEKGRID_EXPORT_AS', { type: 'CSV' }),
2383
- },
2384
- ];
2385
- /**
2386
- * Groups should be opened by default after building
2387
- */
2388
- this.groupsOpened = false;
2389
- /**
2390
- * Show Total summary
2391
- */
2392
- this.showSummaryTotal = true;
2393
- this.groupColumnNames = [];
2394
- this.summaryColumns = [];
2395
- this.groupColumns = [];
2396
- this.toolbarSlotProps = false;
2397
- this.groupedData = [];
2398
- this.editNewRowsOnly = false;
2399
- this.showCheckboxAllFilter = Config.gridShowCheckboxAllFilter || false;
2400
- this.defaultFilter = {};
2401
- this.toolbarOpened = true;
2402
- this.reportTitle = '';
2403
- this.defaultLazy = false;
2404
- this.groups = [];
2405
- this.summary = {};
2406
- /**
2407
- * Tasks that should be finished before loading the grid data
2408
- */
2409
- this.tasksBeforeLoad = [];
2410
- this.request = debounce(() => { this.datasource.get(); }, 500);
2411
- this.updateGrouping = debounce((lazyLoad = false) => {
2412
- this.updateGroupedData(lazyLoad);
2413
- }, 100);
2414
- this.title = this.getInitValue('title', props.title, this.title);
2415
- this.addButton = this.getInitValue('addButton', props.addButton, this.addButton);
2416
- this.deleteButton = this.getInitValue('deleteButton', props.deleteButton, this.deleteButton);
2417
- this.filterButton = this.getInitValue('filterButton', props.filterButton, this.filterButton);
2418
- this.showSearch = this.getInitValue('showSearch', props.showSearch, this.showSearch);
2419
- this.columnFilterButton = this.getInitValue('columnFilterButton', props.columnFilterButton, this.columnFilterButton);
2420
- this.columnsButton = this.getInitValue('columnsButton', props.columnsButton, this.columnsButton);
2421
- this.columnsButtonIgnore = this.getInitValue('columnsButtonIgnore', props.columnsButtonIgnore, this.columnsButtonIgnore);
2422
- this.showHideButton = this.getInitValue('showHideButton', props.showHideButton, this.showHideButton);
2423
- this.showEditButtons = this.getInitValue('showEditButtons', props.showEditButtons, this.showEditButtons);
2424
- this.dragColumns = this.getInitValue('dragColumns', props.dragColumns, this.dragColumns);
2425
- this.resizeColumns = this.getInitValue('resizeColumns', props.resizeColumns, this.resizeColumns);
2426
- this.showLayoutOptions = this.getInitValue('showLayoutOptions', props.showLayoutOptions, this.showLayoutOptions);
2427
- this.xlsDefaultType = this.getInitValue('xlsDefaultType', props.xlsDefaultType, this.xlsDefaultType);
2428
- this.showExport = this.getInitValue('showExport', props.showExport, this.showExport);
2429
- this.showReload = this.getInitValue('showReload', props.showReload, this.showReload);
2430
- this.exportConfig = this.getInitValue('exportConfig', props.exportConfig, this.exportConfig);
2431
- this.modalFilterProps = this.getInitValue('modalFilterProps', props.modalFilterProps, this.modalFilterProps);
2432
- this.exportActions = props.exportActions || this.exportActions;
2433
- this.groupsOpened = this.getInitValue('groupsOpened', props.groupsOpened, this.groupsOpened);
2434
- this.showSummaryTotal = this.getInitValue('showSummaryTotal', props.showSummaryTotal, this.showSummaryTotal);
2435
- this.showCheckboxAllFilter = this.getInitValue('showCheckboxAllFilter', props.showCheckboxAllFilter, this.showCheckboxAllFilter);
2436
- this.defaultFilter = this.getInitValue('defaultFilter', props.defaultFilter, this.defaultFilter);
2437
- this.toolbarConfig = this.getInitValue('toolbarConfig', props.toolbarConfig, this.toolbarConfig);
2438
- this.toolbarOpened = this.getInitValue('toolbarOpened', props.toolbarOpened, this.toolbarOpened);
2439
- this.editNewRowsOnly = this.getInitValue('editNewRowsOnly', props.editNewRowsOnly, this.editNewRowsOnly);
2440
- this.mainGrid = this.getInitValue('mainGrid', props.mainGrid, this.mainGrid);
2441
- this.reportTitle = this.getInitValue('reportTitle', props.reportTitle, this.reportTitle);
2442
- this.reportLabelFormatter = this.getInitValue('reportLabelFormatter', props.reportLabelFormatter, this.reportLabelFormatter);
2443
- this.actions = props.actions || this.actions;
2444
- this.toolbarSlotProps = props.toolbarSlot !== undefined;
2445
- if (this.deleteButton === 'selection') {
2446
- this.selectable = true;
2447
- }
2448
- this.keyShortcutKeyMapping = {
2449
- 'mod+f': {
2450
- event: this.focusSearchInput.bind(this),
2451
- stop: true,
2452
- active: !this.mainGrid,
2453
- input: true,
2454
- },
2455
- 'mod+l': {
2456
- event: ({ event, element }) => {
2457
- if (this.filterButton) {
2458
- const instance = Metadata.getInstance(`${this.name}_filterButton`);
2459
- instance.click(event, element);
2460
- }
2461
- },
2462
- stop: true,
2463
- active: !this.mainGrid,
2464
- input: true,
2465
- },
2466
- 'mod+enter': {
2467
- event: () => {
2468
- const instance = Metadata.getInstance(`${this.name}_actions_dropdown`);
2469
- instance.setFocus();
2470
- instance.value = !instance.value;
2471
- },
2472
- stop: true,
2473
- active: !this.mainGrid,
2474
- input: true,
2475
- },
2476
- };
2477
- this.createAccessors();
2478
- this.defaultLazy = this.getDefaultLazy(props);
2479
- this.gridBase = new GridBase(this);
2480
- this.filterOperationsDatasource = this.gridBase.getFilterOperationsDatasource();
2481
- this.filterRelationsDatasource = this.gridBase.getFilterRelationsDatasource();
2482
- }
2483
- getDatasourceDefaults() {
2484
- return { lazyLoad: true };
2485
- }
2486
- getDefaultLazy(props) {
2487
- if (typeof props.datasource === 'object') {
2488
- return props.datasource.lazyLoad;
2489
- }
2490
- if (typeof props.datasource === 'string' && Accessor.isAccessorDefinition(props.datasource)) {
2491
- const [controller, accessor] = Accessor.getAccessor(props.datasource);
2492
- const instance = Loader.getInstance(controller);
2493
- return instance[accessor].lazyLoad || false;
2494
- }
2495
- return false;
2496
- }
2497
- onCreated() {
2498
- super.onCreated();
2499
- Loader.addController(`GridController_${this.componentId}`, new GridController(this));
2500
- if (!this.toolbarSlotProps)
2501
- this.toolbarSlot = this.gridBase.createToolbarProps();
2502
- this.navigationKeyMapping.left = {
2503
- event: this.directionalLeft.bind(this),
2504
- stop: true,
2505
- active: true,
2506
- };
2507
- this.navigationKeyMapping.right = {
2508
- event: this.directionalRight.bind(this),
2509
- stop: true,
2510
- active: true,
2511
- };
2512
- }
2513
- onMounted(element) {
2514
- super.onMounted(element);
2515
- KeyMap.bind(this.keyShortcutKeyMapping, this, element);
2516
- this.initGrouping(this.defaultLazy);
2517
- }
2518
- onBeforeDestroy() {
2519
- super.onBeforeDestroy();
2520
- KeyMap.unbind(this.keyShortcutKeyMapping, this);
2521
- }
2522
- focusSearchInput() {
2523
- const searchInput = Metadata.getInstance(`${this.name}_gridSearch`);
2524
- searchInput.setFocus();
2525
- }
2526
- get layoutOptions() {
2527
- if (!this.showLayoutOptions)
2528
- return undefined;
2529
- return Metadata.getInstance(`${this.name}_layout_options`);
2530
- }
2531
- instantiateCancelColumn() {
2532
- return new TekGridColumn(this.getCancelColumnProps(), this);
2533
- }
2534
- /**
2535
- * Get Grid columns objects
2536
- * @param columns Grid columns parameter
2537
- */
2538
- getColumns(columns) {
2539
- return columns.map((column) => new TekGridColumn(column, this));
2540
- }
2541
- columnHasFilterData(column) {
2542
- if (this.datasource instanceof TekRestDatasource
2543
- || this.datasource instanceof TekMemoryDatasource) {
2544
- const dynamicFilter = this.datasource.dynamicFilter[column.name];
2545
- return dynamicFilter && dynamicFilter.length > 0;
2546
- }
2547
- return this.datasource.filter[column.name] && this.datasource.filter[column.name].length > 0;
2548
- }
2549
- buildReportGroups() {
2550
- return this.columns
2551
- .filter((column) => column.grouped)
2552
- .map((column) => ({
2553
- field: column.name,
2554
- header: {
2555
- displayfield: column.name,
2556
- label: I18n.translate(column.label),
2557
- },
2558
- name: column.name,
2559
- }));
2560
- }
2561
- buildReportAggregations() {
2562
- const aggregations = {};
2563
- this.columns
2564
- .filter((column) => column.aggregation)
2565
- .forEach((column) => {
2566
- aggregations[column.name] = { expression: column.aggregation };
2567
- });
2568
- return aggregations;
2569
- }
2570
- getReport(type, portrait, rowObj = {}) {
2571
- return __awaiter(this, void 0, void 0, function* () {
2572
- const report = new Report(this, this.title || this.reportTitle);
2573
- const reportGroups = this.buildReportGroups();
2574
- const reportAggregations = this.buildReportAggregations();
2575
- let typeValue = type;
2576
- if (reportGroups.length === 0 && type.substring(0, 3) === 'xls') {
2577
- typeValue = 'xls';
2578
- }
2579
- let filter;
2580
- if (this.datasource instanceof TekRestDatasource
2581
- || this.datasource instanceof TekMemoryDatasource) {
2582
- const dynamicFilter = Object.assign({}, this.datasource.dynamicFilter);
2583
- const formatFilter = (name) => __awaiter(this, void 0, void 0, function* () {
2584
- let column;
2585
- try {
2586
- column = this.getColumn(name);
2587
- }
2588
- catch (e) {
2589
- if (e instanceof ColumnNotFoundError) {
2590
- return;
2591
- }
2592
- throw e;
2593
- }
2594
- const { label } = column;
2595
- // change filter keys to column labels
2596
- dynamicFilter[label] = [...dynamicFilter[name]];
2597
- delete dynamicFilter[name];
2598
- if (!column.componentProps.datasource)
2599
- return;
2600
- const values = dynamicFilter[label].map((filterItem) => filterItem.value);
2601
- yield column.getBatchLookupData(name, values);
2602
- dynamicFilter[label] = dynamicFilter[label].map((filterItem) => {
2603
- const item = Object.assign({}, filterItem);
2604
- const { value } = item;
2605
- const formatted = column.formatterByRow({ [name]: value }, { formatterDataText: undefined });
2606
- item.value = formatted;
2607
- return item;
2608
- });
2609
- });
2610
- const promises = Object.keys(dynamicFilter).map(formatFilter);
2611
- yield Promise.all(promises);
2612
- const reportFilter = new ReportFilter(dynamicFilter);
2613
- filter = reportFilter.build();
2614
- }
2615
- let beforeOpen;
2616
- if (typeof this.events.beforeOpenReport === 'function') {
2617
- beforeOpen = this.events.beforeOpenReport;
2618
- }
2619
- try {
2620
- const reportUrl = yield report
2621
- .getReport(typeValue, portrait, {
2622
- metaData: merge(rowObj, {
2623
- filter,
2624
- groups: reportGroups,
2625
- columns: reportAggregations,
2626
- xlsDefaultType: this.xlsDefaultType,
2627
- }),
2628
- }, beforeOpen, this.reportLabelFormatter);
2629
- window.open(reportUrl);
2630
- }
2631
- catch (e) {
2632
- if (e instanceof EmptyDataError) {
2633
- AlertService.show({ name: 'no-data-warning', text: I18n.translate('TEKGRID_NO_DATA'), color: 'warning' });
2634
- return;
2635
- }
2636
- throw e;
2637
- }
2638
- });
2639
- }
2640
- registerTask(task) {
2641
- this.tasksBeforeLoad.push(task);
2642
- }
2643
- /**
2644
- * Loads grid data after resolving all tasks
2645
- */
2646
- loadAfterTasks() {
2647
- return __awaiter(this, void 0, void 0, function* () {
2648
- Promise.all(this.tasksBeforeLoad.map((promise) => promise.catch(() => undefined)));
2649
- this.tasksBeforeLoad = [];
2650
- return this.request();
2651
- });
2652
- }
2653
- initGrouping(lazyLoad) {
2654
- this.initGroups();
2655
- this.initSummaryColumns();
2656
- const originalGetFunction = this.datasource.get;
2657
- this.originalDatasourceLoadAll = this.datasource.loadAll;
2658
- this.originalDatasourceLimit = this.datasource.limit;
2659
- this.datasource.get = this.buildGetFunction(originalGetFunction);
2660
- this.updateGrouping(lazyLoad);
2661
- }
2662
- buildGetFunction(originalGet) {
2663
- return () => __awaiter(this, void 0, void 0, function* () {
2664
- return originalGet.call(this.datasource).then((data) => {
2665
- if (this.groupColumns.length
2666
- || (this.showSummaryTotal && this.summaryColumns.length)) {
2667
- this.buildGroupedData();
2668
- }
2669
- return data;
2670
- });
2671
- });
2672
- }
2673
- updateGroupedData(lazyLoad) {
2674
- return __awaiter(this, void 0, void 0, function* () {
2675
- this.initSummaryColumns();
2676
- this.groupedData = [];
2677
- this.groupColumns = this.columns.filter((column) => column.grouped);
2678
- this.groupColumnNames = this.groupColumns.map((column) => column.name);
2679
- if (this.groupColumns.length
2680
- || (this.showSummaryTotal && this.summaryColumns.length)) {
2681
- if (this.groupColumns.length) {
2682
- const groupOrderColumns = this.groupColumnNames.map((column) => `${column}.asc`);
2683
- const otherOrderColumns = this.datasource.order.filter((column) => this.groupColumnNames.indexOf(column.split('.')[0]) === -1);
2684
- this.datasource.order = groupOrderColumns.concat(otherOrderColumns);
2685
- }
2686
- this.datasource.loadAll = true;
2687
- }
2688
- else {
2689
- this.datasource.loadAll = this.originalDatasourceLoadAll;
2690
- this.datasource.limit = this.originalDatasourceLimit;
2691
- }
2692
- if (!lazyLoad && this.datasource) {
2693
- yield this.loadAfterTasks();
2694
- }
2695
- if (this.virtualScroll && this.viewUpdateScrollData) {
2696
- this.viewUpdateScrollData();
2697
- }
2698
- if (this.viewUpdateFixedColumns) {
2699
- this.viewUpdateFixedColumns();
2700
- }
2701
- });
2702
- }
2703
- /**
2704
- * It takes a flat array of data and groups it by the group columns specified in
2705
- * the grid.
2706
- */
2707
- buildGroupedData() {
2708
- this.initGroups();
2709
- this.initSummaryColumns();
2710
- this.groupedData = [];
2711
- this.datasource.data.forEach((row) => {
2712
- let groupBreak = false;
2713
- this.groups.forEach((group, index) => {
2714
- const groupValue = row[group.name];
2715
- if (group.lastValue !== groupValue || groupBreak) {
2716
- if (!groupBreak) {
2717
- this.addGroupFooters(index);
2718
- }
2719
- group.lastValue = groupValue;
2720
- this.resetFooterVariables(group);
2721
- this.addGroupHeader(row, group, index);
2722
- groupBreak = true;
2723
- }
2724
- });
2725
- this.groups.forEach((group) => {
2726
- group.lastGroupHeaderRow.children.push(row);
2727
- });
2728
- const groupHeaders = this.groups
2729
- .map((group) => group.lastGroupHeaderRow)
2730
- .filter(Boolean);
2731
- this.groupedData.push(Object.assign(Object.assign({}, row), { groupHeaders }));
2732
- this.calcSummary(row);
2733
- });
2734
- if (this.groupedData.length > 0) {
2735
- this.addGroupFooters(0);
2736
- if (this.showSummaryTotal && this.summaryColumns.length > 0) {
2737
- const summaryRow = this.getSummary();
2738
- this.groupedData.push(summaryRow);
2739
- }
2740
- }
2741
- }
2742
- initGroups() {
2743
- this.groups = [];
2744
- this.groupColumns.forEach((column) => {
2745
- const newGroup = {
2746
- column,
2747
- name: column.name,
2748
- label: column.label,
2749
- lastValue: undefined,
2750
- initialized: false,
2751
- footer: {},
2752
- };
2753
- this.resetFooterVariables(newGroup);
2754
- this.groups.push(newGroup);
2755
- });
2756
- }
2757
- initSummaryColumns() {
2758
- this.summaryColumns = this.columns.filter((column) => !!column.aggregation && !column.grouped);
2759
- this.summary = {};
2760
- }
2761
- addGroupHeader(row, group, index) {
2762
- const groupValue = this.getGroupValue(group, row) || group.column.groupLabelForEmptyValue;
2763
- const groupHeaderRow = {
2764
- group: true,
2765
- groupRow: row,
2766
- groupColumnName: group.column.name,
2767
- groupHeader: true,
2768
- groupIndex: index,
2769
- groupLabel: I18n.translate(group.label),
2770
- groupValue,
2771
- groupOpened: group.column.groupOpened || this.groupsOpened,
2772
- groupHeaders: [],
2773
- children: [],
2774
- };
2775
- // add header for outer groups to the added row
2776
- for (let i = 0; i < index; i += 1) {
2777
- groupHeaderRow.groupHeaders.push(this.groups[i].lastGroupHeaderRow);
2778
- }
2779
- group.lastGroupHeaderRow = groupHeaderRow;
2780
- group.initialized = true;
2781
- this.groupedData.push(groupHeaderRow);
2782
- }
2783
- addGroupFooters(groupIndex) {
2784
- if (this.summaryColumns.length === 0) {
2785
- return;
2786
- }
2787
- for (let i = this.groups.length - 1; i >= groupIndex; i -= 1) {
2788
- if (!this.groups[i].initialized)
2789
- return;
2790
- const groupFooterRow = this.getGroupFooter(this.groups[i], i);
2791
- groupFooterRow.groupHeaders = this.getGroupHeaders(groupIndex);
2792
- this.groupedData.push(groupFooterRow);
2793
- }
2794
- }
2795
- /**
2796
- * Creates a group footer, calculating its summary data
2797
- * @param group Group to which this footer is related
2798
- * @param groupIndex Index of the group
2799
- * @returns new group footer
2800
- */
2801
- getGroupFooter(group, groupIndex) {
2802
- const groupFooterRow = Object.assign({ groupIndex, groupFooter: true, groupHeaders: [], groupLabel: group.lastGroupHeaderRow.groupLabel, groupValue: group.lastGroupHeaderRow.groupValue }, this.getSummaryData(group.footer));
2803
- return groupFooterRow;
2804
- }
2805
- /**
2806
- * Gets all of the group headers that belong to the group at the specified index
2807
- * This method should be called only during the groups creation process because it depends on the
2808
- * group creation order (because it accesses lastGroupHeaderRow that changes during the creation process)
2809
- * @param groupIndex
2810
- * @returns
2811
- */
2812
- getGroupHeaders(groupIndex) {
2813
- const groupHeaders = [];
2814
- for (let i = 0; i <= groupIndex; i += 1) {
2815
- groupHeaders.push(this.groups[i].lastGroupHeaderRow);
2816
- }
2817
- return groupHeaders;
2818
- }
2819
- /**
2820
- * Updates all footers summary data and the summary total
2821
- */
2822
- updateSummary() {
2823
- this.summary = {};
2824
- this.groups.forEach((group) => {
2825
- this.resetFooterVariables(group);
2826
- });
2827
- this.groupedData.forEach((row) => {
2828
- if (this.isGroupHeader(row))
2829
- return;
2830
- if (this.isGroupFooter(row)) {
2831
- this.updateGroupFooterSummary(row);
2832
- this.resetFooterVariables(this.groups[row.groupIndex]);
2833
- return;
2834
- }
2835
- if (this.isGroupSummary(row)) {
2836
- this.updateSummaryTotal(row);
2837
- return;
2838
- }
2839
- this.calcSummary(row);
2840
- });
2841
- }
2842
- /**
2843
- * Takes a group footer and updates its summary data
2844
- */
2845
- updateGroupFooterSummary(groupFooter) {
2846
- const group = this.groups[groupFooter.groupIndex];
2847
- const summary = this.getSummaryData(group.footer);
2848
- Object.keys(summary).forEach((key) => {
2849
- // change properties one by one to avoid changing the object reference
2850
- groupFooter[key] = summary[key];
2851
- });
2852
- }
2853
- /**
2854
- * Updates the total summary data
2855
- */
2856
- updateSummaryTotal(summaryTotal) {
2857
- const summary = this.getSummaryData(this.summary);
2858
- Object.keys(summary).forEach((key) => {
2859
- // change properties one by one to avoid changing the object reference
2860
- summaryTotal[key] = summary[key];
2861
- });
2862
- }
2863
- resetFooterVariables(group) {
2864
- this.summaryColumns.forEach((column) => {
2865
- group.footer[column.name] = {
2866
- count: 0,
2867
- sum: undefined,
2868
- avg: undefined,
2869
- min: undefined,
2870
- max: undefined,
2871
- };
2872
- });
2873
- }
2874
- isUndefined(value) {
2875
- return value === undefined || value === null;
2876
- }
2877
- calcSummaryValues(columnName, summary, rowValue) {
2878
- if (!this.isUndefined(rowValue)) {
2879
- summary.count += 1;
2880
- if (this.events.calcSummary) {
2881
- this.callEvent('calcSummary', {
2882
- component: this, columnName, summary, rowValue,
2883
- });
2884
- }
2885
- else {
2886
- if (summary.min === undefined)
2887
- summary.min = rowValue;
2888
- if (summary.max === undefined)
2889
- summary.max = rowValue;
2890
- summary.min = rowValue < summary.min ? rowValue : summary.min;
2891
- summary.max = rowValue > summary.max ? rowValue : summary.max;
2892
- if (typeof rowValue === 'number') {
2893
- summary.sum = (summary.sum || 0) + rowValue;
2894
- }
2895
- }
2896
- }
2897
- }
2898
- calcSummary(row) {
2899
- if (this.summaryColumns.length === 0)
2900
- return;
2901
- this.summaryColumns.forEach((column) => {
2902
- const columnName = column.name;
2903
- const rowValue = this.getVisibleValue(row, column);
2904
- if (this.isUndefined(this.summary[columnName])) {
2905
- this.summary[columnName] = {
2906
- count: 0,
2907
- sum: undefined,
2908
- avg: undefined,
2909
- min: undefined,
2910
- max: undefined,
2911
- };
2912
- }
2913
- this.calcSummaryValues(columnName, this.summary[columnName], rowValue);
2914
- this.groups.forEach((group) => {
2915
- this.calcSummaryValues(columnName, group.footer[columnName], rowValue);
2916
- });
2917
- });
2918
- }
2919
- getSummary() {
2920
- const summaryRow = Object.assign({ groupFooter: true, groupSummary: true }, this.getSummaryData(this.summary));
2921
- return summaryRow;
2922
- }
2923
- getSummaryData(group) {
2924
- const summaryData = {};
2925
- this.summaryColumns.forEach((column) => {
2926
- const { aggregation } = column;
2927
- const currentGroup = group[column.name];
2928
- if (aggregation === 'COUNT') {
2929
- summaryData[column.name] = currentGroup.count;
2930
- }
2931
- else if (aggregation === 'SUM') {
2932
- summaryData[column.name] = currentGroup.sum;
2933
- }
2934
- else if (aggregation === 'AVG') {
2935
- if (currentGroup.avg) {
2936
- summaryData[column.name] = currentGroup.avg;
2937
- }
2938
- else if (typeof currentGroup.sum === 'number') {
2939
- summaryData[column.name] = currentGroup.sum / currentGroup.count;
2940
- }
2941
- }
2942
- else if (aggregation === 'MIN') {
2943
- summaryData[column.name] = currentGroup.min;
2944
- }
2945
- else {
2946
- // if (aggregation === 'MAX') {
2947
- summaryData[column.name] = currentGroup.max;
2948
- }
2949
- });
2950
- return summaryData;
2951
- }
2952
- openGroup(group) {
2953
- group.groupOpened = !group.groupOpened;
2954
- if (this.virtualScroll && this.viewUpdateScrollData)
2955
- this.viewUpdateScrollData();
2956
- }
2957
- isItemVisible(row) {
2958
- return (!row.groupHeaders
2959
- || !row.groupHeaders.length
2960
- || row.groupHeaders.every((group) => group.groupOpened));
2961
- }
2962
- getGroupValue(group, row) {
2963
- const groupColumn = this.getColumn(group.column.name);
2964
- const rowKey = row[this.datasource.uniqueKey];
2965
- if (!this.cellsApplied[rowKey]) {
2966
- this.reapplyConditions(row);
2967
- }
2968
- const cellProps = this.cellsApplied[rowKey][groupColumn.name];
2969
- const groupValue = groupColumn.formatterByRow(row, cellProps);
2970
- return groupValue;
2971
- }
2972
- getEditedRows(revalidate = false, silent = false) {
2973
- return super.getEditedRows(revalidate, silent).map((row) => {
2974
- const cleanRow = Object.assign({}, row);
2975
- delete cleanRow.groupHeaders;
2976
- return cleanRow;
2977
- });
2978
- }
2979
- setSearch(search) {
2980
- return __awaiter(this, void 0, void 0, function* () {
2981
- return this.gridBase.setSearch(search);
2982
- });
2983
- }
2984
- isGrouped() {
2985
- return (this.groupColumnNames.length
2986
- || (this.showSummaryTotal && this.summaryColumns.length));
2987
- }
2988
- navigateDown(params) {
2989
- if (!this.isGrouped()) {
2990
- super.navigateDown();
2991
- return;
2992
- }
2993
- if (this.cellSelection && this.viewNavigate) {
2994
- this.viewNavigate('down');
2995
- return;
2996
- }
2997
- const { index } = params;
2998
- if (!this.groupedData.length || index === this.groupedData.length)
2999
- return;
3000
- const { uniqueKey, currentRow } = this.datasource;
3001
- const rowIndex = index !== undefined
3002
- ? index
3003
- : this.groupedData.findIndex((row) => {
3004
- if (currentRow.group) {
3005
- return row.group && row.groupValue === currentRow.groupValue;
3006
- }
3007
- return row[uniqueKey] && row[uniqueKey] === currentRow[uniqueKey];
3008
- });
3009
- const newRow = this.groupedData[rowIndex + 1];
3010
- if (!newRow || !this.isItemVisible(newRow) || newRow.groupFooter) {
3011
- this.navigateDown({ index: rowIndex + 1 });
3012
- return;
3013
- }
3014
- this.datasource.currentRow = newRow;
3015
- }
3016
- navigateUp(params) {
3017
- if (!this.isGrouped()) {
3018
- super.navigateUp();
3019
- return;
3020
- }
3021
- if (this.cellSelection && this.viewNavigate) {
3022
- this.viewNavigate('up');
3023
- return;
3024
- }
3025
- const { index } = params;
3026
- if (!this.groupedData.length || index === -1)
3027
- return;
3028
- const { uniqueKey, currentRow } = this.datasource;
3029
- let rowIndex;
3030
- rowIndex = index !== undefined
3031
- ? index
3032
- : this.groupedData.findIndex((row) => {
3033
- if (currentRow.group) {
3034
- return row.group && row.groupValue === currentRow.groupValue;
3035
- }
3036
- return row[uniqueKey] && row[uniqueKey] === currentRow[uniqueKey];
3037
- });
3038
- if (rowIndex === -1)
3039
- rowIndex = this.groupedData.length;
3040
- const newRow = this.groupedData[rowIndex - 1];
3041
- if (!newRow || !this.isItemVisible(newRow) || newRow.groupFooter) {
3042
- this.navigateUp({ index: rowIndex - 1 });
3043
- return;
3044
- }
3045
- this.datasource.currentRow = newRow;
3046
- }
3047
- directionalLeft(params) {
3048
- var _a;
3049
- const { currentRow } = this.datasource;
3050
- if (currentRow.group && currentRow.groupOpened) {
3051
- currentRow.groupOpened = false;
3052
- return;
3053
- }
3054
- if (!this.cellSelection && ((_a = currentRow.groupHeaders) === null || _a === void 0 ? void 0 : _a.length)) {
3055
- this.datasource.currentRow = currentRow.groupHeaders[currentRow.groupHeaders.length - 1];
3056
- return;
3057
- }
3058
- this.navigateLeft(params);
3059
- }
3060
- directionalRight(params) {
3061
- const { currentRow } = this.datasource;
3062
- if (currentRow.group && !currentRow.groupOpened) {
3063
- currentRow.groupOpened = true;
3064
- return;
3065
- }
3066
- this.navigateRight(params);
3067
- }
3068
- /**
3069
- * Dispatches row click event
3070
- * @param row Grid row
3071
- * @param event DOM event
3072
- * @param element DOM Element
3073
- */
3074
- rowClick(row, event, element) {
3075
- if (!this.preventRowClick) {
3076
- this.datasource.currentRow = row;
3077
- this.callEvent('rowClick', {
3078
- event,
3079
- element,
3080
- row,
3081
- component: this,
3082
- column: undefined,
3083
- });
3084
- }
3085
- this.preventRowClick = false;
3086
- }
3087
- rowDoubleClick(row, event, element) {
3088
- if (!this.preventRowDoubleClick) {
3089
- this.datasource.currentRow = row;
3090
- this.callEvent('rowDoubleClick', {
3091
- event,
3092
- element,
3093
- row,
3094
- component: this,
3095
- column: undefined,
3096
- });
3097
- }
3098
- this.preventRowDoubleClick = false;
3099
- }
3100
- /**
3101
- * Dispatches group row click event
3102
- * @param row Grid row
3103
- * @param event DOM event
3104
- * @param element DOM Element
3105
- */
3106
- groupRowClick(row, event, element) {
3107
- if (!this.preventRowClick) {
3108
- this.datasource.currentRow = row;
3109
- this.callEvent('groupRowClick', {
3110
- event,
3111
- element,
3112
- row,
3113
- component: this,
3114
- column: undefined,
3115
- });
3116
- }
3117
- this.preventRowClick = false;
3118
- }
3119
- groupRowDoubleClick(row, event, element) {
3120
- if (!this.preventRowDoubleClick) {
3121
- this.datasource.currentRow = row;
3122
- this.callEvent('groupRowDoubleClick', {
3123
- event,
3124
- element,
3125
- row,
3126
- component: this,
3127
- column: undefined,
3128
- });
3129
- }
3130
- this.preventRowDoubleClick = false;
3131
- }
3132
- /**
3133
- * Dispatches group select/unselect event
3134
- * @param row Group row
3135
- * @param isSelected Row is selected
3136
- * @param event DOM event
3137
- * @param element DOM Element
3138
- */
3139
- selectGroupClick(row, isSelected, event, element) {
3140
- if (isSelected) {
3141
- this.callEvent('groupSelected', {
3142
- event,
3143
- element,
3144
- row,
3145
- component: this,
3146
- column: undefined,
3147
- });
3148
- }
3149
- else {
3150
- this.callEvent('groupUnselected', {
3151
- event,
3152
- element,
3153
- row,
3154
- component: this,
3155
- column: undefined,
3156
- });
3157
- }
3158
- }
3159
- getAtomInstance(key) {
3160
- return this.gridBase.getAtomInstance(key);
3161
- }
3162
- getFilterInputs(columnName) {
3163
- return this.gridBase.getFilterInputs(columnName);
3164
- }
3165
- isColumnSearchable(column) {
3166
- return column.searchable && (!this.searchVisibleOnly || column.isVisible || column.grouped);
3167
- }
3168
- getColumn(name) {
3169
- return super.getColumn(name);
3170
- }
3171
- /**
3172
- * Adds new row to the datasource data and pushes it to the editedRows
3173
- * @param row Row
3174
- * @param position whether the new Row will be inserted at the beginning or end of the data array
3175
- */
3176
- addNewRow(row, position = 'end') {
3177
- const _super = Object.create(null, {
3178
- addNewRow: { get: () => super.addNewRow }
3179
- });
3180
- return __awaiter(this, void 0, void 0, function* () {
3181
- if (!this.groupColumns.length) {
3182
- yield _super.addNewRow.call(this, row, position);
3183
- return;
3184
- }
3185
- this.insertRowInDatasource(row, position);
3186
- this.saveRowReference(row);
3187
- this.addGroupedRow(row, position);
3188
- this.editing = true;
3189
- });
3190
- }
3191
- /**
3192
- * Takes a row and adds it to the selected group (datasource.currentRow)
3193
- * @param row the new row to be added
3194
- * @param position the position, at the beginning of the group or at the end
3195
- */
3196
- addToSelection(row, position = 'end') {
3197
- const { currentRow } = this.datasource;
3198
- // if the currentRow is a group, use the groupRow as reference
3199
- const referenceRow = this.isGroupHeader(currentRow) ? currentRow.groupRow : currentRow;
3200
- // extract the group properties from the referenceRow to add to the new row
3201
- const groupProperties = extractProperties(referenceRow, this.groupColumnNames);
3202
- const rowWithGroups = Object.assign(Object.assign({}, row), groupProperties);
3203
- return this.addNewRow(rowWithGroups, position);
3204
- }
3205
- /**
3206
- * Adds a new row to the groupedData array
3207
- * @param row the new row to be added
3208
- * @param position the position, at the beginning of the group or at the end
3209
- */
3210
- addGroupedRow(row, position) {
3211
- const missingGroups = this.findMissingGroups(row);
3212
- if (missingGroups.length > 0) {
3213
- throw new IncompleteGroupsError(row, missingGroups);
3214
- }
3215
- const { index, group } = this.findLastGroupingIndex(row);
3216
- const groupHeaders = [...group.groupHeaders, group];
3217
- const newGroupedRow = Object.assign(Object.assign({}, row), { groupHeaders });
3218
- if (position === 'end') {
3219
- const childrenLength = group.children.length;
3220
- this.groupedData.splice(index + childrenLength + 1, 0, newGroupedRow);
3221
- }
3222
- else {
3223
- this.groupedData.splice(index + 1, 0, newGroupedRow);
3224
- }
3225
- groupHeaders.forEach((groupHeader) => {
3226
- // open all groups, making the new row visible to the user
3227
- groupHeader.groupOpened = true;
3228
- this.addRowToGroupChildren(row, groupHeader, position);
3229
- });
3230
- }
3231
- findMissingGroups(row) {
3232
- return this.groupColumnNames.filter((group) => row[group] === undefined);
3233
- }
3234
- /**
3235
- * Finds the last group (most internal group) where a row should be inserted
3236
- * @param row to be inserted
3237
- * @returns the index and the group where the row should be inserted
3238
- */
3239
- findLastGroupingIndex(row) {
3240
- const index = this.groupedData.findIndex((groupRow) => {
3241
- // ignore rows that are not headers or not the last grouping (most internal groping)
3242
- if (!this.isGroupHeader(groupRow) || !this.isLastGrouping(groupRow))
3243
- return false;
3244
- // if the new added row is not part of the group, ignore it
3245
- if (groupRow.groupValue !== row[groupRow.groupColumnName])
3246
- return false;
3247
- if (this.groupColumns.length === 1)
3248
- return true;
3249
- const matchHeaders = groupRow.groupHeaders.every((groupHeader) => (groupHeader.groupValue === row[groupHeader.groupColumnName]));
3250
- return matchHeaders;
3251
- });
3252
- if (index === -1) {
3253
- // No existing group found, so we create the full group hierarchy
3254
- return this.createGroupHierarchyForRow(row);
3255
- }
3256
- const group = this.groupedData[index];
3257
- return { index, group };
3258
- }
3259
- /**
3260
- * Creates a group hierarchy for a new row, creating intermediate groups if needed
3261
- * @param row to be inserted
3262
- * @returns the index and the group where the row should be inserted
3263
- */
3264
- createGroupHierarchyForRow(row) {
3265
- let groupHeaders = [];
3266
- let insertionIndex = this.groupedData.length; // default to end
3267
- this.groups.forEach((column) => {
3268
- const groupValue = row[column.name];
3269
- const existingGroupIndex = this.groupedData.findIndex((groupRow) => this.isGroupHeader(groupRow)
3270
- && groupRow.groupColumnName === column.name
3271
- && groupRow.groupValue === groupValue
3272
- && groupRow.groupHeaders.every((h, j) => h.groupValue === groupHeaders[j].groupValue));
3273
- if (existingGroupIndex !== -1) {
3274
- const existingGroup = this.groupedData[existingGroupIndex];
3275
- groupHeaders = [...existingGroup.groupHeaders, existingGroup];
3276
- insertionIndex = existingGroupIndex;
3277
- return;
3278
- }
3279
- // Create new group header
3280
- const newGroup = {
3281
- group: true,
3282
- groupHeader: true,
3283
- groupValue,
3284
- groupColumnName: column.name,
3285
- groupHeaders: [...groupHeaders],
3286
- children: [],
3287
- groupRow: row,
3288
- groupIndex: groupHeaders.length,
3289
- groupLabel: I18n.translate(column.label),
3290
- groupOpened: true,
3291
- };
3292
- // Insert right after last insertionIndex
3293
- insertionIndex += 1;
3294
- this.groupedData.splice(insertionIndex, 0, newGroup);
3295
- groupHeaders.push(newGroup);
3296
- });
3297
- const group = groupHeaders[groupHeaders.length - 1]; // the most inner group
3298
- return { index: insertionIndex, group };
3299
- }
3300
- /**
3301
- * Adds a row to the children of a group
3302
- */
3303
- addRowToGroupChildren(row, group, position) {
3304
- if (position === 'end') {
3305
- group.children.push(row);
3306
- return;
3307
- }
3308
- group.children.unshift(row);
3309
- }
3310
- /**
3311
- * Checks if a row is a group header, adding typescript type-checking
3312
- */
3313
- isGroupHeader(row) {
3314
- return row.groupHeader;
3315
- }
3316
- /**
3317
- * Checks if a row is a group footer, adding typescript type-checking
3318
- */
3319
- isGroupFooter(row) {
3320
- return row.groupFooter && !row.groupSummary;
3321
- }
3322
- /**
3323
- * Checks if a row is a summary, adding typescript type-checking
3324
- */
3325
- isGroupSummary(row) {
3326
- return row.groupSummary;
3327
- }
3328
- /**
3329
- * Checks if a row is the last grouping of the grid (the most internal grouping)
3330
- */
3331
- isLastGrouping(group) {
3332
- return group.groupColumnName === this.groupColumns[this.groupColumns.length - 1].name;
3333
- }
3334
- /**
3335
- * change event of editable components
3336
- * - override to call updateSummary on change
3337
- */
3338
- changeEditableComponent(column, row, value, component) {
3339
- super.changeEditableComponent(column, row, value, component);
3340
- this.updateSummary();
3341
- }
3342
- }
3343
-
3344
- class TekGridColumnsButtonController extends IterableColumnsButtonController {
3345
- changeGroupedColumn(column, { component, event, element }) {
3346
- column.grouped = component.value;
3347
- if (!column.grouped) {
3348
- const index = this.iterableComponent.datasource.order.indexOf(`${column.name}.asc`);
3349
- this.iterableComponent.datasource.order.splice(index, 1);
3350
- }
3351
- this.iterableComponent.changeLayout(event, element);
3352
- }
3353
- changeAggregationColumn(column, { component, event, element }) {
3354
- const newValue = component.value || undefined;
3355
- if (column.aggregation !== newValue) {
3356
- this.iterableComponent.changeLayout(event, element);
3357
- }
3358
- column.aggregation = newValue;
3359
- }
3360
- showHideTekColumn(column, { component, event, element }) {
3361
- if (!component.value && column.grouped)
3362
- column.grouped = false;
3363
- column.isVisible = component.value;
3364
- this.iterableComponent.changeLayout(event, element);
3365
- }
3366
- }
3367
-
3368
- /**
3369
- * Base class for TekGrid Columns Button component
3370
- */
3371
- class TekGridColumnsButton extends IterableColumnsButton {
3372
- constructor(props) {
3373
- super(props);
3374
- this.hideGroups = false;
3375
- this.aggregationDataSet = [];
3376
- this.hideGroups = this.getInitValue('hideGroups', props.hideGroups, this.hideGroups);
3377
- this.createAccessors();
3378
- }
3379
- onCreated() {
3380
- super.onCreated();
3381
- this.controller = new TekGridColumnsButtonController(this.iterableComponent);
3382
- Loader.addController(`IterableColumnsButtonController_${this.componentId}`, this.controller);
3383
- }
3384
- getAggregationSelectData() {
3385
- if (!this.aggregationDataSet.length) {
3386
- this.aggregationDataSet = columnAggregationValues.filter(Boolean).map((value) => ({
3387
- text: I18n.translate(`TEKGRID_AGGREGATION_${value}`),
3388
- value,
3389
- }));
3390
- }
3391
- return this.aggregationDataSet;
3392
- }
3393
- }
3394
-
3395
- class TekFilterHelper {
3396
- static getLabel(name) {
3397
- return DateHelper.getLabel(name);
3398
- }
3399
- static getValue(name, column) {
3400
- return DateHelper.getValue(name, column.componentProps.dateFormat);
3401
- }
3402
- static register(name, label, fn) {
3403
- DateHelper.register(name, label, fn);
3404
- }
3405
- static unregister(name) {
3406
- DateHelper.unregister(name);
3407
- }
3408
- }
3409
-
3410
- /**
3411
- * Base class for TekGrid Filter Button component
3412
- */
3413
- class TekGridFilterButton extends Button {
3414
- constructor(props) {
3415
- super(props);
3416
- this.showCheckboxAll = false;
3417
- this.filterFormInputs = {};
3418
- this.gridName = this.getInitValue('gridName', props.gridName, this.gridName);
3419
- this.grid = this.getInitValue('grid', props.grid, undefined);
3420
- this.showCheckboxAll = this.getInitValue('showCheckboxAll', props.showCheckboxAll, this.showCheckboxAll);
3421
- this.createAccessors();
3422
- if (!this.grid)
3423
- this.loadGrid();
3424
- }
3425
- loadGrid(gridName) {
3426
- if (gridName)
3427
- this.gridName = gridName;
3428
- if (!this.gridName)
3429
- return;
3430
- this.grid = Metadata.getInstances(this.gridName)[0];
3431
- }
3432
- click(event) {
3433
- this.callEvent('click', { component: this, event });
3434
- this.grid.callEvent('filterClick', { component: this.grid, event });
3435
- if (!(event === null || event === void 0 ? void 0 : event.defaultPrevented)) {
3436
- this.createFilterFromColumns.call(this);
3437
- }
3438
- }
3439
- loadFilterValues({ component }) {
3440
- const changedCompNames = [];
3441
- const { datasource } = this.grid;
3442
- if (datasource instanceof TekRestDatasource || datasource instanceof TekMemoryDatasource) {
3443
- const { dynamicFilter } = datasource;
3444
- const newDynamicFilter = Object.assign(Object.assign({}, this.grid.defaultFilter), dynamicFilter);
3445
- Object.keys(newDynamicFilter).forEach((column) => {
3446
- if (newDynamicFilter[column] && newDynamicFilter[column].length > 0) {
3447
- newDynamicFilter[column].forEach((filterItem, index) => {
3448
- const relation = filterItem.relation || 'AND';
3449
- const operation = filterItem.operation || 'CONTAINS';
3450
- const compName = `${this.grid.name}-filter-${relation}-${operation}-${column}-${index}`;
3451
- changedCompNames.push(compName);
3452
- component.value[compName] = filterItem.value;
3453
- let helperValue = '';
3454
- const columnObj = this.grid.getColumn(column);
3455
- if (columnObj instanceof TekGridColumn) {
3456
- const { filterProps } = columnObj;
3457
- if (!Array.isArray(filterProps)) {
3458
- helperValue = filterProps.helperValue || '';
3459
- }
3460
- else {
3461
- filterProps.forEach((prop) => {
3462
- if ((prop.relation || 'AND') === relation && (prop.operation || 'CONTAINS') === operation) {
3463
- helperValue = prop.helperValue || '';
3464
- }
3465
- });
3466
- }
3467
- const inputObj = Metadata.getInstances(compName);
3468
- if (helperValue && inputObj.length && inputObj[0]) {
3469
- inputObj[0].hint = TekFilterHelper.getLabel(helperValue);
3470
- }
3471
- }
3472
- });
3473
- }
3474
- });
3475
- }
3476
- else {
3477
- const { filter } = datasource;
3478
- const newFilter = Object.assign(Object.assign({}, this.grid.defaultFilter), filter);
3479
- Object.keys(newFilter).forEach((item) => {
3480
- if (newFilter[item]) {
3481
- const compName = `${this.grid.name}-filter-AND-CONTAINS-${item}-0`;
3482
- changedCompNames.push(compName);
3483
- component.value[compName] = newFilter[item];
3484
- }
3485
- });
3486
- }
3487
- Object.keys(component.value).forEach((compName) => {
3488
- if (changedCompNames.indexOf(compName) === -1) {
3489
- component.value[compName] = null;
3490
- }
3491
- });
3492
- }
3493
- hideFilterModal() {
3494
- this.filterModal.hide();
3495
- }
3496
- destroyFilterModal() {
3497
- if (this.filterModal)
3498
- this.filterModal.destroy();
3499
- }
3500
- createFilterFromColumns() {
3501
- if (!this.filterModal) {
3502
- const originalProps = {
3503
- height: 'auto',
3504
- maxHeight: '18.75rem',
3505
- persistent: true,
3506
- title: 'FILTER',
3507
- };
3508
- const mergeModalFilterProps = Object.assign(originalProps, this.grid.modalFilterProps);
3509
- const filterModalDef = {
3510
- name: `${this.grid.name}-filter-modal`,
3511
- persistent: mergeModalFilterProps.persistent,
3512
- grid: mergeModalFilterProps.grid,
3513
- cssClass: mergeModalFilterProps.cssClass,
3514
- cssStyle: mergeModalFilterProps.cssStyle,
3515
- draggable: mergeModalFilterProps.draggable,
3516
- dragHandle: mergeModalFilterProps.dragHandle,
3517
- fullscreen: mergeModalFilterProps.fullscreen,
3518
- light: mergeModalFilterProps.light,
3519
- dark: mergeModalFilterProps.dark,
3520
- escKeydownStop: false,
3521
- children: [
3522
- {
3523
- name: `${this.grid.name}-filter-header-container`,
3524
- component: 'ZdContainer',
3525
- cssClass: 'zd-pa-0 zd-display-flex',
3526
- children: [
3527
- {
3528
- name: `${this.grid.name}-filter-title`,
3529
- component: 'ZdText',
3530
- cssStyle: `color: ${'var(--v-primary-base);'}`,
3531
- text: mergeModalFilterProps.title,
3532
- tag: 'h3',
3533
- },
3534
- {
3535
- name: `${this.grid.name}-filter-spacer`,
3536
- component: 'VSpacer',
3537
- },
3538
- {
3539
- name: `${this.grid.name}-filter-close-button`,
3540
- component: 'ZdModalCloseButton',
3541
- small: true,
3542
- modalName: `${this.grid.name}-filter-modal`,
3543
- },
3544
- ],
3545
- },
3546
- {
3547
- name: `${this.grid.name}-filter-content-container`,
3548
- component: 'ZdContainer',
3549
- scrollView: true,
3550
- cssClass: 'zd-my-2 zd-pa-0 tek-grid-filter-content-container',
3551
- maxHeight: mergeModalFilterProps.maxHeight,
3552
- height: mergeModalFilterProps.height,
3553
- children: [
3554
- {
3555
- name: `${this.grid.name}-filter-form`,
3556
- component: 'ZdForm',
3557
- cssClass: 'zd-my-2 zd-pa-0',
3558
- children: this.getFilterModalComponents(),
3559
- events: {
3560
- onMounted: this.loadFilterValues.bind(this),
3561
- },
3562
- },
3563
- ],
3564
- },
3565
- {
3566
- name: `${this.grid.name}-filter-footer-container`,
3567
- component: 'ZdContainer',
3568
- cssClass: 'zd-pa-0',
3569
- children: [
3570
- {
3571
- name: `${this.grid.name}-filter-footer`,
3572
- component: 'ZdFooter',
3573
- color: 'transparent',
3574
- padless: true,
3575
- leftSlot: [
3576
- {
3577
- name: `${this.grid.name}-filter-clearButton`,
3578
- component: 'ZdButton',
3579
- label: 'CLEAR',
3580
- outline: true,
3581
- events: {
3582
- click: this.clearFilter.bind(this),
3583
- },
3584
- },
3585
- ],
3586
- rightSlot: [
3587
- {
3588
- name: `${this.grid.name}-filter-cancelButton`,
3589
- component: 'ZdButton',
3590
- label: 'CANCEL',
3591
- keyMap: {
3592
- esc: {
3593
- event: this.hideFilterModal.bind(this),
3594
- focus: true,
3595
- visible: true,
3596
- input: true,
3597
- stop: true,
3598
- },
3599
- },
3600
- outline: true,
3601
- events: {
3602
- click: this.hideFilterModal.bind(this),
3603
- },
3604
- },
3605
- {
3606
- name: `${this.grid.name}-filter-okButton`,
3607
- component: 'ZdButton',
3608
- label: 'OK',
3609
- events: {
3610
- click: this.applyFilter.bind(this),
3611
- },
3612
- keyMap: {
3613
- 'mod+enter': {
3614
- event: this.applyFilter.bind(this),
3615
- focus: true,
3616
- input: true,
3617
- stop: true,
3618
- visible: true,
3619
- },
3620
- },
3621
- },
3622
- ],
3623
- },
3624
- ],
3625
- },
3626
- ],
3627
- };
3628
- this.filterModal = ModalService.create(filterModalDef);
3629
- }
3630
- else {
3631
- this.loadFilterValues({ component: Metadata.getInstance(`${this.grid.name}-filter-form`) });
3632
- }
3633
- this.filterModal.show();
3634
- }
3635
- onBeforeDestroy() {
3636
- super.onBeforeDestroy();
3637
- this.destroyFilterModal();
3638
- }
3639
- formatFormValue(filterForm) {
3640
- return Object.keys(filterForm.value).reduce((result, item) => {
3641
- try {
3642
- const itemInstance = filterForm.getChildInstance(item);
3643
- if (!(itemInstance instanceof SelectMultiple) || !itemInstance.checkboxAll)
3644
- return result;
3645
- // when selectmultiple with checkboxAll, should either remove it from the filter or
3646
- // change the value to T, depending on selectAllCompatibilityMode
3647
- if (Config.selectAllCompatibilityMode) {
3648
- result[item] = 'T';
3649
- return result;
3650
- }
3651
- delete result[item];
3652
- return result;
3653
- }
3654
- catch (e) {
3655
- return result;
3656
- }
3657
- }, Object.assign({}, filterForm.value));
3658
- }
3659
- applyFilter({ event }) {
3660
- const filterForm = Metadata.getInstance(`${this.grid.name}-filter-form`);
3661
- if (filterForm.validate()) {
3662
- const { datasource } = this.grid;
3663
- const filter = {};
3664
- const formValue = this.formatFormValue(filterForm);
3665
- if (datasource instanceof TekRestDatasource || datasource instanceof TekMemoryDatasource) {
3666
- Object.keys(formValue).forEach((item) => {
3667
- const itemValue = formValue[item];
3668
- if (itemValue && !(Array.isArray(itemValue) && !itemValue.length)) {
3669
- const relationAndOperationAndName = item.split(`${this.grid.name}-filter-`)[1];
3670
- const [relation, operation] = relationAndOperationAndName.split('-');
3671
- let columnName = relationAndOperationAndName.split(`${relation}-${operation}-`)[1];
3672
- columnName = columnName.split('-').slice(0, -1).join('-'); // remove index
3673
- if (!filter[columnName]) {
3674
- filter[columnName] = [];
3675
- }
3676
- const value = itemValue;
3677
- filter[columnName].push({
3678
- relation,
3679
- operation,
3680
- value,
3681
- });
3682
- }
3683
- });
3684
- datasource.dynamicFilter = filter;
3685
- this.setFilter(filter, event, datasource.setBaseFilter.bind(datasource));
3686
- }
3687
- else {
3688
- Object.keys(formValue).forEach((item) => {
3689
- let columnName = item.split(`${this.grid.name}-filter-AND-CONTAINS-`)[1];
3690
- columnName = columnName.split('-').slice(0, -1).join('-'); // remove index
3691
- if (formValue[item]) {
3692
- filter[columnName] = formValue[item];
3693
- }
3694
- });
3695
- datasource.filter = filter;
3696
- this.setFilter(filter, event, datasource.setBaseFilter.bind(datasource));
3697
- }
3698
- this.grid.changeLayout(event);
3699
- }
3700
- }
3701
- setFilter(filter, event, filterFn) {
3702
- this.grid.callEvent('beforeApplyFilter', { component: this.grid, event });
3703
- if (event.defaultPrevented)
3704
- return;
3705
- filterFn(filter);
3706
- this.hideFilterModal();
3707
- }
3708
- clearFilter() {
3709
- const filterForm = Metadata.getInstance(`${this.grid.name}-filter-form`);
3710
- Object.keys(filterForm.value).forEach((item) => {
3711
- filterForm.value[item] = null;
3712
- });
3713
- }
3714
- sortFilterIndex(col1, col2) {
3715
- const index1 = col1.filterIndex !== undefined ? col1.filterIndex : Number.MAX_SAFE_INTEGER;
3716
- const index2 = col2.filterIndex !== undefined ? col2.filterIndex : Number.MAX_SAFE_INTEGER;
3717
- return index1 - index2;
3718
- }
3719
- getFilterInputs(columnName) {
3720
- const mapper = (name) => Metadata.getInstance(name);
3721
- if (columnName) {
3722
- return this.filterFormInputs[columnName].map(mapper);
3723
- }
3724
- const values = Object.values(this.filterFormInputs);
3725
- return values.reduce((result, current) => ([...result, ...current.map(mapper)]), []);
3726
- }
3727
- getFilterModalComponents() {
3728
- const filterColumns = [];
3729
- let columnComponentName;
3730
- [...this.grid.columns].sort(this.sortFilterIndex).forEach((column) => {
3731
- const filterProps = Array.isArray(column.filterProps) ? column.filterProps : [column.filterProps];
3732
- if (column.filterable && filterProps && filterProps.length > 0) {
3733
- this.filterFormInputs[column.name] = [];
3734
- filterProps.forEach((filterItem, index) => {
3735
- var _a;
3736
- const { datasource } = this.grid;
3737
- if (datasource instanceof TekRestDatasource || datasource instanceof TekMemoryDatasource) {
3738
- const relation = filterItem.relation || 'AND';
3739
- const operation = filterItem.operation || 'CONTAINS';
3740
- columnComponentName = `${this.grid.name}-filter-${relation}-${operation}-${column.name}-${index}`;
3741
- }
3742
- else {
3743
- columnComponentName = `${this.grid.name}-filter-AND-CONTAINS-${column.name}-${index}`;
3744
- }
3745
- this.filterFormInputs[column.name].push(columnComponentName);
3746
- const newColumnComponent = Object.assign(Object.assign(Object.assign({ label: column.label }, column.componentProps), filterItem), { name: columnComponentName });
3747
- if (filterItem.helperOptions) {
3748
- if (!newColumnComponent.events)
3749
- newColumnComponent.events = {};
3750
- newColumnComponent.events.change = this.changeHelperEvent.bind(this, column);
3751
- }
3752
- if (newColumnComponent.component === 'ZdSelectMultiple') {
3753
- newColumnComponent.showCheckboxAll = (_a = newColumnComponent.showCheckboxAll) !== null && _a !== void 0 ? _a : this.showCheckboxAll;
3754
- }
3755
- filterColumns.push(newColumnComponent);
3756
- });
3757
- }
3758
- });
3759
- return filterColumns;
3760
- }
3761
- changeHelperEvent(column, { component }) {
3762
- const { helperValue } = component;
3763
- const componentName = component.name;
3764
- if (!Array.isArray(column.filterProps)) {
3765
- column.filterProps.helperValue = helperValue;
3766
- }
3767
- else {
3768
- column.filterProps.forEach((prop) => {
3769
- const relationAndOperationAndName = componentName.split(`${this.grid.name}-filter-`)[1];
3770
- const [relation, operation] = relationAndOperationAndName.split('-');
3771
- if ((prop.relation || 'AND') === relation && (prop.operation || 'CONTAINS') === operation) {
3772
- prop.helperValue = helperValue;
3773
- }
3774
- });
3775
- }
3776
- }
3777
- }
3778
-
3779
- class TekGridLayoutOptions extends ComponentRender {
3780
- constructor() {
3781
- super(...arguments);
3782
- this.currentLayoutName = '';
3783
- this.layoutEdited = false;
3784
- this.layouts = {};
3785
- this.layoutNames = [];
3786
- this.originalColumnProps = [];
3787
- this.originalDatasourceOrder = [];
3788
- this.originalDatasourceDynamicFilter = {};
3789
- this.originalDatasourceFilter = {};
3790
- }
3791
- getParentGrid() {
3792
- let { parent } = this;
3793
- while (parent
3794
- && !(parent.constructor === Grid
3795
- || parent.constructor.prototype instanceof Grid)) {
3796
- parent = parent.parent;
3797
- }
3798
- return parent;
3799
- }
3800
- onMounted(element) {
3801
- const _super = Object.create(null, {
3802
- onMounted: { get: () => super.onMounted }
3803
- });
3804
- return __awaiter(this, void 0, void 0, function* () {
3805
- _super.onMounted.call(this, element);
3806
- this.grid = this.getParentGrid();
3807
- this.originalDatasourceOrder = [...this.grid.datasource.order];
3808
- this.originalDatasourceDynamicFilter = Object.assign({}, this.grid.datasource.dynamicFilter);
3809
- this.originalDatasourceFilter = Object.assign({}, this.grid.datasource.filter);
3810
- this.originalColumnProps = this.grid.columns.map((column) => ({
3811
- name: column.name,
3812
- label: column.label,
3813
- align: column.align,
3814
- isVisible: column.isVisible,
3815
- minWidth: column.minWidth,
3816
- maxWidth: column.maxWidth,
3817
- width: column.width,
3818
- fixed: column.fixed,
3819
- grouped: column.grouped,
3820
- groupOpened: column.groupOpened,
3821
- aggregation: column.aggregation,
3822
- filterHelperValue: this.getHelperValue(column),
3823
- }));
3824
- let layoutsInfo = {};
3825
- const promise = this.loadLayoutsInfo();
3826
- if (this.grid instanceof TekGrid) {
3827
- this.grid.registerTask(promise);
3828
- }
3829
- layoutsInfo = yield promise;
3830
- if (layoutsInfo.layouts) {
3831
- this.layouts = layoutsInfo.layouts;
3832
- this.layoutNames = Object.keys(this.layouts);
3833
- if (layoutsInfo.currentLayoutName) {
3834
- this.currentLayoutName = layoutsInfo.currentLayoutName;
3835
- this.applyLayout(this.currentLayoutName, false);
3836
- }
3837
- }
3838
- });
3839
- }
3840
- loadLayoutsInfo() {
3841
- return __awaiter(this, void 0, void 0, function* () {
3842
- const eventFunction = this.events.loadLayouts || this.grid.events.loadLayouts;
3843
- if (eventFunction && typeof eventFunction === 'function') {
3844
- return eventFunction({ component: this.grid });
3845
- }
3846
- if (Config.loadGridLayoutsEndPoint) {
3847
- const route = Config.loadGridLayoutsEndPoint;
3848
- const response = yield Http.get(`${route}?id=${this.grid.name}`);
3849
- const responseData = response.data.data;
3850
- return responseData.length && responseData[0]
3851
- ? responseData[0].layouts
3852
- : responseData.layouts || {};
3853
- }
3854
- return JSON.parse(localStorage.getItem(this.grid.name) || '{}');
3855
- });
3856
- }
3857
- getHelperValue(column) {
3858
- if (column instanceof TekGridColumn) {
3859
- if (!Array.isArray(column.filterProps))
3860
- return column.filterProps.helperValue;
3861
- return column.filterProps.map((prop) => prop.helperValue);
3862
- }
3863
- return '';
3864
- }
3865
- newLayout(layout) {
3866
- this.fixColumns(layout);
3867
- this.currentLayoutName = layout.name;
3868
- this.addLayout(layout);
3869
- this.layoutEdited = false;
3870
- }
3871
- addLayout(layout) {
3872
- this.fixColumns(layout);
3873
- this.layouts[layout.name] = layout;
3874
- this.saveLayouts();
3875
- }
3876
- discardChanges() {
3877
- const layoutSelected = this.layouts[this.currentLayoutName];
3878
- if (this.viewApplyLayout) {
3879
- this.viewApplyLayout(layoutSelected);
3880
- }
3881
- this.layoutEdited = false;
3882
- }
3883
- applyLayout(name, save = true) {
3884
- this.currentLayoutName = name;
3885
- const layoutSelected = this.layouts[name];
3886
- if (this.viewApplyLayout) {
3887
- this.viewApplyLayout(layoutSelected);
3888
- }
3889
- if (save) {
3890
- this.saveLayouts();
3891
- }
3892
- this.layoutEdited = false;
3893
- }
3894
- saveLayouts() {
3895
- this.layoutNames = Object.keys(this.layouts);
3896
- const layoutInfo = {
3897
- currentLayoutName: this.currentLayoutName,
3898
- layouts: this.layouts,
3899
- };
3900
- const eventFunction = this.events.saveLayouts || this.grid.events.saveLayouts;
3901
- if (eventFunction && typeof eventFunction === 'function') {
3902
- eventFunction({ component: this.grid, layouts: layoutInfo });
3903
- }
3904
- else if (Config.saveGridLayoutsEndPoint) {
3905
- const route = Config.saveGridLayoutsEndPoint;
3906
- Http.post(route, { id: this.grid.name, layouts: layoutInfo });
3907
- }
3908
- else {
3909
- localStorage.setItem(this.grid.name, JSON.stringify(layoutInfo));
3910
- }
3911
- }
3912
- deleteLayout(name) {
3913
- if (this.currentLayoutName === name) {
3914
- this.currentLayoutName = '';
3915
- this.applyLayout(this.currentLayoutName, false);
3916
- }
3917
- delete this.layouts[name];
3918
- this.saveLayouts();
3919
- }
3920
- updateLayout(name, layout) {
3921
- this.fixColumns(layout);
3922
- this.currentLayoutName = name;
3923
- layout.name = name;
3924
- this.layouts[layout.name] = layout;
3925
- this.saveLayouts();
3926
- this.layoutEdited = false;
3927
- }
3928
- updateDefaultLayout(layout) {
3929
- this.fixColumns(layout);
3930
- this.originalDatasourceOrder = layout.order || this.originalDatasourceOrder;
3931
- this.originalDatasourceDynamicFilter = layout.dynamicFilter || this.originalDatasourceDynamicFilter;
3932
- this.originalDatasourceFilter = layout.filter || this.originalDatasourceFilter;
3933
- if (layout.columns) {
3934
- this.originalColumnProps = layout.columns.map((column) => {
3935
- const originalColumnIdx = this.originalColumnProps.findIndex((item) => item.name === column.name);
3936
- const originalColumn = originalColumnIdx !== -1
3937
- ? this.originalColumnProps[originalColumnIdx]
3938
- : {};
3939
- return Object.assign(Object.assign({}, originalColumn), column);
3940
- });
3941
- }
3942
- if (this.currentLayoutName === '') {
3943
- this.applyLayout(this.currentLayoutName, false);
3944
- }
3945
- }
3946
- fixColumns(layout) {
3947
- const hasLayoutColumns = !!layout.columns;
3948
- layout.columns = layout.columns || [];
3949
- const layoutColumnNames = layout.columns.map((layoutColumn) => layoutColumn.name);
3950
- this.grid.columns.forEach((gridColumn) => {
3951
- if (!hasLayoutColumns
3952
- || layoutColumnNames.indexOf(gridColumn.name) === -1) {
3953
- layout.columns.push({
3954
- name: gridColumn.name,
3955
- label: gridColumn.label,
3956
- align: gridColumn.align,
3957
- isVisible: !hasLayoutColumns && gridColumn.isVisible,
3958
- width: gridColumn.width,
3959
- minWidth: gridColumn.minWidth,
3960
- maxWidth: gridColumn.maxWidth,
3961
- fixed: gridColumn.fixed,
3962
- grouped: gridColumn.grouped,
3963
- groupOpened: gridColumn.groupOpened,
3964
- aggregation: gridColumn.aggregation,
3965
- filterHelperValue: this.getHelperValue(gridColumn),
3966
- });
3967
- }
3968
- });
3969
- }
3970
- }
3971
-
3972
- /* TekTreeGrid Class */
3973
- class TekTreeGrid extends TreeGridEditable {
3974
- /**
3975
- * TekTreeGrid class constructor
3976
- * @param props TekTreeGrid properties
3977
- */
3978
- constructor(props) {
3979
- super(props);
3980
- /* Grid Title */
3981
- this.title = '';
3982
- /* Show Add button */
3983
- this.addButton = false;
3984
- /**
3985
- * Components that will be rendered on toolbar slot
3986
- */
3987
- this.toolbarConfig = [];
3988
- /* Show edit buttons */
3989
- this.showEditButtons = true;
3990
- /* Show Delete button */
3991
- this.deleteButton = 'none';
3992
- /* Show Delete button */
3993
- this.actions = [];
3994
- /* Show Filter button */
3995
- this.filterButton = false;
3996
- /* Define modal filter props */
3997
- this.modalFilterProps = {
3998
- name: this.name,
3999
- height: 'auto',
4000
- persistent: true,
4001
- cssClass: '',
4002
- cssStyle: '',
4003
- dark: false,
4004
- draggable: false,
4005
- fullscreen: false,
4006
- dragHandle: '',
4007
- title: 'FILTER',
4008
- };
4009
- /* Show search Input */
4010
- this.showSearch = true;
4011
- /* Show Hide button */
4012
- this.showHideButton = true;
4013
- /* Show Column Filter button */
4014
- this.columnFilterButton = false;
4015
- /* Show Columns button */
4016
- this.columnsButton = false;
4017
- /* Columns to be ignored on columns button */
4018
- this.columnsButtonIgnore = [];
4019
- /**
4020
- * Enables column dragging
4021
- * @public
4022
- */
4023
- this.dragColumns = true;
4024
- /**
4025
- * Defines if the grid is the unique grid on screen
4026
- */
4027
- this.mainGrid = true;
4028
- /**
4029
- * Enables column resizing
4030
- * @public
4031
- */
4032
- this.resizeColumns = true;
4033
- /**
4034
- * Enables layout saving
4035
- * @public
4036
- */
4037
- this.showLayoutOptions = true;
4038
- /**
4039
- * Show export button
4040
- */
4041
- this.showExport = false;
4042
- /**
4043
- * Show refresh button
4044
- */
4045
- this.showReload = true;
4046
- this.toolbarOpened = true;
4047
- /**
4048
- * Export config
4049
- */
4050
- this.exportConfig = [
4051
- {
4052
- type: 'pdf',
4053
- label: I18n.translate('TEKGRID_EXPORT_AS', { type: 'PDF' }),
4054
- multiOption: [
4055
- { label: I18n.translate('TEKGRID_PORTRAIT'), iconName: 'mdi-file-outline' },
4056
- {
4057
- label: I18n.translate('TEKGRID_LANDSCAPE'),
4058
- iconName: 'mdi-file-outline',
4059
- cssClass: 'tek-grid-export-landscape',
4060
- reportParams: { portrait: false },
4061
- },
4062
- ],
4063
- },
4064
- {
4065
- type: 'xls',
4066
- label: I18n.translate('TEKGRID_EXPORT_AS', {
4067
- type: 'XLS',
4068
- }),
4069
- },
4070
- {
4071
- type: 'xls2',
4072
- label: I18n.translate('TEKGRID_EXPORT_AS', {
4073
- type: `XLS ${I18n.translate('TEKGRID_WITH_GROUPS')}`,
4074
- }),
4075
- },
4076
- {
4077
- type: 'xls3',
4078
- label: I18n.translate('TEKGRID_EXPORT_AS', {
4079
- type: `XLS ${I18n.translate('TEKGRID_GRID_MIRROR')}`,
4080
- }),
4081
- },
4082
- {
4083
- type: 'csv',
4084
- label: I18n.translate('TEKGRID_EXPORT_AS', { type: 'CSV' }),
4085
- },
4086
- ];
4087
- this.toolbarSlotProps = false;
4088
- this.showCheckboxAllFilter = false;
4089
- this.defaultFilter = {};
4090
- this.reportTitle = '';
4091
- this.title = this.getInitValue('title', props.title, this.title);
4092
- this.addButton = this.getInitValue('addButton', props.addButton, this.addButton);
4093
- this.deleteButton = this.getInitValue('deleteButton', props.deleteButton, this.deleteButton);
4094
- this.showEditButtons = this.getInitValue('showEditButtons', props.showEditButtons, this.showEditButtons);
4095
- this.filterButton = this.getInitValue('filterButton', props.filterButton, this.filterButton);
4096
- this.showSearch = this.getInitValue('showSearch', props.showSearch, this.showSearch);
4097
- this.showHideButton = this.getInitValue('showHideButton', props.showHideButton, this.showHideButton);
4098
- this.columnFilterButton = this.getInitValue('columnFilterButton', props.columnFilterButton, this.columnFilterButton);
4099
- this.columnsButton = this.getInitValue('columnsButton', props.columnsButton, this.columnsButton);
4100
- this.columnsButtonIgnore = this.getInitValue('columnsButtonIgnore', props.columnsButtonIgnore, this.columnsButtonIgnore);
4101
- this.dragColumns = this.getInitValue('dragColumns', props.dragColumns, this.dragColumns);
4102
- this.resizeColumns = this.getInitValue('resizeColumns', props.resizeColumns, this.resizeColumns);
4103
- this.showLayoutOptions = this.getInitValue('showLayoutOptions', props.showLayoutOptions, this.showLayoutOptions);
4104
- this.showExport = this.getInitValue('showExport', props.showExport, this.showExport);
4105
- this.showReload = this.getInitValue('showReload', props.showReload, this.showReload);
4106
- this.exportConfig = this.getInitValue('exportConfig', props.exportConfig, this.exportConfig);
4107
- this.modalFilterProps = this.getInitValue('modalFilterProps', props.modalFilterProps, this.modalFilterProps);
4108
- this.showCheckboxAllFilter = this.getInitValue('showCheckboxAllFilter', props.showCheckboxAllFilter, this.showCheckboxAllFilter);
4109
- this.defaultFilter = this.getInitValue('defaultFilter', props.defaultFilter, this.defaultFilter);
4110
- this.toolbarConfig = this.getInitValue('toolbarConfig', props.toolbarConfig, this.toolbarConfig);
4111
- this.toolbarOpened = this.getInitValue('toolbarOpened', props.toolbarOpened, this.toolbarOpened);
4112
- this.exportActions = props.exportActions || this.exportActions;
4113
- this.reportTitle = this.getInitValue('reportTitle', props.reportTitle, this.reportTitle);
4114
- this.actions = props.actions || this.actions;
4115
- this.toolbarSlotProps = props.toolbarSlot !== undefined;
4116
- if (this.deleteButton === 'selection') {
4117
- this.selectable = true;
4118
- }
4119
- this.keyShortcutKeyMapping = {
4120
- 'mod+f': {
4121
- event: this.focusSearchInput.bind(this),
4122
- stop: true,
4123
- active: !this.mainGrid,
4124
- input: true,
4125
- },
4126
- 'mod+l': {
4127
- event: ({ event, element }) => {
4128
- if (this.filterButton) {
4129
- const instance = Metadata.getInstance(`${this.name}_filterButton`);
4130
- instance.click(event, element);
4131
- }
4132
- },
4133
- stop: true,
4134
- active: !this.mainGrid,
4135
- input: true,
4136
- },
4137
- 'mod+enter': {
4138
- event: () => {
4139
- const instance = Metadata.getInstance(`${this.name}_actions_dropdown`);
4140
- instance.setFocus();
4141
- instance.value = !instance.value;
4142
- },
4143
- stop: true,
4144
- active: !this.mainGrid,
4145
- input: true,
4146
- },
4147
- };
4148
- this.gridBase = new GridBase(this);
4149
- this.filterOperationsDatasource = this.gridBase.getFilterOperationsDatasource();
4150
- this.filterRelationsDatasource = this.gridBase.getFilterRelationsDatasource();
4151
- this.createAccessors();
4152
- }
4153
- onMounted(element) {
4154
- super.onMounted(element);
4155
- KeyMap.bind(this.keyShortcutKeyMapping, this, element);
4156
- }
4157
- onBeforeDestroy() {
4158
- super.onBeforeDestroy();
4159
- KeyMap.unbind(this.keyShortcutKeyMapping, this);
4160
- }
4161
- onCreated() {
4162
- super.onCreated();
4163
- Loader.addController(`GridController_${this.componentId}`, new GridController(this));
4164
- if (!this.toolbarSlotProps)
4165
- this.toolbarSlot = this.gridBase.createToolbarProps();
4166
- }
4167
- focusSearchInput() {
4168
- const searchInput = Metadata.getInstance(`${this.name}_gridSearch`);
4169
- searchInput.setFocus();
4170
- }
4171
- get layoutOptions() {
4172
- if (!this.showLayoutOptions)
4173
- return undefined;
4174
- return Metadata.getInstance(`${this.name}_layout_options`);
4175
- }
4176
- /**
4177
- * Get Grid columns objects
4178
- * @param columns Grid columns parameter
4179
- */
4180
- getColumns(columns) {
4181
- return columns.map((column) => new TekGridColumn(column, this));
4182
- }
4183
- columnHasFilterData(column) {
4184
- if (this.datasource instanceof TekRestDatasource
4185
- || this.datasource instanceof TekMemoryDatasource) {
4186
- const dynamicFilter = this.datasource.dynamicFilter[column.name];
4187
- return dynamicFilter && dynamicFilter.length > 0;
4188
- }
4189
- return this.datasource.filter[column.name];
4190
- }
4191
- getReport(type, portrait, rowObj = {}) {
4192
- return __awaiter(this, void 0, void 0, function* () {
4193
- const report = new Report(this, this.title || this.reportTitle);
4194
- const reportGroups = {};
4195
- const reportAggregations = {};
4196
- let filter;
4197
- if (this.datasource instanceof TekRestDatasource
4198
- || this.datasource instanceof TekMemoryDatasource) {
4199
- const reportFilter = new ReportFilter(this.datasource.dynamicFilter);
4200
- filter = reportFilter.build();
4201
- }
4202
- let beforeOpen;
4203
- if (typeof this.events.beforeOpenReport === 'function') {
4204
- beforeOpen = this.events.beforeOpenReport;
4205
- }
4206
- return report
4207
- .getReport(type, portrait, {
4208
- metaData: merge(rowObj, {
4209
- filter,
4210
- groups: reportGroups,
4211
- columns: reportAggregations,
4212
- }),
4213
- }, beforeOpen)
4214
- .then((reportUrl) => window.open(reportUrl));
4215
- });
4216
- }
4217
- setSearch(search) {
4218
- return __awaiter(this, void 0, void 0, function* () {
4219
- return this.gridBase.setSearch(search);
4220
- });
4221
- }
4222
- /**
4223
- * Dispatches row click event
4224
- * @param row Grid row
4225
- * @param event DOM event
4226
- * @param element DOM Element
4227
- */
4228
- rowClick(row, event, element) {
4229
- if (!this.preventRowClick) {
4230
- this.datasource.currentRow = row;
4231
- this.callEvent('rowClick', {
4232
- event,
4233
- element,
4234
- row,
4235
- component: this,
4236
- column: undefined,
4237
- });
4238
- }
4239
- this.preventRowClick = false;
4240
- }
4241
- getAtomInstance(key) {
4242
- return this.gridBase.getAtomInstance(key);
4243
- }
4244
- getFilterInputs(columnName) {
4245
- return this.gridBase.getFilterInputs(columnName);
4246
- }
4247
- getColumn(name) {
4248
- return super.getColumn(name);
4249
- }
4250
- }
4251
-
4252
- let TekUserInfoController = class TekUserInfoController {
4253
- constructor(component) {
4254
- this.component = component;
4255
- }
4256
- get versionInfo() {
4257
- return this.component.versionInfo;
4258
- }
4259
- get name() {
4260
- var _a;
4261
- return ((_a = this.versionInfo) === null || _a === void 0 ? void 0 : _a.name) || '';
4262
- }
4263
- set name(value) {
4264
- if (!this.versionInfo)
4265
- return;
4266
- this.versionInfo.name = value;
4267
- }
4268
- get version() {
4269
- var _a;
4270
- return ((_a = this.versionInfo) === null || _a === void 0 ? void 0 : _a.version) || '';
4271
- }
4272
- set version(value) {
4273
- if (!this.versionInfo)
4274
- return;
4275
- this.versionInfo.version = value;
4276
- }
4277
- get hasDefaultEmail() {
4278
- return !!this.component.defaultEmail;
4279
- }
4280
- get hasAboutImage() {
4281
- return !!this.component.aboutImage;
4282
- }
4283
- mergeText(name, version) {
4284
- return `<li>${name} - <b>${version}</b></li>`;
4285
- }
4286
- get mainVersion() {
4287
- var _a;
4288
- if (!((_a = this.versionInfo) === null || _a === void 0 ? void 0 : _a.name) || !this.versionInfo.version)
4289
- return '';
4290
- return `${this.versionInfo.name} - <b>${this.versionInfo.version}</b>`;
4291
- }
4292
- getItems(tab) {
4293
- if (!this.versionInfo)
4294
- return [];
4295
- const tabInfo = this.versionInfo[tab];
4296
- return `<ul>${tabInfo.map((item) => this.mergeText(item.name, item.version)).join('')}</ul>`;
4297
- }
4298
- get frontendItems() {
4299
- return this.getItems('frontend');
4300
- }
4301
- get backendItems() {
4302
- return this.getItems('backend');
4303
- }
4304
- get modulesItems() {
4305
- return this.getItems('modules');
4306
- }
4307
- get showReportError() {
4308
- const { reportError } = this.component.visibleItems;
4309
- return reportError || reportError === undefined;
4310
- }
4311
- get showVersionInfo() {
4312
- const { versionInfo } = this.component.visibleItems;
4313
- return versionInfo || versionInfo === undefined;
4314
- }
4315
- get showAbout() {
4316
- const { about } = this.component.visibleItems;
4317
- return about || about === undefined;
4318
- }
4319
- };
4320
- TekUserInfoController = __decorate([
4321
- Singleton
4322
- ], TekUserInfoController);
4323
-
4324
- class TekUserInfo extends UserInfo {
4325
- constructor(props) {
4326
- super(props);
4327
- /**
4328
- * Data about the application version
4329
- */
4330
- this.versionInfo = null;
4331
- /**
4332
- * Default email address to be defined in the Report Bug form
4333
- */
4334
- this.defaultEmail = '';
4335
- /**
4336
- * Url from which the version info will be retrieved
4337
- */
4338
- this.versionUrl = '';
4339
- /**
4340
- * Path to the image to be shown on about modal
4341
- */
4342
- this.aboutImage = '';
4343
- this.versionInfo = this.getInitValue('versionInfo', props.versionInfo, this.versionInfo);
4344
- this.defaultEmail = this.getInitValue('defaultEmail', props.defaultEmail, this.defaultEmail);
4345
- this.versionUrl = this.getInitValue('versionUrl', props.versionUrl, this.versionUrl);
4346
- this.aboutImage = this.getInitValue('aboutImage', props.aboutImage, this.aboutImage);
4347
- this.createAccessors();
4348
- this.propBottomSlot = props.bottomSlot;
4349
- }
4350
- getBottomSlot() {
4351
- return [
4352
- {
4353
- name: `${this.name}_bottom_list`,
4354
- component: 'TekUserInfoList',
4355
- parentName: this.name,
4356
- },
4357
- ];
4358
- }
4359
- onAboutClick() {
4360
- if (!this.aboutModal) {
4361
- this.aboutModal = ModalService.create({
4362
- name: `${this.name}_about_modal`,
4363
- cssClass: 'about-modal',
4364
- grid: { cols: 8, sm: 4, lg: 5 },
4365
- height: '60%',
4366
- children: [
4367
- {
4368
- name: `${this.name}_about_header`,
4369
- component: 'ZdHeader',
4370
- color: 'transparent',
4371
- padless: true,
4372
- elevation: 0,
4373
- rightSlot: [
4374
- {
4375
- name: `${this.name}_about_close_button`,
4376
- component: 'ZdModalCloseButton',
4377
- small: true,
4378
- modalName: `${this.name}_about_modal`,
4379
- },
4380
- ],
4381
- leftSlot: [
4382
- {
4383
- name: `${this.name}_about_row`,
4384
- component: 'ZdTag',
4385
- tag: 'div',
4386
- cssStyle: 'width: 100%',
4387
- cssClass: 'zd-justify-center zd-px-6',
4388
- isVisible: `{{TekUserInfoController_${this.componentId}.hasAboutImage}}`,
4389
- children: [
4390
- {
4391
- name: `${this.name}_about_image`,
4392
- cssClass: 'zd-tekUserInfo-about-image',
4393
- component: 'ZdImage',
4394
- width: '100%',
4395
- src: this.aboutImage,
4396
- },
4397
- ],
4398
- },
4399
- ],
4400
- },
4401
- {
4402
- name: `${this.name}_version_tabs`,
4403
- cssClass: 'zd-pt-3 zd-tekUserInfo-tab',
4404
- component: 'ZdTabs',
4405
- tabs: [
4406
- {
4407
- name: `${this.name}_version_frontend_tab`,
4408
- tabTitle: 'Frontend',
4409
- children: this.getVersionTree('frontend'),
4410
- },
4411
- {
4412
- name: `${this.name}_version_backend_tab`,
4413
- tabTitle: 'Backend',
4414
- children: this.getVersionTree('backend'),
4415
- },
4416
- {
4417
- name: `${this.name}_version_modules_tab`,
4418
- tabTitle: 'Modules',
4419
- children: this.getVersionTree('modules'),
4420
- },
4421
- ],
4422
- },
4423
- ],
4424
- });
4425
- }
4426
- this.aboutModal.show();
4427
- }
4428
- getVersionTree(tab) {
4429
- if (!this.versionInfo)
4430
- return [];
4431
- const main = {
4432
- name: `${this.name}_version_${tab}_main`,
4433
- component: 'ZdText',
4434
- text: `{{TekUserInfoController_${this.componentId}.mainVersion}}`,
4435
- };
4436
- const itemsComponent = {
4437
- name: `${this.name}_version_${tab}`,
4438
- component: 'ZdText',
4439
- cssClass: 'zd-pl-4',
4440
- text: `{{TekUserInfoController_${this.componentId}.${tab}Items}}`,
4441
- };
4442
- return [main, itemsComponent];
4443
- }
4444
- onReportClick() {
4445
- if (!this.reportModal) {
4446
- this.reportModal = ModalService.create({
4447
- name: `${this.name}_report_modal`,
4448
- children: [
4449
- {
4450
- name: `${this.name}_report_header`,
4451
- component: 'ZdHeader',
4452
- color: 'transparent',
4453
- padless: true,
4454
- elevation: 0,
4455
- leftSlot: [
4456
- {
4457
- name: `${this.name}_report_title`,
4458
- component: 'ZdText',
4459
- text: 'TEKUSERINFO_REPORT_ERROR',
4460
- cssClass: 'zd-theme-font-title',
4461
- },
4462
- ],
4463
- rightSlot: [
4464
- {
4465
- name: `${this.name}_report_close_button`,
4466
- component: 'ZdModalCloseButton',
4467
- small: true,
4468
- modalName: `${this.name}_report_modal`,
4469
- },
4470
- ],
4471
- },
4472
- {
4473
- name: `${this.name}_report_form`,
4474
- component: 'ZdForm',
4475
- cssClass: 'zd-pt-4',
4476
- children: [
4477
- {
4478
- name: 'report_email',
4479
- component: 'ZdTextInput',
4480
- label: 'E-mail',
4481
- grid: {
4482
- cols: '12',
4483
- },
4484
- value: this.defaultEmail,
4485
- readonly: `{{TekUserInfoController_${this.componentId}.hasDefaultEmail}}`,
4486
- validations: {
4487
- required: {},
4488
- email: {},
4489
- },
4490
- },
4491
- {
4492
- name: 'report_cc',
4493
- component: 'ZdTextInput',
4494
- label: 'CC',
4495
- placeholder: 'TEKUSERINFO_EMAIL_PLACEHOLDER',
4496
- grid: {
4497
- cols: '12',
4498
- },
4499
- },
4500
- {
4501
- name: 'report_type',
4502
- component: 'ZdSelect',
4503
- label: 'TEKUSERINFO_TYPE',
4504
- dataValue: 'value',
4505
- dataText: 'text',
4506
- datasource: {
4507
- uniqueKey: 'value',
4508
- translate: true,
4509
- data: [
4510
- { value: '0', text: 'TEKUSERINFO_ERROR' },
4511
- { value: '1', text: 'TEKUSERINFO_IMPROVEMENT' },
4512
- ],
4513
- },
4514
- grid: {
4515
- cols: '12',
4516
- },
4517
- validations: {
4518
- required: {},
4519
- },
4520
- },
4521
- {
4522
- name: 'report_description',
4523
- component: 'ZdTextarea',
4524
- label: 'TEKUSERINFO_DESCRIPTION',
4525
- grid: {
4526
- cols: '12',
4527
- },
4528
- validations: {
4529
- required: {},
4530
- },
4531
- },
4532
- ],
4533
- },
4534
- {
4535
- name: `${this.name}_report_footer`,
4536
- component: 'ZdFooter',
4537
- color: 'transparent',
4538
- padless: true,
4539
- rightSlot: [
4540
- {
4541
- name: `${this.name}_report_cancel`,
4542
- component: 'ZdButton',
4543
- label: 'TEKUSERINFO_CANCEL',
4544
- outline: true,
4545
- events: {
4546
- click: () => { var _a; (_a = this.reportModal) === null || _a === void 0 ? void 0 : _a.hide(); },
4547
- },
4548
- },
4549
- {
4550
- name: `${this.name}_report_send`,
4551
- component: 'ZdButton',
4552
- label: 'TEKUSERINFO_SEND',
4553
- events: {
4554
- click: (args) => this.onSendReport(args),
4555
- },
4556
- },
4557
- ],
4558
- },
4559
- ],
4560
- });
4561
- }
4562
- this.reportModal.show();
4563
- }
4564
- onSendReport({ event, element }) {
4565
- if (!this.reportModal)
4566
- return;
4567
- const form = Metadata.getInstance(`${this.name}_report_form`);
4568
- if (!form.validate())
4569
- return;
4570
- this.callEvent('onSendReport', {
4571
- event, element, component: this, form,
4572
- });
4573
- this.reportModal.hide();
4574
- }
4575
- onCreated() {
4576
- super.onCreated();
4577
- Loader.addController(`TekUserInfoController_${this.componentId}`, new TekUserInfoController(this));
4578
- this.bottomSlot = this.propBottomSlot ? this.propBottomSlot : this.getBottomSlot();
4579
- }
4580
- onMounted(element) {
4581
- const _super = Object.create(null, {
4582
- onMounted: { get: () => super.onMounted }
4583
- });
4584
- return __awaiter(this, void 0, void 0, function* () {
4585
- _super.onMounted.call(this, element);
4586
- if (this.versionUrl) {
4587
- const res = yield Http.get(this.versionUrl);
4588
- this.versionInfo = res.data.versionInfo;
4589
- }
4590
- });
4591
- }
4592
- }
4593
- Messages.add({
4594
- 'pt-BR': {
4595
- translation: {
4596
- TEKUSERINFO_ABOUT: 'Sobre',
4597
- TEKUSERINFO_REPORT_ERROR: 'Reportar Erro',
4598
- TEKUSERINFO_EMAIL_PLACEHOLDER: 'Separe e-mails usando ";"',
4599
- TEKUSERINFO_TYPE: 'Tipo',
4600
- TEKUSERINFO_ERROR: 'Erro',
4601
- TEKUSERINFO_IMPROVEMENT: 'Melhoria',
4602
- TEKUSERINFO_DESCRIPTION: 'Descrição',
4603
- TEKUSERINFO_CANCEL: 'Cancelar',
4604
- TEKUSERINFO_SEND: 'Enviar',
4605
- },
4606
- },
4607
- 'en-US': {
4608
- translation: {
4609
- TEKUSERINFO_ABOUT: 'About',
4610
- TEKUSERINFO_REPORT_ERROR: 'Report Bug',
4611
- TEKUSERINFO_EMAIL_PLACEHOLDER: 'Separate e-mails using ";"',
4612
- TEKUSERINFO_TYPE: 'Type',
4613
- TEKUSERINFO_ERROR: 'Bug',
4614
- TEKUSERINFO_IMPROVEMENT: 'Improvement',
4615
- TEKUSERINFO_DESCRIPTION: 'Description',
4616
- TEKUSERINFO_CANCEL: 'Cancel',
4617
- TEKUSERINFO_SEND: 'Send',
4618
- },
4619
- },
4620
- 'es-CL': {
4621
- translation: {
4622
- TEKUSERINFO_ABOUT: 'Sobre',
4623
- TEKUSERINFO_REPORT_ERROR: 'Reportar Error',
4624
- TEKUSERINFO_EMAIL_PLACEHOLDER: 'Separar e-mails usando ";"',
4625
- TEKUSERINFO_TYPE: 'Tipo',
4626
- TEKUSERINFO_ERROR: 'Error',
4627
- TEKUSERINFO_IMPROVEMENT: 'Mejora',
4628
- TEKUSERINFO_DESCRIPTION: 'Descripción',
4629
- TEKUSERINFO_CANCEL: 'Cancelar',
4630
- TEKUSERINFO_SEND: 'Enviar',
4631
- },
4632
- },
4633
- });
4634
-
4635
- class TekUserInfoList extends List {
4636
- constructor(props) {
4637
- super(props);
4638
- /**
4639
- * Name of the user info component
4640
- */
4641
- this.parentName = '';
4642
- this.dense = true;
4643
- this.parentName = props.parentName || '';
4644
- this.items = this.getItems();
4645
- }
4646
- getItems() {
4647
- const parent = this.parentName ? Metadata.getInstance(this.parentName) : this.parent;
4648
- if (!(parent instanceof TekUserInfo)) {
4649
- throw Error(`Could not find the TekUserInfo component associated with ${this.name} TekUserInfoList`);
4650
- }
4651
- return [
4652
- {
4653
- name: `${parent.name}_version`,
4654
- component: 'ZdListItem',
4655
- title: `{{TekUserInfoController_${parent.componentId}.name}}`,
4656
- subtitle: `{{TekUserInfoController_${parent.componentId}.version}}`,
4657
- isVisible: `{{TekUserInfoController_${parent.componentId}.showVersionInfo}}`,
4658
- cssClass: 'zd-px-2',
4659
- },
4660
- {
4661
- name: `${parent.name}_about`,
4662
- component: 'ZdListItem',
4663
- title: 'TEKUSERINFO_ABOUT',
4664
- prependIcon: 'infoOutline',
4665
- cssClass: 'zd-px-2',
4666
- isVisible: `{{TekUserInfoController_${parent.componentId}.showAbout}}`,
4667
- events: {
4668
- click: () => parent.onAboutClick(),
4669
- },
4670
- },
4671
- {
4672
- name: `${parent.name}_report`,
4673
- component: 'ZdListItem',
4674
- title: 'TEKUSERINFO_REPORT_ERROR',
4675
- prependIcon: 'mdi-ladybug',
4676
- cssClass: 'zd-px-2',
4677
- isVisible: `{{TekUserInfoController_${parent.componentId}.showReportError}}`,
4678
- events: {
4679
- click: () => parent.onReportClick(),
4680
- },
4681
- },
4682
- ];
4683
- }
4684
- }
4685
-
4686
- class TekDragGrid extends TekGrid {
4687
- constructor(props) {
4688
- super(Object.assign(Object.assign({}, props), { datasource: Object.assign(Object.assign({}, props.datasource), { order: [`${props.orderColumnName}.${props.orderMode || 'asc'}`] }) }));
4689
- this.internalOrderColumnName = '';
4690
- this.internalOrderMode = 'asc';
4691
- this.internalOrderColumnName = this.getInitValue('orderColumnName', props.orderColumnName, this.orderColumnName);
4692
- this.internalOrderMode = this.getInitValue('orderMode', props.orderMode, this.orderMode);
4693
- this.createAccessors();
4694
- this.draggable = new Draggable(this.orderColumnName, this.orderMode);
4695
- }
4696
- set orderColumnName(value) {
4697
- this.internalOrderColumnName = value;
4698
- this.draggable.orderColumnName = value;
4699
- }
4700
- get orderColumnName() {
4701
- return this.internalOrderColumnName;
4702
- }
4703
- set orderMode(value) {
4704
- this.internalOrderMode = value;
4705
- this.draggable.orderColumnName = value;
4706
- }
4707
- get orderMode() {
4708
- return this.internalOrderMode;
4709
- }
4710
- /**
4711
- * Event triggered when dragged element is moving
4712
- * @param event DOM event
4713
- * @param row row being dragged
4714
- * @param element HTML element
4715
- * @returns return false to cancel dragging
4716
- */
4717
- onDragMove(event, row, element) {
4718
- this.callEvent('onDragMove', {
4719
- component: this,
4720
- event,
4721
- row,
4722
- element,
4723
- });
4724
- return true;
4725
- }
4726
- /**
4727
- * Event triggered when drag starts
4728
- * @param event DOM event
4729
- * @param row row being dragged
4730
- * @param element HTML element
4731
- */
4732
- onDragStart(event, row, element) {
4733
- return this.callEvent('onDragStart', {
4734
- component: this,
4735
- event,
4736
- row,
4737
- element,
4738
- });
4739
- }
4740
- /**
4741
- * Event triggered when drag ends
4742
- * @param event DOM event
4743
- * @param row row being dragged
4744
- * @param element HTML element
4745
- */
4746
- onDragEnd(event, row, element) {
4747
- const { oldIndex, newIndex } = event;
4748
- const changes = this.draggable.getDragChanges(oldIndex, newIndex, this.datasource, this.getEditedRows());
4749
- this.editing = true;
4750
- const orderColumn = new GridColumnEditable({ name: this.orderColumnName });
4751
- changes.forEach((change) => {
4752
- this.changeEditableComponent(orderColumn, change.row, change.value);
4753
- });
4754
- this.callEvent('inlineEdit', {
4755
- event,
4756
- element,
4757
- row,
4758
- column: { name: this.orderColumnName },
4759
- component: this,
4760
- });
4761
- this.callEvent('onDragEnd', {
4762
- component: this,
4763
- event,
4764
- row,
4765
- element,
4766
- });
4767
- }
4768
- }
4769
-
4770
- Messages.add({
4771
- 'pt-BR': {
4772
- translation: {
4773
- NO_NOTIFICATIONS: 'Nenhuma Notificação',
4774
- MARK_ALL_AS_READ: 'Marcar todas como lidas',
4775
- NOTIFICATIONS: 'Notificações',
4776
- SEE_ALL_NOTIFICATIONS: 'Ver todas notificações',
4777
- UNAVAILABLE_IMAGE: 'Imagem indisponível',
4778
- REFRESH: 'Atualizar',
4779
- ACTIONS: 'Ações',
4780
- FILTER: 'Filtro',
4781
- LAYOUT: 'Layout: ',
4782
- NEW_LAYOUT: 'Novo layout',
4783
- DEFAULT_LAYOUT: 'Padrão',
4784
- LAYOUT_MODIFIED: 'O layout atual foi modificado. Crie um novo layout, sobrescreva um existente ou descarte as alterações',
4785
- LAYOUT_NOT_MODIFIED: 'Crie um novo layout ou aplique um dos layouts já existentes',
4786
- LAYOUT_DISCART_CHANGES: 'Descartar alterações',
4787
- },
4788
- },
4789
- 'en-US': {
4790
- translation: {
4791
- NO_NOTIFICATIONS: 'No Notifications',
4792
- MARK_ALL_AS_READ: 'Mark all as read',
4793
- NOTIFICATIONS: 'Notifications',
4794
- SEE_ALL_NOTIFICATIONS: 'See all notifications',
4795
- UNAVAILABLE_IMAGE: 'Unavailable image',
4796
- REFRESH: 'Refresh',
4797
- ACTIONS: 'Actions',
4798
- FILTER: 'Filter',
4799
- LAYOUT: 'Layout: ',
4800
- NEW_LAYOUT: 'New layout',
4801
- DEFAULT_LAYOUT: 'Default',
4802
- LAYOUT_MODIFIED: 'The current layout has been modified. Create a new layout, overwrite an existing one or discard changes',
4803
- LAYOUT_NOT_MODIFIED: 'Create a new layout or apply one of the existing layouts',
4804
- LAYOUT_DISCART_CHANGES: 'Discard changes',
4805
- },
4806
- },
4807
- 'es-CL': {
4808
- translation: {
4809
- NO_NOTIFICATIONS: 'Sin Notificación',
4810
- MARK_ALL_AS_READ: 'Marcar todo como leído',
4811
- NOTIFICATIONS: 'Notificaciones',
4812
- SEE_ALL_NOTIFICATIONS: 'Ver todas las notificaciones',
4813
- UNAVAILABLE_IMAGE: 'Imagen no disponible',
4814
- REFRESH: 'Actualizar',
4815
- ACTIONS: 'Acciones',
4816
- FILTER: 'Filtro',
4817
- LAYOUT: 'Disposición: ',
4818
- NEW_LAYOUT: 'Nueva disposición',
4819
- DEFAULT_LAYOUT: 'Default',
4820
- LAYOUT_MODIFIED: 'La disposición actual ha sido modificada. Cree una nueva disposición, sobrescriba una existente o descarte los cambios',
4821
- LAYOUT_NOT_MODIFIED: 'Cree una nueva disposición o aplique una de las disposiciones existentes',
4822
- LAYOUT_DISCART_CHANGES: 'Descartar los cambios',
4823
- },
4824
- },
4825
- });
4826
-
4827
- const packageContent = require('../package.json');
4828
- VersionService.addPackageVersion(packageContent.name, packageContent.version);
4829
-
4830
- export { BreadcrumbHeader, CardTitle, CrudAddButton, CrudButton, CrudCancelButton, CrudDeleteButton, CrudForm, CrudSaveButton, DynamicFilterOperations, DynamicFilterRelations, Image, IterableCarousel, IterableComponentRender, Loading, Notifications, ProductCard, TekDragGrid, TekFilterHelper, TekGrid, TekGridColumn, TekGridColumnsButton, TekGridColumnsButtonController, TekGridFilterButton, TekGridLayoutOptions, TekMemoryDatasource, TekRestDatasource, TekTreeGrid, TekUserInfo, TekUserInfoList, columnAggregationValues };