UNPKG

ng-custom-checkbox-values

Version:

Custom checkbox values like strings or numbers other than default boolean

217 lines (209 loc) 7.84 kB
import { Injectable, ɵɵdefineInjectable, Component, Directive, forwardRef, ElementRef, Renderer2, Input, HostListener, NgModule } from '@angular/core'; import { NG_VALUE_ACCESSOR } from '@angular/forms'; /** * @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: Injectable, args: [{ providedIn: 'root' },] } ]; /** @nocollapse */ CustomCheckboxValuesService.ctorParameters = function () { return []; }; /** @nocollapse */ CustomCheckboxValuesService.ngInjectableDef = ɵɵ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: 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: Directive, args: [{ selector: '[customCheckboxValues]', providers: [ { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef((/** * @return {?} */ function () { return CustomCheckboxValuesDirective; })), multi: true } ] },] } ]; /** @nocollapse */ CustomCheckboxValuesDirective.ctorParameters = function () { return [ { type: ElementRef }, { type: Renderer2 } ]; }; CustomCheckboxValuesDirective.propDecorators = { customCheckboxValues: [{ type: Input }], checkedValue: [{ type: Input }], uncheckedValue: [{ type: Input }], indeterminateValue: [{ type: Input }], onHostChange: [{ type: 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: NgModule, args: [{ declarations: [CustomCheckboxValuesComponent, CustomCheckboxValuesDirective], imports: [], exports: [CustomCheckboxValuesComponent, CustomCheckboxValuesDirective] },] } ]; return CustomCheckboxValuesModule; }()); /** * @fileoverview added by tsickle * Generated from: public-api.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * Generated from: ng-custom-checkbox-values.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ export { CustomCheckboxValuesComponent, CustomCheckboxValuesDirective, CustomCheckboxValuesModule, CustomCheckboxValuesService }; //# sourceMappingURL=ng-custom-checkbox-values.js.map