UNPKG

1.22 kBJavaScriptView Raw
1import { Color } from '../../color';
2import { View, CSSType } from '../core/view';
3import { booleanConverter } from '../core/view-base';
4import { Property } from '../core/properties';
5let 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};
15SwitchBase.checkedChangeEvent = 'checkedChange';
16SwitchBase = __decorate([
17 CSSType('Switch')
18], SwitchBase);
19export { SwitchBase };
20SwitchBase.prototype.recycleNativeView = 'auto';
21function onCheckedPropertyChanged(switchBase, oldValue, newValue) {
22 switchBase._onCheckedPropertyChanged(newValue);
23}
24export const checkedProperty = new Property({
25 name: 'checked',
26 defaultValue: false,
27 valueConverter: booleanConverter,
28 valueChanged: onCheckedPropertyChanged,
29});
30checkedProperty.register(SwitchBase);
31export const offBackgroundColorProperty = new Property({
32 name: 'offBackgroundColor',
33 equalityComparer: Color.equals,
34 valueConverter: (v) => new Color(v),
35});
36offBackgroundColorProperty.register(SwitchBase);
37//# sourceMappingURL=switch-common.js.map
\No newline at end of file