logitude-dashboard-library 3.1.143 → 3.1.149
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/assets/styles/dl-dashboard.scss +32 -1
- package/dist/features/Dashboard/ChartsComponents/CustomCharts/PivotAgGridSupport.d.ts +26 -0
- package/dist/index.js +242 -13
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +242 -13
- package/dist/index.modern.js.map +1 -1
- package/dist/styles/dl-dashboard.scss +32 -1
- package/package.json +1 -1
|
@@ -1016,6 +1016,19 @@ $dark-grey: #717585;
|
|
|
1016
1016
|
color: #222222 !important;
|
|
1017
1017
|
}
|
|
1018
1018
|
|
|
1019
|
+
/*
|
|
1020
|
+
* Header wrap only (Ag Grid 27 / pre-v28). Leaf headers also get white-space via
|
|
1021
|
+
* headerComponentParams.template; group headers have no wrapHeaderText until v32.1.
|
|
1022
|
+
* Do not touch body .ag-cell here.
|
|
1023
|
+
*/
|
|
1024
|
+
.dl-ag-pivot-grid .ag-header-cell-text,
|
|
1025
|
+
.dl-ag-pivot-grid .ag-header-group-text {
|
|
1026
|
+
white-space: normal !important;
|
|
1027
|
+
overflow: visible !important;
|
|
1028
|
+
text-overflow: clip !important;
|
|
1029
|
+
line-height: 1.25;
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1019
1032
|
.dl-ag-pivot-grid .ag-header-cell[col-id^="ag-Grid-AutoColumn"] {
|
|
1020
1033
|
text-align: left;
|
|
1021
1034
|
}
|
|
@@ -1036,6 +1049,19 @@ $dark-grey: #717585;
|
|
|
1036
1049
|
background-color: #f5f5f5 !important;
|
|
1037
1050
|
}
|
|
1038
1051
|
|
|
1052
|
+
/* Column group totals (e.g. "Dtest Total") — match DX .dx-total / row-footer totals */
|
|
1053
|
+
.dl-ag-pivot-grid.ag-theme-balham .ag-header-cell.dl-pivot-column-group-total-header,
|
|
1054
|
+
.dl-ag-pivot-grid.ag-theme-balham .ag-header-group-cell.dl-pivot-column-group-total-header,
|
|
1055
|
+
.dl-ag-pivot-grid .ag-header-cell.dl-pivot-column-group-total-header,
|
|
1056
|
+
.dl-ag-pivot-grid .ag-header-group-cell.dl-pivot-column-group-total-header {
|
|
1057
|
+
background-color: #dddddd33 !important;
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
.dl-ag-pivot-grid .ag-cell.dl-pivot-column-group-total-cell,
|
|
1061
|
+
.dl-ag-pivot-grid .dl-pivot-column-group-total-cell {
|
|
1062
|
+
background-color: #dddddd33 !important;
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1039
1065
|
.dl-ag-pivot-grid.ag-theme-balham .ag-cell {
|
|
1040
1066
|
border: none !important;
|
|
1041
1067
|
border-right: 1px solid #DFE1E3 !important;
|
|
@@ -1105,7 +1131,12 @@ $dark-grey: #717585;
|
|
|
1105
1131
|
font-size: 12px;
|
|
1106
1132
|
font-weight: 500;
|
|
1107
1133
|
color: #46494A;
|
|
1108
|
-
|
|
1134
|
+
/*
|
|
1135
|
+
* Ag Grid autoHeight = wrapperHeight + paddingTop + paddingBottom (CellCtrl.setupAutoHeight).
|
|
1136
|
+
* Balham cell line-height is 26px; with old padding 6+5 the row measured ~37px and beat rowHeight 30.
|
|
1137
|
+
* Vertical padding 2+2 => 26+4 = 30 for single-line cells; wrapped content can still grow.
|
|
1138
|
+
*/
|
|
1139
|
+
padding: 2px 8px 2px 8px;
|
|
1109
1140
|
}
|
|
1110
1141
|
|
|
1111
1142
|
.dl-ag-pivot-grid .ag-cell-value,
|
|
@@ -42,6 +42,25 @@ export declare const getPivotDisplayName: (pivotData: any[], fieldName: string,
|
|
|
42
42
|
export declare const isPivotRowGrandTotalColumnDef: (colDef: any) => boolean;
|
|
43
43
|
export declare const isPivotRowGrandTotalGroupDef: (colGroupDef: any) => boolean;
|
|
44
44
|
export declare const resolvePivotGroupHeaderName: (colGroupDef: any, columnFields: PivotApiField[], lookupDisplayName: (field: PivotApiField, rawValue: any) => string) => string | null;
|
|
45
|
+
/**
|
|
46
|
+
* Ag Grid expandable pivot totals: leaf with pivotTotalColumnIds + columnGroupShow 'closed'.
|
|
47
|
+
* (Created by addExpandablePivotGroups — one column per measure.)
|
|
48
|
+
*/
|
|
49
|
+
export declare const isAgGridExpandablePivotColumnTotalLeaf: (colDef: any) => boolean;
|
|
50
|
+
/** After DX promote: per-measure column-group total leaf (still has pivotTotalColumnIds). */
|
|
51
|
+
export declare const isAgGridPivotColumnGroupTotalColumn: (colDef: any) => boolean;
|
|
52
|
+
export declare const setAllAgGridColumnGroupsOpened: (columnApi: any, opened: boolean) => void;
|
|
53
|
+
/**
|
|
54
|
+
* Choice 2 (DX parity) on top of Ag Grid expandable pivot totals:
|
|
55
|
+
* - Keeps native per-measure total leaves (same colIds → aggregation unchanged).
|
|
56
|
+
* - Clears columnGroupShow so totals stay visible when expanded AND collapsed
|
|
57
|
+
* (Ag Grid docs: undefined/null = always shown; open+always-shown still expandable).
|
|
58
|
+
* - Wraps them in a "{Value} Total" group for DX header layout.
|
|
59
|
+
*
|
|
60
|
+
* Requires: pivotColumnGroupTotals OFF (otherwise addExpandablePivotGroups is skipped)
|
|
61
|
+
* and suppressExpandablePivotGroups OFF when column totals are enabled.
|
|
62
|
+
*/
|
|
63
|
+
export declare const promoteExpandablePivotColumnTotalsForDx: (colGroupDef: any, columnFields: PivotApiField[], lookupDisplayName: (field: PivotApiField, rawValue: any) => string) => void;
|
|
45
64
|
export declare const getPivotValueColumnId: (pivotValueColumn: any) => string | null;
|
|
46
65
|
export declare const resolveMeasureFromPivotValueColumn: (colDef: any, measures: PivotApiMeasure[]) => PivotApiMeasure | undefined;
|
|
47
66
|
export declare const resolvePivotLeafHeaderName: (colDef: any, columnFields: PivotApiField[], lookupDisplayName: (field: PivotApiField, rawValue: any) => string, measureCount: number, measures: PivotApiMeasure[]) => string | null;
|
|
@@ -53,6 +72,13 @@ export declare const collectPivotRowPath: (startNode: any) => {
|
|
|
53
72
|
key: any;
|
|
54
73
|
}[];
|
|
55
74
|
export declare const isAgGridPivotDrillDownMeasureColumn: (colDef: any, measures: PivotApiMeasure[]) => boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Map Ag Grid blank dimension keys to what DrillDownDataProvider expects for IS NULL.
|
|
77
|
+
* - Row groups in pivot mode: null/undefined → single space ' ' (GroupStage).
|
|
78
|
+
* - Pivot column buckets: missing → '' (PivotStage.bucketChildren).
|
|
79
|
+
* Backend: string.IsNullOrEmpty(value) → `{field} IS NULL`.
|
|
80
|
+
*/
|
|
81
|
+
export declare const normalizePivotDrillDownFieldValue: (value: any) => string | null;
|
|
56
82
|
export declare const buildPivotDrillDownPivotFields: (colDef: any, startNode: any, apiFields: PivotApiField[]) => any[];
|
|
57
83
|
export declare const getMeasureCaption: (measure: PivotApiMeasure) => string;
|
|
58
84
|
export declare const parseJsonArray: (json: string | null | undefined) => any[];
|
package/dist/index.js
CHANGED
|
@@ -1972,7 +1972,8 @@ var TableChart = function TableChart(props) {
|
|
|
1972
1972
|
}
|
|
1973
1973
|
|
|
1974
1974
|
if (!rowData) return true;
|
|
1975
|
-
|
|
1975
|
+
var rowTenantId = rowData.lookUp_Tenant != null ? rowData.lookUp_Tenant : rowData.Tenant;
|
|
1976
|
+
return Number(rowTenantId) === Number(Session.Tenant);
|
|
1976
1977
|
};
|
|
1977
1978
|
|
|
1978
1979
|
var isClickableCell = function isClickableCell(fieldCode, rowData) {
|
|
@@ -1984,7 +1985,7 @@ var TableChart = function TableChart(props) {
|
|
|
1984
1985
|
return false;
|
|
1985
1986
|
}
|
|
1986
1987
|
|
|
1987
|
-
return fieldCode == "ShipmentNumber" && objectTableName == "Shipment" || IsShipmentMasterFieldClickable(fieldCode, rowData) || fieldCode == "InvoiceNumber" && objectTableName == "APInvoice" || fieldCode == "InvoiceNumber" && objectTableName == "ARInvoice" || fieldCode == "ContainerNumber" && objectTableName == "Container" || fieldCode == "QuoteNumber" && objectTableName == "Quote" || fieldCode == "Subject" && objectTableName == "Opportunity" || fieldCode == "EnglishName" && objectTableName == "Customer" || fieldCode == "TaskNumber" && objectTableName == "Task" || fieldCode == "Subject" && objectTableName == "Activity" || fieldCode == "TicketNumber" && objectTableName == "Ticket" || fieldCode == "ReleaseNumber" && objectTableName == "WarehouseRelease" || fieldCode == "EntryNumber" && objectTableName == "WarehouseEntry";
|
|
1988
|
+
return fieldCode == "ShipmentNumber" && objectTableName == "Shipment" || IsShipmentMasterFieldClickable(fieldCode, rowData) || fieldCode == "InvoiceNumber" && objectTableName == "APInvoice" || fieldCode == "InvoiceNumber" && objectTableName == "ARInvoice" || fieldCode == "ContainerNumber" && objectTableName == "Container" || fieldCode == "QuoteNumber" && objectTableName == "Quote" || fieldCode == "Subject" && objectTableName == "Opportunity" || fieldCode == "EnglishName" && objectTableName == "Customer" || fieldCode == "TaskNumber" && objectTableName == "Task" || fieldCode == "Subject" && objectTableName == "Activity" || fieldCode == "TicketNumber" && objectTableName == "Ticket" || fieldCode == "ReleaseNumber" && objectTableName == "WarehouseRelease" || fieldCode == "EntryNumber" && objectTableName == "WarehouseEntry" || fieldCode == "Subject" && objectTableName == "Conversation" || fieldCode == "ConversationSubject" && objectTableName == "ConversationMessage";
|
|
1988
1989
|
};
|
|
1989
1990
|
|
|
1990
1991
|
var IsShipmentMasterFieldClickable = function IsShipmentMasterFieldClickable(fieldCode, rowData) {
|
|
@@ -2420,6 +2421,10 @@ var resolvePivotGroupHeaderName = function resolvePivotGroupHeaderName(colGroupD
|
|
|
2420
2421
|
return 'Grand Total';
|
|
2421
2422
|
}
|
|
2422
2423
|
|
|
2424
|
+
if (colGroupDef && colGroupDef.dlPivotColumnGroupTotal) {
|
|
2425
|
+
return null;
|
|
2426
|
+
}
|
|
2427
|
+
|
|
2423
2428
|
var pivotKeys = colGroupDef && colGroupDef.pivotKeys ? colGroupDef.pivotKeys : [];
|
|
2424
2429
|
|
|
2425
2430
|
if (pivotKeys.length === 0) {
|
|
@@ -2434,6 +2439,97 @@ var resolvePivotGroupHeaderName = function resolvePivotGroupHeaderName(colGroupD
|
|
|
2434
2439
|
|
|
2435
2440
|
return lookupDisplayName(field, pivotKeys[pivotKeys.length - 1]);
|
|
2436
2441
|
};
|
|
2442
|
+
var isAgGridExpandablePivotColumnTotalLeaf = function isAgGridExpandablePivotColumnTotalLeaf(colDef) {
|
|
2443
|
+
if (!colDef || colDef.children) {
|
|
2444
|
+
return false;
|
|
2445
|
+
}
|
|
2446
|
+
|
|
2447
|
+
if (isPivotRowGrandTotalColumnDef(colDef)) {
|
|
2448
|
+
return false;
|
|
2449
|
+
}
|
|
2450
|
+
|
|
2451
|
+
if (colDef.pivotTotalColumnIds === undefined || colDef.pivotTotalColumnIds === null) {
|
|
2452
|
+
return false;
|
|
2453
|
+
}
|
|
2454
|
+
|
|
2455
|
+
return colDef.columnGroupShow === 'closed';
|
|
2456
|
+
};
|
|
2457
|
+
var isAgGridPivotColumnGroupTotalColumn = function isAgGridPivotColumnGroupTotalColumn(colDef) {
|
|
2458
|
+
if (!colDef || colDef.children) {
|
|
2459
|
+
return false;
|
|
2460
|
+
}
|
|
2461
|
+
|
|
2462
|
+
if (isPivotRowGrandTotalColumnDef(colDef)) {
|
|
2463
|
+
return false;
|
|
2464
|
+
}
|
|
2465
|
+
|
|
2466
|
+
if (colDef.dlPivotColumnGroupTotalLeaf) {
|
|
2467
|
+
return true;
|
|
2468
|
+
}
|
|
2469
|
+
|
|
2470
|
+
return colDef.pivotTotalColumnIds !== undefined && colDef.pivotTotalColumnIds !== null;
|
|
2471
|
+
};
|
|
2472
|
+
var setAllAgGridColumnGroupsOpened = function setAllAgGridColumnGroupsOpened(columnApi, opened) {
|
|
2473
|
+
if (!columnApi || !columnApi.getColumnGroupState || !columnApi.setColumnGroupState) {
|
|
2474
|
+
return;
|
|
2475
|
+
}
|
|
2476
|
+
|
|
2477
|
+
var groupState = columnApi.getColumnGroupState();
|
|
2478
|
+
|
|
2479
|
+
if (!groupState || groupState.length === 0) {
|
|
2480
|
+
return;
|
|
2481
|
+
}
|
|
2482
|
+
|
|
2483
|
+
columnApi.setColumnGroupState(groupState.map(function (group) {
|
|
2484
|
+
return {
|
|
2485
|
+
groupId: group.groupId,
|
|
2486
|
+
open: opened
|
|
2487
|
+
};
|
|
2488
|
+
}));
|
|
2489
|
+
};
|
|
2490
|
+
|
|
2491
|
+
var buildDxPivotColumnGroupTotalHeaderName = function buildDxPivotColumnGroupTotalHeaderName(parentGroupDef, columnFields, lookupDisplayName) {
|
|
2492
|
+
var pivotKeys = parentGroupDef && parentGroupDef.pivotKeys ? parentGroupDef.pivotKeys : [];
|
|
2493
|
+
|
|
2494
|
+
if (pivotKeys.length === 0) {
|
|
2495
|
+
return 'Total';
|
|
2496
|
+
}
|
|
2497
|
+
|
|
2498
|
+
var field = columnFields[pivotKeys.length - 1];
|
|
2499
|
+
var rawValue = pivotKeys[pivotKeys.length - 1];
|
|
2500
|
+
var displayName = field ? lookupDisplayName(field, rawValue) : rawValue == null ? '' : String(rawValue);
|
|
2501
|
+
return displayName ? displayName + " Total" : 'Total';
|
|
2502
|
+
};
|
|
2503
|
+
|
|
2504
|
+
var promoteExpandablePivotColumnTotalsForDx = function promoteExpandablePivotColumnTotalsForDx(colGroupDef, columnFields, lookupDisplayName) {
|
|
2505
|
+
if (!colGroupDef || !colGroupDef.children || colGroupDef.children.length === 0) {
|
|
2506
|
+
return;
|
|
2507
|
+
}
|
|
2508
|
+
|
|
2509
|
+
var totalLeaves = [];
|
|
2510
|
+
var otherChildren = [];
|
|
2511
|
+
colGroupDef.children.forEach(function (child) {
|
|
2512
|
+
if (isAgGridExpandablePivotColumnTotalLeaf(child)) {
|
|
2513
|
+
delete child.columnGroupShow;
|
|
2514
|
+
child.dlPivotColumnGroupTotalLeaf = true;
|
|
2515
|
+
totalLeaves.push(child);
|
|
2516
|
+
} else {
|
|
2517
|
+
otherChildren.push(child);
|
|
2518
|
+
}
|
|
2519
|
+
});
|
|
2520
|
+
|
|
2521
|
+
if (totalLeaves.length === 0) {
|
|
2522
|
+
return;
|
|
2523
|
+
}
|
|
2524
|
+
|
|
2525
|
+
colGroupDef.children = otherChildren.concat([{
|
|
2526
|
+
headerName: buildDxPivotColumnGroupTotalHeaderName(colGroupDef, columnFields, lookupDisplayName),
|
|
2527
|
+
marryChildren: true,
|
|
2528
|
+
dlPivotColumnGroupTotal: true,
|
|
2529
|
+
headerClass: 'dl-pivot-column-group-total-header',
|
|
2530
|
+
children: totalLeaves
|
|
2531
|
+
}]);
|
|
2532
|
+
};
|
|
2437
2533
|
var getPivotValueColumnId = function getPivotValueColumnId(pivotValueColumn) {
|
|
2438
2534
|
if (!pivotValueColumn) {
|
|
2439
2535
|
return null;
|
|
@@ -2760,6 +2856,13 @@ var isAgGridPivotDrillDownMeasureColumn = function isAgGridPivotDrillDownMeasure
|
|
|
2760
2856
|
return measure.PivotMeasureCode === colDef.field || measure.PivotMeasureCode === colId;
|
|
2761
2857
|
});
|
|
2762
2858
|
};
|
|
2859
|
+
var normalizePivotDrillDownFieldValue = function normalizePivotDrillDownFieldValue(value) {
|
|
2860
|
+
if (value === null || value === undefined || value === '' || value === ' ') {
|
|
2861
|
+
return null;
|
|
2862
|
+
}
|
|
2863
|
+
|
|
2864
|
+
return value;
|
|
2865
|
+
};
|
|
2763
2866
|
var buildPivotDrillDownPivotFields = function buildPivotDrillDownPivotFields(colDef, startNode, apiFields) {
|
|
2764
2867
|
var columnFields = apiFields.filter(function (field) {
|
|
2765
2868
|
return !isRowPivotField(field);
|
|
@@ -2781,7 +2884,7 @@ var buildPivotDrillDownPivotFields = function buildPivotDrillDownPivotFields(col
|
|
|
2781
2884
|
pivotFields.push({
|
|
2782
2885
|
FieldId: field.FieldId,
|
|
2783
2886
|
FieldType: field.FieldType ? field.FieldType : 'Field',
|
|
2784
|
-
FieldValue: key,
|
|
2887
|
+
FieldValue: normalizePivotDrillDownFieldValue(key),
|
|
2785
2888
|
DateCode: field.DateCode
|
|
2786
2889
|
});
|
|
2787
2890
|
});
|
|
@@ -2799,7 +2902,7 @@ var buildPivotDrillDownPivotFields = function buildPivotDrillDownPivotFields(col
|
|
|
2799
2902
|
pivotFields.push({
|
|
2800
2903
|
FieldId: field.FieldId,
|
|
2801
2904
|
FieldType: field.FieldType ? field.FieldType : 'Field',
|
|
2802
|
-
FieldValue: pathItem.key,
|
|
2905
|
+
FieldValue: normalizePivotDrillDownFieldValue(pathItem.key),
|
|
2803
2906
|
DateCode: field.DateCode
|
|
2804
2907
|
});
|
|
2805
2908
|
});
|
|
@@ -3256,6 +3359,42 @@ var PivotTable = React.forwardRef(function (props, comRef) {
|
|
|
3256
3359
|
});
|
|
3257
3360
|
|
|
3258
3361
|
var ROW_GROUP_COLUMN_MIN_WIDTH = 100;
|
|
3362
|
+
var PIVOT_VALUE_COLUMN_MIN_WIDTH = 100;
|
|
3363
|
+
var PIVOT_HEADER_BASE_HEIGHT = 36;
|
|
3364
|
+
var PIVOT_ROW_MIN_HEIGHT = 30;
|
|
3365
|
+
var PIVOT_HEADER_WRAP_PADDING = 20;
|
|
3366
|
+
var AG_PIVOT_WRAPPING_HEADER_TEMPLATE = '<div class="ag-cell-label-container" role="presentation">' + ' <span ref="eMenu" class="ag-header-icon ag-header-cell-menu-button"></span>' + ' <div ref="eLabel" class="ag-header-cell-label" role="presentation">' + ' <span ref="eSortOrder" class="ag-header-icon ag-sort-order"></span>' + ' <span ref="eSortAsc" class="ag-header-icon ag-sort-ascending-icon"></span>' + ' <span ref="eSortDesc" class="ag-header-icon ag-sort-descending-icon"></span>' + ' <span ref="eSortNone" class="ag-header-icon ag-sort-none-icon"></span>' + ' <span ref="eText" class="ag-header-cell-text" role="columnheader" style="white-space: normal;"></span>' + ' <span ref="eFilter" class="ag-header-icon ag-filter-icon"></span>' + ' </div>' + '</div>';
|
|
3367
|
+
|
|
3368
|
+
var applyFlexiblePivotValueColumnSizing = function applyFlexiblePivotValueColumnSizing(colDef) {
|
|
3369
|
+
delete colDef.width;
|
|
3370
|
+
colDef.flex = 1;
|
|
3371
|
+
colDef.minWidth = PIVOT_VALUE_COLUMN_MIN_WIDTH;
|
|
3372
|
+
};
|
|
3373
|
+
|
|
3374
|
+
var getMaxHeaderTextClientHeight = function getMaxHeaderTextClientHeight(root, selector) {
|
|
3375
|
+
var nodes = root.querySelectorAll(selector);
|
|
3376
|
+
var maxHeight = 0;
|
|
3377
|
+
|
|
3378
|
+
for (var i = 0; i < nodes.length; i++) {
|
|
3379
|
+
var height = nodes[i].clientHeight;
|
|
3380
|
+
if (height > maxHeight) maxHeight = height;
|
|
3381
|
+
}
|
|
3382
|
+
|
|
3383
|
+
return maxHeight;
|
|
3384
|
+
};
|
|
3385
|
+
|
|
3386
|
+
var syncWrappedPivotHeaderHeights = function syncWrappedPivotHeaderHeights(api, root) {
|
|
3387
|
+
if (!api || !root) return;
|
|
3388
|
+
var apiAny = api;
|
|
3389
|
+
var leafTextHeight = getMaxHeaderTextClientHeight(root, '.ag-header-cell-text');
|
|
3390
|
+
var groupTextHeight = getMaxHeaderTextClientHeight(root, '.ag-header-group-text');
|
|
3391
|
+
var leafHeight = Math.max(PIVOT_HEADER_BASE_HEIGHT, leafTextHeight + PIVOT_HEADER_WRAP_PADDING);
|
|
3392
|
+
var groupHeight = Math.max(PIVOT_HEADER_BASE_HEIGHT, groupTextHeight + PIVOT_HEADER_WRAP_PADDING);
|
|
3393
|
+
if (apiAny.setPivotHeaderHeight) apiAny.setPivotHeaderHeight(leafHeight);
|
|
3394
|
+
if (apiAny.setHeaderHeight) apiAny.setHeaderHeight(leafHeight);
|
|
3395
|
+
if (apiAny.setPivotGroupHeaderHeight) apiAny.setPivotGroupHeaderHeight(groupHeight);
|
|
3396
|
+
if (apiAny.setGroupHeaderHeight) apiAny.setGroupHeaderHeight(groupHeight);
|
|
3397
|
+
};
|
|
3259
3398
|
|
|
3260
3399
|
var applyAgGridLicense = function applyAgGridLicense() {
|
|
3261
3400
|
if (!Session.AgGridLicenseKey) return;
|
|
@@ -3471,6 +3610,7 @@ var AgPivotGrid = React.forwardRef(function (props, _comRef) {
|
|
|
3471
3610
|
return formatPivotMeasureValue(params.value, measure);
|
|
3472
3611
|
}
|
|
3473
3612
|
};
|
|
3613
|
+
applyFlexiblePivotValueColumnSizing(colDef);
|
|
3474
3614
|
|
|
3475
3615
|
if (!isPivotDateMinMaxMeasure(measure)) {
|
|
3476
3616
|
colDef.type = 'numericColumn';
|
|
@@ -3497,26 +3637,45 @@ var AgPivotGrid = React.forwardRef(function (props, _comRef) {
|
|
|
3497
3637
|
};
|
|
3498
3638
|
|
|
3499
3639
|
var canShowRowsTotal = function canShowRowsTotal() {
|
|
3640
|
+
var pivotRows = parseJsonArray(widget === null || widget === void 0 ? void 0 : widget.PivotRows);
|
|
3641
|
+
if (pivotRows.length <= 1) return false;
|
|
3500
3642
|
var settings = parsePivotTotalsSettings(widget === null || widget === void 0 ? void 0 : widget.PivotTotalsSettings);
|
|
3501
3643
|
return !isNullOrUndefinedOrEmpty(settings.ShowRowsTotal) ? !!settings.ShowRowsTotal : false;
|
|
3502
3644
|
};
|
|
3503
3645
|
|
|
3504
3646
|
var canShowColumnsTotal = function canShowColumnsTotal() {
|
|
3647
|
+
var pivotColumns = parseJsonArray(widget === null || widget === void 0 ? void 0 : widget.PivotColumns);
|
|
3648
|
+
if (pivotColumns.length <= 1) return false;
|
|
3505
3649
|
var settings = parsePivotTotalsSettings(widget === null || widget === void 0 ? void 0 : widget.PivotTotalsSettings);
|
|
3506
3650
|
return !isNullOrUndefinedOrEmpty(settings.ShowColumnsTotal) ? !!settings.ShowColumnsTotal : false;
|
|
3507
3651
|
};
|
|
3508
3652
|
|
|
3653
|
+
var showColumnsTotal = canShowColumnsTotal();
|
|
3654
|
+
var pivotRowTotalsPosition = canShowColumnsGrandTotal() ? 'after' : '';
|
|
3655
|
+
React.useEffect(function () {
|
|
3656
|
+
if (!gridApiRef.current || isLoading || columnDefs.length === 0) return;
|
|
3657
|
+
gridApiRef.current.setColumnDefs(columnDefs.slice());
|
|
3658
|
+
}, [widget === null || widget === void 0 ? void 0 : widget.PivotTotalsSettings, showColumnsTotal, pivotRowTotalsPosition]);
|
|
3509
3659
|
var isSingleMeasurePivot = measureCount <= 1;
|
|
3510
3660
|
var processSecondaryColGroupDef = React.useCallback(function (colGroupDef) {
|
|
3511
3661
|
var columnFields = pivotFieldsRef.current.filter(function (field) {
|
|
3512
3662
|
return !isRowPivotField(field);
|
|
3513
3663
|
});
|
|
3664
|
+
|
|
3665
|
+
if (showColumnsTotal) {
|
|
3666
|
+
promoteExpandablePivotColumnTotalsForDx(colGroupDef, columnFields, lookupDisplayName);
|
|
3667
|
+
|
|
3668
|
+
if (!colGroupDef.dlPivotColumnGroupTotal) {
|
|
3669
|
+
colGroupDef.openByDefault = true;
|
|
3670
|
+
}
|
|
3671
|
+
}
|
|
3672
|
+
|
|
3514
3673
|
var headerName = resolvePivotGroupHeaderName(colGroupDef, columnFields, lookupDisplayName);
|
|
3515
3674
|
|
|
3516
3675
|
if (headerName) {
|
|
3517
3676
|
colGroupDef.headerName = headerName;
|
|
3518
3677
|
}
|
|
3519
|
-
}, []);
|
|
3678
|
+
}, [showColumnsTotal]);
|
|
3520
3679
|
var processSecondaryColDef = React.useCallback(function (colDef) {
|
|
3521
3680
|
var columnFields = pivotFieldsRef.current.filter(function (field) {
|
|
3522
3681
|
return !isRowPivotField(field);
|
|
@@ -3535,6 +3694,13 @@ var AgPivotGrid = React.forwardRef(function (props, _comRef) {
|
|
|
3535
3694
|
|
|
3536
3695
|
var measure = resolveMeasureForSecondaryColDef(colDef, pivotMeasuresRef.current);
|
|
3537
3696
|
applyPivotDataCellFormatting(colDef, measure);
|
|
3697
|
+
applyFlexiblePivotValueColumnSizing(colDef);
|
|
3698
|
+
|
|
3699
|
+
if (isAgGridPivotColumnGroupTotalColumn(colDefAny)) {
|
|
3700
|
+
var existingCellClass = colDef.cellClass ? String(colDef.cellClass) : '';
|
|
3701
|
+
colDef.cellClass = (existingCellClass + ' dl-pivot-column-group-total-cell').trim();
|
|
3702
|
+
colDef.headerClass = 'dl-pivot-column-group-total-header';
|
|
3703
|
+
}
|
|
3538
3704
|
|
|
3539
3705
|
colDef.valueFormatter = function (params) {
|
|
3540
3706
|
var resolvedMeasure = measure || resolveMeasureForSecondaryColDef(params.colDef, pivotMeasuresRef.current);
|
|
@@ -3569,13 +3735,27 @@ var AgPivotGrid = React.forwardRef(function (props, _comRef) {
|
|
|
3569
3735
|
resizable: false,
|
|
3570
3736
|
suppressMenu: true,
|
|
3571
3737
|
wrapText: true,
|
|
3572
|
-
autoHeight: true
|
|
3738
|
+
autoHeight: true,
|
|
3739
|
+
headerComponentParams: {
|
|
3740
|
+
template: AG_PIVOT_WRAPPING_HEADER_TEMPLATE
|
|
3741
|
+
}
|
|
3573
3742
|
};
|
|
3574
3743
|
}, []);
|
|
3744
|
+
var scheduleWrappedPivotHeaderHeights = React.useCallback(function () {
|
|
3745
|
+
var run = function run() {
|
|
3746
|
+
return syncWrappedPivotHeaderHeights(gridApiRef.current, gridContainerRef.current);
|
|
3747
|
+
};
|
|
3748
|
+
|
|
3749
|
+
window.requestAnimationFrame(function () {
|
|
3750
|
+
run();
|
|
3751
|
+
window.setTimeout(run, 0);
|
|
3752
|
+
});
|
|
3753
|
+
}, []);
|
|
3575
3754
|
var autoGroupColumnDef = React.useMemo(function () {
|
|
3576
3755
|
return {
|
|
3577
3756
|
minWidth: ROW_GROUP_COLUMN_MIN_WIDTH,
|
|
3578
3757
|
width: ROW_GROUP_COLUMN_MIN_WIDTH,
|
|
3758
|
+
suppressSizeToFit: true,
|
|
3579
3759
|
sortable: false,
|
|
3580
3760
|
filter: false,
|
|
3581
3761
|
wrapText: true,
|
|
@@ -3645,32 +3825,77 @@ var AgPivotGrid = React.forwardRef(function (props, _comRef) {
|
|
|
3645
3825
|
columnApi.autoSizeColumns(autoGroupColumnIds, false);
|
|
3646
3826
|
}
|
|
3647
3827
|
|
|
3828
|
+
scheduleWrappedPivotHeaderHeights();
|
|
3648
3829
|
scheduleRowGrandTotalHeaderLabel();
|
|
3649
3830
|
};
|
|
3650
3831
|
|
|
3651
3832
|
var onColumnPivotChanged = function onColumnPivotChanged() {
|
|
3833
|
+
scheduleWrappedPivotHeaderHeights();
|
|
3652
3834
|
scheduleRowGrandTotalHeaderLabel();
|
|
3653
3835
|
};
|
|
3654
3836
|
|
|
3655
3837
|
var onColumnResized = function onColumnResized() {
|
|
3838
|
+
scheduleWrappedPivotHeaderHeights();
|
|
3656
3839
|
scheduleRowGrandTotalHeaderLabel();
|
|
3657
3840
|
};
|
|
3658
3841
|
|
|
3659
3842
|
var getContextMenuItems = React.useCallback(function (params) {
|
|
3660
3843
|
var colId = params.column && params.column.getColId ? params.column.getColId() : '';
|
|
3661
|
-
|
|
3844
|
+
var isRowLabelColumn = !!(colId && colId.indexOf('ag-Grid-AutoColumn') === 0);
|
|
3845
|
+
|
|
3846
|
+
if (isRowLabelColumn) {
|
|
3847
|
+
return [{
|
|
3848
|
+
name: 'Expand All',
|
|
3849
|
+
action: function action() {
|
|
3850
|
+
if (params.api) params.api.expandAll();
|
|
3851
|
+
}
|
|
3852
|
+
}, {
|
|
3853
|
+
name: 'Collapse All',
|
|
3854
|
+
action: function action() {
|
|
3855
|
+
if (params.api) params.api.collapseAll();
|
|
3856
|
+
}
|
|
3857
|
+
}];
|
|
3858
|
+
}
|
|
3859
|
+
|
|
3860
|
+
var columnApi = columnApiRef.current;
|
|
3861
|
+
if (!columnApi || !columnApi.getColumnGroupState) return [];
|
|
3862
|
+
var groupState = columnApi.getColumnGroupState();
|
|
3863
|
+
if (!groupState || groupState.length === 0) return [];
|
|
3662
3864
|
return [{
|
|
3663
3865
|
name: 'Expand All',
|
|
3664
3866
|
action: function action() {
|
|
3665
|
-
|
|
3867
|
+
return setAllAgGridColumnGroupsOpened(columnApi, true);
|
|
3666
3868
|
}
|
|
3667
3869
|
}, {
|
|
3668
3870
|
name: 'Collapse All',
|
|
3669
3871
|
action: function action() {
|
|
3670
|
-
|
|
3872
|
+
return setAllAgGridColumnGroupsOpened(columnApi, false);
|
|
3671
3873
|
}
|
|
3672
3874
|
}];
|
|
3673
3875
|
}, []);
|
|
3876
|
+
React.useEffect(function () {
|
|
3877
|
+
var container = gridContainerRef.current;
|
|
3878
|
+
if (!container || isLoading) return;
|
|
3879
|
+
|
|
3880
|
+
var onHeaderContextMenu = function onHeaderContextMenu(event) {
|
|
3881
|
+
var target = event.target;
|
|
3882
|
+
if (!target) return;
|
|
3883
|
+
var headerCell = target.closest('.ag-header-cell, .ag-header-group-cell');
|
|
3884
|
+
if (!headerCell) return;
|
|
3885
|
+
var colId = headerCell.getAttribute('col-id') || '';
|
|
3886
|
+
if (colId.indexOf('ag-Grid-AutoColumn') === 0) return;
|
|
3887
|
+
var api = gridApiRef.current;
|
|
3888
|
+
if (!api || !api.contextMenuFactory || !api.contextMenuFactory.onContextMenu) return;
|
|
3889
|
+
event.preventDefault();
|
|
3890
|
+
event.stopPropagation();
|
|
3891
|
+
api.contextMenuFactory.onContextMenu(event, null, null, null, null, headerCell);
|
|
3892
|
+
};
|
|
3893
|
+
|
|
3894
|
+
container.addEventListener('contextmenu', onHeaderContextMenu);
|
|
3895
|
+
return function () {
|
|
3896
|
+
return container.removeEventListener('contextmenu', onHeaderContextMenu);
|
|
3897
|
+
};
|
|
3898
|
+
}, [isLoading]);
|
|
3674
3899
|
var gridWrapperClassName = 'ag-theme-balham pivot-grid-element dl-ag-pivot-grid';
|
|
3675
3900
|
return React__default.createElement(React__default.Fragment, null, isLoading ? React__default.createElement("div", {
|
|
3676
3901
|
className: 'dl-full-hight dl-flex-content-center spinner-custome'
|
|
@@ -3697,8 +3922,9 @@ var AgPivotGrid = React.forwardRef(function (props, _comRef) {
|
|
|
3697
3922
|
removePivotHeaderRowWhenSingleValueColumn: isSingleMeasurePivot,
|
|
3698
3923
|
groupIncludeFooter: canShowRowsTotal(),
|
|
3699
3924
|
groupIncludeTotalFooter: canShowRowsGrandTotal(),
|
|
3700
|
-
pivotRowTotals:
|
|
3701
|
-
pivotColumnGroupTotals:
|
|
3925
|
+
pivotRowTotals: pivotRowTotalsPosition,
|
|
3926
|
+
pivotColumnGroupTotals: '',
|
|
3927
|
+
suppressExpandablePivotGroups: !showColumnsTotal,
|
|
3702
3928
|
processSecondaryColGroupDef: processSecondaryColGroupDef,
|
|
3703
3929
|
processSecondaryColDef: processSecondaryColDef,
|
|
3704
3930
|
onCellClicked: onCellClicked,
|
|
@@ -3709,8 +3935,11 @@ var AgPivotGrid = React.forwardRef(function (props, _comRef) {
|
|
|
3709
3935
|
getContextMenuItems: getContextMenuItems,
|
|
3710
3936
|
animateRows: false,
|
|
3711
3937
|
suppressMovableColumns: true,
|
|
3712
|
-
headerHeight:
|
|
3713
|
-
|
|
3938
|
+
headerHeight: PIVOT_HEADER_BASE_HEIGHT,
|
|
3939
|
+
groupHeaderHeight: PIVOT_HEADER_BASE_HEIGHT,
|
|
3940
|
+
pivotHeaderHeight: PIVOT_HEADER_BASE_HEIGHT,
|
|
3941
|
+
pivotGroupHeaderHeight: PIVOT_HEADER_BASE_HEIGHT,
|
|
3942
|
+
rowHeight: PIVOT_ROW_MIN_HEIGHT
|
|
3714
3943
|
})));
|
|
3715
3944
|
});
|
|
3716
3945
|
|