@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,191 @@
1
+
2
+ declare class BEMAnimationManager extends NSObject {
3
+
4
+ static alloc(): BEMAnimationManager; // inherited from NSObject
5
+
6
+ static new(): BEMAnimationManager; // inherited from NSObject
7
+
8
+ animationDuration: number;
9
+
10
+ constructor(o: { animationDuration: number; });
11
+
12
+ fillAnimationWithBouncesAmplitudeReverse(bounces: number, amplitude: number, reverse: boolean): CAKeyframeAnimation;
13
+
14
+ initWithAnimationDuration(animationDuration: number): this;
15
+
16
+ morphAnimationFromPathToPath(fromPath: UIBezierPath, toPath: UIBezierPath): CABasicAnimation;
17
+
18
+ opacityAnimationReverse(reverse: boolean): CABasicAnimation;
19
+
20
+ strokeAnimationReverse(reverse: boolean): CABasicAnimation;
21
+ }
22
+
23
+ declare const enum BEMAnimationType {
24
+
25
+ Stroke = 0,
26
+
27
+ Fill = 1,
28
+
29
+ Bounce = 2,
30
+
31
+ Flat = 3,
32
+
33
+ OneStroke = 4,
34
+
35
+ Fade = 5
36
+ }
37
+
38
+ declare const enum BEMBoxType {
39
+
40
+ Circle = 0,
41
+
42
+ Square = 1
43
+ }
44
+
45
+ declare class BEMCheckBox extends UIControl implements CAAnimationDelegate {
46
+
47
+ static alloc(): BEMCheckBox; // inherited from NSObject
48
+
49
+ static appearance(): BEMCheckBox; // inherited from UIAppearance
50
+
51
+ static appearanceForTraitCollection(trait: UITraitCollection): BEMCheckBox; // inherited from UIAppearance
52
+
53
+ static appearanceForTraitCollectionWhenContainedIn(trait: UITraitCollection, ContainerClass: typeof NSObject): BEMCheckBox; // inherited from UIAppearance
54
+
55
+ static appearanceForTraitCollectionWhenContainedInInstancesOfClasses(trait: UITraitCollection, containerTypes: NSArray<typeof NSObject> | typeof NSObject[]): BEMCheckBox; // inherited from UIAppearance
56
+
57
+ static appearanceWhenContainedIn(ContainerClass: typeof NSObject): BEMCheckBox; // inherited from UIAppearance
58
+
59
+ static appearanceWhenContainedInInstancesOfClasses(containerTypes: NSArray<typeof NSObject> | typeof NSObject[]): BEMCheckBox; // inherited from UIAppearance
60
+
61
+ static new(): BEMCheckBox; // inherited from NSObject
62
+
63
+ animationDuration: number;
64
+
65
+ boxType: BEMBoxType;
66
+
67
+ cornerRadius: number;
68
+
69
+ delegate: BEMCheckBoxDelegate;
70
+
71
+ readonly group: BEMCheckBoxGroup;
72
+
73
+ hideBox: boolean;
74
+
75
+ lineWidth: number;
76
+
77
+ minimumTouchSize: CGSize;
78
+
79
+ offAnimationType: BEMAnimationType;
80
+
81
+ offFillColor: UIColor;
82
+
83
+ on: boolean;
84
+
85
+ onAnimationType: BEMAnimationType;
86
+
87
+ onCheckColor: UIColor;
88
+
89
+ onFillColor: UIColor;
90
+
91
+ onTintColor: UIColor;
92
+
93
+ readonly debugDescription: string; // inherited from NSObjectProtocol
94
+
95
+ readonly description: string; // inherited from NSObjectProtocol
96
+
97
+ readonly hash: number; // inherited from NSObjectProtocol
98
+
99
+ readonly isProxy: boolean; // inherited from NSObjectProtocol
100
+
101
+ readonly superclass: typeof NSObject; // inherited from NSObjectProtocol
102
+
103
+ readonly // inherited from NSObjectProtocol
104
+
105
+ animationDidStart(anim: CAAnimation): void;
106
+
107
+ animationDidStopFinished(anim: CAAnimation, flag: boolean): void;
108
+
109
+ class(): typeof NSObject;
110
+
111
+ conformsToProtocol(aProtocol: any /* Protocol */): boolean;
112
+
113
+ isEqual(object: any): boolean;
114
+
115
+ isKindOfClass(aClass: typeof NSObject): boolean;
116
+
117
+ isMemberOfClass(aClass: typeof NSObject): boolean;
118
+
119
+ performSelector(aSelector: string): any;
120
+
121
+ performSelectorWithObject(aSelector: string, object: any): any;
122
+
123
+ performSelectorWithObjectWithObject(aSelector: string, object1: any, object2: any): any;
124
+
125
+ reload(): void;
126
+
127
+ respondsToSelector(aSelector: string): boolean;
128
+
129
+ retainCount(): number;
130
+
131
+ self(): this;
132
+
133
+ setOnAnimated(on: boolean, animated: boolean): void;
134
+ }
135
+
136
+ interface BEMCheckBoxDelegate extends NSObjectProtocol {
137
+
138
+ animationDidStopForCheckBox?(checkBox: BEMCheckBox): void;
139
+
140
+ didTapCheckBox?(checkBox: BEMCheckBox): void;
141
+ }
142
+ declare var BEMCheckBoxDelegate: {
143
+
144
+ prototype: BEMCheckBoxDelegate;
145
+ };
146
+
147
+ declare class BEMCheckBoxGroup extends NSObject {
148
+
149
+ static alloc(): BEMCheckBoxGroup; // inherited from NSObject
150
+
151
+ static groupWithCheckBoxes(checkBoxes: NSArray<BEMCheckBox> | BEMCheckBox[]): BEMCheckBoxGroup;
152
+
153
+ static new(): BEMCheckBoxGroup; // inherited from NSObject
154
+
155
+ readonly checkBoxes: NSHashTable<any>;
156
+
157
+ mustHaveSelection: boolean;
158
+
159
+ selectedCheckBox: BEMCheckBox;
160
+
161
+ addCheckBoxToGroup(checkBox: BEMCheckBox): void;
162
+
163
+ removeCheckBoxFromGroup(checkBox: BEMCheckBox): void;
164
+ }
165
+
166
+ declare var BEMCheckBoxVersionNumber: number;
167
+
168
+ declare var BEMCheckBoxVersionString: interop.Reference<number>;
169
+
170
+ declare class BEMPathManager extends NSObject {
171
+
172
+ static alloc(): BEMPathManager; // inherited from NSObject
173
+
174
+ static new(): BEMPathManager; // inherited from NSObject
175
+
176
+ boxType: BEMBoxType;
177
+
178
+ cornerRadius: number;
179
+
180
+ lineWidth: number;
181
+
182
+ size: number;
183
+
184
+ pathForBox(): UIBezierPath;
185
+
186
+ pathForCheckMark(): UIBezierPath;
187
+
188
+ pathForFlatCheckMark(): UIBezierPath;
189
+
190
+ pathForLongCheckMark(): UIBezierPath;
191
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ## 2.0.6 (2022-04-26)
7
+
8
+ **Note:** Version bump only for package @nativescript-community/ui-checkbox
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ nativescript-checkbox
4
+ Copyright (c) 2019, nStudio LLC.
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
7
+ this software and associated documentation files (the "Software"), to deal in
8
+ the Software without restriction, including without limitation the rights to
9
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
10
+ the Software, and to permit persons to whom the Software is furnished to do so,
11
+ subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,273 @@
1
+ <!-- ⚠️ This README has been generated from the file(s) "blueprint.md" ⚠️-->
2
+ <!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
3
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
4
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
5
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
6
+ !!!!!!!!!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center">
23
+ <a href="https://npmcharts.com/compare/@nativescript-community/ui-checkbox?minimal=true"><img alt="Downloads per month" src="https://img.shields.io/npm/dm/@nativescript-community/ui-checkbox.svg" height="20"/></a>
24
+ <a href="https://www.npmjs.com/package/@nativescript-community/ui-checkbox"><img alt="NPM Version" src="https://img.shields.io/npm/v/@nativescript-community/ui-checkbox.svg" height="20"/></a>
25
+ </p>
26
+
27
+ <p align="center">
28
+ <b>NativeScript plugin for checkbox.</b></br>
29
+ <sub><sub>
30
+ </p>
31
+
32
+ <br />
33
+
34
+
35
+ | <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" /> |
36
+ | --- | ----------- |
37
+ | iOS Demo | Android Demo |
38
+
39
+
40
+ [](#table-of-contents)
41
+
42
+ ## Table of Contents
43
+
44
+ * [Installation](#installation)
45
+ * [Platform controls used:](#platform-controls-used)
46
+ * [API](#api)
47
+ * [Properties](#properties)
48
+ * [Events](#events)
49
+ * [API](#api-1)
50
+ * [Css Styling](#css-styling)
51
+ * [Styling [Android]](#styling-android)
52
+ * [Angular Usage Sample:](#angular-usage-sample)
53
+ * [NativeScript-Vue Usage Sample](#nativescript-vue-usage-sample)
54
+ * [Demos](#demos)
55
+ * [Demos and Development](#demos-and-development)
56
+ * [Setup](#setup)
57
+ * [Build](#build)
58
+ * [Demos](#demos-1)
59
+ * [Questions](#questions)
60
+
61
+
62
+ [](#installation)
63
+
64
+ ## Installation
65
+ Run the following command from the root of your project:
66
+
67
+ `ns plugin add @nativescript-community/ui-checkbox`
68
+
69
+ #### Platform controls used:
70
+
71
+ | Android | iOS |
72
+ | ---------------------------------------------------------------------------------------- | ---------------------------------------------------- |
73
+ | [Android CheckBox](https://developer.android.com/reference/android/widget/CheckBox.html) | [BEMCheckBox](http://cocoapods.org/pods/BEMCheckBox) |
74
+
75
+
76
+ [](#api)
77
+
78
+ ## API
79
+
80
+
81
+ [](#properties)
82
+
83
+ ## Properties
84
+
85
+ - **checked** - boolean
86
+ - **text** - text to use with the checkbox
87
+ - **fillColor** - Color of the checkbox element
88
+ - **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.
89
+
90
+
91
+ [](#events)
92
+
93
+ ## Events
94
+
95
+ - **checkedChange** - Use a reference to the CheckBox component to grab it's `checked` property when this event fires to see the new value.
96
+
97
+
98
+ [](#api)
99
+
100
+ ## API
101
+
102
+ - **toggle()** - Change the checked state of the view to the inverse of its current state.
103
+
104
+
105
+ [](#css-styling)
106
+
107
+ ## Css Styling
108
+
109
+ - **color** - set the text label color
110
+ - **font-size** - checkbox is sized to text from here : default 15
111
+ - **border-width** - set the line width of the checkbox element: iOS only
112
+
113
+
114
+ [](#styling-android)
115
+
116
+ ## Styling [Android]
117
+
118
+ - **checkStyle** - set to the name of your drawable
119
+ - **checkPadding** - set the padding of the checkbox
120
+
121
+ ###
122
+
123
+ ```XML
124
+ <Page
125
+ xmlns="http://schemas.nativescript.org/tns.xsd"
126
+ xmlns:CheckBox="@nativecript-community/ui-checkbox" loaded="pageLoaded">
127
+ <ActionBar title="Native Checkbox" />
128
+ <StackLayout>
129
+ <CheckBox:CheckBox checked="checkProp" text="myCheckText" fillColor="myCheckColor" id="myCheckbox" />
130
+ <CheckBox:CheckBox text="CheckBox Label" checked="false" />
131
+ </StackLayout>
132
+ </Page>
133
+ ```
134
+
135
+ ###
136
+
137
+ ```typescript
138
+
139
+ import { CheckBox } from '@nativecript-community/ui-checkbox';
140
+ import { topmost } from '@nativescript/core/ui/frame';
141
+
142
+ public toggleCheck() {
143
+ const checkBox = topmost().getViewById('yourCheckBoxId');
144
+ checkBox.toggle();
145
+ }
146
+
147
+ public getCheckProp() {
148
+ const checkBox = topmost().getViewById('yourCheckBoxId');
149
+ console.log('checked prop value = ' + checkBox.checked);
150
+ }
151
+
152
+ ```
153
+
154
+ ### Angular Usage Sample:
155
+
156
+ ```typescript
157
+ import { TNSCheckBoxModule } from '@nativecript-community/ui-checkbox/angular';
158
+
159
+ @NgModule({
160
+ imports: [TNSCheckBoxModule]
161
+ // etc.
162
+ })
163
+ export class YourModule {}
164
+
165
+ // component:
166
+ export class SomeComponent {
167
+ @ViewChild('CB1') FirstCheckBox: ElementRef;
168
+ constructor() {}
169
+ public toggleCheck() {
170
+ this.FirstCheckBox.nativeElement.toggle();
171
+ }
172
+
173
+ public getCheckProp() {
174
+ console.log(
175
+ 'checked prop value = ' + this.FirstCheckBox.nativeElement.checked
176
+ );
177
+ }
178
+ }
179
+ ```
180
+
181
+ ```html
182
+ <StackLayout>
183
+ <CheckBox #CB1 text="CheckBox Label" checked="false"></CheckBox>
184
+ <button (tap)="toggleCheck()" text="Toggle it!"></button>
185
+ <button (tap)="getCheckProp()" text="Check Property"></button>
186
+ </StackLayout>
187
+ ```
188
+
189
+ ### NativeScript-Vue Usage Sample
190
+
191
+ In your `main.js` (The file where the root Vue instance is created) register the element
192
+
193
+ ```js
194
+ Vue.registerElement(
195
+ 'CheckBox',
196
+ () => require('@nativecript-community/ui-checkbox').CheckBox,
197
+ {
198
+ model: {
199
+ prop: 'checked',
200
+ event: 'checkedChange'
201
+ }
202
+ }
203
+ );
204
+ ```
205
+
206
+ And in your template, use it as:
207
+
208
+ ```html
209
+ <check-box :checked="isChecked" @checkedChange="isChecked = $event.value" />
210
+ ```
211
+
212
+ Use `checked` instead of `v-model`. [See #99](https://github.com/nstudio/nativescript-checkbox/issues/99).
213
+
214
+
215
+
216
+ [](#demos)
217
+
218
+ ## Demos
219
+ This repository includes Angular, Vue.js, and Svelte demos. In order to run these execute the following in your shell:
220
+ ```shell
221
+ $ git clone https://github.com/@nativescript-community/ui-checkbox
222
+ $ cd ui-checkbox
223
+ $ npm i
224
+ $ npm run setup
225
+ $ npm run build # && npm run build.angular
226
+ $ cd demo-ng # or demo-vue or demo-svelte
227
+ $ ns run ios|android
228
+ ```
229
+
230
+
231
+ [](#demos-and-development)
232
+
233
+ ## Demos and Development
234
+
235
+
236
+ ### Setup
237
+
238
+ To run the demos, you must clone this repo **recursively**.
239
+
240
+ ```
241
+ git clone https://github.com/@nativescript-community/ui-checkbox.git --recursive
242
+ ```
243
+
244
+ **Install Dependencies:**
245
+ ```bash
246
+ npm i # or 'yarn install' or 'pnpm install'
247
+ ```
248
+
249
+ **Interactive Menu:**
250
+
251
+ To start the interactive menu, run `npm start` (or `yarn start` or `pnpm start`). This will list all of the commonly used scripts.
252
+
253
+ ### Build
254
+
255
+ ```bash
256
+ npm run build
257
+
258
+ npm run build.angular # or for Angular
259
+ ```
260
+
261
+ ### Demos
262
+
263
+ ```bash
264
+ npm run demo.[ng|react|svelte|vue].[ios|android]
265
+
266
+ npm run demo.svelte.ios # Example
267
+ ```
268
+
269
+ [](#questions)
270
+
271
+ ## Questions
272
+
273
+ If you have any questions/issues/comments please feel free to create an issue or start a conversation in the [NativeScript Community Discord](https://nativescript.org/discord).
@@ -0,0 +1,60 @@
1
+ import { Directive, ElementRef, HostListener, Inject, NgModule, forwardRef } from '@angular/core';
2
+ import { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
3
+ import { BaseValueAccessor, registerElement } from '@nativescript/angular';
4
+ import { View } from '@nativescript/core';
5
+ import { CheckBox } from '@nativescript-community/ui-checkbox';
6
+ import * as i0 from "@angular/core";
7
+ registerElement('CheckBox', () => CheckBox);
8
+ const CHECKED_VALUE_ACCESSOR = {
9
+ provide: NG_VALUE_ACCESSOR,
10
+ useExisting: forwardRef(() => CheckedValueAccessor),
11
+ multi: true
12
+ };
13
+ export class CheckedValueAccessor extends BaseValueAccessor {
14
+ constructor(elementRef) {
15
+ super(elementRef.nativeElement);
16
+ this.onTouched = () => { };
17
+ }
18
+ checkedChangeListener(event) {
19
+ this.onChange(event.value);
20
+ }
21
+ writeValue(value) {
22
+ this.view.checked = value;
23
+ }
24
+ registerOnTouched(fn) {
25
+ this.onTouched = fn;
26
+ }
27
+ }
28
+ CheckedValueAccessor.ɵfac = function CheckedValueAccessor_Factory(t) { return new (t || CheckedValueAccessor)(i0.ɵɵdirectiveInject(ElementRef)); };
29
+ 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) {
30
+ i0.ɵɵlistener("checkedChange", function CheckedValueAccessor_checkedChange_HostBindingHandler($event) { return ctx.checkedChangeListener($event); });
31
+ } }, features: [i0.ɵɵProvidersFeature([CHECKED_VALUE_ACCESSOR]), i0.ɵɵInheritDefinitionFeature] });
32
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CheckedValueAccessor, [{
33
+ type: Directive,
34
+ args: [{
35
+ selector: 'CheckBox[ngModel], CheckBox[formControlName], CheckBox[formControl], checkBox[ngModel], checkBox[formControlName], checkBox[formControl], check-box[ngModel], check-box[formControlName], check-box[formControl]',
36
+ providers: [CHECKED_VALUE_ACCESSOR]
37
+ }]
38
+ }], function () { return [{ type: i0.ElementRef, decorators: [{
39
+ type: Inject,
40
+ args: [ElementRef]
41
+ }] }]; }, { checkedChangeListener: [{
42
+ type: HostListener,
43
+ args: ['checkedChange', ['$event']]
44
+ }] }); })();
45
+ export class CheckBoxModule {
46
+ }
47
+ CheckBoxModule.ɵfac = function CheckBoxModule_Factory(t) { return new (t || CheckBoxModule)(); };
48
+ CheckBoxModule.ɵmod = i0.ɵɵdefineNgModule({ type: CheckBoxModule });
49
+ CheckBoxModule.ɵinj = i0.ɵɵdefineInjector({ providers: [], imports: [[FormsModule], FormsModule] });
50
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CheckBoxModule, [{
51
+ type: NgModule,
52
+ args: [{
53
+ declarations: [CheckedValueAccessor],
54
+ providers: [],
55
+ imports: [FormsModule],
56
+ exports: [FormsModule, CheckedValueAccessor]
57
+ }]
58
+ }], null, null); })();
59
+ (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(CheckBoxModule, { declarations: [CheckedValueAccessor], imports: [FormsModule], exports: [FormsModule, CheckedValueAccessor] }); })();
60
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvY2hlY2tib3gvYW5ndWxhci9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsU0FBUyxFQUFFLFVBQVUsRUFBRSxZQUFZLEVBQUUsTUFBTSxFQUFFLFFBQVEsRUFBRSxVQUFVLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDbEcsT0FBTyxFQUFFLFdBQVcsRUFBRSxpQkFBaUIsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBQ2hFLE9BQU8sRUFBRSxpQkFBaUIsRUFBRSxlQUFlLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUMzRSxPQUFPLEVBQUUsSUFBSSxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFDMUMsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLHFDQUFxQyxDQUFDOztBQUUvRCxlQUFlLENBQUMsVUFBVSxFQUFFLEdBQUcsRUFBRSxDQUFDLFFBQVEsQ0FBQyxDQUFDO0FBRTVDLE1BQU0sc0JBQXNCLEdBQUc7SUFDM0IsT0FBTyxFQUFFLGlCQUFpQjtJQUMxQixXQUFXLEVBQUUsVUFBVSxDQUFDLEdBQU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HVibGljIGNoZWNrZWRDaGFuZ2VMaXN0ZW5lcihldmVudDogYW55KSB7XG4gICAgICAgIHRoaXMub25DaGFuZ2UoZXZlbnQudmFsdWUpO1xuICAgIH1cblxuICAgIHB1YmxpYyBvblRvdWNoZWQgPSAoKSA9PiB7fTtcblxuICAgIHB1YmxpYyB3cml0ZVZhbHVlKHZhbHVlOiBhbnkpOiB2b2lkIHtcbiAgICAgICAgdGhpcy52aWV3LmNoZWNrZWQgPSB2YWx1ZTtcbiAgICB9XG5cbiAgICBwdWJsaWMgcmVnaXN0ZXJPblRvdWNoZWQoZm46ICgpID0+IHZvaWQpOiB2b2lkIHtcbiAgICAgICAgdGhpcy5vblRvdWNoZWQgPSBmbjtcbiAgICB9XG59XG5cbkBOZ01vZHVsZSh7XG4gICAgZGVjbGFyYXRpb25zOiBbQ2hlY2tlZFZhbHVlQWNjZXNzb3JdLFxuICAgIHByb3ZpZGVyczogW10sXG4gICAgaW1wb3J0czogW0Zvcm1zTW9kdWxlXSxcbiAgICBleHBvcnRzOiBbRm9ybXNNb2R1bGUsIENoZWNrZWRWYWx1ZUFjY2Vzc29yXVxufSlcbmV4cG9ydCBjbGFzcyBDaGVja0JveE1vZHVsZSB7fVxuIl19
@@ -0,0 +1,2 @@
1
+ export * from './index';
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmF0aXZlc2NyaXB0LWNvbW11bml0eS11aS1jaGVja2JveC1hbmd1bGFyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2NoZWNrYm94L2FuZ3VsYXIvbmF0aXZlc2NyaXB0LWNvbW11bml0eS11aS1jaGVja2JveC1hbmd1bGFyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUlBLGNBQWMsU0FBUyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBHZW5lcmF0ZWQgYnVuZGxlIGluZGV4LiBEbyBub3QgZWRpdC5cbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL2luZGV4JztcbiJdfQ==
@@ -0,0 +1,70 @@
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 { CheckBox } from '@nativescript-community/ui-checkbox';
6
+
7
+ registerElement('CheckBox', () => CheckBox);
8
+ const CHECKED_VALUE_ACCESSOR = {
9
+ provide: NG_VALUE_ACCESSOR,
10
+ useExisting: forwardRef(() => CheckedValueAccessor),
11
+ multi: true
12
+ };
13
+ class CheckedValueAccessor extends BaseValueAccessor {
14
+ constructor(elementRef) {
15
+ super(elementRef.nativeElement);
16
+ this.onTouched = () => { };
17
+ }
18
+ checkedChangeListener(event) {
19
+ this.onChange(event.value);
20
+ }
21
+ writeValue(value) {
22
+ this.view.checked = value;
23
+ }
24
+ registerOnTouched(fn) {
25
+ this.onTouched = fn;
26
+ }
27
+ }
28
+ CheckedValueAccessor.ɵfac = function CheckedValueAccessor_Factory(t) { return new (t || CheckedValueAccessor)(i0.ɵɵdirectiveInject(ElementRef)); };
29
+ 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) {
30
+ if (rf & 1) {
31
+ i0.ɵɵlistener("checkedChange", function CheckedValueAccessor_checkedChange_HostBindingHandler($event) { return ctx.checkedChangeListener($event); });
32
+ }
33
+ }, features: [i0.ɵɵProvidersFeature([CHECKED_VALUE_ACCESSOR]), i0.ɵɵInheritDefinitionFeature] });
34
+ (function () {
35
+ (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CheckedValueAccessor, [{
36
+ type: Directive,
37
+ args: [{
38
+ selector: 'CheckBox[ngModel], CheckBox[formControlName], CheckBox[formControl], checkBox[ngModel], checkBox[formControlName], checkBox[formControl], check-box[ngModel], check-box[formControlName], check-box[formControl]',
39
+ providers: [CHECKED_VALUE_ACCESSOR]
40
+ }]
41
+ }], function () {
42
+ return [{ type: i0.ElementRef, decorators: [{
43
+ type: Inject,
44
+ args: [ElementRef]
45
+ }] }];
46
+ }, { checkedChangeListener: [{
47
+ type: HostListener,
48
+ args: ['checkedChange', ['$event']]
49
+ }] });
50
+ })();
51
+ class CheckBoxModule {
52
+ }
53
+ CheckBoxModule.ɵfac = function CheckBoxModule_Factory(t) { return new (t || CheckBoxModule)(); };
54
+ CheckBoxModule.ɵmod = i0.ɵɵdefineNgModule({ type: CheckBoxModule });
55
+ CheckBoxModule.ɵinj = i0.ɵɵdefineInjector({ providers: [], imports: [[FormsModule], FormsModule] });
56
+ (function () {
57
+ (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CheckBoxModule, [{
58
+ type: NgModule,
59
+ args: [{
60
+ declarations: [CheckedValueAccessor],
61
+ providers: [],
62
+ imports: [FormsModule],
63
+ exports: [FormsModule, CheckedValueAccessor]
64
+ }]
65
+ }], null, null);
66
+ })();
67
+ (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(CheckBoxModule, { declarations: [CheckedValueAccessor], imports: [FormsModule], exports: [FormsModule, CheckedValueAccessor] }); })();
68
+
69
+ export { CheckBoxModule, CheckedValueAccessor };
70
+ //# 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,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