@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/src/Surface.ts CHANGED
@@ -1,223 +1,223 @@
1
- import { HTMLWidget, Widget } from "@hpcc-js/common";
2
- import { select as d3Select } from "d3-selection";
3
-
4
- import "../src/Surface.css";
5
-
6
- export class Surface extends HTMLWidget {
7
- _surfaceButtons;
8
-
9
- constructor() {
10
- super();
11
-
12
- this._tag = "div";
13
- this._surfaceButtons = [];
14
- }
15
-
16
- widgetSize(titleDiv, widgetDiv) {
17
- let width = this.clientWidth();
18
- let height = this.clientHeight();
19
- if (this.title()) {
20
- height -= this.calcHeight(titleDiv);
21
- }
22
- height -= this.calcFrameHeight(widgetDiv);
23
- width -= this.calcFrameWidth(widgetDiv);
24
- return { width, height };
25
- }
26
-
27
- enter(domNode, element) {
28
- super.enter(domNode, element);
29
- }
30
-
31
- update(domNode, element2) {
32
- super.update(domNode, element2);
33
- const context = this;
34
-
35
- element2
36
- .classed("shadow2", this.surfaceShadow())
37
- .style("border-width", this.surfaceBorderWidth_exists() ? this.surfaceBorderWidth() + "px" : null)
38
- .style("border-color", this.surfaceBorderColor())
39
- .style("border-radius", this.surfaceBorderRadius_exists() ? this.surfaceBorderRadius() + "px" : null)
40
- .style("background-color", this.surfaceBackgroundColor())
41
- ;
42
-
43
- const titles = element2.selectAll(".surfaceTitle").data(this.title() ? [this.title()] : []);
44
- titles.enter().insert("h3", "div")
45
- .attr("class", "surfaceTitle")
46
- .merge(titles)
47
- .text(function (d) { return d; })
48
- .style("text-align", this.surfaceTitleAlignment())
49
- .style("color", this.surfaceTitleFontColor())
50
- .style("font-size", this.surfaceTitleFontSize_exists() ? this.surfaceTitleFontSize() + "px" : null)
51
- .style("font-family", this.surfaceTitleFontFamily())
52
- .style("font-weight", this.surfaceTitleFontBold() ? "bold" : "normal")
53
- .style("background-color", this.surfaceTitleBackgroundColor())
54
- .style("padding", this.surfaceTitlePadding_exists() ? this.surfaceTitlePadding() + "px" : null)
55
- .style("title", this.altText_exists() ? this.altText() : null)
56
- ;
57
- titles.exit().remove();
58
-
59
- const surfaceTitle = element2.select(".surfaceTitle");
60
-
61
- const surfaceButtons = surfaceTitle.append("div").attr("class", "html-button-container").selectAll(".surface-button").data(this.buttonAnnotations());
62
- surfaceButtons.enter().append("button").classed("surface-button", true)
63
- .each(function (button, idx) {
64
- const el = context._surfaceButtons[idx] = d3Select(this)
65
- .attr("class", "surface-button" + (button.class ? " " + button.class : ""))
66
- .attr("id", button.id)
67
- .style("padding", button.padding)
68
- .style("width", button.width)
69
- .style("height", button.height)
70
- .style("cursor", "pointer");
71
- if (button.font === "FontAwesome") {
72
- el
73
- .style("background", "transparent")
74
- .style("border", "none")
75
- .on("click", function (d) { context.click(d); })
76
- .append("i")
77
- .attr("class", "fa")
78
- .text(function () { return button.label; });
79
- } else {
80
- el
81
- .text(function () { return button.label; })
82
- .on("click", function (d) { context.click(d); });
83
- }
84
- })
85
- ;
86
- surfaceButtons.exit()
87
- .each(function (_d, idx) {
88
- const element = d3Select(this);
89
- delete context._surfaceButtons[idx];
90
- element.remove();
91
- })
92
- ;
93
- const widgets = element2.selectAll("#" + this._id + " > .surfaceWidget").data(this.widget() ? [this.widget()] : [], function (d) { return d._id; });
94
-
95
- widgets.enter().append("div")
96
- .attr("class", "surfaceWidget")
97
- .each(function (d) {
98
- d3Select(context.element().node().parentElement).classed("content-icon content-icon-" + (d.classID().split("_")[1]), true);
99
- d.target(this);
100
- })
101
- .merge(widgets)
102
- .style("padding", this.surfacePadding_exists() ? this.surfacePadding() + "px" : null)
103
- .each(function (d) {
104
- const widgetSize = context.widgetSize(element2.select("h3"), d3Select(this));
105
- if (widgetSize.width < 0) widgetSize.width = 0;
106
- if (widgetSize.height < 0) widgetSize.height = 0;
107
- d
108
- .resize({ width: widgetSize.width, height: widgetSize.height })
109
- ;
110
- })
111
- ;
112
- widgets.exit().each(function (d) {
113
- d.target(null);
114
- }).remove();
115
- }
116
-
117
- exit(domNode, element) {
118
- if (this.widget()) {
119
- this.widget().target(null);
120
- }
121
- super.exit(domNode, element);
122
- }
123
-
124
- // Events ---
125
- click(obj) {
126
- }
127
- }
128
- Surface.prototype._class += " layout_Surface";
129
-
130
- export interface Surface {
131
- /*
132
- title: { (): string; (_: string): Surface; };
133
- altText: { (): string; (_: string): Surface; };
134
- altText_exists: () => boolean;
135
- surfaceTitlePadding: { (): number; (_: number): Surface; };
136
- surfaceTitlePadding_exists: () => boolean;
137
- surfaceTitleFontSize: { (): number; (_: number): Surface; };
138
- surfaceTitleFontSize_exists: () => boolean;
139
- surfaceTitleFontColor: { (): string; (_: string): Surface; };
140
- surfaceTitleFontFamily: { (): string; (_: string): Surface; };
141
- surfaceTitleFontBold: { (): boolean; (_: boolean): Surface; };
142
- surfaceTitleBackgroundColor: { (): string; (_: string): Surface; };
143
- surfaceTitleAlignment: { (): string; (_: string): Surface; };
144
-
145
- surfaceShadow: { (): boolean; (_: boolean): Surface; };
146
- surfacePadding: { (): string; (_: string): Surface; };
147
- surfacePadding_exists: () => boolean;
148
- surfaceBackgroundColor: { (): string; (_: string): Surface; };
149
- surfaceBorderWidth: { (): number; (_: number): Surface; };
150
- surfaceBorderWidth_exists: () => boolean;
151
- surfaceBorderColor: { (): string; (_: string): Surface; };
152
- surfaceBorderRadius: { (): number; (_: number): Surface; };
153
- surfaceBorderRadius_exists: () => boolean;
154
-
155
- buttonAnnotations: { (): any[]; (_: any[]): Surface; };
156
-
157
- widget: { (): Widget; (_: Widget): Surface; };
158
- */
159
- title(): string;
160
- title(_: string): this;
161
- altText(): string;
162
- altText(_: string): this;
163
- altText_exists(): boolean;
164
- surfaceTitlePadding(): number;
165
- surfaceTitlePadding(_: number): this;
166
- surfaceTitlePadding_exists(): boolean;
167
- surfaceTitleFontSize(): number;
168
- surfaceTitleFontSize(_: number): this;
169
- surfaceTitleFontSize_exists(): boolean;
170
- surfaceTitleFontColor(): string;
171
- surfaceTitleFontColor(_: string): this;
172
- surfaceTitleFontFamily(): string;
173
- surfaceTitleFontFamily(_: string): this;
174
- surfaceTitleFontBold(): boolean;
175
- surfaceTitleFontBold(_: boolean): this;
176
- surfaceTitleBackgroundColor(): string;
177
- surfaceTitleBackgroundColor(_: string): this;
178
- surfaceTitleAlignment(): string;
179
- surfaceTitleAlignment(_: string): this;
180
-
181
- surfaceShadow(): boolean;
182
- surfaceShadow(_: boolean): this;
183
- surfacePadding(): string;
184
- surfacePadding(_: string): this;
185
- surfacePadding_exists(): boolean;
186
- surfaceBackgroundColor(): string;
187
- surfaceBackgroundColor(_: string): this;
188
- surfaceBorderWidth(): number;
189
- surfaceBorderWidth(_: number): this;
190
- surfaceBorderWidth_exists(): boolean;
191
- surfaceBorderColor(): string;
192
- surfaceBorderColor(_: string): this;
193
- surfaceBorderRadius(): number;
194
- surfaceBorderRadius(_: number): this;
195
- surfaceBorderRadius_exists(): boolean;
196
-
197
- buttonAnnotations(): any[];
198
- buttonAnnotations(_: any[]): this;
199
-
200
- widget(): Widget;
201
- widget(_: Widget): this;
202
- }
203
-
204
- Surface.prototype.publish("title", "", "string", "Title", null, { tags: ["Intermediate"] });
205
- Surface.prototype.publish("altText", null, "string", "Alt text", null, { optional: true });
206
- Surface.prototype.publish("surfaceTitlePadding", null, "number", "Title Padding (px)", null, { tags: ["Advanced"], disable: (w: any) => !w.title() });
207
- Surface.prototype.publish("surfaceTitleFontSize", null, "number", "Title Font Size (px)", null, { tags: ["Advanced"], disable: (w: any) => !w.title() });
208
- Surface.prototype.publish("surfaceTitleFontColor", null, "html-color", "Title Font Color", null, { tags: ["Advanced"], disable: (w: any) => !w.title() });
209
- Surface.prototype.publish("surfaceTitleFontFamily", null, "string", "Title Font Family", null, { tags: ["Advanced"], disable: (w: any) => !w.title() });
210
- Surface.prototype.publish("surfaceTitleFontBold", true, "boolean", "Enable Bold Title Font", null, { tags: ["Advanced"], disable: (w: any) => !w.title() });
211
- Surface.prototype.publish("surfaceTitleBackgroundColor", null, "html-color", "Title Background Color", null, { tags: ["Advanced"], disable: (w: any) => !w.title() });
212
- Surface.prototype.publish("surfaceTitleAlignment", "center", "set", "Title Alignment", ["left", "right", "center"], { tags: ["Basic"], disable: (w: any) => !w.title() });
213
-
214
- Surface.prototype.publish("surfaceShadow", false, "boolean", "3D Shadow");
215
- Surface.prototype.publish("surfacePadding", null, "string", "Surface Padding (px)", null, { tags: ["Intermediate"] });
216
- Surface.prototype.publish("surfaceBackgroundColor", null, "html-color", "Surface Background Color", null, { tags: ["Advanced"] });
217
- Surface.prototype.publish("surfaceBorderWidth", null, "number", "Surface Border Width (px)", null, { tags: ["Advanced"] });
218
- Surface.prototype.publish("surfaceBorderColor", null, "html-color", "Surface Border Color", null, { tags: ["Advanced"] });
219
- Surface.prototype.publish("surfaceBorderRadius", null, "number", "Surface Border Radius (px)", null, { tags: ["Advanced"] });
220
-
221
- Surface.prototype.publish("buttonAnnotations", [], "array", "Button Array", null, { tags: ["Private"] });
222
-
223
- Surface.prototype.publish("widget", null, "widget", "Widget", null, { tags: ["Basic"] });
1
+ import { HTMLWidget, Widget } from "@hpcc-js/common";
2
+ import { select as d3Select } from "d3-selection";
3
+
4
+ import "../src/Surface.css";
5
+
6
+ export class Surface extends HTMLWidget {
7
+ _surfaceButtons;
8
+
9
+ constructor() {
10
+ super();
11
+
12
+ this._tag = "div";
13
+ this._surfaceButtons = [];
14
+ }
15
+
16
+ widgetSize(titleDiv, widgetDiv) {
17
+ let width = this.clientWidth();
18
+ let height = this.clientHeight();
19
+ if (this.title()) {
20
+ height -= this.calcHeight(titleDiv);
21
+ }
22
+ height -= this.calcFrameHeight(widgetDiv);
23
+ width -= this.calcFrameWidth(widgetDiv);
24
+ return { width, height };
25
+ }
26
+
27
+ enter(domNode, element) {
28
+ super.enter(domNode, element);
29
+ }
30
+
31
+ update(domNode, element2) {
32
+ super.update(domNode, element2);
33
+ const context = this;
34
+
35
+ element2
36
+ .classed("shadow2", this.surfaceShadow())
37
+ .style("border-width", this.surfaceBorderWidth_exists() ? this.surfaceBorderWidth() + "px" : null)
38
+ .style("border-color", this.surfaceBorderColor())
39
+ .style("border-radius", this.surfaceBorderRadius_exists() ? this.surfaceBorderRadius() + "px" : null)
40
+ .style("background-color", this.surfaceBackgroundColor())
41
+ ;
42
+
43
+ const titles = element2.selectAll(".surfaceTitle").data(this.title() ? [this.title()] : []);
44
+ titles.enter().insert("h3", "div")
45
+ .attr("class", "surfaceTitle")
46
+ .merge(titles)
47
+ .text(function (d) { return d; })
48
+ .style("text-align", this.surfaceTitleAlignment())
49
+ .style("color", this.surfaceTitleFontColor())
50
+ .style("font-size", this.surfaceTitleFontSize_exists() ? this.surfaceTitleFontSize() + "px" : null)
51
+ .style("font-family", this.surfaceTitleFontFamily())
52
+ .style("font-weight", this.surfaceTitleFontBold() ? "bold" : "normal")
53
+ .style("background-color", this.surfaceTitleBackgroundColor())
54
+ .style("padding", this.surfaceTitlePadding_exists() ? this.surfaceTitlePadding() + "px" : null)
55
+ .style("title", this.altText_exists() ? this.altText() : null)
56
+ ;
57
+ titles.exit().remove();
58
+
59
+ const surfaceTitle = element2.select(".surfaceTitle");
60
+
61
+ const surfaceButtons = surfaceTitle.append("div").attr("class", "html-button-container").selectAll(".surface-button").data(this.buttonAnnotations());
62
+ surfaceButtons.enter().append("button").classed("surface-button", true)
63
+ .each(function (button, idx) {
64
+ const el = context._surfaceButtons[idx] = d3Select(this)
65
+ .attr("class", "surface-button" + (button.class ? " " + button.class : ""))
66
+ .attr("id", button.id)
67
+ .style("padding", button.padding)
68
+ .style("width", button.width)
69
+ .style("height", button.height)
70
+ .style("cursor", "pointer");
71
+ if (button.font === "FontAwesome") {
72
+ el
73
+ .style("background", "transparent")
74
+ .style("border", "none")
75
+ .on("click", function (d) { context.click(d); })
76
+ .append("i")
77
+ .attr("class", "fa")
78
+ .text(function () { return button.label; });
79
+ } else {
80
+ el
81
+ .text(function () { return button.label; })
82
+ .on("click", function (d) { context.click(d); });
83
+ }
84
+ })
85
+ ;
86
+ surfaceButtons.exit()
87
+ .each(function (_d, idx) {
88
+ const element = d3Select(this);
89
+ delete context._surfaceButtons[idx];
90
+ element.remove();
91
+ })
92
+ ;
93
+ const widgets = element2.selectAll("#" + this._id + " > .surfaceWidget").data(this.widget() ? [this.widget()] : [], function (d) { return d._id; });
94
+
95
+ widgets.enter().append("div")
96
+ .attr("class", "surfaceWidget")
97
+ .each(function (d) {
98
+ d3Select(context.element().node().parentElement).classed("content-icon content-icon-" + (d.classID().split("_")[1]), true);
99
+ d.target(this);
100
+ })
101
+ .merge(widgets)
102
+ .style("padding", this.surfacePadding_exists() ? this.surfacePadding() + "px" : null)
103
+ .each(function (d) {
104
+ const widgetSize = context.widgetSize(element2.select("h3"), d3Select(this));
105
+ if (widgetSize.width < 0) widgetSize.width = 0;
106
+ if (widgetSize.height < 0) widgetSize.height = 0;
107
+ d
108
+ .resize({ width: widgetSize.width, height: widgetSize.height })
109
+ ;
110
+ })
111
+ ;
112
+ widgets.exit().each(function (d) {
113
+ d.target(null);
114
+ }).remove();
115
+ }
116
+
117
+ exit(domNode, element) {
118
+ if (this.widget()) {
119
+ this.widget().target(null);
120
+ }
121
+ super.exit(domNode, element);
122
+ }
123
+
124
+ // Events ---
125
+ click(obj) {
126
+ }
127
+ }
128
+ Surface.prototype._class += " layout_Surface";
129
+
130
+ export interface Surface {
131
+ /*
132
+ title: { (): string; (_: string): Surface; };
133
+ altText: { (): string; (_: string): Surface; };
134
+ altText_exists: () => boolean;
135
+ surfaceTitlePadding: { (): number; (_: number): Surface; };
136
+ surfaceTitlePadding_exists: () => boolean;
137
+ surfaceTitleFontSize: { (): number; (_: number): Surface; };
138
+ surfaceTitleFontSize_exists: () => boolean;
139
+ surfaceTitleFontColor: { (): string; (_: string): Surface; };
140
+ surfaceTitleFontFamily: { (): string; (_: string): Surface; };
141
+ surfaceTitleFontBold: { (): boolean; (_: boolean): Surface; };
142
+ surfaceTitleBackgroundColor: { (): string; (_: string): Surface; };
143
+ surfaceTitleAlignment: { (): string; (_: string): Surface; };
144
+
145
+ surfaceShadow: { (): boolean; (_: boolean): Surface; };
146
+ surfacePadding: { (): string; (_: string): Surface; };
147
+ surfacePadding_exists: () => boolean;
148
+ surfaceBackgroundColor: { (): string; (_: string): Surface; };
149
+ surfaceBorderWidth: { (): number; (_: number): Surface; };
150
+ surfaceBorderWidth_exists: () => boolean;
151
+ surfaceBorderColor: { (): string; (_: string): Surface; };
152
+ surfaceBorderRadius: { (): number; (_: number): Surface; };
153
+ surfaceBorderRadius_exists: () => boolean;
154
+
155
+ buttonAnnotations: { (): any[]; (_: any[]): Surface; };
156
+
157
+ widget: { (): Widget; (_: Widget): Surface; };
158
+ */
159
+ title(): string;
160
+ title(_: string): this;
161
+ altText(): string;
162
+ altText(_: string): this;
163
+ altText_exists(): boolean;
164
+ surfaceTitlePadding(): number;
165
+ surfaceTitlePadding(_: number): this;
166
+ surfaceTitlePadding_exists(): boolean;
167
+ surfaceTitleFontSize(): number;
168
+ surfaceTitleFontSize(_: number): this;
169
+ surfaceTitleFontSize_exists(): boolean;
170
+ surfaceTitleFontColor(): string;
171
+ surfaceTitleFontColor(_: string): this;
172
+ surfaceTitleFontFamily(): string;
173
+ surfaceTitleFontFamily(_: string): this;
174
+ surfaceTitleFontBold(): boolean;
175
+ surfaceTitleFontBold(_: boolean): this;
176
+ surfaceTitleBackgroundColor(): string;
177
+ surfaceTitleBackgroundColor(_: string): this;
178
+ surfaceTitleAlignment(): string;
179
+ surfaceTitleAlignment(_: string): this;
180
+
181
+ surfaceShadow(): boolean;
182
+ surfaceShadow(_: boolean): this;
183
+ surfacePadding(): string;
184
+ surfacePadding(_: string): this;
185
+ surfacePadding_exists(): boolean;
186
+ surfaceBackgroundColor(): string;
187
+ surfaceBackgroundColor(_: string): this;
188
+ surfaceBorderWidth(): number;
189
+ surfaceBorderWidth(_: number): this;
190
+ surfaceBorderWidth_exists(): boolean;
191
+ surfaceBorderColor(): string;
192
+ surfaceBorderColor(_: string): this;
193
+ surfaceBorderRadius(): number;
194
+ surfaceBorderRadius(_: number): this;
195
+ surfaceBorderRadius_exists(): boolean;
196
+
197
+ buttonAnnotations(): any[];
198
+ buttonAnnotations(_: any[]): this;
199
+
200
+ widget(): Widget;
201
+ widget(_: Widget): this;
202
+ }
203
+
204
+ Surface.prototype.publish("title", "", "string", "Title", null, { tags: ["Intermediate"] });
205
+ Surface.prototype.publish("altText", null, "string", "Alt text", null, { optional: true });
206
+ Surface.prototype.publish("surfaceTitlePadding", null, "number", "Title Padding (px)", null, { tags: ["Advanced"], disable: (w: any) => !w.title() });
207
+ Surface.prototype.publish("surfaceTitleFontSize", null, "number", "Title Font Size (px)", null, { tags: ["Advanced"], disable: (w: any) => !w.title() });
208
+ Surface.prototype.publish("surfaceTitleFontColor", null, "html-color", "Title Font Color", null, { tags: ["Advanced"], disable: (w: any) => !w.title() });
209
+ Surface.prototype.publish("surfaceTitleFontFamily", null, "string", "Title Font Family", null, { tags: ["Advanced"], disable: (w: any) => !w.title() });
210
+ Surface.prototype.publish("surfaceTitleFontBold", true, "boolean", "Enable Bold Title Font", null, { tags: ["Advanced"], disable: (w: any) => !w.title() });
211
+ Surface.prototype.publish("surfaceTitleBackgroundColor", null, "html-color", "Title Background Color", null, { tags: ["Advanced"], disable: (w: any) => !w.title() });
212
+ Surface.prototype.publish("surfaceTitleAlignment", "center", "set", "Title Alignment", ["left", "right", "center"], { tags: ["Basic"], disable: (w: any) => !w.title() });
213
+
214
+ Surface.prototype.publish("surfaceShadow", false, "boolean", "3D Shadow");
215
+ Surface.prototype.publish("surfacePadding", null, "string", "Surface Padding (px)", null, { tags: ["Intermediate"] });
216
+ Surface.prototype.publish("surfaceBackgroundColor", null, "html-color", "Surface Background Color", null, { tags: ["Advanced"] });
217
+ Surface.prototype.publish("surfaceBorderWidth", null, "number", "Surface Border Width (px)", null, { tags: ["Advanced"] });
218
+ Surface.prototype.publish("surfaceBorderColor", null, "html-color", "Surface Border Color", null, { tags: ["Advanced"] });
219
+ Surface.prototype.publish("surfaceBorderRadius", null, "number", "Surface Border Radius (px)", null, { tags: ["Advanced"] });
220
+
221
+ Surface.prototype.publish("buttonAnnotations", [], "array", "Button Array", null, { tags: ["Private"] });
222
+
223
+ Surface.prototype.publish("widget", null, "widget", "Widget", null, { tags: ["Basic"] });
package/src/Tabbed.css CHANGED
@@ -1,24 +1,24 @@
1
- .layout_Tabbed .tab-button {
2
- position: relative;
3
- top: 1px;
4
- display: inline-block;
5
- border-left: 1px solid #ddd;
6
- border-top: 1px solid #ddd;
7
- border-right: 1px solid #ddd;
8
- background-color: transparent;
9
- margin-right: 4px;
10
- padding: 2px;
11
- padding-bottom: 4px;
12
- background-color: #ccc;
13
- }
14
-
15
- .layout_Tabbed .tab-button.active {
16
- background-color: white;
17
- z-index: 999;
18
- }
19
-
20
- .layout_Tabbed .on_bottom .tab-button {
21
- border-bottom: 1px solid #ddd;
22
- border-top: none;
23
- top: -1px;
1
+ .layout_Tabbed .tab-button {
2
+ position: relative;
3
+ top: 1px;
4
+ display: inline-block;
5
+ border-left: 1px solid #ddd;
6
+ border-top: 1px solid #ddd;
7
+ border-right: 1px solid #ddd;
8
+ background-color: transparent;
9
+ margin-right: 4px;
10
+ padding: 2px;
11
+ padding-bottom: 4px;
12
+ background-color: #ccc;
13
+ }
14
+
15
+ .layout_Tabbed .tab-button.active {
16
+ background-color: white;
17
+ z-index: 999;
18
+ }
19
+
20
+ .layout_Tabbed .on_bottom .tab-button {
21
+ border-bottom: 1px solid #ddd;
22
+ border-top: none;
23
+ top: -1px;
24
24
  }