Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
update(domNode, element) {
HTMLWidget.prototype.update.apply(this, arguments);
if (this.data().length && this.columns().length) {
this.init(domNode, element);
this._chart.draw(this.formatData(), this.getChartOptions());
} else {
this.kill(domNode, element);
}
}
Toolbar.prototype.update = function (domNode, element) {
HTMLWidget.prototype.update.apply(this, arguments);
const context = this;
element
.attr("title", context.title())
.style("background-color", this.backgroundColor())
;
const title = element.selectAll("div.toolbar-title")
.data(this.title() ? [this.title()] : []);
title.enter().append("div")
.classed("toolbar-title", true)
.append("span")
;
title.selectAll("div.toolbar-title > span")
.style("font-size", this.fontSize_exists() ? this.fontSize() + "px" : null)
.style("color", this.fontColor_exists() ? this.fontColor() : null)
Toolbar.prototype.exit = function (domNode, element) {
HTMLWidget.prototype.exit.apply(this, arguments);
this.widgets().forEach(function (w) {
w.target(null);
});
};
Toolbar.prototype.render = function (callback) {
const context = this;
HTMLWidget.prototype.render.call(this, function (w) {
const toolbarBBox = context.element().node().getBoundingClientRect();
let minX = toolbarBBox.left + toolbarBBox.width;
context.element().selectAll("div.toolbar-child")
.each(function (d, i) {
const childBBox = this.getBoundingClientRect();
if (minX > childBBox.left)
minX = childBBox.left;
})
;
context.element().select(".toolbar-title")
.style("width", (minX - toolbarBBox.left - 4) + "px")
;
if (callback) {
callback(w);
}
});
data(_?) {
if (arguments.length) {
this._dataUpdated++;
}
return HTMLWidget.prototype.data.apply(this, arguments);
}
enter(_domNode, element) {
HTMLWidget.prototype.enter.apply(this, arguments);
this._d3Treemap = d3Treemap();
this._elementDIV = element.append("div");
this._selection.widgetElement(this._elementDIV);
}
update(domNode, element) {
HTMLWidget.prototype.update.apply(this, arguments);
const context = this;
const settings: any = {};
settings.colHeaders = context.columns();
settings.columns = this.fields().map(function (field) {
return {
sortFunction: (sortOrder) => {
return function (a, b) {
const l = sortOrder ? field.parse(a[1]) : field.parse(b[1]);
const r = sortOrder ? field.parse(b[1]) : field.parse(a[1]);
if (l === r) {
return 0;
}
if (l < r) {
return -1;
}
return 1;
data(_?) {
const retVal = HTMLWidget.prototype.data.apply(this, arguments);
return retVal;
}
update(domNode, element) {
HTMLWidget.prototype.update.apply(this, arguments);
domNode.style.width = this.size().width + "px";
domNode.style.height = this.size().height + "px";
this._palette = this._palette.switch(this.paletteID());
if (this.useClonedPalette()) {
this._palette = this._palette.cloneNotExists(this.paletteID() + "_" + this.id());
}
this.updateChartOptions();
this._chart.validateNow();
this._chart.validateData();
}
update(domNode, element) {
HTMLWidget.prototype.update.apply(this, arguments);
this._labelElement[0]
.style("visibility", this.inlineLabel_exists() ? "visible" : "hidden")
.text(this.inlineLabel())
;
switch (this.type()) {
case "button":
this._inputElement[0].text(this.value());
break;
case "textarea":
this._inputElement[0].property("value", this.value());
break;
default:
this._inputElement[0].attr("type", this.type());
this._inputElement[0].property("value", this.value());
break;