jqwidgets-scripts-custom
Version:
jQWidgets is an advanced jQuery, Angular 7, Vue, React, ASP .NET MVC, Custom Elements and HTML5 UI framework.
237 lines (236 loc) • 7.22 kB
JavaScript
import * as jqxcore from '../../jqwidgets/jqxcore';
/**
* @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 jqxPivotDesignerComponent {
/**
* @param {?} containerElement
*/
constructor(containerElement) {
this.autoCreate = true;
this.properties = ['type', 'target'];
this.elementRef = containerElement;
JQXLite(window).resize(() => {
this.__updateRect__();
});
}
/**
* @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.jqxPivotDesigner(this.properties[i]));
}
if (areEqual) {
return false;
}
this.host.jqxPivotDesigner(this.properties[i], this[attrName]);
continue;
}
if (this[attrName] !== this.host.jqxPivotDesigner(this.properties[i])) {
this.host.jqxPivotDesigner(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, 'jqxPivotDesigner', options);
this.__updateRect__();
}
/**
* @param {?=} options
* @return {?}
*/
createWidget(options) {
this.createComponent(options);
}
/**
* @return {?}
*/
__updateRect__() {
if (this.host)
this.host.css({ width: this.attrWidth, height: this.attrHeight });
this.refresh();
}
/**
* @param {?} options
* @return {?}
*/
setOptions(options) {
this.host.jqxPivotDesigner('setOptions', options);
}
// jqxPivotDesignerComponent properties
/**
* @param {?=} arg
* @return {?}
*/
type(arg) {
if (arg !== undefined) {
this.host.jqxPivotDesigner('type', arg);
}
else {
return this.host.jqxPivotDesigner('type');
}
}
/**
* @param {?=} arg
* @return {?}
*/
target(arg) {
if (arg !== undefined) {
this.host.jqxPivotDesigner('target', arg);
}
else {
return this.host.jqxPivotDesigner('target');
}
}
// jqxPivotDesignerComponent functions
/**
* @return {?}
*/
refresh() {
this.host.jqxPivotDesigner('refresh');
}
// jqxPivotDesignerComponent events
/**
* @return {?}
*/
__wireEvents__() {
}
} //jqxPivotDesignerComponent
jqxPivotDesignerComponent.decorators = [
{ type: Component, args: [{
selector: 'jqxPivotDesigner',
template: '<div><ng-content></ng-content></div>'
}] }
];
/** @nocollapse */
jqxPivotDesignerComponent.ctorParameters = () => [
{ type: ElementRef }
];
jqxPivotDesignerComponent.propDecorators = {
attrType: [{ type: Input, args: ['type',] }],
attrTarget: [{ type: Input, args: ['target',] }],
attrWidth: [{ type: Input, args: ['width',] }],
attrHeight: [{ type: Input, args: ['height',] }],
autoCreate: [{ type: Input, args: ['auto-create',] }]
};
if (false) {
/** @type {?} */
jqxPivotDesignerComponent.prototype.attrType;
/** @type {?} */
jqxPivotDesignerComponent.prototype.attrTarget;
/** @type {?} */
jqxPivotDesignerComponent.prototype.attrWidth;
/** @type {?} */
jqxPivotDesignerComponent.prototype.attrHeight;
/** @type {?} */
jqxPivotDesignerComponent.prototype.autoCreate;
/** @type {?} */
jqxPivotDesignerComponent.prototype.properties;
/** @type {?} */
jqxPivotDesignerComponent.prototype.host;
/** @type {?} */
jqxPivotDesignerComponent.prototype.elementRef;
/** @type {?} */
jqxPivotDesignerComponent.prototype.widgetObject;
/* Skipping unhandled member: ;*/
}