jqwidgets-framework
Version:
jQWidgets is an advanced Angular, Vue, Blazor, React, Web Components, jquery, ASP .NET MVC, Custom Elements and HTML5 UI framework.
389 lines (330 loc) • 11.2 kB
text/typescript
/*
jQWidgets v22.0.0 (2025-Jan)
Copyright (c) 2011-2025 jQWidgets.
License: https://jqwidgets.com/license/
*/
/* eslint-disable */
/// <reference path="jqwidgets.d.ts" />
import '../jqwidgets/jqxcore.js';
import '../jqwidgets/jqxdraw.js';
import '../jqwidgets/jqxgauge.js';
import { Component, Input, Output, EventEmitter, ElementRef, OnChanges, SimpleChanges } from '@angular/core';
declare let JQXLite: any;
export class jqxGaugeComponent implements OnChanges
{
attrAnimationDuration: string | number;
attrBorder: jqwidgets.GaugeBorder;
attrCaption: jqwidgets.GaugeCaption;
attrCap: jqwidgets.GaugeCap;
attrColorScheme: string;
attrDisabled: boolean;
attrEasing: string;
attrEndAngle: number | string;
attrInt64: boolean;
attrLabels: jqwidgets.GaugeLabels;
attrMin: number;
attrMax: number | string;
attrPointer: jqwidgets.GaugePointer;
attrRadius: number | string;
attrRanges: Array<jqwidgets.GaugeRanges>;
attrStartAngle: number | string;
attrShowRanges: boolean;
attrStyles: jqwidgets.GaugeStyle;
attrTicksMajor: jqwidgets.GaugeTicks;
attrTicksMinor: jqwidgets.GaugeTicks;
attrTicksDistance: string;
attrValue: number;
attrWidth: string | number;
attrHeight: string | number;
autoCreate: boolean = true;
properties: string[] = ['animationDuration','border','caption','cap','colorScheme','disabled','easing','endAngle','height','int64','labels','min','max','pointer','radius','ranges','startAngle','showRanges','styles','ticksMajor','ticksMinor','ticksDistance','value','width'];
host: any;
elementRef: ElementRef;
widgetObject: jqwidgets.jqxGauge;
constructor(containerElement: ElementRef) {
this.elementRef = containerElement;
}
ngOnInit() {
if (this.autoCreate) {
this.createComponent();
}
};
ngOnChanges(changes: SimpleChanges) {
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: boolean = false;
if (this[attrName] !== undefined) {
if (typeof this[attrName] === 'object') {
if (this[attrName] instanceof Array) {
areEqual = this.arraysEqual(this[attrName], this.host.jqxGauge(this.properties[i]));
}
if (areEqual) {
return false;
}
this.host.jqxGauge(this.properties[i], this[attrName]);
continue;
}
if (this[attrName] !== this.host.jqxGauge(this.properties[i])) {
this.host.jqxGauge(this.properties[i], this[attrName]);
}
}
}
}
}
arraysEqual(attrValue: any, hostValue: any): boolean {
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(): any {
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: HTMLElement, childEl: HTMLElement): void {
let classes: any = parentEl.classList;
if (classes.length > 0) {
childEl.classList.add(...classes);
}
parentEl.className = '';
}
moveStyles(parentEl: HTMLElement, childEl: HTMLElement): void {
let style = parentEl.style.cssText;
childEl.style.cssText = style
parentEl.style.cssText = '';
}
createComponent(options?: any): void {
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, 'jqxGauge', options);
}
createWidget(options?: any): void {
this.createComponent(options);
}
__updateRect__() : void {
if(this.host) this.host.css({ width: this.attrWidth, height: this.attrHeight });
}
setOptions(options: any) : void {
this.host.jqxGauge('setOptions', options);
}
// jqxGaugeComponent properties
animationDuration(arg?: string | number): string | number {
if (arg !== undefined) {
this.host.jqxGauge('animationDuration', arg);
} else {
return this.host.jqxGauge('animationDuration');
}
}
border(arg?: jqwidgets.GaugeBorder): jqwidgets.GaugeBorder {
if (arg !== undefined) {
this.host.jqxGauge('border', arg);
} else {
return this.host.jqxGauge('border');
}
}
caption(arg?: jqwidgets.GaugeCaption): jqwidgets.GaugeCaption {
if (arg !== undefined) {
this.host.jqxGauge('caption', arg);
} else {
return this.host.jqxGauge('caption');
}
}
cap(arg?: jqwidgets.GaugeCap): jqwidgets.GaugeCap {
if (arg !== undefined) {
this.host.jqxGauge('cap', arg);
} else {
return this.host.jqxGauge('cap');
}
}
colorScheme(arg?: string): string {
if (arg !== undefined) {
this.host.jqxGauge('colorScheme', arg);
} else {
return this.host.jqxGauge('colorScheme');
}
}
disabled(arg?: boolean): boolean {
if (arg !== undefined) {
this.host.jqxGauge('disabled', arg);
} else {
return this.host.jqxGauge('disabled');
}
}
easing(arg?: string): string {
if (arg !== undefined) {
this.host.jqxGauge('easing', arg);
} else {
return this.host.jqxGauge('easing');
}
}
endAngle(arg?: number | string): number | string {
if (arg !== undefined) {
this.host.jqxGauge('endAngle', arg);
} else {
return this.host.jqxGauge('endAngle');
}
}
height(arg?: number | string): number | string {
if (arg !== undefined) {
this.host.jqxGauge('height', arg);
} else {
return this.host.jqxGauge('height');
}
}
int64(arg?: boolean): boolean {
if (arg !== undefined) {
this.host.jqxGauge('int64', arg);
} else {
return this.host.jqxGauge('int64');
}
}
labels(arg?: jqwidgets.GaugeLabels): jqwidgets.GaugeLabels {
if (arg !== undefined) {
this.host.jqxGauge('labels', arg);
} else {
return this.host.jqxGauge('labels');
}
}
min(arg?: number): number {
if (arg !== undefined) {
this.host.jqxGauge('min', arg);
} else {
return this.host.jqxGauge('min');
}
}
max(arg?: number | string): number | string {
if (arg !== undefined) {
this.host.jqxGauge('max', arg);
} else {
return this.host.jqxGauge('max');
}
}
pointer(arg?: jqwidgets.GaugePointer): jqwidgets.GaugePointer {
if (arg !== undefined) {
this.host.jqxGauge('pointer', arg);
} else {
return this.host.jqxGauge('pointer');
}
}
radius(arg?: number | string): number | string {
if (arg !== undefined) {
this.host.jqxGauge('radius', arg);
} else {
return this.host.jqxGauge('radius');
}
}
ranges(arg?: Array<jqwidgets.GaugeRanges>): Array<jqwidgets.GaugeRanges> {
if (arg !== undefined) {
this.host.jqxGauge('ranges', arg);
} else {
return this.host.jqxGauge('ranges');
}
}
startAngle(arg?: number | string): number | string {
if (arg !== undefined) {
this.host.jqxGauge('startAngle', arg);
} else {
return this.host.jqxGauge('startAngle');
}
}
showRanges(arg?: boolean): boolean {
if (arg !== undefined) {
this.host.jqxGauge('showRanges', arg);
} else {
return this.host.jqxGauge('showRanges');
}
}
styles(arg?: jqwidgets.GaugeStyle): jqwidgets.GaugeStyle {
if (arg !== undefined) {
this.host.jqxGauge('styles', arg);
} else {
return this.host.jqxGauge('styles');
}
}
ticksMajor(arg?: jqwidgets.GaugeTicks): jqwidgets.GaugeTicks {
if (arg !== undefined) {
this.host.jqxGauge('ticksMajor', arg);
} else {
return this.host.jqxGauge('ticksMajor');
}
}
ticksMinor(arg?: jqwidgets.GaugeTicks): jqwidgets.GaugeTicks {
if (arg !== undefined) {
this.host.jqxGauge('ticksMinor', arg);
} else {
return this.host.jqxGauge('ticksMinor');
}
}
ticksDistance(arg?: string): string {
if (arg !== undefined) {
this.host.jqxGauge('ticksDistance', arg);
} else {
return this.host.jqxGauge('ticksDistance');
}
}
value(arg?: number): number {
if (arg !== undefined) {
this.host.jqxGauge('value', arg);
} else {
return this.host.jqxGauge('value');
}
}
width(arg?: number | string): number | string {
if (arg !== undefined) {
this.host.jqxGauge('width', arg);
} else {
return this.host.jqxGauge('width');
}
}
// jqxGaugeComponent functions
disable(): void {
this.host.jqxGauge('disable');
}
enable(): void {
this.host.jqxGauge('enable');
}
val(value?: number): any {
if (value !== undefined) {
return this.host.jqxGauge('val', value);
} else {
return this.host.jqxGauge('val');
}
};
// jqxGaugeComponent events
onValueChanging = new EventEmitter();
onValueChanged = new EventEmitter();
__wireEvents__(): void {
this.host.on('valueChanging', (eventData: any) => { this.onValueChanging.emit(eventData); });
this.host.on('valueChanged', (eventData: any) => { this.onValueChanged.emit(eventData); });
}
} //jqxGaugeComponent