How to use the @hpcc-js/common.HTMLWidget.prototype function in @hpcc-js/common

To help you get started, we’ve selected a few @hpcc-js/common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hpcc-systems / Visualization / packages / google / src / Common.ts View on Github external
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);
        }
    }
github hpcc-systems / Visualization / packages / layout / src / Toolbar.ts View on Github external
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)
github hpcc-systems / Visualization / packages / layout / src / Toolbar.ts View on Github external
Toolbar.prototype.exit = function (domNode, element) {
    HTMLWidget.prototype.exit.apply(this, arguments);
    this.widgets().forEach(function (w) {
        w.target(null);
    });
};
github hpcc-systems / Visualization / packages / layout / src / Toolbar.ts View on Github external
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);
        }
    });
github hpcc-systems / Visualization / packages / amchart / src / CommonFunnel.ts View on Github external
data(_?) {
        if (arguments.length) {
            this._dataUpdated++;
        }
        return HTMLWidget.prototype.data.apply(this, arguments);
    }
github hpcc-systems / Visualization / packages / tree / src / Treemap.ts View on Github external
enter(_domNode, element) {
        HTMLWidget.prototype.enter.apply(this, arguments);
        this._d3Treemap = d3Treemap();

        this._elementDIV = element.append("div");
        this._selection.widgetElement(this._elementDIV);
    }
github hpcc-systems / Visualization / packages / handson / src / Table.ts View on Github external
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;
github hpcc-systems / Visualization / packages / map / src / GMap.ts View on Github external
data(_?) {
        const retVal = HTMLWidget.prototype.data.apply(this, arguments);
        return retVal;
    }
github hpcc-systems / Visualization / packages / amchart / src / CommonFunnel.ts View on Github external
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();
    }
github hpcc-systems / Visualization / packages / form / src / Input.ts View on Github external
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;