[DEV] add a generic checkbox
This commit is contained in:
parent
511c92cbaf
commit
bbe9e0bb4f
7
front/src/common/component/checkbox/checkbox.html
Normal file
7
front/src/common/component/checkbox/checkbox.html
Normal file
@ -0,0 +1,7 @@
|
||||
<div class="elem-checkbox">
|
||||
<input
|
||||
type="checkbox"
|
||||
[checked]="value"
|
||||
(change)="onChange($event.target.checked)" />
|
||||
{{comment}}
|
||||
</div>
|
6
front/src/common/component/checkbox/checkbox.less
Normal file
6
front/src/common/component/checkbox/checkbox.less
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
.elem-checkbox {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
margin: 0 10px 0 10px;
|
||||
}
|
29
front/src/common/component/checkbox/checkbox.ts
Normal file
29
front/src/common/component/checkbox/checkbox.ts
Normal file
@ -0,0 +1,29 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2018, Edouard DUPIN, all right reserved
|
||||
* @license PROPRIETARY (see license file)
|
||||
*/
|
||||
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-checkbox',
|
||||
templateUrl: 'checkbox.html',
|
||||
styleUrls: ['checkbox.less'],
|
||||
})
|
||||
export class CheckboxComponent {
|
||||
/// Checkbox value
|
||||
@Input() value: boolean = false;
|
||||
/// Description of the checkbox
|
||||
@Input() comment: string = "";
|
||||
/// event when change the value of the password
|
||||
@Output() changeValue: EventEmitter<boolean> = new EventEmitter();
|
||||
|
||||
/**
|
||||
* When input value change, need update the display and change the internal value.
|
||||
* @param newValue New value set on the password
|
||||
*/
|
||||
onChange(newValue: boolean): void {
|
||||
this.value = newValue;
|
||||
this.changeValue.emit(this.value);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user