@hpcc-js/common 2.73.3 → 2.73.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.
Files changed (58) hide show
  1. package/LICENSE +43 -43
  2. package/README.md +59 -59
  3. package/dist/index.es6.js +2 -2
  4. package/dist/index.es6.js.map +1 -1
  5. package/dist/index.js +2 -2
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.min.js +1 -1
  8. package/dist/index.min.js.map +1 -1
  9. package/package.json +3 -3
  10. package/src/CanvasWidget.ts +31 -31
  11. package/src/Class.ts +67 -67
  12. package/src/Database.ts +856 -856
  13. package/src/Entity.ts +235 -235
  14. package/src/EntityCard.ts +66 -66
  15. package/src/EntityPin.ts +103 -103
  16. package/src/EntityRect.css +15 -15
  17. package/src/EntityRect.ts +236 -236
  18. package/src/EntityVertex.ts +86 -86
  19. package/src/FAChar.css +2 -2
  20. package/src/FAChar.ts +82 -82
  21. package/src/HTMLWidget.ts +191 -191
  22. package/src/IList.ts +4 -4
  23. package/src/IMenu.ts +5 -5
  24. package/src/Icon.css +9 -9
  25. package/src/Icon.ts +164 -164
  26. package/src/Image.ts +95 -95
  27. package/src/List.css +13 -13
  28. package/src/List.ts +99 -99
  29. package/src/Menu.css +23 -23
  30. package/src/Menu.ts +134 -134
  31. package/src/Palette.ts +341 -341
  32. package/src/Platform.ts +125 -125
  33. package/src/ProgressBar.ts +105 -105
  34. package/src/PropertyExt.ts +793 -793
  35. package/src/ResizeSurface.css +39 -39
  36. package/src/ResizeSurface.ts +221 -221
  37. package/src/SVGWidget.ts +567 -567
  38. package/src/SVGZoomWidget.css +12 -12
  39. package/src/SVGZoomWidget.ts +426 -426
  40. package/src/Shape.css +3 -3
  41. package/src/Shape.ts +186 -186
  42. package/src/Surface.css +35 -35
  43. package/src/Surface.ts +349 -349
  44. package/src/Text.css +4 -4
  45. package/src/Text.ts +131 -131
  46. package/src/TextBox.css +4 -4
  47. package/src/TextBox.ts +168 -168
  48. package/src/TitleBar.css +99 -99
  49. package/src/TitleBar.ts +401 -401
  50. package/src/Transition.ts +45 -45
  51. package/src/Utility.ts +839 -839
  52. package/src/Widget.css +8 -8
  53. package/src/Widget.ts +730 -730
  54. package/src/WidgetArray.ts +13 -13
  55. package/src/__package__.ts +3 -3
  56. package/src/index.ts +55 -55
  57. package/types/__package__.d.ts +2 -2
  58. package/types-3.4/__package__.d.ts +2 -2
package/src/Surface.ts CHANGED
@@ -1,349 +1,349 @@
1
- import { select as d3Select } from "d3-selection";
2
- import "d3-transition";
3
- import { Icon } from "./Icon";
4
- import { Menu } from "./Menu";
5
- import { Shape } from "./Shape";
6
- import { SVGWidget } from "./SVGWidget";
7
- import { Text } from "./Text";
8
-
9
- import "../src/Surface.css";
10
-
11
- export class Surface extends SVGWidget {
12
- _origMenuParam;
13
- _origShowContent;
14
-
15
- protected _iconWidget;
16
- protected _containerWidget;
17
- protected _titleRectWidget;
18
- protected _textWidget;
19
- _menuWidget;
20
- protected _surfaceButtons;
21
-
22
- protected _clipRect;
23
- protected buttonContainer;
24
-
25
- constructor() {
26
- super();
27
-
28
- this._iconWidget = new Icon()
29
- .faChar("\uf07b")
30
- .paddingPercent(50)
31
- ;
32
- this._containerWidget = new Shape()
33
- .class("container")
34
- .shape("rect")
35
- ;
36
- this._titleRectWidget = new Shape()
37
- .class("title")
38
- .shape("rect")
39
- ;
40
- this._textWidget = new Text()
41
- .class("title")
42
- ;
43
- this._menuWidget = new Menu()
44
- .paddingPercent(0)
45
- ;
46
- const context = this;
47
- this._menuWidget.preShowMenu = function () {
48
- if (context.content() && context.content().hasOverlay()) {
49
- context.content().visible(false);
50
- }
51
- };
52
- this._menuWidget.postHideMenu = function () {
53
- if (context.content() && context.content().hasOverlay()) {
54
- context.content().visible(true);
55
- }
56
- };
57
-
58
- this._surfaceButtons = [];
59
- }
60
-
61
- enter(_domNode, _element) {
62
- super.enter(_domNode, _element);
63
- const element = _element.append("g").attr("class", "frame");
64
- const domNode = element.node();
65
- this._clipRect = element.append("defs").append("clipPath")
66
- .attr("id", this.id() + "_clip")
67
- .append("rect")
68
- .attr("x", 0)
69
- .attr("y", 0)
70
- .attr("width", this._size.width)
71
- .attr("height", this._size.height)
72
- ;
73
- this._titleRectWidget
74
- .target(domNode)
75
- .render()
76
- .display(this.showTitle() && this.showIcon())
77
- ;
78
- this._iconWidget
79
- .target(domNode)
80
- .render()
81
- ;
82
- this._menuWidget
83
- .target(_domNode)
84
- ;
85
- this._textWidget
86
- .target(domNode)
87
- ;
88
- this._containerWidget
89
- .target(domNode)
90
- ;
91
- this.buttonContainer = d3Select(this._target).append("div").attr("class", "svg-button-container");
92
- }
93
-
94
- update(domNode, element) {
95
- super.update(domNode, element);
96
- const context = this;
97
-
98
- let width = this.width() - 1;
99
- const height = this.height() - 1;
100
-
101
- this._iconWidget
102
- .display(this.showTitle() && this.showIcon())
103
- .shape(this.icon_shape())
104
- .render()
105
- ;
106
- this._menuWidget
107
- .render()
108
- ;
109
- this._textWidget
110
- .text(this.title())
111
- .display(this.showTitle())
112
- .render()
113
- ;
114
-
115
- const surfaceButtons = this.buttonContainer.selectAll(".surface-button").data(this.buttonAnnotations());
116
- surfaceButtons.enter().append("button").attr("class", "surface-button")
117
- .each(function (button, idx) {
118
- const el = context._surfaceButtons[idx] = d3Select(this)
119
- .attr("class", "surface-button " + (button.class ? button.class : ""))
120
- .attr("id", button.id)
121
- .style("padding", button.padding)
122
- .style("width", button.width)
123
- .style("height", button.height)
124
- .style("cursor", "pointer")
125
- .on("click", function (d) { context.click(d); });
126
- if (button.font === "FontAwesome") {
127
- el
128
- .append("i")
129
- .attr("class", "fa")
130
- .text(function () { return button.label; });
131
- } else {
132
- el
133
- .text(function () { return button.label; });
134
- }
135
- })
136
- ;
137
- surfaceButtons.exit()
138
- .each(function (_d, idx) {
139
- const element2 = d3Select(this);
140
- delete context._surfaceButtons[idx];
141
- element2.remove();
142
- })
143
- ;
144
-
145
- const buttonClientHeight = this.showTitle() ? Math.max.apply(null, this._surfaceButtons.map(function (d) { return d.node().offsetHeight; })) : 0;
146
- const iconClientSize = this.showTitle() && this.showIcon() ? this._iconWidget.getBBox(true) : { width: 0, height: 0 };
147
- const textClientSize = this._textWidget.getBBox(true);
148
- const menuClientSize = this._menuWidget.getBBox(true);
149
- const _titleRegionHeight = Math.max(iconClientSize.height, textClientSize.height, menuClientSize.height, buttonClientHeight);
150
- const titleRegionHeight = this.showTitle() ? _titleRegionHeight : 0;
151
- const yTitle = (-height + _titleRegionHeight) / 2;
152
-
153
- const titleTextHeight = this.showTitle() ? Math.max(textClientSize.height, menuClientSize.height, buttonClientHeight) : 0;
154
- const titleTextWidth = this.showTitle() ? textClientSize.width + menuClientSize.width : 0;
155
- if (titleTextWidth > width) {
156
- width = titleTextWidth;
157
- }
158
-
159
- const topMargin = titleRegionHeight <= titleTextHeight ? 0 : (titleRegionHeight - titleTextHeight) / 2;
160
- const leftMargin = topMargin;
161
-
162
- this._titleRectWidget
163
- .pos({ x: leftMargin, y: yTitle })
164
- .width(width - leftMargin * 2)
165
- .height(titleTextHeight)
166
- .display(this.showTitle())
167
- .render()
168
- ;
169
- this._iconWidget
170
- .move({ x: -width / 2 + iconClientSize.width / 2, y: yTitle })
171
- ;
172
- this._menuWidget
173
- .move({ x: width / 2 - menuClientSize.width / 2 - this.menuPadding(), y: yTitle })
174
- ;
175
- this._textWidget
176
- .move({ x: (iconClientSize.width / 2 - menuClientSize.width / 2) / 2, y: yTitle })
177
- ;
178
-
179
- const xPos = context._titleRectWidget.node().getBoundingClientRect().left + (context._size.width - leftMargin * 2) - context.buttonGutter() - this.buttonContainer.node().offsetWidth;
180
- const yPos = context._titleRectWidget.node().getBoundingClientRect().top + ((titleTextHeight - this.buttonContainer.node().offsetHeight) / 2);
181
- if (!isNaN(xPos)) {
182
- this.buttonContainer.style("left", xPos + "px");
183
- }
184
- if (!isNaN(yPos)) {
185
- this.buttonContainer.style("top", yPos + "px");
186
- }
187
-
188
- if (this.showTitle()) {
189
- this._containerWidget
190
- .pos({ x: leftMargin / 2, y: titleRegionHeight / 2 - topMargin / 2 })
191
- .width(width - leftMargin)
192
- .height(height - titleRegionHeight + topMargin)
193
- .render()
194
- ;
195
- } else {
196
- this._containerWidget
197
- .pos({ x: 0, y: 0 })
198
- .width(width)
199
- .height(height)
200
- .render()
201
- ;
202
- }
203
-
204
- if (this.showContent()) {
205
- const xOffset = leftMargin;
206
- const yOffset = titleRegionHeight - topMargin;
207
-
208
- const content = element.selectAll(".content").data(this.content() ? [this.content()] : [], function (d) { return d._id; });
209
- content.enter().append("g")
210
- .attr("class", "content")
211
- .attr("clip-path", "url(#" + this.id() + "_clip)")
212
- .each(function (d) {
213
- d.target(this);
214
- })
215
- .merge(content)
216
- .attr("transform", "translate(" + (leftMargin / 2) + ", " + (titleRegionHeight / 2 - topMargin / 2) + ")")
217
- .each(function (d) {
218
- const padding = {
219
- left: 0,
220
- top: 0,
221
- right: 1,
222
- bottom: 1
223
- };
224
- d
225
- .resize({
226
- width: width - xOffset - (padding.left + padding.right),
227
- height: height - yOffset - (padding.top + padding.bottom)
228
- })
229
- ;
230
- })
231
- ;
232
- if (this.content()) {
233
- this._clipRect
234
- .attr("x", -(width - xOffset) / 2)
235
- .attr("y", -(height - yOffset) / 2)
236
- .attr("width", width - xOffset)
237
- .attr("height", height - yOffset)
238
- ;
239
- }
240
- content.exit().transition()
241
- .each(function (d) { d.target(null); })
242
- .remove()
243
- ;
244
- }
245
-
246
- if (this._menuWidget.element() && this._menuWidget.element().node() && this._menuWidget.element().node().parentNode) {
247
- this._menuWidget.element().node().parentNode.appendChild(this._menuWidget.element().node()); // Make sure menu is on top (Z-Order POV)
248
- }
249
- }
250
-
251
- exit(domNode, element) {
252
- this._titleRectWidget
253
- .target(null)
254
- ;
255
- this._iconWidget
256
- .target(null)
257
- ;
258
- this._menuWidget
259
- .target(null)
260
- ;
261
- this._textWidget
262
- .target(null)
263
- ;
264
- this._containerWidget
265
- .target(null)
266
- ;
267
- if (this.content()) {
268
- this.content().target(null);
269
- }
270
- super.exit(domNode, element);
271
- }
272
-
273
- intersection(pointA, pointB) {
274
- const hits = [];
275
- const i1 = this._iconWidget.intersection(pointA, pointB, this._pos);
276
- if (i1) {
277
- hits.push({ i: i1, d: this.distance(i1, pointB) });
278
- }
279
- const i2 = this._titleRectWidget.intersection(pointA, pointB);
280
- if (i2) {
281
- hits.push({ i: i2, d: this.distance(i2, pointB) });
282
- }
283
- const i3 = this._containerWidget.intersection(pointA, pointB);
284
- if (i3) {
285
- hits.push({ i: i3, d: this.distance(i3, pointB) });
286
- }
287
- let nearest = null;
288
- hits.forEach(function (item) {
289
- if (nearest === null || nearest.d > item.d) {
290
- nearest = item;
291
- }
292
- });
293
- return nearest && nearest.i ? nearest.i : null;
294
- }
295
-
296
- click(d) {
297
- }
298
-
299
- showTitle: { (): boolean; (_: boolean): Surface; };
300
- title: { (): string; (_: string): Surface; };
301
- titleFontSize: { (): string; (_: string): Surface; };
302
- showIcon: { (): boolean; (_: boolean): Surface; };
303
- icon_faChar: { (): string; (_: string): Surface; };
304
- icon_shape: { (): string; (_: string): Surface; };
305
- content: { (): any; (_: any): Surface; };
306
- buttonAnnotations: { (): any[]; (_: any[]): Surface; };
307
- buttonGutter: { (): number; (_: number): Surface; };
308
- showContent: { (): boolean; (_: boolean): Surface; };
309
- menu: { (): any[]; (_: any[]): Surface; };
310
- menuPadding: { (): number; (_: number): Surface; };
311
- }
312
- Surface.prototype._class += " common_Surface";
313
-
314
- Surface.prototype.publish("showTitle", true, "boolean", "Show Title", null, { tags: ["Basic"] });
315
- Surface.prototype.publish("title", "", "string", "Title", null, { tags: ["Basic"] });
316
- Surface.prototype.publishProxy("titleFontSize", "_textWidget", "fontSize");
317
- Surface.prototype.publish("showIcon", true, "boolean", "Show Title", null, { tags: ["Advanced"] });
318
- Surface.prototype.publishProxy("icon_faChar", "_iconWidget", "faChar");
319
- Surface.prototype.publishProxy("icon_shape", "_iconWidget", "shape");
320
-
321
- Surface.prototype.publish("content", null, "widget", "Content", null, { tags: ["Private"] });
322
-
323
- Surface.prototype.publish("buttonAnnotations", [], "array", "Button Array", null, { tags: ["Intermediate"] });
324
- Surface.prototype.publish("buttonGutter", 25, "number", "Space Between Menu and Buttons", null, { tags: ["Intermediate"] });
325
-
326
- Surface.prototype.publish("showContent", true, "boolean", "Show Content", null, { tags: ["Intermediate"] });
327
- Surface.prototype.publish("menu", [], "array", "Menu List Data", null, { tags: ["Intermediate"] });
328
- Surface.prototype.publish("menuPadding", 2, "number", "Menu Padding", null, { tags: ["Advanced"] });
329
-
330
- Surface.prototype._origMenuParam = Surface.prototype.menu;
331
- Surface.prototype.menu = function (this: Surface, _?) {
332
- Surface.prototype._origMenuParam.apply(this, arguments);
333
- if (arguments.length) {
334
- this._menuWidget.data(_);
335
- return this;
336
- }
337
- return this._menuWidget.data();
338
- };
339
-
340
- Surface.prototype._origShowContent = Surface.prototype.showContent;
341
- Surface.prototype.showContent = function (_?) {
342
- const retVal = Surface.prototype._origShowContent.apply(this, arguments);
343
- if (arguments.length) {
344
- if (this.content()) {
345
- this.content().visible(this.showContent());
346
- }
347
- }
348
- return retVal;
349
- };
1
+ import { select as d3Select } from "d3-selection";
2
+ import "d3-transition";
3
+ import { Icon } from "./Icon";
4
+ import { Menu } from "./Menu";
5
+ import { Shape } from "./Shape";
6
+ import { SVGWidget } from "./SVGWidget";
7
+ import { Text } from "./Text";
8
+
9
+ import "../src/Surface.css";
10
+
11
+ export class Surface extends SVGWidget {
12
+ _origMenuParam;
13
+ _origShowContent;
14
+
15
+ protected _iconWidget;
16
+ protected _containerWidget;
17
+ protected _titleRectWidget;
18
+ protected _textWidget;
19
+ _menuWidget;
20
+ protected _surfaceButtons;
21
+
22
+ protected _clipRect;
23
+ protected buttonContainer;
24
+
25
+ constructor() {
26
+ super();
27
+
28
+ this._iconWidget = new Icon()
29
+ .faChar("\uf07b")
30
+ .paddingPercent(50)
31
+ ;
32
+ this._containerWidget = new Shape()
33
+ .class("container")
34
+ .shape("rect")
35
+ ;
36
+ this._titleRectWidget = new Shape()
37
+ .class("title")
38
+ .shape("rect")
39
+ ;
40
+ this._textWidget = new Text()
41
+ .class("title")
42
+ ;
43
+ this._menuWidget = new Menu()
44
+ .paddingPercent(0)
45
+ ;
46
+ const context = this;
47
+ this._menuWidget.preShowMenu = function () {
48
+ if (context.content() && context.content().hasOverlay()) {
49
+ context.content().visible(false);
50
+ }
51
+ };
52
+ this._menuWidget.postHideMenu = function () {
53
+ if (context.content() && context.content().hasOverlay()) {
54
+ context.content().visible(true);
55
+ }
56
+ };
57
+
58
+ this._surfaceButtons = [];
59
+ }
60
+
61
+ enter(_domNode, _element) {
62
+ super.enter(_domNode, _element);
63
+ const element = _element.append("g").attr("class", "frame");
64
+ const domNode = element.node();
65
+ this._clipRect = element.append("defs").append("clipPath")
66
+ .attr("id", this.id() + "_clip")
67
+ .append("rect")
68
+ .attr("x", 0)
69
+ .attr("y", 0)
70
+ .attr("width", this._size.width)
71
+ .attr("height", this._size.height)
72
+ ;
73
+ this._titleRectWidget
74
+ .target(domNode)
75
+ .render()
76
+ .display(this.showTitle() && this.showIcon())
77
+ ;
78
+ this._iconWidget
79
+ .target(domNode)
80
+ .render()
81
+ ;
82
+ this._menuWidget
83
+ .target(_domNode)
84
+ ;
85
+ this._textWidget
86
+ .target(domNode)
87
+ ;
88
+ this._containerWidget
89
+ .target(domNode)
90
+ ;
91
+ this.buttonContainer = d3Select(this._target).append("div").attr("class", "svg-button-container");
92
+ }
93
+
94
+ update(domNode, element) {
95
+ super.update(domNode, element);
96
+ const context = this;
97
+
98
+ let width = this.width() - 1;
99
+ const height = this.height() - 1;
100
+
101
+ this._iconWidget
102
+ .display(this.showTitle() && this.showIcon())
103
+ .shape(this.icon_shape())
104
+ .render()
105
+ ;
106
+ this._menuWidget
107
+ .render()
108
+ ;
109
+ this._textWidget
110
+ .text(this.title())
111
+ .display(this.showTitle())
112
+ .render()
113
+ ;
114
+
115
+ const surfaceButtons = this.buttonContainer.selectAll(".surface-button").data(this.buttonAnnotations());
116
+ surfaceButtons.enter().append("button").attr("class", "surface-button")
117
+ .each(function (button, idx) {
118
+ const el = context._surfaceButtons[idx] = d3Select(this)
119
+ .attr("class", "surface-button " + (button.class ? button.class : ""))
120
+ .attr("id", button.id)
121
+ .style("padding", button.padding)
122
+ .style("width", button.width)
123
+ .style("height", button.height)
124
+ .style("cursor", "pointer")
125
+ .on("click", function (d) { context.click(d); });
126
+ if (button.font === "FontAwesome") {
127
+ el
128
+ .append("i")
129
+ .attr("class", "fa")
130
+ .text(function () { return button.label; });
131
+ } else {
132
+ el
133
+ .text(function () { return button.label; });
134
+ }
135
+ })
136
+ ;
137
+ surfaceButtons.exit()
138
+ .each(function (_d, idx) {
139
+ const element2 = d3Select(this);
140
+ delete context._surfaceButtons[idx];
141
+ element2.remove();
142
+ })
143
+ ;
144
+
145
+ const buttonClientHeight = this.showTitle() ? Math.max.apply(null, this._surfaceButtons.map(function (d) { return d.node().offsetHeight; })) : 0;
146
+ const iconClientSize = this.showTitle() && this.showIcon() ? this._iconWidget.getBBox(true) : { width: 0, height: 0 };
147
+ const textClientSize = this._textWidget.getBBox(true);
148
+ const menuClientSize = this._menuWidget.getBBox(true);
149
+ const _titleRegionHeight = Math.max(iconClientSize.height, textClientSize.height, menuClientSize.height, buttonClientHeight);
150
+ const titleRegionHeight = this.showTitle() ? _titleRegionHeight : 0;
151
+ const yTitle = (-height + _titleRegionHeight) / 2;
152
+
153
+ const titleTextHeight = this.showTitle() ? Math.max(textClientSize.height, menuClientSize.height, buttonClientHeight) : 0;
154
+ const titleTextWidth = this.showTitle() ? textClientSize.width + menuClientSize.width : 0;
155
+ if (titleTextWidth > width) {
156
+ width = titleTextWidth;
157
+ }
158
+
159
+ const topMargin = titleRegionHeight <= titleTextHeight ? 0 : (titleRegionHeight - titleTextHeight) / 2;
160
+ const leftMargin = topMargin;
161
+
162
+ this._titleRectWidget
163
+ .pos({ x: leftMargin, y: yTitle })
164
+ .width(width - leftMargin * 2)
165
+ .height(titleTextHeight)
166
+ .display(this.showTitle())
167
+ .render()
168
+ ;
169
+ this._iconWidget
170
+ .move({ x: -width / 2 + iconClientSize.width / 2, y: yTitle })
171
+ ;
172
+ this._menuWidget
173
+ .move({ x: width / 2 - menuClientSize.width / 2 - this.menuPadding(), y: yTitle })
174
+ ;
175
+ this._textWidget
176
+ .move({ x: (iconClientSize.width / 2 - menuClientSize.width / 2) / 2, y: yTitle })
177
+ ;
178
+
179
+ const xPos = context._titleRectWidget.node().getBoundingClientRect().left + (context._size.width - leftMargin * 2) - context.buttonGutter() - this.buttonContainer.node().offsetWidth;
180
+ const yPos = context._titleRectWidget.node().getBoundingClientRect().top + ((titleTextHeight - this.buttonContainer.node().offsetHeight) / 2);
181
+ if (!isNaN(xPos)) {
182
+ this.buttonContainer.style("left", xPos + "px");
183
+ }
184
+ if (!isNaN(yPos)) {
185
+ this.buttonContainer.style("top", yPos + "px");
186
+ }
187
+
188
+ if (this.showTitle()) {
189
+ this._containerWidget
190
+ .pos({ x: leftMargin / 2, y: titleRegionHeight / 2 - topMargin / 2 })
191
+ .width(width - leftMargin)
192
+ .height(height - titleRegionHeight + topMargin)
193
+ .render()
194
+ ;
195
+ } else {
196
+ this._containerWidget
197
+ .pos({ x: 0, y: 0 })
198
+ .width(width)
199
+ .height(height)
200
+ .render()
201
+ ;
202
+ }
203
+
204
+ if (this.showContent()) {
205
+ const xOffset = leftMargin;
206
+ const yOffset = titleRegionHeight - topMargin;
207
+
208
+ const content = element.selectAll(".content").data(this.content() ? [this.content()] : [], function (d) { return d._id; });
209
+ content.enter().append("g")
210
+ .attr("class", "content")
211
+ .attr("clip-path", "url(#" + this.id() + "_clip)")
212
+ .each(function (d) {
213
+ d.target(this);
214
+ })
215
+ .merge(content)
216
+ .attr("transform", "translate(" + (leftMargin / 2) + ", " + (titleRegionHeight / 2 - topMargin / 2) + ")")
217
+ .each(function (d) {
218
+ const padding = {
219
+ left: 0,
220
+ top: 0,
221
+ right: 1,
222
+ bottom: 1
223
+ };
224
+ d
225
+ .resize({
226
+ width: width - xOffset - (padding.left + padding.right),
227
+ height: height - yOffset - (padding.top + padding.bottom)
228
+ })
229
+ ;
230
+ })
231
+ ;
232
+ if (this.content()) {
233
+ this._clipRect
234
+ .attr("x", -(width - xOffset) / 2)
235
+ .attr("y", -(height - yOffset) / 2)
236
+ .attr("width", width - xOffset)
237
+ .attr("height", height - yOffset)
238
+ ;
239
+ }
240
+ content.exit().transition()
241
+ .each(function (d) { d.target(null); })
242
+ .remove()
243
+ ;
244
+ }
245
+
246
+ if (this._menuWidget.element() && this._menuWidget.element().node() && this._menuWidget.element().node().parentNode) {
247
+ this._menuWidget.element().node().parentNode.appendChild(this._menuWidget.element().node()); // Make sure menu is on top (Z-Order POV)
248
+ }
249
+ }
250
+
251
+ exit(domNode, element) {
252
+ this._titleRectWidget
253
+ .target(null)
254
+ ;
255
+ this._iconWidget
256
+ .target(null)
257
+ ;
258
+ this._menuWidget
259
+ .target(null)
260
+ ;
261
+ this._textWidget
262
+ .target(null)
263
+ ;
264
+ this._containerWidget
265
+ .target(null)
266
+ ;
267
+ if (this.content()) {
268
+ this.content().target(null);
269
+ }
270
+ super.exit(domNode, element);
271
+ }
272
+
273
+ intersection(pointA, pointB) {
274
+ const hits = [];
275
+ const i1 = this._iconWidget.intersection(pointA, pointB, this._pos);
276
+ if (i1) {
277
+ hits.push({ i: i1, d: this.distance(i1, pointB) });
278
+ }
279
+ const i2 = this._titleRectWidget.intersection(pointA, pointB);
280
+ if (i2) {
281
+ hits.push({ i: i2, d: this.distance(i2, pointB) });
282
+ }
283
+ const i3 = this._containerWidget.intersection(pointA, pointB);
284
+ if (i3) {
285
+ hits.push({ i: i3, d: this.distance(i3, pointB) });
286
+ }
287
+ let nearest = null;
288
+ hits.forEach(function (item) {
289
+ if (nearest === null || nearest.d > item.d) {
290
+ nearest = item;
291
+ }
292
+ });
293
+ return nearest && nearest.i ? nearest.i : null;
294
+ }
295
+
296
+ click(d) {
297
+ }
298
+
299
+ showTitle: { (): boolean; (_: boolean): Surface; };
300
+ title: { (): string; (_: string): Surface; };
301
+ titleFontSize: { (): string; (_: string): Surface; };
302
+ showIcon: { (): boolean; (_: boolean): Surface; };
303
+ icon_faChar: { (): string; (_: string): Surface; };
304
+ icon_shape: { (): string; (_: string): Surface; };
305
+ content: { (): any; (_: any): Surface; };
306
+ buttonAnnotations: { (): any[]; (_: any[]): Surface; };
307
+ buttonGutter: { (): number; (_: number): Surface; };
308
+ showContent: { (): boolean; (_: boolean): Surface; };
309
+ menu: { (): any[]; (_: any[]): Surface; };
310
+ menuPadding: { (): number; (_: number): Surface; };
311
+ }
312
+ Surface.prototype._class += " common_Surface";
313
+
314
+ Surface.prototype.publish("showTitle", true, "boolean", "Show Title", null, { tags: ["Basic"] });
315
+ Surface.prototype.publish("title", "", "string", "Title", null, { tags: ["Basic"] });
316
+ Surface.prototype.publishProxy("titleFontSize", "_textWidget", "fontSize");
317
+ Surface.prototype.publish("showIcon", true, "boolean", "Show Title", null, { tags: ["Advanced"] });
318
+ Surface.prototype.publishProxy("icon_faChar", "_iconWidget", "faChar");
319
+ Surface.prototype.publishProxy("icon_shape", "_iconWidget", "shape");
320
+
321
+ Surface.prototype.publish("content", null, "widget", "Content", null, { tags: ["Private"] });
322
+
323
+ Surface.prototype.publish("buttonAnnotations", [], "array", "Button Array", null, { tags: ["Intermediate"] });
324
+ Surface.prototype.publish("buttonGutter", 25, "number", "Space Between Menu and Buttons", null, { tags: ["Intermediate"] });
325
+
326
+ Surface.prototype.publish("showContent", true, "boolean", "Show Content", null, { tags: ["Intermediate"] });
327
+ Surface.prototype.publish("menu", [], "array", "Menu List Data", null, { tags: ["Intermediate"] });
328
+ Surface.prototype.publish("menuPadding", 2, "number", "Menu Padding", null, { tags: ["Advanced"] });
329
+
330
+ Surface.prototype._origMenuParam = Surface.prototype.menu;
331
+ Surface.prototype.menu = function (this: Surface, _?) {
332
+ Surface.prototype._origMenuParam.apply(this, arguments);
333
+ if (arguments.length) {
334
+ this._menuWidget.data(_);
335
+ return this;
336
+ }
337
+ return this._menuWidget.data();
338
+ };
339
+
340
+ Surface.prototype._origShowContent = Surface.prototype.showContent;
341
+ Surface.prototype.showContent = function (_?) {
342
+ const retVal = Surface.prototype._origShowContent.apply(this, arguments);
343
+ if (arguments.length) {
344
+ if (this.content()) {
345
+ this.content().visible(this.showContent());
346
+ }
347
+ }
348
+ return retVal;
349
+ };