Bump angular 18 (#182)

This commit is contained in:
Ildar Galeev 2024-06-26 23:04:07 +07:00 committed by GitHub
parent 1368639ac7
commit a785856303
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
52 changed files with 5028 additions and 4838 deletions

View File

@ -1,7 +1,7 @@
module.exports = { module.exports = {
extends: '@vality/eslint-config', extends: '@vality/eslint-config-ng',
overrides: [ overrides: [
...require('@vality/eslint-config/configs').angular('dsh').overrides, ...require('@vality/eslint-config-ng/configs').angular('dsh').overrides,
...require('@vality/eslint-config/configs').importOrder(['@dsh/**']).overrides, ...require('@vality/eslint-config-ng/configs').importOrder(['@dsh/**']).overrides,
], ],
}; };

9240
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -25,36 +25,33 @@
"spell:fix": "cspell --no-progress --show-suggestions --show-context **" "spell:fix": "cspell --no-progress --show-suggestions --show-context **"
}, },
"dependencies": { "dependencies": {
"@angular/animations": "^17.2.1", "@angular/animations": "^18.0.4",
"@angular/cdk": "~17.2.0", "@angular/cdk": "~18.0.4",
"@angular/common": "^17.2.1", "@angular/common": "^18.0.4",
"@angular/compiler": "^17.2.1", "@angular/compiler": "^18.0.4",
"@angular/core": "^17.2.1", "@angular/core": "^18.0.4",
"@angular/forms": "^17.2.1", "@angular/forms": "^18.0.4",
"@angular/material": "~17.2.0", "@angular/material": "~18.0.4",
"@angular/material-moment-adapter": "^17.2.0", "@angular/material-moment-adapter": "^18.0.4",
"@angular/platform-browser": "^17.2.1", "@angular/platform-browser": "^18.0.4",
"@angular/platform-browser-dynamic": "^17.2.1", "@angular/platform-browser-dynamic": "^18.0.4",
"@angular/router": "^17.2.1", "@angular/router": "^18.0.4",
"@ngneat/transloco": "^6.0.4", "@ngneat/transloco": "^6.0.4",
"@ngneat/until-destroy": "^9.0.0", "@ngneat/until-destroy": "^9.0.0",
"@sentry/angular-ivy": "^7.100.1", "@vality/ng-core": "18.0.1-pr-63-9e315a6.0",
"@sentry/integrations": "^7.100.1", "@vality/swag-anapi-v2": "2.0.1-2eda808.0",
"@sentry/tracing": "^7.100.1", "@vality/swag-api-keys-v2": "0.1.2-321124b.0",
"@vality/ng-core": "^17.2.1-pr-57-0134d85.0", "@vality/swag-claim-management": "0.1.1-b5248eb.0",
"@vality/swag-anapi-v2": "2.0.1-32ed85f.0", "@vality/swag-organizations": "1.0.1-e863566.0",
"@vality/swag-api-keys-v2": "0.1.2-f0ece04.0", "@vality/swag-payments": "0.1.3-5760b7e.0",
"@vality/swag-claim-management": "0.1.1-6b6711b.0", "@vality/swag-url-shortener": "0.1.1-9659896.0",
"@vality/swag-organizations": "1.0.1-de0cd06.0", "@vality/swag-wallet": "0.1.3-54f56db.0",
"@vality/swag-payments": "0.1.3-5dc6d9f.0",
"@vality/swag-url-shortener": "0.1.0",
"@vality/swag-wallet": "0.1.3-3b8984e.0",
"angular-file": "^3.0.1", "angular-file": "^3.0.1",
"apexcharts": "^3.19.2", "apexcharts": "^3.19.2",
"css-element-queries": "1.2.3", "css-element-queries": "1.2.3",
"humanize-duration": "^3.19.0", "humanize-duration": "^3.19.0",
"jwt-decode": "^3.1.2", "jwt-decode": "^3.1.2",
"keycloak-angular": "^15.1.0", "keycloak-angular": "16.0.1",
"keycloak-js": "^18.0.1", "keycloak-js": "^18.0.1",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"moment": "2.29.4", "moment": "2.29.4",
@ -67,30 +64,27 @@
"zone.js": "~0.14.3" "zone.js": "~0.14.3"
}, },
"devDependencies": { "devDependencies": {
"@angular-builders/custom-webpack": "^17.0.0", "@angular-builders/custom-webpack": "^18.0.0",
"@angular-devkit/build-angular": "^17.2.0", "@angular-devkit/build-angular": "^18.0.5",
"@angular-eslint/builder": "^17.2.0", "@angular-eslint/builder": "^18.0.1",
"@angular-eslint/schematics": "^17.2.0", "@angular-eslint/schematics": "^18.0.1",
"@angular/cli": "^17.2.0", "@angular/cli": "^18.0.5",
"@angular/compiler-cli": "^17.2.1", "@angular/compiler-cli": "^18.0.4",
"@angular/language-service": "^17.2.1", "@angular/language-service": "^18.0.4",
"@ngneat/transloco-keys-manager": "^3.8.0", "@ngneat/transloco-keys-manager": "^3.8.0",
"@ngneat/transloco-optimize": "^5.0.3", "@ngneat/transloco-optimize": "^5.0.3",
"@types/d3": "^5.7.0", "@types/d3": "^5.7.0",
"@types/glob": "^7.1.3", "@types/glob": "^7.1.3",
"@types/humanize-duration": "^3.18.0", "@types/humanize-duration": "^3.18.0",
"@types/jasmine": "~5.1.4", "@types/jasmine": "~5.1.4",
"@types/jwt-decode": "^3.1.0",
"@types/lodash-es": "^4.17.12", "@types/lodash-es": "^4.17.12",
"@types/moment": "2.13.0",
"@types/prettier": "^3.0.0",
"@vality/cspell-config": "^8.0.1-pr-57-482a037.0", "@vality/cspell-config": "^8.0.1-pr-57-482a037.0",
"@vality/eslint-config": "^8.2.0", "@vality/eslint-config-ng": "18.0.1-pr-63-e72dd8e.0",
"@vality/prettier-config": "3.1.0", "@vality/prettier-config": "3.1.0",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"cspell": "^8.3.2", "cspell": "^8.3.2",
"dotenv": "^16.0.3", "dotenv": "^16.0.3",
"eslint": "^8.56.0", "eslint": "^8.57.0",
"glob": "^7.1.6", "glob": "^7.1.6",
"jasmine-core": "~5.1.1", "jasmine-core": "~5.1.1",
"jasmine-marbles": "0.9.2", "jasmine-marbles": "0.9.2",
@ -103,6 +97,6 @@
"prettier": "^3.1.1", "prettier": "^3.1.1",
"ts-mockito": "^2.6.1", "ts-mockito": "^2.6.1",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"typescript": "~5.2.2" "typescript": "~5.4.5"
} }
} }

View File

@ -20,9 +20,8 @@ type DeepOnlyMutable<T> = T extends object
type ApiArgs = [Injector]; type ApiArgs = [Injector];
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
type MethodParams<P extends Record<PropertyKey, any>, K extends PropertyKey> = RequiredKeys< type MethodParams<P extends Record<PropertyKey, any>, K extends PropertyKey> =
Omit<P, K> RequiredKeys<Omit<P, K>> extends never
> extends never
? void | Overwrite<P, { [N in K]?: P[N] }> ? void | Overwrite<P, { [N in K]?: P[N] }>
: Overwrite<P, { [N in K]?: P[N] }>; : Overwrite<P, { [N in K]?: P[N] }>;
type Method<M, P extends PropertyKey> = M extends ( type Method<M, P extends PropertyKey> = M extends (

View File

@ -1,18 +1,15 @@
import { Component, OnInit, isDevMode } from '@angular/core'; import { Component, isDevMode } from '@angular/core';
import * as sentry from '@sentry/angular-ivy';
import { take } from 'rxjs/operators';
import { LanguageService, Language } from '@dsh/app/language'; import { LanguageService, Language } from '@dsh/app/language';
import { BootstrapService } from './bootstrap.service'; import { BootstrapService } from './bootstrap.service';
import { ContextOrganizationService } from './shared';
@Component({ @Component({
selector: 'dsh-root', selector: 'dsh-root',
templateUrl: 'app.component.html', templateUrl: 'app.component.html',
providers: [BootstrapService], providers: [BootstrapService],
}) })
export class AppComponent implements OnInit { export class AppComponent {
bootstrapped$ = this.bootstrapService.bootstrapped$; bootstrapped$ = this.bootstrapService.bootstrapped$;
isDev = isDevMode(); isDev = isDevMode();
@ -22,16 +19,9 @@ export class AppComponent implements OnInit {
constructor( constructor(
private bootstrapService: BootstrapService, private bootstrapService: BootstrapService,
private contextOrganizationService: ContextOrganizationService,
public languageService: LanguageService, public languageService: LanguageService,
) {} ) {}
ngOnInit(): void {
this.contextOrganizationService.organization$
.pipe(take(1))
.subscribe(({ party }) => sentry.setUser({ id: party }));
}
async setLanguage(language: Language) { async setLanguage(language: Language) {
await this.languageService.set(language); await this.languageService.set(language);
window.location.reload(); window.location.reload();

View File

@ -1,6 +1,6 @@
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http'; import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { APP_INITIALIZER, ErrorHandler, LOCALE_ID, NgModule, isDevMode } from '@angular/core'; import { APP_INITIALIZER, LOCALE_ID, NgModule, isDevMode } from '@angular/core';
import { MatButtonModule } from '@angular/material/button'; import { MatButtonModule } from '@angular/material/button';
import { import {
DateAdapter, DateAdapter,
@ -18,9 +18,7 @@ import {
} from '@angular/material-moment-adapter'; } from '@angular/material-moment-adapter';
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { Router } from '@angular/router';
import { TranslocoModule, provideTransloco, TRANSLOCO_SCOPE } from '@ngneat/transloco'; import { TranslocoModule, provideTransloco, TRANSLOCO_SCOPE } from '@ngneat/transloco';
import * as sentry from '@sentry/angular-ivy';
import { QUERY_PARAMS_SERIALIZERS } from '@vality/ng-core'; import { QUERY_PARAMS_SERIALIZERS } from '@vality/ng-core';
import { FlexLayoutModule } from 'ng-flex-layout'; import { FlexLayoutModule } from 'ng-flex-layout';
@ -45,13 +43,12 @@ import { IconsModule, IconsService } from './icons';
import { initializer } from './initializer'; import { initializer } from './initializer';
import { LanguageService } from './language'; import { LanguageService } from './language';
import { SectionsModule } from './sections'; import { SectionsModule } from './sections';
import { SentryErrorHandler } from './sentry-error-handler.service';
import { SentryHttpInterceptor } from './sentry-http-interceptor';
import { ThemeManager } from './theme-manager'; import { ThemeManager } from './theme-manager';
import { TranslocoHttpLoaderService } from './transloco-http-loader.service'; import { TranslocoHttpLoaderService } from './transloco-http-loader.service';
@NgModule({ @NgModule({
declarations: [AppComponent], declarations: [AppComponent],
bootstrap: [AppComponent],
imports: [ imports: [
CommonModule, CommonModule,
BrowserModule, BrowserModule,
@ -60,7 +57,6 @@ import { TranslocoHttpLoaderService } from './transloco-http-loader.service';
AuthModule, AuthModule,
HomeModule, HomeModule,
KeycloakAngularModule, KeycloakAngularModule,
HttpClientModule,
TranslocoModule, TranslocoModule,
ErrorModule, ErrorModule,
IconsModule, IconsModule,
@ -83,14 +79,7 @@ import { TranslocoHttpLoaderService } from './transloco-http-loader.service';
{ {
provide: APP_INITIALIZER, provide: APP_INITIALIZER,
useFactory: initializer, useFactory: initializer,
deps: [ deps: [ConfigService, KeycloakService, LanguageService, ThemeManager, IconsService],
ConfigService,
KeycloakService,
LanguageService,
ThemeManager,
IconsService,
sentry.TraceService,
],
multi: true, multi: true,
}, },
{ {
@ -123,25 +112,12 @@ import { TranslocoHttpLoaderService } from './transloco-http-loader.service';
loader: TranslocoHttpLoaderService, loader: TranslocoHttpLoaderService,
}), }),
{ provide: ENV, useValue: environment }, { provide: ENV, useValue: environment },
{
provide: ErrorHandler,
useClass: SentryErrorHandler,
},
{
provide: HTTP_INTERCEPTORS,
useClass: SentryHttpInterceptor,
multi: true,
},
{
provide: sentry.TraceService,
deps: [Router],
},
{ {
provide: QUERY_PARAMS_SERIALIZERS, provide: QUERY_PARAMS_SERIALIZERS,
useValue: [createDateRangeWithPresetSerializer()], useValue: [createDateRangeWithPresetSerializer()],
}, },
{ provide: TRANSLOCO_SCOPE, useValue: 'app' }, { provide: TRANSLOCO_SCOPE, useValue: 'app' },
provideHttpClient(withInterceptorsFromDi()),
], ],
bootstrap: [AppComponent],
}) })
export class AppModule {} export class AppModule {}

View File

@ -31,8 +31,7 @@ export class RoleAccessService {
return this.contextOrganizationService.member$.pipe( return this.contextOrganizationService.member$.pipe(
map((member) => { map((member) => {
const memberRoles = member.roles.map((r) => r.roleId); const memberRoles = member.roles.map((r) => r.roleId);
return roleAccessNames[type]( return roleAccessNames[type]((access) =>
(access) =>
ROLE_ACCESSES_OBJECT[access]?.some((role) => memberRoles.includes(role)), ROLE_ACCESSES_OBJECT[access]?.some((role) => memberRoles.includes(role)),
); );
}), }),

View File

@ -1,4 +1,5 @@
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing';
import { getTestBed, TestBed } from '@angular/core/testing'; import { getTestBed, TestBed } from '@angular/core/testing';
import { config, mockConfig } from './config-stub'; import { config, mockConfig } from './config-stub';
@ -7,8 +8,12 @@ import { ConfigService } from './config.service';
describe('ConfigService', () => { describe('ConfigService', () => {
function createService() { function createService() {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [HttpClientTestingModule], imports: [],
providers: [ConfigService], providers: [
ConfigService,
provideHttpClient(withInterceptorsFromDi()),
provideHttpClientTesting(),
],
}); });
const injector = getTestBed(); const injector = getTestBed();
const service: ConfigService = injector.inject(ConfigService); const service: ConfigService = injector.inject(ConfigService);

View File

@ -1,4 +1,4 @@
import { HttpClientModule } from '@angular/common/http'; import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { MatIconModule } from '@angular/material/icon'; import { MatIconModule } from '@angular/material/icon';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
@ -6,8 +6,9 @@ import { RouterModule } from '@angular/router';
import { BrandComponent } from './brand.component'; import { BrandComponent } from './brand.component';
@NgModule({ @NgModule({
imports: [RouterModule, MatIconModule, HttpClientModule],
declarations: [BrandComponent], declarations: [BrandComponent],
exports: [BrandComponent], exports: [BrandComponent],
imports: [RouterModule, MatIconModule],
providers: [provideHttpClient(withInterceptorsFromDi())],
}) })
export class BrandModule {} export class BrandModule {}

View File

@ -4,12 +4,12 @@
$primary: map-get($theme, primary); $primary: map-get($theme, primary);
.dsh-mobile-nav-item-active { .dsh-mobile-nav-item-active {
color: mat.get-color-from-palette($primary, default); color: mat.m2-get-color-from-palette($primary, default);
} }
} }
@mixin dsh-mobile-menu-nav-item-typography($config) { @mixin dsh-mobile-menu-nav-item-typography($config) {
.dsh-mobile-menu-nav-item { .dsh-mobile-menu-nav-item {
@include mat.typography-level($config, title); @include mat.m2-typography-level($config, title);
} }
} }

View File

@ -2,6 +2,6 @@
@mixin dsh-mobile-user-bar-typography($config) { @mixin dsh-mobile-user-bar-typography($config) {
.dsh-mobile-user-bar-username { .dsh-mobile-user-bar-username {
@include mat.typography-level($config, body-2); @include mat.m2-typography-level($config, body-2);
} }
} }

View File

@ -1,25 +0,0 @@
import * as sentry from '@sentry/angular-ivy';
import { Integrations } from '@sentry/tracing';
import isNil from 'lodash-es/isNil';
import { environment } from '../environments';
export const initSentry = (dsn: string): void => {
if (isNil(dsn)) {
return null;
}
sentry.init({
dsn,
integrations: [
new Integrations.BrowserTracing({
routingInstrumentation: sentry.routingInstrumentation,
}),
],
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
tracesSampleRate: 1,
autoSessionTracking: true,
environment: environment.production ? 'production' : 'development',
});
};

View File

@ -3,7 +3,6 @@ import { environment } from '../environments';
import { KeycloakService } from './auth/keycloak'; import { KeycloakService } from './auth/keycloak';
import { ConfigService } from './config'; import { ConfigService } from './config';
import { IconsService } from './icons'; import { IconsService } from './icons';
import { initSentry } from './init-sentry';
import { LanguageService } from './language'; import { LanguageService } from './language';
import { ThemeManager } from './theme-manager'; import { ThemeManager } from './theme-manager';
@ -20,7 +19,6 @@ export const initializer =
configService.init({ configUrl: environment.appConfigPath }).then(() => configService.init({ configUrl: environment.appConfigPath }).then(() =>
Promise.all([ Promise.all([
themeManager.init(), themeManager.init(),
initSentry(configService.sentryDsn),
keycloakService.init({ keycloakService.init({
config: environment.authConfigPath, config: environment.authConfigPath,
initOptions: { initOptions: {

View File

@ -5,10 +5,10 @@
$warn: map-get($theme, warn); $warn: map-get($theme, warn);
.positive-percent-difference { .positive-percent-difference {
color: mat.get-color-from-palette($accent, default); color: mat.m2-get-color-from-palette($accent, default);
} }
.negative-percent-difference { .negative-percent-difference {
color: mat.get-color-from-palette($warn, 300); color: mat.m2-get-color-from-palette($warn, 300);
} }
} }

View File

@ -5,7 +5,7 @@
.dsh-balances { .dsh-balances {
&-title { &-title {
color: mat.get-color-from-palette($foreground, secondary-text); color: mat.m2-get-color-from-palette($foreground, secondary-text);
} }
} }
} }
@ -13,13 +13,13 @@
@mixin dsh-balances-typography($config) { @mixin dsh-balances-typography($config) {
.dsh-balances { .dsh-balances {
&-title { &-title {
@include mat.typography-level($config, caption); @include mat.m2-typography-level($config, caption);
} }
&-balance-lg { &-balance-lg {
@include mat.typography-level($config, title); @include mat.m2-typography-level($config, title);
} }
&-balance-md { &-balance-md {
@include mat.typography-level($config, subheading-2); @include mat.m2-typography-level($config, subheading-2);
} }
} }
} }

View File

@ -4,12 +4,12 @@
$primary: map-get($theme, primary); $primary: map-get($theme, primary);
.dsh-no-shops-action { .dsh-no-shops-action {
color: mat.get-color-from-palette($primary, default); color: mat.m2-get-color-from-palette($primary, default);
} }
} }
@mixin dsh-no-shops-alert-typography($config) { @mixin dsh-no-shops-alert-typography($config) {
.dsh-no-shops-content { .dsh-no-shops-content {
@include mat.typography-level($config, subheading-2); @include mat.m2-typography-level($config, subheading-2);
} }
} }

View File

@ -4,7 +4,7 @@
fxLayout="column" fxLayout="column"
fxLayoutGap="32px" fxLayoutGap="32px"
> >
<nav mat-tab-nav-bar> <nav [tabPanel]="tabPanel" mat-tab-nav-bar>
<ng-container *ngFor="let link of links"> <ng-container *ngFor="let link of links">
<a <a
#rla="routerLinkActive" #rla="routerLinkActive"
@ -18,8 +18,8 @@
</a> </a>
</ng-container> </ng-container>
</nav> </nav>
<div> <mat-tab-nav-panel #tabPanel>
<router-outlet></router-outlet> <router-outlet></router-outlet>
</div> </mat-tab-nav-panel>
</div> </div>
<dsh-scroll-up [hideAfter]="200"></dsh-scroll-up> <dsh-scroll-up [hideAfter]="200"></dsh-scroll-up>

View File

@ -12,10 +12,10 @@ export class CreateRefundService {
createRefund(data: CreateRefundDialogData): Observable<CreateRefundDialogResponse> { createRefund(data: CreateRefundDialogData): Observable<CreateRefundDialogResponse> {
return this.dialog return this.dialog
.open<CreateRefundDialogComponent, CreateRefundDialogData>( .open<
CreateRefundDialogComponent, CreateRefundDialogComponent,
{ data }, CreateRefundDialogData
) >(CreateRefundDialogComponent, { data })
.afterClosed(); .afterClosed();
} }
} }

View File

@ -1,4 +1,5 @@
import { HttpClientTestingModule } from '@angular/common/http/testing'; import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { provideHttpClientTesting } from '@angular/common/http/testing';
import { Component, Input } from '@angular/core'; import { Component, Input } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { NoopAnimationsModule } from '@angular/platform-browser/animations';
@ -35,6 +36,7 @@ describe('PaymentsPanelsComponent', () => {
beforeEach(async () => { beforeEach(async () => {
await TestBed.configureTestingModule({ await TestBed.configureTestingModule({
declarations: [PaymentsPanelsComponent, MockRowHeaderComponent, MockRowComponent],
imports: [ imports: [
FlexLayoutModule, FlexLayoutModule,
SpinnerModule, SpinnerModule,
@ -44,7 +46,6 @@ describe('PaymentsPanelsComponent', () => {
ShowMorePanelModule, ShowMorePanelModule,
PaymentsDetailsModule, PaymentsDetailsModule,
NoopAnimationsModule, NoopAnimationsModule,
HttpClientTestingModule,
TranslocoTestingModule.withLangs( TranslocoTestingModule.withLangs(
{ {
ru: { ru: {
@ -57,7 +58,7 @@ describe('PaymentsPanelsComponent', () => {
}, },
), ),
], ],
declarations: [PaymentsPanelsComponent, MockRowHeaderComponent, MockRowComponent], providers: [provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()],
}).compileComponents(); }).compileComponents();
}); });

View File

@ -15,8 +15,7 @@ export class ShopsBalanceService {
return of([]); return of([]);
} }
return this.analyticsService.getCurrentShopBalances({ shopIDs }).pipe( return this.analyticsService.getCurrentShopBalances({ shopIDs }).pipe(
map( map(({ result }) =>
({ result }) =>
result?.map(({ id, amountResults = [] }) => ({ result?.map(({ id, amountResults = [] }) => ({
id, id,
data: amountResults?.length ? amountResults[0] : null, data: amountResults?.length ? amountResults[0] : null,

View File

@ -1,58 +0,0 @@
import { ErrorHandler as AngularErrorHandler, Injectable } from '@angular/core';
import * as sentry from '@sentry/angular-ivy';
import { extractError } from '@dsh/utils';
import { environment } from '../environments';
/**
* Options used to configure the behavior of the Angular ErrorHandler.
*/
export interface ErrorHandlerOptions {
logErrors?: boolean;
}
/**
* Implementation of Angular's ErrorHandler provider that can be used as a drop-in replacement for the stock one.
*/
@Injectable({ providedIn: 'root' })
export class SentryErrorHandler implements AngularErrorHandler {
private readonly options: ErrorHandlerOptions;
constructor() {
this.options = {
logErrors: !environment.production,
};
}
/**
* Method called for every value captured through the ErrorHandler
*/
public handleError(error: unknown): void {
const extractedError = extractError(error) || 'Handled unknown error';
this.captureChunkLoadError(extractedError);
// Capture handled exception and send it to Sentry.
sentry.captureException(extractedError);
if (this.options.logErrors) {
// eslint-disable-next-line no-console
console.error(extractedError);
}
}
private captureChunkLoadError(error: { message?: string }): void {
const chunkFailedMessage = /Loading chunk [\d]+ failed/;
const chunkLoadError = /ChunkLoadError [\d]+ failed/;
const errorMessage = error?.message;
if (!errorMessage) {
return;
}
if (chunkFailedMessage.test(errorMessage) || chunkLoadError.test(errorMessage)) {
// TODO Temporary log for checking error capture efficiency
sentry.captureMessage('Chunk load error captured');
window.location.reload();
}
}
}

View File

@ -1,21 +0,0 @@
import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';
import { Injectable } from '@angular/core';
import * as sentry from '@sentry/angular-ivy';
import isNil from 'lodash-es/isNil';
import { Observable, throwError } from 'rxjs';
import { catchError } from 'rxjs/operators';
@Injectable({ providedIn: 'root' })
export class SentryHttpInterceptor implements HttpInterceptor {
intercept(req: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {
return next.handle(req).pipe(
catchError((resp) => {
const xRequestId = req.headers.get('x-request-id');
if (!isNil(xRequestId)) {
sentry.setTag('x-request-id', xRequestId);
}
return throwError(resp);
}),
);
}
}

View File

@ -34,33 +34,36 @@
&.dsh-primary { &.dsh-primary {
@include button( @include button(
map-get($background, card), map-get($background, card),
mat.get-color-from-palette($primary, default) mat.m2-get-color-from-palette($primary, default)
); );
@include focused-background(mat.get-color-from-palette($primary, default, 0.88)); @include focused-background(mat.m2-get-color-from-palette($primary, default, 0.88));
&:hover:not(:disabled) { &:hover:not(:disabled) {
background: mat.get-color-from-palette($primary, default, 0.88) !important; background: mat.m2-get-color-from-palette($primary, default, 0.88) !important;
} }
} }
&.dsh-accent { &.dsh-accent {
@include button( @include button(
map-get($background, card), map-get($background, card),
mat.get-color-from-palette($accent, default) mat.m2-get-color-from-palette($accent, default)
); );
@include focused-background(mat.get-color-from-palette($primary, default, 0.88)); @include focused-background(mat.m2-get-color-from-palette($primary, default, 0.88));
&:hover:not(:disabled) { &:hover:not(:disabled) {
background: mat.get-color-from-palette($primary, default, 0.88) !important; background: mat.m2-get-color-from-palette($primary, default, 0.88) !important;
} }
} }
&.dsh-warn { &.dsh-warn {
@include button(map-get($background, card), mat.get-color-from-palette($warn, 400)); @include button(
@include focused-background(mat.get-color-from-palette($warn, default, 0.88)); map-get($background, card),
mat.m2-get-color-from-palette($warn, 400)
);
@include focused-background(mat.m2-get-color-from-palette($warn, default, 0.88));
&:hover:not(:disabled) { &:hover:not(:disabled) {
background: mat.get-color-from-palette($warn, default, 0.88) !important; background: mat.m2-get-color-from-palette($warn, default, 0.88) !important;
} }
} }
@ -71,29 +74,29 @@
&-text-button { &-text-button {
&.dsh-primary { &.dsh-primary {
@include button(mat.get-color-from-palette($primary, default), transparent); @include button(mat.m2-get-color-from-palette($primary, default), transparent);
@include focused-background(mat.get-color-from-palette($primary, default, 0.12)); @include focused-background(mat.m2-get-color-from-palette($primary, default, 0.12));
&:hover:not(:disabled) { &:hover:not(:disabled) {
background: mat.get-color-from-palette($primary, default, 0.2) !important; background: mat.m2-get-color-from-palette($primary, default, 0.2) !important;
} }
} }
&.dsh-accent { &.dsh-accent {
@include button(mat.get-color-from-palette($primary, default), transparent); @include button(mat.m2-get-color-from-palette($primary, default), transparent);
@include focused-background(mat.get-color-from-palette($primary, default, 0.12)); @include focused-background(mat.m2-get-color-from-palette($primary, default, 0.12));
&:hover:not(:disabled) { &:hover:not(:disabled) {
background: mat.get-color-from-palette($primary, default, 0.2) !important; background: mat.m2-get-color-from-palette($primary, default, 0.2) !important;
} }
} }
&.dsh-warn { &.dsh-warn {
@include button(mat.get-color-from-palette($warn, 400), transparent); @include button(mat.m2-get-color-from-palette($warn, 400), transparent);
@include focused-background(mat.get-color-from-palette($warn, default, 0.88)); @include focused-background(mat.m2-get-color-from-palette($warn, default, 0.88));
&:hover:not(:disabled) { &:hover:not(:disabled) {
background: mat.get-color-from-palette($warn, default, 0.2) !important; background: mat.m2-get-color-from-palette($warn, default, 0.2) !important;
} }
} }
@ -108,22 +111,25 @@
&.dsh-primary { &.dsh-primary {
@include button( @include button(
map-get($background, card), map-get($background, card),
mat.get-color-from-palette($primary, default) mat.m2-get-color-from-palette($primary, default)
); );
@include focused-background(mat.get-color-from-palette($primary, 300)); @include focused-background(mat.m2-get-color-from-palette($primary, 300));
} }
&.dsh-accent { &.dsh-accent {
@include button( @include button(
map-get($background, card), map-get($background, card),
mat.get-color-from-palette($accent, default) mat.m2-get-color-from-palette($accent, default)
); );
@include focused-background(mat.get-color-from-palette($accent, 200)); @include focused-background(mat.m2-get-color-from-palette($accent, 200));
} }
&.dsh-warn { &.dsh-warn {
@include button(map-get($background, card), mat.get-color-from-palette($warn, 400)); @include button(
@include focused-background(mat.get-color-from-palette($warn, 300)); map-get($background, card),
mat.m2-get-color-from-palette($warn, 400)
);
@include focused-background(mat.m2-get-color-from-palette($warn, 300));
} }
&:disabled { &:disabled {
@ -139,9 +145,9 @@
&-text-button, &-text-button,
&-icon-button { &-icon-button {
font: { font: {
family: mat.font-family($config, button); family: mat.m2-font-family($config, button);
size: mat.font-size($config, button); size: mat.m2-font-size($config, button);
weight: mat.font-weight($config, button); weight: mat.m2-font-weight($config, button);
} }
} }
} }

View File

@ -7,16 +7,16 @@
.apexcharts { .apexcharts {
&-text { &-text {
fill: mat.get-color-from-palette($foreground, text); fill: mat.m2-get-color-from-palette($foreground, text);
} }
&-legend-text { &-legend-text {
color: mat.get-color-from-palette($foreground, text) !important; color: mat.m2-get-color-from-palette($foreground, text) !important;
} }
&-tooltip { &-tooltip {
@include dsh-shadow($theme); @include dsh-shadow($theme);
background-color: mat.get-color-from-palette($background, card); background-color: mat.m2-get-color-from-palette($background, card);
} }
} }
} }
@ -27,9 +27,9 @@
line-height: 20px; line-height: 20px;
font: { font: {
family: mat.font-family($config, caption) !important; family: mat.m2-font-family($config, caption) !important;
size: mat.font-size($config, caption) !important; size: mat.m2-font-size($config, caption) !important;
weight: mat.font-weight($config, caption) !important; weight: mat.m2-font-weight($config, caption) !important;
} }
} }
} }

View File

@ -2,7 +2,7 @@
@mixin dsh-date-range-filter-theme($theme) { @mixin dsh-date-range-filter-theme($theme) {
.dsh-date-range-filter-preset-active { .dsh-date-range-filter-preset-active {
color: mat.get-color-from-palette(map-get($theme, primary)); color: mat.m2-get-color-from-palette(map-get($theme, primary));
font-weight: 500; font-weight: 500;
} }
} }

View File

@ -10,27 +10,27 @@
color: map-get($foreground, text); color: map-get($foreground, text);
&:hover:enabled { &:hover:enabled {
border-color: mat.get-color-from-palette($primary, default); border-color: mat.m2-get-color-from-palette($primary, default);
} }
&-active:enabled { &-active:enabled {
border-color: mat.get-color-from-palette($primary, default); border-color: mat.m2-get-color-from-palette($primary, default);
color: mat.get-color-from-palette($primary, default); color: mat.m2-get-color-from-palette($primary, default);
background-color: mat.get-color-from-palette($primary, default, 0.14); background-color: mat.m2-get-color-from-palette($primary, default, 0.14);
} }
&:disabled { &:disabled {
color: mat.get-color-from-palette($foreground, disabled-text, 0.38); color: mat.m2-get-color-from-palette($foreground, disabled-text, 0.38);
} }
} }
} }
@mixin dsh-filter-button-typography($config) { @mixin dsh-filter-button-typography($config) {
.dsh-filter-button { .dsh-filter-button {
@include mat.typography-level($config, body-1); @include mat.m2-typography-level($config, body-1);
&-active { &-active {
@include mat.typography-level($config, body-2); @include mat.m2-typography-level($config, body-2);
} }
} }
} }

View File

@ -6,7 +6,7 @@
[ngClass]="{ [ngClass]="{
'dsh-format-input-element': true, 'dsh-format-input-element': true,
'mat-input-element': true, 'mat-input-element': true,
'dsh-format-input-element-full-size': !size 'dsh-format-input-element-full-size': !size,
}" }"
[placeholder]="placeholder" [placeholder]="placeholder"
(change)="writeValue($event.target.value)" (change)="writeValue($event.target.value)"

View File

@ -4,7 +4,7 @@
$foreground: map-get($theme, foreground); $foreground: map-get($theme, foreground);
.dsh-last-updated { .dsh-last-updated {
color: mat.get-color-from-palette($foreground, secondary-text); color: mat.m2-get-color-from-palette($foreground, secondary-text);
} }
} }
@ -14,6 +14,6 @@
} }
.dsh-last-updated { .dsh-last-updated {
@include mat.typography-level($config, caption); @include mat.m2-typography-level($config, caption);
} }
} }

View File

@ -44,6 +44,6 @@
@mixin dsh-status-typography($config) { @mixin dsh-status-typography($config) {
.dsh-status-label { .dsh-status-label {
@include mat.typography-level($config, body-1); @include mat.m2-typography-level($config, body-1);
} }
} }

View File

@ -4,12 +4,12 @@
$foreground: map-get($theme, foreground); $foreground: map-get($theme, foreground);
.dsh-accordion-item-content-header-label { .dsh-accordion-item-content-header-label {
color: mat.get-color-from-palette($foreground, secondary-text); color: mat.m2-get-color-from-palette($foreground, secondary-text);
} }
} }
@mixin dsh-accordion-item-content-header-typography($config) { @mixin dsh-accordion-item-content-header-typography($config) {
.dsh-accordion-item-content-header-label { .dsh-accordion-item-content-header-label {
@include mat.typography-level($config, caption); @include mat.m2-typography-level($config, caption);
} }
} }

View File

@ -4,6 +4,6 @@
$primary: map-get($theme, primary); $primary: map-get($theme, primary);
.dsh-alert { .dsh-alert {
background-color: mat.get-color-from-palette($primary, default, 0.12); background-color: mat.m2-get-color-from-palette($primary, default, 0.12);
} }
} }

View File

@ -6,20 +6,20 @@
.dsh-card { .dsh-card {
@include dsh-shadow($theme); @include dsh-shadow($theme);
background-color: mat.get-color-from-palette($background, card); background-color: mat.m2-get-color-from-palette($background, card);
} }
} }
@mixin dsh-card-typography($config) { @mixin dsh-card-typography($config) {
.dsh-card { .dsh-card {
font-family: mat.font-family($config); font-family: mat.m2-font-family($config);
} }
.dsh-card-header .dsh-card-title { .dsh-card-header .dsh-card-title {
font-size: mat.font-size($config, title); font-size: mat.m2-font-size($config, title);
} }
.dsh-card-content { .dsh-card-content {
font-size: mat.font-size($config, body-1); font-size: mat.m2-font-size($config, body-1);
} }
} }

View File

@ -1,4 +1,5 @@
import { HttpClientTestingModule } from '@angular/common/http/testing'; import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { provideHttpClientTesting } from '@angular/common/http/testing';
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { ComponentFixture, inject, TestBed } from '@angular/core/testing'; import { ComponentFixture, inject, TestBed } from '@angular/core/testing';
import { MatIconRegistry } from '@angular/material/icon'; import { MatIconRegistry } from '@angular/material/icon';
@ -34,8 +35,9 @@ describe('CollapseComponent', () => {
beforeEach(async () => { beforeEach(async () => {
await TestBed.configureTestingModule({ await TestBed.configureTestingModule({
imports: [CollapseModule, NoopAnimationsModule, HttpClientTestingModule],
declarations: [MockCollapseComponent, MockCollapseUpComponent], declarations: [MockCollapseComponent, MockCollapseUpComponent],
imports: [CollapseModule, NoopAnimationsModule],
providers: [provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()],
}).compileComponents(); }).compileComponents();
}); });

View File

@ -5,7 +5,7 @@
.dsh-details-item { .dsh-details-item {
&-title { &-title {
color: mat.get-color-from-palette($foreground, secondary-text); color: mat.m2-get-color-from-palette($foreground, secondary-text);
} }
} }
} }
@ -13,11 +13,11 @@
@mixin dsh-details-item-typography($config) { @mixin dsh-details-item-typography($config) {
.dsh-details-item { .dsh-details-item {
&-title { &-title {
@include mat.typography-level($config, caption); @include mat.m2-typography-level($config, caption);
} }
&-content { &-content {
@include mat.typography-level($config, body-1); @include mat.m2-typography-level($config, body-1);
} }
} }
} }

View File

@ -10,13 +10,13 @@
&, &,
&-triangle { &-triangle {
background-color: mat.get-color-from-palette($background, card); background-color: mat.m2-get-color-from-palette($background, card);
} }
} }
} }
@mixin dsh-dropdown-typography($config) { @mixin dsh-dropdown-typography($config) {
.dsh-dropdown { .dsh-dropdown {
@include mat.typography-level($config, body-1); @include mat.m2-typography-level($config, body-1);
} }
} }

View File

@ -6,11 +6,11 @@
.dsh-limited-list { .dsh-limited-list {
&-title { &-title {
color: mat.get-color-from-palette($foreground, secondary-text); color: mat.m2-get-color-from-palette($foreground, secondary-text);
} }
&-show-more { &-show-more {
color: mat.get-color-from-palette($primary, default); color: mat.m2-get-color-from-palette($primary, default);
} }
} }
} }

View File

@ -3,6 +3,6 @@
@mixin dsh-link-label-typography($config) { @mixin dsh-link-label-typography($config) {
.dsh-link-label-content { .dsh-link-label-content {
text-decoration: underline; text-decoration: underline;
@include mat.typography-level($config, body-1); @include mat.m2-typography-level($config, body-1);
} }
} }

View File

@ -16,10 +16,10 @@
.dsh-panel { .dsh-panel {
@include panel(map-get($background, card)); @include panel(map-get($background, card));
&-primary { &-primary {
@include panel(mat.get-color-from-palette($primary, 50)); @include panel(mat.m2-get-color-from-palette($primary, 50));
} }
&-accent { &-accent {
@include panel(mat.get-color-from-palette($accent, 50)); @include panel(mat.m2-get-color-from-palette($accent, 50));
} }
} }
} }
@ -27,9 +27,9 @@
@mixin dsh-panel-typography($config) { @mixin dsh-panel-typography($config) {
.dsh-panel-header-content { .dsh-panel-header-content {
font: { font: {
family: mat.font-family($config, body-1); family: mat.m2-font-family($config, body-1);
size: mat.font-size($config, body-1); size: mat.m2-font-size($config, body-1);
weight: mat.font-weight($config, body-1); weight: mat.m2-font-weight($config, body-1);
} }
} }
} }

View File

@ -2,7 +2,7 @@
[ngClass]="{ [ngClass]="{
'dsh-panel': true, 'dsh-panel': true,
'dsh-panel-primary': color === 'primary', 'dsh-panel-primary': color === 'primary',
'dsh-panel-accent': color === 'accent' 'dsh-panel-accent': color === 'accent',
}" }"
> >
<ng-content></ng-content> <ng-content></ng-content>

View File

@ -6,13 +6,13 @@
$primary: map-get($theme, primary); $primary: map-get($theme, primary);
.dsh-row { .dsh-row {
background-color: mat.get-color-from-palette($background, card); background-color: mat.m2-get-color-from-palette($background, card);
&.dsh-primary { &.dsh-primary {
background-color: mat.get-color-from-palette($primary, 50); background-color: mat.m2-get-color-from-palette($primary, 50);
} }
&-header-label { &-header-label {
color: mat.get-color-from-palette($foreground, secondary-text); color: mat.m2-get-color-from-palette($foreground, secondary-text);
} }
} }
} }
@ -20,10 +20,10 @@
@mixin dsh-row-typography($config) { @mixin dsh-row-typography($config) {
.dsh-row { .dsh-row {
&-header-label { &-header-label {
@include mat.typography-level($config, body-2); @include mat.m2-typography-level($config, body-2);
} }
&-label { &-label {
@include mat.typography-level($config, body-1); @include mat.m2-typography-level($config, body-1);
} }
} }
} }

View File

@ -8,6 +8,6 @@
@mixin dsh-link-typography($config) { @mixin dsh-link-typography($config) {
.dsh-link { .dsh-link {
@include mat.typography-level($config, body-1); @include mat.m2-typography-level($config, body-1);
} }
} }

View File

@ -10,6 +10,6 @@
@mixin dsh-breadcrumb-typography($config) { @mixin dsh-breadcrumb-typography($config) {
.dsh-breadcrumb { .dsh-breadcrumb {
@include mat.typography-level($config, subheading-2); @include mat.m2-typography-level($config, subheading-2);
} }
} }

View File

@ -4,12 +4,12 @@
$primary: map-get($theme, primary); $primary: map-get($theme, primary);
.dsh-navbar-item-active { .dsh-navbar-item-active {
background: mat.get-color-from-palette($primary, default, 0.12); background: mat.m2-get-color-from-palette($primary, default, 0.12);
} }
} }
@mixin dsh-navbar-item-typography($config) { @mixin dsh-navbar-item-typography($config) {
.dsh-navbar-item-content { .dsh-navbar-item-content {
@include mat.typography-level($config, subheading-2); @include mat.m2-typography-level($config, subheading-2);
} }
} }

View File

@ -19,16 +19,16 @@
// The class order directly affects the order of applying styles (for example, both .warn and .selected) // The class order directly affects the order of applying styles (for example, both .warn and .selected)
&.success { &.success {
mat-icon { mat-icon {
@include fill(mat.get-color-from-palette($accent, default)); @include fill(mat.m2-get-color-from-palette($accent, default));
} }
} }
&.warn { &.warn {
mat-icon { mat-icon {
@include fill(mat.get-color-from-palette($warn, 300)); @include fill(mat.m2-get-color-from-palette($warn, 300));
} }
} }
&.selected { &.selected {
color: mat.get-color-from-palette($primary, default); color: mat.m2-get-color-from-palette($primary, default);
} }
} }
@ -40,15 +40,15 @@
// The class order directly affects the order of applying styles (for example, both .warn and .selected) // The class order directly affects the order of applying styles (for example, both .warn and .selected)
&.success { &.success {
background: mat.get-color-from-palette($accent, default); background: mat.m2-get-color-from-palette($accent, default);
color: map-get($accent-text, 300); color: map-get($accent-text, 300);
} }
&.warn { &.warn {
background: mat.get-color-from-palette($warn, 300); background: mat.m2-get-color-from-palette($warn, 300);
color: map-get($warn-text, 300); color: map-get($warn-text, 300);
} }
&.selected { &.selected {
background: mat.get-color-from-palette($primary, default); background: mat.m2-get-color-from-palette($primary, default);
color: map-get($primary-text, 400); color: map-get($primary-text, 400);
} }
} }
@ -59,7 +59,7 @@
@mixin dsh-state-nav-typography($config) { @mixin dsh-state-nav-typography($config) {
.dsh-state-nav { .dsh-state-nav {
&-item { &-item {
@include mat.typography-level($config, subheading-2); @include mat.m2-typography-level($config, subheading-2);
} }
} }
} }

View File

@ -2,19 +2,19 @@
@function dsh-typography-config( @function dsh-typography-config(
$font-family: 'Roboto, "Helvetica Neue", sans-serif', $font-family: 'Roboto, "Helvetica Neue", sans-serif',
$display-4: mat.define-typography-level(112px, 112px, 300, $letter-spacing: -0.05em), $display-4: mat.m2-define-typography-level(112px, 112px, 300, $letter-spacing: -0.05em),
$display-3: mat.define-typography-level(56px, 64px, 400, $letter-spacing: -0.02em), $display-3: mat.m2-define-typography-level(56px, 64px, 400, $letter-spacing: -0.02em),
$display-2: mat.define-typography-level(45px, 48px, 400, $letter-spacing: -0.005em), $display-2: mat.m2-define-typography-level(45px, 48px, 400, $letter-spacing: -0.005em),
$display-1: mat.define-typography-level(34px, 48px, 400), $display-1: mat.m2-define-typography-level(34px, 48px, 400),
$headline: mat.define-typography-level(24px, 32px, 400), $headline: mat.m2-define-typography-level(24px, 32px, 400),
$title: mat.define-typography-level(20px, 32px, 500), $title: mat.m2-define-typography-level(20px, 32px, 500),
$subheading-2: mat.define-typography-level(16px, 32px, 400), $subheading-2: mat.m2-define-typography-level(16px, 32px, 400),
$subheading-1: mat.define-typography-level(15px, 24px, 400), $subheading-1: mat.m2-define-typography-level(15px, 24px, 400),
$body-2: mat.define-typography-level(14px, 24px, 500), $body-2: mat.m2-define-typography-level(14px, 24px, 500),
$body-1: mat.define-typography-level(14px, 24px, 400), $body-1: mat.m2-define-typography-level(14px, 24px, 400),
$caption: mat.define-typography-level(12px, 16px, 400), $caption: mat.m2-define-typography-level(12px, 16px, 400),
$button: mat.define-typography-level(14px, 16px, 500), $button: mat.m2-define-typography-level(14px, 16px, 500),
$input: mat.define-typography-level(14px, 1.15, 400) $input: mat.m2-define-typography-level(14px, 1.15, 400)
) { ) {
// Declare an initial map with all of the levels. // Declare an initial map with all of the levels.
$config: ( $config: (
@ -54,7 +54,7 @@
// Add the base font family to the config. // Add the base font family to the config.
@return map-merge( @return map-merge(
map-merge(mat.define-typography-config(), $config), map-merge(mat.m2-define-typography-config(), $config),
( (
font-family: $font-family, font-family: $font-family,
) )
@ -72,65 +72,65 @@
@mixin dsh-base-typography($config, $selector: '.dsh-typography') { @mixin dsh-base-typography($config, $selector: '.dsh-typography') {
.dsh-headline, .dsh-headline,
#{$selector} h1 { #{$selector} h1 {
@include mat.typography-level($config, headline); @include mat.m2-typography-level($config, headline);
margin: 0; margin: 0;
} }
.dsh-title, .dsh-title,
#{$selector} h2 { #{$selector} h2 {
@include mat.typography-level($config, title); @include mat.m2-typography-level($config, title);
margin: 0; margin: 0;
} }
.dsh-subheading-2, .dsh-subheading-2,
#{$selector} h3 { #{$selector} h3 {
@include mat.typography-level($config, subheading-2); @include mat.m2-typography-level($config, subheading-2);
margin: 0; margin: 0;
} }
.dsh-subheading-1, .dsh-subheading-1,
#{$selector} h4 { #{$selector} h4 {
@include mat.typography-level($config, subheading-1); @include mat.m2-typography-level($config, subheading-1);
margin: 0; margin: 0;
} }
.dsh-body-2 { .dsh-body-2 {
@include mat.typography-level($config, body-2); @include mat.m2-typography-level($config, body-2);
} }
.dsh-body-1, .dsh-body-1,
#{$selector} { #{$selector} {
@include mat.typography-level($config, body-1); @include mat.m2-typography-level($config, body-1);
p { p {
margin: 0; margin: 0;
} }
} }
.dsh-caption { .dsh-caption {
@include mat.typography-level($config, caption); @include mat.m2-typography-level($config, caption);
} }
.dsh-display-4, .dsh-display-4,
#{$selector} .dsh-display-4 { #{$selector} .dsh-display-4 {
@include mat.typography-level($config, display-4); @include mat.m2-typography-level($config, display-4);
margin: 0; margin: 0;
} }
.dsh-display-3, .dsh-display-3,
#{$selector} .dsh-display-3 { #{$selector} .dsh-display-3 {
@include mat.typography-level($config, display-3); @include mat.m2-typography-level($config, display-3);
margin: 0; margin: 0;
} }
.dsh-display-2, .dsh-display-2,
#{$selector} .dsh-display-2 { #{$selector} .dsh-display-2 {
@include mat.typography-level($config, display-2); @include mat.m2-typography-level($config, display-2);
margin: 0; margin: 0;
} }
.dsh-display-1, .dsh-display-1,
#{$selector} .dsh-display-1 { #{$selector} .dsh-display-1 {
@include mat.typography-level($config, display-1); @include mat.m2-typography-level($config, display-1);
margin: 0; margin: 0;
} }
} }

View File

@ -19,9 +19,9 @@
@mixin mat-radio-button-override-typography($config) { @mixin mat-radio-button-override-typography($config) {
.mat-mdc-radio-button { .mat-mdc-radio-button {
font: { font: {
family: mat.font-family($config, body-1); family: mat.m2-font-family($config, body-1);
size: mat.font-size($config, body-1); size: mat.m2-font-size($config, body-1);
weight: mat.font-weight($config, body-1); weight: mat.m2-font-weight($config, body-1);
} }
} }
} }

View File

@ -50,14 +50,14 @@
@mixin mat-tabs-override-typography($config) { @mixin mat-tabs-override-typography($config) {
.mat-mdc-tab-links { .mat-mdc-tab-links {
.mat-mdc-tab-link { .mat-mdc-tab-link {
@include mat.typography-level($config, subheading-1); @include mat.m2-typography-level($config, subheading-1);
} }
} }
.dsh-top-tab-nav-bar { .dsh-top-tab-nav-bar {
.mat-mdc-tab-links { .mat-mdc-tab-links {
.mat-mdc-tab-link { .mat-mdc-tab-link {
@include mat.typography-level($config, subheading-2); @include mat.m2-typography-level($config, subheading-2);
} }
} }
} }

View File

@ -6,32 +6,32 @@ $background: (
// Overrides // Overrides
background: #f0f7f7, background: #f0f7f7,
// Custom // Custom
hover: map-get(mat.$grey-palette, 200), hover: map-get(mat.$m2-grey-palette, 200),
selected-button: map-get(mat.$grey-palette, 100) selected-button: map-get(mat.$m2-grey-palette, 100)
); );
$foreground: ( $foreground: (
// Overrides // Overrides
// Custom // Custom
contrast-text: $light-text, contrast-text: $light-text,
light-text: mat.get-color-from-palette(mat.define-palette(mat.$grey-palette), 500), light-text: mat.m2-get-color-from-palette(mat.m2-define-palette(mat.$m2-grey-palette), 500),
border: map-get(mat.$grey-palette, 200) border: map-get(mat.$m2-grey-palette, 200)
); );
$config: ( $config: (
// Overrides // Overrides
color: color:
( (
primary: mat.define-palette($dsh-eastern, 700), primary: mat.m2-define-palette($dsh-eastern, 700),
accent: mat.define-palette($dsh-eastern, 700), accent: mat.m2-define-palette($dsh-eastern, 700),
warn: mat.define-palette($dsh-warn, 300), warn: mat.m2-define-palette($dsh-warn, 300),
), ),
is-dark: false, is-dark: false,
// Custom // Custom
name: 'eastern', name: 'eastern',
success-base: mat.get-color-from-palette(mat.define-palette($dsh-success), 400), success-base: mat.m2-get-color-from-palette(mat.m2-define-palette($dsh-success), 400),
pending-base: mat.get-color-from-palette(mat.define-palette($dsh-pending), 800), pending-base: mat.m2-get-color-from-palette(mat.m2-define-palette($dsh-pending), 800),
warn-base: mat.get-color-from-palette(mat.define-palette($dsh-warn), 300) warn-base: mat.m2-get-color-from-palette(mat.m2-define-palette($dsh-warn), 300)
); );
@include theme($config, $background, $foreground); @include theme($config, $background, $foreground);

View File

@ -6,29 +6,29 @@ $background: (
// Overrides // Overrides
background: #f1f7fb, background: #f1f7fb,
// Custom // Custom
hover: map-get(mat.$grey-palette, 200), hover: map-get(mat.$m2-grey-palette, 200),
selected-button: map-get(mat.$grey-palette, 100) selected-button: map-get(mat.$m2-grey-palette, 100)
); );
$foreground: ( $foreground: (
// Overrides // Overrides
// Custom // Custom
contrast-text: $light-text, contrast-text: $light-text,
light-text: mat.get-color-from-palette(mat.define-palette(mat.$grey-palette), 500), light-text: mat.m2-get-color-from-palette(mat.m2-define-palette(mat.$m2-grey-palette), 500),
border: map-get(mat.$grey-palette, 200) border: map-get(mat.$m2-grey-palette, 200)
); );
$config: ( $config: (
// Overrides // Overrides
primary: mat.define-palette($dsh-slateblue, 400), primary: mat.m2-define-palette($dsh-slateblue, 400),
accent: mat.define-palette($dsh-palegreen, 300), accent: mat.m2-define-palette($dsh-palegreen, 300),
warn: mat.define-palette($dsh-warn, 300), warn: mat.m2-define-palette($dsh-warn, 300),
is-dark: false, is-dark: false,
// Custom // Custom
name: 'main', name: 'main',
success-base: mat.get-color-from-palette(mat.define-palette($dsh-success), 400), success-base: mat.m2-get-color-from-palette(mat.m2-define-palette($dsh-success), 400),
pending-base: mat.get-color-from-palette(mat.define-palette($dsh-pending), 800), pending-base: mat.m2-get-color-from-palette(mat.m2-define-palette($dsh-pending), 800),
warn-base: mat.get-color-from-palette(mat.define-palette($dsh-warn), 300) warn-base: mat.m2-get-color-from-palette(mat.m2-define-palette($dsh-warn), 300)
); );
@include theme($config, $background, $foreground); @include theme($config, $background, $foreground);

View File

@ -6,32 +6,32 @@ $background: (
// Overrides // Overrides
background: #ecf4f4, background: #ecf4f4,
// Custom // Custom
hover: map-get(mat.$grey-palette, 200), hover: map-get(mat.$m2-grey-palette, 200),
selected-button: map-get(mat.$grey-palette, 100) selected-button: map-get(mat.$m2-grey-palette, 100)
); );
$foreground: ( $foreground: (
// Overrides // Overrides
// Custom // Custom
contrast-text: $light-text, contrast-text: $light-text,
light-text: mat.get-color-from-palette(mat.define-palette(mat.$grey-palette), 500), light-text: mat.m2-get-color-from-palette(mat.m2-define-palette(mat.$m2-grey-palette), 500),
border: map-get(mat.$grey-palette, 200) border: map-get(mat.$m2-grey-palette, 200)
); );
$config: ( $config: (
// Overrides // Overrides
color: color:
( (
primary: mat.define-palette($dsh-smalt, 900), primary: mat.m2-define-palette($dsh-smalt, 900),
accent: mat.define-palette($dsh-persian-green, 400), accent: mat.m2-define-palette($dsh-persian-green, 400),
warn: mat.define-palette($dsh-warn, 300), warn: mat.m2-define-palette($dsh-warn, 300),
), ),
is-dark: false, is-dark: false,
// Custom // Custom
name: 'persian-green', name: 'persian-green',
success-base: mat.get-color-from-palette(mat.define-palette($dsh-success), 400), success-base: mat.m2-get-color-from-palette(mat.m2-define-palette($dsh-success), 400),
pending-base: mat.get-color-from-palette(mat.define-palette($dsh-pending), 800), pending-base: mat.m2-get-color-from-palette(mat.m2-define-palette($dsh-pending), 800),
warn-base: mat.get-color-from-palette(mat.define-palette($dsh-warn), 300) warn-base: mat.m2-get-color-from-palette(mat.m2-define-palette($dsh-warn), 300)
); );
@include theme($config, $background, $foreground); @include theme($config, $background, $foreground);

View File

@ -6,32 +6,32 @@ $background: (
// Overrides // Overrides
background: #f5f5f7, background: #f5f5f7,
// Custom (deprecated) // Custom (deprecated)
hover: map-get(mat.$grey-palette, 200), hover: map-get(mat.$m2-grey-palette, 200),
selected-button: map-get(mat.$grey-palette, 100) selected-button: map-get(mat.$m2-grey-palette, 100)
); );
$foreground: ( $foreground: (
// Overrides // Overrides
// Custom // Custom
contrast-text: $light-text, contrast-text: $light-text,
light-text: mat.get-color-from-palette(mat.define-palette(mat.$grey-palette), 500), light-text: mat.m2-get-color-from-palette(mat.m2-define-palette(mat.$m2-grey-palette), 500),
border: map-get(mat.$grey-palette, 200) border: map-get(mat.$m2-grey-palette, 200)
); );
$config: ( $config: (
// Overrides // Overrides
color: color:
( (
primary: mat.define-palette($dsh-black, 900), primary: mat.m2-define-palette($dsh-black, 900),
accent: mat.define-palette($dsh-black, 900), accent: mat.m2-define-palette($dsh-black, 900),
warn: mat.define-palette($dsh-warn, 300), warn: mat.m2-define-palette($dsh-warn, 300),
), ),
is-dark: false, is-dark: false,
// Custom // Custom
name: 'solitude', name: 'solitude',
success-base: mat.get-color-from-palette(mat.define-palette($dsh-success), 400), success-base: mat.m2-get-color-from-palette(mat.m2-define-palette($dsh-success), 400),
pending-base: mat.get-color-from-palette(mat.define-palette($dsh-pending), 800), pending-base: mat.m2-get-color-from-palette(mat.m2-define-palette($dsh-pending), 800),
warn-base: mat.get-color-from-palette(mat.define-palette($dsh-warn), 300) warn-base: mat.m2-get-color-from-palette(mat.m2-define-palette($dsh-warn), 300)
); );
@include theme($config, $background, $foreground); @include theme($config, $background, $foreground);

View File

@ -8,7 +8,7 @@
@mixin dsh-shadow($theme) { @mixin dsh-shadow($theme) {
$primary: map-get($theme, primary); $primary: map-get($theme, primary);
$shadow-color: mat.get-color-from-palette($primary, default); $shadow-color: mat.m2-get-color-from-palette($primary, default);
box-shadow: #{get-shadow($shadow-color, 0.12)} !important; box-shadow: #{get-shadow($shadow-color, 0.12)} !important;
} }