@zeedhi/teknisa-components-common 1.90.1 → 1.92.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/coverage/clover.xml +718 -677
- package/coverage/coverage-final.json +45 -42
- package/coverage/lcov-report/components/crud/crud-add-button.ts.html +250 -0
- package/coverage/lcov-report/components/crud/crud-button.ts.html +292 -0
- package/coverage/lcov-report/components/crud/crud-cancel-button.ts.html +259 -0
- package/coverage/lcov-report/components/crud/crud-delete-button.ts.html +322 -0
- package/coverage/lcov-report/components/crud/crud-form.ts.html +382 -0
- package/coverage/lcov-report/components/crud/crud-save-button.ts.html +253 -0
- package/coverage/lcov-report/components/crud/index.html +191 -0
- package/coverage/lcov-report/components/index.html +116 -0
- package/coverage/lcov-report/components/index.ts.html +394 -0
- package/coverage/lcov-report/components/tek-breadcrumb-header/breadcrumb-header.ts.html +172 -0
- package/coverage/lcov-report/components/tek-breadcrumb-header/index.html +116 -0
- package/coverage/lcov-report/components/tek-card-title/card-title.ts.html +175 -0
- package/coverage/lcov-report/components/tek-card-title/index.html +116 -0
- package/coverage/lcov-report/components/tek-datasource/index.html +146 -0
- package/coverage/lcov-report/components/tek-datasource/interfaces.ts.html +193 -0
- package/coverage/lcov-report/components/tek-datasource/memory-datasource.ts.html +1015 -0
- package/coverage/lcov-report/components/tek-datasource/rest-datasource.ts.html +751 -0
- package/coverage/lcov-report/components/tek-drag-grid/index.html +116 -0
- package/coverage/lcov-report/components/tek-drag-grid/tek-drag-grid.ts.html +409 -0
- package/coverage/lcov-report/components/tek-grid/filter-helper.ts.html +145 -0
- package/coverage/lcov-report/components/tek-grid/grid-column.ts.html +775 -0
- package/coverage/lcov-report/components/tek-grid/grid-columns-button-controller.ts.html +169 -0
- package/coverage/lcov-report/components/tek-grid/grid-columns-button.ts.html +190 -0
- package/coverage/lcov-report/components/tek-grid/grid-filter-button.ts.html +1282 -0
- package/coverage/lcov-report/components/tek-grid/grid.ts.html +3157 -0
- package/coverage/lcov-report/components/tek-grid/index.html +221 -0
- package/coverage/lcov-report/components/tek-grid/interfaces.ts.html +733 -0
- package/coverage/lcov-report/components/tek-grid/layout-options.ts.html +826 -0
- package/coverage/lcov-report/components/tek-image/image.ts.html +313 -0
- package/coverage/lcov-report/components/tek-image/index.html +116 -0
- package/coverage/lcov-report/components/tek-iterable-carousel/index.html +116 -0
- package/coverage/lcov-report/components/tek-iterable-carousel/iterable-carousel.ts.html +175 -0
- package/coverage/lcov-report/components/tek-iterable-component-render/index.html +116 -0
- package/coverage/lcov-report/components/tek-iterable-component-render/iterable-component-render.ts.html +118 -0
- package/coverage/lcov-report/components/tek-loading/index.html +116 -0
- package/coverage/lcov-report/components/tek-loading/loading.ts.html +196 -0
- package/coverage/lcov-report/components/tek-notifications/index.html +116 -0
- package/coverage/lcov-report/components/tek-notifications/notifications.ts.html +271 -0
- package/coverage/lcov-report/components/tek-product-card/index.html +116 -0
- package/coverage/lcov-report/components/tek-product-card/product-card.ts.html +391 -0
- package/coverage/lcov-report/components/tek-tree-grid/index.html +116 -0
- package/coverage/lcov-report/components/tek-tree-grid/tree-grid.ts.html +1255 -0
- package/coverage/lcov-report/components/tek-user-info/TekUserInfoController.ts.html +367 -0
- package/coverage/lcov-report/components/tek-user-info/index.html +146 -0
- package/coverage/lcov-report/components/tek-user-info/tek-user-info-list.ts.html +268 -0
- package/coverage/lcov-report/components/tek-user-info/tek-user-info.ts.html +1096 -0
- package/coverage/lcov-report/error/delete-rows-error.ts.html +118 -0
- package/coverage/lcov-report/error/index.html +116 -0
- package/coverage/lcov-report/index.html +27 -12
- package/coverage/lcov-report/tests/__helpers__/component-event-helper.ts.html +2 -2
- package/coverage/lcov-report/tests/__helpers__/flush-promises-helper.ts.html +2 -2
- package/coverage/lcov-report/tests/__helpers__/get-child-helper.ts.html +8 -8
- package/coverage/lcov-report/tests/__helpers__/index.html +2 -2
- package/coverage/lcov-report/tests/__helpers__/index.ts.html +2 -2
- package/coverage/lcov-report/tests/__helpers__/mock-created-helper.ts.html +2 -2
- package/coverage/lcov-report/utils/grid-base/export-options/button-option.ts.html +166 -0
- package/coverage/lcov-report/utils/grid-base/export-options/index.html +146 -0
- package/coverage/lcov-report/utils/grid-base/export-options/index.ts.html +94 -0
- package/coverage/lcov-report/utils/grid-base/export-options/multi-option.ts.html +355 -0
- package/coverage/lcov-report/utils/grid-base/grid-base.ts.html +1960 -0
- package/coverage/lcov-report/utils/grid-base/grid-controller.ts.html +457 -0
- package/coverage/lcov-report/utils/grid-base/index.html +131 -0
- package/coverage/lcov-report/utils/index.html +116 -0
- package/coverage/lcov-report/utils/index.ts.html +100 -0
- package/coverage/lcov-report/utils/report-filter/index.html +116 -0
- package/coverage/lcov-report/utils/report-filter/report-filter.ts.html +256 -0
- package/coverage/lcov.info +1055 -972
- package/dist/tek-components-common.esm.js +164 -34
- package/dist/tek-components-common.umd.js +164 -34
- package/package.json +2 -2
- package/tests/unit/components/tek-grid/grid.spec.ts +87 -77
- package/tests/unit/components/tek-user-info/TekUserInfoContoller.spec.ts +0 -14
- package/tests/unit/components/tek-user-info/tek-user-info.spec.ts +1 -1
- package/tests/unit/components/tree-grid/tree-grid.spec.ts +28 -19
- package/tests/unit/utils/grid-base/export-options/button-option.spec.ts +44 -0
- package/tests/unit/utils/grid-base/export-options/multi-option.spec.ts +135 -0
- package/types/components/tek-grid/interfaces.d.ts +19 -2
- package/types/components/tek-user-info/TekUserInfoController.d.ts +0 -2
- package/types/utils/grid-base/export-options/button-option.d.ts +16 -0
- package/types/utils/grid-base/export-options/index.d.ts +3 -0
- package/types/utils/grid-base/export-options/interfaces.d.ts +5 -0
- package/types/utils/grid-base/export-options/multi-option.d.ts +12 -0
- package/types/utils/grid-base/grid-base.d.ts +3 -2
- package/types/utils/index.d.ts +5 -5
- package/types/components/tek-ag-grid/default-icons.d.ts +0 -53
- package/types/components/tek-ag-grid/interfaces.d.ts +0 -9
- package/types/components/tek-ag-grid/tek-ag-grid.d.ts +0 -35
- package/types/components/tek-datasource/datasource.d.ts +0 -94
- package/types/components/tek-grid/default-icons.d.ts +0 -53
- package/types/components/tek-grid/filter-dynamic-values.d.ts +0 -9
- package/types/components/tek-grid/grid-controller.d.ts +0 -19
- package/types/components/tek-grid/grid_column.d.ts +0 -14
- package/types/components/tek-grid/grid_controller.d.ts +0 -15
- package/types/components/tek-grid/tek-grid.d.ts +0 -35
- package/types/components/tek-login/interfaces.d.ts +0 -3
- package/types/components/tek-login/login-children.d.ts +0 -3
- package/types/components/tek-login/login.d.ts +0 -58
- package/types/components/tek-login/login_children.d.ts +0 -3
|
@@ -711,6 +711,95 @@ class TekGridDeleteRowsError extends Error {
|
|
|
711
711
|
}
|
|
712
712
|
}
|
|
713
713
|
|
|
714
|
+
class ButtonOption {
|
|
715
|
+
constructor(config) {
|
|
716
|
+
this.config = config;
|
|
717
|
+
}
|
|
718
|
+
buildComponent(grid) {
|
|
719
|
+
const { type, label, portrait = true, iconName, } = this.config;
|
|
720
|
+
const orientation = portrait ? 'portrait' : 'landscape';
|
|
721
|
+
return {
|
|
722
|
+
label,
|
|
723
|
+
iconName,
|
|
724
|
+
name: `${grid.name}_export_${type}_${orientation}`,
|
|
725
|
+
component: 'ZdButton',
|
|
726
|
+
flat: true,
|
|
727
|
+
events: {
|
|
728
|
+
click: () => grid.getReport(type, portrait),
|
|
729
|
+
},
|
|
730
|
+
};
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
class MultiOption {
|
|
735
|
+
constructor(config) {
|
|
736
|
+
this.config = config;
|
|
737
|
+
}
|
|
738
|
+
formatName(id, type, grid) {
|
|
739
|
+
return `${grid.name}_export_${type}_${id}`;
|
|
740
|
+
}
|
|
741
|
+
buildTooltip(option, type, grid) {
|
|
742
|
+
const { label } = option;
|
|
743
|
+
return {
|
|
744
|
+
name: this.formatName(`tooltip_${label}`, type, grid),
|
|
745
|
+
component: 'ZdTooltip',
|
|
746
|
+
bottom: true,
|
|
747
|
+
label,
|
|
748
|
+
children: [],
|
|
749
|
+
};
|
|
750
|
+
}
|
|
751
|
+
buildButton(option, type, grid) {
|
|
752
|
+
const { cssClass, label, iconName, reportParams, } = option;
|
|
753
|
+
const { portrait: optionPortrait, rowObj } = reportParams || {};
|
|
754
|
+
return {
|
|
755
|
+
name: this.formatName(`button_${label}`, type, grid),
|
|
756
|
+
component: 'ZdButton',
|
|
757
|
+
cssClass,
|
|
758
|
+
icon: true,
|
|
759
|
+
iconName,
|
|
760
|
+
events: {
|
|
761
|
+
click: () => grid.getReport(type, optionPortrait, rowObj),
|
|
762
|
+
},
|
|
763
|
+
};
|
|
764
|
+
}
|
|
765
|
+
buildDivider(option, type, grid) {
|
|
766
|
+
const { label } = option;
|
|
767
|
+
return {
|
|
768
|
+
name: this.formatName(`divider_${label}`, type, grid),
|
|
769
|
+
component: 'ZdDivider',
|
|
770
|
+
cssClass: 'zd-my-1',
|
|
771
|
+
vertical: true,
|
|
772
|
+
};
|
|
773
|
+
}
|
|
774
|
+
buildComponent(grid) {
|
|
775
|
+
const { type, label, multiOption, } = this.config;
|
|
776
|
+
const optionComponents = multiOption.map((option) => ([
|
|
777
|
+
Object.assign(Object.assign({}, this.buildTooltip(option, type, grid)), { children: [
|
|
778
|
+
this.buildButton(option, type, grid),
|
|
779
|
+
] }),
|
|
780
|
+
this.buildDivider(option, type, grid),
|
|
781
|
+
]))
|
|
782
|
+
.flat();
|
|
783
|
+
optionComponents.pop();
|
|
784
|
+
const text = {
|
|
785
|
+
name: this.formatName('text', type, grid),
|
|
786
|
+
component: 'ZdText',
|
|
787
|
+
cssClass: 'zd-display-flex zd-align-center zd-flex-grow-1 tek-grid-export-multioption-text',
|
|
788
|
+
events: {
|
|
789
|
+
click: ({ event }) => event === null || event === void 0 ? void 0 : event.stopPropagation(),
|
|
790
|
+
},
|
|
791
|
+
text: label || '',
|
|
792
|
+
};
|
|
793
|
+
const result = {
|
|
794
|
+
name: this.formatName('row', type, grid),
|
|
795
|
+
component: 'ZdRow',
|
|
796
|
+
cssClass: 'zd-display-flex zd-ma-0 zd-py-0 zd-gap-x-1 tek-grid-export-multioption-row',
|
|
797
|
+
children: [text, ...optionComponents],
|
|
798
|
+
};
|
|
799
|
+
return result;
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
|
|
714
803
|
class GridBase {
|
|
715
804
|
constructor(grid) {
|
|
716
805
|
this.exportConfigButtons = [];
|
|
@@ -735,20 +824,15 @@ class GridBase {
|
|
|
735
824
|
this.grid = grid;
|
|
736
825
|
this.exportConfigButtons = this.getExportConfigButtons();
|
|
737
826
|
}
|
|
827
|
+
getOption(config) {
|
|
828
|
+
if (config.multiOption)
|
|
829
|
+
return new MultiOption(config);
|
|
830
|
+
return new ButtonOption(config);
|
|
831
|
+
}
|
|
738
832
|
getExportConfigButtons() {
|
|
739
833
|
return this.grid.exportConfig.map((config) => {
|
|
740
|
-
const
|
|
741
|
-
|
|
742
|
-
return {
|
|
743
|
-
label,
|
|
744
|
-
iconName,
|
|
745
|
-
name: `${this.grid.name}_export_${type}_${orientation}`,
|
|
746
|
-
component: 'ZdButton',
|
|
747
|
-
flat: true,
|
|
748
|
-
events: {
|
|
749
|
-
click: () => this.grid.getReport(type, portrait),
|
|
750
|
-
},
|
|
751
|
-
};
|
|
834
|
+
const option = this.getOption(config);
|
|
835
|
+
return option.buildComponent(this.grid);
|
|
752
836
|
});
|
|
753
837
|
}
|
|
754
838
|
createToolbarProps() {
|
|
@@ -1089,6 +1173,8 @@ Messages.add({
|
|
|
1089
1173
|
TEKGRID_MULTIPLE_VALUE_HINT: 'Separe valores usando ";"',
|
|
1090
1174
|
TEKGRID_EXPORT: 'Exportar',
|
|
1091
1175
|
TEKGRID_EXPORT_AS: 'Exportar como {{ type }}',
|
|
1176
|
+
TEKGRID_PORTRAIT: 'Retrato',
|
|
1177
|
+
TEKGRID_LANDSCAPE: 'Paisagem',
|
|
1092
1178
|
TEKGRID_COLUMN_VISIBLE: 'Visível',
|
|
1093
1179
|
TEKGRID_COLUMN_GROUPED: 'Grupo',
|
|
1094
1180
|
TEKGRID_COLUMN_AGGREGATION: 'Totalização',
|
|
@@ -1158,6 +1244,8 @@ Messages.add({
|
|
|
1158
1244
|
TEKGRID_MULTIPLE_VALUE_HINT: 'Separate values using ";"',
|
|
1159
1245
|
TEKGRID_EXPORT: 'Export',
|
|
1160
1246
|
TEKGRID_EXPORT_AS: 'Export as {{ type }}',
|
|
1247
|
+
TEKGRID_PORTRAIT: 'Portrait',
|
|
1248
|
+
TEKGRID_LANDSCAPE: 'Landscape',
|
|
1161
1249
|
TEKGRID_COLUMN_VISIBLE: 'Visible',
|
|
1162
1250
|
TEKGRID_COLUMN_GROUPED: 'Grouped',
|
|
1163
1251
|
TEKGRID_COLUMN_AGGREGATION: 'Aggregation',
|
|
@@ -1227,6 +1315,8 @@ Messages.add({
|
|
|
1227
1315
|
TEKGRID_MULTIPLE_VALUE_HINT: 'Separe los valores usando ";"',
|
|
1228
1316
|
TEKGRID_EXPORT: 'Exportar',
|
|
1229
1317
|
TEKGRID_EXPORT_AS: 'Exportar como {{ type }}',
|
|
1318
|
+
TEKGRID_PORTRAIT: 'Vertical',
|
|
1319
|
+
TEKGRID_LANDSCAPE: 'Horizontal',
|
|
1230
1320
|
TEKGRID_COLUMN_VISIBLE: 'Visible',
|
|
1231
1321
|
TEKGRID_COLUMN_GROUPED: 'Grupo',
|
|
1232
1322
|
TEKGRID_COLUMN_AGGREGATION: 'Totalización',
|
|
@@ -2080,6 +2170,15 @@ class TekGrid extends GridEditable {
|
|
|
2080
2170
|
{
|
|
2081
2171
|
type: 'pdf',
|
|
2082
2172
|
label: I18n.translate('TEKGRID_EXPORT_AS', { type: 'PDF' }),
|
|
2173
|
+
multiOption: [
|
|
2174
|
+
{ label: I18n.translate('TEKGRID_PORTRAIT'), iconName: 'mdi-file-outline' },
|
|
2175
|
+
{
|
|
2176
|
+
label: I18n.translate('TEKGRID_LANDSCAPE'),
|
|
2177
|
+
iconName: 'mdi-file-outline',
|
|
2178
|
+
cssClass: 'tek-grid-export-landscape',
|
|
2179
|
+
reportParams: { portrait: false },
|
|
2180
|
+
},
|
|
2181
|
+
],
|
|
2083
2182
|
},
|
|
2084
2183
|
{
|
|
2085
2184
|
type: 'xls',
|
|
@@ -2474,8 +2573,9 @@ class TekGrid extends GridEditable {
|
|
|
2474
2573
|
resetFooterVariables(group) {
|
|
2475
2574
|
this.summaryColumns.forEach((column) => {
|
|
2476
2575
|
group.footer[column.name] = {
|
|
2477
|
-
sum: 0,
|
|
2478
2576
|
count: 0,
|
|
2577
|
+
sum: undefined,
|
|
2578
|
+
avg: undefined,
|
|
2479
2579
|
min: undefined,
|
|
2480
2580
|
max: undefined,
|
|
2481
2581
|
};
|
|
@@ -2484,17 +2584,24 @@ class TekGrid extends GridEditable {
|
|
|
2484
2584
|
isUndefined(value) {
|
|
2485
2585
|
return value === undefined || value === null;
|
|
2486
2586
|
}
|
|
2487
|
-
calcSummaryValues(summary, rowValue) {
|
|
2587
|
+
calcSummaryValues(columnName, summary, rowValue) {
|
|
2488
2588
|
if (!this.isUndefined(rowValue)) {
|
|
2489
2589
|
summary.count += 1;
|
|
2490
|
-
if (
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2590
|
+
if (this.events.calcSummary) {
|
|
2591
|
+
this.callEvent('calcSummary', {
|
|
2592
|
+
component: this, columnName, summary, rowValue,
|
|
2593
|
+
});
|
|
2594
|
+
}
|
|
2595
|
+
else {
|
|
2596
|
+
if (summary.min === undefined)
|
|
2597
|
+
summary.min = rowValue;
|
|
2598
|
+
if (summary.max === undefined)
|
|
2599
|
+
summary.max = rowValue;
|
|
2600
|
+
summary.min = rowValue < summary.min ? rowValue : summary.min;
|
|
2601
|
+
summary.max = rowValue > summary.max ? rowValue : summary.max;
|
|
2602
|
+
if (typeof rowValue === 'number') {
|
|
2603
|
+
summary.sum = (summary.sum || 0) + rowValue;
|
|
2604
|
+
}
|
|
2498
2605
|
}
|
|
2499
2606
|
}
|
|
2500
2607
|
}
|
|
@@ -2506,14 +2613,15 @@ class TekGrid extends GridEditable {
|
|
|
2506
2613
|
if (this.isUndefined(this.summary[columnName])) {
|
|
2507
2614
|
this.summary[columnName] = {
|
|
2508
2615
|
count: 0,
|
|
2509
|
-
sum:
|
|
2616
|
+
sum: undefined,
|
|
2617
|
+
avg: undefined,
|
|
2510
2618
|
min: undefined,
|
|
2511
2619
|
max: undefined,
|
|
2512
2620
|
};
|
|
2513
2621
|
}
|
|
2514
|
-
this.calcSummaryValues(this.summary[columnName], rowValue);
|
|
2622
|
+
this.calcSummaryValues(columnName, this.summary[columnName], rowValue);
|
|
2515
2623
|
this.groups.forEach((group) => {
|
|
2516
|
-
this.calcSummaryValues(group.footer[columnName], rowValue);
|
|
2624
|
+
this.calcSummaryValues(columnName, group.footer[columnName], rowValue);
|
|
2517
2625
|
});
|
|
2518
2626
|
});
|
|
2519
2627
|
}
|
|
@@ -2536,7 +2644,12 @@ class TekGrid extends GridEditable {
|
|
|
2536
2644
|
summaryData[column.name] = currentGroup.sum;
|
|
2537
2645
|
}
|
|
2538
2646
|
else if (aggregation === 'AVG') {
|
|
2539
|
-
|
|
2647
|
+
if (currentGroup.avg) {
|
|
2648
|
+
summaryData[column.name] = currentGroup.avg;
|
|
2649
|
+
}
|
|
2650
|
+
else if (typeof currentGroup.sum === 'number') {
|
|
2651
|
+
summaryData[column.name] = currentGroup.sum / currentGroup.count;
|
|
2652
|
+
}
|
|
2540
2653
|
}
|
|
2541
2654
|
else if (aggregation === 'MIN') {
|
|
2542
2655
|
summaryData[column.name] = currentGroup.min;
|
|
@@ -3398,10 +3511,33 @@ class TekTreeGrid extends TreeGridEditable {
|
|
|
3398
3511
|
{
|
|
3399
3512
|
type: 'pdf',
|
|
3400
3513
|
label: I18n.translate('TEKGRID_EXPORT_AS', { type: 'PDF' }),
|
|
3514
|
+
multiOption: [
|
|
3515
|
+
{ label: I18n.translate('TEKGRID_PORTRAIT'), iconName: 'mdi-file-outline' },
|
|
3516
|
+
{
|
|
3517
|
+
label: I18n.translate('TEKGRID_LANDSCAPE'),
|
|
3518
|
+
iconName: 'mdi-file-outline',
|
|
3519
|
+
cssClass: 'tek-grid-export-landscape',
|
|
3520
|
+
reportParams: { portrait: false },
|
|
3521
|
+
},
|
|
3522
|
+
],
|
|
3401
3523
|
},
|
|
3402
3524
|
{
|
|
3403
3525
|
type: 'xls',
|
|
3404
|
-
label: I18n.translate('TEKGRID_EXPORT_AS', {
|
|
3526
|
+
label: I18n.translate('TEKGRID_EXPORT_AS', {
|
|
3527
|
+
type: `XLS ${I18n.translate('TEKGRID_WITHOUT_GROUPS')}`,
|
|
3528
|
+
}),
|
|
3529
|
+
},
|
|
3530
|
+
{
|
|
3531
|
+
type: 'xls2',
|
|
3532
|
+
label: I18n.translate('TEKGRID_EXPORT_AS', {
|
|
3533
|
+
type: `XLS ${I18n.translate('TEKGRID_WITH_GROUPS')}`,
|
|
3534
|
+
}),
|
|
3535
|
+
},
|
|
3536
|
+
{
|
|
3537
|
+
type: 'xls3',
|
|
3538
|
+
label: I18n.translate('TEKGRID_EXPORT_AS', {
|
|
3539
|
+
type: `XLS ${I18n.translate('TEKGRID_GRID_MIRROR')}`,
|
|
3540
|
+
}),
|
|
3405
3541
|
},
|
|
3406
3542
|
{
|
|
3407
3543
|
type: 'csv',
|
|
@@ -3585,12 +3721,6 @@ let TekUserInfoController = class TekUserInfoController {
|
|
|
3585
3721
|
return;
|
|
3586
3722
|
this.versionInfo.version = value;
|
|
3587
3723
|
}
|
|
3588
|
-
get defaultEmail() {
|
|
3589
|
-
return this.component.defaultEmail;
|
|
3590
|
-
}
|
|
3591
|
-
set defaultEmail(value) {
|
|
3592
|
-
this.component.defaultEmail = value;
|
|
3593
|
-
}
|
|
3594
3724
|
get hasDefaultEmail() {
|
|
3595
3725
|
return !!this.component.defaultEmail;
|
|
3596
3726
|
}
|
|
@@ -3793,7 +3923,7 @@ class TekUserInfo extends UserInfo {
|
|
|
3793
3923
|
grid: {
|
|
3794
3924
|
cols: '12',
|
|
3795
3925
|
},
|
|
3796
|
-
value:
|
|
3926
|
+
value: this.defaultEmail,
|
|
3797
3927
|
readonly: `{{TekUserInfoController_${this.componentId}.hasDefaultEmail}}`,
|
|
3798
3928
|
validations: {
|
|
3799
3929
|
required: {},
|
|
@@ -715,6 +715,95 @@
|
|
|
715
715
|
}
|
|
716
716
|
}
|
|
717
717
|
|
|
718
|
+
class ButtonOption {
|
|
719
|
+
constructor(config) {
|
|
720
|
+
this.config = config;
|
|
721
|
+
}
|
|
722
|
+
buildComponent(grid) {
|
|
723
|
+
const { type, label, portrait = true, iconName, } = this.config;
|
|
724
|
+
const orientation = portrait ? 'portrait' : 'landscape';
|
|
725
|
+
return {
|
|
726
|
+
label,
|
|
727
|
+
iconName,
|
|
728
|
+
name: `${grid.name}_export_${type}_${orientation}`,
|
|
729
|
+
component: 'ZdButton',
|
|
730
|
+
flat: true,
|
|
731
|
+
events: {
|
|
732
|
+
click: () => grid.getReport(type, portrait),
|
|
733
|
+
},
|
|
734
|
+
};
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
class MultiOption {
|
|
739
|
+
constructor(config) {
|
|
740
|
+
this.config = config;
|
|
741
|
+
}
|
|
742
|
+
formatName(id, type, grid) {
|
|
743
|
+
return `${grid.name}_export_${type}_${id}`;
|
|
744
|
+
}
|
|
745
|
+
buildTooltip(option, type, grid) {
|
|
746
|
+
const { label } = option;
|
|
747
|
+
return {
|
|
748
|
+
name: this.formatName(`tooltip_${label}`, type, grid),
|
|
749
|
+
component: 'ZdTooltip',
|
|
750
|
+
bottom: true,
|
|
751
|
+
label,
|
|
752
|
+
children: [],
|
|
753
|
+
};
|
|
754
|
+
}
|
|
755
|
+
buildButton(option, type, grid) {
|
|
756
|
+
const { cssClass, label, iconName, reportParams, } = option;
|
|
757
|
+
const { portrait: optionPortrait, rowObj } = reportParams || {};
|
|
758
|
+
return {
|
|
759
|
+
name: this.formatName(`button_${label}`, type, grid),
|
|
760
|
+
component: 'ZdButton',
|
|
761
|
+
cssClass,
|
|
762
|
+
icon: true,
|
|
763
|
+
iconName,
|
|
764
|
+
events: {
|
|
765
|
+
click: () => grid.getReport(type, optionPortrait, rowObj),
|
|
766
|
+
},
|
|
767
|
+
};
|
|
768
|
+
}
|
|
769
|
+
buildDivider(option, type, grid) {
|
|
770
|
+
const { label } = option;
|
|
771
|
+
return {
|
|
772
|
+
name: this.formatName(`divider_${label}`, type, grid),
|
|
773
|
+
component: 'ZdDivider',
|
|
774
|
+
cssClass: 'zd-my-1',
|
|
775
|
+
vertical: true,
|
|
776
|
+
};
|
|
777
|
+
}
|
|
778
|
+
buildComponent(grid) {
|
|
779
|
+
const { type, label, multiOption, } = this.config;
|
|
780
|
+
const optionComponents = multiOption.map((option) => ([
|
|
781
|
+
Object.assign(Object.assign({}, this.buildTooltip(option, type, grid)), { children: [
|
|
782
|
+
this.buildButton(option, type, grid),
|
|
783
|
+
] }),
|
|
784
|
+
this.buildDivider(option, type, grid),
|
|
785
|
+
]))
|
|
786
|
+
.flat();
|
|
787
|
+
optionComponents.pop();
|
|
788
|
+
const text = {
|
|
789
|
+
name: this.formatName('text', type, grid),
|
|
790
|
+
component: 'ZdText',
|
|
791
|
+
cssClass: 'zd-display-flex zd-align-center zd-flex-grow-1 tek-grid-export-multioption-text',
|
|
792
|
+
events: {
|
|
793
|
+
click: ({ event }) => event === null || event === void 0 ? void 0 : event.stopPropagation(),
|
|
794
|
+
},
|
|
795
|
+
text: label || '',
|
|
796
|
+
};
|
|
797
|
+
const result = {
|
|
798
|
+
name: this.formatName('row', type, grid),
|
|
799
|
+
component: 'ZdRow',
|
|
800
|
+
cssClass: 'zd-display-flex zd-ma-0 zd-py-0 zd-gap-x-1 tek-grid-export-multioption-row',
|
|
801
|
+
children: [text, ...optionComponents],
|
|
802
|
+
};
|
|
803
|
+
return result;
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
|
|
718
807
|
class GridBase {
|
|
719
808
|
constructor(grid) {
|
|
720
809
|
this.exportConfigButtons = [];
|
|
@@ -739,20 +828,15 @@
|
|
|
739
828
|
this.grid = grid;
|
|
740
829
|
this.exportConfigButtons = this.getExportConfigButtons();
|
|
741
830
|
}
|
|
831
|
+
getOption(config) {
|
|
832
|
+
if (config.multiOption)
|
|
833
|
+
return new MultiOption(config);
|
|
834
|
+
return new ButtonOption(config);
|
|
835
|
+
}
|
|
742
836
|
getExportConfigButtons() {
|
|
743
837
|
return this.grid.exportConfig.map((config) => {
|
|
744
|
-
const
|
|
745
|
-
|
|
746
|
-
return {
|
|
747
|
-
label,
|
|
748
|
-
iconName,
|
|
749
|
-
name: `${this.grid.name}_export_${type}_${orientation}`,
|
|
750
|
-
component: 'ZdButton',
|
|
751
|
-
flat: true,
|
|
752
|
-
events: {
|
|
753
|
-
click: () => this.grid.getReport(type, portrait),
|
|
754
|
-
},
|
|
755
|
-
};
|
|
838
|
+
const option = this.getOption(config);
|
|
839
|
+
return option.buildComponent(this.grid);
|
|
756
840
|
});
|
|
757
841
|
}
|
|
758
842
|
createToolbarProps() {
|
|
@@ -1093,6 +1177,8 @@
|
|
|
1093
1177
|
TEKGRID_MULTIPLE_VALUE_HINT: 'Separe valores usando ";"',
|
|
1094
1178
|
TEKGRID_EXPORT: 'Exportar',
|
|
1095
1179
|
TEKGRID_EXPORT_AS: 'Exportar como {{ type }}',
|
|
1180
|
+
TEKGRID_PORTRAIT: 'Retrato',
|
|
1181
|
+
TEKGRID_LANDSCAPE: 'Paisagem',
|
|
1096
1182
|
TEKGRID_COLUMN_VISIBLE: 'Visível',
|
|
1097
1183
|
TEKGRID_COLUMN_GROUPED: 'Grupo',
|
|
1098
1184
|
TEKGRID_COLUMN_AGGREGATION: 'Totalização',
|
|
@@ -1162,6 +1248,8 @@
|
|
|
1162
1248
|
TEKGRID_MULTIPLE_VALUE_HINT: 'Separate values using ";"',
|
|
1163
1249
|
TEKGRID_EXPORT: 'Export',
|
|
1164
1250
|
TEKGRID_EXPORT_AS: 'Export as {{ type }}',
|
|
1251
|
+
TEKGRID_PORTRAIT: 'Portrait',
|
|
1252
|
+
TEKGRID_LANDSCAPE: 'Landscape',
|
|
1165
1253
|
TEKGRID_COLUMN_VISIBLE: 'Visible',
|
|
1166
1254
|
TEKGRID_COLUMN_GROUPED: 'Grouped',
|
|
1167
1255
|
TEKGRID_COLUMN_AGGREGATION: 'Aggregation',
|
|
@@ -1231,6 +1319,8 @@
|
|
|
1231
1319
|
TEKGRID_MULTIPLE_VALUE_HINT: 'Separe los valores usando ";"',
|
|
1232
1320
|
TEKGRID_EXPORT: 'Exportar',
|
|
1233
1321
|
TEKGRID_EXPORT_AS: 'Exportar como {{ type }}',
|
|
1322
|
+
TEKGRID_PORTRAIT: 'Vertical',
|
|
1323
|
+
TEKGRID_LANDSCAPE: 'Horizontal',
|
|
1234
1324
|
TEKGRID_COLUMN_VISIBLE: 'Visible',
|
|
1235
1325
|
TEKGRID_COLUMN_GROUPED: 'Grupo',
|
|
1236
1326
|
TEKGRID_COLUMN_AGGREGATION: 'Totalización',
|
|
@@ -2084,6 +2174,15 @@
|
|
|
2084
2174
|
{
|
|
2085
2175
|
type: 'pdf',
|
|
2086
2176
|
label: core.I18n.translate('TEKGRID_EXPORT_AS', { type: 'PDF' }),
|
|
2177
|
+
multiOption: [
|
|
2178
|
+
{ label: core.I18n.translate('TEKGRID_PORTRAIT'), iconName: 'mdi-file-outline' },
|
|
2179
|
+
{
|
|
2180
|
+
label: core.I18n.translate('TEKGRID_LANDSCAPE'),
|
|
2181
|
+
iconName: 'mdi-file-outline',
|
|
2182
|
+
cssClass: 'tek-grid-export-landscape',
|
|
2183
|
+
reportParams: { portrait: false },
|
|
2184
|
+
},
|
|
2185
|
+
],
|
|
2087
2186
|
},
|
|
2088
2187
|
{
|
|
2089
2188
|
type: 'xls',
|
|
@@ -2478,8 +2577,9 @@
|
|
|
2478
2577
|
resetFooterVariables(group) {
|
|
2479
2578
|
this.summaryColumns.forEach((column) => {
|
|
2480
2579
|
group.footer[column.name] = {
|
|
2481
|
-
sum: 0,
|
|
2482
2580
|
count: 0,
|
|
2581
|
+
sum: undefined,
|
|
2582
|
+
avg: undefined,
|
|
2483
2583
|
min: undefined,
|
|
2484
2584
|
max: undefined,
|
|
2485
2585
|
};
|
|
@@ -2488,17 +2588,24 @@
|
|
|
2488
2588
|
isUndefined(value) {
|
|
2489
2589
|
return value === undefined || value === null;
|
|
2490
2590
|
}
|
|
2491
|
-
calcSummaryValues(summary, rowValue) {
|
|
2591
|
+
calcSummaryValues(columnName, summary, rowValue) {
|
|
2492
2592
|
if (!this.isUndefined(rowValue)) {
|
|
2493
2593
|
summary.count += 1;
|
|
2494
|
-
if (
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2594
|
+
if (this.events.calcSummary) {
|
|
2595
|
+
this.callEvent('calcSummary', {
|
|
2596
|
+
component: this, columnName, summary, rowValue,
|
|
2597
|
+
});
|
|
2598
|
+
}
|
|
2599
|
+
else {
|
|
2600
|
+
if (summary.min === undefined)
|
|
2601
|
+
summary.min = rowValue;
|
|
2602
|
+
if (summary.max === undefined)
|
|
2603
|
+
summary.max = rowValue;
|
|
2604
|
+
summary.min = rowValue < summary.min ? rowValue : summary.min;
|
|
2605
|
+
summary.max = rowValue > summary.max ? rowValue : summary.max;
|
|
2606
|
+
if (typeof rowValue === 'number') {
|
|
2607
|
+
summary.sum = (summary.sum || 0) + rowValue;
|
|
2608
|
+
}
|
|
2502
2609
|
}
|
|
2503
2610
|
}
|
|
2504
2611
|
}
|
|
@@ -2510,14 +2617,15 @@
|
|
|
2510
2617
|
if (this.isUndefined(this.summary[columnName])) {
|
|
2511
2618
|
this.summary[columnName] = {
|
|
2512
2619
|
count: 0,
|
|
2513
|
-
sum:
|
|
2620
|
+
sum: undefined,
|
|
2621
|
+
avg: undefined,
|
|
2514
2622
|
min: undefined,
|
|
2515
2623
|
max: undefined,
|
|
2516
2624
|
};
|
|
2517
2625
|
}
|
|
2518
|
-
this.calcSummaryValues(this.summary[columnName], rowValue);
|
|
2626
|
+
this.calcSummaryValues(columnName, this.summary[columnName], rowValue);
|
|
2519
2627
|
this.groups.forEach((group) => {
|
|
2520
|
-
this.calcSummaryValues(group.footer[columnName], rowValue);
|
|
2628
|
+
this.calcSummaryValues(columnName, group.footer[columnName], rowValue);
|
|
2521
2629
|
});
|
|
2522
2630
|
});
|
|
2523
2631
|
}
|
|
@@ -2540,7 +2648,12 @@
|
|
|
2540
2648
|
summaryData[column.name] = currentGroup.sum;
|
|
2541
2649
|
}
|
|
2542
2650
|
else if (aggregation === 'AVG') {
|
|
2543
|
-
|
|
2651
|
+
if (currentGroup.avg) {
|
|
2652
|
+
summaryData[column.name] = currentGroup.avg;
|
|
2653
|
+
}
|
|
2654
|
+
else if (typeof currentGroup.sum === 'number') {
|
|
2655
|
+
summaryData[column.name] = currentGroup.sum / currentGroup.count;
|
|
2656
|
+
}
|
|
2544
2657
|
}
|
|
2545
2658
|
else if (aggregation === 'MIN') {
|
|
2546
2659
|
summaryData[column.name] = currentGroup.min;
|
|
@@ -3402,10 +3515,33 @@
|
|
|
3402
3515
|
{
|
|
3403
3516
|
type: 'pdf',
|
|
3404
3517
|
label: core.I18n.translate('TEKGRID_EXPORT_AS', { type: 'PDF' }),
|
|
3518
|
+
multiOption: [
|
|
3519
|
+
{ label: core.I18n.translate('TEKGRID_PORTRAIT'), iconName: 'mdi-file-outline' },
|
|
3520
|
+
{
|
|
3521
|
+
label: core.I18n.translate('TEKGRID_LANDSCAPE'),
|
|
3522
|
+
iconName: 'mdi-file-outline',
|
|
3523
|
+
cssClass: 'tek-grid-export-landscape',
|
|
3524
|
+
reportParams: { portrait: false },
|
|
3525
|
+
},
|
|
3526
|
+
],
|
|
3405
3527
|
},
|
|
3406
3528
|
{
|
|
3407
3529
|
type: 'xls',
|
|
3408
|
-
label: core.I18n.translate('TEKGRID_EXPORT_AS', {
|
|
3530
|
+
label: core.I18n.translate('TEKGRID_EXPORT_AS', {
|
|
3531
|
+
type: `XLS ${core.I18n.translate('TEKGRID_WITHOUT_GROUPS')}`,
|
|
3532
|
+
}),
|
|
3533
|
+
},
|
|
3534
|
+
{
|
|
3535
|
+
type: 'xls2',
|
|
3536
|
+
label: core.I18n.translate('TEKGRID_EXPORT_AS', {
|
|
3537
|
+
type: `XLS ${core.I18n.translate('TEKGRID_WITH_GROUPS')}`,
|
|
3538
|
+
}),
|
|
3539
|
+
},
|
|
3540
|
+
{
|
|
3541
|
+
type: 'xls3',
|
|
3542
|
+
label: core.I18n.translate('TEKGRID_EXPORT_AS', {
|
|
3543
|
+
type: `XLS ${core.I18n.translate('TEKGRID_GRID_MIRROR')}`,
|
|
3544
|
+
}),
|
|
3409
3545
|
},
|
|
3410
3546
|
{
|
|
3411
3547
|
type: 'csv',
|
|
@@ -3589,12 +3725,6 @@
|
|
|
3589
3725
|
return;
|
|
3590
3726
|
this.versionInfo.version = value;
|
|
3591
3727
|
}
|
|
3592
|
-
get defaultEmail() {
|
|
3593
|
-
return this.component.defaultEmail;
|
|
3594
|
-
}
|
|
3595
|
-
set defaultEmail(value) {
|
|
3596
|
-
this.component.defaultEmail = value;
|
|
3597
|
-
}
|
|
3598
3728
|
get hasDefaultEmail() {
|
|
3599
3729
|
return !!this.component.defaultEmail;
|
|
3600
3730
|
}
|
|
@@ -3797,7 +3927,7 @@
|
|
|
3797
3927
|
grid: {
|
|
3798
3928
|
cols: '12',
|
|
3799
3929
|
},
|
|
3800
|
-
value:
|
|
3930
|
+
value: this.defaultEmail,
|
|
3801
3931
|
readonly: `{{TekUserInfoController_${this.componentId}.hasDefaultEmail}}`,
|
|
3802
3932
|
validations: {
|
|
3803
3933
|
required: {},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeedhi/teknisa-components-common",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.92.0",
|
|
4
4
|
"description": "Teknisa Components Common",
|
|
5
5
|
"author": "Zeedhi <zeedhi@teknisa.com>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@zeedhi/core": "*"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "00436210f319190361a5043c0815093fa6379227"
|
|
36
36
|
}
|