Skip to content

Commit 88d1983

Browse files
authored
fix: standalone components (#108)
* chore: update lint rules * chore: update ng-mocks * chore: update angular cli * fix: standalone for ng-mocks
1 parent fae0de9 commit 88d1983

20 files changed

+1779
-990
lines changed

package-lock.json

Lines changed: 1140 additions & 538 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@
4646
"zone.js": "^0.15.0"
4747
},
4848
"devDependencies": {
49-
"@angular-devkit/build-angular": "^19.0.3",
49+
"@angular-devkit/build-angular": "^19.1.3",
5050
"@angular-eslint/builder": "19.0.1",
5151
"@angular-eslint/eslint-plugin": "19.0.1",
5252
"@angular-eslint/eslint-plugin-template": "19.0.1",
5353
"@angular-eslint/schematics": "19.0.1",
5454
"@angular-eslint/template-parser": "19.0.1",
55-
"@angular/cli": "^19.0.3",
55+
"@angular/cli": "^19.1.3",
5656
"@angular/compiler-cli": "^19.0.3",
5757
"@angular/language-service": "^19.0.3",
5858
"@commitlint/cli": "^19.6.0",
@@ -73,7 +73,7 @@
7373
"karma-coverage-istanbul-reporter": "~3.0.3",
7474
"karma-jasmine": "~5.1.0",
7575
"karma-jasmine-html-reporter": "^2.1.0",
76-
"ng-mocks": "^14.13.1",
76+
"ng-mocks": "^14.13.2",
7777
"ng-packagr": "^19.0.1",
7878
"semantic-release": "^24.2.0",
7979
"semantic-release-cli": "^5.4.6",

projects/ngb-filterable-dropdown-example/.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"style": "kebab-case"
3434
}
3535
],
36-
"@angular-eslint/prefer-standalone": "off"
36+
"@angular-eslint/prefer-standalone": "error"
3737
}
3838
},
3939
{
Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,39 @@
1-
import { TestBed } from '@angular/core/testing';
2-
import { NgbCustomFilterableDropdownModule, NgbFilterableDropdownModule } from 'projects/ngb-filterable-dropdown/src';
3-
import { AppComponent } from './app.component';
1+
import { TestBed } from "@angular/core/testing";
2+
import {
3+
NgbCustomFilterableDropdownModule,
4+
NgbFilterableDropdownModule,
5+
} from "projects/ngb-filterable-dropdown/src";
6+
import { AppComponent } from "./app.component";
47

5-
describe('AppComponent', () => {
6-
beforeEach(() => {
7-
TestBed.configureTestingModule({
8-
declarations: [
9-
AppComponent,
10-
],
8+
describe("AppComponent", () => {
9+
beforeEach(async () => {
10+
await TestBed.configureTestingModule({
1111
imports: [
12+
AppComponent,
1213
NgbCustomFilterableDropdownModule,
13-
NgbFilterableDropdownModule
14-
]
14+
NgbFilterableDropdownModule,
15+
],
1516
}).compileComponents();
1617
});
1718

18-
it('should create the app', () => {
19+
it("should create the app", () => {
1920
const fixture = TestBed.createComponent(AppComponent);
2021
const app = fixture.debugElement.componentInstance;
2122
expect(app).toBeTruthy();
2223
});
2324

24-
it('should have as title \'ngb-filterable-dropdown-examples\'', () => {
25+
it("should have as title 'ngb-filterable-dropdown-examples'", () => {
2526
const fixture = TestBed.createComponent(AppComponent);
2627
const app = fixture.debugElement.componentInstance;
27-
expect(app.title).toEqual('ngb-filterable-dropdown-examples');
28+
expect(app.title).toEqual("ngb-filterable-dropdown-examples");
2829
});
2930

30-
it('should render title', () => {
31+
it("should render title", () => {
3132
const fixture = TestBed.createComponent(AppComponent);
3233
fixture.detectChanges();
3334
const compiled = fixture.debugElement.nativeElement;
34-
expect(compiled.querySelector('h2').textContent).toContain('ngb-filterable-dropdown-examples');
35+
expect(compiled.querySelector("h2").textContent).toContain(
36+
"ngb-filterable-dropdown-examples"
37+
);
3538
});
3639
});

projects/ngb-filterable-dropdown-example/src/app/app.component.ts

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,51 @@
1-
import { Component } from '@angular/core';
2-
import { ItemCreatedEvent, NgbFilterableDropdownSelectionMode, OpenChangedEvent, SelectionChangedEvent } from 'projects/ngb-filterable-dropdown/src';
1+
import { CommonModule } from "@angular/common";
2+
import { Component } from "@angular/core";
3+
import {
4+
ItemCreatedEvent,
5+
NgbCustomFilterableDropdownModule,
6+
NgbFilterableDropdownModule,
7+
NgbFilterableDropdownSelectionMode,
8+
OpenChangedEvent,
9+
SelectionChangedEvent,
10+
} from "projects/ngb-filterable-dropdown/src";
311

412
@Component({
5-
selector: 'app-root', // eslint-disable-line @angular-eslint/component-selector
6-
templateUrl: './app.component.html',
7-
styleUrls: ['./app.component.scss'],
8-
standalone: false
13+
selector: "app-root", // eslint-disable-line @angular-eslint/component-selector
14+
templateUrl: "./app.component.html",
15+
styleUrls: ["./app.component.scss"],
16+
imports: [
17+
NgbFilterableDropdownModule,
18+
NgbCustomFilterableDropdownModule,
19+
CommonModule,
20+
],
921
})
1022
export class AppComponent {
11-
title = 'ngb-filterable-dropdown-examples';
12-
13-
selectionModes: Array<string> = Object.values(NgbFilterableDropdownSelectionMode);
14-
autoCloseValues = ['inside', 'outside', true, false];
15-
16-
items = ['Beetle', 'Ant', 'Moth', 'Fire Ant', 'Dung Beetle', 'Grass Ant', 'A Really Long Made Up Bug Name For Testing Tooltips Etc Etc Yadda Yadda Yadda'];
23+
title = "ngb-filterable-dropdown-examples";
24+
25+
selectionModes: Array<string> = Object.values(
26+
NgbFilterableDropdownSelectionMode
27+
);
28+
autoCloseValues = ["inside", "outside", true, false];
29+
30+
items = [
31+
"Beetle",
32+
"Ant",
33+
"Moth",
34+
"Fire Ant",
35+
"Dung Beetle",
36+
"Grass Ant",
37+
"A Really Long Made Up Bug Name For Testing Tooltips Etc Etc Yadda Yadda Yadda",
38+
];
1739

1840
allowCreateItem = false;
19-
autoClose: boolean | 'inside' | 'outside' = false;
41+
autoClose: boolean | "inside" | "outside" = false;
2042
customToggleText = false;
2143
disabled = false;
2244
genericHandleUseCustomHandle = true;
23-
genericHandleSelection: string | Array<string> = 'nothing';
45+
genericHandleSelection: string | Array<string> = "nothing";
2446
isGenericHandleDropdownOpen = false;
25-
searchInputPlaceholder = 'Search Bugs';
26-
selection: string | Array<string> = 'Moth';
47+
searchInputPlaceholder = "Search Bugs";
48+
selection: string | Array<string> = "Moth";
2749
selectionMode = NgbFilterableDropdownSelectionMode.SingleSelect;
2850
tooltips = false;
2951
tooltipsOpenDelay = 750;
@@ -49,7 +71,7 @@ export class AppComponent {
4971
this.genericHandleSelection = $event.selection;
5072
}
5173

52-
onAutoCloseValueChanged(value: boolean | 'inside' | 'outside'): void {
74+
onAutoCloseValueChanged(value: boolean | "inside" | "outside"): void {
5375
this.autoClose = value;
5476
}
5577

projects/ngb-filterable-dropdown-example/src/app/app.module.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.
Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
import { enableProdMode } from '@angular/core';
2-
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
3-
4-
import { AppModule } from './app/app.module';
5-
import { environment } from './environments/environment';
1+
import { enableProdMode } from "@angular/core";
2+
import { bootstrapApplication } from "@angular/platform-browser";
3+
import { environment } from "./environments/environment";
4+
import { AppComponent } from "./app/app.component";
65

76
if (environment.production) {
87
enableProdMode();
98
}
109

11-
platformBrowserDynamic().bootstrapModule(AppModule)
12-
.catch(err => console.error(err));
10+
bootstrapApplication(AppComponent);

projects/ngb-filterable-dropdown/.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"style": "kebab-case"
3333
}
3434
],
35-
"@angular-eslint/prefer-standalone": "off"
35+
"@angular-eslint/prefer-standalone": "error"
3636
}
3737
},
3838
{
Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
1-
import { Component } from '@angular/core';
1+
import { Component } from "@angular/core";
22

33
@Component({
4-
selector: 'icon-all', // eslint-disable-line @angular-eslint/component-selector
5-
template: `
6-
<svg height="12px" width="12px" fill="#000000" version="1.1" x="0px" y="0px" viewBox="21.481 21.441 57.23 57.237" style="enable-background:new 0 0 100 100; padding-bottom: 1px;" xmlns="http://www.w3.org/2000/svg">
7-
<g>
8-
<path d="M74.5,21.7H33.6c-2.1,0-3.8,1.7-3.8,3.8v4.3h-3.2c-2.7,0-4.9,2.2-4.9,4.9v38.8c0,2.7,2.2,4.9,4.9,4.9h38.8 c2.7,0,4.9-2.2,4.9-4.9v-3.2h4.3c2.1,0,3.8-1.7,3.8-3.8V25.5C78.3,23.4,76.6,21.7,74.5,21.7z M66.9,73.4c0,0.9-0.7,1.6-1.6,1.6 H26.6c-0.9,0-1.6-0.7-1.6-1.6V34.6c0-0.9,0.7-1.6,1.6-1.6h38.8c0.9,0,1.6,0.7,1.6,1.6V73.4z M75,66.4c0,0.3-0.2,0.5-0.5,0.5h-4.3 V34.6c0-2.7-2.2-4.9-4.9-4.9H33.1v-4.3c0-0.3,0.2-0.5,0.5-0.5h40.9c0.3,0,0.5,0.2,0.5,0.5V66.4z"/>
9-
<path d="M54.4,42.4L40,58.8l-2.6-2.7c-1.2-1.3-3.3-1.3-4.5-0.1s-1.3,3.3-0.1,4.5l5,5.2c0.6,0.6,1.4,1,2.3,1c0,0,0,0,0.1,0 c0.9,0,1.7-0.4,2.3-1.1l16.8-19c1.2-1.3,1.1-3.4-0.3-4.5C57.6,41,55.6,41.1,54.4,42.4z"/>
10-
</g>
4+
selector: "icon-all", // eslint-disable-line @angular-eslint/component-selector
5+
template: `
6+
<svg
7+
height="12px"
8+
width="12px"
9+
fill="#000000"
10+
version="1.1"
11+
x="0px"
12+
y="0px"
13+
viewBox="21.481 21.441 57.23 57.237"
14+
style="enable-background:new 0 0 100 100; padding-bottom: 1px;"
15+
xmlns="http://www.w3.org/2000/svg"
16+
>
17+
<g>
18+
<path
19+
d="M74.5,21.7H33.6c-2.1,0-3.8,1.7-3.8,3.8v4.3h-3.2c-2.7,0-4.9,2.2-4.9,4.9v38.8c0,2.7,2.2,4.9,4.9,4.9h38.8 c2.7,0,4.9-2.2,4.9-4.9v-3.2h4.3c2.1,0,3.8-1.7,3.8-3.8V25.5C78.3,23.4,76.6,21.7,74.5,21.7z M66.9,73.4c0,0.9-0.7,1.6-1.6,1.6 H26.6c-0.9,0-1.6-0.7-1.6-1.6V34.6c0-0.9,0.7-1.6,1.6-1.6h38.8c0.9,0,1.6,0.7,1.6,1.6V73.4z M75,66.4c0,0.3-0.2,0.5-0.5,0.5h-4.3 V34.6c0-2.7-2.2-4.9-4.9-4.9H33.1v-4.3c0-0.3,0.2-0.5,0.5-0.5h40.9c0.3,0,0.5,0.2,0.5,0.5V66.4z"
20+
/>
21+
<path
22+
d="M54.4,42.4L40,58.8l-2.6-2.7c-1.2-1.3-3.3-1.3-4.5-0.1s-1.3,3.3-0.1,4.5l5,5.2c0.6,0.6,1.4,1,2.3,1c0,0,0,0,0.1,0 c0.9,0,1.7-0.4,2.3-1.1l16.8-19c1.2-1.3,1.1-3.4-0.3-4.5C57.6,41,55.6,41.1,54.4,42.4z"
23+
/>
24+
</g>
1125
</svg>
12-
`,
13-
standalone: false
26+
`,
1427
})
15-
export class AllComponent { }
28+
export class AllComponent {}
Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,37 @@
1-
import { Component } from '@angular/core';
1+
import { Component } from "@angular/core";
22

33
@Component({
4-
selector: 'icon-checkmark', // eslint-disable-line @angular-eslint/component-selector
5-
template: `
6-
<svg height='14px' width='14px' fill="#000000" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" version="1.1" style="shape-rendering:geometricPrecision;text-rendering:geometricPrecision;image-rendering:optimizeQuality;" viewBox="0 0 333 333" x="0px" y="0px" fill-rule="evenodd" clip-rule="evenodd">
4+
selector: "icon-checkmark", // eslint-disable-line @angular-eslint/component-selector
5+
template: `
6+
<svg
7+
height="14px"
8+
width="14px"
9+
fill="#000000"
10+
xmlns="http://www.w3.org/2000/svg"
11+
xmlns:xlink="http://www.w3.org/1999/xlink"
12+
xml:space="preserve"
13+
version="1.1"
14+
style="shape-rendering:geometricPrecision;text-rendering:geometricPrecision;image-rendering:optimizeQuality;"
15+
viewBox="0 0 333 333"
16+
x="0px"
17+
y="0px"
18+
fill-rule="evenodd"
19+
clip-rule="evenodd"
20+
>
721
<defs>
822
<style type="text/css">
9-
.fil0 {fill:#000000}
23+
.fil0 {
24+
fill: #000000;
25+
}
1026
</style>
1127
</defs>
1228
<g>
13-
<path class="fil0" d="M47 165c-20,-21 -52,11 -31,31 26,27 52,55 79,81 12,11 21,11 32,0l191 -190c20,-21 -11,-53 -32,-32l-174 174 -65 -64z"></path>
29+
<path
30+
class="fil0"
31+
d="M47 165c-20,-21 -52,11 -31,31 26,27 52,55 79,81 12,11 21,11 32,0l191 -190c20,-21 -11,-53 -32,-32l-174 174 -65 -64z"
32+
></path>
1433
</g>
1534
</svg>
16-
`,
17-
standalone: false
35+
`,
1836
})
19-
export class CheckmarkComponent { }
37+
export class CheckmarkComponent {}

0 commit comments

Comments
 (0)