ng-custom-checkbox-values
Version:
Custom checkbox values like strings or numbers other than default boolean
215 lines (207 loc) • 8.76 kB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/forms')) :
typeof define === 'function' && define.amd ? define('ng-custom-checkbox-values', ['exports', '@angular/core', '@angular/forms'], factory) :
(global = global || self, factory(global['ng-custom-checkbox-values'] = {}, global.ng.core, global.ng.forms));
}(this, (function (exports, core, forms) { 'use strict';
/**
* @fileoverview added by tsickle
* Generated from: lib/custom-checkbox-values.service.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var CustomCheckboxValuesService = /** @class */ (function () {
function CustomCheckboxValuesService() {
}
CustomCheckboxValuesService.decorators = [
{ type: core.Injectable, args: [{
providedIn: 'root'
},] }
];
/** @nocollapse */
CustomCheckboxValuesService.ctorParameters = function () { return []; };
/** @nocollapse */ CustomCheckboxValuesService.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function CustomCheckboxValuesService_Factory() { return new CustomCheckboxValuesService(); }, token: CustomCheckboxValuesService, providedIn: "root" });
return CustomCheckboxValuesService;
}());
/**
* @fileoverview added by tsickle
* Generated from: lib/custom-checkbox-values.component.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var CustomCheckboxValuesComponent = /** @class */ (function () {
function CustomCheckboxValuesComponent() {
}
/**
* @return {?}
*/
CustomCheckboxValuesComponent.prototype.ngOnInit = /**
* @return {?}
*/
function () {
};
CustomCheckboxValuesComponent.decorators = [
{ type: core.Component, args: [{
selector: 'lib-CustomCheckboxValues',
template: "\n <p>\n custom-checkbox-values works!\n </p>\n "
}] }
];
/** @nocollapse */
CustomCheckboxValuesComponent.ctorParameters = function () { return []; };
return CustomCheckboxValuesComponent;
}());
/**
* @fileoverview added by tsickle
* Generated from: lib/custom-checkbox-values.directive.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var CustomCheckboxValuesDirective = /** @class */ (function () {
function CustomCheckboxValuesDirective(elementRef, renderer) {
this.elementRef = elementRef;
this.renderer = renderer;
this.propagateChange = (/**
* @param {?} _
* @return {?}
*/
function (_) { });
this.checkedValue = true;
this.uncheckedValue = false;
this.indeterminateValue = false;
}
/**
* @param {?} ev
* @return {?}
*/
CustomCheckboxValuesDirective.prototype.onHostChange = /**
* @param {?} ev
* @return {?}
*/
function (ev) {
this.propagateChange(ev.target.checked ? this.checkedValue : this.uncheckedValue);
};
/**
* @param {?} obj
* @return {?}
*/
CustomCheckboxValuesDirective.prototype.writeValue = /**
* @param {?} obj
* @return {?}
*/
function (obj) {
if (obj === this.checkedValue) {
this.renderer.setProperty(this.elementRef.nativeElement, 'checked', true);
this.renderer.setProperty(this.elementRef.nativeElement, 'indeterminate', false);
}
else if (obj === this.indeterminateValue) {
this.renderer.setProperty(this.elementRef.nativeElement, 'checked', false);
this.renderer.setProperty(this.elementRef.nativeElement, 'indeterminate', true);
}
else {
this.renderer.setProperty(this.elementRef.nativeElement, 'checked', false);
this.renderer.setProperty(this.elementRef.nativeElement, 'indeterminate', false);
}
};
/**
* @param {?} fn
* @return {?}
*/
CustomCheckboxValuesDirective.prototype.registerOnChange = /**
* @param {?} fn
* @return {?}
*/
function (fn) {
this.propagateChange = fn;
};
/**
* @param {?} fn
* @return {?}
*/
CustomCheckboxValuesDirective.prototype.registerOnTouched = /**
* @param {?} fn
* @return {?}
*/
function (fn) { };
/**
* @param {?} isDisabled
* @return {?}
*/
CustomCheckboxValuesDirective.prototype.setDisabledState = /**
* @param {?} isDisabled
* @return {?}
*/
function (isDisabled) { };
CustomCheckboxValuesDirective.decorators = [
{ type: core.Directive, args: [{
selector: '[customCheckboxValues]',
providers: [
{
provide: forms.NG_VALUE_ACCESSOR,
useExisting: core.forwardRef((/**
* @return {?}
*/
function () { return CustomCheckboxValuesDirective; })),
multi: true
}
]
},] }
];
/** @nocollapse */
CustomCheckboxValuesDirective.ctorParameters = function () { return [
{ type: core.ElementRef },
{ type: core.Renderer2 }
]; };
CustomCheckboxValuesDirective.propDecorators = {
customCheckboxValues: [{ type: core.Input }],
checkedValue: [{ type: core.Input }],
uncheckedValue: [{ type: core.Input }],
indeterminateValue: [{ type: core.Input }],
onHostChange: [{ type: core.HostListener, args: ['change', ['$event'],] }]
};
return CustomCheckboxValuesDirective;
}());
if (false) {
/**
* @type {?}
* @private
*/
CustomCheckboxValuesDirective.prototype.propagateChange;
/** @type {?} */
CustomCheckboxValuesDirective.prototype.customCheckboxValues;
/** @type {?} */
CustomCheckboxValuesDirective.prototype.checkedValue;
/** @type {?} */
CustomCheckboxValuesDirective.prototype.uncheckedValue;
/** @type {?} */
CustomCheckboxValuesDirective.prototype.indeterminateValue;
/**
* @type {?}
* @private
*/
CustomCheckboxValuesDirective.prototype.elementRef;
/**
* @type {?}
* @private
*/
CustomCheckboxValuesDirective.prototype.renderer;
}
/**
* @fileoverview added by tsickle
* Generated from: lib/custom-checkbox-values.module.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var CustomCheckboxValuesModule = /** @class */ (function () {
function CustomCheckboxValuesModule() {
}
CustomCheckboxValuesModule.decorators = [
{ type: core.NgModule, args: [{
declarations: [CustomCheckboxValuesComponent, CustomCheckboxValuesDirective],
imports: [],
exports: [CustomCheckboxValuesComponent, CustomCheckboxValuesDirective]
},] }
];
return CustomCheckboxValuesModule;
}());
exports.CustomCheckboxValuesComponent = CustomCheckboxValuesComponent;
exports.CustomCheckboxValuesDirective = CustomCheckboxValuesDirective;
exports.CustomCheckboxValuesModule = CustomCheckboxValuesModule;
exports.CustomCheckboxValuesService = CustomCheckboxValuesService;
Object.defineProperty(exports, '__esModule', { value: true });
})));
//# sourceMappingURL=ng-custom-checkbox-values.umd.js.map