@vizabi/core
Advanced tools
Comparing version 1.29.1 to 1.31.0
@@ -1,2 +0,2 @@ | ||
// http://vizabi.org v1.29.1 Copyright 2023 Jasper Heeffer and others at Gapminder Foundation | ||
// http://vizabi.org v1.31.0 Copyright 2023 Jasper Heeffer and others at Gapminder Foundation | ||
(function (global, factory) { | ||
@@ -3,0 +3,0 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('mobx'), require('d3')) : |
{ | ||
"name": "@vizabi/core", | ||
"version": "1.29.1", | ||
"version": "1.31.0", | ||
"description": "Vizabi core (data layer)", | ||
@@ -5,0 +5,0 @@ "main": "dist/Vizabi.js", |
@@ -182,3 +182,3 @@ import { fromPromise } from 'mobx-utils' | ||
return { concept, name: concept } | ||
if (!this.concepts.has({ concept })) | ||
if (this.concepts.size && !this.concepts.has({ concept })) | ||
console.warn("Could not find concept " + concept + " in data source ", this); | ||
@@ -185,0 +185,0 @@ return this.concepts.get({ concept }) || {}; |
@@ -9,2 +9,3 @@ import { createStore } from '../genericStore' | ||
import { aggregate } from './aggregate' | ||
import { lane } from './lane' | ||
@@ -17,3 +18,4 @@ export const encodingStore = createStore(encoding, { | ||
repeat, | ||
aggregate | ||
aggregate, | ||
lane | ||
}); |
@@ -112,3 +112,3 @@ import { action, isObservableArray, observable, toJS, trace } from 'mobx'; | ||
}), | ||
addToDimensionsFirstINstatement: action("deleteInDimensions", function(markerItem, path) { | ||
addToDimensionsFirstINstatement: action("addInDimensions", function(markerItem, path) { | ||
if (Array.isArray(markerItem)) { | ||
@@ -149,3 +149,3 @@ for (const el of markerItem) this.addToDimensionsFirstINstatement(el) | ||
}), | ||
deleteFromDimensionsAllINstatements: action("deleteInDimensions", function(markerItem, statement = "$in") { | ||
deleteFromDimensionsFirstINstatement: action("deleteInDimensions", function(markerItem, path ) { | ||
if (Array.isArray(markerItem)) { | ||
@@ -166,2 +166,37 @@ for (const el of markerItem) this.deleteFromDimensionsAllINstatements(el) | ||
function findAndRemoveInObject(obj, item, key) { | ||
if (key === "$in") | ||
findAndRemoveInArray(obj, item); | ||
else if (Array.isArray(obj)) | ||
obj.forEach( d => findAndRemoveInObject(d, item) ); | ||
else if (typeof obj === "object") | ||
for (const objKey in obj) findAndRemoveInObject(obj[objKey], item, objKey); | ||
} | ||
if (path) { | ||
const inArray = path.reduce((a, p)=>{ | ||
if (a[p] == null) a[p] = ["$in", "$or", "$and", "$nin"].includes(p) ? [] : {}; | ||
return a[p]; | ||
}, cfg); | ||
findAndRemoveInArray(inArray, item); | ||
} else { | ||
findAndRemoveInObject(cfg, item); | ||
} | ||
cleanEmptyObjectsAndArrays(cfg); | ||
}), | ||
deleteFromDimensionsAllINstatements: action("deleteAllInDimensions", function(markerItem, statement = "$in") { | ||
if (Array.isArray(markerItem)) { | ||
for (const el of markerItem) this.deleteFromDimensionsAllINstatements(el) | ||
return; | ||
} | ||
const cfg = this.config.dimensions; | ||
const item = this.getKey(markerItem); | ||
//traverse object in search of an array containing markerItem | ||
function findAndRemoveInArray(array, item){ | ||
const index = array.indexOf(item); | ||
if (index !== -1) array.splice(index, 1); | ||
} | ||
function findAndRemoveInObject(obj, item, key) { | ||
if (key === statement) | ||
@@ -168,0 +203,0 @@ findAndRemoveInArray(obj, item); |
@@ -30,2 +30,4 @@ import { trace, computed, observable, toJS, autorun } from 'mobx'; | ||
"orderFacets.order", | ||
"x.addTrack", | ||
"y.addTrack", | ||
"trail.addTrails", // after ordering so trails stay together | ||
@@ -32,0 +34,0 @@ "frame.currentFrame" // final to make it quick |
@@ -25,3 +25,4 @@ import { createModel, isNumeric, parseConfigValue, sortDateSafe } from "../utils"; | ||
"band": d3_scaleBand, | ||
"time": d3_scaleUtc | ||
"time": d3_scaleUtc, | ||
"rank": d3_scaleLinear | ||
} | ||
@@ -145,2 +146,4 @@ | ||
domain = this.parent.marker.encoding.frame.scale.domain; | ||
} else if (this.config.type == "rank" ) { | ||
domain = [0, this.parent.totalTrackNumber]; | ||
} else if (this.data.domain) { | ||
@@ -147,0 +150,0 @@ domain = this.data.domain; |
Sorry, the diff of this file is too big to display
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
1337149
67
13867