mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
apply css style at the right element (#14144)
* apply css style at the right element * make mergeCss protected
This commit is contained in:
@@ -31,13 +31,13 @@ import { IDisposable } from 'vs/base/common/lifecycle';
|
|||||||
<div *ngIf="this.buttonType !== 'Informational'; then thenBlock else elseBlock"></div>
|
<div *ngIf="this.buttonType !== 'Informational'; then thenBlock else elseBlock"></div>
|
||||||
<ng-template #thenBlock>
|
<ng-template #thenBlock>
|
||||||
<label for={{this.label}}>
|
<label for={{this.label}}>
|
||||||
<div #input style="width: 100%">
|
<div #input [ngStyle]="CSSStyles">
|
||||||
<input #fileInput *ngIf="this.isFile === true" id={{this.label}} type="file" accept="{{ this.fileType }}" style="display: none">
|
<input #fileInput *ngIf="this.isFile === true" id={{this.label}} type="file" accept="{{ this.fileType }}" style="display: none">
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
<ng-template #elseBlock>
|
<ng-template #elseBlock>
|
||||||
<div #infoButton style="width: 100%;"></div>
|
<div #infoButton [ngStyle]="CSSStyles"></div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import { ILogService } from 'vs/platform/log/common/log';
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'modelview-checkbox',
|
selector: 'modelview-checkbox',
|
||||||
template: `
|
template: `
|
||||||
<div #input width="100%" [style.display]="display"></div>
|
<div #input width="100%" [ngStyle]="CSSStyles"></div>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
export default class CheckBoxComponent extends ComponentBase<azdata.CheckBoxProperties> implements IComponent, OnDestroy, AfterViewInit {
|
export default class CheckBoxComponent extends ComponentBase<azdata.CheckBoxProperties> implements IComponent, OnDestroy, AfterViewInit {
|
||||||
@@ -127,4 +127,10 @@ export default class CheckBoxComponent extends ComponentBase<azdata.CheckBoxProp
|
|||||||
public focus(): void {
|
public focus(): void {
|
||||||
this._input.focus();
|
this._input.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get CSSStyles(): azdata.CssStyles {
|
||||||
|
return this.mergeCss(super.CSSStyles, {
|
||||||
|
'display': this.display
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,17 +86,9 @@ export abstract class ComponentBase<TPropertyBag extends azdata.ComponentPropert
|
|||||||
public refreshDataProvider(item: any): void {
|
public refreshDataProvider(item: any): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
public updateStyles(): void {
|
|
||||||
const element = (<HTMLElement>this._el.nativeElement);
|
|
||||||
for (const style in this.CSSStyles) {
|
|
||||||
element.style[style] = this.CSSStyles[style];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public setProperties(properties: { [key: string]: any; }): void {
|
public setProperties(properties: { [key: string]: any; }): void {
|
||||||
properties = properties || {};
|
properties = properties || {};
|
||||||
this.properties = properties;
|
this.properties = properties;
|
||||||
this.updateStyles();
|
|
||||||
this.layout();
|
this.layout();
|
||||||
this.validate().catch(onUnexpectedError);
|
this.validate().catch(onUnexpectedError);
|
||||||
}
|
}
|
||||||
@@ -105,7 +97,6 @@ export abstract class ComponentBase<TPropertyBag extends azdata.ComponentPropert
|
|||||||
public updateProperty(key: string, value: any): void {
|
public updateProperty(key: string, value: any): void {
|
||||||
if (key) {
|
if (key) {
|
||||||
this.properties[key] = value;
|
this.properties[key] = value;
|
||||||
this.updateStyles();
|
|
||||||
this.layout();
|
this.layout();
|
||||||
this.validate().catch(onUnexpectedError);
|
this.validate().catch(onUnexpectedError);
|
||||||
}
|
}
|
||||||
@@ -209,12 +200,12 @@ export abstract class ComponentBase<TPropertyBag extends azdata.ComponentPropert
|
|||||||
this.setPropertyFromUI<boolean>((props, value) => props.ariaHidden = value, newValue);
|
this.setPropertyFromUI<boolean>((props, value) => props.ariaHidden = value, newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public get CSSStyles(): { [key: string]: string } {
|
public get CSSStyles(): azdata.CssStyles {
|
||||||
return this.getPropertyOrDefault<{ [key: string]: string }>((props) => props.CSSStyles, {});
|
return this.getPropertyOrDefault<azdata.CssStyles>((props) => props.CSSStyles, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
public set CSSStyles(newValue: { [key: string]: string }) {
|
public set CSSStyles(newValue: azdata.CssStyles) {
|
||||||
this.setPropertyFromUI<{ [key: string]: string }>((properties, CSSStyles) => { properties.CSSStyles = CSSStyles; }, newValue);
|
this.setPropertyFromUI<azdata.CssStyles>((properties, CSSStyles) => { properties.CSSStyles = CSSStyles; }, newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected getWidth(): string {
|
protected getWidth(): string {
|
||||||
@@ -274,6 +265,17 @@ export abstract class ComponentBase<TPropertyBag extends azdata.ComponentPropert
|
|||||||
protected onkeydown(domNode: HTMLElement, listener: (e: StandardKeyboardEvent) => void): void {
|
protected onkeydown(domNode: HTMLElement, listener: (e: StandardKeyboardEvent) => void): void {
|
||||||
this._register(addDisposableListener(domNode, EventType.KEY_DOWN, (e: KeyboardEvent) => listener(new StandardKeyboardEvent(e))));
|
this._register(addDisposableListener(domNode, EventType.KEY_DOWN, (e: KeyboardEvent) => listener(new StandardKeyboardEvent(e))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected mergeCss(...styles: azdata.CssStyles[]): azdata.CssStyles {
|
||||||
|
const x = styles.reduce((previous, current) => {
|
||||||
|
if (current) {
|
||||||
|
return Object.assign(previous, current);
|
||||||
|
}
|
||||||
|
return previous;
|
||||||
|
}, {});
|
||||||
|
|
||||||
|
return x;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export abstract class ContainerBase<T, TPropertyBag extends azdata.ComponentProperties = azdata.ComponentProperties> extends ComponentBase<TPropertyBag> {
|
export abstract class ContainerBase<T, TPropertyBag extends azdata.ComponentProperties = azdata.ComponentProperties> extends ComponentBase<TPropertyBag> {
|
||||||
@@ -389,17 +391,6 @@ export abstract class ContainerBase<T, TPropertyBag extends azdata.ComponentProp
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public mergeCss(...styles: azdata.CssStyles[]): azdata.CssStyles {
|
|
||||||
const x = styles.reduce((previous, current) => {
|
|
||||||
if (current) {
|
|
||||||
return Object.assign(previous, current);
|
|
||||||
}
|
|
||||||
return previous;
|
|
||||||
}, {});
|
|
||||||
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected onItemsUpdated(): void {
|
protected onItemsUpdated(): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<table role="grid" #container *ngIf="columns" class="declarative-table" [style.height]="getHeight()"
|
<table role="grid" #container *ngIf="columns" class="declarative-table" [attr.aria-label]="ariaLabel" [ngStyle]="CSSStyles">
|
||||||
[style.width]="getWidth()" [attr.aria-label]="ariaLabel">
|
|
||||||
<thead role="rowgroup">
|
<thead role="rowgroup">
|
||||||
<tr role="row">
|
<tr role="row">
|
||||||
<ng-container *ngFor="let column of columns; let c = index;">
|
<ng-container *ngFor="let column of columns; let c = index;">
|
||||||
|
|||||||
@@ -310,4 +310,11 @@ export default class DeclarativeTableComponent extends ContainerBase<any, azdata
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get CSSStyles(): azdata.CssStyles {
|
||||||
|
return this.mergeCss(super.CSSStyles, {
|
||||||
|
'width': this.getWidth(),
|
||||||
|
'height': this.getHeight()
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import { ILogService } from 'vs/platform/log/common/log';
|
|||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
template: `
|
template: `
|
||||||
<div *ngIf="_title">
|
<div [ngStyle]="CSSStyles" *ngIf="_title">
|
||||||
<div class="modelview-diff-editor-title modelview-diff-editor-title-background">
|
<div class="modelview-diff-editor-title modelview-diff-editor-title-background">
|
||||||
{{_title}}
|
{{_title}}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import { ILogService } from 'vs/platform/log/common/log';
|
|||||||
selector: 'modelview-dropdown',
|
selector: 'modelview-dropdown',
|
||||||
template: `
|
template: `
|
||||||
|
|
||||||
<div [style.width]="getWidth()">
|
<div [ngStyle]="CSSStyles">
|
||||||
<div [style.display]="getLoadingDisplay()" style="width: 100%; position: relative">
|
<div [style.display]="getLoadingDisplay()" style="width: 100%; position: relative">
|
||||||
<div class="modelview-loadingComponent-spinner" style="position:absolute; right: 0px; margin-right: 5px; height:15px; z-index:1" #spinnerElement></div>
|
<div class="modelview-loadingComponent-spinner" style="position:absolute; right: 0px; margin-right: 5px; height:15px; z-index:1" #spinnerElement></div>
|
||||||
<div [style.display]="getLoadingDisplay()" #loadingBox style="width: 100%;"></div>
|
<div [style.display]="getLoadingDisplay()" #loadingBox style="width: 100%;"></div>
|
||||||
@@ -286,4 +286,10 @@ export default class DropDownComponent extends ComponentBase<azdata.DropDownProp
|
|||||||
public getStatusText(): string {
|
public getStatusText(): string {
|
||||||
return this.loading ? this.loadingText : this.loadingCompletedText;
|
return this.loading ? this.loadingText : this.loadingCompletedText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get CSSStyles(): azdata.CssStyles {
|
||||||
|
return this.mergeCss(super.CSSStyles, {
|
||||||
|
'width': this.getWidth()
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import { ILogService } from 'vs/platform/log/common/log';
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'modelview-fileBrowserTree',
|
selector: 'modelview-fileBrowserTree',
|
||||||
template: `
|
template: `
|
||||||
<div #fileBrowserTree [style.width]="getWidth()" [style.height]="getHeight()"></div>
|
<div #fileBrowserTree [ngStyle]="CSSStyles"></div>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
export default class FileBrowserTreeComponent extends ComponentBase<azdata.FileBrowserTreeProperties> implements IComponent, OnDestroy, AfterViewInit {
|
export default class FileBrowserTreeComponent extends ComponentBase<azdata.FileBrowserTreeProperties> implements IComponent, OnDestroy, AfterViewInit {
|
||||||
@@ -121,4 +121,11 @@ export default class FileBrowserTreeComponent extends ComponentBase<azdata.FileB
|
|||||||
public set ownerUri(newValue: string) {
|
public set ownerUri(newValue: string) {
|
||||||
this.setPropertyFromUI<string>((props, value) => props.ownerUri = value, newValue);
|
this.setPropertyFromUI<string>((props, value) => props.ownerUri = value, newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get CSSStyles(): azdata.CssStyles {
|
||||||
|
return this.mergeCss(super.CSSStyles, {
|
||||||
|
'width': this.getWidth(),
|
||||||
|
'height': this.getHeight()
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
ElementRef, OnDestroy, AfterViewInit
|
ElementRef, OnDestroy, AfterViewInit
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
|
||||||
import { FormLayout, FormItemLayout } from 'azdata';
|
import { FormLayout, FormItemLayout, CssStyles } from 'azdata';
|
||||||
|
|
||||||
import { ContainerBase } from 'sql/workbench/browser/modelComponents/componentBase';
|
import { ContainerBase } from 'sql/workbench/browser/modelComponents/componentBase';
|
||||||
import { IComponentDescriptor, IComponent, IModelStore } from 'sql/platform/dashboard/browser/interfaces';
|
import { IComponentDescriptor, IComponent, IModelStore } from 'sql/platform/dashboard/browser/interfaces';
|
||||||
@@ -36,7 +36,7 @@ class FormItem {
|
|||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
template: `
|
template: `
|
||||||
<div #container *ngIf="items" class="form-table" [style.padding]="getFormPadding()" [style.width]="getFormWidth()" [style.height]="getFormHeight()" role="presentation">
|
<div #container [ngStyle]="CSSStyles" *ngIf="items" class="form-table" role="presentation">
|
||||||
<ng-container *ngFor="let item of items">
|
<ng-container *ngFor="let item of items">
|
||||||
<div class="form-row" *ngIf="isGroupLabel(item)" [style.font-size]="getItemTitleFontSize(item)">
|
<div class="form-row" *ngIf="isGroupLabel(item)" [style.font-size]="getItemTitleFontSize(item)">
|
||||||
<div class="form-item-row form-group-label">
|
<div class="form-item-row form-group-label">
|
||||||
@@ -223,4 +223,12 @@ export default class FormContainer extends ContainerBase<FormItemLayout> impleme
|
|||||||
public isVertical(item: FormItem): boolean {
|
public isVertical(item: FormItem): boolean {
|
||||||
return item && item.config && !item.config.horizontal;
|
return item && item.config && !item.config.horizontal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get CSSStyles(): CssStyles {
|
||||||
|
return this.mergeCss(super.CSSStyles, {
|
||||||
|
'padding': this.getFormPadding(),
|
||||||
|
'width': this.getFormWidth(),
|
||||||
|
'height': this.getFormHeight()
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
ElementRef, OnDestroy, AfterViewInit
|
ElementRef, OnDestroy, AfterViewInit
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
|
||||||
import { GroupLayout, GroupContainerProperties } from 'azdata';
|
import { GroupLayout, GroupContainerProperties, CssStyles } from 'azdata';
|
||||||
|
|
||||||
import { ContainerBase } from 'sql/workbench/browser/modelComponents/componentBase';
|
import { ContainerBase } from 'sql/workbench/browser/modelComponents/componentBase';
|
||||||
import { endsWith } from 'vs/base/common/strings';
|
import { endsWith } from 'vs/base/common/strings';
|
||||||
@@ -25,7 +25,7 @@ import { ILogService } from 'vs/platform/log/common/log';
|
|||||||
<div *ngIf="hasHeader()" [class]="getHeaderClass()" (click)="changeState()" (keydown)="onKeyDown($event)" [tabindex]="isCollapsible()? 0 : -1" [attr.role]="isCollapsible() ? 'button' : null" [attr.aria-expanded]="isCollapsible() ? !collapsed : null">
|
<div *ngIf="hasHeader()" [class]="getHeaderClass()" (click)="changeState()" (keydown)="onKeyDown($event)" [tabindex]="isCollapsible()? 0 : -1" [attr.role]="isCollapsible() ? 'button' : null" [attr.aria-expanded]="isCollapsible() ? !collapsed : null">
|
||||||
{{_containerLayout.header}}
|
{{_containerLayout.header}}
|
||||||
</div>
|
</div>
|
||||||
<div #container *ngIf="items" class="modelview-group-container" [style.width]="getContainerWidth()" [style.display]="getContainerDisplayStyle()">
|
<div #container *ngIf="items" class="modelview-group-container" [ngStyle]="CSSStyles">
|
||||||
<ng-container *ngFor="let item of items">
|
<ng-container *ngFor="let item of items">
|
||||||
<div class="modelview-group-row" >
|
<div class="modelview-group-row" >
|
||||||
<div class="modelview-group-cell">
|
<div class="modelview-group-cell">
|
||||||
@@ -132,4 +132,11 @@ export default class GroupContainer extends ContainerBase<GroupLayout, GroupCont
|
|||||||
this._changeRef.detectChanges();
|
this._changeRef.detectChanges();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get CSSStyles(): CssStyles {
|
||||||
|
return this.mergeCss(super.CSSStyles, {
|
||||||
|
'display': this.getContainerDisplayStyle(),
|
||||||
|
'width': this.getContainerWidth(),
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import { ILogService } from 'vs/platform/log/common/log';
|
|||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'modelview-hyperlink',
|
selector: 'modelview-hyperlink',
|
||||||
template: `<a [href]="url" [title]="title" [attr.aria-label]="ariaLabel" target="blank" [class]="cssClass">{{label}}</a>`
|
template: `<a [href]="url" [title]="title" [attr.aria-label]="ariaLabel" target="blank" [ngStyle]="CSSStyles" [class]="cssClass">{{label}}</a>`
|
||||||
})
|
})
|
||||||
export default class HyperlinkComponent extends TitledComponent<azdata.HyperlinkComponentProperties> implements IComponent, OnDestroy, AfterViewInit {
|
export default class HyperlinkComponent extends TitledComponent<azdata.HyperlinkComponentProperties> implements IComponent, OnDestroy, AfterViewInit {
|
||||||
@Input() descriptor: IComponentDescriptor;
|
@Input() descriptor: IComponentDescriptor;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import { ILogService } from 'vs/platform/log/common/log';
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'modelview-image',
|
selector: 'modelview-image',
|
||||||
template: `
|
template: `
|
||||||
<div #imageContainer [title]="title" [style.width]="getWidth()" [style.height]="getHeight()" [style.background-size]="getImageSize()">`
|
<div #imageContainer [ngStyle]="CSSStyles" [title]="title">`
|
||||||
})
|
})
|
||||||
export default class ImageComponent extends ComponentWithIconBase<azdata.ImageComponentProperties> implements ITitledComponent, IComponent, OnDestroy, AfterViewInit {
|
export default class ImageComponent extends ComponentWithIconBase<azdata.ImageComponentProperties> implements ITitledComponent, IComponent, OnDestroy, AfterViewInit {
|
||||||
@Input() descriptor: IComponentDescriptor;
|
@Input() descriptor: IComponentDescriptor;
|
||||||
@@ -69,4 +69,12 @@ export default class ImageComponent extends ComponentWithIconBase<azdata.ImageCo
|
|||||||
public getImageSize(): string {
|
public getImageSize(): string {
|
||||||
return `${this.getIconWidth()} ${this.getIconHeight()}`;
|
return `${this.getIconWidth()} ${this.getIconHeight()}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get CSSStyles(): azdata.CssStyles {
|
||||||
|
return this.mergeCss(super.CSSStyles, {
|
||||||
|
'background-size': this.getImageSize(),
|
||||||
|
'width': this.getWidth(),
|
||||||
|
'height': this.getHeight()
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import { attachInfoBoxStyler } from 'sql/platform/theme/common/styler';
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'modelview-infobox',
|
selector: 'modelview-infobox',
|
||||||
template: `
|
template: `
|
||||||
<div #container>
|
<div #container [ngStyle]="CSSStyles">
|
||||||
</div>`
|
</div>`
|
||||||
})
|
})
|
||||||
export default class InfoBoxComponent extends ComponentBase<azdata.InfoBoxComponentProperties> implements IComponent, OnDestroy, AfterViewInit {
|
export default class InfoBoxComponent extends ComponentBase<azdata.InfoBoxComponentProperties> implements IComponent, OnDestroy, AfterViewInit {
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ import { ILogService } from 'vs/platform/log/common/log';
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'modelview-inputBox',
|
selector: 'modelview-inputBox',
|
||||||
template: `
|
template: `
|
||||||
<div [style.display]="getInputBoxDisplay()" #input [style.width]="width" ></div>
|
<div #input [ngStyle]="inputBoxCSSStyles"></div>
|
||||||
<div [style.display]="getTextAreaDisplay()" #textarea [style.width]="width" ></div>
|
<div #textarea [ngStyle]="textAreaCSSStyles"></div>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
export default class InputBoxComponent extends ComponentBase<azdata.InputBoxProperties> implements IComponent, OnDestroy, AfterViewInit {
|
export default class InputBoxComponent extends ComponentBase<azdata.InputBoxProperties> implements IComponent, OnDestroy, AfterViewInit {
|
||||||
@@ -363,4 +363,18 @@ export default class InputBoxComponent extends ComponentBase<azdata.InputBoxProp
|
|||||||
public set validationErrorMessage(newValue: string) {
|
public set validationErrorMessage(newValue: string) {
|
||||||
this.setPropertyFromUI<string>((props, value) => props.validationErrorMessage = value, newValue);
|
this.setPropertyFromUI<string>((props, value) => props.validationErrorMessage = value, newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get inputBoxCSSStyles(): azdata.CssStyles {
|
||||||
|
return this.mergeCss(super.CSSStyles, {
|
||||||
|
'width': this.getWidth(),
|
||||||
|
'display': this.getInputBoxDisplay()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public get textAreaCSSStyles(): azdata.CssStyles {
|
||||||
|
return this.mergeCss(super.CSSStyles, {
|
||||||
|
'width': this.getWidth(),
|
||||||
|
'display': this.getTextAreaDisplay()
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<div role="listbox" class="modelview-listview-container" [ngStyle]="styles" [style.width]="width" [style.height]="height">
|
<div role="listbox" class="modelview-listview-container" [ngStyle]="CSSStyles">
|
||||||
<div *ngIf="title" class="modelview-listview-title">{{title.text}}</div>
|
<div *ngIf="title" class="modelview-listview-title">{{title.text}}</div>
|
||||||
<div #vscodelist> </div>
|
<div #vscodelist> </div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -92,10 +92,6 @@ export default class ListViewComponent extends ComponentBase<azdata.ListViewComp
|
|||||||
return this.getProperties().height ?? undefined;
|
return this.getProperties().height ?? undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get styles(): azdata.CssStyles | undefined {
|
|
||||||
return this.getProperties().CSSStyles ?? undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get title(): azdata.ListViewTitle {
|
public get title(): azdata.ListViewTitle {
|
||||||
return this.getProperties().title ?? undefined;
|
return this.getProperties().title ?? undefined;
|
||||||
}
|
}
|
||||||
@@ -143,6 +139,13 @@ export default class ListViewComponent extends ComponentBase<azdata.ListViewComp
|
|||||||
this._optionsList.setFocus([focusElement]);
|
this._optionsList.setFocus([focusElement]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get CSSStyles(): azdata.CssStyles {
|
||||||
|
return this.mergeCss(super.CSSStyles, {
|
||||||
|
'width': this.getWidth(),
|
||||||
|
'height': this.getHeight()
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class OptionListDelegate implements IListVirtualDelegate<azdata.ListViewOption> {
|
class OptionListDelegate implements IListVirtualDelegate<azdata.ListViewOption> {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import { ILogService } from 'vs/platform/log/common/log';
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'modelview-listBox',
|
selector: 'modelview-listBox',
|
||||||
template: `
|
template: `
|
||||||
<div #input style="width: 100%"></div>
|
<div #input [ngStyle]="CSSStyles"></div>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
export default class ListBoxComponent extends ComponentBase<azdata.ListBoxProperties> implements IComponent, OnDestroy, AfterViewInit {
|
export default class ListBoxComponent extends ComponentBase<azdata.ListBoxProperties> implements IComponent, OnDestroy, AfterViewInit {
|
||||||
@@ -112,4 +112,11 @@ export default class ListBoxComponent extends ComponentBase<azdata.ListBoxProper
|
|||||||
private set selectedRow(newValue: number) {
|
private set selectedRow(newValue: number) {
|
||||||
this.setPropertyFromUI<number>((props, value) => props.selectedRow = value, newValue);
|
this.setPropertyFromUI<number>((props, value) => props.selectedRow = value, newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public get CSSStyles(): azdata.CssStyles {
|
||||||
|
return this.mergeCss(super.CSSStyles, {
|
||||||
|
'width': '100%'
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import { ILogService } from 'vs/platform/log/common/log';
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'modelview-radioButton',
|
selector: 'modelview-radioButton',
|
||||||
template: `
|
template: `
|
||||||
<div #input class="modelview-radiobutton-container">
|
<div #input [ngStyle]="CSSStyles" class="modelview-radiobutton-container">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<div role="radiogroup" *ngIf="cards" [class]="orientation + ' card-group'" class="card-group" style="flex-wrap:wrap"
|
<div role="radiogroup" *ngIf="cards" [ngStyle]="CSSStyles" [class]="orientation + ' card-group'" class="card-group" [attr.aria-label]="ariaLabel" (keydown)="onKeyDown($event)">
|
||||||
[style.height]="height" [style.width]="width" [attr.aria-label]="ariaLabel" (keydown)="onKeyDown($event)">
|
|
||||||
<div #cardDiv role="radio" *ngFor="let card of cards" class="model-card" (click)="selectCard(card.id)"
|
<div #cardDiv role="radio" *ngFor="let card of cards" class="model-card" (click)="selectCard(card.id)"
|
||||||
[attr.aria-checked]="isCardSelected(card.id)" [tabIndex]="getTabIndex(card.id)" [style.width]="cardWidth"
|
[attr.aria-checked]="isCardSelected(card.id)" [tabIndex]="getTabIndex(card.id)" [style.width]="cardWidth"
|
||||||
[style.height]="cardHeight" (focus)="onCardFocus(card.id)" (blur)="onCardBlur(card.id)" style="flex:0 0 auto;">
|
[style.height]="cardHeight" (focus)="onCardFocus(card.id)" (blur)="onCardBlur(card.id)" style="flex:0 0 auto;">
|
||||||
|
|||||||
@@ -225,4 +225,11 @@ export default class RadioCardGroup extends ComponentBase<azdata.RadioCardGroupC
|
|||||||
public onCardBlur(cardId: string): void {
|
public onCardBlur(cardId: string): void {
|
||||||
this.focusedCardId = undefined;
|
this.focusedCardId = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get CSSStyles(): azdata.CssStyles {
|
||||||
|
return this.mergeCss(super.CSSStyles, {
|
||||||
|
'width': this.getWidth(),
|
||||||
|
'height': this.getHeight()
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import { ILogService } from 'vs/platform/log/common/log';
|
|||||||
@Component({
|
@Component({
|
||||||
selector: `modelview-separator`,
|
selector: `modelview-separator`,
|
||||||
template: `
|
template: `
|
||||||
<div #separator> </div>
|
<div [ngStyle]="CSSStyles" #separator> </div>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
export default class SeparatorComponent extends ComponentBase<azdata.SeparatorComponentProperties> implements IComponent, OnDestroy, AfterViewInit {
|
export default class SeparatorComponent extends ComponentBase<azdata.SeparatorComponentProperties> implements IComponent, OnDestroy, AfterViewInit {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
import 'vs/css!./media/flexContainer';
|
import 'vs/css!./media/flexContainer';
|
||||||
import { Component, Input, Inject, ChangeDetectorRef, forwardRef, ElementRef, OnDestroy } from '@angular/core';
|
import { Component, Input, Inject, ChangeDetectorRef, forwardRef, ElementRef, OnDestroy } from '@angular/core';
|
||||||
|
|
||||||
import { FlexItemLayout, SplitViewLayout, SplitViewContainer } from 'azdata';
|
import { FlexItemLayout, SplitViewLayout, SplitViewContainer, CssStyles } from 'azdata';
|
||||||
import { FlexItem } from './flexContainer.component';
|
import { FlexItem } from './flexContainer.component';
|
||||||
import { ContainerBase, ComponentBase } from 'sql/workbench/browser/modelComponents/componentBase';
|
import { ContainerBase, ComponentBase } from 'sql/workbench/browser/modelComponents/componentBase';
|
||||||
import { Event } from 'vs/base/common/event';
|
import { Event } from 'vs/base/common/event';
|
||||||
@@ -37,8 +37,7 @@ class SplitPane implements IView {
|
|||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
template: `
|
template: `
|
||||||
<div *ngIf="items" class="splitViewContainer" [style.flexFlow]="flexFlow" [style.justifyContent]="justifyContent" [style.position]="position"
|
<div *ngIf="items" class="splitViewContainer" [ngStyle]="CSSStyles">
|
||||||
[style.alignItems]="alignItems" [style.alignContent]="alignContent" [style.height]="height" [style.width]="width">
|
|
||||||
<div *ngFor="let item of items" [style.flex]="getItemFlex(item)" [style.textAlign]="textAlign" [style.order]="getItemOrder(item)" [ngStyle]="getItemStyles(item)">
|
<div *ngFor="let item of items" [style.flex]="getItemFlex(item)" [style.textAlign]="textAlign" [style.order]="getItemOrder(item)" [ngStyle]="getItemStyles(item)">
|
||||||
<model-component-wrapper [descriptor]="item.descriptor" [modelStore]="modelStore">
|
<model-component-wrapper [descriptor]="item.descriptor" [modelStore]="modelStore">
|
||||||
</model-component-wrapper>
|
</model-component-wrapper>
|
||||||
@@ -164,10 +163,24 @@ export default class SplitViewContainerImpl extends ContainerBase<FlexItemLayout
|
|||||||
public getItemFlex(item: FlexItem): string {
|
public getItemFlex(item: FlexItem): string {
|
||||||
return item.config ? item.config.flex : '1 1 auto';
|
return item.config ? item.config.flex : '1 1 auto';
|
||||||
}
|
}
|
||||||
|
|
||||||
public getItemOrder(item: FlexItem): number {
|
public getItemOrder(item: FlexItem): number {
|
||||||
return item.config ? item.config.order : 0;
|
return item.config ? item.config.order : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getItemStyles(item: FlexItem): { [key: string]: string } {
|
public getItemStyles(item: FlexItem): { [key: string]: string } {
|
||||||
return item.config && item.config.CSSStyles ? item.config.CSSStyles : {};
|
return item.config && item.config.CSSStyles ? item.config.CSSStyles : {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get CSSStyles(): CssStyles {
|
||||||
|
return this.mergeCss(super.CSSStyles, {
|
||||||
|
'width': this.getWidth(),
|
||||||
|
'height': this.getHeight(),
|
||||||
|
'flexFlow': this.flexFlow,
|
||||||
|
'justifyContent': this.justifyContent,
|
||||||
|
'position': this.position,
|
||||||
|
'alignItems': this.alignItems,
|
||||||
|
'alignContent': this.alignContent
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
-->
|
-->
|
||||||
<div class="tabbedpanel-component">
|
<div class="tabbedpanel-component" [ngStyle]="CSSStyles">
|
||||||
<panel (onTabChange)="handleTabChange($event)">
|
<panel (onTabChange)="handleTabChange($event)">
|
||||||
<tab [visibilityType]="'visibility'" *ngFor="let tab of tabs" [title]="tab.title" class="fullsize"
|
<tab [visibilityType]="'visibility'" *ngFor="let tab of tabs" [title]="tab.title" class="fullsize"
|
||||||
[identifier]="tab.id" [type]="tab.type" [iconClass]="tab.iconClass">
|
[identifier]="tab.id" [type]="tab.type" [iconClass]="tab.iconClass">
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ type TableCellDataType = string | CssIconCellValue | ButtonCellValue | Hyperlink
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'modelview-table',
|
selector: 'modelview-table',
|
||||||
template: `
|
template: `
|
||||||
<div #table style="height:100%;" [style.font-size]="fontSize" [style.width]="width"></div>
|
<div #table [ngStyle]="CSSStyles"></div>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
export default class TableComponent extends ComponentBase<azdata.TableComponentProperties> implements IComponent, OnDestroy, AfterViewInit {
|
export default class TableComponent extends ComponentBase<azdata.TableComponentProperties> implements IComponent, OnDestroy, AfterViewInit {
|
||||||
@@ -621,4 +621,12 @@ export default class TableComponent extends ComponentBase<azdata.TableComponentP
|
|||||||
this._table.grid.getActiveCellNode().focus();
|
this._table.grid.getActiveCellNode().focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get CSSStyles(): azdata.CssStyles {
|
||||||
|
return this.mergeCss(super.CSSStyles, {
|
||||||
|
'width': this.getWidth(),
|
||||||
|
'height': '100%',
|
||||||
|
'font-size': this.fontSize
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export class ToolbarItem {
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'modelview-toolbarContainer',
|
selector: 'modelview-toolbarContainer',
|
||||||
template: `
|
template: `
|
||||||
<div #container *ngIf="items" [class]="toolbarClass" >
|
<div #container *ngIf="items" [class]="toolbarClass" [ngStyle]="CSSStyles">
|
||||||
<ng-container *ngFor="let item of items">
|
<ng-container *ngFor="let item of items">
|
||||||
<div class="modelview-toolbar-item" [style.paddingTop]="paddingTop">
|
<div class="modelview-toolbar-item" [style.paddingTop]="paddingTop">
|
||||||
<div *ngIf="shouldShowTitle(item)" class="modelview-toolbar-title" >
|
<div *ngIf="shouldShowTitle(item)" class="modelview-toolbar-title" >
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class Root implements ITreeComponentItem {
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'modelview-tree',
|
selector: 'modelview-tree',
|
||||||
template: `
|
template: `
|
||||||
<div #input style="width: 100%;height:100%"></div>
|
<div #input [ngStyle]="CSSStyles"></div>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
export default class TreeComponent extends ComponentBase<azdata.TreeProperties> implements IComponent, OnDestroy, AfterViewInit {
|
export default class TreeComponent extends ComponentBase<azdata.TreeProperties> implements IComponent, OnDestroy, AfterViewInit {
|
||||||
@@ -169,4 +169,11 @@ export default class TreeComponent extends ComponentBase<azdata.TreeProperties>
|
|||||||
public set withCheckbox(newValue: boolean) {
|
public set withCheckbox(newValue: boolean) {
|
||||||
this.setPropertyFromUI<boolean>((properties, value) => { properties.withCheckbox = value; }, newValue);
|
this.setPropertyFromUI<boolean>((properties, value) => { properties.withCheckbox = value; }, newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get CSSStyles(): azdata.CssStyles {
|
||||||
|
return this.mergeCss(super.CSSStyles, {
|
||||||
|
'width': '100%',
|
||||||
|
'height': '100%'
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user