UNPKG

jqwidgets-ng

Version:

[![Price](https://img.shields.io/badge/price-COMMERCIAL-0098f7.svg)](https://jqwidgets.com/license/)

291 lines (286 loc) 10.8 kB
import '../jqwidgets/modules/jqxcheckboxgroup'; import * as i0 from '@angular/core'; import { Component, Input, NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; /// <reference path="../../jqwidgets.d.ts" /> class jqxCheckBoxGroupComponent { constructor(containerElement) { this.autoCreate = true; this.properties = ['change', 'disabled', 'items', 'value', 'layout', 'labelPosition', 'rtl', 'theme']; this.elementRef = containerElement; } ngOnInit() { if (this.autoCreate) { this.createComponent(); } } ; ngOnChanges(changes) { if (this.host) { for (let i = 0; i < this.properties.length; i++) { let attrName = 'attr' + this.properties[i].substring(0, 1).toUpperCase() + this.properties[i].substring(1); let areEqual = false; if (this[attrName] !== undefined) { if (typeof this[attrName] === 'object') { if (this[attrName] instanceof Array) { areEqual = this.arraysEqual(this[attrName], this.host.jqxCheckBoxGroup(this.properties[i])); } if (areEqual) { return false; } this.host.jqxCheckBoxGroup(this.properties[i], this[attrName]); continue; } if (this[attrName] !== this.host.jqxCheckBoxGroup(this.properties[i])) { this.host.jqxCheckBoxGroup(this.properties[i], this[attrName]); } } } } } arraysEqual(attrValue, hostValue) { if ((attrValue && !hostValue) || (!attrValue && hostValue)) { return false; } if (attrValue.length != hostValue.length) { return false; } for (let i = 0; i < attrValue.length; i++) { if (attrValue[i] !== hostValue[i]) { return false; } } return true; } manageAttributes() { let options = {}; for (let i = 0; i < this.properties.length; i++) { let attrName = 'attr' + this.properties[i].substring(0, 1).toUpperCase() + this.properties[i].substring(1); if (this[attrName] !== undefined) { options[this.properties[i]] = this[attrName]; } } return options; } moveClasses(parentEl, childEl) { let classes = parentEl.classList; if (classes.length > 0) { childEl.classList.add(...classes); } parentEl.className = ''; } moveStyles(parentEl, childEl) { let style = parentEl.style.cssText; childEl.style.cssText = style; parentEl.style.cssText = ''; } createComponent(options) { if (this.host) { return; } if (options) { JQXLite.extend(options, this.manageAttributes()); } else { options = this.manageAttributes(); } this.host = JQXLite(this.elementRef.nativeElement.firstChild); this.moveClasses(this.elementRef.nativeElement, this.host[0]); this.moveStyles(this.elementRef.nativeElement, this.host[0]); this.__wireEvents__(); this.widgetObject = jqwidgets.createInstance(this.host, 'jqxCheckBoxGroup', options); } createWidget(options) { this.createComponent(options); } __updateRect__() { if (this.host) this.host.css({ width: this.attrWidth, height: this.attrHeight }); } setOptions(options) { this.host.jqxCheckBoxGroup('setOptions', options); } // jqxCheckBoxGroupComponent properties change(arg) { if (arg !== undefined) { this.host.jqxCheckBoxGroup('change', arg); } else { return this.host.jqxCheckBoxGroup('change'); } } disabled(arg) { if (arg !== undefined) { this.host.jqxCheckBoxGroup('disabled', arg); } else { return this.host.jqxCheckBoxGroup('disabled'); } } items(arg) { if (arg !== undefined) { this.host.jqxCheckBoxGroup('items', arg); } else { return this.host.jqxCheckBoxGroup('items'); } } value(arg) { if (arg !== undefined) { this.host.jqxCheckBoxGroup('value', arg); } else { return this.host.jqxCheckBoxGroup('value'); } } layout(arg) { if (arg !== undefined) { this.host.jqxCheckBoxGroup('layout', arg); } else { return this.host.jqxCheckBoxGroup('layout'); } } labelPosition(arg) { if (arg !== undefined) { this.host.jqxCheckBoxGroup('labelPosition', arg); } else { return this.host.jqxCheckBoxGroup('labelPosition'); } } rtl(arg) { if (arg !== undefined) { this.host.jqxCheckBoxGroup('rtl', arg); } else { return this.host.jqxCheckBoxGroup('rtl'); } } theme(arg) { if (arg !== undefined) { this.host.jqxCheckBoxGroup('theme', arg); } else { return this.host.jqxCheckBoxGroup('theme'); } } // jqxCheckBoxGroupComponent functions getValue() { return this.host.jqxCheckBoxGroup('getValue'); } getValueAt(index) { return this.host.jqxCheckBoxGroup('getValueAt', index); } enableAt(index) { this.host.jqxCheckBoxGroup('enableAt', index); } disableAt(index) { this.host.jqxCheckBoxGroup('disableAt', index); } checkAt(index) { this.host.jqxCheckBoxGroup('checkAt', index); } uncheckAt(index) { this.host.jqxCheckBoxGroup('uncheckAt', index); } uncheckAll() { this.host.jqxCheckBoxGroup('uncheckAll'); } checkAll() { this.host.jqxCheckBoxGroup('checkAll'); } checkValue(value) { this.host.jqxCheckBoxGroup('checkValue', value); } uncheckValue(value) { this.host.jqxCheckBoxGroup('uncheckValue', value); } disable() { this.host.jqxCheckBoxGroup('disable'); } destroy() { this.host.jqxCheckBoxGroup('destroy'); } enable() { this.host.jqxCheckBoxGroup('enable'); } render() { this.host.jqxCheckBoxGroup('render'); } val(value) { if (value !== undefined) { return this.host.jqxCheckBoxGroup('val', value); } else { return this.host.jqxCheckBoxGroup('val'); } } ; // jqxCheckBoxGroupComponent events __wireEvents__() { } } //jqxCheckBoxGroupComponent jqxCheckBoxGroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: jqxCheckBoxGroupComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); jqxCheckBoxGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: jqxCheckBoxGroupComponent, selector: "jqxCheckBoxGroup", inputs: { attrChange: ["change", "attrChange"], attrDisabled: ["disabled", "attrDisabled"], attrItems: ["items", "attrItems"], attrValue: ["value", "attrValue"], attrLayout: ["layout", "attrLayout"], attrLabelPosition: ["labelPosition", "attrLabelPosition"], attrRtl: ["rtl", "attrRtl"], attrTheme: ["theme", "attrTheme"], attrWidth: ["width", "attrWidth"], attrHeight: ["height", "attrHeight"], autoCreate: ["auto-create", "autoCreate"] }, usesOnChanges: true, ngImport: i0, template: '<div><ng-content></ng-content></div>', isInline: true }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: jqxCheckBoxGroupComponent, decorators: [{ type: Component, args: [{ selector: 'jqxCheckBoxGroup', template: '<div><ng-content></ng-content></div>' }] }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { attrChange: [{ type: Input, args: ['change'] }], attrDisabled: [{ type: Input, args: ['disabled'] }], attrItems: [{ type: Input, args: ['items'] }], attrValue: [{ type: Input, args: ['value'] }], attrLayout: [{ type: Input, args: ['layout'] }], attrLabelPosition: [{ type: Input, args: ['labelPosition'] }], attrRtl: [{ type: Input, args: ['rtl'] }], attrTheme: [{ type: Input, args: ['theme'] }], attrWidth: [{ type: Input, args: ['width'] }], attrHeight: [{ type: Input, args: ['height'] }], autoCreate: [{ type: Input, args: ['auto-create'] }] } }); class jqxCheckBoxGroupModule { } jqxCheckBoxGroupModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: jqxCheckBoxGroupModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); jqxCheckBoxGroupModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: jqxCheckBoxGroupModule, declarations: [jqxCheckBoxGroupComponent], imports: [FormsModule], exports: [jqxCheckBoxGroupComponent] }); jqxCheckBoxGroupModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: jqxCheckBoxGroupModule, imports: [[ FormsModule ]] }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: jqxCheckBoxGroupModule, decorators: [{ type: NgModule, args: [{ imports: [ FormsModule ], declarations: [jqxCheckBoxGroupComponent], exports: [jqxCheckBoxGroupComponent] }] }] }); /** * Generated bundle index. Do not edit. */ export { jqxCheckBoxGroupComponent, jqxCheckBoxGroupModule };