mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-26 19:06:02 +00:00
perspective arrange button
This commit is contained in:
@@ -67,7 +67,7 @@ export interface PerspectiveNodeConfig {
|
|||||||
filters: { [uniqueName: string]: string };
|
filters: { [uniqueName: string]: string };
|
||||||
isAutoGenerated?: true | undefined;
|
isAutoGenerated?: true | undefined;
|
||||||
|
|
||||||
position: {
|
position?: {
|
||||||
x: number;
|
x: number;
|
||||||
y: number;
|
y: number;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
toolbar: true,
|
toolbar: true,
|
||||||
isRelatedToTab: true,
|
isRelatedToTab: true,
|
||||||
testEnabled: () => getCurrentEditor()?.canArrange(),
|
testEnabled: () => getCurrentEditor()?.canArrange(),
|
||||||
|
// testEnabled: () => !!getCurrentEditor(),
|
||||||
onClick: () => getCurrentEditor().arrange(),
|
onClick: () => getCurrentEditor().arrange(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@
|
|||||||
useDatabaseReferences: false,
|
useDatabaseReferences: false,
|
||||||
allowScrollColumns: true,
|
allowScrollColumns: true,
|
||||||
allowAddAllReferences: false,
|
allowAddAllReferences: false,
|
||||||
canArrange: false,
|
canArrange: true,
|
||||||
canExport: false,
|
canExport: false,
|
||||||
canSelectColumns: true,
|
canSelectColumns: true,
|
||||||
canSelectTables: false,
|
canSelectTables: false,
|
||||||
|
|||||||
@@ -40,8 +40,8 @@
|
|||||||
import openNewTab from '../utility/openNewTab';
|
import openNewTab from '../utility/openNewTab';
|
||||||
import { getFilterValueExpression } from 'dbgate-filterparser';
|
import { getFilterValueExpression } from 'dbgate-filterparser';
|
||||||
|
|
||||||
const dbg = debug('dbgate:PerspectivaTable');
|
const dbg = debug('dbgate:PerspectiveTable');
|
||||||
export const activator = createActivator('PerspectiveTable', true);
|
export const activator = createActivator('PerspectiveTable', true, ['Designer']);
|
||||||
|
|
||||||
export let root: PerspectiveTreeNode;
|
export let root: PerspectiveTreeNode;
|
||||||
export let loadedCounts;
|
export let loadedCounts;
|
||||||
|
|||||||
@@ -134,6 +134,7 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<svelte:fragment slot="toolstrip">
|
<svelte:fragment slot="toolstrip">
|
||||||
|
<ToolStripCommandButton command="designer.arrange" />
|
||||||
<ToolStripCommandButton command="perspective.refresh" />
|
<ToolStripCommandButton command="perspective.refresh" />
|
||||||
<ToolStripCommandButton command="perspective.customJoin" />
|
<ToolStripCommandButton command="perspective.customJoin" />
|
||||||
<ToolStripSaveButton idPrefix="perspective" />
|
<ToolStripSaveButton idPrefix="perspective" />
|
||||||
|
|||||||
@@ -12,7 +12,11 @@ function isParent(parent, child) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function createActivator(name: string, activateOnTabVisible: boolean) {
|
export default function createActivator(
|
||||||
|
name: string,
|
||||||
|
activateOnTabVisible: boolean = false,
|
||||||
|
friendActivators: string[] = []
|
||||||
|
) {
|
||||||
const instance = get_current_component();
|
const instance = get_current_component();
|
||||||
const tabVisible: any = getContext('tabVisible');
|
const tabVisible: any = getContext('tabVisible');
|
||||||
const tabid = getContext('tabid');
|
const tabid = getContext('tabid');
|
||||||
@@ -38,11 +42,19 @@ export default function createActivator(name: string, activateOnTabVisible: bool
|
|||||||
|
|
||||||
const activate = () => {
|
const activate = () => {
|
||||||
const toDelete = [];
|
const toDelete = [];
|
||||||
|
|
||||||
|
// console.log('ACTIVATE', instance);
|
||||||
|
|
||||||
for (const key in lastActiveDictionary) {
|
for (const key in lastActiveDictionary) {
|
||||||
if (isParent(lastActiveDictionary[key], instance)) continue;
|
if (isParent(lastActiveDictionary[key], instance)) continue;
|
||||||
if (isParent(instance, lastActiveDictionary[key])) continue;
|
if (isParent(instance, lastActiveDictionary[key])) continue;
|
||||||
|
if (friendActivators.includes(key)) continue;
|
||||||
|
|
||||||
toDelete.push(key);
|
toDelete.push(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// console.log('toDelete', toDelete);
|
||||||
|
|
||||||
for (const del of toDelete) {
|
for (const del of toDelete) {
|
||||||
delete lastActiveDictionary[del];
|
delete lastActiveDictionary[del];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user