@hpcc-js/common 2.73.2 → 2.73.3

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 (55) hide show
  1. package/LICENSE +43 -43
  2. package/README.md +59 -59
  3. package/dist/index.es6.js +28 -28
  4. package/dist/index.es6.js.map +1 -1
  5. package/dist/index.js +30 -30
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.min.js.map +1 -1
  8. package/package.json +3 -3
  9. package/src/CanvasWidget.ts +31 -31
  10. package/src/Class.ts +67 -67
  11. package/src/Database.ts +856 -856
  12. package/src/Entity.ts +235 -235
  13. package/src/EntityCard.ts +66 -66
  14. package/src/EntityPin.ts +103 -103
  15. package/src/EntityRect.css +15 -15
  16. package/src/EntityRect.ts +236 -236
  17. package/src/EntityVertex.ts +86 -86
  18. package/src/FAChar.css +2 -2
  19. package/src/FAChar.ts +82 -82
  20. package/src/HTMLWidget.ts +191 -191
  21. package/src/IList.ts +4 -4
  22. package/src/IMenu.ts +5 -5
  23. package/src/Icon.css +9 -9
  24. package/src/Icon.ts +164 -164
  25. package/src/Image.ts +95 -95
  26. package/src/List.css +13 -13
  27. package/src/List.ts +99 -99
  28. package/src/Menu.css +23 -23
  29. package/src/Menu.ts +134 -134
  30. package/src/Palette.ts +341 -341
  31. package/src/Platform.ts +125 -125
  32. package/src/ProgressBar.ts +105 -105
  33. package/src/PropertyExt.ts +793 -793
  34. package/src/ResizeSurface.css +39 -39
  35. package/src/ResizeSurface.ts +221 -221
  36. package/src/SVGWidget.ts +567 -567
  37. package/src/SVGZoomWidget.css +12 -12
  38. package/src/SVGZoomWidget.ts +426 -426
  39. package/src/Shape.css +3 -3
  40. package/src/Shape.ts +186 -186
  41. package/src/Surface.css +35 -35
  42. package/src/Surface.ts +349 -349
  43. package/src/Text.css +4 -4
  44. package/src/Text.ts +131 -131
  45. package/src/TextBox.css +4 -4
  46. package/src/TextBox.ts +168 -168
  47. package/src/TitleBar.css +99 -99
  48. package/src/TitleBar.ts +401 -401
  49. package/src/Transition.ts +45 -45
  50. package/src/Utility.ts +839 -839
  51. package/src/Widget.css +8 -8
  52. package/src/Widget.ts +730 -730
  53. package/src/WidgetArray.ts +13 -13
  54. package/src/__package__.ts +3 -3
  55. package/src/index.ts +55 -55
package/src/TitleBar.ts CHANGED
@@ -1,401 +1,401 @@
1
- import { event as d3Event } from "d3-selection";
2
- import { HTMLWidget } from "./HTMLWidget";
3
- import { fa5Class } from "./Utility";
4
- import { Widget } from "./Widget";
5
-
6
- import "../src/TitleBar.css";
7
-
8
- // Lite button for titlebar ---
9
- export class Button extends HTMLWidget {
10
- private _enabled = true;
11
- private _i;
12
-
13
- constructor() {
14
- super();
15
- this._tag = "a";
16
- }
17
-
18
- enter(domNode: HTMLElement, element) {
19
- super.enter(domNode, element);
20
- const context = this;
21
- this._i = this._element
22
- .attr("href", "#")
23
- .on("click", function () {
24
- context.click();
25
- d3Event.preventDefault();
26
- })
27
- .on("mousemove", this.mouseMove)
28
- .on("mouseout", this.mouseOut)
29
- .append("i")
30
- ;
31
- }
32
-
33
- update(domNode: HTMLElement, element) {
34
- super.update(domNode, element);
35
- element
36
- .classed("disabled", !this.enabled())
37
- .attr("title", this.tooltip())
38
- ;
39
- this._i.attr("class", `fa ${fa5Class(this.faChar())} fa-lg fa-fw`);
40
- }
41
-
42
- // Events ---
43
- click() {
44
- }
45
-
46
- mouseMove(d, idx, groups) {
47
- }
48
-
49
- mouseOut(d, idx, groups) {
50
- }
51
-
52
- enabled(): boolean;
53
- enabled(_: boolean): this;
54
- enabled(_?: boolean): boolean | this {
55
- if (!arguments.length) return this._enabled;
56
- this._enabled = _;
57
- return this;
58
- }
59
- }
60
- Button.prototype._class += " common_Button";
61
- export interface Button {
62
- faChar(): string;
63
- faChar(_: string): this;
64
- tooltip(): string;
65
- tooltip(_: string): this;
66
- }
67
- Button.prototype.publish("faChar", "", "string", "FontAwesome class");
68
- Button.prototype.publish("tooltip", "", "string", "Displays as the button alt text attribute");
69
-
70
- // Sticky button ---
71
- export class StickyButton extends Button {
72
-
73
- enter(domNode: HTMLElement, element) {
74
- super.enter(domNode, element);
75
- }
76
-
77
- update(domNode: HTMLElement, element) {
78
- super.update(domNode, element);
79
- element.classed("selected", this.selected());
80
- }
81
- }
82
- StickyButton.prototype._class += " common_StickyButton";
83
- export interface StickyButton {
84
- selected(): boolean;
85
- selected(_: boolean): this;
86
- }
87
- StickyButton.prototype.publish("selected", false, "boolean");
88
-
89
- // Toggle button ---
90
- export class ToggleButton extends StickyButton {
91
-
92
- enter(domNode: HTMLElement, element) {
93
- element.on("click.sel", (d, idx, groups) => {
94
- this
95
- .selected(!this.selected())
96
- .render()
97
- ;
98
- d3Event.preventDefault();
99
- });
100
- super.enter(domNode, element);
101
- }
102
- }
103
- ToggleButton.prototype._class += " common_ToggleButton";
104
-
105
- // Spacer ---
106
- export class Spacer extends HTMLWidget {
107
-
108
- enter(domNode: HTMLElement, element) {
109
- super.enter(domNode, element);
110
- element
111
- .attr("class", this.vline() ? "spacer vline" : "spacer")
112
- .attr("href", "#")
113
- .append("i")
114
- ;
115
- }
116
- }
117
- Spacer.prototype._class += " common_Spacer";
118
-
119
- export interface Spacer {
120
- vline(): boolean;
121
- vline(_: boolean): this;
122
- }
123
- Spacer.prototype.publish("vline", true, "boolean");
124
-
125
- export class SelectDropDown extends HTMLWidget {
126
- private _enabled = true;
127
-
128
- constructor() {
129
- super();
130
- this._tag = "select";
131
- }
132
-
133
- enabled(): boolean;
134
- enabled(_: boolean): this;
135
- enabled(_?: boolean): boolean | this {
136
- if (!arguments.length) return this._enabled;
137
- this._enabled = _;
138
- return this;
139
- }
140
-
141
- enter(domNode: HTMLSelectElement, element) {
142
- super.enter(domNode, element);
143
- const context = this;
144
- element.on("change", function (d) {
145
- const values = context.values();
146
- for (const key in context.values()) {
147
- if (this.value === values[key]) {
148
- context.selected(key);
149
- break;
150
- }
151
- }
152
- context.click(this.value);
153
- });
154
- }
155
-
156
- update(domNode: HTMLElement, element) {
157
- super.update(domNode, element);
158
- element
159
- .classed("disabled", !this.enabled())
160
- .attr("title", this.tooltip())
161
- ;
162
-
163
- const values = this.values();
164
-
165
- const options = element.selectAll(".icon-bar-select-option").data(Object.keys(values));
166
- const optionUpdate = options.enter().append("option")
167
- .attr("class", "icon-bar-select-option")
168
- .merge(options)
169
- .attr("value", r => values[r])
170
- .attr("selected", r => r === this.selected() ? "selected" : null)
171
- .text(r => r)
172
- ;
173
- options.exit().remove();
174
- optionUpdate.order();
175
- }
176
-
177
- // Events ---
178
- click(value) {
179
- }
180
-
181
- mouseMove(d, idx, groups) {
182
- }
183
-
184
- mouseOut(d, idx, groups) {
185
- }
186
- }
187
- SelectDropDown.prototype._class += " common_SelectDropDown";
188
- export interface SelectDropDown {
189
- values(): { [key: string]: string };
190
- values(_: { [key: string]: string }): this;
191
- selected(): string;
192
- selected(_: string): this;
193
- tooltip(): string;
194
- tooltip(_: string): this;
195
- }
196
- SelectDropDown.prototype.publish("values", {}, "object", "Label, Values");
197
- SelectDropDown.prototype.publish("selected", "", "string", "Selected Item");
198
- SelectDropDown.prototype.publish("tooltip", "", "string", "Displays as the button alt text attribute");
199
-
200
- // IconBar ---
201
- export class IconBar extends HTMLWidget {
202
- _divIconBar;
203
- _buttons: Widget[] = [];
204
-
205
- constructor() {
206
- super();
207
- }
208
-
209
- enter(domNode, element) {
210
- super.enter(domNode, element);
211
- this._divIconBar = element.append("div")
212
- .attr("class", "icon-bar")
213
- ;
214
- }
215
-
216
- update(domNode, element) {
217
- super.update(domNode, element);
218
-
219
- let buttons = this.buttons().filter(button => this.hiddenButtons().indexOf(button) < 0);
220
- buttons = buttons.reduce((prev, item, idx) => {
221
- if (item instanceof Spacer) {
222
- if ((prev.length === 0 || idx === buttons.length - 1)) {
223
- return prev;
224
- } else if (buttons[idx + 1] instanceof Spacer) {
225
- return prev;
226
- }
227
- }
228
- prev.push(item);
229
- return prev;
230
- }, []);
231
- const icons = this._divIconBar.selectAll(".icon-bar-item").data(buttons, (d: Widget) => d.id());
232
- icons.enter().append("div")
233
- .attr("class", "icon-bar-item")
234
- .each(function (this: HTMLElement, d: Widget) {
235
- d.target(this);
236
- })
237
- .merge(icons)
238
- .each(function (d: Widget) {
239
- d.render();
240
- })
241
- ;
242
- icons.exit()
243
- .each(function (d: Widget) {
244
- d.target(null);
245
- })
246
- .remove()
247
- ;
248
- icons.order();
249
- }
250
-
251
- exit(domNode, element) {
252
- this.buttons().forEach(b => b.target(null));
253
- super.exit(domNode, element);
254
- }
255
- }
256
- IconBar.prototype._class += " common_IconBar";
257
-
258
- export interface IconBar {
259
- buttons(): Widget[];
260
- buttons(_: Widget[]): this;
261
- hiddenButtons(): Widget[];
262
- hiddenButtons(_: Widget[]): this;
263
- }
264
- IconBar.prototype.publish("buttons", [], "widgetArray", null, { internal: true });
265
- IconBar.prototype.publish("hiddenButtons", [], "widgetArray", null, { internal: true });
266
-
267
- // SelectionBar ---
268
- export class SelectionButton extends StickyButton {
269
- _owner: SelectionBar;
270
-
271
- enter(domNode: HTMLElement, element) {
272
- element.on("click.sel", (d, idx, groups) => {
273
- this.selected(true).render();
274
- d3Event.preventDefault();
275
- });
276
- super.enter(domNode, element);
277
- }
278
-
279
- selected(): boolean;
280
- selected(_: boolean): this;
281
- selected(_?: boolean): boolean | this {
282
- const retVal = super.selected.apply(this, arguments);
283
- if (_ && this._owner) {
284
- this._owner.buttons().filter(sb => sb !== this && sb instanceof SelectionButton).forEach((sb: SelectionButton) => sb.selected(false).render());
285
- this._owner.selected(this);
286
- }
287
- return retVal;
288
- }
289
- }
290
- SelectionButton.prototype._class += " common_SelectionButton";
291
-
292
- export class SelectionBar extends IconBar {
293
-
294
- buttons(): Array<SelectionButton | Spacer>;
295
- buttons(_: Array<SelectionButton | Spacer>): this;
296
- buttons(_?: Array<SelectionButton | Spacer>): Array<SelectionButton | Spacer> | this {
297
- const retVal = super.buttons.apply(this, arguments);
298
- if (arguments.length) {
299
- _.filter(b => b instanceof SelectionButton).forEach((sb: SelectionButton) => {
300
- sb._owner = this;
301
- });
302
- }
303
- return retVal;
304
- }
305
-
306
- // Events ---
307
- selected(row: SelectionButton) {
308
- }
309
- }
310
- SelectionBar.prototype._class += " common_SelectionBar";
311
-
312
- // Titlebar ---
313
- export class TitleBar extends IconBar {
314
-
315
- _divTitle;
316
- _divTitleIcon;
317
- _divTitleText;
318
- _divDescriptionText;
319
-
320
- constructor() {
321
- super();
322
- }
323
-
324
- enter(domNode, element) {
325
- this._divTitle = element.append("div")
326
- .attr("class", "title-title")
327
- .style("min-width", "0px")
328
- ;
329
- this._divTitleIcon = this._divTitle.append("div")
330
- .attr("class", "title-icon")
331
- .style("font-family", this.titleIconFont())
332
- .style("font-size", `${this.titleIconFontSize()}px`)
333
- .style("width", `${this.titleIconFontSize()}px`)
334
- ;
335
- this._divTitle.append("div")
336
- .attr("class", "data-count")
337
- ;
338
- this._divTitleText = this._divTitle.append("div")
339
- .attr("class", "title-text")
340
- .style("font-family", this.titleFont())
341
- .style("font-size", `${this.titleFontSize()}px`)
342
- ;
343
- this._divDescriptionText = this._divTitle.append("div")
344
- .attr("class", "description-text")
345
- .style("font-family", this.descriptionFont())
346
- ;
347
-
348
- super.enter(domNode, element);
349
- }
350
-
351
- update(domNode, element) {
352
- this._divTitleIcon
353
- .text(this.titleIcon())
354
- .style("display", this.titleIcon() !== "" ? "inline-block" : "none")
355
- ;
356
- this._divTitleText
357
- .text(this.title())
358
- .attr("title", this.title())
359
- ;
360
- this._divDescriptionText
361
- .style("display", this.description_exists() ? "block" : "none")
362
- .style("font-size", this.description_exists() ? `${this.descriptionFontSize()}px` : null)
363
- .style("line-height", this.description_exists() ? `${this.descriptionFontSize()}px` : null)
364
- .text(this.description())
365
- ;
366
-
367
- super.update(domNode, element);
368
- }
369
- }
370
- TitleBar.prototype._class += " common_TitleBar";
371
-
372
- export interface TitleBar {
373
- title(): string;
374
- title(_: string): this;
375
- titleIcon(): string;
376
- titleIcon(_: string): this;
377
- titleIconFont(): string;
378
- titleIconFont(_: string): this;
379
- titleFont(): string;
380
- titleFont(_: string): this;
381
- titleIconFontSize(): number;
382
- titleIconFontSize(_: number): this;
383
- titleFontSize(): number;
384
- titleFontSize(_: number): this;
385
- description(): string;
386
- description(_: string): this;
387
- description_exists(): boolean;
388
- descriptionFont(): string;
389
- descriptionFont(_: string): this;
390
- descriptionFontSize(): number;
391
- descriptionFontSize(_: number): this;
392
- }
393
- TitleBar.prototype.publish("titleIcon", "", "string", "Icon text");
394
- TitleBar.prototype.publish("titleIconFont", "", "string", "Icon font-family");
395
- TitleBar.prototype.publish("titleIconFontSize", 28, "number", "Icon font-size (pixels)");
396
- TitleBar.prototype.publish("title", "", "string", "Title text");
397
- TitleBar.prototype.publish("titleFont", "", "string", "Title font-family");
398
- TitleBar.prototype.publish("titleFontSize", 20, "number", "Title font-size (pixels)");
399
- TitleBar.prototype.publish("description", null, "string", "Description text", null, { optional: true });
400
- TitleBar.prototype.publish("descriptionFont", "", "string", "Description font-family");
401
- TitleBar.prototype.publish("descriptionFontSize", 10, "number", "Description font-size (pixels)");
1
+ import { event as d3Event } from "d3-selection";
2
+ import { HTMLWidget } from "./HTMLWidget";
3
+ import { fa5Class } from "./Utility";
4
+ import { Widget } from "./Widget";
5
+
6
+ import "../src/TitleBar.css";
7
+
8
+ // Lite button for titlebar ---
9
+ export class Button extends HTMLWidget {
10
+ private _enabled = true;
11
+ private _i;
12
+
13
+ constructor() {
14
+ super();
15
+ this._tag = "a";
16
+ }
17
+
18
+ enter(domNode: HTMLElement, element) {
19
+ super.enter(domNode, element);
20
+ const context = this;
21
+ this._i = this._element
22
+ .attr("href", "#")
23
+ .on("click", function () {
24
+ context.click();
25
+ d3Event.preventDefault();
26
+ })
27
+ .on("mousemove", this.mouseMove)
28
+ .on("mouseout", this.mouseOut)
29
+ .append("i")
30
+ ;
31
+ }
32
+
33
+ update(domNode: HTMLElement, element) {
34
+ super.update(domNode, element);
35
+ element
36
+ .classed("disabled", !this.enabled())
37
+ .attr("title", this.tooltip())
38
+ ;
39
+ this._i.attr("class", `fa ${fa5Class(this.faChar())} fa-lg fa-fw`);
40
+ }
41
+
42
+ // Events ---
43
+ click() {
44
+ }
45
+
46
+ mouseMove(d, idx, groups) {
47
+ }
48
+
49
+ mouseOut(d, idx, groups) {
50
+ }
51
+
52
+ enabled(): boolean;
53
+ enabled(_: boolean): this;
54
+ enabled(_?: boolean): boolean | this {
55
+ if (!arguments.length) return this._enabled;
56
+ this._enabled = _;
57
+ return this;
58
+ }
59
+ }
60
+ Button.prototype._class += " common_Button";
61
+ export interface Button {
62
+ faChar(): string;
63
+ faChar(_: string): this;
64
+ tooltip(): string;
65
+ tooltip(_: string): this;
66
+ }
67
+ Button.prototype.publish("faChar", "", "string", "FontAwesome class");
68
+ Button.prototype.publish("tooltip", "", "string", "Displays as the button alt text attribute");
69
+
70
+ // Sticky button ---
71
+ export class StickyButton extends Button {
72
+
73
+ enter(domNode: HTMLElement, element) {
74
+ super.enter(domNode, element);
75
+ }
76
+
77
+ update(domNode: HTMLElement, element) {
78
+ super.update(domNode, element);
79
+ element.classed("selected", this.selected());
80
+ }
81
+ }
82
+ StickyButton.prototype._class += " common_StickyButton";
83
+ export interface StickyButton {
84
+ selected(): boolean;
85
+ selected(_: boolean): this;
86
+ }
87
+ StickyButton.prototype.publish("selected", false, "boolean");
88
+
89
+ // Toggle button ---
90
+ export class ToggleButton extends StickyButton {
91
+
92
+ enter(domNode: HTMLElement, element) {
93
+ element.on("click.sel", (d, idx, groups) => {
94
+ this
95
+ .selected(!this.selected())
96
+ .render()
97
+ ;
98
+ d3Event.preventDefault();
99
+ });
100
+ super.enter(domNode, element);
101
+ }
102
+ }
103
+ ToggleButton.prototype._class += " common_ToggleButton";
104
+
105
+ // Spacer ---
106
+ export class Spacer extends HTMLWidget {
107
+
108
+ enter(domNode: HTMLElement, element) {
109
+ super.enter(domNode, element);
110
+ element
111
+ .attr("class", this.vline() ? "spacer vline" : "spacer")
112
+ .attr("href", "#")
113
+ .append("i")
114
+ ;
115
+ }
116
+ }
117
+ Spacer.prototype._class += " common_Spacer";
118
+
119
+ export interface Spacer {
120
+ vline(): boolean;
121
+ vline(_: boolean): this;
122
+ }
123
+ Spacer.prototype.publish("vline", true, "boolean");
124
+
125
+ export class SelectDropDown extends HTMLWidget {
126
+ private _enabled = true;
127
+
128
+ constructor() {
129
+ super();
130
+ this._tag = "select";
131
+ }
132
+
133
+ enabled(): boolean;
134
+ enabled(_: boolean): this;
135
+ enabled(_?: boolean): boolean | this {
136
+ if (!arguments.length) return this._enabled;
137
+ this._enabled = _;
138
+ return this;
139
+ }
140
+
141
+ enter(domNode: HTMLSelectElement, element) {
142
+ super.enter(domNode, element);
143
+ const context = this;
144
+ element.on("change", function (d) {
145
+ const values = context.values();
146
+ for (const key in context.values()) {
147
+ if (this.value === values[key]) {
148
+ context.selected(key);
149
+ break;
150
+ }
151
+ }
152
+ context.click(this.value);
153
+ });
154
+ }
155
+
156
+ update(domNode: HTMLElement, element) {
157
+ super.update(domNode, element);
158
+ element
159
+ .classed("disabled", !this.enabled())
160
+ .attr("title", this.tooltip())
161
+ ;
162
+
163
+ const values = this.values();
164
+
165
+ const options = element.selectAll(".icon-bar-select-option").data(Object.keys(values));
166
+ const optionUpdate = options.enter().append("option")
167
+ .attr("class", "icon-bar-select-option")
168
+ .merge(options)
169
+ .attr("value", r => values[r])
170
+ .attr("selected", r => r === this.selected() ? "selected" : null)
171
+ .text(r => r)
172
+ ;
173
+ options.exit().remove();
174
+ optionUpdate.order();
175
+ }
176
+
177
+ // Events ---
178
+ click(value) {
179
+ }
180
+
181
+ mouseMove(d, idx, groups) {
182
+ }
183
+
184
+ mouseOut(d, idx, groups) {
185
+ }
186
+ }
187
+ SelectDropDown.prototype._class += " common_SelectDropDown";
188
+ export interface SelectDropDown {
189
+ values(): { [key: string]: string };
190
+ values(_: { [key: string]: string }): this;
191
+ selected(): string;
192
+ selected(_: string): this;
193
+ tooltip(): string;
194
+ tooltip(_: string): this;
195
+ }
196
+ SelectDropDown.prototype.publish("values", {}, "object", "Label, Values");
197
+ SelectDropDown.prototype.publish("selected", "", "string", "Selected Item");
198
+ SelectDropDown.prototype.publish("tooltip", "", "string", "Displays as the button alt text attribute");
199
+
200
+ // IconBar ---
201
+ export class IconBar extends HTMLWidget {
202
+ _divIconBar;
203
+ _buttons: Widget[] = [];
204
+
205
+ constructor() {
206
+ super();
207
+ }
208
+
209
+ enter(domNode, element) {
210
+ super.enter(domNode, element);
211
+ this._divIconBar = element.append("div")
212
+ .attr("class", "icon-bar")
213
+ ;
214
+ }
215
+
216
+ update(domNode, element) {
217
+ super.update(domNode, element);
218
+
219
+ let buttons = this.buttons().filter(button => this.hiddenButtons().indexOf(button) < 0);
220
+ buttons = buttons.reduce((prev, item, idx) => {
221
+ if (item instanceof Spacer) {
222
+ if ((prev.length === 0 || idx === buttons.length - 1)) {
223
+ return prev;
224
+ } else if (buttons[idx + 1] instanceof Spacer) {
225
+ return prev;
226
+ }
227
+ }
228
+ prev.push(item);
229
+ return prev;
230
+ }, []);
231
+ const icons = this._divIconBar.selectAll(".icon-bar-item").data(buttons, (d: Widget) => d.id());
232
+ icons.enter().append("div")
233
+ .attr("class", "icon-bar-item")
234
+ .each(function (this: HTMLElement, d: Widget) {
235
+ d.target(this);
236
+ })
237
+ .merge(icons)
238
+ .each(function (d: Widget) {
239
+ d.render();
240
+ })
241
+ ;
242
+ icons.exit()
243
+ .each(function (d: Widget) {
244
+ d.target(null);
245
+ })
246
+ .remove()
247
+ ;
248
+ icons.order();
249
+ }
250
+
251
+ exit(domNode, element) {
252
+ this.buttons().forEach(b => b.target(null));
253
+ super.exit(domNode, element);
254
+ }
255
+ }
256
+ IconBar.prototype._class += " common_IconBar";
257
+
258
+ export interface IconBar {
259
+ buttons(): Widget[];
260
+ buttons(_: Widget[]): this;
261
+ hiddenButtons(): Widget[];
262
+ hiddenButtons(_: Widget[]): this;
263
+ }
264
+ IconBar.prototype.publish("buttons", [], "widgetArray", null, { internal: true });
265
+ IconBar.prototype.publish("hiddenButtons", [], "widgetArray", null, { internal: true });
266
+
267
+ // SelectionBar ---
268
+ export class SelectionButton extends StickyButton {
269
+ _owner: SelectionBar;
270
+
271
+ enter(domNode: HTMLElement, element) {
272
+ element.on("click.sel", (d, idx, groups) => {
273
+ this.selected(true).render();
274
+ d3Event.preventDefault();
275
+ });
276
+ super.enter(domNode, element);
277
+ }
278
+
279
+ selected(): boolean;
280
+ selected(_: boolean): this;
281
+ selected(_?: boolean): boolean | this {
282
+ const retVal = super.selected.apply(this, arguments);
283
+ if (_ && this._owner) {
284
+ this._owner.buttons().filter(sb => sb !== this && sb instanceof SelectionButton).forEach((sb: SelectionButton) => sb.selected(false).render());
285
+ this._owner.selected(this);
286
+ }
287
+ return retVal;
288
+ }
289
+ }
290
+ SelectionButton.prototype._class += " common_SelectionButton";
291
+
292
+ export class SelectionBar extends IconBar {
293
+
294
+ buttons(): Array<SelectionButton | Spacer>;
295
+ buttons(_: Array<SelectionButton | Spacer>): this;
296
+ buttons(_?: Array<SelectionButton | Spacer>): Array<SelectionButton | Spacer> | this {
297
+ const retVal = super.buttons.apply(this, arguments);
298
+ if (arguments.length) {
299
+ _.filter(b => b instanceof SelectionButton).forEach((sb: SelectionButton) => {
300
+ sb._owner = this;
301
+ });
302
+ }
303
+ return retVal;
304
+ }
305
+
306
+ // Events ---
307
+ selected(row: SelectionButton) {
308
+ }
309
+ }
310
+ SelectionBar.prototype._class += " common_SelectionBar";
311
+
312
+ // Titlebar ---
313
+ export class TitleBar extends IconBar {
314
+
315
+ _divTitle;
316
+ _divTitleIcon;
317
+ _divTitleText;
318
+ _divDescriptionText;
319
+
320
+ constructor() {
321
+ super();
322
+ }
323
+
324
+ enter(domNode, element) {
325
+ this._divTitle = element.append("div")
326
+ .attr("class", "title-title")
327
+ .style("min-width", "0px")
328
+ ;
329
+ this._divTitleIcon = this._divTitle.append("div")
330
+ .attr("class", "title-icon")
331
+ .style("font-family", this.titleIconFont())
332
+ .style("font-size", `${this.titleIconFontSize()}px`)
333
+ .style("width", `${this.titleIconFontSize()}px`)
334
+ ;
335
+ this._divTitle.append("div")
336
+ .attr("class", "data-count")
337
+ ;
338
+ this._divTitleText = this._divTitle.append("div")
339
+ .attr("class", "title-text")
340
+ .style("font-family", this.titleFont())
341
+ .style("font-size", `${this.titleFontSize()}px`)
342
+ ;
343
+ this._divDescriptionText = this._divTitle.append("div")
344
+ .attr("class", "description-text")
345
+ .style("font-family", this.descriptionFont())
346
+ ;
347
+
348
+ super.enter(domNode, element);
349
+ }
350
+
351
+ update(domNode, element) {
352
+ this._divTitleIcon
353
+ .text(this.titleIcon())
354
+ .style("display", this.titleIcon() !== "" ? "inline-block" : "none")
355
+ ;
356
+ this._divTitleText
357
+ .text(this.title())
358
+ .attr("title", this.title())
359
+ ;
360
+ this._divDescriptionText
361
+ .style("display", this.description_exists() ? "block" : "none")
362
+ .style("font-size", this.description_exists() ? `${this.descriptionFontSize()}px` : null)
363
+ .style("line-height", this.description_exists() ? `${this.descriptionFontSize()}px` : null)
364
+ .text(this.description())
365
+ ;
366
+
367
+ super.update(domNode, element);
368
+ }
369
+ }
370
+ TitleBar.prototype._class += " common_TitleBar";
371
+
372
+ export interface TitleBar {
373
+ title(): string;
374
+ title(_: string): this;
375
+ titleIcon(): string;
376
+ titleIcon(_: string): this;
377
+ titleIconFont(): string;
378
+ titleIconFont(_: string): this;
379
+ titleFont(): string;
380
+ titleFont(_: string): this;
381
+ titleIconFontSize(): number;
382
+ titleIconFontSize(_: number): this;
383
+ titleFontSize(): number;
384
+ titleFontSize(_: number): this;
385
+ description(): string;
386
+ description(_: string): this;
387
+ description_exists(): boolean;
388
+ descriptionFont(): string;
389
+ descriptionFont(_: string): this;
390
+ descriptionFontSize(): number;
391
+ descriptionFontSize(_: number): this;
392
+ }
393
+ TitleBar.prototype.publish("titleIcon", "", "string", "Icon text");
394
+ TitleBar.prototype.publish("titleIconFont", "", "string", "Icon font-family");
395
+ TitleBar.prototype.publish("titleIconFontSize", 28, "number", "Icon font-size (pixels)");
396
+ TitleBar.prototype.publish("title", "", "string", "Title text");
397
+ TitleBar.prototype.publish("titleFont", "", "string", "Title font-family");
398
+ TitleBar.prototype.publish("titleFontSize", 20, "number", "Title font-size (pixels)");
399
+ TitleBar.prototype.publish("description", null, "string", "Description text", null, { optional: true });
400
+ TitleBar.prototype.publish("descriptionFont", "", "string", "Description font-family");
401
+ TitleBar.prototype.publish("descriptionFontSize", 10, "number", "Description font-size (pixels)");