mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-20 01:25:37 -05:00
Initial VS Code 1.19 source merge (#571)
* Initial 1.19 xcopy * Fix yarn build * Fix numerous build breaks * Next batch of build break fixes * More build break fixes * Runtime breaks * Additional post merge fixes * Fix windows setup file * Fix test failures. * Update license header blocks to refer to source eula
This commit is contained in:
@@ -119,7 +119,8 @@ export class Dropdown extends Disposable {
|
||||
|
||||
this._input = new InputBox(this.$input.getHTMLElement(), contextViewService, {
|
||||
validationOptions: {
|
||||
showMessage: false,
|
||||
// @SQLTODO
|
||||
//showMessage: false,
|
||||
validation: v => this._inputValidator(v)
|
||||
},
|
||||
placeholder: this._options.placeholder,
|
||||
|
||||
@@ -339,7 +339,7 @@ export abstract class Modal extends Disposable implements IThemable {
|
||||
let footerButton = $('div.footer-button');
|
||||
let button = new Button(footerButton);
|
||||
button.label = label;
|
||||
button.addListener('click', () => onSelect());
|
||||
button.onDidClick(() => onSelect());
|
||||
if (orientation === 'left') {
|
||||
footerButton.appendTo(this._leftFooter);
|
||||
} else {
|
||||
|
||||
@@ -104,7 +104,7 @@ export class OptionsDialog extends Modal {
|
||||
super.render();
|
||||
attachModalDialogStyler(this, this._themeService);
|
||||
if (this.backButton) {
|
||||
this.backButton.addListener('click', () => this.cancel());
|
||||
this.backButton.onDidClick(() => this.cancel());
|
||||
attachButtonStyler(this.backButton, this._themeService, { buttonBackground: SIDE_BAR_BACKGROUND, buttonHoverBackground: SIDE_BAR_BACKGROUND });
|
||||
}
|
||||
this._okButton = this.addFooterButton(this.okLabel, () => this.ok());
|
||||
|
||||
@@ -14,7 +14,7 @@ import { InputBox } from 'sql/base/browser/ui/inputBox/inputBox';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import data = require('data');
|
||||
import { localize } from 'vs/nls';
|
||||
import { ServiceOptionType } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
import { ServiceOptionType, ServiceOptionTypeNames } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
|
||||
export interface IOptionElement {
|
||||
optionWidget: any;
|
||||
@@ -30,52 +30,51 @@ export function createOptionElement(option: data.ServiceOption, rowContainer: Bu
|
||||
let inputElement: HTMLElement;
|
||||
let missingErrorMessage = localize('missingRequireField', ' is required.');
|
||||
let invalidInputMessage = localize('invalidInput', 'Invalid input. Numeric value expected.');
|
||||
switch (option.valueType) {
|
||||
case ServiceOptionType.number:
|
||||
optionWidget = new InputBox(rowContainer.getHTMLElement(), contextViewService, {
|
||||
validationOptions: {
|
||||
validation: (value: string) => {
|
||||
if (!value && option.isRequired) {
|
||||
return { type: MessageType.ERROR, content: option.displayName + missingErrorMessage };
|
||||
} else if (!types.isNumber(Number(value))) {
|
||||
return { type: MessageType.ERROR, content: invalidInputMessage };
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
let typeName: string = option.valueType.toString();
|
||||
if (typeName === ServiceOptionTypeNames.number) {
|
||||
optionWidget = new InputBox(rowContainer.getHTMLElement(), contextViewService, {
|
||||
validationOptions: {
|
||||
validation: (value: string) => {
|
||||
if (!value && option.isRequired) {
|
||||
return { type: MessageType.ERROR, content: option.displayName + missingErrorMessage };
|
||||
} else if (!types.isNumber(Number(value))) {
|
||||
return { type: MessageType.ERROR, content: invalidInputMessage };
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
});
|
||||
optionWidget.value = optionValue;
|
||||
inputElement = this.findElement(rowContainer, 'input');
|
||||
break;
|
||||
case ServiceOptionType.category:
|
||||
case ServiceOptionType.boolean:
|
||||
optionWidget = new SelectBox(possibleInputs, optionValue.toString());
|
||||
DialogHelper.appendInputSelectBox(rowContainer, optionWidget);
|
||||
inputElement = this.findElement(rowContainer, 'select-box');
|
||||
break;
|
||||
case ServiceOptionType.string:
|
||||
case ServiceOptionType.password:
|
||||
optionWidget = new InputBox(rowContainer.getHTMLElement(), contextViewService, {
|
||||
validationOptions: {
|
||||
validation: (value: string) => (!value && option.isRequired) ? ({ type: MessageType.ERROR, content: option.displayName + missingErrorMessage }) : null
|
||||
}
|
||||
});
|
||||
optionWidget.value = optionValue;
|
||||
if (option.valueType === ServiceOptionType.password) {
|
||||
optionWidget.inputElement.type = 'password';
|
||||
}
|
||||
inputElement = this.findElement(rowContainer, 'input');
|
||||
});
|
||||
optionWidget.value = optionValue;
|
||||
inputElement = this.findElement(rowContainer, 'input');
|
||||
} else if (typeName === ServiceOptionTypeNames.category || typeName === ServiceOptionTypeNames.boolean) {
|
||||
optionWidget = new SelectBox(possibleInputs, optionValue.toString());
|
||||
DialogHelper.appendInputSelectBox(rowContainer, optionWidget);
|
||||
inputElement = this.findElement(rowContainer, 'select-box');
|
||||
} else if (typeName === ServiceOptionTypeNames.string || typeName === ServiceOptionTypeNames.password) {
|
||||
optionWidget = new InputBox(rowContainer.getHTMLElement(), contextViewService, {
|
||||
validationOptions: {
|
||||
validation: (value: string) => (!value && option.isRequired) ? ({ type: MessageType.ERROR, content: option.displayName + missingErrorMessage }) : null
|
||||
}
|
||||
});
|
||||
optionWidget.value = optionValue;
|
||||
if (option.valueType === ServiceOptionType.password) {
|
||||
optionWidget.inputElement.type = 'password';
|
||||
}
|
||||
inputElement = this.findElement(rowContainer, 'input');
|
||||
}
|
||||
optionsMap[option.name] = { optionWidget: optionWidget, option: option, optionValue: optionValue };
|
||||
inputElement.onfocus = () => onFocus(option.name);
|
||||
}
|
||||
|
||||
export function getOptionValueAndCategoryValues(option: data.ServiceOption, options: { [optionName: string]: any }, possibleInputs: string[]): any {
|
||||
|
||||
let valueTypeName:string = option.valueType.toString();
|
||||
var optionValue = option.defaultValue;
|
||||
if (options[option.name]) {
|
||||
// if the value type is boolean, the option value can be either boolean or string
|
||||
if (option.valueType === ServiceOptionType.boolean) {
|
||||
if (valueTypeName === ServiceOptionTypeNames.boolean) {
|
||||
if (options[option.name] === true || options[option.name] === this.trueInputValue) {
|
||||
optionValue = this.trueInputValue;
|
||||
} else {
|
||||
@@ -86,13 +85,13 @@ export function getOptionValueAndCategoryValues(option: data.ServiceOption, opti
|
||||
}
|
||||
}
|
||||
|
||||
if (option.valueType === ServiceOptionType.boolean || option.valueType === ServiceOptionType.category) {
|
||||
if (valueTypeName === ServiceOptionTypeNames.boolean || valueTypeName === ServiceOptionTypeNames.category) {
|
||||
// If the option is not required, the empty string should be add at the top of possible choices
|
||||
if (!option.isRequired) {
|
||||
possibleInputs.push('');
|
||||
}
|
||||
|
||||
if (option.valueType === ServiceOptionType.boolean) {
|
||||
if (valueTypeName === ServiceOptionTypeNames.boolean) {
|
||||
possibleInputs.push(this.trueInputValue, this.falseInputValue);
|
||||
} else {
|
||||
option.categoryValues.map(c => possibleInputs.push(c.name));
|
||||
@@ -112,9 +111,9 @@ export function validateInputs(optionsMap: { [optionName: string]: IOptionElemen
|
||||
for (var optionName in optionsMap) {
|
||||
var optionElement: IOptionElement = optionsMap[optionName];
|
||||
var widget = optionElement.optionWidget;
|
||||
var isInputBox = (optionElement.option.valueType === ServiceOptionType.string ||
|
||||
optionElement.option.valueType === ServiceOptionType.password ||
|
||||
optionElement.option.valueType === ServiceOptionType.number);
|
||||
var isInputBox = (optionElement.option.valueType.toString() === ServiceOptionTypeNames.string ||
|
||||
optionElement.option.valueType.toString() === ServiceOptionTypeNames.password ||
|
||||
optionElement.option.valueType.toString() === ServiceOptionTypeNames.number);
|
||||
|
||||
if (isInputBox) {
|
||||
if (!widget.validate()) {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IThemable } from 'vs/platform/theme/common/styler';
|
||||
import * as objects from 'vs/base/common/objects';
|
||||
import * as objects from 'sql/base/common/objects';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { Dimension, $, Builder } from 'vs/base/browser/builder';
|
||||
import { EventType } from 'vs/base/browser/dom';
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import 'vs/css!./splitview';
|
||||
import lifecycle = require('vs/base/common/lifecycle');
|
||||
import ee = require('vs/base/common/eventEmitter');
|
||||
import ee = require('sql/base/common/eventEmitter');
|
||||
import types = require('vs/base/common/types');
|
||||
import dom = require('vs/base/browser/dom');
|
||||
import numbers = require('vs/base/common/numbers');
|
||||
@@ -347,11 +347,11 @@ export abstract class AbstractCollapsibleView extends HeaderView {
|
||||
// Track state of focus in header so that other components can adjust styles based on that
|
||||
// (for example show or hide actions based on the state of being focused or not)
|
||||
this.focusTracker = dom.trackFocus(this.header);
|
||||
this.focusTracker.addFocusListener(() => {
|
||||
this.focusTracker.onDidFocus(() => {
|
||||
dom.addClass(this.header, 'focused');
|
||||
});
|
||||
|
||||
this.focusTracker.addBlurListener(() => {
|
||||
this.focusTracker.onDidBlur(() => {
|
||||
dom.removeClass(this.header, 'focused');
|
||||
});
|
||||
}
|
||||
@@ -602,8 +602,8 @@ export class SplitView extends lifecycle.Disposable implements
|
||||
if (this.views.length > 2) {
|
||||
let s = new sash.Sash(this.el, this, { orientation: this.sashOrientation });
|
||||
this.sashes.splice(index - 1, 0, s);
|
||||
this.sashesListeners.push(s.addListener('start', e => this.onSashStart(s, this.eventWrapper(e))));
|
||||
this.sashesListeners.push(s.addListener('change', e => this.onSashChange(s, this.eventWrapper(e))));
|
||||
this.sashesListeners.push(s.onDidStart((e) => this.onSashStart(s, this.eventWrapper(e))));
|
||||
this.sashesListeners.push(s.onDidChange((e) => this.onSashChange(s, this.eventWrapper(e))));
|
||||
}
|
||||
|
||||
this.viewChangeListeners.splice(index, 0, view.addListener('change', size => this.onViewChange(view, size)));
|
||||
@@ -611,7 +611,7 @@ export class SplitView extends lifecycle.Disposable implements
|
||||
|
||||
let viewFocusTracker = dom.trackFocus(viewElement);
|
||||
this.viewFocusListeners.splice(index, 0, viewFocusTracker);
|
||||
viewFocusTracker.addFocusListener(() => this._onFocus.fire(view));
|
||||
viewFocusTracker.onDidFocus(() => this._onFocus.fire(view));
|
||||
|
||||
this.viewFocusPreviousListeners.splice(index, 0, view.addListener('focusPrevious', () => index > 0 && this.views[index - 1].focus()));
|
||||
this.viewFocusNextListeners.splice(index, 0, view.addListener('focusNext', () => index < this.views.length && this.views[index + 1].focus()));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Adapted from https://github.com/naresh-n/slickgrid-column-data-autosize/blob/master/src/slick.autocolumnsize.js
|
||||
|
||||
import { mixin, clone } from 'vs/base/common/objects';
|
||||
import { mixin, clone } from 'sql/base/common/objects';
|
||||
|
||||
export interface IAutoColumnSizeOptions extends Slick.PluginOptions {
|
||||
maxWidth?: number;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Drag select selection model gist taken from https://gist.github.com/skoon/5312536
|
||||
// heavily modified
|
||||
|
||||
import { clone } from 'vs/base/common/objects';
|
||||
import { clone } from 'sql/base/common/objects';
|
||||
|
||||
export class DragCellSelectionModel<T> implements Slick.SelectionModel<T, Array<Slick.Range>> {
|
||||
private readonly keyColResizeIncr = 5;
|
||||
|
||||
@@ -10,8 +10,7 @@ import 'vs/css!vs/base/browser/ui/actionbar/actionbar';
|
||||
import { Promise } from 'vs/base/common/winjs.base';
|
||||
import { Builder, $ } from 'vs/base/browser/builder';
|
||||
import { IAction, IActionRunner, ActionRunner } from 'vs/base/common/actions';
|
||||
import { EventType as CommonEventType } from 'vs/base/common/events';
|
||||
import { EventEmitter } from 'vs/base/common/eventEmitter';
|
||||
import { EventEmitter } from 'sql/base/common/eventEmitter';
|
||||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
|
||||
import {
|
||||
@@ -32,7 +31,7 @@ let defaultOptions: IActionBarOptions = {
|
||||
* ActionBar vs/base/browser/ui/actionbar/actionbar. This class was needed because we
|
||||
* want the ability to display content other than Action icons in the QueryTaskbar.
|
||||
*/
|
||||
export class ActionBar extends EventEmitter implements IActionRunner {
|
||||
export class ActionBar extends ActionRunner implements IActionRunner {
|
||||
|
||||
private _options: IActionBarOptions;
|
||||
private _actionRunner: IActionRunner;
|
||||
@@ -60,7 +59,7 @@ export class ActionBar extends EventEmitter implements IActionRunner {
|
||||
this._toDispose.push(this._actionRunner);
|
||||
}
|
||||
|
||||
this._toDispose.push(this.addEmitter(this._actionRunner));
|
||||
//this._toDispose.push(this.addEmitter(this._actionRunner));
|
||||
|
||||
this._items = [];
|
||||
this._focusedItem = undefined;
|
||||
@@ -122,14 +121,16 @@ export class ActionBar extends EventEmitter implements IActionRunner {
|
||||
});
|
||||
|
||||
this._focusTracker = DOM.trackFocus(this._domNode);
|
||||
this._focusTracker.addBlurListener(() => {
|
||||
this._focusTracker.onDidBlur(() => {
|
||||
if (document.activeElement === this._domNode || !DOM.isAncestor(document.activeElement, this._domNode)) {
|
||||
this.emit(DOM.EventType.BLUR, {});
|
||||
|
||||
// @SQLTODO
|
||||
//this.emit(DOM.EventType.BLUR, {});
|
||||
this._focusedItem = undefined;
|
||||
}
|
||||
});
|
||||
|
||||
this._focusTracker.addFocusListener(() => this.updateFocusedItem());
|
||||
this._focusTracker.onDidFocus(() => this.updateFocusedItem());
|
||||
|
||||
this._actionsList = document.createElement('ul');
|
||||
this._actionsList.className = 'actions-container';
|
||||
@@ -226,7 +227,7 @@ export class ActionBar extends EventEmitter implements IActionRunner {
|
||||
|
||||
item.actionRunner = this._actionRunner;
|
||||
item.setActionContext(this.context);
|
||||
this.addEmitter(item);
|
||||
//this.addEmitter(item);
|
||||
item.render(actionItemElement);
|
||||
|
||||
if (index === null || index < 0 || index >= this._actionsList.children.length) {
|
||||
@@ -354,7 +355,7 @@ export class ActionBar extends EventEmitter implements IActionRunner {
|
||||
(<HTMLElement>document.activeElement).blur(); // remove focus from focussed action
|
||||
}
|
||||
|
||||
this.emit(CommonEventType.CANCEL);
|
||||
//this.emit('cancel');
|
||||
}
|
||||
|
||||
public run(action: IAction, context?: any): Promise {
|
||||
|
||||
Reference in New Issue
Block a user