tabstrips

This commit is contained in:
Jan Prochazka
2022-02-13 08:22:23 +01:00
parent 488b200fcb
commit e0b8eb3e79
10 changed files with 354 additions and 291 deletions

View File

@@ -1,60 +1,60 @@
<script lang="ts" context="module">
const getCurrentEditor = () => getActiveComponent('TableEditor');
// registerCommand({
// id: 'tableEditor.addColumn',
// category: 'Table editor',
// name: 'Add column',
// icon: 'icon add-column',
// toolbar: true,
// isRelatedToTab: true,
// testEnabled: () => getCurrentEditor()?.writable(),
// onClick: () => getCurrentEditor().addColumn(),
// });
registerCommand({
id: 'tableEditor.addColumn',
category: 'Table editor',
name: 'Add column',
icon: 'icon add-column',
toolbar: true,
isRelatedToTab: true,
testEnabled: () => getCurrentEditor()?.writable(),
onClick: () => getCurrentEditor().addColumn(),
});
// registerCommand({
// id: 'tableEditor.addPrimaryKey',
// category: 'Table editor',
// name: 'Add primary key',
// icon: 'icon add-key',
// toolbar: true,
// isRelatedToTab: true,
// testEnabled: () => getCurrentEditor()?.allowAddPrimaryKey(),
// onClick: () => getCurrentEditor().addPrimaryKey(),
// });
registerCommand({
id: 'tableEditor.addPrimaryKey',
category: 'Table editor',
name: 'Add primary key',
icon: 'icon add-key',
toolbar: true,
isRelatedToTab: true,
testEnabled: () => getCurrentEditor()?.allowAddPrimaryKey(),
onClick: () => getCurrentEditor().addPrimaryKey(),
});
// registerCommand({
// id: 'tableEditor.addForeignKey',
// category: 'Table editor',
// name: 'Add foreign key',
// icon: 'icon add-key',
// toolbar: true,
// isRelatedToTab: true,
// testEnabled: () => getCurrentEditor()?.writable(),
// onClick: () => getCurrentEditor().addForeignKey(),
// });
registerCommand({
id: 'tableEditor.addForeignKey',
category: 'Table editor',
name: 'Add foreign key',
icon: 'icon add-key',
toolbar: true,
isRelatedToTab: true,
testEnabled: () => getCurrentEditor()?.writable(),
onClick: () => getCurrentEditor().addForeignKey(),
});
// registerCommand({
// id: 'tableEditor.addIndex',
// category: 'Table editor',
// name: 'Add index',
// icon: 'icon add-key',
// toolbar: true,
// isRelatedToTab: true,
// testEnabled: () => getCurrentEditor()?.writable(),
// onClick: () => getCurrentEditor().addIndex(),
// });
registerCommand({
id: 'tableEditor.addIndex',
category: 'Table editor',
name: 'Add index',
icon: 'icon add-key',
toolbar: true,
isRelatedToTab: true,
testEnabled: () => getCurrentEditor()?.writable(),
onClick: () => getCurrentEditor().addIndex(),
});
// registerCommand({
// id: 'tableEditor.addUnique',
// category: 'Table editor',
// name: 'Add unique',
// icon: 'icon add-key',
// toolbar: true,
// isRelatedToTab: true,
// testEnabled: () => getCurrentEditor()?.writable(),
// onClick: () => getCurrentEditor().addUnique(),
// });
registerCommand({
id: 'tableEditor.addUnique',
category: 'Table editor',
name: 'Add unique',
icon: 'icon add-key',
toolbar: true,
isRelatedToTab: true,
testEnabled: () => getCurrentEditor()?.writable(),
onClick: () => getCurrentEditor().addUnique(),
});
</script>
<script lang="ts">
@@ -105,9 +105,9 @@
});
}
// export function allowAddPrimaryKey() {
// return writable() && !tableInfo?.primaryKey;
// }
export function allowAddPrimaryKey() {
return writable() && !tableInfo?.primaryKey;
}
export function addPrimaryKey() {
showModal(PrimaryKeyEditorModal, {