@acorex/platform 20.8.18 → 20.8.19
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-layout-components.mjs +28 -18
- package/fesm2022/acorex-platform-layout-components.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-entity.mjs +76 -16
- package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-views.mjs +7 -3
- package/fesm2022/acorex-platform-layout-views.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-widget-core.mjs +87 -16
- package/fesm2022/acorex-platform-layout-widget-core.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-widgets.mjs +1 -1
- package/fesm2022/acorex-platform-layout-widgets.mjs.map +1 -1
- package/fesm2022/{acorex-platform-themes-default-entity-master-list-view.component-D2CtNrSn.mjs → acorex-platform-themes-default-entity-master-list-view.component-DnFEQS-L.mjs} +48 -15
- package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-DnFEQS-L.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-default.mjs +3 -3
- package/fesm2022/acorex-platform-themes-default.mjs.map +1 -1
- package/layout/components/index.d.ts +2 -1
- package/layout/entity/index.d.ts +19 -0
- package/layout/views/index.d.ts +2 -1
- package/layout/widget-core/index.d.ts +12 -3
- package/package.json +1 -1
- package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-D2CtNrSn.mjs.map +0 -1
|
@@ -3948,7 +3948,7 @@ class AXPEntityMasterListViewModel {
|
|
|
3948
3948
|
this.events$.next({ action: 'refresh' });
|
|
3949
3949
|
}
|
|
3950
3950
|
});
|
|
3951
|
-
this.sortedFields.set(
|
|
3951
|
+
this.sortedFields.set([]);
|
|
3952
3952
|
void this.syncShowRowIndexColumnSetting();
|
|
3953
3953
|
this.settings.onLoaded.pipe(takeUntil(this.destroyed)).subscribe(() => {
|
|
3954
3954
|
void this.syncShowRowIndexColumnSetting();
|
|
@@ -4051,10 +4051,8 @@ class AXPEntityMasterListViewModel {
|
|
|
4051
4051
|
.sort((a, b) => columns.findIndex((col) => col.name === (a.column?.options?.dataPath ?? a.name)) -
|
|
4052
4052
|
columns.findIndex((col) => col.name === (b.column?.options?.dataPath ?? b.name))));
|
|
4053
4053
|
}
|
|
4054
|
-
if (Array.isArray(sorts)) {
|
|
4055
|
-
|
|
4056
|
-
const sortsMap = new Map(sorts.map((s) => [s.name, s.dir]));
|
|
4057
|
-
this.sortedFields.update((prev) => prev.map((sf) => ({ ...sf, dir: sortsMap.get(sf.name) || sf.dir })));
|
|
4054
|
+
if (Array.isArray(sorts) && sorts.length) {
|
|
4055
|
+
this.setActiveSortsFromQueries(sorts);
|
|
4058
4056
|
}
|
|
4059
4057
|
// Don't override filters if they came from queryParams
|
|
4060
4058
|
if (Array.isArray(filters) && !this.hasQueryParamsFilters) {
|
|
@@ -4569,18 +4567,80 @@ class AXPEntityMasterListViewModel {
|
|
|
4569
4567
|
resetSorts() {
|
|
4570
4568
|
this.applyViewSorts();
|
|
4571
4569
|
}
|
|
4570
|
+
/**
|
|
4571
|
+
* Applies active sorts in the given order (click order, saved settings, or view defaults).
|
|
4572
|
+
*/
|
|
4573
|
+
setActiveSortsFromQueries(sorts) {
|
|
4574
|
+
const sortableByName = new Map(this.sortableFields().map((f) => [f.name, f]));
|
|
4575
|
+
this.sortedFields.set(sorts
|
|
4576
|
+
.filter((s) => s.dir && sortableByName.has(s.name))
|
|
4577
|
+
.map((s) => ({
|
|
4578
|
+
name: s.name,
|
|
4579
|
+
title: sortableByName.get(s.name).title,
|
|
4580
|
+
dir: s.dir,
|
|
4581
|
+
})));
|
|
4582
|
+
}
|
|
4572
4583
|
applyViewSorts() {
|
|
4573
|
-
const viewSorts = this.view().sorts;
|
|
4574
|
-
this.
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
+
const viewSorts = this.view().sorts ?? [];
|
|
4585
|
+
this.setActiveSortsFromQueries(viewSorts);
|
|
4586
|
+
}
|
|
4587
|
+
/**
|
|
4588
|
+
* Active sort direction for a column (synced with toolbar sort UI and dataSource).
|
|
4589
|
+
*/
|
|
4590
|
+
getColumnSortDirection(columnName) {
|
|
4591
|
+
const dir = this.sortedFields().find((sf) => sf.name === columnName)?.dir;
|
|
4592
|
+
return dir === 'asc' || dir === 'desc' ? dir : undefined;
|
|
4593
|
+
}
|
|
4594
|
+
/**
|
|
4595
|
+
* 1-based priority index when multiple columns are sorted (Ctrl+click order).
|
|
4596
|
+
*/
|
|
4597
|
+
getColumnSortIndex(columnName) {
|
|
4598
|
+
const index = this.sortedFields().findIndex((sf) => sf.name === columnName);
|
|
4599
|
+
return index >= 0 ? index + 1 : undefined;
|
|
4600
|
+
}
|
|
4601
|
+
/** True when active sorts still match the current view defaults (not yet customized). */
|
|
4602
|
+
isViewDefaultSorts(activeSorts) {
|
|
4603
|
+
const viewSorts = this.view().sorts ?? [];
|
|
4604
|
+
if (activeSorts.length !== viewSorts.length) {
|
|
4605
|
+
return false;
|
|
4606
|
+
}
|
|
4607
|
+
return activeSorts.every((s, i) => s.name === viewSorts[i]?.name && s.dir === viewSorts[i]?.dir);
|
|
4608
|
+
}
|
|
4609
|
+
/**
|
|
4610
|
+
* Toggles column sort (asc → desc → none). Without Ctrl, only one column is active.
|
|
4611
|
+
* With Ctrl/Cmd, multiple columns are sorted in click order (first clicked = primary).
|
|
4612
|
+
*/
|
|
4613
|
+
async toggleColumnSort(columnName, multiSort) {
|
|
4614
|
+
const fieldMeta = this.sortableFields().find((f) => f.name === columnName);
|
|
4615
|
+
if (!fieldMeta) {
|
|
4616
|
+
return;
|
|
4617
|
+
}
|
|
4618
|
+
let activeSorts = [...this.sortedFields()];
|
|
4619
|
+
const index = activeSorts.findIndex((sf) => sf.name === columnName);
|
|
4620
|
+
const currentDir = index >= 0 ? activeSorts[index].dir : undefined;
|
|
4621
|
+
const newDir = currentDir === 'asc' ? 'desc' : currentDir === 'desc' ? undefined : 'asc';
|
|
4622
|
+
if (!multiSort) {
|
|
4623
|
+
activeSorts = newDir ? [{ name: columnName, title: fieldMeta.title, dir: newDir }] : [];
|
|
4624
|
+
}
|
|
4625
|
+
else if (index >= 0) {
|
|
4626
|
+
const [item] = activeSorts.splice(index, 1);
|
|
4627
|
+
if (newDir) {
|
|
4628
|
+
// Re-click moves column to end so click order can override view/default order.
|
|
4629
|
+
activeSorts.push({ ...item, title: fieldMeta.title, dir: newDir });
|
|
4630
|
+
}
|
|
4631
|
+
}
|
|
4632
|
+
else if (newDir) {
|
|
4633
|
+
if (this.isViewDefaultSorts(activeSorts)) {
|
|
4634
|
+
activeSorts = [{ name: columnName, title: fieldMeta.title, dir: newDir }];
|
|
4635
|
+
}
|
|
4636
|
+
else {
|
|
4637
|
+
activeSorts.push({ name: columnName, title: fieldMeta.title, dir: newDir });
|
|
4638
|
+
}
|
|
4639
|
+
}
|
|
4640
|
+
this.sortedFields.set(activeSorts);
|
|
4641
|
+
this.lastAppliedSortKey = null;
|
|
4642
|
+
await this.saveSettings('sorts', activeSorts.map((s) => ({ name: s.name, dir: s.dir })));
|
|
4643
|
+
await this.applyFilterAndSort();
|
|
4584
4644
|
}
|
|
4585
4645
|
//****************** Commands ******************//
|
|
4586
4646
|
async executeCommand(commandName, data = null) {
|