@zeedhi/common 1.38.0 → 1.40.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 +590 -169
- package/dist/zd-common.umd.js +591 -168
- package/package.json +2 -2
- package/types/components/zd-alert/alert.d.ts +2 -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-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-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 +13 -1
- package/types/components/zd-select-tree-multiple/select-tree-multiple.d.ts +4 -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.esm.js
CHANGED
|
@@ -48,6 +48,14 @@ class Component {
|
|
|
48
48
|
* Controls component visibility.
|
|
49
49
|
*/
|
|
50
50
|
this.isVisible = true;
|
|
51
|
+
/**
|
|
52
|
+
* Applies the dark theme variant to the component.
|
|
53
|
+
*/
|
|
54
|
+
this.dark = false;
|
|
55
|
+
/**
|
|
56
|
+
* Applies the light theme variant to the component.
|
|
57
|
+
*/
|
|
58
|
+
this.light = false;
|
|
51
59
|
/**
|
|
52
60
|
* Define component key mapping
|
|
53
61
|
*/
|
|
@@ -63,6 +71,8 @@ class Component {
|
|
|
63
71
|
this.cssClass = this.getInitValue('cssClass', props.cssClass, this.cssClass);
|
|
64
72
|
this.cssStyle = this.getInitValue('cssStyle', props.cssStyle, this.cssStyle);
|
|
65
73
|
this.isVisible = this.getInitValue('isVisible', props.isVisible, this.isVisible);
|
|
74
|
+
this.dark = this.getInitValue('dark', props.dark, this.dark);
|
|
75
|
+
this.light = this.getInitValue('light', props.light, this.light);
|
|
66
76
|
this.children = Array.isArray(props.children) ? props.children : this.children;
|
|
67
77
|
this.keyMap = KeyMap.factory(props.keyMap || this.keyMap);
|
|
68
78
|
this.createAccessors();
|
|
@@ -298,6 +308,8 @@ class Alert extends Component {
|
|
|
298
308
|
this.vertical = false;
|
|
299
309
|
this.defaultValues = {
|
|
300
310
|
name: this.name,
|
|
311
|
+
dark: this.dark,
|
|
312
|
+
light: this.light,
|
|
301
313
|
color: this.color,
|
|
302
314
|
text: this.text,
|
|
303
315
|
timeout: this.timeout,
|
|
@@ -322,6 +334,8 @@ class Alert extends Component {
|
|
|
322
334
|
assignAlertProperties(alert) {
|
|
323
335
|
this.name = this.getInitValue('name', alert.name, this.defaultValues.name);
|
|
324
336
|
this.color = this.getInitValue('color', alert.color, this.defaultValues.color);
|
|
337
|
+
this.dark = this.getInitValue('dark', alert.dark, this.defaultValues.dark);
|
|
338
|
+
this.light = this.getInitValue('light', alert.light, this.defaultValues.light);
|
|
325
339
|
this.text = this.getInitValue('text', alert.text, this.defaultValues.text);
|
|
326
340
|
this.timeout = this.getInitValue('timeout', alert.timeout, this.defaultValues.timeout);
|
|
327
341
|
this.type = this.getInitValue('type', alert.type, this.defaultValues.type);
|
|
@@ -492,10 +506,6 @@ class Breadcrumbs extends ComponentRender {
|
|
|
492
506
|
*/
|
|
493
507
|
constructor(props) {
|
|
494
508
|
super(props);
|
|
495
|
-
/**
|
|
496
|
-
* Applies the dark theme variant to the component.
|
|
497
|
-
*/
|
|
498
|
-
this.dark = false;
|
|
499
509
|
/**
|
|
500
510
|
* Specifies the dividing string between items.
|
|
501
511
|
*/
|
|
@@ -512,19 +522,13 @@ class Breadcrumbs extends ComponentRender {
|
|
|
512
522
|
* Increase the font-size of the breadcrumb item text to 16px.
|
|
513
523
|
*/
|
|
514
524
|
this.large = false;
|
|
515
|
-
/**
|
|
516
|
-
* Applies the light theme variant to the component.
|
|
517
|
-
*/
|
|
518
|
-
this.light = true;
|
|
519
525
|
/**
|
|
520
526
|
* Decrease the font-size of the breadcrumb item text to 12px.
|
|
521
527
|
*/
|
|
522
528
|
this.small = false;
|
|
523
|
-
this.dark = this.getInitValue('dark', props.dark, this.dark);
|
|
524
529
|
this.divider = this.getInitValue('divider', props.divider, this.divider);
|
|
525
530
|
this.items = this.getInitValue('items', props.items, this.items);
|
|
526
531
|
this.large = this.getInitValue('large', props.large, this.large);
|
|
527
|
-
this.light = this.getInitValue('light', props.light, this.light);
|
|
528
532
|
this.iconName = this.getInitValue('iconName', props.iconName, this.iconName);
|
|
529
533
|
this.small = this.getInitValue('small', props.small, this.small);
|
|
530
534
|
this.createAccessors();
|
|
@@ -560,10 +564,6 @@ class Button extends ComponentRender {
|
|
|
560
564
|
* It can be the name of material or css color in hexa
|
|
561
565
|
*/
|
|
562
566
|
this.color = 'primary';
|
|
563
|
-
/**
|
|
564
|
-
* Applies the dark theme variant to the button
|
|
565
|
-
*/
|
|
566
|
-
this.dark = false;
|
|
567
567
|
/**
|
|
568
568
|
* Removes the ability to click or target the button
|
|
569
569
|
*/
|
|
@@ -605,10 +605,6 @@ class Button extends ComponentRender {
|
|
|
605
605
|
* This should be used with the absolute or fixed props
|
|
606
606
|
*/
|
|
607
607
|
this.left = false;
|
|
608
|
-
/**
|
|
609
|
-
* Applies the light theme variant to the button
|
|
610
|
-
*/
|
|
611
|
-
this.light = false;
|
|
612
608
|
/**
|
|
613
609
|
* Makes the background transparent and applies a thin border
|
|
614
610
|
*/
|
|
@@ -711,10 +707,6 @@ class ButtonGroup extends ComponentRender {
|
|
|
711
707
|
* It can be the name of material or css color in hexa
|
|
712
708
|
*/
|
|
713
709
|
this.color = 'primary';
|
|
714
|
-
/**
|
|
715
|
-
* Applies the dark theme variant to the component.
|
|
716
|
-
*/
|
|
717
|
-
this.dark = false;
|
|
718
710
|
/**
|
|
719
711
|
* Reduces the button size and padding.
|
|
720
712
|
*/
|
|
@@ -724,10 +716,6 @@ class ButtonGroup extends ComponentRender {
|
|
|
724
716
|
* space between the buttons
|
|
725
717
|
*/
|
|
726
718
|
this.group = false;
|
|
727
|
-
/**
|
|
728
|
-
* Applies the light theme variant to the component.
|
|
729
|
-
*/
|
|
730
|
-
this.light = false;
|
|
731
719
|
/**
|
|
732
720
|
* Applies mandatory selected button
|
|
733
721
|
*/
|
|
@@ -761,10 +749,8 @@ class ButtonGroup extends ComponentRender {
|
|
|
761
749
|
this.backgroundColor = this.getInitValue('backgroundColor', props.backgroundColor, this.backgroundColor);
|
|
762
750
|
this.borderless = this.getInitValue('block', props.borderless, this.borderless);
|
|
763
751
|
this.color = this.getInitValue('color', props.color, this.color);
|
|
764
|
-
this.dark = this.getInitValue('dark', props.dark, this.dark);
|
|
765
752
|
this.dense = this.getInitValue('disabled', props.dense, this.dense);
|
|
766
753
|
this.group = this.getInitValue('group', props.group, this.group);
|
|
767
|
-
this.light = this.getInitValue('light', props.light, this.light);
|
|
768
754
|
this.mandatory = this.getInitValue('mandatory', props.mandatory, this.mandatory);
|
|
769
755
|
this.multiple = this.getInitValue('multiple', props.multiple, this.multiple);
|
|
770
756
|
this.rounded = this.getInitValue('rounded', props.rounded, this.rounded);
|
|
@@ -818,10 +804,6 @@ class Carousel extends ComponentRender {
|
|
|
818
804
|
* a non-integer number in slidesPerView, like 1.5)
|
|
819
805
|
*/
|
|
820
806
|
this.center = false;
|
|
821
|
-
/**
|
|
822
|
-
* Applies the dark theme variant to the carousel pagination
|
|
823
|
-
*/
|
|
824
|
-
this.dark = false;
|
|
825
807
|
/**
|
|
826
808
|
* Displays the pagination as a fraction in the following format: currentSlide/slidesCount.
|
|
827
809
|
* Only works when <code>showPagination</code> property is true
|
|
@@ -848,10 +830,6 @@ class Carousel extends ComponentRender {
|
|
|
848
830
|
* Allows controlling the carousel using the keyboard arrow keys
|
|
849
831
|
*/
|
|
850
832
|
this.keysControl = true;
|
|
851
|
-
/**
|
|
852
|
-
* Applies the light theme variant to the carousel
|
|
853
|
-
*/
|
|
854
|
-
this.light = true;
|
|
855
833
|
/**
|
|
856
834
|
* Allows controlling the carousel using mouse drag
|
|
857
835
|
*/
|
|
@@ -926,14 +904,12 @@ class Carousel extends ComponentRender {
|
|
|
926
904
|
this.autoPlay = this.getInitValue('autoPlay', props.autoPlay, this.autoPlay);
|
|
927
905
|
this.buttonsOutside = this.getInitValue('buttonsOutside', props.buttonsOutside, this.buttonsOutside);
|
|
928
906
|
this.center = this.getInitValue('center', props.center, this.center);
|
|
929
|
-
this.dark = this.getInitValue('dark', props.dark, this.dark);
|
|
930
907
|
this.height = this.getInitValue('height', props.height, this.height);
|
|
931
908
|
this.infiniteScroll = this.getInitValue('infiniteScroll', props.infiniteScroll, this.infiniteScroll);
|
|
932
909
|
this.initialSlide = this.getInitValue('initialSlide', props.initialSlide, this.initialSlide);
|
|
933
910
|
this.currentSlide = this.getInitValue('currentSlide', props.currentSlide, this.initialSlide);
|
|
934
911
|
this.interval = this.getInitValue('interval', props.interval, this.interval);
|
|
935
912
|
this.keysControl = this.getInitValue('keysControl', props.keysControl, this.keysControl);
|
|
936
|
-
this.light = this.getInitValue('light', props.light, this.light);
|
|
937
913
|
this.mouseControl = this.getInitValue('mouseControl', props.mouseControl, this.mouseControl);
|
|
938
914
|
this.nextButton = props.nextButton || this.nextButton;
|
|
939
915
|
this.fractionPagination = this.getInitValue('fractionPagination', props.fractionPagination, this.fractionPagination);
|
|
@@ -1048,10 +1024,6 @@ class Card extends ComponentRender {
|
|
|
1048
1024
|
* Applies specified color to the control. It can be the name of material color
|
|
1049
1025
|
*/
|
|
1050
1026
|
this.color = '';
|
|
1051
|
-
/**
|
|
1052
|
-
* Applies the dark theme variant to the component
|
|
1053
|
-
*/
|
|
1054
|
-
this.dark = false;
|
|
1055
1027
|
/**
|
|
1056
1028
|
* Removes the ability to click or target the component
|
|
1057
1029
|
*/
|
|
@@ -1068,10 +1040,6 @@ class Card extends ComponentRender {
|
|
|
1068
1040
|
* Specifies an image background for the card
|
|
1069
1041
|
*/
|
|
1070
1042
|
this.img = '';
|
|
1071
|
-
/**
|
|
1072
|
-
* Applies the light theme variant to the component
|
|
1073
|
-
*/
|
|
1074
|
-
this.light = false;
|
|
1075
1043
|
/**
|
|
1076
1044
|
* Designates that the card is a link
|
|
1077
1045
|
*/
|
|
@@ -1095,7 +1063,6 @@ class Card extends ComponentRender {
|
|
|
1095
1063
|
this.activeClass = this.getInitValue('activeClass', props.activeClass, this.activeClass);
|
|
1096
1064
|
this.append = this.getInitValue('append', props.append, this.append);
|
|
1097
1065
|
this.color = this.getInitValue('color', props.color, this.color);
|
|
1098
|
-
this.dark = this.getInitValue('dark', props.dark, this.dark);
|
|
1099
1066
|
this.disabled = this.getInitValue('disabled', props.disabled, this.disabled);
|
|
1100
1067
|
this.elevation = this.getInitValue('elevation', props.elevation, this.elevation);
|
|
1101
1068
|
this.flat = this.getInitValue('flat', props.flat, this.flat);
|
|
@@ -1103,7 +1070,6 @@ class Card extends ComponentRender {
|
|
|
1103
1070
|
this.hover = this.getInitValue('hover', props.hover, this.hover);
|
|
1104
1071
|
this.href = this.getInitValue('href', props.href, this.href);
|
|
1105
1072
|
this.img = this.getInitValue('img', props.img, this.img);
|
|
1106
|
-
this.light = this.getInitValue('light', props.light, this.light);
|
|
1107
1073
|
this.link = this.getInitValue('link', props.link, this.link);
|
|
1108
1074
|
this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
|
|
1109
1075
|
this.maxWidth = this.getInitValue('maxWidth', props.maxWidth, this.maxWidth);
|
|
@@ -1316,10 +1282,6 @@ class Input extends ComponentRender {
|
|
|
1316
1282
|
* It can be the name of material or css color in hexa.
|
|
1317
1283
|
*/
|
|
1318
1284
|
this.color = 'primary';
|
|
1319
|
-
/**
|
|
1320
|
-
* Applies the dark theme variant to the input.
|
|
1321
|
-
*/
|
|
1322
|
-
this.dark = false;
|
|
1323
1285
|
/**
|
|
1324
1286
|
* Defines smaller input.
|
|
1325
1287
|
*/
|
|
@@ -1336,10 +1298,6 @@ class Input extends ComponentRender {
|
|
|
1336
1298
|
* Defines the input label.
|
|
1337
1299
|
*/
|
|
1338
1300
|
this.label = '';
|
|
1339
|
-
/**
|
|
1340
|
-
* Applies the light theme variant to the input.
|
|
1341
|
-
*/
|
|
1342
|
-
this.light = false;
|
|
1343
1301
|
/**
|
|
1344
1302
|
* Applies a custom character mask to the input.
|
|
1345
1303
|
*/
|
|
@@ -1408,13 +1366,11 @@ class Input extends ComponentRender {
|
|
|
1408
1366
|
this.autofocus = this.getInitValue('autofocus', props.autofocus, this.autofocus);
|
|
1409
1367
|
this.clearable = this.getInitValue('clearable', props.clearable, this.clearable);
|
|
1410
1368
|
this.color = this.getInitValue('color', props.color, this.color);
|
|
1411
|
-
this.dark = this.getInitValue('dark', props.dark, this.dark);
|
|
1412
1369
|
this.dense = this.getInitValue('dense', props.dense, this.dense);
|
|
1413
1370
|
this.disabled = this.getInitValue('disabled', props.disabled, this.disabled);
|
|
1414
1371
|
this.hint = this.getInitValue('hint', props.hint, this.hint);
|
|
1415
1372
|
this.autoHintDetails = this.getInitValue('autoHintDetails', props.autoHintDetails, this.autoHintDetails);
|
|
1416
1373
|
this.label = this.getInitValue('label', props.label, this.label);
|
|
1417
|
-
this.light = this.getInitValue('light', props.light, this.light);
|
|
1418
1374
|
this.mask = this.getInitValue('mask', props.mask, this.mask);
|
|
1419
1375
|
this.maxLength = this.getInitValue('maxLength', props.maxLength, this.maxLength);
|
|
1420
1376
|
this.persistentHint = this.getInitValue('persistentHint', props.persistentHint, this.persistentHint);
|
|
@@ -3672,18 +3628,10 @@ class Divider extends ComponentRender {
|
|
|
3672
3628
|
*/
|
|
3673
3629
|
constructor(props) {
|
|
3674
3630
|
super(props);
|
|
3675
|
-
/**
|
|
3676
|
-
* Applies the dark theme variant to the component.
|
|
3677
|
-
*/
|
|
3678
|
-
this.dark = false;
|
|
3679
3631
|
/**
|
|
3680
3632
|
* Adds indentation (72px) for normal dividers, reduces max height for vertical.
|
|
3681
3633
|
*/
|
|
3682
3634
|
this.inset = false;
|
|
3683
|
-
/**
|
|
3684
|
-
* Applies the light theme variant to the component.
|
|
3685
|
-
*/
|
|
3686
|
-
this.light = false;
|
|
3687
3635
|
/**
|
|
3688
3636
|
* Displays dividers vertically.
|
|
3689
3637
|
*/
|
|
@@ -3953,10 +3901,6 @@ class Footer extends ComponentRender {
|
|
|
3953
3901
|
* Applies specified color to the control. It can be the name of material or css color in hexa.
|
|
3954
3902
|
*/
|
|
3955
3903
|
this.color = 'primary';
|
|
3956
|
-
/**
|
|
3957
|
-
* Applies the dark theme variant to footer.
|
|
3958
|
-
*/
|
|
3959
|
-
this.dark = false;
|
|
3960
3904
|
/**
|
|
3961
3905
|
* Applies position fixed to footer.
|
|
3962
3906
|
*/
|
|
@@ -3973,10 +3917,6 @@ class Footer extends ComponentRender {
|
|
|
3973
3917
|
* Render components on the left of footer.
|
|
3974
3918
|
*/
|
|
3975
3919
|
this.leftSlot = [];
|
|
3976
|
-
/**
|
|
3977
|
-
* Applies the light theme variant to the footer.
|
|
3978
|
-
*/
|
|
3979
|
-
this.light = false;
|
|
3980
3920
|
/**
|
|
3981
3921
|
* Remove all padding from the footer.
|
|
3982
3922
|
*/
|
|
@@ -4313,11 +4253,11 @@ class Column extends Component {
|
|
|
4313
4253
|
* Apply conditions
|
|
4314
4254
|
* @param row Datasource row
|
|
4315
4255
|
*/
|
|
4316
|
-
applyCondition(row) {
|
|
4256
|
+
applyCondition(row, factoredConditions = this.factoredConditions) {
|
|
4317
4257
|
const appliedConditions = {};
|
|
4318
|
-
Object.keys(
|
|
4319
|
-
const conditionFunction =
|
|
4320
|
-
set(appliedConditions, condition, conditionFunction({ row }));
|
|
4258
|
+
Object.keys(factoredConditions).forEach((condition) => {
|
|
4259
|
+
const conditionFunction = factoredConditions[condition];
|
|
4260
|
+
set(appliedConditions, condition, conditionFunction({ row, column: this }));
|
|
4321
4261
|
});
|
|
4322
4262
|
return appliedConditions;
|
|
4323
4263
|
}
|
|
@@ -4331,11 +4271,7 @@ class Column extends Component {
|
|
|
4331
4271
|
const appliedConditions = {};
|
|
4332
4272
|
Object.keys(this.actionFactoredConditions).forEach((action) => {
|
|
4333
4273
|
const factoredConditions = this.actionFactoredConditions[action];
|
|
4334
|
-
appliedConditions[action] = {};
|
|
4335
|
-
Object.keys(factoredConditions).forEach((condition) => {
|
|
4336
|
-
const conditionFunction = factoredConditions[condition];
|
|
4337
|
-
set(appliedConditions[action], condition, conditionFunction({ row }));
|
|
4338
|
-
});
|
|
4274
|
+
appliedConditions[action] = Object.assign({}, this.applyCondition(row, factoredConditions));
|
|
4339
4275
|
});
|
|
4340
4276
|
return appliedConditions;
|
|
4341
4277
|
}
|
|
@@ -4713,7 +4649,11 @@ class Grid extends Iterable {
|
|
|
4713
4649
|
/**
|
|
4714
4650
|
* Color of the header background
|
|
4715
4651
|
*/
|
|
4716
|
-
this.headerBackground = '
|
|
4652
|
+
this.headerBackground = '';
|
|
4653
|
+
/**
|
|
4654
|
+
* Color of the header cell text color
|
|
4655
|
+
*/
|
|
4656
|
+
this.headerCellTextColor = '';
|
|
4717
4657
|
/**
|
|
4718
4658
|
* Available order types
|
|
4719
4659
|
* @public
|
|
@@ -4757,6 +4697,8 @@ class Grid extends Iterable {
|
|
|
4757
4697
|
},
|
|
4758
4698
|
};
|
|
4759
4699
|
this.dense = this.getInitValue('dense', props.dense, this.dense);
|
|
4700
|
+
this.dark = this.getInitValue('dark', props.dark, this.dark);
|
|
4701
|
+
this.light = this.getInitValue('light', props.light, this.light);
|
|
4760
4702
|
this.selectable = this.getInitValue('selectable', props.selectable, this.selectable);
|
|
4761
4703
|
this.height = this.getInitValue('height', props.height, this.height);
|
|
4762
4704
|
this.fillHeight = this.getInitValue('fillHeight', props.fillHeight, this.fillHeight);
|
|
@@ -4766,6 +4708,7 @@ class Grid extends Iterable {
|
|
|
4766
4708
|
this.showFooter = this.getInitValue('showFooter', props.showFooter, this.showFooter);
|
|
4767
4709
|
this.showHeader = this.getInitValue('showHeader', props.showHeader, this.showHeader);
|
|
4768
4710
|
this.headerBackground = this.getInitValue('headerBackground', props.headerBackground, this.headerBackground);
|
|
4711
|
+
this.headerCellTextColor = this.getInitValue('headerCellTextColor', props.headerCellTextColor, this.headerCellTextColor);
|
|
4769
4712
|
this.dragColumns = this.getInitValue('dragColumns', props.dragColumns, this.dragColumns);
|
|
4770
4713
|
this.resizeColumns = this.getInitValue('resizeColumns', props.resizeColumns, this.resizeColumns);
|
|
4771
4714
|
this.toolbarSlot = props.toolbarSlot || this.toolbarSlot;
|
|
@@ -5068,7 +5011,6 @@ class GridEditable extends Grid {
|
|
|
5068
5011
|
if (this.editing)
|
|
5069
5012
|
return;
|
|
5070
5013
|
if (column.editable) {
|
|
5071
|
-
this.selectedRows = [];
|
|
5072
5014
|
this.editing = true;
|
|
5073
5015
|
this.preventRowClick = true;
|
|
5074
5016
|
this.datasource.currentRow = row;
|
|
@@ -5138,7 +5080,7 @@ class GridEditable extends Grid {
|
|
|
5138
5080
|
else {
|
|
5139
5081
|
colValue = row[column.name];
|
|
5140
5082
|
}
|
|
5141
|
-
const componentProps = merge({}, column.componentProps, cellProps.componentProps);
|
|
5083
|
+
const componentProps = merge({}, column.componentProps, cellProps === null || cellProps === void 0 ? void 0 : cellProps.componentProps);
|
|
5142
5084
|
let compEvents = {};
|
|
5143
5085
|
if (componentProps && componentProps.events) {
|
|
5144
5086
|
compEvents = Event.factory(componentProps.events);
|
|
@@ -5425,10 +5367,6 @@ class Header extends ComponentRender {
|
|
|
5425
5367
|
* Applies specified color to the control. It can be the name of material or css color in hexa.
|
|
5426
5368
|
*/
|
|
5427
5369
|
this.color = 'primary';
|
|
5428
|
-
/**
|
|
5429
|
-
* Applies the dark theme variant to header.
|
|
5430
|
-
*/
|
|
5431
|
-
this.dark = false;
|
|
5432
5370
|
/**
|
|
5433
5371
|
* Designates that the application menu positioned on the left is below the header.
|
|
5434
5372
|
*/
|
|
@@ -5453,10 +5391,6 @@ class Header extends ComponentRender {
|
|
|
5453
5391
|
* Render components on the left of header.
|
|
5454
5392
|
*/
|
|
5455
5393
|
this.leftSlot = [];
|
|
5456
|
-
/**
|
|
5457
|
-
* Applies the light theme variant to the header.
|
|
5458
|
-
*/
|
|
5459
|
-
this.light = false;
|
|
5460
5394
|
/**
|
|
5461
5395
|
* Removes internal padding from header.
|
|
5462
5396
|
*/
|
|
@@ -5471,13 +5405,11 @@ class Header extends ComponentRender {
|
|
|
5471
5405
|
this.clippedLeft = this.getInitValue('clippedLeft', props.clippedLeft, this.clippedLeft);
|
|
5472
5406
|
this.clippedRight = this.getInitValue('clippedRight', props.clippedRight, this.clippedRight);
|
|
5473
5407
|
this.color = this.getInitValue('color', props.color, this.color);
|
|
5474
|
-
this.dark = this.getInitValue('dark', props.dark, this.dark);
|
|
5475
5408
|
this.dense = this.getInitValue('dense', props.dense, this.dense);
|
|
5476
5409
|
this.elevation = this.getInitValue('elevation', props.elevation, this.elevation);
|
|
5477
5410
|
this.fixed = this.getInitValue('fixed', props.fixed, this.fixed);
|
|
5478
5411
|
this.height = this.getInitValue('height', props.height, this.height);
|
|
5479
5412
|
this.leftSlot = props.leftSlot || this.leftSlot;
|
|
5480
|
-
this.light = this.getInitValue('light', props.light, this.light);
|
|
5481
5413
|
this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
|
|
5482
5414
|
this.maxWidth = this.getInitValue('maxWidth', props.maxWidth, this.maxWidth);
|
|
5483
5415
|
this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
|
|
@@ -5511,10 +5443,6 @@ class Icon extends ComponentRender {
|
|
|
5511
5443
|
* (for example success or purple) or css color (#033 or rgba(255, 0, 0, 0.5)).
|
|
5512
5444
|
*/
|
|
5513
5445
|
this.color = '';
|
|
5514
|
-
/**
|
|
5515
|
-
* Applies the dark theme variant to the component.
|
|
5516
|
-
*/
|
|
5517
|
-
this.dark = false;
|
|
5518
5446
|
/**
|
|
5519
5447
|
* Makes icon smaller (20px)
|
|
5520
5448
|
*/
|
|
@@ -5536,10 +5464,6 @@ class Icon extends ComponentRender {
|
|
|
5536
5464
|
* of a button when placed to the left of another element or text
|
|
5537
5465
|
*/
|
|
5538
5466
|
this.left = false;
|
|
5539
|
-
/**
|
|
5540
|
-
* Applies the light theme variant to the component.
|
|
5541
|
-
*/
|
|
5542
|
-
this.light = false;
|
|
5543
5467
|
/**
|
|
5544
5468
|
* Applies appropriate margins to the icon inside of
|
|
5545
5469
|
* a button when placed to the right of another element or text
|
|
@@ -5558,13 +5482,11 @@ class Icon extends ComponentRender {
|
|
|
5558
5482
|
*/
|
|
5559
5483
|
this.tag = 'i';
|
|
5560
5484
|
this.color = this.getInitValue('color', props.color, this.color);
|
|
5561
|
-
this.dark = this.getInitValue('dark', props.dark, this.dark);
|
|
5562
5485
|
this.dense = this.getInitValue('dense', props.dense, this.dense);
|
|
5563
5486
|
this.disabled = this.getInitValue('disabled', props.disabled, this.disabled);
|
|
5564
5487
|
this.iconName = this.getInitValue('iconName', props.iconName, this.iconName);
|
|
5565
5488
|
this.large = this.getInitValue('large', props.large, this.large);
|
|
5566
5489
|
this.left = this.getInitValue('left', props.left, this.left);
|
|
5567
|
-
this.light = this.getInitValue('light', props.light, this.light);
|
|
5568
5490
|
this.right = this.getInitValue('right', props.right, this.right);
|
|
5569
5491
|
this.size = this.getInitValue('size', props.size, this.size);
|
|
5570
5492
|
this.small = this.getInitValue('small', props.small, this.small);
|
|
@@ -5931,6 +5853,7 @@ class Select extends TextInput {
|
|
|
5931
5853
|
this.cachedData = [];
|
|
5932
5854
|
this.cachedTotal = 0;
|
|
5933
5855
|
this.formatterFn = FormatterParserProvider.getFormatter('ZdSelect');
|
|
5856
|
+
this.pushedValue = null;
|
|
5934
5857
|
this.loadMoreQtty = 0;
|
|
5935
5858
|
this.debounceSearch = debounce(this.doSearch, 500);
|
|
5936
5859
|
this.appendIcon = this.getInitValue('appendIcon', props.appendIcon, 'expand');
|
|
@@ -5952,6 +5875,7 @@ class Select extends TextInput {
|
|
|
5952
5875
|
this.dataText = [this.dataText];
|
|
5953
5876
|
const defaultDatasource = this.getDefaultDatasource(props);
|
|
5954
5877
|
this.datasource = DatasourceFactory.factory(defaultDatasource);
|
|
5878
|
+
this.overrideGet();
|
|
5955
5879
|
let defaultValue = props.value;
|
|
5956
5880
|
if (Accessor.isAccessorDefinition(props.value)) {
|
|
5957
5881
|
defaultValue = this.getAccessorValue(props.value);
|
|
@@ -5982,6 +5906,16 @@ class Select extends TextInput {
|
|
|
5982
5906
|
const searchIn = (((_a = field.datasource) === null || _a === void 0 ? void 0 : _a.searchIn) || []).concat(searchInDefault);
|
|
5983
5907
|
return Object.assign(Object.assign({}, field.datasource), { searchIn, lazyLoad: (field.value !== '' && field.value !== undefined) || (field.datasource && field.datasource.lazyLoad) });
|
|
5984
5908
|
}
|
|
5909
|
+
overrideGet() {
|
|
5910
|
+
const oldGet = this.datasource.get;
|
|
5911
|
+
this.datasource.get = () => __awaiter(this, void 0, void 0, function* () {
|
|
5912
|
+
yield oldGet.call(this.datasource);
|
|
5913
|
+
if (this.indexOf(this.value) !== -1 || this.datasource.search || this.isFocused)
|
|
5914
|
+
return;
|
|
5915
|
+
yield this.setValue(this.value, false);
|
|
5916
|
+
this.removePushedValue();
|
|
5917
|
+
});
|
|
5918
|
+
}
|
|
5985
5919
|
get search() {
|
|
5986
5920
|
return this.searchValue;
|
|
5987
5921
|
}
|
|
@@ -6008,7 +5942,7 @@ class Select extends TextInput {
|
|
|
6008
5942
|
}
|
|
6009
5943
|
if (this.manualMode)
|
|
6010
5944
|
return;
|
|
6011
|
-
this.cachedData = this.datasource.data;
|
|
5945
|
+
this.cachedData = [...this.datasource.data];
|
|
6012
5946
|
this.cachedTotal = this.datasource.total;
|
|
6013
5947
|
if (pushed) {
|
|
6014
5948
|
this.pushedValue = this.selectedData;
|
|
@@ -6067,10 +6001,14 @@ class Select extends TextInput {
|
|
|
6067
6001
|
if (!this.pushedValue && this.isFilledObj(this.selectValue) && this.indexOf(this.selectValue) === -1) {
|
|
6068
6002
|
this.pushedValue = this.selectValue;
|
|
6069
6003
|
}
|
|
6070
|
-
|
|
6004
|
+
const index = this.indexOf(this.pushedValue);
|
|
6005
|
+
if (this.isFilledObj(this.pushedValue) && index === -1) {
|
|
6071
6006
|
this.datasource.data.unshift(this.pushedValue);
|
|
6072
6007
|
}
|
|
6073
|
-
|
|
6008
|
+
else if (index !== 0) {
|
|
6009
|
+
this.pushedValue = null;
|
|
6010
|
+
}
|
|
6011
|
+
this.cachedData = [...this.datasource.data];
|
|
6074
6012
|
this.cachedTotal = this.datasource.total;
|
|
6075
6013
|
}
|
|
6076
6014
|
/**
|
|
@@ -6129,6 +6067,7 @@ class Select extends TextInput {
|
|
|
6129
6067
|
}
|
|
6130
6068
|
if (!searchValue) {
|
|
6131
6069
|
this.setFieldRowValue(null);
|
|
6070
|
+
this.selectValue = this.selectedData;
|
|
6132
6071
|
return false;
|
|
6133
6072
|
}
|
|
6134
6073
|
this.setFieldRowValue(searchValue);
|
|
@@ -6239,7 +6178,7 @@ class Select extends TextInput {
|
|
|
6239
6178
|
else {
|
|
6240
6179
|
this.removePushedValue();
|
|
6241
6180
|
this.datasource.search = this.searchValue;
|
|
6242
|
-
this.datasource.data = this.cachedData;
|
|
6181
|
+
this.datasource.data = [...this.cachedData];
|
|
6243
6182
|
this.datasource.total = this.cachedTotal;
|
|
6244
6183
|
}
|
|
6245
6184
|
});
|
|
@@ -6252,6 +6191,11 @@ class Select extends TextInput {
|
|
|
6252
6191
|
yield this.datasource.setLimit(this.datasource.limit + this.loadMoreQtty);
|
|
6253
6192
|
if (!this.datasource.search) {
|
|
6254
6193
|
this.afterLoad();
|
|
6194
|
+
const { dataValue } = this;
|
|
6195
|
+
const isSelected = this.selectValue && this.pushedValue && this.selectValue[dataValue] === this.pushedValue[dataValue];
|
|
6196
|
+
if (isSelected)
|
|
6197
|
+
return;
|
|
6198
|
+
this.removePushedValue();
|
|
6255
6199
|
}
|
|
6256
6200
|
});
|
|
6257
6201
|
}
|
|
@@ -6265,7 +6209,7 @@ class Select extends TextInput {
|
|
|
6265
6209
|
this.datasource.search = '';
|
|
6266
6210
|
this.dirtySearchValue = '';
|
|
6267
6211
|
if (!this.manualMode) {
|
|
6268
|
-
this.datasource.data = this.cachedData;
|
|
6212
|
+
this.datasource.data = [...this.cachedData];
|
|
6269
6213
|
this.datasource.total = this.cachedTotal;
|
|
6270
6214
|
}
|
|
6271
6215
|
this.checkValueOnBlur();
|
|
@@ -6278,13 +6222,17 @@ class Select extends TextInput {
|
|
|
6278
6222
|
}
|
|
6279
6223
|
if (this.manualMode)
|
|
6280
6224
|
return;
|
|
6281
|
-
if (this.isFilledObj(this.selectValue)) {
|
|
6282
|
-
if (this.
|
|
6283
|
-
this.
|
|
6284
|
-
this.pushedValue = this.selectValue;
|
|
6225
|
+
if (this.isFilledObj(this.selectValue) && this.indexOf(this.selectValue) === -1) {
|
|
6226
|
+
if (this.pushedValue) {
|
|
6227
|
+
this.removePushedValue();
|
|
6285
6228
|
}
|
|
6229
|
+
this.datasource.data.unshift(this.selectValue);
|
|
6230
|
+
this.pushedValue = this.selectValue;
|
|
6286
6231
|
return;
|
|
6287
6232
|
}
|
|
6233
|
+
const { dataValue } = this;
|
|
6234
|
+
if (this.pushedValue && this.selectValue && this.selectValue[dataValue] === this.pushedValue[dataValue])
|
|
6235
|
+
return;
|
|
6288
6236
|
this.removePushedValue();
|
|
6289
6237
|
}
|
|
6290
6238
|
showLoadMore() {
|
|
@@ -6522,10 +6470,6 @@ class ItemNotFoundError extends Error {
|
|
|
6522
6470
|
class List extends ComponentRender {
|
|
6523
6471
|
constructor(props) {
|
|
6524
6472
|
super(props);
|
|
6525
|
-
/**
|
|
6526
|
-
* Applies the dark theme variant to the List.
|
|
6527
|
-
*/
|
|
6528
|
-
this.dark = false;
|
|
6529
6473
|
/**
|
|
6530
6474
|
* Create the list with smaller items.
|
|
6531
6475
|
*/
|
|
@@ -6538,10 +6482,6 @@ class List extends ComponentRender {
|
|
|
6538
6482
|
* Render list with dividers between the items.
|
|
6539
6483
|
*/
|
|
6540
6484
|
this.divided = false;
|
|
6541
|
-
/**
|
|
6542
|
-
* Applies the light theme variant to the List.
|
|
6543
|
-
*/
|
|
6544
|
-
this.light = false;
|
|
6545
6485
|
/**
|
|
6546
6486
|
* Increases the height of all the list items to better support three lines of text.
|
|
6547
6487
|
*/
|
|
@@ -6686,10 +6626,6 @@ class Login extends ComponentRender {
|
|
|
6686
6626
|
* It can be the name of material or css color in hexa.
|
|
6687
6627
|
*/
|
|
6688
6628
|
this.color = '';
|
|
6689
|
-
/**
|
|
6690
|
-
* Applies the dark theme.
|
|
6691
|
-
*/
|
|
6692
|
-
this.dark = false;
|
|
6693
6629
|
/**
|
|
6694
6630
|
* Card position orientation.
|
|
6695
6631
|
*/
|
|
@@ -6718,7 +6654,6 @@ class Login extends ComponentRender {
|
|
|
6718
6654
|
this.bottomLink = props.bottomLink || this.bottomLink;
|
|
6719
6655
|
this.cardWidth = this.getInitValue('cardWidth', props.cardWidth, this.cardWidth);
|
|
6720
6656
|
this.color = this.getInitValue('color', props.color, this.color);
|
|
6721
|
-
this.dark = this.getInitValue('dark', props.dark, this.dark);
|
|
6722
6657
|
this.layout = this.getInitValue('layout', props.layout, this.layout);
|
|
6723
6658
|
this.logo = this.getInitValue('logo', props.logo, this.logo);
|
|
6724
6659
|
this.logoMessage = this.getInitValue('logoMessage', props.logoMessage, this.logoMessage);
|
|
@@ -6945,10 +6880,6 @@ class Menu extends ComponentRender {
|
|
|
6945
6880
|
* Defines if the menu should have a visible container
|
|
6946
6881
|
*/
|
|
6947
6882
|
this.floating = false;
|
|
6948
|
-
/**
|
|
6949
|
-
* Applies the dark theme variant to the menu.
|
|
6950
|
-
*/
|
|
6951
|
-
this.dark = false;
|
|
6952
6883
|
/**
|
|
6953
6884
|
* Create the menu with smaller items.
|
|
6954
6885
|
*/
|
|
@@ -7031,7 +6962,6 @@ class Menu extends ComponentRender {
|
|
|
7031
6962
|
this.clipped = this.getInitValue('clipped', props.clipped, this.clipped);
|
|
7032
6963
|
this.fixed = this.getInitValue('fixed', props.fixed, this.fixed);
|
|
7033
6964
|
this.floating = this.getInitValue('floating', props.floating, this.floating);
|
|
7034
|
-
this.dark = this.getInitValue('dark', props.dark, this.dark);
|
|
7035
6965
|
this.dense = this.getInitValue('dense', props.dense, this.dense);
|
|
7036
6966
|
this.mini = this.getInitValue('mini', props.mini, this.mini);
|
|
7037
6967
|
this.miniState = this.getInitValue('miniState', props.miniState, this.miniState);
|
|
@@ -7672,10 +7602,6 @@ class Progress extends ComponentRender {
|
|
|
7672
7602
|
* Defines the value color
|
|
7673
7603
|
*/
|
|
7674
7604
|
this.color = 'primary';
|
|
7675
|
-
/**
|
|
7676
|
-
* Applies the dark theme variant to the component
|
|
7677
|
-
*/
|
|
7678
|
-
this.dark = false;
|
|
7679
7605
|
/**
|
|
7680
7606
|
* Sets the height for the component
|
|
7681
7607
|
*/
|
|
@@ -7684,10 +7610,6 @@ class Progress extends ComponentRender {
|
|
|
7684
7610
|
* Animates the component constantly
|
|
7685
7611
|
*/
|
|
7686
7612
|
this.indeterminate = false;
|
|
7687
|
-
/**
|
|
7688
|
-
* Applies the light theme variant to the component
|
|
7689
|
-
*/
|
|
7690
|
-
this.light = false;
|
|
7691
7613
|
/**
|
|
7692
7614
|
* Render components on the progress component
|
|
7693
7615
|
*/
|
|
@@ -7699,10 +7621,8 @@ class Progress extends ComponentRender {
|
|
|
7699
7621
|
this.backgroundColor = this.getInitValue('backgroundColor', props.backgroundColor, this.backgroundColor);
|
|
7700
7622
|
this.backgroundOpacity = this.getInitValue('backgroundOpacity', props.backgroundOpacity, this.backgroundOpacity);
|
|
7701
7623
|
this.color = this.getInitValue('color', props.color, this.color);
|
|
7702
|
-
this.dark = this.getInitValue('dark', props.dark, this.dark);
|
|
7703
7624
|
this.height = this.getInitValue('height', props.height, this.height);
|
|
7704
7625
|
this.indeterminate = this.getInitValue('indeterminate', props.indeterminate, this.indeterminate);
|
|
7705
|
-
this.light = this.getInitValue('light', props.light, this.light);
|
|
7706
7626
|
this.centerSlot = this.getInitValue('centerSlot', props.centerSlot, this.centerSlot);
|
|
7707
7627
|
this.value = this.getInitValue('value', props.value, this.value);
|
|
7708
7628
|
this.createAccessors();
|
|
@@ -7929,20 +7849,23 @@ class SelectMultiple extends Select {
|
|
|
7929
7849
|
set selectValue(rows) {
|
|
7930
7850
|
if (!Array.isArray(rows))
|
|
7931
7851
|
return;
|
|
7932
|
-
if (!this.manualMode
|
|
7933
|
-
this.insertsRemoved = [];
|
|
7852
|
+
if (!this.manualMode) {
|
|
7934
7853
|
const values = rows.map((row) => row[this.dataValue]);
|
|
7935
|
-
this.insertedValues
|
|
7936
|
-
|
|
7937
|
-
if (removed) {
|
|
7938
|
-
this.insertsRemoved.push(inserted);
|
|
7939
|
-
}
|
|
7940
|
-
return !removed;
|
|
7941
|
-
});
|
|
7854
|
+
this.cutFromAToB(this.insertedValues, this.insertsRemoved, (value) => !values.includes(value[this.dataValue]));
|
|
7855
|
+
this.cutFromAToB(this.insertsRemoved, this.insertedValues, (value) => values.includes(value[this.dataValue]));
|
|
7942
7856
|
}
|
|
7943
7857
|
this.selectedValue = rows;
|
|
7944
7858
|
this.setFieldValue(this.getValues(rows));
|
|
7945
7859
|
}
|
|
7860
|
+
/**
|
|
7861
|
+
* Removes item from array a and add it to array b if condition is satisfied
|
|
7862
|
+
*/
|
|
7863
|
+
cutFromAToB(a, b, condition) {
|
|
7864
|
+
const indices = a.reduce((result, value, index) => (condition(value) ? [...result, index] : result), []);
|
|
7865
|
+
indices.forEach((index) => {
|
|
7866
|
+
b.push(a.splice(index)[0]);
|
|
7867
|
+
});
|
|
7868
|
+
}
|
|
7946
7869
|
setFieldValue(value) {
|
|
7947
7870
|
return __awaiter(this, void 0, void 0, function* () {
|
|
7948
7871
|
const promises = [];
|
|
@@ -8119,7 +8042,7 @@ class SelectMultiple extends Select {
|
|
|
8119
8042
|
showLoadMore() {
|
|
8120
8043
|
return !!this.datasource.data.length
|
|
8121
8044
|
&& !this.datasource.loadAll
|
|
8122
|
-
&& (this.datasource.data.length - this.insertedValues.length) < this.datasource.total;
|
|
8045
|
+
&& (this.datasource.data.length - this.insertedValues.length - this.insertsRemoved.length) < this.datasource.total;
|
|
8123
8046
|
}
|
|
8124
8047
|
/**
|
|
8125
8048
|
* Load more data
|
|
@@ -8127,10 +8050,16 @@ class SelectMultiple extends Select {
|
|
|
8127
8050
|
loadMore() {
|
|
8128
8051
|
return __awaiter(this, void 0, void 0, function* () {
|
|
8129
8052
|
yield this.datasource.setLimit(this.datasource.limit + this.loadMoreQtty);
|
|
8053
|
+
this.insertsRemoved = this.insertsRemoved.filter((insert) => {
|
|
8054
|
+
const value = insert[this.dataValue];
|
|
8055
|
+
const foundInData = this.datasource.data.find(this.getCondition(value));
|
|
8056
|
+
return !foundInData;
|
|
8057
|
+
});
|
|
8058
|
+
this.insertSelected();
|
|
8130
8059
|
if (!this.datasource.search) {
|
|
8131
8060
|
this.setCache();
|
|
8132
8061
|
}
|
|
8133
|
-
this.
|
|
8062
|
+
this.removePushedValue();
|
|
8134
8063
|
});
|
|
8135
8064
|
}
|
|
8136
8065
|
/**
|
|
@@ -8324,6 +8253,9 @@ class TreeDataStructure {
|
|
|
8324
8253
|
}
|
|
8325
8254
|
return item;
|
|
8326
8255
|
});
|
|
8256
|
+
if (parent) { // remove all existing children to add new ones
|
|
8257
|
+
this.treeData = this.treeData.filter((item) => item.tree__parent !== parent);
|
|
8258
|
+
}
|
|
8327
8259
|
if (!parent) {
|
|
8328
8260
|
this.treeData = childData;
|
|
8329
8261
|
}
|
|
@@ -8507,7 +8439,7 @@ class TreeDataStructure {
|
|
|
8507
8439
|
this.treeStructure = {};
|
|
8508
8440
|
const childData = this.originalDatasource.data.map((row) => (Object.assign(Object.assign({}, row), { tree__children: [], tree__opened: false, tree__searched: true, tree__level: 1, tree__parent: undefined })));
|
|
8509
8441
|
this.treeData = childData;
|
|
8510
|
-
this.treeStructure['no-parent'] =
|
|
8442
|
+
this.treeStructure['no-parent'] = childData;
|
|
8511
8443
|
}
|
|
8512
8444
|
/**
|
|
8513
8445
|
* Search value against a memory datasource
|
|
@@ -8628,6 +8560,10 @@ class SelectTree extends TextInput {
|
|
|
8628
8560
|
* Defines if field value should be an object
|
|
8629
8561
|
*/
|
|
8630
8562
|
this.returnObject = false;
|
|
8563
|
+
/**
|
|
8564
|
+
* Prevents load select data when the input is focused
|
|
8565
|
+
*/
|
|
8566
|
+
this.preventLoadOnFocus = true;
|
|
8631
8567
|
/**
|
|
8632
8568
|
* Field used to make the item disabled
|
|
8633
8569
|
*/
|
|
@@ -8642,6 +8578,7 @@ class SelectTree extends TextInput {
|
|
|
8642
8578
|
* Defines if should wait and not execute GET method when Datasource is created
|
|
8643
8579
|
*/
|
|
8644
8580
|
this.lazyLoad = true;
|
|
8581
|
+
this.selectValue = null;
|
|
8645
8582
|
this.nodes = this.getInitValue('nodes', props.nodes, this.nodes);
|
|
8646
8583
|
this.alwaysOpen = this.getInitValue('alwaysOpen', props.alwaysOpen, this.alwaysOpen);
|
|
8647
8584
|
this.flattenSearchResults = this.getInitValue('flattenSearchResults', props.flattenSearchResults, this.flattenSearchResults);
|
|
@@ -8659,6 +8596,7 @@ class SelectTree extends TextInput {
|
|
|
8659
8596
|
this.dataValue = this.getInitValue('dataValue', props.dataValue, this.dataValue);
|
|
8660
8597
|
this.dataDisabled = this.getInitValue('dataDisabled', props.dataDisabled, this.dataDisabled);
|
|
8661
8598
|
this.disabledItems = this.getInitValue('disabledItems', props.disabledItems, this.disabledItems);
|
|
8599
|
+
this.preventLoadOnFocus = this.getInitValue('preventLoadOnFocus', props.preventLoadOnFocus, this.preventLoadOnFocus);
|
|
8662
8600
|
if (props.datasource && Object.keys(props.datasource).length) {
|
|
8663
8601
|
this.lazyLoad = props.datasource.lazyLoad !== false;
|
|
8664
8602
|
const searchFields = Array.isArray(this.dataText) ? this.dataText : [this.dataText];
|
|
@@ -8672,6 +8610,24 @@ class SelectTree extends TextInput {
|
|
|
8672
8610
|
}
|
|
8673
8611
|
this.createAccessors();
|
|
8674
8612
|
}
|
|
8613
|
+
focus(event, element) {
|
|
8614
|
+
const _super = Object.create(null, {
|
|
8615
|
+
focus: { get: () => super.focus }
|
|
8616
|
+
});
|
|
8617
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
8618
|
+
_super.focus.call(this, event, element);
|
|
8619
|
+
this.afterFocus();
|
|
8620
|
+
});
|
|
8621
|
+
}
|
|
8622
|
+
afterFocus() {
|
|
8623
|
+
var _a;
|
|
8624
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
8625
|
+
if (!this.preventLoadOnFocus) {
|
|
8626
|
+
yield ((_a = this.datasource) === null || _a === void 0 ? void 0 : _a.get());
|
|
8627
|
+
this.preventLoadOnFocus = true;
|
|
8628
|
+
}
|
|
8629
|
+
});
|
|
8630
|
+
}
|
|
8675
8631
|
createDataStructure() {
|
|
8676
8632
|
this.treeDataStructure = new TreeDataStructure({
|
|
8677
8633
|
datasource: this.datasource,
|
|
@@ -8809,8 +8765,41 @@ class SelectTree extends TextInput {
|
|
|
8809
8765
|
get searchValue() {
|
|
8810
8766
|
return this.lastInputValue;
|
|
8811
8767
|
}
|
|
8768
|
+
clearRow(row) {
|
|
8769
|
+
const result = Object.assign({}, row);
|
|
8770
|
+
Object.keys(result).forEach((key) => {
|
|
8771
|
+
if (key.indexOf('tree__') === 0) {
|
|
8772
|
+
delete result[key];
|
|
8773
|
+
}
|
|
8774
|
+
});
|
|
8775
|
+
return result;
|
|
8776
|
+
}
|
|
8777
|
+
get value() {
|
|
8778
|
+
if (!this.selectValue)
|
|
8779
|
+
return this.selectValue;
|
|
8780
|
+
if (this.returnObject) {
|
|
8781
|
+
return this.clearRow(this.selectValue.row);
|
|
8782
|
+
}
|
|
8783
|
+
return this.selectValue;
|
|
8784
|
+
}
|
|
8785
|
+
set value(value) {
|
|
8786
|
+
this.selectValue = value;
|
|
8787
|
+
}
|
|
8812
8788
|
setValue(value) {
|
|
8813
|
-
this.
|
|
8789
|
+
if (this.returnObject) {
|
|
8790
|
+
if (typeof value !== 'object') {
|
|
8791
|
+
this.value = { id: value };
|
|
8792
|
+
}
|
|
8793
|
+
else {
|
|
8794
|
+
this.value = { id: value[this.dataValue] };
|
|
8795
|
+
}
|
|
8796
|
+
}
|
|
8797
|
+
else if (typeof value === 'object') {
|
|
8798
|
+
this.value = value[this.dataValue];
|
|
8799
|
+
}
|
|
8800
|
+
else {
|
|
8801
|
+
this.value = value;
|
|
8802
|
+
}
|
|
8814
8803
|
}
|
|
8815
8804
|
}
|
|
8816
8805
|
|
|
@@ -8836,6 +8825,7 @@ class SelectTreeMultiple extends SelectTree {
|
|
|
8836
8825
|
* Selected Nodes
|
|
8837
8826
|
*/
|
|
8838
8827
|
this.selectedNodes = [];
|
|
8828
|
+
this.selectValue = [];
|
|
8839
8829
|
this.flat = this.getInitValue('flat', props.flat, this.flat);
|
|
8840
8830
|
this.limit = this.getInitValue('limit', props.limit, this.limit);
|
|
8841
8831
|
this.createAccessors();
|
|
@@ -8852,6 +8842,34 @@ class SelectTreeMultiple extends SelectTree {
|
|
|
8852
8842
|
deselect(node, element) {
|
|
8853
8843
|
this.callEvent('onDeselect', { element, component: this, node });
|
|
8854
8844
|
}
|
|
8845
|
+
get value() {
|
|
8846
|
+
if (this.returnObject) {
|
|
8847
|
+
return this.selectValue.map((value) => this.clearRow(value.row));
|
|
8848
|
+
}
|
|
8849
|
+
return this.selectValue;
|
|
8850
|
+
}
|
|
8851
|
+
set value(value) {
|
|
8852
|
+
this.selectValue = value;
|
|
8853
|
+
}
|
|
8854
|
+
setValue(value) {
|
|
8855
|
+
const arrValue = Array.isArray(value) ? value : [value];
|
|
8856
|
+
if (this.returnObject) {
|
|
8857
|
+
this.value = arrValue.map((item) => {
|
|
8858
|
+
if (typeof item !== 'object') {
|
|
8859
|
+
return { id: item };
|
|
8860
|
+
}
|
|
8861
|
+
return { id: item[this.dataValue] };
|
|
8862
|
+
});
|
|
8863
|
+
}
|
|
8864
|
+
else {
|
|
8865
|
+
this.value = arrValue.map((item) => {
|
|
8866
|
+
if (typeof item === 'object') {
|
|
8867
|
+
return item[this.dataValue];
|
|
8868
|
+
}
|
|
8869
|
+
return item;
|
|
8870
|
+
});
|
|
8871
|
+
}
|
|
8872
|
+
}
|
|
8855
8873
|
}
|
|
8856
8874
|
|
|
8857
8875
|
/**
|
|
@@ -8937,14 +8955,6 @@ class Steppers extends ComponentRender {
|
|
|
8937
8955
|
* Array of steppers items
|
|
8938
8956
|
*/
|
|
8939
8957
|
this.items = [];
|
|
8940
|
-
/**
|
|
8941
|
-
* Applies the dark theme variant to the stepper
|
|
8942
|
-
*/
|
|
8943
|
-
this.dark = false;
|
|
8944
|
-
/**
|
|
8945
|
-
* Applies the light theme variant to the stepper
|
|
8946
|
-
*/
|
|
8947
|
-
this.light = false;
|
|
8948
8958
|
/**
|
|
8949
8959
|
* Allow user to jump to any step
|
|
8950
8960
|
*/
|
|
@@ -8956,9 +8966,7 @@ class Steppers extends ComponentRender {
|
|
|
8956
8966
|
this.activeStep = this.getInitValue('activeStep', props.activeStep, this.activeStep);
|
|
8957
8967
|
this.altLabels = this.getInitValue('altLabels', props.altLabels, this.altLabels);
|
|
8958
8968
|
this.content = this.getInitValue('content', props.content, this.content);
|
|
8959
|
-
this.dark = this.getInitValue('dark', props.dark, this.dark);
|
|
8960
8969
|
this.items = this.getInitValue('items', props.items, this.items);
|
|
8961
|
-
this.light = this.getInitValue('light', props.light, this.light);
|
|
8962
8970
|
this.nonLinear = this.getInitValue('nonLinear', props.nonLinear, this.nonLinear);
|
|
8963
8971
|
this.vertical = this.getInitValue('vertical', props.vertical, this.vertical);
|
|
8964
8972
|
this.steps = this.getInitValue('steps', props.steps, this.steps);
|
|
@@ -10121,7 +10129,6 @@ class TreeGridEditable extends TreeGrid {
|
|
|
10121
10129
|
if (this.editing)
|
|
10122
10130
|
return;
|
|
10123
10131
|
if (column.editable) {
|
|
10124
|
-
this.selectedRows = [];
|
|
10125
10132
|
this.editing = true;
|
|
10126
10133
|
this.preventRowClick = true;
|
|
10127
10134
|
this.datasource.currentRow = row;
|
|
@@ -10844,6 +10851,16 @@ WatchURL.watchers = {};
|
|
|
10844
10851
|
WatchURL.originalEvents = new Map();
|
|
10845
10852
|
|
|
10846
10853
|
class BaseReport {
|
|
10854
|
+
constructor() {
|
|
10855
|
+
this.expressionZeedhiToXls = {
|
|
10856
|
+
AVG: 'AVERAGE',
|
|
10857
|
+
COUNT: 'COUNTA',
|
|
10858
|
+
MAX: 'MAX',
|
|
10859
|
+
MIN: 'MIN',
|
|
10860
|
+
SUM: 'SUM',
|
|
10861
|
+
};
|
|
10862
|
+
this.colunmXLS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
10863
|
+
}
|
|
10847
10864
|
buildColumns(columns) {
|
|
10848
10865
|
const widths = {};
|
|
10849
10866
|
let totalWidth;
|
|
@@ -11075,11 +11092,256 @@ class XLSReport extends BaseReport {
|
|
|
11075
11092
|
this.route = '/generateXLS';
|
|
11076
11093
|
}
|
|
11077
11094
|
buildDataset(data, columns) {
|
|
11095
|
+
const result = this.formatRawDataSet(data, columns);
|
|
11096
|
+
return JSON.stringify(result);
|
|
11097
|
+
}
|
|
11098
|
+
// formata o dataset para o formato "cru" xls
|
|
11099
|
+
formatRawDataSet(data, columns) {
|
|
11078
11100
|
const columnNames = columns.map((col) => col.name);
|
|
11079
11101
|
const result = data.reduce((reduced, row) => {
|
|
11080
11102
|
const values = columnNames.map((col) => row[col] || '');
|
|
11081
11103
|
return [...reduced, values];
|
|
11082
11104
|
}, [columnNames]);
|
|
11105
|
+
return result;
|
|
11106
|
+
}
|
|
11107
|
+
buildMetadata(name, title, columns, filter) {
|
|
11108
|
+
const builtCols = this.buildColumns(columns);
|
|
11109
|
+
const builtFilters = this.buildFilter(filter || {});
|
|
11110
|
+
const lang = this.formatLangCode(I18n.instance.language);
|
|
11111
|
+
const clientLogo = '';
|
|
11112
|
+
const enterpriseLogo = '';
|
|
11113
|
+
const productLogo = '';
|
|
11114
|
+
const metadataObj = {
|
|
11115
|
+
name,
|
|
11116
|
+
title,
|
|
11117
|
+
lang,
|
|
11118
|
+
clientLogo,
|
|
11119
|
+
enterpriseLogo,
|
|
11120
|
+
productLogo,
|
|
11121
|
+
version: '1.0',
|
|
11122
|
+
words: {
|
|
11123
|
+
Page: I18n.translate('PAGE'),
|
|
11124
|
+
Report: I18n.translate('REPORT'),
|
|
11125
|
+
Version: I18n.translate('VERSION'),
|
|
11126
|
+
},
|
|
11127
|
+
staticData: {},
|
|
11128
|
+
groups: [],
|
|
11129
|
+
reportName: name,
|
|
11130
|
+
widgetLabel: title,
|
|
11131
|
+
orientation: 'PORTRAIT',
|
|
11132
|
+
columns: builtCols,
|
|
11133
|
+
filter: builtFilters,
|
|
11134
|
+
reportXLS: true,
|
|
11135
|
+
xlsMergedCell: [],
|
|
11136
|
+
};
|
|
11137
|
+
return Promise.resolve(JSON.stringify(metadataObj));
|
|
11138
|
+
}
|
|
11139
|
+
}
|
|
11140
|
+
|
|
11141
|
+
// XLS with groups
|
|
11142
|
+
class XLS2Report extends BaseReport {
|
|
11143
|
+
constructor() {
|
|
11144
|
+
super(...arguments);
|
|
11145
|
+
this.route = '/generateXLS';
|
|
11146
|
+
}
|
|
11147
|
+
buildDataset(data, metadata) {
|
|
11148
|
+
const result = this.formatDataSet(metadata, data);
|
|
11149
|
+
return JSON.stringify(result);
|
|
11150
|
+
}
|
|
11151
|
+
buildMetadata(name, title, columns, filter) {
|
|
11152
|
+
const builtCols = this.buildColumns(columns);
|
|
11153
|
+
const builtFilters = this.buildFilter(filter || {});
|
|
11154
|
+
const lang = this.formatLangCode(I18n.instance.language);
|
|
11155
|
+
const clientLogo = '';
|
|
11156
|
+
const enterpriseLogo = '';
|
|
11157
|
+
const productLogo = '';
|
|
11158
|
+
const metadataObj = {
|
|
11159
|
+
name,
|
|
11160
|
+
title,
|
|
11161
|
+
lang,
|
|
11162
|
+
clientLogo,
|
|
11163
|
+
enterpriseLogo,
|
|
11164
|
+
productLogo,
|
|
11165
|
+
version: '1.0',
|
|
11166
|
+
words: {
|
|
11167
|
+
Page: I18n.translate('PAGE'),
|
|
11168
|
+
Report: I18n.translate('REPORT'),
|
|
11169
|
+
Version: I18n.translate('VERSION'),
|
|
11170
|
+
},
|
|
11171
|
+
staticData: {},
|
|
11172
|
+
groups: [],
|
|
11173
|
+
reportName: name,
|
|
11174
|
+
widgetLabel: title,
|
|
11175
|
+
orientation: 'PORTRAIT',
|
|
11176
|
+
columns: builtCols,
|
|
11177
|
+
filter: builtFilters,
|
|
11178
|
+
reportXLS: true,
|
|
11179
|
+
xlsMergedCell: [],
|
|
11180
|
+
};
|
|
11181
|
+
return Promise.resolve(JSON.stringify(metadataObj));
|
|
11182
|
+
}
|
|
11183
|
+
// Ordenar o nome das colunas de acordo com seu index, e sempre deixando as colunas agrupadas nas primeiras posições
|
|
11184
|
+
getColumnsName(columns, metaData, lengthGroup) {
|
|
11185
|
+
const columnsNameGroup = metaData.groups.map((row) => row.field);
|
|
11186
|
+
let columnsName = [];
|
|
11187
|
+
const columnsGroupName = [];
|
|
11188
|
+
Object.entries(columns).forEach((row) => {
|
|
11189
|
+
const columnName = row[0];
|
|
11190
|
+
const index = row[1].sequence;
|
|
11191
|
+
if (columnsNameGroup.indexOf(columnName) === -1) {
|
|
11192
|
+
columnsName[index + lengthGroup] = columnName;
|
|
11193
|
+
}
|
|
11194
|
+
else {
|
|
11195
|
+
columnsGroupName.push(columnName);
|
|
11196
|
+
}
|
|
11197
|
+
});
|
|
11198
|
+
columnsName = columnsGroupName.concat(columnsName);
|
|
11199
|
+
columnsName = columnsName.filter((columnName) => typeof columnName === 'string');
|
|
11200
|
+
return columnsName;
|
|
11201
|
+
}
|
|
11202
|
+
// Inicializa alguns valores auxiliares
|
|
11203
|
+
initVars(metaData) {
|
|
11204
|
+
metaData.xlsMergedCell = [];
|
|
11205
|
+
const { columns } = metaData;
|
|
11206
|
+
const lengthGroup = metaData.groups.length;
|
|
11207
|
+
const indexLastGroup = lengthGroup - 1;
|
|
11208
|
+
let columnsName = [];
|
|
11209
|
+
columnsName = this.getColumnsName(columns, metaData, lengthGroup);
|
|
11210
|
+
const rowValues = [];
|
|
11211
|
+
const formatedDataSet = [];
|
|
11212
|
+
const groups = [];
|
|
11213
|
+
groups.groupEnd = {};
|
|
11214
|
+
groups.groupEnd.cellsfunc = {};
|
|
11215
|
+
return {
|
|
11216
|
+
columns, indexLastGroup, columnsName, rowValues, formatedDataSet, groups,
|
|
11217
|
+
};
|
|
11218
|
+
}
|
|
11219
|
+
// formata as expressões da linha
|
|
11220
|
+
formatRowFunc(column, columns, row, index, rowValues, funcXlsParam, groups, indexLastGroup) {
|
|
11221
|
+
let funcXls = funcXlsParam;
|
|
11222
|
+
if ((row[column] === 0 || row[column]) && index !== undefined) {
|
|
11223
|
+
const letter = this.colunmXLS[rowValues.length];
|
|
11224
|
+
funcXls = this.expressionZeedhiToXls[columns[column].expression];
|
|
11225
|
+
const cellsfunc = `${letter + groups[index].init}:${letter}${groups[index].end}`;
|
|
11226
|
+
let expression = '';
|
|
11227
|
+
if (indexLastGroup === index) {
|
|
11228
|
+
expression = `=${funcXls}(${cellsfunc})`;
|
|
11229
|
+
}
|
|
11230
|
+
else {
|
|
11231
|
+
expression = `=${funcXls}(${groups[index].cellsfunc[column]})`;
|
|
11232
|
+
if (index === 0) {
|
|
11233
|
+
if (groups.groupEnd.cellsfunc[column]) {
|
|
11234
|
+
groups.groupEnd.cellsfunc[column] += `,${groups[index].cellsfunc[column]}`;
|
|
11235
|
+
}
|
|
11236
|
+
else {
|
|
11237
|
+
groups.groupEnd.cellsfunc[column] = groups[index].cellsfunc[column];
|
|
11238
|
+
}
|
|
11239
|
+
}
|
|
11240
|
+
groups[index].cellsfunc[column] = null;
|
|
11241
|
+
}
|
|
11242
|
+
rowValues.push(expression);
|
|
11243
|
+
groups.forEach((group, indexGroup) => {
|
|
11244
|
+
if (indexGroup !== indexLastGroup) {
|
|
11245
|
+
if (!group.cellsfunc) {
|
|
11246
|
+
group.cellsfunc = {};
|
|
11247
|
+
}
|
|
11248
|
+
if (group.cellsfunc[column]) {
|
|
11249
|
+
group.cellsfunc[column] += `,${cellsfunc}`;
|
|
11250
|
+
}
|
|
11251
|
+
else {
|
|
11252
|
+
group.cellsfunc[column] = cellsfunc;
|
|
11253
|
+
}
|
|
11254
|
+
}
|
|
11255
|
+
});
|
|
11256
|
+
}
|
|
11257
|
+
else {
|
|
11258
|
+
let cell = row[column];
|
|
11259
|
+
if (row.groupSummary) {
|
|
11260
|
+
const groupEndFunc = groups.groupEnd.cellsfunc;
|
|
11261
|
+
if (groupEndFunc[column]) {
|
|
11262
|
+
funcXls = this.expressionZeedhiToXls[columns[column].expression];
|
|
11263
|
+
cell = `=${funcXls}(${groupEndFunc[column]})`;
|
|
11264
|
+
}
|
|
11265
|
+
}
|
|
11266
|
+
rowValues.push(cell);
|
|
11267
|
+
}
|
|
11268
|
+
}
|
|
11269
|
+
// formata a linha de grupo de acordo com o formato xls2
|
|
11270
|
+
setRowGroup(row, rowValues, groups, metaData, formatedDataSet, columnsName, columns, indexLastGroup) {
|
|
11271
|
+
const label = `${row.groupLabel}:${row.groupValue}`;
|
|
11272
|
+
const index = row.groupIndex;
|
|
11273
|
+
if (row.groupHeader) {
|
|
11274
|
+
rowValues[index] = label;
|
|
11275
|
+
groups[index] = { init: null, end: null };
|
|
11276
|
+
}
|
|
11277
|
+
else if (row.groupFooter) {
|
|
11278
|
+
if (!row.groupLabel) {
|
|
11279
|
+
rowValues.push('Total');
|
|
11280
|
+
}
|
|
11281
|
+
else {
|
|
11282
|
+
rowValues.push(`Total (${label})`);
|
|
11283
|
+
}
|
|
11284
|
+
const funcXls = null;
|
|
11285
|
+
if (groups[index]) {
|
|
11286
|
+
metaData.xlsMergedCell.push({
|
|
11287
|
+
start_row: groups[index].init,
|
|
11288
|
+
start_col: this.colunmXLS[index],
|
|
11289
|
+
end_row: formatedDataSet.length + 2,
|
|
11290
|
+
end_col: this.colunmXLS[index],
|
|
11291
|
+
});
|
|
11292
|
+
}
|
|
11293
|
+
columnsName.forEach((column, columnIndex) => {
|
|
11294
|
+
if (!(row.groupFooter && columnIndex === 0)) {
|
|
11295
|
+
this.formatRowFunc(column, columns, row, index, rowValues, funcXls, groups, indexLastGroup);
|
|
11296
|
+
}
|
|
11297
|
+
});
|
|
11298
|
+
}
|
|
11299
|
+
return rowValues;
|
|
11300
|
+
}
|
|
11301
|
+
// Defina o index dos grupos
|
|
11302
|
+
setIndexGroups(groups, formatedDataSet) {
|
|
11303
|
+
groups.forEach((group) => {
|
|
11304
|
+
if (!group.init) {
|
|
11305
|
+
group.init = formatedDataSet.length + 2;
|
|
11306
|
+
}
|
|
11307
|
+
group.end = formatedDataSet.length + 2;
|
|
11308
|
+
});
|
|
11309
|
+
}
|
|
11310
|
+
// Preenche uma linha "normal"
|
|
11311
|
+
setRowNormal(columnsName, rowValues, row) {
|
|
11312
|
+
columnsName.forEach((column) => {
|
|
11313
|
+
rowValues.push(row[column]);
|
|
11314
|
+
});
|
|
11315
|
+
}
|
|
11316
|
+
formatDataSet(metaData, dataSet) {
|
|
11317
|
+
const initVars = this.initVars(metaData);
|
|
11318
|
+
const { columns, indexLastGroup, columnsName, formatedDataSet, groups, } = initVars;
|
|
11319
|
+
let { rowValues } = initVars;
|
|
11320
|
+
dataSet.forEach((row) => {
|
|
11321
|
+
if (row.group || row.groupFooter) {
|
|
11322
|
+
rowValues = this.setRowGroup(row, rowValues, groups, metaData, formatedDataSet, columnsName, columns, indexLastGroup);
|
|
11323
|
+
}
|
|
11324
|
+
else {
|
|
11325
|
+
this.setIndexGroups(groups, formatedDataSet);
|
|
11326
|
+
this.setRowNormal(columnsName, rowValues, row);
|
|
11327
|
+
}
|
|
11328
|
+
if (!row.groupHeader) {
|
|
11329
|
+
formatedDataSet.push(rowValues);
|
|
11330
|
+
}
|
|
11331
|
+
rowValues = [];
|
|
11332
|
+
});
|
|
11333
|
+
return [columnsName].concat(formatedDataSet);
|
|
11334
|
+
}
|
|
11335
|
+
}
|
|
11336
|
+
|
|
11337
|
+
// Grid mirror (with groups)
|
|
11338
|
+
class XLS3Report extends BaseReport {
|
|
11339
|
+
constructor() {
|
|
11340
|
+
super(...arguments);
|
|
11341
|
+
this.route = '/generateXLS';
|
|
11342
|
+
}
|
|
11343
|
+
buildDataset(data, metadata) {
|
|
11344
|
+
const result = this.formatDataSet(metadata, data);
|
|
11083
11345
|
return JSON.stringify(result);
|
|
11084
11346
|
}
|
|
11085
11347
|
buildMetadata(name, title, columns, filter) {
|
|
@@ -11109,9 +11371,153 @@ class XLSReport extends BaseReport {
|
|
|
11109
11371
|
orientation: 'PORTRAIT',
|
|
11110
11372
|
columns: builtCols,
|
|
11111
11373
|
filter: builtFilters,
|
|
11374
|
+
reportXLS: true,
|
|
11375
|
+
xlsMergedCell: [],
|
|
11112
11376
|
};
|
|
11113
11377
|
return Promise.resolve(JSON.stringify(metadataObj));
|
|
11114
11378
|
}
|
|
11379
|
+
// Ordenar o nome das colunas de acordo com seu index, excluindo o nome das colunas agrupadas
|
|
11380
|
+
getColumnsNameFormat3(columns, metaData) {
|
|
11381
|
+
const columnsNameGroup = metaData.groups.map((row) => row.field);
|
|
11382
|
+
let columnsName = [];
|
|
11383
|
+
Object.entries(columns).forEach((row) => {
|
|
11384
|
+
const columnName = row[0];
|
|
11385
|
+
if (columnsNameGroup.indexOf(columnName) === -1) {
|
|
11386
|
+
const index = row[1].sequence;
|
|
11387
|
+
columnsName[index] = columnName;
|
|
11388
|
+
}
|
|
11389
|
+
});
|
|
11390
|
+
columnsName = columnsName.filter((columnName) => typeof columnName === 'string');
|
|
11391
|
+
return columnsName;
|
|
11392
|
+
}
|
|
11393
|
+
// Inicializa alguns valores auxiliares
|
|
11394
|
+
initVars(metaData) {
|
|
11395
|
+
metaData.xlsMergedCell = [];
|
|
11396
|
+
const { columns } = metaData;
|
|
11397
|
+
const lengthGroup = metaData.groups.length;
|
|
11398
|
+
const indexLastGroup = lengthGroup - 1;
|
|
11399
|
+
let columnsName = [];
|
|
11400
|
+
columnsName = this.getColumnsNameFormat3(columns, metaData);
|
|
11401
|
+
const rowValues = [];
|
|
11402
|
+
const formatedDataSet = [];
|
|
11403
|
+
const groups = [];
|
|
11404
|
+
groups.groupEnd = {};
|
|
11405
|
+
groups.groupEnd.cellsfunc = {};
|
|
11406
|
+
return {
|
|
11407
|
+
columns, indexLastGroup, columnsName, rowValues, formatedDataSet, groups,
|
|
11408
|
+
};
|
|
11409
|
+
}
|
|
11410
|
+
// formata a linha do grupo de acordo com o formato xls3
|
|
11411
|
+
setRowGroupFormat(row, rowValuesParam, groups, formatedDataSet, columnsName, columns, indexLastGroup) {
|
|
11412
|
+
let rowValues = rowValuesParam;
|
|
11413
|
+
const label = `${row.groupLabel}:${row.groupValue}`;
|
|
11414
|
+
const index = row.groupIndex;
|
|
11415
|
+
if (row.groupHeader) {
|
|
11416
|
+
rowValues[index] = label;
|
|
11417
|
+
groups[index] = { init: null, end: null };
|
|
11418
|
+
formatedDataSet.push(rowValues);
|
|
11419
|
+
rowValues = [];
|
|
11420
|
+
}
|
|
11421
|
+
else if (row.groupFooter) {
|
|
11422
|
+
if (!row.groupLabel) {
|
|
11423
|
+
rowValues.push('Total');
|
|
11424
|
+
}
|
|
11425
|
+
else {
|
|
11426
|
+
rowValues.push(`Total (${label})`);
|
|
11427
|
+
}
|
|
11428
|
+
formatedDataSet.push(rowValues);
|
|
11429
|
+
rowValues = [];
|
|
11430
|
+
const funcXls = null;
|
|
11431
|
+
columnsName.forEach((column) => {
|
|
11432
|
+
this.formatRowFunc(column, columns, row, index, rowValues, funcXls, groups, indexLastGroup);
|
|
11433
|
+
});
|
|
11434
|
+
}
|
|
11435
|
+
return rowValues;
|
|
11436
|
+
}
|
|
11437
|
+
// formata as expressões da linha
|
|
11438
|
+
formatRowFunc(column, columns, row, index, rowValues, funcXlsParam, groups, indexLastGroup) {
|
|
11439
|
+
let funcXls = funcXlsParam;
|
|
11440
|
+
if ((row[column] === 0 || row[column]) && index !== undefined) {
|
|
11441
|
+
const letter = this.colunmXLS[rowValues.length];
|
|
11442
|
+
funcXls = this.expressionZeedhiToXls[columns[column].expression];
|
|
11443
|
+
const cellsfunc = `${letter + groups[index].init}:${letter}${groups[index].end}`;
|
|
11444
|
+
let expression = '';
|
|
11445
|
+
if (indexLastGroup === index) {
|
|
11446
|
+
expression = `=${funcXls}(${cellsfunc})`;
|
|
11447
|
+
}
|
|
11448
|
+
else {
|
|
11449
|
+
expression = `=${funcXls}(${groups[index].cellsfunc[column]})`;
|
|
11450
|
+
if (index === 0) {
|
|
11451
|
+
if (groups.groupEnd.cellsfunc[column]) {
|
|
11452
|
+
groups.groupEnd.cellsfunc[column] += `,${groups[index].cellsfunc[column]}`;
|
|
11453
|
+
}
|
|
11454
|
+
else {
|
|
11455
|
+
groups.groupEnd.cellsfunc[column] = groups[index].cellsfunc[column];
|
|
11456
|
+
}
|
|
11457
|
+
}
|
|
11458
|
+
groups[index].cellsfunc[column] = null;
|
|
11459
|
+
}
|
|
11460
|
+
rowValues.push(expression);
|
|
11461
|
+
groups.forEach((group, indexGroup) => {
|
|
11462
|
+
if (indexGroup !== indexLastGroup) {
|
|
11463
|
+
if (!group.cellsfunc) {
|
|
11464
|
+
group.cellsfunc = {};
|
|
11465
|
+
}
|
|
11466
|
+
if (group.cellsfunc[column]) {
|
|
11467
|
+
group.cellsfunc[column] += `,${cellsfunc}`;
|
|
11468
|
+
}
|
|
11469
|
+
else {
|
|
11470
|
+
group.cellsfunc[column] = cellsfunc;
|
|
11471
|
+
}
|
|
11472
|
+
}
|
|
11473
|
+
});
|
|
11474
|
+
}
|
|
11475
|
+
else {
|
|
11476
|
+
let cell = row[column];
|
|
11477
|
+
if (row.groupSummary) {
|
|
11478
|
+
const groupEndFunc = groups.groupEnd.cellsfunc;
|
|
11479
|
+
if (groupEndFunc[column]) {
|
|
11480
|
+
funcXls = this.expressionZeedhiToXls[columns[column].expression];
|
|
11481
|
+
cell = `=${funcXls}(${groupEndFunc[column]})`;
|
|
11482
|
+
}
|
|
11483
|
+
}
|
|
11484
|
+
rowValues.push(cell);
|
|
11485
|
+
}
|
|
11486
|
+
}
|
|
11487
|
+
// Defina o index dos grupos
|
|
11488
|
+
setIndexGroups(groups, formatedDataSet) {
|
|
11489
|
+
groups.forEach((group) => {
|
|
11490
|
+
if (!group.init) {
|
|
11491
|
+
group.init = formatedDataSet.length + 2;
|
|
11492
|
+
}
|
|
11493
|
+
group.end = formatedDataSet.length + 2;
|
|
11494
|
+
});
|
|
11495
|
+
}
|
|
11496
|
+
// Preenche uma linha "normal"
|
|
11497
|
+
setRowNormal(columnsName, rowValues, row) {
|
|
11498
|
+
columnsName.forEach((column) => {
|
|
11499
|
+
rowValues.push(row[column]);
|
|
11500
|
+
});
|
|
11501
|
+
}
|
|
11502
|
+
formatDataSet(metaData, dataSet) {
|
|
11503
|
+
const initVars = this.initVars(metaData);
|
|
11504
|
+
const { columns, indexLastGroup, columnsName, formatedDataSet, groups, } = initVars;
|
|
11505
|
+
let { rowValues } = initVars;
|
|
11506
|
+
dataSet.forEach((row) => {
|
|
11507
|
+
if (row.group || row.groupFooter) {
|
|
11508
|
+
rowValues = this.setRowGroupFormat(row, rowValues, groups, formatedDataSet, columnsName, columns, indexLastGroup);
|
|
11509
|
+
}
|
|
11510
|
+
else {
|
|
11511
|
+
this.setIndexGroups(groups, formatedDataSet);
|
|
11512
|
+
this.setRowNormal(columnsName, rowValues, row);
|
|
11513
|
+
}
|
|
11514
|
+
if (!row.groupHeader) {
|
|
11515
|
+
formatedDataSet.push(rowValues);
|
|
11516
|
+
}
|
|
11517
|
+
rowValues = [];
|
|
11518
|
+
});
|
|
11519
|
+
return [columnsName].concat(formatedDataSet);
|
|
11520
|
+
}
|
|
11115
11521
|
}
|
|
11116
11522
|
|
|
11117
11523
|
class Report {
|
|
@@ -11150,6 +11556,12 @@ class Report {
|
|
|
11150
11556
|
if (type === 'xls') {
|
|
11151
11557
|
return new XLSReport();
|
|
11152
11558
|
}
|
|
11559
|
+
if (type === 'xls2') {
|
|
11560
|
+
return new XLS2Report();
|
|
11561
|
+
}
|
|
11562
|
+
if (type === 'xls3') {
|
|
11563
|
+
return new XLS3Report();
|
|
11564
|
+
}
|
|
11153
11565
|
throw new Error(`Invalid report type: ${type}`);
|
|
11154
11566
|
}
|
|
11155
11567
|
getReport(type, portrait = true, rowObj) {
|
|
@@ -11163,9 +11575,18 @@ class Report {
|
|
|
11163
11575
|
const reportType = this.getReportType(type);
|
|
11164
11576
|
const { route } = reportType;
|
|
11165
11577
|
const { name, columns, datasource } = this.iterable;
|
|
11578
|
+
const { groupedData } = Object.assign({}, this.iterable);
|
|
11166
11579
|
const formattedColumns = this.removeActionColumns(columns);
|
|
11167
|
-
const dataset = reportType.buildDataset(data, formattedColumns);
|
|
11168
11580
|
const metadataObj = yield reportType.buildMetadata(name, this.title, formattedColumns, datasource.filter, portrait);
|
|
11581
|
+
let dataset;
|
|
11582
|
+
if ((reportType instanceof XLS2Report || reportType instanceof XLS3Report) && groupedData) {
|
|
11583
|
+
const rowMetadata = rowObj.metaData;
|
|
11584
|
+
const metadataObjClone = merge(rowMetadata, JSON.parse(metadataObj));
|
|
11585
|
+
dataset = reportType.buildDataset(groupedData, metadataObjClone);
|
|
11586
|
+
}
|
|
11587
|
+
else {
|
|
11588
|
+
dataset = reportType.buildDataset(data, formattedColumns);
|
|
11589
|
+
}
|
|
11169
11590
|
const filter = '[]';
|
|
11170
11591
|
let row = {};
|
|
11171
11592
|
if (rowObj) {
|
|
@@ -11204,4 +11625,4 @@ class Report {
|
|
|
11204
11625
|
|
|
11205
11626
|
const AutoNumeric = require('@zeedhi/autonumeric/dist/autoNumeric');
|
|
11206
11627
|
|
|
11207
|
-
export { Alert, AlertService, ApexChart, AutoNumeric, Badge, Breadcrumbs, Button, ButtonGroup, CSVReport, Card, Carousel, Checkbox, CheckboxMultiple, ChildNotFoundError, Chip, CodeEditor, Col, CollapseCard, Column, Component, ComponentRender, Container, Currency, Dashboard, Date$1 as Date, DateRange, Dialog, DialogService, Divider, Dropdown, FileInput, Footer, Form, Frame, FramePage, Grid, GridColumn, GridColumnEditable, GridEditable, Header, Icon, Icons, Image, Increment, Input, Iterable, IterableColumnsButton, IterableColumnsButtonController, IterablePageComponent, IterablePageInfo, IterablePageSize, IterablePagination, List, ListGroup, ListItem, Loading, LoadingService, Login, LoginButton, MasterDetail, Menu, MenuButton, MenuGroup, MenuLink, MenuSeparator, Modal, ModalCloseButton, ModalService, Month, Number$1 as Number, PDFReport, Password, Progress, Radio, RangeSlider, Report, Row, Search, Select, SelectMultiple, SelectTree, SelectTreeMultiple, SpeedDial, Steppers, SvgMap, Switch, Tab, Table, Tabs, Tag, Text, TextInput, Textarea, Time, Toggleable, Tooltip, Tree, TreeDataStructure, TreeGrid, TreeGridEditable, WatchURL, XLSReport, initTheme };
|
|
11628
|
+
export { Alert, AlertService, ApexChart, AutoNumeric, Badge, Breadcrumbs, Button, ButtonGroup, CSVReport, Card, Carousel, Checkbox, CheckboxMultiple, ChildNotFoundError, Chip, CodeEditor, Col, CollapseCard, Column, Component, ComponentRender, Container, Currency, Dashboard, Date$1 as Date, DateRange, Dialog, DialogService, Divider, Dropdown, FileInput, Footer, Form, Frame, FramePage, Grid, GridColumn, GridColumnEditable, GridEditable, Header, Icon, Icons, Image, Increment, Input, Iterable, IterableColumnsButton, IterableColumnsButtonController, IterablePageComponent, IterablePageInfo, IterablePageSize, IterablePagination, List, ListGroup, ListItem, Loading, LoadingService, Login, LoginButton, MasterDetail, Menu, MenuButton, MenuGroup, MenuLink, MenuSeparator, Modal, ModalCloseButton, ModalService, Month, Number$1 as Number, PDFReport, Password, Progress, Radio, RangeSlider, Report, Row, Search, Select, SelectMultiple, SelectTree, SelectTreeMultiple, SpeedDial, Steppers, SvgMap, Switch, Tab, Table, Tabs, Tag, Text, TextInput, Textarea, Time, Toggleable, Tooltip, Tree, TreeDataStructure, TreeGrid, TreeGridEditable, WatchURL, XLS2Report, XLS3Report, XLSReport, initTheme };
|