vega-selections
Advanced tools
Comparing version 5.0.0 to 5.0.1
@@ -214,7 +214,9 @@ (function (global, factory) { | ||
if (op === Intersect && !params.hasOwnProperty(indexName)) { | ||
// eslint-disable-next-line no-prototype-builtins | ||
if (op === Intersect && !vegaUtil.hasOwnProperty(params, indexName)) { | ||
params[indexName] = scope.getData(data).indataRef(scope, field); | ||
} | ||
if (!params.hasOwnProperty(dataName)) { | ||
// eslint-disable-next-line no-prototype-builtins | ||
if (!vegaUtil.hasOwnProperty(params, dataName)) { | ||
params[dataName] = scope.getData(data).tuplesRef(); | ||
@@ -224,4 +226,4 @@ } | ||
exports.selectionResolve = selectionResolve; | ||
exports.selectionTest = selectionTest; | ||
exports.selectionResolve = selectionResolve; | ||
exports.selectionVisitor = selectionVisitor; | ||
@@ -228,0 +230,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-util"),require("vega-expression")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega-expression"],t):t((e=e||self).vega={},e.vega,e.vega)}(this,function(e,t,n){"use strict";const r="intersect",i="union";var u="E",o="R",f="R-E",a="R-LE",s="R-RE",l="index:unit";function c(e,n){for(var r,i,l=n.fields,c=n.values,g=l.length,v=0;v<g;++v)if((i=l[v]).getter=t.field.getter||t.field(i.field),r=i.getter(e),t.isDate(r)&&(r=t.toNumber(r)),t.isDate(c[v])&&(c[v]=t.toNumber(c[v])),t.isDate(c[v][0])&&(c[v]=c[v].map(t.toNumber)),i.type===u){if(t.isArray(c[v])?c[v].indexOf(r)<0:r!==c[v])return!1}else if(i.type===o){if(!t.inrange(r,c[v]))return!1}else if(i.type===s){if(!t.inrange(r,c[v],!0,!1))return!1}else if(i.type===f){if(!t.inrange(r,c[v],!1,!1))return!1}else if(i.type===a&&!t.inrange(r,c[v],!1,!0))return!1;return!0}var g={E_union:function(e,t){if(!e.length)return t;for(var n=0,r=t.length;n<r;++n)e.indexOf(t[n])<0&&e.push(t[n]);return e},E_intersect:function(e,t){return e.length?e.filter(function(e){return t.indexOf(e)>=0}):t},R_union:function(e,n){var r=t.toNumber(n[0]),i=t.toNumber(n[1]);return r>i&&(r=n[1],i=n[0]),e.length?(e[0]>r&&(e[0]=r),e[1]<i&&(e[1]=i),e):[r,i]},R_intersect:function(e,n){var r=t.toNumber(n[0]),i=t.toNumber(n[1]);return r>i&&(r=n[1],i=n[0]),e.length?i<e[0]||e[1]<r?[]:(e[0]<r&&(e[0]=r),e[1]>i&&(e[1]=i),e):[r,i]}};const v=":",d="@";e.selectionTest=function(e,t,n){for(var i,u,o,f,a,s=this.context.data[e],g=s?s.values.value:[],v=s?s[l]&&s[l].value:void 0,d=n===r,p=g.length,h=0;h<p;++h)if(i=g[h],v&&d){if(-1===(o=(u=u||{})[f=i.unit]||0))continue;if(a=c(t,i),u[f]=a?-1:++o,a&&1===v.size)return!0;if(!a&&o===v.get(f).count)return!1}else if(d^(a=c(t,i)))return a;return p&&d},e.selectionResolve=function(e,n){for(var r,u,o,f,a,s,l,c,v,d,p,h=this.context.data[e],y=h?h.values.value:[],m={},b={},x=y.length,R=0;R<x;++R)for(f=(r=y[R]).unit,u=r.fields,o=r.values,d=0,p=u.length;d<p;++d)a=u[d],l=(s=m[a.field]||(m[a.field]={}))[f]||(s[f]=[]),b[a.field]=c=a.type.charAt(0),v=g[c+"_union"],s[f]=v(l,t.array(o[d]));return n=n||i,Object.keys(m).forEach(function(e){m[e]=Object.keys(m[e]).map(function(t){return m[e][t]}).reduce(function(t,r){return void 0===t?r:g[b[e]+"_"+n](t,r)})}),m},e.selectionVisitor=function(e,i,u,o){i[0].type!==n.Literal&&t.error("First argument to selection functions must be a string literal.");const f=i[0].value,a=i.length>=2&&t.peek(i).value,s=d+"unit",l=v+f;a!==r||o.hasOwnProperty(s)||(o[s]=u.getData(f).indataRef(u,"unit")),o.hasOwnProperty(l)||(o[l]=u.getData(f).tuplesRef())},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-util"),require("vega-expression")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega-expression"],t):t((e=e||self).vega={},e.vega,e.vega)}(this,function(e,t,n){"use strict";const r="intersect",i="union";var u="E",o="R",f="R-E",a="R-LE",s="R-RE",l="index:unit";function c(e,n){for(var r,i,l=n.fields,c=n.values,g=l.length,v=0;v<g;++v)if((i=l[v]).getter=t.field.getter||t.field(i.field),r=i.getter(e),t.isDate(r)&&(r=t.toNumber(r)),t.isDate(c[v])&&(c[v]=t.toNumber(c[v])),t.isDate(c[v][0])&&(c[v]=c[v].map(t.toNumber)),i.type===u){if(t.isArray(c[v])?c[v].indexOf(r)<0:r!==c[v])return!1}else if(i.type===o){if(!t.inrange(r,c[v]))return!1}else if(i.type===s){if(!t.inrange(r,c[v],!0,!1))return!1}else if(i.type===f){if(!t.inrange(r,c[v],!1,!1))return!1}else if(i.type===a&&!t.inrange(r,c[v],!1,!0))return!1;return!0}var g={E_union:function(e,t){if(!e.length)return t;for(var n=0,r=t.length;n<r;++n)e.indexOf(t[n])<0&&e.push(t[n]);return e},E_intersect:function(e,t){return e.length?e.filter(function(e){return t.indexOf(e)>=0}):t},R_union:function(e,n){var r=t.toNumber(n[0]),i=t.toNumber(n[1]);return r>i&&(r=n[1],i=n[0]),e.length?(e[0]>r&&(e[0]=r),e[1]<i&&(e[1]=i),e):[r,i]},R_intersect:function(e,n){var r=t.toNumber(n[0]),i=t.toNumber(n[1]);return r>i&&(r=n[1],i=n[0]),e.length?i<e[0]||e[1]<r?[]:(e[0]<r&&(e[0]=r),e[1]>i&&(e[1]=i),e):[r,i]}};const v=":",d="@";e.selectionResolve=function(e,n){for(var r,u,o,f,a,s,l,c,v,d,p,h=this.context.data[e],y=h?h.values.value:[],m={},b={},x=y.length,R=0;R<x;++R)for(f=(r=y[R]).unit,u=r.fields,o=r.values,d=0,p=u.length;d<p;++d)a=u[d],l=(s=m[a.field]||(m[a.field]={}))[f]||(s[f]=[]),b[a.field]=c=a.type.charAt(0),v=g[c+"_union"],s[f]=v(l,t.array(o[d]));return n=n||i,Object.keys(m).forEach(function(e){m[e]=Object.keys(m[e]).map(function(t){return m[e][t]}).reduce(function(t,r){return void 0===t?r:g[b[e]+"_"+n](t,r)})}),m},e.selectionTest=function(e,t,n){for(var i,u,o,f,a,s=this.context.data[e],g=s?s.values.value:[],v=s?s[l]&&s[l].value:void 0,d=n===r,p=g.length,h=0;h<p;++h)if(i=g[h],v&&d){if(-1===(o=(u=u||{})[f=i.unit]||0))continue;if(a=c(t,i),u[f]=a?-1:++o,a&&1===v.size)return!0;if(!a&&o===v.get(f).count)return!1}else if(d^(a=c(t,i)))return a;return p&&d},e.selectionVisitor=function(e,i,u,o){i[0].type!==n.Literal&&t.error("First argument to selection functions must be a string literal.");const f=i[0].value,a=i.length>=2&&t.peek(i).value,s=d+"unit",l=v+f;a!==r||t.hasOwnProperty(o,s)||(o[s]=u.getData(f).indataRef(u,"unit")),t.hasOwnProperty(o,l)||(o[l]=u.getData(f).tuplesRef())},Object.defineProperty(e,"__esModule",{value:!0})}); |
{ | ||
"name": "vega-selections", | ||
"version": "5.0.0", | ||
"version": "5.0.1", | ||
"description": "Vega expression functions for Vega-Lite selections.", | ||
@@ -13,3 +13,3 @@ "keywords": [ | ||
"main": "build/vega-selections.js", | ||
"module": "index.js", | ||
"module": "index", | ||
"repository": "vega/vega", | ||
@@ -27,5 +27,6 @@ "scripts": { | ||
"dependencies": { | ||
"vega-expression": "^2.5.0", | ||
"vega-util": "^1.8.0" | ||
} | ||
"vega-expression": "^2.6.1", | ||
"vega-util": "^1.11.0" | ||
}, | ||
"gitHead": "b45fc90406ce2de167073b73d4ae5cf79c5e1705" | ||
} |
import {Intersect} from './constants'; | ||
import {Literal} from 'vega-expression'; | ||
import {error, peek} from 'vega-util'; | ||
import {error, hasOwnProperty, peek} from 'vega-util'; | ||
@@ -17,9 +17,11 @@ const DataPrefix = ':', | ||
if (op === Intersect && !params.hasOwnProperty(indexName)) { | ||
// eslint-disable-next-line no-prototype-builtins | ||
if (op === Intersect && !hasOwnProperty(params, indexName)) { | ||
params[indexName] = scope.getData(data).indataRef(scope, field); | ||
} | ||
if (!params.hasOwnProperty(dataName)) { | ||
// eslint-disable-next-line no-prototype-builtins | ||
if (!hasOwnProperty(params, dataName)) { | ||
params[dataName] = scope.getData(data).tuplesRef(); | ||
} | ||
} |
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
21090
390
Updatedvega-expression@^2.6.1
Updatedvega-util@^1.11.0