From 7ab83426f52ad3db64d9e189b30159f2c072216c Mon Sep 17 00:00:00 2001 From: Daniel Lando Date: Fri, 11 Jun 2021 10:43:51 +0200 Subject: [PATCH] Release 1.4.3 --- CHANGELOG.md | 8 ++++++++ dist/justgage.js | 6 +++--- dist/justgage.min.js | 2 +- dist/justgage.min.js.map | 2 +- package-lock.json | 2 +- package.json | 2 +- 6 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76f78f9..c865968 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,12 +4,20 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +#### [v1.4.3](https://github.com/toorshia/justgage/compare/v1.4.2...v1.4.3) + +> 11 June 2021 + +- feat: use custom formats when `textRenderer` returns `false` [`#363`](https://github.com/toorshia/justgage/pull/363) +- chore: bump lodash from 4.17.19 to 4.17.21 [`#361`](https://github.com/toorshia/justgage/pull/361) + #### [v1.4.2](https://github.com/toorshia/justgage/compare/v1.4.1...v1.4.2) > 15 February 2021 - fix: refresh with min/max 0 [`#360`](https://github.com/toorshia/justgage/pull/360) - fix: refresh with min/max 0 (#360) [`#359`](https://github.com/toorshia/justgage/issues/359) +- Release 1.4.2 [`57b1ad4`](https://github.com/toorshia/justgage/commit/57b1ad4e142a6d1775051f512d48df9f34aac857) #### [v1.4.1](https://github.com/toorshia/justgage/compare/v1.4.0...v1.4.1) diff --git a/dist/justgage.js b/dist/justgage.js index 19d0d67..a3b7729 100644 --- a/dist/justgage.js +++ b/dist/justgage.js @@ -723,7 +723,7 @@ defs, svg = null; // set value to display - if (obj.config.textRenderer) { + if (obj.config.textRenderer && obj.config.textRenderer(obj.originalValue) !== false) { obj.originalValue = obj.config.textRenderer(obj.originalValue); } else if (obj.config.humanFriendly) { obj.originalValue = humanFriendlyNumber(obj.originalValue, obj.config.humanFriendlyDecimal) + obj.config.symbol; @@ -742,7 +742,7 @@ if (obj.config.reverse) { currentValue = (obj.config.max * 1) + (obj.config.min * 1) - (obj.level.attr("pki")[0] * 1); } - if (obj.config.textRenderer) { + if (obj.config.textRenderer && obj.config.textRenderer(Math.floor(currentValue)) !== false) { obj.txtValue.attr("text", obj.config.textRenderer(Math.floor(currentValue))); } else if (obj.config.humanFriendly) { obj.txtValue.attr("text", humanFriendlyNumber(Math.floor(currentValue), obj.config.humanFriendlyDecimal) + obj.config.symbol); @@ -914,7 +914,7 @@ color = getColor(val, (val - obj.config.min) / (obj.config.max - obj.config.min), obj.config.levelColors, obj.config.noGradient, obj.config.customSectors); - if (obj.config.textRenderer) { + if (obj.config.textRenderer && obj.config.textRenderer(displayVal) !== false) { displayVal = obj.config.textRenderer(displayVal); } else if (obj.config.humanFriendly) { displayVal = humanFriendlyNumber(displayVal, obj.config.humanFriendlyDecimal) + obj.config.symbol; diff --git a/dist/justgage.min.js b/dist/justgage.min.js index ad2a0aa..86bad1c 100644 --- a/dist/justgage.min.js +++ b/dist/justgage.min.js @@ -1,2 +1,2 @@ -!function(n,e){"function"==typeof define&&define.amd?define(["raphael"],function(t){return n.JustGage=e(t)}):"object"==typeof module&&module.exports?module.exports=n.JustGage=e(require("raphael")):n.JustGage=e(Raphael)}("undefined"!=typeof window?window:this,function(T){function t(t){var A=this;if(A.events={},N(t))return!1;if(N(t.id)){if(N(t.parentNode))return!1;A.node=t.parentNode}else if(A.node=document.getElementById(t.id),!A.node)return!1;var n,e,i,o,a,r,l,c,f,m,s,g,u,d,p,h,x,b,v,y=A.node.dataset?A.node.dataset:{},M=!N(t.defaults)&&t.defaults;!1!==M&&delete(t=function(t){t=t||{};for(var n=1;n"),refreshAnimationTime:C("refreshAnimationTime",t,y,700),refreshAnimationType:C("refreshAnimationType",t,y,">"),donutStartAngle:C("donutStartAngle",t,y,90),valueMinFontSize:C("valueMinFontSize",t,y,16),labelMinFontSize:C("labelMinFontSize",t,y,10),minLabelMinFontSize:C("minLabelMinFontSize",t,y,10),maxLabelMinFontSize:C("maxLabelMinFontSize",t,y,10),hideValue:C("hideValue",t,y,!1),hideMinMax:C("hideMinMax",t,y,!1),showInnerShadow:C("showInnerShadow",t,y,!1),humanFriendly:C("humanFriendly",t,y,!1),noGradient:C("noGradient",t,y,!1),donut:C("donut",t,y,!1),relativeGaugeSize:C("relativeGaugeSize",t,y,!1),counter:C("counter",t,y,!1),decimals:C("decimals",t,y,0),customSectors:C("customSectors",t,y,{}),formatNumber:C("formatNumber",t,y,!1),pointer:C("pointer",t,y,!1),pointerOptions:C("pointerOptions",t,y,{}),displayRemaining:C("displayRemaining",t,y,!1)},A.config.value>A.config.max&&(A.config.value=A.config.max),A.config.valueA.config.valueMinFontSize?o/6.5:A.config.valueMinFontSize,f=r+i/2,m=l+o/1.275,s=o/16>A.config.labelMinFontSize?o/16:A.config.labelMinFontSize,g=r+i/2,u=m+c/2+5,d=o/16>A.config.minLabelMinFontSize?o/16:A.config.minLabelMinFontSize,p=r+i/10+i/6.666666666666667*A.config.gaugeWidthScale/2,h=u,o/16>A.config.maxLabelMinFontSize?o/16:A.config.maxLabelMinFontSize),r+i-i/10-i/6.666666666666667*A.config.gaugeWidthScale/2),u),A.params={canvasW:n,canvasH:e,widgetW:i,widgetH:o,dx:r,dy:l,valueFontSize:c,valueX:f,valueY:m,labelFontSize:s,labelX:g,labelY:u,minFontSize:d,minX:p,minY:h,maxFontSize:x,maxX:b,maxY:v},v=null,A.canvas.customAttributes.pki=function(t){var n,e,i,o,a,r,l=A.config.min,c=A.config.max,f=A.params.widgetW,m=A.params.widgetH,s=A.params.dx,g=A.params.dy,u=A.config.gaugeWidthScale,d=A.config.donut;A.config.reverse;return l<0&&(c-=l,t-=l,l=0),d?(n=(1-2*(t-l)/(c-l))*Math.PI,r="M"+((o=f/2+s)-(i=(e=f/2-f/30)-f/6.666666666666667*u))+","+(a=m/2+g)+" ",r+="L"+(o-e)+","+a+" ",(c-l)/2=o.ranges[y].lo&&t<=o.ranges[y].hi)return o.ranges[y].color}if(1===(a=e.length))return e[0];for(r=i?1/a:1/(a-1),l=[],y=0;y1*r.config.max&&(t=1*r.config.max),1*t<1*r.config.min&&(t=1*r.config.min),a=O(t,(t-r.config.min)/(r.config.max-r.config.min),r.config.levelColors,r.config.noGradient,r.config.customSectors),o=r.config.textRenderer?r.config.textRenderer(o):r.config.humanFriendly?k(o,r.config.humanFriendlyDecimal)+r.config.symbol:r.config.formatNumber?L((1*o).toFixed(r.config.decimals))+r.config.symbol:r.config.displayRemaining?(1*(r.config.max-o)).toFixed(r.config.decimals)+r.config.symbol:(1*o).toFixed(r.config.decimals)+r.config.symbol,r.originalValue=o,r.config.value=1*t,r.config.counter||(r.txtValue.attr({text:o}),E(r.txtValue,r.params.valueFontSize,r.params.valueY));var l=r.config.value;r.config.reverse&&(l=1*r.config.max+1*r.config.min-1*r.config.value),r.level.animate({pki:[l],fill:a},r.config.refreshAnimationTime,r.config.refreshAnimationType,r.config.onAnimationEnd),r.config.pointer&&r.needle.animate({ndl:[l]},r.config.refreshAnimationTime,r.config.refreshAnimationType),e=null},t.prototype.update=function(t,n){if(t instanceof Object)for(var e in t)i(this,e,n=t[e]);else i(this,t,n)},t.prototype.destroy=function(){for(var t in this.node&&this.node.parentNode&&(this.node.innerHTML=""),this.events)T.eve.off(t,this.events[t]);this.events={}},t.prototype.generateShadow=function(t,n){var e,i,o,a,r,l,c,f=this,m="inner-shadow-"+f.config.id;(e=document.createElementNS(t,"filter")).setAttribute("id",m),n.appendChild(e),(i=document.createElementNS(t,"feOffset")).setAttribute("dx",0),i.setAttribute("dy",f.config.shadowVerticalOffset),e.appendChild(i),(o=document.createElementNS(t,"feGaussianBlur")).setAttribute("result","offset-blur"),o.setAttribute("stdDeviation",f.config.shadowSize),e.appendChild(o),(a=document.createElementNS(t,"feComposite")).setAttribute("operator","out"),a.setAttribute("in","SourceGraphic"),a.setAttribute("in2","offset-blur"),a.setAttribute("result","inverse"),e.appendChild(a),(r=document.createElementNS(t,"feFlood")).setAttribute("flood-color","black"),r.setAttribute("flood-opacity",f.config.shadowOpacity),r.setAttribute("result","color"),e.appendChild(r),(l=document.createElementNS(t,"feComposite")).setAttribute("operator","in"),l.setAttribute("in","color"),l.setAttribute("in2","inverse"),l.setAttribute("result","shadow"),e.appendChild(l),(c=document.createElementNS(t,"feComposite")).setAttribute("operator","over"),c.setAttribute("in","shadow"),c.setAttribute("in2","SourceGraphic"),e.appendChild(c),f.config.showInnerShadow&&(f.canvas.canvas.childNodes[2].setAttribute("filter","url("+window.location.pathname+"#"+m+")"),f.canvas.canvas.childNodes[3].setAttribute("filter","url("+window.location.pathname+"#"+m+")")),c=null};var I=function(){for(var t=3,n=document.createElement("div"),e=n.getElementsByTagName("i");n.innerHTML="\x3c!--[if gt IE "+ ++t+"]>"),refreshAnimationTime:C("refreshAnimationTime",t,y,700),refreshAnimationType:C("refreshAnimationType",t,y,">"),donutStartAngle:C("donutStartAngle",t,y,90),valueMinFontSize:C("valueMinFontSize",t,y,16),labelMinFontSize:C("labelMinFontSize",t,y,10),minLabelMinFontSize:C("minLabelMinFontSize",t,y,10),maxLabelMinFontSize:C("maxLabelMinFontSize",t,y,10),hideValue:C("hideValue",t,y,!1),hideMinMax:C("hideMinMax",t,y,!1),showInnerShadow:C("showInnerShadow",t,y,!1),humanFriendly:C("humanFriendly",t,y,!1),noGradient:C("noGradient",t,y,!1),donut:C("donut",t,y,!1),relativeGaugeSize:C("relativeGaugeSize",t,y,!1),counter:C("counter",t,y,!1),decimals:C("decimals",t,y,0),customSectors:C("customSectors",t,y,{}),formatNumber:C("formatNumber",t,y,!1),pointer:C("pointer",t,y,!1),pointerOptions:C("pointerOptions",t,y,{}),displayRemaining:C("displayRemaining",t,y,!1)},A.config.value>A.config.max&&(A.config.value=A.config.max),A.config.valueA.config.valueMinFontSize?o/6.5:A.config.valueMinFontSize,f=r+i/2,m=l+o/1.275,s=o/16>A.config.labelMinFontSize?o/16:A.config.labelMinFontSize,g=r+i/2,u=m+c/2+5,d=o/16>A.config.minLabelMinFontSize?o/16:A.config.minLabelMinFontSize,p=r+i/10+i/6.666666666666667*A.config.gaugeWidthScale/2,x=u,o/16>A.config.maxLabelMinFontSize?o/16:A.config.maxLabelMinFontSize),r+i-i/10-i/6.666666666666667*A.config.gaugeWidthScale/2),u),A.params={canvasW:n,canvasH:e,widgetW:i,widgetH:o,dx:r,dy:l,valueFontSize:c,valueX:f,valueY:m,labelFontSize:s,labelX:g,labelY:u,minFontSize:d,minX:p,minY:x,maxFontSize:h,maxX:b,maxY:v},v=null,A.canvas.customAttributes.pki=function(t){var n,e,i,o,a,r,l=A.config.min,c=A.config.max,f=A.params.widgetW,m=A.params.widgetH,s=A.params.dx,g=A.params.dy,u=A.config.gaugeWidthScale,d=A.config.donut;A.config.reverse;return l<0&&(c-=l,t-=l,l=0),d?(n=(1-2*(t-l)/(c-l))*Math.PI,r="M"+((o=f/2+s)-(i=(e=f/2-f/30)-f/6.666666666666667*u))+","+(a=m/2+g)+" ",r+="L"+(o-e)+","+a+" ",(c-l)/2=o.ranges[y].lo&&t<=o.ranges[y].hi)return o.ranges[y].color}if(1===(a=e.length))return e[0];for(r=i?1/a:1/(a-1),l=[],y=0;y1*r.config.max&&(t=1*r.config.max),1*t<1*r.config.min&&(t=1*r.config.min),a=O(t,(t-r.config.min)/(r.config.max-r.config.min),r.config.levelColors,r.config.noGradient,r.config.customSectors),o=r.config.textRenderer&&!1!==r.config.textRenderer(o)?r.config.textRenderer(o):r.config.humanFriendly?k(o,r.config.humanFriendlyDecimal)+r.config.symbol:r.config.formatNumber?L((1*o).toFixed(r.config.decimals))+r.config.symbol:r.config.displayRemaining?(1*(r.config.max-o)).toFixed(r.config.decimals)+r.config.symbol:(1*o).toFixed(r.config.decimals)+r.config.symbol,r.originalValue=o,r.config.value=1*t,r.config.counter||(r.txtValue.attr({text:o}),E(r.txtValue,r.params.valueFontSize,r.params.valueY));var l=r.config.value;r.config.reverse&&(l=1*r.config.max+1*r.config.min-1*r.config.value),r.level.animate({pki:[l],fill:a},r.config.refreshAnimationTime,r.config.refreshAnimationType,r.config.onAnimationEnd),r.config.pointer&&r.needle.animate({ndl:[l]},r.config.refreshAnimationTime,r.config.refreshAnimationType),e=null},t.prototype.update=function(t,n){if(t instanceof Object)for(var e in t)i(this,e,n=t[e]);else i(this,t,n)},t.prototype.destroy=function(){for(var t in this.node&&this.node.parentNode&&(this.node.innerHTML=""),this.events)T.eve.off(t,this.events[t]);this.events={}},t.prototype.generateShadow=function(t,n){var e,i,o,a,r,l,c,f=this,m="inner-shadow-"+f.config.id;(e=document.createElementNS(t,"filter")).setAttribute("id",m),n.appendChild(e),(i=document.createElementNS(t,"feOffset")).setAttribute("dx",0),i.setAttribute("dy",f.config.shadowVerticalOffset),e.appendChild(i),(o=document.createElementNS(t,"feGaussianBlur")).setAttribute("result","offset-blur"),o.setAttribute("stdDeviation",f.config.shadowSize),e.appendChild(o),(a=document.createElementNS(t,"feComposite")).setAttribute("operator","out"),a.setAttribute("in","SourceGraphic"),a.setAttribute("in2","offset-blur"),a.setAttribute("result","inverse"),e.appendChild(a),(r=document.createElementNS(t,"feFlood")).setAttribute("flood-color","black"),r.setAttribute("flood-opacity",f.config.shadowOpacity),r.setAttribute("result","color"),e.appendChild(r),(l=document.createElementNS(t,"feComposite")).setAttribute("operator","in"),l.setAttribute("in","color"),l.setAttribute("in2","inverse"),l.setAttribute("result","shadow"),e.appendChild(l),(c=document.createElementNS(t,"feComposite")).setAttribute("operator","over"),c.setAttribute("in","shadow"),c.setAttribute("in2","SourceGraphic"),e.appendChild(c),f.config.showInnerShadow&&(f.canvas.canvas.childNodes[2].setAttribute("filter","url("+window.location.pathname+"#"+m+")"),f.canvas.canvas.childNodes[3].setAttribute("filter","url("+window.location.pathname+"#"+m+")")),c=null};var R=function(){for(var t=3,n=document.createElement("div"),e=n.getElementsByTagName("i");n.innerHTML="\x3c!--[if gt IE "+ ++t+"]>