1 | import { Color } from '../../color';
|
2 | import { View, CSSType } from '../core/view';
|
3 | import { booleanConverter } from '../core/view-base';
|
4 | import { Property } from '../core/properties';
|
5 | let SwitchBase = class SwitchBase extends View {
|
6 | _onCheckedPropertyChanged(newValue) {
|
7 | if (newValue) {
|
8 | this.addPseudoClass('checked');
|
9 | }
|
10 | else {
|
11 | this.deletePseudoClass('checked');
|
12 | }
|
13 | }
|
14 | };
|
15 | SwitchBase.checkedChangeEvent = 'checkedChange';
|
16 | SwitchBase = __decorate([
|
17 | CSSType('Switch')
|
18 | ], SwitchBase);
|
19 | export { SwitchBase };
|
20 | SwitchBase.prototype.recycleNativeView = 'auto';
|
21 | function onCheckedPropertyChanged(switchBase, oldValue, newValue) {
|
22 | switchBase._onCheckedPropertyChanged(newValue);
|
23 | }
|
24 | export const checkedProperty = new Property({
|
25 | name: 'checked',
|
26 | defaultValue: false,
|
27 | valueConverter: booleanConverter,
|
28 | valueChanged: onCheckedPropertyChanged,
|
29 | });
|
30 | checkedProperty.register(SwitchBase);
|
31 | export const offBackgroundColorProperty = new Property({
|
32 | name: 'offBackgroundColor',
|
33 | equalityComparer: Color.equals,
|
34 | valueConverter: (v) => new Color(v),
|
35 | });
|
36 | offBackgroundColorProperty.register(SwitchBase);
|
37 |
|
\ | No newline at end of file |