@hpcc-js/layout 2.51.3 → 2.51.4
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.es6.js +2 -2
- package/dist/index.es6.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +5 -5
- package/src/AbsoluteSurface.css +9 -9
- package/src/AbsoluteSurface.ts +84 -84
- package/src/Accordion.css +84 -84
- package/src/Accordion.ts +136 -136
- package/src/Border.css +144 -144
- package/src/Border.ts +617 -617
- 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 +11 -11
- package/src/Cell.ts +89 -89
- package/src/ChartPanel.css +8 -8
- package/src/ChartPanel.ts +656 -656
- package/src/FlexGrid.css +7 -7
- package/src/FlexGrid.ts +140 -140
- package/src/Grid.css +90 -90
- package/src/Grid.ts +576 -576
- package/src/HorizontalList.ts +15 -15
- package/src/Layered.css +10 -10
- package/src/Layered.ts +128 -128
- package/src/Legend.ts +516 -516
- package/src/Modal.css +40 -40
- package/src/Modal.ts +289 -289
- package/src/Popup.ts +109 -109
- package/src/Surface.css +89 -89
- package/src/Surface.ts +176 -176
- package/src/Tabbed.css +22 -22
- package/src/Tabbed.ts +158 -158
- package/src/Toolbar.css +32 -32
- package/src/Toolbar.ts +102 -102
- package/src/VerticalList.ts +15 -15
- package/src/__package__.ts +3 -3
- package/src/index.ts +19 -19
- package/types/__package__.d.ts +2 -2
- package/types-3.4/__package__.d.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hpcc-js/layout",
|
|
3
|
-
"version": "2.51.
|
|
3
|
+
"version": "2.51.4",
|
|
4
4
|
"description": "hpcc-js - Viz Layout",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.es6",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"update": "npx --yes npm-check-updates -u -t minor"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@hpcc-js/api": "^2.14.
|
|
41
|
+
"@hpcc-js/api": "^2.14.4",
|
|
42
42
|
"@hpcc-js/chart": "^2.86.3",
|
|
43
|
-
"@hpcc-js/common": "^2.73.
|
|
44
|
-
"@hpcc-js/dgrid2": "^2.5.
|
|
43
|
+
"@hpcc-js/common": "^2.73.4",
|
|
44
|
+
"@hpcc-js/dgrid2": "^2.5.4"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@hpcc-js/bundle": "^2.12.0",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"url": "https://github.com/hpcc-systems/Visualization/issues"
|
|
66
66
|
},
|
|
67
67
|
"homepage": "https://github.com/hpcc-systems/Visualization",
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "81822aa7c1ef1b1ad45ca4cf7769d13fdaf36fba"
|
|
69
69
|
}
|
package/src/AbsoluteSurface.css
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
.layout_AbsoluteSurface {
|
|
2
|
-
pointer-events: none !important;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.layout_AbsoluteSurface > .placeholder {
|
|
6
|
-
position: relative;
|
|
7
|
-
overflow: hidden;
|
|
8
|
-
pointer-events: all;
|
|
9
|
-
}
|
|
1
|
+
.layout_AbsoluteSurface {
|
|
2
|
+
pointer-events: none !important;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.layout_AbsoluteSurface > .placeholder {
|
|
6
|
+
position: relative;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
pointer-events: all;
|
|
9
|
+
}
|
package/src/AbsoluteSurface.ts
CHANGED
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
import { HTMLWidget } from "@hpcc-js/common";
|
|
2
|
-
|
|
3
|
-
import "../src/AbsoluteSurface.css";
|
|
4
|
-
|
|
5
|
-
export class AbsoluteSurface extends HTMLWidget {
|
|
6
|
-
constructor() {
|
|
7
|
-
super();
|
|
8
|
-
|
|
9
|
-
this._tag = "div";
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
enter(domNode, element) {
|
|
13
|
-
super.enter(domNode, element);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
update(domNode, element) {
|
|
17
|
-
super.update(domNode, element);
|
|
18
|
-
|
|
19
|
-
let xPos = 0;
|
|
20
|
-
let yPos = 0;
|
|
21
|
-
let width = this.clientWidth();
|
|
22
|
-
let height = this.clientHeight();
|
|
23
|
-
switch (this.units()) {
|
|
24
|
-
case "pixels":
|
|
25
|
-
xPos = this.widgetX();
|
|
26
|
-
yPos = this.widgetY();
|
|
27
|
-
width = this.widgetWidth() === "" ? width - xPos : Number(this.widgetWidth());
|
|
28
|
-
height = this.widgetHeight() === "" ? height - yPos : Number(this.widgetHeight());
|
|
29
|
-
break;
|
|
30
|
-
case "percent":
|
|
31
|
-
xPos = this.widgetX() * width / 100;
|
|
32
|
-
yPos = this.widgetY() * height / 100;
|
|
33
|
-
width = this.widgetWidth() === "" ? width - xPos : Number(this.widgetWidth()) * width / 100;
|
|
34
|
-
height = this.widgetHeight() === "" ? height - yPos : Number(this.widgetHeight()) * height / 100;
|
|
35
|
-
break;
|
|
36
|
-
}
|
|
37
|
-
element.style("opacity", this.opacity());
|
|
38
|
-
|
|
39
|
-
const widgets = element.selectAll("#" + this._id + " > .placeholder").data(this.widget() ? [this.widget()] : [], function (d) { return d._id; });
|
|
40
|
-
widgets.enter().append("div")
|
|
41
|
-
.attr("class", "placeholder")
|
|
42
|
-
.each(function (d) {
|
|
43
|
-
d.target(this);
|
|
44
|
-
})
|
|
45
|
-
.merge(widgets)
|
|
46
|
-
.style("left", xPos + "px")
|
|
47
|
-
.style("top", yPos + "px")
|
|
48
|
-
.style("width", width + "px")
|
|
49
|
-
.style("bottom", height + "px")
|
|
50
|
-
.each(function (d) {
|
|
51
|
-
d
|
|
52
|
-
.resize({ width, height })
|
|
53
|
-
;
|
|
54
|
-
})
|
|
55
|
-
;
|
|
56
|
-
widgets.exit().each(function (d) {
|
|
57
|
-
d.target(null);
|
|
58
|
-
}).remove();
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
exit(domNode, element) {
|
|
62
|
-
if (this.widget()) {
|
|
63
|
-
this.widget().target(null);
|
|
64
|
-
}
|
|
65
|
-
super.exit(domNode, element);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
units: { (): string; (_: string): AbsoluteSurface; };
|
|
69
|
-
widgetX: { (): number; (_: number): AbsoluteSurface; };
|
|
70
|
-
widgetY: { (): number; (_: number): AbsoluteSurface; };
|
|
71
|
-
widgetWidth: { (): string; (_: string): AbsoluteSurface; };
|
|
72
|
-
widgetHeight: { (): string; (_: string): AbsoluteSurface; };
|
|
73
|
-
widget: { (): any; (_: any): AbsoluteSurface; };
|
|
74
|
-
opacity: { (): number; (_: number): AbsoluteSurface; };
|
|
75
|
-
}
|
|
76
|
-
AbsoluteSurface.prototype._class += " layout_AbsoluteSurface";
|
|
77
|
-
|
|
78
|
-
AbsoluteSurface.prototype.publish("units", "percent", "set", "Units", ["pixels", "percent"]);
|
|
79
|
-
AbsoluteSurface.prototype.publish("widgetX", 0, "number", "Widget XPos");
|
|
80
|
-
AbsoluteSurface.prototype.publish("widgetY", 0, "number", "Widget YPos");
|
|
81
|
-
AbsoluteSurface.prototype.publish("widgetWidth", "100", "string", "Widget Width, omit for full");
|
|
82
|
-
AbsoluteSurface.prototype.publish("widgetHeight", "100", "string", "Widget Height, omit for full");
|
|
83
|
-
AbsoluteSurface.prototype.publish("widget", null, "widget", "Widget", null, { tags: ["Private"] });
|
|
84
|
-
AbsoluteSurface.prototype.publish("opacity", 1, "number", "Opacity");
|
|
1
|
+
import { HTMLWidget } from "@hpcc-js/common";
|
|
2
|
+
|
|
3
|
+
import "../src/AbsoluteSurface.css";
|
|
4
|
+
|
|
5
|
+
export class AbsoluteSurface extends HTMLWidget {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
|
|
9
|
+
this._tag = "div";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
enter(domNode, element) {
|
|
13
|
+
super.enter(domNode, element);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
update(domNode, element) {
|
|
17
|
+
super.update(domNode, element);
|
|
18
|
+
|
|
19
|
+
let xPos = 0;
|
|
20
|
+
let yPos = 0;
|
|
21
|
+
let width = this.clientWidth();
|
|
22
|
+
let height = this.clientHeight();
|
|
23
|
+
switch (this.units()) {
|
|
24
|
+
case "pixels":
|
|
25
|
+
xPos = this.widgetX();
|
|
26
|
+
yPos = this.widgetY();
|
|
27
|
+
width = this.widgetWidth() === "" ? width - xPos : Number(this.widgetWidth());
|
|
28
|
+
height = this.widgetHeight() === "" ? height - yPos : Number(this.widgetHeight());
|
|
29
|
+
break;
|
|
30
|
+
case "percent":
|
|
31
|
+
xPos = this.widgetX() * width / 100;
|
|
32
|
+
yPos = this.widgetY() * height / 100;
|
|
33
|
+
width = this.widgetWidth() === "" ? width - xPos : Number(this.widgetWidth()) * width / 100;
|
|
34
|
+
height = this.widgetHeight() === "" ? height - yPos : Number(this.widgetHeight()) * height / 100;
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
element.style("opacity", this.opacity());
|
|
38
|
+
|
|
39
|
+
const widgets = element.selectAll("#" + this._id + " > .placeholder").data(this.widget() ? [this.widget()] : [], function (d) { return d._id; });
|
|
40
|
+
widgets.enter().append("div")
|
|
41
|
+
.attr("class", "placeholder")
|
|
42
|
+
.each(function (d) {
|
|
43
|
+
d.target(this);
|
|
44
|
+
})
|
|
45
|
+
.merge(widgets)
|
|
46
|
+
.style("left", xPos + "px")
|
|
47
|
+
.style("top", yPos + "px")
|
|
48
|
+
.style("width", width + "px")
|
|
49
|
+
.style("bottom", height + "px")
|
|
50
|
+
.each(function (d) {
|
|
51
|
+
d
|
|
52
|
+
.resize({ width, height })
|
|
53
|
+
;
|
|
54
|
+
})
|
|
55
|
+
;
|
|
56
|
+
widgets.exit().each(function (d) {
|
|
57
|
+
d.target(null);
|
|
58
|
+
}).remove();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
exit(domNode, element) {
|
|
62
|
+
if (this.widget()) {
|
|
63
|
+
this.widget().target(null);
|
|
64
|
+
}
|
|
65
|
+
super.exit(domNode, element);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
units: { (): string; (_: string): AbsoluteSurface; };
|
|
69
|
+
widgetX: { (): number; (_: number): AbsoluteSurface; };
|
|
70
|
+
widgetY: { (): number; (_: number): AbsoluteSurface; };
|
|
71
|
+
widgetWidth: { (): string; (_: string): AbsoluteSurface; };
|
|
72
|
+
widgetHeight: { (): string; (_: string): AbsoluteSurface; };
|
|
73
|
+
widget: { (): any; (_: any): AbsoluteSurface; };
|
|
74
|
+
opacity: { (): number; (_: number): AbsoluteSurface; };
|
|
75
|
+
}
|
|
76
|
+
AbsoluteSurface.prototype._class += " layout_AbsoluteSurface";
|
|
77
|
+
|
|
78
|
+
AbsoluteSurface.prototype.publish("units", "percent", "set", "Units", ["pixels", "percent"]);
|
|
79
|
+
AbsoluteSurface.prototype.publish("widgetX", 0, "number", "Widget XPos");
|
|
80
|
+
AbsoluteSurface.prototype.publish("widgetY", 0, "number", "Widget YPos");
|
|
81
|
+
AbsoluteSurface.prototype.publish("widgetWidth", "100", "string", "Widget Width, omit for full");
|
|
82
|
+
AbsoluteSurface.prototype.publish("widgetHeight", "100", "string", "Widget Height, omit for full");
|
|
83
|
+
AbsoluteSurface.prototype.publish("widget", null, "widget", "Widget", null, { tags: ["Private"] });
|
|
84
|
+
AbsoluteSurface.prototype.publish("opacity", 1, "number", "Opacity");
|
package/src/Accordion.css
CHANGED
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
.layout_Accordion > ul{
|
|
2
|
-
position:relative;
|
|
3
|
-
}
|
|
4
|
-
.layout_Accordion.open > span {
|
|
5
|
-
font-style:italic;
|
|
6
|
-
}
|
|
7
|
-
.layout_Accordion.closed > ul {
|
|
8
|
-
height: 0px;
|
|
9
|
-
overflow: hidden;
|
|
10
|
-
}
|
|
11
|
-
.layout_Accordion.open > ul{
|
|
12
|
-
display:block;
|
|
13
|
-
}
|
|
14
|
-
.layout_Accordion > .collapsible-icon,
|
|
15
|
-
.layout_Accordion > .collapsible-title{
|
|
16
|
-
cursor:pointer;
|
|
17
|
-
box-sizing: border-box;
|
|
18
|
-
}
|
|
19
|
-
.layout_Accordion > .collapsible-title{
|
|
20
|
-
display:block;
|
|
21
|
-
width:100%;
|
|
22
|
-
}
|
|
23
|
-
.layout_Accordion > .collapsible-title{
|
|
24
|
-
font-size: 13px;
|
|
25
|
-
color:#FFF;
|
|
26
|
-
padding:4px 8px;
|
|
27
|
-
height:26px;
|
|
28
|
-
-webkit-box-shadow: inset 0px -1px 1px 0px rgba(0,0,0,0.2);
|
|
29
|
-
-moz-box-shadow: inset 0px -1px 1px 0px rgba(0,0,0,0.2);
|
|
30
|
-
box-shadow: inset 0px -1px 1px 0px rgba(0,0,0,0.2);
|
|
31
|
-
}
|
|
32
|
-
.layout_Accordion li{
|
|
33
|
-
background-color:#FFFFFF;
|
|
34
|
-
}
|
|
35
|
-
.layout_Accordion > ul,
|
|
36
|
-
.layout_Accordion > .collapsible-title{
|
|
37
|
-
background-color:#333;
|
|
38
|
-
}
|
|
39
|
-
.layout_Accordion .layout_Accordion > ul,
|
|
40
|
-
.layout_Accordion .layout_Accordion > .collapsible-title{
|
|
41
|
-
background-color:#555;
|
|
42
|
-
}
|
|
43
|
-
.layout_Accordion .layout_Accordion .layout_Accordion > ul,
|
|
44
|
-
.layout_Accordion .layout_Accordion .layout_Accordion > .collapsible-title{
|
|
45
|
-
background-color:#777;
|
|
46
|
-
}
|
|
47
|
-
.layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion > ul,
|
|
48
|
-
.layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion > .collapsible-title{
|
|
49
|
-
background-color:#999;
|
|
50
|
-
}
|
|
51
|
-
.layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion > ul,
|
|
52
|
-
.layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion > .collapsible-title{
|
|
53
|
-
background-color:#BBB;
|
|
54
|
-
}
|
|
55
|
-
.layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion > ul,
|
|
56
|
-
.layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion > .collapsible-title{
|
|
57
|
-
background-color:#CCC;
|
|
58
|
-
}
|
|
59
|
-
.layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion > ul,
|
|
60
|
-
.layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion > .collapsible-title{
|
|
61
|
-
background-color:#DDD;
|
|
62
|
-
}
|
|
63
|
-
.layout_Accordion > ul,
|
|
64
|
-
.layout_Accordion > span{
|
|
65
|
-
padding-left:0px;
|
|
66
|
-
}
|
|
67
|
-
.layout_Accordion .layout_Accordion > ul,
|
|
68
|
-
.layout_Accordion .layout_Accordion > span{
|
|
69
|
-
padding-left: 12px;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.layout_Accordion > .collapsible-title:before{
|
|
73
|
-
padding: 4px 8px 4px 8px;
|
|
74
|
-
position: absolute;
|
|
75
|
-
left: 0;
|
|
76
|
-
top: 0;
|
|
77
|
-
}
|
|
78
|
-
.layout_Accordion > .collapsible-icon{
|
|
79
|
-
position:absolute;
|
|
80
|
-
top:0px;
|
|
81
|
-
right:0px;
|
|
82
|
-
width:24px;
|
|
83
|
-
height:24px;
|
|
84
|
-
color:#FFF;
|
|
1
|
+
.layout_Accordion > ul{
|
|
2
|
+
position:relative;
|
|
3
|
+
}
|
|
4
|
+
.layout_Accordion.open > span {
|
|
5
|
+
font-style:italic;
|
|
6
|
+
}
|
|
7
|
+
.layout_Accordion.closed > ul {
|
|
8
|
+
height: 0px;
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
}
|
|
11
|
+
.layout_Accordion.open > ul{
|
|
12
|
+
display:block;
|
|
13
|
+
}
|
|
14
|
+
.layout_Accordion > .collapsible-icon,
|
|
15
|
+
.layout_Accordion > .collapsible-title{
|
|
16
|
+
cursor:pointer;
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
}
|
|
19
|
+
.layout_Accordion > .collapsible-title{
|
|
20
|
+
display:block;
|
|
21
|
+
width:100%;
|
|
22
|
+
}
|
|
23
|
+
.layout_Accordion > .collapsible-title{
|
|
24
|
+
font-size: 13px;
|
|
25
|
+
color:#FFF;
|
|
26
|
+
padding:4px 8px;
|
|
27
|
+
height:26px;
|
|
28
|
+
-webkit-box-shadow: inset 0px -1px 1px 0px rgba(0,0,0,0.2);
|
|
29
|
+
-moz-box-shadow: inset 0px -1px 1px 0px rgba(0,0,0,0.2);
|
|
30
|
+
box-shadow: inset 0px -1px 1px 0px rgba(0,0,0,0.2);
|
|
31
|
+
}
|
|
32
|
+
.layout_Accordion li{
|
|
33
|
+
background-color:#FFFFFF;
|
|
34
|
+
}
|
|
35
|
+
.layout_Accordion > ul,
|
|
36
|
+
.layout_Accordion > .collapsible-title{
|
|
37
|
+
background-color:#333;
|
|
38
|
+
}
|
|
39
|
+
.layout_Accordion .layout_Accordion > ul,
|
|
40
|
+
.layout_Accordion .layout_Accordion > .collapsible-title{
|
|
41
|
+
background-color:#555;
|
|
42
|
+
}
|
|
43
|
+
.layout_Accordion .layout_Accordion .layout_Accordion > ul,
|
|
44
|
+
.layout_Accordion .layout_Accordion .layout_Accordion > .collapsible-title{
|
|
45
|
+
background-color:#777;
|
|
46
|
+
}
|
|
47
|
+
.layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion > ul,
|
|
48
|
+
.layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion > .collapsible-title{
|
|
49
|
+
background-color:#999;
|
|
50
|
+
}
|
|
51
|
+
.layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion > ul,
|
|
52
|
+
.layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion > .collapsible-title{
|
|
53
|
+
background-color:#BBB;
|
|
54
|
+
}
|
|
55
|
+
.layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion > ul,
|
|
56
|
+
.layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion > .collapsible-title{
|
|
57
|
+
background-color:#CCC;
|
|
58
|
+
}
|
|
59
|
+
.layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion > ul,
|
|
60
|
+
.layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion > .collapsible-title{
|
|
61
|
+
background-color:#DDD;
|
|
62
|
+
}
|
|
63
|
+
.layout_Accordion > ul,
|
|
64
|
+
.layout_Accordion > span{
|
|
65
|
+
padding-left:0px;
|
|
66
|
+
}
|
|
67
|
+
.layout_Accordion .layout_Accordion > ul,
|
|
68
|
+
.layout_Accordion .layout_Accordion > span{
|
|
69
|
+
padding-left: 12px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.layout_Accordion > .collapsible-title:before{
|
|
73
|
+
padding: 4px 8px 4px 8px;
|
|
74
|
+
position: absolute;
|
|
75
|
+
left: 0;
|
|
76
|
+
top: 0;
|
|
77
|
+
}
|
|
78
|
+
.layout_Accordion > .collapsible-icon{
|
|
79
|
+
position:absolute;
|
|
80
|
+
top:0px;
|
|
81
|
+
right:0px;
|
|
82
|
+
width:24px;
|
|
83
|
+
height:24px;
|
|
84
|
+
color:#FFF;
|
|
85
85
|
}
|
package/src/Accordion.ts
CHANGED
|
@@ -1,136 +1,136 @@
|
|
|
1
|
-
import { FAChar, HTMLWidget } from "@hpcc-js/common";
|
|
2
|
-
|
|
3
|
-
import "../src/Accordion.css";
|
|
4
|
-
|
|
5
|
-
export class Accordion extends HTMLWidget {
|
|
6
|
-
protected _isClosed: boolean;
|
|
7
|
-
titleSpan;
|
|
8
|
-
iconDiv;
|
|
9
|
-
ul;
|
|
10
|
-
icon;
|
|
11
|
-
|
|
12
|
-
constructor() {
|
|
13
|
-
super();
|
|
14
|
-
|
|
15
|
-
this._tag = "div";
|
|
16
|
-
this._isClosed = false;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
pushListItem(widget, prepend: boolean = false, protect: boolean = false) {
|
|
20
|
-
const contentArr = this.content();
|
|
21
|
-
|
|
22
|
-
widget._protected = protect;
|
|
23
|
-
|
|
24
|
-
if (prepend) {
|
|
25
|
-
contentArr.unshift(widget);
|
|
26
|
-
} else {
|
|
27
|
-
contentArr.push(widget);
|
|
28
|
-
}
|
|
29
|
-
this.content(contentArr);
|
|
30
|
-
return this;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
clearListItems() {
|
|
34
|
-
const arr = [];
|
|
35
|
-
for (const i in this.content()) {
|
|
36
|
-
if (this.content()[i]._protected) {
|
|
37
|
-
arr.push(this.content()[i]);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
this.content(arr);
|
|
41
|
-
return this;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
collapseClick(element) {
|
|
45
|
-
if (element.classed("closed")) {
|
|
46
|
-
this._isClosed = false;
|
|
47
|
-
element.classed("open", true);
|
|
48
|
-
element.classed("closed", false);
|
|
49
|
-
} else {
|
|
50
|
-
this._isClosed = true;
|
|
51
|
-
element.classed("open", false);
|
|
52
|
-
element.classed("closed", true);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
enter(domNode, element) {
|
|
57
|
-
super.enter(domNode, element);
|
|
58
|
-
const context = this;
|
|
59
|
-
this._isClosed = this.defaultCollapsed();
|
|
60
|
-
element.classed(this._isClosed ? "closed" : "open", true);
|
|
61
|
-
|
|
62
|
-
this.titleSpan = element.append("span").classed("collapsible-title", true);
|
|
63
|
-
this.iconDiv = element.append("div").classed("collapsible-icon", true);
|
|
64
|
-
this.ul = element.append("ul");
|
|
65
|
-
|
|
66
|
-
this.icon = new FAChar()
|
|
67
|
-
.size({ height: 24, width: 24 })
|
|
68
|
-
.target(this.iconDiv.node());
|
|
69
|
-
|
|
70
|
-
this.iconDiv.on("click", function () {
|
|
71
|
-
context.collapseClick(element);
|
|
72
|
-
context.render();
|
|
73
|
-
});
|
|
74
|
-
this.titleSpan.on("click", function () {
|
|
75
|
-
context.collapseClick(element);
|
|
76
|
-
context.render();
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
update(domNode, element) {
|
|
81
|
-
super.update(domNode, element);
|
|
82
|
-
const context = this;
|
|
83
|
-
const this_id = "";
|
|
84
|
-
this.titleSpan.text(context.title().length > 0 ? context.title() + this_id : "Accordion [" + context._id + "]" + this_id);
|
|
85
|
-
const rows = this.ul.selectAll("#" + context._id + " > ul > li").data(this.content(), function (d) {
|
|
86
|
-
return d._id;
|
|
87
|
-
});
|
|
88
|
-
rows.enter()
|
|
89
|
-
.append(function (widget) {
|
|
90
|
-
const li = document.createElement("li");
|
|
91
|
-
if (widget._target === null) {
|
|
92
|
-
const wSize = widget.size();
|
|
93
|
-
if (wSize.width === 0 || wSize.height === 0) {
|
|
94
|
-
const cSize = context.size();
|
|
95
|
-
widget.size({
|
|
96
|
-
width: cSize.width,
|
|
97
|
-
height: cSize.width
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
widget.target(li);
|
|
101
|
-
} else {
|
|
102
|
-
return widget._target;
|
|
103
|
-
}
|
|
104
|
-
return li;
|
|
105
|
-
})
|
|
106
|
-
;
|
|
107
|
-
rows.exit().remove();
|
|
108
|
-
|
|
109
|
-
this.icon
|
|
110
|
-
.text_colorFill(this.titleFontColor())
|
|
111
|
-
.char(this._isClosed ? this.closedIcon() : this.openIcon()).render()
|
|
112
|
-
;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
exit(domNode, element) {
|
|
116
|
-
super.exit(domNode, element);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
content: { (): any[]; (_: any[]): Accordion; };
|
|
120
|
-
title: { (): string; (_: string): Accordion; };
|
|
121
|
-
openIcon: { (): string; (_: string): Accordion; };
|
|
122
|
-
closedIcon: { (): string; (_: string): Accordion; };
|
|
123
|
-
titleFontColor: { (): string; (_: string): Accordion; };
|
|
124
|
-
titleBackgroundColor: { (): any; (_: any): Accordion; };
|
|
125
|
-
defaultCollapsed: { (): boolean; (_: boolean): Accordion; };
|
|
126
|
-
}
|
|
127
|
-
Accordion.prototype._class += " layout_Accordion";
|
|
128
|
-
|
|
129
|
-
Accordion.prototype.publish("content", [], "widgetArray", "Array of widgets", null, { tags: ["Basic"] });
|
|
130
|
-
Accordion.prototype.publish("title", "", "string", "Title of collapsible section", null, { tags: ["Private"] });
|
|
131
|
-
Accordion.prototype.publish("openIcon", "\uf147", "string", "Icon to display when list is open", null, { tags: ["Private"] });
|
|
132
|
-
Accordion.prototype.publish("closedIcon", "\uf196", "string", "Icon to display when list is closed", null, { tags: ["Private"] });
|
|
133
|
-
Accordion.prototype.publish("titleFontColor", "#FFFFFF", "html-color", "Title font color", null, { tags: ["Private"] });
|
|
134
|
-
Accordion.prototype.publish("titleBackgroundColor", "#333333", "html-color", "Title background color", null, { tags: ["Private"] });
|
|
135
|
-
|
|
136
|
-
Accordion.prototype.publish("defaultCollapsed", false, "boolean", "Collapsed by default if true", null, { tags: ["Private"] });
|
|
1
|
+
import { FAChar, HTMLWidget } from "@hpcc-js/common";
|
|
2
|
+
|
|
3
|
+
import "../src/Accordion.css";
|
|
4
|
+
|
|
5
|
+
export class Accordion extends HTMLWidget {
|
|
6
|
+
protected _isClosed: boolean;
|
|
7
|
+
titleSpan;
|
|
8
|
+
iconDiv;
|
|
9
|
+
ul;
|
|
10
|
+
icon;
|
|
11
|
+
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
|
|
15
|
+
this._tag = "div";
|
|
16
|
+
this._isClosed = false;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
pushListItem(widget, prepend: boolean = false, protect: boolean = false) {
|
|
20
|
+
const contentArr = this.content();
|
|
21
|
+
|
|
22
|
+
widget._protected = protect;
|
|
23
|
+
|
|
24
|
+
if (prepend) {
|
|
25
|
+
contentArr.unshift(widget);
|
|
26
|
+
} else {
|
|
27
|
+
contentArr.push(widget);
|
|
28
|
+
}
|
|
29
|
+
this.content(contentArr);
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
clearListItems() {
|
|
34
|
+
const arr = [];
|
|
35
|
+
for (const i in this.content()) {
|
|
36
|
+
if (this.content()[i]._protected) {
|
|
37
|
+
arr.push(this.content()[i]);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
this.content(arr);
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
collapseClick(element) {
|
|
45
|
+
if (element.classed("closed")) {
|
|
46
|
+
this._isClosed = false;
|
|
47
|
+
element.classed("open", true);
|
|
48
|
+
element.classed("closed", false);
|
|
49
|
+
} else {
|
|
50
|
+
this._isClosed = true;
|
|
51
|
+
element.classed("open", false);
|
|
52
|
+
element.classed("closed", true);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
enter(domNode, element) {
|
|
57
|
+
super.enter(domNode, element);
|
|
58
|
+
const context = this;
|
|
59
|
+
this._isClosed = this.defaultCollapsed();
|
|
60
|
+
element.classed(this._isClosed ? "closed" : "open", true);
|
|
61
|
+
|
|
62
|
+
this.titleSpan = element.append("span").classed("collapsible-title", true);
|
|
63
|
+
this.iconDiv = element.append("div").classed("collapsible-icon", true);
|
|
64
|
+
this.ul = element.append("ul");
|
|
65
|
+
|
|
66
|
+
this.icon = new FAChar()
|
|
67
|
+
.size({ height: 24, width: 24 })
|
|
68
|
+
.target(this.iconDiv.node());
|
|
69
|
+
|
|
70
|
+
this.iconDiv.on("click", function () {
|
|
71
|
+
context.collapseClick(element);
|
|
72
|
+
context.render();
|
|
73
|
+
});
|
|
74
|
+
this.titleSpan.on("click", function () {
|
|
75
|
+
context.collapseClick(element);
|
|
76
|
+
context.render();
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
update(domNode, element) {
|
|
81
|
+
super.update(domNode, element);
|
|
82
|
+
const context = this;
|
|
83
|
+
const this_id = "";
|
|
84
|
+
this.titleSpan.text(context.title().length > 0 ? context.title() + this_id : "Accordion [" + context._id + "]" + this_id);
|
|
85
|
+
const rows = this.ul.selectAll("#" + context._id + " > ul > li").data(this.content(), function (d) {
|
|
86
|
+
return d._id;
|
|
87
|
+
});
|
|
88
|
+
rows.enter()
|
|
89
|
+
.append(function (widget) {
|
|
90
|
+
const li = document.createElement("li");
|
|
91
|
+
if (widget._target === null) {
|
|
92
|
+
const wSize = widget.size();
|
|
93
|
+
if (wSize.width === 0 || wSize.height === 0) {
|
|
94
|
+
const cSize = context.size();
|
|
95
|
+
widget.size({
|
|
96
|
+
width: cSize.width,
|
|
97
|
+
height: cSize.width
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
widget.target(li);
|
|
101
|
+
} else {
|
|
102
|
+
return widget._target;
|
|
103
|
+
}
|
|
104
|
+
return li;
|
|
105
|
+
})
|
|
106
|
+
;
|
|
107
|
+
rows.exit().remove();
|
|
108
|
+
|
|
109
|
+
this.icon
|
|
110
|
+
.text_colorFill(this.titleFontColor())
|
|
111
|
+
.char(this._isClosed ? this.closedIcon() : this.openIcon()).render()
|
|
112
|
+
;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
exit(domNode, element) {
|
|
116
|
+
super.exit(domNode, element);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
content: { (): any[]; (_: any[]): Accordion; };
|
|
120
|
+
title: { (): string; (_: string): Accordion; };
|
|
121
|
+
openIcon: { (): string; (_: string): Accordion; };
|
|
122
|
+
closedIcon: { (): string; (_: string): Accordion; };
|
|
123
|
+
titleFontColor: { (): string; (_: string): Accordion; };
|
|
124
|
+
titleBackgroundColor: { (): any; (_: any): Accordion; };
|
|
125
|
+
defaultCollapsed: { (): boolean; (_: boolean): Accordion; };
|
|
126
|
+
}
|
|
127
|
+
Accordion.prototype._class += " layout_Accordion";
|
|
128
|
+
|
|
129
|
+
Accordion.prototype.publish("content", [], "widgetArray", "Array of widgets", null, { tags: ["Basic"] });
|
|
130
|
+
Accordion.prototype.publish("title", "", "string", "Title of collapsible section", null, { tags: ["Private"] });
|
|
131
|
+
Accordion.prototype.publish("openIcon", "\uf147", "string", "Icon to display when list is open", null, { tags: ["Private"] });
|
|
132
|
+
Accordion.prototype.publish("closedIcon", "\uf196", "string", "Icon to display when list is closed", null, { tags: ["Private"] });
|
|
133
|
+
Accordion.prototype.publish("titleFontColor", "#FFFFFF", "html-color", "Title font color", null, { tags: ["Private"] });
|
|
134
|
+
Accordion.prototype.publish("titleBackgroundColor", "#333333", "html-color", "Title background color", null, { tags: ["Private"] });
|
|
135
|
+
|
|
136
|
+
Accordion.prototype.publish("defaultCollapsed", false, "boolean", "Collapsed by default if true", null, { tags: ["Private"] });
|