@zeedhi/common 1.38.1 → 1.41.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 (56) hide show
  1. package/dist/style.css +1 -1
  2. package/dist/zd-common.esm.js +614 -190
  3. package/dist/zd-common.umd.js +619 -193
  4. package/package.json +2 -2
  5. package/types/components/zd-alert/alert.d.ts +2 -0
  6. package/types/components/zd-apex-chart/apex-chart.d.ts +11 -0
  7. package/types/components/zd-breadcrumbs/breadcrumbs.d.ts +0 -8
  8. package/types/components/zd-button/button.d.ts +0 -8
  9. package/types/components/zd-button/interfaces.d.ts +0 -2
  10. package/types/components/zd-button-group/button-group.d.ts +0 -8
  11. package/types/components/zd-button-group/interfaces.d.ts +0 -2
  12. package/types/components/zd-card/card.d.ts +0 -8
  13. package/types/components/zd-card/interfaces.d.ts +0 -2
  14. package/types/components/zd-carousel/carousel.d.ts +0 -8
  15. package/types/components/zd-carousel/interfaces.d.ts +0 -2
  16. package/types/components/zd-component/component.d.ts +8 -0
  17. package/types/components/zd-component/interfaces.d.ts +2 -0
  18. package/types/components/zd-date/date-range.d.ts +1 -5
  19. package/types/components/zd-divider/divider.d.ts +0 -8
  20. package/types/components/zd-divider/interfaces.d.ts +0 -2
  21. package/types/components/zd-footer/footer.d.ts +0 -8
  22. package/types/components/zd-footer/interfaces.d.ts +0 -2
  23. package/types/components/zd-form/form.d.ts +10 -1
  24. package/types/components/zd-frame/frame.d.ts +1 -0
  25. package/types/components/zd-grid/grid-column.d.ts +2 -0
  26. package/types/components/zd-grid/grid-editable.d.ts +1 -1
  27. package/types/components/zd-grid/grid.d.ts +4 -0
  28. package/types/components/zd-grid/interfaces.d.ts +1 -0
  29. package/types/components/zd-header/header.d.ts +0 -8
  30. package/types/components/zd-icon/icon.d.ts +0 -8
  31. package/types/components/zd-icon/interfaces.d.ts +0 -2
  32. package/types/components/zd-input/input.d.ts +0 -8
  33. package/types/components/zd-iterable/column.d.ts +4 -2
  34. package/types/components/zd-list/interfaces.d.ts +0 -2
  35. package/types/components/zd-list/list.d.ts +0 -8
  36. package/types/components/zd-login/interfaces.d.ts +0 -1
  37. package/types/components/zd-login/login.d.ts +0 -4
  38. package/types/components/zd-menu/interfaces.d.ts +0 -1
  39. package/types/components/zd-menu/menu.d.ts +0 -4
  40. package/types/components/zd-progress/progress.d.ts +0 -8
  41. package/types/components/zd-select/select.d.ts +1 -0
  42. package/types/components/zd-select-multiple/select-multiple.d.ts +4 -0
  43. package/types/components/zd-select-tree/interfaces.d.ts +1 -0
  44. package/types/components/zd-select-tree/select-tree.d.ts +6 -0
  45. package/types/components/zd-selectable-list/interfaces.d.ts +7 -0
  46. package/types/components/zd-selectable-list/selectable-list.d.ts +29 -0
  47. package/types/components/zd-steppers/interfaces.d.ts +0 -2
  48. package/types/components/zd-steppers/steppers.d.ts +0 -8
  49. package/types/components/zd-tree-grid/interfaces.d.ts +3 -1
  50. package/types/components/zd-tree-grid/tree-grid-editable.d.ts +4 -3
  51. package/types/utils/report/index.d.ts +2 -0
  52. package/types/utils/report/report-type/base-report.d.ts +3 -1
  53. package/types/utils/report/report-type/interfaces.d.ts +8 -2
  54. package/types/utils/report/report-type/xls-report.d.ts +1 -0
  55. package/types/utils/report/report-type/xls2-report.d.ts +16 -0
  56. package/types/utils/report/report-type/xls3-report.d.ts +16 -0
@@ -1,7 +1,7 @@
1
1
  import { AccessorManager, Event, KeyMap, Metadata, FormatterParserProvider, Validation, Accessor, DatasourceFactory, I18n, MethodNotAssignedError, Loader, Mask, Config, dayjs, isEqual, Router, InstanceNotFoundError, Http, Cookie, normalize, URL as URL$1 } from '@zeedhi/core';
2
+ import merge from 'lodash.merge';
2
3
  import debounce from 'lodash.debounce';
3
4
  import isUndefined from 'lodash.isundefined';
4
- import merge from 'lodash.merge';
5
5
  import set from 'lodash.set';
6
6
 
7
7
  /**
@@ -48,6 +48,14 @@ class Component {
48
48
  * Controls component visibility.
49
49
  */
50
50
  this.isVisible = true;
51
+ /**
52
+ * Applies the dark theme variant to the component.
53
+ */
54
+ this.dark = false;
55
+ /**
56
+ * Applies the light theme variant to the component.
57
+ */
58
+ this.light = false;
51
59
  /**
52
60
  * Define component key mapping
53
61
  */
@@ -63,6 +71,8 @@ class Component {
63
71
  this.cssClass = this.getInitValue('cssClass', props.cssClass, this.cssClass);
64
72
  this.cssStyle = this.getInitValue('cssStyle', props.cssStyle, this.cssStyle);
65
73
  this.isVisible = this.getInitValue('isVisible', props.isVisible, this.isVisible);
74
+ this.dark = this.getInitValue('dark', props.dark, this.dark);
75
+ this.light = this.getInitValue('light', props.light, this.light);
66
76
  this.children = Array.isArray(props.children) ? props.children : this.children;
67
77
  this.keyMap = KeyMap.factory(props.keyMap || this.keyMap);
68
78
  this.createAccessors();
@@ -298,6 +308,8 @@ class Alert extends Component {
298
308
  this.vertical = false;
299
309
  this.defaultValues = {
300
310
  name: this.name,
311
+ dark: this.dark,
312
+ light: this.light,
301
313
  color: this.color,
302
314
  text: this.text,
303
315
  timeout: this.timeout,
@@ -322,6 +334,8 @@ class Alert extends Component {
322
334
  assignAlertProperties(alert) {
323
335
  this.name = this.getInitValue('name', alert.name, this.defaultValues.name);
324
336
  this.color = this.getInitValue('color', alert.color, this.defaultValues.color);
337
+ this.dark = this.getInitValue('dark', alert.dark, this.defaultValues.dark);
338
+ this.light = this.getInitValue('light', alert.light, this.defaultValues.light);
325
339
  this.text = this.getInitValue('text', alert.text, this.defaultValues.text);
326
340
  this.timeout = this.getInitValue('timeout', alert.timeout, this.defaultValues.timeout);
327
341
  this.type = this.getInitValue('type', alert.type, this.defaultValues.type);
@@ -410,8 +424,23 @@ class ApexChart extends ComponentRender {
410
424
  * Defines the load progress color
411
425
  */
412
426
  this.loadColor = 'primary';
427
+ this.defaultOptions = {
428
+ chart: {
429
+ toolbar: {
430
+ tools: {
431
+ download: 'fileDownload',
432
+ selection: 'zoomSelection',
433
+ zoom: 'zoom',
434
+ zoomin: 'zoomIn',
435
+ zoomout: 'zoomOut',
436
+ pan: 'zoomPanning',
437
+ reset: 'zoomReset',
438
+ },
439
+ },
440
+ },
441
+ };
413
442
  this.chartType = this.getInitValue('chartType', props.chartType, this.chartType);
414
- this.options = this.getInitValue('options', props.options, this.options);
443
+ this.options = merge(this.defaultOptions, this.getInitValue('options', props.options, this.options));
415
444
  this.series = this.getInitValue('series', props.series, this.series);
416
445
  this.height = this.getInitValue('height', props.height, this.height);
417
446
  this.width = this.getInitValue('width', props.width, this.width);
@@ -428,6 +457,14 @@ class ApexChart extends ComponentRender {
428
457
  setViewUpdate(viewUpdate) {
429
458
  this.viewUpdate = viewUpdate;
430
459
  }
460
+ /**
461
+ * Sets view get icon HTML method.
462
+ * @param viewGetIconHTML Update method
463
+ */
464
+ setViewGetIconHTML(viewGetIconHTML) {
465
+ this.viewGetIconHTML = viewGetIconHTML;
466
+ this.updateToolbarIcons();
467
+ }
431
468
  /**
432
469
  * Update the chart
433
470
  * @param options New options
@@ -442,6 +479,32 @@ class ApexChart extends ComponentRender {
442
479
  }
443
480
  return Promise.resolve();
444
481
  }
482
+ updateToolbarIcons() {
483
+ var _a, _b, _c;
484
+ if (!this.viewGetIconHTML)
485
+ return this.options;
486
+ const getIconFn = this.viewGetIconHTML;
487
+ let changed = false;
488
+ const newOptions = Object.assign({}, this.options);
489
+ if ((_b = (_a = newOptions.chart) === null || _a === void 0 ? void 0 : _a.toolbar) === null || _b === void 0 ? void 0 : _b.tools) {
490
+ const { tools } = newOptions.chart.toolbar;
491
+ Object.keys(tools).forEach((key) => {
492
+ if (typeof tools[key] === 'string') {
493
+ tools[key] = getIconFn(tools[key]);
494
+ changed = true;
495
+ }
496
+ });
497
+ if ((_c = tools.customIcons) === null || _c === void 0 ? void 0 : _c.length) {
498
+ tools.customIcons.forEach((item) => {
499
+ item.icon = getIconFn(item.icon);
500
+ });
501
+ }
502
+ }
503
+ if (this.viewUpdate && changed) {
504
+ this.viewUpdate(newOptions);
505
+ }
506
+ return newOptions;
507
+ }
445
508
  }
446
509
 
447
510
  /**
@@ -492,10 +555,6 @@ class Breadcrumbs extends ComponentRender {
492
555
  */
493
556
  constructor(props) {
494
557
  super(props);
495
- /**
496
- * Applies the dark theme variant to the component.
497
- */
498
- this.dark = false;
499
558
  /**
500
559
  * Specifies the dividing string between items.
501
560
  */
@@ -512,19 +571,13 @@ class Breadcrumbs extends ComponentRender {
512
571
  * Increase the font-size of the breadcrumb item text to 16px.
513
572
  */
514
573
  this.large = false;
515
- /**
516
- * Applies the light theme variant to the component.
517
- */
518
- this.light = true;
519
574
  /**
520
575
  * Decrease the font-size of the breadcrumb item text to 12px.
521
576
  */
522
577
  this.small = false;
523
- this.dark = this.getInitValue('dark', props.dark, this.dark);
524
578
  this.divider = this.getInitValue('divider', props.divider, this.divider);
525
579
  this.items = this.getInitValue('items', props.items, this.items);
526
580
  this.large = this.getInitValue('large', props.large, this.large);
527
- this.light = this.getInitValue('light', props.light, this.light);
528
581
  this.iconName = this.getInitValue('iconName', props.iconName, this.iconName);
529
582
  this.small = this.getInitValue('small', props.small, this.small);
530
583
  this.createAccessors();
@@ -560,10 +613,6 @@ class Button extends ComponentRender {
560
613
  * It can be the name of material or css color in hexa
561
614
  */
562
615
  this.color = 'primary';
563
- /**
564
- * Applies the dark theme variant to the button
565
- */
566
- this.dark = false;
567
616
  /**
568
617
  * Removes the ability to click or target the button
569
618
  */
@@ -605,10 +654,6 @@ class Button extends ComponentRender {
605
654
  * This should be used with the absolute or fixed props
606
655
  */
607
656
  this.left = false;
608
- /**
609
- * Applies the light theme variant to the button
610
- */
611
- this.light = false;
612
657
  /**
613
658
  * Makes the background transparent and applies a thin border
614
659
  */
@@ -711,10 +756,6 @@ class ButtonGroup extends ComponentRender {
711
756
  * It can be the name of material or css color in hexa
712
757
  */
713
758
  this.color = 'primary';
714
- /**
715
- * Applies the dark theme variant to the component.
716
- */
717
- this.dark = false;
718
759
  /**
719
760
  * Reduces the button size and padding.
720
761
  */
@@ -724,10 +765,6 @@ class ButtonGroup extends ComponentRender {
724
765
  * space between the buttons
725
766
  */
726
767
  this.group = false;
727
- /**
728
- * Applies the light theme variant to the component.
729
- */
730
- this.light = false;
731
768
  /**
732
769
  * Applies mandatory selected button
733
770
  */
@@ -761,10 +798,8 @@ class ButtonGroup extends ComponentRender {
761
798
  this.backgroundColor = this.getInitValue('backgroundColor', props.backgroundColor, this.backgroundColor);
762
799
  this.borderless = this.getInitValue('block', props.borderless, this.borderless);
763
800
  this.color = this.getInitValue('color', props.color, this.color);
764
- this.dark = this.getInitValue('dark', props.dark, this.dark);
765
801
  this.dense = this.getInitValue('disabled', props.dense, this.dense);
766
802
  this.group = this.getInitValue('group', props.group, this.group);
767
- this.light = this.getInitValue('light', props.light, this.light);
768
803
  this.mandatory = this.getInitValue('mandatory', props.mandatory, this.mandatory);
769
804
  this.multiple = this.getInitValue('multiple', props.multiple, this.multiple);
770
805
  this.rounded = this.getInitValue('rounded', props.rounded, this.rounded);
@@ -818,10 +853,6 @@ class Carousel extends ComponentRender {
818
853
  * a non-integer number in slidesPerView, like 1.5)
819
854
  */
820
855
  this.center = false;
821
- /**
822
- * Applies the dark theme variant to the carousel pagination
823
- */
824
- this.dark = false;
825
856
  /**
826
857
  * Displays the pagination as a fraction in the following format: currentSlide/slidesCount.
827
858
  * Only works when <code>showPagination</code> property is true
@@ -848,10 +879,6 @@ class Carousel extends ComponentRender {
848
879
  * Allows controlling the carousel using the keyboard arrow keys
849
880
  */
850
881
  this.keysControl = true;
851
- /**
852
- * Applies the light theme variant to the carousel
853
- */
854
- this.light = true;
855
882
  /**
856
883
  * Allows controlling the carousel using mouse drag
857
884
  */
@@ -926,14 +953,12 @@ class Carousel extends ComponentRender {
926
953
  this.autoPlay = this.getInitValue('autoPlay', props.autoPlay, this.autoPlay);
927
954
  this.buttonsOutside = this.getInitValue('buttonsOutside', props.buttonsOutside, this.buttonsOutside);
928
955
  this.center = this.getInitValue('center', props.center, this.center);
929
- this.dark = this.getInitValue('dark', props.dark, this.dark);
930
956
  this.height = this.getInitValue('height', props.height, this.height);
931
957
  this.infiniteScroll = this.getInitValue('infiniteScroll', props.infiniteScroll, this.infiniteScroll);
932
958
  this.initialSlide = this.getInitValue('initialSlide', props.initialSlide, this.initialSlide);
933
959
  this.currentSlide = this.getInitValue('currentSlide', props.currentSlide, this.initialSlide);
934
960
  this.interval = this.getInitValue('interval', props.interval, this.interval);
935
961
  this.keysControl = this.getInitValue('keysControl', props.keysControl, this.keysControl);
936
- this.light = this.getInitValue('light', props.light, this.light);
937
962
  this.mouseControl = this.getInitValue('mouseControl', props.mouseControl, this.mouseControl);
938
963
  this.nextButton = props.nextButton || this.nextButton;
939
964
  this.fractionPagination = this.getInitValue('fractionPagination', props.fractionPagination, this.fractionPagination);
@@ -1048,10 +1073,6 @@ class Card extends ComponentRender {
1048
1073
  * Applies specified color to the control. It can be the name of material color
1049
1074
  */
1050
1075
  this.color = '';
1051
- /**
1052
- * Applies the dark theme variant to the component
1053
- */
1054
- this.dark = false;
1055
1076
  /**
1056
1077
  * Removes the ability to click or target the component
1057
1078
  */
@@ -1068,10 +1089,6 @@ class Card extends ComponentRender {
1068
1089
  * Specifies an image background for the card
1069
1090
  */
1070
1091
  this.img = '';
1071
- /**
1072
- * Applies the light theme variant to the component
1073
- */
1074
- this.light = false;
1075
1092
  /**
1076
1093
  * Designates that the card is a link
1077
1094
  */
@@ -1095,7 +1112,6 @@ class Card extends ComponentRender {
1095
1112
  this.activeClass = this.getInitValue('activeClass', props.activeClass, this.activeClass);
1096
1113
  this.append = this.getInitValue('append', props.append, this.append);
1097
1114
  this.color = this.getInitValue('color', props.color, this.color);
1098
- this.dark = this.getInitValue('dark', props.dark, this.dark);
1099
1115
  this.disabled = this.getInitValue('disabled', props.disabled, this.disabled);
1100
1116
  this.elevation = this.getInitValue('elevation', props.elevation, this.elevation);
1101
1117
  this.flat = this.getInitValue('flat', props.flat, this.flat);
@@ -1103,7 +1119,6 @@ class Card extends ComponentRender {
1103
1119
  this.hover = this.getInitValue('hover', props.hover, this.hover);
1104
1120
  this.href = this.getInitValue('href', props.href, this.href);
1105
1121
  this.img = this.getInitValue('img', props.img, this.img);
1106
- this.light = this.getInitValue('light', props.light, this.light);
1107
1122
  this.link = this.getInitValue('link', props.link, this.link);
1108
1123
  this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
1109
1124
  this.maxWidth = this.getInitValue('maxWidth', props.maxWidth, this.maxWidth);
@@ -1316,10 +1331,6 @@ class Input extends ComponentRender {
1316
1331
  * It can be the name of material or css color in hexa.
1317
1332
  */
1318
1333
  this.color = 'primary';
1319
- /**
1320
- * Applies the dark theme variant to the input.
1321
- */
1322
- this.dark = false;
1323
1334
  /**
1324
1335
  * Defines smaller input.
1325
1336
  */
@@ -1336,10 +1347,6 @@ class Input extends ComponentRender {
1336
1347
  * Defines the input label.
1337
1348
  */
1338
1349
  this.label = '';
1339
- /**
1340
- * Applies the light theme variant to the input.
1341
- */
1342
- this.light = false;
1343
1350
  /**
1344
1351
  * Applies a custom character mask to the input.
1345
1352
  */
@@ -1408,13 +1415,11 @@ class Input extends ComponentRender {
1408
1415
  this.autofocus = this.getInitValue('autofocus', props.autofocus, this.autofocus);
1409
1416
  this.clearable = this.getInitValue('clearable', props.clearable, this.clearable);
1410
1417
  this.color = this.getInitValue('color', props.color, this.color);
1411
- this.dark = this.getInitValue('dark', props.dark, this.dark);
1412
1418
  this.dense = this.getInitValue('dense', props.dense, this.dense);
1413
1419
  this.disabled = this.getInitValue('disabled', props.disabled, this.disabled);
1414
1420
  this.hint = this.getInitValue('hint', props.hint, this.hint);
1415
1421
  this.autoHintDetails = this.getInitValue('autoHintDetails', props.autoHintDetails, this.autoHintDetails);
1416
1422
  this.label = this.getInitValue('label', props.label, this.label);
1417
- this.light = this.getInitValue('light', props.light, this.light);
1418
1423
  this.mask = this.getInitValue('mask', props.mask, this.mask);
1419
1424
  this.maxLength = this.getInitValue('maxLength', props.maxLength, this.maxLength);
1420
1425
  this.persistentHint = this.getInitValue('persistentHint', props.persistentHint, this.persistentHint);
@@ -3322,10 +3327,6 @@ class DateRange extends TextInput {
3322
3327
  * Sets the locale. Accepts a string with a BCP 47 language tag.
3323
3328
  */
3324
3329
  this.locale = I18n.instance.language;
3325
- /**
3326
- * Defines if dates should be ordered
3327
- */
3328
- this.orderedDates = false;
3329
3330
  /**
3330
3331
  * Allows changing displayed month with mouse scroll
3331
3332
  */
@@ -3349,15 +3350,12 @@ class DateRange extends TextInput {
3349
3350
  this.appendIcon = this.getInitValue('appendIcon', props.appendIcon, 'calendar');
3350
3351
  this.autocomplete = this.getInitValue('autocomplete', props.autocomplete, this.autocomplete);
3351
3352
  this.dateFormat = this.getInitValue('dateFormat', props.dateFormat, this.dateFormat);
3352
- this.orderedDates = this.getInitValue('orderedDates', props.orderedDates, this.orderedDates);
3353
3353
  this.dateValidation = this.dateValidation.bind(this);
3354
- this.dateValidateOrder = this.dateValidateOrder.bind(this);
3355
3354
  this.displayFormat = this.getInitValue('displayFormat', props.displayFormat, this.displayFormat);
3356
3355
  this.inputFormat = this.getInitValue('inputFormat', props.inputFormat, this.inputFormat);
3357
3356
  this.firstDayOfWeek = this.getInitValue('firstDayOfWeek', props.firstDayOfWeek, this.firstDayOfWeek);
3358
3357
  this.fullWidth = this.getInitValue('fullWidth', props.fullWidth, this.fullWidth);
3359
3358
  this.locale = this.getInitValue('locale', props.locale, this.locale);
3360
- this.rules.push(this.dateValidation, this.dateValidateOrder);
3361
3359
  this.scrollable = this.getInitValue('scrollable', props.scrollable, this.scrollable);
3362
3360
  this.showDatePicker = this.getInitValue('showDatePicker', props.showDatePicker, this.showDatePicker);
3363
3361
  this.showWeek = this.getInitValue('showWeek', props.showWeek, this.showWeek);
@@ -3474,13 +3472,13 @@ class DateRange extends TextInput {
3474
3472
  splitedValue = dates;
3475
3473
  else
3476
3474
  splitedValue = this.splitValues(dates);
3477
- const formatedValue = [];
3475
+ const formattedValue = [];
3478
3476
  splitedValue.forEach((value) => {
3479
3477
  if (value && this.isValidDate(value, this.dateFormat)) {
3480
- formatedValue.push(dayjs(value, this.dateFormat, true).format(this.isoFormat));
3478
+ formattedValue.push(dayjs(value, this.dateFormat, true).format(this.isoFormat));
3481
3479
  }
3482
3480
  });
3483
- return formatedValue;
3481
+ return formattedValue;
3484
3482
  }
3485
3483
  parseISODateRangeValue(values) {
3486
3484
  const parsedValue = [];
@@ -3491,19 +3489,14 @@ class DateRange extends TextInput {
3491
3489
  }
3492
3490
  });
3493
3491
  }
3494
- return parsedValue;
3492
+ return this.sortDates(parsedValue);
3493
+ }
3494
+ sortDates(parsedValue) {
3495
+ return parsedValue.sort((a, b) => (dayjs(a, this.dateFormat).isAfter(dayjs(b, this.dateFormat)) ? 1 : -1));
3495
3496
  }
3496
3497
  dateValidation() {
3497
3498
  return !this.dateError || I18n.translate('VALIDATION_INVALID_DATE');
3498
3499
  }
3499
- dateValidateOrder() {
3500
- if (this.value && (this.value.length === 2 && this.orderedDates)) {
3501
- const date1 = dayjs(this.value[0], this.dateFormat);
3502
- const date2 = dayjs(this.value[1], this.dateFormat);
3503
- return (date1.isBefore(date2) || date1.isSame(date2)) || I18n.translate('VALIDATION_INVALID_ORDER_DATE');
3504
- }
3505
- return true;
3506
- }
3507
3500
  click(event, element) {
3508
3501
  super.click(event, element);
3509
3502
  if (!event.defaultPrevented) {
@@ -3511,6 +3504,7 @@ class DateRange extends TextInput {
3511
3504
  }
3512
3505
  }
3513
3506
  blur(event, element) {
3507
+ this.value = this.sortDates(this.value);
3514
3508
  this.removeDateMask();
3515
3509
  this.setDateValue(this.displayValue);
3516
3510
  super.blur(event, element);
@@ -3672,18 +3666,10 @@ class Divider extends ComponentRender {
3672
3666
  */
3673
3667
  constructor(props) {
3674
3668
  super(props);
3675
- /**
3676
- * Applies the dark theme variant to the component.
3677
- */
3678
- this.dark = false;
3679
3669
  /**
3680
3670
  * Adds indentation (72px) for normal dividers, reduces max height for vertical.
3681
3671
  */
3682
3672
  this.inset = false;
3683
- /**
3684
- * Applies the light theme variant to the component.
3685
- */
3686
- this.light = false;
3687
3673
  /**
3688
3674
  * Displays dividers vertically.
3689
3675
  */
@@ -3953,10 +3939,6 @@ class Footer extends ComponentRender {
3953
3939
  * Applies specified color to the control. It can be the name of material or css color in hexa.
3954
3940
  */
3955
3941
  this.color = 'primary';
3956
- /**
3957
- * Applies the dark theme variant to footer.
3958
- */
3959
- this.dark = false;
3960
3942
  /**
3961
3943
  * Applies position fixed to footer.
3962
3944
  */
@@ -3973,10 +3955,6 @@ class Footer extends ComponentRender {
3973
3955
  * Render components on the left of footer.
3974
3956
  */
3975
3957
  this.leftSlot = [];
3976
- /**
3977
- * Applies the light theme variant to the footer.
3978
- */
3979
- this.light = false;
3980
3958
  /**
3981
3959
  * Remove all padding from the footer.
3982
3960
  */
@@ -4055,6 +4033,12 @@ class Frame extends ComponentRender {
4055
4033
  }
4056
4034
  });
4057
4035
  }
4036
+ reload() {
4037
+ return __awaiter(this, void 0, void 0, function* () {
4038
+ this.loading = true;
4039
+ this.getMetadata();
4040
+ });
4041
+ }
4058
4042
  notFoundError() { }
4059
4043
  requestPage() {
4060
4044
  return __awaiter(this, void 0, void 0, function* () {
@@ -4313,11 +4297,11 @@ class Column extends Component {
4313
4297
  * Apply conditions
4314
4298
  * @param row Datasource row
4315
4299
  */
4316
- applyCondition(row) {
4300
+ applyCondition(row, factoredConditions = this.factoredConditions) {
4317
4301
  const appliedConditions = {};
4318
- Object.keys(this.factoredConditions).forEach((condition) => {
4319
- const conditionFunction = this.factoredConditions[condition];
4320
- set(appliedConditions, condition, conditionFunction({ row }));
4302
+ Object.keys(factoredConditions).forEach((condition) => {
4303
+ const conditionFunction = factoredConditions[condition];
4304
+ set(appliedConditions, condition, conditionFunction({ row, column: this }));
4321
4305
  });
4322
4306
  return appliedConditions;
4323
4307
  }
@@ -4331,11 +4315,7 @@ class Column extends Component {
4331
4315
  const appliedConditions = {};
4332
4316
  Object.keys(this.actionFactoredConditions).forEach((action) => {
4333
4317
  const factoredConditions = this.actionFactoredConditions[action];
4334
- appliedConditions[action] = {};
4335
- Object.keys(factoredConditions).forEach((condition) => {
4336
- const conditionFunction = factoredConditions[condition];
4337
- set(appliedConditions[action], condition, conditionFunction({ row }));
4338
- });
4318
+ appliedConditions[action] = Object.assign({}, this.applyCondition(row, factoredConditions));
4339
4319
  });
4340
4320
  return appliedConditions;
4341
4321
  }
@@ -4713,7 +4693,11 @@ class Grid extends Iterable {
4713
4693
  /**
4714
4694
  * Color of the header background
4715
4695
  */
4716
- this.headerBackground = 'white';
4696
+ this.headerBackground = '';
4697
+ /**
4698
+ * Color of the header cell text color
4699
+ */
4700
+ this.headerCellTextColor = '';
4717
4701
  /**
4718
4702
  * Available order types
4719
4703
  * @public
@@ -4757,6 +4741,8 @@ class Grid extends Iterable {
4757
4741
  },
4758
4742
  };
4759
4743
  this.dense = this.getInitValue('dense', props.dense, this.dense);
4744
+ this.dark = this.getInitValue('dark', props.dark, this.dark);
4745
+ this.light = this.getInitValue('light', props.light, this.light);
4760
4746
  this.selectable = this.getInitValue('selectable', props.selectable, this.selectable);
4761
4747
  this.height = this.getInitValue('height', props.height, this.height);
4762
4748
  this.fillHeight = this.getInitValue('fillHeight', props.fillHeight, this.fillHeight);
@@ -4766,6 +4752,7 @@ class Grid extends Iterable {
4766
4752
  this.showFooter = this.getInitValue('showFooter', props.showFooter, this.showFooter);
4767
4753
  this.showHeader = this.getInitValue('showHeader', props.showHeader, this.showHeader);
4768
4754
  this.headerBackground = this.getInitValue('headerBackground', props.headerBackground, this.headerBackground);
4755
+ this.headerCellTextColor = this.getInitValue('headerCellTextColor', props.headerCellTextColor, this.headerCellTextColor);
4769
4756
  this.dragColumns = this.getInitValue('dragColumns', props.dragColumns, this.dragColumns);
4770
4757
  this.resizeColumns = this.getInitValue('resizeColumns', props.resizeColumns, this.resizeColumns);
4771
4758
  this.toolbarSlot = props.toolbarSlot || this.toolbarSlot;
@@ -4934,6 +4921,7 @@ class Grid extends Iterable {
4934
4921
  var _a, _b, _c;
4935
4922
  const rowKey = row[this.datasource.uniqueKey];
4936
4923
  const compName = actionComponent.name;
4924
+ const instanceName = `${compName}_${rowKey}`;
4937
4925
  const path = parentPath ? `${parentPath}.${compName}` : compName;
4938
4926
  const newComponent = merge({}, actionComponent, (_b = (_a = this.actionsApplied[rowKey]) === null || _a === void 0 ? void 0 : _a[column.name]) === null || _b === void 0 ? void 0 : _b[path]);
4939
4927
  let compEvents = {};
@@ -4948,7 +4936,16 @@ class Grid extends Iterable {
4948
4936
  }
4949
4937
  } });
4950
4938
  const newChildren = (_c = newComponent.children) === null || _c === void 0 ? void 0 : _c.map((child) => this.getActionComponent(child, column, row, path));
4951
- return Object.assign(Object.assign({}, newComponent), { events: newEvents, name: `${compName}_${rowKey}`, children: newChildren });
4939
+ newComponent.name = instanceName;
4940
+ newComponent.children = newChildren;
4941
+ newComponent.events = newEvents;
4942
+ try {
4943
+ Metadata.updateInstance(instanceName, newComponent);
4944
+ }
4945
+ catch (e) {
4946
+ // do nothing
4947
+ }
4948
+ return newComponent;
4952
4949
  }
4953
4950
  changeDefaultSlotNames(slot) {
4954
4951
  slot.forEach((item) => {
@@ -5068,7 +5065,6 @@ class GridEditable extends Grid {
5068
5065
  if (this.editing)
5069
5066
  return;
5070
5067
  if (column.editable) {
5071
- this.selectedRows = [];
5072
5068
  this.editing = true;
5073
5069
  this.preventRowClick = true;
5074
5070
  this.datasource.currentRow = row;
@@ -5138,7 +5134,7 @@ class GridEditable extends Grid {
5138
5134
  else {
5139
5135
  colValue = row[column.name];
5140
5136
  }
5141
- const componentProps = merge({}, column.componentProps, cellProps.componentProps);
5137
+ const componentProps = merge({}, column.componentProps, cellProps === null || cellProps === void 0 ? void 0 : cellProps.componentProps);
5142
5138
  let compEvents = {};
5143
5139
  if (componentProps && componentProps.events) {
5144
5140
  compEvents = Event.factory(componentProps.events);
@@ -5425,10 +5421,6 @@ class Header extends ComponentRender {
5425
5421
  * Applies specified color to the control. It can be the name of material or css color in hexa.
5426
5422
  */
5427
5423
  this.color = 'primary';
5428
- /**
5429
- * Applies the dark theme variant to header.
5430
- */
5431
- this.dark = false;
5432
5424
  /**
5433
5425
  * Designates that the application menu positioned on the left is below the header.
5434
5426
  */
@@ -5453,10 +5445,6 @@ class Header extends ComponentRender {
5453
5445
  * Render components on the left of header.
5454
5446
  */
5455
5447
  this.leftSlot = [];
5456
- /**
5457
- * Applies the light theme variant to the header.
5458
- */
5459
- this.light = false;
5460
5448
  /**
5461
5449
  * Removes internal padding from header.
5462
5450
  */
@@ -5471,13 +5459,11 @@ class Header extends ComponentRender {
5471
5459
  this.clippedLeft = this.getInitValue('clippedLeft', props.clippedLeft, this.clippedLeft);
5472
5460
  this.clippedRight = this.getInitValue('clippedRight', props.clippedRight, this.clippedRight);
5473
5461
  this.color = this.getInitValue('color', props.color, this.color);
5474
- this.dark = this.getInitValue('dark', props.dark, this.dark);
5475
5462
  this.dense = this.getInitValue('dense', props.dense, this.dense);
5476
5463
  this.elevation = this.getInitValue('elevation', props.elevation, this.elevation);
5477
5464
  this.fixed = this.getInitValue('fixed', props.fixed, this.fixed);
5478
5465
  this.height = this.getInitValue('height', props.height, this.height);
5479
5466
  this.leftSlot = props.leftSlot || this.leftSlot;
5480
- this.light = this.getInitValue('light', props.light, this.light);
5481
5467
  this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
5482
5468
  this.maxWidth = this.getInitValue('maxWidth', props.maxWidth, this.maxWidth);
5483
5469
  this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
@@ -5511,10 +5497,6 @@ class Icon extends ComponentRender {
5511
5497
  * (for example success or purple) or css color (#033 or rgba(255, 0, 0, 0.5)).
5512
5498
  */
5513
5499
  this.color = '';
5514
- /**
5515
- * Applies the dark theme variant to the component.
5516
- */
5517
- this.dark = false;
5518
5500
  /**
5519
5501
  * Makes icon smaller (20px)
5520
5502
  */
@@ -5536,10 +5518,6 @@ class Icon extends ComponentRender {
5536
5518
  * of a button when placed to the left of another element or text
5537
5519
  */
5538
5520
  this.left = false;
5539
- /**
5540
- * Applies the light theme variant to the component.
5541
- */
5542
- this.light = false;
5543
5521
  /**
5544
5522
  * Applies appropriate margins to the icon inside of
5545
5523
  * a button when placed to the right of another element or text
@@ -5558,13 +5536,11 @@ class Icon extends ComponentRender {
5558
5536
  */
5559
5537
  this.tag = 'i';
5560
5538
  this.color = this.getInitValue('color', props.color, this.color);
5561
- this.dark = this.getInitValue('dark', props.dark, this.dark);
5562
5539
  this.dense = this.getInitValue('dense', props.dense, this.dense);
5563
5540
  this.disabled = this.getInitValue('disabled', props.disabled, this.disabled);
5564
5541
  this.iconName = this.getInitValue('iconName', props.iconName, this.iconName);
5565
5542
  this.large = this.getInitValue('large', props.large, this.large);
5566
5543
  this.left = this.getInitValue('left', props.left, this.left);
5567
- this.light = this.getInitValue('light', props.light, this.light);
5568
5544
  this.right = this.getInitValue('right', props.right, this.right);
5569
5545
  this.size = this.getInitValue('size', props.size, this.size);
5570
5546
  this.small = this.getInitValue('small', props.small, this.small);
@@ -5931,6 +5907,7 @@ class Select extends TextInput {
5931
5907
  this.cachedData = [];
5932
5908
  this.cachedTotal = 0;
5933
5909
  this.formatterFn = FormatterParserProvider.getFormatter('ZdSelect');
5910
+ this.pushedValue = null;
5934
5911
  this.loadMoreQtty = 0;
5935
5912
  this.debounceSearch = debounce(this.doSearch, 500);
5936
5913
  this.appendIcon = this.getInitValue('appendIcon', props.appendIcon, 'expand');
@@ -5952,6 +5929,7 @@ class Select extends TextInput {
5952
5929
  this.dataText = [this.dataText];
5953
5930
  const defaultDatasource = this.getDefaultDatasource(props);
5954
5931
  this.datasource = DatasourceFactory.factory(defaultDatasource);
5932
+ this.overrideGet();
5955
5933
  let defaultValue = props.value;
5956
5934
  if (Accessor.isAccessorDefinition(props.value)) {
5957
5935
  defaultValue = this.getAccessorValue(props.value);
@@ -5982,6 +5960,16 @@ class Select extends TextInput {
5982
5960
  const searchIn = (((_a = field.datasource) === null || _a === void 0 ? void 0 : _a.searchIn) || []).concat(searchInDefault);
5983
5961
  return Object.assign(Object.assign({}, field.datasource), { searchIn, lazyLoad: (field.value !== '' && field.value !== undefined) || (field.datasource && field.datasource.lazyLoad) });
5984
5962
  }
5963
+ overrideGet() {
5964
+ const oldGet = this.datasource.get;
5965
+ this.datasource.get = () => __awaiter(this, void 0, void 0, function* () {
5966
+ yield oldGet.call(this.datasource);
5967
+ if (this.indexOf(this.value) !== -1 || this.datasource.search || this.isFocused)
5968
+ return;
5969
+ yield this.setValue(this.value, false);
5970
+ this.removePushedValue();
5971
+ });
5972
+ }
5985
5973
  get search() {
5986
5974
  return this.searchValue;
5987
5975
  }
@@ -6008,7 +5996,7 @@ class Select extends TextInput {
6008
5996
  }
6009
5997
  if (this.manualMode)
6010
5998
  return;
6011
- this.cachedData = this.datasource.data;
5999
+ this.cachedData = [...this.datasource.data];
6012
6000
  this.cachedTotal = this.datasource.total;
6013
6001
  if (pushed) {
6014
6002
  this.pushedValue = this.selectedData;
@@ -6067,10 +6055,14 @@ class Select extends TextInput {
6067
6055
  if (!this.pushedValue && this.isFilledObj(this.selectValue) && this.indexOf(this.selectValue) === -1) {
6068
6056
  this.pushedValue = this.selectValue;
6069
6057
  }
6070
- if (this.isFilledObj(this.pushedValue) && this.indexOf(this.pushedValue) === -1) {
6058
+ const index = this.indexOf(this.pushedValue);
6059
+ if (this.isFilledObj(this.pushedValue) && index === -1) {
6071
6060
  this.datasource.data.unshift(this.pushedValue);
6072
6061
  }
6073
- this.cachedData = this.datasource.data;
6062
+ else if (index !== 0) {
6063
+ this.pushedValue = null;
6064
+ }
6065
+ this.cachedData = [...this.datasource.data];
6074
6066
  this.cachedTotal = this.datasource.total;
6075
6067
  }
6076
6068
  /**
@@ -6129,6 +6121,7 @@ class Select extends TextInput {
6129
6121
  }
6130
6122
  if (!searchValue) {
6131
6123
  this.setFieldRowValue(null);
6124
+ this.selectValue = this.selectedData;
6132
6125
  return false;
6133
6126
  }
6134
6127
  this.setFieldRowValue(searchValue);
@@ -6239,7 +6232,7 @@ class Select extends TextInput {
6239
6232
  else {
6240
6233
  this.removePushedValue();
6241
6234
  this.datasource.search = this.searchValue;
6242
- this.datasource.data = this.cachedData;
6235
+ this.datasource.data = [...this.cachedData];
6243
6236
  this.datasource.total = this.cachedTotal;
6244
6237
  }
6245
6238
  });
@@ -6252,6 +6245,11 @@ class Select extends TextInput {
6252
6245
  yield this.datasource.setLimit(this.datasource.limit + this.loadMoreQtty);
6253
6246
  if (!this.datasource.search) {
6254
6247
  this.afterLoad();
6248
+ const { dataValue } = this;
6249
+ const isSelected = this.selectValue && this.pushedValue && this.selectValue[dataValue] === this.pushedValue[dataValue];
6250
+ if (isSelected)
6251
+ return;
6252
+ this.removePushedValue();
6255
6253
  }
6256
6254
  });
6257
6255
  }
@@ -6265,7 +6263,7 @@ class Select extends TextInput {
6265
6263
  this.datasource.search = '';
6266
6264
  this.dirtySearchValue = '';
6267
6265
  if (!this.manualMode) {
6268
- this.datasource.data = this.cachedData;
6266
+ this.datasource.data = [...this.cachedData];
6269
6267
  this.datasource.total = this.cachedTotal;
6270
6268
  }
6271
6269
  this.checkValueOnBlur();
@@ -6278,13 +6276,17 @@ class Select extends TextInput {
6278
6276
  }
6279
6277
  if (this.manualMode)
6280
6278
  return;
6281
- if (this.isFilledObj(this.selectValue)) {
6282
- if (this.indexOf(this.selectValue) === -1) {
6283
- this.datasource.data.unshift(this.selectValue);
6284
- this.pushedValue = this.selectValue;
6279
+ if (this.isFilledObj(this.selectValue) && this.indexOf(this.selectValue) === -1) {
6280
+ if (this.pushedValue) {
6281
+ this.removePushedValue();
6285
6282
  }
6283
+ this.datasource.data.unshift(this.selectValue);
6284
+ this.pushedValue = this.selectValue;
6286
6285
  return;
6287
6286
  }
6287
+ const { dataValue } = this;
6288
+ if (this.pushedValue && this.selectValue && this.selectValue[dataValue] === this.pushedValue[dataValue])
6289
+ return;
6288
6290
  this.removePushedValue();
6289
6291
  }
6290
6292
  showLoadMore() {
@@ -6522,10 +6524,6 @@ class ItemNotFoundError extends Error {
6522
6524
  class List extends ComponentRender {
6523
6525
  constructor(props) {
6524
6526
  super(props);
6525
- /**
6526
- * Applies the dark theme variant to the List.
6527
- */
6528
- this.dark = false;
6529
6527
  /**
6530
6528
  * Create the list with smaller items.
6531
6529
  */
@@ -6538,10 +6536,6 @@ class List extends ComponentRender {
6538
6536
  * Render list with dividers between the items.
6539
6537
  */
6540
6538
  this.divided = false;
6541
- /**
6542
- * Applies the light theme variant to the List.
6543
- */
6544
- this.light = false;
6545
6539
  /**
6546
6540
  * Increases the height of all the list items to better support three lines of text.
6547
6541
  */
@@ -6686,10 +6680,6 @@ class Login extends ComponentRender {
6686
6680
  * It can be the name of material or css color in hexa.
6687
6681
  */
6688
6682
  this.color = '';
6689
- /**
6690
- * Applies the dark theme.
6691
- */
6692
- this.dark = false;
6693
6683
  /**
6694
6684
  * Card position orientation.
6695
6685
  */
@@ -6718,7 +6708,6 @@ class Login extends ComponentRender {
6718
6708
  this.bottomLink = props.bottomLink || this.bottomLink;
6719
6709
  this.cardWidth = this.getInitValue('cardWidth', props.cardWidth, this.cardWidth);
6720
6710
  this.color = this.getInitValue('color', props.color, this.color);
6721
- this.dark = this.getInitValue('dark', props.dark, this.dark);
6722
6711
  this.layout = this.getInitValue('layout', props.layout, this.layout);
6723
6712
  this.logo = this.getInitValue('logo', props.logo, this.logo);
6724
6713
  this.logoMessage = this.getInitValue('logoMessage', props.logoMessage, this.logoMessage);
@@ -6945,10 +6934,6 @@ class Menu extends ComponentRender {
6945
6934
  * Defines if the menu should have a visible container
6946
6935
  */
6947
6936
  this.floating = false;
6948
- /**
6949
- * Applies the dark theme variant to the menu.
6950
- */
6951
- this.dark = false;
6952
6937
  /**
6953
6938
  * Create the menu with smaller items.
6954
6939
  */
@@ -7031,7 +7016,6 @@ class Menu extends ComponentRender {
7031
7016
  this.clipped = this.getInitValue('clipped', props.clipped, this.clipped);
7032
7017
  this.fixed = this.getInitValue('fixed', props.fixed, this.fixed);
7033
7018
  this.floating = this.getInitValue('floating', props.floating, this.floating);
7034
- this.dark = this.getInitValue('dark', props.dark, this.dark);
7035
7019
  this.dense = this.getInitValue('dense', props.dense, this.dense);
7036
7020
  this.mini = this.getInitValue('mini', props.mini, this.mini);
7037
7021
  this.miniState = this.getInitValue('miniState', props.miniState, this.miniState);
@@ -7672,10 +7656,6 @@ class Progress extends ComponentRender {
7672
7656
  * Defines the value color
7673
7657
  */
7674
7658
  this.color = 'primary';
7675
- /**
7676
- * Applies the dark theme variant to the component
7677
- */
7678
- this.dark = false;
7679
7659
  /**
7680
7660
  * Sets the height for the component
7681
7661
  */
@@ -7684,10 +7664,6 @@ class Progress extends ComponentRender {
7684
7664
  * Animates the component constantly
7685
7665
  */
7686
7666
  this.indeterminate = false;
7687
- /**
7688
- * Applies the light theme variant to the component
7689
- */
7690
- this.light = false;
7691
7667
  /**
7692
7668
  * Render components on the progress component
7693
7669
  */
@@ -7699,10 +7675,8 @@ class Progress extends ComponentRender {
7699
7675
  this.backgroundColor = this.getInitValue('backgroundColor', props.backgroundColor, this.backgroundColor);
7700
7676
  this.backgroundOpacity = this.getInitValue('backgroundOpacity', props.backgroundOpacity, this.backgroundOpacity);
7701
7677
  this.color = this.getInitValue('color', props.color, this.color);
7702
- this.dark = this.getInitValue('dark', props.dark, this.dark);
7703
7678
  this.height = this.getInitValue('height', props.height, this.height);
7704
7679
  this.indeterminate = this.getInitValue('indeterminate', props.indeterminate, this.indeterminate);
7705
- this.light = this.getInitValue('light', props.light, this.light);
7706
7680
  this.centerSlot = this.getInitValue('centerSlot', props.centerSlot, this.centerSlot);
7707
7681
  this.value = this.getInitValue('value', props.value, this.value);
7708
7682
  this.createAccessors();
@@ -7929,20 +7903,23 @@ class SelectMultiple extends Select {
7929
7903
  set selectValue(rows) {
7930
7904
  if (!Array.isArray(rows))
7931
7905
  return;
7932
- if (!this.manualMode && this.insertedValues.length > 0) {
7933
- this.insertsRemoved = [];
7906
+ if (!this.manualMode) {
7934
7907
  const values = rows.map((row) => row[this.dataValue]);
7935
- this.insertedValues = this.insertedValues.filter((inserted) => {
7936
- const removed = !values.includes(inserted[this.dataValue]);
7937
- if (removed) {
7938
- this.insertsRemoved.push(inserted);
7939
- }
7940
- return !removed;
7941
- });
7908
+ this.cutFromAToB(this.insertedValues, this.insertsRemoved, (value) => !values.includes(value[this.dataValue]));
7909
+ this.cutFromAToB(this.insertsRemoved, this.insertedValues, (value) => values.includes(value[this.dataValue]));
7942
7910
  }
7943
7911
  this.selectedValue = rows;
7944
7912
  this.setFieldValue(this.getValues(rows));
7945
7913
  }
7914
+ /**
7915
+ * Removes item from array a and add it to array b if condition is satisfied
7916
+ */
7917
+ cutFromAToB(a, b, condition) {
7918
+ const indices = a.reduce((result, value, index) => (condition(value) ? [...result, index] : result), []);
7919
+ indices.forEach((index) => {
7920
+ b.push(a.splice(index)[0]);
7921
+ });
7922
+ }
7946
7923
  setFieldValue(value) {
7947
7924
  return __awaiter(this, void 0, void 0, function* () {
7948
7925
  const promises = [];
@@ -8119,7 +8096,7 @@ class SelectMultiple extends Select {
8119
8096
  showLoadMore() {
8120
8097
  return !!this.datasource.data.length
8121
8098
  && !this.datasource.loadAll
8122
- && (this.datasource.data.length - this.insertedValues.length) < this.datasource.total;
8099
+ && (this.datasource.data.length - this.insertedValues.length - this.insertsRemoved.length) < this.datasource.total;
8123
8100
  }
8124
8101
  /**
8125
8102
  * Load more data
@@ -8127,10 +8104,16 @@ class SelectMultiple extends Select {
8127
8104
  loadMore() {
8128
8105
  return __awaiter(this, void 0, void 0, function* () {
8129
8106
  yield this.datasource.setLimit(this.datasource.limit + this.loadMoreQtty);
8107
+ this.insertsRemoved = this.insertsRemoved.filter((insert) => {
8108
+ const value = insert[this.dataValue];
8109
+ const foundInData = this.datasource.data.find(this.getCondition(value));
8110
+ return !foundInData;
8111
+ });
8112
+ this.insertSelected();
8130
8113
  if (!this.datasource.search) {
8131
8114
  this.setCache();
8132
8115
  }
8133
- this.insertSelected();
8116
+ this.removePushedValue();
8134
8117
  });
8135
8118
  }
8136
8119
  /**
@@ -8324,6 +8307,9 @@ class TreeDataStructure {
8324
8307
  }
8325
8308
  return item;
8326
8309
  });
8310
+ if (parent) { // remove all existing children to add new ones
8311
+ this.treeData = this.treeData.filter((item) => item.tree__parent !== parent);
8312
+ }
8327
8313
  if (!parent) {
8328
8314
  this.treeData = childData;
8329
8315
  }
@@ -8507,7 +8493,7 @@ class TreeDataStructure {
8507
8493
  this.treeStructure = {};
8508
8494
  const childData = this.originalDatasource.data.map((row) => (Object.assign(Object.assign({}, row), { tree__children: [], tree__opened: false, tree__searched: true, tree__level: 1, tree__parent: undefined })));
8509
8495
  this.treeData = childData;
8510
- this.treeStructure['no-parent'] = this.originalDatasource.data;
8496
+ this.treeStructure['no-parent'] = childData;
8511
8497
  }
8512
8498
  /**
8513
8499
  * Search value against a memory datasource
@@ -8628,6 +8614,10 @@ class SelectTree extends TextInput {
8628
8614
  * Defines if field value should be an object
8629
8615
  */
8630
8616
  this.returnObject = false;
8617
+ /**
8618
+ * Prevents load select data when the input is focused
8619
+ */
8620
+ this.preventLoadOnFocus = true;
8631
8621
  /**
8632
8622
  * Field used to make the item disabled
8633
8623
  */
@@ -8660,6 +8650,7 @@ class SelectTree extends TextInput {
8660
8650
  this.dataValue = this.getInitValue('dataValue', props.dataValue, this.dataValue);
8661
8651
  this.dataDisabled = this.getInitValue('dataDisabled', props.dataDisabled, this.dataDisabled);
8662
8652
  this.disabledItems = this.getInitValue('disabledItems', props.disabledItems, this.disabledItems);
8653
+ this.preventLoadOnFocus = this.getInitValue('preventLoadOnFocus', props.preventLoadOnFocus, this.preventLoadOnFocus);
8663
8654
  if (props.datasource && Object.keys(props.datasource).length) {
8664
8655
  this.lazyLoad = props.datasource.lazyLoad !== false;
8665
8656
  const searchFields = Array.isArray(this.dataText) ? this.dataText : [this.dataText];
@@ -8673,6 +8664,24 @@ class SelectTree extends TextInput {
8673
8664
  }
8674
8665
  this.createAccessors();
8675
8666
  }
8667
+ focus(event, element) {
8668
+ const _super = Object.create(null, {
8669
+ focus: { get: () => super.focus }
8670
+ });
8671
+ return __awaiter(this, void 0, void 0, function* () {
8672
+ _super.focus.call(this, event, element);
8673
+ this.afterFocus();
8674
+ });
8675
+ }
8676
+ afterFocus() {
8677
+ var _a;
8678
+ return __awaiter(this, void 0, void 0, function* () {
8679
+ if (!this.preventLoadOnFocus) {
8680
+ yield ((_a = this.datasource) === null || _a === void 0 ? void 0 : _a.get());
8681
+ this.preventLoadOnFocus = true;
8682
+ }
8683
+ });
8684
+ }
8676
8685
  createDataStructure() {
8677
8686
  this.treeDataStructure = new TreeDataStructure({
8678
8687
  datasource: this.datasource,
@@ -9000,14 +9009,6 @@ class Steppers extends ComponentRender {
9000
9009
  * Array of steppers items
9001
9010
  */
9002
9011
  this.items = [];
9003
- /**
9004
- * Applies the dark theme variant to the stepper
9005
- */
9006
- this.dark = false;
9007
- /**
9008
- * Applies the light theme variant to the stepper
9009
- */
9010
- this.light = false;
9011
9012
  /**
9012
9013
  * Allow user to jump to any step
9013
9014
  */
@@ -9019,9 +9020,7 @@ class Steppers extends ComponentRender {
9019
9020
  this.activeStep = this.getInitValue('activeStep', props.activeStep, this.activeStep);
9020
9021
  this.altLabels = this.getInitValue('altLabels', props.altLabels, this.altLabels);
9021
9022
  this.content = this.getInitValue('content', props.content, this.content);
9022
- this.dark = this.getInitValue('dark', props.dark, this.dark);
9023
9023
  this.items = this.getInitValue('items', props.items, this.items);
9024
- this.light = this.getInitValue('light', props.light, this.light);
9025
9024
  this.nonLinear = this.getInitValue('nonLinear', props.nonLinear, this.nonLinear);
9026
9025
  this.vertical = this.getInitValue('vertical', props.vertical, this.vertical);
9027
9026
  this.steps = this.getInitValue('steps', props.steps, this.steps);
@@ -10184,7 +10183,6 @@ class TreeGridEditable extends TreeGrid {
10184
10183
  if (this.editing)
10185
10184
  return;
10186
10185
  if (column.editable) {
10187
- this.selectedRows = [];
10188
10186
  this.editing = true;
10189
10187
  this.preventRowClick = true;
10190
10188
  this.datasource.currentRow = row;
@@ -10581,6 +10579,12 @@ Icons.mdiIcons = {
10581
10579
  tableColumns: 'mdi-table-headers-eye',
10582
10580
  unfold: 'mdi-unfold-more-horizontal',
10583
10581
  warning: 'mdi-exclamation',
10582
+ zoom: 'mdi-magnify-scan',
10583
+ zoomIn: 'mdi-plus-circle-outline',
10584
+ zoomPanning: 'mdi-hand-back-right-outline',
10585
+ zoomOut: 'mdi-minus-circle-outline',
10586
+ zoomReset: 'mdi-magnify-close',
10587
+ zoomSelection: 'mdi-magnify-scan',
10584
10588
  };
10585
10589
  Icons.faIcons = {
10586
10590
  alertOctagon: 'fa fa-exclamation-circle',
@@ -10631,6 +10635,12 @@ Icons.faIcons = {
10631
10635
  tableColumns: 'fa fa-columns',
10632
10636
  unfold: 'fa fa-sort',
10633
10637
  warning: 'fa fa-exclamation',
10638
+ zoom: 'fa fa-search',
10639
+ zoomIn: 'fa fa-search-plus',
10640
+ zoomPanning: 'fa fa-hand-paper',
10641
+ zoomOut: 'fa fa-search-minus',
10642
+ zoomReset: 'fa fa-undo',
10643
+ zoomSelection: 'fa fa-expand',
10634
10644
  };
10635
10645
  Icons.icons = (() => Icons.mdiIcons)();
10636
10646
 
@@ -10907,6 +10917,16 @@ WatchURL.watchers = {};
10907
10917
  WatchURL.originalEvents = new Map();
10908
10918
 
10909
10919
  class BaseReport {
10920
+ constructor() {
10921
+ this.expressionZeedhiToXls = {
10922
+ AVG: 'AVERAGE',
10923
+ COUNT: 'COUNTA',
10924
+ MAX: 'MAX',
10925
+ MIN: 'MIN',
10926
+ SUM: 'SUM',
10927
+ };
10928
+ this.colunmXLS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
10929
+ }
10910
10930
  buildColumns(columns) {
10911
10931
  const widths = {};
10912
10932
  let totalWidth;
@@ -11138,11 +11158,256 @@ class XLSReport extends BaseReport {
11138
11158
  this.route = '/generateXLS';
11139
11159
  }
11140
11160
  buildDataset(data, columns) {
11161
+ const result = this.formatRawDataSet(data, columns);
11162
+ return JSON.stringify(result);
11163
+ }
11164
+ // formata o dataset para o formato "cru" xls
11165
+ formatRawDataSet(data, columns) {
11141
11166
  const columnNames = columns.map((col) => col.name);
11142
11167
  const result = data.reduce((reduced, row) => {
11143
11168
  const values = columnNames.map((col) => row[col] || '');
11144
11169
  return [...reduced, values];
11145
11170
  }, [columnNames]);
11171
+ return result;
11172
+ }
11173
+ buildMetadata(name, title, columns, filter) {
11174
+ const builtCols = this.buildColumns(columns);
11175
+ const builtFilters = this.buildFilter(filter || {});
11176
+ const lang = this.formatLangCode(I18n.instance.language);
11177
+ const clientLogo = '';
11178
+ const enterpriseLogo = '';
11179
+ const productLogo = '';
11180
+ const metadataObj = {
11181
+ name,
11182
+ title,
11183
+ lang,
11184
+ clientLogo,
11185
+ enterpriseLogo,
11186
+ productLogo,
11187
+ version: '1.0',
11188
+ words: {
11189
+ Page: I18n.translate('PAGE'),
11190
+ Report: I18n.translate('REPORT'),
11191
+ Version: I18n.translate('VERSION'),
11192
+ },
11193
+ staticData: {},
11194
+ groups: [],
11195
+ reportName: name,
11196
+ widgetLabel: title,
11197
+ orientation: 'PORTRAIT',
11198
+ columns: builtCols,
11199
+ filter: builtFilters,
11200
+ reportXLS: true,
11201
+ xlsMergedCell: [],
11202
+ };
11203
+ return Promise.resolve(JSON.stringify(metadataObj));
11204
+ }
11205
+ }
11206
+
11207
+ // XLS with groups
11208
+ class XLS2Report extends BaseReport {
11209
+ constructor() {
11210
+ super(...arguments);
11211
+ this.route = '/generateXLS';
11212
+ }
11213
+ buildDataset(data, metadata) {
11214
+ const result = this.formatDataSet(metadata, data);
11215
+ return JSON.stringify(result);
11216
+ }
11217
+ buildMetadata(name, title, columns, filter) {
11218
+ const builtCols = this.buildColumns(columns);
11219
+ const builtFilters = this.buildFilter(filter || {});
11220
+ const lang = this.formatLangCode(I18n.instance.language);
11221
+ const clientLogo = '';
11222
+ const enterpriseLogo = '';
11223
+ const productLogo = '';
11224
+ const metadataObj = {
11225
+ name,
11226
+ title,
11227
+ lang,
11228
+ clientLogo,
11229
+ enterpriseLogo,
11230
+ productLogo,
11231
+ version: '1.0',
11232
+ words: {
11233
+ Page: I18n.translate('PAGE'),
11234
+ Report: I18n.translate('REPORT'),
11235
+ Version: I18n.translate('VERSION'),
11236
+ },
11237
+ staticData: {},
11238
+ groups: [],
11239
+ reportName: name,
11240
+ widgetLabel: title,
11241
+ orientation: 'PORTRAIT',
11242
+ columns: builtCols,
11243
+ filter: builtFilters,
11244
+ reportXLS: true,
11245
+ xlsMergedCell: [],
11246
+ };
11247
+ return Promise.resolve(JSON.stringify(metadataObj));
11248
+ }
11249
+ // Ordenar o nome das colunas de acordo com seu index, e sempre deixando as colunas agrupadas nas primeiras posições
11250
+ getColumnsName(columns, metaData, lengthGroup) {
11251
+ const columnsNameGroup = metaData.groups.map((row) => row.field);
11252
+ let columnsName = [];
11253
+ const columnsGroupName = [];
11254
+ Object.entries(columns).forEach((row) => {
11255
+ const columnName = row[0];
11256
+ const index = row[1].sequence;
11257
+ if (columnsNameGroup.indexOf(columnName) === -1) {
11258
+ columnsName[index + lengthGroup] = columnName;
11259
+ }
11260
+ else {
11261
+ columnsGroupName.push(columnName);
11262
+ }
11263
+ });
11264
+ columnsName = columnsGroupName.concat(columnsName);
11265
+ columnsName = columnsName.filter((columnName) => typeof columnName === 'string');
11266
+ return columnsName;
11267
+ }
11268
+ // Inicializa alguns valores auxiliares
11269
+ initVars(metaData) {
11270
+ metaData.xlsMergedCell = [];
11271
+ const { columns } = metaData;
11272
+ const lengthGroup = metaData.groups.length;
11273
+ const indexLastGroup = lengthGroup - 1;
11274
+ let columnsName = [];
11275
+ columnsName = this.getColumnsName(columns, metaData, lengthGroup);
11276
+ const rowValues = [];
11277
+ const formatedDataSet = [];
11278
+ const groups = [];
11279
+ groups.groupEnd = {};
11280
+ groups.groupEnd.cellsfunc = {};
11281
+ return {
11282
+ columns, indexLastGroup, columnsName, rowValues, formatedDataSet, groups,
11283
+ };
11284
+ }
11285
+ // formata as expressões da linha
11286
+ formatRowFunc(column, columns, row, index, rowValues, funcXlsParam, groups, indexLastGroup) {
11287
+ let funcXls = funcXlsParam;
11288
+ if ((row[column] === 0 || row[column]) && index !== undefined) {
11289
+ const letter = this.colunmXLS[rowValues.length];
11290
+ funcXls = this.expressionZeedhiToXls[columns[column].expression];
11291
+ const cellsfunc = `${letter + groups[index].init}:${letter}${groups[index].end}`;
11292
+ let expression = '';
11293
+ if (indexLastGroup === index) {
11294
+ expression = `=${funcXls}(${cellsfunc})`;
11295
+ }
11296
+ else {
11297
+ expression = `=${funcXls}(${groups[index].cellsfunc[column]})`;
11298
+ if (index === 0) {
11299
+ if (groups.groupEnd.cellsfunc[column]) {
11300
+ groups.groupEnd.cellsfunc[column] += `,${groups[index].cellsfunc[column]}`;
11301
+ }
11302
+ else {
11303
+ groups.groupEnd.cellsfunc[column] = groups[index].cellsfunc[column];
11304
+ }
11305
+ }
11306
+ groups[index].cellsfunc[column] = null;
11307
+ }
11308
+ rowValues.push(expression);
11309
+ groups.forEach((group, indexGroup) => {
11310
+ if (indexGroup !== indexLastGroup) {
11311
+ if (!group.cellsfunc) {
11312
+ group.cellsfunc = {};
11313
+ }
11314
+ if (group.cellsfunc[column]) {
11315
+ group.cellsfunc[column] += `,${cellsfunc}`;
11316
+ }
11317
+ else {
11318
+ group.cellsfunc[column] = cellsfunc;
11319
+ }
11320
+ }
11321
+ });
11322
+ }
11323
+ else {
11324
+ let cell = row[column];
11325
+ if (row.groupSummary) {
11326
+ const groupEndFunc = groups.groupEnd.cellsfunc;
11327
+ if (groupEndFunc[column]) {
11328
+ funcXls = this.expressionZeedhiToXls[columns[column].expression];
11329
+ cell = `=${funcXls}(${groupEndFunc[column]})`;
11330
+ }
11331
+ }
11332
+ rowValues.push(cell);
11333
+ }
11334
+ }
11335
+ // formata a linha de grupo de acordo com o formato xls2
11336
+ setRowGroup(row, rowValues, groups, metaData, formatedDataSet, columnsName, columns, indexLastGroup) {
11337
+ const label = `${row.groupLabel}:${row.groupValue}`;
11338
+ const index = row.groupIndex;
11339
+ if (row.groupHeader) {
11340
+ rowValues[index] = label;
11341
+ groups[index] = { init: null, end: null };
11342
+ }
11343
+ else if (row.groupFooter) {
11344
+ if (!row.groupLabel) {
11345
+ rowValues.push('Total');
11346
+ }
11347
+ else {
11348
+ rowValues.push(`Total (${label})`);
11349
+ }
11350
+ const funcXls = null;
11351
+ if (groups[index]) {
11352
+ metaData.xlsMergedCell.push({
11353
+ start_row: groups[index].init,
11354
+ start_col: this.colunmXLS[index],
11355
+ end_row: formatedDataSet.length + 2,
11356
+ end_col: this.colunmXLS[index],
11357
+ });
11358
+ }
11359
+ columnsName.forEach((column, columnIndex) => {
11360
+ if (!(row.groupFooter && columnIndex === 0)) {
11361
+ this.formatRowFunc(column, columns, row, index, rowValues, funcXls, groups, indexLastGroup);
11362
+ }
11363
+ });
11364
+ }
11365
+ return rowValues;
11366
+ }
11367
+ // Defina o index dos grupos
11368
+ setIndexGroups(groups, formatedDataSet) {
11369
+ groups.forEach((group) => {
11370
+ if (!group.init) {
11371
+ group.init = formatedDataSet.length + 2;
11372
+ }
11373
+ group.end = formatedDataSet.length + 2;
11374
+ });
11375
+ }
11376
+ // Preenche uma linha "normal"
11377
+ setRowNormal(columnsName, rowValues, row) {
11378
+ columnsName.forEach((column) => {
11379
+ rowValues.push(row[column]);
11380
+ });
11381
+ }
11382
+ formatDataSet(metaData, dataSet) {
11383
+ const initVars = this.initVars(metaData);
11384
+ const { columns, indexLastGroup, columnsName, formatedDataSet, groups, } = initVars;
11385
+ let { rowValues } = initVars;
11386
+ dataSet.forEach((row) => {
11387
+ if (row.group || row.groupFooter) {
11388
+ rowValues = this.setRowGroup(row, rowValues, groups, metaData, formatedDataSet, columnsName, columns, indexLastGroup);
11389
+ }
11390
+ else {
11391
+ this.setIndexGroups(groups, formatedDataSet);
11392
+ this.setRowNormal(columnsName, rowValues, row);
11393
+ }
11394
+ if (!row.groupHeader) {
11395
+ formatedDataSet.push(rowValues);
11396
+ }
11397
+ rowValues = [];
11398
+ });
11399
+ return [columnsName].concat(formatedDataSet);
11400
+ }
11401
+ }
11402
+
11403
+ // Grid mirror (with groups)
11404
+ class XLS3Report extends BaseReport {
11405
+ constructor() {
11406
+ super(...arguments);
11407
+ this.route = '/generateXLS';
11408
+ }
11409
+ buildDataset(data, metadata) {
11410
+ const result = this.formatDataSet(metadata, data);
11146
11411
  return JSON.stringify(result);
11147
11412
  }
11148
11413
  buildMetadata(name, title, columns, filter) {
@@ -11172,9 +11437,153 @@ class XLSReport extends BaseReport {
11172
11437
  orientation: 'PORTRAIT',
11173
11438
  columns: builtCols,
11174
11439
  filter: builtFilters,
11440
+ reportXLS: true,
11441
+ xlsMergedCell: [],
11175
11442
  };
11176
11443
  return Promise.resolve(JSON.stringify(metadataObj));
11177
11444
  }
11445
+ // Ordenar o nome das colunas de acordo com seu index, excluindo o nome das colunas agrupadas
11446
+ getColumnsNameFormat3(columns, metaData) {
11447
+ const columnsNameGroup = metaData.groups.map((row) => row.field);
11448
+ let columnsName = [];
11449
+ Object.entries(columns).forEach((row) => {
11450
+ const columnName = row[0];
11451
+ if (columnsNameGroup.indexOf(columnName) === -1) {
11452
+ const index = row[1].sequence;
11453
+ columnsName[index] = columnName;
11454
+ }
11455
+ });
11456
+ columnsName = columnsName.filter((columnName) => typeof columnName === 'string');
11457
+ return columnsName;
11458
+ }
11459
+ // Inicializa alguns valores auxiliares
11460
+ initVars(metaData) {
11461
+ metaData.xlsMergedCell = [];
11462
+ const { columns } = metaData;
11463
+ const lengthGroup = metaData.groups.length;
11464
+ const indexLastGroup = lengthGroup - 1;
11465
+ let columnsName = [];
11466
+ columnsName = this.getColumnsNameFormat3(columns, metaData);
11467
+ const rowValues = [];
11468
+ const formatedDataSet = [];
11469
+ const groups = [];
11470
+ groups.groupEnd = {};
11471
+ groups.groupEnd.cellsfunc = {};
11472
+ return {
11473
+ columns, indexLastGroup, columnsName, rowValues, formatedDataSet, groups,
11474
+ };
11475
+ }
11476
+ // formata a linha do grupo de acordo com o formato xls3
11477
+ setRowGroupFormat(row, rowValuesParam, groups, formatedDataSet, columnsName, columns, indexLastGroup) {
11478
+ let rowValues = rowValuesParam;
11479
+ const label = `${row.groupLabel}:${row.groupValue}`;
11480
+ const index = row.groupIndex;
11481
+ if (row.groupHeader) {
11482
+ rowValues[index] = label;
11483
+ groups[index] = { init: null, end: null };
11484
+ formatedDataSet.push(rowValues);
11485
+ rowValues = [];
11486
+ }
11487
+ else if (row.groupFooter) {
11488
+ if (!row.groupLabel) {
11489
+ rowValues.push('Total');
11490
+ }
11491
+ else {
11492
+ rowValues.push(`Total (${label})`);
11493
+ }
11494
+ formatedDataSet.push(rowValues);
11495
+ rowValues = [];
11496
+ const funcXls = null;
11497
+ columnsName.forEach((column) => {
11498
+ this.formatRowFunc(column, columns, row, index, rowValues, funcXls, groups, indexLastGroup);
11499
+ });
11500
+ }
11501
+ return rowValues;
11502
+ }
11503
+ // formata as expressões da linha
11504
+ formatRowFunc(column, columns, row, index, rowValues, funcXlsParam, groups, indexLastGroup) {
11505
+ let funcXls = funcXlsParam;
11506
+ if ((row[column] === 0 || row[column]) && index !== undefined) {
11507
+ const letter = this.colunmXLS[rowValues.length];
11508
+ funcXls = this.expressionZeedhiToXls[columns[column].expression];
11509
+ const cellsfunc = `${letter + groups[index].init}:${letter}${groups[index].end}`;
11510
+ let expression = '';
11511
+ if (indexLastGroup === index) {
11512
+ expression = `=${funcXls}(${cellsfunc})`;
11513
+ }
11514
+ else {
11515
+ expression = `=${funcXls}(${groups[index].cellsfunc[column]})`;
11516
+ if (index === 0) {
11517
+ if (groups.groupEnd.cellsfunc[column]) {
11518
+ groups.groupEnd.cellsfunc[column] += `,${groups[index].cellsfunc[column]}`;
11519
+ }
11520
+ else {
11521
+ groups.groupEnd.cellsfunc[column] = groups[index].cellsfunc[column];
11522
+ }
11523
+ }
11524
+ groups[index].cellsfunc[column] = null;
11525
+ }
11526
+ rowValues.push(expression);
11527
+ groups.forEach((group, indexGroup) => {
11528
+ if (indexGroup !== indexLastGroup) {
11529
+ if (!group.cellsfunc) {
11530
+ group.cellsfunc = {};
11531
+ }
11532
+ if (group.cellsfunc[column]) {
11533
+ group.cellsfunc[column] += `,${cellsfunc}`;
11534
+ }
11535
+ else {
11536
+ group.cellsfunc[column] = cellsfunc;
11537
+ }
11538
+ }
11539
+ });
11540
+ }
11541
+ else {
11542
+ let cell = row[column];
11543
+ if (row.groupSummary) {
11544
+ const groupEndFunc = groups.groupEnd.cellsfunc;
11545
+ if (groupEndFunc[column]) {
11546
+ funcXls = this.expressionZeedhiToXls[columns[column].expression];
11547
+ cell = `=${funcXls}(${groupEndFunc[column]})`;
11548
+ }
11549
+ }
11550
+ rowValues.push(cell);
11551
+ }
11552
+ }
11553
+ // Defina o index dos grupos
11554
+ setIndexGroups(groups, formatedDataSet) {
11555
+ groups.forEach((group) => {
11556
+ if (!group.init) {
11557
+ group.init = formatedDataSet.length + 2;
11558
+ }
11559
+ group.end = formatedDataSet.length + 2;
11560
+ });
11561
+ }
11562
+ // Preenche uma linha "normal"
11563
+ setRowNormal(columnsName, rowValues, row) {
11564
+ columnsName.forEach((column) => {
11565
+ rowValues.push(row[column]);
11566
+ });
11567
+ }
11568
+ formatDataSet(metaData, dataSet) {
11569
+ const initVars = this.initVars(metaData);
11570
+ const { columns, indexLastGroup, columnsName, formatedDataSet, groups, } = initVars;
11571
+ let { rowValues } = initVars;
11572
+ dataSet.forEach((row) => {
11573
+ if (row.group || row.groupFooter) {
11574
+ rowValues = this.setRowGroupFormat(row, rowValues, groups, formatedDataSet, columnsName, columns, indexLastGroup);
11575
+ }
11576
+ else {
11577
+ this.setIndexGroups(groups, formatedDataSet);
11578
+ this.setRowNormal(columnsName, rowValues, row);
11579
+ }
11580
+ if (!row.groupHeader) {
11581
+ formatedDataSet.push(rowValues);
11582
+ }
11583
+ rowValues = [];
11584
+ });
11585
+ return [columnsName].concat(formatedDataSet);
11586
+ }
11178
11587
  }
11179
11588
 
11180
11589
  class Report {
@@ -11213,6 +11622,12 @@ class Report {
11213
11622
  if (type === 'xls') {
11214
11623
  return new XLSReport();
11215
11624
  }
11625
+ if (type === 'xls2') {
11626
+ return new XLS2Report();
11627
+ }
11628
+ if (type === 'xls3') {
11629
+ return new XLS3Report();
11630
+ }
11216
11631
  throw new Error(`Invalid report type: ${type}`);
11217
11632
  }
11218
11633
  getReport(type, portrait = true, rowObj) {
@@ -11226,9 +11641,18 @@ class Report {
11226
11641
  const reportType = this.getReportType(type);
11227
11642
  const { route } = reportType;
11228
11643
  const { name, columns, datasource } = this.iterable;
11644
+ const { groupedData } = Object.assign({}, this.iterable);
11229
11645
  const formattedColumns = this.removeActionColumns(columns);
11230
- const dataset = reportType.buildDataset(data, formattedColumns);
11231
11646
  const metadataObj = yield reportType.buildMetadata(name, this.title, formattedColumns, datasource.filter, portrait);
11647
+ let dataset;
11648
+ if ((reportType instanceof XLS2Report || reportType instanceof XLS3Report) && groupedData) {
11649
+ const rowMetadata = rowObj.metaData;
11650
+ const metadataObjClone = merge(rowMetadata, JSON.parse(metadataObj));
11651
+ dataset = reportType.buildDataset(groupedData, metadataObjClone);
11652
+ }
11653
+ else {
11654
+ dataset = reportType.buildDataset(data, formattedColumns);
11655
+ }
11232
11656
  const filter = '[]';
11233
11657
  let row = {};
11234
11658
  if (rowObj) {
@@ -11267,4 +11691,4 @@ class Report {
11267
11691
 
11268
11692
  const AutoNumeric = require('@zeedhi/autonumeric/dist/autoNumeric');
11269
11693
 
11270
- export { Alert, AlertService, ApexChart, AutoNumeric, Badge, Breadcrumbs, Button, ButtonGroup, CSVReport, Card, Carousel, Checkbox, CheckboxMultiple, ChildNotFoundError, Chip, CodeEditor, Col, CollapseCard, Column, Component, ComponentRender, Container, Currency, Dashboard, Date$1 as Date, DateRange, Dialog, DialogService, Divider, Dropdown, FileInput, Footer, Form, Frame, FramePage, Grid, GridColumn, GridColumnEditable, GridEditable, Header, Icon, Icons, Image, Increment, Input, Iterable, IterableColumnsButton, IterableColumnsButtonController, IterablePageComponent, IterablePageInfo, IterablePageSize, IterablePagination, List, ListGroup, ListItem, Loading, LoadingService, Login, LoginButton, MasterDetail, Menu, MenuButton, MenuGroup, MenuLink, MenuSeparator, Modal, ModalCloseButton, ModalService, Month, Number$1 as Number, PDFReport, Password, Progress, Radio, RangeSlider, Report, Row, Search, Select, SelectMultiple, SelectTree, SelectTreeMultiple, SpeedDial, Steppers, SvgMap, Switch, Tab, Table, Tabs, Tag, Text, TextInput, Textarea, Time, Toggleable, Tooltip, Tree, TreeDataStructure, TreeGrid, TreeGridEditable, WatchURL, XLSReport, initTheme };
11694
+ export { Alert, AlertService, ApexChart, AutoNumeric, Badge, Breadcrumbs, Button, ButtonGroup, CSVReport, Card, Carousel, Checkbox, CheckboxMultiple, ChildNotFoundError, Chip, CodeEditor, Col, CollapseCard, Column, Component, ComponentRender, Container, Currency, Dashboard, Date$1 as Date, DateRange, Dialog, DialogService, Divider, Dropdown, FileInput, Footer, Form, Frame, FramePage, Grid, GridColumn, GridColumnEditable, GridEditable, Header, Icon, Icons, Image, Increment, Input, Iterable, IterableColumnsButton, IterableColumnsButtonController, IterablePageComponent, IterablePageInfo, IterablePageSize, IterablePagination, List, ListGroup, ListItem, Loading, LoadingService, Login, LoginButton, MasterDetail, Menu, MenuButton, MenuGroup, MenuLink, MenuSeparator, Modal, ModalCloseButton, ModalService, Month, Number$1 as Number, PDFReport, Password, Progress, Radio, RangeSlider, Report, Row, Search, Select, SelectMultiple, SelectTree, SelectTreeMultiple, SpeedDial, Steppers, SvgMap, Switch, Tab, Table, Tabs, Tag, Text, TextInput, Textarea, Time, Toggleable, Tooltip, Tree, TreeDataStructure, TreeGrid, TreeGridEditable, WatchURL, XLS2Report, XLS3Report, XLSReport, initTheme };