show sort in perspective deisgner and tree

This commit is contained in:
Jan Prochazka
2022-08-28 12:02:38 +02:00
parent 14110cb6db
commit f405db7685
8 changed files with 147 additions and 70 deletions

View File

@@ -26,6 +26,7 @@ import _flatten from 'lodash/flatten';
import _uniqBy from 'lodash/uniqBy';
import _sortBy from 'lodash/sortBy';
import _cloneDeepWith from 'lodash/cloneDeepWith';
import _findIndex from 'lodash/findIndex';
import {
PerspectiveDatabaseConfig,
PerspectiveDataLoadProps,
@@ -440,6 +441,16 @@ export abstract class PerspectiveTreeNode {
getParentJoinCondition(alias: string, parentAlias: string): Condition[] {
return [];
}
get sortOrder() {
return this.parentNodeConfig?.sort?.find(x => x.columnName == this.columnName)?.order;
}
get sortOrderIndex() {
return this.parentNodeConfig?.sort?.length > 1
? _findIndex(this.parentNodeConfig?.sort, x => x.columnName == this.columnName)
: -1;
}
}
export class PerspectiveTableColumnNode extends PerspectiveTreeNode {