How to use the @hpcc-js/util.compare function in @hpcc-js/util

To help you get started, we’ve selected a few @hpcc-js/util 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 / marshaller / src / ddl2 / dashboardDockPanel.ts View on Github external
syncWidgets() {
        const prevWidgets = this.widgets();
        const diffWidgets = compare(prevWidgets, this._ec.elements().filter(e => e.visualization().visibility() === "normal").map(viz => viz.visualization().chartPanel()));

        let refit = false;
        for (const w of diffWidgets.removed) {
            this.removeWidget(w);
        }

        for (const w of diffWidgets.added) {
            const element: Element = this._ec.element(w);
            this.addWidget(w, this.tabTitle(element), "split-bottom", undefined, this.hideSingleTabs() ? undefined : this);
            refit = this.syncMinSize(w) || refit;  // ensure syncMinSize is called
        }

        for (const w of diffWidgets.unchanged) {
            this.updateTitle(w);
            refit = this.syncMinSize(w) || refit;  // ensure syncMinSize is called
        }
github hpcc-systems / Visualization / packages / marshaller / src / ddl2 / dashboardGrid.ts View on Github external
syncWidgets() {
        const prevWidgets = this.widgets();
        const diffWidgets = compare(prevWidgets, this._ec.elements().filter(e => e.visualization().visibility() === "normal").map(viz => viz.visualization().chartPanel()));

        for (const w of diffWidgets.removed) {
            this.removeWidget(w);
        }
        let maxX = 0;
        let maxY = 0;
        const no_layout_added = [];
        for (const widget of diffWidgets.added) {
            const element: Element = this._ec.element(widget);
            const i = this.content().length;
            if (this._layoutCache && this._layoutCache[i]) {
                const layout = (this._layoutCache as any).find(n => n.id === widget._id);
                if (layout) {
                    const [x, y, w, h] = layout.position;
                    this.setContent(y, x, element.visualization().chartPanel(), "", h, w);
                    if (x + w > maxX) maxX = x + w;
github hpcc-systems / Visualization / packages / marshaller / src / ddl2 / PopupManager.ts View on Github external
syncPopups() {
        const prevPopups = this.popupChartPanels();
        const diffPopups = compare(prevPopups, this._ec.elements()
            .filter(e => e.visualization().visibility() === "flyout")
            .map((elem: any) => elem.visualization().chartPanel()))
            ;

        for (const w of diffPopups.removed) {
            this.removePopup(w);
        }

        for (const w of diffPopups.added) {
            this.addPopup(w);
        }

        this._popups.forEach(p => p.render());

        return this;
    }