@procore/data-table 14.12.2 → 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.
@@ -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;
@@ -53835,6 +53835,7 @@ var LocationFilterOverlay = React76__default.default.forwardRef(
53835
53835
  enableSublocations,
53836
53836
  selectState,
53837
53837
  options,
53838
+ disabledOptions,
53838
53839
  columnDefinition,
53839
53840
  value
53840
53841
  }, ref) => {
@@ -53856,6 +53857,7 @@ var LocationFilterOverlay = React76__default.default.forwardRef(
53856
53857
  return onSelectAll();
53857
53858
  }
53858
53859
  if (selection.item.id === includeSublocationOption.id) {
53860
+ _onSelect(selection);
53859
53861
  return onSelectSublocations();
53860
53862
  }
53861
53863
  return _onSelect(selection);
@@ -53925,8 +53927,9 @@ var LocationFilterOverlay = React76__default.default.forwardRef(
53925
53927
  {
53926
53928
  key: getId3(item),
53927
53929
  item,
53928
- selected: value.map(({ id }) => id).includes(getId3(item)),
53929
- suggested: i === 0
53930
+ selected: value.map(({ id }) => id).includes(getId3(item)) || disabledOptions.map(({ id }) => id).includes(getId3(item)),
53931
+ suggested: i === 0,
53932
+ disabled: disabledOptions.map(({ id }) => id).includes(getId3(item))
53930
53933
  },
53931
53934
  getLabel3(item)
53932
53935
  );
@@ -53956,10 +53959,23 @@ var ServerSideLocationFilterRenderer = React76__default.default.forwardRef(
53956
53959
  const [selectState, setSelectState] = React76__default.default.useState(
53957
53960
  determineSelectedState(value)
53958
53961
  );
53962
+ const [disabledValues, setDisabledValues] = React76__default.default.useState([]);
53959
53963
  const [enableSublocations, setEnableSublocations] = React76__default.default.useState(false);
53960
53964
  const onSelectSublocations = React76__default.default.useCallback(() => {
53965
+ if (enableSublocations) {
53966
+ setDisabledValues([]);
53967
+ } else {
53968
+ const newDisabledValues = [];
53969
+ value.forEach((location) => {
53970
+ newDisabledValues.push(...findSublocations(location));
53971
+ });
53972
+ const uniqDisabledValues = ramda.uniqBy(ramda.prop("id"), newDisabledValues).filter(
53973
+ ({ id }) => !selectedValueIds.includes(id)
53974
+ );
53975
+ setDisabledValues(uniqDisabledValues);
53976
+ }
53961
53977
  setEnableSublocations(!enableSublocations);
53962
- }, [enableSublocations]);
53978
+ }, [enableSublocations, value, selectedValueIds, options]);
53963
53979
  const I18n = coreReact.useI18nContext();
53964
53980
  const selectRef = React76__default.default.useRef(null);
53965
53981
  const onSelectAll = React76__default.default.useCallback(() => {
@@ -53975,17 +53991,47 @@ var ServerSideLocationFilterRenderer = React76__default.default.forwardRef(
53975
53991
  }
53976
53992
  }, [options, selectState, selectedValueIds]);
53977
53993
  const onSelect = (selection) => {
53978
- if (selection.item.id === "select_all" || selection.item.id === "include_sublocations") {
53994
+ if (selection.item.id === "select_all") {
53979
53995
  return;
53980
53996
  }
53981
- let newSelections = selectedValueIds.includes(getId3(selection.item)) ? removeSelections(selection.item, value) : [
53982
- ...value,
53983
- ...handleSelectSublocations(selection.item),
53984
- selection.item
53985
- ];
53997
+ if (selection.item.id === "include_sublocations") {
53998
+ return onChange(
53999
+ value.map((item) => ({
54000
+ ...item,
54001
+ sublocations: enableSublocations ? [] : findSublocations(item)
54002
+ }))
54003
+ );
54004
+ }
54005
+ let newSelections = [];
54006
+ if (selectedValueIds.includes(getId3(selection.item))) {
54007
+ newSelections = removeSelections(selection.item, value);
54008
+ } else {
54009
+ newSelections = [...value, selection.item];
54010
+ const sublocationsToDisable = handleSelectSublocations(selection.item);
54011
+ const newDisabledValues = [
54012
+ ...disabledValues,
54013
+ ...sublocationsToDisable.filter(
54014
+ ({ id }) => !selectedValueIds.includes(id)
54015
+ )
54016
+ ];
54017
+ setDisabledValues(newDisabledValues);
54018
+ }
53986
54019
  setSelectState(determineSelectedState(newSelections));
53987
54020
  setSelectedValueIds(newSelections.map(({ id }) => id));
53988
- onChange(newSelections);
54021
+ onChange(
54022
+ newSelections.map((item) => ({
54023
+ ...item,
54024
+ sublocations: handleSelectSublocations(item)
54025
+ }))
54026
+ );
54027
+ };
54028
+ const findSublocations = (selected) => {
54029
+ return options.filter((option) => {
54030
+ return ramda.startsWith(
54031
+ `${getLabel3(selected).toLowerCase()} > `,
54032
+ getLabel3(option).toLowerCase()
54033
+ );
54034
+ });
53989
54035
  };
53990
54036
  const handleSelectSublocations = (selected) => {
53991
54037
  if (enableSublocations) {
@@ -54003,14 +54049,16 @@ var ServerSideLocationFilterRenderer = React76__default.default.forwardRef(
54003
54049
  const removeSelections = React76__default.default.useCallback(
54004
54050
  function(selection, selected) {
54005
54051
  const sublocations = handleSelectSublocations(selection);
54006
- return enableSublocations ? selected.filter(
54007
- (item) => ![
54008
- ...sublocations.map(({ id }) => id),
54009
- getId3(selection)
54010
- ].includes(item.id)
54011
- ) : selected.filter((item) => getId3(item) !== getId3(selection));
54052
+ const disabledValueIds = disabledValues.map(({ id }) => id);
54053
+ const sublocationsToRemoveFromDisabledIds = sublocations.filter(({ id }) => disabledValueIds.includes(id)).map(({ id }) => id);
54054
+ setDisabledValues(
54055
+ disabledValues.filter(
54056
+ ({ id }) => !sublocationsToRemoveFromDisabledIds.includes(id)
54057
+ )
54058
+ );
54059
+ return selected.filter((item) => getId3(item) !== getId3(selection));
54012
54060
  },
54013
- [enableSublocations]
54061
+ [enableSublocations, disabledValues]
54014
54062
  );
54015
54063
  React76__default.default.useEffect(() => {
54016
54064
  setSelectState(determineSelectedState(value));
@@ -54021,6 +54069,7 @@ var ServerSideLocationFilterRenderer = React76__default.default.forwardRef(
54021
54069
  columnDefinition,
54022
54070
  value,
54023
54071
  options,
54072
+ disabledOptions: disabledValues,
54024
54073
  enableSublocations,
54025
54074
  getId: getId3,
54026
54075
  getLabel: getLabel3,
@@ -79658,6 +79707,11 @@ var ja_JP_default = {
79658
79707
  }
79659
79708
  };
79660
79709
 
79710
+ // src/locales/pl-PL.json
79711
+ var pl_PL_default = {
79712
+ dataTable: {}
79713
+ };
79714
+
79661
79715
  // src/locales/pseudo.json
79662
79716
  var pseudo_default = {
79663
79717
  dataTable: {
@@ -80274,7 +80328,8 @@ var translations = {
80274
80328
  pseudo: pseudo_default,
80275
80329
  "pt-BR": pt_BR_default,
80276
80330
  "th-TH": th_TH_default,
80277
- "zh-SG": zh_SG_default
80331
+ "zh-SG": zh_SG_default,
80332
+ "pl-PL": pl_PL_default
80278
80333
  };
80279
80334
  var PRINCE_XML_DPI = 96;
80280
80335
  var DEFAULT_PAGE_MARGIN = 40;
@@ -83630,6 +83685,7 @@ var LocationQuickFilterOverlay = React76__default.default.forwardRef(
83630
83685
  enableSublocations,
83631
83686
  selectState,
83632
83687
  options,
83688
+ disabledOptions,
83633
83689
  columnDefinition,
83634
83690
  value
83635
83691
  }, ref) => {
@@ -83657,6 +83713,7 @@ var LocationQuickFilterOverlay = React76__default.default.forwardRef(
83657
83713
  return onSelectAll();
83658
83714
  }
83659
83715
  if (selection.item.id === includeSublocationOption.id) {
83716
+ _onSelect(selection);
83660
83717
  return onSelectSublocations();
83661
83718
  }
83662
83719
  return _onSelect(selection);
@@ -83726,8 +83783,9 @@ var LocationQuickFilterOverlay = React76__default.default.forwardRef(
83726
83783
  {
83727
83784
  key: getId3(item),
83728
83785
  item,
83729
- selected: value.map(({ id }) => id).includes(getId3(item)),
83730
- suggested: i === 0
83786
+ selected: value.map(({ id }) => id).includes(getId3(item)) || disabledOptions.map(({ id }) => id).includes(getId3(item)),
83787
+ suggested: i === 0,
83788
+ disabled: disabledOptions.map(({ id }) => id).includes(getId3(item))
83731
83789
  },
83732
83790
  getLabel3(item)
83733
83791
  );
@@ -83773,10 +83831,23 @@ var LocationQuickFilterRenderer = ({
83773
83831
  const [selectState, setSelectState] = React76__default.default.useState(
83774
83832
  determineSelectedState(value)
83775
83833
  );
83834
+ const [disabledValues, setDisabledValues] = React76__default.default.useState([]);
83776
83835
  const [enableSublocations, setEnableSublocations] = React76__default.default.useState(false);
83777
83836
  const onSelectSublocations = React76__default.default.useCallback(() => {
83837
+ if (enableSublocations) {
83838
+ setDisabledValues([]);
83839
+ } else {
83840
+ const newDisabledValues = [];
83841
+ value.forEach((location) => {
83842
+ newDisabledValues.push(...findSublocations(location));
83843
+ });
83844
+ const uniqDisabledValues = ramda.uniqBy(ramda.prop("id"), newDisabledValues).filter(
83845
+ ({ id }) => !selectedValueIds.includes(id)
83846
+ );
83847
+ setDisabledValues(uniqDisabledValues);
83848
+ }
83778
83849
  setEnableSublocations(!enableSublocations);
83779
- }, [enableSublocations]);
83850
+ }, [enableSublocations, value, selectedValueIds, options]);
83780
83851
  const onSelectAll = React76__default.default.useCallback(() => {
83781
83852
  if (selectState === "none" || selectState === "partial") {
83782
83853
  setSelectState("all");
@@ -83790,22 +83861,51 @@ var LocationQuickFilterRenderer = ({
83790
83861
  }
83791
83862
  }, [options, selectState, selectedValueIds]);
83792
83863
  const onSelect = (selection) => {
83793
- if (selection.item.id === "select_all" || selection.item.id === "include_sublocations") {
83864
+ if (selection.item.id === "select_all") {
83794
83865
  return;
83795
83866
  }
83796
- let newSelections = selectedValueIds.includes(getId3(selection.item)) ? removeSelections(selection.item, value) : [...value, ...handleSelectSublocations(selection.item), selection.item];
83867
+ if (selection.item.id === "include_sublocations") {
83868
+ return onChange(
83869
+ value.map((item) => ({
83870
+ ...item,
83871
+ sublocations: enableSublocations ? [] : findSublocations(item)
83872
+ }))
83873
+ );
83874
+ }
83875
+ let newSelections = [];
83876
+ if (selectedValueIds.includes(getId3(selection.item))) {
83877
+ newSelections = removeSelections(selection.item, value);
83878
+ } else {
83879
+ newSelections = [...value, selection.item];
83880
+ const sublocationsToDisable = handleSelectSublocations(selection.item);
83881
+ const newDisabledValues = [
83882
+ ...disabledValues,
83883
+ ...sublocationsToDisable.filter(
83884
+ ({ id }) => !selectedValueIds.includes(id)
83885
+ )
83886
+ ];
83887
+ setDisabledValues(newDisabledValues);
83888
+ }
83797
83889
  setSelectState(determineSelectedState(newSelections));
83798
83890
  setSelectedValueIds(newSelections.map(({ id }) => id));
83799
- onChange(newSelections);
83891
+ onChange(
83892
+ newSelections.map((item) => ({
83893
+ ...item,
83894
+ sublocations: handleSelectSublocations(item)
83895
+ }))
83896
+ );
83897
+ };
83898
+ const findSublocations = (selected) => {
83899
+ return options.filter((option) => {
83900
+ return ramda.startsWith(
83901
+ `${getLabel3(selected).toLowerCase()} > `,
83902
+ getLabel3(option).toLowerCase()
83903
+ );
83904
+ });
83800
83905
  };
83801
83906
  const handleSelectSublocations = (selected) => {
83802
83907
  if (enableSublocations) {
83803
- const filteredOptions = options.filter((option) => {
83804
- return ramda.startsWith(
83805
- `${getLabel3(selected).toLowerCase()} > `,
83806
- getLabel3(option).toLowerCase()
83807
- );
83808
- });
83908
+ const filteredOptions = findSublocations(selected);
83809
83909
  return filteredOptions;
83810
83910
  } else {
83811
83911
  return [];
@@ -83814,13 +83914,16 @@ var LocationQuickFilterRenderer = ({
83814
83914
  const removeSelections = React76__default.default.useCallback(
83815
83915
  function(selection, selected) {
83816
83916
  const sublocations = handleSelectSublocations(selection);
83817
- return enableSublocations ? selected.filter(
83818
- (item) => ![...sublocations.map(({ id }) => id), getId3(selection)].includes(
83819
- item.id
83917
+ const disabledValueIds = disabledValues.map(({ id }) => id);
83918
+ const sublocationsToRemoveFromDisabledIds = sublocations.filter(({ id }) => disabledValueIds.includes(id)).map(({ id }) => id);
83919
+ setDisabledValues(
83920
+ disabledValues.filter(
83921
+ ({ id }) => !sublocationsToRemoveFromDisabledIds.includes(id)
83820
83922
  )
83821
- ) : selected.filter((item) => getId3(item) !== getId3(selection));
83923
+ );
83924
+ return selected.filter((item) => getId3(item) !== getId3(selection));
83822
83925
  },
83823
- [enableSublocations]
83926
+ [enableSublocations, disabledValues]
83824
83927
  );
83825
83928
  React76__default.default.useEffect(() => {
83826
83929
  setSelectState(determineSelectedState(value));
@@ -83835,6 +83938,7 @@ var LocationQuickFilterRenderer = ({
83835
83938
  selectState,
83836
83939
  value,
83837
83940
  options,
83941
+ disabledOptions: disabledValues,
83838
83942
  getId: getId3,
83839
83943
  getLabel: getLabel3,
83840
83944
  loading,
@@ -1175,6 +1175,7 @@ interface LocationOption {
1175
1175
  label?: string;
1176
1176
  name?: string;
1177
1177
  id: string | number;
1178
+ sublocations?: Omit<LocationOption, 'sublocations'>[];
1178
1179
  }
1179
1180
  declare const LocationFilterRenderer: (props: LocationFilterProps) => React__default.JSX.Element | null;
1180
1181
 
@@ -1175,6 +1175,7 @@ interface LocationOption {
1175
1175
  label?: string;
1176
1176
  name?: string;
1177
1177
  id: string | number;
1178
+ sublocations?: Omit<LocationOption, 'sublocations'>[];
1178
1179
  }
1179
1180
  declare const LocationFilterRenderer: (props: LocationFilterProps) => React__default.JSX.Element | null;
1180
1181