perspectives:add to filter ctx menu

This commit is contained in:
Jan Prochazka
2022-08-04 08:26:35 +02:00
parent 9051ba2ee1
commit 97dc92e413
6 changed files with 53 additions and 27 deletions

View File

@@ -5,6 +5,7 @@ import {
PerspectiveConfig,
PerspectiveConfigColumns,
PerspectiveCustomJoinConfig,
PerspectiveFilterColumnInfo,
} from './PerspectiveConfig';
import _isEqual from 'lodash/isEqual';
import _cloneDeep from 'lodash/cloneDeep';
@@ -152,25 +153,25 @@ export abstract class PerspectiveTreeNode {
}
}
setFilter(value) {
this.setConfig(
cfg => ({
...cfg,
filters: {
...cfg.filters,
[this.uniqueName]: value,
},
filterInfos: {
...cfg.filterInfos,
[this.uniqueName]: {
columnName: this.columnName,
filterType: this.filterType,
},
},
}),
true
);
}
// setFilter(value) {
// this.setConfig(
// cfg => ({
// ...cfg,
// filters: {
// ...cfg.filters,
// [this.uniqueName]: value,
// },
// filterInfos: {
// ...cfg.filterInfos,
// [this.uniqueName]: {
// columnName: this.columnName,
// filterType: this.filterType,
// },
// },
// }),
// true
// );
// }
getFilter() {
return this.config.filters[this.uniqueName];
@@ -232,6 +233,10 @@ export abstract class PerspectiveTreeNode {
getBaseTableFromThis() {
return null;
}
get filterInfo(): PerspectiveFilterColumnInfo {
return null;
}
}
export class PerspectiveTableColumnNode extends PerspectiveTreeNode {
@@ -344,6 +349,14 @@ export class PerspectiveTableColumnNode extends PerspectiveTreeNode {
return this.refTable;
}
get filterInfo(): PerspectiveFilterColumnInfo {
return {
columnName: this.columnName,
filterType: this.filterType,
tableName: this.column.pureName,
};
}
parseFilterCondition() {
const filter = this.getFilter();
if (!filter) return null;