@procore/data-table 14.20.0 → 14.21.1
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 +17 -0
- package/dist/legacy/index.cjs +46 -24
- package/dist/legacy/index.d.cts +10 -1
- package/dist/legacy/index.d.ts +10 -1
- package/dist/legacy/index.js +47 -25
- package/dist/modern/index.cjs +43 -24
- package/dist/modern/index.d.cts +10 -1
- package/dist/modern/index.d.ts +10 -1
- package/dist/modern/index.js +44 -25
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 14.21.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 8cca316b7: Fix issue with filters update
|
|
8
|
+
|
|
9
|
+
## 14.21.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 627bb577d1: Expose onCellFocused event on data-table
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- 72a02060f5: Fixed some issues with sublocations on LocationFilterRenderer. Added documentation.
|
|
18
|
+
- 60f16d8d57: Fix 'include sublocations' checkbox and sublocations initial selection
|
|
19
|
+
|
|
3
20
|
## 14.20.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
package/dist/legacy/index.cjs
CHANGED
|
@@ -54096,19 +54096,34 @@ var ServerSideLocationFilterRenderer = React77__default.default.forwardRef(
|
|
|
54096
54096
|
determineSelectedState(value)
|
|
54097
54097
|
);
|
|
54098
54098
|
const [disabledValues, setDisabledValues] = React77__default.default.useState([]);
|
|
54099
|
+
const enableSublocationsInitialValue = value.some(
|
|
54100
|
+
(selected) => {
|
|
54101
|
+
var _a2;
|
|
54102
|
+
return (_a2 = selected.sublocations) == null ? void 0 : _a2.length;
|
|
54103
|
+
}
|
|
54104
|
+
);
|
|
54105
|
+
const getUniqDisabledValues = () => {
|
|
54106
|
+
const newDisabledValues = [];
|
|
54107
|
+
value.forEach((location) => {
|
|
54108
|
+
newDisabledValues.push(...findSublocations(location));
|
|
54109
|
+
});
|
|
54110
|
+
const uniqDisabledValues = ramda.uniqBy(ramda.prop("id"), newDisabledValues).filter(
|
|
54111
|
+
({ id }) => !selectedValueIds.includes(id)
|
|
54112
|
+
);
|
|
54113
|
+
return uniqDisabledValues;
|
|
54114
|
+
};
|
|
54115
|
+
React77.useEffect(() => {
|
|
54116
|
+
if (enableSublocationsInitialValue && options.length) {
|
|
54117
|
+
setDisabledValues(getUniqDisabledValues());
|
|
54118
|
+
setEnableSublocations(true);
|
|
54119
|
+
}
|
|
54120
|
+
}, [options]);
|
|
54099
54121
|
const [enableSublocations, setEnableSublocations] = React77__default.default.useState(false);
|
|
54100
54122
|
const onSelectSublocations = React77__default.default.useCallback(() => {
|
|
54101
54123
|
if (enableSublocations) {
|
|
54102
54124
|
setDisabledValues([]);
|
|
54103
54125
|
} else {
|
|
54104
|
-
|
|
54105
|
-
value.forEach((location) => {
|
|
54106
|
-
newDisabledValues.push(...findSublocations(location));
|
|
54107
|
-
});
|
|
54108
|
-
const uniqDisabledValues = ramda.uniqBy(ramda.prop("id"), newDisabledValues).filter(
|
|
54109
|
-
({ id }) => !selectedValueIds.includes(id)
|
|
54110
|
-
);
|
|
54111
|
-
setDisabledValues(uniqDisabledValues);
|
|
54126
|
+
setDisabledValues(getUniqDisabledValues());
|
|
54112
54127
|
}
|
|
54113
54128
|
setEnableSublocations(!enableSublocations);
|
|
54114
54129
|
}, [enableSublocations, value, selectedValueIds, options]);
|
|
@@ -54164,18 +54179,18 @@ var ServerSideLocationFilterRenderer = React77__default.default.forwardRef(
|
|
|
54164
54179
|
const findSublocations = (selected) => {
|
|
54165
54180
|
return options.filter((option) => {
|
|
54166
54181
|
return ramda.startsWith(
|
|
54167
|
-
|
|
54168
|
-
getLabel3(option).toLowerCase()
|
|
54169
|
-
);
|
|
54182
|
+
getLabel3(selected).toLowerCase().replace(/\s+>\s+/g, " > "),
|
|
54183
|
+
getLabel3(option).toLowerCase().replace(/\s+>\s+/g, " > ")
|
|
54184
|
+
) && option.id !== selected.id;
|
|
54170
54185
|
});
|
|
54171
54186
|
};
|
|
54172
54187
|
const handleSelectSublocations = (selected) => {
|
|
54173
54188
|
if (enableSublocations) {
|
|
54174
54189
|
const filteredOptions = options.filter((option) => {
|
|
54175
54190
|
return ramda.startsWith(
|
|
54176
|
-
|
|
54177
|
-
getLabel3(option).toLowerCase()
|
|
54178
|
-
);
|
|
54191
|
+
getLabel3(selected).toLowerCase().replace(/ /g, ""),
|
|
54192
|
+
getLabel3(option).toLowerCase().replace(/ /g, "")
|
|
54193
|
+
) && option.id !== selected.id;
|
|
54179
54194
|
});
|
|
54180
54195
|
return filteredOptions;
|
|
54181
54196
|
} else {
|
|
@@ -54231,6 +54246,8 @@ var ServerSideLocationFilterRenderer = React77__default.default.forwardRef(
|
|
|
54231
54246
|
{
|
|
54232
54247
|
block: true,
|
|
54233
54248
|
onClear: () => {
|
|
54249
|
+
setEnableSublocations(false);
|
|
54250
|
+
setDisabledValues([]);
|
|
54234
54251
|
onChange([]);
|
|
54235
54252
|
},
|
|
54236
54253
|
label: `${I18n.t("dataTable.filters.locationFilter.locations")} ${value.length ? `(${value.length})` : ""}`
|
|
@@ -55267,7 +55284,10 @@ function transformServerSideRequestObj(request, filtersState, searchValue) {
|
|
|
55267
55284
|
)
|
|
55268
55285
|
};
|
|
55269
55286
|
}
|
|
55270
|
-
var transformFilterValue = (value) => {
|
|
55287
|
+
var transformFilterValue = (value, field, formatter) => {
|
|
55288
|
+
const formattedValue = formatter == null ? void 0 : formatter(value, field);
|
|
55289
|
+
if (formattedValue)
|
|
55290
|
+
return formattedValue;
|
|
55271
55291
|
if (value == null ? void 0 : value.date)
|
|
55272
55292
|
return dateFns.formatISO(value.date, { representation: "date" });
|
|
55273
55293
|
return value.toString();
|
|
@@ -55294,8 +55314,11 @@ function getServerSideParams(request, filtersState, searchValue, options = {}) {
|
|
|
55294
55314
|
params.set("group", group);
|
|
55295
55315
|
}
|
|
55296
55316
|
if (options.filters !== false) {
|
|
55317
|
+
const formatter = options.filterValueFormatter;
|
|
55297
55318
|
filtersState.forEach((filter) => {
|
|
55298
|
-
const value = filter.selected.length === 1 ? transformFilterValue(filter.selected[0]) : `[${filter.selected.map(
|
|
55319
|
+
const value = filter.selected.length === 1 ? transformFilterValue(filter.selected[0], filter.field, formatter) : `[${filter.selected.map(
|
|
55320
|
+
(value2) => transformFilterValue(value2, filter.field, formatter)
|
|
55321
|
+
)}]`;
|
|
55299
55322
|
params.set(`filters[${filter.field}]`, value);
|
|
55300
55323
|
});
|
|
55301
55324
|
request.groupKeys.forEach((groupKey, index) => {
|
|
@@ -57639,7 +57662,7 @@ function useFilterStorage({
|
|
|
57639
57662
|
setFiltersState((prev) => {
|
|
57640
57663
|
const columnDefinition = getColumnDefinition(field);
|
|
57641
57664
|
return {
|
|
57642
|
-
...
|
|
57665
|
+
...prev,
|
|
57643
57666
|
selectedFilters: {
|
|
57644
57667
|
...prev.selectedFilters,
|
|
57645
57668
|
[field]: {
|
|
@@ -82831,9 +82854,6 @@ var Table = (props) => {
|
|
|
82831
82854
|
);
|
|
82832
82855
|
(_c2 = (_b2 = props.UNSAFE_internalAGGridOverrides) == null ? void 0 : _b2.onGridReady) == null ? void 0 : _c2.call(_b2, params);
|
|
82833
82856
|
};
|
|
82834
|
-
const postProcessPopup = (params) => {
|
|
82835
|
-
params.ePopup.style.top = `${HEADER_HEIGHT}px`;
|
|
82836
|
-
};
|
|
82837
82857
|
const internalOnRowSelected = (event) => {
|
|
82838
82858
|
var _a2, _b2, _c2;
|
|
82839
82859
|
(_a2 = props.onRowSelected) == null ? void 0 : _a2.call(props, event);
|
|
@@ -83083,6 +83103,7 @@ var Table = (props) => {
|
|
|
83083
83103
|
onGridReady,
|
|
83084
83104
|
onColumnEverythingChanged: props.onColumnEverythingChanged,
|
|
83085
83105
|
onModelUpdated,
|
|
83106
|
+
onCellFocused: props.onCellFocused,
|
|
83086
83107
|
onRowDragEnd,
|
|
83087
83108
|
onRowDragMove,
|
|
83088
83109
|
onRowGroupOpened: internalRowGroupOpened,
|
|
@@ -83095,7 +83116,6 @@ var Table = (props) => {
|
|
|
83095
83116
|
paginationPageSize: props.paginationPageSize || defaultPaginationPageSize,
|
|
83096
83117
|
popupParent: props.popupParent,
|
|
83097
83118
|
pinnedBottomRowData: props.pinnedBottomRowData,
|
|
83098
|
-
postProcessPopup,
|
|
83099
83119
|
rowBuffer: props.rowBuffer,
|
|
83100
83120
|
rowClassRules,
|
|
83101
83121
|
rowDragManaged: onSSDR ? false : props.rowDragManaged ?? true,
|
|
@@ -84098,9 +84118,9 @@ var LocationQuickFilterRenderer = ({
|
|
|
84098
84118
|
const findSublocations = (selected) => {
|
|
84099
84119
|
return options.filter((option) => {
|
|
84100
84120
|
return ramda.startsWith(
|
|
84101
|
-
|
|
84102
|
-
getLabel3(option).toLowerCase()
|
|
84103
|
-
);
|
|
84121
|
+
getLabel3(selected).toLowerCase().replace(/\s+>\s+/g, " > "),
|
|
84122
|
+
getLabel3(option).toLowerCase().replace(/\s+>\s+/g, " > ")
|
|
84123
|
+
) && option.id !== selected.id;
|
|
84104
84124
|
});
|
|
84105
84125
|
};
|
|
84106
84126
|
const handleSelectSublocations = (selected) => {
|
|
@@ -84163,6 +84183,8 @@ var LocationQuickFilterRenderer = ({
|
|
|
84163
84183
|
"dataTable.filters.locationFilter.locations"
|
|
84164
84184
|
)}${triggerLabel}`,
|
|
84165
84185
|
onClear: () => {
|
|
84186
|
+
setEnableSublocations(false);
|
|
84187
|
+
setDisabledValues([]);
|
|
84166
84188
|
onChange([]);
|
|
84167
84189
|
},
|
|
84168
84190
|
block: true
|
package/dist/legacy/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _ag_grid_community_core from '@ag-grid-community/core';
|
|
2
|
-
import { ICellRendererParams, NumberFilterModel as NumberFilterModel$1, ColDef, IRowNode, ICellEditorParams, RowDataTransaction, RowNodeTransaction, ServerSideTransaction, GridApi, ICellEditor, RefreshCellsParams, RowNode as RowNode$1, Column, SelectionEventSourceType, ColumnPinnedType, RowHeightParams, CheckboxSelectionCallbackParams, ExcelDataType, RowGroupOpenedEvent, Module, RowSelectedEvent, ColumnEverythingChangedEvent, TabToNextCellParams, CellPosition, GetRowIdParams, ColumnApi, IFilter, IScalarFilterParams, ISimpleFilterParams } from '@ag-grid-community/core';
|
|
2
|
+
import { ICellRendererParams, NumberFilterModel as NumberFilterModel$1, ColDef, IRowNode, ICellEditorParams, RowDataTransaction, RowNodeTransaction, ServerSideTransaction, GridApi, ICellEditor, RefreshCellsParams, RowNode as RowNode$1, Column, SelectionEventSourceType, ColumnPinnedType, RowHeightParams, CheckboxSelectionCallbackParams, ExcelDataType, RowGroupOpenedEvent, Module, RowSelectedEvent, ColumnEverythingChangedEvent, CellFocusedEvent, TabToNextCellParams, CellPosition, GetRowIdParams, ColumnApi, IFilter, IScalarFilterParams, ISimpleFilterParams } from '@ag-grid-community/core';
|
|
3
3
|
import * as React$1 from 'react';
|
|
4
4
|
import React__default from 'react';
|
|
5
5
|
import { AgGridReactProps, AgReactUiProps } from '@ag-grid-community/react';
|
|
@@ -470,6 +470,8 @@ interface ColumnDefinition<TValue = any, TRenderer = React.FC<ICellRendererParam
|
|
|
470
470
|
groupId?: string;
|
|
471
471
|
cellEditor?: TEditor;
|
|
472
472
|
cellEditorParams?: TEditorParams;
|
|
473
|
+
cellEditorPopup?: boolean;
|
|
474
|
+
cellEditorPopupPosition?: 'over' | 'under';
|
|
473
475
|
cellCSVFormatter?: (value: TValue) => string;
|
|
474
476
|
cellExcelFormatter?: (value: TValue) => string;
|
|
475
477
|
cellExcelDataType?: string;
|
|
@@ -887,6 +889,12 @@ type ServerSideParamsOptions = {
|
|
|
887
889
|
* @default filters[search]
|
|
888
890
|
*/
|
|
889
891
|
searchKey?: string;
|
|
892
|
+
/**
|
|
893
|
+
* Custom function for formatting URL params.
|
|
894
|
+
* This function will help you to format URL params when value is an object.
|
|
895
|
+
* If the function does not return anything, the default behavior will be used.
|
|
896
|
+
*/
|
|
897
|
+
filterValueFormatter?: (value: any, field: string) => string | void;
|
|
890
898
|
};
|
|
891
899
|
interface RowActionsConfig extends Omit<ColDef, 'field' | 'pinned' | 'lockPinned' | 'lockVisible'> {
|
|
892
900
|
}
|
|
@@ -985,6 +993,7 @@ interface TableProps<TRow = any, TBottomRow = any> {
|
|
|
985
993
|
onSelectAll?: (param: SelectAllState.All | SelectAllState.None) => void;
|
|
986
994
|
onTableReady?: (tableApi: TableApi, tableApiRef: React.RefObject<TableApi>) => void;
|
|
987
995
|
onColumnEverythingChanged?: (changeEvent: ColumnEverythingChangedEvent) => void;
|
|
996
|
+
onCellFocused?: (event: CellFocusedEvent) => void;
|
|
988
997
|
onFirstDataRendered?: (event: FirstDataRenderedEvent) => void;
|
|
989
998
|
paginateChildRows?: boolean;
|
|
990
999
|
pagination?: boolean;
|
package/dist/legacy/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _ag_grid_community_core from '@ag-grid-community/core';
|
|
2
|
-
import { ICellRendererParams, NumberFilterModel as NumberFilterModel$1, ColDef, IRowNode, ICellEditorParams, RowDataTransaction, RowNodeTransaction, ServerSideTransaction, GridApi, ICellEditor, RefreshCellsParams, RowNode as RowNode$1, Column, SelectionEventSourceType, ColumnPinnedType, RowHeightParams, CheckboxSelectionCallbackParams, ExcelDataType, RowGroupOpenedEvent, Module, RowSelectedEvent, ColumnEverythingChangedEvent, TabToNextCellParams, CellPosition, GetRowIdParams, ColumnApi, IFilter, IScalarFilterParams, ISimpleFilterParams } from '@ag-grid-community/core';
|
|
2
|
+
import { ICellRendererParams, NumberFilterModel as NumberFilterModel$1, ColDef, IRowNode, ICellEditorParams, RowDataTransaction, RowNodeTransaction, ServerSideTransaction, GridApi, ICellEditor, RefreshCellsParams, RowNode as RowNode$1, Column, SelectionEventSourceType, ColumnPinnedType, RowHeightParams, CheckboxSelectionCallbackParams, ExcelDataType, RowGroupOpenedEvent, Module, RowSelectedEvent, ColumnEverythingChangedEvent, CellFocusedEvent, TabToNextCellParams, CellPosition, GetRowIdParams, ColumnApi, IFilter, IScalarFilterParams, ISimpleFilterParams } from '@ag-grid-community/core';
|
|
3
3
|
import * as React$1 from 'react';
|
|
4
4
|
import React__default from 'react';
|
|
5
5
|
import { AgGridReactProps, AgReactUiProps } from '@ag-grid-community/react';
|
|
@@ -470,6 +470,8 @@ interface ColumnDefinition<TValue = any, TRenderer = React.FC<ICellRendererParam
|
|
|
470
470
|
groupId?: string;
|
|
471
471
|
cellEditor?: TEditor;
|
|
472
472
|
cellEditorParams?: TEditorParams;
|
|
473
|
+
cellEditorPopup?: boolean;
|
|
474
|
+
cellEditorPopupPosition?: 'over' | 'under';
|
|
473
475
|
cellCSVFormatter?: (value: TValue) => string;
|
|
474
476
|
cellExcelFormatter?: (value: TValue) => string;
|
|
475
477
|
cellExcelDataType?: string;
|
|
@@ -887,6 +889,12 @@ type ServerSideParamsOptions = {
|
|
|
887
889
|
* @default filters[search]
|
|
888
890
|
*/
|
|
889
891
|
searchKey?: string;
|
|
892
|
+
/**
|
|
893
|
+
* Custom function for formatting URL params.
|
|
894
|
+
* This function will help you to format URL params when value is an object.
|
|
895
|
+
* If the function does not return anything, the default behavior will be used.
|
|
896
|
+
*/
|
|
897
|
+
filterValueFormatter?: (value: any, field: string) => string | void;
|
|
890
898
|
};
|
|
891
899
|
interface RowActionsConfig extends Omit<ColDef, 'field' | 'pinned' | 'lockPinned' | 'lockVisible'> {
|
|
892
900
|
}
|
|
@@ -985,6 +993,7 @@ interface TableProps<TRow = any, TBottomRow = any> {
|
|
|
985
993
|
onSelectAll?: (param: SelectAllState.All | SelectAllState.None) => void;
|
|
986
994
|
onTableReady?: (tableApi: TableApi, tableApiRef: React.RefObject<TableApi>) => void;
|
|
987
995
|
onColumnEverythingChanged?: (changeEvent: ColumnEverythingChangedEvent) => void;
|
|
996
|
+
onCellFocused?: (event: CellFocusedEvent) => void;
|
|
988
997
|
onFirstDataRendered?: (event: FirstDataRenderedEvent) => void;
|
|
989
998
|
paginateChildRows?: boolean;
|
|
990
999
|
pagination?: boolean;
|
package/dist/legacy/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React77, { useState, forwardRef, useContext, useRef, useImperativeHandle, useLayoutEffect, useCallback, useMemo, memo,
|
|
1
|
+
import React77, { useEffect, useState, forwardRef, useContext, useRef, useImperativeHandle, useLayoutEffect, useCallback, useMemo, memo, Component as Component$1, createElement } from 'react';
|
|
2
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, SelectButton, StyledSelectButton, typographyWeights, StyledSelectButtonLabel, StyledButton, StyledSelectArrow, Popover, UNSAFE_StyledSuperSelectTrigger, UNSAFE_StyledSuperSelectLabel, UNSAFE_StyledSuperSelectArrow, UNSAFE_StyledFilterTokenLabel, DateTimeProvider, useField, Label, UNSAFE_mergeRefs, ContactItem as ContactItem$1, ToggleButton, Link, AvatarStack, Pill, Typeahead, Pagination, UNSAFE_SuperSelect, UNSAFE_FilterToken, Avatar, H3, useI18n, I18nContext, UNSAFE_useSuperSelectContext, Checkbox, DropdownFlyout, useVisibility, StyledDropdownFlyoutLabel, StyledDropdownFlyoutExpandIcon, EmptyState as EmptyState$1 } from '@procore/core-react';
|
|
4
4
|
import classnames from 'classnames/bind';
|
|
@@ -54082,19 +54082,34 @@ var ServerSideLocationFilterRenderer = React77.forwardRef(
|
|
|
54082
54082
|
determineSelectedState(value)
|
|
54083
54083
|
);
|
|
54084
54084
|
const [disabledValues, setDisabledValues] = React77.useState([]);
|
|
54085
|
+
const enableSublocationsInitialValue = value.some(
|
|
54086
|
+
(selected) => {
|
|
54087
|
+
var _a2;
|
|
54088
|
+
return (_a2 = selected.sublocations) == null ? void 0 : _a2.length;
|
|
54089
|
+
}
|
|
54090
|
+
);
|
|
54091
|
+
const getUniqDisabledValues = () => {
|
|
54092
|
+
const newDisabledValues = [];
|
|
54093
|
+
value.forEach((location) => {
|
|
54094
|
+
newDisabledValues.push(...findSublocations(location));
|
|
54095
|
+
});
|
|
54096
|
+
const uniqDisabledValues = uniqBy(prop("id"), newDisabledValues).filter(
|
|
54097
|
+
({ id }) => !selectedValueIds.includes(id)
|
|
54098
|
+
);
|
|
54099
|
+
return uniqDisabledValues;
|
|
54100
|
+
};
|
|
54101
|
+
useEffect(() => {
|
|
54102
|
+
if (enableSublocationsInitialValue && options.length) {
|
|
54103
|
+
setDisabledValues(getUniqDisabledValues());
|
|
54104
|
+
setEnableSublocations(true);
|
|
54105
|
+
}
|
|
54106
|
+
}, [options]);
|
|
54085
54107
|
const [enableSublocations, setEnableSublocations] = React77.useState(false);
|
|
54086
54108
|
const onSelectSublocations = React77.useCallback(() => {
|
|
54087
54109
|
if (enableSublocations) {
|
|
54088
54110
|
setDisabledValues([]);
|
|
54089
54111
|
} else {
|
|
54090
|
-
|
|
54091
|
-
value.forEach((location) => {
|
|
54092
|
-
newDisabledValues.push(...findSublocations(location));
|
|
54093
|
-
});
|
|
54094
|
-
const uniqDisabledValues = uniqBy(prop("id"), newDisabledValues).filter(
|
|
54095
|
-
({ id }) => !selectedValueIds.includes(id)
|
|
54096
|
-
);
|
|
54097
|
-
setDisabledValues(uniqDisabledValues);
|
|
54112
|
+
setDisabledValues(getUniqDisabledValues());
|
|
54098
54113
|
}
|
|
54099
54114
|
setEnableSublocations(!enableSublocations);
|
|
54100
54115
|
}, [enableSublocations, value, selectedValueIds, options]);
|
|
@@ -54150,18 +54165,18 @@ var ServerSideLocationFilterRenderer = React77.forwardRef(
|
|
|
54150
54165
|
const findSublocations = (selected) => {
|
|
54151
54166
|
return options.filter((option) => {
|
|
54152
54167
|
return startsWith(
|
|
54153
|
-
|
|
54154
|
-
getLabel3(option).toLowerCase()
|
|
54155
|
-
);
|
|
54168
|
+
getLabel3(selected).toLowerCase().replace(/\s+>\s+/g, " > "),
|
|
54169
|
+
getLabel3(option).toLowerCase().replace(/\s+>\s+/g, " > ")
|
|
54170
|
+
) && option.id !== selected.id;
|
|
54156
54171
|
});
|
|
54157
54172
|
};
|
|
54158
54173
|
const handleSelectSublocations = (selected) => {
|
|
54159
54174
|
if (enableSublocations) {
|
|
54160
54175
|
const filteredOptions = options.filter((option) => {
|
|
54161
54176
|
return startsWith(
|
|
54162
|
-
|
|
54163
|
-
getLabel3(option).toLowerCase()
|
|
54164
|
-
);
|
|
54177
|
+
getLabel3(selected).toLowerCase().replace(/ /g, ""),
|
|
54178
|
+
getLabel3(option).toLowerCase().replace(/ /g, "")
|
|
54179
|
+
) && option.id !== selected.id;
|
|
54165
54180
|
});
|
|
54166
54181
|
return filteredOptions;
|
|
54167
54182
|
} else {
|
|
@@ -54217,6 +54232,8 @@ var ServerSideLocationFilterRenderer = React77.forwardRef(
|
|
|
54217
54232
|
{
|
|
54218
54233
|
block: true,
|
|
54219
54234
|
onClear: () => {
|
|
54235
|
+
setEnableSublocations(false);
|
|
54236
|
+
setDisabledValues([]);
|
|
54220
54237
|
onChange([]);
|
|
54221
54238
|
},
|
|
54222
54239
|
label: `${I18n.t("dataTable.filters.locationFilter.locations")} ${value.length ? `(${value.length})` : ""}`
|
|
@@ -55253,7 +55270,10 @@ function transformServerSideRequestObj(request, filtersState, searchValue) {
|
|
|
55253
55270
|
)
|
|
55254
55271
|
};
|
|
55255
55272
|
}
|
|
55256
|
-
var transformFilterValue = (value) => {
|
|
55273
|
+
var transformFilterValue = (value, field, formatter) => {
|
|
55274
|
+
const formattedValue = formatter == null ? void 0 : formatter(value, field);
|
|
55275
|
+
if (formattedValue)
|
|
55276
|
+
return formattedValue;
|
|
55257
55277
|
if (value == null ? void 0 : value.date)
|
|
55258
55278
|
return formatISO(value.date, { representation: "date" });
|
|
55259
55279
|
return value.toString();
|
|
@@ -55280,8 +55300,11 @@ function getServerSideParams(request, filtersState, searchValue, options = {}) {
|
|
|
55280
55300
|
params.set("group", group);
|
|
55281
55301
|
}
|
|
55282
55302
|
if (options.filters !== false) {
|
|
55303
|
+
const formatter = options.filterValueFormatter;
|
|
55283
55304
|
filtersState.forEach((filter) => {
|
|
55284
|
-
const value = filter.selected.length === 1 ? transformFilterValue(filter.selected[0]) : `[${filter.selected.map(
|
|
55305
|
+
const value = filter.selected.length === 1 ? transformFilterValue(filter.selected[0], filter.field, formatter) : `[${filter.selected.map(
|
|
55306
|
+
(value2) => transformFilterValue(value2, filter.field, formatter)
|
|
55307
|
+
)}]`;
|
|
55285
55308
|
params.set(`filters[${filter.field}]`, value);
|
|
55286
55309
|
});
|
|
55287
55310
|
request.groupKeys.forEach((groupKey, index) => {
|
|
@@ -57625,7 +57648,7 @@ function useFilterStorage({
|
|
|
57625
57648
|
setFiltersState((prev) => {
|
|
57626
57649
|
const columnDefinition = getColumnDefinition(field);
|
|
57627
57650
|
return {
|
|
57628
|
-
...
|
|
57651
|
+
...prev,
|
|
57629
57652
|
selectedFilters: {
|
|
57630
57653
|
...prev.selectedFilters,
|
|
57631
57654
|
[field]: {
|
|
@@ -82817,9 +82840,6 @@ var Table = (props) => {
|
|
|
82817
82840
|
);
|
|
82818
82841
|
(_c2 = (_b2 = props.UNSAFE_internalAGGridOverrides) == null ? void 0 : _b2.onGridReady) == null ? void 0 : _c2.call(_b2, params);
|
|
82819
82842
|
};
|
|
82820
|
-
const postProcessPopup = (params) => {
|
|
82821
|
-
params.ePopup.style.top = `${HEADER_HEIGHT}px`;
|
|
82822
|
-
};
|
|
82823
82843
|
const internalOnRowSelected = (event) => {
|
|
82824
82844
|
var _a2, _b2, _c2;
|
|
82825
82845
|
(_a2 = props.onRowSelected) == null ? void 0 : _a2.call(props, event);
|
|
@@ -83069,6 +83089,7 @@ var Table = (props) => {
|
|
|
83069
83089
|
onGridReady,
|
|
83070
83090
|
onColumnEverythingChanged: props.onColumnEverythingChanged,
|
|
83071
83091
|
onModelUpdated,
|
|
83092
|
+
onCellFocused: props.onCellFocused,
|
|
83072
83093
|
onRowDragEnd,
|
|
83073
83094
|
onRowDragMove,
|
|
83074
83095
|
onRowGroupOpened: internalRowGroupOpened,
|
|
@@ -83081,7 +83102,6 @@ var Table = (props) => {
|
|
|
83081
83102
|
paginationPageSize: props.paginationPageSize || defaultPaginationPageSize,
|
|
83082
83103
|
popupParent: props.popupParent,
|
|
83083
83104
|
pinnedBottomRowData: props.pinnedBottomRowData,
|
|
83084
|
-
postProcessPopup,
|
|
83085
83105
|
rowBuffer: props.rowBuffer,
|
|
83086
83106
|
rowClassRules,
|
|
83087
83107
|
rowDragManaged: onSSDR ? false : props.rowDragManaged ?? true,
|
|
@@ -84084,9 +84104,9 @@ var LocationQuickFilterRenderer = ({
|
|
|
84084
84104
|
const findSublocations = (selected) => {
|
|
84085
84105
|
return options.filter((option) => {
|
|
84086
84106
|
return startsWith(
|
|
84087
|
-
|
|
84088
|
-
getLabel3(option).toLowerCase()
|
|
84089
|
-
);
|
|
84107
|
+
getLabel3(selected).toLowerCase().replace(/\s+>\s+/g, " > "),
|
|
84108
|
+
getLabel3(option).toLowerCase().replace(/\s+>\s+/g, " > ")
|
|
84109
|
+
) && option.id !== selected.id;
|
|
84090
84110
|
});
|
|
84091
84111
|
};
|
|
84092
84112
|
const handleSelectSublocations = (selected) => {
|
|
@@ -84149,6 +84169,8 @@ var LocationQuickFilterRenderer = ({
|
|
|
84149
84169
|
"dataTable.filters.locationFilter.locations"
|
|
84150
84170
|
)}${triggerLabel}`,
|
|
84151
84171
|
onClear: () => {
|
|
84172
|
+
setEnableSublocations(false);
|
|
84173
|
+
setDisabledValues([]);
|
|
84152
84174
|
onChange([]);
|
|
84153
84175
|
},
|
|
84154
84176
|
block: true
|
package/dist/modern/index.cjs
CHANGED
|
@@ -54052,19 +54052,31 @@ var ServerSideLocationFilterRenderer = React77__default.default.forwardRef(
|
|
|
54052
54052
|
determineSelectedState(value)
|
|
54053
54053
|
);
|
|
54054
54054
|
const [disabledValues, setDisabledValues] = React77__default.default.useState([]);
|
|
54055
|
+
const enableSublocationsInitialValue = value.some(
|
|
54056
|
+
(selected) => selected.sublocations?.length
|
|
54057
|
+
);
|
|
54058
|
+
const getUniqDisabledValues = () => {
|
|
54059
|
+
const newDisabledValues = [];
|
|
54060
|
+
value.forEach((location) => {
|
|
54061
|
+
newDisabledValues.push(...findSublocations(location));
|
|
54062
|
+
});
|
|
54063
|
+
const uniqDisabledValues = ramda.uniqBy(ramda.prop("id"), newDisabledValues).filter(
|
|
54064
|
+
({ id }) => !selectedValueIds.includes(id)
|
|
54065
|
+
);
|
|
54066
|
+
return uniqDisabledValues;
|
|
54067
|
+
};
|
|
54068
|
+
React77.useEffect(() => {
|
|
54069
|
+
if (enableSublocationsInitialValue && options.length) {
|
|
54070
|
+
setDisabledValues(getUniqDisabledValues());
|
|
54071
|
+
setEnableSublocations(true);
|
|
54072
|
+
}
|
|
54073
|
+
}, [options]);
|
|
54055
54074
|
const [enableSublocations, setEnableSublocations] = React77__default.default.useState(false);
|
|
54056
54075
|
const onSelectSublocations = React77__default.default.useCallback(() => {
|
|
54057
54076
|
if (enableSublocations) {
|
|
54058
54077
|
setDisabledValues([]);
|
|
54059
54078
|
} else {
|
|
54060
|
-
|
|
54061
|
-
value.forEach((location) => {
|
|
54062
|
-
newDisabledValues.push(...findSublocations(location));
|
|
54063
|
-
});
|
|
54064
|
-
const uniqDisabledValues = ramda.uniqBy(ramda.prop("id"), newDisabledValues).filter(
|
|
54065
|
-
({ id }) => !selectedValueIds.includes(id)
|
|
54066
|
-
);
|
|
54067
|
-
setDisabledValues(uniqDisabledValues);
|
|
54079
|
+
setDisabledValues(getUniqDisabledValues());
|
|
54068
54080
|
}
|
|
54069
54081
|
setEnableSublocations(!enableSublocations);
|
|
54070
54082
|
}, [enableSublocations, value, selectedValueIds, options]);
|
|
@@ -54120,18 +54132,18 @@ var ServerSideLocationFilterRenderer = React77__default.default.forwardRef(
|
|
|
54120
54132
|
const findSublocations = (selected) => {
|
|
54121
54133
|
return options.filter((option) => {
|
|
54122
54134
|
return ramda.startsWith(
|
|
54123
|
-
|
|
54124
|
-
getLabel3(option).toLowerCase()
|
|
54125
|
-
);
|
|
54135
|
+
getLabel3(selected).toLowerCase().replace(/\s+>\s+/g, " > "),
|
|
54136
|
+
getLabel3(option).toLowerCase().replace(/\s+>\s+/g, " > ")
|
|
54137
|
+
) && option.id !== selected.id;
|
|
54126
54138
|
});
|
|
54127
54139
|
};
|
|
54128
54140
|
const handleSelectSublocations = (selected) => {
|
|
54129
54141
|
if (enableSublocations) {
|
|
54130
54142
|
const filteredOptions = options.filter((option) => {
|
|
54131
54143
|
return ramda.startsWith(
|
|
54132
|
-
|
|
54133
|
-
getLabel3(option).toLowerCase()
|
|
54134
|
-
);
|
|
54144
|
+
getLabel3(selected).toLowerCase().replace(/ /g, ""),
|
|
54145
|
+
getLabel3(option).toLowerCase().replace(/ /g, "")
|
|
54146
|
+
) && option.id !== selected.id;
|
|
54135
54147
|
});
|
|
54136
54148
|
return filteredOptions;
|
|
54137
54149
|
} else {
|
|
@@ -54187,6 +54199,8 @@ var ServerSideLocationFilterRenderer = React77__default.default.forwardRef(
|
|
|
54187
54199
|
{
|
|
54188
54200
|
block: true,
|
|
54189
54201
|
onClear: () => {
|
|
54202
|
+
setEnableSublocations(false);
|
|
54203
|
+
setDisabledValues([]);
|
|
54190
54204
|
onChange([]);
|
|
54191
54205
|
},
|
|
54192
54206
|
label: `${I18n.t("dataTable.filters.locationFilter.locations")} ${value.length ? `(${value.length})` : ""}`
|
|
@@ -55201,7 +55215,10 @@ function transformServerSideRequestObj(request, filtersState, searchValue) {
|
|
|
55201
55215
|
)
|
|
55202
55216
|
};
|
|
55203
55217
|
}
|
|
55204
|
-
var transformFilterValue = (value) => {
|
|
55218
|
+
var transformFilterValue = (value, field, formatter) => {
|
|
55219
|
+
const formattedValue = formatter?.(value, field);
|
|
55220
|
+
if (formattedValue)
|
|
55221
|
+
return formattedValue;
|
|
55205
55222
|
if (value?.date)
|
|
55206
55223
|
return dateFns.formatISO(value.date, { representation: "date" });
|
|
55207
55224
|
return value.toString();
|
|
@@ -55227,8 +55244,11 @@ function getServerSideParams(request, filtersState, searchValue, options = {}) {
|
|
|
55227
55244
|
params.set("group", group);
|
|
55228
55245
|
}
|
|
55229
55246
|
if (options.filters !== false) {
|
|
55247
|
+
const formatter = options.filterValueFormatter;
|
|
55230
55248
|
filtersState.forEach((filter) => {
|
|
55231
|
-
const value = filter.selected.length === 1 ? transformFilterValue(filter.selected[0]) : `[${filter.selected.map(
|
|
55249
|
+
const value = filter.selected.length === 1 ? transformFilterValue(filter.selected[0], filter.field, formatter) : `[${filter.selected.map(
|
|
55250
|
+
(value2) => transformFilterValue(value2, filter.field, formatter)
|
|
55251
|
+
)}]`;
|
|
55232
55252
|
params.set(`filters[${filter.field}]`, value);
|
|
55233
55253
|
});
|
|
55234
55254
|
request.groupKeys.forEach((groupKey, index) => {
|
|
@@ -57527,7 +57547,7 @@ function useFilterStorage({
|
|
|
57527
57547
|
setFiltersState((prev) => {
|
|
57528
57548
|
const columnDefinition = getColumnDefinition(field);
|
|
57529
57549
|
return {
|
|
57530
|
-
...
|
|
57550
|
+
...prev,
|
|
57531
57551
|
selectedFilters: {
|
|
57532
57552
|
...prev.selectedFilters,
|
|
57533
57553
|
[field]: {
|
|
@@ -82625,9 +82645,6 @@ var Table = (props) => {
|
|
|
82625
82645
|
);
|
|
82626
82646
|
props.UNSAFE_internalAGGridOverrides?.onGridReady?.(params);
|
|
82627
82647
|
};
|
|
82628
|
-
const postProcessPopup = (params) => {
|
|
82629
|
-
params.ePopup.style.top = `${HEADER_HEIGHT}px`;
|
|
82630
|
-
};
|
|
82631
82648
|
const internalOnRowSelected = (event) => {
|
|
82632
82649
|
props.onRowSelected?.(event);
|
|
82633
82650
|
if (props.siblingGroupsRowSelectionDisabled) {
|
|
@@ -82874,6 +82891,7 @@ var Table = (props) => {
|
|
|
82874
82891
|
onGridReady,
|
|
82875
82892
|
onColumnEverythingChanged: props.onColumnEverythingChanged,
|
|
82876
82893
|
onModelUpdated,
|
|
82894
|
+
onCellFocused: props.onCellFocused,
|
|
82877
82895
|
onRowDragEnd,
|
|
82878
82896
|
onRowDragMove,
|
|
82879
82897
|
onRowGroupOpened: internalRowGroupOpened,
|
|
@@ -82886,7 +82904,6 @@ var Table = (props) => {
|
|
|
82886
82904
|
paginationPageSize: props.paginationPageSize || defaultPaginationPageSize,
|
|
82887
82905
|
popupParent: props.popupParent,
|
|
82888
82906
|
pinnedBottomRowData: props.pinnedBottomRowData,
|
|
82889
|
-
postProcessPopup,
|
|
82890
82907
|
rowBuffer: props.rowBuffer,
|
|
82891
82908
|
rowClassRules,
|
|
82892
82909
|
rowDragManaged: onSSDR ? false : props.rowDragManaged ?? true,
|
|
@@ -83879,9 +83896,9 @@ var LocationQuickFilterRenderer = ({
|
|
|
83879
83896
|
const findSublocations = (selected) => {
|
|
83880
83897
|
return options.filter((option) => {
|
|
83881
83898
|
return ramda.startsWith(
|
|
83882
|
-
|
|
83883
|
-
getLabel3(option).toLowerCase()
|
|
83884
|
-
);
|
|
83899
|
+
getLabel3(selected).toLowerCase().replace(/\s+>\s+/g, " > "),
|
|
83900
|
+
getLabel3(option).toLowerCase().replace(/\s+>\s+/g, " > ")
|
|
83901
|
+
) && option.id !== selected.id;
|
|
83885
83902
|
});
|
|
83886
83903
|
};
|
|
83887
83904
|
const handleSelectSublocations = (selected) => {
|
|
@@ -83944,6 +83961,8 @@ var LocationQuickFilterRenderer = ({
|
|
|
83944
83961
|
"dataTable.filters.locationFilter.locations"
|
|
83945
83962
|
)}${triggerLabel}`,
|
|
83946
83963
|
onClear: () => {
|
|
83964
|
+
setEnableSublocations(false);
|
|
83965
|
+
setDisabledValues([]);
|
|
83947
83966
|
onChange([]);
|
|
83948
83967
|
},
|
|
83949
83968
|
block: true
|
package/dist/modern/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _ag_grid_community_core from '@ag-grid-community/core';
|
|
2
|
-
import { ICellRendererParams, NumberFilterModel as NumberFilterModel$1, ColDef, IRowNode, ICellEditorParams, RowDataTransaction, RowNodeTransaction, ServerSideTransaction, GridApi, ICellEditor, RefreshCellsParams, RowNode as RowNode$1, Column, SelectionEventSourceType, ColumnPinnedType, RowHeightParams, CheckboxSelectionCallbackParams, ExcelDataType, RowGroupOpenedEvent, Module, RowSelectedEvent, ColumnEverythingChangedEvent, TabToNextCellParams, CellPosition, GetRowIdParams, ColumnApi, IFilter, IScalarFilterParams, ISimpleFilterParams } from '@ag-grid-community/core';
|
|
2
|
+
import { ICellRendererParams, NumberFilterModel as NumberFilterModel$1, ColDef, IRowNode, ICellEditorParams, RowDataTransaction, RowNodeTransaction, ServerSideTransaction, GridApi, ICellEditor, RefreshCellsParams, RowNode as RowNode$1, Column, SelectionEventSourceType, ColumnPinnedType, RowHeightParams, CheckboxSelectionCallbackParams, ExcelDataType, RowGroupOpenedEvent, Module, RowSelectedEvent, ColumnEverythingChangedEvent, CellFocusedEvent, TabToNextCellParams, CellPosition, GetRowIdParams, ColumnApi, IFilter, IScalarFilterParams, ISimpleFilterParams } from '@ag-grid-community/core';
|
|
3
3
|
import * as React$1 from 'react';
|
|
4
4
|
import React__default from 'react';
|
|
5
5
|
import { AgGridReactProps, AgReactUiProps } from '@ag-grid-community/react';
|
|
@@ -470,6 +470,8 @@ interface ColumnDefinition<TValue = any, TRenderer = React.FC<ICellRendererParam
|
|
|
470
470
|
groupId?: string;
|
|
471
471
|
cellEditor?: TEditor;
|
|
472
472
|
cellEditorParams?: TEditorParams;
|
|
473
|
+
cellEditorPopup?: boolean;
|
|
474
|
+
cellEditorPopupPosition?: 'over' | 'under';
|
|
473
475
|
cellCSVFormatter?: (value: TValue) => string;
|
|
474
476
|
cellExcelFormatter?: (value: TValue) => string;
|
|
475
477
|
cellExcelDataType?: string;
|
|
@@ -887,6 +889,12 @@ type ServerSideParamsOptions = {
|
|
|
887
889
|
* @default filters[search]
|
|
888
890
|
*/
|
|
889
891
|
searchKey?: string;
|
|
892
|
+
/**
|
|
893
|
+
* Custom function for formatting URL params.
|
|
894
|
+
* This function will help you to format URL params when value is an object.
|
|
895
|
+
* If the function does not return anything, the default behavior will be used.
|
|
896
|
+
*/
|
|
897
|
+
filterValueFormatter?: (value: any, field: string) => string | void;
|
|
890
898
|
};
|
|
891
899
|
interface RowActionsConfig extends Omit<ColDef, 'field' | 'pinned' | 'lockPinned' | 'lockVisible'> {
|
|
892
900
|
}
|
|
@@ -985,6 +993,7 @@ interface TableProps<TRow = any, TBottomRow = any> {
|
|
|
985
993
|
onSelectAll?: (param: SelectAllState.All | SelectAllState.None) => void;
|
|
986
994
|
onTableReady?: (tableApi: TableApi, tableApiRef: React.RefObject<TableApi>) => void;
|
|
987
995
|
onColumnEverythingChanged?: (changeEvent: ColumnEverythingChangedEvent) => void;
|
|
996
|
+
onCellFocused?: (event: CellFocusedEvent) => void;
|
|
988
997
|
onFirstDataRendered?: (event: FirstDataRenderedEvent) => void;
|
|
989
998
|
paginateChildRows?: boolean;
|
|
990
999
|
pagination?: boolean;
|
package/dist/modern/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _ag_grid_community_core from '@ag-grid-community/core';
|
|
2
|
-
import { ICellRendererParams, NumberFilterModel as NumberFilterModel$1, ColDef, IRowNode, ICellEditorParams, RowDataTransaction, RowNodeTransaction, ServerSideTransaction, GridApi, ICellEditor, RefreshCellsParams, RowNode as RowNode$1, Column, SelectionEventSourceType, ColumnPinnedType, RowHeightParams, CheckboxSelectionCallbackParams, ExcelDataType, RowGroupOpenedEvent, Module, RowSelectedEvent, ColumnEverythingChangedEvent, TabToNextCellParams, CellPosition, GetRowIdParams, ColumnApi, IFilter, IScalarFilterParams, ISimpleFilterParams } from '@ag-grid-community/core';
|
|
2
|
+
import { ICellRendererParams, NumberFilterModel as NumberFilterModel$1, ColDef, IRowNode, ICellEditorParams, RowDataTransaction, RowNodeTransaction, ServerSideTransaction, GridApi, ICellEditor, RefreshCellsParams, RowNode as RowNode$1, Column, SelectionEventSourceType, ColumnPinnedType, RowHeightParams, CheckboxSelectionCallbackParams, ExcelDataType, RowGroupOpenedEvent, Module, RowSelectedEvent, ColumnEverythingChangedEvent, CellFocusedEvent, TabToNextCellParams, CellPosition, GetRowIdParams, ColumnApi, IFilter, IScalarFilterParams, ISimpleFilterParams } from '@ag-grid-community/core';
|
|
3
3
|
import * as React$1 from 'react';
|
|
4
4
|
import React__default from 'react';
|
|
5
5
|
import { AgGridReactProps, AgReactUiProps } from '@ag-grid-community/react';
|
|
@@ -470,6 +470,8 @@ interface ColumnDefinition<TValue = any, TRenderer = React.FC<ICellRendererParam
|
|
|
470
470
|
groupId?: string;
|
|
471
471
|
cellEditor?: TEditor;
|
|
472
472
|
cellEditorParams?: TEditorParams;
|
|
473
|
+
cellEditorPopup?: boolean;
|
|
474
|
+
cellEditorPopupPosition?: 'over' | 'under';
|
|
473
475
|
cellCSVFormatter?: (value: TValue) => string;
|
|
474
476
|
cellExcelFormatter?: (value: TValue) => string;
|
|
475
477
|
cellExcelDataType?: string;
|
|
@@ -887,6 +889,12 @@ type ServerSideParamsOptions = {
|
|
|
887
889
|
* @default filters[search]
|
|
888
890
|
*/
|
|
889
891
|
searchKey?: string;
|
|
892
|
+
/**
|
|
893
|
+
* Custom function for formatting URL params.
|
|
894
|
+
* This function will help you to format URL params when value is an object.
|
|
895
|
+
* If the function does not return anything, the default behavior will be used.
|
|
896
|
+
*/
|
|
897
|
+
filterValueFormatter?: (value: any, field: string) => string | void;
|
|
890
898
|
};
|
|
891
899
|
interface RowActionsConfig extends Omit<ColDef, 'field' | 'pinned' | 'lockPinned' | 'lockVisible'> {
|
|
892
900
|
}
|
|
@@ -985,6 +993,7 @@ interface TableProps<TRow = any, TBottomRow = any> {
|
|
|
985
993
|
onSelectAll?: (param: SelectAllState.All | SelectAllState.None) => void;
|
|
986
994
|
onTableReady?: (tableApi: TableApi, tableApiRef: React.RefObject<TableApi>) => void;
|
|
987
995
|
onColumnEverythingChanged?: (changeEvent: ColumnEverythingChangedEvent) => void;
|
|
996
|
+
onCellFocused?: (event: CellFocusedEvent) => void;
|
|
988
997
|
onFirstDataRendered?: (event: FirstDataRenderedEvent) => void;
|
|
989
998
|
paginateChildRows?: boolean;
|
|
990
999
|
pagination?: boolean;
|
package/dist/modern/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React77, { useState, forwardRef, useContext, useRef, useImperativeHandle, useLayoutEffect, useCallback, useMemo, memo,
|
|
1
|
+
import React77, { useEffect, useState, forwardRef, useContext, useRef, useImperativeHandle, useLayoutEffect, useCallback, useMemo, memo, Component as Component$1, createElement } from 'react';
|
|
2
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, SelectButton, StyledSelectButton, typographyWeights, StyledSelectButtonLabel, StyledButton, StyledSelectArrow, Popover, UNSAFE_StyledSuperSelectTrigger, UNSAFE_StyledSuperSelectLabel, UNSAFE_StyledSuperSelectArrow, UNSAFE_StyledFilterTokenLabel, DateTimeProvider, useField, Label, UNSAFE_mergeRefs, ContactItem as ContactItem$1, ToggleButton, Link, AvatarStack, Pill, Typeahead, Pagination, UNSAFE_SuperSelect, UNSAFE_FilterToken, Avatar, H3, useI18n, I18nContext, UNSAFE_useSuperSelectContext, Checkbox, DropdownFlyout, useVisibility, StyledDropdownFlyoutLabel, StyledDropdownFlyoutExpandIcon, EmptyState as EmptyState$1 } from '@procore/core-react';
|
|
4
4
|
import classnames from 'classnames/bind';
|
|
@@ -54038,19 +54038,31 @@ var ServerSideLocationFilterRenderer = React77.forwardRef(
|
|
|
54038
54038
|
determineSelectedState(value)
|
|
54039
54039
|
);
|
|
54040
54040
|
const [disabledValues, setDisabledValues] = React77.useState([]);
|
|
54041
|
+
const enableSublocationsInitialValue = value.some(
|
|
54042
|
+
(selected) => selected.sublocations?.length
|
|
54043
|
+
);
|
|
54044
|
+
const getUniqDisabledValues = () => {
|
|
54045
|
+
const newDisabledValues = [];
|
|
54046
|
+
value.forEach((location) => {
|
|
54047
|
+
newDisabledValues.push(...findSublocations(location));
|
|
54048
|
+
});
|
|
54049
|
+
const uniqDisabledValues = uniqBy(prop("id"), newDisabledValues).filter(
|
|
54050
|
+
({ id }) => !selectedValueIds.includes(id)
|
|
54051
|
+
);
|
|
54052
|
+
return uniqDisabledValues;
|
|
54053
|
+
};
|
|
54054
|
+
useEffect(() => {
|
|
54055
|
+
if (enableSublocationsInitialValue && options.length) {
|
|
54056
|
+
setDisabledValues(getUniqDisabledValues());
|
|
54057
|
+
setEnableSublocations(true);
|
|
54058
|
+
}
|
|
54059
|
+
}, [options]);
|
|
54041
54060
|
const [enableSublocations, setEnableSublocations] = React77.useState(false);
|
|
54042
54061
|
const onSelectSublocations = React77.useCallback(() => {
|
|
54043
54062
|
if (enableSublocations) {
|
|
54044
54063
|
setDisabledValues([]);
|
|
54045
54064
|
} else {
|
|
54046
|
-
|
|
54047
|
-
value.forEach((location) => {
|
|
54048
|
-
newDisabledValues.push(...findSublocations(location));
|
|
54049
|
-
});
|
|
54050
|
-
const uniqDisabledValues = uniqBy(prop("id"), newDisabledValues).filter(
|
|
54051
|
-
({ id }) => !selectedValueIds.includes(id)
|
|
54052
|
-
);
|
|
54053
|
-
setDisabledValues(uniqDisabledValues);
|
|
54065
|
+
setDisabledValues(getUniqDisabledValues());
|
|
54054
54066
|
}
|
|
54055
54067
|
setEnableSublocations(!enableSublocations);
|
|
54056
54068
|
}, [enableSublocations, value, selectedValueIds, options]);
|
|
@@ -54106,18 +54118,18 @@ var ServerSideLocationFilterRenderer = React77.forwardRef(
|
|
|
54106
54118
|
const findSublocations = (selected) => {
|
|
54107
54119
|
return options.filter((option) => {
|
|
54108
54120
|
return startsWith(
|
|
54109
|
-
|
|
54110
|
-
getLabel3(option).toLowerCase()
|
|
54111
|
-
);
|
|
54121
|
+
getLabel3(selected).toLowerCase().replace(/\s+>\s+/g, " > "),
|
|
54122
|
+
getLabel3(option).toLowerCase().replace(/\s+>\s+/g, " > ")
|
|
54123
|
+
) && option.id !== selected.id;
|
|
54112
54124
|
});
|
|
54113
54125
|
};
|
|
54114
54126
|
const handleSelectSublocations = (selected) => {
|
|
54115
54127
|
if (enableSublocations) {
|
|
54116
54128
|
const filteredOptions = options.filter((option) => {
|
|
54117
54129
|
return startsWith(
|
|
54118
|
-
|
|
54119
|
-
getLabel3(option).toLowerCase()
|
|
54120
|
-
);
|
|
54130
|
+
getLabel3(selected).toLowerCase().replace(/ /g, ""),
|
|
54131
|
+
getLabel3(option).toLowerCase().replace(/ /g, "")
|
|
54132
|
+
) && option.id !== selected.id;
|
|
54121
54133
|
});
|
|
54122
54134
|
return filteredOptions;
|
|
54123
54135
|
} else {
|
|
@@ -54173,6 +54185,8 @@ var ServerSideLocationFilterRenderer = React77.forwardRef(
|
|
|
54173
54185
|
{
|
|
54174
54186
|
block: true,
|
|
54175
54187
|
onClear: () => {
|
|
54188
|
+
setEnableSublocations(false);
|
|
54189
|
+
setDisabledValues([]);
|
|
54176
54190
|
onChange([]);
|
|
54177
54191
|
},
|
|
54178
54192
|
label: `${I18n.t("dataTable.filters.locationFilter.locations")} ${value.length ? `(${value.length})` : ""}`
|
|
@@ -55187,7 +55201,10 @@ function transformServerSideRequestObj(request, filtersState, searchValue) {
|
|
|
55187
55201
|
)
|
|
55188
55202
|
};
|
|
55189
55203
|
}
|
|
55190
|
-
var transformFilterValue = (value) => {
|
|
55204
|
+
var transformFilterValue = (value, field, formatter) => {
|
|
55205
|
+
const formattedValue = formatter?.(value, field);
|
|
55206
|
+
if (formattedValue)
|
|
55207
|
+
return formattedValue;
|
|
55191
55208
|
if (value?.date)
|
|
55192
55209
|
return formatISO(value.date, { representation: "date" });
|
|
55193
55210
|
return value.toString();
|
|
@@ -55213,8 +55230,11 @@ function getServerSideParams(request, filtersState, searchValue, options = {}) {
|
|
|
55213
55230
|
params.set("group", group);
|
|
55214
55231
|
}
|
|
55215
55232
|
if (options.filters !== false) {
|
|
55233
|
+
const formatter = options.filterValueFormatter;
|
|
55216
55234
|
filtersState.forEach((filter) => {
|
|
55217
|
-
const value = filter.selected.length === 1 ? transformFilterValue(filter.selected[0]) : `[${filter.selected.map(
|
|
55235
|
+
const value = filter.selected.length === 1 ? transformFilterValue(filter.selected[0], filter.field, formatter) : `[${filter.selected.map(
|
|
55236
|
+
(value2) => transformFilterValue(value2, filter.field, formatter)
|
|
55237
|
+
)}]`;
|
|
55218
55238
|
params.set(`filters[${filter.field}]`, value);
|
|
55219
55239
|
});
|
|
55220
55240
|
request.groupKeys.forEach((groupKey, index) => {
|
|
@@ -57513,7 +57533,7 @@ function useFilterStorage({
|
|
|
57513
57533
|
setFiltersState((prev) => {
|
|
57514
57534
|
const columnDefinition = getColumnDefinition(field);
|
|
57515
57535
|
return {
|
|
57516
|
-
...
|
|
57536
|
+
...prev,
|
|
57517
57537
|
selectedFilters: {
|
|
57518
57538
|
...prev.selectedFilters,
|
|
57519
57539
|
[field]: {
|
|
@@ -82611,9 +82631,6 @@ var Table = (props) => {
|
|
|
82611
82631
|
);
|
|
82612
82632
|
props.UNSAFE_internalAGGridOverrides?.onGridReady?.(params);
|
|
82613
82633
|
};
|
|
82614
|
-
const postProcessPopup = (params) => {
|
|
82615
|
-
params.ePopup.style.top = `${HEADER_HEIGHT}px`;
|
|
82616
|
-
};
|
|
82617
82634
|
const internalOnRowSelected = (event) => {
|
|
82618
82635
|
props.onRowSelected?.(event);
|
|
82619
82636
|
if (props.siblingGroupsRowSelectionDisabled) {
|
|
@@ -82860,6 +82877,7 @@ var Table = (props) => {
|
|
|
82860
82877
|
onGridReady,
|
|
82861
82878
|
onColumnEverythingChanged: props.onColumnEverythingChanged,
|
|
82862
82879
|
onModelUpdated,
|
|
82880
|
+
onCellFocused: props.onCellFocused,
|
|
82863
82881
|
onRowDragEnd,
|
|
82864
82882
|
onRowDragMove,
|
|
82865
82883
|
onRowGroupOpened: internalRowGroupOpened,
|
|
@@ -82872,7 +82890,6 @@ var Table = (props) => {
|
|
|
82872
82890
|
paginationPageSize: props.paginationPageSize || defaultPaginationPageSize,
|
|
82873
82891
|
popupParent: props.popupParent,
|
|
82874
82892
|
pinnedBottomRowData: props.pinnedBottomRowData,
|
|
82875
|
-
postProcessPopup,
|
|
82876
82893
|
rowBuffer: props.rowBuffer,
|
|
82877
82894
|
rowClassRules,
|
|
82878
82895
|
rowDragManaged: onSSDR ? false : props.rowDragManaged ?? true,
|
|
@@ -83865,9 +83882,9 @@ var LocationQuickFilterRenderer = ({
|
|
|
83865
83882
|
const findSublocations = (selected) => {
|
|
83866
83883
|
return options.filter((option) => {
|
|
83867
83884
|
return startsWith(
|
|
83868
|
-
|
|
83869
|
-
getLabel3(option).toLowerCase()
|
|
83870
|
-
);
|
|
83885
|
+
getLabel3(selected).toLowerCase().replace(/\s+>\s+/g, " > "),
|
|
83886
|
+
getLabel3(option).toLowerCase().replace(/\s+>\s+/g, " > ")
|
|
83887
|
+
) && option.id !== selected.id;
|
|
83871
83888
|
});
|
|
83872
83889
|
};
|
|
83873
83890
|
const handleSelectSublocations = (selected) => {
|
|
@@ -83930,6 +83947,8 @@ var LocationQuickFilterRenderer = ({
|
|
|
83930
83947
|
"dataTable.filters.locationFilter.locations"
|
|
83931
83948
|
)}${triggerLabel}`,
|
|
83932
83949
|
onClear: () => {
|
|
83950
|
+
setEnableSublocations(false);
|
|
83951
|
+
setDisabledValues([]);
|
|
83933
83952
|
onChange([]);
|
|
83934
83953
|
},
|
|
83935
83954
|
block: true
|