\u5f53\u4f60\u5728\u4f7f\u7528 ng g ng-alain:list
\u6765\u751f\u6210\u9875\u9762\u65f6\uff0c\u4f1a\u53d1\u73b0\u5e76\u4e0d\u4f1a\u4ea7\u751f Less \u6587\u4ef6\uff0c\u4e3b\u8981\u662f NG-ALAIN \u6709\u81ea\u5df1\u7684\u4e00\u5957\u4e3b\u9898\u7cfb\u7edf\uff0cNG-ALAIN \u5e0c\u671b\u5229\u7528\u8fd9\u5957\u4e3b\u9898\u7cfb\u7edf\u6765\u6784\u5efa\u7ec4\u4ef6\uff0c\u8ba9 CSS \u53d8\u6210\u7f16\u7a0b\u5316\u3002\u7136\u800c\u5b83\u5e76\u4e0d\u80fd\u6ee1\u8db3\u6240\u6709\u9700\u6c42\uff0c\u672c\u6587\u4f1a\u9488\u5bf9\u8fd9\u65b9\u9762\u505a\u4e00\u4e2a\u5168\u9762\u63cf\u8ff0\u3002
\u624b\u52a8\u521b\u5efa\u7ec4\u4ef6\u6837\u5f0f\u6587\u4ef6\uff0c\u4e0b\u9762\u4ee5 img.component.less
\u4e3a\u793a\u4f8b\uff1a
// \u5bfc\u5165 Less \u53d8\u91cf\u53c2\u6570\n@import \'@delon/theme/index\';\n\n:host {\n // \u7ec4\u4ef6\u5bbf\u4e3b\u6837\u5f0f\n display: block;\n font-size: 16px;\n\n ::ng-deep {\n // \u7ec4\u4ef6\u5185\u5176\u4ed6\u6837\u5f0f\n .title {\n color: @text-color;\n }\n }\n}
\u8fd9\u4e2a img.component.less
\u6837\u5f0f\u6587\u4ef6\u5305\u542b\u4e86\u8bb8\u591a\u4fe1\u606f\uff1a
~@delon/theme/index
\u5b83\u5305\u5bb9\u4e86 NG-ZORRO\u3001@delon/theme\u3001@delon/abc\u3001@delon/chart \u4e3b\u9898\u7cfb\u7edf\u6240\u6709\u7684 Less \u53d8\u91cf\u540d\uff0c\u53ea\u6709\u8fd9\u6837\u5bfc\u5165\u624d\u80fd\u4f7f\u6211\u4eec\u5728\u4e0b\u9762\u5f15\u7528 @text-color
\u8fd9\u7c7b Less \u53d8\u91cf\uff0c\u5b83\u8868\u793a\u9ed8\u8ba4\u7684\u989c\u8272\u503c\u3002
\u5982\u679c\u4f60\u6b63\u5728\u4f7f\u7528\u5546\u4e1a\u4e3b\u9898\uff0c\u4f8b\u5982 PRO \u4f1a\u4f7f\u7528\u5176\u4ed6\u8def\u5f84\uff1a
@import \'src/styles/theme.less\';
\u3002
\u7279\u6b8a\u9009\u62e9\u5668
:host
\u3001::ng-deep
\u5b83\u4eec\u662f Angular \u7279\u6b8a\u9009\u62e9\u5668\uff1a
:host
\u8868\u793a\u7ec4\u4ef6\u5bbf\u4e3b\uff0c\u5047\u8bbe\u6211\u4eec\u5f53\u524d\u7684\u7ec4\u4ef6\u540d\u4e3a img
\uff0c\u90a3\u6700\u7ec8 :host
\u4f1a\u88ab\u89e3\u6790\u6210 img
\u7684\u6837\u5f0f
::ng-deep
\u8868\u793a\u7981\u6b62\u5bf9\u89c6\u56fe\u5305\u88c5\uff0c\u8fd9\u6709\u52a9\u4e8e\u51cf\u5c11\u751f\u6210\u4e00\u4e9b\u989d\u5916\u7684\u6807\u8bc6\u7b26\uff0c\u5b83\u4f1a\u5f71\u54cd\u5b50\u7ec4\u4ef6\u7684\u7684\u4f7f\u7528\uff0c\u4f8b\u5982\uff1a.title
\u4f1a\u5728 <img>
\u7ec4\u4ef6\u5185\u6240\u6709\u5305\u542b class="title"
\u90fd\u5c06\u6709\u6548
NG-ALAIN \u81f3\u4ece 9.3.x
\u5f00\u59cb\u5185\u7f6e\u6697\u9ed1\u4e0e\u7d27\u51d1\u4e24\u79cd\u4e3b\u9898\uff0c\u5bf9\u4e8e\u5168\u5c40\u53ea\u9700\u8981\u4fee\u6539 styles.less \u4e00\u4e2a\u53c2\u6570\uff0c\u4f8b\u5982\u5207\u6362\u4e3a\u6697\u9ed1\u4e3b\u9898\uff1a
- // @import \'@delon/theme/theme-dark.less\';\n+ @import \'@delon/theme/theme-dark.less\';
\u82e5\u662f\u7d27\u51d1\uff0c\u53ea\u9700\u8981\u6362\u6210
@import \'@delon/theme/theme-compact.less\';
\u3002
\u540c\u65f6\uff0c\u5bf9\u4e8e\u7ec4\u4ef6\u6837\u5f0f\u7684\u5f15\u5165\u4e5f\u5168\u90e8\u66ff\u6362\u6210\uff1a
- @import \'@delon/theme/index\';\n+ @import \'@delon/theme/theme-dark\';
\u5982\u679c\u4f60\u6b63\u5728\u5236\u4f5c\u5c31\u50cf\b\u73b0\u5728\u7f51\u7ad9\u4e00\u6837\uff0c\u52a8\u6001\u5207\u6362\u4e0d\u540c\u7684\u4e3b\u9898\uff0c\u90a3\u4e48\u5c31\u5fc5\u987b\u9488\u5bf9\u4e0d\u540c\u7684\u4e3b\u9898\u989d\u5916\u8986\u76d6\uff0c\u4f8b\u5982\u5f53\u5f00\u542f\u6697\u9ed1\u65f6\uff0c\u5c06 .title
\u6362\u6210 #000
\u989c\u8272\u503c\uff1a
// \u5bfc\u5165 Less \u53d8\u91cf\u53c2\u6570\n@import \'@delon/theme/index\';\n\n:host {\n // \u7ec4\u4ef6\u5bbf\u4e3b\u6837\u5f0f\n display: block;\n font-size: 16px;\n\n ::ng-deep {\n // \u7ec4\u4ef6\u5185\u5176\u4ed6\u6837\u5f0f\n .title {\n color: @text-color;\n }\n }\n}\n\n[data-theme=\'dark\'] {\n :host ::ng-deep {\n .title {\n color: #000;\n }\n }\n}
\u82e5\u7d27\u51d1\u4e3b\u9898\uff1a
[data-theme=\'compact\'] {\n :host ::ng-deep {\n // \u9488\u5bf9\u7d27\u51d1\u91cd\u65b0\u5b9a\u4e49\n }\n}
Ant Design allows you to customize some basic design aspects in order to meet the needs of UI diversity from business and brand, including primary color, border radius, border color, etc.
We are using Less as the development language for styling. A set of less variables are defined for each design aspect that can be customized to your needs.
Run ng add ng-alain
, set up custom theme file, then modified the file src/styles/theme.less
.
We have some official themes, try them out and give us some feedback!
\u{1f311} Dark Theme (supported in 9+)
\u{1f4e6} Compact Theme (supported in 9+)
In the style file src/styles/theme.less
, change default
to dark
or compact
to override theme variables.
// - `default` Default Theme\n// - `dark` \u{1f311} Dark Theme (supported in 9+)\n// - `compact` \u{1f4e6} Compact Theme (supported in 9+)\n@import \'@delon/theme/theme-default.less\';\n\n// ==========The following is the custom theme variable area==========\n// @primary-color: #f50;
If the project does not use Less, you can include dark.css
or compact.css
in the CSS file or add to the angular.json
config.
CSS file\uff1a
@import "@delon/theme/dark.css";
angular.json
{\n "build": {\n "options": {\n "styles": [\n "node_modules/@delon/theme/dark.css"\n ]\n }\n }\n}
When using @angular/cli to configure themes, you must build applications for each theme. When you want to switch themes without reloading the application (like this website), you can use the following method to compile the theme into a style file, and switch at runtime:
Note: Make sure theme variables exist in global styles, not in component scope styles, because component styles that have higher priority will prevent the theme override.
Install Dependencies
yarn add ng-alain-plugin-theme -D
ng-alain-plugin-theme is to generate
color.less
and theme CSS files for NG-ALAIN.
Add theme
node in ng-alain.json
:
{\n "$schema": "./node_modules/ng-alain/schema.json",\n "theme": {\n "list": [\n {\n "theme": "dark"\n },\n {\n "key": "dust",\n "modifyVars": {\n "@primary-color": "#F5222D"\n }\n }\n ]\n }\n}
Finally, run the following command:
npx ng-alain-plugin-theme -t=themeCss
Two style files will be generated in src/assets/style.dark.css
and src/assets/style.dust.css
.
Switch Theme at Runtime
Dynamically create a link
tag, dynamically load style files into the application, and remove them otherwise.
You can also use the theme-btn component directly.
changeTheme(theme: \'default\' | \'dark\'): void {\n if (theme === \'dark\') {\n const style = document.createElement(\'link\');\n style.type = \'text/css\';\n style.rel = \'stylesheet\';\n style.id = \'dark-theme\';\n style.href = \'assets/style.dark.css\';\n } else {\n const dom = document.getElementById(\'dark-theme\');\n if (dom) {\n dom.remove();\n }\n }\n}
Note: If you use @delon/chart
or third-party component, you may need to manually modify the component to support the corresponding theme.
The above theme switching method is based on the fact that all Less style content is independent of src/styles.less
. Sometimes, it is also defined in the component, like:
@Component({\n selector: \'app-dashboard-analysis\',\n templateUrl: \'./analysis.component.html\',\n styleUrls: [\'./analysis.component.less\'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class DashboardAnalysisComponent {}
// analysis.component.less\n@import \'@delon/theme/index\';\n:host ::ng-deep { \n color: @text-color;\n}
Because the styles defined in the component run independently under Angular, it is impossible to switch to the dark theme as a whole according to the introduction of @import \'@delon/theme/theme-compact.less\';
, if you want the same in the component To use the dark series, you must:
// analysis.component.less\n- @import \'@delon/theme/index\';\n+ @import \'@delon/theme/theme-dark\';
Or, redefine for a component theme:
// analysis.component.less\n[data-theme=\'dark\'] {\n :host ::ng-deep {\n // Redefining the dark theme\n }\n}
Or compact theme:
[data-theme=\'compact\'] {\n :host ::ng-deep {\n // Redefining the compact theme\n }\n}
Ant Design \u8bbe\u8ba1\u89c4\u8303\u4e0a\u652f\u6301\u4e00\u5b9a\u7a0b\u5ea6\u7684\u6837\u5f0f\u5b9a\u5236\uff0c\u4ee5\u6ee1\u8db3\u4e1a\u52a1\u548c\u54c1\u724c\u4e0a\u591a\u6837\u5316\u7684\u89c6\u89c9\u9700\u6c42\uff0c\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u4e3b\u8272\u3001\u5706\u89d2\u3001\u8fb9\u6846\u548c\u90e8\u5206\u7ec4\u4ef6\u7684\u89c6\u89c9\u5b9a\u5236\u3002
Ant Design \u7684\u6837\u5f0f\u4f7f\u7528\u4e86 Less \u4f5c\u4e3a\u5f00\u53d1\u8bed\u8a00\uff0c\u5e76\u5b9a\u4e49\u4e86\u4e00\u7cfb\u5217\u5168\u5c40/\u7ec4\u4ef6\u7684\u6837\u5f0f\u53d8\u91cf\uff0c\u4f60\u53ef\u4ee5\u6839\u636e\u9700\u6c42\u8fdb\u884c\u76f8\u5e94\u8c03\u6574\uff0c\u9ed8\u8ba4\u6837\u5f0f\u53d8\u91cf\uff1aNG-ZORRO\u3001NG-ALAIN \u4e24\u90e8\u5206\u3002
\u5728\u521d\u59cb\u5316\u9879\u76ee\u65f6 ng add ng-alain
\u65f6\u9009\u62e9\u81ea\u5b9a\u4e49\u4e3b\u9898\u5373\u53ef\u81ea\u52a8\u914d\u7f6e\u597d\u81ea\u5b9a\u4e49\u4e3b\u9898\u7684\u76f8\u5173\u6587\u4ef6\uff0c\u4fee\u6539 src/styles/theme.less
\u6587\u4ef6\u5185\u5bb9\u5c31\u53ef\u4ee5\u81ea\u5b9a\u4e49\u4e3b\u9898\u3002
\u6211\u4eec\u63d0\u4f9b\u4e86\u4e00\u4e9b\u5b98\u65b9\u4e3b\u9898\uff0c\u6b22\u8fce\u5728\u9879\u76ee\u4e2d\u8bd5\u7528\uff0c\u5e76\u4e14\u7ed9\u6211\u4eec\u63d0\u4f9b\u53cd\u9988\u3002
\u{1f311} \u6697\u9ed1\u4e3b\u9898\uff089+ \u652f\u6301\uff09
\u{1f4e6} \u7d27\u51d1\u4e3b\u9898\uff089+ \u652f\u6301\uff09
\u5728\u6837\u5f0f\u6587\u4ef6 src/styles/theme.less
\u66f4\u6539 default
\u4e3a dark
\u6216 compact
\u8986\u76d6\u4e3b\u9898\u53d8\u91cf\u3002
// - `default` \u9ed8\u8ba4\u4e3b\u9898\n// - `dark` \u{1f311} \u6697\u9ed1\u4e3b\u9898\uff089+ \u652f\u6301\uff09\n// - `compact` \u{1f4e6} \u7d27\u51d1\u4e3b\u9898\uff089+ \u652f\u6301\uff09\n@import \'@delon/theme/theme-default.less\';\n\n// ==========The following is the custom theme variable area==========\n// @primary-color: #f50;
\u5982\u679c\u9879\u76ee\u4e0d\u4f7f\u7528 Less\uff0c\u53ef\u5728 CSS \u6587\u4ef6\u6216\u8005 angular.json
\u7684 styles
\u5b57\u6bb5\u4e2d\uff0c\u5168\u91cf\u5f15\u5165 dark.css
\u6216\u8005 compact.css
\u3002
\u6837\u5f0f\u6587\u4ef6\u4e2d\uff1a
@import "@delon/theme/dark.css";
angular.json
\u4e2d
{\n "build": {\n "options": {\n "styles": [\n "node_modules/@delon/theme/dark.css"\n ]\n }\n }\n}
\u5f53\u4f7f\u7528 @angular/cli \u7684\u65b9\u5f0f\u914d\u7f6e\u4e3b\u9898\u65f6\u5fc5\u987b\u4e3a\u6bcf\u4e2a\u4e3b\u9898\u5355\u72ec\u6253\u5305\u5e94\u7528\uff0c\u5f53\u4f60\u60f3\u5207\u6362\u4e3b\u9898\u800c\u4e0d\u91cd\u65b0\u52a0\u8f7d\u5e94\u7528\u65f6\uff08\u5c31\u50cf\u8fd9\u4e2a\u7f51\u7ad9\uff09\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u7684\u65b9\u6cd5\u5c06\u4e3b\u9898\u7f16\u8bd1\u5230\u5355\u72ec\u7684\u6837\u5f0f\u6587\u4ef6\uff0c\u5e76\u5728\u8fd0\u884c\u65f6\u5207\u6362\uff1a
\u6ce8\u610f\uff1a\u786e\u4fdd\u4e0e\u4e3b\u9898\u53d8\u91cf\u76f8\u5173\u7684\u6837\u5f0f\u5b58\u5728\u5168\u5c40\u6837\u5f0f\u4e2d\uff0c\u800c\u4e0d\u662f\u7ec4\u4ef6\u6837\u5f0f\u4e2d\uff0c\u56e0\u4e3a\u7ec4\u4ef6\u6837\u5f0f\u4f18\u5148\u7ea7\u66f4\u9ad8\u5c06\u4f1a\u5bfc\u81f4\u6837\u5f0f\u65e0\u6cd5\u88ab\u8986\u76d6\u3002
\u5b89\u88c5\u4f9d\u8d56
yarn add ng-alain-plugin-theme -D
ng-alain-plugin-theme \u662f\u4e13\u95e8\u9488\u5bf9 NG-ALAIN \u751f\u6210
color.less
\u53ca\u4e3b\u9898CSS\u6587\u4ef6\u3002
\u5728 ng-alain.json
\u5185\u65b0\u589e theme
\u8282\u70b9\uff1a
{\n "$schema": "./node_modules/ng-alain/schema.json",\n "theme": {\n "list": [\n {\n "theme": "dark"\n },\n {\n "key": "dust",\n "modifyVars": {\n "@primary-color": "#F5222D"\n }\n }\n ]\n }\n}
\u6700\u540e\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a
npx ng-alain-plugin-theme -t=themeCss
\u4f1a\u5728 src/assets/style.dark.css
\u548c src/assets/style.dust.css
\u751f\u6210\u4e24\u4e2a\u6837\u5f0f\u6587\u4ef6\u3002
\u8fd0\u884c\u65f6\u5207\u6362\u6837\u5f0f
\u52a8\u6001\u521b\u5efa link
\u6807\u7b7e\uff0c\u5c06\u6837\u5f0f\u6587\u4ef6\u52a8\u6001\u52a0\u8f7d\u5728\u5e94\u7528\u4e2d\uff0c\u53cd\u4e4b\u79fb\u9664\u3002
\u4e5f\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528 theme-btn \u7ec4\u4ef6\u3002
changeTheme(theme: \'default\' | \'dark\'): void {\n if (theme === \'dark\') {\n const style = document.createElement(\'link\');\n style.type = \'text/css\';\n style.rel = \'stylesheet\';\n style.id = \'dark-theme\';\n style.href = \'assets/style.dark.css\';\n } else {\n const dom = document.getElementById(\'dark-theme\');\n if (dom) {\n dom.remove();\n }\n }\n}
\u6ce8\u610f\uff1a\u5982\u679c\u4f60\u4f7f\u7528
@delon/chart
\u6216\u7b2c\u4e09\u65b9\u7ec4\u4ef6\uff0c\u53ef\u80fd\u9700\u8981\u624b\u52a8\u4fee\u6539\u7ec4\u4ef6\u6765\u652f\u6301\u76f8\u5e94\u7684\u4e3b\u9898\u3002
\u4ee5\u4e0a\u4e3b\u9898\u5207\u6362\u65b9\u5f0f\u662f\u5728\u4e00\u4e2a\u5c06\u6240\u6709 Less \u6837\u5f0f\u5185\u5bb9\u72ec\u7acb\u4e8e src/styles.less
\u4e0b\u9762\uff0c\u5f53\u6b63\u5e38\u60c5\u51b5\u4e0b\uff0c\u8fd8\u4f1a\u5728\u7ec4\u4ef6\u5185\u5b9a\u4e49\uff0c\u5c31\u50cf\uff1a
@Component({\n selector: \'app-dashboard-analysis\',\n templateUrl: \'./analysis.component.html\',\n styleUrls: [\'./analysis.component.less\'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class DashboardAnalysisComponent {}
// analysis.component.less\n@import \'@delon/theme/index\';\n:host ::ng-deep { \n color: @text-color;\n}
\u7531\u4e8e\u7ec4\u4ef6\u5185\u5b9a\u4e49\u7684\u6837\u5f0f\u72ec\u7acb\u8fd0\u884c\u5728 Angular \u4e0b\u9762\uff0c\u662f\u65e0\u6cd5\u6839\u636e @import \'@delon/theme/theme-compact.less\';
\u7684\u5f15\u5165\u6765\u6574\u4f53\u5207\u6362\u6210\u6697\u9ed1\u7cfb\uff0c\u5982\u679c\u4f60\u5e0c\u671b\u5728\u7ec4\u4ef6\u5185\u4e5f\u540c\u6837\u4f7f\u7528\u6697\u9ed1\u7cfb\uff0c\u5219\u5fc5\u987b\u5c06\uff1a
// analysis.component.less\n- @import \'@delon/theme/index\';\n+ @import \'@delon/theme/theme-dark\';
\u6216\u8005\uff0c\u91cd\u65b0\u9488\u5bf9\u67d0\u4e00\u4e2a\u4e3b\u9898\u91cd\u65b0\u5b9a\u4e49\uff1a
// analysis.component.less\n[data-theme=\'dark\'] {\n :host ::ng-deep {\n // \u9488\u5bf9\u6697\u9ed1\u7cfb\u91cd\u65b0\u5b9a\u4e49\n }\n}
\u6216\u7d27\u51d1\u4e3b\u9898\uff1a
[data-theme=\'compact\'] {\n :host ::ng-deep {\n // \u9488\u5bf9\u7d27\u51d1\u91cd\u65b0\u5b9a\u4e49\n }\n}
@delon/theme
is the only must be imported to ng-alain scaffold. It contains a lot of style parameters and several generalities services, pipes.
ng-alain defaults to using less as the style language, we recommend that you learn about the features of less before using it or sometimes when you have some questions. If you want to get a basic knowledge of CSS or look for properties usage, you can refer to the MDN doc.
Scaffolding include two layouts: default layout, blank layout, scaffolding does not contain these style files, it\'s in the @delon/theme
library.
You can use the toolset provided by ng-alain to adjust spacing, color, size, borders, etc. It\'s a set of like bootstrap style tools.
Or customize your styles with theme.less, which will work in global applications, in the style development process, there are two prominent problems:
Global Pollution - CSS selectors are globally valid. Selectors with the same name in different files will be built together, and the former will be overrided by the latter.
Complex Selector - in order to avoid the above problem, we have to be careful when writing styles. The increase in flags for range restriction will lead to a growing class name, besides that, naming style confusion in multi person development and an increasing number of selectors on an element is hard to avoid.
We should use component styles
property to create component styles. For how use Angular styles, please refer to About Angular Style Packaging.
In a project, style files can be divided into different categories depending on their function.
Global style file, where you can make some common settings.
Please refer to Tools\u3002
Specific page-related style, such as monitor.component.less, the content is only related to the content of this page. Under normal circumstances, if it is not particularly complex page, with the previous global style and tools style, there should be little to write.
We are using Less as the development language for styling. A set of less variables are defined for each design aspect that can be customized to your needs.
The changes parameters put into the theme.less LESS file, all parameters include:
Please report an issue if the existing list of variables is not enough for
@delon/theme
\u662f ng-alain \u811a\u624b\u67b6\u552f\u4e00\u5fc5\u987b\u5f15\u5165\u7684\u6a21\u5757\u3002\u5b83\u5305\u542b\u4e86\u975e\u5e38\u591a\u4e3b\u9898\u6837\u5f0f\u53c2\u6570\uff0c\u901a\u8fc7\u8986\u76d6\u53c2\u6570\u6570\u503c\u8fdb\u800c\u5b9a\u5236\u4e00\u4e9b\u7279\u522b\u7684\u9700\u6c42\uff1b\u4ee5\u53ca\u82e5\u5e72\u901a\u7528\u6027\u670d\u52a1\u3001\u7ba1\u9053\u3002
ng-alain \u9ed8\u8ba4\u4f7f\u7528 less \u4f5c\u4e3a\u6837\u5f0f\u8bed\u8a00\uff0c\u5efa\u8bae\u5728\u4f7f\u7528\u524d\u6216\u8005\u9047\u5230\u7591\u95ee\u65f6\u5b66\u4e60\u4e00\u4e0b less \u7684\u76f8\u5173\u7279\u6027\uff0c\u5982\u679c\u60f3\u83b7\u53d6\u57fa\u7840\u7684 CSS \u77e5\u8bc6\u6216\u67e5\u9605\u5c5e\u6027\uff0c\u53ef\u4ee5\u53c2\u8003 MDN\u6587\u6863\u3002
\u811a\u624b\u67b6\u63d0\u4f9b\u4e24\u79cd\u5e03\u5c40\uff1a\u9ed8\u8ba4\u5e03\u5c40\u3001\u7a7a\u767d\u5e03\u5c40\uff0c\u811a\u624b\u67b6\u5e76\u4e0d\u5305\u542b\u4e24\u79cd\u5e03\u5c40\u6837\u5f0f\u6587\u4ef6\uff0c\u5b83\u4f4d\u4e8e @delon/theme
\u7c7b\u5e93\u5f53\u4e2d\u3002
\u5728\u5f00\u53d1\u8fc7\u7a0b\u4e2d\uff0c\u7edd\u5927\u90e8\u5206\u60c5\u51b5\u4e0b\u53ef\u4ee5\u5229\u7528 ng-alain \u63d0\u4f9b\u7684\u5de5\u5177\u96c6\u6765\u8c03\u6574\u95f4\u8ddd\u3001\u989c\u8272\u3001\u5927\u5c0f\u3001\u8fb9\u6846\u7b49\uff0c\u5b83\u662f\u4e00\u4e2a\u5957\u7c7b\u4f3c bootstrap \u98ce\u683c\u7684\u5de5\u5177\u96c6\u3002
\u6216\u901a\u8fc7 theme.less \u4e0b\u5b9a\u5236\u4f60\u7684\u6837\u5f0f\uff0c\u8fd9\u4e9b\u6837\u5f0f\u5c06\u4f1a\u5728\u5168\u5c40\u5e94\u7528\u4e2d\u6709\u6548\uff0c\u4e14\u6709\u4e24\u4e2a\u95ee\u9898\u6bd4\u8f83\u7a81\u51fa\uff1a
\u5168\u5c40\u6c61\u67d3 \u2014\u2014 CSS \u6587\u4ef6\u4e2d\u7684\u9009\u62e9\u5668\u662f\u5168\u5c40\u751f\u6548\u7684\uff0c\u4e0d\u540c\u6587\u4ef6\u4e2d\u7684\u540c\u540d\u9009\u62e9\u5668\uff0c\u6839\u636e build \u540e\u751f\u6210\u6587\u4ef6\u4e2d\u7684\u5148\u540e\u987a\u5e8f\uff0c\u540e\u9762\u7684\u6837\u5f0f\u4f1a\u5c06\u524d\u9762\u7684\u8986\u76d6\uff1b
\u9009\u62e9\u5668\u590d\u6742 \u2014\u2014 \u4e3a\u4e86\u907f\u514d\u4e0a\u9762\u7684\u95ee\u9898\uff0c\u6211\u4eec\u5728\u7f16\u5199\u6837\u5f0f\u7684\u65f6\u5019\u4e0d\u5f97\u4e0d\u5c0f\u5fc3\u7ffc\u7ffc\uff0c\u7c7b\u540d\u91cc\u4f1a\u5e26\u4e0a\u9650\u5236\u8303\u56f4\u7684\u6807\u8bc6\uff0c\u53d8\u5f97\u8d8a\u6765\u8d8a\u957f\uff0c\u591a\u4eba\u5f00\u53d1\u65f6\u8fd8\u5f88\u5bb9\u6613\u5bfc\u81f4\u547d\u540d\u98ce\u683c\u6df7\u4e71\uff0c\u4e00\u4e2a\u5143\u7d20\u4e0a\u4f7f\u7528\u7684\u9009\u62e9\u5668\u4e2a\u6570\u4e5f\u53ef\u80fd\u8d8a\u6765\u8d8a\u591a\u3002
\u56e0\u6b64\uff0c\u9664\u975e\u8bbe\u8ba1\u5e08\u660e\u786e\u9700\u6c42\u4ee5\u5916\uff0c\u6211\u4eec\u5e94\u8be5\u5c3d\u53ef\u80fd\u4f7f\u7528\u7ec4\u4ef6 styles
\u5c5e\u6027\u521b\u5efa\u7ec4\u4ef6\u6837\u5f0f\uff0c\u6709\u5173\u5982\u4f55Angular\u6837\u5f0f\u8bf7\u53c2\u8003\u300a\u5173\u4e8eAngular\u6837\u5f0f\u5c01\u88c5\u300b\u3002
\u5728\u4e00\u4e2a\u9879\u76ee\u4e2d\uff0c\u6837\u5f0f\u6587\u4ef6\u6839\u636e\u529f\u80fd\u4e0d\u540c\uff0c\u53ef\u4ee5\u5212\u5206\u4e3a\u4e0d\u540c\u7684\u7c7b\u522b\u3002
\u5168\u5c40\u6837\u5f0f\u6587\u4ef6\uff0c\u5728\u8fd9\u91cc\u4f60\u53ef\u4ee5\u8fdb\u884c\u4e00\u4e9b\u901a\u7528\u8bbe\u7f6e\u3002
\u8bf7\u53c2\u8003 \u5de5\u5177\u96c6\u6837\u5f0f\u3002
\u5177\u4f53\u9875\u9762\u76f8\u5173\u7684\u6837\u5f0f\uff0c\u4f8b\u5982 monitor.component.less\uff0c\u91cc\u9762\u7684\u5185\u5bb9\u4ec5\u548c\u672c\u9875\u9762\u7684\u5185\u5bb9\u76f8\u5173\u3002\u4e00\u822c\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u4e0d\u662f\u9875\u9762\u5185\u5bb9\u7279\u522b\u590d\u6742\uff0c\u6709\u4e86\u524d\u9762\u5168\u5c40\u6837\u5f0f\u3001\u5de5\u5177\u96c6\u6837\u5f0f\u7684\u914d\u5408\uff0c\u8fd9\u91cc\u8981\u5199\u7684\u5e94\u8be5\u4e0d\u591a\u3002
ng-alain \u7684\u6837\u5f0f\u4f7f\u7528\u4e86 Less \u4f5c\u4e3a\u5f00\u53d1\u8bed\u8a00\uff0c\u5e76\u5b9a\u4e49\u4e86\u4e00\u7cfb\u5217\u5168\u5c40/\u7ec4\u4ef6\u7684\u6837\u5f0f\u53d8\u91cf\uff0c\u4f60\u53ef\u4ee5\u6839\u636e\u9700\u6c42\u8fdb\u884c\u76f8\u5e94\u8c03\u6574\u3002
\u8981\u6539\u53d8\u7684\u53c2\u6570\u7edf\u4e00\u653e\u5728 theme.less LESS\u6587\u4ef6\u4e2d\uff0c\u6240\u6709\u53c2\u6570\u5305\u62ec\uff1a
\u5982\u679c\u4ee5\u4e0a\u53d8\u91cf\u4e0d\u80fd\u6ee1\u8db3\u4f60\u7684\u5b9a\u5236\u9700\u6c42\uff0c\u53ef\u4ee5\u7ed9\u6211\u4eec\u63d0 i
Name | Default | Description |
---|---|---|
@layout-gutter | 8px | Antd layout spacing (unchageable) |
@font-size-base | 14px | Antd font size (unchageable) |
@primary-color | Blue | antd primary color |
@mobile-min | 768px | PC of width |
@mobile-max | 767px | Mobile of width |
@text-xs | @font-size-base - 2 | Text of xs size |
@text-sm | @font-size-base + 0 | Text of sm size |
@text-md | @font-size-base + 2 | Text of md size |
@text-lg | @font-size-base + 4 | Text of lg size |
@text-xl | @font-size-base + 8 | Text of xl size |
@text-xxl | @font-size-base + 12 | Text of xxl size |
@icon-sm | @font-size-base * 2 | Icon of sm size |
@icon-md | @font-size-base * 4 | Icon of md size |
@icon-lg | @font-size-base * 6 | Icon of lg size |
@icon-xl | @font-size-base * 8 | Icon of xl size |
@icon-xxl | @font-size-base * 10 | Icon of xxl size |
@h1-font-size | 32px | h1 font size |
@h2-font-size | 24px | h2 font size |
@h3-font-size | 20px | h3 font size |
@h4-font-size | 16px | h4 font size |
@h5-font-size | 14px | h5 font size |
@h6-font-size | 12px | h6 font size |
@enable-all-colors | false | Turn on background, text color eg: .bg-teal \u3001.text-teal |
@modal-sm | 300px | Small modal |
@modal-md | 500px | Medium modal |
@modal-lg | 900px | Large modal |
@modal-lg | 1200px | Extra large modal |
@drawer-sm | 300px | Small drawer |
@drawer-md | 500px | Medium drawer |
@drawer-lg | 900px | Large drawer |
@drawer-lg | 1200px | Extra large drawer |
@drawer-sm-height | 200px | Small drawer for height |
@drawer-md-height | 400px | Medium drawer for height |
@drawer-lg-height | 600px | Large drawer for height |
@drawer-xl-height | 800px | Extra large drawer for height |
@code-border-color | #eee | <code> border color |
@code-bg | #f7f7f7 | <code> background color |
@widths | xs @layout-gutter * 10 sm @layout-gutter * 20 md @layout-gutter * 30 lg @layout-gutter * 40 xl @layout-gutter * 50 xxl @layout-gutter * 50 | width |
@border-radius-md | 4px | Medium border rounded corner |
@border-radius-lg | 6px | Large border rounded corner |
@masonry-column-gap | @layout-gutter * 2 | CSS waterfall flow column and column spacing |
@scrollbar-enabled | true | Enable landscaping scrollbars |
@scrollbar-width | 6px | Scroll bar width |
@scrollbar-height | 6px | Scroll bar height |
@scrollbar-track-color | rgba(0, 0, 0, 0.3) | Scrollbar track color |
@scrollbar-thumb-color | #6e6e6e | Scrollbar thumb color |
@scrollbar-table-enabled | false | Enable landscaping scrollbars of nz-table |
@rtl-enabled | false | Wheter support RTL |
@enabled-util-align | true | Whether to enable tools align |
@enabled-util-border | true | Whether to enable tools border |
@enabled-util-code | true | Whether to enable tools code |
@enabled-util-color | true | Whether to enable tools color |
@enabled-util-display | true | Whether to enable tools display |
@enabled-util-float | true | Whether to enable tools float |
@enabled-util-icon | true | Whether to enable tools icon |
@enabled-util-img | true | Whether to enable tools img |
@enabled-util-position | true | Whether to enable tools position |
@enabled-util-overflow | true | Whether to enable tools overflow |
@enabled-util-responsive | true | Whether to enable tools responsive |
@enabled-util-spacing | true | Whether to enable tools spacing |
@enabled-util-text | true | Whether to enable tools text |
@enabled-util-width | true | Whether to enable tools width |
@enabled-util-scrollbar | true | Whether to enable tools scrollbar |
@enabled-util-other | true | Whether to enable tools other |
Name | Default | Description |
---|---|---|
@preserve-white-spaces-enabled | true | Fixed between buttons spacing when enabled preserveWhitespaces is true |
@preserve-sf-and-st-spaces | 16px | Spacing between sf and st |
@preserve-buttons-spaces | Spacing between button and button (incluldes: button ,button-group ,popconfirm ) | |
@router-animation-enabled | false | Whether to enable animation when route changing |
@router-animation-duration | antFadeIn | Route switching animation name |
@router-animation-duration | 1s | Animation duration |
Name | Default | Description |
---|---|---|
@forced-turn-off-nz-modal-animation-enabled | false | Forced to turn off nz-modal animation |
Name | Default | Description |
---|---|---|
@form-state-visual-feedback-enabled | false | Turn on visual feedback of form invalid elements |
@search-form-bg | #fbfbfb | Background color of simple search form |
@search-form-radius | 4px | Border rounded corner of simple search form |
By nz-table
\u3002
Name | Default | Description |
---|---|---|
@nz-table-img-radius | 4px | Image rounded in the table |
@nz-table-img-margin-right | 4px | Image margin-right in the table |
@nz-table-img-max-width | 32px | Image maximum width in the table |
@nz-table-img-max-height | 32px | Image maximum height in the table |
@nz-table-even-background | none | Even background color in the table |
@nz-table-rep-max-width | @mobile-max | Triggering table response when mobile screen |
@nz-table-rep-header-background | @border-color-split | Table responsive: title background color |
@nz-table-rep-even-background | #f9f9f9 | Table responsive: even background color |
@nz-table-rep-padding-vertical | 8px | Table responsive: Cell vertical spacing |
@nz-table-rep-padding-horizontal | 8px | Table responsive: Cell horizontal spacing |
@nz-table-rep-column-name-width | 100px | Table responsive: Column name maximum width |
@nz-table-rep-column-name-text-align | right | Table responsive: Column name text alignment |
@nz-table-rep-column-name-padding-right | right | Table responsive: Column name right spacing |
@nz-table-rep-column-name-color | rgba(0, 0, 0, 0.5) | Table responsive: Column name color |
Name | Default | Description | ||||
---|---|---|---|---|---|---|
@hafl-enabled | true | Whether hafl image | ||||
@abs-enabled | true | Whether abs element | ||||
@masonry-enabled | true | Whether css masonry | ||||
@setting-drawer-enabled | true | Whether setting drawer css | ||||
@search__form-enabled | true | Pro style search form, DEMO |
\u540d\u79f0 | \u9ed8\u8ba4\u503c | \u529f\u80fd |
---|---|---|
@layout-gutter | 8px | antd\u5e03\u5c40\u95f4\u8ddd\uff0c\u4e0d\u53ef\u6539\u53d8 |
@font-size-base | 14px | antd\u5b57\u53f7 |
@primary-color | \u84dd\u8272 | antd \u4e3b\u8272 |
@mobile-min | 768px | PC\u7aef |
@mobile-max | 767px | \u79fb\u52a8\u7aef |
@text-xs | @font-size-base - 2 | xs \u6587\u672c\u5927\u5c0f |
@text-sm | @font-size-base + 0 | sm \u6587\u672c\u5927\u5c0f |
@text-md | @font-size-base + 2 | md \u6587\u672c\u5927\u5c0f |
@text-lg | @font-size-base + 4 | lg \u6587\u672c\u5927\u5c0f |
@text-xl | @font-size-base + 8 | xl \u6587\u672c\u5927\u5c0f |
@text-xxl | @font-size-base + 12 | xxl \u6587\u672c\u5927\u5c0f |
@icon-sm | @font-size-base * 2 | sm \u56fe\u6807 |
@icon-md | @font-size-base * 4 | md \u56fe\u6807 |
@icon-lg | @font-size-base * 6 | lg \u56fe\u6807 |
@icon-xl | @font-size-base * 8 | xl \u56fe\u6807 |
@icon-xxl | @font-size-base * 10 | xxl \u56fe\u6807 |
@h1-font-size | 32px | h1\u5b57\u53f7 |
@h2-font-size | 24px | h2\u5b57\u53f7 |
@h3-font-size | 20px | h3\u5b57\u53f7 |
@h4-font-size | 16px | h4\u5b57\u53f7 |
@h5-font-size | 14px | h5\u5b57\u53f7 |
@h6-font-size | 12px | h6\u5b57\u53f7 |
@enable-all-colors | false | \u5f00\u542f\u80cc\u666f\u3001\u6587\u672c\u989c\u8272 \u4f8b\u5982\uff1a .bg-teal \u3001.text-teal \u6709\u5173\u989c\u8272\u503c\u89c1\u6837\u5f0f\u89c4\u5219\u7ae0\u8282 |
@modal-sm | 300px | \u5c0f\u53f7\u5bf9\u8bdd\u6846 |
@modal-md | 500px | \u4e2d\u53f7\u5bf9\u8bdd\u6846 |
@modal-lg | 900px | \u5927\u53f7\u5bf9\u8bdd\u6846 |
@modal-xl | 1200px | \u8d85\u5927\u53f7\u5bf9\u8bdd\u6846 |
@drawer-sm | 300px | \u5c0f\u53f7\u62bd\u5c49 |
@drawer-md | 500px | \u4e2d\u53f7\u62bd\u5c49 |
@drawer-lg | 900px | \u5927\u53f7\u62bd\u5c49 |
@drawer-xl | 1200px | \u8d85\u5927\u53f7\u62bd\u5c49 |
@drawer-sm-height | 200px | \u5c0f\u53f7\u62bd\u5c49 |
@drawer-md-height | 400px | \u4e2d\u53f7\u62bd\u5c49 |
@drawer-lg-height | 600px | \u5927\u53f7\u62bd\u5c49 |
@drawer-xl-height | 800px | \u8d85\u5927\u53f7\u62bd\u5c49 |
@code-border-color | #eee | <code> \u8fb9\u6846\u989c\u8272 |
@code-bg | #f7f7f7 | <code> \u80cc\u666f\u989c\u8272 |
@widths | xs @layout-gutter * 10 sm @layout-gutter * 20 md @layout-gutter * 30 lg @layout-gutter * 40 xl @layout-gutter * 50 xxl @layout-gutter * 50 | \u5bbd\u5ea6 |
@border-radius-md | 4px | \u4e2d\u53f7\u8fb9\u6846\u5706\u89d2 |
@border-radius-lg | 6px | \u5927\u53f7\u8fb9\u6846\u5706\u89d2 |
@masonry-column-gap | @layout-gutter * 2 | CSS\u7011\u5e03\u6d41\u5217\u4e0e\u5217\u7684\u95f4\u8ddd |
@scrollbar-enabled | true | \u542f\u7528\u7f8e\u5316\u6eda\u52a8\u6761 |
@scrollbar-width | 6px | \u7f8e\u5316\u6eda\u52a8\u6761\u5bbd\u5ea6 |
@scrollbar-height | 6px | \u7f8e\u5316\u6eda\u52a8\u6761\u9ad8\u5ea6 |
@scrollbar-track-color | rgba(0, 0, 0, 0.3) | \u7f8e\u5316\u6eda\u52a8\u6761\u7684\u8f68\u9053\u989c\u8272 |
@scrollbar-thumb-color | #6e6e6e | \u7f8e\u5316\u6eda\u52a8\u6761\u5c0f\u65b9\u5757\u989c\u8272 |
@scrollbar-table-enabled | false | \u542f\u7528\u7f8e\u5316\u8868\u683c\u6eda\u52a8\u6761 |
@rtl-enabled | false | \u662f\u5426\u652f\u6301 RTL |
@enabled-util-align | true | \u662f\u5426\u542f\u7528\u5de5\u5177\u7c7b align |
@enabled-util-border | true | \u662f\u5426\u542f\u7528\u5de5\u5177\u7c7b border |
@enabled-util-code | true | \u662f\u5426\u542f\u7528\u5de5\u5177\u7c7b code |
@enabled-util-color | true | \u662f\u5426\u542f\u7528\u5de5\u5177\u7c7b color |
@enabled-util-display | true | \u662f\u5426\u542f\u7528\u5de5\u5177\u7c7b display |
@enabled-util-float | true | \u662f\u5426\u542f\u7528\u5de5\u5177\u7c7b float |
@enabled-util-icon | true | \u662f\u5426\u542f\u7528\u5de5\u5177\u7c7b icon |
@enabled-util-img | true | \u662f\u5426\u542f\u7528\u5de5\u5177\u7c7b img |
@enabled-util-position | true | \u662f\u5426\u542f\u7528\u5de5\u5177\u7c7b position |
@enabled-util-overflow | true | \u662f\u5426\u542f\u7528\u5de5\u5177\u7c7b overflow |
@enabled-util-responsive | true | \u662f\u5426\u542f\u7528\u5de5\u5177\u7c7b responsive |
@enabled-util-spacing | true | \u662f\u5426\u542f\u7528\u5de5\u5177\u7c7b spacing |
@enabled-util-text | true | \u662f\u5426\u542f\u7528\u5de5\u5177\u7c7b text |
@enabled-util-width | true | \u662f\u5426\u542f\u7528\u5de5\u5177\u7c7b width |
@enabled-util-scrollbar | true | \u662f\u5426\u542f\u7528\u5de5\u5177\u7c7b scrollbar |
@enabled-util-other | true | \u662f\u5426\u542f\u7528\u5de5\u5177\u7c7b other |
\u540d\u79f0 | \u9ed8\u8ba4\u503c | \u529f\u80fd |
---|---|---|
@preserve-white-spaces-enabled | true | \u89e3\u51b3\u5f00\u542f preserveWhitespaces \u65f6\u6309\u94ae\u95f4\u53ef\u80fd\u4f1a\u51fa\u73b0\u65e0\u7f1d |
@preserve-sf-and-st-spaces | 16px | sf \u4e0e st \u95f4\u95f4\u8ddd |
@preserve-buttons-spaces | \u6309\u94ae\u95f4\u95f4\u8ddd\uff08\u5305\u62ec\uff1abutton\u3001button-group\u3001popconfirm\uff09 | |
@router-animation-enabled | false | \u662f\u5426\u542f\u7528\u8def\u7531\u5207\u6362\u52a8\u753b |
@router-animation-duration | antFadeIn | \u8def\u7531\u5207\u6362\u52a8\u753b |
@router-animation-duration | 1s | \u8def\u7531\u5207\u6362\u52a8\u753b\u65f6\u957f |
\u540d\u79f0 | \u9ed8\u8ba4\u503c | \u529f\u80fd |
---|---|---|
@forced-turn-off-nz-modal-animation-enabled | false | \u5f3a\u5236\u5173\u95ed nz-modal \u52a8\u753b\u6548\u679c |
\u540d\u79f0 | \u9ed8\u8ba4\u503c | \u529f\u80fd |
---|---|---|
@form-state-visual-feedback-enabled | false | \u5f00\u542f\u8868\u5355\u5143\u7d20\u7684\u89c6\u89c9\u53cd\u9988 |
@search-form-bg | #fbfbfb | \u5217\u8868\u9875\u7b80\u6613\u641c\u7d22\u8868\u5355\u80cc\u666f\u8272 |
@search-form-radius | 4px | \u5217\u8868\u9875\u7b80\u6613\u641c\u7d22\u8868\u5355\u5706\u89d2 |
\u6307 nz-table
\u3002
\u540d\u79f0 | \u9ed8\u8ba4\u503c | \u529f\u80fd |
---|---|---|
@nz-table-img-radius | 4px | \u8868\u683c\u4e2d\u7684\u56fe\u7247\u5706\u89d2 |
@nz-table-img-margin-right | 4px | \u8868\u683c\u4e2d\u7684\u56fe\u7247\u53f3\u5916\u8fb9\u8ddd |
@nz-table-img-max-width | 32px | \u8868\u683c\u4e2d\u7684\u56fe\u7247\u6700\u5927\u5bbd\u5ea6 |
@nz-table-img-max-height | 32px | \u8868\u683c\u4e2d\u7684\u56fe\u7247\u6700\u5927\u9ad8\u5ea6 |
@nz-table-even-background | none | \u5947\u5076\u80cc\u666f |
@nz-table-rep-max-width | @mobile-max | \u5f53\u79fb\u52a8\u7aef\u5c4f\u5e55\u65f6\u89e6\u53d1\u8868\u683c\u54cd\u5e94\u5f0f |
@nz-table-rep-header-background | @border-color-split | \u8868\u683c\u54cd\u5e94\u5f0f\uff1a\u6807\u9898\u80cc\u666f\u8272 |
@nz-table-rep-even-background | #f9f9f9 | \u8868\u683c\u54cd\u5e94\u5f0f\uff1a\u5076\u6570\u884c\u80cc\u666f\u8272 |
@nz-table-rep-padding-vertical | 8px | \u8868\u683c\u54cd\u5e94\u5f0f\uff1a\u5355\u5143\u683c\u5782\u76f4\u95f4\u8ddd |
@nz-table-rep-padding-horizontal | 8px | \u8868\u683c\u54cd\u5e94\u5f0f\uff1a\u5355\u5143\u683c\u6c34\u5e73\u95f4\u8ddd |
@nz-table-rep-column-name-width | 100px | \u8868\u683c\u54cd\u5e94\u5f0f\uff1a\u5217\u540d\u6700\u5927\u5bbd\u5ea6 |
@nz-table-rep-column-name-text-align | right | \u8868\u683c\u54cd\u5e94\u5f0f\uff1a\u5217\u540d\u6587\u672c\u5bf9\u9f50\u65b9\u5f0f |
@nz-table-rep-column-name-padding-right | right | \u8868\u683c\u54cd\u5e94\u5f0f\uff1a\u5217\u540d\u53f3\u95f4\u8ddd |
@nz-table-rep-column-name-color | rgba(0, 0, 0, 0.5) | \u8868\u683c\u54cd\u5e94\u5f0f\uff1a\u5217\u540d\u989c\u8272 |
\u540d\u79f0 | \u9ed8\u8ba4\u503c | \u529f\u80fd | ||||
---|---|---|---|---|---|---|
@hafl-enabled | true | \u534a\u56fe | ||||
@abs-enabled | true | \u4e2d\u5fc3\u5143\u7d20 | ||||
@masonry-enabled | true | CSS\u7011\u5e03\u6d41\u5217 | ||||
@setting-drawer-enabled | true | \u4e3b\u9898\u8bbe\u7f6e | ||||
@search__form-enabled | true | Pro\u641c\u7d22\u6846\uff0cDEMO |
Language | Filename |
---|---|
English | en_US |
Chinese (Simplified) | zh_CN |
Chinese (Traditional) | zh_TW |
Turkish | tr_TR |
Polish | pl_PL |
Greek | el_GR |
Korean | ko_KR |
Croatian | hr_HR |
Japanese | ja_JP |
Slovenian | sl_SI |
French | fr_FR |
Spanish | es_ES |
Italian | it_IT |
If you can\'t find your language, you are welcome to create a locale package based on en_US (You can also refer to #308 to contribute language package to us) and send us a pull req
\u4e3a\u6574\u4e2a @delon/*
\u7c7b\u5e93\u5185\u5efa\u6587\u6848\u63d0\u4f9b\u7edf\u4e00\u7684\u56fd\u9645\u5316\u652f\u6301\u3002
\u53ea\u9700\u8981\u5728\u6839\u6a21\u5757\u91cd\u65b0\u5bf9 DELON_LOCALE
\u6ce8\u5165\u76ee\u6807\u8bed\u8a00\u5373\u53ef\u5168\u5c40\u751f\u6548\u3002
import { DELON_LOCALE, en_US } from \'@delon/theme\';\n@NgModule({\n ...\n providers : [ { provide: DELON_LOCALE, useValue: en_US } ]\n})\nexport class AppModule { }
@delon
\u63d0\u4f9b\u4e86\u4e00\u4e2a\u670d\u52a1 DelonLocaleService
\u7528\u4e8e\u52a8\u6001\u4fee\u6539\u56fd\u9645\u5316\u6587\u6848\u3002
import { en_US, DelonLocaleService } from \'@delon/theme\';\n...\nconstructor(private delonLocaleService: DelonLocaleService) {\n}\n\nswitchLanguage() {\n this.delonLocaleService.setLocale(en_US);\n}
\u6ce8\u610f\uff1aen_US
\u662f\u8bed\u8a00\u5305\u540d\u79f0\uff0c\u4ee5\u4e0b\u8868\u683c\u4e5f\u9075\u5faa\u540c\u6837\u7684\u89c4\u5219\u3002
\u8bed\u8a00 | \u8bed\u8a00\u5305\u540d\u79f0 |
---|---|
\u82f1\u8bed\uff08\u7f8e\u5f0f\uff09 | en_US |
\u7b80\u4f53\u4e2d\u6587 | zh_CN |
\u7e41\u4f53\u4e2d\u6587 | zh_TW |
\u571f\u8033\u5176\u8bed | tr_TR |
\u6ce2\u5170\u8bed | pl_PL |
\u5e0c\u814a\u8bed | el_GR |
\u671d\u9c9c\u8bed | ko_KR |
\u514b\u7f57\u5730\u4e9a | hr_HR |
\u65e5\u8bed | ja_JP |
\u65af\u6d1b\u6587\u5c3c\u4e9a\u6587 | sl_SI |
\u6cd5\u6587 | fr_FR |
\u897f\u73ed\u7259\u8bed | es_ES |
\u610f\u5927\u5229\u8bed | it_IT |
\u5982\u679c\u4f60\u627e\u4e0d\u5230\u4f60\u9700\u8981\u7684\u8bed\u8a00\u5305\uff0c\u6b22\u8fce\u4f60\u5728 \u82f1\u6587\u8bed\u8a00\u5305\uff08\u4f60\u4e5f\u53ef\u4ee5\u53c2\u8003 #308 \u5411\u6211\u4eec\u8d21\u732e\u8bed\u8a00\u5305\uff09\u7684\u57fa\u7840\u4e0a\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u8bed\u8a00\u5305\uff0c\u5e76\u7ed9\u6211\u4eec Pull Req
ng-alain also includes a set of like bootstrap style tools, And built on the design principles developed by Ant Design. If you are familiar with Bootstrap, it will be very friendly, because all naming as close as it. Also, Install ng-alain snippets plugin in VSCode for intellisense these class names.
We have hundreds of Less variables (including ng-zorro-antd, ng-alain), some of which contain the -enabled
suffix, which means that these libraries are optional.
You can to theme.less set to false
, which can reduce css file size.
// I don\'t need masonry style\n@masonry-enabled: false
Name | Default | Description | ||||
---|---|---|---|---|---|---|
@scrollbar-enabled | true | Enable landscaping scrollbars | ||||
@preserve-white-spaces-enabled | true | Fixed between buttons spacing when enabled preserveWhitespaces is true | ||||
@form-state-visual-feedback-enabled | false | Turn on visual feedback of form invalid elements | ||||
@hafl-enabled | true | Whether hafl image | ||||
@abs-enabled | true | Whether abs element | ||||
@masonry-enabled | true | Whether css masonry | ||||
@setting-drawer-enabled | true | Whether setting drawer css | ||||
@search-form-enabled | true | Simple style search form, DEMO | ||||
@search__form-enabled | true | Pro style search form, DEMO |
\u540d\u79f0 | \u9ed8\u8ba4\u503c | \u529f\u80fd | ||||
---|---|---|---|---|---|---|
@scrollbar-enabled | true | \u542f\u7528\u7f8e\u5316\u6eda\u52a8\u6761 | ||||
@preserve-white-spaces-enabled | true | \u89e3\u51b3\u5f00\u542f preserveWhitespaces \u65f6\u6309\u94ae\u95f4\u53ef\u80fd\u4f1a\u51fa\u73b0\u65e0\u7f1d | ||||
@form-state-visual-feedback-enabled | false | \u5f00\u542f\u8868\u5355\u5143\u7d20\u7684\u89c6\u89c9\u53cd\u9988 | ||||
@hafl-enabled | true | \u534a\u56fe | ||||
@abs-enabled | true | \u4e2d\u5fc3\u5143\u7d20 | ||||
@masonry-enabled | true | CSS\u7011\u5e03\u6d41\u5217 | ||||
@setting-drawer-enabled | true | \u4e3b\u9898\u8bbe\u7f6e | ||||
@search-form-enabled | true | \u7b80\u5316\u641c\u7d22\u6846\uff0cDEMO | ||||
@search__form-enabled | true | Pro\u641c\u7d22\u6846\uff0cDEMO |
Name | Formula | Size | Description |
---|---|---|---|
xs | $gutter / 2 | 4px | Smaller |
sm | $gutter | 8px | Small |
md | $gutter * 2 | 16px | Medium |
lg | $gutter * 3 | 24px | Large |
xl | $gutter * 4 | 32px | Extra Large |
xxl | $gutter * 6 | 48px | Oversized |
According these rules, derived from margin
\uff0cpadding
, and naming rules as follows:
Type: padding
, margin
Direction(Optional): top
, right
, bottom
, left
, x
(equal to left
, right
), y
(equal to top
, bottom
)
Clean
[<Type>p|m][t|r|b|l|x|y]?0
Name Rule
[<Type>p|m][t|r|b|l|x|y]?-[sm|md|lg]
Demo:
.p-sm { padding: 8px !important; }\n.pt-sm { padding-top: 8px !important; }\n.m-sm { margin: 16px !important; }\n.mt-md { margin-top: 16px !important; }\n\n.p0 { padding: 0 !important; }
Ant Design does not have a button color, but is based on visual effects. The default is daybreak blue, for example: button type primary
of nz-button
.
ng-alain still does not break this rule, building a set of color classes for text and background based on the color section.
Name | Primary Color | Description |
---|---|---|
red | #f5222d | Dust Red: Fighting, unrestrained |
volcano | #fa541c | Volcano: Eye-catching |
orange | #fa8c16 | Sunset Orange: Warm and cheerful |
gold | #faad14 | Calendula Gold: Vital and active |
yellow | #fadb14 | Sunrise Yellow: Birth, sunshine |
lime | #a0d911 | Lime: Natural, vital |
green | #f5222d | Polar Green: Health, innovation |
cyan | #13c2c2 | Cyan: Hope, strong |
blue | #1890ff | Daybreak Blue: Inclusive, technology, Pratt & Whitney |
geekblue | #2f54eb | Geek Blue: Explore and delve into |
purple | #722ed1 | Golden Purple: Elegant, romantic |
magenta | #eb2f96 | Magenta: Smooth, neutral |
Ant Design\'s base color palette totals 120 colors, including 12 primary colors and their derivative colors. These colors can basically include the need for color in background applications design.
Category
Name | Color Size |
---|---|
light | 5 |
normal | 6 |
dark | 7 |
Name Rule
[<Type>text|bg]-[red|volcano|orange|gold|yellow|lime|green|cyan|blue|geekblue|purple|magenta|grey](-[light|dark])?(-h)?
normal
itself is the basic color, so it can be ignored\ngrey
is very often used, so add extragrey-light
,grey-darker
alias to indicate depth
DEMO:
// Text color\n.text-red-light { color: #fabeb9 !important; }\n.text-red { color: #f04134 !important; }\n.text-red-dark { color: #a31837 !important; }\n\n// background-color color\n.bg-red-light { background-color: #fabeb9 !important; }\n.bg-red { background-color: #f04134 !important; }\n.bg-red-dark { background-color: #a31837 !important; }\n\n// hover color\n.bg-red-light-h { &:hover { background-color: #fabeb9 !important; } }\n.bg-red-h { &:hover { background-color: #f04134 !important; } }\n.bg-red-dark-h { &:hover { background-color: #a31837 !important; } }
Aliase | Color Name |
---|---|
primary | @blue-6 #1890ff |
success | @green-6 #52c41a |
error | @red-5 #ff4d4f |
warning | @gold-6 #faad14 |
info | @blue-6 #1890ff |
processing | @blue-6 #1890ff |
highlight | @red-5 #ff4d4f |
normal | #d9d9d9 #d9d9d9 |
DEMO:
// Text color\n.text-error-light { color: #fabeb9 !important; }\n.text-error { color: #f04134 !important; }\n.text-error-dark { color: #a31837 !important; }\n\n// background-color color\n.bg-error-light { background-color: #fabeb9 !important; }\n.bg-error { background-color: #f04134 !important; }\n.bg-error-dark { background-color: #a31837 !important; }\n\n// hover color\n.bg-error-light-h { &:hover { background-color: #fabeb9 !important; } }\n.bg-error-h { &:hover { background-color: #f04134 !important; } }\n.bg-error-dark-h { &:hover { background-color: #a31837 !important; } }
Full Colors
You can use @enable-all-colors: true
to turn on all 120 color rules.
.text-red-1 { color: #fff1f0 !important; }\n.text-red-6 { color: #f04134 !important; }\n.text-red-10 { color: #5c0011 !important; }\n\n.bg-red-6 { color: #f04134 !important; }\n.bg-red-6-h { color: #f04134 !important; }
Clear floats .clearfix
.
Aliase | CSS |
---|---|
d-none | display: none |
d-block | display: block |
d-inline-block | display: inline-block |
d-flex | display: flex |
d-inline-flex | display: inline-flex |
justify-content-start | justify-content: flex-start |
justify-content-end | justify-content: flex-end |
justify-content-center | justify-content: center |
justify-content-between | justify-content: space-between |
justify-content-around | justify-content: space-around |
align-items-start | align-items: flex-start |
align-items-end | align-items: flex-end |
align-items-center | align-items: center |
align-items-baseline | align-items: baseline |
align-items-stretch | align-items: stretch |
align-content-start | align-content: flex-start |
align-content-end | align-content: flex-end |
align-content-center | align-content: center |
align-content-between | align-content: space-between |
align-content-around | align-content: space-around |
align-content-stretch | align-content: stretch |
align-self-auto | align-self: auto |
align-self-start | align-self: flex-start |
align-self-end | align-self: flex-end |
align-self-center | align-self: center |
align-self-baseline | align-self: baseline |
align-self-stretch | align-self: stretch |
flex-center | display: flex; align-items: center; |
flex-center-between | display: flex; align-items: center; align-content: space-between; |
Name | Description |
---|---|
overflow-auto | overflow: auto |
overflow-hidden | overflow: hidden |
fixed-top | Fixed top |
fixed-bottom | Fixed bottom |
Ant Design is based on 14px
.
Name | Description |
---|---|
text-xs | 12px |
text-sm | 14px |
text-md | 16px |
text-lg | 18px |
text-xl | 22px |
Name | Description |
---|---|
text-left | Text left |
text-center | Text center |
text-right | Text right |
The container must be
display: inline-block
ordisplay: block
.
Name | Description |
---|---|
text-nowrap | Outputs a single line |
text-truncate | Truncate string with ellipsis |
Name | Description |
---|---|
text-lowercase | Lowercase of text |
text-uppercase | Uppercase of text |
text-capitalize | Capitalize of text |
text-deleted | Deleted line |
Name | Description |
---|---|
font-weight-normal | font-weight: normal |
font-weight-bold | font-weight: 700 |
font-italic | font-style: italic |
Name | Description |
---|---|
text-hover | *:hover { color: @primary-color; } |
disabled | Disabled |
Name | Description |
---|---|
border | border: 1px solid #f5f5f5 !important; |
border-0 | border: 0 !important; |
border-top-0 | border-top: 0 !important; |
border-right-0 | border-right: 0 !important; |
border-bottom-0 | border-bottom: 0 !important; |
border-left-0 | border-left: 0 !important; |
Supports all color & aliase of color section, such as border-red
, border-success
.
Name | Description |
---|---|
rounded-0 | border-radius: 0; |
rounded-circle | border-radius: 50%; |
rounded-sm | border-radius: 2px; |
rounded-md | border-radius: 4px; |
rounded-lg | border-radius: 6px; |
Name | Description |
---|---|
width-sm | 160px |
width-md | 240px |
width-lg | 320px |
width-[0-10] | 0%-100% |
Like Bootstrap responsive rules, all apply hidden-xs
classes are hidden when screen less than 480px
.
Name | Screen |
---|---|
hidden-xs | <480px |
hidden-sm | <768px |
hidden-md | <992px |
hidden-lg | <1200px |
hidden-pc | <768px |
hidden-mobile | >768px |
.rotate-[360 / 15]
DEMO:
// Rotate 15 degrees\n.rotate-15\n// Rotate 90 degrees\n.rotate-90\n// Rotate 360 degrees\n.rotate-360
Name | Description |
---|---|
block-center | margin: 0 auto |
point | cursor: pointer |
no-data | No result |
no-resize | Setting does not allow adjustment elements |
bg-center | Background image is vertically centered |
scrollbar | Custom scrollbar for a div |
color-weak | Weak mode |
Online DEMO\u3002
Name | Description |
---|---|
row-masonry | Rows |
row-masonry-{xs|sm|md|lg|xl}-{1-10} | Rows, Responsive style |
col-masonry | Columns |
Name | Description |
---|---|
ant-card__body-nopadding | Force body without spacing |
Name | Description |
---|---|
modal-{sm|md|lg|xl} | Set size of modal, wrapClassName: \'modal-lg\' |
modal-body-nopadding | Without padding in body element |
modal-header | Use html template to custom modal, DEMO |
modal-footer | Use html template to custom modal, DEMO |
Name | Description |
---|---|
ant-table-rep__title | Title |
ant-table-rep__hide-header-footer | Show title or bottom when mobile screen |
Name | Description | |||||
---|---|---|---|---|---|---|
ant-tag__plus | Add button style |
\u540d\u79f0 | \u516c\u5f0f | \u5c3a\u5bf8 | \u8bf4\u660e |
---|---|---|---|
xs | $gutter / 2 | 4px | \u8d85\u5c0f\u53f7 |
sm | $gutter | 8px | \u5c0f\u53f7 |
md | $gutter * 2 | 16px | \u4e2d\u53f7 |
lg | $gutter * 3 | 24px | \u5927\u53f7 |
xl | $gutter * 4 | 32px | \u7279\u5927\u53f7 |
xxl | $gutter * 6 | 48px | \u8d85\u5927\u53f7 |
\u4f9d\u8fd9\u4e9b\u89c4\u5219\uff0c\u884d\u751f\u51fa margin
\u3001padding
\uff0c\u5176\u547d\u540d\u89c4\u5219\u5982\u4e0b\uff1a
\u7c7b\u578b\uff1apadding
\u3001margin
\u65b9\u5411\uff08\u53ef\u9009\uff09\uff1atop
\u3001right
\u3001bottom
\u3001left
\u3001x
\uff08\u76f8\u5f53\u4e8e left
\u3001right
\uff09\u3001y
\uff08\u76f8\u5f53\u4e8e top
\u3001bottom
\uff09
\u6d88\u9664
[<\u7c7b\u578b>p|m][<\u65b9\u5411>t|r|b|l|x|y]?0
\u547d\u540d\u683c\u5f0f
[<\u7c7b\u578b>p|m][<\u65b9\u5411>t|r|b|l|x|y]?-[<\u5c3a\u5bf8>sm|md|lg]
\u793a\u4f8b\uff1a
.p-sm { padding: 8px !important; }\n.pt-sm { padding-top: 8px !important; }\n.m-sm { margin: 16px !important; }\n.mt-md { margin-top: 16px !important; }\n\n.p0 { padding: 0 !important; }
Ant Design \u5e76\u6ca1\u6709\u6309\u94ae\u8272\u8fd9\u4e00\u8bf4\uff0c\u800c\u662f\u4ee5\u89c6\u89c9\u6548\u679c\u4e3a\u57fa\u51c6\u3002\u9ed8\u8ba4\u662f\u84dd\u8272\u7cfb\uff08\u62c2\u6653\u84dd\uff09\uff0c\u4f8b\u5982\uff1anz-button
\u7684\u6309\u94ae\u7c7b\u578b primary
\u3002
\u800c ng-alain \u4f9d\u7136\u4e0d\u4f1a\u7834\u574f\u8fd9\u79cd\u89c4\u5219\uff0c\u4f46\u4f9d \u8272\u5f69 \u7ae0\u8282\uff0c\u4ea7\u751f\u4e86\u4e00\u79cd\u8fd0\u7528\u4e8e\u6587\u672c\u3001\u80cc\u666f\u7684\u8272\u7cfb\u7c7b\u3002
\u540d\u79f0 | \u57fa\u672c\u8272 | \u8bf4\u660e |
---|---|---|
red | #f5222d | \u8584\u66ae\uff1a\u6597\u5fd7\u3001\u5954\u653e |
volcano | #fa541c | \u706b\u5c71\uff1a\u9192\u76ee\u3001\u6f8e\u6e43 |
orange | #fa8c16 | \u65e5\u66ae\uff1a\u6e29\u6696\u3001\u6b22\u5feb |
gold | #faad14 | \u91d1\u76cf\u82b1\uff1a\u6d3b\u529b\u3001\u79ef\u6781 |
yellow | #fadb14 | \u65e5\u51fa\uff1a\u51fa\u751f\u3001\u9633\u5149 |
lime | #a0d911 | \u9752\u67e0\uff1a\u81ea\u7136\u3001\u751f\u673a |
green | #f5222d | \u6781\u5149\u7eff\uff1a\u5065\u5eb7\u3001\u521b\u65b0 |
cyan | #13c2c2 | \u660e\u9752\uff1a\u5e0c\u671b\u3001\u575a\u5f3a |
blue | #1890ff | \u62c2\u6653\u84dd\uff1a\u5305\u5bb9\u3001\u79d1\u6280\u3001\u666e\u60e0 |
geekblue | #2f54eb | \u6781\u5ba2\u84dd\uff1a\u63a2\u7d22\u3001\u94bb\u7814 |
purple | #722ed1 | \u9171\u7d2b\uff1a\u4f18\u96c5\u3001\u6d6a\u6f2b |
magenta | #eb2f96 | \u6cd5\u5f0f\u6d0b\u7ea2\uff1a\u5e73\u7a33\u3001\u4e2d\u6027 |
Ant Design \u7684\u57fa\u7840\u8272\u677f\u5171\u8ba1 120 \u4e2a\u989c\u8272\uff0c\u5305\u542b 12 \u4e2a\u4e3b\u8272\u4ee5\u53ca\u884d\u751f\u8272\u3002\u8fd9\u4e9b\u989c\u8272\u57fa\u672c\u53ef\u4ee5\u6ee1\u8db3\u4e2d\u540e\u53f0\u8bbe\u8ba1\u4e2d\u5bf9\u4e8e\u989c\u8272\u7684\u9700\u6c42\u3002
\u5206\u7c7b
\u540d\u79f0 | \u8272\u53f7 |
---|---|
light | 5\u53f7 |
normal | 6\u53f7 |
dark | 7\u53f7 |
\u547d\u540d\u683c\u5f0f
[<\u7c7b\u578b>text|bg]-[<\u8272\u5f69\u540d>red|volcano|orange|gold|yellow|lime|green|cyan|blue|geekblue|purple|magenta|grey](-[light|dark])?(-h)?
normal
\u672c\u8eab\u5373\u662f\u57fa\u672c\u8272\uff0c\u6240\u4ee5\u53ef\u4ee5\u88ab\u5ffd\u7565\ngrey
\u53ef\u80fd\u4f1a\u66f4\u5e38\u7528\uff0c\u6240\u4ee5\u989d\u5916\u589e\u52a0grey-lighter
\u3001grey-darker
\u522b\u540d\u8868\u793a\u6df1\u5ea6
\u793a\u4f8b\uff1a
// Text color\n.text-red-light { color: #fabeb9 !important; }\n.text-red { color: #f04134 !important; }\n.text-red-dark { color: #a31837 !important; }\n\n// background-color color\n.bg-red-light { background-color: #fabeb9 !important; }\n.bg-red { background-color: #f04134 !important; }\n.bg-red-dark { background-color: #a31837 !important; }\n\n// hover color\n.bg-red-light-h { &:hover { background-color: #fabeb9 !important; } }\n.bg-red-h { &:hover { background-color: #f04134 !important; } }\n.bg-red-dark-h { &:hover { background-color: #a31837 !important; } }
\u522b\u540d | \u8272\u7cfb |
---|---|
primary | @blue-6 #1890ff |
success | @green-6 #52c41a |
error | @red-5 #ff4d4f |
warning | @gold-6 #faad14 |
info | @blue-6 #1890ff |
processing | @blue-6 #1890ff |
highlight | @red-5 #ff4d4f |
normal | #d9d9d9 #d9d9d9 |
\u793a\u4f8b\uff1a
// Text color\n.text-error-light { color: #fabeb9 !important; }\n.text-error { color: #f04134 !important; }\n.text-error-dark { color: #a31837 !important; }\n\n// background-color color\n.bg-error-light { background-color: #fabeb9 !important; }\n.bg-error { background-color: #f04134 !important; }\n.bg-error-dark { background-color: #a31837 !important; }\n\n// hover color\n.bg-error-light-h { &:hover { background-color: #fabeb9 !important; } }\n.bg-error-h { &:hover { background-color: #f04134 !important; } }\n.bg-error-dark-h { &:hover { background-color: #a31837 !important; } }
\u4f60\u53ef\u4ee5\u4f7f\u7528 @enable-all-colors: true
\u6765\u5f00\u542f\u6240\u6709 120 \u4e2a\u989c\u8272\u7684\u89c4\u5219\u3002
.text-red-1 { color: #fff1f0 !important; }\n.text-red-6 { color: #f04134 !important; }\n.text-red-10 { color: #5c0011 !important; }\n\n.bg-red-6 { color: #f04134 !important; }\n.bg-red-6-h { color: #f04134 !important; }
\u6e05\u9664\u6d6e\u52a8 .clearfix
\u3002
\u522b\u540d | CSS |
---|---|
d-none | display: none |
d-block | display: block |
d-inline-block | display: inline-block |
d-flex | display: flex |
d-inline-flex | display: inline-flex |
justify-content-start | justify-content: flex-start |
justify-content-end | justify-content: flex-end |
justify-content-center | justify-content: center |
justify-content-between | justify-content: space-between |
justify-content-around | justify-content: space-around |
align-items-start | align-items: flex-start |
align-items-end | align-items: flex-end |
align-items-center | align-items: center |
align-items-baseline | align-items: baseline |
align-items-stretch | align-items: stretch |
align-content-start | align-content: flex-start |
align-content-end | align-content: flex-end |
align-content-center | align-content: center |
align-content-between | align-content: space-between |
align-content-around | align-content: space-around |
align-content-stretch | align-content: stretch |
align-self-auto | align-self: auto |
align-self-start | align-self: flex-start |
align-self-end | align-self: flex-end |
align-self-center | align-self: center |
align-self-baseline | align-self: baseline |
align-self-stretch | align-self: stretch |
flex-center | display: flex; align-items: center; |
flex-center-between | display: flex; align-items: center; align-content: space-between; |
\u540d\u79f0 | \u8bf4\u660e |
---|---|
overflow-auto | overflow: auto |
overflow-hidden | overflow: hidden |
fixed-top | \u56fa\u5b9a\u9876\u90e8 |
fixed-bottom | \u56fa\u5b9a\u5e95\u90e8 |
Ant Design \u662f\u4ee5 14px
\u4e3a\u57fa\u51c6\u5b57\u53f7\u3002
\u540d\u79f0 | \u8bf4\u660e |
---|---|
text-xs | 12px |
text-sm | 14px |
text-md | 16px |
text-lg | 18px |
text-xl | 22px |
\u540d\u79f0 | \u8bf4\u660e |
---|---|
text-left | \u6587\u672c\u5c45\u5de6 |
text-center | \u6587\u672c\u5c45\u4e2d |
text-right | \u6587\u672c\u5c45\u53f3 |
\u5bb9\u5668\u5fc5\u987b\u662f
display: inline-block
\u6216display: block
\u3002
\u540d\u79f0 | \u8bf4\u660e |
---|---|
text-nowrap | \u6587\u672c\u8d85\u51fa\u4e0d\u6362\u884c |
text-truncate | \u6587\u672c\u8d85\u51fa\u622a\u53d6\u5e76\u52a0 ... |
\u540d\u79f0 | \u8bf4\u660e |
---|---|
text-lowercase | \u5c0f\u5199\u6587\u672c |
text-uppercase | \u5927\u5199\u6587\u672c |
text-capitalize | \u9996\u8bcd\u5927\u5199 |
text-deleted | \u5220\u9664\u7ebf |
\u540d\u79f0 | \u8bf4\u660e |
---|---|
font-weight-normal | font-weight: normal |
font-weight-bold | font-weight: 700 |
font-italic | font-style: italic |
\u540d\u79f0 | \u8bf4\u660e |
---|---|
text-hover | *:hover { color: @primary-color; } |
disabled | \u7981\u6b62 |
\u540d\u79f0 | \u8bf4\u660e |
---|---|
border | border: 1px solid #f5f5f5 !important; |
border-0 | border: 0 !important; |
border-top-0 | border-top: 0 !important; |
border-right-0 | border-right: 0 !important; |
border-bottom-0 | border-bottom: 0 !important; |
border-left-0 | border-left: 0 !important; |
\u652f\u6301\u8272\u5f69\u7ae0\u8282\u6240\u6709\u7684\u8272\u7cfb&\u522b\u540d\u5199\u6cd5\uff0c\u4f8b\u5982\uff1aborder-red
\u3001border-success
\u3002
\u540d\u79f0 | \u8bf4\u660e |
---|---|
rounded-0 | border-radius: 0; |
rounded-circle | border-radius: 50%; |
rounded-sm | border-radius: 2px; |
rounded-md | border-radius: 4px; |
rounded-lg | border-radius: 6px; |
\u540d\u79f0 | \u8bf4\u660e |
---|---|
width-sm | 160px |
width-md | 240px |
width-lg | 320px |
width-[0-10] | 0%-100% |
\u7c7b\u4f3c Bootstrap \u54cd\u5e94\u5f0f\u89c4\u5219\uff0c\u5f53\u5c4f\u5e55\u5c0f\u4e8e 480px
\u65f6\u4f1a\u9690\u85cf\u6240\u6709 hidden-xs
\u7c7b\u3002
\u540d\u79f0 | \u5c4f\u5e55 |
---|---|
hidden-xs | <480px |
hidden-sm | <768px |
hidden-md | <992px |
hidden-lg | <1200px |
hidden-pc | <768px |
hidden-mobile | >768px |
.rotate-[360 / 15]
\u4f8b\u5982\uff1a
// \u65cb\u8f6c15\u5ea6\n.rotate-15\n// \u65cb\u8f6c90\u5ea6\n.rotate-90\n// \u65cb\u8f6c360\u5ea6\n.rotate-360
\u540d\u79f0 | \u8bf4\u660e |
---|---|
block-center | margin: 0 auto |
point | cursor: pointer |
no-data | \u7a7a\u6570\u636e\u884c |
no-resize | \u8bbe\u7f6e\u4e0d\u5141\u8bb8\u8c03\u6574\u5143\u7d20 |
bg-center | \u80cc\u666f\u56fe\u5782\u76f4\u5c45\u4e2d |
scrollbar | \u7f8e\u5316 div \u6eda\u52a8\u6761 |
color-weak | \u8272\u5f31\u6a21\u5f0f |
\u5728\u7ebf\u793a\u4f8b\u3002
\u540d\u79f0 | \u8bf4\u660e |
---|---|
row-masonry | \u884c |
row-masonry-{xs|sm|md|lg|xl}-{1-10} | \u5217\uff0c\u54cd\u5e94\u5f0f\u6837\u5f0f |
col-masonry | \u5217 |
\u540d\u79f0 | \u8bf4\u660e |
---|---|
ant-card__body-nopadding | \u5f3a\u5236\u5185\u5bb9\u65e0\u95f4\u8ddd |
\u540d\u79f0 | \u8bf4\u660e |
---|---|
modal-{sm|md|lg|xl} | \u8bbe\u7f6eModal\u7684\u5927\u5c0f\uff0cwrapClassName: \'modal-lg\' |
modal-body-nopadding | \u5185\u5bb9\u65e0\u5185\u8fb9\u8ddd |
modal-header | \u81ea\u5b9a\u4e49Modal\u65f6\u975e\u5e38\u6709\u6548\uff0cDEMO |
modal-footer | \u81ea\u5b9a\u4e49Modal\u65f6\u975e\u5e38\u6709\u6548\uff0cDEMO |
\u540d\u79f0 | \u8bf4\u660e |
---|---|
ant-table-rep__title | \u6807\u9898 |
ant-table-rep__hide-header-footer | \u5c0f\u5c4f\u5e55\u65f6\u624d\u663e\u793a\u6807\u9898\u6216\u5e95\u90e8 |
\u540d\u79f0 | \u8bf4\u660e | |||||
---|---|---|---|---|---|---|
ant-tag__plus | \u589e\u52a0\u6309\u94ae\u6837\u5f0f |
Property | Description | Type | Default |
---|---|---|---|
[options] | Options of the layout | LayoutDefaultOptions | - |
[asideUser] | Side user of the layout | TemplateRef<void> | - |
[asideBottom] | Bottom information of the layout | TemplateRef<void> | - |
[nav] | Nav | TemplateRef<void> | - |
[content] | Content | TemplateRef<void> | - |
[customError] | Custom exception routing error message, can\'t show when is null | string, null | Could not load ${evt.url} route |
[fetchingStrictly] | Precise check top loading animation state | boolean | false |
[fetching] | Top loading animation state | boolean | false |
Property | Description | Type | Default |
---|---|---|---|
[logo] | Custom Logo Area | TemplateRef<void> | - |
[logoExpanded] | Logo url of expanded status | string | ./assets/logo-full.svg |
[logoCollapsed] | Logo url of collapsed status | string | ./assets/logo.svg |
[logoFixWidth] | Specify a fixed logo width | number | - |
[logoLink] | Specify the logo routing address | string | / |
[hideAside] | Hide the sidebar without showing the collapsed icon button | boolean | false |
[hideHeader] | Hide top bar | boolean | false |
[showHeaderCollapse] | Whether to display the menu collapse button on the top bar | boolean | true |
[showSiderCollapse] | Whether to show the menu collapse button at the bottom of the sidebar | boolean | false |
Property | Description | Type | Default |
---|---|---|---|
[disabledAcl] | Displayed disabled state when acl check fails. | boolean | false |
[autoCloseUnderPad] | When the route width is less than the Pad width, the sidebar is automatically closed. | boolean | true |
[recursivePath] | Automatic up recursive lookup, menu data source contains /ware , then /ware/1 is also treated as /ware | boolean | true |
[openStrictly] | Precise check open status, does not auto closed other open item | boolean | false |
[maxLevelIcon] | Icon displays up to which level | number | 3 |
(select) | Callback when clicking menu (including disabled ) | EventEmitter<Menu> | - |
The component data comes from
MenuService
(which is structured as Menu), and the operation ofMenuService
is auto synchronized to the component.
Property | Description | Type | Default |
---|---|---|---|
[hidden] | Hidden behavior of the header item | pc, mobile, none | nones |
[direction] | Direction of the header item | left, middle, right | right |
The trigger style of the head item.
Header business menu item, please refer to layout.component.ts(Preview).
In the upper-left-right layout mode, it is applied to the development of the business page. Its specification details:
Top area height 64px
\uff08parameter\uff1a@header-hg
\uff09
Side area width 200px
\uff08parameter\uff1a@aside-wd
\uff09
Hide side navigation when the screen is below 1140px
wide
Turn the side navigation to the fixed
state when the screen is below 1140px
wide
Mainly includes a layout-default-nav component
Parameters are adjustable as needed by the
src/styles/theme.less
file.
Top area
location\uff1asrc/app/layout/base/header
Scaffolding provides some regular top-level components by default, which are stored in the components directory. At the same time @delon/abc
also provides several top components (eg\uff1anotice-icon Notification menu component. You can build it yourself or develop it yourself based on the components provided.
Scaffolding supports responsive layout. For the top area, you may need to hide some components under the small screen, so you can add
hidden-xs
to the corresponding DOM node to automatically hide when the screen is smaller than768px
.
Side area
location\uff1asrc/app/layout/default/sidebar
Only one user information and main menu are included. The main menu is a layout-default-nav component.
Internal area
The content area is the business page area, the specification details\uff1a
Content distance page standard, side, right scroll bar, bottom, this margin is based on a standard Dashboard Gutter width 24px
.
Name | Default | Description |
---|---|---|
@alain-default-prefix | .alain-default | Style name prefix |
@alain-default-ease | cubic-bezier(.25, 0, .15, 1) | Animation filter function |
@alain-default-header-hg | 64px | Height of header |
@alain-default-header-bg | @primary-color | Background-color of header |
@alain-default-header-padding | @layout-gutter * 2 | Horizontal padding of header |
@alain-default-header-search-enabled | true | Whether top search |
@alain-default-header-icon-fs | 18px | Font size of icon |
@alain-default-header-logo-max-height | 36px | Max height of logo |
@alain-default-aside-wd | 200px | Width of aside |
@alain-default-aside-bg | #fff | Background-color of aside |
@alain-default-aside-scrollbar-width | 0 | Scrollbar width of aside |
@alain-default-aside-scrollbar-height | 0 | Scrollbar height of aside |
@alain-default-aside-scrollbar-track-color | transparent | Scrollbar track color of aside |
@alain-default-aside-scrollbar-thumb-color | transparent | Scrollbar thumb color of aside |
@alain-default-aside-nav-fs | 14px | Font size of nav name |
@alain-default-aside-nav-icon-width | 14px | Width of nav icon |
@alain-default-aside-nav-img-wh | 14px | Width & height of nav image |
@alain-default-aside-nav-padding-top-bottom | @layout-gutter | Vertical padding of nav |
@alain-default-aside-nav-padding-left-right | @layout-gutter * 2 | Horizontal padding of nav |
@alain-default-aside-nav-text-color | rgba(0, 0, 0, 0.65) | Nav text color |
@alain-default-aside-nav-text-hover-color | #108ee9 | Nav text hover color |
@alain-default-aside-nav-group-text-color | rgba(0, 0, 0, 0.43) | Group text color |
@alain-default-aside-nav-selected-text-color | #108ee9 | Nav selected text color |
@alain-default-aside-nav-selected-bg | #fcfcfc | Nav selected background color |
@alain-default-aside-collapsed-wd | @layout-gutter * 8 | Width of aside collapsed |
@alain-default-aside-collapsed-nav-fs | 24px | Font size of aside collapsed |
@alain-default-aside-collapsed-nav-img-wh | 24px | Width & height nav image of aside collapsed |
@alain-default-content-heading-bg | #fafbfc | Heading background color of content area |
@alain-default-content-heading-border | #efe3e5 | Heading bottom border color of content area |
@alain-default-content-padding | @layout-gutter * 3 | Padding of content area |
@alain-default-content-bg | #f5f7fa | Background color of content area |
@alain-default-widget-app-icons-enabled | true | Whether the app-icon widget styles |
@alain-default-aside-user-enabled | true | Whether the user styles of aside |
The shortcut menu generation rules are uniformly searched under the 0
index\uff0cand get in the following order:
Recommended children have shortcutRoot: true
which is the highest priority
Otherwise, find the link with the word dashboard, if it exists, create a shortcut entry below the menu.
Otherwise placed at the 0 node position
Therefore, it\'s recommended to keep a valid shortcutRoot: true
data under the 0
index of the menu data.
Hide main menu item
You can set hide: true
in the menu.
Hide auto-generated navigation hide breadcrumbs
You can set hideInBreadcrumb: true
in the menu.
About level
Although unlimited levels are supported, please keep no more than four levels (including groups) for user experience.
How to update a menu item
The menu will be re-rendered via calling MenuService.setItem(key, newValue)
, please refer to the definition of Menu.
How to control menu expand
Use LayoutDefaultService.toggleCollapsed()
for manual control at runtime.
\u9ed8\u8ba4\u5e03\u5c40\u6240\u6709\u53c2\u6570\u90fd\u4ee5 @alain-default-
\u5f00\u5934\u3002
\u5728 src/styles.less
\u5f15\u5165\uff1a
@import \'@delon/theme/layout-default/style/index\';
layout-default
\u7ec4\u4ef6\u5728 src/app/layout/basic/basic.component.ts
\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u5e03\u5c40\uff1a
import { Component } from \'@angular/core\';\nimport { SettingsService, User } from \'@delon/theme\';\nimport { LayoutDefaultOptions } from \'@delon/theme/layout-default\';\nimport { environment } from \'@env/environment\';\n\n@Component({\n selector: \'layout-basic\',\n template: `\n <layout-default [options]="options" [asideUser]="asideUserTpl" [nav]="navTpl" [content]="contentTpl">\n <layout-default-header-item direction="left">\n <a layout-default-header-item-trigger href="//github.com/ng-alain/ng-alain" target="_blank">\n <i nz-icon nzType="github"></i>\n </a>\n </layout-default-header-item>\n <layout-default-header-item direction="left" hidden="pc">\n <div layout-default-header-item-trigger (click)="searchToggleStatus = !searchToggleStatus">\n <i nz-icon nzType="search"></i>\n </div>\n </layout-default-header-item>\n <layout-default-header-item direction="middle">\n <header-search class="alain-default__search" [toggleChange]="searchToggleStatus" />\n </layout-default-header-item>\n <layout-default-header-item direction="right" hidden="mobile">\n <header-task />\n </layout-default-header-item>\n <ng-template #asideUserTpl>\n <div nz-dropdown nzTrigger="click" [nzDropdownMenu]="userMenu" class="alain-default__aside-user">\n <nz-avatar class="alain-default__aside-user-avatar" [nzSrc]="user.avatar" />\n <div class="alain-default__aside-user-info">\n <strong>{{ user.name }}</strong>\n <p class="mb0">{{ user.email }}</p>\n </div>\n </div>\n <nz-dropdown-menu #userMenu="nzDropdownMenu">\n <ul nz-menu>\n <li nz-menu-item routerLink="/pro/account/center">{{ \'menu.account.center\' | i18n }}</li>\n <li nz-menu-item routerLink="/pro/account/settings">{{ \'menu.account.settings\' | i18n }}</li>\n </ul>\n </nz-dropdown-menu>\n </ng-template>\n <ng-template #navTpl>\n <layout-default-nav class="d-block py-lg" />\n </ng-template>\n <ng-template #contentTpl>\n <router-outlet />\n </ng-template>\n </layout-default>\n\n <setting-drawer *ngIf="showSettingDrawer" />\n <theme-btn />\n `,\n})\nexport class LayoutBasicComponent {\n options: LayoutDefaultOptions = {\n logoExpanded: `./assets/logo-full.svg`,\n logoCollapsed: `./assets/logo.svg`,\n };\n searchToggleStatus = false;\n showSettingDrawer = !environment.production;\n get user(): User {\n return this.settings.user;\n }\n\n constructor(private settings: SettingsService) {}\n}
\u901a\u8fc7 LayoutDefaultService
\u670d\u52a1\u53ef\u4ee5\u5728\u8fd0\u884c\u65f6\u52a8\u6001\u7ba1\u7406\u5e03\u5c40\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u5728\u5e03\u5c40\u7684\u64cd\u4f5c\u90fd\u53ef\u4ee5\u901a\u8fc7 SettingsService.notify
\u6765\u8ba2\u9605\u5e03\u5c40\u7684\u53d8\u5316\uff08\u4f8b\u5982\uff1a\u4fa7\u8fb9\u680f\u7684\u5c55\u5f00\u4e0e\u6536\u7f29\u7b49\uff09\uff0c\u6ce8\u610f\u6240\u6709\u5e03\u5c40\u76f8\u5173\u7684\u53d8\u5316\u90fd\u4f1a\u901a\u8fc7\u8fd9\u4e2a\u63a5\u53e3\uff0c\u6240\u4ee5\u9700\u8981\u505a\u597d filter
\u64cd\u4f5c\u3002
\u6210\u5458 | \u8bf4\u660e | \u7c7b\u578b | \u9ed8\u8ba4\u503c |
---|---|---|---|
[options] | \u9009\u9879 | LayoutDefaultOptions | - |
[asideUser] | \u4fa7\u8fb9\u7528\u6237\u4fe1\u606f | TemplateRef<void> | - |
[asideBottom] | \u4fa7\u8fb9\u5e95\u90e8\u4fe1\u606f | TemplateRef<void> | - |
[nav] | \u5bfc\u822a\u4fe1\u606f | TemplateRef<void> | - |
[content] | \u5185\u5bb9\u4fe1\u606f | TemplateRef<void> | - |
[customError] | \u81ea\u5b9a\u4e49\u5f02\u5e38\u8def\u7531\u9519\u8bef\u6d88\u606f\uff0c\u5f53 null \u65f6\u8868\u793a\u4e0d\u663e\u793a\u9519\u8bef\u6d88\u606f | string, null | Could not load ${evt.url} route |
[fetchingStrictly] | \u662f\u5426\u5b8c\u5168\u53d7\u63a7\u9876\u90e8\u52a0\u8f7d\u52a8\u753b\u72b6\u6001 | boolean | false |
[fetching] | \u9876\u90e8\u52a0\u8f7d\u52a8\u753b\u72b6\u6001 | boolean | false |
\u6210\u5458 | \u8bf4\u660e | \u7c7b\u578b | \u9ed8\u8ba4\u503c |
---|---|---|---|
[logo] | \u81ea\u5b9a\u4e49 Logo \u533a\u57df | TemplateRef<void> | - |
[logoExpanded] | \u5c55\u5f00\u65f6 Logo \u5730\u5740 | string | ./assets/logo-full.svg |
[logoCollapsed] | \u6536\u7f29\u65f6 Logo \u5730\u5740 | string | ./assets/logo.svg |
[logoFixWidth] | \u6307\u5b9a\u56fa\u5b9a Logo \u5bbd\u5ea6 | number | - |
[logoLink] | \u6307\u5b9a Logo \u8def\u7531\u5730\u5740 | string | / |
[hideAside] | \u9690\u85cf\u4fa7\u8fb9\u680f\uff0c\u540c\u65f6\u4e0d\u663e\u6536\u7f29\u56fe\u6807\u6309\u94ae | boolean | false |
[hideHeader] | \u9690\u85cf\u9876\u680f | boolean | false |
[showHeaderCollapse] | \u662f\u5426\u5728\u9876\u680f\u663e\u793a\u83dc\u5355\u6298\u53e0\u6309\u94ae | boolean | true |
[showSiderCollapse] | \u662f\u5426\u5728\u4fa7\u8fb9\u680f\u5e95\u90e8\u663e\u793a\u83dc\u5355\u6298\u53e0\u6309\u94ae | boolean | false |
\u6210\u5458 | \u8bf4\u660e | \u7c7b\u578b | \u9ed8\u8ba4\u503c |
---|---|---|---|
[disabledAcl] | acl \u6821\u9a8c\u5931\u8d25\u65f6\u4ee5 disabled \u72b6\u6001\u663e\u793a | boolean | false |
[autoCloseUnderPad] | \u5c0f\u4e8ePad\u5bbd\u5ea6\u65f6\u8def\u7531\u5207\u6362\u540e\u81ea\u52a8\u5173\u95ed\u4fa7\u8fb9\u680f | boolean | true |
[recursivePath] | \u81ea\u52a8\u5411\u4e0a\u9012\u5f52\u67e5\u627e\uff0c\u83dc\u5355\u6570\u636e\u6e90\u5305\u542b /ware \uff0c\u5219 /ware/1 \u4e5f\u89c6\u4e3a /ware \u9879 | boolean | true |
[openStrictly] | \u5c55\u5f00\u5b8c\u5168\u53d7\u63a7\uff0c\u4e0d\u518d\u81ea\u52a8\u5173\u95ed\u5df2\u5c55\u5f00\u7684\u9879 | boolean | false |
[maxLevelIcon] | Icon\u6700\u591a\u663e\u793a\u5230\u7b2c\u51e0\u5c42 | number | 3 |
(select) | \u70b9\u51fb\u83dc\u5355\u65f6\u56de\u8c03\uff08\u5305\u542b disabled \uff09 | EventEmitter<Menu> | - |
\u7ec4\u4ef6\u7684\u6570\u636e\u6765\u81ea
MenuService
\uff08\u5176\u7ed3\u6784\u4e3a Menu\uff09\uff0cMenuService
\u7684\u64cd\u4f5c\u4f1a\u81ea\u52a8\u540c\u6b65\u81f3\u8be5\u7ec4\u4ef6\u3002
\u6210\u5458 | \u8bf4\u660e | \u7c7b\u578b | \u9ed8\u8ba4\u503c |
---|---|---|---|
[hidden] | \u9690\u85cf\u884c\u4e3a | pc, mobile, none | nones |
[direction] | \u65b9\u5411 | left, middle, right | right |
\u5934\u90e8\u9879\u7684\u89e6\u53d1\u6837\u5f0f\u3002
\u5934\u90e8\u4e1a\u52a1\u83dc\u5355\u9879\uff0c\u4f7f\u7528\u65b9\u5f0f\u8bf7\u53c2\u8003 layout.component.ts(\u9884\u89c8)\u3002
\u6309\u4e0a-\u5de6-\u53f3\u5e03\u5c40\u65b9\u5f0f\uff0c\u8fd0\u7528\u4e8e\u4e1a\u52a1\u9875\u7684\u5f00\u53d1\u3002\u5176\u89c4\u8303\u7ec6\u8282\uff1a
\u9876\u90e8\u533a\u57df\u9ad8\u5ea6 64px
\uff08\u53c2\u6570\uff1a@header-hg
\uff09
\u4fa7\u8fb9\u533a\u57df\u5bbd\u5ea6 200px
\uff08\u53c2\u6570\uff1a@aside-wd
\uff09
\u5f53\u5c4f\u5e55\u4f4e\u4e8e 1140px
\u5bbd\u65f6\u9690\u85cf\u4fa7\u8fb9\u5bfc\u822a
\u5f53\u5c4f\u5e55\u4f4e\u4e8e 1140px
\u5bbd\u65f6\u6253\u5f00\u4fa7\u8fb9\u5bfc\u822a\u4e3a fixed
\u72b6\u6001
\u4e3b\u8981\u5305\u62ec\u4e00\u4e2a layout-default-nav \u7ec4\u4ef6
\u53c2\u6570\u662f\u6307\u53ef\u4ee5\u901a\u8fc7
src/styles/theme.less
\u6587\u4ef6\u6309\u9700\u8981\u8c03\u6574\u3002
\u9876\u90e8\u533a\u57df
\u4f4d\u7f6e\uff1asrc/app/layout/base/widgets\u3002
\u811a\u624b\u67b6\u9ed8\u8ba4\u63d0\u4f9b\u4e86\u4e00\u4e9b\u5e38\u89c4\u9876\u90e8\u533a\u57df\u7ec4\u4ef6\uff0c\u8fd9\u4e9b\u7ec4\u4ef6\u90fd\u5b58\u653e\u4e8e components \u76ee\u5f55\u4e2d\u3002\u540c\u65f6 @delon/abc
\u4e5f\u63d0\u4f9b\u82e5\u5e72\u9876\u90e8\u7ec4\u4ef6\uff08\u4f8b\u5982\uff1anotice-icon \u901a\u77e5\u83dc\u5355\u7ec4\u4ef6\uff09\u3002\u4f60\u53ef\u4ee5\u6839\u636e\u63d0\u4f9b\u7684\u7ec4\u4ef6\u81ea\u884c\u7ec4\u5408\u6216\u81ea\u884c\u5f00\u53d1\u3002
\u811a\u624b\u67b6\u652f\u6301\u54cd\u5e94\u5f0f\u5e03\u5c40\uff0c\u5bf9\u4e8e\u9876\u90e8\u533a\u57df\u53ef\u80fd\u4f1a\u662f\u5728\u5c0f\u5c4f\u5e55\u4e0b\u9700\u8981\u9690\u85cf\u4e00\u4e9b\u7ec4\u4ef6\uff0c\u56e0\u6b64\u4f60\u53ef\u4ee5\u5728\u5bf9\u5e94\u7684DOM\u8282\u70b9\u4e0a\u52a0\u4e0a
hidden-xs
\u8868\u793a\u5f53\u5c4f\u5e55\u5c0f\u4e8e768px
\u65f6\u81ea\u52a8\u9690\u85cf\u3002
\u4fa7\u8fb9\u533a\u57df
\u4f4d\u7f6e\uff1asrc/app/layout/default/sidebar\u3002
\u53ea\u5305\u62ec\u4e00\u4e2a\u7528\u6237\u4fe1\u606f\u548c\u4e3b\u83dc\u5355\u3002\u4e3b\u83dc\u5355\u662f\u4e00\u4e2a layout-default-nav\u3002
\u5185\u90e8\u533a\u57df
\u5185\u5bb9\u533a\u57df\u662f\u4e1a\u52a1\u9875\u533a\u57df\uff0c\u89c4\u8303\u7ec6\u8282\uff1a
\u5185\u5bb9\u8ddd\u79bb\u9875\u9762\u6807\u51c6\u3001\u4fa7\u8fb9\u3001\u53f3\u8fb9\u6eda\u52a8\u6761\u3001\u5e95\u90e8\uff0c\u8fd9\u56db\u8fb9\u8ddd\u4f9d\u4e00\u4e2a\u6807\u51c6Dashboard\u7684Gutter\u5bbd\u5ea6 24px
\u3002
\u540d\u79f0 | \u9ed8\u8ba4\u503c | \u529f\u80fd |
---|---|---|
@alain-default-prefix | .alain-default | \u5e03\u5c40\u6837\u5f0f\u524d\u7f00 |
@alain-default-ease | cubic-bezier(.25, 0, .15, 1) | \u52a8\u753b\u8fc7\u6ee4\u51fd\u6570 |
@alain-default-header-hg | 64px | \u9876\u90e8\u9ad8\u5ea6 |
@alain-default-header-bg | @primary-color | \u9876\u90e8\u80cc\u666f\u8272 |
@alain-default-header-padding | @layout-gutter * 2 | \u9876\u90e8\u5de6\u53f3\u5185\u8fb9\u8ddd |
@alain-default-header-search-enabled | true | \u662f\u5426\u5f00\u542f\u9876\u90e8\u641c\u7d22\u6846 |
@alain-default-header-icon-fs | 18px | \u9876\u90e8 Icon \u5927\u5c0f |
@alain-default-header-logo-max-height | 36px | Logo \u56fe\u6700\u9ad8\u9ad8\u5ea6 |
@alain-default-aside-wd | 200px | \u4fa7\u8fb9\u680f\u5bbd\u5ea6 |
@alain-default-aside-bg | #fff | \u4fa7\u8fb9\u680f\u80cc\u666f\u8272 |
@alain-default-aside-scrollbar-width | 0 | \u4fa7\u8fb9\u680f\u6eda\u52a8\u6761\u5bbd\u5ea6 |
@alain-default-aside-scrollbar-height | 0 | \u4fa7\u8fb9\u680f\u6eda\u52a8\u6761\u9ad8\u5ea6 |
@alain-default-aside-scrollbar-track-color | transparent | \u4fa7\u8fb9\u680f\u6eda\u52a8\u6761\u7684\u8f68\u9053\u989c\u8272 |
@alain-default-aside-scrollbar-thumb-color | transparent | \u4fa7\u8fb9\u680f\u6eda\u52a8\u6761\u5c0f\u65b9\u5757\u989c\u8272 |
@alain-default-aside-nav-fs | 14px | \u4fa7\u8fb9\u680f\u83dc\u5355\u5b57\u53f7 |
@alain-default-aside-nav-icon-width | 14px | \u4fa7\u8fb9\u680f\u83dc\u5355 ICON \u5bbd\u5ea6 |
@alain-default-aside-nav-img-wh | 14px | \u4fa7\u8fb9\u680f\u83dc\u5355\u56fe\u50cf\u5bbd\u9ad8 |
@alain-default-aside-nav-padding-top-bottom | @layout-gutter | \u4fa7\u8fb9\u680f\u83dc\u5355\u9879\u4e0a\u4e0b\u5185\u8fb9\u8ddd |
@alain-default-aside-nav-padding-left-right | @layout-gutter * 2 | \u4fa7\u8fb9\u680f\u83dc\u5355\u9879\u5de6\u53f3\u5185\u8fb9\u8ddd |
@alain-default-aside-nav-text-color | rgba(0, 0, 0, 0.65) | \u4fa7\u8fb9\u680f\u83dc\u5355\u6587\u672c\u989c\u8272 |
@alain-default-aside-nav-text-hover-color | #108ee9 | \u4fa7\u8fb9\u680f\u83dc\u5355\u6587\u672c\u60ac\u505c\u989c\u8272 |
@alain-default-aside-nav-group-text-color | rgba(0, 0, 0, 0.43) | \u4fa7\u8fb9\u680f\u83dc\u5355\u5206\u7ec4\u6587\u672c\u989c\u8272 |
@alain-default-aside-nav-selected-text-color | #108ee9 | \u4fa7\u8fb9\u680f\u83dc\u5355\u6fc0\u6d3b\u65f6\u6587\u672c\u989c\u8272 |
@alain-default-aside-nav-selected-bg | #fcfcfc | \u4fa7\u8fb9\u680f\u83dc\u5355\u6fc0\u6d3b\u65f6\u80cc\u666f\u989c\u8272 |
@alain-default-aside-collapsed-wd | @layout-gutter * 8 | \u4fa7\u8fb9\u680f\u6536\u7f29\u540e\u5bbd\u5ea6 |
@alain-default-aside-collapsed-nav-fs | 24px | \u4fa7\u8fb9\u680f\u6536\u7f29\u540e\u6587\u672c\u5b57\u53f7 |
@alain-default-aside-collapsed-nav-img-wh | 24px | \u4fa7\u8fb9\u680f\u6536\u7f29\u540e\u56fe\u50cf\u5bbd\u9ad8 |
@alain-default-content-heading-bg | #fafbfc | \u5185\u5bb9\u533a\u57df\u6807\u9898\u80cc\u666f\u8272 |
@alain-default-content-heading-border | #efe3e5 | \u5185\u5bb9\u533a\u57df\u6807\u9898\u5e95\u90e8\u8fb9\u6846\u8272 |
@alain-default-content-padding | @layout-gutter * 3 | \u5185\u5bb9\u533a\u57df\u5185\u8fb9\u8ddd |
@alain-default-content-bg | #f5f7fa | \u5185\u5bb9\u533a\u57df\u80cc\u666f\u8272 |
@alain-default-widget-app-icons-enabled | true | \u662f\u5426 app-icon \u5c0f\u90e8\u4ef6\u6837\u5f0f |
@alain-default-aside-user-enabled | true | \u662f\u5426\u4fa7\u8fb9\u680f\u7528\u6237\u4fe1\u606f\u6837\u5f0f |
\u5feb\u6377\u83dc\u5355\u751f\u6210\u89c4\u5219\u7edf\u4e00\u5728 0
\u7d22\u5f15\u4e0b\u67e5\u627e\uff0c\u5e76\u6309\u4ee5\u4e0b\u987a\u5e8f\u6765\u83b7\u53d6\uff1a
\u3010\u63a8\u8350\u3011 children \u5b58\u5728 shortcutRoot: true
\u5219\u6700\u4f18\u5148
\u5426\u5219\u67e5\u627e\u5e26\u6709\u3010dashboard\u3011\u5b57\u6837\u94fe\u63a5\uff0c\u82e5\u5b58\u5728\u5219\u5728\u6b64\u83dc\u5355\u7684\u4e0b\u65b9\u521b\u5efa\u5feb\u6377\u5165\u53e3
\u5426\u5219\u653e\u57280\u8282\u70b9\u4f4d\u7f6e
\u56e0\u6b64\uff0c\u5efa\u8bae\u5728\u83dc\u5355\u6570\u636e\u7684 0
\u7d22\u5f15\u4e0b\u4fdd\u6301\u4e00\u4e2a\u6709\u6548\u7684 shortcutRoot: true
\u6570\u636e\u3002
\u9690\u85cf\u4e3b\u83dc\u5355\u9879
\u8868\u793a\u6c38\u8fdc\u4e0d\u663e\u793a\u83dc\u5355\uff0c\u53ef\u4ee5\u5728\u83dc\u5355\u8bbe\u7f6e hide: true
\u3002
\u9690\u85cf\u81ea\u52a8\u751f\u6210\u5bfc\u822a\u9690\u85cf\u9762\u5305\u5c51
\u8868\u793a\u4e0d\u663e\u793a\u8be5\u8282\u70b9\uff0c\u53ef\u4ee5\u5728\u83dc\u5355\u8bbe\u7f6e hideInBreadcrumb: true
\u3002
\u5173\u4e8e\u5c42\u7ea7
\u867d\u7136\u652f\u6301\u65e0\u9650\u5c42\u7ea7\uff0c\u4f46\u4e3a\u4e86\u7528\u6237\u4f53\u9a8c\u8bf7\u4fdd\u6301\u6700\u591a\u4e0d\u8d85\u8fc7\u56db\u5c42\uff08\u542b\u7ec4\u522b\uff09\u3002
\u5982\u4f55\u66f4\u65b0\u67d0\u4e2a\u83dc\u5355\u9879
\u5f53\u8c03\u7528 MenuService.setItem(key, newValue)
\u65f6\u4f1a\u81ea\u52a8\u91cd\u65b0\u6e32\u67d3\u4e3b\u83dc\u5355\uff0c\u5176\u4e2d key
\u5fc5\u987b\u662f\u5b58\u5728\u503c\uff0c\u8bf7\u53c2\u8003 Menu \u7684\u5b9a\u4e49\u3002
\u5982\u4f55\u63a7\u5236\u83dc\u5355\u5c55\u5f00
\u5229\u7528 LayoutDefaultService.toggleCollapsed()
\u6765\u8fd0\u884c\u65f6\u624b\u52a8\u63a7\u5236\u3002
Used for any top and side areas, typically for highly customizable pages such as large screen data. The blank layout all parameters are prefixed with @alain-blank-
.
Import in src/styles.less
:
@import \'@delon/theme/layout-blank/style/index\';
Name | Default | Description | ||||
---|---|---|---|---|---|---|
@prefix | .alain-blank | Style name prefix | ||||
@bg | #f5f7fa | Background color | ||||
@content-padding-vertical | 0 | Vertical padding | ||||
@content-padding-horizontal | 16px | Horizontal padding |
\u540d\u79f0 | \u9ed8\u8ba4\u503c | \u529f\u80fd | ||||
---|---|---|---|---|---|---|
@prefix | .alain-blank | \u5e03\u5c40\u6837\u5f0f\u524d\u7f00 | ||||
@bg | #f5f7fa | \u80cc\u666f\u8272 | ||||
@content-padding-vertical | 0 | \u5782\u76f4\u5185\u8fb9\u8ddd | ||||
@content-padding-horizontal | 16px | \u6c34\u5e73\u5185\u8fb9\u8ddd |
Property | Description | Type | Default |
---|---|---|---|
[types] | Type of theme list | ThemeBtnType[] | [ { key: 'default', text: 'Default Theme' }, { key: 'dark', text: 'Dark Theme' }, { key: 'compact', text: 'Compact Theme' }, ] |
[devTips] | Tips in development | String | When the dark.css file can't be found, you need to run it once: npm run theme |
[deployUrl] | URL where files will be deployed. Generally needed when using ng b --deploy-url | String | - |
(themeChange) | Theme Change Notification | EventEmitter<string> | - |
\u7528\u4e8e\u5728\u8fd0\u884c\u8fc7\u7a0b\u4e2d\u5207\u6362\u5b9a\u5236\u6837\u5f0f\u6587\u4ef6\uff0c\u4ece\u800c\u8d77\u5230\u6362\u5728\u7ebf\u6362\u80a4\u529f\u80fd\u3002
\u6210\u5458 | \u8bf4\u660e | \u7c7b\u578b | \u9ed8\u8ba4\u503c |
---|---|---|---|
[types] | \u7c7b\u578b\u5217\u8868 | ThemeBtnType[] | [ { key: 'default', text: 'Default Theme' }, { key: 'dark', text: 'Dark Theme' }, { key: 'compact', text: 'Compact Theme' }, ] |
[devTips] | \u5f00\u53d1\u63d0\u793a | String | When the dark.css file can't be found, you need to run it once: npm run theme |
[deployUrl] | \u6587\u4ef6\u5c06\u90e8\u7f72\u5230\u7684 URL\uff0c\u4e00\u822c\u5230\u4f7f\u7528 ng b --deploy-url \u65f6\u9700\u8981 | String | - |
(themeChange) | \u4e3b\u9898\u53d8\u66f4\u901a\u77e5 | EventEmitter<string> | - |
Optional pre-loading module loading, when it's necessary to load the resource at the first page load for some lazy routes. For example, by default, the order
module must first access the /order
route before it will actually start download resource files. When using PreloadOptionalModules
and specifying preload: true
, it will automatically download resource files after the Angular project is started.
@NgModule({\n providers: [PreloadOptionalModules],\n imports: [\n RouterModule.forRoot([\n {\n path: 'order',\n loadChildren: () => import('./order/order.module').then(m => m.OrderModule),\n data: { preload: true }\n },\n ], { \n preloadingStrategy: PreloadOptionalModules\n })]\n})",meta:{order:1,title:"PreloadOptionalModules",type:"Router"},toc:[]},"zh-CN":{content:"\u53ef\u9009\u9884\u52a0\u8f7d\u6a21\u5757\uff0c\u5f53\u9700\u8981\u5bf9\u67d0\u4e9b\u61d2\u52a0\u8f7d\u5728\u7b2c\u4e00\u6b21\u9875\u9762\u52a0\u8f7d\u65f6\u4e5f\u4e00\u5e76\u52a0\u8f7d\u8be5\u8d44\u6e90\u65f6\u3002\u4f8b\u5982 order
\u6a21\u5757\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5fc5\u987b\u7b2c\u4e00\u6b21\u8bbf\u95ee /order
\u8def\u7531\u65f6\u624d\u4f1a\u771f\u6b63\u7684\u5f00\u59cb\u4e0b\u8f7d\u8d44\u6e90\u6587\u4ef6\uff0c\u5f53\u901a\u8fc7\u4f7f\u7528 PreloadOptionalModules
\u5e76\u6307\u5b9a preload: true
\u65f6\uff0c\u4f1a\u5728 Angular \u9879\u76ee\u542f\u52a8\u540e\u81ea\u52a8\u4e0b\u8f7d\u8d44\u6e90\u6587\u4ef6\u3002
@NgModule({\n providers: [PreloadOptionalModules],\n imports: [\n RouterModule.forRoot([\n {\n path: 'order',\n loadChildren: () => import('./order/order.module').then(m => m.OrderModule),\n data: { preload: true }\n },\n ], { \n preloadingStrategy: PreloadOptionalModules\n })]\n})",meta:{order:1,title:"PreloadOptionalModules",type:"Router"},toc:[]}},demo:!1},this.codes=[]}}return(t=a).\u0275fac=function(e){return new(e||t)},t.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-index"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(e,o){1&e&&d._UZ(0,"app-docs",0),2&e&&d.Q6J("codes",o.codes)("item",o.item)},dependencies:[r.P],styles:["[_nghost-%COMP%]{display:block}"]}),a})(),D=(()=>{var t;class a{constructor(){this.item={cols:1,urls:{"en-US":"packages/theme/src/pipes/date/index.en-US.md","zh-CN":"packages/theme/src/pipes/date/index.zh-CN.md"},content:{"en-US":{content:'Based on date-fns date formatting, see more details date-fns (China mirror: moment format)
date-fns supports different kinds of time formats, such as:
2018-08-24 18:08:20
2018-08-24
20180824
1503571962333
{{data.registered | _date: \'YYYY\u5e74MM\u6708DD\u65e5\'}}</code></pre><p>Output:</p><pre class="hljs language-null"><code>2017\u5e7408\u670824\u65e5',meta:{order:1,title:"_date",subtitle:"Date",type:"Pipe"},toc:[]},"zh-CN":{content:'\u57fa\u4e8e date-fns \u65e5\u671f\u683c\u5f0f\u5316\uff0c\u663e\u793a\u66f4\u591a\u7ec6\u8282\u53c2\u8003 date-fns\uff08\u56fd\u5185\u955c\u50cf\uff1amoment format\uff09
\u6700\u5927\u597d\u5904\u662f date-fns \u652f\u6301\u4e0d\u540c\u79cd\u7c7b\u7684\u65f6\u95f4\u683c\u5f0f\uff0c\u4f8b\u5982\uff1a
2018-08-24 18:08:20
2018-08-24
20180824
1503571962333
\u7b49\u7b49\u3002
{{data.registered | _date: \'YYYY\u5e74MM\u6708DD\u65e5\'}}</code></pre><p>\u8f93\u51fa\uff1a</p><pre class="hljs language-null"><code>2017\u5e7408\u670824\u65e5',meta:{order:1,title:"_date",subtitle:"\u65e5\u671f",type:"Pipe"},toc:[]}},demo:!1},this.codes=[]}}return(t=a).\u0275fac=function(e){return new(e||t)},t.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-date"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(e,o){1&e&&d._UZ(0,"app-docs",0),2&e&&d.Q6J("codes",o.codes)("item",o.item)},dependencies:[r.P],styles:["[_nghost-%COMP%]{display:block}"]}),a})(),O=(()=>{var t;class a{constructor(){this.item={cols:1,urls:{"en-US":"packages/theme/src/pipes/keys/index.en-US.md","zh-CN":"packages/theme/src/pipes/keys/index.zh-CN.md"},content:{"en-US":{content:'Transforms Object or Map into an array of key value pairs.
Data:
const data = { name: \'cipchk\', address: { city: \'shanghai\', district: \'changning\' } };
Use:
<div *ngFor="let item of data | keys">{{item.key}} {{item.value | json}}</div>
Dictionary
const data = { 1: \'Normal\', 2: \'Deleted\' };
If you want to keep the key name number
numeric:
<div *ngFor="let item of data | keys: true">{{item.key}} {{item.value | json}}
Angular 6.1.0
will support natively KeyValuePipe.
',meta:{order:1,title:"keys",subtitle:"Keys",type:"Pipe"},toc:[]},"zh-CN":{content:'keys
\u5c06\u5bf9\u8c61\u6570\u7ec4\u5316\u3002
\u4f8b\u5982\uff1a
const data = { name: \'cipchk\', address: { city: \'shanghai\', district: \'changning\' } };
\u53d8\u6210\u53ef\u8fed\u4ee3\u5bf9\u8c61\uff1a
<div *ngFor="let item of data | keys">{{item.key}} {{item.value | json}}</div>
\u5b57\u5178\u53ef\u8fed\u4ee3
const data = { 1: \'\u6b63\u5e38\', 2: \'\u5220\u9664\' };
\u82e5\u5e0c\u671b\u4fdd\u6301\u952e\u540d\u4e3a number
\u6570\u5b57\u578b\uff1a
<div *ngFor="let item of data | keys: true">{{item.key}} {{item.value | json}}
Angular 6.1.0
\u4ee5\u540e\u539f\u751f\u652f\u6301 KeyValuePipe\uff0c\u7528\u6cd5\u6709\u70b9\u7c7b\u4f3c\u3002
',meta:{order:1,title:"keys",subtitle:"\u53ef\u8fed\u4ee3\u5bf9\u8c61",type:"Pipe"},toc:[]}},demo:!1},this.codes=[]}}return(t=a).\u0275fac=function(e){return new(e||t)},t.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-keys"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(e,o){1&e&&d._UZ(0,"app-docs",0),2&e&&d.Q6J("codes",o.codes)("item",o.item)},dependencies:[r.P],styles:["[_nghost-%COMP%]{display:block}"]}),a})(),M=(()=>{var t;class a{constructor(){this.item={cols:1,urls:{"en-US":"packages/theme/src/pipes/safe/index.en-US.md","zh-CN":"packages/theme/src/pipes/safe/index.zh-CN.md"},content:{"en-US":{content:'html
Simplify the use of bypassSecurityTrustHtml
.
<div [innerHTML]="content | html"></div>
url
Simplify the use of bypassSecurityTrustUrl
.
<a [href]="file_url | url" target="_blank"></a>',meta:{order:1,title:"safe",subtitle:"XSS",type:"Pipe"},toc:[{id:"html",title:"html",h:2},{id:"url",title:"url",h:2}]},"zh-CN":{content:'html
\u7b80\u5316 bypassSecurityTrustHtml
\u7684\u4f7f\u7528\u3002
<div [innerHTML]="content | html"></div>
url
\u7b80\u5316 bypassSecurityTrustUrl
\u7684\u4f7f\u7528\u3002
<a [href]="file_url | url" target="_blank"></a>',meta:{order:1,title:"safe",subtitle:"\u5b89\u5168HTML\u7b49",type:"Pipe"},toc:[{id:"html",title:"html",h:2},{id:"url",title:"url",h:2}]}},demo:!1},this.codes=[]}}return(t=a).\u0275fac=function(e){return new(e||t)},t.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-safe"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(e,o){1&e&&d._UZ(0,"app-docs",0),2&e&&d.Q6J("codes",o.codes)("item",o.item)},dependencies:[r.P],styles:["[_nghost-%COMP%]{display:block}"]}),a})(),P=(()=>{var t;class a{constructor(){this.item={cols:1,urls:{"en-US":"packages/theme/src/pipes/yn/index.en-US.md","zh-CN":"packages/theme/src/pipes/yn/index.zh-CN.md"},content:{"en-US":{content:'yn
Make boolean as badge.
<td [innerHTML]="enabled | yn"></td>\nOutput:\n<td><i class="text-blue"><svg viewBox="64 64 896 896" fill="currentColor" width="1em" height="1em" aria-hidden="true"><path d="M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 0 0-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"></path></svg></i></td>',meta:{order:1,title:"yn",subtitle:"Badge",type:"Pipe"},toc:[]},"zh-CN":{content:'yn
\u5c06boolean\u7c7b\u578b\u5fbd\u7ae0\u5316\u3002
<td [innerHTML]="enabled | yn"></td>\nOutput:\n<td><i class="text-blue"><svg viewBox="64 64 896 896" fill="currentColor" width="1em" height="1em" aria-hidden="true"><path d="M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 0 0-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"></path></svg></i></td>',meta:{order:1,title:"yn",subtitle:"\u5fbd\u7ae0",type:"Pipe"},toc:[]}},demo:!1},this.codes=[]}}return(t=a).\u0275fac=function(e){return new(e||t)},t.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-yn"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(e,o){1&e&&d._UZ(0,"app-docs",0),2&e&&d.Q6J("codes",o.codes)("item",o.item)},dependencies:[r.P],styles:["[_nghost-%COMP%]{display:block}"]}),a})();var l=n(10095),N=n(27358),L=n(24205),s=n(980),h=n(43460),p=n(42840),m=n(70855),u=n(41958);let U=(()=>{var t;class a{constructor(e,o){this.modalHelper=e,this.msg=o}open(){this.modalHelper.create("View",L.o,{record:{a:1,b:"2",c:new Date}}).subscribe(e=>{this.msg.info(e)})}static(){this.modalHelper.static("View",L.o,{record:{a:1,b:"2",c:new Date}}).subscribe(e=>{this.msg.info(e)})}}return(t=a).\u0275fac=function(e){return new(e||t)(d.Y36(s.hC),d.Y36(h.dD))},t.\u0275cmp=d.Xpm({type:t,selectors:[["theme-drawer-simple"]],decls:4,vars:0,consts:[["nz-button","",3,"click"]],template:function(e,o){1&e&&(d.TgZ(0,"button",0),d.NdJ("click",function(){return o.open()}),d._uU(1,"Open"),d.qZA(),d.TgZ(2,"button",0),d.NdJ("click",function(){return o.static()}),d._uU(3,"Static"),d.qZA())},dependencies:[p.ix,m.w,u.dQ],encapsulation:2}),a})(),R=(()=>{var t;class a{constructor(){this.item={cols:1,urls:{"en-US":"packages/theme/src/services/drawer/index.en-US.md","zh-CN":"packages/theme/src/services/drawer/index.zh-CN.md"},content:{"en-US":{content:'Based on the NzDrawerService
package, it solves some known issues:
More friendly handling callbacks
Support responsive
create
this.drawerHelper.create(\'Edit\', FormEditComponent, { i }).subscribe(res => this.load());\n// Ok callback\n// 1. considered successful\nthis.NzDrawerRef.close(data);\nthis.NzDrawerRef.close(true);\n\n// Close\nthis.NzDrawerRef.close();\nthis.NzDrawerRef.close(false);\n\n// Close all open drawers\nthis.DrawerHelper.closeAll();
There are includes create
& static
methods to open the normal & static drawer.
Custom component HTML template
Your body content\n<div class="drawer-footer">\n // The bottom toolbar need wrapped by `drawer-footer`\n <button nz-button [nzType]="\'default\'" (click)="cancel()">\n Cancel\n </button>\n <button nz-button [nzType]="\'primary\'" (click)="ok()">\n OK\n </button>\n</div>
If you don\'t bottom toolbar, you need specify footer: false
.
',api:'API
Property Description Type Default size
Specify drawer size, responsive only supports non-numeric values sm,md,lg,xl,number
md
footer
Whether toolbar boolean
true
footerHeight
Toolbar height number
55
exact
Exact match return value, default is true
, If the return value is not null (null
or undefined
) is considered successful, otherwise it is considered error. boolean
true
drawerOptions
Drawer raw parameters NzDrawerOptions \u53c2\u6570 NzDrawerOptions
-
Method
closeAll
Close all open drawers
',meta:{order:3,title:"DrawerHelper",subtitle:"Drawer Helper",type:"Service"},toc:[{id:"create",title:"create",h:2},{id:"API",title:"API",h:2,children:[{id:"Method",title:"Method",h:3}]}]},"zh-CN":{content:'\u57fa\u4e8e NzDrawerService
\u5c01\u88c5\uff0c\u5b83\u89e3\u51b3\u4e00\u4e9b\u5df2\u77e5\u95ee\u9898\uff1a
\u66f4\u53cb\u597d\u7684\u5904\u7406\u56de\u8c03
\u54cd\u5e94\u5f0f\u5904\u7406
create
this.drawerHelper.create(\'Edit\', FormEditComponent, { i }).subscribe(res => this.load());\n// \u5bf9\u4e8e\u7ec4\u4ef6\u7684\u6210\u529f&\u5173\u95ed\u7684\u5904\u7406\u8bf4\u660e\n// \u6210\u529f\nthis.NzDrawerRef.close(data);\nthis.NzDrawerRef.close(true);\n// \u5173\u95ed\nthis.NzDrawerRef.close();\nthis.NzDrawerRef.close(false);\n\n// \u5173\u95ed\u6240\u6709\u5df2\u6253\u5f00\u7684\u62bd\u5c49\nthis.DrawerHelper.closeAll();
\u5305\u62ec create
& static
\u5206\u522b\u7528\u4e8e\u6253\u5f00\u666e\u901a\u6216\u9759\u6001\u62bd\u5c49\u3002
\u81ea\u5b9a\u4e49\u7ec4\u4ef6HTML\u6a21\u677f
\u5185\u5bb9\n<div class="drawer-footer">\n // \u5e95\u90e8\u5de5\u5177\u6761\u7531 `drawer-footer` \u5305\u88f9\n <button nz-button [nzType]="\'default\'" (click)="cancel()">\n Cancel\n </button>\n <button nz-button [nzType]="\'primary\'" (click)="ok()">\n OK\n </button>\n</div>
\u82e5\u65e0\u9700\u8981\u5e95\u90e8\u5de5\u5177\u6761\uff0c\u9700\u8981\u6307\u5b9a\u53c2\u6570 footer: false
\u3002
',api:'API
\u540d\u79f0 \u7c7b\u578b \u9ed8\u8ba4\u503c \u529f\u80fd size
\u6307\u5b9a\u62bd\u5c49\u5927\u5c0f\uff0c\u54cd\u5e94\u5f0f\u53ea\u652f\u6301\u975e\u6570\u5b57\u503c\uff0c\u82e5\u503c\u4e3a\u6570\u503c\u7c7b\u578b\uff0c\u5219\u6839\u636e nzPlacement
\u81ea\u52a8\u8f6c\u5316\u4e3a nzHeight
\u6216 nzWidth
sm,md,lg,xl,number
md
footer
\u662f\u5426\u9700\u8981\u5de5\u5177\u6761 boolean
true
footerHeight
\u5de5\u5177\u6761\u9ad8\u5ea6 number
55
exact
\u662f\u5426\u7cbe\u51c6\uff08\u9ed8\u8ba4\uff1atrue
\uff09\uff0c\u82e5\u8fd4\u56de\u503c\u975e\u7a7a\u503c\uff08null
\u6216undefined
\uff09\u89c6\u4e3a\u6210\u529f\uff0c\u5426\u5219\u89c6\u4e3a\u9519\u8bef boolean
true
drawerOptions
\u62bd\u5c49 NzDrawerOptions \u53c2\u6570 NzDrawerOptions
-
Method
closeAll
\u5173\u95ed\u6240\u6709\u5df2\u6253\u5f00\u7684\u62bd\u5c49
',meta:{order:3,title:"DrawerHelper",subtitle:"\u62bd\u5c49\u8f85\u52a9\u7c7b",type:"Service"},toc:[{id:"create",title:"create",h:2},{id:"API",title:"API",h:2,children:[{id:"Method",title:"Method",h:3}]}]}},demo:!0},this.codes=[{id:"theme-drawer-simple",meta:{title:{"zh-CN":"\u57fa\u7840\u6837\u4f8b","en-US":"Basic Usage"},order:0},summary:{"zh-CN":"\u6700\u7b80\u5355\u7684\u7528\u6cd5\u3002
","en-US":"Simplest of usage.
"},code:"import { Component } from '@angular/core';\nimport { DrawerHelper } from '@delon/theme';\nimport { DemoDrawerComponent } from '@shared';\nimport { NzMessageService } from 'ng-zorro-antd/message';\n\n@Component({\n selector: 'theme-drawer-simple',\n template: `\n \n \n `,\n})\nexport class ThemeDrawerSimpleComponent {\n constructor(private modalHelper: DrawerHelper, private msg: NzMessageService) {}\n\n open(): void {\n this.modalHelper.create('View', DemoDrawerComponent, { record: { a: 1, b: '2', c: new Date() } }).subscribe(res => {\n this.msg.info(res);\n });\n }\n\n static(): void {\n this.modalHelper.static('View', DemoDrawerComponent, { record: { a: 1, b: '2', c: new Date() } }).subscribe(res => {\n this.msg.info(res);\n });\n }\n}",name:"simple",urls:"packages/theme/src/services/drawer/demo/simple.md",type:"demo",lang:"ts",componentName:"ThemeDrawerSimpleComponent",point:0}]}}return(t=a).\u0275fac=function(e){return new(e||t)},t.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-drawer"]],decls:5,vars:5,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","24"],[3,"item"]],template:function(e,o){1&e&&(d.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),d._UZ(4,"theme-drawer-simple"),d.qZA()()()()),2&e&&(d.Q6J("codes",o.codes)("item",o.item),d.xp6(1),d.Q6J("nzGutter",16),d.xp6(2),d.Q6J("item",o.codes[0]),d.uIk("id",o.codes[0].id))},dependencies:[l.t3,l.SK,r.P,N.e,U],styles:["[_nghost-%COMP%]{display:block}"]}),a})(),I=(()=>{var t;class a{constructor(){this.item={cols:1,urls:{"en-US":"packages/theme/src/services/http/index.en-US.md","zh-CN":"packages/theme/src/services/http/index.zh-CN.md"},content:{"en-US":{content:'_HttpClient service is based on Angular HttpClient
.
Features
More friendly call methods
Maintain loading
attribute
Handling null values
Unified time format is timestamp
Support decorator @GET, @POST etc
DEMO
Network requests are generally used with Object as arguments, such as a get
request:
HttpClient.get(url, { params: { pi: 1 } });
For _HttpClient
:
_HttpClient.get(url, { pi: 1 });
AlainThemeConfig
Common configuration, such as unifying null and time processing for _HttpClient
.
import { AlainThemeConfig } from \'@delon/theme\';\nexport function fnAlainThemeConfig(): AlainThemeConfig {\n return Object.assign(new AlainThemeConfig(), {\n http: {\n nullValueHandling: \'ignore\',\n },\n });\n}\n\n@NgModule({})\nexport class DelonModule {\n static forRoot(): ModuleWithProviders {\n return {\n ngModule: DelonModule,\n providers: [\n { provide: AlainThemeConfig, useFactory: fnAlainThemeConfig },\n ],\n };\n }\n}
API
Property Description Type Default nullValueHandling
Null processing include,ignore
include
dateValueHandling
Time processing timestamp,ignore
timestamp
Decorators
The target service must inherit BaseApi
abstract class.
Usage
@BaseUrl(\'/user\')\n@BaseHeaders({ bh: \'a\' })\nclass RestService extends BaseApi {\n @GET()\n query(@Query(\'pi\') pi: number, @Query(\'ps\') ps: number): Observable {\n return;\n }\n\n @GET(\':id\')\n get(@Path(\'id\') id: number): Observable {\n return;\n }\n\n @GET()\n get(@Payload data: {}): Observable {\n return;\n }\n\n // Use `::id` to indicate escaping, and should be will be ignored when `id` value is `undefined`, like this:\n\xa0\xa0// When `id` is `10` => 10:type\n\xa0\xa0// When `id` is `undefined` => :id:type\n @GET(\':id::type\')\n get(@Path(\'id\') id: number): Observable {\n return;\n }\n\n @POST(\':id\')\n save(@Path(\'id\') id: number, @Body data: Object): Observable {\n return;\n }\n\n @POST()\n save(@Payload data: {}): Observable {\n return;\n }\n\n @FORM()\n save(@Payload data: {}): Observable {\n return;\n }\n \n // If authorization is invalid, will be thrown directly `401` error and will not be sent.\n @GET(\'\', { acl: \'admin\' })\n ACL(): Observable {\n return;\n }\n}
Class decorators
@BaseUrl(url: string)
@BaseHeaders(headers: HttpHeaders | { [header: string]: string | string[] })
Method decorators
@GET(url: string = \'\', options?: HttpOptions)
@POST(url: string = \'\', options?: HttpOptions)
@DELETE(url: string = \'\', options?: HttpOptions)
@PUT(url: string = \'\', options?: HttpOptions)
@HEAD(url: string = \'\', options?: HttpOptions)
@PATCH(url: string = \'\', options?: HttpOptions)
@JSONP(url: string = \'\', options?: HttpOptions)
@OPTIONS(url: string = \'\', options?: HttpOptions)
HttpOptions
Property Description Type Default acl
ACL config, depends on @delon/acl
any
- observe
Specify response content body,events,response
- responseType
Specify content format arraybuffer,blob,json,text
- reportProgress
Whether monitor progress events boolean
- withCredentials
Set withCredentials boolean
-
Parameter decorators
@Path(key?: string)
URL path parameters
@Query(key?: string)
QueryString of URL
@Body
Body of URL
@Headers(key?: string)
Headers of URL
@Payload
Request Payload
Supported body (likePOST
, PUT
) as a body data, equivalent to @Body
Not supported body (like GET
, DELETE
etc) as a QueryString
CUSTOM_ERROR
Whether to customize the handling of exception messages.
this.http.post(`login`, {\n name: \'cipchk\', pwd: \'123456\'\n}, {\n context: new HttpContext()\n .set(ALLOW_ANONYMOUS, true)\n .set(CUSTOM_ERROR, true)\n}).subscribe({\n next: console.log,\n error: console.log\n});
IGNORE_BASE_URL
Whether to ignore API prefixes.
// When environment.api.baseUrl set \'/api\'\n\nthis.http.get(`/path`) // Request Url: /api/path\nthis.http.get(`/path`, { context: new HttpContext().set(IGNORE_BASE_URL, true) }) // Request Url: /path
RAW_BODY
Whether to return raw response
',meta:{order:1,title:"_HttpClient",type:"Service"},toc:[{id:"Features",title:"Features",h:2},{id:"DEMO",title:"DEMO",h:2},{id:"AlainThemeConfig",title:"AlainThemeConfig",h:2,children:[{id:"API",title:"API",h:3}]},{id:"Decorators",title:"Decorators",h:2,children:[{id:"Usage",title:"Usage",h:3},{id:"Classdecorators",title:"Class decorators",h:3},{id:"Methoddecorators",title:"Method decorators",h:3},{id:"Parameterdecorators",title:"Parameter decorators",h:3},{id:"CUSTOM_ERROR",title:"CUSTOM_ERROR",h:3},{id:"IGNORE_BASE_URL",title:"IGNORE_BASE_URL",h:3},{id:"RAW_BODY",title:"RAW_BODY",h:3}]}]},"zh-CN":{content:'@delon/theme
\u5305\u542b\u4e86\u4e00\u4e2a\u53eb _HttpClient \u7c7b\uff0c\u5176\u672c\u8d28\u8fd8\u662f\u8c03\u7528 Angular \u7684 HttpClient
\u3002
\u7279\u6027
\u66f4\u53cb\u597d\u7684\u8c03\u7528\u65b9\u6cd5
\u7ef4\u62a4 loading
\u5c5e\u6027
\u5904\u7406\u7a7a\u503c
\u7edf\u4e00\u65f6\u95f4\u683c\u5f0f\u4e3a\u65f6\u95f4\u6233
\u652f\u6301\u4fee\u9970\u5668 @GET\u3001@POST \u7b49
\u793a\u4f8b
\u7f51\u7edc\u8bf7\u6c42\u4e00\u822c\u60c5\u51b5\u4e0b\u662f\u540c Object \u5bf9\u8c61\u505a\u4e3a\u53c2\u6570\u4e00\u8d77\u4f7f\u7528\uff0c\u4f8b\u5982\u4e00\u4e2a get
\u8bf7\u6c42\uff0c\u539f\u59cb\u5199\u6cd5\uff1a
HttpClient.get(url, { params: { pi: 1 } });
\u800c\u5bf9\u4e8e _HttpClient
\u6765\u8bb2\uff0c\u5c06\u53c2\u6570\u8fdb\u4e00\u6b65\u4f18\u5316\u4e3a\uff1a
_HttpClient.get(url, { pi: 1 });
AlainThemeConfig
\u901a\u7528\u914d\u7f6e\u9879\uff0c\u4f8b\u5982\u7edf\u4e00\u5bf9 _HttpClient
\u8bbe\u7f6e\u7a7a\u503c\u3001\u65f6\u95f4\u5904\u7406\u65b9\u5f0f\u3002
import { AlainThemeConfig } from \'@delon/theme\';\nexport function fnAlainThemeConfig(): AlainThemeConfig {\n return Object.assign(new AlainThemeConfig(), {\n http: {\n nullValueHandling: \'ignore\',\n },\n });\n}\n\n@NgModule({})\nexport class DelonModule {\n static forRoot(): ModuleWithProviders {\n return {\n ngModule: DelonModule,\n providers: [\n { provide: AlainThemeConfig, useFactory: fnAlainThemeConfig },\n ],\n };\n }\n}
API
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c nullValueHandling
\u7a7a\u503c\u5904\u7406 include,ignore
include
dateValueHandling
\u65f6\u95f4\u503c\u5904\u7406 timestamp,ignore
timestamp
\u4f7f\u7528\u4fee\u9970\u5668
\u76ee\u6807\u7c7b\u90fd\u5fc5\u987b\u7ee7\u627f BaseApi
\u57fa\u7c7b\u3002
\u793a\u4f8b
@BaseUrl(\'/user\')\n@BaseHeaders({ bh: \'a\' })\nclass RestService extends BaseApi {\n @GET()\n query(@Query(\'pi\') pi: number, @Query(\'ps\') ps: number): Observable {\n return;\n }\n\n @GET(\':id\')\n get(@Path(\'id\') id: number): Observable {\n return;\n }\n\n @GET()\n get(@Payload data: {}): Observable {\n return;\n }\n\n // \u4f7f\u7528 `::id` \u6765\u8868\u793a\u8f6c\u4e49\uff0c\u82e5 `id` \u503c\u4e3a `undefined` \u4f1a\u5ffd\u7565\u8f6c\u6362\uff0c\u4f8b\u5982\uff1a\n // \u5f53 `id` \u4e3a `10` \u65f6 => 10:type\n // \u5f53 `id` \u4e3a `undefined` \u65f6 => :id:type\n @GET(\':id::type\')\n get(@Path(\'id\') id: number): Observable {\n return;\n }\n\n @POST(\':id\')\n save(@Path(\'id\') id: number, @Body data: Object): Observable {\n return;\n }\n\n @POST()\n save(@Payload data: {}): Observable {\n return;\n }\n\n @FORM()\n save(@Payload data: {}): Observable {\n return;\n }\n \n // \u82e5\u8bf7\u6c42\u7684URL\u4e0d\u7b26\u5408\u6388\u6743\u8981\u6c42\uff0c\u4f1a\u76f4\u63a5\u629b\u51fa `401` \u9519\u8bef\uff0c\u4e14\u4e0d\u53d1\u9001\u8bf7\u6c42\n @GET(\'\', { acl: \'admin\' })\n ACL(): Observable {\n return;\n }\n}
\u7c7b
@BaseUrl(url: string)
@BaseHeaders(headers: HttpHeaders | { [header: string]: string | string[] })
\u65b9\u6cd5
@GET(url: string = \'\', options?: HttpOptions)
@POST(url: string = \'\', options?: HttpOptions)
@DELETE(url: string = \'\', options?: HttpOptions)
@PUT(url: string = \'\', options?: HttpOptions)
@HEAD(url: string = \'\', options?: HttpOptions)
@PATCH(url: string = \'\', options?: HttpOptions)
@JSONP(url: string = \'\', options?: HttpOptions)
@OPTIONS(url: string = \'\', options?: HttpOptions)
HttpOptions
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c acl
ACL \u914d\u7f6e\uff0c\u82e5\u5bfc\u5165 @delon/acl
\u65f6\u81ea\u52a8\u6709\u6548\uff0c\u7b49\u540c\u4e8e ACLService.can(roleOrAbility: ACLCanType)
\u53c2\u6570\u503c any
- observe
\u6307\u5b9a\u54cd\u5e94\u5185\u5bb9 body,events,response
- responseType
\u6307\u5b9a\u5185\u5bb9\u683c\u5f0f arraybuffer,blob,json,text
- reportProgress
\u662f\u5426\u76d1\u542c\u8fdb\u5ea6\u4e8b\u4ef6 boolean
- withCredentials
\u8bbe\u7f6e withCredentials boolean
-
\u53c2\u6570
@Path(key?: string)
URL \u8def\u7531\u53c2\u6570
@Query(key?: string)
URL \u53c2\u6570 QueryString
@Body
\u53c2\u6570 Body
@Headers(key?: string)
\u53c2\u6570 Headers
@Payload
\u8bf7\u6c42\u8d1f\u8f7d
\u5f53\u652f\u6301 Body \u65f6\uff08\u4f8b\u5982\uff1aPOST
\u3001PUT
\uff09\u4e3a\u5185\u5bb9\u4f53\u7b49\u540c @Body
\u5f53\u4e0d\u652f\u6301 Body \u65f6\uff08\u4f8b\u5982\uff1aGET
\u3001DELETE
\u7b49\uff09\u4e3a QueryString
HttpContext
CUSTOM_ERROR
\u662f\u5426\u81ea\u5b9a\u4e49\u5904\u7406\u5f02\u5e38\u6d88\u606f\u3002
this.http.post(`login`, {\n name: \'cipchk\', pwd: \'123456\'\n}, {\n context: new HttpContext()\n .set(ALLOW_ANONYMOUS, true)\n .set(CUSTOM_ERROR, true)\n}).subscribe({\n next: console.log,\n error: console.log\n});
IGNORE_BASE_URL
\u662f\u5426\u5ffd\u7565API\u524d\u7f00\u3002
// When environment.api.baseUrl set \'/api\'\n\nthis.http.get(`/path`) // Request Url: /api/path\nthis.http.get(`/path`, { context: new HttpContext().set(IGNORE_BASE_URL, true) }) // Request Url: /path
RAW_BODY
\u662f\u5426\u539f\u6837\u8fd4\u56de\u8bf7\u6c42
',meta:{order:1,title:"_HttpClient",type:"Service"},toc:[{id:"\u7279\u6027",title:"\u7279\u6027",h:2},{id:"\u793a\u4f8b",title:"\u793a\u4f8b",h:2},{id:"AlainThemeConfig",title:"AlainThemeConfig",h:2,children:[{id:"API",title:"API",h:3}]},{id:"\u4f7f\u7528\u4fee\u9970\u5668",title:"\u4f7f\u7528\u4fee\u9970\u5668",h:2,children:[{id:"\u793a\u4f8b",title:"\u793a\u4f8b",h:3},{id:"\u7c7b",title:"\u7c7b",h:3},{id:"\u65b9\u6cd5",title:"\u65b9\u6cd5",h:3},{id:"\u53c2\u6570",title:"\u53c2\u6570",h:3}]},{id:"HttpContext",title:"HttpContext",h:2,children:[{id:"CUSTOM_ERROR",title:"CUSTOM_ERROR",h:3},{id:"IGNORE_BASE_URL",title:"IGNORE_BASE_URL",h:3},{id:"RAW_BODY",title:"RAW_BODY",h:3}]}]}},demo:!1},this.codes=[]}}return(t=a).\u0275fac=function(e){return new(e||t)},t.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-http"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(e,o){1&e&&d._UZ(0,"app-docs",0),2&e&&d.Q6J("codes",o.codes)("item",o.item)},dependencies:[r.P],styles:["[_nghost-%COMP%]{display:block}"]}),a})(),j=(()=>{var t;class a{constructor(){this.item={cols:1,urls:{"en-US":"packages/theme/src/services/menu/index.en-US.md","zh-CN":"packages/theme/src/services/menu/index.zh-CN.md"},content:{"en-US":{content:'The data format is an array of Menu, where text
text property muse be required, And it\'s not affected by external components (such as sidebar-nav),
This is because menus it\'s essential part of the applications, And it can be used more effectively as a service, such as: dynamically generate navigation, title etc.
Suggest: Start up Angular (startup.service.ts) After get menu data from remote, call the add()
method.
',api:'API
MenuService
Method Description add
Setting menu data clear
Clear menu data resume
Reset menu, may need call when I18N, user acl changed find
Find a menu item by url
or key
getItem
Get menu item based on key
getPathByUrl
Get menu list based on url setItem
Set menu item open
Open of the menu toggleOpen
Toggle menu open or close openAll
Toggle all menu open or close
recursive
Recursive upward find, for example, the menu data source contains /ware
, then /ware/1
is equivalent to /ware
.
Menu
Property Description Type Default text
Text of menu item, can be choose one of text
or i18n
(Support HTML) string
- i18n
I18n key of menu item, can be choose one of text
or i18n
(Support HTML) string
- group
Whether to display the group name boolean
true
link
Routing for the menu item, can be choose one of link
or externalLink
string
- externalLink
External link for the menu item, can be choose one of link
or externalLink
string
- target
Specifies externalLink
where to display the linked URL _blank,_self,_parent,_top
- icon
Icon for the menu item, only valid for the first level menu string | MenuIcon
- badge
Badget for the menu item when group
is true
number
- badgeDot
Whether to display a red dot instead of badge
value boolean
- badgeStatus
Badge color success,processing,default,error,warning
error
open
Whether open for the menu item boolean
false
disabled
Whether disable for the menu item boolean
false
hide
Whether hidden for the menu item boolean
false
hideInBreadcrumb
Whether hide in breadcrumbs, which are valid when the page-header
component automatically generates breadcrumbs boolean
- acl
ACL configuration, it\'s equivalent to ACLService.can(roleOrAbility: ACLCanType)
parameter value any
- shortcut
Whether shortcut menu item boolean
- shortcutRoot
Wheter shortcut menu root node boolean
- reuse
Whether to allow reuse, need to cooperate with the reuse-tab
component boolean
- open
Whether to expand, when checkStrictly
is valid in sidebar-nav
component boolean
- key
Unique identifier of the menu item, can be used in getItem
, setItem
to update a menu string
- children
Children for the menu item Menu[]
-
MenuIcon
Property Description Type Default [type]
Type for icon; img
, svg
Size uses 14px
width and height class,icon,iconfont,img,svg
icon
[value]
Value for the icon, can be set Class Name, nz-icon of nzType
, image string
- [theme]
Type of the ant design icon outline,twotone,fill
outline
[spin]
Rotate icon with animation boolean
false
[twoToneColor]
Only support the two-tone icon. Specific the primary color string
- [iconfont]
Type of the icon from iconfont string
- [rotate]
Rotate degrees number
-
',meta:{order:2,title:"MenuService",subtitle:"Menu Service",type:"Service"},toc:[{id:"API",title:"API",h:2,children:[{id:"MenuService",title:"MenuService",h:3},{id:"Menu",title:"Menu",h:3},{id:"MenuIcon",title:"MenuIcon",h:3}]}]},"zh-CN":{content:'\u83dc\u5355\u670d\u52a1\u7684\u6570\u636e\u683c\u5f0f\u662f\u4e00\u4e2a Menu \u6570\u7ec4\uff0c\u5176\u4e2d text
\u5c5e\u6027\u8868\u793a\u83dc\u5355\u6587\u672c\u4e3a\u5fc5\u586b\u9879\uff0c\u800c\u4e14\u672c\u8eab\u5e76\u4e0d\u53d7\u5916\u90e8\u7ec4\u4ef6\u7684\u5f71\u54cd\uff08\u4f8b\u5982sidebar-nav\u7ec4\u4ef6\uff09\uff0c\u8fd9\u662f\u56e0\u4e3a\u83dc\u5355\u662f\u8d2f\u7a7f\u6574\u4e2a\u9879\u76ee\u5fc5\u4e0d\u53ef\u5c11\u7684\u7ec4\u6210\u90e8\u5206\uff0c\u800c\u5c06\u5176\u72ec\u7acb\u6210\u4e00\u4e2a\u670d\u52a1\u53ef\u4ee5\u66f4\u6709\u6548\u88ab\u4f7f\u7528\uff0c\u4f8b\u5982\uff1a\u52a8\u6001\u751f\u6210\u5bfc\u822a\u3001\u6807\u9898\u7b49\u3002
\u5efa\u8bae\uff1a \u5728 Angular \u542f\u52a8\u670d\u52a1\uff08startup.service.ts\uff09\u4ece\u8fdc\u7a0b\u83b7\u53d6\u5230\u83dc\u5355\u6570\u636e\u540e\uff0c\u8c03\u7528 add()
\u65b9\u6cd5\u3002
',api:'API
MenuService
\u65b9\u6cd5 \u63cf\u8ff0 add
\u8bbe\u7f6e\u83dc\u5355\u6570\u636e clear
\u6e05\u7a7a\u83dc\u5355\u6570\u636e resume
\u91cd\u7f6e\u83dc\u5355\uff0c\u53ef\u80fdI18N\u3001\u7528\u6237\u6743\u9650\u53d8\u52a8\u65f6\u9700\u8981\u8c03\u7528\u5237\u65b0 find
\u5229\u7528 url
\u6216 key
\u67e5\u627e\u83dc\u5355 getItem
\u6839\u636e key
\u83b7\u53d6\u83dc\u5355 getPathByUrl
\u6839\u636eurl\u83b7\u53d6\u83dc\u5355\u5217\u8868 setItem
\u8bbe\u7f6e\u83dc\u5355\u503c open
\u5c55\u5f00\u67d0\u83dc\u5355 toggleOpen
\u5207\u6362\u83dc\u5355\u7684\u5c55\u5f00\u6216\u5173\u95ed openAll
\u5c55\u5f00\u6216\u5173\u95ed\u6240\u6709\u83dc\u5355
recursive
\u8868\u793a\u81ea\u52a8\u5411\u4e0a\u9012\u5f52\u67e5\u627e\uff0c\u4f8b\u5982\u83dc\u5355\u6570\u636e\u6e90\u5305\u542b /ware
\uff0c\u5219 /ware/1
\u4e5f\u89c6\u4e3a /ware
\u9879\u3002
Menu
\u6210\u5458 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c text
\u6587\u672c\uff08\u652f\u6301HTML\uff09\uff0c\u5fc5\u586b\u9879 string
- i18n
i18n\u4e3b\u952e\uff08\u652f\u6301HTML\uff09 string
- group
\u662f\u5426\u663e\u793a\u5206\u7ec4\u540d\uff0c\u6307\u793a\u4f8b\u4e2d\u7684\u3010\u4e3b\u5bfc\u822a\u3011\u5b57\u6837 boolean
true
link
\u8def\u7531\uff0clink
\u3001externalLink
\u4e8c\u9009\u5176\u4e00 string
- externalLink
\u5916\u90e8\u94fe\u63a5\uff0clink
\u3001externalLink
\u4e8c\u9009\u5176\u4e00 string
- target
\u94fe\u63a5 target _blank,_self,_parent,_top
- icon
\u56fe\u6807\uff0c\u6307\u793a\u4f8b\u4e2d\u7684\u3010\u4eea\u8868\u76d8\u3011\u524d\u56fe\u6807\uff0c\u53ea\u5bf9\u4e00\u7ea7\u83dc\u5355\u6709\u6548 string | MenuIcon
- badge
\u5fbd\u6807\u6570\uff0c\u5c55\u793a\u7684\u6570\u5b57\uff0c\u6307\u793a\u4f8b\u4e2d\u7684\u3010\u5c0f\u90e8\u4ef6\u3011\u540e\u7684\u7ea2\u8272\u5757\u3002\uff08\u6ce8\uff1agroup:true
\u65f6\u65e0\u6548\uff09 number
- badgeDot
\u5fbd\u6807\u6570\uff0c\u663e\u793a\u5c0f\u7ea2\u70b9 boolean
- badgeStatus
\u5fbd\u6807 Badge \u989c\u8272 success,processing,default,error,warning
error
open
\u662f\u5426\u6253\u5f00\u83dc\u5355 boolean
false
disabled
\u662f\u5426\u7981\u7528\u83dc\u5355 boolean
false
hide
\u662f\u5426\u9690\u85cf\u83dc\u5355 boolean
false
hideInBreadcrumb
\u9690\u85cf\u9762\u5305\u5c51\uff0c\u6307 page-header
\u7ec4\u4ef6\u7684\u81ea\u52a8\u751f\u6210\u9762\u5305\u5c51\u65f6\u6709\u6548 boolean
- acl
ACL\u914d\u7f6e\uff0c\u82e5\u5bfc\u5165 @delon/acl
\u65f6\u81ea\u52a8\u6709\u6548\uff0c\u7b49\u540c\u4e8e ACLService.can(roleOrAbility: ACLCanType)
\u53c2\u6570\u503c any
- shortcut
\u662f\u5426\u5feb\u6377\u83dc\u5355\u9879 boolean
- shortcutRoot
\u5feb\u6377\u83dc\u5355\u6839\u8282\u70b9 boolean
- reuse
\u662f\u5426\u5141\u8bb8\u590d\u7528\uff0c\u9700\u914d\u5408 reuse-tab
\u7ec4\u4ef6 boolean
- key
\u83dc\u5355\u9879\u552f\u4e00\u6807\u8bc6\u7b26\uff0c\u53ef\u7528\u4e8e getItem
\u3001setItem
\u6765\u66f4\u65b0\u67d0\u4e2a\u83dc\u5355 string
- children
\u5b50\u83dc\u5355 Menu[]
-
MenuIcon
\u6210\u5458 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [type]
\u7c7b\u578b\uff1bimg
, svg
\u7c7b\u578b\u9700\u8981 14px
\u5bbd\u4e0e\u9ad8\u5c3a\u5bf8 class,icon,iconfont,img,svg
icon
[value]
\u503c\uff0c\u5305\u542b\uff1a\u7c7b\u540d\u3001\u56fe\u6807 nzType
\u3001\u56fe\u50cf string
- [theme]
\u56fe\u6807\u4e3b\u9898\u98ce\u683c outline,twotone,fill
outline
[spin]
\u662f\u5426\u6709\u65cb\u8f6c\u52a8\u753b boolean
false
[twoToneColor]
\u4ec5\u9002\u7528\u53cc\u8272\u56fe\u6807\uff0c\u8bbe\u7f6e\u53cc\u8272\u56fe\u6807\u7684\u4e3b\u8981\u989c\u8272\uff0c\u4ec5\u5bf9\u5f53\u524d icon \u751f\u6548 string
- [iconfont]
\u6307\u5b9a\u6765\u81ea IconFont \u7684\u56fe\u6807\u7c7b\u578b string
- [rotate]
\u56fe\u6807\u65cb\u8f6c\u89d2\u5ea6 number
-
\u4f7f\u7528 iconfont
\u7c7b\u578b\u5fc5\u987b\u5148\u52a0\u8f7d NzIconService.fetchFromIconfont
\uff0c\u5efa\u8bae\u5728\u6839\u6a21\u5757\u4e2d\u6267\u884c\u3002
',meta:{order:2,title:"MenuService",subtitle:"\u83dc\u5355\u670d\u52a1",type:"Service"},toc:[{id:"API",title:"API",h:2,children:[{id:"MenuService",title:"MenuService",h:3},{id:"Menu",title:"Menu",h:3},{id:"MenuIcon",title:"MenuIcon",h:3}]}]}},demo:!1},this.codes=[]}}return(t=a).\u0275fac=function(e){return new(e||t)},t.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-menu"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(e,o){1&e&&d._UZ(0,"app-docs",0),2&e&&d.Q6J("codes",o.codes)("item",o.item)},dependencies:[r.P],styles:["[_nghost-%COMP%]{display:block}"]}),a})();var g=n(50662);let E=(()=>{var t;class a{constructor(e,o){this.modalHelper=e,this.msg=o}open(){this.modalHelper.create(g.X,{record:{a:1,b:"2",c:new Date}}).subscribe(e=>{this.msg.info(e)})}static(){this.modalHelper.createStatic(g.X,{record:{a:1,b:"2",c:new Date}}).subscribe(e=>{this.msg.info(e)})}}return(t=a).\u0275fac=function(e){return new(e||t)(d.Y36(s.Te),d.Y36(h.dD))},t.\u0275cmp=d.Xpm({type:t,selectors:[["theme-modal-simple"]],decls:4,vars:0,consts:[["nz-button","",3,"click"]],template:function(e,o){1&e&&(d.TgZ(0,"button",0),d.NdJ("click",function(){return o.open()}),d._uU(1,"Open"),d.qZA(),d.TgZ(2,"button",0),d.NdJ("click",function(){return o.static()}),d._uU(3,"Static"),d.qZA())},dependencies:[p.ix,m.w,u.dQ],encapsulation:2}),a})(),H=(()=>{var t;class a{constructor(e,o){this.modalHelper=e,this.msg=o}open(){this.modalHelper.create(g.X,{record:{a:1,b:"2",c:new Date}},{drag:!0}).subscribe(e=>{this.msg.info(e)})}}return(t=a).\u0275fac=function(e){return new(e||t)(d.Y36(s.Te),d.Y36(h.dD))},t.\u0275cmp=d.Xpm({type:t,selectors:[["theme-modal-drag"]],decls:2,vars:0,consts:[["nz-button","",3,"click"]],template:function(e,o){1&e&&(d.TgZ(0,"button",0),d.NdJ("click",function(){return o.open()}),d._uU(1,"Open"),d.qZA())},dependencies:[p.ix,m.w,u.dQ],encapsulation:2}),a})();const J=[{path:"",component:Y.S,children:[{path:"",redirectTo:"getting-started/zh",pathMatch:"full"},{path:"component-styles",redirectTo:"component-styles/zh",pathMatch:"full"},{path:"component-styles/:lang",component:f},{path:"customize-theme",redirectTo:"customize-theme/zh",pathMatch:"full"},{path:"customize-theme/:lang",component:y},{path:"getting-started",redirectTo:"getting-started/zh",pathMatch:"full"},{path:"getting-started/:lang",component:k},{path:"global",redirectTo:"global/zh",pathMatch:"full"},{path:"global/:lang",component:v},{path:"icon",redirectTo:"icon/zh",pathMatch:"full"},{path:"icon/:lang",component:x},{path:"locale",redirectTo:"locale/zh",pathMatch:"full"},{path:"locale/:lang",component:T},{path:"performance",redirectTo:"performance/zh",pathMatch:"full"},{path:"performance/:lang",component:S},{path:"tools",redirectTo:"tools/zh",pathMatch:"full"},{path:"tools/:lang",component:w},{path:"layout-default",redirectTo:"layout-default/zh",pathMatch:"full"},{path:"layout-default/:lang",component:C},{path:"layout-blank",redirectTo:"layout-blank/zh",pathMatch:"full"},{path:"layout-blank/:lang",component:z},{path:"theme-btn",redirectTo:"theme-btn/zh",pathMatch:"full"},{path:"theme-btn/:lang",component:_},{path:"index",redirectTo:"index/zh",pathMatch:"full"},{path:"index/:lang",component:A},{path:"date",redirectTo:"date/zh",pathMatch:"full"},{path:"date/:lang",component:D},{path:"keys",redirectTo:"keys/zh",pathMatch:"full"},{path:"keys/:lang",component:O},{path:"safe",redirectTo:"safe/zh",pathMatch:"full"},{path:"safe/:lang",component:M},{path:"yn",redirectTo:"yn/zh",pathMatch:"full"},{path:"yn/:lang",component:P},{path:"drawer",redirectTo:"drawer/zh",pathMatch:"full"},{path:"drawer/:lang",component:R},{path:"http",redirectTo:"http/zh",pathMatch:"full"},{path:"http/:lang",component:I},{path:"menu",redirectTo:"menu/zh",pathMatch:"full"},{path:"menu/:lang",component:j},{path:"modal",redirectTo:"modal/zh",pathMatch:"full"},{path:"modal/:lang",component:(()=>{var t;class a{constructor(){this.item={cols:1,urls:{"en-US":"packages/theme/src/services/modal/index.en-US.md","zh-CN":"packages/theme/src/services/modal/index.zh-CN.md"},content:{"en-US":{content:'Based on the NzModalService
package, it solves some known issues:
More friendly handling callbacks
Usage
this.modalHelper.create(FormEditComponent, { i }).subscribe(res => this.load());\n\n// Ok callback, Where `nzModalRef` refers to the variable name of the target component in the constructor `NzModalRef`\n// 1. considered successful\nthis.nzModalRef.close(true);\nthis.nzModalRef.close({ other: 1 });\n// 2. considered error\nthis.nzModalRef.close();\n\n// Close\nthis.nzModalRef.destroy();
There are includes create
& createStatic
methods to open the normal & static modal. Add a few parameters based on NzModalService
.
Custom component HTML template
<div class="modal-header">\n <div class="modal-title">Title</div>\n</div>\n\nYour body content\n\n<div class="modal-footer">\n <button nz-button [nzType]="\'default\'" (click)="cancel()">\n Cancel\n </button>\n <button nz-button [nzType]="\'primary\'" (click)="ok()">\n OK\n </button>\n</div>
API
Property Description Type Default size
Specify modal size sm,md,lg,xl,number,string
lg
exact
Exact match return value, default is true
, If the return value is not null (null
or undefined
) is considered successful, otherwise it is considered error. boolean
true
includeTabs
Whether to wrap the tab page boolean
false
drag
Drag boolean, ModalHelperDragOptions
- useNzData
Whether it is mandatory to use nzData
to pass parameters. If it is false
, it means that the parameters will be directly mapped to the component instance, and other values \u200b\u200bcan only be obtained through NZ_MODAL_DATA
. boolean
false
modalOptions
nz-modal raw parameters ModalOptions ModalOptions
- ',meta:{order:3,title:"ModalHelper",subtitle:"Modal Helper",type:"Service"},toc:[{id:"Usage",title:"Usage",h:2,children:[{id:"API",title:"API",h:3}]}]},"zh-CN":{content:'\u57fa\u4e8e NzModalService
\u5c01\u88c5\uff0c\u5b83\u89e3\u51b3\u4e00\u4e9b\u5df2\u77e5\u95ee\u9898\uff1a
\u66f4\u53cb\u597d\u7684\u5904\u7406\u56de\u8c03
\u7528\u6cd5
this.modalHelper.create(FormEditComponent, { i }).subscribe(res => this.load());\n\n// \u6210\u529f\u8303\u4f8b\uff0c\u5176\u4e2d `nzModalRef` \u6307\u76ee\u6807\u7ec4\u4ef6\u5728\u6784\u9020\u51fd\u6570 `NzModalRef` \u53d8\u91cf\u540d\n// 1. \u89c6\u4e3a\u6210\u529f\nthis.nzModalRef.close(true);\nthis.nzModalRef.close({ other: 1 });\n// 2. \u89c6\u4e3a\u5931\u8d25\nthis.nzModalRef.close();\n\n// \u5173\u95ed\uff1a\nthis.nzModalRef.destroy();
\u5305\u62ec\u4e24\u4e2a\u65b9\u6cd5\u4f53 create
& createStatic
\u5206\u522b\u6253\u5f00\u666e\u901a&\u9759\u6001\u5bf9\u8bdd\u6846\u3002\u5728 NzModalService
\u57fa\u7840\u4e0a\u65b0\u589e\u82e5\u5e72\u53c2\u6570\u3002
\u81ea\u5b9a\u4e49\u7ec4\u4ef6HTML\u6a21\u677f
<div class="modal-header">\n <div class="modal-title">Title</div>\n</div>\n\nYour body content\n\n<div class="modal-footer">\n <button nz-button [nzType]="\'default\'" (click)="cancel()">\n Cancel\n </button>\n <button nz-button [nzType]="\'primary\'" (click)="ok()">\n OK\n </button>\n</div>
API
\u540d\u79f0 \u7c7b\u578b \u9ed8\u8ba4\u503c \u63cf\u8ff0 size
\u6307\u5b9a\u5bf9\u8bdd\u6846\u5927\u5c0f sm,md,lg,xl,number,string
lg
exact
\u662f\u5426\u7cbe\u51c6\uff08\u9ed8\u8ba4\uff1atrue
\uff09\uff0c\u82e5\u8fd4\u56de\u503c\u975e\u7a7a\u503c\uff08null
\u6216undefined
\uff09\u89c6\u4e3a\u6210\u529f\uff0c\u5426\u5219\u89c6\u4e3a\u9519\u8bef boolean
true
includeTabs
\u662f\u5426\u5305\u88f9\u6807\u7b7e\u9875 boolean
false
drag
\u652f\u6301\u62d6\u52a8 boolean, ModalHelperDragOptions
- useNzData
\u662f\u5426\u5f3a\u5236\u4f7f\u7528 nzData
\u4f20\u9012\u53c2\u6570\uff0c\u82e5\u4e3a false
\u8868\u793a\u53c2\u6570\u4f1a\u76f4\u63a5\u6620\u5c04\u5230\u7ec4\u4ef6\u5b9e\u4f8b\u4e2d\uff0c\u5176\u4ed6\u503c\u53ea\u80fd\u901a\u8fc7 NZ_MODAL_DATA
\u7684\u65b9\u5f0f\u6765\u83b7\u53d6\u53c2\u6570 boolean
false
modalOptions
\u5bf9\u8bdd\u6846 ModalOptions \u53c2\u6570 ModalOptions
- ',meta:{order:3,title:"ModalHelper",subtitle:"\u5bf9\u8bdd\u6846\u8f85\u52a9\u7c7b",type:"Service"},toc:[{id:"\u7528\u6cd5",title:"\u7528\u6cd5",h:2,children:[{id:"API",title:"API",h:3}]}]}},demo:!0},this.codes=[{id:"theme-modal-simple",meta:{title:{"zh-CN":"\u57fa\u7840\u6837\u4f8b","en-US":"Basic Usage"},order:0},summary:{"zh-CN":"\u6700\u7b80\u5355\u7684\u7528\u6cd5\u3002
","en-US":"Simplest of usage.
"},code:"import { Component } from '@angular/core';\nimport { ModalHelper } from '@delon/theme';\nimport { DemoModalComponent } from '@shared';\nimport { NzMessageService } from 'ng-zorro-antd/message';\n\n@Component({\n selector: 'theme-modal-simple',\n template: `\n \n \n `,\n})\nexport class ThemeModalSimpleComponent {\n constructor(private modalHelper: ModalHelper, private msg: NzMessageService) {}\n\n open(): void {\n this.modalHelper.create(DemoModalComponent, { record: { a: 1, b: '2', c: new Date() } }).subscribe(res => {\n this.msg.info(res);\n });\n }\n\n static(): void {\n this.modalHelper.createStatic(DemoModalComponent, { record: { a: 1, b: '2', c: new Date() } }).subscribe(res => {\n this.msg.info(res);\n });\n }\n}",name:"simple",urls:"packages/theme/src/services/modal/demo/simple.md",type:"demo",lang:"ts",componentName:"ThemeModalSimpleComponent",point:0},{id:"theme-modal-drag",meta:{title:{"zh-CN":"\u62d6\u52a8","en-US":"Drag"},order:1},summary:{"zh-CN":"\u652f\u6301\u62d6\u52a8\u5bf9\u8bdd\u6846\u3002
","en-US":"Support for dragging dialogs.
"},code:"import { Component } from '@angular/core';\nimport { ModalHelper } from '@delon/theme';\nimport { DemoModalComponent } from '@shared';\nimport { NzMessageService } from 'ng-zorro-antd/message';\n\n@Component({\n selector: 'theme-modal-drag',\n template: `\n \n `,\n})\nexport class ThemeModalDragComponent {\n constructor(private modalHelper: ModalHelper, private msg: NzMessageService) {}\n\n open(): void {\n this.modalHelper.create(DemoModalComponent, { record: { a: 1, b: '2', c: new Date() } }, { drag: true }).subscribe(res => {\n this.msg.info(res);\n });\n }\n}",name:"drag",urls:"packages/theme/src/services/modal/demo/drag.md",type:"demo",lang:"ts",componentName:"ThemeModalDragComponent",point:1}]}}return(t=a).\u0275fac=function(e){return new(e||t)},t.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-modal"]],decls:7,vars:7,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","24"],[3,"item"]],template:function(e,o){1&e&&(d.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),d._UZ(4,"theme-modal-simple"),d.qZA(),d.TgZ(5,"code-box",3),d._UZ(6,"theme-modal-drag"),d.qZA()()()()),2&e&&(d.Q6J("codes",o.codes)("item",o.item),d.xp6(1),d.Q6J("nzGutter",16),d.xp6(2),d.Q6J("item",o.codes[0]),d.uIk("id",o.codes[0].id),d.xp6(2),d.Q6J("item",o.codes[1]),d.uIk("id",o.codes[1].id))},dependencies:[l.t3,l.SK,r.P,N.e,E,H],styles:["[_nghost-%COMP%]{display:block}"]}),a})()},{path:"responsive",redirectTo:"responsive/zh",pathMatch:"full"},{path:"responsive/:lang",component:(()=>{var t;class a{constructor(){this.item={cols:1,urls:{"en-US":"packages/theme/src/services/responsive/index.en-US.md","zh-CN":"packages/theme/src/services/responsive/index.zh-CN.md"},content:{"en-US":{content:'More friendly use responsive rules, the original xs
, sm
etc. reduced to col
property, the default response rule:
col
<576px
\u2265576px
\u2265768px
\u2265992px
\u22651200px
\u22651600px
1
1 1 1 1 1 1 2
1 2 2 2 2 2 3
1 2 3 3 3 3 4
1 2 3 4 4 4 5
1 2 3 4 6 6 6
1 2 3 4 6 12
In order to better develop responsives this view or edit pages, the rule will be used by default in sg
, sv
, se
components. You can via ResponsiveConfig
to override the default rules.
ResponsiveConfig
import { AlainThemeConfig } from \'@delon/theme\';\nexport function fnAlainThemeConfig(): AlainThemeConfig {\n return Object.assign(new AlainThemeConfig(), {\n responsive: {\n rules: {\n 1: { xs: 24 },\n 2: { xs: 24, sm: 12 },\n 3: { xs: 24, sm: 12, md: 8 },\n 4: { xs: 24, sm: 12, md: 8, lg: 6 },\n 5: { xs: 24, sm: 12, md: 8, lg: 6, xl: 4 },\n 6: { xs: 24, sm: 12, md: 8, lg: 6, xl: 4, xxl: 2 },\n }\n },\n });\n}\n\n@NgModule({})\nexport class DelonModule {\n static forRoot(): ModuleWithProviders {\n return {\n ngModule: DelonModule,\n providers: [\n { provide: AlainThemeConfig, useFactory: fnAlainThemeConfig },\n ],\n };\n }\n}',meta:{type:"Service",order:5,title:"ResponsiveService",subtitle:"Responsive Service"},toc:[{id:"ResponsiveConfig",title:"ResponsiveConfig",h:2}]},"zh-CN":{content:'\u66f4\u53cb\u597d\u7684\u4f7f\u7528\u54cd\u5e94\u5f0f\u89c4\u5219\uff0c\u5c06\u539f xs
\u3001sm
\u7b49\u5c5e\u6027\u7b80\u5316\u6210 col
\u680f\uff0c\u9ed8\u8ba4\u54cd\u5e94\u5f0f\u89c4\u5219\uff1a
col
<576px
\u2265576px
\u2265768px
\u2265992px
\u22651200px
\u22651600px
1
1 1 1 1 1 1 2
1 2 2 2 2 2 3
1 2 3 3 3 3 4
1 2 3 4 4 4 5
1 2 3 4 6 6 6
1 2 3 4 6 12
\u4e3a\u4e86\u66f4\u597d\u7684\u5f00\u53d1\u54cd\u5e94\u5f0f\u67e5\u770b\u3001\u7f16\u8f91\u9875\uff0c\u8fd9\u79cd\u89c4\u5219\u5c06\u9ed8\u8ba4\u5c06\u8fd0\u7528\u5728 sg
\u3001sv
\u3001se
\u7b49\u7ec4\u4ef6\u4e2d\u3002\u4f60\u4e5f\u53ef\u4ee5\u5229\u7528 ResponsiveConfig
\u6765\u6539\u5199\u9ed8\u8ba4\u89c4\u5219\u3002
ResponsiveConfig
\u901a\u7528\u914d\u7f6e\u9879\uff0c\u4f8b\u5982\u7edf\u4e00\u5bf9 ResponsiveService
\u8bbe\u7f6e\u54cd\u5e94\u5f0f\u89c4\u5219\u3002
import { AlainThemeConfig } from \'@delon/theme\';\nexport function fnAlainThemeConfig(): AlainThemeConfig {\n return Object.assign(new AlainThemeConfig(), {\n responsive: {\n rules: {\n 1: { xs: 24 },\n 2: { xs: 24, sm: 12 },\n 3: { xs: 24, sm: 12, md: 8 },\n 4: { xs: 24, sm: 12, md: 8, lg: 6 },\n 5: { xs: 24, sm: 12, md: 8, lg: 6, xl: 4 },\n 6: { xs: 24, sm: 12, md: 8, lg: 6, xl: 4, xxl: 2 },\n }\n },\n });\n}\n\n@NgModule({})\nexport class DelonModule {\n static forRoot(): ModuleWithProviders {\n return {\n ngModule: DelonModule,\n providers: [\n { provide: AlainThemeConfig, useFactory: fnAlainThemeConfig },\n ],\n };\n }\n}',meta:{type:"Service",order:5,title:"ResponsiveService",subtitle:"\u54cd\u5e94\u5f0f\u670d\u52a1"},toc:[{id:"ResponsiveConfig",title:"ResponsiveConfig",h:2}]}},demo:!1},this.codes=[]}}return(t=a).\u0275fac=function(e){return new(e||t)},t.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-responsive"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(e,o){1&e&&d._UZ(0,"app-docs",0),2&e&&d.Q6J("codes",o.codes)("item",o.item)},dependencies:[r.P],styles:["[_nghost-%COMP%]{display:block}"]}),a})()},{path:"rtl",redirectTo:"rtl/zh",pathMatch:"full"},{path:"rtl/:lang",component:(()=>{var t;class a{constructor(){this.item={cols:1,urls:{"en-US":"packages/theme/src/services/rtl/index.en-US.md","zh-CN":"packages/theme/src/services/rtl/index.zh-CN.md"},content:{"en-US":{content:'RTL service control.
',api:'API
Method Property Description dir
Direction
Get or Set the current text direction nextDir
Direction
Get the next text direction change
Observable<Direction>
Subscription change notification toggle()
- Toggle text direction
',meta:{type:"Service",order:6,title:"RTLService",subtitle:"RTL Service"},toc:[{id:"API",title:"API",h:2}]},"zh-CN":{content:'RTL\u670d\u52a1\u63a7\u5236\u3002
',api:'API
\u63a5\u53e3\u540d \u53c2\u6570 \u63cf\u8ff0 dir
Direction
\u83b7\u53d6\u6216\u8bbe\u7f6e\u5f53\u524d\u6587\u5b57\u65b9\u5411 nextDir
Direction
\u83b7\u53d6\u4e0b\u4e00\u6b21\u6587\u5b57\u65b9\u5411 change
Observable<Direction>
\u8ba2\u9605\u53d8\u66f4\u901a\u77e5 toggle()
- \u5207\u6362\u6587\u5b57\u65b9\u5411
',meta:{type:"Service",order:6,title:"RTLService",subtitle:"RTL\u670d\u52a1"},toc:[{id:"API",title:"API",h:2}]}},demo:!1},this.codes=[]}}return(t=a).\u0275fac=function(e){return new(e||t)},t.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-rtl"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(e,o){1&e&&d._UZ(0,"app-docs",0),2&e&&d.Q6J("codes",o.codes)("item",o.item)},dependencies:[r.P],styles:["[_nghost-%COMP%]{display:block}"]}),a})()},{path:"settings",redirectTo:"settings/zh",pathMatch:"full"},{path:"settings/:lang",component:(()=>{var t;class a{constructor(){this.item={cols:1,urls:{"en-US":"packages/theme/src/services/settings/index.en-US.md","zh-CN":"packages/theme/src/services/settings/index.zh-CN.md"},content:{"en-US":{content:'Project config data, includes App, Layout, User, three data types And store persistence in localStorage
(Please refer to #1737 to switch to sessionStorage
).
Suggest: Call the setApp()
, setUser()
methods to restore project config data, via Angular startup service (startup.service.ts).
',api:'API
SettingsService
Name Type Return Value Description layout
property
Layout
Data of layout app
property
App
Data of app user
property
User
Data of User notify
property
Observable<SettingsNotify>
Notify when layout, app, user information changes setLayout(name: string, value: any)
method
boolean
Set property value of layout setApp(value: App)
method
boolean
Set app data setUser(value: User)
method
boolean
Set user data
App
Property Description Type Default [name]
Name for app string
- [description]
Description for app string
-
User
Property Description Type Default [name]
Name for current user string
- [avatar]
Avatar for current user string
- [email]
Email for current user string
-
Layout
Property Description Type Default [collapsed]
Whether to fold menu boolean
- [lang]
Current language string
- [colorWeak]
Color weak boolean
false
FAQ
How to change the local storage key name?
Support add the configuration of ALAIN_SETTING_KEYS
via the global-config.module.ts
global configuration file, for example:
const alainProvides = [\n { provide: ALAIN_CONFIG, useValue: alainConfig },\n+ {\n+ provide: ALAIN_SETTING_KEYS,\n+ useValue: {\n+ layout: \'new-layout\',\n+ user: \'new-user\',\n+ app: \'new-app\',\n+ },\n+ },\n];
',meta:{order:1,title:"SettingsService",subtitle:"Project configuration",type:"Service"},toc:[{id:"API",title:"API",h:2,children:[{id:"SettingsService",title:"SettingsService",h:3},{id:"App",title:"App",h:3},{id:"User",title:"User",h:3},{id:"Layout",title:"Layout",h:3}]},{id:"FAQ",title:"FAQ",h:2}]},"zh-CN":{content:'\u9879\u76ee\u914d\u7f6e\u9879\uff0c\u5305\u542b\u5e94\u7528App\u3001\u5e03\u5c40Layout\u3001\u7528\u6237\u4fe1\u606fUser\u4e09\u79cd\u6570\u636e\u7c7b\u578b\uff0c\u5e76\u4e14\u5b58\u50a8\u6301\u4e45\u5316\u5728 localStorage
\uff08\u53c2\u8003#1737\u6765\u5207\u6362\u6210 sessionStorage
\uff09\u3002
\u5efa\u8bae\uff1a \u5728 Angular \u542f\u52a8\u670d\u52a1\uff08startup.service.ts\uff09\u4ece\u8fdc\u7a0b\u83b7\u53d6\u5230\u5e94\u7528\u3001\u7528\u6237\u6570\u636e\u540e\uff0c\u8c03\u7528 setApp()
\u3001setUser()
\u65b9\u6cd5\u3002
',api:'API
SettingsService
\u540d\u79f0 \u7c7b\u578b \u8fd4\u56de\u503c \u63cf\u8ff0 layout
property
Layout
\u5e03\u5c40\u4fe1\u606f app
property
App
\u9879\u76ee\u4fe1\u606f user
property
User
\u7528\u6237\u4fe1\u606f notify
property
Observable<SettingsNotify>
\u5f53\u5e03\u5c40\u3001\u9879\u76ee\u3001\u7528\u6237\u4fe1\u606f\u53d8\u66f4\u65f6\u901a\u77e5 setLayout(name: string, value: any)
method
boolean
\u8bbe\u7f6e\u5e03\u5c40\u5c5e\u6027\u503c setApp(value: App)
method
boolean
\u8bbe\u7f6e\u9879\u76ee\u4fe1\u606f setUser(value: User)
method
boolean
\u8bbe\u7f6e\u7528\u6237\u4fe1\u606f
App
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [name]
\u5e94\u7528\u540d\u79f0 string
- [description]
\u5e94\u7528\u63cf\u8ff0 string
-
User
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [name]
\u5f53\u524d\u7528\u6237\u540d\u79f0 string
- [avatar]
\u5f53\u524d\u7528\u6237\u5934\u50cf string
- [email]
\u5f53\u524d\u7528\u6237\u90ae\u7bb1 string
-
Layout
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [collapsed]
\u662f\u5426\u6298\u53e0\u83dc\u5355 boolean
- [lang]
\u5f53\u524d\u8bed\u8a00 string
- [colorWeak]
\u8272\u5f31\u6a21\u5f0f boolean
false
\u5e38\u89c1\u95ee\u9898
\u5982\u4f55\u66f4\u6539\u672c\u5730\u5b58\u50a8\u952e\u540d\uff1f
\u5141\u8bb8\u901a\u8fc7 global-config.module.ts
\u5168\u5c40\u914d\u7f6e\u6587\u4ef6\uff0c\b\u589e\u52a0 ALAIN_SETTING_KEYS
\u7684\u914d\u7f6e\uff0c\u4f8b\u5982\uff1a
const alainProvides = [\n { provide: ALAIN_CONFIG, useValue: alainConfig },\n+ {\n+ provide: ALAIN_SETTING_KEYS,\n+ useValue: {\n+ layout: \'new-layout\',\n+ user: \'new-user\',\n+ app: \'new-app\',\n+ },\n+ },\n];
',meta:{order:1,title:"SettingsService",subtitle:"\u9879\u76ee\u914d\u7f6e\u9879\u670d\u52a1",type:"Service"},toc:[{id:"API",title:"API",h:2,children:[{id:"SettingsService",title:"SettingsService",h:3},{id:"App",title:"App",h:3},{id:"User",title:"User",h:3},{id:"Layout",title:"Layout",h:3}]},{id:"\u5e38\u89c1\u95ee\u9898",title:"\u5e38\u89c1\u95ee\u9898",h:2}]}},demo:!1},this.codes=[]}}return(t=a).\u0275fac=function(e){return new(e||t)},t.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-settings"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(e,o){1&e&&d._UZ(0,"app-docs",0),2&e&&d.Q6J("codes",o.codes)("item",o.item)},dependencies:[r.P],styles:["[_nghost-%COMP%]{display:block}"]}),a})()},{path:"title",redirectTo:"title/zh",pathMatch:"full"},{path:"title/:lang",component:(()=>{var t;class a{constructor(){this.item={cols:1,urls:{"en-US":"packages/theme/src/services/title/index.en-US.md","zh-CN":"packages/theme/src/services/title/index.zh-CN.md"},content:{"en-US":{content:'Used to set page title, generally listen for route changed and refresh title, for example: app.component.ts; The default data from MenuService
.
Suggest: Set the prefix
or suffix
value via Angular startup service (startup.service.ts).
Orders
Get the title
value according to the following order:
Routing configuration `{ data: { title: \'page name\', titleI18n: \'page-name\' } }
Parse the menu data based on the current URL
Get h1
content in page alain-default__content-title
or page-header__title
Default title
',api:'API
Name Type Description default
property
Default title of document title selector
property
Set the default CSS selector string separator
property
Separator prefix
property
Prefix of document title suffix
property
Suffix of document title reverse
property
Whether to reverse setTitle(title?: string | string[])
method
Set the document title, will be delay 25ms
, pls refer to #1261 setTitleByI18n(key: string, params?: Object)
method
Set i18n key of the document title
',meta:{order:4,title:"TitleService",subtitle:"Title Service",type:"Service"},toc:[{id:"Orders",title:"Orders",h:2},{id:"API",title:"API",h:2}]},"zh-CN":{content:'\u7528\u4e8e\u8bbe\u7f6e\u9875\u9762\u6807\u9898\uff0c\u4e00\u822c\u76d1\u542c\u8def\u7531\u53d8\u5316\u5e76\u91cd\u65b0\u5237\u65b0\u6807\u9898\uff0c\u4f8b\u5982\uff1aapp.component.ts\uff1b\u540c\u65f6\u6807\u9898\u7684\u9ed8\u8ba4\u6570\u636e\u6765\u6e90\u4e8e MenuService
\u3002
\u5efa\u8bae\uff1a \u5728 Angular \u542f\u52a8\u670d\u52a1\uff08startup.service.ts\uff09\u8fc7\u7a0b\u4e2d\u8bbe\u7f6e prefix
\u6216 suffix
\u503c\u6765\u8c03\u6574\u7edf\u4e00\u7684\u6807\u9898\u524d\u540e\u7f00\u3002
\u83b7\u53d6\u987a\u5e8f
\u6839\u636e\u4ee5\u4e0b\u987a\u5e8f\u83b7\u53d6 title
\u503c\uff1a
\u8def\u7531\u914d\u7f6e { data: { title: \'page name\', titleI18n: \'page-name\' } as RouteTitle }
\u6839\u636e\u5f53\u524d URL \u89e3\u6790\u83dc\u5355\u6570\u636e
\u9875\u9762 alain-default__content-title
\u6216 page-header__title
\u4e2d\u83b7\u53d6 h1
\u5185\u5bb9
\u9ed8\u8ba4\u6807\u9898\u540d
',api:'API
\u540d\u79f0 \u7c7b\u578b \u63cf\u8ff0 default
property
\u8bbe\u7f6e\u9ed8\u8ba4\u6807\u9898\u540d selector
property
\u8bbe\u7f6e\u9ed8\u8ba4CSS\u9009\u62e9\u5668\u5b57\u7b26\u4e32 separator
property
\u8bbe\u7f6e\u5206\u9694\u7b26 prefix
property
\u8bbe\u7f6e\u524d\u7f00 suffix
property
\u8bbe\u7f6e\u540e\u7f00 reverse
property
\u8bbe\u7f6e\u662f\u5426\u53cd\u8f6c setTitle(title?: string | string[])
method
\u8bbe\u7f6e\u6807\u9898\uff0c\u53d7\u9650\u4e8e #1261 \u4f1a\u6709 25ms
\u7684\u5ef6\u8fdf setTitleByI18n(key: string, params?: Object)
method
\u8bbe\u7f6e\u56fd\u9645\u5316\u6807\u9898
',meta:{order:4,title:"TitleService",subtitle:"\u9875\u9762\u6807\u9898\u670d\u52a1",type:"Service"},toc:[{id:"\u83b7\u53d6\u987a\u5e8f",title:"\u83b7\u53d6\u987a\u5e8f",h:2},{id:"API",title:"API",h:2}]}},demo:!1},this.codes=[]}}return(t=a).\u0275fac=function(e){return new(e||t)},t.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-title"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(e,o){1&e&&d._UZ(0,"app-docs",0),2&e&&d.Q6J("codes",o.codes)("item",o.item)},dependencies:[r.P],styles:["[_nghost-%COMP%]{display:block}"]}),a})()}]}];let V=(()=>{var t;class a{}return(t=a).\u0275fac=function(e){return new(e||t)},t.\u0275mod=d.oAB({type:t}),t.\u0275inj=d.cJS({imports:[Q.m,q.Bz.forChild(J)]}),a})()}}]);
\ No newline at end of file
diff --git a/160.8933dcb761850593.js b/160.8933dcb761850593.js
new file mode 100644
index 0000000000..bb53bcdcc1
--- /dev/null
+++ b/160.8933dcb761850593.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunksite=self.webpackChunksite||[]).push([[160],{79160:(V,g,r)=>{r.r(g),r.d(g,{ThemeModule:()=>J});var Z=r(52787),q=r(89359),Q=r(93285),d=r(65879),c=r(28749);let b=(()=>{class t{constructor(){this.item={cols:1,urls:{"zh-CN":"packages/theme/docs/component-styles.md"},content:{"zh-CN":{content:'\u5f53\u4f60\u5728\u4f7f\u7528 ng g ng-alain:list
\u6765\u751f\u6210\u9875\u9762\u65f6\uff0c\u4f1a\u53d1\u73b0\u5e76\u4e0d\u4f1a\u4ea7\u751f Less \u6587\u4ef6\uff0c\u4e3b\u8981\u662f NG-ALAIN \u6709\u81ea\u5df1\u7684\u4e00\u5957\u4e3b\u9898\u7cfb\u7edf\uff0cNG-ALAIN \u5e0c\u671b\u5229\u7528\u8fd9\u5957\u4e3b\u9898\u7cfb\u7edf\u6765\u6784\u5efa\u7ec4\u4ef6\uff0c\u8ba9 CSS \u53d8\u6210\u7f16\u7a0b\u5316\u3002\u7136\u800c\u5b83\u5e76\u4e0d\u80fd\u6ee1\u8db3\u6240\u6709\u9700\u6c42\uff0c\u672c\u6587\u4f1a\u9488\u5bf9\u8fd9\u65b9\u9762\u505a\u4e00\u4e2a\u5168\u9762\u63cf\u8ff0\u3002
\u5982\u4f55\u5f00\u59cb
\u624b\u52a8\u521b\u5efa\u7ec4\u4ef6\u6837\u5f0f\u6587\u4ef6\uff0c\u4e0b\u9762\u4ee5 img.component.less
\u4e3a\u793a\u4f8b\uff1a
// \u5bfc\u5165 Less \u53d8\u91cf\u53c2\u6570\n@import \'@delon/theme/index\';\n\n:host {\n // \u7ec4\u4ef6\u5bbf\u4e3b\u6837\u5f0f\n display: block;\n font-size: 16px;\n\n ::ng-deep {\n // \u7ec4\u4ef6\u5185\u5176\u4ed6\u6837\u5f0f\n .title {\n color: @text-color;\n }\n }\n}
\u8fd9\u4e2a img.component.less
\u6837\u5f0f\u6587\u4ef6\u5305\u542b\u4e86\u8bb8\u591a\u4fe1\u606f\uff1a
~@delon/theme/index
\u5b83\u5305\u5bb9\u4e86 NG-ZORRO\u3001@delon/theme\u3001@delon/abc\u3001@delon/chart \u4e3b\u9898\u7cfb\u7edf\u6240\u6709\u7684 Less \u53d8\u91cf\u540d\uff0c\u53ea\u6709\u8fd9\u6837\u5bfc\u5165\u624d\u80fd\u4f7f\u6211\u4eec\u5728\u4e0b\u9762\u5f15\u7528 @text-color
\u8fd9\u7c7b Less \u53d8\u91cf\uff0c\u5b83\u8868\u793a\u9ed8\u8ba4\u7684\u989c\u8272\u503c\u3002
\u5982\u679c\u4f60\u6b63\u5728\u4f7f\u7528\u5546\u4e1a\u4e3b\u9898\uff0c\u4f8b\u5982 PRO \u4f1a\u4f7f\u7528\u5176\u4ed6\u8def\u5f84\uff1a@import \'src/styles/theme.less\';
\u3002
\u7279\u6b8a\u9009\u62e9\u5668
:host
\u3001::ng-deep
\u5b83\u4eec\u662f Angular \u7279\u6b8a\u9009\u62e9\u5668\uff1a
:host
\u8868\u793a\u7ec4\u4ef6\u5bbf\u4e3b\uff0c\u5047\u8bbe\u6211\u4eec\u5f53\u524d\u7684\u7ec4\u4ef6\u540d\u4e3a img
\uff0c\u90a3\u6700\u7ec8 :host
\u4f1a\u88ab\u89e3\u6790\u6210 img
\u7684\u6837\u5f0f
::ng-deep
\u8868\u793a\u7981\u6b62\u5bf9\u89c6\u56fe\u5305\u88c5\uff0c\u8fd9\u6709\u52a9\u4e8e\u51cf\u5c11\u751f\u6210\u4e00\u4e9b\u989d\u5916\u7684\u6807\u8bc6\u7b26\uff0c\u5b83\u4f1a\u5f71\u54cd\u5b50\u7ec4\u4ef6\u7684\u7684\u4f7f\u7528\uff0c\u4f8b\u5982\uff1a.title
\u4f1a\u5728 <img>
\u7ec4\u4ef6\u5185\u6240\u6709\u5305\u542b class="title"
\u90fd\u5c06\u6709\u6548
\u4e3b\u9898
NG-ALAIN \u81f3\u4ece 9.3.x
\u5f00\u59cb\u5185\u7f6e\u6697\u9ed1\u4e0e\u7d27\u51d1\u4e24\u79cd\u4e3b\u9898\uff0c\u5bf9\u4e8e\u5168\u5c40\u53ea\u9700\u8981\u4fee\u6539 styles.less \u4e00\u4e2a\u53c2\u6570\uff0c\u4f8b\u5982\u5207\u6362\u4e3a\u6697\u9ed1\u4e3b\u9898\uff1a
- // @import \'@delon/theme/theme-dark.less\';\n+ @import \'@delon/theme/theme-dark.less\';
\u82e5\u662f\u7d27\u51d1\uff0c\u53ea\u9700\u8981\u6362\u6210 @import \'@delon/theme/theme-compact.less\';
\u3002
\u540c\u65f6\uff0c\u5bf9\u4e8e\u7ec4\u4ef6\u6837\u5f0f\u7684\u5f15\u5165\u4e5f\u5168\u90e8\u66ff\u6362\u6210\uff1a
- @import \'@delon/theme/index\';\n+ @import \'@delon/theme/theme-dark\';
\u52a8\u6001\u4e3b\u9898
\u5982\u679c\u4f60\u6b63\u5728\u5236\u4f5c\u5c31\u50cf\b\u73b0\u5728\u7f51\u7ad9\u4e00\u6837\uff0c\u52a8\u6001\u5207\u6362\u4e0d\u540c\u7684\u4e3b\u9898\uff0c\u90a3\u4e48\u5c31\u5fc5\u987b\u9488\u5bf9\u4e0d\u540c\u7684\u4e3b\u9898\u989d\u5916\u8986\u76d6\uff0c\u4f8b\u5982\u5f53\u5f00\u542f\u6697\u9ed1\u65f6\uff0c\u5c06 .title
\u6362\u6210 #000
\u989c\u8272\u503c\uff1a
// \u5bfc\u5165 Less \u53d8\u91cf\u53c2\u6570\n@import \'@delon/theme/index\';\n\n:host {\n // \u7ec4\u4ef6\u5bbf\u4e3b\u6837\u5f0f\n display: block;\n font-size: 16px;\n\n ::ng-deep {\n // \u7ec4\u4ef6\u5185\u5176\u4ed6\u6837\u5f0f\n .title {\n color: @text-color;\n }\n }\n}\n\n[data-theme=\'dark\'] {\n :host ::ng-deep {\n .title {\n color: #000;\n }\n }\n}
\u82e5\u7d27\u51d1\u4e3b\u9898\uff1a
[data-theme=\'compact\'] {\n :host ::ng-deep {\n // \u9488\u5bf9\u7d27\u51d1\u91cd\u65b0\u5b9a\u4e49\n }\n}
\u76f8\u5173\u94fe\u63a5
',meta:{type:"Documents",order:15,title:"\u7ec4\u4ef6\u6837\u5f0f"},toc:[{id:"\u5982\u4f55\u5f00\u59cb",title:"\u5982\u4f55\u5f00\u59cb",h:2},{id:"\u4e3b\u9898",title:"\u4e3b\u9898",h:2},{id:"\u52a8\u6001\u4e3b\u9898",title:"\u52a8\u6001\u4e3b\u9898",h:2},{id:"\u76f8\u5173\u94fe\u63a5",title:"\u76f8\u5173\u94fe\u63a5",h:2}]}},demo:!1},this.codes=[]}static#t=this.\u0275fac=function(e){return new(e||t)};static#e=this.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-component-styles"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(e,o){1&e&&d._UZ(0,"app-docs",0),2&e&&d.Q6J("codes",o.codes)("item",o.item)},dependencies:[c.P],styles:["[_nghost-%COMP%]{display:block}"]})}return t})(),f=(()=>{class t{constructor(){this.item={cols:1,urls:{"en-US":"packages/theme/docs/customize-theme.en-US.md","zh-CN":"packages/theme/docs/customize-theme.zh-CN.md"},content:{"en-US":{content:'Ant Design allows you to customize some basic design aspects in order to meet the needs of UI diversity from business and brand, including primary color, border radius, border color, etc.
Less variables
We are using Less as the development language for styling. A set of less variables are defined for each design aspect that can be customized to your needs.
Customize theme with schematics
Run ng add ng-alain
, set up custom theme file, then modified the file src/styles/theme.less
.
Official Themes
We have some official themes, try them out and give us some feedback!
\u{1f311} Dark Theme (supported in 9+)
\u{1f4e6} Compact Theme (supported in 9+)
Method 1
In the style file src/styles/theme.less
, change default
to dark
or compact
to override theme variables.
// - `default` Default Theme\n// - `dark` \u{1f311} Dark Theme (supported in 9+)\n// - `compact` \u{1f4e6} Compact Theme (supported in 9+)\n@import \'@delon/theme/theme-default.less\';\n\n// ==========The following is the custom theme variable area==========\n// @primary-color: #f50;
Method 2
If the project does not use Less, you can include dark.css
or compact.css
in the CSS file or add to the angular.json
config.
CSS file\uff1a
@import "@delon/theme/dark.css";
angular.json
{\n "build": {\n "options": {\n "styles": [\n "node_modules/@delon/theme/dark.css"\n ]\n }\n }\n}
Switch Theming
When using @angular/cli to configure themes, you must build applications for each theme. When you want to switch themes without reloading the application (like this website), you can use the following method to compile the theme into a style file, and switch at runtime:
Note: Make sure theme variables exist in global styles, not in component scope styles, because component styles that have higher priority will prevent the theme override.
Install Dependencies
yarn add ng-alain-plugin-theme -D
ng-alain-plugin-theme is to generate color.less
and theme CSS files for NG-ALAIN.
Add theme
node in ng-alain.json
:
{\n "$schema": "./node_modules/ng-alain/schema.json",\n "theme": {\n "list": [\n {\n "theme": "dark"\n },\n {\n "key": "dust",\n "modifyVars": {\n "@primary-color": "#F5222D"\n }\n }\n ]\n }\n}
Finally, run the following command:
npx ng-alain-plugin-theme -t=themeCss
Two style files will be generated in src/assets/style.dark.css
and src/assets/style.dust.css
.
Switch Theme at Runtime
Dynamically create a link
tag, dynamically load style files into the application, and remove them otherwise.
You can also use the theme-btn component directly.
changeTheme(theme: \'default\' | \'dark\'): void {\n if (theme === \'dark\') {\n const style = document.createElement(\'link\');\n style.type = \'text/css\';\n style.rel = \'stylesheet\';\n style.id = \'dark-theme\';\n style.href = \'assets/style.dark.css\';\n } else {\n const dom = document.getElementById(\'dark-theme\');\n if (dom) {\n dom.remove();\n }\n }\n}
Note: If you use @delon/chart
or third-party component, you may need to manually modify the component to support the corresponding theme.
Component development issues
The above theme switching method is based on the fact that all Less style content is independent of src/styles.less
. Sometimes, it is also defined in the component, like:
@Component({\n selector: \'app-dashboard-analysis\',\n templateUrl: \'./analysis.component.html\',\n styleUrls: [\'./analysis.component.less\'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class DashboardAnalysisComponent {}
// analysis.component.less\n@import \'@delon/theme/index\';\n:host ::ng-deep { \n color: @text-color;\n}
Because the styles defined in the component run independently under Angular, it is impossible to switch to the dark theme as a whole according to the introduction of @import \'@delon/theme/theme-compact.less\';
, if you want the same in the component To use the dark series, you must:
// analysis.component.less\n- @import \'@delon/theme/index\';\n+ @import \'@delon/theme/theme-dark\';
Or, redefine for a component theme:
// analysis.component.less\n[data-theme=\'dark\'] {\n :host ::ng-deep {\n // Redefining the dark theme\n }\n}
Or compact theme:
[data-theme=\'compact\'] {\n :host ::ng-deep {\n // Redefining the compact theme\n }\n}
Related articles
',meta:{order:5,title:"Customize Theme",type:"Documents"},toc:[{id:"Lessvariables",title:"Less variables",h:2,children:[{id:"Customizethemewithschematics",title:"Customize theme with schematics",h:3}]},{id:"OfficialThemes",title:"Official Themes",h:2,children:[{id:"Method1",title:"Method 1",h:3},{id:"Method2",title:"Method 2",h:3}]},{id:"SwitchTheming",title:"Switch Theming",h:2},{id:"Componentdevelopmentissues",title:"Component development issues",h:2},{id:"Relatedarticles",title:"Related articles",h:2}]},"zh-CN":{content:'Ant Design \u8bbe\u8ba1\u89c4\u8303\u4e0a\u652f\u6301\u4e00\u5b9a\u7a0b\u5ea6\u7684\u6837\u5f0f\u5b9a\u5236\uff0c\u4ee5\u6ee1\u8db3\u4e1a\u52a1\u548c\u54c1\u724c\u4e0a\u591a\u6837\u5316\u7684\u89c6\u89c9\u9700\u6c42\uff0c\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u4e3b\u8272\u3001\u5706\u89d2\u3001\u8fb9\u6846\u548c\u90e8\u5206\u7ec4\u4ef6\u7684\u89c6\u89c9\u5b9a\u5236\u3002
\u5b9a\u5236\u65b9\u5f0f
Ant Design \u7684\u6837\u5f0f\u4f7f\u7528\u4e86 Less \u4f5c\u4e3a\u5f00\u53d1\u8bed\u8a00\uff0c\u5e76\u5b9a\u4e49\u4e86\u4e00\u7cfb\u5217\u5168\u5c40/\u7ec4\u4ef6\u7684\u6837\u5f0f\u53d8\u91cf\uff0c\u4f60\u53ef\u4ee5\u6839\u636e\u9700\u6c42\u8fdb\u884c\u76f8\u5e94\u8c03\u6574\uff0c\u9ed8\u8ba4\u6837\u5f0f\u53d8\u91cf\uff1aNG-ZORRO\u3001NG-ALAIN \u4e24\u90e8\u5206\u3002
\u521d\u59cb\u5316\u9879\u76ee\u65f6\u5b9a\u5236\u4e3b\u9898
\u5728\u521d\u59cb\u5316\u9879\u76ee\u65f6 ng add ng-alain
\u65f6\u9009\u62e9\u81ea\u5b9a\u4e49\u4e3b\u9898\u5373\u53ef\u81ea\u52a8\u914d\u7f6e\u597d\u81ea\u5b9a\u4e49\u4e3b\u9898\u7684\u76f8\u5173\u6587\u4ef6\uff0c\u4fee\u6539 src/styles/theme.less
\u6587\u4ef6\u5185\u5bb9\u5c31\u53ef\u4ee5\u81ea\u5b9a\u4e49\u4e3b\u9898\u3002
\u5b98\u65b9\u4e3b\u9898
\u6211\u4eec\u63d0\u4f9b\u4e86\u4e00\u4e9b\u5b98\u65b9\u4e3b\u9898\uff0c\u6b22\u8fce\u5728\u9879\u76ee\u4e2d\u8bd5\u7528\uff0c\u5e76\u4e14\u7ed9\u6211\u4eec\u63d0\u4f9b\u53cd\u9988\u3002
\u{1f311} \u6697\u9ed1\u4e3b\u9898\uff089+ \u652f\u6301\uff09
\u{1f4e6} \u7d27\u51d1\u4e3b\u9898\uff089+ \u652f\u6301\uff09
\u65b9\u5f0f\u4e00
\u5728\u6837\u5f0f\u6587\u4ef6 src/styles/theme.less
\u66f4\u6539 default
\u4e3a dark
\u6216 compact
\u8986\u76d6\u4e3b\u9898\u53d8\u91cf\u3002
// - `default` \u9ed8\u8ba4\u4e3b\u9898\n// - `dark` \u{1f311} \u6697\u9ed1\u4e3b\u9898\uff089+ \u652f\u6301\uff09\n// - `compact` \u{1f4e6} \u7d27\u51d1\u4e3b\u9898\uff089+ \u652f\u6301\uff09\n@import \'@delon/theme/theme-default.less\';\n\n// ==========The following is the custom theme variable area==========\n// @primary-color: #f50;
\u65b9\u5f0f\u4e8c
\u5982\u679c\u9879\u76ee\u4e0d\u4f7f\u7528 Less\uff0c\u53ef\u5728 CSS \u6587\u4ef6\u6216\u8005 angular.json
\u7684 styles
\u5b57\u6bb5\u4e2d\uff0c\u5168\u91cf\u5f15\u5165 dark.css
\u6216\u8005 compact.css
\u3002
\u6837\u5f0f\u6587\u4ef6\u4e2d\uff1a
@import "@delon/theme/dark.css";
angular.json
\u4e2d
{\n "build": {\n "options": {\n "styles": [\n "node_modules/@delon/theme/dark.css"\n ]\n }\n }\n}
\u4e3b\u9898\u5207\u6362
\u5f53\u4f7f\u7528 @angular/cli \u7684\u65b9\u5f0f\u914d\u7f6e\u4e3b\u9898\u65f6\u5fc5\u987b\u4e3a\u6bcf\u4e2a\u4e3b\u9898\u5355\u72ec\u6253\u5305\u5e94\u7528\uff0c\u5f53\u4f60\u60f3\u5207\u6362\u4e3b\u9898\u800c\u4e0d\u91cd\u65b0\u52a0\u8f7d\u5e94\u7528\u65f6\uff08\u5c31\u50cf\u8fd9\u4e2a\u7f51\u7ad9\uff09\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u7684\u65b9\u6cd5\u5c06\u4e3b\u9898\u7f16\u8bd1\u5230\u5355\u72ec\u7684\u6837\u5f0f\u6587\u4ef6\uff0c\u5e76\u5728\u8fd0\u884c\u65f6\u5207\u6362\uff1a
\u6ce8\u610f\uff1a\u786e\u4fdd\u4e0e\u4e3b\u9898\u53d8\u91cf\u76f8\u5173\u7684\u6837\u5f0f\u5b58\u5728\u5168\u5c40\u6837\u5f0f\u4e2d\uff0c\u800c\u4e0d\u662f\u7ec4\u4ef6\u6837\u5f0f\u4e2d\uff0c\u56e0\u4e3a\u7ec4\u4ef6\u6837\u5f0f\u4f18\u5148\u7ea7\u66f4\u9ad8\u5c06\u4f1a\u5bfc\u81f4\u6837\u5f0f\u65e0\u6cd5\u88ab\u8986\u76d6\u3002
\u5b89\u88c5\u4f9d\u8d56
yarn add ng-alain-plugin-theme -D
ng-alain-plugin-theme \u662f\u4e13\u95e8\u9488\u5bf9 NG-ALAIN \u751f\u6210 color.less
\u53ca\u4e3b\u9898CSS\u6587\u4ef6\u3002
\u5728 ng-alain.json
\u5185\u65b0\u589e theme
\u8282\u70b9\uff1a
{\n "$schema": "./node_modules/ng-alain/schema.json",\n "theme": {\n "list": [\n {\n "theme": "dark"\n },\n {\n "key": "dust",\n "modifyVars": {\n "@primary-color": "#F5222D"\n }\n }\n ]\n }\n}
\u6700\u540e\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a
npx ng-alain-plugin-theme -t=themeCss
\u4f1a\u5728 src/assets/style.dark.css
\u548c src/assets/style.dust.css
\u751f\u6210\u4e24\u4e2a\u6837\u5f0f\u6587\u4ef6\u3002
\u8fd0\u884c\u65f6\u5207\u6362\u6837\u5f0f
\u52a8\u6001\u521b\u5efa link
\u6807\u7b7e\uff0c\u5c06\u6837\u5f0f\u6587\u4ef6\u52a8\u6001\u52a0\u8f7d\u5728\u5e94\u7528\u4e2d\uff0c\u53cd\u4e4b\u79fb\u9664\u3002
\u4e5f\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528 theme-btn \u7ec4\u4ef6\u3002
changeTheme(theme: \'default\' | \'dark\'): void {\n if (theme === \'dark\') {\n const style = document.createElement(\'link\');\n style.type = \'text/css\';\n style.rel = \'stylesheet\';\n style.id = \'dark-theme\';\n style.href = \'assets/style.dark.css\';\n } else {\n const dom = document.getElementById(\'dark-theme\');\n if (dom) {\n dom.remove();\n }\n }\n}
\u6ce8\u610f\uff1a\u5982\u679c\u4f60\u4f7f\u7528 @delon/chart
\u6216\u7b2c\u4e09\u65b9\u7ec4\u4ef6\uff0c\u53ef\u80fd\u9700\u8981\u624b\u52a8\u4fee\u6539\u7ec4\u4ef6\u6765\u652f\u6301\u76f8\u5e94\u7684\u4e3b\u9898\u3002
\u7ec4\u4ef6\u5f00\u53d1\u95ee\u9898
\u4ee5\u4e0a\u4e3b\u9898\u5207\u6362\u65b9\u5f0f\u662f\u5728\u4e00\u4e2a\u5c06\u6240\u6709 Less \u6837\u5f0f\u5185\u5bb9\u72ec\u7acb\u4e8e src/styles.less
\u4e0b\u9762\uff0c\u5f53\u6b63\u5e38\u60c5\u51b5\u4e0b\uff0c\u8fd8\u4f1a\u5728\u7ec4\u4ef6\u5185\u5b9a\u4e49\uff0c\u5c31\u50cf\uff1a
@Component({\n selector: \'app-dashboard-analysis\',\n templateUrl: \'./analysis.component.html\',\n styleUrls: [\'./analysis.component.less\'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class DashboardAnalysisComponent {}
// analysis.component.less\n@import \'@delon/theme/index\';\n:host ::ng-deep { \n color: @text-color;\n}
\u7531\u4e8e\u7ec4\u4ef6\u5185\u5b9a\u4e49\u7684\u6837\u5f0f\u72ec\u7acb\u8fd0\u884c\u5728 Angular \u4e0b\u9762\uff0c\u662f\u65e0\u6cd5\u6839\u636e @import \'@delon/theme/theme-compact.less\';
\u7684\u5f15\u5165\u6765\u6574\u4f53\u5207\u6362\u6210\u6697\u9ed1\u7cfb\uff0c\u5982\u679c\u4f60\u5e0c\u671b\u5728\u7ec4\u4ef6\u5185\u4e5f\u540c\u6837\u4f7f\u7528\u6697\u9ed1\u7cfb\uff0c\u5219\u5fc5\u987b\u5c06\uff1a
// analysis.component.less\n- @import \'@delon/theme/index\';\n+ @import \'@delon/theme/theme-dark\';
\u6216\u8005\uff0c\u91cd\u65b0\u9488\u5bf9\u67d0\u4e00\u4e2a\u4e3b\u9898\u91cd\u65b0\u5b9a\u4e49\uff1a
// analysis.component.less\n[data-theme=\'dark\'] {\n :host ::ng-deep {\n // \u9488\u5bf9\u6697\u9ed1\u7cfb\u91cd\u65b0\u5b9a\u4e49\n }\n}
\u6216\u7d27\u51d1\u4e3b\u9898\uff1a
[data-theme=\'compact\'] {\n :host ::ng-deep {\n // \u9488\u5bf9\u7d27\u51d1\u91cd\u65b0\u5b9a\u4e49\n }\n}
\u76f8\u5173\u6587\u7ae0
',meta:{order:5,title:"\u5b9a\u5236\u4e3b\u9898",type:"Documents"},toc:[{id:"\u5b9a\u5236\u65b9\u5f0f",title:"\u5b9a\u5236\u65b9\u5f0f",h:2,children:[{id:"\u521d\u59cb\u5316\u9879\u76ee\u65f6\u5b9a\u5236\u4e3b\u9898",title:"\u521d\u59cb\u5316\u9879\u76ee\u65f6\u5b9a\u5236\u4e3b\u9898",h:3}]},{id:"\u5b98\u65b9\u4e3b\u9898",title:"\u5b98\u65b9\u4e3b\u9898",h:2,children:[{id:"\u65b9\u5f0f\u4e00",title:"\u65b9\u5f0f\u4e00",h:3},{id:"\u65b9\u5f0f\u4e8c",title:"\u65b9\u5f0f\u4e8c",h:3}]},{id:"\u4e3b\u9898\u5207\u6362",title:"\u4e3b\u9898\u5207\u6362",h:2},{id:"\u7ec4\u4ef6\u5f00\u53d1\u95ee\u9898",title:"\u7ec4\u4ef6\u5f00\u53d1\u95ee\u9898",h:2},{id:"\u76f8\u5173\u6587\u7ae0",title:"\u76f8\u5173\u6587\u7ae0",h:2}]}},demo:!1},this.codes=[]}static#t=this.\u0275fac=function(e){return new(e||t)};static#e=this.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-customize-theme"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(e,o){1&e&&d._UZ(0,"app-docs",0),2&e&&d.Q6J("codes",o.codes)("item",o.item)},dependencies:[c.P],styles:["[_nghost-%COMP%]{display:block}"]})}return t})(),y=(()=>{class t{constructor(){this.item={cols:1,urls:{"en-US":"packages/theme/docs/getting-started.en-US.md","zh-CN":"packages/theme/docs/getting-started.zh-CN.md"},content:{"en-US":{content:'@delon/theme
is the only must be imported to ng-alain scaffold. It contains a lot of style parameters and several generalities services, pipes.
Style
ng-alain defaults to using less as the style language, we recommend that you learn about the features of less before using it or sometimes when you have some questions. If you want to get a basic knowledge of CSS or look for properties usage, you can refer to the MDN doc.
Layout
Scaffolding include two layouts: default layout, blank layout, scaffolding does not contain these style files, it\'s in the @delon/theme
library.
Scaffold Style
You can use the toolset provided by ng-alain to adjust spacing, color, size, borders, etc. It\'s a set of like bootstrap style tools.
Or customize your styles with theme.less, which will work in global applications, in the style development process, there are two prominent problems:
Global Pollution - CSS selectors are globally valid. Selectors with the same name in different files will be built together, and the former will be overrided by the latter.
Complex Selector - in order to avoid the above problem, we have to be careful when writing styles. The increase in flags for range restriction will lead to a growing class name, besides that, naming style confusion in multi person development and an increasing number of selectors on an element is hard to avoid.
We should use component styles
property to create component styles. For how use Angular styles, please refer to About Angular Style Packaging.
Style file category
In a project, style files can be divided into different categories depending on their function.
theme.less
Global style file, where you can make some common settings.
Tools
Please refer to Tools\u3002
Page level
Specific page-related style, such as monitor.component.less, the content is only related to the content of this page. Under normal circumstances, if it is not particularly complex page, with the previous global style and tools style, there should be little to write.
How to override parameters
We are using Less as the development language for styling. A set of less variables are defined for each design aspect that can be customized to your needs.
The changes parameters put into the theme.less LESS file, all parameters include:
Please report an issue if the existing list of variables is not enough for
',meta:{order:1,title:"Getting Started",type:"Documents"},toc:[{id:"Style",title:"Style",h:2},{id:"Layout",title:"Layout",h:2},{id:"ScaffoldStyle",title:"Scaffold Style",h:2},{id:"Stylefilecategory",title:"Style file category",h:2,children:[{id:"theme.less",title:"theme.less",h:3},{id:"Tools",title:"Tools",h:3},{id:"Pagelevel",title:"Page level",h:3}]},{id:"Howtooverrideparameters",title:"How to override parameters",h:2}]},"zh-CN":{content:'@delon/theme
\u662f ng-alain \u811a\u624b\u67b6\u552f\u4e00\u5fc5\u987b\u5f15\u5165\u7684\u6a21\u5757\u3002\u5b83\u5305\u542b\u4e86\u975e\u5e38\u591a\u4e3b\u9898\u6837\u5f0f\u53c2\u6570\uff0c\u901a\u8fc7\u8986\u76d6\u53c2\u6570\u6570\u503c\u8fdb\u800c\u5b9a\u5236\u4e00\u4e9b\u7279\u522b\u7684\u9700\u6c42\uff1b\u4ee5\u53ca\u82e5\u5e72\u901a\u7528\u6027\u670d\u52a1\u3001\u7ba1\u9053\u3002
\u6837\u5f0f
ng-alain \u9ed8\u8ba4\u4f7f\u7528 less \u4f5c\u4e3a\u6837\u5f0f\u8bed\u8a00\uff0c\u5efa\u8bae\u5728\u4f7f\u7528\u524d\u6216\u8005\u9047\u5230\u7591\u95ee\u65f6\u5b66\u4e60\u4e00\u4e0b less \u7684\u76f8\u5173\u7279\u6027\uff0c\u5982\u679c\u60f3\u83b7\u53d6\u57fa\u7840\u7684 CSS \u77e5\u8bc6\u6216\u67e5\u9605\u5c5e\u6027\uff0c\u53ef\u4ee5\u53c2\u8003 MDN\u6587\u6863\u3002
\u5e03\u5c40
\u811a\u624b\u67b6\u63d0\u4f9b\u4e24\u79cd\u5e03\u5c40\uff1a\u9ed8\u8ba4\u5e03\u5c40\u3001\u7a7a\u767d\u5e03\u5c40\uff0c\u811a\u624b\u67b6\u5e76\u4e0d\u5305\u542b\u4e24\u79cd\u5e03\u5c40\u6837\u5f0f\u6587\u4ef6\uff0c\u5b83\u4f4d\u4e8e @delon/theme
\u7c7b\u5e93\u5f53\u4e2d\u3002
\u811a\u624b\u67b6\u6837\u5f0f
\u5728\u5f00\u53d1\u8fc7\u7a0b\u4e2d\uff0c\u7edd\u5927\u90e8\u5206\u60c5\u51b5\u4e0b\u53ef\u4ee5\u5229\u7528 ng-alain \u63d0\u4f9b\u7684\u5de5\u5177\u96c6\u6765\u8c03\u6574\u95f4\u8ddd\u3001\u989c\u8272\u3001\u5927\u5c0f\u3001\u8fb9\u6846\u7b49\uff0c\u5b83\u662f\u4e00\u4e2a\u5957\u7c7b\u4f3c bootstrap \u98ce\u683c\u7684\u5de5\u5177\u96c6\u3002
\u6216\u901a\u8fc7 theme.less \u4e0b\u5b9a\u5236\u4f60\u7684\u6837\u5f0f\uff0c\u8fd9\u4e9b\u6837\u5f0f\u5c06\u4f1a\u5728\u5168\u5c40\u5e94\u7528\u4e2d\u6709\u6548\uff0c\u4e14\u6709\u4e24\u4e2a\u95ee\u9898\u6bd4\u8f83\u7a81\u51fa\uff1a
\u5168\u5c40\u6c61\u67d3 \u2014\u2014 CSS \u6587\u4ef6\u4e2d\u7684\u9009\u62e9\u5668\u662f\u5168\u5c40\u751f\u6548\u7684\uff0c\u4e0d\u540c\u6587\u4ef6\u4e2d\u7684\u540c\u540d\u9009\u62e9\u5668\uff0c\u6839\u636e build \u540e\u751f\u6210\u6587\u4ef6\u4e2d\u7684\u5148\u540e\u987a\u5e8f\uff0c\u540e\u9762\u7684\u6837\u5f0f\u4f1a\u5c06\u524d\u9762\u7684\u8986\u76d6\uff1b
\u9009\u62e9\u5668\u590d\u6742 \u2014\u2014 \u4e3a\u4e86\u907f\u514d\u4e0a\u9762\u7684\u95ee\u9898\uff0c\u6211\u4eec\u5728\u7f16\u5199\u6837\u5f0f\u7684\u65f6\u5019\u4e0d\u5f97\u4e0d\u5c0f\u5fc3\u7ffc\u7ffc\uff0c\u7c7b\u540d\u91cc\u4f1a\u5e26\u4e0a\u9650\u5236\u8303\u56f4\u7684\u6807\u8bc6\uff0c\u53d8\u5f97\u8d8a\u6765\u8d8a\u957f\uff0c\u591a\u4eba\u5f00\u53d1\u65f6\u8fd8\u5f88\u5bb9\u6613\u5bfc\u81f4\u547d\u540d\u98ce\u683c\u6df7\u4e71\uff0c\u4e00\u4e2a\u5143\u7d20\u4e0a\u4f7f\u7528\u7684\u9009\u62e9\u5668\u4e2a\u6570\u4e5f\u53ef\u80fd\u8d8a\u6765\u8d8a\u591a\u3002
\u56e0\u6b64\uff0c\u9664\u975e\u8bbe\u8ba1\u5e08\u660e\u786e\u9700\u6c42\u4ee5\u5916\uff0c\u6211\u4eec\u5e94\u8be5\u5c3d\u53ef\u80fd\u4f7f\u7528\u7ec4\u4ef6 styles
\u5c5e\u6027\u521b\u5efa\u7ec4\u4ef6\u6837\u5f0f\uff0c\u6709\u5173\u5982\u4f55Angular\u6837\u5f0f\u8bf7\u53c2\u8003\u300a\u5173\u4e8eAngular\u6837\u5f0f\u5c01\u88c5\u300b\u3002
\u6837\u5f0f\u6587\u4ef6\u7c7b\u522b
\u5728\u4e00\u4e2a\u9879\u76ee\u4e2d\uff0c\u6837\u5f0f\u6587\u4ef6\u6839\u636e\u529f\u80fd\u4e0d\u540c\uff0c\u53ef\u4ee5\u5212\u5206\u4e3a\u4e0d\u540c\u7684\u7c7b\u522b\u3002
theme.less
\u5168\u5c40\u6837\u5f0f\u6587\u4ef6\uff0c\u5728\u8fd9\u91cc\u4f60\u53ef\u4ee5\u8fdb\u884c\u4e00\u4e9b\u901a\u7528\u8bbe\u7f6e\u3002
\u5de5\u5177\u96c6
\u8bf7\u53c2\u8003 \u5de5\u5177\u96c6\u6837\u5f0f\u3002
\u9875\u9762\u7ea7
\u5177\u4f53\u9875\u9762\u76f8\u5173\u7684\u6837\u5f0f\uff0c\u4f8b\u5982 monitor.component.less\uff0c\u91cc\u9762\u7684\u5185\u5bb9\u4ec5\u548c\u672c\u9875\u9762\u7684\u5185\u5bb9\u76f8\u5173\u3002\u4e00\u822c\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u4e0d\u662f\u9875\u9762\u5185\u5bb9\u7279\u522b\u590d\u6742\uff0c\u6709\u4e86\u524d\u9762\u5168\u5c40\u6837\u5f0f\u3001\u5de5\u5177\u96c6\u6837\u5f0f\u7684\u914d\u5408\uff0c\u8fd9\u91cc\u8981\u5199\u7684\u5e94\u8be5\u4e0d\u591a\u3002
\u5982\u4f55\u8986\u76d6\u53c2\u6570
ng-alain \u7684\u6837\u5f0f\u4f7f\u7528\u4e86 Less \u4f5c\u4e3a\u5f00\u53d1\u8bed\u8a00\uff0c\u5e76\u5b9a\u4e49\u4e86\u4e00\u7cfb\u5217\u5168\u5c40/\u7ec4\u4ef6\u7684\u6837\u5f0f\u53d8\u91cf\uff0c\u4f60\u53ef\u4ee5\u6839\u636e\u9700\u6c42\u8fdb\u884c\u76f8\u5e94\u8c03\u6574\u3002
\u8981\u6539\u53d8\u7684\u53c2\u6570\u7edf\u4e00\u653e\u5728 theme.less LESS\u6587\u4ef6\u4e2d\uff0c\u6240\u6709\u53c2\u6570\u5305\u62ec\uff1a
\u5982\u679c\u4ee5\u4e0a\u53d8\u91cf\u4e0d\u80fd\u6ee1\u8db3\u4f60\u7684\u5b9a\u5236\u9700\u6c42\uff0c\u53ef\u4ee5\u7ed9\u6211\u4eec\u63d0 i
',meta:{order:1,title:"\u5f00\u59cb\u4f7f\u7528",type:"Documents"},toc:[{id:"\u6837\u5f0f",title:"\u6837\u5f0f",h:2},{id:"\u5e03\u5c40",title:"\u5e03\u5c40",h:2},{id:"\u811a\u624b\u67b6\u6837\u5f0f",title:"\u811a\u624b\u67b6\u6837\u5f0f",h:2},{id:"\u6837\u5f0f\u6587\u4ef6\u7c7b\u522b",title:"\u6837\u5f0f\u6587\u4ef6\u7c7b\u522b",h:2,children:[{id:"theme.less",title:"theme.less",h:3},{id:"\u5de5\u5177\u96c6",title:"\u5de5\u5177\u96c6",h:3},{id:"\u9875\u9762\u7ea7",title:"\u9875\u9762\u7ea7",h:3}]},{id:"\u5982\u4f55\u8986\u76d6\u53c2\u6570",title:"\u5982\u4f55\u8986\u76d6\u53c2\u6570",h:2}]}},demo:!1},this.codes=[]}static#t=this.\u0275fac=function(e){return new(e||t)};static#e=this.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-getting-started"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(e,o){1&e&&d._UZ(0,"app-docs",0),2&e&&d.Q6J("codes",o.codes)("item",o.item)},dependencies:[c.P],styles:["[_nghost-%COMP%]{display:block}"]})}return t})(),k=(()=>{class t{constructor(){this.item={cols:1,urls:{"en-US":"packages/theme/docs/global.en-US.md","zh-CN":"packages/theme/docs/global.zh-CN.md"},content:{"en-US":{content:'Public
Name Default Description @layout-gutter
8px
Antd layout spacing (unchageable) @font-size-base
14px
Antd font size (unchageable) @primary-color
Blue antd primary color @mobile-min
768px
PC of width @mobile-max
767px
Mobile of width @text-xs
@font-size-base - 2
Text of xs size @text-sm
@font-size-base + 0
Text of sm size @text-md
@font-size-base + 2
Text of md size @text-lg
@font-size-base + 4
Text of lg size @text-xl
@font-size-base + 8
Text of xl size @text-xxl
@font-size-base + 12
Text of xxl size @icon-sm
@font-size-base * 2
Icon of sm size @icon-md
@font-size-base * 4
Icon of md size @icon-lg
@font-size-base * 6
Icon of lg size @icon-xl
@font-size-base * 8
Icon of xl size @icon-xxl
@font-size-base * 10
Icon of xxl size @h1-font-size
32px
h1 font size @h2-font-size
24px
h2 font size @h3-font-size
20px
h3 font size @h4-font-size
16px
h4 font size @h5-font-size
14px
h5 font size @h6-font-size
12px
h6 font size @enable-all-colors
false
Turn on background, text color
eg: .bg-teal
\u3001.text-teal
@modal-sm
300px
Small modal @modal-md
500px
Medium modal @modal-lg
900px
Large modal @modal-lg
1200px
Extra large modal @drawer-sm
300px
Small drawer @drawer-md
500px
Medium drawer @drawer-lg
900px
Large drawer @drawer-lg
1200px
Extra large drawer @drawer-sm-height
200px
Small drawer for height @drawer-md-height
400px
Medium drawer for height @drawer-lg-height
600px
Large drawer for height @drawer-xl-height
800px
Extra large drawer for height @code-border-color
#eee
<code>
border color@code-bg
#f7f7f7
<code>
background color@widths
xs @layout-gutter * 10
sm @layout-gutter * 20
md @layout-gutter * 30
lg @layout-gutter * 40
xl @layout-gutter * 50
xxl @layout-gutter * 50
width @border-radius-md
4px
Medium border rounded corner @border-radius-lg
6px
Large border rounded corner @masonry-column-gap
@layout-gutter * 2
CSS waterfall flow column and column spacing @scrollbar-enabled
true
Enable landscaping scrollbars @scrollbar-width
6px
Scroll bar width @scrollbar-height
6px
Scroll bar height @scrollbar-track-color
rgba(0, 0, 0, 0.3)
Scrollbar track color @scrollbar-thumb-color
#6e6e6e
Scrollbar thumb color @scrollbar-table-enabled
false
Enable landscaping scrollbars of nz-table @rtl-enabled
false
Wheter support RTL @enabled-util-align
true
Whether to enable tools align @enabled-util-border
true
Whether to enable tools border @enabled-util-code
true
Whether to enable tools code @enabled-util-color
true
Whether to enable tools color @enabled-util-display
true
Whether to enable tools display @enabled-util-float
true
Whether to enable tools float @enabled-util-icon
true
Whether to enable tools icon @enabled-util-img
true
Whether to enable tools img @enabled-util-position
true
Whether to enable tools position @enabled-util-overflow
true
Whether to enable tools overflow @enabled-util-responsive
true
Whether to enable tools responsive @enabled-util-spacing
true
Whether to enable tools spacing @enabled-util-text
true
Whether to enable tools text @enabled-util-width
true
Whether to enable tools width @enabled-util-scrollbar
true
Whether to enable tools scrollbar @enabled-util-other
true
Whether to enable tools other
Ng patch
General
Name Default Description @preserve-white-spaces-enabled
true
Fixed between buttons spacing when enabled preserveWhitespaces is true @preserve-sf-and-st-spaces
16px
Spacing between sf
and st
@preserve-buttons-spaces
Spacing between button
and button
(incluldes: button
,button-group
,popconfirm
) @router-animation-enabled
false
Whether to enable animation when route changing @router-animation-duration
antFadeIn
Route switching animation name @router-animation-duration
1s
Animation duration
Zorro patch
General
Name Default Description @forced-turn-off-nz-modal-animation-enabled
false
Forced to turn off nz-modal
animation
Form
Name Default Description @form-state-visual-feedback-enabled
false
Turn on visual feedback of form invalid elements @search-form-bg
#fbfbfb
Background color of simple search form @search-form-radius
4px
Border rounded corner of simple search form
Table
By nz-table
\u3002
Name Default Description @nz-table-img-radius
4px
Image rounded in the table @nz-table-img-margin-right
4px
Image margin-right in the table @nz-table-img-max-width
32px
Image maximum width in the table @nz-table-img-max-height
32px
Image maximum height in the table @nz-table-even-background
none
Even background color in the table @nz-table-rep-max-width
@mobile-max
Triggering table response when mobile screen @nz-table-rep-header-background
@border-color-split
Table responsive: title background color @nz-table-rep-even-background
#f9f9f9
Table responsive: even background color @nz-table-rep-padding-vertical
8px
Table responsive: Cell vertical spacing @nz-table-rep-padding-horizontal
8px
Table responsive: Cell horizontal spacing @nz-table-rep-column-name-width
100px
Table responsive: Column name maximum width @nz-table-rep-column-name-text-align
right
Table responsive: Column name text alignment @nz-table-rep-column-name-padding-right
right
Table responsive: Column name right spacing @nz-table-rep-column-name-color
rgba(0, 0, 0, 0.5)
Table responsive: Column name color
Widgets
Name Default Description @hafl-enabled
true
Whether hafl image @abs-enabled
true
Whether abs element @masonry-enabled
true
Whether css masonry @setting-drawer-enabled
true
Whether setting drawer css @search__form-enabled
true
Pro style search form, DEMO ',meta:{type:"Theme",order:1,title:"Global Parameters"},toc:[{id:"Public",title:"Public",h:2},{id:"Ngpatch",title:"Ng patch",h:2,children:[{id:"General",title:"General",h:3}]},{id:"Zorropatch",title:"Zorro patch",h:2,children:[{id:"General",title:"General",h:3},{id:"Form",title:"Form",h:3},{id:"Table",title:"Table",h:3}]},{id:"Widgets",title:"Widgets",h:2}]},"zh-CN":{content:'\u516c\u5171\u7c7b
\u540d\u79f0 \u9ed8\u8ba4\u503c \u529f\u80fd @layout-gutter
8px
antd\u5e03\u5c40\u95f4\u8ddd\uff0c\u4e0d\u53ef\u6539\u53d8 @font-size-base
14px
antd\u5b57\u53f7 @primary-color
\u84dd\u8272 antd \u4e3b\u8272 @mobile-min
768px
PC\u7aef @mobile-max
767px
\u79fb\u52a8\u7aef @text-xs
@font-size-base - 2
xs \u6587\u672c\u5927\u5c0f @text-sm
@font-size-base + 0
sm \u6587\u672c\u5927\u5c0f @text-md
@font-size-base + 2
md \u6587\u672c\u5927\u5c0f @text-lg
@font-size-base + 4
lg \u6587\u672c\u5927\u5c0f @text-xl
@font-size-base + 8
xl \u6587\u672c\u5927\u5c0f @text-xxl
@font-size-base + 12
xxl \u6587\u672c\u5927\u5c0f @icon-sm
@font-size-base * 2
sm \u56fe\u6807 @icon-md
@font-size-base * 4
md \u56fe\u6807 @icon-lg
@font-size-base * 6
lg \u56fe\u6807 @icon-xl
@font-size-base * 8
xl \u56fe\u6807 @icon-xxl
@font-size-base * 10
xxl \u56fe\u6807 @h1-font-size
32px
h1\u5b57\u53f7 @h2-font-size
24px
h2\u5b57\u53f7 @h3-font-size
20px
h3\u5b57\u53f7 @h4-font-size
16px
h4\u5b57\u53f7 @h5-font-size
14px
h5\u5b57\u53f7 @h6-font-size
12px
h6\u5b57\u53f7 @enable-all-colors
false
\u5f00\u542f\u80cc\u666f\u3001\u6587\u672c\u989c\u8272
\u4f8b\u5982\uff1a.bg-teal
\u3001.text-teal
\u6709\u5173\u989c\u8272\u503c\u89c1\u6837\u5f0f\u89c4\u5219\u7ae0\u8282 @modal-sm
300px
\u5c0f\u53f7\u5bf9\u8bdd\u6846 @modal-md
500px
\u4e2d\u53f7\u5bf9\u8bdd\u6846 @modal-lg
900px
\u5927\u53f7\u5bf9\u8bdd\u6846 @modal-xl
1200px
\u8d85\u5927\u53f7\u5bf9\u8bdd\u6846 @drawer-sm
300px
\u5c0f\u53f7\u62bd\u5c49 @drawer-md
500px
\u4e2d\u53f7\u62bd\u5c49 @drawer-lg
900px
\u5927\u53f7\u62bd\u5c49 @drawer-xl
1200px
\u8d85\u5927\u53f7\u62bd\u5c49 @drawer-sm-height
200px
\u5c0f\u53f7\u62bd\u5c49 @drawer-md-height
400px
\u4e2d\u53f7\u62bd\u5c49 @drawer-lg-height
600px
\u5927\u53f7\u62bd\u5c49 @drawer-xl-height
800px
\u8d85\u5927\u53f7\u62bd\u5c49 @code-border-color
#eee
<code>
\u8fb9\u6846\u989c\u8272@code-bg
#f7f7f7
<code>
\u80cc\u666f\u989c\u8272@widths
xs @layout-gutter * 10
sm @layout-gutter * 20
md @layout-gutter * 30
lg @layout-gutter * 40
xl @layout-gutter * 50
xxl @layout-gutter * 50
\u5bbd\u5ea6 @border-radius-md
4px
\u4e2d\u53f7\u8fb9\u6846\u5706\u89d2 @border-radius-lg
6px
\u5927\u53f7\u8fb9\u6846\u5706\u89d2 @masonry-column-gap
@layout-gutter * 2
CSS\u7011\u5e03\u6d41\u5217\u4e0e\u5217\u7684\u95f4\u8ddd @scrollbar-enabled
true
\u542f\u7528\u7f8e\u5316\u6eda\u52a8\u6761 @scrollbar-width
6px
\u7f8e\u5316\u6eda\u52a8\u6761\u5bbd\u5ea6 @scrollbar-height
6px
\u7f8e\u5316\u6eda\u52a8\u6761\u9ad8\u5ea6 @scrollbar-track-color
rgba(0, 0, 0, 0.3)
\u7f8e\u5316\u6eda\u52a8\u6761\u7684\u8f68\u9053\u989c\u8272 @scrollbar-thumb-color
#6e6e6e
\u7f8e\u5316\u6eda\u52a8\u6761\u5c0f\u65b9\u5757\u989c\u8272 @scrollbar-table-enabled
false
\u542f\u7528\u7f8e\u5316\u8868\u683c\u6eda\u52a8\u6761 @rtl-enabled
false
\u662f\u5426\u652f\u6301 RTL @enabled-util-align
true
\u662f\u5426\u542f\u7528\u5de5\u5177\u7c7b align @enabled-util-border
true
\u662f\u5426\u542f\u7528\u5de5\u5177\u7c7b border @enabled-util-code
true
\u662f\u5426\u542f\u7528\u5de5\u5177\u7c7b code @enabled-util-color
true
\u662f\u5426\u542f\u7528\u5de5\u5177\u7c7b color @enabled-util-display
true
\u662f\u5426\u542f\u7528\u5de5\u5177\u7c7b display @enabled-util-float
true
\u662f\u5426\u542f\u7528\u5de5\u5177\u7c7b float @enabled-util-icon
true
\u662f\u5426\u542f\u7528\u5de5\u5177\u7c7b icon @enabled-util-img
true
\u662f\u5426\u542f\u7528\u5de5\u5177\u7c7b img @enabled-util-position
true
\u662f\u5426\u542f\u7528\u5de5\u5177\u7c7b position @enabled-util-overflow
true
\u662f\u5426\u542f\u7528\u5de5\u5177\u7c7b overflow @enabled-util-responsive
true
\u662f\u5426\u542f\u7528\u5de5\u5177\u7c7b responsive @enabled-util-spacing
true
\u662f\u5426\u542f\u7528\u5de5\u5177\u7c7b spacing @enabled-util-text
true
\u662f\u5426\u542f\u7528\u5de5\u5177\u7c7b text @enabled-util-width
true
\u662f\u5426\u542f\u7528\u5de5\u5177\u7c7b width @enabled-util-scrollbar
true
\u662f\u5426\u542f\u7528\u5de5\u5177\u7c7b scrollbar @enabled-util-other
true
\u662f\u5426\u542f\u7528\u5de5\u5177\u7c7b other
Ng\u8865\u4e01
\u901a\u7528
\u540d\u79f0 \u9ed8\u8ba4\u503c \u529f\u80fd @preserve-white-spaces-enabled
true
\u89e3\u51b3\u5f00\u542f preserveWhitespaces \u65f6\u6309\u94ae\u95f4\u53ef\u80fd\u4f1a\u51fa\u73b0\u65e0\u7f1d @preserve-sf-and-st-spaces
16px
sf
\u4e0e st
\u95f4\u95f4\u8ddd@preserve-buttons-spaces
\u6309\u94ae\u95f4\u95f4\u8ddd\uff08\u5305\u62ec\uff1abutton\u3001button-group\u3001popconfirm\uff09 @router-animation-enabled
false
\u662f\u5426\u542f\u7528\u8def\u7531\u5207\u6362\u52a8\u753b @router-animation-duration
antFadeIn
\u8def\u7531\u5207\u6362\u52a8\u753b @router-animation-duration
1s
\u8def\u7531\u5207\u6362\u52a8\u753b\u65f6\u957f
Zorro\u7ec4\u4ef6\u8865\u4e01
\u901a\u7528
\u540d\u79f0 \u9ed8\u8ba4\u503c \u529f\u80fd @forced-turn-off-nz-modal-animation-enabled
false
\u5f3a\u5236\u5173\u95ed nz-modal
\u52a8\u753b\u6548\u679c
\u8868\u5355
\u540d\u79f0 \u9ed8\u8ba4\u503c \u529f\u80fd @form-state-visual-feedback-enabled
false
\u5f00\u542f\u8868\u5355\u5143\u7d20\u7684\u89c6\u89c9\u53cd\u9988 @search-form-bg
#fbfbfb
\u5217\u8868\u9875\u7b80\u6613\u641c\u7d22\u8868\u5355\u80cc\u666f\u8272 @search-form-radius
4px
\u5217\u8868\u9875\u7b80\u6613\u641c\u7d22\u8868\u5355\u5706\u89d2
\u8868\u683c
\u6307 nz-table
\u3002
\u540d\u79f0 \u9ed8\u8ba4\u503c \u529f\u80fd @nz-table-img-radius
4px
\u8868\u683c\u4e2d\u7684\u56fe\u7247\u5706\u89d2 @nz-table-img-margin-right
4px
\u8868\u683c\u4e2d\u7684\u56fe\u7247\u53f3\u5916\u8fb9\u8ddd @nz-table-img-max-width
32px
\u8868\u683c\u4e2d\u7684\u56fe\u7247\u6700\u5927\u5bbd\u5ea6 @nz-table-img-max-height
32px
\u8868\u683c\u4e2d\u7684\u56fe\u7247\u6700\u5927\u9ad8\u5ea6 @nz-table-even-background
none
\u5947\u5076\u80cc\u666f @nz-table-rep-max-width
@mobile-max
\u5f53\u79fb\u52a8\u7aef\u5c4f\u5e55\u65f6\u89e6\u53d1\u8868\u683c\u54cd\u5e94\u5f0f @nz-table-rep-header-background
@border-color-split
\u8868\u683c\u54cd\u5e94\u5f0f\uff1a\u6807\u9898\u80cc\u666f\u8272 @nz-table-rep-even-background
#f9f9f9
\u8868\u683c\u54cd\u5e94\u5f0f\uff1a\u5076\u6570\u884c\u80cc\u666f\u8272 @nz-table-rep-padding-vertical
8px
\u8868\u683c\u54cd\u5e94\u5f0f\uff1a\u5355\u5143\u683c\u5782\u76f4\u95f4\u8ddd @nz-table-rep-padding-horizontal
8px
\u8868\u683c\u54cd\u5e94\u5f0f\uff1a\u5355\u5143\u683c\u6c34\u5e73\u95f4\u8ddd @nz-table-rep-column-name-width
100px
\u8868\u683c\u54cd\u5e94\u5f0f\uff1a\u5217\u540d\u6700\u5927\u5bbd\u5ea6 @nz-table-rep-column-name-text-align
right
\u8868\u683c\u54cd\u5e94\u5f0f\uff1a\u5217\u540d\u6587\u672c\u5bf9\u9f50\u65b9\u5f0f @nz-table-rep-column-name-padding-right
right
\u8868\u683c\u54cd\u5e94\u5f0f\uff1a\u5217\u540d\u53f3\u95f4\u8ddd @nz-table-rep-column-name-color
rgba(0, 0, 0, 0.5)
\u8868\u683c\u54cd\u5e94\u5f0f\uff1a\u5217\u540d\u989c\u8272
\u5c0f\u90e8\u4ef6
\u540d\u79f0 \u9ed8\u8ba4\u503c \u529f\u80fd @hafl-enabled
true
\u534a\u56fe @abs-enabled
true
\u4e2d\u5fc3\u5143\u7d20 @masonry-enabled
true
CSS\u7011\u5e03\u6d41\u5217 @setting-drawer-enabled
true
\u4e3b\u9898\u8bbe\u7f6e @search__form-enabled
true
Pro\u641c\u7d22\u6846\uff0cDEMO ',meta:{type:"Theme",order:1,title:"\u5168\u5c40\u53c2\u6570"},toc:[{id:"\u516c\u5171\u7c7b",title:"\u516c\u5171\u7c7b",h:2},{id:"Ng\u8865\u4e01",title:"Ng\u8865\u4e01",h:2,children:[{id:"\u901a\u7528",title:"\u901a\u7528",h:3}]},{id:"Zorro\u7ec4\u4ef6\u8865\u4e01",title:"Zorro\u7ec4\u4ef6\u8865\u4e01",h:2,children:[{id:"\u901a\u7528",title:"\u901a\u7528",h:3},{id:"\u8868\u5355",title:"\u8868\u5355",h:3},{id:"\u8868\u683c",title:"\u8868\u683c",h:3}]},{id:"\u5c0f\u90e8\u4ef6",title:"\u5c0f\u90e8\u4ef6",h:2}]}},demo:!1},this.codes=[]}static#t=this.\u0275fac=function(e){return new(e||t)};static#e=this.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-global"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(e,o){1&e&&d._UZ(0,"app-docs",0),2&e&&d.Q6J("codes",o.codes)("item",o.item)},dependencies:[c.P],styles:["[_nghost-%COMP%]{display:block}"]})}return t})(),v=(()=>{class t{constructor(){this.item={cols:1,urls:{"zh-CN":"packages/theme/docs/icon.md"},content:{"zh-CN":{content:'\u81ea ng-zorro-antd 1.7.x \u4ee5\u540e\u56fe\u6807\u53d1\u751f\u7834\u574f\u6027\u53d8\u66f4\uff0c\u867d\u7136\u5e26\u4e86\u8bf8\u591a\u4f18\u52bf\uff0c\u540c\u65f6\u4e5f\u5e26\u6765\u51e0\u4e2a\u52a3\u52bf\uff1a
\u82e5\u91c7\u7528\u52a8\u6001\u52a0\u8f7d\u4f1a\u4ea7\u751f\u989d\u5916\u7684HTTP\u8bf7\u6c42
\u82e5\u9759\u6001\u52a0\u8f7d\u9700\u8981\u9010\u4e00\u6ce8\u518c\u56fe\u6807
st
\u7ec4\u4ef6\u7684 format
\u53c2\u6570\u65e0\u6cd5\u76f4\u63a5\u6307\u5b9a\u56fe\u6807
ng-alain \u9ed8\u8ba4\u4f7f\u7528\u9759\u6001\u52a0\u8f7d\u7684\u505a\u6cd5\uff0c\u6bd5\u7adf\u540e\u7aef\u4f7f\u7528\u56fe\u6807\u76f8\u5bf9\u4e8e\u6bd4\u8f83\u6709\u9650\uff0c\u5373\u4f7f\u5c06 svg \u90fd\u6253\u5305\u8fdb\u811a\u672c\u76f8\u6bd4\u8f83\u4e4b\u524d\u6574\u4e2a styles \u4f53\u79ef\u4e0a\u662f\u6240\u6709\u51cf\u5c11\uff0c\u4f46\u6bd4\u8f83\u5e76\u4e0d\u591a\u3002
\u800c\u9488\u5bf9\u4ee5\u4e0a\u95ee\u9898\uff0cng-alain \u63d0\u4f9b\u51e0\u79cd\u65b9\u6848\u3002
\u4f7f\u7528icon\u63d2\u4ef6\uff08\u63a8\u8350\uff09
\u5c3d\u53ef\u80fd\u4ece\u9879\u76ee\u4e2d\u5206\u6790\u5e76\u751f\u6210\u9759\u6001 Icon\uff0c\u63d2\u4ef6\u4f1a\u81ea\u52a8\u5728 src
\u76ee\u5f55\u4e0b\u751f\u6210\u4e24\u4e2a\u6587\u4ef6\uff1a
src/style-icons.ts
\u81ea\u5b9a\u4e49\u90e8\u5206\u65e0\u6cd5\u89e3\u6790\uff08\u4f8b\u5982\uff1a\u8fdc\u7a0b\u83dc\u5355\u56fe\u6807\uff09
src/style-icons-auto.ts
\u547d\u4ee4\u81ea\u52a8\u751f\u6210\u6587\u4ef6
\u81ea\u52a8\u6392\u9664 ng-zorro-antd \u548c @delon \u5df2\u7ecf\u52a0\u8f7d\u7684\u56fe\u6807\u3002
ng g ng-alain:plugin icon
\u540c\u65f6\uff0c\u9700\u8981\u624b\u52a8\u5728 startup.service.ts
\u4e2d\u5bfc\u5165\uff1a
import { ICONS_AUTO } from \'../../../style-icons-auto\';\nimport { ICONS } from \'../../../style-icons\';\n\n@Injectable()\nexport class StartupService {\n constructor(iconSrv: NzIconService) {\n iconSrv.addIcon(...ICONS_AUTO, ...ICONS);\n }\n}
\u6709\u6548\u8bed\u6cd5
<i class="anticon anticon-user"></i>\n<i class="anticon anticon-question-circle-o"></i>\n<i class="anticon anticon-spin anticon-loading"></i>\n<i nz-icon class="anticon anticon-user"></i>\n<i nz-icon nzType="align-{{type ? \'left\' : \'right\'}}"></i>\n<i nz-icon [type]="type ? \'menu-fold\' : \'menu-unfold\'" [theme]="theme ? \'outline\' : \'fill\'"></i>\n<i nz-icon [type]="type ? \'fullscreen\' : \'fullscreen-exit\'"></i>\n<i nz-icon nzType="{{ type ? \'arrow-left\' : \'arrow-right\' }}"></i>\n<i nz-icon nzType="filter" theme="outline"></i>\n<nz-input-group [nzAddOnBeforeIcon]="focus ? \'anticon anticon-arrow-down\' : \'anticon anticon-search\'"></nz-input-group>
\u52a8\u6001\u52a0\u8f7d
\u52a8\u6001\u52a0\u8f7d\uff0c\u8fd9\u662f\u4e3a\u4e86\u51cf\u5c11\u5305\u4f53\u79ef\u800c\u63d0\u4f9b\u7684\u65b9\u5f0f\u3002\u5f53 NG-ZORRO \u68c0\u6d4b\u7528\u6237\u60f3\u8981\u6e32\u67d3\u7684\u56fe\u6807\u8fd8\u6ca1\u6709\u9759\u6001\u5f15\u5165\u65f6\uff0c\u4f1a\u53d1\u8d77 HTTP \u8bf7\u6c42\u52a8\u6001\u5f15\u5165\u3002\u4f60\u53ea\u9700\u8981\u914d\u7f6e angular.json
\u6587\u4ef6\uff1a
{\n "assets": [\n {\n "glob": "**/*",\n "input": "./node_modules/@ant-design/icons-angular/src/inline-svg/",\n "output": "/assets/"\n }\n ]\n}
\u52a8\u6001\u4f7f\u7528
\u4e0d\u7ba1\u662f\u9759\u6001\u6216\u52a8\u6001\u52a0\u8f7d\uff0c\u4f9d\u7136\u65e0\u6cd5\u89e3\u51b3\u539f\u59cb\u65b9\u6cd5 class="anticon anticon-"
\u7684\u4fbf\u5229\u6027\uff0c\u6bd5\u7adf\u5b57\u7b26\u4e32\u5c31\u662f\u5b57\u7b26\u4e32\u5e76\u975e Angular \u6a21\u677f\u65e0\u6cd5\u88ab\u89e3\u6790\uff0c\u800c\u9488\u5bf9\u8fd9\u4e2a\u95ee\u9898\uff0c\u63d0\u4f9b\u4e24\u79cd\u89e3\u51b3\u529e\u6cd5\u3002
\u7c7b\u6837\u5f0f
\u4e8b\u5b9e\u4e0a\u6240\u6709 Antd \u56fe\u6807\u90fd\u53ef\u4ee5\u5728 iconfont \u627e\u5f97\u5230\uff0c\u53ef\u4ee5\u70b9\u9009\u81ea\u5df1\u9700\u8981\u7684\u56fe\u6807\u5e76\u751f\u6210\u76f8\u5e94\u7684 css \u6587\u4ef6\u6216 cdn\uff0c\u6700\u540e\u5728\u9879\u76ee\u4e2d\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528 1.7.0
\u4e4b\u524d\u7684\u5199\u6cd5\u3002
\u6ce8\u610f\uff1a \u5728\u9879\u76ee\u7f16\u8f91\u91cc\u52a0\u4e0a anticon anticon-
\u524d\u7f00\u624d\u80fd\u540c\u4e4b\u524d\u7684\u7c7b\u540d\u4fdd\u6301\u4e00\u81f4\u3002
// angular.json\n"styles": [\n "src/iconfont.css"\n],
\u5982\u679c\u975ecdn\u8fd8\u9700\u8981\u5c06\u76f8\u5e94\u7684 icon \u56fe\u6807\u6587\u4ef6\u590d\u5236\u5230 assets
\u76ee\u5f55\u4e0b\uff0c\u540c\u65f6\u4fee\u6539 iconfont.css
\u4e2d @font-face
\u5bf9\u5e94\u7684 url \u8def\u5f84\u3002
@angular/elements
\u52a8\u6001\u52a0\u8f7d\u7684\u53e6\u4e00\u79cd\u65b9\u5f0f\u662f\u4f7f\u7528 @angular/elements\uff0c\u53ea\u9700\u8981 nz-icon
\u6307\u4ee4\u91cd\u65b0\u5c01\u88c5\u6210\u7ec4\u4ef6\u3002
import { Component, Input } from \'@angular/core\';\n\n@Component({\n selector: \'nz-icon\',\n template: `<i nz-icon [type]="type"></i>`,\n})\nexport class IconComponent {\n @Input()\n type: string;\n}
\u540c\u65f6\u5728\u6839\u6a21\u5757\u91cc\u6ce8\u518c\u5b83\u3002
import { createCustomElement } from \'@angular/elements\';\n\n@NgModule({\n declarations: [],\n})\nexport class AppModule {\n constructor(injector: Injector) {\n customElements.define(\'nz-icon\', createCustomElement(IconComponent, { injector }));\n }\n}
\u6700\u540e\u3002
@Component({\n selector: \'app-demo\',\n template: `\n <div [innerHTML]="value"></div>\n `,\n})\nexport class DemoComponent {\n\n constructor(private san: DomSanitizer) { }\n\n value = this.san.bypassSecurityTrustHtml(\n `icon: `,\n );\n}',meta:{type:"Documents",order:20,title:"Icon"},toc:[{id:"\u4f7f\u7528icon\u63d2\u4ef6\uff08\u63a8\u8350\uff09",title:"\u4f7f\u7528icon\u63d2\u4ef6\uff08\u63a8\u8350\uff09",h:2},{id:"\u52a8\u6001\u52a0\u8f7d",title:"\u52a8\u6001\u52a0\u8f7d",h:2},{id:"\u52a8\u6001\u4f7f\u7528",title:"\u52a8\u6001\u4f7f\u7528",h:2,children:[{id:"\u7c7b\u6837\u5f0f",title:"\u7c7b\u6837\u5f0f",h:3},{id:"@angular/elements",title:"@angular/elements",h:3}]}]}},demo:!1},this.codes=[]}static#t=this.\u0275fac=function(e){return new(e||t)};static#e=this.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-icon"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(e,o){1&e&&d._UZ(0,"app-docs",0),2&e&&d.Q6J("codes",o.codes)("item",o.item)},dependencies:[c.P],styles:["[_nghost-%COMP%]{display:block}"]})}return t})(),x=(()=>{class t{constructor(){this.item={cols:1,urls:{"en-US":"packages/theme/docs/locale.en-US.md","zh-CN":"packages/theme/docs/locale.zh-CN.md"},content:{"en-US":{content:'Provide a uniform localization support for @delon/*
class library built-in text of components.
Usage
Providers
Provides the token of DELON_LOCALE
for configuring antd locale text globally.
import { DELON_LOCALE, en_US } from \'@delon/theme\';\n@NgModule({\n ...\n providers : [ { provide: DELON_LOCALE, useValue: en_US } ]\n})\nexport class AppModule { }
Service
Provides the service of DelonLocaleService
to dynamic change the locale text.
import { en_US, DelonLocaleService } from \'@delon/theme\';\n...\nconstructor(private delonLocaleService: DelonLocaleService) {\n}\n\nswitchLanguage() {\n this.delonLocaleService.setLocale(en_US);\n}
Note: en_US
is the package name, follow below.
Supported languages
Language Filename English en_US Chinese (Simplified) zh_CN Chinese (Traditional) zh_TW Turkish tr_TR Polish pl_PL Greek el_GR Korean ko_KR Croatian hr_HR Japanese ja_JP Slovenian sl_SI French fr_FR Spanish es_ES Italian it_IT
Add a new language
If you can\'t find your language, you are welcome to create a locale package based on en_US (You can also refer to #308 to contribute language package to us) and send us a pull req
',meta:{order:2,title:"Internationalization",type:"Documents"},toc:[{id:"Usage",title:"Usage",h:2,children:[{id:"Providers",title:"Providers",h:3},{id:"Service",title:"Service",h:3}]},{id:"Supportedlanguages",title:"Supported languages",h:2},{id:"Addanewlanguage",title:"Add a new language",h:2}]},"zh-CN":{content:'\u4e3a\u6574\u4e2a @delon/*
\u7c7b\u5e93\u5185\u5efa\u6587\u6848\u63d0\u4f9b\u7edf\u4e00\u7684\u56fd\u9645\u5316\u652f\u6301\u3002
\u4f7f\u7528
\u5168\u5c40\u914d\u7f6e
\u53ea\u9700\u8981\u5728\u6839\u6a21\u5757\u91cd\u65b0\u5bf9 DELON_LOCALE
\u6ce8\u5165\u76ee\u6807\u8bed\u8a00\u5373\u53ef\u5168\u5c40\u751f\u6548\u3002
import { DELON_LOCALE, en_US } from \'@delon/theme\';\n@NgModule({\n ...\n providers : [ { provide: DELON_LOCALE, useValue: en_US } ]\n})\nexport class AppModule { }
\u8fd0\u884c\u65f6\u4fee\u6539
@delon
\u63d0\u4f9b\u4e86\u4e00\u4e2a\u670d\u52a1 DelonLocaleService
\u7528\u4e8e\u52a8\u6001\u4fee\u6539\u56fd\u9645\u5316\u6587\u6848\u3002
import { en_US, DelonLocaleService } from \'@delon/theme\';\n...\nconstructor(private delonLocaleService: DelonLocaleService) {\n}\n\nswitchLanguage() {\n this.delonLocaleService.setLocale(en_US);\n}
\u6ce8\u610f\uff1aen_US
\u662f\u8bed\u8a00\u5305\u540d\u79f0\uff0c\u4ee5\u4e0b\u8868\u683c\u4e5f\u9075\u5faa\u540c\u6837\u7684\u89c4\u5219\u3002
\u652f\u6301\u8bed\u8a00
\u8bed\u8a00 \u8bed\u8a00\u5305\u540d\u79f0 \u82f1\u8bed\uff08\u7f8e\u5f0f\uff09 en_US \u7b80\u4f53\u4e2d\u6587 zh_CN \u7e41\u4f53\u4e2d\u6587 zh_TW \u571f\u8033\u5176\u8bed tr_TR \u6ce2\u5170\u8bed pl_PL \u5e0c\u814a\u8bed el_GR \u671d\u9c9c\u8bed ko_KR \u514b\u7f57\u5730\u4e9a hr_HR \u65e5\u8bed ja_JP \u65af\u6d1b\u6587\u5c3c\u4e9a\u6587 sl_SI \u6cd5\u6587 fr_FR \u897f\u73ed\u7259\u8bed es_ES \u610f\u5927\u5229\u8bed it_IT
\u589e\u52a0\u8bed\u8a00\u5305
\u5982\u679c\u4f60\u627e\u4e0d\u5230\u4f60\u9700\u8981\u7684\u8bed\u8a00\u5305\uff0c\u6b22\u8fce\u4f60\u5728 \u82f1\u6587\u8bed\u8a00\u5305\uff08\u4f60\u4e5f\u53ef\u4ee5\u53c2\u8003 #308 \u5411\u6211\u4eec\u8d21\u732e\u8bed\u8a00\u5305\uff09\u7684\u57fa\u7840\u4e0a\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u8bed\u8a00\u5305\uff0c\u5e76\u7ed9\u6211\u4eec Pull Req
',meta:{order:2,title:"\u56fd\u9645\u5316",type:"Documents"},toc:[{id:"\u4f7f\u7528",title:"\u4f7f\u7528",h:2,children:[{id:"\u5168\u5c40\u914d\u7f6e",title:"\u5168\u5c40\u914d\u7f6e",h:3},{id:"\u8fd0\u884c\u65f6\u4fee\u6539",title:"\u8fd0\u884c\u65f6\u4fee\u6539",h:3}]},{id:"\u652f\u6301\u8bed\u8a00",title:"\u652f\u6301\u8bed\u8a00",h:2},{id:"\u589e\u52a0\u8bed\u8a00\u5305",title:"\u589e\u52a0\u8bed\u8a00\u5305",h:2}]}},demo:!1},this.codes=[]}static#t=this.\u0275fac=function(e){return new(e||t)};static#e=this.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-locale"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(e,o){1&e&&d._UZ(0,"app-docs",0),2&e&&d.Q6J("codes",o.codes)("item",o.item)},dependencies:[c.P],styles:["[_nghost-%COMP%]{display:block}"]})}return t})(),w=(()=>{class t{constructor(){this.item={cols:1,urls:{"en-US":"packages/theme/docs/performance.en-US.md","zh-CN":"packages/theme/docs/performance.zh-CN.md"},content:{"en-US":{content:'ng-alain also includes a set of like bootstrap style tools, And built on the design principles developed by Ant Design. If you are familiar with Bootstrap, it will be very friendly, because all naming as close as it. Also, Install ng-alain snippets plugin in VSCode for intellisense these class names.
Usage
We have hundreds of Less variables (including ng-zorro-antd, ng-alain), some of which contain the -enabled
suffix, which means that these libraries are optional.
You can to theme.less set to false
, which can reduce css file size.
// I don\'t need masonry style\n@masonry-enabled: false
Parameters
Name Default Description @scrollbar-enabled
true
Enable landscaping scrollbars @preserve-white-spaces-enabled
true
Fixed between buttons spacing when enabled preserveWhitespaces is true @form-state-visual-feedback-enabled
false
Turn on visual feedback of form invalid elements @hafl-enabled
true
Whether hafl image @abs-enabled
true
Whether abs element @masonry-enabled
true
Whether css masonry @setting-drawer-enabled
true
Whether setting drawer css @search-form-enabled
true
Simple style search form, DEMO @search__form-enabled
true
Pro style search form, DEMO ',meta:{type:"Documents",order:10,title:"Performance"},toc:[{id:"Usage",title:"Usage",h:2},{id:"Parameters",title:"Parameters",h:2}]},"zh-CN":{content:'ng-alain \u9664\u4e86\u63d0\u4f9b\u4e3b\u9898\u65b9\u6848\u4ee5\u5916\uff0c\u8fd8\u5305\u542b\u4e00\u5957\u7c7b\u4f3c Bootstrap \u7684\u5de5\u5177\u96c6\uff0c\u5e76\u4e14\u4e25\u683c\u9075\u5b88 Antd \u7684\u8bbe\u8ba1\u4ef7\u503c\u89c2\uff0c\u5bf9\u4e8e\u719f\u6089 Bootstrap \u7684\u4eba\u6765\u8bf4\u4f1a\u975e\u5e38\u53cb\u597d\uff0c\u56e0\u4e3a\u6240\u6709\u547d\u540d\u65b9\u5f0f\u90fd\u5c3d\u53ef\u80fd\u4e0e Bootstrap \u76f8\u540c\u3002\u540c\u65f6\uff0c\u6211\u4eec\u4e3a VSCode \u5199\u7684 ng-alain\u63d2\u4ef6 \u4f1a\u81ea\u52a8\u4e3a\u4f60\u63d0\u4f9b\u8fd9\u5957CSS\u5de5\u5177\u96c6\u7684\u667a\u80fd\u63d0\u9192\u3002
\u5982\u4f55\u4f18\u5316
\u6211\u4eec\u5305\u542b\u7740\u4e0a\u767e\u79cd Less \u53d8\u91cf\uff08\u5305\u542bng-zorro-antd\u3001ng-alain\uff09\uff0c\u8fd9\u4e9b\u53d8\u66f4\u6709\u90e8\u5206\u662f\u5305\u542b\u7740-enabled
\u540e\u7f00\uff0c\u5b83\u8868\u793a\u8fd9\u4e9b\u7c7b\u5e93\u662f\u53ef\u9009\u7684\u3002
\u4f60\u53ef\u4ee5\u5728 ng-alain \u9879\u76ee\u7684 theme.less \u4e2d\u8bbe\u7f6e\u4e3a false
\uff0c\u53ef\u4ee5\u6709\u6548\u51cf\u5c11 css \u6587\u4ef6\u5927\u5c0f\u3002
// \u4e0d\u9700\u8981 masonry \u6837\u5f0f\n@masonry-enabled: false
\u53c2\u6570
\u540d\u79f0 \u9ed8\u8ba4\u503c \u529f\u80fd @scrollbar-enabled
true
\u542f\u7528\u7f8e\u5316\u6eda\u52a8\u6761 @preserve-white-spaces-enabled
true
\u89e3\u51b3\u5f00\u542f preserveWhitespaces \u65f6\u6309\u94ae\u95f4\u53ef\u80fd\u4f1a\u51fa\u73b0\u65e0\u7f1d @form-state-visual-feedback-enabled
false
\u5f00\u542f\u8868\u5355\u5143\u7d20\u7684\u89c6\u89c9\u53cd\u9988 @hafl-enabled
true
\u534a\u56fe @abs-enabled
true
\u4e2d\u5fc3\u5143\u7d20 @masonry-enabled
true
CSS\u7011\u5e03\u6d41\u5217 @setting-drawer-enabled
true
\u4e3b\u9898\u8bbe\u7f6e @search-form-enabled
true
\u7b80\u5316\u641c\u7d22\u6846\uff0cDEMO @search__form-enabled
true
Pro\u641c\u7d22\u6846\uff0cDEMO ',meta:{type:"Documents",order:10,title:"\u5305\u4f53\u4f18\u5316"},toc:[{id:"\u5982\u4f55\u4f18\u5316",title:"\u5982\u4f55\u4f18\u5316",h:2},{id:"\u53c2\u6570",title:"\u53c2\u6570",h:2}]}},demo:!1},this.codes=[]}static#t=this.\u0275fac=function(e){return new(e||t)};static#e=this.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-performance"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(e,o){1&e&&d._UZ(0,"app-docs",0),2&e&&d.Q6J("codes",o.codes)("item",o.item)},dependencies:[c.P],styles:["[_nghost-%COMP%]{display:block}"]})}return t})(),S=(()=>{class t{constructor(){this.item={cols:1,urls:{"en-US":"packages/theme/docs/tools.en-US.md","zh-CN":"packages/theme/docs/tools.zh-CN.md"},content:{"en-US":{content:'ng-alain builds a set of style tools for size, spacing, color, and more based on Ant Design.
Install ng-alain snippets plugin in VSCode for intellisense these class names.
Spacing
ng-alain believes that these styles tool only using in the content area. Built on the design principles developed by Ant Design, A spacing width is based on 8px
as a reference unit, and derived from three rule sizes.
Name Formula Size Description xs
$gutter / 2 4px
Smaller sm
$gutter 8px
Small md
$gutter * 2 16px
Medium lg
$gutter * 3 24px
Large xl
$gutter * 4 32px
Extra Large xxl
$gutter * 6 48px
Oversized
According these rules, derived from margin
\uff0cpadding
, and naming rules as follows:
Type: padding
, margin
Direction(Optional): top
, right
, bottom
, left
, x
(equal to left
, right
), y
(equal to top
, bottom
)
Clean
[<Type>p|m][t|r|b|l|x|y]?0
Name Rule
[<Type>p|m][t|r|b|l|x|y]?-[sm|md|lg]
Demo:
.p-sm { padding: 8px !important; }\n.pt-sm { padding-top: 8px !important; }\n.m-sm { margin: 16px !important; }\n.mt-md { margin-top: 16px !important; }\n\n.p0 { padding: 0 !important; }
Color
Ant Design does not have a button color, but is based on visual effects. The default is daybreak blue, for example: button type primary
of nz-button
.
ng-alain still does not break this rule, building a set of color classes for text and background based on the color section.
Name Primary Color Description red
#f5222d Dust Red: Fighting, unrestrained volcano
#fa541c Volcano: Eye-catching orange
#fa8c16 Sunset Orange: Warm and cheerful gold
#faad14 Calendula Gold: Vital and active yellow
#fadb14 Sunrise Yellow: Birth, sunshine lime
#a0d911 Lime: Natural, vital green
#f5222d Polar Green: Health, innovation cyan
#13c2c2 Cyan: Hope, strong blue
#1890ff Daybreak Blue: Inclusive, technology, Pratt & Whitney geekblue
#2f54eb Geek Blue: Explore and delve into purple
#722ed1 Golden Purple: Elegant, romantic magenta
#eb2f96 Magenta: Smooth, neutral
Ant Design\'s base color palette totals 120 colors, including 12 primary colors and their derivative colors. These colors can basically include the need for color in background applications design.
Category
Name Color Size light
5 normal
6 dark
7
Name Rule
[<Type>text|bg]-[red|volcano|orange|gold|yellow|lime|green|cyan|blue|geekblue|purple|magenta|grey](-[light|dark])?(-h)?
normal
itself is the basic color, so it can be ignored\ngrey
is very often used, so add extra grey-light
, grey-darker
alias to indicate depth
DEMO:
// Text color\n.text-red-light { color: #fabeb9 !important; }\n.text-red { color: #f04134 !important; }\n.text-red-dark { color: #a31837 !important; }\n\n// background-color color\n.bg-red-light { background-color: #fabeb9 !important; }\n.bg-red { background-color: #f04134 !important; }\n.bg-red-dark { background-color: #a31837 !important; }\n\n// hover color\n.bg-red-light-h { &:hover { background-color: #fabeb9 !important; } }\n.bg-red-h { &:hover { background-color: #f04134 !important; } }\n.bg-red-dark-h { &:hover { background-color: #a31837 !important; } }
Aliase
Aliase Color Name primary
@blue-6
#1890ffsuccess
@green-6
#52c41aerror
@red-5
#ff4d4fwarning
@gold-6
#faad14info
@blue-6
#1890ffprocessing
@blue-6
#1890ffhighlight
@red-5
#ff4d4fnormal
#d9d9d9
#d9d9d9
DEMO:
// Text color\n.text-error-light { color: #fabeb9 !important; }\n.text-error { color: #f04134 !important; }\n.text-error-dark { color: #a31837 !important; }\n\n// background-color color\n.bg-error-light { background-color: #fabeb9 !important; }\n.bg-error { background-color: #f04134 !important; }\n.bg-error-dark { background-color: #a31837 !important; }\n\n// hover color\n.bg-error-light-h { &:hover { background-color: #fabeb9 !important; } }\n.bg-error-h { &:hover { background-color: #f04134 !important; } }\n.bg-error-dark-h { &:hover { background-color: #a31837 !important; } }
Full Colors
You can use @enable-all-colors: true
to turn on all 120 color rules.
.text-red-1 { color: #fff1f0 !important; }\n.text-red-6 { color: #f04134 !important; }\n.text-red-10 { color: #5c0011 !important; }\n\n.bg-red-6 { color: #f04134 !important; }\n.bg-red-6-h { color: #f04134 !important; }
Clearfix
Clear floats .clearfix
.
Display
Aliase CSS d-none
display: none
d-block
display: block
d-inline-block
display: inline-block
d-flex
display: flex
d-inline-flex
display: inline-flex
justify-content-start
justify-content: flex-start
justify-content-end
justify-content: flex-end
justify-content-center
justify-content: center
justify-content-between
justify-content: space-between
justify-content-around
justify-content: space-around
align-items-start
align-items: flex-start
align-items-end
align-items: flex-end
align-items-center
align-items: center
align-items-baseline
align-items: baseline
align-items-stretch
align-items: stretch
align-content-start
align-content: flex-start
align-content-end
align-content: flex-end
align-content-center
align-content: center
align-content-between
align-content: space-between
align-content-around
align-content: space-around
align-content-stretch
align-content: stretch
align-self-auto
align-self: auto
align-self-start
align-self: flex-start
align-self-end
align-self: flex-end
align-self-center
align-self: center
align-self-baseline
align-self: baseline
align-self-stretch
align-self: stretch
flex-center
display: flex; align-items: center;
flex-center-between
display: flex; align-items: center; align-content: space-between;
Position
Name Description overflow-auto
overflow: auto
overflow-hidden
overflow: hidden
fixed-top
Fixed top fixed-bottom
Fixed bottom
Text
Sizing
Ant Design is based on 14px
.
Name Description text-xs
12px
text-sm
14px
text-md
16px
text-lg
18px
text-xl
22px
Alignment
Name Description text-left
Text left text-center
Text center text-right
Text right
Overflow
The container must be display: inline-block
or display: block
.
Name Description text-nowrap
Outputs a single line text-truncate
Truncate string with ellipsis
Transformation
Name Description text-lowercase
Lowercase of text text-uppercase
Uppercase of text text-capitalize
Capitalize of text text-deleted
Deleted line
Weight and italics
Name Description font-weight-normal
font-weight: normal
font-weight-bold
font-weight: 700
font-italic
font-style: italic
Other
Name Description text-hover
*:hover { color: @primary-color; }
disabled
Disabled
Borders
Border
Name Description border
border: 1px solid #f5f5f5 !important;
border-0
border: 0 !important;
border-top-0
border-top: 0 !important;
border-right-0
border-right: 0 !important;
border-bottom-0
border-bottom: 0 !important;
border-left-0
border-left: 0 !important;
Color
Supports all color & aliase of color section, such as border-red
, border-success
.
Rounded
Name Description rounded-0
border-radius: 0;
rounded-circle
border-radius: 50%;
rounded-sm
border-radius: 2px;
rounded-md
border-radius: 4px;
rounded-lg
border-radius: 6px;
Width
Name Description width-sm
160px
width-md
240px
width-lg
320px
width-[0-10]
0%-100%
Responsive
Like Bootstrap responsive rules, all apply hidden-xs
classes are hidden when screen less than 480px
.
Name Screen hidden-xs
<480px hidden-sm
<768px hidden-md
<992px hidden-lg
<1200px hidden-pc
<768px hidden-mobile
>768px
Rotate
.rotate-[360 / 15]
DEMO:
// Rotate 15 degrees\n.rotate-15\n// Rotate 90 degrees\n.rotate-90\n// Rotate 360 degrees\n.rotate-360
Other
Name Description block-center
margin: 0 auto
point
cursor: pointer
no-data
No result no-resize
Setting does not allow adjustment elements bg-center
Background image is vertically centered scrollbar
Custom scrollbar for a div color-weak
Weak mode
Widgets
Masonry
Online DEMO\u3002
Name Description row-masonry
Rows row-masonry-{xs|sm|md|lg|xl}-{1-10}
Rows, Responsive style col-masonry
Columns
ng-zorro
nz-card
Name Description ant-card__body-nopadding
Force body without spacing
nz-modal
Name Description modal-{sm|md|lg|xl}
Set size of modal, wrapClassName: \'modal-lg\'
modal-body-nopadding
Without padding in body element modal-header
Use html template to custom modal, DEMO modal-footer
Use html template to custom modal, DEMO
nz-table
Name Description ant-table-rep__title
Title ant-table-rep__hide-header-footer
Show title or bottom when mobile screen
nz-tag
Name Description ant-tag__plus
Add button style ',meta:{type:"Theme",order:2,title:"Style Tools"},toc:[{id:"Spacing",title:"Spacing",h:2},{id:"Color",title:"Color",h:2,children:[{id:"Aliase",title:"Aliase",h:3}]},{id:"Clearfix",title:"Clearfix",h:2},{id:"Display",title:"Display",h:2},{id:"Position",title:"Position",h:2},{id:"Text",title:"Text",h:2,children:[{id:"Sizing",title:"Sizing",h:3},{id:"Alignment",title:"Alignment",h:3},{id:"Overflow",title:"Overflow",h:3},{id:"Transformation",title:"Transformation",h:3},{id:"Weightanditalics",title:"Weight and italics",h:3},{id:"Other",title:"Other",h:3}]},{id:"Borders",title:"Borders",h:2,children:[{id:"Border",title:"Border",h:3},{id:"Color",title:"Color",h:3},{id:"Rounded",title:"Rounded",h:3}]},{id:"Width",title:"Width",h:2},{id:"Responsive",title:"Responsive",h:2},{id:"Rotate",title:"Rotate",h:2},{id:"Other",title:"Other",h:2},{id:"Widgets",title:"Widgets",h:2,children:[{id:"Masonry",title:"Masonry",h:3}]},{id:"ng-zorro",title:"ng-zorro",h:2,children:[{id:"nz-card",title:"nz-card",h:3},{id:"nz-modal",title:"nz-modal",h:3},{id:"nz-table",title:"nz-table",h:3},{id:"nz-tag",title:"nz-tag",h:3}]}]},"zh-CN":{content:'ng-alain \u5728 Ant Design \u7684\u57fa\u7840\u4e0a\u751f\u4ea7\u4e00\u5957\u5c3a\u5bf8\u3001\u95f4\u8ddd\u3001\u989c\u8272\u7b49\u5de5\u5177\u7c7b\u3002
\u5728 VSCode \u5b89\u88c5 ng-alain snippets \u63d2\u4ef6\uff0c\u53ef\u4ee5\u5bf9\u6240\u6709\u5de5\u5177\u96c6\u6837\u5f0f\u540d\u79f0\u7684\u667a\u80fd\u63d0\u9192\u3002
\u95f4\u8ddd
ng-alain \u8ba4\u4e3a\u8fd9\u4e9b\u5de5\u5177\u7c7b\u53ea\u4f1a\u8fd0\u7528\u5728\u5185\u5bb9\u533a\u57df\uff0c\u4e14\u79c9\u627f Ant Design \u7684\u8bbe\u8ba1\u4ef7\u503c\u89c2\uff0c\u95f4\u8ddd\u5bbd\u5ea6\u662f\u4ee5 8px
\u4e3a\u4e00\u4e2a\u57fa\u51c6\u5355\u4f4d\uff0c\u5e76\u884d\u751f\u51fa\u4e09\u4e2a\u5c3a\u5bf8\uff0c\u5206\u522b\u4e3a\uff1a
\u540d\u79f0 \u516c\u5f0f \u5c3a\u5bf8 \u8bf4\u660e xs
$gutter / 2 4px
\u8d85\u5c0f\u53f7 sm
$gutter 8px
\u5c0f\u53f7 md
$gutter * 2 16px
\u4e2d\u53f7 lg
$gutter * 3 24px
\u5927\u53f7 xl
$gutter * 4 32px
\u7279\u5927\u53f7 xxl
$gutter * 6 48px
\u8d85\u5927\u53f7
\u4f9d\u8fd9\u4e9b\u89c4\u5219\uff0c\u884d\u751f\u51fa margin
\u3001padding
\uff0c\u5176\u547d\u540d\u89c4\u5219\u5982\u4e0b\uff1a
\u7c7b\u578b\uff1apadding
\u3001margin
\u65b9\u5411\uff08\u53ef\u9009\uff09\uff1atop
\u3001right
\u3001bottom
\u3001left
\u3001x
\uff08\u76f8\u5f53\u4e8e left
\u3001right
\uff09\u3001y
\uff08\u76f8\u5f53\u4e8e top
\u3001bottom
\uff09
\u6d88\u9664
[<\u7c7b\u578b>p|m][<\u65b9\u5411>t|r|b|l|x|y]?0
\u547d\u540d\u683c\u5f0f
[<\u7c7b\u578b>p|m][<\u65b9\u5411>t|r|b|l|x|y]?-[<\u5c3a\u5bf8>sm|md|lg]
\u793a\u4f8b\uff1a
.p-sm { padding: 8px !important; }\n.pt-sm { padding-top: 8px !important; }\n.m-sm { margin: 16px !important; }\n.mt-md { margin-top: 16px !important; }\n\n.p0 { padding: 0 !important; }
\u8272\u5f69
Ant Design \u5e76\u6ca1\u6709\u6309\u94ae\u8272\u8fd9\u4e00\u8bf4\uff0c\u800c\u662f\u4ee5\u89c6\u89c9\u6548\u679c\u4e3a\u57fa\u51c6\u3002\u9ed8\u8ba4\u662f\u84dd\u8272\u7cfb\uff08\u62c2\u6653\u84dd\uff09\uff0c\u4f8b\u5982\uff1anz-button
\u7684\u6309\u94ae\u7c7b\u578b primary
\u3002
\u800c ng-alain \u4f9d\u7136\u4e0d\u4f1a\u7834\u574f\u8fd9\u79cd\u89c4\u5219\uff0c\u4f46\u4f9d \u8272\u5f69 \u7ae0\u8282\uff0c\u4ea7\u751f\u4e86\u4e00\u79cd\u8fd0\u7528\u4e8e\u6587\u672c\u3001\u80cc\u666f\u7684\u8272\u7cfb\u7c7b\u3002
\u540d\u79f0 \u57fa\u672c\u8272 \u8bf4\u660e red
#f5222d \u8584\u66ae\uff1a\u6597\u5fd7\u3001\u5954\u653e volcano
#fa541c \u706b\u5c71\uff1a\u9192\u76ee\u3001\u6f8e\u6e43 orange
#fa8c16 \u65e5\u66ae\uff1a\u6e29\u6696\u3001\u6b22\u5feb gold
#faad14 \u91d1\u76cf\u82b1\uff1a\u6d3b\u529b\u3001\u79ef\u6781 yellow
#fadb14 \u65e5\u51fa\uff1a\u51fa\u751f\u3001\u9633\u5149 lime
#a0d911 \u9752\u67e0\uff1a\u81ea\u7136\u3001\u751f\u673a green
#f5222d \u6781\u5149\u7eff\uff1a\u5065\u5eb7\u3001\u521b\u65b0 cyan
#13c2c2 \u660e\u9752\uff1a\u5e0c\u671b\u3001\u575a\u5f3a blue
#1890ff \u62c2\u6653\u84dd\uff1a\u5305\u5bb9\u3001\u79d1\u6280\u3001\u666e\u60e0 geekblue
#2f54eb \u6781\u5ba2\u84dd\uff1a\u63a2\u7d22\u3001\u94bb\u7814 purple
#722ed1 \u9171\u7d2b\uff1a\u4f18\u96c5\u3001\u6d6a\u6f2b magenta
#eb2f96 \u6cd5\u5f0f\u6d0b\u7ea2\uff1a\u5e73\u7a33\u3001\u4e2d\u6027
Ant Design \u7684\u57fa\u7840\u8272\u677f\u5171\u8ba1 120 \u4e2a\u989c\u8272\uff0c\u5305\u542b 12 \u4e2a\u4e3b\u8272\u4ee5\u53ca\u884d\u751f\u8272\u3002\u8fd9\u4e9b\u989c\u8272\u57fa\u672c\u53ef\u4ee5\u6ee1\u8db3\u4e2d\u540e\u53f0\u8bbe\u8ba1\u4e2d\u5bf9\u4e8e\u989c\u8272\u7684\u9700\u6c42\u3002
\u5206\u7c7b
\u540d\u79f0 \u8272\u53f7 light
5\u53f7 normal
6\u53f7 dark
7\u53f7
\u547d\u540d\u683c\u5f0f
[<\u7c7b\u578b>text|bg]-[<\u8272\u5f69\u540d>red|volcano|orange|gold|yellow|lime|green|cyan|blue|geekblue|purple|magenta|grey](-[light|dark])?(-h)?
normal
\u672c\u8eab\u5373\u662f\u57fa\u672c\u8272\uff0c\u6240\u4ee5\u53ef\u4ee5\u88ab\u5ffd\u7565\ngrey
\u53ef\u80fd\u4f1a\u66f4\u5e38\u7528\uff0c\u6240\u4ee5\u989d\u5916\u589e\u52a0 grey-lighter
\u3001grey-darker
\u522b\u540d\u8868\u793a\u6df1\u5ea6
\u793a\u4f8b\uff1a
// Text color\n.text-red-light { color: #fabeb9 !important; }\n.text-red { color: #f04134 !important; }\n.text-red-dark { color: #a31837 !important; }\n\n// background-color color\n.bg-red-light { background-color: #fabeb9 !important; }\n.bg-red { background-color: #f04134 !important; }\n.bg-red-dark { background-color: #a31837 !important; }\n\n// hover color\n.bg-red-light-h { &:hover { background-color: #fabeb9 !important; } }\n.bg-red-h { &:hover { background-color: #f04134 !important; } }\n.bg-red-dark-h { &:hover { background-color: #a31837 !important; } }
\u522b\u540d
\u522b\u540d \u8272\u7cfb primary
@blue-6
#1890ffsuccess
@green-6
#52c41aerror
@red-5
#ff4d4fwarning
@gold-6
#faad14info
@blue-6
#1890ffprocessing
@blue-6
#1890ffhighlight
@red-5
#ff4d4fnormal
#d9d9d9
#d9d9d9
\u793a\u4f8b\uff1a
// Text color\n.text-error-light { color: #fabeb9 !important; }\n.text-error { color: #f04134 !important; }\n.text-error-dark { color: #a31837 !important; }\n\n// background-color color\n.bg-error-light { background-color: #fabeb9 !important; }\n.bg-error { background-color: #f04134 !important; }\n.bg-error-dark { background-color: #a31837 !important; }\n\n// hover color\n.bg-error-light-h { &:hover { background-color: #fabeb9 !important; } }\n.bg-error-h { &:hover { background-color: #f04134 !important; } }\n.bg-error-dark-h { &:hover { background-color: #a31837 !important; } }
\u5168\u91cf\u989c\u8272
\u4f60\u53ef\u4ee5\u4f7f\u7528 @enable-all-colors: true
\u6765\u5f00\u542f\u6240\u6709 120 \u4e2a\u989c\u8272\u7684\u89c4\u5219\u3002
.text-red-1 { color: #fff1f0 !important; }\n.text-red-6 { color: #f04134 !important; }\n.text-red-10 { color: #5c0011 !important; }\n\n.bg-red-6 { color: #f04134 !important; }\n.bg-red-6-h { color: #f04134 !important; }
\u6e05\u9664\u6d6e\u52a8
\u6e05\u9664\u6d6e\u52a8 .clearfix
\u3002
\u663e\u793a
\u522b\u540d CSS d-none
display: none
d-block
display: block
d-inline-block
display: inline-block
d-flex
display: flex
d-inline-flex
display: inline-flex
justify-content-start
justify-content: flex-start
justify-content-end
justify-content: flex-end
justify-content-center
justify-content: center
justify-content-between
justify-content: space-between
justify-content-around
justify-content: space-around
align-items-start
align-items: flex-start
align-items-end
align-items: flex-end
align-items-center
align-items: center
align-items-baseline
align-items: baseline
align-items-stretch
align-items: stretch
align-content-start
align-content: flex-start
align-content-end
align-content: flex-end
align-content-center
align-content: center
align-content-between
align-content: space-between
align-content-around
align-content: space-around
align-content-stretch
align-content: stretch
align-self-auto
align-self: auto
align-self-start
align-self: flex-start
align-self-end
align-self: flex-end
align-self-center
align-self: center
align-self-baseline
align-self: baseline
align-self-stretch
align-self: stretch
flex-center
display: flex; align-items: center;
flex-center-between
display: flex; align-items: center; align-content: space-between;
\u4f4d\u7f6e
\u540d\u79f0 \u8bf4\u660e overflow-auto
overflow: auto
overflow-hidden
overflow: hidden
fixed-top
\u56fa\u5b9a\u9876\u90e8 fixed-bottom
\u56fa\u5b9a\u5e95\u90e8
\u6587\u672c
\u5927\u5c0f
Ant Design \u662f\u4ee5 14px
\u4e3a\u57fa\u51c6\u5b57\u53f7\u3002
\u540d\u79f0 \u8bf4\u660e text-xs
12px
text-sm
14px
text-md
16px
text-lg
18px
text-xl
22px
\u5bf9\u9f50
\u540d\u79f0 \u8bf4\u660e text-left
\u6587\u672c\u5c45\u5de6 text-center
\u6587\u672c\u5c45\u4e2d text-right
\u6587\u672c\u5c45\u53f3
\u6ea2\u51fa
\u5bb9\u5668\u5fc5\u987b\u662f display: inline-block
\u6216 display: block
\u3002
\u540d\u79f0 \u8bf4\u660e text-nowrap
\u6587\u672c\u8d85\u51fa\u4e0d\u6362\u884c text-truncate
\u6587\u672c\u8d85\u51fa\u622a\u53d6\u5e76\u52a0 ...
Transformation
\u540d\u79f0 \u8bf4\u660e text-lowercase
\u5c0f\u5199\u6587\u672c text-uppercase
\u5927\u5199\u6587\u672c text-capitalize
\u9996\u8bcd\u5927\u5199 text-deleted
\u5220\u9664\u7ebf
Weight and italics
\u540d\u79f0 \u8bf4\u660e font-weight-normal
font-weight: normal
font-weight-bold
font-weight: 700
font-italic
font-style: italic
Other
\u540d\u79f0 \u8bf4\u660e text-hover
*:hover { color: @primary-color; }
disabled
\u7981\u6b62
Borders
\u8fb9\u6846
\u540d\u79f0 \u8bf4\u660e border
border: 1px solid #f5f5f5 !important;
border-0
border: 0 !important;
border-top-0
border-top: 0 !important;
border-right-0
border-right: 0 !important;
border-bottom-0
border-bottom: 0 !important;
border-left-0
border-left: 0 !important;
\u989c\u8272
\u652f\u6301\u8272\u5f69\u7ae0\u8282\u6240\u6709\u7684\u8272\u7cfb&\u522b\u540d\u5199\u6cd5\uff0c\u4f8b\u5982\uff1aborder-red
\u3001border-success
\u3002
\u5706\u89d2
\u540d\u79f0 \u8bf4\u660e rounded-0
border-radius: 0;
rounded-circle
border-radius: 50%;
rounded-sm
border-radius: 2px;
rounded-md
border-radius: 4px;
rounded-lg
border-radius: 6px;
Width
\u540d\u79f0 \u8bf4\u660e width-sm
160px
width-md
240px
width-lg
320px
width-[0-10]
0%-100%
Responsive
\u7c7b\u4f3c Bootstrap \u54cd\u5e94\u5f0f\u89c4\u5219\uff0c\u5f53\u5c4f\u5e55\u5c0f\u4e8e 480px
\u65f6\u4f1a\u9690\u85cf\u6240\u6709 hidden-xs
\u7c7b\u3002
\u540d\u79f0 \u5c4f\u5e55 hidden-xs
<480px hidden-sm
<768px hidden-md
<992px hidden-lg
<1200px hidden-pc
<768px hidden-mobile
>768px
\u65cb\u8f6c
.rotate-[360 / 15]
\u4f8b\u5982\uff1a
// \u65cb\u8f6c15\u5ea6\n.rotate-15\n// \u65cb\u8f6c90\u5ea6\n.rotate-90\n// \u65cb\u8f6c360\u5ea6\n.rotate-360
Other
\u540d\u79f0 \u8bf4\u660e block-center
margin: 0 auto
point
cursor: pointer
no-data
\u7a7a\u6570\u636e\u884c no-resize
\u8bbe\u7f6e\u4e0d\u5141\u8bb8\u8c03\u6574\u5143\u7d20 bg-center
\u80cc\u666f\u56fe\u5782\u76f4\u5c45\u4e2d scrollbar
\u7f8e\u5316 div \u6eda\u52a8\u6761 color-weak
\u8272\u5f31\u6a21\u5f0f
\u5c0f\u90e8\u4ef6
\u7011\u5e03\u6d41
\u5728\u7ebf\u793a\u4f8b\u3002
\u540d\u79f0 \u8bf4\u660e row-masonry
\u884c row-masonry-{xs|sm|md|lg|xl}-{1-10}
\u5217\uff0c\u54cd\u5e94\u5f0f\u6837\u5f0f col-masonry
\u5217
ng-zorro
nz-card
\u540d\u79f0 \u8bf4\u660e ant-card__body-nopadding
\u5f3a\u5236\u5185\u5bb9\u65e0\u95f4\u8ddd
nz-modal
\u540d\u79f0 \u8bf4\u660e modal-{sm|md|lg|xl}
\u8bbe\u7f6eModal\u7684\u5927\u5c0f\uff0cwrapClassName: \'modal-lg\'
modal-body-nopadding
\u5185\u5bb9\u65e0\u5185\u8fb9\u8ddd modal-header
\u81ea\u5b9a\u4e49Modal\u65f6\u975e\u5e38\u6709\u6548\uff0cDEMO modal-footer
\u81ea\u5b9a\u4e49Modal\u65f6\u975e\u5e38\u6709\u6548\uff0cDEMO
nz-table
\u540d\u79f0 \u8bf4\u660e ant-table-rep__title
\u6807\u9898 ant-table-rep__hide-header-footer
\u5c0f\u5c4f\u5e55\u65f6\u624d\u663e\u793a\u6807\u9898\u6216\u5e95\u90e8
nz-tag
\u540d\u79f0 \u8bf4\u660e ant-tag__plus
\u589e\u52a0\u6309\u94ae\u6837\u5f0f ',meta:{type:"Theme",order:2,title:"\u6837\u5f0f\u5de5\u5177\u7c7b"},toc:[{id:"\u95f4\u8ddd",title:"\u95f4\u8ddd",h:2},{id:"\u8272\u5f69",title:"\u8272\u5f69",h:2,children:[{id:"\u522b\u540d",title:"\u522b\u540d",h:3},{id:"\u5168\u91cf\u989c\u8272",title:"\u5168\u91cf\u989c\u8272",h:3}]},{id:"\u6e05\u9664\u6d6e\u52a8",title:"\u6e05\u9664\u6d6e\u52a8",h:2},{id:"\u663e\u793a",title:"\u663e\u793a",h:2},{id:"\u4f4d\u7f6e",title:"\u4f4d\u7f6e",h:2},{id:"\u6587\u672c",title:"\u6587\u672c",h:2,children:[{id:"\u5927\u5c0f",title:"\u5927\u5c0f",h:3},{id:"\u5bf9\u9f50",title:"\u5bf9\u9f50",h:3},{id:"\u6ea2\u51fa",title:"\u6ea2\u51fa",h:3},{id:"Transformation",title:"Transformation",h:3},{id:"Weightanditalics",title:"Weight and italics",h:3},{id:"Other",title:"Other",h:3}]},{id:"Borders",title:"Borders",h:2,children:[{id:"\u8fb9\u6846",title:"\u8fb9\u6846",h:3},{id:"\u989c\u8272",title:"\u989c\u8272",h:3},{id:"\u5706\u89d2",title:"\u5706\u89d2",h:3}]},{id:"Width",title:"Width",h:2},{id:"Responsive",title:"Responsive",h:2},{id:"\u65cb\u8f6c",title:"\u65cb\u8f6c",h:2},{id:"Other",title:"Other",h:2},{id:"\u5c0f\u90e8\u4ef6",title:"\u5c0f\u90e8\u4ef6",h:2,children:[{id:"\u7011\u5e03\u6d41",title:"\u7011\u5e03\u6d41",h:3}]},{id:"ng-zorro",title:"ng-zorro",h:2,children:[{id:"nz-card",title:"nz-card",h:3},{id:"nz-modal",title:"nz-modal",h:3},{id:"nz-table",title:"nz-table",h:3},{id:"nz-tag",title:"nz-tag",h:3}]}]}},demo:!1},this.codes=[]}static#t=this.\u0275fac=function(e){return new(e||t)};static#e=this.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-tools"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(e,o){1&e&&d._UZ(0,"app-docs",0),2&e&&d.Q6J("codes",o.codes)("item",o.item)},dependencies:[c.P],styles:["[_nghost-%COMP%]{display:block}"]})}return t})(),z=(()=>{class t{constructor(){this.item={cols:1,urls:{"en-US":"packages/theme/layout-default/index.en-US.md","zh-CN":"packages/theme/layout-default/index.zh-CN.md"},content:{"en-US":{content:'The default layout all parameters are prefixed with @alain-default-
.
Usage
1. Style import
Import in src/styles.less
:
@import \'@delon/theme/layout-default/style/index\';
2. Using layout-default
component
Creat a new layout in src/app/layout/basic/basic.component.ts
:
import { Component } from \'@angular/core\';\nimport { SettingsService, User } from \'@delon/theme\';\nimport { LayoutDefaultOptions } from \'@delon/theme/layout-default\';\nimport { environment } from \'@env/environment\';\n\n@Component({\n selector: \'layout-basic\',\n template: `\n <layout-default [options]="options" [asideUser]="asideUserTpl" [nav]="navTpl" [content]="contentTpl">\n <layout-default-header-item direction="left">\n <a layout-default-header-item-trigger href="//github.com/ng-alain/ng-alain" target="_blank">\n <i nz-icon nzType="github"></i>\n </a>\n </layout-default-header-item>\n <layout-default-header-item direction="left" hidden="pc">\n <div layout-default-header-item-trigger (click)="searchToggleStatus = !searchToggleStatus">\n <i nz-icon nzType="search"></i>\n </div>\n </layout-default-header-item>\n <layout-default-header-item direction="middle">\n <header-search class="alain-default__search" [toggleChange]="searchToggleStatus" />\n </layout-default-header-item>\n <layout-default-header-item direction="right" hidden="mobile">\n <header-task />\n </layout-default-header-item>\n <ng-template #asideUserTpl>\n <div nz-dropdown nzTrigger="click" [nzDropdownMenu]="userMenu" class="alain-default__aside-user">\n <nz-avatar class="alain-default__aside-user-avatar" [nzSrc]="user.avatar" />\n <div class="alain-default__aside-user-info">\n <strong>{{ user.name }}</strong>\n <p class="mb0">{{ user.email }}</p>\n </div>\n </div>\n <nz-dropdown-menu #userMenu="nzDropdownMenu">\n <ul nz-menu>\n <li nz-menu-item routerLink="/pro/account/center">{{ \'menu.account.center\' | i18n }}</li>\n <li nz-menu-item routerLink="/pro/account/settings">{{ \'menu.account.settings\' | i18n }}</li>\n </ul>\n </nz-dropdown-menu>\n </ng-template>\n <ng-template #navTpl>\n <layout-default-nav class="d-block py-lg" />\n </ng-template>\n <ng-template #contentTpl>\n <router-outlet />\n </ng-template>\n </layout-default>\n\n <setting-drawer *ngIf="showSettingDrawer" />\n <theme-btn />\n `,\n})\nexport class LayoutBasicComponent {\n options: LayoutDefaultOptions = {\n logoExpanded: `./assets/logo-full.svg`,\n logoCollapsed: `./assets/logo.svg`,\n };\n searchToggleStatus = false;\n showSettingDrawer = !environment.production;\n get user(): User {\n return this.settings.user;\n }\n\n constructor(private settings: SettingsService) {}\n}
The layout can be dynamically managed at runtime through the LayoutDefaultService
service. In addition, in layout operations, you can subscribe to layout changes through SettingsService.notify
(for example: sidebar show and hide, etc.). Note that all layout-related changes will pass through this interface, so you need to do filter
operation.
',api:'API
layout-default
Property Description Type Default [options]
Options of the layout LayoutDefaultOptions
-
[asideUser]
Side user of the layout TemplateRef<void>
-
[asideBottom]
Bottom information of the layout TemplateRef<void>
-
[nav]
Nav TemplateRef<void>
-
[content]
Content TemplateRef<void>
-
[customError]
Custom exception routing error message, can\'t show when is null
string, null
Could not load ${evt.url} route
[fetchingStrictly]
Precise check top loading animation state boolean
false
[fetching]
Top loading animation state boolean
false
LayoutDefaultOptions
Property Description Type Default [logo]
Custom Logo Area TemplateRef<void>
- [logoExpanded]
Logo url of expanded status string
./assets/logo-full.svg
[logoCollapsed]
Logo url of collapsed status string
./assets/logo.svg
[logoFixWidth]
Specify a fixed logo width number
- [logoLink]
Specify the logo routing address string
/
[hideAside]
Hide the sidebar without showing the collapsed icon button boolean
false
[hideHeader]
Hide top bar boolean
false
[showHeaderCollapse]
Whether to display the menu collapse button on the top bar boolean
true
[showSiderCollapse]
Whether to show the menu collapse button at the bottom of the sidebar boolean
false
layout-default-nav
Property Description Type Default [disabledAcl]
Displayed disabled
state when acl
check fails. boolean
false
[autoCloseUnderPad]
When the route width is less than the Pad width, the sidebar is automatically closed. boolean
true
[recursivePath]
Automatic up recursive lookup, menu data source contains /ware
, then /ware/1
is also treated as /ware
boolean
true
[openStrictly]
Precise check open status, does not auto closed other open item boolean
false
[maxLevelIcon]
Icon displays up to which level number
3
(select)
Callback when clicking menu (including disabled
) EventEmitter<Menu>
-
The component data comes from MenuService
(which is structured as Menu), and the operation of MenuService
is auto synchronized to the component.
layout-default-header-item
Property Description Type Default [hidden]
Hidden behavior of the header item pc, mobile, none
nones
[direction]
Direction of the header item left, middle, right
right
layout-default-header-item-trigger
The trigger style of the head item.
layout-default-top-menu-item
Header business menu item, please refer to layout.component.ts(Preview).
Layout description
In the upper-left-right layout mode, it is applied to the development of the business page. Its specification details:
Top area height 64px
\uff08parameter\uff1a@header-hg
\uff09
Side area width 200px
\uff08parameter\uff1a@aside-wd
\uff09
Hide side navigation when the screen is below 1140px
wide
Turn the side navigation to the fixed
state when the screen is below 1140px
wide
Mainly includes a layout-default-nav component
Parameters are adjustable as needed by the src/styles/theme.less
file.
Top area
location\uff1asrc/app/layout/base/header
Scaffolding provides some regular top-level components by default, which are stored in the components directory. At the same time @delon/abc
also provides several top components (eg\uff1anotice-icon Notification menu component. You can build it yourself or develop it yourself based on the components provided.
Scaffolding supports responsive layout. For the top area, you may need to hide some components under the small screen, so you can add hidden-xs
to the corresponding DOM node to automatically hide when the screen is smaller than 768px
.
Side area
location\uff1asrc/app/layout/default/sidebar
Only one user information and main menu are included. The main menu is a layout-default-nav component.
Internal area
The content area is the business page area, the specification details\uff1a
Content distance page standard, side, right scroll bar, bottom, this margin is based on a standard Dashboard Gutter width 24px
.
Less Parameters
Name Default Description @alain-default-prefix
.alain-default
Style name prefix @alain-default-ease
cubic-bezier(.25, 0, .15, 1)
Animation filter function @alain-default-header-hg
64px
Height of header @alain-default-header-bg
@primary-color
Background-color of header @alain-default-header-padding
@layout-gutter * 2
Horizontal padding of header @alain-default-header-search-enabled
true
Whether top search @alain-default-header-icon-fs
18px
Font size of icon @alain-default-header-logo-max-height
36px
Max height of logo @alain-default-aside-wd
200px
Width of aside @alain-default-aside-bg
#fff
Background-color of aside @alain-default-aside-scrollbar-width
0
Scrollbar width of aside @alain-default-aside-scrollbar-height
0
Scrollbar height of aside @alain-default-aside-scrollbar-track-color
transparent
Scrollbar track color of aside @alain-default-aside-scrollbar-thumb-color
transparent
Scrollbar thumb color of aside @alain-default-aside-nav-fs
14px
Font size of nav name @alain-default-aside-nav-icon-width
14px
Width of nav icon @alain-default-aside-nav-img-wh
14px
Width & height of nav image @alain-default-aside-nav-padding-top-bottom
@layout-gutter
Vertical padding of nav @alain-default-aside-nav-padding-left-right
@layout-gutter * 2
Horizontal padding of nav @alain-default-aside-nav-text-color
rgba(0, 0, 0, 0.65)
Nav text color @alain-default-aside-nav-text-hover-color
#108ee9
Nav text hover color @alain-default-aside-nav-group-text-color
rgba(0, 0, 0, 0.43)
Group text color @alain-default-aside-nav-selected-text-color
#108ee9
Nav selected text color @alain-default-aside-nav-selected-bg
#fcfcfc
Nav selected background color @alain-default-aside-collapsed-wd
@layout-gutter * 8
Width of aside collapsed @alain-default-aside-collapsed-nav-fs
24px
Font size of aside collapsed @alain-default-aside-collapsed-nav-img-wh
24px
Width & height nav image of aside collapsed @alain-default-content-heading-bg
#fafbfc
Heading background color of content area @alain-default-content-heading-border
#efe3e5
Heading bottom border color of content area @alain-default-content-padding
@layout-gutter * 3
Padding of content area @alain-default-content-bg
#f5f7fa
Background color of content area @alain-default-widget-app-icons-enabled
true
Whether the app-icon widget styles @alain-default-aside-user-enabled
true
Whether the user styles of aside
FAQ
Why are there two shortcut menus?
The shortcut menu generation rules are uniformly searched under the 0
index\uff0cand get in the following order:
Recommended children have shortcutRoot: true
which is the highest priority
Otherwise, find the link with the word dashboard, if it exists, create a shortcut entry below the menu.
Otherwise placed at the 0 node position
Therefore, it\'s recommended to keep a valid shortcutRoot: true
data under the 0
index of the menu data.
FAQ
Hide main menu item
You can set hide: true
in the menu.
Hide auto-generated navigation hide breadcrumbs
You can set hideInBreadcrumb: true
in the menu.
About level
Although unlimited levels are supported, please keep no more than four levels (including groups) for user experience.
How to update a menu item
The menu will be re-rendered via calling MenuService.setItem(key, newValue)
, please refer to the definition of Menu.
How to control menu expand
Use LayoutDefaultService.toggleCollapsed()
for manual control at runtime.
',meta:{type:"Theme",order:100,title:"Default Layout"},toc:[{id:"Usage",title:"Usage",h:2,children:[{id:"1.Styleimport",title:"1. Style import",h:3},{id:"2.Usinglayout-defaultcomponent",title:"2. Using layout-default component",h:3}]},{id:"API",title:"API",h:2,children:[{id:"layout-default",title:"layout-default",h:3},{id:"LayoutDefaultOptions",title:"LayoutDefaultOptions",h:3},{id:"layout-default-nav",title:"layout-default-nav",h:3},{id:"layout-default-header-item",title:"layout-default-header-item",h:3},{id:"layout-default-header-item-trigger",title:"layout-default-header-item-trigger",h:3},{id:"layout-default-top-menu-item",title:"layout-default-top-menu-item",h:3}]},{id:"Layoutdescription",title:"Layout description",h:2},{id:"LessParameters",title:"Less Parameters",h:2},{id:"FAQ",title:"FAQ",h:2,children:[{id:"Whyaretheretwoshortcutmenus",title:"Why are there two shortcut menus?",h:3},{id:"FAQ",title:"FAQ",h:3}]}]},"zh-CN":{content:'\u9ed8\u8ba4\u5e03\u5c40\u6240\u6709\u53c2\u6570\u90fd\u4ee5 @alain-default-
\u5f00\u5934\u3002
\u4f7f\u7528\u65b9\u5f0f
1\u3001\u5bfc\u5165\u6837\u5f0f
\u5728 src/styles.less
\u5f15\u5165\uff1a
@import \'@delon/theme/layout-default/style/index\';
2\u3001\u4f7f\u7528 layout-default
\u7ec4\u4ef6
\u5728 src/app/layout/basic/basic.component.ts
\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u5e03\u5c40\uff1a
import { Component } from \'@angular/core\';\nimport { SettingsService, User } from \'@delon/theme\';\nimport { LayoutDefaultOptions } from \'@delon/theme/layout-default\';\nimport { environment } from \'@env/environment\';\n\n@Component({\n selector: \'layout-basic\',\n template: `\n <layout-default [options]="options" [asideUser]="asideUserTpl" [nav]="navTpl" [content]="contentTpl">\n <layout-default-header-item direction="left">\n <a layout-default-header-item-trigger href="//github.com/ng-alain/ng-alain" target="_blank">\n <i nz-icon nzType="github"></i>\n </a>\n </layout-default-header-item>\n <layout-default-header-item direction="left" hidden="pc">\n <div layout-default-header-item-trigger (click)="searchToggleStatus = !searchToggleStatus">\n <i nz-icon nzType="search"></i>\n </div>\n </layout-default-header-item>\n <layout-default-header-item direction="middle">\n <header-search class="alain-default__search" [toggleChange]="searchToggleStatus" />\n </layout-default-header-item>\n <layout-default-header-item direction="right" hidden="mobile">\n <header-task />\n </layout-default-header-item>\n <ng-template #asideUserTpl>\n <div nz-dropdown nzTrigger="click" [nzDropdownMenu]="userMenu" class="alain-default__aside-user">\n <nz-avatar class="alain-default__aside-user-avatar" [nzSrc]="user.avatar" />\n <div class="alain-default__aside-user-info">\n <strong>{{ user.name }}</strong>\n <p class="mb0">{{ user.email }}</p>\n </div>\n </div>\n <nz-dropdown-menu #userMenu="nzDropdownMenu">\n <ul nz-menu>\n <li nz-menu-item routerLink="/pro/account/center">{{ \'menu.account.center\' | i18n }}</li>\n <li nz-menu-item routerLink="/pro/account/settings">{{ \'menu.account.settings\' | i18n }}</li>\n </ul>\n </nz-dropdown-menu>\n </ng-template>\n <ng-template #navTpl>\n <layout-default-nav class="d-block py-lg" />\n </ng-template>\n <ng-template #contentTpl>\n <router-outlet />\n </ng-template>\n </layout-default>\n\n <setting-drawer *ngIf="showSettingDrawer" />\n <theme-btn />\n `,\n})\nexport class LayoutBasicComponent {\n options: LayoutDefaultOptions = {\n logoExpanded: `./assets/logo-full.svg`,\n logoCollapsed: `./assets/logo.svg`,\n };\n searchToggleStatus = false;\n showSettingDrawer = !environment.production;\n get user(): User {\n return this.settings.user;\n }\n\n constructor(private settings: SettingsService) {}\n}
\u901a\u8fc7 LayoutDefaultService
\u670d\u52a1\u53ef\u4ee5\u5728\u8fd0\u884c\u65f6\u52a8\u6001\u7ba1\u7406\u5e03\u5c40\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u5728\u5e03\u5c40\u7684\u64cd\u4f5c\u90fd\u53ef\u4ee5\u901a\u8fc7 SettingsService.notify
\u6765\u8ba2\u9605\u5e03\u5c40\u7684\u53d8\u5316\uff08\u4f8b\u5982\uff1a\u4fa7\u8fb9\u680f\u7684\u5c55\u5f00\u4e0e\u6536\u7f29\u7b49\uff09\uff0c\u6ce8\u610f\u6240\u6709\u5e03\u5c40\u76f8\u5173\u7684\u53d8\u5316\u90fd\u4f1a\u901a\u8fc7\u8fd9\u4e2a\u63a5\u53e3\uff0c\u6240\u4ee5\u9700\u8981\u505a\u597d filter
\u64cd\u4f5c\u3002
',api:'API
layout-default
\u6210\u5458 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [options]
\u9009\u9879 LayoutDefaultOptions
-
[asideUser]
\u4fa7\u8fb9\u7528\u6237\u4fe1\u606f TemplateRef<void>
-
[asideBottom]
\u4fa7\u8fb9\u5e95\u90e8\u4fe1\u606f TemplateRef<void>
-
[nav]
\u5bfc\u822a\u4fe1\u606f TemplateRef<void>
-
[content]
\u5185\u5bb9\u4fe1\u606f TemplateRef<void>
-
[customError]
\u81ea\u5b9a\u4e49\u5f02\u5e38\u8def\u7531\u9519\u8bef\u6d88\u606f\uff0c\u5f53 null
\u65f6\u8868\u793a\u4e0d\u663e\u793a\u9519\u8bef\u6d88\u606f string, null
Could not load ${evt.url} route
[fetchingStrictly]
\u662f\u5426\u5b8c\u5168\u53d7\u63a7\u9876\u90e8\u52a0\u8f7d\u52a8\u753b\u72b6\u6001 boolean
false
[fetching]
\u9876\u90e8\u52a0\u8f7d\u52a8\u753b\u72b6\u6001 boolean
false
LayoutDefaultOptions
\u6210\u5458 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [logo]
\u81ea\u5b9a\u4e49 Logo \u533a\u57df TemplateRef<void>
- [logoExpanded]
\u5c55\u5f00\u65f6 Logo \u5730\u5740 string
./assets/logo-full.svg
[logoCollapsed]
\u6536\u7f29\u65f6 Logo \u5730\u5740 string
./assets/logo.svg
[logoFixWidth]
\u6307\u5b9a\u56fa\u5b9a Logo \u5bbd\u5ea6 number
- [logoLink]
\u6307\u5b9a Logo \u8def\u7531\u5730\u5740 string
/
[hideAside]
\u9690\u85cf\u4fa7\u8fb9\u680f\uff0c\u540c\u65f6\u4e0d\u663e\u6536\u7f29\u56fe\u6807\u6309\u94ae boolean
false
[hideHeader]
\u9690\u85cf\u9876\u680f boolean
false
[showHeaderCollapse]
\u662f\u5426\u5728\u9876\u680f\u663e\u793a\u83dc\u5355\u6298\u53e0\u6309\u94ae boolean
true
[showSiderCollapse]
\u662f\u5426\u5728\u4fa7\u8fb9\u680f\u5e95\u90e8\u663e\u793a\u83dc\u5355\u6298\u53e0\u6309\u94ae boolean
false
layout-default-nav
\u6210\u5458 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [disabledAcl]
acl
\u6821\u9a8c\u5931\u8d25\u65f6\u4ee5 disabled
\u72b6\u6001\u663e\u793aboolean
false
[autoCloseUnderPad]
\u5c0f\u4e8ePad\u5bbd\u5ea6\u65f6\u8def\u7531\u5207\u6362\u540e\u81ea\u52a8\u5173\u95ed\u4fa7\u8fb9\u680f boolean
true
[recursivePath]
\u81ea\u52a8\u5411\u4e0a\u9012\u5f52\u67e5\u627e\uff0c\u83dc\u5355\u6570\u636e\u6e90\u5305\u542b /ware
\uff0c\u5219 /ware/1
\u4e5f\u89c6\u4e3a /ware
\u9879 boolean
true
[openStrictly]
\u5c55\u5f00\u5b8c\u5168\u53d7\u63a7\uff0c\u4e0d\u518d\u81ea\u52a8\u5173\u95ed\u5df2\u5c55\u5f00\u7684\u9879 boolean
false
[maxLevelIcon]
Icon\u6700\u591a\u663e\u793a\u5230\u7b2c\u51e0\u5c42 number
3
(select)
\u70b9\u51fb\u83dc\u5355\u65f6\u56de\u8c03\uff08\u5305\u542b disabled
\uff09 EventEmitter<Menu>
-
\u7ec4\u4ef6\u7684\u6570\u636e\u6765\u81ea MenuService
\uff08\u5176\u7ed3\u6784\u4e3a Menu\uff09\uff0c MenuService
\u7684\u64cd\u4f5c\u4f1a\u81ea\u52a8\u540c\u6b65\u81f3\u8be5\u7ec4\u4ef6\u3002
layout-default-header-item
\u6210\u5458 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [hidden]
\u9690\u85cf\u884c\u4e3a pc, mobile, none
nones
[direction]
\u65b9\u5411 left, middle, right
right
layout-default-header-item-trigger
\u5934\u90e8\u9879\u7684\u89e6\u53d1\u6837\u5f0f\u3002
layout-default-top-menu-item
\u5934\u90e8\u4e1a\u52a1\u83dc\u5355\u9879\uff0c\u4f7f\u7528\u65b9\u5f0f\u8bf7\u53c2\u8003 layout.component.ts(\u9884\u89c8)\u3002
\u5e03\u5c40\u8bf4\u660e
\u6309\u4e0a-\u5de6-\u53f3\u5e03\u5c40\u65b9\u5f0f\uff0c\u8fd0\u7528\u4e8e\u4e1a\u52a1\u9875\u7684\u5f00\u53d1\u3002\u5176\u89c4\u8303\u7ec6\u8282\uff1a
\u9876\u90e8\u533a\u57df\u9ad8\u5ea6 64px
\uff08\u53c2\u6570\uff1a@header-hg
\uff09
\u4fa7\u8fb9\u533a\u57df\u5bbd\u5ea6 200px
\uff08\u53c2\u6570\uff1a@aside-wd
\uff09
\u5f53\u5c4f\u5e55\u4f4e\u4e8e 1140px
\u5bbd\u65f6\u9690\u85cf\u4fa7\u8fb9\u5bfc\u822a
\u5f53\u5c4f\u5e55\u4f4e\u4e8e 1140px
\u5bbd\u65f6\u6253\u5f00\u4fa7\u8fb9\u5bfc\u822a\u4e3a fixed
\u72b6\u6001
\u4e3b\u8981\u5305\u62ec\u4e00\u4e2a layout-default-nav \u7ec4\u4ef6
\u53c2\u6570\u662f\u6307\u53ef\u4ee5\u901a\u8fc7 src/styles/theme.less
\u6587\u4ef6\u6309\u9700\u8981\u8c03\u6574\u3002
\u9876\u90e8\u533a\u57df
\u4f4d\u7f6e\uff1asrc/app/layout/base/widgets\u3002
\u811a\u624b\u67b6\u9ed8\u8ba4\u63d0\u4f9b\u4e86\u4e00\u4e9b\u5e38\u89c4\u9876\u90e8\u533a\u57df\u7ec4\u4ef6\uff0c\u8fd9\u4e9b\u7ec4\u4ef6\u90fd\u5b58\u653e\u4e8e components \u76ee\u5f55\u4e2d\u3002\u540c\u65f6 @delon/abc
\u4e5f\u63d0\u4f9b\u82e5\u5e72\u9876\u90e8\u7ec4\u4ef6\uff08\u4f8b\u5982\uff1anotice-icon \u901a\u77e5\u83dc\u5355\u7ec4\u4ef6\uff09\u3002\u4f60\u53ef\u4ee5\u6839\u636e\u63d0\u4f9b\u7684\u7ec4\u4ef6\u81ea\u884c\u7ec4\u5408\u6216\u81ea\u884c\u5f00\u53d1\u3002
\u811a\u624b\u67b6\u652f\u6301\u54cd\u5e94\u5f0f\u5e03\u5c40\uff0c\u5bf9\u4e8e\u9876\u90e8\u533a\u57df\u53ef\u80fd\u4f1a\u662f\u5728\u5c0f\u5c4f\u5e55\u4e0b\u9700\u8981\u9690\u85cf\u4e00\u4e9b\u7ec4\u4ef6\uff0c\u56e0\u6b64\u4f60\u53ef\u4ee5\u5728\u5bf9\u5e94\u7684DOM\u8282\u70b9\u4e0a\u52a0\u4e0a hidden-xs
\u8868\u793a\u5f53\u5c4f\u5e55\u5c0f\u4e8e 768px
\u65f6\u81ea\u52a8\u9690\u85cf\u3002
\u4fa7\u8fb9\u533a\u57df
\u4f4d\u7f6e\uff1asrc/app/layout/default/sidebar\u3002
\u53ea\u5305\u62ec\u4e00\u4e2a\u7528\u6237\u4fe1\u606f\u548c\u4e3b\u83dc\u5355\u3002\u4e3b\u83dc\u5355\u662f\u4e00\u4e2a layout-default-nav\u3002
\u5185\u90e8\u533a\u57df
\u5185\u5bb9\u533a\u57df\u662f\u4e1a\u52a1\u9875\u533a\u57df\uff0c\u89c4\u8303\u7ec6\u8282\uff1a
\u5185\u5bb9\u8ddd\u79bb\u9875\u9762\u6807\u51c6\u3001\u4fa7\u8fb9\u3001\u53f3\u8fb9\u6eda\u52a8\u6761\u3001\u5e95\u90e8\uff0c\u8fd9\u56db\u8fb9\u8ddd\u4f9d\u4e00\u4e2a\u6807\u51c6Dashboard\u7684Gutter\u5bbd\u5ea6 24px
\u3002
\u6837\u5f0f\u53c2\u6570
\u540d\u79f0 \u9ed8\u8ba4\u503c \u529f\u80fd @alain-default-prefix
.alain-default
\u5e03\u5c40\u6837\u5f0f\u524d\u7f00 @alain-default-ease
cubic-bezier(.25, 0, .15, 1)
\u52a8\u753b\u8fc7\u6ee4\u51fd\u6570 @alain-default-header-hg
64px
\u9876\u90e8\u9ad8\u5ea6 @alain-default-header-bg
@primary-color
\u9876\u90e8\u80cc\u666f\u8272 @alain-default-header-padding
@layout-gutter * 2
\u9876\u90e8\u5de6\u53f3\u5185\u8fb9\u8ddd @alain-default-header-search-enabled
true
\u662f\u5426\u5f00\u542f\u9876\u90e8\u641c\u7d22\u6846 @alain-default-header-icon-fs
18px
\u9876\u90e8 Icon \u5927\u5c0f @alain-default-header-logo-max-height
36px
Logo \u56fe\u6700\u9ad8\u9ad8\u5ea6 @alain-default-aside-wd
200px
\u4fa7\u8fb9\u680f\u5bbd\u5ea6 @alain-default-aside-bg
#fff
\u4fa7\u8fb9\u680f\u80cc\u666f\u8272 @alain-default-aside-scrollbar-width
0
\u4fa7\u8fb9\u680f\u6eda\u52a8\u6761\u5bbd\u5ea6 @alain-default-aside-scrollbar-height
0
\u4fa7\u8fb9\u680f\u6eda\u52a8\u6761\u9ad8\u5ea6 @alain-default-aside-scrollbar-track-color
transparent
\u4fa7\u8fb9\u680f\u6eda\u52a8\u6761\u7684\u8f68\u9053\u989c\u8272 @alain-default-aside-scrollbar-thumb-color
transparent
\u4fa7\u8fb9\u680f\u6eda\u52a8\u6761\u5c0f\u65b9\u5757\u989c\u8272 @alain-default-aside-nav-fs
14px
\u4fa7\u8fb9\u680f\u83dc\u5355\u5b57\u53f7 @alain-default-aside-nav-icon-width
14px
\u4fa7\u8fb9\u680f\u83dc\u5355 ICON \u5bbd\u5ea6 @alain-default-aside-nav-img-wh
14px
\u4fa7\u8fb9\u680f\u83dc\u5355\u56fe\u50cf\u5bbd\u9ad8 @alain-default-aside-nav-padding-top-bottom
@layout-gutter
\u4fa7\u8fb9\u680f\u83dc\u5355\u9879\u4e0a\u4e0b\u5185\u8fb9\u8ddd @alain-default-aside-nav-padding-left-right
@layout-gutter * 2
\u4fa7\u8fb9\u680f\u83dc\u5355\u9879\u5de6\u53f3\u5185\u8fb9\u8ddd @alain-default-aside-nav-text-color
rgba(0, 0, 0, 0.65)
\u4fa7\u8fb9\u680f\u83dc\u5355\u6587\u672c\u989c\u8272 @alain-default-aside-nav-text-hover-color
#108ee9
\u4fa7\u8fb9\u680f\u83dc\u5355\u6587\u672c\u60ac\u505c\u989c\u8272 @alain-default-aside-nav-group-text-color
rgba(0, 0, 0, 0.43)
\u4fa7\u8fb9\u680f\u83dc\u5355\u5206\u7ec4\u6587\u672c\u989c\u8272 @alain-default-aside-nav-selected-text-color
#108ee9
\u4fa7\u8fb9\u680f\u83dc\u5355\u6fc0\u6d3b\u65f6\u6587\u672c\u989c\u8272 @alain-default-aside-nav-selected-bg
#fcfcfc
\u4fa7\u8fb9\u680f\u83dc\u5355\u6fc0\u6d3b\u65f6\u80cc\u666f\u989c\u8272 @alain-default-aside-collapsed-wd
@layout-gutter * 8
\u4fa7\u8fb9\u680f\u6536\u7f29\u540e\u5bbd\u5ea6 @alain-default-aside-collapsed-nav-fs
24px
\u4fa7\u8fb9\u680f\u6536\u7f29\u540e\u6587\u672c\u5b57\u53f7 @alain-default-aside-collapsed-nav-img-wh
24px
\u4fa7\u8fb9\u680f\u6536\u7f29\u540e\u56fe\u50cf\u5bbd\u9ad8 @alain-default-content-heading-bg
#fafbfc
\u5185\u5bb9\u533a\u57df\u6807\u9898\u80cc\u666f\u8272 @alain-default-content-heading-border
#efe3e5
\u5185\u5bb9\u533a\u57df\u6807\u9898\u5e95\u90e8\u8fb9\u6846\u8272 @alain-default-content-padding
@layout-gutter * 3
\u5185\u5bb9\u533a\u57df\u5185\u8fb9\u8ddd @alain-default-content-bg
#f5f7fa
\u5185\u5bb9\u533a\u57df\u80cc\u666f\u8272 @alain-default-widget-app-icons-enabled
true
\u662f\u5426 app-icon \u5c0f\u90e8\u4ef6\u6837\u5f0f @alain-default-aside-user-enabled
true
\u662f\u5426\u4fa7\u8fb9\u680f\u7528\u6237\u4fe1\u606f\u6837\u5f0f
\u5e38\u89c1\u95ee\u9898
\u4e3a\u4ec0\u4e48\u4f1a\u6709\u4e24\u4e2a\u5feb\u6377\u83dc\u5355
\u5feb\u6377\u83dc\u5355\u751f\u6210\u89c4\u5219\u7edf\u4e00\u5728 0
\u7d22\u5f15\u4e0b\u67e5\u627e\uff0c\u5e76\u6309\u4ee5\u4e0b\u987a\u5e8f\u6765\u83b7\u53d6\uff1a
\u3010\u63a8\u8350\u3011 children \u5b58\u5728 shortcutRoot: true
\u5219\u6700\u4f18\u5148
\u5426\u5219\u67e5\u627e\u5e26\u6709\u3010dashboard\u3011\u5b57\u6837\u94fe\u63a5\uff0c\u82e5\u5b58\u5728\u5219\u5728\u6b64\u83dc\u5355\u7684\u4e0b\u65b9\u521b\u5efa\u5feb\u6377\u5165\u53e3
\u5426\u5219\u653e\u57280\u8282\u70b9\u4f4d\u7f6e
\u56e0\u6b64\uff0c\u5efa\u8bae\u5728\u83dc\u5355\u6570\u636e\u7684 0
\u7d22\u5f15\u4e0b\u4fdd\u6301\u4e00\u4e2a\u6709\u6548\u7684 shortcutRoot: true
\u6570\u636e\u3002
\u5e38\u89c1\u95ee\u9898
\u9690\u85cf\u4e3b\u83dc\u5355\u9879
\u8868\u793a\u6c38\u8fdc\u4e0d\u663e\u793a\u83dc\u5355\uff0c\u53ef\u4ee5\u5728\u83dc\u5355\u8bbe\u7f6e hide: true
\u3002
\u9690\u85cf\u81ea\u52a8\u751f\u6210\u5bfc\u822a\u9690\u85cf\u9762\u5305\u5c51
\u8868\u793a\u4e0d\u663e\u793a\u8be5\u8282\u70b9\uff0c\u53ef\u4ee5\u5728\u83dc\u5355\u8bbe\u7f6e hideInBreadcrumb: true
\u3002
\u5173\u4e8e\u5c42\u7ea7
\u867d\u7136\u652f\u6301\u65e0\u9650\u5c42\u7ea7\uff0c\u4f46\u4e3a\u4e86\u7528\u6237\u4f53\u9a8c\u8bf7\u4fdd\u6301\u6700\u591a\u4e0d\u8d85\u8fc7\u56db\u5c42\uff08\u542b\u7ec4\u522b\uff09\u3002
\u5982\u4f55\u66f4\u65b0\u67d0\u4e2a\u83dc\u5355\u9879
\u5f53\u8c03\u7528 MenuService.setItem(key, newValue)
\u65f6\u4f1a\u81ea\u52a8\u91cd\u65b0\u6e32\u67d3\u4e3b\u83dc\u5355\uff0c\u5176\u4e2d key
\u5fc5\u987b\u662f\u5b58\u5728\u503c\uff0c\u8bf7\u53c2\u8003 Menu \u7684\u5b9a\u4e49\u3002
\u5982\u4f55\u63a7\u5236\u83dc\u5355\u5c55\u5f00
\u5229\u7528 LayoutDefaultService.toggleCollapsed()
\u6765\u8fd0\u884c\u65f6\u624b\u52a8\u63a7\u5236\u3002
',meta:{type:"Theme",order:100,title:"\u9ed8\u8ba4\u5e03\u5c40"},toc:[{id:"\u4f7f\u7528\u65b9\u5f0f",title:"\u4f7f\u7528\u65b9\u5f0f",h:2,children:[{id:"1\u3001\u5bfc\u5165\u6837\u5f0f",title:"1\u3001\u5bfc\u5165\u6837\u5f0f",h:3},{id:"2\u3001\u4f7f\u7528layout-default\u7ec4\u4ef6",title:"2\u3001\u4f7f\u7528 layout-default \u7ec4\u4ef6",h:3}]},{id:"API",title:"API",h:2,children:[{id:"layout-default",title:"layout-default",h:3},{id:"LayoutDefaultOptions",title:"LayoutDefaultOptions",h:3},{id:"layout-default-nav",title:"layout-default-nav",h:3},{id:"layout-default-header-item",title:"layout-default-header-item",h:3},{id:"layout-default-header-item-trigger",title:"layout-default-header-item-trigger",h:3},{id:"layout-default-top-menu-item",title:"layout-default-top-menu-item",h:3}]},{id:"\u5e03\u5c40\u8bf4\u660e",title:"\u5e03\u5c40\u8bf4\u660e",h:2},{id:"\u6837\u5f0f\u53c2\u6570",title:"\u6837\u5f0f\u53c2\u6570",h:2},{id:"\u5e38\u89c1\u95ee\u9898",title:"\u5e38\u89c1\u95ee\u9898",h:2,children:[{id:"\u4e3a\u4ec0\u4e48\u4f1a\u6709\u4e24\u4e2a\u5feb\u6377\u83dc\u5355",title:"\u4e3a\u4ec0\u4e48\u4f1a\u6709\u4e24\u4e2a\u5feb\u6377\u83dc\u5355",h:3},{id:"\u5e38\u89c1\u95ee\u9898",title:"\u5e38\u89c1\u95ee\u9898",h:3}]}]}},demo:!1},this.codes=[]}static#t=this.\u0275fac=function(e){return new(e||t)};static#e=this.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-layout-default"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(e,o){1&e&&d._UZ(0,"app-docs",0),2&e&&d.Q6J("codes",o.codes)("item",o.item)},dependencies:[c.P],styles:["[_nghost-%COMP%]{display:block}"]})}return t})(),T=(()=>{class t{constructor(){this.item={cols:1,urls:{"en-US":"packages/theme/layout-blank/index.en-US.md","zh-CN":"packages/theme/layout-blank/index.zh-CN.md"},content:{"en-US":{content:'Used for any top and side areas, typically for highly customizable pages such as large screen data. The blank layout all parameters are prefixed with @alain-blank-
.
Usage
Import in src/styles.less
:
@import \'@delon/theme/layout-blank/style/index\';
Parameters
Name Default Description @prefix
.alain-blank
Style name prefix @bg
#f5f7fa
Background color @content-padding-vertical
0
Vertical padding @content-padding-horizontal
16px
Horizontal padding ',meta:{type:"Theme",order:110,title:"Blank Layout"},toc:[{id:"Usage",title:"Usage",h:2},{id:"Parameters",title:"Parameters",h:2}]},"zh-CN":{content:'\u7528\u4e8e\u65e0\u987b\u4efb\u4f55\u9876\u90e8\u548c\u4fa7\u8fb9\u533a\u57df\uff0c\u4e00\u822c\u7528\u4e8e\u9ad8\u5b9a\u5236\u6027\u9875\u9762\uff0c\u8bf8\u5982\u5927\u5c4f\u5e55\u6570\u636e\u7b49\u3002\u9ed8\u8ba4\u5e03\u5c40\u6240\u6709\u53c2\u6570\u90fd\u4ee5 @alain-blank-
\u5f00\u5934\u3002
\u4f7f\u7528\u65b9\u5f0f
\u5728 src/styles.less
\u5f15\u5165\uff1a
@import \'@delon/theme/layout-blank/style/index\';
\u53c2\u6570
\u540d\u79f0 \u9ed8\u8ba4\u503c \u529f\u80fd @prefix
.alain-blank
\u5e03\u5c40\u6837\u5f0f\u524d\u7f00 @bg
#f5f7fa
\u80cc\u666f\u8272 @content-padding-vertical
0
\u5782\u76f4\u5185\u8fb9\u8ddd @content-padding-horizontal
16px
\u6c34\u5e73\u5185\u8fb9\u8ddd ',meta:{type:"Theme",order:110,title:"\u7a7a\u767d\u5e03\u5c40"},toc:[{id:"\u4f7f\u7528\u65b9\u5f0f",title:"\u4f7f\u7528\u65b9\u5f0f",h:2},{id:"\u53c2\u6570",title:"\u53c2\u6570",h:2}]}},demo:!1},this.codes=[]}static#t=this.\u0275fac=function(e){return new(e||t)};static#e=this.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-layout-blank"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(e,o){1&e&&d._UZ(0,"app-docs",0),2&e&&d.Q6J("codes",o.codes)("item",o.item)},dependencies:[c.P],styles:["[_nghost-%COMP%]{display:block}"]})}return t})(),C=(()=>{class t{constructor(){this.item={cols:1,urls:{"en-US":"packages/theme/theme-btn/index.en-US.md","zh-CN":"packages/theme/theme-btn/index.zh-CN.md"},content:{"en-US":{content:'It is used to switch the customized style file during the running process, so as to play the online skin change function.
',api:"API
layout-default
Property Description Type Default [types]
Type of theme list ThemeBtnType[]
[ { key: 'default', text: 'Default Theme' }, { key: 'dark', text: 'Dark Theme' }, { key: 'compact', text: 'Compact Theme' }, ]
[devTips]
Tips in development String
When the dark.css file can't be found, you need to run it once: npm run theme
[deployUrl]
URL where files will be deployed. Generally needed when using ng b --deploy-url
String
-
(themeChange)
Theme Change Notification EventEmitter<string>
-
",meta:{type:"Theme",title:"theme-btn",subtitle:"Component-Change Style",cols:1,order:1001,module:"import { ThemeBtnModule } from '@delon/theme/theme-btn';"},toc:[{id:"API",title:"API",h:2,children:[{id:"layout-default",title:"layout-default",h:3}]}]},"zh-CN":{content:'\u7528\u4e8e\u5728\u8fd0\u884c\u8fc7\u7a0b\u4e2d\u5207\u6362\u5b9a\u5236\u6837\u5f0f\u6587\u4ef6\uff0c\u4ece\u800c\u8d77\u5230\u6362\u5728\u7ebf\u6362\u80a4\u529f\u80fd\u3002
',api:"API
layout-default
\u6210\u5458 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [types]
\u7c7b\u578b\u5217\u8868 ThemeBtnType[]
[ { key: 'default', text: 'Default Theme' }, { key: 'dark', text: 'Dark Theme' }, { key: 'compact', text: 'Compact Theme' }, ]
[devTips]
\u5f00\u53d1\u63d0\u793a String
When the dark.css file can't be found, you need to run it once: npm run theme
[deployUrl]
\u6587\u4ef6\u5c06\u90e8\u7f72\u5230\u7684 URL\uff0c\u4e00\u822c\u5230\u4f7f\u7528 ng b --deploy-url
\u65f6\u9700\u8981 String
-
(themeChange)
\u4e3b\u9898\u53d8\u66f4\u901a\u77e5 EventEmitter<string>
-
",meta:{type:"Theme",title:"theme-btn",subtitle:"\u7ec4\u4ef6-\u5207\u6362\u6837\u5f0f",cols:1,order:1001,module:"import { ThemeBtnModule } from '@delon/theme/theme-btn';"},toc:[{id:"API",title:"API",h:2,children:[{id:"layout-default",title:"layout-default",h:3}]}]}},demo:!1},this.codes=[]}static#t=this.\u0275fac=function(e){return new(e||t)};static#e=this.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-theme-btn"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(e,o){1&e&&d._UZ(0,"app-docs",0),2&e&&d.Q6J("codes",o.codes)("item",o.item)},dependencies:[c.P],styles:["[_nghost-%COMP%]{display:block}"]})}return t})(),A=(()=>{class t{constructor(){this.item={cols:1,urls:{"en-US":"packages/theme/src/router/index.en-US.md","zh-CN":"packages/theme/src/router/index.zh-CN.md"},content:{"en-US":{content:"Optional pre-loading module loading, when it's necessary to load the resource at the first page load for some lazy routes. For example, by default, the order
module must first access the /order
route before it will actually start download resource files. When using PreloadOptionalModules
and specifying preload: true
, it will automatically download resource files after the Angular project is started.
@NgModule({\n providers: [PreloadOptionalModules],\n imports: [\n RouterModule.forRoot([\n {\n path: 'order',\n loadChildren: () => import('./order/order.module').then(m => m.OrderModule),\n data: { preload: true }\n },\n ], { \n preloadingStrategy: PreloadOptionalModules\n })]\n})",meta:{order:1,title:"PreloadOptionalModules",type:"Router"},toc:[]},"zh-CN":{content:"\u53ef\u9009\u9884\u52a0\u8f7d\u6a21\u5757\uff0c\u5f53\u9700\u8981\u5bf9\u67d0\u4e9b\u61d2\u52a0\u8f7d\u5728\u7b2c\u4e00\u6b21\u9875\u9762\u52a0\u8f7d\u65f6\u4e5f\u4e00\u5e76\u52a0\u8f7d\u8be5\u8d44\u6e90\u65f6\u3002\u4f8b\u5982 order
\u6a21\u5757\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5fc5\u987b\u7b2c\u4e00\u6b21\u8bbf\u95ee /order
\u8def\u7531\u65f6\u624d\u4f1a\u771f\u6b63\u7684\u5f00\u59cb\u4e0b\u8f7d\u8d44\u6e90\u6587\u4ef6\uff0c\u5f53\u901a\u8fc7\u4f7f\u7528 PreloadOptionalModules
\u5e76\u6307\u5b9a preload: true
\u65f6\uff0c\u4f1a\u5728 Angular \u9879\u76ee\u542f\u52a8\u540e\u81ea\u52a8\u4e0b\u8f7d\u8d44\u6e90\u6587\u4ef6\u3002
@NgModule({\n providers: [PreloadOptionalModules],\n imports: [\n RouterModule.forRoot([\n {\n path: 'order',\n loadChildren: () => import('./order/order.module').then(m => m.OrderModule),\n data: { preload: true }\n },\n ], { \n preloadingStrategy: PreloadOptionalModules\n })]\n})",meta:{order:1,title:"PreloadOptionalModules",type:"Router"},toc:[]}},demo:!1},this.codes=[]}static#t=this.\u0275fac=function(e){return new(e||t)};static#e=this.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-index"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(e,o){1&e&&d._UZ(0,"app-docs",0),2&e&&d.Q6J("codes",o.codes)("item",o.item)},dependencies:[c.P],styles:["[_nghost-%COMP%]{display:block}"]})}return t})(),_=(()=>{class t{constructor(){this.item={cols:1,urls:{"en-US":"packages/theme/src/pipes/date/index.en-US.md","zh-CN":"packages/theme/src/pipes/date/index.zh-CN.md"},content:{"en-US":{content:'Based on date-fns date formatting, see more details date-fns (China mirror: moment format)
date-fns supports different kinds of time formats, such as:
2018-08-24 18:08:20
2018-08-24
20180824
1503571962333
{{data.registered | _date: \'YYYY\u5e74MM\u6708DD\u65e5\'}}</code></pre><p>Output:</p><pre class="hljs language-null"><code>2017\u5e7408\u670824\u65e5',meta:{order:1,title:"_date",subtitle:"Date",type:"Pipe"},toc:[]},"zh-CN":{content:'\u57fa\u4e8e date-fns \u65e5\u671f\u683c\u5f0f\u5316\uff0c\u663e\u793a\u66f4\u591a\u7ec6\u8282\u53c2\u8003 date-fns\uff08\u56fd\u5185\u955c\u50cf\uff1amoment format\uff09
\u6700\u5927\u597d\u5904\u662f date-fns \u652f\u6301\u4e0d\u540c\u79cd\u7c7b\u7684\u65f6\u95f4\u683c\u5f0f\uff0c\u4f8b\u5982\uff1a
2018-08-24 18:08:20
2018-08-24
20180824
1503571962333
\u7b49\u7b49\u3002
{{data.registered | _date: \'YYYY\u5e74MM\u6708DD\u65e5\'}}</code></pre><p>\u8f93\u51fa\uff1a</p><pre class="hljs language-null"><code>2017\u5e7408\u670824\u65e5',meta:{order:1,title:"_date",subtitle:"\u65e5\u671f",type:"Pipe"},toc:[]}},demo:!1},this.codes=[]}static#t=this.\u0275fac=function(e){return new(e||t)};static#e=this.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-date"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(e,o){1&e&&d._UZ(0,"app-docs",0),2&e&&d.Q6J("codes",o.codes)("item",o.item)},dependencies:[c.P],styles:["[_nghost-%COMP%]{display:block}"]})}return t})(),O=(()=>{class t{constructor(){this.item={cols:1,urls:{"en-US":"packages/theme/src/pipes/keys/index.en-US.md","zh-CN":"packages/theme/src/pipes/keys/index.zh-CN.md"},content:{"en-US":{content:'Transforms Object or Map into an array of key value pairs.
Data:
const data = { name: \'cipchk\', address: { city: \'shanghai\', district: \'changning\' } };
Use:
<div *ngFor="let item of data | keys">{{item.key}} {{item.value | json}}</div>
Dictionary
const data = { 1: \'Normal\', 2: \'Deleted\' };
If you want to keep the key name number
numeric:
<div *ngFor="let item of data | keys: true">{{item.key}} {{item.value | json}}
Angular 6.1.0
will support natively KeyValuePipe.
',meta:{order:1,title:"keys",subtitle:"Keys",type:"Pipe"},toc:[]},"zh-CN":{content:'keys
\u5c06\u5bf9\u8c61\u6570\u7ec4\u5316\u3002
\u4f8b\u5982\uff1a
const data = { name: \'cipchk\', address: { city: \'shanghai\', district: \'changning\' } };
\u53d8\u6210\u53ef\u8fed\u4ee3\u5bf9\u8c61\uff1a
<div *ngFor="let item of data | keys">{{item.key}} {{item.value | json}}</div>
\u5b57\u5178\u53ef\u8fed\u4ee3
const data = { 1: \'\u6b63\u5e38\', 2: \'\u5220\u9664\' };
\u82e5\u5e0c\u671b\u4fdd\u6301\u952e\u540d\u4e3a number
\u6570\u5b57\u578b\uff1a
<div *ngFor="let item of data | keys: true">{{item.key}} {{item.value | json}}
Angular 6.1.0
\u4ee5\u540e\u539f\u751f\u652f\u6301 KeyValuePipe\uff0c\u7528\u6cd5\u6709\u70b9\u7c7b\u4f3c\u3002
',meta:{order:1,title:"keys",subtitle:"\u53ef\u8fed\u4ee3\u5bf9\u8c61",type:"Pipe"},toc:[]}},demo:!1},this.codes=[]}static#t=this.\u0275fac=function(e){return new(e||t)};static#e=this.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-keys"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(e,o){1&e&&d._UZ(0,"app-docs",0),2&e&&d.Q6J("codes",o.codes)("item",o.item)},dependencies:[c.P],styles:["[_nghost-%COMP%]{display:block}"]})}return t})(),D=(()=>{class t{constructor(){this.item={cols:1,urls:{"en-US":"packages/theme/src/pipes/safe/index.en-US.md","zh-CN":"packages/theme/src/pipes/safe/index.zh-CN.md"},content:{"en-US":{content:'html
Simplify the use of bypassSecurityTrustHtml
.
<div [innerHTML]="content | html"></div>
url
Simplify the use of bypassSecurityTrustUrl
.
<a [href]="file_url | url" target="_blank"></a>',meta:{order:1,title:"safe",subtitle:"XSS",type:"Pipe"},toc:[{id:"html",title:"html",h:2},{id:"url",title:"url",h:2}]},"zh-CN":{content:'html
\u7b80\u5316 bypassSecurityTrustHtml
\u7684\u4f7f\u7528\u3002
<div [innerHTML]="content | html"></div>
url
\u7b80\u5316 bypassSecurityTrustUrl
\u7684\u4f7f\u7528\u3002
<a [href]="file_url | url" target="_blank"></a>',meta:{order:1,title:"safe",subtitle:"\u5b89\u5168HTML\u7b49",type:"Pipe"},toc:[{id:"html",title:"html",h:2},{id:"url",title:"url",h:2}]}},demo:!1},this.codes=[]}static#t=this.\u0275fac=function(e){return new(e||t)};static#e=this.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-safe"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(e,o){1&e&&d._UZ(0,"app-docs",0),2&e&&d.Q6J("codes",o.codes)("item",o.item)},dependencies:[c.P],styles:["[_nghost-%COMP%]{display:block}"]})}return t})(),M=(()=>{class t{constructor(){this.item={cols:1,urls:{"en-US":"packages/theme/src/pipes/yn/index.en-US.md","zh-CN":"packages/theme/src/pipes/yn/index.zh-CN.md"},content:{"en-US":{content:'yn
Make boolean as badge.
<td [innerHTML]="enabled | yn"></td>\nOutput:\n<td><i class="text-blue"><svg viewBox="64 64 896 896" fill="currentColor" width="1em" height="1em" aria-hidden="true"><path d="M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 0 0-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"></path></svg></i></td>',meta:{order:1,title:"yn",subtitle:"Badge",type:"Pipe"},toc:[]},"zh-CN":{content:'yn
\u5c06boolean\u7c7b\u578b\u5fbd\u7ae0\u5316\u3002
<td [innerHTML]="enabled | yn"></td>\nOutput:\n<td><i class="text-blue"><svg viewBox="64 64 896 896" fill="currentColor" width="1em" height="1em" aria-hidden="true"><path d="M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 0 0-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"></path></svg></i></td>',meta:{order:1,title:"yn",subtitle:"\u5fbd\u7ae0",type:"Pipe"},toc:[]}},demo:!1},this.codes=[]}static#t=this.\u0275fac=function(e){return new(e||t)};static#e=this.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-yn"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(e,o){1&e&&d._UZ(0,"app-docs",0),2&e&&d.Q6J("codes",o.codes)("item",o.item)},dependencies:[c.P],styles:["[_nghost-%COMP%]{display:block}"]})}return t})();var n=r(10095),P=r(27358),N=r(24205),i=r(980),s=r(43460),h=r(42840),p=r(70855),u=r(41958);let U=(()=>{class t{constructor(a,e){this.modalHelper=a,this.msg=e}open(){this.modalHelper.create("View",N.o,{record:{a:1,b:"2",c:new Date}}).subscribe(a=>{this.msg.info(a)})}static(){this.modalHelper.static("View",N.o,{record:{a:1,b:"2",c:new Date}}).subscribe(a=>{this.msg.info(a)})}static#t=this.\u0275fac=function(e){return new(e||t)(d.Y36(i.hC),d.Y36(s.dD))};static#e=this.\u0275cmp=d.Xpm({type:t,selectors:[["theme-drawer-simple"]],decls:4,vars:0,consts:[["nz-button","",3,"click"]],template:function(e,o){1&e&&(d.TgZ(0,"button",0),d.NdJ("click",function(){return o.open()}),d._uU(1,"Open"),d.qZA(),d.TgZ(2,"button",0),d.NdJ("click",function(){return o.static()}),d._uU(3,"Static"),d.qZA())},dependencies:[h.ix,p.w,u.dQ],encapsulation:2})}return t})(),L=(()=>{class t{constructor(){this.item={cols:1,urls:{"en-US":"packages/theme/src/services/drawer/index.en-US.md","zh-CN":"packages/theme/src/services/drawer/index.zh-CN.md"},content:{"en-US":{content:'Based on the NzDrawerService
package, it solves some known issues:
More friendly handling callbacks
Support responsive
create
this.drawerHelper.create(\'Edit\', FormEditComponent, { i }).subscribe(res => this.load());\n// Ok callback\n// 1. considered successful\nthis.NzDrawerRef.close(data);\nthis.NzDrawerRef.close(true);\n\n// Close\nthis.NzDrawerRef.close();\nthis.NzDrawerRef.close(false);\n\n// Close all open drawers\nthis.DrawerHelper.closeAll();
There are includes create
& static
methods to open the normal & static drawer.
Custom component HTML template
Your body content\n<div class="drawer-footer">\n // The bottom toolbar need wrapped by `drawer-footer`\n <button nz-button [nzType]="\'default\'" (click)="cancel()">\n Cancel\n </button>\n <button nz-button [nzType]="\'primary\'" (click)="ok()">\n OK\n </button>\n</div>
If you don\'t bottom toolbar, you need specify footer: false
.
',api:'API
Property Description Type Default size
Specify drawer size, responsive only supports non-numeric values sm,md,lg,xl,number
md
footer
Whether toolbar boolean
true
footerHeight
Toolbar height number
55
exact
Exact match return value, default is true
, If the return value is not null (null
or undefined
) is considered successful, otherwise it is considered error. boolean
true
drawerOptions
Drawer raw parameters NzDrawerOptions \u53c2\u6570 NzDrawerOptions
-
Method
closeAll
Close all open drawers
',meta:{order:3,title:"DrawerHelper",subtitle:"Drawer Helper",type:"Service"},toc:[{id:"create",title:"create",h:2},{id:"API",title:"API",h:2,children:[{id:"Method",title:"Method",h:3}]}]},"zh-CN":{content:'\u57fa\u4e8e NzDrawerService
\u5c01\u88c5\uff0c\u5b83\u89e3\u51b3\u4e00\u4e9b\u5df2\u77e5\u95ee\u9898\uff1a
\u66f4\u53cb\u597d\u7684\u5904\u7406\u56de\u8c03
\u54cd\u5e94\u5f0f\u5904\u7406
create
this.drawerHelper.create(\'Edit\', FormEditComponent, { i }).subscribe(res => this.load());\n// \u5bf9\u4e8e\u7ec4\u4ef6\u7684\u6210\u529f&\u5173\u95ed\u7684\u5904\u7406\u8bf4\u660e\n// \u6210\u529f\nthis.NzDrawerRef.close(data);\nthis.NzDrawerRef.close(true);\n// \u5173\u95ed\nthis.NzDrawerRef.close();\nthis.NzDrawerRef.close(false);\n\n// \u5173\u95ed\u6240\u6709\u5df2\u6253\u5f00\u7684\u62bd\u5c49\nthis.DrawerHelper.closeAll();
\u5305\u62ec create
& static
\u5206\u522b\u7528\u4e8e\u6253\u5f00\u666e\u901a\u6216\u9759\u6001\u62bd\u5c49\u3002
\u81ea\u5b9a\u4e49\u7ec4\u4ef6HTML\u6a21\u677f
\u5185\u5bb9\n<div class="drawer-footer">\n // \u5e95\u90e8\u5de5\u5177\u6761\u7531 `drawer-footer` \u5305\u88f9\n <button nz-button [nzType]="\'default\'" (click)="cancel()">\n Cancel\n </button>\n <button nz-button [nzType]="\'primary\'" (click)="ok()">\n OK\n </button>\n</div>
\u82e5\u65e0\u9700\u8981\u5e95\u90e8\u5de5\u5177\u6761\uff0c\u9700\u8981\u6307\u5b9a\u53c2\u6570 footer: false
\u3002
',api:'API
\u540d\u79f0 \u7c7b\u578b \u9ed8\u8ba4\u503c \u529f\u80fd size
\u6307\u5b9a\u62bd\u5c49\u5927\u5c0f\uff0c\u54cd\u5e94\u5f0f\u53ea\u652f\u6301\u975e\u6570\u5b57\u503c\uff0c\u82e5\u503c\u4e3a\u6570\u503c\u7c7b\u578b\uff0c\u5219\u6839\u636e nzPlacement
\u81ea\u52a8\u8f6c\u5316\u4e3a nzHeight
\u6216 nzWidth
sm,md,lg,xl,number
md
footer
\u662f\u5426\u9700\u8981\u5de5\u5177\u6761 boolean
true
footerHeight
\u5de5\u5177\u6761\u9ad8\u5ea6 number
55
exact
\u662f\u5426\u7cbe\u51c6\uff08\u9ed8\u8ba4\uff1atrue
\uff09\uff0c\u82e5\u8fd4\u56de\u503c\u975e\u7a7a\u503c\uff08null
\u6216undefined
\uff09\u89c6\u4e3a\u6210\u529f\uff0c\u5426\u5219\u89c6\u4e3a\u9519\u8bef boolean
true
drawerOptions
\u62bd\u5c49 NzDrawerOptions \u53c2\u6570 NzDrawerOptions
-
Method
closeAll
\u5173\u95ed\u6240\u6709\u5df2\u6253\u5f00\u7684\u62bd\u5c49
',meta:{order:3,title:"DrawerHelper",subtitle:"\u62bd\u5c49\u8f85\u52a9\u7c7b",type:"Service"},toc:[{id:"create",title:"create",h:2},{id:"API",title:"API",h:2,children:[{id:"Method",title:"Method",h:3}]}]}},demo:!0},this.codes=[{id:"theme-drawer-simple",meta:{title:{"zh-CN":"\u57fa\u7840\u6837\u4f8b","en-US":"Basic Usage"},order:0},summary:{"zh-CN":"\u6700\u7b80\u5355\u7684\u7528\u6cd5\u3002
","en-US":"Simplest of usage.
"},code:"import { Component } from '@angular/core';\nimport { DrawerHelper } from '@delon/theme';\nimport { DemoDrawerComponent } from '@shared';\nimport { NzMessageService } from 'ng-zorro-antd/message';\n\n@Component({\n selector: 'theme-drawer-simple',\n template: `\n \n \n `,\n})\nexport class ThemeDrawerSimpleComponent {\n constructor(private modalHelper: DrawerHelper, private msg: NzMessageService) {}\n\n open(): void {\n this.modalHelper.create('View', DemoDrawerComponent, { record: { a: 1, b: '2', c: new Date() } }).subscribe(res => {\n this.msg.info(res);\n });\n }\n\n static(): void {\n this.modalHelper.static('View', DemoDrawerComponent, { record: { a: 1, b: '2', c: new Date() } }).subscribe(res => {\n this.msg.info(res);\n });\n }\n}",name:"simple",urls:"packages/theme/src/services/drawer/demo/simple.md",type:"demo",lang:"ts",componentName:"ThemeDrawerSimpleComponent",point:0}]}static#t=this.\u0275fac=function(e){return new(e||t)};static#e=this.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-drawer"]],decls:5,vars:5,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","24"],[3,"item"]],template:function(e,o){1&e&&(d.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),d._UZ(4,"theme-drawer-simple"),d.qZA()()()()),2&e&&(d.Q6J("codes",o.codes)("item",o.item),d.xp6(1),d.Q6J("nzGutter",16),d.xp6(2),d.Q6J("item",o.codes[0]),d.uIk("id",o.codes[0].id))},dependencies:[n.t3,n.SK,c.P,P.e,U],styles:["[_nghost-%COMP%]{display:block}"]})}return t})(),R=(()=>{class t{constructor(){this.item={cols:1,urls:{"en-US":"packages/theme/src/services/http/index.en-US.md","zh-CN":"packages/theme/src/services/http/index.zh-CN.md"},content:{"en-US":{content:'_HttpClient service is based on Angular HttpClient
.
Features
More friendly call methods
Maintain loading
attribute
Handling null values
Unified time format is timestamp
Support decorator @GET, @POST etc
DEMO
Network requests are generally used with Object as arguments, such as a get
request:
HttpClient.get(url, { params: { pi: 1 } });
For _HttpClient
:
_HttpClient.get(url, { pi: 1 });
AlainThemeConfig
Common configuration, such as unifying null and time processing for _HttpClient
.
import { AlainThemeConfig } from \'@delon/theme\';\nexport function fnAlainThemeConfig(): AlainThemeConfig {\n return Object.assign(new AlainThemeConfig(), {\n http: {\n nullValueHandling: \'ignore\',\n },\n });\n}\n\n@NgModule({})\nexport class DelonModule {\n static forRoot(): ModuleWithProviders {\n return {\n ngModule: DelonModule,\n providers: [\n { provide: AlainThemeConfig, useFactory: fnAlainThemeConfig },\n ],\n };\n }\n}
API
Property Description Type Default nullValueHandling
Null processing include,ignore
include
dateValueHandling
Time processing timestamp,ignore
timestamp
Decorators
The target service must inherit BaseApi
abstract class.
Usage
@BaseUrl(\'/user\')\n@BaseHeaders({ bh: \'a\' })\nclass RestService extends BaseApi {\n @GET()\n query(@Query(\'pi\') pi: number, @Query(\'ps\') ps: number): Observable {\n return;\n }\n\n @GET(\':id\')\n get(@Path(\'id\') id: number): Observable {\n return;\n }\n\n @GET()\n get(@Payload data: {}): Observable {\n return;\n }\n\n // Use `::id` to indicate escaping, and should be will be ignored when `id` value is `undefined`, like this:\n\xa0\xa0// When `id` is `10` => 10:type\n\xa0\xa0// When `id` is `undefined` => :id:type\n @GET(\':id::type\')\n get(@Path(\'id\') id: number): Observable {\n return;\n }\n\n @POST(\':id\')\n save(@Path(\'id\') id: number, @Body data: Object): Observable {\n return;\n }\n\n @POST()\n save(@Payload data: {}): Observable {\n return;\n }\n\n @FORM()\n save(@Payload data: {}): Observable {\n return;\n }\n \n // If authorization is invalid, will be thrown directly `401` error and will not be sent.\n @GET(\'\', { acl: \'admin\' })\n ACL(): Observable {\n return;\n }\n}
Class decorators
@BaseUrl(url: string)
@BaseHeaders(headers: HttpHeaders | { [header: string]: string | string[] })
Method decorators
@GET(url: string = \'\', options?: HttpOptions)
@POST(url: string = \'\', options?: HttpOptions)
@DELETE(url: string = \'\', options?: HttpOptions)
@PUT(url: string = \'\', options?: HttpOptions)
@HEAD(url: string = \'\', options?: HttpOptions)
@PATCH(url: string = \'\', options?: HttpOptions)
@JSONP(url: string = \'\', options?: HttpOptions)
@OPTIONS(url: string = \'\', options?: HttpOptions)
HttpOptions
Property Description Type Default acl
ACL config, depends on @delon/acl
any
- observe
Specify response content body,events,response
- responseType
Specify content format arraybuffer,blob,json,text
- reportProgress
Whether monitor progress events boolean
- withCredentials
Set withCredentials boolean
-
Parameter decorators
@Path(key?: string)
URL path parameters
@Query(key?: string)
QueryString of URL
@Body
Body of URL
@Headers(key?: string)
Headers of URL
@Payload
Request Payload
Supported body (likePOST
, PUT
) as a body data, equivalent to @Body
Not supported body (like GET
, DELETE
etc) as a QueryString
CUSTOM_ERROR
Whether to customize the handling of exception messages.
this.http.post(`login`, {\n name: \'cipchk\', pwd: \'123456\'\n}, {\n context: new HttpContext()\n .set(ALLOW_ANONYMOUS, true)\n .set(CUSTOM_ERROR, true)\n}).subscribe({\n next: console.log,\n error: console.log\n});
IGNORE_BASE_URL
Whether to ignore API prefixes.
// When environment.api.baseUrl set \'/api\'\n\nthis.http.get(`/path`) // Request Url: /api/path\nthis.http.get(`/path`, { context: new HttpContext().set(IGNORE_BASE_URL, true) }) // Request Url: /path
RAW_BODY
Whether to return raw response
',meta:{order:1,title:"_HttpClient",type:"Service"},toc:[{id:"Features",title:"Features",h:2},{id:"DEMO",title:"DEMO",h:2},{id:"AlainThemeConfig",title:"AlainThemeConfig",h:2,children:[{id:"API",title:"API",h:3}]},{id:"Decorators",title:"Decorators",h:2,children:[{id:"Usage",title:"Usage",h:3},{id:"Classdecorators",title:"Class decorators",h:3},{id:"Methoddecorators",title:"Method decorators",h:3},{id:"Parameterdecorators",title:"Parameter decorators",h:3},{id:"CUSTOM_ERROR",title:"CUSTOM_ERROR",h:3},{id:"IGNORE_BASE_URL",title:"IGNORE_BASE_URL",h:3},{id:"RAW_BODY",title:"RAW_BODY",h:3}]}]},"zh-CN":{content:'@delon/theme
\u5305\u542b\u4e86\u4e00\u4e2a\u53eb _HttpClient \u7c7b\uff0c\u5176\u672c\u8d28\u8fd8\u662f\u8c03\u7528 Angular \u7684 HttpClient
\u3002
\u7279\u6027
\u66f4\u53cb\u597d\u7684\u8c03\u7528\u65b9\u6cd5
\u7ef4\u62a4 loading
\u5c5e\u6027
\u5904\u7406\u7a7a\u503c
\u7edf\u4e00\u65f6\u95f4\u683c\u5f0f\u4e3a\u65f6\u95f4\u6233
\u652f\u6301\u4fee\u9970\u5668 @GET\u3001@POST \u7b49
\u793a\u4f8b
\u7f51\u7edc\u8bf7\u6c42\u4e00\u822c\u60c5\u51b5\u4e0b\u662f\u540c Object \u5bf9\u8c61\u505a\u4e3a\u53c2\u6570\u4e00\u8d77\u4f7f\u7528\uff0c\u4f8b\u5982\u4e00\u4e2a get
\u8bf7\u6c42\uff0c\u539f\u59cb\u5199\u6cd5\uff1a
HttpClient.get(url, { params: { pi: 1 } });
\u800c\u5bf9\u4e8e _HttpClient
\u6765\u8bb2\uff0c\u5c06\u53c2\u6570\u8fdb\u4e00\u6b65\u4f18\u5316\u4e3a\uff1a
_HttpClient.get(url, { pi: 1 });
AlainThemeConfig
\u901a\u7528\u914d\u7f6e\u9879\uff0c\u4f8b\u5982\u7edf\u4e00\u5bf9 _HttpClient
\u8bbe\u7f6e\u7a7a\u503c\u3001\u65f6\u95f4\u5904\u7406\u65b9\u5f0f\u3002
import { AlainThemeConfig } from \'@delon/theme\';\nexport function fnAlainThemeConfig(): AlainThemeConfig {\n return Object.assign(new AlainThemeConfig(), {\n http: {\n nullValueHandling: \'ignore\',\n },\n });\n}\n\n@NgModule({})\nexport class DelonModule {\n static forRoot(): ModuleWithProviders {\n return {\n ngModule: DelonModule,\n providers: [\n { provide: AlainThemeConfig, useFactory: fnAlainThemeConfig },\n ],\n };\n }\n}
API
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c nullValueHandling
\u7a7a\u503c\u5904\u7406 include,ignore
include
dateValueHandling
\u65f6\u95f4\u503c\u5904\u7406 timestamp,ignore
timestamp
\u4f7f\u7528\u4fee\u9970\u5668
\u76ee\u6807\u7c7b\u90fd\u5fc5\u987b\u7ee7\u627f BaseApi
\u57fa\u7c7b\u3002
\u793a\u4f8b
@BaseUrl(\'/user\')\n@BaseHeaders({ bh: \'a\' })\nclass RestService extends BaseApi {\n @GET()\n query(@Query(\'pi\') pi: number, @Query(\'ps\') ps: number): Observable {\n return;\n }\n\n @GET(\':id\')\n get(@Path(\'id\') id: number): Observable {\n return;\n }\n\n @GET()\n get(@Payload data: {}): Observable {\n return;\n }\n\n // \u4f7f\u7528 `::id` \u6765\u8868\u793a\u8f6c\u4e49\uff0c\u82e5 `id` \u503c\u4e3a `undefined` \u4f1a\u5ffd\u7565\u8f6c\u6362\uff0c\u4f8b\u5982\uff1a\n // \u5f53 `id` \u4e3a `10` \u65f6 => 10:type\n // \u5f53 `id` \u4e3a `undefined` \u65f6 => :id:type\n @GET(\':id::type\')\n get(@Path(\'id\') id: number): Observable {\n return;\n }\n\n @POST(\':id\')\n save(@Path(\'id\') id: number, @Body data: Object): Observable {\n return;\n }\n\n @POST()\n save(@Payload data: {}): Observable {\n return;\n }\n\n @FORM()\n save(@Payload data: {}): Observable {\n return;\n }\n \n // \u82e5\u8bf7\u6c42\u7684URL\u4e0d\u7b26\u5408\u6388\u6743\u8981\u6c42\uff0c\u4f1a\u76f4\u63a5\u629b\u51fa `401` \u9519\u8bef\uff0c\u4e14\u4e0d\u53d1\u9001\u8bf7\u6c42\n @GET(\'\', { acl: \'admin\' })\n ACL(): Observable {\n return;\n }\n}
\u7c7b
@BaseUrl(url: string)
@BaseHeaders(headers: HttpHeaders | { [header: string]: string | string[] })
\u65b9\u6cd5
@GET(url: string = \'\', options?: HttpOptions)
@POST(url: string = \'\', options?: HttpOptions)
@DELETE(url: string = \'\', options?: HttpOptions)
@PUT(url: string = \'\', options?: HttpOptions)
@HEAD(url: string = \'\', options?: HttpOptions)
@PATCH(url: string = \'\', options?: HttpOptions)
@JSONP(url: string = \'\', options?: HttpOptions)
@OPTIONS(url: string = \'\', options?: HttpOptions)
HttpOptions
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c acl
ACL \u914d\u7f6e\uff0c\u82e5\u5bfc\u5165 @delon/acl
\u65f6\u81ea\u52a8\u6709\u6548\uff0c\u7b49\u540c\u4e8e ACLService.can(roleOrAbility: ACLCanType)
\u53c2\u6570\u503c any
- observe
\u6307\u5b9a\u54cd\u5e94\u5185\u5bb9 body,events,response
- responseType
\u6307\u5b9a\u5185\u5bb9\u683c\u5f0f arraybuffer,blob,json,text
- reportProgress
\u662f\u5426\u76d1\u542c\u8fdb\u5ea6\u4e8b\u4ef6 boolean
- withCredentials
\u8bbe\u7f6e withCredentials boolean
-
\u53c2\u6570
@Path(key?: string)
URL \u8def\u7531\u53c2\u6570
@Query(key?: string)
URL \u53c2\u6570 QueryString
@Body
\u53c2\u6570 Body
@Headers(key?: string)
\u53c2\u6570 Headers
@Payload
\u8bf7\u6c42\u8d1f\u8f7d
\u5f53\u652f\u6301 Body \u65f6\uff08\u4f8b\u5982\uff1aPOST
\u3001PUT
\uff09\u4e3a\u5185\u5bb9\u4f53\u7b49\u540c @Body
\u5f53\u4e0d\u652f\u6301 Body \u65f6\uff08\u4f8b\u5982\uff1aGET
\u3001DELETE
\u7b49\uff09\u4e3a QueryString
HttpContext
CUSTOM_ERROR
\u662f\u5426\u81ea\u5b9a\u4e49\u5904\u7406\u5f02\u5e38\u6d88\u606f\u3002
this.http.post(`login`, {\n name: \'cipchk\', pwd: \'123456\'\n}, {\n context: new HttpContext()\n .set(ALLOW_ANONYMOUS, true)\n .set(CUSTOM_ERROR, true)\n}).subscribe({\n next: console.log,\n error: console.log\n});
IGNORE_BASE_URL
\u662f\u5426\u5ffd\u7565API\u524d\u7f00\u3002
// When environment.api.baseUrl set \'/api\'\n\nthis.http.get(`/path`) // Request Url: /api/path\nthis.http.get(`/path`, { context: new HttpContext().set(IGNORE_BASE_URL, true) }) // Request Url: /path
RAW_BODY
\u662f\u5426\u539f\u6837\u8fd4\u56de\u8bf7\u6c42
',meta:{order:1,title:"_HttpClient",type:"Service"},toc:[{id:"\u7279\u6027",title:"\u7279\u6027",h:2},{id:"\u793a\u4f8b",title:"\u793a\u4f8b",h:2},{id:"AlainThemeConfig",title:"AlainThemeConfig",h:2,children:[{id:"API",title:"API",h:3}]},{id:"\u4f7f\u7528\u4fee\u9970\u5668",title:"\u4f7f\u7528\u4fee\u9970\u5668",h:2,children:[{id:"\u793a\u4f8b",title:"\u793a\u4f8b",h:3},{id:"\u7c7b",title:"\u7c7b",h:3},{id:"\u65b9\u6cd5",title:"\u65b9\u6cd5",h:3},{id:"\u53c2\u6570",title:"\u53c2\u6570",h:3}]},{id:"HttpContext",title:"HttpContext",h:2,children:[{id:"CUSTOM_ERROR",title:"CUSTOM_ERROR",h:3},{id:"IGNORE_BASE_URL",title:"IGNORE_BASE_URL",h:3},{id:"RAW_BODY",title:"RAW_BODY",h:3}]}]}},demo:!1},this.codes=[]}static#t=this.\u0275fac=function(e){return new(e||t)};static#e=this.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-http"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(e,o){1&e&&d._UZ(0,"app-docs",0),2&e&&d.Q6J("codes",o.codes)("item",o.item)},dependencies:[c.P],styles:["[_nghost-%COMP%]{display:block}"]})}return t})(),I=(()=>{class t{constructor(){this.item={cols:1,urls:{"en-US":"packages/theme/src/services/menu/index.en-US.md","zh-CN":"packages/theme/src/services/menu/index.zh-CN.md"},content:{"en-US":{content:'The data format is an array of Menu, where text
text property muse be required, And it\'s not affected by external components (such as sidebar-nav),
This is because menus it\'s essential part of the applications, And it can be used more effectively as a service, such as: dynamically generate navigation, title etc.
Suggest: Start up Angular (startup.service.ts) After get menu data from remote, call the add()
method.
',api:'API
MenuService
Method Description add
Setting menu data clear
Clear menu data resume
Reset menu, may need call when I18N, user acl changed find
Find a menu item by url
or key
getItem
Get menu item based on key
getPathByUrl
Get menu list based on url setItem
Set menu item open
Open of the menu toggleOpen
Toggle menu open or close openAll
Toggle all menu open or close
recursive
Recursive upward find, for example, the menu data source contains /ware
, then /ware/1
is equivalent to /ware
.
Menu
Property Description Type Default text
Text of menu item, can be choose one of text
or i18n
(Support HTML) string
- i18n
I18n key of menu item, can be choose one of text
or i18n
(Support HTML) string
- group
Whether to display the group name boolean
true
link
Routing for the menu item, can be choose one of link
or externalLink
string
- externalLink
External link for the menu item, can be choose one of link
or externalLink
string
- target
Specifies externalLink
where to display the linked URL _blank,_self,_parent,_top
- icon
Icon for the menu item, only valid for the first level menu string | MenuIcon
- badge
Badget for the menu item when group
is true
number
- badgeDot
Whether to display a red dot instead of badge
value boolean
- badgeStatus
Badge color success,processing,default,error,warning
error
open
Whether open for the menu item boolean
false
disabled
Whether disable for the menu item boolean
false
hide
Whether hidden for the menu item boolean
false
hideInBreadcrumb
Whether hide in breadcrumbs, which are valid when the page-header
component automatically generates breadcrumbs boolean
- acl
ACL configuration, it\'s equivalent to ACLService.can(roleOrAbility: ACLCanType)
parameter value any
- shortcut
Whether shortcut menu item boolean
- shortcutRoot
Wheter shortcut menu root node boolean
- reuse
Whether to allow reuse, need to cooperate with the reuse-tab
component boolean
- open
Whether to expand, when checkStrictly
is valid in sidebar-nav
component boolean
- key
Unique identifier of the menu item, can be used in getItem
, setItem
to update a menu string
- children
Children for the menu item Menu[]
-
MenuIcon
Property Description Type Default [type]
Type for icon; img
, svg
Size uses 14px
width and height class,icon,iconfont,img,svg
icon
[value]
Value for the icon, can be set Class Name, nz-icon of nzType
, image string
- [theme]
Type of the ant design icon outline,twotone,fill
outline
[spin]
Rotate icon with animation boolean
false
[twoToneColor]
Only support the two-tone icon. Specific the primary color string
- [iconfont]
Type of the icon from iconfont string
- [rotate]
Rotate degrees number
-
',meta:{order:2,title:"MenuService",subtitle:"Menu Service",type:"Service"},toc:[{id:"API",title:"API",h:2,children:[{id:"MenuService",title:"MenuService",h:3},{id:"Menu",title:"Menu",h:3},{id:"MenuIcon",title:"MenuIcon",h:3}]}]},"zh-CN":{content:'\u83dc\u5355\u670d\u52a1\u7684\u6570\u636e\u683c\u5f0f\u662f\u4e00\u4e2a Menu \u6570\u7ec4\uff0c\u5176\u4e2d text
\u5c5e\u6027\u8868\u793a\u83dc\u5355\u6587\u672c\u4e3a\u5fc5\u586b\u9879\uff0c\u800c\u4e14\u672c\u8eab\u5e76\u4e0d\u53d7\u5916\u90e8\u7ec4\u4ef6\u7684\u5f71\u54cd\uff08\u4f8b\u5982sidebar-nav\u7ec4\u4ef6\uff09\uff0c\u8fd9\u662f\u56e0\u4e3a\u83dc\u5355\u662f\u8d2f\u7a7f\u6574\u4e2a\u9879\u76ee\u5fc5\u4e0d\u53ef\u5c11\u7684\u7ec4\u6210\u90e8\u5206\uff0c\u800c\u5c06\u5176\u72ec\u7acb\u6210\u4e00\u4e2a\u670d\u52a1\u53ef\u4ee5\u66f4\u6709\u6548\u88ab\u4f7f\u7528\uff0c\u4f8b\u5982\uff1a\u52a8\u6001\u751f\u6210\u5bfc\u822a\u3001\u6807\u9898\u7b49\u3002
\u5efa\u8bae\uff1a \u5728 Angular \u542f\u52a8\u670d\u52a1\uff08startup.service.ts\uff09\u4ece\u8fdc\u7a0b\u83b7\u53d6\u5230\u83dc\u5355\u6570\u636e\u540e\uff0c\u8c03\u7528 add()
\u65b9\u6cd5\u3002
',api:'API
MenuService
\u65b9\u6cd5 \u63cf\u8ff0 add
\u8bbe\u7f6e\u83dc\u5355\u6570\u636e clear
\u6e05\u7a7a\u83dc\u5355\u6570\u636e resume
\u91cd\u7f6e\u83dc\u5355\uff0c\u53ef\u80fdI18N\u3001\u7528\u6237\u6743\u9650\u53d8\u52a8\u65f6\u9700\u8981\u8c03\u7528\u5237\u65b0 find
\u5229\u7528 url
\u6216 key
\u67e5\u627e\u83dc\u5355 getItem
\u6839\u636e key
\u83b7\u53d6\u83dc\u5355 getPathByUrl
\u6839\u636eurl\u83b7\u53d6\u83dc\u5355\u5217\u8868 setItem
\u8bbe\u7f6e\u83dc\u5355\u503c open
\u5c55\u5f00\u67d0\u83dc\u5355 toggleOpen
\u5207\u6362\u83dc\u5355\u7684\u5c55\u5f00\u6216\u5173\u95ed openAll
\u5c55\u5f00\u6216\u5173\u95ed\u6240\u6709\u83dc\u5355
recursive
\u8868\u793a\u81ea\u52a8\u5411\u4e0a\u9012\u5f52\u67e5\u627e\uff0c\u4f8b\u5982\u83dc\u5355\u6570\u636e\u6e90\u5305\u542b /ware
\uff0c\u5219 /ware/1
\u4e5f\u89c6\u4e3a /ware
\u9879\u3002
Menu
\u6210\u5458 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c text
\u6587\u672c\uff08\u652f\u6301HTML\uff09\uff0c\u5fc5\u586b\u9879 string
- i18n
i18n\u4e3b\u952e\uff08\u652f\u6301HTML\uff09 string
- group
\u662f\u5426\u663e\u793a\u5206\u7ec4\u540d\uff0c\u6307\u793a\u4f8b\u4e2d\u7684\u3010\u4e3b\u5bfc\u822a\u3011\u5b57\u6837 boolean
true
link
\u8def\u7531\uff0clink
\u3001externalLink
\u4e8c\u9009\u5176\u4e00 string
- externalLink
\u5916\u90e8\u94fe\u63a5\uff0clink
\u3001externalLink
\u4e8c\u9009\u5176\u4e00 string
- target
\u94fe\u63a5 target _blank,_self,_parent,_top
- icon
\u56fe\u6807\uff0c\u6307\u793a\u4f8b\u4e2d\u7684\u3010\u4eea\u8868\u76d8\u3011\u524d\u56fe\u6807\uff0c\u53ea\u5bf9\u4e00\u7ea7\u83dc\u5355\u6709\u6548 string | MenuIcon
- badge
\u5fbd\u6807\u6570\uff0c\u5c55\u793a\u7684\u6570\u5b57\uff0c\u6307\u793a\u4f8b\u4e2d\u7684\u3010\u5c0f\u90e8\u4ef6\u3011\u540e\u7684\u7ea2\u8272\u5757\u3002\uff08\u6ce8\uff1agroup:true
\u65f6\u65e0\u6548\uff09 number
- badgeDot
\u5fbd\u6807\u6570\uff0c\u663e\u793a\u5c0f\u7ea2\u70b9 boolean
- badgeStatus
\u5fbd\u6807 Badge \u989c\u8272 success,processing,default,error,warning
error
open
\u662f\u5426\u6253\u5f00\u83dc\u5355 boolean
false
disabled
\u662f\u5426\u7981\u7528\u83dc\u5355 boolean
false
hide
\u662f\u5426\u9690\u85cf\u83dc\u5355 boolean
false
hideInBreadcrumb
\u9690\u85cf\u9762\u5305\u5c51\uff0c\u6307 page-header
\u7ec4\u4ef6\u7684\u81ea\u52a8\u751f\u6210\u9762\u5305\u5c51\u65f6\u6709\u6548 boolean
- acl
ACL\u914d\u7f6e\uff0c\u82e5\u5bfc\u5165 @delon/acl
\u65f6\u81ea\u52a8\u6709\u6548\uff0c\u7b49\u540c\u4e8e ACLService.can(roleOrAbility: ACLCanType)
\u53c2\u6570\u503c any
- shortcut
\u662f\u5426\u5feb\u6377\u83dc\u5355\u9879 boolean
- shortcutRoot
\u5feb\u6377\u83dc\u5355\u6839\u8282\u70b9 boolean
- reuse
\u662f\u5426\u5141\u8bb8\u590d\u7528\uff0c\u9700\u914d\u5408 reuse-tab
\u7ec4\u4ef6 boolean
- key
\u83dc\u5355\u9879\u552f\u4e00\u6807\u8bc6\u7b26\uff0c\u53ef\u7528\u4e8e getItem
\u3001setItem
\u6765\u66f4\u65b0\u67d0\u4e2a\u83dc\u5355 string
- children
\u5b50\u83dc\u5355 Menu[]
-
MenuIcon
\u6210\u5458 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [type]
\u7c7b\u578b\uff1bimg
, svg
\u7c7b\u578b\u9700\u8981 14px
\u5bbd\u4e0e\u9ad8\u5c3a\u5bf8 class,icon,iconfont,img,svg
icon
[value]
\u503c\uff0c\u5305\u542b\uff1a\u7c7b\u540d\u3001\u56fe\u6807 nzType
\u3001\u56fe\u50cf string
- [theme]
\u56fe\u6807\u4e3b\u9898\u98ce\u683c outline,twotone,fill
outline
[spin]
\u662f\u5426\u6709\u65cb\u8f6c\u52a8\u753b boolean
false
[twoToneColor]
\u4ec5\u9002\u7528\u53cc\u8272\u56fe\u6807\uff0c\u8bbe\u7f6e\u53cc\u8272\u56fe\u6807\u7684\u4e3b\u8981\u989c\u8272\uff0c\u4ec5\u5bf9\u5f53\u524d icon \u751f\u6548 string
- [iconfont]
\u6307\u5b9a\u6765\u81ea IconFont \u7684\u56fe\u6807\u7c7b\u578b string
- [rotate]
\u56fe\u6807\u65cb\u8f6c\u89d2\u5ea6 number
-
\u4f7f\u7528 iconfont
\u7c7b\u578b\u5fc5\u987b\u5148\u52a0\u8f7d NzIconService.fetchFromIconfont
\uff0c\u5efa\u8bae\u5728\u6839\u6a21\u5757\u4e2d\u6267\u884c\u3002
',meta:{order:2,title:"MenuService",subtitle:"\u83dc\u5355\u670d\u52a1",type:"Service"},toc:[{id:"API",title:"API",h:2,children:[{id:"MenuService",title:"MenuService",h:3},{id:"Menu",title:"Menu",h:3},{id:"MenuIcon",title:"MenuIcon",h:3}]}]}},demo:!1},this.codes=[]}static#t=this.\u0275fac=function(e){return new(e||t)};static#e=this.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-menu"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(e,o){1&e&&d._UZ(0,"app-docs",0),2&e&&d.Q6J("codes",o.codes)("item",o.item)},dependencies:[c.P],styles:["[_nghost-%COMP%]{display:block}"]})}return t})();var m=r(50662);let j=(()=>{class t{constructor(a,e){this.modalHelper=a,this.msg=e}open(){this.modalHelper.create(m.X,{record:{a:1,b:"2",c:new Date}}).subscribe(a=>{this.msg.info(a)})}static(){this.modalHelper.createStatic(m.X,{record:{a:1,b:"2",c:new Date}}).subscribe(a=>{this.msg.info(a)})}static#t=this.\u0275fac=function(e){return new(e||t)(d.Y36(i.Te),d.Y36(s.dD))};static#e=this.\u0275cmp=d.Xpm({type:t,selectors:[["theme-modal-simple"]],decls:4,vars:0,consts:[["nz-button","",3,"click"]],template:function(e,o){1&e&&(d.TgZ(0,"button",0),d.NdJ("click",function(){return o.open()}),d._uU(1,"Open"),d.qZA(),d.TgZ(2,"button",0),d.NdJ("click",function(){return o.static()}),d._uU(3,"Static"),d.qZA())},dependencies:[h.ix,p.w,u.dQ],encapsulation:2})}return t})(),E=(()=>{class t{constructor(a,e){this.modalHelper=a,this.msg=e}open(){this.modalHelper.create(m.X,{record:{a:1,b:"2",c:new Date}},{drag:!0}).subscribe(a=>{this.msg.info(a)})}static#t=this.\u0275fac=function(e){return new(e||t)(d.Y36(i.Te),d.Y36(s.dD))};static#e=this.\u0275cmp=d.Xpm({type:t,selectors:[["theme-modal-drag"]],decls:2,vars:0,consts:[["nz-button","",3,"click"]],template:function(e,o){1&e&&(d.TgZ(0,"button",0),d.NdJ("click",function(){return o.open()}),d._uU(1,"Open"),d.qZA())},dependencies:[h.ix,p.w,u.dQ],encapsulation:2})}return t})();const Y=[{path:"",component:Q.S,children:[{path:"",redirectTo:"getting-started/zh",pathMatch:"full"},{path:"component-styles",redirectTo:"component-styles/zh",pathMatch:"full"},{path:"component-styles/:lang",component:b},{path:"customize-theme",redirectTo:"customize-theme/zh",pathMatch:"full"},{path:"customize-theme/:lang",component:f},{path:"getting-started",redirectTo:"getting-started/zh",pathMatch:"full"},{path:"getting-started/:lang",component:y},{path:"global",redirectTo:"global/zh",pathMatch:"full"},{path:"global/:lang",component:k},{path:"icon",redirectTo:"icon/zh",pathMatch:"full"},{path:"icon/:lang",component:v},{path:"locale",redirectTo:"locale/zh",pathMatch:"full"},{path:"locale/:lang",component:x},{path:"performance",redirectTo:"performance/zh",pathMatch:"full"},{path:"performance/:lang",component:w},{path:"tools",redirectTo:"tools/zh",pathMatch:"full"},{path:"tools/:lang",component:S},{path:"layout-default",redirectTo:"layout-default/zh",pathMatch:"full"},{path:"layout-default/:lang",component:z},{path:"layout-blank",redirectTo:"layout-blank/zh",pathMatch:"full"},{path:"layout-blank/:lang",component:T},{path:"theme-btn",redirectTo:"theme-btn/zh",pathMatch:"full"},{path:"theme-btn/:lang",component:C},{path:"index",redirectTo:"index/zh",pathMatch:"full"},{path:"index/:lang",component:A},{path:"date",redirectTo:"date/zh",pathMatch:"full"},{path:"date/:lang",component:_},{path:"keys",redirectTo:"keys/zh",pathMatch:"full"},{path:"keys/:lang",component:O},{path:"safe",redirectTo:"safe/zh",pathMatch:"full"},{path:"safe/:lang",component:D},{path:"yn",redirectTo:"yn/zh",pathMatch:"full"},{path:"yn/:lang",component:M},{path:"drawer",redirectTo:"drawer/zh",pathMatch:"full"},{path:"drawer/:lang",component:L},{path:"http",redirectTo:"http/zh",pathMatch:"full"},{path:"http/:lang",component:R},{path:"menu",redirectTo:"menu/zh",pathMatch:"full"},{path:"menu/:lang",component:I},{path:"modal",redirectTo:"modal/zh",pathMatch:"full"},{path:"modal/:lang",component:(()=>{class t{constructor(){this.item={cols:1,urls:{"en-US":"packages/theme/src/services/modal/index.en-US.md","zh-CN":"packages/theme/src/services/modal/index.zh-CN.md"},content:{"en-US":{content:'Based on the NzModalService
package, it solves some known issues:
More friendly handling callbacks
Usage
this.modalHelper.create(FormEditComponent, { i }).subscribe(res => this.load());\n\n// Ok callback, Where `nzModalRef` refers to the variable name of the target component in the constructor `NzModalRef`\n// 1. considered successful\nthis.nzModalRef.close(true);\nthis.nzModalRef.close({ other: 1 });\n// 2. considered error\nthis.nzModalRef.close();\n\n// Close\nthis.nzModalRef.destroy();
There are includes create
& createStatic
methods to open the normal & static modal. Add a few parameters based on NzModalService
.
Custom component HTML template
<div class="modal-header">\n <div class="modal-title">Title</div>\n</div>\n\nYour body content\n\n<div class="modal-footer">\n <button nz-button [nzType]="\'default\'" (click)="cancel()">\n Cancel\n </button>\n <button nz-button [nzType]="\'primary\'" (click)="ok()">\n OK\n </button>\n</div>
API
Property Description Type Default size
Specify modal size sm,md,lg,xl,number,string
lg
exact
Exact match return value, default is true
, If the return value is not null (null
or undefined
) is considered successful, otherwise it is considered error. boolean
true
includeTabs
Whether to wrap the tab page boolean
false
drag
Drag boolean, ModalHelperDragOptions
- useNzData
Whether it is mandatory to use nzData
to pass parameters. If it is false
, it means that the parameters will be directly mapped to the component instance, and other values \u200b\u200bcan only be obtained through NZ_MODAL_DATA
. boolean
false
modalOptions
nz-modal raw parameters ModalOptions ModalOptions
- ',meta:{order:3,title:"ModalHelper",subtitle:"Modal Helper",type:"Service"},toc:[{id:"Usage",title:"Usage",h:2,children:[{id:"API",title:"API",h:3}]}]},"zh-CN":{content:'\u57fa\u4e8e NzModalService
\u5c01\u88c5\uff0c\u5b83\u89e3\u51b3\u4e00\u4e9b\u5df2\u77e5\u95ee\u9898\uff1a
\u66f4\u53cb\u597d\u7684\u5904\u7406\u56de\u8c03
\u7528\u6cd5
this.modalHelper.create(FormEditComponent, { i }).subscribe(res => this.load());\n\n// \u6210\u529f\u8303\u4f8b\uff0c\u5176\u4e2d `nzModalRef` \u6307\u76ee\u6807\u7ec4\u4ef6\u5728\u6784\u9020\u51fd\u6570 `NzModalRef` \u53d8\u91cf\u540d\n// 1. \u89c6\u4e3a\u6210\u529f\nthis.nzModalRef.close(true);\nthis.nzModalRef.close({ other: 1 });\n// 2. \u89c6\u4e3a\u5931\u8d25\nthis.nzModalRef.close();\n\n// \u5173\u95ed\uff1a\nthis.nzModalRef.destroy();
\u5305\u62ec\u4e24\u4e2a\u65b9\u6cd5\u4f53 create
& createStatic
\u5206\u522b\u6253\u5f00\u666e\u901a&\u9759\u6001\u5bf9\u8bdd\u6846\u3002\u5728 NzModalService
\u57fa\u7840\u4e0a\u65b0\u589e\u82e5\u5e72\u53c2\u6570\u3002
\u81ea\u5b9a\u4e49\u7ec4\u4ef6HTML\u6a21\u677f
<div class="modal-header">\n <div class="modal-title">Title</div>\n</div>\n\nYour body content\n\n<div class="modal-footer">\n <button nz-button [nzType]="\'default\'" (click)="cancel()">\n Cancel\n </button>\n <button nz-button [nzType]="\'primary\'" (click)="ok()">\n OK\n </button>\n</div>
API
\u540d\u79f0 \u7c7b\u578b \u9ed8\u8ba4\u503c \u63cf\u8ff0 size
\u6307\u5b9a\u5bf9\u8bdd\u6846\u5927\u5c0f sm,md,lg,xl,number,string
lg
exact
\u662f\u5426\u7cbe\u51c6\uff08\u9ed8\u8ba4\uff1atrue
\uff09\uff0c\u82e5\u8fd4\u56de\u503c\u975e\u7a7a\u503c\uff08null
\u6216undefined
\uff09\u89c6\u4e3a\u6210\u529f\uff0c\u5426\u5219\u89c6\u4e3a\u9519\u8bef boolean
true
includeTabs
\u662f\u5426\u5305\u88f9\u6807\u7b7e\u9875 boolean
false
drag
\u652f\u6301\u62d6\u52a8 boolean, ModalHelperDragOptions
- useNzData
\u662f\u5426\u5f3a\u5236\u4f7f\u7528 nzData
\u4f20\u9012\u53c2\u6570\uff0c\u82e5\u4e3a false
\u8868\u793a\u53c2\u6570\u4f1a\u76f4\u63a5\u6620\u5c04\u5230\u7ec4\u4ef6\u5b9e\u4f8b\u4e2d\uff0c\u5176\u4ed6\u503c\u53ea\u80fd\u901a\u8fc7 NZ_MODAL_DATA
\u7684\u65b9\u5f0f\u6765\u83b7\u53d6\u53c2\u6570 boolean
false
modalOptions
\u5bf9\u8bdd\u6846 ModalOptions \u53c2\u6570 ModalOptions
- ',meta:{order:3,title:"ModalHelper",subtitle:"\u5bf9\u8bdd\u6846\u8f85\u52a9\u7c7b",type:"Service"},toc:[{id:"\u7528\u6cd5",title:"\u7528\u6cd5",h:2,children:[{id:"API",title:"API",h:3}]}]}},demo:!0},this.codes=[{id:"theme-modal-simple",meta:{title:{"zh-CN":"\u57fa\u7840\u6837\u4f8b","en-US":"Basic Usage"},order:0},summary:{"zh-CN":"\u6700\u7b80\u5355\u7684\u7528\u6cd5\u3002
","en-US":"Simplest of usage.
"},code:"import { Component } from '@angular/core';\nimport { ModalHelper } from '@delon/theme';\nimport { DemoModalComponent } from '@shared';\nimport { NzMessageService } from 'ng-zorro-antd/message';\n\n@Component({\n selector: 'theme-modal-simple',\n template: `\n \n \n `,\n})\nexport class ThemeModalSimpleComponent {\n constructor(private modalHelper: ModalHelper, private msg: NzMessageService) {}\n\n open(): void {\n this.modalHelper.create(DemoModalComponent, { record: { a: 1, b: '2', c: new Date() } }).subscribe(res => {\n this.msg.info(res);\n });\n }\n\n static(): void {\n this.modalHelper.createStatic(DemoModalComponent, { record: { a: 1, b: '2', c: new Date() } }).subscribe(res => {\n this.msg.info(res);\n });\n }\n}",name:"simple",urls:"packages/theme/src/services/modal/demo/simple.md",type:"demo",lang:"ts",componentName:"ThemeModalSimpleComponent",point:0},{id:"theme-modal-drag",meta:{title:{"zh-CN":"\u62d6\u52a8","en-US":"Drag"},order:1},summary:{"zh-CN":"\u652f\u6301\u62d6\u52a8\u5bf9\u8bdd\u6846\u3002
","en-US":"Support for dragging dialogs.
"},code:"import { Component } from '@angular/core';\nimport { ModalHelper } from '@delon/theme';\nimport { DemoModalComponent } from '@shared';\nimport { NzMessageService } from 'ng-zorro-antd/message';\n\n@Component({\n selector: 'theme-modal-drag',\n template: `\n \n `,\n})\nexport class ThemeModalDragComponent {\n constructor(private modalHelper: ModalHelper, private msg: NzMessageService) {}\n\n open(): void {\n this.modalHelper.create(DemoModalComponent, { record: { a: 1, b: '2', c: new Date() } }, { drag: true }).subscribe(res => {\n this.msg.info(res);\n });\n }\n}",name:"drag",urls:"packages/theme/src/services/modal/demo/drag.md",type:"demo",lang:"ts",componentName:"ThemeModalDragComponent",point:1}]}static#t=this.\u0275fac=function(e){return new(e||t)};static#e=this.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-modal"]],decls:7,vars:7,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","24"],[3,"item"]],template:function(e,o){1&e&&(d.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),d._UZ(4,"theme-modal-simple"),d.qZA(),d.TgZ(5,"code-box",3),d._UZ(6,"theme-modal-drag"),d.qZA()()()()),2&e&&(d.Q6J("codes",o.codes)("item",o.item),d.xp6(1),d.Q6J("nzGutter",16),d.xp6(2),d.Q6J("item",o.codes[0]),d.uIk("id",o.codes[0].id),d.xp6(2),d.Q6J("item",o.codes[1]),d.uIk("id",o.codes[1].id))},dependencies:[n.t3,n.SK,c.P,P.e,j,E],styles:["[_nghost-%COMP%]{display:block}"]})}return t})()},{path:"responsive",redirectTo:"responsive/zh",pathMatch:"full"},{path:"responsive/:lang",component:(()=>{class t{constructor(){this.item={cols:1,urls:{"en-US":"packages/theme/src/services/responsive/index.en-US.md","zh-CN":"packages/theme/src/services/responsive/index.zh-CN.md"},content:{"en-US":{content:'More friendly use responsive rules, the original xs
, sm
etc. reduced to col
property, the default response rule:
col
<576px
\u2265576px
\u2265768px
\u2265992px
\u22651200px
\u22651600px
1
1 1 1 1 1 1 2
1 2 2 2 2 2 3
1 2 3 3 3 3 4
1 2 3 4 4 4 5
1 2 3 4 6 6 6
1 2 3 4 6 12
In order to better develop responsives this view or edit pages, the rule will be used by default in sg
, sv
, se
components. You can via ResponsiveConfig
to override the default rules.
ResponsiveConfig
import { AlainThemeConfig } from \'@delon/theme\';\nexport function fnAlainThemeConfig(): AlainThemeConfig {\n return Object.assign(new AlainThemeConfig(), {\n responsive: {\n rules: {\n 1: { xs: 24 },\n 2: { xs: 24, sm: 12 },\n 3: { xs: 24, sm: 12, md: 8 },\n 4: { xs: 24, sm: 12, md: 8, lg: 6 },\n 5: { xs: 24, sm: 12, md: 8, lg: 6, xl: 4 },\n 6: { xs: 24, sm: 12, md: 8, lg: 6, xl: 4, xxl: 2 },\n }\n },\n });\n}\n\n@NgModule({})\nexport class DelonModule {\n static forRoot(): ModuleWithProviders {\n return {\n ngModule: DelonModule,\n providers: [\n { provide: AlainThemeConfig, useFactory: fnAlainThemeConfig },\n ],\n };\n }\n}',meta:{type:"Service",order:5,title:"ResponsiveService",subtitle:"Responsive Service"},toc:[{id:"ResponsiveConfig",title:"ResponsiveConfig",h:2}]},"zh-CN":{content:'\u66f4\u53cb\u597d\u7684\u4f7f\u7528\u54cd\u5e94\u5f0f\u89c4\u5219\uff0c\u5c06\u539f xs
\u3001sm
\u7b49\u5c5e\u6027\u7b80\u5316\u6210 col
\u680f\uff0c\u9ed8\u8ba4\u54cd\u5e94\u5f0f\u89c4\u5219\uff1a
col
<576px
\u2265576px
\u2265768px
\u2265992px
\u22651200px
\u22651600px
1
1 1 1 1 1 1 2
1 2 2 2 2 2 3
1 2 3 3 3 3 4
1 2 3 4 4 4 5
1 2 3 4 6 6 6
1 2 3 4 6 12
\u4e3a\u4e86\u66f4\u597d\u7684\u5f00\u53d1\u54cd\u5e94\u5f0f\u67e5\u770b\u3001\u7f16\u8f91\u9875\uff0c\u8fd9\u79cd\u89c4\u5219\u5c06\u9ed8\u8ba4\u5c06\u8fd0\u7528\u5728 sg
\u3001sv
\u3001se
\u7b49\u7ec4\u4ef6\u4e2d\u3002\u4f60\u4e5f\u53ef\u4ee5\u5229\u7528 ResponsiveConfig
\u6765\u6539\u5199\u9ed8\u8ba4\u89c4\u5219\u3002
ResponsiveConfig
\u901a\u7528\u914d\u7f6e\u9879\uff0c\u4f8b\u5982\u7edf\u4e00\u5bf9 ResponsiveService
\u8bbe\u7f6e\u54cd\u5e94\u5f0f\u89c4\u5219\u3002
import { AlainThemeConfig } from \'@delon/theme\';\nexport function fnAlainThemeConfig(): AlainThemeConfig {\n return Object.assign(new AlainThemeConfig(), {\n responsive: {\n rules: {\n 1: { xs: 24 },\n 2: { xs: 24, sm: 12 },\n 3: { xs: 24, sm: 12, md: 8 },\n 4: { xs: 24, sm: 12, md: 8, lg: 6 },\n 5: { xs: 24, sm: 12, md: 8, lg: 6, xl: 4 },\n 6: { xs: 24, sm: 12, md: 8, lg: 6, xl: 4, xxl: 2 },\n }\n },\n });\n}\n\n@NgModule({})\nexport class DelonModule {\n static forRoot(): ModuleWithProviders {\n return {\n ngModule: DelonModule,\n providers: [\n { provide: AlainThemeConfig, useFactory: fnAlainThemeConfig },\n ],\n };\n }\n}',meta:{type:"Service",order:5,title:"ResponsiveService",subtitle:"\u54cd\u5e94\u5f0f\u670d\u52a1"},toc:[{id:"ResponsiveConfig",title:"ResponsiveConfig",h:2}]}},demo:!1},this.codes=[]}static#t=this.\u0275fac=function(e){return new(e||t)};static#e=this.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-responsive"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(e,o){1&e&&d._UZ(0,"app-docs",0),2&e&&d.Q6J("codes",o.codes)("item",o.item)},dependencies:[c.P],styles:["[_nghost-%COMP%]{display:block}"]})}return t})()},{path:"rtl",redirectTo:"rtl/zh",pathMatch:"full"},{path:"rtl/:lang",component:(()=>{class t{constructor(){this.item={cols:1,urls:{"en-US":"packages/theme/src/services/rtl/index.en-US.md","zh-CN":"packages/theme/src/services/rtl/index.zh-CN.md"},content:{"en-US":{content:'RTL service control.
',api:'API
Method Property Description dir
Direction
Get or Set the current text direction nextDir
Direction
Get the next text direction change
Observable<Direction>
Subscription change notification toggle()
- Toggle text direction
',meta:{type:"Service",order:6,title:"RTLService",subtitle:"RTL Service"},toc:[{id:"API",title:"API",h:2}]},"zh-CN":{content:'RTL\u670d\u52a1\u63a7\u5236\u3002
',api:'API
\u63a5\u53e3\u540d \u53c2\u6570 \u63cf\u8ff0 dir
Direction
\u83b7\u53d6\u6216\u8bbe\u7f6e\u5f53\u524d\u6587\u5b57\u65b9\u5411 nextDir
Direction
\u83b7\u53d6\u4e0b\u4e00\u6b21\u6587\u5b57\u65b9\u5411 change
Observable<Direction>
\u8ba2\u9605\u53d8\u66f4\u901a\u77e5 toggle()
- \u5207\u6362\u6587\u5b57\u65b9\u5411
',meta:{type:"Service",order:6,title:"RTLService",subtitle:"RTL\u670d\u52a1"},toc:[{id:"API",title:"API",h:2}]}},demo:!1},this.codes=[]}static#t=this.\u0275fac=function(e){return new(e||t)};static#e=this.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-rtl"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(e,o){1&e&&d._UZ(0,"app-docs",0),2&e&&d.Q6J("codes",o.codes)("item",o.item)},dependencies:[c.P],styles:["[_nghost-%COMP%]{display:block}"]})}return t})()},{path:"settings",redirectTo:"settings/zh",pathMatch:"full"},{path:"settings/:lang",component:(()=>{class t{constructor(){this.item={cols:1,urls:{"en-US":"packages/theme/src/services/settings/index.en-US.md","zh-CN":"packages/theme/src/services/settings/index.zh-CN.md"},content:{"en-US":{content:'Project config data, includes App, Layout, User, three data types And store persistence in localStorage
(Please refer to #1737 to switch to sessionStorage
).
Suggest: Call the setApp()
, setUser()
methods to restore project config data, via Angular startup service (startup.service.ts).
',api:'API
SettingsService
Name Type Return Value Description layout
property
Layout
Data of layout app
property
App
Data of app user
property
User
Data of User notify
property
Observable<SettingsNotify>
Notify when layout, app, user information changes setLayout(name: string, value: any)
method
boolean
Set property value of layout setApp(value: App)
method
boolean
Set app data setUser(value: User)
method
boolean
Set user data
App
Property Description Type Default [name]
Name for app string
- [description]
Description for app string
-
User
Property Description Type Default [name]
Name for current user string
- [avatar]
Avatar for current user string
- [email]
Email for current user string
-
Layout
Property Description Type Default [collapsed]
Whether to fold menu boolean
- [lang]
Current language string
- [colorWeak]
Color weak boolean
false
FAQ
How to change the local storage key name?
Support add the configuration of ALAIN_SETTING_KEYS
via the global-config.module.ts
global configuration file, for example:
const alainProvides = [\n { provide: ALAIN_CONFIG, useValue: alainConfig },\n+ {\n+ provide: ALAIN_SETTING_KEYS,\n+ useValue: {\n+ layout: \'new-layout\',\n+ user: \'new-user\',\n+ app: \'new-app\',\n+ },\n+ },\n];
',meta:{order:1,title:"SettingsService",subtitle:"Project configuration",type:"Service"},toc:[{id:"API",title:"API",h:2,children:[{id:"SettingsService",title:"SettingsService",h:3},{id:"App",title:"App",h:3},{id:"User",title:"User",h:3},{id:"Layout",title:"Layout",h:3}]},{id:"FAQ",title:"FAQ",h:2}]},"zh-CN":{content:'\u9879\u76ee\u914d\u7f6e\u9879\uff0c\u5305\u542b\u5e94\u7528App\u3001\u5e03\u5c40Layout\u3001\u7528\u6237\u4fe1\u606fUser\u4e09\u79cd\u6570\u636e\u7c7b\u578b\uff0c\u5e76\u4e14\u5b58\u50a8\u6301\u4e45\u5316\u5728 localStorage
\uff08\u53c2\u8003#1737\u6765\u5207\u6362\u6210 sessionStorage
\uff09\u3002
\u5efa\u8bae\uff1a \u5728 Angular \u542f\u52a8\u670d\u52a1\uff08startup.service.ts\uff09\u4ece\u8fdc\u7a0b\u83b7\u53d6\u5230\u5e94\u7528\u3001\u7528\u6237\u6570\u636e\u540e\uff0c\u8c03\u7528 setApp()
\u3001setUser()
\u65b9\u6cd5\u3002
',api:'API
SettingsService
\u540d\u79f0 \u7c7b\u578b \u8fd4\u56de\u503c \u63cf\u8ff0 layout
property
Layout
\u5e03\u5c40\u4fe1\u606f app
property
App
\u9879\u76ee\u4fe1\u606f user
property
User
\u7528\u6237\u4fe1\u606f notify
property
Observable<SettingsNotify>
\u5f53\u5e03\u5c40\u3001\u9879\u76ee\u3001\u7528\u6237\u4fe1\u606f\u53d8\u66f4\u65f6\u901a\u77e5 setLayout(name: string, value: any)
method
boolean
\u8bbe\u7f6e\u5e03\u5c40\u5c5e\u6027\u503c setApp(value: App)
method
boolean
\u8bbe\u7f6e\u9879\u76ee\u4fe1\u606f setUser(value: User)
method
boolean
\u8bbe\u7f6e\u7528\u6237\u4fe1\u606f
App
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [name]
\u5e94\u7528\u540d\u79f0 string
- [description]
\u5e94\u7528\u63cf\u8ff0 string
-
User
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [name]
\u5f53\u524d\u7528\u6237\u540d\u79f0 string
- [avatar]
\u5f53\u524d\u7528\u6237\u5934\u50cf string
- [email]
\u5f53\u524d\u7528\u6237\u90ae\u7bb1 string
-
Layout
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [collapsed]
\u662f\u5426\u6298\u53e0\u83dc\u5355 boolean
- [lang]
\u5f53\u524d\u8bed\u8a00 string
- [colorWeak]
\u8272\u5f31\u6a21\u5f0f boolean
false
\u5e38\u89c1\u95ee\u9898
\u5982\u4f55\u66f4\u6539\u672c\u5730\u5b58\u50a8\u952e\u540d\uff1f
\u5141\u8bb8\u901a\u8fc7 global-config.module.ts
\u5168\u5c40\u914d\u7f6e\u6587\u4ef6\uff0c\b\u589e\u52a0 ALAIN_SETTING_KEYS
\u7684\u914d\u7f6e\uff0c\u4f8b\u5982\uff1a
const alainProvides = [\n { provide: ALAIN_CONFIG, useValue: alainConfig },\n+ {\n+ provide: ALAIN_SETTING_KEYS,\n+ useValue: {\n+ layout: \'new-layout\',\n+ user: \'new-user\',\n+ app: \'new-app\',\n+ },\n+ },\n];
',meta:{order:1,title:"SettingsService",subtitle:"\u9879\u76ee\u914d\u7f6e\u9879\u670d\u52a1",type:"Service"},toc:[{id:"API",title:"API",h:2,children:[{id:"SettingsService",title:"SettingsService",h:3},{id:"App",title:"App",h:3},{id:"User",title:"User",h:3},{id:"Layout",title:"Layout",h:3}]},{id:"\u5e38\u89c1\u95ee\u9898",title:"\u5e38\u89c1\u95ee\u9898",h:2}]}},demo:!1},this.codes=[]}static#t=this.\u0275fac=function(e){return new(e||t)};static#e=this.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-settings"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(e,o){1&e&&d._UZ(0,"app-docs",0),2&e&&d.Q6J("codes",o.codes)("item",o.item)},dependencies:[c.P],styles:["[_nghost-%COMP%]{display:block}"]})}return t})()},{path:"title",redirectTo:"title/zh",pathMatch:"full"},{path:"title/:lang",component:(()=>{class t{constructor(){this.item={cols:1,urls:{"en-US":"packages/theme/src/services/title/index.en-US.md","zh-CN":"packages/theme/src/services/title/index.zh-CN.md"},content:{"en-US":{content:'Used to set page title, generally listen for route changed and refresh title, for example: app.component.ts; The default data from MenuService
.
Suggest: Set the prefix
or suffix
value via Angular startup service (startup.service.ts).
Orders
Get the title
value according to the following order:
Routing configuration `{ data: { title: \'page name\', titleI18n: \'page-name\' } }
Parse the menu data based on the current URL
Get h1
content in page alain-default__content-title
or page-header__title
Default title
',api:'API
Name Type Description default
property
Default title of document title selector
property
Set the default CSS selector string separator
property
Separator prefix
property
Prefix of document title suffix
property
Suffix of document title reverse
property
Whether to reverse setTitle(title?: string | string[])
method
Set the document title, will be delay 25ms
, pls refer to #1261 setTitleByI18n(key: string, params?: Object)
method
Set i18n key of the document title
',meta:{order:4,title:"TitleService",subtitle:"Title Service",type:"Service"},toc:[{id:"Orders",title:"Orders",h:2},{id:"API",title:"API",h:2}]},"zh-CN":{content:'\u7528\u4e8e\u8bbe\u7f6e\u9875\u9762\u6807\u9898\uff0c\u4e00\u822c\u76d1\u542c\u8def\u7531\u53d8\u5316\u5e76\u91cd\u65b0\u5237\u65b0\u6807\u9898\uff0c\u4f8b\u5982\uff1aapp.component.ts\uff1b\u540c\u65f6\u6807\u9898\u7684\u9ed8\u8ba4\u6570\u636e\u6765\u6e90\u4e8e MenuService
\u3002
\u5efa\u8bae\uff1a \u5728 Angular \u542f\u52a8\u670d\u52a1\uff08startup.service.ts\uff09\u8fc7\u7a0b\u4e2d\u8bbe\u7f6e prefix
\u6216 suffix
\u503c\u6765\u8c03\u6574\u7edf\u4e00\u7684\u6807\u9898\u524d\u540e\u7f00\u3002
\u83b7\u53d6\u987a\u5e8f
\u6839\u636e\u4ee5\u4e0b\u987a\u5e8f\u83b7\u53d6 title
\u503c\uff1a
\u8def\u7531\u914d\u7f6e { data: { title: \'page name\', titleI18n: \'page-name\' } as RouteTitle }
\u6839\u636e\u5f53\u524d URL \u89e3\u6790\u83dc\u5355\u6570\u636e
\u9875\u9762 alain-default__content-title
\u6216 page-header__title
\u4e2d\u83b7\u53d6 h1
\u5185\u5bb9
\u9ed8\u8ba4\u6807\u9898\u540d
',api:'API
\u540d\u79f0 \u7c7b\u578b \u63cf\u8ff0 default
property
\u8bbe\u7f6e\u9ed8\u8ba4\u6807\u9898\u540d selector
property
\u8bbe\u7f6e\u9ed8\u8ba4CSS\u9009\u62e9\u5668\u5b57\u7b26\u4e32 separator
property
\u8bbe\u7f6e\u5206\u9694\u7b26 prefix
property
\u8bbe\u7f6e\u524d\u7f00 suffix
property
\u8bbe\u7f6e\u540e\u7f00 reverse
property
\u8bbe\u7f6e\u662f\u5426\u53cd\u8f6c setTitle(title?: string | string[])
method
\u8bbe\u7f6e\u6807\u9898\uff0c\u53d7\u9650\u4e8e #1261 \u4f1a\u6709 25ms
\u7684\u5ef6\u8fdf setTitleByI18n(key: string, params?: Object)
method
\u8bbe\u7f6e\u56fd\u9645\u5316\u6807\u9898
',meta:{order:4,title:"TitleService",subtitle:"\u9875\u9762\u6807\u9898\u670d\u52a1",type:"Service"},toc:[{id:"\u83b7\u53d6\u987a\u5e8f",title:"\u83b7\u53d6\u987a\u5e8f",h:2},{id:"API",title:"API",h:2}]}},demo:!1},this.codes=[]}static#t=this.\u0275fac=function(e){return new(e||t)};static#e=this.\u0275cmp=d.Xpm({type:t,selectors:[["app-theme-title"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(e,o){1&e&&d._UZ(0,"app-docs",0),2&e&&d.Q6J("codes",o.codes)("item",o.item)},dependencies:[c.P],styles:["[_nghost-%COMP%]{display:block}"]})}return t})()}]}];let J=(()=>{class t{static#t=this.\u0275fac=function(e){return new(e||t)};static#e=this.\u0275mod=d.oAB({type:t});static#d=this.\u0275inj=d.cJS({imports:[q.m,Z.Bz.forChild(Y)]})}return t})()}}]);
\ No newline at end of file
diff --git a/274.47324d5c64562525.js b/274.47324d5c64562525.js
deleted file mode 100644
index 4a2e09646d..0000000000
--- a/274.47324d5c64562525.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunksite=self.webpackChunksite||[]).push([[274],{47274:(Ht,G,c)=>{c.r(G),c.d(G,{ChartModule:()=>Xt});var zt=c(52787),At=c(89359),_t=c(93285),e=c(65879),s=c(28749);let x=(()=>{var a;class o{constructor(){this.item={cols:1,urls:{"en-US":"packages/chart/docs/faq.en-US.md","zh-CN":"packages/chart/docs/faq.zh-CN.md"},content:{"en-US":{content:'How to auto-resize of the container?
The G2 uses window.addEventListener(\'resize\', this.onResize)
to detect a change in parent dom element\'s size. So you need to manually monitor the change in the size of the container and call chart.forceFit()
to force resize.
\x3c!--demo(resi ',meta:{order:100,title:"FAQ",type:"Documents"},toc:[{id:"Howtoauto-resizeofthecontainer",title:"How to auto-resize of the container?",h:2}]},"zh-CN":{content:'\u5982\u4f55\u81ea\u9002\u5e94\u5bb9\u5668\u5bbd\u9ad8\uff1f
G2 \u5f53\u524d\u7248\u672c\u5e76\u4e0d\u4f1a\u6839\u636e\u5bb9\u5668\u5bbd\u9ad8\u81ea\u9002\u5e94\uff0c\u76ee\u524d\u53ea\u4f1a\u6839\u636e\u6d4f\u89c8\u5668\u7a97\u4f53\u5927\u5c0f\u624d\u4f1a\u91cd\u65b0\u53d8\u66f4\u56fe\u8868\u5c3a\u5bf8\uff0c\u56e0\u6b64\u9700\u8981\u624b\u52a8\u76d1\u542c\u5bb9\u5668\u5927\u5c0f\u7684\u53d8\u5316\u5e76\u8c03\u7528 chart.forceFit()
\u91cd\u65b0\u6e32\u67d3\u56fe\u8868\u5c3a\u5bf8\u3002
\x3c!--demo(resi ',meta:{order:100,title:"\u5e38\u89c1\u95ee\u9898",type:"Documents"},toc:[{id:"\u5982\u4f55\u81ea\u9002\u5e94\u5bb9\u5668\u5bbd\u9ad8\uff1f",title:"\u5982\u4f55\u81ea\u9002\u5e94\u5bb9\u5668\u5bbd\u9ad8\uff1f",h:2}]}},demo:!1},this.codes=[]}}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["app-chart-faq"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,n){1&t&&e._UZ(0,"app-docs",0),2&t&&e.Q6J("codes",n.codes)("item",n.item)},dependencies:[s.P],styles:["[_nghost-%COMP%]{display:block}"]}),o})(),w=(()=>{var a;class o{constructor(){this.item={cols:1,urls:{"en-US":"packages/chart/docs/getting-started.en-US.md","zh-CN":"packages/chart/docs/getting-started.zh-CN.md"},content:{"en-US":{content:'Chart provides the well-designed abstract chart components based on the G2. These components provide the ability to use with complex mixed view or just use along for common business usage.
Usage
G2 class library loading
By default, the class library CDN address has been specified in Global Configuration:
// global-config.module.ts\nconst alainConfig: AlainConfig = {\n chart: { \n // The following is the default configuration. If the project cannot be accessed from the Internet, you can directly use the `./assets***` path for the dependent package according to the `angular.json` configuration\n libs: [\n \'https://gw.alipayobjects.com/os/lib/antv/g2/4.1.4/dist/g2.min.js\',\n \'https://gw.alipayobjects.com/os/lib/antv/data-set/0.11.7/dist/data-set.js\',\n ],\n },\n};\n\nexport class DelonModule {\n static forRoot(): ModuleWithProviders {\n return {\n ngModule: DelonModule,\n providers: [\n { provide: ALAIN_CONFIG, useValue: alainConfig }\n ]\n };\n }\n}
Of course, you can also directly import the CDN address in index.html
, for example:
<!-- Introduce online resources, select the g2 version you need and replace the version variable -->\n<script src="https://gw.alipayobjects.com/os/lib/antv/g2/{{version}}/dist/g2.min.js"></script>
You can also configure the assets
(About assets Document) option in angular.json
to obtain the G2 library from node_modules
, for example:
"assets": [\n {\n "glob": "**/*",\n "input": "./node_modules/@antv/g2/dist",\n "output": "/@antv/g2/"\n },\n {\n "glob": "**/*",\n "input": "./node_modules/@antv/data-set/dist",\n "output": "/@antv/data-set/"\n }\n]
Finally modify the libs
parameter of the global configuration:
// global-config.module.ts\nconst alainConfig: AlainConfig = {\n chart: { \n libs: [\n \'./assets/@antv/g2/g2.min.js\',\n \'./assets/@antv/data-set/data-set.js\',\n ],\n },\n};
Import module
// shared.module.ts\nimport { G2BarModule } from \'@delon/chart/bar\';\n\n@NgModule({\n imports: [ G2BarModule ],\n exports: [ G2BarModule ]\n})
Custom G2 components
Use the g2-chart component to better implement custom charts.
Configure chart theme
Configure the chart theme for all G2, but only provide interfaces. For the configuration chart theme parameters, please refer to G2 website.
// global-config.module.ts\nconst alainConfig: AlainConfig = {\n chart: { theme: \'dark\' },\n};\n\nexport class DelonModule {\n static forRoot(): ModuleWithProviders {\n return {\n ngModule: DelonModule,\n providers: [\n { provide: ALAIN_CONFIG, useValue: alainConfig }\n ]\n };\n }\n}',meta:{order:1,title:"Getting Started",type:"Documents"},toc:[{id:"Usage",title:"Usage",h:2,children:[{id:"G2classlibraryloading",title:"G2 class library loading",h:3},{id:"Importmodule",title:"Import module",h:3}]},{id:"CustomG2components",title:"Custom G2 components",h:2},{id:"Configurecharttheme",title:"Configure chart theme",h:2}]},"zh-CN":{content:'\u56fe\u8868\u662f\u57fa\u4e8e G2 (3.0) \u7684\u57fa\u7840\u4e0a\u4e8c\u6b21\u5c01\u88c5\uff0c\u63d0\u4f9b\u4e86\u4e1a\u52a1\u4e2d\u5e38\u7528\u7684\u56fe\u8868\u5957\u4ef6\uff0c\u53ef\u4ee5\u5355\u72ec\u4f7f\u7528\uff0c\u4e5f\u53ef\u4ee5\u7ec4\u5408\u8d77\u6765\u5b9e\u73b0\u590d\u6742\u7684\u5c55\u793a\u6548\u679c\u3002
\u56fe\u8868\u7684\u4f5c\u7528\uff0c\u662f\u5e2e\u52a9\u6211\u4eec\u66f4\u597d\u5730\u770b\u61c2\u6570\u636e\u3002\u9009\u62e9\u4ec0\u4e48\u56fe\u8868\uff0c\u9700\u8981\u56de\u7b54\u7684\u9996\u8981\u95ee\u9898\u662f\u300e\u6211\u6709\u4ec0\u4e48\u6570\u636e\uff0c\u9700\u8981\u7528\u56fe\u8868\u505a\u4ec0\u4e48\u300f\uff0c\u800c\u4e0d\u662f \u300e\u56fe\u8868\u957f\u6210\u4ec0\u4e48\u6837\u300f \u3002
\u5206\u7c7b\u540d \u7ec4\u4ef6\u6e05\u5355 \u63cf\u8ff0 \u6bd4\u8f83\u7c7b \u8ff7\u4f60\u67f1\u72b6\u56fe\uff1ag2-mini-bar
\u5355\u4e00\u67f1\u72b6\u56fe\uff1ag2-single-bar
\u67f1\u72b6\u56fe\uff1ag2-bar
\u96f7\u8fbe\u56fe\uff1ag2-radar
\u8ff7\u4f60\u533a\u57df\u56fe\uff1ag2-mini-area
\u8ff7\u4f60\u8fdb\u5ea6\u6761\uff1ag2-mini-progress
- \u5206\u5e03\u7c7b \u6298\u7ebf\u56fe\uff1ag2-timeline
- \u5360\u6bd4\u7c7b \u997c\u56fe\uff1ag2-pie
\u6c34\u6ce2\u56fe\uff1ag2-water-wave
\u8ff7\u4f60\u8fdb\u5ea6\u6761\uff1ag2-mini-progress
\u8ff7\u4f60\u533a\u57df\u56fe\uff1ag2-mini-area
- \u533a\u95f4\u7c7b \u4eea\u8868\u76d8\uff1ag2-gauge
\u8ff7\u4f60\u533a\u57df\u56fe\uff1ag2-mini-area
- \u8d8b\u52bf\u7c7b \u6298\u7ebf\u56fe\uff1ag2-timeline
\u8ff7\u4f60\u533a\u57df\u56fe\uff1ag2-mini-area
- \u65f6\u95f4\u7c7b \u6298\u7ebf\u56fe\uff1ag2-timeline
\u8ff7\u4f60\u533a\u57df\u56fe\uff1ag2-mini-area
- \u5176\u5b83 \u6807\u7b7e\u4e91\uff1ag2-tag-cloud
\u56fe\u8868\u5361\u7247\uff1ag2-chart-card
\u81ea\u5b9a\u4e49\u56fe\u8868\uff1ag2-chart
-
\u5982\u4f55\u4f7f\u7528
G2\u7c7b\u5e93\u52a0\u8f7d
\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5728\u5168\u5c40\u914d\u7f6e\u5df2\u7ecf\u6307\u5b9a\u7c7b\u5e93 CDN \u5730\u5740\uff1a
// global-config.module.ts\nconst alainConfig: AlainConfig = {\n chart: { \n // \u4ee5\u4e0b\u662f\u9ed8\u8ba4\u914d\u7f6e\uff0c\u5982\u679c\u9879\u76ee\u65e0\u6cd5\u5916\u7f51\u8bbf\u95ee\uff0c\u53ef\u4ee5\u6839\u636e `angular.json` \u914d\u7f6e\u5c06\u4f9d\u8d56\u5305\u76f4\u63a5\u4f7f\u7528 `./assets***` \u8def\u5f84\n libs: [\n \'https://gw.alipayobjects.com/os/lib/antv/g2/4.1.4/dist/g2.min.js\',\n \'https://gw.alipayobjects.com/os/lib/antv/data-set/0.11.7/dist/data-set.js\',\n ],\n },\n};\n\nexport class DelonModule {\n static forRoot(): ModuleWithProviders {\n return {\n ngModule: DelonModule,\n providers: [\n { provide: ALAIN_CONFIG, useValue: alainConfig }\n ]\n };\n }\n}
\u5f53\u7136\u4e5f\u53ef\u4ee5\u5728 index.html
\u76f4\u63a5\u5f15\u5165 CDN \u5730\u5740\uff0c\u4f8b\u5982\uff1a
<!-- \u5f15\u5165\u5728\u7ebf\u8d44\u6e90\uff0c\u9009\u62e9\u4f60\u9700\u8981\u7684 g2 \u7248\u672c\u4ee5\u66ff\u6362 version \u53d8\u91cf -->\n<script src="https://gw.alipayobjects.com/os/lib/antv/g2/{{version}}/dist/g2.min.js"></script>
\u4e5f\u53ef\u4ee5\u5728 angular.json
\u914d\u7f6e assets
\u9009\u9879\uff08\u6709\u5173 assets \u6587\u6863\uff09\uff0c\u4ece node_modules
\u6765\u83b7\u5f97G2\u7c7b\u5e93\uff0c\u4f8b\u5982\uff1a
"assets": [\n {\n "glob": "**/*",\n "input": "./node_modules/@antv/g2/dist",\n "output": "/@antv/g2/"\n },\n {\n "glob": "**/*",\n "input": "./node_modules/@antv/data-set/dist",\n "output": "/@antv/data-set/"\n }\n]
\u6700\u540e\u4fee\u6539\u5168\u5c40\u914d\u7f6e\u7684 libs
\u53c2\u6570\u4e3a\uff1a
// global-config.module.ts\nconst alainConfig: AlainConfig = {\n chart: { \n libs: [\n \'./assets/@antv/g2/g2.min.js\',\n \'./assets/@antv/data-set/data-set.js\',\n ],\n },\n};
\u5bfc\u5165\u6a21\u5757
// shared.module.ts\nimport { G2BarModule } from \'@delon/chart/bar\';\n\n@NgModule({\n imports: [ G2BarModule ],\n exports: [ G2BarModule ]\n})
\u81ea\u5b9a\u4e49 G2 \u7ec4\u4ef6
\u4f7f\u7528 g2-chart \u7ec4\u4ef6\u5feb\u901f\u81ea\u5b9a\u4e49\u4e00\u4e2a\u56fe\u8868\uff0c\u53ef\u4ee5\u51cf\u5c11\u4e0d\u5fc5\u8981\u7684\u7ec4\u4ef6\u6e32\u67d3\u8fc7\u7a0b\u4e2d\u6240\u4ea7\u751f\u7684\u5947\u602a\u95ee\u9898\u3002
\u914d\u7f6e\u56fe\u8868\u4e3b\u9898
\u5bf9\u6240\u6709 G2 \u8fdb\u884c\u914d\u7f6e\u56fe\u8868\u4e3b\u9898\uff0c\u4f46\u53ea\u63d0\u4f9b\u63a5\u53e3\uff0c\u6709\u5173\u914d\u7f6e\u56fe\u8868\u4e3b\u9898\u53c2\u6570\uff0c\u8bf7\u53c2\u8003G2\u5b98\u7f51\u3002
// global-config.module.ts\nconst alainConfig: AlainConfig = {\n chart: { theme: \'dark\' },\n};\n\nexport class DelonModule {\n static forRoot(): ModuleWithProviders {\n return {\n ngModule: DelonModule,\n providers: [\n { provide: ALAIN_CONFIG, useValue: alainConfig }\n ]\n };\n }\n}',meta:{order:1,title:"\u5f00\u59cb\u4f7f\u7528",type:"Documents"},toc:[{id:"\u5982\u4f55\u4f7f\u7528",title:"\u5982\u4f55\u4f7f\u7528",h:2,children:[{id:"G2\u7c7b\u5e93\u52a0\u8f7d",title:"G2\u7c7b\u5e93\u52a0\u8f7d",h:3},{id:"\u5bfc\u5165\u6a21\u5757",title:"\u5bfc\u5165\u6a21\u5757",h:3}]},{id:"\u81ea\u5b9a\u4e49G2\u7ec4\u4ef6",title:"\u81ea\u5b9a\u4e49 G2 \u7ec4\u4ef6",h:2},{id:"\u914d\u7f6e\u56fe\u8868\u4e3b\u9898",title:"\u914d\u7f6e\u56fe\u8868\u4e3b\u9898",h:2}]}},demo:!1},this.codes=[]}}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["app-chart-getting-started"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,n){1&t&&e._UZ(0,"app-docs",0),2&t&&e.Q6J("codes",n.codes)("item",n.item)},dependencies:[s.P],styles:["[_nghost-%COMP%]{display:block}"]}),o})();var l=c(10095),m=c(27358),u=c(43460),Gt=c(69694),g=c(42840),p=c(70855),v=c(41958);let I=(()=>{var a;class o{constructor(t){this.msg=t,this.salesData=this.genData()}genData(){return new Array(12).fill({}).map((t,n)=>({x:`${n+1}\u6708`,y:Math.floor(1e3*Math.random())+200,color:n>5?"#f50":void 0}))}refresh(){this.salesData=this.genData()}handleClick(t){this.msg.info(`${t.item.x} - ${t.item.y}`)}}return(a=o).\u0275fac=function(t){return new(t||a)(e.Y36(u.dD))},a.\u0275cmp=e.Xpm({type:a,selectors:[["chart-bar-basic"]],decls:3,vars:2,consts:[["nz-button","","nzType","primary",3,"click"],["height","200",3,"title","data","clickItem"]],template:function(t,n){1&t&&(e.TgZ(0,"button",0),e.NdJ("click",function(){return n.refresh()}),e._uU(1,"Refresh"),e.qZA(),e.TgZ(2,"g2-bar",1),e.NdJ("clickItem",function(i){return n.handleClick(i)}),e.qZA()),2&t&&(e.xp6(2),e.Q6J("title","\u9500\u552e\u989d\u8d8b\u52bf")("data",n.salesData))},dependencies:[Gt.g,g.ix,p.w,v.dQ],encapsulation:2}),o})(),B=(()=>{var a;class o{constructor(){this.item={cols:1,urls:{"zh-CN":"packages/chart/bar/index.md"},content:{"zh-CN":{content:'\u4f7f\u7528\u5782\u76f4\u7684\u67f1\u5b50\u663e\u793a\u7c7b\u522b\u4e4b\u95f4\u7684\u6570\u503c\u6bd4\u8f83\u3002\u5176\u4e2d\u4e00\u4e2a\u8f74\u8868\u793a\u9700\u8981\u5bf9\u6bd4\u7684\u5206\u7c7b\u7ef4\u5ea6\uff0c\u53e6\u4e00\u4e2a\u8f74\u4ee3\u8868\u76f8\u5e94\u7684\u6570\u503c\u3002
',api:'API
g2-bar
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [repaint]
\u6570\u636e\u518d\u6b21\u53d8\u66f4\u65f6\u662f\u5426\u91cd\u7ed8 boolean
true
[delay]
\u5ef6\u8fdf\u6e32\u67d3\uff0c\u5355\u4f4d\uff1a\u6beb\u79d2 number
0
[title]
\u56fe\u8868\u6807\u9898 string,TemplateRef<void>
- [color]
\u56fe\u8868\u989c\u8272 string
rgba(24, 144, 255, 0.85)
[padding]
\u56fe\u8868\u5185\u90e8\u95f4\u8ddd Array<number | string> | string
[32, 0, 32, 40]
[height]
\u56fe\u8868\u9ad8\u5ea6 number
- [data]
\u6570\u636e G2BarData[]
[]
[autoLabel]
\u5728\u5bbd\u5ea6\u4e0d\u8db3\u65f6\uff0c\u81ea\u52a8\u9690\u85cf x \u8f74\u7684 label boolean
true
[interaction]
\u4ea4\u4e92\u7c7b\u578b\uff0cnone \u65e0 element-active \u56fe\u5f62\u5143\u7d20\uff0cactive-region \u56fe\u8868\u7ec4\u4ef6\uff0cbrush \u6846\u9009\uff0cdrag-move \u79fb\u52a8 InteractionType
none
[theme]
\u5b9a\u5236\u56fe\u8868\u4e3b\u9898 string | LooseObject
- (clickItem)
\u70b9\u51fb\u9879\u56de\u8c03 EventEmitter<G2BarClickItem>
- (ready)
\u5f53G2\u5b8c\u6210\u521d\u59cb\u5316\u540e\u8c03\u7528 EventEmitter<Chart>
-
G2BarData
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [x]
x\u8f74 any
- [y]
y\u8f74 any
- [color]
\u8f74\u989c\u8272 string
-
',meta:{title:"g2-bar",subtitle:"\u67f1\u72b6\u56fe",cols:1,type:"G2",module:"import { G2BarModule } from '@delon/chart/bar';"},toc:[{id:"API",title:"API",h:2,children:[{id:"g2-bar",title:"g2-bar",h:3},{id:"G2BarData",title:"G2BarData",h:3}]}]}},demo:!0},this.codes=[{id:"chart-bar-basic",meta:{order:0,title:{"zh-CN":"\u57fa\u672c","en-US":"Basic"}},summary:"\u901a\u8fc7\u8bbe\u7f6e x
\uff0cy
\u5c5e\u6027\uff0c\u53ef\u4ee5\u5feb\u901f\u7684\u6784\u5efa\u51fa\u4e00\u4e2a\u6f02\u4eae\u7684\u67f1\u72b6\u56fe\uff0c\u5404\u79cd\u7eac\u5ea6\u7684\u5173\u7cfb\u5219\u662f\u901a\u8fc7\u81ea\u5b9a\u4e49\u7684\u6570\u636e\u5c55\u73b0\u3002
",code:"import { Component } from '@angular/core';\nimport { G2BarClickItem, G2BarData } from '@delon/chart/bar';\nimport { NzMessageService } from 'ng-zorro-antd/message';\n\n@Component({\n selector: 'chart-bar-basic',\n template: `\n \n \n `,\n})\nexport class ChartBarBasicComponent {\n constructor(private msg: NzMessageService) {}\n\n salesData = this.genData();\n\n private genData(): G2BarData[] {\n return new Array(12).fill({}).map((_i, idx) => ({\n x: `${idx + 1}\u6708`,\n y: Math.floor(Math.random() * 1000) + 200,\n color: idx > 5 ? '#f50' : undefined,\n }));\n }\n\n refresh(): void {\n this.salesData = this.genData();\n }\n\n handleClick(data: G2BarClickItem): void {\n this.msg.info(`${data.item.x} - ${data.item.y}`);\n }\n}",name:"basic",urls:"packages/chart/bar/demo/basic.md",type:"demo",lang:"ts",componentName:"ChartBarBasicComponent",point:0}]}}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["app-chart-bar"]],decls:5,vars:5,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","24"],[3,"item"]],template:function(t,n){1&t&&(e.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),e._UZ(4,"chart-bar-basic"),e.qZA()()()()),2&t&&(e.Q6J("codes",n.codes)("item",n.item),e.xp6(1),e.Q6J("nzGutter",16),e.xp6(2),e.Q6J("item",n.codes[0]),e.uIk("id",n.codes[0].id))},dependencies:[l.t3,l.SK,s.P,m.e,I],styles:["[_nghost-%COMP%]{display:block}"]}),o})();var y=c(68636),M=c(37690),k=c(96109),T=c(90551);function xt(a,o){1&a&&e._UZ(0,"i",4)}let P=(()=>{var a;class o{}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["chart-card-style1"]],decls:9,vars:4,consts:[["footer","\u65e5\u8bbf\u95ee\u91cf 12,423","contentHeight","46",3,"title","bordered","total","action"],["action",""],["flag","up",2,"margin","0 16px 0 8px","color","rgba(0,0,0,.85)"],["flag","down",2,"margin","0 0 0 8px","color","rgba(0,0,0,.85)"],["nz-tooltip","","nzTooltipTitle","\u6307\u6807\u8bf4\u660e","nz-icon","","nzType","info-circle"]],template:function(t,n){if(1&t&&(e.TgZ(0,"g2-card",0),e.YNc(1,xt,1,0,"ng-template",null,1,e.W1O),e._uU(3," \u5468\u540c\u6bd4 "),e.TgZ(4,"trend",2),e._uU(5,"12%"),e.qZA(),e._uU(6," \u65e5\u73af\u6bd4 "),e.TgZ(7,"trend",3),e._uU(8,"11%"),e.qZA()()),2&t){const r=e.MAs(2);e.Q6J("title","\u9500\u552e\u989d")("bordered",!0)("total","\xa5 126,560.00")("action",r)}},dependencies:[y.n,M._,p.w,k.SY,T.Ls],encapsulation:2}),o})();function wt(a,o){1&a&&e._UZ(0,"img",3)}function It(a,o){1&a&&e._UZ(0,"i",4)}let S=(()=>{var a;class o{}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["chart-card-style2"]],decls:5,vars:5,consts:[["footer","\u65e5\u8bbf\u95ee\u91cf 12,423",3,"title","bordered","total","avatar","action"],["avatar",""],["action",""],["src","./assets/img/logo-color.svg",2,"width","56px","height","56px"],["nz-tooltip","","nzTooltipTitle","\u6307\u6807\u8bf4\u660e","nz-icon","","nzType","info-circle"]],template:function(t,n){if(1&t&&(e.TgZ(0,"g2-card",0),e.YNc(1,wt,1,0,"ng-template",null,1,e.W1O),e.YNc(3,It,1,0,"ng-template",null,2,e.W1O),e.qZA()),2&t){const r=e.MAs(2),i=e.MAs(4);e.Q6J("title","\u79fb\u52a8\u6307\u6807")("bordered",!0)("total","\xa5 126,560.00")("avatar",r)("action",i)}},dependencies:[y.n,p.w,k.SY,T.Ls],encapsulation:2}),o})();function Bt(a,o){1&a&&e._UZ(0,"img",3)}function Pt(a,o){1&a&&e._UZ(0,"i",4)}let N=(()=>{var a;class o{}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["chart-card-style3"]],decls:5,vars:5,consts:[[3,"title","bordered","total","avatar","action"],["avatar",""],["action",""],["src","./assets/img/logo-color.svg",2,"width","56px","height","56px"],["nz-tooltip","","nzTooltipTitle","\u6307\u6807\u8bf4\u660e","nz-icon","","nzType","info-circle"]],template:function(t,n){if(1&t&&(e.TgZ(0,"g2-card",0),e.YNc(1,Bt,1,0,"ng-template",null,1,e.W1O),e.YNc(3,Pt,1,0,"ng-template",null,2,e.W1O),e.qZA()),2&t){const r=e.MAs(2),i=e.MAs(4);e.Q6J("title","\u79fb\u52a8\u6307\u6807")("bordered",!0)("total","\xa5 126,560.00")("avatar",r)("action",i)}},dependencies:[y.n,p.w,k.SY,T.Ls],encapsulation:2}),o})(),Z=(()=>{var a;class o{constructor(){this.item={cols:2,urls:{"zh-CN":"packages/chart/card/index.md"},content:{"zh-CN":{content:'\u56fe\u8868\u5361\u7247\uff0c\u7528\u4e8e\u5c55\u793a\u56fe\u8868\u7684\u5361\u7247\u5bb9\u5668\uff0c\u53ef\u4ee5\u65b9\u4fbf\u7684\u914d\u5408\u5176\u5b83\u56fe\u8868\u5957\u4ef6\u5c55\u793a\u4e30\u5bcc\u4fe1\u606f\u3002
',api:'API
g2-card
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [title]
\u5361\u7247\u6807\u9898 string,TemplateRef<void>
- [avatar]
\u5934\u50cf string,TemplateRef<void>
- [action]
\u5361\u7247\u64cd\u4f5c string,TemplateRef<void>
- [total]
\u6570\u636e\u603b\u91cf\uff08\u652f\u6301HTML\uff09 string
- [footer]
\u5361\u7247\u5e95\u90e8 string,TemplateRef<void>
- [contentHeight]
\u5185\u5bb9\u533a\u57df\u9ad8\u5ea6\uff08\u5355\u4f4d\uff1apx
\uff09 string
- [bordered]
\u662f\u5426\u663e\u793a\u8fb9\u6846 boolean
false
',meta:{title:"g2-card",subtitle:"\u56fe\u8868\u5361\u7247",cols:2,type:"G2",module:"import { G2CardModule } from '@delon/chart/card';"},toc:[{id:"API",title:"API",h:2,children:[{id:"g2-card",title:"g2-card",h:3}]}]}},demo:!0},this.codes=[{id:"chart-card-style1",meta:{order:0,title:{"zh-CN":"\u98ce\u683c\u4e00","en-US":"Style 1"}},summary:"\u98ce\u683c\u4e00\u7528\u6cd5\u3002
",code:'import { Component } from \'@angular/core\';\n\n@Component({\n selector: \'chart-card-style1\',\n template: `\n \n \n \n \n \u5468\u540c\u6bd4\n 12% \n \u65e5\u73af\u6bd4\n 11% \n \n `,\n})\nexport class ChartCardStyle1Component {}',name:"style1",urls:"packages/chart/card/demo/style1.md",type:"demo",lang:"ts",componentName:"ChartCardStyle1Component",point:0},{id:"chart-card-style2",meta:{order:0,title:{"zh-CN":"\u98ce\u683c\u4e8c","en-US":"Style 2"}},summary:"\u98ce\u683c\u4e8c\u7528\u6cd5\u3002
",code:'import { Component } from \'@angular/core\';\n\n@Component({\n selector: \'chart-card-style2\',\n template: `\n \n \n \n \n \n \n `,\n})\nexport class ChartCardStyle2Component {}',name:"style2",urls:"packages/chart/card/demo/style2.md",type:"demo",lang:"ts",componentName:"ChartCardStyle2Component",point:1},{id:"chart-card-style3",meta:{order:0,title:{"zh-CN":"\u98ce\u683c\u4e09","en-US":"Style 3"}},summary:"\u98ce\u683c\u4e09\u7528\u6cd5\u3002
",code:'import { Component } from \'@angular/core\';\n\n@Component({\n selector: \'chart-card-style3\',\n template: `\n \n \n \n \n \n \n `,\n})\nexport class ChartCardStyle3Component {}',name:"style3",urls:"packages/chart/card/demo/style3.md",type:"demo",lang:"ts",componentName:"ChartCardStyle3Component",point:2}]}}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["app-chart-card"]],decls:10,vars:9,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","12"],[3,"item"]],template:function(t,n){1&t&&(e.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),e._UZ(4,"chart-card-style1"),e.qZA(),e.TgZ(5,"code-box",3),e._UZ(6,"chart-card-style3"),e.qZA()(),e.TgZ(7,"div",2)(8,"code-box",3),e._UZ(9,"chart-card-style2"),e.qZA()()()()),2&t&&(e.Q6J("codes",n.codes)("item",n.item),e.xp6(1),e.Q6J("nzGutter",16),e.xp6(2),e.Q6J("item",n.codes[0]),e.uIk("id",n.codes[0].id),e.xp6(2),e.Q6J("item",n.codes[2]),e.uIk("id",n.codes[2].id),e.xp6(3),e.Q6J("item",n.codes[1]),e.uIk("id",n.codes[1].id))},dependencies:[l.t3,l.SK,s.P,m.e,P,S,N],styles:["[_nghost-%COMP%]{display:block}"]}),o})();var E=c(60095),F=c(59951),St=c(96494);let U=(()=>{var a;class o{constructor(){this.dark=!1,this.two=!1,this.option1={tooltip:{formatter:"{a}
{b} : {c}%"},series:[{name:"Pressure",type:"gauge",detail:{formatter:"{value}"},data:[{value:50,name:"SCORE"}]}]},this.option2={title:{text:"ECharts \u5165\u95e8\u793a\u4f8b"},tooltip:{},legend:{data:["\u9500\u91cf"]},xAxis:{data:["\u886c\u886b","\u7f8a\u6bdb\u886b","\u96ea\u7eba\u886b","\u88e4\u5b50","\u9ad8\u8ddf\u978b","\u889c\u5b50"]},yAxis:{},series:[{name:"\u9500\u91cf",type:"bar",data:[5,20,36,10,10,20]}]}}handleEvents(t){console.log(t)}}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["chart-chart-echarts-basic"]],decls:6,vars:3,consts:[[1,"mb-md"],[3,"ngModel","ngModelChange"],["nz-button","","nzType","primary",3,"click"],[3,"option","theme","events"]],template:function(t,n){1&t&&(e.TgZ(0,"div",0)(1,"nz-switch",1),e.NdJ("ngModelChange",function(i){return n.dark=i}),e.qZA(),e._uU(2," Dark "),e.TgZ(3,"button",2),e.NdJ("click",function(){return n.two=!n.two}),e._uU(4,"Change Option"),e.qZA()(),e.TgZ(5,"chart-echarts",3),e.NdJ("events",function(i){return n.handleEvents(i)}),e.qZA()),2&t&&(e.xp6(1),e.Q6J("ngModel",n.dark),e.xp6(4),e.Q6J("option",n.two?n.option1:n.option2)("theme",n.dark?"dark":null))},dependencies:[E.JJ,E.On,F.d,g.ix,p.w,v.dQ,St.i],encapsulation:2}),o})(),J=(()=>{var a;class o{constructor(t){this.msg=t,this.dark=!1,this.two=!1,this.on=[{eventName:"click",handler:({event:n,chart:r})=>{this.msg.info(`${n.type}: ${n.name} - ${n.value} (${r.id})`)}}],this.option={xAxis:{type:"category",data:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]},yAxis:{type:"value"},series:[{data:[150,230,224,218,135,147,260],type:"line"}]}}}return(a=o).\u0275fac=function(t){return new(t||a)(e.Y36(u.dD))},a.\u0275cmp=e.Xpm({type:a,selectors:[["chart-chart-echarts-on"]],decls:1,vars:2,consts:[[3,"option","on"]],template:function(t,n){1&t&&e._UZ(0,"chart-echarts",0),2&t&&e.Q6J("option",n.option)("on",n.on)},dependencies:[F.d],encapsulation:2}),o})(),O=(()=>{var a;class o{constructor(){this.item={cols:1,urls:{"zh-CN":"packages/chart/chart-echarts/index.md"},content:{"zh-CN":{content:'ECharts \u4e00\u4e2a\u57fa\u4e8e JavaScript \u7684\u5f00\u6e90\u53ef\u89c6\u5316\u56fe\u8868\u5e93\u3002\u4f7f\u7528\u61d2\u52a0\u8f7d ECharts \u811a\u672c\uff0c\u5f00\u7bb1\u542f\u7528\u3002
',api:'API
chart-echarts
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [width]
\u56fe\u8868\u5bbd\u5ea6 number, string
100%
[height]
\u56fe\u8868\u9ad8\u5ea6 number, string
400px
[option]
\u914d\u7f6e\u9879 ChartEChartsOption
- [theme]
\u4e3b\u9898\u914d\u7f6e string, object
- [on]
\u7b49\u540c\u4e8e ECharts on ChartEChartsOn[]
- (events)
\u4e8b\u4ef6\u56de\u8c03 EventEmitter<ChartEChartsEvent>
-
',meta:{title:"chart-echarts",subtitle:"ECharts",cols:1,type:"ECharts",module:"import { ChartEChartsModule } from '@delon/chart/chart-echarts';"},toc:[{id:"API",title:"API",h:2,children:[{id:"chart-echarts",title:"chart-echarts",h:3}]}]}},demo:!0},this.codes=[{id:"chart-chart-echarts-basic",meta:{order:0,title:{"zh-CN":"\u57fa\u672c","en-US":"Basic"}},summary:{"zh-CN":"\u6700\u7b80\u5355\u7684\u7528\u6cd5\u3002
","en-US":"Simplest of usage.
"},code:"import { Component } from '@angular/core';\nimport { ChartEChartsEvent, ChartEChartsOption } from '@delon/chart/chart-echarts';\n\n@Component({\n selector: 'chart-chart-echarts-basic',\n template: `\n \n Dark\n \n \n \n `,\n})\nexport class ChartChartEchartsBasicComponent {\n dark = false;\n two = false;\n\n option1: ChartEChartsOption = {\n tooltip: {\n formatter: '{a}
{b} : {c}%',\n },\n series: [\n {\n name: 'Pressure',\n type: 'gauge',\n detail: {\n formatter: '{value}',\n },\n data: [\n {\n value: 50,\n name: 'SCORE',\n },\n ],\n },\n ],\n };\n\n option2: ChartEChartsOption = {\n title: {\n text: 'ECharts \u5165\u95e8\u793a\u4f8b',\n },\n tooltip: {},\n legend: {\n data: ['\u9500\u91cf'],\n },\n xAxis: {\n data: ['\u886c\u886b', '\u7f8a\u6bdb\u886b', '\u96ea\u7eba\u886b', '\u88e4\u5b50', '\u9ad8\u8ddf\u978b', '\u889c\u5b50'],\n },\n yAxis: {},\n series: [\n {\n name: '\u9500\u91cf',\n type: 'bar',\n data: [5, 20, 36, 10, 10, 20],\n },\n ],\n };\n\n handleEvents(ev: ChartEChartsEvent): void {\n console.log(ev);\n }\n}",name:"basic",urls:"packages/chart/chart-echarts/demo/basic.md",type:"demo",lang:"ts",componentName:"ChartChartEchartsBasicComponent",point:0},{id:"chart-chart-echarts-on",meta:{order:0,title:{"zh-CN":"\u7ed1\u5b9a\u4e8b\u4ef6","en-US":"Bind event"}},summary:{"zh-CN":'\u4f7f\u7528 on
\u5c5e\u6027\uff0c\u7b49\u540c\u4e8e ECharts on\u3002
',"en-US":'Using the on
attribute is equivalent to ECharts on.
'},code:"import { Component } from '@angular/core';\n\nimport { ChartEChartsOn, ChartEChartsOption } from '@delon/chart/chart-echarts';\nimport { NzMessageService } from 'ng-zorro-antd/message';\n\n@Component({\n selector: 'chart-chart-echarts-on',\n template: ` `\n})\nexport class ChartChartEchartsOnComponent {\n dark = false;\n two = false;\n\n on: ChartEChartsOn[] = [\n {\n eventName: 'click',\n handler: ({ event, chart }) => {\n this.msg.info(`${event.type}: ${event.name} - ${event.value} (${chart.id})`);\n }\n }\n ];\n\n option: ChartEChartsOption = {\n xAxis: {\n type: 'category',\n data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']\n },\n yAxis: {\n type: 'value'\n },\n series: [\n {\n data: [150, 230, 224, 218, 135, 147, 260],\n type: 'line'\n }\n ]\n };\n\n constructor(private msg: NzMessageService) {}\n}",name:"on",urls:"packages/chart/chart-echarts/demo/on.md",type:"demo",lang:"ts",componentName:"ChartChartEchartsOnComponent",point:1}]}}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["app-chart-chart-echarts"]],decls:7,vars:7,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","24"],[3,"item"]],template:function(t,n){1&t&&(e.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),e._UZ(4,"chart-chart-echarts-basic"),e.qZA(),e.TgZ(5,"code-box",3),e._UZ(6,"chart-chart-echarts-on"),e.qZA()()()()),2&t&&(e.Q6J("codes",n.codes)("item",n.item),e.xp6(1),e.Q6J("nzGutter",16),e.xp6(2),e.Q6J("item",n.codes[0]),e.uIk("id",n.codes[0].id),e.xp6(2),e.Q6J("item",n.codes[1]),e.uIk("id",n.codes[1].id))},dependencies:[l.t3,l.SK,s.P,m.e,U,J],styles:["[_nghost-%COMP%]{display:block}"]}),o})();var Nt=c(7802);let Q=(()=>{var a;class o{constructor(t){this.ngZone=t}render(t){this.ngZone.runOutsideAngular(()=>this.init(t.nativeElement))}init(t){const n=[{action:"\u6d4f\u89c8\u7f51\u7ad9",pv:5e4,percent:0},{action:"\u653e\u5165\u8d2d\u7269\u8f66",pv:35e3,percent:0},{action:"\u751f\u6210\u8ba2\u5355",pv:25e3,percent:0},{action:"\u652f\u4ed8\u8ba2\u5355",pv:15e3,percent:0},{action:"\u5b8c\u6210\u4ea4\u6613",pv:8e3,percent:0}].map(i=>(i.percent=i.pv/5e4,i)),r=new window.G2.Chart({container:t,autoFit:!0,height:500,width:t.clientWidth,padding:[20,120,95]});r.data(n),r.axis(!1),r.tooltip({showTitle:!1,showMarkers:!1,itemTpl:'{name}
\u6d4f\u89c8\u4eba\u6570\uff1a{pv}
\u5360\u6bd4\uff1a{percent}
'}),r.coordinate("rect").transpose().scale(1,-1),r.interval().adjust("symmetric").position("action*percent").shape("funnel").color("action",["#0050B3","#1890FF","#40A9FF","#69C0FF","#BAE7FF"]).label("action*pv",(i,h)=>({content:`${i} ${h}`}),{offset:35,labelLine:{style:{lineWidth:1,stroke:"rgba(0, 0, 0, 0.15)"}}}).tooltip("action*pv*percent",(i,h,C)=>({name:i,percent:100*+C+"%",pv:h})).animate({appear:{animation:"fade-in"},update:{}}),r.interaction("element-active"),r.on("beforepaint",()=>{r.annotation().clear(!0),r.getData().forEach(h=>{r.annotation().text({top:!0,position:{action:h.action,percent:"median"},content:100*+h.percent+"%",style:{stroke:null,fill:"#fff",textAlign:"center"}})})}),r.render()}}return(a=o).\u0275fac=function(t){return new(t||a)(e.Y36(e.R0b))},a.\u0275cmp=e.Xpm({type:a,selectors:[["chart-custom-basic"]],decls:1,vars:0,consts:[["delay","100",3,"render"]],template:function(t,n){1&t&&(e.TgZ(0,"g2-custom",0),e.NdJ("render",function(i){return n.render(i)}),e.qZA())},dependencies:[Nt.A],encapsulation:2}),o})(),R=(()=>{var a;class o{constructor(){this.item={cols:1,urls:{"en-US":"packages/chart/custom/index.en-US.md","zh-CN":"packages/chart/custom/index.zh-CN.md"},content:{"en-US":{content:'Use g2-custom
component to package your G2 chart.
How to use
A simple example template:
import { Component, ElementRef } from \'@angular/core\';\n\n@Component({\n selector: \'app-demo\',\n template: `\n <g2-custom (render)="render($event)"></g2-custom>\n `,\n})\nexport class DemoComponent {\n render(el: ElementRef) {\n // Coding G2 code\n }\n}
How to develop G2
If throw error G2
not found, please refer to Frequently Asked Questions.
Links
',api:'API
g2-custom
Property Description Type Default [delay]
Delayed rendering, unit: ms number
0
[height]
Height of chart container number
- [resizeTime]
Resize event debounce time number
200
(render)
Render event EventEmitter<ElementRef>
- (resize)
Resize event EventEmitter<ElementRef>
- (destroy)
Destroy event EventEmitter<ElementRef>
- [theme]
Custom chart theme string | LooseObject
-
',meta:{title:"g2-chart",subtitle:"Custom Chart",cols:1,type:"G2",module:"import { G2CustomModule } from '@delon/chart/custom';"},toc:[{id:"Howtouse",title:"How to use",h:2,children:[{id:"HowtodevelopG2",title:"How to develop G2",h:3}]},{id:"Links",title:"Links",h:2},{id:"API",title:"API",h:2,children:[{id:"g2-custom",title:"g2-custom",h:3}]}]},"zh-CN":{content:'\u4f7f\u7528 g2-custom
\u7ec4\u4ef6\u53ef\u4ee5\u66f4\u5feb\u901f\u7684\u5c01\u88c5\u81ea\u5df1\u7684\u56fe\u8868\u7ec4\u4ef6\u3002
\u5982\u4f55\u4f7f\u7528
\u4e00\u4e2a\u7b80\u5355\u793a\u4f8b\u6a21\u677f\uff1a
import { Component, ElementRef } from \'@angular/core\';\n\n@Component({\n selector: \'app-demo\',\n template: `\n <g2-custom (render)="render($event)"></g2-custom>\n `,\n})\nexport class DemoComponent {\n render(el: ElementRef) {\n // \u5f00\u59cb\u7f16\u5199 G2 \u4ee3\u7801\n }\n}
\u5982\u4f55\u5f00\u53d1 G2
\u53ef\u80fd\u4f60\u4f1a\u9047\u5230\u672a\u627e\u5230 G2
\uff0c\u8bf7\u53c2\u8003\u5e38\u89c1\u95ee\u9898\u3002
\u94fe\u63a5
',api:'API
g2-custom
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [delay]
\u5ef6\u8fdf\u6e32\u67d3\uff0c\u5355\u4f4d\uff1a\u6beb\u79d2 number
0
[height]
\u9ad8 number
- [resizeTime]
resize \u4e8b\u4ef6\u53bb\u6296\u65f6\u957f number
200
(render)
\u6e32\u67d3\u4e8b\u4ef6 EventEmitter<ElementRef>
- (resize)
resize \u4e8b\u4ef6 EventEmitter<ElementRef>
- (destroy)
\u9500\u6bc1\u4e8b\u4ef6 EventEmitter<ElementRef>
- [theme]
\u5b9a\u5236\u56fe\u8868\u4e3b\u9898 string | LooseObject
-
',meta:{title:"g2-chart",subtitle:"\u81ea\u5b9a\u4e49\u56fe\u8868",cols:1,type:"G2",module:"import { G2CustomModule } from '@delon/chart/custom';"},toc:[{id:"\u5982\u4f55\u4f7f\u7528",title:"\u5982\u4f55\u4f7f\u7528",h:2,children:[{id:"\u5982\u4f55\u5f00\u53d1G2",title:"\u5982\u4f55\u5f00\u53d1 G2",h:3}]},{id:"\u94fe\u63a5",title:"\u94fe\u63a5",h:2},{id:"API",title:"API",h:2,children:[{id:"g2-custom",title:"g2-custom",h:3}]}]}},demo:!0},this.codes=[{id:"chart-custom-basic",meta:{order:0,title:{"zh-CN":"\u57fa\u7840","en-US":"Basic"}},summary:{"zh-CN":'\u6a21\u4eff\u81ea antv\u57fa\u7840\u6f0f\u6597\u56fe\u3002
',"en-US":'Copy Basic Funnel Chart\u3002
'},code:"import { Component, ElementRef, NgZone } from '@angular/core';\nimport type { Chart } from '@antv/g2';\n\n@Component({\n selector: 'chart-custom-basic',\n template: ` `,\n})\nexport class ChartCustomBasicComponent {\n constructor(private ngZone: NgZone) {}\n\n render(el: ElementRef): void {\n this.ngZone.runOutsideAngular(() => this.init(el.nativeElement));\n }\n\n private init(el: HTMLElement): void {\n const data: Array<{ action: string; pv: number; percent: number }> = [\n { action: '\u6d4f\u89c8\u7f51\u7ad9', pv: 50000, percent: 0 },\n { action: '\u653e\u5165\u8d2d\u7269\u8f66', pv: 35000, percent: 0 },\n { action: '\u751f\u6210\u8ba2\u5355', pv: 25000, percent: 0 },\n { action: '\u652f\u4ed8\u8ba2\u5355', pv: 15000, percent: 0 },\n { action: '\u5b8c\u6210\u4ea4\u6613', pv: 8000, percent: 0 },\n ].map(row => {\n row.percent = row.pv / 50000;\n return row;\n });\n const chart: Chart = new (window as any).G2.Chart({\n container: el,\n autoFit: true,\n height: 500,\n width: el.clientWidth,\n padding: [20, 120, 95],\n });\n chart.data(data);\n chart.axis(false);\n chart.tooltip({\n showTitle: false,\n showMarkers: false,\n itemTpl:\n '' +\n '' +\n '{name}
' +\n '\u6d4f\u89c8\u4eba\u6570\uff1a{pv}
' +\n '\u5360\u6bd4\uff1a{percent}
' +\n ' ',\n });\n\n chart.coordinate('rect').transpose().scale(1, -1);\n chart\n .interval()\n .adjust('symmetric')\n .position('action*percent')\n .shape('funnel')\n .color('action', ['#0050B3', '#1890FF', '#40A9FF', '#69C0FF', '#BAE7FF'])\n .label(\n 'action*pv',\n (action, pv) => {\n return {\n content: `${action} ${pv}`,\n };\n },\n {\n offset: 35,\n labelLine: {\n style: {\n lineWidth: 1,\n stroke: 'rgba(0, 0, 0, 0.15)',\n },\n },\n },\n )\n .tooltip('action*pv*percent', (action, pv, percent) => {\n return {\n name: action,\n percent: +percent * 100 + '%',\n pv,\n };\n })\n .animate({\n appear: {\n animation: 'fade-in',\n },\n update: {\n // annotation: 'fade-in'\n },\n });\n\n chart.interaction('element-active');\n\n chart.on('beforepaint', () => {\n chart.annotation().clear(true);\n const chartData = chart.getData();\n // \u4e2d\u95f4\u6807\u7b7e\u6587\u672c\n chartData.forEach(obj => {\n chart.annotation().text({\n top: true,\n position: {\n action: obj.action,\n percent: 'median',\n },\n content: +obj.percent * 100 + '%', // \u663e\u793a\u7684\u6587\u672c\u5185\u5bb9\n style: {\n stroke: null,\n fill: '#fff',\n textAlign: 'center',\n },\n });\n });\n });\n\n chart.render();\n }\n}",name:"basic",urls:"packages/chart/custom/demo/basic.md",type:"demo",lang:"ts",componentName:"ChartCustomBasicComponent",point:0}]}}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["app-chart-custom"]],decls:5,vars:5,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","24"],[3,"item"]],template:function(t,n){1&t&&(e.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),e._UZ(4,"chart-custom-basic"),e.qZA()()()()),2&t&&(e.Q6J("codes",n.codes)("item",n.item),e.xp6(1),e.Q6J("nzGutter",16),e.xp6(2),e.Q6J("item",n.codes[0]),e.uIk("id",n.codes[0].id))},dependencies:[l.t3,l.SK,s.P,m.e,Q],styles:["[_nghost-%COMP%]{display:block}"]}),o})();var Zt=c(62831),Et=c(61198);let $=(()=>{var a;class o{constructor(t,n){this.percent=36,this.color="#2f9cff",t.isBrowser&&(this.time$=setInterval(()=>{this.percent=parseInt((100*Math.random()).toString(),10),this.color=this.percent>50?"#f50":"#2f9cff",n.detectChanges()},1e3))}ngOnDestroy(){clearInterval(this.time$)}}return(a=o).\u0275fac=function(t){return new(t||a)(e.Y36(Zt.t4),e.Y36(e.sBO))},a.\u0275cmp=e.Xpm({type:a,selectors:[["chart-gauge-basic"]],decls:1,vars:3,consts:[["height","164",3,"title","percent","color"]],template:function(t,n){1&t&&e._UZ(0,"g2-gauge",0),2&t&&e.Q6J("title","\u6838\u9500\u7387")("percent",n.percent)("color",n.color)},dependencies:[Et.j],encapsulation:2,changeDetection:0}),o})(),j=(()=>{var a;class o{constructor(){this.item={cols:1,urls:{"zh-CN":"packages/chart/gauge/index.md"},content:{"zh-CN":{content:'\u4e00\u79cd\u8fdb\u5ea6\u5c55\u793a\u65b9\u5f0f\uff0c\u53ef\u4ee5\u66f4\u76f4\u89c2\u7684\u5c55\u793a\u5f53\u524d\u7684\u8fdb\u5c55\u60c5\u51b5\uff0c\u901a\u5e38\u4e5f\u53ef\u8868\u793a\u5360\u6bd4\u3002
',api:'API
g2-gauge
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [repaint]
\u6570\u636e\u518d\u6b21\u53d8\u66f4\u65f6\u662f\u5426\u91cd\u7ed8 boolean
true
[delay]
\u5ef6\u8fdf\u6e32\u67d3\uff0c\u5355\u4f4d\uff1a\u6beb\u79d2 number
0
[title]
\u56fe\u8868\u6807\u9898 string
- [height]
\u56fe\u8868\u9ad8\u5ea6 number
- [color]
\u56fe\u8868\u989c\u8272 string
#2F9CFF
[bgColor]
\u56fe\u8868\u80cc\u666f\u8272 string
#F0F2F5
[percent]
\u8fdb\u5ea6\u6bd4\u4f8b number
- [padding]
\u5185\u8fb9\u8ddd Array<number | string>
[10, 10, 30, 10]
[format]
\u5750\u6807\u8f74\u683c\u5f0f (text: string, item: {}, index: number) => string
- [theme]
\u5b9a\u5236\u56fe\u8868\u4e3b\u9898 string | LooseObject
- (ready)
\u5f53G2\u5b8c\u6210\u521d\u59cb\u5316\u540e\u8c03\u7528 EventEmitter<Chart>
-
',meta:{title:"g2-gauge",subtitle:"\u4eea\u8868\u76d8",cols:1,type:"G2",module:"import { G2GaugeModule } from '@delon/chart/gauge';"},toc:[{id:"API",title:"API",h:2,children:[{id:"g2-gauge",title:"g2-gauge",h:3}]}]}},demo:!0},this.codes=[{id:"chart-gauge-basic",meta:{order:0,title:{"zh-CN":"\u57fa\u7840","en-US":"Basic"}},summary:"\u57fa\u7840\u7528\u6cd5\u3002
",code:"import { Platform } from '@angular/cdk/platform';\nimport { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnDestroy } from '@angular/core';\n\nimport type { NzSafeAny } from 'ng-zorro-antd/core/types';\n\n@Component({\n selector: 'chart-gauge-basic',\n template: ` `,\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class ChartGaugeBasicComponent implements OnDestroy {\n percent = 36;\n color = '#2f9cff';\n private time$: NzSafeAny;\n\n constructor(platform: Platform, cdr: ChangeDetectorRef) {\n if (!platform.isBrowser) return;\n\n this.time$ = setInterval(() => {\n this.percent = parseInt((Math.random() * 100).toString(), 10);\n this.color = this.percent > 50 ? '#f50' : '#2f9cff';\n cdr.detectChanges();\n }, 1000);\n }\n\n ngOnDestroy(): void {\n clearInterval(this.time$);\n }\n}",name:"basic",urls:"packages/chart/gauge/demo/basic.md",type:"demo",lang:"ts",componentName:"ChartGaugeBasicComponent",point:0}]}}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["app-chart-gauge"]],decls:5,vars:5,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","24"],[3,"item"]],template:function(t,n){1&t&&(e.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),e._UZ(4,"chart-gauge-basic"),e.qZA()()()()),2&t&&(e.Q6J("codes",n.codes)("item",n.item),e.xp6(1),e.Q6J("nzGutter",16),e.xp6(2),e.Q6J("item",n.codes[0]),e.uIk("id",n.codes[0].id))},dependencies:[l.t3,l.SK,s.P,m.e,$],styles:["[_nghost-%COMP%]{display:block}"]}),o})();var f=c(89207),D=c(91289);let q=(()=>{var a;class o{constructor(t){this.msg=t,this.visitData=this.genData()}genData(){const t=(new Date).getTime(),n=[];for(let r=0;r<20;r+=1)n.push({x:(0,f.Z)(new Date(t+864e5*r),"yyyy-MM-dd"),y:Math.floor(100*Math.random())+10});return n}refresh(){this.visitData=this.genData()}handleClick(t){this.msg.info(`${t.item.x} - ${t.item.y}`)}}return(a=o).\u0275fac=function(t){return new(t||a)(e.Y36(u.dD))},a.\u0275cmp=e.Xpm({type:a,selectors:[["chart-mini-area-basic"]],decls:3,vars:1,consts:[["nz-button","","nzType","primary",3,"click"],["line","","color","#cceafe","height","45",3,"data","clickItem"]],template:function(t,n){1&t&&(e.TgZ(0,"button",0),e.NdJ("click",function(){return n.refresh()}),e._uU(1,"Refresh"),e.qZA(),e.TgZ(2,"g2-mini-area",1),e.NdJ("clickItem",function(i){return n.handleClick(i)}),e.qZA()),2&t&&(e.xp6(2),e.Q6J("data",n.visitData))},dependencies:[D.D,g.ix,p.w,v.dQ],encapsulation:2}),o})(),L=(()=>{var a;class o{constructor(){this.visitData=[]}ngOnInit(){const t=(new Date).getTime();for(let n=0;n<20;n+=1)this.visitData.push({x:(0,f.Z)(new Date(t+864e5*n),"yyyy-MM-dd"),y:Math.floor(100*Math.random())+10})}}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["chart-mini-area-tooltip"]],decls:1,vars:1,consts:[["line","","color","#cceafe","height","45","yTooltipSuffix","%",3,"data"]],template:function(t,n){1&t&&e._UZ(0,"g2-mini-area",0),2&t&&e.Q6J("data",n.visitData)},dependencies:[D.D],encapsulation:2}),o})(),W=(()=>{var a;class o{constructor(){this.visitData=[]}ngOnInit(){const t=(new Date).getTime();for(let n=0;n<20;n+=1)this.visitData.push({x:(0,f.Z)(new Date(t+864e5*n),"yyyy-MM-dd"),y:Math.floor(100*Math.random())+10})}}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["chart-mini-area-mini"]],decls:1,vars:1,consts:[["line","","color","#cceafe","height","45","tooltipType","mini",3,"data"]],template:function(t,n){1&t&&e._UZ(0,"g2-mini-area",0),2&t&&e.Q6J("data",n.visitData)},dependencies:[D.D],encapsulation:2}),o})(),X=(()=>{var a;class o{constructor(){this.item={cols:2,urls:{"zh-CN":"packages/chart/mini-area/index.md"},content:{"zh-CN":{content:'\u9762\u79ef\u56fe\u53c8\u53eb\u533a\u57df\u56fe\u3002 \u5b83\u662f\u5728\u6298\u7ebf\u56fe\u7684\u57fa\u7840\u4e4b\u4e0a\u5f62\u6210\u7684, \u5b83\u5c06\u6298\u7ebf\u56fe\u4e2d\u6298\u7ebf\u4e0e\u81ea\u53d8\u91cf\u5750\u6807\u8f74\u4e4b\u95f4\u7684\u533a\u57df\u4f7f\u7528\u989c\u8272\u6216\u8005\u7eb9\u7406\u586b\u5145\uff0c\u8fd9\u6837\u4e00\u4e2a\u586b\u5145\u533a\u57df\u6211\u4eec\u53eb\u505a\u9762\u79ef\uff0c\u989c\u8272\u7684\u586b\u5145\u53ef\u4ee5\u66f4\u597d\u7684\u7a81\u51fa\u8d8b\u52bf\u4fe1\u606f\u3002
',api:'API
g2-mini-area
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [repaint]
\u6570\u636e\u518d\u6b21\u53d8\u66f4\u65f6\u662f\u5426\u91cd\u7ed8 boolean
true
[delay]
\u5ef6\u8fdf\u6e32\u67d3\uff0c\u5355\u4f4d\uff1a\u6beb\u79d2 number
0
[color]
\u56fe\u8868\u989c\u8272 string
rgba(24, 144, 255, 0.2)
[borderColor]
\u56fe\u8868\u8fb9\u989c\u8272 string
#1890FF
[height]
\u56fe\u8868\u9ad8\u5ea6 number
56
[line]
\u662f\u5426\u663e\u793a\u63cf\u8fb9 boolean
false
[animate]
\u662f\u5426\u663e\u793a\u52a8\u753b boolean
true
[padding]
\u56fe\u8868\u5185\u90e8\u95f4\u8ddd array
[8, 8, 8, 8]
[xAxis]
x \u8f74\u914d\u7f6e object
- [yAxis]
y \u8f74\u914d\u7f6e object
- [yTooltipSuffix]
y \u8f74Tooltip\u540e\u7f00\uff0c\u4e00\u822c\u6307\u5b9a\u5355\u4f4d string
- [tooltipType]
Tooltip\u663e\u793a\u7c7b\u578b \'mini\',\'default\'
\'default\'
[data]
\u6570\u636e G2MiniAreaData[]
- [theme]
\u5b9a\u5236\u56fe\u8868\u4e3b\u9898 string | LooseObject
- (clickItem)
\u70b9\u51fb\u9879\u56de\u8c03 EventEmitter<G2MiniAreaClickItem>
- (ready)
\u5f53G2\u5b8c\u6210\u521d\u59cb\u5316\u540e\u8c03\u7528 EventEmitter<Chart>
-
G2MiniAreaData
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [x]
x\u8f74 any
- [y]
y\u8f74 any
-
',meta:{title:"g2-mini-area",subtitle:"\u8ff7\u4f60\u533a\u57df\u56fe",cols:2,type:"G2",module:"import { G2MiniAreaModule } from '@delon/chart/mini-area';"},toc:[{id:"API",title:"API",h:2,children:[{id:"g2-mini-area",title:"g2-mini-area",h:3},{id:"G2MiniAreaData",title:"G2MiniAreaData",h:3}]}]}},demo:!0},this.codes=[{id:"chart-mini-area-basic",meta:{order:0,title:{"zh-CN":"\u57fa\u7840","en-US":"Basic"}},summary:"\u57fa\u7840\u7528\u6cd5\u3002
",code:"import { Component } from '@angular/core';\nimport { G2MiniAreaClickItem, G2MiniAreaData } from '@delon/chart/mini-area';\nimport { format } from 'date-fns';\nimport { NzMessageService } from 'ng-zorro-antd/message';\n\n@Component({\n selector: 'chart-mini-area-basic',\n template: `\n \n \n `,\n})\nexport class ChartMiniAreaBasicComponent {\n visitData = this.genData();\n\n constructor(private msg: NzMessageService) {}\n\n private genData(): G2MiniAreaData[] {\n const beginDay = new Date().getTime();\n const res: G2MiniAreaData[] = [];\n for (let i = 0; i < 20; i += 1) {\n res.push({\n x: format(new Date(beginDay + 1000 * 60 * 60 * 24 * i), 'yyyy-MM-dd'),\n y: Math.floor(Math.random() * 100) + 10,\n });\n }\n return res;\n }\n\n refresh(): void {\n this.visitData = this.genData();\n }\n\n handleClick(data: G2MiniAreaClickItem): void {\n this.msg.info(`${data.item.x} - ${data.item.y}`);\n }\n}",name:"basic",urls:"packages/chart/mini-area/demo/basic.md",type:"demo",lang:"ts",componentName:"ChartMiniAreaBasicComponent",point:0},{id:"chart-mini-area-tooltip",meta:{order:1,title:"Tooltip"},summary:"\u6307\u5b9a yTooltipSuffix
\u503c\u6765\u8868\u793a\u5355\u4f4d\u3002
",code:"import { Component, OnInit } from '@angular/core';\nimport { G2MiniAreaData } from '@delon/chart/mini-area';\nimport { format } from 'date-fns';\n\n@Component({\n selector: 'chart-mini-area-tooltip',\n template: ` `,\n})\nexport class ChartMiniAreaTooltipComponent implements OnInit {\n visitData: G2MiniAreaData[] = [];\n ngOnInit(): void {\n const beginDay = new Date().getTime();\n for (let i = 0; i < 20; i += 1) {\n this.visitData.push({\n x: format(new Date(beginDay + 1000 * 60 * 60 * 24 * i), 'yyyy-MM-dd'),\n y: Math.floor(Math.random() * 100) + 10,\n });\n }\n }\n}",name:"tooltip",urls:"packages/chart/mini-area/demo/tooltip.md",type:"demo",lang:"ts",componentName:"ChartMiniAreaTooltipComponent",point:1},{id:"chart-mini-area-mini",meta:{order:2,title:"Mini tooltip"},summary:"\u6307\u5b9a tooltipType
\u503c\u6765\u8868\u793a\u7b80\u5316tooltip\uff0c\u53ef\u4ee5\u66f4\u597d\u7684\u8fd0\u7528\u4e8e\u8868\u683c\u3002
",code:"import { Component, OnInit } from '@angular/core';\nimport { G2MiniAreaData } from '@delon/chart/mini-area';\nimport { format } from 'date-fns';\n\n@Component({\n selector: 'chart-mini-area-mini',\n template: ` `,\n})\nexport class ChartMiniAreaMiniComponent implements OnInit {\n visitData: G2MiniAreaData[] = [];\n ngOnInit(): void {\n const beginDay = new Date().getTime();\n for (let i = 0; i < 20; i += 1) {\n this.visitData.push({\n x: format(new Date(beginDay + 1000 * 60 * 60 * 24 * i), 'yyyy-MM-dd'),\n y: Math.floor(Math.random() * 100) + 10,\n });\n }\n }\n}",name:"mini",urls:"packages/chart/mini-area/demo/mini.md",type:"demo",lang:"ts",componentName:"ChartMiniAreaMiniComponent",point:2}]}}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["app-chart-mini-area"]],decls:10,vars:9,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","12"],[3,"item"]],template:function(t,n){1&t&&(e.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),e._UZ(4,"chart-mini-area-basic"),e.qZA(),e.TgZ(5,"code-box",3),e._UZ(6,"chart-mini-area-mini"),e.qZA()(),e.TgZ(7,"div",2)(8,"code-box",3),e._UZ(9,"chart-mini-area-tooltip"),e.qZA()()()()),2&t&&(e.Q6J("codes",n.codes)("item",n.item),e.xp6(1),e.Q6J("nzGutter",16),e.xp6(2),e.Q6J("item",n.codes[0]),e.uIk("id",n.codes[0].id),e.xp6(2),e.Q6J("item",n.codes[2]),e.uIk("id",n.codes[2].id),e.xp6(3),e.Q6J("item",n.codes[1]),e.uIk("id",n.codes[1].id))},dependencies:[l.t3,l.SK,s.P,m.e,q,L,W],styles:["[_nghost-%COMP%]{display:block}"]}),o})();var z=c(77322);let H=(()=>{var a;class o{constructor(t){this.msg=t,this.visitData=this.genData()}genData(){const t=(new Date).getTime(),n=[];for(let r=0;r<20;r+=1)n.push({x:(0,f.Z)(new Date(t+864e5*r),"yyyy-MM-dd"),y:Math.floor(100*Math.random())+10});return n}refresh(){this.visitData=this.genData()}handleClick(t){this.msg.info(`${t.item.x} - ${t.item.y}`)}}return(a=o).\u0275fac=function(t){return new(t||a)(e.Y36(u.dD))},a.\u0275cmp=e.Xpm({type:a,selectors:[["chart-mini-bar-basic"]],decls:3,vars:1,consts:[["nz-button","","nzType","primary",3,"click"],["height","45",3,"data","clickItem"]],template:function(t,n){1&t&&(e.TgZ(0,"button",0),e.NdJ("click",function(){return n.refresh()}),e._uU(1,"Refresh"),e.qZA(),e.TgZ(2,"g2-mini-bar",1),e.NdJ("clickItem",function(i){return n.handleClick(i)}),e.qZA()),2&t&&(e.xp6(2),e.Q6J("data",n.visitData))},dependencies:[z.N,g.ix,p.w,v.dQ],encapsulation:2}),o})(),Y=(()=>{var a;class o{constructor(){this.visitData=[]}ngOnInit(){const t=(new Date).getTime();for(let n=0;n<20;n+=1)this.visitData.push({x:(0,f.Z)(new Date(t+864e5*n),"yyyy-MM-dd"),y:Math.floor(100*Math.random())+10})}}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["chart-mini-bar-mini"]],decls:1,vars:1,consts:[["height","45","yTooltipSuffix","%","tooltipType","mini",3,"data"]],template:function(t,n){1&t&&e._UZ(0,"g2-mini-bar",0),2&t&&e.Q6J("data",n.visitData)},dependencies:[z.N],encapsulation:2}),o})(),V=(()=>{var a;class o{constructor(){this.visitData=[]}ngOnInit(){const t=(new Date).getTime();for(let n=0;n<20;n+=1)this.visitData.push({x:(0,f.Z)(new Date(t+864e5*n),"yyyy-MM-dd"),y:Math.floor(100*Math.random())+10})}}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["chart-mini-bar-tooltip"]],decls:1,vars:1,consts:[["height","45","yTooltipSuffix","%",3,"data"]],template:function(t,n){1&t&&e._UZ(0,"g2-mini-bar",0),2&t&&e.Q6J("data",n.visitData)},dependencies:[z.N],encapsulation:2}),o})(),K=(()=>{var a;class o{constructor(){this.item={cols:2,urls:{"zh-CN":"packages/chart/mini-bar/index.md"},content:{"zh-CN":{content:'\u8ff7\u4f60\u67f1\u72b6\u56fe\u66f4\u9002\u5408\u5c55\u793a\u7b80\u5355\u7684\u533a\u95f4\u6570\u636e\uff0c\u7b80\u6d01\u7684\u8868\u73b0\u65b9\u5f0f\u53ef\u4ee5\u5f88\u597d\u7684\u51cf\u5c11\u5927\u6570\u636e\u91cf\u7684\u89c6\u89c9\u5c55\u73b0\u538b\u529b\u3002
',api:'API
g2-mini-bar
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [repaint]
\u6570\u636e\u518d\u6b21\u53d8\u66f4\u65f6\u662f\u5426\u91cd\u7ed8 boolean
true
[delay]
\u5ef6\u8fdf\u6e32\u67d3\uff0c\u5355\u4f4d\uff1a\u6beb\u79d2 number
0
[color]
\u56fe\u8868\u989c\u8272 string
#1890FF
[height]
\u56fe\u8868\u9ad8\u5ea6 number
- [yTooltipSuffix]
y \u8f74Tooltip\u540e\u7f00\uff0c\u4e00\u822c\u6307\u5b9a\u5355\u4f4d string
- [tooltipType]
Tooltip\u663e\u793a\u7c7b\u578b \'mini\',\'default\'
\'default\'
[borderWidth]
\u7ebf\u6761\u7c97\u7ec6 number
5
[padding]
\u56fe\u8868\u5185\u90e8\u95f4\u8ddd array
[8, 8, 8, 8]
[data]
\u6570\u636e G2MiniBarData[]
- [theme]
\u5b9a\u5236\u56fe\u8868\u4e3b\u9898 string | LooseObject
- (clickItem)
\u70b9\u51fb\u9879\u56de\u8c03 EventEmitter<G2MiniBarClickItem>
- (ready)
\u5f53G2\u5b8c\u6210\u521d\u59cb\u5316\u540e\u8c03\u7528 EventEmitter<Chart>
-
G2MiniBarData
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [x]
x\u8f74 any
- [y]
y\u8f74 any
- [color]
\u8f74\u989c\u8272 string
-
',meta:{title:"g2-mini-bar",subtitle:"\u8ff7\u4f60\u67f1\u72b6\u56fe",cols:2,type:"G2",module:"import { G2MiniBarModule } from '@delon/chart/mini-bar';"},toc:[{id:"API",title:"API",h:2,children:[{id:"g2-mini-bar",title:"g2-mini-bar",h:3},{id:"G2MiniBarData",title:"G2MiniBarData",h:3}]}]}},demo:!0},this.codes=[{id:"chart-mini-bar-basic",meta:{order:0,title:{"zh-CN":"\u57fa\u7840","en-US":"Basic"}},summary:"\u57fa\u7840\u7528\u6cd5\u3002
",code:"import { Component } from '@angular/core';\nimport { G2MiniAreaClickItem, G2MiniAreaData } from '@delon/chart/mini-area';\nimport { format } from 'date-fns';\nimport { NzMessageService } from 'ng-zorro-antd/message';\n\n@Component({\n selector: 'chart-mini-bar-basic',\n template: `\n \n \n `,\n})\nexport class ChartMiniBarBasicComponent {\n visitData = this.genData();\n\n constructor(private msg: NzMessageService) {}\n\n private genData(): G2MiniAreaData[] {\n const beginDay = new Date().getTime();\n const res: G2MiniAreaData[] = [];\n for (let i = 0; i < 20; i += 1) {\n res.push({\n x: format(new Date(beginDay + 1000 * 60 * 60 * 24 * i), 'yyyy-MM-dd'),\n y: Math.floor(Math.random() * 100) + 10,\n });\n }\n return res;\n }\n\n refresh(): void {\n this.visitData = this.genData();\n }\n\n handleClick(data: G2MiniAreaClickItem): void {\n this.msg.info(`${data.item.x} - ${data.item.y}`);\n }\n}",name:"basic",urls:"packages/chart/mini-bar/demo/basic.md",type:"demo",lang:"ts",componentName:"ChartMiniBarBasicComponent",point:0},{id:"chart-mini-bar-mini",meta:{order:0,title:"Mini tooltip"},summary:"\u6307\u5b9a tooltipType
\u503c\u6765\u8868\u793a\u7b80\u5316tooltip\uff0c\u53ef\u4ee5\u66f4\u597d\u7684\u8fd0\u7528\u4e8e\u8868\u683c\u3002
",code:"import { Component, OnInit } from '@angular/core';\nimport { G2MiniBarData } from '@delon/chart/mini-bar';\nimport { format } from 'date-fns';\n\n@Component({\n selector: 'chart-mini-bar-mini',\n template: ` `,\n})\nexport class ChartMiniBarMiniComponent implements OnInit {\n visitData: G2MiniBarData[] = [];\n ngOnInit(): void {\n const beginDay = new Date().getTime();\n for (let i = 0; i < 20; i += 1) {\n this.visitData.push({\n x: format(new Date(beginDay + 1000 * 60 * 60 * 24 * i), 'yyyy-MM-dd'),\n y: Math.floor(Math.random() * 100) + 10,\n });\n }\n }\n}",name:"mini",urls:"packages/chart/mini-bar/demo/mini.md",type:"demo",lang:"ts",componentName:"ChartMiniBarMiniComponent",point:1},{id:"chart-mini-bar-tooltip",meta:{order:0,title:"Tooltip"},summary:"\u6307\u5b9a yTooltipSuffix
\u503c\u6765\u8868\u793a\u5355\u4f4d\u3002
",code:"import { Component, OnInit } from '@angular/core';\nimport { G2MiniBarData } from '@delon/chart/mini-bar';\nimport { format } from 'date-fns';\n\n@Component({\n selector: 'chart-mini-bar-tooltip',\n template: ` `,\n})\nexport class ChartMiniBarTooltipComponent implements OnInit {\n visitData: G2MiniBarData[] = [];\n ngOnInit(): void {\n const beginDay = new Date().getTime();\n for (let i = 0; i < 20; i += 1) {\n this.visitData.push({\n x: format(new Date(beginDay + 1000 * 60 * 60 * 24 * i), 'yyyy-MM-dd'),\n y: Math.floor(Math.random() * 100) + 10,\n });\n }\n }\n}",name:"tooltip",urls:"packages/chart/mini-bar/demo/tooltip.md",type:"demo",lang:"ts",componentName:"ChartMiniBarTooltipComponent",point:2}]}}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["app-chart-mini-bar"]],decls:10,vars:9,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","12"],[3,"item"]],template:function(t,n){1&t&&(e.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),e._UZ(4,"chart-mini-bar-basic"),e.qZA(),e.TgZ(5,"code-box",3),e._UZ(6,"chart-mini-bar-tooltip"),e.qZA()(),e.TgZ(7,"div",2)(8,"code-box",3),e._UZ(9,"chart-mini-bar-mini"),e.qZA()()()()),2&t&&(e.Q6J("codes",n.codes)("item",n.item),e.xp6(1),e.Q6J("nzGutter",16),e.xp6(2),e.Q6J("item",n.codes[0]),e.uIk("id",n.codes[0].id),e.xp6(2),e.Q6J("item",n.codes[2]),e.uIk("id",n.codes[2].id),e.xp6(3),e.Q6J("item",n.codes[1]),e.uIk("id",n.codes[1].id))},dependencies:[l.t3,l.SK,s.P,m.e,H,Y,V],styles:["[_nghost-%COMP%]{display:block}"]}),o})();var Ft=c(9730);let tt=(()=>{var a;class o{}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["chart-mini-progress-basic"]],decls:1,vars:0,consts:[["percent","78","strokeWidth","8","target","80"]],template:function(t,n){1&t&&e._UZ(0,"g2-mini-progress",0)},dependencies:[Ft.c],encapsulation:2}),o})(),et=(()=>{var a;class o{constructor(){this.item={cols:1,urls:{"zh-CN":"packages/chart/mini-progress/index.md"},content:{"zh-CN":{content:'\u7528\u4e8e\u663e\u793a\u8ddf\u901f\u5ea6\u76f8\u5173\u56fe\u5f62\u518d\u9002\u5408\u4e0d\u8fc7\u3002
',api:'API
g2-mini-progress
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [target]
\u76ee\u6807\u6bd4\u4f8b number
- [color]
\u8fdb\u5ea6\u6761\u989c\u8272 string
- [strokeWidth]
\u8fdb\u5ea6\u6761\u9ad8\u5ea6 number
- [percent]
\u8fdb\u5ea6\u6bd4\u4f8b number
-
',meta:{title:"g2-mini-progress",subtitle:"\u8ff7\u4f60\u8fdb\u5ea6\u6761",cols:1,type:"G2",module:"import { G2MiniProgressModule } from '@delon/chart/mini-progress';"},toc:[{id:"API",title:"API",h:2,children:[{id:"g2-mini-progress",title:"g2-mini-progress",h:3}]}]}},demo:!0},this.codes=[{id:"chart-mini-progress-basic",meta:{order:0,title:{"zh-CN":"\u57fa\u7840","en-US":"Basic"}},summary:"\u57fa\u7840\u7528\u6cd5\u3002
",code:'import { Component } from \'@angular/core\';\n\n@Component({\n selector: \'chart-mini-progress-basic\',\n template: ` `,\n})\nexport class ChartMiniProgressBasicComponent {}',name:"basic",urls:"packages/chart/mini-progress/demo/basic.md",type:"demo",lang:"ts",componentName:"ChartMiniProgressBasicComponent",point:0}]}}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["app-chart-mini-progress"]],decls:5,vars:5,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","24"],[3,"item"]],template:function(t,n){1&t&&(e.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),e._UZ(4,"chart-mini-progress-basic"),e.qZA()()()()),2&t&&(e.Q6J("codes",n.codes)("item",n.item),e.xp6(1),e.Q6J("nzGutter",16),e.xp6(2),e.Q6J("item",n.codes[0]),e.uIk("id",n.codes[0].id))},dependencies:[l.t3,l.SK,s.P,m.e,tt],styles:["[_nghost-%COMP%]{display:block}"]}),o})();var A=c(84420);let at=(()=>{var a;class o{}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["chart-number-info-basic"]],decls:1,vars:0,consts:[["subTitle","\u672c\u5468\u8bbf\u95ee","total","12,321","subTotal","17.1","status","up"]],template:function(t,n){1&t&&e._UZ(0,"number-info",0)},dependencies:[A.i],encapsulation:2}),o})(),nt=(()=>{var a;class o{}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["chart-number-info-theme"]],decls:1,vars:0,consts:[["subTitle","\u672c\u5468\u8bbf\u95ee","total","12,321","subTotal","17.1","status","down","theme","default"]],template:function(t,n){1&t&&e._UZ(0,"number-info",0)},dependencies:[A.i],encapsulation:2}),o})(),ot=(()=>{var a;class o{}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["chart-number-info-multiple"]],decls:3,vars:0,consts:[["subTitle","\u4eca\u65e5\u8bbf\u95ee","total","12,321"],["subTitle","\u672c\u5468\u8bbf\u95ee","total","12,32100"],["subTitle","\u672c\u6708\u8bbf\u95ee","total","12,32100000"]],template:function(t,n){1&t&&e._UZ(0,"number-info",0)(1,"number-info",1)(2,"number-info",2)},dependencies:[A.i],encapsulation:2}),o})(),dt=(()=>{var a;class o{constructor(){this.item={cols:2,urls:{"en-US":"packages/chart/number-info/index.en-US.md","zh-CN":"packages/chart/number-info/index.zh-CN.md"},content:{"en-US":{content:'Often used in data cards for highlighting the business data.
',api:'API
number-info
Property Description Type Default [title]
title TemplateRef<void>
- [subTitle]
subtitle TemplateRef<void>
- [total]
total amount string, number
- [suffix]
total amount suffix string
- [subTotal]
total amount of additional information string, number
- [status]
increase state \'up\',\'down\'
- [theme]
state style \'light\',\'default\'
\'light\'
[gap]
set the spacing (pixels) between numbers and descriptions number
8
',meta:{type:"G2",title:"number-info",subtitle:"NumberInfo",cols:2,module:"import { NumberInfoModule } from '@delon/chart/number-info';"},toc:[{id:"API",title:"API",h:2,children:[{id:"number-info",title:"number-info",h:3}]}]},"zh-CN":{content:'\u5e38\u7528\u5728\u6570\u636e\u5361\u7247\u4e2d\uff0c\u7528\u4e8e\u7a81\u51fa\u5c55\u793a\u67d0\u4e2a\u4e1a\u52a1\u6570\u636e\u3002
',api:'API
number-info
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [title]
\u6807\u9898 TemplateRef<void>
- [subTitle]
\u5b50\u6807\u9898 TemplateRef<void>
- [total]
\u603b\u91cf string, number
- [suffix]
\u603b\u91cf\u540e\u7f00 string
- [subTotal]
\u5b50\u603b\u91cf string, number
- [status]
\u589e\u52a0\u72b6\u6001 \'up\',\'down\'
- [theme]
\u72b6\u6001\u6837\u5f0f \'light\',\'default\'
\'light\'
[gap]
\u8bbe\u7f6e\u6570\u5b57\u548c\u63cf\u8ff0\u76f4\u63a5\u7684\u95f4\u8ddd\uff08\u50cf\u7d20\uff09 number
8
',meta:{type:"G2",title:"number-info",subtitle:"\u6570\u636e\u6587\u672c",cols:2,module:"import { NumberInfoModule } from '@delon/chart/number-info';"},toc:[{id:"API",title:"API",h:2,children:[{id:"number-info",title:"number-info",h:3}]}]}},demo:!0},this.codes=[{id:"chart-number-info-basic",meta:{order:0,title:{"zh-CN":"\u57fa\u672c","en-US":"Basic"}},summary:"\u5404\u79cd\u6570\u636e\u6587\u6848\u7684\u5c55\u73b0\u65b9\u5f0f\u3002
",code:'import { Component } from \'@angular/core\';\n\n@Component({\n selector: \'chart-number-info-basic\',\n template: ` `,\n})\nexport class ChartNumberInfoBasicComponent {}',name:"basic",urls:"packages/chart/number-info/demo/basic.md",type:"demo",lang:"ts",componentName:"ChartNumberInfoBasicComponent",point:0},{id:"chart-number-info-theme",meta:{order:1,title:"\u4e3b\u9898"},summary:"\u6697\u7cfb\u3002
",code:'import { Component } from \'@angular/core\';\n\n@Component({\n selector: \'chart-number-info-theme\',\n template: ` `,\n})\nexport class ChartNumberInfoThemeComponent {}',name:"theme",urls:"packages/chart/number-info/demo/theme.md",type:"demo",lang:"ts",componentName:"ChartNumberInfoThemeComponent",point:1},{id:"chart-number-info-multiple",meta:{order:2,title:{"zh-CN":"\u591a\u5217","en-US":"Multiple"}},summary:{"zh-CN":"\u591a\u4e2anumber-info
\u7ec4\u4ef6\u5728\u4e00\u8d77\u65f6\u589e\u52a0\u5206\u9694\u7b26\u3002
","en-US":"Should be show a separator when multiple number-info
components.
"},code:'import { Component } from \'@angular/core\';\n\n@Component({\n selector: \'chart-number-info-multiple\',\n template: `\n \n \n \n `,\n})\nexport class ChartNumberInfoMultipleComponent {}',name:"multiple",urls:"packages/chart/number-info/demo/multiple.md",type:"demo",lang:"ts",componentName:"ChartNumberInfoMultipleComponent",point:2}]}}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["app-chart-number-info"]],decls:10,vars:9,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","12"],[3,"item"]],template:function(t,n){1&t&&(e.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),e._UZ(4,"chart-number-info-basic"),e.qZA(),e.TgZ(5,"code-box",3),e._UZ(6,"chart-number-info-multiple"),e.qZA()(),e.TgZ(7,"div",2)(8,"code-box",3),e._UZ(9,"chart-number-info-theme"),e.qZA()()()()),2&t&&(e.Q6J("codes",n.codes)("item",n.item),e.xp6(1),e.Q6J("nzGutter",16),e.xp6(2),e.Q6J("item",n.codes[0]),e.uIk("id",n.codes[0].id),e.xp6(2),e.Q6J("item",n.codes[2]),e.uIk("id",n.codes[2].id),e.xp6(3),e.Q6J("item",n.codes[1]),e.uIk("id",n.codes[1].id))},dependencies:[l.t3,l.SK,s.P,m.e,at,nt,ot],styles:["[_nghost-%COMP%]{display:block}"]}),o})();var rt=c(22595);const Ut=["pie"];let it=(()=>{var a;class o{constructor(t){this.msg=t,this.salesPieData=[],this.total="",this.refresh()}refresh(){const t=(n=0,r=5e3)=>Math.floor(Math.random()*(r-n+1)+n);this.salesPieData=[{x:"\u5bb6\u7528\u7535\u5668",y:t()},{x:"\u98df\u7528\u9152\u6c34",y:t()},{x:"\u4e2a\u62a4\u5065\u5eb7",y:t()},{x:"\u670d\u9970\u7bb1\u5305",y:t()},{x:"\u6bcd\u5a74\u4ea7\u54c1",y:t()}],Math.random()>.5&&this.salesPieData.push({x:"\u5176\u4ed6",y:t()}),this.total=`¥ ${this.salesPieData.reduce((n,r)=>r.y+n,0).toFixed(2)}`,this.pie&&setTimeout(()=>this.pie.changeData())}format(t){return`¥ ${t.toFixed(2)}`}handleClick(t){this.msg.info(`${t.item.x} - ${t.item.y}`)}}return(a=o).\u0275fac=function(t){return new(t||a)(e.Y36(u.dD))},a.\u0275cmp=e.Xpm({type:a,selectors:[["chart-pie-basic"]],viewQuery:function(t,n){if(1&t&&e.Gf(Ut,5),2&t){let r;e.iGM(r=e.CRH())&&(n.pie=r.first)}},decls:4,vars:4,consts:[["nz-button","","nzType","primary",3,"click"],["title","\u9500\u552e\u989d","subTitle","\u9500\u552e\u989d","height","294","repaint","false",3,"hasLegend","total","valueFormat","data","clickItem"],["pie",""]],template:function(t,n){1&t&&(e.TgZ(0,"button",0),e.NdJ("click",function(){return n.refresh()}),e._uU(1,"Refresh"),e.qZA(),e.TgZ(2,"g2-pie",1,2),e.NdJ("clickItem",function(i){return n.handleClick(i)}),e.qZA()),2&t&&(e.xp6(2),e.Q6J("hasLegend",!0)("total",n.total)("valueFormat",n.format)("data",n.salesPieData))},dependencies:[rt.J,g.ix,p.w,v.dQ],encapsulation:2}),o})(),ct=(()=>{var a;class o{}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["chart-pie-mini"]],decls:2,vars:0,consts:[[2,"width","200px","display","inline-block"],["percent","28","subTitle","\u4e2d\u5f0f\u5feb\u9910","total","28%","height","130"]],template:function(t,n){1&t&&(e.TgZ(0,"div",0),e._UZ(1,"g2-pie",1),e.qZA())},dependencies:[rt.J],encapsulation:2}),o})(),lt=(()=>{var a;class o{constructor(){this.item={cols:1,urls:{"zh-CN":"packages/chart/pie/index.md"},content:{"zh-CN":{content:'\u7528\u4e8e\u663e\u793a\u8ddf\u901f\u5ea6\u76f8\u5173\u56fe\u5f62\u518d\u9002\u5408\u4e0d\u8fc7\u3002
',api:'API
g2-pie
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [repaint]
\u6570\u636e\u518d\u6b21\u53d8\u66f4\u65f6\u662f\u5426\u91cd\u7ed8 boolean
true
[delay]
\u5ef6\u8fdf\u6e32\u67d3\uff0c\u5355\u4f4d\uff1a\u6beb\u79d2 number
0
[animate]
\u662f\u5426\u663e\u793a\u52a8\u753b boolean
true
[color]
\u56fe\u8868\u989c\u8272 string
rgba(24, 144, 255, 0.85)
[height]
\u56fe\u8868\u9ad8\u5ea6 number
- [hasLegend]
\u662f\u5426\u663e\u793a legend boolean
false
[padding]
\u56fe\u8868\u5185\u90e8\u95f4\u8ddd number[]
[12, 0, 12, 0]
[percent]
\u5360\u6bd4 number
- [lineWidth]
\u8fb9\u6846\u7c97\u7ec6 number
0
[inner]
\u5185\u90e8\u6781\u5750\u6807\u7cfb\u7684\u534a\u5f84 number
0.75
[blockMaxWidth]
\u591a\u5c11\u5bbd\u5ea6\u4e3a\u5757\u663e\u793a number
380
[tooltip]
\u662f\u5426\u663e\u793a tooltip boolean
true
[subTitle]
\u56fe\u8868\u5b50\u6807\u9898 string,TemplateRef<void>
- [total]
\u603b\u91cf string,number,TemplateRef<void>
- [valueFormat]
y\u8f74\u683c\u5f0f\u5316 (y: number) => string
- [data]
\u6570\u636e G2PieData[]
- [colors]
\u989c\u8272\u5217\u8868 string[]
- [interaction]
\u4ea4\u4e92\u7c7b\u578b\uff0cnone \u65e0 element-active \u56fe\u5f62\u5143\u7d20\uff0cactive-region \u56fe\u8868\u7ec4\u4ef6\uff0cbrush \u6846\u9009\uff0cdrag-move \u79fb\u52a8 InteractionType
none
[ratio]
\u767e\u5206\u6bd4\u914d\u7f6e\u9879 G2PieRatio
{ text: \'\u5360\u6bd4\', inverse: \'\u53cd\u6bd4\', color: \'\', inverseColor: \'#F0F2F5\' }
[theme]
\u5b9a\u5236\u56fe\u8868\u4e3b\u9898 string | LooseObject
- (clickItem)
\u70b9\u51fb\u9879\u56de\u8c03 EventEmitter<G2PieClickItem>
- (ready)
\u5f53G2\u5b8c\u6210\u521d\u59cb\u5316\u540e\u8c03\u7528 EventEmitter<Chart>
-
G2PieData
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [x]
x\u8f74 any
- [y]
y\u8f74 number
-
',meta:{title:"g2-pie",subtitle:"\u997c\u72b6\u56fe",cols:1,type:"G2",module:"import { G2PieModule } from '@delon/chart/pie';"},toc:[{id:"API",title:"API",h:2,children:[{id:"g2-pie",title:"g2-pie",h:3},{id:"G2PieData",title:"G2PieData",h:3}]}]}},demo:!0},this.codes=[{id:"chart-pie-basic",meta:{order:0,title:{"zh-CN":"\u57fa\u7840","en-US":"Basic"}},summary:"\u57fa\u7840\u7528\u6cd5\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4e1d\u6ed1\u66f4\u65b0\u6570\u636e\u7684\u5224\u65ad\u6807\u51c6\u662f\u4ee5\u53ea\u66f4\u65b0 data
\u4e3a\u51c6\uff0c\u8fd9\u91cc\u5229\u7528 repaint
\u8fdb\u884c\u624b\u52a8\u8c03\u7528 changeData
\u6539\u53d8\u6570\u636e\u8fbe\u5230\u4e1d\u6ed1\u66f4\u65b0\u7684\u6548\u679c\u3002
",code:"import { Component, ViewChild } from '@angular/core';\nimport { G2PieClickItem, G2PieComponent, G2PieData } from '@delon/chart/pie';\nimport { NzMessageService } from 'ng-zorro-antd/message';\n\n@Component({\n selector: 'chart-pie-basic',\n template: `\n \n \n `,\n})\nexport class ChartPieBasicComponent {\n @ViewChild('pie', { static: false }) readonly pie!: G2PieComponent;\n salesPieData: G2PieData[] = [];\n total = '';\n\n constructor(private msg: NzMessageService) {\n this.refresh();\n }\n\n refresh(): void {\n const rv = (min: number = 0, max: number = 5000) => Math.floor(Math.random() * (max - min + 1) + min);\n this.salesPieData = [\n {\n x: '\u5bb6\u7528\u7535\u5668',\n y: rv(),\n },\n {\n x: '\u98df\u7528\u9152\u6c34',\n y: rv(),\n },\n {\n x: '\u4e2a\u62a4\u5065\u5eb7',\n y: rv(),\n },\n {\n x: '\u670d\u9970\u7bb1\u5305',\n y: rv(),\n },\n {\n x: '\u6bcd\u5a74\u4ea7\u54c1',\n y: rv(),\n },\n ];\n if (Math.random() > 0.5) {\n this.salesPieData.push({\n x: '\u5176\u4ed6',\n y: rv(),\n });\n }\n this.total = `¥ ${this.salesPieData.reduce((pre, now) => now.y + pre, 0).toFixed(2)}`;\n if (this.pie) {\n // \u7b49\u5f85\u7ec4\u4ef6\u6e32\u67d3\n setTimeout(() => this.pie.changeData());\n }\n }\n\n format(val: number): string {\n return `¥ ${val.toFixed(2)}`;\n }\n\n handleClick(data: G2PieClickItem): void {\n this.msg.info(`${data.item.x} - ${data.item.y}`);\n }\n}",name:"basic",urls:"packages/chart/pie/demo/basic.md",type:"demo",lang:"ts",componentName:"ChartPieBasicComponent",point:0},{id:"chart-pie-mini",meta:{order:0,title:{"zh-CN":"\u8ff7\u4f60\u578b","en-US":"Mini"}},summary:"\u901a\u8fc7\u7b80\u5316 pie
\u5c5e\u6027\u7684\u8bbe\u7f6e\uff0c\u53ef\u4ee5\u5feb\u901f\u7684\u5b9e\u73b0\u6781\u7b80\u7684\u997c\u72b6\u56fe\uff0c\u53ef\u914d\u5408 chart-card
\u7ec4\u5408\u5c55\u73b0\u66f4\u591a\u4e1a\u52a1\u573a\u666f\u3002
",code:'import { Component } from \'@angular/core\';\n\n@Component({\n selector: \'chart-pie-mini\',\n template: `\n \n \n \n `,\n})\nexport class ChartPieMiniComponent {}',name:"mini",urls:"packages/chart/pie/demo/mini.md",type:"demo",lang:"ts",componentName:"ChartPieMiniComponent",point:1}]}}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["app-chart-pie"]],decls:7,vars:7,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","24"],[3,"item"]],template:function(t,n){1&t&&(e.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),e._UZ(4,"chart-pie-basic"),e.qZA(),e.TgZ(5,"code-box",3),e._UZ(6,"chart-pie-mini"),e.qZA()()()()),2&t&&(e.Q6J("codes",n.codes)("item",n.item),e.xp6(1),e.Q6J("nzGutter",16),e.xp6(2),e.Q6J("item",n.codes[0]),e.uIk("id",n.codes[0].id),e.xp6(2),e.Q6J("item",n.codes[1]),e.uIk("id",n.codes[1].id))},dependencies:[l.t3,l.SK,s.P,m.e,it,ct],styles:["[_nghost-%COMP%]{display:block}"]}),o})();var Jt=c(91183);let st=(()=>{var a;class o{constructor(t){this.msg=t,this.radarData=[],this.refresh()}refresh(){const t=(h=1,C=10)=>Math.floor(Math.random()*(C-h+1)+h),n=["\u4e2a\u4eba","\u56e2\u961f","\u90e8\u95e8"].map(h=>({name:h,ref:t(),koubei:t(),output:t(),contribute:t(),hot:t()})),r={ref:"\u5f15\u7528",koubei:"\u53e3\u7891",output:"\u4ea7\u91cf",contribute:"\u8d21\u732e",hot:"\u70ed\u5ea6"};Math.random()>.5&&delete r.hot;const i=[];n.forEach(h=>{Object.keys(h).forEach(C=>{"name"!==C&&i.push({name:h.name,label:r[C],value:h[C]})})}),this.radarData=i}handleClick(t){this.msg.info(`${t.item.label} - ${t.item.name} - ${t.item.value}`)}}return(a=o).\u0275fac=function(t){return new(t||a)(e.Y36(u.dD))},a.\u0275cmp=e.Xpm({type:a,selectors:[["chart-radar-basic"]],decls:3,vars:2,consts:[["nz-button","","nzType","primary",3,"click"],["height","286",3,"hasLegend","data","clickItem"]],template:function(t,n){1&t&&(e.TgZ(0,"button",0),e.NdJ("click",function(){return n.refresh()}),e._uU(1,"Refresh"),e.qZA(),e.TgZ(2,"g2-radar",1),e.NdJ("clickItem",function(i){return n.handleClick(i)}),e.qZA()),2&t&&(e.xp6(2),e.Q6J("hasLegend",!0)("data",n.radarData))},dependencies:[Jt.R,g.ix,p.w,v.dQ],encapsulation:2}),o})(),mt=(()=>{var a;class o{constructor(){this.item={cols:1,urls:{"zh-CN":"packages/chart/radar/index.md"},content:{"zh-CN":{content:'\u96f7\u8fbe\u56fe\u662f\u4ee5\u76f8\u540c\u70b9\u5f00\u59cb\u7684\u8f74\u4e0a\u8868\u793a\u7684\u4e09\u4e2a\u6216\u66f4\u591a\u4e2a\u5b9a\u91cf\u53d8\u91cf\u7684\u4e8c\u7ef4\u56fe\u5f62\u7684\u5f62\u5f0f\u663e\u793a\u591a\u53d8\u91cf\u6570\u636e\u7684\u56fe\u5f62\u65b9\u6cd5\u3002\u8f74\u7684\u76f8\u5bf9\u4f4d\u7f6e\u548c\u89d2\u5ea6\u901a\u5e38\u662f\u4e0d\u77e5\u60c5\u7684\u3002
',api:'API
g2-radar
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [repaint]
\u6570\u636e\u518d\u6b21\u53d8\u66f4\u65f6\u662f\u5426\u91cd\u7ed8 boolean
true
[delay]
\u5ef6\u8fdf\u6e32\u67d3\uff0c\u5355\u4f4d\uff1a\u6beb\u79d2 number
0
[title]
\u56fe\u8868\u6807\u9898 string,TemplateRef<void>
- [height]
\u56fe\u8868\u9ad8\u5ea6 number
- [hasLegend]
\u662f\u5426\u663e\u793a legend boolean
false
[padding]
\u56fe\u8868\u5185\u90e8\u95f4\u8ddd array
[24, 30, 16, 30]
[colors]
\u989c\u8272\u5217\u8868 string[]
- [data]
\u6570\u636e G2RadarData[]
- [theme]
\u5b9a\u5236\u56fe\u8868\u4e3b\u9898 string | LooseObject
- (clickItem)
\u70b9\u51fb\u9879\u56de\u8c03 EventEmitter<G2RadarClickItem>
- (ready)
\u5f53G2\u5b8c\u6210\u521d\u59cb\u5316\u540e\u8c03\u7528 EventEmitter<Chart>
-
G2RadarData
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [name]
\u540d\u79f0 string
- [label]
\u6807\u7b7e string
- [value]
\u503c number
-
',meta:{title:"g2-radar",subtitle:"\u96f7\u8fbe\u56fe",cols:1,type:"G2",module:"import { G2RadarModule } from '@delon/chart/radar';"},toc:[{id:"API",title:"API",h:2,children:[{id:"g2-radar",title:"g2-radar",h:3},{id:"G2RadarData",title:"G2RadarData",h:3}]}]}},demo:!0},this.codes=[{id:"chart-radar-basic",meta:{order:0,title:{"zh-CN":"\u57fa\u7840","en-US":"Basic"}},summary:"\u57fa\u7840\u7528\u6cd5\u3002
",code:"import { Component } from '@angular/core';\nimport { G2RadarClickItem, G2RadarData } from '@delon/chart/radar';\nimport { NzMessageService } from 'ng-zorro-antd/message';\n\n@Component({\n selector: 'chart-radar-basic',\n template: `\n \n \n `,\n})\nexport class ChartRadarBasicComponent {\n radarData: G2RadarData[] = [];\n\n constructor(private msg: NzMessageService) {\n this.refresh();\n }\n\n refresh(): void {\n const rv = (min: number = 1, max: number = 10) => Math.floor(Math.random() * (max - min + 1) + min);\n const radarOriginData = ['\u4e2a\u4eba', '\u56e2\u961f', '\u90e8\u95e8'].map(name => ({\n name,\n ref: rv(),\n koubei: rv(),\n output: rv(),\n contribute: rv(),\n hot: rv(),\n }));\n const radarTitleMap: { [key: string]: string } = {\n ref: '\u5f15\u7528',\n koubei: '\u53e3\u7891',\n output: '\u4ea7\u91cf',\n contribute: '\u8d21\u732e',\n hot: '\u70ed\u5ea6',\n };\n if (Math.random() > 0.5) {\n delete radarTitleMap.hot;\n }\n const res: G2RadarData[] = [];\n radarOriginData.forEach((item: { [key: string]: any }) => {\n Object.keys(item).forEach(key => {\n if (key !== 'name') {\n res.push({\n name: item.name,\n label: radarTitleMap[key],\n value: item[key],\n });\n }\n });\n });\n this.radarData = res;\n }\n\n handleClick(data: G2RadarClickItem): void {\n this.msg.info(`${data.item.label} - ${data.item.name} - ${data.item.value}`);\n }\n}",name:"basic",urls:"packages/chart/radar/demo/basic.md",type:"demo",lang:"ts",componentName:"ChartRadarBasicComponent",point:0}]}}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["app-chart-radar"]],decls:5,vars:5,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","24"],[3,"item"]],template:function(t,n){1&t&&(e.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),e._UZ(4,"chart-radar-basic"),e.qZA()()()()),2&t&&(e.Q6J("codes",n.codes)("item",n.item),e.xp6(1),e.Q6J("nzGutter",16),e.xp6(2),e.Q6J("item",n.codes[0]),e.uIk("id",n.codes[0].id))},dependencies:[l.t3,l.SK,s.P,m.e,st],styles:["[_nghost-%COMP%]{display:block}"]}),o})();var Ot=c(96814),Qt=c(47381),b=c(79663);function Rt(a,o){if(1&a&&(e.TgZ(0,"tr")(1,"td"),e._uU(2),e.qZA(),e.TgZ(3,"td"),e._UZ(4,"g2-single-bar",4),e.qZA(),e.TgZ(5,"td"),e._UZ(6,"g2-single-bar",5),e.qZA()()),2&a){const d=o.$implicit,t=o.index;e.xp6(2),e.Oqu(t+1),e.xp6(2),e.Q6J("value",d.value),e.xp6(2),e.Q6J("value",d.other)}}let ht=(()=>{var a;class o{constructor(){this.list=new Array(5).fill({}).map(()=>({id:Math.floor(1e4*Math.random()),value:Math.floor(100*Math.random()),other:Math.floor(100*Math.random())>50?Math.floor(100*Math.random()):-Math.floor(100*Math.random())}))}refresh(){this.list.forEach(t=>{t.value=Math.floor(100*Math.random()),t.other=Math.floor(100*Math.random())>50?Math.floor(100*Math.random()):-Math.floor(100*Math.random())})}}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["chart-single-bar-basic"]],decls:13,vars:3,consts:[["nz-button","","nzType","primary",3,"click"],[3,"nzData","nzShowPagination"],["nzWidth","350px"],[4,"ngFor","ngForOf"],["height","24",3,"value"],["height","60","min","-100","line","",3,"value"]],template:function(t,n){1&t&&(e.TgZ(0,"button",0),e.NdJ("click",function(){return n.refresh()}),e._uU(1,"Refresh"),e.qZA(),e.TgZ(2,"nz-table",1)(3,"thead")(4,"tr")(5,"th"),e._uU(6,"\u5e8f\u53f7"),e.qZA(),e.TgZ(7,"th",2),e._uU(8,"\u670d\u52a1\u8c03\u7528\u6b21\u6570"),e.qZA(),e.TgZ(9,"th",2),e._uU(10,"\u6570\u636e\u6709\u8d1f\u503c"),e.qZA()()(),e.TgZ(11,"tbody"),e.YNc(12,Rt,7,3,"tr",3),e.qZA()()),2&t&&(e.xp6(2),e.Q6J("nzData",n.list)("nzShowPagination",!1),e.xp6(10),e.Q6J("ngForOf",n.list))},dependencies:[Ot.sg,Qt.C,g.ix,p.w,v.dQ,b.N8,b.Uo,b._C,b.Om,b.p0,b.$Z],styles:["[_nghost-%COMP%] .ant-table tbody>tr>td{padding:0}"]}),o})(),pt=(()=>{var a;class o{constructor(){this.item={cols:1,urls:{"zh-CN":"packages/chart/single-bar/index.md"},content:{"zh-CN":{content:'\u5355\u4e00\u67f1\u72b6\u56fe\u66f4\u9002\u5408\u5728\u5217\u8868\u4e2d\u5c55\u793a\u7b80\u5355\u7684\u533a\u95f4\u6570\u636e\uff0c\u7b80\u6d01\u7684\u8868\u73b0\u65b9\u5f0f\u53ef\u4ee5\u5f88\u597d\u7684\u51cf\u5c11\u5927\u6570\u636e\u91cf\u7684\u89c6\u89c9\u5c55\u73b0\u538b\u529b\u3002
',api:'API
g2-single-bar
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [repaint]
\u6570\u636e\u518d\u6b21\u53d8\u66f4\u65f6\u662f\u5426\u91cd\u7ed8 boolean
true
[delay]
\u5ef6\u8fdf\u6e32\u67d3\uff0c\u5355\u4f4d\uff1a\u6beb\u79d2 number
0
[plusColor]
\u56fe\u8868\u989c\u8272 string
#40a9ff
[minusColor]
\u8d1f\u503c\u56fe\u8868\u989c\u8272 string
#ff4d4f
[height]
\u56fe\u8868\u9ad8\u5ea6 number
60
[barSize]
\u67f1\u72b6\u9ad8\u5ea6 number
30
[min]
\u6700\u5c0f\u503c number
0
[max]
\u6700\u5927\u503c\uff0c\u82e5\u5c0f\u4e8e0\u8868\u793a\u663e\u793a\u8d1f\u503c number
100
[padding]
\u56fe\u8868\u5185\u90e8\u95f4\u8ddd any
0
[value]
\u503c number
0
[format]
\u663e\u793a\u503c\u683c\u5f0f (value: number) => string
- [textStyle]
\u663e\u793a\u503c\u6837\u5f0f any
{ fontSize: 12, color: \'#595959\' }
[theme]
\u5b9a\u5236\u56fe\u8868\u4e3b\u9898 string | LooseObject
- (ready)
\u5f53G2\u5b8c\u6210\u521d\u59cb\u5316\u540e\u8c03\u7528 EventEmitter<Chart>
-
',meta:{title:"g2-single-bar",subtitle:"\u5355\u4e00\u67f1\u72b6\u56fe",cols:1,type:"G2",module:"import { G2SingleBarModule } from '@delon/chart/single-bar';"},toc:[{id:"API",title:"API",h:2,children:[{id:"g2-single-bar",title:"g2-single-bar",h:3}]}]}},demo:!0},this.codes=[{id:"chart-single-bar-basic",meta:{order:0,title:{"zh-CN":"\u57fa\u7840","en-US":"Basic"}},summary:"\u57fa\u7840\u7528\u6cd5\u3002
",code:'import { Component, ViewEncapsulation } from \'@angular/core\';\n\n@Component({\n selector: \'chart-single-bar-basic\',\n template: `\n \n \n \n \n \u5e8f\u53f7 \n \u670d\u52a1\u8c03\u7528\u6b21\u6570 \n \u6570\u636e\u6709\u8d1f\u503c \n \n \n \n \n {{ idx + 1 }} \n \n \n \n \n \n \n \n \n \n `,\n styles: [\n `\n :host ::ng-deep .ant-table tbody > tr > td {\n padding: 0;\n }\n `,\n ],\n encapsulation: ViewEncapsulation.Emulated,\n})\nexport class ChartSingleBarBasicComponent {\n list: Array<{ id: number; value: number; other: number }> = new Array(5).fill({}).map(() => ({\n id: Math.floor(Math.random() * 10000),\n value: Math.floor(Math.random() * 100),\n other: Math.floor(Math.random() * 100) > 50 ? Math.floor(Math.random() * 100) : -Math.floor(Math.random() * 100),\n }));\n\n refresh(): void {\n this.list.forEach(v => {\n v.value = Math.floor(Math.random() * 100);\n v.other = Math.floor(Math.random() * 100) > 50 ? Math.floor(Math.random() * 100) : -Math.floor(Math.random() * 100);\n });\n }\n}',name:"basic",urls:"packages/chart/single-bar/demo/basic.md",type:"demo",lang:"ts",componentName:"ChartSingleBarBasicComponent",point:0}]}}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["app-chart-single-bar"]],decls:5,vars:5,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","24"],[3,"item"]],template:function(t,n){1&t&&(e.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),e._UZ(4,"chart-single-bar-basic"),e.qZA()()()()),2&t&&(e.Q6J("codes",n.codes)("item",n.item),e.xp6(1),e.Q6J("nzGutter",16),e.xp6(2),e.Q6J("item",n.codes[0]),e.uIk("id",n.codes[0].id))},dependencies:[l.t3,l.SK,s.P,m.e,ht],styles:["[_nghost-%COMP%]{display:block}"]}),o})();var $t=c(91641);let ut=(()=>{var a;class o{constructor(t){this.msg=t,this.tags=[],this.refresh()}refresh(){const t=(n=1,r=10)=>Math.floor(Math.random()*(r-n+1)+n);this.tags=[{value:t(),name:"NG-ALAIN"},{value:t(),name:"AntV"},{value:t(),name:"F2"},{value:t(),name:"G2"},{value:t(),name:"G6"},{value:t(),name:"DataSet"},{value:t(),name:"\u58a8\u8005\u5b66\u9662"},{value:t(),name:"Analysis"},{value:t(),name:"Data Mining"},{value:t(),name:"Data Vis"},{value:t(),name:"Design"},{value:t(),name:"Grammar"},{value:t(),name:"Graphics"},{value:t(),name:"Graph"},{value:t(),name:"Hierarchy"},{value:t(),name:"Labeling"},{value:t(),name:"Layout"},{value:t(),name:"Quantitative"},{value:t(),name:"Relation"},{value:t(),name:"Statistics"},{value:t(),name:"\u53ef\u89c6\u5316"},{value:t(),name:"\u6570\u636e"},{value:t(),name:"\u6570\u636e\u53ef\u89c6\u5316"},{value:t(),name:"Arc Diagram"},{value:t(),name:"Bar Chart"},{value:t(),name:"Canvas"},{value:t(),name:"Chart"},{value:t(),name:"DAG"},{value:t(),name:"DG"},{value:t(),name:"Facet"},{value:t(),name:"Geo"},{value:t(),name:"Line"},{value:t(),name:"MindMap"},{value:t(),name:"Pie"},{value:t(),name:"Pizza Chart"},{value:t(),name:"Punch Card"},{value:t(),name:"SVG"},{value:t(),name:"Sunburst"},{value:t(),name:"Tree"},{value:t(),name:"UML"},{value:t(),name:"Chart"},{value:t(),name:"View"},{value:t(),name:"Geom"},{value:t(),name:"Shape"},{value:t(),name:"Scale"},{value:t(),name:"Animate"},{value:t(),name:"Global"},{value:t(),name:"Slider"},{value:t(),name:"Connector"},{value:t(),name:"Transform"},{value:t(),name:"Util"},{value:t(),name:"DomUtil"},{value:t(),name:"MatrixUtil"},{value:t(),name:"PathUtil"},{value:t(),name:"G"},{value:t(),name:"2D"},{value:t(),name:"3D"},{value:t(),name:"Line"},{value:t(),name:"Area"},{value:t(),name:"Interval"},{value:t(),name:"Schema"},{value:t(),name:"Edge"},{value:t(),name:"Polygon"},{value:t(),name:"Heatmap"},{value:t(),name:"Render"},{value:t(),name:"Tooltip"},{value:t(),name:"Axis"},{value:t(),name:"Guide"},{value:t(),name:"Coord"},{value:t(),name:"Legend"},{value:t(),name:"Path"},{value:t(),name:"Helix"},{value:t(),name:"Theta"},{value:t(),name:"Rect"},{value:t(),name:"Polar"},{value:t(),name:"Dsv"},{value:t(),name:"Csv"},{value:t(),name:"Tsv"},{value:t(),name:"GeoJSON"},{value:t(),name:"TopoJSON"},{value:t(),name:"Filter"},{value:t(),name:"Map"},{value:t(),name:"Pick"},{value:t(),name:"Rename"},{value:t(),name:"Filter"},{value:t(),name:"Map"},{value:t(),name:"Pick"},{value:t(),name:"Rename"},{value:t(),name:"Reverse"},{value:t(),name:"sort"},{value:t(),name:"Subset"},{value:t(),name:"Partition"},{value:t(),name:"Imputation"},{value:t(),name:"Fold"},{value:t(),name:"Aggregate"},{value:t(),name:"Proportion"},{value:t(),name:"Histogram"},{value:t(),name:"Quantile"},{value:t(),name:"Treemap"},{value:t(),name:"Hexagon"},{value:t(),name:"Binning"},{value:t(),name:"kernel"},{value:t(),name:"Regression"},{value:t(),name:"Density"},{value:t(),name:"Sankey"},{value:t(),name:"Voronoi"},{value:t(),name:"Projection"},{value:t(),name:"Centroid"},{value:t(),name:"H5"},{value:t(),name:"Mobile"},{value:t(),name:"K\u7ebf\u56fe"},{value:t(),name:"\u5173\u7cfb\u56fe"},{value:t(),name:"\u70db\u5f62\u56fe"},{value:t(),name:"\u80a1\u7968\u56fe"},{value:t(),name:"\u76f4\u65b9\u56fe"},{value:t(),name:"\u91d1\u5b57\u5854\u56fe"},{value:t(),name:"\u5206\u9762"},{value:t(),name:"\u5357\u4e01\u683c\u5c14\u73ab\u7470\u56fe"},{value:t(),name:"\u997c\u56fe"},{value:t(),name:"\u7ebf\u56fe"},{value:t(),name:"\u70b9\u56fe"},{value:t(),name:"\u6563\u70b9\u56fe"},{value:t(),name:"\u5b50\u5f39\u56fe"},{value:t(),name:"\u67f1\u72b6\u56fe"},{value:t(),name:"\u4eea\u8868\u76d8"},{value:t(),name:"\u6c14\u6ce1\u56fe"},{value:t(),name:"\u6f0f\u6597\u56fe"},{value:t(),name:"\u70ed\u529b\u56fe"},{value:t(),name:"\u7389\u73a6\u56fe"},{value:t(),name:"\u76f4\u65b9\u56fe"},{value:t(),name:"\u77e9\u5f62\u6811\u56fe"},{value:t(),name:"\u7bb1\u5f62\u56fe"},{value:t(),name:"\u8272\u5757\u56fe"},{value:t(),name:"\u87ba\u65cb\u56fe"},{value:t(),name:"\u8bcd\u4e91"},{value:t(),name:"\u8bcd\u4e91\u56fe"},{value:t(),name:"\u96f7\u8fbe\u56fe"},{value:t(),name:"\u9762\u79ef\u56fe"},{value:t(),name:"\u9a6c\u8d5b\u514b\u56fe"},{value:t(),name:"\u76d2\u987b\u56fe"},{value:t(),name:"\u5750\u6807\u8f74"},{value:t(),name:""},{value:t(),name:"Jacques Bertin"},{value:t(),name:"Leland Wilkinson"},{value:t(),name:"William Playfair"},{value:t(),name:"\u5173\u8054"},{value:t(),name:"\u5206\u5e03"},{value:t(),name:"\u533a\u95f4"},{value:t(),name:"\u5360\u6bd4"},{value:t(),name:"\u5730\u56fe"},{value:t(),name:"\u65f6\u95f4"},{value:t(),name:"\u6bd4\u8f83"},{value:t(),name:"\u6d41\u7a0b"},{value:t(),name:"\u8d8b\u52bf"},{value:t(),name:"\u4ea6\u53f6"},{value:t(),name:"\u518d\u98de"},{value:t(),name:"\u5b8c\u767d"},{value:t(),name:"\u5df4\u601d"},{value:t(),name:"\u5f20\u521d\u5c18"},{value:t(),name:"\u5fa1\u672f"},{value:t(),name:"\u6709\u7530"},{value:t(),name:"\u6c89\u9c7c"},{value:t(),name:"\u7389\u4f2f"},{value:t(),name:"\u753b\u5eb7"},{value:t(),name:"\u796f\u9038"},{value:t(),name:"\u7edd\u4e91"},{value:t(),name:"\u7f57\u5baa"},{value:t(),name:"\u8427\u5e86"},{value:t(),name:"\u8463\u73ca\u73ca"},{value:t(),name:"\u9646\u6c89"},{value:t(),name:"\u987e\u503e"},{value:t(),name:"Domo"},{value:t(),name:"GPL"},{value:t(),name:"PAI"},{value:t(),name:"SPSS"},{value:t(),name:"SYSTAT"},{value:t(),name:"Tableau"},{value:t(),name:"D3"},{value:t(),name:"Vega"},{value:t(),name:"\u7edf\u8ba1\u56fe\u8868"}]}handleClick(t){this.msg.info(`${t.item.name} - ${t.item.value}`)}}return(a=o).\u0275fac=function(t){return new(t||a)(e.Y36(u.dD))},a.\u0275cmp=e.Xpm({type:a,selectors:[["chart-tag-cloud-basic"]],decls:3,vars:1,consts:[["nz-button","","nzType","primary",3,"click"],["height","400",3,"data","clickItem"]],template:function(t,n){1&t&&(e.TgZ(0,"button",0),e.NdJ("click",function(){return n.refresh()}),e._uU(1,"Refresh"),e.qZA(),e.TgZ(2,"g2-tag-cloud",1),e.NdJ("clickItem",function(i){return n.handleClick(i)}),e.qZA()),2&t&&(e.xp6(2),e.Q6J("data",n.tags))},dependencies:[$t.S,g.ix,p.w,v.dQ],encapsulation:2}),o})(),gt=(()=>{var a;class o{constructor(){this.item={cols:1,urls:{"zh-CN":"packages/chart/tag-cloud/index.md"},content:{"zh-CN":{content:'\u6807\u7b7e\u4e91\u662f\u4e00\u5957\u76f8\u5173\u7684\u6807\u7b7e\u4ee5\u53ca\u4e0e\u6b64\u76f8\u5e94\u7684\u6743\u91cd\u5c55\u793a\u65b9\u5f0f\uff0c\u4e00\u822c\u5178\u578b\u7684\u6807\u7b7e\u4e91\u6709 30 \u81f3 150 \u4e2a\u6807\u7b7e\uff0c\u800c\u6743\u91cd\u5f71\u54cd\u4f7f\u7528\u7684\u5b57\u4f53\u5927\u5c0f\u6216\u5176\u4ed6\u89c6\u89c9\u6548\u679c\u3002
',api:'API
g2-tag-cloud
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [repaint]
\u6570\u636e\u518d\u6b21\u53d8\u66f4\u65f6\u662f\u5426\u91cd\u7ed8 boolean
true
[delay]
\u5ef6\u8fdf\u6e32\u67d3\uff0c\u5355\u4f4d\uff1a\u6beb\u79d2 number
200
[height]
\u9ad8\u5ea6\u503c number
200
[width]
\u5bbd\u5ea6\u503c\uff0c\u82e5\u4e0d\u6307\u5b9a\u81ea\u52a8\u6309\u5bbf\u4e3b\u5143\u7d20\u7684\u5bbd\u5ea6 number
0
[data]
\u6570\u636e G2TagCloudData[]
[]
[theme]
\u5b9a\u5236\u56fe\u8868\u4e3b\u9898 string | LooseObject
- (clickItem)
\u70b9\u51fb\u9879\u56de\u8c03 EventEmitter<G2TagCloudClickItem>
- (ready)
\u5f53G2\u5b8c\u6210\u521d\u59cb\u5316\u540e\u8c03\u7528 EventEmitter<Chart>
-
G2TagCloudData
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [name]
\u540d\u79f0 string
- [value]
\u503c number
-
',meta:{title:"g2-tag-cloud",subtitle:"\u6807\u7b7e\u4e91",cols:1,type:"G2",module:"import { G2TagCloudModule } from '@delon/chart/tag-cloud';"},toc:[{id:"API",title:"API",h:2,children:[{id:"g2-tag-cloud",title:"g2-tag-cloud",h:3},{id:"G2TagCloudData",title:"G2TagCloudData",h:3}]}]}},demo:!0},this.codes=[{id:"chart-tag-cloud-basic",meta:{order:0,title:{"zh-CN":"\u57fa\u7840","en-US":"Basic"}},summary:"\u57fa\u7840\u7528\u6cd5\u3002
",code:"import { Component } from '@angular/core';\nimport { G2TagCloudClickItem, G2TagCloudData } from '@delon/chart/tag-cloud';\nimport { NzMessageService } from 'ng-zorro-antd/message';\n\n@Component({\n selector: 'chart-tag-cloud-basic',\n template: `\n \n \n `,\n})\nexport class ChartTagCloudBasicComponent {\n tags: G2TagCloudData[] = [];\n\n constructor(private msg: NzMessageService) {\n this.refresh();\n }\n\n refresh(): void {\n const rv = (min: number = 1, max: number = 10) => Math.floor(Math.random() * (max - min + 1) + min);\n\n this.tags = [\n { value: rv(), name: 'NG-ALAIN' },\n { value: rv(), name: 'AntV' },\n { value: rv(), name: 'F2' },\n { value: rv(), name: 'G2' },\n { value: rv(), name: 'G6' },\n { value: rv(), name: 'DataSet' },\n { value: rv(), name: '\u58a8\u8005\u5b66\u9662' },\n { value: rv(), name: 'Analysis' },\n { value: rv(), name: 'Data Mining' },\n { value: rv(), name: 'Data Vis' },\n { value: rv(), name: 'Design' },\n { value: rv(), name: 'Grammar' },\n { value: rv(), name: 'Graphics' },\n { value: rv(), name: 'Graph' },\n { value: rv(), name: 'Hierarchy' },\n { value: rv(), name: 'Labeling' },\n { value: rv(), name: 'Layout' },\n { value: rv(), name: 'Quantitative' },\n { value: rv(), name: 'Relation' },\n { value: rv(), name: 'Statistics' },\n { value: rv(), name: '\u53ef\u89c6\u5316' },\n { value: rv(), name: '\u6570\u636e' },\n { value: rv(), name: '\u6570\u636e\u53ef\u89c6\u5316' },\n { value: rv(), name: 'Arc Diagram' },\n { value: rv(), name: 'Bar Chart' },\n { value: rv(), name: 'Canvas' },\n { value: rv(), name: 'Chart' },\n { value: rv(), name: 'DAG' },\n { value: rv(), name: 'DG' },\n { value: rv(), name: 'Facet' },\n { value: rv(), name: 'Geo' },\n { value: rv(), name: 'Line' },\n { value: rv(), name: 'MindMap' },\n { value: rv(), name: 'Pie' },\n { value: rv(), name: 'Pizza Chart' },\n { value: rv(), name: 'Punch Card' },\n { value: rv(), name: 'SVG' },\n { value: rv(), name: 'Sunburst' },\n { value: rv(), name: 'Tree' },\n { value: rv(), name: 'UML' },\n { value: rv(), name: 'Chart' },\n { value: rv(), name: 'View' },\n { value: rv(), name: 'Geom' },\n { value: rv(), name: 'Shape' },\n { value: rv(), name: 'Scale' },\n { value: rv(), name: 'Animate' },\n { value: rv(), name: 'Global' },\n { value: rv(), name: 'Slider' },\n { value: rv(), name: 'Connector' },\n { value: rv(), name: 'Transform' },\n { value: rv(), name: 'Util' },\n { value: rv(), name: 'DomUtil' },\n { value: rv(), name: 'MatrixUtil' },\n { value: rv(), name: 'PathUtil' },\n { value: rv(), name: 'G' },\n { value: rv(), name: '2D' },\n { value: rv(), name: '3D' },\n { value: rv(), name: 'Line' },\n { value: rv(), name: 'Area' },\n { value: rv(), name: 'Interval' },\n { value: rv(), name: 'Schema' },\n { value: rv(), name: 'Edge' },\n { value: rv(), name: 'Polygon' },\n { value: rv(), name: 'Heatmap' },\n { value: rv(), name: 'Render' },\n { value: rv(), name: 'Tooltip' },\n { value: rv(), name: 'Axis' },\n { value: rv(), name: 'Guide' },\n { value: rv(), name: 'Coord' },\n { value: rv(), name: 'Legend' },\n { value: rv(), name: 'Path' },\n { value: rv(), name: 'Helix' },\n { value: rv(), name: 'Theta' },\n { value: rv(), name: 'Rect' },\n { value: rv(), name: 'Polar' },\n { value: rv(), name: 'Dsv' },\n { value: rv(), name: 'Csv' },\n { value: rv(), name: 'Tsv' },\n { value: rv(), name: 'GeoJSON' },\n { value: rv(), name: 'TopoJSON' },\n { value: rv(), name: 'Filter' },\n { value: rv(), name: 'Map' },\n { value: rv(), name: 'Pick' },\n { value: rv(), name: 'Rename' },\n { value: rv(), name: 'Filter' },\n { value: rv(), name: 'Map' },\n { value: rv(), name: 'Pick' },\n { value: rv(), name: 'Rename' },\n { value: rv(), name: 'Reverse' },\n { value: rv(), name: 'sort' },\n { value: rv(), name: 'Subset' },\n { value: rv(), name: 'Partition' },\n { value: rv(), name: 'Imputation' },\n { value: rv(), name: 'Fold' },\n { value: rv(), name: 'Aggregate' },\n { value: rv(), name: 'Proportion' },\n { value: rv(), name: 'Histogram' },\n { value: rv(), name: 'Quantile' },\n { value: rv(), name: 'Treemap' },\n { value: rv(), name: 'Hexagon' },\n { value: rv(), name: 'Binning' },\n { value: rv(), name: 'kernel' },\n { value: rv(), name: 'Regression' },\n { value: rv(), name: 'Density' },\n { value: rv(), name: 'Sankey' },\n { value: rv(), name: 'Voronoi' },\n { value: rv(), name: 'Projection' },\n { value: rv(), name: 'Centroid' },\n { value: rv(), name: 'H5' },\n { value: rv(), name: 'Mobile' },\n { value: rv(), name: 'K\u7ebf\u56fe' },\n { value: rv(), name: '\u5173\u7cfb\u56fe' },\n { value: rv(), name: '\u70db\u5f62\u56fe' },\n { value: rv(), name: '\u80a1\u7968\u56fe' },\n { value: rv(), name: '\u76f4\u65b9\u56fe' },\n { value: rv(), name: '\u91d1\u5b57\u5854\u56fe' },\n { value: rv(), name: '\u5206\u9762' },\n { value: rv(), name: '\u5357\u4e01\u683c\u5c14\u73ab\u7470\u56fe' },\n { value: rv(), name: '\u997c\u56fe' },\n { value: rv(), name: '\u7ebf\u56fe' },\n { value: rv(), name: '\u70b9\u56fe' },\n { value: rv(), name: '\u6563\u70b9\u56fe' },\n { value: rv(), name: '\u5b50\u5f39\u56fe' },\n { value: rv(), name: '\u67f1\u72b6\u56fe' },\n { value: rv(), name: '\u4eea\u8868\u76d8' },\n { value: rv(), name: '\u6c14\u6ce1\u56fe' },\n { value: rv(), name: '\u6f0f\u6597\u56fe' },\n { value: rv(), name: '\u70ed\u529b\u56fe' },\n { value: rv(), name: '\u7389\u73a6\u56fe' },\n { value: rv(), name: '\u76f4\u65b9\u56fe' },\n { value: rv(), name: '\u77e9\u5f62\u6811\u56fe' },\n { value: rv(), name: '\u7bb1\u5f62\u56fe' },\n { value: rv(), name: '\u8272\u5757\u56fe' },\n { value: rv(), name: '\u87ba\u65cb\u56fe' },\n { value: rv(), name: '\u8bcd\u4e91' },\n { value: rv(), name: '\u8bcd\u4e91\u56fe' },\n { value: rv(), name: '\u96f7\u8fbe\u56fe' },\n { value: rv(), name: '\u9762\u79ef\u56fe' },\n { value: rv(), name: '\u9a6c\u8d5b\u514b\u56fe' },\n { value: rv(), name: '\u76d2\u987b\u56fe' },\n { value: rv(), name: '\u5750\u6807\u8f74' },\n { value: rv(), name: '' },\n { value: rv(), name: 'Jacques Bertin' },\n { value: rv(), name: 'Leland Wilkinson' },\n { value: rv(), name: 'William Playfair' },\n { value: rv(), name: '\u5173\u8054' },\n { value: rv(), name: '\u5206\u5e03' },\n { value: rv(), name: '\u533a\u95f4' },\n { value: rv(), name: '\u5360\u6bd4' },\n { value: rv(), name: '\u5730\u56fe' },\n { value: rv(), name: '\u65f6\u95f4' },\n { value: rv(), name: '\u6bd4\u8f83' },\n { value: rv(), name: '\u6d41\u7a0b' },\n { value: rv(), name: '\u8d8b\u52bf' },\n { value: rv(), name: '\u4ea6\u53f6' },\n { value: rv(), name: '\u518d\u98de' },\n { value: rv(), name: '\u5b8c\u767d' },\n { value: rv(), name: '\u5df4\u601d' },\n { value: rv(), name: '\u5f20\u521d\u5c18' },\n { value: rv(), name: '\u5fa1\u672f' },\n { value: rv(), name: '\u6709\u7530' },\n { value: rv(), name: '\u6c89\u9c7c' },\n { value: rv(), name: '\u7389\u4f2f' },\n { value: rv(), name: '\u753b\u5eb7' },\n { value: rv(), name: '\u796f\u9038' },\n { value: rv(), name: '\u7edd\u4e91' },\n { value: rv(), name: '\u7f57\u5baa' },\n { value: rv(), name: '\u8427\u5e86' },\n { value: rv(), name: '\u8463\u73ca\u73ca' },\n { value: rv(), name: '\u9646\u6c89' },\n { value: rv(), name: '\u987e\u503e' },\n { value: rv(), name: 'Domo' },\n { value: rv(), name: 'GPL' },\n { value: rv(), name: 'PAI' },\n { value: rv(), name: 'SPSS' },\n { value: rv(), name: 'SYSTAT' },\n { value: rv(), name: 'Tableau' },\n { value: rv(), name: 'D3' },\n { value: rv(), name: 'Vega' },\n { value: rv(), name: '\u7edf\u8ba1\u56fe\u8868' },\n ];\n }\n\n handleClick(data: G2TagCloudClickItem): void {\n this.msg.info(`${data.item.name} - ${data.item.value}`);\n }\n}",name:"basic",urls:"packages/chart/tag-cloud/demo/basic.md",type:"demo",lang:"ts",componentName:"ChartTagCloudBasicComponent",point:0}]}}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["app-chart-tag-cloud"]],decls:5,vars:5,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","24"],[3,"item"]],template:function(t,n){1&t&&(e.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),e._UZ(4,"chart-tag-cloud-basic"),e.qZA()()()()),2&t&&(e.Q6J("codes",n.codes)("item",n.item),e.xp6(1),e.Q6J("nzGutter",16),e.xp6(2),e.Q6J("item",n.codes[0]),e.uIk("id",n.codes[0].id))},dependencies:[l.t3,l.SK,s.P,m.e,ut],styles:["[_nghost-%COMP%]{display:block}"]}),o})();var _=c(68771);const jt=function(){return{y1:"\u5ba2\u6d41\u91cf",y2:"\u652f\u4ed8\u7b14\u6570"}};let vt=(()=>{var a;class o{constructor(t){this.msg=t,this.chartData=[]}ngOnInit(){for(let t=0;t<20;t+=1)this.chartData.push({time:(new Date).getTime()+18e5*t,y1:Math.floor(100*Math.random())+1e3,y2:Math.floor(100*Math.random())+10})}handleClick(t){this.msg.info(`\u5ba2\u6d41\u91cf: ${t.item.y1}, \u652f\u4ed8\u7b14\u6570: ${t.item.y2}`)}}return(a=o).\u0275fac=function(t){return new(t||a)(e.Y36(u.dD))},a.\u0275cmp=e.Xpm({type:a,selectors:[["chart-timeline-basic"]],decls:1,vars:4,consts:[[3,"data","titleMap","height","clickItem"]],template:function(t,n){1&t&&(e.TgZ(0,"g2-timeline",0),e.NdJ("clickItem",function(i){return n.handleClick(i)}),e.qZA()),2&t&&e.Q6J("data",n.chartData)("titleMap",e.DdM(3,jt))("height",200)},dependencies:[_.Q],encapsulation:2}),o})(),Ct=(()=>{var a;class o{constructor(){this.chartData=[],this.titleMap={y1:"\u6307\u68071",y2:"\u6307\u68072"},this.maxAxis=5,this.refresh()}genData(t){const n=[];for(let r=0;r<20;r+=1){const i={time:(new Date).getTime()+18e5*r,y1:Math.floor(100*Math.random())+500,y2:Math.floor(100*Math.random())+1e3,y3:Math.floor(100*Math.random())+1500,y4:Math.floor(100*Math.random())+2e3,y5:Math.floor(100*Math.random())+2500};t&&delete i.y5,n.push(i)}return n}refresh(){const t={y1:"\u6307\u68071",y2:"\u6307\u68072",y3:"\u6307\u68073",y4:"\u6307\u68074",y5:"\u6307\u68075"},n=Math.random()>.5;n&&delete t.y5,this.chartData=this.genData(n),this.titleMap=t,this.maxAxis=n?4:5}refreshData(){this.chartData=this.genData(4===this.maxAxis)}}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["chart-timeline-max-axis"]],decls:5,vars:4,consts:[["nz-button","","nzType","primary",3,"click"],[3,"maxAxis","data","titleMap","height"]],template:function(t,n){1&t&&(e.TgZ(0,"button",0),e.NdJ("click",function(){return n.refresh()}),e._uU(1,"Refresh"),e.qZA(),e.TgZ(2,"button",0),e.NdJ("click",function(){return n.refreshData()}),e._uU(3,"Refresh Data"),e.qZA(),e._UZ(4,"g2-timeline",1)),2&t&&(e.xp6(4),e.Q6J("maxAxis",n.maxAxis)("data",n.chartData)("titleMap",n.titleMap)("height",300))},dependencies:[_.Q,g.ix,p.w,v.dQ],encapsulation:2}),o})();const qt=function(){return{y1:"\u5ba2\u6d41\u91cf",y2:"\u652f\u4ed8\u7b14\u6570"}};let ft=(()=>{var a;class o{constructor(t){this.msg=t,this.chartData=[]}ngOnInit(){for(let t=0;t<20;t+=1)this.chartData.push({time:(new Date).getTime()+864e5*t,y1:Math.floor(100*Math.random())+1e3,y2:Math.floor(100*Math.random())+10})}handleClick(t){this.msg.info(`\u5ba2\u6d41\u91cf: ${t.item.y1}, \u652f\u4ed8\u7b14\u6570: ${t.item.y2}`)}}return(a=o).\u0275fac=function(t){return new(t||a)(e.Y36(u.dD))},a.\u0275cmp=e.Xpm({type:a,selectors:[["chart-timeline-mask"]],decls:1,vars:4,consts:[["mask","MM\u6708DD\u65e5","maskSlider","MM\u6708dd\u65e5",3,"data","titleMap","height","clickItem"]],template:function(t,n){1&t&&(e.TgZ(0,"g2-timeline",0),e.NdJ("clickItem",function(i){return n.handleClick(i)}),e.qZA()),2&t&&e.Q6J("data",n.chartData)("titleMap",e.DdM(3,qt))("height",200)},dependencies:[_.Q],encapsulation:2}),o})(),bt=(()=>{var a;class o{constructor(){this.item={cols:1,urls:{"zh-CN":"packages/chart/timeline/index.md"},content:{"zh-CN":{content:'\u4f7f\u7528 timeline
\u7ec4\u4ef6\u53ef\u4ee5\u5b9e\u73b0\u5e26\u6709\u65f6\u95f4\u8f74\u7684\u67f1\u72b6\u56fe\u5c55\u73b0\uff0c\u800c\u5176\u4e2d\u7684 x
\u5c5e\u6027\uff0c\u5219\u662f\u65f6\u95f4\u503c\u7684\u6307\u5411\uff0c\u9ed8\u8ba4\u6700\u591a\u652f\u6301\u540c\u65f6\u5c55\u73b0\u4e24\u4e2a\u6307\u6807\uff0c\u5206\u522b\u662f y1
\u548c y2
\u3002
',api:'API
g2-timeline
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [repaint]
\u6570\u636e\u518d\u6b21\u53d8\u66f4\u65f6\u662f\u5426\u91cd\u7ed8 boolean
true
[delay]
\u5ef6\u8fdf\u6e32\u67d3\uff0c\u5355\u4f4d\uff1a\u6beb\u79d2 number
0
[title]
\u56fe\u8868\u6807\u9898 string,TemplateRef<void>
- [maxAxis]
\u6700\u5927\u6307\u6807\u6570\u91cf number
2
[data]
\u6570\u636e\uff0c\u6ce8\uff1a\u6839\u636e maxAxis
\u503c\u4f20\u9012\u6307\u6807\u6570\u636e G2TimelineData[]
- [titleMap]
\u6307\u6807\u522b\u540d G2TimelineMap
- [colorMap]
\u989c\u8272 G2TimelineMap
{ y1: \'#5B8FF9\', y2: \'#5AD8A6\', y3: \'#5D7092\', y4: \'#F6BD16\', y5: \'#E86452\' }
[height]
\u9ad8\u5ea6\u503c number
400
[padding]
\u56fe\u8868\u5185\u90e8\u95f4\u8ddd number[]
[40, 8, 64, 40]
[borderWidth]
\u7ebf\u6761 number
2
[mask]
\u65e5\u671f\u683c\u5f0f\uff0c\u4f7f\u7528 G2 Mask\u65e5\u671f\u683c\u5f0f string
HH:mm
[maskSlider]
\u6ed1\u52a8\u6761\u65e5\u671f\u683c\u5f0f\uff0c\u4f7f\u7528 date-fns \u65e5\u671f\u683c\u5f0f string
HH:mm
[position]
\u6807\u9898\u4f4d\u7f6e \'top\',\'right\',\'bottom\',\'left\'
\'top\'
[slider]
\u662f\u5426\u9700\u8981\u6ed1\u52a8\u6761 boolean
true
[theme]
\u5b9a\u5236\u56fe\u8868\u4e3b\u9898 string | LooseObject
- (clickItem)
\u70b9\u51fb\u9879\u56de\u8c03 EventEmitter<G2TimelineClickItem>
- (ready)
\u5f53G2\u5b8c\u6210\u521d\u59cb\u5316\u540e\u8c03\u7528 EventEmitter<Chart>
-
G2TimelineData
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [time]
\u65e5\u671f\u683c\u5f0f Date | number
- [y1]
\u6307\u68071\u6570\u636e number
- [y2]
\u6307\u68072\u6570\u636e number
- [y3]
\u6307\u68073\u6570\u636e number
- [y4]
\u6307\u68074\u6570\u636e number
- [y5]
\u6307\u68075\u6570\u636e number
-
G2TimelineMap
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [y1]
\u6307\u68071 string
- [y2]
\u6307\u68072 string
- [y3]
\u6307\u68073 string
- [y4]
\u6307\u68074 string
- [y5]
\u6307\u68075 string
-
',meta:{title:"g2-timeline",subtitle:"\u6298\u7ebf\u56fe",cols:1,type:"G2",module:"import { G2TimelineModule } from '@delon/chart/timeline';"},toc:[{id:"API",title:"API",h:2,children:[{id:"g2-timeline",title:"g2-timeline",h:3},{id:"G2TimelineData",title:"G2TimelineData",h:3},{id:"G2TimelineMap",title:"G2TimelineMap",h:3}]}]}},demo:!0},this.codes=[{id:"chart-timeline-basic",meta:{order:0,title:{"zh-CN":"\u57fa\u7840","en-US":"Basic"}},summary:"\u5e26\u6709\u65f6\u95f4\u8f74\u7684\u56fe\u8868\u3002
",code:"import { Component, OnInit } from '@angular/core';\nimport { G2TimelineClickItem, G2TimelineData } from '@delon/chart/timeline';\nimport { NzMessageService } from 'ng-zorro-antd/message';\n\n@Component({\n selector: 'chart-timeline-basic',\n template: ` `,\n})\nexport class ChartTimelineBasicComponent implements OnInit {\n chartData: G2TimelineData[] = [];\n\n constructor(private msg: NzMessageService) {}\n\n ngOnInit(): void {\n for (let i = 0; i < 20; i += 1) {\n this.chartData.push({\n time: new Date().getTime() + 1000 * 60 * 30 * i,\n y1: Math.floor(Math.random() * 100) + 1000,\n y2: Math.floor(Math.random() * 100) + 10,\n });\n }\n }\n\n handleClick(data: G2TimelineClickItem): void {\n this.msg.info(`\u5ba2\u6d41\u91cf: ${data.item.y1}, \u652f\u4ed8\u7b14\u6570: ${data.item.y2}`);\n }\n}",name:"basic",urls:"packages/chart/timeline/demo/basic.md",type:"demo",lang:"ts",componentName:"ChartTimelineBasicComponent",point:0},{id:"chart-timeline-max-axis",meta:{order:1,title:{"zh-CN":"\u591a\u6307\u6807","en-US":"Multiple indicators"}},summary:"\u5229\u7528 maxAxis
\u5c5e\u6027\u6765\u8c03\u6574\u591a\u4e2a\u6307\u6807\uff0c\u6700\u591a\u652f\u6301 5
\u4e2a\u6307\u6807\u503c\u3002
",code:"import { Component } from '@angular/core';\nimport { G2TimelineData, G2TimelineMap } from '@delon/chart/timeline';\n\n@Component({\n selector: 'chart-timeline-max-axis',\n template: `\n \n \n \n `,\n})\nexport class ChartTimelineMaxAxisComponent {\n chartData: G2TimelineData[] = [];\n titleMap: G2TimelineMap = { y1: '\u6307\u68071', y2: '\u6307\u68072' };\n maxAxis = 5;\n\n constructor() {\n this.refresh();\n }\n\n private genData(hideY5: boolean): G2TimelineData[] {\n const res: G2TimelineData[] = [];\n for (let i = 0; i < 20; i += 1) {\n const item: G2TimelineData = {\n time: new Date().getTime() + 1000 * 60 * 30 * i,\n y1: Math.floor(Math.random() * 100) + 500,\n y2: Math.floor(Math.random() * 100) + 1000,\n y3: Math.floor(Math.random() * 100) + 1500,\n y4: Math.floor(Math.random() * 100) + 2000,\n y5: Math.floor(Math.random() * 100) + 2500,\n };\n if (hideY5) delete item.y5;\n res.push(item);\n }\n return res;\n }\n\n refresh(): void {\n const titleMap: G2TimelineMap = { y1: '\u6307\u68071', y2: '\u6307\u68072', y3: '\u6307\u68073', y4: '\u6307\u68074', y5: '\u6307\u68075' };\n const hideY5 = Math.random() > 0.5;\n if (hideY5) delete titleMap.y5;\n this.chartData = this.genData(hideY5);\n this.titleMap = titleMap;\n this.maxAxis = hideY5 ? 4 : 5;\n }\n\n refreshData(): void {\n this.chartData = this.genData(this.maxAxis === 4);\n }\n}",name:"max-axis",urls:"packages/chart/timeline/demo/max-axis.md",type:"demo",lang:"ts",componentName:"ChartTimelineMaxAxisComponent",point:1},{id:"chart-timeline-mask",meta:{order:2,title:{"zh-CN":"\u65f6\u95f4\u683c\u5f0f\u5316","en-US":"Time mask format"}},summary:"\u5229\u7528 mask
\u548c maskSlider
\u6765\u6539\u53d8\u65f6\u95f4\u683c\u5f0f\u3002
",code:"import { Component, OnInit } from '@angular/core';\nimport { G2TimelineClickItem, G2TimelineData } from '@delon/chart/timeline';\nimport { NzMessageService } from 'ng-zorro-antd/message';\n\n@Component({\n selector: 'chart-timeline-mask',\n template: ` `,\n})\nexport class ChartTimelineMaskComponent implements OnInit {\n chartData: G2TimelineData[] = [];\n\n constructor(private msg: NzMessageService) {}\n\n ngOnInit(): void {\n for (let i = 0; i < 20; i += 1) {\n this.chartData.push({\n time: new Date().getTime() + 1000 * 60 * 60 * 24 * i,\n y1: Math.floor(Math.random() * 100) + 1000,\n y2: Math.floor(Math.random() * 100) + 10,\n });\n }\n }\n\n handleClick(data: G2TimelineClickItem): void {\n this.msg.info(`\u5ba2\u6d41\u91cf: ${data.item.y1}, \u652f\u4ed8\u7b14\u6570: ${data.item.y2}`);\n }\n}",name:"mask",urls:"packages/chart/timeline/demo/mask.md",type:"demo",lang:"ts",componentName:"ChartTimelineMaskComponent",point:2}]}}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["app-chart-timeline"]],decls:9,vars:9,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","24"],[3,"item"]],template:function(t,n){1&t&&(e.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),e._UZ(4,"chart-timeline-basic"),e.qZA(),e.TgZ(5,"code-box",3),e._UZ(6,"chart-timeline-max-axis"),e.qZA(),e.TgZ(7,"code-box",3),e._UZ(8,"chart-timeline-mask"),e.qZA()()()()),2&t&&(e.Q6J("codes",n.codes)("item",n.item),e.xp6(1),e.Q6J("nzGutter",16),e.xp6(2),e.Q6J("item",n.codes[0]),e.uIk("id",n.codes[0].id),e.xp6(2),e.Q6J("item",n.codes[1]),e.uIk("id",n.codes[1].id),e.xp6(2),e.Q6J("item",n.codes[2]),e.uIk("id",n.codes[2].id))},dependencies:[l.t3,l.SK,s.P,m.e,vt,Ct,ft],styles:["[_nghost-%COMP%]{display:block}"]}),o})(),yt=(()=>{var a;class o{}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["chart-trend-basic"]],decls:4,vars:0,consts:[["flag","up"],["flag","down",1,"ml-sm"]],template:function(t,n){1&t&&(e.TgZ(0,"trend",0),e._uU(1,"12%"),e.qZA(),e.TgZ(2,"trend",1),e._uU(3,"11%"),e.qZA())},dependencies:[M._],encapsulation:2}),o})(),Mt=(()=>{var a;class o{}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["chart-trend-reverse"]],decls:4,vars:0,consts:[["flag","up","reverseColor",""],["flag","down","reverseColor","",1,"ml-sm"]],template:function(t,n){1&t&&(e.TgZ(0,"trend",0),e._uU(1,"12%"),e.qZA(),e.TgZ(2,"trend",1),e._uU(3,"11%"),e.qZA())},dependencies:[M._],encapsulation:2}),o})(),kt=(()=>{var a;class o{constructor(){this.item={cols:1,urls:{"zh-CN":"packages/chart/trend/index.md"},content:{"zh-CN":{content:'\u8d8b\u52bf\u7b26\u53f7\uff0c\u6807\u8bb0\u4e0a\u5347\u548c\u4e0b\u964d\u8d8b\u52bf\u3002\u901a\u5e38\u7528\u7eff\u8272\u4ee3\u8868\u201c\u597d\u201d\uff0c\u7ea2\u8272\u4ee3\u8868\u201c\u4e0d\u597d\u201d\uff0c\u80a1\u7968\u6da8\u8dcc\u573a\u666f\u9664\u5916\u3002
',api:'API
trend
\u6210\u5458 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [colorful]
\u662f\u5426\u5f69\u8272\u6807\u8bb0 boolean
true
[flag]
\u4e0a\u5347\u4e0b\u964d\u6807\u8bc6 \'up\',\'down\'
- [reverseColor]
\u989c\u8272\u53cd\u8f6c boolean
false
',meta:{type:"G2",title:"trend",subtitle:"\u8d8b\u52bf\u6807\u8bb0",cols:1,module:"import { TrendModule } from '@delon/chart/trend';"},toc:[{id:"API",title:"API",h:2,children:[{id:"trend",title:"trend",h:3}]}]}},demo:!0},this.codes=[{id:"chart-trend-basic",meta:{order:0,title:"\u6f14\u793a"},summary:"\u5728\u6570\u503c\u80cc\u540e\u6dfb\u52a0\u4e00\u4e2a\u5c0f\u56fe\u6807\u6765\u6807\u8bc6\u6da8\u8dcc\u60c5\u51b5\u3002
",code:'import { Component } from \'@angular/core\';\n\n@Component({\n selector: \'chart-trend-basic\',\n template: `\n 12% \n 11% \n `,\n})\nexport class ChartTrendBasicComponent {}',name:"basic",urls:"packages/chart/trend/demo/basic.md",type:"demo",lang:"ts",componentName:"ChartTrendBasicComponent",point:0},{id:"chart-trend-reverse",meta:{order:1,title:"\u989c\u8272\u53cd\u8f6c"},summary:"\u5728\u6570\u503c\u80cc\u540e\u6dfb\u52a0\u4e00\u4e2a\u5c0f\u56fe\u6807\u6765\u6807\u8bc6\u6da8\u8dcc\u60c5\u51b5\u3002
",code:'import { Component } from \'@angular/core\';\n\n@Component({\n selector: \'chart-trend-reverse\',\n template: `\n 12% \n 11% \n `,\n})\nexport class ChartTrendReverseComponent {}',name:"reverse",urls:"packages/chart/trend/demo/reverse.md",type:"demo",lang:"ts",componentName:"ChartTrendReverseComponent",point:1}]}}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["app-chart-trend"]],decls:7,vars:7,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","24"],[3,"item"]],template:function(t,n){1&t&&(e.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),e._UZ(4,"chart-trend-basic"),e.qZA(),e.TgZ(5,"code-box",3),e._UZ(6,"chart-trend-reverse"),e.qZA()()()()),2&t&&(e.Q6J("codes",n.codes)("item",n.item),e.xp6(1),e.Q6J("nzGutter",16),e.xp6(2),e.Q6J("item",n.codes[0]),e.uIk("id",n.codes[0].id),e.xp6(2),e.Q6J("item",n.codes[1]),e.uIk("id",n.codes[1].id))},dependencies:[l.t3,l.SK,s.P,m.e,yt,Mt],styles:["[_nghost-%COMP%]{display:block}"]}),o})();var Lt=c(64755);let Tt=(()=>{var a;class o{}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["chart-water-wave-basic"]],hostVars:2,hostBindings:function(t,n){2&t&&e.ekj("d-block",!0)},decls:1,vars:3,consts:[[3,"title","percent","height"]],template:function(t,n){1&t&&e._UZ(0,"g2-water-wave",0),2&t&&e.Q6J("title","\u8865\u8d34\u8d44\u91d1\u5269\u4f59")("percent",34)("height",161)},dependencies:[Lt.u],encapsulation:2}),o})();const Wt=[{path:"",component:_t.S,children:[{path:"",redirectTo:"getting-started/zh",pathMatch:"full"},{path:"faq",redirectTo:"faq/zh",pathMatch:"full"},{path:"faq/:lang",component:x},{path:"getting-started",redirectTo:"getting-started/zh",pathMatch:"full"},{path:"getting-started/:lang",component:w},{path:"bar",redirectTo:"bar/zh",pathMatch:"full"},{path:"bar/:lang",component:B},{path:"card",redirectTo:"card/zh",pathMatch:"full"},{path:"card/:lang",component:Z},{path:"chart-echarts",redirectTo:"chart-echarts/zh",pathMatch:"full"},{path:"chart-echarts/:lang",component:O},{path:"custom",redirectTo:"custom/zh",pathMatch:"full"},{path:"custom/:lang",component:R},{path:"gauge",redirectTo:"gauge/zh",pathMatch:"full"},{path:"gauge/:lang",component:j},{path:"mini-area",redirectTo:"mini-area/zh",pathMatch:"full"},{path:"mini-area/:lang",component:X},{path:"mini-bar",redirectTo:"mini-bar/zh",pathMatch:"full"},{path:"mini-bar/:lang",component:K},{path:"mini-progress",redirectTo:"mini-progress/zh",pathMatch:"full"},{path:"mini-progress/:lang",component:et},{path:"number-info",redirectTo:"number-info/zh",pathMatch:"full"},{path:"number-info/:lang",component:dt},{path:"pie",redirectTo:"pie/zh",pathMatch:"full"},{path:"pie/:lang",component:lt},{path:"radar",redirectTo:"radar/zh",pathMatch:"full"},{path:"radar/:lang",component:mt},{path:"single-bar",redirectTo:"single-bar/zh",pathMatch:"full"},{path:"single-bar/:lang",component:pt},{path:"tag-cloud",redirectTo:"tag-cloud/zh",pathMatch:"full"},{path:"tag-cloud/:lang",component:gt},{path:"timeline",redirectTo:"timeline/zh",pathMatch:"full"},{path:"timeline/:lang",component:bt},{path:"trend",redirectTo:"trend/zh",pathMatch:"full"},{path:"trend/:lang",component:kt},{path:"water-wave",redirectTo:"water-wave/zh",pathMatch:"full"},{path:"water-wave/:lang",component:(()=>{var a;class o{constructor(){this.item={cols:1,urls:{"zh-CN":"packages/chart/water-wave/index.md"},content:{"zh-CN":{content:'\u6c34\u6ce2\u56fe\u662f\u4e00\u79cd\u6bd4\u4f8b\u7684\u5c55\u793a\u65b9\u5f0f\uff0c\u53ef\u4ee5\u66f4\u76f4\u89c2\u7684\u5c55\u793a\u5173\u952e\u503c\u7684\u5360\u6bd4\u3002
\u9ed8\u8ba4\u4e0d\u652f\u6301\u7236\u5143\u7d20\u81ea\u9002\u5e94\uff0c\u53ef\u4ee5\u76d1\u542c\u7236\u5143\u7d20\u7684\u53d8\u5316\u5e76\u4f7f\u7528 render()
\u65b9\u6cd5\u6765\u91cd\u7f6e\u6e32\u67d3\u3002
',api:'API
g2-water-wave
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [animate]
\u662f\u5426\u663e\u793a\u52a8\u753b boolean
true
[delay]
\u5ef6\u8fdf\u6e32\u67d3\uff0c\u5355\u4f4d\uff1a\u6beb\u79d2 number
0
[title]
\u56fe\u8868\u6807\u9898 string,TemplateRef<void>
- [height]
\u56fe\u8868\u9ad8\u5ea6 number
160
[color]
\u56fe\u8868\u989c\u8272 string
#1890FF
[percent]
\u8fdb\u5ea6\u6bd4\u4f8b number
-
',meta:{title:"g2-water-wave",subtitle:"\u6c34\u6ce2\u56fe",cols:1,type:"G2",module:"import { G2WaterWaveModule } from '@delon/chart/water-wave';"},toc:[{id:"API",title:"API",h:2,children:[{id:"g2-water-wave",title:"g2-water-wave",h:3}]}]}},demo:!0},this.codes=[{id:"chart-water-wave-basic",meta:{order:0,title:{"zh-CN":"\u57fa\u7840","en-US":"Basic"}},summary:"\u57fa\u7840\u7528\u6cd5\u3002
",code:"import { Component } from '@angular/core';\n\n@Component({\n selector: 'chart-water-wave-basic',\n template: `\n \n `,\n host: {\n '[class.d-block]': 'true'\n }\n})\nexport class ChartWaterWaveBasicComponent {}",name:"basic",urls:"packages/chart/water-wave/demo/basic.md",type:"demo",lang:"ts",componentName:"ChartWaterWaveBasicComponent",point:0}]}}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275cmp=e.Xpm({type:a,selectors:[["app-chart-water-wave"]],decls:5,vars:5,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","24"],[3,"item"]],template:function(t,n){1&t&&(e.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),e._UZ(4,"chart-water-wave-basic"),e.qZA()()()()),2&t&&(e.Q6J("codes",n.codes)("item",n.item),e.xp6(1),e.Q6J("nzGutter",16),e.xp6(2),e.Q6J("item",n.codes[0]),e.uIk("id",n.codes[0].id))},dependencies:[l.t3,l.SK,s.P,m.e,Tt],styles:["[_nghost-%COMP%]{display:block}"]}),o})()}]}];let Xt=(()=>{var a;class o{}return(a=o).\u0275fac=function(t){return new(t||a)},a.\u0275mod=e.oAB({type:a}),a.\u0275inj=e.cJS({imports:[At.m,zt.Bz.forChild(Wt)]}),o})()}}]);
\ No newline at end of file
diff --git a/274.5054fb0545474495.js b/274.5054fb0545474495.js
new file mode 100644
index 0000000000..f0c715262e
--- /dev/null
+++ b/274.5054fb0545474495.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunksite=self.webpackChunksite||[]).push([[274],{47274:(Wt,G,i)=>{i.r(G),i.d(G,{ChartModule:()=>Xt});var Dt=i(52787),zt=i(89359),At=i(93285),t=i(65879),s=i(28749);let x=(()=>{class n{constructor(){this.item={cols:1,urls:{"en-US":"packages/chart/docs/faq.en-US.md","zh-CN":"packages/chart/docs/faq.zh-CN.md"},content:{"en-US":{content:'How to auto-resize of the container?
The G2 uses window.addEventListener(\'resize\', this.onResize)
to detect a change in parent dom element\'s size. So you need to manually monitor the change in the size of the container and call chart.forceFit()
to force resize.
\x3c!--demo(resi ',meta:{order:100,title:"FAQ",type:"Documents"},toc:[{id:"Howtoauto-resizeofthecontainer",title:"How to auto-resize of the container?",h:2}]},"zh-CN":{content:'\u5982\u4f55\u81ea\u9002\u5e94\u5bb9\u5668\u5bbd\u9ad8\uff1f
G2 \u5f53\u524d\u7248\u672c\u5e76\u4e0d\u4f1a\u6839\u636e\u5bb9\u5668\u5bbd\u9ad8\u81ea\u9002\u5e94\uff0c\u76ee\u524d\u53ea\u4f1a\u6839\u636e\u6d4f\u89c8\u5668\u7a97\u4f53\u5927\u5c0f\u624d\u4f1a\u91cd\u65b0\u53d8\u66f4\u56fe\u8868\u5c3a\u5bf8\uff0c\u56e0\u6b64\u9700\u8981\u624b\u52a8\u76d1\u542c\u5bb9\u5668\u5927\u5c0f\u7684\u53d8\u5316\u5e76\u8c03\u7528 chart.forceFit()
\u91cd\u65b0\u6e32\u67d3\u56fe\u8868\u5c3a\u5bf8\u3002
\x3c!--demo(resi ',meta:{order:100,title:"\u5e38\u89c1\u95ee\u9898",type:"Documents"},toc:[{id:"\u5982\u4f55\u81ea\u9002\u5e94\u5bb9\u5668\u5bbd\u9ad8\uff1f",title:"\u5982\u4f55\u81ea\u9002\u5e94\u5bb9\u5668\u5bbd\u9ad8\uff1f",h:2}]}},demo:!1},this.codes=[]}static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["app-chart-faq"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(a,o){1&a&&t._UZ(0,"app-docs",0),2&a&&t.Q6J("codes",o.codes)("item",o.item)},dependencies:[s.P],styles:["[_nghost-%COMP%]{display:block}"]})}return n})(),w=(()=>{class n{constructor(){this.item={cols:1,urls:{"en-US":"packages/chart/docs/getting-started.en-US.md","zh-CN":"packages/chart/docs/getting-started.zh-CN.md"},content:{"en-US":{content:'Chart provides the well-designed abstract chart components based on the G2. These components provide the ability to use with complex mixed view or just use along for common business usage.
Usage
G2 class library loading
By default, the class library CDN address has been specified in Global Configuration:
// global-config.module.ts\nconst alainConfig: AlainConfig = {\n chart: { \n // The following is the default configuration. If the project cannot be accessed from the Internet, you can directly use the `./assets***` path for the dependent package according to the `angular.json` configuration\n libs: [\n \'https://gw.alipayobjects.com/os/lib/antv/g2/4.1.4/dist/g2.min.js\',\n \'https://gw.alipayobjects.com/os/lib/antv/data-set/0.11.7/dist/data-set.js\',\n ],\n },\n};\n\nexport class DelonModule {\n static forRoot(): ModuleWithProviders {\n return {\n ngModule: DelonModule,\n providers: [\n { provide: ALAIN_CONFIG, useValue: alainConfig }\n ]\n };\n }\n}
Of course, you can also directly import the CDN address in index.html
, for example:
<!-- Introduce online resources, select the g2 version you need and replace the version variable -->\n<script src="https://gw.alipayobjects.com/os/lib/antv/g2/{{version}}/dist/g2.min.js"></script>
You can also configure the assets
(About assets Document) option in angular.json
to obtain the G2 library from node_modules
, for example:
"assets": [\n {\n "glob": "**/*",\n "input": "./node_modules/@antv/g2/dist",\n "output": "/@antv/g2/"\n },\n {\n "glob": "**/*",\n "input": "./node_modules/@antv/data-set/dist",\n "output": "/@antv/data-set/"\n }\n]
Finally modify the libs
parameter of the global configuration:
// global-config.module.ts\nconst alainConfig: AlainConfig = {\n chart: { \n libs: [\n \'./assets/@antv/g2/g2.min.js\',\n \'./assets/@antv/data-set/data-set.js\',\n ],\n },\n};
Import module
// shared.module.ts\nimport { G2BarModule } from \'@delon/chart/bar\';\n\n@NgModule({\n imports: [ G2BarModule ],\n exports: [ G2BarModule ]\n})
Custom G2 components
Use the g2-chart component to better implement custom charts.
Configure chart theme
Configure the chart theme for all G2, but only provide interfaces. For the configuration chart theme parameters, please refer to G2 website.
// global-config.module.ts\nconst alainConfig: AlainConfig = {\n chart: { theme: \'dark\' },\n};\n\nexport class DelonModule {\n static forRoot(): ModuleWithProviders {\n return {\n ngModule: DelonModule,\n providers: [\n { provide: ALAIN_CONFIG, useValue: alainConfig }\n ]\n };\n }\n}',meta:{order:1,title:"Getting Started",type:"Documents"},toc:[{id:"Usage",title:"Usage",h:2,children:[{id:"G2classlibraryloading",title:"G2 class library loading",h:3},{id:"Importmodule",title:"Import module",h:3}]},{id:"CustomG2components",title:"Custom G2 components",h:2},{id:"Configurecharttheme",title:"Configure chart theme",h:2}]},"zh-CN":{content:'\u56fe\u8868\u662f\u57fa\u4e8e G2 (3.0) \u7684\u57fa\u7840\u4e0a\u4e8c\u6b21\u5c01\u88c5\uff0c\u63d0\u4f9b\u4e86\u4e1a\u52a1\u4e2d\u5e38\u7528\u7684\u56fe\u8868\u5957\u4ef6\uff0c\u53ef\u4ee5\u5355\u72ec\u4f7f\u7528\uff0c\u4e5f\u53ef\u4ee5\u7ec4\u5408\u8d77\u6765\u5b9e\u73b0\u590d\u6742\u7684\u5c55\u793a\u6548\u679c\u3002
\u56fe\u8868\u7684\u4f5c\u7528\uff0c\u662f\u5e2e\u52a9\u6211\u4eec\u66f4\u597d\u5730\u770b\u61c2\u6570\u636e\u3002\u9009\u62e9\u4ec0\u4e48\u56fe\u8868\uff0c\u9700\u8981\u56de\u7b54\u7684\u9996\u8981\u95ee\u9898\u662f\u300e\u6211\u6709\u4ec0\u4e48\u6570\u636e\uff0c\u9700\u8981\u7528\u56fe\u8868\u505a\u4ec0\u4e48\u300f\uff0c\u800c\u4e0d\u662f \u300e\u56fe\u8868\u957f\u6210\u4ec0\u4e48\u6837\u300f \u3002
\u5206\u7c7b\u540d \u7ec4\u4ef6\u6e05\u5355 \u63cf\u8ff0 \u6bd4\u8f83\u7c7b \u8ff7\u4f60\u67f1\u72b6\u56fe\uff1ag2-mini-bar
\u5355\u4e00\u67f1\u72b6\u56fe\uff1ag2-single-bar
\u67f1\u72b6\u56fe\uff1ag2-bar
\u96f7\u8fbe\u56fe\uff1ag2-radar
\u8ff7\u4f60\u533a\u57df\u56fe\uff1ag2-mini-area
\u8ff7\u4f60\u8fdb\u5ea6\u6761\uff1ag2-mini-progress
- \u5206\u5e03\u7c7b \u6298\u7ebf\u56fe\uff1ag2-timeline
- \u5360\u6bd4\u7c7b \u997c\u56fe\uff1ag2-pie
\u6c34\u6ce2\u56fe\uff1ag2-water-wave
\u8ff7\u4f60\u8fdb\u5ea6\u6761\uff1ag2-mini-progress
\u8ff7\u4f60\u533a\u57df\u56fe\uff1ag2-mini-area
- \u533a\u95f4\u7c7b \u4eea\u8868\u76d8\uff1ag2-gauge
\u8ff7\u4f60\u533a\u57df\u56fe\uff1ag2-mini-area
- \u8d8b\u52bf\u7c7b \u6298\u7ebf\u56fe\uff1ag2-timeline
\u8ff7\u4f60\u533a\u57df\u56fe\uff1ag2-mini-area
- \u65f6\u95f4\u7c7b \u6298\u7ebf\u56fe\uff1ag2-timeline
\u8ff7\u4f60\u533a\u57df\u56fe\uff1ag2-mini-area
- \u5176\u5b83 \u6807\u7b7e\u4e91\uff1ag2-tag-cloud
\u56fe\u8868\u5361\u7247\uff1ag2-chart-card
\u81ea\u5b9a\u4e49\u56fe\u8868\uff1ag2-chart
-
\u5982\u4f55\u4f7f\u7528
G2\u7c7b\u5e93\u52a0\u8f7d
\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5728\u5168\u5c40\u914d\u7f6e\u5df2\u7ecf\u6307\u5b9a\u7c7b\u5e93 CDN \u5730\u5740\uff1a
// global-config.module.ts\nconst alainConfig: AlainConfig = {\n chart: { \n // \u4ee5\u4e0b\u662f\u9ed8\u8ba4\u914d\u7f6e\uff0c\u5982\u679c\u9879\u76ee\u65e0\u6cd5\u5916\u7f51\u8bbf\u95ee\uff0c\u53ef\u4ee5\u6839\u636e `angular.json` \u914d\u7f6e\u5c06\u4f9d\u8d56\u5305\u76f4\u63a5\u4f7f\u7528 `./assets***` \u8def\u5f84\n libs: [\n \'https://gw.alipayobjects.com/os/lib/antv/g2/4.1.4/dist/g2.min.js\',\n \'https://gw.alipayobjects.com/os/lib/antv/data-set/0.11.7/dist/data-set.js\',\n ],\n },\n};\n\nexport class DelonModule {\n static forRoot(): ModuleWithProviders {\n return {\n ngModule: DelonModule,\n providers: [\n { provide: ALAIN_CONFIG, useValue: alainConfig }\n ]\n };\n }\n}
\u5f53\u7136\u4e5f\u53ef\u4ee5\u5728 index.html
\u76f4\u63a5\u5f15\u5165 CDN \u5730\u5740\uff0c\u4f8b\u5982\uff1a
<!-- \u5f15\u5165\u5728\u7ebf\u8d44\u6e90\uff0c\u9009\u62e9\u4f60\u9700\u8981\u7684 g2 \u7248\u672c\u4ee5\u66ff\u6362 version \u53d8\u91cf -->\n<script src="https://gw.alipayobjects.com/os/lib/antv/g2/{{version}}/dist/g2.min.js"></script>
\u4e5f\u53ef\u4ee5\u5728 angular.json
\u914d\u7f6e assets
\u9009\u9879\uff08\u6709\u5173 assets \u6587\u6863\uff09\uff0c\u4ece node_modules
\u6765\u83b7\u5f97G2\u7c7b\u5e93\uff0c\u4f8b\u5982\uff1a
"assets": [\n {\n "glob": "**/*",\n "input": "./node_modules/@antv/g2/dist",\n "output": "/@antv/g2/"\n },\n {\n "glob": "**/*",\n "input": "./node_modules/@antv/data-set/dist",\n "output": "/@antv/data-set/"\n }\n]
\u6700\u540e\u4fee\u6539\u5168\u5c40\u914d\u7f6e\u7684 libs
\u53c2\u6570\u4e3a\uff1a
// global-config.module.ts\nconst alainConfig: AlainConfig = {\n chart: { \n libs: [\n \'./assets/@antv/g2/g2.min.js\',\n \'./assets/@antv/data-set/data-set.js\',\n ],\n },\n};
\u5bfc\u5165\u6a21\u5757
// shared.module.ts\nimport { G2BarModule } from \'@delon/chart/bar\';\n\n@NgModule({\n imports: [ G2BarModule ],\n exports: [ G2BarModule ]\n})
\u81ea\u5b9a\u4e49 G2 \u7ec4\u4ef6
\u4f7f\u7528 g2-chart \u7ec4\u4ef6\u5feb\u901f\u81ea\u5b9a\u4e49\u4e00\u4e2a\u56fe\u8868\uff0c\u53ef\u4ee5\u51cf\u5c11\u4e0d\u5fc5\u8981\u7684\u7ec4\u4ef6\u6e32\u67d3\u8fc7\u7a0b\u4e2d\u6240\u4ea7\u751f\u7684\u5947\u602a\u95ee\u9898\u3002
\u914d\u7f6e\u56fe\u8868\u4e3b\u9898
\u5bf9\u6240\u6709 G2 \u8fdb\u884c\u914d\u7f6e\u56fe\u8868\u4e3b\u9898\uff0c\u4f46\u53ea\u63d0\u4f9b\u63a5\u53e3\uff0c\u6709\u5173\u914d\u7f6e\u56fe\u8868\u4e3b\u9898\u53c2\u6570\uff0c\u8bf7\u53c2\u8003G2\u5b98\u7f51\u3002
// global-config.module.ts\nconst alainConfig: AlainConfig = {\n chart: { theme: \'dark\' },\n};\n\nexport class DelonModule {\n static forRoot(): ModuleWithProviders {\n return {\n ngModule: DelonModule,\n providers: [\n { provide: ALAIN_CONFIG, useValue: alainConfig }\n ]\n };\n }\n}',meta:{order:1,title:"\u5f00\u59cb\u4f7f\u7528",type:"Documents"},toc:[{id:"\u5982\u4f55\u4f7f\u7528",title:"\u5982\u4f55\u4f7f\u7528",h:2,children:[{id:"G2\u7c7b\u5e93\u52a0\u8f7d",title:"G2\u7c7b\u5e93\u52a0\u8f7d",h:3},{id:"\u5bfc\u5165\u6a21\u5757",title:"\u5bfc\u5165\u6a21\u5757",h:3}]},{id:"\u81ea\u5b9a\u4e49G2\u7ec4\u4ef6",title:"\u81ea\u5b9a\u4e49 G2 \u7ec4\u4ef6",h:2},{id:"\u914d\u7f6e\u56fe\u8868\u4e3b\u9898",title:"\u914d\u7f6e\u56fe\u8868\u4e3b\u9898",h:2}]}},demo:!1},this.codes=[]}static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["app-chart-getting-started"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(a,o){1&a&&t._UZ(0,"app-docs",0),2&a&&t.Q6J("codes",o.codes)("item",o.item)},dependencies:[s.P],styles:["[_nghost-%COMP%]{display:block}"]})}return n})();var c=i(10095),l=i(27358),h=i(43460),Gt=i(69694),p=i(42840),m=i(70855),u=i(41958);let _=(()=>{class n{constructor(e){this.msg=e,this.salesData=this.genData()}genData(){return new Array(12).fill({}).map((e,a)=>({x:`${a+1}\u6708`,y:Math.floor(1e3*Math.random())+200,color:a>5?"#f50":void 0}))}refresh(){this.salesData=this.genData()}handleClick(e){this.msg.info(`${e.item.x} - ${e.item.y}`)}static#t=this.\u0275fac=function(a){return new(a||n)(t.Y36(h.dD))};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["chart-bar-basic"]],decls:3,vars:2,consts:[["nz-button","","nzType","primary",3,"click"],["height","200",3,"title","data","clickItem"]],template:function(a,o){1&a&&(t.TgZ(0,"button",0),t.NdJ("click",function(){return o.refresh()}),t._uU(1,"Refresh"),t.qZA(),t.TgZ(2,"g2-bar",1),t.NdJ("clickItem",function(r){return o.handleClick(r)}),t.qZA()),2&a&&(t.xp6(2),t.Q6J("title","\u9500\u552e\u989d\u8d8b\u52bf")("data",o.salesData))},dependencies:[Gt.g,p.ix,m.w,u.dQ],encapsulation:2})}return n})(),I=(()=>{class n{constructor(){this.item={cols:1,urls:{"zh-CN":"packages/chart/bar/index.md"},content:{"zh-CN":{content:'\u4f7f\u7528\u5782\u76f4\u7684\u67f1\u5b50\u663e\u793a\u7c7b\u522b\u4e4b\u95f4\u7684\u6570\u503c\u6bd4\u8f83\u3002\u5176\u4e2d\u4e00\u4e2a\u8f74\u8868\u793a\u9700\u8981\u5bf9\u6bd4\u7684\u5206\u7c7b\u7ef4\u5ea6\uff0c\u53e6\u4e00\u4e2a\u8f74\u4ee3\u8868\u76f8\u5e94\u7684\u6570\u503c\u3002
',api:'API
g2-bar
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [repaint]
\u6570\u636e\u518d\u6b21\u53d8\u66f4\u65f6\u662f\u5426\u91cd\u7ed8 boolean
true
[delay]
\u5ef6\u8fdf\u6e32\u67d3\uff0c\u5355\u4f4d\uff1a\u6beb\u79d2 number
0
[title]
\u56fe\u8868\u6807\u9898 string,TemplateRef<void>
- [color]
\u56fe\u8868\u989c\u8272 string
rgba(24, 144, 255, 0.85)
[padding]
\u56fe\u8868\u5185\u90e8\u95f4\u8ddd Array<number | string> | string
[32, 0, 32, 40]
[height]
\u56fe\u8868\u9ad8\u5ea6 number
- [data]
\u6570\u636e G2BarData[]
[]
[autoLabel]
\u5728\u5bbd\u5ea6\u4e0d\u8db3\u65f6\uff0c\u81ea\u52a8\u9690\u85cf x \u8f74\u7684 label boolean
true
[interaction]
\u4ea4\u4e92\u7c7b\u578b\uff0cnone \u65e0 element-active \u56fe\u5f62\u5143\u7d20\uff0cactive-region \u56fe\u8868\u7ec4\u4ef6\uff0cbrush \u6846\u9009\uff0cdrag-move \u79fb\u52a8 InteractionType
none
[theme]
\u5b9a\u5236\u56fe\u8868\u4e3b\u9898 string | LooseObject
- (clickItem)
\u70b9\u51fb\u9879\u56de\u8c03 EventEmitter<G2BarClickItem>
- (ready)
\u5f53G2\u5b8c\u6210\u521d\u59cb\u5316\u540e\u8c03\u7528 EventEmitter<Chart>
-
G2BarData
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [x]
x\u8f74 any
- [y]
y\u8f74 any
- [color]
\u8f74\u989c\u8272 string
-
',meta:{title:"g2-bar",subtitle:"\u67f1\u72b6\u56fe",cols:1,type:"G2",module:"import { G2BarModule } from '@delon/chart/bar';"},toc:[{id:"API",title:"API",h:2,children:[{id:"g2-bar",title:"g2-bar",h:3},{id:"G2BarData",title:"G2BarData",h:3}]}]}},demo:!0},this.codes=[{id:"chart-bar-basic",meta:{order:0,title:{"zh-CN":"\u57fa\u672c","en-US":"Basic"}},summary:"\u901a\u8fc7\u8bbe\u7f6e x
\uff0cy
\u5c5e\u6027\uff0c\u53ef\u4ee5\u5feb\u901f\u7684\u6784\u5efa\u51fa\u4e00\u4e2a\u6f02\u4eae\u7684\u67f1\u72b6\u56fe\uff0c\u5404\u79cd\u7eac\u5ea6\u7684\u5173\u7cfb\u5219\u662f\u901a\u8fc7\u81ea\u5b9a\u4e49\u7684\u6570\u636e\u5c55\u73b0\u3002
",code:"import { Component } from '@angular/core';\nimport { G2BarClickItem, G2BarData } from '@delon/chart/bar';\nimport { NzMessageService } from 'ng-zorro-antd/message';\n\n@Component({\n selector: 'chart-bar-basic',\n template: `\n \n \n `,\n})\nexport class ChartBarBasicComponent {\n constructor(private msg: NzMessageService) {}\n\n salesData = this.genData();\n\n private genData(): G2BarData[] {\n return new Array(12).fill({}).map((_i, idx) => ({\n x: `${idx + 1}\u6708`,\n y: Math.floor(Math.random() * 1000) + 200,\n color: idx > 5 ? '#f50' : undefined,\n }));\n }\n\n refresh(): void {\n this.salesData = this.genData();\n }\n\n handleClick(data: G2BarClickItem): void {\n this.msg.info(`${data.item.x} - ${data.item.y}`);\n }\n}",name:"basic",urls:"packages/chart/bar/demo/basic.md",type:"demo",lang:"ts",componentName:"ChartBarBasicComponent",point:0}]}static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["app-chart-bar"]],decls:5,vars:5,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","24"],[3,"item"]],template:function(a,o){1&a&&(t.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),t._UZ(4,"chart-bar-basic"),t.qZA()()()()),2&a&&(t.Q6J("codes",o.codes)("item",o.item),t.xp6(1),t.Q6J("nzGutter",16),t.xp6(2),t.Q6J("item",o.codes[0]),t.uIk("id",o.codes[0].id))},dependencies:[c.t3,c.SK,s.P,l.e,_],styles:["[_nghost-%COMP%]{display:block}"]})}return n})();var C=i(68636),y=i(37690),k=i(96109),M=i(90551);function xt(n,g){1&n&&t._UZ(0,"i",4)}let P=(()=>{class n{static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["chart-card-style1"]],decls:9,vars:4,consts:[["footer","\u65e5\u8bbf\u95ee\u91cf 12,423","contentHeight","46",3,"title","bordered","total","action"],["action",""],["flag","up",2,"margin","0 16px 0 8px","color","rgba(0,0,0,.85)"],["flag","down",2,"margin","0 0 0 8px","color","rgba(0,0,0,.85)"],["nz-tooltip","","nzTooltipTitle","\u6307\u6807\u8bf4\u660e","nz-icon","","nzType","info-circle"]],template:function(a,o){if(1&a&&(t.TgZ(0,"g2-card",0),t.YNc(1,xt,1,0,"ng-template",null,1,t.W1O),t._uU(3," \u5468\u540c\u6bd4 "),t.TgZ(4,"trend",2),t._uU(5,"12%"),t.qZA(),t._uU(6," \u65e5\u73af\u6bd4 "),t.TgZ(7,"trend",3),t._uU(8,"11%"),t.qZA()()),2&a){const d=t.MAs(2);t.Q6J("title","\u9500\u552e\u989d")("bordered",!0)("total","\xa5 126,560.00")("action",d)}},dependencies:[C.n,y._,m.w,k.SY,M.Ls],encapsulation:2})}return n})();function wt(n,g){1&n&&t._UZ(0,"img",3)}function _t(n,g){1&n&&t._UZ(0,"i",4)}let B=(()=>{class n{static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["chart-card-style2"]],decls:5,vars:5,consts:[["footer","\u65e5\u8bbf\u95ee\u91cf 12,423",3,"title","bordered","total","avatar","action"],["avatar",""],["action",""],["src","./assets/img/logo-color.svg",2,"width","56px","height","56px"],["nz-tooltip","","nzTooltipTitle","\u6307\u6807\u8bf4\u660e","nz-icon","","nzType","info-circle"]],template:function(a,o){if(1&a&&(t.TgZ(0,"g2-card",0),t.YNc(1,wt,1,0,"ng-template",null,1,t.W1O),t.YNc(3,_t,1,0,"ng-template",null,2,t.W1O),t.qZA()),2&a){const d=t.MAs(2),r=t.MAs(4);t.Q6J("title","\u79fb\u52a8\u6307\u6807")("bordered",!0)("total","\xa5 126,560.00")("avatar",d)("action",r)}},dependencies:[C.n,m.w,k.SY,M.Ls],encapsulation:2})}return n})();function It(n,g){1&n&&t._UZ(0,"img",3)}function Pt(n,g){1&n&&t._UZ(0,"i",4)}let S=(()=>{class n{static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["chart-card-style3"]],decls:5,vars:5,consts:[[3,"title","bordered","total","avatar","action"],["avatar",""],["action",""],["src","./assets/img/logo-color.svg",2,"width","56px","height","56px"],["nz-tooltip","","nzTooltipTitle","\u6307\u6807\u8bf4\u660e","nz-icon","","nzType","info-circle"]],template:function(a,o){if(1&a&&(t.TgZ(0,"g2-card",0),t.YNc(1,It,1,0,"ng-template",null,1,t.W1O),t.YNc(3,Pt,1,0,"ng-template",null,2,t.W1O),t.qZA()),2&a){const d=t.MAs(2),r=t.MAs(4);t.Q6J("title","\u79fb\u52a8\u6307\u6807")("bordered",!0)("total","\xa5 126,560.00")("avatar",d)("action",r)}},dependencies:[C.n,m.w,k.SY,M.Ls],encapsulation:2})}return n})(),Z=(()=>{class n{constructor(){this.item={cols:2,urls:{"zh-CN":"packages/chart/card/index.md"},content:{"zh-CN":{content:'\u56fe\u8868\u5361\u7247\uff0c\u7528\u4e8e\u5c55\u793a\u56fe\u8868\u7684\u5361\u7247\u5bb9\u5668\uff0c\u53ef\u4ee5\u65b9\u4fbf\u7684\u914d\u5408\u5176\u5b83\u56fe\u8868\u5957\u4ef6\u5c55\u793a\u4e30\u5bcc\u4fe1\u606f\u3002
',api:'API
g2-card
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [title]
\u5361\u7247\u6807\u9898 string,TemplateRef<void>
- [avatar]
\u5934\u50cf string,TemplateRef<void>
- [action]
\u5361\u7247\u64cd\u4f5c string,TemplateRef<void>
- [total]
\u6570\u636e\u603b\u91cf\uff08\u652f\u6301HTML\uff09 string
- [footer]
\u5361\u7247\u5e95\u90e8 string,TemplateRef<void>
- [contentHeight]
\u5185\u5bb9\u533a\u57df\u9ad8\u5ea6\uff08\u5355\u4f4d\uff1apx
\uff09 string
- [bordered]
\u662f\u5426\u663e\u793a\u8fb9\u6846 boolean
false
',meta:{title:"g2-card",subtitle:"\u56fe\u8868\u5361\u7247",cols:2,type:"G2",module:"import { G2CardModule } from '@delon/chart/card';"},toc:[{id:"API",title:"API",h:2,children:[{id:"g2-card",title:"g2-card",h:3}]}]}},demo:!0},this.codes=[{id:"chart-card-style1",meta:{order:0,title:{"zh-CN":"\u98ce\u683c\u4e00","en-US":"Style 1"}},summary:"\u98ce\u683c\u4e00\u7528\u6cd5\u3002
",code:'import { Component } from \'@angular/core\';\n\n@Component({\n selector: \'chart-card-style1\',\n template: `\n \n \n \n \n \u5468\u540c\u6bd4\n 12% \n \u65e5\u73af\u6bd4\n 11% \n \n `,\n})\nexport class ChartCardStyle1Component {}',name:"style1",urls:"packages/chart/card/demo/style1.md",type:"demo",lang:"ts",componentName:"ChartCardStyle1Component",point:0},{id:"chart-card-style2",meta:{order:0,title:{"zh-CN":"\u98ce\u683c\u4e8c","en-US":"Style 2"}},summary:"\u98ce\u683c\u4e8c\u7528\u6cd5\u3002
",code:'import { Component } from \'@angular/core\';\n\n@Component({\n selector: \'chart-card-style2\',\n template: `\n \n \n \n \n \n \n `,\n})\nexport class ChartCardStyle2Component {}',name:"style2",urls:"packages/chart/card/demo/style2.md",type:"demo",lang:"ts",componentName:"ChartCardStyle2Component",point:1},{id:"chart-card-style3",meta:{order:0,title:{"zh-CN":"\u98ce\u683c\u4e09","en-US":"Style 3"}},summary:"\u98ce\u683c\u4e09\u7528\u6cd5\u3002
",code:'import { Component } from \'@angular/core\';\n\n@Component({\n selector: \'chart-card-style3\',\n template: `\n \n \n \n \n \n \n `,\n})\nexport class ChartCardStyle3Component {}',name:"style3",urls:"packages/chart/card/demo/style3.md",type:"demo",lang:"ts",componentName:"ChartCardStyle3Component",point:2}]}static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["app-chart-card"]],decls:10,vars:9,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","12"],[3,"item"]],template:function(a,o){1&a&&(t.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),t._UZ(4,"chart-card-style1"),t.qZA(),t.TgZ(5,"code-box",3),t._UZ(6,"chart-card-style3"),t.qZA()(),t.TgZ(7,"div",2)(8,"code-box",3),t._UZ(9,"chart-card-style2"),t.qZA()()()()),2&a&&(t.Q6J("codes",o.codes)("item",o.item),t.xp6(1),t.Q6J("nzGutter",16),t.xp6(2),t.Q6J("item",o.codes[0]),t.uIk("id",o.codes[0].id),t.xp6(2),t.Q6J("item",o.codes[2]),t.uIk("id",o.codes[2].id),t.xp6(3),t.Q6J("item",o.codes[1]),t.uIk("id",o.codes[1].id))},dependencies:[c.t3,c.SK,s.P,l.e,P,B,S],styles:["[_nghost-%COMP%]{display:block}"]})}return n})();var N=i(60095),E=i(59951),Bt=i(96494);let F=(()=>{class n{constructor(){this.dark=!1,this.two=!1,this.option1={tooltip:{formatter:"{a}
{b} : {c}%"},series:[{name:"Pressure",type:"gauge",detail:{formatter:"{value}"},data:[{value:50,name:"SCORE"}]}]},this.option2={title:{text:"ECharts \u5165\u95e8\u793a\u4f8b"},tooltip:{},legend:{data:["\u9500\u91cf"]},xAxis:{data:["\u886c\u886b","\u7f8a\u6bdb\u886b","\u96ea\u7eba\u886b","\u88e4\u5b50","\u9ad8\u8ddf\u978b","\u889c\u5b50"]},yAxis:{},series:[{name:"\u9500\u91cf",type:"bar",data:[5,20,36,10,10,20]}]}}handleEvents(e){console.log(e)}static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["chart-chart-echarts-basic"]],decls:6,vars:3,consts:[[1,"mb-md"],[3,"ngModel","ngModelChange"],["nz-button","","nzType","primary",3,"click"],[3,"option","theme","events"]],template:function(a,o){1&a&&(t.TgZ(0,"div",0)(1,"nz-switch",1),t.NdJ("ngModelChange",function(r){return o.dark=r}),t.qZA(),t._uU(2," Dark "),t.TgZ(3,"button",2),t.NdJ("click",function(){return o.two=!o.two}),t._uU(4,"Change Option"),t.qZA()(),t.TgZ(5,"chart-echarts",3),t.NdJ("events",function(r){return o.handleEvents(r)}),t.qZA()),2&a&&(t.xp6(1),t.Q6J("ngModel",o.dark),t.xp6(4),t.Q6J("option",o.two?o.option1:o.option2)("theme",o.dark?"dark":null))},dependencies:[N.JJ,N.On,E.d,p.ix,m.w,u.dQ,Bt.i],encapsulation:2})}return n})(),U=(()=>{class n{constructor(e){this.msg=e,this.dark=!1,this.two=!1,this.on=[{eventName:"click",handler:({event:a,chart:o})=>{this.msg.info(`${a.type}: ${a.name} - ${a.value} (${o.id})`)}}],this.option={xAxis:{type:"category",data:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]},yAxis:{type:"value"},series:[{data:[150,230,224,218,135,147,260],type:"line"}]}}static#t=this.\u0275fac=function(a){return new(a||n)(t.Y36(h.dD))};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["chart-chart-echarts-on"]],decls:1,vars:2,consts:[[3,"option","on"]],template:function(a,o){1&a&&t._UZ(0,"chart-echarts",0),2&a&&t.Q6J("option",o.option)("on",o.on)},dependencies:[E.d],encapsulation:2})}return n})(),J=(()=>{class n{constructor(){this.item={cols:1,urls:{"zh-CN":"packages/chart/chart-echarts/index.md"},content:{"zh-CN":{content:'ECharts \u4e00\u4e2a\u57fa\u4e8e JavaScript \u7684\u5f00\u6e90\u53ef\u89c6\u5316\u56fe\u8868\u5e93\u3002\u4f7f\u7528\u61d2\u52a0\u8f7d ECharts \u811a\u672c\uff0c\u5f00\u7bb1\u542f\u7528\u3002
',api:'API
chart-echarts
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [width]
\u56fe\u8868\u5bbd\u5ea6 number, string
100%
[height]
\u56fe\u8868\u9ad8\u5ea6 number, string
400px
[option]
\u914d\u7f6e\u9879 ChartEChartsOption
- [theme]
\u4e3b\u9898\u914d\u7f6e string, object
- [on]
\u7b49\u540c\u4e8e ECharts on ChartEChartsOn[]
- (events)
\u4e8b\u4ef6\u56de\u8c03 EventEmitter<ChartEChartsEvent>
-
',meta:{title:"chart-echarts",subtitle:"ECharts",cols:1,type:"ECharts",module:"import { ChartEChartsModule } from '@delon/chart/chart-echarts';"},toc:[{id:"API",title:"API",h:2,children:[{id:"chart-echarts",title:"chart-echarts",h:3}]}]}},demo:!0},this.codes=[{id:"chart-chart-echarts-basic",meta:{order:0,title:{"zh-CN":"\u57fa\u672c","en-US":"Basic"}},summary:{"zh-CN":"\u6700\u7b80\u5355\u7684\u7528\u6cd5\u3002
","en-US":"Simplest of usage.
"},code:"import { Component } from '@angular/core';\nimport { ChartEChartsEvent, ChartEChartsOption } from '@delon/chart/chart-echarts';\n\n@Component({\n selector: 'chart-chart-echarts-basic',\n template: `\n \n Dark\n \n \n \n `,\n})\nexport class ChartChartEchartsBasicComponent {\n dark = false;\n two = false;\n\n option1: ChartEChartsOption = {\n tooltip: {\n formatter: '{a}
{b} : {c}%',\n },\n series: [\n {\n name: 'Pressure',\n type: 'gauge',\n detail: {\n formatter: '{value}',\n },\n data: [\n {\n value: 50,\n name: 'SCORE',\n },\n ],\n },\n ],\n };\n\n option2: ChartEChartsOption = {\n title: {\n text: 'ECharts \u5165\u95e8\u793a\u4f8b',\n },\n tooltip: {},\n legend: {\n data: ['\u9500\u91cf'],\n },\n xAxis: {\n data: ['\u886c\u886b', '\u7f8a\u6bdb\u886b', '\u96ea\u7eba\u886b', '\u88e4\u5b50', '\u9ad8\u8ddf\u978b', '\u889c\u5b50'],\n },\n yAxis: {},\n series: [\n {\n name: '\u9500\u91cf',\n type: 'bar',\n data: [5, 20, 36, 10, 10, 20],\n },\n ],\n };\n\n handleEvents(ev: ChartEChartsEvent): void {\n console.log(ev);\n }\n}",name:"basic",urls:"packages/chart/chart-echarts/demo/basic.md",type:"demo",lang:"ts",componentName:"ChartChartEchartsBasicComponent",point:0},{id:"chart-chart-echarts-on",meta:{order:0,title:{"zh-CN":"\u7ed1\u5b9a\u4e8b\u4ef6","en-US":"Bind event"}},summary:{"zh-CN":'\u4f7f\u7528 on
\u5c5e\u6027\uff0c\u7b49\u540c\u4e8e ECharts on\u3002
',"en-US":'Using the on
attribute is equivalent to ECharts on.
'},code:"import { Component } from '@angular/core';\n\nimport { ChartEChartsOn, ChartEChartsOption } from '@delon/chart/chart-echarts';\nimport { NzMessageService } from 'ng-zorro-antd/message';\n\n@Component({\n selector: 'chart-chart-echarts-on',\n template: ` `\n})\nexport class ChartChartEchartsOnComponent {\n dark = false;\n two = false;\n\n on: ChartEChartsOn[] = [\n {\n eventName: 'click',\n handler: ({ event, chart }) => {\n this.msg.info(`${event.type}: ${event.name} - ${event.value} (${chart.id})`);\n }\n }\n ];\n\n option: ChartEChartsOption = {\n xAxis: {\n type: 'category',\n data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']\n },\n yAxis: {\n type: 'value'\n },\n series: [\n {\n data: [150, 230, 224, 218, 135, 147, 260],\n type: 'line'\n }\n ]\n };\n\n constructor(private msg: NzMessageService) {}\n}",name:"on",urls:"packages/chart/chart-echarts/demo/on.md",type:"demo",lang:"ts",componentName:"ChartChartEchartsOnComponent",point:1}]}static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["app-chart-chart-echarts"]],decls:7,vars:7,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","24"],[3,"item"]],template:function(a,o){1&a&&(t.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),t._UZ(4,"chart-chart-echarts-basic"),t.qZA(),t.TgZ(5,"code-box",3),t._UZ(6,"chart-chart-echarts-on"),t.qZA()()()()),2&a&&(t.Q6J("codes",o.codes)("item",o.item),t.xp6(1),t.Q6J("nzGutter",16),t.xp6(2),t.Q6J("item",o.codes[0]),t.uIk("id",o.codes[0].id),t.xp6(2),t.Q6J("item",o.codes[1]),t.uIk("id",o.codes[1].id))},dependencies:[c.t3,c.SK,s.P,l.e,F,U],styles:["[_nghost-%COMP%]{display:block}"]})}return n})();var St=i(7802);let Q=(()=>{class n{constructor(e){this.ngZone=e}render(e){this.ngZone.runOutsideAngular(()=>this.init(e.nativeElement))}init(e){const a=[{action:"\u6d4f\u89c8\u7f51\u7ad9",pv:5e4,percent:0},{action:"\u653e\u5165\u8d2d\u7269\u8f66",pv:35e3,percent:0},{action:"\u751f\u6210\u8ba2\u5355",pv:25e3,percent:0},{action:"\u652f\u4ed8\u8ba2\u5355",pv:15e3,percent:0},{action:"\u5b8c\u6210\u4ea4\u6613",pv:8e3,percent:0}].map(d=>(d.percent=d.pv/5e4,d)),o=new window.G2.Chart({container:e,autoFit:!0,height:500,width:e.clientWidth,padding:[20,120,95]});o.data(a),o.axis(!1),o.tooltip({showTitle:!1,showMarkers:!1,itemTpl:'{name}
\u6d4f\u89c8\u4eba\u6570\uff1a{pv}
\u5360\u6bd4\uff1a{percent}
'}),o.coordinate("rect").transpose().scale(1,-1),o.interval().adjust("symmetric").position("action*percent").shape("funnel").color("action",["#0050B3","#1890FF","#40A9FF","#69C0FF","#BAE7FF"]).label("action*pv",(d,r)=>({content:`${d} ${r}`}),{offset:35,labelLine:{style:{lineWidth:1,stroke:"rgba(0, 0, 0, 0.15)"}}}).tooltip("action*pv*percent",(d,r,v)=>({name:d,percent:100*+v+"%",pv:r})).animate({appear:{animation:"fade-in"},update:{}}),o.interaction("element-active"),o.on("beforepaint",()=>{o.annotation().clear(!0),o.getData().forEach(r=>{o.annotation().text({top:!0,position:{action:r.action,percent:"median"},content:100*+r.percent+"%",style:{stroke:null,fill:"#fff",textAlign:"center"}})})}),o.render()}static#t=this.\u0275fac=function(a){return new(a||n)(t.Y36(t.R0b))};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["chart-custom-basic"]],decls:1,vars:0,consts:[["delay","100",3,"render"]],template:function(a,o){1&a&&(t.TgZ(0,"g2-custom",0),t.NdJ("render",function(r){return o.render(r)}),t.qZA())},dependencies:[St.A],encapsulation:2})}return n})(),O=(()=>{class n{constructor(){this.item={cols:1,urls:{"en-US":"packages/chart/custom/index.en-US.md","zh-CN":"packages/chart/custom/index.zh-CN.md"},content:{"en-US":{content:'Use g2-custom
component to package your G2 chart.
How to use
A simple example template:
import { Component, ElementRef } from \'@angular/core\';\n\n@Component({\n selector: \'app-demo\',\n template: `\n <g2-custom (render)="render($event)"></g2-custom>\n `,\n})\nexport class DemoComponent {\n render(el: ElementRef) {\n // Coding G2 code\n }\n}
How to develop G2
If throw error G2
not found, please refer to Frequently Asked Questions.
Links
',api:'API
g2-custom
Property Description Type Default [delay]
Delayed rendering, unit: ms number
0
[height]
Height of chart container number
- [resizeTime]
Resize event debounce time number
200
(render)
Render event EventEmitter<ElementRef>
- (resize)
Resize event EventEmitter<ElementRef>
- (destroy)
Destroy event EventEmitter<ElementRef>
- [theme]
Custom chart theme string | LooseObject
-
',meta:{title:"g2-chart",subtitle:"Custom Chart",cols:1,type:"G2",module:"import { G2CustomModule } from '@delon/chart/custom';"},toc:[{id:"Howtouse",title:"How to use",h:2,children:[{id:"HowtodevelopG2",title:"How to develop G2",h:3}]},{id:"Links",title:"Links",h:2},{id:"API",title:"API",h:2,children:[{id:"g2-custom",title:"g2-custom",h:3}]}]},"zh-CN":{content:'\u4f7f\u7528 g2-custom
\u7ec4\u4ef6\u53ef\u4ee5\u66f4\u5feb\u901f\u7684\u5c01\u88c5\u81ea\u5df1\u7684\u56fe\u8868\u7ec4\u4ef6\u3002
\u5982\u4f55\u4f7f\u7528
\u4e00\u4e2a\u7b80\u5355\u793a\u4f8b\u6a21\u677f\uff1a
import { Component, ElementRef } from \'@angular/core\';\n\n@Component({\n selector: \'app-demo\',\n template: `\n <g2-custom (render)="render($event)"></g2-custom>\n `,\n})\nexport class DemoComponent {\n render(el: ElementRef) {\n // \u5f00\u59cb\u7f16\u5199 G2 \u4ee3\u7801\n }\n}
\u5982\u4f55\u5f00\u53d1 G2
\u53ef\u80fd\u4f60\u4f1a\u9047\u5230\u672a\u627e\u5230 G2
\uff0c\u8bf7\u53c2\u8003\u5e38\u89c1\u95ee\u9898\u3002
\u94fe\u63a5
',api:'API
g2-custom
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [delay]
\u5ef6\u8fdf\u6e32\u67d3\uff0c\u5355\u4f4d\uff1a\u6beb\u79d2 number
0
[height]
\u9ad8 number
- [resizeTime]
resize \u4e8b\u4ef6\u53bb\u6296\u65f6\u957f number
200
(render)
\u6e32\u67d3\u4e8b\u4ef6 EventEmitter<ElementRef>
- (resize)
resize \u4e8b\u4ef6 EventEmitter<ElementRef>
- (destroy)
\u9500\u6bc1\u4e8b\u4ef6 EventEmitter<ElementRef>
- [theme]
\u5b9a\u5236\u56fe\u8868\u4e3b\u9898 string | LooseObject
-
',meta:{title:"g2-chart",subtitle:"\u81ea\u5b9a\u4e49\u56fe\u8868",cols:1,type:"G2",module:"import { G2CustomModule } from '@delon/chart/custom';"},toc:[{id:"\u5982\u4f55\u4f7f\u7528",title:"\u5982\u4f55\u4f7f\u7528",h:2,children:[{id:"\u5982\u4f55\u5f00\u53d1G2",title:"\u5982\u4f55\u5f00\u53d1 G2",h:3}]},{id:"\u94fe\u63a5",title:"\u94fe\u63a5",h:2},{id:"API",title:"API",h:2,children:[{id:"g2-custom",title:"g2-custom",h:3}]}]}},demo:!0},this.codes=[{id:"chart-custom-basic",meta:{order:0,title:{"zh-CN":"\u57fa\u7840","en-US":"Basic"}},summary:{"zh-CN":'\u6a21\u4eff\u81ea antv\u57fa\u7840\u6f0f\u6597\u56fe\u3002
',"en-US":'Copy Basic Funnel Chart\u3002
'},code:"import { Component, ElementRef, NgZone } from '@angular/core';\nimport type { Chart } from '@antv/g2';\n\n@Component({\n selector: 'chart-custom-basic',\n template: ` `,\n})\nexport class ChartCustomBasicComponent {\n constructor(private ngZone: NgZone) {}\n\n render(el: ElementRef): void {\n this.ngZone.runOutsideAngular(() => this.init(el.nativeElement));\n }\n\n private init(el: HTMLElement): void {\n const data: Array<{ action: string; pv: number; percent: number }> = [\n { action: '\u6d4f\u89c8\u7f51\u7ad9', pv: 50000, percent: 0 },\n { action: '\u653e\u5165\u8d2d\u7269\u8f66', pv: 35000, percent: 0 },\n { action: '\u751f\u6210\u8ba2\u5355', pv: 25000, percent: 0 },\n { action: '\u652f\u4ed8\u8ba2\u5355', pv: 15000, percent: 0 },\n { action: '\u5b8c\u6210\u4ea4\u6613', pv: 8000, percent: 0 },\n ].map(row => {\n row.percent = row.pv / 50000;\n return row;\n });\n const chart: Chart = new (window as any).G2.Chart({\n container: el,\n autoFit: true,\n height: 500,\n width: el.clientWidth,\n padding: [20, 120, 95],\n });\n chart.data(data);\n chart.axis(false);\n chart.tooltip({\n showTitle: false,\n showMarkers: false,\n itemTpl:\n '' +\n '' +\n '{name}
' +\n '\u6d4f\u89c8\u4eba\u6570\uff1a{pv}
' +\n '\u5360\u6bd4\uff1a{percent}
' +\n ' ',\n });\n\n chart.coordinate('rect').transpose().scale(1, -1);\n chart\n .interval()\n .adjust('symmetric')\n .position('action*percent')\n .shape('funnel')\n .color('action', ['#0050B3', '#1890FF', '#40A9FF', '#69C0FF', '#BAE7FF'])\n .label(\n 'action*pv',\n (action, pv) => {\n return {\n content: `${action} ${pv}`,\n };\n },\n {\n offset: 35,\n labelLine: {\n style: {\n lineWidth: 1,\n stroke: 'rgba(0, 0, 0, 0.15)',\n },\n },\n },\n )\n .tooltip('action*pv*percent', (action, pv, percent) => {\n return {\n name: action,\n percent: +percent * 100 + '%',\n pv,\n };\n })\n .animate({\n appear: {\n animation: 'fade-in',\n },\n update: {\n // annotation: 'fade-in'\n },\n });\n\n chart.interaction('element-active');\n\n chart.on('beforepaint', () => {\n chart.annotation().clear(true);\n const chartData = chart.getData();\n // \u4e2d\u95f4\u6807\u7b7e\u6587\u672c\n chartData.forEach(obj => {\n chart.annotation().text({\n top: true,\n position: {\n action: obj.action,\n percent: 'median',\n },\n content: +obj.percent * 100 + '%', // \u663e\u793a\u7684\u6587\u672c\u5185\u5bb9\n style: {\n stroke: null,\n fill: '#fff',\n textAlign: 'center',\n },\n });\n });\n });\n\n chart.render();\n }\n}",name:"basic",urls:"packages/chart/custom/demo/basic.md",type:"demo",lang:"ts",componentName:"ChartCustomBasicComponent",point:0}]}static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["app-chart-custom"]],decls:5,vars:5,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","24"],[3,"item"]],template:function(a,o){1&a&&(t.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),t._UZ(4,"chart-custom-basic"),t.qZA()()()()),2&a&&(t.Q6J("codes",o.codes)("item",o.item),t.xp6(1),t.Q6J("nzGutter",16),t.xp6(2),t.Q6J("item",o.codes[0]),t.uIk("id",o.codes[0].id))},dependencies:[c.t3,c.SK,s.P,l.e,Q],styles:["[_nghost-%COMP%]{display:block}"]})}return n})();var Zt=i(62831),Nt=i(61198);let R=(()=>{class n{constructor(e,a){this.percent=36,this.color="#2f9cff",e.isBrowser&&(this.time$=setInterval(()=>{this.percent=parseInt((100*Math.random()).toString(),10),this.color=this.percent>50?"#f50":"#2f9cff",a.detectChanges()},1e3))}ngOnDestroy(){clearInterval(this.time$)}static#t=this.\u0275fac=function(a){return new(a||n)(t.Y36(Zt.t4),t.Y36(t.sBO))};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["chart-gauge-basic"]],decls:1,vars:3,consts:[["height","164",3,"title","percent","color"]],template:function(a,o){1&a&&t._UZ(0,"g2-gauge",0),2&a&&t.Q6J("title","\u6838\u9500\u7387")("percent",o.percent)("color",o.color)},dependencies:[Nt.j],encapsulation:2,changeDetection:0})}return n})(),$=(()=>{class n{constructor(){this.item={cols:1,urls:{"zh-CN":"packages/chart/gauge/index.md"},content:{"zh-CN":{content:'\u4e00\u79cd\u8fdb\u5ea6\u5c55\u793a\u65b9\u5f0f\uff0c\u53ef\u4ee5\u66f4\u76f4\u89c2\u7684\u5c55\u793a\u5f53\u524d\u7684\u8fdb\u5c55\u60c5\u51b5\uff0c\u901a\u5e38\u4e5f\u53ef\u8868\u793a\u5360\u6bd4\u3002
',api:'API
g2-gauge
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [repaint]
\u6570\u636e\u518d\u6b21\u53d8\u66f4\u65f6\u662f\u5426\u91cd\u7ed8 boolean
true
[delay]
\u5ef6\u8fdf\u6e32\u67d3\uff0c\u5355\u4f4d\uff1a\u6beb\u79d2 number
0
[title]
\u56fe\u8868\u6807\u9898 string
- [height]
\u56fe\u8868\u9ad8\u5ea6 number
- [color]
\u56fe\u8868\u989c\u8272 string
#2F9CFF
[bgColor]
\u56fe\u8868\u80cc\u666f\u8272 string
#F0F2F5
[percent]
\u8fdb\u5ea6\u6bd4\u4f8b number
- [padding]
\u5185\u8fb9\u8ddd Array<number | string>
[10, 10, 30, 10]
[format]
\u5750\u6807\u8f74\u683c\u5f0f (text: string, item: {}, index: number) => string
- [theme]
\u5b9a\u5236\u56fe\u8868\u4e3b\u9898 string | LooseObject
- (ready)
\u5f53G2\u5b8c\u6210\u521d\u59cb\u5316\u540e\u8c03\u7528 EventEmitter<Chart>
-
',meta:{title:"g2-gauge",subtitle:"\u4eea\u8868\u76d8",cols:1,type:"G2",module:"import { G2GaugeModule } from '@delon/chart/gauge';"},toc:[{id:"API",title:"API",h:2,children:[{id:"g2-gauge",title:"g2-gauge",h:3}]}]}},demo:!0},this.codes=[{id:"chart-gauge-basic",meta:{order:0,title:{"zh-CN":"\u57fa\u7840","en-US":"Basic"}},summary:"\u57fa\u7840\u7528\u6cd5\u3002
",code:"import { Platform } from '@angular/cdk/platform';\nimport { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnDestroy } from '@angular/core';\n\nimport type { NzSafeAny } from 'ng-zorro-antd/core/types';\n\n@Component({\n selector: 'chart-gauge-basic',\n template: ` `,\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class ChartGaugeBasicComponent implements OnDestroy {\n percent = 36;\n color = '#2f9cff';\n private time$: NzSafeAny;\n\n constructor(platform: Platform, cdr: ChangeDetectorRef) {\n if (!platform.isBrowser) return;\n\n this.time$ = setInterval(() => {\n this.percent = parseInt((Math.random() * 100).toString(), 10);\n this.color = this.percent > 50 ? '#f50' : '#2f9cff';\n cdr.detectChanges();\n }, 1000);\n }\n\n ngOnDestroy(): void {\n clearInterval(this.time$);\n }\n}",name:"basic",urls:"packages/chart/gauge/demo/basic.md",type:"demo",lang:"ts",componentName:"ChartGaugeBasicComponent",point:0}]}static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["app-chart-gauge"]],decls:5,vars:5,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","24"],[3,"item"]],template:function(a,o){1&a&&(t.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),t._UZ(4,"chart-gauge-basic"),t.qZA()()()()),2&a&&(t.Q6J("codes",o.codes)("item",o.item),t.xp6(1),t.Q6J("nzGutter",16),t.xp6(2),t.Q6J("item",o.codes[0]),t.uIk("id",o.codes[0].id))},dependencies:[c.t3,c.SK,s.P,l.e,R],styles:["[_nghost-%COMP%]{display:block}"]})}return n})();var f=i(89207),T=i(91289);let j=(()=>{class n{constructor(e){this.msg=e,this.visitData=this.genData()}genData(){const e=(new Date).getTime(),a=[];for(let o=0;o<20;o+=1)a.push({x:(0,f.Z)(new Date(e+864e5*o),"yyyy-MM-dd"),y:Math.floor(100*Math.random())+10});return a}refresh(){this.visitData=this.genData()}handleClick(e){this.msg.info(`${e.item.x} - ${e.item.y}`)}static#t=this.\u0275fac=function(a){return new(a||n)(t.Y36(h.dD))};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["chart-mini-area-basic"]],decls:3,vars:1,consts:[["nz-button","","nzType","primary",3,"click"],["line","","color","#cceafe","height","45",3,"data","clickItem"]],template:function(a,o){1&a&&(t.TgZ(0,"button",0),t.NdJ("click",function(){return o.refresh()}),t._uU(1,"Refresh"),t.qZA(),t.TgZ(2,"g2-mini-area",1),t.NdJ("clickItem",function(r){return o.handleClick(r)}),t.qZA()),2&a&&(t.xp6(2),t.Q6J("data",o.visitData))},dependencies:[T.D,p.ix,m.w,u.dQ],encapsulation:2})}return n})(),q=(()=>{class n{constructor(){this.visitData=[]}ngOnInit(){const e=(new Date).getTime();for(let a=0;a<20;a+=1)this.visitData.push({x:(0,f.Z)(new Date(e+864e5*a),"yyyy-MM-dd"),y:Math.floor(100*Math.random())+10})}static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["chart-mini-area-tooltip"]],decls:1,vars:1,consts:[["line","","color","#cceafe","height","45","yTooltipSuffix","%",3,"data"]],template:function(a,o){1&a&&t._UZ(0,"g2-mini-area",0),2&a&&t.Q6J("data",o.visitData)},dependencies:[T.D],encapsulation:2})}return n})(),L=(()=>{class n{constructor(){this.visitData=[]}ngOnInit(){const e=(new Date).getTime();for(let a=0;a<20;a+=1)this.visitData.push({x:(0,f.Z)(new Date(e+864e5*a),"yyyy-MM-dd"),y:Math.floor(100*Math.random())+10})}static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["chart-mini-area-mini"]],decls:1,vars:1,consts:[["line","","color","#cceafe","height","45","tooltipType","mini",3,"data"]],template:function(a,o){1&a&&t._UZ(0,"g2-mini-area",0),2&a&&t.Q6J("data",o.visitData)},dependencies:[T.D],encapsulation:2})}return n})(),X=(()=>{class n{constructor(){this.item={cols:2,urls:{"zh-CN":"packages/chart/mini-area/index.md"},content:{"zh-CN":{content:'\u9762\u79ef\u56fe\u53c8\u53eb\u533a\u57df\u56fe\u3002 \u5b83\u662f\u5728\u6298\u7ebf\u56fe\u7684\u57fa\u7840\u4e4b\u4e0a\u5f62\u6210\u7684, \u5b83\u5c06\u6298\u7ebf\u56fe\u4e2d\u6298\u7ebf\u4e0e\u81ea\u53d8\u91cf\u5750\u6807\u8f74\u4e4b\u95f4\u7684\u533a\u57df\u4f7f\u7528\u989c\u8272\u6216\u8005\u7eb9\u7406\u586b\u5145\uff0c\u8fd9\u6837\u4e00\u4e2a\u586b\u5145\u533a\u57df\u6211\u4eec\u53eb\u505a\u9762\u79ef\uff0c\u989c\u8272\u7684\u586b\u5145\u53ef\u4ee5\u66f4\u597d\u7684\u7a81\u51fa\u8d8b\u52bf\u4fe1\u606f\u3002
',api:'API
g2-mini-area
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [repaint]
\u6570\u636e\u518d\u6b21\u53d8\u66f4\u65f6\u662f\u5426\u91cd\u7ed8 boolean
true
[delay]
\u5ef6\u8fdf\u6e32\u67d3\uff0c\u5355\u4f4d\uff1a\u6beb\u79d2 number
0
[color]
\u56fe\u8868\u989c\u8272 string
rgba(24, 144, 255, 0.2)
[borderColor]
\u56fe\u8868\u8fb9\u989c\u8272 string
#1890FF
[height]
\u56fe\u8868\u9ad8\u5ea6 number
56
[line]
\u662f\u5426\u663e\u793a\u63cf\u8fb9 boolean
false
[animate]
\u662f\u5426\u663e\u793a\u52a8\u753b boolean
true
[padding]
\u56fe\u8868\u5185\u90e8\u95f4\u8ddd array
[8, 8, 8, 8]
[xAxis]
x \u8f74\u914d\u7f6e object
- [yAxis]
y \u8f74\u914d\u7f6e object
- [yTooltipSuffix]
y \u8f74Tooltip\u540e\u7f00\uff0c\u4e00\u822c\u6307\u5b9a\u5355\u4f4d string
- [tooltipType]
Tooltip\u663e\u793a\u7c7b\u578b \'mini\',\'default\'
\'default\'
[data]
\u6570\u636e G2MiniAreaData[]
- [theme]
\u5b9a\u5236\u56fe\u8868\u4e3b\u9898 string | LooseObject
- (clickItem)
\u70b9\u51fb\u9879\u56de\u8c03 EventEmitter<G2MiniAreaClickItem>
- (ready)
\u5f53G2\u5b8c\u6210\u521d\u59cb\u5316\u540e\u8c03\u7528 EventEmitter<Chart>
-
G2MiniAreaData
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [x]
x\u8f74 any
- [y]
y\u8f74 any
-
',meta:{title:"g2-mini-area",subtitle:"\u8ff7\u4f60\u533a\u57df\u56fe",cols:2,type:"G2",module:"import { G2MiniAreaModule } from '@delon/chart/mini-area';"},toc:[{id:"API",title:"API",h:2,children:[{id:"g2-mini-area",title:"g2-mini-area",h:3},{id:"G2MiniAreaData",title:"G2MiniAreaData",h:3}]}]}},demo:!0},this.codes=[{id:"chart-mini-area-basic",meta:{order:0,title:{"zh-CN":"\u57fa\u7840","en-US":"Basic"}},summary:"\u57fa\u7840\u7528\u6cd5\u3002
",code:"import { Component } from '@angular/core';\nimport { G2MiniAreaClickItem, G2MiniAreaData } from '@delon/chart/mini-area';\nimport { format } from 'date-fns';\nimport { NzMessageService } from 'ng-zorro-antd/message';\n\n@Component({\n selector: 'chart-mini-area-basic',\n template: `\n \n \n `,\n})\nexport class ChartMiniAreaBasicComponent {\n visitData = this.genData();\n\n constructor(private msg: NzMessageService) {}\n\n private genData(): G2MiniAreaData[] {\n const beginDay = new Date().getTime();\n const res: G2MiniAreaData[] = [];\n for (let i = 0; i < 20; i += 1) {\n res.push({\n x: format(new Date(beginDay + 1000 * 60 * 60 * 24 * i), 'yyyy-MM-dd'),\n y: Math.floor(Math.random() * 100) + 10,\n });\n }\n return res;\n }\n\n refresh(): void {\n this.visitData = this.genData();\n }\n\n handleClick(data: G2MiniAreaClickItem): void {\n this.msg.info(`${data.item.x} - ${data.item.y}`);\n }\n}",name:"basic",urls:"packages/chart/mini-area/demo/basic.md",type:"demo",lang:"ts",componentName:"ChartMiniAreaBasicComponent",point:0},{id:"chart-mini-area-tooltip",meta:{order:1,title:"Tooltip"},summary:"\u6307\u5b9a yTooltipSuffix
\u503c\u6765\u8868\u793a\u5355\u4f4d\u3002
",code:"import { Component, OnInit } from '@angular/core';\nimport { G2MiniAreaData } from '@delon/chart/mini-area';\nimport { format } from 'date-fns';\n\n@Component({\n selector: 'chart-mini-area-tooltip',\n template: ` `,\n})\nexport class ChartMiniAreaTooltipComponent implements OnInit {\n visitData: G2MiniAreaData[] = [];\n ngOnInit(): void {\n const beginDay = new Date().getTime();\n for (let i = 0; i < 20; i += 1) {\n this.visitData.push({\n x: format(new Date(beginDay + 1000 * 60 * 60 * 24 * i), 'yyyy-MM-dd'),\n y: Math.floor(Math.random() * 100) + 10,\n });\n }\n }\n}",name:"tooltip",urls:"packages/chart/mini-area/demo/tooltip.md",type:"demo",lang:"ts",componentName:"ChartMiniAreaTooltipComponent",point:1},{id:"chart-mini-area-mini",meta:{order:2,title:"Mini tooltip"},summary:"\u6307\u5b9a tooltipType
\u503c\u6765\u8868\u793a\u7b80\u5316tooltip\uff0c\u53ef\u4ee5\u66f4\u597d\u7684\u8fd0\u7528\u4e8e\u8868\u683c\u3002
",code:"import { Component, OnInit } from '@angular/core';\nimport { G2MiniAreaData } from '@delon/chart/mini-area';\nimport { format } from 'date-fns';\n\n@Component({\n selector: 'chart-mini-area-mini',\n template: ` `,\n})\nexport class ChartMiniAreaMiniComponent implements OnInit {\n visitData: G2MiniAreaData[] = [];\n ngOnInit(): void {\n const beginDay = new Date().getTime();\n for (let i = 0; i < 20; i += 1) {\n this.visitData.push({\n x: format(new Date(beginDay + 1000 * 60 * 60 * 24 * i), 'yyyy-MM-dd'),\n y: Math.floor(Math.random() * 100) + 10,\n });\n }\n }\n}",name:"mini",urls:"packages/chart/mini-area/demo/mini.md",type:"demo",lang:"ts",componentName:"ChartMiniAreaMiniComponent",point:2}]}static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["app-chart-mini-area"]],decls:10,vars:9,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","12"],[3,"item"]],template:function(a,o){1&a&&(t.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),t._UZ(4,"chart-mini-area-basic"),t.qZA(),t.TgZ(5,"code-box",3),t._UZ(6,"chart-mini-area-mini"),t.qZA()(),t.TgZ(7,"div",2)(8,"code-box",3),t._UZ(9,"chart-mini-area-tooltip"),t.qZA()()()()),2&a&&(t.Q6J("codes",o.codes)("item",o.item),t.xp6(1),t.Q6J("nzGutter",16),t.xp6(2),t.Q6J("item",o.codes[0]),t.uIk("id",o.codes[0].id),t.xp6(2),t.Q6J("item",o.codes[2]),t.uIk("id",o.codes[2].id),t.xp6(3),t.Q6J("item",o.codes[1]),t.uIk("id",o.codes[1].id))},dependencies:[c.t3,c.SK,s.P,l.e,j,q,L],styles:["[_nghost-%COMP%]{display:block}"]})}return n})();var D=i(77322);let W=(()=>{class n{constructor(e){this.msg=e,this.visitData=this.genData()}genData(){const e=(new Date).getTime(),a=[];for(let o=0;o<20;o+=1)a.push({x:(0,f.Z)(new Date(e+864e5*o),"yyyy-MM-dd"),y:Math.floor(100*Math.random())+10});return a}refresh(){this.visitData=this.genData()}handleClick(e){this.msg.info(`${e.item.x} - ${e.item.y}`)}static#t=this.\u0275fac=function(a){return new(a||n)(t.Y36(h.dD))};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["chart-mini-bar-basic"]],decls:3,vars:1,consts:[["nz-button","","nzType","primary",3,"click"],["height","45",3,"data","clickItem"]],template:function(a,o){1&a&&(t.TgZ(0,"button",0),t.NdJ("click",function(){return o.refresh()}),t._uU(1,"Refresh"),t.qZA(),t.TgZ(2,"g2-mini-bar",1),t.NdJ("clickItem",function(r){return o.handleClick(r)}),t.qZA()),2&a&&(t.xp6(2),t.Q6J("data",o.visitData))},dependencies:[D.N,p.ix,m.w,u.dQ],encapsulation:2})}return n})(),H=(()=>{class n{constructor(){this.visitData=[]}ngOnInit(){const e=(new Date).getTime();for(let a=0;a<20;a+=1)this.visitData.push({x:(0,f.Z)(new Date(e+864e5*a),"yyyy-MM-dd"),y:Math.floor(100*Math.random())+10})}static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["chart-mini-bar-mini"]],decls:1,vars:1,consts:[["height","45","yTooltipSuffix","%","tooltipType","mini",3,"data"]],template:function(a,o){1&a&&t._UZ(0,"g2-mini-bar",0),2&a&&t.Q6J("data",o.visitData)},dependencies:[D.N],encapsulation:2})}return n})(),Y=(()=>{class n{constructor(){this.visitData=[]}ngOnInit(){const e=(new Date).getTime();for(let a=0;a<20;a+=1)this.visitData.push({x:(0,f.Z)(new Date(e+864e5*a),"yyyy-MM-dd"),y:Math.floor(100*Math.random())+10})}static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["chart-mini-bar-tooltip"]],decls:1,vars:1,consts:[["height","45","yTooltipSuffix","%",3,"data"]],template:function(a,o){1&a&&t._UZ(0,"g2-mini-bar",0),2&a&&t.Q6J("data",o.visitData)},dependencies:[D.N],encapsulation:2})}return n})(),V=(()=>{class n{constructor(){this.item={cols:2,urls:{"zh-CN":"packages/chart/mini-bar/index.md"},content:{"zh-CN":{content:'\u8ff7\u4f60\u67f1\u72b6\u56fe\u66f4\u9002\u5408\u5c55\u793a\u7b80\u5355\u7684\u533a\u95f4\u6570\u636e\uff0c\u7b80\u6d01\u7684\u8868\u73b0\u65b9\u5f0f\u53ef\u4ee5\u5f88\u597d\u7684\u51cf\u5c11\u5927\u6570\u636e\u91cf\u7684\u89c6\u89c9\u5c55\u73b0\u538b\u529b\u3002
',api:'API
g2-mini-bar
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [repaint]
\u6570\u636e\u518d\u6b21\u53d8\u66f4\u65f6\u662f\u5426\u91cd\u7ed8 boolean
true
[delay]
\u5ef6\u8fdf\u6e32\u67d3\uff0c\u5355\u4f4d\uff1a\u6beb\u79d2 number
0
[color]
\u56fe\u8868\u989c\u8272 string
#1890FF
[height]
\u56fe\u8868\u9ad8\u5ea6 number
- [yTooltipSuffix]
y \u8f74Tooltip\u540e\u7f00\uff0c\u4e00\u822c\u6307\u5b9a\u5355\u4f4d string
- [tooltipType]
Tooltip\u663e\u793a\u7c7b\u578b \'mini\',\'default\'
\'default\'
[borderWidth]
\u7ebf\u6761\u7c97\u7ec6 number
5
[padding]
\u56fe\u8868\u5185\u90e8\u95f4\u8ddd array
[8, 8, 8, 8]
[data]
\u6570\u636e G2MiniBarData[]
- [theme]
\u5b9a\u5236\u56fe\u8868\u4e3b\u9898 string | LooseObject
- (clickItem)
\u70b9\u51fb\u9879\u56de\u8c03 EventEmitter<G2MiniBarClickItem>
- (ready)
\u5f53G2\u5b8c\u6210\u521d\u59cb\u5316\u540e\u8c03\u7528 EventEmitter<Chart>
-
G2MiniBarData
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [x]
x\u8f74 any
- [y]
y\u8f74 any
- [color]
\u8f74\u989c\u8272 string
-
',meta:{title:"g2-mini-bar",subtitle:"\u8ff7\u4f60\u67f1\u72b6\u56fe",cols:2,type:"G2",module:"import { G2MiniBarModule } from '@delon/chart/mini-bar';"},toc:[{id:"API",title:"API",h:2,children:[{id:"g2-mini-bar",title:"g2-mini-bar",h:3},{id:"G2MiniBarData",title:"G2MiniBarData",h:3}]}]}},demo:!0},this.codes=[{id:"chart-mini-bar-basic",meta:{order:0,title:{"zh-CN":"\u57fa\u7840","en-US":"Basic"}},summary:"\u57fa\u7840\u7528\u6cd5\u3002
",code:"import { Component } from '@angular/core';\nimport { G2MiniAreaClickItem, G2MiniAreaData } from '@delon/chart/mini-area';\nimport { format } from 'date-fns';\nimport { NzMessageService } from 'ng-zorro-antd/message';\n\n@Component({\n selector: 'chart-mini-bar-basic',\n template: `\n \n \n `,\n})\nexport class ChartMiniBarBasicComponent {\n visitData = this.genData();\n\n constructor(private msg: NzMessageService) {}\n\n private genData(): G2MiniAreaData[] {\n const beginDay = new Date().getTime();\n const res: G2MiniAreaData[] = [];\n for (let i = 0; i < 20; i += 1) {\n res.push({\n x: format(new Date(beginDay + 1000 * 60 * 60 * 24 * i), 'yyyy-MM-dd'),\n y: Math.floor(Math.random() * 100) + 10,\n });\n }\n return res;\n }\n\n refresh(): void {\n this.visitData = this.genData();\n }\n\n handleClick(data: G2MiniAreaClickItem): void {\n this.msg.info(`${data.item.x} - ${data.item.y}`);\n }\n}",name:"basic",urls:"packages/chart/mini-bar/demo/basic.md",type:"demo",lang:"ts",componentName:"ChartMiniBarBasicComponent",point:0},{id:"chart-mini-bar-mini",meta:{order:0,title:"Mini tooltip"},summary:"\u6307\u5b9a tooltipType
\u503c\u6765\u8868\u793a\u7b80\u5316tooltip\uff0c\u53ef\u4ee5\u66f4\u597d\u7684\u8fd0\u7528\u4e8e\u8868\u683c\u3002
",code:"import { Component, OnInit } from '@angular/core';\nimport { G2MiniBarData } from '@delon/chart/mini-bar';\nimport { format } from 'date-fns';\n\n@Component({\n selector: 'chart-mini-bar-mini',\n template: ` `,\n})\nexport class ChartMiniBarMiniComponent implements OnInit {\n visitData: G2MiniBarData[] = [];\n ngOnInit(): void {\n const beginDay = new Date().getTime();\n for (let i = 0; i < 20; i += 1) {\n this.visitData.push({\n x: format(new Date(beginDay + 1000 * 60 * 60 * 24 * i), 'yyyy-MM-dd'),\n y: Math.floor(Math.random() * 100) + 10,\n });\n }\n }\n}",name:"mini",urls:"packages/chart/mini-bar/demo/mini.md",type:"demo",lang:"ts",componentName:"ChartMiniBarMiniComponent",point:1},{id:"chart-mini-bar-tooltip",meta:{order:0,title:"Tooltip"},summary:"\u6307\u5b9a yTooltipSuffix
\u503c\u6765\u8868\u793a\u5355\u4f4d\u3002
",code:"import { Component, OnInit } from '@angular/core';\nimport { G2MiniBarData } from '@delon/chart/mini-bar';\nimport { format } from 'date-fns';\n\n@Component({\n selector: 'chart-mini-bar-tooltip',\n template: ` `,\n})\nexport class ChartMiniBarTooltipComponent implements OnInit {\n visitData: G2MiniBarData[] = [];\n ngOnInit(): void {\n const beginDay = new Date().getTime();\n for (let i = 0; i < 20; i += 1) {\n this.visitData.push({\n x: format(new Date(beginDay + 1000 * 60 * 60 * 24 * i), 'yyyy-MM-dd'),\n y: Math.floor(Math.random() * 100) + 10,\n });\n }\n }\n}",name:"tooltip",urls:"packages/chart/mini-bar/demo/tooltip.md",type:"demo",lang:"ts",componentName:"ChartMiniBarTooltipComponent",point:2}]}static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["app-chart-mini-bar"]],decls:10,vars:9,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","12"],[3,"item"]],template:function(a,o){1&a&&(t.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),t._UZ(4,"chart-mini-bar-basic"),t.qZA(),t.TgZ(5,"code-box",3),t._UZ(6,"chart-mini-bar-tooltip"),t.qZA()(),t.TgZ(7,"div",2)(8,"code-box",3),t._UZ(9,"chart-mini-bar-mini"),t.qZA()()()()),2&a&&(t.Q6J("codes",o.codes)("item",o.item),t.xp6(1),t.Q6J("nzGutter",16),t.xp6(2),t.Q6J("item",o.codes[0]),t.uIk("id",o.codes[0].id),t.xp6(2),t.Q6J("item",o.codes[2]),t.uIk("id",o.codes[2].id),t.xp6(3),t.Q6J("item",o.codes[1]),t.uIk("id",o.codes[1].id))},dependencies:[c.t3,c.SK,s.P,l.e,W,H,Y],styles:["[_nghost-%COMP%]{display:block}"]})}return n})();var Et=i(9730);let K=(()=>{class n{static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["chart-mini-progress-basic"]],decls:1,vars:0,consts:[["percent","78","strokeWidth","8","target","80"]],template:function(a,o){1&a&&t._UZ(0,"g2-mini-progress",0)},dependencies:[Et.c],encapsulation:2})}return n})(),tt=(()=>{class n{constructor(){this.item={cols:1,urls:{"zh-CN":"packages/chart/mini-progress/index.md"},content:{"zh-CN":{content:'\u7528\u4e8e\u663e\u793a\u8ddf\u901f\u5ea6\u76f8\u5173\u56fe\u5f62\u518d\u9002\u5408\u4e0d\u8fc7\u3002
',api:'API
g2-mini-progress
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [target]
\u76ee\u6807\u6bd4\u4f8b number
- [color]
\u8fdb\u5ea6\u6761\u989c\u8272 string
- [strokeWidth]
\u8fdb\u5ea6\u6761\u9ad8\u5ea6 number
- [percent]
\u8fdb\u5ea6\u6bd4\u4f8b number
-
',meta:{title:"g2-mini-progress",subtitle:"\u8ff7\u4f60\u8fdb\u5ea6\u6761",cols:1,type:"G2",module:"import { G2MiniProgressModule } from '@delon/chart/mini-progress';"},toc:[{id:"API",title:"API",h:2,children:[{id:"g2-mini-progress",title:"g2-mini-progress",h:3}]}]}},demo:!0},this.codes=[{id:"chart-mini-progress-basic",meta:{order:0,title:{"zh-CN":"\u57fa\u7840","en-US":"Basic"}},summary:"\u57fa\u7840\u7528\u6cd5\u3002
",code:'import { Component } from \'@angular/core\';\n\n@Component({\n selector: \'chart-mini-progress-basic\',\n template: ` `,\n})\nexport class ChartMiniProgressBasicComponent {}',name:"basic",urls:"packages/chart/mini-progress/demo/basic.md",type:"demo",lang:"ts",componentName:"ChartMiniProgressBasicComponent",point:0}]}static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["app-chart-mini-progress"]],decls:5,vars:5,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","24"],[3,"item"]],template:function(a,o){1&a&&(t.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),t._UZ(4,"chart-mini-progress-basic"),t.qZA()()()()),2&a&&(t.Q6J("codes",o.codes)("item",o.item),t.xp6(1),t.Q6J("nzGutter",16),t.xp6(2),t.Q6J("item",o.codes[0]),t.uIk("id",o.codes[0].id))},dependencies:[c.t3,c.SK,s.P,l.e,K],styles:["[_nghost-%COMP%]{display:block}"]})}return n})();var z=i(84420);let et=(()=>{class n{static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["chart-number-info-basic"]],decls:1,vars:0,consts:[["subTitle","\u672c\u5468\u8bbf\u95ee","total","12,321","subTotal","17.1","status","up"]],template:function(a,o){1&a&&t._UZ(0,"number-info",0)},dependencies:[z.i],encapsulation:2})}return n})(),at=(()=>{class n{static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["chart-number-info-theme"]],decls:1,vars:0,consts:[["subTitle","\u672c\u5468\u8bbf\u95ee","total","12,321","subTotal","17.1","status","down","theme","default"]],template:function(a,o){1&a&&t._UZ(0,"number-info",0)},dependencies:[z.i],encapsulation:2})}return n})(),nt=(()=>{class n{static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["chart-number-info-multiple"]],decls:3,vars:0,consts:[["subTitle","\u4eca\u65e5\u8bbf\u95ee","total","12,321"],["subTitle","\u672c\u5468\u8bbf\u95ee","total","12,32100"],["subTitle","\u672c\u6708\u8bbf\u95ee","total","12,32100000"]],template:function(a,o){1&a&&t._UZ(0,"number-info",0)(1,"number-info",1)(2,"number-info",2)},dependencies:[z.i],encapsulation:2})}return n})(),ot=(()=>{class n{constructor(){this.item={cols:2,urls:{"en-US":"packages/chart/number-info/index.en-US.md","zh-CN":"packages/chart/number-info/index.zh-CN.md"},content:{"en-US":{content:'Often used in data cards for highlighting the business data.
',api:'API
number-info
Property Description Type Default [title]
title TemplateRef<void>
- [subTitle]
subtitle TemplateRef<void>
- [total]
total amount string, number
- [suffix]
total amount suffix string
- [subTotal]
total amount of additional information string, number
- [status]
increase state \'up\',\'down\'
- [theme]
state style \'light\',\'default\'
\'light\'
[gap]
set the spacing (pixels) between numbers and descriptions number
8
',meta:{type:"G2",title:"number-info",subtitle:"NumberInfo",cols:2,module:"import { NumberInfoModule } from '@delon/chart/number-info';"},toc:[{id:"API",title:"API",h:2,children:[{id:"number-info",title:"number-info",h:3}]}]},"zh-CN":{content:'\u5e38\u7528\u5728\u6570\u636e\u5361\u7247\u4e2d\uff0c\u7528\u4e8e\u7a81\u51fa\u5c55\u793a\u67d0\u4e2a\u4e1a\u52a1\u6570\u636e\u3002
',api:'API
number-info
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [title]
\u6807\u9898 TemplateRef<void>
- [subTitle]
\u5b50\u6807\u9898 TemplateRef<void>
- [total]
\u603b\u91cf string, number
- [suffix]
\u603b\u91cf\u540e\u7f00 string
- [subTotal]
\u5b50\u603b\u91cf string, number
- [status]
\u589e\u52a0\u72b6\u6001 \'up\',\'down\'
- [theme]
\u72b6\u6001\u6837\u5f0f \'light\',\'default\'
\'light\'
[gap]
\u8bbe\u7f6e\u6570\u5b57\u548c\u63cf\u8ff0\u76f4\u63a5\u7684\u95f4\u8ddd\uff08\u50cf\u7d20\uff09 number
8
',meta:{type:"G2",title:"number-info",subtitle:"\u6570\u636e\u6587\u672c",cols:2,module:"import { NumberInfoModule } from '@delon/chart/number-info';"},toc:[{id:"API",title:"API",h:2,children:[{id:"number-info",title:"number-info",h:3}]}]}},demo:!0},this.codes=[{id:"chart-number-info-basic",meta:{order:0,title:{"zh-CN":"\u57fa\u672c","en-US":"Basic"}},summary:"\u5404\u79cd\u6570\u636e\u6587\u6848\u7684\u5c55\u73b0\u65b9\u5f0f\u3002
",code:'import { Component } from \'@angular/core\';\n\n@Component({\n selector: \'chart-number-info-basic\',\n template: ` `,\n})\nexport class ChartNumberInfoBasicComponent {}',name:"basic",urls:"packages/chart/number-info/demo/basic.md",type:"demo",lang:"ts",componentName:"ChartNumberInfoBasicComponent",point:0},{id:"chart-number-info-theme",meta:{order:1,title:"\u4e3b\u9898"},summary:"\u6697\u7cfb\u3002
",code:'import { Component } from \'@angular/core\';\n\n@Component({\n selector: \'chart-number-info-theme\',\n template: ` `,\n})\nexport class ChartNumberInfoThemeComponent {}',name:"theme",urls:"packages/chart/number-info/demo/theme.md",type:"demo",lang:"ts",componentName:"ChartNumberInfoThemeComponent",point:1},{id:"chart-number-info-multiple",meta:{order:2,title:{"zh-CN":"\u591a\u5217","en-US":"Multiple"}},summary:{"zh-CN":"\u591a\u4e2anumber-info
\u7ec4\u4ef6\u5728\u4e00\u8d77\u65f6\u589e\u52a0\u5206\u9694\u7b26\u3002
","en-US":"Should be show a separator when multiple number-info
components.
"},code:'import { Component } from \'@angular/core\';\n\n@Component({\n selector: \'chart-number-info-multiple\',\n template: `\n \n \n \n `,\n})\nexport class ChartNumberInfoMultipleComponent {}',name:"multiple",urls:"packages/chart/number-info/demo/multiple.md",type:"demo",lang:"ts",componentName:"ChartNumberInfoMultipleComponent",point:2}]}static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["app-chart-number-info"]],decls:10,vars:9,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","12"],[3,"item"]],template:function(a,o){1&a&&(t.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),t._UZ(4,"chart-number-info-basic"),t.qZA(),t.TgZ(5,"code-box",3),t._UZ(6,"chart-number-info-multiple"),t.qZA()(),t.TgZ(7,"div",2)(8,"code-box",3),t._UZ(9,"chart-number-info-theme"),t.qZA()()()()),2&a&&(t.Q6J("codes",o.codes)("item",o.item),t.xp6(1),t.Q6J("nzGutter",16),t.xp6(2),t.Q6J("item",o.codes[0]),t.uIk("id",o.codes[0].id),t.xp6(2),t.Q6J("item",o.codes[2]),t.uIk("id",o.codes[2].id),t.xp6(3),t.Q6J("item",o.codes[1]),t.uIk("id",o.codes[1].id))},dependencies:[c.t3,c.SK,s.P,l.e,et,at,nt],styles:["[_nghost-%COMP%]{display:block}"]})}return n})();var dt=i(22595);const Ft=["pie"];let rt=(()=>{class n{constructor(e){this.msg=e,this.salesPieData=[],this.total="",this.refresh()}refresh(){const e=(a=0,o=5e3)=>Math.floor(Math.random()*(o-a+1)+a);this.salesPieData=[{x:"\u5bb6\u7528\u7535\u5668",y:e()},{x:"\u98df\u7528\u9152\u6c34",y:e()},{x:"\u4e2a\u62a4\u5065\u5eb7",y:e()},{x:"\u670d\u9970\u7bb1\u5305",y:e()},{x:"\u6bcd\u5a74\u4ea7\u54c1",y:e()}],Math.random()>.5&&this.salesPieData.push({x:"\u5176\u4ed6",y:e()}),this.total=`¥ ${this.salesPieData.reduce((a,o)=>o.y+a,0).toFixed(2)}`,this.pie&&setTimeout(()=>this.pie.changeData())}format(e){return`¥ ${e.toFixed(2)}`}handleClick(e){this.msg.info(`${e.item.x} - ${e.item.y}`)}static#t=this.\u0275fac=function(a){return new(a||n)(t.Y36(h.dD))};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["chart-pie-basic"]],viewQuery:function(a,o){if(1&a&&t.Gf(Ft,5),2&a){let d;t.iGM(d=t.CRH())&&(o.pie=d.first)}},decls:4,vars:4,consts:[["nz-button","","nzType","primary",3,"click"],["title","\u9500\u552e\u989d","subTitle","\u9500\u552e\u989d","height","294","repaint","false",3,"hasLegend","total","valueFormat","data","clickItem"],["pie",""]],template:function(a,o){1&a&&(t.TgZ(0,"button",0),t.NdJ("click",function(){return o.refresh()}),t._uU(1,"Refresh"),t.qZA(),t.TgZ(2,"g2-pie",1,2),t.NdJ("clickItem",function(r){return o.handleClick(r)}),t.qZA()),2&a&&(t.xp6(2),t.Q6J("hasLegend",!0)("total",o.total)("valueFormat",o.format)("data",o.salesPieData))},dependencies:[dt.J,p.ix,m.w,u.dQ],encapsulation:2})}return n})(),it=(()=>{class n{static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["chart-pie-mini"]],decls:2,vars:0,consts:[[2,"width","200px","display","inline-block"],["percent","28","subTitle","\u4e2d\u5f0f\u5feb\u9910","total","28%","height","130"]],template:function(a,o){1&a&&(t.TgZ(0,"div",0),t._UZ(1,"g2-pie",1),t.qZA())},dependencies:[dt.J],encapsulation:2})}return n})(),ct=(()=>{class n{constructor(){this.item={cols:1,urls:{"zh-CN":"packages/chart/pie/index.md"},content:{"zh-CN":{content:'\u7528\u4e8e\u663e\u793a\u8ddf\u901f\u5ea6\u76f8\u5173\u56fe\u5f62\u518d\u9002\u5408\u4e0d\u8fc7\u3002
',api:'API
g2-pie
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [repaint]
\u6570\u636e\u518d\u6b21\u53d8\u66f4\u65f6\u662f\u5426\u91cd\u7ed8 boolean
true
[delay]
\u5ef6\u8fdf\u6e32\u67d3\uff0c\u5355\u4f4d\uff1a\u6beb\u79d2 number
0
[animate]
\u662f\u5426\u663e\u793a\u52a8\u753b boolean
true
[color]
\u56fe\u8868\u989c\u8272 string
rgba(24, 144, 255, 0.85)
[height]
\u56fe\u8868\u9ad8\u5ea6 number
- [hasLegend]
\u662f\u5426\u663e\u793a legend boolean
false
[padding]
\u56fe\u8868\u5185\u90e8\u95f4\u8ddd number[]
[12, 0, 12, 0]
[percent]
\u5360\u6bd4 number
- [lineWidth]
\u8fb9\u6846\u7c97\u7ec6 number
0
[inner]
\u5185\u90e8\u6781\u5750\u6807\u7cfb\u7684\u534a\u5f84 number
0.75
[blockMaxWidth]
\u591a\u5c11\u5bbd\u5ea6\u4e3a\u5757\u663e\u793a number
380
[tooltip]
\u662f\u5426\u663e\u793a tooltip boolean
true
[subTitle]
\u56fe\u8868\u5b50\u6807\u9898 string,TemplateRef<void>
- [total]
\u603b\u91cf string,number,TemplateRef<void>
- [valueFormat]
y\u8f74\u683c\u5f0f\u5316 (y: number) => string
- [data]
\u6570\u636e G2PieData[]
- [colors]
\u989c\u8272\u5217\u8868 string[]
- [interaction]
\u4ea4\u4e92\u7c7b\u578b\uff0cnone \u65e0 element-active \u56fe\u5f62\u5143\u7d20\uff0cactive-region \u56fe\u8868\u7ec4\u4ef6\uff0cbrush \u6846\u9009\uff0cdrag-move \u79fb\u52a8 InteractionType
none
[ratio]
\u767e\u5206\u6bd4\u914d\u7f6e\u9879 G2PieRatio
{ text: \'\u5360\u6bd4\', inverse: \'\u53cd\u6bd4\', color: \'\', inverseColor: \'#F0F2F5\' }
[theme]
\u5b9a\u5236\u56fe\u8868\u4e3b\u9898 string | LooseObject
- (clickItem)
\u70b9\u51fb\u9879\u56de\u8c03 EventEmitter<G2PieClickItem>
- (ready)
\u5f53G2\u5b8c\u6210\u521d\u59cb\u5316\u540e\u8c03\u7528 EventEmitter<Chart>
-
G2PieData
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [x]
x\u8f74 any
- [y]
y\u8f74 number
-
',meta:{title:"g2-pie",subtitle:"\u997c\u72b6\u56fe",cols:1,type:"G2",module:"import { G2PieModule } from '@delon/chart/pie';"},toc:[{id:"API",title:"API",h:2,children:[{id:"g2-pie",title:"g2-pie",h:3},{id:"G2PieData",title:"G2PieData",h:3}]}]}},demo:!0},this.codes=[{id:"chart-pie-basic",meta:{order:0,title:{"zh-CN":"\u57fa\u7840","en-US":"Basic"}},summary:"\u57fa\u7840\u7528\u6cd5\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4e1d\u6ed1\u66f4\u65b0\u6570\u636e\u7684\u5224\u65ad\u6807\u51c6\u662f\u4ee5\u53ea\u66f4\u65b0 data
\u4e3a\u51c6\uff0c\u8fd9\u91cc\u5229\u7528 repaint
\u8fdb\u884c\u624b\u52a8\u8c03\u7528 changeData
\u6539\u53d8\u6570\u636e\u8fbe\u5230\u4e1d\u6ed1\u66f4\u65b0\u7684\u6548\u679c\u3002
",code:"import { Component, ViewChild } from '@angular/core';\nimport { G2PieClickItem, G2PieComponent, G2PieData } from '@delon/chart/pie';\nimport { NzMessageService } from 'ng-zorro-antd/message';\n\n@Component({\n selector: 'chart-pie-basic',\n template: `\n \n \n `,\n})\nexport class ChartPieBasicComponent {\n @ViewChild('pie', { static: false }) readonly pie!: G2PieComponent;\n salesPieData: G2PieData[] = [];\n total = '';\n\n constructor(private msg: NzMessageService) {\n this.refresh();\n }\n\n refresh(): void {\n const rv = (min: number = 0, max: number = 5000) => Math.floor(Math.random() * (max - min + 1) + min);\n this.salesPieData = [\n {\n x: '\u5bb6\u7528\u7535\u5668',\n y: rv(),\n },\n {\n x: '\u98df\u7528\u9152\u6c34',\n y: rv(),\n },\n {\n x: '\u4e2a\u62a4\u5065\u5eb7',\n y: rv(),\n },\n {\n x: '\u670d\u9970\u7bb1\u5305',\n y: rv(),\n },\n {\n x: '\u6bcd\u5a74\u4ea7\u54c1',\n y: rv(),\n },\n ];\n if (Math.random() > 0.5) {\n this.salesPieData.push({\n x: '\u5176\u4ed6',\n y: rv(),\n });\n }\n this.total = `¥ ${this.salesPieData.reduce((pre, now) => now.y + pre, 0).toFixed(2)}`;\n if (this.pie) {\n // \u7b49\u5f85\u7ec4\u4ef6\u6e32\u67d3\n setTimeout(() => this.pie.changeData());\n }\n }\n\n format(val: number): string {\n return `¥ ${val.toFixed(2)}`;\n }\n\n handleClick(data: G2PieClickItem): void {\n this.msg.info(`${data.item.x} - ${data.item.y}`);\n }\n}",name:"basic",urls:"packages/chart/pie/demo/basic.md",type:"demo",lang:"ts",componentName:"ChartPieBasicComponent",point:0},{id:"chart-pie-mini",meta:{order:0,title:{"zh-CN":"\u8ff7\u4f60\u578b","en-US":"Mini"}},summary:"\u901a\u8fc7\u7b80\u5316 pie
\u5c5e\u6027\u7684\u8bbe\u7f6e\uff0c\u53ef\u4ee5\u5feb\u901f\u7684\u5b9e\u73b0\u6781\u7b80\u7684\u997c\u72b6\u56fe\uff0c\u53ef\u914d\u5408 chart-card
\u7ec4\u5408\u5c55\u73b0\u66f4\u591a\u4e1a\u52a1\u573a\u666f\u3002
",code:'import { Component } from \'@angular/core\';\n\n@Component({\n selector: \'chart-pie-mini\',\n template: `\n \n \n \n `,\n})\nexport class ChartPieMiniComponent {}',name:"mini",urls:"packages/chart/pie/demo/mini.md",type:"demo",lang:"ts",componentName:"ChartPieMiniComponent",point:1}]}static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["app-chart-pie"]],decls:7,vars:7,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","24"],[3,"item"]],template:function(a,o){1&a&&(t.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),t._UZ(4,"chart-pie-basic"),t.qZA(),t.TgZ(5,"code-box",3),t._UZ(6,"chart-pie-mini"),t.qZA()()()()),2&a&&(t.Q6J("codes",o.codes)("item",o.item),t.xp6(1),t.Q6J("nzGutter",16),t.xp6(2),t.Q6J("item",o.codes[0]),t.uIk("id",o.codes[0].id),t.xp6(2),t.Q6J("item",o.codes[1]),t.uIk("id",o.codes[1].id))},dependencies:[c.t3,c.SK,s.P,l.e,rt,it],styles:["[_nghost-%COMP%]{display:block}"]})}return n})();var Ut=i(91183);let st=(()=>{class n{constructor(e){this.msg=e,this.radarData=[],this.refresh()}refresh(){const e=(r=1,v=10)=>Math.floor(Math.random()*(v-r+1)+r),a=["\u4e2a\u4eba","\u56e2\u961f","\u90e8\u95e8"].map(r=>({name:r,ref:e(),koubei:e(),output:e(),contribute:e(),hot:e()})),o={ref:"\u5f15\u7528",koubei:"\u53e3\u7891",output:"\u4ea7\u91cf",contribute:"\u8d21\u732e",hot:"\u70ed\u5ea6"};Math.random()>.5&&delete o.hot;const d=[];a.forEach(r=>{Object.keys(r).forEach(v=>{"name"!==v&&d.push({name:r.name,label:o[v],value:r[v]})})}),this.radarData=d}handleClick(e){this.msg.info(`${e.item.label} - ${e.item.name} - ${e.item.value}`)}static#t=this.\u0275fac=function(a){return new(a||n)(t.Y36(h.dD))};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["chart-radar-basic"]],decls:3,vars:2,consts:[["nz-button","","nzType","primary",3,"click"],["height","286",3,"hasLegend","data","clickItem"]],template:function(a,o){1&a&&(t.TgZ(0,"button",0),t.NdJ("click",function(){return o.refresh()}),t._uU(1,"Refresh"),t.qZA(),t.TgZ(2,"g2-radar",1),t.NdJ("clickItem",function(r){return o.handleClick(r)}),t.qZA()),2&a&&(t.xp6(2),t.Q6J("hasLegend",!0)("data",o.radarData))},dependencies:[Ut.R,p.ix,m.w,u.dQ],encapsulation:2})}return n})(),lt=(()=>{class n{constructor(){this.item={cols:1,urls:{"zh-CN":"packages/chart/radar/index.md"},content:{"zh-CN":{content:'\u96f7\u8fbe\u56fe\u662f\u4ee5\u76f8\u540c\u70b9\u5f00\u59cb\u7684\u8f74\u4e0a\u8868\u793a\u7684\u4e09\u4e2a\u6216\u66f4\u591a\u4e2a\u5b9a\u91cf\u53d8\u91cf\u7684\u4e8c\u7ef4\u56fe\u5f62\u7684\u5f62\u5f0f\u663e\u793a\u591a\u53d8\u91cf\u6570\u636e\u7684\u56fe\u5f62\u65b9\u6cd5\u3002\u8f74\u7684\u76f8\u5bf9\u4f4d\u7f6e\u548c\u89d2\u5ea6\u901a\u5e38\u662f\u4e0d\u77e5\u60c5\u7684\u3002
',api:'API
g2-radar
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [repaint]
\u6570\u636e\u518d\u6b21\u53d8\u66f4\u65f6\u662f\u5426\u91cd\u7ed8 boolean
true
[delay]
\u5ef6\u8fdf\u6e32\u67d3\uff0c\u5355\u4f4d\uff1a\u6beb\u79d2 number
0
[title]
\u56fe\u8868\u6807\u9898 string,TemplateRef<void>
- [height]
\u56fe\u8868\u9ad8\u5ea6 number
- [hasLegend]
\u662f\u5426\u663e\u793a legend boolean
false
[padding]
\u56fe\u8868\u5185\u90e8\u95f4\u8ddd array
[24, 30, 16, 30]
[colors]
\u989c\u8272\u5217\u8868 string[]
- [data]
\u6570\u636e G2RadarData[]
- [theme]
\u5b9a\u5236\u56fe\u8868\u4e3b\u9898 string | LooseObject
- (clickItem)
\u70b9\u51fb\u9879\u56de\u8c03 EventEmitter<G2RadarClickItem>
- (ready)
\u5f53G2\u5b8c\u6210\u521d\u59cb\u5316\u540e\u8c03\u7528 EventEmitter<Chart>
-
G2RadarData
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [name]
\u540d\u79f0 string
- [label]
\u6807\u7b7e string
- [value]
\u503c number
-
',meta:{title:"g2-radar",subtitle:"\u96f7\u8fbe\u56fe",cols:1,type:"G2",module:"import { G2RadarModule } from '@delon/chart/radar';"},toc:[{id:"API",title:"API",h:2,children:[{id:"g2-radar",title:"g2-radar",h:3},{id:"G2RadarData",title:"G2RadarData",h:3}]}]}},demo:!0},this.codes=[{id:"chart-radar-basic",meta:{order:0,title:{"zh-CN":"\u57fa\u7840","en-US":"Basic"}},summary:"\u57fa\u7840\u7528\u6cd5\u3002
",code:"import { Component } from '@angular/core';\nimport { G2RadarClickItem, G2RadarData } from '@delon/chart/radar';\nimport { NzMessageService } from 'ng-zorro-antd/message';\n\n@Component({\n selector: 'chart-radar-basic',\n template: `\n \n \n `,\n})\nexport class ChartRadarBasicComponent {\n radarData: G2RadarData[] = [];\n\n constructor(private msg: NzMessageService) {\n this.refresh();\n }\n\n refresh(): void {\n const rv = (min: number = 1, max: number = 10) => Math.floor(Math.random() * (max - min + 1) + min);\n const radarOriginData = ['\u4e2a\u4eba', '\u56e2\u961f', '\u90e8\u95e8'].map(name => ({\n name,\n ref: rv(),\n koubei: rv(),\n output: rv(),\n contribute: rv(),\n hot: rv(),\n }));\n const radarTitleMap: { [key: string]: string } = {\n ref: '\u5f15\u7528',\n koubei: '\u53e3\u7891',\n output: '\u4ea7\u91cf',\n contribute: '\u8d21\u732e',\n hot: '\u70ed\u5ea6',\n };\n if (Math.random() > 0.5) {\n delete radarTitleMap.hot;\n }\n const res: G2RadarData[] = [];\n radarOriginData.forEach((item: { [key: string]: any }) => {\n Object.keys(item).forEach(key => {\n if (key !== 'name') {\n res.push({\n name: item.name,\n label: radarTitleMap[key],\n value: item[key],\n });\n }\n });\n });\n this.radarData = res;\n }\n\n handleClick(data: G2RadarClickItem): void {\n this.msg.info(`${data.item.label} - ${data.item.name} - ${data.item.value}`);\n }\n}",name:"basic",urls:"packages/chart/radar/demo/basic.md",type:"demo",lang:"ts",componentName:"ChartRadarBasicComponent",point:0}]}static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["app-chart-radar"]],decls:5,vars:5,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","24"],[3,"item"]],template:function(a,o){1&a&&(t.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),t._UZ(4,"chart-radar-basic"),t.qZA()()()()),2&a&&(t.Q6J("codes",o.codes)("item",o.item),t.xp6(1),t.Q6J("nzGutter",16),t.xp6(2),t.Q6J("item",o.codes[0]),t.uIk("id",o.codes[0].id))},dependencies:[c.t3,c.SK,s.P,l.e,st],styles:["[_nghost-%COMP%]{display:block}"]})}return n})();var Jt=i(96814),Qt=i(47381),b=i(79663);function Ot(n,g){if(1&n&&(t.TgZ(0,"tr")(1,"td"),t._uU(2),t.qZA(),t.TgZ(3,"td"),t._UZ(4,"g2-single-bar",4),t.qZA(),t.TgZ(5,"td"),t._UZ(6,"g2-single-bar",5),t.qZA()()),2&n){const e=g.$implicit,a=g.index;t.xp6(2),t.Oqu(a+1),t.xp6(2),t.Q6J("value",e.value),t.xp6(2),t.Q6J("value",e.other)}}let mt=(()=>{class n{constructor(){this.list=new Array(5).fill({}).map(()=>({id:Math.floor(1e4*Math.random()),value:Math.floor(100*Math.random()),other:Math.floor(100*Math.random())>50?Math.floor(100*Math.random()):-Math.floor(100*Math.random())}))}refresh(){this.list.forEach(e=>{e.value=Math.floor(100*Math.random()),e.other=Math.floor(100*Math.random())>50?Math.floor(100*Math.random()):-Math.floor(100*Math.random())})}static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["chart-single-bar-basic"]],decls:13,vars:3,consts:[["nz-button","","nzType","primary",3,"click"],[3,"nzData","nzShowPagination"],["nzWidth","350px"],[4,"ngFor","ngForOf"],["height","24",3,"value"],["height","60","min","-100","line","",3,"value"]],template:function(a,o){1&a&&(t.TgZ(0,"button",0),t.NdJ("click",function(){return o.refresh()}),t._uU(1,"Refresh"),t.qZA(),t.TgZ(2,"nz-table",1)(3,"thead")(4,"tr")(5,"th"),t._uU(6,"\u5e8f\u53f7"),t.qZA(),t.TgZ(7,"th",2),t._uU(8,"\u670d\u52a1\u8c03\u7528\u6b21\u6570"),t.qZA(),t.TgZ(9,"th",2),t._uU(10,"\u6570\u636e\u6709\u8d1f\u503c"),t.qZA()()(),t.TgZ(11,"tbody"),t.YNc(12,Ot,7,3,"tr",3),t.qZA()()),2&a&&(t.xp6(2),t.Q6J("nzData",o.list)("nzShowPagination",!1),t.xp6(10),t.Q6J("ngForOf",o.list))},dependencies:[Jt.sg,Qt.C,p.ix,m.w,u.dQ,b.N8,b.Uo,b._C,b.Om,b.p0,b.$Z],styles:["[_nghost-%COMP%] .ant-table tbody>tr>td{padding:0}"]})}return n})(),ht=(()=>{class n{constructor(){this.item={cols:1,urls:{"zh-CN":"packages/chart/single-bar/index.md"},content:{"zh-CN":{content:'\u5355\u4e00\u67f1\u72b6\u56fe\u66f4\u9002\u5408\u5728\u5217\u8868\u4e2d\u5c55\u793a\u7b80\u5355\u7684\u533a\u95f4\u6570\u636e\uff0c\u7b80\u6d01\u7684\u8868\u73b0\u65b9\u5f0f\u53ef\u4ee5\u5f88\u597d\u7684\u51cf\u5c11\u5927\u6570\u636e\u91cf\u7684\u89c6\u89c9\u5c55\u73b0\u538b\u529b\u3002
',api:'API
g2-single-bar
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [repaint]
\u6570\u636e\u518d\u6b21\u53d8\u66f4\u65f6\u662f\u5426\u91cd\u7ed8 boolean
true
[delay]
\u5ef6\u8fdf\u6e32\u67d3\uff0c\u5355\u4f4d\uff1a\u6beb\u79d2 number
0
[plusColor]
\u56fe\u8868\u989c\u8272 string
#40a9ff
[minusColor]
\u8d1f\u503c\u56fe\u8868\u989c\u8272 string
#ff4d4f
[height]
\u56fe\u8868\u9ad8\u5ea6 number
60
[barSize]
\u67f1\u72b6\u9ad8\u5ea6 number
30
[min]
\u6700\u5c0f\u503c number
0
[max]
\u6700\u5927\u503c\uff0c\u82e5\u5c0f\u4e8e0\u8868\u793a\u663e\u793a\u8d1f\u503c number
100
[padding]
\u56fe\u8868\u5185\u90e8\u95f4\u8ddd any
0
[value]
\u503c number
0
[format]
\u663e\u793a\u503c\u683c\u5f0f (value: number) => string
- [textStyle]
\u663e\u793a\u503c\u6837\u5f0f any
{ fontSize: 12, color: \'#595959\' }
[theme]
\u5b9a\u5236\u56fe\u8868\u4e3b\u9898 string | LooseObject
- (ready)
\u5f53G2\u5b8c\u6210\u521d\u59cb\u5316\u540e\u8c03\u7528 EventEmitter<Chart>
-
',meta:{title:"g2-single-bar",subtitle:"\u5355\u4e00\u67f1\u72b6\u56fe",cols:1,type:"G2",module:"import { G2SingleBarModule } from '@delon/chart/single-bar';"},toc:[{id:"API",title:"API",h:2,children:[{id:"g2-single-bar",title:"g2-single-bar",h:3}]}]}},demo:!0},this.codes=[{id:"chart-single-bar-basic",meta:{order:0,title:{"zh-CN":"\u57fa\u7840","en-US":"Basic"}},summary:"\u57fa\u7840\u7528\u6cd5\u3002
",code:'import { Component, ViewEncapsulation } from \'@angular/core\';\n\n@Component({\n selector: \'chart-single-bar-basic\',\n template: `\n \n \n \n \n \u5e8f\u53f7 \n \u670d\u52a1\u8c03\u7528\u6b21\u6570 \n \u6570\u636e\u6709\u8d1f\u503c \n \n \n \n \n {{ idx + 1 }} \n \n \n \n \n \n \n \n \n \n `,\n styles: [\n `\n :host ::ng-deep .ant-table tbody > tr > td {\n padding: 0;\n }\n `,\n ],\n encapsulation: ViewEncapsulation.Emulated,\n})\nexport class ChartSingleBarBasicComponent {\n list: Array<{ id: number; value: number; other: number }> = new Array(5).fill({}).map(() => ({\n id: Math.floor(Math.random() * 10000),\n value: Math.floor(Math.random() * 100),\n other: Math.floor(Math.random() * 100) > 50 ? Math.floor(Math.random() * 100) : -Math.floor(Math.random() * 100),\n }));\n\n refresh(): void {\n this.list.forEach(v => {\n v.value = Math.floor(Math.random() * 100);\n v.other = Math.floor(Math.random() * 100) > 50 ? Math.floor(Math.random() * 100) : -Math.floor(Math.random() * 100);\n });\n }\n}',name:"basic",urls:"packages/chart/single-bar/demo/basic.md",type:"demo",lang:"ts",componentName:"ChartSingleBarBasicComponent",point:0}]}static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["app-chart-single-bar"]],decls:5,vars:5,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","24"],[3,"item"]],template:function(a,o){1&a&&(t.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),t._UZ(4,"chart-single-bar-basic"),t.qZA()()()()),2&a&&(t.Q6J("codes",o.codes)("item",o.item),t.xp6(1),t.Q6J("nzGutter",16),t.xp6(2),t.Q6J("item",o.codes[0]),t.uIk("id",o.codes[0].id))},dependencies:[c.t3,c.SK,s.P,l.e,mt],styles:["[_nghost-%COMP%]{display:block}"]})}return n})();var Rt=i(91641);let pt=(()=>{class n{constructor(e){this.msg=e,this.tags=[],this.refresh()}refresh(){const e=(a=1,o=10)=>Math.floor(Math.random()*(o-a+1)+a);this.tags=[{value:e(),name:"NG-ALAIN"},{value:e(),name:"AntV"},{value:e(),name:"F2"},{value:e(),name:"G2"},{value:e(),name:"G6"},{value:e(),name:"DataSet"},{value:e(),name:"\u58a8\u8005\u5b66\u9662"},{value:e(),name:"Analysis"},{value:e(),name:"Data Mining"},{value:e(),name:"Data Vis"},{value:e(),name:"Design"},{value:e(),name:"Grammar"},{value:e(),name:"Graphics"},{value:e(),name:"Graph"},{value:e(),name:"Hierarchy"},{value:e(),name:"Labeling"},{value:e(),name:"Layout"},{value:e(),name:"Quantitative"},{value:e(),name:"Relation"},{value:e(),name:"Statistics"},{value:e(),name:"\u53ef\u89c6\u5316"},{value:e(),name:"\u6570\u636e"},{value:e(),name:"\u6570\u636e\u53ef\u89c6\u5316"},{value:e(),name:"Arc Diagram"},{value:e(),name:"Bar Chart"},{value:e(),name:"Canvas"},{value:e(),name:"Chart"},{value:e(),name:"DAG"},{value:e(),name:"DG"},{value:e(),name:"Facet"},{value:e(),name:"Geo"},{value:e(),name:"Line"},{value:e(),name:"MindMap"},{value:e(),name:"Pie"},{value:e(),name:"Pizza Chart"},{value:e(),name:"Punch Card"},{value:e(),name:"SVG"},{value:e(),name:"Sunburst"},{value:e(),name:"Tree"},{value:e(),name:"UML"},{value:e(),name:"Chart"},{value:e(),name:"View"},{value:e(),name:"Geom"},{value:e(),name:"Shape"},{value:e(),name:"Scale"},{value:e(),name:"Animate"},{value:e(),name:"Global"},{value:e(),name:"Slider"},{value:e(),name:"Connector"},{value:e(),name:"Transform"},{value:e(),name:"Util"},{value:e(),name:"DomUtil"},{value:e(),name:"MatrixUtil"},{value:e(),name:"PathUtil"},{value:e(),name:"G"},{value:e(),name:"2D"},{value:e(),name:"3D"},{value:e(),name:"Line"},{value:e(),name:"Area"},{value:e(),name:"Interval"},{value:e(),name:"Schema"},{value:e(),name:"Edge"},{value:e(),name:"Polygon"},{value:e(),name:"Heatmap"},{value:e(),name:"Render"},{value:e(),name:"Tooltip"},{value:e(),name:"Axis"},{value:e(),name:"Guide"},{value:e(),name:"Coord"},{value:e(),name:"Legend"},{value:e(),name:"Path"},{value:e(),name:"Helix"},{value:e(),name:"Theta"},{value:e(),name:"Rect"},{value:e(),name:"Polar"},{value:e(),name:"Dsv"},{value:e(),name:"Csv"},{value:e(),name:"Tsv"},{value:e(),name:"GeoJSON"},{value:e(),name:"TopoJSON"},{value:e(),name:"Filter"},{value:e(),name:"Map"},{value:e(),name:"Pick"},{value:e(),name:"Rename"},{value:e(),name:"Filter"},{value:e(),name:"Map"},{value:e(),name:"Pick"},{value:e(),name:"Rename"},{value:e(),name:"Reverse"},{value:e(),name:"sort"},{value:e(),name:"Subset"},{value:e(),name:"Partition"},{value:e(),name:"Imputation"},{value:e(),name:"Fold"},{value:e(),name:"Aggregate"},{value:e(),name:"Proportion"},{value:e(),name:"Histogram"},{value:e(),name:"Quantile"},{value:e(),name:"Treemap"},{value:e(),name:"Hexagon"},{value:e(),name:"Binning"},{value:e(),name:"kernel"},{value:e(),name:"Regression"},{value:e(),name:"Density"},{value:e(),name:"Sankey"},{value:e(),name:"Voronoi"},{value:e(),name:"Projection"},{value:e(),name:"Centroid"},{value:e(),name:"H5"},{value:e(),name:"Mobile"},{value:e(),name:"K\u7ebf\u56fe"},{value:e(),name:"\u5173\u7cfb\u56fe"},{value:e(),name:"\u70db\u5f62\u56fe"},{value:e(),name:"\u80a1\u7968\u56fe"},{value:e(),name:"\u76f4\u65b9\u56fe"},{value:e(),name:"\u91d1\u5b57\u5854\u56fe"},{value:e(),name:"\u5206\u9762"},{value:e(),name:"\u5357\u4e01\u683c\u5c14\u73ab\u7470\u56fe"},{value:e(),name:"\u997c\u56fe"},{value:e(),name:"\u7ebf\u56fe"},{value:e(),name:"\u70b9\u56fe"},{value:e(),name:"\u6563\u70b9\u56fe"},{value:e(),name:"\u5b50\u5f39\u56fe"},{value:e(),name:"\u67f1\u72b6\u56fe"},{value:e(),name:"\u4eea\u8868\u76d8"},{value:e(),name:"\u6c14\u6ce1\u56fe"},{value:e(),name:"\u6f0f\u6597\u56fe"},{value:e(),name:"\u70ed\u529b\u56fe"},{value:e(),name:"\u7389\u73a6\u56fe"},{value:e(),name:"\u76f4\u65b9\u56fe"},{value:e(),name:"\u77e9\u5f62\u6811\u56fe"},{value:e(),name:"\u7bb1\u5f62\u56fe"},{value:e(),name:"\u8272\u5757\u56fe"},{value:e(),name:"\u87ba\u65cb\u56fe"},{value:e(),name:"\u8bcd\u4e91"},{value:e(),name:"\u8bcd\u4e91\u56fe"},{value:e(),name:"\u96f7\u8fbe\u56fe"},{value:e(),name:"\u9762\u79ef\u56fe"},{value:e(),name:"\u9a6c\u8d5b\u514b\u56fe"},{value:e(),name:"\u76d2\u987b\u56fe"},{value:e(),name:"\u5750\u6807\u8f74"},{value:e(),name:""},{value:e(),name:"Jacques Bertin"},{value:e(),name:"Leland Wilkinson"},{value:e(),name:"William Playfair"},{value:e(),name:"\u5173\u8054"},{value:e(),name:"\u5206\u5e03"},{value:e(),name:"\u533a\u95f4"},{value:e(),name:"\u5360\u6bd4"},{value:e(),name:"\u5730\u56fe"},{value:e(),name:"\u65f6\u95f4"},{value:e(),name:"\u6bd4\u8f83"},{value:e(),name:"\u6d41\u7a0b"},{value:e(),name:"\u8d8b\u52bf"},{value:e(),name:"\u4ea6\u53f6"},{value:e(),name:"\u518d\u98de"},{value:e(),name:"\u5b8c\u767d"},{value:e(),name:"\u5df4\u601d"},{value:e(),name:"\u5f20\u521d\u5c18"},{value:e(),name:"\u5fa1\u672f"},{value:e(),name:"\u6709\u7530"},{value:e(),name:"\u6c89\u9c7c"},{value:e(),name:"\u7389\u4f2f"},{value:e(),name:"\u753b\u5eb7"},{value:e(),name:"\u796f\u9038"},{value:e(),name:"\u7edd\u4e91"},{value:e(),name:"\u7f57\u5baa"},{value:e(),name:"\u8427\u5e86"},{value:e(),name:"\u8463\u73ca\u73ca"},{value:e(),name:"\u9646\u6c89"},{value:e(),name:"\u987e\u503e"},{value:e(),name:"Domo"},{value:e(),name:"GPL"},{value:e(),name:"PAI"},{value:e(),name:"SPSS"},{value:e(),name:"SYSTAT"},{value:e(),name:"Tableau"},{value:e(),name:"D3"},{value:e(),name:"Vega"},{value:e(),name:"\u7edf\u8ba1\u56fe\u8868"}]}handleClick(e){this.msg.info(`${e.item.name} - ${e.item.value}`)}static#t=this.\u0275fac=function(a){return new(a||n)(t.Y36(h.dD))};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["chart-tag-cloud-basic"]],decls:3,vars:1,consts:[["nz-button","","nzType","primary",3,"click"],["height","400",3,"data","clickItem"]],template:function(a,o){1&a&&(t.TgZ(0,"button",0),t.NdJ("click",function(){return o.refresh()}),t._uU(1,"Refresh"),t.qZA(),t.TgZ(2,"g2-tag-cloud",1),t.NdJ("clickItem",function(r){return o.handleClick(r)}),t.qZA()),2&a&&(t.xp6(2),t.Q6J("data",o.tags))},dependencies:[Rt.S,p.ix,m.w,u.dQ],encapsulation:2})}return n})(),ut=(()=>{class n{constructor(){this.item={cols:1,urls:{"zh-CN":"packages/chart/tag-cloud/index.md"},content:{"zh-CN":{content:'\u6807\u7b7e\u4e91\u662f\u4e00\u5957\u76f8\u5173\u7684\u6807\u7b7e\u4ee5\u53ca\u4e0e\u6b64\u76f8\u5e94\u7684\u6743\u91cd\u5c55\u793a\u65b9\u5f0f\uff0c\u4e00\u822c\u5178\u578b\u7684\u6807\u7b7e\u4e91\u6709 30 \u81f3 150 \u4e2a\u6807\u7b7e\uff0c\u800c\u6743\u91cd\u5f71\u54cd\u4f7f\u7528\u7684\u5b57\u4f53\u5927\u5c0f\u6216\u5176\u4ed6\u89c6\u89c9\u6548\u679c\u3002
',api:'API
g2-tag-cloud
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [repaint]
\u6570\u636e\u518d\u6b21\u53d8\u66f4\u65f6\u662f\u5426\u91cd\u7ed8 boolean
true
[delay]
\u5ef6\u8fdf\u6e32\u67d3\uff0c\u5355\u4f4d\uff1a\u6beb\u79d2 number
200
[height]
\u9ad8\u5ea6\u503c number
200
[width]
\u5bbd\u5ea6\u503c\uff0c\u82e5\u4e0d\u6307\u5b9a\u81ea\u52a8\u6309\u5bbf\u4e3b\u5143\u7d20\u7684\u5bbd\u5ea6 number
0
[data]
\u6570\u636e G2TagCloudData[]
[]
[theme]
\u5b9a\u5236\u56fe\u8868\u4e3b\u9898 string | LooseObject
- (clickItem)
\u70b9\u51fb\u9879\u56de\u8c03 EventEmitter<G2TagCloudClickItem>
- (ready)
\u5f53G2\u5b8c\u6210\u521d\u59cb\u5316\u540e\u8c03\u7528 EventEmitter<Chart>
-
G2TagCloudData
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [name]
\u540d\u79f0 string
- [value]
\u503c number
-
',meta:{title:"g2-tag-cloud",subtitle:"\u6807\u7b7e\u4e91",cols:1,type:"G2",module:"import { G2TagCloudModule } from '@delon/chart/tag-cloud';"},toc:[{id:"API",title:"API",h:2,children:[{id:"g2-tag-cloud",title:"g2-tag-cloud",h:3},{id:"G2TagCloudData",title:"G2TagCloudData",h:3}]}]}},demo:!0},this.codes=[{id:"chart-tag-cloud-basic",meta:{order:0,title:{"zh-CN":"\u57fa\u7840","en-US":"Basic"}},summary:"\u57fa\u7840\u7528\u6cd5\u3002
",code:"import { Component } from '@angular/core';\nimport { G2TagCloudClickItem, G2TagCloudData } from '@delon/chart/tag-cloud';\nimport { NzMessageService } from 'ng-zorro-antd/message';\n\n@Component({\n selector: 'chart-tag-cloud-basic',\n template: `\n \n \n `,\n})\nexport class ChartTagCloudBasicComponent {\n tags: G2TagCloudData[] = [];\n\n constructor(private msg: NzMessageService) {\n this.refresh();\n }\n\n refresh(): void {\n const rv = (min: number = 1, max: number = 10) => Math.floor(Math.random() * (max - min + 1) + min);\n\n this.tags = [\n { value: rv(), name: 'NG-ALAIN' },\n { value: rv(), name: 'AntV' },\n { value: rv(), name: 'F2' },\n { value: rv(), name: 'G2' },\n { value: rv(), name: 'G6' },\n { value: rv(), name: 'DataSet' },\n { value: rv(), name: '\u58a8\u8005\u5b66\u9662' },\n { value: rv(), name: 'Analysis' },\n { value: rv(), name: 'Data Mining' },\n { value: rv(), name: 'Data Vis' },\n { value: rv(), name: 'Design' },\n { value: rv(), name: 'Grammar' },\n { value: rv(), name: 'Graphics' },\n { value: rv(), name: 'Graph' },\n { value: rv(), name: 'Hierarchy' },\n { value: rv(), name: 'Labeling' },\n { value: rv(), name: 'Layout' },\n { value: rv(), name: 'Quantitative' },\n { value: rv(), name: 'Relation' },\n { value: rv(), name: 'Statistics' },\n { value: rv(), name: '\u53ef\u89c6\u5316' },\n { value: rv(), name: '\u6570\u636e' },\n { value: rv(), name: '\u6570\u636e\u53ef\u89c6\u5316' },\n { value: rv(), name: 'Arc Diagram' },\n { value: rv(), name: 'Bar Chart' },\n { value: rv(), name: 'Canvas' },\n { value: rv(), name: 'Chart' },\n { value: rv(), name: 'DAG' },\n { value: rv(), name: 'DG' },\n { value: rv(), name: 'Facet' },\n { value: rv(), name: 'Geo' },\n { value: rv(), name: 'Line' },\n { value: rv(), name: 'MindMap' },\n { value: rv(), name: 'Pie' },\n { value: rv(), name: 'Pizza Chart' },\n { value: rv(), name: 'Punch Card' },\n { value: rv(), name: 'SVG' },\n { value: rv(), name: 'Sunburst' },\n { value: rv(), name: 'Tree' },\n { value: rv(), name: 'UML' },\n { value: rv(), name: 'Chart' },\n { value: rv(), name: 'View' },\n { value: rv(), name: 'Geom' },\n { value: rv(), name: 'Shape' },\n { value: rv(), name: 'Scale' },\n { value: rv(), name: 'Animate' },\n { value: rv(), name: 'Global' },\n { value: rv(), name: 'Slider' },\n { value: rv(), name: 'Connector' },\n { value: rv(), name: 'Transform' },\n { value: rv(), name: 'Util' },\n { value: rv(), name: 'DomUtil' },\n { value: rv(), name: 'MatrixUtil' },\n { value: rv(), name: 'PathUtil' },\n { value: rv(), name: 'G' },\n { value: rv(), name: '2D' },\n { value: rv(), name: '3D' },\n { value: rv(), name: 'Line' },\n { value: rv(), name: 'Area' },\n { value: rv(), name: 'Interval' },\n { value: rv(), name: 'Schema' },\n { value: rv(), name: 'Edge' },\n { value: rv(), name: 'Polygon' },\n { value: rv(), name: 'Heatmap' },\n { value: rv(), name: 'Render' },\n { value: rv(), name: 'Tooltip' },\n { value: rv(), name: 'Axis' },\n { value: rv(), name: 'Guide' },\n { value: rv(), name: 'Coord' },\n { value: rv(), name: 'Legend' },\n { value: rv(), name: 'Path' },\n { value: rv(), name: 'Helix' },\n { value: rv(), name: 'Theta' },\n { value: rv(), name: 'Rect' },\n { value: rv(), name: 'Polar' },\n { value: rv(), name: 'Dsv' },\n { value: rv(), name: 'Csv' },\n { value: rv(), name: 'Tsv' },\n { value: rv(), name: 'GeoJSON' },\n { value: rv(), name: 'TopoJSON' },\n { value: rv(), name: 'Filter' },\n { value: rv(), name: 'Map' },\n { value: rv(), name: 'Pick' },\n { value: rv(), name: 'Rename' },\n { value: rv(), name: 'Filter' },\n { value: rv(), name: 'Map' },\n { value: rv(), name: 'Pick' },\n { value: rv(), name: 'Rename' },\n { value: rv(), name: 'Reverse' },\n { value: rv(), name: 'sort' },\n { value: rv(), name: 'Subset' },\n { value: rv(), name: 'Partition' },\n { value: rv(), name: 'Imputation' },\n { value: rv(), name: 'Fold' },\n { value: rv(), name: 'Aggregate' },\n { value: rv(), name: 'Proportion' },\n { value: rv(), name: 'Histogram' },\n { value: rv(), name: 'Quantile' },\n { value: rv(), name: 'Treemap' },\n { value: rv(), name: 'Hexagon' },\n { value: rv(), name: 'Binning' },\n { value: rv(), name: 'kernel' },\n { value: rv(), name: 'Regression' },\n { value: rv(), name: 'Density' },\n { value: rv(), name: 'Sankey' },\n { value: rv(), name: 'Voronoi' },\n { value: rv(), name: 'Projection' },\n { value: rv(), name: 'Centroid' },\n { value: rv(), name: 'H5' },\n { value: rv(), name: 'Mobile' },\n { value: rv(), name: 'K\u7ebf\u56fe' },\n { value: rv(), name: '\u5173\u7cfb\u56fe' },\n { value: rv(), name: '\u70db\u5f62\u56fe' },\n { value: rv(), name: '\u80a1\u7968\u56fe' },\n { value: rv(), name: '\u76f4\u65b9\u56fe' },\n { value: rv(), name: '\u91d1\u5b57\u5854\u56fe' },\n { value: rv(), name: '\u5206\u9762' },\n { value: rv(), name: '\u5357\u4e01\u683c\u5c14\u73ab\u7470\u56fe' },\n { value: rv(), name: '\u997c\u56fe' },\n { value: rv(), name: '\u7ebf\u56fe' },\n { value: rv(), name: '\u70b9\u56fe' },\n { value: rv(), name: '\u6563\u70b9\u56fe' },\n { value: rv(), name: '\u5b50\u5f39\u56fe' },\n { value: rv(), name: '\u67f1\u72b6\u56fe' },\n { value: rv(), name: '\u4eea\u8868\u76d8' },\n { value: rv(), name: '\u6c14\u6ce1\u56fe' },\n { value: rv(), name: '\u6f0f\u6597\u56fe' },\n { value: rv(), name: '\u70ed\u529b\u56fe' },\n { value: rv(), name: '\u7389\u73a6\u56fe' },\n { value: rv(), name: '\u76f4\u65b9\u56fe' },\n { value: rv(), name: '\u77e9\u5f62\u6811\u56fe' },\n { value: rv(), name: '\u7bb1\u5f62\u56fe' },\n { value: rv(), name: '\u8272\u5757\u56fe' },\n { value: rv(), name: '\u87ba\u65cb\u56fe' },\n { value: rv(), name: '\u8bcd\u4e91' },\n { value: rv(), name: '\u8bcd\u4e91\u56fe' },\n { value: rv(), name: '\u96f7\u8fbe\u56fe' },\n { value: rv(), name: '\u9762\u79ef\u56fe' },\n { value: rv(), name: '\u9a6c\u8d5b\u514b\u56fe' },\n { value: rv(), name: '\u76d2\u987b\u56fe' },\n { value: rv(), name: '\u5750\u6807\u8f74' },\n { value: rv(), name: '' },\n { value: rv(), name: 'Jacques Bertin' },\n { value: rv(), name: 'Leland Wilkinson' },\n { value: rv(), name: 'William Playfair' },\n { value: rv(), name: '\u5173\u8054' },\n { value: rv(), name: '\u5206\u5e03' },\n { value: rv(), name: '\u533a\u95f4' },\n { value: rv(), name: '\u5360\u6bd4' },\n { value: rv(), name: '\u5730\u56fe' },\n { value: rv(), name: '\u65f6\u95f4' },\n { value: rv(), name: '\u6bd4\u8f83' },\n { value: rv(), name: '\u6d41\u7a0b' },\n { value: rv(), name: '\u8d8b\u52bf' },\n { value: rv(), name: '\u4ea6\u53f6' },\n { value: rv(), name: '\u518d\u98de' },\n { value: rv(), name: '\u5b8c\u767d' },\n { value: rv(), name: '\u5df4\u601d' },\n { value: rv(), name: '\u5f20\u521d\u5c18' },\n { value: rv(), name: '\u5fa1\u672f' },\n { value: rv(), name: '\u6709\u7530' },\n { value: rv(), name: '\u6c89\u9c7c' },\n { value: rv(), name: '\u7389\u4f2f' },\n { value: rv(), name: '\u753b\u5eb7' },\n { value: rv(), name: '\u796f\u9038' },\n { value: rv(), name: '\u7edd\u4e91' },\n { value: rv(), name: '\u7f57\u5baa' },\n { value: rv(), name: '\u8427\u5e86' },\n { value: rv(), name: '\u8463\u73ca\u73ca' },\n { value: rv(), name: '\u9646\u6c89' },\n { value: rv(), name: '\u987e\u503e' },\n { value: rv(), name: 'Domo' },\n { value: rv(), name: 'GPL' },\n { value: rv(), name: 'PAI' },\n { value: rv(), name: 'SPSS' },\n { value: rv(), name: 'SYSTAT' },\n { value: rv(), name: 'Tableau' },\n { value: rv(), name: 'D3' },\n { value: rv(), name: 'Vega' },\n { value: rv(), name: '\u7edf\u8ba1\u56fe\u8868' },\n ];\n }\n\n handleClick(data: G2TagCloudClickItem): void {\n this.msg.info(`${data.item.name} - ${data.item.value}`);\n }\n}",name:"basic",urls:"packages/chart/tag-cloud/demo/basic.md",type:"demo",lang:"ts",componentName:"ChartTagCloudBasicComponent",point:0}]}static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["app-chart-tag-cloud"]],decls:5,vars:5,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","24"],[3,"item"]],template:function(a,o){1&a&&(t.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),t._UZ(4,"chart-tag-cloud-basic"),t.qZA()()()()),2&a&&(t.Q6J("codes",o.codes)("item",o.item),t.xp6(1),t.Q6J("nzGutter",16),t.xp6(2),t.Q6J("item",o.codes[0]),t.uIk("id",o.codes[0].id))},dependencies:[c.t3,c.SK,s.P,l.e,pt],styles:["[_nghost-%COMP%]{display:block}"]})}return n})();var A=i(68771);const $t=function(){return{y1:"\u5ba2\u6d41\u91cf",y2:"\u652f\u4ed8\u7b14\u6570"}};let gt=(()=>{class n{constructor(e){this.msg=e,this.chartData=[]}ngOnInit(){for(let e=0;e<20;e+=1)this.chartData.push({time:(new Date).getTime()+18e5*e,y1:Math.floor(100*Math.random())+1e3,y2:Math.floor(100*Math.random())+10})}handleClick(e){this.msg.info(`\u5ba2\u6d41\u91cf: ${e.item.y1}, \u652f\u4ed8\u7b14\u6570: ${e.item.y2}`)}static#t=this.\u0275fac=function(a){return new(a||n)(t.Y36(h.dD))};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["chart-timeline-basic"]],decls:1,vars:4,consts:[[3,"data","titleMap","height","clickItem"]],template:function(a,o){1&a&&(t.TgZ(0,"g2-timeline",0),t.NdJ("clickItem",function(r){return o.handleClick(r)}),t.qZA()),2&a&&t.Q6J("data",o.chartData)("titleMap",t.DdM(3,$t))("height",200)},dependencies:[A.Q],encapsulation:2})}return n})(),vt=(()=>{class n{constructor(){this.chartData=[],this.titleMap={y1:"\u6307\u68071",y2:"\u6307\u68072"},this.maxAxis=5,this.refresh()}genData(e){const a=[];for(let o=0;o<20;o+=1){const d={time:(new Date).getTime()+18e5*o,y1:Math.floor(100*Math.random())+500,y2:Math.floor(100*Math.random())+1e3,y3:Math.floor(100*Math.random())+1500,y4:Math.floor(100*Math.random())+2e3,y5:Math.floor(100*Math.random())+2500};e&&delete d.y5,a.push(d)}return a}refresh(){const e={y1:"\u6307\u68071",y2:"\u6307\u68072",y3:"\u6307\u68073",y4:"\u6307\u68074",y5:"\u6307\u68075"},a=Math.random()>.5;a&&delete e.y5,this.chartData=this.genData(a),this.titleMap=e,this.maxAxis=a?4:5}refreshData(){this.chartData=this.genData(4===this.maxAxis)}static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["chart-timeline-max-axis"]],decls:5,vars:4,consts:[["nz-button","","nzType","primary",3,"click"],[3,"maxAxis","data","titleMap","height"]],template:function(a,o){1&a&&(t.TgZ(0,"button",0),t.NdJ("click",function(){return o.refresh()}),t._uU(1,"Refresh"),t.qZA(),t.TgZ(2,"button",0),t.NdJ("click",function(){return o.refreshData()}),t._uU(3,"Refresh Data"),t.qZA(),t._UZ(4,"g2-timeline",1)),2&a&&(t.xp6(4),t.Q6J("maxAxis",o.maxAxis)("data",o.chartData)("titleMap",o.titleMap)("height",300))},dependencies:[A.Q,p.ix,m.w,u.dQ],encapsulation:2})}return n})();const jt=function(){return{y1:"\u5ba2\u6d41\u91cf",y2:"\u652f\u4ed8\u7b14\u6570"}};let ft=(()=>{class n{constructor(e){this.msg=e,this.chartData=[]}ngOnInit(){for(let e=0;e<20;e+=1)this.chartData.push({time:(new Date).getTime()+864e5*e,y1:Math.floor(100*Math.random())+1e3,y2:Math.floor(100*Math.random())+10})}handleClick(e){this.msg.info(`\u5ba2\u6d41\u91cf: ${e.item.y1}, \u652f\u4ed8\u7b14\u6570: ${e.item.y2}`)}static#t=this.\u0275fac=function(a){return new(a||n)(t.Y36(h.dD))};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["chart-timeline-mask"]],decls:1,vars:4,consts:[["mask","MM\u6708DD\u65e5","maskSlider","MM\u6708dd\u65e5",3,"data","titleMap","height","clickItem"]],template:function(a,o){1&a&&(t.TgZ(0,"g2-timeline",0),t.NdJ("clickItem",function(r){return o.handleClick(r)}),t.qZA()),2&a&&t.Q6J("data",o.chartData)("titleMap",t.DdM(3,jt))("height",200)},dependencies:[A.Q],encapsulation:2})}return n})(),bt=(()=>{class n{constructor(){this.item={cols:1,urls:{"zh-CN":"packages/chart/timeline/index.md"},content:{"zh-CN":{content:'\u4f7f\u7528 timeline
\u7ec4\u4ef6\u53ef\u4ee5\u5b9e\u73b0\u5e26\u6709\u65f6\u95f4\u8f74\u7684\u67f1\u72b6\u56fe\u5c55\u73b0\uff0c\u800c\u5176\u4e2d\u7684 x
\u5c5e\u6027\uff0c\u5219\u662f\u65f6\u95f4\u503c\u7684\u6307\u5411\uff0c\u9ed8\u8ba4\u6700\u591a\u652f\u6301\u540c\u65f6\u5c55\u73b0\u4e24\u4e2a\u6307\u6807\uff0c\u5206\u522b\u662f y1
\u548c y2
\u3002
',api:'API
g2-timeline
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [repaint]
\u6570\u636e\u518d\u6b21\u53d8\u66f4\u65f6\u662f\u5426\u91cd\u7ed8 boolean
true
[delay]
\u5ef6\u8fdf\u6e32\u67d3\uff0c\u5355\u4f4d\uff1a\u6beb\u79d2 number
0
[title]
\u56fe\u8868\u6807\u9898 string,TemplateRef<void>
- [maxAxis]
\u6700\u5927\u6307\u6807\u6570\u91cf number
2
[data]
\u6570\u636e\uff0c\u6ce8\uff1a\u6839\u636e maxAxis
\u503c\u4f20\u9012\u6307\u6807\u6570\u636e G2TimelineData[]
- [titleMap]
\u6307\u6807\u522b\u540d G2TimelineMap
- [colorMap]
\u989c\u8272 G2TimelineMap
{ y1: \'#5B8FF9\', y2: \'#5AD8A6\', y3: \'#5D7092\', y4: \'#F6BD16\', y5: \'#E86452\' }
[height]
\u9ad8\u5ea6\u503c number
400
[padding]
\u56fe\u8868\u5185\u90e8\u95f4\u8ddd number[]
[40, 8, 64, 40]
[borderWidth]
\u7ebf\u6761 number
2
[mask]
\u65e5\u671f\u683c\u5f0f\uff0c\u4f7f\u7528 G2 Mask\u65e5\u671f\u683c\u5f0f string
HH:mm
[maskSlider]
\u6ed1\u52a8\u6761\u65e5\u671f\u683c\u5f0f\uff0c\u4f7f\u7528 date-fns \u65e5\u671f\u683c\u5f0f string
HH:mm
[position]
\u6807\u9898\u4f4d\u7f6e \'top\',\'right\',\'bottom\',\'left\'
\'top\'
[slider]
\u662f\u5426\u9700\u8981\u6ed1\u52a8\u6761 boolean
true
[theme]
\u5b9a\u5236\u56fe\u8868\u4e3b\u9898 string | LooseObject
- (clickItem)
\u70b9\u51fb\u9879\u56de\u8c03 EventEmitter<G2TimelineClickItem>
- (ready)
\u5f53G2\u5b8c\u6210\u521d\u59cb\u5316\u540e\u8c03\u7528 EventEmitter<Chart>
-
G2TimelineData
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [time]
\u65e5\u671f\u683c\u5f0f Date | number
- [y1]
\u6307\u68071\u6570\u636e number
- [y2]
\u6307\u68072\u6570\u636e number
- [y3]
\u6307\u68073\u6570\u636e number
- [y4]
\u6307\u68074\u6570\u636e number
- [y5]
\u6307\u68075\u6570\u636e number
-
G2TimelineMap
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [y1]
\u6307\u68071 string
- [y2]
\u6307\u68072 string
- [y3]
\u6307\u68073 string
- [y4]
\u6307\u68074 string
- [y5]
\u6307\u68075 string
-
',meta:{title:"g2-timeline",subtitle:"\u6298\u7ebf\u56fe",cols:1,type:"G2",module:"import { G2TimelineModule } from '@delon/chart/timeline';"},toc:[{id:"API",title:"API",h:2,children:[{id:"g2-timeline",title:"g2-timeline",h:3},{id:"G2TimelineData",title:"G2TimelineData",h:3},{id:"G2TimelineMap",title:"G2TimelineMap",h:3}]}]}},demo:!0},this.codes=[{id:"chart-timeline-basic",meta:{order:0,title:{"zh-CN":"\u57fa\u7840","en-US":"Basic"}},summary:"\u5e26\u6709\u65f6\u95f4\u8f74\u7684\u56fe\u8868\u3002
",code:"import { Component, OnInit } from '@angular/core';\nimport { G2TimelineClickItem, G2TimelineData } from '@delon/chart/timeline';\nimport { NzMessageService } from 'ng-zorro-antd/message';\n\n@Component({\n selector: 'chart-timeline-basic',\n template: ` `,\n})\nexport class ChartTimelineBasicComponent implements OnInit {\n chartData: G2TimelineData[] = [];\n\n constructor(private msg: NzMessageService) {}\n\n ngOnInit(): void {\n for (let i = 0; i < 20; i += 1) {\n this.chartData.push({\n time: new Date().getTime() + 1000 * 60 * 30 * i,\n y1: Math.floor(Math.random() * 100) + 1000,\n y2: Math.floor(Math.random() * 100) + 10,\n });\n }\n }\n\n handleClick(data: G2TimelineClickItem): void {\n this.msg.info(`\u5ba2\u6d41\u91cf: ${data.item.y1}, \u652f\u4ed8\u7b14\u6570: ${data.item.y2}`);\n }\n}",name:"basic",urls:"packages/chart/timeline/demo/basic.md",type:"demo",lang:"ts",componentName:"ChartTimelineBasicComponent",point:0},{id:"chart-timeline-max-axis",meta:{order:1,title:{"zh-CN":"\u591a\u6307\u6807","en-US":"Multiple indicators"}},summary:"\u5229\u7528 maxAxis
\u5c5e\u6027\u6765\u8c03\u6574\u591a\u4e2a\u6307\u6807\uff0c\u6700\u591a\u652f\u6301 5
\u4e2a\u6307\u6807\u503c\u3002
",code:"import { Component } from '@angular/core';\nimport { G2TimelineData, G2TimelineMap } from '@delon/chart/timeline';\n\n@Component({\n selector: 'chart-timeline-max-axis',\n template: `\n \n \n \n `,\n})\nexport class ChartTimelineMaxAxisComponent {\n chartData: G2TimelineData[] = [];\n titleMap: G2TimelineMap = { y1: '\u6307\u68071', y2: '\u6307\u68072' };\n maxAxis = 5;\n\n constructor() {\n this.refresh();\n }\n\n private genData(hideY5: boolean): G2TimelineData[] {\n const res: G2TimelineData[] = [];\n for (let i = 0; i < 20; i += 1) {\n const item: G2TimelineData = {\n time: new Date().getTime() + 1000 * 60 * 30 * i,\n y1: Math.floor(Math.random() * 100) + 500,\n y2: Math.floor(Math.random() * 100) + 1000,\n y3: Math.floor(Math.random() * 100) + 1500,\n y4: Math.floor(Math.random() * 100) + 2000,\n y5: Math.floor(Math.random() * 100) + 2500,\n };\n if (hideY5) delete item.y5;\n res.push(item);\n }\n return res;\n }\n\n refresh(): void {\n const titleMap: G2TimelineMap = { y1: '\u6307\u68071', y2: '\u6307\u68072', y3: '\u6307\u68073', y4: '\u6307\u68074', y5: '\u6307\u68075' };\n const hideY5 = Math.random() > 0.5;\n if (hideY5) delete titleMap.y5;\n this.chartData = this.genData(hideY5);\n this.titleMap = titleMap;\n this.maxAxis = hideY5 ? 4 : 5;\n }\n\n refreshData(): void {\n this.chartData = this.genData(this.maxAxis === 4);\n }\n}",name:"max-axis",urls:"packages/chart/timeline/demo/max-axis.md",type:"demo",lang:"ts",componentName:"ChartTimelineMaxAxisComponent",point:1},{id:"chart-timeline-mask",meta:{order:2,title:{"zh-CN":"\u65f6\u95f4\u683c\u5f0f\u5316","en-US":"Time mask format"}},summary:"\u5229\u7528 mask
\u548c maskSlider
\u6765\u6539\u53d8\u65f6\u95f4\u683c\u5f0f\u3002
",code:"import { Component, OnInit } from '@angular/core';\nimport { G2TimelineClickItem, G2TimelineData } from '@delon/chart/timeline';\nimport { NzMessageService } from 'ng-zorro-antd/message';\n\n@Component({\n selector: 'chart-timeline-mask',\n template: ` `,\n})\nexport class ChartTimelineMaskComponent implements OnInit {\n chartData: G2TimelineData[] = [];\n\n constructor(private msg: NzMessageService) {}\n\n ngOnInit(): void {\n for (let i = 0; i < 20; i += 1) {\n this.chartData.push({\n time: new Date().getTime() + 1000 * 60 * 60 * 24 * i,\n y1: Math.floor(Math.random() * 100) + 1000,\n y2: Math.floor(Math.random() * 100) + 10,\n });\n }\n }\n\n handleClick(data: G2TimelineClickItem): void {\n this.msg.info(`\u5ba2\u6d41\u91cf: ${data.item.y1}, \u652f\u4ed8\u7b14\u6570: ${data.item.y2}`);\n }\n}",name:"mask",urls:"packages/chart/timeline/demo/mask.md",type:"demo",lang:"ts",componentName:"ChartTimelineMaskComponent",point:2}]}static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["app-chart-timeline"]],decls:9,vars:9,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","24"],[3,"item"]],template:function(a,o){1&a&&(t.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),t._UZ(4,"chart-timeline-basic"),t.qZA(),t.TgZ(5,"code-box",3),t._UZ(6,"chart-timeline-max-axis"),t.qZA(),t.TgZ(7,"code-box",3),t._UZ(8,"chart-timeline-mask"),t.qZA()()()()),2&a&&(t.Q6J("codes",o.codes)("item",o.item),t.xp6(1),t.Q6J("nzGutter",16),t.xp6(2),t.Q6J("item",o.codes[0]),t.uIk("id",o.codes[0].id),t.xp6(2),t.Q6J("item",o.codes[1]),t.uIk("id",o.codes[1].id),t.xp6(2),t.Q6J("item",o.codes[2]),t.uIk("id",o.codes[2].id))},dependencies:[c.t3,c.SK,s.P,l.e,gt,vt,ft],styles:["[_nghost-%COMP%]{display:block}"]})}return n})(),Ct=(()=>{class n{static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["chart-trend-basic"]],decls:4,vars:0,consts:[["flag","up"],["flag","down",1,"ml-sm"]],template:function(a,o){1&a&&(t.TgZ(0,"trend",0),t._uU(1,"12%"),t.qZA(),t.TgZ(2,"trend",1),t._uU(3,"11%"),t.qZA())},dependencies:[y._],encapsulation:2})}return n})(),yt=(()=>{class n{static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["chart-trend-reverse"]],decls:4,vars:0,consts:[["flag","up","reverseColor",""],["flag","down","reverseColor","",1,"ml-sm"]],template:function(a,o){1&a&&(t.TgZ(0,"trend",0),t._uU(1,"12%"),t.qZA(),t.TgZ(2,"trend",1),t._uU(3,"11%"),t.qZA())},dependencies:[y._],encapsulation:2})}return n})(),kt=(()=>{class n{constructor(){this.item={cols:1,urls:{"zh-CN":"packages/chart/trend/index.md"},content:{"zh-CN":{content:'\u8d8b\u52bf\u7b26\u53f7\uff0c\u6807\u8bb0\u4e0a\u5347\u548c\u4e0b\u964d\u8d8b\u52bf\u3002\u901a\u5e38\u7528\u7eff\u8272\u4ee3\u8868\u201c\u597d\u201d\uff0c\u7ea2\u8272\u4ee3\u8868\u201c\u4e0d\u597d\u201d\uff0c\u80a1\u7968\u6da8\u8dcc\u573a\u666f\u9664\u5916\u3002
',api:'API
trend
\u6210\u5458 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [colorful]
\u662f\u5426\u5f69\u8272\u6807\u8bb0 boolean
true
[flag]
\u4e0a\u5347\u4e0b\u964d\u6807\u8bc6 \'up\',\'down\'
- [reverseColor]
\u989c\u8272\u53cd\u8f6c boolean
false
',meta:{type:"G2",title:"trend",subtitle:"\u8d8b\u52bf\u6807\u8bb0",cols:1,module:"import { TrendModule } from '@delon/chart/trend';"},toc:[{id:"API",title:"API",h:2,children:[{id:"trend",title:"trend",h:3}]}]}},demo:!0},this.codes=[{id:"chart-trend-basic",meta:{order:0,title:"\u6f14\u793a"},summary:"\u5728\u6570\u503c\u80cc\u540e\u6dfb\u52a0\u4e00\u4e2a\u5c0f\u56fe\u6807\u6765\u6807\u8bc6\u6da8\u8dcc\u60c5\u51b5\u3002
",code:'import { Component } from \'@angular/core\';\n\n@Component({\n selector: \'chart-trend-basic\',\n template: `\n 12% \n 11% \n `,\n})\nexport class ChartTrendBasicComponent {}',name:"basic",urls:"packages/chart/trend/demo/basic.md",type:"demo",lang:"ts",componentName:"ChartTrendBasicComponent",point:0},{id:"chart-trend-reverse",meta:{order:1,title:"\u989c\u8272\u53cd\u8f6c"},summary:"\u5728\u6570\u503c\u80cc\u540e\u6dfb\u52a0\u4e00\u4e2a\u5c0f\u56fe\u6807\u6765\u6807\u8bc6\u6da8\u8dcc\u60c5\u51b5\u3002
",code:'import { Component } from \'@angular/core\';\n\n@Component({\n selector: \'chart-trend-reverse\',\n template: `\n 12% \n 11% \n `,\n})\nexport class ChartTrendReverseComponent {}',name:"reverse",urls:"packages/chart/trend/demo/reverse.md",type:"demo",lang:"ts",componentName:"ChartTrendReverseComponent",point:1}]}static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["app-chart-trend"]],decls:7,vars:7,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","24"],[3,"item"]],template:function(a,o){1&a&&(t.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),t._UZ(4,"chart-trend-basic"),t.qZA(),t.TgZ(5,"code-box",3),t._UZ(6,"chart-trend-reverse"),t.qZA()()()()),2&a&&(t.Q6J("codes",o.codes)("item",o.item),t.xp6(1),t.Q6J("nzGutter",16),t.xp6(2),t.Q6J("item",o.codes[0]),t.uIk("id",o.codes[0].id),t.xp6(2),t.Q6J("item",o.codes[1]),t.uIk("id",o.codes[1].id))},dependencies:[c.t3,c.SK,s.P,l.e,Ct,yt],styles:["[_nghost-%COMP%]{display:block}"]})}return n})();var qt=i(64755);let Mt=(()=>{class n{static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["chart-water-wave-basic"]],hostVars:2,hostBindings:function(a,o){2&a&&t.ekj("d-block",!0)},decls:1,vars:3,consts:[[3,"title","percent","height"]],template:function(a,o){1&a&&t._UZ(0,"g2-water-wave",0),2&a&&t.Q6J("title","\u8865\u8d34\u8d44\u91d1\u5269\u4f59")("percent",34)("height",161)},dependencies:[qt.u],encapsulation:2})}return n})();const Lt=[{path:"",component:At.S,children:[{path:"",redirectTo:"getting-started/zh",pathMatch:"full"},{path:"faq",redirectTo:"faq/zh",pathMatch:"full"},{path:"faq/:lang",component:x},{path:"getting-started",redirectTo:"getting-started/zh",pathMatch:"full"},{path:"getting-started/:lang",component:w},{path:"bar",redirectTo:"bar/zh",pathMatch:"full"},{path:"bar/:lang",component:I},{path:"card",redirectTo:"card/zh",pathMatch:"full"},{path:"card/:lang",component:Z},{path:"chart-echarts",redirectTo:"chart-echarts/zh",pathMatch:"full"},{path:"chart-echarts/:lang",component:J},{path:"custom",redirectTo:"custom/zh",pathMatch:"full"},{path:"custom/:lang",component:O},{path:"gauge",redirectTo:"gauge/zh",pathMatch:"full"},{path:"gauge/:lang",component:$},{path:"mini-area",redirectTo:"mini-area/zh",pathMatch:"full"},{path:"mini-area/:lang",component:X},{path:"mini-bar",redirectTo:"mini-bar/zh",pathMatch:"full"},{path:"mini-bar/:lang",component:V},{path:"mini-progress",redirectTo:"mini-progress/zh",pathMatch:"full"},{path:"mini-progress/:lang",component:tt},{path:"number-info",redirectTo:"number-info/zh",pathMatch:"full"},{path:"number-info/:lang",component:ot},{path:"pie",redirectTo:"pie/zh",pathMatch:"full"},{path:"pie/:lang",component:ct},{path:"radar",redirectTo:"radar/zh",pathMatch:"full"},{path:"radar/:lang",component:lt},{path:"single-bar",redirectTo:"single-bar/zh",pathMatch:"full"},{path:"single-bar/:lang",component:ht},{path:"tag-cloud",redirectTo:"tag-cloud/zh",pathMatch:"full"},{path:"tag-cloud/:lang",component:ut},{path:"timeline",redirectTo:"timeline/zh",pathMatch:"full"},{path:"timeline/:lang",component:bt},{path:"trend",redirectTo:"trend/zh",pathMatch:"full"},{path:"trend/:lang",component:kt},{path:"water-wave",redirectTo:"water-wave/zh",pathMatch:"full"},{path:"water-wave/:lang",component:(()=>{class n{constructor(){this.item={cols:1,urls:{"zh-CN":"packages/chart/water-wave/index.md"},content:{"zh-CN":{content:'\u6c34\u6ce2\u56fe\u662f\u4e00\u79cd\u6bd4\u4f8b\u7684\u5c55\u793a\u65b9\u5f0f\uff0c\u53ef\u4ee5\u66f4\u76f4\u89c2\u7684\u5c55\u793a\u5173\u952e\u503c\u7684\u5360\u6bd4\u3002
\u9ed8\u8ba4\u4e0d\u652f\u6301\u7236\u5143\u7d20\u81ea\u9002\u5e94\uff0c\u53ef\u4ee5\u76d1\u542c\u7236\u5143\u7d20\u7684\u53d8\u5316\u5e76\u4f7f\u7528 render()
\u65b9\u6cd5\u6765\u91cd\u7f6e\u6e32\u67d3\u3002
',api:'API
g2-water-wave
\u53c2\u6570 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [animate]
\u662f\u5426\u663e\u793a\u52a8\u753b boolean
true
[delay]
\u5ef6\u8fdf\u6e32\u67d3\uff0c\u5355\u4f4d\uff1a\u6beb\u79d2 number
0
[title]
\u56fe\u8868\u6807\u9898 string,TemplateRef<void>
- [height]
\u56fe\u8868\u9ad8\u5ea6 number
160
[color]
\u56fe\u8868\u989c\u8272 string
#1890FF
[percent]
\u8fdb\u5ea6\u6bd4\u4f8b number
-
',meta:{title:"g2-water-wave",subtitle:"\u6c34\u6ce2\u56fe",cols:1,type:"G2",module:"import { G2WaterWaveModule } from '@delon/chart/water-wave';"},toc:[{id:"API",title:"API",h:2,children:[{id:"g2-water-wave",title:"g2-water-wave",h:3}]}]}},demo:!0},this.codes=[{id:"chart-water-wave-basic",meta:{order:0,title:{"zh-CN":"\u57fa\u7840","en-US":"Basic"}},summary:"\u57fa\u7840\u7528\u6cd5\u3002
",code:"import { Component } from '@angular/core';\n\n@Component({\n selector: 'chart-water-wave-basic',\n template: `\n \n `,\n host: {\n '[class.d-block]': 'true'\n }\n})\nexport class ChartWaterWaveBasicComponent {}",name:"basic",urls:"packages/chart/water-wave/demo/basic.md",type:"demo",lang:"ts",componentName:"ChartWaterWaveBasicComponent",point:0}]}static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275cmp=t.Xpm({type:n,selectors:[["app-chart-water-wave"]],decls:5,vars:5,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","24"],[3,"item"]],template:function(a,o){1&a&&(t.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),t._UZ(4,"chart-water-wave-basic"),t.qZA()()()()),2&a&&(t.Q6J("codes",o.codes)("item",o.item),t.xp6(1),t.Q6J("nzGutter",16),t.xp6(2),t.Q6J("item",o.codes[0]),t.uIk("id",o.codes[0].id))},dependencies:[c.t3,c.SK,s.P,l.e,Mt],styles:["[_nghost-%COMP%]{display:block}"]})}return n})()}]}];let Xt=(()=>{class n{static#t=this.\u0275fac=function(a){return new(a||n)};static#e=this.\u0275mod=t.oAB({type:n});static#a=this.\u0275inj=t.cJS({imports:[zt.m,Dt.Bz.forChild(Lt)]})}return n})()}}]);
\ No newline at end of file
diff --git a/311.640905cecd79cc2d.js b/311.640905cecd79cc2d.js
new file mode 100644
index 0000000000..00ba8305a2
--- /dev/null
+++ b/311.640905cecd79cc2d.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunksite=self.webpackChunksite||[]).push([[311],{30311:(E,l,s)=>{s.r(l),s.d(l,{DocsModule:()=>F});var R=s(52787),G=s(89359),O=s(93285),a=s(65879),i=s(28749);const D=[{path:"",component:O.S,children:[{path:"",redirectTo:"getting-started/zh",pathMatch:"full"},{path:"acl",redirectTo:"acl/zh",pathMatch:"full"},{path:"acl/:lang",component:(()=>{class e{constructor(){this.item={cols:1,urls:{"zh-CN":"docs/acl.md"},content:{"zh-CN":{content:' ',meta:{order:50,title:"ACL",type:"Advance",url:"/acl/getting-started"},toc:[]}},demo:!1},this.codes=[]}static#e=this.\u0275fac=function(t){return new(t||e)};static#t=this.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-acl"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,o){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",o.codes)("item",o.item)},dependencies:[i.P],styles:["[_nghost-%COMP%]{display:block}"]})}return e})()},{path:"architecture",redirectTo:"architecture/zh",pathMatch:"full"},{path:"architecture/:lang",component:(()=>{class e{constructor(){this.item={cols:1,urls:{"en-US":"docs/architecture.en-US.md","zh-CN":"docs/architecture.zh-CN.md"},content:{"en-US":{content:'NG-ALAIN scaffold is a front-end solution to support middleware and back-end application. It is based on Angular and ng-zorro-antd(Angular implementation of Ant Design). The scaffold includes a set of common functionalities and business component libraries. It reduces lots of infrastructure development overwhelmingly and let you focus on business logic development.
Architecture Diagram
@delon/theme
Theme library of scaffold, we publish the theme library to NPM, which extremely simplifies upgrade effort.
Theme library includes not only essential styles(CSS tool like bootstrap) required by NG-ALAIN, but also a set of common data rendering(Pipe) and service tools(page title, scroll bar, etc..), which are needed during daily development.
@delon/abc
Scaffold provides a default set of business components, which abstract commonly used block/area in console service. We will continue to maintain and iterate the components. Provide more advanced abstract components than Ant Design base components to middleware and back-end business.
@delon/chart
@delon/chart chart library is customised based on G2. Providing commonly used chart suite in business development. It can be used alone or composed together to achieve more complex and fancy display effect.
@delon/form
@delon/form follows standard of JSON Schema to build dynamic forms.
@delon/auth
User Authentication module is used for resolving steps to obtain, save and use authentication.
@delon/acl
ACL Access Control List is a very simple role based permission control. It can even reach the granularity of controlling the visibility of a button.
@delon/cache
Reduce the Http request by storing cache of the dictionary, city data, etc. into memory or persistence storage.
@delon/mock
Mock will intercept Angular HTTP request and return testing data.
@delon/util
Daily Utilities\u3002
@delon/testing
Commonly used testing suite.
CLI Schematics
Directory Structure
Schematic diagram of directory structure\uff1a
\u251c\u2500\u2500 _mock # Mock Data rule\n\u251c\u2500\u2500 src\n\u2502\xa0\xa0 \u251c\u2500\u2500 app\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 core # Core module\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 i18n\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 net\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 default.interceptor.ts # Default HTTP interceptor\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 services\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 startup.service.ts # Initialize project configuration\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 core.module.ts # Core module file\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 layout # Core layout\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 routes\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 ** # Business directory\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 routes.module.ts # Service routing module\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 routes-routing.module.ts # Service routes registration\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 shared # Shared module\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 shared-delon.module.ts # @Delon/* import of secondary shared modules\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 shared-zorro.module.ts # NG-ZORRO import of secondary shared modules\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 shared.module.ts # Shared module file\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 app.component.ts # Root component\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 app.module.ts # Root module\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 global-config.module.ts # @delon & ng-zorro global config\n\u2502\xa0\xa0 \u251c\u2500\u2500 assets # Local static resource\n\u2502\xa0\xa0 \u251c\u2500\u2500 environments # Environment variable configuration\n\u2502\xa0\xa0 \u251c\u2500\u2500 styles # Style directory\n\u2514\u2500\u2500 \u2514\u2500\u2500 style.less # Style guide entry
The following is a description and use of each directory and file.
_mock
The Mock data rules directory, if you create a project via Command Line Tools, you can specify the --mock
parameter to determine if the Mock function is required.
src/app/core/core.module.ts
The core module will only be imported once. Therefore, core service classes (eg, messages, data access, etc.) that are required for the entire ** business module should exist here.
src/app/core/i18n
Internationalization data loading and processing related classes. If you create a project via Command Line Tool, you can specify the -di
parameter to determine whether internationalization support is required.
src/app/core/net
The default interceptor, where you can handle request parameters, request exceptions, business exceptions, and so on.
src/app/core/services/startup.service.ts
Useful when you need to execute some remote data (eg application information, user information, etc.) before Angular launches.
It is a simple method and returns a Promise
object, unless Angular will abort the launch unless resolve(null)
is explicitly executed.
src/app/layout
Layout file code, refer to the page structure section.
src/app/routes
Business module, all your business code will be here.
src/app/shared/shared.module.ts
The shared module means that some third-party modules, custom components, and custom instructions that you need to use for the entire business module should exist here. In addition, for @delon & NG-ZORRO, two shared secondary module imports, shared-delon.module.ts
andshared-zorro.module.ts
.
src/app/global-config.module.ts
Global configuration for @delon & NG-ZORRO.
src/environments
The application environment variable contains the following values:
SERVER_URL
All HTTP request prefixes
production
Whether the production environment
useHash
Whether the route is useHash mode
<
',meta:{order:20,title:"Architecture",type:"Basic",i18n:"need-update"},toc:[{id:"ArchitectureDiagram",title:"Architecture Diagram",h:2},{id:"DirectoryStructure",title:"Directory Structure",h:2}]},"zh-CN":{content:'NG-ALAIN \u76ee\u6807\u662f\u63d0\u4f9b\u66f4\u591a\u901a\u7528\u6027\u4e1a\u52a1\u6a21\u5757\uff0c\u8ba9\u5f00\u53d1\u8005\u66f4\u52a0\u4e13\u6ce8\u4e8e\u4e1a\u52a1\u3002\u6240\u4ee5\u5728\u4f60\u7740\u624b\u5f00\u59cb\u5f00\u53d1\u524d\uff0c\u6709\u5fc5\u8981\u4e86\u89e3\u6574\u4e2a NG-ALAIN \u7684\u4f53\u7cfb\u7ed3\u6784\uff0c\u4ece\u6574\u4f53\u4e0a\u4e86\u89e3 NG-ALAIN \u5305\u542b\u4e86\u54ea\u4e9b\u4e1c\u897f\u53ca\u5176\u542b\u4e49\uff0c\u624d\u80fd\u66f4\u597d\u7684\u5229\u7528\u8fd9\u4e9b\u4e1a\u52a1\u7ec4\u4ef6\u5e93\u5feb\u901f\u6784\u5efa\u9879\u76ee\u3002
\u7ed3\u6784\u56fe
\u7c7b\u5e93 \u6587\u6863 \u63cf\u8ff0 @delon/theme \u6587\u6863 \u4e3b\u9898\u7cfb\u7edf\u9664\u4e86\u5305\u542b NG-ALAIN \u57fa\u7840\u6846\u67b6\u53ca\u6240\u9700\u6837\u5f0f\uff08\u5305\u542bCSS\u5de5\u5177\u96c6\uff0c\u4e00\u5957\u7c7b\u4f3cBootstrap\uff09\u4ee5\u5916\uff0c\u8fd8\u5305\u542b\u4e00\u4e9b\u901a\u7528\u7684\u6570\u636e\u6e32\u67d3\uff08Pipe\uff09\u3001\u670d\u52a1\u5de5\u5177\u7c7b\uff08\u9875\u9762\u6807\u9898\u3001\u6eda\u52a8\u6761\u7b49\uff09\u7684\u96c6\u5408\uff0c\u8fd9\u4e9b\u662f\u65e5\u5e38\u5fc5\u4e0d\u53ef\u5c11\u7684\u4e00\u4e9b\u7ec4\u6210 @delon/abc \u6587\u6863 \u811a\u624b\u67b6\u5185\u63d0\u4f9b\u4e86\u4e00\u5957\u9ed8\u8ba4\u4e1a\u52a1\u7ec4\u4ef6\uff0c\u8fd9\u4e9b\u7ec4\u4ef6\u62bd\u8c61\u4e86\u63a7\u5236\u53f0\u4e1a\u52a1\u4e2d\u7684\u4e00\u4e9b\u5e38\u89c1\u533a\u5757\u3002\u6211\u4eec\u5c06\u6301\u7eed\u7ef4\u62a4\u548c\u8fed\u4ee3\u8fd9\u4e9b\u7ec4\u4ef6\uff0c\u4e3a\u4e2d\u540e\u53f0\u4e1a\u52a1\u63d0\u4f9b\u6bd4 Ant Design \u57fa\u7840\u7ec4\u4ef6\u66f4\u9ad8\u7ea7\u522b\u7684\u62bd\u8c61 @delon/chart \u6587\u6863 \u57fa\u4e8e G2 \u7684\u57fa\u7840\u4e0a\u4e8c\u6b21\u5c01\u88c5\uff0c\u63d0\u4f9b\u4e86\u4e1a\u52a1\u4e2d\u5e38\u7528\u7684\u56fe\u8868\u5957\u4ef6\uff0c\u53ef\u4ee5\u5355\u72ec\u4f7f\u7528\uff0c\u4e5f\u53ef\u4ee5\u7ec4\u5408\u8d77\u6765\u5b9e\u73b0\u590d\u6742\u7684\u5c55\u793a\u6548\u679c @delon/form \u6587\u6863 \u57fa\u4e8e JSON Schema \u6807\u51c6\u7684\u52a8\u6001\u6784\u5efa\u8868\u5355 @delon/auth \u6587\u6863 \u7528\u6237\u8ba4\u8bc1\u6a21\u5757\uff0c\u7528\u4e8e\u89e3\u51b3\u5982\u4f55\u83b7\u53d6\u3001\u5b58\u53d6\u3001\u4f7f\u7528\u8fd9\u4e09\u4e2a\u6b65\u9aa4\u7684\u7528\u6237\u8ba4\u8bc1\u73af\u8282 @delon/acl \u6587\u6863 \u8bbf\u95ee\u63a7\u5236\u5217\u8868\uff0c\u662f\u4e00\u79cd\u975e\u5e38\u7b80\u5355\u7684\u57fa\u4e8e\u89d2\u8272\u6743\u9650\u63a7\u5236\uff0c\u751a\u81f3\u8fbe\u5230\u63a7\u5236\u67d0\u4e2a\u6309\u94ae\u663e\u9690\u7684\u7c92\u5ea6 @delon/cache \u6587\u6863 \u5c06\u5b57\u5178\u3001\u57ce\u5e02\u6570\u636e\u7b49\u7f13\u5b58\u81f3\u5185\u5b58\u6216\u6301\u4e45\u5316\u5f53\u4e2d\uff0c\u6709\u6548\u51cf\u5c11 Http \u8bf7\u6c42 @delon/mock \u6587\u6863 Mock \u4f1a\u62e6\u622a Angular Http \u8bf7\u6c42\u5e76\u8fd4\u56de\u6d4b\u8bd5\u6570\u636e\uff0c\u5f53\u540e\u7aef\u672a\u5b8c\u6210\u63a5\u53e3\u65f6 Mock \u6280\u672f\u662f\u4e00\u9879\u4e0d\u4f1a\u5f71\u54cd\u524d\u7aef\u5f00\u53d1\u8fdb\u5ea6\u7684\u5de5\u5177 @delon/util \u6587\u6863 \u5305\u542b\u6570\u7ec4\u3001\u5ef6\u8fdf\u3001\u5b57\u7b26\u4e32\u3001\u65e5\u671f\u3001\u6821\u9a8c\u7b49\u5e38\u89c1\u5de5\u5177\u96c6 @delon/testing - \u5e38\u7528\u6d4b\u8bd5\u5957\u4ef6 CLI Schematics \u6587\u6863 \u5feb\u901f\u751f\u6210\u7edf\u4e00\u7684\u6a21\u677f\u3001\u53ef\u63d2\u62d4\u7684\u63d2\u4ef6\u7b49
\u76ee\u5f55\u7ed3\u6784
\u5f53\u4f7f\u7528 ng add ng-alain
\u751f\u6210\u540e\u7684 NG-ALAIN \u811a\u624b\u67b6\uff0c\u5b83\u7684\u57fa\u672c\u76ee\u5f55\u7ed3\u6784\u6982\u7565\u56fe\u5982\u4e0b\uff1a
\u251c\u2500\u2500 _mock # Mock \u6570\u636e\u89c4\u5219\u76ee\u5f55\n\u251c\u2500\u2500 angular.json # Angular \u9879\u76ee\u914d\u7f6e\u6587\u4ef6\n\u251c\u2500\u2500 src\n\u2502\xa0\xa0 \u251c\u2500\u2500 app\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 core # \u6838\u5fc3\u6a21\u5757\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 i18n\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 net\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 default.interceptor.ts # \u9ed8\u8ba4HTTP\u62e6\u622a\u5668\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 services\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 startup.service.ts # \u521d\u59cb\u5316\u9879\u76ee\u914d\u7f6e\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 core.module.ts # \u6838\u5fc3\u6a21\u5757\u6587\u4ef6\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 layout # \u901a\u7528\u5e03\u5c40\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 routes\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 ** # \u4e1a\u52a1\u76ee\u5f55\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 routes.module.ts # \u4e1a\u52a1\u8def\u7531\u6a21\u5757\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 routes-routing.module.ts # \u4e1a\u52a1\u8def\u7531\u6ce8\u518c\u53e3\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 shared # \u5171\u4eab\u6a21\u5757\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 shared-delon.module.ts # @Delon/* \u6b21\u7ea7\u5171\u4eab\u6a21\u5757\u5bfc\u5165\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 shared-zorro.module.ts # NG-ZORRO \u6b21\u7ea7\u5171\u4eab\u6a21\u5757\u5bfc\u5165\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 shared.module.ts # \u5171\u4eab\u6a21\u5757\u6587\u4ef6\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 app.component.ts # \u6839\u7ec4\u4ef6\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 app.module.ts # \u6839\u6a21\u5757\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 global-config.module.ts # @delon & ng-zorro \u5168\u5c40\u914d\u7f6e\u9879\n\u2502\xa0\xa0 \u251c\u2500\u2500 assets # \u672c\u5730\u9759\u6001\u8d44\u6e90\n\u2502\xa0\xa0 \u251c\u2500\u2500 environments # \u73af\u5883\u53d8\u91cf\u914d\u7f6e\n\u2502\xa0\xa0 \u251c\u2500\u2500 styles # \u6837\u5f0f\u76ee\u5f55\n\u2514\u2500\u2500 \u2514\u2500\u2500 style.less # \u6837\u5f0f\u5f15\u5bfc\u5165\u53e3
\u4ee5\u4e0b\u662f\u9488\u5bf9\u5404\u4e2a\u76ee\u5f55\u53ca\u6587\u4ef6\u8bf4\u660e\u53ca\u4f7f\u7528\u76ee\u7684\uff1a
\u540d\u79f0 \u63cf\u8ff0 angular.json Angular \u5de5\u4f5c\u533a\u53ca\u9879\u76ee\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u53c2\u8003Angular\u6587\u6863 _mock Mock \u6570\u636e\u89c4\u5219\u76ee\u5f55\uff0c\u82e5\u4f60\u901a\u8fc7 \u547d\u4ee4\u884c\u5de5\u5177 \u521b\u5efa\u9879\u76ee\u65f6\u53ef\u4ee5\u6307\u5b9a --mock
\u53c2\u6570\u51b3\u5b9a\u662f\u5426\u9700\u8981 Mock \u529f\u80fd src/app/core/core.module.ts \u6838\u5fc3\u6a21\u5757\uff0c\u53ea\u4f1a\u5bfc\u5165\u4e00\u6b21\u3002\u56e0\u6b64\uff0c\u9488\u5bf9\u6574\u4e2a\u4e1a\u52a1\u6a21\u5757\u90fd\u9700\u8981\u4f7f\u7528\u7684\u7eaf\u670d\u52a1\u7c7b\uff08\u4f8b\u5982\uff1a\u6d88\u606f\u3001\u6570\u636e\u8bbf\u95ee\u7b49\uff09 src/app/core/i18n \u56fd\u9645\u5316\u6570\u636e\u52a0\u8f7d\u53ca\u5904\u7406\u76f8\u5173\u7c7b\uff0c\u82e5\u4f60\u901a\u8fc7 \u547d\u4ee4\u884c\u5de5\u5177 \u521b\u5efa\u9879\u76ee\u65f6\u53ef\u4ee5\u6307\u5b9a -di
\u53c2\u6570\u51b3\u5b9a\u662f\u5426\u9700\u8981\u56fd\u9645\u5316\u652f\u6301 src/app/core/net \u9ed8\u8ba4\u62e6\u622a\u5668\uff0c\u4f60\u53ef\u4ee5\u5728\u8fd9\u91cc\u7edf\u4e00\u5904\u7406\u8bf7\u6c42\u53c2\u6570\u3001\u8bf7\u6c42\u5f02\u5e38\u3001\u4e1a\u52a1\u5f02\u5e38\u7b49\u52a8\u4f5c src/app/core/services/startup.service.ts \u5f53\u4f60\u9700\u8981\u5728 Angular \u542f\u52a8\u524d\u6267\u884c\u4e00\u4e9b\u8fdc\u7a0b\u6570\u636e\uff08\u4f8b\u5982\uff1a\u5e94\u7528\u4fe1\u606f\u3001\u7528\u6237\u4fe1\u606f\u7b49\uff09\u65f6\u975e\u5e38\u6709\u7528 src/app/layout \u5e03\u5c40\u76ee\u5f55\uff0c\u5305\u542b\u57fa\u7840\u5e03\u5c40\u3001\u7a7a\u767d\u5e03\u5c40\u3001\u7528\u6237\u767b\u5f55\u5e03\u5c40 src/app/routes \u4e1a\u52a1\u6a21\u5757\uff0c\u4f60\u7684\u6240\u6709\u4e1a\u52a1\u4ee3\u7801\u90fd\u5c06\u5728\u8fd9\u91cc src/app/shared/shared.module.ts \u5171\u4eab\u6a21\u5757\uff0c\u6307\u5f53\u4f60\u9700\u8981\u9488\u5bf9\u6574\u4e2a\u4e1a\u52a1\u6a21\u5757\u90fd\u9700\u8981\u4f7f\u7528\u7684\u4e00\u4e9b\u7b2c\u4e09\u65b9\u6a21\u5757\u3001\u81ea\u5b9a\u4e49\u7ec4\u4ef6\u3001\u81ea\u5b9a\u4e49\u6307\u4ee4\uff0c\u90fd\u5e94\u8be5\u5b58\u5728\u8fd9\u91cc\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u9488\u5bf9 @delon & NG-ZORRO \u5206\u522b\u6784\u5efa\u4e86 shared-delon.module.ts
\u3001shared-zorro.module.ts
\u4e24\u79cd\u6b21\u7ea7\u5171\u4eab\u6a21\u5757\u7684\u5bfc\u5165\u3002 src/app/global-config.module.ts \u9488\u5bf9 @delon & NG-ZORRO \u7684\u5168\u5c40\u914d\u7f6e\u9879 src/environments \u5e94\u7528\u73af\u5883\u53d8\u91cf\uff0c\u5305\u542b\u4ee5\u4e0b\u503c\uff1aSERVER_URL
\u6240\u6709HTTP\u8bf7\u6c42\u7684\u524d\u7f00\uff1bproduction
\u662f\u5426\u751f\u4ea7\u73af\u5883\uff1buseHash
\u8def\u7531\u662f\u5426useHash\u6a21\u5f0f ',meta:{order:20,title:"\u4f53\u7cfb\u7ed3\u6784",type:"Basic",i18n:"need-update"},toc:[{id:"\u7ed3\u6784\u56fe",title:"\u7ed3\u6784\u56fe",h:2},{id:"\u76ee\u5f55\u7ed3\u6784",title:"\u76ee\u5f55\u7ed3\u6784",h:2}]}},demo:!1},this.codes=[]}static#e=this.\u0275fac=function(t){return new(t||e)};static#t=this.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-architecture"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,o){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",o.codes)("item",o.item)},dependencies:[i.P],styles:["[_nghost-%COMP%]{display:block}"]})}return e})()},{path:"auth",redirectTo:"auth/zh",pathMatch:"full"},{path:"auth/:lang",component:(()=>{class e{constructor(){this.item={cols:1,urls:{"zh-CN":"docs/auth.md"},content:{"zh-CN":{content:' ',meta:{order:40,title:{"en-US":"Auth","zh-CN":"\u7528\u6237\u8ba4\u8bc1"},type:"Advance",url:"/auth/getting-started"},toc:[]}},demo:!1},this.codes=[]}static#e=this.\u0275fac=function(t){return new(t||e)};static#t=this.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-auth"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,o){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",o.codes)("item",o.item)},dependencies:[i.P],styles:["[_nghost-%COMP%]{display:block}"]})}return e})()},{path:"cache",redirectTo:"cache/zh",pathMatch:"full"},{path:"cache/:lang",component:(()=>{class e{constructor(){this.item={cols:1,urls:{"zh-CN":"docs/cache.md"},content:{"zh-CN":{content:' ',meta:{order:70,title:{"en-US":"Cache","zh-CN":"\u7f13\u5b58"},type:"Advance",url:"/cache/getting-started"},toc:[]}},demo:!1},this.codes=[]}static#e=this.\u0275fac=function(t){return new(t||e)};static#t=this.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-cache"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,o){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",o.codes)("item",o.item)},dependencies:[i.P],styles:["[_nghost-%COMP%]{display:block}"]})}return e})()},{path:"changelog",redirectTo:"changelog/zh",pathMatch:"full"},{path:"changelog/:lang",component:(()=>{class e{constructor(){this.item={cols:1,urls:{"en-US":"docs/changelog.en-US.md","zh-CN":"docs/changelog.zh-CN.md"},content:{"en-US":{content:'NG-ALAIN strictly follows Semantic Versioning 2.0.0.
Release Schedule
Weekly release: patch version at the end of every week for routine bugfix (anytime for urgent bugfix).
Monthly release: minor version at the end of every month for new features.
Major version release is not included in this schedule for breaking change and new features.
16.4.0 (2023-10-19)
Bug Fixes
abc:st: correct width misalignment in export excel (#1655) (76db16c)
cli: missing fileReplacements
in Angular16 (#1658) (c5b46ee)
form:select: correct trigger onSearch in reset when set value (#1660) (fa234cd)
form: fix visibleIf
to correctly trigger reset
(#1653) (d80f8fb)
fix(form:widget:object): fix missing optional of card type (#1661) (ee96aaa)
Features
16.3.0 (2023-09-01)
SCAFFOLDING
enabled bindToComponentInputs
#2409.
Bug Fixes
abc:pdf: fix ignore dependency pdfjs-dist
(If you use local path to load the libary, you need to install the dependency yourself. pdfjs-dist
depends on canvas
, which may be slow to install dependencies due to environmental factors) (#1641) (#1641) (b987bab)
form:select: fix ignore reset option data when set onSearch
(#1644) (1f8def7)
theme:http: fix missing content
of HttpOptions
(#1640) (28eeceb)
Features
16.2.1 (2023-08-06)
Bug Fixes
16.2.0 (2023-07-21)
SCAFFOLDING
Bug Fixes
abc:onboarding: fix ComponentFactoryResolver
(#1624) (ae065c2)
cli: remove skipTests
from generating module (#1616) (0da83f8)
fix misalignment of col
placeholders in se
, sv
, sg
(#1617) (83b08c9)
Features
abc:st: add onCell
, support colSpan and rowSpan merging (#1613) (9ab109e)
abc:st: button support function method of icon
, className
(#1618) (6bf27da)
theme:layout-default: add fetching
property (#1614) (8446da6)
BREAKING CHANGE
acl: refactor ACLGuard
to aclCanMatch
, aclCanActivate
, aclCanActivateChild
auth:simple refactor SimpleGuard
to authSimpleCanMatch
, authSimpleCanActivate
, authSimpleCanActivateChild
auth:jtw refactor JWTGuard
to authJWTCanMatch
, authJWTCanActivate
, authJWTCanActivateChild
i18n refactor AlainI18NGuard
to alainI18nCanMatch
, alainI18nCanActivate
, alainI18nCanActivateChild
16.1.1 (2023-07-16)
Bug Fixes
Features
16.0.1 (2023-06-08)
fix ng-zorro-antd
dependency
16.0.0 (2023-06-07)
Bug Fixes
abc:st: fix error row class in fixed column title cell (#1598) (d2bf211)
form: fix inheriting references to other of ui (#1600) (a0150e7)
Old Versions
All releases notes can be found here
',meta:{order:100,title:"Change Log",type:"Other"},toc:[{id:"16.4.02023-10-19",title:"16.4.0 (2023-10-19)",h:1,children:[{id:"BugFixes",title:"Bug Fixes",h:3},{id:"Features",title:"Features",h:3}]},{id:"16.3.02023-09-01",title:"16.3.0 (2023-09-01)",h:1,children:[{id:"SCAFFOLDING",title:"SCAFFOLDING",h:3},{id:"BugFixes",title:"Bug Fixes",h:3},{id:"Features",title:"Features",h:3},{id:"16.2.12023-08-06",title:"16.2.1 (2023-08-06)",h:2},{id:"BugFixes",title:"Bug Fixes",h:3}]},{id:"16.2.02023-07-21",title:"16.2.0 (2023-07-21)",h:1,children:[{id:"SCAFFOLDING",title:"SCAFFOLDING",h:3},{id:"BugFixes",title:"Bug Fixes",h:3},{id:"Features",title:"Features",h:3},{id:"BREAKINGCHANGE",title:"BREAKING CHANGE",h:3}]},{id:"16.1.12023-07-16",title:"16.1.1 (2023-07-16)",h:1,children:[{id:"BugFixes",title:"Bug Fixes",h:3},{id:"Features",title:"Features",h:3},{id:"16.0.12023-06-08",title:"16.0.1 (2023-06-08)",h:2}]},{id:"16.0.02023-06-07",title:"16.0.0 (2023-06-07)",h:1,children:[{id:"BugFixes",title:"Bug Fixes",h:3},{id:"OldVersions",title:"Old Versions",h:2}]}]},"zh-CN":{content:'NG-ALAIN \u4e25\u683c\u9075\u5faa Semantic Versioning 2.0.0 \u8bed\u4e49\u5316\u7248\u672c\u89c4\u8303\u3002
\u53d1\u5e03\u5468\u671f
\u4fee\u8ba2\u7248\u672c\u53f7\uff1a\u6bcf\u5468\u672b\u4f1a\u8fdb\u884c\u65e5\u5e38 bugfix \u66f4\u65b0\u3002\uff08\u5982\u679c\u6709\u7d27\u6025\u7684 bugfix\uff0c\u5219\u4efb\u4f55\u65f6\u5019\u90fd\u53ef\u53d1\u5e03\uff09
\u6b21\u7248\u672c\u53f7\uff1a\u6bcf\u6708\u53d1\u5e03\u4e00\u4e2a\u5e26\u6709\u65b0\u7279\u6027\u7684\u5411\u4e0b\u517c\u5bb9\u7684\u7248\u672c\u3002
\u4e3b\u7248\u672c\u53f7\uff1a\u542b\u6709\u7834\u574f\u6027\u66f4\u65b0\u548c\u65b0\u7279\u6027\uff0c\u4e0d\u5728\u53d1\u5e03\u5468\u671f\u5185\u3002
16.4.0 (2023-10-19)
Bug Fixes
abc:onboarding: \u7ea0\u6b63\u6697\u9ed1\u98ce\u683c (#1650) (7a21933)
abc:st: \u7ea0\u6b63\u5bfc\u51fa Excel \u4e2d\u7684\u5bbd\u5ea6\u672a\u5bf9\u9f50\u95ee\u9898 (#1655) (76db16c)
cli: \u4fee\u590d Angular 16 \u4e0b ng new ng-alain
\u7f3a\u5931 fileReplacements
(#1658) (c5b46ee)
form:array: \u4fee\u590d ui
\u5c5e\u6027\u65e0\u6cd5\u5408\u5e76 ui (#1657) (6b3c711)
form:select: \u7ea0\u6b63\u6709\u9ed8\u8ba4\u503c\u65f6\u521d\u59cb\u5316\u65f6\u65e0\u6cd5\u89e6\u53d1 onSearch
(#1660) (fa234cd)
form: \u4fee\u590d\u8bbe\u7f6e visibleIf
\u89e6\u53d1\u65f6\u4e5f\u4f1a\u89e6\u53d1 reset
\u65b9\u6cd5 (#1653) (d80f8fb)
form: \u4fee\u590d\u6e32\u67d3UI\u4e0d\u5e94\u88ab\u7ee7\u627f(#1661) (ee96aaa)
fix(form:widget:object): \u4fee\u590d card
\u6837\u5f0f\u7f3a\u5931 optional
(#1661) (ee96aaa)
Features
abc:onboarding: \u65b0\u589e key
\u7528\u4e8e\u81ea\u52a8\u5224\u65ad\u662f\u5426\u53d1\u751f\u7248\u672c\u53d8\u5316 (#1652) (5edaa97)
abc:theme: \u7ea0\u6b63 ng-tag
\u5217\u8868\u6362\u884c\u95f4\u8ddd\u95ee\u9898 (#1647) (5da4ecb)
16.3.0 (2023-09-01)
SCAFFOLDING
\u542f\u7528 bindToComponentInputs
#2409.
Bug Fixes
abc:pdf: \u5ffd\u7565\u4f9d\u8d56 pdfjs-dist
\uff08\u82e5\u4f7f\u7528\u672c\u5730\u52a0\u8f7d\u6a21\u5f0f\uff0c\u9700\u8981\u81ea\u884c\u5b89\u88c5\u8be5\u4f9d\u8d56\uff0cpdfjs-dist
\u4f9d\u8d56\u4e86 canvas
\u53ef\u80fd\u4f1a\u56e0\u4e3a\u73af\u5883\u56e0\u7d20\u5b89\u88c5\u4f9d\u8d56\u5f88\u6162\uff09 (#1641) (b987bab)
form:select: \u5f53\u8bbe\u7f6e onSearch
\u65f6\u91cd\u7f6e\u6570\u636e\u65f6\u4f1a\u5ffd\u7565\u66f4\u65b0\u9884\u9009\u6570\u636e (#1644) (1f8def7)
theme:http: \u7ea0\u6b63 HttpOptions
\u7f3a\u5c11 content
(#1640) (28eeceb)
Features
abc:cell: \u65b0\u589e cell
\u5355\u5143\u683c\u6570\u636e\u7ec4\u4ef6 (#1530) (26023ca)
abc:page-header: \u65b0\u589e titleSub
\u5b50\u6807\u9898\u5c5e\u6027 (#1643) (79e229f)
abc:st: \u6807\u7b7e\u6216\u5fbd\u6807\u652f\u6301 tooltip
(#1634) (0e9006e)
abc:sv: \u65b0\u589e bordered
\u662f\u5426\u663e\u793a\u8fb9\u6846 (#1628) (ccfa5e1)
cli: ng add
\u5f00\u542f bindToComponentInputs
(#1630) (9717d9d)
theme:drawer: \u65b0\u589e closeAll
, openDrawers
\u65b9\u6cd5 (#1627) (bab3d0c)
theme:modal: \u652f\u6301\u767e\u5206\u6bd4\u5927\u5c0f (#1626) (8b52a08)
16.2.1 (2023-08-06)
Bug Fixes
abc:reuse-tab: \u4fee\u590d\u7f3a\u5c11\u5bfc\u51fa\u7f13\u5b58\u76f8\u5173 (#1633) (2c7def7)
auth:cookie: \u4fee\u590d\u8fc7\u671f\u503c\u5e94\u4e0e expires \u540c\u6b65 (#1636) (eca7bcb)
theme:table: \u4fee\u590d\u5355\u56fe\u50cf\u7684\u95f4\u8ddd\u95ee\u9898 (#1629) (994e2be)
theme:title: \u4fee\u590d\u5e94\u5ffd\u7565\u7a7a\u6807\u9898 (#1638) (c7bf339)
16.2.0 (2023-07-21)
SCAFFOLDING
\u8def\u7531\u5b88\u536b\u7684\u7834\u574f\u6027\u53d8\u66f4 #2407.
\u4ee3\u7801\u98ce\u683c\u53d8\u66f4 #2405.
Bug Fixes
abc:onboarding: \u4fee\u590d\u4f7f\u7528\u8fc7\u671f\u65b9\u6cd5 ComponentFactoryResolver
(#1624) (ae065c2)
chat:timeline: \u4fee\u590d y2
\u6307\u6807\u6570\u636e\u4e3a\u53ef\u9009 (#1622) (b565ddf)
cli: \u79fb\u9664\u751f\u6210\u6a21\u5757\u65f6\u5305\u542b\u65e0\u6548\u53c2\u6570 skipTests
(#1616) (0da83f8)
\u4fee\u590d col
\u5360\u4f4d\u7b26\u4e0d\u5bf9\u9f50\u95ee\u9898\uff0c\u6d89\u53ca se
, sv
, sg
\u7ec4\u4ef6 (#1617) (83b08c9)
theme:modal: \u4fee\u590d\u8fc7\u671f\u53c2\u6570 nzComponentParams
(#1615) (45863a1)
Features
abc:st: \u65b0\u589e onCell
\u65b9\u6cd5\u652f\u6301\u5408\u5e76\u5217\u6216\u884c (#1613) (9ab109e)
abc:st: \u65b0\u589e icon
, className
\u65b9\u6cd5\u652f\u6301\u52a8\u6001\u8c03\u6574 (#1618) (6bf27da)
theme:layout-default: \u65b0\u589e fetchingStrictly
, fetching
\u5c5e\u6027\u7528\u4e8e\u81ea\u4e3b\u53d7\u63a7\u9876\u90e8\u52a0\u8f7d\u52a8\u753b\u72b6\u6001 (#1614) (8446da6)
BREAKING CHANGE
acl: \u91cd\u6784 ACLGuard
\u4e3a aclCanMatch
, aclCanActivate
, aclCanActivateChild
auth:simple \u91cd\u6784 SimpleGuard
\u4e3a authSimpleCanMatch
, authSimpleCanActivate
, authSimpleCanActivateChild
auth:jtw \u91cd\u6784 JWTGuard
\u4e3a authJWTCanMatch
, authJWTCanActivate
, authJWTCanActivateChild
i18n \u91cd\u6784 AlainI18NGuard
\u4e3a alainI18nCanMatch
, alainI18nCanActivate
, alainI18nCanActivateChild
16.1.1 (2023-07-16)
Bug Fixes
cli: \u79fb\u9664\u8fc7\u671f\u5e93 stylelint-config-prettier
(#1606) (2ecc28b)
theme: \u4fee\u590d\u5ffd\u7565\u4e24\u4e2a nzType="link"
\u6309\u9519\u65f6\u95f4\u8ddd (#1605) (0fdd15d)
Features
abc:reuse-tab: \u65b0\u589e\u53ef\u81ea\u5b9a\u4e49\u7f13\u5b58\u5b58\u50a8 (#1609) (11599d9)
theme:modal: \u65b0\u589e\u652f\u6301\u62d6\u62fd\u53c2\u6570 drag
(#1607) (3cd73f7)
16.0.1 (2023-06-08)
\u4fee\u590d ng-zorro-antd
\u9519\u4f4d\u7248\u672c\u4f9d\u8d56
16.0.0 (2023-06-07)
Bug Fixes
abc:st: \u4fee\u590d\u56fa\u5b9a\u5217\u6837\u5f0f\u9519\u8bef (#1598) (d2bf211)
form: \u4fee\u590dui\u7531\u4e8e\u7ee7\u627f\u5173\u7cfb\u5bfc\u81f4\u91cd\u590d\u5f15\u7528 (#1600) (a0150e7)
\u5386\u53f2\u7248\u672c
\u5386\u53f2\u7248\u672c\u7684\u66f4\u65b0\u8bb0\u5f55\u53ef\u4ee5\u5728 Github',meta:{order:100,title:"\u66f4\u65b0\u65e5\u5fd7",type:"Other"},toc:[{id:"16.4.02023-10-19",title:"16.4.0 (2023-10-19)",h:1,children:[{id:"BugFixes",title:"Bug Fixes",h:3},{id:"Features",title:"Features",h:3}]},{id:"16.3.02023-09-01",title:"16.3.0 (2023-09-01)",h:1,children:[{id:"SCAFFOLDING",title:"SCAFFOLDING",h:3},{id:"BugFixes",title:"Bug Fixes",h:3},{id:"Features",title:"Features",h:3},{id:"16.2.12023-08-06",title:"16.2.1 (2023-08-06)",h:2},{id:"BugFixes",title:"Bug Fixes",h:3}]},{id:"16.2.02023-07-21",title:"16.2.0 (2023-07-21)",h:1,children:[{id:"SCAFFOLDING",title:"SCAFFOLDING",h:3},{id:"BugFixes",title:"Bug Fixes",h:3},{id:"Features",title:"Features",h:3},{id:"BREAKINGCHANGE",title:"BREAKING CHANGE",h:3}]},{id:"16.1.12023-07-16",title:"16.1.1 (2023-07-16)",h:1,children:[{id:"BugFixes",title:"Bug Fixes",h:3},{id:"Features",title:"Features",h:3},{id:"16.0.12023-06-08",title:"16.0.1 (2023-06-08)",h:2}]},{id:"16.0.02023-06-07",title:"16.0.0 (2023-06-07)",h:1,children:[{id:"BugFixes",title:"Bug Fixes",h:3},{id:"\u5386\u53f2\u7248\u672c",title:"\u5386\u53f2\u7248\u672c",h:2}]}]}},demo:!1},this.codes=[]}static#e=this.\u0275fac=function(t){return new(t||e)};static#t=this.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-changelog"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,o){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",o.codes)("item",o.item)},dependencies:[i.P],styles:["[_nghost-%COMP%]{display:block}"]})}return e})()},{path:"cli",redirectTo:"cli/zh",pathMatch:"full"},{path:"cli/:lang",component:(()=>{class e{constructor(){this.item={cols:1,urls:{"zh-CN":"docs/cli.md"},content:{"zh-CN":{content:' ',meta:{order:10,title:{"en-US":"Cli","zh-CN":"\u547d\u4ee4\u884c\u5de5\u5177"},type:"Other",url:"/cli/getting-started"},toc:[]}},demo:!1},this.codes=[]}static#e=this.\u0275fac=function(t){return new(t||e)};static#t=this.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-cli"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,o){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",o.codes)("item",o.item)},dependencies:[i.P],styles:["[_nghost-%COMP%]{display:block}"]})}return e})()},{path:"contributing",redirectTo:"contributing/zh",pathMatch:"full"},{path:"contributing/:lang",component:(()=>{class e{constructor(){this.item={cols:1,urls:{"en-US":"docs/contributing.en-US.md","zh-CN":"docs/contributing.zh-CN.md"},content:{"en-US":{content:'The following is a set of guidelines for contributing to ng-alain. Please spend several minutes in reading these guidelines before you create an issue or pull request.
Code of Conduct
We have adopted a Code of Conduct that we expect project participants to adhere to. Please read the full text so that you can understand what actions will and will not be tolerated.
Open Development
All work on ng-alain\u3001delon happens directly. Both core team members and external contributors send pull requests which go through the same review process.
Bugs
We are using GitHub Issues for bug tracing. The best way to get your bug fixed via GitHub Issues and provide a reprduction with this template.
Before you reporting a bug, please make sure you\'ve searched exists issues, and read our FAQ.
Proposing a Change
If you intend to change the public API or introduce new feature that via GitHub Issues.
Your First Pull Request
Working on your first Pull Request? You can learn how from this free video series:
How to Contribute to Open Source
To help you get your feet wet and get you familiar with our contribution process, we have a list of good first issues that contain bugs or small features that have a relatively limited scope. This is a great place to get started.
If you decide to fix an issue, please be sure to check the comment thread in case somebody is already working on a fix. If nobody is working on it at the moment, please leave a comment stating that you intend to work on it so other people don\u2019t accidentally duplicate your effort.
If somebody claims an issue but doesn\u2019t follow up for more than two weeks, it\u2019s fine to take over it but you should still leave a comment.
Sending a Pull Request
The core team is monitoring for pull requests. We will review your pull request and either merge it, request changes to it, or close it with an explanation.
Before submitting a pull request, please make sure the following is done:
Run yarn
in the repository root.
If you\u2019ve fixed a bug or added code that should be tested, add tests!
Ensure the test suite passes (npm run test
).
Make sure your code lints (npm run lint
). Tip: Lint runs automatically when you git commit
.
Make sure rebase your code to keep the history clean.
Make sure your commit message meet the guidelines
Development Workflow
After cloning ng-alain
or delon
, run yarn
to fetch its dependencies. Then, you can run several commands:
delon
npm run site
runs ng-alain.com website locally
npm run lint
checks the code style
npm run test
runs the complete test suite
npm run release
build packages relases
ng-alain
',meta:{order:40,title:"Contributing",type:"Other"},toc:[{id:"CodeofConduct",title:"Code of Conduct",h:2},{id:"OpenDevelopment",title:"Open Development",h:2},{id:"Bugs",title:"Bugs",h:2},{id:"ProposingaChange",title:"Proposing a Change",h:2},{id:"YourFirstPullRequest",title:"Your First Pull Request",h:2},{id:"SendingaPullRequest",title:"Sending a Pull Request",h:2},{id:"DevelopmentWorkflow",title:"Development Workflow",h:2,children:[{id:"delon",title:"delon",h:3},{id:"ng-alain",title:"ng-alain",h:3}]}]},"zh-CN":{content:'\u8fd9\u7bc7\u6307\u5357\u4f1a\u6307\u5bfc\u4f60\u5982\u4f55\u4e3a NG-ALAIN \u8d21\u732e\u4e00\u4efd\u81ea\u5df1\u7684\u529b\u91cf\uff0c\u8bf7\u5728\u4f60\u8981\u63d0 issue \u6216\u8005 pull request \u4e4b\u524d\u82b1\u51e0\u5206\u949f\u6765\u9605\u8bfb\u4e00\u904d\u8fd9\u7bc7\u6307\u5357\u3002
\u884c\u4e3a\u51c6\u5219
\u6211\u4eec\u6709\u4e00\u4efd \u884c\u4e3a\u51c6\u5219\uff0c\u5e0c\u671b\u6240\u6709\u7684\u8d21\u732e\u8005\u90fd\u80fd\u9075\u5b88\uff0c\u8bf7\u82b1\u65f6\u95f4\u9605\u8bfb\u4e00\u904d\u5168\u6587\u4ee5\u786e\u4fdd\u4f60\u80fd\u660e\u767d\u54ea\u4e9b\u662f\u53ef\u4ee5\u505a\u7684\uff0c\u54ea\u4e9b\u662f\u4e0d\u53ef\u4ee5\u505a\u7684\u3002
\u900f\u660e\u7684\u5f00\u53d1
\u6211\u4eec\u6240\u6709\u7684\u5de5\u4f5c\u90fd\u4f1a\u653e\u5728 ng-alain\u3001delon \u4e0a\u3002\u4e0d\u7ba1\u662f\u6838\u5fc3\u56e2\u961f\u7684\u6210\u5458\u8fd8\u662f\u5916\u90e8\u8d21\u732e\u8005\u7684 pull request \u90fd\u9700\u8981\u7ecf\u8fc7\u540c\u6837\u6d41\u7a0b\u7684 review\u3002
Bugs
\u6211\u4eec\u4f7f\u7528 GitHub Issues \u6765\u505a bug \u8ffd\u8e2a\u3002\u5982\u679c\u4f60\u60f3\u8981\u4f60\u53d1\u73b0\u7684 bug \u88ab\u5feb\u901f\u89e3\u51b3\uff0c\u6700\u597d\u7684\u529e\u6cd5\u5c31\u662f\u6309\u7167 issues \u5448\u73b0\u7684\u6a21\u677f\u8ba4\u771f\u586b\u5199\u6bcf\u4e00\u9879\uff1b\u5e76\u4e14\u80fd\u4f7f\u7528\u8fd9\u4e2a \u6a21\u677f \u6765\u63d0\u4f9b\u91cd\u73b0\u3002
\u5728\u4f60\u62a5\u544a\u4e00\u4e2a bug \u4e4b\u524d\uff0c\u8bf7\u5148\u786e\u4fdd\u5df2\u7ecf\u641c\u7d22\u8fc7\u5df2\u6709\u7684 issue \u548c\u9605\u8bfb\u4e86 \u6587\u6863\u7ad9\u3002
\u65b0\u589e\u529f\u80fd
\u5982\u679c\u4f60\u6709\u6539\u8fdb\u6211\u4eec\u7684 API \u6216\u8005\u65b0\u589e\u529f\u80fd\u7684\u60f3\u6cd5\uff0c\u540c\u6837\u6309\u7167 issues \u5448\u73b0\u7684\u6a21\u677f\u8ba4\u771f\u586b\u5199\u6bcf\u4e00\u9879\u3002
\u7b2c\u4e00\u6b21\u8d21\u732e
\u5982\u679c\u4f60\u8fd8\u4e0d\u6e05\u695a\u600e\u4e48\u5728 GitHub \u4e0a\u63d0 Pull Request \uff0c\u53ef\u4ee5\u9605\u8bfb\u4e0b\u9762\u8fd9\u7bc7\u6587\u7ae0\u6765\u5b66\u4e60\uff1a
\u5982\u4f55\u4f18\u96c5\u5730\u5728 GitHub \u4e0a\u8d21\u732e\u4ee3\u7801
\u4e3a\u4e86\u80fd\u5e2e\u52a9\u4f60\u5f00\u59cb\u4f60\u7684\u7b2c\u4e00\u6b21\u5c1d\u8bd5\uff0c\u6211\u4eec\u7528 good first issues \u6807\u8bb0\u4e86\u4e00\u4e9b\u6bd4\u8f83\u6bd4\u8f83\u5bb9\u6613\u4fee\u590d\u7684 bug \u548c\u5c0f\u529f\u80fd\u3002\u8fd9\u4e9b issue \u53ef\u4ee5\u5f88\u597d\u5730\u505a\u4e3a\u4f60\u7684\u9996\u6b21\u5c1d\u8bd5\u3002
\u5982\u679c\u4f60\u6253\u7b97\u5f00\u59cb\u5904\u7406\u4e00\u4e2a issue\uff0c\u8bf7\u5148\u68c0\u67e5\u4e00\u4e0b issue \u4e0b\u9762\u7684\u7559\u8a00\u4ee5\u786e\u4fdd\u6ca1\u6709\u522b\u4eba\u6b63\u5728\u5904\u7406\u8fd9\u4e2a issue\u3002\u5982\u679c\u5f53\u524d\u6ca1\u6709\u4eba\u5728\u5904\u7406\u7684\u8bdd\u4f60\u53ef\u4ee5\u7559\u8a00\u544a\u77e5\u5176\u4ed6\u4eba\u4f60\u5c06\u4f1a\u5904\u7406\u8fd9\u4e2a issue\uff0c\u4ee5\u514d\u522b\u4eba\u91cd\u590d\u52b3\u52a8\u3002
\u5982\u679c\u4e4b\u524d\u6709\u4eba\u7559\u8a00\u8bf4\u4f1a\u5904\u7406\u8fd9\u4e2a issue \u4f46\u662f\u4e00\u4e24\u4e2a\u661f\u671f\u90fd\u6ca1\u6709\u52a8\u9759\uff0c\u90a3\u4e48\u4f60\u4e5f\u53ef\u4ee5\u63a5\u624b\u5904\u7406\u8fd9\u4e2a issue\uff0c\u5f53\u7136\u8fd8\u662f\u9700\u8981\u7559\u8a00\u544a\u77e5\u5176\u4ed6\u4eba\u3002
Pull Request
Ng Alain \u4f1a\u5173\u6ce8\u6240\u6709\u7684 pull request\uff0c\u6211\u4eec\u4f1a review \u4ee5\u53ca\u5408\u5e76\u4f60\u7684\u4ee3\u7801\uff0c\u4e5f\u6709\u53ef\u80fd\u8981\u6c42\u4f60\u505a\u4e00\u4e9b\u4fee\u6539\u6216\u8005\u544a\u8bc9\u4f60\u6211\u4eec\u4e3a\u4ec0\u4e48\u4e0d\u80fd\u63a5\u53d7\u8fd9\u6837\u7684\u4fee\u6539\u3002
\u5728\u4f60\u53d1\u9001 Pull Request \u4e4b\u524d\uff0c\u8bf7\u786e\u8ba4\u4f60\u662f\u6309\u7167\u4e0b\u9762\u7684\u6b65\u9aa4\u6765\u505a\u7684\uff1a
\u5728\u9879\u76ee\u6839\u76ee\u5f55\u4e0b\u8fd0\u884c\u4e86 yarn
\u3002
\u5982\u679c\u4f60\u4fee\u590d\u4e86\u4e00\u4e2a bug \u6216\u8005\u65b0\u589e\u4e86\u4e00\u4e2a\u529f\u80fd\uff0c\u8bf7\u786e\u4fdd\u5199\u4e86\u76f8\u5e94\u7684\u6d4b\u8bd5\uff0c\u8fd9\u5f88\u91cd\u8981\u3002
\u786e\u8ba4\u6240\u6709\u7684\u6d4b\u8bd5\u90fd\u662f\u901a\u8fc7\u7684 npm run test
\u3002
\u786e\u4fdd\u4f60\u7684\u4ee3\u7801\u901a\u8fc7\u4e86 lint \u68c0\u67e5 npm run lint
\u3002\u5c0f\u8d34\u58eb: Lint \u4f1a\u5728\u4f60 git commit
\u7684\u65f6\u5019\u81ea\u52a8\u8fd0\u884c\u3002
\u786e\u4fdd\u4f60\u7684\u4ee3\u7801\u5728\u63d0\u4ea4\u4e4b\u524d\u7ecf\u8fc7\u4e86\u6b63\u786e\u7684 Rebase
\u786e\u4fdd\u4f60\u7684\u63d0\u4ea4\u7b26\u5408\u89c4\u8303
\u5f00\u53d1\u6d41\u7a0b
\u5728\u4f60 clone \u4e86 ng-alain \u6216 delon \u7684\u4ee3\u7801\u5e76\u4e14\u4f7f\u7528 yarn
\u5b89\u88c5\u5b8c\u4f9d\u8d56\u540e\uff0c\u4f60\u8fd8\u53ef\u4ee5\u8fd0\u884c\u4e0b\u9762\u51e0\u4e2a\u5e38\u7528\u7684\u547d\u4ee4\uff1a
delon \u57fa\u5efa\u7c7b\u5e93
npm run site
\u5728\u672c\u5730\u8fd0\u884c ng-alain.com \u7f51\u7ad9
npm run lint
\u68c0\u67e5 packages \u4ee3\u7801\u98ce\u683c
npm run test
\u8fd0\u884c packages \u6240\u6709\u7c7b\u5e93\u6d4b\u8bd5
npm run release
\u6784\u5efa packages \u53d1\u5e03\u5305
ng-alain \u811a\u624b\u67b6
npm start
\u5728\u672c\u5730\u8fd0\u884c\u811a\u624b\u67b6
npm run lint
\u68c0\u67e5\u4ee3\u7801\u98ce\u683c
npm test
\u8fd0\u884c\u6d4b\u8bd5
npm run build
\u6784\u5efa\u751f\u4ea7\u73af\u5883\u7f51\u7ad9
<
',meta:{order:40,title:"\u8d21\u732e\u6307\u5357",type:"Other"},toc:[{id:"\u884c\u4e3a\u51c6\u5219",title:"\u884c\u4e3a\u51c6\u5219",h:2},{id:"\u900f\u660e\u7684\u5f00\u53d1",title:"\u900f\u660e\u7684\u5f00\u53d1",h:2},{id:"Bugs",title:"Bugs",h:2},{id:"\u65b0\u589e\u529f\u80fd",title:"\u65b0\u589e\u529f\u80fd",h:2},{id:"\u7b2c\u4e00\u6b21\u8d21\u732e",title:"\u7b2c\u4e00\u6b21\u8d21\u732e",h:2},{id:"PullRequest",title:"Pull Request",h:2},{id:"\u5f00\u53d1\u6d41\u7a0b",title:"\u5f00\u53d1\u6d41\u7a0b",h:2,children:[{id:"delon\u57fa\u5efa\u7c7b\u5e93",title:"delon \u57fa\u5efa\u7c7b\u5e93",h:3},{id:"ng-alain\u811a\u624b\u67b6",title:"ng-alain \u811a\u624b\u67b6",h:3}]}]}},demo:!1},this.codes=[]}static#e=this.\u0275fac=function(t){return new(t||e)};static#t=this.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-contributing"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,o){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",o.codes)("item",o.item)},dependencies:[i.P],styles:["[_nghost-%COMP%]{display:block}"]})}return e})()},{path:"deploy",redirectTo:"deploy/zh",pathMatch:"full"},{path:"deploy/:lang",component:(()=>{class e{constructor(){this.item={cols:1,urls:{"en-US":"docs/deploy.en-US.md","zh-CN":"docs/deploy.zh-CN.md"},content:{"en-US":{content:'Construct
When the project is developed, you can package your app with just one line of command:
npm run build
NG-ALAIN itself is an Angular CLI project, so you can also complete more complex build requirements with Build. After the package is successfully packaged, the dist
folder will be generated in the root directory, which is to build the packaged file, including several static files such as *.js
, *.css
, index.html
.
JavaScript heap out of memory
Avoid executing ng build
when throw error JavaScript heap out of memory:
{\n "scripts": {\n "build": "node --max_old_space_size=5120 ./node_modules/@angular/cli/bin/ng build"\n }\n}
Environmental variables
When you need to distinguish between development and deployment, and test environments, you can configure the corresponding parameters according to different environments through the src/environments
folder. The configuration items can also be called directly in the application. At the same time, you need to configure the configuration items in angular.json
. Finally, you can change the environment configuration through commands.
Analyze the build file volume
If the build file is large, you can optimize your code by building and analyzing the volume distribution of dependent modules with the analyze
command.
npm run analyze
View the analyze page:
npm run analyze:view
Release
When you are ready to deploy (release) your the app, you need only to publish the generated build artifacts - that is, the files in the dist
folder - to your cdn or static server. Note that the index.html
is usually the entry page for your app and handles all missing file requests. You may need to change the import path of the page after determining the static of js and css.
The default static resource reference path directly points to the directory where the dist
folder is published. For example, if you post dist
to the root directory of the ng-alain.com
site, the requested URL is //ng-alain.com/***.js
, //ng-alain.com/***.css
, if dist
is posted to a directory under a certain directory, such as v2
, request The URL is //ng-alain.com/v2/***.js
, //ng-alain.com/v2/***.css
.
If your static resource is deployed to another domain name (such as a separate CDN address), you can specify a CDN address with the --deployUrl
parameter.
ng build -deployUrl=//cdn.ng-alain.com/
The generated index.html
with its *.js
, *.css
files will automatically refer to //cdn.ng-alain.com/*.js
, //cdn.ng-alain.com/*css
, respectively.
Routing strategy
Angular front-end routing has two different strategies: HashLocationStrategy
and PathLocationStrategy
. The former is routed by appending a #
before a path, and the front-end routing management is performed by HTML5 History, while the latter is similar, but the path does not have #
appended before it. Through the configuration of the server, the specified URL can be accessed to the current page, enabling front-end routing management.
If you want to use PathLocationStrategy
, you need to replace RouterModule.forRoot(routes, { useHash: true })
of ./src/app/routes/routes-routing.module.ts
with RouterModule.forRoot(routes)
, since that is the default Angular behavior. You might notice that this can also be done by changing the useHash
variable in the src/environments/environment.*.ts
files, depending on your project configulation. Importantly, your server needs to be correctly configured, such that is returns the index.html
for any 404 errors:
Express server example:
app.use(express.static(path.join(__dirname, \'build\')));\n\napp.get(\'/*\', function (req, res) {\n res.sendFile(path.join(__dirname, \'build\', \'index.html\'));\n});
Egg server example:
// controller\nexports.index = function* () {\n yield this.render(\'App.jsx\', {\n context: {\n user: this.session.user,\n },\n });\n};\n\n// router\napp.get(\'home\', \'/*\', \'home.index\');
For more questions about Angular routing, please read official website.
Docker
NG-ALAIN provides a complete image file for building Angular projects based on the nginx WEB service. Where nginx is a mirror using nginx:1.13.5-alpine, which basically satisfies NG-ALAIN The project\'s good operating environment, if there are more needs, you can easily specify nginx.conf with docker run
.
1. Building the image
Build a complete image of the runtime environment required by NG-ALAIN based on the Dockerfile.
docker build -t ng-alain .
2. Running
Based on compose (Recommended)
docker-compose up -d
The details can be modified with docker-compose.yml
.
Based on imperative
docker run -d -p 80:80 --name alain ng-alain
Finally, you can visit\uff1ahttp://localhost/
3. About SSL
The Dockerfile provided by NG-ALAIN is relatively simple, and the most common use of real projects is support for SSL.
Therefore, by default you can place the certificate in the _nginx/ssl
directory and enable the _nginx/default.conf
related SSL configuration item.
Finally, add the ports
node of docker-compose.yml
:
- 443:443
Container deployment
Refer to Angular Container Deployment
',meta:{order:70,title:{"en-US":"Build & Deploy","zh-CN":"\u6784\u5efa\u548c\u53d1\u5e03"},type:"Dev"},toc:[{id:"Construct",title:"Construct",h:2,children:[{id:"JavaScriptheapoutofmemory",title:"JavaScript heap out of memory",h:3},{id:"Environmentalvariables",title:"Environmental variables",h:3},{id:"Analyzethebuildfilevolume",title:"Analyze the build file volume",h:3}]},{id:"Release",title:"Release",h:2,children:[{id:"Routingstrategy",title:"Routing strategy",h:3},{id:"Docker",title:"Docker",h:3},{id:"Containerdeployment",title:"Container deployment",h:3}]}]},"zh-CN":{content:'\u6784\u5efa
\u5f53\u9879\u76ee\u5f00\u53d1\u5b8c\u6bd5\uff0c\u53ea\u9700\u8981\u8fd0\u884c\u4e00\u884c\u547d\u4ee4\u5c31\u53ef\u4ee5\u6253\u5305\u4f60\u7684\u5e94\u7528\uff1a
npm run build
NG-ALAIN \u672c\u8eab\u662f\u4e00\u4e2a Angular CLI \u9879\u76ee\uff0c\u56e0\u6b64\u4e5f\u53ef\u4ee5\u53c2\u7167 Build \u5b8c\u6210\u66f4\u590d\u6742\u7684\u6784\u5efa\u9700\u6c42\u3002\u6784\u5efa\u6253\u5305\u6210\u529f\u4e4b\u540e\uff0c\u4f1a\u5728\u6839\u76ee\u5f55\u751f\u6210 dist
\u6587\u4ef6\u5939\uff0c\u91cc\u9762\u5c31\u662f\u6784\u5efa\u6253\u5305\u597d\u7684\u6587\u4ef6\uff0c\u5305\u542b\u82e5\u5e72 *.js
\u3001*.css
\u3001index.html
\u7b49\u9759\u6001\u6587\u4ef6\u3002
JavaScript heap out of memory
\u907f\u514d\u6267\u884c ng build
\u65f6\u629b\u51fa JavaScript heap out of memory\uff1a
{\n "scripts": {\n "build": "node --max_old_space_size=5120 ./node_modules/@angular/cli/bin/ng build"\n }\n}
\u73af\u5883\u53d8\u91cf
\u5f53\u4f60\u9700\u8981\u533a\u522b\u5f00\u53d1\u548c\u90e8\u7f72\u4ee5\u53ca\u6d4b\u8bd5\u73af\u5883\u7684\u65f6\u5019\uff0c\u53ef\u4ee5\u901a\u8fc7 src/environments
\u6587\u4ef6\u5939\u6839\u636e\u4e0d\u540c\u73af\u5883\u914d\u7f6e\u76f8\u5e94\u7684\u53c2\u6570\uff0c\u914d\u7f6e\u9879\u540c\u65f6\u4e5f\u53ef\u4ee5\u5728\u5e94\u7528\u5f53\u4e2d\u76f4\u63a5\u8c03\u7528\u5b83\u4eec\u3002\u540c\u65f6\uff0c\u8fd8\u9700\u8981\u914d\u7f6e angular.json
\u5185\u7684\u914d\u7f6e\u9879\uff0c\u6700\u540e\u4f60\u53ef\u4ee5\u900f\u8fc7\u547d\u4ee4\u6539\u53d8\u73af\u5883\u914d\u7f6e\u3002
\u5206\u6790\u6784\u5efa\u6587\u4ef6\u4f53\u79ef
\u5982\u679c\u6784\u5efa\u6587\u4ef6\u5f88\u5927\uff0c\u53ef\u4ee5\u901a\u8fc7 analyze
\u547d\u4ee4\u6784\u5efa\u5e76\u5206\u6790\u4f9d\u8d56\u6a21\u5757\u7684\u4f53\u79ef\u5206\u5e03\uff0c\u4ece\u800c\u4f18\u5316\u4f60\u7684\u4ee3\u7801\u3002
npm run analyze
\u67e5\u770b\u5206\u6790\u9875\uff1a
npm run analyze:view
\u53d1\u5e03
\u5bf9\u4e8e\u53d1\u5e03\u6765\u8bb2\uff0c\u53ea\u9700\u8981\u5c06\u6700\u7ec8\u751f\u6210\u7684\u9759\u6001\u6587\u4ef6\uff0c\u4e5f\u5c31\u662f\u901a\u5e38\u60c5\u51b5\u4e0b dist
\u6587\u4ef6\u5939\u7684\u9759\u6001\u6587\u4ef6\u53d1\u5e03\u5230\u4f60\u7684 cdn \u6216\u8005\u9759\u6001\u670d\u52a1\u5668\u5373\u53ef\uff0c\u9700\u8981\u6ce8\u610f\u7684\u662f\u5176\u4e2d\u7684 index.html
\u901a\u5e38\u4f1a\u662f\u4f60\u540e\u53f0\u670d\u52a1\u7684\u5165\u53e3\u9875\u9762\uff0c\u5728\u786e\u5b9a\u4e86 js \u548c css \u7684\u9759\u6001\u4e4b\u540e\u53ef\u80fd\u9700\u8981\u6539\u53d8\u9875\u9762\u7684\u5f15\u5165\u8def\u5f84\u3002
\u9ed8\u8ba4\u7684\u9759\u6001\u8d44\u6e90\u5f15\u7528\u8def\u5f84\u76f4\u63a5\u6307\u5411 dist
\u6587\u4ef6\u5939\u53d1\u5e03\u6240\u5904\u5e94\u7528\u7684\u76ee\u5f55\u4e0b\uff0c\u4f8b\u5982\u4f60\u5c06 dist
\u53d1\u5e03\u81f3 ng-alain.com
\u7ad9\u70b9\u7684\u6839\u76ee\u5f55\u91cc\u5219\u8bf7\u6c42\u7684\u7f51\u5740\u662f //ng-alain.com/***.js
\u3001//ng-alain.com/***.css
\uff0c\u82e5 dist
\u53d1\u5e03\u81f3\u67d0\u7ad9\u70b9\u4e0b\u67d0\u4e2a\u76ee\u5f55\u5982 v2
\u6587\u4ef6\u5939\u4e0b\uff0c\u5219\u8bf7\u6c42\u7684\u7f51\u5740\u662f //ng-alain.com/v2/***.js
\u3001//ng-alain.com/v2/***.css
\u3002
\u5982\u679c\u4f60\u7684\u9759\u6001\u8d44\u6e90\u662f\u90e8\u7f72\u5230\u5176\u4ed6\u57df\u540d\uff08\u4f8b\u5982\u72ec\u7acb\u7684 cdn \u5730\u5740\uff09\uff0c\u4f60\u53ef\u4ee5\u900f\u8fc7 -d
\u53c2\u6570\u6307\u5b9a\u4e00\u4e2a cdn \u5730\u5740\u3002
ng build -d=//cdn.ng-alain.com/
\u8fd9\u6837\u751f\u6210\u7684 index.html
\u5185 *.js
\u3001*.css
\u4f1a\u81ea\u52a8\u52a0\u4e0a //cdn.ng-alain.com/*.js
\u3002
\u8def\u7531\u7b56\u7565
Angular \u524d\u7aef\u8def\u7531\u6709\u4e24\u79cd\u4e0d\u540c\u7b56\u7565 HashLocationStrategy
\u548c PathLocationStrategy
\u3002\u524d\u8005\u662f\u4ee5 #
\u540e\u9762\u7684\u8def\u5f84\u8fdb\u884c\u8def\u7531\u5904\u7406\uff0c\u901a\u8fc7 HTML5 History \u8fdb\u884c\u524d\u7aef\u8def\u7531\u7ba1\u7406\uff0c\u800c\u540e\u8005\u5219\u662f\u7c7b\u4f3c\u9875\u9762\u8bbf\u95ee\u8def\u5f84\u5e76\u6ca1\u6709 #
\uff0c\u901a\u8fc7\u670d\u52a1\u7aef\u7684\u914d\u7f6e\uff0c\u80fd\u591f\u8bbf\u95ee\u6307\u5b9a URL \u90fd\u5b9a\u5411\u5230\u5f53\u524d\u9875\u9762\uff0c\u4ece\u800c\u80fd\u591f\u8fdb\u884c\u524d\u7aef\u8def\u7531\u7ba1\u7406\u3002
\u5982\u679c\u4f60\u60f3\u91c7\u7528 PathLocationStrategy
\u7b56\u7565\uff0c\u5219\u9700\u8981\u5c06 ./src/app/routes/routes.module.ts
\u7684 RouterModule.forRoot(routes, { useHash: true })
\u6362\u6210 RouterModule.forRoot(routes)
\u3002\u540c\u65f6\u9700\u8981\u670d\u52a1\u7aef\u505a\u4e00\u4e2a\u6620\u5c04\uff0c\u6bd4\u5982\uff1a
express \u7684\u4f8b\u5b50\uff1a
app.use(express.static(path.join(__dirname, \'build\')));\n\napp.get(\'/*\', function (req, res) {\n res.sendFile(path.join(__dirname, \'build\', \'index.html\'));\n});
egg \u7684\u4f8b\u5b50\uff1a
// controller\nexports.index = function* () {\n yield this.render(\'App.jsx\', {\n context: {\n user: this.session.user,\n },\n });\n};\n\n// router\napp.get(\'home\', \'/*\', \'home.index\');
\u6709\u5173\u66f4\u591a Angular \u8def\u7531\u76f8\u5f53\u95ee\u9898\uff0c\u8bf7\u9605\u8bfb\u5b98\u7f51\u3002
Docker
NG-ALAIN \u63d0\u4f9b\u4e86\u4e00\u4e2a\u57fa\u4e8e nginx
WEB\u670d\u52a1\u5b8c\u6574\u7684\u6784\u5efaAngular\u9879\u76ee\u7684\u955c\u50cf\u6587\u4ef6\u3002\u5176\u4e2d nginx
\u662f\u91c7\u7528 nginx:1.13.5-alpine \u7684\u955c\u50cf\uff0c\u57fa\u672c\u4e0a\u53ef\u4ee5\u6ee1\u8db3 NG-ALAIN \u9879\u76ee\u7684\u826f\u597d\u8fd0\u884c\u73af\u5883\uff0c\u5018\u82e5\u6709\u66f4\u591a\u9700\u6c42\uff0c\u4f60\u53ef\u4ee5\u5229\u7528 docker run
\u8f7b\u6613\u7684\u6307\u5b9a nginx.conf\u3002
1\u3001\u6784\u5efa\u955c\u50cf
\u6839\u636e Dockerfile \u6784\u5efa\u4e00\u4e2a\u5b8c\u6574\u7684 NG-ALAIN \u6240\u9700\u8981\u7684\u8fd0\u884c\u73af\u5883\u7684\u955c\u50cf\u3002
docker build -t ng-alain .
2\u3001\u8fd0\u884c
\u57fa\u4e8ecompose\uff08\u63a8\u8350\uff09
docker-compose up -d
\u5176\u7ec6\u8282\u53ef\u4ee5\u901a\u8fc7 docker-compose.yml
\u4fee\u6539\u3002
\u57fa\u4e8e\u547d\u4ee4\u5f0f
docker run -d -p 80:80 --name alain ng-alain
\u6700\u540e\u4f60\u53ef\u4ee5\u8bbf\u95ee\uff1ahttp://localhost/
3\u3001\u5173\u4e8eSSL
NG-ALAIN \u63d0\u4f9b\u7684 Dockerfile \u6587\u4ef6\u76f8\u5bf9\u4e8e\u6bd4\u8f83\u7b80\u5355\uff0c\u800c\u5b9e\u9645\u9879\u76ee\u4e2d\u6700\u5e38\u7528\u7684\u662f\u5bf9SSL\u7684\u652f\u6301\u3002
\u56e0\u6b64\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4f60\u53ef\u4ee5\u5c06\u8bc1\u4e66\u653e\u7f6e _nginx/ssl
\u76ee\u5f55\u4e0b\uff0c\u5e76\u5f00\u542f _nginx/default.conf
\u76f8\u5173SSL\u914d\u7f6e\u9879\u5373\u53ef\u3002
\u6700\u540e\uff0c\u589e\u52a0 docker-compose.yml
\u7684 ports
\u8282\u70b9\uff1a
- 443:443
\u5bb9\u5668\u90e8\u7f72
\u53c2\u8003 Angular \u5bb9\u5668\u90e8\u7f72
',meta:{order:70,title:{"en-US":"Build & Deploy","zh-CN":"\u6784\u5efa\u548c\u53d1\u5e03"},type:"Dev"},toc:[{id:"\u6784\u5efa",title:"\u6784\u5efa",h:2,children:[{id:"JavaScriptheapoutofmemory",title:"JavaScript heap out of memory",h:3},{id:"\u73af\u5883\u53d8\u91cf",title:"\u73af\u5883\u53d8\u91cf",h:3},{id:"\u5206\u6790\u6784\u5efa\u6587\u4ef6\u4f53\u79ef",title:"\u5206\u6790\u6784\u5efa\u6587\u4ef6\u4f53\u79ef",h:3}]},{id:"\u53d1\u5e03",title:"\u53d1\u5e03",h:2,children:[{id:"\u8def\u7531\u7b56\u7565",title:"\u8def\u7531\u7b56\u7565",h:3},{id:"Docker",title:"Docker",h:3},{id:"\u5bb9\u5668\u90e8\u7f72",title:"\u5bb9\u5668\u90e8\u7f72",h:3}]}]}},demo:!1},this.codes=[]}static#e=this.\u0275fac=function(t){return new(t||e)};static#t=this.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-deploy"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,o){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",o.codes)("item",o.item)},dependencies:[i.P],styles:["[_nghost-%COMP%]{display:block}"]})}return e})()},{path:"faq",redirectTo:"faq/zh",pathMatch:"full"},{path:"faq/:lang",component:(()=>{class e{constructor(){this.item={cols:1,urls:{"en-US":"docs/faq.en-US.md","zh-CN":"docs/faq.zh-CN.md"},content:{"en-US":{content:'Please check the FAQ below before asking questions.
Basic
Can\'t Bind to since it isn\'t a known property of
When you have multiple lazy modules, you want each submodule to use the component library (for example: NgZorroAntdModule
, NgxTinymceModule
) should be exported in ShareModule
, please refer to module registration guidelines.
Expression Changed After It Has Been Checked Error
Common mistakes under Angular, this article will help you understand why.
Can\'t bind to \'formGroup\' since it isn\'t a known property of \'form\'
Common mistakes under Angular, the use of Reactive Forms requires the introduction of ReactiveFormsModule
, refer to official documentation.
Why is the page not updated after the data is modified?
The NG-ZORRO and @delon/* components work in OnPush mode by default. Mutate objects or arrays do not trigger Angular\'s change detection. Use the immutable method.
How to use @delon daily build version
NG-ALAIN provides a delon-builds repository as a daily build version. It\'s not the final stable version, but contains the latest fixed BUG, To use the latest features, you can create delon.sh
in the root directory:
#!/usr/bin/env bash\nset -e\necho "Download latest @delon version"\nrm -rf delon-builds\ngit clone --depth 1 https://github.com/ng-alain/delon-builds.git\nrm -rf node_modules/@delon\nrm -rf node_modules/ng-alain\nrsync -am delon-builds/ node_modules/\nNG_ALAIN_VERSION=$(node -p "require(\'./node_modules/ng-alain/package.json\').version")\nrm -rf delon-builds\necho "Using ng-alain version: ${NG_ALAIN_VERSION}"
When you need to use the daily build version of @delon, you only need to run:
bash delon.sh
If in Windows environment, please use WSL to execute Bash scripts.
Installation
Why can\'t I find the ng-zorro-antd/src/*.less style?
Two situations:
Using cnpm
to install dependencies, you will not be able to find style files. This is because cnpm
is in the form of a soft link path, which causes the ng-zorro-antd
folder name to change, so it is recommended to use the yarn
install dependency package instead.
The ng-zorro-antd
version is too old to cause some components to fail to load into the appropriate style
How to use Taobao source correctly?
The simplest is to use the networkEnv plugin.
Or manually repair:
yarn config set registry https://registry.npmmirror.com\nyarn config set sass_binary_site https://npmmirror.com/mirrors/node-sass\n# restore\nyarn config delete registry\nyarn config delete sass_binary_site
Configuration
How do I deploy the antd icon locally?
First, the latest iconfont file can go to this link (mirror) Download.
Finally, redefine the new path in src/styles/theme.less
:
@icon-url: "/assets/iconfont";
Use an absolute path or CDN address.
Missing locale data for the locale "zh-cn"
For missing language imports, refer to app.module.ts.
How to deploy ng-alain.com documentation site in local
Online documents will only retain the data of the last three major version numbers. If the version is low, you can view it through local deployment:
git clone --depth 1 -b full https://github.com/ng-alain/archive-docs.git ng-alain-doc\ncd ng-alain-doc\nyarn\nyarn start
Fix the abnormal display of the lower part of the 360 browser
The built-in Chrome core of some 360 browsers is too low, resulting in some CSS3 not supported, you can manually increase .browserslistrc
For more details, refer to #2310
',meta:{order:20,title:{"en-US":"FAQ","zh-CN":"\u5e38\u89c1\u95ee\u9898"},type:"Other"},toc:[{id:"Basic",title:"Basic",h:2,children:[{id:"Can'tBindtosinceitisn'taknownpropertyof",title:"Can't Bind to since it isn't a known property of",h:3},{id:"ExpressionChangedAfterItHasBeenCheckedError",title:"Expression Changed After It Has Been Checked Error",h:3},{id:"Can'tbindto'formGroup'sinceitisn'taknownpropertyof'form'",title:"Can't bind to 'formGroup' since it isn't a known property of 'form'",h:3},{id:"Whyisthepagenotupdatedafterthedataismodified",title:"Why is the page not updated after the data is modified?",h:3},{id:"Howtouse@delondailybuildversion",title:"How to use @delon daily build version",h:3}]},{id:"Installation",title:"Installation",h:2,children:[{id:"Whycan'tIfindtheng-zorro-antd/src/*.lessstyle",title:"Why can't I find the ng-zorro-antd/src/*.less style?",h:3},{id:"HowtouseTaobaosourcecorrectly",title:"How to use Taobao source correctly?",h:3}]},{id:"Configuration",title:"Configuration",h:2,children:[{id:"HowdoIdeploytheantdiconlocally",title:"How do I deploy the antd icon locally?",h:3},{id:'Missinglocaledataforthelocale"zh-cn"',title:'Missing locale data for the locale "zh-cn"',h:3},{id:"Howtodeployng-alain.comdocumentationsiteinlocal",title:"How to deploy ng-alain.com documentation site in local",h:3},{id:"Fixtheabnormaldisplayofthelowerpartofthe360browser",title:"Fix the abnormal display of the lower part of the 360 browser",h:3}]}]},"zh-CN":{content:'\u63d0\u95ee\u4e4b\u524d\uff0c\u8bf7\u5148\u67e5\u9605\u4e0b\u9762\u7684\u5e38\u89c1\u95ee\u9898\u3002
\u57fa\u7840
Can\'t Bind to since it isn\'t a known property of
\u5f53\u4f60\u6709\u591a\u4e2a\u61d2\u6a21\u5757\u65f6\uff0c\u5e0c\u671b\u6bcf\u4e2a\u5b50\u6a21\u5757\u90fd\u9700\u8981\u4f7f\u7528\u7ec4\u4ef6\u5e93\u65f6\uff08\u4f8b\u5982\uff1aNgZorroAntdModule
\u3001NgxTinymceModule
\uff09\u5e94\u5728 ShareModule
\u4e2d export\uff0c\u8bf7\u53c2\u8003\u6a21\u5757\u6ce8\u518c\u6307\u5bfc\u539f\u5219\u3002
Expression Changed After It Has Been Checked Error \u9519\u8bef
Angular \u4e0b\u5e38\u89c1\u9519\u8bef\uff0c\u8fd9\u7bc7\u6587\u7ae0 \u4f1a\u5e2e\u52a9\u4f60\u7406\u89e3\u539f\u56e0\u3002
Can\'t bind to \'formGroup\' since it isn\'t a known property of \'form\'
Angular \u4e0b\u5e38\u89c1\u9519\u8bef\uff0c\u4f7f\u7528 Reactive Forms \u9700\u8981\u989d\u5916\u5f15\u5165 ReactiveFormsModule
\uff0c\u53ef\u4ee5\u53c2\u8003\u5b98\u65b9\u6587\u6863\u3002
\u6570\u636e\u4fee\u6539\u540e\u9875\u9762\u4e3a\u4ec0\u4e48\u6ca1\u6709\u66f4\u65b0
NG-ZORRO \u53ca @delon/* \u7ec4\u4ef6\u9ed8\u8ba4\u5728 OnPush \u6a21\u5f0f\u4e0b\u5de5\u4f5c\uff0cmutate \u5bf9\u8c61\u6216\u8005\u6570\u7ec4\u4e0d\u4f1a\u89e6\u53d1 Angular \u7684\u53d8\u66f4\u68c0\u6d4b\uff0c\u8bf7\u4f7f\u7528 immutable \u65b9\u5f0f\u3002
\u5982\u4f55\u4f7f\u7528@delon\u6bcf\u65e5\u6784\u5efa\u7248\u672c
NG-ALAIN \u63d0\u4f9b\u4e00\u4e2a delon-builds \u4ed3\u50a8\u4f5c\u4e3a\u6bcf\u65e5\u6784\u5efa\u7248\u672c\uff0c\u5b83\u5e76\u4e0d\u662f\u6700\u7ec8\u7a33\u5b9a\u7248\u672c\uff0c\u4f46\u5305\u542b\u6700\u65b0\u5df2\u4fee\u590dBUG\u3001\u6700\u65b0\u529f\u80fd\uff0c\u8981\u4f7f\u7528\u53ef\u4ee5\u5728\u6839\u76ee\u5f55\u521b\u5efa delon.sh
\uff1a
#!/usr/bin/env bash\nset -e\necho "Download latest @delon version"\nrm -rf delon-builds\ngit clone --depth 1 https://github.com/ng-alain/delon-builds.git\nrm -rf node_modules/@delon\nrm -rf node_modules/ng-alain\nrsync -am delon-builds/ node_modules/\nNG_ALAIN_VERSION=$(node -p "require(\'./node_modules/ng-alain/package.json\').version")\nrm -rf delon-builds\necho "Using ng-alain version: ${NG_ALAIN_VERSION}"
\u5f53\u9700\u8981\u4f7f\u7528@delon\u7684\u6bcf\u65e5\u6784\u5efa\u7248\u672c\uff0c\u53ea\u9700\u8981\u5728\u8fd0\u884c\uff1a
bash delon.sh
\u5982\u679c\u662f Windows \u73af\u5883\uff0c\u8bf7\u4f7f\u7528 WSL \u6765\u6267\u884c Bash \u811a\u672c\u3002
\u5b89\u88c5
\u4e3a\u4ec0\u4e48\u627e\u4e0d\u5230 ng-zorro-antd/src/*.less \u6837\u5f0f\uff1f
\u4e24\u79cd\u60c5\u51b5\uff1a
\u4f7f\u7528 cnpm
\u5b89\u88c5\u4f9d\u8d56\u5305\uff0c\u4f1a\u9047\u5230\u65e0\u6cd5\u627e\u5230\u6837\u5f0f\u6587\u4ef6\u3002\u8fd9\u662f\u7531\u4e8e cnpm
\u91c7\u7528\u7684\u662f\u8f6f\u94fe\u63a5\u8def\u5f84\u5f62\u5f0f\uff0c\u5bfc\u81f4 ng-zorro-antd
\u6587\u4ef6\u5939\u540d\u6709\u6240\u53d8\u52a8\uff0c\u56e0\u6b64\u5efa\u8bae\u6539\u7528 yarn
\u5b89\u88c5\u4f9d\u8d56\u5305\uff0c\u5982\u679c\u662f\u7f51\u7edc\u56e0\u7d20\uff0c\u8bf7\u53c2\u8003\u4e0b\u65b9\u7684\u5982\u4f55\u6b63\u786e\u4f7f\u7528\u6dd8\u5b9d\u6e90\u3002
ng-zorro-antd
\u7248\u672c\u8fc7\u65e7\u5bfc\u81f4\u90e8\u5206\u7ec4\u4ef6\u65e0\u6cd5\u52a0\u8f7d\u5230\u76f8\u5e94\u6837\u5f0f
\u5982\u4f55\u6b63\u786e\u4f7f\u7528\u6dd8\u5b9d\u6e90\uff1f
\u6700\u7b80\u5355\u662f\u4f7f\u7528 networkEnv \u63d2\u4ef6\u3002
\u6216\u624b\u52a8\u4fee\u590d\uff1a
yarn config set registry https://registry.npmmirror.com\nyarn config set sass_binary_site https://npmmirror.com/mirrors/node-sass\n# \u6062\u590d\nyarn config delete registry\nyarn config delete sass_binary_site
\u914d\u7f6e
\u5982\u4f55\u672c\u5730\u90e8\u7f72 antd \u56fe\u6807\uff1f
\u9996\u5148\uff0c\u6700\u65b0\u7684 iconfont \u6587\u4ef6\u53ef\u4ee5\u5230 \u6b64\u94fe\u63a5\uff08\u955c\u50cf\uff09 \u4e0b\u8f7d\u3002
\u6700\u540e\uff0c\u5728 src/styles/theme.less
\u91cd\u65b0\u5b9a\u4e49\u65b0\u7684\u8def\u5f84\uff1a
@icon-url: "/assets/iconfont";
\u4f7f\u7528\u7edd\u5bf9\u8def\u5f84\u6216CDN\u5730\u5740\u3002
Missing locale data for the locale "zh-cn"
\u7f3a\u5c11\u8bed\u8a00\u5bfc\u5165\uff0c\u53c2\u8003app.module.ts\u3002
\u5982\u4f55\u672c\u5730\u90e8\u7f72ng-alain.com\u6587\u6863
\u7ebf\u4e0a\u6587\u6863\u5c06\u53ea\u4fdd\u7559\u6700\u8fd1\u4e09\u4e2a\u4e3b\u7248\u672c\u53f7\u7684\u6570\u636e\uff0c\u82e5\u662f\u4f4e\u7248\u672c\u53ef\u4ee5\u901a\u8fc7\u672c\u5730\u90e8\u7f72\u6765\u67e5\u770b\uff1a
git clone --depth 1 -b full https://github.com/ng-alain/archive-docs.git ng-alain-doc\ncd ng-alain-doc\nyarn\nyarn start
\u4fee\u590d360\u6d4f\u89c8\u5668\u4e0b\u90e8\u5206\u663e\u793a\u5f02\u5e38
\u90e8\u5206360\u6d4f\u89c8\u5668\u5185\u7f6e\u7684 Chrome \u6838\u5fc3\u8fc7\u4f4e\uff0c\u5bfc\u81f4\u90e8\u5206 CSS3 \u672a\u652f\u6301\uff0c\u53ef\u4ee5\u624b\u52a8\u589e\u52a0 .browserslistrc
\u66f4\u591a\u7ec6\u8282\u53c2\u8003 #2310
',meta:{order:20,title:{"en-US":"FAQ","zh-CN":"\u5e38\u89c1\u95ee\u9898"},type:"Other"},toc:[{id:"\u57fa\u7840",title:"\u57fa\u7840",h:2,children:[{id:"Can'tBindtosinceitisn'taknownpropertyof",title:"Can't Bind to since it isn't a known property of",h:3},{id:"ExpressionChangedAfterItHasBeenCheckedError\u9519\u8bef",title:"Expression Changed After It Has Been Checked Error \u9519\u8bef",h:3},{id:"Can'tbindto'formGroup'sinceitisn'taknownpropertyof'form'",title:"Can't bind to 'formGroup' since it isn't a known property of 'form'",h:3},{id:"\u6570\u636e\u4fee\u6539\u540e\u9875\u9762\u4e3a\u4ec0\u4e48\u6ca1\u6709\u66f4\u65b0",title:"\u6570\u636e\u4fee\u6539\u540e\u9875\u9762\u4e3a\u4ec0\u4e48\u6ca1\u6709\u66f4\u65b0",h:3},{id:"\u5982\u4f55\u4f7f\u7528@delon\u6bcf\u65e5\u6784\u5efa\u7248\u672c",title:"\u5982\u4f55\u4f7f\u7528@delon\u6bcf\u65e5\u6784\u5efa\u7248\u672c",h:3}]},{id:"\u5b89\u88c5",title:"\u5b89\u88c5",h:2,children:[{id:"\u4e3a\u4ec0\u4e48\u627e\u4e0d\u5230ng-zorro-antd/src/*.less\u6837\u5f0f\uff1f",title:"\u4e3a\u4ec0\u4e48\u627e\u4e0d\u5230 ng-zorro-antd/src/*.less \u6837\u5f0f\uff1f",h:3},{id:"\u5982\u4f55\u6b63\u786e\u4f7f\u7528\u6dd8\u5b9d\u6e90\uff1f",title:"\u5982\u4f55\u6b63\u786e\u4f7f\u7528\u6dd8\u5b9d\u6e90\uff1f",h:3}]},{id:"\u914d\u7f6e",title:"\u914d\u7f6e",h:2,children:[{id:"\u5982\u4f55\u672c\u5730\u90e8\u7f72antd\u56fe\u6807\uff1f",title:"\u5982\u4f55\u672c\u5730\u90e8\u7f72 antd \u56fe\u6807\uff1f",h:3},{id:'Missinglocaledataforthelocale"zh-cn"',title:'Missing locale data for the locale "zh-cn"',h:3},{id:"\u5982\u4f55\u672c\u5730\u90e8\u7f72ng-alain.com\u6587\u6863",title:"\u5982\u4f55\u672c\u5730\u90e8\u7f72ng-alain.com\u6587\u6863",h:3},{id:"\u4fee\u590d360\u6d4f\u89c8\u5668\u4e0b\u90e8\u5206\u663e\u793a\u5f02\u5e38",title:"\u4fee\u590d360\u6d4f\u89c8\u5668\u4e0b\u90e8\u5206\u663e\u793a\u5f02\u5e38",h:3}]}]}},demo:!1},this.codes=[]}static#e=this.\u0275fac=function(t){return new(t||e)};static#t=this.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-faq"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,o){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",o.codes)("item",o.item)},dependencies:[i.P],styles:["[_nghost-%COMP%]{display:block}"]})}return e})()},{path:"getting-started",redirectTo:"getting-started/zh",pathMatch:"full"},{path:"getting-started/:lang",component:(()=>{class e{constructor(){this.item={cols:1,urls:{"en-US":"docs/getting-started.en-US.md","zh-CN":"docs/getting-started.zh-CN.md"},content:{"en-US":{content:'Foreword
NG-ALAIN is a production-ready solution for admin interfaces. Built on the design principles developed by Ant Design, this project introduces higher level components; we have developed templates, components, and a corresponding design kit to improve the user and development experience for admin interfaces.
How to read document
This document uses the following conventions:
API
[]
Input Property
()
Output Event
[()]
Two-way binding
ng-content
Component content placeholders
#tpl
Refers <ng-template #tpl>
Preparation
You will need node and git. The project is based on Typescript, Angular, g2, @delon and ng-zorro-antd. It would be helpful if you have pre-existing knowledge on those.
Installation
CLI (Recommend)
Please make sure global Angular Cli is latest version via ng version
command, please refer to CLI Command Reference for how to upgrade.
yarn global add @angular/cli\nng new my-project --style less --routing --package-manager yarn\ncd my-project\nng add ng-alain\nyarn start\n# Or use HMR mode by: yarn run hmr
Please refer to Schematics for more details.
Clone the Git Repository
git clone --depth=1 https://github.com/ng-alain/ng-alain.git my-project\ncd my-project\nyarn\nyarn start\n# Or use HMR mode by: yarn run hmr
Note: Installing with the CLI is a clean scaffolding; using clone the git repository include all example pages.
Scaffolding
NG-ALAIN is a standard Angular CLI project that includes common routes for admins and demonstrates our component library. The project layout is as follows:
\u251c\u2500\u2500 _mock # Mock Data rule\n\u251c\u2500\u2500 src\n\u2502\xa0\xa0 \u251c\u2500\u2500 app\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 core # Core module\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 i18n\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 net\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 default.interceptor.ts # Default HTTP interceptor\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 services\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 startup.service.ts # Initialize project configuration\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 core.module.ts # Core module file\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 layout # Core layout\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 routes\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 ** # Business directory\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 routes.module.ts # Service routing module\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 routes-routing.module.ts # Service routes registration\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 shared # Shared module\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 shared-delon.module.ts # @Delon/* import of secondary shared modules\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 shared-zorro.module.ts # NG-ZORRO import of secondary shared modules\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 shared.module.ts # Shared module file\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 app.component.ts # Root component\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 app.module.ts # Root module\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 global-config.module.ts # @delon & ng-zorro global config\n\u2502\xa0\xa0 \u251c\u2500\u2500 assets # Local static resource\n\u2502\xa0\xa0 \u251c\u2500\u2500 environments # Environment variable configuration\n\u2502\xa0\xa0 \u251c\u2500\u2500 styles # Style directory\n\u2514\u2500\u2500 \u2514\u2500\u2500 style.less # Style guide entry
Development
yarn start
This will automatically open http://localhost:4200. If you see the following page then you have succeeded.
Environment Support
Limited by Angular, no longer supports IE
Modern browsers, Browser support
Server-side Rendering
IE / Edge
Firefox
Chrome
Safari
Opera
ElectronEdge last 2 versions last 2 versions last 2 versions last 2 versions last 2 versions
Contributing
Please read our CONTRIBUTING.md first.
If you\'d like to help us improve NG-ZORRO, just create a Pull Request. Feel free to report bugs and issues here.
If you\'re new to posting issues, we ask that you read How To Ask Questions The Smart Way(This guide does not provide actual support services for this project!) and How to Ask a Question in Open Source Community and How to Report Bugs Effectively prior to posting. Well written bug reports help us help you!
Need Help?
For questions on how to use ng-alain, please post questions to using the ng-alain
tag.
As always, we encourage experienced users to help those who are not familiar with ng-alain
!
DONATE
',meta:{order:10,title:"Getting Started",type:"Basic",i18n:"need-update"},toc:[{id:"Foreword",title:"Foreword",h:2},{id:"Preparation",title:"Preparation",h:2},{id:"Installation",title:"Installation",h:2,children:[{id:"CLIRecommend",title:"CLI (Recommend)",h:3},{id:"ClonetheGitRepository",title:"Clone the Git Repository",h:3}]},{id:"Scaffolding",title:"Scaffolding",h:2},{id:"Development",title:"Development",h:2},{id:"EnvironmentSupport",title:"Environment Support",h:2},{id:"Contributing",title:"Contributing",h:2},{id:"NeedHelp",title:"Need Help?",h:2},{id:"DONATE",title:"DONATE",h:2}]},"zh-CN":{content:'\u4ec0\u4e48\u662fNG-ALAIN
NG-ALAIN \u662f\u4e00\u4e2a\u4f01\u4e1a\u7ea7\u4e2d\u540e\u53f0\u524d\u7aef/\u8bbe\u8ba1\u89e3\u51b3\u65b9\u6848\u811a\u624b\u67b6\uff0c\u6211\u4eec\u79c9\u627f Ant Design \u7684\u8bbe\u8ba1\u4ef7\u503c\u89c2\uff0c\u76ee\u6807\u4e5f\u975e\u5e38\u7b80\u5355\uff0c\u5e0c\u671b\u5728Angular\u4e0a\u9762\u5f00\u53d1\u4f01\u4e1a\u540e\u53f0\u66f4\u7b80\u5355\u3001\u66f4\u5feb\u901f\u3002\u968f\u7740\u300e\u8bbe\u8ba1\u8005\u300f\u7684\u4e0d\u65ad\u53cd\u9988\uff0c\u5c06\u6301\u7eed\u8fed\u4ee3\uff0c\u9010\u6b65\u6c89\u6dc0\u548c\u603b\u7ed3\u51fa\u66f4\u591a\u8bbe\u8ba1\u6a21\u5f0f\u548c\u76f8\u5e94\u7684\u4ee3\u7801\u5b9e\u73b0\uff0c\u9610\u8ff0\u4e2d\u540e\u53f0\u4ea7\u54c1\u6a21\u677f/\u7ec4\u4ef6/\u4e1a\u52a1\u573a\u666f\u7684\u6700\u4f73\u5b9e\u8df5\uff0c\u4e5f\u5341\u5206\u671f\u5f85\u4f60\u7684\u53c2\u4e0e\u548c\u5171\u5efa\u3002
\u73af\u5883\u642d\u5efa
Angular \u5f00\u53d1\u73af\u5883\u81f3\u5c11\u9700\u8981\u5b89\u88c5 Node.js(Node.js \u5185\u7f6e\u4e86 npm \u65e0\u987b\u5355\u72ec\u5b89\u88c5\uff0c\u4f46\u63a8\u8350\u4f7f\u7528 Yarn \u4f46\u4f60\u9700\u8981\u5355\u72ec\u989d\u5916\u5b89\u88c5\uff09\u3001VSCode\u7f16\u8f91\u5668\uff0c\u5176\u4e2d Node.js \u5efa\u8bae\u5b89\u88c5 LTS \u7248\u672c\uff0c\u5b89\u88c5\u5b8c\u6210\u540e\u53ef\u4ee5\u901a\u8fc7\u7ec8\u7aef\u7a97\u53e3\u4e2d\u8fd0\u884c\uff1a
node -v # \u67e5\u770b Node.js \u5f53\u524d\u7248\u672c\nyarn -v # \u67e5\u770b Yarn \u5f53\u524d\u7248\u672c
Yarn \u9ed8\u8ba4\u4ece\u56fd\u5916\u6e90\u6765\u4e0b\u8f7d\u5305\u4fe1\u606f\uff0c\u9274\u4e8e\u56fd\u5185\u73af\u5883\u56e0\u7d20\uff0c\u5728\u5f00\u59cb\u4e0b\u4e00\u6b65\u524d\u5148\u8bbe\u5b9a\u6dd8\u5b9d\u63d0\u4f9b\u955c\u50cf\uff1a
yarn config set registry https://registry.npmmirror.com\nyarn config set sass_binary_site https://npmmirror.com/mirrors/node-sass\n# restore\nyarn config delete registry\nyarn config delete sass_binary_site
\u4e5f\u53ef\u4ee5\u4f7f\u7528 nrm \u5305\uff0c\u53ef\u4ee5\u5feb\u901f\u5207\u6362\u4e0d\u540c\u56fd\u5185\u955c\u50cf\u6e90\u3002
\u5b89\u88c5
\u5168\u5c40 Angular Cli
\u5b89\u88c5\u4e4b\u524d\u8bf7\u5148\u786e\u4fdd\u672c\u5730\u5df2\u7ecf\u5b89\u88c5\u5168\u5c40 Angular Cli\uff0c\u53ea\u6709\u8fd9\u6837\u624d\u80fd\u968f\u65f6\u968f\u5730\u5728\u7ec8\u7aef\u4f7f\u7528 ng
\u547d\u4ee4\uff0c\u53ef\u4ee5\u901a\u8fc7\u7ec8\u7aef\u7a97\u53e3\u4e2d\u8fd0\u884c\uff1a
yarn global add @angular/cli
\u521b\u5efaNG-ALAIN\u9879\u76ee
NG-ALAIN \u5fc5\u987b\u5148\u521b\u5efa\u4e00\u4e2a\u5168\u65b0\u7684 Angular \u9879\u76ee\uff0c\u53ef\u4ee5\u901a\u8fc7\u7ec8\u7aef\u7a97\u53e3\u4e2d\u8fd0\u884c\uff1a
ng new my-project --style less --routing --package-manager yarn
\u5982\u679c\u4f60\u60f3\u4e86\u89e3 --style
\u3001--routing
\u53c2\u6570\uff0c\u8bf7\u53c2\u8003 ng new \u6587\u6863\u3002
\u63a5\u4e0b\u6765\u53ea\u9700\u8981\u5c06 NG-ALAIN \u6dfb\u52a0\u5230 my-project
\u9879\u76ee\u4e2d\u5373\u53ef\uff0c\u5728 my-project
\u76ee\u5f55\u4e0b\u901a\u8fc7\u7ec8\u7aef\u7a97\u53e3\u4e2d\u8fd0\u884c\uff1a
cd my-project\nng add ng-alain
NG-ALAIN \u4f1a\u8be2\u95ee\u662f\u5426\u9700\u8981\u4e00\u4e9b\u989d\u5916\u7684\u63d2\u4ef6\uff0c\u4e00\u5f00\u59cb\u5b8c\u5168\u53ef\u4ee5\u4e00\u8def\u56de\u8f66\uff0c\u8fd9\u4e9b\u63d2\u4ef6\u90fd\u662f\u53ef\u63d2\u62d4\uff0c\u540e\u671f\u53ef\u4ee5\u81ea\u884c\u6dfb\u52a0\u4e0e\u79fb\u9664\u3002
\u4ee5\u4e0a\u53ea\u4f1a\u751f\u6210\u5e72\u51c0\u7684\u9879\u76ee\uff0c\u53ef\u4ee5\u76f4\u63a5\u7528\u4e8e\u751f\u4ea7\u73af\u5883\u4e2d\u3002\u4f60\u53ef\u80fd\u5728\u9884\u89c8\u4e0a\u770b\u5230\u8bb8\u591a\u793a\u4f8b\u9875\uff0c\u5b83\u4eec\u5168\u90fd\u53ef\u4ee5\u5728 Github \u67e5\u770b\u5230\u6e90\u4ee3\u7801\uff0c\u5f53\u7136\u4e5f\u53ef\u4ee5\u901a\u8fc7 Git \u514b\u9686\u4ee3\u7801\u7684\u5f62\u5f0f\u83b7\u5f97\uff1a
git clone --depth=1 https://github.com/ng-alain/ng-alain.git my-project\ncd my-project\nyarn install
\u8fd0\u884c
yarn start
\u542f\u52a8\u5b8c\u6210\u540e\u4f1a\u6253\u5f00\u6d4f\u89c8\u5668\u8bbf\u95ee http://localhost:4200\uff0c\u82e5\u4f60\u770b\u5230\u5982\u4e0b\u9875\u9762\u5219\u4ee3\u8868\u6210\u529f\u4e86\u3002
\u606d\u559c\u4f60\uff0c\u4f60\u5df2\u7ecf\u6210\u529f\u90e8\u7f72\u4e00\u4e2a NG-ALAIN \u9879\u76ee\u3002
\u652f\u6301\u73af\u5883
\u53d7\u9650\u4e8e Angular\uff0c\u4e0d\u518d\u652f\u6301 IE
\u73b0\u4ee3\u6d4f\u89c8\u5668\uff0c\u6d4f\u89c8\u5668\u652f\u6301
\u652f\u6301\u670d\u52a1\u7aef\u6e32\u67d3
IE / Edge
Firefox
Chrome
Safari
Opera
ElectronEdge last 2 versions last 2 versions last 2 versions last 2 versions last 2 versions
\u5982\u4f55\u8d21\u732e
\u5728\u4efb\u4f55\u5f62\u5f0f\u7684\u53c2\u4e0e\u524d\uff0c\u8bf7\u5148\u9605\u8bfb \u8d21\u732e\u8005\u6587\u6863\u3002\u5982\u679c\u4f60\u5e0c\u671b\u53c2\u4e0e\u8d21\u732e\uff0c\u6b22\u8fce Pull Request\uff0c\u6216\u7ed9\u6211\u4eec \u62a5\u544a Bug\u3002
\u5f3a\u70c8\u63a8\u8350\u9605\u8bfb \u300a\u63d0\u95ee\u7684\u667a\u6167\u300b(\u672c\u6307\u5357\u4e0d\u63d0\u4f9b\u6b64\u9879\u76ee\u7684\u5b9e\u9645\u652f\u6301\u670d\u52a1\uff01)\u3001\u300a\u5982\u4f55\u5411\u5f00\u6e90\u793e\u533a\u63d0\u95ee\u9898\u300b \u548c \u300a\u5982\u4f55\u6709\u6548\u5730\u62a5\u544a Bug\u300b\u3001\u300a\u5982\u4f55\u5411\u5f00\u6e90\u9879\u76ee\u63d0\u4ea4\u65e0\u6cd5\u89e3\u7b54\u7684\u95ee\u9898\u300b\uff0c\u66f4\u597d\u7684\u95ee\u9898\u66f4\u5bb9\u6613\u83b7\u5f97\u5e2e\u52a9\u3002
\u793e\u533a\u4e92\u52a9
\u5982\u679c\u60a8\u5728\u4f7f\u7528\u7684\u8fc7\u7a0b\u4e2d\u78b0\u5230\u95ee\u9898\uff0c\u53ef\u4ee5\u901a\u8fc7\u4e0b\u9762\u51e0\u4e2a\u9014\u5f84\u5bfb\u6c42\u5e2e\u52a9\uff0c\u540c\u65f6\u6211\u4eec\u4e5f\u9f13\u52b1\u8d44\u6df1\u7528\u6237\u901a\u8fc7\u4e0b\u9762\u7684\u9014\u5f84\u7ed9\u65b0\u4eba\u63d0\u4f9b\u5e2e\u52a9\u3002
\u901a\u8fc7 Stack Overflow \u6216\u8005 Segment Fault \u63d0\u95ee\u65f6\uff0c\u5efa\u8bae\u52a0\u4e0a ng-alain
\u6807\u7b7e\u3002
QQ \u7fa4
\u52a0\u5165 NG-ALAIN \u81ea\u52a9\u670d\u52a1\u7fa4\uff08\u4e2d\u6587\uff09
\u6350\u52a9
\u5982\u679c\u4f60\u89c9\u5f97 NG-ALAIN \u4e0d\u9519\uff0c\u53ef\u4ee5\u8003\u8651\u81ea\u613f\u4e3a\u672c\u7ad9\u6253\u8d4f\u6216\u6350\u52a9\u3002
{class e{constructor(){this.item={cols:1,urls:{"en-US":"docs/global-config.en-US.md","zh-CN":"docs/global-config.zh-CN.md"},content:{"en-US":{content:'We add support of global configuration to many components. You can define the default behavior of the component through global configuration, thus reducing the code that needs to be written in the template, and support changing global config at runtime.
How to Use?
If you want to provide default configurations to some components, you should provide an object that implements the interface AlainConfig with the injection token ALAIN_CONFIG, in the root module (in another word, to the root injector). Like this:
// global-config.module.ts\nimport { AlainConfig, ALAIN_CONFIG } from \'@delon/util/config\';\n\nconst alainConfig: AlainConfig = {\n st: { ps: 3 },\n};\n\n@NgModule({\n providers: [\n { provide: ALAIN_CONFIG, useValue: alainConfig },\n ],\n})\nexport class GlobalConfigModule {}
These global configuration would be injected into a service named AlainConfigService
and gets stored.
About NG-ZORRO
Please refer to NG-ZORRO Website Documentation
',meta:{order:90,title:{"en-US":"Global Configuration","zh-CN":"\u5168\u5c40\u914d\u7f6e\u9879"},type:"Dev"},toc:[{id:"HowtoUse",title:"How to Use?",h:2},{id:"AboutNG-ZORRO",title:"About NG-ZORRO",h:2}]},"zh-CN":{content:'\u6211\u4eec\u7ed9\u4f17\u591a\u7ec4\u4ef6\u6dfb\u52a0\u4e86\u5168\u5c40\u914d\u7f6e\u529f\u80fd\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u5168\u5c40\u914d\u7f6e\u6765\u5b9a\u4e49\u7ec4\u4ef6\u7684\u9ed8\u8ba4\u884c\u4e3a\uff0c\u4ece\u800c\u51cf\u5c11\u5728\u6a21\u677f\u4e2d\u9700\u8981\u5199\u7684\u4ee3\u7801\uff08\u8ba9\u4f60\u7684\u4ee3\u7801\u66f4\u52a0\u6e05\u723d\uff09\uff0c\u8fd8\u80fd\u5728\u8fd0\u884c\u65f6\u4fee\u6539\u5168\u5c40\u914d\u7f6e\u9879\u3002
\u5982\u4f55\u4f7f\u7528
\u60f3\u8981\u4e3a\u67d0\u4e9b\u7ec4\u4ef6\u63d0\u4f9b\u9ed8\u8ba4\u914d\u7f6e\u9879\uff0c\u8bf7\u5728\u6839\u6ce8\u5165\u5668\u4e2d\u6839\u636e\u6ce8\u5165\u4ee4\u724c ALAIN_CONFIG
\u63d0\u4f9b\u4e00\u4e2a\u7b26\u5408 AlainConfig
\u63a5\u53e3\u7684\u5bf9\u8c61\uff0c\u4f8b\u5982\uff1a
// global-config.module.ts\nimport { AlainConfig, ALAIN_CONFIG } from \'@delon/util/config\';\n\nconst alainConfig: AlainConfig = {\n st: { ps: 3 },\n};\n\n@NgModule({\n providers: [\n { provide: ALAIN_CONFIG, useValue: alainConfig },\n ],\n})\nexport class GlobalConfigModule {}
\u8fd9\u4e9b\u5168\u5c40\u914d\u7f6e\u9879\u5c06\u4f1a\u88ab\u6ce8\u5165 AlainConfigService
\u5f53\u4e2d\u5e76\u4fdd\u5b58\u3002
\u5173\u4e8e NG-ZORRO \u5168\u5c40\u914d\u7f6e\u9879
\u8bf7\u53c2\u8003 NG-ZORRO \u5b98\u7f51\u6587\u6863
',meta:{order:90,title:{"en-US":"Global Configuration","zh-CN":"\u5168\u5c40\u914d\u7f6e\u9879"},type:"Dev"},toc:[{id:"\u5982\u4f55\u4f7f\u7528",title:"\u5982\u4f55\u4f7f\u7528",h:2},{id:"\u5173\u4e8eNG-ZORRO\u5168\u5c40\u914d\u7f6e\u9879",title:"\u5173\u4e8e NG-ZORRO \u5168\u5c40\u914d\u7f6e\u9879",h:2}]}},demo:!1},this.codes=[]}static#e=this.\u0275fac=function(t){return new(t||e)};static#t=this.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-global-config"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,o){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",o.codes)("item",o.item)},dependencies:[i.P],styles:["[_nghost-%COMP%]{display:block}"]})}return e})()},{path:"graph",redirectTo:"graph/zh",pathMatch:"full"},{path:"graph/:lang",component:(()=>{class e{constructor(){this.item={cols:1,urls:{"zh-CN":"docs/graph.md"},content:{"zh-CN":{content:' ',meta:{order:20,title:{"en-US":"Charts","zh-CN":"\u56fe\u8868"},type:"Advance",url:"/chart/getting-started"},toc:[]}},demo:!1},this.codes=[]}static#e=this.\u0275fac=function(t){return new(t||e)};static#t=this.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-graph"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,o){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",o.codes)("item",o.item)},dependencies:[i.P],styles:["[_nghost-%COMP%]{display:block}"]})}return e})()},{path:"how-to-start",redirectTo:"how-to-start/zh",pathMatch:"full"},{path:"how-to-start/:lang",component:(()=>{class e{constructor(){this.item={cols:1,urls:{"en-US":"docs/how-to-start.en-US.md","zh-CN":"docs/how-to-start.zh-CN.md"},content:{"en-US":{content:'First, pre-order preparation
As you begin your business development on NG-ALAIN, i recommend that you first review the following documents, which is very helpful for everyone on the team.
NG-ALAIN\'s base component library comes from NG-ZORRO, so you can get a very detailed API documentation for its use on the official website. For ng components provided by -alain are obtained through the component page.
Second, the startup process
NG-ALAIN is a scaffold that can be used directly in production environments. The prerequisite for understanding these details is that you have a certain knowledge of Angular. The following documents may be helpful to you before you start:
NG-ALAIN Getting started video (YouTube\u3001Tencent video\u3001Station B\uff09
When running an app via ng serve
, a complete Angular startup process would look like this:
Trigger APP_INITIALIZER
(the scaffolding implementation is implemented in StartupService.load
) to get the application information.
Trigger service routing (src/app/routes/routes-routing.module.ts` for scaffolding)
Rendering components
1) APP_INITIALIZER
From a mid and back-office perspective, NG-ALAIN always believes that a network request is required to get some application information (eg menu data, user data, etc.) before Angular starts.startup.service.ts\uff1bIt returns a Promise
object, which always needs to be called: resolve()
to ensure that Angular starts normally.
Network requests may encounter a 403 error because the scaffolding uses the user authentication module by default and always assumes that all requests must be a valid user authorization. For more documentation see:
After obtaining the application information, you need to assign some values \u200b\u200bto the built-in services of the scaffolding, including:
Application Information
Including: application name, description, year, information can be directly injected into the SettingsService
(API) and directly in the HTML template.
this.settingService.setApp(res.app);
User Info
Including: name, avatar, email address, etc., information can be directly injected into the SettingsService
(API) and directly in the HTML template.
this.settingService.setUser(res.user);
Layout information
Including: name, avatar, email, address, etc., information can be directly injected into the SettingsService
(API) and directly in the HTML template.
// Whether to fix the top menu\nthis.settingService.setLayout(`fixed`, false);\n// Whether to collapse the right menu\nthis.settingService.setLayout(`collapsed`, false);
Menu data
NG-ALAIN takes menu from the remote and can also inject MenuService
(API) to change the menu data. Of course, it is more reasonable to perform menu assignment before Angular starts.
Menu data Make sure ensure Menu format, menu data throughout Applications, for example: page header auto navigation page-header, page title text TitleService Wait.
this.menuService.add(res.menu);
Page title
If the page title always wants to add the application name as a suffix, you can re-adjust the suffix
attribute value by injecting TitleService
(API).
// Set the suffix of the page title\nthis.titleService.suffix = res.app.name;
ACL
this.aclService.setFull(true);
It is recommended to load the ACL access control permission data before starting. For more details, please refer to Access Control List.
Globalization
It is recommended to load the internationalization package first before starting, which will ensure that the page is rendered as the target language after the project is started. See Internationalization for more details.
2) Business routing
Scaffolding top-level routing begins with routes-routing.module.ts Its structure is as follows:
const routes: Routes = [\n {\n path: \'\',\n component: LayoutDefaultComponent,\n children: [\n { path: \'\', redirectTo: \'dashboard\', pathMatch: \'full\' },\n { path: \'dashboard\', component: DashboardComponent, data: { title: \'Dashboard\' } },\n // business submodule\n // { path: \'trade\', loadChildren: \'./trade/trade.module#TradeModule\' }\n ]\n },\n // Blank layout\n {\n path: \'blank\',\n component: LayoutBlankComponent,\n children: [\n ]\n },\n // passport\n {\n path: \'passport\',\n component: LayoutPassportComponent,\n children: [\n { path: \'login\', component: UserLoginComponent },\n { path: \'register\', component: UserRegisterComponent },\n { path: \'register-result\', component: UserRegisterResultComponent }\n ]\n },\n // Single page does not wrap Layout\n { path: \'callback/:type\', component: CallbackComponent },\n { path: \'403\', component: Exception403Component },\n { path: \'404\', component: Exception404Component },\n { path: \'500\', component: Exception500Component },\n { path: \'**\', redirectTo: \'dashboard\' }\n];
Above we used the LayoutDefaultComponent
base layout in the business module. User authorization uses LayoutPassportComponent
user authorization layout and the full screen layout.
It is recommended that all submodules be loaded using a lazy module, such as the TradeModule
order module, which organizes the code structure more efficiently.
Under what circumstances do you not use lazy loading?
Angular startup from the top-level component. When a lazy module is encountered, it will initiate a script request. At this time, the dashboard or login page will be blank due to network requests, which is not good for the experience.
Routing permission control
The routing URL may be affected by the browser\'s own historical memory, so that users may access the unprivileged route. If you want a better experience, you need to configure the canActivate
option on the route. When the user has no permission, it will utomatically jump to the relevant page. see the ACL Routing Guard section for details.
IDE
A developer must first sharpen his tools if he is to do his work well, NG-ALAIN recommended to use the Visual Studio Code IDE, because ng-alain adds some extra features to VSCode to better help you. Development.
Or use the NG-ALAIN Extension Pack suite directly.
Code fragment
Class style smart reminder
ng-alain has a lot of built-in toolkit styles (API), and the following plugins can be installed directly into the HTML template.
',meta:{order:0,title:"How to start",type:"Dev",i18n:"need-update"},toc:[{id:"First,pre-orderpreparation",title:"First, pre-order preparation",h:2},{id:"Second,thestartupprocess",title:"Second, the startup process",h:2,children:[{id:"1APP_INITIALIZER",title:"1) APP_INITIALIZER",h:3},{id:"2Businessrouting",title:"2) Business routing",h:3},{id:"Underwhatcircumstancesdoyounotuselazyloading",title:"Under what circumstances do you not use lazy loading?",h:3},{id:"Routingpermissioncontrol",title:"Routing permission control",h:3}]},{id:"IDE",title:"IDE",h:2,children:[{id:"Codefragment",title:"Code fragment",h:3},{id:"Classstylesmartreminder",title:"Class style smart reminder",h:3}]}]},"zh-CN":{content:'\u524d\u5e8f\u51c6\u5907
NG-ALAIN \u6280\u672f\u6808\u57fa\u4e8e Typescript\u3001Angular\u3001\u56fe\u8868G2 \u548c NG-ZORRO\uff0c\u5728\u5f00\u59cb\u5c1d\u8bd5\u4f7f\u7528 NG-ALAIN \u811a\u624b\u67b6\u524d\uff0c\u8bf7\u5148\u63d0\u524d\u4e86\u89e3\u548c\u5b66\u4e60\u8fd9\u4e9b\u77e5\u8bc6\u4f1a\u975e\u5e38\u6709\u5e2e\u52a9\u3002\u5982\u679c\u4f60\u662f\u4e00\u540d Java \u6216 C# \u540e\u7aef\u5f00\u53d1\u4eba\u5458\uff0c\u90a3\u4e48\u606d\u559c\u4f60\uff0c\u4f60\u6240\u89c1\u5230\u7684\u4e0d\u7ba1\u662f\u7ed3\u6784\u3001\u4ee3\u7801\u3001\u5f00\u53d1\u4f53\u9a8c\u7b49\u90fd\u662f\u4f60\u6240\u60f3\u7684\u90a3\u6837\u3002\u4f46\u4e0d\u7ba1\u600e\u4e48\u6837\uff0c\u60f3\u5199\u597d Angular \u4ee3\u7801\uff0c\u4ee5\u4e0b\u8fd9\u4e9b\u6587\u7ae0\u53ca\u793e\u533a\u662f\u4f60\u5fc5\u987b\u8981\u77e5\u9053\u7684\uff1a
\u6587\u6863\u7c7b
TypeScript\u4e2d\u6587\u6587\u6863\uff0c\u867d\u7136 TypeScript \u8ddf Java\u3001C# \u8bed\u6cd5\u5f88\u50cf\uff0c\u8fd9\u662f\u8bed\u6cd5\u57fa\u7840\u9700\u8981\u8ba4\u771f\u9605\u8bfb
Angular\u4e2d\u6587\u6587\u6863\uff0c\u5efa\u8bae\u4e00\u5b9a\u8981\u82b1\u65f6\u95f4\u9605\u8bfb\u6587\u6863\u90e8\u5206\uff0c\u900f\u8fc7\u5b83\u57fa\u672c\u4e0a\u5c31\u53ef\u4ee5\u5b66\u4f1a Angular\uff1b\u540c\u65f6\uff0c\u4e5f\u662f Angular API \u63a5\u53e3\u6587\u6863
NG-ZORRO\u4e2d\u6587\u6587\u6863\uff0cNG-ZORRO \u4f5c\u4e3a NG-ALAIN \u7684\u57fa\u7840\u7ec4\u4ef6\u5e93\uff0c\u5f53\u4f60\u4e0d\u61c2\u67d0\u4e2a\u7ec4\u4ef6\u65f6\uff0c\u5b83\u5c31\u662f\u6700\u597d\u7684\u6587\u6863\uff0c\u5305\u542b\u7ec4\u4ef6\u7528\u6cd5\u53caAPI\u8bf4\u660e
NG-ALAIN\u4e2d\u6587\u6587\u6863\uff0c\u5305\u542b\u6240\u6709 @delon/*
\u7c7b\u578b\u7684\u7528\u6cd5\u53caAPI\u8bf4\u660e
G2\u56fe\u8868\u4e2d\u6587\u6587\u6863\uff0c\u5982\u679c\u9700\u8981\u56fe\u8868\u5f00\u53d1\uff0c\u5219\u8fd9\u4efd\u6587\u6863\u662f\u5fc5\u5907
\u8f85\u52a9\u7c7b
Ant Design \u6307\u5f15\u6587\u7ae0\uff0c\u5b66\u4e60 Ant Design \u7684\u8bbe\u8ba1\u7406\u5ff5\uff0c\u975e\u5e38\u503c\u5f97\u9605\u8bfb\u7684\u90e8\u5206
NG-ZORRO \u793e\u533a\u63a8\u8350\uff0c\u4e00\u4efd\u975e\u5e38\u503c\u5f97\u5b66\u4e60\u7684\u6e05\u5355
NG-ALAIN \u5165\u95e8\u89c6\u9891\uff08YouTube\u3001\u817e\u8baf\u89c6\u9891\u3001B\u7ad9\uff09
\u5199\u5728\u524d\u9762
\u5f88\u591a\u4eba\u5728\u5b66\u4e60\u4e00\u9879\u65b0\u4e1c\u897f\u65f6\uff0c\u65e0\u5916\u4e4e\u5199\u4e2a Hello World \u6216\u662f\u5199\u4e00\u4e2a Http \u8bf7\u6c42\uff0c\u7136\u540e\u6162\u6162\u5f00\u59cb\u8f90\u5c04\u6240\u9700\u8981\u7684\u6280\u672f\u77e5\u8bc6\u3002\u4e00\u4e2a HTTP \u8bf7\u6c42\u5bf9\u4e2d\u540e\u53f0\u800c\u8a00\u4fbf\u662f\u6db5\u76d6\u4e86 CURD \u4e3b\u8981\u4efb\u52a1\uff0c\u751a\u81f3\u53ef\u4ee5\u8bf490%\u65f6\u95f4\u53ca\u529f\u80fd\u90fd\u5728\u505a\u8fd9\u9879\u5de5\u4f5c\u3002\u5728\u4ecb\u7ecd\u7ae0\u8282\u4e2d\u5df2\u7ecf\u63cf\u8ff0\u521b\u5efa\u4e00\u4e2a NG-ALAIN \u9879\u76ee\u5e76\u5982\u4f55\u8fd0\u884c\u5b83\uff0c\u5982\u679c\u6b64\u65f6\u4f60\u4e5f\u60f3\u8981\u5199\u4e2a Hello World\uff0c\u90a3\u4e48\u53ea\u9700\u8981\u5229\u7528 VSCode \u6253\u5f00\u8fd9\u4e2a\u9879\u76ee\uff0c\u5e76\u5728 dashboard.component.html
\u6587\u4ef6\u5185\u8f93\u5165\u6587\u672c\uff0c500ms \u540e\u5c31\u4f1a\u5728\u9875\u9762\u4e0a\u7acb\u5373\u5448\u73b0\u3002
\u6d41\u7a0b
\u56de\u8fc7\u5934\u6765\u6211\u4eec\u8bd5\u7740\u56de\u60f3\u4e00\u4e0b\uff0c\u4e00\u4e2a\u4e2d\u540e\u53f0\u9879\u76ee\uff0c\u4ece\u542f\u52a8\u518d\u5230\u5448\u73b0\u4e00\u4efd\u8ba2\u5355\u5217\u8868\u7684\u529f\u80fd\uff0c\u5bf9\u4e8e\u5f00\u53d1\u8005\u800c\u8a00\u5305\u542b\u4e86\u54ea\u4e9b\u4e8b\u4ef6\u3002\u65e0\u5916\u4e4e\u9879\u76ee\u542f\u52a8\u65f6\u5e94\u8be5\u52a0\u8f7d\u70b9\u4ec0\u4e48\u7cfb\u7edf\u914d\u7f6e\u9879\uff0c\u54ea\u4e9b\u9875\u9762\u7528\u6237\u65e0\u6743\u8fdb\u5165\uff1b\u628a\u7c92\u5ea6\u518d\u60f3\u7ec6\u4e00\u70b9\uff0c\u540c\u4e00\u4e2a\u9875\u9762\u4e0d\u540c\u7684\u6309\u94ae\u7ed9\u4e0d\u540c\u7684\u4eba\u7528\uff0cHTTP\u8bf7\u6c42\u82e5\u4ea7\u751f\u9519\u8bef\u662f\u4e0d\u662f\u5f97\u6bcf\u6b21\u90fd\u5199\u76f8\u540c\u7684\u5904\u7406\u4ee3\u7801\u7b49\u7b49\u3002
\u521d\u59cb\u5316\u9879\u76ee\u6570\u636e
Angular \u63d0\u4f9b\u4e00\u4e2aDI\uff08\u4f9d\u8d56\u6ce8\u5165\uff09\u4ee4\u724c APP_INITIALIZER
\u8ba9\u5e94\u7528\u542f\u52a8\u65f6\u53ef\u4ee5\u505a\u4e00\u4e9b\u4f1a\u5f71\u54cd\u6e32\u67d3\u7ed3\u679c\u7684\u6570\u636e\uff0c\u6bd4\u5982\uff1a\u8bed\u8a00\u6570\u636e\u3001\u83dc\u5355\u6570\u636e\u3001\u7528\u6237\u4fe1\u606f\u6570\u636e\u3001\u5b57\u5178\u6570\u636e\u7b49\uff0c\u5e76\u4e14\u5fc5\u987b\u8fd4\u56de\u4e00\u4e2a Promise
\u5f02\u6b65\u51fd\u6570\uff0c\u5f02\u6b65\u610f\u5473\u8005\u53ef\u4ee5\u505a\u5f88\u591a\u6709\u8da3\u7684\u4e8b\uff0c\u6bd4\u5982\u6570\u636e\u6765\u81ea\u8fdc\u7a0b\u3002APP_INITIALIZER
\u53ea\u4f1a\u6267\u884c\u4e00\u6b21\uff0c\u53ea\u9700\u8981\u5728 AppModule
\u6a21\u5757\u6ce8\u518c\u5b83\u5c31\u884c\u4e86\u3002
export function StartupServiceFactory(startupService: StartupService): () => Promise {\n return () => startupService.load();\n}\n\n@NgModule({\n declarations: [AppComponent],\n imports: [BrowserModule]\n providers: [{\n StartupService,\n {\n provide: APP_INITIALIZER,\n useFactory: StartupServiceFactory,\n deps: [StartupService],\n multi: true,\n },\n }],\n bootstrap: [AppComponent],\n})\nexport class AppModule {}
\u800c StartupService
\u5982\u4e0b\uff1a
@Injectable()\nexport class StartupService {\n constructor(private httpClient: HttpClient) {}\n\n load(): Promise { \n return new Promise((resolve) => {\n this.httpClient.get(``).subscribe(() => {\n resolve();\n });\n });\n }\n}
\u54ea\u6015 Http \u8bf7\u6c42\u5931\u8d25\uff0c\u8fd9\u91cc\u4e5f\u5fc5\u987b\u6267\u884c resolve()
\uff0c\u5426\u5219\u5e94\u7528\u5c31\u65e0\u6cd5\u542f\u52a8\u3002\u800c NG-ALAIN \u63d0\u4f9b\u7684 startup.service.ts \u5185\u5bb9\u66f4\u52a0\u4e30\u5bcc\u4e00\u70b9\uff0c\u5bf9\u4e8e\u5b8c\u6574\u7684\u4e2d\u540e\u53f0\u800c\u8a00\uff0c\u5927\u591a\u6570\u9879\u76ee\u4e2d\u4ee5\u4e0b\u8fd9\u4e9b\u4fe1\u606f\u90fd\u53ef\u4ee5\u5fc5\u5907\u7684\uff1a
\u6570\u636e\u7c7b\u578b \u63cf\u8ff0 \u5e94\u7528\u4fe1\u606f \u5e94\u7528\u540d\u79f0\u3001\u63cf\u8ff0\u3001\u5e74\u4efd\uff0c\u4fe1\u606f\u53ef\u4ee5\u76f4\u63a5\u6ce8\u5165 SettingsService
\uff08API\uff09\u540e\u76f4\u63a5\u5728HTML\u6a21\u677f\u4e2d\u8bbf\u95ee\u3002
\u4f8b\u5982\uff1athis.settingService.setApp(res.app);
\u7528\u6237\u4fe1\u606f \u5f53\u524d\u7528\u6237\u7684\u59d3\u540d\u3001\u5934\u50cf\u3001\u90ae\u7bb1\u5730\u5740\u7b49\uff0c\u4fe1\u606f\u53ef\u4ee5\u76f4\u63a5\u6ce8\u5165 SettingsService
\uff08API\uff09\u540e\u76f4\u63a5\u5728HTML\u6a21\u677f\u4e2d\u8bbf\u95ee\u3002
\u4f8b\u5982\uff1athis.settingService.setUser(res.user);
\u5e03\u5c40\u4fe1\u606f \u8c03\u6574\u4e3b\u9898\u914d\u7f6e\uff0c\u4f8b\u5982\uff1a\u56fa\u5b9a\u9876\u90e8\u83dc\u5355\u3001\u6298\u53e0\u83dc\u5355\u7b49\u3002
\u4f8b\u5982\uff1athis.settingService.setLayout("fixed", false);
\u6216 this.settingService.setLayout("collapsed", false);
\u83dc\u5355\u6570\u636e NG-ALAIN \u8ba4\u4e3a\u83dc\u5355\u6570\u636e\u4e5f\u662f\u6765\u81ea\u8fdc\u7a0b\uff0c\u4e5f\u53ef\u4ee5\u4efb\u610f\u4f4d\u7f6e\u6ce8\u5165 MenuService
\uff08API\uff09\u6765\u6539\u53d8\u83dc\u5355\u6570\u636e\uff0c\u5f53\u7136\u5728 Angular \u542f\u52a8\u4e4b\u524d\u6267\u884c\u83dc\u5355\u8d4b\u503c\u66f4\u4e3a\u5408\u7406\u3002
\u83dc\u5355\u6570\u636e\u52a1\u5fc5\u786e\u4fdd Menu \u683c\u5f0f\uff0c\u83dc\u5355\u6570\u636e\u8d2f\u7a7f\u6574\u4e2a\u5e94\u7528\uff0c\u4f8b\u5982\uff1a\u9875\u5934\u81ea\u52a8\u5bfc\u822a page-header\uff0c\u9875\u6807\u9898\u6587\u672c TitleService \u7b49\u3002
\u4f8b\u5982\uff1athis.menuService.add(res.menu);
\u9875\u9762\u6807\u9898 \u82e5\u9875\u9762\u6807\u9898\u603b\u5e0c\u671b\u52a0\u4e0a\u5e94\u7528\u540d\u79f0\u4e3a\u540e\u7f00\u65f6\uff0c\u53ef\u4ee5\u6ce8\u5165 TitleService
\uff08API\uff09\u91cd\u65b0\u8c03\u6574 suffix
\u5c5e\u6027\u503c\u3002
\u4f8b\u5982\u8bbe\u7f6e\u9875\u9762\u6807\u9898\u7684\u540e\u7f00\uff1athis.titleService.suffix = res.app.name;
ACL \u8bbf\u95ee\u63a7\u5236\u5217\u8868\u6570\u636e\uff0c\u5efa\u8bae\u5728\u542f\u52a8\u524d\u52a0\u8f7dACL\u8bbf\u95ee\u63a7\u5236\u6743\u9650\u6570\u636e\uff0c\u6709\u5173\u66f4\u591a\u7ec6\u8282\u53ef\u53c2\u8003 \u8bbf\u95ee\u63a7\u5236\u5217\u8868\u3002
\u4f8b\u5982\u8bbe\u7f6e\u5168\u91cf\u6743\u9650\uff1athis.aclService.setFull(true);
\u56fd\u9645\u5316 \u5efa\u8bae\u5728\u542f\u52a8\u524d\u4f18\u5148\u52a0\u8f7d\u56fd\u9645\u5316\u6570\u636e\u5305\uff0c\u8fd9\u6837\u53ef\u786e\u4fdd\u9879\u76ee\u542f\u52a8\u540e\u9875\u9762\u6e32\u67d3\u4e3a\u76ee\u6807\u8bed\u8a00\u3002\u66f4\u591a\u7ec6\u8282\u53c2\u8003\u56fd\u9645\u5316\u3002
\u4e1a\u52a1\u8def\u7531
\u5f53 Angular \u9879\u76ee\u6b63\u5f0f\u542f\u52a8\u540e\u4f1a\u8fdb\u5165\u6e32\u67d3\u52a8\u4f5c\uff0c\u6839\u636e\u5f53\u524d\u7684\u8def\u7531\u5730\u5740\u6765\u51b3\u5b9a\u4e00\u4e2a\u9875\u9762\u5982\u4f55\u6e32\u67d3\uff0c\u4ece\u6700\u9876\u5c42\u8def\u7531 routes-routing.module.ts \u5f00\u59cb\u4e00\u5c42\u5c42\u5bfb\u627e\uff0c\u5176\u7ed3\u6784\u5982\u4e0b\uff1a
const routes: Routes = [\n {\n path: \'\',\n component: LayoutBasicComponent,\n children: [\n { path: \'\', redirectTo: \'dashboard\', pathMatch: \'full\' },\n { path: \'dashboard\', component: DashboardComponent, data: { title: \'\u4eea\u8868\u76d8\' } },\n // \u4e1a\u52a1\u5b50\u6a21\u5757\n // { path: \'trade\', loadChildren: \'./trade/trade.module#TradeModule\' }\n ]\n },\n // \u7a7a\u767d\u5e03\u5c40\n {\n path: \'blank\',\n component: LayoutBlankComponent,\n children: [\n ]\n },\n // passport\n {\n path: \'passport\',\n component: LayoutPassportComponent,\n children: [\n { path: \'login\', component: UserLoginComponent },\n ]\n },\n // \u5355\u9875\u4e0d\u5305\u88f9Layout\n { path: \'passport/callback/:type\', component: CallbackComponent },\n { path: \'exception\', loadChildren: () => import(\'./exception/exception.module\').then((m) => m.ExceptionModule) },\n // \u672a\u547d\u4e2d\u8def\u7531\u5168\u90e8\u8df3\u8f6c\u81f3 `exception/404` \u9875\u9762\u4e0a\n { path: \'**\', redirectTo: \'exception/404\' },\n];
\u4e0a\u8ff0\u5728\u4e1a\u52a1\u6a21\u5757\u4e2d\u4f7f\u7528\u4e86 LayoutBasicComponent
\u57fa\u7840\u5e03\u5c40\u3001\u7528\u6237\u6388\u6743\u4f7f\u7528\u4e86 LayoutPassportComponent
\u7528\u6237\u6388\u6743\u5e03\u5c40\u4ee5\u53ca LayoutBlankComponent
\u7a7a\u767d\u5e03\u5c40\uff0c\u4ee5\u4e0a\u4e09\u79cd\u5e03\u5c40\u90fd\u53ef\u4ee5\u5728 layout \u76ee\u5f55\u4e0b\u627e\u5f97\u5230\u3002
\u4f8b\u5982\u5f53\u7528\u6237\u8bbf\u95ee /dashboard
\u8def\u7531\u65f6\uff0c\u4f1a\u5148\u7ecf\u8fc7 LayoutBasicComponent
-> DashboardComponent
\uff0c\u6700\u7ec8\u6362\u5f62\u6210\u4e00\u4e2a\u5e9e\u5927\u7684\u7ec4\u4ef6\u6811\u6765\u8868\u793a\u4e00\u4e2a\u5177\u4f53\u7684\u9875\u9762\u3002NG-ALAIN \u811a\u624b\u67b6\u5e2e\u52a9\u4f60\u5b8c\u6210\u5927\u591a\u6570\u5de5\u4f5c\uff0c\u800c\u4e00\u4e2a\u65b0\u5165\u95e8\u7684\u4eba\u66f4\u591a\u53ea\u9700\u8981\u5173\u5fc3 DashboardComponent
\u4e1a\u52a1\u7ec4\u4ef6\u8be5\u5982\u4f55\u5b9e\u73b0\u3002
\u4ec0\u4e48\u60c5\u51b5\u4e0b\u4e0d\u4f7f\u7528\u61d2\u52a0\u8f7d\uff1f
Angular \u542f\u52a8\u662f\u4ece\u9876\u5c42\u7ec4\u4ef6\u5f00\u59cb\u5411\u4e0b\u6e32\u67d3\uff0c\u5f53\u9047\u5230\u61d2\u6a21\u5757\u65f6\u4f1a\u5148\u53d1\u8d77\u811a\u672c\u8bf7\u6c42\uff0c\u6b64\u65f6\u4f1a\u56e0\u4e3a\u7f51\u7edc\u8bf7\u6c42\u5bfc\u81f4\u4eea\u8868\u76d8\u6216\u767b\u5f55\u9875\u77ed\u6682\u7684\u7a7a\u767d\uff0c\u8fd9\u5bf9\u4f53\u9a8c\u5e76\u4e0d\u597d\u3002
\u7528\u6237\u8ba4\u8bc1\u4e0e\u6388\u6743
\u9875\u9762\u80fd\u5426\u8bbf\u95ee\u53d6\u51b3\u4e8e\u7528\u6237\u662f\u5426\u767b\u5f55\u3001\u5df2\u7ecf\u767b\u5f55\u8fd8\u5f97\u5224\u65ad\u5426\u6709\u6388\u6743\uff0c\u800c\u8fd9\u4e24\u9879\u5de5\u4f5c\u5206\u522b\u4ea4\u7ed9 @delon/auth
\u4e0e @delon/acl
\u6765\u5b8c\u6210\u3002
\u7528\u6237\u8ba4\u8bc1
\u9996\u5148\u7528\u6237\u8bbf\u95ee\u9875\u9762\u65f6\u662f\u7531\u9876\u5c42\u8def\u7531\u5f00\u59cb\u5bfb\u627e\u547d\u4e2d\u540e\u8fdb\u884c\u6e32\u67d3\uff0c\u8981\u60f3\u8ba9\u6240\u6709\u672a\u767b\u5f55\u7528\u6237\u8df3\u8f6c\u5230\u767b\u5f55\u9875\u9762\uff0c\u53ef\u4ee5\u914d\u7f6e canActivate
\u9009\u9879\uff0c@delon/auth
\u5df2\u7ecf\u63d0\u4f9b\u4e86\u5177\u4f53\u7684\u5b9e\u73b0\uff0c\u4f8b\u5982\uff1a
const routes: Routes = [\n {\n path: \'\',\n component: LayoutBasicComponent,\n canActivate: [authSimpleCanActivate],\n children: [\n { path: \'\', redirectTo: \'dashboard\', pathMatch: \'full\' },\n { path: \'dashboard\', component: DashboardComponent, data: { title: \'\u4eea\u8868\u76d8\' } },\n ]\n },\n];
\u8fd9\u91cc\u7684 authSimpleCanActivate
\u662f\u56e0\u4e3a\u91c7\u7528\u57fa\u4e8e Simple Web Token \u8ba4\u8bc1\u98ce\u683c\uff0c\u5176\u4ed6\u8ba4\u8bc1\u65b9\u5f0f\u8bf7\u53c2\u8003\u7528\u6237\u8ba4\u8bc1\u7ae0\u8282\u3002
\u5f53\u7528\u6237\u672a\u767b\u5f55\u65f6\u4f1a\u76f4\u63a5\u8df3\u8f6c\u81f3 /passport/login
\u9875\u9762\uff0c\u5982\u679c\u91c7\u7528\u7684\u662f JWT \u8ba4\u8bc1\u65b9\u5f0f\uff0c\u8fd8\u4f1a\u5bf9 Token \u662f\u5426\u6709\u6548\u8fdb\u884c\u68c0\u9a8c\u3002
\u7528\u6237\u6388\u6743
\u63a5\u8005\u7528\u6237\u8bbf\u95ee\u7684\u9875\u9762\u8fd8\u9700\u8981\u53d6\u51b3\u4e8e\u6388\u6743\u7a0b\u5ea6\uff0c\u4f8b\u5982\u7cfb\u7edf\u914d\u7f6e\u9875\u666e\u901a\u7528\u6237\u80af\u5b9a\u65e0\u6cd5\u8fdb\u5165\u3002\u5728\u521d\u59cb\u5316\u9879\u76ee\u6570\u636e\u5c0f\u8282\u91cc\u4f1a\u6839\u636e\u5f53\u524d\u7528\u6237\u7684 Token \u6765\u83b7\u5f97\u6388\u6743\u7684\u6570\u636e\uff0c\u5e76\u5c06\u6570\u636e\u4ea4\u7ed9 @delon/acl
\uff0c\u540c\u65f6\u5b83\u4e5f\u63d0\u4f9b\u4e00\u7ec4\u8def\u7531\u5b88\u536b\u7684\u5177\u4f53\u5b9e\u73b0 aclCanActivate
\u65b9\u6cd5\uff0c\u4f8b\u5982\u5e0c\u671b\u6574\u4e2a\u7cfb\u7edf\u914d\u7f6e\u6a21\u5757\u90fd\u5fc5\u987b\u662f admin
\u89d2\u8272\u624d\u80fd\u8bbf\u95ee\uff0c\u5219\uff1a
const routes: Routes = [\n {\n path: \'sys\',\n canActivate: [aclCanActivate],\n data: { guard: \'admin\' },\n children: [\n { path: \'config\', component: ConfigComponent },\n ]\n },\n];
\u6b64\u65f6\uff0c\u5f53\u4e00\u4e2a\u672a\u6388\u6743 admin
\u89d2\u8272\u7684\u7528\u6237\u5c1d\u8bd5\u8bbf\u95ee /sys/config
\u9875\u9762\u65f6\u4f1a\u88ab\u8df3\u8f6c\u81f3\u672a\u6388\u6743\u9519\u8bef\u9875\u4e0a\u3002
\u5f53\u7136\u8fd8\u652f\u6301\u7c92\u5ea6\u6709\u66f4\u7ec6\u64cd\u4f5c\uff0c\u6bd4\u5982\u67d0\u4e2a\u6309\u94ae\uff0c\u8bf7\u53c2\u8003ACL\u7ae0\u8282\u3002
\u62e6\u622a\u7f51\u7edc\u8bf7\u6c42
\u7f51\u7edc\u8bf7\u6c42\u662f\u4e00\u9879\u975e\u5e38\u9891\u7e41\u7684\u5de5\u4f5c\uff0c\u5982\u679c\u60f3\u4f18\u96c5\u7684\u5728\u4e1a\u52a1\u7ec4\u4ef6\u5185\u4f7f\u7528\u7f51\u7edc\u8bf7\u6c42\u52a8\u4f5c\u7684\u8bdd\uff0c\u90a3\u4e48\u5c06\u670d\u52a1\u7aefURL\u524d\u7f00\u3001\u5f02\u5e38\u5904\u7406\u3001Token \u5237\u65b0\u7b49\u64cd\u4f5c\u96c6\u4e2d\u5904\u7406\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684\uff0cNG-ALAIN \u811a\u624b\u67b6\u63d0\u4f9b\u4e00\u4e2a default.interceptor.ts \u6587\u4ef6\u3002\u5b83\u4f1a\u5229\u7528\u4ee4\u724c HTTP_INTERCEPTORS
\u8d77\u5230\u4e00\u79cd\u62e6\u622a\u5668\u7684\u6548\u679c\u3002
\u6709\u5173\u4ee5\u4e0a\u96c6\u4e2d\u5904\u7406\u7684\u52a8\u4f5c\u7ec6\u8282\uff0c\u8bf7\u53c2\u8003 default.interceptor.ts \u6587\u4ef6\u3002
IDE
\u201c\u5de5\u6b32\u5584\u5176\u4e8b\uff0c\u5fc5\u5148\u5229\u5176\u5668\u662f\u201d\uff0cNG-ALAIN \u811a\u624b\u67b6\u63a8\u8350\u4f7f\u7528 Visual Studio Code IDE\uff0c\u56e0\u4e3a NG-ALAIN \u9488\u5bf9 VSCode \u589e\u52a0\u4e00\u4e9b\u989d\u5916\u7684\u7279\u6027\uff0c\u53ef\u4ee5\u66f4\u597d\u7684\u5e2e\u52a9\u4f60\u5f00\u53d1\u3002
\u6216\u8005\u76f4\u63a5\u4f7f\u7528 NG-ALAIN Extension Pack \u5957\u4ef6\u3002
\u4ee3\u7801\u7247\u65ad
Class\u6837\u5f0f\u667a\u80fd\u63d0\u9192
ng-alain \u5185\u7f6e\u4e86\u5927\u91cf\u7684\u5de5\u5177\u96c6\u6837\u5f0f\uff08API\uff09\uff0c\u5b89\u88c5\u4ee5\u4e0b\u63d2\u4ef6\u53ef\u4ee5\u76f4\u63a5\u5728HTML\u6a21\u677f\u91cc\u76f4\u63a5\u8bbf\u95ee\u5230\u5b83\u4eec\u3002
',meta:{order:0,title:"\u5982\u4f55\u5f00\u59cb",type:"Dev",i18n:"need-update"},toc:[{id:"\u524d\u5e8f\u51c6\u5907",title:"\u524d\u5e8f\u51c6\u5907",h:2},{id:"\u5199\u5728\u524d\u9762",title:"\u5199\u5728\u524d\u9762",h:2},{id:"\u6d41\u7a0b",title:"\u6d41\u7a0b",h:2,children:[{id:"\u521d\u59cb\u5316\u9879\u76ee\u6570\u636e",title:"\u521d\u59cb\u5316\u9879\u76ee\u6570\u636e",h:3},{id:"\u4e1a\u52a1\u8def\u7531",title:"\u4e1a\u52a1\u8def\u7531",h:3},{id:"\u7528\u6237\u8ba4\u8bc1\u4e0e\u6388\u6743",title:"\u7528\u6237\u8ba4\u8bc1\u4e0e\u6388\u6743",h:3},{id:"\u62e6\u622a\u7f51\u7edc\u8bf7\u6c42",title:"\u62e6\u622a\u7f51\u7edc\u8bf7\u6c42",h:3}]},{id:"IDE",title:"IDE",h:2,children:[{id:"\u4ee3\u7801\u7247\u65ad",title:"\u4ee3\u7801\u7247\u65ad",h:3},{id:"Class\u6837\u5f0f\u667a\u80fd\u63d0\u9192",title:"Class\u6837\u5f0f\u667a\u80fd\u63d0\u9192",h:3}]}]}},demo:!1},this.codes=[]}static#e=this.\u0275fac=function(t){return new(t||e)};static#t=this.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-how-to-start"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,o){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",o.codes)("item",o.item)},dependencies:[i.P],styles:["[_nghost-%COMP%]{display:block}"]})}return e})()},{path:"i18n",redirectTo:"i18n/zh",pathMatch:"full"},{path:"i18n/:lang",component:(()=>{class e{constructor(){this.item={cols:1,urls:{"en-US":"docs/i18n.en-US.md","zh-CN":"docs/i18n.zh-CN.md"},content:{"en-US":{content:'Angular internationalization provides a solution for extracting language files, but for NG-ALAIN, this is not the best way; this is mainly limited by @Delon/* The component library needs to provide a set of dynamic translation Service, therefore, NG-ALAIN has built-in a simple internationalized service ALAIN_I18N_TOKEN
interface.
How to configure
Scaffolding is composed of two important parts: ng-zorro-antd
and @delon/*
. These two libraries have their own international configuration. When internationalizing, they need to be the same for these libraries. Language configuration.
Angular
Angular configuration is mainly for currency, date format, etc., such as Chinese version:
import { registerLocaleData } from \'@angular/common\';\nimport zh from \'@angular/common/locales/zh\';\nregisterLocaleData(zh);
ng-zorro-antd
ng-zorro-antd
internationalization defaults to the Chinese version, for example the default English version:
import { en_US, provideNzI18n } from \'ng-zorro-antd/i18n\';\n@NgModule({\n providers: [provideNzI18n(en_US)]\n})\nexport class App1Module {}
Of course, you can also use runtime changes:
import { en_US, NzI18nService } from \'ng-zorro-antd/i18n\';\n...\nconstructor(private nzI18nService:NzI18nService) {\n}\n\nswitchLanguage() {\n this.nzI18nService.setLocale(en_US);\n}
@delon
@delon internationalization defaults to Chinese version, for example the default is English version:
import { DELON_LOCALE, en_US } from \'@delon/theme\';\n@NgModule({\n ...\n providers : [ { provide: DELON_LOCALE, useValue: en_US } ]\n})\nexport class AppModule { }
Of course, you can also use runtime changes:
import { en_US, DelonLocaleService } from \'@delon/theme\';\n...\nconstructor(private delonLocaleService: DelonLocaleService) {\n}\n\nswitchLanguage() {\n this.delonLocaleService.setLocale(en_US);\n}
ALAIN_I18N_TOKEN
@delon/*
class library has many data interface properties with the i18n typeface (for example: page-header
, st
column description, Menu
menu data, etc.) when you want the data for these components. When the interface can dynamically switch automatically according to the Key value in the current language, you also need to define a self-implementation service interface for ALAIN_I18N_TOKEN
(for example: I18NService /master/src/app/core/i18n/i18n.service.ts)) and register under the root module.
import { ALAIN_I18N_TOKEN } from \'@delon/theme\';\nimport { I18NService } from \'@core\';\n\n@NgModule({\n ...\n providers: [\n { provide: ALAIN_I18N_TOKEN, useClass: I18NService, multi: false }\n ]\n})\nexport class AppModule {}
i18n pipe
In order not to be named by the third-party pipes, the scaffolding contains a i18n
pipe, which is equivalent to calling the fanAIN
method of ALAIN_I18N_TOKEN
directly.
| i18n
will not listen to language change notifications, so there will be better performance. When you explicitly re-render the Angular project after switching languages, | i18n
will be more suitable.
How to add
When creating scaffolding from command line ng add ng-alain
, it is allowed to specify --i18n
to indicate whether the internationalized sample code is included.
How to delete
The sample code covers the following:
src/app/core/i18n
directory
Replace the pipe of i18n that may appear in the default layout using | i18n
Default language
Regardless of whether internationalization is required or not, since the default languages \u200b\u200bof class libraries such as Angular
, ng-zorro-antd
, @delon/*
are different, it is also necessary to ensure that the default language of these libraries is the same type. A simple example approach to understand the current language situation for each type of library:
import { Component } from \'@angular/core\';\n\n@Component({\n selector: \'app-i18n-test\',\n template: `\n <h2>angular</h2>\n <p>Date: {{now | date}}</p>\n <h2>ng-zorro-antd</h2>\n <nz-transfer [nzDataSource]="[]"></nz-transfer>\n <h2>@delon</h2>\n <div style="width: 200px">\n <tag-select>\n <nz-tag>1</nz-tag>\n </tag-select>\n </div>`,\n})\nexport class I18nTestComponent {\n now = new Date();\n}
Example
In order to make language uniformity, NG-ALAIN provides a simple unified configuration in the AppModule
root module.
Chinese Version
// #region i18n\nimport { default as ngLang } from \'@angular/common/locales/zh\';\nimport { provideNzI18n, zh_CN as zorroLang } from \'ng-zorro-antd/i18n\';\nimport { DELON_LOCALE, zh_CN as delonLang } from \'@delon/theme\';\nconst LANG = {\n abbr: \'zh\',\n ng: ngLang,\n zorro: zorroLang,\n delon: delonLang,\n};\n// register angular\nimport { registerLocaleData } from \'@angular/common\';\nregisterLocaleData(LANG.ng, LANG.abbr);\nconst LANG_PROVIDES = [\n { provide: LOCALE_ID, useValue: LANG.abbr },\n provideNzI18n(LANG.zorro),\n { provide: DELON_LOCALE, useValue: LANG.delon },\n];\n// #endregion\n\n@NgModule({\n providers: [...LANG_PROVIDES],\n})\nexport class AppModule {}
English version
// #region i18n\nimport { default as ngLang } from \'@angular/common/locales/en\';\nimport { provideNzI18n, en_US as zorroLang } from \'ng-zorro-antd/i18n\';\nimport { DELON_LOCALE, en_US as delonLang } from \'@delon/theme\';\nconst LANG = {\n abbr: \'en\',\n ng: ngLang,\n zorro: zorroLang,\n delon: delonLang,\n};\n// register angular\nimport { registerLocaleData } from \'@angular/common\';\nregisterLocaleData(LANG.ng, LANG.abbr);\nconst LANG_PROVIDES = [\n { provide: LOCALE_ID, useValue: LANG.abbr },\n provideNzI18n(LANG.zorro),\n { provide: DELON_LOCALE, useValue: LANG.delon },\n];\n// #endregion\n\n@NgModule({\n providers: [...LANG_PROVIDES],\n})\nexport class AppModule {}
Command Line
Use the defaultLanguage plugin to quickly switch between the default locales.
Internationalized routing
If you want to toggle internationalization by routed URLs, e.g. by accessing /zh
and /en
to change the language, just use the alainI18nCanActivate
guard in the root route:
const routes: Route[] = [\n {\n path: \'\',\n component: LayoutComponent,\n canActivateChild: [alainI18nCanActivate],\n children: [\n { path: \'\', redirectTo: \'en\', pathMatch: \'full\' },\n { path: \':i18n\', component: HomeComponent }\n ]\n }\n];
Where :i18n
is a fixed value of the parameter, which can be adjusted by the Global Configuration paramNameOfUrlGuard
.
',meta:{order:30,title:{"en-US":"I18n","zh-CN":"\u56fd\u9645\u5316"},type:"Advance"},toc:[{id:"Howtoconfigure",title:"How to configure",h:2,children:[{id:"Angular",title:"Angular",h:3},{id:"ng-zorro-antd",title:"ng-zorro-antd",h:3},{id:"@delon",title:"@delon",h:3}]},{id:"ALAIN_I18N_TOKEN",title:"ALAIN_I18N_TOKEN",h:2,children:[{id:"i18npipe",title:"i18n pipe",h:3}]},{id:"Howtoadd",title:"How to add",h:2},{id:"Howtodelete",title:"How to delete",h:2},{id:"Defaultlanguage",title:"Default language",h:2,children:[{id:"Example",title:"Example",h:3},{id:"CommandLine",title:"Command Line",h:3}]},{id:"Internationalizedrouting",title:"Internationalized routing",h:2}]},"zh-CN":{content:'Angular \u56fd\u9645\u5316\u63d0\u4f9b\u4e00\u79cd\u53ef\u88ab\u63d0\u53d6\u8bed\u8a00\u6587\u4ef6\u7684\u65b9\u6848\uff0c\u4f46\u5bf9\u4e8e NG-ALAIN \u800c\u8a00\uff0c\u8fd9\u5e76\u4e0d\u662f\u6700\u597d\u7684\u65b9\u5f0f\uff1b\u8fd9\u4e3b\u8981\u53d7\u9650\u4e8e @Delon/* \u7ec4\u4ef6\u5e93\u9700\u8981\u63d0\u4f9b\u4e00\u5957\u5e26\u6709\u52a8\u6001\u7ffb\u8bd1\u7684\u670d\u52a1\uff0c\u56e0\u6b64\uff0cNG-ALAIN \u5185\u7f6e\u4e00\u4e2a\u7b80\u6613\u7684\u56fd\u9645\u5316\u670d\u52a1 ALAIN_I18N_TOKEN
\u63a5\u53e3\u3002
\u5982\u4f55\u914d\u7f6e
\u811a\u624b\u67b6\u662f\u7531 ng-zorro-antd
\u3001@delon/*
\u7c7b\u5e93\u4e24\u4e2a\u91cd\u8981\u90e8\u5206\u7ec4\u4ef6\uff0c\u800c\u8fd9\u4e24\u4e2a\u7c7b\u5e93\u6709\u81ea\u5df1\u7684\u56fd\u9645\u5316\u914d\u7f6e\uff0c\u5f53\u8fdb\u884c\u56fd\u9645\u5316\u65f6\u9700\u8981\u5bf9\u8fd9\u4e9b\u7c7b\u5e93\u8fdb\u884c\u76f8\u540c\u8bed\u8a00\u7684\u914d\u7f6e\u3002
Angular
Angular \u914d\u7f6e\u4e3b\u8981\u662f\u9488\u5bf9\u8d27\u5e01\u3001\u65e5\u671f\u683c\u5f0f\u7b49\uff0c\u4f8b\u5982\u4e2d\u6587\u7248\u672c\uff1a
import { registerLocaleData } from \'@angular/common\';\nimport zh from \'@angular/common/locales/zh\';\nregisterLocaleData(zh);
ng-zorro-antd
NG-ZORRO \u56fd\u9645\u5316\u9ed8\u8ba4\u662f\u4e2d\u6587\u7248\uff0c\u4f8b\u5982\u9ed8\u8ba4\u4e3a\u82f1\u6587\u7248\u672c\uff1a
import { en_US, provideNzI18n } from \'ng-zorro-antd/i18n\';\n@NgModule({\n providers: [provideNzI18n(en_US)]\n})\nexport class App1Module {}
\u5f53\u7136\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528\u8fd0\u884c\u65f6\u66f4\u6539\uff1a
import { en_US, NzI18nService } from \'ng-zorro-antd/i18n\';\n...\nconstructor(private nzI18nService:NzI18nService) {\n}\n\nswitchLanguage() {\n this.nzI18nService.setLocale(en_US);\n}
@delon
@delon \u56fd\u9645\u5316\u9ed8\u8ba4\u662f\u4e2d\u6587\u7248\uff0c\u4f8b\u5982\u9ed8\u8ba4\u4e3a\u82f1\u6587\u7248\u672c\uff1a
import { DELON_LOCALE, en_US } from \'@delon/theme\';\n@NgModule({\n ...\n providers : [ { provide: DELON_LOCALE, useValue: en_US } ]\n})\nexport class AppModule { }
\u5f53\u7136\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528\u8fd0\u884c\u65f6\u66f4\u6539\uff1a
import { en_US, DelonLocaleService } from \'@delon/theme\';\n...\nconstructor(private delonLocaleService: DelonLocaleService) {\n}\n\nswitchLanguage() {\n this.delonLocaleService.setLocale(en_US);\n}
ALAIN_I18N_TOKEN
@delon/*
\u7c7b\u5e93\u6709\u8bb8\u591a\u5e26\u6709 i18n \u5b57\u6837\u7684\u6570\u636e\u63a5\u53e3\u5c5e\u6027\uff08\u4f8b\u5982\uff1apage-header
\u3001st
\u5217\u63cf\u8ff0\u3001Menu
\u83dc\u5355\u6570\u636e\u7b49\u7b49\uff09\uff0c\u5f53\u4f60\u5e0c\u671b\u8fd9\u4e9b\u7ec4\u4ef6\u7684\u6570\u636e\u63a5\u53e3\u80fd\u52a8\u6001\u6839\u636e Key \u503c\u6309\u5f53\u524d\u8bed\u8a00\u81ea\u52a8\u5207\u6362\u65f6\uff0c\u4f60\u8fd8\u9700\u8981\u5bf9 ALAIN_I18N_TOKEN
\u5b9a\u4e49\u4e00\u4e2a\u81ea\u5b9e\u73b0\u670d\u52a1\u63a5\u53e3\uff08\u4f8b\u5982\uff1aI18NService\uff09\uff0c\u5e76\u5728\u6839\u6a21\u5757\u4e0b\u6ce8\u518c\u3002
import { ALAIN_I18N_TOKEN } from \'@delon/theme\';\nimport { I18NService } from \'@core\';\n\n@NgModule({\n ...\n providers: [\n { provide: ALAIN_I18N_TOKEN, useClass: I18NService, multi: false }\n ]\n})\nexport class AppModule {}
i18n\u7ba1\u9053
\u4e3a\u4e86\u4e0d\u53d7\u7b2c\u4e09\u65b9\u5404\u81ea\u7ba1\u9053\u7684\u547d\u540d\u65b9\u5f0f\uff0c\u811a\u624b\u67b6\u5305\u542b\u4e00\u4e2a i18n
\u7684\u7ba1\u9053\uff0c\u5b83\u76f8\u5f53\u4e8e\u76f4\u63a5\u8c03\u7528 ALAIN_I18N_TOKEN
\u7684 fanyi
\u65b9\u6cd5\u3002
| i18n
\u4e0d\u4f1a\u76d1\u542c\u8bed\u8a00\u53d8\u66f4\u901a\u77e5\u6240\u4ee5\u4f1a\u6709\u66f4\u597d\u7684\u6027\u80fd\uff0c\u5f53\u4f60\u660e\u786e\u5728\u5207\u6362\u8bed\u8a00\u540e\u4f1a\u91cd\u65b0\u6e32\u67d3 Angular \u9879\u76ee\u65f6 | i18n
\u4f1a\u66f4\u9002\u5408\u3002
\u5982\u4f55\u6dfb\u52a0
\u521b\u5efa\u811a\u624b\u67b6\u547d\u4ee4\u884c ng add ng-alain
\u65f6\u5141\u8bb8\u6307\u5b9a --i18n
\u8868\u793a\u662f\u5426\u5305\u542b\u56fd\u9645\u5316\u793a\u4f8b\u4ee3\u7801\u3002
\u5982\u4f55\u5220\u9664
\u793a\u4f8b\u4ee3\u7801\u6d89\u53ca\u5185\u5bb9\u5305\u62ec\uff1a
src/app/core/i18n
\u76ee\u5f55
\u66ff\u6362\u6389\u9ed8\u8ba4\u5e03\u5c40\u53ef\u80fd\u51fa\u73b0\u7684 I18n \u7684 Pipe \u4f7f\u7528 | i18n
\u9ed8\u8ba4\u8bed\u8a00
\u4e0d\u7ba1\u662f\u5426\u9700\u8981\u56fd\u9645\u5316\uff0c\u7531\u4e8e Angular
\u3001ng-zorro-antd
\u3001@delon/*
\u7b49\u7c7b\u5e93\u7684\u9ed8\u8ba4\u8bed\u8a00\u90fd\u4e0d\u540c\uff0c\u56e0\u6b64\u8fd8\u9700\u8981\u786e\u4fdd\u8fd9\u4e9b\u7c7b\u5e93\u7684\u9ed8\u8ba4\u8bed\u8a00\u662f\u540c\u4e00\u7c7b\u578b\u3002\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\u529e\u6cd5\u53ef\u4ee5\u4e86\u89e3\u5404\u7c7b\u5e93\u5f53\u524d\u8bed\u8a00\u60c5\u51b5\uff1a
import { Component } from \'@angular/core\';\n\n@Component({\n selector: \'app-i18n-test\',\n template: `\n <h2>angular</h2>\n <p>Date: {{now | date}}</p>\n <h2>ng-zorro-antd</h2>\n <nz-transfer [nzDataSource]="[]"></nz-transfer>\n <h2>@delon</h2>\n <div style="width: 200px">\n <tag-select>\n <nz-tag>1</nz-tag>\n </tag-select>\n </div>`,\n})\nexport class I18nTestComponent {\n now = new Date();\n}
\u793a\u4f8b
\u4e3a\u4e86\u4f7f\u8bed\u8a00\u7edf\u4e00\u6027\uff0cNG-ALAIN \u63d0\u4f9b\u4e00\u4e2a\u5728 AppModule
\u6839\u6a21\u5757\u91cc\u7b80\u5355\u7684\u7edf\u4e00\u914d\u7f6e\u65b9\u5f0f\u3002
\u4e2d\u6587\u7248
// #region i18n\nimport { default as ngLang } from \'@angular/common/locales/zh\';\nimport { provideNzI18n, zh_CN as zorroLang } from \'ng-zorro-antd/i18n\';\nimport { DELON_LOCALE, zh_CN as delonLang } from \'@delon/theme\';\nconst LANG = {\n abbr: \'zh\',\n ng: ngLang,\n zorro: zorroLang,\n delon: delonLang,\n};\n// register angular\nimport { registerLocaleData } from \'@angular/common\';\nregisterLocaleData(LANG.ng, LANG.abbr);\nconst LANG_PROVIDES = [\n { provide: LOCALE_ID, useValue: LANG.abbr },\n provideNzI18n(LANG.zorro),\n { provide: DELON_LOCALE, useValue: LANG.delon },\n];\n// #endregion\n\n@NgModule({\n providers: [...LANG_PROVIDES],\n})\nexport class AppModule {}
\u82f1\u6587\u7248
// #region i18n\nimport { default as ngLang } from \'@angular/common/locales/en\';\nimport { provideNzI18n, en_US as zorroLang } from \'ng-zorro-antd/i18n\';\nimport { DELON_LOCALE, en_US as delonLang } from \'@delon/theme\';\nconst LANG = {\n abbr: \'en\',\n ng: ngLang,\n zorro: zorroLang,\n delon: delonLang,\n};\n// register angular\nimport { registerLocaleData } from \'@angular/common\';\nregisterLocaleData(LANG.ng, LANG.abbr);\nconst LANG_PROVIDES = [\n { provide: LOCALE_ID, useValue: LANG.abbr },\n provideNzI18n(LANG.zorro),\n { provide: DELON_LOCALE, useValue: LANG.delon },\n];\n// #endregion\n\n@NgModule({\n providers: [...LANG_PROVIDES],\n})\nexport class AppModule {}
\u547d\u4ee4\u884c
\u4f7f\u7528 defaultLanguage \u63d2\u4ef6\u53ef\u4ee5\u5feb\u901f\u5207\u6362\u9ed8\u8ba4\u8bed\u8a00\u73af\u5883\u3002
\u56fd\u9645\u5316\u8def\u7531
\u82e5\u60f3\u901a\u8fc7\u8def\u7531\u7684URL\u6765\u5207\u6362\u56fd\u9645\u5316\uff0c\u4f8b\u5982\uff1a\u901a\u8fc7\u8bbf\u95ee /zh
\u548c /en
\u6765\u53d8\u66f4\u8bed\u8a00\uff0c\u5219\u53ea\u9700\u8981\u5728\u6839\u8def\u7531\u4e2d\u4f7f\u7528 alainI18nCanActivate
\u5b88\u536b\uff1a
const routes: Route[] = [\n {\n path: \'\',\n component: LayoutComponent,\n canActivateChild: [alainI18nCanActivate],\n children: [\n { path: \'\', redirectTo: \'en\', pathMatch: \'full\' },\n { path: \':i18n\', component: HomeComponent }\n ]\n }\n];
\u5176\u4e2d :i18n
\u662f\u53c2\u6570\u56fa\u5b9a\u503c\uff0c\u53ef\u4ee5\u901a\u8fc7\u5168\u5c40\u914d\u7f6e paramNameOfUrlGuard
\u6765\u8c03\u6574\u3002
',meta:{order:30,title:{"en-US":"I18n","zh-CN":"\u56fd\u9645\u5316"},type:"Advance"},toc:[{id:"\u5982\u4f55\u914d\u7f6e",title:"\u5982\u4f55\u914d\u7f6e",h:2,children:[{id:"Angular",title:"Angular",h:3},{id:"ng-zorro-antd",title:"ng-zorro-antd",h:3},{id:"@delon",title:"@delon",h:3}]},{id:"ALAIN_I18N_TOKEN",title:"ALAIN_I18N_TOKEN",h:2,children:[{id:"i18n\u7ba1\u9053",title:"i18n\u7ba1\u9053",h:3}]},{id:"\u5982\u4f55\u6dfb\u52a0",title:"\u5982\u4f55\u6dfb\u52a0",h:2},{id:"\u5982\u4f55\u5220\u9664",title:"\u5982\u4f55\u5220\u9664",h:2},{id:"\u9ed8\u8ba4\u8bed\u8a00",title:"\u9ed8\u8ba4\u8bed\u8a00",h:2,children:[{id:"\u793a\u4f8b",title:"\u793a\u4f8b",h:3},{id:"\u547d\u4ee4\u884c",title:"\u547d\u4ee4\u884c",h:3}]},{id:"\u56fd\u9645\u5316\u8def\u7531",title:"\u56fd\u9645\u5316\u8def\u7531",h:2}]}},demo:!1},this.codes=[]}static#e=this.\u0275fac=function(t){return new(t||e)};static#t=this.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-i18n"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,o){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",o.codes)("item",o.item)},dependencies:[i.P],styles:["[_nghost-%COMP%]{display:block}"]})}return e})()},{path:"import",redirectTo:"import/zh",pathMatch:"full"},{path:"import/:lang",component:(()=>{class e{constructor(){this.item={cols:1,urls:{"en-US":"docs/import.en-US.md","zh-CN":"docs/import.zh-CN.md"},content:{"en-US":{content:'In addition to the NG-ALAIN base component and the @delon business component, sometimes we need to reference other external class libraries, the following is how to use the rich text component ngx-tinymce:
Angular Component
Installing dependencies
yarn add ngx-tinymce
Import module
You may need to use rich editor in all submodules, as it\'s recommended to import and export them in the SharedModule
module.
// #region third libs\nimport { NgxTinymceModule } from \'ngx-tinymce\';\nconst THIRDMODULES = [ NgxTinymceModule ];\n// #endregion
The region: third libs
region is a coding convention for NG-ALAIN, register all third-party components into the THIRDMODULES
variable, for more coding conventions, refer to Style Guide.
For some third-party components, may be required global configuration. It\'s recommended to register in the root module, for example:
import { NgxTinymceModule } from \'ngx-tinymce\';\n@NgModule({\n imports: [\n BrowserModule,\n NgxTinymceModule.forRoot({\n baseURL: \'//cdn.bootcss.com/tinymce/4.7.13/\'\n })\n ]\n})\nexport class AppModule { }
Next you can use ngx-tinymce
in any submodule:
<tinymce [(ngModel)]="html"></tinymce>
Non-Angular Component
Referencing a non-Angular component is actually loading a JavaScript class library file, such as the QR code library qrious:
Installing dependencies
yarn add qrious
Import Scripts
Add qrious.min.js
to the scripts
node in angular.json
:
"scripts": [\n "node_modules/qrious/dist/qrious.min.js"\n]
If the third-party library requires additional styles, you also need to add a path to styles
.
Note: You need to re-run ng s
.
Lazy loading script
The above import script method will package the code directly into scripts.js
, which will cause the scripts.js
to become larger. NG-ALAIN provides another delayed loading CDN library script solution for low-usage services. (Example: zip compression), you can use LazyService to delay loading remote CDN scripts.
How to use
Angular is using TypeScript language, and all types must be clearly defined to be used. For details, please refer to Angular How to use third-party libraries.
A sample code for the call:
declare var QRious: any;\n\n@Component()\nexport class DEMOComponent {\n constructor() {\n const qr = new QRious();\n }\n}',meta:{order:60,title:"Use a third-party lib",type:"Dev"},toc:[{id:"AngularComponent",title:"Angular Component",h:2,children:[{id:"Installingdependencies",title:"Installing dependencies",h:3},{id:"Importmodule",title:"Import module",h:3}]},{id:"Non-AngularComponent",title:"Non-Angular Component",h:2,children:[{id:"Installingdependencies",title:"Installing dependencies",h:3},{id:"ImportScripts",title:"Import Scripts",h:3},{id:"Howtouse",title:"How to use",h:3}]}]},"zh-CN":{content:'\u9664\u4e86 NG-ZORRO \u57fa\u7840\u7ec4\u4ef6\u4ee5\u53ca @delon \u4e1a\u52a1\u7ec4\u4ef6\u4ee5\u5916\uff0c\u6709\u65f6\u6211\u4eec\u8fd8\u9700\u8981\u5f15\u7528\u5176\u4ed6\u5916\u90e8\u7c7b\u5e93\uff0c\u4ee5\u4e0b\u5c06\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528\u5bcc\u6587\u672c\u7ec4\u4ef6 ngx-tinymce\uff1a
Angular\u7ec4\u4ef6
\u5b89\u88c5\u4f9d\u8d56\u5305
yarn add ngx-tinymce
\u6ce8\u518c
\u50cf\u5bcc\u6587\u672c\u6846\u4f60\u53ef\u80fd\u9700\u8981\u5728\u6240\u6709\u5b50\u6a21\u5757\u4e2d\u90fd\u4f1a\u53ef\u80fd\u4f1a\u7528\u5230\uff0c\u56e0\u4e3a\u5efa\u8bae\u5728 SharedModule
\u6a21\u5757\u4e2d\u5bfc\u5165\u548c\u5bfc\u51fa\u4ed6\u3002
// #region third libs\nimport { NgxTinymceModule } from \'ngx-tinymce\';\nconst THIRDMODULES = [ NgxTinymceModule ];\n// #endregion
region: third libs
\u533a\u57df\u662fNG-ALAIN\u7684\u4e00\u4e2a\u7f16\u7801\u7ea6\u5b9a\uff0c\u5c06\u6240\u6709\u7b2c\u4e09\u65b9\u7ec4\u4ef6\u6ce8\u518c\u81f3 THIRDMODULES
\u53d8\u91cf\u4e2d\u5373\u53ef\uff0c\u800c\u65e0\u987b\u5173\u5fc3 @NgModule
\u5185\u5728\u7684\u5199\u6cd5\uff0c\u6709\u5173\u66f4\u591a\u7f16\u7801\u7ea6\u5b9a\u53ef\u4ee5\u53c2\u8003\u7f16\u7801\u89c4\u8303\u5efa\u8bae\u3002
\u5bf9\u4e8e\u90e8\u5206\u7b2c\u4e09\u65b9\u7ec4\u4ef6\uff0c\u53ef\u80fd\u4f1a\u9700\u8981\u4e00\u4e9b\u914d\u7f6e\u9879\uff0c\u5efa\u8bae\u5728\u6839\u6a21\u5757\u4e2d\u6ce8\u518c\uff0c\u4f8b\u5982\uff1a
import { NgxTinymceModule } from \'ngx-tinymce\';\n@NgModule({\n imports: [\n BrowserModule,\n NgxTinymceModule.forRoot({\n baseURL: \'//cdn.bootcss.com/tinymce/4.7.13/\'\n })\n ]\n})\nexport class AppModule { }
\u63a5\u4e0b\u6765\u4f60\u53ef\u4ee5\u5728\u4efb\u4f55\u5b50\u6a21\u5757\u4e2d\u4f7f\u7528 ngx-tinymce
\uff1a
<tinymce [(ngModel)]="html"></tinymce>
\u975eAngular\u7ec4\u4ef6
\u5f15\u7528\u4e00\u4e2a\u975e Angular \u7ec4\u4ef6\u5b9e\u9645\u4e0a\u662f\u4e00\u4e2a JavaScript \u7c7b\u5e93\uff0c\u4f8b\u5982\u4e8c\u7ef4\u7801\u7c7b\u5e93 qrious\uff0c\u8fd9\u662f\u4e00\u4e2a\u7eaf\u6d01\u7684 JavaScript \u7c7b\u5e93\uff08\u5efa\u8bae\u5c3d\u53ef\u80fd\u4f7f\u7528\u7eaf\u6d01\u7c7b\u5e93\u800c\u975e\u5e26\u6709\u4f9d\u8d56\u5176\u4ed6\uff09\u3002
\u5b89\u88c5\u4f9d\u8d56\u5305
yarn add qrious
\u5bfc\u5165\u811a\u672c
\u5728 angular.json
\u627e\u5230 scripts
\u8282\u70b9\u5e76\u589e\u52a0\uff1a
"scripts": [\n "node_modules/qrious/dist/qrious.min.js"\n]
\u5982\u679c\u7b2c\u4e09\u65b9\u7c7b\u5e93\u9700\u8981\u989d\u5916\u7684\u6837\u5f0f\uff0c\u8fd8\u9700\u8981\u5728 styles
\u589e\u52a0\u8def\u5f84\u3002
\u6ce8\u610f\uff1a\u9700\u8981\u91cd\u65b0\u8fd0\u884c ng s
\u624d\u4f1a\u751f\u6548\u3002
\u5ef6\u8fdf\u52a0\u8f7d\u811a\u672c
\u4e0a\u8ff0\u5bfc\u5165\u811a\u672c\u65b9\u5f0f\u4f1a\u628a\u4ee3\u7801\u76f4\u63a5\u6253\u5305\u8fdb scripts.js
\uff0c\u8fd9\u4f1a\u5bfc\u81f4 scripts.js
\u4f53\u79ef\u53d8\u5927\uff0cNG-ALAIN \u63d0\u4f9b\u53e6\u4e00\u79cd\u5ef6\u8fdf\u52a0\u8f7dCDN\u7c7b\u5e93\u811a\u672c\u89e3\u51b3\u65b9\u6848\uff0c\u9002\u7528\u4f4e\u4f7f\u7528\u7387\u7684\u4e1a\u52a1\uff08\u4f8b\u5982\uff1azip \u538b\u7f29\uff09\uff0c\u53ef\u4ee5\u5229\u7528 LazyService \u5ef6\u8fdf\u52a0\u8f7d\u8fdc\u7a0bCDN\u811a\u672c\u3002
\u4f7f\u7528
Angular \u662f\u91c7\u7528 TypeScript \u8bed\u8a00\uff0c\u6240\u6709\u7c7b\u578b\u90fd\u5fc5\u987b\u660e\u786e\u5b9a\u4e49\u624d\u80fd\u4f7f\u7528\uff0c\u7ec6\u8282\u8bf7\u53c2\u8003 Angular \u5982\u4f55\u4f7f\u7528\u7b2c\u4e09\u65b9\u5e93\u3002
\u4e00\u4e2a\u8c03\u7528\u7684\u793a\u4f8b\u4ee3\u7801\uff1a
declare var QRious: any;\n\n@Component()\nexport class DEMOComponent {\n constructor() {\n const qr = new QRious();\n }\n}',meta:{order:60,title:"\u4f7f\u7528\u7b2c\u4e09\u65b9\u7c7b\u5e93",type:"Dev"},toc:[{id:"Angular\u7ec4\u4ef6",title:"Angular\u7ec4\u4ef6",h:2,children:[{id:"\u5b89\u88c5\u4f9d\u8d56\u5305",title:"\u5b89\u88c5\u4f9d\u8d56\u5305",h:3},{id:"\u6ce8\u518c",title:"\u6ce8\u518c",h:3}]},{id:"\u975eAngular\u7ec4\u4ef6",title:"\u975eAngular\u7ec4\u4ef6",h:2,children:[{id:"\u5b89\u88c5\u4f9d\u8d56\u5305",title:"\u5b89\u88c5\u4f9d\u8d56\u5305",h:3},{id:"\u5bfc\u5165\u811a\u672c",title:"\u5bfc\u5165\u811a\u672c",h:3},{id:"\u4f7f\u7528",title:"\u4f7f\u7528",h:3}]}]}},demo:!1},this.codes=[]}static#e=this.\u0275fac=function(t){return new(t||e)};static#t=this.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-import"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,o){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",o.codes)("item",o.item)},dependencies:[i.P],styles:["[_nghost-%COMP%]{display:block}"]})}return e})()},{path:"mock",redirectTo:"mock/zh",pathMatch:"full"},{path:"mock/:lang",component:(()=>{class e{constructor(){this.item={cols:1,urls:{"zh-CN":"docs/mock.md"},content:{"zh-CN":{content:' ',meta:{order:60,title:"Mock",type:"Advance",url:"/mock/getting-started"},toc:[]}},demo:!1},this.codes=[]}static#e=this.\u0275fac=function(t){return new(t||e)};static#t=this.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-mock"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,o){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",o.codes)("item",o.item)},dependencies:[i.P],styles:["[_nghost-%COMP%]{display:block}"]})}return e})()},{path:"module",redirectTo:"module/zh",pathMatch:"full"},{path:"module/:lang",component:(()=>{class e{constructor(){this.item={cols:1,urls:{"en-US":"docs/module.en-US.md","zh-CN":"docs/module.zh-CN.md"},content:{"en-US":{content:'The AppModule
, CoreModule
, and SharedModule
modules have not been used very clearly, and it is easy to use them. The goal of the Angular module is to make components, instructions, services, and pipeline function blocks more cohesive, and each functional area forms a separate set of business domains or utilities.
1) Classification description
AppModule
The root module is used to guide Angular startup. It is very suitable for importing some modules that need to be used everywhere in the application. Such as: theme system, user master authentication module, permission module, global HTTP interceptors, international services, etc..
CoreModule
The core module will only be imported once. It is equivalent to AppModule
, but we should treat it as a pure service class module. For example: message, data access, etc.
SharedModule
We call it a shared module. It should not have providers
because ShareModule
will be imported in all business modules. Which will cause the service to be overwritten.
NG-ZORRO, @delon/abc, @delon/chart, etc. have changed from all import to on-demand import since version 11. For this reason, NG-ALAIN has refined two files shared-delon.module.ts
and shared -zorro.module.ts
merges some modules frequently used throughout the project into a module called SharedModule
, which is why it is necessary to import it in the business module for the first time. Although this method can reduce unnecessary import code, it will also cause compilation speed. Therefore, it is not recommended to put all components into SharedModule
, and try to put the modules that need to be used more than three times before putting them here; Otherwise, you must import it yourself in the business module.
2) Recommendation
AppModule
Should import module:
Angular Module: BrowserModule
, BrowserAnimationsModule
, HttpClientModule
AlainThemeModule
Theme system
DelonMockModule
Mock data
AlainAuthModule
User authentication module
AlainACLModule
Privilege module
Internationalization module
Should include services:
Angular globalization
HTTP interceptor
Angular start service
ng-zorro-antd
Basic component service
@delon/abc
Business component service
Role: Throughout the definition of the entire application.
CoreModule
Should only leave the providers
attribute.
Role: Some common services. such as: user messages, HTTP data access.
ShareModule
Should contain definitions:
Apply generic custom business components
Should import module:
Angular generic module:CommonModule
\u3001FormsModule
\u3001RouterModule
\u3001ReactiveFormsModule
ng-zorro-antd
Basic component module
@delon/abc
Business component module
Third-party generic dependency component module
Should Export all included modules.
Should not have providers
attribute.
Function: Some common custom, third-party component definitions, reducing the import of business modules.
Business module
The business module should include a business definition module and a routing module.
Should import module:
Corresponding routing module
Should not:
Export any component
Try not to use the providers
attribute
Route module
Should include only the import
, exports
modules of the r
',meta:{order:30,title:{"en-US":"Module Guidelines","zh-CN":"\u6a21\u5757\u6ce8\u518c\u6307\u5bfc\u539f\u5219"},type:"Other"},toc:[{id:"1Classificationdescription",title:"1) Classification description",h:2,children:[{id:"AppModule",title:"AppModule",h:3},{id:"CoreModule",title:"CoreModule",h:3},{id:"SharedModule",title:"SharedModule",h:3}]},{id:"2Recommendation",title:"2) Recommendation",h:2,children:[{id:"AppModule",title:"AppModule",h:3},{id:"CoreModule",title:"CoreModule",h:3},{id:"ShareModule",title:"ShareModule",h:3},{id:"Businessmodule",title:"Business module",h:3}]}]},"zh-CN":{content:'\u4e00\u76f4\u4ee5\u6765 AppModule
\u3001CoreModule
\u3001SharedModule
\u6a21\u5757\u4f7f\u7528\u6ca1\u6709\u5f88\u660e\u786e\u7684\u89c4\u8303\uff0c\u5f88\u5bb9\u6613\u8ba9\u4ea7\u751f\u4e71\u7528\u3002Angular\u6a21\u5757\u76ee\u6807\u662f\u4e3a\u4e86\u4f7f\u7ec4\u4ef6\u3001\u6307\u4ee4\u3001\u670d\u52a1\u548c\u7ba1\u9053\u529f\u80fd\u5757\u66f4\u5185\u805a\uff0c\u5e76\u6bcf\u4e00\u4e2a\u529f\u80fd\u533a\u57df\u5f62\u6210\u72ec\u7acb\u7684\u4e1a\u52a1\u9886\u57df\u6216\u5b9e\u7528\u5de5\u5177\u7684\u96c6\u5408\u3002
1) \u5206\u7c7b\u8bf4\u660e
AppModule
\u6839\u6a21\u5757\uff0c\u7528\u4e8e\u5f15\u5bfc Angular \u542f\u52a8\uff1b\u5b83\u975e\u5e38\u9002\u5408\u5bfc\u5165\u4e00\u4e9b\u9700\u8981\u5728\u6574\u4e2a\u5e94\u7528\u5230\u5904\u9700\u8981\u7684\u6a21\u5757\uff0c\u4f8b\u5982\uff1a\u4e3b\u9898\u7cfb\u7edf\u3001\u7528\u6237\u4e3b\u8ba4\u8bc1\u6a21\u5757\u3001\u6743\u9650\u6a21\u5757\u7b49\u6a21\u5757\uff0c\u4ee5\u53ca\u4e00\u4e9b\u5168\u5c40\u6027HTTP\u62e6\u622a\u5668\u3001\u56fd\u9645\u5316\u670d\u52a1\u7b49\u3002
CoreModule
\u6838\u5fc3\u6a21\u5757\u53ea\u4f1a\u88ab\u5bfc\u5165\u4e00\u6b21\uff0c\u5b83\u7b49\u540c AppModule
\uff0c\u4f46\u6211\u4eec\u66f4\u5e94\u8be5\u628a\u5b83\u5f53\u6210\u4e00\u4e2a\u7eaf\u670d\u52a1\u7c7b\u6a21\u5757\uff0c\u4f8b\u5982\uff1a\u6d88\u606f\u3001\u6570\u636e\u8bbf\u95ee\u7b49\u3002
SharedModule
\u6211\u4eec\u53eb\u5b83\u5171\u4eab\u6a21\u5757\uff1b\u5b83\u4e0d\u5e94\u8be5\u51fa\u73b0 providers
\uff0c\u56e0\u4e3a ShareModule
\u4f1a\u5728\u6240\u6709\u4e1a\u52a1\u6a21\u5757\u4e2d\u88ab\u5bfc\u5165\uff0c\u8fd9\u4f1a\u5bfc\u81f4\u670d\u52a1\u88ab\u8986\u76d6\u3002
NG-ZORRO\u3001@delon/abc\u3001@delon/chart \u7b49\u4ece\u7248\u672c11\u5f00\u59cb\u7531\u4e00\u6b21\u6027\u5bfc\u5165\u6539\u6210\u6309\u9700\u5bfc\u5165\uff0c\u4e3a\u6b64 NG-ALAIN \u63d0\u70bc\u4e86\u4e24\u4e2a\u6587\u4ef6 shared-delon.module.ts
\u3001shared-zorro.module.ts
\u5c06\u4e00\u4e9b\u6574\u4e2a\u9879\u76ee\u7ecf\u5e38\u7528\u5230\u7684\u6a21\u5757\u5408\u5e76\u6210\u4e00\u4e2a\u53eb SharedModule
\u6a21\u5757\u5185\uff0c\u8fd9\u4e5f\u5c31\u662f\u4e3a\u4ec0\u4e48\u9700\u8981\u5728\u4e1a\u52a1\u6a21\u5757\u5185\u7b2c\u4e00\u65f6\u95f4\u5bfc\u5165\u5b83\u3002\u867d\u7136\u8fd9\u79cd\u65b9\u5f0f\u53ef\u4ee5\u51cf\u5c11\u4e0d\u5fc5\u8981\u7684\u5bfc\u5165\u4ee3\u7801\uff0c\u4f46\u540c\u65f6\u4e5f\u4f1a\u5f15\u8d77\u7f16\u8bd1\u901f\u5ea6\uff0c\u56e0\u6b64\u4e0d\u5efa\u8bae\u628a\u6240\u6709\u7ec4\u4ef6\u90fd\u653e\u8fdb SharedModule
\u5185\uff0c\u5c3d\u53ef\u80fd\u5c06\u9700\u8981\u7528\u5230\u7684\u6a21\u5757\u4e09\u6b21\u4ee5\u4e0a\u4f7f\u7528\u624d\u653e\u8fdb\u8fd9\u91cc\uff1b\u5426\u5219\u52a1\u5fc5\u5728\u4e1a\u52a1\u6a21\u5757\u5185\u81ea\u884c\u5bfc\u5165\u3002
2) \u5efa\u8bae
AppModule
\u5e94 \u5bfc\u5165\u6a21\u5757\uff1a
Angular \u6a21\u5757\uff1aBrowserModule
\u3001BrowserAnimationsModule
\u3001HttpClientModule
AlainThemeModule
\u4e3b\u9898\u7cfb\u7edf
DelonMockModule
Mock\u6570\u636e
AlainAuthModule
\u7528\u6237\u8ba4\u8bc1\u6a21\u5757
AlainACLModule
\u6743\u9650\u6a21\u5757
\u56fd\u9645\u5316\u6a21\u5757
\u5e94 \u5305\u542b\u670d\u52a1\uff1a
Angular \u56fd\u9645\u5316
HTTP \u62e6\u622a\u5668
Angular \u542f\u52a8\u670d\u52a1
ng-zorro-antd
\u57fa\u7840\u7ec4\u4ef6\u670d\u52a1
@delon/abc
\u4e1a\u52a1\u7ec4\u4ef6\u670d\u52a1
\u4f5c\u7528\uff1a \u8d2f\u7a7f\u6574\u4e2a\u5e94\u7528\u7684\u5b9a\u4e49\u3002
CoreModule
\u5e94 \u4ec5\u53ea\u7559 providers
\u5c5e\u6027\u3002
\u4f5c\u7528\uff1a \u4e00\u4e9b\u901a\u7528\u670d\u52a1\uff0c\u4f8b\u5982\uff1a\u7528\u6237\u6d88\u606f\u3001HTTP\u6570\u636e\u8bbf\u95ee\u3002
ShareModule
\u5e94 \u5305\u542b\u5b9a\u4e49\uff1a
\u5e94\u7528\u901a\u7528\u81ea\u5b9a\u4e49\u4e1a\u52a1\u7ec4\u4ef6
\u5e94 \u5bfc\u5165\u6a21\u5757\uff1a
Angular \u901a\u7528\u6a21\u5757\uff1aCommonModule
\u3001FormsModule
\u3001RouterModule
\u3001ReactiveFormsModule
ng-zorro-antd
\u57fa\u7840\u7ec4\u4ef6\u6a21\u5757
@delon/abc
\u4e1a\u52a1\u7ec4\u4ef6\u6a21\u5757
\u7b2c\u4e09\u65b9\u901a\u7528\u4f9d\u8d56\u7ec4\u4ef6\u6a21\u5757
\u5e94 \u5bfc\u51fa\u6240\u6709\u5305\u542b\u7684\u6a21\u5757\u3002
\u4e0d\u5e94 \u6709 providers
\u5c5e\u6027\u3002
\u4f5c\u7528\uff1a \u4e00\u4e9b\u901a\u7528\u81ea\u5b9a\u4e49\u3001\u7b2c\u4e09\u65b9\u7ec4\u4ef6\u5b9a\u4e49\uff0c\u51cf\u5c11\u4e1a\u52a1\u6a21\u5757\u7684\u5bfc\u5165\u3002
\u4e1a\u52a1\u6a21\u5757
\u4e1a\u52a1\u6a21\u5757\u5e94\u8be5\u5305\u62ec\u4e1a\u52a1\u5b9a\u4e49\u6a21\u5757\u548c\u8def\u7531\u6a21\u5757\u3002
\u6a21\u5757
\u5e94 \u5bfc\u5165\u6a21\u5757\uff1a
\u5bf9\u5e94\u7684\u8def\u7531\u6a21\u5757
\u4e0d\u5e94\uff1a
\u5bfc\u51fa\u4efb\u4f55\u7ec4\u4ef6
\u5c3d\u53ef\u80fd\u4e0d\u8981\u4f7f\u7528 providers
\u5c5e\u6027
\u8def\u7531\u6a21\u5757
\u5e94 \u53ea\u5305\u62ec\u8def\u7531\u7684 import
\u3001exports
',meta:{order:30,title:{"en-US":"Module Guidelines","zh-CN":"\u6a21\u5757\u6ce8\u518c\u6307\u5bfc\u539f\u5219"},type:"Other"},toc:[{id:"1\u5206\u7c7b\u8bf4\u660e",title:"1) \u5206\u7c7b\u8bf4\u660e",h:2,children:[{id:"AppModule",title:"AppModule",h:3},{id:"CoreModule",title:"CoreModule",h:3},{id:"SharedModule",title:"SharedModule",h:3}]},{id:"2\u5efa\u8bae",title:"2) \u5efa\u8bae",h:2,children:[{id:"AppModule",title:"AppModule",h:3},{id:"CoreModule",title:"CoreModule",h:3},{id:"ShareModule",title:"ShareModule",h:3},{id:"\u4e1a\u52a1\u6a21\u5757",title:"\u4e1a\u52a1\u6a21\u5757",h:3}]}]}},demo:!1},this.codes=[]}static#e=this.\u0275fac=function(t){return new(t||e)};static#t=this.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-module"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,o){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",o.codes)("item",o.item)},dependencies:[i.P],styles:["[_nghost-%COMP%]{display:block}"]})}return e})()},{path:"new-component",redirectTo:"new-component/zh",pathMatch:"full"},{path:"new-component/:lang",component:(()=>{class e{constructor(){this.item={cols:1,urls:{"en-US":"docs/new-component.en-US.md","zh-CN":"docs/new-component.zh-CN.md"},content:{"en-US":{content:'For some functional modules that may be referenced in multiple places, it is recommended to refine the management into unified management of business components. These components generally have the following characteristics:
Only responsible for a relatively independent, stable function;
no separate routing configuration;
May be purely static, controlled only by parameters passed by the parent component (usually a page).
Let\'s take a simple static component as an example. Suppose your app often needs to display images. These images are fixed in width, have a gray background and a certain padding, and have text descriptions, like the following:
You can do this with a component that has a default style and can receive the parameters passed by the parent component for display.
Create a new file
Create a new folder named components
under src/app/shared
. Create folder called image-wrapper
and component file. If required add ts files index.ts
and style files index.less
. Provide README.md
for component API descriptions in this folder.
When using components, the default is to look for the export object in index.ts
. If your component is more complex, you can split it into multiple files, and finally unify the export in index.ts
, like this:
// main.component.ts\nexport class MainComponent {}\n\n// sub.component.ts\nexport class SubComponent {}\n\n// index.ts\nexport MainComponent from \'./main.component\';\nexport SubComponent from \'./sub.component\';
Your code is probably like this:
// index.ts\nimport { Component, Input } from \'@angular/core\';\n\n@Component({\n selector: \'image-wrapper\',\n template: `\n <div [ngStyle]="style">\n <img class="img" [src]="src" [alt]="desc" />\n <div *ngIf="desc" class="desc">{{ desc }}</div>\n </div>\n `,\n styleUrls: [ \'./index.less\' ]\n})\nexport class ImageWrapperComponent {\n @Input() style: { [key: string]: string };\n @Input() src: string;\n @Input() desc: string;\n}
// index.less\n:host {\n width: 400px;\n margin: 0 auto;\n padding: 0 20px 8px;\n text-align: center;\n background: #f2f4f5;\n\n ::ng-deep {\n .img {\n max-width: calc(100% - 32px);\n margin: 2.4em 1em;\n vertical-align: middle;\n box-shadow: 0 8px 20px rgba(143, 168, 191, 0.35);\n }\n }\n}
The components are built here, to learn more about the development of component styles.
Register
Once the component is created, you need to import the component into SharedModule
so that all submodules can use it.
// shared.module.ts\nimport { ImageWrapperComponent } from \'./image-wrapper\';\nconst COMPONENTS = [\n ImageWrapperComponent\n];
Use
Where you want to use this component, just follow the component-defined API input parameters and use it directly:
<image-wrapper\n src="https://os.alipayobjects.com/rmsportal/mgesTPFxodmIwpi.png"\n desc="schematic-diagram"></image-wrapper>',meta:{order:20,title:{"en-US":"New Component","zh-CN":"\u65b0\u589e\u4e1a\u52a1\u7ec4\u4ef6"},type:"Dev"},toc:[{id:"Createanewfile",title:"Create a new file",h:2},{id:"Register",title:"Register",h:2},{id:"Use",title:"Use",h:2}]},"zh-CN":{content:'\u5bf9\u4e8e\u4e00\u4e9b\u53ef\u80fd\u88ab\u591a\u5904\u5f15\u7528\u7684\u529f\u80fd\u6a21\u5757\uff0c\u5efa\u8bae\u63d0\u70bc\u6210\u4e1a\u52a1\u7ec4\u4ef6\u7edf\u4e00\u7ba1\u7406\u3002\u8fd9\u4e9b\u7ec4\u4ef6\u4e00\u822c\u6709\u4ee5\u4e0b\u7279\u5f81\uff1a
\u53ea\u8d1f\u8d23\u4e00\u5757\u76f8\u5bf9\u72ec\u7acb\uff0c\u7a33\u5b9a\u7684\u529f\u80fd\uff1b
\u6ca1\u6709\u5355\u72ec\u7684\u8def\u7531\u914d\u7f6e\uff1b
\u53ef\u80fd\u662f\u7eaf\u9759\u6001\u7684\uff0c\u4ec5\u53d7\u7236\u7ec4\u4ef6\uff08\u901a\u5e38\u662f\u4e00\u4e2a\u9875\u9762\uff09\u4f20\u9012\u7684\u53c2\u6570\u63a7\u5236\u3002
\u4e0b\u9762\u4ee5\u4e00\u4e2a\u7b80\u5355\u7684\u9759\u6001\u7ec4\u4ef6\u4e3a\u4f8b\u8fdb\u884c\u4ecb\u7ecd\u3002\u5047\u8bbe\u4f60\u7684\u5e94\u7528\u4e2d\u7ecf\u5e38\u9700\u8981\u5c55\u73b0\u56fe\u7247\uff0c\u8fd9\u4e9b\u56fe\u7247\u5bbd\u5ea6\u56fa\u5b9a\uff0c\u6709\u4e00\u4e2a\u7070\u8272\u7684\u80cc\u666f\u548c\u4e00\u5b9a\u7684\u5185\u8fb9\u8ddd\uff0c\u6709\u6587\u5b57\u4ecb\u7ecd\uff0c\u5c31\u50cf\u4e0b\u56fe\u8fd9\u6837\uff1a
\u4f60\u53ef\u4ee5\u7528\u4e00\u4e2a\u7ec4\u4ef6\u6765\u5b9e\u73b0\u8fd9\u4e00\u529f\u80fd\uff0c\u5b83\u6709\u9ed8\u8ba4\u7684\u6837\u5f0f\uff0c\u540c\u65f6\u53ef\u4ee5\u63a5\u6536\u7236\u7ec4\u4ef6\u4f20\u9012\u7684\u53c2\u6570\u8fdb\u884c\u5c55\u793a\u3002
\u65b0\u5efa\u6587\u4ef6
\u5728 src/app/shared/components
\u4e0b\u65b0\u5efa\u4e00\u4e2a\u4ee5\u7ec4\u4ef6\u540d\u547d\u540d\u7684\u6587\u4ef6\u5939\uff0c\u547d\u540d\u5c3d\u91cf\u4f53\u73b0\u7ec4\u4ef6\u7684\u529f\u80fd\uff0c\u8fd9\u91cc\u5c31\u53eb image-wrapper
\u3002\u5728\u6b64\u6587\u4ef6\u5939\u4e0b\u65b0\u589e ts \u6587\u4ef6\u3001\u6837\u5f0f\u6587\u4ef6\uff08\u5982\u679c\u9700\u8981\uff09\u53ca\u7ec4\u4ef6API\u8bf4\u660e\uff0c\u547d\u540d\u4e3a index.ts
\u3001index.less
\u548cREADME.md
\u3002
\u5728\u4f7f\u7528\u7ec4\u4ef6\u65f6\uff0c\u9ed8\u8ba4\u4f1a\u5728 index.ts
\u4e2d\u5bfb\u627e export \u7684\u5bf9\u8c61\uff0c\u5982\u679c\u4f60\u7684\u7ec4\u4ef6\u6bd4\u8f83\u590d\u6742\uff0c\u53ef\u4ee5\u5206\u4e3a\u591a\u4e2a\u6587\u4ef6\uff0c\u6700\u540e\u5728 index.ts
\u4e2d\u7edf\u4e00 export\uff0c\u5c31\u50cf\u8fd9\u6837\uff1a
// main.component.ts\nexport class MainComponent {}\n\n// sub.component.ts\nexport class SubComponent {}\n\n// index.ts\nexport MainComponent from \'./main.component\';\nexport SubComponent from \'./sub.component\';
\u4f60\u7684\u4ee3\u7801\u5927\u6982\u662f\u8fd9\u4e2a\u6837\u5b50\uff1a
// index.ts\nimport { Component, Input } from \'@angular/core\';\n\n@Component({\n selector: \'image-wrapper\',\n template: `\n <div [ngStyle]="style">\n <img class="img" [src]="src" [alt]="desc" />\n <div *ngIf="desc" class="desc">{{ desc }}</div>\n </div>\n `,\n styleUrls: [ \'./index.less\' ]\n})\nexport class ImageWrapperComponent {\n @Input() style: { [key: string]: string };\n @Input() src: string;\n @Input() desc: string;\n}
// index.less\n:host {\n width: 400px;\n margin: 0 auto;\n padding: 0 20px 8px;\n text-align: center;\n background: #f2f4f5;\n\n ::ng-deep {\n .img {\n max-width: calc(100% - 32px);\n margin: 2.4em 1em;\n vertical-align: middle;\n box-shadow: 0 8px 20px rgba(143, 168, 191, 0.35);\n }\n }\n}
\u5230\u8fd9\u513f\u7ec4\u4ef6\u5c31\u5efa\u597d\u4e86\uff0c\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u7ec4\u4ef6\u6837\u5f0f\u7684\u5f00\u53d1\u3002
\u6ce8\u518c
\u7ec4\u4ef6\u521b\u5efa\u597d\u540e\uff0c\u9700\u8981\u5c06\u7ec4\u4ef6\u5bfc\u5165 SharedModule
\u4e2d\uff0c\u8fd9\u6837\u6240\u6709\u5b50\u6a21\u5757\u90fd\u53ef\u4ee5\u4f7f\u7528\u5230\u8be5\u7ec4\u4ef6\u3002
// shared.module.ts\nimport { ImageWrapperComponent } from \'./image-wrapper\';\nconst COMPONENTS = [\n ImageWrapperComponent\n];
\u4f7f\u7528
\u5728\u8981\u4f7f\u7528\u8fd9\u4e2a\u7ec4\u4ef6\u7684\u5730\u65b9\uff0c\u6309\u7167\u7ec4\u4ef6\u5b9a\u4e49\u7684 API \u4f20\u5165\u53c2\u6570\uff0c\u76f4\u63a5\u4f7f\u7528\u5c31\u597d\uff1a
<image-wrapper\n src="https://os.alipayobjects.com/rmsportal/mgesTPFxodmIwpi.png"\n desc="\u793a\u610f\u56fe"></image-wrapper>',meta:{order:20,title:{"en-US":"New Component","zh-CN":"\u65b0\u589e\u4e1a\u52a1\u7ec4\u4ef6"},type:"Dev"},toc:[{id:"\u65b0\u5efa\u6587\u4ef6",title:"\u65b0\u5efa\u6587\u4ef6",h:2},{id:"\u6ce8\u518c",title:"\u6ce8\u518c",h:2},{id:"\u4f7f\u7528",title:"\u4f7f\u7528",h:2}]}},demo:!1},this.codes=[]}static#e=this.\u0275fac=function(t){return new(t||e)};static#t=this.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-new-component"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,o){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",o.codes)("item",o.item)},dependencies:[i.P],styles:["[_nghost-%COMP%]{display:block}"]})}return e})()},{path:"new-page",redirectTo:"new-page/zh",pathMatch:"full"},{path:"new-page/:lang",component:(()=>{class e{constructor(){this.item={cols:1,urls:{"en-US":"docs/new-page.en-US.md","zh-CN":"docs/new-page.zh-CN.md"},content:{"en-US":{content:'Angular renders a page in a component tree, the actual development is to organize the code in a module tree to make it better to resuse code. For module granularity depends on the requirements, ng-alain is positioned in the middle of the front-end. Therefore, it is recommended to organize your code structure from a business perspective.
NG-ALAIN provides a very rich set of Schematics templates to quickly create templates and pages that match NG-ALAIN features, as well as a variety of pluggable plugins.
Additionally: NG-ALAIN is a standard Angular CLI project, you can still use the default command line.
First, the module
To create a page, you need to create a module first. If you need a system to set the relevant module, execute the command:
ng g ng-alain:module sys
The CLI will automatically create sys.module.ts
and sys-routing.module.ts
files under src/app/routes/sys
, the former is the system setup module component definition file; the latter is the system setup module routing Configuration file.
// sys.module.ts\nimport { NgModule, Type } from \'@angular/core\';\nimport { SharedModule } from \'@shared\';\nimport { SysRoutingModule } from \'./sys-routing.module\';\n\nconst COMPONENTS: Type[] = [];\n\n@NgModule({\n imports: [SharedModule, SysRoutingModule],\n declarations: COMPONENTS,\n})\nexport class SysModule {}
The function of the module is to import the modules we need. All NG-ZORRO, @delon/abc, @delon/chart, etc. are loaded on demand. The external components are imported wherever the current business page needs. In order to reduce these import actions, NG -ALAIN has refined two files shared-delon.module.ts
and shared-zorro.module.ts
to merge some modules frequently used throughout the project into a module called SharedModule
, which is why it is necessary Import it in the business module for the first time. Note: It is not recommended to put all the components in SharedModule
, as far as possible, put the modules that need to be used two or three times or more.
And the routing configuration module:
// sys-routing.module.ts\nimport { NgModule } from \'@angular/core\';\nimport { RouterModule, Routes } from \'@angular/router\';\n\nconst routes: Routes = [];\n\n@NgModule({\n imports: [RouterModule.forChild(routes)],\n exports: [RouterModule],\n})\nexport class SysRoutingModule {}
By now, you can safely start developing business pages like menu management, logging, system configuration, etc. in the sys
directory.
Second, the page
Use the ng generate
(abbreviated as: ng g
) command to create a log list page in the sys
directory:
ng g ng-alain:list log -m=sys
See Command Line Tools for more information.
Finally, you can access the Log page.
Of course, the log may be a very rich piece of information, you can add a view page opened in a modal box to display more details.
ng g ng-alain:view view -m=sys -t=log
-t=log
indicates that you want to put the created file under sys/log/view',meta:{order:10,title:{"en-US":"New Page","zh-CN":"\u65b0\u589e\u9875\u9762"},type:"Dev"},toc:[{id:"First,themodule",title:"First, the module",h:2},{id:"Second,thepage",title:"Second, the page",h:2}]},"zh-CN":{content:'Angular \u867d\u7136\u662f\u4ee5\u7ec4\u4ef6\u6811\u6765\u6e32\u67d3\u4e00\u4e2a\u9875\u9762\uff0c\u7136\u540e\u5b9e\u9645\u5f00\u53d1\u662f\u4ee5\u4e00\u79cd\u6a21\u5757\u6811\u6765\u7ec4\u7ec7\u4ee3\u7801\uff0c\u4f7f\u5176\u80fd\u66f4\u597d\u5730\u4ee3\u7801\u590d\u7528\u3002\u800c\u5bf9\u4e8e\u6a21\u5757\u7c92\u5ea6\u53d6\u51b3\u4e8e\u9700\u6c42\uff0cng-alain\u7684\u5b9a\u4f4d\u5728\u4e8e\u4e2d\u53f0\u524d\u7aef\uff0c\u56e0\u6b64\uff0c\u6bd4\u8f83\u5efa\u8bae\u4ece\u4e1a\u52a1\u89d2\u5ea6\u51fa\u53d1\u7ec4\u7ec7\u4f60\u7684\u4ee3\u7801\u7ed3\u6784\u3002
NG-ALAIN \u63d0\u4f9b\u4e00\u5957\u975e\u5e38\u4e30\u5bcc\u7684 Schematics \u6a21\u677f\uff0c\u53ef\u4ee5\u5feb\u901f\u521b\u5efa\u7b26\u5408 NG-ALAIN \u7279\u70b9\u7684\u6a21\u677f\u548c\u9875\u9762\uff1b\u540c\u65f6\u5305\u542b\u591a\u79cd\u53ef\u63d2\u62d4\u63d2\u4ef6\u3002
\u53e6\uff1aNG-ALAIN \u662f\u4e00\u4e2a\u6807\u51c6\u7684 Angular CLI \u9879\u76ee\uff0c\u4f60\u4f9d\u7136\u53ef\u4ee5\u4f7f\u7528\u9ed8\u8ba4\u7684\u6240\u6709\u547d\u4ee4\u884c\u3002
\u4e00\u3001\u6a21\u5757
\u8981\u521b\u5efa\u4e00\u4e2a\u9875\u9762\u9700\u8981\u5148\u521b\u5efa\u4e00\u4e2a\u6a21\u5757\u5f00\u59cb\uff0c\u5047\u5982\u9700\u8981\u4e00\u4e2a\u7cfb\u7edf\u8bbe\u7f6e\u76f8\u5173\u7684\u6a21\u5757\uff0c\u6267\u884c\u547d\u4ee4\uff1a
ng g ng-alain:module sys
CLI \u4f1a\u81ea\u52a8\u5728 src/app/routes/sys
\u4e0b\u521b\u5efa sys.module.ts
\u548c sys-routing.module.ts
\u6587\u4ef6\uff0c\u524d\u8005\u662f\u7cfb\u7edf\u8bbe\u7f6e\u6a21\u5757\u7ec4\u4ef6\u5b9a\u4e49\u6587\u4ef6\uff1b\u540e\u8005\u662f\u7cfb\u7edf\u8bbe\u7f6e\u6a21\u5757\u8def\u7531\u914d\u7f6e\u6587\u4ef6\u3002
// sys.module.ts\nimport { NgModule, Type } from \'@angular/core\';\nimport { SharedModule } from \'@shared\';\nimport { SysRoutingModule } from \'./sys-routing.module\';\n\nconst COMPONENTS: Type[] = [];\n\n@NgModule({\n imports: [SharedModule, SysRoutingModule],\n declarations: COMPONENTS,\n})\nexport class SysModule {}
\u6a21\u5757\u7684\u4f5c\u7528\u662f\u5bfc\u5165\u6211\u4eec\u9700\u8981\u7684\u6a21\u5757\uff0c\u6240\u6709 NG-ZORRO\u3001@delon/abc\u3001@delon/chart \u7b49\u90fd\u662f\u6309\u9700\u6c42\u52a0\u8f7d\u6a21\u5757\uff0c\u5f53\u524d\u4e1a\u52a1\u9875\u9700\u8981\u54ea\u91cc\u5916\u90e8\u7ec4\u4ef6\u5c31\u5bfc\u5165\u54ea\u4e9b\uff0c\u4e3a\u4e86\u51cf\u5c11\u8fd9\u4e9b\u5bfc\u5165\u52a8\u4f5c\uff0cNG-ALAIN \u63d0\u70bc\u4e86\u4e24\u4e2a\u6587\u4ef6 shared-delon.module.ts
\u3001shared-zorro.module.ts
\u5c06\u4e00\u4e9b\u6574\u4e2a\u9879\u76ee\u7ecf\u5e38\u7528\u5230\u7684\u6a21\u5757\u5408\u5e76\u6210\u4e00\u4e2a\u53eb SharedModule
\u6a21\u5757\u5185\uff0c\u8fd9\u4e5f\u5c31\u662f\u4e3a\u4ec0\u4e48\u9700\u8981\u5728\u4e1a\u52a1\u6a21\u5757\u5185\u7b2c\u4e00\u65f6\u95f4\u5bfc\u5165\u5b83\u3002\u6ce8\u610f\uff1a\u4e0d\u5efa\u8bae\u628a\u6240\u6709\u7ec4\u4ef6\u90fd\u653e\u8fdb SharedModule
\u5185\uff0c\u5c3d\u53ef\u80fd\u5c06\u9700\u8981\u7528\u5230\u7684\u6a21\u5757\u4ee5\u4e8c\u6216\u4e09\u6b21\u4ee5\u4e0a\u4f7f\u7528\u624d\u653e\u8fdb\u8fd9\u91cc\u3002
\u4ee5\u53ca\u8def\u7531\u914d\u7f6e\u6a21\u5757\uff1a
// sys-routing.module.ts\nimport { NgModule } from \'@angular/core\';\nimport { RouterModule, Routes } from \'@angular/router\';\n\nconst routes: Routes = [];\n\n@NgModule({\n imports: [RouterModule.forChild(routes)],\n exports: [RouterModule],\n})\nexport class SysRoutingModule {}
\u81f3\u6b64\uff0c\u4f60\u53ef\u4ee5\u653e\u5fc3\u5728 sys
\u76ee\u5f55\u4e2d\u5f00\u59cb\u5f00\u53d1\u50cf\u83dc\u5355\u7ba1\u7406\u3001\u65e5\u5fd7\u3001\u7cfb\u7edf\u914d\u7f6e\u7b49\u4e1a\u52a1\u9875\u9762\u3002
\u4e8c\u3001\u9875\u9762
\u5229\u7528 ng generate
\uff08\u53ef\u7b80\u5199\u4e3a\uff1ang g
\uff09 \u547d\u4ee4\u5728 sys
\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2a\u65e5\u5fd7\u5217\u8868\u9875\uff1a
ng g ng-alain:list log -m=sys
\u4e86\u89e3\u66f4\u591a\u8bf7\u53c2\u8003\u547d\u4ee4\u884c\u5de5\u5177\u3002
\u6700\u7ec8\uff0c\u4f60\u53ef\u4ee5\u8bbf\u95ee \u65e5\u5fd7 \u9875\u9762\u3002
\u5f53\u7136\u65e5\u5fd7\u53ef\u80fd\u662f\u4e00\u4e2a\u975e\u5e38\u4e30\u5bcc\u7684\u4fe1\u606f\uff0c\u53ef\u4ee5\u589e\u52a0\u4e00\u4e2a\u4ee5\u6a21\u6001\u6846\u6253\u5f00\u7684\u67e5\u770b\u9875\u6765\u663e\u793a\u66f4\u591a\u8be6\u60c5\u3002
ng g ng-alain:view view -m=sys -t=log
-t=log
\u8868\u793a\u5e0c\u671b\u628a\u521b\u5efa\u7684\u6587\u4ef6\u653e\u8fdb\u81f3 sys/log/view
',meta:{order:10,title:{"en-US":"New Page","zh-CN":"\u65b0\u589e\u9875\u9762"},type:"Dev"},toc:[{id:"\u4e00\u3001\u6a21\u5757",title:"\u4e00\u3001\u6a21\u5757",h:2},{id:"\u4e8c\u3001\u9875\u9762",title:"\u4e8c\u3001\u9875\u9762",h:2}]}},demo:!1},this.codes=[]}static#e=this.\u0275fac=function(t){return new(t||e)};static#t=this.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-new-page"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,o){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",o.codes)("item",o.item)},dependencies:[i.P],styles:["[_nghost-%COMP%]{display:block}"]})}return e})()},{path:"performance",redirectTo:"performance/zh",pathMatch:"full"},{path:"performance/:lang",component:(()=>{class e{constructor(){this.item={cols:1,urls:{"en-US":"docs/performance.en-US.md","zh-CN":"docs/performance.zh-CN.md"},content:{"en-US":{content:'Envelope size optimization
Divided into JavaScript script files and CSS files. The following only describes the script part. For the CSS file, please refer to Optimize Theme System.
Note: It is recommended to always prioritize business, optimize to the post- criteria, and have some understanding of NG-ALAIN before starting to optimize. The optimization scheme in this chapter will change with the change of the version. Please pay attention to the details.
Structure description
In general, there are two files that are larger after the build: scripts.js
and main.js
, and our optimization is mainly for these two items.
scripts.js
It comes from a collection of scripts
nodes of angular.json
, so the size of this file depends on the size of the third-party component referenced by the scripts
node.
In general, you should put it under scripts
when you are using non-Angular third-party components.
main.js
Using ng build
by default will package all @angular/*
, ng-zorro-antd
, @delon/*
and some third-party Angular components. Unless you use the --vendor-chunk
parameter to separate these classes library.
Optimization object
We know that the resource file packaged by Angular Cli will contain the hashing value of the file. Which is like the unique identifier of the file. If the module is not modified, no new hashing value will be generated. This ensures that after the user downloads the resource for the first time. No matter how we build the user again, there is no need to download it again.
In fact, Angular Cli defaults to --vendor-chunk
. The main factor is that these @angular/*
are very fast relative to iteration.
According to NG-ALAIN\'s module registration guidelines, generate two shared-delon.module.ts
andshared-zorro.module.ts
produced are the summary of the import of secondary modules shared by @Delon and NG-ZORRO.
@delon/abc
,@delon/chart
, ng-zorro-antd
The three main libraries all support secondary imports. Only selecting the modules required by the project will effectively solve the problem of package size.
Conclusion
After NG-ZORRO provides better optimization support, we will release #684 and hope to have a better package size. Expected res
',meta:{order:80,title:{"en-US":"Performance","zh-CN":"\u4f18\u5316"},type:"Advance"},toc:[{id:"Envelopesizeoptimization",title:"Envelope size optimization",h:2,children:[{id:"Structuredescription",title:"Structure description",h:3},{id:"Optimizationobject",title:"Optimization object",h:3},{id:"Conclusion",title:"Conclusion",h:3}]}]},"zh-CN":{content:'\u5305\u4f53\u5927\u5c0f\u4f18\u5316
\u5206\u4e3aJavaScript\u811a\u672c\u6587\u4ef6\u548cCSS\u6587\u4ef6\uff0c\u4ee5\u4e0b\u53ea\u63cf\u8ff0\u811a\u672c\u90e8\u5206\uff0c\u6709\u5173CSS\u6587\u4ef6\u8bf7\u53c2\u8003\u4f18\u5316\u4e3b\u9898\u7cfb\u7edf\u3002
\u6ce8\u610f\uff1a \u5efa\u8bae\u59cb\u7ec8\u4ee5\u4e1a\u52a1\u4f18\u5148\uff0c\u4f18\u5316\u4e3a\u540e\u7684\u51c6\u5219\uff0c\u4e14\u5728\u5f00\u59cb\u524d\u5bf9 NG-ALAIN \u6709\u4e00\u5b9a\u4e86\u89e3\u540e\u518d\u8fdb\u884c\u4f18\u5316\u3002\u672c\u7ae0\u8282\u7684\u4f18\u5316\u65b9\u6848\u4f1a\u968f\u7740\u7248\u672c\u7684\u66f4\u8fed\u6709\u6240\u53d8\u52a8\uff0c\u6709\u5173\u7ec6\u8282\u8bf7\u6301\u7eed\u5173\u6ce8\u3002
\u7ed3\u6784\u8bf4\u660e
\u4e00\u822c\u6765\u8bf4\uff0c\u6784\u5efa\u540e\u6709\u4e24\u4e2a\u6587\u4ef6\u4f1a\u6bd4\u8f83\u5927\uff1ascripts.js
\u548c main.js
\uff0c\u800c\u6211\u4eec\u4f18\u5316\u4e5f\u4e3b\u8981\u9488\u5bf9\u8fd9\u4e24\u9879\u3002
scripts.js
\u5b83\u6765\u81ea\u662f angular.json
\u7684 scripts
\u8282\u70b9\u7684\u96c6\u5408\uff0c\u56e0\u6b64\uff0c\u8fd9\u4e2a\u6587\u4ef6\u7684\u5927\u5c0f\u53d6\u51b3\u4e8e scripts
\u8282\u70b9\u6240\u5f15\u7528\u7684\u7b2c\u4e09\u65b9\u7ec4\u4ef6\u7684\u5927\u5c0f\u3002
\u4e00\u822c\u6765\u8bf4\uff0c\u5f53\u4f60\u5728\u4f7f\u7528\u975e Angular \u7b2c\u4e09\u65b9\u7ec4\u4ef6\u65f6\u90fd\u5e94\u8be5\u653e\u5728 scripts
\u4e0b\u3002
main.js
\u9ed8\u8ba4\u4f7f\u7528 ng build
\u4f1a\u5c06\u6240\u6709 @angular/*
\u3001ng-zorro-antd
\u3001@delon/*
\u4ee5\u53ca\u4e00\u4e9b\u7b2c\u4e09\u65b9 Angular \u7ec4\u4ef6\u90fd\u4f1a\u88ab\u6253\u5305\u8fdb\u6765\uff0c\u9664\u975e\u4f60\u4f7f\u7528 --vendor-chunk
\u53c2\u6570\u6765\u5206\u79bb\u8fd9\u4e9b\u7c7b\u5e93\u3002
\u4f18\u5316\u5bf9\u8c61
\u6211\u4eec\u77e5\u9053\uff0cAngular Cli \u6253\u5305\u51fa\u6765\u7684\u8d44\u6e90\u6587\u4ef6\u4f1a\u5305\u542b\u8be5\u6587\u4ef6 hashing \u503c\uff0c\u5b83\u50cf\u662f\u6587\u4ef6\u7684\u552f\u4e00\u6807\u8bc6\u7801\uff0c\u82e5\u672a\u5bf9\u8be5\u6587\u4ef6\u8fdb\u884c\u6a21\u5757\u4fee\u6539\u90fd\u4e0d\u4f1a\u4ea7\u751f\u65b0\u7684 hashing \u503c\uff0c\u8fd9\u786e\u4fdd\u7528\u6237\u9996\u6b21\u4e0b\u8f7d\u8d44\u6e90\u540e\u4e0d\u7ba1\u6211\u4eec\u5982\u4f55\u518d\u6b21\u6784\u5efa\u7528\u6237\u90fd\u65e0\u987b\u518d\u4e00\u6b21\u4e0b\u8f7d\u3002
\u4e8b\u5b9e\u4e0a\uff0cAngular Cli \u9ed8\u8ba4\u5c06 --vendor-chunk
\u4e3b\u8981\u56e0\u7d20\u662f\u8fd9\u4e9b @angular/* \u76f8\u5bf9\u4e8e\u8fed\u4ee3\u5f88\u5feb\u3002
\u6839\u636e NG-ALAIN \u7684\u6a21\u5757\u6ce8\u518c\u6307\u5bfc\u539f\u5219\uff0c\u4ea7\u751f\u7684\u4e24\u4e2a shared-delon.module.ts
\u3001shared-zorro.module.ts
\u4e24\u4e2a\u4e13\u95e8\u9488\u5bf9 @Delon \u4e0e NG-ZORRO \u5171\u4eab\u6b21\u7ea7\u6a21\u5757\u5bfc\u5165\u7684\u6c47\u603b\u3002
@delon/abc
\u3001@delon/chart
\u3001ng-zorro-antd
\u4e09\u4e2a\u4e3b\u8981\u7c7b\u5e93\u90fd\u652f\u6301\u6b21\u7ea7\u5bfc\u5165\uff0c\u53ea\u9009\u62e9\u9879\u76ee\u6240\u9700\u8981\u7684\u6a21\u5757\u5c06\u6709\u6548\u7684\u89e3\u51b3\u5305\u4f53\u5927\u5c0f\u7684\u95ee\u9898\u3002
\u7ed3\u8bba
\u5f85 NG-ALAIN \u63d0\u4f9b\u66f4\u597d\u7684\u4f18\u5316\u652f\u6301\u540e\uff0c\u6211\u4eec\u4f1a\u53d1\u5e03 #684 \u5e0c\u671b\u5bf9\u5305\u4f53\u5927\u5c0f\u6709\u66f4\u597d\u7684
',meta:{order:80,title:{"en-US":"Performance","zh-CN":"\u4f18\u5316"},type:"Advance"},toc:[{id:"\u5305\u4f53\u5927\u5c0f\u4f18\u5316",title:"\u5305\u4f53\u5927\u5c0f\u4f18\u5316",h:2,children:[{id:"\u7ed3\u6784\u8bf4\u660e",title:"\u7ed3\u6784\u8bf4\u660e",h:3},{id:"\u4f18\u5316\u5bf9\u8c61",title:"\u4f18\u5316\u5bf9\u8c61",h:3},{id:"\u7ed3\u8bba",title:"\u7ed3\u8bba",h:3}]}]}},demo:!1},this.codes=[]}static#e=this.\u0275fac=function(t){return new(t||e)};static#t=this.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-performance"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,o){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",o.codes)("item",o.item)},dependencies:[i.P],styles:["[_nghost-%COMP%]{display:block}"]})}return e})()},{path:"server",redirectTo:"server/zh",pathMatch:"full"},{path:"server/:lang",component:(()=>{class e{constructor(){this.item={cols:1,urls:{"en-US":"docs/server.en-US.md","zh-CN":"docs/server.zh-CN.md"},content:{"en-US":{content:'NG-ALAIN is a single-page application based on the Angular technology stack. We provide development models for front-end code and native analog data.\nWork in the form of the Restful API with the server application of any technology stack. The basics of interacting with the server are briefly described below.
Front-end request process
In NG-ALAIN, a complete front-end UI interaction to the server-side processing flow looks like this:
Start Angular for the first time to execute APP_INITIALIZER
;
UI component interaction;
Send the request using the encapsulated _HttpClient;
Trigger the user authentication interceptor @delon/auth and add the token
parameter uniformly;
If there is no token
or an expired interrupt subsequent request, jump directly to the login page;
Trigger the default interceptor to process the prefix and other information;
Get the server back;
Trigger the default interceptor to handle request exceptions, business exceptions, etc.
Update the data and refresh the UI.
Interceptor
By default, two interceptors are registered in the root module.SimpleInterceptor with DefaultInterceptorAnd the execution order is executed in the registration order.
SimpleInterceptor
User Authentication has built-in interceptors for automatically adding token
parameters to requests. There is also a JWTInterceptor interceptor, which is a standard JWT specification. If the backend uses standard JWT, it can be directly replaced with a JWTInterceptor interceptor.
DefaultInterceptor
DefaultInterceptor The interceptor simply provides an interceptor. By default, it contains sample code that handles server request prefixes, handles request exceptions, and business exceptions. You can make adjustments based on your own needs.
Important point
We can put the next.handle(req)
as the demarcation point in the interceptor intercept
method. The first part is the request and the pipe
part is the post. This will make it clearer which part is to be done before the request and which part will be executed after the request. For more information on interceptors, please refer to the official website.
Development environment
Under normal circumstances, the development environment and the production environment are not the same back-end request source. You can actually configure it under the environment directory. environment.ts and environment.prod.ts Change the request source for different environments.
environment is actually a JSON object, you can organize different forms to meet the problem of multiple request sources.
Mock
Sometimes when you want to develop the front-end first, you can use @delon/mock to simulate the request data. The actual principle is to use the interceptor to directly return the data to the matching URL instead of sending an HTTP request. By default, it is only valid for the test environment. Of course, you usually need to make sure that the data of the Mock interface is consistent with the backend. You can create the corresponding Mock interface in the _mock
directory:
export const USERS = {\n \'GET /users\': { users: [1, 2], total: 2 }\n}
So for the test environment, when the /users
request is encountered, the {users: [1, 2], total: 2 }
data is returned directly. See here for more Mock syntax and usage.
Note: When you don\'t need a Mock interface for a request, be sure to comment out or remove it.
Cors
Most applications will be front-end is separate from the back-end, which leads to CORS factors when a request is made to the back end, such as:
http.get(`http://192.168.1.100/api/app`).subscribe();
Note: If the request does not start with http
, each request will add environment.SERVER_URL
as the leading edge of the request URL.
The following error is returned directly:
Access to XMLHttpRequest at \'http://192.168.1.100/api/app\' from origin \'http://localhost:4200\' has been blocked by CORS policy: No \'Access-Control-Allow-Origin\' header is present on the requested resource.
There are usually two ways to solve cross-domain problems. One is to allow the back-end development environment to directly support CORS requests (not recommended, but simplest), the second is to use Angular Cli to provide Proxy Support, the development proxy server will forward the domain and port of the request sent by Angular to the backend Server, CORS is a security restriction of the browser. There is no problem with CORS before the proxy server and the backend server. This is why many people try to make it clear that they can be requested in Postman but not in Angular.
Assuming that all backend requests are prefixed with /api
, you can configure all this prefix in proxy.conf.js
to forward to the new backend, for example:
module.exports = {\n \'/api\': {\n target: \'http://192.168.1.100/api\',\n secure: false\n }\n}
/api
Proxy path, domain is not supported
target
Proxy target address
secure
If the proxy target address is https
, it should be set to true
, otherwise it is false
pathRewrite
Rewrite the address, such as pathRewrite: {\'^/api\':\'/\'}
to change the prefix /api
to /
changeOrigin
Change the host
of the host header to the target URL. Some backends will judge whether it is valid according to its value. You may need to set true
logLevel
Set to debug
to display the message forwarded by the agent on the terminal
Abort more detail please refer to Proxying to a backend server, and for configuration description please refer to http-proxy-middleware options.
Common problem
Q: The request may be rejected or returned directly to 401
?
Scaffolding uses the SimpleInterceptor
interceptor of @delon/auth
by default, which causes an error to be returned directly if a token cannot be obtained during the request.
User Authentication This process is a must for the middle of
',meta:{order:40,title:"Work with Server",type:"Dev"},toc:[{id:"Front-endrequestprocess",title:"Front-end request process",h:2,children:[{id:"Interceptor",title:"Interceptor",h:3}]},{id:"Developmentenvironment",title:"Development environment",h:2},{id:"Mock",title:"Mock",h:2},{id:"Cors",title:"Cors",h:2},{id:"Commonproblem",title:"Common problem",h:2}]},"zh-CN":{content:'NG-ALAIN \u662f\u4e00\u5957\u57fa\u4e8e Angular \u6280\u672f\u6808\u7684\u5355\u9875\u9762\u5e94\u7528\uff0c\u6211\u4eec\u63d0\u4f9b\u7684\u662f\u524d\u7aef\u4ee3\u7801\u548c\u672c\u5730\u6a21\u62df\u6570\u636e\u7684\u5f00\u53d1\u6a21\u5f0f\uff0c\n\u901a\u8fc7 Restful API \u7684\u5f62\u5f0f\u548c\u4efb\u4f55\u6280\u672f\u6808\u7684\u670d\u52a1\u7aef\u5e94\u7528\u4e00\u8d77\u5de5\u4f5c\u3002\u4e0b\u9762\u5c06\u7b80\u5355\u4ecb\u7ecd\u548c\u670d\u52a1\u7aef\u4ea4\u4e92\u7684\u57fa\u672c\u5199\u6cd5\u3002
\u524d\u7aef\u8bf7\u6c42\u6d41\u7a0b
\u5728 NG-ALAIN \u4e2d\uff0c\u4e00\u4e2a\u5b8c\u6574\u7684\u524d\u7aef UI \u4ea4\u4e92\u5230\u670d\u52a1\u7aef\u5904\u7406\u6d41\u7a0b\u662f\u8fd9\u6837\u7684\uff1a
\u9996\u6b21\u542f\u52a8 Angular \u6267\u884c APP_INITIALIZER
\uff1b
UI \u7ec4\u4ef6\u4ea4\u4e92\u64cd\u4f5c\uff1b
\u4f7f\u7528\u5c01\u88c5\u7684 _HttpClient \u53d1\u9001\u8bf7\u6c42\uff1b
\u89e6\u53d1\u7528\u6237\u8ba4\u8bc1\u62e6\u622a\u5668 @delon/auth\uff0c\u7edf\u4e00\u52a0\u5165 token
\u53c2\u6570\uff1b
\u82e5\u672a\u5b58\u5728 token
\u6216\u5df2\u8fc7\u671f\u4e2d\u65ad\u540e\u7eed\u8bf7\u6c42\uff0c\u76f4\u63a5\u8df3\u8f6c\u81f3\u767b\u5f55\u9875\uff1b
\u89e6\u53d1\u9ed8\u8ba4\u62e6\u622a\u5668\uff0c\u7edf\u4e00\u5904\u7406\u524d\u7f00\u7b49\u4fe1\u606f\uff1b
\u83b7\u53d6\u670d\u52a1\u7aef\u8fd4\u56de\uff1b
\u89e6\u53d1\u9ed8\u8ba4\u62e6\u622a\u5668\uff0c\u7edf\u4e00\u5904\u7406\u8bf7\u6c42\u5f02\u5e38\u3001\u4e1a\u52a1\u5f02\u5e38\u7b49\uff1b
\u6570\u636e\u66f4\u65b0\uff0c\u5e76\u5237\u65b0 UI\u3002
\u62e6\u622a\u5668
\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5728\u6839\u6a21\u5757\u6ce8\u518c\u4e86\u4e24\u4e2a\u62e6\u622a\u5668 SimpleInterceptor \u548c DefaultInterceptor\uff0c\u4e14\u6267\u884c\u987a\u5e8f\u6309\u6ce8\u518c\u987a\u5e8f\u6267\u884c\u3002
SimpleInterceptor
\u7528\u6237\u8ba4\u8bc1\u5185\u7f6e\u7528\u4e8e\u81ea\u52a8\u4e3a\u8bf7\u6c42\u6dfb\u52a0 token
\u53c2\u6570\u7684\u62e6\u622a\u5668\u3002\u8fd9\u91cc\u8fd8\u6709\u4e00\u4e2a\u53eb JWTInterceptor \u62e6\u622a\u5668\uff0c\u662f\u4e00\u4e2a\u6807\u51c6 JWT \u89c4\u8303\uff0c\u82e5\u540e\u7aef\u91c7\u7528\u6807\u51c6JWT\u53ef\u4ee5\u76f4\u63a5\u6362\u6210JWTInterceptor\u62e6\u622a\u5668\u3002
DefaultInterceptor
DefaultInterceptor \u62e6\u622a\u5668\u53ea\u662f\u63d0\u4f9b\u4e00\u4e2a\u62e6\u622a\u5668\u7684\u5199\u6cd5\uff0c\u9ed8\u8ba4\u5305\u542b\u4e86\u7edf\u4e00\u5904\u7406\u670d\u52a1\u5668\u8bf7\u6c42\u524d\u7f00\u3001\u5904\u7406\u8bf7\u6c42\u5f02\u5e38\u53ca\u4e1a\u52a1\u5f02\u5e38\u7684\u793a\u4f8b\u4ee3\u7801\uff0c\u4f60\u53ef\u4ee5\u6839\u636e\u4f60\u81ea\u5df1\u7684\u9700\u6c42\u505a\u8c03\u6574\u3002
\u6ce8\u610f\u70b9
\u6211\u4eec\u53ef\u4ee5\u628a\u62e6\u622a\u5668 intercept
\u65b9\u6cd5\u5185\uff0c\u4ee5 next.handle(req)
\u4e3a\u5206\u754c\u70b9\uff0c\u524d\u90e8\u5206\u4e3a\u8bf7\u6c42\u524d\uff0cpipe
\u90e8\u5206\u4e3a\u63a5\u6536\u540e\u3002\u8fd9\u6837\u4f1a\u66f4\u660e\u786e\u77e5\u9053\u54ea\u4e00\u90e8\u5206\u662f\u8bf7\u6c42\u524d\u8981\u505a\uff0c\u54ea\u4e00\u90e8\u5206\u662f\u8bf7\u6c42\u540e\u4f1a\u6267\u884c\u7684\u3002\u6709\u5173\u66f4\u591a\u62e6\u622a\u5668\u77e5\u8bc6\u8bf7\u53c2\u8003\u5b98\u7f51\u3002
\u5f00\u53d1\u73af\u5883
\u6b63\u5e38\u60c5\u51b5\u4e0b\u5f00\u53d1\u73af\u5883\u548c\u751f\u4ea7\u73af\u5883\u4e0d\u662f\u540c\u4e00\u4e2a\u540e\u7aef\u8bf7\u6c42\u6e90\uff0c\u5b9e\u9645\u53ef\u4ee5\u901a\u8fc7\u914d\u7f6e environment \u76ee\u5f55\u4e0b environment.ts \u548c environment.prod.ts \u6539\u53d8\u4e0d\u540c\u73af\u5883\u7684\u8bf7\u6c42\u6e90\u3002
environment \u5b9e\u9645\u662f\u4e00\u4e2aJSON\u5bf9\u8c61\uff0c\u53ef\u4ee5\u7ec4\u7ec7\u4e0d\u540c\u5f62\u5f0f\u6765\u6ee1\u8db3\u591a\u8bf7\u6c42\u6e90\u7684\u95ee\u9898\u3002
Mock
\u6709\u65f6\u5019\u5e0c\u671b\u4f18\u5148\u5f00\u53d1\u524d\u7aef\u65f6\uff0c\u53ef\u4ee5\u5229\u7528 @delon/mock \u6765\u6a21\u62df\u8bf7\u6c42\u6570\u636e\uff0c\u5b9e\u9645\u539f\u7406\u662f\u5229\u7528\u62e6\u622a\u5668\uff0c\u5bf9\u5339\u914d\u7684URL\u76f4\u63a5\u8fd4\u56de\u6570\u636e\uff0c\u800c\u4e0d\u662f\u53d1\u9001\u4e00\u4e2aHTTP\u8bf7\u6c42\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u53ea\u5bf9\u6d4b\u8bd5\u73af\u5883\u6709\u6548\u3002\u5f53\u7136\u901a\u5e38\u60c5\u51b5\u4e0b\u4f60\u9700\u8981\u786e\u4fdd Mock \u63a5\u53e3\u7684\u6570\u636e\u4e0e\u540e\u7aef\u4fdd\u6301\u4e00\u81f4\uff0c\u4f60\u53ef\u4ee5\u5728 _mock
\u76ee\u5f55\u4e0b\u521b\u5efa\u76f8\u5e94\u7684 Mock \u63a5\u53e3\uff1a
export const USERS = {\n \'GET /users\': { users: [1, 2], total: 2 }\n}
\u56e0\u6b64\u5bf9\u4e8e\u6d4b\u8bd5\u73af\u5883\u4e0b\u5f53\u9047\u5230 /users
\u8bf7\u6c42\u76f4\u63a5\u8fd4\u56de { users: [1, 2], total: 2 }
\u6570\u636e\u3002\u6709\u5173\u66f4\u591a Mock \u8bed\u6cd5\u548c\u4f7f\u7528\u65b9\u5f0f\u53c2\u8003\u8fd9\u91cc\u3002
\u6ce8\uff1a \u5f53\u4f60\u4e0d\u9700\u8981\u67d0\u4e2a\u8bf7\u6c42\u7684 Mock \u63a5\u53e3\u65f6\uff0c\u52a1\u5fc5\u8981\u6ce8\u91ca\u6389\u6216\u79fb\u9664\u5b83\u3002
\u8de8\u57df
\u5927\u90e8\u5206\u5e94\u7528\u90fd\u4f1a\u524d\u540e\u7aef\u5206\u79bb\u8fdb\u884c\u5f00\u53d1\uff0c\u8fd9\u5bfc\u81f4\u5f53\u5bf9\u540e\u7aef\u53d1\u8d77\u4e00\u4e2a\u8bf7\u6c42\u65f6\u4f1a\u53d7\u8de8\u57df\uff08CORS\uff09\u7684\u56e0\u7d20\uff0c\u4f8b\u5982\uff1a
http.get(`http://192.168.1.100/api/app`).subscribe();
\u6ce8\uff1a\u5982\u679c\u975e http
\u5f00\u5934\u7684\u8bf7\u6c42\uff0c\u4f1a\u5728\u6bcf\u4e2a\u8bf7\u6c42\u90fd\u4f1a\u52a0\u4e0a environment.SERVER_URL
\u4f5c\u4e3a\u8bf7\u6c42 URL \u7684\u524d\u7f18\u3002
\u76f4\u63a5\u8fd4\u56de\u4ee5\u4e0b\u9519\u8bef\uff1a
Access to XMLHttpRequest at \'http://192.168.1.100/api/app\' from origin \'http://localhost:4200\' has been blocked by CORS policy: No \'Access-Control-Allow-Origin\' header is present on the requested resource.
\u800c\u6b63\u5e38\u89e3\u51b3\u8de8\u57df\u95ee\u9898\u6709\u4e24\u79cd\u65b9\u6cd5\uff0c\u4e00\u662f\u8ba9\u540e\u7aef\u5f00\u53d1\u73af\u5883\u76f4\u63a5\u652f\u6301\u8de8\u57df\u8bf7\u6c42\uff08\u4e0d\u63a8\u8350\uff0c\u4f46\u6700\u7b80\u5355\uff09\uff0c\u4e8c\u662f\u5229\u7528 Angular Cli \u63d0\u4f9b\u4ee3\u7406\u652f\u6301\uff0c\u5f00\u53d1\u4ee3\u7406\u670d\u52a1\u5668\u4f1a\u5c06 Angular \u53d1\u9001\u7684\u8bf7\u6c42\u7684\u57df\u548c\u7aef\u53e3\u8f6c\u53d1\u7ed9\u540e\u7aef\u670d\u52a1\u5668\uff0cCORS \u662f\u6d4f\u89c8\u5668\u7684\u5b89\u5168\u9650\u5236\uff0c\u5728\u4ee3\u7406\u670d\u52a1\u5668\u4e0e\u540e\u7aef\u670d\u52a1\u5668\u4e4b\u524d\u5e76\u4e0d\u5b58\u5728 CORS \u7684\u95ee\u9898\uff0c\u8fd9\u4e5f\u5c31\u662f\u4e3a\u4ec0\u4e48\u5f88\u591a\u4eba\u4f1a\u5c1d\u8bd5\u660e\u660e\u5728 Postman \u80fd\u8bf7\u6c42\uff0c\u800c\u5728 Angular \u4e0b\u65e0\u6cd5\u8bf7\u6c42\u7684\u539f\u56e0\u6240\u5728\u3002
\u5047\u5b9a\u6240\u6709\u540e\u7aef\u8bf7\u6c42\u90fd\u662f\u4ee5 /api
\u4e3a\u524d\u7f00\u65f6\uff0c\u5c31\u53ef\u4ee5\u5728 proxy.conf.js
\u914d\u7f6e\u6240\u6709\u8fd9\u4e2a\u524d\u7f00\u90fd\u8f6c\u5411\u65b0\u7684\u540e\u7aef\uff0c\u4f8b\u5982\uff1a
module.exports = {\n \'/api\': {\n target: \'http://192.168.1.100/api\',\n secure: false\n }\n}
/api
\u4ee3\u7406\u8def\u5f84\uff0c\u4e0d\u652f\u6301\u57df
target
\u4ee3\u7406\u76ee\u6807\u5730\u5740
secure
\u4ee3\u7406\u76ee\u6807\u5730\u5740\u5982\u679c\u662f https
\u5e94\u8be5\u8bbe\u7f6e\u4e3a true
\uff0c\u53cd\u4e4b\u4e3a false
pathRewrite
\u91cd\u5199\u5730\u5740\uff0c\u4f8b\u5982 pathRewrite: {\'^/api\': \'/\'}
\u5c06\u524d\u7f00 /api
\u8f6c\u4e3a /
changeOrigin
\u5c06\u4e3b\u673a\u6807\u5934\u7684 host
\u66f4\u6539\u4e3a\u76ee\u6807URL\uff0c\u6709\u4e9b\u540e\u7aef\u4f1a\u6839\u636e\u5176\u503c\u6765\u5224\u65ad\u662f\u5426\u6709\u6548\uff0c\u53ef\u80fd\u9700\u8981\u901a\u8fc7\u8bbe\u7f6e true
logLevel
\u8bbe\u7f6e\u4e3a debug
\u53ef\u4ee5\u7ec8\u7aef\u663e\u793a\u4ee3\u7406\u8f6c\u53d1\u7684\u6d88\u606f
\u66f4\u591a\u4f7f\u7528\u8bf4\u660e\u8bf7\u53c2\u8003\u4ee3\u7406\u5230\u540e\u7aef\u670d\u52a1\u5668\uff0c\u4ee5\u53ca\u914d\u7f6e\u63cf\u8ff0\u8bf7\u53c2\u8003http-proxy-middleware options\u3002
\u5e38\u89c1\u95ee\u9898
Q\uff1a \u8bf7\u6c42\u53ef\u80fd\u88ab\u62d2\u7edd\u6216\u76f4\u63a5\u8fd4\u56de 401
?
\u811a\u624b\u67b6\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4f7f\u7528\u4e86 @delon/auth
\u7684 SimpleInterceptor
\u62e6\u622a\u5668\uff0c\u5bfc\u81f4\u5728\u8bf7\u6c42\u8fc7\u7a0b\u4e2d\u82e5\u53d1\u73b0\u65e0\u6cd5\u83b7\u53d6 Token \u65f6\u4f1a\u76f4\u63a5\u8fd4\u56de\u9519\u8bef\u3002
\u7528\u6237\u8ba4\u8bc1\u8fd9\u4e2a\u8fc7\u7a0b\u662f\u4e2d
',meta:{order:40,title:"\u548c\u670d\u52a1\u7aef\u8fdb\u884c\u4ea4\u4e92",type:"Dev"},toc:[{id:"\u524d\u7aef\u8bf7\u6c42\u6d41\u7a0b",title:"\u524d\u7aef\u8bf7\u6c42\u6d41\u7a0b",h:2,children:[{id:"\u62e6\u622a\u5668",title:"\u62e6\u622a\u5668",h:3}]},{id:"\u5f00\u53d1\u73af\u5883",title:"\u5f00\u53d1\u73af\u5883",h:2},{id:"Mock",title:"Mock",h:2},{id:"\u8de8\u57df",title:"\u8de8\u57df",h:2},{id:"\u5e38\u89c1\u95ee\u9898",title:"\u5e38\u89c1\u95ee\u9898",h:2}]}},demo:!1},this.codes=[]}static#e=this.\u0275fac=function(t){return new(t||e)};static#t=this.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-server"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,o){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",o.codes)("item",o.item)},dependencies:[i.P],styles:["[_nghost-%COMP%]{display:block}"]})}return e})()},{path:"ssr",redirectTo:"ssr/zh",pathMatch:"full"},{path:"ssr/:lang",component:(()=>{class e{constructor(){this.item={cols:1,urls:{"zh-CN":"docs/ssr.md"},content:{"zh-CN":{content:'\u672c\u6587\u63cf\u8ff0\u7684\u662f NG-ALAIN \u5982\u4f55\u652f\u6301\u670d\u52a1\u7aef\u6e32\u67d3\uff08SSR\uff09\u3002
NG-ALAIN \u4e0d\u63a8\u8350\u5728\u4e2d\u540e\u53f0\u4f7f\u7528\u670d\u52a1\u7aef\u6e32\u67d3\uff08SSR\uff09\uff0c\u8fd9\u662f\u56e0\u4e3a\u4e2d\u540e\u53f0\u672c\u8eab\u5bf9\u4e8eSSR\u6240\u5e26\u6765\u7684\u597d\u5904\u8fdc\u5927\u4e8e\u5f00\u53d1\u5e26\u6765\u7684\u9ebb\u70e6\uff0c\u4f46\u4e0d\u7ba1\u600e\u4e48\u6837\u5728\u8bb8\u591a\u4eba\u7684\u8981\u6c42\u4e0b\uff0c\u4ece 9.5
\u7248\u672c\u5f00\u59cb\uff0c\u5df2\u7ecf\u5bf9\u6240\u6709 @delon/*
\u7c7b\u5e93\u652f\u6301\u670d\u52a1\u7aef\u6e32\u67d3\u3002
\u5f00\u59cb\u4e4b\u524d
\u5728\u5f00\u59cb\u4e4b\u524d\u8bf7\u5148\u9605\u8bfb\u4ee5\u4e0b\u6587\u7ae0\uff0c\u5b83\u4eec\u80fd\u591f\u66f4\u52a0\u5feb\u901f\u8ba9\u4f60\u4e86\u89e3 Angular \u670d\u52a1\u7aef\u6e32\u67d3\u662f\u5982\u4f55\u5de5\u4f5c\u7684\uff1a
Angular Universal\uff1aAngular \u7edf\u4e00\u5e73\u53f0\u7b80\u4ecb
Partial Server Side Rendering with Angular 9 and How to Deploy it
\u6559\u7a0b
\u6dfb\u52a0 @nguniversal/express-engine
\u5728\u4e00\u4e2a\u5b8c\u6574\u7684 NG-ALAIN \u9879\u76ee\u4e0b\uff0c\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a
ng add @nguniversal/express-engine
\u6700\u540e\u8fd0\u884c\uff1a
npm run dev:ssr
\u6b64\u65f6\u4f1a\u4ee5 SSR \u7684\u5f62\u5f0f\u8fd0\u884c NG-ALAIN\u3002
\u4f46\u5982\u679c\u91c7\u7528\u9ed8\u8ba4 LocalStorageStore
\u6765\u5b58\u50a8 Token \u7684\u60c5\u51b5\u4e0b\uff0c\u4f1a\u63d0\u793a\u627e\u4e0d\u5230 localStorage
\u7684\u9519\u8bef\uff0c\u8fd9\u662f\u56e0\u4e3a\u670d\u52a1\u7aef\u5e76\u6ca1\u6709\u8fd9\u4e9b\uff0c\u5b83\u4eec\u53ef\u80fd\u8fd8\u5305\u542b window
\u3001document
\u3001sessionStorage
\u7b49\u3002
\u56e0\u6b64\uff0c\u8981\u60f3\u5728\u4e2d\u540e\u53f0\u5f88\u597d\u7684\u652f\u6301 SSR\uff0c\u9700\u8981\u5206\u6790\u6240\u4f9d\u8d56\u7684\u7b2c\u4e09\u65b9\u7c7b\u5e93\u662f\u5426\u652f\u6301 SSR\uff0c\u5982\u679c\u6ca1\u6709\u5fc5\u987b\u624b\u52a8\u5904\u7406\u5728\u670d\u52a1\u7aef\u4e0b\u4e0d\u6e32\u67d3\u8fd9\u4e9b\u7ec4\u4ef6\u3002
\u4e22\u5931Token
\u670d\u52a1\u7aef\u662f\u65e0\u72b6\u6001\u7684\uff0c\u56e0\u6b64\u5224\u65ad\u8bf7\u6c42\u662f\u5426\u6709\u6548\u6388\u6743\uff0c\u76ee\u524d\u901a\u7528\u7684\u505a\u6cd5\u662f\u5c06 Token \u5b58\u50a8\u5728 Cookie \u4e0b\uff0c\u5728\u670d\u52a1\u7aef\u63a5\u6536\u8bf7\u6c42\u65f6\u518d\u6839\u636e Cookies \u6765\u83b7\u53d6 Token \u4fe1\u606f\u3002\x1c
\u867d\u7136 NG-ALAIN \u63d0\u4f9b CookieStorageStore
\u4f46\u5b83\u5e76\u4e0d\u652f\u6301\u670d\u52a1\u7aef SSR \u8bbf\u95ee Cookie\uff0c\u56e0\u6b64\u9700\u8981\u624b\u52a8\u6784\u5efa\u9488\u5bf9 SSR \u7684 Token \u6301\u4e45\u5316\u5b58\u50a8\u3002
\u63a8\u8350\u4f7f\u7528 @ngx-utils/cookies \u6765\u5904\u7406 Cookies\uff0c\u5b83\u540c\u65f6\u652f\u6301\u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u7aef\u3002
\u6ce8\u610f\uff1a \u53d7\u9650\u4e8e #20 \u7684\u539f\u56e0\uff0c\u7531\u4e8e\u4e00\u76f4\u672a\u5904\u7406\uff0c\u6709\u4eba\u4e13\u95e8\u89e3\u51b3\u4e86\u8fd9\u4e2a\u95ee\u9898\u5e76\u53d1\u5e03\u4e00\u4e2a\u65b0\u7c7b\u5e93 ngx-utils-cookies-port\uff0c\u6682\u65f6\u53ea\u80fd\u4f7f\u7528\u5b83\u6765\u4ee3\u66ff @ngx-utils/cookies
\uff0c\u7528\u6cd5\u4e00\u6a21\u4e00\u6837\u53ea\u662f\u6a21\u5757\u540d\u6362\u4e00\u4e0b\uff0c\u5728\u4fee\u590d\u4e4b\u540e\u518d\u6362\u56de\u6765\u3002
\u8981\u521b\u5efa\u4e00\u4e2a\u7b26\u5408 @delon/auth
\u63a5\u53e3\u6301\u4e45\u5316\u5b58\u50a8\u7c7b\uff0c\u53ea\u9700\u8981\u7ee7\u627f IStore
\u5373\u53ef\uff0c\u4f8b\u5982\uff1a
import { Injectable } from \'@angular/core\';\nimport { IStore, ITokenModel } from \'@delon/auth\';\nimport { CookiesService } from \'ngx-utils-cookies-port\';\n\n@Injectable()\nexport class AuthStorageStore implements IStore {\n constructor(private cookies: CookiesService) {}\n\n get(key: string): ITokenModel {\n return JSON.parse(this.cookies.get(key) || \'{}\') || {};\n }\n\n set(key: string, value: ITokenModel | null): boolean {\n this.cookies.put(key, JSON.stringify(value));\n return true;\n }\n\n remove(key: string) {\n this.cookies.remove(key);\n }\n}
\u6700\u540e\uff0c\u5728 global-config.module.ts
\u5185\u91cd\u65b0\u6ce8\u518c\u5b83\uff1a
const alainProvides = [\n { provide: ALAIN_CONFIG, useValue: alainConfig },\n+ { provide: DA_STORE_TOKEN, useClass: AuthStorageStore },\n ];
\u6ce8\u610f\uff1a\u8fd9\u91cc\u4f9d\u7136\u9700\u8981\u6ce8\u518c\u65b0\u589e\u7684\u6a21\u5757\uff0c\u65b9\u6cd5\u8bf7\u53c2\u8003 @ngx-utils/cookies \u8bf4\u660e\u3002
@ngx-utils/cookies
\u5185\u90e8\u4f1a\u6839\u636e REQUEST
\u6765\u83b7\u53d6\u5f53\u524d\u7684\u8bf7\u6c42\u5934\u4fe1\u606f\uff0c\u56e0\u6b64\uff0c\u6211\u4eec\u8fd8\u9700\u8981\u4fee\u6539 server.ts
\uff1a
// All regular routes use the Universal engine\n server.get(\'*\', (req, res) => {\n res.render(indexHtml, {\n req,\n+ res,\n providers: [\n { provide: APP_BASE_HREF, useValue: req.baseUrl },\n+ { provide: \'REQUEST\', useValue: req },\n+ { provide: \'RESPONSE\', useValue: res },\n ],\n });\n });',meta:{order:110,title:"\u670d\u52a1\u7aef\u6e32\u67d3\uff08SSR\uff09",type:"Dev"},toc:[{id:"\u5f00\u59cb\u4e4b\u524d",title:"\u5f00\u59cb\u4e4b\u524d",h:2},{id:"\u6559\u7a0b",title:"\u6559\u7a0b",h:2,children:[{id:"\u6dfb\u52a0@nguniversal/express-engine",title:"\u6dfb\u52a0 @nguniversal/express-engine",h:3},{id:"\u4e22\u5931Token",title:"\u4e22\u5931Token",h:3}]}]}},demo:!1},this.codes=[]}static#e=this.\u0275fac=function(t){return new(t||e)};static#t=this.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-ssr"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,o){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",o.codes)("item",o.item)},dependencies:[i.P],styles:["[_nghost-%COMP%]{display:block}"]})}return e})()},{path:"style-guide",redirectTo:"style-guide/zh",pathMatch:"full"},{path:"style-guide/:lang",component:(()=>{class e{constructor(){this.item={cols:1,urls:{"en-US":"docs/style-guide.en-US.md","zh-CN":"docs/style-guide.zh-CN.md"},content:{"en-US":{content:'The project built by Angular CLI is already very good in terms of its directory structure. Official website also has an Angular Style Guide (Chinese version) Style guide. It is recommended to read it several times. In addition, NG-ALAIN also has a part of the coding style, the following instructions may be useful for reading the code.
Consistent code style
NG-ALAIN uses ESLint to guarantee code quality and Prettier to optimize the code style.
It is recommended to install several plugins for more friendly development in vscode:
Of course, NG-ALAIN has prepared a complete set of extension packs for everyone, just install NG-ALAIN Extension Pack.
Git - pre commit Hook
The ng lint
command provided by Angular, can be very effective in helping us find bugs and readability earlier. Isn\'t it cool if we can guarantee that the lint of the file in staged is automatically done before each commit in the team development process?
NG-ALAIN is configured to do lint each time you commit to staged and you can\'t commit if you find an error.
By default, the *.ts
, *.less
commit process forces the formatting of the code. You can change the rules by modifying the husky
node of package.json
.
If hint: The\'.husky/pre-commit\' hook was ignored because it\'s not set as executable. is generated when executing git commit -m "commit"
, it may be due to permission issues. Try to execute in the project root directory:
chmod ug+x .husky/*\nchmod ug+x .git/hooks/*
Style guide
API documentation
Applications are always inevitable for the development of business components. We can not guarantee that you can remember these after a certain time. So, make sure to include the README.md
document in each business component and describe the API, DEMO and other information.
For example:
## When do you use it?\n\nInstruction\n\n## DEMO\n\nInstruction\n\n## API\n\nParameter | Description | Type | Default\n----|------|-----|------\nsrc | The map\'s address | `string` | -
Module registration
Please parameter module registration guidelines.
Auxiliary item
NG-ALAIN is configured with some options for the CLI to better code.
CLI
Vscode is the best choice for writing Angular. You can type: ng g c list
in any directory of the project to generate the corresponding files for the component.
NG-ALAIN is configured by default without generating style files & unit tests. So you will see that only .ts
, .html
are generated. This is because NG-ALAIN provides a very rich style API, and custom styles are not just needed on most pages. At the same time, unit tests.
Of course, you can easily adjust the default configuration in angular.json
.
VSCode snippets
VSCode is the best choice for writing Angular. Naturally NG-ALAIN also created the corresponding snippets extension: ng-zorro-vscode and ng-alain-vscode
',meta:{order:90,title:{"en-US":"Style Guide","zh-CN":"\u7f16\u7801\u89c4\u8303\u5efa\u8bae"},type:"Advance"},toc:[{id:"Consistentcodestyle",title:"Consistent code style",h:2},{id:"Git-precommitHook",title:"Git - pre commit Hook",h:2},{id:"Styleguide",title:"Style guide",h:2,children:[{id:"APIdocumentation",title:"API documentation",h:3},{id:"Moduleregistration",title:"Module registration",h:3}]},{id:"Auxiliaryitem",title:"Auxiliary item",h:2,children:[{id:"CLI",title:"CLI",h:3},{id:"VSCodesnippets",title:"VSCode snippets",h:3}]}]},"zh-CN":{content:'Angular CLI \u6784\u5efa\u7684\u9879\u76ee\u5c31\u5176\u76ee\u5f55\u7ed3\u6784\u800c\u8a00\u5df2\u7ecf\u975e\u5e38\u68d2\u4e86\uff0c\u540c\u65f6\u5b98\u7f51\u4e5f\u6709\u4e00\u4efd Angular Style Guide\uff08\u4e2d\u6587\u7248\uff09\u98ce\u683c\u6307\u5357\uff0c\u5efa\u8bae\u597d\u597d\u9605\u8bfb\u51e0\u904d\u3002\u9664\u6b64\u4e4b\u5916\uff0cNG-ALAIN \u4e5f\u6709\u4e00\u90e8\u5206\u7f16\u7801\u98ce\u683c\uff0c\u5982\u4e0b\u8bf4\u660e\u53ef\u80fd\u5bf9\u4e8e\u4f60\u9605\u8bfb\u4ee3\u7801\u65f6\u6709\u7528\u3002
\u4e00\u81f4\u7684\u4ee3\u7801\u98ce\u683c
NG-ALAIN \u4f7f\u7528 ESLint \u6765\u4fdd\u8bc1\u4ee3\u7801\u8d28\u91cf \u4e0e Prettier \u6765\u4f18\u5316\u4ee3\u7801\u98ce\u683c\u3002
\u63a8\u8350\u5b89\u88c5\u51e0\u4e2a\u63d2\u4ef6\u5728 vscode \u4e2d\u66f4\u53cb\u597d\u7684\u5f00\u53d1\uff1a
\u5f53\u7136\uff0cNG-ALAIN \u4e3a\u5927\u5bb6\u51c6\u5907\u4e86\u4e00\u5957\u5b8c\u6574\u7684\u6269\u5c55\u5305\uff0c\u53ea\u9700\u8981\u5b89\u88c5 NG-ALAIN Extension Pack \u5373\u53ef\u3002
Git - pre commit \u52fe\u5b50
Angular \u63d0\u4f9b\u7684 ng lint
\u547d\u4ee4\u53ef\u4ee5\u975e\u5e38\u6709\u6548\u7684\u5e2e\u52a9\u6211\u4eec\u66f4\u65e9\u53d1\u73b0bug\u3001\u66f4\u9ad8\u7684\u53ef\u8bfb\u6027\uff1b\u5982\u679c\u6211\u4eec\u80fd\u591f\u4fdd\u8bc1\u56e2\u961f\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u6bcf\u4e00\u6b21 commit \u524d\u90fd\u81ea\u52a8\u505a\u4e00\u6b21 staged \u4e2d\u6587\u4ef6\u7684 lint \u7684\u8bdd\uff0c\u90a3\u4e0d\u662f\u975e\u5e38\u9177\u5417\uff1f
NG-ALAIN \u914d\u7f6e\u4e86\u6bcf\u6b21\u5bf9 staged \u8fdb\u884c commit \u65f6\u4f1a\u9884\u5148\u505a lint\uff0c\u82e5\u53d1\u73b0\u9519\u8bef\u5219\u65e0\u6cd5\u63d0\u4ea4\u3002
\u9ed8\u8ba4\u5f00\u542f\u4e86 *.ts
\u3001*.less
\u7684\u63d0\u4ea4\u8fc7\u7a0b\u4e2d\u5f3a\u5236\u5bf9\u4ee3\u7801\u8fdb\u884c\u683c\u5f0f\u5316\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539 package.json
\u7684 husky
\u8282\u70b9\u6765\u6539\u53d8\u4e9b\u89c4\u5219\u3002
\u82e5\u5728\u6267\u884c git commit -m "commit"
\u65f6\u82e5\u4ea7\u751f hint: The \'.husky/pre-commit\' hook was ignored because it\'s not set as executable. \u65f6\uff0c\u53ef\u80fd\u662f\u56e0\u4e3a\u6743\u9650\u95ee\u9898\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u5728\u9879\u76ee\u6839\u76ee\u5f55\u4e0b\u6267\u884c\uff1a
chmod ug+x .husky/*\nchmod ug+x .git/hooks/*
\u98ce\u683c\u6307\u5357
API\u6587\u6863
\u5e94\u7528\u603b\u662f\u514d\u4e0d\u4e86\u4e1a\u52a1\u7ec4\u4ef6\u7684\u5f00\u53d1\uff0c\u6211\u4eec\u65e0\u6cd5\u4fdd\u8bc1\u82e5\u5e72\u65f6\u95f4\u4e4b\u540e\u4f60\u8fd8\u80fd\u8bb0\u5f97\u8fd9\u4e9b\uff0c\u56e0\u6b64\u52a1\u5fc5\u5728\u6bcf\u4e00\u4e2a\u4e1a\u52a1\u7ec4\u4ef6\u9644\u5e26 README.md
\u6587\u6863\uff0c\u5e76\u63cf\u8ff0API\u3001DEMO\u7b49\u4fe1\u606f\uff0c\u4f8b\u5982\uff1a
## \u4f55\u65f6\u4f7f\u7528\uff1f\n\n\u7565\n\n## DEMO\n\n\u7565\n\n## API\n\n\u6210\u5458 | \u8bf4\u660e | \u7c7b\u578b | \u9ed8\u8ba4\u503c\n----|------|-----|------\nsrc | \u56fe\u7247\u5730\u5740 | `string` | -
\u6a21\u5757\u6ce8\u518c
\u8bf7\u53c2\u6570\u6a21\u5757\u6ce8\u518c\u6307\u5bfc\u539f\u5219\u3002
\u8f85\u52a9\u9879
ng-alain
\u914d\u7f6e\u4e86\u4e00\u4e9b\u9488\u5bf9 CLI \u9009\u9879\uff0c\u4ee5\u4fbf\u66f4\u597d\u8fdb\u884c\u7f16\u7801\u5de5\u4f5c\u3002
CLI
vscode \u662f\u7f16\u5199 Angular \u6700\u4f73\u7684\u9009\u62e9\uff0c\u4f60\u53ef\u4ee5\u5728\u9879\u76ee\u7684\u4efb\u4f55\u76ee\u5f55\u91cc\u8f93\u5165\uff1ang g c list
\u751f\u6210\u7ec4\u4ef6\u7684\u76f8\u5e94\u7684\u6587\u4ef6\u3002
ng-alain
\u9ed8\u8ba4\u914d\u7f6e\u4e86\u4e0d\u751f\u6210\u6837\u5f0f\u6587\u4ef6&\u5355\u5143\u6d4b\u8bd5\uff0c\u56e0\u6b64\uff0c\u4f60\u4f1a\u770b\u5230\u751f\u6210\u7684\u53ea\u6709 .ts
\u3001.html
\u3002\u8fd9\u662f\u56e0\u4e3a ng-alain
\u63d0\u4f9b\u4e86\u975e\u5e38\u4e30\u5bcc\u7684\u6837\u5f0fAPI\uff0c\u5728\u5927\u591a\u6570\u9875\u9762\u4e2d\u81ea\u5b9a\u4e49\u6837\u5f0f\u5e76\u4e0d\u662f\u521a\u9700\u7684\uff1b\u540c\u65f6\uff0c\u5355\u5143\u6d4b\u8bd5\u4e5f\u662f\u5982\u6b64\u3002
\u5f53\u7136\uff0c\u4f60\u53ef\u4ee5\u5f88\u5bb9\u6613\u5728 angular.json
\u4e2d\u8c03\u6574\u9ed8\u8ba4\u914d\u7f6e\u3002
vscode snippets
vscode \u662f\u7f16\u5199 Angular \u6700\u4f73\u7684\u9009\u62e9\uff0c\u81ea\u7136 NG-ALAIN \u4e5f\u5236\u4f5c\u4e86\u76f8\u5e94 snippets \u6269\u5c55\u63d2\u4ef6\uff1ang-zorro-vscode \u548c ng-alain-vscode
',meta:{order:90,title:{"en-US":"Style Guide","zh-CN":"\u7f16\u7801\u89c4\u8303\u5efa\u8bae"},type:"Advance"},toc:[{id:"\u4e00\u81f4\u7684\u4ee3\u7801\u98ce\u683c",title:"\u4e00\u81f4\u7684\u4ee3\u7801\u98ce\u683c",h:2,children:[{id:"Git-precommit\u52fe\u5b50",title:"Git - pre commit \u52fe\u5b50",h:3}]},{id:"\u98ce\u683c\u6307\u5357",title:"\u98ce\u683c\u6307\u5357",h:2,children:[{id:"API\u6587\u6863",title:"API\u6587\u6863",h:3},{id:"\u6a21\u5757\u6ce8\u518c",title:"\u6a21\u5757\u6ce8\u518c",h:3}]},{id:"\u8f85\u52a9\u9879",title:"\u8f85\u52a9\u9879",h:2,children:[{id:"CLI",title:"CLI",h:3},{id:"vscodesnippets",title:"vscode snippets",h:3}]}]}},demo:!1},this.codes=[]}static#e=this.\u0275fac=function(t){return new(t||e)};static#t=this.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-style-guide"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,o){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",o.codes)("item",o.item)},dependencies:[i.P],styles:["[_nghost-%COMP%]{display:block}"]})}return e})()},{path:"theme",redirectTo:"theme/zh",pathMatch:"full"},{path:"theme/:lang",component:(()=>{class e{constructor(){this.item={cols:1,urls:{"zh-CN":"docs/theme.md"},content:{"zh-CN":{content:' ',meta:{order:10,title:{"en-US":"Theme","zh-CN":"\u4e3b\u9898\u7cfb\u7edf"},type:"Advance",url:"/theme/getting-started"},toc:[]}},demo:!1},this.codes=[]}static#e=this.\u0275fac=function(t){return new(t||e)};static#t=this.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-theme"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,o){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",o.codes)("item",o.item)},dependencies:[i.P],styles:["[_nghost-%COMP%]{display:block}"]})}return e})()},{path:"upgrade-v16",redirectTo:"upgrade-v16/zh",pathMatch:"full"},{path:"upgrade-v16/:lang",component:(()=>{class e{constructor(){this.item={cols:1,urls:{"en-US":"docs/upgrade-v16.en-US.md","zh-CN":"docs/upgrade-v16.zh-CN.md"},content:{"en-US":{content:'This guide applies to the current version ng-alain >= 15
;\nIf you encounter problems during the upgrade process, feel free to comment here.\nIf you find any errors in this guide, please point out\nOr you have encountered a new problem and solved it, welcome to comment here.
Before upgrade
Make sure Node.js
>= 16.10.0
.
Create a new branch, or use other methods to back up the current project.
Delete the package-lock.json
or yarn.lock
file.
1.Upgrade dependencies
Upgrade Angular to 15.x version, Run ng update @angular/core@16 @angular/cli@16 @angular-eslint/schematics@16 ng-zorro-antd@16 ng-alain@16
.
Run ng update @angular/cdk@16
, if you have used @angular/cdk
.
If any warning messages appear in the console, follow the prompts to modify the corresponding code.
NG-ALAIN scaffolding upgrade all change files, please refer to: #2394.
',meta:{order:1e3,type:"Basic",title:"Upgrade to version 16.0",hot:!0},toc:[{id:"Beforeupgrade",title:"Before upgrade",h:2,children:[{id:"1.Upgradedependencies",title:"1.Upgrade dependencies",h:3}]}]},"zh-CN":{content:'\u672c\u6307\u5357\u9002\u7528\u4e8e\u5f53\u524d\u7248\u672c ng-alain >= 15
;\n\u5982\u679c\u5728\u5347\u7ea7\u8fc7\u7a0b\u4e2d\u9047\u5230\u95ee\u9898\uff0c\u6b22\u8fce\u63d0\u51fa\u3002\u63d0\u95ee\u524d\u8bf7\u9605\u8bfb \u5982\u4f55\u5411\u5f00\u6e90\u793e\u533a\u63d0\u95ee\u9898\n\u5982\u679c\u53d1\u73b0\u672c\u6307\u5357\u5b58\u5728\u9057\u6f0f/\u9519\u8bef\uff0c\u8bf7\u6307\u51fa!\n\u6216\u8005\u4f60\u9047\u5230\u4e86\u65b0\u7684\u95ee\u9898\u5e76\u89e3\u51b3\u4e86\uff0c\u6b22\u8fce\u8865\u5145!
\u5f00\u59cb\u4e4b\u524d
\u9996\u5148\u786e\u4fdd\u4f60 Node.js
>= 16.10.0
\u521b\u5efa\u65b0\u7684\u5206\u652f\uff0c\u6216\u8005\u4f7f\u7528\u5176\u4ed6\u65b9\u5f0f\u5907\u4efd\u5f53\u524d\u9879\u76ee
\u5220\u9664\u9879\u76ee\u4e0b package-lock.json
\u6216 yarn.lock
\u6587\u4ef6
\u5347\u7ea7\u6b65\u9aa4
\u5347\u7ea7\u76f8\u5173\u4f9d\u8d56
\u5c06\u9879\u76ee\u5347\u7ea7\u5230 Angular 15 \u8fd0\u884c ng update @angular/core@16 @angular/cli@16 @angular-eslint/schematics@16 ng-zorro-antd@16 ng-alain@16
\u3002
\u5982\u679c\u4f60\u6709\u5355\u72ec\u4f7f\u7528 @angular/cdk
\u8bf7\u6267\u884c ng update @angular/cdk@16
\u5982\u679c\u63a7\u5236\u53f0\u51fa\u73b0\u8b66\u544a\u6d88\u606f\u8bf7\u6309\u63d0\u793a\u4fee\u6539\u5bf9\u5e94\u4ee3\u7801
NG-ALAIN\u811a\u624b\u67b6\u5347\u7ea7\u5168\u90e8\u53d8\u66f4\u6587\u4ef6\uff0c\u8bf7\u53c2\u8003\uff1a#2394\u3002
',meta:{order:1e3,type:"Basic",title:"\u5347\u7ea7\u5230 16.0 \u7248\u672c",hot:!0},toc:[{id:"\u5f00\u59cb\u4e4b\u524d",title:"\u5f00\u59cb\u4e4b\u524d",h:2},{id:"\u5347\u7ea7\u6b65\u9aa4",title:"\u5347\u7ea7\u6b65\u9aa4",h:2,children:[{id:"\u5347\u7ea7\u76f8\u5173\u4f9d\u8d56",title:"\u5347\u7ea7\u76f8\u5173\u4f9d\u8d56",h:3}]}]}},demo:!1},this.codes=[]}static#e=this.\u0275fac=function(t){return new(t||e)};static#t=this.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-upgrade-v16"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,o){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",o.codes)("item",o.item)},dependencies:[i.P],styles:["[_nghost-%COMP%]{display:block}"]})}return e})()},{path:"upgrade",redirectTo:"upgrade/zh",pathMatch:"full"},{path:"upgrade/:lang",component:(()=>{class e{constructor(){this.item={cols:1,urls:{"en-US":"docs/upgrade.en-US.md","zh-CN":"docs/upgrade.zh-CN.md"},content:{"en-US":{content:'In Architecture we have described the overall composition of the NG-ALAIN scaffolding. We spent a lot of time developing some infrastructure and publishing these to the @delon/*
series to Npm. , making the upgrade very easy.
Publishing rule
Similar to @angular/*
, the version number of the @delon/*
class library will be a version number () at each iteration, regardless of whether a class library has been modified.
At the same time, please follow the following publishing rules and update version number:
@delon
as the infrastructure library, which will be slightly higher in the update frequency, usually updated at least once a week.
With BREAKING CHANGES at least one minor version number
How to upgrade?
Method 1: Command (Recommend)
Unless it\'s a major version update (Similar to upgrading from 12.0.0
to 13.0.0
), you only need to run the following command:
ng update ng-alain
Method 2: Modify the version number
Modify package.json
All class libraries starting with @delon/
are the latest version number:
"@delon/theme": "^12.0.0"
Replace ^12.0.0
with the latest version number.
Finally, reinstall the dependencies.
yarn
Please read Frequently Asked Questions
Method 3: Update all class libraries
Scaffolding in package.json
most libraries use loose version numbers, for example:
^0.1.0
with the ^
symbol indicates that the latest minor version number is used, so 0.7.0
is also the range.
To use this update method, you need to follow these steps:
Remove the node_modules
folder and the yarn.lock
file
Execute yarn
Note: This method will install all class libraries in a newer version, but it may cause unnecessary troubles due to damaging changes of third-party t
',meta:{order:80,title:{"en-US":"Upgrade scaffold","zh-CN":"\u5347\u7ea7\u811a\u624b\u67b6"},type:"Dev"},toc:[{id:"Publishingrule",title:"Publishing rule",h:2},{id:"Howtoupgrade",title:"How to upgrade?",h:2,children:[{id:"Method1:CommandRecommend",title:"Method 1: Command (Recommend)",h:3},{id:"Method2:Modifytheversionnumber",title:"Method 2: Modify the version number",h:3},{id:"Method3:Updateallclasslibraries",title:"Method 3: Update all class libraries",h:3}]}]},"zh-CN":{content:'\u5728 \u4f53\u7cfb\u7ed3\u6784 \u4e2d\u6211\u4eec\u5df2\u7ecf\u63cf\u8ff0\u4e86 NG-ALAIN \u811a\u624b\u67b6\u7684\u6574\u4f53\u6784\u6210\uff0c\u6211\u4eec\u82b1\u4e86\u5927\u91cf\u65f6\u95f4\u53bb\u5f00\u53d1\u4e00\u4e9b\u57fa\u7840\u5efa\u8bbe\uff0c\u5e76\u628a\u8fd9\u4e9b\u4ee5 @delon/*
\u7cfb\u5217\u53d1\u5e03\u81f3 Npm \u5f53\u4e2d\uff0c\u4f7f\u5f97\u5347\u7ea7\u53d8\u5f97\u975e\u5e38\u8f7b\u677e\u3002
\u53d1\u5e03\u89c4\u5219
\u540c @angular/*
\u7c7b\u4f3c\uff0c@delon/*
\u7c7b\u5e93\u7684\u7248\u672c\u53f7\u5728\u6bcf\u4e00\u4e2a\u8fed\u4ee3\u65f6\uff0c\u4e0d\u7ba1\u67d0\u7c7b\u5e93\u662f\u5426\u6709\u4fee\u6539\uff0c\u90fd\u4f1a\u7edf\u4e00\u4e2a\u7248\u672c\u53f7 () \u3002
\u540c\u65f6\u6309\u4ee5\u4e0b\u53d1\u5e03\u89c4\u5219\u53ca\u66f4\u65b0\u7248\u672c\u53f7\u8bf4\u660e\uff1a
@delon
\u4f5c\u4e3a\u57fa\u7840\u5efa\u8bbe\u7c7b\u5e93\uff0c\u5728\u66f4\u65b0\u9891\u7387\u4e0a\u4f1a\u7565\u9ad8\uff0c\u4e00\u822c\u4e00\u5468\u81f3\u5c11\u66f4\u65b0\u4e00\u6b21
\u5e26\u6709 BREAKING CHANGES \u81f3\u5c11\u63d0\u5347\u4e00\u4e2a\u6b21\u7248\u672c\u53f7
\u5982\u4f55\u5347\u7ea7\uff1f
\u65b9\u5f0f\u4e00\uff1a\u547d\u4ee4\u884c\uff08\u63a8\u8350\uff09
\u9664\u975e\u662f\u5927\u7248\u672c\u66f4\u65b0\uff08\u5373\u7c7b\u4f3c\u4ece 12.0.0
\u5347\u81f3 13.0.0
\uff09\uff0c\u5426\u5219\u53ea\u9700\u8981\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u5373\u53ef\uff1a
ng update ng-alain
\u65b9\u5f0f\u4e8c\uff1a\u624b\u52a8\u4fee\u6539\u7248\u672c\u53f7
\u4fee\u6539 package.json
\u6240\u6709 @delon/
\u5f00\u5934\u7684\u7c7b\u5e93\u7248\u672c\u53f7\u4e3a\u6700\u65b0\u7248\u672c\u53f7\uff1a
"@delon/theme": "^12.0.0"
\u5c06 ^12.0.0
\u66ff\u6362\u6210\u6700\u65b0\u7248\u672c\u53f7\u3002
\u6700\u540e\uff0c\u91cd\u65b0\u5b89\u88c5\u4f9d\u8d56\u5305\u3002
yarn
\u9047\u5230\u95ee\u9898\u8bf7\u9605\u8bfb \u5e38\u89c1\u95ee\u9898
\u65b9\u5f0f\u4e09\uff1a\u66f4\u65b0\u6240\u6709\u7c7b\u5e93
\u811a\u624b\u67b6\u5728 package.json
\u91cc\u591a\u6570\u7c7b\u5e93\u90fd\u662f\u4f7f\u7528\u5bbd\u677e\u7684\u7248\u672c\u53f7\uff0c\u4f8b\u5982\uff1a
^0.1.0
\u5e26\u6709 ^
\u7b26\u53f7\u8868\u793a\u4f7f\u7528\u6700\u65b0\u6b21\u7248\u672c\u53f7\uff0c\u56e0\u6b64\uff0c0.7.0
\u4e5f\u662f\u8be5\u8303\u56f4\u4e4b\u5217\u3002
\u8981\u60f3\u91c7\u7528\u8fd9\u79cd\u66f4\u65b0\u65b9\u5f0f\u9700\u8981\u6309\u4ee5\u4e0b\u6b65\u9aa4\u8fdb\u884c\uff1a
\u79fb\u9664 node_modules
\u6587\u4ef6\u5939\u53ca yarn.lock
\u6587\u4ef6
\u6267\u884c yarn
\u6ce8\u610f\uff1a \u8fd9\u79cd\u65b9\u5f0f\u4f1a\u5bf9\u6240\u6709\u7c7b\u5e93\u6309\u6bd4\u8f83\u65b0\u7684\u7248\u672c\u5b89\u88c5\uff0c\u4f46\u6709\u53ef\u80fd\u4f1a\u5bfc\u81f4\u7531\u4e8e\u7b2c\u4e09\u65b9\u7c7b\u578b\u7684\u7834\u574f\u6027\u53d8\u66f4\u4f1a\u5bfc\u81f4\u4e00\u4e9b\u4e0d\u5fc5
',meta:{order:80,title:{"en-US":"Upgrade scaffold","zh-CN":"\u5347\u7ea7\u811a\u624b\u67b6"},type:"Dev"},toc:[{id:"\u53d1\u5e03\u89c4\u5219",title:"\u53d1\u5e03\u89c4\u5219",h:2},{id:"\u5982\u4f55\u5347\u7ea7\uff1f",title:"\u5982\u4f55\u5347\u7ea7\uff1f",h:2,children:[{id:"\u65b9\u5f0f\u4e00\uff1a\u547d\u4ee4\u884c\uff08\u63a8\u8350\uff09",title:"\u65b9\u5f0f\u4e00\uff1a\u547d\u4ee4\u884c\uff08\u63a8\u8350\uff09",h:3},{id:"\u65b9\u5f0f\u4e8c\uff1a\u624b\u52a8\u4fee\u6539\u7248\u672c\u53f7",title:"\u65b9\u5f0f\u4e8c\uff1a\u624b\u52a8\u4fee\u6539\u7248\u672c\u53f7",h:3},{id:"\u65b9\u5f0f\u4e09\uff1a\u66f4\u65b0\u6240\u6709\u7c7b\u5e93",title:"\u65b9\u5f0f\u4e09\uff1a\u66f4\u65b0\u6240\u6709\u7c7b\u5e93",h:3}]}]}},demo:!1},this.codes=[]}static#e=this.\u0275fac=function(t){return new(t||e)};static#t=this.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-upgrade"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,o){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",o.codes)("item",o.item)},dependencies:[i.P],styles:["[_nghost-%COMP%]{display:block}"]})}return e})()}]}];let F=(()=>{class e{static#e=this.\u0275fac=function(t){return new(t||e)};static#t=this.\u0275mod=a.oAB({type:e});static#a=this.\u0275inj=a.cJS({imports:[G.m,R.Bz.forChild(D)]})}return e})()}}]);
\ No newline at end of file
diff --git a/311.d9a75ff48777da56.js b/311.d9a75ff48777da56.js
deleted file mode 100644
index 5d69a4481a..0000000000
--- a/311.d9a75ff48777da56.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunksite=self.webpackChunksite||[]).push([[311],{30311:(F,r,l)=>{l.r(r),l.d(r,{DocsModule:()=>E});var G=l(52787),R=l(89359),O=l(93285),a=l(65879),s=l(28749);const P=[{path:"",component:O.S,children:[{path:"",redirectTo:"getting-started/zh",pathMatch:"full"},{path:"acl",redirectTo:"acl/zh",pathMatch:"full"},{path:"acl/:lang",component:(()=>{var e;class o{constructor(){this.item={cols:1,urls:{"zh-CN":"docs/acl.md"},content:{"zh-CN":{content:' ',meta:{order:50,title:"ACL",type:"Advance",url:"/acl/getting-started"},toc:[]}},demo:!1},this.codes=[]}}return(e=o).\u0275fac=function(t){return new(t||e)},e.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-acl"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,i){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",i.codes)("item",i.item)},dependencies:[s.P],styles:["[_nghost-%COMP%]{display:block}"]}),o})()},{path:"architecture",redirectTo:"architecture/zh",pathMatch:"full"},{path:"architecture/:lang",component:(()=>{var e;class o{constructor(){this.item={cols:1,urls:{"en-US":"docs/architecture.en-US.md","zh-CN":"docs/architecture.zh-CN.md"},content:{"en-US":{content:'NG-ALAIN scaffold is a front-end solution to support middleware and back-end application. It is based on Angular and ng-zorro-antd(Angular implementation of Ant Design). The scaffold includes a set of common functionalities and business component libraries. It reduces lots of infrastructure development overwhelmingly and let you focus on business logic development.
Architecture Diagram
@delon/theme
Theme library of scaffold, we publish the theme library to NPM, which extremely simplifies upgrade effort.
Theme library includes not only essential styles(CSS tool like bootstrap) required by NG-ALAIN, but also a set of common data rendering(Pipe) and service tools(page title, scroll bar, etc..), which are needed during daily development.
@delon/abc
Scaffold provides a default set of business components, which abstract commonly used block/area in console service. We will continue to maintain and iterate the components. Provide more advanced abstract components than Ant Design base components to middleware and back-end business.
@delon/chart
@delon/chart chart library is customised based on G2. Providing commonly used chart suite in business development. It can be used alone or composed together to achieve more complex and fancy display effect.
@delon/form
@delon/form follows standard of JSON Schema to build dynamic forms.
@delon/auth
User Authentication module is used for resolving steps to obtain, save and use authentication.
@delon/acl
ACL Access Control List is a very simple role based permission control. It can even reach the granularity of controlling the visibility of a button.
@delon/cache
Reduce the Http request by storing cache of the dictionary, city data, etc. into memory or persistence storage.
@delon/mock
Mock will intercept Angular HTTP request and return testing data.
@delon/util
Daily Utilities\u3002
@delon/testing
Commonly used testing suite.
CLI Schematics
Directory Structure
Schematic diagram of directory structure\uff1a
\u251c\u2500\u2500 _mock # Mock Data rule\n\u251c\u2500\u2500 src\n\u2502\xa0\xa0 \u251c\u2500\u2500 app\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 core # Core module\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 i18n\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 net\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 default.interceptor.ts # Default HTTP interceptor\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 services\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 startup.service.ts # Initialize project configuration\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 core.module.ts # Core module file\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 layout # Core layout\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 routes\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 ** # Business directory\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 routes.module.ts # Service routing module\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 routes-routing.module.ts # Service routes registration\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 shared # Shared module\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 shared-delon.module.ts # @Delon/* import of secondary shared modules\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 shared-zorro.module.ts # NG-ZORRO import of secondary shared modules\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 shared.module.ts # Shared module file\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 app.component.ts # Root component\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 app.module.ts # Root module\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 global-config.module.ts # @delon & ng-zorro global config\n\u2502\xa0\xa0 \u251c\u2500\u2500 assets # Local static resource\n\u2502\xa0\xa0 \u251c\u2500\u2500 environments # Environment variable configuration\n\u2502\xa0\xa0 \u251c\u2500\u2500 styles # Style directory\n\u2514\u2500\u2500 \u2514\u2500\u2500 style.less # Style guide entry
The following is a description and use of each directory and file.
_mock
The Mock data rules directory, if you create a project via Command Line Tools, you can specify the --mock
parameter to determine if the Mock function is required.
src/app/core/core.module.ts
The core module will only be imported once. Therefore, core service classes (eg, messages, data access, etc.) that are required for the entire ** business module should exist here.
src/app/core/i18n
Internationalization data loading and processing related classes. If you create a project via Command Line Tool, you can specify the -di
parameter to determine whether internationalization support is required.
src/app/core/net
The default interceptor, where you can handle request parameters, request exceptions, business exceptions, and so on.
src/app/core/services/startup.service.ts
Useful when you need to execute some remote data (eg application information, user information, etc.) before Angular launches.
It is a simple method and returns a Promise
object, unless Angular will abort the launch unless resolve(null)
is explicitly executed.
src/app/layout
Layout file code, refer to the page structure section.
src/app/routes
Business module, all your business code will be here.
src/app/shared/shared.module.ts
The shared module means that some third-party modules, custom components, and custom instructions that you need to use for the entire business module should exist here. In addition, for @delon & NG-ZORRO, two shared secondary module imports, shared-delon.module.ts
andshared-zorro.module.ts
.
src/app/global-config.module.ts
Global configuration for @delon & NG-ZORRO.
src/environments
The application environment variable contains the following values:
SERVER_URL
All HTTP request prefixes
production
Whether the production environment
useHash
Whether the route is useHash mode
<
',meta:{order:20,title:"Architecture",type:"Basic",i18n:"need-update"},toc:[{id:"ArchitectureDiagram",title:"Architecture Diagram",h:2},{id:"DirectoryStructure",title:"Directory Structure",h:2}]},"zh-CN":{content:'NG-ALAIN \u76ee\u6807\u662f\u63d0\u4f9b\u66f4\u591a\u901a\u7528\u6027\u4e1a\u52a1\u6a21\u5757\uff0c\u8ba9\u5f00\u53d1\u8005\u66f4\u52a0\u4e13\u6ce8\u4e8e\u4e1a\u52a1\u3002\u6240\u4ee5\u5728\u4f60\u7740\u624b\u5f00\u59cb\u5f00\u53d1\u524d\uff0c\u6709\u5fc5\u8981\u4e86\u89e3\u6574\u4e2a NG-ALAIN \u7684\u4f53\u7cfb\u7ed3\u6784\uff0c\u4ece\u6574\u4f53\u4e0a\u4e86\u89e3 NG-ALAIN \u5305\u542b\u4e86\u54ea\u4e9b\u4e1c\u897f\u53ca\u5176\u542b\u4e49\uff0c\u624d\u80fd\u66f4\u597d\u7684\u5229\u7528\u8fd9\u4e9b\u4e1a\u52a1\u7ec4\u4ef6\u5e93\u5feb\u901f\u6784\u5efa\u9879\u76ee\u3002
\u7ed3\u6784\u56fe
\u7c7b\u5e93 \u6587\u6863 \u63cf\u8ff0 @delon/theme \u6587\u6863 \u4e3b\u9898\u7cfb\u7edf\u9664\u4e86\u5305\u542b NG-ALAIN \u57fa\u7840\u6846\u67b6\u53ca\u6240\u9700\u6837\u5f0f\uff08\u5305\u542bCSS\u5de5\u5177\u96c6\uff0c\u4e00\u5957\u7c7b\u4f3cBootstrap\uff09\u4ee5\u5916\uff0c\u8fd8\u5305\u542b\u4e00\u4e9b\u901a\u7528\u7684\u6570\u636e\u6e32\u67d3\uff08Pipe\uff09\u3001\u670d\u52a1\u5de5\u5177\u7c7b\uff08\u9875\u9762\u6807\u9898\u3001\u6eda\u52a8\u6761\u7b49\uff09\u7684\u96c6\u5408\uff0c\u8fd9\u4e9b\u662f\u65e5\u5e38\u5fc5\u4e0d\u53ef\u5c11\u7684\u4e00\u4e9b\u7ec4\u6210 @delon/abc \u6587\u6863 \u811a\u624b\u67b6\u5185\u63d0\u4f9b\u4e86\u4e00\u5957\u9ed8\u8ba4\u4e1a\u52a1\u7ec4\u4ef6\uff0c\u8fd9\u4e9b\u7ec4\u4ef6\u62bd\u8c61\u4e86\u63a7\u5236\u53f0\u4e1a\u52a1\u4e2d\u7684\u4e00\u4e9b\u5e38\u89c1\u533a\u5757\u3002\u6211\u4eec\u5c06\u6301\u7eed\u7ef4\u62a4\u548c\u8fed\u4ee3\u8fd9\u4e9b\u7ec4\u4ef6\uff0c\u4e3a\u4e2d\u540e\u53f0\u4e1a\u52a1\u63d0\u4f9b\u6bd4 Ant Design \u57fa\u7840\u7ec4\u4ef6\u66f4\u9ad8\u7ea7\u522b\u7684\u62bd\u8c61 @delon/chart \u6587\u6863 \u57fa\u4e8e G2 \u7684\u57fa\u7840\u4e0a\u4e8c\u6b21\u5c01\u88c5\uff0c\u63d0\u4f9b\u4e86\u4e1a\u52a1\u4e2d\u5e38\u7528\u7684\u56fe\u8868\u5957\u4ef6\uff0c\u53ef\u4ee5\u5355\u72ec\u4f7f\u7528\uff0c\u4e5f\u53ef\u4ee5\u7ec4\u5408\u8d77\u6765\u5b9e\u73b0\u590d\u6742\u7684\u5c55\u793a\u6548\u679c @delon/form \u6587\u6863 \u57fa\u4e8e JSON Schema \u6807\u51c6\u7684\u52a8\u6001\u6784\u5efa\u8868\u5355 @delon/auth \u6587\u6863 \u7528\u6237\u8ba4\u8bc1\u6a21\u5757\uff0c\u7528\u4e8e\u89e3\u51b3\u5982\u4f55\u83b7\u53d6\u3001\u5b58\u53d6\u3001\u4f7f\u7528\u8fd9\u4e09\u4e2a\u6b65\u9aa4\u7684\u7528\u6237\u8ba4\u8bc1\u73af\u8282 @delon/acl \u6587\u6863 \u8bbf\u95ee\u63a7\u5236\u5217\u8868\uff0c\u662f\u4e00\u79cd\u975e\u5e38\u7b80\u5355\u7684\u57fa\u4e8e\u89d2\u8272\u6743\u9650\u63a7\u5236\uff0c\u751a\u81f3\u8fbe\u5230\u63a7\u5236\u67d0\u4e2a\u6309\u94ae\u663e\u9690\u7684\u7c92\u5ea6 @delon/cache \u6587\u6863 \u5c06\u5b57\u5178\u3001\u57ce\u5e02\u6570\u636e\u7b49\u7f13\u5b58\u81f3\u5185\u5b58\u6216\u6301\u4e45\u5316\u5f53\u4e2d\uff0c\u6709\u6548\u51cf\u5c11 Http \u8bf7\u6c42 @delon/mock \u6587\u6863 Mock \u4f1a\u62e6\u622a Angular Http \u8bf7\u6c42\u5e76\u8fd4\u56de\u6d4b\u8bd5\u6570\u636e\uff0c\u5f53\u540e\u7aef\u672a\u5b8c\u6210\u63a5\u53e3\u65f6 Mock \u6280\u672f\u662f\u4e00\u9879\u4e0d\u4f1a\u5f71\u54cd\u524d\u7aef\u5f00\u53d1\u8fdb\u5ea6\u7684\u5de5\u5177 @delon/util \u6587\u6863 \u5305\u542b\u6570\u7ec4\u3001\u5ef6\u8fdf\u3001\u5b57\u7b26\u4e32\u3001\u65e5\u671f\u3001\u6821\u9a8c\u7b49\u5e38\u89c1\u5de5\u5177\u96c6 @delon/testing - \u5e38\u7528\u6d4b\u8bd5\u5957\u4ef6 CLI Schematics \u6587\u6863 \u5feb\u901f\u751f\u6210\u7edf\u4e00\u7684\u6a21\u677f\u3001\u53ef\u63d2\u62d4\u7684\u63d2\u4ef6\u7b49
\u76ee\u5f55\u7ed3\u6784
\u5f53\u4f7f\u7528 ng add ng-alain
\u751f\u6210\u540e\u7684 NG-ALAIN \u811a\u624b\u67b6\uff0c\u5b83\u7684\u57fa\u672c\u76ee\u5f55\u7ed3\u6784\u6982\u7565\u56fe\u5982\u4e0b\uff1a
\u251c\u2500\u2500 _mock # Mock \u6570\u636e\u89c4\u5219\u76ee\u5f55\n\u251c\u2500\u2500 angular.json # Angular \u9879\u76ee\u914d\u7f6e\u6587\u4ef6\n\u251c\u2500\u2500 src\n\u2502\xa0\xa0 \u251c\u2500\u2500 app\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 core # \u6838\u5fc3\u6a21\u5757\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 i18n\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 net\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 default.interceptor.ts # \u9ed8\u8ba4HTTP\u62e6\u622a\u5668\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 services\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 startup.service.ts # \u521d\u59cb\u5316\u9879\u76ee\u914d\u7f6e\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 core.module.ts # \u6838\u5fc3\u6a21\u5757\u6587\u4ef6\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 layout # \u901a\u7528\u5e03\u5c40\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 routes\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 ** # \u4e1a\u52a1\u76ee\u5f55\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 routes.module.ts # \u4e1a\u52a1\u8def\u7531\u6a21\u5757\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 routes-routing.module.ts # \u4e1a\u52a1\u8def\u7531\u6ce8\u518c\u53e3\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 shared # \u5171\u4eab\u6a21\u5757\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 shared-delon.module.ts # @Delon/* \u6b21\u7ea7\u5171\u4eab\u6a21\u5757\u5bfc\u5165\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 shared-zorro.module.ts # NG-ZORRO \u6b21\u7ea7\u5171\u4eab\u6a21\u5757\u5bfc\u5165\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 shared.module.ts # \u5171\u4eab\u6a21\u5757\u6587\u4ef6\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 app.component.ts # \u6839\u7ec4\u4ef6\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 app.module.ts # \u6839\u6a21\u5757\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 global-config.module.ts # @delon & ng-zorro \u5168\u5c40\u914d\u7f6e\u9879\n\u2502\xa0\xa0 \u251c\u2500\u2500 assets # \u672c\u5730\u9759\u6001\u8d44\u6e90\n\u2502\xa0\xa0 \u251c\u2500\u2500 environments # \u73af\u5883\u53d8\u91cf\u914d\u7f6e\n\u2502\xa0\xa0 \u251c\u2500\u2500 styles # \u6837\u5f0f\u76ee\u5f55\n\u2514\u2500\u2500 \u2514\u2500\u2500 style.less # \u6837\u5f0f\u5f15\u5bfc\u5165\u53e3
\u4ee5\u4e0b\u662f\u9488\u5bf9\u5404\u4e2a\u76ee\u5f55\u53ca\u6587\u4ef6\u8bf4\u660e\u53ca\u4f7f\u7528\u76ee\u7684\uff1a
\u540d\u79f0 \u63cf\u8ff0 angular.json Angular \u5de5\u4f5c\u533a\u53ca\u9879\u76ee\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u53c2\u8003Angular\u6587\u6863 _mock Mock \u6570\u636e\u89c4\u5219\u76ee\u5f55\uff0c\u82e5\u4f60\u901a\u8fc7 \u547d\u4ee4\u884c\u5de5\u5177 \u521b\u5efa\u9879\u76ee\u65f6\u53ef\u4ee5\u6307\u5b9a --mock
\u53c2\u6570\u51b3\u5b9a\u662f\u5426\u9700\u8981 Mock \u529f\u80fd src/app/core/core.module.ts \u6838\u5fc3\u6a21\u5757\uff0c\u53ea\u4f1a\u5bfc\u5165\u4e00\u6b21\u3002\u56e0\u6b64\uff0c\u9488\u5bf9\u6574\u4e2a\u4e1a\u52a1\u6a21\u5757\u90fd\u9700\u8981\u4f7f\u7528\u7684\u7eaf\u670d\u52a1\u7c7b\uff08\u4f8b\u5982\uff1a\u6d88\u606f\u3001\u6570\u636e\u8bbf\u95ee\u7b49\uff09 src/app/core/i18n \u56fd\u9645\u5316\u6570\u636e\u52a0\u8f7d\u53ca\u5904\u7406\u76f8\u5173\u7c7b\uff0c\u82e5\u4f60\u901a\u8fc7 \u547d\u4ee4\u884c\u5de5\u5177 \u521b\u5efa\u9879\u76ee\u65f6\u53ef\u4ee5\u6307\u5b9a -di
\u53c2\u6570\u51b3\u5b9a\u662f\u5426\u9700\u8981\u56fd\u9645\u5316\u652f\u6301 src/app/core/net \u9ed8\u8ba4\u62e6\u622a\u5668\uff0c\u4f60\u53ef\u4ee5\u5728\u8fd9\u91cc\u7edf\u4e00\u5904\u7406\u8bf7\u6c42\u53c2\u6570\u3001\u8bf7\u6c42\u5f02\u5e38\u3001\u4e1a\u52a1\u5f02\u5e38\u7b49\u52a8\u4f5c src/app/core/services/startup.service.ts \u5f53\u4f60\u9700\u8981\u5728 Angular \u542f\u52a8\u524d\u6267\u884c\u4e00\u4e9b\u8fdc\u7a0b\u6570\u636e\uff08\u4f8b\u5982\uff1a\u5e94\u7528\u4fe1\u606f\u3001\u7528\u6237\u4fe1\u606f\u7b49\uff09\u65f6\u975e\u5e38\u6709\u7528 src/app/layout \u5e03\u5c40\u76ee\u5f55\uff0c\u5305\u542b\u57fa\u7840\u5e03\u5c40\u3001\u7a7a\u767d\u5e03\u5c40\u3001\u7528\u6237\u767b\u5f55\u5e03\u5c40 src/app/routes \u4e1a\u52a1\u6a21\u5757\uff0c\u4f60\u7684\u6240\u6709\u4e1a\u52a1\u4ee3\u7801\u90fd\u5c06\u5728\u8fd9\u91cc src/app/shared/shared.module.ts \u5171\u4eab\u6a21\u5757\uff0c\u6307\u5f53\u4f60\u9700\u8981\u9488\u5bf9\u6574\u4e2a\u4e1a\u52a1\u6a21\u5757\u90fd\u9700\u8981\u4f7f\u7528\u7684\u4e00\u4e9b\u7b2c\u4e09\u65b9\u6a21\u5757\u3001\u81ea\u5b9a\u4e49\u7ec4\u4ef6\u3001\u81ea\u5b9a\u4e49\u6307\u4ee4\uff0c\u90fd\u5e94\u8be5\u5b58\u5728\u8fd9\u91cc\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u9488\u5bf9 @delon & NG-ZORRO \u5206\u522b\u6784\u5efa\u4e86 shared-delon.module.ts
\u3001shared-zorro.module.ts
\u4e24\u79cd\u6b21\u7ea7\u5171\u4eab\u6a21\u5757\u7684\u5bfc\u5165\u3002 src/app/global-config.module.ts \u9488\u5bf9 @delon & NG-ZORRO \u7684\u5168\u5c40\u914d\u7f6e\u9879 src/environments \u5e94\u7528\u73af\u5883\u53d8\u91cf\uff0c\u5305\u542b\u4ee5\u4e0b\u503c\uff1aSERVER_URL
\u6240\u6709HTTP\u8bf7\u6c42\u7684\u524d\u7f00\uff1bproduction
\u662f\u5426\u751f\u4ea7\u73af\u5883\uff1buseHash
\u8def\u7531\u662f\u5426useHash\u6a21\u5f0f ',meta:{order:20,title:"\u4f53\u7cfb\u7ed3\u6784",type:"Basic",i18n:"need-update"},toc:[{id:"\u7ed3\u6784\u56fe",title:"\u7ed3\u6784\u56fe",h:2},{id:"\u76ee\u5f55\u7ed3\u6784",title:"\u76ee\u5f55\u7ed3\u6784",h:2}]}},demo:!1},this.codes=[]}}return(e=o).\u0275fac=function(t){return new(t||e)},e.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-architecture"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,i){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",i.codes)("item",i.item)},dependencies:[s.P],styles:["[_nghost-%COMP%]{display:block}"]}),o})()},{path:"auth",redirectTo:"auth/zh",pathMatch:"full"},{path:"auth/:lang",component:(()=>{var e;class o{constructor(){this.item={cols:1,urls:{"zh-CN":"docs/auth.md"},content:{"zh-CN":{content:' ',meta:{order:40,title:{"en-US":"Auth","zh-CN":"\u7528\u6237\u8ba4\u8bc1"},type:"Advance",url:"/auth/getting-started"},toc:[]}},demo:!1},this.codes=[]}}return(e=o).\u0275fac=function(t){return new(t||e)},e.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-auth"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,i){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",i.codes)("item",i.item)},dependencies:[s.P],styles:["[_nghost-%COMP%]{display:block}"]}),o})()},{path:"cache",redirectTo:"cache/zh",pathMatch:"full"},{path:"cache/:lang",component:(()=>{var e;class o{constructor(){this.item={cols:1,urls:{"zh-CN":"docs/cache.md"},content:{"zh-CN":{content:' ',meta:{order:70,title:{"en-US":"Cache","zh-CN":"\u7f13\u5b58"},type:"Advance",url:"/cache/getting-started"},toc:[]}},demo:!1},this.codes=[]}}return(e=o).\u0275fac=function(t){return new(t||e)},e.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-cache"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,i){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",i.codes)("item",i.item)},dependencies:[s.P],styles:["[_nghost-%COMP%]{display:block}"]}),o})()},{path:"changelog",redirectTo:"changelog/zh",pathMatch:"full"},{path:"changelog/:lang",component:(()=>{var e;class o{constructor(){this.item={cols:1,urls:{"en-US":"docs/changelog.en-US.md","zh-CN":"docs/changelog.zh-CN.md"},content:{"en-US":{content:'NG-ALAIN strictly follows Semantic Versioning 2.0.0.
Release Schedule
Weekly release: patch version at the end of every week for routine bugfix (anytime for urgent bugfix).
Monthly release: minor version at the end of every month for new features.
Major version release is not included in this schedule for breaking change and new features.
16.3.0 (2023-09-01)
SCAFFOLDING
enabled bindToComponentInputs
#2409.
Bug Fixes
abc:pdf: fix ignore dependency pdfjs-dist
(If you use local path to load the libary, you need to install the dependency yourself. pdfjs-dist
depends on canvas
, which may be slow to install dependencies due to environmental factors) (#1641) (#1641) (b987bab)
form:select: fix ignore reset option data when set onSearch
(#1644) (1f8def7)
theme:http: fix missing content
of HttpOptions
(#1640) (28eeceb)
Features
16.2.1 (2023-08-06)
Bug Fixes
16.2.0 (2023-07-21)
SCAFFOLDING
Bug Fixes
abc:onboarding: fix ComponentFactoryResolver
(#1624) (ae065c2)
cli: remove skipTests
from generating module (#1616) (0da83f8)
fix misalignment of col
placeholders in se
, sv
, sg
(#1617) (83b08c9)
Features
abc:st: add onCell
, support colSpan and rowSpan merging (#1613) (9ab109e)
abc:st: button support function method of icon
, className
(#1618) (6bf27da)
theme:layout-default: add fetching
property (#1614) (8446da6)
BREAKING CHANGE
acl: refactor ACLGuard
to aclCanMatch
, aclCanActivate
, aclCanActivateChild
auth:simple refactor SimpleGuard
to authSimpleCanMatch
, authSimpleCanActivate
, authSimpleCanActivateChild
auth:jtw refactor JWTGuard
to authJWTCanMatch
, authJWTCanActivate
, authJWTCanActivateChild
i18n refactor AlainI18NGuard
to alainI18nCanMatch
, alainI18nCanActivate
, alainI18nCanActivateChild
16.1.1 (2023-07-16)
Bug Fixes
Features
16.0.1 (2023-06-08)
fix ng-zorro-antd
dependency
16.0.0 (2023-06-07)
Bug Fixes
abc:st: fix error row class in fixed column title cell (#1598) (d2bf211)
form: fix inheriting references to other of ui (#1600) (a0150e7)
Old Versions
All releases notes can be found here
',meta:{order:100,title:"Change Log",type:"Other"},toc:[{id:"16.3.02023-09-01",title:"16.3.0 (2023-09-01)",h:1,children:[{id:"SCAFFOLDING",title:"SCAFFOLDING",h:3},{id:"BugFixes",title:"Bug Fixes",h:3},{id:"Features",title:"Features",h:3},{id:"16.2.12023-08-06",title:"16.2.1 (2023-08-06)",h:2},{id:"BugFixes",title:"Bug Fixes",h:3}]},{id:"16.2.02023-07-21",title:"16.2.0 (2023-07-21)",h:1,children:[{id:"SCAFFOLDING",title:"SCAFFOLDING",h:3},{id:"BugFixes",title:"Bug Fixes",h:3},{id:"Features",title:"Features",h:3},{id:"BREAKINGCHANGE",title:"BREAKING CHANGE",h:3}]},{id:"16.1.12023-07-16",title:"16.1.1 (2023-07-16)",h:1,children:[{id:"BugFixes",title:"Bug Fixes",h:3},{id:"Features",title:"Features",h:3},{id:"16.0.12023-06-08",title:"16.0.1 (2023-06-08)",h:2}]},{id:"16.0.02023-06-07",title:"16.0.0 (2023-06-07)",h:1,children:[{id:"BugFixes",title:"Bug Fixes",h:3},{id:"OldVersions",title:"Old Versions",h:2}]}]},"zh-CN":{content:'NG-ALAIN \u4e25\u683c\u9075\u5faa Semantic Versioning 2.0.0 \u8bed\u4e49\u5316\u7248\u672c\u89c4\u8303\u3002
\u53d1\u5e03\u5468\u671f
\u4fee\u8ba2\u7248\u672c\u53f7\uff1a\u6bcf\u5468\u672b\u4f1a\u8fdb\u884c\u65e5\u5e38 bugfix \u66f4\u65b0\u3002\uff08\u5982\u679c\u6709\u7d27\u6025\u7684 bugfix\uff0c\u5219\u4efb\u4f55\u65f6\u5019\u90fd\u53ef\u53d1\u5e03\uff09
\u6b21\u7248\u672c\u53f7\uff1a\u6bcf\u6708\u53d1\u5e03\u4e00\u4e2a\u5e26\u6709\u65b0\u7279\u6027\u7684\u5411\u4e0b\u517c\u5bb9\u7684\u7248\u672c\u3002
\u4e3b\u7248\u672c\u53f7\uff1a\u542b\u6709\u7834\u574f\u6027\u66f4\u65b0\u548c\u65b0\u7279\u6027\uff0c\u4e0d\u5728\u53d1\u5e03\u5468\u671f\u5185\u3002
16.3.0 (2023-09-01)
SCAFFOLDING
\u542f\u7528 bindToComponentInputs
#2409.
Bug Fixes
abc:pdf: \u5ffd\u7565\u4f9d\u8d56 pdfjs-dist
\uff08\u82e5\u4f7f\u7528\u672c\u5730\u52a0\u8f7d\u6a21\u5f0f\uff0c\u9700\u8981\u81ea\u884c\u5b89\u88c5\u8be5\u4f9d\u8d56\uff0cpdfjs-dist
\u4f9d\u8d56\u4e86 canvas
\u53ef\u80fd\u4f1a\u56e0\u4e3a\u73af\u5883\u56e0\u7d20\u5b89\u88c5\u4f9d\u8d56\u5f88\u6162\uff09 (#1641) (b987bab)
form:select: \u5f53\u8bbe\u7f6e onSearch
\u65f6\u91cd\u7f6e\u6570\u636e\u65f6\u4f1a\u5ffd\u7565\u66f4\u65b0\u9884\u9009\u6570\u636e (#1644) (1f8def7)
theme:http: \u7ea0\u6b63 HttpOptions
\u7f3a\u5c11 content
(#1640) (28eeceb)
Features
abc:cell: \u65b0\u589e cell
\u5355\u5143\u683c\u6570\u636e\u7ec4\u4ef6 (#1530) (26023ca)
abc:page-header: \u65b0\u589e titleSub
\u5b50\u6807\u9898\u5c5e\u6027 (#1643) (79e229f)
abc:st: \u6807\u7b7e\u6216\u5fbd\u6807\u652f\u6301 tooltip
(#1634) (0e9006e)
abc:sv: \u65b0\u589e bordered
\u662f\u5426\u663e\u793a\u8fb9\u6846 (#1628) (ccfa5e1)
cli: ng add
\u5f00\u542f bindToComponentInputs
(#1630) (9717d9d)
theme:drawer: \u65b0\u589e closeAll
, openDrawers
\u65b9\u6cd5 (#1627) (bab3d0c)
theme:modal: \u652f\u6301\u767e\u5206\u6bd4\u5927\u5c0f (#1626) (8b52a08)
16.2.1 (2023-08-06)
Bug Fixes
abc:reuse-tab: \u4fee\u590d\u7f3a\u5c11\u5bfc\u51fa\u7f13\u5b58\u76f8\u5173 (#1633) (2c7def7)
auth:cookie: \u4fee\u590d\u8fc7\u671f\u503c\u5e94\u4e0e expires \u540c\u6b65 (#1636) (eca7bcb)
theme:table: \u4fee\u590d\u5355\u56fe\u50cf\u7684\u95f4\u8ddd\u95ee\u9898 (#1629) (994e2be)
theme:title: \u4fee\u590d\u5e94\u5ffd\u7565\u7a7a\u6807\u9898 (#1638) (c7bf339)
16.2.0 (2023-07-21)
SCAFFOLDING
\u8def\u7531\u5b88\u536b\u7684\u7834\u574f\u6027\u53d8\u66f4 #2407.
\u4ee3\u7801\u98ce\u683c\u53d8\u66f4 #2405.
Bug Fixes
abc:onboarding: \u4fee\u590d\u4f7f\u7528\u8fc7\u671f\u65b9\u6cd5 ComponentFactoryResolver
(#1624) (ae065c2)
chat:timeline: \u4fee\u590d y2
\u6307\u6807\u6570\u636e\u4e3a\u53ef\u9009 (#1622) (b565ddf)
cli: \u79fb\u9664\u751f\u6210\u6a21\u5757\u65f6\u5305\u542b\u65e0\u6548\u53c2\u6570 skipTests
(#1616) (0da83f8)
\u4fee\u590d col
\u5360\u4f4d\u7b26\u4e0d\u5bf9\u9f50\u95ee\u9898\uff0c\u6d89\u53ca se
, sv
, sg
\u7ec4\u4ef6 (#1617) (83b08c9)
theme:modal: \u4fee\u590d\u8fc7\u671f\u53c2\u6570 nzComponentParams
(#1615) (45863a1)
Features
abc:st: \u65b0\u589e onCell
\u65b9\u6cd5\u652f\u6301\u5408\u5e76\u5217\u6216\u884c (#1613) (9ab109e)
abc:st: \u65b0\u589e icon
, className
\u65b9\u6cd5\u652f\u6301\u52a8\u6001\u8c03\u6574 (#1618) (6bf27da)
theme:layout-default: \u65b0\u589e fetchingStrictly
, fetching
\u5c5e\u6027\u7528\u4e8e\u81ea\u4e3b\u53d7\u63a7\u9876\u90e8\u52a0\u8f7d\u52a8\u753b\u72b6\u6001 (#1614) (8446da6)
BREAKING CHANGE
acl: \u91cd\u6784 ACLGuard
\u4e3a aclCanMatch
, aclCanActivate
, aclCanActivateChild
auth:simple \u91cd\u6784 SimpleGuard
\u4e3a authSimpleCanMatch
, authSimpleCanActivate
, authSimpleCanActivateChild
auth:jtw \u91cd\u6784 JWTGuard
\u4e3a authJWTCanMatch
, authJWTCanActivate
, authJWTCanActivateChild
i18n \u91cd\u6784 AlainI18NGuard
\u4e3a alainI18nCanMatch
, alainI18nCanActivate
, alainI18nCanActivateChild
16.1.1 (2023-07-16)
Bug Fixes
cli: \u79fb\u9664\u8fc7\u671f\u5e93 stylelint-config-prettier
(#1606) (2ecc28b)
theme: \u4fee\u590d\u5ffd\u7565\u4e24\u4e2a nzType="link"
\u6309\u9519\u65f6\u95f4\u8ddd (#1605) (0fdd15d)
Features
abc:reuse-tab: \u65b0\u589e\u53ef\u81ea\u5b9a\u4e49\u7f13\u5b58\u5b58\u50a8 (#1609) (11599d9)
theme:modal: \u65b0\u589e\u652f\u6301\u62d6\u62fd\u53c2\u6570 drag
(#1607) (3cd73f7)
16.0.1 (2023-06-08)
\u4fee\u590d ng-zorro-antd
\u9519\u4f4d\u7248\u672c\u4f9d\u8d56
16.0.0 (2023-06-07)
Bug Fixes
abc:st: \u4fee\u590d\u56fa\u5b9a\u5217\u6837\u5f0f\u9519\u8bef (#1598) (d2bf211)
form: \u4fee\u590dui\u7531\u4e8e\u7ee7\u627f\u5173\u7cfb\u5bfc\u81f4\u91cd\u590d\u5f15\u7528 (#1600) (a0150e7)
\u5386\u53f2\u7248\u672c
\u5386\u53f2\u7248\u672c\u7684\u66f4\u65b0\u8bb0\u5f55\u53ef\u4ee5\u5728 Github',meta:{order:100,title:"\u66f4\u65b0\u65e5\u5fd7",type:"Other"},toc:[{id:"16.3.02023-09-01",title:"16.3.0 (2023-09-01)",h:1,children:[{id:"SCAFFOLDING",title:"SCAFFOLDING",h:3},{id:"BugFixes",title:"Bug Fixes",h:3},{id:"Features",title:"Features",h:3},{id:"16.2.12023-08-06",title:"16.2.1 (2023-08-06)",h:2},{id:"BugFixes",title:"Bug Fixes",h:3}]},{id:"16.2.02023-07-21",title:"16.2.0 (2023-07-21)",h:1,children:[{id:"SCAFFOLDING",title:"SCAFFOLDING",h:3},{id:"BugFixes",title:"Bug Fixes",h:3},{id:"Features",title:"Features",h:3},{id:"BREAKINGCHANGE",title:"BREAKING CHANGE",h:3}]},{id:"16.1.12023-07-16",title:"16.1.1 (2023-07-16)",h:1,children:[{id:"BugFixes",title:"Bug Fixes",h:3},{id:"Features",title:"Features",h:3},{id:"16.0.12023-06-08",title:"16.0.1 (2023-06-08)",h:2}]},{id:"16.0.02023-06-07",title:"16.0.0 (2023-06-07)",h:1,children:[{id:"BugFixes",title:"Bug Fixes",h:3},{id:"\u5386\u53f2\u7248\u672c",title:"\u5386\u53f2\u7248\u672c",h:2}]}]}},demo:!1},this.codes=[]}}return(e=o).\u0275fac=function(t){return new(t||e)},e.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-changelog"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,i){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",i.codes)("item",i.item)},dependencies:[s.P],styles:["[_nghost-%COMP%]{display:block}"]}),o})()},{path:"cli",redirectTo:"cli/zh",pathMatch:"full"},{path:"cli/:lang",component:(()=>{var e;class o{constructor(){this.item={cols:1,urls:{"zh-CN":"docs/cli.md"},content:{"zh-CN":{content:' ',meta:{order:10,title:{"en-US":"Cli","zh-CN":"\u547d\u4ee4\u884c\u5de5\u5177"},type:"Other",url:"/cli/getting-started"},toc:[]}},demo:!1},this.codes=[]}}return(e=o).\u0275fac=function(t){return new(t||e)},e.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-cli"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,i){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",i.codes)("item",i.item)},dependencies:[s.P],styles:["[_nghost-%COMP%]{display:block}"]}),o})()},{path:"contributing",redirectTo:"contributing/zh",pathMatch:"full"},{path:"contributing/:lang",component:(()=>{var e;class o{constructor(){this.item={cols:1,urls:{"en-US":"docs/contributing.en-US.md","zh-CN":"docs/contributing.zh-CN.md"},content:{"en-US":{content:'The following is a set of guidelines for contributing to ng-alain. Please spend several minutes in reading these guidelines before you create an issue or pull request.
Code of Conduct
We have adopted a Code of Conduct that we expect project participants to adhere to. Please read the full text so that you can understand what actions will and will not be tolerated.
Open Development
All work on ng-alain\u3001delon happens directly. Both core team members and external contributors send pull requests which go through the same review process.
Bugs
We are using GitHub Issues for bug tracing. The best way to get your bug fixed via GitHub Issues and provide a reprduction with this template.
Before you reporting a bug, please make sure you\'ve searched exists issues, and read our FAQ.
Proposing a Change
If you intend to change the public API or introduce new feature that via GitHub Issues.
Your First Pull Request
Working on your first Pull Request? You can learn how from this free video series:
How to Contribute to Open Source
To help you get your feet wet and get you familiar with our contribution process, we have a list of good first issues that contain bugs or small features that have a relatively limited scope. This is a great place to get started.
If you decide to fix an issue, please be sure to check the comment thread in case somebody is already working on a fix. If nobody is working on it at the moment, please leave a comment stating that you intend to work on it so other people don\u2019t accidentally duplicate your effort.
If somebody claims an issue but doesn\u2019t follow up for more than two weeks, it\u2019s fine to take over it but you should still leave a comment.
Sending a Pull Request
The core team is monitoring for pull requests. We will review your pull request and either merge it, request changes to it, or close it with an explanation.
Before submitting a pull request, please make sure the following is done:
Run yarn
in the repository root.
If you\u2019ve fixed a bug or added code that should be tested, add tests!
Ensure the test suite passes (npm run test
).
Make sure your code lints (npm run lint
). Tip: Lint runs automatically when you git commit
.
Make sure rebase your code to keep the history clean.
Make sure your commit message meet the guidelines
Development Workflow
After cloning ng-alain
or delon
, run yarn
to fetch its dependencies. Then, you can run several commands:
delon
npm run site
runs ng-alain.com website locally
npm run lint
checks the code style
npm run test
runs the complete test suite
npm run release
build packages relases
ng-alain
',meta:{order:40,title:"Contributing",type:"Other"},toc:[{id:"CodeofConduct",title:"Code of Conduct",h:2},{id:"OpenDevelopment",title:"Open Development",h:2},{id:"Bugs",title:"Bugs",h:2},{id:"ProposingaChange",title:"Proposing a Change",h:2},{id:"YourFirstPullRequest",title:"Your First Pull Request",h:2},{id:"SendingaPullRequest",title:"Sending a Pull Request",h:2},{id:"DevelopmentWorkflow",title:"Development Workflow",h:2,children:[{id:"delon",title:"delon",h:3},{id:"ng-alain",title:"ng-alain",h:3}]}]},"zh-CN":{content:'\u8fd9\u7bc7\u6307\u5357\u4f1a\u6307\u5bfc\u4f60\u5982\u4f55\u4e3a NG-ALAIN \u8d21\u732e\u4e00\u4efd\u81ea\u5df1\u7684\u529b\u91cf\uff0c\u8bf7\u5728\u4f60\u8981\u63d0 issue \u6216\u8005 pull request \u4e4b\u524d\u82b1\u51e0\u5206\u949f\u6765\u9605\u8bfb\u4e00\u904d\u8fd9\u7bc7\u6307\u5357\u3002
\u884c\u4e3a\u51c6\u5219
\u6211\u4eec\u6709\u4e00\u4efd \u884c\u4e3a\u51c6\u5219\uff0c\u5e0c\u671b\u6240\u6709\u7684\u8d21\u732e\u8005\u90fd\u80fd\u9075\u5b88\uff0c\u8bf7\u82b1\u65f6\u95f4\u9605\u8bfb\u4e00\u904d\u5168\u6587\u4ee5\u786e\u4fdd\u4f60\u80fd\u660e\u767d\u54ea\u4e9b\u662f\u53ef\u4ee5\u505a\u7684\uff0c\u54ea\u4e9b\u662f\u4e0d\u53ef\u4ee5\u505a\u7684\u3002
\u900f\u660e\u7684\u5f00\u53d1
\u6211\u4eec\u6240\u6709\u7684\u5de5\u4f5c\u90fd\u4f1a\u653e\u5728 ng-alain\u3001delon \u4e0a\u3002\u4e0d\u7ba1\u662f\u6838\u5fc3\u56e2\u961f\u7684\u6210\u5458\u8fd8\u662f\u5916\u90e8\u8d21\u732e\u8005\u7684 pull request \u90fd\u9700\u8981\u7ecf\u8fc7\u540c\u6837\u6d41\u7a0b\u7684 review\u3002
Bugs
\u6211\u4eec\u4f7f\u7528 GitHub Issues \u6765\u505a bug \u8ffd\u8e2a\u3002\u5982\u679c\u4f60\u60f3\u8981\u4f60\u53d1\u73b0\u7684 bug \u88ab\u5feb\u901f\u89e3\u51b3\uff0c\u6700\u597d\u7684\u529e\u6cd5\u5c31\u662f\u6309\u7167 issues \u5448\u73b0\u7684\u6a21\u677f\u8ba4\u771f\u586b\u5199\u6bcf\u4e00\u9879\uff1b\u5e76\u4e14\u80fd\u4f7f\u7528\u8fd9\u4e2a \u6a21\u677f \u6765\u63d0\u4f9b\u91cd\u73b0\u3002
\u5728\u4f60\u62a5\u544a\u4e00\u4e2a bug \u4e4b\u524d\uff0c\u8bf7\u5148\u786e\u4fdd\u5df2\u7ecf\u641c\u7d22\u8fc7\u5df2\u6709\u7684 issue \u548c\u9605\u8bfb\u4e86 \u6587\u6863\u7ad9\u3002
\u65b0\u589e\u529f\u80fd
\u5982\u679c\u4f60\u6709\u6539\u8fdb\u6211\u4eec\u7684 API \u6216\u8005\u65b0\u589e\u529f\u80fd\u7684\u60f3\u6cd5\uff0c\u540c\u6837\u6309\u7167 issues \u5448\u73b0\u7684\u6a21\u677f\u8ba4\u771f\u586b\u5199\u6bcf\u4e00\u9879\u3002
\u7b2c\u4e00\u6b21\u8d21\u732e
\u5982\u679c\u4f60\u8fd8\u4e0d\u6e05\u695a\u600e\u4e48\u5728 GitHub \u4e0a\u63d0 Pull Request \uff0c\u53ef\u4ee5\u9605\u8bfb\u4e0b\u9762\u8fd9\u7bc7\u6587\u7ae0\u6765\u5b66\u4e60\uff1a
\u5982\u4f55\u4f18\u96c5\u5730\u5728 GitHub \u4e0a\u8d21\u732e\u4ee3\u7801
\u4e3a\u4e86\u80fd\u5e2e\u52a9\u4f60\u5f00\u59cb\u4f60\u7684\u7b2c\u4e00\u6b21\u5c1d\u8bd5\uff0c\u6211\u4eec\u7528 good first issues \u6807\u8bb0\u4e86\u4e00\u4e9b\u6bd4\u8f83\u6bd4\u8f83\u5bb9\u6613\u4fee\u590d\u7684 bug \u548c\u5c0f\u529f\u80fd\u3002\u8fd9\u4e9b issue \u53ef\u4ee5\u5f88\u597d\u5730\u505a\u4e3a\u4f60\u7684\u9996\u6b21\u5c1d\u8bd5\u3002
\u5982\u679c\u4f60\u6253\u7b97\u5f00\u59cb\u5904\u7406\u4e00\u4e2a issue\uff0c\u8bf7\u5148\u68c0\u67e5\u4e00\u4e0b issue \u4e0b\u9762\u7684\u7559\u8a00\u4ee5\u786e\u4fdd\u6ca1\u6709\u522b\u4eba\u6b63\u5728\u5904\u7406\u8fd9\u4e2a issue\u3002\u5982\u679c\u5f53\u524d\u6ca1\u6709\u4eba\u5728\u5904\u7406\u7684\u8bdd\u4f60\u53ef\u4ee5\u7559\u8a00\u544a\u77e5\u5176\u4ed6\u4eba\u4f60\u5c06\u4f1a\u5904\u7406\u8fd9\u4e2a issue\uff0c\u4ee5\u514d\u522b\u4eba\u91cd\u590d\u52b3\u52a8\u3002
\u5982\u679c\u4e4b\u524d\u6709\u4eba\u7559\u8a00\u8bf4\u4f1a\u5904\u7406\u8fd9\u4e2a issue \u4f46\u662f\u4e00\u4e24\u4e2a\u661f\u671f\u90fd\u6ca1\u6709\u52a8\u9759\uff0c\u90a3\u4e48\u4f60\u4e5f\u53ef\u4ee5\u63a5\u624b\u5904\u7406\u8fd9\u4e2a issue\uff0c\u5f53\u7136\u8fd8\u662f\u9700\u8981\u7559\u8a00\u544a\u77e5\u5176\u4ed6\u4eba\u3002
Pull Request
Ng Alain \u4f1a\u5173\u6ce8\u6240\u6709\u7684 pull request\uff0c\u6211\u4eec\u4f1a review \u4ee5\u53ca\u5408\u5e76\u4f60\u7684\u4ee3\u7801\uff0c\u4e5f\u6709\u53ef\u80fd\u8981\u6c42\u4f60\u505a\u4e00\u4e9b\u4fee\u6539\u6216\u8005\u544a\u8bc9\u4f60\u6211\u4eec\u4e3a\u4ec0\u4e48\u4e0d\u80fd\u63a5\u53d7\u8fd9\u6837\u7684\u4fee\u6539\u3002
\u5728\u4f60\u53d1\u9001 Pull Request \u4e4b\u524d\uff0c\u8bf7\u786e\u8ba4\u4f60\u662f\u6309\u7167\u4e0b\u9762\u7684\u6b65\u9aa4\u6765\u505a\u7684\uff1a
\u5728\u9879\u76ee\u6839\u76ee\u5f55\u4e0b\u8fd0\u884c\u4e86 yarn
\u3002
\u5982\u679c\u4f60\u4fee\u590d\u4e86\u4e00\u4e2a bug \u6216\u8005\u65b0\u589e\u4e86\u4e00\u4e2a\u529f\u80fd\uff0c\u8bf7\u786e\u4fdd\u5199\u4e86\u76f8\u5e94\u7684\u6d4b\u8bd5\uff0c\u8fd9\u5f88\u91cd\u8981\u3002
\u786e\u8ba4\u6240\u6709\u7684\u6d4b\u8bd5\u90fd\u662f\u901a\u8fc7\u7684 npm run test
\u3002
\u786e\u4fdd\u4f60\u7684\u4ee3\u7801\u901a\u8fc7\u4e86 lint \u68c0\u67e5 npm run lint
\u3002\u5c0f\u8d34\u58eb: Lint \u4f1a\u5728\u4f60 git commit
\u7684\u65f6\u5019\u81ea\u52a8\u8fd0\u884c\u3002
\u786e\u4fdd\u4f60\u7684\u4ee3\u7801\u5728\u63d0\u4ea4\u4e4b\u524d\u7ecf\u8fc7\u4e86\u6b63\u786e\u7684 Rebase
\u786e\u4fdd\u4f60\u7684\u63d0\u4ea4\u7b26\u5408\u89c4\u8303
\u5f00\u53d1\u6d41\u7a0b
\u5728\u4f60 clone \u4e86 ng-alain \u6216 delon \u7684\u4ee3\u7801\u5e76\u4e14\u4f7f\u7528 yarn
\u5b89\u88c5\u5b8c\u4f9d\u8d56\u540e\uff0c\u4f60\u8fd8\u53ef\u4ee5\u8fd0\u884c\u4e0b\u9762\u51e0\u4e2a\u5e38\u7528\u7684\u547d\u4ee4\uff1a
delon \u57fa\u5efa\u7c7b\u5e93
npm run site
\u5728\u672c\u5730\u8fd0\u884c ng-alain.com \u7f51\u7ad9
npm run lint
\u68c0\u67e5 packages \u4ee3\u7801\u98ce\u683c
npm run test
\u8fd0\u884c packages \u6240\u6709\u7c7b\u5e93\u6d4b\u8bd5
npm run release
\u6784\u5efa packages \u53d1\u5e03\u5305
ng-alain \u811a\u624b\u67b6
npm start
\u5728\u672c\u5730\u8fd0\u884c\u811a\u624b\u67b6
npm run lint
\u68c0\u67e5\u4ee3\u7801\u98ce\u683c
npm test
\u8fd0\u884c\u6d4b\u8bd5
npm run build
\u6784\u5efa\u751f\u4ea7\u73af\u5883\u7f51\u7ad9
<
',meta:{order:40,title:"\u8d21\u732e\u6307\u5357",type:"Other"},toc:[{id:"\u884c\u4e3a\u51c6\u5219",title:"\u884c\u4e3a\u51c6\u5219",h:2},{id:"\u900f\u660e\u7684\u5f00\u53d1",title:"\u900f\u660e\u7684\u5f00\u53d1",h:2},{id:"Bugs",title:"Bugs",h:2},{id:"\u65b0\u589e\u529f\u80fd",title:"\u65b0\u589e\u529f\u80fd",h:2},{id:"\u7b2c\u4e00\u6b21\u8d21\u732e",title:"\u7b2c\u4e00\u6b21\u8d21\u732e",h:2},{id:"PullRequest",title:"Pull Request",h:2},{id:"\u5f00\u53d1\u6d41\u7a0b",title:"\u5f00\u53d1\u6d41\u7a0b",h:2,children:[{id:"delon\u57fa\u5efa\u7c7b\u5e93",title:"delon \u57fa\u5efa\u7c7b\u5e93",h:3},{id:"ng-alain\u811a\u624b\u67b6",title:"ng-alain \u811a\u624b\u67b6",h:3}]}]}},demo:!1},this.codes=[]}}return(e=o).\u0275fac=function(t){return new(t||e)},e.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-contributing"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,i){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",i.codes)("item",i.item)},dependencies:[s.P],styles:["[_nghost-%COMP%]{display:block}"]}),o})()},{path:"deploy",redirectTo:"deploy/zh",pathMatch:"full"},{path:"deploy/:lang",component:(()=>{var e;class o{constructor(){this.item={cols:1,urls:{"en-US":"docs/deploy.en-US.md","zh-CN":"docs/deploy.zh-CN.md"},content:{"en-US":{content:'Construct
When the project is developed, you can package your app with just one line of command:
npm run build
NG-ALAIN itself is an Angular CLI project, so you can also complete more complex build requirements with Build. After the package is successfully packaged, the dist
folder will be generated in the root directory, which is to build the packaged file, including several static files such as *.js
, *.css
, index.html
.
JavaScript heap out of memory
Avoid executing ng build
when throw error JavaScript heap out of memory:
{\n "scripts": {\n "build": "node --max_old_space_size=5120 ./node_modules/@angular/cli/bin/ng build"\n }\n}
Environmental variables
When you need to distinguish between development and deployment, and test environments, you can configure the corresponding parameters according to different environments through the src/environments
folder. The configuration items can also be called directly in the application. At the same time, you need to configure the configuration items in angular.json
. Finally, you can change the environment configuration through commands.
Analyze the build file volume
If the build file is large, you can optimize your code by building and analyzing the volume distribution of dependent modules with the analyze
command.
npm run analyze
View the analyze page:
npm run analyze:view
Release
When you are ready to deploy (release) your the app, you need only to publish the generated build artifacts - that is, the files in the dist
folder - to your cdn or static server. Note that the index.html
is usually the entry page for your app and handles all missing file requests. You may need to change the import path of the page after determining the static of js and css.
The default static resource reference path directly points to the directory where the dist
folder is published. For example, if you post dist
to the root directory of the ng-alain.com
site, the requested URL is //ng-alain.com/***.js
, //ng-alain.com/***.css
, if dist
is posted to a directory under a certain directory, such as v2
, request The URL is //ng-alain.com/v2/***.js
, //ng-alain.com/v2/***.css
.
If your static resource is deployed to another domain name (such as a separate CDN address), you can specify a CDN address with the --deployUrl
parameter.
ng build -deployUrl=//cdn.ng-alain.com/
The generated index.html
with its *.js
, *.css
files will automatically refer to //cdn.ng-alain.com/*.js
, //cdn.ng-alain.com/*css
, respectively.
Routing strategy
Angular front-end routing has two different strategies: HashLocationStrategy
and PathLocationStrategy
. The former is routed by appending a #
before a path, and the front-end routing management is performed by HTML5 History, while the latter is similar, but the path does not have #
appended before it. Through the configuration of the server, the specified URL can be accessed to the current page, enabling front-end routing management.
If you want to use PathLocationStrategy
, you need to replace RouterModule.forRoot(routes, { useHash: true })
of ./src/app/routes/routes-routing.module.ts
with RouterModule.forRoot(routes)
, since that is the default Angular behavior. You might notice that this can also be done by changing the useHash
variable in the src/environments/environment.*.ts
files, depending on your project configulation. Importantly, your server needs to be correctly configured, such that is returns the index.html
for any 404 errors:
Express server example:
app.use(express.static(path.join(__dirname, \'build\')));\n\napp.get(\'/*\', function (req, res) {\n res.sendFile(path.join(__dirname, \'build\', \'index.html\'));\n});
Egg server example:
// controller\nexports.index = function* () {\n yield this.render(\'App.jsx\', {\n context: {\n user: this.session.user,\n },\n });\n};\n\n// router\napp.get(\'home\', \'/*\', \'home.index\');
For more questions about Angular routing, please read official website.
Docker
NG-ALAIN provides a complete image file for building Angular projects based on the nginx WEB service. Where nginx is a mirror using nginx:1.13.5-alpine, which basically satisfies NG-ALAIN The project\'s good operating environment, if there are more needs, you can easily specify nginx.conf with docker run
.
1. Building the image
Build a complete image of the runtime environment required by NG-ALAIN based on the Dockerfile.
docker build -t ng-alain .
2. Running
Based on compose (Recommended)
docker-compose up -d
The details can be modified with docker-compose.yml
.
Based on imperative
docker run -d -p 80:80 --name alain ng-alain
Finally, you can visit\uff1ahttp://localhost/
3. About SSL
The Dockerfile provided by NG-ALAIN is relatively simple, and the most common use of real projects is support for SSL.
Therefore, by default you can place the certificate in the _nginx/ssl
directory and enable the _nginx/default.conf
related SSL configuration item.
Finally, add the ports
node of docker-compose.yml
:
- 443:443
Container deployment
Refer to Angular Container Deployment
',meta:{order:70,title:{"en-US":"Build & Deploy","zh-CN":"\u6784\u5efa\u548c\u53d1\u5e03"},type:"Dev"},toc:[{id:"Construct",title:"Construct",h:2,children:[{id:"JavaScriptheapoutofmemory",title:"JavaScript heap out of memory",h:3},{id:"Environmentalvariables",title:"Environmental variables",h:3},{id:"Analyzethebuildfilevolume",title:"Analyze the build file volume",h:3}]},{id:"Release",title:"Release",h:2,children:[{id:"Routingstrategy",title:"Routing strategy",h:3},{id:"Docker",title:"Docker",h:3},{id:"Containerdeployment",title:"Container deployment",h:3}]}]},"zh-CN":{content:'\u6784\u5efa
\u5f53\u9879\u76ee\u5f00\u53d1\u5b8c\u6bd5\uff0c\u53ea\u9700\u8981\u8fd0\u884c\u4e00\u884c\u547d\u4ee4\u5c31\u53ef\u4ee5\u6253\u5305\u4f60\u7684\u5e94\u7528\uff1a
npm run build
NG-ALAIN \u672c\u8eab\u662f\u4e00\u4e2a Angular CLI \u9879\u76ee\uff0c\u56e0\u6b64\u4e5f\u53ef\u4ee5\u53c2\u7167 Build \u5b8c\u6210\u66f4\u590d\u6742\u7684\u6784\u5efa\u9700\u6c42\u3002\u6784\u5efa\u6253\u5305\u6210\u529f\u4e4b\u540e\uff0c\u4f1a\u5728\u6839\u76ee\u5f55\u751f\u6210 dist
\u6587\u4ef6\u5939\uff0c\u91cc\u9762\u5c31\u662f\u6784\u5efa\u6253\u5305\u597d\u7684\u6587\u4ef6\uff0c\u5305\u542b\u82e5\u5e72 *.js
\u3001*.css
\u3001index.html
\u7b49\u9759\u6001\u6587\u4ef6\u3002
JavaScript heap out of memory
\u907f\u514d\u6267\u884c ng build
\u65f6\u629b\u51fa JavaScript heap out of memory\uff1a
{\n "scripts": {\n "build": "node --max_old_space_size=5120 ./node_modules/@angular/cli/bin/ng build"\n }\n}
\u73af\u5883\u53d8\u91cf
\u5f53\u4f60\u9700\u8981\u533a\u522b\u5f00\u53d1\u548c\u90e8\u7f72\u4ee5\u53ca\u6d4b\u8bd5\u73af\u5883\u7684\u65f6\u5019\uff0c\u53ef\u4ee5\u901a\u8fc7 src/environments
\u6587\u4ef6\u5939\u6839\u636e\u4e0d\u540c\u73af\u5883\u914d\u7f6e\u76f8\u5e94\u7684\u53c2\u6570\uff0c\u914d\u7f6e\u9879\u540c\u65f6\u4e5f\u53ef\u4ee5\u5728\u5e94\u7528\u5f53\u4e2d\u76f4\u63a5\u8c03\u7528\u5b83\u4eec\u3002\u540c\u65f6\uff0c\u8fd8\u9700\u8981\u914d\u7f6e angular.json
\u5185\u7684\u914d\u7f6e\u9879\uff0c\u6700\u540e\u4f60\u53ef\u4ee5\u900f\u8fc7\u547d\u4ee4\u6539\u53d8\u73af\u5883\u914d\u7f6e\u3002
\u5206\u6790\u6784\u5efa\u6587\u4ef6\u4f53\u79ef
\u5982\u679c\u6784\u5efa\u6587\u4ef6\u5f88\u5927\uff0c\u53ef\u4ee5\u901a\u8fc7 analyze
\u547d\u4ee4\u6784\u5efa\u5e76\u5206\u6790\u4f9d\u8d56\u6a21\u5757\u7684\u4f53\u79ef\u5206\u5e03\uff0c\u4ece\u800c\u4f18\u5316\u4f60\u7684\u4ee3\u7801\u3002
npm run analyze
\u67e5\u770b\u5206\u6790\u9875\uff1a
npm run analyze:view
\u53d1\u5e03
\u5bf9\u4e8e\u53d1\u5e03\u6765\u8bb2\uff0c\u53ea\u9700\u8981\u5c06\u6700\u7ec8\u751f\u6210\u7684\u9759\u6001\u6587\u4ef6\uff0c\u4e5f\u5c31\u662f\u901a\u5e38\u60c5\u51b5\u4e0b dist
\u6587\u4ef6\u5939\u7684\u9759\u6001\u6587\u4ef6\u53d1\u5e03\u5230\u4f60\u7684 cdn \u6216\u8005\u9759\u6001\u670d\u52a1\u5668\u5373\u53ef\uff0c\u9700\u8981\u6ce8\u610f\u7684\u662f\u5176\u4e2d\u7684 index.html
\u901a\u5e38\u4f1a\u662f\u4f60\u540e\u53f0\u670d\u52a1\u7684\u5165\u53e3\u9875\u9762\uff0c\u5728\u786e\u5b9a\u4e86 js \u548c css \u7684\u9759\u6001\u4e4b\u540e\u53ef\u80fd\u9700\u8981\u6539\u53d8\u9875\u9762\u7684\u5f15\u5165\u8def\u5f84\u3002
\u9ed8\u8ba4\u7684\u9759\u6001\u8d44\u6e90\u5f15\u7528\u8def\u5f84\u76f4\u63a5\u6307\u5411 dist
\u6587\u4ef6\u5939\u53d1\u5e03\u6240\u5904\u5e94\u7528\u7684\u76ee\u5f55\u4e0b\uff0c\u4f8b\u5982\u4f60\u5c06 dist
\u53d1\u5e03\u81f3 ng-alain.com
\u7ad9\u70b9\u7684\u6839\u76ee\u5f55\u91cc\u5219\u8bf7\u6c42\u7684\u7f51\u5740\u662f //ng-alain.com/***.js
\u3001//ng-alain.com/***.css
\uff0c\u82e5 dist
\u53d1\u5e03\u81f3\u67d0\u7ad9\u70b9\u4e0b\u67d0\u4e2a\u76ee\u5f55\u5982 v2
\u6587\u4ef6\u5939\u4e0b\uff0c\u5219\u8bf7\u6c42\u7684\u7f51\u5740\u662f //ng-alain.com/v2/***.js
\u3001//ng-alain.com/v2/***.css
\u3002
\u5982\u679c\u4f60\u7684\u9759\u6001\u8d44\u6e90\u662f\u90e8\u7f72\u5230\u5176\u4ed6\u57df\u540d\uff08\u4f8b\u5982\u72ec\u7acb\u7684 cdn \u5730\u5740\uff09\uff0c\u4f60\u53ef\u4ee5\u900f\u8fc7 -d
\u53c2\u6570\u6307\u5b9a\u4e00\u4e2a cdn \u5730\u5740\u3002
ng build -d=//cdn.ng-alain.com/
\u8fd9\u6837\u751f\u6210\u7684 index.html
\u5185 *.js
\u3001*.css
\u4f1a\u81ea\u52a8\u52a0\u4e0a //cdn.ng-alain.com/*.js
\u3002
\u8def\u7531\u7b56\u7565
Angular \u524d\u7aef\u8def\u7531\u6709\u4e24\u79cd\u4e0d\u540c\u7b56\u7565 HashLocationStrategy
\u548c PathLocationStrategy
\u3002\u524d\u8005\u662f\u4ee5 #
\u540e\u9762\u7684\u8def\u5f84\u8fdb\u884c\u8def\u7531\u5904\u7406\uff0c\u901a\u8fc7 HTML5 History \u8fdb\u884c\u524d\u7aef\u8def\u7531\u7ba1\u7406\uff0c\u800c\u540e\u8005\u5219\u662f\u7c7b\u4f3c\u9875\u9762\u8bbf\u95ee\u8def\u5f84\u5e76\u6ca1\u6709 #
\uff0c\u901a\u8fc7\u670d\u52a1\u7aef\u7684\u914d\u7f6e\uff0c\u80fd\u591f\u8bbf\u95ee\u6307\u5b9a URL \u90fd\u5b9a\u5411\u5230\u5f53\u524d\u9875\u9762\uff0c\u4ece\u800c\u80fd\u591f\u8fdb\u884c\u524d\u7aef\u8def\u7531\u7ba1\u7406\u3002
\u5982\u679c\u4f60\u60f3\u91c7\u7528 PathLocationStrategy
\u7b56\u7565\uff0c\u5219\u9700\u8981\u5c06 ./src/app/routes/routes.module.ts
\u7684 RouterModule.forRoot(routes, { useHash: true })
\u6362\u6210 RouterModule.forRoot(routes)
\u3002\u540c\u65f6\u9700\u8981\u670d\u52a1\u7aef\u505a\u4e00\u4e2a\u6620\u5c04\uff0c\u6bd4\u5982\uff1a
express \u7684\u4f8b\u5b50\uff1a
app.use(express.static(path.join(__dirname, \'build\')));\n\napp.get(\'/*\', function (req, res) {\n res.sendFile(path.join(__dirname, \'build\', \'index.html\'));\n});
egg \u7684\u4f8b\u5b50\uff1a
// controller\nexports.index = function* () {\n yield this.render(\'App.jsx\', {\n context: {\n user: this.session.user,\n },\n });\n};\n\n// router\napp.get(\'home\', \'/*\', \'home.index\');
\u6709\u5173\u66f4\u591a Angular \u8def\u7531\u76f8\u5f53\u95ee\u9898\uff0c\u8bf7\u9605\u8bfb\u5b98\u7f51\u3002
Docker
NG-ALAIN \u63d0\u4f9b\u4e86\u4e00\u4e2a\u57fa\u4e8e nginx
WEB\u670d\u52a1\u5b8c\u6574\u7684\u6784\u5efaAngular\u9879\u76ee\u7684\u955c\u50cf\u6587\u4ef6\u3002\u5176\u4e2d nginx
\u662f\u91c7\u7528 nginx:1.13.5-alpine \u7684\u955c\u50cf\uff0c\u57fa\u672c\u4e0a\u53ef\u4ee5\u6ee1\u8db3 NG-ALAIN \u9879\u76ee\u7684\u826f\u597d\u8fd0\u884c\u73af\u5883\uff0c\u5018\u82e5\u6709\u66f4\u591a\u9700\u6c42\uff0c\u4f60\u53ef\u4ee5\u5229\u7528 docker run
\u8f7b\u6613\u7684\u6307\u5b9a nginx.conf\u3002
1\u3001\u6784\u5efa\u955c\u50cf
\u6839\u636e Dockerfile \u6784\u5efa\u4e00\u4e2a\u5b8c\u6574\u7684 NG-ALAIN \u6240\u9700\u8981\u7684\u8fd0\u884c\u73af\u5883\u7684\u955c\u50cf\u3002
docker build -t ng-alain .
2\u3001\u8fd0\u884c
\u57fa\u4e8ecompose\uff08\u63a8\u8350\uff09
docker-compose up -d
\u5176\u7ec6\u8282\u53ef\u4ee5\u901a\u8fc7 docker-compose.yml
\u4fee\u6539\u3002
\u57fa\u4e8e\u547d\u4ee4\u5f0f
docker run -d -p 80:80 --name alain ng-alain
\u6700\u540e\u4f60\u53ef\u4ee5\u8bbf\u95ee\uff1ahttp://localhost/
3\u3001\u5173\u4e8eSSL
NG-ALAIN \u63d0\u4f9b\u7684 Dockerfile \u6587\u4ef6\u76f8\u5bf9\u4e8e\u6bd4\u8f83\u7b80\u5355\uff0c\u800c\u5b9e\u9645\u9879\u76ee\u4e2d\u6700\u5e38\u7528\u7684\u662f\u5bf9SSL\u7684\u652f\u6301\u3002
\u56e0\u6b64\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4f60\u53ef\u4ee5\u5c06\u8bc1\u4e66\u653e\u7f6e _nginx/ssl
\u76ee\u5f55\u4e0b\uff0c\u5e76\u5f00\u542f _nginx/default.conf
\u76f8\u5173SSL\u914d\u7f6e\u9879\u5373\u53ef\u3002
\u6700\u540e\uff0c\u589e\u52a0 docker-compose.yml
\u7684 ports
\u8282\u70b9\uff1a
- 443:443
\u5bb9\u5668\u90e8\u7f72
\u53c2\u8003 Angular \u5bb9\u5668\u90e8\u7f72
',meta:{order:70,title:{"en-US":"Build & Deploy","zh-CN":"\u6784\u5efa\u548c\u53d1\u5e03"},type:"Dev"},toc:[{id:"\u6784\u5efa",title:"\u6784\u5efa",h:2,children:[{id:"JavaScriptheapoutofmemory",title:"JavaScript heap out of memory",h:3},{id:"\u73af\u5883\u53d8\u91cf",title:"\u73af\u5883\u53d8\u91cf",h:3},{id:"\u5206\u6790\u6784\u5efa\u6587\u4ef6\u4f53\u79ef",title:"\u5206\u6790\u6784\u5efa\u6587\u4ef6\u4f53\u79ef",h:3}]},{id:"\u53d1\u5e03",title:"\u53d1\u5e03",h:2,children:[{id:"\u8def\u7531\u7b56\u7565",title:"\u8def\u7531\u7b56\u7565",h:3},{id:"Docker",title:"Docker",h:3},{id:"\u5bb9\u5668\u90e8\u7f72",title:"\u5bb9\u5668\u90e8\u7f72",h:3}]}]}},demo:!1},this.codes=[]}}return(e=o).\u0275fac=function(t){return new(t||e)},e.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-deploy"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,i){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",i.codes)("item",i.item)},dependencies:[s.P],styles:["[_nghost-%COMP%]{display:block}"]}),o})()},{path:"faq",redirectTo:"faq/zh",pathMatch:"full"},{path:"faq/:lang",component:(()=>{var e;class o{constructor(){this.item={cols:1,urls:{"en-US":"docs/faq.en-US.md","zh-CN":"docs/faq.zh-CN.md"},content:{"en-US":{content:'Please check the FAQ below before asking questions.
Basic
Can\'t Bind to since it isn\'t a known property of
When you have multiple lazy modules, you want each submodule to use the component library (for example: NgZorroAntdModule
, NgxTinymceModule
) should be exported in ShareModule
, please refer to module registration guidelines.
Expression Changed After It Has Been Checked Error
Common mistakes under Angular, this article will help you understand why.
Can\'t bind to \'formGroup\' since it isn\'t a known property of \'form\'
Common mistakes under Angular, the use of Reactive Forms requires the introduction of ReactiveFormsModule
, refer to official documentation.
Why is the page not updated after the data is modified?
The NG-ZORRO and @delon/* components work in OnPush mode by default. Mutate objects or arrays do not trigger Angular\'s change detection. Use the immutable method.
How to use @delon daily build version
NG-ALAIN provides a delon-builds repository as a daily build version. It\'s not the final stable version, but contains the latest fixed BUG, To use the latest features, you can create delon.sh
in the root directory:
#!/usr/bin/env bash\nset -e\necho "Download latest @delon version"\nrm -rf delon-builds\ngit clone --depth 1 https://github.com/ng-alain/delon-builds.git\nrm -rf node_modules/@delon\nrm -rf node_modules/ng-alain\nrsync -am delon-builds/ node_modules/\nNG_ALAIN_VERSION=$(node -p "require(\'./node_modules/ng-alain/package.json\').version")\nrm -rf delon-builds\necho "Using ng-alain version: ${NG_ALAIN_VERSION}"
When you need to use the daily build version of @delon, you only need to run:
bash delon.sh
If in Windows environment, please use WSL to execute Bash scripts.
Installation
Why can\'t I find the ng-zorro-antd/src/*.less style?
Two situations:
Using cnpm
to install dependencies, you will not be able to find style files. This is because cnpm
is in the form of a soft link path, which causes the ng-zorro-antd
folder name to change, so it is recommended to use the yarn
install dependency package instead.
The ng-zorro-antd
version is too old to cause some components to fail to load into the appropriate style
How to use Taobao source correctly?
The simplest is to use the networkEnv plugin.
Or manually repair:
yarn config set registry https://registry.npmmirror.com\nyarn config set sass_binary_site https://npmmirror.com/mirrors/node-sass\n# restore\nyarn config delete registry\nyarn config delete sass_binary_site
Configuration
How do I deploy the antd icon locally?
First, the latest iconfont file can go to this link (mirror) Download.
Finally, redefine the new path in src/styles/theme.less
:
@icon-url: "/assets/iconfont";
Use an absolute path or CDN address.
Missing locale data for the locale "zh-cn"
For missing language imports, refer to app.module.ts.
How to deploy ng-alain.com documentation site in local
Online documents will only retain the data of the last three major version numbers. If the version is low, you can view it through local deployment:
git clone --depth 1 -b full https://github.com/ng-alain/archive-docs.git ng-alain-doc\ncd ng-alain-doc\nyarn\nyarn start
Fix the abnormal display of the lower part of the 360 browser
The built-in Chrome core of some 360 browsers is too low, resulting in some CSS3 not supported, you can manually increase .browserslistrc
For more details, refer to #2310
',meta:{order:20,title:{"en-US":"FAQ","zh-CN":"\u5e38\u89c1\u95ee\u9898"},type:"Other"},toc:[{id:"Basic",title:"Basic",h:2,children:[{id:"Can'tBindtosinceitisn'taknownpropertyof",title:"Can't Bind to since it isn't a known property of",h:3},{id:"ExpressionChangedAfterItHasBeenCheckedError",title:"Expression Changed After It Has Been Checked Error",h:3},{id:"Can'tbindto'formGroup'sinceitisn'taknownpropertyof'form'",title:"Can't bind to 'formGroup' since it isn't a known property of 'form'",h:3},{id:"Whyisthepagenotupdatedafterthedataismodified",title:"Why is the page not updated after the data is modified?",h:3},{id:"Howtouse@delondailybuildversion",title:"How to use @delon daily build version",h:3}]},{id:"Installation",title:"Installation",h:2,children:[{id:"Whycan'tIfindtheng-zorro-antd/src/*.lessstyle",title:"Why can't I find the ng-zorro-antd/src/*.less style?",h:3},{id:"HowtouseTaobaosourcecorrectly",title:"How to use Taobao source correctly?",h:3}]},{id:"Configuration",title:"Configuration",h:2,children:[{id:"HowdoIdeploytheantdiconlocally",title:"How do I deploy the antd icon locally?",h:3},{id:'Missinglocaledataforthelocale"zh-cn"',title:'Missing locale data for the locale "zh-cn"',h:3},{id:"Howtodeployng-alain.comdocumentationsiteinlocal",title:"How to deploy ng-alain.com documentation site in local",h:3},{id:"Fixtheabnormaldisplayofthelowerpartofthe360browser",title:"Fix the abnormal display of the lower part of the 360 browser",h:3}]}]},"zh-CN":{content:'\u63d0\u95ee\u4e4b\u524d\uff0c\u8bf7\u5148\u67e5\u9605\u4e0b\u9762\u7684\u5e38\u89c1\u95ee\u9898\u3002
\u57fa\u7840
Can\'t Bind to since it isn\'t a known property of
\u5f53\u4f60\u6709\u591a\u4e2a\u61d2\u6a21\u5757\u65f6\uff0c\u5e0c\u671b\u6bcf\u4e2a\u5b50\u6a21\u5757\u90fd\u9700\u8981\u4f7f\u7528\u7ec4\u4ef6\u5e93\u65f6\uff08\u4f8b\u5982\uff1aNgZorroAntdModule
\u3001NgxTinymceModule
\uff09\u5e94\u5728 ShareModule
\u4e2d export\uff0c\u8bf7\u53c2\u8003\u6a21\u5757\u6ce8\u518c\u6307\u5bfc\u539f\u5219\u3002
Expression Changed After It Has Been Checked Error \u9519\u8bef
Angular \u4e0b\u5e38\u89c1\u9519\u8bef\uff0c\u8fd9\u7bc7\u6587\u7ae0 \u4f1a\u5e2e\u52a9\u4f60\u7406\u89e3\u539f\u56e0\u3002
Can\'t bind to \'formGroup\' since it isn\'t a known property of \'form\'
Angular \u4e0b\u5e38\u89c1\u9519\u8bef\uff0c\u4f7f\u7528 Reactive Forms \u9700\u8981\u989d\u5916\u5f15\u5165 ReactiveFormsModule
\uff0c\u53ef\u4ee5\u53c2\u8003\u5b98\u65b9\u6587\u6863\u3002
\u6570\u636e\u4fee\u6539\u540e\u9875\u9762\u4e3a\u4ec0\u4e48\u6ca1\u6709\u66f4\u65b0
NG-ZORRO \u53ca @delon/* \u7ec4\u4ef6\u9ed8\u8ba4\u5728 OnPush \u6a21\u5f0f\u4e0b\u5de5\u4f5c\uff0cmutate \u5bf9\u8c61\u6216\u8005\u6570\u7ec4\u4e0d\u4f1a\u89e6\u53d1 Angular \u7684\u53d8\u66f4\u68c0\u6d4b\uff0c\u8bf7\u4f7f\u7528 immutable \u65b9\u5f0f\u3002
\u5982\u4f55\u4f7f\u7528@delon\u6bcf\u65e5\u6784\u5efa\u7248\u672c
NG-ALAIN \u63d0\u4f9b\u4e00\u4e2a delon-builds \u4ed3\u50a8\u4f5c\u4e3a\u6bcf\u65e5\u6784\u5efa\u7248\u672c\uff0c\u5b83\u5e76\u4e0d\u662f\u6700\u7ec8\u7a33\u5b9a\u7248\u672c\uff0c\u4f46\u5305\u542b\u6700\u65b0\u5df2\u4fee\u590dBUG\u3001\u6700\u65b0\u529f\u80fd\uff0c\u8981\u4f7f\u7528\u53ef\u4ee5\u5728\u6839\u76ee\u5f55\u521b\u5efa delon.sh
\uff1a
#!/usr/bin/env bash\nset -e\necho "Download latest @delon version"\nrm -rf delon-builds\ngit clone --depth 1 https://github.com/ng-alain/delon-builds.git\nrm -rf node_modules/@delon\nrm -rf node_modules/ng-alain\nrsync -am delon-builds/ node_modules/\nNG_ALAIN_VERSION=$(node -p "require(\'./node_modules/ng-alain/package.json\').version")\nrm -rf delon-builds\necho "Using ng-alain version: ${NG_ALAIN_VERSION}"
\u5f53\u9700\u8981\u4f7f\u7528@delon\u7684\u6bcf\u65e5\u6784\u5efa\u7248\u672c\uff0c\u53ea\u9700\u8981\u5728\u8fd0\u884c\uff1a
bash delon.sh
\u5982\u679c\u662f Windows \u73af\u5883\uff0c\u8bf7\u4f7f\u7528 WSL \u6765\u6267\u884c Bash \u811a\u672c\u3002
\u5b89\u88c5
\u4e3a\u4ec0\u4e48\u627e\u4e0d\u5230 ng-zorro-antd/src/*.less \u6837\u5f0f\uff1f
\u4e24\u79cd\u60c5\u51b5\uff1a
\u4f7f\u7528 cnpm
\u5b89\u88c5\u4f9d\u8d56\u5305\uff0c\u4f1a\u9047\u5230\u65e0\u6cd5\u627e\u5230\u6837\u5f0f\u6587\u4ef6\u3002\u8fd9\u662f\u7531\u4e8e cnpm
\u91c7\u7528\u7684\u662f\u8f6f\u94fe\u63a5\u8def\u5f84\u5f62\u5f0f\uff0c\u5bfc\u81f4 ng-zorro-antd
\u6587\u4ef6\u5939\u540d\u6709\u6240\u53d8\u52a8\uff0c\u56e0\u6b64\u5efa\u8bae\u6539\u7528 yarn
\u5b89\u88c5\u4f9d\u8d56\u5305\uff0c\u5982\u679c\u662f\u7f51\u7edc\u56e0\u7d20\uff0c\u8bf7\u53c2\u8003\u4e0b\u65b9\u7684\u5982\u4f55\u6b63\u786e\u4f7f\u7528\u6dd8\u5b9d\u6e90\u3002
ng-zorro-antd
\u7248\u672c\u8fc7\u65e7\u5bfc\u81f4\u90e8\u5206\u7ec4\u4ef6\u65e0\u6cd5\u52a0\u8f7d\u5230\u76f8\u5e94\u6837\u5f0f
\u5982\u4f55\u6b63\u786e\u4f7f\u7528\u6dd8\u5b9d\u6e90\uff1f
\u6700\u7b80\u5355\u662f\u4f7f\u7528 networkEnv \u63d2\u4ef6\u3002
\u6216\u624b\u52a8\u4fee\u590d\uff1a
yarn config set registry https://registry.npmmirror.com\nyarn config set sass_binary_site https://npmmirror.com/mirrors/node-sass\n# \u6062\u590d\nyarn config delete registry\nyarn config delete sass_binary_site
\u914d\u7f6e
\u5982\u4f55\u672c\u5730\u90e8\u7f72 antd \u56fe\u6807\uff1f
\u9996\u5148\uff0c\u6700\u65b0\u7684 iconfont \u6587\u4ef6\u53ef\u4ee5\u5230 \u6b64\u94fe\u63a5\uff08\u955c\u50cf\uff09 \u4e0b\u8f7d\u3002
\u6700\u540e\uff0c\u5728 src/styles/theme.less
\u91cd\u65b0\u5b9a\u4e49\u65b0\u7684\u8def\u5f84\uff1a
@icon-url: "/assets/iconfont";
\u4f7f\u7528\u7edd\u5bf9\u8def\u5f84\u6216CDN\u5730\u5740\u3002
Missing locale data for the locale "zh-cn"
\u7f3a\u5c11\u8bed\u8a00\u5bfc\u5165\uff0c\u53c2\u8003app.module.ts\u3002
\u5982\u4f55\u672c\u5730\u90e8\u7f72ng-alain.com\u6587\u6863
\u7ebf\u4e0a\u6587\u6863\u5c06\u53ea\u4fdd\u7559\u6700\u8fd1\u4e09\u4e2a\u4e3b\u7248\u672c\u53f7\u7684\u6570\u636e\uff0c\u82e5\u662f\u4f4e\u7248\u672c\u53ef\u4ee5\u901a\u8fc7\u672c\u5730\u90e8\u7f72\u6765\u67e5\u770b\uff1a
git clone --depth 1 -b full https://github.com/ng-alain/archive-docs.git ng-alain-doc\ncd ng-alain-doc\nyarn\nyarn start
\u4fee\u590d360\u6d4f\u89c8\u5668\u4e0b\u90e8\u5206\u663e\u793a\u5f02\u5e38
\u90e8\u5206360\u6d4f\u89c8\u5668\u5185\u7f6e\u7684 Chrome \u6838\u5fc3\u8fc7\u4f4e\uff0c\u5bfc\u81f4\u90e8\u5206 CSS3 \u672a\u652f\u6301\uff0c\u53ef\u4ee5\u624b\u52a8\u589e\u52a0 .browserslistrc
\u66f4\u591a\u7ec6\u8282\u53c2\u8003 #2310
',meta:{order:20,title:{"en-US":"FAQ","zh-CN":"\u5e38\u89c1\u95ee\u9898"},type:"Other"},toc:[{id:"\u57fa\u7840",title:"\u57fa\u7840",h:2,children:[{id:"Can'tBindtosinceitisn'taknownpropertyof",title:"Can't Bind to since it isn't a known property of",h:3},{id:"ExpressionChangedAfterItHasBeenCheckedError\u9519\u8bef",title:"Expression Changed After It Has Been Checked Error \u9519\u8bef",h:3},{id:"Can'tbindto'formGroup'sinceitisn'taknownpropertyof'form'",title:"Can't bind to 'formGroup' since it isn't a known property of 'form'",h:3},{id:"\u6570\u636e\u4fee\u6539\u540e\u9875\u9762\u4e3a\u4ec0\u4e48\u6ca1\u6709\u66f4\u65b0",title:"\u6570\u636e\u4fee\u6539\u540e\u9875\u9762\u4e3a\u4ec0\u4e48\u6ca1\u6709\u66f4\u65b0",h:3},{id:"\u5982\u4f55\u4f7f\u7528@delon\u6bcf\u65e5\u6784\u5efa\u7248\u672c",title:"\u5982\u4f55\u4f7f\u7528@delon\u6bcf\u65e5\u6784\u5efa\u7248\u672c",h:3}]},{id:"\u5b89\u88c5",title:"\u5b89\u88c5",h:2,children:[{id:"\u4e3a\u4ec0\u4e48\u627e\u4e0d\u5230ng-zorro-antd/src/*.less\u6837\u5f0f\uff1f",title:"\u4e3a\u4ec0\u4e48\u627e\u4e0d\u5230 ng-zorro-antd/src/*.less \u6837\u5f0f\uff1f",h:3},{id:"\u5982\u4f55\u6b63\u786e\u4f7f\u7528\u6dd8\u5b9d\u6e90\uff1f",title:"\u5982\u4f55\u6b63\u786e\u4f7f\u7528\u6dd8\u5b9d\u6e90\uff1f",h:3}]},{id:"\u914d\u7f6e",title:"\u914d\u7f6e",h:2,children:[{id:"\u5982\u4f55\u672c\u5730\u90e8\u7f72antd\u56fe\u6807\uff1f",title:"\u5982\u4f55\u672c\u5730\u90e8\u7f72 antd \u56fe\u6807\uff1f",h:3},{id:'Missinglocaledataforthelocale"zh-cn"',title:'Missing locale data for the locale "zh-cn"',h:3},{id:"\u5982\u4f55\u672c\u5730\u90e8\u7f72ng-alain.com\u6587\u6863",title:"\u5982\u4f55\u672c\u5730\u90e8\u7f72ng-alain.com\u6587\u6863",h:3},{id:"\u4fee\u590d360\u6d4f\u89c8\u5668\u4e0b\u90e8\u5206\u663e\u793a\u5f02\u5e38",title:"\u4fee\u590d360\u6d4f\u89c8\u5668\u4e0b\u90e8\u5206\u663e\u793a\u5f02\u5e38",h:3}]}]}},demo:!1},this.codes=[]}}return(e=o).\u0275fac=function(t){return new(t||e)},e.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-faq"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,i){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",i.codes)("item",i.item)},dependencies:[s.P],styles:["[_nghost-%COMP%]{display:block}"]}),o})()},{path:"getting-started",redirectTo:"getting-started/zh",pathMatch:"full"},{path:"getting-started/:lang",component:(()=>{var e;class o{constructor(){this.item={cols:1,urls:{"en-US":"docs/getting-started.en-US.md","zh-CN":"docs/getting-started.zh-CN.md"},content:{"en-US":{content:'Foreword
NG-ALAIN is a production-ready solution for admin interfaces. Built on the design principles developed by Ant Design, this project introduces higher level components; we have developed templates, components, and a corresponding design kit to improve the user and development experience for admin interfaces.
How to read document
This document uses the following conventions:
API
[]
Input Property
()
Output Event
[()]
Two-way binding
ng-content
Component content placeholders
#tpl
Refers <ng-template #tpl>
Preparation
You will need node and git. The project is based on Typescript, Angular, g2, @delon and ng-zorro-antd. It would be helpful if you have pre-existing knowledge on those.
Installation
CLI (Recommend)
Please make sure global Angular Cli is latest version via ng version
command, please refer to CLI Command Reference for how to upgrade.
yarn global add @angular/cli\nng new my-project --style less --routing --package-manager yarn\ncd my-project\nng add ng-alain\nyarn start\n# Or use HMR mode by: yarn run hmr
Please refer to Schematics for more details.
Clone the Git Repository
git clone --depth=1 https://github.com/ng-alain/ng-alain.git my-project\ncd my-project\nyarn\nyarn start\n# Or use HMR mode by: yarn run hmr
Note: Installing with the CLI is a clean scaffolding; using clone the git repository include all example pages.
Scaffolding
NG-ALAIN is a standard Angular CLI project that includes common routes for admins and demonstrates our component library. The project layout is as follows:
\u251c\u2500\u2500 _mock # Mock Data rule\n\u251c\u2500\u2500 src\n\u2502\xa0\xa0 \u251c\u2500\u2500 app\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 core # Core module\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 i18n\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 net\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 default.interceptor.ts # Default HTTP interceptor\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 services\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 startup.service.ts # Initialize project configuration\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 core.module.ts # Core module file\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 layout # Core layout\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 routes\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 ** # Business directory\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 routes.module.ts # Service routing module\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 routes-routing.module.ts # Service routes registration\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 shared # Shared module\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 shared-delon.module.ts # @Delon/* import of secondary shared modules\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 shared-zorro.module.ts # NG-ZORRO import of secondary shared modules\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 shared.module.ts # Shared module file\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 app.component.ts # Root component\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 app.module.ts # Root module\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 global-config.module.ts # @delon & ng-zorro global config\n\u2502\xa0\xa0 \u251c\u2500\u2500 assets # Local static resource\n\u2502\xa0\xa0 \u251c\u2500\u2500 environments # Environment variable configuration\n\u2502\xa0\xa0 \u251c\u2500\u2500 styles # Style directory\n\u2514\u2500\u2500 \u2514\u2500\u2500 style.less # Style guide entry
Development
yarn start
This will automatically open http://localhost:4200. If you see the following page then you have succeeded.
Environment Support
Limited by Angular, no longer supports IE
Modern browsers, Browser support
Server-side Rendering
IE / Edge
Firefox
Chrome
Safari
Opera
ElectronEdge last 2 versions last 2 versions last 2 versions last 2 versions last 2 versions
Contributing
Please read our CONTRIBUTING.md first.
If you\'d like to help us improve NG-ZORRO, just create a Pull Request. Feel free to report bugs and issues here.
If you\'re new to posting issues, we ask that you read How To Ask Questions The Smart Way(This guide does not provide actual support services for this project!) and How to Ask a Question in Open Source Community and How to Report Bugs Effectively prior to posting. Well written bug reports help us help you!
Need Help?
For questions on how to use ng-alain, please post questions to using the ng-alain
tag.
As always, we encourage experienced users to help those who are not familiar with ng-alain
!
DONATE
',meta:{order:10,title:"Getting Started",type:"Basic",i18n:"need-update"},toc:[{id:"Foreword",title:"Foreword",h:2},{id:"Preparation",title:"Preparation",h:2},{id:"Installation",title:"Installation",h:2,children:[{id:"CLIRecommend",title:"CLI (Recommend)",h:3},{id:"ClonetheGitRepository",title:"Clone the Git Repository",h:3}]},{id:"Scaffolding",title:"Scaffolding",h:2},{id:"Development",title:"Development",h:2},{id:"EnvironmentSupport",title:"Environment Support",h:2},{id:"Contributing",title:"Contributing",h:2},{id:"NeedHelp",title:"Need Help?",h:2},{id:"DONATE",title:"DONATE",h:2}]},"zh-CN":{content:'\u4ec0\u4e48\u662fNG-ALAIN
NG-ALAIN \u662f\u4e00\u4e2a\u4f01\u4e1a\u7ea7\u4e2d\u540e\u53f0\u524d\u7aef/\u8bbe\u8ba1\u89e3\u51b3\u65b9\u6848\u811a\u624b\u67b6\uff0c\u6211\u4eec\u79c9\u627f Ant Design \u7684\u8bbe\u8ba1\u4ef7\u503c\u89c2\uff0c\u76ee\u6807\u4e5f\u975e\u5e38\u7b80\u5355\uff0c\u5e0c\u671b\u5728Angular\u4e0a\u9762\u5f00\u53d1\u4f01\u4e1a\u540e\u53f0\u66f4\u7b80\u5355\u3001\u66f4\u5feb\u901f\u3002\u968f\u7740\u300e\u8bbe\u8ba1\u8005\u300f\u7684\u4e0d\u65ad\u53cd\u9988\uff0c\u5c06\u6301\u7eed\u8fed\u4ee3\uff0c\u9010\u6b65\u6c89\u6dc0\u548c\u603b\u7ed3\u51fa\u66f4\u591a\u8bbe\u8ba1\u6a21\u5f0f\u548c\u76f8\u5e94\u7684\u4ee3\u7801\u5b9e\u73b0\uff0c\u9610\u8ff0\u4e2d\u540e\u53f0\u4ea7\u54c1\u6a21\u677f/\u7ec4\u4ef6/\u4e1a\u52a1\u573a\u666f\u7684\u6700\u4f73\u5b9e\u8df5\uff0c\u4e5f\u5341\u5206\u671f\u5f85\u4f60\u7684\u53c2\u4e0e\u548c\u5171\u5efa\u3002
\u73af\u5883\u642d\u5efa
Angular \u5f00\u53d1\u73af\u5883\u81f3\u5c11\u9700\u8981\u5b89\u88c5 Node.js(Node.js \u5185\u7f6e\u4e86 npm \u65e0\u987b\u5355\u72ec\u5b89\u88c5\uff0c\u4f46\u63a8\u8350\u4f7f\u7528 Yarn \u4f46\u4f60\u9700\u8981\u5355\u72ec\u989d\u5916\u5b89\u88c5\uff09\u3001VSCode\u7f16\u8f91\u5668\uff0c\u5176\u4e2d Node.js \u5efa\u8bae\u5b89\u88c5 LTS \u7248\u672c\uff0c\u5b89\u88c5\u5b8c\u6210\u540e\u53ef\u4ee5\u901a\u8fc7\u7ec8\u7aef\u7a97\u53e3\u4e2d\u8fd0\u884c\uff1a
node -v # \u67e5\u770b Node.js \u5f53\u524d\u7248\u672c\nyarn -v # \u67e5\u770b Yarn \u5f53\u524d\u7248\u672c
Yarn \u9ed8\u8ba4\u4ece\u56fd\u5916\u6e90\u6765\u4e0b\u8f7d\u5305\u4fe1\u606f\uff0c\u9274\u4e8e\u56fd\u5185\u73af\u5883\u56e0\u7d20\uff0c\u5728\u5f00\u59cb\u4e0b\u4e00\u6b65\u524d\u5148\u8bbe\u5b9a\u6dd8\u5b9d\u63d0\u4f9b\u955c\u50cf\uff1a
yarn config set registry https://registry.npmmirror.com\nyarn config set sass_binary_site https://npmmirror.com/mirrors/node-sass\n# restore\nyarn config delete registry\nyarn config delete sass_binary_site
\u4e5f\u53ef\u4ee5\u4f7f\u7528 nrm \u5305\uff0c\u53ef\u4ee5\u5feb\u901f\u5207\u6362\u4e0d\u540c\u56fd\u5185\u955c\u50cf\u6e90\u3002
\u5b89\u88c5
\u5168\u5c40 Angular Cli
\u5b89\u88c5\u4e4b\u524d\u8bf7\u5148\u786e\u4fdd\u672c\u5730\u5df2\u7ecf\u5b89\u88c5\u5168\u5c40 Angular Cli\uff0c\u53ea\u6709\u8fd9\u6837\u624d\u80fd\u968f\u65f6\u968f\u5730\u5728\u7ec8\u7aef\u4f7f\u7528 ng
\u547d\u4ee4\uff0c\u53ef\u4ee5\u901a\u8fc7\u7ec8\u7aef\u7a97\u53e3\u4e2d\u8fd0\u884c\uff1a
yarn global add @angular/cli
\u521b\u5efaNG-ALAIN\u9879\u76ee
NG-ALAIN \u5fc5\u987b\u5148\u521b\u5efa\u4e00\u4e2a\u5168\u65b0\u7684 Angular \u9879\u76ee\uff0c\u53ef\u4ee5\u901a\u8fc7\u7ec8\u7aef\u7a97\u53e3\u4e2d\u8fd0\u884c\uff1a
ng new my-project --style less --routing --package-manager yarn
\u5982\u679c\u4f60\u60f3\u4e86\u89e3 --style
\u3001--routing
\u53c2\u6570\uff0c\u8bf7\u53c2\u8003 ng new \u6587\u6863\u3002
\u63a5\u4e0b\u6765\u53ea\u9700\u8981\u5c06 NG-ALAIN \u6dfb\u52a0\u5230 my-project
\u9879\u76ee\u4e2d\u5373\u53ef\uff0c\u5728 my-project
\u76ee\u5f55\u4e0b\u901a\u8fc7\u7ec8\u7aef\u7a97\u53e3\u4e2d\u8fd0\u884c\uff1a
cd my-project\nng add ng-alain
NG-ALAIN \u4f1a\u8be2\u95ee\u662f\u5426\u9700\u8981\u4e00\u4e9b\u989d\u5916\u7684\u63d2\u4ef6\uff0c\u4e00\u5f00\u59cb\u5b8c\u5168\u53ef\u4ee5\u4e00\u8def\u56de\u8f66\uff0c\u8fd9\u4e9b\u63d2\u4ef6\u90fd\u662f\u53ef\u63d2\u62d4\uff0c\u540e\u671f\u53ef\u4ee5\u81ea\u884c\u6dfb\u52a0\u4e0e\u79fb\u9664\u3002
\u4ee5\u4e0a\u53ea\u4f1a\u751f\u6210\u5e72\u51c0\u7684\u9879\u76ee\uff0c\u53ef\u4ee5\u76f4\u63a5\u7528\u4e8e\u751f\u4ea7\u73af\u5883\u4e2d\u3002\u4f60\u53ef\u80fd\u5728\u9884\u89c8\u4e0a\u770b\u5230\u8bb8\u591a\u793a\u4f8b\u9875\uff0c\u5b83\u4eec\u5168\u90fd\u53ef\u4ee5\u5728 Github \u67e5\u770b\u5230\u6e90\u4ee3\u7801\uff0c\u5f53\u7136\u4e5f\u53ef\u4ee5\u901a\u8fc7 Git \u514b\u9686\u4ee3\u7801\u7684\u5f62\u5f0f\u83b7\u5f97\uff1a
git clone --depth=1 https://github.com/ng-alain/ng-alain.git my-project\ncd my-project\nyarn install
\u8fd0\u884c
yarn start
\u542f\u52a8\u5b8c\u6210\u540e\u4f1a\u6253\u5f00\u6d4f\u89c8\u5668\u8bbf\u95ee http://localhost:4200\uff0c\u82e5\u4f60\u770b\u5230\u5982\u4e0b\u9875\u9762\u5219\u4ee3\u8868\u6210\u529f\u4e86\u3002
\u606d\u559c\u4f60\uff0c\u4f60\u5df2\u7ecf\u6210\u529f\u90e8\u7f72\u4e00\u4e2a NG-ALAIN \u9879\u76ee\u3002
\u652f\u6301\u73af\u5883
\u53d7\u9650\u4e8e Angular\uff0c\u4e0d\u518d\u652f\u6301 IE
\u73b0\u4ee3\u6d4f\u89c8\u5668\uff0c\u6d4f\u89c8\u5668\u652f\u6301
\u652f\u6301\u670d\u52a1\u7aef\u6e32\u67d3
IE / Edge
Firefox
Chrome
Safari
Opera
ElectronEdge last 2 versions last 2 versions last 2 versions last 2 versions last 2 versions
\u5982\u4f55\u8d21\u732e
\u5728\u4efb\u4f55\u5f62\u5f0f\u7684\u53c2\u4e0e\u524d\uff0c\u8bf7\u5148\u9605\u8bfb \u8d21\u732e\u8005\u6587\u6863\u3002\u5982\u679c\u4f60\u5e0c\u671b\u53c2\u4e0e\u8d21\u732e\uff0c\u6b22\u8fce Pull Request\uff0c\u6216\u7ed9\u6211\u4eec \u62a5\u544a Bug\u3002
\u5f3a\u70c8\u63a8\u8350\u9605\u8bfb \u300a\u63d0\u95ee\u7684\u667a\u6167\u300b(\u672c\u6307\u5357\u4e0d\u63d0\u4f9b\u6b64\u9879\u76ee\u7684\u5b9e\u9645\u652f\u6301\u670d\u52a1\uff01)\u3001\u300a\u5982\u4f55\u5411\u5f00\u6e90\u793e\u533a\u63d0\u95ee\u9898\u300b \u548c \u300a\u5982\u4f55\u6709\u6548\u5730\u62a5\u544a Bug\u300b\u3001\u300a\u5982\u4f55\u5411\u5f00\u6e90\u9879\u76ee\u63d0\u4ea4\u65e0\u6cd5\u89e3\u7b54\u7684\u95ee\u9898\u300b\uff0c\u66f4\u597d\u7684\u95ee\u9898\u66f4\u5bb9\u6613\u83b7\u5f97\u5e2e\u52a9\u3002
\u793e\u533a\u4e92\u52a9
\u5982\u679c\u60a8\u5728\u4f7f\u7528\u7684\u8fc7\u7a0b\u4e2d\u78b0\u5230\u95ee\u9898\uff0c\u53ef\u4ee5\u901a\u8fc7\u4e0b\u9762\u51e0\u4e2a\u9014\u5f84\u5bfb\u6c42\u5e2e\u52a9\uff0c\u540c\u65f6\u6211\u4eec\u4e5f\u9f13\u52b1\u8d44\u6df1\u7528\u6237\u901a\u8fc7\u4e0b\u9762\u7684\u9014\u5f84\u7ed9\u65b0\u4eba\u63d0\u4f9b\u5e2e\u52a9\u3002
\u901a\u8fc7 Stack Overflow \u6216\u8005 Segment Fault \u63d0\u95ee\u65f6\uff0c\u5efa\u8bae\u52a0\u4e0a ng-alain
\u6807\u7b7e\u3002
QQ \u7fa4
\u52a0\u5165 NG-ALAIN \u81ea\u52a9\u670d\u52a1\u7fa4\uff08\u4e2d\u6587\uff09
\u6350\u52a9
\u5982\u679c\u4f60\u89c9\u5f97 NG-ALAIN \u4e0d\u9519\uff0c\u53ef\u4ee5\u8003\u8651\u81ea\u613f\u4e3a\u672c\u7ad9\u6253\u8d4f\u6216\u6350\u52a9\u3002
{var e;class o{constructor(){this.item={cols:1,urls:{"en-US":"docs/global-config.en-US.md","zh-CN":"docs/global-config.zh-CN.md"},content:{"en-US":{content:'We add support of global configuration to many components. You can define the default behavior of the component through global configuration, thus reducing the code that needs to be written in the template, and support changing global config at runtime.
How to Use?
If you want to provide default configurations to some components, you should provide an object that implements the interface AlainConfig with the injection token ALAIN_CONFIG, in the root module (in another word, to the root injector). Like this:
// global-config.module.ts\nimport { AlainConfig, ALAIN_CONFIG } from \'@delon/util/config\';\n\nconst alainConfig: AlainConfig = {\n st: { ps: 3 },\n};\n\n@NgModule({\n providers: [\n { provide: ALAIN_CONFIG, useValue: alainConfig },\n ],\n})\nexport class GlobalConfigModule {}
These global configuration would be injected into a service named AlainConfigService
and gets stored.
About NG-ZORRO
Please refer to NG-ZORRO Website Documentation
',meta:{order:90,title:{"en-US":"Global Configuration","zh-CN":"\u5168\u5c40\u914d\u7f6e\u9879"},type:"Dev"},toc:[{id:"HowtoUse",title:"How to Use?",h:2},{id:"AboutNG-ZORRO",title:"About NG-ZORRO",h:2}]},"zh-CN":{content:'\u6211\u4eec\u7ed9\u4f17\u591a\u7ec4\u4ef6\u6dfb\u52a0\u4e86\u5168\u5c40\u914d\u7f6e\u529f\u80fd\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u5168\u5c40\u914d\u7f6e\u6765\u5b9a\u4e49\u7ec4\u4ef6\u7684\u9ed8\u8ba4\u884c\u4e3a\uff0c\u4ece\u800c\u51cf\u5c11\u5728\u6a21\u677f\u4e2d\u9700\u8981\u5199\u7684\u4ee3\u7801\uff08\u8ba9\u4f60\u7684\u4ee3\u7801\u66f4\u52a0\u6e05\u723d\uff09\uff0c\u8fd8\u80fd\u5728\u8fd0\u884c\u65f6\u4fee\u6539\u5168\u5c40\u914d\u7f6e\u9879\u3002
\u5982\u4f55\u4f7f\u7528
\u60f3\u8981\u4e3a\u67d0\u4e9b\u7ec4\u4ef6\u63d0\u4f9b\u9ed8\u8ba4\u914d\u7f6e\u9879\uff0c\u8bf7\u5728\u6839\u6ce8\u5165\u5668\u4e2d\u6839\u636e\u6ce8\u5165\u4ee4\u724c ALAIN_CONFIG
\u63d0\u4f9b\u4e00\u4e2a\u7b26\u5408 AlainConfig
\u63a5\u53e3\u7684\u5bf9\u8c61\uff0c\u4f8b\u5982\uff1a
// global-config.module.ts\nimport { AlainConfig, ALAIN_CONFIG } from \'@delon/util/config\';\n\nconst alainConfig: AlainConfig = {\n st: { ps: 3 },\n};\n\n@NgModule({\n providers: [\n { provide: ALAIN_CONFIG, useValue: alainConfig },\n ],\n})\nexport class GlobalConfigModule {}
\u8fd9\u4e9b\u5168\u5c40\u914d\u7f6e\u9879\u5c06\u4f1a\u88ab\u6ce8\u5165 AlainConfigService
\u5f53\u4e2d\u5e76\u4fdd\u5b58\u3002
\u5173\u4e8e NG-ZORRO \u5168\u5c40\u914d\u7f6e\u9879
\u8bf7\u53c2\u8003 NG-ZORRO \u5b98\u7f51\u6587\u6863
',meta:{order:90,title:{"en-US":"Global Configuration","zh-CN":"\u5168\u5c40\u914d\u7f6e\u9879"},type:"Dev"},toc:[{id:"\u5982\u4f55\u4f7f\u7528",title:"\u5982\u4f55\u4f7f\u7528",h:2},{id:"\u5173\u4e8eNG-ZORRO\u5168\u5c40\u914d\u7f6e\u9879",title:"\u5173\u4e8e NG-ZORRO \u5168\u5c40\u914d\u7f6e\u9879",h:2}]}},demo:!1},this.codes=[]}}return(e=o).\u0275fac=function(t){return new(t||e)},e.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-global-config"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,i){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",i.codes)("item",i.item)},dependencies:[s.P],styles:["[_nghost-%COMP%]{display:block}"]}),o})()},{path:"graph",redirectTo:"graph/zh",pathMatch:"full"},{path:"graph/:lang",component:(()=>{var e;class o{constructor(){this.item={cols:1,urls:{"zh-CN":"docs/graph.md"},content:{"zh-CN":{content:' ',meta:{order:20,title:{"en-US":"Charts","zh-CN":"\u56fe\u8868"},type:"Advance",url:"/chart/getting-started"},toc:[]}},demo:!1},this.codes=[]}}return(e=o).\u0275fac=function(t){return new(t||e)},e.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-graph"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,i){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",i.codes)("item",i.item)},dependencies:[s.P],styles:["[_nghost-%COMP%]{display:block}"]}),o})()},{path:"how-to-start",redirectTo:"how-to-start/zh",pathMatch:"full"},{path:"how-to-start/:lang",component:(()=>{var e;class o{constructor(){this.item={cols:1,urls:{"en-US":"docs/how-to-start.en-US.md","zh-CN":"docs/how-to-start.zh-CN.md"},content:{"en-US":{content:'First, pre-order preparation
As you begin your business development on NG-ALAIN, i recommend that you first review the following documents, which is very helpful for everyone on the team.
NG-ALAIN\'s base component library comes from NG-ZORRO, so you can get a very detailed API documentation for its use on the official website. For ng components provided by -alain are obtained through the component page.
Second, the startup process
NG-ALAIN is a scaffold that can be used directly in production environments. The prerequisite for understanding these details is that you have a certain knowledge of Angular. The following documents may be helpful to you before you start:
NG-ALAIN Getting started video (YouTube\u3001Tencent video\u3001Station B\uff09
When running an app via ng serve
, a complete Angular startup process would look like this:
Trigger APP_INITIALIZER
(the scaffolding implementation is implemented in StartupService.load
) to get the application information.
Trigger service routing (src/app/routes/routes-routing.module.ts` for scaffolding)
Rendering components
1) APP_INITIALIZER
From a mid and back-office perspective, NG-ALAIN always believes that a network request is required to get some application information (eg menu data, user data, etc.) before Angular starts.startup.service.ts\uff1bIt returns a Promise
object, which always needs to be called: resolve()
to ensure that Angular starts normally.
Network requests may encounter a 403 error because the scaffolding uses the user authentication module by default and always assumes that all requests must be a valid user authorization. For more documentation see:
After obtaining the application information, you need to assign some values \u200b\u200bto the built-in services of the scaffolding, including:
Application Information
Including: application name, description, year, information can be directly injected into the SettingsService
(API) and directly in the HTML template.
this.settingService.setApp(res.app);
User Info
Including: name, avatar, email address, etc., information can be directly injected into the SettingsService
(API) and directly in the HTML template.
this.settingService.setUser(res.user);
Layout information
Including: name, avatar, email, address, etc., information can be directly injected into the SettingsService
(API) and directly in the HTML template.
// Whether to fix the top menu\nthis.settingService.setLayout(`fixed`, false);\n// Whether to collapse the right menu\nthis.settingService.setLayout(`collapsed`, false);
Menu data
NG-ALAIN takes menu from the remote and can also inject MenuService
(API) to change the menu data. Of course, it is more reasonable to perform menu assignment before Angular starts.
Menu data Make sure ensure Menu format, menu data throughout Applications, for example: page header auto navigation page-header, page title text TitleService Wait.
this.menuService.add(res.menu);
Page title
If the page title always wants to add the application name as a suffix, you can re-adjust the suffix
attribute value by injecting TitleService
(API).
// Set the suffix of the page title\nthis.titleService.suffix = res.app.name;
ACL
this.aclService.setFull(true);
It is recommended to load the ACL access control permission data before starting. For more details, please refer to Access Control List.
Globalization
It is recommended to load the internationalization package first before starting, which will ensure that the page is rendered as the target language after the project is started. See Internationalization for more details.
2) Business routing
Scaffolding top-level routing begins with routes-routing.module.ts Its structure is as follows:
const routes: Routes = [\n {\n path: \'\',\n component: LayoutDefaultComponent,\n children: [\n { path: \'\', redirectTo: \'dashboard\', pathMatch: \'full\' },\n { path: \'dashboard\', component: DashboardComponent, data: { title: \'Dashboard\' } },\n // business submodule\n // { path: \'trade\', loadChildren: \'./trade/trade.module#TradeModule\' }\n ]\n },\n // Blank layout\n {\n path: \'blank\',\n component: LayoutBlankComponent,\n children: [\n ]\n },\n // passport\n {\n path: \'passport\',\n component: LayoutPassportComponent,\n children: [\n { path: \'login\', component: UserLoginComponent },\n { path: \'register\', component: UserRegisterComponent },\n { path: \'register-result\', component: UserRegisterResultComponent }\n ]\n },\n // Single page does not wrap Layout\n { path: \'callback/:type\', component: CallbackComponent },\n { path: \'403\', component: Exception403Component },\n { path: \'404\', component: Exception404Component },\n { path: \'500\', component: Exception500Component },\n { path: \'**\', redirectTo: \'dashboard\' }\n];
Above we used the LayoutDefaultComponent
base layout in the business module. User authorization uses LayoutPassportComponent
user authorization layout and the full screen layout.
It is recommended that all submodules be loaded using a lazy module, such as the TradeModule
order module, which organizes the code structure more efficiently.
Under what circumstances do you not use lazy loading?
Angular startup from the top-level component. When a lazy module is encountered, it will initiate a script request. At this time, the dashboard or login page will be blank due to network requests, which is not good for the experience.
Routing permission control
The routing URL may be affected by the browser\'s own historical memory, so that users may access the unprivileged route. If you want a better experience, you need to configure the canActivate
option on the route. When the user has no permission, it will utomatically jump to the relevant page. see the ACL Routing Guard section for details.
IDE
A developer must first sharpen his tools if he is to do his work well, NG-ALAIN recommended to use the Visual Studio Code IDE, because ng-alain adds some extra features to VSCode to better help you. Development.
Or use the NG-ALAIN Extension Pack suite directly.
Code fragment
Class style smart reminder
ng-alain has a lot of built-in toolkit styles (API), and the following plugins can be installed directly into the HTML template.
',meta:{order:0,title:"How to start",type:"Dev",i18n:"need-update"},toc:[{id:"First,pre-orderpreparation",title:"First, pre-order preparation",h:2},{id:"Second,thestartupprocess",title:"Second, the startup process",h:2,children:[{id:"1APP_INITIALIZER",title:"1) APP_INITIALIZER",h:3},{id:"2Businessrouting",title:"2) Business routing",h:3},{id:"Underwhatcircumstancesdoyounotuselazyloading",title:"Under what circumstances do you not use lazy loading?",h:3},{id:"Routingpermissioncontrol",title:"Routing permission control",h:3}]},{id:"IDE",title:"IDE",h:2,children:[{id:"Codefragment",title:"Code fragment",h:3},{id:"Classstylesmartreminder",title:"Class style smart reminder",h:3}]}]},"zh-CN":{content:'\u524d\u5e8f\u51c6\u5907
NG-ALAIN \u6280\u672f\u6808\u57fa\u4e8e Typescript\u3001Angular\u3001\u56fe\u8868G2 \u548c NG-ZORRO\uff0c\u5728\u5f00\u59cb\u5c1d\u8bd5\u4f7f\u7528 NG-ALAIN \u811a\u624b\u67b6\u524d\uff0c\u8bf7\u5148\u63d0\u524d\u4e86\u89e3\u548c\u5b66\u4e60\u8fd9\u4e9b\u77e5\u8bc6\u4f1a\u975e\u5e38\u6709\u5e2e\u52a9\u3002\u5982\u679c\u4f60\u662f\u4e00\u540d Java \u6216 C# \u540e\u7aef\u5f00\u53d1\u4eba\u5458\uff0c\u90a3\u4e48\u606d\u559c\u4f60\uff0c\u4f60\u6240\u89c1\u5230\u7684\u4e0d\u7ba1\u662f\u7ed3\u6784\u3001\u4ee3\u7801\u3001\u5f00\u53d1\u4f53\u9a8c\u7b49\u90fd\u662f\u4f60\u6240\u60f3\u7684\u90a3\u6837\u3002\u4f46\u4e0d\u7ba1\u600e\u4e48\u6837\uff0c\u60f3\u5199\u597d Angular \u4ee3\u7801\uff0c\u4ee5\u4e0b\u8fd9\u4e9b\u6587\u7ae0\u53ca\u793e\u533a\u662f\u4f60\u5fc5\u987b\u8981\u77e5\u9053\u7684\uff1a
\u6587\u6863\u7c7b
TypeScript\u4e2d\u6587\u6587\u6863\uff0c\u867d\u7136 TypeScript \u8ddf Java\u3001C# \u8bed\u6cd5\u5f88\u50cf\uff0c\u8fd9\u662f\u8bed\u6cd5\u57fa\u7840\u9700\u8981\u8ba4\u771f\u9605\u8bfb
Angular\u4e2d\u6587\u6587\u6863\uff0c\u5efa\u8bae\u4e00\u5b9a\u8981\u82b1\u65f6\u95f4\u9605\u8bfb\u6587\u6863\u90e8\u5206\uff0c\u900f\u8fc7\u5b83\u57fa\u672c\u4e0a\u5c31\u53ef\u4ee5\u5b66\u4f1a Angular\uff1b\u540c\u65f6\uff0c\u4e5f\u662f Angular API \u63a5\u53e3\u6587\u6863
NG-ZORRO\u4e2d\u6587\u6587\u6863\uff0cNG-ZORRO \u4f5c\u4e3a NG-ALAIN \u7684\u57fa\u7840\u7ec4\u4ef6\u5e93\uff0c\u5f53\u4f60\u4e0d\u61c2\u67d0\u4e2a\u7ec4\u4ef6\u65f6\uff0c\u5b83\u5c31\u662f\u6700\u597d\u7684\u6587\u6863\uff0c\u5305\u542b\u7ec4\u4ef6\u7528\u6cd5\u53caAPI\u8bf4\u660e
NG-ALAIN\u4e2d\u6587\u6587\u6863\uff0c\u5305\u542b\u6240\u6709 @delon/*
\u7c7b\u578b\u7684\u7528\u6cd5\u53caAPI\u8bf4\u660e
G2\u56fe\u8868\u4e2d\u6587\u6587\u6863\uff0c\u5982\u679c\u9700\u8981\u56fe\u8868\u5f00\u53d1\uff0c\u5219\u8fd9\u4efd\u6587\u6863\u662f\u5fc5\u5907
\u8f85\u52a9\u7c7b
Ant Design \u6307\u5f15\u6587\u7ae0\uff0c\u5b66\u4e60 Ant Design \u7684\u8bbe\u8ba1\u7406\u5ff5\uff0c\u975e\u5e38\u503c\u5f97\u9605\u8bfb\u7684\u90e8\u5206
NG-ZORRO \u793e\u533a\u63a8\u8350\uff0c\u4e00\u4efd\u975e\u5e38\u503c\u5f97\u5b66\u4e60\u7684\u6e05\u5355
NG-ALAIN \u5165\u95e8\u89c6\u9891\uff08YouTube\u3001\u817e\u8baf\u89c6\u9891\u3001B\u7ad9\uff09
\u5199\u5728\u524d\u9762
\u5f88\u591a\u4eba\u5728\u5b66\u4e60\u4e00\u9879\u65b0\u4e1c\u897f\u65f6\uff0c\u65e0\u5916\u4e4e\u5199\u4e2a Hello World \u6216\u662f\u5199\u4e00\u4e2a Http \u8bf7\u6c42\uff0c\u7136\u540e\u6162\u6162\u5f00\u59cb\u8f90\u5c04\u6240\u9700\u8981\u7684\u6280\u672f\u77e5\u8bc6\u3002\u4e00\u4e2a HTTP \u8bf7\u6c42\u5bf9\u4e2d\u540e\u53f0\u800c\u8a00\u4fbf\u662f\u6db5\u76d6\u4e86 CURD \u4e3b\u8981\u4efb\u52a1\uff0c\u751a\u81f3\u53ef\u4ee5\u8bf490%\u65f6\u95f4\u53ca\u529f\u80fd\u90fd\u5728\u505a\u8fd9\u9879\u5de5\u4f5c\u3002\u5728\u4ecb\u7ecd\u7ae0\u8282\u4e2d\u5df2\u7ecf\u63cf\u8ff0\u521b\u5efa\u4e00\u4e2a NG-ALAIN \u9879\u76ee\u5e76\u5982\u4f55\u8fd0\u884c\u5b83\uff0c\u5982\u679c\u6b64\u65f6\u4f60\u4e5f\u60f3\u8981\u5199\u4e2a Hello World\uff0c\u90a3\u4e48\u53ea\u9700\u8981\u5229\u7528 VSCode \u6253\u5f00\u8fd9\u4e2a\u9879\u76ee\uff0c\u5e76\u5728 dashboard.component.html
\u6587\u4ef6\u5185\u8f93\u5165\u6587\u672c\uff0c500ms \u540e\u5c31\u4f1a\u5728\u9875\u9762\u4e0a\u7acb\u5373\u5448\u73b0\u3002
\u6d41\u7a0b
\u56de\u8fc7\u5934\u6765\u6211\u4eec\u8bd5\u7740\u56de\u60f3\u4e00\u4e0b\uff0c\u4e00\u4e2a\u4e2d\u540e\u53f0\u9879\u76ee\uff0c\u4ece\u542f\u52a8\u518d\u5230\u5448\u73b0\u4e00\u4efd\u8ba2\u5355\u5217\u8868\u7684\u529f\u80fd\uff0c\u5bf9\u4e8e\u5f00\u53d1\u8005\u800c\u8a00\u5305\u542b\u4e86\u54ea\u4e9b\u4e8b\u4ef6\u3002\u65e0\u5916\u4e4e\u9879\u76ee\u542f\u52a8\u65f6\u5e94\u8be5\u52a0\u8f7d\u70b9\u4ec0\u4e48\u7cfb\u7edf\u914d\u7f6e\u9879\uff0c\u54ea\u4e9b\u9875\u9762\u7528\u6237\u65e0\u6743\u8fdb\u5165\uff1b\u628a\u7c92\u5ea6\u518d\u60f3\u7ec6\u4e00\u70b9\uff0c\u540c\u4e00\u4e2a\u9875\u9762\u4e0d\u540c\u7684\u6309\u94ae\u7ed9\u4e0d\u540c\u7684\u4eba\u7528\uff0cHTTP\u8bf7\u6c42\u82e5\u4ea7\u751f\u9519\u8bef\u662f\u4e0d\u662f\u5f97\u6bcf\u6b21\u90fd\u5199\u76f8\u540c\u7684\u5904\u7406\u4ee3\u7801\u7b49\u7b49\u3002
\u521d\u59cb\u5316\u9879\u76ee\u6570\u636e
Angular \u63d0\u4f9b\u4e00\u4e2aDI\uff08\u4f9d\u8d56\u6ce8\u5165\uff09\u4ee4\u724c APP_INITIALIZER
\u8ba9\u5e94\u7528\u542f\u52a8\u65f6\u53ef\u4ee5\u505a\u4e00\u4e9b\u4f1a\u5f71\u54cd\u6e32\u67d3\u7ed3\u679c\u7684\u6570\u636e\uff0c\u6bd4\u5982\uff1a\u8bed\u8a00\u6570\u636e\u3001\u83dc\u5355\u6570\u636e\u3001\u7528\u6237\u4fe1\u606f\u6570\u636e\u3001\u5b57\u5178\u6570\u636e\u7b49\uff0c\u5e76\u4e14\u5fc5\u987b\u8fd4\u56de\u4e00\u4e2a Promise
\u5f02\u6b65\u51fd\u6570\uff0c\u5f02\u6b65\u610f\u5473\u8005\u53ef\u4ee5\u505a\u5f88\u591a\u6709\u8da3\u7684\u4e8b\uff0c\u6bd4\u5982\u6570\u636e\u6765\u81ea\u8fdc\u7a0b\u3002APP_INITIALIZER
\u53ea\u4f1a\u6267\u884c\u4e00\u6b21\uff0c\u53ea\u9700\u8981\u5728 AppModule
\u6a21\u5757\u6ce8\u518c\u5b83\u5c31\u884c\u4e86\u3002
export function StartupServiceFactory(startupService: StartupService): () => Promise {\n return () => startupService.load();\n}\n\n@NgModule({\n declarations: [AppComponent],\n imports: [BrowserModule]\n providers: [{\n StartupService,\n {\n provide: APP_INITIALIZER,\n useFactory: StartupServiceFactory,\n deps: [StartupService],\n multi: true,\n },\n }],\n bootstrap: [AppComponent],\n})\nexport class AppModule {}
\u800c StartupService
\u5982\u4e0b\uff1a
@Injectable()\nexport class StartupService {\n constructor(private httpClient: HttpClient) {}\n\n load(): Promise { \n return new Promise((resolve) => {\n this.httpClient.get(``).subscribe(() => {\n resolve();\n });\n });\n }\n}
\u54ea\u6015 Http \u8bf7\u6c42\u5931\u8d25\uff0c\u8fd9\u91cc\u4e5f\u5fc5\u987b\u6267\u884c resolve()
\uff0c\u5426\u5219\u5e94\u7528\u5c31\u65e0\u6cd5\u542f\u52a8\u3002\u800c NG-ALAIN \u63d0\u4f9b\u7684 startup.service.ts \u5185\u5bb9\u66f4\u52a0\u4e30\u5bcc\u4e00\u70b9\uff0c\u5bf9\u4e8e\u5b8c\u6574\u7684\u4e2d\u540e\u53f0\u800c\u8a00\uff0c\u5927\u591a\u6570\u9879\u76ee\u4e2d\u4ee5\u4e0b\u8fd9\u4e9b\u4fe1\u606f\u90fd\u53ef\u4ee5\u5fc5\u5907\u7684\uff1a
\u6570\u636e\u7c7b\u578b \u63cf\u8ff0 \u5e94\u7528\u4fe1\u606f \u5e94\u7528\u540d\u79f0\u3001\u63cf\u8ff0\u3001\u5e74\u4efd\uff0c\u4fe1\u606f\u53ef\u4ee5\u76f4\u63a5\u6ce8\u5165 SettingsService
\uff08API\uff09\u540e\u76f4\u63a5\u5728HTML\u6a21\u677f\u4e2d\u8bbf\u95ee\u3002
\u4f8b\u5982\uff1athis.settingService.setApp(res.app);
\u7528\u6237\u4fe1\u606f \u5f53\u524d\u7528\u6237\u7684\u59d3\u540d\u3001\u5934\u50cf\u3001\u90ae\u7bb1\u5730\u5740\u7b49\uff0c\u4fe1\u606f\u53ef\u4ee5\u76f4\u63a5\u6ce8\u5165 SettingsService
\uff08API\uff09\u540e\u76f4\u63a5\u5728HTML\u6a21\u677f\u4e2d\u8bbf\u95ee\u3002
\u4f8b\u5982\uff1athis.settingService.setUser(res.user);
\u5e03\u5c40\u4fe1\u606f \u8c03\u6574\u4e3b\u9898\u914d\u7f6e\uff0c\u4f8b\u5982\uff1a\u56fa\u5b9a\u9876\u90e8\u83dc\u5355\u3001\u6298\u53e0\u83dc\u5355\u7b49\u3002
\u4f8b\u5982\uff1athis.settingService.setLayout("fixed", false);
\u6216 this.settingService.setLayout("collapsed", false);
\u83dc\u5355\u6570\u636e NG-ALAIN \u8ba4\u4e3a\u83dc\u5355\u6570\u636e\u4e5f\u662f\u6765\u81ea\u8fdc\u7a0b\uff0c\u4e5f\u53ef\u4ee5\u4efb\u610f\u4f4d\u7f6e\u6ce8\u5165 MenuService
\uff08API\uff09\u6765\u6539\u53d8\u83dc\u5355\u6570\u636e\uff0c\u5f53\u7136\u5728 Angular \u542f\u52a8\u4e4b\u524d\u6267\u884c\u83dc\u5355\u8d4b\u503c\u66f4\u4e3a\u5408\u7406\u3002
\u83dc\u5355\u6570\u636e\u52a1\u5fc5\u786e\u4fdd Menu \u683c\u5f0f\uff0c\u83dc\u5355\u6570\u636e\u8d2f\u7a7f\u6574\u4e2a\u5e94\u7528\uff0c\u4f8b\u5982\uff1a\u9875\u5934\u81ea\u52a8\u5bfc\u822a page-header\uff0c\u9875\u6807\u9898\u6587\u672c TitleService \u7b49\u3002
\u4f8b\u5982\uff1athis.menuService.add(res.menu);
\u9875\u9762\u6807\u9898 \u82e5\u9875\u9762\u6807\u9898\u603b\u5e0c\u671b\u52a0\u4e0a\u5e94\u7528\u540d\u79f0\u4e3a\u540e\u7f00\u65f6\uff0c\u53ef\u4ee5\u6ce8\u5165 TitleService
\uff08API\uff09\u91cd\u65b0\u8c03\u6574 suffix
\u5c5e\u6027\u503c\u3002
\u4f8b\u5982\u8bbe\u7f6e\u9875\u9762\u6807\u9898\u7684\u540e\u7f00\uff1athis.titleService.suffix = res.app.name;
ACL \u8bbf\u95ee\u63a7\u5236\u5217\u8868\u6570\u636e\uff0c\u5efa\u8bae\u5728\u542f\u52a8\u524d\u52a0\u8f7dACL\u8bbf\u95ee\u63a7\u5236\u6743\u9650\u6570\u636e\uff0c\u6709\u5173\u66f4\u591a\u7ec6\u8282\u53ef\u53c2\u8003 \u8bbf\u95ee\u63a7\u5236\u5217\u8868\u3002
\u4f8b\u5982\u8bbe\u7f6e\u5168\u91cf\u6743\u9650\uff1athis.aclService.setFull(true);
\u56fd\u9645\u5316 \u5efa\u8bae\u5728\u542f\u52a8\u524d\u4f18\u5148\u52a0\u8f7d\u56fd\u9645\u5316\u6570\u636e\u5305\uff0c\u8fd9\u6837\u53ef\u786e\u4fdd\u9879\u76ee\u542f\u52a8\u540e\u9875\u9762\u6e32\u67d3\u4e3a\u76ee\u6807\u8bed\u8a00\u3002\u66f4\u591a\u7ec6\u8282\u53c2\u8003\u56fd\u9645\u5316\u3002
\u4e1a\u52a1\u8def\u7531
\u5f53 Angular \u9879\u76ee\u6b63\u5f0f\u542f\u52a8\u540e\u4f1a\u8fdb\u5165\u6e32\u67d3\u52a8\u4f5c\uff0c\u6839\u636e\u5f53\u524d\u7684\u8def\u7531\u5730\u5740\u6765\u51b3\u5b9a\u4e00\u4e2a\u9875\u9762\u5982\u4f55\u6e32\u67d3\uff0c\u4ece\u6700\u9876\u5c42\u8def\u7531 routes-routing.module.ts \u5f00\u59cb\u4e00\u5c42\u5c42\u5bfb\u627e\uff0c\u5176\u7ed3\u6784\u5982\u4e0b\uff1a
const routes: Routes = [\n {\n path: \'\',\n component: LayoutBasicComponent,\n children: [\n { path: \'\', redirectTo: \'dashboard\', pathMatch: \'full\' },\n { path: \'dashboard\', component: DashboardComponent, data: { title: \'\u4eea\u8868\u76d8\' } },\n // \u4e1a\u52a1\u5b50\u6a21\u5757\n // { path: \'trade\', loadChildren: \'./trade/trade.module#TradeModule\' }\n ]\n },\n // \u7a7a\u767d\u5e03\u5c40\n {\n path: \'blank\',\n component: LayoutBlankComponent,\n children: [\n ]\n },\n // passport\n {\n path: \'passport\',\n component: LayoutPassportComponent,\n children: [\n { path: \'login\', component: UserLoginComponent },\n ]\n },\n // \u5355\u9875\u4e0d\u5305\u88f9Layout\n { path: \'passport/callback/:type\', component: CallbackComponent },\n { path: \'exception\', loadChildren: () => import(\'./exception/exception.module\').then((m) => m.ExceptionModule) },\n // \u672a\u547d\u4e2d\u8def\u7531\u5168\u90e8\u8df3\u8f6c\u81f3 `exception/404` \u9875\u9762\u4e0a\n { path: \'**\', redirectTo: \'exception/404\' },\n];
\u4e0a\u8ff0\u5728\u4e1a\u52a1\u6a21\u5757\u4e2d\u4f7f\u7528\u4e86 LayoutBasicComponent
\u57fa\u7840\u5e03\u5c40\u3001\u7528\u6237\u6388\u6743\u4f7f\u7528\u4e86 LayoutPassportComponent
\u7528\u6237\u6388\u6743\u5e03\u5c40\u4ee5\u53ca LayoutBlankComponent
\u7a7a\u767d\u5e03\u5c40\uff0c\u4ee5\u4e0a\u4e09\u79cd\u5e03\u5c40\u90fd\u53ef\u4ee5\u5728 layout \u76ee\u5f55\u4e0b\u627e\u5f97\u5230\u3002
\u4f8b\u5982\u5f53\u7528\u6237\u8bbf\u95ee /dashboard
\u8def\u7531\u65f6\uff0c\u4f1a\u5148\u7ecf\u8fc7 LayoutBasicComponent
-> DashboardComponent
\uff0c\u6700\u7ec8\u6362\u5f62\u6210\u4e00\u4e2a\u5e9e\u5927\u7684\u7ec4\u4ef6\u6811\u6765\u8868\u793a\u4e00\u4e2a\u5177\u4f53\u7684\u9875\u9762\u3002NG-ALAIN \u811a\u624b\u67b6\u5e2e\u52a9\u4f60\u5b8c\u6210\u5927\u591a\u6570\u5de5\u4f5c\uff0c\u800c\u4e00\u4e2a\u65b0\u5165\u95e8\u7684\u4eba\u66f4\u591a\u53ea\u9700\u8981\u5173\u5fc3 DashboardComponent
\u4e1a\u52a1\u7ec4\u4ef6\u8be5\u5982\u4f55\u5b9e\u73b0\u3002
\u4ec0\u4e48\u60c5\u51b5\u4e0b\u4e0d\u4f7f\u7528\u61d2\u52a0\u8f7d\uff1f
Angular \u542f\u52a8\u662f\u4ece\u9876\u5c42\u7ec4\u4ef6\u5f00\u59cb\u5411\u4e0b\u6e32\u67d3\uff0c\u5f53\u9047\u5230\u61d2\u6a21\u5757\u65f6\u4f1a\u5148\u53d1\u8d77\u811a\u672c\u8bf7\u6c42\uff0c\u6b64\u65f6\u4f1a\u56e0\u4e3a\u7f51\u7edc\u8bf7\u6c42\u5bfc\u81f4\u4eea\u8868\u76d8\u6216\u767b\u5f55\u9875\u77ed\u6682\u7684\u7a7a\u767d\uff0c\u8fd9\u5bf9\u4f53\u9a8c\u5e76\u4e0d\u597d\u3002
\u7528\u6237\u8ba4\u8bc1\u4e0e\u6388\u6743
\u9875\u9762\u80fd\u5426\u8bbf\u95ee\u53d6\u51b3\u4e8e\u7528\u6237\u662f\u5426\u767b\u5f55\u3001\u5df2\u7ecf\u767b\u5f55\u8fd8\u5f97\u5224\u65ad\u5426\u6709\u6388\u6743\uff0c\u800c\u8fd9\u4e24\u9879\u5de5\u4f5c\u5206\u522b\u4ea4\u7ed9 @delon/auth
\u4e0e @delon/acl
\u6765\u5b8c\u6210\u3002
\u7528\u6237\u8ba4\u8bc1
\u9996\u5148\u7528\u6237\u8bbf\u95ee\u9875\u9762\u65f6\u662f\u7531\u9876\u5c42\u8def\u7531\u5f00\u59cb\u5bfb\u627e\u547d\u4e2d\u540e\u8fdb\u884c\u6e32\u67d3\uff0c\u8981\u60f3\u8ba9\u6240\u6709\u672a\u767b\u5f55\u7528\u6237\u8df3\u8f6c\u5230\u767b\u5f55\u9875\u9762\uff0c\u53ef\u4ee5\u914d\u7f6e canActivate
\u9009\u9879\uff0c@delon/auth
\u5df2\u7ecf\u63d0\u4f9b\u4e86\u5177\u4f53\u7684\u5b9e\u73b0\uff0c\u4f8b\u5982\uff1a
const routes: Routes = [\n {\n path: \'\',\n component: LayoutBasicComponent,\n canActivate: [authSimpleCanActivate],\n children: [\n { path: \'\', redirectTo: \'dashboard\', pathMatch: \'full\' },\n { path: \'dashboard\', component: DashboardComponent, data: { title: \'\u4eea\u8868\u76d8\' } },\n ]\n },\n];
\u8fd9\u91cc\u7684 authSimpleCanActivate
\u662f\u56e0\u4e3a\u91c7\u7528\u57fa\u4e8e Simple Web Token \u8ba4\u8bc1\u98ce\u683c\uff0c\u5176\u4ed6\u8ba4\u8bc1\u65b9\u5f0f\u8bf7\u53c2\u8003\u7528\u6237\u8ba4\u8bc1\u7ae0\u8282\u3002
\u5f53\u7528\u6237\u672a\u767b\u5f55\u65f6\u4f1a\u76f4\u63a5\u8df3\u8f6c\u81f3 /passport/login
\u9875\u9762\uff0c\u5982\u679c\u91c7\u7528\u7684\u662f JWT \u8ba4\u8bc1\u65b9\u5f0f\uff0c\u8fd8\u4f1a\u5bf9 Token \u662f\u5426\u6709\u6548\u8fdb\u884c\u68c0\u9a8c\u3002
\u7528\u6237\u6388\u6743
\u63a5\u8005\u7528\u6237\u8bbf\u95ee\u7684\u9875\u9762\u8fd8\u9700\u8981\u53d6\u51b3\u4e8e\u6388\u6743\u7a0b\u5ea6\uff0c\u4f8b\u5982\u7cfb\u7edf\u914d\u7f6e\u9875\u666e\u901a\u7528\u6237\u80af\u5b9a\u65e0\u6cd5\u8fdb\u5165\u3002\u5728\u521d\u59cb\u5316\u9879\u76ee\u6570\u636e\u5c0f\u8282\u91cc\u4f1a\u6839\u636e\u5f53\u524d\u7528\u6237\u7684 Token \u6765\u83b7\u5f97\u6388\u6743\u7684\u6570\u636e\uff0c\u5e76\u5c06\u6570\u636e\u4ea4\u7ed9 @delon/acl
\uff0c\u540c\u65f6\u5b83\u4e5f\u63d0\u4f9b\u4e00\u7ec4\u8def\u7531\u5b88\u536b\u7684\u5177\u4f53\u5b9e\u73b0 aclCanActivate
\u65b9\u6cd5\uff0c\u4f8b\u5982\u5e0c\u671b\u6574\u4e2a\u7cfb\u7edf\u914d\u7f6e\u6a21\u5757\u90fd\u5fc5\u987b\u662f admin
\u89d2\u8272\u624d\u80fd\u8bbf\u95ee\uff0c\u5219\uff1a
const routes: Routes = [\n {\n path: \'sys\',\n canActivate: [aclCanActivate],\n data: { guard: \'admin\' },\n children: [\n { path: \'config\', component: ConfigComponent },\n ]\n },\n];
\u6b64\u65f6\uff0c\u5f53\u4e00\u4e2a\u672a\u6388\u6743 admin
\u89d2\u8272\u7684\u7528\u6237\u5c1d\u8bd5\u8bbf\u95ee /sys/config
\u9875\u9762\u65f6\u4f1a\u88ab\u8df3\u8f6c\u81f3\u672a\u6388\u6743\u9519\u8bef\u9875\u4e0a\u3002
\u5f53\u7136\u8fd8\u652f\u6301\u7c92\u5ea6\u6709\u66f4\u7ec6\u64cd\u4f5c\uff0c\u6bd4\u5982\u67d0\u4e2a\u6309\u94ae\uff0c\u8bf7\u53c2\u8003ACL\u7ae0\u8282\u3002
\u62e6\u622a\u7f51\u7edc\u8bf7\u6c42
\u7f51\u7edc\u8bf7\u6c42\u662f\u4e00\u9879\u975e\u5e38\u9891\u7e41\u7684\u5de5\u4f5c\uff0c\u5982\u679c\u60f3\u4f18\u96c5\u7684\u5728\u4e1a\u52a1\u7ec4\u4ef6\u5185\u4f7f\u7528\u7f51\u7edc\u8bf7\u6c42\u52a8\u4f5c\u7684\u8bdd\uff0c\u90a3\u4e48\u5c06\u670d\u52a1\u7aefURL\u524d\u7f00\u3001\u5f02\u5e38\u5904\u7406\u3001Token \u5237\u65b0\u7b49\u64cd\u4f5c\u96c6\u4e2d\u5904\u7406\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684\uff0cNG-ALAIN \u811a\u624b\u67b6\u63d0\u4f9b\u4e00\u4e2a default.interceptor.ts \u6587\u4ef6\u3002\u5b83\u4f1a\u5229\u7528\u4ee4\u724c HTTP_INTERCEPTORS
\u8d77\u5230\u4e00\u79cd\u62e6\u622a\u5668\u7684\u6548\u679c\u3002
\u6709\u5173\u4ee5\u4e0a\u96c6\u4e2d\u5904\u7406\u7684\u52a8\u4f5c\u7ec6\u8282\uff0c\u8bf7\u53c2\u8003 default.interceptor.ts \u6587\u4ef6\u3002
IDE
\u201c\u5de5\u6b32\u5584\u5176\u4e8b\uff0c\u5fc5\u5148\u5229\u5176\u5668\u662f\u201d\uff0cNG-ALAIN \u811a\u624b\u67b6\u63a8\u8350\u4f7f\u7528 Visual Studio Code IDE\uff0c\u56e0\u4e3a NG-ALAIN \u9488\u5bf9 VSCode \u589e\u52a0\u4e00\u4e9b\u989d\u5916\u7684\u7279\u6027\uff0c\u53ef\u4ee5\u66f4\u597d\u7684\u5e2e\u52a9\u4f60\u5f00\u53d1\u3002
\u6216\u8005\u76f4\u63a5\u4f7f\u7528 NG-ALAIN Extension Pack \u5957\u4ef6\u3002
\u4ee3\u7801\u7247\u65ad
Class\u6837\u5f0f\u667a\u80fd\u63d0\u9192
ng-alain \u5185\u7f6e\u4e86\u5927\u91cf\u7684\u5de5\u5177\u96c6\u6837\u5f0f\uff08API\uff09\uff0c\u5b89\u88c5\u4ee5\u4e0b\u63d2\u4ef6\u53ef\u4ee5\u76f4\u63a5\u5728HTML\u6a21\u677f\u91cc\u76f4\u63a5\u8bbf\u95ee\u5230\u5b83\u4eec\u3002
',meta:{order:0,title:"\u5982\u4f55\u5f00\u59cb",type:"Dev",i18n:"need-update"},toc:[{id:"\u524d\u5e8f\u51c6\u5907",title:"\u524d\u5e8f\u51c6\u5907",h:2},{id:"\u5199\u5728\u524d\u9762",title:"\u5199\u5728\u524d\u9762",h:2},{id:"\u6d41\u7a0b",title:"\u6d41\u7a0b",h:2,children:[{id:"\u521d\u59cb\u5316\u9879\u76ee\u6570\u636e",title:"\u521d\u59cb\u5316\u9879\u76ee\u6570\u636e",h:3},{id:"\u4e1a\u52a1\u8def\u7531",title:"\u4e1a\u52a1\u8def\u7531",h:3},{id:"\u7528\u6237\u8ba4\u8bc1\u4e0e\u6388\u6743",title:"\u7528\u6237\u8ba4\u8bc1\u4e0e\u6388\u6743",h:3},{id:"\u62e6\u622a\u7f51\u7edc\u8bf7\u6c42",title:"\u62e6\u622a\u7f51\u7edc\u8bf7\u6c42",h:3}]},{id:"IDE",title:"IDE",h:2,children:[{id:"\u4ee3\u7801\u7247\u65ad",title:"\u4ee3\u7801\u7247\u65ad",h:3},{id:"Class\u6837\u5f0f\u667a\u80fd\u63d0\u9192",title:"Class\u6837\u5f0f\u667a\u80fd\u63d0\u9192",h:3}]}]}},demo:!1},this.codes=[]}}return(e=o).\u0275fac=function(t){return new(t||e)},e.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-how-to-start"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,i){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",i.codes)("item",i.item)},dependencies:[s.P],styles:["[_nghost-%COMP%]{display:block}"]}),o})()},{path:"i18n",redirectTo:"i18n/zh",pathMatch:"full"},{path:"i18n/:lang",component:(()=>{var e;class o{constructor(){this.item={cols:1,urls:{"en-US":"docs/i18n.en-US.md","zh-CN":"docs/i18n.zh-CN.md"},content:{"en-US":{content:'Angular internationalization provides a solution for extracting language files, but for NG-ALAIN, this is not the best way; this is mainly limited by @Delon/* The component library needs to provide a set of dynamic translation Service, therefore, NG-ALAIN has built-in a simple internationalized service ALAIN_I18N_TOKEN
interface.
How to configure
Scaffolding is composed of two important parts: ng-zorro-antd
and @delon/*
. These two libraries have their own international configuration. When internationalizing, they need to be the same for these libraries. Language configuration.
Angular
Angular configuration is mainly for currency, date format, etc., such as Chinese version:
import { registerLocaleData } from \'@angular/common\';\nimport zh from \'@angular/common/locales/zh\';\nregisterLocaleData(zh);
ng-zorro-antd
ng-zorro-antd
internationalization defaults to the Chinese version, for example the default English version:
import { NZ_I18N, en_US } from \'ng-zorro-antd/i18n\';\n@NgModule({\n ...\n imports : [ NgZorroAntdModule ],\n providers : [ { provide: NZ_I18N, useValue: en_US } ]\n})\nexport class AppModule { }
Of course, you can also use runtime changes:
import { en_US, NzI18nService } from \'ng-zorro-antd/i18n\';\n...\nconstructor(private nzI18nService:NzI18nService) {\n}\n\nswitchLanguage() {\n this.nzI18nService.setLocale(en_US);\n}
@delon
@delon internationalization defaults to Chinese version, for example the default is English version:
import { DELON_LOCALE, en_US } from \'@delon/theme\';\n@NgModule({\n ...\n providers : [ { provide: DELON_LOCALE, useValue: en_US } ]\n})\nexport class AppModule { }
Of course, you can also use runtime changes:
import { en_US, DelonLocaleService } from \'@delon/theme\';\n...\nconstructor(private delonLocaleService: DelonLocaleService) {\n}\n\nswitchLanguage() {\n this.delonLocaleService.setLocale(en_US);\n}
ALAIN_I18N_TOKEN
@delon/*
class library has many data interface properties with the i18n typeface (for example: page-header
, st
column description, Menu
menu data, etc.) when you want the data for these components. When the interface can dynamically switch automatically according to the Key value in the current language, you also need to define a self-implementation service interface for ALAIN_I18N_TOKEN
(for example: I18NService /master/src/app/core/i18n/i18n.service.ts)) and register under the root module.
import { ALAIN_I18N_TOKEN } from \'@delon/theme\';\nimport { I18NService } from \'@core\';\n\n@NgModule({\n ...\n providers: [\n { provide: ALAIN_I18N_TOKEN, useClass: I18NService, multi: false }\n ]\n})\nexport class AppModule {}
i18n pipe
In order not to be named by the third-party pipes, the scaffolding contains a i18n
pipe, which is equivalent to calling the fanAIN
method of ALAIN_I18N_TOKEN
directly.
| i18n
will not listen to language change notifications, so there will be better performance. When you explicitly re-render the Angular project after switching languages, | i18n
will be more suitable.
How to add
When creating scaffolding from command line ng add ng-alain
, it is allowed to specify --i18n
to indicate whether the internationalized sample code is included.
How to delete
The sample code covers the following:
src/app/core/i18n
directory
Replace the pipe of i18n that may appear in the default layout using | i18n
Default language
Regardless of whether internationalization is required or not, since the default languages \u200b\u200bof class libraries such as Angular
, ng-zorro-antd
, @delon/*
are different, it is also necessary to ensure that the default language of these libraries is the same type. A simple example approach to understand the current language situation for each type of library:
import { Component } from \'@angular/core\';\n\n@Component({\n selector: \'app-i18n-test\',\n template: `\n <h2>angular</h2>\n <p>Date: {{now | date}}</p>\n <h2>ng-zorro-antd</h2>\n <nz-transfer [nzDataSource]="[]"></nz-transfer>\n <h2>@delon</h2>\n <div style="width: 200px">\n <tag-select>\n <nz-tag>1</nz-tag>\n </tag-select>\n </div>`,\n})\nexport class I18nTestComponent {\n now = new Date();\n}
Example
In order to make language uniformity, NG-ALAIN provides a simple unified configuration in the AppModule
root module.
Chinese Version
// #region i18n\nimport { default as ngLang } from \'@angular/common/locales/zh\';\nimport { NZ_I18N, zh_CN as zorroLang } from \'ng-zorro-antd/i18n\';\nimport { DELON_LOCALE, zh_CN as delonLang } from \'@delon/theme\';\nconst LANG = {\n abbr: \'zh\',\n ng: ngLang,\n zorro: zorroLang,\n delon: delonLang,\n};\n// register angular\nimport { registerLocaleData } from \'@angular/common\';\nregisterLocaleData(LANG.ng, LANG.abbr);\nconst LANG_PROVIDES = [\n { provide: LOCALE_ID, useValue: LANG.abbr },\n { provide: NZ_I18N, useValue: LANG.zorro },\n { provide: DELON_LOCALE, useValue: LANG.delon },\n];\n// #endregion\n\n@NgModule({\n providers: [...LANG_PROVIDES],\n})\nexport class AppModule {}
English version
// #region i18n\nimport { default as ngLang } from \'@angular/common/locales/en\';\nimport { NZ_I18N, en_US as zorroLang } from \'ng-zorro-antd/i18n\';\nimport { DELON_LOCALE, en_US as delonLang } from \'@delon/theme\';\nconst LANG = {\n abbr: \'en\',\n ng: ngLang,\n zorro: zorroLang,\n delon: delonLang,\n};\n// register angular\nimport { registerLocaleData } from \'@angular/common\';\nregisterLocaleData(LANG.ng, LANG.abbr);\nconst LANG_PROVIDES = [\n { provide: LOCALE_ID, useValue: LANG.abbr },\n { provide: NZ_I18N, useValue: LANG.zorro },\n { provide: DELON_LOCALE, useValue: LANG.delon },\n];\n// #endregion\n\n@NgModule({\n providers: [...LANG_PROVIDES],\n})\nexport class AppModule {}
Command Line
Use the defaultLanguage plugin to quickly switch between the default locales.
Internationalized routing
If you want to toggle internationalization by routed URLs, e.g. by accessing /zh
and /en
to change the language, just use the alainI18nCanActivate
guard in the root route:
const routes: Route[] = [\n {\n path: \'\',\n component: LayoutComponent,\n canActivateChild: [alainI18nCanActivate],\n children: [\n { path: \'\', redirectTo: \'en\', pathMatch: \'full\' },\n { path: \':i18n\', component: HomeComponent }\n ]\n }\n];
Where :i18n
is a fixed value of the parameter, which can be adjusted by the Global Configuration paramNameOfUrlGuard
.
',meta:{order:30,title:{"en-US":"I18n","zh-CN":"\u56fd\u9645\u5316"},type:"Advance"},toc:[{id:"Howtoconfigure",title:"How to configure",h:2,children:[{id:"Angular",title:"Angular",h:3},{id:"ng-zorro-antd",title:"ng-zorro-antd",h:3},{id:"@delon",title:"@delon",h:3}]},{id:"ALAIN_I18N_TOKEN",title:"ALAIN_I18N_TOKEN",h:2,children:[{id:"i18npipe",title:"i18n pipe",h:3}]},{id:"Howtoadd",title:"How to add",h:2},{id:"Howtodelete",title:"How to delete",h:2},{id:"Defaultlanguage",title:"Default language",h:2,children:[{id:"Example",title:"Example",h:3},{id:"CommandLine",title:"Command Line",h:3}]},{id:"Internationalizedrouting",title:"Internationalized routing",h:2}]},"zh-CN":{content:'Angular \u56fd\u9645\u5316\u63d0\u4f9b\u4e00\u79cd\u53ef\u88ab\u63d0\u53d6\u8bed\u8a00\u6587\u4ef6\u7684\u65b9\u6848\uff0c\u4f46\u5bf9\u4e8e NG-ALAIN \u800c\u8a00\uff0c\u8fd9\u5e76\u4e0d\u662f\u6700\u597d\u7684\u65b9\u5f0f\uff1b\u8fd9\u4e3b\u8981\u53d7\u9650\u4e8e @Delon/* \u7ec4\u4ef6\u5e93\u9700\u8981\u63d0\u4f9b\u4e00\u5957\u5e26\u6709\u52a8\u6001\u7ffb\u8bd1\u7684\u670d\u52a1\uff0c\u56e0\u6b64\uff0cNG-ALAIN \u5185\u7f6e\u4e00\u4e2a\u7b80\u6613\u7684\u56fd\u9645\u5316\u670d\u52a1 ALAIN_I18N_TOKEN
\u63a5\u53e3\u3002
\u5982\u4f55\u914d\u7f6e
\u811a\u624b\u67b6\u662f\u7531 ng-zorro-antd
\u3001@delon/*
\u7c7b\u5e93\u4e24\u4e2a\u91cd\u8981\u90e8\u5206\u7ec4\u4ef6\uff0c\u800c\u8fd9\u4e24\u4e2a\u7c7b\u5e93\u6709\u81ea\u5df1\u7684\u56fd\u9645\u5316\u914d\u7f6e\uff0c\u5f53\u8fdb\u884c\u56fd\u9645\u5316\u65f6\u9700\u8981\u5bf9\u8fd9\u4e9b\u7c7b\u5e93\u8fdb\u884c\u76f8\u540c\u8bed\u8a00\u7684\u914d\u7f6e\u3002
Angular
Angular \u914d\u7f6e\u4e3b\u8981\u662f\u9488\u5bf9\u8d27\u5e01\u3001\u65e5\u671f\u683c\u5f0f\u7b49\uff0c\u4f8b\u5982\u4e2d\u6587\u7248\u672c\uff1a
import { registerLocaleData } from \'@angular/common\';\nimport zh from \'@angular/common/locales/zh\';\nregisterLocaleData(zh);
ng-zorro-antd
NG-ZORRO \u56fd\u9645\u5316\u9ed8\u8ba4\u662f\u4e2d\u6587\u7248\uff0c\u4f8b\u5982\u9ed8\u8ba4\u4e3a\u82f1\u6587\u7248\u672c\uff1a
import { NZ_I18N, en_US } from \'ng-zorro-antd/i18n\';\n@NgModule({\n ...\n imports : [ NgZorroAntdModule ],\n providers : [ { provide: NZ_I18N, useValue: en_US } ]\n})\nexport class AppModule { }
\u5f53\u7136\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528\u8fd0\u884c\u65f6\u66f4\u6539\uff1a
import { en_US, NzI18nService } from \'ng-zorro-antd/i18n\';\n...\nconstructor(private nzI18nService:NzI18nService) {\n}\n\nswitchLanguage() {\n this.nzI18nService.setLocale(en_US);\n}
@delon
@delon \u56fd\u9645\u5316\u9ed8\u8ba4\u662f\u4e2d\u6587\u7248\uff0c\u4f8b\u5982\u9ed8\u8ba4\u4e3a\u82f1\u6587\u7248\u672c\uff1a
import { DELON_LOCALE, en_US } from \'@delon/theme\';\n@NgModule({\n ...\n providers : [ { provide: DELON_LOCALE, useValue: en_US } ]\n})\nexport class AppModule { }
\u5f53\u7136\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528\u8fd0\u884c\u65f6\u66f4\u6539\uff1a
import { en_US, DelonLocaleService } from \'@delon/theme\';\n...\nconstructor(private delonLocaleService: DelonLocaleService) {\n}\n\nswitchLanguage() {\n this.delonLocaleService.setLocale(en_US);\n}
ALAIN_I18N_TOKEN
@delon/*
\u7c7b\u5e93\u6709\u8bb8\u591a\u5e26\u6709 i18n \u5b57\u6837\u7684\u6570\u636e\u63a5\u53e3\u5c5e\u6027\uff08\u4f8b\u5982\uff1apage-header
\u3001st
\u5217\u63cf\u8ff0\u3001Menu
\u83dc\u5355\u6570\u636e\u7b49\u7b49\uff09\uff0c\u5f53\u4f60\u5e0c\u671b\u8fd9\u4e9b\u7ec4\u4ef6\u7684\u6570\u636e\u63a5\u53e3\u80fd\u52a8\u6001\u6839\u636e Key \u503c\u6309\u5f53\u524d\u8bed\u8a00\u81ea\u52a8\u5207\u6362\u65f6\uff0c\u4f60\u8fd8\u9700\u8981\u5bf9 ALAIN_I18N_TOKEN
\u5b9a\u4e49\u4e00\u4e2a\u81ea\u5b9e\u73b0\u670d\u52a1\u63a5\u53e3\uff08\u4f8b\u5982\uff1aI18NService\uff09\uff0c\u5e76\u5728\u6839\u6a21\u5757\u4e0b\u6ce8\u518c\u3002
import { ALAIN_I18N_TOKEN } from \'@delon/theme\';\nimport { I18NService } from \'@core\';\n\n@NgModule({\n ...\n providers: [\n { provide: ALAIN_I18N_TOKEN, useClass: I18NService, multi: false }\n ]\n})\nexport class AppModule {}
i18n\u7ba1\u9053
\u4e3a\u4e86\u4e0d\u53d7\u7b2c\u4e09\u65b9\u5404\u81ea\u7ba1\u9053\u7684\u547d\u540d\u65b9\u5f0f\uff0c\u811a\u624b\u67b6\u5305\u542b\u4e00\u4e2a i18n
\u7684\u7ba1\u9053\uff0c\u5b83\u76f8\u5f53\u4e8e\u76f4\u63a5\u8c03\u7528 ALAIN_I18N_TOKEN
\u7684 fanyi
\u65b9\u6cd5\u3002
| i18n
\u4e0d\u4f1a\u76d1\u542c\u8bed\u8a00\u53d8\u66f4\u901a\u77e5\u6240\u4ee5\u4f1a\u6709\u66f4\u597d\u7684\u6027\u80fd\uff0c\u5f53\u4f60\u660e\u786e\u5728\u5207\u6362\u8bed\u8a00\u540e\u4f1a\u91cd\u65b0\u6e32\u67d3 Angular \u9879\u76ee\u65f6 | i18n
\u4f1a\u66f4\u9002\u5408\u3002
\u5982\u4f55\u6dfb\u52a0
\u521b\u5efa\u811a\u624b\u67b6\u547d\u4ee4\u884c ng add ng-alain
\u65f6\u5141\u8bb8\u6307\u5b9a --i18n
\u8868\u793a\u662f\u5426\u5305\u542b\u56fd\u9645\u5316\u793a\u4f8b\u4ee3\u7801\u3002
\u5982\u4f55\u5220\u9664
\u793a\u4f8b\u4ee3\u7801\u6d89\u53ca\u5185\u5bb9\u5305\u62ec\uff1a
src/app/core/i18n
\u76ee\u5f55
\u66ff\u6362\u6389\u9ed8\u8ba4\u5e03\u5c40\u53ef\u80fd\u51fa\u73b0\u7684 I18n \u7684 Pipe \u4f7f\u7528 | i18n
\u9ed8\u8ba4\u8bed\u8a00
\u4e0d\u7ba1\u662f\u5426\u9700\u8981\u56fd\u9645\u5316\uff0c\u7531\u4e8e Angular
\u3001ng-zorro-antd
\u3001@delon/*
\u7b49\u7c7b\u5e93\u7684\u9ed8\u8ba4\u8bed\u8a00\u90fd\u4e0d\u540c\uff0c\u56e0\u6b64\u8fd8\u9700\u8981\u786e\u4fdd\u8fd9\u4e9b\u7c7b\u5e93\u7684\u9ed8\u8ba4\u8bed\u8a00\u662f\u540c\u4e00\u7c7b\u578b\u3002\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\u529e\u6cd5\u53ef\u4ee5\u4e86\u89e3\u5404\u7c7b\u5e93\u5f53\u524d\u8bed\u8a00\u60c5\u51b5\uff1a
import { Component } from \'@angular/core\';\n\n@Component({\n selector: \'app-i18n-test\',\n template: `\n <h2>angular</h2>\n <p>Date: {{now | date}}</p>\n <h2>ng-zorro-antd</h2>\n <nz-transfer [nzDataSource]="[]"></nz-transfer>\n <h2>@delon</h2>\n <div style="width: 200px">\n <tag-select>\n <nz-tag>1</nz-tag>\n </tag-select>\n </div>`,\n})\nexport class I18nTestComponent {\n now = new Date();\n}
\u793a\u4f8b
\u4e3a\u4e86\u4f7f\u8bed\u8a00\u7edf\u4e00\u6027\uff0cNG-ALAIN \u63d0\u4f9b\u4e00\u4e2a\u5728 AppModule
\u6839\u6a21\u5757\u91cc\u7b80\u5355\u7684\u7edf\u4e00\u914d\u7f6e\u65b9\u5f0f\u3002
\u4e2d\u6587\u7248
// #region i18n\nimport { default as ngLang } from \'@angular/common/locales/zh\';\nimport { NZ_I18N, zh_CN as zorroLang } from \'ng-zorro-antd/i18n\';\nimport { DELON_LOCALE, zh_CN as delonLang } from \'@delon/theme\';\nconst LANG = {\n abbr: \'zh\',\n ng: ngLang,\n zorro: zorroLang,\n delon: delonLang,\n};\n// register angular\nimport { registerLocaleData } from \'@angular/common\';\nregisterLocaleData(LANG.ng, LANG.abbr);\nconst LANG_PROVIDES = [\n { provide: LOCALE_ID, useValue: LANG.abbr },\n { provide: NZ_I18N, useValue: LANG.zorro },\n { provide: DELON_LOCALE, useValue: LANG.delon },\n];\n// #endregion\n\n@NgModule({\n providers: [...LANG_PROVIDES],\n})\nexport class AppModule {}
\u82f1\u6587\u7248
// #region i18n\nimport { default as ngLang } from \'@angular/common/locales/en\';\nimport { NZ_I18N, en_US as zorroLang } from \'ng-zorro-antd/i18n\';\nimport { DELON_LOCALE, en_US as delonLang } from \'@delon/theme\';\nconst LANG = {\n abbr: \'en\',\n ng: ngLang,\n zorro: zorroLang,\n delon: delonLang,\n};\n// register angular\nimport { registerLocaleData } from \'@angular/common\';\nregisterLocaleData(LANG.ng, LANG.abbr);\nconst LANG_PROVIDES = [\n { provide: LOCALE_ID, useValue: LANG.abbr },\n { provide: NZ_I18N, useValue: LANG.zorro },\n { provide: DELON_LOCALE, useValue: LANG.delon },\n];\n// #endregion\n\n@NgModule({\n providers: [...LANG_PROVIDES],\n})\nexport class AppModule {}
\u547d\u4ee4\u884c
\u4f7f\u7528 defaultLanguage \u63d2\u4ef6\u53ef\u4ee5\u5feb\u901f\u5207\u6362\u9ed8\u8ba4\u8bed\u8a00\u73af\u5883\u3002
\u56fd\u9645\u5316\u8def\u7531
\u82e5\u60f3\u901a\u8fc7\u8def\u7531\u7684URL\u6765\u5207\u6362\u56fd\u9645\u5316\uff0c\u4f8b\u5982\uff1a\u901a\u8fc7\u8bbf\u95ee /zh
\u548c /en
\u6765\u53d8\u66f4\u8bed\u8a00\uff0c\u5219\u53ea\u9700\u8981\u5728\u6839\u8def\u7531\u4e2d\u4f7f\u7528 alainI18nCanActivate
\u5b88\u536b\uff1a
const routes: Route[] = [\n {\n path: \'\',\n component: LayoutComponent,\n canActivateChild: [alainI18nCanActivate],\n children: [\n { path: \'\', redirectTo: \'en\', pathMatch: \'full\' },\n { path: \':i18n\', component: HomeComponent }\n ]\n }\n];
\u5176\u4e2d :i18n
\u662f\u53c2\u6570\u56fa\u5b9a\u503c\uff0c\u53ef\u4ee5\u901a\u8fc7\u5168\u5c40\u914d\u7f6e paramNameOfUrlGuard
\u6765\u8c03\u6574\u3002
',meta:{order:30,title:{"en-US":"I18n","zh-CN":"\u56fd\u9645\u5316"},type:"Advance"},toc:[{id:"\u5982\u4f55\u914d\u7f6e",title:"\u5982\u4f55\u914d\u7f6e",h:2,children:[{id:"Angular",title:"Angular",h:3},{id:"ng-zorro-antd",title:"ng-zorro-antd",h:3},{id:"@delon",title:"@delon",h:3}]},{id:"ALAIN_I18N_TOKEN",title:"ALAIN_I18N_TOKEN",h:2,children:[{id:"i18n\u7ba1\u9053",title:"i18n\u7ba1\u9053",h:3}]},{id:"\u5982\u4f55\u6dfb\u52a0",title:"\u5982\u4f55\u6dfb\u52a0",h:2},{id:"\u5982\u4f55\u5220\u9664",title:"\u5982\u4f55\u5220\u9664",h:2},{id:"\u9ed8\u8ba4\u8bed\u8a00",title:"\u9ed8\u8ba4\u8bed\u8a00",h:2,children:[{id:"\u793a\u4f8b",title:"\u793a\u4f8b",h:3},{id:"\u547d\u4ee4\u884c",title:"\u547d\u4ee4\u884c",h:3}]},{id:"\u56fd\u9645\u5316\u8def\u7531",title:"\u56fd\u9645\u5316\u8def\u7531",h:2}]}},demo:!1},this.codes=[]}}return(e=o).\u0275fac=function(t){return new(t||e)},e.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-i18n"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,i){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",i.codes)("item",i.item)},dependencies:[s.P],styles:["[_nghost-%COMP%]{display:block}"]}),o})()},{path:"import",redirectTo:"import/zh",pathMatch:"full"},{path:"import/:lang",component:(()=>{var e;class o{constructor(){this.item={cols:1,urls:{"en-US":"docs/import.en-US.md","zh-CN":"docs/import.zh-CN.md"},content:{"en-US":{content:'In addition to the NG-ALAIN base component and the @delon business component, sometimes we need to reference other external class libraries, the following is how to use the rich text component ngx-tinymce:
Angular Component
Installing dependencies
yarn add ngx-tinymce
Import module
You may need to use rich editor in all submodules, as it\'s recommended to import and export them in the SharedModule
module.
// #region third libs\nimport { NgxTinymceModule } from \'ngx-tinymce\';\nconst THIRDMODULES = [ NgxTinymceModule ];\n// #endregion
The region: third libs
region is a coding convention for NG-ALAIN, register all third-party components into the THIRDMODULES
variable, for more coding conventions, refer to Style Guide.
For some third-party components, may be required global configuration. It\'s recommended to register in the root module, for example:
import { NgxTinymceModule } from \'ngx-tinymce\';\n@NgModule({\n imports: [\n BrowserModule,\n NgxTinymceModule.forRoot({\n baseURL: \'//cdn.bootcss.com/tinymce/4.7.13/\'\n })\n ]\n})\nexport class AppModule { }
Next you can use ngx-tinymce
in any submodule:
<tinymce [(ngModel)]="html"></tinymce>
Non-Angular Component
Referencing a non-Angular component is actually loading a JavaScript class library file, such as the QR code library qrious:
Installing dependencies
yarn add qrious
Import Scripts
Add qrious.min.js
to the scripts
node in angular.json
:
"scripts": [\n "node_modules/qrious/dist/qrious.min.js"\n]
If the third-party library requires additional styles, you also need to add a path to styles
.
Note: You need to re-run ng s
.
Lazy loading script
The above import script method will package the code directly into scripts.js
, which will cause the scripts.js
to become larger. NG-ALAIN provides another delayed loading CDN library script solution for low-usage services. (Example: zip compression), you can use LazyService to delay loading remote CDN scripts.
How to use
Angular is using TypeScript language, and all types must be clearly defined to be used. For details, please refer to Angular How to use third-party libraries.
A sample code for the call:
declare var QRious: any;\n\n@Component()\nexport class DEMOComponent {\n constructor() {\n const qr = new QRious();\n }\n}',meta:{order:60,title:"Use a third-party lib",type:"Dev"},toc:[{id:"AngularComponent",title:"Angular Component",h:2,children:[{id:"Installingdependencies",title:"Installing dependencies",h:3},{id:"Importmodule",title:"Import module",h:3}]},{id:"Non-AngularComponent",title:"Non-Angular Component",h:2,children:[{id:"Installingdependencies",title:"Installing dependencies",h:3},{id:"ImportScripts",title:"Import Scripts",h:3},{id:"Howtouse",title:"How to use",h:3}]}]},"zh-CN":{content:'\u9664\u4e86 NG-ZORRO \u57fa\u7840\u7ec4\u4ef6\u4ee5\u53ca @delon \u4e1a\u52a1\u7ec4\u4ef6\u4ee5\u5916\uff0c\u6709\u65f6\u6211\u4eec\u8fd8\u9700\u8981\u5f15\u7528\u5176\u4ed6\u5916\u90e8\u7c7b\u5e93\uff0c\u4ee5\u4e0b\u5c06\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528\u5bcc\u6587\u672c\u7ec4\u4ef6 ngx-tinymce\uff1a
Angular\u7ec4\u4ef6
\u5b89\u88c5\u4f9d\u8d56\u5305
yarn add ngx-tinymce
\u6ce8\u518c
\u50cf\u5bcc\u6587\u672c\u6846\u4f60\u53ef\u80fd\u9700\u8981\u5728\u6240\u6709\u5b50\u6a21\u5757\u4e2d\u90fd\u4f1a\u53ef\u80fd\u4f1a\u7528\u5230\uff0c\u56e0\u4e3a\u5efa\u8bae\u5728 SharedModule
\u6a21\u5757\u4e2d\u5bfc\u5165\u548c\u5bfc\u51fa\u4ed6\u3002
// #region third libs\nimport { NgxTinymceModule } from \'ngx-tinymce\';\nconst THIRDMODULES = [ NgxTinymceModule ];\n// #endregion
region: third libs
\u533a\u57df\u662fNG-ALAIN\u7684\u4e00\u4e2a\u7f16\u7801\u7ea6\u5b9a\uff0c\u5c06\u6240\u6709\u7b2c\u4e09\u65b9\u7ec4\u4ef6\u6ce8\u518c\u81f3 THIRDMODULES
\u53d8\u91cf\u4e2d\u5373\u53ef\uff0c\u800c\u65e0\u987b\u5173\u5fc3 @NgModule
\u5185\u5728\u7684\u5199\u6cd5\uff0c\u6709\u5173\u66f4\u591a\u7f16\u7801\u7ea6\u5b9a\u53ef\u4ee5\u53c2\u8003\u7f16\u7801\u89c4\u8303\u5efa\u8bae\u3002
\u5bf9\u4e8e\u90e8\u5206\u7b2c\u4e09\u65b9\u7ec4\u4ef6\uff0c\u53ef\u80fd\u4f1a\u9700\u8981\u4e00\u4e9b\u914d\u7f6e\u9879\uff0c\u5efa\u8bae\u5728\u6839\u6a21\u5757\u4e2d\u6ce8\u518c\uff0c\u4f8b\u5982\uff1a
import { NgxTinymceModule } from \'ngx-tinymce\';\n@NgModule({\n imports: [\n BrowserModule,\n NgxTinymceModule.forRoot({\n baseURL: \'//cdn.bootcss.com/tinymce/4.7.13/\'\n })\n ]\n})\nexport class AppModule { }
\u63a5\u4e0b\u6765\u4f60\u53ef\u4ee5\u5728\u4efb\u4f55\u5b50\u6a21\u5757\u4e2d\u4f7f\u7528 ngx-tinymce
\uff1a
<tinymce [(ngModel)]="html"></tinymce>
\u975eAngular\u7ec4\u4ef6
\u5f15\u7528\u4e00\u4e2a\u975e Angular \u7ec4\u4ef6\u5b9e\u9645\u4e0a\u662f\u4e00\u4e2a JavaScript \u7c7b\u5e93\uff0c\u4f8b\u5982\u4e8c\u7ef4\u7801\u7c7b\u5e93 qrious\uff0c\u8fd9\u662f\u4e00\u4e2a\u7eaf\u6d01\u7684 JavaScript \u7c7b\u5e93\uff08\u5efa\u8bae\u5c3d\u53ef\u80fd\u4f7f\u7528\u7eaf\u6d01\u7c7b\u5e93\u800c\u975e\u5e26\u6709\u4f9d\u8d56\u5176\u4ed6\uff09\u3002
\u5b89\u88c5\u4f9d\u8d56\u5305
yarn add qrious
\u5bfc\u5165\u811a\u672c
\u5728 angular.json
\u627e\u5230 scripts
\u8282\u70b9\u5e76\u589e\u52a0\uff1a
"scripts": [\n "node_modules/qrious/dist/qrious.min.js"\n]
\u5982\u679c\u7b2c\u4e09\u65b9\u7c7b\u5e93\u9700\u8981\u989d\u5916\u7684\u6837\u5f0f\uff0c\u8fd8\u9700\u8981\u5728 styles
\u589e\u52a0\u8def\u5f84\u3002
\u6ce8\u610f\uff1a\u9700\u8981\u91cd\u65b0\u8fd0\u884c ng s
\u624d\u4f1a\u751f\u6548\u3002
\u5ef6\u8fdf\u52a0\u8f7d\u811a\u672c
\u4e0a\u8ff0\u5bfc\u5165\u811a\u672c\u65b9\u5f0f\u4f1a\u628a\u4ee3\u7801\u76f4\u63a5\u6253\u5305\u8fdb scripts.js
\uff0c\u8fd9\u4f1a\u5bfc\u81f4 scripts.js
\u4f53\u79ef\u53d8\u5927\uff0cNG-ALAIN \u63d0\u4f9b\u53e6\u4e00\u79cd\u5ef6\u8fdf\u52a0\u8f7dCDN\u7c7b\u5e93\u811a\u672c\u89e3\u51b3\u65b9\u6848\uff0c\u9002\u7528\u4f4e\u4f7f\u7528\u7387\u7684\u4e1a\u52a1\uff08\u4f8b\u5982\uff1azip \u538b\u7f29\uff09\uff0c\u53ef\u4ee5\u5229\u7528 LazyService \u5ef6\u8fdf\u52a0\u8f7d\u8fdc\u7a0bCDN\u811a\u672c\u3002
\u4f7f\u7528
Angular \u662f\u91c7\u7528 TypeScript \u8bed\u8a00\uff0c\u6240\u6709\u7c7b\u578b\u90fd\u5fc5\u987b\u660e\u786e\u5b9a\u4e49\u624d\u80fd\u4f7f\u7528\uff0c\u7ec6\u8282\u8bf7\u53c2\u8003 Angular \u5982\u4f55\u4f7f\u7528\u7b2c\u4e09\u65b9\u5e93\u3002
\u4e00\u4e2a\u8c03\u7528\u7684\u793a\u4f8b\u4ee3\u7801\uff1a
declare var QRious: any;\n\n@Component()\nexport class DEMOComponent {\n constructor() {\n const qr = new QRious();\n }\n}',meta:{order:60,title:"\u4f7f\u7528\u7b2c\u4e09\u65b9\u7c7b\u5e93",type:"Dev"},toc:[{id:"Angular\u7ec4\u4ef6",title:"Angular\u7ec4\u4ef6",h:2,children:[{id:"\u5b89\u88c5\u4f9d\u8d56\u5305",title:"\u5b89\u88c5\u4f9d\u8d56\u5305",h:3},{id:"\u6ce8\u518c",title:"\u6ce8\u518c",h:3}]},{id:"\u975eAngular\u7ec4\u4ef6",title:"\u975eAngular\u7ec4\u4ef6",h:2,children:[{id:"\u5b89\u88c5\u4f9d\u8d56\u5305",title:"\u5b89\u88c5\u4f9d\u8d56\u5305",h:3},{id:"\u5bfc\u5165\u811a\u672c",title:"\u5bfc\u5165\u811a\u672c",h:3},{id:"\u4f7f\u7528",title:"\u4f7f\u7528",h:3}]}]}},demo:!1},this.codes=[]}}return(e=o).\u0275fac=function(t){return new(t||e)},e.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-import"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,i){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",i.codes)("item",i.item)},dependencies:[s.P],styles:["[_nghost-%COMP%]{display:block}"]}),o})()},{path:"mock",redirectTo:"mock/zh",pathMatch:"full"},{path:"mock/:lang",component:(()=>{var e;class o{constructor(){this.item={cols:1,urls:{"zh-CN":"docs/mock.md"},content:{"zh-CN":{content:' ',meta:{order:60,title:"Mock",type:"Advance",url:"/mock/getting-started"},toc:[]}},demo:!1},this.codes=[]}}return(e=o).\u0275fac=function(t){return new(t||e)},e.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-mock"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,i){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",i.codes)("item",i.item)},dependencies:[s.P],styles:["[_nghost-%COMP%]{display:block}"]}),o})()},{path:"module",redirectTo:"module/zh",pathMatch:"full"},{path:"module/:lang",component:(()=>{var e;class o{constructor(){this.item={cols:1,urls:{"en-US":"docs/module.en-US.md","zh-CN":"docs/module.zh-CN.md"},content:{"en-US":{content:'The AppModule
, CoreModule
, and SharedModule
modules have not been used very clearly, and it is easy to use them. The goal of the Angular module is to make components, instructions, services, and pipeline function blocks more cohesive, and each functional area forms a separate set of business domains or utilities.
1) Classification description
AppModule
The root module is used to guide Angular startup. It is very suitable for importing some modules that need to be used everywhere in the application. Such as: theme system, user master authentication module, permission module, global HTTP interceptors, international services, etc..
CoreModule
The core module will only be imported once. It is equivalent to AppModule
, but we should treat it as a pure service class module. For example: message, data access, etc.
SharedModule
We call it a shared module. It should not have providers
because ShareModule
will be imported in all business modules. Which will cause the service to be overwritten.
NG-ZORRO, @delon/abc, @delon/chart, etc. have changed from all import to on-demand import since version 11. For this reason, NG-ALAIN has refined two files shared-delon.module.ts
and shared -zorro.module.ts
merges some modules frequently used throughout the project into a module called SharedModule
, which is why it is necessary to import it in the business module for the first time. Although this method can reduce unnecessary import code, it will also cause compilation speed. Therefore, it is not recommended to put all components into SharedModule
, and try to put the modules that need to be used more than three times before putting them here; Otherwise, you must import it yourself in the business module.
2) Recommendation
AppModule
Should import module:
Angular Module: BrowserModule
, BrowserAnimationsModule
, HttpClientModule
AlainThemeModule
Theme system
DelonMockModule
Mock data
AlainAuthModule
User authentication module
AlainACLModule
Privilege module
Internationalization module
Should include services:
Angular globalization
HTTP interceptor
Angular start service
ng-zorro-antd
Basic component service
@delon/abc
Business component service
Role: Throughout the definition of the entire application.
CoreModule
Should only leave the providers
attribute.
Role: Some common services. such as: user messages, HTTP data access.
ShareModule
Should contain definitions:
Apply generic custom business components
Should import module:
Angular generic module:CommonModule
\u3001FormsModule
\u3001RouterModule
\u3001ReactiveFormsModule
ng-zorro-antd
Basic component module
@delon/abc
Business component module
Third-party generic dependency component module
Should Export all included modules.
Should not have providers
attribute.
Function: Some common custom, third-party component definitions, reducing the import of business modules.
Business module
The business module should include a business definition module and a routing module.
Should import module:
Corresponding routing module
Should not:
Export any component
Try not to use the providers
attribute
Route module
Should include only the import
, exports
modules of the r
',meta:{order:30,title:{"en-US":"Module Guidelines","zh-CN":"\u6a21\u5757\u6ce8\u518c\u6307\u5bfc\u539f\u5219"},type:"Other"},toc:[{id:"1Classificationdescription",title:"1) Classification description",h:2,children:[{id:"AppModule",title:"AppModule",h:3},{id:"CoreModule",title:"CoreModule",h:3},{id:"SharedModule",title:"SharedModule",h:3}]},{id:"2Recommendation",title:"2) Recommendation",h:2,children:[{id:"AppModule",title:"AppModule",h:3},{id:"CoreModule",title:"CoreModule",h:3},{id:"ShareModule",title:"ShareModule",h:3},{id:"Businessmodule",title:"Business module",h:3}]}]},"zh-CN":{content:'\u4e00\u76f4\u4ee5\u6765 AppModule
\u3001CoreModule
\u3001SharedModule
\u6a21\u5757\u4f7f\u7528\u6ca1\u6709\u5f88\u660e\u786e\u7684\u89c4\u8303\uff0c\u5f88\u5bb9\u6613\u8ba9\u4ea7\u751f\u4e71\u7528\u3002Angular\u6a21\u5757\u76ee\u6807\u662f\u4e3a\u4e86\u4f7f\u7ec4\u4ef6\u3001\u6307\u4ee4\u3001\u670d\u52a1\u548c\u7ba1\u9053\u529f\u80fd\u5757\u66f4\u5185\u805a\uff0c\u5e76\u6bcf\u4e00\u4e2a\u529f\u80fd\u533a\u57df\u5f62\u6210\u72ec\u7acb\u7684\u4e1a\u52a1\u9886\u57df\u6216\u5b9e\u7528\u5de5\u5177\u7684\u96c6\u5408\u3002
1) \u5206\u7c7b\u8bf4\u660e
AppModule
\u6839\u6a21\u5757\uff0c\u7528\u4e8e\u5f15\u5bfc Angular \u542f\u52a8\uff1b\u5b83\u975e\u5e38\u9002\u5408\u5bfc\u5165\u4e00\u4e9b\u9700\u8981\u5728\u6574\u4e2a\u5e94\u7528\u5230\u5904\u9700\u8981\u7684\u6a21\u5757\uff0c\u4f8b\u5982\uff1a\u4e3b\u9898\u7cfb\u7edf\u3001\u7528\u6237\u4e3b\u8ba4\u8bc1\u6a21\u5757\u3001\u6743\u9650\u6a21\u5757\u7b49\u6a21\u5757\uff0c\u4ee5\u53ca\u4e00\u4e9b\u5168\u5c40\u6027HTTP\u62e6\u622a\u5668\u3001\u56fd\u9645\u5316\u670d\u52a1\u7b49\u3002
CoreModule
\u6838\u5fc3\u6a21\u5757\u53ea\u4f1a\u88ab\u5bfc\u5165\u4e00\u6b21\uff0c\u5b83\u7b49\u540c AppModule
\uff0c\u4f46\u6211\u4eec\u66f4\u5e94\u8be5\u628a\u5b83\u5f53\u6210\u4e00\u4e2a\u7eaf\u670d\u52a1\u7c7b\u6a21\u5757\uff0c\u4f8b\u5982\uff1a\u6d88\u606f\u3001\u6570\u636e\u8bbf\u95ee\u7b49\u3002
SharedModule
\u6211\u4eec\u53eb\u5b83\u5171\u4eab\u6a21\u5757\uff1b\u5b83\u4e0d\u5e94\u8be5\u51fa\u73b0 providers
\uff0c\u56e0\u4e3a ShareModule
\u4f1a\u5728\u6240\u6709\u4e1a\u52a1\u6a21\u5757\u4e2d\u88ab\u5bfc\u5165\uff0c\u8fd9\u4f1a\u5bfc\u81f4\u670d\u52a1\u88ab\u8986\u76d6\u3002
NG-ZORRO\u3001@delon/abc\u3001@delon/chart \u7b49\u4ece\u7248\u672c11\u5f00\u59cb\u7531\u4e00\u6b21\u6027\u5bfc\u5165\u6539\u6210\u6309\u9700\u5bfc\u5165\uff0c\u4e3a\u6b64 NG-ALAIN \u63d0\u70bc\u4e86\u4e24\u4e2a\u6587\u4ef6 shared-delon.module.ts
\u3001shared-zorro.module.ts
\u5c06\u4e00\u4e9b\u6574\u4e2a\u9879\u76ee\u7ecf\u5e38\u7528\u5230\u7684\u6a21\u5757\u5408\u5e76\u6210\u4e00\u4e2a\u53eb SharedModule
\u6a21\u5757\u5185\uff0c\u8fd9\u4e5f\u5c31\u662f\u4e3a\u4ec0\u4e48\u9700\u8981\u5728\u4e1a\u52a1\u6a21\u5757\u5185\u7b2c\u4e00\u65f6\u95f4\u5bfc\u5165\u5b83\u3002\u867d\u7136\u8fd9\u79cd\u65b9\u5f0f\u53ef\u4ee5\u51cf\u5c11\u4e0d\u5fc5\u8981\u7684\u5bfc\u5165\u4ee3\u7801\uff0c\u4f46\u540c\u65f6\u4e5f\u4f1a\u5f15\u8d77\u7f16\u8bd1\u901f\u5ea6\uff0c\u56e0\u6b64\u4e0d\u5efa\u8bae\u628a\u6240\u6709\u7ec4\u4ef6\u90fd\u653e\u8fdb SharedModule
\u5185\uff0c\u5c3d\u53ef\u80fd\u5c06\u9700\u8981\u7528\u5230\u7684\u6a21\u5757\u4e09\u6b21\u4ee5\u4e0a\u4f7f\u7528\u624d\u653e\u8fdb\u8fd9\u91cc\uff1b\u5426\u5219\u52a1\u5fc5\u5728\u4e1a\u52a1\u6a21\u5757\u5185\u81ea\u884c\u5bfc\u5165\u3002
2) \u5efa\u8bae
AppModule
\u5e94 \u5bfc\u5165\u6a21\u5757\uff1a
Angular \u6a21\u5757\uff1aBrowserModule
\u3001BrowserAnimationsModule
\u3001HttpClientModule
AlainThemeModule
\u4e3b\u9898\u7cfb\u7edf
DelonMockModule
Mock\u6570\u636e
AlainAuthModule
\u7528\u6237\u8ba4\u8bc1\u6a21\u5757
AlainACLModule
\u6743\u9650\u6a21\u5757
\u56fd\u9645\u5316\u6a21\u5757
\u5e94 \u5305\u542b\u670d\u52a1\uff1a
Angular \u56fd\u9645\u5316
HTTP \u62e6\u622a\u5668
Angular \u542f\u52a8\u670d\u52a1
ng-zorro-antd
\u57fa\u7840\u7ec4\u4ef6\u670d\u52a1
@delon/abc
\u4e1a\u52a1\u7ec4\u4ef6\u670d\u52a1
\u4f5c\u7528\uff1a \u8d2f\u7a7f\u6574\u4e2a\u5e94\u7528\u7684\u5b9a\u4e49\u3002
CoreModule
\u5e94 \u4ec5\u53ea\u7559 providers
\u5c5e\u6027\u3002
\u4f5c\u7528\uff1a \u4e00\u4e9b\u901a\u7528\u670d\u52a1\uff0c\u4f8b\u5982\uff1a\u7528\u6237\u6d88\u606f\u3001HTTP\u6570\u636e\u8bbf\u95ee\u3002
ShareModule
\u5e94 \u5305\u542b\u5b9a\u4e49\uff1a
\u5e94\u7528\u901a\u7528\u81ea\u5b9a\u4e49\u4e1a\u52a1\u7ec4\u4ef6
\u5e94 \u5bfc\u5165\u6a21\u5757\uff1a
Angular \u901a\u7528\u6a21\u5757\uff1aCommonModule
\u3001FormsModule
\u3001RouterModule
\u3001ReactiveFormsModule
ng-zorro-antd
\u57fa\u7840\u7ec4\u4ef6\u6a21\u5757
@delon/abc
\u4e1a\u52a1\u7ec4\u4ef6\u6a21\u5757
\u7b2c\u4e09\u65b9\u901a\u7528\u4f9d\u8d56\u7ec4\u4ef6\u6a21\u5757
\u5e94 \u5bfc\u51fa\u6240\u6709\u5305\u542b\u7684\u6a21\u5757\u3002
\u4e0d\u5e94 \u6709 providers
\u5c5e\u6027\u3002
\u4f5c\u7528\uff1a \u4e00\u4e9b\u901a\u7528\u81ea\u5b9a\u4e49\u3001\u7b2c\u4e09\u65b9\u7ec4\u4ef6\u5b9a\u4e49\uff0c\u51cf\u5c11\u4e1a\u52a1\u6a21\u5757\u7684\u5bfc\u5165\u3002
\u4e1a\u52a1\u6a21\u5757
\u4e1a\u52a1\u6a21\u5757\u5e94\u8be5\u5305\u62ec\u4e1a\u52a1\u5b9a\u4e49\u6a21\u5757\u548c\u8def\u7531\u6a21\u5757\u3002
\u6a21\u5757
\u5e94 \u5bfc\u5165\u6a21\u5757\uff1a
\u5bf9\u5e94\u7684\u8def\u7531\u6a21\u5757
\u4e0d\u5e94\uff1a
\u5bfc\u51fa\u4efb\u4f55\u7ec4\u4ef6
\u5c3d\u53ef\u80fd\u4e0d\u8981\u4f7f\u7528 providers
\u5c5e\u6027
\u8def\u7531\u6a21\u5757
\u5e94 \u53ea\u5305\u62ec\u8def\u7531\u7684 import
\u3001exports
',meta:{order:30,title:{"en-US":"Module Guidelines","zh-CN":"\u6a21\u5757\u6ce8\u518c\u6307\u5bfc\u539f\u5219"},type:"Other"},toc:[{id:"1\u5206\u7c7b\u8bf4\u660e",title:"1) \u5206\u7c7b\u8bf4\u660e",h:2,children:[{id:"AppModule",title:"AppModule",h:3},{id:"CoreModule",title:"CoreModule",h:3},{id:"SharedModule",title:"SharedModule",h:3}]},{id:"2\u5efa\u8bae",title:"2) \u5efa\u8bae",h:2,children:[{id:"AppModule",title:"AppModule",h:3},{id:"CoreModule",title:"CoreModule",h:3},{id:"ShareModule",title:"ShareModule",h:3},{id:"\u4e1a\u52a1\u6a21\u5757",title:"\u4e1a\u52a1\u6a21\u5757",h:3}]}]}},demo:!1},this.codes=[]}}return(e=o).\u0275fac=function(t){return new(t||e)},e.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-module"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,i){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",i.codes)("item",i.item)},dependencies:[s.P],styles:["[_nghost-%COMP%]{display:block}"]}),o})()},{path:"new-component",redirectTo:"new-component/zh",pathMatch:"full"},{path:"new-component/:lang",component:(()=>{var e;class o{constructor(){this.item={cols:1,urls:{"en-US":"docs/new-component.en-US.md","zh-CN":"docs/new-component.zh-CN.md"},content:{"en-US":{content:'For some functional modules that may be referenced in multiple places, it is recommended to refine the management into unified management of business components. These components generally have the following characteristics:
Only responsible for a relatively independent, stable function;
no separate routing configuration;
May be purely static, controlled only by parameters passed by the parent component (usually a page).
Let\'s take a simple static component as an example. Suppose your app often needs to display images. These images are fixed in width, have a gray background and a certain padding, and have text descriptions, like the following:
You can do this with a component that has a default style and can receive the parameters passed by the parent component for display.
Create a new file
Create a new folder named components
under src/app/shared
. Create folder called image-wrapper
and component file. If required add ts files index.ts
and style files index.less
. Provide README.md
for component API descriptions in this folder.
When using components, the default is to look for the export object in index.ts
. If your component is more complex, you can split it into multiple files, and finally unify the export in index.ts
, like this:
// main.component.ts\nexport class MainComponent {}\n\n// sub.component.ts\nexport class SubComponent {}\n\n// index.ts\nexport MainComponent from \'./main.component\';\nexport SubComponent from \'./sub.component\';
Your code is probably like this:
// index.ts\nimport { Component, Input } from \'@angular/core\';\n\n@Component({\n selector: \'image-wrapper\',\n template: `\n <div [ngStyle]="style">\n <img class="img" [src]="src" [alt]="desc" />\n <div *ngIf="desc" class="desc">{{ desc }}</div>\n </div>\n `,\n styleUrls: [ \'./index.less\' ]\n})\nexport class ImageWrapperComponent {\n @Input() style: { [key: string]: string };\n @Input() src: string;\n @Input() desc: string;\n}
// index.less\n:host {\n width: 400px;\n margin: 0 auto;\n padding: 0 20px 8px;\n text-align: center;\n background: #f2f4f5;\n\n ::ng-deep {\n .img {\n max-width: calc(100% - 32px);\n margin: 2.4em 1em;\n vertical-align: middle;\n box-shadow: 0 8px 20px rgba(143, 168, 191, 0.35);\n }\n }\n}
The components are built here, to learn more about the development of component styles.
Register
Once the component is created, you need to import the component into SharedModule
so that all submodules can use it.
// shared.module.ts\nimport { ImageWrapperComponent } from \'./image-wrapper\';\nconst COMPONENTS = [\n ImageWrapperComponent\n];
Use
Where you want to use this component, just follow the component-defined API input parameters and use it directly:
<image-wrapper\n src="https://os.alipayobjects.com/rmsportal/mgesTPFxodmIwpi.png"\n desc="schematic-diagram"></image-wrapper>',meta:{order:20,title:{"en-US":"New Component","zh-CN":"\u65b0\u589e\u4e1a\u52a1\u7ec4\u4ef6"},type:"Dev"},toc:[{id:"Createanewfile",title:"Create a new file",h:2},{id:"Register",title:"Register",h:2},{id:"Use",title:"Use",h:2}]},"zh-CN":{content:'\u5bf9\u4e8e\u4e00\u4e9b\u53ef\u80fd\u88ab\u591a\u5904\u5f15\u7528\u7684\u529f\u80fd\u6a21\u5757\uff0c\u5efa\u8bae\u63d0\u70bc\u6210\u4e1a\u52a1\u7ec4\u4ef6\u7edf\u4e00\u7ba1\u7406\u3002\u8fd9\u4e9b\u7ec4\u4ef6\u4e00\u822c\u6709\u4ee5\u4e0b\u7279\u5f81\uff1a
\u53ea\u8d1f\u8d23\u4e00\u5757\u76f8\u5bf9\u72ec\u7acb\uff0c\u7a33\u5b9a\u7684\u529f\u80fd\uff1b
\u6ca1\u6709\u5355\u72ec\u7684\u8def\u7531\u914d\u7f6e\uff1b
\u53ef\u80fd\u662f\u7eaf\u9759\u6001\u7684\uff0c\u4ec5\u53d7\u7236\u7ec4\u4ef6\uff08\u901a\u5e38\u662f\u4e00\u4e2a\u9875\u9762\uff09\u4f20\u9012\u7684\u53c2\u6570\u63a7\u5236\u3002
\u4e0b\u9762\u4ee5\u4e00\u4e2a\u7b80\u5355\u7684\u9759\u6001\u7ec4\u4ef6\u4e3a\u4f8b\u8fdb\u884c\u4ecb\u7ecd\u3002\u5047\u8bbe\u4f60\u7684\u5e94\u7528\u4e2d\u7ecf\u5e38\u9700\u8981\u5c55\u73b0\u56fe\u7247\uff0c\u8fd9\u4e9b\u56fe\u7247\u5bbd\u5ea6\u56fa\u5b9a\uff0c\u6709\u4e00\u4e2a\u7070\u8272\u7684\u80cc\u666f\u548c\u4e00\u5b9a\u7684\u5185\u8fb9\u8ddd\uff0c\u6709\u6587\u5b57\u4ecb\u7ecd\uff0c\u5c31\u50cf\u4e0b\u56fe\u8fd9\u6837\uff1a
\u4f60\u53ef\u4ee5\u7528\u4e00\u4e2a\u7ec4\u4ef6\u6765\u5b9e\u73b0\u8fd9\u4e00\u529f\u80fd\uff0c\u5b83\u6709\u9ed8\u8ba4\u7684\u6837\u5f0f\uff0c\u540c\u65f6\u53ef\u4ee5\u63a5\u6536\u7236\u7ec4\u4ef6\u4f20\u9012\u7684\u53c2\u6570\u8fdb\u884c\u5c55\u793a\u3002
\u65b0\u5efa\u6587\u4ef6
\u5728 src/app/shared/components
\u4e0b\u65b0\u5efa\u4e00\u4e2a\u4ee5\u7ec4\u4ef6\u540d\u547d\u540d\u7684\u6587\u4ef6\u5939\uff0c\u547d\u540d\u5c3d\u91cf\u4f53\u73b0\u7ec4\u4ef6\u7684\u529f\u80fd\uff0c\u8fd9\u91cc\u5c31\u53eb image-wrapper
\u3002\u5728\u6b64\u6587\u4ef6\u5939\u4e0b\u65b0\u589e ts \u6587\u4ef6\u3001\u6837\u5f0f\u6587\u4ef6\uff08\u5982\u679c\u9700\u8981\uff09\u53ca\u7ec4\u4ef6API\u8bf4\u660e\uff0c\u547d\u540d\u4e3a index.ts
\u3001index.less
\u548cREADME.md
\u3002
\u5728\u4f7f\u7528\u7ec4\u4ef6\u65f6\uff0c\u9ed8\u8ba4\u4f1a\u5728 index.ts
\u4e2d\u5bfb\u627e export \u7684\u5bf9\u8c61\uff0c\u5982\u679c\u4f60\u7684\u7ec4\u4ef6\u6bd4\u8f83\u590d\u6742\uff0c\u53ef\u4ee5\u5206\u4e3a\u591a\u4e2a\u6587\u4ef6\uff0c\u6700\u540e\u5728 index.ts
\u4e2d\u7edf\u4e00 export\uff0c\u5c31\u50cf\u8fd9\u6837\uff1a
// main.component.ts\nexport class MainComponent {}\n\n// sub.component.ts\nexport class SubComponent {}\n\n// index.ts\nexport MainComponent from \'./main.component\';\nexport SubComponent from \'./sub.component\';
\u4f60\u7684\u4ee3\u7801\u5927\u6982\u662f\u8fd9\u4e2a\u6837\u5b50\uff1a
// index.ts\nimport { Component, Input } from \'@angular/core\';\n\n@Component({\n selector: \'image-wrapper\',\n template: `\n <div [ngStyle]="style">\n <img class="img" [src]="src" [alt]="desc" />\n <div *ngIf="desc" class="desc">{{ desc }}</div>\n </div>\n `,\n styleUrls: [ \'./index.less\' ]\n})\nexport class ImageWrapperComponent {\n @Input() style: { [key: string]: string };\n @Input() src: string;\n @Input() desc: string;\n}
// index.less\n:host {\n width: 400px;\n margin: 0 auto;\n padding: 0 20px 8px;\n text-align: center;\n background: #f2f4f5;\n\n ::ng-deep {\n .img {\n max-width: calc(100% - 32px);\n margin: 2.4em 1em;\n vertical-align: middle;\n box-shadow: 0 8px 20px rgba(143, 168, 191, 0.35);\n }\n }\n}
\u5230\u8fd9\u513f\u7ec4\u4ef6\u5c31\u5efa\u597d\u4e86\uff0c\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u7ec4\u4ef6\u6837\u5f0f\u7684\u5f00\u53d1\u3002
\u6ce8\u518c
\u7ec4\u4ef6\u521b\u5efa\u597d\u540e\uff0c\u9700\u8981\u5c06\u7ec4\u4ef6\u5bfc\u5165 SharedModule
\u4e2d\uff0c\u8fd9\u6837\u6240\u6709\u5b50\u6a21\u5757\u90fd\u53ef\u4ee5\u4f7f\u7528\u5230\u8be5\u7ec4\u4ef6\u3002
// shared.module.ts\nimport { ImageWrapperComponent } from \'./image-wrapper\';\nconst COMPONENTS = [\n ImageWrapperComponent\n];
\u4f7f\u7528
\u5728\u8981\u4f7f\u7528\u8fd9\u4e2a\u7ec4\u4ef6\u7684\u5730\u65b9\uff0c\u6309\u7167\u7ec4\u4ef6\u5b9a\u4e49\u7684 API \u4f20\u5165\u53c2\u6570\uff0c\u76f4\u63a5\u4f7f\u7528\u5c31\u597d\uff1a
<image-wrapper\n src="https://os.alipayobjects.com/rmsportal/mgesTPFxodmIwpi.png"\n desc="\u793a\u610f\u56fe"></image-wrapper>',meta:{order:20,title:{"en-US":"New Component","zh-CN":"\u65b0\u589e\u4e1a\u52a1\u7ec4\u4ef6"},type:"Dev"},toc:[{id:"\u65b0\u5efa\u6587\u4ef6",title:"\u65b0\u5efa\u6587\u4ef6",h:2},{id:"\u6ce8\u518c",title:"\u6ce8\u518c",h:2},{id:"\u4f7f\u7528",title:"\u4f7f\u7528",h:2}]}},demo:!1},this.codes=[]}}return(e=o).\u0275fac=function(t){return new(t||e)},e.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-new-component"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,i){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",i.codes)("item",i.item)},dependencies:[s.P],styles:["[_nghost-%COMP%]{display:block}"]}),o})()},{path:"new-page",redirectTo:"new-page/zh",pathMatch:"full"},{path:"new-page/:lang",component:(()=>{var e;class o{constructor(){this.item={cols:1,urls:{"en-US":"docs/new-page.en-US.md","zh-CN":"docs/new-page.zh-CN.md"},content:{"en-US":{content:'Angular renders a page in a component tree, the actual development is to organize the code in a module tree to make it better to resuse code. For module granularity depends on the requirements, ng-alain is positioned in the middle of the front-end. Therefore, it is recommended to organize your code structure from a business perspective.
NG-ALAIN provides a very rich set of Schematics templates to quickly create templates and pages that match NG-ALAIN features, as well as a variety of pluggable plugins.
Additionally: NG-ALAIN is a standard Angular CLI project, you can still use the default command line.
First, the module
To create a page, you need to create a module first. If you need a system to set the relevant module, execute the command:
ng g ng-alain:module sys
The CLI will automatically create sys.module.ts
and sys-routing.module.ts
files under src/app/routes/sys
, the former is the system setup module component definition file; the latter is the system setup module routing Configuration file.
// sys.module.ts\nimport { NgModule, Type } from \'@angular/core\';\nimport { SharedModule } from \'@shared\';\nimport { SysRoutingModule } from \'./sys-routing.module\';\n\nconst COMPONENTS: Type[] = [];\n\n@NgModule({\n imports: [SharedModule, SysRoutingModule],\n declarations: COMPONENTS,\n})\nexport class SysModule {}
The function of the module is to import the modules we need. All NG-ZORRO, @delon/abc, @delon/chart, etc. are loaded on demand. The external components are imported wherever the current business page needs. In order to reduce these import actions, NG -ALAIN has refined two files shared-delon.module.ts
and shared-zorro.module.ts
to merge some modules frequently used throughout the project into a module called SharedModule
, which is why it is necessary Import it in the business module for the first time. Note: It is not recommended to put all the components in SharedModule
, as far as possible, put the modules that need to be used two or three times or more.
And the routing configuration module:
// sys-routing.module.ts\nimport { NgModule } from \'@angular/core\';\nimport { RouterModule, Routes } from \'@angular/router\';\n\nconst routes: Routes = [];\n\n@NgModule({\n imports: [RouterModule.forChild(routes)],\n exports: [RouterModule],\n})\nexport class SysRoutingModule {}
By now, you can safely start developing business pages like menu management, logging, system configuration, etc. in the sys
directory.
Second, the page
Use the ng generate
(abbreviated as: ng g
) command to create a log list page in the sys
directory:
ng g ng-alain:list log -m=sys
See Command Line Tools for more information.
Finally, you can access the Log page.
Of course, the log may be a very rich piece of information, you can add a view page opened in a modal box to display more details.
ng g ng-alain:view view -m=sys -t=log
-t=log
indicates that you want to put the created file under sys/log/view',meta:{order:10,title:{"en-US":"New Page","zh-CN":"\u65b0\u589e\u9875\u9762"},type:"Dev"},toc:[{id:"First,themodule",title:"First, the module",h:2},{id:"Second,thepage",title:"Second, the page",h:2}]},"zh-CN":{content:'Angular \u867d\u7136\u662f\u4ee5\u7ec4\u4ef6\u6811\u6765\u6e32\u67d3\u4e00\u4e2a\u9875\u9762\uff0c\u7136\u540e\u5b9e\u9645\u5f00\u53d1\u662f\u4ee5\u4e00\u79cd\u6a21\u5757\u6811\u6765\u7ec4\u7ec7\u4ee3\u7801\uff0c\u4f7f\u5176\u80fd\u66f4\u597d\u5730\u4ee3\u7801\u590d\u7528\u3002\u800c\u5bf9\u4e8e\u6a21\u5757\u7c92\u5ea6\u53d6\u51b3\u4e8e\u9700\u6c42\uff0cng-alain\u7684\u5b9a\u4f4d\u5728\u4e8e\u4e2d\u53f0\u524d\u7aef\uff0c\u56e0\u6b64\uff0c\u6bd4\u8f83\u5efa\u8bae\u4ece\u4e1a\u52a1\u89d2\u5ea6\u51fa\u53d1\u7ec4\u7ec7\u4f60\u7684\u4ee3\u7801\u7ed3\u6784\u3002
NG-ALAIN \u63d0\u4f9b\u4e00\u5957\u975e\u5e38\u4e30\u5bcc\u7684 Schematics \u6a21\u677f\uff0c\u53ef\u4ee5\u5feb\u901f\u521b\u5efa\u7b26\u5408 NG-ALAIN \u7279\u70b9\u7684\u6a21\u677f\u548c\u9875\u9762\uff1b\u540c\u65f6\u5305\u542b\u591a\u79cd\u53ef\u63d2\u62d4\u63d2\u4ef6\u3002
\u53e6\uff1aNG-ALAIN \u662f\u4e00\u4e2a\u6807\u51c6\u7684 Angular CLI \u9879\u76ee\uff0c\u4f60\u4f9d\u7136\u53ef\u4ee5\u4f7f\u7528\u9ed8\u8ba4\u7684\u6240\u6709\u547d\u4ee4\u884c\u3002
\u4e00\u3001\u6a21\u5757
\u8981\u521b\u5efa\u4e00\u4e2a\u9875\u9762\u9700\u8981\u5148\u521b\u5efa\u4e00\u4e2a\u6a21\u5757\u5f00\u59cb\uff0c\u5047\u5982\u9700\u8981\u4e00\u4e2a\u7cfb\u7edf\u8bbe\u7f6e\u76f8\u5173\u7684\u6a21\u5757\uff0c\u6267\u884c\u547d\u4ee4\uff1a
ng g ng-alain:module sys
CLI \u4f1a\u81ea\u52a8\u5728 src/app/routes/sys
\u4e0b\u521b\u5efa sys.module.ts
\u548c sys-routing.module.ts
\u6587\u4ef6\uff0c\u524d\u8005\u662f\u7cfb\u7edf\u8bbe\u7f6e\u6a21\u5757\u7ec4\u4ef6\u5b9a\u4e49\u6587\u4ef6\uff1b\u540e\u8005\u662f\u7cfb\u7edf\u8bbe\u7f6e\u6a21\u5757\u8def\u7531\u914d\u7f6e\u6587\u4ef6\u3002
// sys.module.ts\nimport { NgModule, Type } from \'@angular/core\';\nimport { SharedModule } from \'@shared\';\nimport { SysRoutingModule } from \'./sys-routing.module\';\n\nconst COMPONENTS: Type[] = [];\n\n@NgModule({\n imports: [SharedModule, SysRoutingModule],\n declarations: COMPONENTS,\n})\nexport class SysModule {}
\u6a21\u5757\u7684\u4f5c\u7528\u662f\u5bfc\u5165\u6211\u4eec\u9700\u8981\u7684\u6a21\u5757\uff0c\u6240\u6709 NG-ZORRO\u3001@delon/abc\u3001@delon/chart \u7b49\u90fd\u662f\u6309\u9700\u6c42\u52a0\u8f7d\u6a21\u5757\uff0c\u5f53\u524d\u4e1a\u52a1\u9875\u9700\u8981\u54ea\u91cc\u5916\u90e8\u7ec4\u4ef6\u5c31\u5bfc\u5165\u54ea\u4e9b\uff0c\u4e3a\u4e86\u51cf\u5c11\u8fd9\u4e9b\u5bfc\u5165\u52a8\u4f5c\uff0cNG-ALAIN \u63d0\u70bc\u4e86\u4e24\u4e2a\u6587\u4ef6 shared-delon.module.ts
\u3001shared-zorro.module.ts
\u5c06\u4e00\u4e9b\u6574\u4e2a\u9879\u76ee\u7ecf\u5e38\u7528\u5230\u7684\u6a21\u5757\u5408\u5e76\u6210\u4e00\u4e2a\u53eb SharedModule
\u6a21\u5757\u5185\uff0c\u8fd9\u4e5f\u5c31\u662f\u4e3a\u4ec0\u4e48\u9700\u8981\u5728\u4e1a\u52a1\u6a21\u5757\u5185\u7b2c\u4e00\u65f6\u95f4\u5bfc\u5165\u5b83\u3002\u6ce8\u610f\uff1a\u4e0d\u5efa\u8bae\u628a\u6240\u6709\u7ec4\u4ef6\u90fd\u653e\u8fdb SharedModule
\u5185\uff0c\u5c3d\u53ef\u80fd\u5c06\u9700\u8981\u7528\u5230\u7684\u6a21\u5757\u4ee5\u4e8c\u6216\u4e09\u6b21\u4ee5\u4e0a\u4f7f\u7528\u624d\u653e\u8fdb\u8fd9\u91cc\u3002
\u4ee5\u53ca\u8def\u7531\u914d\u7f6e\u6a21\u5757\uff1a
// sys-routing.module.ts\nimport { NgModule } from \'@angular/core\';\nimport { RouterModule, Routes } from \'@angular/router\';\n\nconst routes: Routes = [];\n\n@NgModule({\n imports: [RouterModule.forChild(routes)],\n exports: [RouterModule],\n})\nexport class SysRoutingModule {}
\u81f3\u6b64\uff0c\u4f60\u53ef\u4ee5\u653e\u5fc3\u5728 sys
\u76ee\u5f55\u4e2d\u5f00\u59cb\u5f00\u53d1\u50cf\u83dc\u5355\u7ba1\u7406\u3001\u65e5\u5fd7\u3001\u7cfb\u7edf\u914d\u7f6e\u7b49\u4e1a\u52a1\u9875\u9762\u3002
\u4e8c\u3001\u9875\u9762
\u5229\u7528 ng generate
\uff08\u53ef\u7b80\u5199\u4e3a\uff1ang g
\uff09 \u547d\u4ee4\u5728 sys
\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2a\u65e5\u5fd7\u5217\u8868\u9875\uff1a
ng g ng-alain:list log -m=sys
\u4e86\u89e3\u66f4\u591a\u8bf7\u53c2\u8003\u547d\u4ee4\u884c\u5de5\u5177\u3002
\u6700\u7ec8\uff0c\u4f60\u53ef\u4ee5\u8bbf\u95ee \u65e5\u5fd7 \u9875\u9762\u3002
\u5f53\u7136\u65e5\u5fd7\u53ef\u80fd\u662f\u4e00\u4e2a\u975e\u5e38\u4e30\u5bcc\u7684\u4fe1\u606f\uff0c\u53ef\u4ee5\u589e\u52a0\u4e00\u4e2a\u4ee5\u6a21\u6001\u6846\u6253\u5f00\u7684\u67e5\u770b\u9875\u6765\u663e\u793a\u66f4\u591a\u8be6\u60c5\u3002
ng g ng-alain:view view -m=sys -t=log
-t=log
\u8868\u793a\u5e0c\u671b\u628a\u521b\u5efa\u7684\u6587\u4ef6\u653e\u8fdb\u81f3 sys/log/view
',meta:{order:10,title:{"en-US":"New Page","zh-CN":"\u65b0\u589e\u9875\u9762"},type:"Dev"},toc:[{id:"\u4e00\u3001\u6a21\u5757",title:"\u4e00\u3001\u6a21\u5757",h:2},{id:"\u4e8c\u3001\u9875\u9762",title:"\u4e8c\u3001\u9875\u9762",h:2}]}},demo:!1},this.codes=[]}}return(e=o).\u0275fac=function(t){return new(t||e)},e.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-new-page"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,i){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",i.codes)("item",i.item)},dependencies:[s.P],styles:["[_nghost-%COMP%]{display:block}"]}),o})()},{path:"performance",redirectTo:"performance/zh",pathMatch:"full"},{path:"performance/:lang",component:(()=>{var e;class o{constructor(){this.item={cols:1,urls:{"en-US":"docs/performance.en-US.md","zh-CN":"docs/performance.zh-CN.md"},content:{"en-US":{content:'Envelope size optimization
Divided into JavaScript script files and CSS files. The following only describes the script part. For the CSS file, please refer to Optimize Theme System.
Note: It is recommended to always prioritize business, optimize to the post- criteria, and have some understanding of NG-ALAIN before starting to optimize. The optimization scheme in this chapter will change with the change of the version. Please pay attention to the details.
Structure description
In general, there are two files that are larger after the build: scripts.js
and main.js
, and our optimization is mainly for these two items.
scripts.js
It comes from a collection of scripts
nodes of angular.json
, so the size of this file depends on the size of the third-party component referenced by the scripts
node.
In general, you should put it under scripts
when you are using non-Angular third-party components.
main.js
Using ng build
by default will package all @angular/*
, ng-zorro-antd
, @delon/*
and some third-party Angular components. Unless you use the --vendor-chunk
parameter to separate these classes library.
Optimization object
We know that the resource file packaged by Angular Cli will contain the hashing value of the file. Which is like the unique identifier of the file. If the module is not modified, no new hashing value will be generated. This ensures that after the user downloads the resource for the first time. No matter how we build the user again, there is no need to download it again.
In fact, Angular Cli defaults to --vendor-chunk
. The main factor is that these @angular/*
are very fast relative to iteration.
According to NG-ALAIN\'s module registration guidelines, generate two shared-delon.module.ts
andshared-zorro.module.ts
produced are the summary of the import of secondary modules shared by @Delon and NG-ZORRO.
@delon/abc
,@delon/chart
, ng-zorro-antd
The three main libraries all support secondary imports. Only selecting the modules required by the project will effectively solve the problem of package size.
Conclusion
After NG-ZORRO provides better optimization support, we will release #684 and hope to have a better package size. Expected res
',meta:{order:80,title:{"en-US":"Performance","zh-CN":"\u4f18\u5316"},type:"Advance"},toc:[{id:"Envelopesizeoptimization",title:"Envelope size optimization",h:2,children:[{id:"Structuredescription",title:"Structure description",h:3},{id:"Optimizationobject",title:"Optimization object",h:3},{id:"Conclusion",title:"Conclusion",h:3}]}]},"zh-CN":{content:'\u5305\u4f53\u5927\u5c0f\u4f18\u5316
\u5206\u4e3aJavaScript\u811a\u672c\u6587\u4ef6\u548cCSS\u6587\u4ef6\uff0c\u4ee5\u4e0b\u53ea\u63cf\u8ff0\u811a\u672c\u90e8\u5206\uff0c\u6709\u5173CSS\u6587\u4ef6\u8bf7\u53c2\u8003\u4f18\u5316\u4e3b\u9898\u7cfb\u7edf\u3002
\u6ce8\u610f\uff1a \u5efa\u8bae\u59cb\u7ec8\u4ee5\u4e1a\u52a1\u4f18\u5148\uff0c\u4f18\u5316\u4e3a\u540e\u7684\u51c6\u5219\uff0c\u4e14\u5728\u5f00\u59cb\u524d\u5bf9 NG-ALAIN \u6709\u4e00\u5b9a\u4e86\u89e3\u540e\u518d\u8fdb\u884c\u4f18\u5316\u3002\u672c\u7ae0\u8282\u7684\u4f18\u5316\u65b9\u6848\u4f1a\u968f\u7740\u7248\u672c\u7684\u66f4\u8fed\u6709\u6240\u53d8\u52a8\uff0c\u6709\u5173\u7ec6\u8282\u8bf7\u6301\u7eed\u5173\u6ce8\u3002
\u7ed3\u6784\u8bf4\u660e
\u4e00\u822c\u6765\u8bf4\uff0c\u6784\u5efa\u540e\u6709\u4e24\u4e2a\u6587\u4ef6\u4f1a\u6bd4\u8f83\u5927\uff1ascripts.js
\u548c main.js
\uff0c\u800c\u6211\u4eec\u4f18\u5316\u4e5f\u4e3b\u8981\u9488\u5bf9\u8fd9\u4e24\u9879\u3002
scripts.js
\u5b83\u6765\u81ea\u662f angular.json
\u7684 scripts
\u8282\u70b9\u7684\u96c6\u5408\uff0c\u56e0\u6b64\uff0c\u8fd9\u4e2a\u6587\u4ef6\u7684\u5927\u5c0f\u53d6\u51b3\u4e8e scripts
\u8282\u70b9\u6240\u5f15\u7528\u7684\u7b2c\u4e09\u65b9\u7ec4\u4ef6\u7684\u5927\u5c0f\u3002
\u4e00\u822c\u6765\u8bf4\uff0c\u5f53\u4f60\u5728\u4f7f\u7528\u975e Angular \u7b2c\u4e09\u65b9\u7ec4\u4ef6\u65f6\u90fd\u5e94\u8be5\u653e\u5728 scripts
\u4e0b\u3002
main.js
\u9ed8\u8ba4\u4f7f\u7528 ng build
\u4f1a\u5c06\u6240\u6709 @angular/*
\u3001ng-zorro-antd
\u3001@delon/*
\u4ee5\u53ca\u4e00\u4e9b\u7b2c\u4e09\u65b9 Angular \u7ec4\u4ef6\u90fd\u4f1a\u88ab\u6253\u5305\u8fdb\u6765\uff0c\u9664\u975e\u4f60\u4f7f\u7528 --vendor-chunk
\u53c2\u6570\u6765\u5206\u79bb\u8fd9\u4e9b\u7c7b\u5e93\u3002
\u4f18\u5316\u5bf9\u8c61
\u6211\u4eec\u77e5\u9053\uff0cAngular Cli \u6253\u5305\u51fa\u6765\u7684\u8d44\u6e90\u6587\u4ef6\u4f1a\u5305\u542b\u8be5\u6587\u4ef6 hashing \u503c\uff0c\u5b83\u50cf\u662f\u6587\u4ef6\u7684\u552f\u4e00\u6807\u8bc6\u7801\uff0c\u82e5\u672a\u5bf9\u8be5\u6587\u4ef6\u8fdb\u884c\u6a21\u5757\u4fee\u6539\u90fd\u4e0d\u4f1a\u4ea7\u751f\u65b0\u7684 hashing \u503c\uff0c\u8fd9\u786e\u4fdd\u7528\u6237\u9996\u6b21\u4e0b\u8f7d\u8d44\u6e90\u540e\u4e0d\u7ba1\u6211\u4eec\u5982\u4f55\u518d\u6b21\u6784\u5efa\u7528\u6237\u90fd\u65e0\u987b\u518d\u4e00\u6b21\u4e0b\u8f7d\u3002
\u4e8b\u5b9e\u4e0a\uff0cAngular Cli \u9ed8\u8ba4\u5c06 --vendor-chunk
\u4e3b\u8981\u56e0\u7d20\u662f\u8fd9\u4e9b @angular/* \u76f8\u5bf9\u4e8e\u8fed\u4ee3\u5f88\u5feb\u3002
\u6839\u636e NG-ALAIN \u7684\u6a21\u5757\u6ce8\u518c\u6307\u5bfc\u539f\u5219\uff0c\u4ea7\u751f\u7684\u4e24\u4e2a shared-delon.module.ts
\u3001shared-zorro.module.ts
\u4e24\u4e2a\u4e13\u95e8\u9488\u5bf9 @Delon \u4e0e NG-ZORRO \u5171\u4eab\u6b21\u7ea7\u6a21\u5757\u5bfc\u5165\u7684\u6c47\u603b\u3002
@delon/abc
\u3001@delon/chart
\u3001ng-zorro-antd
\u4e09\u4e2a\u4e3b\u8981\u7c7b\u5e93\u90fd\u652f\u6301\u6b21\u7ea7\u5bfc\u5165\uff0c\u53ea\u9009\u62e9\u9879\u76ee\u6240\u9700\u8981\u7684\u6a21\u5757\u5c06\u6709\u6548\u7684\u89e3\u51b3\u5305\u4f53\u5927\u5c0f\u7684\u95ee\u9898\u3002
\u7ed3\u8bba
\u5f85 NG-ALAIN \u63d0\u4f9b\u66f4\u597d\u7684\u4f18\u5316\u652f\u6301\u540e\uff0c\u6211\u4eec\u4f1a\u53d1\u5e03 #684 \u5e0c\u671b\u5bf9\u5305\u4f53\u5927\u5c0f\u6709\u66f4\u597d\u7684
',meta:{order:80,title:{"en-US":"Performance","zh-CN":"\u4f18\u5316"},type:"Advance"},toc:[{id:"\u5305\u4f53\u5927\u5c0f\u4f18\u5316",title:"\u5305\u4f53\u5927\u5c0f\u4f18\u5316",h:2,children:[{id:"\u7ed3\u6784\u8bf4\u660e",title:"\u7ed3\u6784\u8bf4\u660e",h:3},{id:"\u4f18\u5316\u5bf9\u8c61",title:"\u4f18\u5316\u5bf9\u8c61",h:3},{id:"\u7ed3\u8bba",title:"\u7ed3\u8bba",h:3}]}]}},demo:!1},this.codes=[]}}return(e=o).\u0275fac=function(t){return new(t||e)},e.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-performance"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,i){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",i.codes)("item",i.item)},dependencies:[s.P],styles:["[_nghost-%COMP%]{display:block}"]}),o})()},{path:"server",redirectTo:"server/zh",pathMatch:"full"},{path:"server/:lang",component:(()=>{var e;class o{constructor(){this.item={cols:1,urls:{"en-US":"docs/server.en-US.md","zh-CN":"docs/server.zh-CN.md"},content:{"en-US":{content:'NG-ALAIN is a single-page application based on the Angular technology stack. We provide development models for front-end code and native analog data.\nWork in the form of the Restful API with the server application of any technology stack. The basics of interacting with the server are briefly described below.
Front-end request process
In NG-ALAIN, a complete front-end UI interaction to the server-side processing flow looks like this:
Start Angular for the first time to execute APP_INITIALIZER
;
UI component interaction;
Send the request using the encapsulated _HttpClient;
Trigger the user authentication interceptor @delon/auth and add the token
parameter uniformly;
If there is no token
or an expired interrupt subsequent request, jump directly to the login page;
Trigger the default interceptor to process the prefix and other information;
Get the server back;
Trigger the default interceptor to handle request exceptions, business exceptions, etc.
Update the data and refresh the UI.
Interceptor
By default, two interceptors are registered in the root module.SimpleInterceptor with DefaultInterceptorAnd the execution order is executed in the registration order.
SimpleInterceptor
User Authentication has built-in interceptors for automatically adding token
parameters to requests. There is also a JWTInterceptor interceptor, which is a standard JWT specification. If the backend uses standard JWT, it can be directly replaced with a JWTInterceptor interceptor.
DefaultInterceptor
DefaultInterceptor The interceptor simply provides an interceptor. By default, it contains sample code that handles server request prefixes, handles request exceptions, and business exceptions. You can make adjustments based on your own needs.
Important point
We can put the next.handle(req)
as the demarcation point in the interceptor intercept
method. The first part is the request and the pipe
part is the post. This will make it clearer which part is to be done before the request and which part will be executed after the request. For more information on interceptors, please refer to the official website.
Development environment
Under normal circumstances, the development environment and the production environment are not the same back-end request source. You can actually configure it under the environment directory. environment.ts and environment.prod.ts Change the request source for different environments.
environment is actually a JSON object, you can organize different forms to meet the problem of multiple request sources.
Mock
Sometimes when you want to develop the front-end first, you can use @delon/mock to simulate the request data. The actual principle is to use the interceptor to directly return the data to the matching URL instead of sending an HTTP request. By default, it is only valid for the test environment. Of course, you usually need to make sure that the data of the Mock interface is consistent with the backend. You can create the corresponding Mock interface in the _mock
directory:
export const USERS = {\n \'GET /users\': { users: [1, 2], total: 2 }\n}
So for the test environment, when the /users
request is encountered, the {users: [1, 2], total: 2 }
data is returned directly. See here for more Mock syntax and usage.
Note: When you don\'t need a Mock interface for a request, be sure to comment out or remove it.
Cors
Most applications will be front-end is separate from the back-end, which leads to CORS factors when a request is made to the back end, such as:
http.get(`http://192.168.1.100/api/app`).subscribe();
Note: If the request does not start with http
, each request will add environment.SERVER_URL
as the leading edge of the request URL.
The following error is returned directly:
Access to XMLHttpRequest at \'http://192.168.1.100/api/app\' from origin \'http://localhost:4200\' has been blocked by CORS policy: No \'Access-Control-Allow-Origin\' header is present on the requested resource.
There are usually two ways to solve cross-domain problems. One is to allow the back-end development environment to directly support CORS requests (not recommended, but simplest), the second is to use Angular Cli to provide Proxy Support, the development proxy server will forward the domain and port of the request sent by Angular to the backend Server, CORS is a security restriction of the browser. There is no problem with CORS before the proxy server and the backend server. This is why many people try to make it clear that they can be requested in Postman but not in Angular.
Assuming that all backend requests are prefixed with /api
, you can configure all this prefix in proxy.conf.js
to forward to the new backend, for example:
module.exports = {\n \'/api\': {\n target: \'http://192.168.1.100/api\',\n secure: false\n }\n}
/api
Proxy path, domain is not supported
target
Proxy target address
secure
If the proxy target address is https
, it should be set to true
, otherwise it is false
pathRewrite
Rewrite the address, such as pathRewrite: {\'^/api\':\'/\'}
to change the prefix /api
to /
changeOrigin
Change the host
of the host header to the target URL. Some backends will judge whether it is valid according to its value. You may need to set true
logLevel
Set to debug
to display the message forwarded by the agent on the terminal
Abort more detail please refer to Proxying to a backend server, and for configuration description please refer to http-proxy-middleware options.
Common problem
Q: The request may be rejected or returned directly to 401
?
Scaffolding uses the SimpleInterceptor
interceptor of @delon/auth
by default, which causes an error to be returned directly if a token cannot be obtained during the request.
User Authentication This process is a must for the middle of
',meta:{order:40,title:"Work with Server",type:"Dev"},toc:[{id:"Front-endrequestprocess",title:"Front-end request process",h:2,children:[{id:"Interceptor",title:"Interceptor",h:3}]},{id:"Developmentenvironment",title:"Development environment",h:2},{id:"Mock",title:"Mock",h:2},{id:"Cors",title:"Cors",h:2},{id:"Commonproblem",title:"Common problem",h:2}]},"zh-CN":{content:'NG-ALAIN \u662f\u4e00\u5957\u57fa\u4e8e Angular \u6280\u672f\u6808\u7684\u5355\u9875\u9762\u5e94\u7528\uff0c\u6211\u4eec\u63d0\u4f9b\u7684\u662f\u524d\u7aef\u4ee3\u7801\u548c\u672c\u5730\u6a21\u62df\u6570\u636e\u7684\u5f00\u53d1\u6a21\u5f0f\uff0c\n\u901a\u8fc7 Restful API \u7684\u5f62\u5f0f\u548c\u4efb\u4f55\u6280\u672f\u6808\u7684\u670d\u52a1\u7aef\u5e94\u7528\u4e00\u8d77\u5de5\u4f5c\u3002\u4e0b\u9762\u5c06\u7b80\u5355\u4ecb\u7ecd\u548c\u670d\u52a1\u7aef\u4ea4\u4e92\u7684\u57fa\u672c\u5199\u6cd5\u3002
\u524d\u7aef\u8bf7\u6c42\u6d41\u7a0b
\u5728 NG-ALAIN \u4e2d\uff0c\u4e00\u4e2a\u5b8c\u6574\u7684\u524d\u7aef UI \u4ea4\u4e92\u5230\u670d\u52a1\u7aef\u5904\u7406\u6d41\u7a0b\u662f\u8fd9\u6837\u7684\uff1a
\u9996\u6b21\u542f\u52a8 Angular \u6267\u884c APP_INITIALIZER
\uff1b
UI \u7ec4\u4ef6\u4ea4\u4e92\u64cd\u4f5c\uff1b
\u4f7f\u7528\u5c01\u88c5\u7684 _HttpClient \u53d1\u9001\u8bf7\u6c42\uff1b
\u89e6\u53d1\u7528\u6237\u8ba4\u8bc1\u62e6\u622a\u5668 @delon/auth\uff0c\u7edf\u4e00\u52a0\u5165 token
\u53c2\u6570\uff1b
\u82e5\u672a\u5b58\u5728 token
\u6216\u5df2\u8fc7\u671f\u4e2d\u65ad\u540e\u7eed\u8bf7\u6c42\uff0c\u76f4\u63a5\u8df3\u8f6c\u81f3\u767b\u5f55\u9875\uff1b
\u89e6\u53d1\u9ed8\u8ba4\u62e6\u622a\u5668\uff0c\u7edf\u4e00\u5904\u7406\u524d\u7f00\u7b49\u4fe1\u606f\uff1b
\u83b7\u53d6\u670d\u52a1\u7aef\u8fd4\u56de\uff1b
\u89e6\u53d1\u9ed8\u8ba4\u62e6\u622a\u5668\uff0c\u7edf\u4e00\u5904\u7406\u8bf7\u6c42\u5f02\u5e38\u3001\u4e1a\u52a1\u5f02\u5e38\u7b49\uff1b
\u6570\u636e\u66f4\u65b0\uff0c\u5e76\u5237\u65b0 UI\u3002
\u62e6\u622a\u5668
\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5728\u6839\u6a21\u5757\u6ce8\u518c\u4e86\u4e24\u4e2a\u62e6\u622a\u5668 SimpleInterceptor \u548c DefaultInterceptor\uff0c\u4e14\u6267\u884c\u987a\u5e8f\u6309\u6ce8\u518c\u987a\u5e8f\u6267\u884c\u3002
SimpleInterceptor
\u7528\u6237\u8ba4\u8bc1\u5185\u7f6e\u7528\u4e8e\u81ea\u52a8\u4e3a\u8bf7\u6c42\u6dfb\u52a0 token
\u53c2\u6570\u7684\u62e6\u622a\u5668\u3002\u8fd9\u91cc\u8fd8\u6709\u4e00\u4e2a\u53eb JWTInterceptor \u62e6\u622a\u5668\uff0c\u662f\u4e00\u4e2a\u6807\u51c6 JWT \u89c4\u8303\uff0c\u82e5\u540e\u7aef\u91c7\u7528\u6807\u51c6JWT\u53ef\u4ee5\u76f4\u63a5\u6362\u6210JWTInterceptor\u62e6\u622a\u5668\u3002
DefaultInterceptor
DefaultInterceptor \u62e6\u622a\u5668\u53ea\u662f\u63d0\u4f9b\u4e00\u4e2a\u62e6\u622a\u5668\u7684\u5199\u6cd5\uff0c\u9ed8\u8ba4\u5305\u542b\u4e86\u7edf\u4e00\u5904\u7406\u670d\u52a1\u5668\u8bf7\u6c42\u524d\u7f00\u3001\u5904\u7406\u8bf7\u6c42\u5f02\u5e38\u53ca\u4e1a\u52a1\u5f02\u5e38\u7684\u793a\u4f8b\u4ee3\u7801\uff0c\u4f60\u53ef\u4ee5\u6839\u636e\u4f60\u81ea\u5df1\u7684\u9700\u6c42\u505a\u8c03\u6574\u3002
\u6ce8\u610f\u70b9
\u6211\u4eec\u53ef\u4ee5\u628a\u62e6\u622a\u5668 intercept
\u65b9\u6cd5\u5185\uff0c\u4ee5 next.handle(req)
\u4e3a\u5206\u754c\u70b9\uff0c\u524d\u90e8\u5206\u4e3a\u8bf7\u6c42\u524d\uff0cpipe
\u90e8\u5206\u4e3a\u63a5\u6536\u540e\u3002\u8fd9\u6837\u4f1a\u66f4\u660e\u786e\u77e5\u9053\u54ea\u4e00\u90e8\u5206\u662f\u8bf7\u6c42\u524d\u8981\u505a\uff0c\u54ea\u4e00\u90e8\u5206\u662f\u8bf7\u6c42\u540e\u4f1a\u6267\u884c\u7684\u3002\u6709\u5173\u66f4\u591a\u62e6\u622a\u5668\u77e5\u8bc6\u8bf7\u53c2\u8003\u5b98\u7f51\u3002
\u5f00\u53d1\u73af\u5883
\u6b63\u5e38\u60c5\u51b5\u4e0b\u5f00\u53d1\u73af\u5883\u548c\u751f\u4ea7\u73af\u5883\u4e0d\u662f\u540c\u4e00\u4e2a\u540e\u7aef\u8bf7\u6c42\u6e90\uff0c\u5b9e\u9645\u53ef\u4ee5\u901a\u8fc7\u914d\u7f6e environment \u76ee\u5f55\u4e0b environment.ts \u548c environment.prod.ts \u6539\u53d8\u4e0d\u540c\u73af\u5883\u7684\u8bf7\u6c42\u6e90\u3002
environment \u5b9e\u9645\u662f\u4e00\u4e2aJSON\u5bf9\u8c61\uff0c\u53ef\u4ee5\u7ec4\u7ec7\u4e0d\u540c\u5f62\u5f0f\u6765\u6ee1\u8db3\u591a\u8bf7\u6c42\u6e90\u7684\u95ee\u9898\u3002
Mock
\u6709\u65f6\u5019\u5e0c\u671b\u4f18\u5148\u5f00\u53d1\u524d\u7aef\u65f6\uff0c\u53ef\u4ee5\u5229\u7528 @delon/mock \u6765\u6a21\u62df\u8bf7\u6c42\u6570\u636e\uff0c\u5b9e\u9645\u539f\u7406\u662f\u5229\u7528\u62e6\u622a\u5668\uff0c\u5bf9\u5339\u914d\u7684URL\u76f4\u63a5\u8fd4\u56de\u6570\u636e\uff0c\u800c\u4e0d\u662f\u53d1\u9001\u4e00\u4e2aHTTP\u8bf7\u6c42\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u53ea\u5bf9\u6d4b\u8bd5\u73af\u5883\u6709\u6548\u3002\u5f53\u7136\u901a\u5e38\u60c5\u51b5\u4e0b\u4f60\u9700\u8981\u786e\u4fdd Mock \u63a5\u53e3\u7684\u6570\u636e\u4e0e\u540e\u7aef\u4fdd\u6301\u4e00\u81f4\uff0c\u4f60\u53ef\u4ee5\u5728 _mock
\u76ee\u5f55\u4e0b\u521b\u5efa\u76f8\u5e94\u7684 Mock \u63a5\u53e3\uff1a
export const USERS = {\n \'GET /users\': { users: [1, 2], total: 2 }\n}
\u56e0\u6b64\u5bf9\u4e8e\u6d4b\u8bd5\u73af\u5883\u4e0b\u5f53\u9047\u5230 /users
\u8bf7\u6c42\u76f4\u63a5\u8fd4\u56de { users: [1, 2], total: 2 }
\u6570\u636e\u3002\u6709\u5173\u66f4\u591a Mock \u8bed\u6cd5\u548c\u4f7f\u7528\u65b9\u5f0f\u53c2\u8003\u8fd9\u91cc\u3002
\u6ce8\uff1a \u5f53\u4f60\u4e0d\u9700\u8981\u67d0\u4e2a\u8bf7\u6c42\u7684 Mock \u63a5\u53e3\u65f6\uff0c\u52a1\u5fc5\u8981\u6ce8\u91ca\u6389\u6216\u79fb\u9664\u5b83\u3002
\u8de8\u57df
\u5927\u90e8\u5206\u5e94\u7528\u90fd\u4f1a\u524d\u540e\u7aef\u5206\u79bb\u8fdb\u884c\u5f00\u53d1\uff0c\u8fd9\u5bfc\u81f4\u5f53\u5bf9\u540e\u7aef\u53d1\u8d77\u4e00\u4e2a\u8bf7\u6c42\u65f6\u4f1a\u53d7\u8de8\u57df\uff08CORS\uff09\u7684\u56e0\u7d20\uff0c\u4f8b\u5982\uff1a
http.get(`http://192.168.1.100/api/app`).subscribe();
\u6ce8\uff1a\u5982\u679c\u975e http
\u5f00\u5934\u7684\u8bf7\u6c42\uff0c\u4f1a\u5728\u6bcf\u4e2a\u8bf7\u6c42\u90fd\u4f1a\u52a0\u4e0a environment.SERVER_URL
\u4f5c\u4e3a\u8bf7\u6c42 URL \u7684\u524d\u7f18\u3002
\u76f4\u63a5\u8fd4\u56de\u4ee5\u4e0b\u9519\u8bef\uff1a
Access to XMLHttpRequest at \'http://192.168.1.100/api/app\' from origin \'http://localhost:4200\' has been blocked by CORS policy: No \'Access-Control-Allow-Origin\' header is present on the requested resource.
\u800c\u6b63\u5e38\u89e3\u51b3\u8de8\u57df\u95ee\u9898\u6709\u4e24\u79cd\u65b9\u6cd5\uff0c\u4e00\u662f\u8ba9\u540e\u7aef\u5f00\u53d1\u73af\u5883\u76f4\u63a5\u652f\u6301\u8de8\u57df\u8bf7\u6c42\uff08\u4e0d\u63a8\u8350\uff0c\u4f46\u6700\u7b80\u5355\uff09\uff0c\u4e8c\u662f\u5229\u7528 Angular Cli \u63d0\u4f9b\u4ee3\u7406\u652f\u6301\uff0c\u5f00\u53d1\u4ee3\u7406\u670d\u52a1\u5668\u4f1a\u5c06 Angular \u53d1\u9001\u7684\u8bf7\u6c42\u7684\u57df\u548c\u7aef\u53e3\u8f6c\u53d1\u7ed9\u540e\u7aef\u670d\u52a1\u5668\uff0cCORS \u662f\u6d4f\u89c8\u5668\u7684\u5b89\u5168\u9650\u5236\uff0c\u5728\u4ee3\u7406\u670d\u52a1\u5668\u4e0e\u540e\u7aef\u670d\u52a1\u5668\u4e4b\u524d\u5e76\u4e0d\u5b58\u5728 CORS \u7684\u95ee\u9898\uff0c\u8fd9\u4e5f\u5c31\u662f\u4e3a\u4ec0\u4e48\u5f88\u591a\u4eba\u4f1a\u5c1d\u8bd5\u660e\u660e\u5728 Postman \u80fd\u8bf7\u6c42\uff0c\u800c\u5728 Angular \u4e0b\u65e0\u6cd5\u8bf7\u6c42\u7684\u539f\u56e0\u6240\u5728\u3002
\u5047\u5b9a\u6240\u6709\u540e\u7aef\u8bf7\u6c42\u90fd\u662f\u4ee5 /api
\u4e3a\u524d\u7f00\u65f6\uff0c\u5c31\u53ef\u4ee5\u5728 proxy.conf.js
\u914d\u7f6e\u6240\u6709\u8fd9\u4e2a\u524d\u7f00\u90fd\u8f6c\u5411\u65b0\u7684\u540e\u7aef\uff0c\u4f8b\u5982\uff1a
module.exports = {\n \'/api\': {\n target: \'http://192.168.1.100/api\',\n secure: false\n }\n}
/api
\u4ee3\u7406\u8def\u5f84\uff0c\u4e0d\u652f\u6301\u57df
target
\u4ee3\u7406\u76ee\u6807\u5730\u5740
secure
\u4ee3\u7406\u76ee\u6807\u5730\u5740\u5982\u679c\u662f https
\u5e94\u8be5\u8bbe\u7f6e\u4e3a true
\uff0c\u53cd\u4e4b\u4e3a false
pathRewrite
\u91cd\u5199\u5730\u5740\uff0c\u4f8b\u5982 pathRewrite: {\'^/api\': \'/\'}
\u5c06\u524d\u7f00 /api
\u8f6c\u4e3a /
changeOrigin
\u5c06\u4e3b\u673a\u6807\u5934\u7684 host
\u66f4\u6539\u4e3a\u76ee\u6807URL\uff0c\u6709\u4e9b\u540e\u7aef\u4f1a\u6839\u636e\u5176\u503c\u6765\u5224\u65ad\u662f\u5426\u6709\u6548\uff0c\u53ef\u80fd\u9700\u8981\u901a\u8fc7\u8bbe\u7f6e true
logLevel
\u8bbe\u7f6e\u4e3a debug
\u53ef\u4ee5\u7ec8\u7aef\u663e\u793a\u4ee3\u7406\u8f6c\u53d1\u7684\u6d88\u606f
\u66f4\u591a\u4f7f\u7528\u8bf4\u660e\u8bf7\u53c2\u8003\u4ee3\u7406\u5230\u540e\u7aef\u670d\u52a1\u5668\uff0c\u4ee5\u53ca\u914d\u7f6e\u63cf\u8ff0\u8bf7\u53c2\u8003http-proxy-middleware options\u3002
\u5e38\u89c1\u95ee\u9898
Q\uff1a \u8bf7\u6c42\u53ef\u80fd\u88ab\u62d2\u7edd\u6216\u76f4\u63a5\u8fd4\u56de 401
?
\u811a\u624b\u67b6\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4f7f\u7528\u4e86 @delon/auth
\u7684 SimpleInterceptor
\u62e6\u622a\u5668\uff0c\u5bfc\u81f4\u5728\u8bf7\u6c42\u8fc7\u7a0b\u4e2d\u82e5\u53d1\u73b0\u65e0\u6cd5\u83b7\u53d6 Token \u65f6\u4f1a\u76f4\u63a5\u8fd4\u56de\u9519\u8bef\u3002
\u7528\u6237\u8ba4\u8bc1\u8fd9\u4e2a\u8fc7\u7a0b\u662f\u4e2d
',meta:{order:40,title:"\u548c\u670d\u52a1\u7aef\u8fdb\u884c\u4ea4\u4e92",type:"Dev"},toc:[{id:"\u524d\u7aef\u8bf7\u6c42\u6d41\u7a0b",title:"\u524d\u7aef\u8bf7\u6c42\u6d41\u7a0b",h:2,children:[{id:"\u62e6\u622a\u5668",title:"\u62e6\u622a\u5668",h:3}]},{id:"\u5f00\u53d1\u73af\u5883",title:"\u5f00\u53d1\u73af\u5883",h:2},{id:"Mock",title:"Mock",h:2},{id:"\u8de8\u57df",title:"\u8de8\u57df",h:2},{id:"\u5e38\u89c1\u95ee\u9898",title:"\u5e38\u89c1\u95ee\u9898",h:2}]}},demo:!1},this.codes=[]}}return(e=o).\u0275fac=function(t){return new(t||e)},e.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-server"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,i){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",i.codes)("item",i.item)},dependencies:[s.P],styles:["[_nghost-%COMP%]{display:block}"]}),o})()},{path:"ssr",redirectTo:"ssr/zh",pathMatch:"full"},{path:"ssr/:lang",component:(()=>{var e;class o{constructor(){this.item={cols:1,urls:{"zh-CN":"docs/ssr.md"},content:{"zh-CN":{content:'\u672c\u6587\u63cf\u8ff0\u7684\u662f NG-ALAIN \u5982\u4f55\u652f\u6301\u670d\u52a1\u7aef\u6e32\u67d3\uff08SSR\uff09\u3002
NG-ALAIN \u4e0d\u63a8\u8350\u5728\u4e2d\u540e\u53f0\u4f7f\u7528\u670d\u52a1\u7aef\u6e32\u67d3\uff08SSR\uff09\uff0c\u8fd9\u662f\u56e0\u4e3a\u4e2d\u540e\u53f0\u672c\u8eab\u5bf9\u4e8eSSR\u6240\u5e26\u6765\u7684\u597d\u5904\u8fdc\u5927\u4e8e\u5f00\u53d1\u5e26\u6765\u7684\u9ebb\u70e6\uff0c\u4f46\u4e0d\u7ba1\u600e\u4e48\u6837\u5728\u8bb8\u591a\u4eba\u7684\u8981\u6c42\u4e0b\uff0c\u4ece 9.5
\u7248\u672c\u5f00\u59cb\uff0c\u5df2\u7ecf\u5bf9\u6240\u6709 @delon/*
\u7c7b\u5e93\u652f\u6301\u670d\u52a1\u7aef\u6e32\u67d3\u3002
\u5f00\u59cb\u4e4b\u524d
\u5728\u5f00\u59cb\u4e4b\u524d\u8bf7\u5148\u9605\u8bfb\u4ee5\u4e0b\u6587\u7ae0\uff0c\u5b83\u4eec\u80fd\u591f\u66f4\u52a0\u5feb\u901f\u8ba9\u4f60\u4e86\u89e3 Angular \u670d\u52a1\u7aef\u6e32\u67d3\u662f\u5982\u4f55\u5de5\u4f5c\u7684\uff1a
Angular Universal\uff1aAngular \u7edf\u4e00\u5e73\u53f0\u7b80\u4ecb
Partial Server Side Rendering with Angular 9 and How to Deploy it
\u6559\u7a0b
\u6dfb\u52a0 @nguniversal/express-engine
\u5728\u4e00\u4e2a\u5b8c\u6574\u7684 NG-ALAIN \u9879\u76ee\u4e0b\uff0c\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a
ng add @nguniversal/express-engine
\u6700\u540e\u8fd0\u884c\uff1a
npm run dev:ssr
\u6b64\u65f6\u4f1a\u4ee5 SSR \u7684\u5f62\u5f0f\u8fd0\u884c NG-ALAIN\u3002
\u4f46\u5982\u679c\u91c7\u7528\u9ed8\u8ba4 LocalStorageStore
\u6765\u5b58\u50a8 Token \u7684\u60c5\u51b5\u4e0b\uff0c\u4f1a\u63d0\u793a\u627e\u4e0d\u5230 localStorage
\u7684\u9519\u8bef\uff0c\u8fd9\u662f\u56e0\u4e3a\u670d\u52a1\u7aef\u5e76\u6ca1\u6709\u8fd9\u4e9b\uff0c\u5b83\u4eec\u53ef\u80fd\u8fd8\u5305\u542b window
\u3001document
\u3001sessionStorage
\u7b49\u3002
\u56e0\u6b64\uff0c\u8981\u60f3\u5728\u4e2d\u540e\u53f0\u5f88\u597d\u7684\u652f\u6301 SSR\uff0c\u9700\u8981\u5206\u6790\u6240\u4f9d\u8d56\u7684\u7b2c\u4e09\u65b9\u7c7b\u5e93\u662f\u5426\u652f\u6301 SSR\uff0c\u5982\u679c\u6ca1\u6709\u5fc5\u987b\u624b\u52a8\u5904\u7406\u5728\u670d\u52a1\u7aef\u4e0b\u4e0d\u6e32\u67d3\u8fd9\u4e9b\u7ec4\u4ef6\u3002
\u4e22\u5931Token
\u670d\u52a1\u7aef\u662f\u65e0\u72b6\u6001\u7684\uff0c\u56e0\u6b64\u5224\u65ad\u8bf7\u6c42\u662f\u5426\u6709\u6548\u6388\u6743\uff0c\u76ee\u524d\u901a\u7528\u7684\u505a\u6cd5\u662f\u5c06 Token \u5b58\u50a8\u5728 Cookie \u4e0b\uff0c\u5728\u670d\u52a1\u7aef\u63a5\u6536\u8bf7\u6c42\u65f6\u518d\u6839\u636e Cookies \u6765\u83b7\u53d6 Token \u4fe1\u606f\u3002\x1c
\u867d\u7136 NG-ALAIN \u63d0\u4f9b CookieStorageStore
\u4f46\u5b83\u5e76\u4e0d\u652f\u6301\u670d\u52a1\u7aef SSR \u8bbf\u95ee Cookie\uff0c\u56e0\u6b64\u9700\u8981\u624b\u52a8\u6784\u5efa\u9488\u5bf9 SSR \u7684 Token \u6301\u4e45\u5316\u5b58\u50a8\u3002
\u63a8\u8350\u4f7f\u7528 @ngx-utils/cookies \u6765\u5904\u7406 Cookies\uff0c\u5b83\u540c\u65f6\u652f\u6301\u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u7aef\u3002
\u6ce8\u610f\uff1a \u53d7\u9650\u4e8e #20 \u7684\u539f\u56e0\uff0c\u7531\u4e8e\u4e00\u76f4\u672a\u5904\u7406\uff0c\u6709\u4eba\u4e13\u95e8\u89e3\u51b3\u4e86\u8fd9\u4e2a\u95ee\u9898\u5e76\u53d1\u5e03\u4e00\u4e2a\u65b0\u7c7b\u5e93 ngx-utils-cookies-port\uff0c\u6682\u65f6\u53ea\u80fd\u4f7f\u7528\u5b83\u6765\u4ee3\u66ff @ngx-utils/cookies
\uff0c\u7528\u6cd5\u4e00\u6a21\u4e00\u6837\u53ea\u662f\u6a21\u5757\u540d\u6362\u4e00\u4e0b\uff0c\u5728\u4fee\u590d\u4e4b\u540e\u518d\u6362\u56de\u6765\u3002
\u8981\u521b\u5efa\u4e00\u4e2a\u7b26\u5408 @delon/auth
\u63a5\u53e3\u6301\u4e45\u5316\u5b58\u50a8\u7c7b\uff0c\u53ea\u9700\u8981\u7ee7\u627f IStore
\u5373\u53ef\uff0c\u4f8b\u5982\uff1a
import { Injectable } from \'@angular/core\';\nimport { IStore, ITokenModel } from \'@delon/auth\';\nimport { CookiesService } from \'ngx-utils-cookies-port\';\n\n@Injectable()\nexport class AuthStorageStore implements IStore {\n constructor(private cookies: CookiesService) {}\n\n get(key: string): ITokenModel {\n return JSON.parse(this.cookies.get(key) || \'{}\') || {};\n }\n\n set(key: string, value: ITokenModel | null): boolean {\n this.cookies.put(key, JSON.stringify(value));\n return true;\n }\n\n remove(key: string) {\n this.cookies.remove(key);\n }\n}
\u6700\u540e\uff0c\u5728 global-config.module.ts
\u5185\u91cd\u65b0\u6ce8\u518c\u5b83\uff1a
const alainProvides = [\n { provide: ALAIN_CONFIG, useValue: alainConfig },\n+ { provide: DA_STORE_TOKEN, useClass: AuthStorageStore },\n ];
\u6ce8\u610f\uff1a\u8fd9\u91cc\u4f9d\u7136\u9700\u8981\u6ce8\u518c\u65b0\u589e\u7684\u6a21\u5757\uff0c\u65b9\u6cd5\u8bf7\u53c2\u8003 @ngx-utils/cookies \u8bf4\u660e\u3002
@ngx-utils/cookies
\u5185\u90e8\u4f1a\u6839\u636e REQUEST
\u6765\u83b7\u53d6\u5f53\u524d\u7684\u8bf7\u6c42\u5934\u4fe1\u606f\uff0c\u56e0\u6b64\uff0c\u6211\u4eec\u8fd8\u9700\u8981\u4fee\u6539 server.ts
\uff1a
// All regular routes use the Universal engine\n server.get(\'*\', (req, res) => {\n res.render(indexHtml, {\n req,\n+ res,\n providers: [\n { provide: APP_BASE_HREF, useValue: req.baseUrl },\n+ { provide: \'REQUEST\', useValue: req },\n+ { provide: \'RESPONSE\', useValue: res },\n ],\n });\n });',meta:{order:110,title:"\u670d\u52a1\u7aef\u6e32\u67d3\uff08SSR\uff09",type:"Dev"},toc:[{id:"\u5f00\u59cb\u4e4b\u524d",title:"\u5f00\u59cb\u4e4b\u524d",h:2},{id:"\u6559\u7a0b",title:"\u6559\u7a0b",h:2,children:[{id:"\u6dfb\u52a0@nguniversal/express-engine",title:"\u6dfb\u52a0 @nguniversal/express-engine",h:3},{id:"\u4e22\u5931Token",title:"\u4e22\u5931Token",h:3}]}]}},demo:!1},this.codes=[]}}return(e=o).\u0275fac=function(t){return new(t||e)},e.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-ssr"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,i){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",i.codes)("item",i.item)},dependencies:[s.P],styles:["[_nghost-%COMP%]{display:block}"]}),o})()},{path:"style-guide",redirectTo:"style-guide/zh",pathMatch:"full"},{path:"style-guide/:lang",component:(()=>{var e;class o{constructor(){this.item={cols:1,urls:{"en-US":"docs/style-guide.en-US.md","zh-CN":"docs/style-guide.zh-CN.md"},content:{"en-US":{content:'The project built by Angular CLI is already very good in terms of its directory structure. Official website also has an Angular Style Guide (Chinese version) Style guide. It is recommended to read it several times. In addition, NG-ALAIN also has a part of the coding style, the following instructions may be useful for reading the code.
Consistent code style
NG-ALAIN uses ESLint to guarantee code quality and Prettier to optimize the code style.
It is recommended to install several plugins for more friendly development in vscode:
Of course, NG-ALAIN has prepared a complete set of extension packs for everyone, just install NG-ALAIN Extension Pack.
Git - pre commit Hook
The ng lint
command provided by Angular, can be very effective in helping us find bugs and readability earlier. Isn\'t it cool if we can guarantee that the lint of the file in staged is automatically done before each commit in the team development process?
NG-ALAIN is configured to do lint each time you commit to staged and you can\'t commit if you find an error.
By default, the *.ts
, *.less
commit process forces the formatting of the code. You can change the rules by modifying the husky
node of package.json
.
If hint: The\'.husky/pre-commit\' hook was ignored because it\'s not set as executable. is generated when executing git commit -m "commit"
, it may be due to permission issues. Try to execute in the project root directory:
chmod ug+x .husky/*\nchmod ug+x .git/hooks/*
Style guide
API documentation
Applications are always inevitable for the development of business components. We can not guarantee that you can remember these after a certain time. So, make sure to include the README.md
document in each business component and describe the API, DEMO and other information.
For example:
## When do you use it?\n\nInstruction\n\n## DEMO\n\nInstruction\n\n## API\n\nParameter | Description | Type | Default\n----|------|-----|------\nsrc | The map\'s address | `string` | -
Module registration
Please parameter module registration guidelines.
Auxiliary item
NG-ALAIN is configured with some options for the CLI to better code.
CLI
Vscode is the best choice for writing Angular. You can type: ng g c list
in any directory of the project to generate the corresponding files for the component.
NG-ALAIN is configured by default without generating style files & unit tests. So you will see that only .ts
, .html
are generated. This is because NG-ALAIN provides a very rich style API, and custom styles are not just needed on most pages. At the same time, unit tests.
Of course, you can easily adjust the default configuration in angular.json
.
VSCode snippets
VSCode is the best choice for writing Angular. Naturally NG-ALAIN also created the corresponding snippets extension: ng-zorro-vscode and ng-alain-vscode
',meta:{order:90,title:{"en-US":"Style Guide","zh-CN":"\u7f16\u7801\u89c4\u8303\u5efa\u8bae"},type:"Advance"},toc:[{id:"Consistentcodestyle",title:"Consistent code style",h:2},{id:"Git-precommitHook",title:"Git - pre commit Hook",h:2},{id:"Styleguide",title:"Style guide",h:2,children:[{id:"APIdocumentation",title:"API documentation",h:3},{id:"Moduleregistration",title:"Module registration",h:3}]},{id:"Auxiliaryitem",title:"Auxiliary item",h:2,children:[{id:"CLI",title:"CLI",h:3},{id:"VSCodesnippets",title:"VSCode snippets",h:3}]}]},"zh-CN":{content:'Angular CLI \u6784\u5efa\u7684\u9879\u76ee\u5c31\u5176\u76ee\u5f55\u7ed3\u6784\u800c\u8a00\u5df2\u7ecf\u975e\u5e38\u68d2\u4e86\uff0c\u540c\u65f6\u5b98\u7f51\u4e5f\u6709\u4e00\u4efd Angular Style Guide\uff08\u4e2d\u6587\u7248\uff09\u98ce\u683c\u6307\u5357\uff0c\u5efa\u8bae\u597d\u597d\u9605\u8bfb\u51e0\u904d\u3002\u9664\u6b64\u4e4b\u5916\uff0cNG-ALAIN \u4e5f\u6709\u4e00\u90e8\u5206\u7f16\u7801\u98ce\u683c\uff0c\u5982\u4e0b\u8bf4\u660e\u53ef\u80fd\u5bf9\u4e8e\u4f60\u9605\u8bfb\u4ee3\u7801\u65f6\u6709\u7528\u3002
\u4e00\u81f4\u7684\u4ee3\u7801\u98ce\u683c
NG-ALAIN \u4f7f\u7528 ESLint \u6765\u4fdd\u8bc1\u4ee3\u7801\u8d28\u91cf \u4e0e Prettier \u6765\u4f18\u5316\u4ee3\u7801\u98ce\u683c\u3002
\u63a8\u8350\u5b89\u88c5\u51e0\u4e2a\u63d2\u4ef6\u5728 vscode \u4e2d\u66f4\u53cb\u597d\u7684\u5f00\u53d1\uff1a
\u5f53\u7136\uff0cNG-ALAIN \u4e3a\u5927\u5bb6\u51c6\u5907\u4e86\u4e00\u5957\u5b8c\u6574\u7684\u6269\u5c55\u5305\uff0c\u53ea\u9700\u8981\u5b89\u88c5 NG-ALAIN Extension Pack \u5373\u53ef\u3002
Git - pre commit \u52fe\u5b50
Angular \u63d0\u4f9b\u7684 ng lint
\u547d\u4ee4\u53ef\u4ee5\u975e\u5e38\u6709\u6548\u7684\u5e2e\u52a9\u6211\u4eec\u66f4\u65e9\u53d1\u73b0bug\u3001\u66f4\u9ad8\u7684\u53ef\u8bfb\u6027\uff1b\u5982\u679c\u6211\u4eec\u80fd\u591f\u4fdd\u8bc1\u56e2\u961f\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u6bcf\u4e00\u6b21 commit \u524d\u90fd\u81ea\u52a8\u505a\u4e00\u6b21 staged \u4e2d\u6587\u4ef6\u7684 lint \u7684\u8bdd\uff0c\u90a3\u4e0d\u662f\u975e\u5e38\u9177\u5417\uff1f
NG-ALAIN \u914d\u7f6e\u4e86\u6bcf\u6b21\u5bf9 staged \u8fdb\u884c commit \u65f6\u4f1a\u9884\u5148\u505a lint\uff0c\u82e5\u53d1\u73b0\u9519\u8bef\u5219\u65e0\u6cd5\u63d0\u4ea4\u3002
\u9ed8\u8ba4\u5f00\u542f\u4e86 *.ts
\u3001*.less
\u7684\u63d0\u4ea4\u8fc7\u7a0b\u4e2d\u5f3a\u5236\u5bf9\u4ee3\u7801\u8fdb\u884c\u683c\u5f0f\u5316\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539 package.json
\u7684 husky
\u8282\u70b9\u6765\u6539\u53d8\u4e9b\u89c4\u5219\u3002
\u82e5\u5728\u6267\u884c git commit -m "commit"
\u65f6\u82e5\u4ea7\u751f hint: The \'.husky/pre-commit\' hook was ignored because it\'s not set as executable. \u65f6\uff0c\u53ef\u80fd\u662f\u56e0\u4e3a\u6743\u9650\u95ee\u9898\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u5728\u9879\u76ee\u6839\u76ee\u5f55\u4e0b\u6267\u884c\uff1a
chmod ug+x .husky/*\nchmod ug+x .git/hooks/*
\u98ce\u683c\u6307\u5357
API\u6587\u6863
\u5e94\u7528\u603b\u662f\u514d\u4e0d\u4e86\u4e1a\u52a1\u7ec4\u4ef6\u7684\u5f00\u53d1\uff0c\u6211\u4eec\u65e0\u6cd5\u4fdd\u8bc1\u82e5\u5e72\u65f6\u95f4\u4e4b\u540e\u4f60\u8fd8\u80fd\u8bb0\u5f97\u8fd9\u4e9b\uff0c\u56e0\u6b64\u52a1\u5fc5\u5728\u6bcf\u4e00\u4e2a\u4e1a\u52a1\u7ec4\u4ef6\u9644\u5e26 README.md
\u6587\u6863\uff0c\u5e76\u63cf\u8ff0API\u3001DEMO\u7b49\u4fe1\u606f\uff0c\u4f8b\u5982\uff1a
## \u4f55\u65f6\u4f7f\u7528\uff1f\n\n\u7565\n\n## DEMO\n\n\u7565\n\n## API\n\n\u6210\u5458 | \u8bf4\u660e | \u7c7b\u578b | \u9ed8\u8ba4\u503c\n----|------|-----|------\nsrc | \u56fe\u7247\u5730\u5740 | `string` | -
\u6a21\u5757\u6ce8\u518c
\u8bf7\u53c2\u6570\u6a21\u5757\u6ce8\u518c\u6307\u5bfc\u539f\u5219\u3002
\u8f85\u52a9\u9879
ng-alain
\u914d\u7f6e\u4e86\u4e00\u4e9b\u9488\u5bf9 CLI \u9009\u9879\uff0c\u4ee5\u4fbf\u66f4\u597d\u8fdb\u884c\u7f16\u7801\u5de5\u4f5c\u3002
CLI
vscode \u662f\u7f16\u5199 Angular \u6700\u4f73\u7684\u9009\u62e9\uff0c\u4f60\u53ef\u4ee5\u5728\u9879\u76ee\u7684\u4efb\u4f55\u76ee\u5f55\u91cc\u8f93\u5165\uff1ang g c list
\u751f\u6210\u7ec4\u4ef6\u7684\u76f8\u5e94\u7684\u6587\u4ef6\u3002
ng-alain
\u9ed8\u8ba4\u914d\u7f6e\u4e86\u4e0d\u751f\u6210\u6837\u5f0f\u6587\u4ef6&\u5355\u5143\u6d4b\u8bd5\uff0c\u56e0\u6b64\uff0c\u4f60\u4f1a\u770b\u5230\u751f\u6210\u7684\u53ea\u6709 .ts
\u3001.html
\u3002\u8fd9\u662f\u56e0\u4e3a ng-alain
\u63d0\u4f9b\u4e86\u975e\u5e38\u4e30\u5bcc\u7684\u6837\u5f0fAPI\uff0c\u5728\u5927\u591a\u6570\u9875\u9762\u4e2d\u81ea\u5b9a\u4e49\u6837\u5f0f\u5e76\u4e0d\u662f\u521a\u9700\u7684\uff1b\u540c\u65f6\uff0c\u5355\u5143\u6d4b\u8bd5\u4e5f\u662f\u5982\u6b64\u3002
\u5f53\u7136\uff0c\u4f60\u53ef\u4ee5\u5f88\u5bb9\u6613\u5728 angular.json
\u4e2d\u8c03\u6574\u9ed8\u8ba4\u914d\u7f6e\u3002
vscode snippets
vscode \u662f\u7f16\u5199 Angular \u6700\u4f73\u7684\u9009\u62e9\uff0c\u81ea\u7136 NG-ALAIN \u4e5f\u5236\u4f5c\u4e86\u76f8\u5e94 snippets \u6269\u5c55\u63d2\u4ef6\uff1ang-zorro-vscode \u548c ng-alain-vscode
',meta:{order:90,title:{"en-US":"Style Guide","zh-CN":"\u7f16\u7801\u89c4\u8303\u5efa\u8bae"},type:"Advance"},toc:[{id:"\u4e00\u81f4\u7684\u4ee3\u7801\u98ce\u683c",title:"\u4e00\u81f4\u7684\u4ee3\u7801\u98ce\u683c",h:2,children:[{id:"Git-precommit\u52fe\u5b50",title:"Git - pre commit \u52fe\u5b50",h:3}]},{id:"\u98ce\u683c\u6307\u5357",title:"\u98ce\u683c\u6307\u5357",h:2,children:[{id:"API\u6587\u6863",title:"API\u6587\u6863",h:3},{id:"\u6a21\u5757\u6ce8\u518c",title:"\u6a21\u5757\u6ce8\u518c",h:3}]},{id:"\u8f85\u52a9\u9879",title:"\u8f85\u52a9\u9879",h:2,children:[{id:"CLI",title:"CLI",h:3},{id:"vscodesnippets",title:"vscode snippets",h:3}]}]}},demo:!1},this.codes=[]}}return(e=o).\u0275fac=function(t){return new(t||e)},e.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-style-guide"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,i){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",i.codes)("item",i.item)},dependencies:[s.P],styles:["[_nghost-%COMP%]{display:block}"]}),o})()},{path:"theme",redirectTo:"theme/zh",pathMatch:"full"},{path:"theme/:lang",component:(()=>{var e;class o{constructor(){this.item={cols:1,urls:{"zh-CN":"docs/theme.md"},content:{"zh-CN":{content:' ',meta:{order:10,title:{"en-US":"Theme","zh-CN":"\u4e3b\u9898\u7cfb\u7edf"},type:"Advance",url:"/theme/getting-started"},toc:[]}},demo:!1},this.codes=[]}}return(e=o).\u0275fac=function(t){return new(t||e)},e.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-theme"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,i){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",i.codes)("item",i.item)},dependencies:[s.P],styles:["[_nghost-%COMP%]{display:block}"]}),o})()},{path:"upgrade-v16",redirectTo:"upgrade-v16/zh",pathMatch:"full"},{path:"upgrade-v16/:lang",component:(()=>{var e;class o{constructor(){this.item={cols:1,urls:{"en-US":"docs/upgrade-v16.en-US.md","zh-CN":"docs/upgrade-v16.zh-CN.md"},content:{"en-US":{content:'This guide applies to the current version ng-alain >= 15
;\nIf you encounter problems during the upgrade process, feel free to comment here.\nIf you find any errors in this guide, please point out\nOr you have encountered a new problem and solved it, welcome to comment here.
Before upgrade
Make sure Node.js
>= 16.10.0
.
Create a new branch, or use other methods to back up the current project.
Delete the package-lock.json
or yarn.lock
file.
1.Upgrade dependencies
Upgrade Angular to 15.x version, Run ng update @angular/core@16 @angular/cli@16 @angular-eslint/schematics@16 ng-zorro-antd@16 ng-alain@16
.
Run ng update @angular/cdk@16
, if you have used @angular/cdk
.
If any warning messages appear in the console, follow the prompts to modify the corresponding code.
NG-ALAIN scaffolding upgrade all change files, please refer to: #2394.
',meta:{order:1e3,type:"Basic",title:"Upgrade to version 16.0",hot:!0},toc:[{id:"Beforeupgrade",title:"Before upgrade",h:2,children:[{id:"1.Upgradedependencies",title:"1.Upgrade dependencies",h:3}]}]},"zh-CN":{content:'\u672c\u6307\u5357\u9002\u7528\u4e8e\u5f53\u524d\u7248\u672c ng-alain >= 15
;\n\u5982\u679c\u5728\u5347\u7ea7\u8fc7\u7a0b\u4e2d\u9047\u5230\u95ee\u9898\uff0c\u6b22\u8fce\u63d0\u51fa\u3002\u63d0\u95ee\u524d\u8bf7\u9605\u8bfb \u5982\u4f55\u5411\u5f00\u6e90\u793e\u533a\u63d0\u95ee\u9898\n\u5982\u679c\u53d1\u73b0\u672c\u6307\u5357\u5b58\u5728\u9057\u6f0f/\u9519\u8bef\uff0c\u8bf7\u6307\u51fa!\n\u6216\u8005\u4f60\u9047\u5230\u4e86\u65b0\u7684\u95ee\u9898\u5e76\u89e3\u51b3\u4e86\uff0c\u6b22\u8fce\u8865\u5145!
\u5f00\u59cb\u4e4b\u524d
\u9996\u5148\u786e\u4fdd\u4f60 Node.js
>= 16.10.0
\u521b\u5efa\u65b0\u7684\u5206\u652f\uff0c\u6216\u8005\u4f7f\u7528\u5176\u4ed6\u65b9\u5f0f\u5907\u4efd\u5f53\u524d\u9879\u76ee
\u5220\u9664\u9879\u76ee\u4e0b package-lock.json
\u6216 yarn.lock
\u6587\u4ef6
\u5347\u7ea7\u6b65\u9aa4
\u5347\u7ea7\u76f8\u5173\u4f9d\u8d56
\u5c06\u9879\u76ee\u5347\u7ea7\u5230 Angular 15 \u8fd0\u884c ng update @angular/core@16 @angular/cli@16 @angular-eslint/schematics@16 ng-zorro-antd@16 ng-alain@16
\u3002
\u5982\u679c\u4f60\u6709\u5355\u72ec\u4f7f\u7528 @angular/cdk
\u8bf7\u6267\u884c ng update @angular/cdk@16
\u5982\u679c\u63a7\u5236\u53f0\u51fa\u73b0\u8b66\u544a\u6d88\u606f\u8bf7\u6309\u63d0\u793a\u4fee\u6539\u5bf9\u5e94\u4ee3\u7801
NG-ALAIN\u811a\u624b\u67b6\u5347\u7ea7\u5168\u90e8\u53d8\u66f4\u6587\u4ef6\uff0c\u8bf7\u53c2\u8003\uff1a#2394\u3002
',meta:{order:1e3,type:"Basic",title:"\u5347\u7ea7\u5230 16.0 \u7248\u672c",hot:!0},toc:[{id:"\u5f00\u59cb\u4e4b\u524d",title:"\u5f00\u59cb\u4e4b\u524d",h:2},{id:"\u5347\u7ea7\u6b65\u9aa4",title:"\u5347\u7ea7\u6b65\u9aa4",h:2,children:[{id:"\u5347\u7ea7\u76f8\u5173\u4f9d\u8d56",title:"\u5347\u7ea7\u76f8\u5173\u4f9d\u8d56",h:3}]}]}},demo:!1},this.codes=[]}}return(e=o).\u0275fac=function(t){return new(t||e)},e.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-upgrade-v16"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,i){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",i.codes)("item",i.item)},dependencies:[s.P],styles:["[_nghost-%COMP%]{display:block}"]}),o})()},{path:"upgrade",redirectTo:"upgrade/zh",pathMatch:"full"},{path:"upgrade/:lang",component:(()=>{var e;class o{constructor(){this.item={cols:1,urls:{"en-US":"docs/upgrade.en-US.md","zh-CN":"docs/upgrade.zh-CN.md"},content:{"en-US":{content:'In Architecture we have described the overall composition of the NG-ALAIN scaffolding. We spent a lot of time developing some infrastructure and publishing these to the @delon/*
series to Npm. , making the upgrade very easy.
Publishing rule
Similar to @angular/*
, the version number of the @delon/*
class library will be a version number () at each iteration, regardless of whether a class library has been modified.
At the same time, please follow the following publishing rules and update version number:
@delon
as the infrastructure library, which will be slightly higher in the update frequency, usually updated at least once a week.
With BREAKING CHANGES at least one minor version number
How to upgrade?
Method 1: Command (Recommend)
Unless it\'s a major version update (Similar to upgrading from 12.0.0
to 13.0.0
), you only need to run the following command:
ng update ng-alain
Method 2: Modify the version number
Modify package.json
All class libraries starting with @delon/
are the latest version number:
"@delon/theme": "^12.0.0"
Replace ^12.0.0
with the latest version number.
Finally, reinstall the dependencies.
yarn
Please read Frequently Asked Questions
Method 3: Update all class libraries
Scaffolding in package.json
most libraries use loose version numbers, for example:
^0.1.0
with the ^
symbol indicates that the latest minor version number is used, so 0.7.0
is also the range.
To use this update method, you need to follow these steps:
Remove the node_modules
folder and the yarn.lock
file
Execute yarn
Note: This method will install all class libraries in a newer version, but it may cause unnecessary troubles due to damaging changes of third-party t
',meta:{order:80,title:{"en-US":"Upgrade scaffold","zh-CN":"\u5347\u7ea7\u811a\u624b\u67b6"},type:"Dev"},toc:[{id:"Publishingrule",title:"Publishing rule",h:2},{id:"Howtoupgrade",title:"How to upgrade?",h:2,children:[{id:"Method1:CommandRecommend",title:"Method 1: Command (Recommend)",h:3},{id:"Method2:Modifytheversionnumber",title:"Method 2: Modify the version number",h:3},{id:"Method3:Updateallclasslibraries",title:"Method 3: Update all class libraries",h:3}]}]},"zh-CN":{content:'\u5728 \u4f53\u7cfb\u7ed3\u6784 \u4e2d\u6211\u4eec\u5df2\u7ecf\u63cf\u8ff0\u4e86 NG-ALAIN \u811a\u624b\u67b6\u7684\u6574\u4f53\u6784\u6210\uff0c\u6211\u4eec\u82b1\u4e86\u5927\u91cf\u65f6\u95f4\u53bb\u5f00\u53d1\u4e00\u4e9b\u57fa\u7840\u5efa\u8bbe\uff0c\u5e76\u628a\u8fd9\u4e9b\u4ee5 @delon/*
\u7cfb\u5217\u53d1\u5e03\u81f3 Npm \u5f53\u4e2d\uff0c\u4f7f\u5f97\u5347\u7ea7\u53d8\u5f97\u975e\u5e38\u8f7b\u677e\u3002
\u53d1\u5e03\u89c4\u5219
\u540c @angular/*
\u7c7b\u4f3c\uff0c@delon/*
\u7c7b\u5e93\u7684\u7248\u672c\u53f7\u5728\u6bcf\u4e00\u4e2a\u8fed\u4ee3\u65f6\uff0c\u4e0d\u7ba1\u67d0\u7c7b\u5e93\u662f\u5426\u6709\u4fee\u6539\uff0c\u90fd\u4f1a\u7edf\u4e00\u4e2a\u7248\u672c\u53f7 () \u3002
\u540c\u65f6\u6309\u4ee5\u4e0b\u53d1\u5e03\u89c4\u5219\u53ca\u66f4\u65b0\u7248\u672c\u53f7\u8bf4\u660e\uff1a
@delon
\u4f5c\u4e3a\u57fa\u7840\u5efa\u8bbe\u7c7b\u5e93\uff0c\u5728\u66f4\u65b0\u9891\u7387\u4e0a\u4f1a\u7565\u9ad8\uff0c\u4e00\u822c\u4e00\u5468\u81f3\u5c11\u66f4\u65b0\u4e00\u6b21
\u5e26\u6709 BREAKING CHANGES \u81f3\u5c11\u63d0\u5347\u4e00\u4e2a\u6b21\u7248\u672c\u53f7
\u5982\u4f55\u5347\u7ea7\uff1f
\u65b9\u5f0f\u4e00\uff1a\u547d\u4ee4\u884c\uff08\u63a8\u8350\uff09
\u9664\u975e\u662f\u5927\u7248\u672c\u66f4\u65b0\uff08\u5373\u7c7b\u4f3c\u4ece 12.0.0
\u5347\u81f3 13.0.0
\uff09\uff0c\u5426\u5219\u53ea\u9700\u8981\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u5373\u53ef\uff1a
ng update ng-alain
\u65b9\u5f0f\u4e8c\uff1a\u624b\u52a8\u4fee\u6539\u7248\u672c\u53f7
\u4fee\u6539 package.json
\u6240\u6709 @delon/
\u5f00\u5934\u7684\u7c7b\u5e93\u7248\u672c\u53f7\u4e3a\u6700\u65b0\u7248\u672c\u53f7\uff1a
"@delon/theme": "^12.0.0"
\u5c06 ^12.0.0
\u66ff\u6362\u6210\u6700\u65b0\u7248\u672c\u53f7\u3002
\u6700\u540e\uff0c\u91cd\u65b0\u5b89\u88c5\u4f9d\u8d56\u5305\u3002
yarn
\u9047\u5230\u95ee\u9898\u8bf7\u9605\u8bfb \u5e38\u89c1\u95ee\u9898
\u65b9\u5f0f\u4e09\uff1a\u66f4\u65b0\u6240\u6709\u7c7b\u5e93
\u811a\u624b\u67b6\u5728 package.json
\u91cc\u591a\u6570\u7c7b\u5e93\u90fd\u662f\u4f7f\u7528\u5bbd\u677e\u7684\u7248\u672c\u53f7\uff0c\u4f8b\u5982\uff1a
^0.1.0
\u5e26\u6709 ^
\u7b26\u53f7\u8868\u793a\u4f7f\u7528\u6700\u65b0\u6b21\u7248\u672c\u53f7\uff0c\u56e0\u6b64\uff0c0.7.0
\u4e5f\u662f\u8be5\u8303\u56f4\u4e4b\u5217\u3002
\u8981\u60f3\u91c7\u7528\u8fd9\u79cd\u66f4\u65b0\u65b9\u5f0f\u9700\u8981\u6309\u4ee5\u4e0b\u6b65\u9aa4\u8fdb\u884c\uff1a
\u79fb\u9664 node_modules
\u6587\u4ef6\u5939\u53ca yarn.lock
\u6587\u4ef6
\u6267\u884c yarn
\u6ce8\u610f\uff1a \u8fd9\u79cd\u65b9\u5f0f\u4f1a\u5bf9\u6240\u6709\u7c7b\u5e93\u6309\u6bd4\u8f83\u65b0\u7684\u7248\u672c\u5b89\u88c5\uff0c\u4f46\u6709\u53ef\u80fd\u4f1a\u5bfc\u81f4\u7531\u4e8e\u7b2c\u4e09\u65b9\u7c7b\u578b\u7684\u7834\u574f\u6027\u53d8\u66f4\u4f1a\u5bfc\u81f4\u4e00\u4e9b\u4e0d\u5fc5
',meta:{order:80,title:{"en-US":"Upgrade scaffold","zh-CN":"\u5347\u7ea7\u811a\u624b\u67b6"},type:"Dev"},toc:[{id:"\u53d1\u5e03\u89c4\u5219",title:"\u53d1\u5e03\u89c4\u5219",h:2},{id:"\u5982\u4f55\u5347\u7ea7\uff1f",title:"\u5982\u4f55\u5347\u7ea7\uff1f",h:2,children:[{id:"\u65b9\u5f0f\u4e00\uff1a\u547d\u4ee4\u884c\uff08\u63a8\u8350\uff09",title:"\u65b9\u5f0f\u4e00\uff1a\u547d\u4ee4\u884c\uff08\u63a8\u8350\uff09",h:3},{id:"\u65b9\u5f0f\u4e8c\uff1a\u624b\u52a8\u4fee\u6539\u7248\u672c\u53f7",title:"\u65b9\u5f0f\u4e8c\uff1a\u624b\u52a8\u4fee\u6539\u7248\u672c\u53f7",h:3},{id:"\u65b9\u5f0f\u4e09\uff1a\u66f4\u65b0\u6240\u6709\u7c7b\u5e93",title:"\u65b9\u5f0f\u4e09\uff1a\u66f4\u65b0\u6240\u6709\u7c7b\u5e93",h:3}]}]}},demo:!1},this.codes=[]}}return(e=o).\u0275fac=function(t){return new(t||e)},e.\u0275cmp=a.Xpm({type:e,selectors:[["app-docs-upgrade"]],decls:1,vars:2,consts:[[3,"codes","item"]],template:function(t,i){1&t&&a._UZ(0,"app-docs",0),2&t&&a.Q6J("codes",i.codes)("item",i.item)},dependencies:[s.P],styles:["[_nghost-%COMP%]{display:block}"]}),o})()}]}];let E=(()=>{var e;class o{}return(e=o).\u0275fac=function(t){return new(t||e)},e.\u0275mod=a.oAB({type:e}),e.\u0275inj=a.cJS({imports:[R.m,G.Bz.forChild(P)]}),o})()}}]);
\ No newline at end of file
diff --git a/324.2de7ad512acffd32.js b/324.2de7ad512acffd32.js
deleted file mode 100644
index e134f5e2bd..0000000000
--- a/324.2de7ad512acffd32.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunksite=self.webpackChunksite||[]).push([[324],{72324:(Z,c,r)=>{r.r(c),r.d(c,{DevListModule:()=>g});var u=r(52787),l=r(89207),t=r(65879),d=r(18750),a=r(96814);let m=(()=>{var s;class e{constructor(n){this.route=n,this.first=(0,l.Z)(new Date,"yyyy-MM-dd HH:mm:ss"),this.now=(0,l.Z)(new Date,"yyyy-MM-dd HH:mm:ss")}ngOnInit(){console.log("LAYOUT LIST: ngOnInit")}_onReuseInit(){this.now=(0,l.Z)(new Date,"yyyy-MM-dd HH:mm:ss"),console.log("LAYOUT LIST: by _onReuseInit",this.route.snapshot.url.toString())}ngOnDestroy(){console.log("LAYOUT LIST: ngOnDestroy")}}return(s=e).\u0275fac=function(n){return new(n||s)(t.Y36(u.gz))},s.\u0275cmp=t.Xpm({type:s,selectors:[["dev-list-layout"]],decls:10,vars:6,consts:[[1,"px-lg"]],template:function(n,o){1&n&&(t._UZ(0,"page-header"),t.TgZ(1,"h1"),t._uU(2,"Layout"),t.qZA(),t.TgZ(3,"p"),t._uU(4),t.ALo(5,"json"),t.ALo(6,"json"),t.qZA(),t._UZ(7,"hr"),t.TgZ(8,"div",0),t._UZ(9,"router-outlet"),t.qZA()),2&n&&(t.xp6(4),t.AsE("first: ",t.lcZ(5,2,o.first),"\uff0cnow: ",t.lcZ(6,4,o.now),""))},dependencies:[u.lC,d.q,a.Ts],encapsulation:2}),e})(),p=(()=>{var s;class e{constructor(n){this.route=n,this.first=(0,l.Z)(new Date,"yyyy-MM-dd HH:mm:ss"),this.now=(0,l.Z)(new Date,"yyyy-MM-dd HH:mm:ss"),this.id=0}ngOnInit(){console.log("LIST ITEM: ngOnInit"),this.route.params.subscribe(n=>this.id=+n.id)}_onReuseInit(){this.now=(0,l.Z)(new Date,"yyyy-MM-dd HH:mm:ss"),console.log("LIST ITEM: by _onReuseInit",this.route.snapshot.url.toString())}ngOnDestroy(){console.log("LIST ITEM: ngOnDestroy")}}return(s=e).\u0275fac=function(n){return new(n||s)(t.Y36(u.gz))},s.\u0275cmp=t.Xpm({type:s,selectors:[["dev-list-item"]],decls:11,vars:12,template:function(n,o){1&n&&(t.TgZ(0,"h2"),t._uU(1,"List Item"),t.qZA(),t.TgZ(2,"p"),t._uU(3),t.ALo(4,"json"),t.ALo(5,"json"),t.qZA(),t.TgZ(6,"p"),t._uU(7),t.ALo(8,"json"),t.qZA(),t._uU(9),t.ALo(10,"json")),2&n&&(t.xp6(3),t.AsE("first: ",t.lcZ(4,4,o.first),"\uff0cnow: ",t.lcZ(5,6,o.now),""),t.xp6(4),t.hij("id: ",t.lcZ(8,8,o.id),""),t.xp6(2),t.hij(" page: ",t.lcZ(10,10,o.route.url)," "))},dependencies:[a.Ts],encapsulation:2}),e})(),y=(()=>{var s;class e{constructor(n){this.route=n,this.first=(0,l.Z)(new Date,"yyyy-MM-dd HH:mm:ss"),this.now=(0,l.Z)(new Date,"yyyy-MM-dd HH:mm:ss"),this.id=0}ngOnInit(){console.log("LIST: ngOnInit"),this.route.params.subscribe(n=>this.id=+n.id)}_onReuseInit(){this.now=(0,l.Z)(new Date,"yyyy-MM-dd HH:mm:ss"),console.log("LIST: by _onReuseInit",this.route.snapshot.url.toString())}ngOnDestroy(){console.log("LIST: ngOnDestroy")}}return(s=e).\u0275fac=function(n){return new(n||s)(t.Y36(u.gz))},s.\u0275cmp=t.Xpm({type:s,selectors:[["dev-list"]],decls:11,vars:12,template:function(n,o){1&n&&(t.TgZ(0,"h2"),t._uU(1,"List"),t.qZA(),t.TgZ(2,"p"),t._uU(3),t.ALo(4,"json"),t.ALo(5,"json"),t.qZA(),t.TgZ(6,"p"),t._uU(7),t.ALo(8,"json"),t.qZA(),t._uU(9),t.ALo(10,"json")),2&n&&(t.xp6(3),t.AsE("first: ",t.lcZ(4,4,o.first),"\uff0cnow: ",t.lcZ(5,6,o.now),""),t.xp6(4),t.hij("id: ",t.lcZ(8,8,o.id),""),t.xp6(2),t.hij(" page: ",t.lcZ(10,10,o.route.url)," "))},dependencies:[a.Ts],encapsulation:2}),e})();var L=r(89359);const h=[{path:"",component:m,children:[{path:"",component:y},{path:"item",component:p}]}];let g=(()=>{var s;class e{}return(s=e).\u0275fac=function(n){return new(n||s)},s.\u0275mod=t.oAB({type:s}),s.\u0275inj=t.cJS({imports:[L.m,u.Bz.forChild(h)]}),e})()}}]);
\ No newline at end of file
diff --git a/324.7b8f4d584c4d0e3b.js b/324.7b8f4d584c4d0e3b.js
new file mode 100644
index 0000000000..e3f6050f50
--- /dev/null
+++ b/324.7b8f4d584c4d0e3b.js
@@ -0,0 +1 @@
+"use strict";(self.webpackChunksite=self.webpackChunksite||[]).push([[324],{72324:(Z,a,r)=>{r.r(a),r.d(a,{DevListModule:()=>g});var l=r(52787),i=r(89207),t=r(65879),d=r(18750),c=r(96814);let u=(()=>{class s{constructor(n){this.route=n,this.first=(0,i.Z)(new Date,"yyyy-MM-dd HH:mm:ss"),this.now=(0,i.Z)(new Date,"yyyy-MM-dd HH:mm:ss")}ngOnInit(){console.log("LAYOUT LIST: ngOnInit")}_onReuseInit(){this.now=(0,i.Z)(new Date,"yyyy-MM-dd HH:mm:ss"),console.log("LAYOUT LIST: by _onReuseInit",this.route.snapshot.url.toString())}ngOnDestroy(){console.log("LAYOUT LIST: ngOnDestroy")}static#t=this.\u0275fac=function(o){return new(o||s)(t.Y36(l.gz))};static#s=this.\u0275cmp=t.Xpm({type:s,selectors:[["dev-list-layout"]],decls:10,vars:6,consts:[[1,"px-lg"]],template:function(o,e){1&o&&(t._UZ(0,"page-header"),t.TgZ(1,"h1"),t._uU(2,"Layout"),t.qZA(),t.TgZ(3,"p"),t._uU(4),t.ALo(5,"json"),t.ALo(6,"json"),t.qZA(),t._UZ(7,"hr"),t.TgZ(8,"div",0),t._UZ(9,"router-outlet"),t.qZA()),2&o&&(t.xp6(4),t.AsE("first: ",t.lcZ(5,2,e.first),"\uff0cnow: ",t.lcZ(6,4,e.now),""))},dependencies:[l.lC,d.q,c.Ts],encapsulation:2})}return s})(),y=(()=>{class s{constructor(n){this.route=n,this.first=(0,i.Z)(new Date,"yyyy-MM-dd HH:mm:ss"),this.now=(0,i.Z)(new Date,"yyyy-MM-dd HH:mm:ss"),this.id=0}ngOnInit(){console.log("LIST ITEM: ngOnInit"),this.route.params.subscribe(n=>this.id=+n.id)}_onReuseInit(){this.now=(0,i.Z)(new Date,"yyyy-MM-dd HH:mm:ss"),console.log("LIST ITEM: by _onReuseInit",this.route.snapshot.url.toString())}ngOnDestroy(){console.log("LIST ITEM: ngOnDestroy")}static#t=this.\u0275fac=function(o){return new(o||s)(t.Y36(l.gz))};static#s=this.\u0275cmp=t.Xpm({type:s,selectors:[["dev-list-item"]],decls:11,vars:12,template:function(o,e){1&o&&(t.TgZ(0,"h2"),t._uU(1,"List Item"),t.qZA(),t.TgZ(2,"p"),t._uU(3),t.ALo(4,"json"),t.ALo(5,"json"),t.qZA(),t.TgZ(6,"p"),t._uU(7),t.ALo(8,"json"),t.qZA(),t._uU(9),t.ALo(10,"json")),2&o&&(t.xp6(3),t.AsE("first: ",t.lcZ(4,4,e.first),"\uff0cnow: ",t.lcZ(5,6,e.now),""),t.xp6(4),t.hij("id: ",t.lcZ(8,8,e.id),""),t.xp6(2),t.hij(" page: ",t.lcZ(10,10,e.route.url)," "))},dependencies:[c.Ts],encapsulation:2})}return s})(),m=(()=>{class s{constructor(n){this.route=n,this.first=(0,i.Z)(new Date,"yyyy-MM-dd HH:mm:ss"),this.now=(0,i.Z)(new Date,"yyyy-MM-dd HH:mm:ss"),this.id=0}ngOnInit(){console.log("LIST: ngOnInit"),this.route.params.subscribe(n=>this.id=+n.id)}_onReuseInit(){this.now=(0,i.Z)(new Date,"yyyy-MM-dd HH:mm:ss"),console.log("LIST: by _onReuseInit",this.route.snapshot.url.toString())}ngOnDestroy(){console.log("LIST: ngOnDestroy")}static#t=this.\u0275fac=function(o){return new(o||s)(t.Y36(l.gz))};static#s=this.\u0275cmp=t.Xpm({type:s,selectors:[["dev-list"]],decls:11,vars:12,template:function(o,e){1&o&&(t.TgZ(0,"h2"),t._uU(1,"List"),t.qZA(),t.TgZ(2,"p"),t._uU(3),t.ALo(4,"json"),t.ALo(5,"json"),t.qZA(),t.TgZ(6,"p"),t._uU(7),t.ALo(8,"json"),t.qZA(),t._uU(9),t.ALo(10,"json")),2&o&&(t.xp6(3),t.AsE("first: ",t.lcZ(4,4,e.first),"\uff0cnow: ",t.lcZ(5,6,e.now),""),t.xp6(4),t.hij("id: ",t.lcZ(8,8,e.id),""),t.xp6(2),t.hij(" page: ",t.lcZ(10,10,e.route.url)," "))},dependencies:[c.Ts],encapsulation:2})}return s})();var p=r(89359);const h=[{path:"",component:u,children:[{path:"",component:m},{path:"item",component:y}]}];let g=(()=>{class s{static#t=this.\u0275fac=function(o){return new(o||s)};static#s=this.\u0275mod=t.oAB({type:s});static#n=this.\u0275inj=t.cJS({imports:[p.m,l.Bz.forChild(h)]})}return s})()}}]);
\ No newline at end of file
diff --git a/404.html b/404.html
index fe18467b4f..f5bbf8ade7 100644
--- a/404.html
+++ b/404.html
@@ -1 +1 @@
-Ng Alain - 一个基于 Antd 中后台前端解决方案 loading...
\ No newline at end of file
+Ng Alain - 一个基于 Antd 中后台前端解决方案 loading...
\ No newline at end of file
diff --git a/414.b19721894fa548ab.js b/414.b19721894fa548ab.js
deleted file mode 100644
index 6be9ca53d4..0000000000
--- a/414.b19721894fa548ab.js
+++ /dev/null
@@ -1 +0,0 @@
-"use strict";(self.webpackChunksite=self.webpackChunksite||[]).push([[414],{88414:(Pc,$,l)=>{l.r($),l.d($,{ComponentsModule:()=>Ac});var jo=l(52787),Go=l(89359),Wo=l(93285),t=l(65879),p=l(10095),g=l(28749),b=l(27358),C=l(96814),Xo=l(45372),u=l(42840),m=l(70855),h=l(41958),f=l(20824);function Ko(o,a){1&o&&(t.TgZ(0,"div",2),t._UZ(1,"input",3),t.qZA())}let tt=(()=>{var o;class a{constructor(){this.showInput=!1}}return(o=a).\u0275fac=function(n){return new(n||o)},o.\u0275cmp=t.Xpm({type:o,selectors:[["components-auto-focus-simple"]],decls:3,vars:1,consts:[["nz-button","",3,"click"],["class","mt-md",4,"ngIf"],[1,"mt-md"],["nz-input","","auto-focus",""]],template:function(n,e){1&n&&(t.TgZ(0,"button",0),t.NdJ("click",function(){return e.showInput=!e.showInput}),t._uU(1,"Toggle Input"),t.qZA(),t.YNc(2,Ko,2,0,"div",1)),2&n&&(t.xp6(2),t.Q6J("ngIf",e.showInput))},dependencies:[C.O5,Xo.h,u.ix,m.w,h.dQ,f.Zp],encapsulation:2}),a})(),et=(()=>{var o;class a{constructor(){this.item={cols:1,urls:{"en-US":"packages/abc/auto-focus/index.en-US.md","zh-CN":"packages/abc/auto-focus/index.zh-CN.md"},content:{"en-US":{content:'Allows to focus HTML-element right after its appearance, By default, it will take effect for input
and textarea
with [autofocus="autofocus"]
.
',api:'API
auto-focus
Property Description Type Default [enabled]
Whether enabled of auto focus boolean
true
[delay]
Delay of the focus (unit: ms) number
300
',meta:{type:"Other",title:"auto-focus",subtitle:"Auto focus",cols:1,module:"import { AutoFocusModule } from '@delon/abc/auto-focus';"},toc:[{id:"API",title:"API",h:2,children:[{id:"auto-focus",title:"auto-focus",h:3}]}]},"zh-CN":{content:'\u5141\u8bb8\u5728HTML\u5143\u7d20\u51fa\u73b0\u540e\u7acb\u5373\u5bf9\u5176\u8fdb\u884c\u8bbe\u7f6e\u7126\u70b9\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4f1a\u5bf9 input
\u3001textarea
\u5e26\u6709 [autofocus="autofocus"]
\u751f\u6548\u3002
',api:'API
auto-focus
\u6210\u5458 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [enabled]
\u662f\u5426\u542f\u7528 boolean
true
[delay]
\u5ef6\u8fdf\u65f6\u957f\uff08\u5355\u4f4d\uff1a\u6beb\u79d2\uff09 number
300
',meta:{type:"Other",title:"auto-focus",subtitle:"\u81ea\u52a8\u83b7\u5f97\u7126\u70b9",cols:1,module:"import { AutoFocusModule } from '@delon/abc/auto-focus';"},toc:[{id:"API",title:"API",h:2,children:[{id:"auto-focus",title:"auto-focus",h:3}]}]}},demo:!0},this.codes=[{id:"components-auto-focus-simple",meta:{title:{"zh-CN":"\u57fa\u7840\u6837\u4f8b","en-US":"Basic Usage"},order:0},summary:{"zh-CN":"\u6700\u7b80\u5355\u7684\u7528\u6cd5\u3002
","en-US":"Simplest of usage.
"},code:'import { Component } from \'@angular/core\';\n\n@Component({\n selector: \'components-auto-focus-simple\',\n template: `\n \n \n \n \n `,\n})\nexport class ComponentsAutoFocusSimpleComponent {\n showInput = false;\n}',name:"simple",urls:"packages/abc/auto-focus/demo/simple.md",type:"demo",lang:"ts",componentName:"ComponentsAutoFocusSimpleComponent",point:0}]}}return(o=a).\u0275fac=function(n){return new(n||o)},o.\u0275cmp=t.Xpm({type:o,selectors:[["app-components-auto-focus"]],decls:5,vars:5,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","24"],[3,"item"]],template:function(n,e){1&n&&(t.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),t._UZ(4,"components-auto-focus-simple"),t.qZA()()()()),2&n&&(t.Q6J("codes",e.codes)("item",e.item),t.xp6(1),t.Q6J("nzGutter",16),t.xp6(2),t.Q6J("item",e.codes[0]),t.uIk("id",e.codes[0].id))},dependencies:[p.t3,p.SK,g.P,b.e,tt],styles:["[_nghost-%COMP%]{display:block}"]}),a})();var ot=l(8682),nt=l(32461);const Yo=function(){return{color:"#f56a00",backgroundColor:"#fde3cf"}};let dt=(()=>{var o;class a{}return(o=a).\u0275fac=function(n){return new(n||o)},o.\u0275cmp=t.Xpm({type:o,selectors:[["components-avatar-list-maxLength"]],decls:6,vars:2,consts:[["size","mini","maxLength","3",3,"excessItemsStyle"],["tips","Jake","src","https://gw.alipayobjects.com/zos/rmsportal/zOsKZmFRdUtvpqCImOVY.png"],["tips","Andy","src","https://gw.alipayobjects.com/zos/rmsportal/sfjbOqnsXXJgNCjCzDBL.png"],["tips","Niko","src","https://gw.alipayobjects.com/zos/rmsportal/kZzEzemZyKLKFsojXItE.png"],["tips","Cipchk","text","Cipchk"],["tips","heart-o","icon","heart-o"]],template:function(n,e){1&n&&(t.TgZ(0,"avatar-list",0),t._UZ(1,"avatar-list-item",1)(2,"avatar-list-item",2)(3,"avatar-list-item",3)(4,"avatar-list-item",4)(5,"avatar-list-item",5),t.qZA()),2&n&&t.Q6J("excessItemsStyle",t.DdM(1,Yo))},dependencies:[ot.k,nt.y],encapsulation:2}),a})(),at=(()=>{var o;class a{}return(o=a).\u0275fac=function(n){return new(n||o)},o.\u0275cmp=t.Xpm({type:o,selectors:[["components-avatar-list-simple"]],decls:6,vars:0,consts:[["size","mini"],["tips","Jake","src","https://gw.alipayobjects.com/zos/rmsportal/zOsKZmFRdUtvpqCImOVY.png"],["tips","Andy","src","https://gw.alipayobjects.com/zos/rmsportal/sfjbOqnsXXJgNCjCzDBL.png"],["tips","Niko","src","https://gw.alipayobjects.com/zos/rmsportal/kZzEzemZyKLKFsojXItE.png"],["tips","Cipchk","text","Cipchk"],["tips","heart-o","icon","heart-o"]],template:function(n,e){1&n&&(t.TgZ(0,"avatar-list",0),t._UZ(1,"avatar-list-item",1)(2,"avatar-list-item",2)(3,"avatar-list-item",3)(4,"avatar-list-item",4)(5,"avatar-list-item",5),t.qZA())},dependencies:[ot.k,nt.y],encapsulation:2}),a})(),ct=(()=>{var o;class a{constructor(){this.item={cols:1,urls:{"en-US":"packages/abc/avatar-list/index.en-US.md","zh-CN":"packages/abc/avatar-list/index.zh-CN.md"},content:{"en-US":{content:'A list of user\'s avatar for project or group member list frequently. If a large or small avatar-list is desired, set the size
property to either large
or small
and mini
respectively. Omit the size
property for a avatar-list with the default size.
',api:'API
avatar-list
Property Description Type Default [size]
size of list \'large\',\'small\',\'mini\',\'default\'
\'default\'
[maxLength]
max items to show number
- [excessItemsStyle]
the excess item style { [key: string]: string }
-
avatar-list-item
Property Description Type Default [tips]
title tips for avatar item string
- [src]
the address of the image for an image avatar string
- [text]
text for avatar item string
- [icon]
icon for avatar item string
-
',meta:{type:"Basic",title:"avatar-list",subtitle:"AvatarList",cols:1,module:"import { AvatarListModule } from '@delon/abc/avatar-list';"},toc:[{id:"API",title:"API",h:2,children:[{id:"avatar-list",title:"avatar-list",h:3},{id:"avatar-list-item",title:"avatar-list-item",h:3}]}]},"zh-CN":{content:'\u4e00\u7ec4\u7528\u6237\u5934\u50cf\uff0c\u5e38\u7528\u5728\u9879\u76ee/\u56e2\u961f\u6210\u5458\u5217\u8868\u3002\u53ef\u901a\u8fc7\u8bbe\u7f6e size
\u5c5e\u6027\u6765\u6307\u5b9a\u5934\u50cf\u5927\u5c0f\u3002
',api:'API
avatar-list
\u6210\u5458 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [size]
\u5934\u50cf\u5927\u5c0f \'large\',\'small\',\'mini\',\'default\'
\'default\'
[maxLength]
\u8981\u663e\u793a\u7684\u6700\u5927\u9879\u76ee number
- [excessItemsStyle]
\u591a\u4f59\u7684\u9879\u76ee\u98ce\u683c { [key: string]: string }
-
avatar-list-item
\u6210\u5458 \u8bf4\u660e \u7c7b\u578b \u9ed8\u8ba4\u503c [tips]
\u5934\u50cf\u5c55\u793a\u6587\u6848 string
- [src]
\u5934\u50cf\u56fe\u7247\u8fde\u63a5 string
- [text]
\u6587\u672c\u7c7b\u5934\u50cf string
- [icon]
\u56fe\u6807\u7c7b\u578b string
-
',meta:{type:"Basic",title:"avatar-list",subtitle:"\u7528\u6237\u5934\u50cf\u5217\u8868",cols:1,module:"import { AvatarListModule } from '@delon/abc/avatar-list';"},toc:[{id:"API",title:"API",h:2,children:[{id:"avatar-list",title:"avatar-list",h:3},{id:"avatar-list-item",title:"avatar-list-item",h:3}]}]}},demo:!0},this.codes=[{id:"components-avatar-list-maxLength",meta:{title:{"zh-CN":"\u8981\u663e\u793a\u7684\u6700\u5927\u9879\u76ee","en-US":"Max Items to Show"},order:0},summary:"maxLength
attribute specifies the maximum number of items to show while excessItemsStyle
style the excess\nitem component.
",code:'import { Component } from \'@angular/core\';\n\n@Component({\n selector: \'components-avatar-list-maxLength\',\n template: ` \n \n \n \n \n \n `,\n})\nexport class ComponentsAvatarListMaxLengthComponent {}',name:"maxLength",urls:"packages/abc/avatar-list/demo/maxLength.md",type:"demo",lang:"ts",componentName:"ComponentsAvatarListMaxLengthComponent",point:0},{id:"components-avatar-list-simple",meta:{title:{"zh-CN":"\u57fa\u7840\u6837\u4f8b","en-US":"Basic Usage"},order:0},summary:{"zh-CN":"\u6700\u7b80\u5355\u7684\u7528\u6cd5\u3002
","en-US":"Simplest of usage.
"},code:'import { Component } from \'@angular/core\';\n\n@Component({\n selector: \'components-avatar-list-simple\',\n template: ` \n \n \n \n \n \n `,\n})\nexport class ComponentsAvatarListSimpleComponent {}',name:"simple",urls:"packages/abc/avatar-list/demo/simple.md",type:"demo",lang:"ts",componentName:"ComponentsAvatarListSimpleComponent",point:1}]}}return(o=a).\u0275fac=function(n){return new(n||o)},o.\u0275cmp=t.Xpm({type:o,selectors:[["app-components-avatar-list"]],decls:7,vars:7,consts:[[3,"codes","item"],["nz-row","",3,"nzGutter"],["nz-col","","nzSpan","24"],[3,"item"]],template:function(n,e){1&n&&(t.TgZ(0,"app-docs",0)(1,"div",1)(2,"div",2)(3,"code-box",3),t._UZ(4,"components-avatar-list-maxLength"),t.qZA(),t.TgZ(5,"code-box",3),t._UZ(6,"components-avatar-list-simple"),t.qZA()()()()),2&n&&(t.Q6J("codes",e.codes)("item",e.item),t.xp6(1),t.Q6J("nzGutter",16),t.xp6(2),t.Q6J("item",e.codes[0]),t.uIk("id",e.codes[0].id),t.xp6(2),t.Q6J("item",e.codes[1]),t.uIk("id",e.codes[1].id))},dependencies:[p.t3,p.SK,g.P,b.e,dt,at],styles:["[_nghost-%COMP%]{display:block}"]}),a})();var B=l(22096),$o=l(48180),it=l(5177),tn=l(64716),rt=l(68584),st=l(62816),w=l(96156),lt=l(6593),on=l(11463);function nn(o,a){if(1&o&&(t.TgZ(0,"div",2),t._uU(1),t.ALo(2,"json"),t._UZ(3,"cell",11),t.qZA()),2&o){const d=a.$implicit;t.xp6(1),t.hij(" ",t.lcZ(2,2,d)," => "),t.xp6(2),t.Q6J("value",d)}}const dn=function(o){return{renderType:o}};function an(o,a){if(1&o&&(t.TgZ(0,"div",2),t._uU(1),t._UZ(2,"cell",3),t.qZA()),2&o){const d=a.$implicit;t.xp6(1),t.hij(" ",d," => "),t.xp6(1),t.Q6J("value",d)("options",t.VKq(3,dn,d))}}function cn(o,a){if(1&o){const d=t.EpF();t.TgZ(0,"a",21),t.NdJ("click",function(){t.CHM(d);const e=t.oxw();return t.KtG(e.again())}),t._uU(1,"Again"),t.qZA()}}const rn=function(){return{format:"fn"}},sn=function(o){return{date:o}},ln=function(){return{type:"mega"}},pn=function(){return{mask:"999****9999"}},mn=function(){return{unit:"$"}},un=function(){return{type:"cny"}},hn=function(){return{type:"boolean"}},pt=function(){return{type:"img"}},fn=function(){return["https://randomuser.me/api/portraits/thumb/women/46.jpg","https://randomuser.me/api/portraits/thumb/women/47.jpg"]},Cn=function(){return{url:"https://ng-alain.com"}},yn=function(o){return{link:o}},vn=function(){return{type:"html"}},mt=function(o){return{data:o}},Tn=function(o){return{badge:o}},Sn=function(o){return{tag:o}},zn=function(){return{label:"Label"}},_n=function(o){return{type:"checkbox",tooltip:"Tooltip",checkbox:o}},kn=function(){return{label:"Radio"}},xn=function(o){return{type:"radio",tooltip:"Tooltip",radio:o}},wn=function(o){return{enum:o}},An=function(){return{tooltip:"Tooltip"}},Mn=function(){return{unit:"\u4eba"}},Zn=function(){return{text:"100",unit:"\u5143"}},Dn=function(){return{key:"test",data:"new url"}},Pn=function(o){return{widget:o}};let ut=(()=>{var o;class a{constructor(n,e){this.ds=n,this.cdr=e,this.value="string",this.checkbox=!1,this.radio=!0,this.disabled=!1,this.yn=!0,this.default="-",this.defaultCondition="*",this.baseList=["string",!0,!1,100,1e6,new Date],this.typeList=["primary","success","danger","warning"],this.now=new Date,this.day3=function en(o,a){(0,st.Z)(2,arguments);var d=(0,w.Z)(a);return(0,rt.Z)(o,-d)}(new Date,3),this.HTML="Strong",this.status={WAIT:{text:"Wait",tooltip:"Refers to waiting for the user to ship"},FINISHED:{text:"Done",color:"success"}},this.loading=!0,this.asyncLoading=!0,this.safeHtml=this.ds.bypassSecurityTrustHtml("Strong Html"),this.enum={1:"Success",2:"Error"},this.enumValue=1,this.bigImg={img:{size:32,big:!0}}}ngOnInit(){this.again()}refresh(){this.value=new Date,this.cdr.detectChanges()}again(){this.asyncLoading=!0,this.async=()=>(0,B.of)({text:""+ +new Date}).pipe((0,$o.q)(1),(0,it.g)(1e3),(0,tn.x)(()=>{this.asyncLoading=!1,this.cdr.detectChanges()})),this.cdr.detectChanges()}updateSafeHtml(){this.safeHtml=this.ds.bypassSecurityTrustHtml("alert('a');