Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const values = items.map(d => utils.clone(d, attr)); // pick attrs
uniq = utils.unique(values, n => JSON.stringify(n));
getDefaultPalette() {
const conceptpropsColor = this.getConceptprops().color;
let palette;
this.discreteDefaultPalette = false;
if (conceptpropsColor && conceptpropsColor.palette) {
//specific color palette from hook concept properties
palette = utils.clone(conceptpropsColor.palette);
} else if (defaultPalettes[this.which]) {
//color palette for this.which exists in palette defaults
palette = utils.clone(defaultPalettes[this.which]);
} else if (this.use === "constant") {
//an explicit hex color constant #abc or #adcdef is provided
if (/^#([0-9a-f]{3}|[0-9a-f]{6})$/.test(this.which)) {
palette = { "_default": this.which };
} else {
palette = utils.clone(defaultPalettes["_default"]);
}
} else {
palette = utils.clone(defaultPalettes[this.isDiscrete() ? "_discrete" : "_continuous"]);
this.discreteDefaultPalette = true;
}
return palette;
},
let palette;
this.discreteDefaultPalette = false;
if (conceptpropsColor && conceptpropsColor.palette) {
//specific color palette from hook concept properties
palette = utils.clone(conceptpropsColor.palette);
} else if (defaultPalettes[this.which]) {
//color palette for this.which exists in palette defaults
palette = utils.clone(defaultPalettes[this.which]);
} else if (this.use === "constant") {
//an explicit hex color constant #abc or #adcdef is provided
if (/^#([0-9a-f]{3}|[0-9a-f]{6})$/.test(this.which)) {
palette = { "_default": this.which };
} else {
palette = utils.clone(defaultPalettes["_default"]);
}
} else {
palette = utils.clone(defaultPalettes[this.isDiscrete() ? "_discrete" : "_continuous"]);
this.discreteDefaultPalette = true;
}
return palette;
},
function parse(res) {
var data = res;
//rename geo.category to geo.cat
var where = query.where;
if (where['geo.category']) {
where['geo.cat'] = utils.clone(where['geo.category']);
delete where['geo.category'];
}
//format values in the dataset and filters
where = utils.mapRows([where], _this._parsers)[0];
//make sure conditions don't contain invalid conditions
var validConditions = [];
utils.forEach(where, function (v, p) {
for (var i = 0, s = data.length; i < s; i++) {
if (data[i].hasOwnProperty(p)) {
validConditions.push(p);
return true;
}
}
});
_addButtons(button_list, button_expand) {
const _this = this;
this._components_config = [];
const details_btns = [];
if (!button_list.length) return;
//add a component for each button
for (let i = 0; i < button_list.length; i++) {
const btn = button_list[i];
const btn_config = this._available_buttons[btn];
//add template data
const d = (btn_config) ? btn : "_default";
const details_btn = utils.clone(this._available_buttons[d]);
details_btn.id = btn;
details_btn.icon = iconset[details_btn.icon];
details_btns.push(details_btn);
}
const t = this.getTranslationFunction(true);
this.element.selectAll("button").data(details_btns)
.enter().append("button")
.attr("class", d => {
let cls = "vzb-buttonlist-btn";
if (button_expand.length > 0) {
if (button_expand.indexOf(d.id) > -1) {
cls += " vzb-dialog-side-btn";
}
const skipCrownInnerFill = !d.trailStartTime || d.trailStartTime == _this.model.time.formatDate(_this.time);
_this._setBubbleCrown(x, y, s, c, skipCrownInnerFill);
}
if (!entityOutOfView && !hoverTrail) {
_this._axisProjections(d);
}
//set tooltip and show axis projections
if (text && !entityOutOfView && !hoverTrail) {
_this._setTooltip(text, x, y, s + 3, c);
}
const selectedData = utils.find(_this.model.marker.select, f => f[KEY] == d[KEY]);
if (selectedData) {
const clonedSelectedData = utils.clone(selectedData);
//change opacity to OPACITY_HIGHLT = 1.0;
clonedSelectedData.opacity = 1.0;
_this._trails.run(["opacityHandler"], clonedSelectedData);
}
});
} else {
const select = _this.model.marker.select.map(d => {
const p = utils.clone(d, KEYS);
p[KEY] = utils.getKey(d, KEYS);
return p;
});
this.entityLabels = this.labelsContainer.selectAll("." + _cssPrefix + "-entity")
this._components_config = this.components.map(x => utils.clone(x));
var values = items.map(function(d) {
return utils.clone(d, attr); //pick attrs
});
uniq = utils.unique(values, function(n) {
data = data.map(function(row) {
return utils.clone(row, query.select);
});