UNPKG

jqwidgets-scripts-custom

Version:

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

498 lines (497 loc) 14.5 kB
import * as jqxcore from '../../jqwidgets/jqxcore'; import * as jqxbuttons from '../../jqwidgets/jqxbuttons'; import * as jqxcomplexinput from '../../jqwidgets/jqxcomplexinput'; /** * @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, forwardRef, ChangeDetectionStrategy } from '@angular/core'; import { NG_VALUE_ACCESSOR } from '@angular/forms'; /** @type {?} */ const noop = () => { }; const ɵ0 = noop; /** @type {?} */ const CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR = { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => jqxComplexInputComponent), multi: true }; export class jqxComplexInputComponent { /** * @param {?} containerElement */ constructor(containerElement) { this.autoCreate = true; this.properties = ['decimalNotation', 'disabled', 'height', 'placeHolder', 'roundedCorners', 'rtl', 'spinButtons', 'spinButtonsStep', 'template', 'theme', 'value', 'width']; this.onTouchedCallback = noop; this.onChangeCallback = noop; // jqxComplexInputComponent events this.onChange = new EventEmitter(); 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.jqxComplexInput(this.properties[i])); } if (areEqual) { return false; } this.host.jqxComplexInput(this.properties[i], this[attrName]); continue; } if (this[attrName] !== this.host.jqxComplexInput(this.properties[i])) { this.host.jqxComplexInput(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, 'jqxComplexInput', options); setTimeout(_ => { /** @type {?} */ let valueWithWS = 'JQXLite{options.value}'; this.host.jqxComplexInput({ value: valueWithWS }); }); } /** * @param {?=} options * @return {?} */ createWidget(options) { this.createComponent(options); } /** * @return {?} */ __updateRect__() { if (this.host) this.host.css({ width: this.attrWidth, height: this.attrHeight }); } /** * @return {?} */ get ngValue() { if (this.widgetObject) { /** @type {?} */ const value = this.host.val(); return value; } return ''; } /** * @param {?} value * @return {?} */ set ngValue(value) { if (this.widgetObject) { this.onChangeCallback(value); } } /** * @param {?} value * @return {?} */ writeValue(value) { if (this.widgetObject) { this.onChangeCallback(this.host.val()); this.host.jqxComplexInput('val', value); } } /** * @param {?} fn * @return {?} */ registerOnChange(fn) { this.onChangeCallback = fn; } /** * @param {?} fn * @return {?} */ registerOnTouched(fn) { this.onTouchedCallback = fn; } /** * @param {?} options * @return {?} */ setOptions(options) { this.host.jqxComplexInput('setOptions', options); } // jqxComplexInputComponent properties /** * @param {?=} arg * @return {?} */ decimalNotation(arg) { if (arg !== undefined) { this.host.jqxComplexInput('decimalNotation', arg); } else { return this.host.jqxComplexInput('decimalNotation'); } } /** * @param {?=} arg * @return {?} */ disabled(arg) { if (arg !== undefined) { this.host.jqxComplexInput('disabled', arg); } else { return this.host.jqxComplexInput('disabled'); } } /** * @param {?=} arg * @return {?} */ height(arg) { if (arg !== undefined) { this.host.jqxComplexInput('height', arg); } else { return this.host.jqxComplexInput('height'); } } /** * @param {?=} arg * @return {?} */ placeHolder(arg) { if (arg !== undefined) { this.host.jqxComplexInput('placeHolder', arg); } else { return this.host.jqxComplexInput('placeHolder'); } } /** * @param {?=} arg * @return {?} */ roundedCorners(arg) { if (arg !== undefined) { this.host.jqxComplexInput('roundedCorners', arg); } else { return this.host.jqxComplexInput('roundedCorners'); } } /** * @param {?=} arg * @return {?} */ rtl(arg) { if (arg !== undefined) { this.host.jqxComplexInput('rtl', arg); } else { return this.host.jqxComplexInput('rtl'); } } /** * @param {?=} arg * @return {?} */ spinButtons(arg) { if (arg !== undefined) { this.host.jqxComplexInput('spinButtons', arg); } else { return this.host.jqxComplexInput('spinButtons'); } } /** * @param {?=} arg * @return {?} */ spinButtonsStep(arg) { if (arg !== undefined) { this.host.jqxComplexInput('spinButtonsStep', arg); } else { return this.host.jqxComplexInput('spinButtonsStep'); } } /** * @param {?=} arg * @return {?} */ template(arg) { if (arg !== undefined) { this.host.jqxComplexInput('template', arg); } else { return this.host.jqxComplexInput('template'); } } /** * @param {?=} arg * @return {?} */ theme(arg) { if (arg !== undefined) { this.host.jqxComplexInput('theme', arg); } else { return this.host.jqxComplexInput('theme'); } } /** * @param {?=} arg * @return {?} */ value(arg) { if (arg !== undefined) { this.host.jqxComplexInput('value', arg); } else { return this.host.jqxComplexInput('value'); } } /** * @param {?=} arg * @return {?} */ width(arg) { if (arg !== undefined) { this.host.jqxComplexInput('width', arg); } else { return this.host.jqxComplexInput('width'); } } // jqxComplexInputComponent functions /** * @return {?} */ destroy() { this.host.jqxComplexInput('destroy'); } /** * @param {?=} complexnumber * @return {?} */ getReal(complexnumber) { return this.host.jqxComplexInput('getReal', complexnumber); } /** * @param {?=} complexnumber * @return {?} */ getImaginary(complexnumber) { return this.host.jqxComplexInput('getImaginary', complexnumber); } /** * @return {?} */ render() { this.host.jqxComplexInput('render'); } /** * @return {?} */ refresh() { this.host.jqxComplexInput('refresh'); } /** * @param {?=} value * @return {?} */ val(value) { if (value !== undefined) { return this.host.jqxComplexInput('val', value); } else { return this.host.jqxComplexInput('val'); } } ; /** * @return {?} */ __wireEvents__() { this.host.on('change', (eventData) => { this.onChange.emit(eventData); if (eventData.args) this.onChangeCallback(eventData.args.value); }); } } //jqxComplexInputComponent jqxComplexInputComponent.decorators = [ { type: Component, args: [{ selector: 'jqxComplexInput', template: '<div style="display: inline-flex;"><input [(ngModel)]="ngValue"><div></div></div>', providers: [CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR], changeDetection: ChangeDetectionStrategy.OnPush }] } ]; /** @nocollapse */ jqxComplexInputComponent.ctorParameters = () => [ { type: ElementRef } ]; jqxComplexInputComponent.propDecorators = { attrDecimalNotation: [{ type: Input, args: ['decimalNotation',] }], attrDisabled: [{ type: Input, args: ['disabled',] }], attrPlaceHolder: [{ type: Input, args: ['placeHolder',] }], attrRoundedCorners: [{ type: Input, args: ['roundedCorners',] }], attrRtl: [{ type: Input, args: ['rtl',] }], attrSpinButtons: [{ type: Input, args: ['spinButtons',] }], attrSpinButtonsStep: [{ type: Input, args: ['spinButtonsStep',] }], attrTemplate: [{ type: Input, args: ['template',] }], attrTheme: [{ type: Input, args: ['theme',] }], attrValue: [{ type: Input, args: ['value',] }], attrWidth: [{ type: Input, args: ['width',] }], attrHeight: [{ type: Input, args: ['height',] }], autoCreate: [{ type: Input, args: ['auto-create',] }], onChange: [{ type: Output }] }; if (false) { /** @type {?} */ jqxComplexInputComponent.prototype.attrDecimalNotation; /** @type {?} */ jqxComplexInputComponent.prototype.attrDisabled; /** @type {?} */ jqxComplexInputComponent.prototype.attrPlaceHolder; /** @type {?} */ jqxComplexInputComponent.prototype.attrRoundedCorners; /** @type {?} */ jqxComplexInputComponent.prototype.attrRtl; /** @type {?} */ jqxComplexInputComponent.prototype.attrSpinButtons; /** @type {?} */ jqxComplexInputComponent.prototype.attrSpinButtonsStep; /** @type {?} */ jqxComplexInputComponent.prototype.attrTemplate; /** @type {?} */ jqxComplexInputComponent.prototype.attrTheme; /** @type {?} */ jqxComplexInputComponent.prototype.attrValue; /** @type {?} */ jqxComplexInputComponent.prototype.attrWidth; /** @type {?} */ jqxComplexInputComponent.prototype.attrHeight; /** @type {?} */ jqxComplexInputComponent.prototype.autoCreate; /** @type {?} */ jqxComplexInputComponent.prototype.properties; /** @type {?} */ jqxComplexInputComponent.prototype.host; /** @type {?} */ jqxComplexInputComponent.prototype.elementRef; /** @type {?} */ jqxComplexInputComponent.prototype.widgetObject; /** * @type {?} * @private */ jqxComplexInputComponent.prototype.onTouchedCallback; /** * @type {?} * @private */ jqxComplexInputComponent.prototype.onChangeCallback; /** @type {?} */ jqxComplexInputComponent.prototype.onChange; /* Skipping unhandled member: ;*/ /* Skipping unhandled member: ;*/ } export { ɵ0 };