@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.
- package/CHANGELOG.md +12 -0
- package/dist/legacy/index.cjs +176 -61
- package/dist/legacy/index.d.cts +2 -1
- package/dist/legacy/index.d.ts +2 -1
- package/dist/legacy/index.js +177 -62
- package/dist/modern/index.cjs +176 -61
- package/dist/modern/index.d.cts +2 -1
- package/dist/modern/index.d.ts +2 -1
- package/dist/modern/index.js +177 -62
- package/package.json +2 -2
package/dist/legacy/index.js
CHANGED
|
@@ -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';
|
|
@@ -8014,7 +8014,7 @@ var InternalBooleanCellEditor = React76.forwardRef(({ columnDefinition, setDataV
|
|
|
8014
8014
|
return /* @__PURE__ */ React76.createElement(
|
|
8015
8015
|
Select,
|
|
8016
8016
|
{
|
|
8017
|
-
afterHide: stopEditing,
|
|
8017
|
+
afterHide: () => stopEditing(),
|
|
8018
8018
|
block: true,
|
|
8019
8019
|
className: cx("input-cell"),
|
|
8020
8020
|
label: value ? I18n.t("dataTable.cells.booleanCell.options.yes") : I18n.t("dataTable.cells.booleanCell.options.no"),
|
|
@@ -8235,8 +8235,8 @@ var Editor = React76.forwardRef(
|
|
|
8235
8235
|
if (isEmptyValue(value) && !columnDefinition.editable) {
|
|
8236
8236
|
return null;
|
|
8237
8237
|
}
|
|
8238
|
-
function onBlur() {
|
|
8239
|
-
stopEditing();
|
|
8238
|
+
function onBlur(event) {
|
|
8239
|
+
stopEditing(ensureIsHTMLElement(event.relatedTarget));
|
|
8240
8240
|
}
|
|
8241
8241
|
const defaultValue = eventKey ? value : formatNumber(value, {
|
|
8242
8242
|
...((_a = columnDefinition.cellEditorParams) == null ? void 0 : _a.formatConfig) ?? ((_b = columnDefinition.cellRendererParams) == null ? void 0 : _b.formatConfig) ?? {},
|
|
@@ -8679,8 +8679,8 @@ var DateCellRenderer = withDataTableRenderer(Renderer4, "date");
|
|
|
8679
8679
|
var Editor2 = React76.forwardRef(
|
|
8680
8680
|
({ columnDefinition, setDataValue, stopEditing, value }, ref) => {
|
|
8681
8681
|
var _a, _b;
|
|
8682
|
-
function afterHide() {
|
|
8683
|
-
stopEditing();
|
|
8682
|
+
function afterHide(event) {
|
|
8683
|
+
stopEditing(ensureIsHTMLElement(event == null ? void 0 : event.target));
|
|
8684
8684
|
}
|
|
8685
8685
|
function onChange(date) {
|
|
8686
8686
|
if (date) {
|
|
@@ -8753,8 +8753,8 @@ var DateTimeCellRenderer = withDataTableRenderer(Renderer5, "date");
|
|
|
8753
8753
|
var Editor3 = React76.forwardRef(
|
|
8754
8754
|
({ columnDefinition, setDataValue, stopEditing, value }, ref) => {
|
|
8755
8755
|
var _a, _b;
|
|
8756
|
-
function afterHide() {
|
|
8757
|
-
stopEditing();
|
|
8756
|
+
function afterHide(event) {
|
|
8757
|
+
stopEditing(ensureIsHTMLElement(event == null ? void 0 : event.target));
|
|
8758
8758
|
}
|
|
8759
8759
|
function onChange(date) {
|
|
8760
8760
|
if (date) {
|
|
@@ -12804,8 +12804,8 @@ var GridOptionsValidator = class GridOptionsValidator2 {
|
|
|
12804
12804
|
enterMovesDownAfterEdit: { version: "30", newProp: "enterNavigatesVerticallyAfterEdit", copyToNewProp: true }
|
|
12805
12805
|
};
|
|
12806
12806
|
}
|
|
12807
|
-
pickOneWarning(prop1,
|
|
12808
|
-
console.warn(`AG Grid: ${prop1} and ${
|
|
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 = (
|
|
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 = (
|
|
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(([
|
|
52170
|
+
].some(([prop3, comparisonValue]) => this.doesColDefPropPreventInference(colDef, propsToCheckForInference, prop3, comparisonValue));
|
|
52171
52171
|
}
|
|
52172
|
-
doesColDefPropPreventInference(colDef, checkProps,
|
|
52173
|
-
if (!checkProps[
|
|
52172
|
+
doesColDefPropPreventInference(colDef, checkProps, prop3, comparisonValue) {
|
|
52173
|
+
if (!checkProps[prop3]) {
|
|
52174
52174
|
return false;
|
|
52175
52175
|
}
|
|
52176
|
-
const value = colDef[
|
|
52176
|
+
const value = colDef[prop3];
|
|
52177
52177
|
if (value === null) {
|
|
52178
|
-
checkProps[
|
|
52178
|
+
checkProps[prop3] = false;
|
|
52179
52179
|
return false;
|
|
52180
52180
|
} else {
|
|
52181
52181
|
return comparisonValue === void 0 ? !!value : value === comparisonValue;
|
|
@@ -53029,8 +53029,8 @@ var InternalNumberCellEditor = React76.forwardRef(({ columnDefinition, stopEditi
|
|
|
53029
53029
|
if (isEmptyValue(value) && !columnDefinition.editable) {
|
|
53030
53030
|
return null;
|
|
53031
53031
|
}
|
|
53032
|
-
function onBlur() {
|
|
53033
|
-
stopEditing();
|
|
53032
|
+
function onBlur(event) {
|
|
53033
|
+
stopEditing(ensureIsHTMLElement(event.relatedTarget));
|
|
53034
53034
|
}
|
|
53035
53035
|
return /* @__PURE__ */ React76.createElement(
|
|
53036
53036
|
Input,
|
|
@@ -53321,8 +53321,8 @@ var PercentCellRenderer = withDataTableRenderer(Renderer7, "input");
|
|
|
53321
53321
|
var Editor4 = React76.forwardRef(({ columnDefinition, eventKey, stopEditing, value }, ref) => {
|
|
53322
53322
|
var _a, _b, _c, _d, _e;
|
|
53323
53323
|
const I18n = useI18nContext();
|
|
53324
|
-
function onBlur() {
|
|
53325
|
-
stopEditing();
|
|
53324
|
+
function onBlur(event) {
|
|
53325
|
+
stopEditing(ensureIsHTMLElement(event.relatedTarget));
|
|
53326
53326
|
}
|
|
53327
53327
|
if (isEmptyValue(value) && !columnDefinition.editable) {
|
|
53328
53328
|
return null;
|
|
@@ -53727,8 +53727,8 @@ var TextCellRenderer = withDataTableRenderer(Renderer11, "input");
|
|
|
53727
53727
|
var Editor7 = React76.forwardRef(
|
|
53728
53728
|
({ columnDefinition, eventKey, stopEditing, value }, ref) => {
|
|
53729
53729
|
var _a, _b, _c, _d;
|
|
53730
|
-
function onBlur() {
|
|
53731
|
-
stopEditing();
|
|
53730
|
+
function onBlur(event) {
|
|
53731
|
+
stopEditing(ensureIsHTMLElement(event.relatedTarget));
|
|
53732
53732
|
}
|
|
53733
53733
|
const I18n = useI18nContext();
|
|
53734
53734
|
const internalValue = eventKey ? value : ((_a = columnDefinition.getStringFormattedValue) == null ? void 0 : _a.call(columnDefinition, value)) ?? value;
|
|
@@ -53801,8 +53801,8 @@ var Renderer12 = ({
|
|
|
53801
53801
|
var Editor8 = React76.forwardRef(
|
|
53802
53802
|
({ columnDefinition, stopEditing, value }, ref) => {
|
|
53803
53803
|
var _a, _b, _c, _d;
|
|
53804
|
-
function onBlur() {
|
|
53805
|
-
stopEditing();
|
|
53804
|
+
function onBlur(event) {
|
|
53805
|
+
stopEditing(ensureIsHTMLElement(event.relatedTarget));
|
|
53806
53806
|
}
|
|
53807
53807
|
const I18n = useI18nContext();
|
|
53808
53808
|
const internalValue = ((_a = columnDefinition.getStringFormattedValue) == null ? void 0 : _a.call(columnDefinition, value)) ?? value;
|
|
@@ -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"
|
|
54024
|
+
if (selection.item.id === "select_all") {
|
|
54009
54025
|
return;
|
|
54010
54026
|
}
|
|
54011
|
-
|
|
54012
|
-
|
|
54013
|
-
|
|
54014
|
-
|
|
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(
|
|
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
|
-
|
|
54037
|
-
|
|
54038
|
-
|
|
54039
|
-
|
|
54040
|
-
|
|
54041
|
-
|
|
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,
|
|
@@ -56056,7 +56105,14 @@ var DataTableCellEditor = React76.forwardRef(
|
|
|
56056
56105
|
node.setDataValue(field, newValue);
|
|
56057
56106
|
setCurrentValue(newValue);
|
|
56058
56107
|
},
|
|
56059
|
-
stopEditing
|
|
56108
|
+
stopEditing: (relatedTarget) => {
|
|
56109
|
+
const isRelatedTargetOutsideTable = (relatedTarget == null ? void 0 : relatedTarget.closest('[data-qa="data-table-table')) === null;
|
|
56110
|
+
stopEditing(isRelatedTargetOutsideTable);
|
|
56111
|
+
if (isRelatedTargetOutsideTable) {
|
|
56112
|
+
api.clearFocusedCell();
|
|
56113
|
+
relatedTarget.focus();
|
|
56114
|
+
}
|
|
56115
|
+
},
|
|
56060
56116
|
tableApi: tableRef == null ? void 0 : tableRef.current,
|
|
56061
56117
|
value: currentValue,
|
|
56062
56118
|
ref: handleRefs(editorType)
|
|
@@ -56938,6 +56994,9 @@ function withDataTableRenderer(Component4, editorType) {
|
|
|
56938
56994
|
}
|
|
56939
56995
|
);
|
|
56940
56996
|
}
|
|
56997
|
+
function ensureIsHTMLElement(element) {
|
|
56998
|
+
return element instanceof HTMLElement ? element : null;
|
|
56999
|
+
}
|
|
56941
57000
|
function getGroupNodes(params) {
|
|
56942
57001
|
var _a, _b;
|
|
56943
57002
|
const currentParentId = ((_b = (_a = params.node) == null ? void 0 : _a.parent) == null ? void 0 : _b.id) ?? "root";
|
|
@@ -57186,7 +57245,7 @@ var MultiSelectEditor = React76.forwardRef(({ columnDefinition, value = [], setD
|
|
|
57186
57245
|
MultiSelect,
|
|
57187
57246
|
{
|
|
57188
57247
|
beforeShow,
|
|
57189
|
-
afterHide: stopEditing,
|
|
57248
|
+
afterHide: () => stopEditing(),
|
|
57190
57249
|
block: true,
|
|
57191
57250
|
loading: isSearching || loading,
|
|
57192
57251
|
getId: (option) => {
|
|
@@ -79786,6 +79845,11 @@ var ja_JP_default = {
|
|
|
79786
79845
|
}
|
|
79787
79846
|
};
|
|
79788
79847
|
|
|
79848
|
+
// src/locales/pl-PL.json
|
|
79849
|
+
var pl_PL_default = {
|
|
79850
|
+
dataTable: {}
|
|
79851
|
+
};
|
|
79852
|
+
|
|
79789
79853
|
// src/locales/pseudo.json
|
|
79790
79854
|
var pseudo_default = {
|
|
79791
79855
|
dataTable: {
|
|
@@ -80402,7 +80466,8 @@ var translations = {
|
|
|
80402
80466
|
pseudo: pseudo_default,
|
|
80403
80467
|
"pt-BR": pt_BR_default,
|
|
80404
80468
|
"th-TH": th_TH_default,
|
|
80405
|
-
"zh-SG": zh_SG_default
|
|
80469
|
+
"zh-SG": zh_SG_default,
|
|
80470
|
+
"pl-PL": pl_PL_default
|
|
80406
80471
|
};
|
|
80407
80472
|
var PRINCE_XML_DPI = 96;
|
|
80408
80473
|
var DEFAULT_PAGE_MARGIN = 40;
|
|
@@ -82332,6 +82397,7 @@ var Table = (props) => {
|
|
|
82332
82397
|
return /* @__PURE__ */ React76.createElement(
|
|
82333
82398
|
Spinner,
|
|
82334
82399
|
{
|
|
82400
|
+
"data-qa": "data-table-table",
|
|
82335
82401
|
loading: loadingStatus.loading,
|
|
82336
82402
|
label: loadingStatus.message,
|
|
82337
82403
|
style: {
|
|
@@ -83829,6 +83895,7 @@ var LocationQuickFilterOverlay = React76.forwardRef(
|
|
|
83829
83895
|
enableSublocations,
|
|
83830
83896
|
selectState,
|
|
83831
83897
|
options,
|
|
83898
|
+
disabledOptions,
|
|
83832
83899
|
columnDefinition,
|
|
83833
83900
|
value
|
|
83834
83901
|
}, ref) => {
|
|
@@ -83856,6 +83923,7 @@ var LocationQuickFilterOverlay = React76.forwardRef(
|
|
|
83856
83923
|
return onSelectAll();
|
|
83857
83924
|
}
|
|
83858
83925
|
if (selection.item.id === includeSublocationOption.id) {
|
|
83926
|
+
_onSelect(selection);
|
|
83859
83927
|
return onSelectSublocations();
|
|
83860
83928
|
}
|
|
83861
83929
|
return _onSelect(selection);
|
|
@@ -83926,8 +83994,9 @@ var LocationQuickFilterOverlay = React76.forwardRef(
|
|
|
83926
83994
|
{
|
|
83927
83995
|
key: getId3(item),
|
|
83928
83996
|
item,
|
|
83929
|
-
selected: value.map(({ id }) => id).includes(getId3(item)),
|
|
83930
|
-
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))
|
|
83931
84000
|
},
|
|
83932
84001
|
getLabel3(item)
|
|
83933
84002
|
);
|
|
@@ -83974,10 +84043,23 @@ var LocationQuickFilterRenderer = ({
|
|
|
83974
84043
|
const [selectState, setSelectState] = React76.useState(
|
|
83975
84044
|
determineSelectedState(value)
|
|
83976
84045
|
);
|
|
84046
|
+
const [disabledValues, setDisabledValues] = React76.useState([]);
|
|
83977
84047
|
const [enableSublocations, setEnableSublocations] = React76.useState(false);
|
|
83978
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
|
+
}
|
|
83979
84061
|
setEnableSublocations(!enableSublocations);
|
|
83980
|
-
}, [enableSublocations]);
|
|
84062
|
+
}, [enableSublocations, value, selectedValueIds, options]);
|
|
83981
84063
|
const onSelectAll = React76.useCallback(() => {
|
|
83982
84064
|
if (selectState === "none" || selectState === "partial") {
|
|
83983
84065
|
setSelectState("all");
|
|
@@ -83991,22 +84073,51 @@ var LocationQuickFilterRenderer = ({
|
|
|
83991
84073
|
}
|
|
83992
84074
|
}, [options, selectState, selectedValueIds]);
|
|
83993
84075
|
const onSelect = (selection) => {
|
|
83994
|
-
if (selection.item.id === "select_all"
|
|
84076
|
+
if (selection.item.id === "select_all") {
|
|
83995
84077
|
return;
|
|
83996
84078
|
}
|
|
83997
|
-
|
|
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
|
+
}
|
|
83998
84101
|
setSelectState(determineSelectedState(newSelections));
|
|
83999
84102
|
setSelectedValueIds(newSelections.map(({ id }) => id));
|
|
84000
|
-
onChange(
|
|
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
|
+
});
|
|
84001
84117
|
};
|
|
84002
84118
|
const handleSelectSublocations = (selected) => {
|
|
84003
84119
|
if (enableSublocations) {
|
|
84004
|
-
const filteredOptions =
|
|
84005
|
-
return startsWith(
|
|
84006
|
-
`${getLabel3(selected).toLowerCase()} > `,
|
|
84007
|
-
getLabel3(option).toLowerCase()
|
|
84008
|
-
);
|
|
84009
|
-
});
|
|
84120
|
+
const filteredOptions = findSublocations(selected);
|
|
84010
84121
|
return filteredOptions;
|
|
84011
84122
|
} else {
|
|
84012
84123
|
return [];
|
|
@@ -84015,13 +84126,16 @@ var LocationQuickFilterRenderer = ({
|
|
|
84015
84126
|
const removeSelections = React76.useCallback(
|
|
84016
84127
|
function(selection, selected) {
|
|
84017
84128
|
const sublocations = handleSelectSublocations(selection);
|
|
84018
|
-
|
|
84019
|
-
|
|
84020
|
-
|
|
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)
|
|
84021
84134
|
)
|
|
84022
|
-
)
|
|
84135
|
+
);
|
|
84136
|
+
return selected.filter((item) => getId3(item) !== getId3(selection));
|
|
84023
84137
|
},
|
|
84024
|
-
[enableSublocations]
|
|
84138
|
+
[enableSublocations, disabledValues]
|
|
84025
84139
|
);
|
|
84026
84140
|
React76.useEffect(() => {
|
|
84027
84141
|
setSelectState(determineSelectedState(value));
|
|
@@ -84036,6 +84150,7 @@ var LocationQuickFilterRenderer = ({
|
|
|
84036
84150
|
selectState,
|
|
84037
84151
|
value,
|
|
84038
84152
|
options,
|
|
84153
|
+
disabledOptions: disabledValues,
|
|
84039
84154
|
getId: getId3,
|
|
84040
84155
|
getLabel: getLabel3,
|
|
84041
84156
|
loading,
|