This commit is contained in:
Dan Percic 2024-12-05 12:49:51 +02:00
parent 8582f2e6be
commit e21c225ddd
53 changed files with 44 additions and 67 deletions

View File

@ -206,6 +206,7 @@ module.exports = {
],
rules: {
'rxjs/no-ignored-subscription': 'error',
'@angular-eslint/prefer-standalone': 'off',
'@angular-eslint/directive-selector': [
'error',
{

View File

@ -8,7 +8,7 @@ import { randomString } from '../../utils';
templateUrl: './chevron-button.component.html',
styleUrls: ['./chevron-button.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [MatIconModule, MatButtonModule]
imports: [MatIconModule, MatButtonModule],
})
export class ChevronButtonComponent {
readonly label = input.required<string>();

View File

@ -24,7 +24,7 @@ import { CircleButtonType, CircleButtonTypes } from '../types/circle-button.type
templateUrl: './circle-button.component.html',
styleUrls: ['./circle-button.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [MatTooltipModule, MatIconModule, MatButtonModule, StopPropagationDirective]
imports: [MatTooltipModule, MatIconModule, MatButtonModule, StopPropagationDirective],
})
export class CircleButtonComponent {
readonly #elementRef = inject(ElementRef<HTMLElement>);

View File

@ -11,7 +11,7 @@ import { IconButtonType, IconButtonTypes } from '../types/icon-button.type';
selector: 'iqser-icon-button',
templateUrl: './icon-button.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [NgClass, MatButtonModule, MatIconModule, StopPropagationDirective]
imports: [NgClass, MatButtonModule, MatIconModule, StopPropagationDirective],
})
export class IconButtonComponent {
protected readonly _hasRouterLink = !!inject(RouterLink, { optional: true, host: true });

View File

@ -1,4 +1,4 @@
import { NgClass, NgTemplateOutlet } from '@angular/common';
import { NgTemplateOutlet } from '@angular/common';
import {
AfterViewInit,
ChangeDetectionStrategy,
@ -96,8 +96,7 @@ function getConfig(options?: IConfirmationDialogData): InternalConfirmationDialo
IconButtonComponent,
CircleButtonComponent,
MatDialogModule,
NgClass,
]
],
})
export class ConfirmationDialogComponent implements AfterViewInit {
readonly config = getConfig(inject(MAT_DIALOG_DATA));

View File

@ -2,7 +2,6 @@ import { booleanAttribute, Directive, input } from '@angular/core';
@Directive({
selector: '[iqserDisableStopPropagation]',
standalone: true,
})
export class DisableStopPropagationDirective {
readonly iqserDisableStopPropagation = input(true, { transform: booleanAttribute });

View File

@ -2,7 +2,6 @@ import { Directive, ElementRef, OnDestroy, OnInit, signal } from '@angular/core'
@Directive({
selector: '[iqserHasScrollbar]',
standalone: true,
host: {
'[class]': '_class()',
},

View File

@ -2,7 +2,6 @@ import { Directive, EventEmitter, HostListener, Input, Output } from '@angular/c
@Directive({
selector: '[iqserHiddenAction]',
standalone: true,
})
export class HiddenActionDirective {
@Input() requiredClicks = 4;

View File

@ -3,7 +3,6 @@ import { NGXLogger } from 'ngx-logger';
@Directive({
selector: '[iqserPreventDefault]',
standalone: true,
})
export class PreventDefaultDirective {
readonly #logger = inject(NGXLogger);

View File

@ -4,7 +4,6 @@ import { DisableStopPropagationDirective } from './disable-stop-propagation.dire
@Directive({
selector: '[iqserStopPropagation]',
standalone: true,
})
export class StopPropagationDirective {
readonly #disableStopPropagation = inject(DisableStopPropagationDirective, { optional: true });

View File

@ -2,7 +2,6 @@ import { Directive, ElementRef, HostListener, Input, OnDestroy } from '@angular/
@Directive({
selector: '[iqserSyncWidth]',
standalone: true,
})
export class SyncWidthDirective implements OnDestroy {
@Input() iqserSyncWidth!: string;

View File

@ -19,7 +19,7 @@ import { randomString } from '../utils/functions';
templateUrl: './empty-state.component.html',
styleUrls: ['./empty-state.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [NgStyle, MatIconModule, IconButtonComponent]
imports: [NgStyle, MatIconModule, IconButtonComponent],
})
export class EmptyStateComponent {
protected readonly iconButtonTypes = IconButtonTypes;

View File

@ -17,7 +17,7 @@ import { ErrorService } from '../error.service';
]),
],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: false
standalone: false,
})
export class ConnectionStatusComponent {
protected readonly connectionStatusTranslations = connectionStatusTranslations;

View File

@ -8,7 +8,7 @@ import { CustomError, ErrorService, ErrorType } from '../error.service';
templateUrl: './full-page-error.component.html',
styleUrls: ['./full-page-error.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: false
standalone: false,
})
export class FullPageErrorComponent {
protected readonly iconButtonTypes = IconButtonTypes;

View File

@ -37,7 +37,7 @@ const atLeastOneIsExpandable = pipe(
},
},
],
imports: [AsyncPipe, InputWithActionComponent, NgTemplateOutlet, TranslateModule, MatIcon, MatCheckbox, StopPropagationDirective]
imports: [AsyncPipe, InputWithActionComponent, NgTemplateOutlet, TranslateModule, MatIcon, MatCheckbox, StopPropagationDirective],
})
export class FilterCardComponent implements OnInit {
readonly #filterService = inject(FilterService);

View File

@ -28,7 +28,7 @@ import { IFilterGroup } from '../models/filter-group.model';
FilterCardComponent,
StopPropagationDirective,
MatMenuContent,
]
],
})
export class PopupFilterComponent implements OnInit {
@Input() primaryFiltersSlug!: string;

View File

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

View File

@ -7,7 +7,7 @@ import { IFilter } from '../models/filter.model';
selector: 'iqser-single-filter',
templateUrl: './single-filter.component.html',
styleUrls: ['./single-filter.component.scss'],
standalone: false
standalone: false,
})
export class SingleFilterComponent {
@Input() filter!: IFilter;

View File

@ -10,7 +10,7 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
selector: 'iqser-help-button',
templateUrl: './help-button.component.html',
styleUrls: ['./help-button.component.scss'],
imports: [MatIcon, MatTooltip]
imports: [MatIcon, MatTooltip],
})
export class HelpButtonComponent implements OnInit, OnDestroy {
#helpModeHasBeenActivated = false;

View File

@ -12,7 +12,7 @@ const DEFAULT_CDK_OVERLAY_CONTAINER_ZINDEX = '800';
templateUrl: './help-mode-dialog.component.html',
styleUrls: ['./help-mode-dialog.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [MatCheckbox, CircleButtonComponent, TranslateModule]
imports: [MatCheckbox, CircleButtonComponent, TranslateModule],
})
export class HelpModeDialogComponent implements OnInit, OnDestroy {
#backdropClickSubscription: Subscription;

View File

@ -3,7 +3,7 @@ import { HelpModeService } from '../help-mode.service';
import { IqserEventTarget } from '../../utils';
import { MatDialog } from '@angular/material/dialog';
import { CircleButtonComponent, CircleButtonTypes } from '../../buttons';
import { AsyncPipe, NgIf } from '@angular/common';
import { AsyncPipe } from '@angular/common';
import { TranslateModule } from '@ngx-translate/core';
@Component({
@ -11,7 +11,7 @@ import { TranslateModule } from '@ngx-translate/core';
templateUrl: './help-mode.component.html',
styleUrls: ['./help-mode.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [AsyncPipe, TranslateModule, NgIf, CircleButtonComponent]
imports: [AsyncPipe, TranslateModule, CircleButtonComponent],
})
export class HelpModeComponent {
readonly circleButtonTypes = CircleButtonTypes;

View File

@ -10,7 +10,7 @@ import { randomString } from '../../utils/functions';
templateUrl: './input-with-action.component.html',
styleUrls: ['./input-with-action.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [FormsModule, MatIconModule, CircleButtonComponent]
imports: [FormsModule, MatIconModule, CircleButtonComponent],
})
export class InputWithActionComponent {
readonly inputId = input(`${randomString() + '-search-input'}`);

View File

@ -6,7 +6,7 @@ import { MatIconModule } from '@angular/material/icon';
templateUrl: './round-checkbox.component.html',
styleUrls: ['./round-checkbox.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [MatIconModule]
imports: [MatIconModule],
})
export class RoundCheckboxComponent {
protected readonly _wrapper = viewChild.required('wrapper', { read: ElementRef });

View File

@ -18,7 +18,7 @@ type ButtonType = keyof typeof ButtonTypes;
templateUrl: './scroll-button.component.html',
styleUrls: ['./scroll-button.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [AsyncPipe, MatIcon]
imports: [AsyncPipe, MatIcon],
})
export class ScrollButtonComponent implements OnInit {
readonly buttonType = ButtonTypes;

View File

@ -12,7 +12,7 @@ import { Id, IListable } from '../models';
templateUrl: './table-column-name.component.html',
styleUrls: ['./table-column-name.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [MatIcon, MatTooltip, TranslateModule, AsyncPipe, NgClass]
imports: [MatIcon, MatTooltip, TranslateModule, AsyncPipe, NgClass],
})
export class TableColumnNameComponent<T extends IListable<PrimaryKey>, PrimaryKey extends Id = T['id']> {
readonly sortingOrders = SortingOrders;

View File

@ -12,7 +12,7 @@ import { ListingService } from '../../services/listing.service';
templateUrl: './table-item.component.html',
styleUrls: ['./table-item.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [RoundCheckboxComponent, AsyncPipe, NgTemplateOutlet]
imports: [RoundCheckboxComponent, AsyncPipe, NgTemplateOutlet],
})
export class TableItemComponent<T extends IListable> implements OnChanges {
@Input() entity!: T;

View File

@ -28,7 +28,7 @@ const SCROLLBAR_WIDTH = 11;
selector: 'iqser-table [tableColumnConfigs] [itemSize]',
templateUrl: './table.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [TableHeaderComponent, NgTemplateOutlet, AsyncPipe, EmptyStateComponent, ScrollButtonComponent, TableContentComponent]
imports: [TableHeaderComponent, NgTemplateOutlet, AsyncPipe, EmptyStateComponent, ScrollButtonComponent, TableContentComponent],
})
export class TableComponent<Class extends IListable<PrimaryKey>, PrimaryKey extends Id = Class['id']> implements OnChanges {
@ViewChild(TableContentComponent, { static: true }) private readonly _tableContent!: TableContentComponent<Class>;

View File

@ -36,7 +36,7 @@ interface ColumnHeaderContext {
templateUrl: './column-header.component.html',
styleUrls: ['./column-header.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [AsyncPipe, TranslateModule, RoundCheckboxComponent, NgTemplateOutlet, CircleButtonComponent]
imports: [AsyncPipe, TranslateModule, RoundCheckboxComponent, NgTemplateOutlet, CircleButtonComponent],
})
export class ColumnHeaderComponent<T extends IListable, K extends string> extends ContextComponent<ColumnHeaderContext> implements OnInit {
readonly circleButtonTypes = CircleButtonTypes;

View File

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

View File

@ -1,16 +1,16 @@
import { ChangeDetectionStrategy, Component, Input, Optional, OnInit } from '@angular/core';
import { ProgressBarConfigModel } from './progress-bar-config.model';
import { FilterService, INestedFilter } from '../../filtering';
import { ChangeDetectionStrategy, Component, Input, OnInit, Optional } from '@angular/core';
import { Observable, of } from 'rxjs';
import { get, shareLast } from '../../utils';
import { map } from 'rxjs/operators';
import { FilterService, INestedFilter } from '../../filtering';
import { get, shareLast } from '../../utils';
import { ProgressBarConfigModel } from './progress-bar-config.model';
@Component({
selector: 'iqser-progress-bar [config]',
templateUrl: './progress-bar.component.html',
styleUrls: ['./progress-bar.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: false
standalone: false,
})
export class ProgressBarComponent implements OnInit {
@Input() config!: ProgressBarConfigModel;

View File

@ -6,7 +6,7 @@ import { ILoadingConfig } from '../loading.service';
templateUrl: './progress-loading.component.html',
styleUrls: ['./progress-loading.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: false
standalone: false,
})
export class ProgressLoadingComponent {
@Input() config!: ILoadingConfig;

View File

@ -6,7 +6,6 @@ import { assertTemplate, IqserPermissionsDirective } from './permissions.directi
@Directive({
selector: '[allow]',
standalone: true,
})
export class IqserAllowDirective extends IqserPermissionsDirective implements OnDestroy, OnInit {
/**

View File

@ -6,7 +6,6 @@ import { assertTemplate, IqserPermissionsDirective } from './permissions.directi
@Directive({
selector: '[deny]',
standalone: true,
})
export class IqserDenyDirective extends IqserPermissionsDirective implements OnDestroy, OnInit {
/**

View File

@ -3,7 +3,6 @@ import { capitalize } from '../utils';
@Pipe({
name: 'capitalize',
standalone: true,
})
export class CapitalizePipe implements PipeTransform {
transform(value: string): string {

View File

@ -3,7 +3,6 @@ import { humanizeCamelCase } from '../utils';
@Pipe({
name: 'humanizeCamelCase',
standalone: true,
})
export class HumanizeCamelCasePipe implements PipeTransform {
transform(item: string): string {

View File

@ -3,7 +3,6 @@ import { humanize } from '../utils';
@Pipe({
name: 'humanize',
standalone: true,
})
export class HumanizePipe implements PipeTransform {
transform(item: string, lowercase = false): string {

View File

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

View File

@ -2,7 +2,6 @@ import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'replaceNbsp',
standalone: true,
})
export class ReplaceNbspPipe implements PipeTransform {
transform(value: string): string {

View File

@ -3,7 +3,6 @@ import { size } from '../utils';
@Pipe({
name: 'size',
standalone: true,
})
export class SizePipe implements PipeTransform {
transform(value: number): string {

View File

@ -2,7 +2,6 @@ import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'snakeCase',
standalone: true,
})
export class SnakeCasePipe implements PipeTransform {
transform(value: string): string | undefined {

View File

@ -1,6 +1,5 @@
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
import { MatIconModule } from '@angular/material/icon';
import { NgClass } from '@angular/common';
@Component({
selector: 'iqser-logo',
@ -18,8 +17,8 @@ import { NgClass } from '@angular/common';
`,
],
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [MatIconModule, NgClass]
imports: [MatIconModule],
})
export class LogoComponent {
icon = input.required<string>();
readonly icon = input.required<string>();
}

View File

@ -4,7 +4,6 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
selector: 'iqser-side-nav [title]',
templateUrl: './side-nav.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
})
export class SideNavComponent {
@Input() title!: string;

View File

@ -9,7 +9,7 @@ import { tap } from 'rxjs/operators';
templateUrl: './skeleton.component.html',
styleUrls: ['./skeleton.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [NgTemplateOutlet, AsyncPipe]
imports: [NgTemplateOutlet, AsyncPipe],
})
export class SkeletonComponent {
@Input() templates!: Record<string, TemplateRef<unknown>>;

View File

@ -13,7 +13,6 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
`,
],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
})
export class SmallChipComponent {
@Input() color!: string;

View File

@ -4,7 +4,6 @@ import { Component, HostBinding, Input } from '@angular/core';
selector: 'iqser-spacer [height]',
template: ' <div></div> ',
styleUrls: ['./spacer.component.scss'],
standalone: true,
})
export class SpacerComponent {
@Input({ required: true }) height!: number;

View File

@ -9,7 +9,7 @@ import { MatTooltipModule } from '@angular/material/tooltip';
styleUrls: ['./status-bar.component.scss'],
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [NgClass, NgStyle, MatTooltipModule]
imports: [NgClass, NgStyle, MatTooltipModule],
})
export class StatusBarComponent<T extends string> {
@Input() configs: readonly StatusBarConfig<T>[] = [];

View File

@ -8,7 +8,7 @@ import { StopPropagationDirective } from '../../directives';
@Component({
templateUrl: './toast.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [MatIconModule, StopPropagationDirective]
imports: [MatIconModule, StopPropagationDirective],
})
export class ToastComponent extends Toast {
get actions(): ToasterActions[] {

View File

@ -3,7 +3,7 @@ import { SortingOrder } from './models/sorting-order.type';
import { KeysOf } from '../utils';
import { sort } from './functions';
@Pipe({ name: 'sortBy', standalone: true })
@Pipe({ name: 'sortBy' })
export class SortByPipe implements PipeTransform {
transform<T>(values: T[], order: SortingOrder, column: KeysOf<T>): T[] {
return sort(values, order, column);

View File

@ -15,7 +15,7 @@ import { KeycloakStatusService } from '../services/keycloak-status.service';
templateUrl: './tenant-select.component.html',
styleUrls: ['./tenant-select.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: false
standalone: false,
})
export class TenantSelectComponent {
readonly #uiRoot = inject(UI_ROOT);
@ -39,10 +39,6 @@ export class TenantSelectComponent {
this.#loadStoredTenants();
}
protected tenantIcon(tenant: IStoredTenantId) {
return `red:${tenant.documine ? 'documine' : 'redaction'}-logo`;
}
updateTenantSelection() {
const tenantId = this.form.controls.tenantId.value;
if (!tenantId) {
@ -75,6 +71,10 @@ export class TenantSelectComponent {
this.#loadStoredTenants();
}
protected tenantIcon(tenant: IStoredTenantId) {
return `red:${tenant.documine ? 'documine' : 'redaction'}-logo`;
}
#loadStoredTenants() {
this.storedTenants = this.tenantsService.getStoredTenants().sort((a, b) => a.tenantId.localeCompare(b.tenantId));
}

View File

@ -2,7 +2,6 @@ import { Directive, EventEmitter, HostBinding, HostListener, Output } from '@ang
@Directive({
selector: '[iqserDragDropFileUpload]',
standalone: true,
})
export class DragDropFileUploadDirective {
@Output() readonly fileDropped = new EventEmitter();

View File

@ -1,16 +1,14 @@
import { ChangeDetectionStrategy, Component, ElementRef, EventEmitter, Input, Output, ViewChild } from '@angular/core';
import { DragDropFileUploadDirective } from './drag-drop-file-upload.directive';
import { MatIcon } from '@angular/material/icon';
import { NgIf } from '@angular/common';
import { TranslateModule } from '@ngx-translate/core';
@Component({
selector: 'iqser-upload-file',
templateUrl: './upload-file.component.html',
// eslint-disable-next-line @angular-eslint/no-host-metadata-property
host: { '[class.iqser-upload-file]': 'true' },
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [DragDropFileUploadDirective, MatIcon, NgIf, TranslateModule]
imports: [DragDropFileUploadDirective, MatIcon, TranslateModule],
})
export class UploadFileComponent {
@ViewChild('attachFileInput', { static: true }) attachFileInput!: ElementRef;

View File

@ -6,7 +6,7 @@ import { IqserUserService } from '../../services/iqser-user.service';
templateUrl: './user-button.component.html',
styleUrls: ['./user-button.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: false
standalone: false,
})
export class UserButtonComponent {
@Input() showDot = false;

View File

@ -19,7 +19,6 @@ function getInitials(name: string) {
@Pipe({
name: 'name',
standalone: true,
})
export class NamePipe implements PipeTransform {
readonly #translateService = inject(TranslateService);