Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added filter option for Select #1473

Merged
merged 2 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "17.0.5",
"version": "17.1.0",
"license": "MIT",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/components/data-grid/DataGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ export const DataGrid = ({
const gridState: DataGridState = JSON.parse(state);

try {
api?.applyColumnState({ state: gridState.columnState });
api?.applyColumnState({ state: gridState.columnState, applyOrder: true });
api?.setColumnGroupState(gridState.columnGroupState);
if (gridState?.pageSize) {
api?.setGridOption('paginationPageSize', gridState.pageSize);
Expand Down
2 changes: 2 additions & 0 deletions src/components/select/single-select/SingleSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const SingleSelect = <
createText = (inputValue: string) => `Create ${inputValue}`,
noOptionsMessage = () => 'No options',
onCreateOption,
filterOption,
loadOptions,
cacheOptions,
inputId,
Expand Down Expand Up @@ -319,6 +320,7 @@ export const SingleSelect = <
loadOptions={loadOptions}
cacheOptions={cacheOptions}
defaultOptions={options}
filterOption={filterOption}
/>
);
}
Expand Down
6 changes: 6 additions & 0 deletions src/components/select/single-select/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { FilterOptionOption } from 'react-select/dist/declarations/src/filters';

export type Option<T, ValueKey extends string, LabelKey extends string> = {
[key in ValueKey]: T;
} & {
Expand Down Expand Up @@ -27,6 +29,10 @@ interface BaseSingleSelectProps<ValueType, ValueKey extends string, LabelKey ext
onCreateOption?: (inputValue: string) => void;
multi?: boolean;
loadOptions?: (inputValue: string) => Promise<Option<ValueType, ValueKey, LabelKey>[]>;
filterOption?:
| ((option: FilterOptionOption<Option<ValueType, ValueKey, LabelKey>>, inputValue: string) => boolean)
| null
| undefined;
cacheOptions?: boolean;
/** @deprecated Don't use this prop, it will be removed in the future */
inputId?: string;
Expand Down
Loading