Skip to content

Commit e928e62

Browse files
yangxiaolangHaoxin YangJounQin
authored
chore: upgrade to angular 19 (#585)
* chore: upgrade angular 19 * chore: upgrade ng 19 * chore: migrate cdkscrollable to wrapper * fix: fix unit test * chore: fix jest test * fix: unit test case * chore: add @babel/helper-environment-visitor * chore: add @babel/plugin-syntax-class-static-block * chore: add @babel/plugin-syntax-private-property-in-object * chore: add @babel/plugin-syntax-export-namespace-from * chore: add @babel/plugin-syntax-dynamic-import * fix: fullscreen fitviewport dialog style * Create unlucky-days-yawn.md * Update .changeset/unlucky-days-yawn.md Co-authored-by: JounQin <admin@1stg.me> * chore: use prettier lint manually * chore: prettier stories ts * chore: prettier empty line * chore: revert test:ci * chore: rm unexpected empty line --------- Co-authored-by: Haoxin Yang <hxyang@alauda.io> Co-authored-by: JounQin <admin@1stg.me>
1 parent ec6e62a commit e928e62

File tree

209 files changed

+3334
-3652
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

209 files changed

+3334
-3652
lines changed

.changeset/unlucky-days-yawn.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@alauda/ui": major
3+
---
4+
5+
chore/upgrade angular 19 & migrate fix

angular.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,18 @@
2424
"prefix": "app",
2525
"architect": {
2626
"build": {
27-
"builder": "@angular-devkit/build-angular:browser",
27+
"builder": "@angular/build:application",
2828
"options": {
29-
"outputPath": "dist",
30-
"index": "",
31-
"main": "",
29+
"outputPath": {
30+
"base": "dist"
31+
},
32+
"index": false,
3233
"tsConfig": "tsconfig.json",
3334
"inlineStyleLanguage": "scss",
3435
"styles": [
3536
"src/theme/style.scss"
36-
]
37+
],
38+
"browser": ""
3739
},
3840
"configurations": {
3941
"production": {
@@ -52,9 +54,7 @@
5254
"outputHashing": "all"
5355
},
5456
"development": {
55-
"buildOptimizer": false,
5657
"optimization": false,
57-
"vendorChunk": true,
5858
"extractLicenses": false,
5959
"sourceMap": true,
6060
"namedChunks": true

jest.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Config } from '@jest/types';
22

33
const config: Config.InitialOptions = {
44
preset: 'jest-preset-angular',
5-
testMatch: ['<rootDir>/src/**/+(*.)+(spec|test).+(ts|js)?(x)'],
5+
testMatch: ['<rootDir>/src/**/*.+(spec|test).+(ts|js)?(x)'],
66
testEnvironment: 'jsdom',
77
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
88
coverageReporters: ['text', 'html'],

jest.setup.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import 'jest-preset-angular/setup-jest';
22

3-
// @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment
4-
globalThis.ngJest = {
5-
testEnvironmentOptions: {
3+
Object.assign(globalThis, {
4+
ngJest: {
65
errorOnUnknownElements: true,
76
errorOnUnknownProperties: true,
87
},
9-
};
8+
});
109

1110
// https://jestjs.io/docs/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom
1211
Object.defineProperty(window, 'matchMedia', {

package.json

+29-28
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,7 @@
4040
"test:watch": "jest --watch"
4141
},
4242
"peerDependencies": {
43-
"@angular/animations": ">=18.0.0",
44-
"@angular/cdk": ">=18.0.0",
45-
"@angular/common": ">=18.0.0",
46-
"@angular/core": ">=18.0.0",
47-
"@angular/forms": ">=18.0.0",
48-
"@angular/platform-browser": ">=18.0.0",
43+
"@angular/cdk": ">=19.0.0",
4944
"dayjs": "^1.0.0",
5045
"rxjs": "^7.0.0"
5146
},
@@ -55,34 +50,40 @@
5550
"@1stg/remark-preset": "^2.0.0",
5651
"@1stg/simple-git-hooks": "^0.2.3",
5752
"@1stg/stylelint-config": "^6.0.0",
58-
"@angular-devkit/build-angular": "^18.0.7",
59-
"@angular/animations": "^18.0.6",
60-
"@angular/cdk": "^18.0.6",
61-
"@angular/cli": "^18.0.7",
62-
"@angular/common": "^18.0.6",
63-
"@angular/compiler": "^18.0.6",
64-
"@angular/compiler-cli": "^18.0.6",
65-
"@angular/core": "^18.0.6",
66-
"@angular/forms": "^18.0.6",
67-
"@angular/platform-browser": "^18.0.6",
68-
"@angular/platform-browser-dynamic": "^18.0.6",
53+
"@angular-devkit/build-angular": "^19.1.7",
54+
"@angular/animations": "^19.1.6",
55+
"@angular/build": "^19.1.7",
56+
"@angular/cdk": "^19.1.5",
57+
"@angular/cli": "^19.1.7",
58+
"@angular/common": "^19.1.6",
59+
"@angular/compiler": "^19.1.6",
60+
"@angular/compiler-cli": "^19.1.6",
61+
"@angular/core": "^19.1.6",
62+
"@angular/forms": "^19.1.6",
63+
"@angular/platform-browser": "^19.1.6",
64+
"@angular/platform-browser-dynamic": "^19.1.6",
65+
"@babel/helper-environment-visitor": "^7.24.7",
66+
"@babel/plugin-syntax-class-static-block": "^7.14.5",
67+
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
68+
"@babel/plugin-syntax-export-namespace-from": "^7.8.3",
69+
"@babel/plugin-syntax-private-property-in-object": "^7.14.5",
6970
"@changesets/changelog-github": "^0.4.8",
7071
"@changesets/cli": "^2.26.2",
7172
"@commitlint/cli": "^17.7.1",
7273
"@compodoc/compodoc": "^1.1.25",
7374
"@eslint/compat": "^1.1.1",
7475
"@eslint/eslintrc": "^3.1.0",
7576
"@eslint/js": "^9.7.0",
76-
"@storybook/addon-essentials": "^8.2.1",
77-
"@storybook/addon-interactions": "^8.2.1",
78-
"@storybook/addon-links": "^8.2.1",
79-
"@storybook/angular": "^8.2.1",
80-
"@storybook/blocks": "^8.2.1",
77+
"@storybook/addon-essentials": "^8.5.6",
78+
"@storybook/addon-interactions": "^8.5.6",
79+
"@storybook/addon-links": "^8.5.6",
80+
"@storybook/angular": "^8.5.6",
81+
"@storybook/blocks": "^8.5.6",
8182
"@types/chroma-js": "^2.4.0",
8283
"@types/file-saver": "^2.0.5",
8384
"@types/jest": "29.5.12",
8485
"@types/node": "^20.5.7",
85-
"angular-eslint": "18.1.0",
86+
"angular-eslint": "19.1.0",
8687
"chroma-js": "^2.4.2",
8788
"dayjs": "^1.11.11",
8889
"eslint": "^9.6.0",
@@ -96,25 +97,25 @@
9697
"gulp-dart-sass": "^1.1.0",
9798
"jest": "^29.7.0",
9899
"jest-junit": "^16.0.0",
99-
"jest-preset-angular": "^14.1.0",
100+
"jest-preset-angular": "^14.5.1",
100101
"jsdom": "^24.1.0",
101102
"lint-staged": "^15.2.7",
102-
"ng-packagr": "^18.0.0",
103+
"ng-packagr": "^19.1.2",
103104
"npm-run-all": "^4.1.5",
104105
"patch-package": "^8.0.0",
105106
"remark-gfm": "^4.0.0",
106107
"rxjs": "^7.8.1",
107108
"simple-git-hooks": "^2.11.1",
108-
"storybook": "^8.2.1",
109+
"storybook": "^8.5.6",
109110
"storybook-dark-mode": "^4.0.2",
110111
"style-loader": "^4.0.0",
111112
"stylelint": "^16.6.1",
112113
"ts-jest": "29.2.0",
113114
"ts-node": "^10.9.2",
114-
"typescript": "~5.4.0",
115+
"typescript": "~5.7.3",
115116
"typescript-eslint": "7.16.1",
116117
"yarn-deduplicate": "^6.0.2",
117-
"zone.js": "^0.14.7"
118+
"zone.js": "^0.15.0"
118119
},
119120
"publishConfig": {
120121
"access": "public",

patches/@angular-eslint+eslint-plugin-template+18.1.0.patch

-14
This file was deleted.

src/accordion/accordion-item/accordion-item.component.ts

-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ export class AccordionItemContentDirective {}
4949
]),
5050
],
5151
viewProviders: [AccordionItemComponent],
52-
standalone: true,
5352
imports: [IconComponent, NgIf, NgTemplateOutlet],
5453
})
5554
export class AccordionItemComponent
@@ -67,7 +66,6 @@ export class AccordionItemComponent
6766

6867
lazyContentTpl: TemplateRef<unknown>;
6968

70-
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
7169
constructor(
7270
accordion: AccordionComponent,
7371
cdr: ChangeDetectorRef,

src/accordion/accordion.component.spec.ts

-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ describe('AccordionComponent', () => {
5252
</aui-accordion-item>
5353
</aui-accordion>
5454
`,
55-
standalone: true,
5655
imports: [...ACCORDION_MODULE],
5756
})
5857
class TestComponent {

src/anchor/anchor.component.ts

-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ const bem = buildBem('aui-anchor');
3636
templateUrl: 'anchor-tree.component.html',
3737
encapsulation: ViewEncapsulation.None,
3838
changeDetection: ChangeDetectionStrategy.OnPush,
39-
standalone: true,
4039
imports: [NgFor, NgIf, NgTemplateOutlet],
4140
})
4241
export class AnchorTreeComponent
@@ -123,7 +122,6 @@ export class AnchorTreeComponent
123122
styleUrls: ['anchor.component.scss'],
124123
encapsulation: ViewEncapsulation.None,
125124
changeDetection: ChangeDetectionStrategy.OnPush,
126-
standalone: true,
127125
imports: [AnchorTreeComponent],
128126
})
129127
export class AnchorComponent

src/autocomplete/autocomplete.component.ts

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ import { SuggestionComponent } from './suggestion/suggestion.component';
3838
changeDetection: ChangeDetectionStrategy.OnPush,
3939
encapsulation: ViewEncapsulation.None,
4040
preserveWhitespaces: false,
41-
standalone: true,
4241
imports: [AsyncPipe],
4342
})
4443
export class AutocompleteComponent implements AfterContentInit {

src/autocomplete/suggestion-group/suggestion-group.component.ts

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import { SuggestionComponent } from '../suggestion/suggestion.component';
2020
changeDetection: ChangeDetectionStrategy.OnPush,
2121
encapsulation: ViewEncapsulation.None,
2222
preserveWhitespaces: false,
23-
standalone: true,
2423
imports: [AsyncPipe],
2524
})
2625
export class SuggestionGroupComponent implements AfterContentInit {

src/autocomplete/suggestion/suggestion.component.ts

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import { AutocompleteComponent } from '../autocomplete.component';
3535
changeDetection: ChangeDetectionStrategy.OnPush,
3636
encapsulation: ViewEncapsulation.None,
3737
preserveWhitespaces: false,
38-
standalone: true,
3938
imports: [AsyncPipe],
4039
})
4140
export class SuggestionComponent {

src/back-top/back-top.component.ts

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ type TargetType = Element | Window | string;
3232
encapsulation: ViewEncapsulation.None,
3333
changeDetection: ChangeDetectionStrategy.OnPush,
3434
preserveWhitespaces: false,
35-
standalone: true,
3635
imports: [ButtonComponent, IconComponent, AsyncPipe],
3736
})
3837
export class BackTopComponent {

src/breadcrumb/breadcrumb-item.component.ts

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import { IconComponent } from '../icon/icon.component';
1515
changeDetection: ChangeDetectionStrategy.OnPush,
1616
encapsulation: ViewEncapsulation.None,
1717
preserveWhitespaces: false,
18-
standalone: true,
1918
imports: [NgIf, IconComponent],
2019
})
2120
export class BreadcrumbItemComponent {

src/breadcrumb/breadcrumb.component.spec.ts

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ describe('BreadcrumbComponent', () => {
2929
<aui-breadcrumb-item>default</aui-breadcrumb-item>
3030
</aui-breadcrumb>
3131
`,
32-
standalone: true,
3332
imports: [...BREADCRUMB_MODULE],
3433
})
3534
class TestComponent {}

src/button/button.component.spec.ts

-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ describe('ButtonComponent', () => {
108108
{{ content }}
109109
</button>
110110
`,
111-
standalone: true,
112111
imports: [ButtonComponent],
113112
})
114113
class TestComponent {

src/button/button.component.ts

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ const prefix = 'aui-button--';
2525
encapsulation: ViewEncapsulation.None,
2626
changeDetection: ChangeDetectionStrategy.OnPush,
2727
preserveWhitespaces: false,
28-
standalone: true,
2928
imports: [NgIf, IconComponent],
3029
})
3130
export class ButtonComponent implements OnDestroy {

src/checkbox/checkbox-group/checkbox-group.component.spec.ts

-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ describe('CheckboxGroupComponent', () => {
9494
</aui-checkbox-group>
9595
</div>
9696
`,
97-
standalone: true,
9897
imports: [FormsModule, NgForOf, ...CHECKBOX_MODULE],
9998
})
10099
class TestComponent {

src/checkbox/checkbox.component.spec.ts

-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ describe('CheckboxComponent', () => {
119119
{{ content }}
120120
</aui-checkbox>
121121
`,
122-
standalone: true,
123122
imports: [FormsModule, CheckboxComponent],
124123
})
125124
export class TestComponent {

src/checkbox/checkbox.component.ts

-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ let uniqueId = 0;
3737
multi: true,
3838
},
3939
],
40-
standalone: true,
4140
imports: [NgIf, IconComponent],
4241
})
4342
export class CheckboxComponent<T>

src/date-picker/calendar/date-picker-panel/component.ts

-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ import {
4949
multi: true,
5050
},
5151
],
52-
standalone: true,
5352
imports: [
5453
CalendarHeaderComponent,
5554
PickerPanelComponent,

src/date-picker/calendar/footer/component.ts

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import { I18nPipe } from '../../../i18n/i18n.pipe';
1818
styleUrls: ['./style.scss'],
1919
encapsulation: ViewEncapsulation.None,
2020
changeDetection: ChangeDetectionStrategy.OnPush,
21-
standalone: true,
2221
imports: [NgIf, NgTemplateOutlet, ButtonComponent, I18nPipe],
2322
})
2423
export class CalendarFooterComponent {

src/date-picker/calendar/header/component.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ const bem = buildBem('aui-calendar-header');
2727
styleUrls: ['./style.scss'],
2828
encapsulation: ViewEncapsulation.None,
2929
changeDetection: ChangeDetectionStrategy.OnPush,
30-
standalone: true,
3130
imports: [NgIf, NgTemplateOutlet, ButtonComponent, IconComponent, I18nPipe],
3231
})
3332
export class CalendarHeaderComponent {
@@ -142,8 +141,8 @@ export class CalendarHeaderComponent {
142141
return constrainValue.isSame(range.start, MONTH)
143142
? 0
144143
: constrainValue.isBefore(range.start, MONTH)
145-
? -1
146-
: 1;
144+
? -1
145+
: 1;
147146
}
148147

149148
navHead(range: DateNavRange, value: number) {

src/date-picker/calendar/panel/picker-panel.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ const bem = buildBem('aui-picker-panel');
4949
styleUrls: ['./picker-panel.style.scss'],
5050
encapsulation: ViewEncapsulation.None,
5151
changeDetection: ChangeDetectionStrategy.OnPush,
52-
standalone: true,
5352
imports: [NgClass, NgIf, NgFor, ButtonComponent, I18nPipe],
5453
})
5554
export class PickerPanelComponent implements OnChanges {
@@ -132,7 +131,6 @@ export class PickerPanelComponent implements OnChanges {
132131
}
133132

134133
// 根据当前数据,计算渲染表格
135-
136134
renderPanelData(date: Dayjs, navRange: DateNavRange) {
137135
const value = [];
138136
let colCounts = 0;
@@ -203,8 +201,8 @@ export class PickerPanelComponent implements OnChanges {
203201
this.navRange === DateNavRange.Decade
204202
? value.isSame(dateValue, YEAR)
205203
: this.navRange === DateNavRange.Year
206-
? value.isSame(dateValue, MONTH)
207-
: value.isSame(dateValue, DAY),
204+
? value.isSame(dateValue, MONTH)
205+
: value.isSame(dateValue, DAY),
208206
);
209207
}
210208

src/date-picker/calendar/range-picker-panel/component.ts

-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ const bem = buildBem('aui-date-range-picker-panel');
4848
multi: true,
4949
},
5050
],
51-
standalone: true,
5251
imports: [
5352
CalendarHeaderComponent,
5453
PickerPanelComponent,

0 commit comments

Comments
 (0)