logitude-dashboard-library 3.2.65 → 3.2.67
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 +178 -8
- package/dist/features/Dashboard/ChartsComponents/CustomCharts/PivotAgGridSupport.d.ts +27 -0
- package/dist/index.js +289 -30
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +289 -30
- package/dist/index.modern.js.map +1 -1
- package/dist/styles/dl-dashboard.scss +178 -8
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -1968,7 +1968,8 @@ var TableChart = function TableChart(props) {
|
|
|
1968
1968
|
}
|
|
1969
1969
|
|
|
1970
1970
|
if (!rowData) return true;
|
|
1971
|
-
|
|
1971
|
+
var rowTenantId = rowData.lookUp_Tenant != null ? rowData.lookUp_Tenant : rowData.Tenant;
|
|
1972
|
+
return Number(rowTenantId) === Number(Session.Tenant);
|
|
1972
1973
|
};
|
|
1973
1974
|
|
|
1974
1975
|
var isClickableCell = function isClickableCell(fieldCode, rowData) {
|
|
@@ -1980,7 +1981,7 @@ var TableChart = function TableChart(props) {
|
|
|
1980
1981
|
return false;
|
|
1981
1982
|
}
|
|
1982
1983
|
|
|
1983
|
-
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";
|
|
1984
|
+
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";
|
|
1984
1985
|
};
|
|
1985
1986
|
|
|
1986
1987
|
var IsShipmentMasterFieldClickable = function IsShipmentMasterFieldClickable(fieldCode, rowData) {
|
|
@@ -2416,6 +2417,10 @@ var resolvePivotGroupHeaderName = function resolvePivotGroupHeaderName(colGroupD
|
|
|
2416
2417
|
return 'Grand Total';
|
|
2417
2418
|
}
|
|
2418
2419
|
|
|
2420
|
+
if (colGroupDef && colGroupDef.dlPivotColumnGroupTotal) {
|
|
2421
|
+
return null;
|
|
2422
|
+
}
|
|
2423
|
+
|
|
2419
2424
|
var pivotKeys = colGroupDef && colGroupDef.pivotKeys ? colGroupDef.pivotKeys : [];
|
|
2420
2425
|
|
|
2421
2426
|
if (pivotKeys.length === 0) {
|
|
@@ -2430,6 +2435,97 @@ var resolvePivotGroupHeaderName = function resolvePivotGroupHeaderName(colGroupD
|
|
|
2430
2435
|
|
|
2431
2436
|
return lookupDisplayName(field, pivotKeys[pivotKeys.length - 1]);
|
|
2432
2437
|
};
|
|
2438
|
+
var isAgGridExpandablePivotColumnTotalLeaf = function isAgGridExpandablePivotColumnTotalLeaf(colDef) {
|
|
2439
|
+
if (!colDef || colDef.children) {
|
|
2440
|
+
return false;
|
|
2441
|
+
}
|
|
2442
|
+
|
|
2443
|
+
if (isPivotRowGrandTotalColumnDef(colDef)) {
|
|
2444
|
+
return false;
|
|
2445
|
+
}
|
|
2446
|
+
|
|
2447
|
+
if (colDef.pivotTotalColumnIds === undefined || colDef.pivotTotalColumnIds === null) {
|
|
2448
|
+
return false;
|
|
2449
|
+
}
|
|
2450
|
+
|
|
2451
|
+
return colDef.columnGroupShow === 'closed';
|
|
2452
|
+
};
|
|
2453
|
+
var isAgGridPivotColumnGroupTotalColumn = function isAgGridPivotColumnGroupTotalColumn(colDef) {
|
|
2454
|
+
if (!colDef || colDef.children) {
|
|
2455
|
+
return false;
|
|
2456
|
+
}
|
|
2457
|
+
|
|
2458
|
+
if (isPivotRowGrandTotalColumnDef(colDef)) {
|
|
2459
|
+
return false;
|
|
2460
|
+
}
|
|
2461
|
+
|
|
2462
|
+
if (colDef.dlPivotColumnGroupTotalLeaf) {
|
|
2463
|
+
return true;
|
|
2464
|
+
}
|
|
2465
|
+
|
|
2466
|
+
return colDef.pivotTotalColumnIds !== undefined && colDef.pivotTotalColumnIds !== null;
|
|
2467
|
+
};
|
|
2468
|
+
var setAllAgGridColumnGroupsOpened = function setAllAgGridColumnGroupsOpened(columnApi, opened) {
|
|
2469
|
+
if (!columnApi || !columnApi.getColumnGroupState || !columnApi.setColumnGroupState) {
|
|
2470
|
+
return;
|
|
2471
|
+
}
|
|
2472
|
+
|
|
2473
|
+
var groupState = columnApi.getColumnGroupState();
|
|
2474
|
+
|
|
2475
|
+
if (!groupState || groupState.length === 0) {
|
|
2476
|
+
return;
|
|
2477
|
+
}
|
|
2478
|
+
|
|
2479
|
+
columnApi.setColumnGroupState(groupState.map(function (group) {
|
|
2480
|
+
return {
|
|
2481
|
+
groupId: group.groupId,
|
|
2482
|
+
open: opened
|
|
2483
|
+
};
|
|
2484
|
+
}));
|
|
2485
|
+
};
|
|
2486
|
+
|
|
2487
|
+
var buildDxPivotColumnGroupTotalHeaderName = function buildDxPivotColumnGroupTotalHeaderName(parentGroupDef, columnFields, lookupDisplayName) {
|
|
2488
|
+
var pivotKeys = parentGroupDef && parentGroupDef.pivotKeys ? parentGroupDef.pivotKeys : [];
|
|
2489
|
+
|
|
2490
|
+
if (pivotKeys.length === 0) {
|
|
2491
|
+
return 'Total';
|
|
2492
|
+
}
|
|
2493
|
+
|
|
2494
|
+
var field = columnFields[pivotKeys.length - 1];
|
|
2495
|
+
var rawValue = pivotKeys[pivotKeys.length - 1];
|
|
2496
|
+
var displayName = field ? lookupDisplayName(field, rawValue) : rawValue == null ? '' : String(rawValue);
|
|
2497
|
+
return displayName ? displayName + " Total" : 'Total';
|
|
2498
|
+
};
|
|
2499
|
+
|
|
2500
|
+
var promoteExpandablePivotColumnTotalsForDx = function promoteExpandablePivotColumnTotalsForDx(colGroupDef, columnFields, lookupDisplayName) {
|
|
2501
|
+
if (!colGroupDef || !colGroupDef.children || colGroupDef.children.length === 0) {
|
|
2502
|
+
return;
|
|
2503
|
+
}
|
|
2504
|
+
|
|
2505
|
+
var totalLeaves = [];
|
|
2506
|
+
var otherChildren = [];
|
|
2507
|
+
colGroupDef.children.forEach(function (child) {
|
|
2508
|
+
if (isAgGridExpandablePivotColumnTotalLeaf(child)) {
|
|
2509
|
+
delete child.columnGroupShow;
|
|
2510
|
+
child.dlPivotColumnGroupTotalLeaf = true;
|
|
2511
|
+
totalLeaves.push(child);
|
|
2512
|
+
} else {
|
|
2513
|
+
otherChildren.push(child);
|
|
2514
|
+
}
|
|
2515
|
+
});
|
|
2516
|
+
|
|
2517
|
+
if (totalLeaves.length === 0) {
|
|
2518
|
+
return;
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2521
|
+
colGroupDef.children = otherChildren.concat([{
|
|
2522
|
+
headerName: buildDxPivotColumnGroupTotalHeaderName(colGroupDef, columnFields, lookupDisplayName),
|
|
2523
|
+
marryChildren: true,
|
|
2524
|
+
dlPivotColumnGroupTotal: true,
|
|
2525
|
+
headerClass: 'dl-pivot-column-group-total-header',
|
|
2526
|
+
children: totalLeaves
|
|
2527
|
+
}]);
|
|
2528
|
+
};
|
|
2433
2529
|
var getPivotValueColumnId = function getPivotValueColumnId(pivotValueColumn) {
|
|
2434
2530
|
if (!pivotValueColumn) {
|
|
2435
2531
|
return null;
|
|
@@ -2707,17 +2803,15 @@ var collectPivotRowPath = function collectPivotRowPath(startNode) {
|
|
|
2707
2803
|
return path;
|
|
2708
2804
|
}
|
|
2709
2805
|
|
|
2710
|
-
if (startNode.footer) {
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
}
|
|
2806
|
+
if (startNode.footer && startNode.level === -1) {
|
|
2807
|
+
return path;
|
|
2808
|
+
}
|
|
2714
2809
|
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
}
|
|
2810
|
+
if (startNode.field != null && startNode.key !== undefined) {
|
|
2811
|
+
path.unshift({
|
|
2812
|
+
field: startNode.field,
|
|
2813
|
+
key: startNode.key
|
|
2814
|
+
});
|
|
2721
2815
|
}
|
|
2722
2816
|
|
|
2723
2817
|
var node = startNode.parent;
|
|
@@ -2735,6 +2829,36 @@ var collectPivotRowPath = function collectPivotRowPath(startNode) {
|
|
|
2735
2829
|
|
|
2736
2830
|
return path;
|
|
2737
2831
|
};
|
|
2832
|
+
var isAgGridPivotDrillDownMeasureColumn = function isAgGridPivotDrillDownMeasureColumn(colDef, measures) {
|
|
2833
|
+
if (!colDef || !measures || measures.length === 0) {
|
|
2834
|
+
return false;
|
|
2835
|
+
}
|
|
2836
|
+
|
|
2837
|
+
if (colDef.pivotValueColumn) {
|
|
2838
|
+
return true;
|
|
2839
|
+
}
|
|
2840
|
+
|
|
2841
|
+
if (colDef.rowGroup || colDef.pivot) {
|
|
2842
|
+
return false;
|
|
2843
|
+
}
|
|
2844
|
+
|
|
2845
|
+
var colId = colDef.colId ? String(colDef.colId) : '';
|
|
2846
|
+
|
|
2847
|
+
if (colId.indexOf('ag-Grid-AutoColumn') === 0) {
|
|
2848
|
+
return false;
|
|
2849
|
+
}
|
|
2850
|
+
|
|
2851
|
+
return measures.some(function (measure) {
|
|
2852
|
+
return measure.PivotMeasureCode === colDef.field || measure.PivotMeasureCode === colId;
|
|
2853
|
+
});
|
|
2854
|
+
};
|
|
2855
|
+
var normalizePivotDrillDownFieldValue = function normalizePivotDrillDownFieldValue(value) {
|
|
2856
|
+
if (value === null || value === undefined || value === '' || value === ' ') {
|
|
2857
|
+
return null;
|
|
2858
|
+
}
|
|
2859
|
+
|
|
2860
|
+
return value;
|
|
2861
|
+
};
|
|
2738
2862
|
var buildPivotDrillDownPivotFields = function buildPivotDrillDownPivotFields(colDef, startNode, apiFields) {
|
|
2739
2863
|
var columnFields = apiFields.filter(function (field) {
|
|
2740
2864
|
return !isRowPivotField(field);
|
|
@@ -2756,7 +2880,7 @@ var buildPivotDrillDownPivotFields = function buildPivotDrillDownPivotFields(col
|
|
|
2756
2880
|
pivotFields.push({
|
|
2757
2881
|
FieldId: field.FieldId,
|
|
2758
2882
|
FieldType: field.FieldType ? field.FieldType : 'Field',
|
|
2759
|
-
FieldValue: key,
|
|
2883
|
+
FieldValue: normalizePivotDrillDownFieldValue(key),
|
|
2760
2884
|
DateCode: field.DateCode
|
|
2761
2885
|
});
|
|
2762
2886
|
});
|
|
@@ -2774,7 +2898,7 @@ var buildPivotDrillDownPivotFields = function buildPivotDrillDownPivotFields(col
|
|
|
2774
2898
|
pivotFields.push({
|
|
2775
2899
|
FieldId: field.FieldId,
|
|
2776
2900
|
FieldType: field.FieldType ? field.FieldType : 'Field',
|
|
2777
|
-
FieldValue: pathItem.key,
|
|
2901
|
+
FieldValue: normalizePivotDrillDownFieldValue(pathItem.key),
|
|
2778
2902
|
DateCode: field.DateCode
|
|
2779
2903
|
});
|
|
2780
2904
|
});
|
|
@@ -3231,6 +3355,42 @@ var PivotTable = forwardRef(function (props, comRef) {
|
|
|
3231
3355
|
});
|
|
3232
3356
|
|
|
3233
3357
|
var ROW_GROUP_COLUMN_MIN_WIDTH = 100;
|
|
3358
|
+
var PIVOT_VALUE_COLUMN_MIN_WIDTH = 100;
|
|
3359
|
+
var PIVOT_HEADER_BASE_HEIGHT = 36;
|
|
3360
|
+
var PIVOT_ROW_MIN_HEIGHT = 30;
|
|
3361
|
+
var PIVOT_HEADER_WRAP_PADDING = 20;
|
|
3362
|
+
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>';
|
|
3363
|
+
|
|
3364
|
+
var applyFlexiblePivotValueColumnSizing = function applyFlexiblePivotValueColumnSizing(colDef) {
|
|
3365
|
+
delete colDef.width;
|
|
3366
|
+
colDef.flex = 1;
|
|
3367
|
+
colDef.minWidth = PIVOT_VALUE_COLUMN_MIN_WIDTH;
|
|
3368
|
+
};
|
|
3369
|
+
|
|
3370
|
+
var getMaxHeaderTextClientHeight = function getMaxHeaderTextClientHeight(root, selector) {
|
|
3371
|
+
var nodes = root.querySelectorAll(selector);
|
|
3372
|
+
var maxHeight = 0;
|
|
3373
|
+
|
|
3374
|
+
for (var i = 0; i < nodes.length; i++) {
|
|
3375
|
+
var height = nodes[i].clientHeight;
|
|
3376
|
+
if (height > maxHeight) maxHeight = height;
|
|
3377
|
+
}
|
|
3378
|
+
|
|
3379
|
+
return maxHeight;
|
|
3380
|
+
};
|
|
3381
|
+
|
|
3382
|
+
var syncWrappedPivotHeaderHeights = function syncWrappedPivotHeaderHeights(api, root) {
|
|
3383
|
+
if (!api || !root) return;
|
|
3384
|
+
var apiAny = api;
|
|
3385
|
+
var leafTextHeight = getMaxHeaderTextClientHeight(root, '.ag-header-cell-text');
|
|
3386
|
+
var groupTextHeight = getMaxHeaderTextClientHeight(root, '.ag-header-group-text');
|
|
3387
|
+
var leafHeight = Math.max(PIVOT_HEADER_BASE_HEIGHT, leafTextHeight + PIVOT_HEADER_WRAP_PADDING);
|
|
3388
|
+
var groupHeight = Math.max(PIVOT_HEADER_BASE_HEIGHT, groupTextHeight + PIVOT_HEADER_WRAP_PADDING);
|
|
3389
|
+
if (apiAny.setPivotHeaderHeight) apiAny.setPivotHeaderHeight(leafHeight);
|
|
3390
|
+
if (apiAny.setHeaderHeight) apiAny.setHeaderHeight(leafHeight);
|
|
3391
|
+
if (apiAny.setPivotGroupHeaderHeight) apiAny.setPivotGroupHeaderHeight(groupHeight);
|
|
3392
|
+
if (apiAny.setGroupHeaderHeight) apiAny.setGroupHeaderHeight(groupHeight);
|
|
3393
|
+
};
|
|
3234
3394
|
|
|
3235
3395
|
var applyAgGridLicense = function applyAgGridLicense() {
|
|
3236
3396
|
if (!Session.AgGridLicenseKey) return;
|
|
@@ -3446,6 +3606,7 @@ var AgPivotGrid = forwardRef(function (props, _comRef) {
|
|
|
3446
3606
|
return formatPivotMeasureValue(params.value, measure);
|
|
3447
3607
|
}
|
|
3448
3608
|
};
|
|
3609
|
+
applyFlexiblePivotValueColumnSizing(colDef);
|
|
3449
3610
|
|
|
3450
3611
|
if (!isPivotDateMinMaxMeasure(measure)) {
|
|
3451
3612
|
colDef.type = 'numericColumn';
|
|
@@ -3472,26 +3633,45 @@ var AgPivotGrid = forwardRef(function (props, _comRef) {
|
|
|
3472
3633
|
};
|
|
3473
3634
|
|
|
3474
3635
|
var canShowRowsTotal = function canShowRowsTotal() {
|
|
3636
|
+
var pivotRows = parseJsonArray(widget === null || widget === void 0 ? void 0 : widget.PivotRows);
|
|
3637
|
+
if (pivotRows.length <= 1) return false;
|
|
3475
3638
|
var settings = parsePivotTotalsSettings(widget === null || widget === void 0 ? void 0 : widget.PivotTotalsSettings);
|
|
3476
3639
|
return !isNullOrUndefinedOrEmpty(settings.ShowRowsTotal) ? !!settings.ShowRowsTotal : false;
|
|
3477
3640
|
};
|
|
3478
3641
|
|
|
3479
3642
|
var canShowColumnsTotal = function canShowColumnsTotal() {
|
|
3643
|
+
var pivotColumns = parseJsonArray(widget === null || widget === void 0 ? void 0 : widget.PivotColumns);
|
|
3644
|
+
if (pivotColumns.length <= 1) return false;
|
|
3480
3645
|
var settings = parsePivotTotalsSettings(widget === null || widget === void 0 ? void 0 : widget.PivotTotalsSettings);
|
|
3481
3646
|
return !isNullOrUndefinedOrEmpty(settings.ShowColumnsTotal) ? !!settings.ShowColumnsTotal : false;
|
|
3482
3647
|
};
|
|
3483
3648
|
|
|
3649
|
+
var showColumnsTotal = canShowColumnsTotal();
|
|
3650
|
+
var pivotRowTotalsPosition = canShowColumnsGrandTotal() ? 'after' : '';
|
|
3651
|
+
useEffect(function () {
|
|
3652
|
+
if (!gridApiRef.current || isLoading || columnDefs.length === 0) return;
|
|
3653
|
+
gridApiRef.current.setColumnDefs(columnDefs.slice());
|
|
3654
|
+
}, [widget === null || widget === void 0 ? void 0 : widget.PivotTotalsSettings, showColumnsTotal, pivotRowTotalsPosition]);
|
|
3484
3655
|
var isSingleMeasurePivot = measureCount <= 1;
|
|
3485
3656
|
var processSecondaryColGroupDef = useCallback(function (colGroupDef) {
|
|
3486
3657
|
var columnFields = pivotFieldsRef.current.filter(function (field) {
|
|
3487
3658
|
return !isRowPivotField(field);
|
|
3488
3659
|
});
|
|
3660
|
+
|
|
3661
|
+
if (showColumnsTotal) {
|
|
3662
|
+
promoteExpandablePivotColumnTotalsForDx(colGroupDef, columnFields, lookupDisplayName);
|
|
3663
|
+
|
|
3664
|
+
if (!colGroupDef.dlPivotColumnGroupTotal) {
|
|
3665
|
+
colGroupDef.openByDefault = true;
|
|
3666
|
+
}
|
|
3667
|
+
}
|
|
3668
|
+
|
|
3489
3669
|
var headerName = resolvePivotGroupHeaderName(colGroupDef, columnFields, lookupDisplayName);
|
|
3490
3670
|
|
|
3491
3671
|
if (headerName) {
|
|
3492
3672
|
colGroupDef.headerName = headerName;
|
|
3493
3673
|
}
|
|
3494
|
-
}, []);
|
|
3674
|
+
}, [showColumnsTotal]);
|
|
3495
3675
|
var processSecondaryColDef = useCallback(function (colDef) {
|
|
3496
3676
|
var columnFields = pivotFieldsRef.current.filter(function (field) {
|
|
3497
3677
|
return !isRowPivotField(field);
|
|
@@ -3510,6 +3690,13 @@ var AgPivotGrid = forwardRef(function (props, _comRef) {
|
|
|
3510
3690
|
|
|
3511
3691
|
var measure = resolveMeasureForSecondaryColDef(colDef, pivotMeasuresRef.current);
|
|
3512
3692
|
applyPivotDataCellFormatting(colDef, measure);
|
|
3693
|
+
applyFlexiblePivotValueColumnSizing(colDef);
|
|
3694
|
+
|
|
3695
|
+
if (isAgGridPivotColumnGroupTotalColumn(colDefAny)) {
|
|
3696
|
+
var existingCellClass = colDef.cellClass ? String(colDef.cellClass) : '';
|
|
3697
|
+
colDef.cellClass = (existingCellClass + ' dl-pivot-column-group-total-cell').trim();
|
|
3698
|
+
colDef.headerClass = 'dl-pivot-column-group-total-header';
|
|
3699
|
+
}
|
|
3513
3700
|
|
|
3514
3701
|
colDef.valueFormatter = function (params) {
|
|
3515
3702
|
var resolvedMeasure = measure || resolveMeasureForSecondaryColDef(params.colDef, pivotMeasuresRef.current);
|
|
@@ -3524,7 +3711,7 @@ var AgPivotGrid = forwardRef(function (props, _comRef) {
|
|
|
3524
3711
|
}, []);
|
|
3525
3712
|
var onCellClicked = useCallback(function (event) {
|
|
3526
3713
|
var colDef = event.colDef;
|
|
3527
|
-
if (!colDef
|
|
3714
|
+
if (!isAgGridPivotDrillDownMeasureColumn(colDef, pivotMeasuresRef.current)) return;
|
|
3528
3715
|
if (isPivotMeasureValueEmpty(event.value)) return;
|
|
3529
3716
|
var pivotFields = buildPivotDrillDownPivotFields(colDef, event.node, pivotFieldsRef.current);
|
|
3530
3717
|
props.customChartProps.onSelectDataPoint({
|
|
@@ -3544,26 +3731,34 @@ var AgPivotGrid = forwardRef(function (props, _comRef) {
|
|
|
3544
3731
|
resizable: false,
|
|
3545
3732
|
suppressMenu: true,
|
|
3546
3733
|
wrapText: true,
|
|
3547
|
-
autoHeight: true
|
|
3734
|
+
autoHeight: true,
|
|
3735
|
+
headerComponentParams: {
|
|
3736
|
+
template: AG_PIVOT_WRAPPING_HEADER_TEMPLATE
|
|
3737
|
+
}
|
|
3738
|
+
};
|
|
3739
|
+
}, []);
|
|
3740
|
+
var scheduleWrappedPivotHeaderHeights = useCallback(function () {
|
|
3741
|
+
var run = function run() {
|
|
3742
|
+
return syncWrappedPivotHeaderHeights(gridApiRef.current, gridContainerRef.current);
|
|
3548
3743
|
};
|
|
3744
|
+
|
|
3745
|
+
window.requestAnimationFrame(function () {
|
|
3746
|
+
run();
|
|
3747
|
+
window.setTimeout(run, 0);
|
|
3748
|
+
});
|
|
3549
3749
|
}, []);
|
|
3550
3750
|
var autoGroupColumnDef = useMemo(function () {
|
|
3551
3751
|
return {
|
|
3552
3752
|
minWidth: ROW_GROUP_COLUMN_MIN_WIDTH,
|
|
3553
3753
|
width: ROW_GROUP_COLUMN_MIN_WIDTH,
|
|
3754
|
+
suppressSizeToFit: true,
|
|
3554
3755
|
sortable: false,
|
|
3555
3756
|
filter: false,
|
|
3556
3757
|
wrapText: true,
|
|
3557
3758
|
autoHeight: true,
|
|
3558
3759
|
cellClass: 'dl-ag-pivot-row-label-cell',
|
|
3559
|
-
headerValueGetter: function headerValueGetter(
|
|
3560
|
-
|
|
3561
|
-
var showRowGroup = colDef && colDef.showRowGroup;
|
|
3562
|
-
if (!showRowGroup) return '';
|
|
3563
|
-
var field = pivotFieldsRef.current.find(function (f) {
|
|
3564
|
-
return f.PivotCode === showRowGroup;
|
|
3565
|
-
});
|
|
3566
|
-
return field ? field.DisplayName : '';
|
|
3760
|
+
headerValueGetter: function headerValueGetter() {
|
|
3761
|
+
return '';
|
|
3567
3762
|
},
|
|
3568
3763
|
valueFormatter: function valueFormatter(params) {
|
|
3569
3764
|
var colDef = params.colDef;
|
|
@@ -3626,17 +3821,77 @@ var AgPivotGrid = forwardRef(function (props, _comRef) {
|
|
|
3626
3821
|
columnApi.autoSizeColumns(autoGroupColumnIds, false);
|
|
3627
3822
|
}
|
|
3628
3823
|
|
|
3824
|
+
scheduleWrappedPivotHeaderHeights();
|
|
3629
3825
|
scheduleRowGrandTotalHeaderLabel();
|
|
3630
3826
|
};
|
|
3631
3827
|
|
|
3632
3828
|
var onColumnPivotChanged = function onColumnPivotChanged() {
|
|
3829
|
+
scheduleWrappedPivotHeaderHeights();
|
|
3633
3830
|
scheduleRowGrandTotalHeaderLabel();
|
|
3634
3831
|
};
|
|
3635
3832
|
|
|
3636
3833
|
var onColumnResized = function onColumnResized() {
|
|
3834
|
+
scheduleWrappedPivotHeaderHeights();
|
|
3637
3835
|
scheduleRowGrandTotalHeaderLabel();
|
|
3638
3836
|
};
|
|
3639
3837
|
|
|
3838
|
+
var getContextMenuItems = useCallback(function (params) {
|
|
3839
|
+
var colId = params.column && params.column.getColId ? params.column.getColId() : '';
|
|
3840
|
+
var isRowLabelColumn = !!(colId && colId.indexOf('ag-Grid-AutoColumn') === 0);
|
|
3841
|
+
|
|
3842
|
+
if (isRowLabelColumn) {
|
|
3843
|
+
return [{
|
|
3844
|
+
name: 'Expand All',
|
|
3845
|
+
action: function action() {
|
|
3846
|
+
if (params.api) params.api.expandAll();
|
|
3847
|
+
}
|
|
3848
|
+
}, {
|
|
3849
|
+
name: 'Collapse All',
|
|
3850
|
+
action: function action() {
|
|
3851
|
+
if (params.api) params.api.collapseAll();
|
|
3852
|
+
}
|
|
3853
|
+
}];
|
|
3854
|
+
}
|
|
3855
|
+
|
|
3856
|
+
var columnApi = columnApiRef.current;
|
|
3857
|
+
if (!columnApi || !columnApi.getColumnGroupState) return [];
|
|
3858
|
+
var groupState = columnApi.getColumnGroupState();
|
|
3859
|
+
if (!groupState || groupState.length === 0) return [];
|
|
3860
|
+
return [{
|
|
3861
|
+
name: 'Expand All',
|
|
3862
|
+
action: function action() {
|
|
3863
|
+
return setAllAgGridColumnGroupsOpened(columnApi, true);
|
|
3864
|
+
}
|
|
3865
|
+
}, {
|
|
3866
|
+
name: 'Collapse All',
|
|
3867
|
+
action: function action() {
|
|
3868
|
+
return setAllAgGridColumnGroupsOpened(columnApi, false);
|
|
3869
|
+
}
|
|
3870
|
+
}];
|
|
3871
|
+
}, []);
|
|
3872
|
+
useEffect(function () {
|
|
3873
|
+
var container = gridContainerRef.current;
|
|
3874
|
+
if (!container || isLoading) return;
|
|
3875
|
+
|
|
3876
|
+
var onHeaderContextMenu = function onHeaderContextMenu(event) {
|
|
3877
|
+
var target = event.target;
|
|
3878
|
+
if (!target) return;
|
|
3879
|
+
var headerCell = target.closest('.ag-header-cell, .ag-header-group-cell');
|
|
3880
|
+
if (!headerCell) return;
|
|
3881
|
+
var colId = headerCell.getAttribute('col-id') || '';
|
|
3882
|
+
if (colId.indexOf('ag-Grid-AutoColumn') === 0) return;
|
|
3883
|
+
var api = gridApiRef.current;
|
|
3884
|
+
if (!api || !api.contextMenuFactory || !api.contextMenuFactory.onContextMenu) return;
|
|
3885
|
+
event.preventDefault();
|
|
3886
|
+
event.stopPropagation();
|
|
3887
|
+
api.contextMenuFactory.onContextMenu(event, null, null, null, null, headerCell);
|
|
3888
|
+
};
|
|
3889
|
+
|
|
3890
|
+
container.addEventListener('contextmenu', onHeaderContextMenu);
|
|
3891
|
+
return function () {
|
|
3892
|
+
return container.removeEventListener('contextmenu', onHeaderContextMenu);
|
|
3893
|
+
};
|
|
3894
|
+
}, [isLoading]);
|
|
3640
3895
|
var gridWrapperClassName = 'ag-theme-balham pivot-grid-element dl-ag-pivot-grid';
|
|
3641
3896
|
return React__default.createElement(React__default.Fragment, null, isLoading ? React__default.createElement("div", {
|
|
3642
3897
|
className: 'dl-full-hight dl-flex-content-center spinner-custome'
|
|
@@ -3663,8 +3918,9 @@ var AgPivotGrid = forwardRef(function (props, _comRef) {
|
|
|
3663
3918
|
removePivotHeaderRowWhenSingleValueColumn: isSingleMeasurePivot,
|
|
3664
3919
|
groupIncludeFooter: canShowRowsTotal(),
|
|
3665
3920
|
groupIncludeTotalFooter: canShowRowsGrandTotal(),
|
|
3666
|
-
pivotRowTotals:
|
|
3667
|
-
pivotColumnGroupTotals:
|
|
3921
|
+
pivotRowTotals: pivotRowTotalsPosition,
|
|
3922
|
+
pivotColumnGroupTotals: '',
|
|
3923
|
+
suppressExpandablePivotGroups: !showColumnsTotal,
|
|
3668
3924
|
processSecondaryColGroupDef: processSecondaryColGroupDef,
|
|
3669
3925
|
processSecondaryColDef: processSecondaryColDef,
|
|
3670
3926
|
onCellClicked: onCellClicked,
|
|
@@ -3672,11 +3928,14 @@ var AgPivotGrid = forwardRef(function (props, _comRef) {
|
|
|
3672
3928
|
onFirstDataRendered: onFirstDataRendered,
|
|
3673
3929
|
onColumnPivotChanged: onColumnPivotChanged,
|
|
3674
3930
|
onColumnResized: onColumnResized,
|
|
3931
|
+
getContextMenuItems: getContextMenuItems,
|
|
3675
3932
|
animateRows: false,
|
|
3676
|
-
suppressContextMenu: true,
|
|
3677
3933
|
suppressMovableColumns: true,
|
|
3678
|
-
headerHeight:
|
|
3679
|
-
|
|
3934
|
+
headerHeight: PIVOT_HEADER_BASE_HEIGHT,
|
|
3935
|
+
groupHeaderHeight: PIVOT_HEADER_BASE_HEIGHT,
|
|
3936
|
+
pivotHeaderHeight: PIVOT_HEADER_BASE_HEIGHT,
|
|
3937
|
+
pivotGroupHeaderHeight: PIVOT_HEADER_BASE_HEIGHT,
|
|
3938
|
+
rowHeight: PIVOT_ROW_MIN_HEIGHT
|
|
3680
3939
|
})));
|
|
3681
3940
|
});
|
|
3682
3941
|
|