@grapecity/wijmo.gauge 5.20242.30 → 5.20251.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * Wijmo Library 5.20242.30
3
+ * Wijmo Library 5.20251.40
4
4
  * https://developer.mescius.com/wijmo
5
5
  *
6
6
  * Copyright(c) MESCIUS inc. All rights reserved.
@@ -11,4 +11,4 @@
11
11
  *
12
12
  */
13
13
 
14
- "use strict";var __importStar=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)Object.hasOwnProperty.call(t,i)&&(e[i]=t[i]);e.default=t;return e};Object.defineProperty(exports,"__esModule",{value:!0});const wijmo_1=require("@grapecity/wijmo"),selfModule=__importStar(require("@grapecity/wijmo.gauge"));exports.BulletGraphClsNames={hostElement:"wj-bulletgraph"};exports.GaugeClsNames={cover:"wj-cover",face:"wj-face",filter:"wj-gauge-filter",hostElement:"wj-gauge",innerNeedleCap:"wj-inner-needle-cap",max:"wj-max",min:"wj-min",needle:"wj-needle",needleCap:"wj-needle-cap",pointer:"wj-pointer",ranges:"wj-ranges",thumb:"wj-thumb",tickText:"wj-tick-text",ticks:"wj-ticks",value:"wj-value"};exports.LinearGaugeClsNames={hostElement:"wj-lineargauge"};exports.RadialGaugeClsNames={hostElement:"wj-radialgauge"};exports.RangeClsNames={ranges:"wj-ranges"};class Range{constructor(t){this._min=0;this._max=100;this._thickness=1;this.propertyChanged=new wijmo_1.Event;wijmo_1.isString(t)?this._name=t:wijmo_1.copy(this,t)}get min(){return this._min}set min(t){this._setProp("_min",wijmo_1.asNumber(t,!0))}get max(){return this._max}set max(t){this._setProp("_max",wijmo_1.asNumber(t,!0))}get color(){return this._color}set color(t){this._setProp("_color",wijmo_1.asString(t))}get thickness(){return this._thickness}set thickness(t){this._setProp("_thickness",wijmo_1.clamp(wijmo_1.asNumber(t),0,1))}get name(){return this._name}set name(t){this._setProp("_name",wijmo_1.asString(t))}onPropertyChanged(t){this.propertyChanged.raise(this,t)}_setProp(t,e){let i=this[t];if(e!=i){this[t]=e;let s=new wijmo_1.PropertyChangedEventArgs(t.substr(1),i,e);this.onPropertyChanged(s)}}}Range._ctr=0;exports.Range=Range;var ShowText,NeedleShape,NeedleLength,GaugeDirection;!function(t){t[t.None=0]="None";t[t.Value=1]="Value";t[t.MinMax=2]="MinMax";t[t.All=3]="All"}(ShowText=exports.ShowText||(exports.ShowText={}));class Gauge extends wijmo_1.Control{constructor(t,e){super(t,null,!0);this._ranges=new wijmo_1.ObservableArray;this._rngElements=[];this._format="n0";this._showRanges=!0;this._stackRanges=!1;this._shadow=!0;this._animated=!0;this._readOnly=!0;this._handleWheel=!0;this._step=1;this._showText=ShowText.None;this._showTicks=!1;this._showTickText=!1;this._thickness=.8;this._initialized=!1;this.valueChanged=new wijmo_1.Event;this._getPercent=function(t){let e=this.max>this.min?(t-this.min)/(this.max-this.min):0;return Math.max(0,Math.min(1,e))};Gauge._ctr++;let i=this.hostElement;wijmo_1.setAttribute(i,"role","slider",!0);let s=this.getTemplate();this.applyTemplate(`${wijmo_1.ControlClsNames.hostElement} ${exports.GaugeClsNames.hostElement}`,s,{_dSvg:"dsvg",_svg:"svg",_filter:"filter",_gFace:"gface",_gRanges:"granges",_gPointer:"gpointer",_gCover:"gcover",_pFace:"pface",_pPointer:"ppointer",_cValue:"cvalue",_tValue:"value",_tMin:"min",_tMax:"max",_pTicks:"pticks",_gTicks:"gticks",_gNeedle:"gneedle"});wijmo_1.setCss(this._dSvg,{width:"100%",height:"100%"});this._filterID="wj-gauge-filter-"+Gauge._ctr.toString(36);this._filter.setAttribute("id",this._filterID);this.face=new Range;this.pointer=new Range;this._ranges.collectionChanged.addHandler(()=>{this._ranges.forEach(t=>{wijmo_1.assert(t instanceof Range,"ranges array must contain Range objects.")});this._rangesDirty=!0;this.invalidate()});this.addEventListener(i,"keydown",this._keydown.bind(this));this.addEventListener(i,"click",t=>{if(0==t.button){this.focus();this._applyMouseValue(t)}});this.addEventListener(i,"mousedown",t=>{if(0==t.button){this.focus();this._dragging=!0;setTimeout(()=>{this._applyMouseValue(t)})}});this.addEventListener(i,"mousemove",t=>{this._dragging&&this.containsFocus()&&this._applyMouseValue(t,!0)});this.addEventListener(i,"mouseup",t=>{this._dragging=!1});this.addEventListener(i,"mouseleave",t=>{t.target==i&&(this._dragging=!1)});if("ontouchstart"in window){this.addEventListener(i,"touchstart",t=>{this.focus();!t.defaultPrevented&&this._applyMouseValue(t,!1)&&t.preventDefault()});this.addEventListener(i,"touchmove",t=>{!t.defaultPrevented&&this._applyMouseValue(t,!0)&&t.preventDefault()})}this.addEventListener(i,"wheel",t=>{if(this._handleWheel&&!this.isReadOnly&&!t.defaultPrevented&&this.containsFocus()&&null!=this.value&&this.hitTest(t)){let e=wijmo_1.clamp(-t.deltaY,-1,1);this.value=wijmo_1.clamp(this.value+(this.step||1)*e,this.min,this.max);t.preventDefault()}});this.isReadOnly=!0;this.initialize(e);this.invalidate()}static get controlTemplate(){Gauge._ctrlTemplate||(Gauge._ctrlTemplate='<div wj-part="dsvg" dir="ltr"><svg wj-part="svg" width="100%" height="100%"><defs><filter wj-part="filter"><feOffset dx="3" dy="3"></feOffset><feGaussianBlur result="offset-blur" stdDeviation="5"></feGaussianBlur><feComposite operator="out" in="SourceGraphic" in2="offset-blur" result="inverse"></feComposite><feFlood flood-color="black" flood-opacity="0.2" result="color"></feFlood><feComposite operator="in" in="color" in2="inverse" result="shadow"></feComposite><feComposite operator="over" in="shadow" in2="SourceGraphic"></feComposite></filter></defs>'+`<g wj-part="gface" class="${exports.GaugeClsNames.face}">`+'<path wj-part="pface"/></g>'+`<g wj-part="granges" class="${exports.GaugeClsNames.ranges}"/>`+`<g wj-part="gpointer" class="${exports.GaugeClsNames.pointer}">`+'<path wj-part="ppointer"/></g>'+`<g wj-part="gcover" class="${exports.GaugeClsNames.cover}">`+`<path wj-part="pticks" class="${exports.GaugeClsNames.ticks}"/>`+`<g wj-part="gticks" aria-hidden="true" class="${exports.GaugeClsNames.tickText}"/>`+`<circle wj-part="cvalue" class="${exports.GaugeClsNames.pointer} ${exports.GaugeClsNames.thumb}"/>`+`<g wj-part="gneedle" class="${exports.GaugeClsNames.needle}"/>`+`<text wj-part="value" class="${exports.GaugeClsNames.value}"/>`+`<text wj-part="min" class="${exports.GaugeClsNames.min}" aria-hidden="true"/>`+`<text wj-part="max" class="${exports.GaugeClsNames.max}" aria-hidden="true"/>`+"</g></svg></div>");return Gauge._ctrlTemplate}static set controlTemplate(t){Gauge._ctrlTemplate=t}get value(){return this._pointer.max}set value(t){if(t!=this.value){this._pointer.max=wijmo_1.asNumber(t,!0);this._updateAria()}}get min(){return this._face.min}set min(t){if(t!=this.min){this._face.min=wijmo_1.asNumber(t);this._updateAria()}}get max(){return this._face.max}set max(t){if(t!=this.max){this._face.max=wijmo_1.asNumber(t);this._updateAria()}}get origin(){return this._origin}set origin(t){if(t!=this._origin){this._origin=wijmo_1.asNumber(t,!0);this.invalidate()}}get isReadOnly(){return this._readOnly}set isReadOnly(t){this._readOnly=wijmo_1.asBoolean(t);wijmo_1.setAttribute(this._svg,"cursor",this._readOnly?null:"pointer");wijmo_1.toggleClass(this.hostElement,wijmo_1.ControlStateClsNames.readOnly,this.isReadOnly)}get handleWheel(){return this._handleWheel}set handleWheel(t){this._handleWheel=wijmo_1.asBoolean(t)}get step(){return this._step}set step(t){if(t!=this._step){this._step=wijmo_1.asNumber(t,!0);this.invalidate()}}get format(){return this._format}set format(t){if(t!=this._format){this._format=wijmo_1.asString(t);this.invalidate()}}get getText(){return this._getText}set getText(t){if(t!=this._getText){this._getText=wijmo_1.asFunction(t);this.invalidate()}}get thickness(){return this._thickness}set thickness(t){if(t!=this._thickness){this._thickness=wijmo_1.clamp(wijmo_1.asNumber(t,!1),0,1);this.invalidate()}}get face(){return this._face}set face(t){if(t!=this._face){this._face&&this._face.propertyChanged.removeHandler(this._rangeChanged);this._face=wijmo_1.asType(t,Range);this._face&&this._face.propertyChanged.addHandler(this._rangeChanged,this);this.invalidate()}}get pointer(){return this._pointer}set pointer(t){if(t!=this._pointer){let e=null;if(this._pointer){e=this.value;this._pointer.propertyChanged.removeHandler(this._rangeChanged)}this._pointer=wijmo_1.asType(t,Range);if(this._pointer){e&&(this.value=e);this._pointer.propertyChanged.addHandler(this._rangeChanged,this)}this.invalidate()}}get showText(){return this._showText}set showText(t){if((t=wijmo_1.asEnum(t,ShowText))!=this._showText){this._showText=t;this.invalidate()}}get showTicks(){return this._showTicks}set showTicks(t){if(t!=this._showTicks){this._showTicks=wijmo_1.asBoolean(t);this.invalidate()}}get showTickText(){return this._showTickText}set showTickText(t){if(t!=this._showTickText){this._showTickText=wijmo_1.asBoolean(t);this.invalidate()}}get tickSpacing(){return this._tickSpacing}set tickSpacing(t){if(t!=this._tickSpacing){this._tickSpacing=wijmo_1.asNumber(t,!0);this.invalidate()}}get thumbSize(){return this._thumbSize}set thumbSize(t){if(t!=this._thumbSize){this._thumbSize=wijmo_1.asNumber(t,!0,!0);this.invalidate()}}get showRanges(){return this._showRanges}set showRanges(t){if(t!=this._showRanges){this._showRanges=wijmo_1.asBoolean(t);this._animColor=null;this._rangesDirty=!0;this.invalidate()}}get stackRanges(){return this._stackRanges}set stackRanges(t){if(t!=this._stackRanges){this._stackRanges=wijmo_1.asBoolean(t);this._animColor=null;this._rangesDirty=!0;this.invalidate()}}get hasShadow(){return this._shadow}set hasShadow(t){if(t!=this._shadow){this._shadow=wijmo_1.asBoolean(t);this.invalidate()}}get isAnimated(){return this._animated}set isAnimated(t){this._animated=wijmo_1.asBoolean(t)}get ranges(){return this._ranges}onValueChanged(t){this.valueChanged.raise(this,t)}refresh(t=!0){super.refresh(t);if(this._rangesDirty){this._rangesDirty=!1;let t=this._gRanges;this._rngElements.forEach(t=>{t.rng.propertyChanged.removeHandler(this._rangeChanged)});for(;t.lastChild;)t.removeChild(t.lastChild);this._rngElements=[];this._showRanges&&this._ranges.forEach(e=>{e.propertyChanged.addHandler(this._rangeChanged,this);this._rngElements.push({rng:e,el:this._createElement("path",t)})})}this._showElement(this._tValue,0!=(this.showText&ShowText.Value));this._showElement(this._tMin,0!=(this.showText&ShowText.MinMax));this._showElement(this._tMax,0!=(this.showText&ShowText.MinMax));this._showElement(this._cValue,0!=(this.showText&ShowText.Value)||this._thumbSize>0);this._updateText();let e=this._getFilterUrl();wijmo_1.setAttribute(this._pFace,"filter",e);wijmo_1.setAttribute(this._pPointer,"filter",e);this._updateRange(this._face);this._updateRange(this._pointer);this._updateTicks();this._ranges.forEach(t=>{this._updateRange(t)});this._initialized=!0}hitTest(t,e){wijmo_1.isNumber(t)&&wijmo_1.isNumber(e)?t=new wijmo_1.Point(t,e):t instanceof wijmo_1.Point||(t=wijmo_1.mouseToPage(t));t=wijmo_1.asType(t,wijmo_1.Point);let i=wijmo_1.Rect.fromBoundingRect(this._dSvg.getBoundingClientRect());t.x-=i.left+pageXOffset;t.y-=i.top+pageYOffset;return this._getValueFromPoint(t)}dispose(){if(this._animInterval){clearInterval(this._animInterval);this._animInterval=null}super.dispose()}static _getBBox(t){try{return t.getBBox()}catch(t){return{x:0,y:0,width:0,height:0}}}_getFilterUrl(){return this.hasShadow&&!wijmo_1.isiOS()?"url(#"+this._filterID+")":null}_getRangeElement(t){if(t==this._face)return this._pFace;if(t==this._pointer)return this._pPointer;for(let e=0;e<this._rngElements.length;e++){let i=this._rngElements[e];if(i.rng==t)return i.el}return null}_rangeChanged(t,e){if(t==this._pointer&&"max"==e.propertyName){this.onValueChanged();this._updateText()}if(t!=this._face){if(t==this._pointer&&"max"==e.propertyName){if(this._animInterval){clearInterval(this._animInterval);this._updateRange(t,e.oldValue)}if(this.isAnimated&&!this.isUpdating&&this._initialized){let i=this._getPointerColor(e.oldValue),s=this._getPointerColor(e.newValue),a=i?new wijmo_1.Color(i):null,h=s?new wijmo_1.Color(s):null,n=wijmo_1.clamp(Math.abs(e.newValue-e.oldValue)/(this.max-this.min),0,1);this._animInterval=wijmo_1.animate(i=>{this._animColor=a&&h?wijmo_1.Color.interpolate(a,h,i).toString():null;this._updateRange(t,e.oldValue+i*(e.newValue-e.oldValue));if(i>=1){this._animColor=null;this._animInterval=null;this._updateRange(t);this._updateText()}},n*wijmo_1.Control._ANIM_DEF_DURATION);return}}this._updateRange(t)}else this.invalidate()}_createElement(t,e,i){let s=document.createElementNS(Gauge._SVGNS,t);i&&s.setAttribute("class",i);e.appendChild(s);return s}_centerText(t,e,i){if("none"!=t.getAttribute("display")){let s=wijmo_1.Globalize.format(e,this.format);if(wijmo_1.isFunction(this.getText)){let i="";t==this._tValue?i="value":t==this._tMin?i="min":t==this._tMax&&(i="max");i&&(s=this.getText(this,i,e,s))}t.textContent=s;let a=wijmo_1.Rect.fromBoundingRect(Gauge._getBBox(t)),h=i.x-Math.round(a.width)/2,n=i.y+Math.round(a.height)/4;t.setAttribute("x",this._fix(h));t.setAttribute("y",this._fix(n))}}_copy(t,e){if("ranges"==t){wijmo_1.asArray(e).forEach(t=>{let e=new Range(t);this.ranges.push(e)});return!0}if("pointer"==t){wijmo_1.copy(this.pointer,e);return!0}return!1}_showElement(t,e){wijmo_1.setAttribute(t,"display",e?null:"none")}_updateRange(t,e=t.max){t==this._pointer&&(t.min=null!=this.origin?this.origin:this.min<0&&this.max>0?0:this.min);let i=this._getRangeElement(t);if(i){this._updateRangeElement(i,t,e);let s=t.color;t==this._pointer&&(s=this._animColor?this._animColor:this._getPointerColor(t.max));wijmo_1.setAttribute(i,"style",s?"fill:"+s:null)}}_getPointerColor(t){if(!this._showRanges){let e;for(let i=0;i<this._ranges.length;i++){let s=this._ranges[i];if(t>=s.min&&t<=s.max){e=s;break}}if(e)return e.color}return this._pointer.color}_keydown(t){if(!this._readOnly&&this._step){let e=!0;switch(this._getKey(t.keyCode)){case wijmo_1.Key.Left:case wijmo_1.Key.Down:this.value=wijmo_1.clamp(this.value-this._step,this.min,this.max);break;case wijmo_1.Key.Right:case wijmo_1.Key.Up:this.value=wijmo_1.clamp(this.value+this._step,this.min,this.max);break;case wijmo_1.Key.Home:this.value=this.min;break;case wijmo_1.Key.End:this.value=this.max;break;default:e=!1}e&&t.preventDefault()}}_getKey(t){return t}_applyMouseValue(t,e){if(!this.isReadOnly&&this.containsFocus()){let i=this.hitTest(t);if(null!=i){let t=this._animated,s=this._step;e&&(this._animated=!1);s&&(i=Math.round(i/s)*s);this.value=wijmo_1.clamp(i,this.min,this.max);this._animated=t;return!0}}return!1}_updateRangeElement(t,e,i){wijmo_1.assert(!1,"Gauge is an abstract class.")}_updateText(){wijmo_1.assert(!1,"Gauge is an abstract class.")}_updateTicks(){wijmo_1.assert(!1,"Gauge is an abstract class.")}_getValueFromPoint(t){return null}_fix(t){return wijmo_1.isNumber(t)?parseFloat(t.toFixed(4)).toString():this._fix(t.x)+" "+this._fix(t.y)}_updateAria(){let t=this.hostElement;if(t){wijmo_1.setAttribute(t,"aria-valuemin",this.min);wijmo_1.setAttribute(t,"aria-valuemax",this.max);wijmo_1.setAttribute(t,"aria-valuenow",this.value)}}}Gauge._SVGNS="http://www.w3.org/2000/svg";Gauge._ctr=0;Gauge._ctrlTemplate="";exports.Gauge=Gauge;!function(t){t[t.None=0]="None";t[t.Triangle=1]="Triangle";t[t.Diamond=2]="Diamond";t[t.Hexagon=3]="Hexagon";t[t.Rectangle=4]="Rectangle";t[t.Arrow=5]="Arrow";t[t.WideArrow=6]="WideArrow";t[t.Pointer=7]="Pointer";t[t.WidePointer=8]="WidePointer";t[t.Outer=9]="Outer"}(NeedleShape=exports.NeedleShape||(exports.NeedleShape={}));!function(t){t[t.Outer=0]="Outer";t[t.Middle=1]="Middle";t[t.Inner=2]="Inner"}(NeedleLength=exports.NeedleLength||(exports.NeedleLength={}));class RadialGauge extends Gauge{constructor(t,e){super(t,null);this._startAngle=0;this._sweepAngle=180;this._autoScale=!0;this._ndlShape=NeedleShape.None;this._ndlLength=NeedleLength.Middle;wijmo_1.addClass(this.hostElement,exports.RadialGaugeClsNames.hostElement);this._thickness=.4;this.showText=ShowText.All;this.initialize(e)}get startAngle(){return this._startAngle}set startAngle(t){if(t!=this._startAngle){this._startAngle=wijmo_1.clamp(wijmo_1.asNumber(t,!1),-360,360);this.invalidate()}}get sweepAngle(){return this._sweepAngle}set sweepAngle(t){if(t!=this._sweepAngle){this._sweepAngle=wijmo_1.clamp(wijmo_1.asNumber(t,!1),-360,360);this.invalidate()}}get autoScale(){return this._autoScale}set autoScale(t){if(t!=this._autoScale){this._autoScale=wijmo_1.asBoolean(t);this.invalidate()}}get faceBounds(){return this._rcSvg?this._rcSvg.clone():null}get clientSize(){wijmo_1._deprecated("clientSize","faceBounds");let t=this._rcSvg;return t?new wijmo_1.Size(t.width,t.height):null}get needleElement(){return this._ndlElement}set needleElement(t){if(t!=this._ndlElement){this._ndlShape=0;this._ndlElement=wijmo_1.asType(t,SVGElement,!0);let e=this._gNeedle;for(;e.firstChild;)wijmo_1.removeChild(e.firstChild);if(this._ndlElement){wijmo_1.setAttribute(e,"transform","scale(0)");e.appendChild(this._ndlElement)}this.invalidate()}}get needleShape(){return this._ndlShape}set needleShape(t){if(t!=this._ndlShape){if((t=wijmo_1.asEnum(t,NeedleShape))===this._ndlShape)return;let e=null;switch(t){case NeedleShape.Triangle:e=RadialGauge.createNeedleElement([{x:-10,y:10},{x:100,y:0}]);break;case NeedleShape.Diamond:e=RadialGauge.createNeedleElement([{x:-20,y:0},{x:0,y:10},{x:100,y:0}]);break;case NeedleShape.Hexagon:e=RadialGauge.createNeedleElement([{x:-15,y:0},{x:-10,y:5},{x:10,y:5},{x:100,y:0}]);break;case NeedleShape.Rectangle:e=RadialGauge.createNeedleElement([{x:-20,y:3},{x:100,y:3}],10);break;case NeedleShape.Arrow:e=RadialGauge.createNeedleElement([{x:-20,y:3},{x:70,y:3},{x:70,y:15},{x:100,y:0}],10);break;case NeedleShape.WideArrow:e=RadialGauge.createNeedleElement([{x:-30,y:5},{x:-40,y:15},{x:-20,y:15},{x:-10,y:5},{x:80,y:5},{x:70,y:15},{x:100,y:0}]);break;case NeedleShape.Pointer:e=RadialGauge.createNeedleElement([{x:0,y:10},{x:100,y:0}],20,10);break;case NeedleShape.WidePointer:e=RadialGauge.createNeedleElement([{x:0,y:20},{x:100,y:0}],20,10);break;case NeedleShape.Outer:e=RadialGauge.createNeedleElement([{x:60,y:20},{x:100,y:0}])}this.needleElement=e;this._ndlShape=t;this.invalidate()}}get needleLength(){return this._ndlLength}set needleLength(t){if(t!=this._ndlLength){this._ndlLength=wijmo_1.asEnum(t,NeedleLength);this.invalidate()}}static createNeedleElement(t,e,i){let s="";for(let e=0;e<t.length;e++){let i=t[e];if(e==t.length-1&&0==i.y)break;s+=(e>0?" L ":"M ")+i.x+" "+i.y}for(let e=t.length-1;e>=0;e--){let i=t[e];s+=" L "+i.x+" "+-i.y}s+=" Z";let a="http://www.w3.org/2000/svg",h=document.createElementNS(a,"g"),n=document.createElementNS(a,"path");wijmo_1.setAttribute(n,"d",s);h.appendChild(n);if(e){let t=document.createElementNS(a,"circle");wijmo_1.addClass(t,exports.GaugeClsNames.needleCap);wijmo_1.setAttribute(t,"r",e);h.appendChild(t);if(i){t=document.createElementNS(a,"circle");wijmo_1.addClass(t,exports.GaugeClsNames.innerNeedleCap);wijmo_1.setAttribute(t,"r",i);h.appendChild(t)}}return h}refresh(t=!0){wijmo_1.setAttribute(this._svg,"viewBox",null);this._rcSvg=wijmo_1.Rect.fromBoundingRect(this._dSvg.getBoundingClientRect());super.refresh(t);this._ctmInv=null;this._ptSvg=null;if(this._autoScale){wijmo_1.setAttribute(this._svg,"viewBox",null);let t=wijmo_1.Rect.fromBoundingRect(Gauge._getBBox(this._pFace));0!=(this.showText&ShowText.Value)&&(t=wijmo_1.Rect.union(t,wijmo_1.Rect.fromBoundingRect(Gauge._getBBox(this._tValue))));if(0!=(this.showText&ShowText.MinMax)){t=wijmo_1.Rect.union(t,wijmo_1.Rect.fromBoundingRect(Gauge._getBBox(this._tMin)));t=wijmo_1.Rect.union(t,wijmo_1.Rect.fromBoundingRect(Gauge._getBBox(this._tMax)))}let e=[this._fix(t.left),this._fix(t.top),this._fix(t.width),this._fix(t.height)].join(" ");wijmo_1.setAttribute(this._svg,"viewBox",e);let i=this._pFace.getCTM();this._ctmInv=i?i.inverse():null;this._ptSvg=this._svg.createSVGPoint()}}_updateRangeElement(t,e,i){if(this._rcSvg){let s=this._rcSvg,a=new wijmo_1.Point(s.width/2,s.height/2),h=Math.min(s.width,s.height)/2,n=h*this.thickness,r=n*e.thickness,o=h-(n-r)/2,l=o-r,_=this._getStartAngle(),g=this._getSweepAngle(),c=e==this._face,m=c?0:this._getPercent(e.min),u=_+g*m,d=g*((c?1:this._getPercent(i))-m);if(this.stackRanges&&e!=this.face&&e!=this.pointer){let t=this.ranges.indexOf(e);if(t>-1){let e=this.ranges.length,i=(o-l)/e;o=(l+=(e-1-t)*i)+i}}this._updateSegment(t,a,o,l,u,d);if(e==this._pointer){let t=this._fix;if(this.thumbSize>0){let s=this._animColor?this._animColor:this._getPointerColor(e.max),h=this._getPoint(a,_+g*this._getPercent(i),(o+l)/2),n=this._cValue;wijmo_1.setAttribute(n,"cx",t(h.x));wijmo_1.setAttribute(n,"cy",t(h.y));wijmo_1.setAttribute(n,"style",s?"fill:"+s:null);wijmo_1.setAttribute(n,"r",t(this.thumbSize/2))}if(this.needleElement){let e=o;this._ndlLength==NeedleLength.Inner?e=l:this._ndlLength==NeedleLength.Middle&&(e=(l+o)/2);let i="translate({cx}, {cy}) scale({scale}) rotate({angle})".replace("{cx}",t(a.x)).replace("{cy}",t(a.y)).replace("{scale}",t(e/100)).replace("{angle}",t(u+d));this._gNeedle.setAttribute("transform",i)}}}}_getStartAngle(){let t=this.startAngle+180;this.rightToLeft&&(t=180-t);return t}_getSweepAngle(){let t=this.sweepAngle;this.rightToLeft&&(t=-t);return t}_updateText(){if(this._rcSvg){let t=this._rcSvg,e=new wijmo_1.Point(t.width/2,t.height/2),i=Math.min(t.width,t.height)/2,s=Math.max(0,i*(1-this.thickness)),a=this._getStartAngle(),h=this._getSweepAngle();this._showElement(this._cValue,this.thumbSize>0);let n=0!=(this.showText&ShowText.MinMax)&&Math.abs(h)<=300;this._showElement(this._tMin,n);this._showElement(this._tMax,n);this._centerText(this._tValue,this.value,e);let r=10*(this._getSweepAngle()<0?-1:1);this._centerText(this._tMin,this.min,this._getPoint(e,a-r,(i+s)/2));this._centerText(this._tMax,this.max,this._getPoint(e,a+h+r,(i+s)/2))}}_updateTicks(){let t=this.tickSpacing&&this.tickSpacing>0?this.tickSpacing:this.step,e="",i=this._gTicks;for(;i.firstChild;)wijmo_1.removeChild(i.firstChild);if(this.showTicks&&t>0){let s=this._rcSvg,a=new wijmo_1.Point(s.width/2,s.height/2),h=Math.min(s.width,s.height)/2,n=h*this.thickness,r=n*this._face.thickness,o=h-(n-r)/2,l=o-r,_=1.15*o,g=this._getStartAngle(),c=this._getSweepAngle();for(let s=this.min;s<=this.max;s+=t){let t=g+c*this._getPercent(s),h=this._fix(this._getPoint(a,t,l)),n=this._fix(this._getPoint(a,t,o));s>this.min&&s<this.max&&(e+="M "+h+" L "+n+" ");if(this.showTickText){let e=this._createElement("text",i),h=this._getPoint(a,t,_);this._centerText(e,s,h)}}}this._pTicks.setAttribute("d",e)}_updateSegment(t,e,i,s,a,h){h=Math.min(Math.max(h,-359.99),359.99);let n=this._getPoint(e,a,s),r=this._getPoint(e,a,i),o=this._getPoint(e,a+h,i),l=this._getPoint(e,a+h,s),_={large:Math.abs(h)>180?1:0,cw:h>0?1:0,ccw:h>0?0:1,or:this._fix(i),ir:this._fix(s),p1:this._fix(n),p2:this._fix(r),p3:this._fix(o),p4:this._fix(l)},g=wijmo_1.format("M {p1} L {p2} A {or} {or} 0 {large} {cw} {p3} L {p4} A {ir} {ir} 0 {large} {ccw} {p1} Z",_);t.setAttribute("d",g)}_getPoint(t,e,i){e=e*Math.PI/180;return new wijmo_1.Point(t.x+i*Math.cos(e),t.y+i*Math.sin(e))}_getValueFromPoint(t){if(this.autoScale&&this._ctmInv){this._ptSvg.x=t.x;this._ptSvg.y=t.y;this._ptSvg=this._ptSvg.matrixTransform(this._ctmInv);t.x=this._ptSvg.x;t.y=this._ptSvg.y}if(!this._rcSvg||!this.sweepAngle)return null;let e=this._rcSvg,i=new wijmo_1.Point(e.width/2,e.height/2),s=Math.min(e.width,e.height)/2,a=t.x-i.x,h=t.y-i.y,n=h*h+a*a;if(n<400||n>(s+20)*(s+20))return null;let r=180*(Math.PI-Math.atan2(-h,a))/Math.PI,o=this.startAngle,l=this.sweepAngle,_=o+l;this.rightToLeft&&(r=180-r);if(l>0){for(;r<o;)r+=360;for(;r>_;)r-=360}else{for(;r<_;)r+=360;for(;r>o;)r-=360}if((r-o)*(r-_)>0){let t=this._getPoint(i,r,s),e=this._getPoint(i,o,s),a=this._getPoint(i,_,s);r=this._getDist2(t,e)<this._getDist2(t,a)?o:_}let g=l?wijmo_1.clamp(Math.abs(r-o)/Math.abs(l),0,1):0;return this.min+g*(this.max-this.min)}_getDist2(t,e){let i=t.x-e.x,s=t.y-e.y;return i*i+s*s}}exports.RadialGauge=RadialGauge;!function(t){t[t.Right=0]="Right";t[t.Left=1]="Left";t[t.Up=2]="Up";t[t.Down=3]="Down"}(GaugeDirection=exports.GaugeDirection||(exports.GaugeDirection={}));class LinearGauge extends Gauge{constructor(t,e){super(t,null);this._direction=GaugeDirection.Right;wijmo_1.addClass(this.hostElement,exports.LinearGaugeClsNames.hostElement);this.initialize(e)}get direction(){return this._direction}set direction(t){if((t=wijmo_1.asEnum(t,GaugeDirection))!=this._direction){this._direction=t;this.invalidate()}}get faceBounds(){return this._getRangeRect(this._face)}_updateRangeElement(t,e,i){let s=this._getRangeRect(e,i);this._updateSegment(t,s);let a=e==this._pointer&&0!=(this.showText&ShowText.Value),h=a||e==this._pointer&&this.thumbSize>0,n=s.left+s.width/2,r=s.top+s.height/2;switch(this._getDirection()){case GaugeDirection.Right:n=s.right;break;case GaugeDirection.Left:n=s.left;break;case GaugeDirection.Up:r=s.top;break;case GaugeDirection.Down:r=s.bottom}a&&this._centerText(this._tValue,i,new wijmo_1.Point(n,r));if(a||h){s=wijmo_1.Rect.fromBoundingRect(Gauge._getBBox(this._tValue));let t=this._animColor?this._animColor:this._getPointerColor(e.max),i=null!=this.thumbSize?this.thumbSize/2:.8*Math.max(s.width,s.height),a=this._cValue;wijmo_1.setAttribute(a,"cx",this._fix(n));wijmo_1.setAttribute(a,"cy",this._fix(r));wijmo_1.setAttribute(a,"style",t?"fill:"+t:null);wijmo_1.setAttribute(a,"r",this._fix(i))}}_updateText(){let t=this._getRangeRect(this._face);switch(this._getDirection()){case GaugeDirection.Right:this._setText(this._tMin,this.min,t,"left");this._setText(this._tMax,this.max,t,"right");break;case GaugeDirection.Left:this._setText(this._tMin,this.min,t,"right");this._setText(this._tMax,this.max,t,"left");break;case GaugeDirection.Up:this._setText(this._tMin,this.min,t,"bottom");this._setText(this._tMax,this.max,t,"top");break;case GaugeDirection.Down:this._setText(this._tMin,this.min,t,"top");this._setText(this._tMax,this.max,t,"bottom")}}_updateTicks(){let t=this.tickSpacing&&this.tickSpacing>0?this.tickSpacing:this.step,e="",i=this._gTicks;for(;i.firstChild;)wijmo_1.removeChild(i.firstChild);if(this.showTicks&&t>0){let s,a=this._getRangeRect(this._face),h=new wijmo_1.Point(a.left-.75*a.width,a.top-.75*a.height),n=this._fix;for(let r=this.min;r<=this.max;r+=t){let t=null;switch(this._getDirection()){case GaugeDirection.Right:h.x=a.left+a.width*this._getPercent(r);t="M "+(s=n(h.x))+" "+n(a.top)+" L "+s+" "+n(a.bottom)+" ";break;case GaugeDirection.Left:h.x=a.right-a.width*this._getPercent(r);t="M "+(s=n(h.x))+" "+n(a.top)+" L "+s+" "+n(a.bottom)+" ";break;case GaugeDirection.Up:h.y=a.bottom-a.height*this._getPercent(r);s=n(h.y);t="M "+n(a.left)+" "+s+" L "+n(a.right)+" "+s+" ";break;case GaugeDirection.Down:h.y=a.top+a.height*this._getPercent(r);s=n(h.y);t="M "+n(a.left)+" "+s+" L "+n(a.right)+" "+s+" "}r>this.min&&r<this.max&&(e+=t);if(this.showTickText){let t=this._createElement("text",i);this._centerText(t,r,h)}}}this._pTicks.setAttribute("d",e)}_updateSegment(t,e){let i={p1:this._fix(new wijmo_1.Point(e.left,e.top)),p2:this._fix(new wijmo_1.Point(e.right,e.top)),p3:this._fix(new wijmo_1.Point(e.right,e.bottom)),p4:this._fix(new wijmo_1.Point(e.left,e.bottom))},s=wijmo_1.format("M {p1} L {p2} L {p3} L {p4} Z",i);t.setAttribute("d",s)}_setText(t,e,i,s){if("none"!=t.getAttribute("display")){let a=wijmo_1.Globalize.format(e,this.format);if(wijmo_1.isFunction(this.getText)){let i=t==this._tValue?"value":t==this._tMin?"min":t==this._tMax?"max":null;wijmo_1.assert(null!=i,"unknown element");a=this.getText(this,i,e,a)}t.textContent=a;let h=wijmo_1.Rect.fromBoundingRect(Gauge._getBBox(t)),n=new wijmo_1.Point(i.left+i.width/2-h.width/2,i.top+i.height/2+h.height/2);switch(s){case"top":n.y=i.top-4;break;case"left":n.x=i.left-4-h.width;break;case"right":n.x=i.right+4;break;case"bottom":n.y=i.bottom+4+h.height}t.setAttribute("x",this._fix(n.x));t.setAttribute("y",this._fix(n.y))}}_getRangeRect(t,e=t.max){let i=this.hostElement,s=new wijmo_1.Rect(0,0,i.clientWidth,i.clientHeight),a=this._getDirection(),h=this.thumbSize?Math.ceil(this.thumbSize/2):0;if(this.showText!=ShowText.None){let t=parseInt(getComputedStyle(i).fontSize);isNaN(t)||(h=Math.max(h,3*t))}switch(a){case GaugeDirection.Right:case GaugeDirection.Left:s=s.inflate(-h,-s.height*(1-this.thickness*t.thickness)/2);break;case GaugeDirection.Up:case GaugeDirection.Down:s=s.inflate(-s.width*(1-this.thickness*t.thickness)/2,-h)}if(this.stackRanges&&t!=this.face&&t!=this.pointer){let e=this.ranges.indexOf(t);if(e>-1){let t=this.ranges.length;switch(a){case GaugeDirection.Right:case GaugeDirection.Left:s.height/=t;s.top+=e*s.height;break;case GaugeDirection.Up:case GaugeDirection.Down:s.width/=t;s.left+=e*s.width}}}let n=t==this._face,r=n?0:this._getPercent(t.min),o=n?1:this._getPercent(e);switch(a){case GaugeDirection.Right:s.left+=s.width*r;s.width*=o-r;break;case GaugeDirection.Left:s.left=s.right-s.width*o;s.width=s.width*(o-r);break;case GaugeDirection.Down:s.top+=s.height*r;s.height*=o-r;break;case GaugeDirection.Up:s.top=s.bottom-s.height*o;s.height=s.height*(o-r)}return s}_getValueFromPoint(t){let e=this._getRangeRect(this._face),i=0;switch(this._getDirection()){case GaugeDirection.Right:i=e.width>0?(t.x-e.left)/e.width:0;break;case GaugeDirection.Left:i=e.width>0?(e.right-t.x)/e.width:0;break;case GaugeDirection.Up:i=e.height>0?(e.bottom-t.y)/e.height:0;break;case GaugeDirection.Down:i=e.height>0?(t.y-e.top)/e.height:0}return this.min+i*(this.max-this.min)}_getDirection(){let t=this._direction;if(this.rightToLeft)switch(t){case GaugeDirection.Left:t=GaugeDirection.Right;break;case GaugeDirection.Right:t=GaugeDirection.Left}return t}_getKey(t){switch(this._getDirection()){case GaugeDirection.Left:switch(t){case wijmo_1.Key.Left:t=wijmo_1.Key.Right;break;case wijmo_1.Key.Right:t=wijmo_1.Key.Left}break;case GaugeDirection.Down:switch(t){case wijmo_1.Key.Up:t=wijmo_1.Key.Down;break;case wijmo_1.Key.Down:t=wijmo_1.Key.Up}}return t}}exports.LinearGauge=LinearGauge;class BulletGraph extends LinearGauge{constructor(t,e){super(t,null);wijmo_1.addClass(this.hostElement,exports.BulletGraphClsNames.hostElement);this._pointer.thickness=.35;this._rngTarget=new Range("target");this._rngTarget.thickness=.8;this._rngTarget.color="black";this._rngGood=new Range("good");this._rngGood.color="rgba(0,0,0,.15)";this._rngBad=new Range("bad");this._rngBad.color="rgba(0,0,0,.3)";this.ranges.push(this._rngBad);this.ranges.push(this._rngGood);this.ranges.push(this._rngTarget);this.initialize(e)}get target(){return this._rngTarget.max}set target(t){this._rngTarget.max=t}get good(){return this._rngGood.max}set good(t){this._rngGood.max=t}get bad(){return this._rngBad.max}set bad(t){this._rngBad.max=t}_getRangeRect(t,e=t.max){let i=super._getRangeRect(t,e);if(t==this._rngTarget)switch(this._getDirection()){case GaugeDirection.Right:i.left=i.right-1;i.width=3;break;case GaugeDirection.Left:i.width=3;break;case GaugeDirection.Up:i.height=3;break;case GaugeDirection.Down:i.top=i.bottom-1;i.height=3}return i}}exports.BulletGraph=BulletGraph;wijmo_1._registerModule("wijmo.gauge",selfModule);
14
+ "use strict";var __importStar=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)Object.hasOwnProperty.call(t,i)&&(e[i]=t[i]);e.default=t;return e};Object.defineProperty(exports,"__esModule",{value:!0});const wijmo_1=require("@grapecity/wijmo"),selfModule=__importStar(require("@grapecity/wijmo.gauge"));exports.BulletGraphClsNames={hostElement:"wj-bulletgraph"};exports.GaugeClsNames={cover:"wj-cover",face:"wj-face",filter:"wj-gauge-filter",hostElement:"wj-gauge",innerNeedleCap:"wj-inner-needle-cap",max:"wj-max",min:"wj-min",needle:"wj-needle",needleCap:"wj-needle-cap",pointer:"wj-pointer",ranges:"wj-ranges",thumb:"wj-thumb",tickText:"wj-tick-text",ticks:"wj-ticks",value:"wj-value"};exports.LinearGaugeClsNames={hostElement:"wj-lineargauge"};exports.RadialGaugeClsNames={hostElement:"wj-radialgauge"};exports.RangeClsNames={ranges:"wj-ranges"};class Range{constructor(t){this._min=0;this._max=100;this._thickness=1;this.propertyChanged=new wijmo_1.Event;wijmo_1.isString(t)?this._name=t:wijmo_1.copy(this,t)}get min(){return this._min}set min(t){this._setProp("_min",wijmo_1.asNumber(t,!0))}get max(){return this._max}set max(t){this._setProp("_max",wijmo_1.asNumber(t,!0))}get color(){return this._color}set color(t){this._setProp("_color",wijmo_1.asString(t))}get thickness(){return this._thickness}set thickness(t){this._setProp("_thickness",wijmo_1.clamp(wijmo_1.asNumber(t),0,1))}get name(){return this._name}set name(t){this._setProp("_name",wijmo_1.asString(t))}onPropertyChanged(t){this.propertyChanged.raise(this,t)}_setProp(t,e){let i=this[t];if(e!=i){this[t]=e;let s=new wijmo_1.PropertyChangedEventArgs(t.substr(1),i,e);this.onPropertyChanged(s)}}}Range._ctr=0;exports.Range=Range;var ShowText,NeedleShape,NeedleLength,GaugeDirection;!function(t){t[t.None=0]="None";t[t.Value=1]="Value";t[t.MinMax=2]="MinMax";t[t.All=3]="All"}(ShowText=exports.ShowText||(exports.ShowText={}));class Gauge extends wijmo_1.Control{constructor(t,e){super(t,null,!0);this._ranges=new wijmo_1.ObservableArray;this._rngElements=[];this._format="n0";this._showRanges=!0;this._stackRanges=!1;this._shadow=!0;this._animated=!0;this._readOnly=!0;this._handleWheel=!0;this._step=1;this._showText=ShowText.None;this._showTicks=!1;this._showTickText=!1;this._thickness=.8;this._initialized=!1;this.valueChanged=new wijmo_1.Event;this._getPercent=function(t){let e=this.max>this.min?(t-this.min)/(this.max-this.min):0;return Math.max(0,Math.min(1,e))};Gauge._ctr++;let i=this.hostElement;wijmo_1.setAttribute(i,"role","slider",!0);let s=this.getTemplate();this.applyTemplate(`${wijmo_1.ControlClsNames.hostElement} ${exports.GaugeClsNames.hostElement}`,s,{_dSvg:"dsvg",_svg:"svg",_filter:"filter",_gFace:"gface",_gRanges:"granges",_gPointer:"gpointer",_gCover:"gcover",_pFace:"pface",_pPointer:"ppointer",_cValue:"cvalue",_tValue:"value",_tMin:"min",_tMax:"max",_pTicks:"pticks",_gTicks:"gticks",_gNeedle:"gneedle"});wijmo_1.setCss(this._dSvg,{width:"100%",height:"100%"});this._filterID="wj-gauge-filter-"+Gauge._ctr.toString(36);this._filter.setAttribute("id",this._filterID);this.face=new Range;this.pointer=new Range;this._ranges.collectionChanged.addHandler(()=>{this._ranges.forEach(t=>{wijmo_1.assert(t instanceof Range,"ranges array must contain Range objects.")});this._rangesDirty=!0;this.invalidate()});this.addEventListener(i,"keydown",this._keydown.bind(this));this.addEventListener(i,"click",t=>{if(0==t.button){this.focus();this._applyMouseValue(t)}});this.addEventListener(i,"mousedown",t=>{if(0==t.button){this.focus();this._dragging=!0;setTimeout(()=>{this._applyMouseValue(t)})}});this.addEventListener(i,"mousemove",t=>{this._dragging&&this.containsFocus()&&this._applyMouseValue(t,!0)});this.addEventListener(i,"mouseup",t=>{this._dragging=!1});this.addEventListener(i,"mouseleave",t=>{t.target==i&&(this._dragging=!1)});if("ontouchstart"in window){this.addEventListener(i,"touchstart",t=>{this.focus();!t.defaultPrevented&&this._applyMouseValue(t,!1)&&t.preventDefault()});this.addEventListener(i,"touchmove",t=>{!t.defaultPrevented&&this._applyMouseValue(t,!0)&&t.preventDefault()})}this.addEventListener(i,"wheel",t=>{if(this._handleWheel&&!this.isReadOnly&&!t.defaultPrevented&&this.containsFocus()&&null!=this.value&&this.hitTest(t)){let e=wijmo_1.clamp(-t.deltaY,-1,1);this.value=wijmo_1.clamp(this.value+(this.step||1)*e,this.min,this.max);t.preventDefault()}});this.isReadOnly=!0;this.initialize(e);this.invalidate()}static get controlTemplate(){Gauge._ctrlTemplate||(Gauge._ctrlTemplate='<div wj-part="dsvg" dir="ltr"><svg wj-part="svg" width="100%" height="100%"><defs><filter wj-part="filter"><feOffset dx="3" dy="3"></feOffset><feGaussianBlur result="offset-blur" stdDeviation="5"></feGaussianBlur><feComposite operator="out" in="SourceGraphic" in2="offset-blur" result="inverse"></feComposite><feFlood flood-color="black" flood-opacity="0.2" result="color"></feFlood><feComposite operator="in" in="color" in2="inverse" result="shadow"></feComposite><feComposite operator="over" in="shadow" in2="SourceGraphic"></feComposite></filter></defs>'+`<g wj-part="gface" class="${exports.GaugeClsNames.face}">`+'<path wj-part="pface"/></g>'+`<g wj-part="granges" class="${exports.GaugeClsNames.ranges}"/>`+`<g wj-part="gpointer" class="${exports.GaugeClsNames.pointer}">`+'<path wj-part="ppointer"/></g>'+`<g wj-part="gcover" class="${exports.GaugeClsNames.cover}">`+`<path wj-part="pticks" class="${exports.GaugeClsNames.ticks}"/>`+`<g wj-part="gticks" aria-hidden="true" class="${exports.GaugeClsNames.tickText}"/>`+`<circle wj-part="cvalue" class="${exports.GaugeClsNames.pointer} ${exports.GaugeClsNames.thumb}"/>`+`<g wj-part="gneedle" class="${exports.GaugeClsNames.needle}"/>`+`<text wj-part="value" class="${exports.GaugeClsNames.value}"/>`+`<text wj-part="min" class="${exports.GaugeClsNames.min}" aria-hidden="true"/>`+`<text wj-part="max" class="${exports.GaugeClsNames.max}" aria-hidden="true"/>`+"</g></svg></div>");return Gauge._ctrlTemplate}static set controlTemplate(t){Gauge._ctrlTemplate=t}get value(){return this._pointer.max}set value(t){if(t!=this.value){this._pointer.max=wijmo_1.asNumber(t,!0);this._updateAria()}}get min(){return this._face.min}set min(t){if(t!=this.min){this._face.min=wijmo_1.asNumber(t);this._updateAria()}}get max(){return this._face.max}set max(t){if(t!=this.max){this._face.max=wijmo_1.asNumber(t);this._updateAria()}}get origin(){return this._origin}set origin(t){if(t!=this._origin){this._origin=wijmo_1.asNumber(t,!0);this.invalidate()}}get isReadOnly(){return this._readOnly}set isReadOnly(t){this._readOnly=wijmo_1.asBoolean(t);wijmo_1.setAttribute(this._svg,"cursor",this._readOnly?null:"pointer");wijmo_1.toggleClass(this.hostElement,wijmo_1.ControlStateClsNames.readOnly,this.isReadOnly)}get handleWheel(){return this._handleWheel}set handleWheel(t){this._handleWheel=wijmo_1.asBoolean(t)}get step(){return this._step}set step(t){if(t!=this._step){this._step=wijmo_1.asNumber(t,!0);this.invalidate()}}get format(){return this._format}set format(t){if(t!=this._format){this._format=wijmo_1.asString(t);this.invalidate()}}get getText(){return this._getText}set getText(t){if(t!=this._getText){this._getText=wijmo_1.asFunction(t);this.invalidate()}}get thickness(){return this._thickness}set thickness(t){if(t!=this._thickness){this._thickness=wijmo_1.clamp(wijmo_1.asNumber(t,!1),0,1);this.invalidate()}}get face(){return this._face}set face(t){if(t!=this._face){this._face&&this._face.propertyChanged.removeHandler(this._rangeChanged);this._face=wijmo_1.asType(t,Range);this._face&&this._face.propertyChanged.addHandler(this._rangeChanged,this);this.invalidate()}}get pointer(){return this._pointer}set pointer(t){if(t!=this._pointer){let e=null;if(this._pointer){e=this.value;this._pointer.propertyChanged.removeHandler(this._rangeChanged)}this._pointer=wijmo_1.asType(t,Range);if(this._pointer){e&&(this.value=e);this._pointer.propertyChanged.addHandler(this._rangeChanged,this)}this.invalidate()}}get showText(){return this._showText}set showText(t){if((t=wijmo_1.asEnum(t,ShowText))!=this._showText){this._showText=t;this.invalidate()}}get showTicks(){return this._showTicks}set showTicks(t){if(t!=this._showTicks){this._showTicks=wijmo_1.asBoolean(t);this.invalidate()}}get showTickText(){return this._showTickText}set showTickText(t){if(t!=this._showTickText){this._showTickText=wijmo_1.asBoolean(t);this.invalidate()}}get tickSpacing(){return this._tickSpacing}set tickSpacing(t){if(t!=this._tickSpacing){this._tickSpacing=wijmo_1.asNumber(t,!0);this.invalidate()}}get thumbSize(){return this._thumbSize}set thumbSize(t){if(t!=this._thumbSize){this._thumbSize=wijmo_1.asNumber(t,!0,!0);this.invalidate()}}get showRanges(){return this._showRanges}set showRanges(t){if(t!=this._showRanges){this._showRanges=wijmo_1.asBoolean(t);this._animColor=null;this._rangesDirty=!0;this.invalidate()}}get stackRanges(){return this._stackRanges}set stackRanges(t){if(t!=this._stackRanges){this._stackRanges=wijmo_1.asBoolean(t);this._animColor=null;this._rangesDirty=!0;this.invalidate()}}get hasShadow(){return this._shadow}set hasShadow(t){if(t!=this._shadow){this._shadow=wijmo_1.asBoolean(t);this.invalidate()}}get isAnimated(){return this._animated}set isAnimated(t){this._animated=wijmo_1.asBoolean(t)}get ranges(){return this._ranges}onValueChanged(t){this.valueChanged.raise(this,t)}refresh(t=!0){super.refresh(t);if(this._rangesDirty){this._rangesDirty=!1;let t=this._gRanges;this._rngElements.forEach(t=>{t.rng.propertyChanged.removeHandler(this._rangeChanged)});for(;t.lastChild;)t.removeChild(t.lastChild);this._rngElements=[];this._showRanges&&this._ranges.forEach(e=>{e.propertyChanged.addHandler(this._rangeChanged,this);this._rngElements.push({rng:e,el:this._createElement("path",t)})})}this._showElement(this._tValue,0!=(this.showText&ShowText.Value));this._showElement(this._tMin,0!=(this.showText&ShowText.MinMax));this._showElement(this._tMax,0!=(this.showText&ShowText.MinMax));this._showElement(this._cValue,0!=(this.showText&ShowText.Value)||this._thumbSize>0);this._updateText();let e=this._getFilterUrl();wijmo_1.setAttribute(this._pFace,"filter",e);wijmo_1.setAttribute(this._pPointer,"filter",e);this._updateRange(this._face);this._updateRange(this._pointer);this._updateTicks();this._ranges.forEach(t=>{this._updateRange(t)});this._initialized=!0}hitTest(t,e){wijmo_1.isNumber(t)&&wijmo_1.isNumber(e)?t=new wijmo_1.Point(t,e):t instanceof wijmo_1.Point||(t=wijmo_1.mouseToPage(t));t=wijmo_1.asType(t,wijmo_1.Point);let i=wijmo_1.Rect.fromBoundingRect(this._dSvg.getBoundingClientRect());t.x-=i.left+pageXOffset;t.y-=i.top+pageYOffset;return this._getValueFromPoint(t)}dispose(){if(this._animInterval){clearInterval(this._animInterval);this._animInterval=null}super.dispose()}static _getBBox(t){try{return t.getBBox()}catch(t){return{x:0,y:0,width:0,height:0}}}_getFilterUrl(){return this.hasShadow&&!wijmo_1.isiOS()?"url(#"+this._filterID+")":null}_getRangeElement(t){if(t==this._face)return this._pFace;if(t==this._pointer)return this._pPointer;for(let e=0;e<this._rngElements.length;e++){let i=this._rngElements[e];if(i.rng==t)return i.el}return null}_rangeChanged(t,e){if(t==this._pointer&&"max"==e.propertyName){this.onValueChanged();this._updateText()}if(t!=this._face){if(t==this._pointer&&"max"==e.propertyName){if(this._animInterval){clearInterval(this._animInterval);this._updateRange(t,e.oldValue)}if(this.isAnimated&&!this.isUpdating&&this._initialized){let i=this._getPointerColor(e.oldValue),s=this._getPointerColor(e.newValue),a=i?new wijmo_1.Color(i):null,h=s?new wijmo_1.Color(s):null,n=wijmo_1.clamp(Math.abs(e.newValue-e.oldValue)/(this.max-this.min),0,1);this._animInterval=wijmo_1.animate(i=>{this._animColor=a&&h?wijmo_1.Color.interpolate(a,h,i).toString():null;this._updateRange(t,e.oldValue+i*(e.newValue-e.oldValue));if(i>=1){this._animColor=null;this._animInterval=null;this._updateRange(t);this._updateText()}},n*wijmo_1.Control._ANIM_DEF_DURATION);return}}this._updateRange(t)}else this.invalidate()}_createElement(t,e,i){let s=document.createElementNS(Gauge._SVGNS,t);i&&s.setAttribute("class",i);e.appendChild(s);return s}_centerText(t,e,i){if("none"!=t.getAttribute("display")){let s=wijmo_1.Globalize.format(e,this.format);if(wijmo_1.isFunction(this.getText)){let i="";t==this._tValue?i="value":t==this._tMin?i="min":t==this._tMax&&(i="max");i&&(s=this.getText(this,i,e,s))}t.textContent=s;let a=wijmo_1.Rect.fromBoundingRect(Gauge._getBBox(t)),h=i.x-Math.round(a.width)/2,n=i.y+Math.round(a.height)/4;t.setAttribute("x",this._fix(h));t.setAttribute("y",this._fix(n))}}_copy(t,e){if("ranges"==t){wijmo_1.asArray(e).forEach(t=>{let e=new Range(t);this.ranges.push(e)});return!0}if("pointer"==t){wijmo_1.copy(this.pointer,e);return!0}return!1}_showElement(t,e){wijmo_1.setAttribute(t,"display",e?null:"none")}_updateRange(t,e=t.max){t==this._pointer&&(t.min=null!=this.origin?this.origin:this.min<0&&this.max>0?0:this.min);let i=this._getRangeElement(t);if(i){this._updateRangeElement(i,t,e);let s=t.color;t==this._pointer&&(s=this._animColor?this._animColor:this._getPointerColor(t.max));wijmo_1.setAttribute(i,"style",s?"fill:"+s:null)}}_getPointerColor(t){if(!this._showRanges){let e;for(let i=0;i<this._ranges.length;i++){let s=this._ranges[i];if(t>=s.min&&t<=s.max){e=s;break}}if(e)return e.color}return this._pointer.color}_keydown(t){if(!this._readOnly&&this._step){let e=!0;switch(this._getKey(t.keyCode)){case wijmo_1.Key.Left:case wijmo_1.Key.Down:this.value=wijmo_1.clamp(this.value-this._step,this.min,this.max);break;case wijmo_1.Key.Right:case wijmo_1.Key.Up:this.value=wijmo_1.clamp(this.value+this._step,this.min,this.max);break;case wijmo_1.Key.Home:this.value=this.min;break;case wijmo_1.Key.End:this.value=this.max;break;default:e=!1}e&&t.preventDefault()}}_getKey(t){return t}_applyMouseValue(t,e){if(!this.isReadOnly&&this.containsFocus()){let i=this.hitTest(t);if(null!=i){let t=this._animated,s=this._step;e&&(this._animated=!1);s&&(i=Math.round(i/s)*s);this.value=wijmo_1.clamp(i,this.min,this.max);this._animated=t;return!0}}return!1}_updateRangeElement(t,e,i){wijmo_1.assert(!1,"Gauge is an abstract class.")}_updateText(){wijmo_1.assert(!1,"Gauge is an abstract class.")}_updateTicks(){wijmo_1.assert(!1,"Gauge is an abstract class.")}_getValueFromPoint(t){return null}_fix(t){return wijmo_1.isNumber(t)?parseFloat(t.toFixed(4)).toString():this._fix(t.x)+" "+this._fix(t.y)}_updateAria(){let t=this.hostElement;if(t){wijmo_1.setAttribute(t,"aria-valuemin",this.min);wijmo_1.setAttribute(t,"aria-valuemax",this.max);wijmo_1.setAttribute(t,"aria-valuenow",this.value)}}}Gauge._SVGNS="http://www.w3.org/2000/svg";Gauge._ctr=0;Gauge._ctrlTemplate="";exports.Gauge=Gauge;!function(t){t[t.None=0]="None";t[t.Triangle=1]="Triangle";t[t.Diamond=2]="Diamond";t[t.Hexagon=3]="Hexagon";t[t.Rectangle=4]="Rectangle";t[t.Arrow=5]="Arrow";t[t.WideArrow=6]="WideArrow";t[t.Pointer=7]="Pointer";t[t.WidePointer=8]="WidePointer";t[t.Outer=9]="Outer"}(NeedleShape=exports.NeedleShape||(exports.NeedleShape={}));!function(t){t[t.Outer=0]="Outer";t[t.Middle=1]="Middle";t[t.Inner=2]="Inner"}(NeedleLength=exports.NeedleLength||(exports.NeedleLength={}));class RadialGauge extends Gauge{constructor(t,e){super(t,null);this._startAngle=0;this._sweepAngle=180;this._autoScale=!0;this._ndlShape=NeedleShape.None;this._ndlLength=NeedleLength.Middle;wijmo_1.addClass(this.hostElement,exports.RadialGaugeClsNames.hostElement);this._thickness=.4;this.showText=ShowText.All;this.initialize(e)}static get controlTemplate(){RadialGauge._ctrlTemplate||(RadialGauge._ctrlTemplate=Gauge.controlTemplate);return RadialGauge._ctrlTemplate}static set controlTemplate(t){RadialGauge._ctrlTemplate=t}get startAngle(){return this._startAngle}set startAngle(t){if(t!=this._startAngle){this._startAngle=wijmo_1.clamp(wijmo_1.asNumber(t,!1),-360,360);this.invalidate()}}get sweepAngle(){return this._sweepAngle}set sweepAngle(t){if(t!=this._sweepAngle){this._sweepAngle=wijmo_1.clamp(wijmo_1.asNumber(t,!1),-360,360);this.invalidate()}}get autoScale(){return this._autoScale}set autoScale(t){if(t!=this._autoScale){this._autoScale=wijmo_1.asBoolean(t);this.invalidate()}}get faceBounds(){return this._rcSvg?this._rcSvg.clone():null}get clientSize(){wijmo_1._deprecated("clientSize","faceBounds");let t=this._rcSvg;return t?new wijmo_1.Size(t.width,t.height):null}get needleElement(){return this._ndlElement}set needleElement(t){if(t!=this._ndlElement){this._ndlShape=0;this._ndlElement=wijmo_1.asType(t,SVGElement,!0);let e=this._gNeedle;for(;e.firstChild;)wijmo_1.removeChild(e.firstChild);if(this._ndlElement){wijmo_1.setAttribute(e,"transform","scale(0)");e.appendChild(this._ndlElement)}this.invalidate()}}get needleShape(){return this._ndlShape}set needleShape(t){if(t!=this._ndlShape){if((t=wijmo_1.asEnum(t,NeedleShape))===this._ndlShape)return;let e=null;switch(t){case NeedleShape.Triangle:e=RadialGauge.createNeedleElement([{x:-10,y:10},{x:100,y:0}]);break;case NeedleShape.Diamond:e=RadialGauge.createNeedleElement([{x:-20,y:0},{x:0,y:10},{x:100,y:0}]);break;case NeedleShape.Hexagon:e=RadialGauge.createNeedleElement([{x:-15,y:0},{x:-10,y:5},{x:10,y:5},{x:100,y:0}]);break;case NeedleShape.Rectangle:e=RadialGauge.createNeedleElement([{x:-20,y:3},{x:100,y:3}],10);break;case NeedleShape.Arrow:e=RadialGauge.createNeedleElement([{x:-20,y:3},{x:70,y:3},{x:70,y:15},{x:100,y:0}],10);break;case NeedleShape.WideArrow:e=RadialGauge.createNeedleElement([{x:-30,y:5},{x:-40,y:15},{x:-20,y:15},{x:-10,y:5},{x:80,y:5},{x:70,y:15},{x:100,y:0}]);break;case NeedleShape.Pointer:e=RadialGauge.createNeedleElement([{x:0,y:10},{x:100,y:0}],20,10);break;case NeedleShape.WidePointer:e=RadialGauge.createNeedleElement([{x:0,y:20},{x:100,y:0}],20,10);break;case NeedleShape.Outer:e=RadialGauge.createNeedleElement([{x:60,y:20},{x:100,y:0}])}this.needleElement=e;this._ndlShape=t;this.invalidate()}}get needleLength(){return this._ndlLength}set needleLength(t){if(t!=this._ndlLength){this._ndlLength=wijmo_1.asEnum(t,NeedleLength);this.invalidate()}}static createNeedleElement(t,e,i){let s="";for(let e=0;e<t.length;e++){let i=t[e];if(e==t.length-1&&0==i.y)break;s+=(e>0?" L ":"M ")+i.x+" "+i.y}for(let e=t.length-1;e>=0;e--){let i=t[e];s+=" L "+i.x+" "+-i.y}s+=" Z";let a="http://www.w3.org/2000/svg",h=document.createElementNS(a,"g"),n=document.createElementNS(a,"path");wijmo_1.setAttribute(n,"d",s);h.appendChild(n);if(e){let t=document.createElementNS(a,"circle");wijmo_1.addClass(t,exports.GaugeClsNames.needleCap);wijmo_1.setAttribute(t,"r",e);h.appendChild(t);if(i){t=document.createElementNS(a,"circle");wijmo_1.addClass(t,exports.GaugeClsNames.innerNeedleCap);wijmo_1.setAttribute(t,"r",i);h.appendChild(t)}}return h}refresh(t=!0){wijmo_1.setAttribute(this._svg,"viewBox",null);this._rcSvg=wijmo_1.Rect.fromBoundingRect(this._dSvg.getBoundingClientRect());super.refresh(t);this._ctmInv=null;this._ptSvg=null;if(this._autoScale){wijmo_1.setAttribute(this._svg,"viewBox",null);let t=wijmo_1.Rect.fromBoundingRect(Gauge._getBBox(this._pFace));0!=(this.showText&ShowText.Value)&&(t=wijmo_1.Rect.union(t,wijmo_1.Rect.fromBoundingRect(Gauge._getBBox(this._tValue))));if(0!=(this.showText&ShowText.MinMax)){t=wijmo_1.Rect.union(t,wijmo_1.Rect.fromBoundingRect(Gauge._getBBox(this._tMin)));t=wijmo_1.Rect.union(t,wijmo_1.Rect.fromBoundingRect(Gauge._getBBox(this._tMax)))}let e=[this._fix(t.left),this._fix(t.top),this._fix(t.width),this._fix(t.height)].join(" ");wijmo_1.setAttribute(this._svg,"viewBox",e);let i=this._pFace.getCTM();this._ctmInv=i?i.inverse():null;this._ptSvg=this._svg.createSVGPoint()}}_updateRangeElement(t,e,i){if(this._rcSvg){let s=this._rcSvg,a=new wijmo_1.Point(s.width/2,s.height/2),h=Math.min(s.width,s.height)/2,n=h*this.thickness,r=n*e.thickness,o=h-(n-r)/2,l=o-r,_=this._getStartAngle(),g=this._getSweepAngle(),c=e==this._face,m=c?0:this._getPercent(e.min),u=_+g*m,d=g*((c?1:this._getPercent(i))-m);if(this.stackRanges&&e!=this.face&&e!=this.pointer){let t=this.ranges.indexOf(e);if(t>-1){let e=this.ranges.length,i=(o-l)/e;o=(l+=(e-1-t)*i)+i}}this._updateSegment(t,a,o,l,u,d);if(e==this._pointer){let t=this._fix;if(this.thumbSize>0){let s=this._animColor?this._animColor:this._getPointerColor(e.max),h=this._getPoint(a,_+g*this._getPercent(i),(o+l)/2),n=this._cValue;wijmo_1.setAttribute(n,"cx",t(h.x));wijmo_1.setAttribute(n,"cy",t(h.y));wijmo_1.setAttribute(n,"style",s?"fill:"+s:null);wijmo_1.setAttribute(n,"r",t(this.thumbSize/2))}if(this.needleElement){let e=o;this._ndlLength==NeedleLength.Inner?e=l:this._ndlLength==NeedleLength.Middle&&(e=(l+o)/2);let i="translate({cx}, {cy}) scale({scale}) rotate({angle})".replace("{cx}",t(a.x)).replace("{cy}",t(a.y)).replace("{scale}",t(e/100)).replace("{angle}",t(u+d));this._gNeedle.setAttribute("transform",i)}}}}_getStartAngle(){let t=this.startAngle+180;this.rightToLeft&&(t=180-t);return t}_getSweepAngle(){let t=this.sweepAngle;this.rightToLeft&&(t=-t);return t}_updateText(){if(this._rcSvg){let t=this._rcSvg,e=new wijmo_1.Point(t.width/2,t.height/2),i=Math.min(t.width,t.height)/2,s=Math.max(0,i*(1-this.thickness)),a=this._getStartAngle(),h=this._getSweepAngle();this._showElement(this._cValue,this.thumbSize>0);let n=0!=(this.showText&ShowText.MinMax)&&Math.abs(h)<=300;this._showElement(this._tMin,n);this._showElement(this._tMax,n);this._centerText(this._tValue,this.value,e);let r=10*(this._getSweepAngle()<0?-1:1);this._centerText(this._tMin,this.min,this._getPoint(e,a-r,(i+s)/2));this._centerText(this._tMax,this.max,this._getPoint(e,a+h+r,(i+s)/2))}}_updateTicks(){let t=this.tickSpacing&&this.tickSpacing>0?this.tickSpacing:this.step,e="",i=this._gTicks;for(;i.firstChild;)wijmo_1.removeChild(i.firstChild);if(this.showTicks&&t>0){let s=this._rcSvg,a=new wijmo_1.Point(s.width/2,s.height/2),h=Math.min(s.width,s.height)/2,n=h*this.thickness,r=n*this._face.thickness,o=h-(n-r)/2,l=o-r,_=1.15*o,g=this._getStartAngle(),c=this._getSweepAngle();for(let s=this.min;s<=this.max;s+=t){let t=g+c*this._getPercent(s),h=this._fix(this._getPoint(a,t,l)),n=this._fix(this._getPoint(a,t,o));s>this.min&&s<this.max&&(e+="M "+h+" L "+n+" ");if(this.showTickText){let e=this._createElement("text",i),h=this._getPoint(a,t,_);this._centerText(e,s,h)}}}this._pTicks.setAttribute("d",e)}_updateSegment(t,e,i,s,a,h){h=Math.min(Math.max(h,-359.99),359.99);let n=this._getPoint(e,a,s),r=this._getPoint(e,a,i),o=this._getPoint(e,a+h,i),l=this._getPoint(e,a+h,s),_={large:Math.abs(h)>180?1:0,cw:h>0?1:0,ccw:h>0?0:1,or:this._fix(i),ir:this._fix(s),p1:this._fix(n),p2:this._fix(r),p3:this._fix(o),p4:this._fix(l)},g=wijmo_1.format("M {p1} L {p2} A {or} {or} 0 {large} {cw} {p3} L {p4} A {ir} {ir} 0 {large} {ccw} {p1} Z",_);t.setAttribute("d",g)}_getPoint(t,e,i){e=e*Math.PI/180;return new wijmo_1.Point(t.x+i*Math.cos(e),t.y+i*Math.sin(e))}_getValueFromPoint(t){if(this.autoScale&&this._ctmInv){this._ptSvg.x=t.x;this._ptSvg.y=t.y;this._ptSvg=this._ptSvg.matrixTransform(this._ctmInv);t.x=this._ptSvg.x;t.y=this._ptSvg.y}if(!this._rcSvg||!this.sweepAngle)return null;let e=this._rcSvg,i=new wijmo_1.Point(e.width/2,e.height/2),s=Math.min(e.width,e.height)/2,a=t.x-i.x,h=t.y-i.y,n=h*h+a*a;if(n<400||n>(s+20)*(s+20))return null;let r=180*(Math.PI-Math.atan2(-h,a))/Math.PI,o=this.startAngle,l=this.sweepAngle,_=o+l;this.rightToLeft&&(r=180-r);if(l>0){for(;r<o;)r+=360;for(;r>_;)r-=360}else{for(;r<_;)r+=360;for(;r>o;)r-=360}if((r-o)*(r-_)>0){let t=this._getPoint(i,r,s),e=this._getPoint(i,o,s),a=this._getPoint(i,_,s);r=this._getDist2(t,e)<this._getDist2(t,a)?o:_}let g=l?wijmo_1.clamp(Math.abs(r-o)/Math.abs(l),0,1):0;return this.min+g*(this.max-this.min)}_getDist2(t,e){let i=t.x-e.x,s=t.y-e.y;return i*i+s*s}}RadialGauge._ctrlTemplate="";exports.RadialGauge=RadialGauge;!function(t){t[t.Right=0]="Right";t[t.Left=1]="Left";t[t.Up=2]="Up";t[t.Down=3]="Down"}(GaugeDirection=exports.GaugeDirection||(exports.GaugeDirection={}));class LinearGauge extends Gauge{constructor(t,e){super(t,null);this._direction=GaugeDirection.Right;wijmo_1.addClass(this.hostElement,exports.LinearGaugeClsNames.hostElement);this.initialize(e)}static get controlTemplate(){LinearGauge._ctrlTemplate||(LinearGauge._ctrlTemplate=Gauge.controlTemplate);return LinearGauge._ctrlTemplate}static set controlTemplate(t){LinearGauge._ctrlTemplate=t}get direction(){return this._direction}set direction(t){if((t=wijmo_1.asEnum(t,GaugeDirection))!=this._direction){this._direction=t;this.invalidate()}}get faceBounds(){return this._getRangeRect(this._face)}_updateRangeElement(t,e,i){let s=this._getRangeRect(e,i);this._updateSegment(t,s);let a=e==this._pointer&&0!=(this.showText&ShowText.Value),h=a||e==this._pointer&&this.thumbSize>0,n=s.left+s.width/2,r=s.top+s.height/2;switch(this._getDirection()){case GaugeDirection.Right:n=s.right;break;case GaugeDirection.Left:n=s.left;break;case GaugeDirection.Up:r=s.top;break;case GaugeDirection.Down:r=s.bottom}a&&this._centerText(this._tValue,i,new wijmo_1.Point(n,r));if(a||h){s=wijmo_1.Rect.fromBoundingRect(Gauge._getBBox(this._tValue));let t=this._animColor?this._animColor:this._getPointerColor(e.max),i=null!=this.thumbSize?this.thumbSize/2:.8*Math.max(s.width,s.height),a=this._cValue;wijmo_1.setAttribute(a,"cx",this._fix(n));wijmo_1.setAttribute(a,"cy",this._fix(r));wijmo_1.setAttribute(a,"style",t?"fill:"+t:null);wijmo_1.setAttribute(a,"r",this._fix(i))}}_updateText(){let t=this._getRangeRect(this._face);switch(this._getDirection()){case GaugeDirection.Right:this._setText(this._tMin,this.min,t,"left");this._setText(this._tMax,this.max,t,"right");break;case GaugeDirection.Left:this._setText(this._tMin,this.min,t,"right");this._setText(this._tMax,this.max,t,"left");break;case GaugeDirection.Up:this._setText(this._tMin,this.min,t,"bottom");this._setText(this._tMax,this.max,t,"top");break;case GaugeDirection.Down:this._setText(this._tMin,this.min,t,"top");this._setText(this._tMax,this.max,t,"bottom")}}_updateTicks(){let t=this.tickSpacing&&this.tickSpacing>0?this.tickSpacing:this.step,e="",i=this._gTicks;for(;i.firstChild;)wijmo_1.removeChild(i.firstChild);if(this.showTicks&&t>0){let s,a=this._getRangeRect(this._face),h=new wijmo_1.Point(a.left-.75*a.width,a.top-.75*a.height),n=this._fix;for(let r=this.min;r<=this.max;r+=t){let t=null;switch(this._getDirection()){case GaugeDirection.Right:h.x=a.left+a.width*this._getPercent(r);t="M "+(s=n(h.x))+" "+n(a.top)+" L "+s+" "+n(a.bottom)+" ";break;case GaugeDirection.Left:h.x=a.right-a.width*this._getPercent(r);t="M "+(s=n(h.x))+" "+n(a.top)+" L "+s+" "+n(a.bottom)+" ";break;case GaugeDirection.Up:h.y=a.bottom-a.height*this._getPercent(r);s=n(h.y);t="M "+n(a.left)+" "+s+" L "+n(a.right)+" "+s+" ";break;case GaugeDirection.Down:h.y=a.top+a.height*this._getPercent(r);s=n(h.y);t="M "+n(a.left)+" "+s+" L "+n(a.right)+" "+s+" "}r>this.min&&r<this.max&&(e+=t);if(this.showTickText){let t=this._createElement("text",i);this._centerText(t,r,h)}}}this._pTicks.setAttribute("d",e)}_updateSegment(t,e){let i={p1:this._fix(new wijmo_1.Point(e.left,e.top)),p2:this._fix(new wijmo_1.Point(e.right,e.top)),p3:this._fix(new wijmo_1.Point(e.right,e.bottom)),p4:this._fix(new wijmo_1.Point(e.left,e.bottom))},s=wijmo_1.format("M {p1} L {p2} L {p3} L {p4} Z",i);t.setAttribute("d",s)}_setText(t,e,i,s){if("none"!=t.getAttribute("display")){let a=wijmo_1.Globalize.format(e,this.format);if(wijmo_1.isFunction(this.getText)){let i=t==this._tValue?"value":t==this._tMin?"min":t==this._tMax?"max":null;wijmo_1.assert(null!=i,"unknown element");a=this.getText(this,i,e,a)}t.textContent=a;let h=wijmo_1.Rect.fromBoundingRect(Gauge._getBBox(t)),n=new wijmo_1.Point(i.left+i.width/2-h.width/2,i.top+i.height/2+h.height/2);switch(s){case"top":n.y=i.top-4;break;case"left":n.x=i.left-4-h.width;break;case"right":n.x=i.right+4;break;case"bottom":n.y=i.bottom+4+h.height}t.setAttribute("x",this._fix(n.x));t.setAttribute("y",this._fix(n.y))}}_getRangeRect(t,e=t.max){let i=this.hostElement,s=new wijmo_1.Rect(0,0,i.clientWidth,i.clientHeight),a=this._getDirection(),h=this.thumbSize?Math.ceil(this.thumbSize/2):0;if(this.showText!=ShowText.None){let t=parseInt(getComputedStyle(i).fontSize);isNaN(t)||(h=Math.max(h,3*t))}switch(a){case GaugeDirection.Right:case GaugeDirection.Left:s=s.inflate(-h,-s.height*(1-this.thickness*t.thickness)/2);break;case GaugeDirection.Up:case GaugeDirection.Down:s=s.inflate(-s.width*(1-this.thickness*t.thickness)/2,-h)}if(this.stackRanges&&t!=this.face&&t!=this.pointer){let e=this.ranges.indexOf(t);if(e>-1){let t=this.ranges.length;switch(a){case GaugeDirection.Right:case GaugeDirection.Left:s.height/=t;s.top+=e*s.height;break;case GaugeDirection.Up:case GaugeDirection.Down:s.width/=t;s.left+=e*s.width}}}let n=t==this._face,r=n?0:this._getPercent(t.min),o=n?1:this._getPercent(e);switch(a){case GaugeDirection.Right:s.left+=s.width*r;s.width*=o-r;break;case GaugeDirection.Left:s.left=s.right-s.width*o;s.width=s.width*(o-r);break;case GaugeDirection.Down:s.top+=s.height*r;s.height*=o-r;break;case GaugeDirection.Up:s.top=s.bottom-s.height*o;s.height=s.height*(o-r)}return s}_getValueFromPoint(t){let e=this._getRangeRect(this._face),i=0;switch(this._getDirection()){case GaugeDirection.Right:i=e.width>0?(t.x-e.left)/e.width:0;break;case GaugeDirection.Left:i=e.width>0?(e.right-t.x)/e.width:0;break;case GaugeDirection.Up:i=e.height>0?(e.bottom-t.y)/e.height:0;break;case GaugeDirection.Down:i=e.height>0?(t.y-e.top)/e.height:0}return this.min+i*(this.max-this.min)}_getDirection(){let t=this._direction;if(this.rightToLeft)switch(t){case GaugeDirection.Left:t=GaugeDirection.Right;break;case GaugeDirection.Right:t=GaugeDirection.Left}return t}_getKey(t){switch(this._getDirection()){case GaugeDirection.Left:switch(t){case wijmo_1.Key.Left:t=wijmo_1.Key.Right;break;case wijmo_1.Key.Right:t=wijmo_1.Key.Left}break;case GaugeDirection.Down:switch(t){case wijmo_1.Key.Up:t=wijmo_1.Key.Down;break;case wijmo_1.Key.Down:t=wijmo_1.Key.Up}}return t}}LinearGauge._ctrlTemplate="";exports.LinearGauge=LinearGauge;class BulletGraph extends LinearGauge{constructor(t,e){super(t,null);wijmo_1.addClass(this.hostElement,exports.BulletGraphClsNames.hostElement);this._pointer.thickness=.35;this._rngTarget=new Range("target");this._rngTarget.thickness=.8;this._rngTarget.color="black";this._rngGood=new Range("good");this._rngGood.color="rgba(0,0,0,.15)";this._rngBad=new Range("bad");this._rngBad.color="rgba(0,0,0,.3)";this.ranges.push(this._rngBad);this.ranges.push(this._rngGood);this.ranges.push(this._rngTarget);this.initialize(e)}static get controlTemplate(){BulletGraph._ctrlTemplate||(BulletGraph._ctrlTemplate=LinearGauge.controlTemplate);return BulletGraph._ctrlTemplate}static set controlTemplate(t){BulletGraph._ctrlTemplate=t}get target(){return this._rngTarget.max}set target(t){this._rngTarget.max=t}get good(){return this._rngGood.max}set good(t){this._rngGood.max=t}get bad(){return this._rngBad.max}set bad(t){this._rngBad.max=t}_getRangeRect(t,e=t.max){let i=super._getRangeRect(t,e);if(t==this._rngTarget)switch(this._getDirection()){case GaugeDirection.Right:i.left=i.right-1;i.width=3;break;case GaugeDirection.Left:i.width=3;break;case GaugeDirection.Up:i.height=3;break;case GaugeDirection.Down:i.top=i.bottom-1;i.height=3}return i}}BulletGraph._ctrlTemplate="";exports.BulletGraph=BulletGraph;wijmo_1._registerModule("wijmo.gauge",selfModule);
package/es2015-esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * Wijmo Library 5.20242.30
3
+ * Wijmo Library 5.20251.40
4
4
  * https://developer.mescius.com/wijmo
5
5
  *
6
6
  * Copyright(c) MESCIUS inc. All rights reserved.
@@ -11,4 +11,4 @@
11
11
  *
12
12
  */
13
13
 
14
- import{isString,copy,asNumber,asString,clamp,PropertyChangedEventArgs,Event,assert,setAttribute,animate,setCss,toggleClass,mouseToPage,isiOS,isNumber,isFunction,asBoolean,asType,asFunction,asEnum,asArray,Globalize,Control,Color,Point,Rect,Key,ObservableArray,ControlStateClsNames,ControlClsNames,addClass,format,removeChild,Size,_deprecated,_registerModule}from"@grapecity/wijmo";import*as selfModule from"@grapecity/wijmo.gauge";export const BulletGraphClsNames={hostElement:"wj-bulletgraph"};export const GaugeClsNames={cover:"wj-cover",face:"wj-face",filter:"wj-gauge-filter",hostElement:"wj-gauge",innerNeedleCap:"wj-inner-needle-cap",max:"wj-max",min:"wj-min",needle:"wj-needle",needleCap:"wj-needle-cap",pointer:"wj-pointer",ranges:"wj-ranges",thumb:"wj-thumb",tickText:"wj-tick-text",ticks:"wj-ticks",value:"wj-value"};export const LinearGaugeClsNames={hostElement:"wj-lineargauge"};export const RadialGaugeClsNames={hostElement:"wj-radialgauge"};export const RangeClsNames={ranges:"wj-ranges"};export class Range{constructor(t){this._min=0;this._max=100;this._thickness=1;this.propertyChanged=new Event;isString(t)?this._name=t:copy(this,t)}get min(){return this._min}set min(t){this._setProp("_min",asNumber(t,!0))}get max(){return this._max}set max(t){this._setProp("_max",asNumber(t,!0))}get color(){return this._color}set color(t){this._setProp("_color",asString(t))}get thickness(){return this._thickness}set thickness(t){this._setProp("_thickness",clamp(asNumber(t),0,1))}get name(){return this._name}set name(t){this._setProp("_name",asString(t))}onPropertyChanged(t){this.propertyChanged.raise(this,t)}_setProp(t,e){let i=this[t];if(e!=i){this[t]=e;let s=new PropertyChangedEventArgs(t.substr(1),i,e);this.onPropertyChanged(s)}}}Range._ctr=0;export var ShowText;!function(t){t[t.None=0]="None";t[t.Value=1]="Value";t[t.MinMax=2]="MinMax";t[t.All=3]="All"}(ShowText||(ShowText={}));export class Gauge extends Control{constructor(t,e){super(t,null,!0);this._ranges=new ObservableArray;this._rngElements=[];this._format="n0";this._showRanges=!0;this._stackRanges=!1;this._shadow=!0;this._animated=!0;this._readOnly=!0;this._handleWheel=!0;this._step=1;this._showText=ShowText.None;this._showTicks=!1;this._showTickText=!1;this._thickness=.8;this._initialized=!1;this.valueChanged=new Event;this._getPercent=function(t){let e=this.max>this.min?(t-this.min)/(this.max-this.min):0;return Math.max(0,Math.min(1,e))};Gauge._ctr++;let i=this.hostElement;setAttribute(i,"role","slider",!0);let s=this.getTemplate();this.applyTemplate(`${ControlClsNames.hostElement} ${GaugeClsNames.hostElement}`,s,{_dSvg:"dsvg",_svg:"svg",_filter:"filter",_gFace:"gface",_gRanges:"granges",_gPointer:"gpointer",_gCover:"gcover",_pFace:"pface",_pPointer:"ppointer",_cValue:"cvalue",_tValue:"value",_tMin:"min",_tMax:"max",_pTicks:"pticks",_gTicks:"gticks",_gNeedle:"gneedle"});setCss(this._dSvg,{width:"100%",height:"100%"});this._filterID="wj-gauge-filter-"+Gauge._ctr.toString(36);this._filter.setAttribute("id",this._filterID);this.face=new Range;this.pointer=new Range;this._ranges.collectionChanged.addHandler(()=>{this._ranges.forEach(t=>{assert(t instanceof Range,"ranges array must contain Range objects.")});this._rangesDirty=!0;this.invalidate()});this.addEventListener(i,"keydown",this._keydown.bind(this));this.addEventListener(i,"click",t=>{if(0==t.button){this.focus();this._applyMouseValue(t)}});this.addEventListener(i,"mousedown",t=>{if(0==t.button){this.focus();this._dragging=!0;setTimeout(()=>{this._applyMouseValue(t)})}});this.addEventListener(i,"mousemove",t=>{this._dragging&&this.containsFocus()&&this._applyMouseValue(t,!0)});this.addEventListener(i,"mouseup",t=>{this._dragging=!1});this.addEventListener(i,"mouseleave",t=>{t.target==i&&(this._dragging=!1)});if("ontouchstart"in window){this.addEventListener(i,"touchstart",t=>{this.focus();!t.defaultPrevented&&this._applyMouseValue(t,!1)&&t.preventDefault()});this.addEventListener(i,"touchmove",t=>{!t.defaultPrevented&&this._applyMouseValue(t,!0)&&t.preventDefault()})}this.addEventListener(i,"wheel",t=>{if(this._handleWheel&&!this.isReadOnly&&!t.defaultPrevented&&this.containsFocus()&&null!=this.value&&this.hitTest(t)){let e=clamp(-t.deltaY,-1,1);this.value=clamp(this.value+(this.step||1)*e,this.min,this.max);t.preventDefault()}});this.isReadOnly=!0;this.initialize(e);this.invalidate()}static get controlTemplate(){Gauge._ctrlTemplate||(Gauge._ctrlTemplate='<div wj-part="dsvg" dir="ltr"><svg wj-part="svg" width="100%" height="100%"><defs><filter wj-part="filter"><feOffset dx="3" dy="3"></feOffset><feGaussianBlur result="offset-blur" stdDeviation="5"></feGaussianBlur><feComposite operator="out" in="SourceGraphic" in2="offset-blur" result="inverse"></feComposite><feFlood flood-color="black" flood-opacity="0.2" result="color"></feFlood><feComposite operator="in" in="color" in2="inverse" result="shadow"></feComposite><feComposite operator="over" in="shadow" in2="SourceGraphic"></feComposite></filter></defs>'+`<g wj-part="gface" class="${GaugeClsNames.face}">`+'<path wj-part="pface"/></g>'+`<g wj-part="granges" class="${GaugeClsNames.ranges}"/>`+`<g wj-part="gpointer" class="${GaugeClsNames.pointer}">`+'<path wj-part="ppointer"/></g>'+`<g wj-part="gcover" class="${GaugeClsNames.cover}">`+`<path wj-part="pticks" class="${GaugeClsNames.ticks}"/>`+`<g wj-part="gticks" aria-hidden="true" class="${GaugeClsNames.tickText}"/>`+`<circle wj-part="cvalue" class="${GaugeClsNames.pointer} ${GaugeClsNames.thumb}"/>`+`<g wj-part="gneedle" class="${GaugeClsNames.needle}"/>`+`<text wj-part="value" class="${GaugeClsNames.value}"/>`+`<text wj-part="min" class="${GaugeClsNames.min}" aria-hidden="true"/>`+`<text wj-part="max" class="${GaugeClsNames.max}" aria-hidden="true"/>`+"</g></svg></div>");return Gauge._ctrlTemplate}static set controlTemplate(t){Gauge._ctrlTemplate=t}get value(){return this._pointer.max}set value(t){if(t!=this.value){this._pointer.max=asNumber(t,!0);this._updateAria()}}get min(){return this._face.min}set min(t){if(t!=this.min){this._face.min=asNumber(t);this._updateAria()}}get max(){return this._face.max}set max(t){if(t!=this.max){this._face.max=asNumber(t);this._updateAria()}}get origin(){return this._origin}set origin(t){if(t!=this._origin){this._origin=asNumber(t,!0);this.invalidate()}}get isReadOnly(){return this._readOnly}set isReadOnly(t){this._readOnly=asBoolean(t);setAttribute(this._svg,"cursor",this._readOnly?null:"pointer");toggleClass(this.hostElement,ControlStateClsNames.readOnly,this.isReadOnly)}get handleWheel(){return this._handleWheel}set handleWheel(t){this._handleWheel=asBoolean(t)}get step(){return this._step}set step(t){if(t!=this._step){this._step=asNumber(t,!0);this.invalidate()}}get format(){return this._format}set format(t){if(t!=this._format){this._format=asString(t);this.invalidate()}}get getText(){return this._getText}set getText(t){if(t!=this._getText){this._getText=asFunction(t);this.invalidate()}}get thickness(){return this._thickness}set thickness(t){if(t!=this._thickness){this._thickness=clamp(asNumber(t,!1),0,1);this.invalidate()}}get face(){return this._face}set face(t){if(t!=this._face){this._face&&this._face.propertyChanged.removeHandler(this._rangeChanged);this._face=asType(t,Range);this._face&&this._face.propertyChanged.addHandler(this._rangeChanged,this);this.invalidate()}}get pointer(){return this._pointer}set pointer(t){if(t!=this._pointer){let e=null;if(this._pointer){e=this.value;this._pointer.propertyChanged.removeHandler(this._rangeChanged)}this._pointer=asType(t,Range);if(this._pointer){e&&(this.value=e);this._pointer.propertyChanged.addHandler(this._rangeChanged,this)}this.invalidate()}}get showText(){return this._showText}set showText(t){if((t=asEnum(t,ShowText))!=this._showText){this._showText=t;this.invalidate()}}get showTicks(){return this._showTicks}set showTicks(t){if(t!=this._showTicks){this._showTicks=asBoolean(t);this.invalidate()}}get showTickText(){return this._showTickText}set showTickText(t){if(t!=this._showTickText){this._showTickText=asBoolean(t);this.invalidate()}}get tickSpacing(){return this._tickSpacing}set tickSpacing(t){if(t!=this._tickSpacing){this._tickSpacing=asNumber(t,!0);this.invalidate()}}get thumbSize(){return this._thumbSize}set thumbSize(t){if(t!=this._thumbSize){this._thumbSize=asNumber(t,!0,!0);this.invalidate()}}get showRanges(){return this._showRanges}set showRanges(t){if(t!=this._showRanges){this._showRanges=asBoolean(t);this._animColor=null;this._rangesDirty=!0;this.invalidate()}}get stackRanges(){return this._stackRanges}set stackRanges(t){if(t!=this._stackRanges){this._stackRanges=asBoolean(t);this._animColor=null;this._rangesDirty=!0;this.invalidate()}}get hasShadow(){return this._shadow}set hasShadow(t){if(t!=this._shadow){this._shadow=asBoolean(t);this.invalidate()}}get isAnimated(){return this._animated}set isAnimated(t){this._animated=asBoolean(t)}get ranges(){return this._ranges}onValueChanged(t){this.valueChanged.raise(this,t)}refresh(t=!0){super.refresh(t);if(this._rangesDirty){this._rangesDirty=!1;let t=this._gRanges;this._rngElements.forEach(t=>{t.rng.propertyChanged.removeHandler(this._rangeChanged)});for(;t.lastChild;)t.removeChild(t.lastChild);this._rngElements=[];this._showRanges&&this._ranges.forEach(e=>{e.propertyChanged.addHandler(this._rangeChanged,this);this._rngElements.push({rng:e,el:this._createElement("path",t)})})}this._showElement(this._tValue,0!=(this.showText&ShowText.Value));this._showElement(this._tMin,0!=(this.showText&ShowText.MinMax));this._showElement(this._tMax,0!=(this.showText&ShowText.MinMax));this._showElement(this._cValue,0!=(this.showText&ShowText.Value)||this._thumbSize>0);this._updateText();let e=this._getFilterUrl();setAttribute(this._pFace,"filter",e);setAttribute(this._pPointer,"filter",e);this._updateRange(this._face);this._updateRange(this._pointer);this._updateTicks();this._ranges.forEach(t=>{this._updateRange(t)});this._initialized=!0}hitTest(t,e){isNumber(t)&&isNumber(e)?t=new Point(t,e):t instanceof Point||(t=mouseToPage(t));t=asType(t,Point);let i=Rect.fromBoundingRect(this._dSvg.getBoundingClientRect());t.x-=i.left+pageXOffset;t.y-=i.top+pageYOffset;return this._getValueFromPoint(t)}dispose(){if(this._animInterval){clearInterval(this._animInterval);this._animInterval=null}super.dispose()}static _getBBox(t){try{return t.getBBox()}catch(t){return{x:0,y:0,width:0,height:0}}}_getFilterUrl(){return this.hasShadow&&!isiOS()?"url(#"+this._filterID+")":null}_getRangeElement(t){if(t==this._face)return this._pFace;if(t==this._pointer)return this._pPointer;for(let e=0;e<this._rngElements.length;e++){let i=this._rngElements[e];if(i.rng==t)return i.el}return null}_rangeChanged(t,e){if(t==this._pointer&&"max"==e.propertyName){this.onValueChanged();this._updateText()}if(t!=this._face){if(t==this._pointer&&"max"==e.propertyName){if(this._animInterval){clearInterval(this._animInterval);this._updateRange(t,e.oldValue)}if(this.isAnimated&&!this.isUpdating&&this._initialized){let i=this._getPointerColor(e.oldValue),s=this._getPointerColor(e.newValue),a=i?new Color(i):null,h=s?new Color(s):null,n=clamp(Math.abs(e.newValue-e.oldValue)/(this.max-this.min),0,1);this._animInterval=animate(i=>{this._animColor=a&&h?Color.interpolate(a,h,i).toString():null;this._updateRange(t,e.oldValue+i*(e.newValue-e.oldValue));if(i>=1){this._animColor=null;this._animInterval=null;this._updateRange(t);this._updateText()}},n*Control._ANIM_DEF_DURATION);return}}this._updateRange(t)}else this.invalidate()}_createElement(t,e,i){let s=document.createElementNS(Gauge._SVGNS,t);i&&s.setAttribute("class",i);e.appendChild(s);return s}_centerText(t,e,i){if("none"!=t.getAttribute("display")){let s=Globalize.format(e,this.format);if(isFunction(this.getText)){let i="";t==this._tValue?i="value":t==this._tMin?i="min":t==this._tMax&&(i="max");i&&(s=this.getText(this,i,e,s))}t.textContent=s;let a=Rect.fromBoundingRect(Gauge._getBBox(t)),h=i.x-Math.round(a.width)/2,n=i.y+Math.round(a.height)/4;t.setAttribute("x",this._fix(h));t.setAttribute("y",this._fix(n))}}_copy(t,e){if("ranges"==t){asArray(e).forEach(t=>{let e=new Range(t);this.ranges.push(e)});return!0}if("pointer"==t){copy(this.pointer,e);return!0}return!1}_showElement(t,e){setAttribute(t,"display",e?null:"none")}_updateRange(t,e=t.max){t==this._pointer&&(t.min=null!=this.origin?this.origin:this.min<0&&this.max>0?0:this.min);let i=this._getRangeElement(t);if(i){this._updateRangeElement(i,t,e);let s=t.color;t==this._pointer&&(s=this._animColor?this._animColor:this._getPointerColor(t.max));setAttribute(i,"style",s?"fill:"+s:null)}}_getPointerColor(t){if(!this._showRanges){let e;for(let i=0;i<this._ranges.length;i++){let s=this._ranges[i];if(t>=s.min&&t<=s.max){e=s;break}}if(e)return e.color}return this._pointer.color}_keydown(t){if(!this._readOnly&&this._step){let e=!0;switch(this._getKey(t.keyCode)){case Key.Left:case Key.Down:this.value=clamp(this.value-this._step,this.min,this.max);break;case Key.Right:case Key.Up:this.value=clamp(this.value+this._step,this.min,this.max);break;case Key.Home:this.value=this.min;break;case Key.End:this.value=this.max;break;default:e=!1}e&&t.preventDefault()}}_getKey(t){return t}_applyMouseValue(t,e){if(!this.isReadOnly&&this.containsFocus()){let i=this.hitTest(t);if(null!=i){let t=this._animated,s=this._step;e&&(this._animated=!1);s&&(i=Math.round(i/s)*s);this.value=clamp(i,this.min,this.max);this._animated=t;return!0}}return!1}_updateRangeElement(t,e,i){assert(!1,"Gauge is an abstract class.")}_updateText(){assert(!1,"Gauge is an abstract class.")}_updateTicks(){assert(!1,"Gauge is an abstract class.")}_getValueFromPoint(t){return null}_fix(t){return isNumber(t)?parseFloat(t.toFixed(4)).toString():this._fix(t.x)+" "+this._fix(t.y)}_updateAria(){let t=this.hostElement;if(t){setAttribute(t,"aria-valuemin",this.min);setAttribute(t,"aria-valuemax",this.max);setAttribute(t,"aria-valuenow",this.value)}}}Gauge._SVGNS="http://www.w3.org/2000/svg";Gauge._ctr=0;Gauge._ctrlTemplate="";export var NeedleShape;!function(t){t[t.None=0]="None";t[t.Triangle=1]="Triangle";t[t.Diamond=2]="Diamond";t[t.Hexagon=3]="Hexagon";t[t.Rectangle=4]="Rectangle";t[t.Arrow=5]="Arrow";t[t.WideArrow=6]="WideArrow";t[t.Pointer=7]="Pointer";t[t.WidePointer=8]="WidePointer";t[t.Outer=9]="Outer"}(NeedleShape||(NeedleShape={}));export var NeedleLength;!function(t){t[t.Outer=0]="Outer";t[t.Middle=1]="Middle";t[t.Inner=2]="Inner"}(NeedleLength||(NeedleLength={}));export class RadialGauge extends Gauge{constructor(t,e){super(t,null);this._startAngle=0;this._sweepAngle=180;this._autoScale=!0;this._ndlShape=NeedleShape.None;this._ndlLength=NeedleLength.Middle;addClass(this.hostElement,RadialGaugeClsNames.hostElement);this._thickness=.4;this.showText=ShowText.All;this.initialize(e)}get startAngle(){return this._startAngle}set startAngle(t){if(t!=this._startAngle){this._startAngle=clamp(asNumber(t,!1),-360,360);this.invalidate()}}get sweepAngle(){return this._sweepAngle}set sweepAngle(t){if(t!=this._sweepAngle){this._sweepAngle=clamp(asNumber(t,!1),-360,360);this.invalidate()}}get autoScale(){return this._autoScale}set autoScale(t){if(t!=this._autoScale){this._autoScale=asBoolean(t);this.invalidate()}}get faceBounds(){return this._rcSvg?this._rcSvg.clone():null}get clientSize(){_deprecated("clientSize","faceBounds");let t=this._rcSvg;return t?new Size(t.width,t.height):null}get needleElement(){return this._ndlElement}set needleElement(t){if(t!=this._ndlElement){this._ndlShape=0;this._ndlElement=asType(t,SVGElement,!0);let e=this._gNeedle;for(;e.firstChild;)removeChild(e.firstChild);if(this._ndlElement){setAttribute(e,"transform","scale(0)");e.appendChild(this._ndlElement)}this.invalidate()}}get needleShape(){return this._ndlShape}set needleShape(t){if(t!=this._ndlShape){if((t=asEnum(t,NeedleShape))===this._ndlShape)return;let e=null;switch(t){case NeedleShape.Triangle:e=RadialGauge.createNeedleElement([{x:-10,y:10},{x:100,y:0}]);break;case NeedleShape.Diamond:e=RadialGauge.createNeedleElement([{x:-20,y:0},{x:0,y:10},{x:100,y:0}]);break;case NeedleShape.Hexagon:e=RadialGauge.createNeedleElement([{x:-15,y:0},{x:-10,y:5},{x:10,y:5},{x:100,y:0}]);break;case NeedleShape.Rectangle:e=RadialGauge.createNeedleElement([{x:-20,y:3},{x:100,y:3}],10);break;case NeedleShape.Arrow:e=RadialGauge.createNeedleElement([{x:-20,y:3},{x:70,y:3},{x:70,y:15},{x:100,y:0}],10);break;case NeedleShape.WideArrow:e=RadialGauge.createNeedleElement([{x:-30,y:5},{x:-40,y:15},{x:-20,y:15},{x:-10,y:5},{x:80,y:5},{x:70,y:15},{x:100,y:0}]);break;case NeedleShape.Pointer:e=RadialGauge.createNeedleElement([{x:0,y:10},{x:100,y:0}],20,10);break;case NeedleShape.WidePointer:e=RadialGauge.createNeedleElement([{x:0,y:20},{x:100,y:0}],20,10);break;case NeedleShape.Outer:e=RadialGauge.createNeedleElement([{x:60,y:20},{x:100,y:0}])}this.needleElement=e;this._ndlShape=t;this.invalidate()}}get needleLength(){return this._ndlLength}set needleLength(t){if(t!=this._ndlLength){this._ndlLength=asEnum(t,NeedleLength);this.invalidate()}}static createNeedleElement(t,e,i){let s="";for(let e=0;e<t.length;e++){let i=t[e];if(e==t.length-1&&0==i.y)break;s+=(e>0?" L ":"M ")+i.x+" "+i.y}for(let e=t.length-1;e>=0;e--){let i=t[e];s+=" L "+i.x+" "+-i.y}s+=" Z";let a="http://www.w3.org/2000/svg",h=document.createElementNS(a,"g"),n=document.createElementNS(a,"path");setAttribute(n,"d",s);h.appendChild(n);if(e){let t=document.createElementNS(a,"circle");addClass(t,GaugeClsNames.needleCap);setAttribute(t,"r",e);h.appendChild(t);if(i){t=document.createElementNS(a,"circle");addClass(t,GaugeClsNames.innerNeedleCap);setAttribute(t,"r",i);h.appendChild(t)}}return h}refresh(t=!0){setAttribute(this._svg,"viewBox",null);this._rcSvg=Rect.fromBoundingRect(this._dSvg.getBoundingClientRect());super.refresh(t);this._ctmInv=null;this._ptSvg=null;if(this._autoScale){setAttribute(this._svg,"viewBox",null);let t=Rect.fromBoundingRect(Gauge._getBBox(this._pFace));0!=(this.showText&ShowText.Value)&&(t=Rect.union(t,Rect.fromBoundingRect(Gauge._getBBox(this._tValue))));if(0!=(this.showText&ShowText.MinMax)){t=Rect.union(t,Rect.fromBoundingRect(Gauge._getBBox(this._tMin)));t=Rect.union(t,Rect.fromBoundingRect(Gauge._getBBox(this._tMax)))}let e=[this._fix(t.left),this._fix(t.top),this._fix(t.width),this._fix(t.height)].join(" ");setAttribute(this._svg,"viewBox",e);let i=this._pFace.getCTM();this._ctmInv=i?i.inverse():null;this._ptSvg=this._svg.createSVGPoint()}}_updateRangeElement(t,e,i){if(this._rcSvg){let s=this._rcSvg,a=new Point(s.width/2,s.height/2),h=Math.min(s.width,s.height)/2,n=h*this.thickness,r=n*e.thickness,l=h-(n-r)/2,o=l-r,g=this._getStartAngle(),c=this._getSweepAngle(),u=e==this._face,_=u?0:this._getPercent(e.min),d=g+c*_,m=c*((u?1:this._getPercent(i))-_);if(this.stackRanges&&e!=this.face&&e!=this.pointer){let t=this.ranges.indexOf(e);if(t>-1){let e=this.ranges.length,i=(l-o)/e;l=(o+=(e-1-t)*i)+i}}this._updateSegment(t,a,l,o,d,m);if(e==this._pointer){let t=this._fix;if(this.thumbSize>0){let s=this._animColor?this._animColor:this._getPointerColor(e.max),h=this._getPoint(a,g+c*this._getPercent(i),(l+o)/2),n=this._cValue;setAttribute(n,"cx",t(h.x));setAttribute(n,"cy",t(h.y));setAttribute(n,"style",s?"fill:"+s:null);setAttribute(n,"r",t(this.thumbSize/2))}if(this.needleElement){let e=l;this._ndlLength==NeedleLength.Inner?e=o:this._ndlLength==NeedleLength.Middle&&(e=(o+l)/2);let i="translate({cx}, {cy}) scale({scale}) rotate({angle})".replace("{cx}",t(a.x)).replace("{cy}",t(a.y)).replace("{scale}",t(e/100)).replace("{angle}",t(d+m));this._gNeedle.setAttribute("transform",i)}}}}_getStartAngle(){let t=this.startAngle+180;this.rightToLeft&&(t=180-t);return t}_getSweepAngle(){let t=this.sweepAngle;this.rightToLeft&&(t=-t);return t}_updateText(){if(this._rcSvg){let t=this._rcSvg,e=new Point(t.width/2,t.height/2),i=Math.min(t.width,t.height)/2,s=Math.max(0,i*(1-this.thickness)),a=this._getStartAngle(),h=this._getSweepAngle();this._showElement(this._cValue,this.thumbSize>0);let n=0!=(this.showText&ShowText.MinMax)&&Math.abs(h)<=300;this._showElement(this._tMin,n);this._showElement(this._tMax,n);this._centerText(this._tValue,this.value,e);let r=10*(this._getSweepAngle()<0?-1:1);this._centerText(this._tMin,this.min,this._getPoint(e,a-r,(i+s)/2));this._centerText(this._tMax,this.max,this._getPoint(e,a+h+r,(i+s)/2))}}_updateTicks(){let t=this.tickSpacing&&this.tickSpacing>0?this.tickSpacing:this.step,e="",i=this._gTicks;for(;i.firstChild;)removeChild(i.firstChild);if(this.showTicks&&t>0){let s=this._rcSvg,a=new Point(s.width/2,s.height/2),h=Math.min(s.width,s.height)/2,n=h*this.thickness,r=n*this._face.thickness,l=h-(n-r)/2,o=l-r,g=1.15*l,c=this._getStartAngle(),u=this._getSweepAngle();for(let s=this.min;s<=this.max;s+=t){let t=c+u*this._getPercent(s),h=this._fix(this._getPoint(a,t,o)),n=this._fix(this._getPoint(a,t,l));s>this.min&&s<this.max&&(e+="M "+h+" L "+n+" ");if(this.showTickText){let e=this._createElement("text",i),h=this._getPoint(a,t,g);this._centerText(e,s,h)}}}this._pTicks.setAttribute("d",e)}_updateSegment(t,e,i,s,a,h){h=Math.min(Math.max(h,-359.99),359.99);let n=this._getPoint(e,a,s),r=this._getPoint(e,a,i),l=this._getPoint(e,a+h,i),o=this._getPoint(e,a+h,s),g={large:Math.abs(h)>180?1:0,cw:h>0?1:0,ccw:h>0?0:1,or:this._fix(i),ir:this._fix(s),p1:this._fix(n),p2:this._fix(r),p3:this._fix(l),p4:this._fix(o)},c=format("M {p1} L {p2} A {or} {or} 0 {large} {cw} {p3} L {p4} A {ir} {ir} 0 {large} {ccw} {p1} Z",g);t.setAttribute("d",c)}_getPoint(t,e,i){e=e*Math.PI/180;return new Point(t.x+i*Math.cos(e),t.y+i*Math.sin(e))}_getValueFromPoint(t){if(this.autoScale&&this._ctmInv){this._ptSvg.x=t.x;this._ptSvg.y=t.y;this._ptSvg=this._ptSvg.matrixTransform(this._ctmInv);t.x=this._ptSvg.x;t.y=this._ptSvg.y}if(!this._rcSvg||!this.sweepAngle)return null;let e=this._rcSvg,i=new Point(e.width/2,e.height/2),s=Math.min(e.width,e.height)/2,a=t.x-i.x,h=t.y-i.y,n=h*h+a*a;if(n<400||n>(s+20)*(s+20))return null;let r=180*(Math.PI-Math.atan2(-h,a))/Math.PI,l=this.startAngle,o=this.sweepAngle,g=l+o;this.rightToLeft&&(r=180-r);if(o>0){for(;r<l;)r+=360;for(;r>g;)r-=360}else{for(;r<g;)r+=360;for(;r>l;)r-=360}if((r-l)*(r-g)>0){let t=this._getPoint(i,r,s),e=this._getPoint(i,l,s),a=this._getPoint(i,g,s);r=this._getDist2(t,e)<this._getDist2(t,a)?l:g}let c=o?clamp(Math.abs(r-l)/Math.abs(o),0,1):0;return this.min+c*(this.max-this.min)}_getDist2(t,e){let i=t.x-e.x,s=t.y-e.y;return i*i+s*s}}export var GaugeDirection;!function(t){t[t.Right=0]="Right";t[t.Left=1]="Left";t[t.Up=2]="Up";t[t.Down=3]="Down"}(GaugeDirection||(GaugeDirection={}));export class LinearGauge extends Gauge{constructor(t,e){super(t,null);this._direction=GaugeDirection.Right;addClass(this.hostElement,LinearGaugeClsNames.hostElement);this.initialize(e)}get direction(){return this._direction}set direction(t){if((t=asEnum(t,GaugeDirection))!=this._direction){this._direction=t;this.invalidate()}}get faceBounds(){return this._getRangeRect(this._face)}_updateRangeElement(t,e,i){let s=this._getRangeRect(e,i);this._updateSegment(t,s);let a=e==this._pointer&&0!=(this.showText&ShowText.Value),h=a||e==this._pointer&&this.thumbSize>0,n=s.left+s.width/2,r=s.top+s.height/2;switch(this._getDirection()){case GaugeDirection.Right:n=s.right;break;case GaugeDirection.Left:n=s.left;break;case GaugeDirection.Up:r=s.top;break;case GaugeDirection.Down:r=s.bottom}a&&this._centerText(this._tValue,i,new Point(n,r));if(a||h){s=Rect.fromBoundingRect(Gauge._getBBox(this._tValue));let t=this._animColor?this._animColor:this._getPointerColor(e.max),i=null!=this.thumbSize?this.thumbSize/2:.8*Math.max(s.width,s.height),a=this._cValue;setAttribute(a,"cx",this._fix(n));setAttribute(a,"cy",this._fix(r));setAttribute(a,"style",t?"fill:"+t:null);setAttribute(a,"r",this._fix(i))}}_updateText(){let t=this._getRangeRect(this._face);switch(this._getDirection()){case GaugeDirection.Right:this._setText(this._tMin,this.min,t,"left");this._setText(this._tMax,this.max,t,"right");break;case GaugeDirection.Left:this._setText(this._tMin,this.min,t,"right");this._setText(this._tMax,this.max,t,"left");break;case GaugeDirection.Up:this._setText(this._tMin,this.min,t,"bottom");this._setText(this._tMax,this.max,t,"top");break;case GaugeDirection.Down:this._setText(this._tMin,this.min,t,"top");this._setText(this._tMax,this.max,t,"bottom")}}_updateTicks(){let t=this.tickSpacing&&this.tickSpacing>0?this.tickSpacing:this.step,e="",i=this._gTicks;for(;i.firstChild;)removeChild(i.firstChild);if(this.showTicks&&t>0){let s,a=this._getRangeRect(this._face),h=new Point(a.left-.75*a.width,a.top-.75*a.height),n=this._fix;for(let r=this.min;r<=this.max;r+=t){let t=null;switch(this._getDirection()){case GaugeDirection.Right:h.x=a.left+a.width*this._getPercent(r);t="M "+(s=n(h.x))+" "+n(a.top)+" L "+s+" "+n(a.bottom)+" ";break;case GaugeDirection.Left:h.x=a.right-a.width*this._getPercent(r);t="M "+(s=n(h.x))+" "+n(a.top)+" L "+s+" "+n(a.bottom)+" ";break;case GaugeDirection.Up:h.y=a.bottom-a.height*this._getPercent(r);s=n(h.y);t="M "+n(a.left)+" "+s+" L "+n(a.right)+" "+s+" ";break;case GaugeDirection.Down:h.y=a.top+a.height*this._getPercent(r);s=n(h.y);t="M "+n(a.left)+" "+s+" L "+n(a.right)+" "+s+" "}r>this.min&&r<this.max&&(e+=t);if(this.showTickText){let t=this._createElement("text",i);this._centerText(t,r,h)}}}this._pTicks.setAttribute("d",e)}_updateSegment(t,e){let i={p1:this._fix(new Point(e.left,e.top)),p2:this._fix(new Point(e.right,e.top)),p3:this._fix(new Point(e.right,e.bottom)),p4:this._fix(new Point(e.left,e.bottom))},s=format("M {p1} L {p2} L {p3} L {p4} Z",i);t.setAttribute("d",s)}_setText(t,e,i,s){if("none"!=t.getAttribute("display")){let a=Globalize.format(e,this.format);if(isFunction(this.getText)){let i=t==this._tValue?"value":t==this._tMin?"min":t==this._tMax?"max":null;assert(null!=i,"unknown element");a=this.getText(this,i,e,a)}t.textContent=a;let h=Rect.fromBoundingRect(Gauge._getBBox(t)),n=new Point(i.left+i.width/2-h.width/2,i.top+i.height/2+h.height/2);switch(s){case"top":n.y=i.top-4;break;case"left":n.x=i.left-4-h.width;break;case"right":n.x=i.right+4;break;case"bottom":n.y=i.bottom+4+h.height}t.setAttribute("x",this._fix(n.x));t.setAttribute("y",this._fix(n.y))}}_getRangeRect(t,e=t.max){let i=this.hostElement,s=new Rect(0,0,i.clientWidth,i.clientHeight),a=this._getDirection(),h=this.thumbSize?Math.ceil(this.thumbSize/2):0;if(this.showText!=ShowText.None){let t=parseInt(getComputedStyle(i).fontSize);isNaN(t)||(h=Math.max(h,3*t))}switch(a){case GaugeDirection.Right:case GaugeDirection.Left:s=s.inflate(-h,-s.height*(1-this.thickness*t.thickness)/2);break;case GaugeDirection.Up:case GaugeDirection.Down:s=s.inflate(-s.width*(1-this.thickness*t.thickness)/2,-h)}if(this.stackRanges&&t!=this.face&&t!=this.pointer){let e=this.ranges.indexOf(t);if(e>-1){let t=this.ranges.length;switch(a){case GaugeDirection.Right:case GaugeDirection.Left:s.height/=t;s.top+=e*s.height;break;case GaugeDirection.Up:case GaugeDirection.Down:s.width/=t;s.left+=e*s.width}}}let n=t==this._face,r=n?0:this._getPercent(t.min),l=n?1:this._getPercent(e);switch(a){case GaugeDirection.Right:s.left+=s.width*r;s.width*=l-r;break;case GaugeDirection.Left:s.left=s.right-s.width*l;s.width=s.width*(l-r);break;case GaugeDirection.Down:s.top+=s.height*r;s.height*=l-r;break;case GaugeDirection.Up:s.top=s.bottom-s.height*l;s.height=s.height*(l-r)}return s}_getValueFromPoint(t){let e=this._getRangeRect(this._face),i=0;switch(this._getDirection()){case GaugeDirection.Right:i=e.width>0?(t.x-e.left)/e.width:0;break;case GaugeDirection.Left:i=e.width>0?(e.right-t.x)/e.width:0;break;case GaugeDirection.Up:i=e.height>0?(e.bottom-t.y)/e.height:0;break;case GaugeDirection.Down:i=e.height>0?(t.y-e.top)/e.height:0}return this.min+i*(this.max-this.min)}_getDirection(){let t=this._direction;if(this.rightToLeft)switch(t){case GaugeDirection.Left:t=GaugeDirection.Right;break;case GaugeDirection.Right:t=GaugeDirection.Left}return t}_getKey(t){switch(this._getDirection()){case GaugeDirection.Left:switch(t){case Key.Left:t=Key.Right;break;case Key.Right:t=Key.Left}break;case GaugeDirection.Down:switch(t){case Key.Up:t=Key.Down;break;case Key.Down:t=Key.Up}}return t}}export class BulletGraph extends LinearGauge{constructor(t,e){super(t,null);addClass(this.hostElement,BulletGraphClsNames.hostElement);this._pointer.thickness=.35;this._rngTarget=new Range("target");this._rngTarget.thickness=.8;this._rngTarget.color="black";this._rngGood=new Range("good");this._rngGood.color="rgba(0,0,0,.15)";this._rngBad=new Range("bad");this._rngBad.color="rgba(0,0,0,.3)";this.ranges.push(this._rngBad);this.ranges.push(this._rngGood);this.ranges.push(this._rngTarget);this.initialize(e)}get target(){return this._rngTarget.max}set target(t){this._rngTarget.max=t}get good(){return this._rngGood.max}set good(t){this._rngGood.max=t}get bad(){return this._rngBad.max}set bad(t){this._rngBad.max=t}_getRangeRect(t,e=t.max){let i=super._getRangeRect(t,e);if(t==this._rngTarget)switch(this._getDirection()){case GaugeDirection.Right:i.left=i.right-1;i.width=3;break;case GaugeDirection.Left:i.width=3;break;case GaugeDirection.Up:i.height=3;break;case GaugeDirection.Down:i.top=i.bottom-1;i.height=3}return i}}_registerModule("wijmo.gauge",selfModule);
14
+ import{isString,copy,asNumber,asString,clamp,PropertyChangedEventArgs,Event,assert,setAttribute,animate,setCss,toggleClass,mouseToPage,isiOS,isNumber,isFunction,asBoolean,asType,asFunction,asEnum,asArray,Globalize,Control,Color,Point,Rect,Key,ObservableArray,ControlStateClsNames,ControlClsNames,addClass,format,removeChild,Size,_deprecated,_registerModule}from"@grapecity/wijmo";import*as selfModule from"@grapecity/wijmo.gauge";export const BulletGraphClsNames={hostElement:"wj-bulletgraph"};export const GaugeClsNames={cover:"wj-cover",face:"wj-face",filter:"wj-gauge-filter",hostElement:"wj-gauge",innerNeedleCap:"wj-inner-needle-cap",max:"wj-max",min:"wj-min",needle:"wj-needle",needleCap:"wj-needle-cap",pointer:"wj-pointer",ranges:"wj-ranges",thumb:"wj-thumb",tickText:"wj-tick-text",ticks:"wj-ticks",value:"wj-value"};export const LinearGaugeClsNames={hostElement:"wj-lineargauge"};export const RadialGaugeClsNames={hostElement:"wj-radialgauge"};export const RangeClsNames={ranges:"wj-ranges"};export class Range{constructor(t){this._min=0;this._max=100;this._thickness=1;this.propertyChanged=new Event;isString(t)?this._name=t:copy(this,t)}get min(){return this._min}set min(t){this._setProp("_min",asNumber(t,!0))}get max(){return this._max}set max(t){this._setProp("_max",asNumber(t,!0))}get color(){return this._color}set color(t){this._setProp("_color",asString(t))}get thickness(){return this._thickness}set thickness(t){this._setProp("_thickness",clamp(asNumber(t),0,1))}get name(){return this._name}set name(t){this._setProp("_name",asString(t))}onPropertyChanged(t){this.propertyChanged.raise(this,t)}_setProp(t,e){let i=this[t];if(e!=i){this[t]=e;let s=new PropertyChangedEventArgs(t.substr(1),i,e);this.onPropertyChanged(s)}}}Range._ctr=0;export var ShowText;!function(t){t[t.None=0]="None";t[t.Value=1]="Value";t[t.MinMax=2]="MinMax";t[t.All=3]="All"}(ShowText||(ShowText={}));export class Gauge extends Control{constructor(t,e){super(t,null,!0);this._ranges=new ObservableArray;this._rngElements=[];this._format="n0";this._showRanges=!0;this._stackRanges=!1;this._shadow=!0;this._animated=!0;this._readOnly=!0;this._handleWheel=!0;this._step=1;this._showText=ShowText.None;this._showTicks=!1;this._showTickText=!1;this._thickness=.8;this._initialized=!1;this.valueChanged=new Event;this._getPercent=function(t){let e=this.max>this.min?(t-this.min)/(this.max-this.min):0;return Math.max(0,Math.min(1,e))};Gauge._ctr++;let i=this.hostElement;setAttribute(i,"role","slider",!0);let s=this.getTemplate();this.applyTemplate(`${ControlClsNames.hostElement} ${GaugeClsNames.hostElement}`,s,{_dSvg:"dsvg",_svg:"svg",_filter:"filter",_gFace:"gface",_gRanges:"granges",_gPointer:"gpointer",_gCover:"gcover",_pFace:"pface",_pPointer:"ppointer",_cValue:"cvalue",_tValue:"value",_tMin:"min",_tMax:"max",_pTicks:"pticks",_gTicks:"gticks",_gNeedle:"gneedle"});setCss(this._dSvg,{width:"100%",height:"100%"});this._filterID="wj-gauge-filter-"+Gauge._ctr.toString(36);this._filter.setAttribute("id",this._filterID);this.face=new Range;this.pointer=new Range;this._ranges.collectionChanged.addHandler(()=>{this._ranges.forEach(t=>{assert(t instanceof Range,"ranges array must contain Range objects.")});this._rangesDirty=!0;this.invalidate()});this.addEventListener(i,"keydown",this._keydown.bind(this));this.addEventListener(i,"click",t=>{if(0==t.button){this.focus();this._applyMouseValue(t)}});this.addEventListener(i,"mousedown",t=>{if(0==t.button){this.focus();this._dragging=!0;setTimeout(()=>{this._applyMouseValue(t)})}});this.addEventListener(i,"mousemove",t=>{this._dragging&&this.containsFocus()&&this._applyMouseValue(t,!0)});this.addEventListener(i,"mouseup",t=>{this._dragging=!1});this.addEventListener(i,"mouseleave",t=>{t.target==i&&(this._dragging=!1)});if("ontouchstart"in window){this.addEventListener(i,"touchstart",t=>{this.focus();!t.defaultPrevented&&this._applyMouseValue(t,!1)&&t.preventDefault()});this.addEventListener(i,"touchmove",t=>{!t.defaultPrevented&&this._applyMouseValue(t,!0)&&t.preventDefault()})}this.addEventListener(i,"wheel",t=>{if(this._handleWheel&&!this.isReadOnly&&!t.defaultPrevented&&this.containsFocus()&&null!=this.value&&this.hitTest(t)){let e=clamp(-t.deltaY,-1,1);this.value=clamp(this.value+(this.step||1)*e,this.min,this.max);t.preventDefault()}});this.isReadOnly=!0;this.initialize(e);this.invalidate()}static get controlTemplate(){Gauge._ctrlTemplate||(Gauge._ctrlTemplate='<div wj-part="dsvg" dir="ltr"><svg wj-part="svg" width="100%" height="100%"><defs><filter wj-part="filter"><feOffset dx="3" dy="3"></feOffset><feGaussianBlur result="offset-blur" stdDeviation="5"></feGaussianBlur><feComposite operator="out" in="SourceGraphic" in2="offset-blur" result="inverse"></feComposite><feFlood flood-color="black" flood-opacity="0.2" result="color"></feFlood><feComposite operator="in" in="color" in2="inverse" result="shadow"></feComposite><feComposite operator="over" in="shadow" in2="SourceGraphic"></feComposite></filter></defs>'+`<g wj-part="gface" class="${GaugeClsNames.face}">`+'<path wj-part="pface"/></g>'+`<g wj-part="granges" class="${GaugeClsNames.ranges}"/>`+`<g wj-part="gpointer" class="${GaugeClsNames.pointer}">`+'<path wj-part="ppointer"/></g>'+`<g wj-part="gcover" class="${GaugeClsNames.cover}">`+`<path wj-part="pticks" class="${GaugeClsNames.ticks}"/>`+`<g wj-part="gticks" aria-hidden="true" class="${GaugeClsNames.tickText}"/>`+`<circle wj-part="cvalue" class="${GaugeClsNames.pointer} ${GaugeClsNames.thumb}"/>`+`<g wj-part="gneedle" class="${GaugeClsNames.needle}"/>`+`<text wj-part="value" class="${GaugeClsNames.value}"/>`+`<text wj-part="min" class="${GaugeClsNames.min}" aria-hidden="true"/>`+`<text wj-part="max" class="${GaugeClsNames.max}" aria-hidden="true"/>`+"</g></svg></div>");return Gauge._ctrlTemplate}static set controlTemplate(t){Gauge._ctrlTemplate=t}get value(){return this._pointer.max}set value(t){if(t!=this.value){this._pointer.max=asNumber(t,!0);this._updateAria()}}get min(){return this._face.min}set min(t){if(t!=this.min){this._face.min=asNumber(t);this._updateAria()}}get max(){return this._face.max}set max(t){if(t!=this.max){this._face.max=asNumber(t);this._updateAria()}}get origin(){return this._origin}set origin(t){if(t!=this._origin){this._origin=asNumber(t,!0);this.invalidate()}}get isReadOnly(){return this._readOnly}set isReadOnly(t){this._readOnly=asBoolean(t);setAttribute(this._svg,"cursor",this._readOnly?null:"pointer");toggleClass(this.hostElement,ControlStateClsNames.readOnly,this.isReadOnly)}get handleWheel(){return this._handleWheel}set handleWheel(t){this._handleWheel=asBoolean(t)}get step(){return this._step}set step(t){if(t!=this._step){this._step=asNumber(t,!0);this.invalidate()}}get format(){return this._format}set format(t){if(t!=this._format){this._format=asString(t);this.invalidate()}}get getText(){return this._getText}set getText(t){if(t!=this._getText){this._getText=asFunction(t);this.invalidate()}}get thickness(){return this._thickness}set thickness(t){if(t!=this._thickness){this._thickness=clamp(asNumber(t,!1),0,1);this.invalidate()}}get face(){return this._face}set face(t){if(t!=this._face){this._face&&this._face.propertyChanged.removeHandler(this._rangeChanged);this._face=asType(t,Range);this._face&&this._face.propertyChanged.addHandler(this._rangeChanged,this);this.invalidate()}}get pointer(){return this._pointer}set pointer(t){if(t!=this._pointer){let e=null;if(this._pointer){e=this.value;this._pointer.propertyChanged.removeHandler(this._rangeChanged)}this._pointer=asType(t,Range);if(this._pointer){e&&(this.value=e);this._pointer.propertyChanged.addHandler(this._rangeChanged,this)}this.invalidate()}}get showText(){return this._showText}set showText(t){if((t=asEnum(t,ShowText))!=this._showText){this._showText=t;this.invalidate()}}get showTicks(){return this._showTicks}set showTicks(t){if(t!=this._showTicks){this._showTicks=asBoolean(t);this.invalidate()}}get showTickText(){return this._showTickText}set showTickText(t){if(t!=this._showTickText){this._showTickText=asBoolean(t);this.invalidate()}}get tickSpacing(){return this._tickSpacing}set tickSpacing(t){if(t!=this._tickSpacing){this._tickSpacing=asNumber(t,!0);this.invalidate()}}get thumbSize(){return this._thumbSize}set thumbSize(t){if(t!=this._thumbSize){this._thumbSize=asNumber(t,!0,!0);this.invalidate()}}get showRanges(){return this._showRanges}set showRanges(t){if(t!=this._showRanges){this._showRanges=asBoolean(t);this._animColor=null;this._rangesDirty=!0;this.invalidate()}}get stackRanges(){return this._stackRanges}set stackRanges(t){if(t!=this._stackRanges){this._stackRanges=asBoolean(t);this._animColor=null;this._rangesDirty=!0;this.invalidate()}}get hasShadow(){return this._shadow}set hasShadow(t){if(t!=this._shadow){this._shadow=asBoolean(t);this.invalidate()}}get isAnimated(){return this._animated}set isAnimated(t){this._animated=asBoolean(t)}get ranges(){return this._ranges}onValueChanged(t){this.valueChanged.raise(this,t)}refresh(t=!0){super.refresh(t);if(this._rangesDirty){this._rangesDirty=!1;let t=this._gRanges;this._rngElements.forEach(t=>{t.rng.propertyChanged.removeHandler(this._rangeChanged)});for(;t.lastChild;)t.removeChild(t.lastChild);this._rngElements=[];this._showRanges&&this._ranges.forEach(e=>{e.propertyChanged.addHandler(this._rangeChanged,this);this._rngElements.push({rng:e,el:this._createElement("path",t)})})}this._showElement(this._tValue,0!=(this.showText&ShowText.Value));this._showElement(this._tMin,0!=(this.showText&ShowText.MinMax));this._showElement(this._tMax,0!=(this.showText&ShowText.MinMax));this._showElement(this._cValue,0!=(this.showText&ShowText.Value)||this._thumbSize>0);this._updateText();let e=this._getFilterUrl();setAttribute(this._pFace,"filter",e);setAttribute(this._pPointer,"filter",e);this._updateRange(this._face);this._updateRange(this._pointer);this._updateTicks();this._ranges.forEach(t=>{this._updateRange(t)});this._initialized=!0}hitTest(t,e){isNumber(t)&&isNumber(e)?t=new Point(t,e):t instanceof Point||(t=mouseToPage(t));t=asType(t,Point);let i=Rect.fromBoundingRect(this._dSvg.getBoundingClientRect());t.x-=i.left+pageXOffset;t.y-=i.top+pageYOffset;return this._getValueFromPoint(t)}dispose(){if(this._animInterval){clearInterval(this._animInterval);this._animInterval=null}super.dispose()}static _getBBox(t){try{return t.getBBox()}catch(t){return{x:0,y:0,width:0,height:0}}}_getFilterUrl(){return this.hasShadow&&!isiOS()?"url(#"+this._filterID+")":null}_getRangeElement(t){if(t==this._face)return this._pFace;if(t==this._pointer)return this._pPointer;for(let e=0;e<this._rngElements.length;e++){let i=this._rngElements[e];if(i.rng==t)return i.el}return null}_rangeChanged(t,e){if(t==this._pointer&&"max"==e.propertyName){this.onValueChanged();this._updateText()}if(t!=this._face){if(t==this._pointer&&"max"==e.propertyName){if(this._animInterval){clearInterval(this._animInterval);this._updateRange(t,e.oldValue)}if(this.isAnimated&&!this.isUpdating&&this._initialized){let i=this._getPointerColor(e.oldValue),s=this._getPointerColor(e.newValue),a=i?new Color(i):null,n=s?new Color(s):null,h=clamp(Math.abs(e.newValue-e.oldValue)/(this.max-this.min),0,1);this._animInterval=animate(i=>{this._animColor=a&&n?Color.interpolate(a,n,i).toString():null;this._updateRange(t,e.oldValue+i*(e.newValue-e.oldValue));if(i>=1){this._animColor=null;this._animInterval=null;this._updateRange(t);this._updateText()}},h*Control._ANIM_DEF_DURATION);return}}this._updateRange(t)}else this.invalidate()}_createElement(t,e,i){let s=document.createElementNS(Gauge._SVGNS,t);i&&s.setAttribute("class",i);e.appendChild(s);return s}_centerText(t,e,i){if("none"!=t.getAttribute("display")){let s=Globalize.format(e,this.format);if(isFunction(this.getText)){let i="";t==this._tValue?i="value":t==this._tMin?i="min":t==this._tMax&&(i="max");i&&(s=this.getText(this,i,e,s))}t.textContent=s;let a=Rect.fromBoundingRect(Gauge._getBBox(t)),n=i.x-Math.round(a.width)/2,h=i.y+Math.round(a.height)/4;t.setAttribute("x",this._fix(n));t.setAttribute("y",this._fix(h))}}_copy(t,e){if("ranges"==t){asArray(e).forEach(t=>{let e=new Range(t);this.ranges.push(e)});return!0}if("pointer"==t){copy(this.pointer,e);return!0}return!1}_showElement(t,e){setAttribute(t,"display",e?null:"none")}_updateRange(t,e=t.max){t==this._pointer&&(t.min=null!=this.origin?this.origin:this.min<0&&this.max>0?0:this.min);let i=this._getRangeElement(t);if(i){this._updateRangeElement(i,t,e);let s=t.color;t==this._pointer&&(s=this._animColor?this._animColor:this._getPointerColor(t.max));setAttribute(i,"style",s?"fill:"+s:null)}}_getPointerColor(t){if(!this._showRanges){let e;for(let i=0;i<this._ranges.length;i++){let s=this._ranges[i];if(t>=s.min&&t<=s.max){e=s;break}}if(e)return e.color}return this._pointer.color}_keydown(t){if(!this._readOnly&&this._step){let e=!0;switch(this._getKey(t.keyCode)){case Key.Left:case Key.Down:this.value=clamp(this.value-this._step,this.min,this.max);break;case Key.Right:case Key.Up:this.value=clamp(this.value+this._step,this.min,this.max);break;case Key.Home:this.value=this.min;break;case Key.End:this.value=this.max;break;default:e=!1}e&&t.preventDefault()}}_getKey(t){return t}_applyMouseValue(t,e){if(!this.isReadOnly&&this.containsFocus()){let i=this.hitTest(t);if(null!=i){let t=this._animated,s=this._step;e&&(this._animated=!1);s&&(i=Math.round(i/s)*s);this.value=clamp(i,this.min,this.max);this._animated=t;return!0}}return!1}_updateRangeElement(t,e,i){assert(!1,"Gauge is an abstract class.")}_updateText(){assert(!1,"Gauge is an abstract class.")}_updateTicks(){assert(!1,"Gauge is an abstract class.")}_getValueFromPoint(t){return null}_fix(t){return isNumber(t)?parseFloat(t.toFixed(4)).toString():this._fix(t.x)+" "+this._fix(t.y)}_updateAria(){let t=this.hostElement;if(t){setAttribute(t,"aria-valuemin",this.min);setAttribute(t,"aria-valuemax",this.max);setAttribute(t,"aria-valuenow",this.value)}}}Gauge._SVGNS="http://www.w3.org/2000/svg";Gauge._ctr=0;Gauge._ctrlTemplate="";export var NeedleShape;!function(t){t[t.None=0]="None";t[t.Triangle=1]="Triangle";t[t.Diamond=2]="Diamond";t[t.Hexagon=3]="Hexagon";t[t.Rectangle=4]="Rectangle";t[t.Arrow=5]="Arrow";t[t.WideArrow=6]="WideArrow";t[t.Pointer=7]="Pointer";t[t.WidePointer=8]="WidePointer";t[t.Outer=9]="Outer"}(NeedleShape||(NeedleShape={}));export var NeedleLength;!function(t){t[t.Outer=0]="Outer";t[t.Middle=1]="Middle";t[t.Inner=2]="Inner"}(NeedleLength||(NeedleLength={}));export class RadialGauge extends Gauge{constructor(t,e){super(t,null);this._startAngle=0;this._sweepAngle=180;this._autoScale=!0;this._ndlShape=NeedleShape.None;this._ndlLength=NeedleLength.Middle;addClass(this.hostElement,RadialGaugeClsNames.hostElement);this._thickness=.4;this.showText=ShowText.All;this.initialize(e)}static get controlTemplate(){RadialGauge._ctrlTemplate||(RadialGauge._ctrlTemplate=Gauge.controlTemplate);return RadialGauge._ctrlTemplate}static set controlTemplate(t){RadialGauge._ctrlTemplate=t}get startAngle(){return this._startAngle}set startAngle(t){if(t!=this._startAngle){this._startAngle=clamp(asNumber(t,!1),-360,360);this.invalidate()}}get sweepAngle(){return this._sweepAngle}set sweepAngle(t){if(t!=this._sweepAngle){this._sweepAngle=clamp(asNumber(t,!1),-360,360);this.invalidate()}}get autoScale(){return this._autoScale}set autoScale(t){if(t!=this._autoScale){this._autoScale=asBoolean(t);this.invalidate()}}get faceBounds(){return this._rcSvg?this._rcSvg.clone():null}get clientSize(){_deprecated("clientSize","faceBounds");let t=this._rcSvg;return t?new Size(t.width,t.height):null}get needleElement(){return this._ndlElement}set needleElement(t){if(t!=this._ndlElement){this._ndlShape=0;this._ndlElement=asType(t,SVGElement,!0);let e=this._gNeedle;for(;e.firstChild;)removeChild(e.firstChild);if(this._ndlElement){setAttribute(e,"transform","scale(0)");e.appendChild(this._ndlElement)}this.invalidate()}}get needleShape(){return this._ndlShape}set needleShape(t){if(t!=this._ndlShape){if((t=asEnum(t,NeedleShape))===this._ndlShape)return;let e=null;switch(t){case NeedleShape.Triangle:e=RadialGauge.createNeedleElement([{x:-10,y:10},{x:100,y:0}]);break;case NeedleShape.Diamond:e=RadialGauge.createNeedleElement([{x:-20,y:0},{x:0,y:10},{x:100,y:0}]);break;case NeedleShape.Hexagon:e=RadialGauge.createNeedleElement([{x:-15,y:0},{x:-10,y:5},{x:10,y:5},{x:100,y:0}]);break;case NeedleShape.Rectangle:e=RadialGauge.createNeedleElement([{x:-20,y:3},{x:100,y:3}],10);break;case NeedleShape.Arrow:e=RadialGauge.createNeedleElement([{x:-20,y:3},{x:70,y:3},{x:70,y:15},{x:100,y:0}],10);break;case NeedleShape.WideArrow:e=RadialGauge.createNeedleElement([{x:-30,y:5},{x:-40,y:15},{x:-20,y:15},{x:-10,y:5},{x:80,y:5},{x:70,y:15},{x:100,y:0}]);break;case NeedleShape.Pointer:e=RadialGauge.createNeedleElement([{x:0,y:10},{x:100,y:0}],20,10);break;case NeedleShape.WidePointer:e=RadialGauge.createNeedleElement([{x:0,y:20},{x:100,y:0}],20,10);break;case NeedleShape.Outer:e=RadialGauge.createNeedleElement([{x:60,y:20},{x:100,y:0}])}this.needleElement=e;this._ndlShape=t;this.invalidate()}}get needleLength(){return this._ndlLength}set needleLength(t){if(t!=this._ndlLength){this._ndlLength=asEnum(t,NeedleLength);this.invalidate()}}static createNeedleElement(t,e,i){let s="";for(let e=0;e<t.length;e++){let i=t[e];if(e==t.length-1&&0==i.y)break;s+=(e>0?" L ":"M ")+i.x+" "+i.y}for(let e=t.length-1;e>=0;e--){let i=t[e];s+=" L "+i.x+" "+-i.y}s+=" Z";let a="http://www.w3.org/2000/svg",n=document.createElementNS(a,"g"),h=document.createElementNS(a,"path");setAttribute(h,"d",s);n.appendChild(h);if(e){let t=document.createElementNS(a,"circle");addClass(t,GaugeClsNames.needleCap);setAttribute(t,"r",e);n.appendChild(t);if(i){t=document.createElementNS(a,"circle");addClass(t,GaugeClsNames.innerNeedleCap);setAttribute(t,"r",i);n.appendChild(t)}}return n}refresh(t=!0){setAttribute(this._svg,"viewBox",null);this._rcSvg=Rect.fromBoundingRect(this._dSvg.getBoundingClientRect());super.refresh(t);this._ctmInv=null;this._ptSvg=null;if(this._autoScale){setAttribute(this._svg,"viewBox",null);let t=Rect.fromBoundingRect(Gauge._getBBox(this._pFace));0!=(this.showText&ShowText.Value)&&(t=Rect.union(t,Rect.fromBoundingRect(Gauge._getBBox(this._tValue))));if(0!=(this.showText&ShowText.MinMax)){t=Rect.union(t,Rect.fromBoundingRect(Gauge._getBBox(this._tMin)));t=Rect.union(t,Rect.fromBoundingRect(Gauge._getBBox(this._tMax)))}let e=[this._fix(t.left),this._fix(t.top),this._fix(t.width),this._fix(t.height)].join(" ");setAttribute(this._svg,"viewBox",e);let i=this._pFace.getCTM();this._ctmInv=i?i.inverse():null;this._ptSvg=this._svg.createSVGPoint()}}_updateRangeElement(t,e,i){if(this._rcSvg){let s=this._rcSvg,a=new Point(s.width/2,s.height/2),n=Math.min(s.width,s.height)/2,h=n*this.thickness,r=h*e.thickness,l=n-(h-r)/2,o=l-r,g=this._getStartAngle(),c=this._getSweepAngle(),u=e==this._face,_=u?0:this._getPercent(e.min),d=g+c*_,m=c*((u?1:this._getPercent(i))-_);if(this.stackRanges&&e!=this.face&&e!=this.pointer){let t=this.ranges.indexOf(e);if(t>-1){let e=this.ranges.length,i=(l-o)/e;l=(o+=(e-1-t)*i)+i}}this._updateSegment(t,a,l,o,d,m);if(e==this._pointer){let t=this._fix;if(this.thumbSize>0){let s=this._animColor?this._animColor:this._getPointerColor(e.max),n=this._getPoint(a,g+c*this._getPercent(i),(l+o)/2),h=this._cValue;setAttribute(h,"cx",t(n.x));setAttribute(h,"cy",t(n.y));setAttribute(h,"style",s?"fill:"+s:null);setAttribute(h,"r",t(this.thumbSize/2))}if(this.needleElement){let e=l;this._ndlLength==NeedleLength.Inner?e=o:this._ndlLength==NeedleLength.Middle&&(e=(o+l)/2);let i="translate({cx}, {cy}) scale({scale}) rotate({angle})".replace("{cx}",t(a.x)).replace("{cy}",t(a.y)).replace("{scale}",t(e/100)).replace("{angle}",t(d+m));this._gNeedle.setAttribute("transform",i)}}}}_getStartAngle(){let t=this.startAngle+180;this.rightToLeft&&(t=180-t);return t}_getSweepAngle(){let t=this.sweepAngle;this.rightToLeft&&(t=-t);return t}_updateText(){if(this._rcSvg){let t=this._rcSvg,e=new Point(t.width/2,t.height/2),i=Math.min(t.width,t.height)/2,s=Math.max(0,i*(1-this.thickness)),a=this._getStartAngle(),n=this._getSweepAngle();this._showElement(this._cValue,this.thumbSize>0);let h=0!=(this.showText&ShowText.MinMax)&&Math.abs(n)<=300;this._showElement(this._tMin,h);this._showElement(this._tMax,h);this._centerText(this._tValue,this.value,e);let r=10*(this._getSweepAngle()<0?-1:1);this._centerText(this._tMin,this.min,this._getPoint(e,a-r,(i+s)/2));this._centerText(this._tMax,this.max,this._getPoint(e,a+n+r,(i+s)/2))}}_updateTicks(){let t=this.tickSpacing&&this.tickSpacing>0?this.tickSpacing:this.step,e="",i=this._gTicks;for(;i.firstChild;)removeChild(i.firstChild);if(this.showTicks&&t>0){let s=this._rcSvg,a=new Point(s.width/2,s.height/2),n=Math.min(s.width,s.height)/2,h=n*this.thickness,r=h*this._face.thickness,l=n-(h-r)/2,o=l-r,g=1.15*l,c=this._getStartAngle(),u=this._getSweepAngle();for(let s=this.min;s<=this.max;s+=t){let t=c+u*this._getPercent(s),n=this._fix(this._getPoint(a,t,o)),h=this._fix(this._getPoint(a,t,l));s>this.min&&s<this.max&&(e+="M "+n+" L "+h+" ");if(this.showTickText){let e=this._createElement("text",i),n=this._getPoint(a,t,g);this._centerText(e,s,n)}}}this._pTicks.setAttribute("d",e)}_updateSegment(t,e,i,s,a,n){n=Math.min(Math.max(n,-359.99),359.99);let h=this._getPoint(e,a,s),r=this._getPoint(e,a,i),l=this._getPoint(e,a+n,i),o=this._getPoint(e,a+n,s),g={large:Math.abs(n)>180?1:0,cw:n>0?1:0,ccw:n>0?0:1,or:this._fix(i),ir:this._fix(s),p1:this._fix(h),p2:this._fix(r),p3:this._fix(l),p4:this._fix(o)},c=format("M {p1} L {p2} A {or} {or} 0 {large} {cw} {p3} L {p4} A {ir} {ir} 0 {large} {ccw} {p1} Z",g);t.setAttribute("d",c)}_getPoint(t,e,i){e=e*Math.PI/180;return new Point(t.x+i*Math.cos(e),t.y+i*Math.sin(e))}_getValueFromPoint(t){if(this.autoScale&&this._ctmInv){this._ptSvg.x=t.x;this._ptSvg.y=t.y;this._ptSvg=this._ptSvg.matrixTransform(this._ctmInv);t.x=this._ptSvg.x;t.y=this._ptSvg.y}if(!this._rcSvg||!this.sweepAngle)return null;let e=this._rcSvg,i=new Point(e.width/2,e.height/2),s=Math.min(e.width,e.height)/2,a=t.x-i.x,n=t.y-i.y,h=n*n+a*a;if(h<400||h>(s+20)*(s+20))return null;let r=180*(Math.PI-Math.atan2(-n,a))/Math.PI,l=this.startAngle,o=this.sweepAngle,g=l+o;this.rightToLeft&&(r=180-r);if(o>0){for(;r<l;)r+=360;for(;r>g;)r-=360}else{for(;r<g;)r+=360;for(;r>l;)r-=360}if((r-l)*(r-g)>0){let t=this._getPoint(i,r,s),e=this._getPoint(i,l,s),a=this._getPoint(i,g,s);r=this._getDist2(t,e)<this._getDist2(t,a)?l:g}let c=o?clamp(Math.abs(r-l)/Math.abs(o),0,1):0;return this.min+c*(this.max-this.min)}_getDist2(t,e){let i=t.x-e.x,s=t.y-e.y;return i*i+s*s}}RadialGauge._ctrlTemplate="";export var GaugeDirection;!function(t){t[t.Right=0]="Right";t[t.Left=1]="Left";t[t.Up=2]="Up";t[t.Down=3]="Down"}(GaugeDirection||(GaugeDirection={}));export class LinearGauge extends Gauge{constructor(t,e){super(t,null);this._direction=GaugeDirection.Right;addClass(this.hostElement,LinearGaugeClsNames.hostElement);this.initialize(e)}static get controlTemplate(){LinearGauge._ctrlTemplate||(LinearGauge._ctrlTemplate=Gauge.controlTemplate);return LinearGauge._ctrlTemplate}static set controlTemplate(t){LinearGauge._ctrlTemplate=t}get direction(){return this._direction}set direction(t){if((t=asEnum(t,GaugeDirection))!=this._direction){this._direction=t;this.invalidate()}}get faceBounds(){return this._getRangeRect(this._face)}_updateRangeElement(t,e,i){let s=this._getRangeRect(e,i);this._updateSegment(t,s);let a=e==this._pointer&&0!=(this.showText&ShowText.Value),n=a||e==this._pointer&&this.thumbSize>0,h=s.left+s.width/2,r=s.top+s.height/2;switch(this._getDirection()){case GaugeDirection.Right:h=s.right;break;case GaugeDirection.Left:h=s.left;break;case GaugeDirection.Up:r=s.top;break;case GaugeDirection.Down:r=s.bottom}a&&this._centerText(this._tValue,i,new Point(h,r));if(a||n){s=Rect.fromBoundingRect(Gauge._getBBox(this._tValue));let t=this._animColor?this._animColor:this._getPointerColor(e.max),i=null!=this.thumbSize?this.thumbSize/2:.8*Math.max(s.width,s.height),a=this._cValue;setAttribute(a,"cx",this._fix(h));setAttribute(a,"cy",this._fix(r));setAttribute(a,"style",t?"fill:"+t:null);setAttribute(a,"r",this._fix(i))}}_updateText(){let t=this._getRangeRect(this._face);switch(this._getDirection()){case GaugeDirection.Right:this._setText(this._tMin,this.min,t,"left");this._setText(this._tMax,this.max,t,"right");break;case GaugeDirection.Left:this._setText(this._tMin,this.min,t,"right");this._setText(this._tMax,this.max,t,"left");break;case GaugeDirection.Up:this._setText(this._tMin,this.min,t,"bottom");this._setText(this._tMax,this.max,t,"top");break;case GaugeDirection.Down:this._setText(this._tMin,this.min,t,"top");this._setText(this._tMax,this.max,t,"bottom")}}_updateTicks(){let t=this.tickSpacing&&this.tickSpacing>0?this.tickSpacing:this.step,e="",i=this._gTicks;for(;i.firstChild;)removeChild(i.firstChild);if(this.showTicks&&t>0){let s,a=this._getRangeRect(this._face),n=new Point(a.left-.75*a.width,a.top-.75*a.height),h=this._fix;for(let r=this.min;r<=this.max;r+=t){let t=null;switch(this._getDirection()){case GaugeDirection.Right:n.x=a.left+a.width*this._getPercent(r);t="M "+(s=h(n.x))+" "+h(a.top)+" L "+s+" "+h(a.bottom)+" ";break;case GaugeDirection.Left:n.x=a.right-a.width*this._getPercent(r);t="M "+(s=h(n.x))+" "+h(a.top)+" L "+s+" "+h(a.bottom)+" ";break;case GaugeDirection.Up:n.y=a.bottom-a.height*this._getPercent(r);s=h(n.y);t="M "+h(a.left)+" "+s+" L "+h(a.right)+" "+s+" ";break;case GaugeDirection.Down:n.y=a.top+a.height*this._getPercent(r);s=h(n.y);t="M "+h(a.left)+" "+s+" L "+h(a.right)+" "+s+" "}r>this.min&&r<this.max&&(e+=t);if(this.showTickText){let t=this._createElement("text",i);this._centerText(t,r,n)}}}this._pTicks.setAttribute("d",e)}_updateSegment(t,e){let i={p1:this._fix(new Point(e.left,e.top)),p2:this._fix(new Point(e.right,e.top)),p3:this._fix(new Point(e.right,e.bottom)),p4:this._fix(new Point(e.left,e.bottom))},s=format("M {p1} L {p2} L {p3} L {p4} Z",i);t.setAttribute("d",s)}_setText(t,e,i,s){if("none"!=t.getAttribute("display")){let a=Globalize.format(e,this.format);if(isFunction(this.getText)){let i=t==this._tValue?"value":t==this._tMin?"min":t==this._tMax?"max":null;assert(null!=i,"unknown element");a=this.getText(this,i,e,a)}t.textContent=a;let n=Rect.fromBoundingRect(Gauge._getBBox(t)),h=new Point(i.left+i.width/2-n.width/2,i.top+i.height/2+n.height/2);switch(s){case"top":h.y=i.top-4;break;case"left":h.x=i.left-4-n.width;break;case"right":h.x=i.right+4;break;case"bottom":h.y=i.bottom+4+n.height}t.setAttribute("x",this._fix(h.x));t.setAttribute("y",this._fix(h.y))}}_getRangeRect(t,e=t.max){let i=this.hostElement,s=new Rect(0,0,i.clientWidth,i.clientHeight),a=this._getDirection(),n=this.thumbSize?Math.ceil(this.thumbSize/2):0;if(this.showText!=ShowText.None){let t=parseInt(getComputedStyle(i).fontSize);isNaN(t)||(n=Math.max(n,3*t))}switch(a){case GaugeDirection.Right:case GaugeDirection.Left:s=s.inflate(-n,-s.height*(1-this.thickness*t.thickness)/2);break;case GaugeDirection.Up:case GaugeDirection.Down:s=s.inflate(-s.width*(1-this.thickness*t.thickness)/2,-n)}if(this.stackRanges&&t!=this.face&&t!=this.pointer){let e=this.ranges.indexOf(t);if(e>-1){let t=this.ranges.length;switch(a){case GaugeDirection.Right:case GaugeDirection.Left:s.height/=t;s.top+=e*s.height;break;case GaugeDirection.Up:case GaugeDirection.Down:s.width/=t;s.left+=e*s.width}}}let h=t==this._face,r=h?0:this._getPercent(t.min),l=h?1:this._getPercent(e);switch(a){case GaugeDirection.Right:s.left+=s.width*r;s.width*=l-r;break;case GaugeDirection.Left:s.left=s.right-s.width*l;s.width=s.width*(l-r);break;case GaugeDirection.Down:s.top+=s.height*r;s.height*=l-r;break;case GaugeDirection.Up:s.top=s.bottom-s.height*l;s.height=s.height*(l-r)}return s}_getValueFromPoint(t){let e=this._getRangeRect(this._face),i=0;switch(this._getDirection()){case GaugeDirection.Right:i=e.width>0?(t.x-e.left)/e.width:0;break;case GaugeDirection.Left:i=e.width>0?(e.right-t.x)/e.width:0;break;case GaugeDirection.Up:i=e.height>0?(e.bottom-t.y)/e.height:0;break;case GaugeDirection.Down:i=e.height>0?(t.y-e.top)/e.height:0}return this.min+i*(this.max-this.min)}_getDirection(){let t=this._direction;if(this.rightToLeft)switch(t){case GaugeDirection.Left:t=GaugeDirection.Right;break;case GaugeDirection.Right:t=GaugeDirection.Left}return t}_getKey(t){switch(this._getDirection()){case GaugeDirection.Left:switch(t){case Key.Left:t=Key.Right;break;case Key.Right:t=Key.Left}break;case GaugeDirection.Down:switch(t){case Key.Up:t=Key.Down;break;case Key.Down:t=Key.Up}}return t}}LinearGauge._ctrlTemplate="";export class BulletGraph extends LinearGauge{constructor(t,e){super(t,null);addClass(this.hostElement,BulletGraphClsNames.hostElement);this._pointer.thickness=.35;this._rngTarget=new Range("target");this._rngTarget.thickness=.8;this._rngTarget.color="black";this._rngGood=new Range("good");this._rngGood.color="rgba(0,0,0,.15)";this._rngBad=new Range("bad");this._rngBad.color="rgba(0,0,0,.3)";this.ranges.push(this._rngBad);this.ranges.push(this._rngGood);this.ranges.push(this._rngTarget);this.initialize(e)}static get controlTemplate(){BulletGraph._ctrlTemplate||(BulletGraph._ctrlTemplate=LinearGauge.controlTemplate);return BulletGraph._ctrlTemplate}static set controlTemplate(t){BulletGraph._ctrlTemplate=t}get target(){return this._rngTarget.max}set target(t){this._rngTarget.max=t}get good(){return this._rngGood.max}set good(t){this._rngGood.max=t}get bad(){return this._rngBad.max}set bad(t){this._rngBad.max=t}_getRangeRect(t,e=t.max){let i=super._getRangeRect(t,e);if(t==this._rngTarget)switch(this._getDirection()){case GaugeDirection.Right:i.left=i.right-1;i.width=3;break;case GaugeDirection.Left:i.width=3;break;case GaugeDirection.Up:i.height=3;break;case GaugeDirection.Down:i.top=i.bottom-1;i.height=3}return i}}BulletGraph._ctrlTemplate="";_registerModule("wijmo.gauge",selfModule);
package/es5-esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * Wijmo Library 5.20242.30
3
+ * Wijmo Library 5.20251.40
4
4
  * https://developer.mescius.com/wijmo
5
5
  *
6
6
  * Copyright(c) MESCIUS inc. All rights reserved.
@@ -11,4 +11,4 @@
11
11
  *
12
12
  */
13
13
 
14
- var __extends=this&&this.__extends||function(){var extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};return function(e,t){extendStatics(e,t);function __(){this.constructor=e}e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}}();import{isString,copy,asNumber,asString,clamp,PropertyChangedEventArgs,Event,assert,setAttribute,animate,setCss,toggleClass,mouseToPage,isiOS,isNumber,isFunction,asBoolean,asType,asFunction,asEnum,asArray,Globalize,Control,Color,Point,Rect,Key,ObservableArray,ControlStateClsNames,ControlClsNames,addClass,format,removeChild,Size,_deprecated,_registerModule}from"@grapecity/wijmo";import*as selfModule from"@grapecity/wijmo.gauge";export var BulletGraphClsNames={hostElement:"wj-bulletgraph"};export var GaugeClsNames={cover:"wj-cover",face:"wj-face",filter:"wj-gauge-filter",hostElement:"wj-gauge",innerNeedleCap:"wj-inner-needle-cap",max:"wj-max",min:"wj-min",needle:"wj-needle",needleCap:"wj-needle-cap",pointer:"wj-pointer",ranges:"wj-ranges",thumb:"wj-thumb",tickText:"wj-tick-text",ticks:"wj-ticks",value:"wj-value"};export var LinearGaugeClsNames={hostElement:"wj-lineargauge"};export var RadialGaugeClsNames={hostElement:"wj-radialgauge"};export var RangeClsNames={ranges:"wj-ranges"};var Range=function(){function Range(e){this._min=0;this._max=100;this._thickness=1;this.propertyChanged=new Event;isString(e)?this._name=e:copy(this,e)}Object.defineProperty(Range.prototype,"min",{get:function(){return this._min},set:function(e){this._setProp("_min",asNumber(e,!0))},enumerable:!0,configurable:!0});Object.defineProperty(Range.prototype,"max",{get:function(){return this._max},set:function(e){this._setProp("_max",asNumber(e,!0))},enumerable:!0,configurable:!0});Object.defineProperty(Range.prototype,"color",{get:function(){return this._color},set:function(e){this._setProp("_color",asString(e))},enumerable:!0,configurable:!0});Object.defineProperty(Range.prototype,"thickness",{get:function(){return this._thickness},set:function(e){this._setProp("_thickness",clamp(asNumber(e),0,1))},enumerable:!0,configurable:!0});Object.defineProperty(Range.prototype,"name",{get:function(){return this._name},set:function(e){this._setProp("_name",asString(e))},enumerable:!0,configurable:!0});Range.prototype.onPropertyChanged=function(e){this.propertyChanged.raise(this,e)};Range.prototype._setProp=function(e,t){var i=this[e];if(t!=i){this[e]=t;var n=new PropertyChangedEventArgs(e.substr(1),i,t);this.onPropertyChanged(n)}};Range._ctr=0;return Range}();export{Range};export var ShowText;!function(e){e[e.None=0]="None";e[e.Value=1]="Value";e[e.MinMax=2]="MinMax";e[e.All=3]="All"}(ShowText||(ShowText={}));var Gauge=function(e){__extends(Gauge,e);function Gauge(t,i){var n=e.call(this,t,null,!0)||this;n._ranges=new ObservableArray;n._rngElements=[];n._format="n0";n._showRanges=!0;n._stackRanges=!1;n._shadow=!0;n._animated=!0;n._readOnly=!0;n._handleWheel=!0;n._step=1;n._showText=ShowText.None;n._showTicks=!1;n._showTickText=!1;n._thickness=.8;n._initialized=!1;n.valueChanged=new Event;n._getPercent=function(e){var t=this.max>this.min?(e-this.min)/(this.max-this.min):0;return Math.max(0,Math.min(1,t))};Gauge._ctr++;var a=n.hostElement;setAttribute(a,"role","slider",!0);var r=n.getTemplate();n.applyTemplate(ControlClsNames.hostElement+" "+GaugeClsNames.hostElement,r,{_dSvg:"dsvg",_svg:"svg",_filter:"filter",_gFace:"gface",_gRanges:"granges",_gPointer:"gpointer",_gCover:"gcover",_pFace:"pface",_pPointer:"ppointer",_cValue:"cvalue",_tValue:"value",_tMin:"min",_tMax:"max",_pTicks:"pticks",_gTicks:"gticks",_gNeedle:"gneedle"});setCss(n._dSvg,{width:"100%",height:"100%"});n._filterID="wj-gauge-filter-"+Gauge._ctr.toString(36);n._filter.setAttribute("id",n._filterID);n.face=new Range;n.pointer=new Range;n._ranges.collectionChanged.addHandler((function(){n._ranges.forEach((function(e){assert(e instanceof Range,"ranges array must contain Range objects.")}));n._rangesDirty=!0;n.invalidate()}));n.addEventListener(a,"keydown",n._keydown.bind(n));n.addEventListener(a,"click",(function(e){if(0==e.button){n.focus();n._applyMouseValue(e)}}));n.addEventListener(a,"mousedown",(function(e){if(0==e.button){n.focus();n._dragging=!0;setTimeout((function(){n._applyMouseValue(e)}))}}));n.addEventListener(a,"mousemove",(function(e){n._dragging&&n.containsFocus()&&n._applyMouseValue(e,!0)}));n.addEventListener(a,"mouseup",(function(e){n._dragging=!1}));n.addEventListener(a,"mouseleave",(function(e){e.target==a&&(n._dragging=!1)}));if("ontouchstart"in window){n.addEventListener(a,"touchstart",(function(e){n.focus();!e.defaultPrevented&&n._applyMouseValue(e,!1)&&e.preventDefault()}));n.addEventListener(a,"touchmove",(function(e){!e.defaultPrevented&&n._applyMouseValue(e,!0)&&e.preventDefault()}))}n.addEventListener(a,"wheel",(function(e){if(n._handleWheel&&!n.isReadOnly&&!e.defaultPrevented&&n.containsFocus()&&null!=n.value&&n.hitTest(e)){var t=clamp(-e.deltaY,-1,1);n.value=clamp(n.value+(n.step||1)*t,n.min,n.max);e.preventDefault()}}));n.isReadOnly=!0;n.initialize(i);n.invalidate();return n}Object.defineProperty(Gauge,"controlTemplate",{get:function(){Gauge._ctrlTemplate||(Gauge._ctrlTemplate='<div wj-part="dsvg" dir="ltr"><svg wj-part="svg" width="100%" height="100%"><defs><filter wj-part="filter"><feOffset dx="3" dy="3"></feOffset><feGaussianBlur result="offset-blur" stdDeviation="5"></feGaussianBlur><feComposite operator="out" in="SourceGraphic" in2="offset-blur" result="inverse"></feComposite><feFlood flood-color="black" flood-opacity="0.2" result="color"></feFlood><feComposite operator="in" in="color" in2="inverse" result="shadow"></feComposite><feComposite operator="over" in="shadow" in2="SourceGraphic"></feComposite></filter></defs><g wj-part="gface" class="'+GaugeClsNames.face+'"><path wj-part="pface"/></g><g wj-part="granges" class="'+GaugeClsNames.ranges+'"/><g wj-part="gpointer" class="'+GaugeClsNames.pointer+'"><path wj-part="ppointer"/></g><g wj-part="gcover" class="'+GaugeClsNames.cover+'"><path wj-part="pticks" class="'+GaugeClsNames.ticks+'"/><g wj-part="gticks" aria-hidden="true" class="'+GaugeClsNames.tickText+'"/><circle wj-part="cvalue" class="'+GaugeClsNames.pointer+" "+GaugeClsNames.thumb+'"/><g wj-part="gneedle" class="'+GaugeClsNames.needle+'"/><text wj-part="value" class="'+GaugeClsNames.value+'"/><text wj-part="min" class="'+GaugeClsNames.min+'" aria-hidden="true"/><text wj-part="max" class="'+GaugeClsNames.max+'" aria-hidden="true"/></g></svg></div>');return Gauge._ctrlTemplate},set:function(e){Gauge._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"value",{get:function(){return this._pointer.max},set:function(e){if(e!=this.value){this._pointer.max=asNumber(e,!0);this._updateAria()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"min",{get:function(){return this._face.min},set:function(e){if(e!=this.min){this._face.min=asNumber(e);this._updateAria()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"max",{get:function(){return this._face.max},set:function(e){if(e!=this.max){this._face.max=asNumber(e);this._updateAria()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"origin",{get:function(){return this._origin},set:function(e){if(e!=this._origin){this._origin=asNumber(e,!0);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"isReadOnly",{get:function(){return this._readOnly},set:function(e){this._readOnly=asBoolean(e);setAttribute(this._svg,"cursor",this._readOnly?null:"pointer");toggleClass(this.hostElement,ControlStateClsNames.readOnly,this.isReadOnly)},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"handleWheel",{get:function(){return this._handleWheel},set:function(e){this._handleWheel=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"step",{get:function(){return this._step},set:function(e){if(e!=this._step){this._step=asNumber(e,!0);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"format",{get:function(){return this._format},set:function(e){if(e!=this._format){this._format=asString(e);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"getText",{get:function(){return this._getText},set:function(e){if(e!=this._getText){this._getText=asFunction(e);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"thickness",{get:function(){return this._thickness},set:function(e){if(e!=this._thickness){this._thickness=clamp(asNumber(e,!1),0,1);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"face",{get:function(){return this._face},set:function(e){if(e!=this._face){this._face&&this._face.propertyChanged.removeHandler(this._rangeChanged);this._face=asType(e,Range);this._face&&this._face.propertyChanged.addHandler(this._rangeChanged,this);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"pointer",{get:function(){return this._pointer},set:function(e){if(e!=this._pointer){var t=null;if(this._pointer){t=this.value;this._pointer.propertyChanged.removeHandler(this._rangeChanged)}this._pointer=asType(e,Range);if(this._pointer){t&&(this.value=t);this._pointer.propertyChanged.addHandler(this._rangeChanged,this)}this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"showText",{get:function(){return this._showText},set:function(e){if((e=asEnum(e,ShowText))!=this._showText){this._showText=e;this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"showTicks",{get:function(){return this._showTicks},set:function(e){if(e!=this._showTicks){this._showTicks=asBoolean(e);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"showTickText",{get:function(){return this._showTickText},set:function(e){if(e!=this._showTickText){this._showTickText=asBoolean(e);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"tickSpacing",{get:function(){return this._tickSpacing},set:function(e){if(e!=this._tickSpacing){this._tickSpacing=asNumber(e,!0);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"thumbSize",{get:function(){return this._thumbSize},set:function(e){if(e!=this._thumbSize){this._thumbSize=asNumber(e,!0,!0);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"showRanges",{get:function(){return this._showRanges},set:function(e){if(e!=this._showRanges){this._showRanges=asBoolean(e);this._animColor=null;this._rangesDirty=!0;this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"stackRanges",{get:function(){return this._stackRanges},set:function(e){if(e!=this._stackRanges){this._stackRanges=asBoolean(e);this._animColor=null;this._rangesDirty=!0;this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"hasShadow",{get:function(){return this._shadow},set:function(e){if(e!=this._shadow){this._shadow=asBoolean(e);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"isAnimated",{get:function(){return this._animated},set:function(e){this._animated=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"ranges",{get:function(){return this._ranges},enumerable:!0,configurable:!0});Gauge.prototype.onValueChanged=function(e){this.valueChanged.raise(this,e)};Gauge.prototype.refresh=function(t){var i=this;void 0===t&&(t=!0);e.prototype.refresh.call(this,t);if(this._rangesDirty){this._rangesDirty=!1;var n=this._gRanges;this._rngElements.forEach((function(e){e.rng.propertyChanged.removeHandler(i._rangeChanged)}));for(;n.lastChild;)n.removeChild(n.lastChild);this._rngElements=[];this._showRanges&&this._ranges.forEach((function(e){e.propertyChanged.addHandler(i._rangeChanged,i);i._rngElements.push({rng:e,el:i._createElement("path",n)})}))}this._showElement(this._tValue,0!=(this.showText&ShowText.Value));this._showElement(this._tMin,0!=(this.showText&ShowText.MinMax));this._showElement(this._tMax,0!=(this.showText&ShowText.MinMax));this._showElement(this._cValue,0!=(this.showText&ShowText.Value)||this._thumbSize>0);this._updateText();var a=this._getFilterUrl();setAttribute(this._pFace,"filter",a);setAttribute(this._pPointer,"filter",a);this._updateRange(this._face);this._updateRange(this._pointer);this._updateTicks();this._ranges.forEach((function(e){i._updateRange(e)}));this._initialized=!0};Gauge.prototype.hitTest=function(e,t){isNumber(e)&&isNumber(t)?e=new Point(e,t):e instanceof Point||(e=mouseToPage(e));e=asType(e,Point);var i=Rect.fromBoundingRect(this._dSvg.getBoundingClientRect());e.x-=i.left+pageXOffset;e.y-=i.top+pageYOffset;return this._getValueFromPoint(e)};Gauge.prototype.dispose=function(){if(this._animInterval){clearInterval(this._animInterval);this._animInterval=null}e.prototype.dispose.call(this)};Gauge._getBBox=function(e){try{return e.getBBox()}catch(e){return{x:0,y:0,width:0,height:0}}};Gauge.prototype._getFilterUrl=function(){return this.hasShadow&&!isiOS()?"url(#"+this._filterID+")":null};Gauge.prototype._getRangeElement=function(e){if(e==this._face)return this._pFace;if(e==this._pointer)return this._pPointer;for(var t=0;t<this._rngElements.length;t++){var i=this._rngElements[t];if(i.rng==e)return i.el}return null};Gauge.prototype._rangeChanged=function(e,t){var i=this;if(e==this._pointer&&"max"==t.propertyName){this.onValueChanged();this._updateText()}if(e!=this._face){if(e==this._pointer&&"max"==t.propertyName){if(this._animInterval){clearInterval(this._animInterval);this._updateRange(e,t.oldValue)}if(this.isAnimated&&!this.isUpdating&&this._initialized){var n=this._getPointerColor(t.oldValue),a=this._getPointerColor(t.newValue),r=n?new Color(n):null,s=a?new Color(a):null,o=clamp(Math.abs(t.newValue-t.oldValue)/(this.max-this.min),0,1);this._animInterval=animate((function(n){i._animColor=r&&s?Color.interpolate(r,s,n).toString():null;i._updateRange(e,t.oldValue+n*(t.newValue-t.oldValue));if(n>=1){i._animColor=null;i._animInterval=null;i._updateRange(e);i._updateText()}}),o*Control._ANIM_DEF_DURATION);return}}this._updateRange(e)}else this.invalidate()};Gauge.prototype._createElement=function(e,t,i){var n=document.createElementNS(Gauge._SVGNS,e);i&&n.setAttribute("class",i);t.appendChild(n);return n};Gauge.prototype._centerText=function(e,t,i){if("none"!=e.getAttribute("display")){var n=Globalize.format(t,this.format);if(isFunction(this.getText)){var a="";e==this._tValue?a="value":e==this._tMin?a="min":e==this._tMax&&(a="max");a&&(n=this.getText(this,a,t,n))}e.textContent=n;var r=Rect.fromBoundingRect(Gauge._getBBox(e)),s=i.x-Math.round(r.width)/2,o=i.y+Math.round(r.height)/4;e.setAttribute("x",this._fix(s));e.setAttribute("y",this._fix(o))}};Gauge.prototype._copy=function(e,t){var i=this;if("ranges"==e){asArray(t).forEach((function(e){var t=new Range(e);i.ranges.push(t)}));return!0}if("pointer"==e){copy(this.pointer,t);return!0}return!1};Gauge.prototype._showElement=function(e,t){setAttribute(e,"display",t?null:"none")};Gauge.prototype._updateRange=function(e,t){void 0===t&&(t=e.max);e==this._pointer&&(e.min=null!=this.origin?this.origin:this.min<0&&this.max>0?0:this.min);var i=this._getRangeElement(e);if(i){this._updateRangeElement(i,e,t);var n=e.color;e==this._pointer&&(n=this._animColor?this._animColor:this._getPointerColor(e.max));setAttribute(i,"style",n?"fill:"+n:null)}};Gauge.prototype._getPointerColor=function(e){if(!this._showRanges){for(var t,i=0;i<this._ranges.length;i++){var n=this._ranges[i];if(e>=n.min&&e<=n.max){t=n;break}}if(t)return t.color}return this._pointer.color};Gauge.prototype._keydown=function(e){if(!this._readOnly&&this._step){var t=!0;switch(this._getKey(e.keyCode)){case Key.Left:case Key.Down:this.value=clamp(this.value-this._step,this.min,this.max);break;case Key.Right:case Key.Up:this.value=clamp(this.value+this._step,this.min,this.max);break;case Key.Home:this.value=this.min;break;case Key.End:this.value=this.max;break;default:t=!1}t&&e.preventDefault()}};Gauge.prototype._getKey=function(e){return e};Gauge.prototype._applyMouseValue=function(e,t){if(!this.isReadOnly&&this.containsFocus()){var i=this.hitTest(e);if(null!=i){var n=this._animated,a=this._step;t&&(this._animated=!1);a&&(i=Math.round(i/a)*a);this.value=clamp(i,this.min,this.max);this._animated=n;return!0}}return!1};Gauge.prototype._updateRangeElement=function(e,t,i){assert(!1,"Gauge is an abstract class.")};Gauge.prototype._updateText=function(){assert(!1,"Gauge is an abstract class.")};Gauge.prototype._updateTicks=function(){assert(!1,"Gauge is an abstract class.")};Gauge.prototype._getValueFromPoint=function(e){return null};Gauge.prototype._fix=function(e){return isNumber(e)?parseFloat(e.toFixed(4)).toString():this._fix(e.x)+" "+this._fix(e.y)};Gauge.prototype._updateAria=function(){var e=this.hostElement;if(e){setAttribute(e,"aria-valuemin",this.min);setAttribute(e,"aria-valuemax",this.max);setAttribute(e,"aria-valuenow",this.value)}};Gauge._SVGNS="http://www.w3.org/2000/svg";Gauge._ctr=0;Gauge._ctrlTemplate="";return Gauge}(Control);export{Gauge};export var NeedleShape;!function(e){e[e.None=0]="None";e[e.Triangle=1]="Triangle";e[e.Diamond=2]="Diamond";e[e.Hexagon=3]="Hexagon";e[e.Rectangle=4]="Rectangle";e[e.Arrow=5]="Arrow";e[e.WideArrow=6]="WideArrow";e[e.Pointer=7]="Pointer";e[e.WidePointer=8]="WidePointer";e[e.Outer=9]="Outer"}(NeedleShape||(NeedleShape={}));export var NeedleLength;!function(e){e[e.Outer=0]="Outer";e[e.Middle=1]="Middle";e[e.Inner=2]="Inner"}(NeedleLength||(NeedleLength={}));var RadialGauge=function(e){__extends(RadialGauge,e);function RadialGauge(t,i){var n=e.call(this,t,null)||this;n._startAngle=0;n._sweepAngle=180;n._autoScale=!0;n._ndlShape=NeedleShape.None;n._ndlLength=NeedleLength.Middle;addClass(n.hostElement,RadialGaugeClsNames.hostElement);n._thickness=.4;n.showText=ShowText.All;n.initialize(i);return n}Object.defineProperty(RadialGauge.prototype,"startAngle",{get:function(){return this._startAngle},set:function(e){if(e!=this._startAngle){this._startAngle=clamp(asNumber(e,!1),-360,360);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(RadialGauge.prototype,"sweepAngle",{get:function(){return this._sweepAngle},set:function(e){if(e!=this._sweepAngle){this._sweepAngle=clamp(asNumber(e,!1),-360,360);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(RadialGauge.prototype,"autoScale",{get:function(){return this._autoScale},set:function(e){if(e!=this._autoScale){this._autoScale=asBoolean(e);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(RadialGauge.prototype,"faceBounds",{get:function(){return this._rcSvg?this._rcSvg.clone():null},enumerable:!0,configurable:!0});Object.defineProperty(RadialGauge.prototype,"clientSize",{get:function(){_deprecated("clientSize","faceBounds");var e=this._rcSvg;return e?new Size(e.width,e.height):null},enumerable:!0,configurable:!0});Object.defineProperty(RadialGauge.prototype,"needleElement",{get:function(){return this._ndlElement},set:function(e){if(e!=this._ndlElement){this._ndlShape=0;this._ndlElement=asType(e,SVGElement,!0);for(var t=this._gNeedle;t.firstChild;)removeChild(t.firstChild);if(this._ndlElement){setAttribute(t,"transform","scale(0)");t.appendChild(this._ndlElement)}this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(RadialGauge.prototype,"needleShape",{get:function(){return this._ndlShape},set:function(e){if(e!=this._ndlShape){if((e=asEnum(e,NeedleShape))===this._ndlShape)return;var t=null;switch(e){case NeedleShape.Triangle:t=RadialGauge.createNeedleElement([{x:-10,y:10},{x:100,y:0}]);break;case NeedleShape.Diamond:t=RadialGauge.createNeedleElement([{x:-20,y:0},{x:0,y:10},{x:100,y:0}]);break;case NeedleShape.Hexagon:t=RadialGauge.createNeedleElement([{x:-15,y:0},{x:-10,y:5},{x:10,y:5},{x:100,y:0}]);break;case NeedleShape.Rectangle:t=RadialGauge.createNeedleElement([{x:-20,y:3},{x:100,y:3}],10);break;case NeedleShape.Arrow:t=RadialGauge.createNeedleElement([{x:-20,y:3},{x:70,y:3},{x:70,y:15},{x:100,y:0}],10);break;case NeedleShape.WideArrow:t=RadialGauge.createNeedleElement([{x:-30,y:5},{x:-40,y:15},{x:-20,y:15},{x:-10,y:5},{x:80,y:5},{x:70,y:15},{x:100,y:0}]);break;case NeedleShape.Pointer:t=RadialGauge.createNeedleElement([{x:0,y:10},{x:100,y:0}],20,10);break;case NeedleShape.WidePointer:t=RadialGauge.createNeedleElement([{x:0,y:20},{x:100,y:0}],20,10);break;case NeedleShape.Outer:t=RadialGauge.createNeedleElement([{x:60,y:20},{x:100,y:0}])}this.needleElement=t;this._ndlShape=e;this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(RadialGauge.prototype,"needleLength",{get:function(){return this._ndlLength},set:function(e){if(e!=this._ndlLength){this._ndlLength=asEnum(e,NeedleLength);this.invalidate()}},enumerable:!0,configurable:!0});RadialGauge.createNeedleElement=function(e,t,i){for(var n="",a=0;a<e.length;a++){var r=e[a];if(a==e.length-1&&0==r.y)break;n+=(a>0?" L ":"M ")+r.x+" "+r.y}for(a=e.length-1;a>=0;a--){n+=" L "+(r=e[a]).x+" "+-r.y}n+=" Z";var s="http://www.w3.org/2000/svg",o=document.createElementNS(s,"g"),h=document.createElementNS(s,"path");setAttribute(h,"d",n);o.appendChild(h);if(t){var u=document.createElementNS(s,"circle");addClass(u,GaugeClsNames.needleCap);setAttribute(u,"r",t);o.appendChild(u);if(i){u=document.createElementNS(s,"circle");addClass(u,GaugeClsNames.innerNeedleCap);setAttribute(u,"r",i);o.appendChild(u)}}return o};RadialGauge.prototype.refresh=function(t){void 0===t&&(t=!0);setAttribute(this._svg,"viewBox",null);this._rcSvg=Rect.fromBoundingRect(this._dSvg.getBoundingClientRect());e.prototype.refresh.call(this,t);this._ctmInv=null;this._ptSvg=null;if(this._autoScale){setAttribute(this._svg,"viewBox",null);var i=Rect.fromBoundingRect(Gauge._getBBox(this._pFace));0!=(this.showText&ShowText.Value)&&(i=Rect.union(i,Rect.fromBoundingRect(Gauge._getBBox(this._tValue))));if(0!=(this.showText&ShowText.MinMax)){i=Rect.union(i,Rect.fromBoundingRect(Gauge._getBBox(this._tMin)));i=Rect.union(i,Rect.fromBoundingRect(Gauge._getBBox(this._tMax)))}var n=[this._fix(i.left),this._fix(i.top),this._fix(i.width),this._fix(i.height)].join(" ");setAttribute(this._svg,"viewBox",n);var a=this._pFace.getCTM();this._ctmInv=a?a.inverse():null;this._ptSvg=this._svg.createSVGPoint()}};RadialGauge.prototype._updateRangeElement=function(e,t,i){if(this._rcSvg){var n=this._rcSvg,a=new Point(n.width/2,n.height/2),r=Math.min(n.width,n.height)/2,s=r*this.thickness,o=s*t.thickness,h=r-(s-o)/2,u=h-o,l=this._getStartAngle(),g=this._getSweepAngle(),c=t==this._face,p=c?0:this._getPercent(t.min),f=l+g*p,_=g*((c?1:this._getPercent(i))-p);if(this.stackRanges&&t!=this.face&&t!=this.pointer){var d=this.ranges.indexOf(t);if(d>-1){var m=this.ranges.length,x=(h-u)/m;h=(u+=(m-1-d)*x)+x}}this._updateSegment(e,a,h,u,f,_);if(t==this._pointer){var b=this._fix;if(this.thumbSize>0){var y=this._animColor?this._animColor:this._getPointerColor(t.max),v=this._getPoint(a,l+g*this._getPercent(i),(h+u)/2),w=this._cValue;setAttribute(w,"cx",b(v.x));setAttribute(w,"cy",b(v.y));setAttribute(w,"style",y?"fill:"+y:null);setAttribute(w,"r",b(this.thumbSize/2))}if(this.needleElement){var G=h;this._ndlLength==NeedleLength.Inner?G=u:this._ndlLength==NeedleLength.Middle&&(G=(u+h)/2);var R="translate({cx}, {cy}) scale({scale}) rotate({angle})".replace("{cx}",b(a.x)).replace("{cy}",b(a.y)).replace("{scale}",b(G/100)).replace("{angle}",b(f+_));this._gNeedle.setAttribute("transform",R)}}}};RadialGauge.prototype._getStartAngle=function(){var e=this.startAngle+180;this.rightToLeft&&(e=180-e);return e};RadialGauge.prototype._getSweepAngle=function(){var e=this.sweepAngle;this.rightToLeft&&(e=-e);return e};RadialGauge.prototype._updateText=function(){if(this._rcSvg){var e=this._rcSvg,t=new Point(e.width/2,e.height/2),i=Math.min(e.width,e.height)/2,n=Math.max(0,i*(1-this.thickness)),a=this._getStartAngle(),r=this._getSweepAngle();this._showElement(this._cValue,this.thumbSize>0);var s=0!=(this.showText&ShowText.MinMax)&&Math.abs(r)<=300;this._showElement(this._tMin,s);this._showElement(this._tMax,s);this._centerText(this._tValue,this.value,t);var o=10*(this._getSweepAngle()<0?-1:1);this._centerText(this._tMin,this.min,this._getPoint(t,a-o,(i+n)/2));this._centerText(this._tMax,this.max,this._getPoint(t,a+r+o,(i+n)/2))}};RadialGauge.prototype._updateTicks=function(){for(var e=this.tickSpacing&&this.tickSpacing>0?this.tickSpacing:this.step,t="",i=this._gTicks;i.firstChild;)removeChild(i.firstChild);if(this.showTicks&&e>0)for(var n=this._rcSvg,a=new Point(n.width/2,n.height/2),r=Math.min(n.width,n.height)/2,s=r*this.thickness,o=s*this._face.thickness,h=r-(s-o)/2,u=h-o,l=1.15*h,g=this._getStartAngle(),c=this._getSweepAngle(),p=this.min;p<=this.max;p+=e){var f=g+c*this._getPercent(p),_=this._fix(this._getPoint(a,f,u)),d=this._fix(this._getPoint(a,f,h));p>this.min&&p<this.max&&(t+="M "+_+" L "+d+" ");if(this.showTickText){var m=this._createElement("text",i),x=this._getPoint(a,f,l);this._centerText(m,p,x)}}this._pTicks.setAttribute("d",t)};RadialGauge.prototype._updateSegment=function(e,t,i,n,a,r){r=Math.min(Math.max(r,-359.99),359.99);var s=this._getPoint(t,a,n),o=this._getPoint(t,a,i),h=this._getPoint(t,a+r,i),u=this._getPoint(t,a+r,n),l={large:Math.abs(r)>180?1:0,cw:r>0?1:0,ccw:r>0?0:1,or:this._fix(i),ir:this._fix(n),p1:this._fix(s),p2:this._fix(o),p3:this._fix(h),p4:this._fix(u)},g=format("M {p1} L {p2} A {or} {or} 0 {large} {cw} {p3} L {p4} A {ir} {ir} 0 {large} {ccw} {p1} Z",l);e.setAttribute("d",g)};RadialGauge.prototype._getPoint=function(e,t,i){t=t*Math.PI/180;return new Point(e.x+i*Math.cos(t),e.y+i*Math.sin(t))};RadialGauge.prototype._getValueFromPoint=function(e){if(this.autoScale&&this._ctmInv){this._ptSvg.x=e.x;this._ptSvg.y=e.y;this._ptSvg=this._ptSvg.matrixTransform(this._ctmInv);e.x=this._ptSvg.x;e.y=this._ptSvg.y}if(!this._rcSvg||!this.sweepAngle)return null;var t=this._rcSvg,i=new Point(t.width/2,t.height/2),n=Math.min(t.width,t.height)/2,a=e.x-i.x,r=e.y-i.y,s=r*r+a*a;if(s<400||s>(n+20)*(n+20))return null;var o=180*(Math.PI-Math.atan2(-r,a))/Math.PI,h=this.startAngle,u=this.sweepAngle,l=h+u;this.rightToLeft&&(o=180-o);if(u>0){for(;o<h;)o+=360;for(;o>l;)o-=360}else{for(;o<l;)o+=360;for(;o>h;)o-=360}if((o-h)*(o-l)>0){var g=this._getPoint(i,o,n),c=this._getPoint(i,h,n),p=this._getPoint(i,l,n);o=this._getDist2(g,c)<this._getDist2(g,p)?h:l}var f=u?clamp(Math.abs(o-h)/Math.abs(u),0,1):0;return this.min+f*(this.max-this.min)};RadialGauge.prototype._getDist2=function(e,t){var i=e.x-t.x,n=e.y-t.y;return i*i+n*n};return RadialGauge}(Gauge);export{RadialGauge};export var GaugeDirection;!function(e){e[e.Right=0]="Right";e[e.Left=1]="Left";e[e.Up=2]="Up";e[e.Down=3]="Down"}(GaugeDirection||(GaugeDirection={}));var LinearGauge=function(e){__extends(LinearGauge,e);function LinearGauge(t,i){var n=e.call(this,t,null)||this;n._direction=GaugeDirection.Right;addClass(n.hostElement,LinearGaugeClsNames.hostElement);n.initialize(i);return n}Object.defineProperty(LinearGauge.prototype,"direction",{get:function(){return this._direction},set:function(e){if((e=asEnum(e,GaugeDirection))!=this._direction){this._direction=e;this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(LinearGauge.prototype,"faceBounds",{get:function(){return this._getRangeRect(this._face)},enumerable:!0,configurable:!0});LinearGauge.prototype._updateRangeElement=function(e,t,i){var n=this._getRangeRect(t,i);this._updateSegment(e,n);var a=t==this._pointer&&0!=(this.showText&ShowText.Value),r=a||t==this._pointer&&this.thumbSize>0,s=n.left+n.width/2,o=n.top+n.height/2;switch(this._getDirection()){case GaugeDirection.Right:s=n.right;break;case GaugeDirection.Left:s=n.left;break;case GaugeDirection.Up:o=n.top;break;case GaugeDirection.Down:o=n.bottom}a&&this._centerText(this._tValue,i,new Point(s,o));if(a||r){n=Rect.fromBoundingRect(Gauge._getBBox(this._tValue));var h=this._animColor?this._animColor:this._getPointerColor(t.max),u=null!=this.thumbSize?this.thumbSize/2:.8*Math.max(n.width,n.height),l=this._cValue;setAttribute(l,"cx",this._fix(s));setAttribute(l,"cy",this._fix(o));setAttribute(l,"style",h?"fill:"+h:null);setAttribute(l,"r",this._fix(u))}};LinearGauge.prototype._updateText=function(){var e=this._getRangeRect(this._face);switch(this._getDirection()){case GaugeDirection.Right:this._setText(this._tMin,this.min,e,"left");this._setText(this._tMax,this.max,e,"right");break;case GaugeDirection.Left:this._setText(this._tMin,this.min,e,"right");this._setText(this._tMax,this.max,e,"left");break;case GaugeDirection.Up:this._setText(this._tMin,this.min,e,"bottom");this._setText(this._tMax,this.max,e,"top");break;case GaugeDirection.Down:this._setText(this._tMin,this.min,e,"top");this._setText(this._tMax,this.max,e,"bottom")}};LinearGauge.prototype._updateTicks=function(){for(var e=this.tickSpacing&&this.tickSpacing>0?this.tickSpacing:this.step,t="",i=this._gTicks;i.firstChild;)removeChild(i.firstChild);if(this.showTicks&&e>0)for(var n=this._getRangeRect(this._face),a=new Point(n.left-.75*n.width,n.top-.75*n.height),r=void 0,s=this._fix,o=this.min;o<=this.max;o+=e){var h=null;switch(this._getDirection()){case GaugeDirection.Right:a.x=n.left+n.width*this._getPercent(o);h="M "+(r=s(a.x))+" "+s(n.top)+" L "+r+" "+s(n.bottom)+" ";break;case GaugeDirection.Left:a.x=n.right-n.width*this._getPercent(o);h="M "+(r=s(a.x))+" "+s(n.top)+" L "+r+" "+s(n.bottom)+" ";break;case GaugeDirection.Up:a.y=n.bottom-n.height*this._getPercent(o);r=s(a.y);h="M "+s(n.left)+" "+r+" L "+s(n.right)+" "+r+" ";break;case GaugeDirection.Down:a.y=n.top+n.height*this._getPercent(o);r=s(a.y);h="M "+s(n.left)+" "+r+" L "+s(n.right)+" "+r+" "}o>this.min&&o<this.max&&(t+=h);if(this.showTickText){var u=this._createElement("text",i);this._centerText(u,o,a)}}this._pTicks.setAttribute("d",t)};LinearGauge.prototype._updateSegment=function(e,t){var i={p1:this._fix(new Point(t.left,t.top)),p2:this._fix(new Point(t.right,t.top)),p3:this._fix(new Point(t.right,t.bottom)),p4:this._fix(new Point(t.left,t.bottom))},n=format("M {p1} L {p2} L {p3} L {p4} Z",i);e.setAttribute("d",n)};LinearGauge.prototype._setText=function(e,t,i,n){if("none"!=e.getAttribute("display")){var a=Globalize.format(t,this.format);if(isFunction(this.getText)){var r=e==this._tValue?"value":e==this._tMin?"min":e==this._tMax?"max":null;assert(null!=r,"unknown element");a=this.getText(this,r,t,a)}e.textContent=a;var s=Rect.fromBoundingRect(Gauge._getBBox(e)),o=new Point(i.left+i.width/2-s.width/2,i.top+i.height/2+s.height/2);switch(n){case"top":o.y=i.top-4;break;case"left":o.x=i.left-4-s.width;break;case"right":o.x=i.right+4;break;case"bottom":o.y=i.bottom+4+s.height}e.setAttribute("x",this._fix(o.x));e.setAttribute("y",this._fix(o.y))}};LinearGauge.prototype._getRangeRect=function(e,t){void 0===t&&(t=e.max);var i=this.hostElement,n=new Rect(0,0,i.clientWidth,i.clientHeight),a=this._getDirection(),r=this.thumbSize?Math.ceil(this.thumbSize/2):0;if(this.showText!=ShowText.None){var s=parseInt(getComputedStyle(i).fontSize);isNaN(s)||(r=Math.max(r,3*s))}switch(a){case GaugeDirection.Right:case GaugeDirection.Left:n=n.inflate(-r,-n.height*(1-this.thickness*e.thickness)/2);break;case GaugeDirection.Up:case GaugeDirection.Down:n=n.inflate(-n.width*(1-this.thickness*e.thickness)/2,-r)}if(this.stackRanges&&e!=this.face&&e!=this.pointer){var o=this.ranges.indexOf(e);if(o>-1){var h=this.ranges.length;switch(a){case GaugeDirection.Right:case GaugeDirection.Left:n.height/=h;n.top+=o*n.height;break;case GaugeDirection.Up:case GaugeDirection.Down:n.width/=h;n.left+=o*n.width}}}var u=e==this._face,l=u?0:this._getPercent(e.min),g=u?1:this._getPercent(t);switch(a){case GaugeDirection.Right:n.left+=n.width*l;n.width*=g-l;break;case GaugeDirection.Left:n.left=n.right-n.width*g;n.width=n.width*(g-l);break;case GaugeDirection.Down:n.top+=n.height*l;n.height*=g-l;break;case GaugeDirection.Up:n.top=n.bottom-n.height*g;n.height=n.height*(g-l)}return n};LinearGauge.prototype._getValueFromPoint=function(e){var t=this._getRangeRect(this._face),i=0;switch(this._getDirection()){case GaugeDirection.Right:i=t.width>0?(e.x-t.left)/t.width:0;break;case GaugeDirection.Left:i=t.width>0?(t.right-e.x)/t.width:0;break;case GaugeDirection.Up:i=t.height>0?(t.bottom-e.y)/t.height:0;break;case GaugeDirection.Down:i=t.height>0?(e.y-t.top)/t.height:0}return this.min+i*(this.max-this.min)};LinearGauge.prototype._getDirection=function(){var e=this._direction;if(this.rightToLeft)switch(e){case GaugeDirection.Left:e=GaugeDirection.Right;break;case GaugeDirection.Right:e=GaugeDirection.Left}return e};LinearGauge.prototype._getKey=function(e){switch(this._getDirection()){case GaugeDirection.Left:switch(e){case Key.Left:e=Key.Right;break;case Key.Right:e=Key.Left}break;case GaugeDirection.Down:switch(e){case Key.Up:e=Key.Down;break;case Key.Down:e=Key.Up}}return e};return LinearGauge}(Gauge);export{LinearGauge};var BulletGraph=function(e){__extends(BulletGraph,e);function BulletGraph(t,i){var n=e.call(this,t,null)||this;addClass(n.hostElement,BulletGraphClsNames.hostElement);n._pointer.thickness=.35;n._rngTarget=new Range("target");n._rngTarget.thickness=.8;n._rngTarget.color="black";n._rngGood=new Range("good");n._rngGood.color="rgba(0,0,0,.15)";n._rngBad=new Range("bad");n._rngBad.color="rgba(0,0,0,.3)";n.ranges.push(n._rngBad);n.ranges.push(n._rngGood);n.ranges.push(n._rngTarget);n.initialize(i);return n}Object.defineProperty(BulletGraph.prototype,"target",{get:function(){return this._rngTarget.max},set:function(e){this._rngTarget.max=e},enumerable:!0,configurable:!0});Object.defineProperty(BulletGraph.prototype,"good",{get:function(){return this._rngGood.max},set:function(e){this._rngGood.max=e},enumerable:!0,configurable:!0});Object.defineProperty(BulletGraph.prototype,"bad",{get:function(){return this._rngBad.max},set:function(e){this._rngBad.max=e},enumerable:!0,configurable:!0});BulletGraph.prototype._getRangeRect=function(t,i){void 0===i&&(i=t.max);var n=e.prototype._getRangeRect.call(this,t,i);if(t==this._rngTarget)switch(this._getDirection()){case GaugeDirection.Right:n.left=n.right-1;n.width=3;break;case GaugeDirection.Left:n.width=3;break;case GaugeDirection.Up:n.height=3;break;case GaugeDirection.Down:n.top=n.bottom-1;n.height=3}return n};return BulletGraph}(LinearGauge);export{BulletGraph};_registerModule("wijmo.gauge",selfModule);
14
+ var __extends=this&&this.__extends||function(){var extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};return function(e,t){extendStatics(e,t);function __(){this.constructor=e}e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}}();import{isString,copy,asNumber,asString,clamp,PropertyChangedEventArgs,Event,assert,setAttribute,animate,setCss,toggleClass,mouseToPage,isiOS,isNumber,isFunction,asBoolean,asType,asFunction,asEnum,asArray,Globalize,Control,Color,Point,Rect,Key,ObservableArray,ControlStateClsNames,ControlClsNames,addClass,format,removeChild,Size,_deprecated,_registerModule}from"@grapecity/wijmo";import*as selfModule from"@grapecity/wijmo.gauge";export var BulletGraphClsNames={hostElement:"wj-bulletgraph"};export var GaugeClsNames={cover:"wj-cover",face:"wj-face",filter:"wj-gauge-filter",hostElement:"wj-gauge",innerNeedleCap:"wj-inner-needle-cap",max:"wj-max",min:"wj-min",needle:"wj-needle",needleCap:"wj-needle-cap",pointer:"wj-pointer",ranges:"wj-ranges",thumb:"wj-thumb",tickText:"wj-tick-text",ticks:"wj-ticks",value:"wj-value"};export var LinearGaugeClsNames={hostElement:"wj-lineargauge"};export var RadialGaugeClsNames={hostElement:"wj-radialgauge"};export var RangeClsNames={ranges:"wj-ranges"};var Range=function(){function Range(e){this._min=0;this._max=100;this._thickness=1;this.propertyChanged=new Event;isString(e)?this._name=e:copy(this,e)}Object.defineProperty(Range.prototype,"min",{get:function(){return this._min},set:function(e){this._setProp("_min",asNumber(e,!0))},enumerable:!0,configurable:!0});Object.defineProperty(Range.prototype,"max",{get:function(){return this._max},set:function(e){this._setProp("_max",asNumber(e,!0))},enumerable:!0,configurable:!0});Object.defineProperty(Range.prototype,"color",{get:function(){return this._color},set:function(e){this._setProp("_color",asString(e))},enumerable:!0,configurable:!0});Object.defineProperty(Range.prototype,"thickness",{get:function(){return this._thickness},set:function(e){this._setProp("_thickness",clamp(asNumber(e),0,1))},enumerable:!0,configurable:!0});Object.defineProperty(Range.prototype,"name",{get:function(){return this._name},set:function(e){this._setProp("_name",asString(e))},enumerable:!0,configurable:!0});Range.prototype.onPropertyChanged=function(e){this.propertyChanged.raise(this,e)};Range.prototype._setProp=function(e,t){var i=this[e];if(t!=i){this[e]=t;var a=new PropertyChangedEventArgs(e.substr(1),i,t);this.onPropertyChanged(a)}};Range._ctr=0;return Range}();export{Range};export var ShowText;!function(e){e[e.None=0]="None";e[e.Value=1]="Value";e[e.MinMax=2]="MinMax";e[e.All=3]="All"}(ShowText||(ShowText={}));var Gauge=function(e){__extends(Gauge,e);function Gauge(t,i){var a=e.call(this,t,null,!0)||this;a._ranges=new ObservableArray;a._rngElements=[];a._format="n0";a._showRanges=!0;a._stackRanges=!1;a._shadow=!0;a._animated=!0;a._readOnly=!0;a._handleWheel=!0;a._step=1;a._showText=ShowText.None;a._showTicks=!1;a._showTickText=!1;a._thickness=.8;a._initialized=!1;a.valueChanged=new Event;a._getPercent=function(e){var t=this.max>this.min?(e-this.min)/(this.max-this.min):0;return Math.max(0,Math.min(1,t))};Gauge._ctr++;var n=a.hostElement;setAttribute(n,"role","slider",!0);var r=a.getTemplate();a.applyTemplate(ControlClsNames.hostElement+" "+GaugeClsNames.hostElement,r,{_dSvg:"dsvg",_svg:"svg",_filter:"filter",_gFace:"gface",_gRanges:"granges",_gPointer:"gpointer",_gCover:"gcover",_pFace:"pface",_pPointer:"ppointer",_cValue:"cvalue",_tValue:"value",_tMin:"min",_tMax:"max",_pTicks:"pticks",_gTicks:"gticks",_gNeedle:"gneedle"});setCss(a._dSvg,{width:"100%",height:"100%"});a._filterID="wj-gauge-filter-"+Gauge._ctr.toString(36);a._filter.setAttribute("id",a._filterID);a.face=new Range;a.pointer=new Range;a._ranges.collectionChanged.addHandler((function(){a._ranges.forEach((function(e){assert(e instanceof Range,"ranges array must contain Range objects.")}));a._rangesDirty=!0;a.invalidate()}));a.addEventListener(n,"keydown",a._keydown.bind(a));a.addEventListener(n,"click",(function(e){if(0==e.button){a.focus();a._applyMouseValue(e)}}));a.addEventListener(n,"mousedown",(function(e){if(0==e.button){a.focus();a._dragging=!0;setTimeout((function(){a._applyMouseValue(e)}))}}));a.addEventListener(n,"mousemove",(function(e){a._dragging&&a.containsFocus()&&a._applyMouseValue(e,!0)}));a.addEventListener(n,"mouseup",(function(e){a._dragging=!1}));a.addEventListener(n,"mouseleave",(function(e){e.target==n&&(a._dragging=!1)}));if("ontouchstart"in window){a.addEventListener(n,"touchstart",(function(e){a.focus();!e.defaultPrevented&&a._applyMouseValue(e,!1)&&e.preventDefault()}));a.addEventListener(n,"touchmove",(function(e){!e.defaultPrevented&&a._applyMouseValue(e,!0)&&e.preventDefault()}))}a.addEventListener(n,"wheel",(function(e){if(a._handleWheel&&!a.isReadOnly&&!e.defaultPrevented&&a.containsFocus()&&null!=a.value&&a.hitTest(e)){var t=clamp(-e.deltaY,-1,1);a.value=clamp(a.value+(a.step||1)*t,a.min,a.max);e.preventDefault()}}));a.isReadOnly=!0;a.initialize(i);a.invalidate();return a}Object.defineProperty(Gauge,"controlTemplate",{get:function(){Gauge._ctrlTemplate||(Gauge._ctrlTemplate='<div wj-part="dsvg" dir="ltr"><svg wj-part="svg" width="100%" height="100%"><defs><filter wj-part="filter"><feOffset dx="3" dy="3"></feOffset><feGaussianBlur result="offset-blur" stdDeviation="5"></feGaussianBlur><feComposite operator="out" in="SourceGraphic" in2="offset-blur" result="inverse"></feComposite><feFlood flood-color="black" flood-opacity="0.2" result="color"></feFlood><feComposite operator="in" in="color" in2="inverse" result="shadow"></feComposite><feComposite operator="over" in="shadow" in2="SourceGraphic"></feComposite></filter></defs><g wj-part="gface" class="'+GaugeClsNames.face+'"><path wj-part="pface"/></g><g wj-part="granges" class="'+GaugeClsNames.ranges+'"/><g wj-part="gpointer" class="'+GaugeClsNames.pointer+'"><path wj-part="ppointer"/></g><g wj-part="gcover" class="'+GaugeClsNames.cover+'"><path wj-part="pticks" class="'+GaugeClsNames.ticks+'"/><g wj-part="gticks" aria-hidden="true" class="'+GaugeClsNames.tickText+'"/><circle wj-part="cvalue" class="'+GaugeClsNames.pointer+" "+GaugeClsNames.thumb+'"/><g wj-part="gneedle" class="'+GaugeClsNames.needle+'"/><text wj-part="value" class="'+GaugeClsNames.value+'"/><text wj-part="min" class="'+GaugeClsNames.min+'" aria-hidden="true"/><text wj-part="max" class="'+GaugeClsNames.max+'" aria-hidden="true"/></g></svg></div>');return Gauge._ctrlTemplate},set:function(e){Gauge._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"value",{get:function(){return this._pointer.max},set:function(e){if(e!=this.value){this._pointer.max=asNumber(e,!0);this._updateAria()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"min",{get:function(){return this._face.min},set:function(e){if(e!=this.min){this._face.min=asNumber(e);this._updateAria()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"max",{get:function(){return this._face.max},set:function(e){if(e!=this.max){this._face.max=asNumber(e);this._updateAria()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"origin",{get:function(){return this._origin},set:function(e){if(e!=this._origin){this._origin=asNumber(e,!0);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"isReadOnly",{get:function(){return this._readOnly},set:function(e){this._readOnly=asBoolean(e);setAttribute(this._svg,"cursor",this._readOnly?null:"pointer");toggleClass(this.hostElement,ControlStateClsNames.readOnly,this.isReadOnly)},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"handleWheel",{get:function(){return this._handleWheel},set:function(e){this._handleWheel=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"step",{get:function(){return this._step},set:function(e){if(e!=this._step){this._step=asNumber(e,!0);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"format",{get:function(){return this._format},set:function(e){if(e!=this._format){this._format=asString(e);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"getText",{get:function(){return this._getText},set:function(e){if(e!=this._getText){this._getText=asFunction(e);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"thickness",{get:function(){return this._thickness},set:function(e){if(e!=this._thickness){this._thickness=clamp(asNumber(e,!1),0,1);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"face",{get:function(){return this._face},set:function(e){if(e!=this._face){this._face&&this._face.propertyChanged.removeHandler(this._rangeChanged);this._face=asType(e,Range);this._face&&this._face.propertyChanged.addHandler(this._rangeChanged,this);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"pointer",{get:function(){return this._pointer},set:function(e){if(e!=this._pointer){var t=null;if(this._pointer){t=this.value;this._pointer.propertyChanged.removeHandler(this._rangeChanged)}this._pointer=asType(e,Range);if(this._pointer){t&&(this.value=t);this._pointer.propertyChanged.addHandler(this._rangeChanged,this)}this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"showText",{get:function(){return this._showText},set:function(e){if((e=asEnum(e,ShowText))!=this._showText){this._showText=e;this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"showTicks",{get:function(){return this._showTicks},set:function(e){if(e!=this._showTicks){this._showTicks=asBoolean(e);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"showTickText",{get:function(){return this._showTickText},set:function(e){if(e!=this._showTickText){this._showTickText=asBoolean(e);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"tickSpacing",{get:function(){return this._tickSpacing},set:function(e){if(e!=this._tickSpacing){this._tickSpacing=asNumber(e,!0);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"thumbSize",{get:function(){return this._thumbSize},set:function(e){if(e!=this._thumbSize){this._thumbSize=asNumber(e,!0,!0);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"showRanges",{get:function(){return this._showRanges},set:function(e){if(e!=this._showRanges){this._showRanges=asBoolean(e);this._animColor=null;this._rangesDirty=!0;this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"stackRanges",{get:function(){return this._stackRanges},set:function(e){if(e!=this._stackRanges){this._stackRanges=asBoolean(e);this._animColor=null;this._rangesDirty=!0;this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"hasShadow",{get:function(){return this._shadow},set:function(e){if(e!=this._shadow){this._shadow=asBoolean(e);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"isAnimated",{get:function(){return this._animated},set:function(e){this._animated=asBoolean(e)},enumerable:!0,configurable:!0});Object.defineProperty(Gauge.prototype,"ranges",{get:function(){return this._ranges},enumerable:!0,configurable:!0});Gauge.prototype.onValueChanged=function(e){this.valueChanged.raise(this,e)};Gauge.prototype.refresh=function(t){var i=this;void 0===t&&(t=!0);e.prototype.refresh.call(this,t);if(this._rangesDirty){this._rangesDirty=!1;var a=this._gRanges;this._rngElements.forEach((function(e){e.rng.propertyChanged.removeHandler(i._rangeChanged)}));for(;a.lastChild;)a.removeChild(a.lastChild);this._rngElements=[];this._showRanges&&this._ranges.forEach((function(e){e.propertyChanged.addHandler(i._rangeChanged,i);i._rngElements.push({rng:e,el:i._createElement("path",a)})}))}this._showElement(this._tValue,0!=(this.showText&ShowText.Value));this._showElement(this._tMin,0!=(this.showText&ShowText.MinMax));this._showElement(this._tMax,0!=(this.showText&ShowText.MinMax));this._showElement(this._cValue,0!=(this.showText&ShowText.Value)||this._thumbSize>0);this._updateText();var n=this._getFilterUrl();setAttribute(this._pFace,"filter",n);setAttribute(this._pPointer,"filter",n);this._updateRange(this._face);this._updateRange(this._pointer);this._updateTicks();this._ranges.forEach((function(e){i._updateRange(e)}));this._initialized=!0};Gauge.prototype.hitTest=function(e,t){isNumber(e)&&isNumber(t)?e=new Point(e,t):e instanceof Point||(e=mouseToPage(e));e=asType(e,Point);var i=Rect.fromBoundingRect(this._dSvg.getBoundingClientRect());e.x-=i.left+pageXOffset;e.y-=i.top+pageYOffset;return this._getValueFromPoint(e)};Gauge.prototype.dispose=function(){if(this._animInterval){clearInterval(this._animInterval);this._animInterval=null}e.prototype.dispose.call(this)};Gauge._getBBox=function(e){try{return e.getBBox()}catch(e){return{x:0,y:0,width:0,height:0}}};Gauge.prototype._getFilterUrl=function(){return this.hasShadow&&!isiOS()?"url(#"+this._filterID+")":null};Gauge.prototype._getRangeElement=function(e){if(e==this._face)return this._pFace;if(e==this._pointer)return this._pPointer;for(var t=0;t<this._rngElements.length;t++){var i=this._rngElements[t];if(i.rng==e)return i.el}return null};Gauge.prototype._rangeChanged=function(e,t){var i=this;if(e==this._pointer&&"max"==t.propertyName){this.onValueChanged();this._updateText()}if(e!=this._face){if(e==this._pointer&&"max"==t.propertyName){if(this._animInterval){clearInterval(this._animInterval);this._updateRange(e,t.oldValue)}if(this.isAnimated&&!this.isUpdating&&this._initialized){var a=this._getPointerColor(t.oldValue),n=this._getPointerColor(t.newValue),r=a?new Color(a):null,s=n?new Color(n):null,o=clamp(Math.abs(t.newValue-t.oldValue)/(this.max-this.min),0,1);this._animInterval=animate((function(a){i._animColor=r&&s?Color.interpolate(r,s,a).toString():null;i._updateRange(e,t.oldValue+a*(t.newValue-t.oldValue));if(a>=1){i._animColor=null;i._animInterval=null;i._updateRange(e);i._updateText()}}),o*Control._ANIM_DEF_DURATION);return}}this._updateRange(e)}else this.invalidate()};Gauge.prototype._createElement=function(e,t,i){var a=document.createElementNS(Gauge._SVGNS,e);i&&a.setAttribute("class",i);t.appendChild(a);return a};Gauge.prototype._centerText=function(e,t,i){if("none"!=e.getAttribute("display")){var a=Globalize.format(t,this.format);if(isFunction(this.getText)){var n="";e==this._tValue?n="value":e==this._tMin?n="min":e==this._tMax&&(n="max");n&&(a=this.getText(this,n,t,a))}e.textContent=a;var r=Rect.fromBoundingRect(Gauge._getBBox(e)),s=i.x-Math.round(r.width)/2,o=i.y+Math.round(r.height)/4;e.setAttribute("x",this._fix(s));e.setAttribute("y",this._fix(o))}};Gauge.prototype._copy=function(e,t){var i=this;if("ranges"==e){asArray(t).forEach((function(e){var t=new Range(e);i.ranges.push(t)}));return!0}if("pointer"==e){copy(this.pointer,t);return!0}return!1};Gauge.prototype._showElement=function(e,t){setAttribute(e,"display",t?null:"none")};Gauge.prototype._updateRange=function(e,t){void 0===t&&(t=e.max);e==this._pointer&&(e.min=null!=this.origin?this.origin:this.min<0&&this.max>0?0:this.min);var i=this._getRangeElement(e);if(i){this._updateRangeElement(i,e,t);var a=e.color;e==this._pointer&&(a=this._animColor?this._animColor:this._getPointerColor(e.max));setAttribute(i,"style",a?"fill:"+a:null)}};Gauge.prototype._getPointerColor=function(e){if(!this._showRanges){for(var t,i=0;i<this._ranges.length;i++){var a=this._ranges[i];if(e>=a.min&&e<=a.max){t=a;break}}if(t)return t.color}return this._pointer.color};Gauge.prototype._keydown=function(e){if(!this._readOnly&&this._step){var t=!0;switch(this._getKey(e.keyCode)){case Key.Left:case Key.Down:this.value=clamp(this.value-this._step,this.min,this.max);break;case Key.Right:case Key.Up:this.value=clamp(this.value+this._step,this.min,this.max);break;case Key.Home:this.value=this.min;break;case Key.End:this.value=this.max;break;default:t=!1}t&&e.preventDefault()}};Gauge.prototype._getKey=function(e){return e};Gauge.prototype._applyMouseValue=function(e,t){if(!this.isReadOnly&&this.containsFocus()){var i=this.hitTest(e);if(null!=i){var a=this._animated,n=this._step;t&&(this._animated=!1);n&&(i=Math.round(i/n)*n);this.value=clamp(i,this.min,this.max);this._animated=a;return!0}}return!1};Gauge.prototype._updateRangeElement=function(e,t,i){assert(!1,"Gauge is an abstract class.")};Gauge.prototype._updateText=function(){assert(!1,"Gauge is an abstract class.")};Gauge.prototype._updateTicks=function(){assert(!1,"Gauge is an abstract class.")};Gauge.prototype._getValueFromPoint=function(e){return null};Gauge.prototype._fix=function(e){return isNumber(e)?parseFloat(e.toFixed(4)).toString():this._fix(e.x)+" "+this._fix(e.y)};Gauge.prototype._updateAria=function(){var e=this.hostElement;if(e){setAttribute(e,"aria-valuemin",this.min);setAttribute(e,"aria-valuemax",this.max);setAttribute(e,"aria-valuenow",this.value)}};Gauge._SVGNS="http://www.w3.org/2000/svg";Gauge._ctr=0;Gauge._ctrlTemplate="";return Gauge}(Control);export{Gauge};export var NeedleShape;!function(e){e[e.None=0]="None";e[e.Triangle=1]="Triangle";e[e.Diamond=2]="Diamond";e[e.Hexagon=3]="Hexagon";e[e.Rectangle=4]="Rectangle";e[e.Arrow=5]="Arrow";e[e.WideArrow=6]="WideArrow";e[e.Pointer=7]="Pointer";e[e.WidePointer=8]="WidePointer";e[e.Outer=9]="Outer"}(NeedleShape||(NeedleShape={}));export var NeedleLength;!function(e){e[e.Outer=0]="Outer";e[e.Middle=1]="Middle";e[e.Inner=2]="Inner"}(NeedleLength||(NeedleLength={}));var RadialGauge=function(e){__extends(RadialGauge,e);function RadialGauge(t,i){var a=e.call(this,t,null)||this;a._startAngle=0;a._sweepAngle=180;a._autoScale=!0;a._ndlShape=NeedleShape.None;a._ndlLength=NeedleLength.Middle;addClass(a.hostElement,RadialGaugeClsNames.hostElement);a._thickness=.4;a.showText=ShowText.All;a.initialize(i);return a}Object.defineProperty(RadialGauge,"controlTemplate",{get:function(){RadialGauge._ctrlTemplate||(RadialGauge._ctrlTemplate=Gauge.controlTemplate);return RadialGauge._ctrlTemplate},set:function(e){RadialGauge._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(RadialGauge.prototype,"startAngle",{get:function(){return this._startAngle},set:function(e){if(e!=this._startAngle){this._startAngle=clamp(asNumber(e,!1),-360,360);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(RadialGauge.prototype,"sweepAngle",{get:function(){return this._sweepAngle},set:function(e){if(e!=this._sweepAngle){this._sweepAngle=clamp(asNumber(e,!1),-360,360);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(RadialGauge.prototype,"autoScale",{get:function(){return this._autoScale},set:function(e){if(e!=this._autoScale){this._autoScale=asBoolean(e);this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(RadialGauge.prototype,"faceBounds",{get:function(){return this._rcSvg?this._rcSvg.clone():null},enumerable:!0,configurable:!0});Object.defineProperty(RadialGauge.prototype,"clientSize",{get:function(){_deprecated("clientSize","faceBounds");var e=this._rcSvg;return e?new Size(e.width,e.height):null},enumerable:!0,configurable:!0});Object.defineProperty(RadialGauge.prototype,"needleElement",{get:function(){return this._ndlElement},set:function(e){if(e!=this._ndlElement){this._ndlShape=0;this._ndlElement=asType(e,SVGElement,!0);for(var t=this._gNeedle;t.firstChild;)removeChild(t.firstChild);if(this._ndlElement){setAttribute(t,"transform","scale(0)");t.appendChild(this._ndlElement)}this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(RadialGauge.prototype,"needleShape",{get:function(){return this._ndlShape},set:function(e){if(e!=this._ndlShape){if((e=asEnum(e,NeedleShape))===this._ndlShape)return;var t=null;switch(e){case NeedleShape.Triangle:t=RadialGauge.createNeedleElement([{x:-10,y:10},{x:100,y:0}]);break;case NeedleShape.Diamond:t=RadialGauge.createNeedleElement([{x:-20,y:0},{x:0,y:10},{x:100,y:0}]);break;case NeedleShape.Hexagon:t=RadialGauge.createNeedleElement([{x:-15,y:0},{x:-10,y:5},{x:10,y:5},{x:100,y:0}]);break;case NeedleShape.Rectangle:t=RadialGauge.createNeedleElement([{x:-20,y:3},{x:100,y:3}],10);break;case NeedleShape.Arrow:t=RadialGauge.createNeedleElement([{x:-20,y:3},{x:70,y:3},{x:70,y:15},{x:100,y:0}],10);break;case NeedleShape.WideArrow:t=RadialGauge.createNeedleElement([{x:-30,y:5},{x:-40,y:15},{x:-20,y:15},{x:-10,y:5},{x:80,y:5},{x:70,y:15},{x:100,y:0}]);break;case NeedleShape.Pointer:t=RadialGauge.createNeedleElement([{x:0,y:10},{x:100,y:0}],20,10);break;case NeedleShape.WidePointer:t=RadialGauge.createNeedleElement([{x:0,y:20},{x:100,y:0}],20,10);break;case NeedleShape.Outer:t=RadialGauge.createNeedleElement([{x:60,y:20},{x:100,y:0}])}this.needleElement=t;this._ndlShape=e;this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(RadialGauge.prototype,"needleLength",{get:function(){return this._ndlLength},set:function(e){if(e!=this._ndlLength){this._ndlLength=asEnum(e,NeedleLength);this.invalidate()}},enumerable:!0,configurable:!0});RadialGauge.createNeedleElement=function(e,t,i){for(var a="",n=0;n<e.length;n++){var r=e[n];if(n==e.length-1&&0==r.y)break;a+=(n>0?" L ":"M ")+r.x+" "+r.y}for(n=e.length-1;n>=0;n--){a+=" L "+(r=e[n]).x+" "+-r.y}a+=" Z";var s="http://www.w3.org/2000/svg",o=document.createElementNS(s,"g"),h=document.createElementNS(s,"path");setAttribute(h,"d",a);o.appendChild(h);if(t){var l=document.createElementNS(s,"circle");addClass(l,GaugeClsNames.needleCap);setAttribute(l,"r",t);o.appendChild(l);if(i){l=document.createElementNS(s,"circle");addClass(l,GaugeClsNames.innerNeedleCap);setAttribute(l,"r",i);o.appendChild(l)}}return o};RadialGauge.prototype.refresh=function(t){void 0===t&&(t=!0);setAttribute(this._svg,"viewBox",null);this._rcSvg=Rect.fromBoundingRect(this._dSvg.getBoundingClientRect());e.prototype.refresh.call(this,t);this._ctmInv=null;this._ptSvg=null;if(this._autoScale){setAttribute(this._svg,"viewBox",null);var i=Rect.fromBoundingRect(Gauge._getBBox(this._pFace));0!=(this.showText&ShowText.Value)&&(i=Rect.union(i,Rect.fromBoundingRect(Gauge._getBBox(this._tValue))));if(0!=(this.showText&ShowText.MinMax)){i=Rect.union(i,Rect.fromBoundingRect(Gauge._getBBox(this._tMin)));i=Rect.union(i,Rect.fromBoundingRect(Gauge._getBBox(this._tMax)))}var a=[this._fix(i.left),this._fix(i.top),this._fix(i.width),this._fix(i.height)].join(" ");setAttribute(this._svg,"viewBox",a);var n=this._pFace.getCTM();this._ctmInv=n?n.inverse():null;this._ptSvg=this._svg.createSVGPoint()}};RadialGauge.prototype._updateRangeElement=function(e,t,i){if(this._rcSvg){var a=this._rcSvg,n=new Point(a.width/2,a.height/2),r=Math.min(a.width,a.height)/2,s=r*this.thickness,o=s*t.thickness,h=r-(s-o)/2,l=h-o,u=this._getStartAngle(),g=this._getSweepAngle(),c=t==this._face,p=c?0:this._getPercent(t.min),f=u+g*p,_=g*((c?1:this._getPercent(i))-p);if(this.stackRanges&&t!=this.face&&t!=this.pointer){var d=this.ranges.indexOf(t);if(d>-1){var m=this.ranges.length,b=(h-l)/m;h=(l+=(m-1-d)*b)+b}}this._updateSegment(e,n,h,l,f,_);if(t==this._pointer){var y=this._fix;if(this.thumbSize>0){var x=this._animColor?this._animColor:this._getPointerColor(t.max),v=this._getPoint(n,u+g*this._getPercent(i),(h+l)/2),w=this._cValue;setAttribute(w,"cx",y(v.x));setAttribute(w,"cy",y(v.y));setAttribute(w,"style",x?"fill:"+x:null);setAttribute(w,"r",y(this.thumbSize/2))}if(this.needleElement){var G=h;this._ndlLength==NeedleLength.Inner?G=l:this._ndlLength==NeedleLength.Middle&&(G=(l+h)/2);var R="translate({cx}, {cy}) scale({scale}) rotate({angle})".replace("{cx}",y(n.x)).replace("{cy}",y(n.y)).replace("{scale}",y(G/100)).replace("{angle}",y(f+_));this._gNeedle.setAttribute("transform",R)}}}};RadialGauge.prototype._getStartAngle=function(){var e=this.startAngle+180;this.rightToLeft&&(e=180-e);return e};RadialGauge.prototype._getSweepAngle=function(){var e=this.sweepAngle;this.rightToLeft&&(e=-e);return e};RadialGauge.prototype._updateText=function(){if(this._rcSvg){var e=this._rcSvg,t=new Point(e.width/2,e.height/2),i=Math.min(e.width,e.height)/2,a=Math.max(0,i*(1-this.thickness)),n=this._getStartAngle(),r=this._getSweepAngle();this._showElement(this._cValue,this.thumbSize>0);var s=0!=(this.showText&ShowText.MinMax)&&Math.abs(r)<=300;this._showElement(this._tMin,s);this._showElement(this._tMax,s);this._centerText(this._tValue,this.value,t);var o=10*(this._getSweepAngle()<0?-1:1);this._centerText(this._tMin,this.min,this._getPoint(t,n-o,(i+a)/2));this._centerText(this._tMax,this.max,this._getPoint(t,n+r+o,(i+a)/2))}};RadialGauge.prototype._updateTicks=function(){for(var e=this.tickSpacing&&this.tickSpacing>0?this.tickSpacing:this.step,t="",i=this._gTicks;i.firstChild;)removeChild(i.firstChild);if(this.showTicks&&e>0)for(var a=this._rcSvg,n=new Point(a.width/2,a.height/2),r=Math.min(a.width,a.height)/2,s=r*this.thickness,o=s*this._face.thickness,h=r-(s-o)/2,l=h-o,u=1.15*h,g=this._getStartAngle(),c=this._getSweepAngle(),p=this.min;p<=this.max;p+=e){var f=g+c*this._getPercent(p),_=this._fix(this._getPoint(n,f,l)),d=this._fix(this._getPoint(n,f,h));p>this.min&&p<this.max&&(t+="M "+_+" L "+d+" ");if(this.showTickText){var m=this._createElement("text",i),b=this._getPoint(n,f,u);this._centerText(m,p,b)}}this._pTicks.setAttribute("d",t)};RadialGauge.prototype._updateSegment=function(e,t,i,a,n,r){r=Math.min(Math.max(r,-359.99),359.99);var s=this._getPoint(t,n,a),o=this._getPoint(t,n,i),h=this._getPoint(t,n+r,i),l=this._getPoint(t,n+r,a),u={large:Math.abs(r)>180?1:0,cw:r>0?1:0,ccw:r>0?0:1,or:this._fix(i),ir:this._fix(a),p1:this._fix(s),p2:this._fix(o),p3:this._fix(h),p4:this._fix(l)},g=format("M {p1} L {p2} A {or} {or} 0 {large} {cw} {p3} L {p4} A {ir} {ir} 0 {large} {ccw} {p1} Z",u);e.setAttribute("d",g)};RadialGauge.prototype._getPoint=function(e,t,i){t=t*Math.PI/180;return new Point(e.x+i*Math.cos(t),e.y+i*Math.sin(t))};RadialGauge.prototype._getValueFromPoint=function(e){if(this.autoScale&&this._ctmInv){this._ptSvg.x=e.x;this._ptSvg.y=e.y;this._ptSvg=this._ptSvg.matrixTransform(this._ctmInv);e.x=this._ptSvg.x;e.y=this._ptSvg.y}if(!this._rcSvg||!this.sweepAngle)return null;var t=this._rcSvg,i=new Point(t.width/2,t.height/2),a=Math.min(t.width,t.height)/2,n=e.x-i.x,r=e.y-i.y,s=r*r+n*n;if(s<400||s>(a+20)*(a+20))return null;var o=180*(Math.PI-Math.atan2(-r,n))/Math.PI,h=this.startAngle,l=this.sweepAngle,u=h+l;this.rightToLeft&&(o=180-o);if(l>0){for(;o<h;)o+=360;for(;o>u;)o-=360}else{for(;o<u;)o+=360;for(;o>h;)o-=360}if((o-h)*(o-u)>0){var g=this._getPoint(i,o,a),c=this._getPoint(i,h,a),p=this._getPoint(i,u,a);o=this._getDist2(g,c)<this._getDist2(g,p)?h:u}var f=l?clamp(Math.abs(o-h)/Math.abs(l),0,1):0;return this.min+f*(this.max-this.min)};RadialGauge.prototype._getDist2=function(e,t){var i=e.x-t.x,a=e.y-t.y;return i*i+a*a};RadialGauge._ctrlTemplate="";return RadialGauge}(Gauge);export{RadialGauge};export var GaugeDirection;!function(e){e[e.Right=0]="Right";e[e.Left=1]="Left";e[e.Up=2]="Up";e[e.Down=3]="Down"}(GaugeDirection||(GaugeDirection={}));var LinearGauge=function(e){__extends(LinearGauge,e);function LinearGauge(t,i){var a=e.call(this,t,null)||this;a._direction=GaugeDirection.Right;addClass(a.hostElement,LinearGaugeClsNames.hostElement);a.initialize(i);return a}Object.defineProperty(LinearGauge,"controlTemplate",{get:function(){LinearGauge._ctrlTemplate||(LinearGauge._ctrlTemplate=Gauge.controlTemplate);return LinearGauge._ctrlTemplate},set:function(e){LinearGauge._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(LinearGauge.prototype,"direction",{get:function(){return this._direction},set:function(e){if((e=asEnum(e,GaugeDirection))!=this._direction){this._direction=e;this.invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(LinearGauge.prototype,"faceBounds",{get:function(){return this._getRangeRect(this._face)},enumerable:!0,configurable:!0});LinearGauge.prototype._updateRangeElement=function(e,t,i){var a=this._getRangeRect(t,i);this._updateSegment(e,a);var n=t==this._pointer&&0!=(this.showText&ShowText.Value),r=n||t==this._pointer&&this.thumbSize>0,s=a.left+a.width/2,o=a.top+a.height/2;switch(this._getDirection()){case GaugeDirection.Right:s=a.right;break;case GaugeDirection.Left:s=a.left;break;case GaugeDirection.Up:o=a.top;break;case GaugeDirection.Down:o=a.bottom}n&&this._centerText(this._tValue,i,new Point(s,o));if(n||r){a=Rect.fromBoundingRect(Gauge._getBBox(this._tValue));var h=this._animColor?this._animColor:this._getPointerColor(t.max),l=null!=this.thumbSize?this.thumbSize/2:.8*Math.max(a.width,a.height),u=this._cValue;setAttribute(u,"cx",this._fix(s));setAttribute(u,"cy",this._fix(o));setAttribute(u,"style",h?"fill:"+h:null);setAttribute(u,"r",this._fix(l))}};LinearGauge.prototype._updateText=function(){var e=this._getRangeRect(this._face);switch(this._getDirection()){case GaugeDirection.Right:this._setText(this._tMin,this.min,e,"left");this._setText(this._tMax,this.max,e,"right");break;case GaugeDirection.Left:this._setText(this._tMin,this.min,e,"right");this._setText(this._tMax,this.max,e,"left");break;case GaugeDirection.Up:this._setText(this._tMin,this.min,e,"bottom");this._setText(this._tMax,this.max,e,"top");break;case GaugeDirection.Down:this._setText(this._tMin,this.min,e,"top");this._setText(this._tMax,this.max,e,"bottom")}};LinearGauge.prototype._updateTicks=function(){for(var e=this.tickSpacing&&this.tickSpacing>0?this.tickSpacing:this.step,t="",i=this._gTicks;i.firstChild;)removeChild(i.firstChild);if(this.showTicks&&e>0)for(var a=this._getRangeRect(this._face),n=new Point(a.left-.75*a.width,a.top-.75*a.height),r=void 0,s=this._fix,o=this.min;o<=this.max;o+=e){var h=null;switch(this._getDirection()){case GaugeDirection.Right:n.x=a.left+a.width*this._getPercent(o);h="M "+(r=s(n.x))+" "+s(a.top)+" L "+r+" "+s(a.bottom)+" ";break;case GaugeDirection.Left:n.x=a.right-a.width*this._getPercent(o);h="M "+(r=s(n.x))+" "+s(a.top)+" L "+r+" "+s(a.bottom)+" ";break;case GaugeDirection.Up:n.y=a.bottom-a.height*this._getPercent(o);r=s(n.y);h="M "+s(a.left)+" "+r+" L "+s(a.right)+" "+r+" ";break;case GaugeDirection.Down:n.y=a.top+a.height*this._getPercent(o);r=s(n.y);h="M "+s(a.left)+" "+r+" L "+s(a.right)+" "+r+" "}o>this.min&&o<this.max&&(t+=h);if(this.showTickText){var l=this._createElement("text",i);this._centerText(l,o,n)}}this._pTicks.setAttribute("d",t)};LinearGauge.prototype._updateSegment=function(e,t){var i={p1:this._fix(new Point(t.left,t.top)),p2:this._fix(new Point(t.right,t.top)),p3:this._fix(new Point(t.right,t.bottom)),p4:this._fix(new Point(t.left,t.bottom))},a=format("M {p1} L {p2} L {p3} L {p4} Z",i);e.setAttribute("d",a)};LinearGauge.prototype._setText=function(e,t,i,a){if("none"!=e.getAttribute("display")){var n=Globalize.format(t,this.format);if(isFunction(this.getText)){var r=e==this._tValue?"value":e==this._tMin?"min":e==this._tMax?"max":null;assert(null!=r,"unknown element");n=this.getText(this,r,t,n)}e.textContent=n;var s=Rect.fromBoundingRect(Gauge._getBBox(e)),o=new Point(i.left+i.width/2-s.width/2,i.top+i.height/2+s.height/2);switch(a){case"top":o.y=i.top-4;break;case"left":o.x=i.left-4-s.width;break;case"right":o.x=i.right+4;break;case"bottom":o.y=i.bottom+4+s.height}e.setAttribute("x",this._fix(o.x));e.setAttribute("y",this._fix(o.y))}};LinearGauge.prototype._getRangeRect=function(e,t){void 0===t&&(t=e.max);var i=this.hostElement,a=new Rect(0,0,i.clientWidth,i.clientHeight),n=this._getDirection(),r=this.thumbSize?Math.ceil(this.thumbSize/2):0;if(this.showText!=ShowText.None){var s=parseInt(getComputedStyle(i).fontSize);isNaN(s)||(r=Math.max(r,3*s))}switch(n){case GaugeDirection.Right:case GaugeDirection.Left:a=a.inflate(-r,-a.height*(1-this.thickness*e.thickness)/2);break;case GaugeDirection.Up:case GaugeDirection.Down:a=a.inflate(-a.width*(1-this.thickness*e.thickness)/2,-r)}if(this.stackRanges&&e!=this.face&&e!=this.pointer){var o=this.ranges.indexOf(e);if(o>-1){var h=this.ranges.length;switch(n){case GaugeDirection.Right:case GaugeDirection.Left:a.height/=h;a.top+=o*a.height;break;case GaugeDirection.Up:case GaugeDirection.Down:a.width/=h;a.left+=o*a.width}}}var l=e==this._face,u=l?0:this._getPercent(e.min),g=l?1:this._getPercent(t);switch(n){case GaugeDirection.Right:a.left+=a.width*u;a.width*=g-u;break;case GaugeDirection.Left:a.left=a.right-a.width*g;a.width=a.width*(g-u);break;case GaugeDirection.Down:a.top+=a.height*u;a.height*=g-u;break;case GaugeDirection.Up:a.top=a.bottom-a.height*g;a.height=a.height*(g-u)}return a};LinearGauge.prototype._getValueFromPoint=function(e){var t=this._getRangeRect(this._face),i=0;switch(this._getDirection()){case GaugeDirection.Right:i=t.width>0?(e.x-t.left)/t.width:0;break;case GaugeDirection.Left:i=t.width>0?(t.right-e.x)/t.width:0;break;case GaugeDirection.Up:i=t.height>0?(t.bottom-e.y)/t.height:0;break;case GaugeDirection.Down:i=t.height>0?(e.y-t.top)/t.height:0}return this.min+i*(this.max-this.min)};LinearGauge.prototype._getDirection=function(){var e=this._direction;if(this.rightToLeft)switch(e){case GaugeDirection.Left:e=GaugeDirection.Right;break;case GaugeDirection.Right:e=GaugeDirection.Left}return e};LinearGauge.prototype._getKey=function(e){switch(this._getDirection()){case GaugeDirection.Left:switch(e){case Key.Left:e=Key.Right;break;case Key.Right:e=Key.Left}break;case GaugeDirection.Down:switch(e){case Key.Up:e=Key.Down;break;case Key.Down:e=Key.Up}}return e};LinearGauge._ctrlTemplate="";return LinearGauge}(Gauge);export{LinearGauge};var BulletGraph=function(e){__extends(BulletGraph,e);function BulletGraph(t,i){var a=e.call(this,t,null)||this;addClass(a.hostElement,BulletGraphClsNames.hostElement);a._pointer.thickness=.35;a._rngTarget=new Range("target");a._rngTarget.thickness=.8;a._rngTarget.color="black";a._rngGood=new Range("good");a._rngGood.color="rgba(0,0,0,.15)";a._rngBad=new Range("bad");a._rngBad.color="rgba(0,0,0,.3)";a.ranges.push(a._rngBad);a.ranges.push(a._rngGood);a.ranges.push(a._rngTarget);a.initialize(i);return a}Object.defineProperty(BulletGraph,"controlTemplate",{get:function(){BulletGraph._ctrlTemplate||(BulletGraph._ctrlTemplate=LinearGauge.controlTemplate);return BulletGraph._ctrlTemplate},set:function(e){BulletGraph._ctrlTemplate=e},enumerable:!0,configurable:!0});Object.defineProperty(BulletGraph.prototype,"target",{get:function(){return this._rngTarget.max},set:function(e){this._rngTarget.max=e},enumerable:!0,configurable:!0});Object.defineProperty(BulletGraph.prototype,"good",{get:function(){return this._rngGood.max},set:function(e){this._rngGood.max=e},enumerable:!0,configurable:!0});Object.defineProperty(BulletGraph.prototype,"bad",{get:function(){return this._rngBad.max},set:function(e){this._rngBad.max=e},enumerable:!0,configurable:!0});BulletGraph.prototype._getRangeRect=function(t,i){void 0===i&&(i=t.max);var a=e.prototype._getRangeRect.call(this,t,i);if(t==this._rngTarget)switch(this._getDirection()){case GaugeDirection.Right:a.left=a.right-1;a.width=3;break;case GaugeDirection.Left:a.width=3;break;case GaugeDirection.Up:a.height=3;break;case GaugeDirection.Down:a.top=a.bottom-1;a.height=3}return a};BulletGraph._ctrlTemplate="";return BulletGraph}(LinearGauge);export{BulletGraph};_registerModule("wijmo.gauge",selfModule);
package/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * Wijmo Library 5.20242.30
3
+ * Wijmo Library 5.20251.40
4
4
  * https://developer.mescius.com/wijmo
5
5
  *
6
6
  * Copyright(c) MESCIUS inc. All rights reserved.
@@ -557,6 +557,11 @@ export declare class RadialGauge extends Gauge {
557
557
  private _rcSvg;
558
558
  private _ctmInv;
559
559
  private _ptSvg;
560
+ static _ctrlTemplate: string;
561
+ /**
562
+ * Gets or sets the template used to instantiate {@link RadialGauge} control.
563
+ */
564
+ static controlTemplate: string;
560
565
  /**
561
566
  * Initializes a new instance of the {@link RadialGauge} class.
562
567
  *
@@ -741,6 +746,11 @@ export declare enum GaugeDirection {
741
746
  */
742
747
  export declare class LinearGauge extends Gauge {
743
748
  private _direction;
749
+ static _ctrlTemplate: string;
750
+ /**
751
+ * Gets or sets the template used to instantiate {@link LinearGauge} control.
752
+ */
753
+ static controlTemplate: string;
744
754
  /**
745
755
  * Initializes a new instance of the {@link LinearGauge} class.
746
756
  *
@@ -790,6 +800,11 @@ export declare class BulletGraph extends LinearGauge {
790
800
  _rngTarget: Range;
791
801
  _rngGood: Range;
792
802
  _rngBad: Range;
803
+ static _ctrlTemplate: string;
804
+ /**
805
+ * Gets or sets the template used to instantiate {@link BulletGraph} control.
806
+ */
807
+ static controlTemplate: string;
793
808
  /**
794
809
  * Initializes a new instance of the {@link BulletGraph} class.
795
810
  *