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

packages/plugin-define-enum - Enable sort and filtering #97

Open
Aralun opened this issue Jul 9, 2024 · 1 comment
Open

packages/plugin-define-enum - Enable sort and filtering #97

Aralun opened this issue Jul 9, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@Aralun
Copy link

Aralun commented Jul 9, 2024

I've added some sorting and filtering to fields defined with the plugin.
The code looked very boiler-platey, so maybe it could be included in the plugin?

    .replaceFieldSorting(newFieldName, [
      { field: fieldName, ascending: true },
    ])
    .replaceFieldOperator(newFieldName, 'Equal', (v) => ({
      field: fieldName,
      operator: 'Equal',
      value: v ? enumObject[v] : null,
    }))
    .replaceFieldOperator(newFieldName, 'NotEqual', (v) => ({
      field: fieldName,
      operator: 'NotEqual',
      value: v ? enumObject[v] : null,
    }))
    .replaceFieldOperator(newFieldName, 'Present', () => ({
      field: fieldName,
      operator: 'Present',
    }))
    .replaceFieldOperator(newFieldName, 'Blank', () => ({
      field: fieldName,
      operator: 'Blank',
    }))

I don't know if there are subtle implications to this, for example on matters of performance.
If so, it might be worth hiding these behind enableSorting / enableFiltering options.

@Thenkei Thenkei changed the title Enable sort / filtering on plugin-define-enum packages/plugin-define-enum - Enable sort and filtering Jul 15, 2024
@Thenkei Thenkei self-assigned this Jul 15, 2024
@Thenkei Thenkei added the enhancement New feature or request label Jul 15, 2024
@Thenkei
Copy link
Contributor

Thenkei commented Jul 15, 2024

Hey @Aralun,

It's indeed a good idea! Most of our team is on Holiday vacation so we will add this when we will have a little time.

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

No branches or pull requests

2 participants