UNPKG

jqwidgets-scripts-custom

Version:

jQWidgets is an advanced jQuery, Angular 7, Vue, React, ASP .NET MVC, Custom Elements and HTML5 UI framework.

354 lines (353 loc) 10 kB
import * as jqxcore from '../../jqwidgets/jqxcore'; import * as jqxloader from '../../jqwidgets/jqxloader'; /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /// <reference path="../../jqwidgets.d.ts" /> /// <reference path="../../jqwidgets.d.ts" /> import { Component, Input, ElementRef } from '@angular/core'; export class jqxLoaderComponent { /** * @param {?} containerElement */ constructor(containerElement) { this.autoCreate = true; this.properties = ['autoOpen', 'height', 'html', 'isModal', 'imagePosition', 'rtl', 'text', 'textPosition', 'theme', 'width']; this.elementRef = containerElement; } /** * @return {?} */ ngOnInit() { if (this.autoCreate) { this.createComponent(); } } ; /** * @param {?} changes * @return {?} */ ngOnChanges(changes) { if (this.host) { for (let i = 0; i < this.properties.length; i++) { /** @type {?} */ let attrName = 'attr' + this.properties[i].substring(0, 1).toUpperCase() + this.properties[i].substring(1); /** @type {?} */ let areEqual = false; if (this[attrName] !== undefined) { if (typeof this[attrName] === 'object') { if (this[attrName] instanceof Array) { areEqual = this.arraysEqual(this[attrName], this.host.jqxLoader(this.properties[i])); } if (areEqual) { return false; } this.host.jqxLoader(this.properties[i], this[attrName]); continue; } if (this[attrName] !== this.host.jqxLoader(this.properties[i])) { this.host.jqxLoader(this.properties[i], this[attrName]); } } } } } /** * @param {?} attrValue * @param {?} hostValue * @return {?} */ 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; } /** * @return {?} */ manageAttributes() { /** @type {?} */ let options = {}; for (let i = 0; i < this.properties.length; i++) { /** @type {?} */ 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; } /** * @param {?} parentEl * @param {?} childEl * @return {?} */ moveClasses(parentEl, childEl) { /** @type {?} */ let classes = parentEl.classList; if (classes.length > 0) { childEl.classList.add(...classes); } parentEl.className = ''; } /** * @param {?} parentEl * @param {?} childEl * @return {?} */ moveStyles(parentEl, childEl) { /** @type {?} */ let style = parentEl.style.cssText; childEl.style.cssText = style; parentEl.style.cssText = ''; } /** * @param {?=} options * @return {?} */ 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, 'jqxLoader', options); } /** * @param {?=} options * @return {?} */ createWidget(options) { this.createComponent(options); } /** * @return {?} */ __updateRect__() { if (this.host) this.host.css({ width: this.attrWidth, height: this.attrHeight }); } /** * @param {?} options * @return {?} */ setOptions(options) { this.host.jqxLoader('setOptions', options); } // jqxLoaderComponent properties /** * @param {?=} arg * @return {?} */ autoOpen(arg) { if (arg !== undefined) { this.host.jqxLoader('autoOpen', arg); } else { return this.host.jqxLoader('autoOpen'); } } /** * @param {?=} arg * @return {?} */ height(arg) { if (arg !== undefined) { this.host.jqxLoader('height', arg); } else { return this.host.jqxLoader('height'); } } /** * @param {?=} arg * @return {?} */ html(arg) { if (arg !== undefined) { this.host.jqxLoader('html', arg); } else { return this.host.jqxLoader('html'); } } /** * @param {?=} arg * @return {?} */ isModal(arg) { if (arg !== undefined) { this.host.jqxLoader('isModal', arg); } else { return this.host.jqxLoader('isModal'); } } /** * @param {?=} arg * @return {?} */ imagePosition(arg) { if (arg !== undefined) { this.host.jqxLoader('imagePosition', arg); } else { return this.host.jqxLoader('imagePosition'); } } /** * @param {?=} arg * @return {?} */ rtl(arg) { if (arg !== undefined) { this.host.jqxLoader('rtl', arg); } else { return this.host.jqxLoader('rtl'); } } /** * @param {?=} arg * @return {?} */ text(arg) { if (arg !== undefined) { this.host.jqxLoader('text', arg); } else { return this.host.jqxLoader('text'); } } /** * @param {?=} arg * @return {?} */ textPosition(arg) { if (arg !== undefined) { this.host.jqxLoader('textPosition', arg); } else { return this.host.jqxLoader('textPosition'); } } /** * @param {?=} arg * @return {?} */ theme(arg) { if (arg !== undefined) { this.host.jqxLoader('theme', arg); } else { return this.host.jqxLoader('theme'); } } /** * @param {?=} arg * @return {?} */ width(arg) { if (arg !== undefined) { this.host.jqxLoader('width', arg); } else { return this.host.jqxLoader('width'); } } // jqxLoaderComponent functions /** * @return {?} */ close() { this.host.jqxLoader('close'); } /** * @param {?=} left * @param {?=} top * @return {?} */ open(left, top) { this.host.jqxLoader('open', left, top); } /** * @return {?} */ __wireEvents__() { } } //jqxLoaderComponent jqxLoaderComponent.decorators = [ { type: Component, args: [{ selector: 'jqxLoader', template: '<div><ng-content></ng-content></div>' }] } ]; /** @nocollapse */ jqxLoaderComponent.ctorParameters = () => [ { type: ElementRef } ]; jqxLoaderComponent.propDecorators = { attrAutoOpen: [{ type: Input, args: ['autoOpen',] }], attrHtml: [{ type: Input, args: ['html',] }], attrIsModal: [{ type: Input, args: ['isModal',] }], attrImagePosition: [{ type: Input, args: ['imagePosition',] }], attrRtl: [{ type: Input, args: ['rtl',] }], attrText: [{ type: Input, args: ['text',] }], attrTextPosition: [{ type: Input, args: ['textPosition',] }], attrTheme: [{ type: Input, args: ['theme',] }], attrWidth: [{ type: Input, args: ['width',] }], attrHeight: [{ type: Input, args: ['height',] }], autoCreate: [{ type: Input, args: ['auto-create',] }] }; if (false) { /** @type {?} */ jqxLoaderComponent.prototype.attrAutoOpen; /** @type {?} */ jqxLoaderComponent.prototype.attrHtml; /** @type {?} */ jqxLoaderComponent.prototype.attrIsModal; /** @type {?} */ jqxLoaderComponent.prototype.attrImagePosition; /** @type {?} */ jqxLoaderComponent.prototype.attrRtl; /** @type {?} */ jqxLoaderComponent.prototype.attrText; /** @type {?} */ jqxLoaderComponent.prototype.attrTextPosition; /** @type {?} */ jqxLoaderComponent.prototype.attrTheme; /** @type {?} */ jqxLoaderComponent.prototype.attrWidth; /** @type {?} */ jqxLoaderComponent.prototype.attrHeight; /** @type {?} */ jqxLoaderComponent.prototype.autoCreate; /** @type {?} */ jqxLoaderComponent.prototype.properties; /** @type {?} */ jqxLoaderComponent.prototype.host; /** @type {?} */ jqxLoaderComponent.prototype.elementRef; /** @type {?} */ jqxLoaderComponent.prototype.widgetObject; /* Skipping unhandled member: ;*/ }