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

feat(filters): add new optional filterShortcuts to Column Filter #1575

Merged
merged 9 commits into from
Jun 15, 2024

Conversation

ghiscoding
Copy link
Owner

@ghiscoding ghiscoding commented Jun 14, 2024

closes #1569

  • user will be able to declare some Filter Shortcuts that will be added to the Column Header Menu that the shortcuts were defined, it can be declared via an array that must include at least a title (or titleKey) and a searchTerms array, lastly an optional operator can also be provided
  • the available properties of these shortcut is a merge of Header Menu Item (except command and action which are reserved) and an addition of our required props which are the extra searchTerms and operator (which as you can guess are the same props as a Column Filter for example what we use in preset)
  • here's a code sample of it
this.columnDefinitions = [{
    id: 'country', name: 'Country of Origin', field: 'country',
    filter: {
      model: Filters.inputText,
      filterShortcuts: [
        { title: 'Blank Values', searchTerms: ['A'], operator: '<', iconCssClass: 'mdi mdi-filter-minus-outline', },
        { title: 'Non-Blank Values', searchTerms: ['A'], operator: '>', iconCssClass: 'mdi mdi-filter-plus-outline', },
      ]
    },
  },
];

TODOs

  • add unit tests
  • add Cypress tests
  • add documentation
  • test UI with Locale translations

demo

brave_iNBMcswLvc

Copy link

stackblitz bot commented Jun 14, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@ghiscoding
Copy link
Owner Author

ghiscoding commented Jun 14, 2024

cc @zewa666 @jr01

so the only thing I'm not sure is the position in the Column Header Menu, it's starting to be crowded a little. I think it's ok where I've put it but just in case, I also expose a configurable filterShortcutsPositionOrder (that's the only built-in one that I exposed and it's current position index is 55).

I might also keep it only available on the Column Filter for now, I'm not sure I want to spend time on adding it to the Grid Option since that doesn't seem to be much of a request for now.

Note that you can try a live demo by clicking the Stackblitz button just above

image

Copy link

codecov bot commented Jun 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.8%. Comparing base (025888d) to head (dc111d6).

Current head dc111d6 differs from pull request most recent head 65bc0bf

Please upload reports for the commit 65bc0bf to get more accurate results.

Additional details and impacted files
@@           Coverage Diff            @@
##           master   #1575     +/-   ##
========================================
+ Coverage    99.8%   99.8%   +0.1%     
========================================
  Files         198     198             
  Lines       21746   21759     +13     
  Branches     7282    7287      +5     
========================================
+ Hits        21685   21698     +13     
  Misses         55      55             
  Partials        6       6             

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jr01
Copy link
Collaborator

jr01 commented Jun 14, 2024

Hey @ghiscoding - I think this looks pretty good and I don't feel it's crowded at all! Go for it!

@zewa666
Copy link
Contributor

zewa666 commented Jun 14, 2024

great work, looks sweet. looking forward to this one

@ghiscoding ghiscoding merged commit cbd6ae4 into master Jun 15, 2024
6 checks passed
@ghiscoding ghiscoding deleted the feat/filter-shortcuts branch June 15, 2024 03:47
@ghiscoding
Copy link
Owner Author

ghiscoding commented Jun 18, 2024

@zewa666 I released everything last night, we should be good for a while (I would think anyway 😄)... oh well I say that and I just found and fixed another small issue but it's small and that can definitely wait.

Cheers and thanks for all

@zewa666
Copy link
Contributor

zewa666 commented Jun 18, 2024

awesome, thx a lot gonna give it a try tomorrow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Filter for blanks / non blanks
3 participants