@hpcc-js/api
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -6,2 +6,10 @@ # Change Log | ||
<a name="0.1.1"></a> | ||
## [0.1.1](https://github.com/hpcc-systems/Visualization/compare/@hpcc-js/api@0.1.0...@hpcc-js/api@0.1.1) (2018-05-28) | ||
**Note:** Version bump only for package @hpcc-js/api | ||
<a name="0.1.0"></a> | ||
@@ -8,0 +16,0 @@ # [0.1.0](https://github.com/hpcc-systems/Visualization/compare/@hpcc-js/api@0.0.78...@hpcc-js/api@0.1.0) (2018-05-21) |
@@ -200,15 +200,49 @@ import { Palette, Widget, select, selection } from '@hpcc-js/common'; | ||
function formatDefault(x, p) { | ||
x = x.toPrecision(p); | ||
// [[fill]align][sign][symbol][0][width][,][.precision][~][type] | ||
var re = /^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i; | ||
out: for (var n = x.length, i = 1, i0 = -1, i1; i < n; ++i) { | ||
switch (x[i]) { | ||
function formatSpecifier(specifier) { | ||
return new FormatSpecifier(specifier); | ||
} | ||
formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof | ||
function FormatSpecifier(specifier) { | ||
if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier); | ||
var match; | ||
this.fill = match[1] || " "; | ||
this.align = match[2] || ">"; | ||
this.sign = match[3] || "-"; | ||
this.symbol = match[4] || ""; | ||
this.zero = !!match[5]; | ||
this.width = match[6] && +match[6]; | ||
this.comma = !!match[7]; | ||
this.precision = match[8] && +match[8].slice(1); | ||
this.trim = !!match[9]; | ||
this.type = match[10] || ""; | ||
} | ||
FormatSpecifier.prototype.toString = function() { | ||
return this.fill | ||
+ this.align | ||
+ this.sign | ||
+ this.symbol | ||
+ (this.zero ? "0" : "") | ||
+ (this.width == null ? "" : Math.max(1, this.width | 0)) | ||
+ (this.comma ? "," : "") | ||
+ (this.precision == null ? "" : "." + Math.max(0, this.precision | 0)) | ||
+ (this.trim ? "~" : "") | ||
+ this.type; | ||
}; | ||
// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k. | ||
function formatTrim(s) { | ||
out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) { | ||
switch (s[i]) { | ||
case ".": i0 = i1 = i; break; | ||
case "0": if (i0 === 0) i0 = i; i1 = i; break; | ||
case "e": break out; | ||
default: if (i0 > 0) i0 = 0; break; | ||
default: if (i0 > 0) { if (!+s[i]) break out; i0 = 0; } break; | ||
} | ||
} | ||
return i0 > 0 ? x.slice(0, i0) + x.slice(i1 + 1) : x; | ||
return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s; | ||
} | ||
@@ -242,3 +276,2 @@ | ||
var formatTypes = { | ||
"": formatDefault, | ||
"%": function(x, p) { return (x * 100).toFixed(p); }, | ||
@@ -259,57 +292,2 @@ "b": function(x) { return Math.round(x).toString(2); }, | ||
// [[fill]align][sign][symbol][0][width][,][.precision][type] | ||
var re = /^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i; | ||
function formatSpecifier(specifier) { | ||
return new FormatSpecifier(specifier); | ||
} | ||
formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof | ||
function FormatSpecifier(specifier) { | ||
if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier); | ||
var match, | ||
fill = match[1] || " ", | ||
align = match[2] || ">", | ||
sign = match[3] || "-", | ||
symbol = match[4] || "", | ||
zero = !!match[5], | ||
width = match[6] && +match[6], | ||
comma = !!match[7], | ||
precision = match[8] && +match[8].slice(1), | ||
type = match[9] || ""; | ||
// The "n" type is an alias for ",g". | ||
if (type === "n") comma = true, type = "g"; | ||
// Map invalid types to the default format. | ||
else if (!formatTypes[type]) type = ""; | ||
// If zero fill is specified, padding goes after sign and before digits. | ||
if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "="; | ||
this.fill = fill; | ||
this.align = align; | ||
this.sign = sign; | ||
this.symbol = symbol; | ||
this.zero = zero; | ||
this.width = width; | ||
this.comma = comma; | ||
this.precision = precision; | ||
this.type = type; | ||
} | ||
FormatSpecifier.prototype.toString = function() { | ||
return this.fill | ||
+ this.align | ||
+ this.sign | ||
+ this.symbol | ||
+ (this.zero ? "0" : "") | ||
+ (this.width == null ? "" : Math.max(1, this.width | 0)) | ||
+ (this.comma ? "," : "") | ||
+ (this.precision == null ? "" : "." + Math.max(0, this.precision | 0)) | ||
+ this.type; | ||
}; | ||
function identity(x) { | ||
@@ -339,4 +317,14 @@ return x; | ||
precision = specifier.precision, | ||
trim = specifier.trim, | ||
type = specifier.type; | ||
// The "n" type is an alias for ",g". | ||
if (type === "n") comma = true, type = "g"; | ||
// The "" type, and any invalid type, is an alias for ".12~g". | ||
else if (!formatTypes[type]) precision == null && (precision = 12), trim = true, type = "g"; | ||
// If zero fill is specified, padding goes after sign and before digits. | ||
if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "="; | ||
// Compute the prefix and suffix. | ||
@@ -351,3 +339,3 @@ // For SI-prefix, the suffix is lazily computed. | ||
var formatType = formatTypes[type], | ||
maybeSuffix = !type || /[defgprs%]/.test(type); | ||
maybeSuffix = /[defgprs%]/.test(type); | ||
@@ -358,3 +346,3 @@ // Set the default precision if not specified, | ||
// For fixed precision, it must be in [0, 20]. | ||
precision = precision == null ? (type ? 6 : 12) | ||
precision = precision == null ? 6 | ||
: /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) | ||
@@ -378,2 +366,5 @@ : Math.max(0, Math.min(20, precision)); | ||
// Trim insignificant zeros. | ||
if (trim) value = formatTrim(value); | ||
// If a negative value rounds to zero during formatting, treat as positive. | ||
@@ -384,3 +375,3 @@ if (valueNegative && +value === 0) valueNegative = false; | ||
valuePrefix = (valueNegative ? (sign === "(" ? sign : "-") : sign === "-" || sign === "(" ? "" : sign) + valuePrefix; | ||
valueSuffix = valueSuffix + (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + (valueNegative && sign === "(" ? ")" : ""); | ||
valueSuffix = (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : ""); | ||
@@ -387,0 +378,0 @@ // Break the formatted value into the integer “value” part that can be |
@@ -204,15 +204,49 @@ (function (global, factory) { | ||
function formatDefault(x, p) { | ||
x = x.toPrecision(p); | ||
// [[fill]align][sign][symbol][0][width][,][.precision][~][type] | ||
var re = /^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i; | ||
out: for (var n = x.length, i = 1, i0 = -1, i1; i < n; ++i) { | ||
switch (x[i]) { | ||
function formatSpecifier(specifier) { | ||
return new FormatSpecifier(specifier); | ||
} | ||
formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof | ||
function FormatSpecifier(specifier) { | ||
if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier); | ||
var match; | ||
this.fill = match[1] || " "; | ||
this.align = match[2] || ">"; | ||
this.sign = match[3] || "-"; | ||
this.symbol = match[4] || ""; | ||
this.zero = !!match[5]; | ||
this.width = match[6] && +match[6]; | ||
this.comma = !!match[7]; | ||
this.precision = match[8] && +match[8].slice(1); | ||
this.trim = !!match[9]; | ||
this.type = match[10] || ""; | ||
} | ||
FormatSpecifier.prototype.toString = function() { | ||
return this.fill | ||
+ this.align | ||
+ this.sign | ||
+ this.symbol | ||
+ (this.zero ? "0" : "") | ||
+ (this.width == null ? "" : Math.max(1, this.width | 0)) | ||
+ (this.comma ? "," : "") | ||
+ (this.precision == null ? "" : "." + Math.max(0, this.precision | 0)) | ||
+ (this.trim ? "~" : "") | ||
+ this.type; | ||
}; | ||
// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k. | ||
function formatTrim(s) { | ||
out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) { | ||
switch (s[i]) { | ||
case ".": i0 = i1 = i; break; | ||
case "0": if (i0 === 0) i0 = i; i1 = i; break; | ||
case "e": break out; | ||
default: if (i0 > 0) i0 = 0; break; | ||
default: if (i0 > 0) { if (!+s[i]) break out; i0 = 0; } break; | ||
} | ||
} | ||
return i0 > 0 ? x.slice(0, i0) + x.slice(i1 + 1) : x; | ||
return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s; | ||
} | ||
@@ -246,3 +280,2 @@ | ||
var formatTypes = { | ||
"": formatDefault, | ||
"%": function(x, p) { return (x * 100).toFixed(p); }, | ||
@@ -263,57 +296,2 @@ "b": function(x) { return Math.round(x).toString(2); }, | ||
// [[fill]align][sign][symbol][0][width][,][.precision][type] | ||
var re = /^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i; | ||
function formatSpecifier(specifier) { | ||
return new FormatSpecifier(specifier); | ||
} | ||
formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof | ||
function FormatSpecifier(specifier) { | ||
if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier); | ||
var match, | ||
fill = match[1] || " ", | ||
align = match[2] || ">", | ||
sign = match[3] || "-", | ||
symbol = match[4] || "", | ||
zero = !!match[5], | ||
width = match[6] && +match[6], | ||
comma = !!match[7], | ||
precision = match[8] && +match[8].slice(1), | ||
type = match[9] || ""; | ||
// The "n" type is an alias for ",g". | ||
if (type === "n") comma = true, type = "g"; | ||
// Map invalid types to the default format. | ||
else if (!formatTypes[type]) type = ""; | ||
// If zero fill is specified, padding goes after sign and before digits. | ||
if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "="; | ||
this.fill = fill; | ||
this.align = align; | ||
this.sign = sign; | ||
this.symbol = symbol; | ||
this.zero = zero; | ||
this.width = width; | ||
this.comma = comma; | ||
this.precision = precision; | ||
this.type = type; | ||
} | ||
FormatSpecifier.prototype.toString = function() { | ||
return this.fill | ||
+ this.align | ||
+ this.sign | ||
+ this.symbol | ||
+ (this.zero ? "0" : "") | ||
+ (this.width == null ? "" : Math.max(1, this.width | 0)) | ||
+ (this.comma ? "," : "") | ||
+ (this.precision == null ? "" : "." + Math.max(0, this.precision | 0)) | ||
+ this.type; | ||
}; | ||
function identity(x) { | ||
@@ -343,4 +321,14 @@ return x; | ||
precision = specifier.precision, | ||
trim = specifier.trim, | ||
type = specifier.type; | ||
// The "n" type is an alias for ",g". | ||
if (type === "n") comma = true, type = "g"; | ||
// The "" type, and any invalid type, is an alias for ".12~g". | ||
else if (!formatTypes[type]) precision == null && (precision = 12), trim = true, type = "g"; | ||
// If zero fill is specified, padding goes after sign and before digits. | ||
if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "="; | ||
// Compute the prefix and suffix. | ||
@@ -355,3 +343,3 @@ // For SI-prefix, the suffix is lazily computed. | ||
var formatType = formatTypes[type], | ||
maybeSuffix = !type || /[defgprs%]/.test(type); | ||
maybeSuffix = /[defgprs%]/.test(type); | ||
@@ -362,3 +350,3 @@ // Set the default precision if not specified, | ||
// For fixed precision, it must be in [0, 20]. | ||
precision = precision == null ? (type ? 6 : 12) | ||
precision = precision == null ? 6 | ||
: /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) | ||
@@ -382,2 +370,5 @@ : Math.max(0, Math.min(20, precision)); | ||
// Trim insignificant zeros. | ||
if (trim) value = formatTrim(value); | ||
// If a negative value rounds to zero during formatting, treat as positive. | ||
@@ -388,3 +379,3 @@ if (valueNegative && +value === 0) valueNegative = false; | ||
valuePrefix = (valueNegative ? (sign === "(" ? sign : "-") : sign === "-" || sign === "(" ? "" : sign) + valuePrefix; | ||
valueSuffix = valueSuffix + (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + (valueNegative && sign === "(" ? ")" : ""); | ||
valueSuffix = (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : ""); | ||
@@ -391,0 +382,0 @@ // Break the formatted value into the integer “value” part that can be |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@hpcc-js/common")):"function"==typeof define&&define.amd?define(["exports","@hpcc-js/common"],e):e(t["@hpcc-js/api"]={},t["@hpcc-js/common"])}(this,function(t,e){"use strict";function n(){}function o(){}function r(){}n.prototype._palette=e.Palette.rainbow("default"),n.prototype.click=function(t,e,n){console.log("Click: "+JSON.stringify(t)+", "+e+", "+n)},n.prototype.dblclick=function(t,e,n){console.log("Double click: "+JSON.stringify(t)+", "+e+", "+n)},o.prototype._palette=e.Palette.ordinal("default"),o.prototype.click=function(t,e,n){console.log("Click: "+JSON.stringify(t)+", "+e+", "+n)},o.prototype.dblclick=function(t,e,n){console.log("Double click: "+JSON.stringify(t)+", "+e+", "+n)},r.prototype.vertex_click=function(t,e,n,o){o&&o.vertex&&console.log("Vertex click: "+o.vertex.id())},r.prototype.vertex_dblclick=function(t,e,n,o){o&&o.vertex&&console.log("Vertex double click: "+o.vertex.id())},r.prototype.edge_click=function(t,e,n,o){o&&o.edge&&console.log("Edge click: "+o.edge.id())},r.prototype.edge_dblclick=function(t,e,n,o){o&&o.edge&&console.log("Edge double click: "+o.edge.id())};var i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};function l(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var a,s=function(t){function e(){return t.call(this)||this}return l(e,t),e.prototype.isValid=function(){if(this.validate()&&!new RegExp(this.validate()).test(this.value()))return!1;return!0},e.prototype.hasValue=function(){if("function"==typeof this.type){switch(this.type()){case"radio":case"checkbox":if(this.value()&&"false"!==this.value())return!0;break;default:if(this.value())return!0}return!1}return""!==this.value()},e.prototype.blur=function(t){},e.prototype.click=function(t){},e.prototype.dblclick=function(t){},e.prototype.change=function(t,e){},e.prototype.resetValue=function(t){t.value(t._inputElement[0].node().value)},e.prototype.disable=function(t){this._inputElement.forEach(function(e,n){e.attr("disabled",t?"disabled":null)})},e.prototype.setFocus=function(){this._inputElement.length&&this._inputElement[0].node().focus()},e}(e.Widget);function u(){}function c(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,o=t.slice(0,n);return[o.length>1?o[0]+o.slice(2):o,+t.slice(n+1)]}function p(t,e){var n=c(t,e);if(!n)return t+"";var o=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+o:o.length>r+1?o.slice(0,r+1)+"."+o.slice(r+1):o+new Array(r-o.length+2).join("0")}s.prototype.publish("name","","string","HTML name for the input"),s.prototype.publish("label","","string","Descriptive label"),s.prototype.publish("value","","string","Input Current Value"),s.prototype.publish("validate",null,"string","Input Validation"),u.prototype._palette=e.Palette.ordinal("default"),u.prototype.click=function(t,e,n){console.log("Click: "+JSON.stringify(t)+", "+e+", "+n)},u.prototype.dblclick=function(t,e,n){console.log("Double click: "+JSON.stringify(t)+", "+e+", "+n)};var f={"":function(t,e){t=t.toPrecision(e);t:for(var n,o=t.length,r=1,i=-1;r<o;++r)switch(t[r]){case".":i=n=r;break;case"0":0===i&&(i=r),n=r;break;case"e":break t;default:i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(n+1):t},"%":function(t,e){return(100*t).toFixed(e)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},g:function(t,e){return t.toPrecision(e)},o:function(t){return Math.round(t).toString(8)},p:function(t,e){return p(100*t,e)},r:p,s:function(t,e){var n=c(t,e);if(!n)return t+"";var o=n[0],r=n[1],i=r-(a=3*Math.max(-8,Math.min(8,Math.floor(r/3))))+1,l=o.length;return i===l?o:i>l?o+new Array(i-l+1).join("0"):i>0?o.slice(0,i)+"."+o.slice(i):"0."+new Array(1-i).join("0")+c(t,Math.max(0,e+i-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}},h=/^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i;function y(t){return new d(t)}function d(t){if(!(e=h.exec(t)))throw new Error("invalid format: "+t);var e,n=e[1]||" ",o=e[2]||">",r=e[3]||"-",i=e[4]||"",l=!!e[5],a=e[6]&&+e[6],s=!!e[7],u=e[8]&&+e[8].slice(1),c=e[9]||"";"n"===c?(s=!0,c="g"):f[c]||(c=""),(l||"0"===n&&"="===o)&&(l=!0,n="0",o="="),this.fill=n,this.align=o,this.sign=r,this.symbol=i,this.zero=l,this.width=a,this.comma=s,this.precision=u,this.type=c}function g(t){return t}y.prototype=d.prototype,d.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+this.type};var v,m,x=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function b(t){var e,n,o=t.grouping&&t.thousands?(e=t.grouping,n=t.thousands,function(t,o){for(var r=t.length,i=[],l=0,a=e[0],s=0;r>0&&a>0&&(s+a+1>o&&(a=Math.max(1,o-s)),i.push(t.substring(r-=a,r+a)),!((s+=a+1)>o));)a=e[l=(l+1)%e.length];return i.reverse().join(n)}):g,r=t.currency,i=t.decimal,l=t.numerals?function(t){return function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}}(t.numerals):g,s=t.percent||"%";function u(t){var e=(t=y(t)).fill,n=t.align,u=t.sign,c=t.symbol,p=t.zero,h=t.width,d=t.comma,g=t.precision,v=t.type,m="$"===c?r[0]:"#"===c&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",b="$"===c?r[1]:/[%p]/.test(v)?s:"",w=f[v],k=!v||/[defgprs%]/.test(v);function C(t){var r,s,c,f=m,y=b;if("c"===v)y=w(t)+y,t="";else{var C=(t=+t)<0;if(t=w(Math.abs(t),g),C&&0==+t&&(C=!1),f=(C?"("===u?u:"-":"-"===u||"("===u?"":u)+f,y=y+("s"===v?x[8+a/3]:"")+(C&&"("===u?")":""),k)for(r=-1,s=t.length;++r<s;)if(48>(c=t.charCodeAt(r))||c>57){y=(46===c?i+t.slice(r+1):t.slice(r))+y,t=t.slice(0,r);break}}d&&!p&&(t=o(t,1/0));var E=f.length+t.length+y.length,S=E<h?new Array(h-E+1).join(e):"";switch(d&&p&&(t=o(S+t,S.length?h-y.length:1/0),S=""),n){case"<":t=f+t+y+S;break;case"=":t=f+S+t+y;break;case"^":t=S.slice(0,E=S.length>>1)+f+t+y+S.slice(E);break;default:t=S+f+t+y}return l(t)}return g=null==g?v?6:12:/[gprs]/.test(v)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),C.toString=function(){return t+""},C}return{format:u,formatPrefix:function(t,e){var n,o=u(((t=y(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor((n=e,((n=c(Math.abs(n)))?n[1]:NaN)/3)))),i=Math.pow(10,-r),l=x[8+r/3];return function(t){return o(i*t)+l}}}}v=b({decimal:".",thousands:",",grouping:[3],currency:["$",""]}),m=v.format,v.formatPrefix;function w(){}function k(t,e){var n=new w;if(t instanceof w)t.each(function(t,e){n.set(e,t)});else if(Array.isArray(t)){var o,r=-1,i=t.length;if(null==e)for(;++r<i;)n.set(r,t[r]);else for(;++r<i;)n.set(e(o=t[r],r,t),o)}else if(t)for(var l in t)n.set(l,t[l]);return n}function C(){}w.prototype=k.prototype={constructor:w,has:function(t){return"$"+t in this},get:function(t){return this["$"+t]},set:function(t,e){return this["$"+t]=e,this},remove:function(t){var e="$"+t;return e in this&&delete this[e]},clear:function(){for(var t in this)"$"===t[0]&&delete this[t]},keys:function(){var t=[];for(var e in this)"$"===e[0]&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)"$"===e[0]&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)"$"===e[0]&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)"$"===e[0]&&++t;return t},empty:function(){for(var t in this)if("$"===t[0])return!1;return!0},each:function(t){for(var e in this)"$"===e[0]&&t(this[e],e.slice(1),this)}};var E=k.prototype;C.prototype=function(t,e){var n=new C;if(t instanceof C)t.each(function(t){n.add(t)});else if(t){var o=-1,r=t.length;if(null==e)for(;++o<r;)n.add(t[o]);else for(;++o<r;)n.add(e(t[o],o,t))}return n}.prototype={constructor:C,has:E.has,add:function(t){return this["$"+(t+="")]=t,this},remove:E.remove,clear:E.clear,values:E.keys,size:E.size,empty:E.empty,each:E.each};!function(t,e){void 0===e&&(e={});var n=e.insertAt;if(t&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===n&&o.firstChild?o.insertBefore(r,o.firstChild):o.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}}('.d3-tip {\r\n line-height: 1;\r\n font-weight: bold;\r\n padding: 12px;\r\n background: rgba(0, 0, 0, 0.66);\r\n color: #fff;\r\n border-radius: 2px;\r\n pointer-events: none !important;\r\n z-index:10;\r\n}\r\n\r\n.d3-tip.hidden {\r\n visibility:hidden;\r\n}\r\n\r\n/* Creates a small triangle extender for the tooltip */\r\n.d3-tip:after {\r\n box-sizing: border-box;\r\n display: inline;\r\n font-size: 10px;\r\n width: 100%;\r\n line-height: 1;\r\n color: rgba(0, 0, 0, 0.66);\r\n position: absolute;\r\n pointer-events: none !important;\r\n}\r\n\r\n/* Northward tooltips */\r\n.d3-tip.n:after {\r\n content: "\\25BC";\r\n margin: -1px 0 0 0;\r\n top: 100%;\r\n left: 0;\r\n text-align: center;\r\n}\r\n\r\n/* Eastward tooltips */\r\n.d3-tip.e:after {\r\n content: "\\25C0";\r\n margin: -4px 0 0 0;\r\n top: 50%;\r\n left: -8px;\r\n}\r\n\r\n/* Southward tooltips */\r\n.d3-tip.s:after {\r\n content: "\\25B2";\r\n margin: 0 0 1px 0;\r\n top: -8px;\r\n left: 0;\r\n text-align: center;\r\n}\r\n\r\n/* Westward tooltips */\r\n.d3-tip.w:after {\r\n content: "\\25B6";\r\n margin: -4px 0 0 -1px;\r\n top: 50%;\r\n left: 100%;\r\n}\r\n\r\n.d3-tip.notick:after {\r\n content: "" !important;\r\n}\r\n\r\n.common_Widget .over {\r\n stroke: rgba(0, 0, 0, 0.66);\r\n opacity: 0.66;\r\n}\r\n');var S=function(t){function n(){var n=t.call(this)||this;if(n.tooltip=function(){var t=function(){return"n"},n=function(){return[0,0]},o=function(){return" "},r=d(document.body),i=f(),l=null,a=null,s=null;function u(t){var e;e=t.node(),(l=e?"svg"===e.tagName.toLowerCase()?e:e.ownerSVGElement:null)&&(a=l.createSVGPoint(),r().appendChild(i))}u.show=function(){var e=Array.prototype.slice.call(arguments);e[e.length-1]instanceof SVGElement&&(s=e.pop());var i,l=o.apply(this,e),a=n.apply(this,e),f=t.apply(this,e),y=h(),d=p.length,g=document.documentElement.scrollTop||r().scrollTop,v=document.documentElement.scrollLeft||r().scrollLeft;for(y.html(l).style("opacity",1).style("pointer-events","all");d--;)y.classed(p[d],!1);return i=c.get(f).apply(this),y.classed(f,!0).style("top",i.top+a[0]+g+"px").style("left",i.left+a[1]+v+"px"),u},u.hide=function(){return h().style("opacity",0).style("pointer-events","none"),u},u.attr=function(t,n){if(arguments.length<2&&"string"==typeof t)return h().attr(t);var o=Array.prototype.slice.call(arguments);return e.selection.prototype.attr.apply(h(),o),u},u.style=function(t,n){if(arguments.length<2&&"string"==typeof t)return h().style(t);var o=Array.prototype.slice.call(arguments);return e.selection.prototype.style.apply(h(),o),u},u.direction=function(e){return arguments.length?(t=null==e?e:d(e),u):t},u.offset=function(t){return arguments.length?(n=null==t?t:d(t),u):n},u.html=function(t){return arguments.length?(o=null==t?t:d(t),u):o},u.rootElement=function(t){return arguments.length?(r=null==t?t:d(t),u):r},u.destroy=function(){return i&&(h().remove(),i=null),u};var c=k({n:function(){var t=y();return{top:t.n.y-i.offsetHeight,left:t.n.x-i.offsetWidth/2}},s:function(){var t=y();return{top:t.s.y,left:t.s.x-i.offsetWidth/2}},e:function(){var t=y();return{top:t.e.y-i.offsetHeight/2,left:t.e.x}},w:function(){var t=y();return{top:t.w.y-i.offsetHeight/2,left:t.w.x-i.offsetWidth}},nw:function(){var t=y();return{top:t.nw.y-i.offsetHeight,left:t.nw.x-i.offsetWidth}},ne:function(){var t=y();return{top:t.ne.y-i.offsetHeight,left:t.ne.x}},sw:function(){var t=y();return{top:t.sw.y,left:t.sw.x-i.offsetWidth}},se:function(){var t=y();return{top:t.se.y,left:t.se.x}}}),p=c.keys();function f(){var t=e.select(document.createElement("div"));return t.style("position","absolute").style("top",0).style("opacity",0).style("pointer-events","none").style("box-sizing","border-box"),t.node()}function h(){return null==i&&(i=f(),r().appendChild(i)),e.select(i)}function y(){for(var t=s||event.target;null==t.getScreenCTM&&null==t.parentNode;)t=t.parentNode;var e={},n=t.getScreenCTM(),o=t.getBBox(),r=o.width,i=o.height,l=o.x,u=o.y;return a.x=l,a.y=u,e.nw=a.matrixTransform(n),a.x+=r,e.ne=a.matrixTransform(n),a.y+=i,e.se=a.matrixTransform(n),a.x-=r,e.sw=a.matrixTransform(n),a.y-=i/2,e.w=a.matrixTransform(n),a.x+=r,e.e=a.matrixTransform(n),a.x-=r/2,a.y-=i/2,e.n=a.matrixTransform(n),a.y+=i,e.s=a.matrixTransform(n),e}function d(t){return"function"==typeof t?t:function(){return t}}return u}().attr("class","d3-tip"),n._valueFormatter=m(n.tooltipValueFormat()),n.layerEnter){var o=n.layerEnter;n.layerEnter=function(t,e,n){this.tooltipEnter(e),o.apply(this,arguments)};var r=n.layerUpdate;n.layerUpdate=function(t){r.apply(this,arguments),this.tooltipUpdate()};var i=n.layerExit;n.layerExit=function(t){i.apply(this,arguments),this.tooltipExit()}}else{var l=n.enter;n.enter=function(t,e){this.tooltipEnter(e),l.apply(this,arguments)};var a=n.update;n.update=function(t,e){a.apply(this,arguments),this.tooltipUpdate()};var s=n.exit;n.exit=function(t,e){s.apply(this,arguments),this.tooltipExit()}}return n}return l(n,t),n.prototype.tooltipEnter=function(t){t.call(this.tooltip)},n.prototype.tooltipUpdate=function(){var t=this;this.tooltip.offset(function(){switch(t.tooltip.direction()()){case"e":return[0,t.tooltipOffset()];default:return[-t.tooltipOffset(),0]}});var e=this.tooltip.attr("class");e&&(e=e.split(" notick").join("")+(this.tooltipTick()?"":" notick")+("none"===this.tooltipStyle()?" hidden":""),this.tooltip.attr("class",e))},n.prototype.tooltipExit=function(){this.tooltip&&this.tooltip.destroy()},n.prototype._tooltipHTML=function(t){return t},n.prototype.tooltipHTML=function(t){return this.tooltip.html(t)},n.prototype.tooltipFormat=function(t){switch((t=t||{}).label=void 0===t.label?"":t.label,t.series=t.series||"",t.value instanceof Date?t.value=t.value||"":t.value=this._valueFormatter(t.value)||"",this.tooltipStyle()){case"none":break;default:return t.series?"<span style='color:"+this.tooltipSeriesColor()+"'>"+t.series+"</span> / <span style='color:"+this.tooltipLabelColor()+"'>"+t.label+"</span>: <span style='color:"+this.tooltipValueColor()+"'>"+t.value+"</span>":"<span style='color:"+this.tooltipLabelColor()+"'>"+t.label+"</span>: <span style='color:"+this.tooltipValueColor()+"'>"+t.value+"</span>"}},n}(e.Widget);S.prototype.publish("tooltipStyle","default","set","Style",["default","none"],{}),S.prototype.publish("tooltipValueFormat",",.2f","string","Value Format",null,{}),S.prototype.publish("tooltipSeriesColor","#EAFFFF","html-color","Series Color",null,{}),S.prototype.publish("tooltipLabelColor","#CCFFFF","html-color","Label Color",null,{}),S.prototype.publish("tooltipValueColor","white","html-color","Value Color",null,{}),S.prototype.publish("tooltipTick",!0,"boolean","Show tooltip tick",null,{}),S.prototype.publish("tooltipOffset",8,"number","Offset from the cursor",null,{});var M=S.prototype.tooltipValueFormat;S.prototype.tooltipValueFormat=function(t){var e=M.apply(this,arguments);return arguments.length&&(this._valueFormatter=m(t)),e};var _=function(){function t(){}return t.prototype.click=function(t,e,n){console.log("Click: "+JSON.stringify(t)+", "+e+", "+n)},t.prototype.dblclick=function(t,e,n){console.log("Double click: "+JSON.stringify(t)+", "+e+", "+n)},t}();_.prototype._palette=e.Palette.ordinal("default"),t.I1DChart=n,t.I2DChart=o,t.IGraph=r,t.instanceOfIHighlight=function(t){return"function"==typeof t.highlightColumn},t.IInput=s,t.INDChart=u,t.ITooltip=S,t.ITree=_,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@hpcc-js/common")):"function"==typeof define&&define.amd?define(["exports","@hpcc-js/common"],e):e(t["@hpcc-js/api"]={},t["@hpcc-js/common"])}(this,function(t,e){"use strict";function n(){}function o(){}function r(){}n.prototype._palette=e.Palette.rainbow("default"),n.prototype.click=function(t,e,n){console.log("Click: "+JSON.stringify(t)+", "+e+", "+n)},n.prototype.dblclick=function(t,e,n){console.log("Double click: "+JSON.stringify(t)+", "+e+", "+n)},o.prototype._palette=e.Palette.ordinal("default"),o.prototype.click=function(t,e,n){console.log("Click: "+JSON.stringify(t)+", "+e+", "+n)},o.prototype.dblclick=function(t,e,n){console.log("Double click: "+JSON.stringify(t)+", "+e+", "+n)},r.prototype.vertex_click=function(t,e,n,o){o&&o.vertex&&console.log("Vertex click: "+o.vertex.id())},r.prototype.vertex_dblclick=function(t,e,n,o){o&&o.vertex&&console.log("Vertex double click: "+o.vertex.id())},r.prototype.edge_click=function(t,e,n,o){o&&o.edge&&console.log("Edge click: "+o.edge.id())},r.prototype.edge_dblclick=function(t,e,n,o){o&&o.edge&&console.log("Edge double click: "+o.edge.id())};var i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};function l(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var a=function(t){function e(){return t.call(this)||this}return l(e,t),e.prototype.isValid=function(){if(this.validate()&&!new RegExp(this.validate()).test(this.value()))return!1;return!0},e.prototype.hasValue=function(){if("function"==typeof this.type){switch(this.type()){case"radio":case"checkbox":if(this.value()&&"false"!==this.value())return!0;break;default:if(this.value())return!0}return!1}return""!==this.value()},e.prototype.blur=function(t){},e.prototype.click=function(t){},e.prototype.dblclick=function(t){},e.prototype.change=function(t,e){},e.prototype.resetValue=function(t){t.value(t._inputElement[0].node().value)},e.prototype.disable=function(t){this._inputElement.forEach(function(e,n){e.attr("disabled",t?"disabled":null)})},e.prototype.setFocus=function(){this._inputElement.length&&this._inputElement[0].node().focus()},e}(e.Widget);function s(){}function u(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,o=t.slice(0,n);return[o.length>1?o[0]+o.slice(2):o,+t.slice(n+1)]}a.prototype.publish("name","","string","HTML name for the input"),a.prototype.publish("label","","string","Descriptive label"),a.prototype.publish("value","","string","Input Current Value"),a.prototype.publish("validate",null,"string","Input Validation"),s.prototype._palette=e.Palette.ordinal("default"),s.prototype.click=function(t,e,n){console.log("Click: "+JSON.stringify(t)+", "+e+", "+n)},s.prototype.dblclick=function(t,e,n){console.log("Double click: "+JSON.stringify(t)+", "+e+", "+n)};var c,p=/^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function f(t){return new h(t)}function h(t){if(!(e=p.exec(t)))throw new Error("invalid format: "+t);var e;this.fill=e[1]||" ",this.align=e[2]||">",this.sign=e[3]||"-",this.symbol=e[4]||"",this.zero=!!e[5],this.width=e[6]&&+e[6],this.comma=!!e[7],this.precision=e[8]&&+e[8].slice(1),this.trim=!!e[9],this.type=e[10]||""}function y(t,e){var n=u(t,e);if(!n)return t+"";var o=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+o:o.length>r+1?o.slice(0,r+1)+"."+o.slice(r+1):o+new Array(r-o.length+2).join("0")}f.prototype=h.prototype,h.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var d={"%":function(t,e){return(100*t).toFixed(e)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},g:function(t,e){return t.toPrecision(e)},o:function(t){return Math.round(t).toString(8)},p:function(t,e){return y(100*t,e)},r:y,s:function(t,e){var n=u(t,e);if(!n)return t+"";var o=n[0],r=n[1],i=r-(c=3*Math.max(-8,Math.min(8,Math.floor(r/3))))+1,l=o.length;return i===l?o:i>l?o+new Array(i-l+1).join("0"):i>0?o.slice(0,i)+"."+o.slice(i):"0."+new Array(1-i).join("0")+u(t,Math.max(0,e+i-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function g(t){return t}var v,m,x=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function b(t){var e,n,o=t.grouping&&t.thousands?(e=t.grouping,n=t.thousands,function(t,o){for(var r=t.length,i=[],l=0,a=e[0],s=0;r>0&&a>0&&(s+a+1>o&&(a=Math.max(1,o-s)),i.push(t.substring(r-=a,r+a)),!((s+=a+1)>o));)a=e[l=(l+1)%e.length];return i.reverse().join(n)}):g,r=t.currency,i=t.decimal,l=t.numerals?function(t){return function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}}(t.numerals):g,a=t.percent||"%";function s(t){var e=(t=f(t)).fill,n=t.align,s=t.sign,u=t.symbol,p=t.zero,h=t.width,y=t.comma,g=t.precision,v=t.trim,m=t.type;"n"===m?(y=!0,m="g"):d[m]||(null==g&&(g=12),v=!0,m="g"),(p||"0"===e&&"="===n)&&(p=!0,e="0",n="=");var b="$"===u?r[0]:"#"===u&&/[boxX]/.test(m)?"0"+m.toLowerCase():"",w="$"===u?r[1]:/[%p]/.test(m)?a:"",k=d[m],C=/[defgprs%]/.test(m);function E(t){var r,a,u,f=b,d=w;if("c"===m)d=k(t)+d,t="";else{var E=(t=+t)<0;if(t=k(Math.abs(t),g),v&&(t=function(t){t:for(var e,n=t.length,o=1,r=-1;o<n;++o)switch(t[o]){case".":r=e=o;break;case"0":0===r&&(r=o),e=o;break;default:if(r>0){if(!+t[o])break t;r=0}}return r>0?t.slice(0,r)+t.slice(e+1):t}(t)),E&&0==+t&&(E=!1),f=(E?"("===s?s:"-":"-"===s||"("===s?"":s)+f,d=("s"===m?x[8+c/3]:"")+d+(E&&"("===s?")":""),C)for(r=-1,a=t.length;++r<a;)if(48>(u=t.charCodeAt(r))||u>57){d=(46===u?i+t.slice(r+1):t.slice(r))+d,t=t.slice(0,r);break}}y&&!p&&(t=o(t,1/0));var S=f.length+t.length+d.length,M=S<h?new Array(h-S+1).join(e):"";switch(y&&p&&(t=o(M+t,M.length?h-d.length:1/0),M=""),n){case"<":t=f+t+d+M;break;case"=":t=f+M+t+d;break;case"^":t=M.slice(0,S=M.length>>1)+f+t+d+M.slice(S);break;default:t=M+f+t+d}return l(t)}return g=null==g?6:/[gprs]/.test(m)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),E.toString=function(){return t+""},E}return{format:s,formatPrefix:function(t,e){var n,o=s(((t=f(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor((n=e,((n=u(Math.abs(n)))?n[1]:NaN)/3)))),i=Math.pow(10,-r),l=x[8+r/3];return function(t){return o(i*t)+l}}}}v=b({decimal:".",thousands:",",grouping:[3],currency:["$",""]}),m=v.format,v.formatPrefix;function w(){}function k(t,e){var n=new w;if(t instanceof w)t.each(function(t,e){n.set(e,t)});else if(Array.isArray(t)){var o,r=-1,i=t.length;if(null==e)for(;++r<i;)n.set(r,t[r]);else for(;++r<i;)n.set(e(o=t[r],r,t),o)}else if(t)for(var l in t)n.set(l,t[l]);return n}function C(){}w.prototype=k.prototype={constructor:w,has:function(t){return"$"+t in this},get:function(t){return this["$"+t]},set:function(t,e){return this["$"+t]=e,this},remove:function(t){var e="$"+t;return e in this&&delete this[e]},clear:function(){for(var t in this)"$"===t[0]&&delete this[t]},keys:function(){var t=[];for(var e in this)"$"===e[0]&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)"$"===e[0]&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)"$"===e[0]&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)"$"===e[0]&&++t;return t},empty:function(){for(var t in this)if("$"===t[0])return!1;return!0},each:function(t){for(var e in this)"$"===e[0]&&t(this[e],e.slice(1),this)}};var E=k.prototype;C.prototype=function(t,e){var n=new C;if(t instanceof C)t.each(function(t){n.add(t)});else if(t){var o=-1,r=t.length;if(null==e)for(;++o<r;)n.add(t[o]);else for(;++o<r;)n.add(e(t[o],o,t))}return n}.prototype={constructor:C,has:E.has,add:function(t){return this["$"+(t+="")]=t,this},remove:E.remove,clear:E.clear,values:E.keys,size:E.size,empty:E.empty,each:E.each};!function(t,e){void 0===e&&(e={});var n=e.insertAt;if(t&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===n&&o.firstChild?o.insertBefore(r,o.firstChild):o.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}}('.d3-tip {\r\n line-height: 1;\r\n font-weight: bold;\r\n padding: 12px;\r\n background: rgba(0, 0, 0, 0.66);\r\n color: #fff;\r\n border-radius: 2px;\r\n pointer-events: none !important;\r\n z-index:10;\r\n}\r\n\r\n.d3-tip.hidden {\r\n visibility:hidden;\r\n}\r\n\r\n/* Creates a small triangle extender for the tooltip */\r\n.d3-tip:after {\r\n box-sizing: border-box;\r\n display: inline;\r\n font-size: 10px;\r\n width: 100%;\r\n line-height: 1;\r\n color: rgba(0, 0, 0, 0.66);\r\n position: absolute;\r\n pointer-events: none !important;\r\n}\r\n\r\n/* Northward tooltips */\r\n.d3-tip.n:after {\r\n content: "\\25BC";\r\n margin: -1px 0 0 0;\r\n top: 100%;\r\n left: 0;\r\n text-align: center;\r\n}\r\n\r\n/* Eastward tooltips */\r\n.d3-tip.e:after {\r\n content: "\\25C0";\r\n margin: -4px 0 0 0;\r\n top: 50%;\r\n left: -8px;\r\n}\r\n\r\n/* Southward tooltips */\r\n.d3-tip.s:after {\r\n content: "\\25B2";\r\n margin: 0 0 1px 0;\r\n top: -8px;\r\n left: 0;\r\n text-align: center;\r\n}\r\n\r\n/* Westward tooltips */\r\n.d3-tip.w:after {\r\n content: "\\25B6";\r\n margin: -4px 0 0 -1px;\r\n top: 50%;\r\n left: 100%;\r\n}\r\n\r\n.d3-tip.notick:after {\r\n content: "" !important;\r\n}\r\n\r\n.common_Widget .over {\r\n stroke: rgba(0, 0, 0, 0.66);\r\n opacity: 0.66;\r\n}\r\n');var S=function(t){function n(){var n=t.call(this)||this;if(n.tooltip=function(){var t=function(){return"n"},n=function(){return[0,0]},o=function(){return" "},r=d(document.body),i=f(),l=null,a=null,s=null;function u(t){var e;e=t.node(),(l=e?"svg"===e.tagName.toLowerCase()?e:e.ownerSVGElement:null)&&(a=l.createSVGPoint(),r().appendChild(i))}u.show=function(){var e=Array.prototype.slice.call(arguments);e[e.length-1]instanceof SVGElement&&(s=e.pop());var i,l=o.apply(this,e),a=n.apply(this,e),f=t.apply(this,e),y=h(),d=p.length,g=document.documentElement.scrollTop||r().scrollTop,v=document.documentElement.scrollLeft||r().scrollLeft;for(y.html(l).style("opacity",1).style("pointer-events","all");d--;)y.classed(p[d],!1);return i=c.get(f).apply(this),y.classed(f,!0).style("top",i.top+a[0]+g+"px").style("left",i.left+a[1]+v+"px"),u},u.hide=function(){return h().style("opacity",0).style("pointer-events","none"),u},u.attr=function(t,n){if(arguments.length<2&&"string"==typeof t)return h().attr(t);var o=Array.prototype.slice.call(arguments);return e.selection.prototype.attr.apply(h(),o),u},u.style=function(t,n){if(arguments.length<2&&"string"==typeof t)return h().style(t);var o=Array.prototype.slice.call(arguments);return e.selection.prototype.style.apply(h(),o),u},u.direction=function(e){return arguments.length?(t=null==e?e:d(e),u):t},u.offset=function(t){return arguments.length?(n=null==t?t:d(t),u):n},u.html=function(t){return arguments.length?(o=null==t?t:d(t),u):o},u.rootElement=function(t){return arguments.length?(r=null==t?t:d(t),u):r},u.destroy=function(){return i&&(h().remove(),i=null),u};var c=k({n:function(){var t=y();return{top:t.n.y-i.offsetHeight,left:t.n.x-i.offsetWidth/2}},s:function(){var t=y();return{top:t.s.y,left:t.s.x-i.offsetWidth/2}},e:function(){var t=y();return{top:t.e.y-i.offsetHeight/2,left:t.e.x}},w:function(){var t=y();return{top:t.w.y-i.offsetHeight/2,left:t.w.x-i.offsetWidth}},nw:function(){var t=y();return{top:t.nw.y-i.offsetHeight,left:t.nw.x-i.offsetWidth}},ne:function(){var t=y();return{top:t.ne.y-i.offsetHeight,left:t.ne.x}},sw:function(){var t=y();return{top:t.sw.y,left:t.sw.x-i.offsetWidth}},se:function(){var t=y();return{top:t.se.y,left:t.se.x}}}),p=c.keys();function f(){var t=e.select(document.createElement("div"));return t.style("position","absolute").style("top",0).style("opacity",0).style("pointer-events","none").style("box-sizing","border-box"),t.node()}function h(){return null==i&&(i=f(),r().appendChild(i)),e.select(i)}function y(){for(var t=s||event.target;null==t.getScreenCTM&&null==t.parentNode;)t=t.parentNode;var e={},n=t.getScreenCTM(),o=t.getBBox(),r=o.width,i=o.height,l=o.x,u=o.y;return a.x=l,a.y=u,e.nw=a.matrixTransform(n),a.x+=r,e.ne=a.matrixTransform(n),a.y+=i,e.se=a.matrixTransform(n),a.x-=r,e.sw=a.matrixTransform(n),a.y-=i/2,e.w=a.matrixTransform(n),a.x+=r,e.e=a.matrixTransform(n),a.x-=r/2,a.y-=i/2,e.n=a.matrixTransform(n),a.y+=i,e.s=a.matrixTransform(n),e}function d(t){return"function"==typeof t?t:function(){return t}}return u}().attr("class","d3-tip"),n._valueFormatter=m(n.tooltipValueFormat()),n.layerEnter){var o=n.layerEnter;n.layerEnter=function(t,e,n){this.tooltipEnter(e),o.apply(this,arguments)};var r=n.layerUpdate;n.layerUpdate=function(t){r.apply(this,arguments),this.tooltipUpdate()};var i=n.layerExit;n.layerExit=function(t){i.apply(this,arguments),this.tooltipExit()}}else{var l=n.enter;n.enter=function(t,e){this.tooltipEnter(e),l.apply(this,arguments)};var a=n.update;n.update=function(t,e){a.apply(this,arguments),this.tooltipUpdate()};var s=n.exit;n.exit=function(t,e){s.apply(this,arguments),this.tooltipExit()}}return n}return l(n,t),n.prototype.tooltipEnter=function(t){t.call(this.tooltip)},n.prototype.tooltipUpdate=function(){var t=this;this.tooltip.offset(function(){switch(t.tooltip.direction()()){case"e":return[0,t.tooltipOffset()];default:return[-t.tooltipOffset(),0]}});var e=this.tooltip.attr("class");e&&(e=e.split(" notick").join("")+(this.tooltipTick()?"":" notick")+("none"===this.tooltipStyle()?" hidden":""),this.tooltip.attr("class",e))},n.prototype.tooltipExit=function(){this.tooltip&&this.tooltip.destroy()},n.prototype._tooltipHTML=function(t){return t},n.prototype.tooltipHTML=function(t){return this.tooltip.html(t)},n.prototype.tooltipFormat=function(t){switch((t=t||{}).label=void 0===t.label?"":t.label,t.series=t.series||"",t.value instanceof Date?t.value=t.value||"":t.value=this._valueFormatter(t.value)||"",this.tooltipStyle()){case"none":break;default:return t.series?"<span style='color:"+this.tooltipSeriesColor()+"'>"+t.series+"</span> / <span style='color:"+this.tooltipLabelColor()+"'>"+t.label+"</span>: <span style='color:"+this.tooltipValueColor()+"'>"+t.value+"</span>":"<span style='color:"+this.tooltipLabelColor()+"'>"+t.label+"</span>: <span style='color:"+this.tooltipValueColor()+"'>"+t.value+"</span>"}},n}(e.Widget);S.prototype.publish("tooltipStyle","default","set","Style",["default","none"],{}),S.prototype.publish("tooltipValueFormat",",.2f","string","Value Format",null,{}),S.prototype.publish("tooltipSeriesColor","#EAFFFF","html-color","Series Color",null,{}),S.prototype.publish("tooltipLabelColor","#CCFFFF","html-color","Label Color",null,{}),S.prototype.publish("tooltipValueColor","white","html-color","Value Color",null,{}),S.prototype.publish("tooltipTick",!0,"boolean","Show tooltip tick",null,{}),S.prototype.publish("tooltipOffset",8,"number","Offset from the cursor",null,{});var M=S.prototype.tooltipValueFormat;S.prototype.tooltipValueFormat=function(t){var e=M.apply(this,arguments);return arguments.length&&(this._valueFormatter=m(t)),e};var _=function(){function t(){}return t.prototype.click=function(t,e,n){console.log("Click: "+JSON.stringify(t)+", "+e+", "+n)},t.prototype.dblclick=function(t,e,n){console.log("Double click: "+JSON.stringify(t)+", "+e+", "+n)},t}();_.prototype._palette=e.Palette.ordinal("default"),t.I1DChart=n,t.I2DChart=o,t.IGraph=r,t.instanceOfIHighlight=function(t){return"function"==typeof t.highlightColumn},t.IInput=a,t.INDChart=s,t.ITooltip=S,t.ITree=_,Object.defineProperty(t,"__esModule",{value:!0})}); |
{ | ||
"name": "@hpcc-js/api", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "hpcc-js - Viz api", | ||
@@ -28,3 +28,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@hpcc-js/common": "^0.2.0" | ||
"@hpcc-js/common": "^0.2.1" | ||
}, | ||
@@ -31,0 +31,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
280607
2012
Updated@hpcc-js/common@^0.2.1