@procore/data-table 14.12.1 → 14.13.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';
@@ -8011,7 +8011,7 @@ var InternalBooleanCellEditor = React76.forwardRef(({ columnDefinition, setDataV
8011
8011
  return /* @__PURE__ */ React76.createElement(
8012
8012
  Select,
8013
8013
  {
8014
- afterHide: stopEditing,
8014
+ afterHide: () => stopEditing(),
8015
8015
  block: true,
8016
8016
  className: cx("input-cell"),
8017
8017
  label: value ? I18n.t("dataTable.cells.booleanCell.options.yes") : I18n.t("dataTable.cells.booleanCell.options.no"),
@@ -8229,8 +8229,8 @@ var Editor = React76.forwardRef(
8229
8229
  if (isEmptyValue(value) && !columnDefinition.editable) {
8230
8230
  return null;
8231
8231
  }
8232
- function onBlur() {
8233
- stopEditing();
8232
+ function onBlur(event) {
8233
+ stopEditing(ensureIsHTMLElement(event.relatedTarget));
8234
8234
  }
8235
8235
  const defaultValue = eventKey ? value : formatNumber(value, {
8236
8236
  ...columnDefinition.cellEditorParams?.formatConfig ?? columnDefinition.cellRendererParams?.formatConfig ?? {},
@@ -8668,8 +8668,8 @@ var Renderer4 = (props) => {
8668
8668
  var DateCellRenderer = withDataTableRenderer(Renderer4, "date");
8669
8669
  var Editor2 = React76.forwardRef(
8670
8670
  ({ columnDefinition, setDataValue, stopEditing, value }, ref) => {
8671
- function afterHide() {
8672
- stopEditing();
8671
+ function afterHide(event) {
8672
+ stopEditing(ensureIsHTMLElement(event?.target));
8673
8673
  }
8674
8674
  function onChange(date) {
8675
8675
  if (date) {
@@ -8739,8 +8739,8 @@ var Renderer5 = (props) => {
8739
8739
  var DateTimeCellRenderer = withDataTableRenderer(Renderer5, "date");
8740
8740
  var Editor3 = React76.forwardRef(
8741
8741
  ({ columnDefinition, setDataValue, stopEditing, value }, ref) => {
8742
- function afterHide() {
8743
- stopEditing();
8742
+ function afterHide(event) {
8743
+ stopEditing(ensureIsHTMLElement(event?.target));
8744
8744
  }
8745
8745
  function onChange(date) {
8746
8746
  if (date) {
@@ -12790,8 +12790,8 @@ var GridOptionsValidator = class GridOptionsValidator2 {
12790
12790
  enterMovesDownAfterEdit: { version: "30", newProp: "enterNavigatesVerticallyAfterEdit", copyToNewProp: true }
12791
12791
  };
12792
12792
  }
12793
- pickOneWarning(prop1, prop2) {
12794
- console.warn(`AG Grid: ${prop1} and ${prop2} do not work with each other, you need to pick one.`);
12793
+ pickOneWarning(prop1, prop22) {
12794
+ console.warn(`AG Grid: ${prop1} and ${prop22} do not work with each other, you need to pick one.`);
12795
12795
  }
12796
12796
  init() {
12797
12797
  this.checkForDeprecated();
@@ -12813,7 +12813,7 @@ var GridOptionsValidator = class GridOptionsValidator2 {
12813
12813
  this.pickOneWarning("groupRemoveSingleChildren", "groupHideOpenParents");
12814
12814
  }
12815
12815
  if (this.gridOptionsService.isRowModelType("serverSide")) {
12816
- const msg = (prop, alt) => `AG Grid: '${prop}' is not supported on the Server-Side Row Model.` + (alt ? ` Please use ${alt} instead.` : "");
12816
+ const msg = (prop3, alt) => `AG Grid: '${prop3}' is not supported on the Server-Side Row Model.` + (alt ? ` Please use ${alt} instead.` : "");
12817
12817
  if (this.gridOptionsService.exists("groupDefaultExpanded")) {
12818
12818
  console.warn(msg("groupDefaultExpanded", "isServerSideGroupOpenByDefault callback"));
12819
12819
  }
@@ -12829,7 +12829,7 @@ var GridOptionsValidator = class GridOptionsValidator2 {
12829
12829
  } else if (this.gridOptionsService.is("enableRangeHandle") || this.gridOptionsService.is("enableFillHandle")) {
12830
12830
  console.warn("AG Grid: 'enableRangeHandle' or 'enableFillHandle' will not work unless 'enableRangeSelection' is set to true");
12831
12831
  }
12832
- const validateRegistered = (prop, module) => this.gridOptionsService.exists(prop) && ModuleRegistry.__assertRegistered(module, prop, this.gridOptionsService.getGridId());
12832
+ const validateRegistered = (prop3, module) => this.gridOptionsService.exists(prop3) && ModuleRegistry.__assertRegistered(module, prop3, this.gridOptionsService.getGridId());
12833
12833
  validateRegistered("sideBar", ModuleNames.SideBarModule);
12834
12834
  validateRegistered("statusBar", ModuleNames.StatusBarModule);
12835
12835
  validateRegistered("enableCharts", ModuleNames.GridChartsModule);
@@ -52153,15 +52153,15 @@ var DataTypeService = class DataTypeService2 extends BeanStub {
52153
52153
  ["valueGetter", void 0],
52154
52154
  ["valueParser", void 0],
52155
52155
  ["refData", void 0]
52156
- ].some(([prop, comparisonValue]) => this.doesColDefPropPreventInference(colDef, propsToCheckForInference, prop, comparisonValue));
52156
+ ].some(([prop3, comparisonValue]) => this.doesColDefPropPreventInference(colDef, propsToCheckForInference, prop3, comparisonValue));
52157
52157
  }
52158
- doesColDefPropPreventInference(colDef, checkProps, prop, comparisonValue) {
52159
- if (!checkProps[prop]) {
52158
+ doesColDefPropPreventInference(colDef, checkProps, prop3, comparisonValue) {
52159
+ if (!checkProps[prop3]) {
52160
52160
  return false;
52161
52161
  }
52162
- const value = colDef[prop];
52162
+ const value = colDef[prop3];
52163
52163
  if (value === null) {
52164
- checkProps[prop] = false;
52164
+ checkProps[prop3] = false;
52165
52165
  return false;
52166
52166
  } else {
52167
52167
  return comparisonValue === void 0 ? !!value : value === comparisonValue;
@@ -53012,8 +53012,8 @@ var InternalNumberCellEditor = React76.forwardRef(({ columnDefinition, stopEditi
53012
53012
  if (isEmptyValue(value) && !columnDefinition.editable) {
53013
53013
  return null;
53014
53014
  }
53015
- function onBlur() {
53016
- stopEditing();
53015
+ function onBlur(event) {
53016
+ stopEditing(ensureIsHTMLElement(event.relatedTarget));
53017
53017
  }
53018
53018
  return /* @__PURE__ */ React76.createElement(
53019
53019
  Input,
@@ -53296,8 +53296,8 @@ var Renderer7 = ({
53296
53296
  var PercentCellRenderer = withDataTableRenderer(Renderer7, "input");
53297
53297
  var Editor4 = React76.forwardRef(({ columnDefinition, eventKey, stopEditing, value }, ref) => {
53298
53298
  const I18n = useI18nContext();
53299
- function onBlur() {
53300
- stopEditing();
53299
+ function onBlur(event) {
53300
+ stopEditing(ensureIsHTMLElement(event.relatedTarget));
53301
53301
  }
53302
53302
  if (isEmptyValue(value) && !columnDefinition.editable) {
53303
53303
  return null;
@@ -53688,8 +53688,8 @@ var Renderer11 = ({
53688
53688
  var TextCellRenderer = withDataTableRenderer(Renderer11, "input");
53689
53689
  var Editor7 = React76.forwardRef(
53690
53690
  ({ columnDefinition, eventKey, stopEditing, value }, ref) => {
53691
- function onBlur() {
53692
- stopEditing();
53691
+ function onBlur(event) {
53692
+ stopEditing(ensureIsHTMLElement(event.relatedTarget));
53693
53693
  }
53694
53694
  const I18n = useI18nContext();
53695
53695
  const internalValue = eventKey ? value : columnDefinition.getStringFormattedValue?.(value) ?? value;
@@ -53759,8 +53759,8 @@ var Renderer12 = ({
53759
53759
  };
53760
53760
  var Editor8 = React76.forwardRef(
53761
53761
  ({ columnDefinition, stopEditing, value }, ref) => {
53762
- function onBlur() {
53763
- stopEditing();
53762
+ function onBlur(event) {
53763
+ stopEditing(ensureIsHTMLElement(event.relatedTarget));
53764
53764
  }
53765
53765
  const I18n = useI18nContext();
53766
53766
  const internalValue = columnDefinition.getStringFormattedValue?.(value) ?? value;
@@ -53821,6 +53821,7 @@ var LocationFilterOverlay = React76.forwardRef(
53821
53821
  enableSublocations,
53822
53822
  selectState,
53823
53823
  options,
53824
+ disabledOptions,
53824
53825
  columnDefinition,
53825
53826
  value
53826
53827
  }, ref) => {
@@ -53842,6 +53843,7 @@ var LocationFilterOverlay = React76.forwardRef(
53842
53843
  return onSelectAll();
53843
53844
  }
53844
53845
  if (selection.item.id === includeSublocationOption.id) {
53846
+ _onSelect(selection);
53845
53847
  return onSelectSublocations();
53846
53848
  }
53847
53849
  return _onSelect(selection);
@@ -53911,8 +53913,9 @@ var LocationFilterOverlay = React76.forwardRef(
53911
53913
  {
53912
53914
  key: getId3(item),
53913
53915
  item,
53914
- selected: value.map(({ id }) => id).includes(getId3(item)),
53915
- suggested: i === 0
53916
+ selected: value.map(({ id }) => id).includes(getId3(item)) || disabledOptions.map(({ id }) => id).includes(getId3(item)),
53917
+ suggested: i === 0,
53918
+ disabled: disabledOptions.map(({ id }) => id).includes(getId3(item))
53916
53919
  },
53917
53920
  getLabel3(item)
53918
53921
  );
@@ -53942,10 +53945,23 @@ var ServerSideLocationFilterRenderer = React76.forwardRef(
53942
53945
  const [selectState, setSelectState] = React76.useState(
53943
53946
  determineSelectedState(value)
53944
53947
  );
53948
+ const [disabledValues, setDisabledValues] = React76.useState([]);
53945
53949
  const [enableSublocations, setEnableSublocations] = React76.useState(false);
53946
53950
  const onSelectSublocations = React76.useCallback(() => {
53951
+ if (enableSublocations) {
53952
+ setDisabledValues([]);
53953
+ } else {
53954
+ const newDisabledValues = [];
53955
+ value.forEach((location) => {
53956
+ newDisabledValues.push(...findSublocations(location));
53957
+ });
53958
+ const uniqDisabledValues = uniqBy(prop("id"), newDisabledValues).filter(
53959
+ ({ id }) => !selectedValueIds.includes(id)
53960
+ );
53961
+ setDisabledValues(uniqDisabledValues);
53962
+ }
53947
53963
  setEnableSublocations(!enableSublocations);
53948
- }, [enableSublocations]);
53964
+ }, [enableSublocations, value, selectedValueIds, options]);
53949
53965
  const I18n = useI18nContext();
53950
53966
  const selectRef = React76.useRef(null);
53951
53967
  const onSelectAll = React76.useCallback(() => {
@@ -53961,17 +53977,47 @@ var ServerSideLocationFilterRenderer = React76.forwardRef(
53961
53977
  }
53962
53978
  }, [options, selectState, selectedValueIds]);
53963
53979
  const onSelect = (selection) => {
53964
- if (selection.item.id === "select_all" || selection.item.id === "include_sublocations") {
53980
+ if (selection.item.id === "select_all") {
53965
53981
  return;
53966
53982
  }
53967
- let newSelections = selectedValueIds.includes(getId3(selection.item)) ? removeSelections(selection.item, value) : [
53968
- ...value,
53969
- ...handleSelectSublocations(selection.item),
53970
- selection.item
53971
- ];
53983
+ if (selection.item.id === "include_sublocations") {
53984
+ return onChange(
53985
+ value.map((item) => ({
53986
+ ...item,
53987
+ sublocations: enableSublocations ? [] : findSublocations(item)
53988
+ }))
53989
+ );
53990
+ }
53991
+ let newSelections = [];
53992
+ if (selectedValueIds.includes(getId3(selection.item))) {
53993
+ newSelections = removeSelections(selection.item, value);
53994
+ } else {
53995
+ newSelections = [...value, selection.item];
53996
+ const sublocationsToDisable = handleSelectSublocations(selection.item);
53997
+ const newDisabledValues = [
53998
+ ...disabledValues,
53999
+ ...sublocationsToDisable.filter(
54000
+ ({ id }) => !selectedValueIds.includes(id)
54001
+ )
54002
+ ];
54003
+ setDisabledValues(newDisabledValues);
54004
+ }
53972
54005
  setSelectState(determineSelectedState(newSelections));
53973
54006
  setSelectedValueIds(newSelections.map(({ id }) => id));
53974
- onChange(newSelections);
54007
+ onChange(
54008
+ newSelections.map((item) => ({
54009
+ ...item,
54010
+ sublocations: handleSelectSublocations(item)
54011
+ }))
54012
+ );
54013
+ };
54014
+ const findSublocations = (selected) => {
54015
+ return options.filter((option) => {
54016
+ return startsWith(
54017
+ `${getLabel3(selected).toLowerCase()} > `,
54018
+ getLabel3(option).toLowerCase()
54019
+ );
54020
+ });
53975
54021
  };
53976
54022
  const handleSelectSublocations = (selected) => {
53977
54023
  if (enableSublocations) {
@@ -53989,14 +54035,16 @@ var ServerSideLocationFilterRenderer = React76.forwardRef(
53989
54035
  const removeSelections = React76.useCallback(
53990
54036
  function(selection, selected) {
53991
54037
  const sublocations = handleSelectSublocations(selection);
53992
- return enableSublocations ? selected.filter(
53993
- (item) => ![
53994
- ...sublocations.map(({ id }) => id),
53995
- getId3(selection)
53996
- ].includes(item.id)
53997
- ) : selected.filter((item) => getId3(item) !== getId3(selection));
54038
+ const disabledValueIds = disabledValues.map(({ id }) => id);
54039
+ const sublocationsToRemoveFromDisabledIds = sublocations.filter(({ id }) => disabledValueIds.includes(id)).map(({ id }) => id);
54040
+ setDisabledValues(
54041
+ disabledValues.filter(
54042
+ ({ id }) => !sublocationsToRemoveFromDisabledIds.includes(id)
54043
+ )
54044
+ );
54045
+ return selected.filter((item) => getId3(item) !== getId3(selection));
53998
54046
  },
53999
- [enableSublocations]
54047
+ [enableSublocations, disabledValues]
54000
54048
  );
54001
54049
  React76.useEffect(() => {
54002
54050
  setSelectState(determineSelectedState(value));
@@ -54007,6 +54055,7 @@ var ServerSideLocationFilterRenderer = React76.forwardRef(
54007
54055
  columnDefinition,
54008
54056
  value,
54009
54057
  options,
54058
+ disabledOptions: disabledValues,
54010
54059
  enableSublocations,
54011
54060
  getId: getId3,
54012
54061
  getLabel: getLabel3,
@@ -55970,7 +56019,14 @@ var DataTableCellEditor = React76.forwardRef(
55970
56019
  node.setDataValue(field, newValue);
55971
56020
  setCurrentValue(newValue);
55972
56021
  },
55973
- stopEditing,
56022
+ stopEditing: (relatedTarget) => {
56023
+ const isRelatedTargetOutsideTable = relatedTarget?.closest('[data-qa="data-table-table') === null;
56024
+ stopEditing(isRelatedTargetOutsideTable);
56025
+ if (isRelatedTargetOutsideTable) {
56026
+ api.clearFocusedCell();
56027
+ relatedTarget.focus();
56028
+ }
56029
+ },
55974
56030
  tableApi: tableRef?.current,
55975
56031
  value: currentValue,
55976
56032
  ref: handleRefs(editorType)
@@ -56842,6 +56898,9 @@ function withDataTableRenderer(Component4, editorType) {
56842
56898
  }
56843
56899
  );
56844
56900
  }
56901
+ function ensureIsHTMLElement(element) {
56902
+ return element instanceof HTMLElement ? element : null;
56903
+ }
56845
56904
  function getGroupNodes(params) {
56846
56905
  const currentParentId = params.node?.parent?.id ?? "root";
56847
56906
  let groupNodes = {
@@ -57081,7 +57140,7 @@ var MultiSelectEditor = React76.forwardRef(({ columnDefinition, value = [], setD
57081
57140
  MultiSelect,
57082
57141
  {
57083
57142
  beforeShow,
57084
- afterHide: stopEditing,
57143
+ afterHide: () => stopEditing(),
57085
57144
  block: true,
57086
57145
  loading: isSearching || loading,
57087
57146
  getId: (option) => {
@@ -79634,6 +79693,11 @@ var ja_JP_default = {
79634
79693
  }
79635
79694
  };
79636
79695
 
79696
+ // src/locales/pl-PL.json
79697
+ var pl_PL_default = {
79698
+ dataTable: {}
79699
+ };
79700
+
79637
79701
  // src/locales/pseudo.json
79638
79702
  var pseudo_default = {
79639
79703
  dataTable: {
@@ -80250,7 +80314,8 @@ var translations = {
80250
80314
  pseudo: pseudo_default,
80251
80315
  "pt-BR": pt_BR_default,
80252
80316
  "th-TH": th_TH_default,
80253
- "zh-SG": zh_SG_default
80317
+ "zh-SG": zh_SG_default,
80318
+ "pl-PL": pl_PL_default
80254
80319
  };
80255
80320
  var PRINCE_XML_DPI = 96;
80256
80321
  var DEFAULT_PAGE_MARGIN = 40;
@@ -82131,6 +82196,7 @@ var Table = (props) => {
82131
82196
  return /* @__PURE__ */ React76.createElement(
82132
82197
  Spinner,
82133
82198
  {
82199
+ "data-qa": "data-table-table",
82134
82200
  loading: loadingStatus.loading,
82135
82201
  label: loadingStatus.message,
82136
82202
  style: {
@@ -83605,6 +83671,7 @@ var LocationQuickFilterOverlay = React76.forwardRef(
83605
83671
  enableSublocations,
83606
83672
  selectState,
83607
83673
  options,
83674
+ disabledOptions,
83608
83675
  columnDefinition,
83609
83676
  value
83610
83677
  }, ref) => {
@@ -83632,6 +83699,7 @@ var LocationQuickFilterOverlay = React76.forwardRef(
83632
83699
  return onSelectAll();
83633
83700
  }
83634
83701
  if (selection.item.id === includeSublocationOption.id) {
83702
+ _onSelect(selection);
83635
83703
  return onSelectSublocations();
83636
83704
  }
83637
83705
  return _onSelect(selection);
@@ -83701,8 +83769,9 @@ var LocationQuickFilterOverlay = React76.forwardRef(
83701
83769
  {
83702
83770
  key: getId3(item),
83703
83771
  item,
83704
- selected: value.map(({ id }) => id).includes(getId3(item)),
83705
- suggested: i === 0
83772
+ selected: value.map(({ id }) => id).includes(getId3(item)) || disabledOptions.map(({ id }) => id).includes(getId3(item)),
83773
+ suggested: i === 0,
83774
+ disabled: disabledOptions.map(({ id }) => id).includes(getId3(item))
83706
83775
  },
83707
83776
  getLabel3(item)
83708
83777
  );
@@ -83748,10 +83817,23 @@ var LocationQuickFilterRenderer = ({
83748
83817
  const [selectState, setSelectState] = React76.useState(
83749
83818
  determineSelectedState(value)
83750
83819
  );
83820
+ const [disabledValues, setDisabledValues] = React76.useState([]);
83751
83821
  const [enableSublocations, setEnableSublocations] = React76.useState(false);
83752
83822
  const onSelectSublocations = React76.useCallback(() => {
83823
+ if (enableSublocations) {
83824
+ setDisabledValues([]);
83825
+ } else {
83826
+ const newDisabledValues = [];
83827
+ value.forEach((location) => {
83828
+ newDisabledValues.push(...findSublocations(location));
83829
+ });
83830
+ const uniqDisabledValues = uniqBy(prop("id"), newDisabledValues).filter(
83831
+ ({ id }) => !selectedValueIds.includes(id)
83832
+ );
83833
+ setDisabledValues(uniqDisabledValues);
83834
+ }
83753
83835
  setEnableSublocations(!enableSublocations);
83754
- }, [enableSublocations]);
83836
+ }, [enableSublocations, value, selectedValueIds, options]);
83755
83837
  const onSelectAll = React76.useCallback(() => {
83756
83838
  if (selectState === "none" || selectState === "partial") {
83757
83839
  setSelectState("all");
@@ -83765,22 +83847,51 @@ var LocationQuickFilterRenderer = ({
83765
83847
  }
83766
83848
  }, [options, selectState, selectedValueIds]);
83767
83849
  const onSelect = (selection) => {
83768
- if (selection.item.id === "select_all" || selection.item.id === "include_sublocations") {
83850
+ if (selection.item.id === "select_all") {
83769
83851
  return;
83770
83852
  }
83771
- let newSelections = selectedValueIds.includes(getId3(selection.item)) ? removeSelections(selection.item, value) : [...value, ...handleSelectSublocations(selection.item), selection.item];
83853
+ if (selection.item.id === "include_sublocations") {
83854
+ return onChange(
83855
+ value.map((item) => ({
83856
+ ...item,
83857
+ sublocations: enableSublocations ? [] : findSublocations(item)
83858
+ }))
83859
+ );
83860
+ }
83861
+ let newSelections = [];
83862
+ if (selectedValueIds.includes(getId3(selection.item))) {
83863
+ newSelections = removeSelections(selection.item, value);
83864
+ } else {
83865
+ newSelections = [...value, selection.item];
83866
+ const sublocationsToDisable = handleSelectSublocations(selection.item);
83867
+ const newDisabledValues = [
83868
+ ...disabledValues,
83869
+ ...sublocationsToDisable.filter(
83870
+ ({ id }) => !selectedValueIds.includes(id)
83871
+ )
83872
+ ];
83873
+ setDisabledValues(newDisabledValues);
83874
+ }
83772
83875
  setSelectState(determineSelectedState(newSelections));
83773
83876
  setSelectedValueIds(newSelections.map(({ id }) => id));
83774
- onChange(newSelections);
83877
+ onChange(
83878
+ newSelections.map((item) => ({
83879
+ ...item,
83880
+ sublocations: handleSelectSublocations(item)
83881
+ }))
83882
+ );
83883
+ };
83884
+ const findSublocations = (selected) => {
83885
+ return options.filter((option) => {
83886
+ return startsWith(
83887
+ `${getLabel3(selected).toLowerCase()} > `,
83888
+ getLabel3(option).toLowerCase()
83889
+ );
83890
+ });
83775
83891
  };
83776
83892
  const handleSelectSublocations = (selected) => {
83777
83893
  if (enableSublocations) {
83778
- const filteredOptions = options.filter((option) => {
83779
- return startsWith(
83780
- `${getLabel3(selected).toLowerCase()} > `,
83781
- getLabel3(option).toLowerCase()
83782
- );
83783
- });
83894
+ const filteredOptions = findSublocations(selected);
83784
83895
  return filteredOptions;
83785
83896
  } else {
83786
83897
  return [];
@@ -83789,13 +83900,16 @@ var LocationQuickFilterRenderer = ({
83789
83900
  const removeSelections = React76.useCallback(
83790
83901
  function(selection, selected) {
83791
83902
  const sublocations = handleSelectSublocations(selection);
83792
- return enableSublocations ? selected.filter(
83793
- (item) => ![...sublocations.map(({ id }) => id), getId3(selection)].includes(
83794
- item.id
83903
+ const disabledValueIds = disabledValues.map(({ id }) => id);
83904
+ const sublocationsToRemoveFromDisabledIds = sublocations.filter(({ id }) => disabledValueIds.includes(id)).map(({ id }) => id);
83905
+ setDisabledValues(
83906
+ disabledValues.filter(
83907
+ ({ id }) => !sublocationsToRemoveFromDisabledIds.includes(id)
83795
83908
  )
83796
- ) : selected.filter((item) => getId3(item) !== getId3(selection));
83909
+ );
83910
+ return selected.filter((item) => getId3(item) !== getId3(selection));
83797
83911
  },
83798
- [enableSublocations]
83912
+ [enableSublocations, disabledValues]
83799
83913
  );
83800
83914
  React76.useEffect(() => {
83801
83915
  setSelectState(determineSelectedState(value));
@@ -83810,6 +83924,7 @@ var LocationQuickFilterRenderer = ({
83810
83924
  selectState,
83811
83925
  value,
83812
83926
  options,
83927
+ disabledOptions: disabledValues,
83813
83928
  getId: getId3,
83814
83929
  getLabel: getLabel3,
83815
83930
  loading,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@procore/data-table",
3
- "version": "14.12.1",
3
+ "version": "14.13.0",
4
4
  "description": "Complex data grid built on top of ag-grid, with DST components and styles.",
5
5
  "type": "module",
6
6
  "main": "dist/legacy/index.cjs",
@@ -111,7 +111,7 @@
111
111
  "@procore/core-css": "10.17.0",
112
112
  "@procore/core-icons": "12.1.0",
113
113
  "@procore/core-prettier": "10.2.0",
114
- "@procore/core-react": "12.9.0",
114
+ "@procore/core-react": "12.10.0",
115
115
  "@procore/eslint-config": "10.0.0",
116
116
  "@procore/globalization-toolkit": "3.1.0",
117
117
  "@procore/labs-financials-utils": "3.0.1",