jqwidgets-ng
Version:
[](https://jqwidgets.com/license/)
333 lines (328 loc) • 12.7 kB
JavaScript
import '../jqwidgets/modules/jqxprogressbar';
import * as i0 from '@angular/core';
import { EventEmitter, Component, Input, Output, NgModule } from '@angular/core';
/// <reference path="../../jqwidgets.d.ts" />
class jqxProgressBarComponent {
constructor(containerElement) {
this.autoCreate = true;
this.properties = ['animationDuration', 'colorRanges', 'disabled', 'height', 'layout', 'max', 'min', 'orientation', 'rtl', 'renderText', 'showText', 'template', 'theme', 'value', 'width'];
// jqxProgressBarComponent events
this.onComplete = new EventEmitter();
this.onInvalidValue = new EventEmitter();
this.onValueChanged = new EventEmitter();
this.elementRef = containerElement;
}
ngOnInit() {
if (this.autoCreate) {
this.createComponent();
}
}
;
ngOnChanges(changes) {
if (this.host) {
for (let i = 0; i < this.properties.length; i++) {
let attrName = 'attr' + this.properties[i].substring(0, 1).toUpperCase() + this.properties[i].substring(1);
let areEqual = false;
if (this[attrName] !== undefined) {
if (typeof this[attrName] === 'object') {
if (this[attrName] instanceof Array) {
areEqual = this.arraysEqual(this[attrName], this.host.jqxProgressBar(this.properties[i]));
}
if (areEqual) {
return false;
}
this.host.jqxProgressBar(this.properties[i], this[attrName]);
continue;
}
if (this[attrName] !== this.host.jqxProgressBar(this.properties[i])) {
this.host.jqxProgressBar(this.properties[i], this[attrName]);
}
}
}
}
}
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;
}
manageAttributes() {
let options = {};
for (let i = 0; i < this.properties.length; i++) {
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;
}
moveClasses(parentEl, childEl) {
let classes = parentEl.classList;
if (classes.length > 0) {
childEl.classList.add(...classes);
}
parentEl.className = '';
}
moveStyles(parentEl, childEl) {
let style = parentEl.style.cssText;
childEl.style.cssText = style;
parentEl.style.cssText = '';
}
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, 'jqxProgressBar', options);
}
createWidget(options) {
this.createComponent(options);
}
__updateRect__() {
if (this.host)
this.host.css({ width: this.attrWidth, height: this.attrHeight });
}
setOptions(options) {
this.host.jqxProgressBar('setOptions', options);
}
// jqxProgressBarComponent properties
animationDuration(arg) {
if (arg !== undefined) {
this.host.jqxProgressBar('animationDuration', arg);
}
else {
return this.host.jqxProgressBar('animationDuration');
}
}
colorRanges(arg) {
if (arg !== undefined) {
this.host.jqxProgressBar('colorRanges', arg);
}
else {
return this.host.jqxProgressBar('colorRanges');
}
}
disabled(arg) {
if (arg !== undefined) {
this.host.jqxProgressBar('disabled', arg);
}
else {
return this.host.jqxProgressBar('disabled');
}
}
height(arg) {
if (arg !== undefined) {
this.host.jqxProgressBar('height', arg);
}
else {
return this.host.jqxProgressBar('height');
}
}
layout(arg) {
if (arg !== undefined) {
this.host.jqxProgressBar('layout', arg);
}
else {
return this.host.jqxProgressBar('layout');
}
}
max(arg) {
if (arg !== undefined) {
this.host.jqxProgressBar('max', arg);
}
else {
return this.host.jqxProgressBar('max');
}
}
min(arg) {
if (arg !== undefined) {
this.host.jqxProgressBar('min', arg);
}
else {
return this.host.jqxProgressBar('min');
}
}
orientation(arg) {
if (arg !== undefined) {
this.host.jqxProgressBar('orientation', arg);
}
else {
return this.host.jqxProgressBar('orientation');
}
}
rtl(arg) {
if (arg !== undefined) {
this.host.jqxProgressBar('rtl', arg);
}
else {
return this.host.jqxProgressBar('rtl');
}
}
renderText(arg) {
if (arg !== undefined) {
this.host.jqxProgressBar('renderText', arg);
}
else {
return this.host.jqxProgressBar('renderText');
}
}
showText(arg) {
if (arg !== undefined) {
this.host.jqxProgressBar('showText', arg);
}
else {
return this.host.jqxProgressBar('showText');
}
}
template(arg) {
if (arg !== undefined) {
this.host.jqxProgressBar('template', arg);
}
else {
return this.host.jqxProgressBar('template');
}
}
theme(arg) {
if (arg !== undefined) {
this.host.jqxProgressBar('theme', arg);
}
else {
return this.host.jqxProgressBar('theme');
}
}
value(arg) {
if (arg !== undefined) {
this.host.jqxProgressBar('value', arg);
}
else {
return this.host.jqxProgressBar('value');
}
}
width(arg) {
if (arg !== undefined) {
this.host.jqxProgressBar('width', arg);
}
else {
return this.host.jqxProgressBar('width');
}
}
// jqxProgressBarComponent functions
actualValue(value) {
this.host.jqxProgressBar('actualValue', value);
}
destroy() {
this.host.jqxProgressBar('destroy');
}
val(value) {
if (value !== undefined) {
return this.host.jqxProgressBar('val', value);
}
else {
return this.host.jqxProgressBar('val');
}
}
;
__wireEvents__() {
this.host.on('complete', (eventData) => { this.onComplete.emit(eventData); });
this.host.on('invalidValue', (eventData) => { this.onInvalidValue.emit(eventData); });
this.host.on('valueChanged', (eventData) => { this.onValueChanged.emit(eventData); });
}
} //jqxProgressBarComponent
jqxProgressBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: jqxProgressBarComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
jqxProgressBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: jqxProgressBarComponent, selector: "jqxProgressBar", inputs: { attrAnimationDuration: ["animationDuration", "attrAnimationDuration"], attrColorRanges: ["colorRanges", "attrColorRanges"], attrDisabled: ["disabled", "attrDisabled"], attrLayout: ["layout", "attrLayout"], attrMax: ["max", "attrMax"], attrMin: ["min", "attrMin"], attrOrientation: ["orientation", "attrOrientation"], attrRtl: ["rtl", "attrRtl"], attrRenderText: ["renderText", "attrRenderText"], attrShowText: ["showText", "attrShowText"], attrTemplate: ["template", "attrTemplate"], attrTheme: ["theme", "attrTheme"], attrValue: ["value", "attrValue"], attrWidth: ["width", "attrWidth"], attrHeight: ["height", "attrHeight"], autoCreate: ["auto-create", "autoCreate"] }, outputs: { onComplete: "onComplete", onInvalidValue: "onInvalidValue", onValueChanged: "onValueChanged" }, usesOnChanges: true, ngImport: i0, template: '<div><ng-content></ng-content></div>', isInline: true });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: jqxProgressBarComponent, decorators: [{
type: Component,
args: [{
selector: 'jqxProgressBar',
template: '<div><ng-content></ng-content></div>'
}]
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { attrAnimationDuration: [{
type: Input,
args: ['animationDuration']
}], attrColorRanges: [{
type: Input,
args: ['colorRanges']
}], attrDisabled: [{
type: Input,
args: ['disabled']
}], attrLayout: [{
type: Input,
args: ['layout']
}], attrMax: [{
type: Input,
args: ['max']
}], attrMin: [{
type: Input,
args: ['min']
}], attrOrientation: [{
type: Input,
args: ['orientation']
}], attrRtl: [{
type: Input,
args: ['rtl']
}], attrRenderText: [{
type: Input,
args: ['renderText']
}], attrShowText: [{
type: Input,
args: ['showText']
}], 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']
}], onComplete: [{
type: Output
}], onInvalidValue: [{
type: Output
}], onValueChanged: [{
type: Output
}] } });
class jqxProgressBarModule {
}
jqxProgressBarModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: jqxProgressBarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
jqxProgressBarModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: jqxProgressBarModule, declarations: [jqxProgressBarComponent], exports: [jqxProgressBarComponent] });
jqxProgressBarModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: jqxProgressBarModule, imports: [[]] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: jqxProgressBarModule, decorators: [{
type: NgModule,
args: [{
imports: [],
declarations: [jqxProgressBarComponent],
exports: [jqxProgressBarComponent]
}]
}] });
/**
* Generated bundle index. Do not edit.
*/
export { jqxProgressBarComponent, jqxProgressBarModule };