Skip to content

Commit ab9534b

Browse files
committed
NS7 final
1 parent 10cc858 commit ab9534b

File tree

3 files changed

+55
-50
lines changed

3 files changed

+55
-50
lines changed

src/checkbox.ios.ts

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,78 +4,78 @@ import {
44
Color,
55
CssProperty,
66
Property,
7-
Style,
7+
Style
88
} from '@nativescript/core';
99
import { BoxType } from './checkbox-common';
1010
import { CheckBoxInterface } from './index';
1111

1212
const checkBoxBackgroundColorProperty = new CssProperty<Style, string>({
1313
name: 'checkBoxBackgroundColor',
1414
cssName: 'checkbox-background-color',
15-
valueConverter: (v) => {
15+
valueConverter: v => {
1616
return String(v);
17-
},
17+
}
1818
});
1919

2020
const onCheckColorProperty = new CssProperty<Style, string>({
2121
name: 'onCheckColor',
2222
cssName: 'on-check-color',
2323
defaultValue: '#ffffff',
24-
valueConverter: (v) => {
24+
valueConverter: v => {
2525
return String(v);
26-
},
26+
}
2727
});
2828

2929
const tintColorProperty = new CssProperty<Style, string>({
3030
name: 'tintColor',
3131
cssName: 'tint-color',
3232
// defaultValue: "#0075ff",
33-
valueConverter: (v) => {
33+
valueConverter: v => {
3434
return String(v);
35-
},
35+
}
3636
});
3737

3838
const onTintColorProperty = new CssProperty<Style, string>({
3939
name: 'onTintColor',
4040
cssName: 'on-tint-color',
41-
valueConverter: (v) => {
41+
valueConverter: v => {
4242
return String(v);
43-
},
43+
}
4444
});
4545

4646
const fillColorProperty = new CssProperty<Style, string>({
4747
name: 'fillColor',
4848
cssName: 'fill-color',
49-
valueConverter: (v) => {
49+
valueConverter: v => {
5050
return String(v);
51-
},
51+
}
5252
});
5353

5454
const checkedProperty = new Property<CheckBox, boolean>({
5555
name: 'checked',
5656
defaultValue: false,
5757
valueConverter: booleanConverter,
58-
valueChanged: onCheckedPropertyChanged,
58+
valueChanged: onCheckedPropertyChanged
5959
});
6060

6161
const boxTypeProperty = new Property<CheckBox, BEMBoxType>({
6262
name: 'boxType',
63-
valueConverter: (v) => {
63+
valueConverter: v => {
6464
return BoxType[v] === BoxType.circle
6565
? BEMBoxType.Circle
6666
: BEMBoxType.Square;
67-
},
67+
}
6868
});
6969

7070
export class CheckBox extends Button implements CheckBoxInterface {
71-
public checked: boolean;
72-
public boxType: number;
73-
public _onCheckColor: string;
74-
public _checkBoxBackgroundColor: any;
75-
public _onTintColor: string;
76-
public _tintColor: string;
77-
public _onFillColor: string;
78-
public _fillColor: string;
71+
checked: boolean;
72+
boxType: number;
73+
_onCheckColor: string;
74+
_checkBoxBackgroundColor: any;
75+
_onTintColor: string;
76+
_tintColor: string;
77+
_onFillColor: string;
78+
_fillColor: string;
7979
private _iosCheckbox: BEMCheckBox;
8080
private _delegate: BEMCheckBoxDelegateImpl;
8181
private _lineWidth: number = 1;
@@ -125,17 +125,17 @@ export class CheckBox extends Button implements CheckBoxInterface {
125125
this._iosCheckbox.onCheckColor = new Color(color).ios;
126126
}
127127

128-
public [boxTypeProperty.setNative](value: any) {
128+
[boxTypeProperty.setNative](value: any) {
129129
if (this._iosCheckbox) {
130130
this._iosCheckbox.boxType = value;
131131
}
132132
}
133133

134-
public [checkedProperty.getDefault](): boolean {
134+
[checkedProperty.getDefault](): boolean {
135135
return false;
136136
}
137137

138-
public [checkedProperty.setNative](value: boolean) {
138+
[checkedProperty.setNative](value: boolean) {
139139
this._iosCheckbox.setOnAnimated(value, true);
140140
}
141141

@@ -173,13 +173,13 @@ export class CheckBox extends Button implements CheckBoxInterface {
173173
return this._iosCheckbox;
174174
}
175175

176-
public reload(value: boolean) {
176+
reload(value: boolean) {
177177
this._iosCheckbox.reload();
178178
}
179179

180-
public initNativeView() {
180+
initNativeView() {
181181
// allow label click to change the textbox
182-
this.addEventListener('tap', (args) => {
182+
this.addEventListener('tap', args => {
183183
const checkbox = args.object as CheckBox;
184184
checkbox.checked = !checkbox.checked;
185185
});
@@ -248,12 +248,12 @@ export class CheckBox extends Button implements CheckBoxInterface {
248248
}
249249
}
250250

251-
public disposeNativeView() {
251+
disposeNativeView() {
252252
this._iosCheckbox.delegate = null;
253253
this.removeEventListener('tap');
254254
}
255255

256-
public toggle() {
256+
toggle() {
257257
this.checked = !this.checked;
258258
}
259259

@@ -276,35 +276,35 @@ export class CheckBox extends Button implements CheckBoxInterface {
276276
}
277277
}
278278

279-
public _onCheckedPropertyChanged(checkbox: CheckBox, oldValue, newValue) {
279+
_onCheckedPropertyChanged(checkbox: CheckBox, oldValue, newValue) {
280280
if (!this.nativeView) {
281281
return;
282282
}
283283
checkedProperty.nativeValueChange(this, newValue);
284284
}
285285
}
286286

287+
@NativeClass()
287288
class BEMCheckBoxDelegateImpl extends NSObject implements BEMCheckBoxDelegate {
288-
public static ObjCProtocols = [BEMCheckBoxDelegate];
289-
/*public static ObjCExposedMethods = {
290-
"didTapCheckBox": { returns: interop.types.void, params: [NSObject] }
291-
};*/
289+
static ObjCProtocols = [BEMCheckBoxDelegate];
292290

293291
private _owner: WeakRef<CheckBox>;
294292

295-
public static initWithOwner(
296-
owner: WeakRef<CheckBox>
297-
): BEMCheckBoxDelegateImpl {
293+
/* static ObjCExposedMethods = {
294+
"didTapCheckBox": { returns: interop.types.void, params: [NSObject] }
295+
};*/
296+
297+
static initWithOwner(owner: WeakRef<CheckBox>): BEMCheckBoxDelegateImpl {
298298
const delegate = <BEMCheckBoxDelegateImpl>BEMCheckBoxDelegateImpl.new();
299299
delegate._owner = owner;
300300
return delegate;
301301
}
302302

303-
public animationDidStopForCheckBox(checkBox: BEMCheckBox): void {
303+
animationDidStopForCheckBox(checkBox: BEMCheckBox): void {
304304
// TODO: Maybe trigger event later?
305305
}
306306

307-
public didTapCheckBox(checkBox: BEMCheckBox): void {
307+
didTapCheckBox(checkBox: BEMCheckBox): void {
308308
const owner = this._owner.get();
309309
if (owner) {
310310
checkedProperty.nativeValueChange(owner, checkBox.on);

src/package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
"scripts": {
1414
"clean": "npx rimraf node_modules package-lock.json && npm i",
15-
"build": "npm i && tsc",
15+
"build": "npm i && ts-patch install && tsc",
1616
"prepublishOnly": "npm run build && npm run build.ng.module",
1717
"build.ng.module": "npm run build && ng-packagr -p angular/package.json",
1818
"tslint": "cd .. && tslint \"**/*.ts\" --config tslint.json --exclude \"**/node_modules/**\" --exclude \"*demo*/platforms/**\" --exclude \"**/typings/**\"",
@@ -70,9 +70,10 @@
7070
"@angular/platform-browser": "~10.0.0",
7171
"@angular/platform-browser-dynamic": "~10.0.0",
7272
"@angular/router": "~10.0.0",
73-
"@nativescript/angular": "~10.0.0",
74-
"@nativescript/core": "~7.0.0",
75-
"@nativescript/types": "~7.0.0",
73+
"@nativescript/angular": "~10.1.5",
74+
"@nativescript/core": "~7.0.3",
75+
"@nativescript/types": "~7.0.3",
76+
"@nativescript/webpack": "~3.0.4",
7677
"husky": "^4.2.5",
7778
"lint-staged": "^10.2.11",
7879
"ng-packagr": "~10.1.0",
@@ -81,6 +82,8 @@
8182
"rimraf": "^2.6.3",
8283
"rxjs": "~6.6.0",
8384
"tslint": "~6.0.0",
85+
"ts-patch": "^1.3.0",
86+
"ts-node": "~9.0.0",
8487
"typescript": "~3.9.7",
8588
"zone.js": "0.11.1"
8689
},

src/tsconfig.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@
1717
"noImplicitReturns": true,
1818
"noImplicitUseStrict": false,
1919
"noFallthroughCasesInSwitch": true,
20-
"lib": [
21-
"es2017",
22-
"dom",
23-
"es6"
24-
],
25-
"baseUrl": "."
20+
"lib": ["es2017", "dom", "es6"],
21+
"baseUrl": ".",
22+
"plugins": [
23+
{
24+
"transform": "@nativescript/webpack/transformers/ns-transform-native-classes",
25+
"type": "raw"
26+
}
27+
]
2628
},
2729
"exclude": ["node_modules", "platforms", "typings/BEMCheckBox.d.ts"],
2830
"compileOnSave": false

0 commit comments

Comments
 (0)