@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/modern/index.cjs
CHANGED
|
@@ -8025,7 +8025,7 @@ var InternalBooleanCellEditor = React76__default.default.forwardRef(({ columnDef
|
|
|
8025
8025
|
return /* @__PURE__ */ React76__default.default.createElement(
|
|
8026
8026
|
coreReact.Select,
|
|
8027
8027
|
{
|
|
8028
|
-
afterHide: stopEditing,
|
|
8028
|
+
afterHide: () => stopEditing(),
|
|
8029
8029
|
block: true,
|
|
8030
8030
|
className: cx("input-cell"),
|
|
8031
8031
|
label: value ? I18n.t("dataTable.cells.booleanCell.options.yes") : I18n.t("dataTable.cells.booleanCell.options.no"),
|
|
@@ -8243,8 +8243,8 @@ var Editor = React76__default.default.forwardRef(
|
|
|
8243
8243
|
if (isEmptyValue(value) && !columnDefinition.editable) {
|
|
8244
8244
|
return null;
|
|
8245
8245
|
}
|
|
8246
|
-
function onBlur() {
|
|
8247
|
-
stopEditing();
|
|
8246
|
+
function onBlur(event) {
|
|
8247
|
+
stopEditing(ensureIsHTMLElement(event.relatedTarget));
|
|
8248
8248
|
}
|
|
8249
8249
|
const defaultValue = eventKey ? value : labsFinancialsUtils.formatNumber(value, {
|
|
8250
8250
|
...columnDefinition.cellEditorParams?.formatConfig ?? columnDefinition.cellRendererParams?.formatConfig ?? {},
|
|
@@ -8682,8 +8682,8 @@ var Renderer4 = (props) => {
|
|
|
8682
8682
|
var DateCellRenderer = withDataTableRenderer(Renderer4, "date");
|
|
8683
8683
|
var Editor2 = React76__default.default.forwardRef(
|
|
8684
8684
|
({ columnDefinition, setDataValue, stopEditing, value }, ref) => {
|
|
8685
|
-
function afterHide() {
|
|
8686
|
-
stopEditing();
|
|
8685
|
+
function afterHide(event) {
|
|
8686
|
+
stopEditing(ensureIsHTMLElement(event?.target));
|
|
8687
8687
|
}
|
|
8688
8688
|
function onChange(date) {
|
|
8689
8689
|
if (date) {
|
|
@@ -8753,8 +8753,8 @@ var Renderer5 = (props) => {
|
|
|
8753
8753
|
var DateTimeCellRenderer = withDataTableRenderer(Renderer5, "date");
|
|
8754
8754
|
var Editor3 = React76__default.default.forwardRef(
|
|
8755
8755
|
({ columnDefinition, setDataValue, stopEditing, value }, ref) => {
|
|
8756
|
-
function afterHide() {
|
|
8757
|
-
stopEditing();
|
|
8756
|
+
function afterHide(event) {
|
|
8757
|
+
stopEditing(ensureIsHTMLElement(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;
|
|
@@ -53026,8 +53026,8 @@ var InternalNumberCellEditor = React76__default.default.forwardRef(({ columnDefi
|
|
|
53026
53026
|
if (isEmptyValue(value) && !columnDefinition.editable) {
|
|
53027
53027
|
return null;
|
|
53028
53028
|
}
|
|
53029
|
-
function onBlur() {
|
|
53030
|
-
stopEditing();
|
|
53029
|
+
function onBlur(event) {
|
|
53030
|
+
stopEditing(ensureIsHTMLElement(event.relatedTarget));
|
|
53031
53031
|
}
|
|
53032
53032
|
return /* @__PURE__ */ React76__default.default.createElement(
|
|
53033
53033
|
coreReact.Input,
|
|
@@ -53310,8 +53310,8 @@ var Renderer7 = ({
|
|
|
53310
53310
|
var PercentCellRenderer = withDataTableRenderer(Renderer7, "input");
|
|
53311
53311
|
var Editor4 = React76__default.default.forwardRef(({ columnDefinition, eventKey, stopEditing, value }, ref) => {
|
|
53312
53312
|
const I18n = coreReact.useI18nContext();
|
|
53313
|
-
function onBlur() {
|
|
53314
|
-
stopEditing();
|
|
53313
|
+
function onBlur(event) {
|
|
53314
|
+
stopEditing(ensureIsHTMLElement(event.relatedTarget));
|
|
53315
53315
|
}
|
|
53316
53316
|
if (isEmptyValue(value) && !columnDefinition.editable) {
|
|
53317
53317
|
return null;
|
|
@@ -53702,8 +53702,8 @@ var Renderer11 = ({
|
|
|
53702
53702
|
var TextCellRenderer = withDataTableRenderer(Renderer11, "input");
|
|
53703
53703
|
var Editor7 = React76__default.default.forwardRef(
|
|
53704
53704
|
({ columnDefinition, eventKey, stopEditing, value }, ref) => {
|
|
53705
|
-
function onBlur() {
|
|
53706
|
-
stopEditing();
|
|
53705
|
+
function onBlur(event) {
|
|
53706
|
+
stopEditing(ensureIsHTMLElement(event.relatedTarget));
|
|
53707
53707
|
}
|
|
53708
53708
|
const I18n = coreReact.useI18nContext();
|
|
53709
53709
|
const internalValue = eventKey ? value : columnDefinition.getStringFormattedValue?.(value) ?? value;
|
|
@@ -53773,8 +53773,8 @@ var Renderer12 = ({
|
|
|
53773
53773
|
};
|
|
53774
53774
|
var Editor8 = React76__default.default.forwardRef(
|
|
53775
53775
|
({ columnDefinition, stopEditing, value }, ref) => {
|
|
53776
|
-
function onBlur() {
|
|
53777
|
-
stopEditing();
|
|
53776
|
+
function onBlur(event) {
|
|
53777
|
+
stopEditing(ensureIsHTMLElement(event.relatedTarget));
|
|
53778
53778
|
}
|
|
53779
53779
|
const I18n = coreReact.useI18nContext();
|
|
53780
53780
|
const internalValue = columnDefinition.getStringFormattedValue?.(value) ?? value;
|
|
@@ -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"
|
|
53994
|
+
if (selection.item.id === "select_all") {
|
|
53979
53995
|
return;
|
|
53980
53996
|
}
|
|
53981
|
-
|
|
53982
|
-
|
|
53983
|
-
|
|
53984
|
-
|
|
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(
|
|
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
|
-
|
|
54007
|
-
|
|
54008
|
-
|
|
54009
|
-
|
|
54010
|
-
|
|
54011
|
-
|
|
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,
|
|
@@ -55984,7 +56033,14 @@ var DataTableCellEditor = React76__default.default.forwardRef(
|
|
|
55984
56033
|
node.setDataValue(field, newValue);
|
|
55985
56034
|
setCurrentValue(newValue);
|
|
55986
56035
|
},
|
|
55987
|
-
stopEditing
|
|
56036
|
+
stopEditing: (relatedTarget) => {
|
|
56037
|
+
const isRelatedTargetOutsideTable = relatedTarget?.closest('[data-qa="data-table-table') === null;
|
|
56038
|
+
stopEditing(isRelatedTargetOutsideTable);
|
|
56039
|
+
if (isRelatedTargetOutsideTable) {
|
|
56040
|
+
api.clearFocusedCell();
|
|
56041
|
+
relatedTarget.focus();
|
|
56042
|
+
}
|
|
56043
|
+
},
|
|
55988
56044
|
tableApi: tableRef?.current,
|
|
55989
56045
|
value: currentValue,
|
|
55990
56046
|
ref: handleRefs(editorType)
|
|
@@ -56856,6 +56912,9 @@ function withDataTableRenderer(Component4, editorType) {
|
|
|
56856
56912
|
}
|
|
56857
56913
|
);
|
|
56858
56914
|
}
|
|
56915
|
+
function ensureIsHTMLElement(element) {
|
|
56916
|
+
return element instanceof HTMLElement ? element : null;
|
|
56917
|
+
}
|
|
56859
56918
|
function getGroupNodes(params) {
|
|
56860
56919
|
const currentParentId = params.node?.parent?.id ?? "root";
|
|
56861
56920
|
let groupNodes = {
|
|
@@ -57095,7 +57154,7 @@ var MultiSelectEditor = React76__default.default.forwardRef(({ columnDefinition,
|
|
|
57095
57154
|
coreReact.MultiSelect,
|
|
57096
57155
|
{
|
|
57097
57156
|
beforeShow,
|
|
57098
|
-
afterHide: stopEditing,
|
|
57157
|
+
afterHide: () => stopEditing(),
|
|
57099
57158
|
block: true,
|
|
57100
57159
|
loading: isSearching || loading,
|
|
57101
57160
|
getId: (option) => {
|
|
@@ -79648,6 +79707,11 @@ var ja_JP_default = {
|
|
|
79648
79707
|
}
|
|
79649
79708
|
};
|
|
79650
79709
|
|
|
79710
|
+
// src/locales/pl-PL.json
|
|
79711
|
+
var pl_PL_default = {
|
|
79712
|
+
dataTable: {}
|
|
79713
|
+
};
|
|
79714
|
+
|
|
79651
79715
|
// src/locales/pseudo.json
|
|
79652
79716
|
var pseudo_default = {
|
|
79653
79717
|
dataTable: {
|
|
@@ -80264,7 +80328,8 @@ var translations = {
|
|
|
80264
80328
|
pseudo: pseudo_default,
|
|
80265
80329
|
"pt-BR": pt_BR_default,
|
|
80266
80330
|
"th-TH": th_TH_default,
|
|
80267
|
-
"zh-SG": zh_SG_default
|
|
80331
|
+
"zh-SG": zh_SG_default,
|
|
80332
|
+
"pl-PL": pl_PL_default
|
|
80268
80333
|
};
|
|
80269
80334
|
var PRINCE_XML_DPI = 96;
|
|
80270
80335
|
var DEFAULT_PAGE_MARGIN = 40;
|
|
@@ -82145,6 +82210,7 @@ var Table = (props) => {
|
|
|
82145
82210
|
return /* @__PURE__ */ React76__default.default.createElement(
|
|
82146
82211
|
Spinner,
|
|
82147
82212
|
{
|
|
82213
|
+
"data-qa": "data-table-table",
|
|
82148
82214
|
loading: loadingStatus.loading,
|
|
82149
82215
|
label: loadingStatus.message,
|
|
82150
82216
|
style: {
|
|
@@ -83619,6 +83685,7 @@ var LocationQuickFilterOverlay = React76__default.default.forwardRef(
|
|
|
83619
83685
|
enableSublocations,
|
|
83620
83686
|
selectState,
|
|
83621
83687
|
options,
|
|
83688
|
+
disabledOptions,
|
|
83622
83689
|
columnDefinition,
|
|
83623
83690
|
value
|
|
83624
83691
|
}, ref) => {
|
|
@@ -83646,6 +83713,7 @@ var LocationQuickFilterOverlay = React76__default.default.forwardRef(
|
|
|
83646
83713
|
return onSelectAll();
|
|
83647
83714
|
}
|
|
83648
83715
|
if (selection.item.id === includeSublocationOption.id) {
|
|
83716
|
+
_onSelect(selection);
|
|
83649
83717
|
return onSelectSublocations();
|
|
83650
83718
|
}
|
|
83651
83719
|
return _onSelect(selection);
|
|
@@ -83715,8 +83783,9 @@ var LocationQuickFilterOverlay = React76__default.default.forwardRef(
|
|
|
83715
83783
|
{
|
|
83716
83784
|
key: getId3(item),
|
|
83717
83785
|
item,
|
|
83718
|
-
selected: value.map(({ id }) => id).includes(getId3(item)),
|
|
83719
|
-
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))
|
|
83720
83789
|
},
|
|
83721
83790
|
getLabel3(item)
|
|
83722
83791
|
);
|
|
@@ -83762,10 +83831,23 @@ var LocationQuickFilterRenderer = ({
|
|
|
83762
83831
|
const [selectState, setSelectState] = React76__default.default.useState(
|
|
83763
83832
|
determineSelectedState(value)
|
|
83764
83833
|
);
|
|
83834
|
+
const [disabledValues, setDisabledValues] = React76__default.default.useState([]);
|
|
83765
83835
|
const [enableSublocations, setEnableSublocations] = React76__default.default.useState(false);
|
|
83766
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
|
+
}
|
|
83767
83849
|
setEnableSublocations(!enableSublocations);
|
|
83768
|
-
}, [enableSublocations]);
|
|
83850
|
+
}, [enableSublocations, value, selectedValueIds, options]);
|
|
83769
83851
|
const onSelectAll = React76__default.default.useCallback(() => {
|
|
83770
83852
|
if (selectState === "none" || selectState === "partial") {
|
|
83771
83853
|
setSelectState("all");
|
|
@@ -83779,22 +83861,51 @@ var LocationQuickFilterRenderer = ({
|
|
|
83779
83861
|
}
|
|
83780
83862
|
}, [options, selectState, selectedValueIds]);
|
|
83781
83863
|
const onSelect = (selection) => {
|
|
83782
|
-
if (selection.item.id === "select_all"
|
|
83864
|
+
if (selection.item.id === "select_all") {
|
|
83783
83865
|
return;
|
|
83784
83866
|
}
|
|
83785
|
-
|
|
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
|
+
}
|
|
83786
83889
|
setSelectState(determineSelectedState(newSelections));
|
|
83787
83890
|
setSelectedValueIds(newSelections.map(({ id }) => id));
|
|
83788
|
-
onChange(
|
|
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
|
+
});
|
|
83789
83905
|
};
|
|
83790
83906
|
const handleSelectSublocations = (selected) => {
|
|
83791
83907
|
if (enableSublocations) {
|
|
83792
|
-
const filteredOptions =
|
|
83793
|
-
return ramda.startsWith(
|
|
83794
|
-
`${getLabel3(selected).toLowerCase()} > `,
|
|
83795
|
-
getLabel3(option).toLowerCase()
|
|
83796
|
-
);
|
|
83797
|
-
});
|
|
83908
|
+
const filteredOptions = findSublocations(selected);
|
|
83798
83909
|
return filteredOptions;
|
|
83799
83910
|
} else {
|
|
83800
83911
|
return [];
|
|
@@ -83803,13 +83914,16 @@ var LocationQuickFilterRenderer = ({
|
|
|
83803
83914
|
const removeSelections = React76__default.default.useCallback(
|
|
83804
83915
|
function(selection, selected) {
|
|
83805
83916
|
const sublocations = handleSelectSublocations(selection);
|
|
83806
|
-
|
|
83807
|
-
|
|
83808
|
-
|
|
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)
|
|
83809
83922
|
)
|
|
83810
|
-
)
|
|
83923
|
+
);
|
|
83924
|
+
return selected.filter((item) => getId3(item) !== getId3(selection));
|
|
83811
83925
|
},
|
|
83812
|
-
[enableSublocations]
|
|
83926
|
+
[enableSublocations, disabledValues]
|
|
83813
83927
|
);
|
|
83814
83928
|
React76__default.default.useEffect(() => {
|
|
83815
83929
|
setSelectState(determineSelectedState(value));
|
|
@@ -83824,6 +83938,7 @@ var LocationQuickFilterRenderer = ({
|
|
|
83824
83938
|
selectState,
|
|
83825
83939
|
value,
|
|
83826
83940
|
options,
|
|
83941
|
+
disabledOptions: disabledValues,
|
|
83827
83942
|
getId: getId3,
|
|
83828
83943
|
getLabel: getLabel3,
|
|
83829
83944
|
loading,
|
package/dist/modern/index.d.cts
CHANGED
|
@@ -198,7 +198,7 @@ interface DataTableCellEditorProps<TValue = any, TColumnDefinition extends Colum
|
|
|
198
198
|
eventKey: string | null;
|
|
199
199
|
ref?: ((instance: HTMLElement | null) => void) | React__default.MutableRefObject<HTMLElement | null> | null;
|
|
200
200
|
setDataValue: (field: string, newValue: TValue) => void;
|
|
201
|
-
stopEditing: () => void;
|
|
201
|
+
stopEditing: (relatedTarget?: HTMLElement | null) => void;
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
interface BooleanCellRendererParams {
|
|
@@ -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
|
|
package/dist/modern/index.d.ts
CHANGED
|
@@ -198,7 +198,7 @@ interface DataTableCellEditorProps<TValue = any, TColumnDefinition extends Colum
|
|
|
198
198
|
eventKey: string | null;
|
|
199
199
|
ref?: ((instance: HTMLElement | null) => void) | React__default.MutableRefObject<HTMLElement | null> | null;
|
|
200
200
|
setDataValue: (field: string, newValue: TValue) => void;
|
|
201
|
-
stopEditing: () => void;
|
|
201
|
+
stopEditing: (relatedTarget?: HTMLElement | null) => void;
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
interface BooleanCellRendererParams {
|
|
@@ -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
|
|