Skip to content

Commit

Permalink
feat: migrate to angular standalone components (#1556)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: IgoLanguageModule don't import TranslateModule.forRoot
defaultLanguageLoader is not exported anymore
BREAKING CHANGE: 'provideDefaultLanguageLoader' and 'provideLanguageLoader' are replaced by 'DEFAULT_LANGUAGE_LOADER' and set directly inside the TranslationConfig
  • Loading branch information
alecarn authored Jan 18, 2024
1 parent faf8c42 commit b7e31e4
Show file tree
Hide file tree
Showing 434 changed files with 4,320 additions and 2,467 deletions.
32 changes: 27 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
"scripts": {
"build": "ng build auth --configuration production",
"format": "prettier --write ./src/**/*.{ts,js,html,scss,css,json}",
"lint": "ng lint auth",
"lint.fix": "ng lint auth --fix",
"test": "ng test auth --watch=false",
"test.watch": "ng test auth",
"watch": "ng build auth --watch"
Expand Down
3 changes: 2 additions & 1 deletion packages/auth/src/lib/auth-form/auth-facebook.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import { AuthService } from '../shared/auth.service';
selector: 'igo-auth-facebook',
templateUrl: './auth-facebook.component.html',
styleUrls: ['./auth-facebook.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true
})
export class AuthFacebookComponent {
private options?: AuthFacebookOptions;
Expand Down
21 changes: 20 additions & 1 deletion packages/auth/src/lib/auth-form/auth-form.component.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { NgIf } from '@angular/common';
import {
ChangeDetectionStrategy,
Component,
Expand All @@ -7,20 +8,38 @@ import {
Optional,
Output
} from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { NavigationStart, Router } from '@angular/router';

import { ConfigService } from '@igo2/core';

import { TranslateModule } from '@ngx-translate/core';
import { filter } from 'rxjs/operators';

import { AuthOptions } from '../shared/auth.interface';
import { AuthService } from '../shared/auth.service';
import { AuthFacebookComponent } from './auth-facebook.component';
import { AuthGoogleComponent } from './auth-google.component';
import { AuthInternComponent } from './auth-intern.component';
import { AuthMicrosoftComponent } from './auth-microsoft.component';
import { AuthMicrosoftb2cComponent } from './auth-microsoftb2c.component';

@Component({
selector: 'igo-auth-form',
templateUrl: './auth-form.component.html',
styleUrls: ['./auth-form.component.scss'],
changeDetection: ChangeDetectionStrategy.Default
changeDetection: ChangeDetectionStrategy.Default,
standalone: true,
imports: [
NgIf,
AuthGoogleComponent,
AuthMicrosoftComponent,
AuthMicrosoftb2cComponent,
AuthFacebookComponent,
AuthInternComponent,
MatButtonModule,
TranslateModule
]
})
export class AuthFormComponent implements OnInit {
@Input()
Expand Down
3 changes: 2 additions & 1 deletion packages/auth/src/lib/auth-form/auth-google.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import { AuthService } from '../shared/auth.service';
selector: 'igo-auth-google',
templateUrl: './auth-google.component.html',
styleUrls: ['./auth-google.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true
})
export class AuthGoogleComponent {
private options?: AuthGoogleOptions;
Expand Down
20 changes: 19 additions & 1 deletion packages/auth/src/lib/auth-form/auth-intern.component.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { NgIf } from '@angular/common';
import {
ChangeDetectionStrategy,
Component,
Expand All @@ -6,20 +7,37 @@ import {
Output
} from '@angular/core';
import {
FormsModule,
ReactiveFormsModule,
UntypedFormBuilder,
UntypedFormGroup,
Validators
} from '@angular/forms';
import { MatButtonModule } from '@angular/material/button';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';

import { LanguageService } from '@igo2/core';

import { TranslateModule } from '@ngx-translate/core';

import { AuthService } from '../shared/auth.service';

@Component({
selector: 'igo-auth-intern',
templateUrl: './auth-intern.component.html',
styleUrls: ['./auth-intern.component.scss'],
changeDetection: ChangeDetectionStrategy.Default
changeDetection: ChangeDetectionStrategy.Default,
standalone: true,
imports: [
FormsModule,
ReactiveFormsModule,
MatFormFieldModule,
MatInputModule,
MatButtonModule,
NgIf,
TranslateModule
]
})
export class AuthInternComponent {
@Input()
Expand Down
7 changes: 6 additions & 1 deletion packages/auth/src/lib/auth-form/auth-microsoft.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {
Inject,
Output
} from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';

import { ConfigService } from '@igo2/core';

Expand All @@ -22,6 +24,7 @@ import {
PublicClientApplication,
SilentRequest
} from '@azure/msal-browser';
import { TranslateModule } from '@ngx-translate/core';
import { Subject } from 'rxjs';
import { filter, takeUntil } from 'rxjs/operators';

Expand All @@ -35,7 +38,9 @@ import { AuthService } from '../shared/auth.service';
selector: 'igo-auth-microsoft',
templateUrl: './auth-microsoft.component.html',
styleUrls: ['./auth-microsoft.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [MatButtonModule, MatIconModule, TranslateModule]
})
export class AuthMicrosoftComponent {
private options?: AuthMicrosoftOptions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {
Inject,
Output
} from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';

import { ConfigService } from '@igo2/core';

Expand All @@ -18,6 +20,7 @@ import {
PublicClientApplication,
SilentRequest
} from '@azure/msal-browser';
import { TranslateModule } from '@ngx-translate/core';
import { Subject } from 'rxjs';
import { filter, takeUntil } from 'rxjs/operators';

Expand All @@ -33,7 +36,9 @@ import { AuthService } from '../shared/auth.service';
selector: 'igo-auth-microsoftb2c',
templateUrl: './auth-microsoftb2c.component.html',
styleUrls: ['./auth-microsoftb2c.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [MatButtonModule, MatIconModule, TranslateModule]
})
export class AuthMicrosoftb2cComponent {
private options: AuthMicrosoftb2cOptions;
Expand Down
16 changes: 16 additions & 0 deletions packages/auth/src/lib/auth-form/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
import { AuthFacebookComponent } from './auth-facebook.component';
import { AuthFormComponent } from './auth-form.component';
import { AuthGoogleComponent } from './auth-google.component';
import { AuthInternComponent } from './auth-intern.component';
import { AuthMicrosoftComponent } from './auth-microsoft.component';
import { AuthMicrosoftb2cComponent } from './auth-microsoftb2c.component';

export * from './auth-form.component';
export * from './auth-intern.component';
export * from './auth-facebook.component';
export * from './auth-google.component';

export const AUTH_FORM_DIRECTIVES = [
AuthFormComponent,
AuthGoogleComponent,
AuthInternComponent,
AuthFacebookComponent,
AuthMicrosoftComponent,
AuthMicrosoftb2cComponent
] as const;
4 changes: 1 addition & 3 deletions packages/auth/src/lib/auth.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ import { ProtectedDirective } from './shared/protected.directive';
MatIconModule,
MatButtonModule,
IgoLanguageModule,
MsalModule
],
declarations: [
MsalModule,
AuthFormComponent,
AuthGoogleComponent,
AuthInternComponent,
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/lib/shared/auth-storage.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { Injectable } from '@angular/core';

import { BaseStorage, ConfigService, StorageScope } from '@igo2/core';

import { AuthService } from './auth.service';
import { AuthStorageOptions } from './auth-storage.interface';
import { AuthService } from './auth.service';
import { TokenService } from './token.service';

@Injectable({
Expand Down
3 changes: 2 additions & 1 deletion packages/auth/src/lib/shared/protected.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { Directive, ElementRef } from '@angular/core';
import { AuthService } from './auth.service';

@Directive({
selector: '[igoProtected]'
selector: '[igoProtected]',
standalone: true
})
export class ProtectedDirective {
constructor(authentication: AuthService, el: ElementRef) {
Expand Down
2 changes: 2 additions & 0 deletions packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
"scripts": {
"build": "ng build common --configuration production",
"format": "prettier --write ./src/**/*.{ts,js,html,scss,css,json}",
"lint": "ng lint common",
"lint.fix": "ng lint common --fix",
"postbuild": "ts-node ../../scripts/src/common/postbuild-common.ts",
"test": "ng test common --watch=false",
"watch": "ng build common --watch"
Expand Down
12 changes: 6 additions & 6 deletions packages/common/src/lib/action/action.module.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';

import { IgoActionbarModule } from './actionbar/actionbar.module';
import { ActionbarComponent } from './actionbar/actionbar.component';

/**
* @deprecated import the ActionbarComponent directly
*/
@NgModule({
imports: [CommonModule, IgoActionbarModule],
exports: [IgoActionbarModule],
declarations: [],
providers: []
imports: [ActionbarComponent],
exports: [ActionbarComponent]
})
export class IgoActionModule {}
Loading

0 comments on commit b7e31e4

Please sign in to comment.