@zeedhi/common 1.39.0 → 1.42.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 (53) hide show
  1. package/dist/style.css +1 -1
  2. package/dist/zd-common.esm.js +460 -247
  3. package/dist/zd-common.umd.js +466 -250
  4. package/package.json +2 -2
  5. package/types/components/index.d.ts +2 -0
  6. package/types/components/zd-alert/alert.d.ts +2 -0
  7. package/types/components/zd-apex-chart/apex-chart.d.ts +11 -0
  8. package/types/components/zd-breadcrumbs/breadcrumbs.d.ts +0 -8
  9. package/types/components/zd-button/button.d.ts +0 -8
  10. package/types/components/zd-button/interfaces.d.ts +0 -2
  11. package/types/components/zd-button-group/button-group.d.ts +0 -8
  12. package/types/components/zd-button-group/interfaces.d.ts +0 -2
  13. package/types/components/zd-card/card.d.ts +0 -8
  14. package/types/components/zd-card/interfaces.d.ts +0 -2
  15. package/types/components/zd-carousel/carousel.d.ts +0 -8
  16. package/types/components/zd-carousel/interfaces.d.ts +0 -2
  17. package/types/components/zd-component/component.d.ts +8 -0
  18. package/types/components/zd-component/interfaces.d.ts +2 -0
  19. package/types/components/zd-date/date-range.d.ts +1 -5
  20. package/types/components/zd-divider/divider.d.ts +0 -8
  21. package/types/components/zd-divider/interfaces.d.ts +0 -2
  22. package/types/components/zd-footer/footer.d.ts +0 -8
  23. package/types/components/zd-footer/interfaces.d.ts +0 -2
  24. package/types/components/zd-form/form.d.ts +10 -1
  25. package/types/components/zd-frame/frame.d.ts +1 -0
  26. package/types/components/zd-grid/grid-column.d.ts +2 -0
  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-tree/interfaces.d.ts +1 -0
  42. package/types/components/zd-select-tree/select-tree.d.ts +6 -0
  43. package/types/components/zd-selectable-list/interfaces.d.ts +8 -0
  44. package/types/components/zd-selectable-list/selectable-list.d.ts +29 -0
  45. package/types/components/zd-steppers/interfaces.d.ts +0 -2
  46. package/types/components/zd-steppers/steppers.d.ts +0 -8
  47. package/types/components/zd-tabs/tabs.d.ts +10 -0
  48. package/types/utils/report/index.d.ts +2 -0
  49. package/types/utils/report/report-type/base-report.d.ts +3 -1
  50. package/types/utils/report/report-type/interfaces.d.ts +2 -1
  51. package/types/utils/report/report-type/xls-report.d.ts +1 -16
  52. package/types/utils/report/report-type/xls2-report.d.ts +16 -0
  53. package/types/utils/report/report-type/xls3-report.d.ts +16 -0
@@ -1,14 +1,14 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@zeedhi/core'), require('lodash.debounce'), require('lodash.isundefined'), require('lodash.merge'), require('lodash.set')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@zeedhi/core', 'lodash.debounce', 'lodash.isundefined', 'lodash.merge', 'lodash.set'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@zeedhi/common"] = {}, global.core, global.debounce, global.isUndefined, global.merge, global.set));
5
- })(this, (function (exports, core, debounce, isUndefined, merge, set) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@zeedhi/core'), require('lodash.merge'), require('lodash.debounce'), require('lodash.isundefined'), require('lodash.set')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', '@zeedhi/core', 'lodash.merge', 'lodash.debounce', 'lodash.isundefined', 'lodash.set'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@zeedhi/common"] = {}, global.core, global.merge, global.debounce, global.isUndefined, global.set));
5
+ })(this, (function (exports, core, merge, debounce, isUndefined, set) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
9
+ var merge__default = /*#__PURE__*/_interopDefaultLegacy(merge);
9
10
  var debounce__default = /*#__PURE__*/_interopDefaultLegacy(debounce);
10
11
  var isUndefined__default = /*#__PURE__*/_interopDefaultLegacy(isUndefined);
11
- var merge__default = /*#__PURE__*/_interopDefaultLegacy(merge);
12
12
  var set__default = /*#__PURE__*/_interopDefaultLegacy(set);
13
13
 
14
14
  /**
@@ -55,6 +55,14 @@
55
55
  * Controls component visibility.
56
56
  */
57
57
  this.isVisible = true;
58
+ /**
59
+ * Applies the dark theme variant to the component.
60
+ */
61
+ this.dark = false;
62
+ /**
63
+ * Applies the light theme variant to the component.
64
+ */
65
+ this.light = false;
58
66
  /**
59
67
  * Define component key mapping
60
68
  */
@@ -70,6 +78,8 @@
70
78
  this.cssClass = this.getInitValue('cssClass', props.cssClass, this.cssClass);
71
79
  this.cssStyle = this.getInitValue('cssStyle', props.cssStyle, this.cssStyle);
72
80
  this.isVisible = this.getInitValue('isVisible', props.isVisible, this.isVisible);
81
+ this.dark = this.getInitValue('dark', props.dark, this.dark);
82
+ this.light = this.getInitValue('light', props.light, this.light);
73
83
  this.children = Array.isArray(props.children) ? props.children : this.children;
74
84
  this.keyMap = core.KeyMap.factory(props.keyMap || this.keyMap);
75
85
  this.createAccessors();
@@ -305,6 +315,8 @@
305
315
  this.vertical = false;
306
316
  this.defaultValues = {
307
317
  name: this.name,
318
+ dark: this.dark,
319
+ light: this.light,
308
320
  color: this.color,
309
321
  text: this.text,
310
322
  timeout: this.timeout,
@@ -329,6 +341,8 @@
329
341
  assignAlertProperties(alert) {
330
342
  this.name = this.getInitValue('name', alert.name, this.defaultValues.name);
331
343
  this.color = this.getInitValue('color', alert.color, this.defaultValues.color);
344
+ this.dark = this.getInitValue('dark', alert.dark, this.defaultValues.dark);
345
+ this.light = this.getInitValue('light', alert.light, this.defaultValues.light);
332
346
  this.text = this.getInitValue('text', alert.text, this.defaultValues.text);
333
347
  this.timeout = this.getInitValue('timeout', alert.timeout, this.defaultValues.timeout);
334
348
  this.type = this.getInitValue('type', alert.type, this.defaultValues.type);
@@ -417,8 +431,23 @@
417
431
  * Defines the load progress color
418
432
  */
419
433
  this.loadColor = 'primary';
434
+ this.defaultOptions = {
435
+ chart: {
436
+ toolbar: {
437
+ tools: {
438
+ download: 'fileDownload',
439
+ selection: 'zoomSelection',
440
+ zoom: 'zoom',
441
+ zoomin: 'zoomIn',
442
+ zoomout: 'zoomOut',
443
+ pan: 'zoomPanning',
444
+ reset: 'zoomReset',
445
+ },
446
+ },
447
+ },
448
+ };
420
449
  this.chartType = this.getInitValue('chartType', props.chartType, this.chartType);
421
- this.options = this.getInitValue('options', props.options, this.options);
450
+ this.options = merge__default["default"](this.defaultOptions, this.getInitValue('options', props.options, this.options));
422
451
  this.series = this.getInitValue('series', props.series, this.series);
423
452
  this.height = this.getInitValue('height', props.height, this.height);
424
453
  this.width = this.getInitValue('width', props.width, this.width);
@@ -435,6 +464,14 @@
435
464
  setViewUpdate(viewUpdate) {
436
465
  this.viewUpdate = viewUpdate;
437
466
  }
467
+ /**
468
+ * Sets view get icon HTML method.
469
+ * @param viewGetIconHTML Update method
470
+ */
471
+ setViewGetIconHTML(viewGetIconHTML) {
472
+ this.viewGetIconHTML = viewGetIconHTML;
473
+ this.updateToolbarIcons();
474
+ }
438
475
  /**
439
476
  * Update the chart
440
477
  * @param options New options
@@ -449,6 +486,32 @@
449
486
  }
450
487
  return Promise.resolve();
451
488
  }
489
+ updateToolbarIcons() {
490
+ var _a, _b, _c;
491
+ if (!this.viewGetIconHTML)
492
+ return this.options;
493
+ const getIconFn = this.viewGetIconHTML;
494
+ let changed = false;
495
+ const newOptions = Object.assign({}, this.options);
496
+ if ((_b = (_a = newOptions.chart) === null || _a === void 0 ? void 0 : _a.toolbar) === null || _b === void 0 ? void 0 : _b.tools) {
497
+ const { tools } = newOptions.chart.toolbar;
498
+ Object.keys(tools).forEach((key) => {
499
+ if (typeof tools[key] === 'string') {
500
+ tools[key] = getIconFn(tools[key]);
501
+ changed = true;
502
+ }
503
+ });
504
+ if ((_c = tools.customIcons) === null || _c === void 0 ? void 0 : _c.length) {
505
+ tools.customIcons.forEach((item) => {
506
+ item.icon = getIconFn(item.icon);
507
+ });
508
+ }
509
+ }
510
+ if (this.viewUpdate && changed) {
511
+ this.viewUpdate(newOptions);
512
+ }
513
+ return newOptions;
514
+ }
452
515
  }
453
516
 
454
517
  /**
@@ -499,10 +562,6 @@
499
562
  */
500
563
  constructor(props) {
501
564
  super(props);
502
- /**
503
- * Applies the dark theme variant to the component.
504
- */
505
- this.dark = false;
506
565
  /**
507
566
  * Specifies the dividing string between items.
508
567
  */
@@ -519,19 +578,13 @@
519
578
  * Increase the font-size of the breadcrumb item text to 16px.
520
579
  */
521
580
  this.large = false;
522
- /**
523
- * Applies the light theme variant to the component.
524
- */
525
- this.light = true;
526
581
  /**
527
582
  * Decrease the font-size of the breadcrumb item text to 12px.
528
583
  */
529
584
  this.small = false;
530
- this.dark = this.getInitValue('dark', props.dark, this.dark);
531
585
  this.divider = this.getInitValue('divider', props.divider, this.divider);
532
586
  this.items = this.getInitValue('items', props.items, this.items);
533
587
  this.large = this.getInitValue('large', props.large, this.large);
534
- this.light = this.getInitValue('light', props.light, this.light);
535
588
  this.iconName = this.getInitValue('iconName', props.iconName, this.iconName);
536
589
  this.small = this.getInitValue('small', props.small, this.small);
537
590
  this.createAccessors();
@@ -567,10 +620,6 @@
567
620
  * It can be the name of material or css color in hexa
568
621
  */
569
622
  this.color = 'primary';
570
- /**
571
- * Applies the dark theme variant to the button
572
- */
573
- this.dark = false;
574
623
  /**
575
624
  * Removes the ability to click or target the button
576
625
  */
@@ -612,10 +661,6 @@
612
661
  * This should be used with the absolute or fixed props
613
662
  */
614
663
  this.left = false;
615
- /**
616
- * Applies the light theme variant to the button
617
- */
618
- this.light = false;
619
664
  /**
620
665
  * Makes the background transparent and applies a thin border
621
666
  */
@@ -718,10 +763,6 @@
718
763
  * It can be the name of material or css color in hexa
719
764
  */
720
765
  this.color = 'primary';
721
- /**
722
- * Applies the dark theme variant to the component.
723
- */
724
- this.dark = false;
725
766
  /**
726
767
  * Reduces the button size and padding.
727
768
  */
@@ -731,10 +772,6 @@
731
772
  * space between the buttons
732
773
  */
733
774
  this.group = false;
734
- /**
735
- * Applies the light theme variant to the component.
736
- */
737
- this.light = false;
738
775
  /**
739
776
  * Applies mandatory selected button
740
777
  */
@@ -768,10 +805,8 @@
768
805
  this.backgroundColor = this.getInitValue('backgroundColor', props.backgroundColor, this.backgroundColor);
769
806
  this.borderless = this.getInitValue('block', props.borderless, this.borderless);
770
807
  this.color = this.getInitValue('color', props.color, this.color);
771
- this.dark = this.getInitValue('dark', props.dark, this.dark);
772
808
  this.dense = this.getInitValue('disabled', props.dense, this.dense);
773
809
  this.group = this.getInitValue('group', props.group, this.group);
774
- this.light = this.getInitValue('light', props.light, this.light);
775
810
  this.mandatory = this.getInitValue('mandatory', props.mandatory, this.mandatory);
776
811
  this.multiple = this.getInitValue('multiple', props.multiple, this.multiple);
777
812
  this.rounded = this.getInitValue('rounded', props.rounded, this.rounded);
@@ -825,10 +860,6 @@
825
860
  * a non-integer number in slidesPerView, like 1.5)
826
861
  */
827
862
  this.center = false;
828
- /**
829
- * Applies the dark theme variant to the carousel pagination
830
- */
831
- this.dark = false;
832
863
  /**
833
864
  * Displays the pagination as a fraction in the following format: currentSlide/slidesCount.
834
865
  * Only works when <code>showPagination</code> property is true
@@ -855,10 +886,6 @@
855
886
  * Allows controlling the carousel using the keyboard arrow keys
856
887
  */
857
888
  this.keysControl = true;
858
- /**
859
- * Applies the light theme variant to the carousel
860
- */
861
- this.light = true;
862
889
  /**
863
890
  * Allows controlling the carousel using mouse drag
864
891
  */
@@ -933,14 +960,12 @@
933
960
  this.autoPlay = this.getInitValue('autoPlay', props.autoPlay, this.autoPlay);
934
961
  this.buttonsOutside = this.getInitValue('buttonsOutside', props.buttonsOutside, this.buttonsOutside);
935
962
  this.center = this.getInitValue('center', props.center, this.center);
936
- this.dark = this.getInitValue('dark', props.dark, this.dark);
937
963
  this.height = this.getInitValue('height', props.height, this.height);
938
964
  this.infiniteScroll = this.getInitValue('infiniteScroll', props.infiniteScroll, this.infiniteScroll);
939
965
  this.initialSlide = this.getInitValue('initialSlide', props.initialSlide, this.initialSlide);
940
966
  this.currentSlide = this.getInitValue('currentSlide', props.currentSlide, this.initialSlide);
941
967
  this.interval = this.getInitValue('interval', props.interval, this.interval);
942
968
  this.keysControl = this.getInitValue('keysControl', props.keysControl, this.keysControl);
943
- this.light = this.getInitValue('light', props.light, this.light);
944
969
  this.mouseControl = this.getInitValue('mouseControl', props.mouseControl, this.mouseControl);
945
970
  this.nextButton = props.nextButton || this.nextButton;
946
971
  this.fractionPagination = this.getInitValue('fractionPagination', props.fractionPagination, this.fractionPagination);
@@ -1055,10 +1080,6 @@
1055
1080
  * Applies specified color to the control. It can be the name of material color
1056
1081
  */
1057
1082
  this.color = '';
1058
- /**
1059
- * Applies the dark theme variant to the component
1060
- */
1061
- this.dark = false;
1062
1083
  /**
1063
1084
  * Removes the ability to click or target the component
1064
1085
  */
@@ -1075,10 +1096,6 @@
1075
1096
  * Specifies an image background for the card
1076
1097
  */
1077
1098
  this.img = '';
1078
- /**
1079
- * Applies the light theme variant to the component
1080
- */
1081
- this.light = false;
1082
1099
  /**
1083
1100
  * Designates that the card is a link
1084
1101
  */
@@ -1102,7 +1119,6 @@
1102
1119
  this.activeClass = this.getInitValue('activeClass', props.activeClass, this.activeClass);
1103
1120
  this.append = this.getInitValue('append', props.append, this.append);
1104
1121
  this.color = this.getInitValue('color', props.color, this.color);
1105
- this.dark = this.getInitValue('dark', props.dark, this.dark);
1106
1122
  this.disabled = this.getInitValue('disabled', props.disabled, this.disabled);
1107
1123
  this.elevation = this.getInitValue('elevation', props.elevation, this.elevation);
1108
1124
  this.flat = this.getInitValue('flat', props.flat, this.flat);
@@ -1110,7 +1126,6 @@
1110
1126
  this.hover = this.getInitValue('hover', props.hover, this.hover);
1111
1127
  this.href = this.getInitValue('href', props.href, this.href);
1112
1128
  this.img = this.getInitValue('img', props.img, this.img);
1113
- this.light = this.getInitValue('light', props.light, this.light);
1114
1129
  this.link = this.getInitValue('link', props.link, this.link);
1115
1130
  this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
1116
1131
  this.maxWidth = this.getInitValue('maxWidth', props.maxWidth, this.maxWidth);
@@ -1323,10 +1338,6 @@
1323
1338
  * It can be the name of material or css color in hexa.
1324
1339
  */
1325
1340
  this.color = 'primary';
1326
- /**
1327
- * Applies the dark theme variant to the input.
1328
- */
1329
- this.dark = false;
1330
1341
  /**
1331
1342
  * Defines smaller input.
1332
1343
  */
@@ -1343,10 +1354,6 @@
1343
1354
  * Defines the input label.
1344
1355
  */
1345
1356
  this.label = '';
1346
- /**
1347
- * Applies the light theme variant to the input.
1348
- */
1349
- this.light = false;
1350
1357
  /**
1351
1358
  * Applies a custom character mask to the input.
1352
1359
  */
@@ -1415,13 +1422,11 @@
1415
1422
  this.autofocus = this.getInitValue('autofocus', props.autofocus, this.autofocus);
1416
1423
  this.clearable = this.getInitValue('clearable', props.clearable, this.clearable);
1417
1424
  this.color = this.getInitValue('color', props.color, this.color);
1418
- this.dark = this.getInitValue('dark', props.dark, this.dark);
1419
1425
  this.dense = this.getInitValue('dense', props.dense, this.dense);
1420
1426
  this.disabled = this.getInitValue('disabled', props.disabled, this.disabled);
1421
1427
  this.hint = this.getInitValue('hint', props.hint, this.hint);
1422
1428
  this.autoHintDetails = this.getInitValue('autoHintDetails', props.autoHintDetails, this.autoHintDetails);
1423
1429
  this.label = this.getInitValue('label', props.label, this.label);
1424
- this.light = this.getInitValue('light', props.light, this.light);
1425
1430
  this.mask = this.getInitValue('mask', props.mask, this.mask);
1426
1431
  this.maxLength = this.getInitValue('maxLength', props.maxLength, this.maxLength);
1427
1432
  this.persistentHint = this.getInitValue('persistentHint', props.persistentHint, this.persistentHint);
@@ -3329,10 +3334,6 @@
3329
3334
  * Sets the locale. Accepts a string with a BCP 47 language tag.
3330
3335
  */
3331
3336
  this.locale = core.I18n.instance.language;
3332
- /**
3333
- * Defines if dates should be ordered
3334
- */
3335
- this.orderedDates = false;
3336
3337
  /**
3337
3338
  * Allows changing displayed month with mouse scroll
3338
3339
  */
@@ -3356,15 +3357,12 @@
3356
3357
  this.appendIcon = this.getInitValue('appendIcon', props.appendIcon, 'calendar');
3357
3358
  this.autocomplete = this.getInitValue('autocomplete', props.autocomplete, this.autocomplete);
3358
3359
  this.dateFormat = this.getInitValue('dateFormat', props.dateFormat, this.dateFormat);
3359
- this.orderedDates = this.getInitValue('orderedDates', props.orderedDates, this.orderedDates);
3360
3360
  this.dateValidation = this.dateValidation.bind(this);
3361
- this.dateValidateOrder = this.dateValidateOrder.bind(this);
3362
3361
  this.displayFormat = this.getInitValue('displayFormat', props.displayFormat, this.displayFormat);
3363
3362
  this.inputFormat = this.getInitValue('inputFormat', props.inputFormat, this.inputFormat);
3364
3363
  this.firstDayOfWeek = this.getInitValue('firstDayOfWeek', props.firstDayOfWeek, this.firstDayOfWeek);
3365
3364
  this.fullWidth = this.getInitValue('fullWidth', props.fullWidth, this.fullWidth);
3366
3365
  this.locale = this.getInitValue('locale', props.locale, this.locale);
3367
- this.rules.push(this.dateValidation, this.dateValidateOrder);
3368
3366
  this.scrollable = this.getInitValue('scrollable', props.scrollable, this.scrollable);
3369
3367
  this.showDatePicker = this.getInitValue('showDatePicker', props.showDatePicker, this.showDatePicker);
3370
3368
  this.showWeek = this.getInitValue('showWeek', props.showWeek, this.showWeek);
@@ -3481,13 +3479,13 @@
3481
3479
  splitedValue = dates;
3482
3480
  else
3483
3481
  splitedValue = this.splitValues(dates);
3484
- const formatedValue = [];
3482
+ const formattedValue = [];
3485
3483
  splitedValue.forEach((value) => {
3486
3484
  if (value && this.isValidDate(value, this.dateFormat)) {
3487
- formatedValue.push(core.dayjs(value, this.dateFormat, true).format(this.isoFormat));
3485
+ formattedValue.push(core.dayjs(value, this.dateFormat, true).format(this.isoFormat));
3488
3486
  }
3489
3487
  });
3490
- return formatedValue;
3488
+ return formattedValue;
3491
3489
  }
3492
3490
  parseISODateRangeValue(values) {
3493
3491
  const parsedValue = [];
@@ -3498,19 +3496,14 @@
3498
3496
  }
3499
3497
  });
3500
3498
  }
3501
- return parsedValue;
3499
+ return this.sortDates(parsedValue);
3500
+ }
3501
+ sortDates(parsedValue) {
3502
+ return parsedValue.sort((a, b) => (core.dayjs(a, this.dateFormat).isAfter(core.dayjs(b, this.dateFormat)) ? 1 : -1));
3502
3503
  }
3503
3504
  dateValidation() {
3504
3505
  return !this.dateError || core.I18n.translate('VALIDATION_INVALID_DATE');
3505
3506
  }
3506
- dateValidateOrder() {
3507
- if (this.value && (this.value.length === 2 && this.orderedDates)) {
3508
- const date1 = core.dayjs(this.value[0], this.dateFormat);
3509
- const date2 = core.dayjs(this.value[1], this.dateFormat);
3510
- return (date1.isBefore(date2) || date1.isSame(date2)) || core.I18n.translate('VALIDATION_INVALID_ORDER_DATE');
3511
- }
3512
- return true;
3513
- }
3514
3507
  click(event, element) {
3515
3508
  super.click(event, element);
3516
3509
  if (!event.defaultPrevented) {
@@ -3518,6 +3511,7 @@
3518
3511
  }
3519
3512
  }
3520
3513
  blur(event, element) {
3514
+ this.value = this.sortDates(this.value);
3521
3515
  this.removeDateMask();
3522
3516
  this.setDateValue(this.displayValue);
3523
3517
  super.blur(event, element);
@@ -3679,18 +3673,10 @@
3679
3673
  */
3680
3674
  constructor(props) {
3681
3675
  super(props);
3682
- /**
3683
- * Applies the dark theme variant to the component.
3684
- */
3685
- this.dark = false;
3686
3676
  /**
3687
3677
  * Adds indentation (72px) for normal dividers, reduces max height for vertical.
3688
3678
  */
3689
3679
  this.inset = false;
3690
- /**
3691
- * Applies the light theme variant to the component.
3692
- */
3693
- this.light = false;
3694
3680
  /**
3695
3681
  * Displays dividers vertically.
3696
3682
  */
@@ -3960,10 +3946,6 @@
3960
3946
  * Applies specified color to the control. It can be the name of material or css color in hexa.
3961
3947
  */
3962
3948
  this.color = 'primary';
3963
- /**
3964
- * Applies the dark theme variant to footer.
3965
- */
3966
- this.dark = false;
3967
3949
  /**
3968
3950
  * Applies position fixed to footer.
3969
3951
  */
@@ -3980,10 +3962,6 @@
3980
3962
  * Render components on the left of footer.
3981
3963
  */
3982
3964
  this.leftSlot = [];
3983
- /**
3984
- * Applies the light theme variant to the footer.
3985
- */
3986
- this.light = false;
3987
3965
  /**
3988
3966
  * Remove all padding from the footer.
3989
3967
  */
@@ -4062,6 +4040,12 @@
4062
4040
  }
4063
4041
  });
4064
4042
  }
4043
+ reload() {
4044
+ return __awaiter(this, void 0, void 0, function* () {
4045
+ this.loading = true;
4046
+ this.getMetadata();
4047
+ });
4048
+ }
4065
4049
  notFoundError() { }
4066
4050
  requestPage() {
4067
4051
  return __awaiter(this, void 0, void 0, function* () {
@@ -4320,10 +4304,10 @@
4320
4304
  * Apply conditions
4321
4305
  * @param row Datasource row
4322
4306
  */
4323
- applyCondition(row) {
4307
+ applyCondition(row, factoredConditions = this.factoredConditions) {
4324
4308
  const appliedConditions = {};
4325
- Object.keys(this.factoredConditions).forEach((condition) => {
4326
- const conditionFunction = this.factoredConditions[condition];
4309
+ Object.keys(factoredConditions).forEach((condition) => {
4310
+ const conditionFunction = factoredConditions[condition];
4327
4311
  set__default["default"](appliedConditions, condition, conditionFunction({ row, column: this }));
4328
4312
  });
4329
4313
  return appliedConditions;
@@ -4338,11 +4322,7 @@
4338
4322
  const appliedConditions = {};
4339
4323
  Object.keys(this.actionFactoredConditions).forEach((action) => {
4340
4324
  const factoredConditions = this.actionFactoredConditions[action];
4341
- appliedConditions[action] = {};
4342
- Object.keys(factoredConditions).forEach((condition) => {
4343
- const conditionFunction = factoredConditions[condition];
4344
- set__default["default"](appliedConditions[action], condition, conditionFunction({ row }));
4345
- });
4325
+ appliedConditions[action] = Object.assign({}, this.applyCondition(row, factoredConditions));
4346
4326
  });
4347
4327
  return appliedConditions;
4348
4328
  }
@@ -4720,7 +4700,11 @@
4720
4700
  /**
4721
4701
  * Color of the header background
4722
4702
  */
4723
- this.headerBackground = 'white';
4703
+ this.headerBackground = '';
4704
+ /**
4705
+ * Color of the header cell text color
4706
+ */
4707
+ this.headerCellTextColor = '';
4724
4708
  /**
4725
4709
  * Available order types
4726
4710
  * @public
@@ -4764,6 +4748,8 @@
4764
4748
  },
4765
4749
  };
4766
4750
  this.dense = this.getInitValue('dense', props.dense, this.dense);
4751
+ this.dark = this.getInitValue('dark', props.dark, this.dark);
4752
+ this.light = this.getInitValue('light', props.light, this.light);
4767
4753
  this.selectable = this.getInitValue('selectable', props.selectable, this.selectable);
4768
4754
  this.height = this.getInitValue('height', props.height, this.height);
4769
4755
  this.fillHeight = this.getInitValue('fillHeight', props.fillHeight, this.fillHeight);
@@ -4773,6 +4759,7 @@
4773
4759
  this.showFooter = this.getInitValue('showFooter', props.showFooter, this.showFooter);
4774
4760
  this.showHeader = this.getInitValue('showHeader', props.showHeader, this.showHeader);
4775
4761
  this.headerBackground = this.getInitValue('headerBackground', props.headerBackground, this.headerBackground);
4762
+ this.headerCellTextColor = this.getInitValue('headerCellTextColor', props.headerCellTextColor, this.headerCellTextColor);
4776
4763
  this.dragColumns = this.getInitValue('dragColumns', props.dragColumns, this.dragColumns);
4777
4764
  this.resizeColumns = this.getInitValue('resizeColumns', props.resizeColumns, this.resizeColumns);
4778
4765
  this.toolbarSlot = props.toolbarSlot || this.toolbarSlot;
@@ -4941,6 +4928,7 @@
4941
4928
  var _a, _b, _c;
4942
4929
  const rowKey = row[this.datasource.uniqueKey];
4943
4930
  const compName = actionComponent.name;
4931
+ const instanceName = `${compName}_${rowKey}`;
4944
4932
  const path = parentPath ? `${parentPath}.${compName}` : compName;
4945
4933
  const newComponent = merge__default["default"]({}, actionComponent, (_b = (_a = this.actionsApplied[rowKey]) === null || _a === void 0 ? void 0 : _a[column.name]) === null || _b === void 0 ? void 0 : _b[path]);
4946
4934
  let compEvents = {};
@@ -4955,7 +4943,16 @@
4955
4943
  }
4956
4944
  } });
4957
4945
  const newChildren = (_c = newComponent.children) === null || _c === void 0 ? void 0 : _c.map((child) => this.getActionComponent(child, column, row, path));
4958
- return Object.assign(Object.assign({}, newComponent), { events: newEvents, name: `${compName}_${rowKey}`, children: newChildren });
4946
+ newComponent.name = instanceName;
4947
+ newComponent.children = newChildren;
4948
+ newComponent.events = newEvents;
4949
+ try {
4950
+ core.Metadata.updateInstance(instanceName, newComponent);
4951
+ }
4952
+ catch (e) {
4953
+ // do nothing
4954
+ }
4955
+ return newComponent;
4959
4956
  }
4960
4957
  changeDefaultSlotNames(slot) {
4961
4958
  slot.forEach((item) => {
@@ -5431,10 +5428,6 @@
5431
5428
  * Applies specified color to the control. It can be the name of material or css color in hexa.
5432
5429
  */
5433
5430
  this.color = 'primary';
5434
- /**
5435
- * Applies the dark theme variant to header.
5436
- */
5437
- this.dark = false;
5438
5431
  /**
5439
5432
  * Designates that the application menu positioned on the left is below the header.
5440
5433
  */
@@ -5459,10 +5452,6 @@
5459
5452
  * Render components on the left of header.
5460
5453
  */
5461
5454
  this.leftSlot = [];
5462
- /**
5463
- * Applies the light theme variant to the header.
5464
- */
5465
- this.light = false;
5466
5455
  /**
5467
5456
  * Removes internal padding from header.
5468
5457
  */
@@ -5477,13 +5466,11 @@
5477
5466
  this.clippedLeft = this.getInitValue('clippedLeft', props.clippedLeft, this.clippedLeft);
5478
5467
  this.clippedRight = this.getInitValue('clippedRight', props.clippedRight, this.clippedRight);
5479
5468
  this.color = this.getInitValue('color', props.color, this.color);
5480
- this.dark = this.getInitValue('dark', props.dark, this.dark);
5481
5469
  this.dense = this.getInitValue('dense', props.dense, this.dense);
5482
5470
  this.elevation = this.getInitValue('elevation', props.elevation, this.elevation);
5483
5471
  this.fixed = this.getInitValue('fixed', props.fixed, this.fixed);
5484
5472
  this.height = this.getInitValue('height', props.height, this.height);
5485
5473
  this.leftSlot = props.leftSlot || this.leftSlot;
5486
- this.light = this.getInitValue('light', props.light, this.light);
5487
5474
  this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
5488
5475
  this.maxWidth = this.getInitValue('maxWidth', props.maxWidth, this.maxWidth);
5489
5476
  this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
@@ -5517,10 +5504,6 @@
5517
5504
  * (for example success or purple) or css color (#033 or rgba(255, 0, 0, 0.5)).
5518
5505
  */
5519
5506
  this.color = '';
5520
- /**
5521
- * Applies the dark theme variant to the component.
5522
- */
5523
- this.dark = false;
5524
5507
  /**
5525
5508
  * Makes icon smaller (20px)
5526
5509
  */
@@ -5542,10 +5525,6 @@
5542
5525
  * of a button when placed to the left of another element or text
5543
5526
  */
5544
5527
  this.left = false;
5545
- /**
5546
- * Applies the light theme variant to the component.
5547
- */
5548
- this.light = false;
5549
5528
  /**
5550
5529
  * Applies appropriate margins to the icon inside of
5551
5530
  * a button when placed to the right of another element or text
@@ -5564,13 +5543,11 @@
5564
5543
  */
5565
5544
  this.tag = 'i';
5566
5545
  this.color = this.getInitValue('color', props.color, this.color);
5567
- this.dark = this.getInitValue('dark', props.dark, this.dark);
5568
5546
  this.dense = this.getInitValue('dense', props.dense, this.dense);
5569
5547
  this.disabled = this.getInitValue('disabled', props.disabled, this.disabled);
5570
5548
  this.iconName = this.getInitValue('iconName', props.iconName, this.iconName);
5571
5549
  this.large = this.getInitValue('large', props.large, this.large);
5572
5550
  this.left = this.getInitValue('left', props.left, this.left);
5573
- this.light = this.getInitValue('light', props.light, this.light);
5574
5551
  this.right = this.getInitValue('right', props.right, this.right);
5575
5552
  this.size = this.getInitValue('size', props.size, this.size);
5576
5553
  this.small = this.getInitValue('small', props.small, this.small);
@@ -5993,11 +5970,12 @@
5993
5970
  overrideGet() {
5994
5971
  const oldGet = this.datasource.get;
5995
5972
  this.datasource.get = () => __awaiter(this, void 0, void 0, function* () {
5996
- yield oldGet.call(this.datasource);
5997
- if (this.indexOf(this.value) !== -1 || this.datasource.search || this.isFocused)
5998
- return;
5999
- yield this.setValue(this.value, false);
6000
- this.removePushedValue();
5973
+ const response = yield oldGet.call(this.datasource);
5974
+ if (this.indexOf(this.value) === -1 && !this.datasource.search && !this.isFocused) {
5975
+ yield this.setValue(this.value, false);
5976
+ this.removePushedValue();
5977
+ }
5978
+ return response;
6001
5979
  });
6002
5980
  }
6003
5981
  get search() {
@@ -6554,10 +6532,6 @@
6554
6532
  class List extends ComponentRender {
6555
6533
  constructor(props) {
6556
6534
  super(props);
6557
- /**
6558
- * Applies the dark theme variant to the List.
6559
- */
6560
- this.dark = false;
6561
6535
  /**
6562
6536
  * Create the list with smaller items.
6563
6537
  */
@@ -6570,10 +6544,6 @@
6570
6544
  * Render list with dividers between the items.
6571
6545
  */
6572
6546
  this.divided = false;
6573
- /**
6574
- * Applies the light theme variant to the List.
6575
- */
6576
- this.light = false;
6577
6547
  /**
6578
6548
  * Increases the height of all the list items to better support three lines of text.
6579
6549
  */
@@ -6718,10 +6688,6 @@
6718
6688
  * It can be the name of material or css color in hexa.
6719
6689
  */
6720
6690
  this.color = '';
6721
- /**
6722
- * Applies the dark theme.
6723
- */
6724
- this.dark = false;
6725
6691
  /**
6726
6692
  * Card position orientation.
6727
6693
  */
@@ -6750,7 +6716,6 @@
6750
6716
  this.bottomLink = props.bottomLink || this.bottomLink;
6751
6717
  this.cardWidth = this.getInitValue('cardWidth', props.cardWidth, this.cardWidth);
6752
6718
  this.color = this.getInitValue('color', props.color, this.color);
6753
- this.dark = this.getInitValue('dark', props.dark, this.dark);
6754
6719
  this.layout = this.getInitValue('layout', props.layout, this.layout);
6755
6720
  this.logo = this.getInitValue('logo', props.logo, this.logo);
6756
6721
  this.logoMessage = this.getInitValue('logoMessage', props.logoMessage, this.logoMessage);
@@ -6977,10 +6942,6 @@
6977
6942
  * Defines if the menu should have a visible container
6978
6943
  */
6979
6944
  this.floating = false;
6980
- /**
6981
- * Applies the dark theme variant to the menu.
6982
- */
6983
- this.dark = false;
6984
6945
  /**
6985
6946
  * Create the menu with smaller items.
6986
6947
  */
@@ -7063,7 +7024,6 @@
7063
7024
  this.clipped = this.getInitValue('clipped', props.clipped, this.clipped);
7064
7025
  this.fixed = this.getInitValue('fixed', props.fixed, this.fixed);
7065
7026
  this.floating = this.getInitValue('floating', props.floating, this.floating);
7066
- this.dark = this.getInitValue('dark', props.dark, this.dark);
7067
7027
  this.dense = this.getInitValue('dense', props.dense, this.dense);
7068
7028
  this.mini = this.getInitValue('mini', props.mini, this.mini);
7069
7029
  this.miniState = this.getInitValue('miniState', props.miniState, this.miniState);
@@ -7704,10 +7664,6 @@
7704
7664
  * Defines the value color
7705
7665
  */
7706
7666
  this.color = 'primary';
7707
- /**
7708
- * Applies the dark theme variant to the component
7709
- */
7710
- this.dark = false;
7711
7667
  /**
7712
7668
  * Sets the height for the component
7713
7669
  */
@@ -7716,10 +7672,6 @@
7716
7672
  * Animates the component constantly
7717
7673
  */
7718
7674
  this.indeterminate = false;
7719
- /**
7720
- * Applies the light theme variant to the component
7721
- */
7722
- this.light = false;
7723
7675
  /**
7724
7676
  * Render components on the progress component
7725
7677
  */
@@ -7731,10 +7683,8 @@
7731
7683
  this.backgroundColor = this.getInitValue('backgroundColor', props.backgroundColor, this.backgroundColor);
7732
7684
  this.backgroundOpacity = this.getInitValue('backgroundOpacity', props.backgroundOpacity, this.backgroundOpacity);
7733
7685
  this.color = this.getInitValue('color', props.color, this.color);
7734
- this.dark = this.getInitValue('dark', props.dark, this.dark);
7735
7686
  this.height = this.getInitValue('height', props.height, this.height);
7736
7687
  this.indeterminate = this.getInitValue('indeterminate', props.indeterminate, this.indeterminate);
7737
- this.light = this.getInitValue('light', props.light, this.light);
7738
7688
  this.centerSlot = this.getInitValue('centerSlot', props.centerSlot, this.centerSlot);
7739
7689
  this.value = this.getInitValue('value', props.value, this.value);
7740
7690
  this.createAccessors();
@@ -8672,6 +8622,10 @@
8672
8622
  * Defines if field value should be an object
8673
8623
  */
8674
8624
  this.returnObject = false;
8625
+ /**
8626
+ * Prevents load select data when the input is focused
8627
+ */
8628
+ this.preventLoadOnFocus = true;
8675
8629
  /**
8676
8630
  * Field used to make the item disabled
8677
8631
  */
@@ -8704,6 +8658,7 @@
8704
8658
  this.dataValue = this.getInitValue('dataValue', props.dataValue, this.dataValue);
8705
8659
  this.dataDisabled = this.getInitValue('dataDisabled', props.dataDisabled, this.dataDisabled);
8706
8660
  this.disabledItems = this.getInitValue('disabledItems', props.disabledItems, this.disabledItems);
8661
+ this.preventLoadOnFocus = this.getInitValue('preventLoadOnFocus', props.preventLoadOnFocus, this.preventLoadOnFocus);
8707
8662
  if (props.datasource && Object.keys(props.datasource).length) {
8708
8663
  this.lazyLoad = props.datasource.lazyLoad !== false;
8709
8664
  const searchFields = Array.isArray(this.dataText) ? this.dataText : [this.dataText];
@@ -8717,6 +8672,24 @@
8717
8672
  }
8718
8673
  this.createAccessors();
8719
8674
  }
8675
+ focus(event, element) {
8676
+ const _super = Object.create(null, {
8677
+ focus: { get: () => super.focus }
8678
+ });
8679
+ return __awaiter(this, void 0, void 0, function* () {
8680
+ _super.focus.call(this, event, element);
8681
+ this.afterFocus();
8682
+ });
8683
+ }
8684
+ afterFocus() {
8685
+ var _a;
8686
+ return __awaiter(this, void 0, void 0, function* () {
8687
+ if (!this.preventLoadOnFocus) {
8688
+ yield ((_a = this.datasource) === null || _a === void 0 ? void 0 : _a.get());
8689
+ this.preventLoadOnFocus = true;
8690
+ }
8691
+ });
8692
+ }
8720
8693
  createDataStructure() {
8721
8694
  this.treeDataStructure = new TreeDataStructure({
8722
8695
  datasource: this.datasource,
@@ -8961,6 +8934,40 @@
8961
8934
  }
8962
8935
  }
8963
8936
 
8937
+ /**
8938
+ * Base class for SelectableList component.
8939
+ */
8940
+ class SelectableList extends List {
8941
+ constructor(props) {
8942
+ super(props);
8943
+ /**
8944
+ * Specifies whether at least one element must be selected
8945
+ */
8946
+ this.mandatory = false;
8947
+ /**
8948
+ * Defines the maximum number of elements the list has
8949
+ */
8950
+ this.max = undefined;
8951
+ /**
8952
+ * Defines how many elements of the list can be selected at the same time
8953
+ */
8954
+ this.multiple = undefined;
8955
+ /**
8956
+ * Sets the active list-item inside the list-group
8957
+ */
8958
+ this.value = undefined;
8959
+ this.activeClass = this.getInitValue('activeClass', props.activeClass, this.activeClass);
8960
+ this.mandatory = this.getInitValue('mandatory', props.mandatory, this.mandatory);
8961
+ this.max = this.getInitValue('max', props.max, this.max);
8962
+ this.multiple = this.getInitValue('multiple', props.multiple, this.multiple);
8963
+ this.value = this.getInitValue('value', props.value, this.value);
8964
+ this.createAccessors();
8965
+ }
8966
+ change(event, element) {
8967
+ this.callEvent('change', { event, element, component: this });
8968
+ }
8969
+ }
8970
+
8964
8971
  /**
8965
8972
  * Base class for SpeedDial component.
8966
8973
  */
@@ -9044,14 +9051,6 @@
9044
9051
  * Array of steppers items
9045
9052
  */
9046
9053
  this.items = [];
9047
- /**
9048
- * Applies the dark theme variant to the stepper
9049
- */
9050
- this.dark = false;
9051
- /**
9052
- * Applies the light theme variant to the stepper
9053
- */
9054
- this.light = false;
9055
9054
  /**
9056
9055
  * Allow user to jump to any step
9057
9056
  */
@@ -9063,9 +9062,7 @@
9063
9062
  this.activeStep = this.getInitValue('activeStep', props.activeStep, this.activeStep);
9064
9063
  this.altLabels = this.getInitValue('altLabels', props.altLabels, this.altLabels);
9065
9064
  this.content = this.getInitValue('content', props.content, this.content);
9066
- this.dark = this.getInitValue('dark', props.dark, this.dark);
9067
9065
  this.items = this.getInitValue('items', props.items, this.items);
9068
- this.light = this.getInitValue('light', props.light, this.light);
9069
9066
  this.nonLinear = this.getInitValue('nonLinear', props.nonLinear, this.nonLinear);
9070
9067
  this.vertical = this.getInitValue('vertical', props.vertical, this.vertical);
9071
9068
  this.steps = this.getInitValue('steps', props.steps, this.steps);
@@ -9328,6 +9325,31 @@
9328
9325
  }
9329
9326
  return tab;
9330
9327
  }
9328
+ /**
9329
+ * Method for navigating to the next tab
9330
+ * @param loop Defines if want a loop navigation
9331
+ */
9332
+ nextTab(loop = false) {
9333
+ if (loop) {
9334
+ this.activeTab = (this.activeTab + 1) % this.tabs.length;
9335
+ }
9336
+ else if (this.activeTab < this.tabs.length - 1) {
9337
+ this.activeTab += 1;
9338
+ }
9339
+ }
9340
+ /**
9341
+ * Method for navigating to the previous tab
9342
+ * @param loop Defines if want a loop navigation
9343
+ */
9344
+ previousTab(loop = false) {
9345
+ if (loop) {
9346
+ const newTabIndex = (this.activeTab - 1) % this.tabs.length;
9347
+ this.activeTab = newTabIndex >= 0 ? newTabIndex : newTabIndex + this.tabs.length;
9348
+ }
9349
+ else if (this.activeTab > 0) {
9350
+ this.activeTab -= 1;
9351
+ }
9352
+ }
9331
9353
  /**
9332
9354
  * Triggered before tab is change.
9333
9355
  * @param event DOM event
@@ -10624,6 +10646,12 @@
10624
10646
  tableColumns: 'mdi-table-headers-eye',
10625
10647
  unfold: 'mdi-unfold-more-horizontal',
10626
10648
  warning: 'mdi-exclamation',
10649
+ zoom: 'mdi-magnify-scan',
10650
+ zoomIn: 'mdi-plus-circle-outline',
10651
+ zoomPanning: 'mdi-hand-back-right-outline',
10652
+ zoomOut: 'mdi-minus-circle-outline',
10653
+ zoomReset: 'mdi-magnify-close',
10654
+ zoomSelection: 'mdi-magnify-scan',
10627
10655
  };
10628
10656
  Icons.faIcons = {
10629
10657
  alertOctagon: 'fa fa-exclamation-circle',
@@ -10674,6 +10702,12 @@
10674
10702
  tableColumns: 'fa fa-columns',
10675
10703
  unfold: 'fa fa-sort',
10676
10704
  warning: 'fa fa-exclamation',
10705
+ zoom: 'fa fa-search',
10706
+ zoomIn: 'fa fa-search-plus',
10707
+ zoomPanning: 'fa fa-hand-paper',
10708
+ zoomOut: 'fa fa-search-minus',
10709
+ zoomReset: 'fa fa-undo',
10710
+ zoomSelection: 'fa fa-expand',
10677
10711
  };
10678
10712
  Icons.icons = (() => Icons.mdiIcons)();
10679
10713
 
@@ -10950,6 +10984,16 @@
10950
10984
  WatchURL.originalEvents = new Map();
10951
10985
 
10952
10986
  class BaseReport {
10987
+ constructor() {
10988
+ this.expressionZeedhiToXls = {
10989
+ AVG: 'AVERAGE',
10990
+ COUNT: 'COUNTA',
10991
+ MAX: 'MAX',
10992
+ MIN: 'MIN',
10993
+ SUM: 'SUM',
10994
+ };
10995
+ this.colunmXLS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
10996
+ }
10953
10997
  buildColumns(columns) {
10954
10998
  const widths = {};
10955
10999
  let totalWidth;
@@ -11176,27 +11220,12 @@
11176
11220
  }
11177
11221
 
11178
11222
  class XLSReport extends BaseReport {
11179
- constructor(type) {
11180
- super();
11223
+ constructor() {
11224
+ super(...arguments);
11181
11225
  this.route = '/generateXLS';
11182
- this.expressionZeedhiToXls = {
11183
- AVG: 'AVERAGE',
11184
- COUNT: 'COUNTA',
11185
- MAX: 'MAX',
11186
- MIN: 'MIN',
11187
- SUM: 'SUM',
11188
- };
11189
- this.colunmXLS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
11190
- this.type = type || 'xls';
11191
11226
  }
11192
- buildDataset(data, columns, metadata) {
11193
- let result;
11194
- if (this.type === 'xls') {
11195
- result = this.formatRawDataSet(data, columns);
11196
- }
11197
- else if (metadata) {
11198
- result = this.formatDataSet(metadata, data);
11199
- }
11227
+ buildDataset(data, columns) {
11228
+ const result = this.formatRawDataSet(data, columns);
11200
11229
  return JSON.stringify(result);
11201
11230
  }
11202
11231
  // formata o dataset para o formato "cru" xls
@@ -11240,27 +11269,55 @@
11240
11269
  };
11241
11270
  return Promise.resolve(JSON.stringify(metadataObj));
11242
11271
  }
11243
- isFormat3(format) {
11244
- return format === 'xls3';
11272
+ }
11273
+
11274
+ // XLS with groups
11275
+ class XLS2Report extends BaseReport {
11276
+ constructor() {
11277
+ super(...arguments);
11278
+ this.route = '/generateXLS';
11245
11279
  }
11246
- // Ordenar o nome das colunas de acordo com seu index, excluindo o nome das colunas agrupadas
11247
- getColumnsNameFormat3(columns, metaData) {
11248
- const columnsNameGroup = metaData.groups.map((row) => row.field);
11249
- let columnsName = [];
11250
- Object.entries(columns).forEach((row) => {
11251
- const columnName = row[0];
11252
- if (columnsNameGroup.indexOf(columnName) === -1) {
11253
- const index = row[1].sequence;
11254
- columnsName[index] = columnName;
11255
- }
11256
- });
11257
- columnsName = columnsName.filter((columnName) => typeof columnName === 'string');
11258
- return columnsName;
11280
+ buildDataset(data, metadata) {
11281
+ const result = this.formatDataSet(metadata, data);
11282
+ return JSON.stringify(result);
11283
+ }
11284
+ buildMetadata(name, title, columns, filter) {
11285
+ const builtCols = this.buildColumns(columns);
11286
+ const builtFilters = this.buildFilter(filter || {});
11287
+ const lang = this.formatLangCode(core.I18n.instance.language);
11288
+ const clientLogo = '';
11289
+ const enterpriseLogo = '';
11290
+ const productLogo = '';
11291
+ const metadataObj = {
11292
+ name,
11293
+ title,
11294
+ lang,
11295
+ clientLogo,
11296
+ enterpriseLogo,
11297
+ productLogo,
11298
+ version: '1.0',
11299
+ words: {
11300
+ Page: core.I18n.translate('PAGE'),
11301
+ Report: core.I18n.translate('REPORT'),
11302
+ Version: core.I18n.translate('VERSION'),
11303
+ },
11304
+ staticData: {},
11305
+ groups: [],
11306
+ reportName: name,
11307
+ widgetLabel: title,
11308
+ orientation: 'PORTRAIT',
11309
+ columns: builtCols,
11310
+ filter: builtFilters,
11311
+ reportXLS: true,
11312
+ xlsMergedCell: [],
11313
+ };
11314
+ return Promise.resolve(JSON.stringify(metadataObj));
11259
11315
  }
11260
11316
  // Ordenar o nome das colunas de acordo com seu index, e sempre deixando as colunas agrupadas nas primeiras posições
11261
11317
  getColumnsName(columns, metaData, lengthGroup) {
11262
11318
  const columnsNameGroup = metaData.groups.map((row) => row.field);
11263
11319
  let columnsName = [];
11320
+ const columnsGroupName = [];
11264
11321
  Object.entries(columns).forEach((row) => {
11265
11322
  const columnName = row[0];
11266
11323
  const index = row[1].sequence;
@@ -11268,25 +11325,21 @@
11268
11325
  columnsName[index + lengthGroup] = columnName;
11269
11326
  }
11270
11327
  else {
11271
- columnsName[index] = columnName;
11328
+ columnsGroupName.push(columnName);
11272
11329
  }
11273
11330
  });
11331
+ columnsName = columnsGroupName.concat(columnsName);
11274
11332
  columnsName = columnsName.filter((columnName) => typeof columnName === 'string');
11275
11333
  return columnsName;
11276
11334
  }
11277
11335
  // Inicializa alguns valores auxiliares
11278
- initVars(metaData, type) {
11336
+ initVars(metaData) {
11279
11337
  metaData.xlsMergedCell = [];
11280
11338
  const { columns } = metaData;
11281
11339
  const lengthGroup = metaData.groups.length;
11282
11340
  const indexLastGroup = lengthGroup - 1;
11283
11341
  let columnsName = [];
11284
- if (this.isFormat3(type)) {
11285
- columnsName = this.getColumnsNameFormat3(columns, metaData);
11286
- }
11287
- else {
11288
- columnsName = this.getColumnsName(columns, metaData, lengthGroup);
11289
- }
11342
+ columnsName = this.getColumnsName(columns, metaData, lengthGroup);
11290
11343
  const rowValues = [];
11291
11344
  const formatedDataSet = [];
11292
11345
  const groups = [];
@@ -11296,33 +11349,6 @@
11296
11349
  columns, indexLastGroup, columnsName, rowValues, formatedDataSet, groups,
11297
11350
  };
11298
11351
  }
11299
- // formata a linha do grupo de acordo com o formato xls3
11300
- setRowGroupFormat3(row, rowValuesParam, groups, formatedDataSet, columnsName, columns, indexLastGroup) {
11301
- let rowValues = rowValuesParam;
11302
- const label = `${row.groupLabel}:${row.groupValue}`;
11303
- const index = row.groupIndex;
11304
- if (row.groupHeader) {
11305
- rowValues[index] = label;
11306
- groups[index] = { init: null, end: null };
11307
- formatedDataSet.push(rowValues);
11308
- rowValues = [];
11309
- }
11310
- else if (row.groupFooter) {
11311
- if (!row.groupLabel) {
11312
- rowValues.push('Total');
11313
- }
11314
- else {
11315
- rowValues.push(`Total (${label})`);
11316
- }
11317
- formatedDataSet.push(rowValues);
11318
- rowValues = [];
11319
- const funcXls = null;
11320
- columnsName.forEach((column) => {
11321
- this.formatRowFunc(column, columns, row, index, rowValues, funcXls, groups, indexLastGroup);
11322
- });
11323
- }
11324
- return rowValues;
11325
- }
11326
11352
  // formata as expressões da linha
11327
11353
  formatRowFunc(column, columns, row, index, rowValues, funcXlsParam, groups, indexLastGroup) {
11328
11354
  let funcXls = funcXlsParam;
@@ -11421,18 +11447,199 @@
11421
11447
  });
11422
11448
  }
11423
11449
  formatDataSet(metaData, dataSet) {
11424
- const initVars = this.initVars(metaData, this.type);
11450
+ const initVars = this.initVars(metaData);
11425
11451
  const { columns, indexLastGroup, columnsName, formatedDataSet, groups, } = initVars;
11426
11452
  let { rowValues } = initVars;
11427
11453
  dataSet.forEach((row) => {
11428
11454
  if (row.group || row.groupFooter) {
11429
- if (this.isFormat3(this.type)) {
11430
- rowValues = this.setRowGroupFormat3(row, rowValues, groups, formatedDataSet, columnsName, columns, indexLastGroup);
11455
+ rowValues = this.setRowGroup(row, rowValues, groups, metaData, formatedDataSet, columnsName, columns, indexLastGroup);
11456
+ }
11457
+ else {
11458
+ this.setIndexGroups(groups, formatedDataSet);
11459
+ this.setRowNormal(columnsName, rowValues, row);
11460
+ }
11461
+ if (!row.groupHeader) {
11462
+ formatedDataSet.push(rowValues);
11463
+ }
11464
+ rowValues = [];
11465
+ });
11466
+ return [columnsName].concat(formatedDataSet);
11467
+ }
11468
+ }
11469
+
11470
+ // Grid mirror (with groups)
11471
+ class XLS3Report extends BaseReport {
11472
+ constructor() {
11473
+ super(...arguments);
11474
+ this.route = '/generateXLS';
11475
+ }
11476
+ buildDataset(data, metadata) {
11477
+ const result = this.formatDataSet(metadata, data);
11478
+ return JSON.stringify(result);
11479
+ }
11480
+ buildMetadata(name, title, columns, filter) {
11481
+ const builtCols = this.buildColumns(columns);
11482
+ const builtFilters = this.buildFilter(filter || {});
11483
+ const lang = this.formatLangCode(core.I18n.instance.language);
11484
+ const clientLogo = '';
11485
+ const enterpriseLogo = '';
11486
+ const productLogo = '';
11487
+ const metadataObj = {
11488
+ name,
11489
+ title,
11490
+ lang,
11491
+ clientLogo,
11492
+ enterpriseLogo,
11493
+ productLogo,
11494
+ version: '1.0',
11495
+ words: {
11496
+ Page: core.I18n.translate('PAGE'),
11497
+ Report: core.I18n.translate('REPORT'),
11498
+ Version: core.I18n.translate('VERSION'),
11499
+ },
11500
+ staticData: {},
11501
+ groups: [],
11502
+ reportName: name,
11503
+ widgetLabel: title,
11504
+ orientation: 'PORTRAIT',
11505
+ columns: builtCols,
11506
+ filter: builtFilters,
11507
+ reportXLS: true,
11508
+ xlsMergedCell: [],
11509
+ };
11510
+ return Promise.resolve(JSON.stringify(metadataObj));
11511
+ }
11512
+ // Ordenar o nome das colunas de acordo com seu index, excluindo o nome das colunas agrupadas
11513
+ getColumnsNameFormat3(columns, metaData) {
11514
+ const columnsNameGroup = metaData.groups.map((row) => row.field);
11515
+ let columnsName = [];
11516
+ Object.entries(columns).forEach((row) => {
11517
+ const columnName = row[0];
11518
+ if (columnsNameGroup.indexOf(columnName) === -1) {
11519
+ const index = row[1].sequence;
11520
+ columnsName[index] = columnName;
11521
+ }
11522
+ });
11523
+ columnsName = columnsName.filter((columnName) => typeof columnName === 'string');
11524
+ return columnsName;
11525
+ }
11526
+ // Inicializa alguns valores auxiliares
11527
+ initVars(metaData) {
11528
+ metaData.xlsMergedCell = [];
11529
+ const { columns } = metaData;
11530
+ const lengthGroup = metaData.groups.length;
11531
+ const indexLastGroup = lengthGroup - 1;
11532
+ let columnsName = [];
11533
+ columnsName = this.getColumnsNameFormat3(columns, metaData);
11534
+ const rowValues = [];
11535
+ const formatedDataSet = [];
11536
+ const groups = [];
11537
+ groups.groupEnd = {};
11538
+ groups.groupEnd.cellsfunc = {};
11539
+ return {
11540
+ columns, indexLastGroup, columnsName, rowValues, formatedDataSet, groups,
11541
+ };
11542
+ }
11543
+ // formata a linha do grupo de acordo com o formato xls3
11544
+ setRowGroupFormat(row, rowValuesParam, groups, formatedDataSet, columnsName, columns, indexLastGroup) {
11545
+ let rowValues = rowValuesParam;
11546
+ const label = `${row.groupLabel}:${row.groupValue}`;
11547
+ const index = row.groupIndex;
11548
+ if (row.groupHeader) {
11549
+ rowValues[index] = label;
11550
+ groups[index] = { init: null, end: null };
11551
+ formatedDataSet.push(rowValues);
11552
+ rowValues = [];
11553
+ }
11554
+ else if (row.groupFooter) {
11555
+ if (!row.groupLabel) {
11556
+ rowValues.push('Total');
11557
+ }
11558
+ else {
11559
+ rowValues.push(`Total (${label})`);
11560
+ }
11561
+ formatedDataSet.push(rowValues);
11562
+ rowValues = [];
11563
+ const funcXls = null;
11564
+ columnsName.forEach((column) => {
11565
+ this.formatRowFunc(column, columns, row, index, rowValues, funcXls, groups, indexLastGroup);
11566
+ });
11567
+ }
11568
+ return rowValues;
11569
+ }
11570
+ // formata as expressões da linha
11571
+ formatRowFunc(column, columns, row, index, rowValues, funcXlsParam, groups, indexLastGroup) {
11572
+ let funcXls = funcXlsParam;
11573
+ if ((row[column] === 0 || row[column]) && index !== undefined) {
11574
+ const letter = this.colunmXLS[rowValues.length];
11575
+ funcXls = this.expressionZeedhiToXls[columns[column].expression];
11576
+ const cellsfunc = `${letter + groups[index].init}:${letter}${groups[index].end}`;
11577
+ let expression = '';
11578
+ if (indexLastGroup === index) {
11579
+ expression = `=${funcXls}(${cellsfunc})`;
11580
+ }
11581
+ else {
11582
+ expression = `=${funcXls}(${groups[index].cellsfunc[column]})`;
11583
+ if (index === 0) {
11584
+ if (groups.groupEnd.cellsfunc[column]) {
11585
+ groups.groupEnd.cellsfunc[column] += `,${groups[index].cellsfunc[column]}`;
11586
+ }
11587
+ else {
11588
+ groups.groupEnd.cellsfunc[column] = groups[index].cellsfunc[column];
11589
+ }
11431
11590
  }
11432
- else {
11433
- rowValues = this.setRowGroup(row, rowValues, groups, metaData, formatedDataSet, columnsName, columns, indexLastGroup);
11591
+ groups[index].cellsfunc[column] = null;
11592
+ }
11593
+ rowValues.push(expression);
11594
+ groups.forEach((group, indexGroup) => {
11595
+ if (indexGroup !== indexLastGroup) {
11596
+ if (!group.cellsfunc) {
11597
+ group.cellsfunc = {};
11598
+ }
11599
+ if (group.cellsfunc[column]) {
11600
+ group.cellsfunc[column] += `,${cellsfunc}`;
11601
+ }
11602
+ else {
11603
+ group.cellsfunc[column] = cellsfunc;
11604
+ }
11605
+ }
11606
+ });
11607
+ }
11608
+ else {
11609
+ let cell = row[column];
11610
+ if (row.groupSummary) {
11611
+ const groupEndFunc = groups.groupEnd.cellsfunc;
11612
+ if (groupEndFunc[column]) {
11613
+ funcXls = this.expressionZeedhiToXls[columns[column].expression];
11614
+ cell = `=${funcXls}(${groupEndFunc[column]})`;
11434
11615
  }
11435
11616
  }
11617
+ rowValues.push(cell);
11618
+ }
11619
+ }
11620
+ // Defina o index dos grupos
11621
+ setIndexGroups(groups, formatedDataSet) {
11622
+ groups.forEach((group) => {
11623
+ if (!group.init) {
11624
+ group.init = formatedDataSet.length + 2;
11625
+ }
11626
+ group.end = formatedDataSet.length + 2;
11627
+ });
11628
+ }
11629
+ // Preenche uma linha "normal"
11630
+ setRowNormal(columnsName, rowValues, row) {
11631
+ columnsName.forEach((column) => {
11632
+ rowValues.push(row[column]);
11633
+ });
11634
+ }
11635
+ formatDataSet(metaData, dataSet) {
11636
+ const initVars = this.initVars(metaData);
11637
+ const { columns, indexLastGroup, columnsName, formatedDataSet, groups, } = initVars;
11638
+ let { rowValues } = initVars;
11639
+ dataSet.forEach((row) => {
11640
+ if (row.group || row.groupFooter) {
11641
+ rowValues = this.setRowGroupFormat(row, rowValues, groups, formatedDataSet, columnsName, columns, indexLastGroup);
11642
+ }
11436
11643
  else {
11437
11644
  this.setIndexGroups(groups, formatedDataSet);
11438
11645
  this.setRowNormal(columnsName, rowValues, row);
@@ -11479,8 +11686,14 @@
11479
11686
  if (type === 'pdf') {
11480
11687
  return new PDFReport();
11481
11688
  }
11482
- if (type === 'xls' || type === 'xls2' || type === 'xls3') {
11483
- return new XLSReport(type);
11689
+ if (type === 'xls') {
11690
+ return new XLSReport();
11691
+ }
11692
+ if (type === 'xls2') {
11693
+ return new XLS2Report();
11694
+ }
11695
+ if (type === 'xls3') {
11696
+ return new XLS3Report();
11484
11697
  }
11485
11698
  throw new Error(`Invalid report type: ${type}`);
11486
11699
  }
@@ -11499,10 +11712,10 @@
11499
11712
  const formattedColumns = this.removeActionColumns(columns);
11500
11713
  const metadataObj = yield reportType.buildMetadata(name, this.title, formattedColumns, datasource.filter, portrait);
11501
11714
  let dataset;
11502
- if ((reportType.type === 'xls2' || reportType.type === 'xls3') && groupedData) {
11715
+ if ((reportType instanceof XLS2Report || reportType instanceof XLS3Report) && groupedData) {
11503
11716
  const rowMetadata = rowObj.metaData;
11504
11717
  const metadataObjClone = merge__default["default"](rowMetadata, JSON.parse(metadataObj));
11505
- dataset = reportType.buildDataset(groupedData, formattedColumns, metadataObjClone);
11718
+ dataset = reportType.buildDataset(groupedData, metadataObjClone);
11506
11719
  }
11507
11720
  else {
11508
11721
  dataset = reportType.buildDataset(data, formattedColumns);
@@ -11627,6 +11840,7 @@
11627
11840
  exports.SelectMultiple = SelectMultiple;
11628
11841
  exports.SelectTree = SelectTree;
11629
11842
  exports.SelectTreeMultiple = SelectTreeMultiple;
11843
+ exports.SelectableList = SelectableList;
11630
11844
  exports.SpeedDial = SpeedDial;
11631
11845
  exports.Steppers = Steppers;
11632
11846
  exports.SvgMap = SvgMap;
@@ -11646,6 +11860,8 @@
11646
11860
  exports.TreeGrid = TreeGrid;
11647
11861
  exports.TreeGridEditable = TreeGridEditable;
11648
11862
  exports.WatchURL = WatchURL;
11863
+ exports.XLS2Report = XLS2Report;
11864
+ exports.XLS3Report = XLS3Report;
11649
11865
  exports.XLSReport = XLSReport;
11650
11866
  exports.initTheme = initTheme;
11651
11867