mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-20 09:35:38 -05:00
Inital platform relayering (#6385)
* moving test files and inital refactoring * relayer extension host code * fix imports * make insights work * relayer dashboard * relayer notebooks * moveing more code around * formatting * accept angular as browser * fix serializer * add missing files * remove declarations from extensions * fix build errors * more relayering * change urls to relative to help code relayering * remove layering to prep for merge * fix hygiene errors * fix hygiene errors * fix tests
This commit is contained in:
56
src/sql/base/browser/ui/checkbox/checkbox.component.ts
Normal file
56
src/sql/base/browser/ui/checkbox/checkbox.component.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import {
|
||||
Component, Inject, forwardRef, ElementRef, OnInit, Input,
|
||||
Output, OnChanges, SimpleChanges, EventEmitter
|
||||
} from '@angular/core';
|
||||
|
||||
import { Checkbox as vsCheckbox } from 'sql/base/browser/ui/checkbox/checkbox';
|
||||
|
||||
@Component({
|
||||
selector: 'checkbox',
|
||||
template: ''
|
||||
})
|
||||
export class Checkbox implements OnInit, OnChanges {
|
||||
@Input() label: string;
|
||||
@Input() enabled = true;
|
||||
@Input() checked = true;
|
||||
@Input('aria-label') private ariaLabel: string;
|
||||
|
||||
@Output() onChange = new EventEmitter<boolean>();
|
||||
|
||||
private _checkbox: vsCheckbox;
|
||||
|
||||
constructor(
|
||||
@Inject(forwardRef(() => ElementRef)) private _el: ElementRef
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this._checkbox = new vsCheckbox(this._el.nativeElement, {
|
||||
label: this.label,
|
||||
ariaLabel: this.ariaLabel || this.label,
|
||||
checked: this.checked,
|
||||
enabled: this.enabled
|
||||
});
|
||||
this._checkbox.onChange(e => { this.onChange.emit(e); });
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
if (this._checkbox) {
|
||||
if (changes['label']) {
|
||||
this._checkbox.label = changes['label'].currentValue;
|
||||
}
|
||||
|
||||
if (changes['enabled']) {
|
||||
this._checkbox.enabled = changes['enabled'].currentValue;
|
||||
}
|
||||
|
||||
if (changes['checked']) {
|
||||
this._checkbox.checked = changes['checked'].currentValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user