@procore/data-table 14.13.0 → 14.14.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/CHANGELOG.md +12 -0
- package/dist/legacy/index.cjs +160 -20
- package/dist/legacy/index.d.cts +9 -0
- package/dist/legacy/index.d.ts +9 -0
- package/dist/legacy/index.js +160 -20
- package/dist/modern/index.cjs +147 -9
- package/dist/modern/index.d.cts +9 -0
- package/dist/modern/index.d.ts +9 -0
- package/dist/modern/index.js +147 -9
- package/package.json +3 -3
package/dist/legacy/index.js
CHANGED
|
@@ -53422,7 +53422,7 @@ var Renderer9 = ({
|
|
|
53422
53422
|
if (isGroup || rowPinned && columnDefinition.aggFunc) {
|
|
53423
53423
|
return /* @__PURE__ */ React76.createElement(Typography, { ...typographyProps, weight: "semibold" }, label);
|
|
53424
53424
|
}
|
|
53425
|
-
return /* @__PURE__ */ React76.createElement(Pill, { color: getColor(value), className: cx10("pill-cell") }, label
|
|
53425
|
+
return /* @__PURE__ */ React76.createElement(Pill, { color: getColor(value), className: cx10("pill-cell") }, label);
|
|
53426
53426
|
};
|
|
53427
53427
|
var PillCellRenderer = withDataTableRenderer(Renderer9, "select");
|
|
53428
53428
|
var Editor5 = React76.forwardRef(
|
|
@@ -53459,7 +53459,7 @@ var Editor5 = React76.forwardRef(
|
|
|
53459
53459
|
function getLabel3(item) {
|
|
53460
53460
|
var _a2;
|
|
53461
53461
|
const unformattedLabel = ((_a2 = columnDefinition.getStringFormattedValue) == null ? void 0 : _a2.call(columnDefinition, item)) || "";
|
|
53462
|
-
return unformattedLabel
|
|
53462
|
+
return unformattedLabel;
|
|
53463
53463
|
}
|
|
53464
53464
|
return /* @__PURE__ */ React76.createElement(
|
|
53465
53465
|
PillSelect,
|
|
@@ -56611,9 +56611,10 @@ var GenericHeaderRenderer = (props) => {
|
|
|
56611
56611
|
props.api.addEventListener("columnRowGroupChanged", updateExpandedState);
|
|
56612
56612
|
return () => {
|
|
56613
56613
|
props.column.removeEventListener("sortChanged", onSortChanged);
|
|
56614
|
-
|
|
56614
|
+
removeEventListenerFromGrid(
|
|
56615
56615
|
"columnRowGroupChanged",
|
|
56616
|
-
updateExpandedState
|
|
56616
|
+
updateExpandedState,
|
|
56617
|
+
props.api
|
|
56617
56618
|
);
|
|
56618
56619
|
};
|
|
56619
56620
|
}, [props.column]);
|
|
@@ -57708,6 +57709,7 @@ var InternalTableContext = React76.createContext({
|
|
|
57708
57709
|
getRowHeight: () => () => rowSize.md,
|
|
57709
57710
|
grandTotalsLabelInnerRenderer: void 0,
|
|
57710
57711
|
gridApi: void 0,
|
|
57712
|
+
localStoragePersistenceKey: void 0,
|
|
57711
57713
|
onBulkEditUpdate: () => Promise.resolve(),
|
|
57712
57714
|
onServerSideDataRequest: void 0,
|
|
57713
57715
|
onTableConfigChange: () => {
|
|
@@ -57724,6 +57726,7 @@ var InternalTableContext = React76.createContext({
|
|
|
57724
57726
|
setRowHeight: () => {
|
|
57725
57727
|
},
|
|
57726
57728
|
showExpandCollapseAllToggle: false,
|
|
57729
|
+
expandCollapseStateRef: null,
|
|
57727
57730
|
tableRef: null,
|
|
57728
57731
|
getColumnDefinition: () => void 0,
|
|
57729
57732
|
setSelectedGroupIndex: () => {
|
|
@@ -78171,6 +78174,63 @@ var buildDetailRowsConfig_ = (detailRowConfig, {
|
|
|
78171
78174
|
};
|
|
78172
78175
|
};
|
|
78173
78176
|
|
|
78177
|
+
// src/utils/expandRows.ts
|
|
78178
|
+
var getGroupRowState = (gridApi, groupDefaultExpanded = 0) => {
|
|
78179
|
+
const expandedRoutes = [];
|
|
78180
|
+
const collapsedRoutes = [];
|
|
78181
|
+
if (gridApi) {
|
|
78182
|
+
gridApi.forEachNode((node) => {
|
|
78183
|
+
const route = node.getRoute();
|
|
78184
|
+
if (route) {
|
|
78185
|
+
const routePath = route.join(",");
|
|
78186
|
+
const defaultExpandLevel = groupDefaultExpanded === -1 ? Infinity : groupDefaultExpanded;
|
|
78187
|
+
if (node.level > defaultExpandLevel - 1) {
|
|
78188
|
+
if (node.expanded) {
|
|
78189
|
+
expandedRoutes.push(routePath);
|
|
78190
|
+
}
|
|
78191
|
+
} else if (!node.expanded) {
|
|
78192
|
+
collapsedRoutes.push(routePath);
|
|
78193
|
+
}
|
|
78194
|
+
}
|
|
78195
|
+
});
|
|
78196
|
+
}
|
|
78197
|
+
return { expandedRoutes, collapsedRoutes };
|
|
78198
|
+
};
|
|
78199
|
+
var setExpandCollapseRow = (gridApi, tableConfig, groupDefaultExpanded = 0) => {
|
|
78200
|
+
var _a, _b;
|
|
78201
|
+
const expandedRoutes = ((_a = tableConfig.groupRowState) == null ? void 0 : _a.expandedRoutes) ?? [];
|
|
78202
|
+
const collapsedRoutes = ((_b = tableConfig.groupRowState) == null ? void 0 : _b.collapsedRoutes) ?? [];
|
|
78203
|
+
gridApi.forEachNode((node) => {
|
|
78204
|
+
const route = node.getRoute();
|
|
78205
|
+
if (route) {
|
|
78206
|
+
const routePath = route.join(",");
|
|
78207
|
+
const defaultExpandLevel = groupDefaultExpanded === -1 ? Infinity : groupDefaultExpanded;
|
|
78208
|
+
if (node.level > defaultExpandLevel - 1) {
|
|
78209
|
+
if (expandedRoutes.includes(routePath)) {
|
|
78210
|
+
node.setExpanded(true);
|
|
78211
|
+
}
|
|
78212
|
+
} else if (collapsedRoutes.includes(routePath)) {
|
|
78213
|
+
node.setExpanded(false);
|
|
78214
|
+
}
|
|
78215
|
+
}
|
|
78216
|
+
});
|
|
78217
|
+
};
|
|
78218
|
+
var isRowOpenedByDefault = (node, tableConfig, groupDefaultExpanded = 0) => {
|
|
78219
|
+
var _a, _b;
|
|
78220
|
+
const expandedRoutes = ((_a = tableConfig == null ? void 0 : tableConfig.groupRowState) == null ? void 0 : _a.expandedRoutes) ?? [];
|
|
78221
|
+
const collapsedRoutes = ((_b = tableConfig == null ? void 0 : tableConfig.groupRowState) == null ? void 0 : _b.collapsedRoutes) ?? [];
|
|
78222
|
+
const route = node.getRoute();
|
|
78223
|
+
if (!route) {
|
|
78224
|
+
return false;
|
|
78225
|
+
}
|
|
78226
|
+
const routePath = route.join(",");
|
|
78227
|
+
const defaultExpandLevel = groupDefaultExpanded === -1 ? Infinity : groupDefaultExpanded;
|
|
78228
|
+
if (node.level > defaultExpandLevel - 1) {
|
|
78229
|
+
return expandedRoutes.includes(routePath);
|
|
78230
|
+
} else
|
|
78231
|
+
return !collapsedRoutes.includes(routePath);
|
|
78232
|
+
};
|
|
78233
|
+
|
|
78174
78234
|
// src/utils/getRootRowNode.ts
|
|
78175
78235
|
function getRootRowNode(rowNode) {
|
|
78176
78236
|
return rowNode.level > 0 && rowNode.parent ? getRootRowNode(rowNode.parent) : rowNode;
|
|
@@ -80693,6 +80753,7 @@ var useTableApi = ({
|
|
|
80693
80753
|
columnApi,
|
|
80694
80754
|
columnDefinitions,
|
|
80695
80755
|
gridApi,
|
|
80756
|
+
groupDefaultExpanded,
|
|
80696
80757
|
setLoadingStatus,
|
|
80697
80758
|
wrapperRef
|
|
80698
80759
|
}) => {
|
|
@@ -80886,10 +80947,33 @@ var useTableApi = ({
|
|
|
80886
80947
|
const setSearchValue = React76.useCallback(
|
|
80887
80948
|
(value) => {
|
|
80888
80949
|
gridApi == null ? void 0 : gridApi.setQuickFilter(value);
|
|
80950
|
+
gridApi == null ? void 0 : gridApi.forEachNodeAfterFilterAndSort((node) => {
|
|
80951
|
+
if (node.id) {
|
|
80952
|
+
const currentNode = rowSelectionRef == null ? void 0 : rowSelectionRef.current.affectedRows[node.id];
|
|
80953
|
+
if (currentNode && currentNode.selectedState === rowSelectionState.selected) {
|
|
80954
|
+
node.setSelected(true, false, "checkboxSelected");
|
|
80955
|
+
}
|
|
80956
|
+
}
|
|
80957
|
+
});
|
|
80889
80958
|
resetPagination();
|
|
80959
|
+
gridApi == null ? void 0 : gridApi.redrawRows();
|
|
80890
80960
|
},
|
|
80891
|
-
[gridApi]
|
|
80961
|
+
[gridApi, rowSelectionRef.current]
|
|
80892
80962
|
);
|
|
80963
|
+
React76.useEffect(() => {
|
|
80964
|
+
function handleRowSelection(event) {
|
|
80965
|
+
if (event.node.displayed && event.node.id) {
|
|
80966
|
+
rowSelectionRef.current.affectedRows[event.node.id] = {
|
|
80967
|
+
node: event.node,
|
|
80968
|
+
selectedState: event.node.isSelected() ? rowSelectionState.selected : rowSelectionState.unselected
|
|
80969
|
+
};
|
|
80970
|
+
}
|
|
80971
|
+
}
|
|
80972
|
+
(gridApi == null ? void 0 : gridApi.addEventListener) && gridApi.addEventListener("rowSelected", handleRowSelection);
|
|
80973
|
+
return () => {
|
|
80974
|
+
removeEventListenerFromGrid("rowSelected", handleRowSelection, gridApi);
|
|
80975
|
+
};
|
|
80976
|
+
}, [gridApi]);
|
|
80893
80977
|
const setLoading = React76.useCallback((loading, message = "") => {
|
|
80894
80978
|
setLoadingStatus({
|
|
80895
80979
|
loading,
|
|
@@ -80951,6 +81035,7 @@ var useTableApi = ({
|
|
|
80951
81035
|
adjustRowDragIcon(gridApi, columnApi);
|
|
80952
81036
|
});
|
|
80953
81037
|
}
|
|
81038
|
+
setExpandCollapseRow(gridApi, config, groupDefaultExpanded);
|
|
80954
81039
|
},
|
|
80955
81040
|
[columnApi, gridApi, internalSetRowHeight, filterStorage.setSelectedFilters]
|
|
80956
81041
|
);
|
|
@@ -81044,7 +81129,8 @@ var useTableApi = ({
|
|
|
81044
81129
|
columnApi,
|
|
81045
81130
|
rowHeight,
|
|
81046
81131
|
filterStorage,
|
|
81047
|
-
rowSelectionRef
|
|
81132
|
+
rowSelectionRef,
|
|
81133
|
+
groupDefaultExpanded
|
|
81048
81134
|
}),
|
|
81049
81135
|
[columnApi, gridApi, rowHeight, filterStorage]
|
|
81050
81136
|
);
|
|
@@ -81318,7 +81404,6 @@ function buildPartialTableApi({
|
|
|
81318
81404
|
focusField && (gridApi == null ? void 0 : gridApi.setFocusedCell(rowIndex, focusField));
|
|
81319
81405
|
};
|
|
81320
81406
|
return {
|
|
81321
|
-
getVisibleRowNodes,
|
|
81322
81407
|
applyTransaction,
|
|
81323
81408
|
applyServerSideTransaction,
|
|
81324
81409
|
collapseAll,
|
|
@@ -81333,6 +81418,7 @@ function buildPartialTableApi({
|
|
|
81333
81418
|
getSelectedRows: getSelectedRows2,
|
|
81334
81419
|
getServerSideSelectionState,
|
|
81335
81420
|
getTableConfiguration,
|
|
81421
|
+
getVisibleRowNodes,
|
|
81336
81422
|
refreshCells,
|
|
81337
81423
|
setPinnedBottomRowData,
|
|
81338
81424
|
setRowData,
|
|
@@ -81450,6 +81536,12 @@ var DataTable = ({
|
|
|
81450
81536
|
const [rowHeight, setRowHeight] = React76.useState(
|
|
81451
81537
|
(initialTableConfig == null ? void 0 : initialTableConfig.rowHeight) || rowSize.md
|
|
81452
81538
|
);
|
|
81539
|
+
const expandCollapseStateRef = React76.useRef(
|
|
81540
|
+
(initialTableConfig == null ? void 0 : initialTableConfig.groupRowState) || {
|
|
81541
|
+
expandedRoutes: [],
|
|
81542
|
+
collapsedRoutes: []
|
|
81543
|
+
}
|
|
81544
|
+
);
|
|
81453
81545
|
const rowHeightRef = React76.useRef(
|
|
81454
81546
|
(initialTableConfig == null ? void 0 : initialTableConfig.rowHeight) || rowSize.md
|
|
81455
81547
|
);
|
|
@@ -81497,12 +81589,14 @@ var DataTable = ({
|
|
|
81497
81589
|
if (localStoragePersistenceKey) {
|
|
81498
81590
|
storage.local.setItem(localStoragePersistenceKey, {
|
|
81499
81591
|
...config,
|
|
81592
|
+
groupRowState: expandCollapseStateRef.current,
|
|
81500
81593
|
rowHeight: rowHeightRef.current,
|
|
81501
81594
|
serverFilters: filterStorage.filtersState
|
|
81502
81595
|
});
|
|
81503
81596
|
}
|
|
81504
81597
|
onTableConfigChange == null ? void 0 : onTableConfigChange({
|
|
81505
81598
|
...config,
|
|
81599
|
+
groupRowState: expandCollapseStateRef.current,
|
|
81506
81600
|
rowHeight: rowHeightRef.current,
|
|
81507
81601
|
serverFilters: filterStorage.filtersState
|
|
81508
81602
|
});
|
|
@@ -81613,6 +81707,7 @@ var DataTable = ({
|
|
|
81613
81707
|
onServerSideDataRequest,
|
|
81614
81708
|
onTableConfigChange: internalOnTableConfigChange,
|
|
81615
81709
|
rowSelectionRef,
|
|
81710
|
+
expandCollapseStateRef,
|
|
81616
81711
|
rowHeight,
|
|
81617
81712
|
searchStorage,
|
|
81618
81713
|
selectedGroupIndex,
|
|
@@ -81673,7 +81768,7 @@ function getServerSideDatasource(onServerSideDataRequestCallbackRef, onEmptyResp
|
|
|
81673
81768
|
}
|
|
81674
81769
|
var minimumColumnWidth = 140;
|
|
81675
81770
|
var Table = (props) => {
|
|
81676
|
-
var _a, _b;
|
|
81771
|
+
var _a, _b, _c;
|
|
81677
81772
|
const { suppressColumnVirtualisation = true, rowActionsConfig = {} } = props;
|
|
81678
81773
|
const I18n = useI18nContext();
|
|
81679
81774
|
const internalTableContext = useInternalTableContext();
|
|
@@ -81715,8 +81810,10 @@ var Table = (props) => {
|
|
|
81715
81810
|
columnDefinitions: internalTableContext.columnDefinitions,
|
|
81716
81811
|
gridApi,
|
|
81717
81812
|
setLoadingStatus,
|
|
81718
|
-
wrapperRef
|
|
81813
|
+
wrapperRef,
|
|
81814
|
+
groupDefaultExpanded: props.groupDefaultExpanded
|
|
81719
81815
|
});
|
|
81816
|
+
const initialTableConfig = internalTableContext.initialTableConfig;
|
|
81720
81817
|
React76.useImperativeHandle(internalTableContext.tableRef, () => tableApi, [
|
|
81721
81818
|
tableApi
|
|
81722
81819
|
]);
|
|
@@ -82030,8 +82127,8 @@ var Table = (props) => {
|
|
|
82030
82127
|
);
|
|
82031
82128
|
const onColumnGroupOpened = React76.useCallback(
|
|
82032
82129
|
(event) => {
|
|
82033
|
-
var _a2, _b2,
|
|
82034
|
-
(
|
|
82130
|
+
var _a2, _b2, _c2;
|
|
82131
|
+
(_c2 = internalTableContext.analytics) == null ? void 0 : _c2.client.addEvent(
|
|
82035
82132
|
"design_system.data_table.column.expand_toggled",
|
|
82036
82133
|
{
|
|
82037
82134
|
client: internalTableContext.analytics.clientName,
|
|
@@ -82048,14 +82145,14 @@ var Table = (props) => {
|
|
|
82048
82145
|
);
|
|
82049
82146
|
const onColumnPinned = React76.useCallback(
|
|
82050
82147
|
(event) => {
|
|
82051
|
-
var _a2, _b2,
|
|
82148
|
+
var _a2, _b2, _c2, _d;
|
|
82052
82149
|
(_d = internalTableContext.analytics) == null ? void 0 : _d.client.addEvent(
|
|
82053
82150
|
"design_system.data_table.column.pinned",
|
|
82054
82151
|
{
|
|
82055
82152
|
client: internalTableContext.analytics.clientName,
|
|
82056
82153
|
column: (_a2 = event.column) == null ? void 0 : _a2.getColId(),
|
|
82057
82154
|
side: (_b2 = event.column) == null ? void 0 : _b2.getPinned(),
|
|
82058
|
-
position: (
|
|
82155
|
+
position: (_c2 = columnApi == null ? void 0 : columnApi.getColumns()) == null ? void 0 : _c2.findIndex(
|
|
82059
82156
|
(col) => {
|
|
82060
82157
|
var _a3;
|
|
82061
82158
|
return col.getId() === ((_a3 = event.column) == null ? void 0 : _a3.getColId());
|
|
@@ -82154,7 +82251,7 @@ var Table = (props) => {
|
|
|
82154
82251
|
const onDragStopped = React76.useCallback(
|
|
82155
82252
|
// eslint-disable-next-line complexity
|
|
82156
82253
|
(event) => {
|
|
82157
|
-
var _a2, _b2,
|
|
82254
|
+
var _a2, _b2, _c2;
|
|
82158
82255
|
if (event.target.className.includes("ag-header-cell")) {
|
|
82159
82256
|
internalTableContext.onTableConfigChange();
|
|
82160
82257
|
}
|
|
@@ -82172,7 +82269,7 @@ var Table = (props) => {
|
|
|
82172
82269
|
const firstVisibleColumnIndex = allColumns.findIndex(
|
|
82173
82270
|
(col) => col.isVisible()
|
|
82174
82271
|
);
|
|
82175
|
-
if (moveColumnEvent.toIndex === firstVisibleColumnIndex || ((
|
|
82272
|
+
if (moveColumnEvent.toIndex === firstVisibleColumnIndex || ((_c2 = moveColumnEvent.column) == null ? void 0 : _c2.getColDef().rowDrag)) {
|
|
82176
82273
|
adjustRowDragIcon(event.api, event.columnApi);
|
|
82177
82274
|
}
|
|
82178
82275
|
}
|
|
@@ -82251,27 +82348,55 @@ var Table = (props) => {
|
|
|
82251
82348
|
(_a2 = document.getElementsByClassName("ag-body-viewport")[0]) == null ? void 0 : _a2.clientWidth
|
|
82252
82349
|
);
|
|
82253
82350
|
}, [setViewportWidth]);
|
|
82351
|
+
const isClientSideGroupOpenByDefault = React76.useCallback(
|
|
82352
|
+
(params) => {
|
|
82353
|
+
const node = params.rowNode;
|
|
82354
|
+
if (!node) {
|
|
82355
|
+
return false;
|
|
82356
|
+
}
|
|
82357
|
+
return isRowOpenedByDefault(
|
|
82358
|
+
node,
|
|
82359
|
+
initialTableConfig,
|
|
82360
|
+
props.groupsAlwaysExpanded ? -1 : props.groupDefaultExpanded
|
|
82361
|
+
);
|
|
82362
|
+
},
|
|
82363
|
+
[initialTableConfig, props.groupDefaultExpanded]
|
|
82364
|
+
);
|
|
82365
|
+
const isServerSideGroupOpenByDefault = React76.useCallback(
|
|
82366
|
+
(params) => {
|
|
82367
|
+
const node = params.rowNode;
|
|
82368
|
+
if (!node) {
|
|
82369
|
+
return false;
|
|
82370
|
+
}
|
|
82371
|
+
return isRowOpenedByDefault(
|
|
82372
|
+
node,
|
|
82373
|
+
initialTableConfig,
|
|
82374
|
+
props.groupsAlwaysExpanded ? -1 : props.groupDefaultExpanded
|
|
82375
|
+
);
|
|
82376
|
+
},
|
|
82377
|
+
[initialTableConfig, props.groupDefaultExpanded]
|
|
82378
|
+
);
|
|
82254
82379
|
const onGridReady = (params) => {
|
|
82255
|
-
var _a2, _b2,
|
|
82380
|
+
var _a2, _b2, _c2;
|
|
82256
82381
|
internalTableContext.setGridApi(params.api);
|
|
82257
82382
|
internalTableContext.setColumnApi(params.columnApi);
|
|
82258
82383
|
setViewportWidth(
|
|
82259
82384
|
(_a2 = document.getElementsByClassName("ag-body-viewport")[0]) == null ? void 0 : _a2.clientWidth
|
|
82260
82385
|
);
|
|
82261
|
-
(
|
|
82386
|
+
(_c2 = (_b2 = props.UNSAFE_internalAGGridOverrides) == null ? void 0 : _b2.onGridReady) == null ? void 0 : _c2.call(_b2, params);
|
|
82262
82387
|
};
|
|
82263
82388
|
const postProcessPopup = (params) => {
|
|
82264
82389
|
params.ePopup.style.top = `${HEADER_HEIGHT}px`;
|
|
82265
82390
|
};
|
|
82266
82391
|
const internalOnRowSelected = (event) => {
|
|
82267
|
-
var _a2, _b2,
|
|
82392
|
+
var _a2, _b2, _c2;
|
|
82268
82393
|
(_a2 = props.onRowSelected) == null ? void 0 : _a2.call(props, event);
|
|
82269
82394
|
if (props.siblingGroupsRowSelectionDisabled) {
|
|
82270
82395
|
const rootRowNode = getRootRowNode(event.node);
|
|
82271
82396
|
if (!event.node.isSelected() && internalTableContext.selectedGroupIndex !== null && (rootRowNode == null ? void 0 : rootRowNode.id) === internalTableContext.selectedGroupIndex && event.api.getSelectedNodes().length === 0) {
|
|
82272
82397
|
(_b2 = internalTableContext == null ? void 0 : internalTableContext.setSelectedGroupIndex) == null ? void 0 : _b2.call(internalTableContext, null);
|
|
82273
82398
|
} else {
|
|
82274
|
-
(
|
|
82399
|
+
(_c2 = internalTableContext == null ? void 0 : internalTableContext.setSelectedGroupIndex) == null ? void 0 : _c2.call(internalTableContext, (prevState) => {
|
|
82275
82400
|
return prevState ?? (rootRowNode == null ? void 0 : rootRowNode.id) ?? null;
|
|
82276
82401
|
});
|
|
82277
82402
|
}
|
|
@@ -82280,13 +82405,26 @@ var Table = (props) => {
|
|
|
82280
82405
|
const internalRowGroupOpened = React76.useCallback(
|
|
82281
82406
|
(event) => {
|
|
82282
82407
|
var _a2;
|
|
82408
|
+
if (internalTableContext.expandCollapseStateRef) {
|
|
82409
|
+
internalTableContext.expandCollapseStateRef.current = getGroupRowState(
|
|
82410
|
+
gridApi,
|
|
82411
|
+
props.groupDefaultExpanded
|
|
82412
|
+
);
|
|
82413
|
+
}
|
|
82414
|
+
internalTableContext.onTableConfigChange();
|
|
82283
82415
|
(_a2 = props.onRowGroupOpened) == null ? void 0 : _a2.call(props, {
|
|
82284
82416
|
expanded: event.expanded,
|
|
82285
82417
|
node: serializeNode(event.node),
|
|
82286
82418
|
rowIndex: event.rowIndex
|
|
82287
82419
|
});
|
|
82288
82420
|
},
|
|
82289
|
-
[
|
|
82421
|
+
[
|
|
82422
|
+
props.onRowGroupOpened,
|
|
82423
|
+
internalTableContext.onTableConfigChange,
|
|
82424
|
+
tableApi == null ? void 0 : tableApi.getTableConfiguration(),
|
|
82425
|
+
(_c = internalTableContext.expandCollapseStateRef) == null ? void 0 : _c.current,
|
|
82426
|
+
gridApi
|
|
82427
|
+
]
|
|
82290
82428
|
);
|
|
82291
82429
|
const getGroupRowAgg = React76.useCallback(
|
|
82292
82430
|
(params) => {
|
|
@@ -82439,6 +82577,8 @@ var Table = (props) => {
|
|
|
82439
82577
|
alwaysAggregateAtRootLevel: !onSSDR,
|
|
82440
82578
|
autoGroupColumnDef: decoratedAutoGroupColDef,
|
|
82441
82579
|
cacheBlockSize: props.paginationPageSize || defaultPaginationPageSize,
|
|
82580
|
+
isGroupOpenByDefault: isClientSideGroupOpenByDefault,
|
|
82581
|
+
isServerSideGroupOpenByDefault,
|
|
82442
82582
|
defaultColDef,
|
|
82443
82583
|
enableGroupEdit: internalTableContext.enableGroupEditAndValidation,
|
|
82444
82584
|
enableCellTextSelection: internalTableContext.enableCellTextSelection,
|
package/dist/modern/index.cjs
CHANGED
|
@@ -53409,7 +53409,7 @@ var Renderer9 = ({
|
|
|
53409
53409
|
if (isGroup || rowPinned && columnDefinition.aggFunc) {
|
|
53410
53410
|
return /* @__PURE__ */ React76__default.default.createElement(coreReact.Typography, { ...typographyProps, weight: "semibold" }, label);
|
|
53411
53411
|
}
|
|
53412
|
-
return /* @__PURE__ */ React76__default.default.createElement(coreReact.Pill, { color: getColor(value), className: cx10("pill-cell") }, label
|
|
53412
|
+
return /* @__PURE__ */ React76__default.default.createElement(coreReact.Pill, { color: getColor(value), className: cx10("pill-cell") }, label);
|
|
53413
53413
|
};
|
|
53414
53414
|
var PillCellRenderer = withDataTableRenderer(Renderer9, "select");
|
|
53415
53415
|
var Editor5 = React76__default.default.forwardRef(
|
|
@@ -53442,7 +53442,7 @@ var Editor5 = React76__default.default.forwardRef(
|
|
|
53442
53442
|
}
|
|
53443
53443
|
function getLabel3(item) {
|
|
53444
53444
|
const unformattedLabel = columnDefinition.getStringFormattedValue?.(item) || "";
|
|
53445
|
-
return unformattedLabel
|
|
53445
|
+
return unformattedLabel;
|
|
53446
53446
|
}
|
|
53447
53447
|
return /* @__PURE__ */ React76__default.default.createElement(
|
|
53448
53448
|
coreReact.PillSelect,
|
|
@@ -56535,9 +56535,10 @@ var GenericHeaderRenderer = (props) => {
|
|
|
56535
56535
|
props.api.addEventListener("columnRowGroupChanged", updateExpandedState);
|
|
56536
56536
|
return () => {
|
|
56537
56537
|
props.column.removeEventListener("sortChanged", onSortChanged);
|
|
56538
|
-
|
|
56538
|
+
removeEventListenerFromGrid(
|
|
56539
56539
|
"columnRowGroupChanged",
|
|
56540
|
-
updateExpandedState
|
|
56540
|
+
updateExpandedState,
|
|
56541
|
+
props.api
|
|
56541
56542
|
);
|
|
56542
56543
|
};
|
|
56543
56544
|
}, [props.column]);
|
|
@@ -57603,6 +57604,7 @@ var InternalTableContext = React76__default.default.createContext({
|
|
|
57603
57604
|
getRowHeight: () => () => rowSize.md,
|
|
57604
57605
|
grandTotalsLabelInnerRenderer: void 0,
|
|
57605
57606
|
gridApi: void 0,
|
|
57607
|
+
localStoragePersistenceKey: void 0,
|
|
57606
57608
|
onBulkEditUpdate: () => Promise.resolve(),
|
|
57607
57609
|
onServerSideDataRequest: void 0,
|
|
57608
57610
|
onTableConfigChange: () => {
|
|
@@ -57619,6 +57621,7 @@ var InternalTableContext = React76__default.default.createContext({
|
|
|
57619
57621
|
setRowHeight: () => {
|
|
57620
57622
|
},
|
|
57621
57623
|
showExpandCollapseAllToggle: false,
|
|
57624
|
+
expandCollapseStateRef: null,
|
|
57622
57625
|
tableRef: null,
|
|
57623
57626
|
getColumnDefinition: () => void 0,
|
|
57624
57627
|
setSelectedGroupIndex: () => {
|
|
@@ -78033,6 +78036,61 @@ var buildDetailRowsConfig_ = (detailRowConfig, {
|
|
|
78033
78036
|
};
|
|
78034
78037
|
};
|
|
78035
78038
|
|
|
78039
|
+
// src/utils/expandRows.ts
|
|
78040
|
+
var getGroupRowState = (gridApi, groupDefaultExpanded = 0) => {
|
|
78041
|
+
const expandedRoutes = [];
|
|
78042
|
+
const collapsedRoutes = [];
|
|
78043
|
+
if (gridApi) {
|
|
78044
|
+
gridApi.forEachNode((node) => {
|
|
78045
|
+
const route = node.getRoute();
|
|
78046
|
+
if (route) {
|
|
78047
|
+
const routePath = route.join(",");
|
|
78048
|
+
const defaultExpandLevel = groupDefaultExpanded === -1 ? Infinity : groupDefaultExpanded;
|
|
78049
|
+
if (node.level > defaultExpandLevel - 1) {
|
|
78050
|
+
if (node.expanded) {
|
|
78051
|
+
expandedRoutes.push(routePath);
|
|
78052
|
+
}
|
|
78053
|
+
} else if (!node.expanded) {
|
|
78054
|
+
collapsedRoutes.push(routePath);
|
|
78055
|
+
}
|
|
78056
|
+
}
|
|
78057
|
+
});
|
|
78058
|
+
}
|
|
78059
|
+
return { expandedRoutes, collapsedRoutes };
|
|
78060
|
+
};
|
|
78061
|
+
var setExpandCollapseRow = (gridApi, tableConfig, groupDefaultExpanded = 0) => {
|
|
78062
|
+
const expandedRoutes = tableConfig.groupRowState?.expandedRoutes ?? [];
|
|
78063
|
+
const collapsedRoutes = tableConfig.groupRowState?.collapsedRoutes ?? [];
|
|
78064
|
+
gridApi.forEachNode((node) => {
|
|
78065
|
+
const route = node.getRoute();
|
|
78066
|
+
if (route) {
|
|
78067
|
+
const routePath = route.join(",");
|
|
78068
|
+
const defaultExpandLevel = groupDefaultExpanded === -1 ? Infinity : groupDefaultExpanded;
|
|
78069
|
+
if (node.level > defaultExpandLevel - 1) {
|
|
78070
|
+
if (expandedRoutes.includes(routePath)) {
|
|
78071
|
+
node.setExpanded(true);
|
|
78072
|
+
}
|
|
78073
|
+
} else if (collapsedRoutes.includes(routePath)) {
|
|
78074
|
+
node.setExpanded(false);
|
|
78075
|
+
}
|
|
78076
|
+
}
|
|
78077
|
+
});
|
|
78078
|
+
};
|
|
78079
|
+
var isRowOpenedByDefault = (node, tableConfig, groupDefaultExpanded = 0) => {
|
|
78080
|
+
const expandedRoutes = tableConfig?.groupRowState?.expandedRoutes ?? [];
|
|
78081
|
+
const collapsedRoutes = tableConfig?.groupRowState?.collapsedRoutes ?? [];
|
|
78082
|
+
const route = node.getRoute();
|
|
78083
|
+
if (!route) {
|
|
78084
|
+
return false;
|
|
78085
|
+
}
|
|
78086
|
+
const routePath = route.join(",");
|
|
78087
|
+
const defaultExpandLevel = groupDefaultExpanded === -1 ? Infinity : groupDefaultExpanded;
|
|
78088
|
+
if (node.level > defaultExpandLevel - 1) {
|
|
78089
|
+
return expandedRoutes.includes(routePath);
|
|
78090
|
+
} else
|
|
78091
|
+
return !collapsedRoutes.includes(routePath);
|
|
78092
|
+
};
|
|
78093
|
+
|
|
78036
78094
|
// src/utils/getRootRowNode.ts
|
|
78037
78095
|
function getRootRowNode(rowNode) {
|
|
78038
78096
|
return rowNode.level > 0 && rowNode.parent ? getRootRowNode(rowNode.parent) : rowNode;
|
|
@@ -80554,6 +80612,7 @@ var useTableApi = ({
|
|
|
80554
80612
|
columnApi,
|
|
80555
80613
|
columnDefinitions,
|
|
80556
80614
|
gridApi,
|
|
80615
|
+
groupDefaultExpanded,
|
|
80557
80616
|
setLoadingStatus,
|
|
80558
80617
|
wrapperRef
|
|
80559
80618
|
}) => {
|
|
@@ -80745,10 +80804,33 @@ var useTableApi = ({
|
|
|
80745
80804
|
const setSearchValue = React76__default.default.useCallback(
|
|
80746
80805
|
(value) => {
|
|
80747
80806
|
gridApi?.setQuickFilter(value);
|
|
80807
|
+
gridApi?.forEachNodeAfterFilterAndSort((node) => {
|
|
80808
|
+
if (node.id) {
|
|
80809
|
+
const currentNode = rowSelectionRef?.current.affectedRows[node.id];
|
|
80810
|
+
if (currentNode && currentNode.selectedState === rowSelectionState.selected) {
|
|
80811
|
+
node.setSelected(true, false, "checkboxSelected");
|
|
80812
|
+
}
|
|
80813
|
+
}
|
|
80814
|
+
});
|
|
80748
80815
|
resetPagination();
|
|
80816
|
+
gridApi?.redrawRows();
|
|
80749
80817
|
},
|
|
80750
|
-
[gridApi]
|
|
80818
|
+
[gridApi, rowSelectionRef.current]
|
|
80751
80819
|
);
|
|
80820
|
+
React76__default.default.useEffect(() => {
|
|
80821
|
+
function handleRowSelection(event) {
|
|
80822
|
+
if (event.node.displayed && event.node.id) {
|
|
80823
|
+
rowSelectionRef.current.affectedRows[event.node.id] = {
|
|
80824
|
+
node: event.node,
|
|
80825
|
+
selectedState: event.node.isSelected() ? rowSelectionState.selected : rowSelectionState.unselected
|
|
80826
|
+
};
|
|
80827
|
+
}
|
|
80828
|
+
}
|
|
80829
|
+
gridApi?.addEventListener && gridApi.addEventListener("rowSelected", handleRowSelection);
|
|
80830
|
+
return () => {
|
|
80831
|
+
removeEventListenerFromGrid("rowSelected", handleRowSelection, gridApi);
|
|
80832
|
+
};
|
|
80833
|
+
}, [gridApi]);
|
|
80752
80834
|
const setLoading = React76__default.default.useCallback((loading, message = "") => {
|
|
80753
80835
|
setLoadingStatus({
|
|
80754
80836
|
loading,
|
|
@@ -80809,6 +80891,7 @@ var useTableApi = ({
|
|
|
80809
80891
|
adjustRowDragIcon(gridApi, columnApi);
|
|
80810
80892
|
});
|
|
80811
80893
|
}
|
|
80894
|
+
setExpandCollapseRow(gridApi, config, groupDefaultExpanded);
|
|
80812
80895
|
},
|
|
80813
80896
|
[columnApi, gridApi, internalSetRowHeight, filterStorage.setSelectedFilters]
|
|
80814
80897
|
);
|
|
@@ -80900,7 +80983,8 @@ var useTableApi = ({
|
|
|
80900
80983
|
columnApi,
|
|
80901
80984
|
rowHeight,
|
|
80902
80985
|
filterStorage,
|
|
80903
|
-
rowSelectionRef
|
|
80986
|
+
rowSelectionRef,
|
|
80987
|
+
groupDefaultExpanded
|
|
80904
80988
|
}),
|
|
80905
80989
|
[columnApi, gridApi, rowHeight, filterStorage]
|
|
80906
80990
|
);
|
|
@@ -81168,7 +81252,6 @@ function buildPartialTableApi({
|
|
|
81168
81252
|
focusField && gridApi?.setFocusedCell(rowIndex, focusField);
|
|
81169
81253
|
};
|
|
81170
81254
|
return {
|
|
81171
|
-
getVisibleRowNodes,
|
|
81172
81255
|
applyTransaction,
|
|
81173
81256
|
applyServerSideTransaction,
|
|
81174
81257
|
collapseAll,
|
|
@@ -81183,6 +81266,7 @@ function buildPartialTableApi({
|
|
|
81183
81266
|
getSelectedRows: getSelectedRows2,
|
|
81184
81267
|
getServerSideSelectionState,
|
|
81185
81268
|
getTableConfiguration,
|
|
81269
|
+
getVisibleRowNodes,
|
|
81186
81270
|
refreshCells,
|
|
81187
81271
|
setPinnedBottomRowData,
|
|
81188
81272
|
setRowData,
|
|
@@ -81300,6 +81384,12 @@ var DataTable = ({
|
|
|
81300
81384
|
const [rowHeight, setRowHeight] = React76__default.default.useState(
|
|
81301
81385
|
initialTableConfig?.rowHeight || rowSize.md
|
|
81302
81386
|
);
|
|
81387
|
+
const expandCollapseStateRef = React76__default.default.useRef(
|
|
81388
|
+
initialTableConfig?.groupRowState || {
|
|
81389
|
+
expandedRoutes: [],
|
|
81390
|
+
collapsedRoutes: []
|
|
81391
|
+
}
|
|
81392
|
+
);
|
|
81303
81393
|
const rowHeightRef = React76__default.default.useRef(
|
|
81304
81394
|
initialTableConfig?.rowHeight || rowSize.md
|
|
81305
81395
|
);
|
|
@@ -81345,12 +81435,14 @@ var DataTable = ({
|
|
|
81345
81435
|
if (localStoragePersistenceKey) {
|
|
81346
81436
|
webSdkStorage.storage.local.setItem(localStoragePersistenceKey, {
|
|
81347
81437
|
...config,
|
|
81438
|
+
groupRowState: expandCollapseStateRef.current,
|
|
81348
81439
|
rowHeight: rowHeightRef.current,
|
|
81349
81440
|
serverFilters: filterStorage.filtersState
|
|
81350
81441
|
});
|
|
81351
81442
|
}
|
|
81352
81443
|
onTableConfigChange?.({
|
|
81353
81444
|
...config,
|
|
81445
|
+
groupRowState: expandCollapseStateRef.current,
|
|
81354
81446
|
rowHeight: rowHeightRef.current,
|
|
81355
81447
|
serverFilters: filterStorage.filtersState
|
|
81356
81448
|
});
|
|
@@ -81459,6 +81551,7 @@ var DataTable = ({
|
|
|
81459
81551
|
onServerSideDataRequest,
|
|
81460
81552
|
onTableConfigChange: internalOnTableConfigChange,
|
|
81461
81553
|
rowSelectionRef,
|
|
81554
|
+
expandCollapseStateRef,
|
|
81462
81555
|
rowHeight,
|
|
81463
81556
|
searchStorage,
|
|
81464
81557
|
selectedGroupIndex,
|
|
@@ -81560,8 +81653,10 @@ var Table = (props) => {
|
|
|
81560
81653
|
columnDefinitions: internalTableContext.columnDefinitions,
|
|
81561
81654
|
gridApi,
|
|
81562
81655
|
setLoadingStatus,
|
|
81563
|
-
wrapperRef
|
|
81656
|
+
wrapperRef,
|
|
81657
|
+
groupDefaultExpanded: props.groupDefaultExpanded
|
|
81564
81658
|
});
|
|
81659
|
+
const initialTableConfig = internalTableContext.initialTableConfig;
|
|
81565
81660
|
React76__default.default.useImperativeHandle(internalTableContext.tableRef, () => tableApi, [
|
|
81566
81661
|
tableApi
|
|
81567
81662
|
]);
|
|
@@ -82068,6 +82163,34 @@ var Table = (props) => {
|
|
|
82068
82163
|
document.getElementsByClassName("ag-body-viewport")[0]?.clientWidth
|
|
82069
82164
|
);
|
|
82070
82165
|
}, [setViewportWidth]);
|
|
82166
|
+
const isClientSideGroupOpenByDefault = React76__default.default.useCallback(
|
|
82167
|
+
(params) => {
|
|
82168
|
+
const node = params.rowNode;
|
|
82169
|
+
if (!node) {
|
|
82170
|
+
return false;
|
|
82171
|
+
}
|
|
82172
|
+
return isRowOpenedByDefault(
|
|
82173
|
+
node,
|
|
82174
|
+
initialTableConfig,
|
|
82175
|
+
props.groupsAlwaysExpanded ? -1 : props.groupDefaultExpanded
|
|
82176
|
+
);
|
|
82177
|
+
},
|
|
82178
|
+
[initialTableConfig, props.groupDefaultExpanded]
|
|
82179
|
+
);
|
|
82180
|
+
const isServerSideGroupOpenByDefault = React76__default.default.useCallback(
|
|
82181
|
+
(params) => {
|
|
82182
|
+
const node = params.rowNode;
|
|
82183
|
+
if (!node) {
|
|
82184
|
+
return false;
|
|
82185
|
+
}
|
|
82186
|
+
return isRowOpenedByDefault(
|
|
82187
|
+
node,
|
|
82188
|
+
initialTableConfig,
|
|
82189
|
+
props.groupsAlwaysExpanded ? -1 : props.groupDefaultExpanded
|
|
82190
|
+
);
|
|
82191
|
+
},
|
|
82192
|
+
[initialTableConfig, props.groupDefaultExpanded]
|
|
82193
|
+
);
|
|
82071
82194
|
const onGridReady = (params) => {
|
|
82072
82195
|
internalTableContext.setGridApi(params.api);
|
|
82073
82196
|
internalTableContext.setColumnApi(params.columnApi);
|
|
@@ -82094,13 +82217,26 @@ var Table = (props) => {
|
|
|
82094
82217
|
};
|
|
82095
82218
|
const internalRowGroupOpened = React76__default.default.useCallback(
|
|
82096
82219
|
(event) => {
|
|
82220
|
+
if (internalTableContext.expandCollapseStateRef) {
|
|
82221
|
+
internalTableContext.expandCollapseStateRef.current = getGroupRowState(
|
|
82222
|
+
gridApi,
|
|
82223
|
+
props.groupDefaultExpanded
|
|
82224
|
+
);
|
|
82225
|
+
}
|
|
82226
|
+
internalTableContext.onTableConfigChange();
|
|
82097
82227
|
props.onRowGroupOpened?.({
|
|
82098
82228
|
expanded: event.expanded,
|
|
82099
82229
|
node: serializeNode(event.node),
|
|
82100
82230
|
rowIndex: event.rowIndex
|
|
82101
82231
|
});
|
|
82102
82232
|
},
|
|
82103
|
-
[
|
|
82233
|
+
[
|
|
82234
|
+
props.onRowGroupOpened,
|
|
82235
|
+
internalTableContext.onTableConfigChange,
|
|
82236
|
+
tableApi?.getTableConfiguration(),
|
|
82237
|
+
internalTableContext.expandCollapseStateRef?.current,
|
|
82238
|
+
gridApi
|
|
82239
|
+
]
|
|
82104
82240
|
);
|
|
82105
82241
|
const getGroupRowAgg = React76__default.default.useCallback(
|
|
82106
82242
|
(params) => {
|
|
@@ -82252,6 +82388,8 @@ var Table = (props) => {
|
|
|
82252
82388
|
alwaysAggregateAtRootLevel: !onSSDR,
|
|
82253
82389
|
autoGroupColumnDef: decoratedAutoGroupColDef,
|
|
82254
82390
|
cacheBlockSize: props.paginationPageSize || defaultPaginationPageSize,
|
|
82391
|
+
isGroupOpenByDefault: isClientSideGroupOpenByDefault,
|
|
82392
|
+
isServerSideGroupOpenByDefault,
|
|
82255
82393
|
defaultColDef,
|
|
82256
82394
|
enableGroupEdit: internalTableContext.enableGroupEditAndValidation,
|
|
82257
82395
|
enableCellTextSelection: internalTableContext.enableCellTextSelection,
|