jqwidgets-scripts-custom
Version:
jQWidgets is an advanced jQuery, Angular 7, Vue, React, ASP .NET MVC, Custom Elements and HTML5 UI framework.
501 lines (500 loc) • 14.8 kB
JavaScript
import * as jqxcore from '../../jqwidgets/jqxcore';
import * as jqxtooltip from '../../jqwidgets/jqxtooltip';
import * as jqxpasswordinput from '../../jqwidgets/jqxpasswordinput';
/**
* @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(() => jqxPasswordInputComponent),
multi: true
};
export class jqxPasswordInputComponent {
/**
* @param {?} containerElement
*/
constructor(containerElement) {
this.autoCreate = true;
this.properties = ['disabled', 'height', 'localization', 'maxLength', 'placeHolder', 'passwordStrength', 'rtl', 'strengthColors', 'showStrength', 'showStrengthPosition', 'strengthTypeRenderer', 'showPasswordIcon', 'theme', 'width'];
this.onTouchedCallback = noop;
this.onChangeCallback = noop;
// jqxPasswordInputComponent 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.jqxPasswordInput(this.properties[i]));
}
if (areEqual) {
return false;
}
this.host.jqxPasswordInput(this.properties[i], this[attrName]);
continue;
}
if (this[attrName] !== this.host.jqxPasswordInput(this.properties[i])) {
this.host.jqxPasswordInput(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, 'jqxPasswordInput', options);
}
/**
* @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.host.jqxPasswordInput('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.jqxPasswordInput('setOptions', options);
}
// jqxPasswordInputComponent properties
/**
* @param {?=} arg
* @return {?}
*/
disabled(arg) {
if (arg !== undefined) {
this.host.jqxPasswordInput('disabled', arg);
}
else {
return this.host.jqxPasswordInput('disabled');
}
}
/**
* @param {?=} arg
* @return {?}
*/
height(arg) {
if (arg !== undefined) {
this.host.jqxPasswordInput('height', arg);
}
else {
return this.host.jqxPasswordInput('height');
}
}
/**
* @param {?=} arg
* @return {?}
*/
localization(arg) {
if (arg !== undefined) {
this.host.jqxPasswordInput('localization', arg);
}
else {
return this.host.jqxPasswordInput('localization');
}
}
/**
* @param {?=} arg
* @return {?}
*/
maxLength(arg) {
if (arg !== undefined) {
this.host.jqxPasswordInput('maxLength', arg);
}
else {
return this.host.jqxPasswordInput('maxLength');
}
}
/**
* @param {?=} arg
* @return {?}
*/
placeHolder(arg) {
if (arg !== undefined) {
this.host.jqxPasswordInput('placeHolder', arg);
}
else {
return this.host.jqxPasswordInput('placeHolder');
}
}
/**
* @param {?=} arg
* @return {?}
*/
passwordStrength(arg) {
if (arg !== undefined) {
this.host.jqxPasswordInput('passwordStrength', arg);
}
else {
return this.host.jqxPasswordInput('passwordStrength');
}
}
/**
* @param {?=} arg
* @return {?}
*/
rtl(arg) {
if (arg !== undefined) {
this.host.jqxPasswordInput('rtl', arg);
}
else {
return this.host.jqxPasswordInput('rtl');
}
}
/**
* @param {?=} arg
* @return {?}
*/
strengthColors(arg) {
if (arg !== undefined) {
this.host.jqxPasswordInput('strengthColors', arg);
}
else {
return this.host.jqxPasswordInput('strengthColors');
}
}
/**
* @param {?=} arg
* @return {?}
*/
showStrength(arg) {
if (arg !== undefined) {
this.host.jqxPasswordInput('showStrength', arg);
}
else {
return this.host.jqxPasswordInput('showStrength');
}
}
/**
* @param {?=} arg
* @return {?}
*/
showStrengthPosition(arg) {
if (arg !== undefined) {
this.host.jqxPasswordInput('showStrengthPosition', arg);
}
else {
return this.host.jqxPasswordInput('showStrengthPosition');
}
}
/**
* @param {?=} arg
* @return {?}
*/
strengthTypeRenderer(arg) {
if (arg !== undefined) {
this.host.jqxPasswordInput('strengthTypeRenderer', arg);
}
else {
return this.host.jqxPasswordInput('strengthTypeRenderer');
}
}
/**
* @param {?=} arg
* @return {?}
*/
showPasswordIcon(arg) {
if (arg !== undefined) {
this.host.jqxPasswordInput('showPasswordIcon', arg);
}
else {
return this.host.jqxPasswordInput('showPasswordIcon');
}
}
/**
* @param {?=} arg
* @return {?}
*/
theme(arg) {
if (arg !== undefined) {
this.host.jqxPasswordInput('theme', arg);
}
else {
return this.host.jqxPasswordInput('theme');
}
}
/**
* @param {?=} arg
* @return {?}
*/
width(arg) {
if (arg !== undefined) {
this.host.jqxPasswordInput('width', arg);
}
else {
return this.host.jqxPasswordInput('width');
}
}
// jqxPasswordInputComponent functions
/**
* @return {?}
*/
render() {
this.host.jqxPasswordInput('render');
}
/**
* @return {?}
*/
refresh() {
this.host.jqxPasswordInput('refresh');
}
/**
* @param {?=} value
* @return {?}
*/
val(value) {
if (value !== undefined) {
return this.host.jqxPasswordInput('val', value);
}
else {
return this.host.jqxPasswordInput('val');
}
}
;
/**
* @return {?}
*/
__wireEvents__() {
this.host.on('change', (eventData) => { this.onChange.emit(eventData); });
}
} //jqxPasswordInputComponent
jqxPasswordInputComponent.decorators = [
{ type: Component, args: [{
selector: 'jqxPasswordInput',
template: '<input type="password" [(ngModel)]="ngValue">',
providers: [CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR],
changeDetection: ChangeDetectionStrategy.OnPush
}] }
];
/** @nocollapse */
jqxPasswordInputComponent.ctorParameters = () => [
{ type: ElementRef }
];
jqxPasswordInputComponent.propDecorators = {
attrDisabled: [{ type: Input, args: ['disabled',] }],
attrLocalization: [{ type: Input, args: ['localization',] }],
attrMaxLength: [{ type: Input, args: ['maxLength',] }],
attrPlaceHolder: [{ type: Input, args: ['placeHolder',] }],
attrPasswordStrength: [{ type: Input, args: ['passwordStrength',] }],
attrRtl: [{ type: Input, args: ['rtl',] }],
attrStrengthColors: [{ type: Input, args: ['strengthColors',] }],
attrShowStrength: [{ type: Input, args: ['showStrength',] }],
attrShowStrengthPosition: [{ type: Input, args: ['showStrengthPosition',] }],
attrStrengthTypeRenderer: [{ type: Input, args: ['strengthTypeRenderer',] }],
attrShowPasswordIcon: [{ type: Input, args: ['showPasswordIcon',] }],
attrTheme: [{ type: Input, args: ['theme',] }],
attrWidth: [{ type: Input, args: ['width',] }],
attrHeight: [{ type: Input, args: ['height',] }],
autoCreate: [{ type: Input, args: ['auto-create',] }],
onChange: [{ type: Output }]
};
if (false) {
/** @type {?} */
jqxPasswordInputComponent.prototype.attrDisabled;
/** @type {?} */
jqxPasswordInputComponent.prototype.attrLocalization;
/** @type {?} */
jqxPasswordInputComponent.prototype.attrMaxLength;
/** @type {?} */
jqxPasswordInputComponent.prototype.attrPlaceHolder;
/** @type {?} */
jqxPasswordInputComponent.prototype.attrPasswordStrength;
/** @type {?} */
jqxPasswordInputComponent.prototype.attrRtl;
/** @type {?} */
jqxPasswordInputComponent.prototype.attrStrengthColors;
/** @type {?} */
jqxPasswordInputComponent.prototype.attrShowStrength;
/** @type {?} */
jqxPasswordInputComponent.prototype.attrShowStrengthPosition;
/** @type {?} */
jqxPasswordInputComponent.prototype.attrStrengthTypeRenderer;
/** @type {?} */
jqxPasswordInputComponent.prototype.attrShowPasswordIcon;
/** @type {?} */
jqxPasswordInputComponent.prototype.attrTheme;
/** @type {?} */
jqxPasswordInputComponent.prototype.attrWidth;
/** @type {?} */
jqxPasswordInputComponent.prototype.attrHeight;
/** @type {?} */
jqxPasswordInputComponent.prototype.autoCreate;
/** @type {?} */
jqxPasswordInputComponent.prototype.properties;
/** @type {?} */
jqxPasswordInputComponent.prototype.host;
/** @type {?} */
jqxPasswordInputComponent.prototype.elementRef;
/** @type {?} */
jqxPasswordInputComponent.prototype.widgetObject;
/**
* @type {?}
* @private
*/
jqxPasswordInputComponent.prototype.onTouchedCallback;
/**
* @type {?}
* @private
*/
jqxPasswordInputComponent.prototype.onChangeCallback;
/** @type {?} */
jqxPasswordInputComponent.prototype.onChange;
/* Skipping unhandled member: ;*/
/* Skipping unhandled member: ;*/
}
export { ɵ0 };