nativescript-checkbox-ns-7
Advanced tools
Comparing version 12.0.0 to 22.0.0
@@ -6,3 +6,3 @@ import { Directive, ElementRef, forwardRef, HostListener, Inject, NgModule } from '@angular/core'; | ||
function convertToInt(value) { | ||
var normalizedValue; | ||
let normalizedValue; | ||
if (value === undefined || value === null) { | ||
@@ -16,3 +16,3 @@ normalizedValue = 0; | ||
else { | ||
var parsedValue = parseInt(value.toString(), 10); | ||
const parsedValue = parseInt(value.toString(), 10); | ||
normalizedValue = isNaN(parsedValue) ? 0 : parsedValue; | ||
@@ -23,54 +23,45 @@ } | ||
} | ||
registerElement('CheckBox', function () { return require('../checkbox').CheckBox; }); | ||
var CHECKED_VALUE_ACCESSOR = { | ||
registerElement('CheckBox', () => require('../checkbox').CheckBox); | ||
const CHECKED_VALUE_ACCESSOR = { | ||
provide: NG_VALUE_ACCESSOR, | ||
useExisting: forwardRef(function () { return CheckedValueAccessor; }), | ||
useExisting: forwardRef(() => CheckedValueAccessor), | ||
multi: true, | ||
}; | ||
var CheckedValueAccessor = (function (_super) { | ||
__extends(CheckedValueAccessor, _super); | ||
function CheckedValueAccessor(elementRef) { | ||
var _this = _super.call(this, elementRef.nativeElement) || this; | ||
_this.onTouched = function () { }; | ||
return _this; | ||
let CheckedValueAccessor = class CheckedValueAccessor extends BaseValueAccessor { | ||
constructor(elementRef) { | ||
super(elementRef.nativeElement); | ||
this.onTouched = () => { }; | ||
} | ||
CheckedValueAccessor.prototype.checkedChangeListener = function (event) { | ||
checkedChangeListener(event) { | ||
this.onChange(event.value); | ||
}; | ||
CheckedValueAccessor.prototype.writeValue = function (value) { | ||
} | ||
writeValue(value) { | ||
this.view.checked = value; | ||
}; | ||
CheckedValueAccessor.prototype.registerOnTouched = function (fn) { | ||
} | ||
registerOnTouched(fn) { | ||
this.onTouched = fn; | ||
}; | ||
__decorate([ | ||
HostListener('checkedChange', ['$event']), | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", [Object]), | ||
__metadata("design:returntype", void 0) | ||
], CheckedValueAccessor.prototype, "checkedChangeListener", null); | ||
CheckedValueAccessor = __decorate([ | ||
Directive({ | ||
selector: 'CheckBox[ngModel], CheckBox[formControlName], CheckBox[formControl], checkBox[ngModel], checkBox[formControlName], checkBox[formControl], check-box[ngModel], check-box[formControlName], check-box[formControl]', | ||
providers: [CHECKED_VALUE_ACCESSOR], | ||
}), | ||
__param(0, Inject(ElementRef)), | ||
__metadata("design:paramtypes", [ElementRef]) | ||
], CheckedValueAccessor); | ||
return CheckedValueAccessor; | ||
}(BaseValueAccessor)); | ||
} | ||
}; | ||
__decorate([ | ||
HostListener('checkedChange', ['$event']) | ||
], CheckedValueAccessor.prototype, "checkedChangeListener", null); | ||
CheckedValueAccessor = __decorate([ | ||
Directive({ | ||
selector: 'CheckBox[ngModel], CheckBox[formControlName], CheckBox[formControl], checkBox[ngModel], checkBox[formControlName], checkBox[formControl], check-box[ngModel], check-box[formControlName], check-box[formControl]', | ||
providers: [CHECKED_VALUE_ACCESSOR], | ||
}), | ||
__param(0, Inject(ElementRef)) | ||
], CheckedValueAccessor); | ||
export { CheckedValueAccessor }; | ||
var TNSCheckBoxModule = (function () { | ||
function TNSCheckBoxModule() { | ||
} | ||
TNSCheckBoxModule = __decorate([ | ||
NgModule({ | ||
declarations: [CheckedValueAccessor], | ||
providers: [], | ||
imports: [FormsModule], | ||
exports: [FormsModule, CheckedValueAccessor], | ||
}) | ||
], TNSCheckBoxModule); | ||
return TNSCheckBoxModule; | ||
}()); | ||
let TNSCheckBoxModule = class TNSCheckBoxModule { | ||
}; | ||
TNSCheckBoxModule = __decorate([ | ||
NgModule({ | ||
declarations: [CheckedValueAccessor], | ||
providers: [], | ||
imports: [FormsModule], | ||
exports: [FormsModule, CheckedValueAccessor], | ||
}) | ||
], TNSCheckBoxModule); | ||
export { TNSCheckBoxModule }; | ||
//# sourceMappingURL=index.js.map |
@@ -1,8 +0,6 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var BoxType; | ||
export var BoxType; | ||
(function (BoxType) { | ||
BoxType["circle"] = "circle"; | ||
BoxType["square"] = "square"; | ||
})(BoxType = exports.BoxType || (exports.BoxType = {})); | ||
})(BoxType || (BoxType = {})); | ||
//# sourceMappingURL=checkbox-common.js.map |
@@ -1,11 +0,7 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var core_1 = require("@nativescript/core"); | ||
var view_base_1 = require("@nativescript/core/ui/core/view-base"); | ||
var properties_1 = require("@nativescript/core/ui/core/properties"); | ||
var checkbox_common_1 = require("./checkbox-common"); | ||
var AppCompatCheckBox_Namespace = useAndroidX() | ||
import { Application, Device, Color, View, Style, Property, CssProperty, booleanConverter } from '@nativescript/core'; | ||
import { BoxType } from './checkbox-common'; | ||
const AppCompatCheckBox_Namespace = useAndroidX() | ||
? androidx.appcompat.widget | ||
: android.support.v7.widget; | ||
var CompoundButtonCompat_Namespace = useAndroidX() | ||
const CompoundButtonCompat_Namespace = useAndroidX() | ||
? androidx.core.widget | ||
@@ -19,9 +15,9 @@ : android.support.v4.widget; | ||
} | ||
exports.checkedProperty = new properties_1.Property({ | ||
export const checkedProperty = new Property({ | ||
name: 'checked', | ||
defaultValue: false, | ||
valueConverter: view_base_1.booleanConverter, | ||
valueConverter: booleanConverter, | ||
valueChanged: onCheckedPropertyChanged, | ||
}); | ||
exports.textProperty = new properties_1.Property({ | ||
export const textProperty = new Property({ | ||
name: 'text', | ||
@@ -31,25 +27,25 @@ defaultValue: '', | ||
}); | ||
exports.fillColorProperty = new properties_1.CssProperty({ | ||
export const fillColorProperty = new CssProperty({ | ||
name: 'fillColor', | ||
cssName: 'fill-color', | ||
valueConverter: function (v) { | ||
valueConverter: (v) => { | ||
return String(v); | ||
}, | ||
}); | ||
exports.tintColorProperty = new properties_1.CssProperty({ | ||
export const tintColorProperty = new CssProperty({ | ||
name: 'tintColor', | ||
cssName: 'tint-color', | ||
defaultValue: '#0075ff', | ||
valueConverter: function (v) { | ||
valueConverter: (v) => { | ||
return String(v); | ||
}, | ||
}); | ||
exports.fontSizeProperty = new properties_1.CssProperty({ | ||
export const fontSizeProperty = new CssProperty({ | ||
name: 'fontSize', | ||
cssName: 'font-size', | ||
defaultValue: 14, | ||
valueConverter: function (v) { | ||
var x = parseFloat(v); | ||
valueConverter: (v) => { | ||
const x = parseFloat(v); | ||
if (x < 0) { | ||
throw new Error("font-size accepts values greater than 0. Value: " + v); | ||
throw new Error(`font-size accepts values greater than 0. Value: ${v}`); | ||
} | ||
@@ -59,129 +55,88 @@ return x; | ||
}); | ||
exports.fontSizeProperty.register(properties_1.Style); | ||
var CheckBox = (function (_super) { | ||
__extends(CheckBox, _super); | ||
function CheckBox() { | ||
return _super.call(this) || this; | ||
fontSizeProperty.register(Style); | ||
export class CheckBox extends View { | ||
constructor() { | ||
super(); | ||
} | ||
Object.defineProperty(CheckBox.prototype, "android", { | ||
get: function () { | ||
return this._android; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(CheckBox.prototype, "boxType", { | ||
get: function () { | ||
return this._boxType; | ||
}, | ||
set: function (value) { | ||
this._boxType = value; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(CheckBox.prototype, "checkStyle", { | ||
get: function () { | ||
return this._checkStyle; | ||
}, | ||
set: function (style) { | ||
this._checkStyle = style; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(CheckBox.prototype, "checkPadding", { | ||
get: function () { | ||
return this._checkPadding; | ||
}, | ||
set: function (padding) { | ||
this._checkPadding = padding; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(CheckBox.prototype, "checkPaddingLeft", { | ||
get: function () { | ||
return this._checkPaddingLeft; | ||
}, | ||
set: function (padding) { | ||
this._checkPaddingLeft = padding; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(CheckBox.prototype, "checkPaddingTop", { | ||
get: function () { | ||
return this._checkPaddingTop; | ||
}, | ||
set: function (padding) { | ||
this._checkPaddingTop = padding; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(CheckBox.prototype, "checkPaddingRight", { | ||
get: function () { | ||
return this._checkPaddingRight; | ||
}, | ||
set: function (padding) { | ||
this._checkPaddingRight = padding; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(CheckBox.prototype, "checkPaddingBottom", { | ||
get: function () { | ||
return this._checkPaddingBottom; | ||
}, | ||
set: function (padding) { | ||
this._checkPaddingBottom = padding; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
CheckBox.prototype[exports.checkedProperty.getDefault] = function () { | ||
get android() { | ||
return this._android; | ||
} | ||
set boxType(value) { | ||
this._boxType = value; | ||
} | ||
get boxType() { | ||
return this._boxType; | ||
} | ||
get checkStyle() { | ||
return this._checkStyle; | ||
} | ||
set checkStyle(style) { | ||
this._checkStyle = style; | ||
} | ||
set checkPadding(padding) { | ||
this._checkPadding = padding; | ||
} | ||
get checkPadding() { | ||
return this._checkPadding; | ||
} | ||
set checkPaddingLeft(padding) { | ||
this._checkPaddingLeft = padding; | ||
} | ||
get checkPaddingLeft() { | ||
return this._checkPaddingLeft; | ||
} | ||
set checkPaddingTop(padding) { | ||
this._checkPaddingTop = padding; | ||
} | ||
get checkPaddingTop() { | ||
return this._checkPaddingTop; | ||
} | ||
set checkPaddingRight(padding) { | ||
this._checkPaddingRight = padding; | ||
} | ||
get checkPaddingRight() { | ||
return this._checkPaddingRight; | ||
} | ||
set checkPaddingBottom(padding) { | ||
this._checkPaddingBottom = padding; | ||
} | ||
get checkPaddingBottom() { | ||
return this._checkPaddingBottom; | ||
} | ||
[checkedProperty.getDefault]() { | ||
return false; | ||
}; | ||
CheckBox.prototype[exports.checkedProperty.setNative] = function (value) { | ||
} | ||
[checkedProperty.setNative](value) { | ||
this.nativeView.setChecked(Boolean(value)); | ||
}; | ||
CheckBox.prototype[exports.textProperty.getDefault] = function () { | ||
} | ||
[textProperty.getDefault]() { | ||
return ''; | ||
}; | ||
CheckBox.prototype[exports.textProperty.setNative] = function (value) { | ||
} | ||
[textProperty.setNative](value) { | ||
this.nativeView.setText(java.lang.String.valueOf(value)); | ||
}; | ||
CheckBox.prototype[exports.fontSizeProperty.getDefault] = function () { | ||
} | ||
[fontSizeProperty.getDefault]() { | ||
return 14; | ||
}; | ||
CheckBox.prototype[exports.fontSizeProperty.setNative] = function (value) { | ||
} | ||
[fontSizeProperty.setNative](value) { | ||
this.nativeView.setTextSize(value); | ||
}; | ||
Object.defineProperty(CheckBox.prototype, "fillColor", { | ||
get: function () { | ||
return this.style.fillColor; | ||
}, | ||
set: function (color) { | ||
this.style.fillColor = color; | ||
if (this._android && core_1.Device.sdkVersion >= '21') { | ||
this._android.setButtonTintList(android.content.res.ColorStateList.valueOf(new core_1.Color(color).android)); | ||
} | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(CheckBox.prototype, "tintColor", { | ||
get: function () { | ||
return this.style.fillColor; | ||
}, | ||
set: function (color) { | ||
this.style.fillColor = color; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
CheckBox.prototype.createNativeView = function () { | ||
} | ||
get fillColor() { | ||
return this.style.fillColor; | ||
} | ||
set fillColor(color) { | ||
this.style.fillColor = color; | ||
if (this._android && Device.sdkVersion >= '21') { | ||
this._android.setButtonTintList(android.content.res.ColorStateList.valueOf(new Color(color).android)); | ||
} | ||
} | ||
get tintColor() { | ||
return this.style.fillColor; | ||
} | ||
set tintColor(color) { | ||
this.style.fillColor = color; | ||
} | ||
createNativeView() { | ||
var _a; | ||
this._android = new AppCompatCheckBox_Namespace[checkbox_common_1.BoxType[this.boxType] === checkbox_common_1.BoxType.circle | ||
this._android = new AppCompatCheckBox_Namespace[BoxType[this.boxType] === BoxType.circle | ||
? 'AppCompatRadioButton' | ||
@@ -203,3 +158,3 @@ : 'AppCompatCheckBox'](this._context, null); | ||
if (this.checkPadding) { | ||
var pads = this.checkPadding.toString().split(','); | ||
const pads = this.checkPadding.toString().split(','); | ||
switch (pads.length) { | ||
@@ -227,3 +182,3 @@ case 1: | ||
this._android.setTextSize(this.style.fontSize); | ||
var typeface = (_a = this.style.fontInternal) === null || _a === void 0 ? void 0 : _a.getAndroidTypeface(); | ||
const typeface = (_a = this.style.fontInternal) === null || _a === void 0 ? void 0 : _a.getAndroidTypeface(); | ||
if (typeface) { | ||
@@ -233,5 +188,5 @@ this._android.setTypeface(typeface); | ||
if (this._checkStyle) { | ||
var drawable = core_1.Application.android.context | ||
const drawable = Application.android.context | ||
.getResources() | ||
.getIdentifier(this._checkStyle, 'drawable', core_1.Application.android.context.getPackageName()); | ||
.getIdentifier(this._checkStyle, 'drawable', Application.android.context.getPackageName()); | ||
this._android.setButtonDrawable(drawable); | ||
@@ -241,38 +196,36 @@ } | ||
if (this.fillColor) { | ||
CompoundButtonCompat_Namespace.CompoundButtonCompat.setButtonTintList(this._android, android.content.res.ColorStateList.valueOf(new core_1.Color(this.fillColor).android)); | ||
CompoundButtonCompat_Namespace.CompoundButtonCompat.setButtonTintList(this._android, android.content.res.ColorStateList.valueOf(new Color(this.fillColor).android)); | ||
} | ||
} | ||
return this._android; | ||
}; | ||
CheckBox.prototype.initNativeView = function () { | ||
var that = new WeakRef(this); | ||
} | ||
initNativeView() { | ||
const that = new WeakRef(this); | ||
this.nativeView.setOnCheckedChangeListener(new android.widget.CompoundButton.OnCheckedChangeListener({ | ||
onCheckedChanged: function (sender, isChecked) { | ||
onCheckedChanged: (sender, isChecked) => { | ||
if (that.get()) { | ||
exports.checkedProperty.nativeValueChange(that.get(), isChecked); | ||
checkedProperty.nativeValueChange(that.get(), isChecked); | ||
} | ||
}, | ||
})); | ||
}; | ||
CheckBox.prototype.disposeNativeView = function () { | ||
} | ||
disposeNativeView() { | ||
this.nativeView.setOnCheckedChangeListener(null); | ||
}; | ||
CheckBox.prototype.toggle = function () { | ||
} | ||
toggle() { | ||
this.nativeView.toggle(); | ||
}; | ||
CheckBox.prototype._onCheckedPropertyChanged = function (checkbox, oldValue, newValue) { | ||
} | ||
_onCheckedPropertyChanged(checkbox, oldValue, newValue) { | ||
if (!this.nativeView) { | ||
return; | ||
} | ||
exports.checkedProperty.nativeValueChange(this, newValue); | ||
}; | ||
CheckBox.prototype._onTextPropertyChanged = function (checkbox, oldValue, newValue) { | ||
checkedProperty.nativeValueChange(this, newValue); | ||
} | ||
_onTextPropertyChanged(checkbox, oldValue, newValue) { | ||
if (!this.nativeView) { | ||
return; | ||
} | ||
exports.textProperty.nativeValueChange(this, newValue); | ||
}; | ||
return CheckBox; | ||
}(core_1.View)); | ||
exports.CheckBox = CheckBox; | ||
textProperty.nativeValueChange(this, newValue); | ||
} | ||
} | ||
function onCheckedPropertyChanged(checkbox, oldValue, newValue) { | ||
@@ -284,6 +237,6 @@ checkbox._onCheckedPropertyChanged(checkbox, oldValue, newValue); | ||
} | ||
exports.checkedProperty.register(CheckBox); | ||
exports.textProperty.register(CheckBox); | ||
exports.fillColorProperty.register(properties_1.Style); | ||
exports.tintColorProperty.register(properties_1.Style); | ||
checkedProperty.register(CheckBox); | ||
textProperty.register(CheckBox); | ||
fillColorProperty.register(Style); | ||
tintColorProperty.register(Style); | ||
//# sourceMappingURL=checkbox.android.js.map |
@@ -1,53 +0,49 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var core_1 = require("@nativescript/core"); | ||
var view_base_1 = require("@nativescript/core/ui/core/view-base"); | ||
var properties_1 = require("@nativescript/core/ui/core/properties"); | ||
var checkbox_common_1 = require("./checkbox-common"); | ||
var checkBoxBackgroundColorProperty = new properties_1.CssProperty({ | ||
import { Color, Button, CssProperty, Property, Style, booleanConverter } from '@nativescript/core'; | ||
import { BoxType } from './checkbox-common'; | ||
const checkBoxBackgroundColorProperty = new CssProperty({ | ||
name: 'checkBoxBackgroundColor', | ||
cssName: 'checkbox-background-color', | ||
valueConverter: function (v) { | ||
valueConverter: (v) => { | ||
return String(v); | ||
}, | ||
}); | ||
var onCheckColorProperty = new properties_1.CssProperty({ | ||
const onCheckColorProperty = new CssProperty({ | ||
name: 'onCheckColor', | ||
cssName: 'on-check-color', | ||
defaultValue: '#ffffff', | ||
valueConverter: function (v) { | ||
valueConverter: (v) => { | ||
return String(v); | ||
}, | ||
}); | ||
var tintColorProperty = new properties_1.CssProperty({ | ||
const tintColorProperty = new CssProperty({ | ||
name: 'tintColor', | ||
cssName: 'tint-color', | ||
valueConverter: function (v) { | ||
valueConverter: (v) => { | ||
return String(v); | ||
}, | ||
}); | ||
var onTintColorProperty = new properties_1.CssProperty({ | ||
const onTintColorProperty = new CssProperty({ | ||
name: 'onTintColor', | ||
cssName: 'on-tint-color', | ||
valueConverter: function (v) { | ||
valueConverter: (v) => { | ||
return String(v); | ||
}, | ||
}); | ||
var fillColorProperty = new properties_1.CssProperty({ | ||
const fillColorProperty = new CssProperty({ | ||
name: 'fillColor', | ||
cssName: 'fill-color', | ||
valueConverter: function (v) { | ||
valueConverter: (v) => { | ||
return String(v); | ||
}, | ||
}); | ||
var checkedProperty = new properties_1.Property({ | ||
const checkedProperty = new Property({ | ||
name: 'checked', | ||
defaultValue: false, | ||
valueConverter: view_base_1.booleanConverter, | ||
valueConverter: booleanConverter, | ||
valueChanged: onCheckedPropertyChanged, | ||
}); | ||
var boxTypeProperty = new properties_1.Property({ | ||
const boxTypeProperty = new Property({ | ||
name: 'boxType', | ||
valueConverter: function (v) { | ||
return checkbox_common_1.BoxType[v] === checkbox_common_1.BoxType.circle | ||
valueConverter: (v) => { | ||
return BoxType[v] === BoxType.circle | ||
? 0 | ||
@@ -57,131 +53,77 @@ : 1; | ||
}); | ||
var CheckBox = (function (_super) { | ||
__extends(CheckBox, _super); | ||
function CheckBox() { | ||
var _this = _super.call(this) || this; | ||
_this._lineWidth = 1; | ||
_this._iosCheckbox = BEMCheckBox.alloc().initWithFrame(CGRectMake(0, 0, 80, 80)); | ||
return _this; | ||
export class CheckBox extends Button { | ||
constructor() { | ||
super(); | ||
this._lineWidth = 1; | ||
this._iosCheckbox = BEMCheckBox.alloc().initWithFrame(CGRectMake(0, 0, 80, 80)); | ||
} | ||
Object.defineProperty(CheckBox.prototype, "fillColor", { | ||
set: function (color) { | ||
this._fillColor = color; | ||
this._iosCheckbox.onFillColor = new core_1.Color(color).ios; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(CheckBox.prototype, "onFillColor", { | ||
set: function (color) { | ||
this._onFillColor = color; | ||
this._iosCheckbox.onFillColor = new core_1.Color(color).ios; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(CheckBox.prototype, "tintColor", { | ||
set: function (color) { | ||
this._tintColor = color; | ||
this._iosCheckbox.tintColor = new core_1.Color(color).ios; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(CheckBox.prototype, "onTintColor", { | ||
set: function (color) { | ||
this._onTintColor = color; | ||
this._iosCheckbox.onTintColor = new core_1.Color(color).ios; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(CheckBox.prototype, "checkBoxBackgroundColor", { | ||
set: function (color) { | ||
this._checkBoxBackgroundColor = color; | ||
this._iosCheckbox.offFillColor = new core_1.Color(color).ios; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(CheckBox.prototype, "onCheckColor", { | ||
set: function (color) { | ||
this._onCheckColor = color; | ||
this._iosCheckbox.onCheckColor = new core_1.Color(color).ios; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
CheckBox.prototype[boxTypeProperty.setNative] = function (value) { | ||
set fillColor(color) { | ||
this._fillColor = color; | ||
this._iosCheckbox.onFillColor = new Color(color).ios; | ||
} | ||
set onFillColor(color) { | ||
this._onFillColor = color; | ||
this._iosCheckbox.onFillColor = new Color(color).ios; | ||
} | ||
set tintColor(color) { | ||
this._tintColor = color; | ||
this._iosCheckbox.tintColor = new Color(color).ios; | ||
} | ||
set onTintColor(color) { | ||
this._onTintColor = color; | ||
this._iosCheckbox.onTintColor = new Color(color).ios; | ||
} | ||
set checkBoxBackgroundColor(color) { | ||
this._checkBoxBackgroundColor = color; | ||
this._iosCheckbox.offFillColor = new Color(color).ios; | ||
} | ||
set onCheckColor(color) { | ||
this._onCheckColor = color; | ||
this._iosCheckbox.onCheckColor = new Color(color).ios; | ||
} | ||
[boxTypeProperty.setNative](value) { | ||
if (this._iosCheckbox) { | ||
this._iosCheckbox.boxType = value; | ||
} | ||
}; | ||
CheckBox.prototype[checkedProperty.getDefault] = function () { | ||
} | ||
[checkedProperty.getDefault]() { | ||
return false; | ||
}; | ||
CheckBox.prototype[checkedProperty.setNative] = function (value) { | ||
} | ||
[checkedProperty.setNative](value) { | ||
this._iosCheckbox.setOnAnimated(value, true); | ||
}; | ||
Object.defineProperty(CheckBox.prototype, "checkedAnimated", { | ||
set: function (value) { | ||
this._iosCheckbox.setOnAnimated(value, true); | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(CheckBox.prototype, "lineWidth", { | ||
set: function (value) { | ||
this._iosCheckbox.lineWidth = value; | ||
this._lineWidth = value; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(CheckBox.prototype, "hideBox", { | ||
set: function (value) { | ||
this._iosCheckbox.hideBox = value; | ||
this._hideBox = value; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(CheckBox.prototype, "animationDuration", { | ||
set: function (value) { | ||
this._iosCheckbox.animationDuration = value; | ||
this._animationDuration = value; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(CheckBox.prototype, "onAnimationType", { | ||
set: function (value) { | ||
if (this._iosCheckbox) | ||
this._iosCheckbox.onAnimationType = this._getAnimationType(value); | ||
else | ||
this._onAnimationType = value; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(CheckBox.prototype, "offAnimationType", { | ||
set: function (value) { | ||
this._iosCheckbox.offAnimationType = this._getAnimationType(value); | ||
this._offAnimationType = value; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(CheckBox.prototype, "nativeiOSCheckBox", { | ||
get: function () { | ||
return this._iosCheckbox; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
CheckBox.prototype.reload = function (value) { | ||
} | ||
set checkedAnimated(value) { | ||
this._iosCheckbox.setOnAnimated(value, true); | ||
} | ||
set lineWidth(value) { | ||
this._iosCheckbox.lineWidth = value; | ||
this._lineWidth = value; | ||
} | ||
set hideBox(value) { | ||
this._iosCheckbox.hideBox = value; | ||
this._hideBox = value; | ||
} | ||
set animationDuration(value) { | ||
this._iosCheckbox.animationDuration = value; | ||
this._animationDuration = value; | ||
} | ||
set onAnimationType(value) { | ||
if (this._iosCheckbox) | ||
this._iosCheckbox.onAnimationType = this._getAnimationType(value); | ||
else | ||
this._onAnimationType = value; | ||
} | ||
set offAnimationType(value) { | ||
this._iosCheckbox.offAnimationType = this._getAnimationType(value); | ||
this._offAnimationType = value; | ||
} | ||
get nativeiOSCheckBox() { | ||
return this._iosCheckbox; | ||
} | ||
reload(value) { | ||
this._iosCheckbox.reload(); | ||
}; | ||
CheckBox.prototype.initNativeView = function () { | ||
this.addEventListener('tap', function (args) { | ||
var checkbox = args.object; | ||
} | ||
initNativeView() { | ||
this.addEventListener('tap', (args) => { | ||
const checkbox = args.object; | ||
checkbox.checked = !checkbox.checked; | ||
@@ -192,3 +134,3 @@ }); | ||
this._delegate = BEMCheckBoxDelegateImpl.initWithOwner(new WeakRef(this)); | ||
var fontSize; | ||
let fontSize; | ||
if (!this.style.fontSize) { | ||
@@ -206,15 +148,15 @@ fontSize = 15; | ||
if (this._onCheckColor) { | ||
this._iosCheckbox.onCheckColor = new core_1.Color(this._onCheckColor).ios; | ||
this._iosCheckbox.onCheckColor = new Color(this._onCheckColor).ios; | ||
} | ||
if (this._onFillColor) { | ||
this._iosCheckbox.onFillColor = new core_1.Color(this._onFillColor).ios; | ||
this._iosCheckbox.onFillColor = new Color(this._onFillColor).ios; | ||
} | ||
if (this._onTintColor) { | ||
this._iosCheckbox.onTintColor = new core_1.Color(this._onTintColor).ios; | ||
this._iosCheckbox.onTintColor = new Color(this._onTintColor).ios; | ||
} | ||
if (this._fillColor) { | ||
this._iosCheckbox.onFillColor = new core_1.Color(this._fillColor).ios; | ||
this._iosCheckbox.onFillColor = new Color(this._fillColor).ios; | ||
} | ||
if (this._tintColor) { | ||
this._iosCheckbox.tintColor = new core_1.Color(this._tintColor).ios; | ||
this._iosCheckbox.tintColor = new Color(this._tintColor).ios; | ||
} | ||
@@ -238,11 +180,11 @@ this.nativeView.addSubview(this._iosCheckbox); | ||
} | ||
}; | ||
CheckBox.prototype.disposeNativeView = function () { | ||
} | ||
disposeNativeView() { | ||
this._iosCheckbox.delegate = null; | ||
this.removeEventListener('tap'); | ||
}; | ||
CheckBox.prototype.toggle = function () { | ||
} | ||
toggle() { | ||
this.checked = !this.checked; | ||
}; | ||
CheckBox.prototype._getAnimationType = function (value) { | ||
} | ||
_getAnimationType(value) { | ||
switch (value) { | ||
@@ -264,4 +206,4 @@ case 1: | ||
} | ||
}; | ||
CheckBox.prototype._onCheckedPropertyChanged = function (checkbox, oldValue, newValue) { | ||
} | ||
_onCheckedPropertyChanged(checkbox, oldValue, newValue) { | ||
if (!this.nativeView) { | ||
@@ -271,7 +213,5 @@ return; | ||
checkedProperty.nativeValueChange(this, newValue); | ||
}; | ||
return CheckBox; | ||
}(core_1.Button)); | ||
exports.CheckBox = CheckBox; | ||
var BEMCheckBoxDelegateImpl = (function (_super) { | ||
} | ||
} | ||
var BEMCheckBoxDelegateImpl = /** @class */ (function (_super) { | ||
__extends(BEMCheckBoxDelegateImpl, _super); | ||
@@ -287,2 +227,3 @@ function BEMCheckBoxDelegateImpl() { | ||
BEMCheckBoxDelegateImpl.prototype.animationDidStopForCheckBox = function (checkBox) { | ||
// TODO: Maybe trigger event later? | ||
}; | ||
@@ -303,7 +244,7 @@ BEMCheckBoxDelegateImpl.prototype.didTapCheckBox = function (checkBox) { | ||
checkedProperty.register(CheckBox); | ||
fillColorProperty.register(properties_1.Style); | ||
onTintColorProperty.register(properties_1.Style); | ||
onCheckColorProperty.register(properties_1.Style); | ||
checkBoxBackgroundColorProperty.register(properties_1.Style); | ||
tintColorProperty.register(properties_1.Style); | ||
fillColorProperty.register(Style); | ||
onTintColorProperty.register(Style); | ||
onCheckColorProperty.register(Style); | ||
checkBoxBackgroundColorProperty.register(Style); | ||
tintColorProperty.register(Style); | ||
//# sourceMappingURL=checkbox.ios.js.map |
{ | ||
"name": "nativescript-checkbox-ns-7", | ||
"version": "12.0.0", | ||
"version": "22.0.0", | ||
"description": "NativeScript plugin for checkbox.", | ||
@@ -15,3 +15,3 @@ "main": "checkbox", | ||
"clean": "npx rimraf node_modules package-lock.json && npm i", | ||
"build": "npm i && tsc", | ||
"build": "npm i && ts-patch install && tsc", | ||
"prepublishOnly": "npm run build && npm run build.ng.module", | ||
@@ -75,17 +75,20 @@ "build.ng.module": "npm run build && node ./node_modules/.bin/ngc --project tsconfig.aot.json --outDir ./ && npm pack && npx cpy-cli '*.tgz' '../dist' --rename=nstudio-nativescript-checkbox.tgz", | ||
"@nativescript/angular": "^9.0.0", | ||
"@nativescript/core": "^6.5.8", | ||
"rxjs": "~6.6.0", | ||
"@nativescript/core": "~7.0.0", | ||
"@nativescript/types": "~7.0.0", | ||
"@nativescript/webpack": "~3.0.0", | ||
"husky": "^4.2.5", | ||
"lint-staged": "^10.2.11", | ||
"prettier": "^2.0.5", | ||
"tns-platform-declarations": "^6.5.8", | ||
"prompt": "^1.0.0", | ||
"rimraf": "^2.6.3", | ||
"rxjs": "~6.6.0", | ||
"ts-patch": "^1.3.0", | ||
"tslint": "~6.0.0", | ||
"typescript": "~3.8.3", | ||
"zone.js": "~0.9.1", | ||
"prompt": "^1.0.0" | ||
"typescript": "~3.9.0", | ||
"zone.js": "~0.9.1" | ||
}, | ||
"dependencies": { | ||
"ng": "0.0.0" | ||
"ng": "0.0.0", | ||
"ts-node": "^9.0.0" | ||
} | ||
} |
/// <reference path="./typings/BEMCheckBox.d.ts" /> | ||
/// <reference path="./node_modules/tns-platform-declarations/android.d.ts" /> | ||
/// <reference path="./node_modules/tns-platform-declarations/ios.d.ts" /> | ||
/// <reference path="./node_modules/@nativescript/types/index.d.ts" /> |
@@ -1,2 +0,2 @@ | ||
@NativeClass() | ||
declare class BEMAnimationManager extends NSObject { | ||
@@ -45,2 +45,3 @@ | ||
@NativeClass() | ||
declare class BEMCheckBox extends UIControl implements CAAnimationDelegate { | ||
@@ -148,2 +149,3 @@ | ||
@NativeClass() | ||
declare class BEMCheckBoxGroup extends NSObject { | ||
@@ -172,2 +174,3 @@ | ||
@NativeClass() | ||
declare class BEMPathManager extends NSObject { | ||
@@ -174,0 +177,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36171
2
23
13
719
+ Addedts-node@^9.0.0
+ Addedarg@4.1.3(transitive)
+ Addedbuffer-from@1.1.2(transitive)
+ Addedcreate-require@1.1.1(transitive)
+ Addeddiff@4.0.2(transitive)
+ Addedmake-error@1.3.6(transitive)
+ Addedsource-map@0.6.1(transitive)
+ Addedsource-map-support@0.5.21(transitive)
+ Addedts-node@9.1.1(transitive)
+ Addedtypescript@5.7.2(transitive)
+ Addedyn@3.1.1(transitive)