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