mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 15:56:00 +00:00
checkedNodes => checkedColumns
This commit is contained in:
@@ -55,9 +55,9 @@ export interface PerspectiveNodeConfig {
|
||||
|
||||
isParentFilter?: true | undefined;
|
||||
|
||||
expandedNodes: string[];
|
||||
checkedNodes: string[];
|
||||
uncheckedNodes: string[];
|
||||
expandedColumns: string[];
|
||||
checkedColumns: string[];
|
||||
uncheckedColumns: string[];
|
||||
|
||||
sort: {
|
||||
columnName: string;
|
||||
@@ -98,9 +98,9 @@ export function createPerspectiveNodeConfig(name: { schemaName?: string; pureNam
|
||||
...name,
|
||||
designerId: uuidv1(),
|
||||
|
||||
expandedNodes: [],
|
||||
checkedNodes: [],
|
||||
uncheckedNodes: [],
|
||||
expandedColumns: [],
|
||||
checkedColumns: [],
|
||||
uncheckedColumns: [],
|
||||
|
||||
sort: [],
|
||||
filters: {},
|
||||
|
||||
@@ -131,11 +131,11 @@ export abstract class PerspectiveTreeNode {
|
||||
return 0;
|
||||
}
|
||||
get isExpanded() {
|
||||
return this.parentNodeConfig?.expandedNodes?.includes(this.codeName);
|
||||
return this.parentNodeConfig?.expandedColumns?.includes(this.codeName);
|
||||
}
|
||||
get isChecked() {
|
||||
if (this.parentNodeConfig?.checkedNodes?.includes(this.codeName)) return true;
|
||||
if (this.parentNodeConfig?.uncheckedNodes?.includes(this.codeName)) return false;
|
||||
if (this.parentNodeConfig?.checkedColumns?.includes(this.codeName)) return true;
|
||||
if (this.parentNodeConfig?.uncheckedColumns?.includes(this.codeName)) return false;
|
||||
return this.defaultChecked;
|
||||
}
|
||||
get columnTitle() {
|
||||
@@ -179,14 +179,14 @@ export abstract class PerspectiveTreeNode {
|
||||
}
|
||||
|
||||
toggleExpanded(value?: boolean) {
|
||||
this.includeInNodeSet('expandedNodes', value == null ? !this.isExpanded : value);
|
||||
this.includeInNodeSet('expandedColumns', value == null ? !this.isExpanded : value);
|
||||
}
|
||||
|
||||
toggleChecked(value?: boolean) {
|
||||
if (this.defaultChecked) {
|
||||
this.includeInNodeSet('uncheckedNodes', value == null ? this.isChecked : value);
|
||||
this.includeInNodeSet('uncheckedColumns', value == null ? this.isChecked : value);
|
||||
} else {
|
||||
this.includeInNodeSet('checkedNodes', value == null ? !this.isChecked : value);
|
||||
this.includeInNodeSet('checkedColumns', value == null ? !this.isChecked : value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@ export abstract class PerspectiveTreeNode {
|
||||
return cfg;
|
||||
}
|
||||
|
||||
includeInNodeSet(field: 'expandedNodes' | 'uncheckedNodes' | 'checkedNodes', isIncluded: boolean) {
|
||||
includeInNodeSet(field: 'expandedColumns' | 'uncheckedColumns' | 'checkedColumns', isIncluded: boolean) {
|
||||
this.setConfig(cfg => {
|
||||
const changedFields = n => ({
|
||||
...n,
|
||||
@@ -225,7 +225,7 @@ export abstract class PerspectiveTreeNode {
|
||||
});
|
||||
|
||||
cfg = this.parentNode?.ensureNodeConfig(cfg);
|
||||
if (isIncluded && field == 'expandedNodes') {
|
||||
if (isIncluded && field == 'expandedColumns') {
|
||||
cfg = this.ensureNodeConfig(cfg);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ test('test flat view', () => {
|
||||
test('test one level nesting', () => {
|
||||
const artistTable = chinookDbInfo.tables.find(x => x.pureName == 'Artist');
|
||||
const config = createPerspectiveConfig({ pureName: 'Artist' });
|
||||
config.nodes[0].checkedNodes = ['Album'];
|
||||
config.nodes[0].checkedColumns = ['Album'];
|
||||
const root = new PerspectiveTableNode(
|
||||
artistTable,
|
||||
{ conid: { db: chinookDbInfo } },
|
||||
@@ -98,8 +98,8 @@ test('test two level nesting', () => {
|
||||
designerId: '1',
|
||||
columns: [{ source: 'ArtistId', target: 'ArtistId' }],
|
||||
});
|
||||
config.nodes[0].checkedNodes = ['Album'];
|
||||
config.nodes[1].checkedNodes = ['Track'];
|
||||
config.nodes[0].checkedColumns = ['Album'];
|
||||
config.nodes[1].checkedColumns = ['Track'];
|
||||
|
||||
const root = new PerspectiveTableNode(
|
||||
artistTable,
|
||||
|
||||
Reference in New Issue
Block a user