@procore/data-table 14.12.2 → 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.
@@ -12804,8 +12804,8 @@ var GridOptionsValidator = class GridOptionsValidator2 {
12804
12804
  enterMovesDownAfterEdit: { version: "30", newProp: "enterNavigatesVerticallyAfterEdit", copyToNewProp: true }
12805
12805
  };
12806
12806
  }
12807
- pickOneWarning(prop1, prop2) {
12808
- console.warn(`AG Grid: ${prop1} and ${prop2} do not work with each other, you need to pick one.`);
12807
+ pickOneWarning(prop1, prop22) {
12808
+ console.warn(`AG Grid: ${prop1} and ${prop22} do not work with each other, you need to pick one.`);
12809
12809
  }
12810
12810
  init() {
12811
12811
  this.checkForDeprecated();
@@ -12827,7 +12827,7 @@ var GridOptionsValidator = class GridOptionsValidator2 {
12827
12827
  this.pickOneWarning("groupRemoveSingleChildren", "groupHideOpenParents");
12828
12828
  }
12829
12829
  if (this.gridOptionsService.isRowModelType("serverSide")) {
12830
- const msg = (prop, alt) => `AG Grid: '${prop}' is not supported on the Server-Side Row Model.` + (alt ? ` Please use ${alt} instead.` : "");
12830
+ const msg = (prop3, alt) => `AG Grid: '${prop3}' is not supported on the Server-Side Row Model.` + (alt ? ` Please use ${alt} instead.` : "");
12831
12831
  if (this.gridOptionsService.exists("groupDefaultExpanded")) {
12832
12832
  console.warn(msg("groupDefaultExpanded", "isServerSideGroupOpenByDefault callback"));
12833
12833
  }
@@ -12843,7 +12843,7 @@ var GridOptionsValidator = class GridOptionsValidator2 {
12843
12843
  } else if (this.gridOptionsService.is("enableRangeHandle") || this.gridOptionsService.is("enableFillHandle")) {
12844
12844
  console.warn("AG Grid: 'enableRangeHandle' or 'enableFillHandle' will not work unless 'enableRangeSelection' is set to true");
12845
12845
  }
12846
- const validateRegistered = (prop, module) => this.gridOptionsService.exists(prop) && ModuleRegistry.__assertRegistered(module, prop, this.gridOptionsService.getGridId());
12846
+ const validateRegistered = (prop3, module) => this.gridOptionsService.exists(prop3) && ModuleRegistry.__assertRegistered(module, prop3, this.gridOptionsService.getGridId());
12847
12847
  validateRegistered("sideBar", ModuleNames.SideBarModule);
12848
12848
  validateRegistered("statusBar", ModuleNames.StatusBarModule);
12849
12849
  validateRegistered("enableCharts", ModuleNames.GridChartsModule);
@@ -52167,15 +52167,15 @@ var DataTypeService = class DataTypeService2 extends BeanStub {
52167
52167
  ["valueGetter", void 0],
52168
52168
  ["valueParser", void 0],
52169
52169
  ["refData", void 0]
52170
- ].some(([prop, comparisonValue]) => this.doesColDefPropPreventInference(colDef, propsToCheckForInference, prop, comparisonValue));
52170
+ ].some(([prop3, comparisonValue]) => this.doesColDefPropPreventInference(colDef, propsToCheckForInference, prop3, comparisonValue));
52171
52171
  }
52172
- doesColDefPropPreventInference(colDef, checkProps, prop, comparisonValue) {
52173
- if (!checkProps[prop]) {
52172
+ doesColDefPropPreventInference(colDef, checkProps, prop3, comparisonValue) {
52173
+ if (!checkProps[prop3]) {
52174
52174
  return false;
52175
52175
  }
52176
- const value = colDef[prop];
52176
+ const value = colDef[prop3];
52177
52177
  if (value === null) {
52178
- checkProps[prop] = false;
52178
+ checkProps[prop3] = false;
52179
52179
  return false;
52180
52180
  } else {
52181
52181
  return comparisonValue === void 0 ? !!value : value === comparisonValue;
@@ -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?.toUpperCase());
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.toUpperCase();
53445
+ return unformattedLabel;
53446
53446
  }
53447
53447
  return /* @__PURE__ */ React76__default.default.createElement(
53448
53448
  coreReact.PillSelect,
@@ -53835,6 +53835,7 @@ var LocationFilterOverlay = React76__default.default.forwardRef(
53835
53835
  enableSublocations,
53836
53836
  selectState,
53837
53837
  options,
53838
+ disabledOptions,
53838
53839
  columnDefinition,
53839
53840
  value
53840
53841
  }, ref) => {
@@ -53856,6 +53857,7 @@ var LocationFilterOverlay = React76__default.default.forwardRef(
53856
53857
  return onSelectAll();
53857
53858
  }
53858
53859
  if (selection.item.id === includeSublocationOption.id) {
53860
+ _onSelect(selection);
53859
53861
  return onSelectSublocations();
53860
53862
  }
53861
53863
  return _onSelect(selection);
@@ -53925,8 +53927,9 @@ var LocationFilterOverlay = React76__default.default.forwardRef(
53925
53927
  {
53926
53928
  key: getId3(item),
53927
53929
  item,
53928
- selected: value.map(({ id }) => id).includes(getId3(item)),
53929
- suggested: i === 0
53930
+ selected: value.map(({ id }) => id).includes(getId3(item)) || disabledOptions.map(({ id }) => id).includes(getId3(item)),
53931
+ suggested: i === 0,
53932
+ disabled: disabledOptions.map(({ id }) => id).includes(getId3(item))
53930
53933
  },
53931
53934
  getLabel3(item)
53932
53935
  );
@@ -53956,10 +53959,23 @@ var ServerSideLocationFilterRenderer = React76__default.default.forwardRef(
53956
53959
  const [selectState, setSelectState] = React76__default.default.useState(
53957
53960
  determineSelectedState(value)
53958
53961
  );
53962
+ const [disabledValues, setDisabledValues] = React76__default.default.useState([]);
53959
53963
  const [enableSublocations, setEnableSublocations] = React76__default.default.useState(false);
53960
53964
  const onSelectSublocations = React76__default.default.useCallback(() => {
53965
+ if (enableSublocations) {
53966
+ setDisabledValues([]);
53967
+ } else {
53968
+ const newDisabledValues = [];
53969
+ value.forEach((location) => {
53970
+ newDisabledValues.push(...findSublocations(location));
53971
+ });
53972
+ const uniqDisabledValues = ramda.uniqBy(ramda.prop("id"), newDisabledValues).filter(
53973
+ ({ id }) => !selectedValueIds.includes(id)
53974
+ );
53975
+ setDisabledValues(uniqDisabledValues);
53976
+ }
53961
53977
  setEnableSublocations(!enableSublocations);
53962
- }, [enableSublocations]);
53978
+ }, [enableSublocations, value, selectedValueIds, options]);
53963
53979
  const I18n = coreReact.useI18nContext();
53964
53980
  const selectRef = React76__default.default.useRef(null);
53965
53981
  const onSelectAll = React76__default.default.useCallback(() => {
@@ -53975,17 +53991,47 @@ var ServerSideLocationFilterRenderer = React76__default.default.forwardRef(
53975
53991
  }
53976
53992
  }, [options, selectState, selectedValueIds]);
53977
53993
  const onSelect = (selection) => {
53978
- if (selection.item.id === "select_all" || selection.item.id === "include_sublocations") {
53994
+ if (selection.item.id === "select_all") {
53979
53995
  return;
53980
53996
  }
53981
- let newSelections = selectedValueIds.includes(getId3(selection.item)) ? removeSelections(selection.item, value) : [
53982
- ...value,
53983
- ...handleSelectSublocations(selection.item),
53984
- selection.item
53985
- ];
53997
+ if (selection.item.id === "include_sublocations") {
53998
+ return onChange(
53999
+ value.map((item) => ({
54000
+ ...item,
54001
+ sublocations: enableSublocations ? [] : findSublocations(item)
54002
+ }))
54003
+ );
54004
+ }
54005
+ let newSelections = [];
54006
+ if (selectedValueIds.includes(getId3(selection.item))) {
54007
+ newSelections = removeSelections(selection.item, value);
54008
+ } else {
54009
+ newSelections = [...value, selection.item];
54010
+ const sublocationsToDisable = handleSelectSublocations(selection.item);
54011
+ const newDisabledValues = [
54012
+ ...disabledValues,
54013
+ ...sublocationsToDisable.filter(
54014
+ ({ id }) => !selectedValueIds.includes(id)
54015
+ )
54016
+ ];
54017
+ setDisabledValues(newDisabledValues);
54018
+ }
53986
54019
  setSelectState(determineSelectedState(newSelections));
53987
54020
  setSelectedValueIds(newSelections.map(({ id }) => id));
53988
- onChange(newSelections);
54021
+ onChange(
54022
+ newSelections.map((item) => ({
54023
+ ...item,
54024
+ sublocations: handleSelectSublocations(item)
54025
+ }))
54026
+ );
54027
+ };
54028
+ const findSublocations = (selected) => {
54029
+ return options.filter((option) => {
54030
+ return ramda.startsWith(
54031
+ `${getLabel3(selected).toLowerCase()} > `,
54032
+ getLabel3(option).toLowerCase()
54033
+ );
54034
+ });
53989
54035
  };
53990
54036
  const handleSelectSublocations = (selected) => {
53991
54037
  if (enableSublocations) {
@@ -54003,14 +54049,16 @@ var ServerSideLocationFilterRenderer = React76__default.default.forwardRef(
54003
54049
  const removeSelections = React76__default.default.useCallback(
54004
54050
  function(selection, selected) {
54005
54051
  const sublocations = handleSelectSublocations(selection);
54006
- return enableSublocations ? selected.filter(
54007
- (item) => ![
54008
- ...sublocations.map(({ id }) => id),
54009
- getId3(selection)
54010
- ].includes(item.id)
54011
- ) : selected.filter((item) => getId3(item) !== getId3(selection));
54052
+ const disabledValueIds = disabledValues.map(({ id }) => id);
54053
+ const sublocationsToRemoveFromDisabledIds = sublocations.filter(({ id }) => disabledValueIds.includes(id)).map(({ id }) => id);
54054
+ setDisabledValues(
54055
+ disabledValues.filter(
54056
+ ({ id }) => !sublocationsToRemoveFromDisabledIds.includes(id)
54057
+ )
54058
+ );
54059
+ return selected.filter((item) => getId3(item) !== getId3(selection));
54012
54060
  },
54013
- [enableSublocations]
54061
+ [enableSublocations, disabledValues]
54014
54062
  );
54015
54063
  React76__default.default.useEffect(() => {
54016
54064
  setSelectState(determineSelectedState(value));
@@ -54021,6 +54069,7 @@ var ServerSideLocationFilterRenderer = React76__default.default.forwardRef(
54021
54069
  columnDefinition,
54022
54070
  value,
54023
54071
  options,
54072
+ disabledOptions: disabledValues,
54024
54073
  enableSublocations,
54025
54074
  getId: getId3,
54026
54075
  getLabel: getLabel3,
@@ -56486,9 +56535,10 @@ var GenericHeaderRenderer = (props) => {
56486
56535
  props.api.addEventListener("columnRowGroupChanged", updateExpandedState);
56487
56536
  return () => {
56488
56537
  props.column.removeEventListener("sortChanged", onSortChanged);
56489
- props.api.removeEventListener(
56538
+ removeEventListenerFromGrid(
56490
56539
  "columnRowGroupChanged",
56491
- updateExpandedState
56540
+ updateExpandedState,
56541
+ props.api
56492
56542
  );
56493
56543
  };
56494
56544
  }, [props.column]);
@@ -57554,6 +57604,7 @@ var InternalTableContext = React76__default.default.createContext({
57554
57604
  getRowHeight: () => () => rowSize.md,
57555
57605
  grandTotalsLabelInnerRenderer: void 0,
57556
57606
  gridApi: void 0,
57607
+ localStoragePersistenceKey: void 0,
57557
57608
  onBulkEditUpdate: () => Promise.resolve(),
57558
57609
  onServerSideDataRequest: void 0,
57559
57610
  onTableConfigChange: () => {
@@ -57570,6 +57621,7 @@ var InternalTableContext = React76__default.default.createContext({
57570
57621
  setRowHeight: () => {
57571
57622
  },
57572
57623
  showExpandCollapseAllToggle: false,
57624
+ expandCollapseStateRef: null,
57573
57625
  tableRef: null,
57574
57626
  getColumnDefinition: () => void 0,
57575
57627
  setSelectedGroupIndex: () => {
@@ -77984,6 +78036,61 @@ var buildDetailRowsConfig_ = (detailRowConfig, {
77984
78036
  };
77985
78037
  };
77986
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
+
77987
78094
  // src/utils/getRootRowNode.ts
77988
78095
  function getRootRowNode(rowNode) {
77989
78096
  return rowNode.level > 0 && rowNode.parent ? getRootRowNode(rowNode.parent) : rowNode;
@@ -79658,6 +79765,11 @@ var ja_JP_default = {
79658
79765
  }
79659
79766
  };
79660
79767
 
79768
+ // src/locales/pl-PL.json
79769
+ var pl_PL_default = {
79770
+ dataTable: {}
79771
+ };
79772
+
79661
79773
  // src/locales/pseudo.json
79662
79774
  var pseudo_default = {
79663
79775
  dataTable: {
@@ -80274,7 +80386,8 @@ var translations = {
80274
80386
  pseudo: pseudo_default,
80275
80387
  "pt-BR": pt_BR_default,
80276
80388
  "th-TH": th_TH_default,
80277
- "zh-SG": zh_SG_default
80389
+ "zh-SG": zh_SG_default,
80390
+ "pl-PL": pl_PL_default
80278
80391
  };
80279
80392
  var PRINCE_XML_DPI = 96;
80280
80393
  var DEFAULT_PAGE_MARGIN = 40;
@@ -80499,6 +80612,7 @@ var useTableApi = ({
80499
80612
  columnApi,
80500
80613
  columnDefinitions,
80501
80614
  gridApi,
80615
+ groupDefaultExpanded,
80502
80616
  setLoadingStatus,
80503
80617
  wrapperRef
80504
80618
  }) => {
@@ -80690,10 +80804,33 @@ var useTableApi = ({
80690
80804
  const setSearchValue = React76__default.default.useCallback(
80691
80805
  (value) => {
80692
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
+ });
80693
80815
  resetPagination();
80816
+ gridApi?.redrawRows();
80694
80817
  },
80695
- [gridApi]
80818
+ [gridApi, rowSelectionRef.current]
80696
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]);
80697
80834
  const setLoading = React76__default.default.useCallback((loading, message = "") => {
80698
80835
  setLoadingStatus({
80699
80836
  loading,
@@ -80754,6 +80891,7 @@ var useTableApi = ({
80754
80891
  adjustRowDragIcon(gridApi, columnApi);
80755
80892
  });
80756
80893
  }
80894
+ setExpandCollapseRow(gridApi, config, groupDefaultExpanded);
80757
80895
  },
80758
80896
  [columnApi, gridApi, internalSetRowHeight, filterStorage.setSelectedFilters]
80759
80897
  );
@@ -80845,7 +80983,8 @@ var useTableApi = ({
80845
80983
  columnApi,
80846
80984
  rowHeight,
80847
80985
  filterStorage,
80848
- rowSelectionRef
80986
+ rowSelectionRef,
80987
+ groupDefaultExpanded
80849
80988
  }),
80850
80989
  [columnApi, gridApi, rowHeight, filterStorage]
80851
80990
  );
@@ -81113,7 +81252,6 @@ function buildPartialTableApi({
81113
81252
  focusField && gridApi?.setFocusedCell(rowIndex, focusField);
81114
81253
  };
81115
81254
  return {
81116
- getVisibleRowNodes,
81117
81255
  applyTransaction,
81118
81256
  applyServerSideTransaction,
81119
81257
  collapseAll,
@@ -81128,6 +81266,7 @@ function buildPartialTableApi({
81128
81266
  getSelectedRows: getSelectedRows2,
81129
81267
  getServerSideSelectionState,
81130
81268
  getTableConfiguration,
81269
+ getVisibleRowNodes,
81131
81270
  refreshCells,
81132
81271
  setPinnedBottomRowData,
81133
81272
  setRowData,
@@ -81245,6 +81384,12 @@ var DataTable = ({
81245
81384
  const [rowHeight, setRowHeight] = React76__default.default.useState(
81246
81385
  initialTableConfig?.rowHeight || rowSize.md
81247
81386
  );
81387
+ const expandCollapseStateRef = React76__default.default.useRef(
81388
+ initialTableConfig?.groupRowState || {
81389
+ expandedRoutes: [],
81390
+ collapsedRoutes: []
81391
+ }
81392
+ );
81248
81393
  const rowHeightRef = React76__default.default.useRef(
81249
81394
  initialTableConfig?.rowHeight || rowSize.md
81250
81395
  );
@@ -81290,12 +81435,14 @@ var DataTable = ({
81290
81435
  if (localStoragePersistenceKey) {
81291
81436
  webSdkStorage.storage.local.setItem(localStoragePersistenceKey, {
81292
81437
  ...config,
81438
+ groupRowState: expandCollapseStateRef.current,
81293
81439
  rowHeight: rowHeightRef.current,
81294
81440
  serverFilters: filterStorage.filtersState
81295
81441
  });
81296
81442
  }
81297
81443
  onTableConfigChange?.({
81298
81444
  ...config,
81445
+ groupRowState: expandCollapseStateRef.current,
81299
81446
  rowHeight: rowHeightRef.current,
81300
81447
  serverFilters: filterStorage.filtersState
81301
81448
  });
@@ -81404,6 +81551,7 @@ var DataTable = ({
81404
81551
  onServerSideDataRequest,
81405
81552
  onTableConfigChange: internalOnTableConfigChange,
81406
81553
  rowSelectionRef,
81554
+ expandCollapseStateRef,
81407
81555
  rowHeight,
81408
81556
  searchStorage,
81409
81557
  selectedGroupIndex,
@@ -81505,8 +81653,10 @@ var Table = (props) => {
81505
81653
  columnDefinitions: internalTableContext.columnDefinitions,
81506
81654
  gridApi,
81507
81655
  setLoadingStatus,
81508
- wrapperRef
81656
+ wrapperRef,
81657
+ groupDefaultExpanded: props.groupDefaultExpanded
81509
81658
  });
81659
+ const initialTableConfig = internalTableContext.initialTableConfig;
81510
81660
  React76__default.default.useImperativeHandle(internalTableContext.tableRef, () => tableApi, [
81511
81661
  tableApi
81512
81662
  ]);
@@ -82013,6 +82163,34 @@ var Table = (props) => {
82013
82163
  document.getElementsByClassName("ag-body-viewport")[0]?.clientWidth
82014
82164
  );
82015
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
+ );
82016
82194
  const onGridReady = (params) => {
82017
82195
  internalTableContext.setGridApi(params.api);
82018
82196
  internalTableContext.setColumnApi(params.columnApi);
@@ -82039,13 +82217,26 @@ var Table = (props) => {
82039
82217
  };
82040
82218
  const internalRowGroupOpened = React76__default.default.useCallback(
82041
82219
  (event) => {
82220
+ if (internalTableContext.expandCollapseStateRef) {
82221
+ internalTableContext.expandCollapseStateRef.current = getGroupRowState(
82222
+ gridApi,
82223
+ props.groupDefaultExpanded
82224
+ );
82225
+ }
82226
+ internalTableContext.onTableConfigChange();
82042
82227
  props.onRowGroupOpened?.({
82043
82228
  expanded: event.expanded,
82044
82229
  node: serializeNode(event.node),
82045
82230
  rowIndex: event.rowIndex
82046
82231
  });
82047
82232
  },
82048
- [props.onRowGroupOpened]
82233
+ [
82234
+ props.onRowGroupOpened,
82235
+ internalTableContext.onTableConfigChange,
82236
+ tableApi?.getTableConfiguration(),
82237
+ internalTableContext.expandCollapseStateRef?.current,
82238
+ gridApi
82239
+ ]
82049
82240
  );
82050
82241
  const getGroupRowAgg = React76__default.default.useCallback(
82051
82242
  (params) => {
@@ -82197,6 +82388,8 @@ var Table = (props) => {
82197
82388
  alwaysAggregateAtRootLevel: !onSSDR,
82198
82389
  autoGroupColumnDef: decoratedAutoGroupColDef,
82199
82390
  cacheBlockSize: props.paginationPageSize || defaultPaginationPageSize,
82391
+ isGroupOpenByDefault: isClientSideGroupOpenByDefault,
82392
+ isServerSideGroupOpenByDefault,
82200
82393
  defaultColDef,
82201
82394
  enableGroupEdit: internalTableContext.enableGroupEditAndValidation,
82202
82395
  enableCellTextSelection: internalTableContext.enableCellTextSelection,
@@ -83630,6 +83823,7 @@ var LocationQuickFilterOverlay = React76__default.default.forwardRef(
83630
83823
  enableSublocations,
83631
83824
  selectState,
83632
83825
  options,
83826
+ disabledOptions,
83633
83827
  columnDefinition,
83634
83828
  value
83635
83829
  }, ref) => {
@@ -83657,6 +83851,7 @@ var LocationQuickFilterOverlay = React76__default.default.forwardRef(
83657
83851
  return onSelectAll();
83658
83852
  }
83659
83853
  if (selection.item.id === includeSublocationOption.id) {
83854
+ _onSelect(selection);
83660
83855
  return onSelectSublocations();
83661
83856
  }
83662
83857
  return _onSelect(selection);
@@ -83726,8 +83921,9 @@ var LocationQuickFilterOverlay = React76__default.default.forwardRef(
83726
83921
  {
83727
83922
  key: getId3(item),
83728
83923
  item,
83729
- selected: value.map(({ id }) => id).includes(getId3(item)),
83730
- suggested: i === 0
83924
+ selected: value.map(({ id }) => id).includes(getId3(item)) || disabledOptions.map(({ id }) => id).includes(getId3(item)),
83925
+ suggested: i === 0,
83926
+ disabled: disabledOptions.map(({ id }) => id).includes(getId3(item))
83731
83927
  },
83732
83928
  getLabel3(item)
83733
83929
  );
@@ -83773,10 +83969,23 @@ var LocationQuickFilterRenderer = ({
83773
83969
  const [selectState, setSelectState] = React76__default.default.useState(
83774
83970
  determineSelectedState(value)
83775
83971
  );
83972
+ const [disabledValues, setDisabledValues] = React76__default.default.useState([]);
83776
83973
  const [enableSublocations, setEnableSublocations] = React76__default.default.useState(false);
83777
83974
  const onSelectSublocations = React76__default.default.useCallback(() => {
83975
+ if (enableSublocations) {
83976
+ setDisabledValues([]);
83977
+ } else {
83978
+ const newDisabledValues = [];
83979
+ value.forEach((location) => {
83980
+ newDisabledValues.push(...findSublocations(location));
83981
+ });
83982
+ const uniqDisabledValues = ramda.uniqBy(ramda.prop("id"), newDisabledValues).filter(
83983
+ ({ id }) => !selectedValueIds.includes(id)
83984
+ );
83985
+ setDisabledValues(uniqDisabledValues);
83986
+ }
83778
83987
  setEnableSublocations(!enableSublocations);
83779
- }, [enableSublocations]);
83988
+ }, [enableSublocations, value, selectedValueIds, options]);
83780
83989
  const onSelectAll = React76__default.default.useCallback(() => {
83781
83990
  if (selectState === "none" || selectState === "partial") {
83782
83991
  setSelectState("all");
@@ -83790,22 +83999,51 @@ var LocationQuickFilterRenderer = ({
83790
83999
  }
83791
84000
  }, [options, selectState, selectedValueIds]);
83792
84001
  const onSelect = (selection) => {
83793
- if (selection.item.id === "select_all" || selection.item.id === "include_sublocations") {
84002
+ if (selection.item.id === "select_all") {
83794
84003
  return;
83795
84004
  }
83796
- let newSelections = selectedValueIds.includes(getId3(selection.item)) ? removeSelections(selection.item, value) : [...value, ...handleSelectSublocations(selection.item), selection.item];
84005
+ if (selection.item.id === "include_sublocations") {
84006
+ return onChange(
84007
+ value.map((item) => ({
84008
+ ...item,
84009
+ sublocations: enableSublocations ? [] : findSublocations(item)
84010
+ }))
84011
+ );
84012
+ }
84013
+ let newSelections = [];
84014
+ if (selectedValueIds.includes(getId3(selection.item))) {
84015
+ newSelections = removeSelections(selection.item, value);
84016
+ } else {
84017
+ newSelections = [...value, selection.item];
84018
+ const sublocationsToDisable = handleSelectSublocations(selection.item);
84019
+ const newDisabledValues = [
84020
+ ...disabledValues,
84021
+ ...sublocationsToDisable.filter(
84022
+ ({ id }) => !selectedValueIds.includes(id)
84023
+ )
84024
+ ];
84025
+ setDisabledValues(newDisabledValues);
84026
+ }
83797
84027
  setSelectState(determineSelectedState(newSelections));
83798
84028
  setSelectedValueIds(newSelections.map(({ id }) => id));
83799
- onChange(newSelections);
84029
+ onChange(
84030
+ newSelections.map((item) => ({
84031
+ ...item,
84032
+ sublocations: handleSelectSublocations(item)
84033
+ }))
84034
+ );
84035
+ };
84036
+ const findSublocations = (selected) => {
84037
+ return options.filter((option) => {
84038
+ return ramda.startsWith(
84039
+ `${getLabel3(selected).toLowerCase()} > `,
84040
+ getLabel3(option).toLowerCase()
84041
+ );
84042
+ });
83800
84043
  };
83801
84044
  const handleSelectSublocations = (selected) => {
83802
84045
  if (enableSublocations) {
83803
- const filteredOptions = options.filter((option) => {
83804
- return ramda.startsWith(
83805
- `${getLabel3(selected).toLowerCase()} > `,
83806
- getLabel3(option).toLowerCase()
83807
- );
83808
- });
84046
+ const filteredOptions = findSublocations(selected);
83809
84047
  return filteredOptions;
83810
84048
  } else {
83811
84049
  return [];
@@ -83814,13 +84052,16 @@ var LocationQuickFilterRenderer = ({
83814
84052
  const removeSelections = React76__default.default.useCallback(
83815
84053
  function(selection, selected) {
83816
84054
  const sublocations = handleSelectSublocations(selection);
83817
- return enableSublocations ? selected.filter(
83818
- (item) => ![...sublocations.map(({ id }) => id), getId3(selection)].includes(
83819
- item.id
84055
+ const disabledValueIds = disabledValues.map(({ id }) => id);
84056
+ const sublocationsToRemoveFromDisabledIds = sublocations.filter(({ id }) => disabledValueIds.includes(id)).map(({ id }) => id);
84057
+ setDisabledValues(
84058
+ disabledValues.filter(
84059
+ ({ id }) => !sublocationsToRemoveFromDisabledIds.includes(id)
83820
84060
  )
83821
- ) : selected.filter((item) => getId3(item) !== getId3(selection));
84061
+ );
84062
+ return selected.filter((item) => getId3(item) !== getId3(selection));
83822
84063
  },
83823
- [enableSublocations]
84064
+ [enableSublocations, disabledValues]
83824
84065
  );
83825
84066
  React76__default.default.useEffect(() => {
83826
84067
  setSelectState(determineSelectedState(value));
@@ -83835,6 +84076,7 @@ var LocationQuickFilterRenderer = ({
83835
84076
  selectState,
83836
84077
  value,
83837
84078
  options,
84079
+ disabledOptions: disabledValues,
83838
84080
  getId: getId3,
83839
84081
  getLabel: getLabel3,
83840
84082
  loading,
@@ -792,6 +792,10 @@ interface DataTableConfig {
792
792
  } | undefined;
793
793
  rowHeight?: RowSize;
794
794
  serverFilters?: IServerFilter[];
795
+ groupRowState?: {
796
+ expandedRoutes: string[];
797
+ collapsedRoutes: string[];
798
+ };
795
799
  }
796
800
  interface HTMLStringExportConfig {
797
801
  header?: React.FunctionComponent;
@@ -1175,6 +1179,7 @@ interface LocationOption {
1175
1179
  label?: string;
1176
1180
  name?: string;
1177
1181
  id: string | number;
1182
+ sublocations?: Omit<LocationOption, 'sublocations'>[];
1178
1183
  }
1179
1184
  declare const LocationFilterRenderer: (props: LocationFilterProps) => React__default.JSX.Element | null;
1180
1185
 
@@ -1307,6 +1312,7 @@ interface InternalTableContext {
1307
1312
  onBulkEditUpdate: DataTableProps['onBulkEditUpdate'];
1308
1313
  onServerSideDataRequest?: DataTableProps['onServerSideDataRequest'];
1309
1314
  updateServerSideDataSource: (params: UpdateServerSideDataSourceParams) => void;
1315
+ localStoragePersistenceKey?: string;
1310
1316
  onTableConfigChange: () => void;
1311
1317
  rowHeight: RowSize;
1312
1318
  rowSelectionRef?: React__default.MutableRefObject<RowSelectionRef>;
@@ -1316,6 +1322,10 @@ interface InternalTableContext {
1316
1322
  setGridApi: (gridApi: GridApi) => void;
1317
1323
  setRowHeight: (rowHeight: RowSize, createTrackEvent?: boolean, triggerTableConfigChange?: boolean) => void;
1318
1324
  showExpandCollapseAllToggle: boolean;
1325
+ expandCollapseStateRef: React__default.MutableRefObject<{
1326
+ expandedRoutes: string[];
1327
+ collapsedRoutes: string[];
1328
+ }> | null;
1319
1329
  tableRef: React__default.RefObject<TableApi> | null;
1320
1330
  getColumnDefinition: (field: string) => ColumnDefinition | undefined;
1321
1331
  totalRowCount: number;