mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode cfc1ab4c5f816765b91fb7ead3c3427a7c8581a3
This commit is contained in:
@@ -45,6 +45,10 @@
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.monaco-action-bar .action-item .codicon {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.monaco-action-bar .action-label {
|
||||
font-size: 11px;
|
||||
margin-right: 4px;
|
||||
|
||||
@@ -104,7 +104,7 @@ export class BaseActionViewItem extends Disposable implements IActionViewItem {
|
||||
return this._action.enabled;
|
||||
}
|
||||
|
||||
setActionContext(newContext: any): void {
|
||||
setActionContext(newContext: unknown): void {
|
||||
this._context = newContext;
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ export class ActionViewItem extends BaseActionViewItem {
|
||||
|
||||
private cssClass?: string;
|
||||
|
||||
constructor(context: any, action: IAction, options: IActionViewItemOptions = {}) {
|
||||
constructor(context: unknown, action: IAction, options: IActionViewItemOptions = {}) {
|
||||
super(context, action, options);
|
||||
|
||||
this.options = options;
|
||||
@@ -423,7 +423,7 @@ export class ActionBar extends Disposable implements IActionRunner {
|
||||
options: IActionBarOptions;
|
||||
|
||||
private _actionRunner: IActionRunner;
|
||||
private _context: any;
|
||||
private _context: unknown;
|
||||
|
||||
// View Items
|
||||
viewItems: IActionViewItem[];
|
||||
@@ -821,7 +821,7 @@ export class ActionBar extends Disposable implements IActionRunner {
|
||||
this._onDidCancel.fire();
|
||||
}
|
||||
|
||||
run(action: IAction, context?: any): Promise<void> {
|
||||
run(action: IAction, context?: unknown): Promise<void> {
|
||||
return this._actionRunner.run(action, context);
|
||||
}
|
||||
|
||||
@@ -838,7 +838,7 @@ export class ActionBar extends Disposable implements IActionRunner {
|
||||
export class SelectActionViewItem extends BaseActionViewItem {
|
||||
protected selectBox: SelectBox;
|
||||
|
||||
constructor(ctx: any, action: IAction, options: ISelectOptionItem[], selected: number, contextViewProvider: IContextViewProvider, selectBoxOptions?: ISelectBoxOptions) {
|
||||
constructor(ctx: unknown, action: IAction, options: ISelectOptionItem[], selected: number, contextViewProvider: IContextViewProvider, selectBoxOptions?: ISelectBoxOptions) {
|
||||
super(ctx, action);
|
||||
|
||||
this.selectBox = new SelectBox(options, selected, contextViewProvider, undefined, selectBoxOptions);
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
.codicon-wrench-subaction {
|
||||
opacity: 0.5;
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
@font-face {
|
||||
font-family: "codicon";
|
||||
src: url("./codicon.ttf?b5dd8f5aa953889dc1f4c9fa9b44d3dd") format("truetype");
|
||||
src: url("./codicon.ttf?df9e07bbeddc0cf98f4d7a7c92bef3d8") format("truetype");
|
||||
}
|
||||
|
||||
.codicon[class*='codicon-'] {
|
||||
@@ -360,6 +360,8 @@
|
||||
.codicon-symbol-misc:before { content: "\eb63" }
|
||||
.codicon-symbol-operator:before { content: "\eb64" }
|
||||
.codicon-symbol-property:before { content: "\eb65" }
|
||||
.codicon-wrench:before { content: "\eb65" }
|
||||
.codicon-wrench-subaction:before { content: "\eb65" }
|
||||
.codicon-symbol-snippet:before { content: "\eb66" }
|
||||
.codicon-tasklist:before { content: "\eb67" }
|
||||
.codicon-telescope:before { content: "\eb68" }
|
||||
@@ -415,6 +417,5 @@
|
||||
.codicon-group-by-ref-type:before { content: "\eb97" }
|
||||
.codicon-ungroup-by-ref-type:before { content: "\eb98" }
|
||||
.codicon-bell-dot:before { content: "\f101" }
|
||||
.codicon-bell-progress:before { content: "\f102" }
|
||||
.codicon-debug-alt-2:before { content: "\f103" }
|
||||
.codicon-debug-alt:before { content: "\f104" }
|
||||
.codicon-debug-alt-2:before { content: "\f102" }
|
||||
.codicon-debug-alt:before { content: "\f103" }
|
||||
|
||||
Binary file not shown.
@@ -4,6 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import 'vs/css!./codicon/codicon';
|
||||
import 'vs/css!./codicon/codicon-modifications';
|
||||
import 'vs/css!./codicon/codicon-animations';
|
||||
import { escape } from 'vs/base/common/strings';
|
||||
import { renderCodicons } from 'vs/base/common/codicons';
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
flex-direction: column-reverse;
|
||||
width: min-content;
|
||||
min-width: 500px;
|
||||
max-width: 90%;
|
||||
max-width: 90vw;
|
||||
min-height: 75px;
|
||||
padding: 10px;
|
||||
transform: translate3d(0px, 0px, 0px);
|
||||
|
||||
@@ -271,7 +271,7 @@ export class DropdownMenu extends BaseDropdown {
|
||||
}
|
||||
|
||||
export class DropdownMenuActionViewItem extends BaseActionViewItem {
|
||||
private menuActionsOrProvider: any;
|
||||
private menuActionsOrProvider: ReadonlyArray<IAction> | IActionProvider;
|
||||
private dropdownMenu: DropdownMenu | undefined;
|
||||
private contextMenuProvider: IContextMenuProvider;
|
||||
private actionViewItemProvider?: IActionViewItemProvider;
|
||||
@@ -317,7 +317,7 @@ export class DropdownMenuActionViewItem extends BaseActionViewItem {
|
||||
if (Array.isArray(this.menuActionsOrProvider)) {
|
||||
options.actions = this.menuActionsOrProvider;
|
||||
} else {
|
||||
options.actionProvider = this.menuActionsOrProvider;
|
||||
options.actionProvider = this.menuActionsOrProvider as IActionProvider;
|
||||
}
|
||||
|
||||
this.dropdownMenu = this._register(new DropdownMenu(container, options));
|
||||
@@ -341,7 +341,7 @@ export class DropdownMenuActionViewItem extends BaseActionViewItem {
|
||||
}
|
||||
}
|
||||
|
||||
setActionContext(newContext: any): void {
|
||||
setActionContext(newContext: unknown): void {
|
||||
super.setActionContext(newContext);
|
||||
|
||||
if (this.dropdownMenu) {
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
import 'vs/css!./inputBox';
|
||||
|
||||
import * as nls from 'vs/nls';
|
||||
import * as Bal from 'vs/base/browser/browser';
|
||||
import * as dom from 'vs/base/browser/dom';
|
||||
import { MarkdownRenderOptions } from 'vs/base/browser/markdownRenderer';
|
||||
import { renderFormattedText, renderText } from 'vs/base/browser/formattedTextRenderer';
|
||||
@@ -234,14 +233,6 @@ export class InputBox extends Widget {
|
||||
this.onblur(this.input, () => this.onBlur());
|
||||
this.onfocus(this.input, () => this.onFocus());
|
||||
|
||||
// Add placeholder shim for IE because IE decides to hide the placeholder on focus (we dont want that!)
|
||||
if (this.placeholder && Bal.isIE) {
|
||||
this.onclick(this.input, (e) => {
|
||||
dom.EventHelper.stop(e, true);
|
||||
this.input.focus();
|
||||
});
|
||||
}
|
||||
|
||||
this.ignoreGesture(this.input);
|
||||
|
||||
setTimeout(() => this.updateMirror(), 0);
|
||||
@@ -281,6 +272,10 @@ export class InputBox extends Widget {
|
||||
}
|
||||
}
|
||||
|
||||
public getAriaLabel(): string {
|
||||
return this.ariaLabel;
|
||||
}
|
||||
|
||||
public get mirrorElement(): HTMLElement | undefined {
|
||||
return this.mirror;
|
||||
}
|
||||
|
||||
@@ -64,6 +64,9 @@ export interface IIdentityProvider<T> {
|
||||
}
|
||||
|
||||
export enum ListAriaRootRole {
|
||||
/** default list structure role */
|
||||
LIST = 'list',
|
||||
|
||||
/** default tree structure role */
|
||||
TREE = 'tree',
|
||||
|
||||
|
||||
@@ -114,16 +114,16 @@ export class PagedList<T> implements IDisposable {
|
||||
return this.list.onDidDispose;
|
||||
}
|
||||
|
||||
get onFocusChange(): Event<IListEvent<T>> {
|
||||
return Event.map(this.list.onFocusChange, ({ elements, indexes }) => ({ elements: elements.map(e => this._model.get(e)), indexes }));
|
||||
get onDidChangeFocus(): Event<IListEvent<T>> {
|
||||
return Event.map(this.list.onDidChangeFocus, ({ elements, indexes }) => ({ elements: elements.map(e => this._model.get(e)), indexes }));
|
||||
}
|
||||
|
||||
get onOpen(): Event<IListEvent<T>> {
|
||||
get onDidOpen(): Event<IListEvent<T>> {
|
||||
return Event.map(this.list.onDidOpen, ({ elements, indexes, browserEvent }) => ({ elements: elements.map(e => this._model.get(e)), indexes, browserEvent }));
|
||||
}
|
||||
|
||||
get onSelectionChange(): Event<IListEvent<T>> {
|
||||
return Event.map(this.list.onSelectionChange, ({ elements, indexes }) => ({ elements: elements.map(e => this._model.get(e)), indexes }));
|
||||
get onDidChangeSelection(): Event<IListEvent<T>> {
|
||||
return Event.map(this.list.onDidChangeSelection, ({ elements, indexes }) => ({ elements: elements.map(e => this._model.get(e)), indexes }));
|
||||
}
|
||||
|
||||
get onPin(): Event<IListEvent<T>> {
|
||||
@@ -191,8 +191,8 @@ export class PagedList<T> implements IDisposable {
|
||||
return this.list.getFocus();
|
||||
}
|
||||
|
||||
setSelection(indexes: number[]): void {
|
||||
this.list.setSelection(indexes);
|
||||
setSelection(indexes: number[], browserEvent?: UIEvent): void {
|
||||
this.list.setSelection(indexes, browserEvent);
|
||||
}
|
||||
|
||||
getSelection(): number[] {
|
||||
|
||||
@@ -21,6 +21,7 @@ import { equals, distinct } from 'vs/base/common/arrays';
|
||||
import { DataTransfers, StaticDND, IDragAndDropData } from 'vs/base/browser/dnd';
|
||||
import { disposableTimeout, Delayer } from 'vs/base/common/async';
|
||||
import { isFirefox } from 'vs/base/browser/browser';
|
||||
import { IMouseWheelEvent } from 'vs/base/browser/mouseEvent';
|
||||
|
||||
interface IItem<T> {
|
||||
readonly id: string;
|
||||
@@ -198,6 +199,7 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
|
||||
|
||||
get onDidScroll(): Event<ScrollEvent> { return this.scrollableElement.onScroll; }
|
||||
get onWillScroll(): Event<ScrollEvent> { return this.scrollableElement.onWillScroll; }
|
||||
get containerDomNode(): HTMLElement { return this.rowsContainer; }
|
||||
|
||||
constructor(
|
||||
container: HTMLElement,
|
||||
@@ -273,6 +275,31 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
|
||||
this.layout();
|
||||
}
|
||||
|
||||
triggerScrollFromMouseWheelEvent(browserEvent: IMouseWheelEvent) {
|
||||
this.scrollableElement.triggerScrollFromMouseWheelEvent(browserEvent);
|
||||
}
|
||||
|
||||
updateElementHeight(index: number, size: number): void {
|
||||
if (this.items[index].size === size) {
|
||||
return;
|
||||
}
|
||||
|
||||
const lastRenderRange = this.getRenderRange(this.lastRenderTop, this.lastRenderHeight);
|
||||
|
||||
const heightDiff = index < lastRenderRange.start ? size - this.items[index].size : 0;
|
||||
this.rangeMap.splice(index, 1, [{ size: size }]);
|
||||
this.items[index].size = size;
|
||||
|
||||
this.render(lastRenderRange, this.lastRenderTop + heightDiff, this.lastRenderHeight, undefined, undefined, true);
|
||||
|
||||
this.eventuallyUpdateScrollDimensions();
|
||||
|
||||
if (this.supportDynamicHeights) {
|
||||
this._rerender(this.lastRenderTop, this.lastRenderHeight);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
splice(start: number, deleteCount: number, elements: T[] = []): T[] {
|
||||
if (this.splicing) {
|
||||
throw new Error('Can\'t run recursive splices.');
|
||||
@@ -516,14 +543,21 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
|
||||
|
||||
// Render
|
||||
|
||||
private render(renderTop: number, renderHeight: number, renderLeft: number, scrollWidth: number): void {
|
||||
const previousRenderRange = this.getRenderRange(this.lastRenderTop, this.lastRenderHeight);
|
||||
private render(previousRenderRange: IRange, renderTop: number, renderHeight: number, renderLeft: number | undefined, scrollWidth: number | undefined, updateItemsInDOM: boolean = false): void {
|
||||
const renderRange = this.getRenderRange(renderTop, renderHeight);
|
||||
|
||||
const rangesToInsert = Range.relativeComplement(renderRange, previousRenderRange);
|
||||
const rangesToRemove = Range.relativeComplement(previousRenderRange, renderRange);
|
||||
const beforeElement = this.getNextToLastElement(rangesToInsert);
|
||||
|
||||
if (updateItemsInDOM) {
|
||||
const rangesToUpdate = Range.intersect(previousRenderRange, renderRange);
|
||||
|
||||
for (let i = rangesToUpdate.start; i < rangesToUpdate.end; i++) {
|
||||
this.updateItemInDOM(this.items[i], i);
|
||||
}
|
||||
}
|
||||
|
||||
for (const range of rangesToInsert) {
|
||||
for (let i = range.start; i < range.end; i++) {
|
||||
this.insertItemInDOM(i, beforeElement);
|
||||
@@ -536,10 +570,13 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
|
||||
}
|
||||
}
|
||||
|
||||
this.rowsContainer.style.left = `-${renderLeft}px`;
|
||||
if (renderLeft !== undefined) {
|
||||
this.rowsContainer.style.left = `-${renderLeft}px`;
|
||||
}
|
||||
|
||||
this.rowsContainer.style.top = `-${renderTop}px`;
|
||||
|
||||
if (this.horizontalScrolling) {
|
||||
if (this.horizontalScrolling && scrollWidth !== undefined) {
|
||||
this.rowsContainer.style.width = `${Math.max(scrollWidth, this.renderWidth)}px`;
|
||||
}
|
||||
|
||||
@@ -741,7 +778,8 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
|
||||
|
||||
private onScroll(e: ScrollEvent): void {
|
||||
try {
|
||||
this.render(e.scrollTop, e.height, e.scrollLeft, e.scrollWidth);
|
||||
const previousRenderRange = this.getRenderRange(this.lastRenderTop, this.lastRenderHeight);
|
||||
this.render(previousRenderRange, e.scrollTop, e.height, e.scrollLeft, e.scrollWidth);
|
||||
|
||||
if (this.supportDynamicHeights) {
|
||||
this._rerender(e.scrollTop, e.height);
|
||||
@@ -1097,6 +1135,14 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
|
||||
}
|
||||
|
||||
const size = item.size;
|
||||
|
||||
if (!this.setRowHeight && item.row && item.row.domNode) {
|
||||
let newSize = item.row.domNode.offsetHeight;
|
||||
item.size = newSize;
|
||||
item.lastDynamicHeightWidth = this.renderWidth;
|
||||
return newSize - size;
|
||||
}
|
||||
|
||||
const row = this.cache.alloc(item.templateId);
|
||||
|
||||
row.domNode!.style.height = '';
|
||||
|
||||
@@ -180,10 +180,10 @@ class Trait<T> implements ISpliceable<boolean>, IDisposable {
|
||||
}
|
||||
}
|
||||
|
||||
class FocusTrait<T> extends Trait<T> {
|
||||
class SelectionTrait<T> extends Trait<T> {
|
||||
|
||||
constructor() {
|
||||
super('focused');
|
||||
super('selected');
|
||||
}
|
||||
|
||||
renderIndex(index: number, container: HTMLElement): void {
|
||||
@@ -192,7 +192,7 @@ class FocusTrait<T> extends Trait<T> {
|
||||
if (this.contains(index)) {
|
||||
container.setAttribute('aria-selected', 'true');
|
||||
} else {
|
||||
container.removeAttribute('aria-selected');
|
||||
container.setAttribute('aria-selected', 'false');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -901,7 +901,7 @@ const DefaultOptions = {
|
||||
onDragOver() { return false; },
|
||||
drop() { }
|
||||
},
|
||||
ariaRootRole: ListAriaRootRole.TREE
|
||||
ariaRootRole: ListAriaRootRole.LIST
|
||||
};
|
||||
|
||||
// TODO@Joao: move these utils into a SortedArray class
|
||||
@@ -1115,7 +1115,7 @@ export class List<T> implements ISpliceable<T>, IDisposable {
|
||||
private focus: Trait<T>;
|
||||
private selection: Trait<T>;
|
||||
private eventBufferer = new EventBufferer();
|
||||
private view: ListView<T>;
|
||||
protected view: ListView<T>;
|
||||
private spliceable: ISpliceable<T>;
|
||||
private styleController: IStyleController;
|
||||
private typeLabelController?: TypeLabelController<T>;
|
||||
@@ -1123,11 +1123,11 @@ export class List<T> implements ISpliceable<T>, IDisposable {
|
||||
|
||||
protected readonly disposables = new DisposableStore();
|
||||
|
||||
@memoize get onFocusChange(): Event<IListEvent<T>> {
|
||||
@memoize get onDidChangeFocus(): Event<IListEvent<T>> {
|
||||
return Event.map(this.eventBufferer.wrapEvent(this.focus.onChange), e => this.toListEvent(e));
|
||||
}
|
||||
|
||||
@memoize get onSelectionChange(): Event<IListEvent<T>> {
|
||||
@memoize get onDidChangeSelection(): Event<IListEvent<T>> {
|
||||
return Event.map(this.eventBufferer.wrapEvent(this.selection.onChange), e => this.toListEvent(e));
|
||||
}
|
||||
|
||||
@@ -1198,8 +1198,8 @@ export class List<T> implements ISpliceable<T>, IDisposable {
|
||||
renderers: IListRenderer<any /* TODO@joao */, any>[],
|
||||
private _options: IListOptions<T> = DefaultOptions
|
||||
) {
|
||||
this.focus = new FocusTrait();
|
||||
this.selection = new Trait('selected');
|
||||
this.selection = new SelectionTrait();
|
||||
this.focus = new Trait('focused');
|
||||
|
||||
mixin(_options, defaultStyles, false);
|
||||
|
||||
@@ -1225,7 +1225,7 @@ export class List<T> implements ISpliceable<T>, IDisposable {
|
||||
this.view = new ListView(container, virtualDelegate, renderers, viewOptions);
|
||||
|
||||
if (typeof _options.ariaRole !== 'string') {
|
||||
this.view.domNode.setAttribute('role', ListAriaRootRole.TREE);
|
||||
this.view.domNode.setAttribute('role', ListAriaRootRole.LIST);
|
||||
} else {
|
||||
this.view.domNode.setAttribute('role', _options.ariaRole);
|
||||
}
|
||||
@@ -1266,12 +1266,15 @@ export class List<T> implements ISpliceable<T>, IDisposable {
|
||||
|
||||
this.disposables.add(this.createMouseController(_options));
|
||||
|
||||
this.onFocusChange(this._onFocusChange, this, this.disposables);
|
||||
this.onSelectionChange(this._onSelectionChange, this, this.disposables);
|
||||
this.onDidChangeFocus(this._onFocusChange, this, this.disposables);
|
||||
this.onDidChangeSelection(this._onSelectionChange, this, this.disposables);
|
||||
|
||||
if (_options.ariaLabel) {
|
||||
this.view.domNode.setAttribute('aria-label', localize('aria list', "{0}. Use the navigation keys to navigate.", _options.ariaLabel));
|
||||
}
|
||||
if (_options.multipleSelectionSupport) {
|
||||
this.view.domNode.setAttribute('aria-multiselectable', 'true');
|
||||
}
|
||||
}
|
||||
|
||||
protected createMouseController(options: IListOptions<T>): MouseController<T> {
|
||||
@@ -1310,6 +1313,10 @@ export class List<T> implements ISpliceable<T>, IDisposable {
|
||||
this.view.updateWidth(index);
|
||||
}
|
||||
|
||||
updateElementHeight(index: number, size: number): void {
|
||||
this.view.updateElementHeight(index, size);
|
||||
}
|
||||
|
||||
rerender(): void {
|
||||
this.view.rerender();
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import 'vs/css!./menu';
|
||||
import * as nls from 'vs/nls';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { IActionRunner, IAction, Action, IActionViewItem } from 'vs/base/common/actions';
|
||||
import { IActionRunner, IAction, Action } from 'vs/base/common/actions';
|
||||
import { ActionBar, IActionViewItemProvider, ActionsOrientation, Separator, ActionViewItem, IActionViewItemOptions, BaseActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { ResolvedKeybinding, KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { addClass, EventType, EventHelper, EventLike, removeTabIndexAndUpdateFocus, isAncestor, hasClass, addDisposableListener, removeClass, append, $, addClasses, removeClasses, clearNode } from 'vs/base/browser/dom';
|
||||
@@ -19,6 +19,7 @@ import { ScrollbarVisibility, ScrollEvent } from 'vs/base/common/scrollable';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview';
|
||||
import { isLinux, isMacintosh } from 'vs/base/common/platform';
|
||||
import { stripCodicons } from 'vs/base/common/codicons';
|
||||
|
||||
export const MENU_MNEMONIC_REGEX = /\(&([^\s&])\)|(^|[^&])&([^\s&])/;
|
||||
export const MENU_ESCAPED_MNEMONIC_REGEX = /(&)?(&)([^\s&])/g;
|
||||
@@ -205,7 +206,7 @@ export class Menu extends ActionBar {
|
||||
container.appendChild(this.scrollableElement.getDomNode());
|
||||
this.scrollableElement.scanDomNode();
|
||||
|
||||
this.viewItems.filter(item => !(item instanceof MenuSeparatorActionViewItem)).forEach((item: IActionViewItem, index: number, array: any[]) => {
|
||||
this.viewItems.filter(item => !(item instanceof MenuSeparatorActionViewItem)).forEach((item, index, array) => {
|
||||
(item as BaseMenuActionViewItem).updatePositionInSet(index + 1, array.length);
|
||||
});
|
||||
}
|
||||
@@ -363,7 +364,7 @@ class BaseMenuActionViewItem extends BaseActionViewItem {
|
||||
private cssClass: string;
|
||||
protected menuStyle: IMenuStyles | undefined;
|
||||
|
||||
constructor(ctx: any, action: IAction, options: IMenuItemOptions = {}) {
|
||||
constructor(ctx: unknown, action: IAction, options: IMenuItemOptions = {}) {
|
||||
options.isMenu = true;
|
||||
super(action, action, options);
|
||||
|
||||
@@ -471,7 +472,7 @@ class BaseMenuActionViewItem extends BaseActionViewItem {
|
||||
if (this.options.label) {
|
||||
clearNode(this.label);
|
||||
|
||||
let label = this.getAction().label;
|
||||
let label = stripCodicons(this.getAction().label);
|
||||
if (label) {
|
||||
const cleanLabel = cleanMnemonic(label);
|
||||
if (!this.options.enableMnemonics) {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import 'vs/css!./media/scrollbars';
|
||||
import { isEdgeOrIE } from 'vs/base/browser/browser';
|
||||
import { isEdge } from 'vs/base/browser/browser';
|
||||
import * as dom from 'vs/base/browser/dom';
|
||||
import { FastDomNode, createFastDomNode } from 'vs/base/browser/fastDomNode';
|
||||
import { IMouseEvent, StandardWheelEvent, IMouseWheelEvent } from 'vs/base/browser/mouseEvent';
|
||||
@@ -303,6 +303,10 @@ export abstract class AbstractScrollableElement extends Widget {
|
||||
this._revealOnScroll = value;
|
||||
}
|
||||
|
||||
public triggerScrollFromMouseWheelEvent(browserEvent: IMouseWheelEvent) {
|
||||
this._onMouseWheel(new StandardWheelEvent(browserEvent));
|
||||
}
|
||||
|
||||
// -------------------- mouse wheel scrolling --------------------
|
||||
|
||||
private _setListeningToMouseWheel(shouldListen: boolean): void {
|
||||
@@ -322,7 +326,7 @@ export abstract class AbstractScrollableElement extends Widget {
|
||||
this._onMouseWheel(new StandardWheelEvent(browserEvent));
|
||||
};
|
||||
|
||||
this._mouseWheelToDispose.push(dom.addDisposableListener(this._listenOnDomNode, isEdgeOrIE ? 'mousewheel' : 'wheel', onMouseWheel, { passive: false }));
|
||||
this._mouseWheelToDispose.push(dom.addDisposableListener(this._listenOnDomNode, isEdge ? 'mousewheel' : 'wheel', onMouseWheel, { passive: false }));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -762,7 +762,7 @@ export class SelectBoxList extends Disposable implements ISelectBoxDelegate, ILi
|
||||
.on(e => this.onMouseUp(e), this));
|
||||
|
||||
this._register(this.selectList.onMouseOver(e => typeof e.index !== 'undefined' && this.selectList.setFocus([e.index])));
|
||||
this._register(this.selectList.onFocusChange(e => this.onListFocus(e)));
|
||||
this._register(this.selectList.onDidChangeFocus(e => this.onListFocus(e)));
|
||||
|
||||
this._register(dom.addDisposableListener(this.selectDropDownContainer, dom.EventType.FOCUS_OUT, e => {
|
||||
if (!this._isVisible || dom.isAncestor(e.relatedTarget as HTMLElement, this.selectDropDownContainer)) {
|
||||
|
||||
@@ -15,12 +15,15 @@ import { Color, RGBA } from 'vs/base/common/color';
|
||||
import { SplitView, IView } from './splitview';
|
||||
import { isFirefox } from 'vs/base/browser/browser';
|
||||
import { DataTransfers } from 'vs/base/browser/dnd';
|
||||
import { Orientation } from 'vs/base/browser/ui/sash/sash';
|
||||
import { localize } from 'vs/nls';
|
||||
|
||||
export interface IPaneOptions {
|
||||
ariaHeaderLabel?: string;
|
||||
minimumBodySize?: number;
|
||||
maximumBodySize?: number;
|
||||
expanded?: boolean;
|
||||
orientation?: Orientation;
|
||||
title: string;
|
||||
}
|
||||
|
||||
export interface IPaneStyles {
|
||||
@@ -48,6 +51,8 @@ export abstract class Pane extends Disposable implements IView {
|
||||
private body!: HTMLElement;
|
||||
|
||||
protected _expanded: boolean;
|
||||
protected _orientation: Orientation;
|
||||
protected _preventCollapse?: boolean;
|
||||
|
||||
private expandedSize: number | undefined = undefined;
|
||||
private _headerVisible = true;
|
||||
@@ -114,12 +119,13 @@ export abstract class Pane extends Disposable implements IView {
|
||||
return headerSize + maximumBodySize;
|
||||
}
|
||||
|
||||
width: number = 0;
|
||||
orthogonalSize: number = 0;
|
||||
|
||||
constructor(options: IPaneOptions = {}) {
|
||||
constructor(options: IPaneOptions) {
|
||||
super();
|
||||
this._expanded = typeof options.expanded === 'undefined' ? true : !!options.expanded;
|
||||
this.ariaHeaderLabel = options.ariaHeaderLabel || '';
|
||||
this._orientation = typeof options.orientation === 'undefined' ? Orientation.VERTICAL : Orientation.HORIZONTAL;
|
||||
this.ariaHeaderLabel = localize('viewSection', "{0} Section", options.title);
|
||||
this._minimumBodySize = typeof options.minimumBodySize === 'number' ? options.minimumBodySize : 120;
|
||||
this._maximumBodySize = typeof options.maximumBodySize === 'number' ? options.maximumBodySize : Number.POSITIVE_INFINITY;
|
||||
|
||||
@@ -183,31 +189,37 @@ export abstract class Pane extends Disposable implements IView {
|
||||
|
||||
this.updateHeader();
|
||||
|
||||
const onHeaderKeyDown = Event.chain(domEvent(this.header, 'keydown'))
|
||||
.map(e => new StandardKeyboardEvent(e));
|
||||
|
||||
this._register(onHeaderKeyDown.filter(e => e.keyCode === KeyCode.Enter || e.keyCode === KeyCode.Space)
|
||||
.event(() => this.setExpanded(!this.isExpanded()), null));
|
||||
if (!this._preventCollapse) {
|
||||
const onHeaderKeyDown = Event.chain(domEvent(this.header, 'keydown'))
|
||||
.map(e => new StandardKeyboardEvent(e));
|
||||
|
||||
this._register(onHeaderKeyDown.filter(e => e.keyCode === KeyCode.LeftArrow)
|
||||
.event(() => this.setExpanded(false), null));
|
||||
this._register(onHeaderKeyDown.filter(e => e.keyCode === KeyCode.Enter || e.keyCode === KeyCode.Space)
|
||||
.event(() => this.setExpanded(!this.isExpanded()), null));
|
||||
|
||||
this._register(onHeaderKeyDown.filter(e => e.keyCode === KeyCode.RightArrow)
|
||||
.event(() => this.setExpanded(true), null));
|
||||
this._register(onHeaderKeyDown.filter(e => e.keyCode === KeyCode.LeftArrow)
|
||||
.event(() => this.setExpanded(false), null));
|
||||
|
||||
this._register(domEvent(this.header, 'click')
|
||||
(() => this.setExpanded(!this.isExpanded()), null));
|
||||
this._register(onHeaderKeyDown.filter(e => e.keyCode === KeyCode.RightArrow)
|
||||
.event(() => this.setExpanded(true), null));
|
||||
|
||||
this._register(domEvent(this.header, 'click')
|
||||
(() => this.setExpanded(!this.isExpanded()), null));
|
||||
}
|
||||
|
||||
this.body = append(this.element, $('.pane-body'));
|
||||
this.renderBody(this.body);
|
||||
}
|
||||
|
||||
layout(height: number): void {
|
||||
layout(size: number): void {
|
||||
const headerSize = this.headerVisible ? Pane.HEADER_SIZE : 0;
|
||||
|
||||
const width = this._orientation === Orientation.VERTICAL ? this.orthogonalSize : size;
|
||||
const height = this._orientation === Orientation.VERTICAL ? size - headerSize : this.orthogonalSize - headerSize;
|
||||
|
||||
if (this.isExpanded()) {
|
||||
this.layoutBody(height - headerSize, this.width);
|
||||
this.expandedSize = height;
|
||||
this.layoutBody(height, width);
|
||||
this.expandedSize = size;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -371,6 +383,7 @@ export class DefaultPaneDndController implements IPaneDndController {
|
||||
|
||||
export interface IPaneViewOptions {
|
||||
dnd?: IPaneDndController;
|
||||
orientation?: Orientation;
|
||||
}
|
||||
|
||||
interface IPaneItem {
|
||||
@@ -384,8 +397,9 @@ export class PaneView extends Disposable {
|
||||
private dndContext: IDndContext = { draggable: null };
|
||||
private el: HTMLElement;
|
||||
private paneItems: IPaneItem[] = [];
|
||||
private width: number = 0;
|
||||
private orthogonalSize: number = 0;
|
||||
private splitview: SplitView;
|
||||
private orientation: Orientation;
|
||||
private animationTimer: number | undefined = undefined;
|
||||
|
||||
private _onDidDrop = this._register(new Emitter<{ from: Pane, to: Pane }>());
|
||||
@@ -397,8 +411,9 @@ export class PaneView extends Disposable {
|
||||
super();
|
||||
|
||||
this.dnd = options.dnd;
|
||||
this.orientation = options.orientation ?? Orientation.VERTICAL;
|
||||
this.el = append(container, $('.monaco-pane-view'));
|
||||
this.splitview = this._register(new SplitView(this.el));
|
||||
this.splitview = this._register(new SplitView(this.el, { orientation: this.orientation }));
|
||||
this.onDidSashChange = this.splitview.onDidSashChange;
|
||||
}
|
||||
|
||||
@@ -408,7 +423,7 @@ export class PaneView extends Disposable {
|
||||
|
||||
const paneItem = { pane: pane, disposable: disposables };
|
||||
this.paneItems.splice(index, 0, paneItem);
|
||||
pane.width = this.width;
|
||||
pane.orthogonalSize = this.orthogonalSize;
|
||||
this.splitview.addView(pane, size, index);
|
||||
|
||||
if (this.dnd) {
|
||||
@@ -465,13 +480,13 @@ export class PaneView extends Disposable {
|
||||
}
|
||||
|
||||
layout(height: number, width: number): void {
|
||||
this.width = width;
|
||||
this.orthogonalSize = this.orientation === Orientation.VERTICAL ? width : height;
|
||||
|
||||
for (const paneItem of this.paneItems) {
|
||||
paneItem.pane.width = width;
|
||||
paneItem.pane.orthogonalSize = this.orthogonalSize;
|
||||
}
|
||||
|
||||
this.splitview.layout(height);
|
||||
this.splitview.layout(this.orientation === Orientation.HORIZONTAL ? width : height);
|
||||
}
|
||||
|
||||
private setupAnimation(): void {
|
||||
|
||||
@@ -86,7 +86,7 @@ export class ToolBar extends Disposable {
|
||||
return this.actionBar.actionRunner;
|
||||
}
|
||||
|
||||
set context(context: any) {
|
||||
set context(context: unknown) {
|
||||
this.actionBar.context = context;
|
||||
if (this.toggleMenuActionViewItem.value) {
|
||||
this.toggleMenuActionViewItem.value.setActionContext(context);
|
||||
@@ -166,10 +166,8 @@ class ToggleMenuAction extends Action {
|
||||
this.toggleDropdownMenu = toggleDropdownMenu;
|
||||
}
|
||||
|
||||
run(): Promise<any> {
|
||||
async run(): Promise<void> {
|
||||
this.toggleDropdownMenu();
|
||||
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
|
||||
get menuActions(): ReadonlyArray<IAction> {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import 'vs/css!./media/tree';
|
||||
import { IDisposable, dispose, Disposable, toDisposable, DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { IListOptions, List, IListStyles, MouseController, DefaultKeyboardNavigationDelegate } from 'vs/base/browser/ui/list/listWidget';
|
||||
import { IListVirtualDelegate, IListRenderer, IListMouseEvent, IListEvent, IListContextMenuEvent, IListDragAndDrop, IListDragOverReaction, IKeyboardNavigationLabelProvider, IIdentityProvider, IKeyboardNavigationDelegate } from 'vs/base/browser/ui/list/list';
|
||||
import { IListVirtualDelegate, IListRenderer, IListMouseEvent, IListEvent, IListContextMenuEvent, IListDragAndDrop, IListDragOverReaction, IKeyboardNavigationLabelProvider, IIdentityProvider, IKeyboardNavigationDelegate, ListAriaRootRole } from 'vs/base/browser/ui/list/list';
|
||||
import { append, $, toggleClass, getDomNodePagePosition, removeClass, addClass, hasClass, hasParentWithClass, createStyleSheet, clearNode, addClasses, removeClasses } from 'vs/base/browser/dom';
|
||||
import { Event, Relay, Emitter, EventBufferer } from 'vs/base/common/event';
|
||||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
@@ -14,7 +14,7 @@ import { KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { ITreeModel, ITreeNode, ITreeRenderer, ITreeEvent, ITreeMouseEvent, ITreeContextMenuEvent, ITreeFilter, ITreeNavigator, ICollapseStateChangeEvent, ITreeDragAndDrop, TreeDragOverBubble, TreeVisibility, TreeFilterResult, ITreeModelSpliceEvent, TreeMouseEventTarget } from 'vs/base/browser/ui/tree/tree';
|
||||
import { ISpliceable } from 'vs/base/common/sequence';
|
||||
import { IDragAndDropData, StaticDND, DragAndDropData } from 'vs/base/browser/dnd';
|
||||
import { range, equals, distinctES6, fromSet } from 'vs/base/common/arrays';
|
||||
import { range, equals, distinctES6 } from 'vs/base/common/arrays';
|
||||
import { ElementsDragAndDropData } from 'vs/base/browser/ui/list/listView';
|
||||
import { domEvent } from 'vs/base/browser/event';
|
||||
import { fuzzyScore, FuzzyScore } from 'vs/base/common/filters';
|
||||
@@ -197,7 +197,8 @@ function asListOptions<T, TFilterData, TRef>(modelProvider: () => ITreeModel<T,
|
||||
getRole: options.ariaProvider && options.ariaProvider.getRole ? (node) => {
|
||||
return options.ariaProvider!.getRole!(node.element);
|
||||
} : () => 'treeitem'
|
||||
}
|
||||
},
|
||||
ariaRole: ListAriaRootRole.TREE
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1320,7 +1321,7 @@ export abstract class AbstractTree<T, TFilterData, TRef> implements IDisposable
|
||||
set.add(node);
|
||||
}
|
||||
|
||||
return fromSet(set);
|
||||
return values(set);
|
||||
}).event;
|
||||
|
||||
if (_options.keyboardSupport !== false) {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import { ComposedTreeDelegate, IAbstractTreeOptions, IAbstractTreeOptionsUpdate } from 'vs/base/browser/ui/tree/abstractTree';
|
||||
import { ObjectTree, IObjectTreeOptions, CompressibleObjectTree, ICompressibleTreeRenderer, ICompressibleKeyboardNavigationLabelProvider, ICompressibleObjectTreeOptions } from 'vs/base/browser/ui/tree/objectTree';
|
||||
import { IListVirtualDelegate, IIdentityProvider, IListDragAndDrop, IListDragOverReaction } from 'vs/base/browser/ui/list/list';
|
||||
import { IListVirtualDelegate, IIdentityProvider, IListDragAndDrop, IListDragOverReaction, ListAriaRootRole } from 'vs/base/browser/ui/list/list';
|
||||
import { ITreeElement, ITreeNode, ITreeRenderer, ITreeEvent, ITreeMouseEvent, ITreeContextMenuEvent, ITreeSorter, ICollapseStateChangeEvent, IAsyncDataSource, ITreeDragAndDrop, TreeError, WeakMapper, ITreeFilter, TreeVisibility, TreeFilterResult } from 'vs/base/browser/ui/tree/tree';
|
||||
import { IDisposable, dispose, DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
@@ -272,6 +272,7 @@ function asObjectTreeOptions<TInput, T, TFilterData>(options?: IAsyncDataTreeOpt
|
||||
return options.ariaProvider?.isChecked!(e.element as T);
|
||||
} : undefined
|
||||
},
|
||||
ariaRole: ListAriaRootRole.TREE,
|
||||
additionalScrollHeight: options.additionalScrollHeight
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user