@vizabi/core
Advanced tools
Comparing version 1.26.1 to 1.26.2
@@ -1,2 +0,2 @@ | ||
// http://vizabi.org v1.26.1 Copyright 2022 Jasper Heeffer and others at Gapminder Foundation | ||
// http://vizabi.org v1.26.2 Copyright 2022 Jasper Heeffer and others at Gapminder Foundation | ||
(function (global, factory) { | ||
@@ -1140,7 +1140,7 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('mobx')) : | ||
function interpolateGroup(group, { fields = group.fields, interpolators = {}, ammendNewRow = () => {} } = {}) { | ||
function interpolateGroup(group, { fields = group.fields, frameField = "", frameCopyFields = [], interpolators = {}, ammendNewRow = () => {} } = {}) { | ||
// what fields to interpolate? | ||
const groupFields = group.values().next().value.fields; | ||
const copyFields = relativeComplement(fields, groupFields); | ||
const copyFields = relativeComplement(fields, groupFields).filter(f => !frameCopyFields.includes(f)); | ||
copyFields.push(Symbol.for('key')); | ||
@@ -1166,2 +1166,3 @@ | ||
gapRow = Object.assign(pickGetters(marker, copyFields), group.keyObject(gapFrame)); | ||
for (let frameCopyField of frameCopyFields) gapRow[frameCopyField] = gapRow[frameField]; | ||
ammendNewRow(gapRow); | ||
@@ -1168,0 +1169,0 @@ gapRow[Symbol.for('interpolated')] = {}; |
{ | ||
"name": "@vizabi/core", | ||
"version": "1.26.1", | ||
"version": "1.26.2", | ||
"description": "Vizabi core (data layer)", | ||
@@ -5,0 +5,0 @@ "main": "dist/Vizabi.js", |
@@ -241,7 +241,15 @@ import { encoding } from './encoding'; | ||
fields: this.changeBetweenFramesEncodings, | ||
interpolators: this.fieldCustomInterpolators, | ||
ammendNewRow: row => row[this.data.concept] = row[encName] | ||
frameField: encName, | ||
frameCopyFields: this.encodingsThatCopyFrame.concat(this.data.concept), | ||
interpolators: this.fieldCustomInterpolators | ||
}); | ||
}, | ||
get encodingsThatCopyFrame() { | ||
const enc = this.marker.encoding; | ||
return Object.keys(enc).filter(prop => | ||
enc[prop] != this | ||
&& enc[prop].data.concept === this.data.concept | ||
&& enc[prop].data.space.includes(this.data.concept) | ||
); | ||
}, | ||
get changeBetweenFramesEncodings() { | ||
@@ -323,3 +331,3 @@ const enc = this.marker.encoding; | ||
get fieldsToInterpolate() { | ||
return [this.name, this.data.concept, ...this.changeBetweenFramesEncodings]; | ||
return [this.name, this.data.concept, ...this.changeBetweenFramesEncodings, ...this.encodingsThatCopyFrame]; | ||
}, | ||
@@ -459,3 +467,4 @@ getInterpolatedFrame(df, step, stepsAround) { | ||
frame.decorate = { | ||
changeBetweenFramesEncodings: computed.struct | ||
changeBetweenFramesEncodings: computed.struct, | ||
encodingsThatCopyFrame: computed.struct | ||
} | ||
@@ -462,0 +471,0 @@ |
@@ -60,7 +60,7 @@ import { assign, pickGetters, relativeComplement } from "../../core/utils"; | ||
export function interpolateGroup(group, { fields = group.fields, interpolators = {}, ammendNewRow = () => {} } = {}) { | ||
export function interpolateGroup(group, { fields = group.fields, frameField = "", frameCopyFields = [], interpolators = {}, ammendNewRow = () => {} } = {}) { | ||
// what fields to interpolate? | ||
const groupFields = group.values().next().value.fields; | ||
const copyFields = relativeComplement(fields, groupFields); | ||
const copyFields = relativeComplement(fields, groupFields).filter(f => !frameCopyFields.includes(f)); | ||
copyFields.push(Symbol.for('key')); | ||
@@ -86,2 +86,3 @@ | ||
gapRow = Object.assign(pickGetters(marker, copyFields), group.keyObject(gapFrame)); | ||
for (let frameCopyField of frameCopyFields) gapRow[frameCopyField] = gapRow[frameField]; | ||
ammendNewRow(gapRow); | ||
@@ -88,0 +89,0 @@ gapRow[Symbol.for('interpolated')] = {}; |
Sorry, the diff of this file is not supported yet
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
1299680
13484