@nativescript-community/ui-checkbox 2.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,63 @@
1
+ import * as i0 from '@angular/core';
2
+ import { forwardRef, ElementRef, Directive, Inject, HostListener, NgModule } from '@angular/core';
3
+ import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
4
+ import { registerElement, BaseValueAccessor } from '@nativescript/angular';
5
+ import '@nativescript/core';
6
+ import { CheckBox } from '@nativescript-community/ui-checkbox';
7
+
8
+ registerElement('CheckBox', () => CheckBox);
9
+ const CHECKED_VALUE_ACCESSOR = {
10
+ provide: NG_VALUE_ACCESSOR,
11
+ useExisting: forwardRef(() => CheckedValueAccessor),
12
+ multi: true
13
+ };
14
+ class CheckedValueAccessor extends BaseValueAccessor {
15
+ constructor(elementRef) {
16
+ super(elementRef.nativeElement);
17
+ this.onTouched = () => { };
18
+ }
19
+ checkedChangeListener(event) {
20
+ this.onChange(event.value);
21
+ }
22
+ writeValue(value) {
23
+ this.view.checked = value;
24
+ }
25
+ registerOnTouched(fn) {
26
+ this.onTouched = fn;
27
+ }
28
+ }
29
+ CheckedValueAccessor.ɵfac = function CheckedValueAccessor_Factory(t) { return new (t || CheckedValueAccessor)(i0.ɵɵdirectiveInject(ElementRef)); };
30
+ CheckedValueAccessor.ɵdir = i0.ɵɵdefineDirective({ type: CheckedValueAccessor, selectors: [["CheckBox", "ngModel", ""], ["CheckBox", "formControlName", ""], ["CheckBox", "formControl", ""], ["checkBox", "ngModel", ""], ["checkBox", "formControlName", ""], ["checkBox", "formControl", ""], ["check-box", "ngModel", ""], ["check-box", "formControlName", ""], ["check-box", "formControl", ""]], hostBindings: function CheckedValueAccessor_HostBindings(rf, ctx) { if (rf & 1) {
31
+ i0.ɵɵlistener("checkedChange", function CheckedValueAccessor_checkedChange_HostBindingHandler($event) { return ctx.checkedChangeListener($event); });
32
+ } }, features: [i0.ɵɵProvidersFeature([CHECKED_VALUE_ACCESSOR]), i0.ɵɵInheritDefinitionFeature] });
33
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CheckedValueAccessor, [{
34
+ type: Directive,
35
+ args: [{
36
+ selector: 'CheckBox[ngModel], CheckBox[formControlName], CheckBox[formControl], checkBox[ngModel], checkBox[formControlName], checkBox[formControl], check-box[ngModel], check-box[formControlName], check-box[formControl]',
37
+ providers: [CHECKED_VALUE_ACCESSOR]
38
+ }]
39
+ }], function () { return [{ type: i0.ElementRef, decorators: [{
40
+ type: Inject,
41
+ args: [ElementRef]
42
+ }] }]; }, { checkedChangeListener: [{
43
+ type: HostListener,
44
+ args: ['checkedChange', ['$event']]
45
+ }] }); })();
46
+ class CheckBoxModule {
47
+ }
48
+ CheckBoxModule.ɵfac = function CheckBoxModule_Factory(t) { return new (t || CheckBoxModule)(); };
49
+ CheckBoxModule.ɵmod = i0.ɵɵdefineNgModule({ type: CheckBoxModule });
50
+ CheckBoxModule.ɵinj = i0.ɵɵdefineInjector({ providers: [], imports: [[FormsModule], FormsModule] });
51
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CheckBoxModule, [{
52
+ type: NgModule,
53
+ args: [{
54
+ declarations: [CheckedValueAccessor],
55
+ providers: [],
56
+ imports: [FormsModule],
57
+ exports: [FormsModule, CheckedValueAccessor]
58
+ }]
59
+ }], null, null); })();
60
+ (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(CheckBoxModule, { declarations: [CheckedValueAccessor], imports: [FormsModule], exports: [FormsModule, CheckedValueAccessor] }); })();
61
+
62
+ export { CheckBoxModule, CheckedValueAccessor };
63
+ //# sourceMappingURL=nativescript-community-ui-checkbox-angular.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nativescript-community-ui-checkbox-angular.mjs","sources":["../../../../src/checkbox/angular/index.ts"],"sourcesContent":["import { Directive, ElementRef, HostListener, Inject, NgModule, forwardRef } from '@angular/core';\nimport { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { BaseValueAccessor, registerElement } from '@nativescript/angular';\nimport { View } from '@nativescript/core';\nimport { CheckBox } from '@nativescript-community/ui-checkbox';\n\nregisterElement('CheckBox', () => CheckBox);\n\nconst CHECKED_VALUE_ACCESSOR = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => CheckedValueAccessor),\n multi: true\n};\n\nexport type CheckableView = { checked: boolean } & View;\n\n/**\n * The accessor for setting checked property and listening to changes that is used by the\n * {@link NgModel} directives.\n *\n * ### Example\n * ```\n * <CheckBox [(ngModel)]=\"model.test\">\n * ```\n */\n@Directive({\n selector:\n 'CheckBox[ngModel], CheckBox[formControlName], CheckBox[formControl], checkBox[ngModel], checkBox[formControlName], checkBox[formControl], check-box[ngModel], check-box[formControlName], check-box[formControl]',\n providers: [CHECKED_VALUE_ACCESSOR]\n})\nexport class CheckedValueAccessor extends BaseValueAccessor<CheckableView> {\n constructor(@Inject(ElementRef) elementRef: ElementRef) {\n super(elementRef.nativeElement);\n }\n\n @HostListener('checkedChange', ['$event'])\n public checkedChangeListener(event: any) {\n this.onChange(event.value);\n }\n\n public onTouched = () => {};\n\n public writeValue(value: any): void {\n this.view.checked = value;\n }\n\n public registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n}\n\n@NgModule({\n declarations: [CheckedValueAccessor],\n providers: [],\n imports: [FormsModule],\n exports: [FormsModule, CheckedValueAccessor]\n})\nexport class CheckBoxModule {}\n"],"names":[],"mappings":";;;;;;;AAMA,eAAe,CAAC,UAAU,EAAE,MAAM,QAAQ,CAAC,CAAC;AAE5C,MAAM,sBAAsB,GAAG;AAC3B,IAAA,OAAO,EAAE,iBAAiB;AAC1B,IAAA,WAAW,EAAE,UAAU,CAAC,MAAM,oBAAoB,CAAC;AACnD,IAAA,KAAK,EAAE,IAAI;CACd,CAAC;AAkBI,MAAO,oBAAqB,SAAQ,iBAAgC,C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 @@
1
+ import { ElementRef } from '@angular/core';
2
+ import { BaseValueAccessor } from '@nativescript/angular';
3
+ import { View } from '@nativescript/core';
4
+ import * as i0 from "@angular/core";
5
+ import * as i1 from "@angular/forms";
6
+ export declare type CheckableView = {
7
+ checked: boolean;
8
+ } & View;
9
+ export declare class CheckedValueAccessor extends BaseValueAccessor<CheckableView> {
10
+ constructor(elementRef: ElementRef);
11
+ checkedChangeListener(event: any): void;
12
+ onTouched: () => void;
13
+ writeValue(value: any): void;
14
+ registerOnTouched(fn: () => void): void;
15
+ static ɵfac: i0.ɵɵFactoryDeclaration<CheckedValueAccessor, never>;
16
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CheckedValueAccessor, "CheckBox[ngModel], CheckBox[formControlName], CheckBox[formControl], checkBox[ngModel], checkBox[formControlName], checkBox[formControl], check-box[ngModel], check-box[formControlName], check-box[formControl]", never, {}, {}, never>;
17
+ }
18
+ export declare class CheckBoxModule {
19
+ static ɵfac: i0.ɵɵFactoryDeclaration<CheckBoxModule, never>;
20
+ static ɵmod: i0.ɵɵNgModuleDeclaration<CheckBoxModule, [typeof CheckedValueAccessor], [typeof i1.FormsModule], [typeof i1.FormsModule, typeof CheckedValueAccessor]>;
21
+ static ɵinj: i0.ɵɵInjectorDeclaration<CheckBoxModule>;
22
+ }
@@ -0,0 +1,2 @@
1
+ /// <amd-module name="@nativescript-community/ui-checkbox-angular" />
2
+ export * from './index';
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@nativescript-community/ui-checkbox-angular",
3
+ "main": "index.js",
4
+ "module": "fesm2015/nativescript-community-ui-checkbox-angular.mjs",
5
+ "es2020": "fesm2020/nativescript-community-ui-checkbox-angular.mjs",
6
+ "esm2020": "esm2020/nativescript-community-ui-checkbox-angular.mjs",
7
+ "fesm2020": "fesm2020/nativescript-community-ui-checkbox-angular.mjs",
8
+ "fesm2015": "fesm2015/nativescript-community-ui-checkbox-angular.mjs",
9
+ "typings": "nativescript-community-ui-checkbox-angular.d.ts",
10
+ "exports": {
11
+ "./package.json": {
12
+ "default": "./package.json"
13
+ },
14
+ ".": {
15
+ "types": "./nativescript-community-ui-checkbox-angular.d.ts",
16
+ "esm2020": "./esm2020/nativescript-community-ui-checkbox-angular.mjs",
17
+ "es2020": "./fesm2020/nativescript-community-ui-checkbox-angular.mjs",
18
+ "es2015": "./fesm2015/nativescript-community-ui-checkbox-angular.mjs",
19
+ "node": "./fesm2015/nativescript-community-ui-checkbox-angular.mjs",
20
+ "default": "./fesm2020/nativescript-community-ui-checkbox-angular.mjs"
21
+ }
22
+ },
23
+ "sideEffects": false,
24
+ "dependencies": {
25
+ "tslib": "^2.3.0"
26
+ },
27
+ "scripts": {
28
+ "prepublishOnly": "node --eval \"console.error('ERROR: Trying to publish a package that has been compiled by Ivy in full compilation mode. This is not allowed.\\nPlease delete and rebuild the package with Ivy partial compilation mode, before attempting to publish.\\n')\" && exit 1"
29
+ }
30
+ }
package/blueprint.md ADDED
@@ -0,0 +1,158 @@
1
+ {{ load:../../tools/readme/edit-warning.md }}
2
+ {{ template:title }}
3
+ {{ template:badges }}
4
+ {{ template:description }}
5
+
6
+ | <img src="https://github.com/nativescript-community/ui-checkbox/raw/master/images/demo-ios.gif" height="500" /> | <img src="https://github.com/nativescript-community/ui-checkbox/raw/master/images/demo-android.gif" height="500" /> |
7
+ | --- | ----------- |
8
+ | iOS Demo | Android Demo |
9
+
10
+ {{ template:toc }}
11
+
12
+ ## Installation
13
+ Run the following command from the root of your project:
14
+
15
+ `ns plugin add {{ pkg.name }}`
16
+
17
+ #### Platform controls used:
18
+
19
+ | Android | iOS |
20
+ | ---------------------------------------------------------------------------------------- | ---------------------------------------------------- |
21
+ | [Android CheckBox](https://developer.android.com/reference/android/widget/CheckBox.html) | [BEMCheckBox](http://cocoapods.org/pods/BEMCheckBox) |
22
+
23
+ ## API
24
+
25
+ ## Properties
26
+
27
+ - **checked** - boolean
28
+ - **text** - text to use with the checkbox
29
+ - **fillColor** - Color of the checkbox element
30
+ - **boxType** - Either 'square' (default) or 'circle'. It's recommended to use 'circle' for radiobuttons. Note that plugin version 3.0.0 switched the default for iOS to 'square' for alignment with Android. Still want `circle` on iOS and `square` on Android? Just make the `boxType` value conditional.
31
+
32
+ ## Events
33
+
34
+ - **checkedChange** - Use a reference to the CheckBox component to grab it's `checked` property when this event fires to see the new value.
35
+
36
+ ## API
37
+
38
+ - **toggle()** - Change the checked state of the view to the inverse of its current state.
39
+
40
+ ## Css Styling
41
+
42
+ - **color** - set the text label color
43
+ - **font-size** - checkbox is sized to text from here : default 15
44
+ - **border-width** - set the line width of the checkbox element: iOS only
45
+
46
+ ## Styling [Android]
47
+
48
+ - **checkStyle** - set to the name of your drawable
49
+ - **checkPadding** - set the padding of the checkbox
50
+
51
+ ###
52
+
53
+ ```XML
54
+ <Page
55
+ xmlns="http://schemas.nativescript.org/tns.xsd"
56
+ xmlns:CheckBox="@nativecript-community/ui-checkbox" loaded="pageLoaded">
57
+ <ActionBar title="Native Checkbox" />
58
+ <StackLayout>
59
+ <CheckBox:CheckBox checked="{{ checkProp }}" text="{{ myCheckText }}" fillColor="{{ myCheckColor }}" id="myCheckbox" />
60
+ <CheckBox:CheckBox text="CheckBox Label" checked="false" />
61
+ </StackLayout>
62
+ </Page>
63
+ ```
64
+
65
+ ###
66
+
67
+ ```typescript
68
+
69
+ import { CheckBox } from '@nativecript-community/ui-checkbox';
70
+ import { topmost } from '@nativescript/core/ui/frame';
71
+
72
+ public toggleCheck() {
73
+ const checkBox = topmost().getViewById('yourCheckBoxId');
74
+ checkBox.toggle();
75
+ }
76
+
77
+ public getCheckProp() {
78
+ const checkBox = topmost().getViewById('yourCheckBoxId');
79
+ console.log('checked prop value = ' + checkBox.checked);
80
+ }
81
+
82
+ ```
83
+
84
+ ### Angular Usage Sample:
85
+
86
+ ```typescript
87
+ import { TNSCheckBoxModule } from '@nativecript-community/ui-checkbox/angular';
88
+
89
+ @NgModule({
90
+ imports: [TNSCheckBoxModule]
91
+ // etc.
92
+ })
93
+ export class YourModule {}
94
+
95
+ // component:
96
+ export class SomeComponent {
97
+ @ViewChild('CB1') FirstCheckBox: ElementRef;
98
+ constructor() {}
99
+ public toggleCheck() {
100
+ this.FirstCheckBox.nativeElement.toggle();
101
+ }
102
+
103
+ public getCheckProp() {
104
+ console.log(
105
+ 'checked prop value = ' + this.FirstCheckBox.nativeElement.checked
106
+ );
107
+ }
108
+ }
109
+ ```
110
+
111
+ ```html
112
+ <StackLayout>
113
+ <CheckBox #CB1 text="CheckBox Label" checked="false"></CheckBox>
114
+ <button (tap)="toggleCheck()" text="Toggle it!"></button>
115
+ <button (tap)="getCheckProp()" text="Check Property"></button>
116
+ </StackLayout>
117
+ ```
118
+
119
+ ### NativeScript-Vue Usage Sample
120
+
121
+ In your `main.js` (The file where the root Vue instance is created) register the element
122
+
123
+ ```js
124
+ Vue.registerElement(
125
+ 'CheckBox',
126
+ () => require('@nativecript-community/ui-checkbox').CheckBox,
127
+ {
128
+ model: {
129
+ prop: 'checked',
130
+ event: 'checkedChange'
131
+ }
132
+ }
133
+ );
134
+ ```
135
+
136
+ And in your template, use it as:
137
+
138
+ ```html
139
+ <check-box :checked="isChecked" @checkedChange="isChecked = $event.value" />
140
+ ```
141
+
142
+ Use `checked` instead of `v-model`. [See #99](https://github.com/nstudio/nativescript-checkbox/issues/99).
143
+
144
+
145
+ ## Demos
146
+ This repository includes Angular, Vue.js, and Svelte demos. In order to run these execute the following in your shell:
147
+ ```shell
148
+ $ git clone https://github.com/@nativescript-community/ui-checkbox
149
+ $ cd ui-checkbox
150
+ $ npm i
151
+ $ npm run setup
152
+ $ npm run build # && npm run build.angular
153
+ $ cd demo-ng # or demo-vue or demo-svelte
154
+ $ ns run ios|android
155
+ ```
156
+
157
+ {{ load:../../tools/readme/demos-and-development.md }}
158
+ {{ load:../../tools/readme/questions.md }}
package/common.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export declare enum BoxType {
2
+ circle = "circle",
3
+ square = "square"
4
+ }
package/common.js ADDED
@@ -0,0 +1,6 @@
1
+ export var BoxType;
2
+ (function (BoxType) {
3
+ BoxType["circle"] = "circle";
4
+ BoxType["square"] = "square";
5
+ })(BoxType || (BoxType = {}));
6
+ //# sourceMappingURL=common.js.map
package/common.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"../src/","sources":["common.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,OAGX;AAHD,WAAY,OAAO;IACf,4BAAiB,CAAA;IACjB,4BAAiB,CAAA;AACrB,CAAC,EAHW,OAAO,KAAP,OAAO,QAGlB"}
@@ -0,0 +1,41 @@
1
+ import { Color, CssProperty, Property, Style, View } from '@nativescript/core';
2
+ export declare const checkedProperty: any;
3
+ export declare const textProperty: Property<CheckBox, string>;
4
+ export declare const fillColorProperty: CssProperty<Style, string>;
5
+ export declare const tintColorProperty: CssProperty<Style, string>;
6
+ export declare class CheckBox extends View {
7
+ checked: boolean;
8
+ fillColor: Color | string;
9
+ tintColor: Color | string;
10
+ nativeViewProtected: androidx.appcompat.widget.AppCompatCheckBox;
11
+ private _boxType;
12
+ private _checkStyle;
13
+ private _checkPadding;
14
+ private _checkPaddingLeft;
15
+ private _checkPaddingTop;
16
+ private _checkPaddingRight;
17
+ private _checkPaddingBottom;
18
+ constructor();
19
+ set boxType(value: string);
20
+ get boxType(): string;
21
+ get checkStyle(): string;
22
+ set checkStyle(style: string);
23
+ set checkPadding(padding: string);
24
+ get checkPadding(): string;
25
+ set checkPaddingLeft(padding: string);
26
+ get checkPaddingLeft(): string;
27
+ set checkPaddingTop(padding: string);
28
+ get checkPaddingTop(): string;
29
+ set checkPaddingRight(padding: string);
30
+ get checkPaddingRight(): string;
31
+ set checkPaddingBottom(padding: string);
32
+ get checkPaddingBottom(): string;
33
+ get fontSize(): number;
34
+ set fontSize(size: number);
35
+ createNativeView(): androidx.appcompat.widget.AppCompatCheckBox | androidx.appcompat.widget.AppCompatRadioButton;
36
+ initNativeView(): void;
37
+ disposeNativeView(): void;
38
+ toggle(): void;
39
+ _onCheckedPropertyChanged(checkbox: CheckBox, oldValue: any, newValue: any): void;
40
+ _onTextPropertyChanged(checkbox: CheckBox, oldValue: any, newValue: any): void;
41
+ }
@@ -0,0 +1,200 @@
1
+ import { Color, CssProperty, Property, Style, View, booleanConverter, fontSizeProperty } from '@nativescript/core';
2
+ import { BoxType } from './common';
3
+ export const checkedProperty = new Property({
4
+ name: 'checked',
5
+ defaultValue: false,
6
+ valueConverter: booleanConverter,
7
+ valueChanged: onCheckedPropertyChanged
8
+ });
9
+ export const textProperty = new Property({
10
+ name: 'text',
11
+ defaultValue: '',
12
+ valueChanged: onTextPropertyChanged
13
+ });
14
+ export const fillColorProperty = new CssProperty({
15
+ name: 'fillColor',
16
+ cssName: 'fill-color',
17
+ valueConverter: (v) => String(v)
18
+ });
19
+ export const tintColorProperty = new CssProperty({
20
+ name: 'tintColor',
21
+ cssName: 'tint-color',
22
+ valueConverter: (v) => String(v)
23
+ });
24
+ export class CheckBox extends View {
25
+ constructor() {
26
+ super();
27
+ }
28
+ set boxType(value) {
29
+ this._boxType = value;
30
+ }
31
+ get boxType() {
32
+ return this._boxType;
33
+ }
34
+ get checkStyle() {
35
+ return this._checkStyle;
36
+ }
37
+ set checkStyle(style) {
38
+ this._checkStyle = style;
39
+ }
40
+ set checkPadding(padding) {
41
+ this._checkPadding = padding;
42
+ }
43
+ get checkPadding() {
44
+ return this._checkPadding;
45
+ }
46
+ set checkPaddingLeft(padding) {
47
+ this._checkPaddingLeft = padding;
48
+ }
49
+ get checkPaddingLeft() {
50
+ return this._checkPaddingLeft;
51
+ }
52
+ set checkPaddingTop(padding) {
53
+ this._checkPaddingTop = padding;
54
+ }
55
+ get checkPaddingTop() {
56
+ return this._checkPaddingTop;
57
+ }
58
+ set checkPaddingRight(padding) {
59
+ this._checkPaddingRight = padding;
60
+ }
61
+ get checkPaddingRight() {
62
+ return this._checkPaddingRight;
63
+ }
64
+ set checkPaddingBottom(padding) {
65
+ this._checkPaddingBottom = padding;
66
+ }
67
+ get checkPaddingBottom() {
68
+ return this._checkPaddingBottom;
69
+ }
70
+ [checkedProperty.getDefault]() {
71
+ return false;
72
+ }
73
+ [checkedProperty.setNative](value) {
74
+ this.nativeViewProtected.setChecked(Boolean(value));
75
+ }
76
+ [textProperty.getDefault]() {
77
+ return '';
78
+ }
79
+ [textProperty.setNative](value) {
80
+ this.nativeViewProtected.setText(java.lang.String.valueOf(value));
81
+ }
82
+ [fontSizeProperty.getDefault]() {
83
+ return { nativeSize: this.nativeViewProtected.getTextSize() };
84
+ }
85
+ [fontSizeProperty.setNative](value) {
86
+ if (typeof value === 'number') {
87
+ this.nativeViewProtected.setTextSize(value);
88
+ }
89
+ else {
90
+ this.nativeViewProtected.setTextSize(android.util.TypedValue.COMPLEX_UNIT_PX, value.nativeSize);
91
+ }
92
+ }
93
+ get fontSize() {
94
+ return this.style.fontSize;
95
+ }
96
+ set fontSize(size) {
97
+ this.style.fontSize = size;
98
+ }
99
+ [fillColorProperty.setNative](value) {
100
+ const color = !value || value instanceof Color ? value : new Color(value);
101
+ this.nativeViewProtected.setButtonTintList(color ? android.content.res.ColorStateList.valueOf(color.android) : null);
102
+ }
103
+ [tintColorProperty.setNative](value) {
104
+ this[fillColorProperty.setNative](value);
105
+ }
106
+ createNativeView() {
107
+ var _a;
108
+ let view;
109
+ if (BoxType[this.boxType] === BoxType.circle) {
110
+ view = new androidx.appcompat.widget.AppCompatRadioButton(this._context, null);
111
+ }
112
+ else {
113
+ view = new androidx.appcompat.widget.AppCompatCheckBox(this._context, null);
114
+ }
115
+ if (this.checkPaddingLeft) {
116
+ view.setPadding(parseInt(this.checkPaddingLeft, 10), view.getPaddingTop(), view.getPaddingRight(), view.getPaddingBottom());
117
+ }
118
+ if (this.checkPaddingTop) {
119
+ view.setPadding(view.getPaddingLeft(), parseInt(this.checkPaddingTop, 10), view.getPaddingRight(), view.getPaddingBottom());
120
+ }
121
+ if (this.checkPaddingRight) {
122
+ view.setPadding(view.getPaddingLeft(), view.getPaddingTop(), parseInt(this.checkPaddingRight, 10), view.getPaddingBottom());
123
+ }
124
+ if (this.checkPaddingBottom) {
125
+ view.setPadding(view.getPaddingLeft(), view.getPaddingTop(), view.getPaddingRight(), parseInt(this.checkPaddingBottom, 10));
126
+ }
127
+ if (this.checkPadding) {
128
+ const pads = this.checkPadding.toString().split(',');
129
+ switch (pads.length) {
130
+ case 1:
131
+ view.setPadding(parseInt(pads[0], 10), parseInt(pads[0], 10), parseInt(pads[0], 10), parseInt(pads[0], 10));
132
+ break;
133
+ case 2:
134
+ view.setPadding(parseInt(pads[0], 10), parseInt(pads[1], 10), parseInt(pads[0], 10), parseInt(pads[1], 10));
135
+ break;
136
+ case 3:
137
+ view.setPadding(parseInt(pads[0], 10), parseInt(pads[1], 10), parseInt(pads[2], 10), parseInt(pads[1], 10));
138
+ break;
139
+ case 4:
140
+ view.setPadding(parseInt(pads[0], 10), parseInt(pads[1], 10), parseInt(pads[2], 10), parseInt(pads[3], 10));
141
+ break;
142
+ }
143
+ }
144
+ if (this.style.color) {
145
+ view.setTextColor(this.style.color.android);
146
+ }
147
+ if (!this.style.fontSize) {
148
+ this.style.fontSize = 14;
149
+ }
150
+ view.setTextSize(this.style.fontSize);
151
+ const typeface = (_a = this.style.fontInternal) === null || _a === void 0 ? void 0 : _a.getAndroidTypeface();
152
+ if (typeface) {
153
+ view.setTypeface(typeface);
154
+ }
155
+ if (this._checkStyle) {
156
+ const drawable = this._context.getResources().getIdentifier(this._checkStyle, 'drawable', this._context.getPackageName());
157
+ view.setButtonDrawable(drawable);
158
+ }
159
+ return view;
160
+ }
161
+ initNativeView() {
162
+ const that = new WeakRef(this);
163
+ this.nativeViewProtected.setOnCheckedChangeListener(new android.widget.CompoundButton.OnCheckedChangeListener({
164
+ onCheckedChanged: (sender, isChecked) => {
165
+ if (that.get()) {
166
+ checkedProperty.nativeValueChange(that.get(), isChecked);
167
+ }
168
+ }
169
+ }));
170
+ }
171
+ disposeNativeView() {
172
+ this.nativeViewProtected.setOnCheckedChangeListener(null);
173
+ }
174
+ toggle() {
175
+ this.nativeViewProtected.toggle();
176
+ }
177
+ _onCheckedPropertyChanged(checkbox, oldValue, newValue) {
178
+ if (!this.nativeViewProtected) {
179
+ return;
180
+ }
181
+ checkedProperty.nativeValueChange(this, newValue);
182
+ }
183
+ _onTextPropertyChanged(checkbox, oldValue, newValue) {
184
+ if (!this.nativeViewProtected) {
185
+ return;
186
+ }
187
+ textProperty.nativeValueChange(this, newValue);
188
+ }
189
+ }
190
+ function onCheckedPropertyChanged(checkbox, oldValue, newValue) {
191
+ checkbox._onCheckedPropertyChanged(checkbox, oldValue, newValue);
192
+ }
193
+ function onTextPropertyChanged(checkbox, oldValue, newValue) {
194
+ checkbox._onTextPropertyChanged(checkbox, oldValue, newValue);
195
+ }
196
+ checkedProperty.register(CheckBox);
197
+ textProperty.register(CheckBox);
198
+ fillColorProperty.register(Style);
199
+ tintColorProperty.register(Style);
200
+ //# sourceMappingURL=index.android.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.android.js","sourceRoot":"../src/","sources":["index.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACnH,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,QAAQ,CAAoB;IAC3D,IAAI,EAAE,SAAS;IACf,YAAY,EAAE,KAAK;IACnB,cAAc,EAAE,gBAAgB;IAChC,YAAY,EAAE,wBAAwB;CACzC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,QAAQ,CAAmB;IACvD,IAAI,EAAE,MAAM;IACZ,YAAY,EAAE,EAAE;IAChB,YAAY,EAAE,qBAAqB;CACtC,CAAC,CAAC;AAEH,MAA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AAE,QAAQ,CAAC,CAAC;IACtD,CAAC;IACD,sBAAsB,CAAC,QAAkB,EAAE,QAAQ,EAAE,QAAQ;QACzD,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE;YAC3B,OAAO;SACV;QACD,YAAY,CAAC,iBAAiB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACnD,CAAC;CACJ;AAED,SAAS,wBAAwB,CAAC,QAAkB,EAAE,QAAQ,EAAE,QAAQ;IACpE,QAAQ,CAAC,yBAAyB,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AACrE,CAAC;AACD,SAAS,qBAAqB,CAAC,QAAkB,EAAE,QAAQ,EAAE,QAAQ;IACjE,QAAQ,CAAC,sBAAsB,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAClE,CAAC;AAED,eAAe,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACnC,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAChC,iBAAiB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAClC,iBAAiB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC"}
package/index.d.ts ADDED
@@ -0,0 +1,32 @@
1
+ import { View } from '@nativescript/core';
2
+
3
+ /**
4
+ * Represents a CheckBox component.
5
+ */
6
+ export class CheckBox extends View {
7
+ /**
8
+ * Gets the native [android widget](https://developer.android.com/reference/android/widget/CheckBox.html) that represents the user interface for this component. Valid only when running on Android OS.
9
+ */
10
+ android: any /* android.widget.CheckBox */;
11
+
12
+ /**
13
+ * Gets the ios Label with the checkbox as a subview
14
+ */
15
+ ios: any /* Label */;
16
+
17
+ /**
18
+ * Gets or sets if a switch is checked or not.
19
+ */
20
+ checked: boolean;
21
+
22
+ /**
23
+ * Change the checked state of the view to the inverse of its current state.
24
+ */
25
+ toggle(): void;
26
+ }
27
+
28
+ export interface CheckBoxInterface {
29
+ text?: string;
30
+ checked: boolean;
31
+ toggle(): void;
32
+ }
package/index.ios.d.ts ADDED
@@ -0,0 +1,42 @@
1
+ import { Button } from '@nativescript/core';
2
+ import { CheckBoxInterface } from '.';
3
+ export declare class CheckBox extends Button implements CheckBoxInterface {
4
+ checked: boolean;
5
+ boxType: number;
6
+ _onCheckColor: string;
7
+ _checkBoxBackgroundColor: any;
8
+ _onTintColor: string;
9
+ _tintColor: string;
10
+ _onFillColor: string;
11
+ _fillColor: string;
12
+ _iosCheckbox: BEMCheckBox;
13
+ private _delegate;
14
+ private _lineWidth;
15
+ private _hideBox;
16
+ private _boxType;
17
+ private _tint;
18
+ private _animationDuration;
19
+ private _onAnimationType;
20
+ private _offAnimationType;
21
+ createNativeView(): UIButton;
22
+ set fillColor(color: string);
23
+ set onFillColor(color: string);
24
+ set tintColor(color: string);
25
+ set onTintColor(color: string);
26
+ set checkBoxBackgroundColor(color: any);
27
+ set onCheckColor(color: string);
28
+ set checkedAnimated(value: boolean);
29
+ set lineWidth(value: number);
30
+ set hideBox(value: boolean);
31
+ set animationDuration(value: number);
32
+ set onAnimationType(value: number);
33
+ set offAnimationType(value: number);
34
+ get nativeiOSCheckBox(): BEMCheckBox;
35
+ reload(value: boolean): void;
36
+ tapTimeout: any;
37
+ initNativeView(): void;
38
+ disposeNativeView(): void;
39
+ toggle(): void;
40
+ private _getAnimationType;
41
+ _onCheckedPropertyChanged(checkbox: CheckBox, oldValue: any, newValue: any): void;
42
+ }