CB-3372 feat: codemirror6 autocomplete (#1646)

* CB-3372 feat: codemirror6 autocomplete

* CB-3372 feat: autocomplete icons

* CB-3371 feat: sql editor syntax highlight

* CB-3371 fix: syntax highlight blinking

* CB-3371 fix: editor extensions state

* CB-3372 chore: code cleanup

* CB-3372 fix: remove useSqlDIalectAutocompletion

* CB-3372 fix: add useSqlDIalectAutocompletion

* CB-3372 feat: experimental context menu

* CB-3372 feat: use new sql editor

* CB-3372 chore: remove sql script parser

* CB-3372 fix: rounded menu

* CB-3372 fix: event preventDefault on dialog

* CB-3372 fix: context menu styles

* CB-3372 feat: remove old codemirror

* CB-3372 fix: numbers completion & extensions caching

* CB-3372 fix: table display

* CB-3372 fix: decrease sql editor font size

* CB-3372 fix: copy in readonly mode & autocompletion in safari on MacOS

* CB-3372 fix: value panel styles

* CB-3372 fix: menu bar styles

* CB-3372 fix: menu bar and inline editor styles

* CB-3372 fix: menu and inline editor styles

* CB-3372 chore: update bundle

---------

Co-authored-by: dariamarutkina <125263541+dariamarutkina@users.noreply.github.com>
This commit is contained in:
Alexey
2023-05-17 17:32:09 +03:00
committed by GitHub
co-authored by dariamarutkina
parent a219593e1d
commit 64040bc3a3
151 changed files with 2224 additions and 2303 deletions
@@ -0,0 +1,59 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2023 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
import { Bootstrap, injectable } from '@cloudbeaver/core-di';
import { ResultDataFormat } from '@cloudbeaver/core-sdk';
import { DatabaseEditAction, TableFooterMenuService } from '@cloudbeaver/plugin-data-viewer';
import { ScriptPreviewService } from './ScriptPreview/ScriptPreviewService';
@injectable()
export class GeneratorMenuBootstrap extends Bootstrap {
constructor(
private readonly scriptPreviewService: ScriptPreviewService,
private readonly tableFooterMenuService: TableFooterMenuService,
) {
super();
}
register(): void {
this.tableFooterMenuService.registerMenuItem({
id: 'script',
order: 3,
title: 'data_viewer_script_preview',
tooltip: 'data_viewer_script_preview',
icon: 'sql-script-preview',
isPresent(context) {
return context.contextType === TableFooterMenuService.nodeContextType;
},
isHidden(context) {
return context.data.model.isReadonly(context.data.resultIndex)
|| context.data.model.source.getResult(context.data.resultIndex)?.dataFormat !== ResultDataFormat.Resultset;
},
isDisabled(context) {
if (
context.data.model.isLoading()
|| context.data.model.isDisabled(context.data.resultIndex)
|| !context.data.model.source.hasResult(context.data.resultIndex)
) {
return true;
}
const editor = context.data.model.source.getActionImplementation(
context.data.resultIndex,
DatabaseEditAction
);
return !editor?.isEdited();
},
onClick: async context => {
await this.scriptPreviewService.open(context.data.model, context.data.resultIndex);
},
});
}
load(): void | Promise<void> { }
}