diff --git a/.eslintrc.js b/.eslintrc.js index ce21309..b5dd005 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -6,7 +6,7 @@ module.exports = { globals: { NodeJS: true, }, - ignorePatterns: ['!**/*'], + ignorePatterns: ['!**/*', 'jest.config.ts'], overrides: [ { files: ['*.ts'], diff --git a/src/lib/dialog/confirmation-dialog/confirmation-dialog.component.html b/src/lib/dialog/confirmation-dialog/confirmation-dialog.component.html index 1123f7e..6a1ff38 100644 --- a/src/lib/dialog/confirmation-dialog/confirmation-dialog.component.html +++ b/src/lib/dialog/confirmation-dialog/confirmation-dialog.component.html @@ -1,30 +1,38 @@
-
-
- - - -
+ @if (showToast && config.toastMessage) { +
+
+ + + +
+ }

-

+ @if (config.details) { +

+ } -
- - -
+ @if (config.requireInput) { +
+ + +
+ } -
- - - {{ checkbox.label | translate: config.translateParams }} - - - -
+ @if (config.checkboxes.length > 0) { +
+ @for (checkbox of config.checkboxes; track checkbox) { + + {{ checkbox.label | translate: config.translateParams }} + + + } +
+ }
@@ -36,21 +44,26 @@ buttonId="confirm" > - + @if (config.alternativeConfirmationText) { + + } -
- {{ config.discardChangesText }} -
+ @if (config.discardChangesText) { +
+ {{ config.discardChangesText }} +
+ } -
- {{ config.denyText }} -
+ @if (!config.discardChangesText) { +
+ {{ config.denyText }} +
+ }
diff --git a/src/lib/dialog/confirmation-dialog/confirmation-dialog.component.ts b/src/lib/dialog/confirmation-dialog/confirmation-dialog.component.ts index 8cc9279..456347f 100644 --- a/src/lib/dialog/confirmation-dialog/confirmation-dialog.component.ts +++ b/src/lib/dialog/confirmation-dialog/confirmation-dialog.component.ts @@ -1,4 +1,4 @@ -import { NgForOf, NgIf, NgTemplateOutlet } from '@angular/common'; +import { NgTemplateOutlet } from '@angular/common'; import { ChangeDetectionStrategy, Component, HostListener, inject, TemplateRef } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { MatCheckboxModule } from '@angular/material/checkbox'; @@ -72,10 +72,8 @@ function getConfig(options?: IConfirmationDialogData): InternalConfirmationDialo changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [ - NgIf, MatIconModule, FormsModule, - NgForOf, MatCheckboxModule, TranslateModule, NgTemplateOutlet, diff --git a/src/lib/empty-state/empty-state.component.html b/src/lib/empty-state/empty-state.component.html index 3bb9aa4..b5bef39 100644 --- a/src/lib/empty-state/empty-state.component.html +++ b/src/lib/empty-state/empty-state.component.html @@ -6,7 +6,9 @@ }" class="empty-state" > - + @if (icon) { + + }
@@ -14,13 +16,14 @@
- + @if (showButton) { + + }
diff --git a/src/lib/empty-state/empty-state.component.ts b/src/lib/empty-state/empty-state.component.ts index f6c7c59..92bc0e3 100644 --- a/src/lib/empty-state/empty-state.component.ts +++ b/src/lib/empty-state/empty-state.component.ts @@ -1,7 +1,7 @@ import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { IconButtonComponent, IconButtonTypes } from '../buttons'; import { randomString } from '../utils'; -import { NgIf, NgStyle } from '@angular/common'; +import { NgStyle } from '@angular/common'; import { MatIconModule } from '@angular/material/icon'; @Component({ @@ -10,7 +10,7 @@ import { MatIconModule } from '@angular/material/icon'; styleUrls: ['./empty-state.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, - imports: [NgStyle, MatIconModule, NgIf, IconButtonComponent], + imports: [NgStyle, MatIconModule, IconButtonComponent], }) export class EmptyStateComponent implements OnInit { readonly iconButtonTypes = IconButtonTypes; diff --git a/src/lib/error/connection-status/connection-status.component.html b/src/lib/error/connection-status/connection-status.component.html index 45b1490..93e83aa 100644 --- a/src/lib/error/connection-status/connection-status.component.html +++ b/src/lib/error/connection-status/connection-status.component.html @@ -1,8 +1,5 @@ -
- -
+@if (errorService.connectionStatus$ | async; as status) { +
+ +
+} diff --git a/src/lib/error/full-page-error/full-page-error.component.html b/src/lib/error/full-page-error/full-page-error.component.html index eb9b099..cf35e6b 100644 --- a/src/lib/error/full-page-error/full-page-error.component.html +++ b/src/lib/error/full-page-error/full-page-error.component.html @@ -1,13 +1,11 @@ - +@if (errorService.error$ | async; as error) {
-
-
- -
{{ error.message }}
- + @if (error.message) { +
{{ error.message }}
+ }
-
+} diff --git a/src/lib/filtering/filter-card/filter-card.component.html b/src/lib/filtering/filter-card/filter-card.component.html index a29dcd4..127487e 100644 --- a/src/lib/filtering/filter-card/filter-card.component.html +++ b/src/lib/filtering/filter-card/filter-card.component.html @@ -1,43 +1,47 @@ - -
- -
- - - -
- -
- -
-
-
+@if (primaryFilterGroup$ | async; as primaryGroup) { + @if (primaryGroup.filterceptionPlaceholder) { +
+
- - -
- + } + + @if (primaryFilters$ | async; as filters) { +
+ @for (filter of filters; track filter) { + + } +
+ } + @if (secondaryFilterGroup$ | async; as secondaryGroup) { +
+
+
+
+ @for (filter of secondaryGroup.filters; track filter) { + + } +
+ } +} {{ filter?.label }} @@ -45,30 +49,46 @@ -
-
-
-
-
+ @if (primaryFilterGroup$ | async; as primaryGroup) { +
+
+
+ @if (!primaryGroup.singleSelect) { +
+ } +
+
-
+ }
-
- - -
+ @if (filter.children?.length > 0) { +
+ @if (filter.expanded) { + + } + @if (!filter.expanded) { + + } +
+ } -
 
+ @if (atLeastOneIsExpandable && filter.children?.length === 0) { +
 
+ }
-
-
- - - - - + @if (filter.children?.length && filter.expanded) { +
+ @for (child of filter.children; track child) { +
+ + + + +
+ }
-
+ } diff --git a/src/lib/filtering/popup-filter/popup-filter.component.html b/src/lib/filtering/popup-filter/popup-filter.component.html index 85ddf2c..98b134f 100644 --- a/src/lib/filtering/popup-filter/popup-filter.component.html +++ b/src/lib/filtering/popup-filter/popup-filter.component.html @@ -1,5 +1,5 @@ - - +@if (primaryFilterGroup$ | async; as primaryGroup) { + @if (primaryGroup.icon) { - - - + } + @if (!primaryGroup.icon) { - - + }
- +} diff --git a/src/lib/filtering/quick-filters/quick-filters.component.html b/src/lib/filtering/quick-filters/quick-filters.component.html index 0352a69..1aee58d 100644 --- a/src/lib/filtering/quick-filters/quick-filters.component.html +++ b/src/lib/filtering/quick-filters/quick-filters.component.html @@ -1,12 +1,13 @@ - -
- {{ filter.label }} -
-
+@if (quickFilters$ | async; as filters) { + @for (filter of filters; track filter) { +
+ {{ filter.label }} +
+ } +} diff --git a/src/lib/filtering/simple-popup-filter/simple-popup-filter.component.html b/src/lib/filtering/simple-popup-filter/simple-popup-filter.component.html index 726d322..6cfc7cd 100644 --- a/src/lib/filtering/simple-popup-filter/simple-popup-filter.component.html +++ b/src/lib/filtering/simple-popup-filter/simple-popup-filter.component.html @@ -1,48 +1,51 @@ - +@if (type() === 'text' && icon()) { + +} - +@if (type() === 'text' && !icon()) { + +} - +@if (type() === 'icon') { + +}
-
+
@@ -50,11 +53,13 @@
-
- - {{ option.label }} - -
+ @for (option of displayedOptions(); track option) { +
+ + {{ option.label }} + +
+ }
diff --git a/src/lib/filtering/simple-popup-filter/simple-popup-filter.component.ts b/src/lib/filtering/simple-popup-filter/simple-popup-filter.component.ts index 5f85505..47fa481 100644 --- a/src/lib/filtering/simple-popup-filter/simple-popup-filter.component.ts +++ b/src/lib/filtering/simple-popup-filter/simple-popup-filter.component.ts @@ -1,6 +1,6 @@ import { Component, computed, effect, input, output, signal, untracked } from '@angular/core'; import { MatMenuModule } from '@angular/material/menu'; -import { CommonModule } from '@angular/common'; + import { TranslateModule } from '@ngx-translate/core'; import { MatCheckbox } from '@angular/material/checkbox'; import { ChevronButtonComponent, CircleButtonComponent, IconButtonComponent } from '../../buttons'; @@ -14,7 +14,6 @@ import { SimpleFilterOption } from '../models/simple-filter-option'; styleUrls: ['./simple-popup-filter.component.scss'], standalone: true, imports: [ - CommonModule, MatMenuModule, IconButtonComponent, ChevronButtonComponent, diff --git a/src/lib/help-mode/help-mode/help-mode.component.html b/src/lib/help-mode/help-mode/help-mode.component.html index f14bc48..f9d996c 100644 --- a/src/lib/help-mode/help-mode/help-mode.component.html +++ b/src/lib/help-mode/help-mode/help-mode.component.html @@ -1,19 +1,23 @@ -
-
-
- {{ 'help-mode.bottom-text' | translate }} - - {{ 'help-mode.instructions' | translate }} - -
- (esc) - +@if (helpModeService.isHelpModeActive$ | async) { +
+
+
+ {{ 'help-mode.bottom-text' | translate }} + @if ((helpModeService.helpModeDialogIsOpened$ | async) === false) { + + {{ 'help-mode.instructions' | translate }} + + } +
+ (esc) + +
-
+} diff --git a/src/lib/inputs/details-radio/details-radio.component.html b/src/lib/inputs/details-radio/details-radio.component.html index c39a5c1..4a61fbd 100644 --- a/src/lib/inputs/details-radio/details-radio.component.html +++ b/src/lib/inputs/details-radio/details-radio.component.html @@ -1,50 +1,52 @@
-
-
- - -
- - {{ option.description | translate: option.descriptionParams | replaceNbsp }} - -
- - {{ option.extraOption.label | translate }} - - + @for (option of options; track option) { +
+ @if (option.icon) { +
+ +
+ + {{ option.description | translate: option.descriptionParams | replaceNbsp }} + @if (option.extraOption && !option.extraOption.hidden && isSelected(option)) { +
+ + {{ option.extraOption.label | translate }} + + @if (option.extraOption.description) { + + } +
+ } +
+ @if (isSelected(option)) { + + }
-
- - + } @else { +
+ + +
+ {{ option.description | translate }} + }
- - -
- - -
- - {{ option.description | translate }} -
-
+ }
diff --git a/src/lib/inputs/details-radio/details-radio.component.ts b/src/lib/inputs/details-radio/details-radio.component.ts index adff6b6..8d0f087 100644 --- a/src/lib/inputs/details-radio/details-radio.component.ts +++ b/src/lib/inputs/details-radio/details-radio.component.ts @@ -1,4 +1,4 @@ -import { NgClass, NgForOf, NgIf } from '@angular/common'; +import { NgClass } from '@angular/common'; import { booleanAttribute, Component, EventEmitter, Input, Output } from '@angular/core'; import { FormsModule, NG_VALIDATORS, NG_VALUE_ACCESSOR, ReactiveFormsModule } from '@angular/forms'; import { MatCheckboxModule } from '@angular/material/checkbox'; @@ -28,12 +28,10 @@ import { DetailsRadioOption } from './details-radio-option'; }, ], imports: [ - NgForOf, NgClass, RoundCheckboxComponent, TranslateModule, MatIconModule, - NgIf, FormsModule, MatCheckboxModule, ReactiveFormsModule, diff --git a/src/lib/inputs/dynamic-input/dynamic-input.component.html b/src/lib/inputs/dynamic-input/dynamic-input.component.html index 6f53cb6..f655490 100644 --- a/src/lib/inputs/dynamic-input/dynamic-input.component.html +++ b/src/lib/inputs/dynamic-input/dynamic-input.component.html @@ -1,7 +1,9 @@
- + @if (label) { + + } - + @if (isDate) { - + } - + @if (isText) { + + } - + @if (isNumber) { + + }
diff --git a/src/lib/inputs/dynamic-input/dynamic-input.component.ts b/src/lib/inputs/dynamic-input/dynamic-input.component.ts index c4fd2c3..8a8a645 100644 --- a/src/lib/inputs/dynamic-input/dynamic-input.component.ts +++ b/src/lib/inputs/dynamic-input/dynamic-input.component.ts @@ -1,7 +1,7 @@ import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core'; import { FormsModule, NG_VALIDATORS, NG_VALUE_ACCESSOR } from '@angular/forms'; import { FormFieldComponent } from '../form-field/form-field-component.directive'; -import { NgClass, NgIf } from '@angular/common'; +import { NgClass } from '@angular/common'; import { MatDatepickerModule } from '@angular/material/datepicker'; import { StopPropagationDirective } from '../../directives'; import { MatIconModule } from '@angular/material/icon'; @@ -36,7 +36,7 @@ type DynamicInput = number | string | Date; useExisting: DynamicInputComponent, }, ], - imports: [NgClass, NgIf, FormsModule, MatDatepickerModule, StopPropagationDirective, MatIconModule, MatInputModule], + imports: [NgClass, FormsModule, MatDatepickerModule, StopPropagationDirective, MatIconModule, MatInputModule], }) export class DynamicInputComponent extends FormFieldComponent { @Input() label?: string; diff --git a/src/lib/inputs/editable-input/editable-input.component.html b/src/lib/inputs/editable-input/editable-input.component.html index 22945ee..581d1d3 100644 --- a/src/lib/inputs/editable-input/editable-input.component.html +++ b/src/lib/inputs/editable-input/editable-input.component.html @@ -1,34 +1,30 @@ - -
- {{ value }} -
- +@if (!editing) { + @if (showPreview) { +
+ {{ value }} +
+ }
- - + @if (canEdit) { + + }
-
+} - +@if (editing) {
- - + @if (!parentId) { + + } @else { - + }
-
-
-
+} diff --git a/src/lib/inputs/editable-input/editable-input.component.ts b/src/lib/inputs/editable-input/editable-input.component.ts index fbc24f2..942e2d2 100644 --- a/src/lib/inputs/editable-input/editable-input.component.ts +++ b/src/lib/inputs/editable-input/editable-input.component.ts @@ -1,4 +1,3 @@ -import { NgIf } from '@angular/common'; import { ChangeDetectionStrategy, Component, EventEmitter, HostBinding, Input, OnChanges, Output, SimpleChanges } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { CircleButtonComponent, CircleButtonType, CircleButtonTypes } from '../../buttons'; @@ -9,7 +8,7 @@ import { CircleButtonComponent, CircleButtonType, CircleButtonTypes } from '../. styleUrls: ['./editable-input.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, - imports: [NgIf, CircleButtonComponent, FormsModule], + imports: [CircleButtonComponent, FormsModule], }) export class EditableInputComponent implements OnChanges { @Input() id?: string; diff --git a/src/lib/inputs/input-with-action/input-with-action.component.html b/src/lib/inputs/input-with-action/input-with-action.component.html index ac3e561..f574a68 100644 --- a/src/lib/inputs/input-with-action/input-with-action.component.html +++ b/src/lib/inputs/input-with-action/input-with-action.component.html @@ -11,22 +11,24 @@ type="text" /> - {{ hint }} + @if (hint) { + {{ hint }} + } - + @if (isSearch && !hasContent) { + + } - + @if (isSearch && hasContent) { + + } - + @if (!isSearch) { + + } diff --git a/src/lib/inputs/input-with-action/input-with-action.component.ts b/src/lib/inputs/input-with-action/input-with-action.component.ts index 810ca83..5e8d67f 100644 --- a/src/lib/inputs/input-with-action/input-with-action.component.ts +++ b/src/lib/inputs/input-with-action/input-with-action.component.ts @@ -1,7 +1,7 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core'; import { randomString } from '../../utils'; import { FormsModule } from '@angular/forms'; -import { NgIf } from '@angular/common'; + import { CircleButtonComponent } from '../../buttons'; import { MatIconModule } from '@angular/material/icon'; @@ -11,7 +11,7 @@ import { MatIconModule } from '@angular/material/icon'; styleUrls: ['./input-with-action.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, - imports: [FormsModule, NgIf, MatIconModule, CircleButtonComponent], + imports: [FormsModule, MatIconModule, CircleButtonComponent], }) export class InputWithActionComponent { @Input() inputId = `${randomString() + '-search-input'}`; diff --git a/src/lib/inputs/round-checkbox/round-checkbox.component.html b/src/lib/inputs/round-checkbox/round-checkbox.component.html index 39efd44..1d9ff37 100644 --- a/src/lib/inputs/round-checkbox/round-checkbox.component.html +++ b/src/lib/inputs/round-checkbox/round-checkbox.component.html @@ -6,6 +6,10 @@ [class.with-bg]="type === 'with-bg'" class="wrapper" > - - + @if (active && !indeterminate) { + + } + @if (indeterminate) { + + }
diff --git a/src/lib/inputs/round-checkbox/round-checkbox.component.ts b/src/lib/inputs/round-checkbox/round-checkbox.component.ts index f3dc96c..c54dab1 100644 --- a/src/lib/inputs/round-checkbox/round-checkbox.component.ts +++ b/src/lib/inputs/round-checkbox/round-checkbox.component.ts @@ -1,6 +1,5 @@ import { booleanAttribute, ChangeDetectionStrategy, Component, ElementRef, HostBinding, Input, OnInit, ViewChild } from '@angular/core'; import { MatIconModule } from '@angular/material/icon'; -import { NgIf } from '@angular/common'; @Component({ selector: 'iqser-round-checkbox', @@ -8,7 +7,7 @@ import { NgIf } from '@angular/common'; styleUrls: ['./round-checkbox.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, - imports: [MatIconModule, NgIf], + imports: [MatIconModule], }) export class RoundCheckboxComponent implements OnInit { @Input() size = 20; diff --git a/src/lib/listing/page-header/page-header.component.html b/src/lib/listing/page-header/page-header.component.html index aff6a0b..b34ceb4 100644 --- a/src/lib/listing/page-header/page-header.component.html +++ b/src/lib/listing/page-header/page-header.component.html @@ -1,94 +1,98 @@ diff --git a/src/lib/listing/table-content/table-item/table-item.component.html b/src/lib/listing/table-content/table-item/table-item.component.html index 62a632b..8107390 100644 --- a/src/lib/listing/table-content/table-item/table-item.component.html +++ b/src/lib/listing/table-content/table-item/table-item.component.html @@ -1,6 +1,8 @@ -
- -
+@if (selectionEnabled) { +
+ +
+} diff --git a/src/lib/listing/table-header/table-header.component.html b/src/lib/listing/table-header/table-header.component.html index 3ca9bd8..ca13ae0 100644 --- a/src/lib/listing/table-header/table-header.component.html +++ b/src/lib/listing/table-header/table-header.component.html @@ -1,50 +1,56 @@
- + @if (selectionEnabled) { + + } {{ tableHeaderLabel | translate: { length: totalSize || (listingService.displayedLength$ | async) } }} - - ({{ 'table-header.selected-count' | translate: { count: selectedItems } }}) - + @if (listingService.selectedLength$ | async; as selectedItems) { + ({{ 'table-header.selected-count' | translate: { count: selectedItems } }}) + }
- + @if (quickFilters$ | async) { + + }
-
-
- - - -
- -
-
+@if (listingMode === listingModes.table) { +
+ @if (selectionEnabled) { +
+ } + @for (config of tableColumnConfigs; track config) { + + } + @if (hasEmptyColumn) { +
+ } +
+
+} diff --git a/src/lib/listing/table/table.component.html b/src/lib/listing/table/table.component.html index 8c77d8b..6327b1a 100644 --- a/src/lib/listing/table/table.component.html +++ b/src/lib/listing/table/table.component.html @@ -1,42 +1,46 @@ - +@if (entitiesService.noData$ | async) { + +} - +@if (listingComponent.noMatch$ | async) { + +} - +@if (hasScrollButton && tableContent?.scrollViewport) { + +} diff --git a/src/lib/listing/workflow/column-header/column-header.component.html b/src/lib/listing/workflow/column-header/column-header.component.html index 85af253..ca89188 100644 --- a/src/lib/listing/workflow/column-header/column-header.component.html +++ b/src/lib/listing/workflow/column-header/column-header.component.html @@ -1,43 +1,46 @@ - - +@if (componentContext$ | async; as ctx) { + @if (ctx.entities; as entities) {
{{ column.label | translate }} ({{ entities.length || 0 }}) - -
- - -
+ @if (!activeSelection && !selectionColumn && entities.length > 1) { + + } + @if (activeSelection) { +
+ + +
+ }
-
-
- - - + @if (activeSelection) { +
+
+ + +
+
+ @if (bulkActionsContainerWidth) { + + } +
+
- -
- -
- - -
- - + } + } +} diff --git a/src/lib/listing/workflow/workflow.component.html b/src/lib/listing/workflow/workflow.component.html index 203f3b0..c43ee82 100644 --- a/src/lib/listing/workflow/workflow.component.html +++ b/src/lib/listing/workflow/workflow.component.html @@ -1,69 +1,78 @@ - +@if (componentContext$ | async; as ctx) { - - - -
-
- -
+ @if (ctx.noData) { + + } + @if (!ctx.noData) { +
+ @for (column of config.columns; track column) {
- - - - - -
-
- - - -
- -
-
-
+ + @if (column.entities | async; as entities) { +
+ @for (entity of entities; track trackBy($index, entity)) { +
+ @if (!ctx.draggingEntities.includes(entity)) { + + } + + @for (e of ctx.draggingEntities; track e) { +
+ } +
+ + @for (e of ctx.draggingEntities; track e) { +
+ +
+ } +
+
+ } + @if (column.key === addElementColumn) { +
+ +
+ } +
+ }
- -
- -
-
+ }
-
- + } +} diff --git a/src/lib/loading/full-page-loading-indicator/full-page-loading-indicator.component.html b/src/lib/loading/full-page-loading-indicator/full-page-loading-indicator.component.html index b451ba8..cf1bbfb 100644 --- a/src/lib/loading/full-page-loading-indicator/full-page-loading-indicator.component.html +++ b/src/lib/loading/full-page-loading-indicator/full-page-loading-indicator.component.html @@ -1,12 +1,12 @@ - +@if (loadingService.isLoading(); as config) {
- - - + @if (config.type === 'spinner') { + + } + @if (config.type === 'progress-bar') { - - + }
-
+} diff --git a/src/lib/loading/progress-bar/progress-bar.component.ts b/src/lib/loading/progress-bar/progress-bar.component.ts index 6192d9b..f3b6ccc 100644 --- a/src/lib/loading/progress-bar/progress-bar.component.ts +++ b/src/lib/loading/progress-bar/progress-bar.component.ts @@ -1,4 +1,4 @@ -import { ChangeDetectionStrategy, Component, Input, Optional } from '@angular/core'; +import { ChangeDetectionStrategy, Component, Input, Optional, OnInit } from '@angular/core'; import { ProgressBarConfigModel } from './progress-bar-config.model'; import { FilterService, INestedFilter } from '../../filtering'; import { Observable, of } from 'rxjs'; @@ -11,7 +11,7 @@ import { map } from 'rxjs/operators'; styleUrls: ['./progress-bar.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, }) -export class ProgressBarComponent { +export class ProgressBarComponent implements OnInit { @Input() config!: ProgressBarConfigModel; @Input() filterKey?: string; diff --git a/src/lib/loading/progress-loading/progress-loading.component.html b/src/lib/loading/progress-loading/progress-loading.component.html index 158c70c..289ac9d 100644 --- a/src/lib/loading/progress-loading/progress-loading.component.html +++ b/src/lib/loading/progress-loading/progress-loading.component.html @@ -1,4 +1,6 @@ -

{{ config.title }}

+@if (config.title) { +

{{ config.title }}

+}
- {{ config.value }}% + @if (config.value) { + {{ config.value }}% + } - - + @if (config.value && config.remainingTime) { + - + } - {{ config.remainingTime }} remaining... + @if (config.remainingTime) { + {{ config.remainingTime }} remaining... + }
diff --git a/src/lib/pagination/pagination.component.html b/src/lib/pagination/pagination.component.html index 1012cbb..7e7d022 100644 --- a/src/lib/pagination/pagination.component.html +++ b/src/lib/pagination/pagination.component.html @@ -1,26 +1,27 @@
| -
- {{ displayValue(page) }} -
+@for (page of displayedPages; track page) { +
+ {{ displayValue(page) }} +
+} |
diff --git a/src/lib/pagination/pagination.component.ts b/src/lib/pagination/pagination.component.ts index d4a4288..1fe81dd 100644 --- a/src/lib/pagination/pagination.component.ts +++ b/src/lib/pagination/pagination.component.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core'; -import { NgForOf } from '@angular/common'; + import { TranslateModule } from '@ngx-translate/core'; import { PaginationSettings } from './pagination-settings'; @@ -9,7 +9,7 @@ import { PaginationSettings } from './pagination-settings'; styleUrls: ['./pagination.component.scss'], standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, - imports: [NgForOf, TranslateModule], + imports: [TranslateModule], }) export class PaginationComponent { displayedPages: (number | string)[] = []; diff --git a/src/lib/permissions/README.md b/src/lib/permissions/README.md index 40bd849..b8527ef 100644 --- a/src/lib/permissions/README.md +++ b/src/lib/permissions/README.md @@ -1,24 +1,23 @@ ```typescript -import { Component, OnInit } from "@angular/core"; -import { HttpClient } from "@angular/common/http"; -import { IqserPermissionsService } from "./permissions.service"; -import { IqserRolesService } from "./roles.service"; +import { Component, OnInit } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { IqserPermissionsService } from './permissions.service'; +import { IqserRolesService } from './roles.service'; @Component({ - templateUrl: "./app.component.html" + templateUrl: './app.component.html', }) export class AppComponent implements OnInit { constructor( private permissionsService: IqserPermissionsService, - private rolesService: IqserRolesService - ) { - } + private rolesService: IqserRolesService, + ) {} ngOnInit(): void { - const perm = ["can-edit-articles", "can-read-articles"]; + const perm = ['can-edit-articles', 'can-read-articles']; this.permissionsService.load(perm); - const roles = ["ADMIN", "EDITOR"]; + const roles = ['ADMIN', 'EDITOR']; this.rolesService.load(roles); } } @@ -82,21 +81,21 @@ export class AppComponent implements OnInit { ``` ```typescript -import { IqserRoute } from "./models/permissions-router-data.model"; -import { IqserPermissionsGuard } from "./permissions-guard.service"; +import { IqserRoute } from './models/permissions-router-data.model'; +import { IqserPermissionsGuard } from './permissions-guard.service'; const appRoutes: IqserRoute[] = [ { - path: "home", + path: 'home', component: HomeComponent, canActivate: [IqserPermissionsGuard], data: { permissions: { - allow: ["ADMIN", "MODERATOR"], - redirectTo: "/another-route" - } - } - } + allow: ['ADMIN', 'MODERATOR'], + redirectTo: '/another-route', + }, + }, + }, ]; const appRoutes1: IqserRoute[] = [ @@ -108,73 +107,73 @@ const appRoutes1: IqserRoute[] = [ permissions: { allow: (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => { if (route.params['id'] === 42) { - return ['MANAGER', "UTILS"] + return ['MANAGER', 'UTILS']; } else { - return 'ADMIN' + return 'ADMIN'; } - } - } - } - } + }, + }, + }, + }, ]; const appRoutes2: IqserRoute[] = [ { - path: "home", + path: 'home', component: HomeComponent, canActivate: [IqserPermissionsGuard], data: { permissions: { - allow: ["ADMIN", "MODERATOR"], + allow: ['ADMIN', 'MODERATOR'], redirectTo: { - navigationCommands: ["123"], + navigationCommands: ['123'], navigationExtras: { - skipLocationChange: true - } - } - } + skipLocationChange: true, + }, + }, + }, }, - } + }, ]; const appRoutes3: IqserRoute[] = [ { - path: "home", + path: 'home', component: HomeComponent, canActivate: [IqserPermissionsGuard], data: { permissions: { - allow: ["canReadAgenda", "canEditAgenda"], + allow: ['canReadAgenda', 'canEditAgenda'], redirectTo: { - canReadAgenda: "agendaList", - canEditAgenda: "dashboard", - default: "login" - } - } - } - } + canReadAgenda: 'agendaList', + canEditAgenda: 'dashboard', + default: 'login', + }, + }, + }, + }, ]; const appRoutes4: IqserRoute[] = [ { - path: "home", + path: 'home', component: HomeComponent, canActivate: [IqserPermissionsGuard], data: { permissions: { - allow: ["canEditAgenda"], + allow: ['canEditAgenda'], redirectTo: { canEditAgenda: { - navigationCommands: "dashboard", + navigationCommands: 'dashboard', navigationExtras: { - skipLocationChange: true - } + skipLocationChange: true, + }, }, - default: "login" - } - } - } - } + default: 'login', + }, + }, + }, + }, ]; const appRoutes5: IqserRoute[] = [ @@ -186,22 +185,29 @@ const appRoutes5: IqserRoute[] = [ permissions: { allow: ['canReadAgenda', 'canEditAgenda'], redirectTo: { - canReadAgenda: (rejectedPermissionName: string, activateRouteSnapshot: ActivatedRouteSnapshot, routeStateSnapshot: RouterStateSnapshot) => { + canReadAgenda: ( + rejectedPermissionName: string, + activateRouteSnapshot: ActivatedRouteSnapshot, + routeStateSnapshot: RouterStateSnapshot, + ) => { return 'dashboard'; }, - canEditAgenda: (rejectedPermissionName: string, activateRouteSnapshot: ActivatedRouteSnapshot, routeStateSnapshot: RouterStateSnapshot) => { + canEditAgenda: ( + rejectedPermissionName: string, + activateRouteSnapshot: ActivatedRouteSnapshot, + routeStateSnapshot: RouterStateSnapshot, + ) => { return { navigationCommands: ['/dashboard'], navigationExtras: { - skipLocationChange: true - } - } + skipLocationChange: true, + }, + }; }, - default: 'login' - } - } - } + default: 'login', + }, + }, + }, }, ]; - ``` diff --git a/src/lib/permissions/directives/deny.directive.spec.ts b/src/lib/permissions/directives/deny.directive.spec.ts index 46c3ce5..4ece03f 100644 --- a/src/lib/permissions/directives/deny.directive.spec.ts +++ b/src/lib/permissions/directives/deny.directive.spec.ts @@ -291,7 +291,7 @@ describe('Permission directive angular testing different async functions in role })); it('should hide the component when one returns falsy value', fakeAsync(() => { - let content = getFixtureContent(); + const content = getFixtureContent(); expect(content).toBeTruthy(); expect(content.innerHTML).toEqual('
123
'); diff --git a/src/lib/shared/skeleton/skeleton.component.html b/src/lib/shared/skeleton/skeleton.component.html index a07bbfc..e927ba3 100644 --- a/src/lib/shared/skeleton/skeleton.component.html +++ b/src/lib/shared/skeleton/skeleton.component.html @@ -1,3 +1,3 @@ - +@if (type$ | async; as type) { - +} diff --git a/src/lib/shared/skeleton/skeleton.component.ts b/src/lib/shared/skeleton/skeleton.component.ts index b9b74f4..f6d3629 100644 --- a/src/lib/shared/skeleton/skeleton.component.ts +++ b/src/lib/shared/skeleton/skeleton.component.ts @@ -1,7 +1,7 @@ import { ChangeDetectionStrategy, Component, HostBinding, inject, Input, TemplateRef } from '@angular/core'; import { SkeletonService } from '../../services'; import { IqserUserService } from '../../users'; -import { AsyncPipe, NgForOf, NgIf, NgTemplateOutlet } from '@angular/common'; +import { AsyncPipe, NgTemplateOutlet } from '@angular/common'; import { tap } from 'rxjs/operators'; @Component({ @@ -10,7 +10,7 @@ import { tap } from 'rxjs/operators'; styleUrls: ['./skeleton.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, - imports: [NgTemplateOutlet, NgIf, AsyncPipe, NgForOf], + imports: [NgTemplateOutlet, AsyncPipe], }) export class SkeletonComponent { @Input() templates!: Record>; diff --git a/src/lib/shared/status-bar/status-bar.component.html b/src/lib/shared/status-bar/status-bar.component.html index 2234a81..5132689 100644 --- a/src/lib/shared/status-bar/status-bar.component.html +++ b/src/lib/shared/status-bar/status-bar.component.html @@ -1,14 +1,17 @@
-
-
- -
- {{ config.label }} + @for (config of configs; track config) { +
+
+ @if (config.label) { +
+ {{ config.label }} +
+ }
-
+ }
diff --git a/src/lib/shared/status-bar/status-bar.component.ts b/src/lib/shared/status-bar/status-bar.component.ts index 00885a7..58f1071 100644 --- a/src/lib/shared/status-bar/status-bar.component.ts +++ b/src/lib/shared/status-bar/status-bar.component.ts @@ -1,6 +1,6 @@ import { ChangeDetectionStrategy, Component, Input, ViewEncapsulation } from '@angular/core'; import { StatusBarConfig } from './status-bar-config.model'; -import { NgClass, NgForOf, NgIf, NgStyle } from '@angular/common'; +import { NgClass, NgStyle } from '@angular/common'; import { MatTooltipModule } from '@angular/material/tooltip'; @Component({ @@ -10,7 +10,7 @@ import { MatTooltipModule } from '@angular/material/tooltip'; encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, - imports: [NgClass, NgStyle, NgForOf, MatTooltipModule, NgIf], + imports: [NgClass, NgStyle, MatTooltipModule], }) export class StatusBarComponent { @Input() configs: readonly StatusBarConfig[] = []; diff --git a/src/lib/shared/toast/toast.component.html b/src/lib/shared/toast/toast.component.html index 5da85b2..419f55f 100644 --- a/src/lib/shared/toast/toast.component.html +++ b/src/lib/shared/toast/toast.component.html @@ -1,23 +1,35 @@
-
- {{ title }} -
+ @if (title) { +
+ {{ title }} +
+ } -
+ @if (message && options.enableHtml) { +
+ } -
- {{ message }} -
+ @if (message && !options.enableHtml) { +
+ {{ message }} +
+ } - + @if (actions?.length) { +
+ @for (action of actions; track action) { + + {{ action.title }} + + } +
+ }
- - - + @if (options.closeButton) { + + + + }
diff --git a/src/lib/shared/toast/toast.component.ts b/src/lib/shared/toast/toast.component.ts index 3b2f6a7..596aa29 100644 --- a/src/lib/shared/toast/toast.component.ts +++ b/src/lib/shared/toast/toast.component.ts @@ -2,14 +2,14 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; import { Toast } from 'ngx-toastr'; import { ToasterActions, ToasterOptions } from '../../services'; import { MatIconModule } from '@angular/material/icon'; -import { NgForOf, NgIf } from '@angular/common'; + import { StopPropagationDirective } from '../../directives'; @Component({ templateUrl: './toast.component.html', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, - imports: [MatIconModule, NgIf, StopPropagationDirective, NgForOf], + imports: [MatIconModule, StopPropagationDirective], }) export class ToastComponent extends Toast { get actions(): ToasterActions[] { diff --git a/src/lib/tenants/tenant-select/tenant-select.component.html b/src/lib/tenants/tenant-select/tenant-select.component.html index 6a7c697..b1c5ff9 100644 --- a/src/lib/tenants/tenant-select/tenant-select.component.html +++ b/src/lib/tenants/tenant-select/tenant-select.component.html @@ -8,38 +8,40 @@ - + @if (isLoggedOut || noRoleLogOut) {
-
+ } -
+ @if (storedTenants.length) { +
+ } -
-
- - -
- {{ stored.tenantId }} -
- - -
- -
+ @if (storedTenants.length) { +
+ @for (stored of storedTenants; track stored) { +
+ +
+ {{ stored.tenantId }} +
+ +
+ +
+
+ }
-
+ } -
+ @if (storedTenants.length === 0) { +
+ } - + @if (storedTenants.length) {
-
+ }
diff --git a/src/lib/upload-file/upload-file.component.html b/src/lib/upload-file/upload-file.component.html index ae52c17..30278b5 100644 --- a/src/lib/upload-file/upload-file.component.html +++ b/src/lib/upload-file/upload-file.component.html @@ -1,22 +1,25 @@ -
- - -
-
-
- - -

{{ file.name }}

- - -
+@if (!file) { +
+ +
+
+} +@if (file) { +
+ +

{{ file.name }}

+ @if (!readonly) { + + } +
+} diff --git a/src/lib/users/components/initials-avatar/initials-avatar.component.html b/src/lib/users/components/initials-avatar/initials-avatar.component.html index 75bf3ae..46eadd3 100644 --- a/src/lib/users/components/initials-avatar/initials-avatar.component.html +++ b/src/lib/users/components/initials-avatar/initials-avatar.component.html @@ -1,13 +1,16 @@ -
-
- {{ _user | name: { showInitials: true } }} +@if (_user && _user | name: namePipeOptions; as userName) { +
+
+ {{ _user | name: { showInitials: true } }} +
+ @if (withName) { +
+ {{ userName }} +
+ }
- -
- {{ userName }} -
-
+} diff --git a/src/lib/users/components/user-button/user-button.component.html b/src/lib/users/components/user-button/user-button.component.html index 694c628..8d4e57b 100644 --- a/src/lib/users/components/user-button/user-button.component.html +++ b/src/lib/users/components/user-button/user-button.component.html @@ -1,14 +1,18 @@ -
- - - - +@if (showDot) { +
+} diff --git a/tsconfig.spec.json b/tsconfig.spec.json index 423b1f2..dd570e4 100644 --- a/tsconfig.spec.json +++ b/tsconfig.spec.json @@ -5,5 +5,5 @@ "types": ["jest", "node"], "esModuleInterop": true }, - "include": ["./src/lib/**/*.spec.ts", "./src/lib/**/*.d.ts"] + "include": ["./src/lib/**/*.spec.ts", "./src/lib/**/*.d.ts", "jest.config.ts"] }