@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.
@@ -12818,8 +12818,8 @@ var GridOptionsValidator = class GridOptionsValidator2 {
12818
12818
  enterMovesDownAfterEdit: { version: "30", newProp: "enterNavigatesVerticallyAfterEdit", copyToNewProp: true }
12819
12819
  };
12820
12820
  }
12821
- pickOneWarning(prop1, prop2) {
12822
- console.warn(`AG Grid: ${prop1} and ${prop2} do not work with each other, you need to pick one.`);
12821
+ pickOneWarning(prop1, prop22) {
12822
+ console.warn(`AG Grid: ${prop1} and ${prop22} do not work with each other, you need to pick one.`);
12823
12823
  }
12824
12824
  init() {
12825
12825
  this.checkForDeprecated();
@@ -12841,7 +12841,7 @@ var GridOptionsValidator = class GridOptionsValidator2 {
12841
12841
  this.pickOneWarning("groupRemoveSingleChildren", "groupHideOpenParents");
12842
12842
  }
12843
12843
  if (this.gridOptionsService.isRowModelType("serverSide")) {
12844
- const msg = (prop, alt) => `AG Grid: '${prop}' is not supported on the Server-Side Row Model.` + (alt ? ` Please use ${alt} instead.` : "");
12844
+ const msg = (prop3, alt) => `AG Grid: '${prop3}' is not supported on the Server-Side Row Model.` + (alt ? ` Please use ${alt} instead.` : "");
12845
12845
  if (this.gridOptionsService.exists("groupDefaultExpanded")) {
12846
12846
  console.warn(msg("groupDefaultExpanded", "isServerSideGroupOpenByDefault callback"));
12847
12847
  }
@@ -12857,7 +12857,7 @@ var GridOptionsValidator = class GridOptionsValidator2 {
12857
12857
  } else if (this.gridOptionsService.is("enableRangeHandle") || this.gridOptionsService.is("enableFillHandle")) {
12858
12858
  console.warn("AG Grid: 'enableRangeHandle' or 'enableFillHandle' will not work unless 'enableRangeSelection' is set to true");
12859
12859
  }
12860
- const validateRegistered = (prop, module) => this.gridOptionsService.exists(prop) && ModuleRegistry.__assertRegistered(module, prop, this.gridOptionsService.getGridId());
12860
+ const validateRegistered = (prop3, module) => this.gridOptionsService.exists(prop3) && ModuleRegistry.__assertRegistered(module, prop3, this.gridOptionsService.getGridId());
12861
12861
  validateRegistered("sideBar", ModuleNames.SideBarModule);
12862
12862
  validateRegistered("statusBar", ModuleNames.StatusBarModule);
12863
12863
  validateRegistered("enableCharts", ModuleNames.GridChartsModule);
@@ -52181,15 +52181,15 @@ var DataTypeService = class DataTypeService2 extends BeanStub {
52181
52181
  ["valueGetter", void 0],
52182
52182
  ["valueParser", void 0],
52183
52183
  ["refData", void 0]
52184
- ].some(([prop, comparisonValue]) => this.doesColDefPropPreventInference(colDef, propsToCheckForInference, prop, comparisonValue));
52184
+ ].some(([prop3, comparisonValue]) => this.doesColDefPropPreventInference(colDef, propsToCheckForInference, prop3, comparisonValue));
52185
52185
  }
52186
- doesColDefPropPreventInference(colDef, checkProps, prop, comparisonValue) {
52187
- if (!checkProps[prop]) {
52186
+ doesColDefPropPreventInference(colDef, checkProps, prop3, comparisonValue) {
52187
+ if (!checkProps[prop3]) {
52188
52188
  return false;
52189
52189
  }
52190
- const value = colDef[prop];
52190
+ const value = colDef[prop3];
52191
52191
  if (value === null) {
52192
- checkProps[prop] = false;
52192
+ checkProps[prop3] = false;
52193
52193
  return false;
52194
52194
  } else {
52195
52195
  return comparisonValue === void 0 ? !!value : value === comparisonValue;
@@ -53436,7 +53436,7 @@ var Renderer9 = ({
53436
53436
  if (isGroup || rowPinned && columnDefinition.aggFunc) {
53437
53437
  return /* @__PURE__ */ React76__default.default.createElement(coreReact.Typography, { ...typographyProps, weight: "semibold" }, label);
53438
53438
  }
53439
- return /* @__PURE__ */ React76__default.default.createElement(coreReact.Pill, { color: getColor(value), className: cx10("pill-cell") }, label == null ? void 0 : label.toUpperCase());
53439
+ return /* @__PURE__ */ React76__default.default.createElement(coreReact.Pill, { color: getColor(value), className: cx10("pill-cell") }, label);
53440
53440
  };
53441
53441
  var PillCellRenderer = withDataTableRenderer(Renderer9, "select");
53442
53442
  var Editor5 = React76__default.default.forwardRef(
@@ -53473,7 +53473,7 @@ var Editor5 = React76__default.default.forwardRef(
53473
53473
  function getLabel3(item) {
53474
53474
  var _a2;
53475
53475
  const unformattedLabel = ((_a2 = columnDefinition.getStringFormattedValue) == null ? void 0 : _a2.call(columnDefinition, item)) || "";
53476
- return unformattedLabel.toUpperCase();
53476
+ return unformattedLabel;
53477
53477
  }
53478
53478
  return /* @__PURE__ */ React76__default.default.createElement(
53479
53479
  coreReact.PillSelect,
@@ -53877,6 +53877,7 @@ var LocationFilterOverlay = React76__default.default.forwardRef(
53877
53877
  enableSublocations,
53878
53878
  selectState,
53879
53879
  options,
53880
+ disabledOptions,
53880
53881
  columnDefinition,
53881
53882
  value
53882
53883
  }, ref) => {
@@ -53898,6 +53899,7 @@ var LocationFilterOverlay = React76__default.default.forwardRef(
53898
53899
  return onSelectAll();
53899
53900
  }
53900
53901
  if (selection.item.id === includeSublocationOption.id) {
53902
+ _onSelect(selection);
53901
53903
  return onSelectSublocations();
53902
53904
  }
53903
53905
  return _onSelect(selection);
@@ -53968,8 +53970,9 @@ var LocationFilterOverlay = React76__default.default.forwardRef(
53968
53970
  {
53969
53971
  key: getId3(item),
53970
53972
  item,
53971
- selected: value.map(({ id }) => id).includes(getId3(item)),
53972
- suggested: i === 0
53973
+ selected: value.map(({ id }) => id).includes(getId3(item)) || disabledOptions.map(({ id }) => id).includes(getId3(item)),
53974
+ suggested: i === 0,
53975
+ disabled: disabledOptions.map(({ id }) => id).includes(getId3(item))
53973
53976
  },
53974
53977
  getLabel3(item)
53975
53978
  );
@@ -54000,10 +54003,23 @@ var ServerSideLocationFilterRenderer = React76__default.default.forwardRef(
54000
54003
  const [selectState, setSelectState] = React76__default.default.useState(
54001
54004
  determineSelectedState(value)
54002
54005
  );
54006
+ const [disabledValues, setDisabledValues] = React76__default.default.useState([]);
54003
54007
  const [enableSublocations, setEnableSublocations] = React76__default.default.useState(false);
54004
54008
  const onSelectSublocations = React76__default.default.useCallback(() => {
54009
+ if (enableSublocations) {
54010
+ setDisabledValues([]);
54011
+ } else {
54012
+ const newDisabledValues = [];
54013
+ value.forEach((location) => {
54014
+ newDisabledValues.push(...findSublocations(location));
54015
+ });
54016
+ const uniqDisabledValues = ramda.uniqBy(ramda.prop("id"), newDisabledValues).filter(
54017
+ ({ id }) => !selectedValueIds.includes(id)
54018
+ );
54019
+ setDisabledValues(uniqDisabledValues);
54020
+ }
54005
54021
  setEnableSublocations(!enableSublocations);
54006
- }, [enableSublocations]);
54022
+ }, [enableSublocations, value, selectedValueIds, options]);
54007
54023
  const I18n = coreReact.useI18nContext();
54008
54024
  const selectRef = React76__default.default.useRef(null);
54009
54025
  const onSelectAll = React76__default.default.useCallback(() => {
@@ -54019,17 +54035,47 @@ var ServerSideLocationFilterRenderer = React76__default.default.forwardRef(
54019
54035
  }
54020
54036
  }, [options, selectState, selectedValueIds]);
54021
54037
  const onSelect = (selection) => {
54022
- if (selection.item.id === "select_all" || selection.item.id === "include_sublocations") {
54038
+ if (selection.item.id === "select_all") {
54023
54039
  return;
54024
54040
  }
54025
- let newSelections = selectedValueIds.includes(getId3(selection.item)) ? removeSelections(selection.item, value) : [
54026
- ...value,
54027
- ...handleSelectSublocations(selection.item),
54028
- selection.item
54029
- ];
54041
+ if (selection.item.id === "include_sublocations") {
54042
+ return onChange(
54043
+ value.map((item) => ({
54044
+ ...item,
54045
+ sublocations: enableSublocations ? [] : findSublocations(item)
54046
+ }))
54047
+ );
54048
+ }
54049
+ let newSelections = [];
54050
+ if (selectedValueIds.includes(getId3(selection.item))) {
54051
+ newSelections = removeSelections(selection.item, value);
54052
+ } else {
54053
+ newSelections = [...value, selection.item];
54054
+ const sublocationsToDisable = handleSelectSublocations(selection.item);
54055
+ const newDisabledValues = [
54056
+ ...disabledValues,
54057
+ ...sublocationsToDisable.filter(
54058
+ ({ id }) => !selectedValueIds.includes(id)
54059
+ )
54060
+ ];
54061
+ setDisabledValues(newDisabledValues);
54062
+ }
54030
54063
  setSelectState(determineSelectedState(newSelections));
54031
54064
  setSelectedValueIds(newSelections.map(({ id }) => id));
54032
- onChange(newSelections);
54065
+ onChange(
54066
+ newSelections.map((item) => ({
54067
+ ...item,
54068
+ sublocations: handleSelectSublocations(item)
54069
+ }))
54070
+ );
54071
+ };
54072
+ const findSublocations = (selected) => {
54073
+ return options.filter((option) => {
54074
+ return ramda.startsWith(
54075
+ `${getLabel3(selected).toLowerCase()} > `,
54076
+ getLabel3(option).toLowerCase()
54077
+ );
54078
+ });
54033
54079
  };
54034
54080
  const handleSelectSublocations = (selected) => {
54035
54081
  if (enableSublocations) {
@@ -54047,14 +54093,16 @@ var ServerSideLocationFilterRenderer = React76__default.default.forwardRef(
54047
54093
  const removeSelections = React76__default.default.useCallback(
54048
54094
  function(selection, selected) {
54049
54095
  const sublocations = handleSelectSublocations(selection);
54050
- return enableSublocations ? selected.filter(
54051
- (item) => ![
54052
- ...sublocations.map(({ id }) => id),
54053
- getId3(selection)
54054
- ].includes(item.id)
54055
- ) : selected.filter((item) => getId3(item) !== getId3(selection));
54096
+ const disabledValueIds = disabledValues.map(({ id }) => id);
54097
+ const sublocationsToRemoveFromDisabledIds = sublocations.filter(({ id }) => disabledValueIds.includes(id)).map(({ id }) => id);
54098
+ setDisabledValues(
54099
+ disabledValues.filter(
54100
+ ({ id }) => !sublocationsToRemoveFromDisabledIds.includes(id)
54101
+ )
54102
+ );
54103
+ return selected.filter((item) => getId3(item) !== getId3(selection));
54056
54104
  },
54057
- [enableSublocations]
54105
+ [enableSublocations, disabledValues]
54058
54106
  );
54059
54107
  React76__default.default.useEffect(() => {
54060
54108
  setSelectState(determineSelectedState(value));
@@ -54065,6 +54113,7 @@ var ServerSideLocationFilterRenderer = React76__default.default.forwardRef(
54065
54113
  columnDefinition,
54066
54114
  value,
54067
54115
  options,
54116
+ disabledOptions: disabledValues,
54068
54117
  enableSublocations,
54069
54118
  getId: getId3,
54070
54119
  getLabel: getLabel3,
@@ -56576,9 +56625,10 @@ var GenericHeaderRenderer = (props) => {
56576
56625
  props.api.addEventListener("columnRowGroupChanged", updateExpandedState);
56577
56626
  return () => {
56578
56627
  props.column.removeEventListener("sortChanged", onSortChanged);
56579
- props.api.removeEventListener(
56628
+ removeEventListenerFromGrid(
56580
56629
  "columnRowGroupChanged",
56581
- updateExpandedState
56630
+ updateExpandedState,
56631
+ props.api
56582
56632
  );
56583
56633
  };
56584
56634
  }, [props.column]);
@@ -57673,6 +57723,7 @@ var InternalTableContext = React76__default.default.createContext({
57673
57723
  getRowHeight: () => () => rowSize.md,
57674
57724
  grandTotalsLabelInnerRenderer: void 0,
57675
57725
  gridApi: void 0,
57726
+ localStoragePersistenceKey: void 0,
57676
57727
  onBulkEditUpdate: () => Promise.resolve(),
57677
57728
  onServerSideDataRequest: void 0,
57678
57729
  onTableConfigChange: () => {
@@ -57689,6 +57740,7 @@ var InternalTableContext = React76__default.default.createContext({
57689
57740
  setRowHeight: () => {
57690
57741
  },
57691
57742
  showExpandCollapseAllToggle: false,
57743
+ expandCollapseStateRef: null,
57692
57744
  tableRef: null,
57693
57745
  getColumnDefinition: () => void 0,
57694
57746
  setSelectedGroupIndex: () => {
@@ -78136,6 +78188,63 @@ var buildDetailRowsConfig_ = (detailRowConfig, {
78136
78188
  };
78137
78189
  };
78138
78190
 
78191
+ // src/utils/expandRows.ts
78192
+ var getGroupRowState = (gridApi, groupDefaultExpanded = 0) => {
78193
+ const expandedRoutes = [];
78194
+ const collapsedRoutes = [];
78195
+ if (gridApi) {
78196
+ gridApi.forEachNode((node) => {
78197
+ const route = node.getRoute();
78198
+ if (route) {
78199
+ const routePath = route.join(",");
78200
+ const defaultExpandLevel = groupDefaultExpanded === -1 ? Infinity : groupDefaultExpanded;
78201
+ if (node.level > defaultExpandLevel - 1) {
78202
+ if (node.expanded) {
78203
+ expandedRoutes.push(routePath);
78204
+ }
78205
+ } else if (!node.expanded) {
78206
+ collapsedRoutes.push(routePath);
78207
+ }
78208
+ }
78209
+ });
78210
+ }
78211
+ return { expandedRoutes, collapsedRoutes };
78212
+ };
78213
+ var setExpandCollapseRow = (gridApi, tableConfig, groupDefaultExpanded = 0) => {
78214
+ var _a, _b;
78215
+ const expandedRoutes = ((_a = tableConfig.groupRowState) == null ? void 0 : _a.expandedRoutes) ?? [];
78216
+ const collapsedRoutes = ((_b = tableConfig.groupRowState) == null ? void 0 : _b.collapsedRoutes) ?? [];
78217
+ gridApi.forEachNode((node) => {
78218
+ const route = node.getRoute();
78219
+ if (route) {
78220
+ const routePath = route.join(",");
78221
+ const defaultExpandLevel = groupDefaultExpanded === -1 ? Infinity : groupDefaultExpanded;
78222
+ if (node.level > defaultExpandLevel - 1) {
78223
+ if (expandedRoutes.includes(routePath)) {
78224
+ node.setExpanded(true);
78225
+ }
78226
+ } else if (collapsedRoutes.includes(routePath)) {
78227
+ node.setExpanded(false);
78228
+ }
78229
+ }
78230
+ });
78231
+ };
78232
+ var isRowOpenedByDefault = (node, tableConfig, groupDefaultExpanded = 0) => {
78233
+ var _a, _b;
78234
+ const expandedRoutes = ((_a = tableConfig == null ? void 0 : tableConfig.groupRowState) == null ? void 0 : _a.expandedRoutes) ?? [];
78235
+ const collapsedRoutes = ((_b = tableConfig == null ? void 0 : tableConfig.groupRowState) == null ? void 0 : _b.collapsedRoutes) ?? [];
78236
+ const route = node.getRoute();
78237
+ if (!route) {
78238
+ return false;
78239
+ }
78240
+ const routePath = route.join(",");
78241
+ const defaultExpandLevel = groupDefaultExpanded === -1 ? Infinity : groupDefaultExpanded;
78242
+ if (node.level > defaultExpandLevel - 1) {
78243
+ return expandedRoutes.includes(routePath);
78244
+ } else
78245
+ return !collapsedRoutes.includes(routePath);
78246
+ };
78247
+
78139
78248
  // src/utils/getRootRowNode.ts
78140
78249
  function getRootRowNode(rowNode) {
78141
78250
  return rowNode.level > 0 && rowNode.parent ? getRootRowNode(rowNode.parent) : rowNode;
@@ -79810,6 +79919,11 @@ var ja_JP_default = {
79810
79919
  }
79811
79920
  };
79812
79921
 
79922
+ // src/locales/pl-PL.json
79923
+ var pl_PL_default = {
79924
+ dataTable: {}
79925
+ };
79926
+
79813
79927
  // src/locales/pseudo.json
79814
79928
  var pseudo_default = {
79815
79929
  dataTable: {
@@ -80426,7 +80540,8 @@ var translations = {
80426
80540
  pseudo: pseudo_default,
80427
80541
  "pt-BR": pt_BR_default,
80428
80542
  "th-TH": th_TH_default,
80429
- "zh-SG": zh_SG_default
80543
+ "zh-SG": zh_SG_default,
80544
+ "pl-PL": pl_PL_default
80430
80545
  };
80431
80546
  var PRINCE_XML_DPI = 96;
80432
80547
  var DEFAULT_PAGE_MARGIN = 40;
@@ -80652,6 +80767,7 @@ var useTableApi = ({
80652
80767
  columnApi,
80653
80768
  columnDefinitions,
80654
80769
  gridApi,
80770
+ groupDefaultExpanded,
80655
80771
  setLoadingStatus,
80656
80772
  wrapperRef
80657
80773
  }) => {
@@ -80845,10 +80961,33 @@ var useTableApi = ({
80845
80961
  const setSearchValue = React76__default.default.useCallback(
80846
80962
  (value) => {
80847
80963
  gridApi == null ? void 0 : gridApi.setQuickFilter(value);
80964
+ gridApi == null ? void 0 : gridApi.forEachNodeAfterFilterAndSort((node) => {
80965
+ if (node.id) {
80966
+ const currentNode = rowSelectionRef == null ? void 0 : rowSelectionRef.current.affectedRows[node.id];
80967
+ if (currentNode && currentNode.selectedState === rowSelectionState.selected) {
80968
+ node.setSelected(true, false, "checkboxSelected");
80969
+ }
80970
+ }
80971
+ });
80848
80972
  resetPagination();
80973
+ gridApi == null ? void 0 : gridApi.redrawRows();
80849
80974
  },
80850
- [gridApi]
80975
+ [gridApi, rowSelectionRef.current]
80851
80976
  );
80977
+ React76__default.default.useEffect(() => {
80978
+ function handleRowSelection(event) {
80979
+ if (event.node.displayed && event.node.id) {
80980
+ rowSelectionRef.current.affectedRows[event.node.id] = {
80981
+ node: event.node,
80982
+ selectedState: event.node.isSelected() ? rowSelectionState.selected : rowSelectionState.unselected
80983
+ };
80984
+ }
80985
+ }
80986
+ (gridApi == null ? void 0 : gridApi.addEventListener) && gridApi.addEventListener("rowSelected", handleRowSelection);
80987
+ return () => {
80988
+ removeEventListenerFromGrid("rowSelected", handleRowSelection, gridApi);
80989
+ };
80990
+ }, [gridApi]);
80852
80991
  const setLoading = React76__default.default.useCallback((loading, message = "") => {
80853
80992
  setLoadingStatus({
80854
80993
  loading,
@@ -80910,6 +81049,7 @@ var useTableApi = ({
80910
81049
  adjustRowDragIcon(gridApi, columnApi);
80911
81050
  });
80912
81051
  }
81052
+ setExpandCollapseRow(gridApi, config, groupDefaultExpanded);
80913
81053
  },
80914
81054
  [columnApi, gridApi, internalSetRowHeight, filterStorage.setSelectedFilters]
80915
81055
  );
@@ -81003,7 +81143,8 @@ var useTableApi = ({
81003
81143
  columnApi,
81004
81144
  rowHeight,
81005
81145
  filterStorage,
81006
- rowSelectionRef
81146
+ rowSelectionRef,
81147
+ groupDefaultExpanded
81007
81148
  }),
81008
81149
  [columnApi, gridApi, rowHeight, filterStorage]
81009
81150
  );
@@ -81277,7 +81418,6 @@ function buildPartialTableApi({
81277
81418
  focusField && (gridApi == null ? void 0 : gridApi.setFocusedCell(rowIndex, focusField));
81278
81419
  };
81279
81420
  return {
81280
- getVisibleRowNodes,
81281
81421
  applyTransaction,
81282
81422
  applyServerSideTransaction,
81283
81423
  collapseAll,
@@ -81292,6 +81432,7 @@ function buildPartialTableApi({
81292
81432
  getSelectedRows: getSelectedRows2,
81293
81433
  getServerSideSelectionState,
81294
81434
  getTableConfiguration,
81435
+ getVisibleRowNodes,
81295
81436
  refreshCells,
81296
81437
  setPinnedBottomRowData,
81297
81438
  setRowData,
@@ -81409,6 +81550,12 @@ var DataTable = ({
81409
81550
  const [rowHeight, setRowHeight] = React76__default.default.useState(
81410
81551
  (initialTableConfig == null ? void 0 : initialTableConfig.rowHeight) || rowSize.md
81411
81552
  );
81553
+ const expandCollapseStateRef = React76__default.default.useRef(
81554
+ (initialTableConfig == null ? void 0 : initialTableConfig.groupRowState) || {
81555
+ expandedRoutes: [],
81556
+ collapsedRoutes: []
81557
+ }
81558
+ );
81412
81559
  const rowHeightRef = React76__default.default.useRef(
81413
81560
  (initialTableConfig == null ? void 0 : initialTableConfig.rowHeight) || rowSize.md
81414
81561
  );
@@ -81456,12 +81603,14 @@ var DataTable = ({
81456
81603
  if (localStoragePersistenceKey) {
81457
81604
  webSdkStorage.storage.local.setItem(localStoragePersistenceKey, {
81458
81605
  ...config,
81606
+ groupRowState: expandCollapseStateRef.current,
81459
81607
  rowHeight: rowHeightRef.current,
81460
81608
  serverFilters: filterStorage.filtersState
81461
81609
  });
81462
81610
  }
81463
81611
  onTableConfigChange == null ? void 0 : onTableConfigChange({
81464
81612
  ...config,
81613
+ groupRowState: expandCollapseStateRef.current,
81465
81614
  rowHeight: rowHeightRef.current,
81466
81615
  serverFilters: filterStorage.filtersState
81467
81616
  });
@@ -81572,6 +81721,7 @@ var DataTable = ({
81572
81721
  onServerSideDataRequest,
81573
81722
  onTableConfigChange: internalOnTableConfigChange,
81574
81723
  rowSelectionRef,
81724
+ expandCollapseStateRef,
81575
81725
  rowHeight,
81576
81726
  searchStorage,
81577
81727
  selectedGroupIndex,
@@ -81632,7 +81782,7 @@ function getServerSideDatasource(onServerSideDataRequestCallbackRef, onEmptyResp
81632
81782
  }
81633
81783
  var minimumColumnWidth = 140;
81634
81784
  var Table = (props) => {
81635
- var _a, _b;
81785
+ var _a, _b, _c;
81636
81786
  const { suppressColumnVirtualisation = true, rowActionsConfig = {} } = props;
81637
81787
  const I18n = coreReact.useI18nContext();
81638
81788
  const internalTableContext = useInternalTableContext();
@@ -81674,8 +81824,10 @@ var Table = (props) => {
81674
81824
  columnDefinitions: internalTableContext.columnDefinitions,
81675
81825
  gridApi,
81676
81826
  setLoadingStatus,
81677
- wrapperRef
81827
+ wrapperRef,
81828
+ groupDefaultExpanded: props.groupDefaultExpanded
81678
81829
  });
81830
+ const initialTableConfig = internalTableContext.initialTableConfig;
81679
81831
  React76__default.default.useImperativeHandle(internalTableContext.tableRef, () => tableApi, [
81680
81832
  tableApi
81681
81833
  ]);
@@ -81989,8 +82141,8 @@ var Table = (props) => {
81989
82141
  );
81990
82142
  const onColumnGroupOpened = React76__default.default.useCallback(
81991
82143
  (event) => {
81992
- var _a2, _b2, _c;
81993
- (_c = internalTableContext.analytics) == null ? void 0 : _c.client.addEvent(
82144
+ var _a2, _b2, _c2;
82145
+ (_c2 = internalTableContext.analytics) == null ? void 0 : _c2.client.addEvent(
81994
82146
  "design_system.data_table.column.expand_toggled",
81995
82147
  {
81996
82148
  client: internalTableContext.analytics.clientName,
@@ -82007,14 +82159,14 @@ var Table = (props) => {
82007
82159
  );
82008
82160
  const onColumnPinned = React76__default.default.useCallback(
82009
82161
  (event) => {
82010
- var _a2, _b2, _c, _d;
82162
+ var _a2, _b2, _c2, _d;
82011
82163
  (_d = internalTableContext.analytics) == null ? void 0 : _d.client.addEvent(
82012
82164
  "design_system.data_table.column.pinned",
82013
82165
  {
82014
82166
  client: internalTableContext.analytics.clientName,
82015
82167
  column: (_a2 = event.column) == null ? void 0 : _a2.getColId(),
82016
82168
  side: (_b2 = event.column) == null ? void 0 : _b2.getPinned(),
82017
- position: (_c = columnApi == null ? void 0 : columnApi.getColumns()) == null ? void 0 : _c.findIndex(
82169
+ position: (_c2 = columnApi == null ? void 0 : columnApi.getColumns()) == null ? void 0 : _c2.findIndex(
82018
82170
  (col) => {
82019
82171
  var _a3;
82020
82172
  return col.getId() === ((_a3 = event.column) == null ? void 0 : _a3.getColId());
@@ -82113,7 +82265,7 @@ var Table = (props) => {
82113
82265
  const onDragStopped = React76__default.default.useCallback(
82114
82266
  // eslint-disable-next-line complexity
82115
82267
  (event) => {
82116
- var _a2, _b2, _c;
82268
+ var _a2, _b2, _c2;
82117
82269
  if (event.target.className.includes("ag-header-cell")) {
82118
82270
  internalTableContext.onTableConfigChange();
82119
82271
  }
@@ -82131,7 +82283,7 @@ var Table = (props) => {
82131
82283
  const firstVisibleColumnIndex = allColumns.findIndex(
82132
82284
  (col) => col.isVisible()
82133
82285
  );
82134
- if (moveColumnEvent.toIndex === firstVisibleColumnIndex || ((_c = moveColumnEvent.column) == null ? void 0 : _c.getColDef().rowDrag)) {
82286
+ if (moveColumnEvent.toIndex === firstVisibleColumnIndex || ((_c2 = moveColumnEvent.column) == null ? void 0 : _c2.getColDef().rowDrag)) {
82135
82287
  adjustRowDragIcon(event.api, event.columnApi);
82136
82288
  }
82137
82289
  }
@@ -82210,27 +82362,55 @@ var Table = (props) => {
82210
82362
  (_a2 = document.getElementsByClassName("ag-body-viewport")[0]) == null ? void 0 : _a2.clientWidth
82211
82363
  );
82212
82364
  }, [setViewportWidth]);
82365
+ const isClientSideGroupOpenByDefault = React76__default.default.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
+ );
82379
+ const isServerSideGroupOpenByDefault = React76__default.default.useCallback(
82380
+ (params) => {
82381
+ const node = params.rowNode;
82382
+ if (!node) {
82383
+ return false;
82384
+ }
82385
+ return isRowOpenedByDefault(
82386
+ node,
82387
+ initialTableConfig,
82388
+ props.groupsAlwaysExpanded ? -1 : props.groupDefaultExpanded
82389
+ );
82390
+ },
82391
+ [initialTableConfig, props.groupDefaultExpanded]
82392
+ );
82213
82393
  const onGridReady = (params) => {
82214
- var _a2, _b2, _c;
82394
+ var _a2, _b2, _c2;
82215
82395
  internalTableContext.setGridApi(params.api);
82216
82396
  internalTableContext.setColumnApi(params.columnApi);
82217
82397
  setViewportWidth(
82218
82398
  (_a2 = document.getElementsByClassName("ag-body-viewport")[0]) == null ? void 0 : _a2.clientWidth
82219
82399
  );
82220
- (_c = (_b2 = props.UNSAFE_internalAGGridOverrides) == null ? void 0 : _b2.onGridReady) == null ? void 0 : _c.call(_b2, params);
82400
+ (_c2 = (_b2 = props.UNSAFE_internalAGGridOverrides) == null ? void 0 : _b2.onGridReady) == null ? void 0 : _c2.call(_b2, params);
82221
82401
  };
82222
82402
  const postProcessPopup = (params) => {
82223
82403
  params.ePopup.style.top = `${HEADER_HEIGHT}px`;
82224
82404
  };
82225
82405
  const internalOnRowSelected = (event) => {
82226
- var _a2, _b2, _c;
82406
+ var _a2, _b2, _c2;
82227
82407
  (_a2 = props.onRowSelected) == null ? void 0 : _a2.call(props, event);
82228
82408
  if (props.siblingGroupsRowSelectionDisabled) {
82229
82409
  const rootRowNode = getRootRowNode(event.node);
82230
82410
  if (!event.node.isSelected() && internalTableContext.selectedGroupIndex !== null && (rootRowNode == null ? void 0 : rootRowNode.id) === internalTableContext.selectedGroupIndex && event.api.getSelectedNodes().length === 0) {
82231
82411
  (_b2 = internalTableContext == null ? void 0 : internalTableContext.setSelectedGroupIndex) == null ? void 0 : _b2.call(internalTableContext, null);
82232
82412
  } else {
82233
- (_c = internalTableContext == null ? void 0 : internalTableContext.setSelectedGroupIndex) == null ? void 0 : _c.call(internalTableContext, (prevState) => {
82413
+ (_c2 = internalTableContext == null ? void 0 : internalTableContext.setSelectedGroupIndex) == null ? void 0 : _c2.call(internalTableContext, (prevState) => {
82234
82414
  return prevState ?? (rootRowNode == null ? void 0 : rootRowNode.id) ?? null;
82235
82415
  });
82236
82416
  }
@@ -82239,13 +82419,26 @@ var Table = (props) => {
82239
82419
  const internalRowGroupOpened = React76__default.default.useCallback(
82240
82420
  (event) => {
82241
82421
  var _a2;
82422
+ if (internalTableContext.expandCollapseStateRef) {
82423
+ internalTableContext.expandCollapseStateRef.current = getGroupRowState(
82424
+ gridApi,
82425
+ props.groupDefaultExpanded
82426
+ );
82427
+ }
82428
+ internalTableContext.onTableConfigChange();
82242
82429
  (_a2 = props.onRowGroupOpened) == null ? void 0 : _a2.call(props, {
82243
82430
  expanded: event.expanded,
82244
82431
  node: serializeNode(event.node),
82245
82432
  rowIndex: event.rowIndex
82246
82433
  });
82247
82434
  },
82248
- [props.onRowGroupOpened]
82435
+ [
82436
+ props.onRowGroupOpened,
82437
+ internalTableContext.onTableConfigChange,
82438
+ tableApi == null ? void 0 : tableApi.getTableConfiguration(),
82439
+ (_c = internalTableContext.expandCollapseStateRef) == null ? void 0 : _c.current,
82440
+ gridApi
82441
+ ]
82249
82442
  );
82250
82443
  const getGroupRowAgg = React76__default.default.useCallback(
82251
82444
  (params) => {
@@ -82398,6 +82591,8 @@ var Table = (props) => {
82398
82591
  alwaysAggregateAtRootLevel: !onSSDR,
82399
82592
  autoGroupColumnDef: decoratedAutoGroupColDef,
82400
82593
  cacheBlockSize: props.paginationPageSize || defaultPaginationPageSize,
82594
+ isGroupOpenByDefault: isClientSideGroupOpenByDefault,
82595
+ isServerSideGroupOpenByDefault,
82401
82596
  defaultColDef,
82402
82597
  enableGroupEdit: internalTableContext.enableGroupEditAndValidation,
82403
82598
  enableCellTextSelection: internalTableContext.enableCellTextSelection,
@@ -83854,6 +84049,7 @@ var LocationQuickFilterOverlay = React76__default.default.forwardRef(
83854
84049
  enableSublocations,
83855
84050
  selectState,
83856
84051
  options,
84052
+ disabledOptions,
83857
84053
  columnDefinition,
83858
84054
  value
83859
84055
  }, ref) => {
@@ -83881,6 +84077,7 @@ var LocationQuickFilterOverlay = React76__default.default.forwardRef(
83881
84077
  return onSelectAll();
83882
84078
  }
83883
84079
  if (selection.item.id === includeSublocationOption.id) {
84080
+ _onSelect(selection);
83884
84081
  return onSelectSublocations();
83885
84082
  }
83886
84083
  return _onSelect(selection);
@@ -83951,8 +84148,9 @@ var LocationQuickFilterOverlay = React76__default.default.forwardRef(
83951
84148
  {
83952
84149
  key: getId3(item),
83953
84150
  item,
83954
- selected: value.map(({ id }) => id).includes(getId3(item)),
83955
- suggested: i === 0
84151
+ selected: value.map(({ id }) => id).includes(getId3(item)) || disabledOptions.map(({ id }) => id).includes(getId3(item)),
84152
+ suggested: i === 0,
84153
+ disabled: disabledOptions.map(({ id }) => id).includes(getId3(item))
83956
84154
  },
83957
84155
  getLabel3(item)
83958
84156
  );
@@ -83999,10 +84197,23 @@ var LocationQuickFilterRenderer = ({
83999
84197
  const [selectState, setSelectState] = React76__default.default.useState(
84000
84198
  determineSelectedState(value)
84001
84199
  );
84200
+ const [disabledValues, setDisabledValues] = React76__default.default.useState([]);
84002
84201
  const [enableSublocations, setEnableSublocations] = React76__default.default.useState(false);
84003
84202
  const onSelectSublocations = React76__default.default.useCallback(() => {
84203
+ if (enableSublocations) {
84204
+ setDisabledValues([]);
84205
+ } else {
84206
+ const newDisabledValues = [];
84207
+ value.forEach((location) => {
84208
+ newDisabledValues.push(...findSublocations(location));
84209
+ });
84210
+ const uniqDisabledValues = ramda.uniqBy(ramda.prop("id"), newDisabledValues).filter(
84211
+ ({ id }) => !selectedValueIds.includes(id)
84212
+ );
84213
+ setDisabledValues(uniqDisabledValues);
84214
+ }
84004
84215
  setEnableSublocations(!enableSublocations);
84005
- }, [enableSublocations]);
84216
+ }, [enableSublocations, value, selectedValueIds, options]);
84006
84217
  const onSelectAll = React76__default.default.useCallback(() => {
84007
84218
  if (selectState === "none" || selectState === "partial") {
84008
84219
  setSelectState("all");
@@ -84016,22 +84227,51 @@ var LocationQuickFilterRenderer = ({
84016
84227
  }
84017
84228
  }, [options, selectState, selectedValueIds]);
84018
84229
  const onSelect = (selection) => {
84019
- if (selection.item.id === "select_all" || selection.item.id === "include_sublocations") {
84230
+ if (selection.item.id === "select_all") {
84020
84231
  return;
84021
84232
  }
84022
- let newSelections = selectedValueIds.includes(getId3(selection.item)) ? removeSelections(selection.item, value) : [...value, ...handleSelectSublocations(selection.item), selection.item];
84233
+ if (selection.item.id === "include_sublocations") {
84234
+ return onChange(
84235
+ value.map((item) => ({
84236
+ ...item,
84237
+ sublocations: enableSublocations ? [] : findSublocations(item)
84238
+ }))
84239
+ );
84240
+ }
84241
+ let newSelections = [];
84242
+ if (selectedValueIds.includes(getId3(selection.item))) {
84243
+ newSelections = removeSelections(selection.item, value);
84244
+ } else {
84245
+ newSelections = [...value, selection.item];
84246
+ const sublocationsToDisable = handleSelectSublocations(selection.item);
84247
+ const newDisabledValues = [
84248
+ ...disabledValues,
84249
+ ...sublocationsToDisable.filter(
84250
+ ({ id }) => !selectedValueIds.includes(id)
84251
+ )
84252
+ ];
84253
+ setDisabledValues(newDisabledValues);
84254
+ }
84023
84255
  setSelectState(determineSelectedState(newSelections));
84024
84256
  setSelectedValueIds(newSelections.map(({ id }) => id));
84025
- onChange(newSelections);
84257
+ onChange(
84258
+ newSelections.map((item) => ({
84259
+ ...item,
84260
+ sublocations: handleSelectSublocations(item)
84261
+ }))
84262
+ );
84263
+ };
84264
+ const findSublocations = (selected) => {
84265
+ return options.filter((option) => {
84266
+ return ramda.startsWith(
84267
+ `${getLabel3(selected).toLowerCase()} > `,
84268
+ getLabel3(option).toLowerCase()
84269
+ );
84270
+ });
84026
84271
  };
84027
84272
  const handleSelectSublocations = (selected) => {
84028
84273
  if (enableSublocations) {
84029
- const filteredOptions = options.filter((option) => {
84030
- return ramda.startsWith(
84031
- `${getLabel3(selected).toLowerCase()} > `,
84032
- getLabel3(option).toLowerCase()
84033
- );
84034
- });
84274
+ const filteredOptions = findSublocations(selected);
84035
84275
  return filteredOptions;
84036
84276
  } else {
84037
84277
  return [];
@@ -84040,13 +84280,16 @@ var LocationQuickFilterRenderer = ({
84040
84280
  const removeSelections = React76__default.default.useCallback(
84041
84281
  function(selection, selected) {
84042
84282
  const sublocations = handleSelectSublocations(selection);
84043
- return enableSublocations ? selected.filter(
84044
- (item) => ![...sublocations.map(({ id }) => id), getId3(selection)].includes(
84045
- item.id
84283
+ const disabledValueIds = disabledValues.map(({ id }) => id);
84284
+ const sublocationsToRemoveFromDisabledIds = sublocations.filter(({ id }) => disabledValueIds.includes(id)).map(({ id }) => id);
84285
+ setDisabledValues(
84286
+ disabledValues.filter(
84287
+ ({ id }) => !sublocationsToRemoveFromDisabledIds.includes(id)
84046
84288
  )
84047
- ) : selected.filter((item) => getId3(item) !== getId3(selection));
84289
+ );
84290
+ return selected.filter((item) => getId3(item) !== getId3(selection));
84048
84291
  },
84049
- [enableSublocations]
84292
+ [enableSublocations, disabledValues]
84050
84293
  );
84051
84294
  React76__default.default.useEffect(() => {
84052
84295
  setSelectState(determineSelectedState(value));
@@ -84061,6 +84304,7 @@ var LocationQuickFilterRenderer = ({
84061
84304
  selectState,
84062
84305
  value,
84063
84306
  options,
84307
+ disabledOptions: disabledValues,
84064
84308
  getId: getId3,
84065
84309
  getLabel: getLabel3,
84066
84310
  loading,