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: add provide function #7952

Merged
merged 5 commits into from
Sep 18, 2023
Merged

Conversation

MunMunMiao
Copy link
Collaborator

@MunMunMiao MunMunMiao commented May 17, 2023

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

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

What is the current behavior?

Issue Number: #7953

What is the new behavior?

See: #7953

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

@codecov
Copy link

codecov bot commented May 17, 2023

Codecov Report

Merging #7952 (d70b4a5) into master (169181c) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

❗ Current head d70b4a5 differs from pull request most recent head 02a6149. Consider uploading reports for the commit 02a6149 to get more accurate results

@@            Coverage Diff             @@
##           master    #7952      +/-   ##
==========================================
- Coverage   91.80%   91.80%   -0.01%     
==========================================
  Files         509      509              
  Lines       17452    17456       +4     
  Branches     2684     2684              
==========================================
+ Hits        16022    16025       +3     
- Misses       1136     1137       +1     
  Partials      294      294              
Impacted Files Coverage Δ
components/core/wave/nz-wave.module.ts 100.00% <ø> (ø)
components/core/config/config.ts 100.00% <100.00%> (ø)
components/core/wave/nz-wave.directive.ts 100.00% <100.00%> (ø)
components/i18n/nz-i18n.token.ts 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

@MunMunMiao MunMunMiao requested a review from a team as a code owner May 17, 2023 09:50
@MunMunMiao
Copy link
Collaborator Author

MunMunMiao commented May 17, 2023

I think provideNz or provideNgZorro or provideZorro will be better naming.

Because it does not rule out that we will have such a function signature:

provideNz(
  config,
  withAFeature(),
  withBFeature()
)

In other words, not only configurations can be added here.

This proposal is based on the package dimension.

like:

@angular/common/http

provideHttpClient

@angular/platform-browser

provideClientHydration

@angular/platform-browser/animations

provideAnimations
provideNoopAnimations

API List more...

so provideNzConfig is only for ng-zoro-antd/core/config

because there are too many configuration items, it is not necessary to provide a function for each sub item

@MunMunMiao MunMunMiao changed the title feat(core:config): add provideNzConfig function feat(): add provide function May 18, 2023
@MunMunMiao MunMunMiao changed the title feat(): add provide function feat: add provide function May 18, 2023
@MunMunMiao
Copy link
Collaborator Author

MunMunMiao commented May 19, 2023

@simplejason 你好,麻烦看下这个PR是否可以合入,如果不需要合入的话我可以关闭这个PR :)

@HyperLife1119
Copy link
Collaborator

@simplejason 我支持此PR,它的灵感来源于自 Angular14 之后推出的一系列 provide* 函数,这些助手函数为用户提供了更便捷的方法来配置 provider,并且类型安全。

@simplejason simplejason added 💔 Breaking Change This PR or the solution to this issue would introduce breaking changes PR: target-major labels Aug 3, 2023
@simplejason
Copy link
Member

目前有可能保留原有的使用方式但标注 deprecated 吗?看上去用户升级后会出现 break change

@MunMunMiao
Copy link
Collaborator Author

MunMunMiao commented Aug 4, 2023

目前有可能保留原有的使用方式但标注 deprecated 吗?看上去用户升级后会出现 break change

现在只是提供了一系列provide的function,原使用方式目前不影响,provide的函数是为了日后取消了module而做准备,文档也引导用户使用provide

@HyperLife1119
Copy link
Collaborator

这里不会出现 breaking change,我们应该移除这个 label 😊

@simplejason simplejason merged commit 150c6ca into NG-ZORRO:master Sep 18, 2023
@MunMunMiao MunMunMiao deleted the feat/provide_config branch September 20, 2023 17:07
@Laffery
Copy link
Collaborator

Laffery commented Sep 27, 2023

@MunMunMiao provide function 和原来的使用方式是等价的,我觉得 ng-add schematic 现在应该可以默认生成 provide function 形式的代码了

@Laffery Laffery removed the 💔 Breaking Change This PR or the solution to this issue would introduce breaking changes label Sep 27, 2023
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