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(module:table): add nzSortDirections to table global config (#6613) #8721

Merged
merged 5 commits into from
Nov 22, 2024

Conversation

sharakouze
Copy link
Contributor

@sharakouze sharakouze commented Aug 31, 2024

add nzSortDirections to table global config

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Application (the showcase website) / infrastructure changes
  • Other... Please describe:

What is the current behavior?

We can't change nzSortDirections for table component globally

Issue Number: #6613

What is the new behavior?

We can now change nzSortDirections for table component globally in the TableConfig object

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Sorry, something went wrong.

…RRO#6613)

add nzSortDirections to table global config
@sharakouze sharakouze changed the title feat(module:table): add nzSortDirection to table global config (#6613) feat(module:table): add nzSortDirections to table global config (#6613) Aug 31, 2024
Copy link
Collaborator

@HyperLife1119 HyperLife1119 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

codecov bot commented Sep 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.89%. Comparing base (c610d61) to head (0807f0e).
Report is 112 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8721      +/-   ##
==========================================
+ Coverage   91.57%   91.89%   +0.32%     
==========================================
  Files         538      546       +8     
  Lines       18459    19291     +832     
  Branches     2816     2850      +34     
==========================================
+ Hits        16903    17728     +825     
- Misses       1238     1251      +13     
+ Partials      318      312       -6     

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


🚨 Try these New Features:

Copy link
Collaborator

@Laffery Laffery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please solve the CI error

remove reference to NzTableSortOrder in config
@sharakouze
Copy link
Contributor Author

please solve the CI error

Done!

@@ -18,7 +18,6 @@ import {
NzSizeMDSType,
NzTSType
} from 'ng-zorro-antd/core/types';
import { NzTableSortOrder } from 'ng-zorro-antd/table';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import type { NzTableSortOrder } from 'ng-zorro-antd/table';

Copy link
Contributor Author

@sharakouze sharakouze Sep 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still have the same error if using this import :

Entry point ng-zorro-antd/table has a circular dependency on ng-zorro-antd/core/config.

Copy link
Collaborator

@Laffery Laffery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Laffery Laffery added this to the v18.2 milestone Sep 4, 2024
Copy link
Collaborator

@Laffery Laffery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please mark nzSortDirections as global config in the documents components/table/doc/*.md

@@ -296,6 +296,7 @@ export interface TableConfig {
nzShowSizeChanger?: boolean;
nzSimple?: boolean;
nzHideOnSinglePage?: boolean;
nzSortDirections?: Array<string | null>;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about migrate NzTableSortOrder to ng-zorro-antd/core/types ?

if use Array<string | null>, code auto-completion and type check won't work

Copy link
Contributor Author

@sharakouze sharakouze Sep 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this, it would be a breaking change (if you use this type in your code) and it's not worth the bother.

Maybe we can simplify and replace all occurences of NzTableSortOrder with string | null?
Currently NzTableSortOrder is like that : export type NzTableSortOrder = string | 'ascend' | 'descend' | null;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, what should I do ?

Copy link
Collaborator

@Laffery Laffery Nov 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about adding a document link here?

Suggested change
nzSortDirections?: Array<string | null>;
/**
* @see {@link NzTableSortOrder}
*/
nzSortDirections?: Array<string | 'ascend' | 'descend' | null>;

mark nzSortDirections as global config
@sharakouze
Copy link
Contributor Author

Please mark nzSortDirections as global config in the documents components/table/doc/*.md

It's done

@sharakouze
Copy link
Contributor Author

Could we discuss about what should I do to finish this PR ?

add link to NzTableSortOrder in config
Copy link
Collaborator

@Laffery Laffery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Laffery Laffery merged commit eb1fdc5 into NG-ZORRO:master Nov 22, 2024
1 of 4 checks passed
@sharakouze sharakouze deleted the nzsortdirections-global-config branch November 25, 2024 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants