@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.
@@ -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;
@@ -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,
@@ -79796,6 +79845,11 @@ var ja_JP_default = {
79796
79845
  }
79797
79846
  };
79798
79847
 
79848
+ // src/locales/pl-PL.json
79849
+ var pl_PL_default = {
79850
+ dataTable: {}
79851
+ };
79852
+
79799
79853
  // src/locales/pseudo.json
79800
79854
  var pseudo_default = {
79801
79855
  dataTable: {
@@ -80412,7 +80466,8 @@ var translations = {
80412
80466
  pseudo: pseudo_default,
80413
80467
  "pt-BR": pt_BR_default,
80414
80468
  "th-TH": th_TH_default,
80415
- "zh-SG": zh_SG_default
80469
+ "zh-SG": zh_SG_default,
80470
+ "pl-PL": pl_PL_default
80416
80471
  };
80417
80472
  var PRINCE_XML_DPI = 96;
80418
80473
  var DEFAULT_PAGE_MARGIN = 40;
@@ -83840,6 +83895,7 @@ var LocationQuickFilterOverlay = React76.forwardRef(
83840
83895
  enableSublocations,
83841
83896
  selectState,
83842
83897
  options,
83898
+ disabledOptions,
83843
83899
  columnDefinition,
83844
83900
  value
83845
83901
  }, ref) => {
@@ -83867,6 +83923,7 @@ var LocationQuickFilterOverlay = React76.forwardRef(
83867
83923
  return onSelectAll();
83868
83924
  }
83869
83925
  if (selection.item.id === includeSublocationOption.id) {
83926
+ _onSelect(selection);
83870
83927
  return onSelectSublocations();
83871
83928
  }
83872
83929
  return _onSelect(selection);
@@ -83937,8 +83994,9 @@ var LocationQuickFilterOverlay = React76.forwardRef(
83937
83994
  {
83938
83995
  key: getId3(item),
83939
83996
  item,
83940
- selected: value.map(({ id }) => id).includes(getId3(item)),
83941
- suggested: i === 0
83997
+ selected: value.map(({ id }) => id).includes(getId3(item)) || disabledOptions.map(({ id }) => id).includes(getId3(item)),
83998
+ suggested: i === 0,
83999
+ disabled: disabledOptions.map(({ id }) => id).includes(getId3(item))
83942
84000
  },
83943
84001
  getLabel3(item)
83944
84002
  );
@@ -83985,10 +84043,23 @@ var LocationQuickFilterRenderer = ({
83985
84043
  const [selectState, setSelectState] = React76.useState(
83986
84044
  determineSelectedState(value)
83987
84045
  );
84046
+ const [disabledValues, setDisabledValues] = React76.useState([]);
83988
84047
  const [enableSublocations, setEnableSublocations] = React76.useState(false);
83989
84048
  const onSelectSublocations = React76.useCallback(() => {
84049
+ if (enableSublocations) {
84050
+ setDisabledValues([]);
84051
+ } else {
84052
+ const newDisabledValues = [];
84053
+ value.forEach((location) => {
84054
+ newDisabledValues.push(...findSublocations(location));
84055
+ });
84056
+ const uniqDisabledValues = uniqBy(prop("id"), newDisabledValues).filter(
84057
+ ({ id }) => !selectedValueIds.includes(id)
84058
+ );
84059
+ setDisabledValues(uniqDisabledValues);
84060
+ }
83990
84061
  setEnableSublocations(!enableSublocations);
83991
- }, [enableSublocations]);
84062
+ }, [enableSublocations, value, selectedValueIds, options]);
83992
84063
  const onSelectAll = React76.useCallback(() => {
83993
84064
  if (selectState === "none" || selectState === "partial") {
83994
84065
  setSelectState("all");
@@ -84002,22 +84073,51 @@ var LocationQuickFilterRenderer = ({
84002
84073
  }
84003
84074
  }, [options, selectState, selectedValueIds]);
84004
84075
  const onSelect = (selection) => {
84005
- if (selection.item.id === "select_all" || selection.item.id === "include_sublocations") {
84076
+ if (selection.item.id === "select_all") {
84006
84077
  return;
84007
84078
  }
84008
- let newSelections = selectedValueIds.includes(getId3(selection.item)) ? removeSelections(selection.item, value) : [...value, ...handleSelectSublocations(selection.item), selection.item];
84079
+ if (selection.item.id === "include_sublocations") {
84080
+ return onChange(
84081
+ value.map((item) => ({
84082
+ ...item,
84083
+ sublocations: enableSublocations ? [] : findSublocations(item)
84084
+ }))
84085
+ );
84086
+ }
84087
+ let newSelections = [];
84088
+ if (selectedValueIds.includes(getId3(selection.item))) {
84089
+ newSelections = removeSelections(selection.item, value);
84090
+ } else {
84091
+ newSelections = [...value, selection.item];
84092
+ const sublocationsToDisable = handleSelectSublocations(selection.item);
84093
+ const newDisabledValues = [
84094
+ ...disabledValues,
84095
+ ...sublocationsToDisable.filter(
84096
+ ({ id }) => !selectedValueIds.includes(id)
84097
+ )
84098
+ ];
84099
+ setDisabledValues(newDisabledValues);
84100
+ }
84009
84101
  setSelectState(determineSelectedState(newSelections));
84010
84102
  setSelectedValueIds(newSelections.map(({ id }) => id));
84011
- onChange(newSelections);
84103
+ onChange(
84104
+ newSelections.map((item) => ({
84105
+ ...item,
84106
+ sublocations: handleSelectSublocations(item)
84107
+ }))
84108
+ );
84109
+ };
84110
+ const findSublocations = (selected) => {
84111
+ return options.filter((option) => {
84112
+ return startsWith(
84113
+ `${getLabel3(selected).toLowerCase()} > `,
84114
+ getLabel3(option).toLowerCase()
84115
+ );
84116
+ });
84012
84117
  };
84013
84118
  const handleSelectSublocations = (selected) => {
84014
84119
  if (enableSublocations) {
84015
- const filteredOptions = options.filter((option) => {
84016
- return startsWith(
84017
- `${getLabel3(selected).toLowerCase()} > `,
84018
- getLabel3(option).toLowerCase()
84019
- );
84020
- });
84120
+ const filteredOptions = findSublocations(selected);
84021
84121
  return filteredOptions;
84022
84122
  } else {
84023
84123
  return [];
@@ -84026,13 +84126,16 @@ var LocationQuickFilterRenderer = ({
84026
84126
  const removeSelections = React76.useCallback(
84027
84127
  function(selection, selected) {
84028
84128
  const sublocations = handleSelectSublocations(selection);
84029
- return enableSublocations ? selected.filter(
84030
- (item) => ![...sublocations.map(({ id }) => id), getId3(selection)].includes(
84031
- item.id
84129
+ const disabledValueIds = disabledValues.map(({ id }) => id);
84130
+ const sublocationsToRemoveFromDisabledIds = sublocations.filter(({ id }) => disabledValueIds.includes(id)).map(({ id }) => id);
84131
+ setDisabledValues(
84132
+ disabledValues.filter(
84133
+ ({ id }) => !sublocationsToRemoveFromDisabledIds.includes(id)
84032
84134
  )
84033
- ) : selected.filter((item) => getId3(item) !== getId3(selection));
84135
+ );
84136
+ return selected.filter((item) => getId3(item) !== getId3(selection));
84034
84137
  },
84035
- [enableSublocations]
84138
+ [enableSublocations, disabledValues]
84036
84139
  );
84037
84140
  React76.useEffect(() => {
84038
84141
  setSelectState(determineSelectedState(value));
@@ -84047,6 +84150,7 @@ var LocationQuickFilterRenderer = ({
84047
84150
  selectState,
84048
84151
  value,
84049
84152
  options,
84153
+ disabledOptions: disabledValues,
84050
84154
  getId: getId3,
84051
84155
  getLabel: getLabel3,
84052
84156
  loading,