mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode 27ada910e121e23a6d95ecca9cae595fb98ab568
This commit is contained in:
@@ -91,13 +91,13 @@ export class Insight {
|
||||
|
||||
private findctor(type: ChartType | InsightType): IInsightCtor {
|
||||
if (find(Graph.types, x => x === type as ChartType)) {
|
||||
return Graph;
|
||||
return Graph as IInsightCtor;
|
||||
} else if (find(ImageInsight.types, x => x === type as InsightType)) {
|
||||
return ImageInsight;
|
||||
return ImageInsight as IInsightCtor;
|
||||
} else if (find(TableInsight.types, x => x === type as InsightType)) {
|
||||
return TableInsight;
|
||||
return TableInsight as IInsightCtor;
|
||||
} else if (find(CountInsight.types, x => x === type as InsightType)) {
|
||||
return CountInsight;
|
||||
return CountInsight as IInsightCtor;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import { mixin } from 'sql/base/common/objects';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import { IInsightOptions, InsightType, ChartType } from 'sql/workbench/contrib/charts/common/interfaces';
|
||||
import { IInsightData } from 'sql/platform/dashboard/browser/insightRegistry';
|
||||
import { BrandedService } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
export interface IPointDataSet {
|
||||
data: Array<{ x: number | string, y: number }>;
|
||||
@@ -42,6 +43,6 @@ export interface IInsight {
|
||||
}
|
||||
|
||||
export interface IInsightCtor {
|
||||
new(container: HTMLElement, options: IInsightOptions, ...services: { _serviceBrand: undefined; }[]): IInsight;
|
||||
new <Services extends BrandedService[]>(container: HTMLElement, options: IInsightOptions, ...services: Services): IInsight;
|
||||
readonly types: Array<InsightType | ChartType>;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ export class DashboardNavSection extends DashboardTab implements OnDestroy, OnCh
|
||||
dashboardHelper.filterConfigs
|
||||
];
|
||||
|
||||
private readonly _gridModifiers: Array<(item: Array<WidgetConfig>, originalConfig: Array<WidgetConfig>) => Array<WidgetConfig>> = [
|
||||
private readonly _gridModifiers: Array<(item: Array<WidgetConfig>, originalConfig?: Array<WidgetConfig>) => Array<WidgetConfig>> = [
|
||||
dashboardHelper.validateGridConfig
|
||||
];
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ import { ContextKeyExpr, IContextKeyService } from 'vs/platform/contextkey/commo
|
||||
import { WidgetConfig } from 'sql/workbench/contrib/dashboard/browser/core/dashboardWidget';
|
||||
import { Extensions, IInsightRegistry } from 'sql/platform/dashboard/browser/insightRegistry';
|
||||
import { ConnectionManagementInfo } from 'sql/platform/connection/common/connectionManagementInfo';
|
||||
import { DashboardServiceInterface } from 'sql/workbench/contrib/dashboard/browser/services/dashboardServiceInterface.service';
|
||||
import { WIDGETS_CONTAINER } from 'sql/workbench/contrib/dashboard/browser/containers/dashboardWidgetContainer.contribution';
|
||||
import { GRID_CONTAINER } from 'sql/workbench/contrib/dashboard/browser/containers/dashboardGridContainer.contribution';
|
||||
import { WEBVIEW_CONTAINER } from 'sql/workbench/contrib/dashboard/browser/containers/dashboardWebviewContainer.contribution';
|
||||
@@ -111,7 +110,7 @@ export function addProvider<T extends { connectionManagementService: SingleConne
|
||||
* Adds the edition to the passed widgets and returns the new widgets
|
||||
* @param widgets Array of widgets to add edition onto
|
||||
*/
|
||||
export function addEdition<T extends { connectionManagementService: SingleConnectionManagementService }>(config: WidgetConfig[], collection: DashboardServiceInterface): Array<WidgetConfig> {
|
||||
export function addEdition<T extends { connectionManagementService: SingleConnectionManagementService }>(config: WidgetConfig[], collection: T): Array<WidgetConfig> {
|
||||
const connectionInfo: ConnectionManagementInfo = collection.connectionManagementService.connectionInfo;
|
||||
if (connectionInfo.serverInfo) {
|
||||
const edition = connectionInfo.serverInfo.engineEditionId;
|
||||
|
||||
@@ -107,7 +107,7 @@ export abstract class DashboardPage extends AngularDisposable implements IConfig
|
||||
return this.dashboardService.scopedContextKeyService;
|
||||
}
|
||||
|
||||
private readonly _gridModifiers: Array<(item: Array<WidgetConfig>, originalConfig: Array<WidgetConfig>) => Array<WidgetConfig>> = [
|
||||
private readonly _gridModifiers: Array<(item: Array<WidgetConfig>, originalConfig?: Array<WidgetConfig>) => Array<WidgetConfig>> = [
|
||||
dashboardHelper.validateGridConfig
|
||||
];
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ MenuRegistry.appendMenuItem(MenuId.ObjectExplorerItemContext, {
|
||||
when: ContextKeyExpr.or(ContextKeyExpr.and(TreeNodeContextKey.Status.notEqualsTo('Unavailable'), TreeNodeContextKey.NodeType.isEqualTo('Server')), ContextKeyExpr.and(TreeNodeContextKey.Status.notEqualsTo('Unavailable'), TreeNodeContextKey.NodeType.isEqualTo('Database')))
|
||||
});
|
||||
|
||||
const dashboardEditorDescriptor = new EditorDescriptor(
|
||||
const dashboardEditorDescriptor = EditorDescriptor.create(
|
||||
DashboardEditor,
|
||||
DashboardEditor.ID,
|
||||
localize('dashboard.editor.label', "Dashboard")
|
||||
|
||||
@@ -7,16 +7,17 @@ import { localize } from 'vs/nls';
|
||||
import { forEach } from 'vs/base/common/collections';
|
||||
import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IViewContainersRegistry, ViewContainer, Extensions as ViewContainerExtensions, ITreeViewDescriptor, IViewsRegistry } from 'vs/workbench/common/views';
|
||||
import { IViewContainersRegistry, ViewContainer, Extensions as ViewContainerExtensions, IViewsRegistry } from 'vs/workbench/common/views';
|
||||
import { IExtensionPoint, ExtensionsRegistry, ExtensionMessageCollector } from 'vs/workbench/services/extensions/common/extensionsRegistry';
|
||||
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { coalesce } from 'vs/base/common/arrays';
|
||||
|
||||
import { CustomTreeViewPane, CustomTreeView } from 'sql/workbench/browser/parts/views/customView';
|
||||
import { CustomTreeView, TreeViewPane } from 'sql/workbench/browser/parts/views/treeView';
|
||||
import { VIEWLET_ID } from 'sql/workbench/contrib/dataExplorer/browser/dataExplorerViewlet';
|
||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
import { ICustomViewDescriptor } from 'vs/workbench/api/browser/viewsExtensionPoint';
|
||||
|
||||
interface IUserFriendlyViewDescriptor {
|
||||
id: string;
|
||||
@@ -103,14 +104,15 @@ export class DataExplorerContainerExtensionHandler implements IWorkbenchContribu
|
||||
return null;
|
||||
}
|
||||
|
||||
const viewDescriptor = <ITreeViewDescriptor>{
|
||||
const viewDescriptor = <ICustomViewDescriptor>{
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
ctorDescriptor: new SyncDescriptor(CustomTreeViewPane),
|
||||
ctorDescriptor: new SyncDescriptor(TreeViewPane),
|
||||
when: ContextKeyExpr.deserialize(item.when),
|
||||
canToggleVisibility: true,
|
||||
canMoveView: true,
|
||||
treeView: this.instantiationService.createInstance(CustomTreeView, item.id, item.name),
|
||||
collapsed: this.showCollapsed(container),
|
||||
treeView: this.instantiationService.createInstance(CustomTreeView, item.id, item.name, container),
|
||||
extensionId: extension.description.identifier,
|
||||
originalContainerId: entry.key
|
||||
};
|
||||
|
||||
@@ -12,7 +12,7 @@ import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
|
||||
// Editor
|
||||
const editDataEditorDescriptor = new EditorDescriptor(
|
||||
const editDataEditorDescriptor = EditorDescriptor.create(
|
||||
EditDataEditor,
|
||||
EditDataEditor.ID,
|
||||
'EditData'
|
||||
@@ -22,7 +22,7 @@ Registry.as<IEditorRegistry>(Extensions.Editors)
|
||||
.registerEditor(editDataEditorDescriptor, [new SyncDescriptor(EditDataInput)]);
|
||||
|
||||
// Editor
|
||||
const editDataResultsEditorDescriptor = new EditorDescriptor(
|
||||
const editDataResultsEditorDescriptor = EditorDescriptor.create(
|
||||
EditDataResultsEditor,
|
||||
EditDataResultsEditor.ID,
|
||||
'EditDataResults'
|
||||
|
||||
@@ -21,7 +21,7 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
|
||||
import * as queryContext from 'sql/workbench/contrib/query/common/queryContext';
|
||||
import { Taskbar, ITaskbarContent } from 'sql/base/browser/ui/taskbar/taskbar';
|
||||
import { IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
import { IQueryModelService } from 'sql/workbench/services/query/common/queryModel';
|
||||
import { IEditorDescriptorService } from 'sql/workbench/services/queryEditor/browser/editorDescriptorService';
|
||||
import {
|
||||
@@ -321,7 +321,7 @@ export class EditDataEditor extends BaseEditor {
|
||||
// Create QueryTaskbar
|
||||
this._taskbarContainer = DOM.append(parentElement, DOM.$('div'));
|
||||
this._taskbar = new Taskbar(this._taskbarContainer, {
|
||||
actionViewItemProvider: (action: Action) => this._getChangeMaxRowsAction(action)
|
||||
actionViewItemProvider: (action: IAction) => this._getChangeMaxRowsAction(action)
|
||||
});
|
||||
|
||||
// Create Actions for the toolbar
|
||||
@@ -352,7 +352,7 @@ export class EditDataEditor extends BaseEditor {
|
||||
/**
|
||||
* Gets the IActionItem for the list of row number drop down
|
||||
*/
|
||||
private _getChangeMaxRowsAction(action: Action): IActionViewItem {
|
||||
private _getChangeMaxRowsAction(action: IAction): IActionViewItem {
|
||||
let actionID = ChangeMaxRowsAction.ID;
|
||||
if (action.id === actionID) {
|
||||
if (!this._changeMaxRowsActionItem) {
|
||||
|
||||
@@ -25,8 +25,8 @@ export class ShowRecommendedExtensionsByScenarioAction extends Action {
|
||||
|
||||
run(): Promise<void> {
|
||||
return this.viewletService.openViewlet(VIEWLET_ID, true)
|
||||
.then(viewlet => viewlet?.getViewPaneContainer())
|
||||
.then((viewlet: IExtensionsViewPaneContainer) => {
|
||||
.then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer)
|
||||
.then(viewlet => {
|
||||
viewlet.search('@' + this.scenarioType);
|
||||
viewlet.focus();
|
||||
});
|
||||
@@ -51,8 +51,8 @@ export class InstallRecommendedExtensionsByScenarioAction extends Action {
|
||||
run(): Promise<any> {
|
||||
if (!this.recommendations.length) { return Promise.resolve(); }
|
||||
return this.viewletService.openViewlet(VIEWLET_ID, true)
|
||||
.then(viewlet => viewlet?.getViewPaneContainer())
|
||||
.then((viewlet: IExtensionsViewPaneContainer) => {
|
||||
.then(viewlet => viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer)
|
||||
.then(viewlet => {
|
||||
viewlet.search('@' + this.scenarioType);
|
||||
viewlet.focus();
|
||||
const names = this.recommendations.map(({ extensionId }) => extensionId);
|
||||
|
||||
@@ -57,7 +57,7 @@ Registry.as<ILanguageAssociationRegistry>(LanguageAssociationExtensions.Language
|
||||
.registerLanguageAssociation(NotebookEditorInputAssociation.languages, NotebookEditorInputAssociation);
|
||||
|
||||
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
|
||||
.registerEditor(new EditorDescriptor(NotebookEditor, NotebookEditor.ID, localize('notebookEditor.name', "Notebook Editor")), [new SyncDescriptor(UntitledNotebookInput), new SyncDescriptor(FileNotebookInput)]);
|
||||
.registerEditor(EditorDescriptor.create(NotebookEditor, NotebookEditor.ID, localize('notebookEditor.name', "Notebook Editor")), [new SyncDescriptor(UntitledNotebookInput), new SyncDescriptor(FileNotebookInput)]);
|
||||
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
|
||||
.registerWorkbenchContribution(NotebookThemingContribution, LifecyclePhase.Restored);
|
||||
|
||||
@@ -14,7 +14,7 @@ import { ProfilerInput } from 'sql/workbench/browser/editor/profiler/profilerInp
|
||||
import { ProfilerEditor } from 'sql/workbench/contrib/profiler/browser/profilerEditor';
|
||||
import { PROFILER_VIEW_TEMPLATE_SETTINGS, PROFILER_SESSION_TEMPLATE_SETTINGS, IProfilerViewTemplate, IProfilerSessionTemplate, EngineType, PROFILER_FILTER_SETTINGS } from 'sql/workbench/services/profiler/browser/interfaces';
|
||||
|
||||
const profilerDescriptor = new EditorDescriptor(
|
||||
const profilerDescriptor = EditorDescriptor.create(
|
||||
ProfilerEditor,
|
||||
ProfilerEditor.ID,
|
||||
'ProfilerEditor'
|
||||
|
||||
@@ -395,7 +395,7 @@ export class ProfilerEditor extends BaseEditor {
|
||||
this._detailTable.updateRowCount();
|
||||
});
|
||||
|
||||
const detailTableCopyKeybind = new CopyKeybind();
|
||||
const detailTableCopyKeybind = new CopyKeybind<IDetailData>();
|
||||
detailTableCopyKeybind.onCopy((ranges: Slick.Range[]) => {
|
||||
// we always only get 1 item in the ranges
|
||||
if (ranges && ranges.length === 1) {
|
||||
|
||||
@@ -323,7 +323,7 @@ export abstract class GridTableBase<T> extends Disposable implements IView {
|
||||
private table: Table<T>;
|
||||
private actionBar: ActionBar;
|
||||
private container = document.createElement('div');
|
||||
private selectionModel = new CellSelectionModel();
|
||||
private selectionModel = new CellSelectionModel<T>();
|
||||
private styles: ITableStyles;
|
||||
private currentHeight: number;
|
||||
private dataProvider: AsyncDataProvider<T>;
|
||||
@@ -461,7 +461,7 @@ export abstract class GridTableBase<T> extends Disposable implements IView {
|
||||
this.renderGridDataRowsRange(startIndex, count);
|
||||
});
|
||||
this.rowNumberColumn = new RowNumberColumn({ numberOfRows: this.resultSet.rowCount });
|
||||
let copyHandler = new CopyKeybind();
|
||||
let copyHandler = new CopyKeybind<T>();
|
||||
copyHandler.onCopy(e => {
|
||||
new CopyResultAction(CopyResultAction.COPY_ID, CopyResultAction.COPY_LABEL, false).run(this.generateContext());
|
||||
});
|
||||
|
||||
@@ -57,10 +57,10 @@ Registry.as<ILanguageAssociationRegistry>(LanguageAssociationExtensions.Language
|
||||
.registerLanguageAssociation(QueryEditorLanguageAssociation.languages, QueryEditorLanguageAssociation, QueryEditorLanguageAssociation.isDefault);
|
||||
|
||||
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
|
||||
.registerEditor(new EditorDescriptor(QueryResultsEditor, QueryResultsEditor.ID, localize('queryResultsEditor.name', "Query Results")), [new SyncDescriptor(QueryResultsInput)]);
|
||||
.registerEditor(EditorDescriptor.create(QueryResultsEditor, QueryResultsEditor.ID, localize('queryResultsEditor.name', "Query Results")), [new SyncDescriptor(QueryResultsInput)]);
|
||||
|
||||
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
|
||||
.registerEditor(new EditorDescriptor(QueryEditor, QueryEditor.ID, localize('queryEditor.name', "Query Editor")), [new SyncDescriptor(FileQueryEditorInput), new SyncDescriptor(UntitledQueryEditorInput)]);
|
||||
.registerEditor(EditorDescriptor.create(QueryEditor, QueryEditor.ID, localize('queryEditor.name', "Query Editor")), [new SyncDescriptor(FileQueryEditorInput), new SyncDescriptor(UntitledQueryEditorInput)]);
|
||||
|
||||
const actionRegistry = <IWorkbenchActionRegistry>Registry.as(ActionExtensions.WorkbenchActions);
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import { SplitView, Sizing } from 'vs/base/browser/ui/splitview/splitview';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { ISelectionData } from 'azdata';
|
||||
import { Action, IActionViewItem } from 'vs/base/common/actions';
|
||||
import { IActionViewItem, IAction } from 'vs/base/common/actions';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { BaseTextEditor } from 'vs/workbench/browser/parts/editor/textEditor';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput';
|
||||
@@ -171,7 +171,7 @@ export class QueryEditor extends BaseEditor {
|
||||
// Create QueryTaskbar
|
||||
let taskbarContainer = DOM.append(parentElement, DOM.$('div'));
|
||||
this.taskbar = this._register(new Taskbar(taskbarContainer, {
|
||||
actionViewItemProvider: (action: Action) => this._getActionItemForAction(action),
|
||||
actionViewItemProvider: action => this._getActionItemForAction(action),
|
||||
}));
|
||||
|
||||
// Create Actions for the toolbar
|
||||
@@ -236,7 +236,7 @@ export class QueryEditor extends BaseEditor {
|
||||
* Gets the IActionItem for the List Databases dropdown if provided the associated Action.
|
||||
* Otherwise returns null.
|
||||
*/
|
||||
private _getActionItemForAction(action: Action): IActionViewItem {
|
||||
private _getActionItemForAction(action: IAction): IActionViewItem {
|
||||
if (action.id === actions.ListDatabasesAction.ID) {
|
||||
return this.listDatabasesActionItem;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import { ILanguageAssociationRegistry, Extensions as LanguageAssociationExtensio
|
||||
|
||||
// Query Plan editor registration
|
||||
|
||||
const queryPlanEditorDescriptor = new EditorDescriptor(
|
||||
const queryPlanEditorDescriptor = EditorDescriptor.create(
|
||||
QueryPlanEditor,
|
||||
QueryPlanEditor.ID,
|
||||
'QueryPlan'
|
||||
|
||||
@@ -48,7 +48,7 @@ export class StatusUpdater extends lifecycle.Disposable implements ext.IWorkbenc
|
||||
lifecycle.dispose(this.badgeHandle);
|
||||
let numOfInProgressTask: number = this.taskService.getNumberOfInProgressTasks();
|
||||
let badge: NumberBadge = new NumberBadge(numOfInProgressTask, n => localize('inProgressTasksChangesBadge', "{0} in progress tasks", n));
|
||||
this.badgeHandle = this.activityBarService.showActivity(TASKS_CONTAINER_ID, badge, 'taskhistory-viewlet-label');
|
||||
this.badgeHandle = this.activityBarService.showViewContainerActivity(TASKS_CONTAINER_ID, { badge, clazz: 'taskhistory-viewlet-label' });
|
||||
}
|
||||
|
||||
public getId(): string {
|
||||
|
||||
@@ -46,6 +46,7 @@ import { IProductService } from 'vs/platform/product/common/productService';
|
||||
import { KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { joinPath } from 'vs/base/common/resources';
|
||||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { addStandardDisposableListener, EventHelper } from 'vs/base/browser/dom';
|
||||
|
||||
const configurationKey = 'workbench.startupEditor';
|
||||
const oldConfigurationKey = 'workbench.welcome.enabled';
|
||||
@@ -321,23 +322,21 @@ class WelcomePage extends Disposable {
|
||||
}
|
||||
|
||||
private createWidePreviewToolTip() {
|
||||
const previewLink = document.querySelector('#tool_tip_container_wide');
|
||||
const tooltip = document.querySelector('#tooltip_text_wide');
|
||||
const previewLink = document.querySelector('#tool_tip_container_wide') as HTMLElement;
|
||||
const tooltip = document.querySelector('#tooltip_text_wide') as HTMLElement;
|
||||
const previewModalBody = document.querySelector('.preview_tooltip_body') as HTMLElement;
|
||||
const previewModalHeader = document.querySelector('.preview_tooltip_header') as HTMLElement;
|
||||
|
||||
previewLink.addEventListener('mouseover', () => {
|
||||
addStandardDisposableListener(previewLink, 'mouseover', () => {
|
||||
tooltip.setAttribute('aria-hidden', 'true');
|
||||
tooltip.classList.toggle('show');
|
||||
});
|
||||
previewLink.addEventListener('mouseout', () => {
|
||||
addStandardDisposableListener(previewLink, 'mouseout', () => {
|
||||
tooltip.setAttribute('aria-hidden', 'false');
|
||||
tooltip.classList.remove('show');
|
||||
});
|
||||
|
||||
previewLink.addEventListener('keydown', (e: KeyboardEvent) => {
|
||||
let event = new StandardKeyboardEvent(e);
|
||||
|
||||
addStandardDisposableListener(previewLink, 'keydown', event => {
|
||||
if (event.equals(KeyCode.Escape)) {
|
||||
if (tooltip.classList.contains('show')) {
|
||||
tooltip.setAttribute('aria-hidden', 'true');
|
||||
@@ -351,9 +350,7 @@ class WelcomePage extends Disposable {
|
||||
}
|
||||
});
|
||||
|
||||
tooltip.addEventListener('keydown', (e: KeyboardEvent) => {
|
||||
let event = new StandardKeyboardEvent(e);
|
||||
|
||||
addStandardDisposableListener(tooltip, 'keydown', event => {
|
||||
if (event.equals(KeyCode.Escape)) {
|
||||
if (tooltip.classList.contains('show')) {
|
||||
tooltip.setAttribute('aria-hidden', 'true');
|
||||
@@ -361,8 +358,8 @@ class WelcomePage extends Disposable {
|
||||
}
|
||||
}
|
||||
else if (event.equals(KeyCode.Tab)) {
|
||||
e.preventDefault();
|
||||
if (e.target === previewModalBody) {
|
||||
EventHelper.stop(event);
|
||||
if (event.target === previewModalBody) {
|
||||
previewModalHeader.focus();
|
||||
} else {
|
||||
previewModalBody.focus();
|
||||
@@ -381,15 +378,14 @@ class WelcomePage extends Disposable {
|
||||
}
|
||||
|
||||
private createDropDown() {
|
||||
const dropdownBtn = document.querySelector('#dropdown_btn');
|
||||
const dropdownBtn = document.querySelector('#dropdown_btn') as HTMLElement;
|
||||
const dropdown = document.querySelector('#dropdown') as HTMLInputElement;
|
||||
|
||||
dropdownBtn.addEventListener('click', () => {
|
||||
addStandardDisposableListener(dropdownBtn, 'click', () => {
|
||||
dropdown.classList.toggle('show');
|
||||
});
|
||||
|
||||
dropdownBtn.addEventListener('keydown', (e: KeyboardEvent) => {
|
||||
let event = new StandardKeyboardEvent(e);
|
||||
addStandardDisposableListener(dropdownBtn, 'keydown', event => {
|
||||
if (event.equals(KeyCode.Enter) || event.equals(KeyCode.Space)) {
|
||||
const dropdownFirstElement = document.querySelector('#dropdown').firstElementChild.children[0] as HTMLInputElement;
|
||||
dropdown.classList.toggle('show');
|
||||
@@ -397,8 +393,7 @@ class WelcomePage extends Disposable {
|
||||
}
|
||||
});
|
||||
|
||||
dropdown.addEventListener('keydown', (e: KeyboardEvent) => {
|
||||
let event = new StandardKeyboardEvent(e);
|
||||
addStandardDisposableListener(dropdown, 'keydown', event => {
|
||||
if (event.equals(KeyCode.Escape)) {
|
||||
if (dropdown.classList.contains('show')) {
|
||||
dropdown.classList.remove('show');
|
||||
@@ -427,16 +422,15 @@ class WelcomePage extends Disposable {
|
||||
}
|
||||
});
|
||||
|
||||
dropdown.addEventListener('keydown', function (e: KeyboardEvent) {
|
||||
addStandardDisposableListener(dropdown, 'keydown', event => {
|
||||
const dropdownLastElement = document.querySelector('#dropdown').lastElementChild.children[0] as HTMLInputElement;
|
||||
const dropdownFirstElement = document.querySelector('#dropdown').firstElementChild.children[0] as HTMLInputElement;
|
||||
let event = new StandardKeyboardEvent(e);
|
||||
if (event.equals(KeyCode.Tab)) {
|
||||
e.preventDefault();
|
||||
EventHelper.stop(event);
|
||||
return;
|
||||
}
|
||||
else if (event.equals(KeyCode.UpArrow) || event.equals(KeyCode.LeftArrow)) {
|
||||
if (e.target === dropdownFirstElement) {
|
||||
if (event.target === dropdownFirstElement) {
|
||||
dropdownLastElement.focus();
|
||||
} else {
|
||||
const movePrev = <HTMLElement>document.querySelector('.move:focus').parentElement.previousElementSibling.children[0] as HTMLElement;
|
||||
@@ -444,7 +438,7 @@ class WelcomePage extends Disposable {
|
||||
}
|
||||
}
|
||||
else if (event.equals(KeyCode.DownArrow) || event.equals(KeyCode.RightArrow)) {
|
||||
if (e.target === dropdownLastElement) {
|
||||
if (event.target === dropdownLastElement) {
|
||||
dropdownFirstElement.focus();
|
||||
} else {
|
||||
const moveNext = <HTMLElement>document.querySelector('.move:focus').parentElement.nextElementSibling.children[0] as HTMLElement;
|
||||
|
||||
Reference in New Issue
Block a user