@coolon/angular-ui-powerups 16.1.0-alpha.326 → 16.1.0-alpha.328
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/esm2022/lib/components/tables/abstract-table-model.mjs +17 -6
- package/esm2022/lib/interaction/services/interaction.service.mjs +19 -12
- package/esm2022/lib/place/navigation/session/interactions/pop-state-during-interaction-navigation.mjs +5 -3
- package/esm2022/lib/place/place-router.mjs +50 -27
- package/fesm2022/coolon-angular-ui-powerups.mjs +87 -44
- package/fesm2022/coolon-angular-ui-powerups.mjs.map +1 -1
- package/lib/components/tables/abstract-table-model.d.ts +4 -4
- package/lib/interaction/services/interaction.service.d.ts +12 -0
- package/lib/place/place-router.d.ts +19 -1
- package/package.json +1 -1
|
@@ -6925,10 +6925,10 @@ class AbstractTableModel extends GarbageCollector {
|
|
|
6925
6925
|
* 3. A column that names search classes, none of them for the page's search criteria, fails when the
|
|
6926
6926
|
* table initialises, naming the column and the search criteria class. The check runs then, so a
|
|
6927
6927
|
* page calls this before the table initialises, and a later call throws.
|
|
6928
|
-
* 4. New criteria are offered only when they differ in value from the last.
|
|
6929
|
-
*
|
|
6930
|
-
*
|
|
6931
|
-
*
|
|
6928
|
+
* 4. New criteria are offered only when they differ in value from the last. A search class's
|
|
6929
|
+
* dependency can change, or a column be shown, without changing what the search writes, and a page
|
|
6930
|
+
* that starts its list again on every new criteria would restart it for nothing. Criteria with an
|
|
6931
|
+
* `equals` method, as generated DTOs have, are compared with it; any others are compared deeply.
|
|
6932
6932
|
*
|
|
6933
6933
|
* The criteria are worked out again when the base criteria, the search, the visible columns or any
|
|
6934
6934
|
* search class's `dependsOn` change.
|
|
@@ -6958,7 +6958,7 @@ class AbstractTableModel extends GarbageCollector {
|
|
|
6958
6958
|
return placement.withSearchCriteria(base, searchCriteria);
|
|
6959
6959
|
}, {
|
|
6960
6960
|
dependsOn: [this._search$, this.visibleColumns$, this._searchClassesResolved$, this._searchDependencyChanges$],
|
|
6961
|
-
equal:
|
|
6961
|
+
equal: sameCriteria,
|
|
6962
6962
|
});
|
|
6963
6963
|
}
|
|
6964
6964
|
initialiseSearchCriteria() {
|
|
@@ -7183,6 +7183,17 @@ class AbstractTableModel extends GarbageCollector {
|
|
|
7183
7183
|
}
|
|
7184
7184
|
}
|
|
7185
7185
|
ProxyRegistry.registerOneTimeBinding(AbstractTableModel);
|
|
7186
|
+
/**
|
|
7187
|
+
* Whether two criteria hold the same value. A generated DTO compares its data through its own `equals`.
|
|
7188
|
+
* Comparing DTOs with `isEqual` used to find no two of them equal, because each instance carries `Symbol`
|
|
7189
|
+
* fields of its own, so every recompute restarted the page's list.
|
|
7190
|
+
*/
|
|
7191
|
+
function sameCriteria(a, b) {
|
|
7192
|
+
return comparesItself(a) ? a.equals(b) : isEqual(a, b);
|
|
7193
|
+
}
|
|
7194
|
+
function comparesItself(value) {
|
|
7195
|
+
return typeof value?.equals === 'function';
|
|
7196
|
+
}
|
|
7186
7197
|
|
|
7187
7198
|
class TableCellComponent extends DisposableComponent {
|
|
7188
7199
|
row;
|
|
@@ -9902,7 +9913,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImpor
|
|
|
9902
9913
|
notifyActive(context) {
|
|
9903
9914
|
assert$1.isTruthy(context.identifier);
|
|
9904
9915
|
this.contextRegistry.start(context);
|
|
9905
|
-
return this.
|
|
9916
|
+
return this.syncIdsWithRouter();
|
|
9906
9917
|
}
|
|
9907
9918
|
// @Trace()
|
|
9908
9919
|
isNavigationInProgress() {
|
|
@@ -9911,16 +9922,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImpor
|
|
|
9911
9922
|
// @Trace()
|
|
9912
9923
|
notifyFinished(context) {
|
|
9913
9924
|
this.contextRegistry.finish(context);
|
|
9914
|
-
|
|
9915
|
-
|
|
9916
|
-
|
|
9917
|
-
|
|
9918
|
-
|
|
9919
|
-
|
|
9920
|
-
|
|
9921
|
-
|
|
9922
|
-
|
|
9923
|
-
|
|
9925
|
+
return this.syncIdsWithRouter();
|
|
9926
|
+
}
|
|
9927
|
+
/**
|
|
9928
|
+
* Brings the url's interaction ids up to date. During a navigation the router runs the sync once
|
|
9929
|
+
* that navigation lands; skipping it instead left the url with the old ids, so Back left the place
|
|
9930
|
+
* rather than closing a dialog opened then, or kept the id of one closed then.
|
|
9931
|
+
*
|
|
9932
|
+
* :: Important ::
|
|
9933
|
+
* Only an idle router's sync is waited for. This is traversed by both the place router (during
|
|
9934
|
+
* canDeactivate guards) and user land code (both when routing is idle and while it is active in
|
|
9935
|
+
* PlaceComponent.canDeactivate()). A sync asked for during a navigation won't start until that
|
|
9936
|
+
* navigation finishes, and the navigation won't finish until this promise settles: deadlock.
|
|
9937
|
+
*/
|
|
9938
|
+
syncIdsWithRouter() {
|
|
9939
|
+
const navigating = this.isNavigationInProgress();
|
|
9940
|
+
const synced = this.placeRouter.syncInteractionContextIdsWithRouter();
|
|
9941
|
+
return navigating ? Promise.resolve() : synced;
|
|
9924
9942
|
}
|
|
9925
9943
|
}
|
|
9926
9944
|
InteractionService.ApiAdapter = ApiAdapter;
|
|
@@ -11094,8 +11112,10 @@ class PopStateDuringInteractionNavigation extends AbstractPopStateNavigation {
|
|
|
11094
11112
|
}
|
|
11095
11113
|
// @Trace()
|
|
11096
11114
|
onRouterEnd(event) {
|
|
11097
|
-
//
|
|
11098
|
-
|
|
11115
|
+
// Usually a pop during an interaction is refused (onRouterCancelled), but one that lands has to
|
|
11116
|
+
// record where it landed, as every other session does: finishing without the visit left
|
|
11117
|
+
// activeVisit$, and with it the places, on parameters the url no longer showed.
|
|
11118
|
+
this.context.finishRoutingSession(this.createUpdatedVisit(event.urlAfterRedirects));
|
|
11099
11119
|
}
|
|
11100
11120
|
handleCanDeactivateCancelledEventScenario(newUrl) {
|
|
11101
11121
|
this.illegalTransition('Leaving interaction after pop-state should\'t block so should never see a back button click');
|
|
@@ -11955,6 +11975,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImpor
|
|
|
11955
11975
|
}]
|
|
11956
11976
|
}], ctorParameters: function () { return [{ type: i1$5.Router }, { type: i1$1.Location }, { type: i1$5.UrlSerializer }]; } });
|
|
11957
11977
|
|
|
11978
|
+
function resolveTarget(target) {
|
|
11979
|
+
return typeof target === 'function' ? target() : target;
|
|
11980
|
+
}
|
|
11958
11981
|
// function asArray<T>(item: T | T[]): T[] {
|
|
11959
11982
|
// return Array.isArray(item) ? item : [item];
|
|
11960
11983
|
// }
|
|
@@ -11977,8 +12000,9 @@ class PlaceRouter extends GarbageCollector {
|
|
|
11977
12000
|
// agnostic about what the metadata means - producers (e.g. SingleSelectionModel corrections) tag
|
|
11978
12001
|
// the transaction and register a predicate here. See skipHistoryIf / notifyVisitSegmentChanged.
|
|
11979
12002
|
skipHistoryPredicates = [];
|
|
11980
|
-
// A navigation triggered while
|
|
11981
|
-
//
|
|
12003
|
+
// A navigation triggered while a session is in flight is parked here and run when that session
|
|
12004
|
+
// finishes. Only the most recent target is kept (coalescing), but every caller it replaced waits
|
|
12005
|
+
// with it: see queueNavigation.
|
|
11982
12006
|
pendingNavigation;
|
|
11983
12007
|
queuedNavigationDepth = 0;
|
|
11984
12008
|
static MAX_QUEUED_NAVIGATION_DEPTH = 5;
|
|
@@ -12163,21 +12187,30 @@ class PlaceRouter extends GarbageCollector {
|
|
|
12163
12187
|
this.currentSession.onRouterEnd(event);
|
|
12164
12188
|
}
|
|
12165
12189
|
async navigate(visitOrPlaceComponent, params) {
|
|
12166
|
-
const
|
|
12167
|
-
|
|
12168
|
-
|
|
12190
|
+
const target = this.toVisit(visitOrPlaceComponent, params);
|
|
12191
|
+
// The defaults are filled in when the navigation runs. One that queues behind a navigation in
|
|
12192
|
+
// flight would otherwise take the ancestors that navigation replaces.
|
|
12193
|
+
return this.doNavigation(() => target.copyWithDefaultsFrom(this.activeVisit$.value), async (router, visit) => {
|
|
12194
|
+
await router.navigate(visit.getRouterCommands());
|
|
12169
12195
|
});
|
|
12170
12196
|
}
|
|
12197
|
+
/**
|
|
12198
|
+
* Runs a navigation, or queues it behind the one in flight. The returned promise settles once the
|
|
12199
|
+
* navigation has landed (or been refused): a caller may treat it as the route being current, as
|
|
12200
|
+
* the place outlet does. A {@link PlaceRouter.NavigationTarget} given as a function is resolved
|
|
12201
|
+
* when the navigation runs, so a queued one is built from the visit it runs after.
|
|
12202
|
+
*/
|
|
12171
12203
|
// @Trace()
|
|
12172
|
-
async doNavigation(
|
|
12204
|
+
async doNavigation(target, runNavigationCommands) {
|
|
12173
12205
|
if (this.navigationInProgress$.value) {
|
|
12174
|
-
return this.handleOverlappingNavigation(
|
|
12206
|
+
return this.handleOverlappingNavigation(target, runNavigationCommands);
|
|
12175
12207
|
}
|
|
12208
|
+
const visit = resolveTarget(target);
|
|
12176
12209
|
const navigation = this.createNavigationSession(this.urlService.getCurrentRouterUrl());
|
|
12177
12210
|
navigation.initialiseVisitSegments(visit);
|
|
12178
12211
|
this.transitionTo(navigation);
|
|
12179
12212
|
try {
|
|
12180
|
-
await runNavigationCommands(this.angularRouter);
|
|
12213
|
+
await runNavigationCommands(this.angularRouter, visit);
|
|
12181
12214
|
}
|
|
12182
12215
|
finally {
|
|
12183
12216
|
// Check if the router has finished (in the case where no router change required) and we're still in a
|
|
@@ -12201,7 +12234,8 @@ class PlaceRouter extends GarbageCollector {
|
|
|
12201
12234
|
* events -> onPopState), so queueing programmatic navigations behind an in-flight session
|
|
12202
12235
|
* preserves user-intent ordering.
|
|
12203
12236
|
*/
|
|
12204
|
-
handleOverlappingNavigation(
|
|
12237
|
+
handleOverlappingNavigation(target, runNavigationCommands) {
|
|
12238
|
+
const visit = resolveTarget(target);
|
|
12205
12239
|
const current = this.navigationSession;
|
|
12206
12240
|
const debug = {
|
|
12207
12241
|
inProgress: {
|
|
@@ -12217,17 +12251,25 @@ class PlaceRouter extends GarbageCollector {
|
|
|
12217
12251
|
};
|
|
12218
12252
|
Logger.get(this).warn(`Navigation triggered while session '${current?.name}' is in progress; ` +
|
|
12219
12253
|
`queueing the incoming navigation to run once it finishes.`, debug);
|
|
12220
|
-
return this.queueNavigation(
|
|
12254
|
+
return this.queueNavigation(target, runNavigationCommands);
|
|
12221
12255
|
}
|
|
12222
|
-
|
|
12223
|
-
|
|
12224
|
-
|
|
12225
|
-
|
|
12226
|
-
|
|
12227
|
-
|
|
12256
|
+
/**
|
|
12257
|
+
* Coalesces to the latest target, but a superseded caller is NOT settled here: it waits for the
|
|
12258
|
+
* navigation that replaced it. Settling it at once told the caller its navigation had landed while
|
|
12259
|
+
* the route was unchanged. The place outlet then wrote that route back to its place; a selection
|
|
12260
|
+
* that couldn't hold it selected again and navigated again, superseding the next one, and that
|
|
12261
|
+
* cycle ran on microtasks alone, so the session in flight never finished (mars-v2's groups pages
|
|
12262
|
+
* hung after a create).
|
|
12263
|
+
*/
|
|
12264
|
+
queueNavigation(target, runNavigationCommands) {
|
|
12265
|
+
const superseded = this.pendingNavigation;
|
|
12228
12266
|
return new Promise((resolve, reject) => {
|
|
12229
|
-
this.pendingNavigation = {
|
|
12230
|
-
|
|
12267
|
+
this.pendingNavigation = {
|
|
12268
|
+
target,
|
|
12269
|
+
runNavigationCommands,
|
|
12270
|
+
callers: [...(superseded?.callers ?? []), { resolve, reject }],
|
|
12271
|
+
};
|
|
12272
|
+
if (!superseded) {
|
|
12231
12273
|
this.runAfterRoutingSessionFinishes(() => this.flushPendingNavigation());
|
|
12232
12274
|
}
|
|
12233
12275
|
});
|
|
@@ -12240,18 +12282,19 @@ class PlaceRouter extends GarbageCollector {
|
|
|
12240
12282
|
this.pendingNavigation = undefined;
|
|
12241
12283
|
if (this.queuedNavigationDepth >= PlaceRouter.MAX_QUEUED_NAVIGATION_DEPTH) {
|
|
12242
12284
|
Logger.get(this).warn(`Dropping queued navigation after ${this.queuedNavigationDepth} consecutive deferrals to ` +
|
|
12243
|
-
`avoid a navigation loop.`, { visit: pending.
|
|
12285
|
+
`avoid a navigation loop.`, { visit: resolveTarget(pending.target)?.toDebugString() });
|
|
12244
12286
|
this.queuedNavigationDepth = 0;
|
|
12245
|
-
|
|
12287
|
+
// Nothing navigated, so the route its callers read back is still the current one.
|
|
12288
|
+
pending.callers.forEach(caller => caller.resolve());
|
|
12246
12289
|
return;
|
|
12247
12290
|
}
|
|
12248
12291
|
this.queuedNavigationDepth++;
|
|
12249
|
-
this.doNavigation(pending.
|
|
12292
|
+
this.doNavigation(pending.target, pending.runNavigationCommands).then(() => {
|
|
12250
12293
|
this.queuedNavigationDepth = 0;
|
|
12251
|
-
pending.resolve();
|
|
12294
|
+
pending.callers.forEach(caller => caller.resolve());
|
|
12252
12295
|
}, (error) => {
|
|
12253
12296
|
this.queuedNavigationDepth = 0;
|
|
12254
|
-
pending.reject(error);
|
|
12297
|
+
pending.callers.forEach(caller => caller.reject(error));
|
|
12255
12298
|
});
|
|
12256
12299
|
}
|
|
12257
12300
|
navigateByUrl(urlSnapshot, navigationExtras) {
|
|
@@ -12268,8 +12311,6 @@ class PlaceRouter extends GarbageCollector {
|
|
|
12268
12311
|
async notifyVisitSegmentChanged(is, was, metadata) {
|
|
12269
12312
|
// console.log("PlaceRouter.notifyVisitSegmentChanged", is.toDebugString(), was.toDebugString());
|
|
12270
12313
|
this.placeHistory.updateVisitSegment(is);
|
|
12271
|
-
// FIXME: no route id -> route id duplicates route parameters
|
|
12272
|
-
const visit = this.activeVisit$.value.copyAndReplaceSegment(is);
|
|
12273
12314
|
if (is.hasRoutingChangedFrom(was)) {
|
|
12274
12315
|
// An in-place parameter change (model -> route) pushes a history entry by default so a
|
|
12275
12316
|
// deliberate selection is reachable via the back button. Automatic refinements
|
|
@@ -12279,7 +12320,9 @@ class PlaceRouter extends GarbageCollector {
|
|
|
12279
12320
|
// that entry, and a pushed one would leave the pop on an entry that still holds the interaction. The closing
|
|
12280
12321
|
// session then pushes the change after the entry it pops to (RemoveLastInteractionFromUrlNavigationSession).
|
|
12281
12322
|
const replaceUrl = this.interactionService.isActive() || this.shouldReplaceHistory(metadata);
|
|
12282
|
-
|
|
12323
|
+
// Both the visit and the url are built when the navigation runs, from what is current then.
|
|
12324
|
+
// FIXME: no route id -> route id duplicates route parameters
|
|
12325
|
+
await this.doNavigation(() => this.activeVisit$.value.copyAndReplaceSegment(is), () => {
|
|
12283
12326
|
const urlSnapshot = this.urlService
|
|
12284
12327
|
.parseUrl(this.angularRouter.routerState.snapshot.url)
|
|
12285
12328
|
.updateVisitSegment(is);
|