-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[core] Create dedicated InputComponent
s for single select and date filters
#3227
[core] Create dedicated InputComponent
s for single select and date filters
#3227
Conversation
InputComponent
for single select filter
We should keep the logic for the |
a535e35
to
1b45845
Compare
I have put Date inputs in a dedicated component because I was looking to modify their InputProps #3222 |
InputComponent
for single select filterInputComponent
s for single select and date filters
packages/grid/_modules_/grid/models/colDef/gridSingleSelectOperators.ts
Outdated
Show resolved
Hide resolved
packages/grid/_modules_/grid/models/colDef/gridSingleSelectOperators.ts
Outdated
Show resolved
Hide resolved
packages/grid/_modules_/grid/components/panel/filterPanel/GridFilterInputValue.tsx
Outdated
Show resolved
Hide resolved
packages/grid/_modules_/grid/components/panel/filterPanel/GridFilterInputValue.tsx
Show resolved
Hide resolved
packages/grid/_modules_/grid/components/panel/filterPanel/GridFilterInputSingleSelect.tsx
Outdated
Show resolved
Hide resolved
packages/grid/_modules_/grid/components/panel/filterPanel/GridFilterInputDate.tsx
Outdated
Show resolved
Hide resolved
packages/grid/_modules_/grid/components/panel/filterPanel/GridFilterInputDate.tsx
Show resolved
Hide resolved
packages/grid/_modules_/grid/models/colDef/gridSingleSelectOperators.ts
Outdated
Show resolved
Hide resolved
packages/grid/_modules_/grid/components/panel/filterPanel/GridFilterInputDate.tsx
Outdated
Show resolved
Hide resolved
packages/grid/_modules_/grid/components/panel/filterPanel/GridFilterInputDate.tsx
Outdated
Show resolved
Hide resolved
packages/grid/_modules_/grid/components/panel/filterPanel/GridFilterInputDate.tsx
Outdated
Show resolved
Hide resolved
packages/grid/_modules_/grid/components/panel/filterPanel/GridFilterInputSingleSelect.tsx
Outdated
Show resolved
Hide resolved
); | ||
}; | ||
|
||
export interface GridFilterInputSingleSelectProps extends GridFilterInputValueProps { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't we merge the props with TextFieldProps
here instead of below ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems that we can not extend with a union of type, so we cannot do
export interface GridFilterInputSingleSelectProps extends GridFilterInputValueProps, TextFieldProps {
type?: 'singleSelect';
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case I think we should use a type
export type GridFilterInputSingleSelectProps = GridFilterInputValueProps & TextFieldProps & { type?: 'singleSelect' }
It's not great, but exporting an incomplete interface seems worse to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I corrected it for the two new components. I can not do it for theGridFilterInputValue
because the type GridFilterInputValueProps
is already exported. I add it as a comment in the breaking change issue
packages/grid/_modules_/grid/components/panel/filterPanel/GridFilterInputSingleSelect.tsx
Outdated
Show resolved
Hide resolved
packages/grid/_modules_/grid/components/panel/filterPanel/GridFilterInputSingleSelect.tsx
Outdated
Show resolved
Hide resolved
InputComponent
s for single select and date filtersInputComponent
s for single select and date filters
shrink: true, | ||
}} | ||
inputRef={focusElementRef} | ||
{...other} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a problem here, but per convention other
should always be last prop to be spread.
Context: #3198 (comment)
I have a doubt about the second commit. If the
GridFilterInputValue
component is used by developers, removing the support forsingleSelect
type will be a breaking change