@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 14.13.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 03bf2b82b: Add Polish support
|
|
8
|
+
|
|
9
|
+
## 14.12.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 7ba11177c: When using an input or date editor and focusing on an element outside of the table, clear the cell focus and ensure that the new element is focused.
|
|
14
|
+
|
|
3
15
|
## 14.12.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/legacy/index.cjs
CHANGED
|
@@ -8028,7 +8028,7 @@ var InternalBooleanCellEditor = React76__default.default.forwardRef(({ columnDef
|
|
|
8028
8028
|
return /* @__PURE__ */ React76__default.default.createElement(
|
|
8029
8029
|
coreReact.Select,
|
|
8030
8030
|
{
|
|
8031
|
-
afterHide: stopEditing,
|
|
8031
|
+
afterHide: () => stopEditing(),
|
|
8032
8032
|
block: true,
|
|
8033
8033
|
className: cx("input-cell"),
|
|
8034
8034
|
label: value ? I18n.t("dataTable.cells.booleanCell.options.yes") : I18n.t("dataTable.cells.booleanCell.options.no"),
|
|
@@ -8249,8 +8249,8 @@ var Editor = React76__default.default.forwardRef(
|
|
|
8249
8249
|
if (isEmptyValue(value) && !columnDefinition.editable) {
|
|
8250
8250
|
return null;
|
|
8251
8251
|
}
|
|
8252
|
-
function onBlur() {
|
|
8253
|
-
stopEditing();
|
|
8252
|
+
function onBlur(event) {
|
|
8253
|
+
stopEditing(ensureIsHTMLElement(event.relatedTarget));
|
|
8254
8254
|
}
|
|
8255
8255
|
const defaultValue = eventKey ? value : labsFinancialsUtils.formatNumber(value, {
|
|
8256
8256
|
...((_a = columnDefinition.cellEditorParams) == null ? void 0 : _a.formatConfig) ?? ((_b = columnDefinition.cellRendererParams) == null ? void 0 : _b.formatConfig) ?? {},
|
|
@@ -8693,8 +8693,8 @@ var DateCellRenderer = withDataTableRenderer(Renderer4, "date");
|
|
|
8693
8693
|
var Editor2 = React76__default.default.forwardRef(
|
|
8694
8694
|
({ columnDefinition, setDataValue, stopEditing, value }, ref) => {
|
|
8695
8695
|
var _a, _b;
|
|
8696
|
-
function afterHide() {
|
|
8697
|
-
stopEditing();
|
|
8696
|
+
function afterHide(event) {
|
|
8697
|
+
stopEditing(ensureIsHTMLElement(event == null ? void 0 : event.target));
|
|
8698
8698
|
}
|
|
8699
8699
|
function onChange(date) {
|
|
8700
8700
|
if (date) {
|
|
@@ -8767,8 +8767,8 @@ var DateTimeCellRenderer = withDataTableRenderer(Renderer5, "date");
|
|
|
8767
8767
|
var Editor3 = React76__default.default.forwardRef(
|
|
8768
8768
|
({ columnDefinition, setDataValue, stopEditing, value }, ref) => {
|
|
8769
8769
|
var _a, _b;
|
|
8770
|
-
function afterHide() {
|
|
8771
|
-
stopEditing();
|
|
8770
|
+
function afterHide(event) {
|
|
8771
|
+
stopEditing(ensureIsHTMLElement(event == null ? void 0 : event.target));
|
|
8772
8772
|
}
|
|
8773
8773
|
function onChange(date) {
|
|
8774
8774
|
if (date) {
|
|
@@ -12818,8 +12818,8 @@ var GridOptionsValidator = class GridOptionsValidator2 {
|
|
|
12818
12818
|
enterMovesDownAfterEdit: { version: "30", newProp: "enterNavigatesVerticallyAfterEdit", copyToNewProp: true }
|
|
12819
12819
|
};
|
|
12820
12820
|
}
|
|
12821
|
-
pickOneWarning(prop1,
|
|
12822
|
-
console.warn(`AG Grid: ${prop1} and ${
|
|
12821
|
+
pickOneWarning(prop1, prop22) {
|
|
12822
|
+
console.warn(`AG Grid: ${prop1} and ${prop22} do not work with each other, you need to pick one.`);
|
|
12823
12823
|
}
|
|
12824
12824
|
init() {
|
|
12825
12825
|
this.checkForDeprecated();
|
|
@@ -12841,7 +12841,7 @@ var GridOptionsValidator = class GridOptionsValidator2 {
|
|
|
12841
12841
|
this.pickOneWarning("groupRemoveSingleChildren", "groupHideOpenParents");
|
|
12842
12842
|
}
|
|
12843
12843
|
if (this.gridOptionsService.isRowModelType("serverSide")) {
|
|
12844
|
-
const msg = (
|
|
12844
|
+
const msg = (prop3, alt) => `AG Grid: '${prop3}' is not supported on the Server-Side Row Model.` + (alt ? ` Please use ${alt} instead.` : "");
|
|
12845
12845
|
if (this.gridOptionsService.exists("groupDefaultExpanded")) {
|
|
12846
12846
|
console.warn(msg("groupDefaultExpanded", "isServerSideGroupOpenByDefault callback"));
|
|
12847
12847
|
}
|
|
@@ -12857,7 +12857,7 @@ var GridOptionsValidator = class GridOptionsValidator2 {
|
|
|
12857
12857
|
} else if (this.gridOptionsService.is("enableRangeHandle") || this.gridOptionsService.is("enableFillHandle")) {
|
|
12858
12858
|
console.warn("AG Grid: 'enableRangeHandle' or 'enableFillHandle' will not work unless 'enableRangeSelection' is set to true");
|
|
12859
12859
|
}
|
|
12860
|
-
const validateRegistered = (
|
|
12860
|
+
const validateRegistered = (prop3, module) => this.gridOptionsService.exists(prop3) && ModuleRegistry.__assertRegistered(module, prop3, this.gridOptionsService.getGridId());
|
|
12861
12861
|
validateRegistered("sideBar", ModuleNames.SideBarModule);
|
|
12862
12862
|
validateRegistered("statusBar", ModuleNames.StatusBarModule);
|
|
12863
12863
|
validateRegistered("enableCharts", ModuleNames.GridChartsModule);
|
|
@@ -52181,15 +52181,15 @@ var DataTypeService = class DataTypeService2 extends BeanStub {
|
|
|
52181
52181
|
["valueGetter", void 0],
|
|
52182
52182
|
["valueParser", void 0],
|
|
52183
52183
|
["refData", void 0]
|
|
52184
|
-
].some(([
|
|
52184
|
+
].some(([prop3, comparisonValue]) => this.doesColDefPropPreventInference(colDef, propsToCheckForInference, prop3, comparisonValue));
|
|
52185
52185
|
}
|
|
52186
|
-
doesColDefPropPreventInference(colDef, checkProps,
|
|
52187
|
-
if (!checkProps[
|
|
52186
|
+
doesColDefPropPreventInference(colDef, checkProps, prop3, comparisonValue) {
|
|
52187
|
+
if (!checkProps[prop3]) {
|
|
52188
52188
|
return false;
|
|
52189
52189
|
}
|
|
52190
|
-
const value = colDef[
|
|
52190
|
+
const value = colDef[prop3];
|
|
52191
52191
|
if (value === null) {
|
|
52192
|
-
checkProps[
|
|
52192
|
+
checkProps[prop3] = false;
|
|
52193
52193
|
return false;
|
|
52194
52194
|
} else {
|
|
52195
52195
|
return comparisonValue === void 0 ? !!value : value === comparisonValue;
|
|
@@ -53043,8 +53043,8 @@ var InternalNumberCellEditor = React76__default.default.forwardRef(({ columnDefi
|
|
|
53043
53043
|
if (isEmptyValue(value) && !columnDefinition.editable) {
|
|
53044
53044
|
return null;
|
|
53045
53045
|
}
|
|
53046
|
-
function onBlur() {
|
|
53047
|
-
stopEditing();
|
|
53046
|
+
function onBlur(event) {
|
|
53047
|
+
stopEditing(ensureIsHTMLElement(event.relatedTarget));
|
|
53048
53048
|
}
|
|
53049
53049
|
return /* @__PURE__ */ React76__default.default.createElement(
|
|
53050
53050
|
coreReact.Input,
|
|
@@ -53335,8 +53335,8 @@ var PercentCellRenderer = withDataTableRenderer(Renderer7, "input");
|
|
|
53335
53335
|
var Editor4 = React76__default.default.forwardRef(({ columnDefinition, eventKey, stopEditing, value }, ref) => {
|
|
53336
53336
|
var _a, _b, _c, _d, _e;
|
|
53337
53337
|
const I18n = coreReact.useI18nContext();
|
|
53338
|
-
function onBlur() {
|
|
53339
|
-
stopEditing();
|
|
53338
|
+
function onBlur(event) {
|
|
53339
|
+
stopEditing(ensureIsHTMLElement(event.relatedTarget));
|
|
53340
53340
|
}
|
|
53341
53341
|
if (isEmptyValue(value) && !columnDefinition.editable) {
|
|
53342
53342
|
return null;
|
|
@@ -53741,8 +53741,8 @@ var TextCellRenderer = withDataTableRenderer(Renderer11, "input");
|
|
|
53741
53741
|
var Editor7 = React76__default.default.forwardRef(
|
|
53742
53742
|
({ columnDefinition, eventKey, stopEditing, value }, ref) => {
|
|
53743
53743
|
var _a, _b, _c, _d;
|
|
53744
|
-
function onBlur() {
|
|
53745
|
-
stopEditing();
|
|
53744
|
+
function onBlur(event) {
|
|
53745
|
+
stopEditing(ensureIsHTMLElement(event.relatedTarget));
|
|
53746
53746
|
}
|
|
53747
53747
|
const I18n = coreReact.useI18nContext();
|
|
53748
53748
|
const internalValue = eventKey ? value : ((_a = columnDefinition.getStringFormattedValue) == null ? void 0 : _a.call(columnDefinition, value)) ?? value;
|
|
@@ -53815,8 +53815,8 @@ var Renderer12 = ({
|
|
|
53815
53815
|
var Editor8 = React76__default.default.forwardRef(
|
|
53816
53816
|
({ columnDefinition, stopEditing, value }, ref) => {
|
|
53817
53817
|
var _a, _b, _c, _d;
|
|
53818
|
-
function onBlur() {
|
|
53819
|
-
stopEditing();
|
|
53818
|
+
function onBlur(event) {
|
|
53819
|
+
stopEditing(ensureIsHTMLElement(event.relatedTarget));
|
|
53820
53820
|
}
|
|
53821
53821
|
const I18n = coreReact.useI18nContext();
|
|
53822
53822
|
const internalValue = ((_a = columnDefinition.getStringFormattedValue) == null ? void 0 : _a.call(columnDefinition, value)) ?? value;
|
|
@@ -53877,6 +53877,7 @@ var LocationFilterOverlay = React76__default.default.forwardRef(
|
|
|
53877
53877
|
enableSublocations,
|
|
53878
53878
|
selectState,
|
|
53879
53879
|
options,
|
|
53880
|
+
disabledOptions,
|
|
53880
53881
|
columnDefinition,
|
|
53881
53882
|
value
|
|
53882
53883
|
}, ref) => {
|
|
@@ -53898,6 +53899,7 @@ var LocationFilterOverlay = React76__default.default.forwardRef(
|
|
|
53898
53899
|
return onSelectAll();
|
|
53899
53900
|
}
|
|
53900
53901
|
if (selection.item.id === includeSublocationOption.id) {
|
|
53902
|
+
_onSelect(selection);
|
|
53901
53903
|
return onSelectSublocations();
|
|
53902
53904
|
}
|
|
53903
53905
|
return _onSelect(selection);
|
|
@@ -53968,8 +53970,9 @@ var LocationFilterOverlay = React76__default.default.forwardRef(
|
|
|
53968
53970
|
{
|
|
53969
53971
|
key: getId3(item),
|
|
53970
53972
|
item,
|
|
53971
|
-
selected: value.map(({ id }) => id).includes(getId3(item)),
|
|
53972
|
-
suggested: i === 0
|
|
53973
|
+
selected: value.map(({ id }) => id).includes(getId3(item)) || disabledOptions.map(({ id }) => id).includes(getId3(item)),
|
|
53974
|
+
suggested: i === 0,
|
|
53975
|
+
disabled: disabledOptions.map(({ id }) => id).includes(getId3(item))
|
|
53973
53976
|
},
|
|
53974
53977
|
getLabel3(item)
|
|
53975
53978
|
);
|
|
@@ -54000,10 +54003,23 @@ var ServerSideLocationFilterRenderer = React76__default.default.forwardRef(
|
|
|
54000
54003
|
const [selectState, setSelectState] = React76__default.default.useState(
|
|
54001
54004
|
determineSelectedState(value)
|
|
54002
54005
|
);
|
|
54006
|
+
const [disabledValues, setDisabledValues] = React76__default.default.useState([]);
|
|
54003
54007
|
const [enableSublocations, setEnableSublocations] = React76__default.default.useState(false);
|
|
54004
54008
|
const onSelectSublocations = React76__default.default.useCallback(() => {
|
|
54009
|
+
if (enableSublocations) {
|
|
54010
|
+
setDisabledValues([]);
|
|
54011
|
+
} else {
|
|
54012
|
+
const newDisabledValues = [];
|
|
54013
|
+
value.forEach((location) => {
|
|
54014
|
+
newDisabledValues.push(...findSublocations(location));
|
|
54015
|
+
});
|
|
54016
|
+
const uniqDisabledValues = ramda.uniqBy(ramda.prop("id"), newDisabledValues).filter(
|
|
54017
|
+
({ id }) => !selectedValueIds.includes(id)
|
|
54018
|
+
);
|
|
54019
|
+
setDisabledValues(uniqDisabledValues);
|
|
54020
|
+
}
|
|
54005
54021
|
setEnableSublocations(!enableSublocations);
|
|
54006
|
-
}, [enableSublocations]);
|
|
54022
|
+
}, [enableSublocations, value, selectedValueIds, options]);
|
|
54007
54023
|
const I18n = coreReact.useI18nContext();
|
|
54008
54024
|
const selectRef = React76__default.default.useRef(null);
|
|
54009
54025
|
const onSelectAll = React76__default.default.useCallback(() => {
|
|
@@ -54019,17 +54035,47 @@ var ServerSideLocationFilterRenderer = React76__default.default.forwardRef(
|
|
|
54019
54035
|
}
|
|
54020
54036
|
}, [options, selectState, selectedValueIds]);
|
|
54021
54037
|
const onSelect = (selection) => {
|
|
54022
|
-
if (selection.item.id === "select_all"
|
|
54038
|
+
if (selection.item.id === "select_all") {
|
|
54023
54039
|
return;
|
|
54024
54040
|
}
|
|
54025
|
-
|
|
54026
|
-
|
|
54027
|
-
|
|
54028
|
-
|
|
54029
|
-
|
|
54041
|
+
if (selection.item.id === "include_sublocations") {
|
|
54042
|
+
return onChange(
|
|
54043
|
+
value.map((item) => ({
|
|
54044
|
+
...item,
|
|
54045
|
+
sublocations: enableSublocations ? [] : findSublocations(item)
|
|
54046
|
+
}))
|
|
54047
|
+
);
|
|
54048
|
+
}
|
|
54049
|
+
let newSelections = [];
|
|
54050
|
+
if (selectedValueIds.includes(getId3(selection.item))) {
|
|
54051
|
+
newSelections = removeSelections(selection.item, value);
|
|
54052
|
+
} else {
|
|
54053
|
+
newSelections = [...value, selection.item];
|
|
54054
|
+
const sublocationsToDisable = handleSelectSublocations(selection.item);
|
|
54055
|
+
const newDisabledValues = [
|
|
54056
|
+
...disabledValues,
|
|
54057
|
+
...sublocationsToDisable.filter(
|
|
54058
|
+
({ id }) => !selectedValueIds.includes(id)
|
|
54059
|
+
)
|
|
54060
|
+
];
|
|
54061
|
+
setDisabledValues(newDisabledValues);
|
|
54062
|
+
}
|
|
54030
54063
|
setSelectState(determineSelectedState(newSelections));
|
|
54031
54064
|
setSelectedValueIds(newSelections.map(({ id }) => id));
|
|
54032
|
-
onChange(
|
|
54065
|
+
onChange(
|
|
54066
|
+
newSelections.map((item) => ({
|
|
54067
|
+
...item,
|
|
54068
|
+
sublocations: handleSelectSublocations(item)
|
|
54069
|
+
}))
|
|
54070
|
+
);
|
|
54071
|
+
};
|
|
54072
|
+
const findSublocations = (selected) => {
|
|
54073
|
+
return options.filter((option) => {
|
|
54074
|
+
return ramda.startsWith(
|
|
54075
|
+
`${getLabel3(selected).toLowerCase()} > `,
|
|
54076
|
+
getLabel3(option).toLowerCase()
|
|
54077
|
+
);
|
|
54078
|
+
});
|
|
54033
54079
|
};
|
|
54034
54080
|
const handleSelectSublocations = (selected) => {
|
|
54035
54081
|
if (enableSublocations) {
|
|
@@ -54047,14 +54093,16 @@ var ServerSideLocationFilterRenderer = React76__default.default.forwardRef(
|
|
|
54047
54093
|
const removeSelections = React76__default.default.useCallback(
|
|
54048
54094
|
function(selection, selected) {
|
|
54049
54095
|
const sublocations = handleSelectSublocations(selection);
|
|
54050
|
-
|
|
54051
|
-
|
|
54052
|
-
|
|
54053
|
-
|
|
54054
|
-
|
|
54055
|
-
|
|
54096
|
+
const disabledValueIds = disabledValues.map(({ id }) => id);
|
|
54097
|
+
const sublocationsToRemoveFromDisabledIds = sublocations.filter(({ id }) => disabledValueIds.includes(id)).map(({ id }) => id);
|
|
54098
|
+
setDisabledValues(
|
|
54099
|
+
disabledValues.filter(
|
|
54100
|
+
({ id }) => !sublocationsToRemoveFromDisabledIds.includes(id)
|
|
54101
|
+
)
|
|
54102
|
+
);
|
|
54103
|
+
return selected.filter((item) => getId3(item) !== getId3(selection));
|
|
54056
54104
|
},
|
|
54057
|
-
[enableSublocations]
|
|
54105
|
+
[enableSublocations, disabledValues]
|
|
54058
54106
|
);
|
|
54059
54107
|
React76__default.default.useEffect(() => {
|
|
54060
54108
|
setSelectState(determineSelectedState(value));
|
|
@@ -54065,6 +54113,7 @@ var ServerSideLocationFilterRenderer = React76__default.default.forwardRef(
|
|
|
54065
54113
|
columnDefinition,
|
|
54066
54114
|
value,
|
|
54067
54115
|
options,
|
|
54116
|
+
disabledOptions: disabledValues,
|
|
54068
54117
|
enableSublocations,
|
|
54069
54118
|
getId: getId3,
|
|
54070
54119
|
getLabel: getLabel3,
|
|
@@ -56070,7 +56119,14 @@ var DataTableCellEditor = React76__default.default.forwardRef(
|
|
|
56070
56119
|
node.setDataValue(field, newValue);
|
|
56071
56120
|
setCurrentValue(newValue);
|
|
56072
56121
|
},
|
|
56073
|
-
stopEditing
|
|
56122
|
+
stopEditing: (relatedTarget) => {
|
|
56123
|
+
const isRelatedTargetOutsideTable = (relatedTarget == null ? void 0 : relatedTarget.closest('[data-qa="data-table-table')) === null;
|
|
56124
|
+
stopEditing(isRelatedTargetOutsideTable);
|
|
56125
|
+
if (isRelatedTargetOutsideTable) {
|
|
56126
|
+
api.clearFocusedCell();
|
|
56127
|
+
relatedTarget.focus();
|
|
56128
|
+
}
|
|
56129
|
+
},
|
|
56074
56130
|
tableApi: tableRef == null ? void 0 : tableRef.current,
|
|
56075
56131
|
value: currentValue,
|
|
56076
56132
|
ref: handleRefs(editorType)
|
|
@@ -56952,6 +57008,9 @@ function withDataTableRenderer(Component4, editorType) {
|
|
|
56952
57008
|
}
|
|
56953
57009
|
);
|
|
56954
57010
|
}
|
|
57011
|
+
function ensureIsHTMLElement(element) {
|
|
57012
|
+
return element instanceof HTMLElement ? element : null;
|
|
57013
|
+
}
|
|
56955
57014
|
function getGroupNodes(params) {
|
|
56956
57015
|
var _a, _b;
|
|
56957
57016
|
const currentParentId = ((_b = (_a = params.node) == null ? void 0 : _a.parent) == null ? void 0 : _b.id) ?? "root";
|
|
@@ -57200,7 +57259,7 @@ var MultiSelectEditor = React76__default.default.forwardRef(({ columnDefinition,
|
|
|
57200
57259
|
coreReact.MultiSelect,
|
|
57201
57260
|
{
|
|
57202
57261
|
beforeShow,
|
|
57203
|
-
afterHide: stopEditing,
|
|
57262
|
+
afterHide: () => stopEditing(),
|
|
57204
57263
|
block: true,
|
|
57205
57264
|
loading: isSearching || loading,
|
|
57206
57265
|
getId: (option) => {
|
|
@@ -79800,6 +79859,11 @@ var ja_JP_default = {
|
|
|
79800
79859
|
}
|
|
79801
79860
|
};
|
|
79802
79861
|
|
|
79862
|
+
// src/locales/pl-PL.json
|
|
79863
|
+
var pl_PL_default = {
|
|
79864
|
+
dataTable: {}
|
|
79865
|
+
};
|
|
79866
|
+
|
|
79803
79867
|
// src/locales/pseudo.json
|
|
79804
79868
|
var pseudo_default = {
|
|
79805
79869
|
dataTable: {
|
|
@@ -80416,7 +80480,8 @@ var translations = {
|
|
|
80416
80480
|
pseudo: pseudo_default,
|
|
80417
80481
|
"pt-BR": pt_BR_default,
|
|
80418
80482
|
"th-TH": th_TH_default,
|
|
80419
|
-
"zh-SG": zh_SG_default
|
|
80483
|
+
"zh-SG": zh_SG_default,
|
|
80484
|
+
"pl-PL": pl_PL_default
|
|
80420
80485
|
};
|
|
80421
80486
|
var PRINCE_XML_DPI = 96;
|
|
80422
80487
|
var DEFAULT_PAGE_MARGIN = 40;
|
|
@@ -82346,6 +82411,7 @@ var Table = (props) => {
|
|
|
82346
82411
|
return /* @__PURE__ */ React76__default.default.createElement(
|
|
82347
82412
|
Spinner,
|
|
82348
82413
|
{
|
|
82414
|
+
"data-qa": "data-table-table",
|
|
82349
82415
|
loading: loadingStatus.loading,
|
|
82350
82416
|
label: loadingStatus.message,
|
|
82351
82417
|
style: {
|
|
@@ -83843,6 +83909,7 @@ var LocationQuickFilterOverlay = React76__default.default.forwardRef(
|
|
|
83843
83909
|
enableSublocations,
|
|
83844
83910
|
selectState,
|
|
83845
83911
|
options,
|
|
83912
|
+
disabledOptions,
|
|
83846
83913
|
columnDefinition,
|
|
83847
83914
|
value
|
|
83848
83915
|
}, ref) => {
|
|
@@ -83870,6 +83937,7 @@ var LocationQuickFilterOverlay = React76__default.default.forwardRef(
|
|
|
83870
83937
|
return onSelectAll();
|
|
83871
83938
|
}
|
|
83872
83939
|
if (selection.item.id === includeSublocationOption.id) {
|
|
83940
|
+
_onSelect(selection);
|
|
83873
83941
|
return onSelectSublocations();
|
|
83874
83942
|
}
|
|
83875
83943
|
return _onSelect(selection);
|
|
@@ -83940,8 +84008,9 @@ var LocationQuickFilterOverlay = React76__default.default.forwardRef(
|
|
|
83940
84008
|
{
|
|
83941
84009
|
key: getId3(item),
|
|
83942
84010
|
item,
|
|
83943
|
-
selected: value.map(({ id }) => id).includes(getId3(item)),
|
|
83944
|
-
suggested: i === 0
|
|
84011
|
+
selected: value.map(({ id }) => id).includes(getId3(item)) || disabledOptions.map(({ id }) => id).includes(getId3(item)),
|
|
84012
|
+
suggested: i === 0,
|
|
84013
|
+
disabled: disabledOptions.map(({ id }) => id).includes(getId3(item))
|
|
83945
84014
|
},
|
|
83946
84015
|
getLabel3(item)
|
|
83947
84016
|
);
|
|
@@ -83988,10 +84057,23 @@ var LocationQuickFilterRenderer = ({
|
|
|
83988
84057
|
const [selectState, setSelectState] = React76__default.default.useState(
|
|
83989
84058
|
determineSelectedState(value)
|
|
83990
84059
|
);
|
|
84060
|
+
const [disabledValues, setDisabledValues] = React76__default.default.useState([]);
|
|
83991
84061
|
const [enableSublocations, setEnableSublocations] = React76__default.default.useState(false);
|
|
83992
84062
|
const onSelectSublocations = React76__default.default.useCallback(() => {
|
|
84063
|
+
if (enableSublocations) {
|
|
84064
|
+
setDisabledValues([]);
|
|
84065
|
+
} else {
|
|
84066
|
+
const newDisabledValues = [];
|
|
84067
|
+
value.forEach((location) => {
|
|
84068
|
+
newDisabledValues.push(...findSublocations(location));
|
|
84069
|
+
});
|
|
84070
|
+
const uniqDisabledValues = ramda.uniqBy(ramda.prop("id"), newDisabledValues).filter(
|
|
84071
|
+
({ id }) => !selectedValueIds.includes(id)
|
|
84072
|
+
);
|
|
84073
|
+
setDisabledValues(uniqDisabledValues);
|
|
84074
|
+
}
|
|
83993
84075
|
setEnableSublocations(!enableSublocations);
|
|
83994
|
-
}, [enableSublocations]);
|
|
84076
|
+
}, [enableSublocations, value, selectedValueIds, options]);
|
|
83995
84077
|
const onSelectAll = React76__default.default.useCallback(() => {
|
|
83996
84078
|
if (selectState === "none" || selectState === "partial") {
|
|
83997
84079
|
setSelectState("all");
|
|
@@ -84005,22 +84087,51 @@ var LocationQuickFilterRenderer = ({
|
|
|
84005
84087
|
}
|
|
84006
84088
|
}, [options, selectState, selectedValueIds]);
|
|
84007
84089
|
const onSelect = (selection) => {
|
|
84008
|
-
if (selection.item.id === "select_all"
|
|
84090
|
+
if (selection.item.id === "select_all") {
|
|
84009
84091
|
return;
|
|
84010
84092
|
}
|
|
84011
|
-
|
|
84093
|
+
if (selection.item.id === "include_sublocations") {
|
|
84094
|
+
return onChange(
|
|
84095
|
+
value.map((item) => ({
|
|
84096
|
+
...item,
|
|
84097
|
+
sublocations: enableSublocations ? [] : findSublocations(item)
|
|
84098
|
+
}))
|
|
84099
|
+
);
|
|
84100
|
+
}
|
|
84101
|
+
let newSelections = [];
|
|
84102
|
+
if (selectedValueIds.includes(getId3(selection.item))) {
|
|
84103
|
+
newSelections = removeSelections(selection.item, value);
|
|
84104
|
+
} else {
|
|
84105
|
+
newSelections = [...value, selection.item];
|
|
84106
|
+
const sublocationsToDisable = handleSelectSublocations(selection.item);
|
|
84107
|
+
const newDisabledValues = [
|
|
84108
|
+
...disabledValues,
|
|
84109
|
+
...sublocationsToDisable.filter(
|
|
84110
|
+
({ id }) => !selectedValueIds.includes(id)
|
|
84111
|
+
)
|
|
84112
|
+
];
|
|
84113
|
+
setDisabledValues(newDisabledValues);
|
|
84114
|
+
}
|
|
84012
84115
|
setSelectState(determineSelectedState(newSelections));
|
|
84013
84116
|
setSelectedValueIds(newSelections.map(({ id }) => id));
|
|
84014
|
-
onChange(
|
|
84117
|
+
onChange(
|
|
84118
|
+
newSelections.map((item) => ({
|
|
84119
|
+
...item,
|
|
84120
|
+
sublocations: handleSelectSublocations(item)
|
|
84121
|
+
}))
|
|
84122
|
+
);
|
|
84123
|
+
};
|
|
84124
|
+
const findSublocations = (selected) => {
|
|
84125
|
+
return options.filter((option) => {
|
|
84126
|
+
return ramda.startsWith(
|
|
84127
|
+
`${getLabel3(selected).toLowerCase()} > `,
|
|
84128
|
+
getLabel3(option).toLowerCase()
|
|
84129
|
+
);
|
|
84130
|
+
});
|
|
84015
84131
|
};
|
|
84016
84132
|
const handleSelectSublocations = (selected) => {
|
|
84017
84133
|
if (enableSublocations) {
|
|
84018
|
-
const filteredOptions =
|
|
84019
|
-
return ramda.startsWith(
|
|
84020
|
-
`${getLabel3(selected).toLowerCase()} > `,
|
|
84021
|
-
getLabel3(option).toLowerCase()
|
|
84022
|
-
);
|
|
84023
|
-
});
|
|
84134
|
+
const filteredOptions = findSublocations(selected);
|
|
84024
84135
|
return filteredOptions;
|
|
84025
84136
|
} else {
|
|
84026
84137
|
return [];
|
|
@@ -84029,13 +84140,16 @@ var LocationQuickFilterRenderer = ({
|
|
|
84029
84140
|
const removeSelections = React76__default.default.useCallback(
|
|
84030
84141
|
function(selection, selected) {
|
|
84031
84142
|
const sublocations = handleSelectSublocations(selection);
|
|
84032
|
-
|
|
84033
|
-
|
|
84034
|
-
|
|
84143
|
+
const disabledValueIds = disabledValues.map(({ id }) => id);
|
|
84144
|
+
const sublocationsToRemoveFromDisabledIds = sublocations.filter(({ id }) => disabledValueIds.includes(id)).map(({ id }) => id);
|
|
84145
|
+
setDisabledValues(
|
|
84146
|
+
disabledValues.filter(
|
|
84147
|
+
({ id }) => !sublocationsToRemoveFromDisabledIds.includes(id)
|
|
84035
84148
|
)
|
|
84036
|
-
)
|
|
84149
|
+
);
|
|
84150
|
+
return selected.filter((item) => getId3(item) !== getId3(selection));
|
|
84037
84151
|
},
|
|
84038
|
-
[enableSublocations]
|
|
84152
|
+
[enableSublocations, disabledValues]
|
|
84039
84153
|
);
|
|
84040
84154
|
React76__default.default.useEffect(() => {
|
|
84041
84155
|
setSelectState(determineSelectedState(value));
|
|
@@ -84050,6 +84164,7 @@ var LocationQuickFilterRenderer = ({
|
|
|
84050
84164
|
selectState,
|
|
84051
84165
|
value,
|
|
84052
84166
|
options,
|
|
84167
|
+
disabledOptions: disabledValues,
|
|
84053
84168
|
getId: getId3,
|
|
84054
84169
|
getLabel: getLabel3,
|
|
84055
84170
|
loading,
|
package/dist/legacy/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/legacy/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
|
|