@hpcc-js/layout 3.5.8 → 3.5.10
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/README.md +83 -83
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +1 -1
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +8 -8
- package/src/AbsoluteSurface.css +8 -8
- package/src/AbsoluteSurface.ts +93 -93
- package/src/Accordion.css +101 -101
- package/src/Accordion.ts +146 -146
- package/src/Border.css +148 -148
- package/src/Border.ts +636 -636
- package/src/Border2.css +22 -22
- package/src/Border2.ts +391 -391
- package/src/Carousel.css +7 -7
- package/src/Carousel.ts +100 -100
- package/src/Cell.css +10 -10
- package/src/Cell.ts +94 -94
- package/src/ChartPanel.css +7 -7
- package/src/ChartPanel.ts +635 -635
- package/src/FlexGrid.css +8 -8
- package/src/FlexGrid.ts +140 -140
- package/src/Grid.css +89 -89
- package/src/Grid.ts +576 -576
- package/src/HorizontalList.ts +15 -15
- package/src/Layered.css +11 -11
- package/src/Layered.ts +132 -132
- package/src/Legend.ts +516 -516
- package/src/Modal.css +50 -50
- package/src/Modal.ts +289 -289
- package/src/Popup.ts +120 -120
- package/src/Surface.css +104 -104
- package/src/Surface.ts +223 -223
- package/src/Tabbed.css +23 -23
- package/src/Tabbed.ts +165 -165
- package/src/Toolbar.css +33 -33
- package/src/Toolbar.ts +127 -127
- package/src/VerticalList.ts +15 -15
- package/src/__package__.ts +3 -3
- package/src/index.ts +20 -20
package/src/HorizontalList.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { FlexGrid } from "./FlexGrid.ts";
|
|
2
|
-
|
|
3
|
-
export class HorizontalList extends FlexGrid {
|
|
4
|
-
constructor() {
|
|
5
|
-
super();
|
|
6
|
-
this.orientation_default("horizontal");
|
|
7
|
-
this.flexWrap_default("nowrap");
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
HorizontalList.prototype._class += " layout_HorizontalList";
|
|
11
|
-
|
|
12
|
-
export interface HorizontalList {
|
|
13
|
-
orientation_default(_: "horizontal" | "vertical");
|
|
14
|
-
flexWrap_default(_: "nowrap" | "wrap" | "wrap-reverse");
|
|
15
|
-
}
|
|
1
|
+
import { FlexGrid } from "./FlexGrid.ts";
|
|
2
|
+
|
|
3
|
+
export class HorizontalList extends FlexGrid {
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
this.orientation_default("horizontal");
|
|
7
|
+
this.flexWrap_default("nowrap");
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
HorizontalList.prototype._class += " layout_HorizontalList";
|
|
11
|
+
|
|
12
|
+
export interface HorizontalList {
|
|
13
|
+
orientation_default(_: "horizontal" | "vertical");
|
|
14
|
+
flexWrap_default(_: "nowrap" | "wrap" | "wrap-reverse");
|
|
15
|
+
}
|
package/src/Layered.css
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
.layout_Layered {
|
|
2
|
-
pointer-events: none;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.layout_Layered>.container>.content {
|
|
6
|
-
position: absolute;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.layout_Layered>.container>.content>div>.common_Widget,
|
|
10
|
-
.layout_Layered>.container>.content>div>svg>.common_Widget {
|
|
11
|
-
pointer-events: all;
|
|
1
|
+
.layout_Layered {
|
|
2
|
+
pointer-events: none;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.layout_Layered>.container>.content {
|
|
6
|
+
position: absolute;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.layout_Layered>.container>.content>div>.common_Widget,
|
|
10
|
+
.layout_Layered>.container>.content>div>svg>.common_Widget {
|
|
11
|
+
pointer-events: all;
|
|
12
12
|
}
|
package/src/Layered.ts
CHANGED
|
@@ -1,132 +1,132 @@
|
|
|
1
|
-
import { HTMLWidget, Text } from "@hpcc-js/common";
|
|
2
|
-
|
|
3
|
-
import "../src/Layered.css";
|
|
4
|
-
|
|
5
|
-
export type LayerPlacement = "default" | "top" | "right" | "bottom" | "left" | "center";
|
|
6
|
-
|
|
7
|
-
export class Layered extends HTMLWidget {
|
|
8
|
-
protected _contentContainer;
|
|
9
|
-
_widgetPlacements;
|
|
10
|
-
_widgetRatios;
|
|
11
|
-
constructor() {
|
|
12
|
-
super();
|
|
13
|
-
|
|
14
|
-
this._tag = "div";
|
|
15
|
-
this._widgetPlacements = [];
|
|
16
|
-
this._widgetRatios = [];
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
addLayer(widget, placement: LayerPlacement = "default", widthRatio: number = 1, heightRatio: number = 1) {
|
|
20
|
-
const widgets = this.widgets();
|
|
21
|
-
widgets.push(widget ? widget : new Text().text("No widget defined for layer."));
|
|
22
|
-
this.widgets(widgets);
|
|
23
|
-
this._widgetPlacements.push(placement);
|
|
24
|
-
this._widgetRatios.push([widthRatio, heightRatio]);
|
|
25
|
-
return this;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
enter(domNode, element) {
|
|
29
|
-
super.enter(domNode, element);
|
|
30
|
-
this._contentContainer = element.append("div")
|
|
31
|
-
.attr("class", "container")
|
|
32
|
-
;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
update(domNode, element) {
|
|
36
|
-
super.update(domNode, element);
|
|
37
|
-
const context = this;
|
|
38
|
-
|
|
39
|
-
element.style("padding", this.surfacePadding() + "px");
|
|
40
|
-
|
|
41
|
-
const content = this._contentContainer.selectAll(".content.id" + this.id()).data(this.widgets(), function (d) { return d.id(); });
|
|
42
|
-
content.enter().append("div")
|
|
43
|
-
.attr("class", "content id" + this.id())
|
|
44
|
-
.each(function (widget, idx) {
|
|
45
|
-
widget.target(this);
|
|
46
|
-
})
|
|
47
|
-
.merge(content)
|
|
48
|
-
.each(function (widget, idx) {
|
|
49
|
-
const clientSize = {
|
|
50
|
-
width: context.clientWidth(),
|
|
51
|
-
height: context.clientHeight()
|
|
52
|
-
};
|
|
53
|
-
const widgetSize = context.widgetSize(idx, clientSize);
|
|
54
|
-
const widgetPosition = context.widgetPosition(idx, clientSize, widgetSize);
|
|
55
|
-
this.style.top = widgetPosition.y + "px";
|
|
56
|
-
this.style.left = widgetPosition.x + "px";
|
|
57
|
-
widget
|
|
58
|
-
.resize(widgetSize)
|
|
59
|
-
.render()
|
|
60
|
-
;
|
|
61
|
-
})
|
|
62
|
-
;
|
|
63
|
-
content.exit()
|
|
64
|
-
.each(function (widget, idx) {
|
|
65
|
-
widget
|
|
66
|
-
.target(null)
|
|
67
|
-
;
|
|
68
|
-
})
|
|
69
|
-
.remove()
|
|
70
|
-
;
|
|
71
|
-
content.order();
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
widgetSize(idx, clientSize) {
|
|
75
|
-
if (this._widgetPlacements[idx] === "default") {
|
|
76
|
-
return {
|
|
77
|
-
width: clientSize.width * this._widgetRatios[idx][0],
|
|
78
|
-
height: clientSize.height * this._widgetRatios[idx][1]
|
|
79
|
-
};
|
|
80
|
-
} else {
|
|
81
|
-
return {
|
|
82
|
-
width: clientSize.width * this._widgetRatios[idx][0],
|
|
83
|
-
height: clientSize.height * this._widgetRatios[idx][1]
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
widgetPosition(idx, clientSize, widgetSize) {
|
|
88
|
-
switch (this._widgetPlacements[idx]) {
|
|
89
|
-
default:
|
|
90
|
-
return {
|
|
91
|
-
x: 0,
|
|
92
|
-
y: 0
|
|
93
|
-
};
|
|
94
|
-
case "top":
|
|
95
|
-
return {
|
|
96
|
-
x: (clientSize.width / 2) - (widgetSize.width / 2),
|
|
97
|
-
y: 0
|
|
98
|
-
};
|
|
99
|
-
case "bottom":
|
|
100
|
-
return {
|
|
101
|
-
x: (clientSize.width / 2) - (widgetSize.width / 2),
|
|
102
|
-
y: clientSize.height - widgetSize.height
|
|
103
|
-
};
|
|
104
|
-
case "left":
|
|
105
|
-
return {
|
|
106
|
-
x: 0,
|
|
107
|
-
y: (clientSize.height / 2) - (widgetSize.height / 2)
|
|
108
|
-
};
|
|
109
|
-
case "right":
|
|
110
|
-
return {
|
|
111
|
-
x: clientSize.width - widgetSize.width,
|
|
112
|
-
y: (clientSize.height / 2) - (widgetSize.height / 2)
|
|
113
|
-
};
|
|
114
|
-
case "center":
|
|
115
|
-
return {
|
|
116
|
-
x: (clientSize.width / 2) - (widgetSize.width / 2),
|
|
117
|
-
y: (clientSize.height / 2) - (widgetSize.height / 2)
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
Layered.prototype._class += " layout_Layered";
|
|
123
|
-
|
|
124
|
-
export interface Layered {
|
|
125
|
-
surfacePadding(): number;
|
|
126
|
-
surfacePadding(_: number): this;
|
|
127
|
-
widgets(): any;
|
|
128
|
-
widgets(_: any): this;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
Layered.prototype.publish("surfacePadding", 0, "number", "Padding");
|
|
132
|
-
Layered.prototype.publish("widgets", [], "widgetArray", "widgets", null, { tags: ["Private"] });
|
|
1
|
+
import { HTMLWidget, Text } from "@hpcc-js/common";
|
|
2
|
+
|
|
3
|
+
import "../src/Layered.css";
|
|
4
|
+
|
|
5
|
+
export type LayerPlacement = "default" | "top" | "right" | "bottom" | "left" | "center";
|
|
6
|
+
|
|
7
|
+
export class Layered extends HTMLWidget {
|
|
8
|
+
protected _contentContainer;
|
|
9
|
+
_widgetPlacements;
|
|
10
|
+
_widgetRatios;
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
|
|
14
|
+
this._tag = "div";
|
|
15
|
+
this._widgetPlacements = [];
|
|
16
|
+
this._widgetRatios = [];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
addLayer(widget, placement: LayerPlacement = "default", widthRatio: number = 1, heightRatio: number = 1) {
|
|
20
|
+
const widgets = this.widgets();
|
|
21
|
+
widgets.push(widget ? widget : new Text().text("No widget defined for layer."));
|
|
22
|
+
this.widgets(widgets);
|
|
23
|
+
this._widgetPlacements.push(placement);
|
|
24
|
+
this._widgetRatios.push([widthRatio, heightRatio]);
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
enter(domNode, element) {
|
|
29
|
+
super.enter(domNode, element);
|
|
30
|
+
this._contentContainer = element.append("div")
|
|
31
|
+
.attr("class", "container")
|
|
32
|
+
;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
update(domNode, element) {
|
|
36
|
+
super.update(domNode, element);
|
|
37
|
+
const context = this;
|
|
38
|
+
|
|
39
|
+
element.style("padding", this.surfacePadding() + "px");
|
|
40
|
+
|
|
41
|
+
const content = this._contentContainer.selectAll(".content.id" + this.id()).data(this.widgets(), function (d) { return d.id(); });
|
|
42
|
+
content.enter().append("div")
|
|
43
|
+
.attr("class", "content id" + this.id())
|
|
44
|
+
.each(function (widget, idx) {
|
|
45
|
+
widget.target(this);
|
|
46
|
+
})
|
|
47
|
+
.merge(content)
|
|
48
|
+
.each(function (widget, idx) {
|
|
49
|
+
const clientSize = {
|
|
50
|
+
width: context.clientWidth(),
|
|
51
|
+
height: context.clientHeight()
|
|
52
|
+
};
|
|
53
|
+
const widgetSize = context.widgetSize(idx, clientSize);
|
|
54
|
+
const widgetPosition = context.widgetPosition(idx, clientSize, widgetSize);
|
|
55
|
+
this.style.top = widgetPosition.y + "px";
|
|
56
|
+
this.style.left = widgetPosition.x + "px";
|
|
57
|
+
widget
|
|
58
|
+
.resize(widgetSize)
|
|
59
|
+
.render()
|
|
60
|
+
;
|
|
61
|
+
})
|
|
62
|
+
;
|
|
63
|
+
content.exit()
|
|
64
|
+
.each(function (widget, idx) {
|
|
65
|
+
widget
|
|
66
|
+
.target(null)
|
|
67
|
+
;
|
|
68
|
+
})
|
|
69
|
+
.remove()
|
|
70
|
+
;
|
|
71
|
+
content.order();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
widgetSize(idx, clientSize) {
|
|
75
|
+
if (this._widgetPlacements[idx] === "default") {
|
|
76
|
+
return {
|
|
77
|
+
width: clientSize.width * this._widgetRatios[idx][0],
|
|
78
|
+
height: clientSize.height * this._widgetRatios[idx][1]
|
|
79
|
+
};
|
|
80
|
+
} else {
|
|
81
|
+
return {
|
|
82
|
+
width: clientSize.width * this._widgetRatios[idx][0],
|
|
83
|
+
height: clientSize.height * this._widgetRatios[idx][1]
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
widgetPosition(idx, clientSize, widgetSize) {
|
|
88
|
+
switch (this._widgetPlacements[idx]) {
|
|
89
|
+
default:
|
|
90
|
+
return {
|
|
91
|
+
x: 0,
|
|
92
|
+
y: 0
|
|
93
|
+
};
|
|
94
|
+
case "top":
|
|
95
|
+
return {
|
|
96
|
+
x: (clientSize.width / 2) - (widgetSize.width / 2),
|
|
97
|
+
y: 0
|
|
98
|
+
};
|
|
99
|
+
case "bottom":
|
|
100
|
+
return {
|
|
101
|
+
x: (clientSize.width / 2) - (widgetSize.width / 2),
|
|
102
|
+
y: clientSize.height - widgetSize.height
|
|
103
|
+
};
|
|
104
|
+
case "left":
|
|
105
|
+
return {
|
|
106
|
+
x: 0,
|
|
107
|
+
y: (clientSize.height / 2) - (widgetSize.height / 2)
|
|
108
|
+
};
|
|
109
|
+
case "right":
|
|
110
|
+
return {
|
|
111
|
+
x: clientSize.width - widgetSize.width,
|
|
112
|
+
y: (clientSize.height / 2) - (widgetSize.height / 2)
|
|
113
|
+
};
|
|
114
|
+
case "center":
|
|
115
|
+
return {
|
|
116
|
+
x: (clientSize.width / 2) - (widgetSize.width / 2),
|
|
117
|
+
y: (clientSize.height / 2) - (widgetSize.height / 2)
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
Layered.prototype._class += " layout_Layered";
|
|
123
|
+
|
|
124
|
+
export interface Layered {
|
|
125
|
+
surfacePadding(): number;
|
|
126
|
+
surfacePadding(_: number): this;
|
|
127
|
+
widgets(): any;
|
|
128
|
+
widgets(_: any): this;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
Layered.prototype.publish("surfacePadding", 0, "number", "Padding");
|
|
132
|
+
Layered.prototype.publish("widgets", [], "widgetArray", "widgets", null, { tags: ["Private"] });
|