mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 17:19:48 +01:00
Remove deprecated widget API (#284546)
and move the widget logic into the QuickWidget class
This commit is contained in:
committed by
GitHub
parent
d390495f1f
commit
d5df40d240
@@ -156,8 +156,6 @@ export abstract class QuickInput extends Disposable implements IQuickInput {
|
||||
protected _visible = observableValue('visible', false);
|
||||
private _title: string | undefined;
|
||||
private _description: string | undefined;
|
||||
private _widget: HTMLElement | undefined;
|
||||
private _widgetUpdated = false;
|
||||
private _steps: number | undefined;
|
||||
private _totalSteps: number | undefined;
|
||||
private _enabled = true;
|
||||
@@ -213,21 +211,6 @@ export abstract class QuickInput extends Disposable implements IQuickInput {
|
||||
this.update();
|
||||
}
|
||||
|
||||
get widget() {
|
||||
return this._widget;
|
||||
}
|
||||
|
||||
set widget(widget: unknown | undefined) {
|
||||
if (!(dom.isHTMLElement(widget))) {
|
||||
return;
|
||||
}
|
||||
if (this._widget !== widget) {
|
||||
this._widget = widget;
|
||||
this._widgetUpdated = true;
|
||||
this.update();
|
||||
}
|
||||
}
|
||||
|
||||
get step() {
|
||||
return this._steps;
|
||||
}
|
||||
@@ -417,14 +400,6 @@ export abstract class QuickInput extends Disposable implements IQuickInput {
|
||||
if (this.ui.description2.textContent !== description) {
|
||||
this.ui.description2.textContent = description;
|
||||
}
|
||||
if (this._widgetUpdated) {
|
||||
this._widgetUpdated = false;
|
||||
if (this._widget) {
|
||||
dom.reset(this.ui.widget, this._widget);
|
||||
} else {
|
||||
dom.reset(this.ui.widget);
|
||||
}
|
||||
}
|
||||
if (this.busy && !this.busyDelay) {
|
||||
this.busyDelay = new TimeoutTimer();
|
||||
this.busyDelay.setIfNotSet(() => {
|
||||
@@ -1358,17 +1333,37 @@ export class InputBox extends QuickInput implements IInputBox {
|
||||
export class QuickWidget extends QuickInput implements IQuickWidget {
|
||||
readonly type = QuickInputType.QuickWidget;
|
||||
|
||||
private _widget: HTMLElement | undefined;
|
||||
private _widgetUpdated = false;
|
||||
|
||||
get widget() {
|
||||
return this._widget;
|
||||
}
|
||||
|
||||
set widget(widget: HTMLElement | undefined) {
|
||||
if (this._widget !== widget) {
|
||||
this._widget = widget;
|
||||
this._widgetUpdated = true;
|
||||
this.update();
|
||||
}
|
||||
}
|
||||
|
||||
protected override update() {
|
||||
if (!this.visible) {
|
||||
return;
|
||||
}
|
||||
|
||||
const visibilities: Visibilities = {
|
||||
this.ui.setVisibilities({
|
||||
title: !!this.title || !!this.step || !!this.titleButtons.length,
|
||||
description: !!this.description || !!this.step
|
||||
};
|
||||
|
||||
this.ui.setVisibilities(visibilities);
|
||||
});
|
||||
if (this._widgetUpdated) {
|
||||
this._widgetUpdated = false;
|
||||
if (this._widget) {
|
||||
dom.reset(this.ui.widget, this._widget);
|
||||
} else {
|
||||
dom.reset(this.ui.widget);
|
||||
}
|
||||
}
|
||||
super.update();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -313,12 +313,6 @@ export interface IQuickInput extends IDisposable {
|
||||
*/
|
||||
description: string | undefined;
|
||||
|
||||
/**
|
||||
* An HTML widget rendered below the input.
|
||||
* @deprecated Use an IQuickWidget instead.
|
||||
*/
|
||||
widget: any | undefined;
|
||||
|
||||
/**
|
||||
* The current step of the quick input rendered in the titlebar.
|
||||
*/
|
||||
@@ -390,10 +384,9 @@ export interface IQuickWidget extends IQuickInput {
|
||||
readonly type: QuickInputType.QuickWidget;
|
||||
|
||||
/**
|
||||
* Should be an HTMLElement (TODO: move this entire file into browser)
|
||||
* @override
|
||||
* A HTML element that will be rendered inside the quick input.
|
||||
*/
|
||||
widget: any | undefined;
|
||||
widget: HTMLElement | undefined;
|
||||
}
|
||||
|
||||
export interface IQuickPickWillAcceptEvent {
|
||||
|
||||
Reference in New Issue
Block a user