@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.
@@ -1,5 +1,5 @@
1
1
  import React76, { useState, forwardRef, useContext, useRef, useImperativeHandle, useLayoutEffect, useCallback, useMemo, memo, useEffect, Component as Component$1, createElement } from 'react';
2
- import { startsWith, mergeDeepRight, equals, omit, intersection, isNil, mergeDeepLeft, isEmpty, groupBy } from 'ramda';
2
+ import { uniqBy, prop, startsWith, mergeDeepRight, equals, omit, intersection, isNil, mergeDeepLeft, isEmpty, groupBy } from 'ramda';
3
3
  import { useI18nContext, Select, Input, UNSAFE_useOverlayTriggerContext, Card, Flex, Box, SegmentedController, Calendar, useDateTime, OverlayTrigger, isEventSource, DateInput, UNSAFE_isValidYearRange, DateSelect, PillSelect, TextArea, UNSAFE_useMenuImperativeControlNavigation, UNSAFE_Menu, UNSAFE_menuItemsWrapperAttribute, Spinner as Spinner$1, FlexList, Typography, Tooltip, Button, Required, MultiSelect, colors, Form, spacing, Switch, Panel, UNSAFE_StyledFilterTokenLabel, typographyWeights, SelectButton, StyledSelectButton, StyledSelectButtonLabel, StyledButton, StyledSelectArrow, Popover, UNSAFE_StyledSuperSelectTrigger, UNSAFE_StyledSuperSelectLabel, UNSAFE_StyledSuperSelectArrow, DateTimeProvider, useField, Label, UNSAFE_mergeRefs, ContactItem as ContactItem$1, ToggleButton, Link, AvatarStack, Pill, Typeahead, Pagination, UNSAFE_FilterToken, UNSAFE_SuperSelect, Avatar, H3, Checkbox, useI18n, I18nContext, UNSAFE_useSuperSelectContext, DropdownFlyout, useVisibility, StyledDropdownFlyoutLabel, StyledDropdownFlyoutExpandIcon, EmptyState as EmptyState$1 } from '@procore/core-react';
4
4
  import classnames from 'classnames/bind';
5
5
  import debounce5 from 'lodash.debounce';
@@ -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;
@@ -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 == null ? void 0 : label.toUpperCase());
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.toUpperCase();
53462
+ return unformattedLabel;
53463
53463
  }
53464
53464
  return /* @__PURE__ */ React76.createElement(
53465
53465
  PillSelect,
@@ -53863,6 +53863,7 @@ var LocationFilterOverlay = React76.forwardRef(
53863
53863
  enableSublocations,
53864
53864
  selectState,
53865
53865
  options,
53866
+ disabledOptions,
53866
53867
  columnDefinition,
53867
53868
  value
53868
53869
  }, ref) => {
@@ -53884,6 +53885,7 @@ var LocationFilterOverlay = React76.forwardRef(
53884
53885
  return onSelectAll();
53885
53886
  }
53886
53887
  if (selection.item.id === includeSublocationOption.id) {
53888
+ _onSelect(selection);
53887
53889
  return onSelectSublocations();
53888
53890
  }
53889
53891
  return _onSelect(selection);
@@ -53954,8 +53956,9 @@ var LocationFilterOverlay = React76.forwardRef(
53954
53956
  {
53955
53957
  key: getId3(item),
53956
53958
  item,
53957
- selected: value.map(({ id }) => id).includes(getId3(item)),
53958
- suggested: i === 0
53959
+ selected: value.map(({ id }) => id).includes(getId3(item)) || disabledOptions.map(({ id }) => id).includes(getId3(item)),
53960
+ suggested: i === 0,
53961
+ disabled: disabledOptions.map(({ id }) => id).includes(getId3(item))
53959
53962
  },
53960
53963
  getLabel3(item)
53961
53964
  );
@@ -53986,10 +53989,23 @@ var ServerSideLocationFilterRenderer = React76.forwardRef(
53986
53989
  const [selectState, setSelectState] = React76.useState(
53987
53990
  determineSelectedState(value)
53988
53991
  );
53992
+ const [disabledValues, setDisabledValues] = React76.useState([]);
53989
53993
  const [enableSublocations, setEnableSublocations] = React76.useState(false);
53990
53994
  const onSelectSublocations = React76.useCallback(() => {
53995
+ if (enableSublocations) {
53996
+ setDisabledValues([]);
53997
+ } else {
53998
+ const newDisabledValues = [];
53999
+ value.forEach((location) => {
54000
+ newDisabledValues.push(...findSublocations(location));
54001
+ });
54002
+ const uniqDisabledValues = uniqBy(prop("id"), newDisabledValues).filter(
54003
+ ({ id }) => !selectedValueIds.includes(id)
54004
+ );
54005
+ setDisabledValues(uniqDisabledValues);
54006
+ }
53991
54007
  setEnableSublocations(!enableSublocations);
53992
- }, [enableSublocations]);
54008
+ }, [enableSublocations, value, selectedValueIds, options]);
53993
54009
  const I18n = useI18nContext();
53994
54010
  const selectRef = React76.useRef(null);
53995
54011
  const onSelectAll = React76.useCallback(() => {
@@ -54005,17 +54021,47 @@ var ServerSideLocationFilterRenderer = React76.forwardRef(
54005
54021
  }
54006
54022
  }, [options, selectState, selectedValueIds]);
54007
54023
  const onSelect = (selection) => {
54008
- if (selection.item.id === "select_all" || selection.item.id === "include_sublocations") {
54024
+ if (selection.item.id === "select_all") {
54009
54025
  return;
54010
54026
  }
54011
- let newSelections = selectedValueIds.includes(getId3(selection.item)) ? removeSelections(selection.item, value) : [
54012
- ...value,
54013
- ...handleSelectSublocations(selection.item),
54014
- selection.item
54015
- ];
54027
+ if (selection.item.id === "include_sublocations") {
54028
+ return onChange(
54029
+ value.map((item) => ({
54030
+ ...item,
54031
+ sublocations: enableSublocations ? [] : findSublocations(item)
54032
+ }))
54033
+ );
54034
+ }
54035
+ let newSelections = [];
54036
+ if (selectedValueIds.includes(getId3(selection.item))) {
54037
+ newSelections = removeSelections(selection.item, value);
54038
+ } else {
54039
+ newSelections = [...value, selection.item];
54040
+ const sublocationsToDisable = handleSelectSublocations(selection.item);
54041
+ const newDisabledValues = [
54042
+ ...disabledValues,
54043
+ ...sublocationsToDisable.filter(
54044
+ ({ id }) => !selectedValueIds.includes(id)
54045
+ )
54046
+ ];
54047
+ setDisabledValues(newDisabledValues);
54048
+ }
54016
54049
  setSelectState(determineSelectedState(newSelections));
54017
54050
  setSelectedValueIds(newSelections.map(({ id }) => id));
54018
- onChange(newSelections);
54051
+ onChange(
54052
+ newSelections.map((item) => ({
54053
+ ...item,
54054
+ sublocations: handleSelectSublocations(item)
54055
+ }))
54056
+ );
54057
+ };
54058
+ const findSublocations = (selected) => {
54059
+ return options.filter((option) => {
54060
+ return startsWith(
54061
+ `${getLabel3(selected).toLowerCase()} > `,
54062
+ getLabel3(option).toLowerCase()
54063
+ );
54064
+ });
54019
54065
  };
54020
54066
  const handleSelectSublocations = (selected) => {
54021
54067
  if (enableSublocations) {
@@ -54033,14 +54079,16 @@ var ServerSideLocationFilterRenderer = React76.forwardRef(
54033
54079
  const removeSelections = React76.useCallback(
54034
54080
  function(selection, selected) {
54035
54081
  const sublocations = handleSelectSublocations(selection);
54036
- return enableSublocations ? selected.filter(
54037
- (item) => ![
54038
- ...sublocations.map(({ id }) => id),
54039
- getId3(selection)
54040
- ].includes(item.id)
54041
- ) : selected.filter((item) => getId3(item) !== getId3(selection));
54082
+ const disabledValueIds = disabledValues.map(({ id }) => id);
54083
+ const sublocationsToRemoveFromDisabledIds = sublocations.filter(({ id }) => disabledValueIds.includes(id)).map(({ id }) => id);
54084
+ setDisabledValues(
54085
+ disabledValues.filter(
54086
+ ({ id }) => !sublocationsToRemoveFromDisabledIds.includes(id)
54087
+ )
54088
+ );
54089
+ return selected.filter((item) => getId3(item) !== getId3(selection));
54042
54090
  },
54043
- [enableSublocations]
54091
+ [enableSublocations, disabledValues]
54044
54092
  );
54045
54093
  React76.useEffect(() => {
54046
54094
  setSelectState(determineSelectedState(value));
@@ -54051,6 +54099,7 @@ var ServerSideLocationFilterRenderer = React76.forwardRef(
54051
54099
  columnDefinition,
54052
54100
  value,
54053
54101
  options,
54102
+ disabledOptions: disabledValues,
54054
54103
  enableSublocations,
54055
54104
  getId: getId3,
54056
54105
  getLabel: getLabel3,
@@ -56562,9 +56611,10 @@ var GenericHeaderRenderer = (props) => {
56562
56611
  props.api.addEventListener("columnRowGroupChanged", updateExpandedState);
56563
56612
  return () => {
56564
56613
  props.column.removeEventListener("sortChanged", onSortChanged);
56565
- props.api.removeEventListener(
56614
+ removeEventListenerFromGrid(
56566
56615
  "columnRowGroupChanged",
56567
- updateExpandedState
56616
+ updateExpandedState,
56617
+ props.api
56568
56618
  );
56569
56619
  };
56570
56620
  }, [props.column]);
@@ -57659,6 +57709,7 @@ var InternalTableContext = React76.createContext({
57659
57709
  getRowHeight: () => () => rowSize.md,
57660
57710
  grandTotalsLabelInnerRenderer: void 0,
57661
57711
  gridApi: void 0,
57712
+ localStoragePersistenceKey: void 0,
57662
57713
  onBulkEditUpdate: () => Promise.resolve(),
57663
57714
  onServerSideDataRequest: void 0,
57664
57715
  onTableConfigChange: () => {
@@ -57675,6 +57726,7 @@ var InternalTableContext = React76.createContext({
57675
57726
  setRowHeight: () => {
57676
57727
  },
57677
57728
  showExpandCollapseAllToggle: false,
57729
+ expandCollapseStateRef: null,
57678
57730
  tableRef: null,
57679
57731
  getColumnDefinition: () => void 0,
57680
57732
  setSelectedGroupIndex: () => {
@@ -78122,6 +78174,63 @@ var buildDetailRowsConfig_ = (detailRowConfig, {
78122
78174
  };
78123
78175
  };
78124
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
+
78125
78234
  // src/utils/getRootRowNode.ts
78126
78235
  function getRootRowNode(rowNode) {
78127
78236
  return rowNode.level > 0 && rowNode.parent ? getRootRowNode(rowNode.parent) : rowNode;
@@ -79796,6 +79905,11 @@ var ja_JP_default = {
79796
79905
  }
79797
79906
  };
79798
79907
 
79908
+ // src/locales/pl-PL.json
79909
+ var pl_PL_default = {
79910
+ dataTable: {}
79911
+ };
79912
+
79799
79913
  // src/locales/pseudo.json
79800
79914
  var pseudo_default = {
79801
79915
  dataTable: {
@@ -80412,7 +80526,8 @@ var translations = {
80412
80526
  pseudo: pseudo_default,
80413
80527
  "pt-BR": pt_BR_default,
80414
80528
  "th-TH": th_TH_default,
80415
- "zh-SG": zh_SG_default
80529
+ "zh-SG": zh_SG_default,
80530
+ "pl-PL": pl_PL_default
80416
80531
  };
80417
80532
  var PRINCE_XML_DPI = 96;
80418
80533
  var DEFAULT_PAGE_MARGIN = 40;
@@ -80638,6 +80753,7 @@ var useTableApi = ({
80638
80753
  columnApi,
80639
80754
  columnDefinitions,
80640
80755
  gridApi,
80756
+ groupDefaultExpanded,
80641
80757
  setLoadingStatus,
80642
80758
  wrapperRef
80643
80759
  }) => {
@@ -80831,10 +80947,33 @@ var useTableApi = ({
80831
80947
  const setSearchValue = React76.useCallback(
80832
80948
  (value) => {
80833
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
+ });
80834
80958
  resetPagination();
80959
+ gridApi == null ? void 0 : gridApi.redrawRows();
80835
80960
  },
80836
- [gridApi]
80961
+ [gridApi, rowSelectionRef.current]
80837
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]);
80838
80977
  const setLoading = React76.useCallback((loading, message = "") => {
80839
80978
  setLoadingStatus({
80840
80979
  loading,
@@ -80896,6 +81035,7 @@ var useTableApi = ({
80896
81035
  adjustRowDragIcon(gridApi, columnApi);
80897
81036
  });
80898
81037
  }
81038
+ setExpandCollapseRow(gridApi, config, groupDefaultExpanded);
80899
81039
  },
80900
81040
  [columnApi, gridApi, internalSetRowHeight, filterStorage.setSelectedFilters]
80901
81041
  );
@@ -80989,7 +81129,8 @@ var useTableApi = ({
80989
81129
  columnApi,
80990
81130
  rowHeight,
80991
81131
  filterStorage,
80992
- rowSelectionRef
81132
+ rowSelectionRef,
81133
+ groupDefaultExpanded
80993
81134
  }),
80994
81135
  [columnApi, gridApi, rowHeight, filterStorage]
80995
81136
  );
@@ -81263,7 +81404,6 @@ function buildPartialTableApi({
81263
81404
  focusField && (gridApi == null ? void 0 : gridApi.setFocusedCell(rowIndex, focusField));
81264
81405
  };
81265
81406
  return {
81266
- getVisibleRowNodes,
81267
81407
  applyTransaction,
81268
81408
  applyServerSideTransaction,
81269
81409
  collapseAll,
@@ -81278,6 +81418,7 @@ function buildPartialTableApi({
81278
81418
  getSelectedRows: getSelectedRows2,
81279
81419
  getServerSideSelectionState,
81280
81420
  getTableConfiguration,
81421
+ getVisibleRowNodes,
81281
81422
  refreshCells,
81282
81423
  setPinnedBottomRowData,
81283
81424
  setRowData,
@@ -81395,6 +81536,12 @@ var DataTable = ({
81395
81536
  const [rowHeight, setRowHeight] = React76.useState(
81396
81537
  (initialTableConfig == null ? void 0 : initialTableConfig.rowHeight) || rowSize.md
81397
81538
  );
81539
+ const expandCollapseStateRef = React76.useRef(
81540
+ (initialTableConfig == null ? void 0 : initialTableConfig.groupRowState) || {
81541
+ expandedRoutes: [],
81542
+ collapsedRoutes: []
81543
+ }
81544
+ );
81398
81545
  const rowHeightRef = React76.useRef(
81399
81546
  (initialTableConfig == null ? void 0 : initialTableConfig.rowHeight) || rowSize.md
81400
81547
  );
@@ -81442,12 +81589,14 @@ var DataTable = ({
81442
81589
  if (localStoragePersistenceKey) {
81443
81590
  storage.local.setItem(localStoragePersistenceKey, {
81444
81591
  ...config,
81592
+ groupRowState: expandCollapseStateRef.current,
81445
81593
  rowHeight: rowHeightRef.current,
81446
81594
  serverFilters: filterStorage.filtersState
81447
81595
  });
81448
81596
  }
81449
81597
  onTableConfigChange == null ? void 0 : onTableConfigChange({
81450
81598
  ...config,
81599
+ groupRowState: expandCollapseStateRef.current,
81451
81600
  rowHeight: rowHeightRef.current,
81452
81601
  serverFilters: filterStorage.filtersState
81453
81602
  });
@@ -81558,6 +81707,7 @@ var DataTable = ({
81558
81707
  onServerSideDataRequest,
81559
81708
  onTableConfigChange: internalOnTableConfigChange,
81560
81709
  rowSelectionRef,
81710
+ expandCollapseStateRef,
81561
81711
  rowHeight,
81562
81712
  searchStorage,
81563
81713
  selectedGroupIndex,
@@ -81618,7 +81768,7 @@ function getServerSideDatasource(onServerSideDataRequestCallbackRef, onEmptyResp
81618
81768
  }
81619
81769
  var minimumColumnWidth = 140;
81620
81770
  var Table = (props) => {
81621
- var _a, _b;
81771
+ var _a, _b, _c;
81622
81772
  const { suppressColumnVirtualisation = true, rowActionsConfig = {} } = props;
81623
81773
  const I18n = useI18nContext();
81624
81774
  const internalTableContext = useInternalTableContext();
@@ -81660,8 +81810,10 @@ var Table = (props) => {
81660
81810
  columnDefinitions: internalTableContext.columnDefinitions,
81661
81811
  gridApi,
81662
81812
  setLoadingStatus,
81663
- wrapperRef
81813
+ wrapperRef,
81814
+ groupDefaultExpanded: props.groupDefaultExpanded
81664
81815
  });
81816
+ const initialTableConfig = internalTableContext.initialTableConfig;
81665
81817
  React76.useImperativeHandle(internalTableContext.tableRef, () => tableApi, [
81666
81818
  tableApi
81667
81819
  ]);
@@ -81975,8 +82127,8 @@ var Table = (props) => {
81975
82127
  );
81976
82128
  const onColumnGroupOpened = React76.useCallback(
81977
82129
  (event) => {
81978
- var _a2, _b2, _c;
81979
- (_c = internalTableContext.analytics) == null ? void 0 : _c.client.addEvent(
82130
+ var _a2, _b2, _c2;
82131
+ (_c2 = internalTableContext.analytics) == null ? void 0 : _c2.client.addEvent(
81980
82132
  "design_system.data_table.column.expand_toggled",
81981
82133
  {
81982
82134
  client: internalTableContext.analytics.clientName,
@@ -81993,14 +82145,14 @@ var Table = (props) => {
81993
82145
  );
81994
82146
  const onColumnPinned = React76.useCallback(
81995
82147
  (event) => {
81996
- var _a2, _b2, _c, _d;
82148
+ var _a2, _b2, _c2, _d;
81997
82149
  (_d = internalTableContext.analytics) == null ? void 0 : _d.client.addEvent(
81998
82150
  "design_system.data_table.column.pinned",
81999
82151
  {
82000
82152
  client: internalTableContext.analytics.clientName,
82001
82153
  column: (_a2 = event.column) == null ? void 0 : _a2.getColId(),
82002
82154
  side: (_b2 = event.column) == null ? void 0 : _b2.getPinned(),
82003
- position: (_c = columnApi == null ? void 0 : columnApi.getColumns()) == null ? void 0 : _c.findIndex(
82155
+ position: (_c2 = columnApi == null ? void 0 : columnApi.getColumns()) == null ? void 0 : _c2.findIndex(
82004
82156
  (col) => {
82005
82157
  var _a3;
82006
82158
  return col.getId() === ((_a3 = event.column) == null ? void 0 : _a3.getColId());
@@ -82099,7 +82251,7 @@ var Table = (props) => {
82099
82251
  const onDragStopped = React76.useCallback(
82100
82252
  // eslint-disable-next-line complexity
82101
82253
  (event) => {
82102
- var _a2, _b2, _c;
82254
+ var _a2, _b2, _c2;
82103
82255
  if (event.target.className.includes("ag-header-cell")) {
82104
82256
  internalTableContext.onTableConfigChange();
82105
82257
  }
@@ -82117,7 +82269,7 @@ var Table = (props) => {
82117
82269
  const firstVisibleColumnIndex = allColumns.findIndex(
82118
82270
  (col) => col.isVisible()
82119
82271
  );
82120
- if (moveColumnEvent.toIndex === firstVisibleColumnIndex || ((_c = moveColumnEvent.column) == null ? void 0 : _c.getColDef().rowDrag)) {
82272
+ if (moveColumnEvent.toIndex === firstVisibleColumnIndex || ((_c2 = moveColumnEvent.column) == null ? void 0 : _c2.getColDef().rowDrag)) {
82121
82273
  adjustRowDragIcon(event.api, event.columnApi);
82122
82274
  }
82123
82275
  }
@@ -82196,27 +82348,55 @@ var Table = (props) => {
82196
82348
  (_a2 = document.getElementsByClassName("ag-body-viewport")[0]) == null ? void 0 : _a2.clientWidth
82197
82349
  );
82198
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
+ );
82199
82379
  const onGridReady = (params) => {
82200
- var _a2, _b2, _c;
82380
+ var _a2, _b2, _c2;
82201
82381
  internalTableContext.setGridApi(params.api);
82202
82382
  internalTableContext.setColumnApi(params.columnApi);
82203
82383
  setViewportWidth(
82204
82384
  (_a2 = document.getElementsByClassName("ag-body-viewport")[0]) == null ? void 0 : _a2.clientWidth
82205
82385
  );
82206
- (_c = (_b2 = props.UNSAFE_internalAGGridOverrides) == null ? void 0 : _b2.onGridReady) == null ? void 0 : _c.call(_b2, params);
82386
+ (_c2 = (_b2 = props.UNSAFE_internalAGGridOverrides) == null ? void 0 : _b2.onGridReady) == null ? void 0 : _c2.call(_b2, params);
82207
82387
  };
82208
82388
  const postProcessPopup = (params) => {
82209
82389
  params.ePopup.style.top = `${HEADER_HEIGHT}px`;
82210
82390
  };
82211
82391
  const internalOnRowSelected = (event) => {
82212
- var _a2, _b2, _c;
82392
+ var _a2, _b2, _c2;
82213
82393
  (_a2 = props.onRowSelected) == null ? void 0 : _a2.call(props, event);
82214
82394
  if (props.siblingGroupsRowSelectionDisabled) {
82215
82395
  const rootRowNode = getRootRowNode(event.node);
82216
82396
  if (!event.node.isSelected() && internalTableContext.selectedGroupIndex !== null && (rootRowNode == null ? void 0 : rootRowNode.id) === internalTableContext.selectedGroupIndex && event.api.getSelectedNodes().length === 0) {
82217
82397
  (_b2 = internalTableContext == null ? void 0 : internalTableContext.setSelectedGroupIndex) == null ? void 0 : _b2.call(internalTableContext, null);
82218
82398
  } else {
82219
- (_c = internalTableContext == null ? void 0 : internalTableContext.setSelectedGroupIndex) == null ? void 0 : _c.call(internalTableContext, (prevState) => {
82399
+ (_c2 = internalTableContext == null ? void 0 : internalTableContext.setSelectedGroupIndex) == null ? void 0 : _c2.call(internalTableContext, (prevState) => {
82220
82400
  return prevState ?? (rootRowNode == null ? void 0 : rootRowNode.id) ?? null;
82221
82401
  });
82222
82402
  }
@@ -82225,13 +82405,26 @@ var Table = (props) => {
82225
82405
  const internalRowGroupOpened = React76.useCallback(
82226
82406
  (event) => {
82227
82407
  var _a2;
82408
+ if (internalTableContext.expandCollapseStateRef) {
82409
+ internalTableContext.expandCollapseStateRef.current = getGroupRowState(
82410
+ gridApi,
82411
+ props.groupDefaultExpanded
82412
+ );
82413
+ }
82414
+ internalTableContext.onTableConfigChange();
82228
82415
  (_a2 = props.onRowGroupOpened) == null ? void 0 : _a2.call(props, {
82229
82416
  expanded: event.expanded,
82230
82417
  node: serializeNode(event.node),
82231
82418
  rowIndex: event.rowIndex
82232
82419
  });
82233
82420
  },
82234
- [props.onRowGroupOpened]
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
+ ]
82235
82428
  );
82236
82429
  const getGroupRowAgg = React76.useCallback(
82237
82430
  (params) => {
@@ -82384,6 +82577,8 @@ var Table = (props) => {
82384
82577
  alwaysAggregateAtRootLevel: !onSSDR,
82385
82578
  autoGroupColumnDef: decoratedAutoGroupColDef,
82386
82579
  cacheBlockSize: props.paginationPageSize || defaultPaginationPageSize,
82580
+ isGroupOpenByDefault: isClientSideGroupOpenByDefault,
82581
+ isServerSideGroupOpenByDefault,
82387
82582
  defaultColDef,
82388
82583
  enableGroupEdit: internalTableContext.enableGroupEditAndValidation,
82389
82584
  enableCellTextSelection: internalTableContext.enableCellTextSelection,
@@ -83840,6 +84035,7 @@ var LocationQuickFilterOverlay = React76.forwardRef(
83840
84035
  enableSublocations,
83841
84036
  selectState,
83842
84037
  options,
84038
+ disabledOptions,
83843
84039
  columnDefinition,
83844
84040
  value
83845
84041
  }, ref) => {
@@ -83867,6 +84063,7 @@ var LocationQuickFilterOverlay = React76.forwardRef(
83867
84063
  return onSelectAll();
83868
84064
  }
83869
84065
  if (selection.item.id === includeSublocationOption.id) {
84066
+ _onSelect(selection);
83870
84067
  return onSelectSublocations();
83871
84068
  }
83872
84069
  return _onSelect(selection);
@@ -83937,8 +84134,9 @@ var LocationQuickFilterOverlay = React76.forwardRef(
83937
84134
  {
83938
84135
  key: getId3(item),
83939
84136
  item,
83940
- selected: value.map(({ id }) => id).includes(getId3(item)),
83941
- suggested: i === 0
84137
+ selected: value.map(({ id }) => id).includes(getId3(item)) || disabledOptions.map(({ id }) => id).includes(getId3(item)),
84138
+ suggested: i === 0,
84139
+ disabled: disabledOptions.map(({ id }) => id).includes(getId3(item))
83942
84140
  },
83943
84141
  getLabel3(item)
83944
84142
  );
@@ -83985,10 +84183,23 @@ var LocationQuickFilterRenderer = ({
83985
84183
  const [selectState, setSelectState] = React76.useState(
83986
84184
  determineSelectedState(value)
83987
84185
  );
84186
+ const [disabledValues, setDisabledValues] = React76.useState([]);
83988
84187
  const [enableSublocations, setEnableSublocations] = React76.useState(false);
83989
84188
  const onSelectSublocations = React76.useCallback(() => {
84189
+ if (enableSublocations) {
84190
+ setDisabledValues([]);
84191
+ } else {
84192
+ const newDisabledValues = [];
84193
+ value.forEach((location) => {
84194
+ newDisabledValues.push(...findSublocations(location));
84195
+ });
84196
+ const uniqDisabledValues = uniqBy(prop("id"), newDisabledValues).filter(
84197
+ ({ id }) => !selectedValueIds.includes(id)
84198
+ );
84199
+ setDisabledValues(uniqDisabledValues);
84200
+ }
83990
84201
  setEnableSublocations(!enableSublocations);
83991
- }, [enableSublocations]);
84202
+ }, [enableSublocations, value, selectedValueIds, options]);
83992
84203
  const onSelectAll = React76.useCallback(() => {
83993
84204
  if (selectState === "none" || selectState === "partial") {
83994
84205
  setSelectState("all");
@@ -84002,22 +84213,51 @@ var LocationQuickFilterRenderer = ({
84002
84213
  }
84003
84214
  }, [options, selectState, selectedValueIds]);
84004
84215
  const onSelect = (selection) => {
84005
- if (selection.item.id === "select_all" || selection.item.id === "include_sublocations") {
84216
+ if (selection.item.id === "select_all") {
84006
84217
  return;
84007
84218
  }
84008
- let newSelections = selectedValueIds.includes(getId3(selection.item)) ? removeSelections(selection.item, value) : [...value, ...handleSelectSublocations(selection.item), selection.item];
84219
+ if (selection.item.id === "include_sublocations") {
84220
+ return onChange(
84221
+ value.map((item) => ({
84222
+ ...item,
84223
+ sublocations: enableSublocations ? [] : findSublocations(item)
84224
+ }))
84225
+ );
84226
+ }
84227
+ let newSelections = [];
84228
+ if (selectedValueIds.includes(getId3(selection.item))) {
84229
+ newSelections = removeSelections(selection.item, value);
84230
+ } else {
84231
+ newSelections = [...value, selection.item];
84232
+ const sublocationsToDisable = handleSelectSublocations(selection.item);
84233
+ const newDisabledValues = [
84234
+ ...disabledValues,
84235
+ ...sublocationsToDisable.filter(
84236
+ ({ id }) => !selectedValueIds.includes(id)
84237
+ )
84238
+ ];
84239
+ setDisabledValues(newDisabledValues);
84240
+ }
84009
84241
  setSelectState(determineSelectedState(newSelections));
84010
84242
  setSelectedValueIds(newSelections.map(({ id }) => id));
84011
- onChange(newSelections);
84243
+ onChange(
84244
+ newSelections.map((item) => ({
84245
+ ...item,
84246
+ sublocations: handleSelectSublocations(item)
84247
+ }))
84248
+ );
84249
+ };
84250
+ const findSublocations = (selected) => {
84251
+ return options.filter((option) => {
84252
+ return startsWith(
84253
+ `${getLabel3(selected).toLowerCase()} > `,
84254
+ getLabel3(option).toLowerCase()
84255
+ );
84256
+ });
84012
84257
  };
84013
84258
  const handleSelectSublocations = (selected) => {
84014
84259
  if (enableSublocations) {
84015
- const filteredOptions = options.filter((option) => {
84016
- return startsWith(
84017
- `${getLabel3(selected).toLowerCase()} > `,
84018
- getLabel3(option).toLowerCase()
84019
- );
84020
- });
84260
+ const filteredOptions = findSublocations(selected);
84021
84261
  return filteredOptions;
84022
84262
  } else {
84023
84263
  return [];
@@ -84026,13 +84266,16 @@ var LocationQuickFilterRenderer = ({
84026
84266
  const removeSelections = React76.useCallback(
84027
84267
  function(selection, selected) {
84028
84268
  const sublocations = handleSelectSublocations(selection);
84029
- return enableSublocations ? selected.filter(
84030
- (item) => ![...sublocations.map(({ id }) => id), getId3(selection)].includes(
84031
- item.id
84269
+ const disabledValueIds = disabledValues.map(({ id }) => id);
84270
+ const sublocationsToRemoveFromDisabledIds = sublocations.filter(({ id }) => disabledValueIds.includes(id)).map(({ id }) => id);
84271
+ setDisabledValues(
84272
+ disabledValues.filter(
84273
+ ({ id }) => !sublocationsToRemoveFromDisabledIds.includes(id)
84032
84274
  )
84033
- ) : selected.filter((item) => getId3(item) !== getId3(selection));
84275
+ );
84276
+ return selected.filter((item) => getId3(item) !== getId3(selection));
84034
84277
  },
84035
- [enableSublocations]
84278
+ [enableSublocations, disabledValues]
84036
84279
  );
84037
84280
  React76.useEffect(() => {
84038
84281
  setSelectState(determineSelectedState(value));
@@ -84047,6 +84290,7 @@ var LocationQuickFilterRenderer = ({
84047
84290
  selectState,
84048
84291
  value,
84049
84292
  options,
84293
+ disabledOptions: disabledValues,
84050
84294
  getId: getId3,
84051
84295
  getLabel: getLabel3,
84052
84296
  loading,