UNPKG

jqwidgets-ng

Version:

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

267 lines (262 loc) 10.2 kB
import '../jqwidgets/modules/jqxlayout'; import * as i0 from '@angular/core'; import { EventEmitter, Component, Input, Output, NgModule } from '@angular/core'; /// <reference path="../../jqwidgets.d.ts" /> class jqxLayoutComponent { constructor(containerElement) { this.autoCreate = true; this.properties = ['contextMenu', 'height', 'layout', 'minGroupHeight', 'minGroupWidth', 'resizable', 'rtl', 'theme', 'width']; // jqxLayoutComponent events this.onPin = new EventEmitter(); this.onResize = new EventEmitter(); this.onUnpin = new EventEmitter(); 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.jqxLayout(this.properties[i])); } if (areEqual) { return false; } this.host.jqxLayout(this.properties[i], this[attrName]); continue; } if (this[attrName] !== this.host.jqxLayout(this.properties[i])) { this.host.jqxLayout(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, 'jqxLayout', options); } createWidget(options) { this.createComponent(options); } __updateRect__() { if (this.host) this.host.css({ width: this.attrWidth, height: this.attrHeight }); } setOptions(options) { this.host.jqxLayout('setOptions', options); } // jqxLayoutComponent properties contextMenu(arg) { if (arg !== undefined) { this.host.jqxLayout('contextMenu', arg); } else { return this.host.jqxLayout('contextMenu'); } } height(arg) { if (arg !== undefined) { this.host.jqxLayout('height', arg); } else { return this.host.jqxLayout('height'); } } layout(arg) { if (arg !== undefined) { this.host.jqxLayout('layout', arg); } else { return this.host.jqxLayout('layout'); } } minGroupHeight(arg) { if (arg !== undefined) { this.host.jqxLayout('minGroupHeight', arg); } else { return this.host.jqxLayout('minGroupHeight'); } } minGroupWidth(arg) { if (arg !== undefined) { this.host.jqxLayout('minGroupWidth', arg); } else { return this.host.jqxLayout('minGroupWidth'); } } resizable(arg) { if (arg !== undefined) { this.host.jqxLayout('resizable', arg); } else { return this.host.jqxLayout('resizable'); } } rtl(arg) { if (arg !== undefined) { this.host.jqxLayout('rtl', arg); } else { return this.host.jqxLayout('rtl'); } } theme(arg) { if (arg !== undefined) { this.host.jqxLayout('theme', arg); } else { return this.host.jqxLayout('theme'); } } width(arg) { if (arg !== undefined) { this.host.jqxLayout('width', arg); } else { return this.host.jqxLayout('width'); } } // jqxLayoutComponent functions destroy() { this.host.jqxLayout('destroy'); } loadLayout(Layout) { this.host.jqxLayout('loadLayout', Layout); } refresh() { this.host.jqxLayout('refresh'); } render() { this.host.jqxLayout('render'); } saveLayout() { return this.host.jqxLayout('saveLayout'); } __wireEvents__() { this.host.on('pin', (eventData) => { this.onPin.emit(eventData); }); this.host.on('resize', (eventData) => { this.onResize.emit(eventData); }); this.host.on('unpin', (eventData) => { this.onUnpin.emit(eventData); }); } } //jqxLayoutComponent jqxLayoutComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: jqxLayoutComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); jqxLayoutComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: jqxLayoutComponent, selector: "jqxLayout", inputs: { attrContextMenu: ["contextMenu", "attrContextMenu"], attrLayout: ["layout", "attrLayout"], attrMinGroupHeight: ["minGroupHeight", "attrMinGroupHeight"], attrMinGroupWidth: ["minGroupWidth", "attrMinGroupWidth"], attrResizable: ["resizable", "attrResizable"], attrRtl: ["rtl", "attrRtl"], attrTheme: ["theme", "attrTheme"], attrWidth: ["width", "attrWidth"], attrHeight: ["height", "attrHeight"], autoCreate: ["auto-create", "autoCreate"] }, outputs: { onPin: "onPin", onResize: "onResize", onUnpin: "onUnpin" }, 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: jqxLayoutComponent, decorators: [{ type: Component, args: [{ selector: 'jqxLayout', template: '<div><ng-content></ng-content></div>' }] }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { attrContextMenu: [{ type: Input, args: ['contextMenu'] }], attrLayout: [{ type: Input, args: ['layout'] }], attrMinGroupHeight: [{ type: Input, args: ['minGroupHeight'] }], attrMinGroupWidth: [{ type: Input, args: ['minGroupWidth'] }], attrResizable: [{ type: Input, args: ['resizable'] }], 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'] }], onPin: [{ type: Output }], onResize: [{ type: Output }], onUnpin: [{ type: Output }] } }); class jqxLayoutModule { } jqxLayoutModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: jqxLayoutModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); jqxLayoutModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: jqxLayoutModule, declarations: [jqxLayoutComponent], exports: [jqxLayoutComponent] }); jqxLayoutModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: jqxLayoutModule, imports: [[]] }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: jqxLayoutModule, decorators: [{ type: NgModule, args: [{ imports: [], declarations: [jqxLayoutComponent], exports: [jqxLayoutComponent] }] }] }); /** * Generated bundle index. Do not edit. */ export { jqxLayoutComponent, jqxLayoutModule };