jqwidgets-scripts-custom
Version:
jQWidgets is an advanced jQuery, Angular 7, Vue, React, ASP .NET MVC, Custom Elements and HTML5 UI framework.
364 lines (363 loc) • 11 kB
JavaScript
import * as jqxcore from '../../jqwidgets/jqxcore';
import * as globalize from '../../jqwidgets/globalization/globalize';
import * as jqxdata from '../../jqwidgets/jqxdata';
import * as jqxinput from '../../jqwidgets/jqxinput';
import * as jqxpasswordinput from '../../jqwidgets/jqxpasswordinput';
import * as jqxnumberinput from '../../jqwidgets/jqxnumberinput';
import * as jqxradiobutton from '../../jqwidgets/jqxradiobutton';
import * as jqxcheckbox from '../../jqwidgets/jqxcheckbox';
import * as jqxbuttons from '../../jqwidgets/jqxbuttons';
import * as jqxscrollbar from '../../jqwidgets/jqxscrollbar';
import * as jqxlistbox from '../../jqwidgets/jqxlistbox';
import * as jqxdropdownlist from '../../jqwidgets/jqxdropdownlist';
import * as jqxcombobox from '../../jqwidgets/jqxcombobox';
import * as jqxmaskedinput from '../../jqwidgets/jqxmaskedinput';
import * as jqxcalendar from '../../jqwidgets/jqxcalendar';
import * as jqxdatetimeinput from '../../jqwidgets/jqxdatetimeinput';
import * as jqxform from '../../jqwidgets/jqxform';
/**
* @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, Output, EventEmitter, ElementRef } from '@angular/core';
export class jqxFormComponent {
/**
* @param {?} containerElement
*/
constructor(containerElement) {
this.autoCreate = true;
this.properties = ['padding', 'backgroundColor', 'borderColor', 'value', 'template'];
// jqxFormComponent events
this.onFormDataChange = new EventEmitter();
this.onButtonClick = new EventEmitter();
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.jqxForm(this.properties[i]));
}
if (areEqual) {
return false;
}
this.host.jqxForm(this.properties[i], this[attrName]);
continue;
}
if (this[attrName] !== this.host.jqxForm(this.properties[i])) {
this.host.jqxForm(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, 'jqxForm', 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.jqxForm('setOptions', options);
}
// jqxFormComponent properties
/**
* @param {?=} arg
* @return {?}
*/
padding(arg) {
if (arg !== undefined) {
this.host.jqxForm('padding', arg);
}
else {
return this.host.jqxForm('padding');
}
}
/**
* @param {?=} arg
* @return {?}
*/
backgroundColor(arg) {
if (arg !== undefined) {
this.host.jqxForm('backgroundColor', arg);
}
else {
return this.host.jqxForm('backgroundColor');
}
}
/**
* @param {?=} arg
* @return {?}
*/
borderColor(arg) {
if (arg !== undefined) {
this.host.jqxForm('borderColor', arg);
}
else {
return this.host.jqxForm('borderColor');
}
}
/**
* @param {?=} arg
* @return {?}
*/
value(arg) {
if (arg !== undefined) {
this.host.jqxForm('value', arg);
}
else {
return this.host.jqxForm('value');
}
}
/**
* @param {?=} arg
* @return {?}
*/
template(arg) {
if (arg !== undefined) {
this.host.jqxForm('template', arg);
}
else {
return this.host.jqxForm('template');
}
}
// jqxFormComponent functions
/**
* @return {?}
*/
getInstance() {
return this.host.jqxForm('getInstance');
}
/**
* @return {?}
*/
refresh() {
this.host.jqxForm('refresh');
}
/**
* @return {?}
*/
destroy() {
this.host.jqxForm('destroy');
}
/**
* @param {?} name
* @return {?}
*/
hideComponent(name) {
this.host.jqxForm('hideComponent', name);
}
/**
* @param {?} name
* @return {?}
*/
showComponent(name) {
this.host.jqxForm('showComponent', name);
}
/**
* @param {?=} value
* @return {?}
*/
val(value) {
if (value !== undefined) {
return this.host.jqxForm('val', value);
}
else {
return this.host.jqxForm('val');
}
}
;
/**
* @param {?=} action
* @param {?=} target
* @param {?=} method
* @return {?}
*/
submit(action, target, method) {
this.host.jqxForm('submit', action, target, method);
}
/**
* @param {?=} name
* @return {?}
*/
getComponentByName(name) {
return this.host.jqxForm('getComponentByName', name);
}
/**
* @return {?}
*/
__wireEvents__() {
this.host.on('formDataChange', (eventData) => { this.onFormDataChange.emit(eventData); });
this.host.on('buttonClick', (eventData) => { this.onButtonClick.emit(eventData); });
}
} //jqxFormComponent
jqxFormComponent.decorators = [
{ type: Component, args: [{
selector: 'jqxForm',
template: '<div><ng-content></ng-content></div>'
}] }
];
/** @nocollapse */
jqxFormComponent.ctorParameters = () => [
{ type: ElementRef }
];
jqxFormComponent.propDecorators = {
attrPadding: [{ type: Input, args: ['padding',] }],
attrBackgroundColor: [{ type: Input, args: ['backgroundColor',] }],
attrBorderColor: [{ type: Input, args: ['borderColor',] }],
attrValue: [{ type: Input, args: ['value',] }],
attrTemplate: [{ type: Input, args: ['template',] }],
attrWidth: [{ type: Input, args: ['width',] }],
attrHeight: [{ type: Input, args: ['height',] }],
autoCreate: [{ type: Input, args: ['auto-create',] }],
onFormDataChange: [{ type: Output }],
onButtonClick: [{ type: Output }]
};
if (false) {
/** @type {?} */
jqxFormComponent.prototype.attrPadding;
/** @type {?} */
jqxFormComponent.prototype.attrBackgroundColor;
/** @type {?} */
jqxFormComponent.prototype.attrBorderColor;
/** @type {?} */
jqxFormComponent.prototype.attrValue;
/** @type {?} */
jqxFormComponent.prototype.attrTemplate;
/** @type {?} */
jqxFormComponent.prototype.attrWidth;
/** @type {?} */
jqxFormComponent.prototype.attrHeight;
/** @type {?} */
jqxFormComponent.prototype.autoCreate;
/** @type {?} */
jqxFormComponent.prototype.properties;
/** @type {?} */
jqxFormComponent.prototype.host;
/** @type {?} */
jqxFormComponent.prototype.elementRef;
/** @type {?} */
jqxFormComponent.prototype.widgetObject;
/** @type {?} */
jqxFormComponent.prototype.onFormDataChange;
/** @type {?} */
jqxFormComponent.prototype.onButtonClick;
/* Skipping unhandled member: ;*/
/* Skipping unhandled member: ;*/
}