This commit is contained in:
Dan Percic 2024-12-05 11:46:15 +02:00
parent b929f1d136
commit 8582f2e6be
42 changed files with 47 additions and 73 deletions

View File

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

View File

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

View File

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

View File

@ -87,7 +87,6 @@ function getConfig(options?: IConfirmationDialogData): InternalConfirmationDialo
templateUrl: './confirmation-dialog.component.html',
styleUrls: ['./confirmation-dialog.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [
MatIconModule,
FormsModule,
@ -98,7 +97,7 @@ function getConfig(options?: IConfirmationDialogData): InternalConfirmationDialo
CircleButtonComponent,
MatDialogModule,
NgClass,
],
]
})
export class ConfirmationDialogComponent implements AfterViewInit {
readonly config = getConfig(inject(MAT_DIALOG_DATA));

View File

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

View File

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

View File

@ -8,6 +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
})
export class FullPageErrorComponent {
protected readonly iconButtonTypes = IconButtonTypes;

View File

@ -37,8 +37,7 @@ const atLeastOneIsExpandable = pipe(
},
},
],
standalone: true,
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,8 +28,7 @@ import { IFilterGroup } from '../models/filter-group.model';
FilterCardComponent,
StopPropagationDirective,
MatMenuContent,
],
standalone: true,
]
})
export class PopupFilterComponent implements OnInit {
@Input() primaryFiltersSlug!: string;

View File

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

View File

@ -13,7 +13,6 @@ import { SimpleFilterOption } from '../models/simple-filter-option';
selector: 'iqser-simple-popup-filter',
templateUrl: './simple-popup-filter.component.html',
styleUrls: ['./simple-popup-filter.component.scss'],
standalone: true,
imports: [
MatMenuModule,
IconButtonComponent,
@ -24,7 +23,7 @@ import { SimpleFilterOption } from '../models/simple-filter-option';
MatCheckbox,
IconButtonComponent,
CircleButtonComponent,
],
]
})
export class SimplePopupFilterComponent<T> {
readonly options = input.required<SimpleFilterOption<T>[]>();

View File

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

View File

@ -10,8 +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'],
standalone: true,
imports: [MatIcon, MatTooltip],
imports: [MatIcon, MatTooltip]
})
export class HelpButtonComponent implements OnInit, OnDestroy {
#helpModeHasBeenActivated = false;

View File

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

View File

@ -11,8 +11,7 @@ import { TranslateModule } from '@ngx-translate/core';
templateUrl: './help-mode.component.html',
styleUrls: ['./help-mode.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [AsyncPipe, TranslateModule, NgIf, CircleButtonComponent],
imports: [AsyncPipe, TranslateModule, NgIf, CircleButtonComponent]
})
export class HelpModeComponent {
readonly circleButtonTypes = CircleButtonTypes;

View File

@ -14,7 +14,6 @@ import { DetailsRadioOption } from './details-radio-option';
selector: 'iqser-details-radio',
templateUrl: './details-radio.component.html',
styleUrls: ['./details-radio.component.scss'],
standalone: true,
providers: [
{
provide: NG_VALUE_ACCESSOR,
@ -37,7 +36,7 @@ import { DetailsRadioOption } from './details-radio-option';
ReactiveFormsModule,
MatTooltipModule,
ReplaceNbspPipe,
],
]
})
export class DetailsRadioComponent<I> extends FormFieldComponent<DetailsRadioOption<I>> {
readonly options = input.required<DetailsRadioOption<I>[]>();

View File

@ -23,7 +23,6 @@ type DynamicInput = number | string | Date;
templateUrl: './dynamic-input.component.html',
styleUrls: ['./dynamic-input.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
providers: [
{
provide: NG_VALUE_ACCESSOR,
@ -36,7 +35,7 @@ type DynamicInput = number | string | Date;
useExisting: DynamicInputComponent,
},
],
imports: [NgClass, FormsModule, MatDatepickerModule, StopPropagationDirective, MatIconModule, MatInputModule],
imports: [NgClass, FormsModule, MatDatepickerModule, StopPropagationDirective, MatIconModule, MatInputModule]
})
export class DynamicInputComponent extends FormFieldComponent<DynamicInput> {
readonly label = input<string>();

View File

@ -8,11 +8,10 @@ import { CircleButtonType, CircleButtonTypes } from '../../buttons/types/circle-
templateUrl: './editable-input.component.html',
styleUrls: ['./editable-input.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [CircleButtonComponent, FormsModule],
host: {
'[class.editing]': '_editing()',
},
}
})
export class EditableInputComponent implements OnChanges {
protected readonly _editing = signal(false);

View File

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

View File

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

View File

@ -23,7 +23,6 @@ import { DisableStopPropagationDirective } from '../../directives';
templateUrl: './page-header.component.html',
styleUrls: ['./page-header.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [
AsyncPipe,
NgTemplateOutlet,
@ -35,7 +34,7 @@ import { DisableStopPropagationDirective } from '../../directives';
InputWithActionComponent,
MatTooltip,
DisableStopPropagationDirective,
],
]
})
export class PageHeaderComponent<T extends IListable> {
readonly searchPositions = SearchPositions;

View File

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

View File

@ -12,8 +12,7 @@ import { Id, IListable } from '../models';
templateUrl: './table-column-name.component.html',
styleUrls: ['./table-column-name.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
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

@ -21,7 +21,7 @@
>
<iqser-table-item
(click)="multiSelect(entity, $event)"
[entity]="entity"
[entity]="$any(entity)"
[selectionEnabled]="selectionEnabled"
></iqser-table-item>
</a>
@ -34,7 +34,7 @@
>
<iqser-table-item
(click)="multiSelect(entity, $event)"
[entity]="entity"
[entity]="$any(entity)"
[selectionEnabled]="selectionEnabled"
></iqser-table-item>
</a>

View File

@ -20,7 +20,6 @@ import { TableItemComponent } from './table-item/table-item.component';
selector: 'iqser-table-content',
templateUrl: './table-content.component.html',
styleUrls: ['./table-content.component.scss'],
standalone: true,
imports: [
CdkVirtualScrollViewport,
AsyncPipe,
@ -31,7 +30,7 @@ import { TableItemComponent } from './table-item/table-item.component';
NgClass,
RouterLink,
TableItemComponent,
],
]
})
export class TableContentComponent<Class extends IListable<PrimaryKey>, PrimaryKey extends Id = Class['id']>
extends AutoUnsubscribe

View File

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

View File

@ -13,7 +13,6 @@ import { TableColumnNameComponent } from '../table-column-name/table-column-name
templateUrl: './table-header.component.html',
styleUrls: ['./table-header.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [
RoundCheckboxComponent,
AsyncPipe,
@ -22,7 +21,7 @@ import { TableColumnNameComponent } from '../table-column-name/table-column-name
IqserFiltersModule,
SyncWidthDirective,
TableColumnNameComponent,
],
]
})
export class TableHeaderComponent<T extends IListable<PrimaryKey>, PrimaryKey extends Id = T['id']> {
readonly listingModes = ListingModes;

View File

@ -28,8 +28,7 @@ const SCROLLBAR_WIDTH = 11;
selector: 'iqser-table [tableColumnConfigs] [itemSize]',
templateUrl: './table.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
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,8 +36,7 @@ interface ColumnHeaderContext {
templateUrl: './column-header.component.html',
styleUrls: ['./column-header.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
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

@ -50,7 +50,6 @@ interface WorkflowContext<T> {
templateUrl: './workflow.component.html',
styleUrls: ['./workflow.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [
TableHeaderComponent,
AsyncPipe,
@ -64,7 +63,7 @@ interface WorkflowContext<T> {
NgTemplateOutlet,
CdkDragPreview,
MatIcon,
],
]
})
export class WorkflowComponent<T extends IListable, K extends string> extends ContextComponent<WorkflowContext<T>> implements OnInit {
@ViewChildren(CdkDropList) private readonly _dropLists!: QueryList<CdkDropList>;

View File

@ -5,6 +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
})
export class FullPageLoadingIndicatorComponent {
constructor(readonly loadingService: LoadingService) {}

View File

@ -10,6 +10,7 @@ import { map } from 'rxjs/operators';
templateUrl: './progress-bar.component.html',
styleUrls: ['./progress-bar.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: false
})
export class ProgressBarComponent implements OnInit {
@Input() config!: ProgressBarConfigModel;

View File

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

View File

@ -7,9 +7,8 @@ import { PaginationSettings } from './pagination-settings';
selector: 'iqser-pagination',
templateUrl: './pagination.component.html',
styleUrls: ['./pagination.component.scss'],
standalone: true,
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [TranslateModule],
imports: [TranslateModule]
})
export class PaginationComponent {
displayedPages: (number | string)[] = [];

View File

@ -18,8 +18,7 @@ import { NgClass } from '@angular/common';
`,
],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [MatIconModule, NgClass],
imports: [MatIconModule, NgClass]
})
export class LogoComponent {
icon = input.required<string>();

View File

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

View File

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

View File

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

View File

@ -15,6 +15,7 @@ import { KeycloakStatusService } from '../services/keycloak-status.service';
templateUrl: './tenant-select.component.html',
styleUrls: ['./tenant-select.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: false
})
export class TenantSelectComponent {
readonly #uiRoot = inject(UI_ROOT);

View File

@ -10,8 +10,7 @@ import { TranslateModule } from '@ngx-translate/core';
// eslint-disable-next-line @angular-eslint/no-host-metadata-property
host: { '[class.iqser-upload-file]': 'true' },
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [DragDropFileUploadDirective, MatIcon, NgIf, TranslateModule],
imports: [DragDropFileUploadDirective, MatIcon, NgIf, TranslateModule]
})
export class UploadFileComponent {
@ViewChild('attachFileInput', { static: true }) attachFileInput!: ElementRef;

View File

@ -1,21 +1,19 @@
import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';
import { toSignal } from '@angular/core/rxjs-interop';
import { MatTooltip } from '@angular/material/tooltip';
import { TranslateService } from '@ngx-translate/core';
import { IqserUser } from '../../iqser-user.model';
import { NamePipe } from '../../name.pipe';
import { IqserUserService } from '../../services/iqser-user.service';
import { NamePipeOptions } from '../../types/name-pipe-options';
import { IIqserUser } from '../../types/user.response';
import { NgIf } from '@angular/common';
import { NamePipe } from '../../name.pipe';
import { MatTooltip } from '@angular/material/tooltip';
import { toSignal } from '@angular/core/rxjs-interop';
@Component({
selector: 'iqser-initials-avatar',
templateUrl: './initials-avatar.component.html',
styleUrls: ['./initials-avatar.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [NgIf, NamePipe, MatTooltip],
imports: [NamePipe, MatTooltip],
})
export class InitialsAvatarComponent<
Interface extends IIqserUser = IIqserUser,
@ -23,9 +21,7 @@ export class InitialsAvatarComponent<
> {
readonly #userService = inject<IqserUserService<Interface, Class>>(IqserUserService);
readonly #translateService = inject(TranslateService);
readonly #isSystemUser = computed(() => this._user()?.id?.toLowerCase() === 'system');
readonly #users = toSignal(this.#userService.all$);
readonly color = input('lightgray');
readonly size = input<'small' | 'large'>('small');
readonly withName = input(false);
@ -35,7 +31,6 @@ export class InitialsAvatarComponent<
readonly showTooltip = input(true);
readonly user = input.required<Class | string>();
readonly showBorderCondition = input<<T extends Class = Class>(user: T) => boolean>(user => user.isSpecial);
readonly _user = computed(() => {
const user = this.user();
if (typeof user === 'string') {
@ -45,6 +40,7 @@ export class InitialsAvatarComponent<
}
return user;
});
readonly #isSystemUser = computed(() => this._user()?.id?.toLowerCase() === 'system');
readonly isCurrentUser = computed(() => this.#userService.currentUser?.id === this._user()?.id);
readonly hasBorder = computed(() => !!this._user() && !this.isCurrentUser() && this.showBorderCondition()(this._user()!));
readonly disabled = computed(() => !!this._user() && !this.#isSystemUser() && !this._user()?.hasAnyRole);

View File

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