@quadrel-enterprise-ui/framework 21.12.1 → 21.12.2-beta.349.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/quadrel-enterprise-ui-framework.mjs +166 -53
- package/fesm2022/quadrel-enterprise-ui-framework.mjs.map +1 -1
- package/package.json +1 -1
- package/src/assets/i18n/de.json +2 -0
- package/src/assets/i18n/en.json +2 -0
- package/src/assets/i18n/fr.json +2 -0
- package/src/assets/i18n/it.json +2 -0
- package/types/quadrel-enterprise-ui-framework.d.ts +132 -53
|
@@ -3,7 +3,7 @@ import { Directive, InjectionToken, inject, ElementRef, HostBinding, Input, View
|
|
|
3
3
|
import { Dialog, DialogRef, DIALOG_DATA, DialogModule } from '@angular/cdk/dialog';
|
|
4
4
|
import { quadrelIcons } from '@quadrel-enterprise-ui/icons';
|
|
5
5
|
export { quadrelIconNames } from '@quadrel-enterprise-ui/icons';
|
|
6
|
-
import { BehaviorSubject, pairwise, fromEvent, combineLatest, concat, map as map$1, Subject, throwError, of, ReplaySubject, merge, isObservable, NEVER, Observable, EMPTY, shareReplay, Subscription, distinctUntilChanged as distinctUntilChanged$1, debounce, timer, switchMap as switchMap$1, asyncScheduler, startWith as startWith$1, filter as filter$1, takeUntil as takeUntil$1, debounceTime as debounceTime$1, firstValueFrom, take as take$1, tap as tap$1, from, delay, defer, queueScheduler, concatMap as concatMap$1, exhaustMap, finalize, forkJoin, delayWhen, combineLatestWith, withLatestFrom as withLatestFrom$1, async } from 'rxjs';
|
|
6
|
+
import { BehaviorSubject, pairwise, fromEvent, combineLatest, concat, map as map$1, Subject, throwError, of, ReplaySubject, merge, isObservable, NEVER, Observable, EMPTY, shareReplay, Subscription, distinctUntilChanged as distinctUntilChanged$1, debounce, timer, switchMap as switchMap$1, asyncScheduler, startWith as startWith$1, filter as filter$1, takeUntil as takeUntil$1, debounceTime as debounceTime$1, firstValueFrom, take as take$1, tap as tap$1, from, delay, defer, throwIfEmpty, EmptyError, queueScheduler, concatMap as concatMap$1, exhaustMap, finalize, forkJoin, delayWhen, combineLatestWith, withLatestFrom as withLatestFrom$1, async } from 'rxjs';
|
|
7
7
|
import { map, startWith, take, debounceTime, takeUntil, filter, catchError, distinctUntilChanged, switchMap, concatMap, skip, throttleTime, tap, auditTime, withLatestFrom, first, observeOn, pairwise as pairwise$1, mergeMap } from 'rxjs/operators';
|
|
8
8
|
import { v4 } from 'uuid';
|
|
9
9
|
import * as i2 from '@ngx-translate/core';
|
|
@@ -5010,10 +5010,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
5010
5010
|
//@ts-nocheck
|
|
5011
5011
|
class QdMockTableEmptyStateComponent {
|
|
5012
5012
|
config;
|
|
5013
|
+
i18ns;
|
|
5014
|
+
testId;
|
|
5013
5015
|
getI18n = jest.fn(() => 'i18n.my.table');
|
|
5014
5016
|
handleClick = jest.fn();
|
|
5015
5017
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdMockTableEmptyStateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
5016
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.17", type: QdMockTableEmptyStateComponent, isStandalone: false, selector: "qd-table-empty-state", inputs: { config: "config" }, host: { classAttribute: "mock-qd-table-empty-state" }, ngImport: i0, template: 'config: {{ config | json }}', isInline: true, dependencies: [{ kind: "pipe", type: i1$1.JsonPipe, name: "json" }] });
|
|
5018
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.17", type: QdMockTableEmptyStateComponent, isStandalone: false, selector: "qd-table-empty-state", inputs: { config: "config", i18ns: "i18ns", testId: ["data-test-id", "testId"] }, host: { classAttribute: "mock-qd-table-empty-state" }, ngImport: i0, template: 'config: {{ config | json }}', isInline: true, dependencies: [{ kind: "pipe", type: i1$1.JsonPipe, name: "json" }] });
|
|
5017
5019
|
}
|
|
5018
5020
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdMockTableEmptyStateComponent, decorators: [{
|
|
5019
5021
|
type: Component,
|
|
@@ -5025,6 +5027,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
5025
5027
|
}]
|
|
5026
5028
|
}], propDecorators: { config: [{
|
|
5027
5029
|
type: Input
|
|
5030
|
+
}], i18ns: [{
|
|
5031
|
+
type: Input
|
|
5032
|
+
}], testId: [{
|
|
5033
|
+
type: Input,
|
|
5034
|
+
args: ['data-test-id']
|
|
5028
5035
|
}] } });
|
|
5029
5036
|
|
|
5030
5037
|
// @ts-strict-ignore
|
|
@@ -26384,7 +26391,7 @@ class QdTableStoreService {
|
|
|
26384
26391
|
recentSecondaryAction$() {
|
|
26385
26392
|
return this.store
|
|
26386
26393
|
.select(this.tableStoreSelectorService.recentSecondaryAction())
|
|
26387
|
-
.pipe(filter(action => action?.rowData !== undefined));
|
|
26394
|
+
.pipe(filter((action) => action?.rowData !== undefined));
|
|
26388
26395
|
}
|
|
26389
26396
|
tableRow$(rowIndex) {
|
|
26390
26397
|
return this.store.select(this.tableStoreSelectorService.tableRow(rowIndex));
|
|
@@ -26978,6 +26985,7 @@ const QD_TABLE_DATA_RESOLVER_TOKEN = new InjectionToken('QD_TABLE_DATA_RESOLVER_
|
|
|
26978
26985
|
* #### Internal invariant
|
|
26979
26986
|
*
|
|
26980
26987
|
* Both streams wait for resolution criteria from the store and only resolve once criteria arrive.
|
|
26988
|
+
* A refresh is dropped while the connectors are not ready yet. The first load runs anyway once they are ready.
|
|
26981
26989
|
* The store yields criteria only while `pageIndex` and `pageSize` are set for this table. A resolver
|
|
26982
26990
|
* result without `size` therefore stores `pageSize: undefined` and silences every later refresh,
|
|
26983
26991
|
* because the stream keeps waiting for criteria that never come again. `handleResolverResult`
|
|
@@ -26989,10 +26997,11 @@ class QdTableResolverService {
|
|
|
26989
26997
|
tableStoreService = inject(QdTableStoreService);
|
|
26990
26998
|
translateService = inject(TranslateService);
|
|
26991
26999
|
actionResultService = inject(QdTableExternalActionResultService);
|
|
26992
|
-
_destroyed$ = new
|
|
27000
|
+
_destroyed$ = new ReplaySubject(1);
|
|
26993
27001
|
_refreshSubscription;
|
|
26994
27002
|
_hasPagination = true;
|
|
26995
27003
|
_isNavigatingToValidPage = false;
|
|
27004
|
+
_latestRequest = 0;
|
|
26996
27005
|
constructor() {
|
|
26997
27006
|
this.subscribeToExternalRefresh();
|
|
26998
27007
|
}
|
|
@@ -27009,7 +27018,7 @@ class QdTableResolverService {
|
|
|
27009
27018
|
this.subscribeToLangChanges();
|
|
27010
27019
|
this.tableStoreService
|
|
27011
27020
|
.selectDataResolutionCriteria$()
|
|
27012
|
-
.pipe(
|
|
27021
|
+
.pipe(distinctUntilChanged(qdIsDeepEqual), filter((resolutionCriteria) => !!resolutionCriteria && this.shouldDataBeResolved(resolutionCriteria)), map(resolutionCriteria => this.buildCriteriaParams(resolutionCriteria)), switchMap$1(resolutionParams => this.resolveAndApply(resolver, resolutionParams)), takeUntil(this._destroyed$))
|
|
27013
27022
|
.subscribe();
|
|
27014
27023
|
}
|
|
27015
27024
|
refresh(resolverOptions = {}) {
|
|
@@ -27020,18 +27029,21 @@ class QdTableResolverService {
|
|
|
27020
27029
|
this._refreshSubscription?.unsubscribe();
|
|
27021
27030
|
this._refreshSubscription = this.tableStoreService
|
|
27022
27031
|
.selectDataResolutionCriteria$()
|
|
27023
|
-
.pipe(filter((criteria) => !!criteria), take$1(1), switchMap$1(resolutionCriteria => this.resolveAndApply(resolver, this.buildRefreshParams(resolutionCriteria, pageIndex))), takeUntil(this._destroyed$))
|
|
27032
|
+
.pipe(filter((criteria) => !!criteria), take$1(1), filter(criteria => !this.isAwaitingConnectors(criteria)), switchMap$1(resolutionCriteria => this.resolveAndApply(resolver, this.buildRefreshParams(resolutionCriteria, pageIndex))), takeUntil(this._destroyed$))
|
|
27024
27033
|
.subscribe();
|
|
27025
27034
|
}
|
|
27026
27035
|
subscribeToLangChanges() {
|
|
27027
27036
|
this.translateService.onLangChange.pipe(takeUntil(this._destroyed$)).subscribe(() => this.refresh());
|
|
27028
27037
|
}
|
|
27029
|
-
shouldDataBeResolved(
|
|
27030
|
-
if (
|
|
27038
|
+
shouldDataBeResolved(criteria) {
|
|
27039
|
+
if (this.isAwaitingConnectors(criteria))
|
|
27031
27040
|
return false;
|
|
27032
27041
|
if (!this._hasPagination)
|
|
27033
27042
|
return true;
|
|
27034
|
-
return tableParams?.size !== undefined && tableParams?.page !== undefined;
|
|
27043
|
+
return criteria.tableParams?.size !== undefined && criteria.tableParams?.page !== undefined;
|
|
27044
|
+
}
|
|
27045
|
+
isAwaitingConnectors({ hasConnectors, connectorsState }) {
|
|
27046
|
+
return !!hasConnectors && connectorsState === QdTableConnectorState.AWAITING;
|
|
27035
27047
|
}
|
|
27036
27048
|
subscribeToExternalRefresh() {
|
|
27037
27049
|
this.actionResultService.actionSuccess$
|
|
@@ -27052,10 +27064,12 @@ class QdTableResolverService {
|
|
|
27052
27064
|
};
|
|
27053
27065
|
}
|
|
27054
27066
|
resolveAndApply(resolver, params) {
|
|
27067
|
+
let request = 0;
|
|
27055
27068
|
return defer(() => {
|
|
27069
|
+
request = ++this._latestRequest;
|
|
27056
27070
|
this.tableStoreService.setRequestState(QdTableRequestState.PENDING);
|
|
27057
27071
|
return resolver.resolve(params);
|
|
27058
|
-
}).pipe(tap(result => this.handleResolverResult(result)), filter(() => !this._isNavigatingToValidPage), tap(() => this.tableStoreService.setRequestState(QdTableRequestState.SUCCESS)), catchError(
|
|
27072
|
+
}).pipe(throwIfEmpty(), tap(result => this.handleResolverResult(result)), filter(() => !this._isNavigatingToValidPage), tap(() => this.tableStoreService.setRequestState(QdTableRequestState.SUCCESS)), catchError(error => error instanceof EmptyError && request !== this._latestRequest ? EMPTY : this.recoverFromFailedRequest()));
|
|
27059
27073
|
}
|
|
27060
27074
|
recoverFromFailedRequest() {
|
|
27061
27075
|
this._isNavigatingToValidPage = false;
|
|
@@ -28030,6 +28044,7 @@ class QdTableRowActionsSecondaryMenuComponent {
|
|
|
28030
28044
|
actionsService = inject(QdTableSecondaryActionsService);
|
|
28031
28045
|
tableStore = inject(QdTableStoreService);
|
|
28032
28046
|
eventBroker = inject(QdEventBrokerService, { optional: true });
|
|
28047
|
+
destroyRef = inject(DestroyRef);
|
|
28033
28048
|
rowIndex;
|
|
28034
28049
|
rowData;
|
|
28035
28050
|
actions;
|
|
@@ -28038,30 +28053,33 @@ class QdTableRowActionsSecondaryMenuComponent {
|
|
|
28038
28053
|
viewonly;
|
|
28039
28054
|
trackRowBy;
|
|
28040
28055
|
_isViewonly = false;
|
|
28056
|
+
_viewModeSubscription;
|
|
28057
|
+
_operationMode$;
|
|
28041
28058
|
_isInitialized = false;
|
|
28042
28059
|
_isEvaluating = false;
|
|
28043
28060
|
_countsByType = new Map();
|
|
28044
28061
|
_resolutions = new Map();
|
|
28045
28062
|
_states$ = new BehaviorSubject(new Map());
|
|
28046
28063
|
_entries$ = new BehaviorSubject([]);
|
|
28047
|
-
_destroy$ = new Subject();
|
|
28048
28064
|
entries$ = this._entries$.asObservable();
|
|
28049
28065
|
ngOnChanges(changes) {
|
|
28050
28066
|
if (changes['rowData'])
|
|
28051
28067
|
this.forgetAll();
|
|
28068
|
+
if (changes['viewonly'] && this._isInitialized)
|
|
28069
|
+
this.followViewMode();
|
|
28052
28070
|
if (changes['rowData'] || changes['actions'])
|
|
28053
28071
|
this.evaluate(true);
|
|
28072
|
+
else if (changes['viewonly'])
|
|
28073
|
+
this.evaluate(false);
|
|
28054
28074
|
else if (changes['i18ns'])
|
|
28055
28075
|
this.publish(this.currentEntries());
|
|
28056
28076
|
}
|
|
28057
28077
|
ngOnInit() {
|
|
28058
|
-
this.
|
|
28078
|
+
this.followViewMode();
|
|
28059
28079
|
this._isInitialized = true;
|
|
28060
28080
|
this.evaluate(true);
|
|
28061
28081
|
}
|
|
28062
28082
|
ngOnDestroy() {
|
|
28063
|
-
this._destroy$.next();
|
|
28064
|
-
this._destroy$.complete();
|
|
28065
28083
|
this.forgetAll();
|
|
28066
28084
|
this._states$.next(new Map());
|
|
28067
28085
|
}
|
|
@@ -28072,18 +28090,21 @@ class QdTableRowActionsSecondaryMenuComponent {
|
|
|
28072
28090
|
this.actionsService.rememberAvailabilityCheck(recentAction, () => this.settledAvailability$(type, recentAction.rowData));
|
|
28073
28091
|
this.tableStore.updateTableStateRecentSecondaryAction(recentAction);
|
|
28074
28092
|
}
|
|
28075
|
-
|
|
28076
|
-
|
|
28077
|
-
|
|
28093
|
+
followViewMode() {
|
|
28094
|
+
this._viewModeSubscription?.unsubscribe();
|
|
28095
|
+
this._isViewonly = this.viewonly ?? false;
|
|
28096
|
+
if (typeof this.viewonly === 'boolean')
|
|
28078
28097
|
return;
|
|
28079
|
-
|
|
28080
|
-
|
|
28081
|
-
|
|
28082
|
-
|
|
28098
|
+
this._operationMode$ ??= this.eventBroker?.consume('operation_mode_changed');
|
|
28099
|
+
let isReplaying = true;
|
|
28100
|
+
this._viewModeSubscription = this._operationMode$
|
|
28101
|
+
?.pipe(takeUntilDestroyed(this.destroyRef))
|
|
28083
28102
|
.subscribe(({ payload }) => {
|
|
28084
28103
|
this._isViewonly = payload.isViewonly;
|
|
28085
|
-
|
|
28104
|
+
if (!isReplaying)
|
|
28105
|
+
this.evaluate(false);
|
|
28086
28106
|
});
|
|
28107
|
+
isReplaying = false;
|
|
28087
28108
|
}
|
|
28088
28109
|
isAvailable(type) {
|
|
28089
28110
|
return this._states$.value.get(type) === 'available';
|
|
@@ -28226,19 +28247,21 @@ class QdTableRowActionsSecondaryMenuComponent {
|
|
|
28226
28247
|
return 'blocked';
|
|
28227
28248
|
}
|
|
28228
28249
|
toMenuEntry(key, type, state) {
|
|
28250
|
+
const text = String(type);
|
|
28229
28251
|
return {
|
|
28230
28252
|
key,
|
|
28231
28253
|
type,
|
|
28232
|
-
i18n: `${this.i18ns}.secondaryActions.${type}
|
|
28254
|
+
i18n: this.i18ns ? `${this.i18ns}.secondaryActions.${type}` : undefined,
|
|
28255
|
+
label: text.charAt(0).toUpperCase() + text.slice(1),
|
|
28233
28256
|
isBlocked: state === 'blocked'
|
|
28234
28257
|
};
|
|
28235
28258
|
}
|
|
28236
28259
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdTableRowActionsSecondaryMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
28237
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: QdTableRowActionsSecondaryMenuComponent, isStandalone: false, selector: "[qd-table-row-actions-secondary-menu]", inputs: { rowIndex: "rowIndex", rowData: "rowData", actions: "actions", i18ns: "i18ns", testId: "testId", viewonly: "viewonly", trackRowBy: "trackRowBy" }, usesOnChanges: true, ngImport: i0, template: "@let entries = entries$ | async; @if (entries && entries.length > 0) {\n<button\n type=\"button\"\n class=\"menu-button\"\n [qdPopoverOnClick]=\"menu\"\n [qdPopoverCloseStrategy]=\"'onEveryClick'\"\n [qdPopoverStopPropagation]=\"true\"\n [qdPopoverMinWidth]=\"160\"\n [attr.data-test-id]=\"testId + '-toggler'\"\n>\n <qd-icon icon=\"overflowMenuHorizontal\"></qd-icon>\n</button>\n}\n<ng-template #menu>\n @for (entry of entries ?? []; track entry.key; let i = $index) {\n <button\n class=\"action-button\"\n type=\"button\"\n [disabled]=\"entry.isBlocked\"\n (click)=\"onActionClick(entry.type)\"\n [attr.data-test-id]=\"testId + '-' + i\"\n >\n {{ entry.i18n | translate }}\n </button>\n }\n</ng-template>\n", styles: [".menu-button{display:flex;padding:.1875rem .625rem 0 .375rem;background:unset;color:#454545;font-size:2rem}.menu-button:hover,.menu-button:focus{color:#000}.action-button{display:block;width:100%;min-height:2rem;padding:0 1rem;background:#fff0;font-size:.75rem;text-align:left}.action-button:hover{background-color:#f2f7fa}\n"], dependencies: [{ kind: "component", type: QdIconComponent, selector: "qd-icon", inputs: ["icon", "status"] }, { kind: "directive", type: QdPopoverOnClickDirective, selector: "[qdPopoverOnClick]", inputs: ["qdPopoverOnClick", "qdPopoverPlacement", "qdPopoverOffsetX", "qdPopoverOffsetY", "qdPopoverCloseStrategy", "qdPopoverDisabled", "qdPopoverStopPropagation", "qdPopoverBackgroundColor", "qdPopoverMaxHeight", "qdPopoverMinWidth", "qdPopoverMaxWidth", "qdPopoverAutoSize", "qdPopoverEnableKeyControl", "qdPopoverRestoreFocus", "qdPopoverFlipIntoViewport"], outputs: ["opened", "closed"], exportAs: ["qdPopoverOnClick"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
28260
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: QdTableRowActionsSecondaryMenuComponent, isStandalone: false, selector: "[qd-table-row-actions-secondary-menu]", inputs: { rowIndex: "rowIndex", rowData: "rowData", actions: "actions", i18ns: "i18ns", testId: "testId", viewonly: "viewonly", trackRowBy: "trackRowBy" }, usesOnChanges: true, ngImport: i0, template: "@let entries = entries$ | async; @if (entries && entries.length > 0) {\n<button\n type=\"button\"\n class=\"menu-button\"\n [qdPopoverOnClick]=\"menu\"\n [qdPopoverCloseStrategy]=\"'onEveryClick'\"\n [qdPopoverStopPropagation]=\"true\"\n [qdPopoverMinWidth]=\"160\"\n [attr.data-test-id]=\"testId + '-toggler'\"\n [attr.aria-label]=\"'i18n.qd.table.a11y.moreActions' | translate\"\n>\n <qd-icon icon=\"overflowMenuHorizontal\"></qd-icon>\n</button>\n}\n<ng-template #menu>\n @for (entry of entries ?? []; track entry.key; let i = $index) {\n <button\n class=\"action-button\"\n type=\"button\"\n [disabled]=\"entry.isBlocked\"\n (click)=\"onActionClick(entry.type)\"\n [attr.data-test-id]=\"testId + '-' + i\"\n >\n {{ entry.i18n ? (entry.i18n | translate) : entry.label }}\n </button>\n }\n</ng-template>\n", styles: [".menu-button{display:flex;padding:.1875rem .625rem 0 .375rem;background:unset;color:#454545;font-size:2rem}.menu-button:hover,.menu-button:focus{color:#000}.action-button{display:block;width:100%;min-height:2rem;padding:0 1rem;background:#fff0;font-size:.75rem;text-align:left}.action-button:hover{background-color:#f2f7fa}.action-button:disabled{cursor:not-allowed}.action-button:disabled:hover{background-color:#fff0}\n"], dependencies: [{ kind: "component", type: QdIconComponent, selector: "qd-icon", inputs: ["icon", "status"] }, { kind: "directive", type: QdPopoverOnClickDirective, selector: "[qdPopoverOnClick]", inputs: ["qdPopoverOnClick", "qdPopoverPlacement", "qdPopoverOffsetX", "qdPopoverOffsetY", "qdPopoverCloseStrategy", "qdPopoverDisabled", "qdPopoverStopPropagation", "qdPopoverBackgroundColor", "qdPopoverMaxHeight", "qdPopoverMinWidth", "qdPopoverMaxWidth", "qdPopoverAutoSize", "qdPopoverEnableKeyControl", "qdPopoverRestoreFocus", "qdPopoverFlipIntoViewport"], outputs: ["opened", "closed"], exportAs: ["qdPopoverOnClick"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
28238
28261
|
}
|
|
28239
28262
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdTableRowActionsSecondaryMenuComponent, decorators: [{
|
|
28240
28263
|
type: Component,
|
|
28241
|
-
args: [{ selector: '[qd-table-row-actions-secondary-menu]', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "@let entries = entries$ | async; @if (entries && entries.length > 0) {\n<button\n type=\"button\"\n class=\"menu-button\"\n [qdPopoverOnClick]=\"menu\"\n [qdPopoverCloseStrategy]=\"'onEveryClick'\"\n [qdPopoverStopPropagation]=\"true\"\n [qdPopoverMinWidth]=\"160\"\n [attr.data-test-id]=\"testId + '-toggler'\"\n>\n <qd-icon icon=\"overflowMenuHorizontal\"></qd-icon>\n</button>\n}\n<ng-template #menu>\n @for (entry of entries ?? []; track entry.key; let i = $index) {\n <button\n class=\"action-button\"\n type=\"button\"\n [disabled]=\"entry.isBlocked\"\n (click)=\"onActionClick(entry.type)\"\n [attr.data-test-id]=\"testId + '-' + i\"\n >\n {{ entry.i18n | translate }}\n </button>\n }\n</ng-template>\n", styles: [".menu-button{display:flex;padding:.1875rem .625rem 0 .375rem;background:unset;color:#454545;font-size:2rem}.menu-button:hover,.menu-button:focus{color:#000}.action-button{display:block;width:100%;min-height:2rem;padding:0 1rem;background:#fff0;font-size:.75rem;text-align:left}.action-button:hover{background-color:#f2f7fa}\n"] }]
|
|
28264
|
+
args: [{ selector: '[qd-table-row-actions-secondary-menu]', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "@let entries = entries$ | async; @if (entries && entries.length > 0) {\n<button\n type=\"button\"\n class=\"menu-button\"\n [qdPopoverOnClick]=\"menu\"\n [qdPopoverCloseStrategy]=\"'onEveryClick'\"\n [qdPopoverStopPropagation]=\"true\"\n [qdPopoverMinWidth]=\"160\"\n [attr.data-test-id]=\"testId + '-toggler'\"\n [attr.aria-label]=\"'i18n.qd.table.a11y.moreActions' | translate\"\n>\n <qd-icon icon=\"overflowMenuHorizontal\"></qd-icon>\n</button>\n}\n<ng-template #menu>\n @for (entry of entries ?? []; track entry.key; let i = $index) {\n <button\n class=\"action-button\"\n type=\"button\"\n [disabled]=\"entry.isBlocked\"\n (click)=\"onActionClick(entry.type)\"\n [attr.data-test-id]=\"testId + '-' + i\"\n >\n {{ entry.i18n ? (entry.i18n | translate) : entry.label }}\n </button>\n }\n</ng-template>\n", styles: [".menu-button{display:flex;padding:.1875rem .625rem 0 .375rem;background:unset;color:#454545;font-size:2rem}.menu-button:hover,.menu-button:focus{color:#000}.action-button{display:block;width:100%;min-height:2rem;padding:0 1rem;background:#fff0;font-size:.75rem;text-align:left}.action-button:hover{background-color:#f2f7fa}.action-button:disabled{cursor:not-allowed}.action-button:disabled:hover{background-color:#fff0}\n"] }]
|
|
28242
28265
|
}], propDecorators: { rowIndex: [{
|
|
28243
28266
|
type: Input,
|
|
28244
28267
|
args: [{ required: true }]
|
|
@@ -28290,11 +28313,11 @@ class QdTableRowSelectionComponent {
|
|
|
28290
28313
|
}
|
|
28291
28314
|
}
|
|
28292
28315
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdTableRowSelectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
28293
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: QdTableRowSelectionComponent, isStandalone: false, selector: "[qd-table-row-selection]", inputs: { rowIndex: "rowIndex", rowData: "rowData", testId: ["data-test-id", "testId"] }, host: { properties: { "attr.data-test-id": "this.dataTestId" } }, ngImport: i0, template: "@switch (selectionType) { @case ('singleSelect') {\n<input\n type=\"radio\"\n [name]=\"'qd-table-selection__' + tableId\"\n [checked]=\"isRowSelected$() | async\"\n (click)=\"stopPropagation($event)\"\n (change)=\"handleChange($event)\"\n [attr.data-test-id]=\"testId + '-radio'\"\n/>\n} @case ('multiSelect') {\n<input\n type=\"checkbox\"\n [name]=\"'qd-table-selection__' + tableId\"\n [checked]=\"isRowSelected$() | async\"\n (click)=\"stopPropagation($event)\"\n (change)=\"handleChange($event)\"\n [attr.data-test-id]=\"testId + '-checkbox'\"\n/>\n} }\n", styles: ["input{cursor:pointer}\n"], dependencies: [{ kind: "pipe", type: i1$1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
28316
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: QdTableRowSelectionComponent, isStandalone: false, selector: "[qd-table-row-selection]", inputs: { rowIndex: "rowIndex", rowData: "rowData", testId: ["data-test-id", "testId"] }, host: { properties: { "attr.data-test-id": "this.dataTestId" } }, ngImport: i0, template: "@switch (selectionType) { @case ('singleSelect') {\n<input\n type=\"radio\"\n [name]=\"'qd-table-selection__' + tableId\"\n [checked]=\"isRowSelected$() | async\"\n (click)=\"stopPropagation($event)\"\n (change)=\"handleChange($event)\"\n [attr.data-test-id]=\"testId + '-radio'\"\n [attr.aria-label]=\"'i18n.qd.table.a11y.selectRow' | translate\"\n/>\n} @case ('multiSelect') {\n<input\n type=\"checkbox\"\n [name]=\"'qd-table-selection__' + tableId\"\n [checked]=\"isRowSelected$() | async\"\n (click)=\"stopPropagation($event)\"\n (change)=\"handleChange($event)\"\n [attr.data-test-id]=\"testId + '-checkbox'\"\n [attr.aria-label]=\"'i18n.qd.table.a11y.selectRow' | translate\"\n/>\n} }\n", styles: ["input{cursor:pointer}\n"], dependencies: [{ kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
28294
28317
|
}
|
|
28295
28318
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdTableRowSelectionComponent, decorators: [{
|
|
28296
28319
|
type: Component,
|
|
28297
|
-
args: [{ selector: '[qd-table-row-selection]', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "@switch (selectionType) { @case ('singleSelect') {\n<input\n type=\"radio\"\n [name]=\"'qd-table-selection__' + tableId\"\n [checked]=\"isRowSelected$() | async\"\n (click)=\"stopPropagation($event)\"\n (change)=\"handleChange($event)\"\n [attr.data-test-id]=\"testId + '-radio'\"\n/>\n} @case ('multiSelect') {\n<input\n type=\"checkbox\"\n [name]=\"'qd-table-selection__' + tableId\"\n [checked]=\"isRowSelected$() | async\"\n (click)=\"stopPropagation($event)\"\n (change)=\"handleChange($event)\"\n [attr.data-test-id]=\"testId + '-checkbox'\"\n/>\n} }\n", styles: ["input{cursor:pointer}\n"] }]
|
|
28320
|
+
args: [{ selector: '[qd-table-row-selection]', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "@switch (selectionType) { @case ('singleSelect') {\n<input\n type=\"radio\"\n [name]=\"'qd-table-selection__' + tableId\"\n [checked]=\"isRowSelected$() | async\"\n (click)=\"stopPropagation($event)\"\n (change)=\"handleChange($event)\"\n [attr.data-test-id]=\"testId + '-radio'\"\n [attr.aria-label]=\"'i18n.qd.table.a11y.selectRow' | translate\"\n/>\n} @case ('multiSelect') {\n<input\n type=\"checkbox\"\n [name]=\"'qd-table-selection__' + tableId\"\n [checked]=\"isRowSelected$() | async\"\n (click)=\"stopPropagation($event)\"\n (change)=\"handleChange($event)\"\n [attr.data-test-id]=\"testId + '-checkbox'\"\n [attr.aria-label]=\"'i18n.qd.table.a11y.selectRow' | translate\"\n/>\n} }\n", styles: ["input{cursor:pointer}\n"] }]
|
|
28298
28321
|
}], propDecorators: { rowIndex: [{
|
|
28299
28322
|
type: Input
|
|
28300
28323
|
}], rowData: [{
|
|
@@ -28410,6 +28433,7 @@ class QdTableBodyComponent {
|
|
|
28410
28433
|
tableStoreService = inject(QdTableStoreService);
|
|
28411
28434
|
resolverService = inject(QdTableResolverService);
|
|
28412
28435
|
cdr = inject(ChangeDetectorRef);
|
|
28436
|
+
destroyRef = inject(DestroyRef);
|
|
28413
28437
|
config;
|
|
28414
28438
|
data;
|
|
28415
28439
|
testId;
|
|
@@ -28443,7 +28467,7 @@ class QdTableBodyComponent {
|
|
|
28443
28467
|
if (result instanceof Observable) {
|
|
28444
28468
|
this._primaryActionRefreshSubscription = result
|
|
28445
28469
|
.pipe(take(1))
|
|
28446
|
-
.subscribe(success => success && this.triggerRefresh());
|
|
28470
|
+
.subscribe(success => success && !this.destroyRef.destroyed && this.triggerRefresh());
|
|
28447
28471
|
return;
|
|
28448
28472
|
}
|
|
28449
28473
|
this.triggerRefresh();
|
|
@@ -28483,6 +28507,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
28483
28507
|
class QdTableEmptyStateComponent {
|
|
28484
28508
|
emptyStateService = inject(QdTableEmptyStateService);
|
|
28485
28509
|
config;
|
|
28510
|
+
i18ns;
|
|
28511
|
+
testId = 'table';
|
|
28512
|
+
get dataTestId() {
|
|
28513
|
+
return this.testId + '-empty-state';
|
|
28514
|
+
}
|
|
28486
28515
|
translationParameter = {};
|
|
28487
28516
|
ngOnInit() {
|
|
28488
28517
|
if (this.config?.i18nParameter)
|
|
@@ -28496,22 +28525,30 @@ class QdTableEmptyStateComponent {
|
|
|
28496
28525
|
}
|
|
28497
28526
|
}
|
|
28498
28527
|
getI18n() {
|
|
28499
|
-
if (!this.
|
|
28528
|
+
if (!this.i18ns)
|
|
28500
28529
|
console.warn('Quadrel Framework | QdTable - No translations available.');
|
|
28501
|
-
return this.
|
|
28530
|
+
return this.i18ns;
|
|
28502
28531
|
}
|
|
28503
28532
|
handleClick() {
|
|
28504
|
-
this.config.handler();
|
|
28533
|
+
this.config.handler?.();
|
|
28505
28534
|
this.emptyStateService.emitAction();
|
|
28506
28535
|
}
|
|
28507
28536
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdTableEmptyStateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
28508
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: QdTableEmptyStateComponent, isStandalone: false, selector: "qd-table-empty-state", inputs: { config: "config" }, usesOnChanges: true, ngImport: i0, template: "<p>{{ getI18n() + \".empty.content\" | translate : translationParameter }}</p>\n@if (config?.action) {\n<button qdButton qdButtonLink icon=\"plusCircle\" color=\"primary\" (click)=\"handleClick()\">\n {{ getI18n() + \".empty.action\" | translate }}\n</button>\n}\n", styles: [":host{display:block;padding:1.5rem;background:#fff}:host p{margin:0 0 .5rem}\n"], dependencies: [{ kind: "component", type: QdButtonComponent, selector: "button[qdButton], a[qdButton]", inputs: ["disabled", "color", "icon", "data-test-id", "additionalInfo"] }, { kind: "directive", type: QdButtonLinkDirective, selector: "button[qdButtonLink], a[qdButtonLink]" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
28537
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: QdTableEmptyStateComponent, isStandalone: false, selector: "qd-table-empty-state", inputs: { config: "config", i18ns: "i18ns", testId: ["data-test-id", "testId"] }, host: { properties: { "attr.data-test-id": "this.dataTestId" } }, usesOnChanges: true, ngImport: i0, template: "<p>{{ getI18n() + \".empty.content\" | translate : translationParameter }}</p>\n@if (config?.action) {\n<button qdButton qdButtonLink icon=\"plusCircle\" color=\"primary\" (click)=\"handleClick()\">\n {{ getI18n() + \".empty.action\" | translate }}\n</button>\n}\n", styles: [":host{display:block;padding:1.5rem;background:#fff}:host p{margin:0 0 .5rem}\n"], dependencies: [{ kind: "component", type: QdButtonComponent, selector: "button[qdButton], a[qdButton]", inputs: ["disabled", "color", "icon", "data-test-id", "additionalInfo"] }, { kind: "directive", type: QdButtonLinkDirective, selector: "button[qdButtonLink], a[qdButtonLink]" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
28509
28538
|
}
|
|
28510
28539
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdTableEmptyStateComponent, decorators: [{
|
|
28511
28540
|
type: Component,
|
|
28512
28541
|
args: [{ selector: 'qd-table-empty-state', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<p>{{ getI18n() + \".empty.content\" | translate : translationParameter }}</p>\n@if (config?.action) {\n<button qdButton qdButtonLink icon=\"plusCircle\" color=\"primary\" (click)=\"handleClick()\">\n {{ getI18n() + \".empty.action\" | translate }}\n</button>\n}\n", styles: [":host{display:block;padding:1.5rem;background:#fff}:host p{margin:0 0 .5rem}\n"] }]
|
|
28513
28542
|
}], propDecorators: { config: [{
|
|
28514
28543
|
type: Input
|
|
28544
|
+
}], i18ns: [{
|
|
28545
|
+
type: Input
|
|
28546
|
+
}], testId: [{
|
|
28547
|
+
type: Input,
|
|
28548
|
+
args: ['data-test-id']
|
|
28549
|
+
}], dataTestId: [{
|
|
28550
|
+
type: HostBinding,
|
|
28551
|
+
args: ['attr.data-test-id']
|
|
28515
28552
|
}] } });
|
|
28516
28553
|
|
|
28517
28554
|
// TODO: Add multi sort feature
|
|
@@ -28823,8 +28860,10 @@ class QdTableComponent {
|
|
|
28823
28860
|
resolverService = inject(QdTableResolverService);
|
|
28824
28861
|
confirmationDialogService = inject(QdConfirmationDialogOpenerService);
|
|
28825
28862
|
sortRouterConnector = inject(QdTableSortRouterConnectorService);
|
|
28863
|
+
destroyRef = inject(DestroyRef);
|
|
28826
28864
|
/**
|
|
28827
28865
|
* Configuration of the table. The generic type specifies the column definition. <br />
|
|
28866
|
+
* Required. Without a config, the table throws an error on init and shows nothing. <br />
|
|
28828
28867
|
*
|
|
28829
28868
|
* **Usage:**
|
|
28830
28869
|
*
|
|
@@ -28873,27 +28912,30 @@ class QdTableComponent {
|
|
|
28873
28912
|
this._data = data;
|
|
28874
28913
|
}
|
|
28875
28914
|
/**
|
|
28876
|
-
*
|
|
28877
|
-
* The value
|
|
28915
|
+
* The root of the test IDs of the table. <br />
|
|
28916
|
+
* The host gets `<value>-<uid>`. Without `uid`, it gets `<value>-` plus a random ID. <br />
|
|
28917
|
+
* Inner elements start with the value, for example `<value>-element` and `<value>-row-0`. <br />
|
|
28918
|
+
* The empty state view gets the test ID `<value>-empty-state`.
|
|
28878
28919
|
*/
|
|
28879
28920
|
testId = 'table';
|
|
28880
28921
|
/**
|
|
28881
|
-
* Emits an event when
|
|
28922
|
+
* Emits an event when a secondary action is triggered. The return value contains the row-specific data. <br />
|
|
28882
28923
|
* `secondaryActions` must be defined in the table configuration.
|
|
28883
28924
|
*
|
|
28884
28925
|
* * @returns EventEmitter with generic type: QdTableRecentSecondaryAction
|
|
28885
28926
|
*/
|
|
28886
28927
|
secondaryActionOutput = new EventEmitter();
|
|
28887
28928
|
/**
|
|
28888
|
-
*
|
|
28929
|
+
* Emits the selected rows whenever the selection changes, also when a row is unselected. <br />
|
|
28930
|
+
* The list is empty when no row is selected. <br />
|
|
28889
28931
|
* `multiSelect` or `singleSelect` must be activated in the table configuration.
|
|
28890
28932
|
*
|
|
28891
28933
|
* * @returns EventEmitter with generic type: QdTableSelectedRows
|
|
28892
28934
|
*/
|
|
28893
28935
|
selectedRowsOutput = new EventEmitter();
|
|
28894
28936
|
/**
|
|
28895
|
-
*
|
|
28896
|
-
*
|
|
28937
|
+
* Emits when the user clicks the call-to-action button of the empty state. <br />
|
|
28938
|
+
* Needs `emptyStateView.action: true` in the table configuration.
|
|
28897
28939
|
*/
|
|
28898
28940
|
emptyStateActionOutput = new EventEmitter();
|
|
28899
28941
|
paginator;
|
|
@@ -28941,7 +28983,7 @@ class QdTableComponent {
|
|
|
28941
28983
|
this.initRefresh();
|
|
28942
28984
|
this.table$ = this.tableStoreService.table$();
|
|
28943
28985
|
this.hasData$ = this.data$.pipe(map(state => (state ?? []).length > 0));
|
|
28944
|
-
this.
|
|
28986
|
+
this.initializeEmptyStateView();
|
|
28945
28987
|
}
|
|
28946
28988
|
ngOnChanges(changes) {
|
|
28947
28989
|
if (changes['data'] &&
|
|
@@ -28955,8 +28997,12 @@ class QdTableComponent {
|
|
|
28955
28997
|
if (changes['config'] &&
|
|
28956
28998
|
!changes['config'].firstChange &&
|
|
28957
28999
|
!qdIsDeepEqual(changes['config'].previousValue, changes['config'].currentValue)) {
|
|
29000
|
+
this.validateSelectionTracking();
|
|
28958
29001
|
this.updateResponsiveRowServiceTableConfig();
|
|
28959
29002
|
this.updateFillingWidthServiceTableConfig();
|
|
29003
|
+
this.updateRowSelectionServiceTableConfig();
|
|
29004
|
+
this.initializeEmptyStateView();
|
|
29005
|
+
this.updateConfigObservables(changes['config'].previousValue);
|
|
28960
29006
|
}
|
|
28961
29007
|
}
|
|
28962
29008
|
ngOnDestroy() {
|
|
@@ -29016,21 +29062,44 @@ class QdTableComponent {
|
|
|
29016
29062
|
this.fillingWidthService.updateTableConfig(this.config);
|
|
29017
29063
|
}
|
|
29018
29064
|
initializeEmptyStateService() {
|
|
29019
|
-
this.emptyStateService.i18ns = this.config.i18ns;
|
|
29020
29065
|
this._emptyStateActionServiceSubscription = this.emptyStateService.emptyStateAction$.subscribe(() => this.emptyStateActionOutput.emit());
|
|
29021
29066
|
}
|
|
29067
|
+
initializeEmptyStateView() {
|
|
29068
|
+
this.hasEmptyStateView$ = this.hasData$.pipe(map(hasData => !hasData && !!this.config.emptyStateView && !this.config.emptyStateView.disabled));
|
|
29069
|
+
}
|
|
29022
29070
|
initializeRowSelectionService() {
|
|
29023
29071
|
this.rowSelectionService.config = this.config;
|
|
29024
29072
|
this._rowSelectionServiceSubscription = this.rowSelectionService.selectedRows$.subscribe(selectedRows => {
|
|
29025
29073
|
this.selectedRowsOutput.emit(selectedRows);
|
|
29026
29074
|
this.config.selection?.handler?.(selectedRows);
|
|
29027
29075
|
});
|
|
29028
|
-
this.
|
|
29076
|
+
this.subscribeToDeselectAll();
|
|
29077
|
+
}
|
|
29078
|
+
updateRowSelectionServiceTableConfig() {
|
|
29079
|
+
this.rowSelectionService.config = this.config;
|
|
29080
|
+
}
|
|
29081
|
+
subscribeToDeselectAll(ignoresReplayedValue = false) {
|
|
29082
|
+
let isSubscribing = ignoresReplayedValue;
|
|
29083
|
+
this._deselectAllSubscription = this.config.selection?.deselectAll$?.subscribe(() => {
|
|
29084
|
+
if (!isSubscribing)
|
|
29085
|
+
this.rowSelectionService.clearAll();
|
|
29086
|
+
});
|
|
29087
|
+
isSubscribing = false;
|
|
29088
|
+
}
|
|
29089
|
+
updateConfigObservables(previousConfig) {
|
|
29090
|
+
if (previousConfig?.refresh !== this.config.refresh) {
|
|
29091
|
+
this._refreshSubscription?.unsubscribe();
|
|
29092
|
+
this.initRefresh(true);
|
|
29093
|
+
}
|
|
29094
|
+
if (previousConfig?.selection?.deselectAll$ !== this.config.selection?.deselectAll$) {
|
|
29095
|
+
this._deselectAllSubscription?.unsubscribe();
|
|
29096
|
+
this.subscribeToDeselectAll(true);
|
|
29097
|
+
}
|
|
29029
29098
|
}
|
|
29030
29099
|
initializeSecondaryActionsService() {
|
|
29031
29100
|
this._recentSecondaryActionsSubscription = this.tableStoreService
|
|
29032
29101
|
.recentSecondaryAction$()
|
|
29033
|
-
.pipe(switchMap(recentAction =>
|
|
29102
|
+
.pipe(switchMap(recentAction => this.whenSecondaryActionAvailable$(recentAction)))
|
|
29034
29103
|
.subscribe(recentAction => {
|
|
29035
29104
|
this.secondaryActionOutput.emit(recentAction);
|
|
29036
29105
|
const action = this.config.secondaryActions?.find(a => a.type === recentAction.type);
|
|
@@ -29095,25 +29164,36 @@ class QdTableComponent {
|
|
|
29095
29164
|
}
|
|
29096
29165
|
processSecondaryActionRefresh(result, refreshConfig) {
|
|
29097
29166
|
if (result instanceof Observable) {
|
|
29098
|
-
result
|
|
29167
|
+
result
|
|
29168
|
+
.pipe(take(1))
|
|
29169
|
+
.subscribe(success => success && !this.destroyRef.destroyed && this.triggerRefresh(refreshConfig.page));
|
|
29099
29170
|
return;
|
|
29100
29171
|
}
|
|
29101
|
-
this.
|
|
29172
|
+
if (!this.destroyRef.destroyed)
|
|
29173
|
+
this.triggerRefresh(refreshConfig.page);
|
|
29102
29174
|
}
|
|
29103
|
-
initRefresh() {
|
|
29104
|
-
|
|
29175
|
+
initRefresh(ignoresReplayedValue = false) {
|
|
29176
|
+
let isSubscribing = ignoresReplayedValue;
|
|
29177
|
+
this._refreshSubscription = this.config.refresh?.subscribe(value => {
|
|
29178
|
+
if (!isSubscribing)
|
|
29179
|
+
this.triggerRefresh(value);
|
|
29180
|
+
});
|
|
29181
|
+
isSubscribing = false;
|
|
29105
29182
|
}
|
|
29106
29183
|
triggerRefresh(pageIndex) {
|
|
29107
29184
|
this.resolverService.refresh(pageIndex !== undefined ? { pageIndex } : {});
|
|
29108
29185
|
}
|
|
29109
29186
|
validateConfig() {
|
|
29110
|
-
if (!this.config.i18ns) {
|
|
29187
|
+
if (!this.config.i18ns && (this.config.secondaryActions?.length || this.hasTranslatedColumn())) {
|
|
29111
29188
|
console.warn('Quadrel Framework | QdTable - No translations available for the secondaryActions.');
|
|
29112
29189
|
}
|
|
29113
29190
|
if (this.hasHighlightOnRevisit() && !this.config.uid) {
|
|
29114
29191
|
console.warn('Quadrel Framework | QdTable - A "uid" has to be defined when "highlightOnRevisit" is enabled. ' +
|
|
29115
29192
|
'Without a uid, the table state does not persist across navigation.');
|
|
29116
29193
|
}
|
|
29194
|
+
this.validateSelectionTracking();
|
|
29195
|
+
}
|
|
29196
|
+
validateSelectionTracking() {
|
|
29117
29197
|
if (this.config.selection?.type === 'multiSelect' && this.hasPagination && !this.config.trackRowBy) {
|
|
29118
29198
|
throw new Error('Quadrel Framework | QdTable - "trackRowBy" is required when combining "selection: multiSelect" with pagination. ' +
|
|
29119
29199
|
'Provide a trackRowBy function (e.g. `trackRowBy: row => row.uid`) that returns a unique identifier ' +
|
|
@@ -29123,6 +29203,9 @@ class QdTableComponent {
|
|
|
29123
29203
|
hasHighlightOnRevisit() {
|
|
29124
29204
|
return (!!this.config.primaryAction?.highlightOnRevisit || !!this.config.secondaryActions?.some(a => a.highlightOnRevisit));
|
|
29125
29205
|
}
|
|
29206
|
+
hasTranslatedColumn() {
|
|
29207
|
+
return this.config.columns.some(column => 'options' in column && !!column.options && 'isTranslated' in column.options && !!column.options.isTranslated);
|
|
29208
|
+
}
|
|
29126
29209
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
29127
29210
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: QdTableComponent, isStandalone: false, selector: "qd-table", inputs: { config: "config", data: "data", testId: ["data-test-id", "testId"] }, outputs: { secondaryActionOutput: "secondaryActionOutput", selectedRowsOutput: "selectedRowsOutput", emptyStateActionOutput: "emptyStateActionOutput" }, host: { properties: { "class.qd-table": "true", "class.main-column-fills-width": "whichColumnFillsWidth === \"main\"", "class.last-column-fills-width": "whichColumnFillsWidth === \"last\"", "class.harmonized": "whichColumnFillsWidth === \"harmonized\"", "attr.data-qd-no-horizontal-padding-small": "true", "attr.data-test-id": "this.dataTestId" } }, providers: [
|
|
29128
29211
|
QdTableStoreService,
|
|
@@ -29137,7 +29220,7 @@ class QdTableComponent {
|
|
|
29137
29220
|
QdTableExternalActionResultService,
|
|
29138
29221
|
QdTableUrlNamespaceService,
|
|
29139
29222
|
QdTableSortRouterConnectorService
|
|
29140
|
-
], viewQueries: [{ propertyName: "paginator", first: true, predicate: QdTablePaginatorComponent, descendants: true }], usesOnChanges: true, ngImport: i0, template: "<table [class]=\"'qd-table__table'\" [attr.data-test-id]=\"testId + '-element'\">\n <tr qd-table-head [config]=\"config\" [data-test-id]=\"testId\"></tr>\n <tbody qd-table-body [config]=\"config\" [data]=\"(data$ | async) ?? []\" [data-test-id]=\"testId\"></tbody>\n</table>\n\n@if (hasPagination) {\n<qd-table-paginator [config]=\"config\" [data-test-id]=\"testId\"></qd-table-paginator>\n} @if (hasEmptyStateView$ | async) {\n<qd-table-empty-state
|
|
29223
|
+
], viewQueries: [{ propertyName: "paginator", first: true, predicate: QdTablePaginatorComponent, descendants: true }], usesOnChanges: true, ngImport: i0, template: "<table [class]=\"'qd-table__table'\" [attr.data-test-id]=\"testId + '-element'\">\n <tr qd-table-head [config]=\"config\" [data-test-id]=\"testId\"></tr>\n <tbody qd-table-body [config]=\"config\" [data]=\"(data$ | async) ?? []\" [data-test-id]=\"testId\"></tbody>\n</table>\n\n@if (hasPagination) {\n<qd-table-paginator [config]=\"config\" [data-test-id]=\"testId\"></qd-table-paginator>\n} @if (hasEmptyStateView$ | async) {\n<qd-table-empty-state\n [config]=\"config.emptyStateView\"\n [i18ns]=\"config.i18ns\"\n [data-test-id]=\"testId\"\n></qd-table-empty-state>\n}\n", styles: [":host{display:inline-flex;flex-direction:column}:host .qd-table__table{background:#fff;border-spacing:0;color:#171717;font-size:.875rem;font-weight:400;line-height:2.5rem}:host .qd-table__head,:host .qd-table__body{vertical-align:center}:host .qd-table__head{background:#e5e5e5;text-align:left}:host .qd-table__head ::ng-deep .qd-table__head-cell{font-weight:600}:host .qd-table__body{color:#171717}:host ::ng-deep .qd-table__head-cell,:host ::ng-deep .qd-table__body-cell{padding:.125rem 1rem 0;vertical-align:top}:host ::ng-deep .qd-table__head-cell--selection,:host ::ng-deep .qd-table__body-cell--selection{width:1.875rem;padding-top:.1875rem;text-align:center}:host ::ng-deep .qd-table__head-cell--actions-inline-menu,:host ::ng-deep .qd-table__body-cell--actions-inline-menu{padding-top:.125rem;vertical-align:top}:host.main-column-fills-width.table-has-remaining-width:not(.table-has-right-aligned-filling-column) ::ng-deep th.main-column,:host.main-column-fills-width.table-has-remaining-width:not(.table-has-right-aligned-filling-column) ::ng-deep td.main-column{width:100%}:host.main-column-fills-width.table-has-remaining-width ::ng-deep th:not(.main-column),:host.main-column-fills-width.table-has-remaining-width ::ng-deep td:not(.main-column){white-space:nowrap}:host.last-column-fills-width.table-has-remaining-width:not(.table-has-right-aligned-filling-column) ::ng-deep th.last-column,:host.last-column-fills-width.table-has-remaining-width:not(.table-has-right-aligned-filling-column) ::ng-deep td.last-column{width:100%}:host.last-column-fills-width.table-has-remaining-width ::ng-deep th:not(.last-column),:host.last-column-fills-width.table-has-remaining-width ::ng-deep td:not(.last-column){white-space:nowrap}:host.harmonized{width:100%}\n"], dependencies: [{ kind: "component", type: QdTableBodyComponent, selector: "[qd-table-body]", inputs: ["config", "data", "data-test-id"] }, { kind: "component", type: QdTableEmptyStateComponent, selector: "qd-table-empty-state", inputs: ["config", "i18ns", "data-test-id"] }, { kind: "component", type: QdTableHeadComponent, selector: "[qd-table-head]", inputs: ["config", "data-test-id"] }, { kind: "component", type: QdTablePaginatorComponent, selector: "qd-table-paginator", inputs: ["config", "data-test-id"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
29141
29224
|
}
|
|
29142
29225
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdTableComponent, decorators: [{
|
|
29143
29226
|
type: Component,
|
|
@@ -29160,7 +29243,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
29160
29243
|
'[class.last-column-fills-width]': 'whichColumnFillsWidth === "last"',
|
|
29161
29244
|
'[class.harmonized]': 'whichColumnFillsWidth === "harmonized"',
|
|
29162
29245
|
'[attr.data-qd-no-horizontal-padding-small]': 'true'
|
|
29163
|
-
}, standalone: false, template: "<table [class]=\"'qd-table__table'\" [attr.data-test-id]=\"testId + '-element'\">\n <tr qd-table-head [config]=\"config\" [data-test-id]=\"testId\"></tr>\n <tbody qd-table-body [config]=\"config\" [data]=\"(data$ | async) ?? []\" [data-test-id]=\"testId\"></tbody>\n</table>\n\n@if (hasPagination) {\n<qd-table-paginator [config]=\"config\" [data-test-id]=\"testId\"></qd-table-paginator>\n} @if (hasEmptyStateView$ | async) {\n<qd-table-empty-state
|
|
29246
|
+
}, standalone: false, template: "<table [class]=\"'qd-table__table'\" [attr.data-test-id]=\"testId + '-element'\">\n <tr qd-table-head [config]=\"config\" [data-test-id]=\"testId\"></tr>\n <tbody qd-table-body [config]=\"config\" [data]=\"(data$ | async) ?? []\" [data-test-id]=\"testId\"></tbody>\n</table>\n\n@if (hasPagination) {\n<qd-table-paginator [config]=\"config\" [data-test-id]=\"testId\"></qd-table-paginator>\n} @if (hasEmptyStateView$ | async) {\n<qd-table-empty-state\n [config]=\"config.emptyStateView\"\n [i18ns]=\"config.i18ns\"\n [data-test-id]=\"testId\"\n></qd-table-empty-state>\n}\n", styles: [":host{display:inline-flex;flex-direction:column}:host .qd-table__table{background:#fff;border-spacing:0;color:#171717;font-size:.875rem;font-weight:400;line-height:2.5rem}:host .qd-table__head,:host .qd-table__body{vertical-align:center}:host .qd-table__head{background:#e5e5e5;text-align:left}:host .qd-table__head ::ng-deep .qd-table__head-cell{font-weight:600}:host .qd-table__body{color:#171717}:host ::ng-deep .qd-table__head-cell,:host ::ng-deep .qd-table__body-cell{padding:.125rem 1rem 0;vertical-align:top}:host ::ng-deep .qd-table__head-cell--selection,:host ::ng-deep .qd-table__body-cell--selection{width:1.875rem;padding-top:.1875rem;text-align:center}:host ::ng-deep .qd-table__head-cell--actions-inline-menu,:host ::ng-deep .qd-table__body-cell--actions-inline-menu{padding-top:.125rem;vertical-align:top}:host.main-column-fills-width.table-has-remaining-width:not(.table-has-right-aligned-filling-column) ::ng-deep th.main-column,:host.main-column-fills-width.table-has-remaining-width:not(.table-has-right-aligned-filling-column) ::ng-deep td.main-column{width:100%}:host.main-column-fills-width.table-has-remaining-width ::ng-deep th:not(.main-column),:host.main-column-fills-width.table-has-remaining-width ::ng-deep td:not(.main-column){white-space:nowrap}:host.last-column-fills-width.table-has-remaining-width:not(.table-has-right-aligned-filling-column) ::ng-deep th.last-column,:host.last-column-fills-width.table-has-remaining-width:not(.table-has-right-aligned-filling-column) ::ng-deep td.last-column{width:100%}:host.last-column-fills-width.table-has-remaining-width ::ng-deep th:not(.last-column),:host.last-column-fills-width.table-has-remaining-width ::ng-deep td:not(.last-column){white-space:nowrap}:host.harmonized{width:100%}\n"] }]
|
|
29164
29247
|
}], propDecorators: { config: [{
|
|
29165
29248
|
type: Input
|
|
29166
29249
|
}], data: [{
|
|
@@ -29290,6 +29373,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
29290
29373
|
* }
|
|
29291
29374
|
* ```
|
|
29292
29375
|
*
|
|
29376
|
+
* The resolver gets `context` on every call. It maps each context id to its selection:
|
|
29377
|
+
* a `QdPageSelectedContext` (`{ value, label }`), or an array of them for a multi context.
|
|
29378
|
+
* It is `{}` before the first selection and after `clear()`.
|
|
29379
|
+
* If the user confirms the dialog with nothing picked, the key stays with `undefined` or `[]`.
|
|
29380
|
+
*
|
|
29293
29381
|
* @parent qd-section {supported}
|
|
29294
29382
|
* description: Put it on the table inside the section that owns the context, so both read the same state.
|
|
29295
29383
|
*/
|
|
@@ -29376,7 +29464,8 @@ class QdConnectorTableFilterDirective {
|
|
|
29376
29464
|
tableComponent = inject(QdTableComponent, { host: true });
|
|
29377
29465
|
toolbarComponentsService = inject(QdToolbarComponentsService);
|
|
29378
29466
|
/**
|
|
29379
|
-
*
|
|
29467
|
+
* Configuration of the filter used to connect to the table. <br />
|
|
29468
|
+
* Here `emitOutputsInitially` is always `true`, so the table loads at once. A `false` value is ignored.
|
|
29380
29469
|
*/
|
|
29381
29470
|
qdConnectToFilter;
|
|
29382
29471
|
filterComponent;
|
|
@@ -29565,7 +29654,8 @@ class QdConnectorTableSearchDirective {
|
|
|
29565
29654
|
tableComponent = inject(QdTableComponent, { host: true });
|
|
29566
29655
|
toolbarComponentsService = inject(QdToolbarComponentsService);
|
|
29567
29656
|
/**
|
|
29568
|
-
*
|
|
29657
|
+
* Configuration of the search used to connect to the table. <br />
|
|
29658
|
+
* Here `emitEmptySearch` defaults to `true`. Set it to `false` to turn it off.
|
|
29569
29659
|
*/
|
|
29570
29660
|
qdConnectToSearch;
|
|
29571
29661
|
searchComponent;
|
|
@@ -36061,6 +36151,7 @@ class QdShellServiceNavigationComponent {
|
|
|
36061
36151
|
_config;
|
|
36062
36152
|
_destroyed$ = new Subject();
|
|
36063
36153
|
_attributesHaveBeenSet$ = new ReplaySubject(1);
|
|
36154
|
+
_qdAuthLogoutUnavailableWarningLogged = false;
|
|
36064
36155
|
localeService = inject(QdLocaleService);
|
|
36065
36156
|
ngOnInit() {
|
|
36066
36157
|
loadJavascriptAsset(this.config?.javascriptAssetPath ?? DEFAULT_JAVASCRIPT_ASSET_PATH, {
|
|
@@ -36111,14 +36202,36 @@ class QdShellServiceNavigationComponent {
|
|
|
36111
36202
|
this.authenticationService?.pamsStatus.next($event);
|
|
36112
36203
|
}
|
|
36113
36204
|
handleLogoutTriggered($event) {
|
|
36114
|
-
|
|
36205
|
+
const logoutUrl = typeof $event === 'string' ? $event : $event?.detail;
|
|
36206
|
+
if (this.config?.logoutHandler) {
|
|
36207
|
+
this.config.logoutHandler(logoutUrl);
|
|
36208
|
+
return;
|
|
36209
|
+
}
|
|
36210
|
+
if (this.shouldUseQdAuthLogout(this.config))
|
|
36211
|
+
this.authenticationService.logoutAndContinueTo(logoutUrl);
|
|
36115
36212
|
}
|
|
36116
36213
|
passConfig(config) {
|
|
36117
36214
|
if (!this.serviceNavigation)
|
|
36118
36215
|
return;
|
|
36119
|
-
this.serviceNavigationService.config = config
|
|
36216
|
+
this.serviceNavigationService.config = this.shouldUseQdAuthLogout(config)
|
|
36217
|
+
? { ...config, handleLogout: false }
|
|
36218
|
+
: config;
|
|
36120
36219
|
this.setAttributesForServiceNavigation();
|
|
36121
36220
|
}
|
|
36221
|
+
shouldUseQdAuthLogout(config) {
|
|
36222
|
+
if (!config?.useQdAuthLogout || config.logoutHandler)
|
|
36223
|
+
return false;
|
|
36224
|
+
if (typeof this.authenticationService?.logoutAndContinueTo === 'function')
|
|
36225
|
+
return true;
|
|
36226
|
+
this.logQdAuthLogoutUnavailableWarning();
|
|
36227
|
+
return false;
|
|
36228
|
+
}
|
|
36229
|
+
logQdAuthLogoutUnavailableWarning() {
|
|
36230
|
+
if (this._qdAuthLogoutUnavailableWarningLogged)
|
|
36231
|
+
return;
|
|
36232
|
+
this._qdAuthLogoutUnavailableWarningLogged = true;
|
|
36233
|
+
console.warn('Quadrel Framework | QdShell - Config key "useQdAuthLogout" requires QD Auth with "logoutAndContinueTo" support. The logout is handled by the service navigation only.');
|
|
36234
|
+
}
|
|
36122
36235
|
setAttributesForServiceNavigation() {
|
|
36123
36236
|
this.serviceNavigationService
|
|
36124
36237
|
.getMappedAttributes$()
|