Skip to content

Commit

Permalink
updated ng-zorro-antd
Browse files Browse the repository at this point in the history
  • Loading branch information
imolorhe committed Dec 17, 2023
1 parent 8900bf3 commit d857dc0
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 165 deletions.
4 changes: 3 additions & 1 deletion packages/altair-app/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"tsConfig": "src/tsconfig.app.json",
"polyfills": "src/polyfills.ts",
"assets": ["src/assets", "src/favicon.ico"],
"styles": ["src/theme.less", "src/styles.scss"],
"styles": [
"src/styles.scss"
],
"stylePreprocessorOptions": {
"includePaths": ["node_modules"]
},
Expand Down
2 changes: 1 addition & 1 deletion packages/altair-app/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ module.exports = {
setupFilesAfterEnv: ['<rootDir>/src/setup-jest.ts'],
moduleDirectories: ['node_modules', '<rootDir>/src'],
transformIgnorePatterns: [
'node_modules/(?!@angular|@firebase|@ngrx|@sentry|lodash-es|altair-graphql-core|angular-resizable-element|dexie|uuid|ngx-cookie-service|ngx-markdown|ky|color-name|json-schema-library|graphql-language-service|vscode-languageserver-types|cm6-graphql|ngx-toastr|@ngx-translate|lucide-angular|@ctrl/ngx-codemirror)',
'node_modules/(?!@angular|@firebase|@ngrx|@sentry|lodash-es|altair-graphql-core|angular-resizable-element|dexie|uuid|ngx-cookie-service|ngx-markdown|ky|color-name|json-schema-library|graphql-language-service|vscode-languageserver-types|cm6-graphql|ngx-toastr|@ngx-translate|lucide-angular|@ctrl/ngx-codemirror|ng-zorro-antd|@ant-design/icons-angular)',
],
};
2 changes: 1 addition & 1 deletion packages/altair-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"memoizee": "0.4.14",
"mousetrap": "1.6.5",
"mousetrap-global-bind": "1.1.0",
"ng-zorro-antd": "12.1.1",
"ng-zorro-antd": "^15.1.1",
"ngrx-store-localstorage": "12.0.1",
"ngx-cookie-service": "14.0.1",
"ngx-markdown": "^14.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ exports[`AddCollectionQueryDialogComponent should render correctly 1`] = `
class="ant-form-item-control-input-content"
>
<nz-select
class="dialog-block ant-select ant-select-show-arrow ant-select-single ng-untouched ng-pristine ng-valid"
class="ant-select dialog-block ant-select-in-form-item ant-select-show-arrow ant-select-single ng-untouched ng-pristine ng-valid"
name="collection"
nzplaceholder="Choose"
>
Expand All @@ -49,19 +49,13 @@ exports[`AddCollectionQueryDialogComponent should render correctly 1`] = `
<nz-select-search
class="ant-select-selection-search"
>
<input
autocomplete="off"
class="ant-select-selection-search-input ng-untouched ng-pristine ng-valid"
readonly="readonly"
style="opacity: 0;"
/>
</nz-select-search>
Expand All @@ -71,28 +65,16 @@ exports[`AddCollectionQueryDialogComponent should render correctly 1`] = `
<nz-select-placeholder
class="ant-select-selection-placeholder"
>
Choose
Choose
</nz-select-placeholder>
</nz-select-top-control>
<nz-select-arrow
class="ant-select-arrow"
>
<i
<span
class="anticon anticon-down"
nz-icon=""
nztype="down"
Expand All @@ -110,37 +92,22 @@ exports[`AddCollectionQueryDialogComponent should render correctly 1`] = `
d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"
/>
</svg>
</i>
</span>
</nz-select-arrow>
</nz-select>
</div>
<span
class="ant-form-item-children-icon"
>
</span>
</div>
Expand Down Expand Up @@ -190,7 +157,7 @@ exports[`AddCollectionQueryDialogComponent should render correctly with [collect
class="ant-form-item-control-input-content"
>
<nz-select
class="dialog-block ant-select ant-select-show-arrow ant-select-single ng-untouched ng-pristine ng-valid"
class="ant-select dialog-block ant-select-in-form-item ant-select-show-arrow ant-select-single ng-untouched ng-pristine ng-valid"
name="collection"
nzplaceholder="Choose"
>
Expand All @@ -201,19 +168,13 @@ exports[`AddCollectionQueryDialogComponent should render correctly with [collect
<nz-select-search
class="ant-select-selection-search"
>
<input
autocomplete="off"
class="ant-select-selection-search-input ng-untouched ng-pristine ng-valid"
readonly="readonly"
style="opacity: 0;"
/>
</nz-select-search>
Expand All @@ -223,28 +184,16 @@ exports[`AddCollectionQueryDialogComponent should render correctly with [collect
<nz-select-placeholder
class="ant-select-selection-placeholder"
>
Choose
Choose
</nz-select-placeholder>
</nz-select-top-control>
<nz-select-arrow
class="ant-select-arrow"
>
<i
<span
class="anticon anticon-down"
nz-icon=""
nztype="down"
Expand All @@ -262,37 +211,22 @@ exports[`AddCollectionQueryDialogComponent should render correctly with [collect
d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"
/>
</svg>
</i>
</span>
</nz-select-arrow>
</nz-select>
</div>
<span
class="ant-form-item-children-icon"
>
</span>
</div>
Expand Down Expand Up @@ -342,7 +276,7 @@ exports[`AddCollectionQueryDialogComponent should render correctly with [windowT
class="ant-form-item-control-input-content"
>
<nz-select
class="dialog-block ant-select ant-select-show-arrow ant-select-single ng-untouched ng-pristine ng-valid"
class="ant-select dialog-block ant-select-in-form-item ant-select-show-arrow ant-select-single ng-untouched ng-pristine ng-valid"
name="collection"
nzplaceholder="Choose"
>
Expand All @@ -353,19 +287,13 @@ exports[`AddCollectionQueryDialogComponent should render correctly with [windowT
<nz-select-search
class="ant-select-selection-search"
>
<input
autocomplete="off"
class="ant-select-selection-search-input ng-untouched ng-pristine ng-valid"
readonly="readonly"
style="opacity: 0;"
/>
</nz-select-search>
Expand All @@ -375,28 +303,16 @@ exports[`AddCollectionQueryDialogComponent should render correctly with [windowT
<nz-select-placeholder
class="ant-select-selection-placeholder"
>
Choose
Choose
</nz-select-placeholder>
</nz-select-top-control>
<nz-select-arrow
class="ant-select-arrow"
>
<i
<span
class="anticon anticon-down"
nz-icon=""
nztype="down"
Expand All @@ -414,37 +330,22 @@ exports[`AddCollectionQueryDialogComponent should render correctly with [windowT
d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"
/>
</svg>
</i>
</span>
</nz-select-arrow>
</nz-select>
</div>
<span
class="ant-form-item-children-icon"
>
</span>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="ui-form-wrapper">
<form nz-form>
<form nz-form nzLayout="vertical">
<app-schema-form-item
*ngFor="let item of schemaProperties"
[item]="item"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { mock } from '../../../../../testing';

describe('ThemeDirective', () => {
it('should create an instance', () => {
const directive = new ThemeDirective(mock());
const directive = new ThemeDirective(mock(), mock());
expect(directive).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {

import { css } from '@emotion/css';
import { ThemeRegistryService } from '../../services';
import { NzConfigService } from 'ng-zorro-antd/core/config';

@Directive({
selector: '[appTheme]',
Expand All @@ -24,18 +25,21 @@ export class ThemeDirective implements OnInit, OnChanges {

private className = '';

constructor(private themeRegistry: ThemeRegistryService) {}
constructor(
private themeRegistry: ThemeRegistryService,
private nzConfigService: NzConfigService
) {}

ngOnInit() {
this.addHTMLClass(this.appTheme, this.appDarkTheme);
this.applyTheme(this.appTheme, this.appDarkTheme);
}

ngOnChanges(changes: SimpleChanges) {
if (
changes?.appTheme?.currentValue ||
changes?.appDarkTheme?.currentValue
) {
this.addHTMLClass(
this.applyTheme(
changes.appTheme?.currentValue,
changes.appDarkTheme?.currentValue
);
Expand Down Expand Up @@ -152,6 +156,16 @@ export class ThemeDirective implements OnInit, OnChanges {
return css(this.getCssString(createTheme(appTheme)));
}

applyTheme(theme: ICustomTheme, darkTheme?: ICustomTheme) {
this.nzConfigService.set('theme', {
primaryColor: theme.colors?.primary,
errorColor: theme.colors?.red,
warningColor: theme.colors?.yellow,
successColor: theme.colors?.green,
});
this.addHTMLClass(theme, darkTheme);
}

addHTMLClass(appTheme: ICustomTheme, appDarkTheme?: ICustomTheme) {
if (this.className) {
document.documentElement.classList.remove(this.className);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const AntdComponentModules = [
MarkdownModule,
ResizableModule,
IconsModule,
HotToastModule,
// HotToastModule,
...AntdComponentModules,
],
})
Expand Down
Loading

0 comments on commit d857dc0

Please sign in to comment.