From 192d9c095a9d6784fadbfb64d92d1f2846e6004e Mon Sep 17 00:00:00 2001 From: bigBear713 <774326739@qq.com> Date: Sun, 22 Dec 2024 11:15:26 +0800 Subject: [PATCH 1/5] chore: upgrade to angular 19 --- package.json | 28 ++++++------- .../r-str/test/r-str.component.spec.ts | 1 + .../test/placeholder.directive.spec.ts | 1 + .../templateRef/templateRef-testing.module.ts | 1 + src/app/app.component.ts | 9 ++-- .../call-fn-demo/call-fn-demo.component.ts | 9 ++-- src/app/img-demo/img-demo.component.ts | 9 ++-- .../placeholder-str-demo.component.ts | 9 ++-- src/app/r-str-demo/r-str-demo.component.ts | 9 ++-- .../standalone-demo.component.ts | 41 +++++++++---------- .../tpl-content-demo.component.ts | 9 ++-- 11 files changed, 65 insertions(+), 61 deletions(-) diff --git a/package.json b/package.json index 5b7dde5..054ade8 100644 --- a/package.json +++ b/package.json @@ -23,29 +23,29 @@ }, "private": true, "dependencies": { - "@angular/animations": "^18.0.1", - "@angular/common": "^18.0.1", - "@angular/compiler": "^18.0.1", - "@angular/core": "^18.0.1", - "@angular/forms": "^18.0.1", - "@angular/platform-browser": "^18.0.1", - "@angular/platform-browser-dynamic": "^18.0.1", - "@angular/router": "^18.0.1", + "@angular/animations": "^19.0.5", + "@angular/common": "^19.0.5", + "@angular/compiler": "^19.0.5", + "@angular/core": "^19.0.5", + "@angular/forms": "^19.0.5", + "@angular/platform-browser": "^19.0.5", + "@angular/platform-browser-dynamic": "^19.0.5", + "@angular/router": "^19.0.5", "dayjs": "^1.11.10", "lodash-es": "^4.17.21", "rxjs": "~6.6.0", "tslib": "^2.3.0", - "zone.js": "~0.14.2" + "zone.js": "~0.15.0" }, "devDependencies": { - "@angular-devkit/build-angular": "^18.0.2", + "@angular-devkit/build-angular": "^19.0.6", "@angular-eslint/builder": "18.0.1", "@angular-eslint/eslint-plugin": "18.0.1", "@angular-eslint/eslint-plugin-template": "18.0.1", "@angular-eslint/schematics": "18.0.1", "@angular-eslint/template-parser": "18.0.1", - "@angular/cli": "^18.0.2", - "@angular/compiler-cli": "^18.0.1", + "@angular/cli": "^19.0.6", + "@angular/compiler-cli": "^19.0.5", "@types/jasmine": "~3.8.0", "@types/lodash-es": "^4.17.5", "@types/node": "^12.11.1", @@ -60,9 +60,9 @@ "karma-coverage": "~2.0.3", "karma-jasmine": "~4.0.0", "karma-jasmine-html-reporter": "~1.7.0", - "ng-packagr": "^18.0.0", + "ng-packagr": "^19.0.1", "source-map-explorer": "^2.5.3", "prettier": "^3.2.5", - "typescript": "~5.4.5" + "typescript": "~5.6.3" } } \ No newline at end of file diff --git a/projects/nb-common/src/lib/components/r-str/test/r-str.component.spec.ts b/projects/nb-common/src/lib/components/r-str/test/r-str.component.spec.ts index 76d46cc..4dab2b9 100644 --- a/projects/nb-common/src/lib/components/r-str/test/r-str.component.spec.ts +++ b/projects/nb-common/src/lib/components/r-str/test/r-str.component.spec.ts @@ -5,6 +5,7 @@ import { NbCommonTestingModule } from '../../../testing/nb-common-testing.module import { NbRStrComponent } from '../r-str.component'; @Component({ + standalone: false, selector: 'nb-r-str-host', template: ``, }) diff --git a/projects/nb-common/src/lib/directives/test/placeholder.directive.spec.ts b/projects/nb-common/src/lib/directives/test/placeholder.directive.spec.ts index 245839b..310e0e7 100644 --- a/projects/nb-common/src/lib/directives/test/placeholder.directive.spec.ts +++ b/projects/nb-common/src/lib/directives/test/placeholder.directive.spec.ts @@ -10,6 +10,7 @@ const STR_PLACEHOLDER = 'this is a string placeholder'; const OBSERVABLE_PLACEHOLDER = 'this is a observable placeholder'; @Component({ + standalone: false, selector: 'mock-component', template: ``, }) diff --git a/projects/nb-common/src/lib/testing/templateRef/templateRef-testing.module.ts b/projects/nb-common/src/lib/testing/templateRef/templateRef-testing.module.ts index d55b461..23376e1 100644 --- a/projects/nb-common/src/lib/testing/templateRef/templateRef-testing.module.ts +++ b/projects/nb-common/src/lib/testing/templateRef/templateRef-testing.module.ts @@ -7,6 +7,7 @@ import { ComponentFixture, TestBedStatic } from '@angular/core/testing'; // eslint-disable-next-line @angular-eslint/component-selector selector: 'mock-templateRef', template: ``, + standalone: false, }) export class TemplateRefTestingComponent { @ViewChild('tplRef', { static: true }) tplRef!: TemplateRef; diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 34fb983..7f0fb51 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -2,10 +2,11 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; import { GTagService } from './g-tag.service'; @Component({ - selector: 'app-root', - templateUrl: './app.component.html', - styleUrls: ['./app.component.scss'], - changeDetection: ChangeDetectionStrategy.OnPush, + selector: 'app-root', + templateUrl: './app.component.html', + styleUrls: ['./app.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush, + standalone: false }) export class AppComponent { title = 'nb-common-demo'; diff --git a/src/app/call-fn-demo/call-fn-demo.component.ts b/src/app/call-fn-demo/call-fn-demo.component.ts index e19565f..f0a803b 100644 --- a/src/app/call-fn-demo/call-fn-demo.component.ts +++ b/src/app/call-fn-demo/call-fn-demo.component.ts @@ -5,11 +5,10 @@ import { NbCallFnPipe } from 'nb-common'; import { GTagService } from '../g-tag.service'; @Component({ - selector: 'app-call-fn-demo', - standalone: true, - imports: [NbCallFnPipe, FormsModule], - templateUrl: './call-fn-demo.component.html', - styleUrls: ['./call-fn-demo.component.css'], + selector: 'app-call-fn-demo', + imports: [NbCallFnPipe, FormsModule], + templateUrl: './call-fn-demo.component.html', + styleUrls: ['./call-fn-demo.component.css'] }) export class CallFnDemoComponent implements OnInit { val1 = 0; diff --git a/src/app/img-demo/img-demo.component.ts b/src/app/img-demo/img-demo.component.ts index d3bf8a7..96511e3 100644 --- a/src/app/img-demo/img-demo.component.ts +++ b/src/app/img-demo/img-demo.component.ts @@ -2,10 +2,11 @@ import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; import { GTagService } from '../g-tag.service'; @Component({ - selector: 'app-img-demo', - templateUrl: './img-demo.component.html', - styleUrls: ['./img-demo.component.scss'], - changeDetection: ChangeDetectionStrategy.OnPush, + selector: 'app-img-demo', + templateUrl: './img-demo.component.html', + styleUrls: ['./img-demo.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush, + standalone: false }) export class ImgDemoComponent implements OnInit { bigImg = 'https://pic2.zhimg.com/v2-77be54b348b0168f3562f51404451aeb_r.jpg'; diff --git a/src/app/placeholder-str-demo/placeholder-str-demo.component.ts b/src/app/placeholder-str-demo/placeholder-str-demo.component.ts index 5d8fc38..6771b8f 100644 --- a/src/app/placeholder-str-demo/placeholder-str-demo.component.ts +++ b/src/app/placeholder-str-demo/placeholder-str-demo.component.ts @@ -3,10 +3,11 @@ import { BehaviorSubject } from 'rxjs'; import { GTagService } from '../g-tag.service'; @Component({ - selector: 'app-placeholder-str-demo', - templateUrl: './placeholder-str-demo.component.html', - styleUrls: ['./placeholder-str-demo.component.scss'], - changeDetection: ChangeDetectionStrategy.OnPush, + selector: 'app-placeholder-str-demo', + templateUrl: './placeholder-str-demo.component.html', + styleUrls: ['./placeholder-str-demo.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush, + standalone: false }) export class PlaceholderStrDemoComponent implements OnInit { placeholder$ = new BehaviorSubject('这是placeholder'); diff --git a/src/app/r-str-demo/r-str-demo.component.ts b/src/app/r-str-demo/r-str-demo.component.ts index 38e1f17..68a084b 100644 --- a/src/app/r-str-demo/r-str-demo.component.ts +++ b/src/app/r-str-demo/r-str-demo.component.ts @@ -3,10 +3,11 @@ import { BehaviorSubject } from 'rxjs'; import { GTagService } from '../g-tag.service'; @Component({ - selector: 'app-r-str-demo', - templateUrl: './r-str-demo.component.html', - styleUrls: ['./r-str-demo.component.scss'], - changeDetection: ChangeDetectionStrategy.OnPush, + selector: 'app-r-str-demo', + templateUrl: './r-str-demo.component.html', + styleUrls: ['./r-str-demo.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush, + standalone: false }) export class RStrDemoComponent implements OnInit { observableDemo$ = new BehaviorSubject('1'); diff --git a/src/app/standalone-demo/standalone-demo.component.ts b/src/app/standalone-demo/standalone-demo.component.ts index 0f275c4..4196380 100644 --- a/src/app/standalone-demo/standalone-demo.component.ts +++ b/src/app/standalone-demo/standalone-demo.component.ts @@ -12,28 +12,25 @@ import { BehaviorSubject } from 'rxjs'; import { GTagService } from '../g-tag.service'; @Component({ - standalone: true, - selector: 'app-standalone-demo', - templateUrl: './standalone-demo.component.html', - styleUrls: ['./standalone-demo.component.css'], - imports: [ - CommonModule, - NbRStrComponent, - NbPlaceholderDirective, - NbImgDirective, - NbTplContentPipe, - ], - providers: [ - { - provide: NB_DEFAULT_LOADING_IMG, - useFactory: (domSanitizer: DomSanitizer) => { - return domSanitizer.bypassSecurityTrustResourceUrl( - 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBzdHlsZT0ibWFyZ2luOmF1dG87YmFja2dyb3VuZDp0cmFuc3BhcmVudDtkaXNwbGF5OmJsb2NrOyIgd2lkdGg9IjIwMHB4IiBoZWlnaHQ9IjIwMHB4IiB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQiPgo8cGF0aCBkPSJNMTcgNTBBMzMgMzMgMCAwIDAgODMgNTBBMzMgMzUgMCAwIDEgMTcgNTAiIGZpbGw9IiM0MGE5ZmYiIHN0cm9rZT0ibm9uZSI+CiAgPGFuaW1hdGVUcmFuc2Zvcm0gYXR0cmlidXRlTmFtZT0idHJhbnNmb3JtIiB0eXBlPSJyb3RhdGUiIGR1cj0iMXMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiBrZXlUaW1lcz0iMDsxIiB2YWx1ZXM9IjAgNTAgNTE7MzYwIDUwIDUxIj48L2FuaW1hdGVUcmFuc2Zvcm0+CjwvcGF0aD4KPC9zdmc+' - ); - }, - deps: [DomSanitizer], - }, - ], + selector: 'app-standalone-demo', + templateUrl: './standalone-demo.component.html', + styleUrls: ['./standalone-demo.component.css'], + imports: [ + CommonModule, + NbRStrComponent, + NbPlaceholderDirective, + NbImgDirective, + NbTplContentPipe, + ], + providers: [ + { + provide: NB_DEFAULT_LOADING_IMG, + useFactory: (domSanitizer: DomSanitizer) => { + return domSanitizer.bypassSecurityTrustResourceUrl('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBzdHlsZT0ibWFyZ2luOmF1dG87YmFja2dyb3VuZDp0cmFuc3BhcmVudDtkaXNwbGF5OmJsb2NrOyIgd2lkdGg9IjIwMHB4IiBoZWlnaHQ9IjIwMHB4IiB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQiPgo8cGF0aCBkPSJNMTcgNTBBMzMgMzMgMCAwIDAgODMgNTBBMzMgMzUgMCAwIDEgMTcgNTAiIGZpbGw9IiM0MGE5ZmYiIHN0cm9rZT0ibm9uZSI+CiAgPGFuaW1hdGVUcmFuc2Zvcm0gYXR0cmlidXRlTmFtZT0idHJhbnNmb3JtIiB0eXBlPSJyb3RhdGUiIGR1cj0iMXMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiBrZXlUaW1lcz0iMDsxIiB2YWx1ZXM9IjAgNTAgNTE7MzYwIDUwIDUxIj48L2FuaW1hdGVUcmFuc2Zvcm0+CjwvcGF0aD4KPC9zdmc+'); + }, + deps: [DomSanitizer], + }, + ] }) export class StandaloneDemoComponent implements OnInit, OnDestroy { promiseDemo = new Promise(resolve => diff --git a/src/app/tpl-content-demo/tpl-content-demo.component.ts b/src/app/tpl-content-demo/tpl-content-demo.component.ts index 910087e..180968d 100644 --- a/src/app/tpl-content-demo/tpl-content-demo.component.ts +++ b/src/app/tpl-content-demo/tpl-content-demo.component.ts @@ -2,10 +2,11 @@ import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; import { GTagService } from '../g-tag.service'; @Component({ - selector: 'app-tpl-content-demo', - templateUrl: './tpl-content-demo.component.html', - styleUrls: ['./tpl-content-demo.component.scss'], - changeDetection: ChangeDetectionStrategy.OnPush, + selector: 'app-tpl-content-demo', + templateUrl: './tpl-content-demo.component.html', + styleUrls: ['./tpl-content-demo.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush, + standalone: false }) export class TplContentDemoComponent implements OnInit { constructor(private gtagService: GTagService) { From 26e928f8d80975219d982cb9c53fa60fbfffbb0f Mon Sep 17 00:00:00 2001 From: bigBear713 <774326739@qq.com> Date: Sun, 22 Dec 2024 11:31:30 +0800 Subject: [PATCH 2/5] chore: update dependencies --- package.json | 4 ++-- projects/nb-common/src/lib/pipes/nb-call-fn.pipe.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 054ade8..1b085b0 100644 --- a/package.json +++ b/package.json @@ -49,8 +49,8 @@ "@types/jasmine": "~3.8.0", "@types/lodash-es": "^4.17.5", "@types/node": "^12.11.1", - "@typescript-eslint/eslint-plugin": "7.8.0", - "@typescript-eslint/parser": "7.8.0", + "@typescript-eslint/eslint-plugin": "8.18.1", + "@typescript-eslint/parser": "8.18.1", "eslint": "^8.57.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-prettier": "^5.1.3", diff --git a/projects/nb-common/src/lib/pipes/nb-call-fn.pipe.ts b/projects/nb-common/src/lib/pipes/nb-call-fn.pipe.ts index 6f7c5bb..071a91c 100644 --- a/projects/nb-common/src/lib/pipes/nb-call-fn.pipe.ts +++ b/projects/nb-common/src/lib/pipes/nb-call-fn.pipe.ts @@ -2,7 +2,7 @@ import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ standalone: true, name: 'nbCallFn' }) export class NbCallFnPipe implements PipeTransform { - // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types + // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-function-type transform(fn: Function, ...args: any): undefined | unknown { if (!fn) return; return fn(...args); From 39f5e301e7fb96bca9f2116863ea8f718a6cf9b5 Mon Sep 17 00:00:00 2001 From: bigBear713 <774326739@qq.com> Date: Tue, 24 Dec 2024 10:34:08 +0800 Subject: [PATCH 3/5] style: lint the demo code --- src/app/app.component.ts | 10 ++--- .../call-fn-demo/call-fn-demo.component.ts | 9 ++-- src/app/img-demo/img-demo.component.ts | 10 ++--- .../placeholder-str-demo.component.ts | 10 ++--- src/app/r-str-demo/r-str-demo.component.ts | 10 ++--- .../standalone-demo.component.ts | 41 ++++++++++--------- .../tpl-content-demo.component.ts | 10 ++--- 7 files changed, 52 insertions(+), 48 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 7f0fb51..3ef1ed1 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -2,11 +2,11 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; import { GTagService } from './g-tag.service'; @Component({ - selector: 'app-root', - templateUrl: './app.component.html', - styleUrls: ['./app.component.scss'], - changeDetection: ChangeDetectionStrategy.OnPush, - standalone: false + selector: 'app-root', + templateUrl: './app.component.html', + styleUrls: ['./app.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush, + standalone: false, }) export class AppComponent { title = 'nb-common-demo'; diff --git a/src/app/call-fn-demo/call-fn-demo.component.ts b/src/app/call-fn-demo/call-fn-demo.component.ts index f0a803b..0ddf8da 100644 --- a/src/app/call-fn-demo/call-fn-demo.component.ts +++ b/src/app/call-fn-demo/call-fn-demo.component.ts @@ -5,10 +5,11 @@ import { NbCallFnPipe } from 'nb-common'; import { GTagService } from '../g-tag.service'; @Component({ - selector: 'app-call-fn-demo', - imports: [NbCallFnPipe, FormsModule], - templateUrl: './call-fn-demo.component.html', - styleUrls: ['./call-fn-demo.component.css'] + standalone: true, + selector: 'app-call-fn-demo', + imports: [NbCallFnPipe, FormsModule], + templateUrl: './call-fn-demo.component.html', + styleUrls: ['./call-fn-demo.component.css'], }) export class CallFnDemoComponent implements OnInit { val1 = 0; diff --git a/src/app/img-demo/img-demo.component.ts b/src/app/img-demo/img-demo.component.ts index 96511e3..0523cf0 100644 --- a/src/app/img-demo/img-demo.component.ts +++ b/src/app/img-demo/img-demo.component.ts @@ -2,11 +2,11 @@ import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; import { GTagService } from '../g-tag.service'; @Component({ - selector: 'app-img-demo', - templateUrl: './img-demo.component.html', - styleUrls: ['./img-demo.component.scss'], - changeDetection: ChangeDetectionStrategy.OnPush, - standalone: false + selector: 'app-img-demo', + templateUrl: './img-demo.component.html', + styleUrls: ['./img-demo.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush, + standalone: false, }) export class ImgDemoComponent implements OnInit { bigImg = 'https://pic2.zhimg.com/v2-77be54b348b0168f3562f51404451aeb_r.jpg'; diff --git a/src/app/placeholder-str-demo/placeholder-str-demo.component.ts b/src/app/placeholder-str-demo/placeholder-str-demo.component.ts index 6771b8f..a4812d2 100644 --- a/src/app/placeholder-str-demo/placeholder-str-demo.component.ts +++ b/src/app/placeholder-str-demo/placeholder-str-demo.component.ts @@ -3,11 +3,11 @@ import { BehaviorSubject } from 'rxjs'; import { GTagService } from '../g-tag.service'; @Component({ - selector: 'app-placeholder-str-demo', - templateUrl: './placeholder-str-demo.component.html', - styleUrls: ['./placeholder-str-demo.component.scss'], - changeDetection: ChangeDetectionStrategy.OnPush, - standalone: false + selector: 'app-placeholder-str-demo', + templateUrl: './placeholder-str-demo.component.html', + styleUrls: ['./placeholder-str-demo.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush, + standalone: false, }) export class PlaceholderStrDemoComponent implements OnInit { placeholder$ = new BehaviorSubject('这是placeholder'); diff --git a/src/app/r-str-demo/r-str-demo.component.ts b/src/app/r-str-demo/r-str-demo.component.ts index 68a084b..095cc17 100644 --- a/src/app/r-str-demo/r-str-demo.component.ts +++ b/src/app/r-str-demo/r-str-demo.component.ts @@ -3,11 +3,11 @@ import { BehaviorSubject } from 'rxjs'; import { GTagService } from '../g-tag.service'; @Component({ - selector: 'app-r-str-demo', - templateUrl: './r-str-demo.component.html', - styleUrls: ['./r-str-demo.component.scss'], - changeDetection: ChangeDetectionStrategy.OnPush, - standalone: false + selector: 'app-r-str-demo', + templateUrl: './r-str-demo.component.html', + styleUrls: ['./r-str-demo.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush, + standalone: false, }) export class RStrDemoComponent implements OnInit { observableDemo$ = new BehaviorSubject('1'); diff --git a/src/app/standalone-demo/standalone-demo.component.ts b/src/app/standalone-demo/standalone-demo.component.ts index 4196380..0f275c4 100644 --- a/src/app/standalone-demo/standalone-demo.component.ts +++ b/src/app/standalone-demo/standalone-demo.component.ts @@ -12,25 +12,28 @@ import { BehaviorSubject } from 'rxjs'; import { GTagService } from '../g-tag.service'; @Component({ - selector: 'app-standalone-demo', - templateUrl: './standalone-demo.component.html', - styleUrls: ['./standalone-demo.component.css'], - imports: [ - CommonModule, - NbRStrComponent, - NbPlaceholderDirective, - NbImgDirective, - NbTplContentPipe, - ], - providers: [ - { - provide: NB_DEFAULT_LOADING_IMG, - useFactory: (domSanitizer: DomSanitizer) => { - return domSanitizer.bypassSecurityTrustResourceUrl('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBzdHlsZT0ibWFyZ2luOmF1dG87YmFja2dyb3VuZDp0cmFuc3BhcmVudDtkaXNwbGF5OmJsb2NrOyIgd2lkdGg9IjIwMHB4IiBoZWlnaHQ9IjIwMHB4IiB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQiPgo8cGF0aCBkPSJNMTcgNTBBMzMgMzMgMCAwIDAgODMgNTBBMzMgMzUgMCAwIDEgMTcgNTAiIGZpbGw9IiM0MGE5ZmYiIHN0cm9rZT0ibm9uZSI+CiAgPGFuaW1hdGVUcmFuc2Zvcm0gYXR0cmlidXRlTmFtZT0idHJhbnNmb3JtIiB0eXBlPSJyb3RhdGUiIGR1cj0iMXMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiBrZXlUaW1lcz0iMDsxIiB2YWx1ZXM9IjAgNTAgNTE7MzYwIDUwIDUxIj48L2FuaW1hdGVUcmFuc2Zvcm0+CjwvcGF0aD4KPC9zdmc+'); - }, - deps: [DomSanitizer], - }, - ] + standalone: true, + selector: 'app-standalone-demo', + templateUrl: './standalone-demo.component.html', + styleUrls: ['./standalone-demo.component.css'], + imports: [ + CommonModule, + NbRStrComponent, + NbPlaceholderDirective, + NbImgDirective, + NbTplContentPipe, + ], + providers: [ + { + provide: NB_DEFAULT_LOADING_IMG, + useFactory: (domSanitizer: DomSanitizer) => { + return domSanitizer.bypassSecurityTrustResourceUrl( + 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBzdHlsZT0ibWFyZ2luOmF1dG87YmFja2dyb3VuZDp0cmFuc3BhcmVudDtkaXNwbGF5OmJsb2NrOyIgd2lkdGg9IjIwMHB4IiBoZWlnaHQ9IjIwMHB4IiB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQiPgo8cGF0aCBkPSJNMTcgNTBBMzMgMzMgMCAwIDAgODMgNTBBMzMgMzUgMCAwIDEgMTcgNTAiIGZpbGw9IiM0MGE5ZmYiIHN0cm9rZT0ibm9uZSI+CiAgPGFuaW1hdGVUcmFuc2Zvcm0gYXR0cmlidXRlTmFtZT0idHJhbnNmb3JtIiB0eXBlPSJyb3RhdGUiIGR1cj0iMXMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiBrZXlUaW1lcz0iMDsxIiB2YWx1ZXM9IjAgNTAgNTE7MzYwIDUwIDUxIj48L2FuaW1hdGVUcmFuc2Zvcm0+CjwvcGF0aD4KPC9zdmc+' + ); + }, + deps: [DomSanitizer], + }, + ], }) export class StandaloneDemoComponent implements OnInit, OnDestroy { promiseDemo = new Promise(resolve => diff --git a/src/app/tpl-content-demo/tpl-content-demo.component.ts b/src/app/tpl-content-demo/tpl-content-demo.component.ts index 180968d..ec6ee70 100644 --- a/src/app/tpl-content-demo/tpl-content-demo.component.ts +++ b/src/app/tpl-content-demo/tpl-content-demo.component.ts @@ -2,11 +2,11 @@ import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; import { GTagService } from '../g-tag.service'; @Component({ - selector: 'app-tpl-content-demo', - templateUrl: './tpl-content-demo.component.html', - styleUrls: ['./tpl-content-demo.component.scss'], - changeDetection: ChangeDetectionStrategy.OnPush, - standalone: false + selector: 'app-tpl-content-demo', + templateUrl: './tpl-content-demo.component.html', + styleUrls: ['./tpl-content-demo.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush, + standalone: false, }) export class TplContentDemoComponent implements OnInit { constructor(private gtagService: GTagService) { From e53e192f9c8edec62e4d8d36b032409ce59a4742 Mon Sep 17 00:00:00 2001 From: bigBear713 <774326739@qq.com> Date: Tue, 24 Dec 2024 11:46:34 +0800 Subject: [PATCH 4/5] style: lint the code --- package.json | 10 +++++----- .../lib/components/r-str/test/r-str.component.spec.ts | 1 + .../lib/directives/test/placeholder.directive.spec.ts | 1 + .../testing/templateRef/templateRef-testing.module.ts | 1 + src/app/app.component.ts | 1 + src/app/img-demo/img-demo.component.ts | 1 + .../placeholder-str-demo.component.ts | 1 + src/app/r-str-demo/r-str-demo.component.ts | 1 + src/app/tpl-content-demo/tpl-content-demo.component.ts | 1 + 9 files changed, 13 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 1b085b0..9a94426 100644 --- a/package.json +++ b/package.json @@ -39,11 +39,11 @@ }, "devDependencies": { "@angular-devkit/build-angular": "^19.0.6", - "@angular-eslint/builder": "18.0.1", - "@angular-eslint/eslint-plugin": "18.0.1", - "@angular-eslint/eslint-plugin-template": "18.0.1", - "@angular-eslint/schematics": "18.0.1", - "@angular-eslint/template-parser": "18.0.1", + "@angular-eslint/builder": "19.0.2", + "@angular-eslint/eslint-plugin": "19.0.2", + "@angular-eslint/eslint-plugin-template": "19.0.2", + "@angular-eslint/schematics": "19.0.2", + "@angular-eslint/template-parser": "19.0.2", "@angular/cli": "^19.0.6", "@angular/compiler-cli": "^19.0.5", "@types/jasmine": "~3.8.0", diff --git a/projects/nb-common/src/lib/components/r-str/test/r-str.component.spec.ts b/projects/nb-common/src/lib/components/r-str/test/r-str.component.spec.ts index 4dab2b9..15a6ea9 100644 --- a/projects/nb-common/src/lib/components/r-str/test/r-str.component.spec.ts +++ b/projects/nb-common/src/lib/components/r-str/test/r-str.component.spec.ts @@ -5,6 +5,7 @@ import { NbCommonTestingModule } from '../../../testing/nb-common-testing.module import { NbRStrComponent } from '../r-str.component'; @Component({ + // eslint-disable-next-line @angular-eslint/prefer-standalone standalone: false, selector: 'nb-r-str-host', template: ``, diff --git a/projects/nb-common/src/lib/directives/test/placeholder.directive.spec.ts b/projects/nb-common/src/lib/directives/test/placeholder.directive.spec.ts index 310e0e7..5577c50 100644 --- a/projects/nb-common/src/lib/directives/test/placeholder.directive.spec.ts +++ b/projects/nb-common/src/lib/directives/test/placeholder.directive.spec.ts @@ -10,6 +10,7 @@ const STR_PLACEHOLDER = 'this is a string placeholder'; const OBSERVABLE_PLACEHOLDER = 'this is a observable placeholder'; @Component({ + // eslint-disable-next-line @angular-eslint/prefer-standalone standalone: false, selector: 'mock-component', template: ``, diff --git a/projects/nb-common/src/lib/testing/templateRef/templateRef-testing.module.ts b/projects/nb-common/src/lib/testing/templateRef/templateRef-testing.module.ts index 23376e1..a05bb5b 100644 --- a/projects/nb-common/src/lib/testing/templateRef/templateRef-testing.module.ts +++ b/projects/nb-common/src/lib/testing/templateRef/templateRef-testing.module.ts @@ -7,6 +7,7 @@ import { ComponentFixture, TestBedStatic } from '@angular/core/testing'; // eslint-disable-next-line @angular-eslint/component-selector selector: 'mock-templateRef', template: ``, + // eslint-disable-next-line @angular-eslint/prefer-standalone standalone: false, }) export class TemplateRefTestingComponent { diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 3ef1ed1..0071590 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -6,6 +6,7 @@ import { GTagService } from './g-tag.service'; templateUrl: './app.component.html', styleUrls: ['./app.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, + // eslint-disable-next-line @angular-eslint/prefer-standalone standalone: false, }) export class AppComponent { diff --git a/src/app/img-demo/img-demo.component.ts b/src/app/img-demo/img-demo.component.ts index 0523cf0..c195f8f 100644 --- a/src/app/img-demo/img-demo.component.ts +++ b/src/app/img-demo/img-demo.component.ts @@ -6,6 +6,7 @@ import { GTagService } from '../g-tag.service'; templateUrl: './img-demo.component.html', styleUrls: ['./img-demo.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, + // eslint-disable-next-line @angular-eslint/prefer-standalone standalone: false, }) export class ImgDemoComponent implements OnInit { diff --git a/src/app/placeholder-str-demo/placeholder-str-demo.component.ts b/src/app/placeholder-str-demo/placeholder-str-demo.component.ts index a4812d2..444c46d 100644 --- a/src/app/placeholder-str-demo/placeholder-str-demo.component.ts +++ b/src/app/placeholder-str-demo/placeholder-str-demo.component.ts @@ -7,6 +7,7 @@ import { GTagService } from '../g-tag.service'; templateUrl: './placeholder-str-demo.component.html', styleUrls: ['./placeholder-str-demo.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, + // eslint-disable-next-line @angular-eslint/prefer-standalone standalone: false, }) export class PlaceholderStrDemoComponent implements OnInit { diff --git a/src/app/r-str-demo/r-str-demo.component.ts b/src/app/r-str-demo/r-str-demo.component.ts index 095cc17..ace7ff9 100644 --- a/src/app/r-str-demo/r-str-demo.component.ts +++ b/src/app/r-str-demo/r-str-demo.component.ts @@ -7,6 +7,7 @@ import { GTagService } from '../g-tag.service'; templateUrl: './r-str-demo.component.html', styleUrls: ['./r-str-demo.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, + // eslint-disable-next-line @angular-eslint/prefer-standalone standalone: false, }) export class RStrDemoComponent implements OnInit { diff --git a/src/app/tpl-content-demo/tpl-content-demo.component.ts b/src/app/tpl-content-demo/tpl-content-demo.component.ts index ec6ee70..1d98603 100644 --- a/src/app/tpl-content-demo/tpl-content-demo.component.ts +++ b/src/app/tpl-content-demo/tpl-content-demo.component.ts @@ -6,6 +6,7 @@ import { GTagService } from '../g-tag.service'; templateUrl: './tpl-content-demo.component.html', styleUrls: ['./tpl-content-demo.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, + // eslint-disable-next-line @angular-eslint/prefer-standalone standalone: false, }) export class TplContentDemoComponent implements OnInit { From 8a78a1f5f3f7f827a14359c5a89a6e77cbb785af Mon Sep 17 00:00:00 2001 From: bigBear713 <774326739@qq.com> Date: Tue, 24 Dec 2024 13:23:33 +0800 Subject: [PATCH 5/5] doc: update document content --- CHANGELOG.CN.md | 6 ++++++ CHANGELOG.md | 6 ++++++ README.CN.md | 1 + README.md | 1 + package.json | 2 +- projects/nb-common/README.CN.md | 1 + projects/nb-common/README.md | 1 + projects/nb-common/package.json | 6 +++--- 8 files changed, 20 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.CN.md b/CHANGELOG.CN.md index 7bf76e5..54cdc4a 100644 --- a/CHANGELOG.CN.md +++ b/CHANGELOG.CN.md @@ -1,3 +1,9 @@ +# v19.0.0 +## 破坏性更新 +- feat: `angular`升级到`v19`; + +--- + # v18.0.0 ## 破坏性更新 - feat: `angular`升级到`v18`; diff --git a/CHANGELOG.md b/CHANGELOG.md index 44bb6cd..6d72d17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# v19.0.0 +## Breaking Changes +- feat: Upgrade `angular` to `v19`; + +--- + # v18.0.0 ## Breaking Changes - feat: Upgrade `angular` to `v18`; diff --git a/README.CN.md b/README.CN.md index dfbf1a3..56939aa 100644 --- a/README.CN.md +++ b/README.CN.md @@ -50,6 +50,7 @@ Angular common lib by bigBear713, include some common `component`, `directive`, | ^16.0.0 | ^16.0.0 | | ^17.0.0 | ^17.0.0 | | ^18.0.0 | ^18.0.0 | +| ^19.0.0 | ^19.0.0 | --- diff --git a/README.md b/README.md index 373d92f..fdc2c84 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ Angular common lib by bigBear713, include some common `component`, `directive`, | ^16.0.0 | ^16.0.0 | | ^17.0.0 | ^17.0.0 | | ^18.0.0 | ^18.0.0 | +| ^19.0.0 | ^19.0.0 | --- diff --git a/package.json b/package.json index 9a94426..641d535 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nb-common-demo", - "version": "18.0.0", + "version": "19.0.0", "scripts": { "ng": "ng", "start": "ng serve", diff --git a/projects/nb-common/README.CN.md b/projects/nb-common/README.CN.md index 2c72ddf..af9760e 100644 --- a/projects/nb-common/README.CN.md +++ b/projects/nb-common/README.CN.md @@ -50,6 +50,7 @@ Angular common lib by bigBear713, include some common `component`, `directive`, | ^16.0.0 | ^16.0.0 | | ^17.0.0 | ^17.0.0 | | ^18.0.0 | ^18.0.0 | +| ^19.0.0 | ^19.0.0 |
diff --git a/projects/nb-common/README.md b/projects/nb-common/README.md index 0e45140..b34d771 100644 --- a/projects/nb-common/README.md +++ b/projects/nb-common/README.md @@ -50,6 +50,7 @@ Angular common lib by bigBear713, include some common `component`, `directive`, | ^16.0.0 | ^16.0.0 | | ^17.0.0 | ^17.0.0 | | ^18.0.0 | ^18.0.0 | +| ^19.0.0 | ^19.0.0 |
diff --git a/projects/nb-common/package.json b/projects/nb-common/package.json index 87818a5..297219f 100644 --- a/projects/nb-common/package.json +++ b/projects/nb-common/package.json @@ -1,6 +1,6 @@ { "name": "@bigbear713/nb-common", - "version": "18.0.0", + "version": "19.0.0", "homepage": "https://github.com/bigBear713/nb-common/blob/main/projects/nb-common/README.md", "description": "An angular(2+) common component, pipe, service library.", "keywords": [ @@ -25,8 +25,8 @@ "url": "https://github.com/bigBear713/nb-common/issues" }, "peerDependencies": { - "@angular/common": "^18.0.0", - "@angular/core": "^18.0.0" + "@angular/common": "^19.0.0", + "@angular/core": "^19.0.0" }, "dependencies": { "lodash-es": "^4.17.21",