@quadrel-enterprise-ui/framework 20.36.0-beta.318.1 → 20.36.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.
|
@@ -24735,6 +24735,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
|
|
|
24735
24735
|
*/
|
|
24736
24736
|
const QD_TABLE_DATA_RESOLVER_TOKEN = new InjectionToken('QD_TABLE_DATA_RESOLVER_TOKEN');
|
|
24737
24737
|
|
|
24738
|
+
/**
|
|
24739
|
+
* Resolves table data through the consumer's `QdTableDataResolver` and writes the result into the table store.
|
|
24740
|
+
*
|
|
24741
|
+
* #### Internal invariant
|
|
24742
|
+
*
|
|
24743
|
+
* Both streams wait for resolution criteria from the store and only resolve once criteria arrive.
|
|
24744
|
+
* The store yields criteria only while `pageIndex` and `pageSize` are set for this table. A resolver
|
|
24745
|
+
* result without `size` therefore stores `pageSize: undefined` and silences every later refresh,
|
|
24746
|
+
* because the stream keeps waiting for criteria that never come again. `handleResolverResult`
|
|
24747
|
+
* guards against that, so a broken result surfaces as an error instead of a table that stops
|
|
24748
|
+
* reacting without a trace.
|
|
24749
|
+
*/
|
|
24738
24750
|
class QdTableResolverService {
|
|
24739
24751
|
tableDataResolver = inject(QD_TABLE_DATA_RESOLVER_TOKEN, { optional: true });
|
|
24740
24752
|
tableStoreService = inject(QdTableStoreService);
|
|
@@ -24768,21 +24780,12 @@ class QdTableResolverService {
|
|
|
24768
24780
|
if (!resolver)
|
|
24769
24781
|
return console.warn('Quadrel Framework | QdTable - Refresh skipped: resolver not provided.');
|
|
24770
24782
|
const { pageIndex } = resolverOptions;
|
|
24771
|
-
console.warn('Quadrel Framework | QdTable - A refresh was requested:', { pageIndex });
|
|
24772
24783
|
this._refreshSubscription?.unsubscribe();
|
|
24773
24784
|
this._refreshSubscription = this.tableStoreService
|
|
24774
24785
|
.selectDataResolutionCriteria$()
|
|
24775
|
-
.pipe(
|
|
24786
|
+
.pipe(filter((criteria) => !!criteria), first(), switchMap(resolutionCriteria => this.resolveAndApply(resolver, this.buildRefreshParams(resolutionCriteria, pageIndex))), takeUntil(this._destroyed$))
|
|
24776
24787
|
.subscribe();
|
|
24777
24788
|
}
|
|
24778
|
-
reportResolutionCriteria(criteria) {
|
|
24779
|
-
if (criteria) {
|
|
24780
|
-
console.warn('Quadrel Framework | QdTable - The refresh received its resolution criteria:', criteria);
|
|
24781
|
-
return;
|
|
24782
|
-
}
|
|
24783
|
-
console.warn('Quadrel Framework | QdTable - Refresh is waiting for resolution criteria. ' +
|
|
24784
|
-
'The table has no page index or page size in its store, so the resolver is not called until they arrive.');
|
|
24785
|
-
}
|
|
24786
24789
|
subscribeToLangChanges() {
|
|
24787
24790
|
this.translateService.onLangChange.pipe(takeUntil(this._destroyed$)).subscribe(() => this.refresh());
|
|
24788
24791
|
}
|
|
@@ -24814,7 +24817,6 @@ class QdTableResolverService {
|
|
|
24814
24817
|
resolveAndApply(resolver, params) {
|
|
24815
24818
|
return defer(() => {
|
|
24816
24819
|
this.tableStoreService.setRequestState(QdTableRequestState.PENDING);
|
|
24817
|
-
console.warn('Quadrel Framework | QdTable - Calling the data resolver:', params);
|
|
24818
24820
|
return resolver.resolve(params);
|
|
24819
24821
|
}).pipe(tap(result => this.handleResolverResult(result)), filter(() => !this._isNavigatingToValidPage), tap(() => this.tableStoreService.setRequestState(QdTableRequestState.SUCCESS)), catchError(() => this.recoverFromFailedRequest()));
|
|
24820
24822
|
}
|
|
@@ -24827,6 +24829,9 @@ class QdTableResolverService {
|
|
|
24827
24829
|
if (!result?.data)
|
|
24828
24830
|
throw new Error('Quadrel Framework | QdTable - Resolver result has no data.');
|
|
24829
24831
|
const { page, data, size, totalElements } = result;
|
|
24832
|
+
if (this._hasPagination && size === undefined)
|
|
24833
|
+
throw new Error('Quadrel Framework | QdTable - The QdTableDataResolver returned a result without "size". ' +
|
|
24834
|
+
'A paginated table stores it to resolve the next page and stops resolving without it.');
|
|
24830
24835
|
if (this.isOnEmptyPageWithRemainingEntries(result)) {
|
|
24831
24836
|
const lastValidPage = Math.ceil(totalElements / size) - 1;
|
|
24832
24837
|
this._isNavigatingToValidPage = true;
|
|
@@ -26464,7 +26469,7 @@ class QdTableComponent {
|
|
|
26464
26469
|
}
|
|
26465
26470
|
if (changes['config'] &&
|
|
26466
26471
|
!changes['config'].firstChange &&
|
|
26467
|
-
|
|
26472
|
+
JSON.stringify(changes['config'].previousValue) !== JSON.stringify(changes['config'].currentValue)) {
|
|
26468
26473
|
this.updateResponsiveRowServiceTableConfig();
|
|
26469
26474
|
this.updateFillingWidthServiceTableConfig();
|
|
26470
26475
|
}
|
|
@@ -26594,15 +26599,9 @@ class QdTableComponent {
|
|
|
26594
26599
|
this.triggerRefresh(refreshConfig.page);
|
|
26595
26600
|
}
|
|
26596
26601
|
initRefresh() {
|
|
26597
|
-
|
|
26598
|
-
return;
|
|
26599
|
-
console.warn('Quadrel Framework | QdTable - Subscribing to the refresh observable from the config:', {
|
|
26600
|
-
uid: this.config.uid
|
|
26601
|
-
});
|
|
26602
|
-
this._refreshSubscription = this.config.refresh.subscribe(value => this.triggerRefresh(value));
|
|
26602
|
+
this._refreshSubscription = this.config.refresh?.subscribe(value => this.triggerRefresh(value));
|
|
26603
26603
|
}
|
|
26604
26604
|
triggerRefresh(pageIndex) {
|
|
26605
|
-
console.warn('Quadrel Framework | QdTable - The refresh observable emitted:', { pageIndex });
|
|
26606
26605
|
this.resolverService.refresh(pageIndex !== undefined ? { pageIndex } : {});
|
|
26607
26606
|
}
|
|
26608
26607
|
validateConfig() {
|