Add more options to chart viewer (#1307)

* fixing up chart viewer

* formatting

* everything is working

* removed unnecessary code

* removed unneeded code
This commit is contained in:
Anthony Dresser
2018-05-02 10:15:51 -07:00
committed by GitHub
parent 6f10f7a21a
commit e82b7615b3
11 changed files with 522 additions and 134 deletions

View File

@@ -0,0 +1,58 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
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() 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;
}
}
}
}