Skip to content

feat(module:table): add nzSortDirections to table global config (#6613)#8721

Merged
Laffery merged 5 commits intoNG-ZORRO:masterfrom
sharakouze:nzsortdirections-global-config
Nov 22, 2024
Merged

feat(module:table): add nzSortDirections to table global config (#6613)#8721
Laffery merged 5 commits intoNG-ZORRO:masterfrom
sharakouze:nzsortdirections-global-config

Conversation

@sharakouze
Copy link
Copy Markdown
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

@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
Copy Markdown
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

@codecov
Copy link
Copy Markdown

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:

Comment thread components/core/config/config.ts Outdated
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

please solve the CI error

Done!

Comment thread components/core/config/config.ts Outdated
NzSizeMDSType,
NzTSType
} from 'ng-zorro-antd/core/types';
import { NzTableSortOrder } from 'ng-zorro-antd/table';
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

Comment thread components/core/config/config.ts Outdated
nzShowSizeChanger?: boolean;
nzSimple?: boolean;
nzHideOnSinglePage?: boolean;
nzSortDirections?: Array<string | null>;
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

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

It's done

@sharakouze
Copy link
Copy Markdown
Contributor Author

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

add link to NzTableSortOrder in config
Copy link
Copy Markdown
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
@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.

4 participants