@hpcc-js/marshaller 2.28.7 → 2.28.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +43 -43
- package/dist/index.es6.js +25 -13
- package/dist/index.es6.js.map +1 -1
- package/dist/index.js +25 -13
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/package.json +12 -12
- package/src/__package__.ts +3 -3
- package/src/dashy.css +239 -239
- package/src/dashy.ts +521 -521
- package/src/ddl1/DDLApi.ts +229 -229
- package/src/ddl1/FlyoutButton.ts +120 -120
- package/src/ddl1/Graph.ts +93 -93
- package/src/ddl1/HTML.ts +77 -77
- package/src/ddl1/HipieDDL.ts +2437 -2437
- package/src/ddl1/HipieDDLMixin.ts +380 -380
- package/src/ddl1/Tabbed.ts +91 -91
- package/src/ddl1/TargetMarshaller.ts +57 -57
- package/src/ddl2/PopupManager.ts +89 -89
- package/src/ddl2/activities/activity.ts +431 -431
- package/src/ddl2/activities/databomb.ts +237 -237
- package/src/ddl2/activities/datasource.ts +52 -52
- package/src/ddl2/activities/dspicker.ts +106 -106
- package/src/ddl2/activities/filter.ts +542 -542
- package/src/ddl2/activities/form.ts +153 -153
- package/src/ddl2/activities/groupby.ts +439 -439
- package/src/ddl2/activities/hipiepipeline.ts +114 -114
- package/src/ddl2/activities/limit.ts +49 -49
- package/src/ddl2/activities/logicalfile.ts +62 -62
- package/src/ddl2/activities/nullview.ts +12 -12
- package/src/ddl2/activities/project.ts +764 -764
- package/src/ddl2/activities/rest.ts +568 -568
- package/src/ddl2/activities/roxie.ts +490 -490
- package/src/ddl2/activities/sampledata.json +16264 -16264
- package/src/ddl2/activities/sort.ts +176 -176
- package/src/ddl2/activities/wuresult.ts +395 -395
- package/src/ddl2/dashboard.css +13 -13
- package/src/ddl2/dashboard.ts +330 -330
- package/src/ddl2/dashboardDockPanel.ts +123 -123
- package/src/ddl2/dashboardGrid.ts +202 -202
- package/src/ddl2/ddl.ts +410 -410
- package/src/ddl2/ddleditor.ts +60 -60
- package/src/ddl2/dsTable.ts +238 -238
- package/src/ddl2/dvTable.ts +31 -31
- package/src/ddl2/graphadapter.ts +297 -297
- package/src/ddl2/javascriptadapter.ts +354 -354
- package/src/ddl2/model/element.ts +398 -398
- package/src/ddl2/model/visualization.ts +351 -351
- package/src/ddl2/model/vizChartPanel.ts +149 -149
- package/src/ddl2/pipelinePanel.css +4 -4
- package/src/ddl2/pipelinePanel.ts +465 -465
- package/src/index.ts +26 -26
- package/types/__package__.d.ts +2 -2
- package/types-3.4/__package__.d.ts +2 -2
package/src/ddl1/Tabbed.ts
CHANGED
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
import { Grid, Tabbed as TabbedLayout } from "@hpcc-js/layout";
|
|
2
|
-
import { HipieDDLMixin } from "./HipieDDLMixin";
|
|
3
|
-
|
|
4
|
-
export class Tabbed extends TabbedLayout {
|
|
5
|
-
_ddlDashboards;
|
|
6
|
-
|
|
7
|
-
constructor() {
|
|
8
|
-
super();
|
|
9
|
-
HipieDDLMixin.call(this);
|
|
10
|
-
|
|
11
|
-
this.surfacePadding_default(0);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
content() {
|
|
15
|
-
const retVal = [];
|
|
16
|
-
this.widgets().forEach(function (surface) {
|
|
17
|
-
const grid = surface.widget();
|
|
18
|
-
grid.content().forEach(function (widget) {
|
|
19
|
-
retVal.push(widget);
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
return retVal;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
populateContent() {
|
|
26
|
-
const cellDensity = 3;
|
|
27
|
-
this._ddlDashboards.forEach(dashboard => {
|
|
28
|
-
const grid = new Grid().surfacePadding("0px");
|
|
29
|
-
this.addTab(grid, dashboard.dashboard.title);
|
|
30
|
-
let cellRow = 0;
|
|
31
|
-
let cellCol = 0;
|
|
32
|
-
const maxCol = Math.floor(Math.sqrt(dashboard.visualizations.length));
|
|
33
|
-
dashboard.visualizations.forEach(function (viz) {
|
|
34
|
-
if (viz.newWidgetSurface) {
|
|
35
|
-
while (grid.getCell(cellRow * cellDensity, cellCol * cellDensity) !== null) {
|
|
36
|
-
cellCol++;
|
|
37
|
-
if (cellCol % maxCol === 0) {
|
|
38
|
-
cellRow++;
|
|
39
|
-
cellCol = 0;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
grid.setContent(cellRow * cellDensity, cellCol * cellDensity, viz.newWidgetSurface, "", cellDensity, cellDensity);
|
|
43
|
-
}
|
|
44
|
-
}, this);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
const vizCellMap = {};
|
|
48
|
-
this.content().forEach(function (cell) {
|
|
49
|
-
let widget = cell.widget();
|
|
50
|
-
if (widget && widget.classID() === "layout_Surface") {
|
|
51
|
-
widget = widget.widget();
|
|
52
|
-
}
|
|
53
|
-
if (widget) {
|
|
54
|
-
vizCellMap[widget.id()] = cell;
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
this._ddlDashboards.forEach(function (dashboard) {
|
|
59
|
-
dashboard.visualizations.forEach(function (viz, idx) {
|
|
60
|
-
if (viz.properties.flyout || viz.parentVisualization) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
const targetVizs = viz.events.getUpdatesVisualizations();
|
|
64
|
-
const targetIDs = targetVizs.filter(function (targetViz) {
|
|
65
|
-
return vizCellMap[targetViz.id];
|
|
66
|
-
}).map(function (targetViz) {
|
|
67
|
-
return vizCellMap[targetViz.id].id();
|
|
68
|
-
});
|
|
69
|
-
vizCellMap[viz.id].indicateTheseIds(targetIDs);
|
|
70
|
-
});
|
|
71
|
-
}, this);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
enter(domNode, element) {
|
|
75
|
-
super.enter(domNode, element);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
render(callback) {
|
|
79
|
-
this._marshallerRender(TabbedLayout.prototype, callback);
|
|
80
|
-
return this;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
commsError(source, error) {
|
|
84
|
-
alert("Comms Error:\n" + source + "\n" + error);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// HipieDDLMixin ---
|
|
88
|
-
_marshallerRender: (BaseClass, callback) => this;
|
|
89
|
-
}
|
|
90
|
-
Tabbed.prototype.mixin(HipieDDLMixin);
|
|
91
|
-
Tabbed.prototype._class += " marshaller_Tabbed";
|
|
1
|
+
import { Grid, Tabbed as TabbedLayout } from "@hpcc-js/layout";
|
|
2
|
+
import { HipieDDLMixin } from "./HipieDDLMixin";
|
|
3
|
+
|
|
4
|
+
export class Tabbed extends TabbedLayout {
|
|
5
|
+
_ddlDashboards;
|
|
6
|
+
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
HipieDDLMixin.call(this);
|
|
10
|
+
|
|
11
|
+
this.surfacePadding_default(0);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
content() {
|
|
15
|
+
const retVal = [];
|
|
16
|
+
this.widgets().forEach(function (surface) {
|
|
17
|
+
const grid = surface.widget();
|
|
18
|
+
grid.content().forEach(function (widget) {
|
|
19
|
+
retVal.push(widget);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
return retVal;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
populateContent() {
|
|
26
|
+
const cellDensity = 3;
|
|
27
|
+
this._ddlDashboards.forEach(dashboard => {
|
|
28
|
+
const grid = new Grid().surfacePadding("0px");
|
|
29
|
+
this.addTab(grid, dashboard.dashboard.title);
|
|
30
|
+
let cellRow = 0;
|
|
31
|
+
let cellCol = 0;
|
|
32
|
+
const maxCol = Math.floor(Math.sqrt(dashboard.visualizations.length));
|
|
33
|
+
dashboard.visualizations.forEach(function (viz) {
|
|
34
|
+
if (viz.newWidgetSurface) {
|
|
35
|
+
while (grid.getCell(cellRow * cellDensity, cellCol * cellDensity) !== null) {
|
|
36
|
+
cellCol++;
|
|
37
|
+
if (cellCol % maxCol === 0) {
|
|
38
|
+
cellRow++;
|
|
39
|
+
cellCol = 0;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
grid.setContent(cellRow * cellDensity, cellCol * cellDensity, viz.newWidgetSurface, "", cellDensity, cellDensity);
|
|
43
|
+
}
|
|
44
|
+
}, this);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const vizCellMap = {};
|
|
48
|
+
this.content().forEach(function (cell) {
|
|
49
|
+
let widget = cell.widget();
|
|
50
|
+
if (widget && widget.classID() === "layout_Surface") {
|
|
51
|
+
widget = widget.widget();
|
|
52
|
+
}
|
|
53
|
+
if (widget) {
|
|
54
|
+
vizCellMap[widget.id()] = cell;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
this._ddlDashboards.forEach(function (dashboard) {
|
|
59
|
+
dashboard.visualizations.forEach(function (viz, idx) {
|
|
60
|
+
if (viz.properties.flyout || viz.parentVisualization) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const targetVizs = viz.events.getUpdatesVisualizations();
|
|
64
|
+
const targetIDs = targetVizs.filter(function (targetViz) {
|
|
65
|
+
return vizCellMap[targetViz.id];
|
|
66
|
+
}).map(function (targetViz) {
|
|
67
|
+
return vizCellMap[targetViz.id].id();
|
|
68
|
+
});
|
|
69
|
+
vizCellMap[viz.id].indicateTheseIds(targetIDs);
|
|
70
|
+
});
|
|
71
|
+
}, this);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
enter(domNode, element) {
|
|
75
|
+
super.enter(domNode, element);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
render(callback) {
|
|
79
|
+
this._marshallerRender(TabbedLayout.prototype, callback);
|
|
80
|
+
return this;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
commsError(source, error) {
|
|
84
|
+
alert("Comms Error:\n" + source + "\n" + error);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// HipieDDLMixin ---
|
|
88
|
+
_marshallerRender: (BaseClass, callback) => this;
|
|
89
|
+
}
|
|
90
|
+
Tabbed.prototype.mixin(HipieDDLMixin);
|
|
91
|
+
Tabbed.prototype._class += " marshaller_Tabbed";
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import { HTMLWidget } from "@hpcc-js/common";
|
|
2
|
-
import { HipieDDLMixin } from "./HipieDDLMixin";
|
|
3
|
-
|
|
4
|
-
export function TargetMarshaller(this: any) {
|
|
5
|
-
HTMLWidget.call(this);
|
|
6
|
-
HipieDDLMixin.call(this);
|
|
7
|
-
this._tag = "div";
|
|
8
|
-
}
|
|
9
|
-
TargetMarshaller.prototype = Object.create(HTMLWidget.prototype);
|
|
10
|
-
TargetMarshaller.prototype.constructor = TargetMarshaller;
|
|
11
|
-
TargetMarshaller.prototype.mixin(HipieDDLMixin);
|
|
12
|
-
TargetMarshaller.prototype._class += " marshaller_TargetMarshaller";
|
|
13
|
-
|
|
14
|
-
TargetMarshaller.prototype.publish("configObject", {}, "object", "TargetMarshaller setup object", null, { tags: ["Basic"] });
|
|
15
|
-
|
|
16
|
-
TargetMarshaller.prototype.content = function () {
|
|
17
|
-
return [];
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
TargetMarshaller.prototype.populateContent = function () {
|
|
21
|
-
const _configObject = this.configObject();
|
|
22
|
-
for (const key in this._ddlDashboards) {
|
|
23
|
-
this._ddlDashboards[key].visualizations.forEach(function (viz, idx) {
|
|
24
|
-
const widget_config = _configObject[viz.id];
|
|
25
|
-
if (widget_config !== undefined) {
|
|
26
|
-
if (widget_config.target !== undefined) {
|
|
27
|
-
viz.newWidgetSurface.target(widget_config.target);
|
|
28
|
-
} else {
|
|
29
|
-
console.warn("Target not specified for the following:");
|
|
30
|
-
console.warn("this._ddlDashboards[" + key + "].visualizations[" + idx + "].id = " + viz.id);
|
|
31
|
-
}
|
|
32
|
-
if (typeof widget_config.callback === "function") {
|
|
33
|
-
widget_config.callback(viz.widget, viz.newWidgetSurface);
|
|
34
|
-
} else {
|
|
35
|
-
console.warn("Callback not specified for the following:");
|
|
36
|
-
console.warn("this._ddlDashboards[" + key + "].visualizations[" + idx + "].id = " + viz.id);
|
|
37
|
-
}
|
|
38
|
-
} else {
|
|
39
|
-
console.warn("Config not specified for the following:");
|
|
40
|
-
console.warn("this._ddlDashboards[" + key + "].visualizations[" + idx + "].id = " + viz.id);
|
|
41
|
-
}
|
|
42
|
-
}, this);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
TargetMarshaller.prototype.enter = function (domNode, element) {
|
|
47
|
-
HTMLWidget.prototype.enter.apply(this, arguments);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
TargetMarshaller.prototype.render = function (callback) {
|
|
51
|
-
this.marshallerRender(HTMLWidget.prototype, callback);
|
|
52
|
-
return this;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
TargetMarshaller.prototype.commsError = function (source, error) {
|
|
56
|
-
alert("Comms Error:\n" + source + "\n" + error);
|
|
57
|
-
};
|
|
1
|
+
import { HTMLWidget } from "@hpcc-js/common";
|
|
2
|
+
import { HipieDDLMixin } from "./HipieDDLMixin";
|
|
3
|
+
|
|
4
|
+
export function TargetMarshaller(this: any) {
|
|
5
|
+
HTMLWidget.call(this);
|
|
6
|
+
HipieDDLMixin.call(this);
|
|
7
|
+
this._tag = "div";
|
|
8
|
+
}
|
|
9
|
+
TargetMarshaller.prototype = Object.create(HTMLWidget.prototype);
|
|
10
|
+
TargetMarshaller.prototype.constructor = TargetMarshaller;
|
|
11
|
+
TargetMarshaller.prototype.mixin(HipieDDLMixin);
|
|
12
|
+
TargetMarshaller.prototype._class += " marshaller_TargetMarshaller";
|
|
13
|
+
|
|
14
|
+
TargetMarshaller.prototype.publish("configObject", {}, "object", "TargetMarshaller setup object", null, { tags: ["Basic"] });
|
|
15
|
+
|
|
16
|
+
TargetMarshaller.prototype.content = function () {
|
|
17
|
+
return [];
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
TargetMarshaller.prototype.populateContent = function () {
|
|
21
|
+
const _configObject = this.configObject();
|
|
22
|
+
for (const key in this._ddlDashboards) {
|
|
23
|
+
this._ddlDashboards[key].visualizations.forEach(function (viz, idx) {
|
|
24
|
+
const widget_config = _configObject[viz.id];
|
|
25
|
+
if (widget_config !== undefined) {
|
|
26
|
+
if (widget_config.target !== undefined) {
|
|
27
|
+
viz.newWidgetSurface.target(widget_config.target);
|
|
28
|
+
} else {
|
|
29
|
+
console.warn("Target not specified for the following:");
|
|
30
|
+
console.warn("this._ddlDashboards[" + key + "].visualizations[" + idx + "].id = " + viz.id);
|
|
31
|
+
}
|
|
32
|
+
if (typeof widget_config.callback === "function") {
|
|
33
|
+
widget_config.callback(viz.widget, viz.newWidgetSurface);
|
|
34
|
+
} else {
|
|
35
|
+
console.warn("Callback not specified for the following:");
|
|
36
|
+
console.warn("this._ddlDashboards[" + key + "].visualizations[" + idx + "].id = " + viz.id);
|
|
37
|
+
}
|
|
38
|
+
} else {
|
|
39
|
+
console.warn("Config not specified for the following:");
|
|
40
|
+
console.warn("this._ddlDashboards[" + key + "].visualizations[" + idx + "].id = " + viz.id);
|
|
41
|
+
}
|
|
42
|
+
}, this);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
TargetMarshaller.prototype.enter = function (domNode, element) {
|
|
47
|
+
HTMLWidget.prototype.enter.apply(this, arguments);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
TargetMarshaller.prototype.render = function (callback) {
|
|
51
|
+
this.marshallerRender(HTMLWidget.prototype, callback);
|
|
52
|
+
return this;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
TargetMarshaller.prototype.commsError = function (source, error) {
|
|
56
|
+
alert("Comms Error:\n" + source + "\n" + error);
|
|
57
|
+
};
|
package/src/ddl2/PopupManager.ts
CHANGED
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
import { IMonitorHandle, Widget } from "@hpcc-js/common";
|
|
2
|
-
import { compare } from "@hpcc-js/util";
|
|
3
|
-
import { ElementContainer } from "./model/element";
|
|
4
|
-
import { IVizPopupPanelOwner, VizChartPanel, VizPopupPanel } from "./model/vizChartPanel";
|
|
5
|
-
|
|
6
|
-
export class PopupManager extends Widget implements IVizPopupPanelOwner {
|
|
7
|
-
protected _ec: ElementContainer;
|
|
8
|
-
protected _popups: VizPopupPanel[] = [];
|
|
9
|
-
protected _popupIdx: {
|
|
10
|
-
[id: string]: {
|
|
11
|
-
panel: VizPopupPanel,
|
|
12
|
-
monitorHandle: IMonitorHandle
|
|
13
|
-
}
|
|
14
|
-
} = {};
|
|
15
|
-
|
|
16
|
-
popupPanels(): VizPopupPanel[] {
|
|
17
|
-
if (!this._popups) this._popups = [];
|
|
18
|
-
if (!this._popupIdx) this._popupIdx = {};
|
|
19
|
-
return this._popups;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
popupChartPanels(): VizChartPanel[] {
|
|
23
|
-
return this.popupPanels().map(p => p.widget() as VizChartPanel);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
addPopup(cp: VizChartPanel) {
|
|
27
|
-
const elem = this._ec.element(cp);
|
|
28
|
-
const targetNode = this.element().node();
|
|
29
|
-
const pp = new VizPopupPanel(this, elem)
|
|
30
|
-
.target(targetNode)
|
|
31
|
-
.widget(cp)
|
|
32
|
-
.relativeTargetId(this.id())
|
|
33
|
-
.size({
|
|
34
|
-
width: cp.minWidth(),
|
|
35
|
-
height: cp.minHeight()
|
|
36
|
-
});
|
|
37
|
-
this._popups.push(pp);
|
|
38
|
-
this._popupIdx[cp.id()] = {
|
|
39
|
-
panel: pp,
|
|
40
|
-
monitorHandle: cp.monitor((id) => {
|
|
41
|
-
switch (id) {
|
|
42
|
-
case "minWidth":
|
|
43
|
-
case "minHeight":
|
|
44
|
-
pp
|
|
45
|
-
.resize({ width: cp.minWidth(), height: cp.minHeight() })
|
|
46
|
-
.render()
|
|
47
|
-
;
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
})
|
|
51
|
-
};
|
|
52
|
-
this._ec.filteredBy(elem.id()).forEach(otherElem => {
|
|
53
|
-
otherElem.visualization().chartPanel().popup(pp);
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
removePopup(cp: VizChartPanel) {
|
|
58
|
-
const elem = this._ec.element(cp);
|
|
59
|
-
this._ec.filteredBy(elem.id()).forEach(otherElem => {
|
|
60
|
-
otherElem.visualization().chartPanel().popup(null);
|
|
61
|
-
});
|
|
62
|
-
this._popupIdx[cp.id()].panel.target(null);
|
|
63
|
-
this._popupIdx[cp.id()].monitorHandle.remove();
|
|
64
|
-
cp.target(null);
|
|
65
|
-
delete this._popupIdx[cp.id()];
|
|
66
|
-
this._popups = this._popups.filter(p => p.widget() !== cp);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
syncPopups() {
|
|
70
|
-
const prevPopups = this.popupChartPanels();
|
|
71
|
-
const diffPopups = compare(prevPopups, this._ec.elements()
|
|
72
|
-
.filter(e => e.visualization().visibility() === "flyout")
|
|
73
|
-
.map((elem: any) => elem.visualization().chartPanel()))
|
|
74
|
-
;
|
|
75
|
-
|
|
76
|
-
for (const w of diffPopups.exit) {
|
|
77
|
-
this.removePopup(w);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
for (const w of diffPopups.enter) {
|
|
81
|
-
this.addPopup(w);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return this;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
vizActivation() {
|
|
88
|
-
}
|
|
89
|
-
}
|
|
1
|
+
import { IMonitorHandle, Widget } from "@hpcc-js/common";
|
|
2
|
+
import { compare } from "@hpcc-js/util";
|
|
3
|
+
import { ElementContainer } from "./model/element";
|
|
4
|
+
import { IVizPopupPanelOwner, VizChartPanel, VizPopupPanel } from "./model/vizChartPanel";
|
|
5
|
+
|
|
6
|
+
export class PopupManager extends Widget implements IVizPopupPanelOwner {
|
|
7
|
+
protected _ec: ElementContainer;
|
|
8
|
+
protected _popups: VizPopupPanel[] = [];
|
|
9
|
+
protected _popupIdx: {
|
|
10
|
+
[id: string]: {
|
|
11
|
+
panel: VizPopupPanel,
|
|
12
|
+
monitorHandle: IMonitorHandle
|
|
13
|
+
}
|
|
14
|
+
} = {};
|
|
15
|
+
|
|
16
|
+
popupPanels(): VizPopupPanel[] {
|
|
17
|
+
if (!this._popups) this._popups = [];
|
|
18
|
+
if (!this._popupIdx) this._popupIdx = {};
|
|
19
|
+
return this._popups;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
popupChartPanels(): VizChartPanel[] {
|
|
23
|
+
return this.popupPanels().map(p => p.widget() as VizChartPanel);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
addPopup(cp: VizChartPanel) {
|
|
27
|
+
const elem = this._ec.element(cp);
|
|
28
|
+
const targetNode = this.element().node();
|
|
29
|
+
const pp = new VizPopupPanel(this, elem)
|
|
30
|
+
.target(targetNode)
|
|
31
|
+
.widget(cp)
|
|
32
|
+
.relativeTargetId(this.id())
|
|
33
|
+
.size({
|
|
34
|
+
width: cp.minWidth(),
|
|
35
|
+
height: cp.minHeight()
|
|
36
|
+
});
|
|
37
|
+
this._popups.push(pp);
|
|
38
|
+
this._popupIdx[cp.id()] = {
|
|
39
|
+
panel: pp,
|
|
40
|
+
monitorHandle: cp.monitor((id) => {
|
|
41
|
+
switch (id) {
|
|
42
|
+
case "minWidth":
|
|
43
|
+
case "minHeight":
|
|
44
|
+
pp
|
|
45
|
+
.resize({ width: cp.minWidth(), height: cp.minHeight() })
|
|
46
|
+
.render()
|
|
47
|
+
;
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
};
|
|
52
|
+
this._ec.filteredBy(elem.id()).forEach(otherElem => {
|
|
53
|
+
otherElem.visualization().chartPanel().popup(pp);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
removePopup(cp: VizChartPanel) {
|
|
58
|
+
const elem = this._ec.element(cp);
|
|
59
|
+
this._ec.filteredBy(elem.id()).forEach(otherElem => {
|
|
60
|
+
otherElem.visualization().chartPanel().popup(null);
|
|
61
|
+
});
|
|
62
|
+
this._popupIdx[cp.id()].panel.target(null);
|
|
63
|
+
this._popupIdx[cp.id()].monitorHandle.remove();
|
|
64
|
+
cp.target(null);
|
|
65
|
+
delete this._popupIdx[cp.id()];
|
|
66
|
+
this._popups = this._popups.filter(p => p.widget() !== cp);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
syncPopups() {
|
|
70
|
+
const prevPopups = this.popupChartPanels();
|
|
71
|
+
const diffPopups = compare(prevPopups, this._ec.elements()
|
|
72
|
+
.filter(e => e.visualization().visibility() === "flyout")
|
|
73
|
+
.map((elem: any) => elem.visualization().chartPanel()))
|
|
74
|
+
;
|
|
75
|
+
|
|
76
|
+
for (const w of diffPopups.exit) {
|
|
77
|
+
this.removePopup(w);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
for (const w of diffPopups.enter) {
|
|
81
|
+
this.addPopup(w);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return this;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
vizActivation() {
|
|
88
|
+
}
|
|
89
|
+
}
|