@acorex/platform 20.9.20 → 20.9.22
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/acorex-platform-common.mjs +43 -4
- package/fesm2022/acorex-platform-common.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-entity.mjs +39 -18
- package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
- package/fesm2022/acorex-platform-themes-default.mjs +39 -4
- package/fesm2022/acorex-platform-themes-default.mjs.map +1 -1
- package/package.json +1 -1
- package/types/acorex-platform-layout-entity.d.ts +2 -1
- package/types/acorex-platform-themes-default.d.ts +8 -0
|
@@ -5442,12 +5442,16 @@ class AXPEntityMasterListViewModel {
|
|
|
5442
5442
|
const entitySetting = await this.settings.get(this.settingEntityKey);
|
|
5443
5443
|
selectedViewName = entitySetting?.list?.currentView;
|
|
5444
5444
|
}
|
|
5445
|
+
// URL `view` wins; fall back to persisted currentView when the query param is absent.
|
|
5445
5446
|
const resolvedViewName = viewName ?? selectedViewName;
|
|
5446
5447
|
const currentViewName = this.view().name;
|
|
5447
5448
|
const currentViewUnavailable = !availableViews.some((v) => v.name === currentViewName);
|
|
5448
5449
|
const nextView = availableViews.find((c) => c.name == resolvedViewName) ??
|
|
5449
5450
|
(currentViewUnavailable ? availableViews[0] : this.view());
|
|
5450
|
-
|
|
5451
|
+
// Columns start empty; bootstrap them on first setView even when the view name is unchanged
|
|
5452
|
+
// (e.g. URL already has ?view=all matching the default view).
|
|
5453
|
+
const needsColumnBootstrap = this.columns().length === 0;
|
|
5454
|
+
const shouldApplyViewState = nextView.name !== currentViewName || currentViewUnavailable || needsColumnBootstrap;
|
|
5451
5455
|
if (shouldApplyViewState) {
|
|
5452
5456
|
this.view.set(nextView);
|
|
5453
5457
|
this.applyViewSorts();
|
|
@@ -5825,17 +5829,16 @@ class AXPEntityMasterListViewModel {
|
|
|
5825
5829
|
}
|
|
5826
5830
|
this.loadListPagingFromViewSettings(listViewSetting);
|
|
5827
5831
|
if (columns && columnVisibilityMap && columnWidthsMap) {
|
|
5828
|
-
this.columns.update((prev) =>
|
|
5829
|
-
.
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
width
|
|
5834
|
-
visible
|
|
5835
|
-
}
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
columns.findIndex((col) => col.name === (b.column?.options?.dataPath ?? b.name))));
|
|
5832
|
+
this.columns.update((prev) => {
|
|
5833
|
+
const next = [...prev].sort((a, b) => columns.findIndex((col) => col.name === (a.column?.options?.dataPath ?? a.name)) -
|
|
5834
|
+
columns.findIndex((col) => col.name === (b.column?.options?.dataPath ?? b.name)));
|
|
5835
|
+
for (const column of next) {
|
|
5836
|
+
const columnKey = column.column?.options?.dataPath ?? column.name;
|
|
5837
|
+
column.width = defaultTo(columnWidthsMap.get(columnKey), column.column?.options?.width);
|
|
5838
|
+
column.visible = columnVisibilityMap.get(columnKey) ?? column.visible;
|
|
5839
|
+
}
|
|
5840
|
+
return next;
|
|
5841
|
+
});
|
|
5839
5842
|
}
|
|
5840
5843
|
if (Array.isArray(sorts) && sorts.length) {
|
|
5841
5844
|
this.setActiveSortsFromQueries(sorts);
|
|
@@ -6331,9 +6334,10 @@ class AXPEntityMasterListViewModel {
|
|
|
6331
6334
|
/**
|
|
6332
6335
|
* Records the current route query context after initial resolver / view init so the first
|
|
6333
6336
|
* subscription emission does not re-sync unnecessarily.
|
|
6337
|
+
* Pass `overrides` when about to `replaceUrl` query params so the upcoming emission is treated as synced.
|
|
6334
6338
|
*/
|
|
6335
|
-
markRouteQueryContextSynced(queryParamMap) {
|
|
6336
|
-
this.routeQueryContextKey = this.buildRouteQueryContextKey(queryParamMap);
|
|
6339
|
+
markRouteQueryContextSynced(queryParamMap, overrides) {
|
|
6340
|
+
this.routeQueryContextKey = this.buildRouteQueryContextKey(queryParamMap, overrides);
|
|
6337
6341
|
}
|
|
6338
6342
|
/**
|
|
6339
6343
|
* Reacts to any route query param change while the list route is reused (`reuse: queryParamsChange`).
|
|
@@ -6353,14 +6357,31 @@ class AXPEntityMasterListViewModel {
|
|
|
6353
6357
|
if (filtersChanged || viewChanged) {
|
|
6354
6358
|
this.lastAppliedFilterKey = null;
|
|
6355
6359
|
this.lastAppliedSortKey = null;
|
|
6360
|
+
// applyFilterAndSort already emits refresh — avoid a second reloadListData in the host.
|
|
6356
6361
|
await this.applyFilterAndSort();
|
|
6362
|
+
return { reloadList: false };
|
|
6357
6363
|
}
|
|
6364
|
+
// Other query-param context changes (e.g. expression-driven visibility) still need a list reload.
|
|
6358
6365
|
return { reloadList: true };
|
|
6359
6366
|
}
|
|
6360
|
-
buildRouteQueryContextKey(queryParamMap) {
|
|
6361
|
-
|
|
6367
|
+
buildRouteQueryContextKey(queryParamMap, overrides) {
|
|
6368
|
+
const params = {};
|
|
6369
|
+
for (const key of queryParamMap.keys) {
|
|
6370
|
+
params[key] = queryParamMap.get(key) ?? '';
|
|
6371
|
+
}
|
|
6372
|
+
if (overrides) {
|
|
6373
|
+
for (const [key, value] of Object.entries(overrides)) {
|
|
6374
|
+
if (value == null) {
|
|
6375
|
+
delete params[key];
|
|
6376
|
+
}
|
|
6377
|
+
else {
|
|
6378
|
+
params[key] = value;
|
|
6379
|
+
}
|
|
6380
|
+
}
|
|
6381
|
+
}
|
|
6382
|
+
return Object.keys(params)
|
|
6362
6383
|
.sort()
|
|
6363
|
-
.map((key) => `${key}=${
|
|
6384
|
+
.map((key) => `${key}=${params[key]}`)
|
|
6364
6385
|
.join('&');
|
|
6365
6386
|
}
|
|
6366
6387
|
async syncFiltersFromRouteQueryParam(filtersJson) {
|
|
@@ -25176,7 +25197,7 @@ const AXPCrudModifier = {
|
|
|
25176
25197
|
queries.list = {
|
|
25177
25198
|
execute: async (e) => {
|
|
25178
25199
|
const res = await dataService.query(e);
|
|
25179
|
-
//console.log('query', res, ctx.module.get() + '.' + ctx.name.get(), e);
|
|
25200
|
+
// console.log('query', res, ctx.module.get() + '.' + ctx.name.get(), e);
|
|
25180
25201
|
return res;
|
|
25181
25202
|
},
|
|
25182
25203
|
type: AXPEntityQueryType.List,
|