diff --git a/src/sql/azdata.d.ts b/src/sql/azdata.d.ts index 0877cf53db..4bba1f5d30 100644 --- a/src/sql/azdata.d.ts +++ b/src/sql/azdata.d.ts @@ -356,6 +356,10 @@ declare module 'azdata' { * Holds the connection profile for nodes, used by data explorer tree view api */ payload?: any; + /** + * Specify the icon for the node. The value could the path to the icon or and ADS icon defined in {@link SqlThemeIcon}. + */ + icon?: IconPath | SqlThemeIcon; } export interface IConnectionProfile extends ConnectionInfo { @@ -439,6 +443,14 @@ declare module 'azdata' { * information about the actual connection established */ connectionSummary: ConnectionSummary; + /** + * Indicates whether the server version is supported by ADS. The default value is true. If the value is false, ADS will show a warning message. + */ + isSupportedVersion?: boolean; + /** + * The messages that will be appended to the Azure Data Studio's warning message about unsupported versions. + */ + unsupportedVersionMessage?: string; } /** @@ -942,6 +954,22 @@ declare module 'azdata' { rowCount: number; columnInfo: IDbColumn[]; complete: boolean; + /** + * The visualization options for the result set. + */ + visualization?: VisualizationOptions; + } + + /** + * Defines all the supported visualization types + */ + export type VisualizationType = 'bar' | 'count' | 'doughnut' | 'horizontalBar' | 'image' | 'line' | 'pie' | 'scatter' | 'table' | 'timeSeries'; + + /** + * Defines the configuration options for visualization + */ + export interface VisualizationOptions { + type: VisualizationType; } export interface BatchSummary { @@ -2683,6 +2711,10 @@ declare module 'azdata' { separator(): ComponentBuilder; infoBox(): ComponentBuilder; propertiesContainer(): ComponentBuilder; + radioCardGroup(): ComponentBuilder; + listView(): ComponentBuilder; + tabbedPanel(): TabbedPanelComponentBuilder; + slider(): ComponentBuilder; } export interface TreeComponentDataProvider extends vscode.TreeDataProvider { @@ -3888,6 +3920,291 @@ declare module 'azdata' { * The properties to display */ propertyItems?: PropertiesContainerItem[] | undefined; + /** + * Whether to show the button that will hide/show the content of the container. Default value is false. + */ + showToggleButton?: boolean; + } + + /** + * Represent a card in the radio card group component. + */ + export interface RadioCard { + /** + * Id of the card. + */ + id: string; + /** + * descriptions to be displayed in the card. + */ + descriptions: RadioCardDescription[]; + /** + * Icon of the card. + */ + icon?: IconPath; + } + + /** + * Represents a text component inside the radio card. + */ + export interface RadioCardDescription { + /** + * The text to be displayed. + */ + textValue: string; + /** + * The link's display text. + */ + linkDisplayValue?: string; + /** + * Whether to show the link icon. + */ + displayLinkCodicon?: boolean; + /** + * CSS styles for the text. + */ + textStyles?: CssStyles; + /** + * CSS styles for the link. + */ + linkStyles?: CssStyles; + /** + * CSS styles for the link icon. + */ + linkCodiconStyles?: CssStyles; + } + + /** + * Properties of radio card group component. + */ + export interface RadioCardGroupComponentProperties extends ComponentProperties, TitledComponentProperties { + /** + * Cards information. + */ + cards: RadioCard[]; + /** + * Width of the card. + */ + cardWidth: string; + /** + * Height of the card. + */ + cardHeight: string; + /** + * Width of the icon. + */ + iconWidth?: string; + /** + * Height of the icon. + */ + iconHeight?: string; + /** + * Id of the currently selected card. + */ + selectedCardId?: string; + /** + * Oritentation of the cards in the group. Default value is horizontal. + */ + orientation?: Orientation; + /** + * Position of the icon. Default value is top. + */ + iconPosition?: 'top' | 'left'; + } + + /** + * Event arguments when the selected card is changed. + */ + export type RadioCardSelectionChangedEvent = { cardId: string; card: RadioCard }; + /** + * Event arguments when a link in the radio card is clicked. + */ + export type RadioCardLinkClickEvent = { cardId: string, card: RadioCard, description: RadioCardDescription }; + + /** + * Defines the radio card group component. + */ + export interface RadioCardGroupComponent extends Component, RadioCardGroupComponentProperties { + /** + * Raised when the selected card is changed. + */ + onSelectionChanged: vscode.Event; + /** + * Raised when a link a clicked in a card. + */ + onLinkClick: vscode.Event; + } + + /** + * Properties for the list view component. + */ + export interface ListViewComponentProperties extends ComponentProperties { + /** + * Title of the component. + */ + title?: ListViewTitle; + /** + * Items in the list view. + */ + options: ListViewOption[]; + /** + * Id of the currently selected option. + */ + selectedOptionId?: string; + } + + /** + * Title of the list view component. + */ + export interface ListViewTitle { + /** + * Display text. + */ + text?: string; + /** + * CSS styles of the title. + */ + style?: CssStyles; + } + + /** + * Defines an item in list view component. + */ + export interface ListViewOption { + /** + * Display text of the item. + */ + label: string; + /** + * Id of the item. + */ + id: string; + } + + /** + * Event arg when a list view item is selected. + */ + export type ListViewClickEvent = { id: string }; + + /** + * Defines the list view component. + */ + export interface ListViewComponent extends Component, ListViewComponentProperties { + /** + * Fired when a list view item is selected. + */ + onDidClick: vscode.Event; + } + /** + * Panel component with tabs + */ + export interface TabbedPanelComponent extends Container { + /** + * An event triggered when the selected tab is changed. + * The event argument is the id of the selected tab. + */ + onTabChanged: vscode.Event; + + /** + * update the tabs. + * @param tabs new tabs + */ + updateTabs(tabs: (Tab | TabGroup)[]): void; + + /** + * Selects the tab with the specified id + * @param id The id of the tab to select + */ + selectTab(id: string): void; + } + + /** + * Defines the tab orientation of TabbedPanelComponent + */ + export enum TabOrientation { + Vertical = 'vertical', + Horizontal = 'horizontal' + } + + /** + * Layout of TabbedPanelComponent, can be used to initialize the component when using ModelBuilder + */ + export interface TabbedPanelLayout { + /** + * Tab orientation. Default horizontal. + */ + orientation?: TabOrientation; + + /** + * Whether to show the tab icon. Default false. + */ + showIcon?: boolean; + + /** + * Whether to show the tab navigation pane even when there is only one tab. Default false. + */ + alwaysShowTabs?: boolean; + } + + /** + * Represents the tab group of TabbedPanelComponent + */ + export interface TabGroup { + /** + * Title of the tab group + */ + title: string; + + /** + * children of the tab group + */ + tabs: Tab[]; + } + + /** + * Builder for TabbedPanelComponent + */ + export interface TabbedPanelComponentBuilder extends ContainerBuilder { + /** + * Add the tabs to the component + * @param tabs tabs/tab groups to be added + */ + withTabs(tabs: (Tab | TabGroup)[]): ContainerBuilder; + } + + export interface SliderComponentProperties extends ComponentProperties { + /** + * The value selected on the slider. Default initial value is the minimum value. + */ + value?: number, + /** + * The minimum value of the slider. Default value is 1. + */ + min?: number, + /** + * The maximum value of the slider. Default value is 100. + */ + max?: number, + /** + * The value between each "tick" of the slider. Default is 1. + */ + step?: number, + /** + * Whether to show the tick marks on the slider. Default is false. + */ + showTicks?: boolean + /** + * The width of the slider, not including the value box. + */ + width?: number | string; + } + + /** + * Defines the slider component + */ + export interface SliderComponent extends Component, SliderComponentProperties { + onChanged: vscode.Event; + onInput: vscode.Event; } /** @@ -3967,6 +4284,19 @@ declare module 'azdata' { */ export function createModelViewDialog(title: string, dialogName?: string, width?: DialogWidth): Dialog; + /** + * Create a dialog with the given title + * @param title Title of the dialog, displayed at the top. + * @param dialogName Name of the dialog. + * @param width Width of the dialog, default is 'narrow'. + * @param dialogStyle Defines the dialog style, default is 'flyout'. + * @param dialogPosition Defines the dialog position, default is undefined + * @param renderHeader Specify whether or not to render the Dialog header, default is true. + * @param renderFooter Specify whether or not to render the Dialog footer, default is true. + * @param dialogProperties Positional data prior to opening of dialog, default is undefined. + */ + export function createModelViewDialog(title: string, dialogName?: string, width?: DialogWidth, dialogStyle?: DialogStyle, dialogPosition?: DialogPosition, renderHeader?: boolean, renderFooter?: boolean, dialogProperties?: IDialogProperties): Dialog; + export interface ModelViewDashboard { /** * Registers the initial set of tabs for this dashboard @@ -4085,6 +4415,46 @@ declare module 'azdata' { readonly onValidityChanged: vscode.Event; } + /** + * The reason that the dialog was closed + */ + export type CloseReason = 'close' | 'cancel' | 'ok'; + /** + * These dialog styles affect how the dialog displays in the application. + * normal: Positioned top and centered. + * flyout (default): Positioned full screen height, opens from the right side of the application. + * callout: Opens below or beside parent element, contains footer section with buttons. + */ + export type DialogStyle = 'normal' | 'flyout' | 'callout'; + + /** + * Where to position the dialog relative to the parent element + */ + export type DialogPosition = 'left' | 'below'; + + /** + * The p + * They are needed for positioning relative to the element which triggers the opening of the dialog. + */ + export interface IDialogProperties { + /** + * x position of the dialog relative to the parent element + */ + xPos: number, + /** + * y position of the dialog relative to the parent element + */ + yPos: number, + /** + * width of the dialog + */ + width: number, + /** + * height of the dialog + */ + height: number + } + // Model view dialog classes export interface Dialog extends ModelViewPanel { /** @@ -4130,6 +4500,42 @@ declare module 'azdata' { */ dialogName?: string | undefined; + /** + * Width of the dialog. + * Default is 'narrow'. + */ + width?: DialogWidth; + + /** + * Dialog style type: normal, flyout, callout. + * Default is 'flyout'. + */ + dialogStyle?: DialogStyle; + + /** + * Dialog position type: left, below and undefined. + * Default is undefined. + */ + dialogPosition?: DialogPosition; + + /** + * Specify whether or not to render the Dialog header. + * Default is true. + */ + renderHeader?: boolean; + + /** + * Specify whether or not to render the Dialog footer. + * Default is true. + */ + renderFooter?: boolean; + + /** + * Positional data prior to opening of dialog. + * Default is undefined. + */ + dialogProperties?: IDialogProperties; + /** * Register a callback that will be called when the user tries to click done. Only * one callback can be registered at once, so each registration call will clear @@ -4144,6 +4550,11 @@ declare module 'azdata' { * @param operationInfo Operation Information */ registerOperation(operationInfo: BackgroundOperationInfo): void; + + /** + * Fired when the dialog is closed for any reason. The value indicates the reason it was closed (such as 'ok' or 'cancel') + */ + onClosed: vscode.Event; } export interface DialogTab extends ModelViewPanel { @@ -4303,6 +4714,11 @@ declare module 'azdata' { */ displayPageTitles: boolean; + /** + * Width of the wizard + */ + width?: DialogWidth; + /** * Event fired when the wizard's page changes, containing information about the * previous page and the new page @@ -4427,6 +4843,17 @@ declare module 'azdata' { * Get a QueryDocument object for a file URI */ export function getQueryDocument(fileUri: string): Thenable; + + /** + * Opens an untitled text document. The editor will prompt the user for a file + * path when the document is to be saved. The `options` parameter allows to + * specify the *content* of the document. + * + * @param options Options to control how the document will be created. + * @param providerId Optional provider ID this editor will be associated with. Defaults to MSSQL. + * @return A promise that resolves to a [document](#QueryDocument). + */ + export function openQueryDocument(options?: { content?: string; }, providerId?: string): Thenable; } /** diff --git a/src/sql/azdata.proposed.d.ts b/src/sql/azdata.proposed.d.ts index 277d230982..fe9d14ba8b 100644 --- a/src/sql/azdata.proposed.d.ts +++ b/src/sql/azdata.proposed.d.ts @@ -8,20 +8,6 @@ import * as vscode from 'vscode'; declare module 'azdata' { - - export namespace queryeditor { - /** - * Opens an untitled text document. The editor will prompt the user for a file - * path when the document is to be saved. The `options` parameter allows to - * specify the *content* of the document. - * - * @param options Options to control how the document will be created. - * @param providerId Optional provider ID this editor will be associated with. Defaults to MSSQL. - * @return A promise that resolves to a [document](#QueryDocument). - */ - export function openQueryDocument(options?: { content?: string; }, providerId?: string): Thenable; - } - export namespace nb { export interface NotebookDocument { /** @@ -380,73 +366,6 @@ declare module 'azdata' { defaultValueOsOverrides?: DefaultValueOsOverride[]; } - export interface ModelBuilder { - radioCardGroup(): ComponentBuilder; - listView(): ComponentBuilder; - tabbedPanel(): TabbedPanelComponentBuilder; - slider(): ComponentBuilder; - } - - export interface RadioCard { - id: string; - descriptions: RadioCardDescription[]; - icon?: IconPath; - } - - export interface RadioCardDescription { - textValue: string; - linkDisplayValue?: string; - displayLinkCodicon?: boolean; - textStyles?: CssStyles; - linkStyles?: CssStyles; - linkCodiconStyles?: CssStyles; - } - - export interface RadioCardGroupComponentProperties extends ComponentProperties, TitledComponentProperties { - cards: RadioCard[]; - cardWidth: string; - cardHeight: string; - iconWidth?: string; - iconHeight?: string; - selectedCardId?: string; - orientation?: Orientation; // Defaults to horizontal - iconPosition?: 'top' | 'left'; // Defaults to top - } - - export type RadioCardSelectionChangedEvent = { cardId: string; card: RadioCard }; - export type RadioCardLinkClickEvent = { cardId: string, card: RadioCard, description: RadioCardDescription }; - - export interface RadioCardGroupComponent extends Component, RadioCardGroupComponentProperties { - /** - * The card object returned from this function is a clone of the internal representation - changes will not impact the original object - */ - onSelectionChanged: vscode.Event; - - onLinkClick: vscode.Event; - - } - - export interface ListViewComponentProperties extends ComponentProperties { - title?: ListViewTitle; - options: ListViewOption[]; - selectedOptionId?: string; - } - - export interface ListViewTitle { - text?: string; - style?: CssStyles; - } - - export interface ListViewOption { - label: string; - id: string; - } - - export type ListViewClickEvent = { id: string }; - - export interface ListViewComponent extends Component, ListViewComponentProperties { - onDidClick: vscode.Event; - } export interface DeclarativeTableProperties { /** @@ -509,115 +428,6 @@ declare module 'azdata' { validationErrorMessages?: string[]; } - /** - * Panel component with tabs - */ - export interface TabbedPanelComponent extends Container { - /** - * An event triggered when the selected tab is changed. - * The event argument is the id of the selected tab. - */ - onTabChanged: vscode.Event; - - /** - * update the tabs. - * @param tabs new tabs - */ - updateTabs(tabs: (Tab | TabGroup)[]): void; - - /** - * Selects the tab with the specified id - * @param id The id of the tab to select - */ - selectTab(id: string): void; - } - - /** - * Defines the tab orientation of TabbedPanelComponent - */ - export enum TabOrientation { - Vertical = 'vertical', - Horizontal = 'horizontal' - } - - /** - * Layout of TabbedPanelComponent, can be used to initialize the component when using ModelBuilder - */ - export interface TabbedPanelLayout { - /** - * Tab orientation. Default horizontal. - */ - orientation?: TabOrientation; - - /** - * Whether to show the tab icon. Default false. - */ - showIcon?: boolean; - - /** - * Whether to show the tab navigation pane even when there is only one tab. Default false. - */ - alwaysShowTabs?: boolean; - } - - /** - * Represents the tab group of TabbedPanelComponent - */ - export interface TabGroup { - /** - * Title of the tab group - */ - title: string; - - /** - * children of the tab group - */ - tabs: Tab[]; - } - - /** - * Builder for TabbedPanelComponent - */ - export interface TabbedPanelComponentBuilder extends ContainerBuilder { - /** - * Add the tabs to the component - * @param tabs tabs/tab groups to be added - */ - withTabs(tabs: (Tab | TabGroup)[]): ContainerBuilder; - } - - export interface SliderComponentProperties extends ComponentProperties { - /** - * The value selected on the slider. Default initial value is the minimum value. - */ - value?: number, - /** - * The minimum value of the slider. Default value is 1. - */ - min?: number, - /** - * The maximum value of the slider. Default value is 100. - */ - max?: number, - /** - * The value between each "tick" of the slider. Default is 1. - */ - step?: number, - /** - * Whether to show the tick marks on the slider. Default is false. - */ - showTicks?: boolean - /** - * The width of the slider, not including the value box. - */ - width?: number | string; - } - - export interface SliderComponent extends Component, SliderComponentProperties { - onChanged: vscode.Event; - onInput: vscode.Event; - } - /** * The heading levels an HTML heading element can be. */ @@ -645,109 +455,6 @@ declare module 'azdata' { textType?: TextType; } - export namespace window { - - /** - * The reason that the dialog was closed - */ - export type CloseReason = 'close' | 'cancel' | 'ok'; - - export interface Dialog { - /** - * Width of the dialog. - * Default is 'narrow'. - */ - width?: DialogWidth; - /** - * Dialog style type: normal, flyout, callout. - * Default is 'flyout'. - */ - dialogStyle?: DialogStyle; - /** - * Dialog position type: left, below and undefined. - * Default is undefined. - */ - dialogPosition?: DialogPosition; - /** - * Specify whether or not to render the Dialog header. - * Default is true. - */ - renderHeader?: boolean; - /** - * Specify whether or not to render the Dialog footer. - * Default is true. - */ - renderFooter?: boolean; - /** - * Positional data prior to opening of dialog. - * Default is undefined. - */ - dialogProperties?: IDialogProperties; - - /** - * Fired when the dialog is closed for any reason. The value indicates the reason it was closed (such as 'ok' or 'cancel') - */ - onClosed: vscode.Event; - } - - export interface Wizard { - /** - * Width of the wizard - */ - width?: DialogWidth; - } - - /** - * These dialog styles affect how the dialog displays in the application. - * normal: Positioned top and centered. - * flyout (default): Positioned full screen height, opens from the right side of the application. - * callout: Opens below or beside parent element, contains footer section with buttons. - */ - export type DialogStyle = 'normal' | 'flyout' | 'callout'; - - /** - * Where to position the dialog relative to the parent element - */ - export type DialogPosition = 'left' | 'below'; - - /** - * The p - * They are needed for positioning relative to the element which triggers the opening of the dialog. - */ - export interface IDialogProperties { - /** - * x position of the dialog relative to the parent element - */ - xPos: number, - /** - * y position of the dialog relative to the parent element - */ - yPos: number, - /** - * width of the dialog - */ - width: number, - /** - * height of the dialog - */ - height: number - } - - /** - * Create a dialog with the given title - * @param title Title of the dialog, displayed at the top. - * @param dialogName Name of the dialog. - * @param width Width of the dialog, default is 'narrow'. - * @param dialogStyle Defines the dialog style, default is 'flyout'. - * @param dialogPosition Defines the dialog position, default is undefined - * @param renderHeader Specify whether or not to render the Dialog header, default is true. - * @param renderFooter Specify whether or not to render the Dialog footer, default is true. - * @param dialogProperties Positional data prior to opening of dialog, default is undefined. - */ - export function createModelViewDialog(title: string, dialogName?: string, width?: DialogWidth, dialogStyle?: DialogStyle, dialogPosition?: DialogPosition, renderHeader?: boolean, renderFooter?: boolean, dialogProperties?: IDialogProperties): Dialog; - - } - export interface TaskInfo { targetLocation?: string; } @@ -965,31 +672,6 @@ declare module 'azdata' { executionPlans: ExecutionPlanGraph[]; } - export interface ResultSetSummary { - /** - * The visualization options for the result set. - */ - visualization?: VisualizationOptions; - } - - /** - * Defines all the supported visualization types - */ - export type VisualizationType = 'bar' | 'count' | 'doughnut' | 'horizontalBar' | 'image' | 'line' | 'pie' | 'scatter' | 'table' | 'timeSeries'; - - /** - * Defines the configuration options for visualization - */ - export interface VisualizationOptions { - type: VisualizationType; - } - - export interface PropertiesContainerComponentProperties { - /** - * Whether to show the button that will hide/show the content of the container. Default value is false. - */ - showToggleButton?: boolean; - } export interface ServerInfo { /** @@ -1002,13 +684,6 @@ declare module 'azdata' { physicalMemoryInMb?: number; } - export interface NodeInfo { - /** - * Specify the icon for the node. The value could the path to the icon or and ADS icon defined in {@link SqlThemeIcon}. - */ - icon?: IconPath | SqlThemeIcon; - } - export interface ObjectMetadata { /* * Parent object name for subobjects such as triggers, indexes, etc. @@ -1037,18 +712,6 @@ declare module 'azdata' { } } - export interface ConnectionInfoSummary { - /** - * Indicates whether the server version is supported by ADS. The default value is true. If the value is false, ADS will show a warning message. - */ - isSupportedVersion?: boolean; - - /** - * The messages that will be appended to the Azure Data Studio's warning message about unsupported versions. - */ - unsupportedVersionMessage?: string; - } - export enum DataProviderType { TableDesignerProvider = 'TableDesignerProvider' }