mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-29 02:56:01 +00:00
grayed nodes in perspective designer
This commit is contained in:
@@ -190,6 +190,12 @@ export abstract class PerspectiveTreeNode {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get hasUncheckedNodeInPath() {
|
||||||
|
if (!this.parentNode) return false;
|
||||||
|
if (!this.isCheckedNode) return true;
|
||||||
|
return this.parentNode.hasUncheckedNodeInPath;
|
||||||
|
}
|
||||||
|
|
||||||
get childDataColumn() {
|
get childDataColumn() {
|
||||||
if (this.isCheckedColumn) {
|
if (this.isCheckedColumn) {
|
||||||
return this.codeName;
|
return this.codeName;
|
||||||
|
|||||||
@@ -66,7 +66,8 @@
|
|||||||
$: top = table?.top;
|
$: top = table?.top;
|
||||||
$: mainIcon = settings?.getMainTableIcon ? settings?.getMainTableIcon(designerId) : null;
|
$: mainIcon = settings?.getMainTableIcon ? settings?.getMainTableIcon(designerId) : null;
|
||||||
$: specificDb = settings?.tableSpecificDb ? settings?.tableSpecificDb(designerId) : null;
|
$: specificDb = settings?.tableSpecificDb ? settings?.tableSpecificDb(designerId) : null;
|
||||||
$: filterParentRows = settings?.hasFilterParentRowsFlag ? settings?.hasFilterParentRowsFlag(designerId) : null;
|
$: filterParentRows = settings?.hasFilterParentRowsFlag ? settings?.hasFilterParentRowsFlag(designerId) : false;
|
||||||
|
$: isGrayed = settings?.isGrayedTable ? settings?.isGrayedTable(designerId) : false;
|
||||||
|
|
||||||
export function isSelected() {
|
export function isSelected() {
|
||||||
return table?.isSelectedTable;
|
return table?.isSelectedTable;
|
||||||
@@ -234,6 +235,7 @@
|
|||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="header"
|
class="header"
|
||||||
|
class:isGrayed
|
||||||
class:isTable={objectTypeField == 'tables'}
|
class:isTable={objectTypeField == 'tables'}
|
||||||
class:isView={objectTypeField == 'views'}
|
class:isView={objectTypeField == 'views'}
|
||||||
use:moveDrag={settings?.canSelectColumns ? [handleMoveStart, handleMove, handleMoveEnd] : null}
|
use:moveDrag={settings?.canSelectColumns ? [handleMoveStart, handleMove, handleMoveEnd] : null}
|
||||||
@@ -355,6 +357,9 @@
|
|||||||
.header.isView {
|
.header.isView {
|
||||||
background: var(--theme-bg-magenta);
|
background: var(--theme-bg-magenta);
|
||||||
}
|
}
|
||||||
|
.header.isGrayed {
|
||||||
|
background: var(--theme-bg-2);
|
||||||
|
}
|
||||||
.close {
|
.close {
|
||||||
background: var(--theme-bg-1);
|
background: var(--theme-bg-1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,7 +125,7 @@
|
|||||||
root &&
|
root &&
|
||||||
config.nodes.find(x => !x.position) &&
|
config.nodes.find(x => !x.position) &&
|
||||||
perspectiveNodesHaveStructure(config, dbInfos, conid, database) &&
|
perspectiveNodesHaveStructure(config, dbInfos, conid, database) &&
|
||||||
config.nodes.every(x => root.findNodeByDesignerId(x.designerId))
|
config.nodes.every(x => root?.findNodeByDesignerId(x.designerId))
|
||||||
) {
|
) {
|
||||||
await tick();
|
await tick();
|
||||||
runCommand('designer.arrange');
|
runCommand('designer.arrange');
|
||||||
@@ -152,8 +152,8 @@
|
|||||||
return [{ text: 'Remove', onClick: () => onRemoveReference(reference) }];
|
return [{ text: 'Remove', onClick: () => onRemoveReference(reference) }];
|
||||||
},
|
},
|
||||||
columnMenu: ({ designer, designerId, column, foreignKey }) => {
|
columnMenu: ({ designer, designerId, column, foreignKey }) => {
|
||||||
const node = root.findNodeByDesignerId(designerId);
|
const node = root?.findNodeByDesignerId(designerId);
|
||||||
const child = node.childNodes.find(x => x.columnName == column.columnName);
|
const child = node?.childNodes?.find(x => x.columnName == column.columnName);
|
||||||
return getPerspectiveNodeMenu({
|
return getPerspectiveNodeMenu({
|
||||||
config,
|
config,
|
||||||
setConfig,
|
setConfig,
|
||||||
@@ -165,7 +165,7 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
tableMenu: ({ designer, designerId, onRemoveTable }) => {
|
tableMenu: ({ designer, designerId, onRemoveTable }) => {
|
||||||
const node = root.findNodeByDesignerId(designerId);
|
const node = root?.findNodeByDesignerId(designerId);
|
||||||
return [
|
return [
|
||||||
{ text: 'Remove', onClick: () => onRemoveTable({ designerId }) },
|
{ text: 'Remove', onClick: () => onRemoveTable({ designerId }) },
|
||||||
getPerspectiveNodeMenu({
|
getPerspectiveNodeMenu({
|
||||||
@@ -265,6 +265,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
hasFilterParentRowsFlag: designerId => !!config.nodes.find(x => x.designerId == designerId)?.isParentFilter,
|
hasFilterParentRowsFlag: designerId => !!config.nodes.find(x => x.designerId == designerId)?.isParentFilter,
|
||||||
|
isGrayedTable: designerId => {
|
||||||
|
const node = root?.findNodeByDesignerId(designerId);
|
||||||
|
if (!node) return true;
|
||||||
|
if (node?.hasUncheckedNodeInPath) return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
},
|
||||||
}}
|
}}
|
||||||
referenceComponent={QueryDesignerReference}
|
referenceComponent={QueryDesignerReference}
|
||||||
value={createDesignerModel(config, dbInfos)}
|
value={createDesignerModel(config, dbInfos)}
|
||||||
|
|||||||
Reference in New Issue
Block a user