Some fixes/improvements

This commit is contained in:
Adina Țeudan 2021-10-11 20:43:04 +03:00
parent d8a0c189b0
commit 4040db5fba
4 changed files with 27 additions and 22 deletions

View File

@ -1,14 +1,10 @@
@mixin line-clamp($lines) {
display: -webkit-box;
-webkit-line-clamp: $lines;
-webkit-box-orient: vertical;
overflow: hidden;
display: block;
@if $lines == 1 {
text-overflow: ellipsis;
white-space: nowrap;
}
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: $lines; /* number of lines to show */
-webkit-box-orient: vertical;
width: fit-content;
}
@mixin no-scroll-bar {

View File

@ -114,6 +114,14 @@ pre {
@include mixins.line-clamp(2);
}
.clamp-3 {
@include mixins.line-clamp(3);
}
.clamp-4 {
@include mixins.line-clamp(4);
}
.no-wrap {
white-space: nowrap;
}

View File

@ -2,8 +2,8 @@ import { Inject, Injectable, InjectionToken, Injector, Optional } from '@angular
import { BehaviorSubject, Observable, Subject } from 'rxjs';
import { distinctUntilChanged, map, shareReplay, tap } from 'rxjs/operators';
import { IListable } from '../models';
import { GenericService } from '../../services';
import { getLength } from '../../utils';
import { GenericService, QueryParam } from '../../services';
import { getLength, List } from '../../utils';
/**
* This should be removed when refactoring is done
@ -47,17 +47,16 @@ export class EntitiesService<E extends IListable, I = E> extends GenericService<
);
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
loadAll(...args: unknown[]): Observable<E[]> {
return this.getAll().pipe(
loadAll(modelPath = this._defaultModelPath, queryParams?: List<QueryParam>): Observable<E[]> {
return this.getAll(modelPath, queryParams).pipe(
map((entities: I[]) => entities.map(entity => new this._entityClass(entity))),
tap((entities: E[]) => this.setEntities(entities)),
);
}
loadAllIfEmpty(...args: unknown[]): Promise<unknown> | void {
loadAllIfEmpty(modelPath = this._defaultModelPath, queryParams?: List<QueryParam>): Promise<unknown> | void {
if (!this.all.length) {
return this.loadAll(...args).toPromise();
return this.loadAll(modelPath, queryParams).toPromise();
}
}

View File

@ -16,14 +16,16 @@ export const defaultDialogConfig: MatDialogConfig = {
autoFocus: false,
} as const;
export type DialogConfig<T extends string> = {
[key in T]: {
component: ComponentType<unknown>;
dialogConfig?: MatDialogConfig;
};
};
@Injectable()
export abstract class DialogService<T extends string> {
protected abstract readonly _config: {
[key in T]: {
component: ComponentType<unknown>;
dialogConfig?: MatDialogConfig;
};
};
protected abstract readonly _config: DialogConfig<T>;
protected constructor(protected readonly _dialog: MatDialog) {}