perspective expand fix

This commit is contained in:
Jan Prochazka 2022-10-13 15:22:23 +02:00
parent bf4eb19ef5
commit 69a87bc076

View File

@ -108,14 +108,14 @@ export abstract class PerspectiveTreeNode {
get namedObject(): NamedObjectInfo { get namedObject(): NamedObjectInfo {
return null; return null;
} }
get parentTableNode(): PerspectiveTableNode { get tableNodeOrParent(): PerspectiveTableNode {
if (this instanceof PerspectiveTableNode) { if (this instanceof PerspectiveTableNode) {
return this; return this;
} }
if (this.parentNode == null) { if (this.parentNode == null) {
return null; return null;
} }
return this.parentNode.parentTableNode; return this.parentNode.tableNodeOrParent;
} }
get engineType(): PerspectiveDatabaseEngineType { get engineType(): PerspectiveDatabaseEngineType {
return null; return null;
@ -289,14 +289,15 @@ export abstract class PerspectiveTreeNode {
[field]: isIncluded ? [...(n[field] || []), this.codeName] : (n[field] || []).filter(x => x != this.codeName), [field]: isIncluded ? [...(n[field] || []), this.codeName] : (n[field] || []).filter(x => x != this.codeName),
}); });
const [cfgChanged, nodeCfg] = this.parentTableNode?.ensureNodeConfig(cfg); const [cfgChanged, nodeCfg] = this.parentNode?.tableNodeOrParent?.ensureNodeConfig(cfg);
return { const res = {
...cfgChanged, ...cfgChanged,
nodes: cfgChanged.nodes.map(n => nodes: cfgChanged.nodes.map(n =>
n.designerId == (this.parentTableNode?.designerId || nodeCfg?.designerId) ? changedFields(n) : n n.designerId == (this.parentNode?.tableNodeOrParent?.designerId || nodeCfg?.designerId) ? changedFields(n) : n
), ),
}; };
return res;
}); });
} }
@ -756,7 +757,7 @@ export class PerspectivePatternColumnNode extends PerspectiveTreeNode {
designerId: string designerId: string
) { ) {
super(dbs, config, setConfig, parentNode, dataProvider, databaseConfig, designerId); super(dbs, config, setConfig, parentNode, dataProvider, databaseConfig, designerId);
this.parentNodeConfig = this.parentTableNode?.nodeConfig; this.parentNodeConfig = this.tableNodeOrParent?.nodeConfig;
} }
get isChildColumn() { get isChildColumn() {
@ -812,7 +813,7 @@ export class PerspectivePatternColumnNode extends PerspectiveTreeNode {
get generatesHiearchicGridColumn() { get generatesHiearchicGridColumn() {
// console.log('generatesHiearchicGridColumn', this.parentTableNode?.nodeConfig?.checkedColumns, this.codeName + '::'); // console.log('generatesHiearchicGridColumn', this.parentTableNode?.nodeConfig?.checkedColumns, this.codeName + '::');
return !!this.parentTableNode?.nodeConfig?.checkedColumns?.find(x => x.startsWith(this.codeName + '::')); return !!this.tableNodeOrParent?.nodeConfig?.checkedColumns?.find(x => x.startsWith(this.codeName + '::'));
} }
// get generatesHiearchicGridColumn() { // get generatesHiearchicGridColumn() {