fix eslint

This commit is contained in:
Dan Percic 2021-10-06 09:50:13 +03:00
parent 61fb1a4006
commit 4e84610f65
59 changed files with 108 additions and 106 deletions

View File

@ -14,6 +14,6 @@ const components = [ChevronButtonComponent, CircleButtonComponent, IconButtonCom
@NgModule({
declarations: [...components],
imports: [CommonModule, IqserIconsModule, TranslateModule, ...matModules],
exports: [...components]
exports: [...components],
})
export class IqserButtonsModule {}

View File

@ -5,7 +5,7 @@ import { Required } from '../../utils';
selector: 'iqser-chevron-button',
templateUrl: './chevron-button.component.html',
styleUrls: ['./chevron-button.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ChevronButtonComponent {
@Input() @Required() label!: string;

View File

@ -7,7 +7,7 @@ import { IqserTooltipPosition, IqserTooltipPositions, Required } from '../../uti
selector: 'iqser-circle-button',
templateUrl: './circle-button.component.html',
styleUrls: ['./circle-button.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class CircleButtonComponent implements OnInit {
readonly circleButtonTypes = CircleButtonTypes;

View File

@ -6,7 +6,7 @@ import { Required } from '../../utils';
selector: 'iqser-icon-button',
templateUrl: './icon-button.component.html',
styleUrls: ['./icon-button.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class IconButtonComponent {
readonly iconButtonTypes = IconButtonTypes;

View File

@ -2,7 +2,7 @@ export const CircleButtonTypes = {
default: 'default',
primary: 'primary',
warn: 'warn',
dark: 'dark'
dark: 'dark',
} as const;
export type CircleButtonType = keyof typeof CircleButtonTypes;

View File

@ -1,7 +1,7 @@
export const IconButtonTypes = {
default: 'default',
dark: 'dark',
primary: 'primary'
primary: 'primary',
} as const;
export type IconButtonType = keyof typeof IconButtonTypes;

View File

@ -32,7 +32,7 @@ const modules = [
IqserInputsModule,
IqserHelpModeModule,
IqserScrollbarModule,
IqserEmptyStatesModule
IqserEmptyStatesModule,
];
const components = [
StatusBarComponent,
@ -41,13 +41,13 @@ const components = [
LogoComponent,
HiddenActionComponent,
ConfirmationDialogComponent,
SideNavComponent
SideNavComponent,
];
const pipes = [SortByPipe, HumanizePipe];
@NgModule({
declarations: [...components, ...pipes, LogPipe],
imports: [CommonModule, ...matModules, ...modules, FormsModule, ReactiveFormsModule],
exports: [...components, ...pipes, ...modules, LogPipe]
exports: [...components, ...pipes, ...modules, LogPipe],
})
export class CommonUiModule {}

View File

@ -10,6 +10,6 @@ const components = [EmptyStateComponent];
@NgModule({
declarations: [...components],
imports: [CommonModule, ...modules],
exports: [...components]
exports: [...components],
})
export class IqserEmptyStatesModule {}

View File

@ -6,7 +6,7 @@ import { Required } from '../../utils';
selector: 'iqser-empty-state',
templateUrl: './empty-state.component.html',
styleUrls: ['./empty-state.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class EmptyStateComponent implements OnInit {
readonly iconButtonTypes = IconButtonTypes;

View File

@ -11,10 +11,10 @@ import { animate, state, style, transition, trigger } from '@angular/animations'
trigger('animateOpenClose', [
state('open', style({ bottom: '20px' })),
state('void', style({ bottom: '-70px' })),
transition('* => open, open => void', animate('1s ease-in-out'))
])
transition('* => open, open => void', animate('1s ease-in-out')),
]),
],
changeDetection: ChangeDetectionStrategy.OnPush
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class FullPageErrorComponent {
readonly iconButtonTypes = IconButtonTypes;

View File

@ -50,7 +50,7 @@ export function checkFilter(
validate?: (...args: unknown[]) => boolean,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
validateArgs: any = [],
matchAll = false
matchAll = false,
): boolean {
const hasChecked = filters.find(f => f.checked);

View File

@ -18,7 +18,7 @@ export class FilterService {
constructor() {
this.filterGroups$ = this._refresh$.pipe(
startWith(''),
switchMap(() => this._filterGroups$.asObservable())
switchMap(() => this._filterGroups$.asObservable()),
);
this.showResetFilters$ = this._showResetFilters$;
@ -32,7 +32,7 @@ export class FilterService {
return this.filterGroups$.pipe(
map(toFlatFilters),
map(f => !!f.find(el => el.checked)),
distinctUntilChanged()
distinctUntilChanged(),
);
}

View File

@ -16,6 +16,6 @@ const components = [QuickFiltersComponent, PopupFilterComponent];
@NgModule({
declarations: [...components],
exports: [...components],
imports: [CommonModule, ...matModules, ...modules]
imports: [CommonModule, ...matModules, ...modules],
})
export class IqserFiltersModule {}

View File

@ -14,7 +14,7 @@ const areExpandable = (nestedFilter: INestedFilter) => !!nestedFilter?.children?
const atLeastOneIsExpandable = pipe(
map<IFilterGroup | undefined, boolean>(group => !!group?.filters.some(areExpandable)),
distinctUntilChanged(),
shareReplay()
shareReplay(),
);
@Component({
@ -27,11 +27,11 @@ const atLeastOneIsExpandable = pipe(
provide: MAT_CHECKBOX_DEFAULT_OPTIONS,
useValue: {
clickAction: 'noop',
color: 'primary'
}
color: 'primary',
},
},
SearchService
]
SearchService,
],
})
export class PopupFilterComponent implements OnInit {
@Input() primaryFiltersSlug!: string;
@ -54,7 +54,7 @@ export class PopupFilterComponent implements OnInit {
return combineLatest([this.primaryFilterGroup$, this.secondaryFilterGroup$]).pipe(
map(([primary, secondary]) => [...(primary?.filters || []), ...(secondary?.filters || [])]),
any(f => f.checked || !!f.indeterminate),
distinctUntilChanged()
distinctUntilChanged(),
);
}
@ -123,7 +123,7 @@ export class PopupFilterComponent implements OnInit {
private get _primaryFilters$(): Observable<IFilter[]> {
return combineLatest([this.primaryFilterGroup$, this.searchService.valueChanges$]).pipe(
map(([group]) => this.searchService.searchIn(group?.filters ?? []))
map(([group]) => this.searchService.searchIn(group?.filters ?? [])),
);
}
}

View File

@ -5,7 +5,7 @@ import { FilterService } from '../filter.service';
selector: 'iqser-quick-filters',
templateUrl: './quick-filters.component.html',
styleUrls: ['./quick-filters.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class QuickFiltersComponent {
readonly quickFilters$ = this.filterService.getFilterModels$('quickFilters');

View File

@ -3,6 +3,6 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';
@Component({
templateUrl: './help-mode-dialog.component.html',
styleUrls: ['./help-mode-dialog.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class HelpModeDialogComponent {}

View File

@ -3,7 +3,7 @@ import { HelpModeService } from './help-mode.service';
@Directive({
selector: '[iqserHelpMode]',
exportAs: 'iqserHelpMode'
exportAs: 'iqserHelpMode',
})
export class HelpModeDirective implements OnInit {
@Input('iqserHelpMode') elementName!: string;
@ -11,7 +11,7 @@ export class HelpModeDirective implements OnInit {
constructor(
private readonly _elementRef: ElementRef,
private readonly _renderer: Renderer2,
private readonly _helpModeService: HelpModeService
private readonly _helpModeService: HelpModeService,
) {}
ngOnInit(): void {

View File

@ -16,6 +16,6 @@ const components = [HelpModeComponent, HelpModeDialogComponent, HelpModeDirectiv
declarations: [...components],
imports: [CommonModule, IqserIconsModule, ...matModules, TranslateModule, IqserButtonsModule],
exports: [...components],
providers: [HelpModeService]
providers: [HelpModeService],
})
export class IqserHelpModeModule {}

View File

@ -24,7 +24,7 @@ export class HelpModeService {
@Inject(HELP_DOCS) private readonly _docs: Record<string, Record<string, string>>,
private readonly _dialog: MatDialog,
private readonly _rendererFactory: RendererFactory2,
private readonly _translateService: TranslateService
private readonly _translateService: TranslateService,
) {
this._renderer = this._rendererFactory.createRenderer(null, null);
}
@ -41,7 +41,7 @@ export class HelpModeService {
this._helpModeDialogIsOpened$.next(true);
const ref = this._dialog.open(HelpModeDialogComponent, {
width: '600px'
width: '600px',
});
ref.afterClosed()

View File

@ -6,7 +6,7 @@ import { IqserEventTarget } from '../../utils';
selector: 'iqser-help-mode',
templateUrl: './help-mode.component.html',
styleUrls: ['./help-mode.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class HelpModeComponent {
constructor(readonly helpModeService: HelpModeService) {}

View File

@ -36,7 +36,7 @@ export class IqserIconsModule {
'sort-desc',
'status-collapse',
'status-expand',
'upload'
'upload',
]);
icons.forEach(icon => {
_iconRegistry.addSvgIconInNamespace(

View File

@ -6,7 +6,7 @@ import { CircleButtonType } from '../../buttons';
selector: 'iqser-editable-input',
templateUrl: './editable-input.component.html',
styleUrls: ['./editable-input.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class EditableInputComponent {
@Input() @Required() value!: string;

View File

@ -4,7 +4,7 @@ import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from
selector: 'iqser-input-with-action',
templateUrl: './input-with-action.component.html',
styleUrls: ['./input-with-action.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class InputWithActionComponent {
@Input() placeholder = '';

View File

@ -13,6 +13,6 @@ const components = [RoundCheckboxComponent, EditableInputComponent, InputWithAct
@NgModule({
declarations: [...components],
exports: [...components],
imports: [CommonModule, IqserIconsModule, ...modules]
imports: [CommonModule, IqserIconsModule, ...modules],
})
export class IqserInputsModule {}

View File

@ -4,7 +4,7 @@ import { ChangeDetectionStrategy, Component, ElementRef, Input, OnInit, ViewChil
selector: 'iqser-round-checkbox',
templateUrl: './round-checkbox.component.html',
styleUrls: ['./round-checkbox.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class RoundCheckboxComponent implements OnInit {
@Input() size = 20;

View File

@ -26,7 +26,7 @@ const components = [
WorkflowComponent,
TableColumnNameComponent,
ScrollButtonComponent,
PageHeaderComponent
PageHeaderComponent,
];
const modules = [
DragDropModule,
@ -38,13 +38,13 @@ const modules = [
IqserScrollbarModule,
IqserEmptyStatesModule,
ScrollingModule,
RouterModule
RouterModule,
];
const utils = [SyncWidthDirective];
@NgModule({
declarations: [...components, ...utils],
exports: [...components, ...utils],
imports: [CommonModule, ...modules, ...matModules]
imports: [CommonModule, ...modules, ...matModules],
})
export class IqserListingModule {}

View File

@ -1,6 +1,6 @@
export const ListingModes = {
table: 'table',
workflow: 'workflow'
workflow: 'workflow',
} as const;
export type ListingMode = keyof typeof ListingModes;

View File

@ -1,6 +1,6 @@
export const SearchPositions = {
beforeFilters: 'beforeFilters',
afterFilters: 'afterFilters'
afterFilters: 'afterFilters',
} as const;
export type SearchPosition = keyof typeof SearchPositions;

View File

@ -11,7 +11,7 @@ import { FilterService } from '../../filtering';
selector: 'iqser-page-header',
templateUrl: './page-header.component.html',
styleUrls: ['./page-header.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class PageHeaderComponent<T extends IListable> {
readonly searchPositions = SearchPositions;
@ -39,7 +39,7 @@ export class PageHeaderComponent<T extends IListable> {
return combineLatest([this.filterService.showResetFilters$, this.searchService.valueChanges$]).pipe(
map(([showResetFilters, searchValue]) => showResetFilters || !!searchValue),
distinctUntilChanged()
distinctUntilChanged(),
);
}

View File

@ -6,7 +6,7 @@ import { Required } from '../../utils';
const ButtonTypes = {
top: 'top',
bottom: 'bottom'
bottom: 'bottom',
} as const;
type ButtonType = keyof typeof ButtonTypes;
@ -15,7 +15,7 @@ type ButtonType = keyof typeof ButtonTypes;
selector: 'iqser-scroll-button',
templateUrl: './scroll-button.component.html',
styleUrls: ['./scroll-button.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ScrollButtonComponent implements OnInit {
readonly buttonType = ButtonTypes;

View File

@ -1,9 +1,9 @@
import { Inject, Injectable, InjectionToken, Injector, Optional } from "@angular/core";
import { BehaviorSubject, Observable, Subject } from "rxjs";
import { distinctUntilChanged, map, tap } from "rxjs/operators";
import { IListable } from "../models";
import { GenericService } from "../../services";
import { getLength } from "../../utils";
import { Inject, Injectable, InjectionToken, Injector, Optional } from '@angular/core';
import { BehaviorSubject, Observable, Subject } from 'rxjs';
import { distinctUntilChanged, map, tap } from 'rxjs/operators';
import { IListable } from '../models';
import { GenericService } from '../../services';
import { getLength } from '../../utils';
/**
* This should be removed when refactoring is done
@ -27,7 +27,7 @@ export class EntitiesService<E extends IListable, I = E> extends GenericService<
constructor(
protected readonly _injector: Injector,
@Optional() @Inject(ENTITY_CLASS) private readonly _entityClass: new (entityInterface: I, ...args: unknown[]) => E,
@Optional() @Inject(ENTITY_PATH) protected readonly _defaultModelPath = ''
@Optional() @Inject(ENTITY_PATH) protected readonly _defaultModelPath = '',
) {
super(_injector, _defaultModelPath);
this.all$ = this._all$.asObservable();
@ -42,14 +42,14 @@ export class EntitiesService<E extends IListable, I = E> extends GenericService<
private get _noData$(): Observable<boolean> {
return this.allLength$.pipe(
map(length => length === 0),
distinctUntilChanged()
distinctUntilChanged(),
);
}
loadAll(): Observable<E[]> {
return this.getAll().pipe(
map((entities: I[]) => entities.map(entity => new this._entityClass(entity))),
tap((entities: E[]) => this.setEntities(entities))
tap((entities: E[]) => this.setEntities(entities)),
);
}

View File

@ -4,7 +4,8 @@ import { distinctUntilChanged, map, tap } from 'rxjs/operators';
import { FilterService, getFilteredEntities } from '../../filtering';
import { SearchService } from '../../search';
import { IListable } from '../models';
import { EntitiesService, getLength } from '@iqser/common-ui';
import { EntitiesService } from './entities.service';
import { getLength } from '../../utils';
@Injectable()
export class ListingService<E extends IListable> {

View File

@ -1,7 +1,7 @@
import { Directive, ElementRef, HostListener, Input, OnDestroy } from '@angular/core';
@Directive({
selector: '[iqserSyncWidth]'
selector: '[iqserSyncWidth]',
})
export class SyncWidthDirective implements OnDestroy {
@Input() iqserSyncWidth!: string;
@ -25,7 +25,7 @@ export class SyncWidthDirective implements OnDestroy {
private _matchWidth() {
const headerItems = (this._elementRef.nativeElement as HTMLElement).children;
const tableRows = (this._elementRef.nativeElement as HTMLElement).parentElement?.parentElement?.getElementsByClassName(
this.iqserSyncWidth
this.iqserSyncWidth,
);
if (!tableRows || !tableRows.length) {
@ -52,7 +52,7 @@ export class SyncWidthDirective implements OnDestroy {
for (let idx = length - hasExtraColumns - 1; idx < headerItems.length; idx += 1) {
const item = headerItems[idx] as HTMLElement;
if (item) {
item.style.minWidth = `0`;
item.style.minWidth = '0';
}
}
}

View File

@ -9,7 +9,7 @@ const ifHasRightIcon = <T extends IListable>(thisArg: TableColumnNameComponent<T
selector: 'iqser-table-column-name',
templateUrl: './table-column-name.component.html',
styleUrls: ['./table-column-name.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class TableColumnNameComponent<T extends IListable> {
readonly sortingOrders = SortingOrders;

View File

@ -9,7 +9,7 @@ import {
Output,
TemplateRef,
ViewChild,
ViewContainerRef
ViewContainerRef,
} from '@angular/core';
import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
import { Required } from '../../utils';
@ -80,7 +80,7 @@ export class TableComponent<T extends IListable> implements OnInit {
getTableItemClasses(entity: T): { [key: string]: boolean } {
const classes: { [key: string]: boolean } = {
'table-item': true,
pointer: !!entity.routerLink && entity.routerLink.length > 0
pointer: !!entity.routerLink && entity.routerLink.length > 0,
};
for (const key in this.tableItemClasses) {
if (Object.prototype.hasOwnProperty.call(this.tableItemClasses, key)) {

View File

@ -9,7 +9,7 @@ import {
Output,
QueryList,
TemplateRef,
ViewChildren
ViewChildren,
} from '@angular/core';
import { ListingComponent } from '../listing-component.directive';
import { CdkDrag, CdkDragDrop, CdkDropList } from '@angular/cdk/drag-drop';
@ -37,7 +37,7 @@ export interface WorkflowConfig<T, K> {
selector: 'iqser-workflow',
templateUrl: './workflow.component.html',
styleUrls: ['./workflow.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class WorkflowComponent<T extends IListable, K extends string> implements OnInit {
@Input() headerTemplate?: TemplateRef<unknown>;

View File

@ -5,7 +5,7 @@ import { LoadingService } from '../loading.service';
selector: 'iqser-full-page-loading-indicator',
templateUrl: './full-page-loading-indicator.component.html',
styleUrls: ['./full-page-loading-indicator.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class FullPageLoadingIndicatorComponent {
constructor(readonly loadingService: LoadingService) {}

View File

@ -28,7 +28,7 @@ export class LoadingService {
func.then(
() => this.stop(),
() => this.stop()
() => this.stop(),
);
}

View File

@ -4,7 +4,7 @@ import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from
selector: 'iqser-hidden-action',
templateUrl: './hidden-action.component.html',
styleUrls: ['./hidden-action.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class HiddenActionComponent {
@Input() requiredClicks = 4;

View File

@ -5,7 +5,7 @@ import { Required } from '../../utils';
selector: 'iqser-logo',
templateUrl: './logo.component.html',
styleUrls: ['./logo.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class LogoComponent {
@Input() @Required() icon!: string;

View File

@ -5,7 +5,7 @@ import { Required } from '../../utils';
selector: 'iqser-side-nav',
templateUrl: './side-nav.component.html',
styleUrls: ['./side-nav.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class SideNavComponent {
@Input() @Required() title!: string;

View File

@ -6,7 +6,7 @@ import { StatusBarConfig } from './status-bar-config.model';
templateUrl: './status-bar.component.html',
styleUrls: ['./status-bar.component.scss'],
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class StatusBarComponent<T extends string> {
@Input() configs: readonly StatusBarConfig<T>[] = [];

View File

@ -2,7 +2,7 @@ import { AfterContentChecked, Directive, ElementRef, HostBinding } from '@angula
@Directive({
selector: '[iqserHasScrollbar]',
exportAs: 'iqserHasScrollbar'
exportAs: 'iqserHasScrollbar',
})
export class HasScrollbarDirective implements AfterContentChecked {
@HostBinding('class') class = '';

View File

@ -8,6 +8,6 @@ const utils = [HasScrollbarDirective];
declarations: [...utils],
exports: [...utils],
imports: [CommonModule],
providers: [HasScrollbarDirective]
providers: [HasScrollbarDirective],
})
export class IqserScrollbarModule {}

View File

@ -6,13 +6,13 @@ export const largeDialogConfig: MatDialogConfig = {
width: '90vw',
maxWidth: '90vw',
maxHeight: '90vh',
autoFocus: false
autoFocus: false,
} as const;
export const defaultDialogConfig: MatDialogConfig = {
width: '662px',
maxWidth: '90vw',
autoFocus: false
autoFocus: false,
} as const;
@Injectable()
@ -30,8 +30,8 @@ export abstract class DialogService<T extends string> {
type: T,
$event: MouseEvent,
data: unknown,
cb?: (...params: unknown[]) => unknown,
finallyCb?: (...params: unknown[]) => unknown | Promise<unknown>
cb?: (...params: unknown[]) => Promise<unknown> | unknown,
finallyCb?: (...params: unknown[]) => unknown | Promise<unknown>,
): MatDialogRef<unknown> {
const config = this._config[type];
@ -39,7 +39,7 @@ export abstract class DialogService<T extends string> {
const ref = this._dialog.open(config.component, {
...defaultDialogConfig,
...(config.dialogConfig || {}),
data
data,
});
// eslint-disable-next-line @typescript-eslint/no-misused-promises
ref.afterClosed().subscribe(async result => {

View File

@ -26,6 +26,7 @@ export abstract class GenericService<I> {
get(): Observable<I[]>;
get(id: string, ...args: unknown[]): Observable<I>;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
get(id?: string, ...args: unknown[]): Observable<I | I[]> {
return id ? this._getOne([id]) : this.getAll();
}
@ -34,7 +35,7 @@ export abstract class GenericService<I> {
getAll<R = I>(modelPath = this._defaultModelPath): Observable<R[]> {
return this._http.get<R[]>(`/${encodeURI(modelPath)}`, {
headers: HeadersConfiguration.getHeaders({ contentType: false }),
observe: 'body'
observe: 'body',
});
}
@ -50,7 +51,7 @@ export abstract class GenericService<I> {
body: body,
params: this._queryParams(queryParams),
headers: HeadersConfiguration.getHeaders({ contentType: false }),
observe: 'body'
observe: 'body',
});
}
@ -58,12 +59,12 @@ export abstract class GenericService<I> {
protected _post<R = I>(
@RequiredParam() body: unknown,
modelPath = this._defaultModelPath,
queryParams?: List<QueryParam>
queryParams?: List<QueryParam>,
): Observable<R> {
return this._http.post<R>(`/${encodeURI(modelPath)}`, body, {
params: this._queryParams(queryParams),
headers: HeadersConfiguration.getHeaders(),
observe: 'body'
observe: 'body',
});
}
@ -71,12 +72,12 @@ export abstract class GenericService<I> {
protected _put<R = I>(
@RequiredParam() body: unknown,
modelPath = this._defaultModelPath,
queryParams?: List<QueryParam>
queryParams?: List<QueryParam>,
): Observable<R> {
return this._http.put<R>(`/${encodeURI(modelPath)}`, body, {
params: this._queryParams(queryParams),
headers: HeadersConfiguration.getHeaders(),
observe: 'body'
observe: 'body',
});
}
@ -84,14 +85,14 @@ export abstract class GenericService<I> {
protected _getOne<R = I>(
@RequiredParam() path: List,
modelPath = this._defaultModelPath,
queryParams?: List<QueryParam>
queryParams?: List<QueryParam>,
): Observable<R> {
const entityPath = path.map(item => encodeURIComponent(item)).join('/');
return this._http.get<R>(`/${encodeURI(modelPath)}/${entityPath}`, {
headers: HeadersConfiguration.getHeaders({ contentType: false }),
params: this._queryParams(queryParams),
observe: 'body'
observe: 'body',
});
}

View File

@ -10,7 +10,7 @@ import { ErrorMessageService } from './error-message.service';
const enum NotificationType {
SUCCESS = 'SUCCESS',
WARNING = 'WARNING',
INFO = 'INFO'
INFO = 'INFO',
}
export interface ToasterOptions extends IndividualConfig {
@ -31,14 +31,14 @@ export interface ErrorToasterOptions extends ToasterOptions {
}
@Injectable({
providedIn: 'root'
providedIn: 'root',
})
export class Toaster {
constructor(
private readonly _toastr: ToastrService,
private readonly _router: Router,
private readonly _translateService: TranslateService,
private readonly _errorMessageService: ErrorMessageService
private readonly _errorMessageService: ErrorMessageService,
) {
_router.events.pipe(filter(event => event instanceof NavigationStart)).subscribe(() => {
_toastr.clear();
@ -71,7 +71,7 @@ export class Toaster {
private _showToastNotification(
message: string,
notificationType = NotificationType.INFO,
options?: Partial<ToasterOptions>
options?: Partial<ToasterOptions>,
): ActiveToast<unknown> {
const translatedMsg = this._translateService.instant(message, options?.params) as string;

View File

@ -8,7 +8,7 @@ export const SortingOrders = {
return 'asc';
}
return order === 'asc' ? 'desc' : 'asc';
}
},
} as const;
export type SortingOrder = NonFunctionKeys<typeof SortingOrders>;

View File

@ -10,7 +10,7 @@ import { IListable } from '../listing';
export class SortingService<T extends IListable> {
private readonly _sortingOption$ = new BehaviorSubject<SortingOption<T>>({
column: 'searchKey',
order: SortingOrders.asc
order: SortingOrders.asc,
});
readonly sortingOption$ = this._sortingOption$.asObservable();

View File

@ -45,7 +45,7 @@ export class CustomRouteReuseStrategy implements RouteReuseStrategy {
this._storedRoutes[this._getKey(route)] = {
handle: element as DetachedRouteHandle,
previousRoute: route
previousRoute: route,
};
}

View File

@ -19,10 +19,10 @@ export function Bind(): MethodDecorator {
Object.defineProperty(this, propertyKey, {
value: boundMethod,
configurable: true,
writable: true
writable: true,
});
return boundMethod;
}
},
};
};
}

View File

@ -47,14 +47,14 @@ export function OnChange<T, C extends Object = Object>(callback: CallBackFunctio
const simpleChange: SimpleChange<T> = {
previousValue: oldValue,
currentValue: instance[CACHED_VALUE_KEY],
isFirstChange: instance[IS_FIRST_CHANGE_KEY]
isFirstChange: instance[IS_FIRST_CHANGE_KEY],
};
callBackFn.call(instance, instance[CACHED_VALUE_KEY], simpleChange);
},
get(): T {
return (this as Instance<T>)[CACHED_VALUE_KEY];
}
},
});
};
}

View File

@ -20,7 +20,7 @@ export function Validate() {
const method = descriptor.value as (...args: unknown[]) => unknown;
const methodParams = getMethodParams(target as Record<string, unknown>, propertyName);
descriptor.value = function(...args: unknown[]) {
descriptor.value = function (...args: unknown[]) {
// eslint-disable-next-line @typescript-eslint/ban-types
const requiredParameters = <number[]>Reflect.getOwnMetadata(requiredMetadataKey, target as Object, propertyName);
@ -31,7 +31,7 @@ export function Validate() {
for (const parameterIndex of requiredParameters) {
if (parameterIndex >= args.length || args[parameterIndex] === undefined) {
throw new Error(
`Required parameter ${methodParams[parameterIndex]} was null or undefined when calling ${propertyName}`
`Required parameter ${methodParams[parameterIndex]} was null or undefined when calling ${propertyName}`,
);
}
}

View File

@ -11,9 +11,9 @@ export function Required<T>(condition: Condition<T> = () => true): PropertyDecor
set(value: unknown) {
Object.defineProperty(this, propertyKey, {
value,
writable: true
writable: true,
});
}
},
});
};
}

View File

@ -1,4 +1,4 @@
import { HttpUrlEncodingCodec } from "@angular/common/http";
import { HttpUrlEncodingCodec } from '@angular/common/http';
/**
* CustomHttpUrlEncodingCodec

View File

@ -2,7 +2,7 @@ import { Pipe, PipeTransform } from '@angular/core';
import { humanize } from '../functions';
@Pipe({
name: 'humanize'
name: 'humanize',
})
export class HumanizePipe implements PipeTransform {
transform(item: string, lowercase = false): string {

View File

@ -1,7 +1,7 @@
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'log'
name: 'log',
})
export class LogPipe implements PipeTransform {
transform<T>(value: T, message = ''): T {

View File

@ -23,7 +23,7 @@ export class PruningTranslationLoader implements TranslateLoader {
(result: T, key) => (
(result[key] = typeof object[key] === 'object' ? this._process(object[key] as T) : object[key]), result
),
{}
{},
)
);
}

View File

@ -4,7 +4,7 @@ export const IqserTooltipPositions = {
below: 'below',
above: 'above',
before: 'before',
after: 'after'
after: 'after',
} as const;
export type IqserTooltipPosition = KeysOf<typeof IqserTooltipPositions>;