-
Notifications
You must be signed in to change notification settings - Fork 662
🎴 CardView - HeaderFilter - implement #29627
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
Merged
Raushen
merged 19 commits into
DevExpress:grids/cardview/main
from
Raushen:grids/cardview/main_FilterSync2
Apr 17, 2025
Merged
Changes from 17 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
8f784a6
CardView: DataController: implement Remote Operations (#28835)
Raushen 6f979a4
Remove summary operation
Raushen 51ae18c
Merge branch 'grids/cardview/main' of github.com:DevExpress/DevExtrem…
Raushen 884c0d5
Merge branch 'grids/cardview/main' of github.com:DevExpress/DevExtrem…
Raushen d770580
Spike
Raushen badb73c
Spike filtering HeaderFilter data source
Raushen e1210fa
fix filterType issue
Raushen 85f7715
Spike
Raushen 31f79ce
Apply visitors
Raushen dd58ed5
Fix context initialization
Raushen b90f533
Fix filter expression
Raushen 33d18a0
Add jest tests
Raushen 13c6c8a
fix jest tests
Raushen 0e80531
Fix e2e tests
Raushen 2afc680
Merge branch 'grids/cardview/main' of github.com:DevExpress/DevExtrem…
Raushen 78cac76
import fix
Raushen f8b9637
Revert changes
Raushen f263b8d
Add e2e tests
Raushen 1f2c871
Fix review comments
Raushen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 46 additions & 16 deletions
62
packages/devextreme/js/__internal/grids/new/grid_core/filtering/filter_controller.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,37 +1,67 @@ | ||
| /* eslint-disable spellcheck/spell-checker */ | ||
| /* eslint-disable @typescript-eslint/no-unsafe-return */ | ||
| import { computed } from '@ts/core/reactive/index'; | ||
|
|
||
| import type { SubsGetsUpd } from '@ts/core/reactive/index'; | ||
| import { computed, state } from '@ts/core/reactive/index'; | ||
| import { anyOf, noneOf } from '@ts/grids/grid_core/filter/m_filter_custom_operations'; | ||
| import gridCoreUtils from '@ts/grids/grid_core/m_utils'; | ||
|
|
||
| import { ColumnsController } from '../columns_controller/index'; | ||
| import { OptionsController } from '../options_controller/options_controller'; | ||
| import { SearchController } from '../search/index'; | ||
| import type { AppliedFilters } from './types'; | ||
| import { getAppliedFilterExpressions } from './utils'; | ||
|
|
||
| export class FilterController { | ||
| public readonly filter = this.options.twoWay('filterValue'); | ||
| public readonly filterSyncEnabled = this.options.oneWay('filterSyncEnabled'); | ||
Raushen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| private readonly filterBuilderCustomOperations = this.options.oneWay('filterBuilder.customOperations'); | ||
|
|
||
| public readonly appliedFilters: SubsGetsUpd<AppliedFilters> = state({}); | ||
|
|
||
| public readonly filterEnabled = this.options.twoWay('filterPanel.filterEnabled'); | ||
| public static dependencies = [ | ||
| OptionsController, | ||
| ColumnsController, | ||
| ] as const; | ||
|
|
||
| public readonly customOperations = computed( | ||
| (fbCustomOperations) => [ | ||
| anyOf(null), | ||
| noneOf(null), | ||
| ].concat(fbCustomOperations) | ||
| .filter((o) => o), | ||
| [this.filterBuilderCustomOperations], | ||
| ); | ||
|
|
||
| public static dependencies = [OptionsController, SearchController] as const; | ||
| private readonly appliedFilterExpressions = computed( | ||
| ( | ||
| appliedFilters, | ||
| columns, | ||
| customOperations, | ||
| ) => getAppliedFilterExpressions(appliedFilters, columns, customOperations), | ||
| [ | ||
| this.appliedFilters, | ||
| this.columnsController.visibleColumns, | ||
| this.customOperations, | ||
| ], | ||
| ); | ||
|
|
||
| public readonly displayFilter = computed( | ||
| (filterEnabled, filter, searchFilter) => { | ||
| if (!filterEnabled) { | ||
| return searchFilter; | ||
| } | ||
| return gridCoreUtils.combineFilters([filter, searchFilter]); | ||
| }, | ||
| (filters) => gridCoreUtils.combineFilters(filters), | ||
| [ | ||
| this.filterEnabled, | ||
| this.filter, | ||
| this.searchController.searchFilter, | ||
| this.appliedFilterExpressions, | ||
| ], | ||
| ); | ||
|
|
||
| public clearFilterContext: unknown = null; | ||
|
|
||
| constructor( | ||
| private readonly options: OptionsController, | ||
| private readonly searchController: SearchController, | ||
| private readonly columnsController: ColumnsController, | ||
| ) { } | ||
|
|
||
| public clearFilterCallback = (): void => {}; | ||
|
|
||
| public clearFilter(): void { | ||
| this.filter.update(null); | ||
| this.clearFilterCallback.call(this.clearFilterContext); | ||
| } | ||
| } | ||
36 changes: 36 additions & 0 deletions
36
...treme/js/__internal/grids/new/grid_core/filtering/filter_visitors/clear_filter_visitor.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| /* eslint-disable spellcheck/spell-checker */ | ||
| import { OptionsController } from '../../options_controller/options_controller'; | ||
| import { SearchController } from '../../search/index'; | ||
| import { FilterController } from '../filter_controller'; | ||
| import { HeaderFilterController } from '../header_filter/index'; | ||
|
|
||
| export class ClearFilterVisitor { | ||
| public static dependencies = [ | ||
| OptionsController, | ||
| SearchController, | ||
| HeaderFilterController, | ||
| FilterController, | ||
| ] as const; | ||
|
|
||
| private readonly filter = this.options.twoWay('filterValue'); | ||
Raushen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| public readonly filterSyncEnabled = this.options.oneWay('filterSyncEnabled'); | ||
Raushen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| constructor( | ||
| private readonly options: OptionsController, | ||
| private readonly searchController: SearchController, | ||
| private readonly headerFilterController: HeaderFilterController, | ||
| private readonly filterController: FilterController, | ||
| ) { | ||
| this.filterController.clearFilterCallback = this.clearFilters; | ||
| this.filterController.clearFilterContext = this; | ||
Raushen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| public clearFilters(): void { | ||
| this.searchController.searchTextOption.update(''); | ||
| this.filter.update(null); | ||
| if (!this.filterSyncEnabled.unreactive_get()) { | ||
| this.headerFilterController.clearHeaderFilters(); | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
So, we revert change filterType -> headerFilter.filterType?
Maybe then remove change filterValue -> headerFilter.filterValue?
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.
Under discussing with PMs.