@zeedhi/teknisa-components-common 1.65.0 → 1.67.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 +507 -495
- package/coverage/coverage-final.json +5 -5
- package/coverage/lcov-report/index.html +11 -11
- package/coverage/lcov-report/tests/__helpers__/component-event-helper.ts.html +1 -1
- package/coverage/lcov-report/tests/__helpers__/get-child-helper.ts.html +1 -1
- package/coverage/lcov-report/tests/__helpers__/index.html +1 -1
- package/coverage/lcov-report/tests/__helpers__/index.ts.html +1 -1
- package/coverage/lcov-report/tests/__helpers__/mock-created-helper.ts.html +1 -1
- package/coverage/lcov.info +909 -895
- package/dist/tek-components-common.esm.js +151 -47
- package/dist/tek-components-common.umd.js +151 -47
- package/package.json +2 -2
- package/tests/unit/components/tek-grid/grid.spec.ts +23 -0
- package/tests/unit/utils/grid-base/grid-controller.spec.ts +11 -0
- package/types/components/tek-grid/grid.d.ts +2 -1
- package/types/components/tek-grid/interfaces.d.ts +5 -1
- package/types/components/tek-tree-grid/interfaces.d.ts +2 -1
- package/types/components/tek-tree-grid/tree-grid.d.ts +2 -1
- package/types/utils/grid-base/grid-controller.d.ts +1 -0
|
@@ -917,9 +917,23 @@
|
|
|
917
917
|
}
|
|
918
918
|
createFilterFromColumns() {
|
|
919
919
|
if (!this.filterModal) {
|
|
920
|
+
const originalProps = {
|
|
921
|
+
height: 'auto',
|
|
922
|
+
persistent: true,
|
|
923
|
+
title: 'FILTER',
|
|
924
|
+
};
|
|
925
|
+
const mergeModalFilterProps = Object.assign(originalProps, this.grid.modalFilterProps);
|
|
920
926
|
const filterModalDef = {
|
|
921
927
|
name: `${this.grid.name}-filter-modal`,
|
|
922
|
-
persistent:
|
|
928
|
+
persistent: mergeModalFilterProps.persistent,
|
|
929
|
+
grid: mergeModalFilterProps.grid,
|
|
930
|
+
cssClass: mergeModalFilterProps.cssClass,
|
|
931
|
+
cssStyle: mergeModalFilterProps.cssStyle,
|
|
932
|
+
draggable: mergeModalFilterProps.draggable,
|
|
933
|
+
dragHandle: mergeModalFilterProps.dragHandle,
|
|
934
|
+
fullscreen: mergeModalFilterProps.fullscreen,
|
|
935
|
+
light: mergeModalFilterProps.light,
|
|
936
|
+
dark: mergeModalFilterProps.dark,
|
|
923
937
|
children: [
|
|
924
938
|
{
|
|
925
939
|
name: `${this.grid.name}-filter-header-container`,
|
|
@@ -936,7 +950,7 @@
|
|
|
936
950
|
{
|
|
937
951
|
name: `${this.grid.name}-filter-title`,
|
|
938
952
|
component: 'ZdText',
|
|
939
|
-
text:
|
|
953
|
+
text: `${mergeModalFilterProps.title}`,
|
|
940
954
|
tag: 'h3',
|
|
941
955
|
},
|
|
942
956
|
],
|
|
@@ -957,6 +971,7 @@
|
|
|
957
971
|
scrollView: true,
|
|
958
972
|
cssClass: 'zd-my-2 zd-pa-0',
|
|
959
973
|
maxHeight: '18.75rem',
|
|
974
|
+
height: this.grid.modalFilterProps.height,
|
|
960
975
|
children: [
|
|
961
976
|
{
|
|
962
977
|
name: `${this.grid.name}-filter-form`,
|
|
@@ -1458,6 +1473,9 @@
|
|
|
1458
1473
|
get showFilterButton() {
|
|
1459
1474
|
return this.grid.filterButton;
|
|
1460
1475
|
}
|
|
1476
|
+
get showModalFilterProps() {
|
|
1477
|
+
return this.grid.modalFilterProps;
|
|
1478
|
+
}
|
|
1461
1479
|
get showSearchInput() {
|
|
1462
1480
|
return this.grid.showSearch;
|
|
1463
1481
|
}
|
|
@@ -1465,8 +1483,12 @@
|
|
|
1465
1483
|
return this.grid.showReload;
|
|
1466
1484
|
}
|
|
1467
1485
|
get showDivider2() {
|
|
1468
|
-
return this.showReloadButton
|
|
1469
|
-
|
|
1486
|
+
return (this.showReloadButton
|
|
1487
|
+
&& (this.showLayoutOptionsButton
|
|
1488
|
+
|| this.showColumnsButton
|
|
1489
|
+
|| this.showActionsButton
|
|
1490
|
+
|| this.showExportButton
|
|
1491
|
+
|| this.showSearchInput));
|
|
1470
1492
|
}
|
|
1471
1493
|
get showColumnsButton() {
|
|
1472
1494
|
return this.grid.columnsButton;
|
|
@@ -1478,8 +1500,13 @@
|
|
|
1478
1500
|
return this.grid.showLayoutOptions;
|
|
1479
1501
|
}
|
|
1480
1502
|
get showDivider1() {
|
|
1481
|
-
return (this.showAddButton || this.showDeleteButton)
|
|
1482
|
-
|
|
1503
|
+
return ((this.showAddButton || this.showDeleteButton)
|
|
1504
|
+
&& (this.showReloadButton
|
|
1505
|
+
|| this.showLayoutOptionsButton
|
|
1506
|
+
|| this.showColumnsButton
|
|
1507
|
+
|| this.showActionsButton
|
|
1508
|
+
|| this.showExportButton
|
|
1509
|
+
|| this.showSearchInput));
|
|
1483
1510
|
}
|
|
1484
1511
|
get showActionsButton() {
|
|
1485
1512
|
return this.grid.actions.length > 0;
|
|
@@ -1488,10 +1515,11 @@
|
|
|
1488
1515
|
return this.grid.showExport;
|
|
1489
1516
|
}
|
|
1490
1517
|
get showActionAndExportButton() {
|
|
1491
|
-
return (this.showLayoutOptionsButton || this.showColumnsButton)
|
|
1518
|
+
return ((this.showLayoutOptionsButton || this.showColumnsButton)
|
|
1519
|
+
&& (this.showActionsButton || this.showExportButton || this.showSearchInput));
|
|
1492
1520
|
}
|
|
1493
1521
|
get showDivider3() {
|
|
1494
|
-
return (this.showActionsButton || this.showExportButton) && this.showSearchInput;
|
|
1522
|
+
return ((this.showActionsButton || this.showExportButton) && this.showSearchInput);
|
|
1495
1523
|
}
|
|
1496
1524
|
get isEditing() {
|
|
1497
1525
|
return this.grid.editing;
|
|
@@ -1500,8 +1528,10 @@
|
|
|
1500
1528
|
return !this.isEditing;
|
|
1501
1529
|
}
|
|
1502
1530
|
get disableDeleteButton() {
|
|
1503
|
-
return !((this.grid.deleteButton === 'selection'
|
|
1504
|
-
|
|
1531
|
+
return !((this.grid.deleteButton === 'selection'
|
|
1532
|
+
&& this.grid.selectedRows.length > 0)
|
|
1533
|
+
|| (this.grid.deleteButton === 'currentRow'
|
|
1534
|
+
&& this.grid.datasource.currentRow[this.grid.datasource.uniqueKey]));
|
|
1505
1535
|
}
|
|
1506
1536
|
}
|
|
1507
1537
|
|
|
@@ -2174,6 +2204,18 @@
|
|
|
2174
2204
|
* @public
|
|
2175
2205
|
*/
|
|
2176
2206
|
this.showLayoutOptions = true;
|
|
2207
|
+
this.modalFilterProps = {
|
|
2208
|
+
name: this.name,
|
|
2209
|
+
height: 'auto',
|
|
2210
|
+
persistent: true,
|
|
2211
|
+
cssClass: '',
|
|
2212
|
+
cssStyle: '',
|
|
2213
|
+
dark: false,
|
|
2214
|
+
draggable: false,
|
|
2215
|
+
fullscreen: false,
|
|
2216
|
+
dragHandle: '',
|
|
2217
|
+
title: 'FILTER',
|
|
2218
|
+
};
|
|
2177
2219
|
/**
|
|
2178
2220
|
* Show export button
|
|
2179
2221
|
*/
|
|
@@ -2192,15 +2234,21 @@
|
|
|
2192
2234
|
},
|
|
2193
2235
|
{
|
|
2194
2236
|
type: 'xls',
|
|
2195
|
-
label: core.I18n.translate('TEKGRID_EXPORT_AS', {
|
|
2237
|
+
label: core.I18n.translate('TEKGRID_EXPORT_AS', {
|
|
2238
|
+
type: `XLS ${core.I18n.translate('TEKGRID_WITHOUT_GROUPS')}`,
|
|
2239
|
+
}),
|
|
2196
2240
|
},
|
|
2197
2241
|
{
|
|
2198
2242
|
type: 'xls2',
|
|
2199
|
-
label: core.I18n.translate('TEKGRID_EXPORT_AS', {
|
|
2243
|
+
label: core.I18n.translate('TEKGRID_EXPORT_AS', {
|
|
2244
|
+
type: `XLS ${core.I18n.translate('TEKGRID_WITH_GROUPS')}`,
|
|
2245
|
+
}),
|
|
2200
2246
|
},
|
|
2201
2247
|
{
|
|
2202
2248
|
type: 'xls3',
|
|
2203
|
-
label: core.I18n.translate('TEKGRID_EXPORT_AS', {
|
|
2249
|
+
label: core.I18n.translate('TEKGRID_EXPORT_AS', {
|
|
2250
|
+
type: `XLS ${core.I18n.translate('TEKGRID_GRID_MIRROR')}`,
|
|
2251
|
+
}),
|
|
2204
2252
|
},
|
|
2205
2253
|
{
|
|
2206
2254
|
type: 'csv',
|
|
@@ -2239,6 +2287,7 @@
|
|
|
2239
2287
|
this.showExport = this.getInitValue('showExport', props.showExport, this.showExport);
|
|
2240
2288
|
this.showReload = this.getInitValue('showReload', props.showReload, this.showReload);
|
|
2241
2289
|
this.exportConfig = this.getInitValue('exportConfig', props.exportConfig, this.exportConfig);
|
|
2290
|
+
this.modalFilterProps = this.getInitValue('modalFilterProps', props.modalFilterProps, this.modalFilterProps);
|
|
2242
2291
|
this.exportActions = props.exportActions || this.exportActions;
|
|
2243
2292
|
this.groupsOpened = this.getInitValue('groupsOpened', props.groupsOpened, this.groupsOpened);
|
|
2244
2293
|
this.showSummaryTotal = this.getInitValue('showSummaryTotal', props.showSummaryTotal, this.showSummaryTotal);
|
|
@@ -2324,14 +2373,17 @@
|
|
|
2324
2373
|
return columns.map((column) => new TekGridColumn(column, this));
|
|
2325
2374
|
}
|
|
2326
2375
|
columnHasFilterData(column) {
|
|
2327
|
-
if (this.datasource instanceof TekRestDatasource
|
|
2376
|
+
if (this.datasource instanceof TekRestDatasource
|
|
2377
|
+
|| this.datasource instanceof TekMemoryDatasource) {
|
|
2328
2378
|
const dynamicFilter = this.datasource.dynamicFilter[column.name];
|
|
2329
2379
|
return dynamicFilter && dynamicFilter.length > 0;
|
|
2330
2380
|
}
|
|
2331
2381
|
return this.datasource.filter[column.name];
|
|
2332
2382
|
}
|
|
2333
2383
|
buildReportGroups() {
|
|
2334
|
-
return this.columns
|
|
2384
|
+
return this.columns
|
|
2385
|
+
.filter((column) => column.grouped)
|
|
2386
|
+
.map((column) => ({
|
|
2335
2387
|
field: column.name,
|
|
2336
2388
|
header: {
|
|
2337
2389
|
displayfield: column.name,
|
|
@@ -2342,7 +2394,9 @@
|
|
|
2342
2394
|
}
|
|
2343
2395
|
buildReportAggregations() {
|
|
2344
2396
|
const aggregations = {};
|
|
2345
|
-
this.columns
|
|
2397
|
+
this.columns
|
|
2398
|
+
.filter((column) => column.aggregation)
|
|
2399
|
+
.forEach((column) => {
|
|
2346
2400
|
aggregations[column.name] = { expression: column.aggregation };
|
|
2347
2401
|
});
|
|
2348
2402
|
return aggregations;
|
|
@@ -2353,7 +2407,8 @@
|
|
|
2353
2407
|
const reportGroups = this.buildReportGroups();
|
|
2354
2408
|
const reportAggregations = this.buildReportAggregations();
|
|
2355
2409
|
let filter;
|
|
2356
|
-
if (this.datasource instanceof TekRestDatasource
|
|
2410
|
+
if (this.datasource instanceof TekRestDatasource
|
|
2411
|
+
|| this.datasource instanceof TekMemoryDatasource) {
|
|
2357
2412
|
const dynamicFilter = Object.assign({}, this.datasource.dynamicFilter);
|
|
2358
2413
|
const formatFilter = (name) => __awaiter(this, void 0, void 0, function* () {
|
|
2359
2414
|
let column;
|
|
@@ -2391,13 +2446,15 @@
|
|
|
2391
2446
|
if (typeof this.events.beforeOpenReport === 'function') {
|
|
2392
2447
|
beforeOpen = this.events.beforeOpenReport;
|
|
2393
2448
|
}
|
|
2394
|
-
return report
|
|
2449
|
+
return report
|
|
2450
|
+
.getReport(type, portrait, {
|
|
2395
2451
|
metaData: merge__default["default"](rowObj, {
|
|
2396
2452
|
filter,
|
|
2397
2453
|
groups: reportGroups,
|
|
2398
2454
|
columns: reportAggregations,
|
|
2399
2455
|
}),
|
|
2400
|
-
}, beforeOpen)
|
|
2456
|
+
}, beforeOpen)
|
|
2457
|
+
.then((reportUrl) => window.open(reportUrl));
|
|
2401
2458
|
});
|
|
2402
2459
|
}
|
|
2403
2460
|
initGrouping(lazyLoad) {
|
|
@@ -2412,7 +2469,8 @@
|
|
|
2412
2469
|
buildGetFunction(originalGet) {
|
|
2413
2470
|
return () => __awaiter(this, void 0, void 0, function* () {
|
|
2414
2471
|
return originalGet.call(this.datasource).then((data) => {
|
|
2415
|
-
if (this.groupColumns.length
|
|
2472
|
+
if (this.groupColumns.length
|
|
2473
|
+
|| (this.showSummaryTotal && this.summaryColumns.length)) {
|
|
2416
2474
|
this.buildGroupedData();
|
|
2417
2475
|
}
|
|
2418
2476
|
return data;
|
|
@@ -2424,7 +2482,8 @@
|
|
|
2424
2482
|
this.groupedData = [];
|
|
2425
2483
|
this.groupColumns = this.columns.filter((column) => column.grouped);
|
|
2426
2484
|
this.groupColumnNames = this.groupColumns.map((column) => column.name);
|
|
2427
|
-
if (this.groupColumns.length
|
|
2485
|
+
if (this.groupColumns.length
|
|
2486
|
+
|| (this.showSummaryTotal && this.summaryColumns.length)) {
|
|
2428
2487
|
if (this.groupColumns.length) {
|
|
2429
2488
|
const groupOrderColumns = this.groupColumnNames.map((column) => `${column}.asc`);
|
|
2430
2489
|
const otherOrderColumns = this.datasource.order.filter((column) => this.groupColumnNames.indexOf(column.split('.')[0]) === -1);
|
|
@@ -2472,7 +2531,9 @@
|
|
|
2472
2531
|
this.groups.forEach((group) => {
|
|
2473
2532
|
group.lastGroupHeaderRow.children.push(row);
|
|
2474
2533
|
});
|
|
2475
|
-
this.groupedData.push(Object.assign(Object.assign({}, row), { groupHeaders: this.groups
|
|
2534
|
+
this.groupedData.push(Object.assign(Object.assign({}, row), { groupHeaders: this.groups
|
|
2535
|
+
.map((group) => group.lastGroupHeaderRow)
|
|
2536
|
+
.filter(Boolean) }));
|
|
2476
2537
|
this.calcSummary(row);
|
|
2477
2538
|
});
|
|
2478
2539
|
if (this.groupedData.length > 0) {
|
|
@@ -2608,7 +2669,8 @@
|
|
|
2608
2669
|
else if (aggregation === 'MIN') {
|
|
2609
2670
|
summaryData[column.name] = currentGroup.min;
|
|
2610
2671
|
}
|
|
2611
|
-
else {
|
|
2672
|
+
else {
|
|
2673
|
+
// if (aggregation === 'MAX') {
|
|
2612
2674
|
summaryData[column.name] = currentGroup.max;
|
|
2613
2675
|
}
|
|
2614
2676
|
});
|
|
@@ -2620,9 +2682,9 @@
|
|
|
2620
2682
|
this.viewUpdateScrollData();
|
|
2621
2683
|
}
|
|
2622
2684
|
isItemVisible(row) {
|
|
2623
|
-
return !row.groupHeaders
|
|
2685
|
+
return (!row.groupHeaders
|
|
2624
2686
|
|| !row.groupHeaders.length
|
|
2625
|
-
|| row.groupHeaders.every((group) => group.groupOpened);
|
|
2687
|
+
|| row.groupHeaders.every((group) => group.groupOpened));
|
|
2626
2688
|
}
|
|
2627
2689
|
getGroupValue(group, row) {
|
|
2628
2690
|
const groupColumn = this.getColumn(group.column.name);
|
|
@@ -2647,7 +2709,8 @@
|
|
|
2647
2709
|
});
|
|
2648
2710
|
}
|
|
2649
2711
|
isGrouped() {
|
|
2650
|
-
return this.groupColumnNames.length
|
|
2712
|
+
return (this.groupColumnNames.length
|
|
2713
|
+
|| (this.showSummaryTotal && this.summaryColumns.length));
|
|
2651
2714
|
}
|
|
2652
2715
|
navigateDown(params) {
|
|
2653
2716
|
if (!this.isGrouped()) {
|
|
@@ -2658,12 +2721,14 @@
|
|
|
2658
2721
|
if (!this.groupedData.length || index === this.groupedData.length)
|
|
2659
2722
|
return;
|
|
2660
2723
|
const { uniqueKey, currentRow } = this.datasource;
|
|
2661
|
-
const rowIndex = index !== undefined
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2724
|
+
const rowIndex = index !== undefined
|
|
2725
|
+
? index
|
|
2726
|
+
: this.groupedData.findIndex((row) => {
|
|
2727
|
+
if (currentRow.group) {
|
|
2728
|
+
return row.group && row.groupValue === currentRow.groupValue;
|
|
2729
|
+
}
|
|
2730
|
+
return row[uniqueKey] && row[uniqueKey] === currentRow[uniqueKey];
|
|
2731
|
+
});
|
|
2667
2732
|
const newRow = this.groupedData[rowIndex + 1];
|
|
2668
2733
|
if (newRow && this.isItemVisible(newRow) && !newRow.groupFooter) {
|
|
2669
2734
|
this.datasource.currentRow = newRow;
|
|
@@ -2683,12 +2748,14 @@
|
|
|
2683
2748
|
return;
|
|
2684
2749
|
const { uniqueKey, currentRow } = this.datasource;
|
|
2685
2750
|
let rowIndex;
|
|
2686
|
-
rowIndex = index !== undefined
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2751
|
+
rowIndex = index !== undefined
|
|
2752
|
+
? index
|
|
2753
|
+
: this.groupedData.findIndex((row) => {
|
|
2754
|
+
if (currentRow.group) {
|
|
2755
|
+
return row.group && row.groupValue === currentRow.groupValue;
|
|
2756
|
+
}
|
|
2757
|
+
return row[uniqueKey] && row[uniqueKey] === currentRow[uniqueKey];
|
|
2758
|
+
});
|
|
2692
2759
|
if (rowIndex === -1)
|
|
2693
2760
|
rowIndex = this.groupedData.length;
|
|
2694
2761
|
const newRow = this.groupedData[rowIndex - 1];
|
|
@@ -2726,7 +2793,11 @@
|
|
|
2726
2793
|
if (!this.preventRowClick) {
|
|
2727
2794
|
this.datasource.currentRow = row;
|
|
2728
2795
|
this.callEvent('rowClick', {
|
|
2729
|
-
event,
|
|
2796
|
+
event,
|
|
2797
|
+
element,
|
|
2798
|
+
row,
|
|
2799
|
+
component: this,
|
|
2800
|
+
column: undefined,
|
|
2730
2801
|
});
|
|
2731
2802
|
}
|
|
2732
2803
|
this.preventRowClick = false;
|
|
@@ -2740,7 +2811,11 @@
|
|
|
2740
2811
|
groupRowClick(row, event, element) {
|
|
2741
2812
|
if (!this.preventRowClick) {
|
|
2742
2813
|
this.callEvent('groupRowClick', {
|
|
2743
|
-
event,
|
|
2814
|
+
event,
|
|
2815
|
+
element,
|
|
2816
|
+
row,
|
|
2817
|
+
component: this,
|
|
2818
|
+
column: undefined,
|
|
2744
2819
|
});
|
|
2745
2820
|
}
|
|
2746
2821
|
this.preventRowClick = false;
|
|
@@ -2755,12 +2830,20 @@
|
|
|
2755
2830
|
selectGroupClick(row, isSelected, event, element) {
|
|
2756
2831
|
if (isSelected) {
|
|
2757
2832
|
this.callEvent('groupSelected', {
|
|
2758
|
-
event,
|
|
2833
|
+
event,
|
|
2834
|
+
element,
|
|
2835
|
+
row,
|
|
2836
|
+
component: this,
|
|
2837
|
+
column: undefined,
|
|
2759
2838
|
});
|
|
2760
2839
|
}
|
|
2761
2840
|
else {
|
|
2762
2841
|
this.callEvent('groupUnselected', {
|
|
2763
|
-
event,
|
|
2842
|
+
event,
|
|
2843
|
+
element,
|
|
2844
|
+
row,
|
|
2845
|
+
component: this,
|
|
2846
|
+
column: undefined,
|
|
2764
2847
|
});
|
|
2765
2848
|
}
|
|
2766
2849
|
}
|
|
@@ -3025,6 +3108,19 @@
|
|
|
3025
3108
|
this.actions = [];
|
|
3026
3109
|
/* Show Filter button */
|
|
3027
3110
|
this.filterButton = false;
|
|
3111
|
+
/* Define modal filter props */
|
|
3112
|
+
this.modalFilterProps = {
|
|
3113
|
+
name: this.name,
|
|
3114
|
+
height: 'auto',
|
|
3115
|
+
persistent: true,
|
|
3116
|
+
cssClass: '',
|
|
3117
|
+
cssStyle: '',
|
|
3118
|
+
dark: false,
|
|
3119
|
+
draggable: false,
|
|
3120
|
+
fullscreen: false,
|
|
3121
|
+
dragHandle: '',
|
|
3122
|
+
title: 'FILTER',
|
|
3123
|
+
};
|
|
3028
3124
|
/* Show search Input */
|
|
3029
3125
|
this.showSearch = true;
|
|
3030
3126
|
/* Show Column Filter button */
|
|
@@ -3118,7 +3214,8 @@
|
|
|
3118
3214
|
return columns.map((column) => new TekGridColumn(column, this));
|
|
3119
3215
|
}
|
|
3120
3216
|
columnHasFilterData(column) {
|
|
3121
|
-
if (this.datasource instanceof TekRestDatasource
|
|
3217
|
+
if (this.datasource instanceof TekRestDatasource
|
|
3218
|
+
|| this.datasource instanceof TekMemoryDatasource) {
|
|
3122
3219
|
const dynamicFilter = this.datasource.dynamicFilter[column.name];
|
|
3123
3220
|
return dynamicFilter && dynamicFilter.length > 0;
|
|
3124
3221
|
}
|
|
@@ -3130,7 +3227,8 @@
|
|
|
3130
3227
|
const reportGroups = {};
|
|
3131
3228
|
const reportAggregations = {};
|
|
3132
3229
|
let filter;
|
|
3133
|
-
if (this.datasource instanceof TekRestDatasource
|
|
3230
|
+
if (this.datasource instanceof TekRestDatasource
|
|
3231
|
+
|| this.datasource instanceof TekMemoryDatasource) {
|
|
3134
3232
|
const reportFilter = new ReportFilter(this.datasource.dynamicFilter);
|
|
3135
3233
|
filter = reportFilter.build();
|
|
3136
3234
|
}
|
|
@@ -3138,13 +3236,15 @@
|
|
|
3138
3236
|
if (typeof this.events.beforeOpenReport === 'function') {
|
|
3139
3237
|
beforeOpen = this.events.beforeOpenReport;
|
|
3140
3238
|
}
|
|
3141
|
-
return report
|
|
3239
|
+
return report
|
|
3240
|
+
.getReport(type, portrait, {
|
|
3142
3241
|
metaData: merge__default["default"](rowObj, {
|
|
3143
3242
|
filter,
|
|
3144
3243
|
groups: reportGroups,
|
|
3145
3244
|
columns: reportAggregations,
|
|
3146
3245
|
}),
|
|
3147
|
-
}, beforeOpen)
|
|
3246
|
+
}, beforeOpen)
|
|
3247
|
+
.then((reportUrl) => window.open(reportUrl));
|
|
3148
3248
|
});
|
|
3149
3249
|
}
|
|
3150
3250
|
setSearch(search) {
|
|
@@ -3162,7 +3262,11 @@
|
|
|
3162
3262
|
if (!this.preventRowClick) {
|
|
3163
3263
|
this.datasource.currentRow = row;
|
|
3164
3264
|
this.callEvent('rowClick', {
|
|
3165
|
-
event,
|
|
3265
|
+
event,
|
|
3266
|
+
element,
|
|
3267
|
+
row,
|
|
3268
|
+
component: this,
|
|
3269
|
+
column: undefined,
|
|
3166
3270
|
});
|
|
3167
3271
|
}
|
|
3168
3272
|
this.preventRowClick = false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeedhi/teknisa-components-common",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.67.0",
|
|
4
4
|
"description": "Teknisa Components Common",
|
|
5
5
|
"author": "Zeedhi <zeedhi@teknisa.com>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"@zeedhi/core": "*"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "4863f15b5b39b27f3a62e32c666a20e081997690"
|
|
35
35
|
}
|
|
@@ -44,6 +44,12 @@ describe('TekGrid', () => {
|
|
|
44
44
|
expect(instance.addButton).toBeFalsy();
|
|
45
45
|
expect(instance.deleteButton).toBe('none');
|
|
46
46
|
expect(instance.filterButton).toBeFalsy();
|
|
47
|
+
expect(instance.modalFilterProps).toEqual(
|
|
48
|
+
expect.objectContaining({
|
|
49
|
+
height: 'auto',
|
|
50
|
+
persistent: true,
|
|
51
|
+
}),
|
|
52
|
+
);
|
|
47
53
|
expect(instance.columnFilterButton).toBeFalsy();
|
|
48
54
|
expect(instance.dragColumns).toBeTruthy();
|
|
49
55
|
expect(instance.resizeColumns).toBeTruthy();
|
|
@@ -63,6 +69,17 @@ describe('TekGrid', () => {
|
|
|
63
69
|
addButton: true,
|
|
64
70
|
deleteButton: 'selection',
|
|
65
71
|
filterButton: true,
|
|
72
|
+
modalFilterProps: {
|
|
73
|
+
name: 'teste',
|
|
74
|
+
height: 'auto',
|
|
75
|
+
persistent: false,
|
|
76
|
+
cssClass: 'class-test',
|
|
77
|
+
cssStyle: 'background: red',
|
|
78
|
+
draggable: true,
|
|
79
|
+
fullscreen: true,
|
|
80
|
+
light: false,
|
|
81
|
+
dark: true,
|
|
82
|
+
},
|
|
66
83
|
columnFilterButton: true,
|
|
67
84
|
dragColumns: false,
|
|
68
85
|
resizeColumns: false,
|
|
@@ -80,6 +97,12 @@ describe('TekGrid', () => {
|
|
|
80
97
|
expect(instance.addButton).toBeTruthy();
|
|
81
98
|
expect(instance.deleteButton).toBe('selection');
|
|
82
99
|
expect(instance.filterButton).toBeTruthy();
|
|
100
|
+
expect(instance.modalFilterProps).toEqual(
|
|
101
|
+
expect.objectContaining({
|
|
102
|
+
height: 'auto',
|
|
103
|
+
persistent: false,
|
|
104
|
+
}),
|
|
105
|
+
);
|
|
83
106
|
expect(instance.columnFilterButton).toBeTruthy();
|
|
84
107
|
expect(instance.dragColumns).toBeFalsy();
|
|
85
108
|
expect(instance.resizeColumns).toBeFalsy();
|
|
@@ -14,6 +14,11 @@ describe('GridController', () => {
|
|
|
14
14
|
deleteButton: 'currentRow',
|
|
15
15
|
filterButton: true,
|
|
16
16
|
columnsButton: true,
|
|
17
|
+
modalFilterProps: {
|
|
18
|
+
name: 'name',
|
|
19
|
+
height: 'auto',
|
|
20
|
+
persistent: true,
|
|
21
|
+
},
|
|
17
22
|
showExport: true,
|
|
18
23
|
showLayoutOptionsButton: true,
|
|
19
24
|
showReloadButton: true,
|
|
@@ -39,6 +44,12 @@ describe('GridController', () => {
|
|
|
39
44
|
expect(instance.isEditing).toBeFalsy();
|
|
40
45
|
expect(instance.isNotEditing).toBeTruthy();
|
|
41
46
|
expect(instance.disableDeleteButton).toBeTruthy();
|
|
47
|
+
expect(instance.showModalFilterProps).toEqual(
|
|
48
|
+
expect.objectContaining({
|
|
49
|
+
height: 'auto',
|
|
50
|
+
persistent: true,
|
|
51
|
+
}),
|
|
52
|
+
);
|
|
42
53
|
|
|
43
54
|
grid.datasource.currentRow = { id: '1' };
|
|
44
55
|
expect(instance.disableDeleteButton).toBeFalsy();
|
|
@@ -2,7 +2,7 @@ import { GridEditable, IComponentRender } from '@zeedhi/common';
|
|
|
2
2
|
import { Datasource, IDictionary } from '@zeedhi/core';
|
|
3
3
|
import { ITekGridAtoms } from '../../utils';
|
|
4
4
|
import { TekGridColumn } from './grid-column';
|
|
5
|
-
import { ITekGrid, ITekGridColumn, ITekGridEvents, ITekGridExportConfig } from './interfaces';
|
|
5
|
+
import { ITekGrid, ITekGridColumn, ITekGridEvents, ITekGridExportConfig, IModalFilterProps } from './interfaces';
|
|
6
6
|
import { TekGridLayoutOptions } from './layout-options';
|
|
7
7
|
export declare class TekGrid extends GridEditable implements ITekGrid {
|
|
8
8
|
title: string;
|
|
@@ -35,6 +35,7 @@ export declare class TekGrid extends GridEditable implements ITekGrid {
|
|
|
35
35
|
* Editable columns
|
|
36
36
|
*/
|
|
37
37
|
columns: TekGridColumn[];
|
|
38
|
+
modalFilterProps: IModalFilterProps;
|
|
38
39
|
/**
|
|
39
40
|
* Show export button
|
|
40
41
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IBeforeReportEvent, IComponent, IComponentEvents, IComponentRender, IGridColumnEditable, IGridEditable, IIterableColumnsButton, EventDef } from '@zeedhi/common';
|
|
1
|
+
import { IBeforeReportEvent, IComponent, IComponentEvents, IComponentRender, IGridColumnEditable, IGridEditable, IIterableColumnsButton, EventDef, IModal } from '@zeedhi/common';
|
|
2
2
|
import { IDictionary, IEvent, IEventParam, IDateHelperValue, IDateHelperValues } from '@zeedhi/core';
|
|
3
3
|
import { IDynamicFilterItem, TekGridLayoutOptions } from '..';
|
|
4
4
|
export interface ITekGridLayoutEventParams extends IEventParam<ITekGrid> {
|
|
@@ -39,6 +39,7 @@ export interface ITekGrid extends IGridEditable {
|
|
|
39
39
|
deleteButton?: 'none' | 'currentRow' | 'selection';
|
|
40
40
|
events?: ITekGridEvents;
|
|
41
41
|
filterButton?: boolean;
|
|
42
|
+
modalFilterProps?: IModalFilterProps;
|
|
42
43
|
showSearch?: boolean;
|
|
43
44
|
showLayoutOptions?: boolean;
|
|
44
45
|
title?: string;
|
|
@@ -144,3 +145,6 @@ export interface ITekFilterHelperValue extends IDateHelperValue {
|
|
|
144
145
|
}
|
|
145
146
|
export interface ITekFilterHelperValues extends IDateHelperValues {
|
|
146
147
|
}
|
|
148
|
+
export interface IModalFilterProps extends IModal {
|
|
149
|
+
height: string;
|
|
150
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IComponentRender, ITreeGridEditable } from '@zeedhi/common';
|
|
2
|
-
import { ITekGridColumn, ITekGridEvents, ITekGridExportConfig, TekGridLayoutOptions } from '..';
|
|
2
|
+
import { ITekGridColumn, ITekGridEvents, ITekGridExportConfig, TekGridLayoutOptions, IModalFilterProps } from '..';
|
|
3
3
|
export interface ITekTreeGrid extends ITreeGridEditable {
|
|
4
4
|
actions?: IComponentRender[];
|
|
5
5
|
addButton?: boolean;
|
|
@@ -10,6 +10,7 @@ export interface ITekTreeGrid extends ITreeGridEditable {
|
|
|
10
10
|
deleteButton?: 'none' | 'currentRow' | 'selection';
|
|
11
11
|
events?: ITekGridEvents;
|
|
12
12
|
filterButton?: boolean;
|
|
13
|
+
modalFilterProps?: IModalFilterProps;
|
|
13
14
|
showSearch?: boolean;
|
|
14
15
|
showLayoutOptions?: boolean;
|
|
15
16
|
title?: string;
|
|
@@ -2,7 +2,7 @@ import { IComponentRender, TreeGridEditable } from '@zeedhi/common';
|
|
|
2
2
|
import { Datasource, IDictionary } from '@zeedhi/core';
|
|
3
3
|
import { ITekGridAtoms } from '../../utils';
|
|
4
4
|
import { TekGridColumn } from '../tek-grid/grid-column';
|
|
5
|
-
import { ITekGridColumn, ITekGridEvents, ITekGridExportConfig } from '../tek-grid/interfaces';
|
|
5
|
+
import { IModalFilterProps, ITekGridColumn, ITekGridEvents, ITekGridExportConfig } from '../tek-grid/interfaces';
|
|
6
6
|
import { ITekTreeGrid } from './interfaces';
|
|
7
7
|
import { TekGridLayoutOptions } from '..';
|
|
8
8
|
export declare class TekTreeGrid extends TreeGridEditable implements ITekTreeGrid {
|
|
@@ -11,6 +11,7 @@ export declare class TekTreeGrid extends TreeGridEditable implements ITekTreeGri
|
|
|
11
11
|
deleteButton: 'none' | 'currentRow' | 'selection';
|
|
12
12
|
actions: IComponentRender[];
|
|
13
13
|
filterButton: boolean;
|
|
14
|
+
modalFilterProps: IModalFilterProps;
|
|
14
15
|
showSearch?: boolean;
|
|
15
16
|
columnFilterButton: boolean;
|
|
16
17
|
columnsButton: boolean;
|
|
@@ -7,6 +7,7 @@ export declare class GridController {
|
|
|
7
7
|
get showAddButton(): boolean;
|
|
8
8
|
get showDeleteButton(): boolean;
|
|
9
9
|
get showFilterButton(): boolean;
|
|
10
|
+
get showModalFilterProps(): import("../..").IModalFilterProps;
|
|
10
11
|
get showSearchInput(): boolean | undefined;
|
|
11
12
|
get showReloadButton(): boolean;
|
|
12
13
|
get showDivider2(): boolean | undefined;
|