@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.
- package/dist/style.css +1 -1
- package/dist/zd-common.esm.js +614 -190
- package/dist/zd-common.umd.js +619 -193
- package/package.json +2 -2
- package/types/components/zd-alert/alert.d.ts +2 -0
- package/types/components/zd-apex-chart/apex-chart.d.ts +11 -0
- package/types/components/zd-breadcrumbs/breadcrumbs.d.ts +0 -8
- package/types/components/zd-button/button.d.ts +0 -8
- package/types/components/zd-button/interfaces.d.ts +0 -2
- package/types/components/zd-button-group/button-group.d.ts +0 -8
- package/types/components/zd-button-group/interfaces.d.ts +0 -2
- package/types/components/zd-card/card.d.ts +0 -8
- package/types/components/zd-card/interfaces.d.ts +0 -2
- package/types/components/zd-carousel/carousel.d.ts +0 -8
- package/types/components/zd-carousel/interfaces.d.ts +0 -2
- package/types/components/zd-component/component.d.ts +8 -0
- package/types/components/zd-component/interfaces.d.ts +2 -0
- package/types/components/zd-date/date-range.d.ts +1 -5
- package/types/components/zd-divider/divider.d.ts +0 -8
- package/types/components/zd-divider/interfaces.d.ts +0 -2
- package/types/components/zd-footer/footer.d.ts +0 -8
- package/types/components/zd-footer/interfaces.d.ts +0 -2
- package/types/components/zd-form/form.d.ts +10 -1
- package/types/components/zd-frame/frame.d.ts +1 -0
- package/types/components/zd-grid/grid-column.d.ts +2 -0
- package/types/components/zd-grid/grid-editable.d.ts +1 -1
- package/types/components/zd-grid/grid.d.ts +4 -0
- package/types/components/zd-grid/interfaces.d.ts +1 -0
- package/types/components/zd-header/header.d.ts +0 -8
- package/types/components/zd-icon/icon.d.ts +0 -8
- package/types/components/zd-icon/interfaces.d.ts +0 -2
- package/types/components/zd-input/input.d.ts +0 -8
- package/types/components/zd-iterable/column.d.ts +4 -2
- package/types/components/zd-list/interfaces.d.ts +0 -2
- package/types/components/zd-list/list.d.ts +0 -8
- package/types/components/zd-login/interfaces.d.ts +0 -1
- package/types/components/zd-login/login.d.ts +0 -4
- package/types/components/zd-menu/interfaces.d.ts +0 -1
- package/types/components/zd-menu/menu.d.ts +0 -4
- package/types/components/zd-progress/progress.d.ts +0 -8
- package/types/components/zd-select/select.d.ts +1 -0
- package/types/components/zd-select-multiple/select-multiple.d.ts +4 -0
- package/types/components/zd-select-tree/interfaces.d.ts +1 -0
- package/types/components/zd-select-tree/select-tree.d.ts +6 -0
- package/types/components/zd-selectable-list/interfaces.d.ts +7 -0
- package/types/components/zd-selectable-list/selectable-list.d.ts +29 -0
- package/types/components/zd-steppers/interfaces.d.ts +0 -2
- package/types/components/zd-steppers/steppers.d.ts +0 -8
- package/types/components/zd-tree-grid/interfaces.d.ts +3 -1
- package/types/components/zd-tree-grid/tree-grid-editable.d.ts +4 -3
- package/types/utils/report/index.d.ts +2 -0
- package/types/utils/report/report-type/base-report.d.ts +3 -1
- package/types/utils/report/report-type/interfaces.d.ts +8 -2
- package/types/utils/report/report-type/xls-report.d.ts +1 -0
- package/types/utils/report/report-type/xls2-report.d.ts +16 -0
- package/types/utils/report/report-type/xls3-report.d.ts +16 -0
package/dist/zd-common.umd.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@zeedhi/core'), require('lodash.
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@zeedhi/core', 'lodash.
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@zeedhi/common"] = {}, global.core, global.
|
|
5
|
-
})(this, (function (exports, core, debounce, isUndefined,
|
|
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
|
|
3482
|
+
const formattedValue = [];
|
|
3485
3483
|
splitedValue.forEach((value) => {
|
|
3486
3484
|
if (value && this.isValidDate(value, this.dateFormat)) {
|
|
3487
|
-
|
|
3485
|
+
formattedValue.push(core.dayjs(value, this.dateFormat, true).format(this.isoFormat));
|
|
3488
3486
|
}
|
|
3489
3487
|
});
|
|
3490
|
-
return
|
|
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,11 +4304,11 @@
|
|
|
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(
|
|
4326
|
-
const conditionFunction =
|
|
4327
|
-
set__default["default"](appliedConditions, condition, conditionFunction({ row }));
|
|
4309
|
+
Object.keys(factoredConditions).forEach((condition) => {
|
|
4310
|
+
const conditionFunction = factoredConditions[condition];
|
|
4311
|
+
set__default["default"](appliedConditions, condition, conditionFunction({ row, column: this }));
|
|
4328
4312
|
});
|
|
4329
4313
|
return appliedConditions;
|
|
4330
4314
|
}
|
|
@@ -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 = '
|
|
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
|
-
|
|
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) => {
|
|
@@ -5075,7 +5072,6 @@
|
|
|
5075
5072
|
if (this.editing)
|
|
5076
5073
|
return;
|
|
5077
5074
|
if (column.editable) {
|
|
5078
|
-
this.selectedRows = [];
|
|
5079
5075
|
this.editing = true;
|
|
5080
5076
|
this.preventRowClick = true;
|
|
5081
5077
|
this.datasource.currentRow = row;
|
|
@@ -5145,7 +5141,7 @@
|
|
|
5145
5141
|
else {
|
|
5146
5142
|
colValue = row[column.name];
|
|
5147
5143
|
}
|
|
5148
|
-
const componentProps = merge__default["default"]({}, column.componentProps, cellProps.componentProps);
|
|
5144
|
+
const componentProps = merge__default["default"]({}, column.componentProps, cellProps === null || cellProps === void 0 ? void 0 : cellProps.componentProps);
|
|
5149
5145
|
let compEvents = {};
|
|
5150
5146
|
if (componentProps && componentProps.events) {
|
|
5151
5147
|
compEvents = core.Event.factory(componentProps.events);
|
|
@@ -5432,10 +5428,6 @@
|
|
|
5432
5428
|
* Applies specified color to the control. It can be the name of material or css color in hexa.
|
|
5433
5429
|
*/
|
|
5434
5430
|
this.color = 'primary';
|
|
5435
|
-
/**
|
|
5436
|
-
* Applies the dark theme variant to header.
|
|
5437
|
-
*/
|
|
5438
|
-
this.dark = false;
|
|
5439
5431
|
/**
|
|
5440
5432
|
* Designates that the application menu positioned on the left is below the header.
|
|
5441
5433
|
*/
|
|
@@ -5460,10 +5452,6 @@
|
|
|
5460
5452
|
* Render components on the left of header.
|
|
5461
5453
|
*/
|
|
5462
5454
|
this.leftSlot = [];
|
|
5463
|
-
/**
|
|
5464
|
-
* Applies the light theme variant to the header.
|
|
5465
|
-
*/
|
|
5466
|
-
this.light = false;
|
|
5467
5455
|
/**
|
|
5468
5456
|
* Removes internal padding from header.
|
|
5469
5457
|
*/
|
|
@@ -5478,13 +5466,11 @@
|
|
|
5478
5466
|
this.clippedLeft = this.getInitValue('clippedLeft', props.clippedLeft, this.clippedLeft);
|
|
5479
5467
|
this.clippedRight = this.getInitValue('clippedRight', props.clippedRight, this.clippedRight);
|
|
5480
5468
|
this.color = this.getInitValue('color', props.color, this.color);
|
|
5481
|
-
this.dark = this.getInitValue('dark', props.dark, this.dark);
|
|
5482
5469
|
this.dense = this.getInitValue('dense', props.dense, this.dense);
|
|
5483
5470
|
this.elevation = this.getInitValue('elevation', props.elevation, this.elevation);
|
|
5484
5471
|
this.fixed = this.getInitValue('fixed', props.fixed, this.fixed);
|
|
5485
5472
|
this.height = this.getInitValue('height', props.height, this.height);
|
|
5486
5473
|
this.leftSlot = props.leftSlot || this.leftSlot;
|
|
5487
|
-
this.light = this.getInitValue('light', props.light, this.light);
|
|
5488
5474
|
this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
|
|
5489
5475
|
this.maxWidth = this.getInitValue('maxWidth', props.maxWidth, this.maxWidth);
|
|
5490
5476
|
this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
|
|
@@ -5518,10 +5504,6 @@
|
|
|
5518
5504
|
* (for example success or purple) or css color (#033 or rgba(255, 0, 0, 0.5)).
|
|
5519
5505
|
*/
|
|
5520
5506
|
this.color = '';
|
|
5521
|
-
/**
|
|
5522
|
-
* Applies the dark theme variant to the component.
|
|
5523
|
-
*/
|
|
5524
|
-
this.dark = false;
|
|
5525
5507
|
/**
|
|
5526
5508
|
* Makes icon smaller (20px)
|
|
5527
5509
|
*/
|
|
@@ -5543,10 +5525,6 @@
|
|
|
5543
5525
|
* of a button when placed to the left of another element or text
|
|
5544
5526
|
*/
|
|
5545
5527
|
this.left = false;
|
|
5546
|
-
/**
|
|
5547
|
-
* Applies the light theme variant to the component.
|
|
5548
|
-
*/
|
|
5549
|
-
this.light = false;
|
|
5550
5528
|
/**
|
|
5551
5529
|
* Applies appropriate margins to the icon inside of
|
|
5552
5530
|
* a button when placed to the right of another element or text
|
|
@@ -5565,13 +5543,11 @@
|
|
|
5565
5543
|
*/
|
|
5566
5544
|
this.tag = 'i';
|
|
5567
5545
|
this.color = this.getInitValue('color', props.color, this.color);
|
|
5568
|
-
this.dark = this.getInitValue('dark', props.dark, this.dark);
|
|
5569
5546
|
this.dense = this.getInitValue('dense', props.dense, this.dense);
|
|
5570
5547
|
this.disabled = this.getInitValue('disabled', props.disabled, this.disabled);
|
|
5571
5548
|
this.iconName = this.getInitValue('iconName', props.iconName, this.iconName);
|
|
5572
5549
|
this.large = this.getInitValue('large', props.large, this.large);
|
|
5573
5550
|
this.left = this.getInitValue('left', props.left, this.left);
|
|
5574
|
-
this.light = this.getInitValue('light', props.light, this.light);
|
|
5575
5551
|
this.right = this.getInitValue('right', props.right, this.right);
|
|
5576
5552
|
this.size = this.getInitValue('size', props.size, this.size);
|
|
5577
5553
|
this.small = this.getInitValue('small', props.small, this.small);
|
|
@@ -5938,6 +5914,7 @@
|
|
|
5938
5914
|
this.cachedData = [];
|
|
5939
5915
|
this.cachedTotal = 0;
|
|
5940
5916
|
this.formatterFn = core.FormatterParserProvider.getFormatter('ZdSelect');
|
|
5917
|
+
this.pushedValue = null;
|
|
5941
5918
|
this.loadMoreQtty = 0;
|
|
5942
5919
|
this.debounceSearch = debounce__default["default"](this.doSearch, 500);
|
|
5943
5920
|
this.appendIcon = this.getInitValue('appendIcon', props.appendIcon, 'expand');
|
|
@@ -5959,6 +5936,7 @@
|
|
|
5959
5936
|
this.dataText = [this.dataText];
|
|
5960
5937
|
const defaultDatasource = this.getDefaultDatasource(props);
|
|
5961
5938
|
this.datasource = core.DatasourceFactory.factory(defaultDatasource);
|
|
5939
|
+
this.overrideGet();
|
|
5962
5940
|
let defaultValue = props.value;
|
|
5963
5941
|
if (core.Accessor.isAccessorDefinition(props.value)) {
|
|
5964
5942
|
defaultValue = this.getAccessorValue(props.value);
|
|
@@ -5989,6 +5967,16 @@
|
|
|
5989
5967
|
const searchIn = (((_a = field.datasource) === null || _a === void 0 ? void 0 : _a.searchIn) || []).concat(searchInDefault);
|
|
5990
5968
|
return Object.assign(Object.assign({}, field.datasource), { searchIn, lazyLoad: (field.value !== '' && field.value !== undefined) || (field.datasource && field.datasource.lazyLoad) });
|
|
5991
5969
|
}
|
|
5970
|
+
overrideGet() {
|
|
5971
|
+
const oldGet = this.datasource.get;
|
|
5972
|
+
this.datasource.get = () => __awaiter(this, void 0, void 0, function* () {
|
|
5973
|
+
yield oldGet.call(this.datasource);
|
|
5974
|
+
if (this.indexOf(this.value) !== -1 || this.datasource.search || this.isFocused)
|
|
5975
|
+
return;
|
|
5976
|
+
yield this.setValue(this.value, false);
|
|
5977
|
+
this.removePushedValue();
|
|
5978
|
+
});
|
|
5979
|
+
}
|
|
5992
5980
|
get search() {
|
|
5993
5981
|
return this.searchValue;
|
|
5994
5982
|
}
|
|
@@ -6015,7 +6003,7 @@
|
|
|
6015
6003
|
}
|
|
6016
6004
|
if (this.manualMode)
|
|
6017
6005
|
return;
|
|
6018
|
-
this.cachedData = this.datasource.data;
|
|
6006
|
+
this.cachedData = [...this.datasource.data];
|
|
6019
6007
|
this.cachedTotal = this.datasource.total;
|
|
6020
6008
|
if (pushed) {
|
|
6021
6009
|
this.pushedValue = this.selectedData;
|
|
@@ -6074,10 +6062,14 @@
|
|
|
6074
6062
|
if (!this.pushedValue && this.isFilledObj(this.selectValue) && this.indexOf(this.selectValue) === -1) {
|
|
6075
6063
|
this.pushedValue = this.selectValue;
|
|
6076
6064
|
}
|
|
6077
|
-
|
|
6065
|
+
const index = this.indexOf(this.pushedValue);
|
|
6066
|
+
if (this.isFilledObj(this.pushedValue) && index === -1) {
|
|
6078
6067
|
this.datasource.data.unshift(this.pushedValue);
|
|
6079
6068
|
}
|
|
6080
|
-
|
|
6069
|
+
else if (index !== 0) {
|
|
6070
|
+
this.pushedValue = null;
|
|
6071
|
+
}
|
|
6072
|
+
this.cachedData = [...this.datasource.data];
|
|
6081
6073
|
this.cachedTotal = this.datasource.total;
|
|
6082
6074
|
}
|
|
6083
6075
|
/**
|
|
@@ -6136,6 +6128,7 @@
|
|
|
6136
6128
|
}
|
|
6137
6129
|
if (!searchValue) {
|
|
6138
6130
|
this.setFieldRowValue(null);
|
|
6131
|
+
this.selectValue = this.selectedData;
|
|
6139
6132
|
return false;
|
|
6140
6133
|
}
|
|
6141
6134
|
this.setFieldRowValue(searchValue);
|
|
@@ -6246,7 +6239,7 @@
|
|
|
6246
6239
|
else {
|
|
6247
6240
|
this.removePushedValue();
|
|
6248
6241
|
this.datasource.search = this.searchValue;
|
|
6249
|
-
this.datasource.data = this.cachedData;
|
|
6242
|
+
this.datasource.data = [...this.cachedData];
|
|
6250
6243
|
this.datasource.total = this.cachedTotal;
|
|
6251
6244
|
}
|
|
6252
6245
|
});
|
|
@@ -6259,6 +6252,11 @@
|
|
|
6259
6252
|
yield this.datasource.setLimit(this.datasource.limit + this.loadMoreQtty);
|
|
6260
6253
|
if (!this.datasource.search) {
|
|
6261
6254
|
this.afterLoad();
|
|
6255
|
+
const { dataValue } = this;
|
|
6256
|
+
const isSelected = this.selectValue && this.pushedValue && this.selectValue[dataValue] === this.pushedValue[dataValue];
|
|
6257
|
+
if (isSelected)
|
|
6258
|
+
return;
|
|
6259
|
+
this.removePushedValue();
|
|
6262
6260
|
}
|
|
6263
6261
|
});
|
|
6264
6262
|
}
|
|
@@ -6272,7 +6270,7 @@
|
|
|
6272
6270
|
this.datasource.search = '';
|
|
6273
6271
|
this.dirtySearchValue = '';
|
|
6274
6272
|
if (!this.manualMode) {
|
|
6275
|
-
this.datasource.data = this.cachedData;
|
|
6273
|
+
this.datasource.data = [...this.cachedData];
|
|
6276
6274
|
this.datasource.total = this.cachedTotal;
|
|
6277
6275
|
}
|
|
6278
6276
|
this.checkValueOnBlur();
|
|
@@ -6285,13 +6283,17 @@
|
|
|
6285
6283
|
}
|
|
6286
6284
|
if (this.manualMode)
|
|
6287
6285
|
return;
|
|
6288
|
-
if (this.isFilledObj(this.selectValue)) {
|
|
6289
|
-
if (this.
|
|
6290
|
-
this.
|
|
6291
|
-
this.pushedValue = this.selectValue;
|
|
6286
|
+
if (this.isFilledObj(this.selectValue) && this.indexOf(this.selectValue) === -1) {
|
|
6287
|
+
if (this.pushedValue) {
|
|
6288
|
+
this.removePushedValue();
|
|
6292
6289
|
}
|
|
6290
|
+
this.datasource.data.unshift(this.selectValue);
|
|
6291
|
+
this.pushedValue = this.selectValue;
|
|
6293
6292
|
return;
|
|
6294
6293
|
}
|
|
6294
|
+
const { dataValue } = this;
|
|
6295
|
+
if (this.pushedValue && this.selectValue && this.selectValue[dataValue] === this.pushedValue[dataValue])
|
|
6296
|
+
return;
|
|
6295
6297
|
this.removePushedValue();
|
|
6296
6298
|
}
|
|
6297
6299
|
showLoadMore() {
|
|
@@ -6529,10 +6531,6 @@
|
|
|
6529
6531
|
class List extends ComponentRender {
|
|
6530
6532
|
constructor(props) {
|
|
6531
6533
|
super(props);
|
|
6532
|
-
/**
|
|
6533
|
-
* Applies the dark theme variant to the List.
|
|
6534
|
-
*/
|
|
6535
|
-
this.dark = false;
|
|
6536
6534
|
/**
|
|
6537
6535
|
* Create the list with smaller items.
|
|
6538
6536
|
*/
|
|
@@ -6545,10 +6543,6 @@
|
|
|
6545
6543
|
* Render list with dividers between the items.
|
|
6546
6544
|
*/
|
|
6547
6545
|
this.divided = false;
|
|
6548
|
-
/**
|
|
6549
|
-
* Applies the light theme variant to the List.
|
|
6550
|
-
*/
|
|
6551
|
-
this.light = false;
|
|
6552
6546
|
/**
|
|
6553
6547
|
* Increases the height of all the list items to better support three lines of text.
|
|
6554
6548
|
*/
|
|
@@ -6693,10 +6687,6 @@
|
|
|
6693
6687
|
* It can be the name of material or css color in hexa.
|
|
6694
6688
|
*/
|
|
6695
6689
|
this.color = '';
|
|
6696
|
-
/**
|
|
6697
|
-
* Applies the dark theme.
|
|
6698
|
-
*/
|
|
6699
|
-
this.dark = false;
|
|
6700
6690
|
/**
|
|
6701
6691
|
* Card position orientation.
|
|
6702
6692
|
*/
|
|
@@ -6725,7 +6715,6 @@
|
|
|
6725
6715
|
this.bottomLink = props.bottomLink || this.bottomLink;
|
|
6726
6716
|
this.cardWidth = this.getInitValue('cardWidth', props.cardWidth, this.cardWidth);
|
|
6727
6717
|
this.color = this.getInitValue('color', props.color, this.color);
|
|
6728
|
-
this.dark = this.getInitValue('dark', props.dark, this.dark);
|
|
6729
6718
|
this.layout = this.getInitValue('layout', props.layout, this.layout);
|
|
6730
6719
|
this.logo = this.getInitValue('logo', props.logo, this.logo);
|
|
6731
6720
|
this.logoMessage = this.getInitValue('logoMessage', props.logoMessage, this.logoMessage);
|
|
@@ -6952,10 +6941,6 @@
|
|
|
6952
6941
|
* Defines if the menu should have a visible container
|
|
6953
6942
|
*/
|
|
6954
6943
|
this.floating = false;
|
|
6955
|
-
/**
|
|
6956
|
-
* Applies the dark theme variant to the menu.
|
|
6957
|
-
*/
|
|
6958
|
-
this.dark = false;
|
|
6959
6944
|
/**
|
|
6960
6945
|
* Create the menu with smaller items.
|
|
6961
6946
|
*/
|
|
@@ -7038,7 +7023,6 @@
|
|
|
7038
7023
|
this.clipped = this.getInitValue('clipped', props.clipped, this.clipped);
|
|
7039
7024
|
this.fixed = this.getInitValue('fixed', props.fixed, this.fixed);
|
|
7040
7025
|
this.floating = this.getInitValue('floating', props.floating, this.floating);
|
|
7041
|
-
this.dark = this.getInitValue('dark', props.dark, this.dark);
|
|
7042
7026
|
this.dense = this.getInitValue('dense', props.dense, this.dense);
|
|
7043
7027
|
this.mini = this.getInitValue('mini', props.mini, this.mini);
|
|
7044
7028
|
this.miniState = this.getInitValue('miniState', props.miniState, this.miniState);
|
|
@@ -7679,10 +7663,6 @@
|
|
|
7679
7663
|
* Defines the value color
|
|
7680
7664
|
*/
|
|
7681
7665
|
this.color = 'primary';
|
|
7682
|
-
/**
|
|
7683
|
-
* Applies the dark theme variant to the component
|
|
7684
|
-
*/
|
|
7685
|
-
this.dark = false;
|
|
7686
7666
|
/**
|
|
7687
7667
|
* Sets the height for the component
|
|
7688
7668
|
*/
|
|
@@ -7691,10 +7671,6 @@
|
|
|
7691
7671
|
* Animates the component constantly
|
|
7692
7672
|
*/
|
|
7693
7673
|
this.indeterminate = false;
|
|
7694
|
-
/**
|
|
7695
|
-
* Applies the light theme variant to the component
|
|
7696
|
-
*/
|
|
7697
|
-
this.light = false;
|
|
7698
7674
|
/**
|
|
7699
7675
|
* Render components on the progress component
|
|
7700
7676
|
*/
|
|
@@ -7706,10 +7682,8 @@
|
|
|
7706
7682
|
this.backgroundColor = this.getInitValue('backgroundColor', props.backgroundColor, this.backgroundColor);
|
|
7707
7683
|
this.backgroundOpacity = this.getInitValue('backgroundOpacity', props.backgroundOpacity, this.backgroundOpacity);
|
|
7708
7684
|
this.color = this.getInitValue('color', props.color, this.color);
|
|
7709
|
-
this.dark = this.getInitValue('dark', props.dark, this.dark);
|
|
7710
7685
|
this.height = this.getInitValue('height', props.height, this.height);
|
|
7711
7686
|
this.indeterminate = this.getInitValue('indeterminate', props.indeterminate, this.indeterminate);
|
|
7712
|
-
this.light = this.getInitValue('light', props.light, this.light);
|
|
7713
7687
|
this.centerSlot = this.getInitValue('centerSlot', props.centerSlot, this.centerSlot);
|
|
7714
7688
|
this.value = this.getInitValue('value', props.value, this.value);
|
|
7715
7689
|
this.createAccessors();
|
|
@@ -7936,20 +7910,23 @@
|
|
|
7936
7910
|
set selectValue(rows) {
|
|
7937
7911
|
if (!Array.isArray(rows))
|
|
7938
7912
|
return;
|
|
7939
|
-
if (!this.manualMode
|
|
7940
|
-
this.insertsRemoved = [];
|
|
7913
|
+
if (!this.manualMode) {
|
|
7941
7914
|
const values = rows.map((row) => row[this.dataValue]);
|
|
7942
|
-
this.insertedValues
|
|
7943
|
-
|
|
7944
|
-
if (removed) {
|
|
7945
|
-
this.insertsRemoved.push(inserted);
|
|
7946
|
-
}
|
|
7947
|
-
return !removed;
|
|
7948
|
-
});
|
|
7915
|
+
this.cutFromAToB(this.insertedValues, this.insertsRemoved, (value) => !values.includes(value[this.dataValue]));
|
|
7916
|
+
this.cutFromAToB(this.insertsRemoved, this.insertedValues, (value) => values.includes(value[this.dataValue]));
|
|
7949
7917
|
}
|
|
7950
7918
|
this.selectedValue = rows;
|
|
7951
7919
|
this.setFieldValue(this.getValues(rows));
|
|
7952
7920
|
}
|
|
7921
|
+
/**
|
|
7922
|
+
* Removes item from array a and add it to array b if condition is satisfied
|
|
7923
|
+
*/
|
|
7924
|
+
cutFromAToB(a, b, condition) {
|
|
7925
|
+
const indices = a.reduce((result, value, index) => (condition(value) ? [...result, index] : result), []);
|
|
7926
|
+
indices.forEach((index) => {
|
|
7927
|
+
b.push(a.splice(index)[0]);
|
|
7928
|
+
});
|
|
7929
|
+
}
|
|
7953
7930
|
setFieldValue(value) {
|
|
7954
7931
|
return __awaiter(this, void 0, void 0, function* () {
|
|
7955
7932
|
const promises = [];
|
|
@@ -8126,7 +8103,7 @@
|
|
|
8126
8103
|
showLoadMore() {
|
|
8127
8104
|
return !!this.datasource.data.length
|
|
8128
8105
|
&& !this.datasource.loadAll
|
|
8129
|
-
&& (this.datasource.data.length - this.insertedValues.length) < this.datasource.total;
|
|
8106
|
+
&& (this.datasource.data.length - this.insertedValues.length - this.insertsRemoved.length) < this.datasource.total;
|
|
8130
8107
|
}
|
|
8131
8108
|
/**
|
|
8132
8109
|
* Load more data
|
|
@@ -8134,10 +8111,16 @@
|
|
|
8134
8111
|
loadMore() {
|
|
8135
8112
|
return __awaiter(this, void 0, void 0, function* () {
|
|
8136
8113
|
yield this.datasource.setLimit(this.datasource.limit + this.loadMoreQtty);
|
|
8114
|
+
this.insertsRemoved = this.insertsRemoved.filter((insert) => {
|
|
8115
|
+
const value = insert[this.dataValue];
|
|
8116
|
+
const foundInData = this.datasource.data.find(this.getCondition(value));
|
|
8117
|
+
return !foundInData;
|
|
8118
|
+
});
|
|
8119
|
+
this.insertSelected();
|
|
8137
8120
|
if (!this.datasource.search) {
|
|
8138
8121
|
this.setCache();
|
|
8139
8122
|
}
|
|
8140
|
-
this.
|
|
8123
|
+
this.removePushedValue();
|
|
8141
8124
|
});
|
|
8142
8125
|
}
|
|
8143
8126
|
/**
|
|
@@ -8331,6 +8314,9 @@
|
|
|
8331
8314
|
}
|
|
8332
8315
|
return item;
|
|
8333
8316
|
});
|
|
8317
|
+
if (parent) { // remove all existing children to add new ones
|
|
8318
|
+
this.treeData = this.treeData.filter((item) => item.tree__parent !== parent);
|
|
8319
|
+
}
|
|
8334
8320
|
if (!parent) {
|
|
8335
8321
|
this.treeData = childData;
|
|
8336
8322
|
}
|
|
@@ -8514,7 +8500,7 @@
|
|
|
8514
8500
|
this.treeStructure = {};
|
|
8515
8501
|
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 })));
|
|
8516
8502
|
this.treeData = childData;
|
|
8517
|
-
this.treeStructure['no-parent'] =
|
|
8503
|
+
this.treeStructure['no-parent'] = childData;
|
|
8518
8504
|
}
|
|
8519
8505
|
/**
|
|
8520
8506
|
* Search value against a memory datasource
|
|
@@ -8635,6 +8621,10 @@
|
|
|
8635
8621
|
* Defines if field value should be an object
|
|
8636
8622
|
*/
|
|
8637
8623
|
this.returnObject = false;
|
|
8624
|
+
/**
|
|
8625
|
+
* Prevents load select data when the input is focused
|
|
8626
|
+
*/
|
|
8627
|
+
this.preventLoadOnFocus = true;
|
|
8638
8628
|
/**
|
|
8639
8629
|
* Field used to make the item disabled
|
|
8640
8630
|
*/
|
|
@@ -8667,6 +8657,7 @@
|
|
|
8667
8657
|
this.dataValue = this.getInitValue('dataValue', props.dataValue, this.dataValue);
|
|
8668
8658
|
this.dataDisabled = this.getInitValue('dataDisabled', props.dataDisabled, this.dataDisabled);
|
|
8669
8659
|
this.disabledItems = this.getInitValue('disabledItems', props.disabledItems, this.disabledItems);
|
|
8660
|
+
this.preventLoadOnFocus = this.getInitValue('preventLoadOnFocus', props.preventLoadOnFocus, this.preventLoadOnFocus);
|
|
8670
8661
|
if (props.datasource && Object.keys(props.datasource).length) {
|
|
8671
8662
|
this.lazyLoad = props.datasource.lazyLoad !== false;
|
|
8672
8663
|
const searchFields = Array.isArray(this.dataText) ? this.dataText : [this.dataText];
|
|
@@ -8680,6 +8671,24 @@
|
|
|
8680
8671
|
}
|
|
8681
8672
|
this.createAccessors();
|
|
8682
8673
|
}
|
|
8674
|
+
focus(event, element) {
|
|
8675
|
+
const _super = Object.create(null, {
|
|
8676
|
+
focus: { get: () => super.focus }
|
|
8677
|
+
});
|
|
8678
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
8679
|
+
_super.focus.call(this, event, element);
|
|
8680
|
+
this.afterFocus();
|
|
8681
|
+
});
|
|
8682
|
+
}
|
|
8683
|
+
afterFocus() {
|
|
8684
|
+
var _a;
|
|
8685
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
8686
|
+
if (!this.preventLoadOnFocus) {
|
|
8687
|
+
yield ((_a = this.datasource) === null || _a === void 0 ? void 0 : _a.get());
|
|
8688
|
+
this.preventLoadOnFocus = true;
|
|
8689
|
+
}
|
|
8690
|
+
});
|
|
8691
|
+
}
|
|
8683
8692
|
createDataStructure() {
|
|
8684
8693
|
this.treeDataStructure = new TreeDataStructure({
|
|
8685
8694
|
datasource: this.datasource,
|
|
@@ -9007,14 +9016,6 @@
|
|
|
9007
9016
|
* Array of steppers items
|
|
9008
9017
|
*/
|
|
9009
9018
|
this.items = [];
|
|
9010
|
-
/**
|
|
9011
|
-
* Applies the dark theme variant to the stepper
|
|
9012
|
-
*/
|
|
9013
|
-
this.dark = false;
|
|
9014
|
-
/**
|
|
9015
|
-
* Applies the light theme variant to the stepper
|
|
9016
|
-
*/
|
|
9017
|
-
this.light = false;
|
|
9018
9019
|
/**
|
|
9019
9020
|
* Allow user to jump to any step
|
|
9020
9021
|
*/
|
|
@@ -9026,9 +9027,7 @@
|
|
|
9026
9027
|
this.activeStep = this.getInitValue('activeStep', props.activeStep, this.activeStep);
|
|
9027
9028
|
this.altLabels = this.getInitValue('altLabels', props.altLabels, this.altLabels);
|
|
9028
9029
|
this.content = this.getInitValue('content', props.content, this.content);
|
|
9029
|
-
this.dark = this.getInitValue('dark', props.dark, this.dark);
|
|
9030
9030
|
this.items = this.getInitValue('items', props.items, this.items);
|
|
9031
|
-
this.light = this.getInitValue('light', props.light, this.light);
|
|
9032
9031
|
this.nonLinear = this.getInitValue('nonLinear', props.nonLinear, this.nonLinear);
|
|
9033
9032
|
this.vertical = this.getInitValue('vertical', props.vertical, this.vertical);
|
|
9034
9033
|
this.steps = this.getInitValue('steps', props.steps, this.steps);
|
|
@@ -10191,7 +10190,6 @@
|
|
|
10191
10190
|
if (this.editing)
|
|
10192
10191
|
return;
|
|
10193
10192
|
if (column.editable) {
|
|
10194
|
-
this.selectedRows = [];
|
|
10195
10193
|
this.editing = true;
|
|
10196
10194
|
this.preventRowClick = true;
|
|
10197
10195
|
this.datasource.currentRow = row;
|
|
@@ -10588,6 +10586,12 @@
|
|
|
10588
10586
|
tableColumns: 'mdi-table-headers-eye',
|
|
10589
10587
|
unfold: 'mdi-unfold-more-horizontal',
|
|
10590
10588
|
warning: 'mdi-exclamation',
|
|
10589
|
+
zoom: 'mdi-magnify-scan',
|
|
10590
|
+
zoomIn: 'mdi-plus-circle-outline',
|
|
10591
|
+
zoomPanning: 'mdi-hand-back-right-outline',
|
|
10592
|
+
zoomOut: 'mdi-minus-circle-outline',
|
|
10593
|
+
zoomReset: 'mdi-magnify-close',
|
|
10594
|
+
zoomSelection: 'mdi-magnify-scan',
|
|
10591
10595
|
};
|
|
10592
10596
|
Icons.faIcons = {
|
|
10593
10597
|
alertOctagon: 'fa fa-exclamation-circle',
|
|
@@ -10638,6 +10642,12 @@
|
|
|
10638
10642
|
tableColumns: 'fa fa-columns',
|
|
10639
10643
|
unfold: 'fa fa-sort',
|
|
10640
10644
|
warning: 'fa fa-exclamation',
|
|
10645
|
+
zoom: 'fa fa-search',
|
|
10646
|
+
zoomIn: 'fa fa-search-plus',
|
|
10647
|
+
zoomPanning: 'fa fa-hand-paper',
|
|
10648
|
+
zoomOut: 'fa fa-search-minus',
|
|
10649
|
+
zoomReset: 'fa fa-undo',
|
|
10650
|
+
zoomSelection: 'fa fa-expand',
|
|
10641
10651
|
};
|
|
10642
10652
|
Icons.icons = (() => Icons.mdiIcons)();
|
|
10643
10653
|
|
|
@@ -10914,6 +10924,16 @@
|
|
|
10914
10924
|
WatchURL.originalEvents = new Map();
|
|
10915
10925
|
|
|
10916
10926
|
class BaseReport {
|
|
10927
|
+
constructor() {
|
|
10928
|
+
this.expressionZeedhiToXls = {
|
|
10929
|
+
AVG: 'AVERAGE',
|
|
10930
|
+
COUNT: 'COUNTA',
|
|
10931
|
+
MAX: 'MAX',
|
|
10932
|
+
MIN: 'MIN',
|
|
10933
|
+
SUM: 'SUM',
|
|
10934
|
+
};
|
|
10935
|
+
this.colunmXLS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
10936
|
+
}
|
|
10917
10937
|
buildColumns(columns) {
|
|
10918
10938
|
const widths = {};
|
|
10919
10939
|
let totalWidth;
|
|
@@ -11145,11 +11165,256 @@
|
|
|
11145
11165
|
this.route = '/generateXLS';
|
|
11146
11166
|
}
|
|
11147
11167
|
buildDataset(data, columns) {
|
|
11168
|
+
const result = this.formatRawDataSet(data, columns);
|
|
11169
|
+
return JSON.stringify(result);
|
|
11170
|
+
}
|
|
11171
|
+
// formata o dataset para o formato "cru" xls
|
|
11172
|
+
formatRawDataSet(data, columns) {
|
|
11148
11173
|
const columnNames = columns.map((col) => col.name);
|
|
11149
11174
|
const result = data.reduce((reduced, row) => {
|
|
11150
11175
|
const values = columnNames.map((col) => row[col] || '');
|
|
11151
11176
|
return [...reduced, values];
|
|
11152
11177
|
}, [columnNames]);
|
|
11178
|
+
return result;
|
|
11179
|
+
}
|
|
11180
|
+
buildMetadata(name, title, columns, filter) {
|
|
11181
|
+
const builtCols = this.buildColumns(columns);
|
|
11182
|
+
const builtFilters = this.buildFilter(filter || {});
|
|
11183
|
+
const lang = this.formatLangCode(core.I18n.instance.language);
|
|
11184
|
+
const clientLogo = '';
|
|
11185
|
+
const enterpriseLogo = '';
|
|
11186
|
+
const productLogo = '';
|
|
11187
|
+
const metadataObj = {
|
|
11188
|
+
name,
|
|
11189
|
+
title,
|
|
11190
|
+
lang,
|
|
11191
|
+
clientLogo,
|
|
11192
|
+
enterpriseLogo,
|
|
11193
|
+
productLogo,
|
|
11194
|
+
version: '1.0',
|
|
11195
|
+
words: {
|
|
11196
|
+
Page: core.I18n.translate('PAGE'),
|
|
11197
|
+
Report: core.I18n.translate('REPORT'),
|
|
11198
|
+
Version: core.I18n.translate('VERSION'),
|
|
11199
|
+
},
|
|
11200
|
+
staticData: {},
|
|
11201
|
+
groups: [],
|
|
11202
|
+
reportName: name,
|
|
11203
|
+
widgetLabel: title,
|
|
11204
|
+
orientation: 'PORTRAIT',
|
|
11205
|
+
columns: builtCols,
|
|
11206
|
+
filter: builtFilters,
|
|
11207
|
+
reportXLS: true,
|
|
11208
|
+
xlsMergedCell: [],
|
|
11209
|
+
};
|
|
11210
|
+
return Promise.resolve(JSON.stringify(metadataObj));
|
|
11211
|
+
}
|
|
11212
|
+
}
|
|
11213
|
+
|
|
11214
|
+
// XLS with groups
|
|
11215
|
+
class XLS2Report extends BaseReport {
|
|
11216
|
+
constructor() {
|
|
11217
|
+
super(...arguments);
|
|
11218
|
+
this.route = '/generateXLS';
|
|
11219
|
+
}
|
|
11220
|
+
buildDataset(data, metadata) {
|
|
11221
|
+
const result = this.formatDataSet(metadata, data);
|
|
11222
|
+
return JSON.stringify(result);
|
|
11223
|
+
}
|
|
11224
|
+
buildMetadata(name, title, columns, filter) {
|
|
11225
|
+
const builtCols = this.buildColumns(columns);
|
|
11226
|
+
const builtFilters = this.buildFilter(filter || {});
|
|
11227
|
+
const lang = this.formatLangCode(core.I18n.instance.language);
|
|
11228
|
+
const clientLogo = '';
|
|
11229
|
+
const enterpriseLogo = '';
|
|
11230
|
+
const productLogo = '';
|
|
11231
|
+
const metadataObj = {
|
|
11232
|
+
name,
|
|
11233
|
+
title,
|
|
11234
|
+
lang,
|
|
11235
|
+
clientLogo,
|
|
11236
|
+
enterpriseLogo,
|
|
11237
|
+
productLogo,
|
|
11238
|
+
version: '1.0',
|
|
11239
|
+
words: {
|
|
11240
|
+
Page: core.I18n.translate('PAGE'),
|
|
11241
|
+
Report: core.I18n.translate('REPORT'),
|
|
11242
|
+
Version: core.I18n.translate('VERSION'),
|
|
11243
|
+
},
|
|
11244
|
+
staticData: {},
|
|
11245
|
+
groups: [],
|
|
11246
|
+
reportName: name,
|
|
11247
|
+
widgetLabel: title,
|
|
11248
|
+
orientation: 'PORTRAIT',
|
|
11249
|
+
columns: builtCols,
|
|
11250
|
+
filter: builtFilters,
|
|
11251
|
+
reportXLS: true,
|
|
11252
|
+
xlsMergedCell: [],
|
|
11253
|
+
};
|
|
11254
|
+
return Promise.resolve(JSON.stringify(metadataObj));
|
|
11255
|
+
}
|
|
11256
|
+
// Ordenar o nome das colunas de acordo com seu index, e sempre deixando as colunas agrupadas nas primeiras posições
|
|
11257
|
+
getColumnsName(columns, metaData, lengthGroup) {
|
|
11258
|
+
const columnsNameGroup = metaData.groups.map((row) => row.field);
|
|
11259
|
+
let columnsName = [];
|
|
11260
|
+
const columnsGroupName = [];
|
|
11261
|
+
Object.entries(columns).forEach((row) => {
|
|
11262
|
+
const columnName = row[0];
|
|
11263
|
+
const index = row[1].sequence;
|
|
11264
|
+
if (columnsNameGroup.indexOf(columnName) === -1) {
|
|
11265
|
+
columnsName[index + lengthGroup] = columnName;
|
|
11266
|
+
}
|
|
11267
|
+
else {
|
|
11268
|
+
columnsGroupName.push(columnName);
|
|
11269
|
+
}
|
|
11270
|
+
});
|
|
11271
|
+
columnsName = columnsGroupName.concat(columnsName);
|
|
11272
|
+
columnsName = columnsName.filter((columnName) => typeof columnName === 'string');
|
|
11273
|
+
return columnsName;
|
|
11274
|
+
}
|
|
11275
|
+
// Inicializa alguns valores auxiliares
|
|
11276
|
+
initVars(metaData) {
|
|
11277
|
+
metaData.xlsMergedCell = [];
|
|
11278
|
+
const { columns } = metaData;
|
|
11279
|
+
const lengthGroup = metaData.groups.length;
|
|
11280
|
+
const indexLastGroup = lengthGroup - 1;
|
|
11281
|
+
let columnsName = [];
|
|
11282
|
+
columnsName = this.getColumnsName(columns, metaData, lengthGroup);
|
|
11283
|
+
const rowValues = [];
|
|
11284
|
+
const formatedDataSet = [];
|
|
11285
|
+
const groups = [];
|
|
11286
|
+
groups.groupEnd = {};
|
|
11287
|
+
groups.groupEnd.cellsfunc = {};
|
|
11288
|
+
return {
|
|
11289
|
+
columns, indexLastGroup, columnsName, rowValues, formatedDataSet, groups,
|
|
11290
|
+
};
|
|
11291
|
+
}
|
|
11292
|
+
// formata as expressões da linha
|
|
11293
|
+
formatRowFunc(column, columns, row, index, rowValues, funcXlsParam, groups, indexLastGroup) {
|
|
11294
|
+
let funcXls = funcXlsParam;
|
|
11295
|
+
if ((row[column] === 0 || row[column]) && index !== undefined) {
|
|
11296
|
+
const letter = this.colunmXLS[rowValues.length];
|
|
11297
|
+
funcXls = this.expressionZeedhiToXls[columns[column].expression];
|
|
11298
|
+
const cellsfunc = `${letter + groups[index].init}:${letter}${groups[index].end}`;
|
|
11299
|
+
let expression = '';
|
|
11300
|
+
if (indexLastGroup === index) {
|
|
11301
|
+
expression = `=${funcXls}(${cellsfunc})`;
|
|
11302
|
+
}
|
|
11303
|
+
else {
|
|
11304
|
+
expression = `=${funcXls}(${groups[index].cellsfunc[column]})`;
|
|
11305
|
+
if (index === 0) {
|
|
11306
|
+
if (groups.groupEnd.cellsfunc[column]) {
|
|
11307
|
+
groups.groupEnd.cellsfunc[column] += `,${groups[index].cellsfunc[column]}`;
|
|
11308
|
+
}
|
|
11309
|
+
else {
|
|
11310
|
+
groups.groupEnd.cellsfunc[column] = groups[index].cellsfunc[column];
|
|
11311
|
+
}
|
|
11312
|
+
}
|
|
11313
|
+
groups[index].cellsfunc[column] = null;
|
|
11314
|
+
}
|
|
11315
|
+
rowValues.push(expression);
|
|
11316
|
+
groups.forEach((group, indexGroup) => {
|
|
11317
|
+
if (indexGroup !== indexLastGroup) {
|
|
11318
|
+
if (!group.cellsfunc) {
|
|
11319
|
+
group.cellsfunc = {};
|
|
11320
|
+
}
|
|
11321
|
+
if (group.cellsfunc[column]) {
|
|
11322
|
+
group.cellsfunc[column] += `,${cellsfunc}`;
|
|
11323
|
+
}
|
|
11324
|
+
else {
|
|
11325
|
+
group.cellsfunc[column] = cellsfunc;
|
|
11326
|
+
}
|
|
11327
|
+
}
|
|
11328
|
+
});
|
|
11329
|
+
}
|
|
11330
|
+
else {
|
|
11331
|
+
let cell = row[column];
|
|
11332
|
+
if (row.groupSummary) {
|
|
11333
|
+
const groupEndFunc = groups.groupEnd.cellsfunc;
|
|
11334
|
+
if (groupEndFunc[column]) {
|
|
11335
|
+
funcXls = this.expressionZeedhiToXls[columns[column].expression];
|
|
11336
|
+
cell = `=${funcXls}(${groupEndFunc[column]})`;
|
|
11337
|
+
}
|
|
11338
|
+
}
|
|
11339
|
+
rowValues.push(cell);
|
|
11340
|
+
}
|
|
11341
|
+
}
|
|
11342
|
+
// formata a linha de grupo de acordo com o formato xls2
|
|
11343
|
+
setRowGroup(row, rowValues, groups, metaData, formatedDataSet, columnsName, columns, indexLastGroup) {
|
|
11344
|
+
const label = `${row.groupLabel}:${row.groupValue}`;
|
|
11345
|
+
const index = row.groupIndex;
|
|
11346
|
+
if (row.groupHeader) {
|
|
11347
|
+
rowValues[index] = label;
|
|
11348
|
+
groups[index] = { init: null, end: null };
|
|
11349
|
+
}
|
|
11350
|
+
else if (row.groupFooter) {
|
|
11351
|
+
if (!row.groupLabel) {
|
|
11352
|
+
rowValues.push('Total');
|
|
11353
|
+
}
|
|
11354
|
+
else {
|
|
11355
|
+
rowValues.push(`Total (${label})`);
|
|
11356
|
+
}
|
|
11357
|
+
const funcXls = null;
|
|
11358
|
+
if (groups[index]) {
|
|
11359
|
+
metaData.xlsMergedCell.push({
|
|
11360
|
+
start_row: groups[index].init,
|
|
11361
|
+
start_col: this.colunmXLS[index],
|
|
11362
|
+
end_row: formatedDataSet.length + 2,
|
|
11363
|
+
end_col: this.colunmXLS[index],
|
|
11364
|
+
});
|
|
11365
|
+
}
|
|
11366
|
+
columnsName.forEach((column, columnIndex) => {
|
|
11367
|
+
if (!(row.groupFooter && columnIndex === 0)) {
|
|
11368
|
+
this.formatRowFunc(column, columns, row, index, rowValues, funcXls, groups, indexLastGroup);
|
|
11369
|
+
}
|
|
11370
|
+
});
|
|
11371
|
+
}
|
|
11372
|
+
return rowValues;
|
|
11373
|
+
}
|
|
11374
|
+
// Defina o index dos grupos
|
|
11375
|
+
setIndexGroups(groups, formatedDataSet) {
|
|
11376
|
+
groups.forEach((group) => {
|
|
11377
|
+
if (!group.init) {
|
|
11378
|
+
group.init = formatedDataSet.length + 2;
|
|
11379
|
+
}
|
|
11380
|
+
group.end = formatedDataSet.length + 2;
|
|
11381
|
+
});
|
|
11382
|
+
}
|
|
11383
|
+
// Preenche uma linha "normal"
|
|
11384
|
+
setRowNormal(columnsName, rowValues, row) {
|
|
11385
|
+
columnsName.forEach((column) => {
|
|
11386
|
+
rowValues.push(row[column]);
|
|
11387
|
+
});
|
|
11388
|
+
}
|
|
11389
|
+
formatDataSet(metaData, dataSet) {
|
|
11390
|
+
const initVars = this.initVars(metaData);
|
|
11391
|
+
const { columns, indexLastGroup, columnsName, formatedDataSet, groups, } = initVars;
|
|
11392
|
+
let { rowValues } = initVars;
|
|
11393
|
+
dataSet.forEach((row) => {
|
|
11394
|
+
if (row.group || row.groupFooter) {
|
|
11395
|
+
rowValues = this.setRowGroup(row, rowValues, groups, metaData, formatedDataSet, columnsName, columns, indexLastGroup);
|
|
11396
|
+
}
|
|
11397
|
+
else {
|
|
11398
|
+
this.setIndexGroups(groups, formatedDataSet);
|
|
11399
|
+
this.setRowNormal(columnsName, rowValues, row);
|
|
11400
|
+
}
|
|
11401
|
+
if (!row.groupHeader) {
|
|
11402
|
+
formatedDataSet.push(rowValues);
|
|
11403
|
+
}
|
|
11404
|
+
rowValues = [];
|
|
11405
|
+
});
|
|
11406
|
+
return [columnsName].concat(formatedDataSet);
|
|
11407
|
+
}
|
|
11408
|
+
}
|
|
11409
|
+
|
|
11410
|
+
// Grid mirror (with groups)
|
|
11411
|
+
class XLS3Report extends BaseReport {
|
|
11412
|
+
constructor() {
|
|
11413
|
+
super(...arguments);
|
|
11414
|
+
this.route = '/generateXLS';
|
|
11415
|
+
}
|
|
11416
|
+
buildDataset(data, metadata) {
|
|
11417
|
+
const result = this.formatDataSet(metadata, data);
|
|
11153
11418
|
return JSON.stringify(result);
|
|
11154
11419
|
}
|
|
11155
11420
|
buildMetadata(name, title, columns, filter) {
|
|
@@ -11179,9 +11444,153 @@
|
|
|
11179
11444
|
orientation: 'PORTRAIT',
|
|
11180
11445
|
columns: builtCols,
|
|
11181
11446
|
filter: builtFilters,
|
|
11447
|
+
reportXLS: true,
|
|
11448
|
+
xlsMergedCell: [],
|
|
11182
11449
|
};
|
|
11183
11450
|
return Promise.resolve(JSON.stringify(metadataObj));
|
|
11184
11451
|
}
|
|
11452
|
+
// Ordenar o nome das colunas de acordo com seu index, excluindo o nome das colunas agrupadas
|
|
11453
|
+
getColumnsNameFormat3(columns, metaData) {
|
|
11454
|
+
const columnsNameGroup = metaData.groups.map((row) => row.field);
|
|
11455
|
+
let columnsName = [];
|
|
11456
|
+
Object.entries(columns).forEach((row) => {
|
|
11457
|
+
const columnName = row[0];
|
|
11458
|
+
if (columnsNameGroup.indexOf(columnName) === -1) {
|
|
11459
|
+
const index = row[1].sequence;
|
|
11460
|
+
columnsName[index] = columnName;
|
|
11461
|
+
}
|
|
11462
|
+
});
|
|
11463
|
+
columnsName = columnsName.filter((columnName) => typeof columnName === 'string');
|
|
11464
|
+
return columnsName;
|
|
11465
|
+
}
|
|
11466
|
+
// Inicializa alguns valores auxiliares
|
|
11467
|
+
initVars(metaData) {
|
|
11468
|
+
metaData.xlsMergedCell = [];
|
|
11469
|
+
const { columns } = metaData;
|
|
11470
|
+
const lengthGroup = metaData.groups.length;
|
|
11471
|
+
const indexLastGroup = lengthGroup - 1;
|
|
11472
|
+
let columnsName = [];
|
|
11473
|
+
columnsName = this.getColumnsNameFormat3(columns, metaData);
|
|
11474
|
+
const rowValues = [];
|
|
11475
|
+
const formatedDataSet = [];
|
|
11476
|
+
const groups = [];
|
|
11477
|
+
groups.groupEnd = {};
|
|
11478
|
+
groups.groupEnd.cellsfunc = {};
|
|
11479
|
+
return {
|
|
11480
|
+
columns, indexLastGroup, columnsName, rowValues, formatedDataSet, groups,
|
|
11481
|
+
};
|
|
11482
|
+
}
|
|
11483
|
+
// formata a linha do grupo de acordo com o formato xls3
|
|
11484
|
+
setRowGroupFormat(row, rowValuesParam, groups, formatedDataSet, columnsName, columns, indexLastGroup) {
|
|
11485
|
+
let rowValues = rowValuesParam;
|
|
11486
|
+
const label = `${row.groupLabel}:${row.groupValue}`;
|
|
11487
|
+
const index = row.groupIndex;
|
|
11488
|
+
if (row.groupHeader) {
|
|
11489
|
+
rowValues[index] = label;
|
|
11490
|
+
groups[index] = { init: null, end: null };
|
|
11491
|
+
formatedDataSet.push(rowValues);
|
|
11492
|
+
rowValues = [];
|
|
11493
|
+
}
|
|
11494
|
+
else if (row.groupFooter) {
|
|
11495
|
+
if (!row.groupLabel) {
|
|
11496
|
+
rowValues.push('Total');
|
|
11497
|
+
}
|
|
11498
|
+
else {
|
|
11499
|
+
rowValues.push(`Total (${label})`);
|
|
11500
|
+
}
|
|
11501
|
+
formatedDataSet.push(rowValues);
|
|
11502
|
+
rowValues = [];
|
|
11503
|
+
const funcXls = null;
|
|
11504
|
+
columnsName.forEach((column) => {
|
|
11505
|
+
this.formatRowFunc(column, columns, row, index, rowValues, funcXls, groups, indexLastGroup);
|
|
11506
|
+
});
|
|
11507
|
+
}
|
|
11508
|
+
return rowValues;
|
|
11509
|
+
}
|
|
11510
|
+
// formata as expressões da linha
|
|
11511
|
+
formatRowFunc(column, columns, row, index, rowValues, funcXlsParam, groups, indexLastGroup) {
|
|
11512
|
+
let funcXls = funcXlsParam;
|
|
11513
|
+
if ((row[column] === 0 || row[column]) && index !== undefined) {
|
|
11514
|
+
const letter = this.colunmXLS[rowValues.length];
|
|
11515
|
+
funcXls = this.expressionZeedhiToXls[columns[column].expression];
|
|
11516
|
+
const cellsfunc = `${letter + groups[index].init}:${letter}${groups[index].end}`;
|
|
11517
|
+
let expression = '';
|
|
11518
|
+
if (indexLastGroup === index) {
|
|
11519
|
+
expression = `=${funcXls}(${cellsfunc})`;
|
|
11520
|
+
}
|
|
11521
|
+
else {
|
|
11522
|
+
expression = `=${funcXls}(${groups[index].cellsfunc[column]})`;
|
|
11523
|
+
if (index === 0) {
|
|
11524
|
+
if (groups.groupEnd.cellsfunc[column]) {
|
|
11525
|
+
groups.groupEnd.cellsfunc[column] += `,${groups[index].cellsfunc[column]}`;
|
|
11526
|
+
}
|
|
11527
|
+
else {
|
|
11528
|
+
groups.groupEnd.cellsfunc[column] = groups[index].cellsfunc[column];
|
|
11529
|
+
}
|
|
11530
|
+
}
|
|
11531
|
+
groups[index].cellsfunc[column] = null;
|
|
11532
|
+
}
|
|
11533
|
+
rowValues.push(expression);
|
|
11534
|
+
groups.forEach((group, indexGroup) => {
|
|
11535
|
+
if (indexGroup !== indexLastGroup) {
|
|
11536
|
+
if (!group.cellsfunc) {
|
|
11537
|
+
group.cellsfunc = {};
|
|
11538
|
+
}
|
|
11539
|
+
if (group.cellsfunc[column]) {
|
|
11540
|
+
group.cellsfunc[column] += `,${cellsfunc}`;
|
|
11541
|
+
}
|
|
11542
|
+
else {
|
|
11543
|
+
group.cellsfunc[column] = cellsfunc;
|
|
11544
|
+
}
|
|
11545
|
+
}
|
|
11546
|
+
});
|
|
11547
|
+
}
|
|
11548
|
+
else {
|
|
11549
|
+
let cell = row[column];
|
|
11550
|
+
if (row.groupSummary) {
|
|
11551
|
+
const groupEndFunc = groups.groupEnd.cellsfunc;
|
|
11552
|
+
if (groupEndFunc[column]) {
|
|
11553
|
+
funcXls = this.expressionZeedhiToXls[columns[column].expression];
|
|
11554
|
+
cell = `=${funcXls}(${groupEndFunc[column]})`;
|
|
11555
|
+
}
|
|
11556
|
+
}
|
|
11557
|
+
rowValues.push(cell);
|
|
11558
|
+
}
|
|
11559
|
+
}
|
|
11560
|
+
// Defina o index dos grupos
|
|
11561
|
+
setIndexGroups(groups, formatedDataSet) {
|
|
11562
|
+
groups.forEach((group) => {
|
|
11563
|
+
if (!group.init) {
|
|
11564
|
+
group.init = formatedDataSet.length + 2;
|
|
11565
|
+
}
|
|
11566
|
+
group.end = formatedDataSet.length + 2;
|
|
11567
|
+
});
|
|
11568
|
+
}
|
|
11569
|
+
// Preenche uma linha "normal"
|
|
11570
|
+
setRowNormal(columnsName, rowValues, row) {
|
|
11571
|
+
columnsName.forEach((column) => {
|
|
11572
|
+
rowValues.push(row[column]);
|
|
11573
|
+
});
|
|
11574
|
+
}
|
|
11575
|
+
formatDataSet(metaData, dataSet) {
|
|
11576
|
+
const initVars = this.initVars(metaData);
|
|
11577
|
+
const { columns, indexLastGroup, columnsName, formatedDataSet, groups, } = initVars;
|
|
11578
|
+
let { rowValues } = initVars;
|
|
11579
|
+
dataSet.forEach((row) => {
|
|
11580
|
+
if (row.group || row.groupFooter) {
|
|
11581
|
+
rowValues = this.setRowGroupFormat(row, rowValues, groups, formatedDataSet, columnsName, columns, indexLastGroup);
|
|
11582
|
+
}
|
|
11583
|
+
else {
|
|
11584
|
+
this.setIndexGroups(groups, formatedDataSet);
|
|
11585
|
+
this.setRowNormal(columnsName, rowValues, row);
|
|
11586
|
+
}
|
|
11587
|
+
if (!row.groupHeader) {
|
|
11588
|
+
formatedDataSet.push(rowValues);
|
|
11589
|
+
}
|
|
11590
|
+
rowValues = [];
|
|
11591
|
+
});
|
|
11592
|
+
return [columnsName].concat(formatedDataSet);
|
|
11593
|
+
}
|
|
11185
11594
|
}
|
|
11186
11595
|
|
|
11187
11596
|
class Report {
|
|
@@ -11220,6 +11629,12 @@
|
|
|
11220
11629
|
if (type === 'xls') {
|
|
11221
11630
|
return new XLSReport();
|
|
11222
11631
|
}
|
|
11632
|
+
if (type === 'xls2') {
|
|
11633
|
+
return new XLS2Report();
|
|
11634
|
+
}
|
|
11635
|
+
if (type === 'xls3') {
|
|
11636
|
+
return new XLS3Report();
|
|
11637
|
+
}
|
|
11223
11638
|
throw new Error(`Invalid report type: ${type}`);
|
|
11224
11639
|
}
|
|
11225
11640
|
getReport(type, portrait = true, rowObj) {
|
|
@@ -11233,9 +11648,18 @@
|
|
|
11233
11648
|
const reportType = this.getReportType(type);
|
|
11234
11649
|
const { route } = reportType;
|
|
11235
11650
|
const { name, columns, datasource } = this.iterable;
|
|
11651
|
+
const { groupedData } = Object.assign({}, this.iterable);
|
|
11236
11652
|
const formattedColumns = this.removeActionColumns(columns);
|
|
11237
|
-
const dataset = reportType.buildDataset(data, formattedColumns);
|
|
11238
11653
|
const metadataObj = yield reportType.buildMetadata(name, this.title, formattedColumns, datasource.filter, portrait);
|
|
11654
|
+
let dataset;
|
|
11655
|
+
if ((reportType instanceof XLS2Report || reportType instanceof XLS3Report) && groupedData) {
|
|
11656
|
+
const rowMetadata = rowObj.metaData;
|
|
11657
|
+
const metadataObjClone = merge__default["default"](rowMetadata, JSON.parse(metadataObj));
|
|
11658
|
+
dataset = reportType.buildDataset(groupedData, metadataObjClone);
|
|
11659
|
+
}
|
|
11660
|
+
else {
|
|
11661
|
+
dataset = reportType.buildDataset(data, formattedColumns);
|
|
11662
|
+
}
|
|
11239
11663
|
const filter = '[]';
|
|
11240
11664
|
let row = {};
|
|
11241
11665
|
if (rowObj) {
|
|
@@ -11375,6 +11799,8 @@
|
|
|
11375
11799
|
exports.TreeGrid = TreeGrid;
|
|
11376
11800
|
exports.TreeGridEditable = TreeGridEditable;
|
|
11377
11801
|
exports.WatchURL = WatchURL;
|
|
11802
|
+
exports.XLS2Report = XLS2Report;
|
|
11803
|
+
exports.XLS3Report = XLS3Report;
|
|
11378
11804
|
exports.XLSReport = XLSReport;
|
|
11379
11805
|
exports.initTheme = initTheme;
|
|
11380
11806
|
|