@quadrel-enterprise-ui/framework 21.12.0 → 21.12.2
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 +145 -54
- 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 +114 -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
|
|
@@ -12619,9 +12626,10 @@ class QdInputComponent {
|
|
|
12619
12626
|
return this.control.getMaxLengthOrUndefined();
|
|
12620
12627
|
}
|
|
12621
12628
|
get valueAsList() {
|
|
12622
|
-
const
|
|
12623
|
-
|
|
12624
|
-
|
|
12629
|
+
const value = this._value.value;
|
|
12630
|
+
if (value == null || value === '')
|
|
12631
|
+
return [null];
|
|
12632
|
+
const displayValue = this.inputType === 'number' ? this.numberInputService.formatNumberForViewonly(value) : value;
|
|
12625
12633
|
return [`${displayValue}${this._value.unit ? ' ' + this.getUnitLabel(this._value.unit) : ''}`];
|
|
12626
12634
|
}
|
|
12627
12635
|
ngOnInit() {
|
|
@@ -26383,7 +26391,7 @@ class QdTableStoreService {
|
|
|
26383
26391
|
recentSecondaryAction$() {
|
|
26384
26392
|
return this.store
|
|
26385
26393
|
.select(this.tableStoreSelectorService.recentSecondaryAction())
|
|
26386
|
-
.pipe(filter(action => action?.rowData !== undefined));
|
|
26394
|
+
.pipe(filter((action) => action?.rowData !== undefined));
|
|
26387
26395
|
}
|
|
26388
26396
|
tableRow$(rowIndex) {
|
|
26389
26397
|
return this.store.select(this.tableStoreSelectorService.tableRow(rowIndex));
|
|
@@ -26977,6 +26985,7 @@ const QD_TABLE_DATA_RESOLVER_TOKEN = new InjectionToken('QD_TABLE_DATA_RESOLVER_
|
|
|
26977
26985
|
* #### Internal invariant
|
|
26978
26986
|
*
|
|
26979
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.
|
|
26980
26989
|
* The store yields criteria only while `pageIndex` and `pageSize` are set for this table. A resolver
|
|
26981
26990
|
* result without `size` therefore stores `pageSize: undefined` and silences every later refresh,
|
|
26982
26991
|
* because the stream keeps waiting for criteria that never come again. `handleResolverResult`
|
|
@@ -26988,10 +26997,11 @@ class QdTableResolverService {
|
|
|
26988
26997
|
tableStoreService = inject(QdTableStoreService);
|
|
26989
26998
|
translateService = inject(TranslateService);
|
|
26990
26999
|
actionResultService = inject(QdTableExternalActionResultService);
|
|
26991
|
-
_destroyed$ = new
|
|
27000
|
+
_destroyed$ = new ReplaySubject(1);
|
|
26992
27001
|
_refreshSubscription;
|
|
26993
27002
|
_hasPagination = true;
|
|
26994
27003
|
_isNavigatingToValidPage = false;
|
|
27004
|
+
_latestRequest = 0;
|
|
26995
27005
|
constructor() {
|
|
26996
27006
|
this.subscribeToExternalRefresh();
|
|
26997
27007
|
}
|
|
@@ -27008,7 +27018,7 @@ class QdTableResolverService {
|
|
|
27008
27018
|
this.subscribeToLangChanges();
|
|
27009
27019
|
this.tableStoreService
|
|
27010
27020
|
.selectDataResolutionCriteria$()
|
|
27011
|
-
.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$))
|
|
27012
27022
|
.subscribe();
|
|
27013
27023
|
}
|
|
27014
27024
|
refresh(resolverOptions = {}) {
|
|
@@ -27019,18 +27029,21 @@ class QdTableResolverService {
|
|
|
27019
27029
|
this._refreshSubscription?.unsubscribe();
|
|
27020
27030
|
this._refreshSubscription = this.tableStoreService
|
|
27021
27031
|
.selectDataResolutionCriteria$()
|
|
27022
|
-
.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$))
|
|
27023
27033
|
.subscribe();
|
|
27024
27034
|
}
|
|
27025
27035
|
subscribeToLangChanges() {
|
|
27026
27036
|
this.translateService.onLangChange.pipe(takeUntil(this._destroyed$)).subscribe(() => this.refresh());
|
|
27027
27037
|
}
|
|
27028
|
-
shouldDataBeResolved(
|
|
27029
|
-
if (
|
|
27038
|
+
shouldDataBeResolved(criteria) {
|
|
27039
|
+
if (this.isAwaitingConnectors(criteria))
|
|
27030
27040
|
return false;
|
|
27031
27041
|
if (!this._hasPagination)
|
|
27032
27042
|
return true;
|
|
27033
|
-
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;
|
|
27034
27047
|
}
|
|
27035
27048
|
subscribeToExternalRefresh() {
|
|
27036
27049
|
this.actionResultService.actionSuccess$
|
|
@@ -27051,10 +27064,12 @@ class QdTableResolverService {
|
|
|
27051
27064
|
};
|
|
27052
27065
|
}
|
|
27053
27066
|
resolveAndApply(resolver, params) {
|
|
27067
|
+
let request = 0;
|
|
27054
27068
|
return defer(() => {
|
|
27069
|
+
request = ++this._latestRequest;
|
|
27055
27070
|
this.tableStoreService.setRequestState(QdTableRequestState.PENDING);
|
|
27056
27071
|
return resolver.resolve(params);
|
|
27057
|
-
}).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()));
|
|
27058
27073
|
}
|
|
27059
27074
|
recoverFromFailedRequest() {
|
|
27060
27075
|
this._isNavigatingToValidPage = false;
|
|
@@ -28029,6 +28044,7 @@ class QdTableRowActionsSecondaryMenuComponent {
|
|
|
28029
28044
|
actionsService = inject(QdTableSecondaryActionsService);
|
|
28030
28045
|
tableStore = inject(QdTableStoreService);
|
|
28031
28046
|
eventBroker = inject(QdEventBrokerService, { optional: true });
|
|
28047
|
+
destroyRef = inject(DestroyRef);
|
|
28032
28048
|
rowIndex;
|
|
28033
28049
|
rowData;
|
|
28034
28050
|
actions;
|
|
@@ -28037,30 +28053,33 @@ class QdTableRowActionsSecondaryMenuComponent {
|
|
|
28037
28053
|
viewonly;
|
|
28038
28054
|
trackRowBy;
|
|
28039
28055
|
_isViewonly = false;
|
|
28056
|
+
_viewModeSubscription;
|
|
28057
|
+
_operationMode$;
|
|
28040
28058
|
_isInitialized = false;
|
|
28041
28059
|
_isEvaluating = false;
|
|
28042
28060
|
_countsByType = new Map();
|
|
28043
28061
|
_resolutions = new Map();
|
|
28044
28062
|
_states$ = new BehaviorSubject(new Map());
|
|
28045
28063
|
_entries$ = new BehaviorSubject([]);
|
|
28046
|
-
_destroy$ = new Subject();
|
|
28047
28064
|
entries$ = this._entries$.asObservable();
|
|
28048
28065
|
ngOnChanges(changes) {
|
|
28049
28066
|
if (changes['rowData'])
|
|
28050
28067
|
this.forgetAll();
|
|
28068
|
+
if (changes['viewonly'] && this._isInitialized)
|
|
28069
|
+
this.followViewMode();
|
|
28051
28070
|
if (changes['rowData'] || changes['actions'])
|
|
28052
28071
|
this.evaluate(true);
|
|
28072
|
+
else if (changes['viewonly'])
|
|
28073
|
+
this.evaluate(false);
|
|
28053
28074
|
else if (changes['i18ns'])
|
|
28054
28075
|
this.publish(this.currentEntries());
|
|
28055
28076
|
}
|
|
28056
28077
|
ngOnInit() {
|
|
28057
|
-
this.
|
|
28078
|
+
this.followViewMode();
|
|
28058
28079
|
this._isInitialized = true;
|
|
28059
28080
|
this.evaluate(true);
|
|
28060
28081
|
}
|
|
28061
28082
|
ngOnDestroy() {
|
|
28062
|
-
this._destroy$.next();
|
|
28063
|
-
this._destroy$.complete();
|
|
28064
28083
|
this.forgetAll();
|
|
28065
28084
|
this._states$.next(new Map());
|
|
28066
28085
|
}
|
|
@@ -28071,18 +28090,21 @@ class QdTableRowActionsSecondaryMenuComponent {
|
|
|
28071
28090
|
this.actionsService.rememberAvailabilityCheck(recentAction, () => this.settledAvailability$(type, recentAction.rowData));
|
|
28072
28091
|
this.tableStore.updateTableStateRecentSecondaryAction(recentAction);
|
|
28073
28092
|
}
|
|
28074
|
-
|
|
28075
|
-
|
|
28076
|
-
|
|
28093
|
+
followViewMode() {
|
|
28094
|
+
this._viewModeSubscription?.unsubscribe();
|
|
28095
|
+
this._isViewonly = this.viewonly ?? false;
|
|
28096
|
+
if (typeof this.viewonly === 'boolean')
|
|
28077
28097
|
return;
|
|
28078
|
-
|
|
28079
|
-
|
|
28080
|
-
|
|
28081
|
-
|
|
28098
|
+
this._operationMode$ ??= this.eventBroker?.consume('operation_mode_changed');
|
|
28099
|
+
let isReplaying = true;
|
|
28100
|
+
this._viewModeSubscription = this._operationMode$
|
|
28101
|
+
?.pipe(takeUntilDestroyed(this.destroyRef))
|
|
28082
28102
|
.subscribe(({ payload }) => {
|
|
28083
28103
|
this._isViewonly = payload.isViewonly;
|
|
28084
|
-
|
|
28104
|
+
if (!isReplaying)
|
|
28105
|
+
this.evaluate(false);
|
|
28085
28106
|
});
|
|
28107
|
+
isReplaying = false;
|
|
28086
28108
|
}
|
|
28087
28109
|
isAvailable(type) {
|
|
28088
28110
|
return this._states$.value.get(type) === 'available';
|
|
@@ -28225,19 +28247,21 @@ class QdTableRowActionsSecondaryMenuComponent {
|
|
|
28225
28247
|
return 'blocked';
|
|
28226
28248
|
}
|
|
28227
28249
|
toMenuEntry(key, type, state) {
|
|
28250
|
+
const text = String(type);
|
|
28228
28251
|
return {
|
|
28229
28252
|
key,
|
|
28230
28253
|
type,
|
|
28231
|
-
i18n: `${this.i18ns}.secondaryActions.${type}
|
|
28254
|
+
i18n: this.i18ns ? `${this.i18ns}.secondaryActions.${type}` : undefined,
|
|
28255
|
+
label: text.charAt(0).toUpperCase() + text.slice(1),
|
|
28232
28256
|
isBlocked: state === 'blocked'
|
|
28233
28257
|
};
|
|
28234
28258
|
}
|
|
28235
28259
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdTableRowActionsSecondaryMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
28236
|
-
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 });
|
|
28237
28261
|
}
|
|
28238
28262
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdTableRowActionsSecondaryMenuComponent, decorators: [{
|
|
28239
28263
|
type: Component,
|
|
28240
|
-
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"] }]
|
|
28241
28265
|
}], propDecorators: { rowIndex: [{
|
|
28242
28266
|
type: Input,
|
|
28243
28267
|
args: [{ required: true }]
|
|
@@ -28289,11 +28313,11 @@ class QdTableRowSelectionComponent {
|
|
|
28289
28313
|
}
|
|
28290
28314
|
}
|
|
28291
28315
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdTableRowSelectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
28292
|
-
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 });
|
|
28293
28317
|
}
|
|
28294
28318
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdTableRowSelectionComponent, decorators: [{
|
|
28295
28319
|
type: Component,
|
|
28296
|
-
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"] }]
|
|
28297
28321
|
}], propDecorators: { rowIndex: [{
|
|
28298
28322
|
type: Input
|
|
28299
28323
|
}], rowData: [{
|
|
@@ -28409,6 +28433,7 @@ class QdTableBodyComponent {
|
|
|
28409
28433
|
tableStoreService = inject(QdTableStoreService);
|
|
28410
28434
|
resolverService = inject(QdTableResolverService);
|
|
28411
28435
|
cdr = inject(ChangeDetectorRef);
|
|
28436
|
+
destroyRef = inject(DestroyRef);
|
|
28412
28437
|
config;
|
|
28413
28438
|
data;
|
|
28414
28439
|
testId;
|
|
@@ -28442,7 +28467,7 @@ class QdTableBodyComponent {
|
|
|
28442
28467
|
if (result instanceof Observable) {
|
|
28443
28468
|
this._primaryActionRefreshSubscription = result
|
|
28444
28469
|
.pipe(take(1))
|
|
28445
|
-
.subscribe(success => success && this.triggerRefresh());
|
|
28470
|
+
.subscribe(success => success && !this.destroyRef.destroyed && this.triggerRefresh());
|
|
28446
28471
|
return;
|
|
28447
28472
|
}
|
|
28448
28473
|
this.triggerRefresh();
|
|
@@ -28482,6 +28507,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
28482
28507
|
class QdTableEmptyStateComponent {
|
|
28483
28508
|
emptyStateService = inject(QdTableEmptyStateService);
|
|
28484
28509
|
config;
|
|
28510
|
+
i18ns;
|
|
28511
|
+
testId = 'table';
|
|
28512
|
+
get dataTestId() {
|
|
28513
|
+
return this.testId + '-empty-state';
|
|
28514
|
+
}
|
|
28485
28515
|
translationParameter = {};
|
|
28486
28516
|
ngOnInit() {
|
|
28487
28517
|
if (this.config?.i18nParameter)
|
|
@@ -28495,22 +28525,30 @@ class QdTableEmptyStateComponent {
|
|
|
28495
28525
|
}
|
|
28496
28526
|
}
|
|
28497
28527
|
getI18n() {
|
|
28498
|
-
if (!this.
|
|
28528
|
+
if (!this.i18ns)
|
|
28499
28529
|
console.warn('Quadrel Framework | QdTable - No translations available.');
|
|
28500
|
-
return this.
|
|
28530
|
+
return this.i18ns;
|
|
28501
28531
|
}
|
|
28502
28532
|
handleClick() {
|
|
28503
|
-
this.config.handler();
|
|
28533
|
+
this.config.handler?.();
|
|
28504
28534
|
this.emptyStateService.emitAction();
|
|
28505
28535
|
}
|
|
28506
28536
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdTableEmptyStateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
28507
|
-
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 });
|
|
28508
28538
|
}
|
|
28509
28539
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdTableEmptyStateComponent, decorators: [{
|
|
28510
28540
|
type: Component,
|
|
28511
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"] }]
|
|
28512
28542
|
}], propDecorators: { config: [{
|
|
28513
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']
|
|
28514
28552
|
}] } });
|
|
28515
28553
|
|
|
28516
28554
|
// TODO: Add multi sort feature
|
|
@@ -28822,8 +28860,10 @@ class QdTableComponent {
|
|
|
28822
28860
|
resolverService = inject(QdTableResolverService);
|
|
28823
28861
|
confirmationDialogService = inject(QdConfirmationDialogOpenerService);
|
|
28824
28862
|
sortRouterConnector = inject(QdTableSortRouterConnectorService);
|
|
28863
|
+
destroyRef = inject(DestroyRef);
|
|
28825
28864
|
/**
|
|
28826
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 />
|
|
28827
28867
|
*
|
|
28828
28868
|
* **Usage:**
|
|
28829
28869
|
*
|
|
@@ -28872,27 +28912,30 @@ class QdTableComponent {
|
|
|
28872
28912
|
this._data = data;
|
|
28873
28913
|
}
|
|
28874
28914
|
/**
|
|
28875
|
-
*
|
|
28876
|
-
* 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`.
|
|
28877
28919
|
*/
|
|
28878
28920
|
testId = 'table';
|
|
28879
28921
|
/**
|
|
28880
|
-
* Emits an event when
|
|
28922
|
+
* Emits an event when a secondary action is triggered. The return value contains the row-specific data. <br />
|
|
28881
28923
|
* `secondaryActions` must be defined in the table configuration.
|
|
28882
28924
|
*
|
|
28883
28925
|
* * @returns EventEmitter with generic type: QdTableRecentSecondaryAction
|
|
28884
28926
|
*/
|
|
28885
28927
|
secondaryActionOutput = new EventEmitter();
|
|
28886
28928
|
/**
|
|
28887
|
-
*
|
|
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 />
|
|
28888
28931
|
* `multiSelect` or `singleSelect` must be activated in the table configuration.
|
|
28889
28932
|
*
|
|
28890
28933
|
* * @returns EventEmitter with generic type: QdTableSelectedRows
|
|
28891
28934
|
*/
|
|
28892
28935
|
selectedRowsOutput = new EventEmitter();
|
|
28893
28936
|
/**
|
|
28894
|
-
*
|
|
28895
|
-
*
|
|
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.
|
|
28896
28939
|
*/
|
|
28897
28940
|
emptyStateActionOutput = new EventEmitter();
|
|
28898
28941
|
paginator;
|
|
@@ -28940,7 +28983,7 @@ class QdTableComponent {
|
|
|
28940
28983
|
this.initRefresh();
|
|
28941
28984
|
this.table$ = this.tableStoreService.table$();
|
|
28942
28985
|
this.hasData$ = this.data$.pipe(map(state => (state ?? []).length > 0));
|
|
28943
|
-
this.
|
|
28986
|
+
this.initializeEmptyStateView();
|
|
28944
28987
|
}
|
|
28945
28988
|
ngOnChanges(changes) {
|
|
28946
28989
|
if (changes['data'] &&
|
|
@@ -28954,8 +28997,12 @@ class QdTableComponent {
|
|
|
28954
28997
|
if (changes['config'] &&
|
|
28955
28998
|
!changes['config'].firstChange &&
|
|
28956
28999
|
!qdIsDeepEqual(changes['config'].previousValue, changes['config'].currentValue)) {
|
|
29000
|
+
this.validateSelectionTracking();
|
|
28957
29001
|
this.updateResponsiveRowServiceTableConfig();
|
|
28958
29002
|
this.updateFillingWidthServiceTableConfig();
|
|
29003
|
+
this.updateRowSelectionServiceTableConfig();
|
|
29004
|
+
this.initializeEmptyStateView();
|
|
29005
|
+
this.updateConfigObservables(changes['config'].previousValue);
|
|
28959
29006
|
}
|
|
28960
29007
|
}
|
|
28961
29008
|
ngOnDestroy() {
|
|
@@ -29015,21 +29062,44 @@ class QdTableComponent {
|
|
|
29015
29062
|
this.fillingWidthService.updateTableConfig(this.config);
|
|
29016
29063
|
}
|
|
29017
29064
|
initializeEmptyStateService() {
|
|
29018
|
-
this.emptyStateService.i18ns = this.config.i18ns;
|
|
29019
29065
|
this._emptyStateActionServiceSubscription = this.emptyStateService.emptyStateAction$.subscribe(() => this.emptyStateActionOutput.emit());
|
|
29020
29066
|
}
|
|
29067
|
+
initializeEmptyStateView() {
|
|
29068
|
+
this.hasEmptyStateView$ = this.hasData$.pipe(map(hasData => !hasData && !!this.config.emptyStateView && !this.config.emptyStateView.disabled));
|
|
29069
|
+
}
|
|
29021
29070
|
initializeRowSelectionService() {
|
|
29022
29071
|
this.rowSelectionService.config = this.config;
|
|
29023
29072
|
this._rowSelectionServiceSubscription = this.rowSelectionService.selectedRows$.subscribe(selectedRows => {
|
|
29024
29073
|
this.selectedRowsOutput.emit(selectedRows);
|
|
29025
29074
|
this.config.selection?.handler?.(selectedRows);
|
|
29026
29075
|
});
|
|
29027
|
-
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
|
+
}
|
|
29028
29098
|
}
|
|
29029
29099
|
initializeSecondaryActionsService() {
|
|
29030
29100
|
this._recentSecondaryActionsSubscription = this.tableStoreService
|
|
29031
29101
|
.recentSecondaryAction$()
|
|
29032
|
-
.pipe(switchMap(recentAction =>
|
|
29102
|
+
.pipe(switchMap(recentAction => this.whenSecondaryActionAvailable$(recentAction)))
|
|
29033
29103
|
.subscribe(recentAction => {
|
|
29034
29104
|
this.secondaryActionOutput.emit(recentAction);
|
|
29035
29105
|
const action = this.config.secondaryActions?.find(a => a.type === recentAction.type);
|
|
@@ -29094,25 +29164,36 @@ class QdTableComponent {
|
|
|
29094
29164
|
}
|
|
29095
29165
|
processSecondaryActionRefresh(result, refreshConfig) {
|
|
29096
29166
|
if (result instanceof Observable) {
|
|
29097
|
-
result
|
|
29167
|
+
result
|
|
29168
|
+
.pipe(take(1))
|
|
29169
|
+
.subscribe(success => success && !this.destroyRef.destroyed && this.triggerRefresh(refreshConfig.page));
|
|
29098
29170
|
return;
|
|
29099
29171
|
}
|
|
29100
|
-
this.
|
|
29172
|
+
if (!this.destroyRef.destroyed)
|
|
29173
|
+
this.triggerRefresh(refreshConfig.page);
|
|
29101
29174
|
}
|
|
29102
|
-
initRefresh() {
|
|
29103
|
-
|
|
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;
|
|
29104
29182
|
}
|
|
29105
29183
|
triggerRefresh(pageIndex) {
|
|
29106
29184
|
this.resolverService.refresh(pageIndex !== undefined ? { pageIndex } : {});
|
|
29107
29185
|
}
|
|
29108
29186
|
validateConfig() {
|
|
29109
|
-
if (!this.config.i18ns) {
|
|
29187
|
+
if (!this.config.i18ns && (this.config.secondaryActions?.length || this.hasTranslatedColumn())) {
|
|
29110
29188
|
console.warn('Quadrel Framework | QdTable - No translations available for the secondaryActions.');
|
|
29111
29189
|
}
|
|
29112
29190
|
if (this.hasHighlightOnRevisit() && !this.config.uid) {
|
|
29113
29191
|
console.warn('Quadrel Framework | QdTable - A "uid" has to be defined when "highlightOnRevisit" is enabled. ' +
|
|
29114
29192
|
'Without a uid, the table state does not persist across navigation.');
|
|
29115
29193
|
}
|
|
29194
|
+
this.validateSelectionTracking();
|
|
29195
|
+
}
|
|
29196
|
+
validateSelectionTracking() {
|
|
29116
29197
|
if (this.config.selection?.type === 'multiSelect' && this.hasPagination && !this.config.trackRowBy) {
|
|
29117
29198
|
throw new Error('Quadrel Framework | QdTable - "trackRowBy" is required when combining "selection: multiSelect" with pagination. ' +
|
|
29118
29199
|
'Provide a trackRowBy function (e.g. `trackRowBy: row => row.uid`) that returns a unique identifier ' +
|
|
@@ -29122,6 +29203,9 @@ class QdTableComponent {
|
|
|
29122
29203
|
hasHighlightOnRevisit() {
|
|
29123
29204
|
return (!!this.config.primaryAction?.highlightOnRevisit || !!this.config.secondaryActions?.some(a => a.highlightOnRevisit));
|
|
29124
29205
|
}
|
|
29206
|
+
hasTranslatedColumn() {
|
|
29207
|
+
return this.config.columns.some(column => 'options' in column && !!column.options && 'isTranslated' in column.options && !!column.options.isTranslated);
|
|
29208
|
+
}
|
|
29125
29209
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
29126
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: [
|
|
29127
29211
|
QdTableStoreService,
|
|
@@ -29136,7 +29220,7 @@ class QdTableComponent {
|
|
|
29136
29220
|
QdTableExternalActionResultService,
|
|
29137
29221
|
QdTableUrlNamespaceService,
|
|
29138
29222
|
QdTableSortRouterConnectorService
|
|
29139
|
-
], 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 });
|
|
29140
29224
|
}
|
|
29141
29225
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdTableComponent, decorators: [{
|
|
29142
29226
|
type: Component,
|
|
@@ -29159,7 +29243,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
29159
29243
|
'[class.last-column-fills-width]': 'whichColumnFillsWidth === "last"',
|
|
29160
29244
|
'[class.harmonized]': 'whichColumnFillsWidth === "harmonized"',
|
|
29161
29245
|
'[attr.data-qd-no-horizontal-padding-small]': 'true'
|
|
29162
|
-
}, 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"] }]
|
|
29163
29247
|
}], propDecorators: { config: [{
|
|
29164
29248
|
type: Input
|
|
29165
29249
|
}], data: [{
|
|
@@ -29289,6 +29373,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
29289
29373
|
* }
|
|
29290
29374
|
* ```
|
|
29291
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
|
+
*
|
|
29292
29381
|
* @parent qd-section {supported}
|
|
29293
29382
|
* description: Put it on the table inside the section that owns the context, so both read the same state.
|
|
29294
29383
|
*/
|
|
@@ -29375,7 +29464,8 @@ class QdConnectorTableFilterDirective {
|
|
|
29375
29464
|
tableComponent = inject(QdTableComponent, { host: true });
|
|
29376
29465
|
toolbarComponentsService = inject(QdToolbarComponentsService);
|
|
29377
29466
|
/**
|
|
29378
|
-
*
|
|
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.
|
|
29379
29469
|
*/
|
|
29380
29470
|
qdConnectToFilter;
|
|
29381
29471
|
filterComponent;
|
|
@@ -29564,7 +29654,8 @@ class QdConnectorTableSearchDirective {
|
|
|
29564
29654
|
tableComponent = inject(QdTableComponent, { host: true });
|
|
29565
29655
|
toolbarComponentsService = inject(QdToolbarComponentsService);
|
|
29566
29656
|
/**
|
|
29567
|
-
*
|
|
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.
|
|
29568
29659
|
*/
|
|
29569
29660
|
qdConnectToSearch;
|
|
29570
29661
|
searchComponent;
|