mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
remove builder from button (#4146)
This commit is contained in:
@@ -7,7 +7,6 @@
|
|||||||
import { Button as vsButton, IButtonOptions, IButtonStyles as vsIButtonStyles } from 'vs/base/browser/ui/button/button';
|
import { Button as vsButton, IButtonOptions, IButtonStyles as vsIButtonStyles } from 'vs/base/browser/ui/button/button';
|
||||||
import * as DOM from 'vs/base/browser/dom';
|
import * as DOM from 'vs/base/browser/dom';
|
||||||
import { Color } from 'vs/base/common/color';
|
import { Color } from 'vs/base/common/color';
|
||||||
import { Builder } from 'sql/base/browser/builder';
|
|
||||||
|
|
||||||
export interface IButtonStyles extends vsIButtonStyles {
|
export interface IButtonStyles extends vsIButtonStyles {
|
||||||
buttonFocusOutline?: Color;
|
buttonFocusOutline?: Color;
|
||||||
@@ -15,29 +14,26 @@ export interface IButtonStyles extends vsIButtonStyles {
|
|||||||
|
|
||||||
export class Button extends vsButton {
|
export class Button extends vsButton {
|
||||||
private buttonFocusOutline: Color;
|
private buttonFocusOutline: Color;
|
||||||
private $el: Builder;
|
|
||||||
|
|
||||||
constructor(container: HTMLElement, options?: IButtonOptions) {
|
constructor(container: HTMLElement, options?: IButtonOptions) {
|
||||||
super(container, options);
|
super(container, options);
|
||||||
this.buttonFocusOutline = null;
|
this.buttonFocusOutline = null;
|
||||||
this.$el = new Builder(this.element);
|
|
||||||
|
|
||||||
this.$el.on(DOM.EventType.FOCUS, (e) => {
|
this._register(DOM.addDisposableListener(this.element, DOM.EventType.FOCUS, () => {
|
||||||
this.$el.style('outline-color', this.buttonFocusOutline ? this.buttonFocusOutline.toString() : null);
|
this.element.style.outlineColor = this.buttonFocusOutline ? this.buttonFocusOutline.toString() : null;
|
||||||
this.$el.style('outline-width', '1px');
|
this.element.style.outlineWidth = '1px';
|
||||||
});
|
}));
|
||||||
|
|
||||||
this.$el.on(DOM.EventType.MOUSE_DOWN, (e) => {
|
this._register(DOM.addDisposableListener(this.element, DOM.EventType.MOUSE_DOWN, e => {
|
||||||
const mouseEvent = e as MouseEvent;
|
if (!DOM.hasClass(this.element, 'disabled') && e.button === 0) {
|
||||||
if (!this.$el.hasClass('disabled') && mouseEvent.button === 0) {
|
DOM.addClass(this.element, 'active');
|
||||||
this.$el.addClass('active');
|
|
||||||
}
|
}
|
||||||
});
|
}));
|
||||||
|
|
||||||
this.$el.on([DOM.EventType.MOUSE_UP], (e) => {
|
this._register(DOM.addDisposableListener(this.element, DOM.EventType.MOUSE_UP, e => {
|
||||||
DOM.EventHelper.stop(e);
|
DOM.EventHelper.stop(e);
|
||||||
this.$el.removeClass('active');
|
DOM.removeClass(this.element, 'active');
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
public style(styles: IButtonStyles): void {
|
public style(styles: IButtonStyles): void {
|
||||||
@@ -46,14 +42,14 @@ export class Button extends vsButton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public set title(value: string) {
|
public set title(value: string) {
|
||||||
this.$el.title(value);
|
this.element.title = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public setHeight(value: string) {
|
public setHeight(value: string) {
|
||||||
this.$el.style('height', value);
|
this.element.style.height = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public setWidth(value: string) {
|
public setWidth(value: string) {
|
||||||
this.$el.style('width', value);
|
this.element.style.width = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -32,8 +32,7 @@ const defaultOptions: IButtonStyles = {
|
|||||||
|
|
||||||
export class Button extends Disposable {
|
export class Button extends Disposable {
|
||||||
|
|
||||||
// {{SQL CARBON EDIT}} -- changed access modifier to protected
|
private _element: HTMLElement;
|
||||||
protected _element: HTMLElement;
|
|
||||||
private options: IButtonOptions;
|
private options: IButtonOptions;
|
||||||
|
|
||||||
private buttonBackground: Color | undefined;
|
private buttonBackground: Color | undefined;
|
||||||
|
|||||||
Reference in New Issue
Block a user