@hpcc-js/layout 3.4.0 → 3.4.2

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/dist/index.js CHANGED
@@ -1,3985 +1,4 @@
1
- import { Button, Database, FAChar, HTMLWidget, IconBar, Palette, Platform, ProgressBar, SVGWidget, Spacer, Text, TitleBar, ToggleButton, Utility, d3Event, dispatch, drag, format, formatLocale, formatPrefix, formatSpecifier, scaleLinear, scaleOrdinal, select, selectAll, sum } from "@hpcc-js/common";
2
- import { Table } from "@hpcc-js/dgrid";
3
- import { instanceOfIHighlight } from "@hpcc-js/api";
4
-
5
- //#region rolldown:runtime
6
- var __create = Object.create;
7
- var __defProp = Object.defineProperty;
8
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
9
- var __getOwnPropNames = Object.getOwnPropertyNames;
10
- var __getProtoOf = Object.getPrototypeOf;
11
- var __hasOwnProp = Object.prototype.hasOwnProperty;
12
- var __commonJS = (cb, mod) => function() {
13
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
14
- };
15
- var __copyProps = (to, from, except, desc) => {
16
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
17
- key = keys[i];
18
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
19
- get: ((k$1) => from[k$1]).bind(null, key),
20
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
21
- });
22
- }
23
- return to;
24
- };
25
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
- value: mod,
27
- enumerable: true
28
- }) : target, mod));
29
-
30
- //#endregion
31
- //#region src/__package__.ts
32
- const PKG_NAME = "@hpcc-js/layout";
33
- const PKG_VERSION = "3.4.0";
34
- const BUILD_VERSION = "3.15.0";
35
-
36
- //#endregion
37
- //#region src/AbsoluteSurface.ts
38
- var AbsoluteSurface = class extends HTMLWidget {
39
- constructor() {
40
- super();
41
- this._tag = "div";
42
- }
43
- enter(domNode, element) {
44
- super.enter(domNode, element);
45
- }
46
- update(domNode, element) {
47
- super.update(domNode, element);
48
- let xPos = 0;
49
- let yPos = 0;
50
- let width = this.clientWidth();
51
- let height = this.clientHeight();
52
- switch (this.units()) {
53
- case "pixels":
54
- xPos = this.widgetX();
55
- yPos = this.widgetY();
56
- width = this.widgetWidth() === "" ? width - xPos : Number(this.widgetWidth());
57
- height = this.widgetHeight() === "" ? height - yPos : Number(this.widgetHeight());
58
- break;
59
- case "percent":
60
- xPos = this.widgetX() * width / 100;
61
- yPos = this.widgetY() * height / 100;
62
- width = this.widgetWidth() === "" ? width - xPos : Number(this.widgetWidth()) * width / 100;
63
- height = this.widgetHeight() === "" ? height - yPos : Number(this.widgetHeight()) * height / 100;
64
- break;
65
- }
66
- element.style("opacity", this.opacity());
67
- const widgets = element.selectAll("#" + this._id + " > .placeholder").data(this.widget() ? [this.widget()] : [], function(d) {
68
- return d._id;
69
- });
70
- widgets.enter().append("div").attr("class", "placeholder").each(function(d) {
71
- d.target(this);
72
- }).merge(widgets).style("left", xPos + "px").style("top", yPos + "px").style("width", width + "px").style("bottom", height + "px").each(function(d) {
73
- d.resize({
74
- width,
75
- height
76
- });
77
- });
78
- widgets.exit().each(function(d) {
79
- d.target(null);
80
- }).remove();
81
- }
82
- exit(domNode, element) {
83
- if (this.widget()) this.widget().target(null);
84
- super.exit(domNode, element);
85
- }
86
- };
87
- AbsoluteSurface.prototype._class += " layout_AbsoluteSurface";
88
- AbsoluteSurface.prototype.publish("units", "percent", "set", "Units", ["pixels", "percent"]);
89
- AbsoluteSurface.prototype.publish("widgetX", 0, "number", "Widget XPos");
90
- AbsoluteSurface.prototype.publish("widgetY", 0, "number", "Widget YPos");
91
- AbsoluteSurface.prototype.publish("widgetWidth", "100", "string", "Widget Width, omit for full");
92
- AbsoluteSurface.prototype.publish("widgetHeight", "100", "string", "Widget Height, omit for full");
93
- AbsoluteSurface.prototype.publish("widget", null, "widget", "Widget", null, { tags: ["Private"] });
94
- AbsoluteSurface.prototype.publish("opacity", 1, "number", "Opacity");
95
-
96
- //#endregion
97
- //#region src/Accordion.ts
98
- var Accordion = class extends HTMLWidget {
99
- _isClosed;
100
- titleSpan;
101
- iconDiv;
102
- ul;
103
- icon;
104
- constructor() {
105
- super();
106
- this._tag = "div";
107
- this._isClosed = false;
108
- }
109
- pushListItem(widget, prepend = false, protect = false) {
110
- const contentArr = this.content();
111
- widget._protected = protect;
112
- if (prepend) contentArr.unshift(widget);
113
- else contentArr.push(widget);
114
- this.content(contentArr);
115
- return this;
116
- }
117
- clearListItems() {
118
- const arr = [];
119
- for (const i in this.content()) if (this.content()[i]._protected) arr.push(this.content()[i]);
120
- this.content(arr);
121
- return this;
122
- }
123
- collapseClick(element) {
124
- if (element.classed("closed")) {
125
- this._isClosed = false;
126
- element.classed("open", true);
127
- element.classed("closed", false);
128
- } else {
129
- this._isClosed = true;
130
- element.classed("open", false);
131
- element.classed("closed", true);
132
- }
133
- }
134
- enter(domNode, element) {
135
- super.enter(domNode, element);
136
- const context = this;
137
- this._isClosed = this.defaultCollapsed();
138
- element.classed(this._isClosed ? "closed" : "open", true);
139
- this.titleSpan = element.append("span").classed("collapsible-title", true);
140
- this.iconDiv = element.append("div").classed("collapsible-icon", true);
141
- this.ul = element.append("ul");
142
- this.icon = new FAChar().size({
143
- height: 24,
144
- width: 24
145
- }).target(this.iconDiv.node());
146
- this.iconDiv.on("click", function() {
147
- context.collapseClick(element);
148
- context.render();
149
- });
150
- this.titleSpan.on("click", function() {
151
- context.collapseClick(element);
152
- context.render();
153
- });
154
- }
155
- update(domNode, element) {
156
- super.update(domNode, element);
157
- const context = this;
158
- this.titleSpan.text(context.title().length > 0 ? context.title() + "" : "Accordion [" + context._id + "]");
159
- const rows = this.ul.selectAll("#" + context._id + " > ul > li").data(this.content(), function(d) {
160
- return d._id;
161
- });
162
- rows.enter().append(function(widget) {
163
- const li = document.createElement("li");
164
- if (widget._target === null) {
165
- const wSize = widget.size();
166
- if (wSize.width === 0 || wSize.height === 0) {
167
- const cSize = context.size();
168
- widget.size({
169
- width: cSize.width,
170
- height: cSize.width
171
- });
172
- }
173
- widget.target(li);
174
- } else return widget._target;
175
- return li;
176
- });
177
- rows.exit().remove();
178
- this.icon.text_colorFill(this.titleFontColor()).char(this._isClosed ? this.closedIcon() : this.openIcon()).render();
179
- }
180
- exit(domNode, element) {
181
- super.exit(domNode, element);
182
- }
183
- };
184
- Accordion.prototype._class += " layout_Accordion";
185
- Accordion.prototype.publish("content", [], "widgetArray", "Array of widgets", null, { tags: ["Basic"] });
186
- Accordion.prototype.publish("title", "", "string", "Title of collapsible section", null, { tags: ["Private"] });
187
- Accordion.prototype.publish("openIcon", "", "string", "Icon to display when list is open", null, { tags: ["Private"] });
188
- Accordion.prototype.publish("closedIcon", "", "string", "Icon to display when list is closed", null, { tags: ["Private"] });
189
- Accordion.prototype.publish("titleFontColor", "#FFFFFF", "html-color", "Title font color", null, { tags: ["Private"] });
190
- Accordion.prototype.publish("titleBackgroundColor", "#333333", "html-color", "Title background color", null, { tags: ["Private"] });
191
- Accordion.prototype.publish("defaultCollapsed", false, "boolean", "Collapsed by default if true", null, { tags: ["Private"] });
192
-
193
- //#endregion
194
- //#region src/Surface.ts
195
- var Surface = class extends HTMLWidget {
196
- _surfaceButtons;
197
- constructor() {
198
- super();
199
- this._tag = "div";
200
- this._surfaceButtons = [];
201
- }
202
- widgetSize(titleDiv, widgetDiv) {
203
- let width = this.clientWidth();
204
- let height = this.clientHeight();
205
- if (this.title()) height -= this.calcHeight(titleDiv);
206
- height -= this.calcFrameHeight(widgetDiv);
207
- width -= this.calcFrameWidth(widgetDiv);
208
- return {
209
- width,
210
- height
211
- };
212
- }
213
- enter(domNode, element) {
214
- super.enter(domNode, element);
215
- }
216
- update(domNode, element2) {
217
- super.update(domNode, element2);
218
- const context = this;
219
- element2.classed("shadow2", this.surfaceShadow()).style("border-width", this.surfaceBorderWidth_exists() ? this.surfaceBorderWidth() + "px" : null).style("border-color", this.surfaceBorderColor()).style("border-radius", this.surfaceBorderRadius_exists() ? this.surfaceBorderRadius() + "px" : null).style("background-color", this.surfaceBackgroundColor());
220
- const titles = element2.selectAll(".surfaceTitle").data(this.title() ? [this.title()] : []);
221
- titles.enter().insert("h3", "div").attr("class", "surfaceTitle").merge(titles).text(function(d) {
222
- return d;
223
- }).style("text-align", this.surfaceTitleAlignment()).style("color", this.surfaceTitleFontColor()).style("font-size", this.surfaceTitleFontSize_exists() ? this.surfaceTitleFontSize() + "px" : null).style("font-family", this.surfaceTitleFontFamily()).style("font-weight", this.surfaceTitleFontBold() ? "bold" : "normal").style("background-color", this.surfaceTitleBackgroundColor()).style("padding", this.surfaceTitlePadding_exists() ? this.surfaceTitlePadding() + "px" : null).style("title", this.altText_exists() ? this.altText() : null);
224
- titles.exit().remove();
225
- const surfaceButtons = element2.select(".surfaceTitle").append("div").attr("class", "html-button-container").selectAll(".surface-button").data(this.buttonAnnotations());
226
- surfaceButtons.enter().append("button").classed("surface-button", true).each(function(button, idx) {
227
- const el = context._surfaceButtons[idx] = select(this).attr("class", "surface-button" + (button.class ? " " + button.class : "")).attr("id", button.id).style("padding", button.padding).style("width", button.width).style("height", button.height).style("cursor", "pointer");
228
- if (button.font === "FontAwesome") el.style("background", "transparent").style("border", "none").on("click", function(d) {
229
- context.click(d);
230
- }).append("i").attr("class", "fa").text(function() {
231
- return button.label;
232
- });
233
- else el.text(function() {
234
- return button.label;
235
- }).on("click", function(d) {
236
- context.click(d);
237
- });
238
- });
239
- surfaceButtons.exit().each(function(_d, idx) {
240
- const element = select(this);
241
- delete context._surfaceButtons[idx];
242
- element.remove();
243
- });
244
- const widgets = element2.selectAll("#" + this._id + " > .surfaceWidget").data(this.widget() ? [this.widget()] : [], function(d) {
245
- return d._id;
246
- });
247
- widgets.enter().append("div").attr("class", "surfaceWidget").each(function(d) {
248
- select(context.element().node().parentElement).classed("content-icon content-icon-" + d.classID().split("_")[1], true);
249
- d.target(this);
250
- }).merge(widgets).style("padding", this.surfacePadding_exists() ? this.surfacePadding() + "px" : null).each(function(d) {
251
- const widgetSize = context.widgetSize(element2.select("h3"), select(this));
252
- if (widgetSize.width < 0) widgetSize.width = 0;
253
- if (widgetSize.height < 0) widgetSize.height = 0;
254
- d.resize({
255
- width: widgetSize.width,
256
- height: widgetSize.height
257
- });
258
- });
259
- widgets.exit().each(function(d) {
260
- d.target(null);
261
- }).remove();
262
- }
263
- exit(domNode, element) {
264
- if (this.widget()) this.widget().target(null);
265
- super.exit(domNode, element);
266
- }
267
- click(obj) {}
268
- };
269
- Surface.prototype._class += " layout_Surface";
270
- Surface.prototype.publish("title", "", "string", "Title", null, { tags: ["Intermediate"] });
271
- Surface.prototype.publish("altText", null, "string", "Alt text", null, { optional: true });
272
- Surface.prototype.publish("surfaceTitlePadding", null, "number", "Title Padding (px)", null, {
273
- tags: ["Advanced"],
274
- disable: (w) => !w.title()
275
- });
276
- Surface.prototype.publish("surfaceTitleFontSize", null, "number", "Title Font Size (px)", null, {
277
- tags: ["Advanced"],
278
- disable: (w) => !w.title()
279
- });
280
- Surface.prototype.publish("surfaceTitleFontColor", null, "html-color", "Title Font Color", null, {
281
- tags: ["Advanced"],
282
- disable: (w) => !w.title()
283
- });
284
- Surface.prototype.publish("surfaceTitleFontFamily", null, "string", "Title Font Family", null, {
285
- tags: ["Advanced"],
286
- disable: (w) => !w.title()
287
- });
288
- Surface.prototype.publish("surfaceTitleFontBold", true, "boolean", "Enable Bold Title Font", null, {
289
- tags: ["Advanced"],
290
- disable: (w) => !w.title()
291
- });
292
- Surface.prototype.publish("surfaceTitleBackgroundColor", null, "html-color", "Title Background Color", null, {
293
- tags: ["Advanced"],
294
- disable: (w) => !w.title()
295
- });
296
- Surface.prototype.publish("surfaceTitleAlignment", "center", "set", "Title Alignment", [
297
- "left",
298
- "right",
299
- "center"
300
- ], {
301
- tags: ["Basic"],
302
- disable: (w) => !w.title()
303
- });
304
- Surface.prototype.publish("surfaceShadow", false, "boolean", "3D Shadow");
305
- Surface.prototype.publish("surfacePadding", null, "string", "Surface Padding (px)", null, { tags: ["Intermediate"] });
306
- Surface.prototype.publish("surfaceBackgroundColor", null, "html-color", "Surface Background Color", null, { tags: ["Advanced"] });
307
- Surface.prototype.publish("surfaceBorderWidth", null, "number", "Surface Border Width (px)", null, { tags: ["Advanced"] });
308
- Surface.prototype.publish("surfaceBorderColor", null, "html-color", "Surface Border Color", null, { tags: ["Advanced"] });
309
- Surface.prototype.publish("surfaceBorderRadius", null, "number", "Surface Border Radius (px)", null, { tags: ["Advanced"] });
310
- Surface.prototype.publish("buttonAnnotations", [], "array", "Button Array", null, { tags: ["Private"] });
311
- Surface.prototype.publish("widget", null, "widget", "Widget", null, { tags: ["Basic"] });
312
-
313
- //#endregion
314
- //#region src/Cell.ts
315
- var Cell = class extends Surface {
316
- _indicateTheseIds;
317
- constructor() {
318
- super();
319
- this._indicateTheseIds = [];
320
- }
321
- indicateTheseIds(_) {
322
- if (!arguments.length) return this._indicateTheseIds;
323
- this._indicateTheseIds = _;
324
- return this;
325
- }
326
- enter(domNode, element) {
327
- super.enter(domNode, element);
328
- const context = this;
329
- element.classed("layout_Surface", true).on("mouseenter", function() {
330
- context.onMouseEnter();
331
- }).on("mouseleave", function() {
332
- context.onMouseLeave();
333
- });
334
- }
335
- update(domNode, element) {
336
- super.update(domNode, element);
337
- }
338
- onMouseEnter() {
339
- const arr = this.indicateTheseIds();
340
- const opacity = this.indicatorOpacity();
341
- const indicatorBorderColor = this.indicatorBorderColor();
342
- const indicatorGlowColor = this.indicatorGlowColor();
343
- for (let i = 0; i < arr.length; i++) {
344
- const otherElement = select("#" + arr[i]);
345
- const otherWidget = otherElement.datum();
346
- if (otherElement && otherWidget) otherElement.append("div").attr("class", "update-indicator").style("width", otherWidget.width() + "px").style("height", otherWidget.height() + "px").style("opacity", opacity).style("border-color", indicatorBorderColor).style("-webkit-box-shadow", "inset 0px 0px 30px 0px " + indicatorGlowColor).style("-moz-box-shadow", "inset 0px 0px 30px 0px " + indicatorGlowColor).style("box-shadow", "inset 0px 0px 30px 0px " + indicatorGlowColor);
347
- }
348
- }
349
- onMouseLeave() {
350
- const arr = this.indicateTheseIds();
351
- for (let i = 0; i < arr.length; i++) selectAll("#" + arr[i] + " > div.update-indicator").remove();
352
- }
353
- };
354
- Cell.prototype._class += " layout_Cell";
355
- Cell.prototype.publish("gridRow", 0, "number", "Grid Row Position", null, { tags: ["Private"] });
356
- Cell.prototype.publish("gridCol", 0, "number", "Grid Column Position", null, { tags: ["Private"] });
357
- Cell.prototype.publish("gridRowSpan", 1, "number", "Grid Row Span", null, { tags: ["Private"] });
358
- Cell.prototype.publish("gridColSpan", 1, "number", "Grid Column Span", null, { tags: ["Private"] });
359
- Cell.prototype.publish("indicatorGlowColor", "#EEEE11", "html-color", "Glow color of update-indicator", null, { tags: ["Basic"] });
360
- Cell.prototype.publish("indicatorBorderColor", "#F48A00", "html-color", "Border color of update-indicator", null, { tags: ["Basic"] });
361
- Cell.prototype.publish("indicatorOpacity", .8, "number", "Opacity of update-indicator", null, { tags: ["Basic"] });
362
-
363
- //#endregion
364
- //#region src/Border.ts
365
- var Border = class extends HTMLWidget {
366
- _colCount;
367
- _rowCount;
368
- _colSize;
369
- _rowSize;
370
- _shrinkWrapBoxes;
371
- _watch;
372
- _offsetX;
373
- _offsetY;
374
- _dragCell;
375
- _dragCellSize;
376
- _dragCellStartSize;
377
- _handleTop;
378
- _handleLeft;
379
- _dragPrevX;
380
- _dragPrevY;
381
- _cellSizes;
382
- contentDiv;
383
- _scrollBarWidth;
384
- _borderHandles;
385
- _sectionTypeArr;
386
- constructor() {
387
- super();
388
- this._tag = "div";
389
- this._colCount = 0;
390
- this._rowCount = 0;
391
- this._colSize = 0;
392
- this._rowSize = 0;
393
- this._shrinkWrapBoxes = {};
394
- this.content([]);
395
- this.sectionTypes([]);
396
- }
397
- watchWidget(widget) {
398
- if (this._watch === void 0) this._watch = {};
399
- if (this._watch[widget.id()]) {
400
- this._watch[widget.id()].remove();
401
- delete this._watch[widget.id()];
402
- }
403
- if (widget) {
404
- const context = this;
405
- this._watch[widget.id()] = widget.monitor(function(paramId, newVal, oldVal) {
406
- if (oldVal !== newVal) context.lazyPostUpdate();
407
- });
408
- }
409
- }
410
- lazyPostUpdate = Utility.debounce(function() {
411
- this.postUpdate();
412
- }, 100);
413
- applyLayoutType() {
414
- const layoutObj = this.borderLayoutObject();
415
- this.content().forEach(function(cell, i) {
416
- cell._fixedLeft = layoutObj[this.sectionTypes()[i]].left;
417
- cell._fixedTop = layoutObj[this.sectionTypes()[i]].top;
418
- cell._fixedWidth = layoutObj[this.sectionTypes()[i]].width;
419
- cell._fixedHeight = layoutObj[this.sectionTypes()[i]].height;
420
- cell._dragHandles = this.cellSpecificDragHandles(this.sectionTypes()[i]);
421
- }, this);
422
- }
423
- cellSpecificDragHandles(sectionType) {
424
- switch (sectionType) {
425
- case "top": return ["s"];
426
- case "right": return ["w"];
427
- case "bottom": return ["n"];
428
- case "left": return ["e"];
429
- case "center": return [];
430
- }
431
- }
432
- borderLayoutObject(layoutType) {
433
- const retObj = {};
434
- const context = this;
435
- let topSize;
436
- let topPerc;
437
- let bottomSize;
438
- let bottomPerc;
439
- let leftSize;
440
- let leftPerc;
441
- let rightSize;
442
- let rightPerc;
443
- const bcRect = this.target().getBoundingClientRect();
444
- const gridRect = {};
445
- gridRect.top = bcRect.top;
446
- gridRect.left = bcRect.left;
447
- gridRect.bottom = bcRect.bottom;
448
- gridRect.right = bcRect.right;
449
- if (this.target() instanceof SVGElement) {
450
- gridRect.width = parseFloat(this.target().getAttribute("width"));
451
- gridRect.height = parseFloat(this.target().getAttribute("height"));
452
- } else {
453
- gridRect.width = bcRect.width;
454
- gridRect.height = bcRect.height;
455
- }
456
- if (this.sectionTypes().indexOf("top") !== -1) {
457
- topSize = this.topSize();
458
- topPerc = this.topPercentage();
459
- if (typeof this._shrinkWrapBoxes["top"] !== "undefined") {
460
- topSize = this._shrinkWrapBoxes["top"].height + this.gutter();
461
- topPerc = 0;
462
- }
463
- }
464
- if (this.sectionTypes().indexOf("bottom") !== -1) {
465
- bottomSize = this.bottomSize();
466
- bottomPerc = this.bottomPercentage();
467
- if (typeof this._shrinkWrapBoxes["bottom"] !== "undefined") {
468
- bottomSize = this._shrinkWrapBoxes["bottom"].height + this.gutter();
469
- bottomPerc = 0;
470
- }
471
- }
472
- if (this.sectionTypes().indexOf("left") !== -1) {
473
- leftSize = this.leftSize();
474
- leftPerc = this.leftPercentage();
475
- if (typeof this._shrinkWrapBoxes["left"] !== "undefined") {
476
- leftSize = this._shrinkWrapBoxes["left"].width + this.gutter();
477
- leftPerc = 0;
478
- }
479
- }
480
- if (this.sectionTypes().indexOf("right") !== -1) {
481
- rightSize = this.rightSize();
482
- rightPerc = this.rightPercentage();
483
- if (typeof this._shrinkWrapBoxes["right"] !== "undefined") {
484
- rightSize = this._shrinkWrapBoxes["right"].width + this.gutter();
485
- rightPerc = 0;
486
- }
487
- }
488
- const t = _sectionPlacementObject({
489
- width: {
490
- "px": 0,
491
- "%": 100
492
- },
493
- height: {
494
- "px": topSize,
495
- "%": topPerc
496
- },
497
- top: {
498
- "px": 0,
499
- "%": 0
500
- },
501
- left: {
502
- "px": 0,
503
- "%": 0
504
- }
505
- });
506
- const b = _sectionPlacementObject({
507
- width: {
508
- "px": 0,
509
- "%": 100
510
- },
511
- height: {
512
- "px": bottomSize,
513
- "%": bottomPerc
514
- },
515
- top: {
516
- "px": 0,
517
- "%": 100
518
- },
519
- left: {
520
- "px": 0,
521
- "%": 0
522
- }
523
- });
524
- b.top -= b.height;
525
- const l = _sectionPlacementObject({
526
- width: {
527
- "px": leftSize,
528
- "%": leftPerc
529
- },
530
- height: {
531
- "px": -t.height - b.height,
532
- "%": 100
533
- },
534
- top: {
535
- "px": t.height,
536
- "%": 0
537
- },
538
- left: {
539
- "px": 0,
540
- "%": 0
541
- }
542
- });
543
- const r = _sectionPlacementObject({
544
- width: {
545
- "px": rightSize,
546
- "%": rightPerc
547
- },
548
- height: {
549
- "px": -t.height - b.height,
550
- "%": 100
551
- },
552
- top: {
553
- "px": t.height,
554
- "%": 0
555
- },
556
- left: {
557
- "px": 0,
558
- "%": 100
559
- }
560
- });
561
- r.left -= r.width;
562
- const c$1 = _sectionPlacementObject({
563
- width: {
564
- "px": -r.width - l.width,
565
- "%": 100
566
- },
567
- height: {
568
- "px": -t.height - b.height,
569
- "%": 100
570
- },
571
- top: {
572
- "px": t.height,
573
- "%": 0
574
- },
575
- left: {
576
- "px": l.width,
577
- "%": 0
578
- }
579
- });
580
- retObj["top"] = t;
581
- retObj["bottom"] = b;
582
- retObj["right"] = r;
583
- retObj["left"] = l;
584
- retObj["center"] = c$1;
585
- return retObj;
586
- function _sectionPlacementObject(obj) {
587
- obj.width["px"] = typeof obj.width["px"] !== "undefined" ? obj.width["px"] : 0;
588
- obj.width["%"] = typeof obj.width["%"] !== "undefined" ? obj.width["%"] : 0;
589
- obj.height["px"] = typeof obj.height["px"] !== "undefined" ? obj.height["px"] : 0;
590
- obj.height["%"] = typeof obj.height["%"] !== "undefined" ? obj.height["%"] : 0;
591
- return {
592
- width: obj.width["px"] + obj.width["%"] / 100 * context.width(),
593
- height: obj.height["px"] + obj.height["%"] / 100 * context.height(),
594
- top: obj.top["px"] + obj.top["%"] / 100 * context.height() + context.gutter() / 2,
595
- left: obj.left["px"] + obj.left["%"] / 100 * context.width() + context.gutter() / 2
596
- };
597
- }
598
- }
599
- clearContent(sectionType) {
600
- if (!sectionType) {
601
- this.content().forEach(function(contentWidget) {
602
- contentWidget.target(null);
603
- return false;
604
- });
605
- select("#" + this.id() + " > div.borderHandle").classed("borderHandleDisabled", true);
606
- delete this._watch;
607
- this.content([]);
608
- this.sectionTypes([]);
609
- } else {
610
- const idx = this.sectionTypes().indexOf(sectionType);
611
- if (idx >= 0) {
612
- if (this._watch && this.content()[idx]) delete this._watch[this.content()[idx].id()];
613
- this.content()[idx].target(null);
614
- select("#" + this.id() + " > div.borderHandle_" + sectionType).classed("borderHandleDisabled", true);
615
- this.content().splice(idx, 1);
616
- this.sectionTypes().splice(idx, 1);
617
- }
618
- }
619
- }
620
- hasContent(sectionType, widget, title) {
621
- return this.sectionTypes().indexOf(sectionType) >= 0;
622
- }
623
- setContent(sectionType, widget, title) {
624
- this.clearContent(sectionType);
625
- title = typeof title !== "undefined" ? title : "";
626
- if (widget) {
627
- const cell = new Cell().surfaceBorderWidth(0).widget(widget).title(title);
628
- this.watchWidget(widget);
629
- this.content().push(cell);
630
- this.sectionTypes().push(sectionType);
631
- }
632
- return this;
633
- }
634
- getCell(id) {
635
- const idx = this.sectionTypes().indexOf(id);
636
- if (idx >= 0) return this.content()[idx];
637
- return null;
638
- }
639
- getContent(id) {
640
- const idx = this.sectionTypes().indexOf(id);
641
- if (idx >= 0) return this.content()[idx].widget();
642
- return null;
643
- }
644
- setLayoutOffsets() {
645
- this._offsetX = this._element.node().getBoundingClientRect().left + this.gutter() / 2;
646
- this._offsetY = this._element.node().getBoundingClientRect().top + this.gutter() / 2;
647
- }
648
- dragStart(handle) {
649
- const event = d3Event();
650
- event.sourceEvent.stopPropagation();
651
- const context = this;
652
- this._dragCell = handle;
653
- this._dragCellStartSize = this[handle + "Size"]();
654
- if (this[handle + "ShrinkWrap"]()) {
655
- this[handle + "Percentage"](0);
656
- this[handle + "ShrinkWrap"](false);
657
- }
658
- const handleElm = select("#" + context.id() + " > div.borderHandle_" + handle);
659
- context._handleTop = parseFloat(handleElm.style("top").split("px")[0]);
660
- context._handleLeft = parseFloat(handleElm.style("left").split("px")[0]);
661
- this._dragPrevX = event.sourceEvent.clientX;
662
- this._dragPrevY = event.sourceEvent.clientY;
663
- }
664
- dragTick(handle) {
665
- const context = this;
666
- const event = d3Event();
667
- const xDelta = this._dragPrevX - event.sourceEvent.clientX;
668
- const yDelta = this._dragPrevY - event.sourceEvent.clientY;
669
- switch (handle) {
670
- case "top":
671
- case "bottom":
672
- _moveHandles(handle, yDelta);
673
- break;
674
- case "right":
675
- case "left":
676
- _moveHandles(handle, xDelta);
677
- break;
678
- }
679
- function _moveHandles(handle2, delta) {
680
- if (delta === 0) return;
681
- const handles = selectAll("#" + context.id() + " > div.borderHandle");
682
- const grabbedHandle = select("#" + context.id() + " > div.borderHandle_" + handle2);
683
- if (grabbedHandle.classed("borderHandle_top")) {
684
- grabbedHandle.style("top", context._handleTop - delta + "px");
685
- context._cellSizes.topHeight = context._handleTop - delta;
686
- context._cellSizes.leftHeight = context._cellSizes.height;
687
- context._cellSizes.leftHeight -= context._cellSizes.topHeight;
688
- context._cellSizes.leftHeight -= context._cellSizes.bottomHeight;
689
- context._cellSizes.rightHeight = context._cellSizes.leftHeight;
690
- } else if (grabbedHandle.classed("borderHandle_right")) {
691
- grabbedHandle.style("left", context._handleLeft - delta + "px");
692
- context._cellSizes.rightWidth = context._cellSizes.width - context._handleLeft + delta;
693
- } else if (grabbedHandle.classed("borderHandle_bottom")) {
694
- grabbedHandle.style("top", context._handleTop - delta + "px");
695
- context._cellSizes.bottomHeight = context._cellSizes.height - context._handleTop + delta;
696
- context._cellSizes.leftHeight = context._cellSizes.height;
697
- context._cellSizes.leftHeight -= context._cellSizes.bottomHeight;
698
- context._cellSizes.leftHeight -= context._cellSizes.topHeight;
699
- context._cellSizes.rightHeight = context._cellSizes.leftHeight;
700
- } else if (grabbedHandle.classed("borderHandle_left")) {
701
- grabbedHandle.style("left", context._handleLeft - delta + "px");
702
- context._cellSizes.leftWidth = context._handleLeft - delta;
703
- }
704
- handles.each(function() {
705
- const handle3 = select(this);
706
- if (handle3.classed("borderHandle_top")) {
707
- handle3.style("width", context._cellSizes.width + "px");
708
- handle3.style("top", context._cellSizes.topHeight - 3 + "px");
709
- } else if (handle3.classed("borderHandle_right")) {
710
- handle3.style("left", context._cellSizes.width - context._cellSizes.rightWidth + "px");
711
- handle3.style("top", context._cellSizes.topHeight + 3 + "px");
712
- handle3.style("height", context._cellSizes.rightHeight + "px");
713
- } else if (handle3.classed("borderHandle_bottom")) {
714
- handle3.style("width", context._cellSizes.width + "px");
715
- handle3.style("top", context._cellSizes.height - context._cellSizes.bottomHeight - 3 + "px");
716
- } else if (handle3.classed("borderHandle_left")) {
717
- handle3.style("left", context._cellSizes.leftWidth + "px");
718
- handle3.style("height", context._cellSizes.leftHeight + "px");
719
- handle3.style("top", context._cellSizes.topHeight + 3 + "px");
720
- }
721
- });
722
- }
723
- }
724
- dragEnd(handle) {
725
- if (handle) {
726
- const event = d3Event();
727
- const xDelta = this._dragPrevX - event.sourceEvent.clientX;
728
- const yDelta = this._dragPrevY - event.sourceEvent.clientY;
729
- switch (handle) {
730
- case "top":
731
- if (yDelta !== 0) {
732
- this.topPercentage(0);
733
- this.topSize(this.topSize() === 0 ? this.getContent("top").getBBox().height - yDelta : this.topSize() - yDelta);
734
- }
735
- break;
736
- case "right":
737
- if (xDelta !== 0) {
738
- this.rightPercentage(0);
739
- this.rightSize(this.rightSize() === 0 ? this.getContent("right").getBBox().width + xDelta : this.rightSize() + xDelta);
740
- }
741
- break;
742
- case "bottom":
743
- if (yDelta !== 0) {
744
- this.bottomPercentage(0);
745
- this.bottomSize(this.bottomSize() === 0 ? this.getContent("bottom").getBBox().height + yDelta : this.bottomSize() + yDelta);
746
- }
747
- break;
748
- case "left":
749
- if (xDelta !== 0) {
750
- this.leftPercentage(0);
751
- this.leftSize(this.leftSize() === 0 ? this.getContent("left").getBBox().width - xDelta : this.leftSize() - xDelta);
752
- }
753
- break;
754
- }
755
- this._dragPrevX = event.sourceEvent.clientX;
756
- this._dragPrevY = event.sourceEvent.clientY;
757
- }
758
- this.render();
759
- }
760
- size(_) {
761
- const retVal = HTMLWidget.prototype.size.apply(this, arguments);
762
- if (arguments.length && this.contentDiv) this.contentDiv.style("width", this._size.width + "px").style("height", this._size.height + "px");
763
- return retVal;
764
- }
765
- enter(domNode, element) {
766
- super.enter(domNode, element);
767
- const context = this;
768
- element.style("position", "relative");
769
- this.contentDiv = element.append("div").classed("border-content", true);
770
- this._scrollBarWidth = Platform.getScrollbarWidth();
771
- this._borderHandles = [
772
- "top",
773
- "left",
774
- "right",
775
- "bottom"
776
- ];
777
- element.selectAll("div.borderHandle").data(this._borderHandles).enter().append("div").classed("borderHandle", true).each(function(handle) {
778
- select(this).classed("borderHandle_" + handle, true).classed("borderHandleDisabled", context.getContent(handle) === null);
779
- });
780
- }
781
- update(domNode, element) {
782
- super.update(domNode, element);
783
- this._sectionTypeArr = this.sectionTypes();
784
- const context = this;
785
- element.classed("design-mode", this.designMode());
786
- this.setLayoutOffsets();
787
- const rows = this.contentDiv.selectAll(".cell_" + this._id).data(this.content(), function(d) {
788
- return d._id;
789
- });
790
- const rowsUpdate = rows.enter().append("div").classed("cell_" + this._id, true).style("position", "absolute").each(function(d, i) {
791
- select(this).classed("border-cell border-cell-" + context._sectionTypeArr[i], true);
792
- d.target(this);
793
- select("#" + context.id() + " > div.borderHandle_" + context._sectionTypeArr[i]).classed("borderHandleDisabled", false);
794
- }).merge(rows);
795
- rowsUpdate.each(function(d, idx) {
796
- const sectionType = context.sectionTypes()[idx];
797
- if (typeof context[sectionType + "ShrinkWrap"] !== "undefined" && context[sectionType + "ShrinkWrap"]()) {
798
- d.render();
799
- context._shrinkWrapBoxes[sectionType] = d.widget().getBBox(true);
800
- } else delete context._shrinkWrapBoxes[sectionType];
801
- });
802
- const drag$1 = drag().on("start", function(d, i) {
803
- context.dragStart.call(context, d, i);
804
- }).on("drag", function(d, i) {
805
- context.dragTick.call(context, d, i);
806
- }).on("end", function(d, i) {
807
- context.dragEnd.call(context, d, i);
808
- });
809
- if (this.designMode()) element.selectAll("#" + this.id() + " > div.borderHandle").call(drag$1);
810
- else element.selectAll("#" + this.id() + " > div.borderHandle").on(".drag", null);
811
- const layoutObj = this.borderLayoutObject();
812
- this.content().forEach(function(cell, i) {
813
- cell._fixedLeft = layoutObj[this.sectionTypes()[i]].left;
814
- cell._fixedTop = layoutObj[this.sectionTypes()[i]].top;
815
- cell._fixedWidth = layoutObj[this.sectionTypes()[i]].width;
816
- cell._fixedHeight = layoutObj[this.sectionTypes()[i]].height;
817
- cell._dragHandles = [];
818
- }, this);
819
- rowsUpdate.style("left", function(d) {
820
- return d._fixedLeft + "px";
821
- }).style("top", function(d) {
822
- return d._fixedTop + "px";
823
- }).style("width", function(d) {
824
- return d._fixedWidth - context.gutter() + "px";
825
- }).style("height", function(d) {
826
- return d._fixedHeight - context.gutter() + "px";
827
- }).each(function(d) {
828
- d._placeholderElement.attr("draggable", context.designMode()).selectAll(".dragHandle").attr("draggable", context.designMode());
829
- d.surfacePadding(context.surfacePadding()).resize();
830
- });
831
- rows.exit().each(function(d) {
832
- d.target(null);
833
- }).remove();
834
- this.getCellSizes();
835
- element.selectAll("#" + this.id() + " > div.borderHandle").each(function() {
836
- const handle = select(this);
837
- if (handle.classed("borderHandle_top")) {
838
- handle.style("width", context._cellSizes.width + "px");
839
- handle.style("top", context._cellSizes.topHeight - 3 + "px");
840
- } else if (handle.classed("borderHandle_right")) {
841
- handle.style("left", context._cellSizes.width - context._cellSizes.rightWidth + "px");
842
- handle.style("top", context._cellSizes.topHeight + 3 + "px");
843
- handle.style("height", context._cellSizes.rightHeight + "px");
844
- } else if (handle.classed("borderHandle_bottom")) {
845
- handle.style("width", context._cellSizes.width + "px");
846
- handle.style("top", context._cellSizes.height - context._cellSizes.bottomHeight - 3 + "px");
847
- } else if (handle.classed("borderHandle_left")) {
848
- handle.style("left", context._cellSizes.leftWidth + "px");
849
- handle.style("height", context._cellSizes.leftHeight + "px");
850
- handle.style("top", context._cellSizes.topHeight + 3 + "px");
851
- }
852
- });
853
- }
854
- getCellSizes() {
855
- const context = this;
856
- context._cellSizes = {};
857
- const contentRect = this.element().node().getBoundingClientRect();
858
- context._cellSizes.width = contentRect.width;
859
- context._cellSizes.height = contentRect.height;
860
- this.element().selectAll("#" + this.id() + " > div > div.border-cell").each(function() {
861
- const cell = select(this);
862
- if (typeof cell.node === "function") {
863
- const rect = cell.node().getBoundingClientRect();
864
- if (cell.classed("border-cell-top")) context._cellSizes.topHeight = rect.height;
865
- else if (cell.classed("border-cell-left")) {
866
- context._cellSizes.leftWidth = rect.width;
867
- context._cellSizes.leftHeight = rect.height;
868
- } else if (cell.classed("border-cell-right")) {
869
- context._cellSizes.rightWidth = rect.width;
870
- context._cellSizes.rightHeight = rect.height;
871
- } else if (cell.classed("border-cell-bottom")) context._cellSizes.bottomHeight = rect.height;
872
- }
873
- });
874
- [
875
- "height",
876
- "width",
877
- "topHeight",
878
- "bottomHeight",
879
- "leftHeight",
880
- "rightHeight",
881
- "leftWidth",
882
- "rightWidth"
883
- ].forEach(function(size) {
884
- context._cellSizes[size] = context._cellSizes[size] === void 0 ? 0 : context._cellSizes[size];
885
- });
886
- }
887
- postUpdate(domNode, element) {
888
- const context = this;
889
- this.content().forEach(function(n) {
890
- if (n._element.node() !== null && n.widget()) {
891
- const prevBox = n.widget().getBBox(false, true);
892
- const currBox = n.widget().getBBox(true, true);
893
- if (prevBox.width !== currBox.width || prevBox.height !== currBox.height) context.lazyRender();
894
- }
895
- });
896
- }
897
- exit(domNode, element) {
898
- this.content().forEach((w) => w.target(null));
899
- super.exit(domNode, element);
900
- }
901
- };
902
- Border.prototype._class += " layout_Border";
903
- Border.prototype.publish("designMode", false, "boolean", "Design Mode", null, { tags: ["Basic"] });
904
- Border.prototype.publish("content", [], "widgetArray", "widgets", null, { tags: ["Intermediate"] });
905
- Border.prototype.publish("gutter", 0, "number", "Gap Between Widgets", null, { tags: ["Basic"] });
906
- Border.prototype.publish("topShrinkWrap", false, "boolean", "'Top' Cell shrinks to fit content", null, { tags: ["Intermediate"] });
907
- Border.prototype.publish("leftShrinkWrap", false, "boolean", "'Left' Cell shrinks to fit content", null, { tags: ["Intermediate"] });
908
- Border.prototype.publish("rightShrinkWrap", false, "boolean", "'Right' Cell shrinks to fit content", null, { tags: ["Intermediate"] });
909
- Border.prototype.publish("bottomShrinkWrap", false, "boolean", "'Bottom' Cell shrinks to fit content", null, { tags: ["Intermediate"] });
910
- Border.prototype.publish("topSize", 0, "number", "Height of the 'Top' Cell (px)", null, { tags: ["Private"] });
911
- Border.prototype.publish("leftSize", 0, "number", "Width of the 'Left' Cell (px)", null, { tags: ["Private"] });
912
- Border.prototype.publish("rightSize", 0, "number", "Width of the 'Right' Cell (px)", null, { tags: ["Private"] });
913
- Border.prototype.publish("bottomSize", 0, "number", "Height of the 'Bottom' Cell (px)", null, { tags: ["Private"] });
914
- Border.prototype.publish("topPercentage", 20, "number", "Percentage (of parent) Height of the 'Top' Cell", null, { tags: ["Private"] });
915
- Border.prototype.publish("leftPercentage", 20, "number", "Percentage (of parent) Width of the 'Left' Cell", null, { tags: ["Private"] });
916
- Border.prototype.publish("rightPercentage", 20, "number", "Percentage (of parent) Width of the 'Right' Cell", null, { tags: ["Private"] });
917
- Border.prototype.publish("bottomPercentage", 20, "number", "Percentage (of parent) Height of the 'Bottom' Cell", null, { tags: ["Private"] });
918
- Border.prototype.publish("surfacePadding", 0, "number", "Cell Padding (px)", null, { tags: ["Intermediate"] });
919
- Border.prototype.publish("sectionTypes", [], "array", "Section Types sharing an index with 'content' - Used to determine position/size.", null, { tags: ["Private"] });
920
-
921
- //#endregion
922
- //#region src/Border2.ts
923
- var WidgetDiv = class {
924
- _div;
925
- _overlay = false;
926
- _overflowX = "visible";
927
- _overflowY = "visible";
928
- _widget;
929
- constructor(div) {
930
- this._div = div;
931
- }
932
- overlay(_) {
933
- if (!arguments.length) return this._overlay;
934
- this._overlay = _;
935
- return this;
936
- }
937
- overflowX(_) {
938
- if (!arguments.length) return this._overflowX;
939
- this._overflowX = _;
940
- this._div.style("overflow-x", _);
941
- return this;
942
- }
943
- overflowY(_) {
944
- if (!arguments.length) return this._overflowY;
945
- this._overflowY = _;
946
- this._div.style("overflow-y", _);
947
- return this;
948
- }
949
- element() {
950
- return this._div;
951
- }
952
- node() {
953
- return this._div.node();
954
- }
955
- widget(_) {
956
- if (!arguments.length) return this._widget;
957
- if (this._widget !== _) {
958
- if (this._widget) this._widget.target(null);
959
- this._widget = _;
960
- if (this._widget) this._widget.target(this._div.node());
961
- }
962
- return this;
963
- }
964
- resize(size) {
965
- if (this._widget) {
966
- this._div.style("width", `${size.width}px`).style("height", `${size.height}px`);
967
- this._widget.resize(size);
968
- }
969
- return this;
970
- }
971
- async render(getBBox, availableHeight, availableWidth) {
972
- let overflowX = this.overflowX();
973
- if (!this.overlay() && overflowX === "visible") overflowX = null;
974
- let overflowY = this.overflowY();
975
- if (!this.overlay() && overflowY === "visible") overflowY = null;
976
- this._div.style("height", this.overlay() ? "0px" : null).style("overflow-x", overflowX).style("overflow-y", overflowY);
977
- if (this._widget) return this._widget.renderPromise().then((w) => {
978
- if (getBBox && this._widget.visible()) {
979
- const retVal = this._widget.getBBox();
980
- retVal.width += 8;
981
- if (availableHeight !== void 0 && retVal.height > availableHeight) retVal.width += Platform.getScrollbarWidth();
982
- if (availableWidth !== void 0 && retVal.width > availableWidth) retVal.height += Platform.getScrollbarWidth();
983
- if (this.overlay()) retVal.height = 0;
984
- else retVal.height += 4;
985
- return retVal;
986
- }
987
- return getBBox ? {
988
- x: 0,
989
- y: 0,
990
- width: 0,
991
- height: 0
992
- } : void 0;
993
- });
994
- else return Promise.resolve(getBBox ? {
995
- x: 0,
996
- y: 0,
997
- width: 0,
998
- height: 0
999
- } : void 0);
1000
- }
1001
- };
1002
- var Border2 = class extends HTMLWidget {
1003
- _bodyElement;
1004
- _topWA;
1005
- _leftWA;
1006
- _centerWA;
1007
- _rightWA;
1008
- _bottomWA;
1009
- _topPrevOverflow;
1010
- _leftPrevOverflow;
1011
- _rightPrevOverflow;
1012
- _bottomPrevOverflow;
1013
- constructor() {
1014
- super();
1015
- this._tag = "div";
1016
- }
1017
- enter(domNode, element) {
1018
- super.enter(domNode, element);
1019
- const topElement = element.append("header");
1020
- this._bodyElement = element.append("div").attr("class", "body");
1021
- const centerElement = this._bodyElement.append("div").attr("class", "center");
1022
- const leftElement = this._bodyElement.append("div").attr("class", "lhs");
1023
- const rightElement = this._bodyElement.append("div").attr("class", "rhs");
1024
- const bottomElement = element.append("div").attr("class", "footer");
1025
- this._topWA = new WidgetDiv(topElement);
1026
- this._centerWA = new WidgetDiv(centerElement);
1027
- this._leftWA = new WidgetDiv(leftElement);
1028
- this._rightWA = new WidgetDiv(rightElement);
1029
- this._bottomWA = new WidgetDiv(bottomElement);
1030
- }
1031
- update(domNode, element) {
1032
- super.update(domNode, element);
1033
- this._topWA.element().style("display", this.showTop() ? null : "none");
1034
- this._rightWA.element().style("display", this.showRight() ? null : "none");
1035
- this._bottomWA.element().style("display", this.showBottom() ? null : "none");
1036
- this._leftWA.element().style("display", this.showLeft() ? null : "none");
1037
- if (this.topOverflowX() !== this._topWA.overflowX()) this._topWA.overflowX(this.topOverflowX());
1038
- if (this.rightOverflowX() !== this._rightWA.overflowX()) this._rightWA.overflowX(this.rightOverflowX());
1039
- if (this.bottomOverflowX() !== this._bottomWA.overflowX()) this._bottomWA.overflowX(this.bottomOverflowX());
1040
- if (this.leftOverflowX() !== this._leftWA.overflowX()) this._leftWA.overflowX(this.leftOverflowX());
1041
- if (this.topOverflowY() !== this._topWA.overflowY()) this._topWA.overflowY(this.topOverflowY());
1042
- if (this.rightOverflowY() !== this._rightWA.overflowY()) this._rightWA.overflowY(this.rightOverflowY());
1043
- if (this.bottomOverflowY() !== this._bottomWA.overflowY()) this._bottomWA.overflowY(this.bottomOverflowY());
1044
- if (this.leftOverflowY() !== this._leftWA.overflowY()) this._leftWA.overflowY(this.leftOverflowY());
1045
- this.element().style("width", `${this.width()}px`).style("height", `${this.height()}px`);
1046
- }
1047
- targetNull(w) {
1048
- if (w) w.target(null);
1049
- }
1050
- exit(domNode, element) {
1051
- this.targetNull(this.center());
1052
- this.targetNull(this.bottom());
1053
- this.targetNull(this.right());
1054
- this.targetNull(this.left());
1055
- this.targetNull(this.top());
1056
- super.exit(domNode, element);
1057
- }
1058
- swap(sectionA, sectionB) {
1059
- const a$1 = this[sectionA]();
1060
- const b = this[sectionB]();
1061
- this.targetNull(a$1);
1062
- this.targetNull(b);
1063
- this[`_${sectionA}WA`].widget(null);
1064
- this[`_${sectionB}WA`].widget(null);
1065
- this[sectionA](b);
1066
- this[sectionB](a$1);
1067
- return this;
1068
- }
1069
- render(callback) {
1070
- return super.render((w) => {
1071
- if (this._topWA) this._topWA.widget(this.top()).overlay(this.topOverlay()).render(true).then(async (topBBox) => {
1072
- const bottomBBox = await this._bottomWA.widget(this.bottom()).render(true, void 0, this.width());
1073
- const availableHeight = this.height() - (topBBox.height + bottomBBox.height);
1074
- const leftBBox = await this._leftWA.widget(this.left()).render(true, availableHeight);
1075
- const rightBBox = await this._rightWA.widget(this.right()).render(true, availableHeight);
1076
- if (this.bottomHeight_exists()) bottomBBox.height = this.bottomHeight();
1077
- const bodyWidth = this.width() - (leftBBox.width + rightBBox.width);
1078
- const bodyHeight = this.height() - (topBBox.height + bottomBBox.height);
1079
- const centerOverflowX = this.centerOverflowX();
1080
- const centerOverflowY = this.centerOverflowY();
1081
- const scrollCenterX = ["auto", "scroll"].indexOf(centerOverflowX) !== -1;
1082
- const scrollCenterY = ["auto", "scroll"].indexOf(centerOverflowY) !== -1;
1083
- if (scrollCenterX || scrollCenterY) this._centerWA.overflowX(this.centerOverflowX()).overflowY(this.centerOverflowY()).widget(this.center()).resize({
1084
- width: bodyWidth,
1085
- height: bodyHeight
1086
- }).render();
1087
- this._bodyElement.style("height", `${bodyHeight}px`);
1088
- const promises = [
1089
- this._topWA.overflowX(this.topOverflowX()).overflowY(this.topOverflowY()).resize({
1090
- width: this.width(),
1091
- height: topBBox.height
1092
- }).render(),
1093
- this._leftWA.overflowX(this.leftOverflowX()).overflowY(this.leftOverflowY()).resize({
1094
- width: leftBBox.width,
1095
- height: bodyHeight
1096
- }).render(),
1097
- this._rightWA.overflowX(this.rightOverflowX()).overflowY(this.rightOverflowY()).resize({
1098
- width: rightBBox.width,
1099
- height: bodyHeight
1100
- }).render(),
1101
- this._centerWA.overflowX(this.centerOverflowX()).overflowY(this.centerOverflowY()).widget(this.center()).resize({
1102
- width: bodyWidth,
1103
- height: bodyHeight
1104
- }).render(),
1105
- this._bottomWA.overflowX(this.bottomOverflowX()).overflowY(this.bottomOverflowY()).resize({
1106
- width: this.width(),
1107
- height: bottomBBox.height
1108
- }).render()
1109
- ];
1110
- Promise.all(promises).then((promises$1) => {
1111
- if (callback) callback(this);
1112
- });
1113
- });
1114
- else if (callback) callback(this);
1115
- });
1116
- }
1117
- };
1118
- Border2.prototype._class += " layout_Border2";
1119
- Border2.prototype.publish("showTop", true, "boolean", "If true, top widget adapter will display");
1120
- Border2.prototype.publish("showRight", true, "boolean", "If true, right widget adapter will display");
1121
- Border2.prototype.publish("showBottom", true, "boolean", "If true, bottom widget adapter will display");
1122
- Border2.prototype.publish("showLeft", true, "boolean", "If true, left widget adapter will display");
1123
- Border2.prototype.publish("topOverflowX", "visible", "set", "Sets the overflow-x css style for the top widget adapter", [
1124
- "hidden",
1125
- "scroll",
1126
- "visible",
1127
- "auto"
1128
- ]);
1129
- Border2.prototype.publish("rightOverflowX", "visible", "set", "Sets the overflow-x css style for the right widget adapter", [
1130
- "hidden",
1131
- "scroll",
1132
- "visible",
1133
- "auto"
1134
- ]);
1135
- Border2.prototype.publish("bottomOverflowX", "visible", "set", "Sets the overflow-x css style for the bottom widget adapter", [
1136
- "hidden",
1137
- "scroll",
1138
- "visible",
1139
- "auto"
1140
- ]);
1141
- Border2.prototype.publish("leftOverflowX", "visible", "set", "Sets the overflow-x css style for the left widget adapter", [
1142
- "hidden",
1143
- "scroll",
1144
- "visible",
1145
- "auto"
1146
- ]);
1147
- Border2.prototype.publish("centerOverflowX", "visible", "set", "Sets the overflow-x css style for the center widget adapter", [
1148
- "hidden",
1149
- "scroll",
1150
- "visible",
1151
- "auto"
1152
- ]);
1153
- Border2.prototype.publish("topOverflowY", "visible", "set", "Sets the overflow-y css style for the top widget adapter", [
1154
- "hidden",
1155
- "scroll",
1156
- "visible",
1157
- "auto"
1158
- ]);
1159
- Border2.prototype.publish("rightOverflowY", "visible", "set", "Sets the overflow-y css style for the right widget adapter", [
1160
- "hidden",
1161
- "scroll",
1162
- "visible",
1163
- "auto"
1164
- ]);
1165
- Border2.prototype.publish("bottomOverflowY", "visible", "set", "Sets the overflow-y css style for the bottom widget adapter", [
1166
- "hidden",
1167
- "scroll",
1168
- "visible",
1169
- "auto"
1170
- ]);
1171
- Border2.prototype.publish("leftOverflowY", "visible", "set", "Sets the overflow-y css style for the left widget adapter", [
1172
- "hidden",
1173
- "scroll",
1174
- "visible",
1175
- "auto"
1176
- ]);
1177
- Border2.prototype.publish("centerOverflowY", "visible", "set", "Sets the overflow-y css style for the center widget adapter", [
1178
- "hidden",
1179
- "scroll",
1180
- "visible",
1181
- "auto"
1182
- ]);
1183
- Border2.prototype.publish("top", null, "widget", "Top Widget", void 0, { render: false });
1184
- Border2.prototype.publish("topOverlay", false, "boolean", "Overlay Top Widget");
1185
- Border2.prototype.publish("left", null, "widget", "Left Widget", void 0, { render: false });
1186
- Border2.prototype.publish("center", null, "widget", "Center Widget", void 0, { render: false });
1187
- Border2.prototype.publish("right", null, "widget", "Right Widget", void 0, { render: false });
1188
- Border2.prototype.publish("bottom", null, "widget", "Bottom Widget", void 0, { render: false });
1189
- Border2.prototype.publish("bottomHeight", null, "number", "Bottom Fixed Height", void 0, { optional: true });
1190
-
1191
- //#endregion
1192
- //#region src/Carousel.ts
1193
- var Carousel = class extends HTMLWidget {
1194
- _prevActive = 0;
1195
- _root;
1196
- activeWidget() {
1197
- return this.widgets()[this.active()];
1198
- }
1199
- enter(domNode, element) {
1200
- super.enter(domNode, element);
1201
- this._root = element.append("div").attr("id", `${this.id()}_root`);
1202
- }
1203
- update(domNode, element) {
1204
- super.update(domNode, element);
1205
- const active = this.active();
1206
- const width = this.width();
1207
- this._root.style("width", `${width}px`).style("height", `${this.height()}px`);
1208
- const widgetElements = this._root.selectAll(`#${this.id()}_root > .carouselItem`).data(this.widgets(), (d) => d.id());
1209
- const update = widgetElements.enter().append("div").attr("class", "carouselItem").each(function(w) {
1210
- w.target(this);
1211
- }).merge(widgetElements).style("left", (d, i) => `${(i - this._prevActive) * width}px`).style("width", `${width}px`);
1212
- if (this._prevActive !== active) {
1213
- update.style("display", (d, i) => i === this._prevActive || i === active ? null : "none").transition().duration(this.transitionDuration()).style("left", (d, i) => `${(i - active) * width}px`).on("end", function(d, i) {
1214
- select(this).style("display", () => i === active ? null : "none");
1215
- });
1216
- this._prevActive = active;
1217
- }
1218
- widgetElements.exit().each(function(w) {
1219
- w.target(null);
1220
- }).remove();
1221
- }
1222
- exit(domNode, element) {
1223
- this.widgets().forEach((w) => w.target(null));
1224
- super.exit(domNode, element);
1225
- }
1226
- render(callback) {
1227
- return super.render((w) => {
1228
- if (!this.visible() || this.isDOMHidden()) {
1229
- if (callback) callback(w);
1230
- } else {
1231
- const aw = this.activeWidget();
1232
- if (aw) aw.resize(this.size()).render((w2) => {
1233
- if (callback) callback(w);
1234
- });
1235
- }
1236
- });
1237
- }
1238
- };
1239
- Carousel.prototype._class += " layout_Carousel";
1240
- Carousel.prototype.publish("widgets", [], "widgetArray", "Widgets", null, { render: false });
1241
- Carousel.prototype.publish("active", 0, "number", "Active widget");
1242
- Carousel.prototype.publish("transitionDuration", 500, "number", "Transition duration");
1243
-
1244
- //#endregion
1245
- //#region ../../node_modules/d3-path/src/path.js
1246
- var pi$1 = Math.PI, tau$1 = 2 * pi$1, epsilon = 1e-6, tauEpsilon = tau$1 - epsilon;
1247
- function Path() {
1248
- this._x0 = this._y0 = this._x1 = this._y1 = null;
1249
- this._ = "";
1250
- }
1251
- function path() {
1252
- return new Path();
1253
- }
1254
- Path.prototype = path.prototype = {
1255
- constructor: Path,
1256
- moveTo: function(x, y) {
1257
- this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y);
1258
- },
1259
- closePath: function() {
1260
- if (this._x1 !== null) {
1261
- this._x1 = this._x0, this._y1 = this._y0;
1262
- this._ += "Z";
1263
- }
1264
- },
1265
- lineTo: function(x, y) {
1266
- this._ += "L" + (this._x1 = +x) + "," + (this._y1 = +y);
1267
- },
1268
- quadraticCurveTo: function(x1, y1, x, y) {
1269
- this._ += "Q" + +x1 + "," + +y1 + "," + (this._x1 = +x) + "," + (this._y1 = +y);
1270
- },
1271
- bezierCurveTo: function(x1, y1, x2, y2, x, y) {
1272
- this._ += "C" + +x1 + "," + +y1 + "," + +x2 + "," + +y2 + "," + (this._x1 = +x) + "," + (this._y1 = +y);
1273
- },
1274
- arcTo: function(x1, y1, x2, y2, r) {
1275
- x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;
1276
- var x0 = this._x1, y0 = this._y1, x21 = x2 - x1, y21 = y2 - y1, x01 = x0 - x1, y01 = y0 - y1, l01_2 = x01 * x01 + y01 * y01;
1277
- if (r < 0) throw new Error("negative radius: " + r);
1278
- if (this._x1 === null) this._ += "M" + (this._x1 = x1) + "," + (this._y1 = y1);
1279
- else if (!(l01_2 > epsilon));
1280
- else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) this._ += "L" + (this._x1 = x1) + "," + (this._y1 = y1);
1281
- else {
1282
- var x20 = x2 - x0, y20 = y2 - y0, l21_2 = x21 * x21 + y21 * y21, l20_2 = x20 * x20 + y20 * y20, l21 = Math.sqrt(l21_2), l01 = Math.sqrt(l01_2), l = r * Math.tan((pi$1 - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), t01 = l / l01, t21 = l / l21;
1283
- if (Math.abs(t01 - 1) > epsilon) this._ += "L" + (x1 + t01 * x01) + "," + (y1 + t01 * y01);
1284
- this._ += "A" + r + "," + r + ",0,0," + +(y01 * x20 > x01 * y20) + "," + (this._x1 = x1 + t21 * x21) + "," + (this._y1 = y1 + t21 * y21);
1285
- }
1286
- },
1287
- arc: function(x, y, r, a0, a1, ccw) {
1288
- x = +x, y = +y, r = +r, ccw = !!ccw;
1289
- var dx = r * Math.cos(a0), dy = r * Math.sin(a0), x0 = x + dx, y0 = y + dy, cw = 1 ^ ccw, da = ccw ? a0 - a1 : a1 - a0;
1290
- if (r < 0) throw new Error("negative radius: " + r);
1291
- if (this._x1 === null) this._ += "M" + x0 + "," + y0;
1292
- else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) this._ += "L" + x0 + "," + y0;
1293
- if (!r) return;
1294
- if (da < 0) da = da % tau$1 + tau$1;
1295
- if (da > tauEpsilon) this._ += "A" + r + "," + r + ",0,1," + cw + "," + (x - dx) + "," + (y - dy) + "A" + r + "," + r + ",0,1," + cw + "," + (this._x1 = x0) + "," + (this._y1 = y0);
1296
- else if (da > epsilon) this._ += "A" + r + "," + r + ",0," + +(da >= pi$1) + "," + cw + "," + (this._x1 = x + r * Math.cos(a1)) + "," + (this._y1 = y + r * Math.sin(a1));
1297
- },
1298
- rect: function(x, y, w, h) {
1299
- this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y) + "h" + +w + "v" + +h + "h" + -w + "Z";
1300
- },
1301
- toString: function() {
1302
- return this._;
1303
- }
1304
- };
1305
- var path_default = path;
1306
-
1307
- //#endregion
1308
- //#region ../../node_modules/d3-shape/src/constant.js
1309
- function constant_default(x) {
1310
- return function constant() {
1311
- return x;
1312
- };
1313
- }
1314
-
1315
- //#endregion
1316
- //#region ../../node_modules/d3-shape/src/math.js
1317
- var pi = Math.PI;
1318
- var halfPi = pi / 2;
1319
- var tau = 2 * pi;
1320
-
1321
- //#endregion
1322
- //#region ../../node_modules/d3-shape/src/symbol/circle.js
1323
- var circle_default = { draw: function(context, size) {
1324
- var r = Math.sqrt(size / pi);
1325
- context.moveTo(r, 0);
1326
- context.arc(0, 0, r, 0, tau);
1327
- } };
1328
-
1329
- //#endregion
1330
- //#region ../../node_modules/d3-shape/src/symbol/cross.js
1331
- var cross_default = { draw: function(context, size) {
1332
- var r = Math.sqrt(size / 5) / 2;
1333
- context.moveTo(-3 * r, -r);
1334
- context.lineTo(-r, -r);
1335
- context.lineTo(-r, -3 * r);
1336
- context.lineTo(r, -3 * r);
1337
- context.lineTo(r, -r);
1338
- context.lineTo(3 * r, -r);
1339
- context.lineTo(3 * r, r);
1340
- context.lineTo(r, r);
1341
- context.lineTo(r, 3 * r);
1342
- context.lineTo(-r, 3 * r);
1343
- context.lineTo(-r, r);
1344
- context.lineTo(-3 * r, r);
1345
- context.closePath();
1346
- } };
1347
-
1348
- //#endregion
1349
- //#region ../../node_modules/d3-shape/src/symbol/diamond.js
1350
- var tan30 = Math.sqrt(1 / 3), tan30_2 = tan30 * 2;
1351
- var diamond_default = { draw: function(context, size) {
1352
- var y = Math.sqrt(size / tan30_2), x = y * tan30;
1353
- context.moveTo(0, -y);
1354
- context.lineTo(x, 0);
1355
- context.lineTo(0, y);
1356
- context.lineTo(-x, 0);
1357
- context.closePath();
1358
- } };
1359
-
1360
- //#endregion
1361
- //#region ../../node_modules/d3-shape/src/symbol/star.js
1362
- var ka = .8908130915292852, kr = Math.sin(pi / 10) / Math.sin(7 * pi / 10), kx = Math.sin(tau / 10) * kr, ky = -Math.cos(tau / 10) * kr;
1363
- var star_default = { draw: function(context, size) {
1364
- var r = Math.sqrt(size * ka), x = kx * r, y = ky * r;
1365
- context.moveTo(0, -r);
1366
- context.lineTo(x, y);
1367
- for (var i = 1; i < 5; ++i) {
1368
- var a$1 = tau * i / 5, c$1 = Math.cos(a$1), s$1 = Math.sin(a$1);
1369
- context.lineTo(s$1 * r, -c$1 * r);
1370
- context.lineTo(c$1 * x - s$1 * y, s$1 * x + c$1 * y);
1371
- }
1372
- context.closePath();
1373
- } };
1374
-
1375
- //#endregion
1376
- //#region ../../node_modules/d3-shape/src/symbol/square.js
1377
- var square_default = { draw: function(context, size) {
1378
- var w = Math.sqrt(size), x = -w / 2;
1379
- context.rect(x, x, w, w);
1380
- } };
1381
-
1382
- //#endregion
1383
- //#region ../../node_modules/d3-shape/src/symbol/triangle.js
1384
- var sqrt3 = Math.sqrt(3);
1385
- var triangle_default = { draw: function(context, size) {
1386
- var y = -Math.sqrt(size / (sqrt3 * 3));
1387
- context.moveTo(0, y * 2);
1388
- context.lineTo(-sqrt3 * y, -y);
1389
- context.lineTo(sqrt3 * y, -y);
1390
- context.closePath();
1391
- } };
1392
-
1393
- //#endregion
1394
- //#region ../../node_modules/d3-shape/src/symbol/wye.js
1395
- var c = -.5, s = Math.sqrt(3) / 2, k = 1 / Math.sqrt(12), a = (k / 2 + 1) * 3;
1396
- var wye_default = { draw: function(context, size) {
1397
- var r = Math.sqrt(size / a), x0 = r / 2, y0 = r * k, x1 = x0, y1 = r * k + r, x2 = -x1, y2 = y1;
1398
- context.moveTo(x0, y0);
1399
- context.lineTo(x1, y1);
1400
- context.lineTo(x2, y2);
1401
- context.lineTo(c * x0 - s * y0, s * x0 + c * y0);
1402
- context.lineTo(c * x1 - s * y1, s * x1 + c * y1);
1403
- context.lineTo(c * x2 - s * y2, s * x2 + c * y2);
1404
- context.lineTo(c * x0 + s * y0, c * y0 - s * x0);
1405
- context.lineTo(c * x1 + s * y1, c * y1 - s * x1);
1406
- context.lineTo(c * x2 + s * y2, c * y2 - s * x2);
1407
- context.closePath();
1408
- } };
1409
-
1410
- //#endregion
1411
- //#region ../../node_modules/d3-shape/src/symbol.js
1412
- function symbol_default() {
1413
- var type = constant_default(circle_default), size = constant_default(64), context = null;
1414
- function symbol() {
1415
- var buffer;
1416
- if (!context) context = buffer = path_default();
1417
- type.apply(this, arguments).draw(context, +size.apply(this, arguments));
1418
- if (buffer) return context = null, buffer + "" || null;
1419
- }
1420
- symbol.type = function(_) {
1421
- return arguments.length ? (type = typeof _ === "function" ? _ : constant_default(_), symbol) : type;
1422
- };
1423
- symbol.size = function(_) {
1424
- return arguments.length ? (size = typeof _ === "function" ? _ : constant_default(+_), symbol) : size;
1425
- };
1426
- symbol.context = function(_) {
1427
- return arguments.length ? (context = _ == null ? null : _, symbol) : context;
1428
- };
1429
- return symbol;
1430
- }
1431
-
1432
- //#endregion
1433
- //#region ../../node_modules/d3-svg-legend/indexRollupNext.js
1434
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function(obj) {
1435
- return typeof obj;
1436
- } : function(obj) {
1437
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1438
- };
1439
- var d3_identity = function d3_identity$1(d) {
1440
- return d;
1441
- };
1442
- var d3_reverse = function d3_reverse$1(arr) {
1443
- var mirror = [];
1444
- for (var i = 0, l = arr.length; i < l; i++) mirror[i] = arr[l - i - 1];
1445
- return mirror;
1446
- };
1447
- var d3_textWrapping = function d3_textWrapping$1(text, width) {
1448
- text.each(function() {
1449
- var text$1 = select(this), words = text$1.text().split(/\s+/).reverse(), word, line = [], lineHeight = 1.2;
1450
- text$1.attr("y");
1451
- var dy = parseFloat(text$1.attr("dy")) || 0, tspan = text$1.text(null).append("tspan").attr("x", 0).attr("dy", dy + "em");
1452
- while (word = words.pop()) {
1453
- line.push(word);
1454
- tspan.text(line.join(" "));
1455
- if (tspan.node().getComputedTextLength() > width && line.length > 1) {
1456
- line.pop();
1457
- tspan.text(line.join(" "));
1458
- line = [word];
1459
- tspan = text$1.append("tspan").attr("x", 0).attr("dy", lineHeight + dy + "em").text(word);
1460
- }
1461
- }
1462
- });
1463
- };
1464
- var d3_mergeLabels = function d3_mergeLabels$1() {
1465
- var gen = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
1466
- var labels = arguments[1];
1467
- var domain = arguments[2];
1468
- var range = arguments[3];
1469
- var labelDelimiter = arguments[4];
1470
- if ((typeof labels === "undefined" ? "undefined" : _typeof(labels)) === "object") {
1471
- if (labels.length === 0) return gen;
1472
- var i = labels.length;
1473
- for (; i < gen.length; i++) labels.push(gen[i]);
1474
- return labels;
1475
- } else if (typeof labels === "function") {
1476
- var customLabels = [];
1477
- var genLength = gen.length;
1478
- for (var _i = 0; _i < genLength; _i++) customLabels.push(labels({
1479
- i: _i,
1480
- genLength,
1481
- generatedLabels: gen,
1482
- domain,
1483
- range,
1484
- labelDelimiter
1485
- }));
1486
- return customLabels;
1487
- }
1488
- return gen;
1489
- };
1490
- var d3_linearLegend = function d3_linearLegend$1(scale, cells, labelFormat) {
1491
- var data = [];
1492
- if (cells.length > 1) data = cells;
1493
- else {
1494
- var domain = scale.domain(), increment = (domain[domain.length - 1] - domain[0]) / (cells - 1);
1495
- var i = 0;
1496
- for (; i < cells; i++) data.push(domain[0] + i * increment);
1497
- }
1498
- var labels = data.map(labelFormat);
1499
- return {
1500
- data,
1501
- labels,
1502
- feature: function feature(d) {
1503
- return scale(d);
1504
- }
1505
- };
1506
- };
1507
- var d3_quantLegend = function d3_quantLegend$1(scale, labelFormat, labelDelimiter) {
1508
- var labels = scale.range().map(function(d) {
1509
- var invert = scale.invertExtent(d);
1510
- return labelFormat(invert[0]) + " " + labelDelimiter + " " + labelFormat(invert[1]);
1511
- });
1512
- return {
1513
- data: scale.range(),
1514
- labels,
1515
- feature: d3_identity
1516
- };
1517
- };
1518
- var d3_ordinalLegend = function d3_ordinalLegend$1(scale) {
1519
- return {
1520
- data: scale.domain(),
1521
- labels: scale.domain(),
1522
- feature: function feature(d) {
1523
- return scale(d);
1524
- }
1525
- };
1526
- };
1527
- var d3_cellOver = function d3_cellOver$1(cellDispatcher, d, obj) {
1528
- cellDispatcher.call("cellover", obj, d);
1529
- };
1530
- var d3_cellOut = function d3_cellOut$1(cellDispatcher, d, obj) {
1531
- cellDispatcher.call("cellout", obj, d);
1532
- };
1533
- var d3_cellClick = function d3_cellClick$1(cellDispatcher, d, obj) {
1534
- cellDispatcher.call("cellclick", obj, d);
1535
- };
1536
- var helper = {
1537
- d3_drawShapes: function d3_drawShapes(shape, shapes, shapeHeight, shapeWidth, shapeRadius, path$1) {
1538
- if (shape === "rect") shapes.attr("height", shapeHeight).attr("width", shapeWidth);
1539
- else if (shape === "circle") shapes.attr("r", shapeRadius);
1540
- else if (shape === "line") shapes.attr("x1", 0).attr("x2", shapeWidth).attr("y1", 0).attr("y2", 0);
1541
- else if (shape === "path") shapes.attr("d", path$1);
1542
- },
1543
- d3_addText: function d3_addText(svg, enter, labels, classPrefix, labelWidth) {
1544
- enter.append("text").attr("class", classPrefix + "label");
1545
- var text = svg.selectAll("g." + classPrefix + "cell text." + classPrefix + "label").data(labels).text(d3_identity);
1546
- if (labelWidth) svg.selectAll("g." + classPrefix + "cell text." + classPrefix + "label").call(d3_textWrapping, labelWidth);
1547
- return text;
1548
- },
1549
- d3_calcType: function d3_calcType(scale, ascending, cells, labels, labelFormat, labelDelimiter) {
1550
- var type = scale.invertExtent ? d3_quantLegend(scale, labelFormat, labelDelimiter) : scale.ticks ? d3_linearLegend(scale, cells, labelFormat) : d3_ordinalLegend(scale);
1551
- var range = scale.range && scale.range() || scale.domain();
1552
- type.labels = d3_mergeLabels(type.labels, labels, scale.domain(), range, labelDelimiter);
1553
- if (ascending) {
1554
- type.labels = d3_reverse(type.labels);
1555
- type.data = d3_reverse(type.data);
1556
- }
1557
- return type;
1558
- },
1559
- d3_filterCells: function d3_filterCells(type, cellFilter) {
1560
- var filterCells = type.data.map(function(d, i) {
1561
- return {
1562
- data: d,
1563
- label: type.labels[i]
1564
- };
1565
- }).filter(cellFilter);
1566
- var dataValues = filterCells.map(function(d) {
1567
- return d.data;
1568
- });
1569
- var labelValues = filterCells.map(function(d) {
1570
- return d.label;
1571
- });
1572
- type.data = type.data.filter(function(d) {
1573
- return dataValues.indexOf(d) !== -1;
1574
- });
1575
- type.labels = type.labels.filter(function(d) {
1576
- return labelValues.indexOf(d) !== -1;
1577
- });
1578
- return type;
1579
- },
1580
- d3_placement: function d3_placement(orient, cell, cellTrans, text, textTrans, labelAlign) {
1581
- cell.attr("transform", cellTrans);
1582
- text.attr("transform", textTrans);
1583
- if (orient === "horizontal") text.style("text-anchor", labelAlign);
1584
- },
1585
- d3_addEvents: function d3_addEvents(cells, dispatcher) {
1586
- cells.on("mouseover.legend", function(d) {
1587
- d3_cellOver(dispatcher, d, this);
1588
- }).on("mouseout.legend", function(d) {
1589
- d3_cellOut(dispatcher, d, this);
1590
- }).on("click.legend", function(d) {
1591
- d3_cellClick(dispatcher, d, this);
1592
- });
1593
- },
1594
- d3_title: function d3_title(svg, title, classPrefix, titleWidth) {
1595
- if (title !== "") {
1596
- svg.selectAll("text." + classPrefix + "legendTitle").data([title]).enter().append("text").attr("class", classPrefix + "legendTitle");
1597
- svg.selectAll("text." + classPrefix + "legendTitle").text(title);
1598
- if (titleWidth) svg.selectAll("text." + classPrefix + "legendTitle").call(d3_textWrapping, titleWidth);
1599
- var cellsSvg = svg.select("." + classPrefix + "legendCells");
1600
- var yOffset = svg.select("." + classPrefix + "legendTitle").nodes().map(function(d) {
1601
- return d.getBBox().height;
1602
- })[0], xOffset = -cellsSvg.nodes().map(function(d) {
1603
- return d.getBBox().x;
1604
- })[0];
1605
- cellsSvg.attr("transform", "translate(" + xOffset + "," + yOffset + ")");
1606
- }
1607
- },
1608
- d3_defaultLocale: {
1609
- format,
1610
- formatPrefix
1611
- },
1612
- d3_defaultFormatSpecifier: ".01f",
1613
- d3_defaultDelimiter: "to"
1614
- };
1615
- function color() {
1616
- var scale = scaleLinear(), shape = "rect", shapeWidth = 15, shapeHeight = 15, shapeRadius = 10, shapePadding = 2, cells = [5], cellFilter = void 0, labels = [], classPrefix = "", useClass = false, title = "", locale = helper.d3_defaultLocale, specifier = helper.d3_defaultFormatSpecifier, labelOffset = 10, labelAlign = "middle", labelDelimiter = helper.d3_defaultDelimiter, labelWrap = void 0, orient = "vertical", ascending = false, path$1 = void 0, titleWidth = void 0, legendDispatcher = dispatch("cellover", "cellout", "cellclick");
1617
- function legend(svg) {
1618
- var type = helper.d3_calcType(scale, ascending, cells, labels, locale.format(specifier), labelDelimiter);
1619
- svg.selectAll("g").data([scale]).enter().append("g").attr("class", classPrefix + "legendCells");
1620
- if (cellFilter) helper.d3_filterCells(type, cellFilter);
1621
- var cell = svg.select("." + classPrefix + "legendCells").selectAll("." + classPrefix + "cell").data(type.data);
1622
- var cellEnter = cell.enter().append("g").attr("class", classPrefix + "cell");
1623
- cellEnter.append(shape).attr("class", classPrefix + "swatch");
1624
- var shapes = svg.selectAll("g." + classPrefix + "cell " + shape + "." + classPrefix + "swatch").data(type.data);
1625
- helper.d3_addEvents(cellEnter, legendDispatcher);
1626
- cell.exit().transition().style("opacity", 0).remove();
1627
- shapes.exit().transition().style("opacity", 0).remove();
1628
- shapes = shapes.merge(shapes);
1629
- helper.d3_drawShapes(shape, shapes, shapeHeight, shapeWidth, shapeRadius, path$1);
1630
- var text = helper.d3_addText(svg, cellEnter, type.labels, classPrefix, labelWrap);
1631
- cell = cellEnter.merge(cell);
1632
- var textSize = text.nodes().map(function(d) {
1633
- return d.getBBox();
1634
- }), shapeSize = shapes.nodes().map(function(d) {
1635
- return d.getBBox();
1636
- });
1637
- if (!useClass) if (shape == "line") shapes.style("stroke", type.feature);
1638
- else shapes.style("fill", type.feature);
1639
- else shapes.attr("class", function(d) {
1640
- return classPrefix + "swatch " + type.feature(d);
1641
- });
1642
- var cellTrans = void 0, textTrans = void 0, textAlign = labelAlign == "start" ? 0 : labelAlign == "middle" ? .5 : 1;
1643
- if (orient === "vertical") (function() {
1644
- var cellSize = textSize.map(function(d, i) {
1645
- return Math.max(d.height, shapeSize[i].height);
1646
- });
1647
- cellTrans = function cellTrans$1(d, i) {
1648
- return "translate(0, " + (sum(cellSize.slice(0, i)) + i * shapePadding) + ")";
1649
- };
1650
- textTrans = function textTrans$1(d, i) {
1651
- return "translate( " + (shapeSize[i].width + shapeSize[i].x + labelOffset) + ", " + (shapeSize[i].y + shapeSize[i].height / 2 + 5) + ")";
1652
- };
1653
- })();
1654
- else if (orient === "horizontal") {
1655
- cellTrans = function cellTrans$1(d, i) {
1656
- return "translate(" + i * (shapeSize[i].width + shapePadding) + ",0)";
1657
- };
1658
- textTrans = function textTrans$1(d, i) {
1659
- return "translate(" + (shapeSize[i].width * textAlign + shapeSize[i].x) + ",\n " + (shapeSize[i].height + shapeSize[i].y + labelOffset + 8) + ")";
1660
- };
1661
- }
1662
- helper.d3_placement(orient, cell, cellTrans, text, textTrans, labelAlign);
1663
- helper.d3_title(svg, title, classPrefix, titleWidth);
1664
- cell.transition().style("opacity", 1);
1665
- }
1666
- legend.scale = function(_) {
1667
- if (!arguments.length) return scale;
1668
- scale = _;
1669
- return legend;
1670
- };
1671
- legend.cells = function(_) {
1672
- if (!arguments.length) return cells;
1673
- if (_.length > 1 || _ >= 2) cells = _;
1674
- return legend;
1675
- };
1676
- legend.cellFilter = function(_) {
1677
- if (!arguments.length) return cellFilter;
1678
- cellFilter = _;
1679
- return legend;
1680
- };
1681
- legend.shape = function(_, d) {
1682
- if (!arguments.length) return shape;
1683
- if (_ == "rect" || _ == "circle" || _ == "line" || _ == "path" && typeof d === "string") {
1684
- shape = _;
1685
- path$1 = d;
1686
- }
1687
- return legend;
1688
- };
1689
- legend.shapeWidth = function(_) {
1690
- if (!arguments.length) return shapeWidth;
1691
- shapeWidth = +_;
1692
- return legend;
1693
- };
1694
- legend.shapeHeight = function(_) {
1695
- if (!arguments.length) return shapeHeight;
1696
- shapeHeight = +_;
1697
- return legend;
1698
- };
1699
- legend.shapeRadius = function(_) {
1700
- if (!arguments.length) return shapeRadius;
1701
- shapeRadius = +_;
1702
- return legend;
1703
- };
1704
- legend.shapePadding = function(_) {
1705
- if (!arguments.length) return shapePadding;
1706
- shapePadding = +_;
1707
- return legend;
1708
- };
1709
- legend.labels = function(_) {
1710
- if (!arguments.length) return labels;
1711
- labels = _;
1712
- return legend;
1713
- };
1714
- legend.labelAlign = function(_) {
1715
- if (!arguments.length) return labelAlign;
1716
- if (_ == "start" || _ == "end" || _ == "middle") labelAlign = _;
1717
- return legend;
1718
- };
1719
- legend.locale = function(_) {
1720
- if (!arguments.length) return locale;
1721
- locale = formatLocale(_);
1722
- return legend;
1723
- };
1724
- legend.labelFormat = function(_) {
1725
- if (!arguments.length) return legend.locale().format(specifier);
1726
- specifier = formatSpecifier(_);
1727
- return legend;
1728
- };
1729
- legend.labelOffset = function(_) {
1730
- if (!arguments.length) return labelOffset;
1731
- labelOffset = +_;
1732
- return legend;
1733
- };
1734
- legend.labelDelimiter = function(_) {
1735
- if (!arguments.length) return labelDelimiter;
1736
- labelDelimiter = _;
1737
- return legend;
1738
- };
1739
- legend.labelWrap = function(_) {
1740
- if (!arguments.length) return labelWrap;
1741
- labelWrap = _;
1742
- return legend;
1743
- };
1744
- legend.useClass = function(_) {
1745
- if (!arguments.length) return useClass;
1746
- if (_ === true || _ === false) useClass = _;
1747
- return legend;
1748
- };
1749
- legend.orient = function(_) {
1750
- if (!arguments.length) return orient;
1751
- _ = _.toLowerCase();
1752
- if (_ == "horizontal" || _ == "vertical") orient = _;
1753
- return legend;
1754
- };
1755
- legend.ascending = function(_) {
1756
- if (!arguments.length) return ascending;
1757
- ascending = !!_;
1758
- return legend;
1759
- };
1760
- legend.classPrefix = function(_) {
1761
- if (!arguments.length) return classPrefix;
1762
- classPrefix = _;
1763
- return legend;
1764
- };
1765
- legend.title = function(_) {
1766
- if (!arguments.length) return title;
1767
- title = _;
1768
- return legend;
1769
- };
1770
- legend.titleWidth = function(_) {
1771
- if (!arguments.length) return titleWidth;
1772
- titleWidth = _;
1773
- return legend;
1774
- };
1775
- legend.textWrap = function(_) {
1776
- if (!arguments.length) return textWrap;
1777
- textWrap = _;
1778
- return legend;
1779
- };
1780
- legend.on = function() {
1781
- var value = legendDispatcher.on.apply(legendDispatcher, arguments);
1782
- return value === legendDispatcher ? legend : value;
1783
- };
1784
- return legend;
1785
- }
1786
-
1787
- //#endregion
1788
- //#region src/Legend.ts
1789
- var Legend = class extends SVGWidget {
1790
- _owner;
1791
- _targetWidget;
1792
- _targetWidgetMonitor;
1793
- _legendOrdinal;
1794
- _disabled = [];
1795
- _symbolTypeMap = {
1796
- "circle": circle_default,
1797
- "cross": cross_default,
1798
- "diamond": diamond_default,
1799
- "square": square_default,
1800
- "star": star_default,
1801
- "triangle": triangle_default,
1802
- "wye": wye_default
1803
- };
1804
- constructor(owner) {
1805
- super();
1806
- this._owner = owner;
1807
- this._drawStartPos = "origin";
1808
- const context = this;
1809
- this._legendOrdinal = color().shape("path", symbol_default().type(circle_default).size(150)()).shapePadding(10).shapeRadius(10).on("cellclick", function(d) {
1810
- context.onClick(d, this);
1811
- }).on("cellover", (d) => {
1812
- context.onOver(d, this);
1813
- }).on("cellout", (d) => {
1814
- context.onOut(d, this);
1815
- });
1816
- }
1817
- isDisabled(d) {
1818
- if (typeof d === "undefined") return false;
1819
- else if (typeof d === "string") return d.indexOf("__") === 0 || this._disabled.indexOf(d) >= 0;
1820
- else if (d instanceof Database.Field) return d.id().indexOf("__") === 0 || this._disabled.indexOf(d.id()) >= 0;
1821
- return this._disabled.indexOf(d) >= 0;
1822
- }
1823
- filteredFields() {
1824
- switch (this.dataFamily()) {
1825
- case "2D": return this.fields();
1826
- case "ND": return this.fields().filter((d) => !this.isDisabled(d));
1827
- }
1828
- return this.fields();
1829
- }
1830
- filteredColumns() {
1831
- switch (this.dataFamily()) {
1832
- case "2D": return this.columns();
1833
- case "ND": return this.columns().filter((d) => !this.isDisabled(d));
1834
- }
1835
- return this.columns();
1836
- }
1837
- filteredData() {
1838
- switch (this.dataFamily()) {
1839
- case "2D": return this.data().filter((row) => !this.isDisabled(row[0]));
1840
- case "ND":
1841
- const disabledCols = {};
1842
- let anyDisabled = false;
1843
- this.columns().forEach((col, idx) => {
1844
- const disabled = this.isDisabled(col);
1845
- disabledCols[idx] = disabled;
1846
- if (disabled) anyDisabled = true;
1847
- });
1848
- return !anyDisabled ? this.data() : this.data().map((row) => {
1849
- return row.filter((cell, idx) => !disabledCols[idx]);
1850
- });
1851
- }
1852
- return this.data();
1853
- }
1854
- isRainbow() {
1855
- const widget = this.getWidget();
1856
- return widget && widget._palette && widget._palette.type() === "rainbow";
1857
- }
1858
- targetWidget(_) {
1859
- if (!arguments.length) return this._targetWidget;
1860
- this._targetWidget = _;
1861
- if (this._targetWidgetMonitor) {
1862
- this._targetWidgetMonitor.remove();
1863
- delete this._targetWidgetMonitor;
1864
- }
1865
- if (this._targetWidget) {
1866
- const context = this;
1867
- this._targetWidgetMonitor = this._targetWidget.monitor(function(key, newProp, oldProp, source) {
1868
- switch (key) {
1869
- case "chart":
1870
- case "columns":
1871
- case "data":
1872
- case "paletteID":
1873
- context.lazyRender();
1874
- break;
1875
- }
1876
- });
1877
- }
1878
- return this;
1879
- }
1880
- getWidget() {
1881
- if (this._targetWidget) switch (this._targetWidget.classID()) {
1882
- case "composite_MultiChart": return this._targetWidget.chart();
1883
- }
1884
- return this._targetWidget;
1885
- }
1886
- getPalette() {
1887
- const widget = this.getWidget();
1888
- if (widget && widget._palette) switch (widget._palette.type()) {
1889
- case "ordinal": return Palette.ordinal(widget._palette.id());
1890
- case "rainbow": return Palette.rainbow(widget._palette.id());
1891
- }
1892
- return Palette.ordinal("default");
1893
- }
1894
- getPaletteType() {
1895
- return this.getPalette().type();
1896
- }
1897
- fillColorFunc() {
1898
- const widget = this.getWidget();
1899
- if (widget && widget.fillColor) {
1900
- if (widget._palette && widget.paletteID && widget._palette.name !== widget.paletteID()) widget._palette = widget._palette.switch(widget.paletteID());
1901
- return (row, col, sel) => {
1902
- return widget.fillColor(row, col, sel);
1903
- };
1904
- }
1905
- const palette = Palette.ordinal(widget && widget.paletteID ? widget.paletteID() || "default" : "default");
1906
- return (row, col, sel) => {
1907
- return palette(col);
1908
- };
1909
- }
1910
- fillColor(row, col, sel) {
1911
- return this.fillColorFunc()(row, col, sel);
1912
- }
1913
- _g;
1914
- enter(domNode, element) {
1915
- super.enter(domNode, element);
1916
- this._g = element.append("g").attr("class", "legendOrdinal");
1917
- }
1918
- calcMetaData() {
1919
- let dataArr = [];
1920
- let total = 0;
1921
- let maxLabelWidth = 0;
1922
- const colLength = this.columns().length;
1923
- if (this._targetWidget) {
1924
- const columns = this.columns();
1925
- switch (this.getPaletteType()) {
1926
- case "ordinal":
1927
- const fillColor = this.fillColorFunc();
1928
- let val = 0;
1929
- switch (this.dataFamily()) {
1930
- case "2D":
1931
- dataArr = this.data().map(function(n, i) {
1932
- val = this.data()[i].slice(1, colLength).reduce((acc, n$1) => acc + n$1, 0);
1933
- const disabled = this.isDisabled(n[0]);
1934
- if (!disabled) total += val;
1935
- const label = n[0] + (!disabled && this.showSeriesTotal() ? ` (${val})` : "");
1936
- const textSize = this.textSize(label);
1937
- if (maxLabelWidth < textSize.width) maxLabelWidth = textSize.width;
1938
- return [
1939
- fillColor(n, n[0], false),
1940
- n[0],
1941
- label
1942
- ];
1943
- }, this);
1944
- break;
1945
- case "ND":
1946
- dataArr = this.columns().filter((col) => col.indexOf("__") !== 0).filter(function(n, i) {
1947
- return i > 0;
1948
- }).map(function(n, i) {
1949
- val = this.data().reduce((acc, n$1) => acc + n$1[i + 1], 0);
1950
- const disabled = this.isDisabled(columns[i + 1]);
1951
- const label = n + (!disabled && this.showSeriesTotal() ? ` (${val})` : "");
1952
- if (!disabled) total += val;
1953
- const textSize = this.textSize(label);
1954
- if (maxLabelWidth < textSize.width) maxLabelWidth = textSize.width;
1955
- return [
1956
- fillColor(void 0, n, false),
1957
- n,
1958
- label
1959
- ];
1960
- }, this);
1961
- break;
1962
- default:
1963
- dataArr = this.columns().map(function(n) {
1964
- return [fillColor(void 0, n, false), n];
1965
- }, this);
1966
- break;
1967
- }
1968
- break;
1969
- case "rainbow":
1970
- const palette = this.getPalette();
1971
- const format$1 = format(this.rainbowFormat());
1972
- const widget = this.getWidget();
1973
- const steps = this.rainbowBins();
1974
- const weightMin = widget._dataMinWeight;
1975
- const weightMax = widget._dataMaxWeight;
1976
- const stepWeightDiff = (weightMax - weightMin) / (steps - 1);
1977
- dataArr.push([palette(weightMin, weightMin, weightMax), format$1(weightMin)]);
1978
- for (let x = 1; x < steps - 1; ++x) {
1979
- let mid = stepWeightDiff * x;
1980
- if (Math.floor(mid) > parseInt(dataArr[0][1])) mid = Math.floor(mid);
1981
- dataArr.push([palette(mid, weightMin, weightMax), format$1(mid)]);
1982
- }
1983
- dataArr.push([palette(weightMax, weightMin, weightMax), format$1(weightMax)]);
1984
- break;
1985
- }
1986
- }
1987
- return {
1988
- dataArr,
1989
- total,
1990
- maxLabelWidth
1991
- };
1992
- }
1993
- update(domNode, element) {
1994
- super.update(domNode, element);
1995
- const { dataArr, maxLabelWidth, total } = this.calcMetaData();
1996
- const radius = this.shapeRadius();
1997
- const size = this.radiusToSymbolSize(radius);
1998
- const strokeWidth = 1;
1999
- let shapePadding = this.itemPadding();
2000
- if (this.orientation() === "horizontal") shapePadding += maxLabelWidth - radius * 2;
2001
- const ordinal = scaleOrdinal().domain(dataArr.map((row) => row[1])).range(dataArr.map((row) => row[0]));
2002
- this._legendOrdinal.shape("path", symbol_default().type(this._symbolTypeMap[this.symbolType()]).size(size)()).orient(this.orientation()).title(this.title()).labelWrap(this.labelMaxWidth()).labelAlign(this.labelAlign()).shapePadding(shapePadding).scale(ordinal).labels((d) => dataArr[d.i][2]);
2003
- this._g.call(this._legendOrdinal);
2004
- this.updateDisabled(element, dataArr);
2005
- const legendCellsBbox = this._g.select(".legendCells").node().getBBox();
2006
- let offsetX = Math.abs(legendCellsBbox.x);
2007
- let offsetY = Math.abs(legendCellsBbox.y) + strokeWidth;
2008
- if (this.orientation() === "horizontal") {
2009
- if (this.labelAlign() === "start") offsetX += strokeWidth;
2010
- else if (this.labelAlign() === "end") offsetX -= strokeWidth;
2011
- if (this.width() > legendCellsBbox.width) {
2012
- const extraWidth = this.width() - legendCellsBbox.width;
2013
- offsetX += extraWidth / 2;
2014
- }
2015
- } else if (this.orientation() === "vertical") {
2016
- offsetX += strokeWidth;
2017
- if (this._containerSize.height > legendCellsBbox.height) {
2018
- const extraHeight = this.height() - legendCellsBbox.height;
2019
- offsetY += extraHeight / 2;
2020
- }
2021
- }
2022
- this._g.attr("transform", `translate(${offsetX}, ${offsetY})`);
2023
- this.pos({
2024
- x: 0,
2025
- y: 0
2026
- });
2027
- this._legendOrdinal.labelOffset(this.itemPadding());
2028
- const legendTotal = this._g.selectAll(".legendTotal").data(dataArr.length && this.showLegendTotal() ? [total] : []);
2029
- const totalText = `Total: ${total}`;
2030
- const totalOffsetX = -offsetX;
2031
- const totalOffsetY = legendCellsBbox.height + this.itemPadding() + strokeWidth;
2032
- this.enableOverflowScroll(false);
2033
- this.enableOverflow(true);
2034
- legendTotal.enter().append("text").classed("legendTotal", true).merge(legendTotal).attr("transform", `translate(${totalOffsetX}, ${totalOffsetY})`).text(totalText);
2035
- legendTotal.exit().remove();
2036
- }
2037
- updateDisabled(element, dataArr) {
2038
- element.style("cursor", "pointer").selectAll("path.swatch").filter((d, i) => i < dataArr.length).style("stroke", (d, i) => dataArr[i][0]).style("fill", (d, i) => this._disabled.indexOf(d) < 0 ? dataArr[i][0] : "white");
2039
- }
2040
- postUpdate(domNode, element) {
2041
- let w;
2042
- if (this._boundingBox) {
2043
- w = this._boundingBox.width;
2044
- this._boundingBox.width = this._size.width;
2045
- }
2046
- super.postUpdate(domNode, element);
2047
- if (w !== void 0) this._boundingBox.width = w;
2048
- this._parentRelativeDiv.style("overflow", "hidden");
2049
- }
2050
- exit(domNode, element) {
2051
- super.exit(domNode, element);
2052
- }
2053
- radiusToSymbolSize(radius) {
2054
- const circleSize = Math.pow(radius, 2) * Math.PI;
2055
- switch (this.symbolType()) {
2056
- case "star": return circleSize * .45;
2057
- case "triangle": return circleSize * .65;
2058
- case "cross":
2059
- case "diamond":
2060
- case "wye": return circleSize * .75;
2061
- case "circle": return circleSize;
2062
- case "square": return circleSize * 1.3;
2063
- }
2064
- }
2065
- onClick(d, domNode) {
2066
- switch (this.getPaletteType()) {
2067
- case "ordinal":
2068
- switch (this.dataFamily()) {
2069
- case "2D":
2070
- case "ND":
2071
- const disabledIdx = this._disabled.indexOf(d);
2072
- if (disabledIdx < 0) this._disabled.push(d);
2073
- else this._disabled.splice(disabledIdx, 1);
2074
- this._owner.refreshColumns();
2075
- this._owner.refreshData();
2076
- this._owner.render();
2077
- break;
2078
- }
2079
- break;
2080
- }
2081
- }
2082
- onOver(d, domNode) {
2083
- if (instanceOfIHighlight(this._owner)) switch (this.getPaletteType()) {
2084
- case "ordinal":
2085
- switch (this.dataFamily()) {
2086
- case "2D":
2087
- case "ND":
2088
- if (this._disabled.indexOf(d) < 0) this._owner.highlightColumn(d);
2089
- break;
2090
- }
2091
- break;
2092
- }
2093
- }
2094
- onOut(d, domNode) {
2095
- if (instanceOfIHighlight(this._owner)) switch (this.getPaletteType()) {
2096
- case "ordinal":
2097
- switch (this.dataFamily()) {
2098
- case "2D":
2099
- case "ND":
2100
- this._owner.highlightColumn();
2101
- break;
2102
- }
2103
- break;
2104
- }
2105
- }
2106
- onDblClick(rowData, rowIdx) {}
2107
- onMouseOver(rowData, rowIdx) {}
2108
- _containerSize;
2109
- resize(_size) {
2110
- let retVal;
2111
- if (this.fitToContent()) {
2112
- this._containerSize = _size;
2113
- const bbox = this.getBBox();
2114
- if (_size.width > bbox.width) bbox.width = _size.width;
2115
- if (_size.height > bbox.height) bbox.height = _size.height;
2116
- retVal = super.resize.apply(this, [{ ...bbox }]);
2117
- } else retVal = super.resize.apply(this, arguments);
2118
- return retVal;
2119
- }
2120
- };
2121
- Legend.prototype._class += " layout_Legend";
2122
- Legend.prototype.publish("title", "", "string", "Title");
2123
- Legend.prototype.publish("symbolType", "circle", "set", "Shape of each legend item", [
2124
- "circle",
2125
- "cross",
2126
- "diamond",
2127
- "square",
2128
- "star",
2129
- "triangle",
2130
- "wye"
2131
- ]);
2132
- Legend.prototype.publish("labelMaxWidth", null, "number", "Max Label Width (pixels)", null, { optional: true });
2133
- Legend.prototype.publish("orientation", "vertical", "set", "Orientation of Legend rows", ["vertical", "horizontal"], { tags: ["Private"] });
2134
- Legend.prototype.publish("dataFamily", "ND", "set", "Type of data", [
2135
- "1D",
2136
- "2D",
2137
- "ND",
2138
- "map",
2139
- "graph",
2140
- "any"
2141
- ], { tags: ["Private"] });
2142
- Legend.prototype.publish("rainbowFormat", ",", "string", "Rainbow number formatting", null, {
2143
- tags: ["Private"],
2144
- optional: true,
2145
- disable: (w) => !w.isRainbow()
2146
- });
2147
- Legend.prototype.publish("rainbowBins", 8, "number", "Number of rainbow bins", null, {
2148
- tags: ["Private"],
2149
- disable: (w) => !w.isRainbow()
2150
- });
2151
- Legend.prototype.publish("showSeriesTotal", false, "boolean", "Show value next to series");
2152
- Legend.prototype.publish("showLegendTotal", false, "boolean", "Show a total of the series values under the legend", null);
2153
- Legend.prototype.publish("itemPadding", 8, "number", "Padding between legend items (pixels)");
2154
- Legend.prototype.publish("shapeRadius", 7, "number", "Radius of legend shape (pixels)");
2155
- Legend.prototype.publish("fitToContent", true, "boolean", "If true, resize will simply reapply the bounding box dimensions");
2156
- Legend.prototype.publish("labelAlign", "start", "set", "Horizontal alignment of legend item label (for horizontal orientation only)", [
2157
- "start",
2158
- "middle",
2159
- "end"
2160
- ], {
2161
- optional: true,
2162
- disable: (w) => w.orientation() === "vertical"
2163
- });
2164
-
2165
- //#endregion
2166
- //#region src/Modal.ts
2167
- var Modal = class extends HTMLWidget {
2168
- _widget;
2169
- _relativeTarget;
2170
- _fade;
2171
- _modal;
2172
- _modalHeader;
2173
- _modalBody;
2174
- _modalHeaderAnnotations;
2175
- _modalHeaderCloseButton;
2176
- _close;
2177
- constructor() {
2178
- super();
2179
- this._tag = "div";
2180
- }
2181
- closeModal() {
2182
- this.visible(false);
2183
- }
2184
- getRelativeTarget() {
2185
- let relativeTarget;
2186
- if (this.relativeTargetId()) {
2187
- relativeTarget = document.getElementById(this.relativeTargetId());
2188
- if (relativeTarget) return relativeTarget;
2189
- }
2190
- if (!relativeTarget) {
2191
- relativeTarget = this.locateAncestor("layout_Grid");
2192
- if (relativeTarget && relativeTarget.element) return relativeTarget.element().node();
2193
- }
2194
- return document.body;
2195
- }
2196
- setModalSize() {
2197
- if (this.fixedHeight() !== null && this.fixedWidth() !== null) this._modal.style("height", this.fixedHeight()).style("width", this.fixedWidth()).style("min-height", null).style("min-width", null).style("max-height", null).style("max-width", null);
2198
- else if (this.minHeight() || this.minWidth()) this._modal.style("min-height", this.minHeight()).style("min-width", this.minWidth()).style("max-height", this.maxHeight()).style("max-width", this.maxWidth());
2199
- const modalRect = this._modal.node().getBoundingClientRect();
2200
- const headerRect = this._modalHeader.node().getBoundingClientRect();
2201
- this._modalBody.style("height", modalRect.height - headerRect.height + "px").style("width", modalRect.width);
2202
- return modalRect;
2203
- }
2204
- setFadePosition(rect) {
2205
- this._fade.style("top", rect.top + "px").style("left", rect.left + "px").style("width", rect.width + "px").style("height", rect.height + "px");
2206
- }
2207
- setModalPosition(rect) {
2208
- const modalRect = this.setModalSize();
2209
- if (this.fixedTop() !== null && this.fixedLeft() !== null) this._modal.style("top", `calc(${this.fixedTop()} + ${rect.top}px)`).style("left", `calc(${this.fixedLeft()} + ${rect.left}px)`);
2210
- else if (this.fixedHeight() !== null && this.fixedWidth() !== null) this._modal.style("top", rect.top + rect.height / 2 - modalRect.height / 2 + "px").style("left", rect.left + rect.width / 2 - modalRect.width / 2 + "px");
2211
- else if (this.minHeight() || this.minWidth()) {
2212
- const contentRect = this._modal.node().getBoundingClientRect();
2213
- this._modal.style("top", rect.top + rect.height / 2 - contentRect.height / 2 + "px").style("left", rect.left + rect.width / 2 - contentRect.width / 2 + "px");
2214
- }
2215
- }
2216
- resize(size) {
2217
- super.resize();
2218
- if (this._modal) this.setModalSize();
2219
- return this;
2220
- }
2221
- resizeBodySync(width, height) {
2222
- const headerRect = this._modalHeader.node().getBoundingClientRect();
2223
- this._modal.style("width", width + "px").style("height", height + headerRect.height + "px").style("min-width", width + "px").style("min-height", height + headerRect.height + "px");
2224
- this._modalHeader.style("width", width + "px");
2225
- this._modalBody.style("width", width + "px").style("height", height + "px");
2226
- return this.minWidth(width + "px").minHeight(height + headerRect.height + "px").resize({
2227
- height: height + headerRect.height,
2228
- width
2229
- });
2230
- }
2231
- enter(domNode, element) {
2232
- super.enter(domNode, element);
2233
- this._fade = element.append("div").classed("layout_Modal-fade", true).classed("layout_Modal-fadeClickable", this.enableClickFadeToClose()).classed("layout_Modal-fade-hidden", !this.showFade());
2234
- const header_h = this.titleFontSize() * 2;
2235
- this._modal = element.append("div").classed("layout_Modal-content", true);
2236
- this._modalHeader = this._modal.append("div").classed("layout_Modal-header", true).style("color", this.titleFontColor()).style("font-size", this.titleFontSize() + "px").style("height", header_h + "px");
2237
- this._modalBody = this._modal.append("div").classed("layout_Modal-body", true).style("height", `calc( 100% - ${header_h}px )`).style("overflow-x", this.overflowX()).style("overflow-y", this.overflowY());
2238
- this._modalHeader.append("div").classed("layout_Modal-title", true).style("line-height", this.titleFontSize() + "px").style("top", this.titleFontSize() / 2 + "px").style("left", this.titleFontSize() / 2 + "px").text(this.formattedTitle());
2239
- this._modalHeaderAnnotations = this._modalHeader.append("div").classed("layout_Modal-annotations", true);
2240
- this._modalHeaderCloseButton = this._modalHeaderAnnotations.append("div").classed("layout_Modal-closeButton", true).html("<i class=\"fa fa-close\"></i>");
2241
- this._modalHeaderAnnotations.style("line-height", this.titleFontSize() + "px").style("right", this.titleFontSize() / 2 + "px").style("top", this.titleFontSize() / 2 + "px");
2242
- this._modalHeaderCloseButton.on("click", () => {
2243
- this.closeModal();
2244
- });
2245
- this._fade.on("click", (n) => {
2246
- if (this.enableClickFadeToClose()) this.closeModal();
2247
- });
2248
- }
2249
- update(domNode, element) {
2250
- super.update(domNode, element);
2251
- element.style("display", this.show() ? null : "none");
2252
- this._fade.classed("layout_Modal-fade-hidden", !this.showFade());
2253
- this._relativeTarget = this.getRelativeTarget();
2254
- this.setModalSize();
2255
- const rect = this._relativeTarget.getBoundingClientRect();
2256
- this.setFadePosition(rect);
2257
- this.setModalPosition(rect);
2258
- if (this.show()) {
2259
- if (!this._widget.target()) this._widget.target(this._modalBody.node());
2260
- this._widget.resize().render();
2261
- } else this._widget.target(null).render();
2262
- }
2263
- exit(domNode, element) {
2264
- if (this._widget) this._widget.target(null);
2265
- super.exit(domNode, element);
2266
- }
2267
- formattedTitle() {
2268
- const title = this.title_exists() ? this.title().trim() : "";
2269
- if (title.length > 0 && title.slice(0, 1) === "(" && title.slice(-1) === ")") return title.slice(1, -1);
2270
- return this.title();
2271
- }
2272
- };
2273
- Modal.prototype._class += " layout_Modal";
2274
- Modal.prototype.publish("title", null, "string", "title");
2275
- Modal.prototype.publish("widget", null, "widget", "widget");
2276
- Modal.prototype.publish("titleFontSize", 18, "number", "titleFontSize (in pixels)");
2277
- Modal.prototype.publish("titleFontColor", "#ffffff", "html-color", "titleFontColor");
2278
- Modal.prototype.publish("relativeTargetId", null, "string", "relativeTargetId");
2279
- Modal.prototype.publish("show", true, "boolean", "show");
2280
- Modal.prototype.publish("showFade", true, "boolean", "showFade");
2281
- Modal.prototype.publish("enableClickFadeToClose", true, "boolean", "enableClickFadeToClose");
2282
- Modal.prototype.publish("minWidth", "400px", "string", "minWidth");
2283
- Modal.prototype.publish("minHeight", "400px", "string", "minHeight");
2284
- Modal.prototype.publish("maxWidth", "800px", "string", "maxWidth");
2285
- Modal.prototype.publish("maxHeight", "800px", "string", "maxHeight");
2286
- Modal.prototype.publish("fixedWidth", null, "string", "fixedWidth");
2287
- Modal.prototype.publish("fixedHeight", null, "string", "fixedHeight");
2288
- Modal.prototype.publish("fixedTop", null, "string", "fixedTop");
2289
- Modal.prototype.publish("fixedLeft", null, "string", "fixedLeft");
2290
- Modal.prototype.publish("overflowX", "hidden", "string", "overflowX");
2291
- Modal.prototype.publish("overflowY", "scroll", "string", "overflowY");
2292
-
2293
- //#endregion
2294
- //#region src/ChartPanel.ts
2295
- var ChartPanel = class extends Border2 {
2296
- _legend = new Legend(this).enableOverflow(true);
2297
- _progressBar = new ProgressBar();
2298
- _autoScale = false;
2299
- _resolutions = {
2300
- tiny: {
2301
- width: 100,
2302
- height: 100
2303
- },
2304
- small: {
2305
- width: 300,
2306
- height: 300
2307
- }
2308
- };
2309
- _modal = new Modal();
2310
- _highlight;
2311
- _scale;
2312
- _orig_size;
2313
- _toggleInfo = new ToggleButton().faChar("fa-info-circle").tooltip(".Description").selected(false).on("enabled", () => {
2314
- return this.description() !== "";
2315
- }).on("click", () => {
2316
- if (this._toggleInfo.selected()) {
2317
- this._modal.title(this.title()).widget(new Text().text(this.description())).show(true).render();
2318
- const origCloseFunc = this._modal._close;
2319
- this._modal._close = () => {
2320
- this._toggleInfo.selected(false).render();
2321
- this._modal._close = origCloseFunc;
2322
- };
2323
- }
2324
- }).on("mouseMove", () => {}).on("mouseOut", () => {});
2325
- _toggleData = new ToggleButton().faChar("fa-table").tooltip("Data").on("click", () => {
2326
- this.dataVisible(this._toggleData.selected());
2327
- this.render();
2328
- });
2329
- _buttonDownload = new Button().faChar("fa-download").tooltip("Download").on("click", () => {
2330
- this.downloadCSV();
2331
- });
2332
- _buttonDownloadImage = new Button().faChar("fa-image").tooltip("Download Image").on("click", () => {
2333
- this.downloadPNG();
2334
- });
2335
- _toggleLegend = new ToggleButton().faChar("fa-list-ul").tooltip("Legend").selected(false).on("click", () => {
2336
- const selected = this._toggleLegend.selected();
2337
- if (this.legendPosition() === "bottom") this.showBottom(selected);
2338
- else if (this.legendPosition() === "right") this.showRight(selected);
2339
- this.legendVisible(selected);
2340
- this.render();
2341
- });
2342
- _spacer = new Spacer();
2343
- _titleBar = new TitleBar().buttons([
2344
- this._toggleData,
2345
- this._buttonDownload,
2346
- this._buttonDownloadImage,
2347
- this._spacer,
2348
- this._toggleLegend
2349
- ]);
2350
- _carousel = new Carousel();
2351
- _table = new Table();
2352
- _widget;
2353
- _hideLegendToggleList = ["dgrid_Table"];
2354
- constructor() {
2355
- super();
2356
- this._tag = "div";
2357
- }
2358
- fields(_) {
2359
- if (!arguments.length) return super.fields();
2360
- super.fields(_);
2361
- this._legend.fields(_);
2362
- this.refreshFields();
2363
- return this;
2364
- }
2365
- refreshFields() {
2366
- this._widget.fields(this._legend.filteredFields());
2367
- this._table.fields(this._legend.filteredFields());
2368
- return this;
2369
- }
2370
- columns(_, asDefault) {
2371
- if (!arguments.length) return super.columns();
2372
- super.columns(_, asDefault);
2373
- this._legend.columns(_, asDefault);
2374
- this.refreshColumns();
2375
- return this;
2376
- }
2377
- refreshColumns() {
2378
- this._widget.columns(this._legend.filteredColumns());
2379
- this._table.columns(this._legend.filteredColumns());
2380
- return this;
2381
- }
2382
- data(_) {
2383
- if (!arguments.length) return super.data();
2384
- super.data(_);
2385
- this._legend.data(_);
2386
- this.refreshData();
2387
- return this;
2388
- }
2389
- refreshData() {
2390
- this._widget.data(this._legend.filteredData());
2391
- this._table.data(this._legend.filteredData());
2392
- return this;
2393
- }
2394
- highlight(_) {
2395
- if (!arguments.length) return this._highlight;
2396
- this._highlight = _;
2397
- return this;
2398
- }
2399
- startProgress() {
2400
- this._progressBar.start();
2401
- }
2402
- finishProgress() {
2403
- this._progressBar.finish();
2404
- }
2405
- buttons(_) {
2406
- if (!arguments.length) return this._titleBar.buttons();
2407
- this._titleBar.buttons(_);
2408
- return this;
2409
- }
2410
- downloadCSV() {
2411
- const namePrefix = this.downloadTitle() ? this.downloadTitle() : this.title() ? this.title() : "data";
2412
- const nameSuffix = this.downloadTimestampSuffix() ? "_" + Utility.timestamp() : "";
2413
- Utility.downloadString("CSV", this._widget.export("CSV"), namePrefix + nameSuffix);
2414
- return this;
2415
- }
2416
- downloadPNG() {
2417
- const widget = this.widget();
2418
- if (widget instanceof SVGWidget) if (!this.legendVisible()) widget.downloadPNG(this.title());
2419
- else widget.downloadPNG(this.title(), void 0, this._legend);
2420
- return this;
2421
- }
2422
- highlightColumn(column) {
2423
- if (column) {
2424
- const cssTag = `series-${this.cssTag(column)}`;
2425
- this._centerWA.element().selectAll(".series").each(function() {
2426
- const element = select(this);
2427
- const highlight = element.classed(cssTag);
2428
- element.classed("highlight", highlight).classed("lowlight", !highlight);
2429
- });
2430
- } else this._centerWA.element().selectAll(".series").classed("highlight", false).classed("lowlight", false);
2431
- return this;
2432
- }
2433
- getResponsiveMode() {
2434
- if (!this.enableAutoscaling()) return "none";
2435
- if (!this._autoScale) return "regular";
2436
- if (this.size().width <= this._resolutions.tiny.width || this.size().height <= this._resolutions.tiny.height) return "tiny";
2437
- else if (this.size().width <= this._resolutions.small.width || this.size().height <= this._resolutions.small.height) return "small";
2438
- return "regular";
2439
- }
2440
- setOrigSize() {
2441
- this._orig_size = JSON.parse(JSON.stringify(this.size()));
2442
- }
2443
- enter(domNode, element) {
2444
- super.enter(domNode, element);
2445
- this._modal.target(this.target()).relativeTargetId(this.id());
2446
- this.top(this._titleBar);
2447
- this.center(this._carousel);
2448
- this._legend.targetWidget(this._widget).orientation("vertical").title("").visible(false);
2449
- this._progressBar.enter(domNode, element);
2450
- this.setOrigSize();
2451
- }
2452
- preUpdateTiny(element) {
2453
- element.selectAll("div.body,div.title-text,div.icon-bar").style("display", "none");
2454
- }
2455
- preUpdateSmall(element) {
2456
- const scale_x = this._orig_size.width / this._resolutions.small.width;
2457
- const scale_y = this._orig_size.height / this._resolutions.small.height;
2458
- this._scale = Math.min(scale_x, scale_y);
2459
- const x_is_smaller = this._scale === scale_x;
2460
- this.size({
2461
- width: x_is_smaller ? this._resolutions.small.width : this._orig_size.width * (1 / this._scale),
2462
- height: !x_is_smaller ? this._resolutions.small.height : this._orig_size.height * (1 / this._scale)
2463
- });
2464
- element.select("div.title-icon").style("position", "static");
2465
- element.selectAll("lhs").style("display", "none");
2466
- element.selectAll("div.body,div.title-text,div.icon-bar").style("display", "");
2467
- element.selectAll("div.data-count").style("visibility", "hidden");
2468
- element.style("transform", `scale(${this._scale})`);
2469
- }
2470
- preUpdateRegular(element) {
2471
- element.selectAll("div.body,div.title-text,div.icon-bar").style("display", "");
2472
- element.selectAll("div.data-count").style("visibility", "hidden");
2473
- element.select("div.title-icon").style("position", "static");
2474
- element.style("transform", "translate(0px,0px) scale(1)");
2475
- }
2476
- _prevdataVisible;
2477
- _prevlegendVisible;
2478
- _prevLegendPosition;
2479
- _prevChartDataFamily;
2480
- _prevChart;
2481
- _prevButtons;
2482
- update(domNode, element) {
2483
- super.update(domNode, element);
2484
- }
2485
- preUpdate(domNode, element) {
2486
- super.preUpdate(domNode, element);
2487
- if (this._prevLegendPosition !== this.legendPosition()) {
2488
- if (this._legend.target() !== null) this._legend.target(null);
2489
- if (this._prevLegendPosition !== void 0) this.swap(this._prevLegendPosition, this.legendPosition());
2490
- else this[this.legendPosition()](this._legend);
2491
- if (this.legendPosition() === "right") {
2492
- this.rightOverflowX("hidden");
2493
- this.rightOverflowY("auto");
2494
- this.bottomOverflowX("visible");
2495
- this.bottomOverflowY("visible");
2496
- } else {
2497
- this.rightOverflowX("visible");
2498
- this.rightOverflowY("visible");
2499
- this.bottomOverflowX("auto");
2500
- this.bottomOverflowY("hidden");
2501
- }
2502
- this._prevLegendPosition = this.legendPosition();
2503
- }
2504
- if (this._prevdataVisible !== this.dataVisible()) {
2505
- this._prevdataVisible = this.dataVisible();
2506
- this._toggleData.selected(this._prevdataVisible);
2507
- this._legend.visible(this._prevlegendVisible && !this._prevdataVisible);
2508
- this._carousel.active(this._prevdataVisible ? 1 : 0);
2509
- }
2510
- if (this._prevlegendVisible !== this.legendVisible()) {
2511
- this._prevlegendVisible = this.legendVisible();
2512
- this._toggleLegend.selected(this._prevlegendVisible);
2513
- this._legend.visible(this._prevlegendVisible && !this._prevdataVisible);
2514
- }
2515
- this._legend.orientation(this.legendPosition() === "bottom" ? "horizontal" : "vertical");
2516
- this.showLeft(!this.left());
2517
- switch (this.getResponsiveMode()) {
2518
- case "tiny":
2519
- this.preUpdateTiny(element);
2520
- break;
2521
- case "small":
2522
- this.preUpdateSmall(element);
2523
- break;
2524
- case "regular":
2525
- this.preUpdateRegular(element);
2526
- break;
2527
- }
2528
- const chart = this._widget.classID() === "composite_MultiChart" ? this._widget["chart"]() : this._widget;
2529
- this._legend.dataFamily(chart._dataFamily || "any");
2530
- if (this._prevChartDataFamily !== this._legend.dataFamily()) {
2531
- this._prevChartDataFamily = this._legend.dataFamily();
2532
- switch (this._prevChartDataFamily) {
2533
- case "any":
2534
- this._toggleLegend.selected(false);
2535
- this._legend.visible(false);
2536
- break;
2537
- }
2538
- }
2539
- element.style("box-shadow", this.highlight() ? `inset 0px 0px 0px ${this.highlightSize()}px ${this.highlightColor()}` : "none");
2540
- if (this._hideLegendToggleList.indexOf(chart.classID()) !== -1) {
2541
- this._spacer.visible(false);
2542
- this._toggleLegend.visible(false);
2543
- } else {
2544
- this._spacer.visible(true);
2545
- this._toggleLegend.visible(true);
2546
- }
2547
- if (this._prevChart !== chart) {
2548
- this._prevChart = chart;
2549
- const widgetIconBar = chart ? chart["_titleBar"] || chart["_iconBar"] : void 0;
2550
- if (widgetIconBar && widgetIconBar instanceof IconBar) {
2551
- this._prevButtons = this._prevButtons || [...this.buttons()];
2552
- const buttons = [
2553
- ...widgetIconBar.buttons(),
2554
- new Spacer(),
2555
- ...this._prevButtons
2556
- ];
2557
- widgetIconBar.buttons([]).render();
2558
- this.buttons(buttons);
2559
- } else if (this._prevButtons) this.buttons(this._prevButtons);
2560
- }
2561
- const hiddenButtons = [];
2562
- if (!this.dataButtonVisible()) hiddenButtons.push(this._toggleData);
2563
- if (!this.downloadButtonVisible()) hiddenButtons.push(this._buttonDownload);
2564
- if (!this.downloadImageButtonVisible()) hiddenButtons.push(this._buttonDownloadImage);
2565
- if (!this.legendButtonVisible()) hiddenButtons.push(this._toggleLegend);
2566
- this._buttonDownloadImage.enabled(this.widget() instanceof SVGWidget);
2567
- this._titleBar.hiddenButtons(hiddenButtons).visible(this.titleVisible());
2568
- this.topOverlay(this.titleOverlay() || !this.titleVisible());
2569
- }
2570
- postUpdate(domNode, element) {
2571
- super.postUpdate(domNode, element);
2572
- switch (this.getResponsiveMode()) {
2573
- case "tiny":
2574
- this.postUpdateTiny(element);
2575
- break;
2576
- case "small":
2577
- this.postUpdateSmall(element);
2578
- break;
2579
- case "regular":
2580
- this.postUpdateRegular(element);
2581
- break;
2582
- }
2583
- }
2584
- postUpdateTiny(element) {
2585
- element.selectAll("div.body,div.title-text,div.icon-bar").style("display", "none");
2586
- element.selectAll("div.data-count").style("visibility", "visible").style("font-size", this.titleIconFontSize() / 3 + "px").style("line-height", this.titleIconFontSize() / 3 + "px").style("left", this.titleIconFontSize() + "px").text(this.data().length);
2587
- element.style("transform", "translate(0px,0px) scale(1)");
2588
- const iconDiv = element.selectAll("div.title-icon");
2589
- const _node = iconDiv.node();
2590
- const containerRect = element.node().parentElement.getBoundingClientRect();
2591
- if (_node) {
2592
- const rect = iconDiv.node().getBoundingClientRect();
2593
- const icon_top = containerRect.height / 2;
2594
- iconDiv.style("position", "absolute").style("left", `calc(50% - ${rect.width / 2}px)`).style("top", `${icon_top - rect.height / 2}px`);
2595
- element.selectAll("div.data-count").style("position", "absolute").style("left", `calc(50% + ${rect.width / 2}px)`).style("top", `${icon_top - rect.height / 2}px`);
2596
- }
2597
- }
2598
- postUpdateSmall(element) {
2599
- element.selectAll("lhs").style("display", "none");
2600
- element.selectAll("div.title-icon").style("position", "static");
2601
- element.selectAll("div.body,div.title-text,div.icon-bar").style("display", "");
2602
- element.selectAll("div.data-count").style("visibility", "hidden");
2603
- const rect = element.node().getBoundingClientRect();
2604
- const parentRect = element.node().parentElement.getBoundingClientRect();
2605
- element.style("transform", `translate(${parentRect.x - rect.x}px, ${parentRect.y - rect.y}px) scale(${this._scale})`);
2606
- }
2607
- postUpdateRegular(element) {
2608
- element.selectAll("div.title-icon").style("position", "static");
2609
- element.selectAll("div.body,div.title-text,div.icon-bar").style("display", "");
2610
- element.selectAll("div.data-count").style("visibility", "hidden");
2611
- }
2612
- exit(domNode, element) {
2613
- this._progressBar.exit(domNode, element);
2614
- this.right(null);
2615
- this._legend.target(null);
2616
- this.center(null);
2617
- this._carousel.target(null);
2618
- this.top(null);
2619
- this._titleBar.target(null);
2620
- this._modal.target(null);
2621
- delete this._prevChart;
2622
- delete this._prevButtons;
2623
- delete this._prevChartDataFamily;
2624
- delete this._prevPos;
2625
- delete this._prevdataVisible;
2626
- delete this._prevlegendVisible;
2627
- super.exit(domNode, element);
2628
- }
2629
- click(row, column, selected) {}
2630
- dblclick(row, column, selected) {}
2631
- vertex_click(row, col, sel, more) {
2632
- if (more && more.vertex) {}
2633
- }
2634
- vertex_dblclick(row, col, sel, more) {
2635
- if (more && more.vertex) {}
2636
- }
2637
- edge_click(row, col, sel, more) {
2638
- if (more && more.edge) {}
2639
- }
2640
- edge_dblclick(row, col, sel, more) {
2641
- if (more && more.edge) {}
2642
- }
2643
- };
2644
- ChartPanel.prototype._class += " layout_ChartPanel";
2645
- ChartPanel.prototype.publishReset();
2646
- ChartPanel.prototype.publishProxy("title", "_titleBar");
2647
- ChartPanel.prototype.publish("titleVisible", true, "boolean");
2648
- ChartPanel.prototype.publish("titleOverlay", false, "boolean");
2649
- ChartPanel.prototype.publishProxy("titleIcon", "_titleBar");
2650
- ChartPanel.prototype.publishProxy("titleIconFont", "_titleBar");
2651
- ChartPanel.prototype.publishProxy("titleFont", "_titleBar");
2652
- ChartPanel.prototype.publishProxy("titleIconFontSize", "_titleBar");
2653
- ChartPanel.prototype.publishProxy("titleFontSize", "_titleBar");
2654
- ChartPanel.prototype.publishProxy("description", "_titleBar");
2655
- ChartPanel.prototype.publishProxy("descriptionFont", "_titleBar");
2656
- ChartPanel.prototype.publishProxy("descriptionFontSize", "_titleBar");
2657
- ChartPanel.prototype.publish("dataVisible", false, "boolean", "Show data table");
2658
- ChartPanel.prototype.publish("dataButtonVisible", true, "boolean", "Show data table button");
2659
- ChartPanel.prototype.publish("downloadButtonVisible", true, "boolean", "Show data download button");
2660
- ChartPanel.prototype.publish("downloadImageButtonVisible", false, "boolean", "Show image download button");
2661
- ChartPanel.prototype.publish("downloadTitle", "", "string", "File name when downloaded");
2662
- ChartPanel.prototype.publish("downloadTimestampSuffix", true, "boolean", "Use timestamp as file name suffix");
2663
- ChartPanel.prototype.publish("legendVisible", false, "boolean", "Show legend");
2664
- ChartPanel.prototype.publish("legendButtonVisible", true, "boolean", "Show legend button");
2665
- ChartPanel.prototype.publish("legendPosition", "right", "set", "Position of legend", ["right", "bottom"]);
2666
- ChartPanel.prototype.publishProxy("legend_labelMaxWidth", "_legend", "labelMaxWidth");
2667
- ChartPanel.prototype.publishProxy("legend_showSeriesTotal", "_legend", "showSeriesTotal");
2668
- ChartPanel.prototype.publishProxy("legend_showLegendTotal", "_legend", "showLegendTotal");
2669
- ChartPanel.prototype.publishProxy("legend_itemPadding", "_legend", "itemPadding");
2670
- ChartPanel.prototype.publishProxy("legend_shapeRadius", "_legend", "shapeRadius");
2671
- ChartPanel.prototype.publishProxy("legend_symbolType", "_legend", "symbolType");
2672
- ChartPanel.prototype.publishProxy("legend_labelAlign", "_legend", "labelAlign");
2673
- ChartPanel.prototype.publish("widget", null, "widget", "Widget", void 0, { render: false });
2674
- ChartPanel.prototype.publish("enableAutoscaling", false, "boolean");
2675
- ChartPanel.prototype.publish("highlightSize", 4, "number");
2676
- ChartPanel.prototype.publish("highlightColor", "#e67e22", "html-color");
2677
- ChartPanel.prototype.publishProxy("progress_halfLife", "_progressBar", "halfLife");
2678
- ChartPanel.prototype.publishProxy("progress_decay", "_progressBar", "decay");
2679
- ChartPanel.prototype.publishProxy("progress_size", "_progressBar", "size");
2680
- ChartPanel.prototype.publishProxy("progress_color", "_progressBar", "color");
2681
- ChartPanel.prototype.publishProxy("progress_blurBar", "_progressBar", "blurBar");
2682
- ChartPanel.prototype.publishProxy("progress_blurSize", "_progressBar", "blurSize");
2683
- ChartPanel.prototype.publishProxy("progress_blurColor", "_progressBar", "blurColor");
2684
- ChartPanel.prototype.publishProxy("progress_blurOpacity", "_progressBar", "blurOpacity");
2685
- ChartPanel.prototype.widget = function(_) {
2686
- if (!arguments.length) return this._widget;
2687
- this._carousel.widgets([_, this._table]);
2688
- this._widget = _;
2689
- this._widget.fields(this._legend.filteredFields()).data(this._legend.filteredData());
2690
- const context = this;
2691
- const tmpAny = this._widget;
2692
- tmpAny.click = function() {
2693
- context.click.apply(context, arguments);
2694
- };
2695
- tmpAny.dblclick = function() {
2696
- context.dblclick.apply(context, arguments);
2697
- };
2698
- tmpAny.vertex_click = function() {
2699
- context.vertex_click.apply(context, arguments);
2700
- };
2701
- tmpAny.vertex_dblclick = function() {
2702
- context.vertex_dblclick.apply(context, arguments);
2703
- };
2704
- tmpAny.edge_click = function() {
2705
- context.edge_click.apply(context, arguments);
2706
- };
2707
- tmpAny.edge_dblclick = function() {
2708
- context.edge_dblclick.apply(context, arguments);
2709
- };
2710
- return this;
2711
- };
2712
-
2713
- //#endregion
2714
- //#region src/FlexGrid.ts
2715
- var FlexGrid = class extends HTMLWidget {
2716
- constructor() {
2717
- super();
2718
- }
2719
- enter(domNode, element) {
2720
- super.enter(domNode, element);
2721
- select(domNode.parentNode).style("height", "100%").style("width", "100%");
2722
- }
2723
- update(domNode, element) {
2724
- super.update(domNode, element);
2725
- const context = this;
2726
- const cachedSizes = [];
2727
- this.updateFlexParent(element);
2728
- const listItems = element.selectAll(".FlexGrid-list-item").data(this.widgets(), (w) => w.id());
2729
- listItems.enter().append("div").classed("FlexGrid-list-item", true).each(function(w) {
2730
- w.target(this);
2731
- }).merge(listItems).style("min-height", this.itemMinHeight() + "px").style("min-width", this.itemMinWidth() + "px").style("flex-basis", (n, i) => {
2732
- const flexBasis = this.widgetsFlexBasis()[i];
2733
- return typeof flexBasis !== "undefined" ? flexBasis : this.flexBasis();
2734
- }).style("flex-grow", (n, i) => {
2735
- const flexGrow = this.widgetsFlexGrow()[i];
2736
- return typeof flexGrow !== "undefined" ? flexGrow : this.flexGrow();
2737
- }).style("border-width", this.borderWidth() + "px").style("border-color", this.itemBorderColor()).each(function() {
2738
- this.firstChild.style.display = "none";
2739
- }).each(function() {
2740
- const rect = this.getBoundingClientRect();
2741
- cachedSizes.push([rect.width, rect.height]);
2742
- }).each(function(w, i) {
2743
- this.firstChild.style.display = "block";
2744
- w.resize({
2745
- width: cachedSizes[i][0] - 2 * context.borderWidth(),
2746
- height: cachedSizes[i][1] - 2 * context.borderWidth()
2747
- });
2748
- });
2749
- listItems.exit().remove();
2750
- }
2751
- exit(domNode, element) {
2752
- super.exit(domNode, element);
2753
- }
2754
- updateFlexParent(element) {
2755
- element.style("height", "100%").style("flex-direction", this.orientation() === "horizontal" ? "row" : "column").style("flex-wrap", this.flexWrap()).style("align-items", this.alignItems()).style("align-content", this.alignContent()).style("overflow-x", () => {
2756
- if (this.forceXScroll() || this.orientation() === "horizontal" && this.flexWrap() === "nowrap" && !this.disableScroll()) return "scroll";
2757
- return "hidden";
2758
- }).style("overflow-y", () => {
2759
- if (this.forceYScroll() || this.orientation() === "vertical" && this.flexWrap() === "nowrap" && !this.disableScroll()) return "scroll";
2760
- return "hidden";
2761
- });
2762
- }
2763
- };
2764
- FlexGrid.prototype._class += " layout_FlexGrid";
2765
- FlexGrid.prototype.publish("itemBorderColor", "transparent", "html-color", "Color of list item borders");
2766
- FlexGrid.prototype.publish("borderWidth", 0, "number", "Width of list item borders (pixels)");
2767
- FlexGrid.prototype.publish("orientation", "horizontal", "set", "Controls the flex-direction of the list items", ["horizontal", "vertical"]);
2768
- FlexGrid.prototype.publish("flexWrap", "wrap", "set", "Controls the line wrap when overflow occurs", [
2769
- "nowrap",
2770
- "wrap",
2771
- "wrap-reverse"
2772
- ]);
2773
- FlexGrid.prototype.publish("disableScroll", false, "boolean", "If false, scrollbar will show (when flexWrap is set to 'nowrap')", null, { disable: (w) => w.flexWrap() !== "nowrap" });
2774
- FlexGrid.prototype.publish("forceXScroll", false, "boolean", "If true, horzontal scrollbar will show");
2775
- FlexGrid.prototype.publish("forceYScroll", false, "boolean", "If true, vertical scrollbar will show");
2776
- FlexGrid.prototype.publish("itemMinHeight", 64, "number", "Minimum height of a list item (pixels)");
2777
- FlexGrid.prototype.publish("itemMinWidth", 64, "number", "Minimum width of a list item (pixels)");
2778
- FlexGrid.prototype.publish("alignItems", "stretch", "set", "Controls normal alignment of items", [
2779
- "flex-start",
2780
- "center",
2781
- "flex-end",
2782
- "stretch"
2783
- ]);
2784
- FlexGrid.prototype.publish("alignContent", "stretch", "set", "Controls normal alignment of item rows", [
2785
- "flex-start",
2786
- "center",
2787
- "flex-end",
2788
- "stretch",
2789
- "space-between",
2790
- "space-around"
2791
- ]);
2792
- FlexGrid.prototype.publish("flexGrow", 1, "number", "Default flex-grow style for all list items");
2793
- FlexGrid.prototype.publish("flexBasis", "10%", "string", "Default flex-basis style for all list items");
2794
- FlexGrid.prototype.publish("widgetsFlexGrow", [], "array", "Array of flex-grow values keyed on the widgets array");
2795
- FlexGrid.prototype.publish("widgetsFlexBasis", [], "array", "Array of flex-basis values keyed on the widgets array");
2796
- FlexGrid.prototype.publish("widgets", [], "widgetArray", "Array of widgets to be rendered as list items");
2797
-
2798
- //#endregion
2799
- //#region ../../node_modules/grid-list/src/gridList.js
2800
- var require_gridList = /* @__PURE__ */ __commonJS({ "../../node_modules/grid-list/src/gridList.js": ((exports, module) => {
2801
- (function(root, factory) {
2802
- if (typeof define === "function" && define.amd) define([], factory);
2803
- else if (typeof exports === "object") module.exports = factory();
2804
- else root.GridList = factory();
2805
- })(exports, function() {
2806
- var GridList$1 = function(items, options) {
2807
- /**
2808
- * A GridList manages the two-dimensional positions from a list of items,
2809
- * within a virtual matrix.
2810
- *
2811
- * The GridList's main function is to convert the item positions from one
2812
- * grid size to another, maintaining as much of their order as possible.
2813
- *
2814
- * The GridList's second function is to handle collisions when moving an item
2815
- * over another.
2816
- *
2817
- * The positioning algorithm places items in columns. Starting from left to
2818
- * right, going through each column top to bottom.
2819
- *
2820
- * The size of an item is expressed using the number of cols and rows it
2821
- * takes up within the grid (w and h)
2822
- *
2823
- * The position of an item is express using the col and row position within
2824
- * the grid (x and y)
2825
- *
2826
- * An item is an object of structure:
2827
- * {
2828
- * w: 3, h: 1,
2829
- * x: 0, y: 1
2830
- * }
2831
- */
2832
- this._options = options;
2833
- for (var k$1 in this.defaults) if (!this._options.hasOwnProperty(k$1)) this._options[k$1] = this.defaults[k$1];
2834
- this.items = items;
2835
- this._adjustSizeOfItems();
2836
- this.generateGrid();
2837
- };
2838
- GridList$1.cloneItems = function(items, _items) {
2839
- /**
2840
- * Clone items with a deep level of one. Items are not referenced but their
2841
- * properties are
2842
- */
2843
- var i, k$1;
2844
- if (_items === void 0) _items = [];
2845
- for (i = 0; i < items.length; i++) {
2846
- if (!_items[i]) _items[i] = {};
2847
- for (k$1 in items[i]) _items[i][k$1] = items[i][k$1];
2848
- }
2849
- return _items;
2850
- };
2851
- GridList$1.prototype = {
2852
- defaults: {
2853
- lanes: 5,
2854
- direction: "horizontal"
2855
- },
2856
- toString: function() {
2857
- var widthOfGrid = this.grid.length, output = "\n #|", border = "\n --", item, i, j;
2858
- for (i = 0; i < widthOfGrid; i++) {
2859
- output += " " + this._padNumber(i, " ");
2860
- border += "---";
2861
- }
2862
- output += border;
2863
- for (i = 0; i < this._options.lanes; i++) {
2864
- output += "\n" + this._padNumber(i, " ") + "|";
2865
- for (j = 0; j < widthOfGrid; j++) {
2866
- output += " ";
2867
- item = this.grid[j][i];
2868
- output += item ? this._padNumber(this.items.indexOf(item), "0") : "--";
2869
- }
2870
- }
2871
- output += "\n";
2872
- return output;
2873
- },
2874
- generateGrid: function() {
2875
- /**
2876
- * Build the grid structure from scratch, with the current item positions
2877
- */
2878
- var i;
2879
- this._resetGrid();
2880
- for (i = 0; i < this.items.length; i++) this._markItemPositionToGrid(this.items[i]);
2881
- },
2882
- resizeGrid: function(lanes) {
2883
- var currentColumn = 0;
2884
- this._options.lanes = lanes;
2885
- this._adjustSizeOfItems();
2886
- this._sortItemsByPosition();
2887
- this._resetGrid();
2888
- for (var i = 0; i < this.items.length; i++) {
2889
- var item = this.items[i], position = this._getItemPosition(item);
2890
- this._updateItemPosition(item, this.findPositionForItem(item, {
2891
- x: currentColumn,
2892
- y: 0
2893
- }));
2894
- currentColumn = Math.max(currentColumn, position.x);
2895
- }
2896
- this._pullItemsToLeft();
2897
- },
2898
- findPositionForItem: function(item, start, fixedRow) {
2899
- /**
2900
- * This method has two options for the position we want for the item:
2901
- * - Starting from a certain row/column number and only looking for
2902
- * positions to its right
2903
- * - Accepting positions for a certain row number only (use-case: items
2904
- * being shifted to the left/right as a result of collisions)
2905
- *
2906
- * @param {Object<x:Number, y:Number, w:Number, h:Number} item
2907
- * @param {Object<x:Number, y:Number} start Position from which to start
2908
- * the search.
2909
- * @param {Number} [fixedRow] If provided, we're going to try to find a
2910
- * position for the new item on it. If doesn't fit there, we're going
2911
- * to put it on the first row.
2912
- *
2913
- * @returns {Number[2]} x and y.
2914
- */
2915
- var x, y, position;
2916
- for (x = start.x; x < this.grid.length; x++) if (fixedRow !== void 0) {
2917
- position = [x, fixedRow];
2918
- if (this._itemFitsAtPosition(item, position)) return position;
2919
- } else for (y = start.y; y < this._options.lanes; y++) {
2920
- position = [x, y];
2921
- if (this._itemFitsAtPosition(item, position)) return position;
2922
- }
2923
- var newCol = this.grid.length, newRow = 0;
2924
- if (fixedRow !== void 0 && this._itemFitsAtPosition(item, [newCol, fixedRow])) newRow = fixedRow;
2925
- return [newCol, newRow];
2926
- },
2927
- moveItemToPosition: function(item, newPosition) {
2928
- var position = this._getItemPosition({
2929
- x: newPosition[0],
2930
- y: newPosition[1],
2931
- w: item.w,
2932
- h: item.h
2933
- });
2934
- this._updateItemPosition(item, [position.x, position.y]);
2935
- this._resolveCollisions(item);
2936
- },
2937
- resizeItem: function(item, size) {
2938
- /**
2939
- * Resize an item and resolve collisions.
2940
- *
2941
- * @param {Object} item A reference to an item that's part of the grid.
2942
- * @param {Object} size
2943
- * @param {Number} [size.w=item.w] The new width.
2944
- * @param {Number} [size.h=item.h] The new height.
2945
- */
2946
- var width = size.w || item.w, height = size.h || item.h;
2947
- this._updateItemSize(item, width, height);
2948
- this._resolveCollisions(item);
2949
- this._pullItemsToLeft();
2950
- },
2951
- getChangedItems: function(initialItems, idAttribute) {
2952
- /**
2953
- * Compare the current items against a previous snapshot and return only
2954
- * the ones that changed their attributes in the meantime. This includes both
2955
- * position (x, y) and size (w, h)
2956
- *
2957
- * Since both their position and size can change, the items need an
2958
- * additional identifier attribute to match them with their previous state
2959
- */
2960
- var changedItems = [];
2961
- for (var i = 0; i < initialItems.length; i++) {
2962
- var item = this._getItemByAttribute(idAttribute, initialItems[i][idAttribute]);
2963
- if (item.x !== initialItems[i].x || item.y !== initialItems[i].y || item.w !== initialItems[i].w || item.h !== initialItems[i].h) changedItems.push(item);
2964
- }
2965
- return changedItems;
2966
- },
2967
- _sortItemsByPosition: function() {
2968
- this.items.sort(function(item1, item2) {
2969
- var position1 = this._getItemPosition(item1), position2 = this._getItemPosition(item2);
2970
- if (position1.x != position2.x) return position1.x - position2.x;
2971
- if (position1.y != position2.y) return position1.y - position2.y;
2972
- return 0;
2973
- }.bind(this));
2974
- },
2975
- _adjustSizeOfItems: function() {
2976
- /**
2977
- * Some items can have 100% height or 100% width. Those dimmensions are
2978
- * expressed as 0. We need to ensure a valid width and height for each of
2979
- * those items as the number of items per lane.
2980
- */
2981
- for (var i = 0; i < this.items.length; i++) {
2982
- var item = this.items[i];
2983
- if (item.autoSize === void 0) item.autoSize = item.w === 0 || item.h === 0;
2984
- if (item.autoSize) if (this._options.direction === "horizontal") item.h = this._options.lanes;
2985
- else item.w = this._options.lanes;
2986
- }
2987
- },
2988
- _resetGrid: function() {
2989
- this.grid = [];
2990
- },
2991
- _itemFitsAtPosition: function(item, newPosition) {
2992
- /**
2993
- * Check that an item wouldn't overlap with another one if placed at a
2994
- * certain position within the grid
2995
- */
2996
- var position = this._getItemPosition(item), x, y;
2997
- if (newPosition[0] < 0 || newPosition[1] < 0) return false;
2998
- if (newPosition[1] + position.h > this._options.lanes) return false;
2999
- for (x = newPosition[0]; x < newPosition[0] + position.w; x++) {
3000
- var col = this.grid[x];
3001
- if (!col) continue;
3002
- for (y = newPosition[1]; y < newPosition[1] + position.h; y++) if (col[y] && col[y] !== item) return false;
3003
- }
3004
- return true;
3005
- },
3006
- _updateItemPosition: function(item, position) {
3007
- if (item.x !== null && item.y !== null) this._deleteItemPositionFromGrid(item);
3008
- this._setItemPosition(item, position);
3009
- this._markItemPositionToGrid(item);
3010
- },
3011
- _updateItemSize: function(item, width, height) {
3012
- /**
3013
- * @param {Object} item A reference to a grid item.
3014
- * @param {Number} width The new width.
3015
- * @param {Number} height The new height.
3016
- */
3017
- if (item.x !== null && item.y !== null) this._deleteItemPositionFromGrid(item);
3018
- item.w = width;
3019
- item.h = height;
3020
- this._markItemPositionToGrid(item);
3021
- },
3022
- _markItemPositionToGrid: function(item) {
3023
- /**
3024
- * Mark the grid cells that are occupied by an item. This prevents items
3025
- * from overlapping in the grid
3026
- */
3027
- var position = this._getItemPosition(item), x, y;
3028
- this._ensureColumns(position.x + position.w);
3029
- for (x = position.x; x < position.x + position.w; x++) for (y = position.y; y < position.y + position.h; y++) this.grid[x][y] = item;
3030
- },
3031
- _deleteItemPositionFromGrid: function(item) {
3032
- var position = this._getItemPosition(item), x, y;
3033
- for (x = position.x; x < position.x + position.w; x++) {
3034
- if (!this.grid[x]) continue;
3035
- for (y = position.y; y < position.y + position.h; y++) if (this.grid[x][y] == item) this.grid[x][y] = null;
3036
- }
3037
- },
3038
- _ensureColumns: function(N) {
3039
- /**
3040
- * Ensure that the grid has at least N columns available.
3041
- */
3042
- var i;
3043
- for (i = 0; i < N; i++) if (!this.grid[i]) this.grid.push(new GridCol(this._options.lanes));
3044
- },
3045
- _getItemsCollidingWithItem: function(item) {
3046
- var collidingItems = [];
3047
- for (var i = 0; i < this.items.length; i++) if (item != this.items[i] && this._itemsAreColliding(item, this.items[i])) collidingItems.push(i);
3048
- return collidingItems;
3049
- },
3050
- _itemsAreColliding: function(item1, item2) {
3051
- var position1 = this._getItemPosition(item1), position2 = this._getItemPosition(item2);
3052
- return !(position2.x >= position1.x + position1.w || position2.x + position2.w <= position1.x || position2.y >= position1.y + position1.h || position2.y + position2.h <= position1.y);
3053
- },
3054
- _resolveCollisions: function(item) {
3055
- if (!this._tryToResolveCollisionsLocally(item)) this._pullItemsToLeft(item);
3056
- this._pullItemsToLeft();
3057
- },
3058
- _tryToResolveCollisionsLocally: function(item) {
3059
- /**
3060
- * Attempt to resolve the collisions after moving a an item over one or more
3061
- * other items within the grid, by shifting the position of the colliding
3062
- * items around the moving one. This might result in subsequent collisions,
3063
- * in which case we will revert all position permutations. To be able to
3064
- * revert to the initial item positions, we create a virtual grid in the
3065
- * process
3066
- */
3067
- var collidingItems = this._getItemsCollidingWithItem(item);
3068
- if (!collidingItems.length) return true;
3069
- var _gridList = new GridList$1([], this._options), leftOfItem, rightOfItem, aboveOfItem, belowOfItem;
3070
- GridList$1.cloneItems(this.items, _gridList.items);
3071
- _gridList.generateGrid();
3072
- for (var i = 0; i < collidingItems.length; i++) {
3073
- var collidingItem = _gridList.items[collidingItems[i]], collidingPosition = this._getItemPosition(collidingItem);
3074
- var position = this._getItemPosition(item);
3075
- leftOfItem = [position.x - collidingPosition.w, collidingPosition.y];
3076
- rightOfItem = [position.x + position.w, collidingPosition.y];
3077
- aboveOfItem = [collidingPosition.x, position.y - collidingPosition.h];
3078
- belowOfItem = [collidingPosition.x, position.y + position.h];
3079
- if (_gridList._itemFitsAtPosition(collidingItem, leftOfItem)) _gridList._updateItemPosition(collidingItem, leftOfItem);
3080
- else if (_gridList._itemFitsAtPosition(collidingItem, aboveOfItem)) _gridList._updateItemPosition(collidingItem, aboveOfItem);
3081
- else if (_gridList._itemFitsAtPosition(collidingItem, belowOfItem)) _gridList._updateItemPosition(collidingItem, belowOfItem);
3082
- else if (_gridList._itemFitsAtPosition(collidingItem, rightOfItem)) _gridList._updateItemPosition(collidingItem, rightOfItem);
3083
- else return false;
3084
- }
3085
- GridList$1.cloneItems(_gridList.items, this.items);
3086
- this.generateGrid();
3087
- return true;
3088
- },
3089
- _pullItemsToLeft: function(fixedItem) {
3090
- /**
3091
- * Build the grid from scratch, by using the current item positions and
3092
- * pulling them as much to the left as possible, removing as space between
3093
- * them as possible.
3094
- *
3095
- * If a "fixed item" is provided, its position will be kept intact and the
3096
- * rest of the items will be layed around it.
3097
- */
3098
- this._sortItemsByPosition();
3099
- this._resetGrid();
3100
- if (fixedItem) {
3101
- var fixedPosition = this._getItemPosition(fixedItem);
3102
- this._updateItemPosition(fixedItem, [fixedPosition.x, fixedPosition.y]);
3103
- }
3104
- for (var i = 0; i < this.items.length; i++) {
3105
- var item = this.items[i], position = this._getItemPosition(item);
3106
- if (fixedItem && item == fixedItem) continue;
3107
- var x = this._findLeftMostPositionForItem(item), newPosition = this.findPositionForItem(item, {
3108
- x,
3109
- y: 0
3110
- }, position.y);
3111
- this._updateItemPosition(item, newPosition);
3112
- }
3113
- },
3114
- _findLeftMostPositionForItem: function(item) {
3115
- /**
3116
- * When pulling items to the left, we need to find the leftmost position for
3117
- * an item, with two considerations in mind:
3118
- * - preserving its current row
3119
- * - preserving the previous horizontal order between items
3120
- */
3121
- var tail = 0, position = this._getItemPosition(item);
3122
- for (var i = 0; i < this.grid.length; i++) for (var j = position.y; j < position.y + position.h; j++) {
3123
- var otherItem = this.grid[i][j];
3124
- if (!otherItem) continue;
3125
- var otherPosition = this._getItemPosition(otherItem);
3126
- if (this.items.indexOf(otherItem) < this.items.indexOf(item)) tail = otherPosition.x + otherPosition.w;
3127
- }
3128
- return tail;
3129
- },
3130
- _getItemByAttribute: function(key, value) {
3131
- for (var i = 0; i < this.items.length; i++) if (this.items[i][key] === value) return this.items[i];
3132
- return null;
3133
- },
3134
- _padNumber: function(nr, prefix) {
3135
- return nr >= 10 ? nr : prefix + nr;
3136
- },
3137
- _getItemPosition: function(item) {
3138
- /**
3139
- * If the direction is vertical we need to rotate the grid 90 deg to the
3140
- * left. Thus, we simulate the fact that items are being pulled to the top.
3141
- *
3142
- * Since the items have widths and heights, if we apply the classic
3143
- * counter-clockwise 90 deg rotation
3144
- *
3145
- * [0 -1]
3146
- * [1 0]
3147
- *
3148
- * then the top left point of an item will become the bottom left point of
3149
- * the rotated item. To adjust for this, we need to subtract from the y
3150
- * position the height of the original item - the width of the rotated item.
3151
- *
3152
- * However, if we do this then we'll reverse some actions: resizing the
3153
- * width of an item will stretch the item to the left instead of to the
3154
- * right; resizing an item that doesn't fit into the grid will push the
3155
- * items around it instead of going on a new row, etc.
3156
- *
3157
- * We found it better to do a vertical flip of the grid after rotating it.
3158
- * This restores the direction of the actions and greatly simplifies the
3159
- * transformations.
3160
- */
3161
- if (this._options.direction === "horizontal") return item;
3162
- else return {
3163
- x: item.y,
3164
- y: item.x,
3165
- w: item.h,
3166
- h: item.w
3167
- };
3168
- },
3169
- _setItemPosition: function(item, position) {
3170
- /**
3171
- * See _getItemPosition.
3172
- */
3173
- if (this._options.direction === "horizontal") {
3174
- item.x = position[0];
3175
- item.y = position[1];
3176
- } else {
3177
- item.x = position[1];
3178
- item.y = position[0];
3179
- }
3180
- }
3181
- };
3182
- var GridCol = function(lanes) {
3183
- for (var i = 0; i < lanes; i++) this.push(null);
3184
- };
3185
- GridCol.prototype = [];
3186
- return GridList$1;
3187
- });
3188
- }) });
3189
-
3190
- //#endregion
3191
- //#region src/Grid.css
3192
- var import_gridList = /* @__PURE__ */ __toESM(require_gridList(), 1);
3193
-
3194
- //#endregion
3195
- //#region src/Grid.ts
3196
- var GridList = import_gridList && import_gridList.default || import_gridList;
3197
- var Grid = class extends HTMLWidget {
3198
- divItems;
3199
- gridList;
3200
- items;
3201
- itemsMap;
3202
- origItems;
3203
- cellWidth;
3204
- cellHeight;
3205
- dragItem;
3206
- dragItemPos;
3207
- _d3Drag;
3208
- _d3DragResize;
3209
- _selectionBag;
3210
- _scrollBarWidth;
3211
- constructor() {
3212
- super();
3213
- this._tag = "div";
3214
- this._selectionBag = new Utility.Selection(this);
3215
- this.content([]);
3216
- }
3217
- getDimensions() {
3218
- const size = {
3219
- width: 0,
3220
- height: 0
3221
- };
3222
- this.content().forEach(function(cell) {
3223
- if (size.width < cell.gridCol() + cell.gridColSpan()) size.width = cell.gridCol() + cell.gridColSpan();
3224
- if (size.height < cell.gridRow() + cell.gridRowSpan()) size.height = cell.gridRow() + cell.gridRowSpan();
3225
- }, this);
3226
- return size;
3227
- }
3228
- clearContent(widget) {
3229
- this.content(this.content().filter(function(contentWidget) {
3230
- if (!widget) {
3231
- contentWidget.target(null);
3232
- return false;
3233
- }
3234
- let w = contentWidget;
3235
- while (w) {
3236
- if (widget === w) {
3237
- contentWidget.target(null);
3238
- return false;
3239
- }
3240
- w = w.widget ? w.widget() : null;
3241
- }
3242
- return true;
3243
- }));
3244
- }
3245
- setContent(row, col, widget, title, rowSpan, colSpan) {
3246
- rowSpan = rowSpan || 1;
3247
- colSpan = colSpan || 1;
3248
- title = title || "";
3249
- this.content(this.content().filter(function(contentWidget) {
3250
- if (contentWidget.gridRow() === row && contentWidget.gridCol() === col) {
3251
- contentWidget.target(null);
3252
- return false;
3253
- }
3254
- return true;
3255
- }));
3256
- if (widget) {
3257
- const cell = new Cell().gridRow(row).gridCol(col).widget(widget).title(title).gridRowSpan(rowSpan).gridColSpan(colSpan);
3258
- this.content().push(cell);
3259
- }
3260
- return this;
3261
- }
3262
- sortedContent() {
3263
- return this.content().sort(function(l, r) {
3264
- if (l.gridRow() === r.gridRow()) return l.gridCol() - r.gridCol();
3265
- return l.gridRow() - r.gridRow();
3266
- });
3267
- }
3268
- getCell(row, col) {
3269
- let retVal = null;
3270
- this.content().some(function(cell) {
3271
- if (row >= cell.gridRow() && row < cell.gridRow() + cell.gridRowSpan() && col >= cell.gridCol() && col < cell.gridCol() + cell.gridColSpan()) {
3272
- retVal = cell;
3273
- return true;
3274
- }
3275
- return false;
3276
- });
3277
- return retVal;
3278
- }
3279
- getWidgetCell(id) {
3280
- let retVal = null;
3281
- this.content().some(function(cell) {
3282
- if (cell.widget().id() === id) {
3283
- retVal = cell;
3284
- return true;
3285
- }
3286
- return false;
3287
- });
3288
- return retVal;
3289
- }
3290
- getContent(id) {
3291
- let retVal = null;
3292
- this.content().some(function(cell) {
3293
- if (cell.widget().id() === id) {
3294
- retVal = cell.widget();
3295
- return true;
3296
- }
3297
- return false;
3298
- });
3299
- return retVal;
3300
- }
3301
- cellToGridItem(cell) {
3302
- return {
3303
- x: cell.gridCol(),
3304
- y: cell.gridRow(),
3305
- w: cell.gridColSpan(),
3306
- h: cell.gridRowSpan(),
3307
- id: cell.id(),
3308
- cell
3309
- };
3310
- }
3311
- gridItemToCell(item) {
3312
- item.cell.gridCol(item.x).gridRow(item.y).gridColSpan(item.w).gridRowSpan(item.h);
3313
- }
3314
- resetItemsPos() {
3315
- this.origItems.forEach(function(origItem) {
3316
- const item = this.itemsMap[origItem.id];
3317
- item.x = origItem.x;
3318
- item.y = origItem.y;
3319
- }, this);
3320
- }
3321
- initGridList() {
3322
- this.itemsMap = {};
3323
- this.items = this.content().map(function(cell) {
3324
- const retVal = this.cellToGridItem(cell);
3325
- this.itemsMap[retVal.id] = retVal;
3326
- return retVal;
3327
- }, this);
3328
- this.origItems = this.content().map(this.cellToGridItem);
3329
- this.gridList = new GridList(this.items, {
3330
- direction: this.snapping(),
3331
- lanes: this.snapping() === "horizontal" ? this.snappingRows() : this.snappingColumns()
3332
- });
3333
- }
3334
- killGridList() {
3335
- this.gridList = null;
3336
- delete this.items;
3337
- delete this.itemsMap;
3338
- }
3339
- enter(domNode, element) {
3340
- super.enter(domNode, element);
3341
- this._scrollBarWidth = Platform.getScrollbarWidth();
3342
- const context = this;
3343
- this._d3Drag = drag().subject(function(_d) {
3344
- const d = context.cellToGridItem(_d);
3345
- return {
3346
- x: d.x * context.cellWidth,
3347
- y: d.y * context.cellHeight
3348
- };
3349
- }).on("start", function(_d) {
3350
- if (!context.designMode()) return;
3351
- d3Event().sourceEvent.stopPropagation();
3352
- context.initGridList();
3353
- const d = context.itemsMap[_d.id()];
3354
- context.dragItem = element.append("div").attr("class", "dragging").style("transform", function() {
3355
- return "translate(" + d.x * context.cellWidth + "px, " + d.y * context.cellHeight + "px)";
3356
- }).style("width", function() {
3357
- return d.w * context.cellWidth - context.gutter() + "px";
3358
- }).style("height", function() {
3359
- return d.h * context.cellHeight - context.gutter() + "px";
3360
- });
3361
- context.selectionBagClick(_d);
3362
- }).on("drag", function(_d) {
3363
- if (!context.designMode()) return;
3364
- const event = d3Event();
3365
- event.sourceEvent.stopPropagation();
3366
- const d = context.itemsMap[_d.id()];
3367
- if (event.x < 0) event.x = 0;
3368
- if (event.x + d.w * context.cellWidth > context.snappingColumns() * context.cellWidth) event.x = context.snappingColumns() * context.cellWidth - d.w * context.cellWidth;
3369
- if (event.y < 0) event.y = 0;
3370
- if (event.y + d.h * context.cellWidth > context.snappingRows() * context.cellWidth) event.y = context.snappingRows() * context.cellWidth - d.h * context.cellWidth;
3371
- const pos = [Math.max(0, Math.floor((event.x + context.cellWidth / 2) / context.cellWidth)), Math.max(0, Math.floor((event.y + context.cellHeight / 2) / context.cellHeight))];
3372
- if (d.x !== pos[0] || d.y !== pos[1]) {
3373
- if (context.snapping() !== "none") {
3374
- context.resetItemsPos();
3375
- context.gridList.moveItemToPosition(d, pos);
3376
- } else {
3377
- d.x = pos[0];
3378
- d.y = pos[1];
3379
- }
3380
- if (_d.gridCol() !== d.x || _d.gridRow() !== d.y) {
3381
- context.items.forEach(context.gridItemToCell);
3382
- context.updateGrid(false, 100);
3383
- }
3384
- }
3385
- context.dragItem.style("transform", function() {
3386
- return "translate(" + event.x + "px, " + event.y + "px)";
3387
- }).style("width", function() {
3388
- return d.w * context.cellWidth + "px";
3389
- }).style("height", function() {
3390
- return d.h * context.cellHeight + "px";
3391
- });
3392
- }).on("end", function() {
3393
- if (!context.designMode()) return;
3394
- d3Event().sourceEvent.stopPropagation();
3395
- context.dragItem.remove();
3396
- context.dragItem = null;
3397
- context.killGridList();
3398
- });
3399
- this._d3DragResize = drag().subject(function(_d) {
3400
- const d = context.cellToGridItem(_d);
3401
- return {
3402
- x: (d.x + d.w - 1) * context.cellWidth,
3403
- y: (d.y + d.h - 1) * context.cellHeight
3404
- };
3405
- }).on("start", function(_d) {
3406
- if (!context.designMode()) return;
3407
- d3Event().sourceEvent.stopPropagation();
3408
- context.initGridList();
3409
- const d = context.itemsMap[_d.id()];
3410
- context.dragItem = element.append("div").attr("class", "resizing").style("transform", function() {
3411
- return "translate(" + d.x * context.cellWidth + "px, " + d.y * context.cellHeight + "px)";
3412
- }).style("width", function() {
3413
- return d.w * context.cellWidth - context.gutter() + "px";
3414
- }).style("height", function() {
3415
- return d.h * context.cellHeight - context.gutter() + "px";
3416
- });
3417
- context.dragItemPos = {
3418
- x: d.x,
3419
- y: d.y
3420
- };
3421
- }).on("drag", function(_d) {
3422
- if (!context.designMode()) return;
3423
- const event = d3Event();
3424
- event.sourceEvent.stopPropagation();
3425
- const d = context.itemsMap[_d.id()];
3426
- const pos = [Math.max(0, Math.round(event.x / context.cellWidth)), Math.max(0, Math.round(event.y / context.cellHeight))];
3427
- const size = {
3428
- w: Math.max(1, pos[0] - d.x + 1),
3429
- h: Math.max(1, pos[1] - d.y + 1)
3430
- };
3431
- if (d.w !== size.w || d.h !== size.h) {
3432
- if (context.snapping() !== "none") {
3433
- context.resetItemsPos();
3434
- context.gridList.resizeItem(d, size);
3435
- } else {
3436
- d.w = size.w;
3437
- d.h = size.h;
3438
- }
3439
- if (_d.gridColSpan() !== d.w || _d.gridRowSpan() !== d.h) {
3440
- context.items.forEach(context.gridItemToCell);
3441
- context.updateGrid(d.id, 100);
3442
- }
3443
- }
3444
- context.dragItem.style("width", function() {
3445
- return (-d.x + 1) * context.cellWidth + event.x - context.gutter() + "px";
3446
- }).style("height", function() {
3447
- return (-d.y + 1) * context.cellHeight + event.y - context.gutter() + "px";
3448
- });
3449
- }).on("end", function() {
3450
- if (!context.designMode()) return;
3451
- d3Event().sourceEvent.stopPropagation();
3452
- context.dragItem.remove();
3453
- context.dragItem = null;
3454
- context.killGridList();
3455
- });
3456
- }
3457
- updateGrid(resize, transitionDuration = 0, _noRender = false) {
3458
- transitionDuration = transitionDuration || 0;
3459
- const context = this;
3460
- this.divItems.classed("draggable", this.designMode()).transition().duration(transitionDuration).style("left", function(d) {
3461
- return d.gridCol() * context.cellWidth + context.gutter() / 2 + "px";
3462
- }).style("top", function(d) {
3463
- return d.gridRow() * context.cellHeight + context.gutter() / 2 + "px";
3464
- }).style("width", function(d) {
3465
- return d.gridColSpan() * context.cellWidth - context.gutter() + "px";
3466
- }).style("height", function(d) {
3467
- return d.gridRowSpan() * context.cellHeight - context.gutter() + "px";
3468
- }).on("end", function(d) {
3469
- d.surfaceShadow_default(context.surfaceShadow()).surfacePadding_default(context.surfacePadding()).surfaceBorderWidth_default(context.surfaceBorderWidth()).surfaceBackgroundColor_default(context.surfaceBackgroundColor());
3470
- if (resize === true || resize === d.id()) d.resize().lazyRender();
3471
- });
3472
- }
3473
- update(domNode, element2) {
3474
- super.update(domNode, element2);
3475
- this._placeholderElement.style("overflow-x", this.fitTo() === "width" ? "hidden" : null);
3476
- this._placeholderElement.style("overflow-y", this.fitTo() === "width" ? "scroll" : null);
3477
- const dimensions = this.getDimensions();
3478
- this.cellWidth = (this.width() - (this.fitTo() === "width" ? this._scrollBarWidth : 0)) / dimensions.width;
3479
- this.cellHeight = this.fitTo() === "all" ? this.height() / dimensions.height : this.cellWidth;
3480
- if (this.designMode()) {
3481
- const cellLaneRatio = Math.min(this.width() / this.snappingColumns(), this.height() / this.snappingRows());
3482
- this.cellWidth = Math.floor(cellLaneRatio);
3483
- this.cellHeight = this.cellWidth;
3484
- }
3485
- const context = this;
3486
- const divItems = element2.selectAll("#" + this.id() + " > .ddCell").data(this.content(), function(d) {
3487
- return d.id();
3488
- });
3489
- this.divItems = divItems.enter().append("div").attr("class", "ddCell").each(function(d) {
3490
- d.target(this);
3491
- d.__grid_watch = d.monitor(function(key, newVal, oldVal) {
3492
- if (context._renderCount && (key === "snapping" || key.indexOf("grid") === 0) && newVal !== oldVal) {
3493
- if (!context.gridList) {
3494
- context.initGridList();
3495
- if (context.snapping() !== "none") context.gridList.resizeGrid(context.snapping() === "horizontal" ? context.snappingRows() : context.snappingColumns());
3496
- context.items.forEach(context.gridItemToCell);
3497
- context.updateGrid(d.id(), 100);
3498
- context.killGridList();
3499
- }
3500
- }
3501
- });
3502
- select(this).append("div").attr("class", "resizeHandle").call(context._d3DragResize).append("div").attr("class", "resizeHandleDisplay");
3503
- }).merge(divItems);
3504
- this.divItems.each(function(d) {
3505
- const element = select(this);
3506
- if (context.designMode()) element.call(context._d3Drag);
3507
- else element.on("mousedown.drag", null).on("touchstart.drag", null);
3508
- });
3509
- this.divItems.select(".resizeHandle").style("display", this.designMode() ? null : "none");
3510
- this.updateGrid(true);
3511
- divItems.exit().each(function(d) {
3512
- d.target(null);
3513
- if (d.__grid_watch) d.__grid_watch.remove();
3514
- }).remove();
3515
- const lanesBackground = element2.selectAll("#" + this.id() + " > .laneBackground").data(this.designMode() ? [""] : []);
3516
- lanesBackground.enter().insert("div", ":first-child").attr("class", "laneBackground").style("left", "1px").style("top", "1px").on("click", function() {
3517
- context.selectionBagClear();
3518
- }).merge(lanesBackground).style("width", this.snappingColumns() * this.cellWidth + "px").style("height", this.snappingRows() * this.cellHeight + "px");
3519
- lanesBackground.exit().each(function() {
3520
- context.selectionBagClear();
3521
- }).remove();
3522
- const lanes = element2.selectAll("#" + this.id() + " > .lane").data(this.designMode() ? [""] : []);
3523
- lanes.enter().append("div").attr("class", "lane").style("left", "1px").style("top", "1px");
3524
- lanes.style("display", this.showLanes() ? null : "none").style("width", this.snappingColumns() * this.cellWidth + "px").style("height", this.snappingRows() * this.cellHeight + "px").style("background-image", "linear-gradient(to right, grey 1px, transparent 1px), linear-gradient(to bottom, grey 1px, transparent 1px)").style("background-size", this.cellWidth + "px " + this.cellHeight + "px");
3525
- lanes.exit().remove();
3526
- }
3527
- exit(domNode, element) {
3528
- this.content().forEach((w) => w.target(null));
3529
- super.exit(domNode, element);
3530
- }
3531
- _createSelectionObject(d) {
3532
- return {
3533
- _id: d._id,
3534
- element: () => {
3535
- return d._element;
3536
- },
3537
- widget: d
3538
- };
3539
- }
3540
- selection(_) {
3541
- if (!arguments.length) return this._selectionBag.get().map(function(d) {
3542
- return d._id;
3543
- });
3544
- this._selectionBag.set(_.map(function(row) {
3545
- return this._createSelectionObject(row);
3546
- }, this));
3547
- return this;
3548
- }
3549
- selectionBagClear() {
3550
- if (!this._selectionBag.isEmpty()) {
3551
- this._selectionBag.clear();
3552
- this.postSelectionChange();
3553
- }
3554
- }
3555
- selectionBagClick(d) {
3556
- if (d !== null) {
3557
- const selectionObj = this._createSelectionObject(d);
3558
- if (d3Event().sourceEvent.ctrlKey) if (this._selectionBag.isSelected(selectionObj)) {
3559
- this._selectionBag.remove(selectionObj);
3560
- this.postSelectionChange();
3561
- } else {
3562
- this._selectionBag.append(selectionObj);
3563
- this.postSelectionChange();
3564
- }
3565
- else {
3566
- const selected = this._selectionBag.get();
3567
- if (selected.length === 1 && selected[0]._id === selectionObj._id) this.selectionBagClear();
3568
- else this._selectionBag.set([selectionObj]);
3569
- this.postSelectionChange();
3570
- }
3571
- }
3572
- }
3573
- postSelectionChange() {}
3574
- applyLayout(layoutArr) {
3575
- this.divItems.each((d, i) => {
3576
- if (layoutArr[i]) {
3577
- const [x, y, w, h] = layoutArr[i];
3578
- d.gridCol(x).gridRow(y).gridColSpan(w).gridRowSpan(h);
3579
- }
3580
- });
3581
- this.updateGrid(true);
3582
- }
3583
- vizActivation(elem) {}
3584
- };
3585
- Grid.prototype._class += " layout_Grid";
3586
- Grid.prototype.publish("designMode", false, "boolean", "Design Mode", null, { tags: ["Basic"] });
3587
- Grid.prototype.publish("showLanes", true, "boolean", "Show snapping lanes when in design mode", null, {
3588
- tags: ["Basic"],
3589
- disable: (w) => !w.designMode()
3590
- });
3591
- Grid.prototype.publish("fitTo", "all", "set", "Sizing Strategy", ["all", "width"], { tags: ["Basic"] });
3592
- Grid.prototype.publish("snapping", "vertical", "set", "Snapping Strategy", [
3593
- "vertical",
3594
- "horizontal",
3595
- "none"
3596
- ]);
3597
- Grid.prototype.publish("snappingColumns", 12, "number", "Snapping Columns");
3598
- Grid.prototype.publish("snappingRows", 16, "number", "Snapping Rows");
3599
- Grid.prototype.publish("gutter", 6, "number", "Gap Between Widgets", null, { tags: ["Basic"] });
3600
- Grid.prototype.publish("surfaceShadow", true, "boolean", "3D Shadow");
3601
- Grid.prototype.publish("surfacePadding", null, "string", "Cell Padding (px)", null, { tags: ["Intermediate"] });
3602
- Grid.prototype.publish("surfaceBorderWidth", 1, "number", "Width (px) of Cell Border", null, { tags: ["Intermediate"] });
3603
- Grid.prototype.publish("surfaceBackgroundColor", null, "html-color", "Surface Background Color", null, { tags: ["Advanced"] });
3604
- Grid.prototype.publish("content", [], "widgetArray", "widgets", null, {
3605
- tags: ["Basic"],
3606
- render: false
3607
- });
3608
-
3609
- //#endregion
3610
- //#region src/HorizontalList.ts
3611
- var HorizontalList = class extends FlexGrid {
3612
- constructor() {
3613
- super();
3614
- this.orientation_default("horizontal");
3615
- this.flexWrap_default("nowrap");
3616
- }
3617
- };
3618
- HorizontalList.prototype._class += " layout_HorizontalList";
3619
-
3620
- //#endregion
3621
- //#region src/Layered.ts
3622
- var Layered = class extends HTMLWidget {
3623
- _contentContainer;
3624
- _widgetPlacements;
3625
- _widgetRatios;
3626
- constructor() {
3627
- super();
3628
- this._tag = "div";
3629
- this._widgetPlacements = [];
3630
- this._widgetRatios = [];
3631
- }
3632
- addLayer(widget, placement = "default", widthRatio = 1, heightRatio = 1) {
3633
- const widgets = this.widgets();
3634
- widgets.push(widget ? widget : new Text().text("No widget defined for layer."));
3635
- this.widgets(widgets);
3636
- this._widgetPlacements.push(placement);
3637
- this._widgetRatios.push([widthRatio, heightRatio]);
3638
- return this;
3639
- }
3640
- enter(domNode, element) {
3641
- super.enter(domNode, element);
3642
- this._contentContainer = element.append("div").attr("class", "container");
3643
- }
3644
- update(domNode, element) {
3645
- super.update(domNode, element);
3646
- const context = this;
3647
- element.style("padding", this.surfacePadding() + "px");
3648
- const content = this._contentContainer.selectAll(".content.id" + this.id()).data(this.widgets(), function(d) {
3649
- return d.id();
3650
- });
3651
- content.enter().append("div").attr("class", "content id" + this.id()).each(function(widget, idx) {
3652
- widget.target(this);
3653
- }).merge(content).each(function(widget, idx) {
3654
- const clientSize = {
3655
- width: context.clientWidth(),
3656
- height: context.clientHeight()
3657
- };
3658
- const widgetSize = context.widgetSize(idx, clientSize);
3659
- const widgetPosition = context.widgetPosition(idx, clientSize, widgetSize);
3660
- this.style.top = widgetPosition.y + "px";
3661
- this.style.left = widgetPosition.x + "px";
3662
- widget.resize(widgetSize).render();
3663
- });
3664
- content.exit().each(function(widget, idx) {
3665
- widget.target(null);
3666
- }).remove();
3667
- content.order();
3668
- }
3669
- widgetSize(idx, clientSize) {
3670
- if (this._widgetPlacements[idx] === "default") return {
3671
- width: clientSize.width * this._widgetRatios[idx][0],
3672
- height: clientSize.height * this._widgetRatios[idx][1]
3673
- };
3674
- else return {
3675
- width: clientSize.width * this._widgetRatios[idx][0],
3676
- height: clientSize.height * this._widgetRatios[idx][1]
3677
- };
3678
- }
3679
- widgetPosition(idx, clientSize, widgetSize) {
3680
- switch (this._widgetPlacements[idx]) {
3681
- default: return {
3682
- x: 0,
3683
- y: 0
3684
- };
3685
- case "top": return {
3686
- x: clientSize.width / 2 - widgetSize.width / 2,
3687
- y: 0
3688
- };
3689
- case "bottom": return {
3690
- x: clientSize.width / 2 - widgetSize.width / 2,
3691
- y: clientSize.height - widgetSize.height
3692
- };
3693
- case "left": return {
3694
- x: 0,
3695
- y: clientSize.height / 2 - widgetSize.height / 2
3696
- };
3697
- case "right": return {
3698
- x: clientSize.width - widgetSize.width,
3699
- y: clientSize.height / 2 - widgetSize.height / 2
3700
- };
3701
- case "center": return {
3702
- x: clientSize.width / 2 - widgetSize.width / 2,
3703
- y: clientSize.height / 2 - widgetSize.height / 2
3704
- };
3705
- }
3706
- }
3707
- };
3708
- Layered.prototype._class += " layout_Layered";
3709
- Layered.prototype.publish("surfacePadding", 0, "number", "Padding");
3710
- Layered.prototype.publish("widgets", [], "widgetArray", "widgets", null, { tags: ["Private"] });
3711
-
3712
- //#endregion
3713
- //#region src/Popup.ts
3714
- var Popup = class extends HTMLWidget {
3715
- _surfaceButtons;
3716
- _originalPosition;
3717
- constructor() {
3718
- super();
3719
- this._tag = "div";
3720
- this._surfaceButtons = [];
3721
- }
3722
- updateState(visible) {
3723
- visible = visible || !this.popupState();
3724
- this.popupState(visible).render();
3725
- }
3726
- enter(domNode, element) {
3727
- super.enter(domNode, element);
3728
- this.widget().target(domNode);
3729
- this._originalPosition = this.position();
3730
- }
3731
- update(domNode, element) {
3732
- super.update(domNode, element);
3733
- element.style("visibility", this.popupState() ? null : "hidden").style("opacity", this.popupState() ? null : 0).style("width", this.shrinkWrap() ? this.widget().width() + "px" : this._size.width + "px").style("height", this.shrinkWrap() ? this.widget().height() + "px" : this._size.height + "px");
3734
- if (this.widget().size().height === 0) this.widget().resize(this.size());
3735
- }
3736
- postUpdate(domNode, element) {
3737
- let left;
3738
- let top;
3739
- switch (this.centerPopup()) {
3740
- case "container":
3741
- if (this._placeholderElement) {
3742
- left = parseInt(this._placeholderElement.style("width")) / 2 - this.widget().width() / 2;
3743
- top = parseInt(this._placeholderElement.style("height")) / 2 - this.widget().height() / 2;
3744
- }
3745
- this.position("absolute");
3746
- break;
3747
- case "window":
3748
- left = window.innerWidth / 2 - this.widget().width() / 2;
3749
- top = window.innerHeight / 2 - this.widget().height() / 2;
3750
- this.position("fixed");
3751
- break;
3752
- default:
3753
- left = 0;
3754
- top = 0;
3755
- this.position(this._originalPosition);
3756
- break;
3757
- }
3758
- this.pos({
3759
- x: left,
3760
- y: top
3761
- });
3762
- super.postUpdate(domNode, element);
3763
- element.style("position", this.position()).style("left", this.left() + "px").style("right", this.right() + "px").style("top", this.top() + "px").style("bottom", this.bottom() + "px");
3764
- }
3765
- exit(domNode, element) {
3766
- if (this.widget()) this.widget().target(null);
3767
- super.exit(domNode, element);
3768
- }
3769
- click(obj) {}
3770
- };
3771
- Popup.prototype._class += " layout_Popup";
3772
- Popup.prototype.publish("popupState", false, "boolean", "State of the popup, visible (true) or hidden (false)", null, {});
3773
- Popup.prototype.publish("shrinkWrap", false, "boolean", "The popup parent container either shrinks to the size of its contents (true) or expands to fit thge popup's parentDiv (false)", null, {});
3774
- Popup.prototype.publish("centerPopup", "none", "set", "Center the widget in its container element (target) or in the window", [
3775
- "none",
3776
- "container",
3777
- "window"
3778
- ], {});
3779
- Popup.prototype.publish("top", null, "number", "Top position property of popup", null, {});
3780
- Popup.prototype.publish("bottom", null, "number", "Bottom position property of popup", null, {});
3781
- Popup.prototype.publish("left", null, "number", "Left position property of popup", null, {});
3782
- Popup.prototype.publish("right", null, "number", "Right position property of popup", null, {});
3783
- Popup.prototype.publish("position", "relative", "set", "Value of the 'position' property", [
3784
- "absolute",
3785
- "relative",
3786
- "fixed",
3787
- "static",
3788
- "initial",
3789
- "inherit"
3790
- ], { tags: ["Private"] });
3791
- Popup.prototype.publish("widget", null, "widget", "Widget", null, { tags: ["Private"] });
3792
-
3793
- //#endregion
3794
- //#region src/Tabbed.ts
3795
- var Tabbed = class extends HTMLWidget {
3796
- _tabContainer;
3797
- _contentContainer;
3798
- constructor() {
3799
- super();
3800
- this._tag = "div";
3801
- }
3802
- clearTabs() {
3803
- this.labels([]);
3804
- this.widgets([]);
3805
- return this;
3806
- }
3807
- addTab(widget, label, isActive, callback) {
3808
- const widgetSize = widget.size();
3809
- if (widgetSize.width === 0 && widgetSize.height === 0) widget.size({
3810
- width: "100%",
3811
- height: "100%"
3812
- });
3813
- const labels = this.labels();
3814
- const widgets = this.widgets();
3815
- if (isActive) this.activeTabIdx(this.widgets().length);
3816
- labels.push(label);
3817
- const surface = new Surface().widget(widget ? widget : new Text().text("No widget defined for tab"));
3818
- widgets.push(surface);
3819
- this.labels(labels);
3820
- this.widgets(widgets);
3821
- if (callback) callback(surface);
3822
- return this;
3823
- }
3824
- widgetSize(widgetDiv) {
3825
- const width = this.clientWidth();
3826
- let height = this.clientHeight();
3827
- const tcBox = this._tabContainer.node().getBoundingClientRect();
3828
- if (typeof tcBox.height !== "undefined") height -= tcBox.height;
3829
- return {
3830
- width,
3831
- height
3832
- };
3833
- }
3834
- enter(domNode, element) {
3835
- super.enter(domNode, element);
3836
- this._tabContainer = element.append("div");
3837
- this._contentContainer = element.append("div");
3838
- }
3839
- update(domNode, element) {
3840
- super.update(domNode, element);
3841
- const context = this;
3842
- element.style("padding", this.surfacePadding_exists() ? this.surfacePadding() + "px" : null);
3843
- const tabs = this._tabContainer.selectAll(".tab-button.id" + this.id()).data(this.showTabs() ? this.labels() : [], function(d) {
3844
- return d;
3845
- });
3846
- tabs.enter().append("span").attr("class", "tab-button id" + this.id()).style("cursor", "pointer").on("click", function(d, idx) {
3847
- context.click(context.widgets()[idx].widget(), d, idx);
3848
- context.activeTabIdx(idx).render();
3849
- }).merge(tabs).classed("active", function(d, idx) {
3850
- return context.activeTabIdx() === idx;
3851
- }).text(function(d) {
3852
- return d;
3853
- });
3854
- tabs.exit().remove();
3855
- const content = this._contentContainer.selectAll(".tab-content.id" + this.id()).data(this.widgets(), function(d) {
3856
- return d.id();
3857
- });
3858
- content.enter().append("div").attr("class", "tab-content id" + this.id()).each(function(widget, idx) {
3859
- widget.target(this);
3860
- }).merge(content).classed("active", function(d, idx) {
3861
- return context.activeTabIdx() === idx;
3862
- }).style("display", function(d, idx) {
3863
- return context.activeTabIdx() === idx ? "block" : "none";
3864
- }).each(function(surface, idx) {
3865
- surface.visible(context.activeTabIdx() === idx);
3866
- if (context.activeTabIdx() === idx) {
3867
- const wSize = context.widgetSize(select(this));
3868
- surface.surfaceBorderWidth(context.showTabs() ? null : 0).surfacePadding(context.showTabs() ? null : 0).resize(wSize);
3869
- }
3870
- });
3871
- content.exit().each(function(widget, idx) {
3872
- widget.target(null);
3873
- }).remove();
3874
- switch (this.tabLocation()) {
3875
- case "bottom":
3876
- this._tabContainer.attr("class", "on_bottom").style("top", this._contentContainer.node().offsetHeight + this.surfacePadding() + "px").style("position", "absolute");
3877
- this._contentContainer.style("top", this.surfacePadding_exists() ? this.surfacePadding() + "px" : null).style("position", "absolute");
3878
- break;
3879
- default:
3880
- this._tabContainer.attr("class", "on_top").style("top", null).style("position", "relative");
3881
- this._contentContainer.style("top", this._tabContainer.node().offsetHeight + this.surfacePadding() + "px").style("position", "absolute");
3882
- break;
3883
- }
3884
- }
3885
- click(widget, column, idx) {}
3886
- };
3887
- Tabbed.prototype._class += " layout_Tabbed";
3888
- Tabbed.prototype.publish("showTabs", true, "boolean", "Show Tabs", null, {});
3889
- Tabbed.prototype.publish("surfacePadding", 4, "number", "Padding");
3890
- Tabbed.prototype.publish("activeTabIdx", 0, "number", "Index of active tab", null, {});
3891
- Tabbed.prototype.publish("labels", [], "array", "Array of tab labels sharing an index with ", null, { tags: ["Private"] });
3892
- Tabbed.prototype.publish("tabLocation", "top", "set", "Position the tabs at the bottom of the widget", ["top", "bottom"], { tags: ["Private"] });
3893
- Tabbed.prototype.publish("widgets", [], "widgetArray", "widgets", null, { tags: ["Private"] });
3894
-
3895
- //#endregion
3896
- //#region src/Toolbar.ts
3897
- var Toolbar = class extends HTMLWidget {
3898
- constructor() {
3899
- super();
3900
- this._tag = "div";
3901
- }
3902
- enter(domNode, element) {
3903
- super.enter(domNode, element);
3904
- }
3905
- update(domNode, element) {
3906
- super.update(domNode, element);
3907
- const context = this;
3908
- element.attr("title", context.title()).style("background-color", this.backgroundColor());
3909
- const title = element.selectAll("div.toolbar-title").data(this.title() ? [this.title()] : []);
3910
- title.enter().append("div").classed("toolbar-title", true).append("span");
3911
- title.selectAll("div.toolbar-title > span").style("font-size", this.fontSize_exists() ? this.fontSize() + "px" : null).style("color", this.fontColor_exists() ? this.fontColor() : null).style("font-family", this.fontFamily_exists() ? this.fontFamily() : null).style("font-weight", this.fontBold_exists() ? this.fontBold() ? "bold" : "normal" : null).style("background-color", this.backgroundColor_exists() ? this.backgroundColor() : null).text(context.title());
3912
- title.exit().remove();
3913
- const childWidgets = element.selectAll("div.toolbar-child").data(this.widgets() !== null ? this.widgets() : [], function(d) {
3914
- return d.id();
3915
- });
3916
- childWidgets.enter().insert("div", "div.toolbar-title").each(function(d, i) {
3917
- const widgetClass = context.widgetClasses()[i] ? context.widgetClasses()[i] + " toolbar-child" : "toolbar-child";
3918
- select(this).classed(widgetClass, true);
3919
- d.target(this);
3920
- });
3921
- childWidgets.exit().each(function(d) {
3922
- d.target(null);
3923
- }).remove();
3924
- childWidgets.order();
3925
- }
3926
- render(callback) {
3927
- const context = this;
3928
- return super.render(function(w) {
3929
- const toolbarBBox = context.element().node().getBoundingClientRect();
3930
- let minX = toolbarBBox.left + toolbarBBox.width;
3931
- context.element().selectAll("div.toolbar-child").each(function(d, i) {
3932
- const childBBox = this.getBoundingClientRect();
3933
- if (minX > childBBox.left) minX = childBBox.left;
3934
- });
3935
- context.element().select(".toolbar-title").style("width", minX - toolbarBBox.left - 4 + "px");
3936
- if (callback) callback(w);
3937
- });
3938
- }
3939
- exit(domNode, element) {
3940
- this.widgets().forEach(function(w) {
3941
- w.target(null);
3942
- });
3943
- super.exit(domNode, element);
3944
- }
3945
- };
3946
- Toolbar.prototype._class += " layout_Toolbar";
3947
- Toolbar.prototype.publish("title", "", "string", "Title", null, { tags: ["Intermediate"] });
3948
- Toolbar.prototype.publish("fontSize", null, "number", "Title Font Size (px)", null, {
3949
- tags: ["Advanced"],
3950
- optional: true
3951
- });
3952
- Toolbar.prototype.publish("fontColor", null, "html-color", "Title Font Color", null, {
3953
- tags: ["Advanced"],
3954
- optional: true
3955
- });
3956
- Toolbar.prototype.publish("fontFamily", null, "string", "Title Font Family", null, {
3957
- tags: ["Advanced"],
3958
- optional: true
3959
- });
3960
- Toolbar.prototype.publish("fontBold", true, "boolean", "Enable Bold Title Font", null, {
3961
- tags: ["Advanced"],
3962
- optional: true
3963
- });
3964
- Toolbar.prototype.publish("backgroundColor", null, "html-color", "Background Color", null, {
3965
- tags: ["Intermediate"],
3966
- optional: true
3967
- });
3968
- Toolbar.prototype.publish("responsive", true, "boolean", "Adapts to pixel width", null, { tags: ["Basic"] });
3969
- Toolbar.prototype.publish("widgets", [], "widgetArray", "Child widgets of the toolbar", null, { tags: ["Basic"] });
3970
- Toolbar.prototype.publish("widgetClasses", [], "array", "Array of Html Element classes to be assigned to the child widgets (shares index with widgets param)", null, { tags: ["Basic"] });
3971
-
3972
- //#endregion
3973
- //#region src/VerticalList.ts
3974
- var VerticalList = class extends FlexGrid {
3975
- constructor() {
3976
- super();
3977
- this.orientation_default("vertical");
3978
- this.flexWrap_default("nowrap");
3979
- }
3980
- };
3981
- VerticalList.prototype._class += " layout_VerticalList";
3982
-
3983
- //#endregion
3984
- export { AbsoluteSurface, Accordion, BUILD_VERSION, Border, Border2, Carousel, Cell, ChartPanel, FlexGrid, Grid, HorizontalList, Layered, Legend, Modal, PKG_NAME, PKG_VERSION, Popup, Surface, Tabbed, Toolbar, VerticalList, WidgetDiv };
3985
- //# sourceMappingURL=index.js.map!function(){try{if("undefined"!=typeof document){var o=document.createElement("style");o.appendChild(document.createTextNode('.layout_AbsoluteSurface{pointer-events:none!important}.layout_AbsoluteSurface>.placeholder{pointer-events:all;position:relative;overflow:hidden}.layout_Accordion>ul{position:relative}.layout_Accordion.open>span{font-style:italic}.layout_Accordion.closed>ul{height:0;overflow:hidden}.layout_Accordion.open>ul{display:block}.layout_Accordion>.collapsible-icon,.layout_Accordion>.collapsible-title{cursor:pointer;box-sizing:border-box}.layout_Accordion>.collapsible-title{color:#fff;width:100%;height:26px;padding:4px 8px;font-size:13px;display:block;box-shadow:inset 0 -1px 1px #0003}.layout_Accordion li{background-color:#fff}.layout_Accordion>ul,.layout_Accordion>.collapsible-title{background-color:#333}.layout_Accordion .layout_Accordion>ul,.layout_Accordion .layout_Accordion>.collapsible-title{background-color:#555}.layout_Accordion .layout_Accordion .layout_Accordion>ul,.layout_Accordion .layout_Accordion .layout_Accordion>.collapsible-title{background-color:#777}.layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion>ul,.layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion>.collapsible-title{background-color:#999}.layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion>ul,.layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion>.collapsible-title{background-color:#bbb}.layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion>ul,.layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion>.collapsible-title{background-color:#ccc}.layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion>ul,.layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion>.collapsible-title{background-color:#ddd}.layout_Accordion>ul,.layout_Accordion>span{padding-left:0}.layout_Accordion .layout_Accordion>ul,.layout_Accordion .layout_Accordion>span{padding-left:12px}.layout_Accordion>.collapsible-title:before{padding:4px 8px;position:absolute;top:0;left:0}.layout_Accordion>.collapsible-icon{color:#fff;width:24px;height:24px;position:absolute;top:0;right:0}.layout_Surface{box-sizing:border-box;border:1px solid #e5e5e5;width:100%;height:100%;margin:0;overflow:hidden}.layout_Surface.shadow2{box-shadow:0 2px 2px #00000024,0 3px 1px -2px #0003,0 1px 5px #0000001f}.layout_Surface>h3{background-color:#e5e5e5;margin:0;padding:2px}.layout_Surface .html-button-container{position:absolute;top:3px;right:0}.layout_Surface>div{padding:8px}.layout_Surface .html-button-container .surface-button{margin-right:5px}.layout_Surface .html-button-container .surface-button i{opacity:.8}.layout_Surface .html-button-container .surface-button:hover{opacity:1}.layout_Surface .html-button-container .surface-button:active{opacity:.5}div[draggable=true].hideDragCellContent.content-icon:before{content:"";font-family:FontAwesome;font-size:100px;position:absolute;top:calc(50% - 74px);left:calc(50% - 56px)}div[draggable=true].hideDragCellContent.content-icon-Line:before{content:""}div[draggable=true].hideDragCellContent.content-icon-Pie:before{content:"";top:calc(50% - 72px);left:calc(50% - 45px)}div[draggable=true].hideDragCellContent.content-icon-Area:before{content:""}div[draggable=true].hideDragCellContent.content-icon-Gauge:before{content:""}div[draggable=true].hideDragCellContent.content-icon-Table:before{content:""}div[draggable=true].hideDragCellContent.content-icon-Form:before{content:""}div[draggable=true].hideDragCellContent.content-icon-Grid:before,div[draggable=true].hideDragCellContent.content-icon-Graph:before,div[draggable=true].hideDragCellContent.content-icon-Border:before,div[draggable=true].hideDragCellContent.content-icon-Tabbed:before,div[draggable=true].hideDragCellContent.content-icon-Accordion:before,div[draggable=true].hideDragCellContent.content-icon-MultiChart:before,div[draggable=true].hideDragCellContent.content-icon-MultiChartSurface:before{content:""}div[draggable=true].hideDragCellContent.content-icon-ChoroplethStates:before,div[draggable=true].hideDragCellContent.content-icon-ChoroplethStatesHeat:before,div[draggable=true].hideDragCellContent.content-icon-ChoroplethCounties:before,div[draggable=true].hideDragCellContent.content-icon-ChoroplethCountries:before,div[draggable=true].hideDragCellContent.content-icon-GMap:before,div[draggable=true].hideDragCellContent.content-icon-GMapHeat:before,div[draggable=true].hideDragCellContent.content-icon-GMapGraph:before,div[draggable=true].hideDragCellContent.content-icon-Text:before,div[draggable=true].hideDragCellContent.content-icon-TextBox:before,div[draggable=true].hideDragCellContent.content-icon-FAChar:before{content:""}.layout_Cell .update-indicator{box-sizing:border-box;z-index:1000;pointer-events:none;border-style:solid;border-width:0;padding:0;position:absolute;top:0;left:0}.layout_Border{width:100%;height:100%}.layout_Border>.border-content{width:100%;height:100%;position:relative}.layout_Border>.borderHandle{opacity:.3;visibility:hidden;background-color:#444;width:6px;height:6px;position:absolute}.layout_Border.design-mode>.borderHandle{visibility:visible}.layout_Border>.borderHandle:hover{background-color:#666}.layout_Border>.borderHandle.borderHandleDisabled{display:none}.layout_Border>.borderHandle_top,.layout_Border>.borderHandle_bottom{cursor:ns-resize}.layout_Border>.borderHandle_left,.layout_Border>.borderHandle_right{cursor:ew-resize}.layout_Border .cell{border:1px solid #e5e5e5;border-radius:5px;display:inline-block;overflow:hidden}.layout_Border .cell h2{-webkit-margin:0px;text-align:center;margin:0;padding-top:4px}.layout_Border .layout_BorderCell.over{border:2px dashed #000}.layout_Border .dragItem{z-index:-1;opacity:.33}.layout_Border .notDragItem{z-index:-1;opacity:1}.layout_Border div[draggable=true]{opacity:.75;cursor:default}.layout_Border div[draggable=true] .dragHandle{opacity:1}.layout_Border div[draggable=true] .dragHandle_n,.layout_Border div[draggable=true] .dragHandle_e,.layout_Border div[draggable=true] .dragHandle_s,.layout_Border div[draggable=true] .dragHandle_w{background-color:#aaa}.layout_Border div[draggable=true] .dragHandle_nw,.layout_Border div[draggable=true] .dragHandle_ne,.layout_Border div[draggable=true] .dragHandle_se,.layout_Border div[draggable=true] .dragHandle_sw{background-color:#333}.layout_Border div[draggable=true] .dragHandle_nw{cursor:nw-resize}.layout_Border div[draggable=true] .dragHandle_n{cursor:n-resize}.layout_Border div[draggable=true] .dragHandle_ne{cursor:ne-resize}.layout_Border div[draggable=true] .dragHandle_e{cursor:e-resize}.layout_Border div[draggable=true] .dragHandle_se{cursor:se-resize}.layout_Border div[draggable=true] .dragHandle_s{cursor:s-resize}.layout_Border div[draggable=true] .dragHandle_sw{cursor:sw-resize}.layout_Border div[draggable=true] .dragHandle_w{cursor:w-resize}.layout_Border div[draggable=false]>div>.dragHandle{display:none}.layout_Border .grid-drop-target{box-sizing:border-box;background:repeating-linear-gradient(-45deg,#0000,#0000 4px,#6464641a 4px 8px);border:2px dashed #7f8c8d;border-radius:0;position:fixed}.layout_Border .grid-drop-target.drop-target-over{background:repeating-linear-gradient(-45deg,#0000,#0000 6px,#119bd71a 6px 12px);border:2px dashed #179bd7}.layout_Border2{flex-direction:column;display:flex}.layout_Border2>.body{flex-flow:row;margin:0;padding:0;display:flex}.layout_Border2>.body>.center{flex:1}.layout_Border2>.header,.layout_Border2>.footer{display:block}.layout_Carousel>div{position:relative;overflow:hidden}.layout_Carousel>div>.carouselItem{position:absolute}.layout_Modal-header{background-color:#3f51b5;overflow:hidden}.layout_Modal-body{background-color:#fff;overflow:hidden scroll}.layout_Modal-title,.layout_Modal-annotations{position:absolute}.layout_Modal-closeButton{cursor:pointer}.layout_Modal-closeButton:hover{opacity:.7}.layout_Modal-closeButton:active{opacity:.5}.layout_Modal-fade{opacity:.5;z-index:10000;background-color:#000;position:fixed}.layout_Modal-content{z-index:10100;background-color:#fff;position:fixed}.layout_Modal-fade-hidden{display:none}.layout_Modal-fadeClickable{cursor:pointer}.layout_ChartPanel .series.highlight{stroke-width:2px;opacity:1}.layout_ChartPanel .series.lowlight{opacity:.3!important}.layout_FlexGrid{display:flex}.FlexGrid-list-item{border-style:solid;flex-grow:1;overflow:hidden}.layout_Grid>.ddCell{position:absolute}.layout_Grid>.laneBackground{background:#f5f5f5;border-style:solid;border-width:1px;position:absolute}.layout_Grid>.lane{opacity:.25;pointer-events:none;border-style:none;border-radius:0;position:absolute}.layout_Grid>.ddCell.draggable{cursor:move;background-color:#f8f8ff;border-style:solid;border-width:1px;border-radius:0}.layout_Grid>.ddCell.draggable>.resizeHandle{cursor:nwse-resize;border-style:none;width:8px;height:8px;position:absolute;bottom:0;right:0}.layout_Grid>.ddCell.draggable .resizeHandleDisplay{background-color:none;border:2px solid #a9a9a9;border-width:0 2px 2px 0;width:4px;height:4px;position:absolute;bottom:2px;right:2px}.layout_Grid>.ddCell.draggable .resizeHandleDisplay:hover{border-color:orange}.layout_Grid>.dragging{background:repeating-linear-gradient(-45deg,#0000,#0000 4px,#6464641a 4px 8px);border:1px solid gray;border-radius:0;position:absolute}.layout_Grid>.resizing{opacity:.3;background:repeating-linear-gradient(-45deg,#0000,#0000 4px,orange 4px 8px);border:1px solid gray;border-radius:0;position:absolute}.layout_Grid>.ddCell.draggable .common_Widget.selected{background:repeating-linear-gradient(-45deg,#0000,#0000 4px,#6400001a 4px 8px);border:1px solid red;border-radius:0;position:absolute}.layout_Grid #drag-me:before{content:"#" attr(id);font-weight:700}.layout_Layered{pointer-events:none}.layout_Layered>.container>.content{position:absolute}.layout_Layered>.container>.content>div>.common_Widget,.layout_Layered>.container>.content>div>svg>.common_Widget{pointer-events:all}.layout_Tabbed .tab-button{background-color:#ccc;border-top:1px solid #ddd;border-left:1px solid #ddd;border-right:1px solid #ddd;margin-right:4px;padding:2px 2px 4px;display:inline-block;position:relative;top:1px}.layout_Tabbed .tab-button.active{z-index:999;background-color:#fff}.layout_Tabbed .on_bottom .tab-button{border-top:none;border-bottom:1px solid #ddd;top:-1px}.layout_Toolbar{white-space:nowrap;background-color:#ddd;height:100%;overflow:hidden}.layout_Toolbar .toolbar-title{text-overflow:ellipsis;white-space:nowrap;margin-left:4px;font-weight:700;display:inline-block;position:relative;top:50%;overflow:hidden;transform:translateY(-50%)}.layout_Toolbar .toolbar-child{float:right;margin-left:4px;margin-right:4px;line-height:16px;position:relative;top:50%;transform:translateY(-50%)}\n/*$vite$:1*/')),document.head.appendChild(o)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}}();
1
+ var t=Object.defineProperty,e=(e,i)=>t(e,"name",{value:i,configurable:!0});import{HTMLWidget as i,FAChar as s,select as o,selectAll as l,Utility as n,d3Event as r,Platform as h,drag as a,scaleLinear as d,dispatch as p,formatPrefix as c,format as u,formatLocale as g,formatSpecifier as f,sum as _,SVGWidget as y,Database as b,Palette as w,scaleOrdinal as m,ProgressBar as v,ToggleButton as x,Text as S,Button as C,Spacer as P,TitleBar as T,IconBar as z}from"@hpcc-js/common";import{Table as W}from"@hpcc-js/dgrid";import{instanceOfIHighlight as B}from"@hpcc-js/api";function I(t,i){for(var s=0;s<i.length;s++){const o=i[s];if("string"!=typeof o&&!Array.isArray(o))for(const i in o)if("default"!==i&&!(i in t)){const s=Object.getOwnPropertyDescriptor(o,i);s&&Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:/* @__PURE__ */e(()=>o[i],"get")})}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}e(I,"_mergeNamespaces");const A="@hpcc-js/layout",H="3.4.2",M="3.16.0",k=class _AbsoluteSurface extends i{constructor(){super(),this._tag="div"}enter(t,e){super.enter(t,e)}update(t,e){super.update(t,e);let i=0,s=0,o=this.clientWidth(),l=this.clientHeight();switch(this.units()){case"pixels":i=this.widgetX(),s=this.widgetY(),o=""===this.widgetWidth()?o-i:Number(this.widgetWidth()),l=""===this.widgetHeight()?l-s:Number(this.widgetHeight());break;case"percent":i=this.widgetX()*o/100,s=this.widgetY()*l/100,o=""===this.widgetWidth()?o-i:Number(this.widgetWidth())*o/100,l=""===this.widgetHeight()?l-s:Number(this.widgetHeight())*l/100}e.style("opacity",this.opacity());const n=e.selectAll("#"+this._id+" > .placeholder").data(this.widget()?[this.widget()]:[],function(t){return t._id});n.enter().append("div").attr("class","placeholder").each(function(t){t.target(this)}).merge(n).style("left",i+"px").style("top",s+"px").style("width",o+"px").style("bottom",l+"px").each(function(t){t.resize({width:o,height:l})}),n.exit().each(function(t){t.target(null)}).remove()}exit(t,e){this.widget()&&this.widget().target(null),super.exit(t,e)}};e(k,"AbsoluteSurface");let F=k;F.prototype._class+=" layout_AbsoluteSurface",F.prototype.publish("units","percent","set","Units",["pixels","percent"]),F.prototype.publish("widgetX",0,"number","Widget XPos"),F.prototype.publish("widgetY",0,"number","Widget YPos"),F.prototype.publish("widgetWidth","100","string","Widget Width, omit for full"),F.prototype.publish("widgetHeight","100","string","Widget Height, omit for full"),F.prototype.publish("widget",null,"widget","Widget",null,{tags:["Private"]}),F.prototype.publish("opacity",1,"number","Opacity");const O=class _Accordion extends i{_isClosed;titleSpan;iconDiv;ul;icon;constructor(){super(),this._tag="div",this._isClosed=!1}pushListItem(t,e=!1,i=!1){const s=this.content();return t._protected=i,e?s.unshift(t):s.push(t),this.content(s),this}clearListItems(){const t=[];for(const e in this.content())this.content()[e]._protected&&t.push(this.content()[e]);return this.content(t),this}collapseClick(t){t.classed("closed")?(this._isClosed=!1,t.classed("open",!0),t.classed("closed",!1)):(this._isClosed=!0,t.classed("open",!1),t.classed("closed",!0))}enter(t,e){super.enter(t,e);const i=this;this._isClosed=this.defaultCollapsed(),e.classed(this._isClosed?"closed":"open",!0),this.titleSpan=e.append("span").classed("collapsible-title",!0),this.iconDiv=e.append("div").classed("collapsible-icon",!0),this.ul=e.append("ul"),this.icon=(new s).size({height:24,width:24}).target(this.iconDiv.node()),this.iconDiv.on("click",function(){i.collapseClick(e),i.render()}),this.titleSpan.on("click",function(){i.collapseClick(e),i.render()})}update(t,e){super.update(t,e);const i=this;this.titleSpan.text(i.title().length>0?i.title()+"":"Accordion ["+i._id+"]");const s=this.ul.selectAll("#"+i._id+" > ul > li").data(this.content(),function(t){return t._id});s.enter().append(function(t){const e=document.createElement("li");if(null!==t._target)return t._target;{const s=t.size();if(0===s.width||0===s.height){const e=i.size();t.size({width:e.width,height:e.width})}t.target(e)}return e}),s.exit().remove(),this.icon.text_colorFill(this.titleFontColor()).char(this._isClosed?this.closedIcon():this.openIcon()).render()}exit(t,e){super.exit(t,e)}};e(O,"Accordion");let L=O;L.prototype._class+=" layout_Accordion",L.prototype.publish("content",[],"widgetArray","Array of widgets",null,{tags:["Basic"]}),L.prototype.publish("title","","string","Title of collapsible section",null,{tags:["Private"]}),L.prototype.publish("openIcon","","string","Icon to display when list is open",null,{tags:["Private"]}),L.prototype.publish("closedIcon","","string","Icon to display when list is closed",null,{tags:["Private"]}),L.prototype.publish("titleFontColor","#FFFFFF","html-color","Title font color",null,{tags:["Private"]}),L.prototype.publish("titleBackgroundColor","#333333","html-color","Title background color",null,{tags:["Private"]}),L.prototype.publish("defaultCollapsed",!1,"boolean","Collapsed by default if true",null,{tags:["Private"]});const D=class _Surface extends i{_surfaceButtons;constructor(){super(),this._tag="div",this._surfaceButtons=[]}widgetSize(t,e){let i=this.clientWidth(),s=this.clientHeight();return this.title()&&(s-=this.calcHeight(t)),s-=this.calcFrameHeight(e),i-=this.calcFrameWidth(e),{width:i,height:s}}enter(t,e){super.enter(t,e)}update(t,e){super.update(t,e);const i=this;e.classed("shadow2",this.surfaceShadow()).style("border-width",this.surfaceBorderWidth_exists()?this.surfaceBorderWidth()+"px":null).style("border-color",this.surfaceBorderColor()).style("border-radius",this.surfaceBorderRadius_exists()?this.surfaceBorderRadius()+"px":null).style("background-color",this.surfaceBackgroundColor());const s=e.selectAll(".surfaceTitle").data(this.title()?[this.title()]:[]);s.enter().insert("h3","div").attr("class","surfaceTitle").merge(s).text(function(t){return t}).style("text-align",this.surfaceTitleAlignment()).style("color",this.surfaceTitleFontColor()).style("font-size",this.surfaceTitleFontSize_exists()?this.surfaceTitleFontSize()+"px":null).style("font-family",this.surfaceTitleFontFamily()).style("font-weight",this.surfaceTitleFontBold()?"bold":"normal").style("background-color",this.surfaceTitleBackgroundColor()).style("padding",this.surfaceTitlePadding_exists()?this.surfaceTitlePadding()+"px":null).style("title",this.altText_exists()?this.altText():null),s.exit().remove();const l=e.select(".surfaceTitle").append("div").attr("class","html-button-container").selectAll(".surface-button").data(this.buttonAnnotations());l.enter().append("button").classed("surface-button",!0).each(function(t,e){const s=i._surfaceButtons[e]=o(this).attr("class","surface-button"+(t.class?" "+t.class:"")).attr("id",t.id).style("padding",t.padding).style("width",t.width).style("height",t.height).style("cursor","pointer");"FontAwesome"===t.font?s.style("background","transparent").style("border","none").on("click",function(t){i.click(t)}).append("i").attr("class","fa").text(function(){return t.label}):s.text(function(){return t.label}).on("click",function(t){i.click(t)})}),l.exit().each(function(t,e){const s=o(this);delete i._surfaceButtons[e],s.remove()});const n=e.selectAll("#"+this._id+" > .surfaceWidget").data(this.widget()?[this.widget()]:[],function(t){return t._id});n.enter().append("div").attr("class","surfaceWidget").each(function(t){o(i.element().node().parentElement).classed("content-icon content-icon-"+t.classID().split("_")[1],!0),t.target(this)}).merge(n).style("padding",this.surfacePadding_exists()?this.surfacePadding()+"px":null).each(function(t){const s=i.widgetSize(e.select("h3"),o(this));s.width<0&&(s.width=0),s.height<0&&(s.height=0),t.resize({width:s.width,height:s.height})}),n.exit().each(function(t){t.target(null)}).remove()}exit(t,e){this.widget()&&this.widget().target(null),super.exit(t,e)}click(t){}};e(D,"Surface");let R=D;R.prototype._class+=" layout_Surface",R.prototype.publish("title","","string","Title",null,{tags:["Intermediate"]}),R.prototype.publish("altText",null,"string","Alt text",null,{optional:!0}),R.prototype.publish("surfaceTitlePadding",null,"number","Title Padding (px)",null,{tags:["Advanced"],disable:/* @__PURE__ */e(t=>!t.title(),"disable")}),R.prototype.publish("surfaceTitleFontSize",null,"number","Title Font Size (px)",null,{tags:["Advanced"],disable:/* @__PURE__ */e(t=>!t.title(),"disable")}),R.prototype.publish("surfaceTitleFontColor",null,"html-color","Title Font Color",null,{tags:["Advanced"],disable:/* @__PURE__ */e(t=>!t.title(),"disable")}),R.prototype.publish("surfaceTitleFontFamily",null,"string","Title Font Family",null,{tags:["Advanced"],disable:/* @__PURE__ */e(t=>!t.title(),"disable")}),R.prototype.publish("surfaceTitleFontBold",!0,"boolean","Enable Bold Title Font",null,{tags:["Advanced"],disable:/* @__PURE__ */e(t=>!t.title(),"disable")}),R.prototype.publish("surfaceTitleBackgroundColor",null,"html-color","Title Background Color",null,{tags:["Advanced"],disable:/* @__PURE__ */e(t=>!t.title(),"disable")}),R.prototype.publish("surfaceTitleAlignment","center","set","Title Alignment",["left","right","center"],{tags:["Basic"],disable:/* @__PURE__ */e(t=>!t.title(),"disable")}),R.prototype.publish("surfaceShadow",!1,"boolean","3D Shadow"),R.prototype.publish("surfacePadding",null,"string","Surface Padding (px)",null,{tags:["Intermediate"]}),R.prototype.publish("surfaceBackgroundColor",null,"html-color","Surface Background Color",null,{tags:["Advanced"]}),R.prototype.publish("surfaceBorderWidth",null,"number","Surface Border Width (px)",null,{tags:["Advanced"]}),R.prototype.publish("surfaceBorderColor",null,"html-color","Surface Border Color",null,{tags:["Advanced"]}),R.prototype.publish("surfaceBorderRadius",null,"number","Surface Border Radius (px)",null,{tags:["Advanced"]}),R.prototype.publish("buttonAnnotations",[],"array","Button Array",null,{tags:["Private"]}),R.prototype.publish("widget",null,"widget","Widget",null,{tags:["Basic"]});const G=class _Cell extends R{_indicateTheseIds;constructor(){super(),this._indicateTheseIds=[]}indicateTheseIds(t){return arguments.length?(this._indicateTheseIds=t,this):this._indicateTheseIds}enter(t,e){super.enter(t,e);const i=this;e.classed("layout_Surface",!0).on("mouseenter",function(){i.onMouseEnter()}).on("mouseleave",function(){i.onMouseLeave()})}update(t,e){super.update(t,e)}onMouseEnter(){const t=this.indicateTheseIds(),e=this.indicatorOpacity(),i=this.indicatorBorderColor(),s=this.indicatorGlowColor();for(let l=0;l<t.length;l++){const n=o("#"+t[l]),r=n.datum();n&&r&&n.append("div").attr("class","update-indicator").style("width",r.width()+"px").style("height",r.height()+"px").style("opacity",e).style("border-color",i).style("-webkit-box-shadow","inset 0px 0px 30px 0px "+s).style("-moz-box-shadow","inset 0px 0px 30px 0px "+s).style("box-shadow","inset 0px 0px 30px 0px "+s)}}onMouseLeave(){const t=this.indicateTheseIds();for(let e=0;e<t.length;e++)l("#"+t[e]+" > div.update-indicator").remove()}};e(G,"Cell");let E=G;E.prototype._class+=" layout_Cell",E.prototype.publish("gridRow",0,"number","Grid Row Position",null,{tags:["Private"]}),E.prototype.publish("gridCol",0,"number","Grid Column Position",null,{tags:["Private"]}),E.prototype.publish("gridRowSpan",1,"number","Grid Row Span",null,{tags:["Private"]}),E.prototype.publish("gridColSpan",1,"number","Grid Column Span",null,{tags:["Private"]}),E.prototype.publish("indicatorGlowColor","#EEEE11","html-color","Glow color of update-indicator",null,{tags:["Basic"]}),E.prototype.publish("indicatorBorderColor","#F48A00","html-color","Border color of update-indicator",null,{tags:["Basic"]}),E.prototype.publish("indicatorOpacity",.8,"number","Opacity of update-indicator",null,{tags:["Basic"]});const X=class _Border extends i{_colCount;_rowCount;_colSize;_rowSize;_shrinkWrapBoxes;_watch;_offsetX;_offsetY;_dragCell;_dragCellSize;_dragCellStartSize;_handleTop;_handleLeft;_dragPrevX;_dragPrevY;_cellSizes;contentDiv;_scrollBarWidth;_borderHandles;_sectionTypeArr;constructor(){super(),this._tag="div",this._colCount=0,this._rowCount=0,this._colSize=0,this._rowSize=0,this._shrinkWrapBoxes={},this.content([]),this.sectionTypes([])}watchWidget(t){if(void 0===this._watch&&(this._watch={}),this._watch[t.id()]&&(this._watch[t.id()].remove(),delete this._watch[t.id()]),t){const e=this;this._watch[t.id()]=t.monitor(function(t,i,s){s!==i&&e.lazyPostUpdate()})}}lazyPostUpdate=n.debounce(function(){this.postUpdate()},100);applyLayoutType(){const t=this.borderLayoutObject();this.content().forEach(function(e,i){e._fixedLeft=t[this.sectionTypes()[i]].left,e._fixedTop=t[this.sectionTypes()[i]].top,e._fixedWidth=t[this.sectionTypes()[i]].width,e._fixedHeight=t[this.sectionTypes()[i]].height,e._dragHandles=this.cellSpecificDragHandles(this.sectionTypes()[i])},this)}cellSpecificDragHandles(t){switch(t){case"top":return["s"];case"right":return["w"];case"bottom":return["n"];case"left":return["e"];case"center":return[]}}borderLayoutObject(t){const e={},i=this;let s,o,l,n,r,h,a,d;const p=this.target().getBoundingClientRect();p.top,p.left,p.bottom,p.right,this.target()instanceof SVGElement?(parseFloat(this.target().getAttribute("width")),parseFloat(this.target().getAttribute("height"))):(p.width,p.height),-1!==this.sectionTypes().indexOf("top")&&(s=this.topSize(),o=this.topPercentage(),void 0!==this._shrinkWrapBoxes.top&&(s=this._shrinkWrapBoxes.top.height+this.gutter(),o=0)),-1!==this.sectionTypes().indexOf("bottom")&&(l=this.bottomSize(),n=this.bottomPercentage(),void 0!==this._shrinkWrapBoxes.bottom&&(l=this._shrinkWrapBoxes.bottom.height+this.gutter(),n=0)),-1!==this.sectionTypes().indexOf("left")&&(r=this.leftSize(),h=this.leftPercentage(),void 0!==this._shrinkWrapBoxes.left&&(r=this._shrinkWrapBoxes.left.width+this.gutter(),h=0)),-1!==this.sectionTypes().indexOf("right")&&(a=this.rightSize(),d=this.rightPercentage(),void 0!==this._shrinkWrapBoxes.right&&(a=this._shrinkWrapBoxes.right.width+this.gutter(),d=0));const c=y({width:{px:0,"%":100},height:{px:s,"%":o},top:{px:0,"%":0},left:{px:0,"%":0}}),u=y({width:{px:0,"%":100},height:{px:l,"%":n},top:{px:0,"%":100},left:{px:0,"%":0}});u.top-=u.height;const g=y({width:{px:r,"%":h},height:{px:-c.height-u.height,"%":100},top:{px:c.height,"%":0},left:{px:0,"%":0}}),f=y({width:{px:a,"%":d},height:{px:-c.height-u.height,"%":100},top:{px:c.height,"%":0},left:{px:0,"%":100}});f.left-=f.width;const _=y({width:{px:-f.width-g.width,"%":100},height:{px:-c.height-u.height,"%":100},top:{px:c.height,"%":0},left:{px:g.width,"%":0}});return e.top=c,e.bottom=u,e.right=f,e.left=g,e.center=_,e;function y(t){t.width.px=void 0!==t.width.px?t.width.px:0,t.width["%"]=void 0!==t.width["%"]?t.width["%"]:0,t.height.px=void 0!==t.height.px?t.height.px:0,t.height["%"]=void 0!==t.height["%"]?t.height["%"]:0;return{width:t.width.px+t.width["%"]/100*i.width(),height:t.height.px+t.height["%"]/100*i.height(),top:t.top.px+t.top["%"]/100*i.height()+i.gutter()/2,left:t.left.px+t.left["%"]/100*i.width()+i.gutter()/2}}}clearContent(t){if(t){const e=this.sectionTypes().indexOf(t);e>=0&&(this._watch&&this.content()[e]&&delete this._watch[this.content()[e].id()],this.content()[e].target(null),o("#"+this.id()+" > div.borderHandle_"+t).classed("borderHandleDisabled",!0),this.content().splice(e,1),this.sectionTypes().splice(e,1))}else this.content().forEach(function(t){return t.target(null),!1}),o("#"+this.id()+" > div.borderHandle").classed("borderHandleDisabled",!0),delete this._watch,this.content([]),this.sectionTypes([])}hasContent(t,e,i){return this.sectionTypes().indexOf(t)>=0}setContent(t,e,i){if(this.clearContent(t),i=void 0!==i?i:"",e){const s=(new E).surfaceBorderWidth(0).widget(e).title(i);this.watchWidget(e),this.content().push(s),this.sectionTypes().push(t)}return this}getCell(t){const e=this.sectionTypes().indexOf(t);return e>=0?this.content()[e]:null}getContent(t){const e=this.sectionTypes().indexOf(t);return e>=0?this.content()[e].widget():null}setLayoutOffsets(){this._offsetX=this._element.node().getBoundingClientRect().left+this.gutter()/2,this._offsetY=this._element.node().getBoundingClientRect().top+this.gutter()/2}dragStart(t){const e=r();e.sourceEvent.stopPropagation();const i=this;this._dragCell=t,this._dragCellStartSize=this[t+"Size"](),this[t+"ShrinkWrap"]()&&(this[t+"Percentage"](0),this[t+"ShrinkWrap"](!1));const s=o("#"+i.id()+" > div.borderHandle_"+t);i._handleTop=parseFloat(s.style("top").split("px")[0]),i._handleLeft=parseFloat(s.style("left").split("px")[0]),this._dragPrevX=e.sourceEvent.clientX,this._dragPrevY=e.sourceEvent.clientY}dragTick(t){const i=this,s=r(),n=this._dragPrevX-s.sourceEvent.clientX,h=this._dragPrevY-s.sourceEvent.clientY;switch(t){case"top":case"bottom":a(t,h);break;case"right":case"left":a(t,n)}function a(t,e){if(0===e)return;const s=l("#"+i.id()+" > div.borderHandle"),n=o("#"+i.id()+" > div.borderHandle_"+t);n.classed("borderHandle_top")?(n.style("top",i._handleTop-e+"px"),i._cellSizes.topHeight=i._handleTop-e,i._cellSizes.leftHeight=i._cellSizes.height,i._cellSizes.leftHeight-=i._cellSizes.topHeight,i._cellSizes.leftHeight-=i._cellSizes.bottomHeight,i._cellSizes.rightHeight=i._cellSizes.leftHeight):n.classed("borderHandle_right")?(n.style("left",i._handleLeft-e+"px"),i._cellSizes.rightWidth=i._cellSizes.width-i._handleLeft+e):n.classed("borderHandle_bottom")?(n.style("top",i._handleTop-e+"px"),i._cellSizes.bottomHeight=i._cellSizes.height-i._handleTop+e,i._cellSizes.leftHeight=i._cellSizes.height,i._cellSizes.leftHeight-=i._cellSizes.bottomHeight,i._cellSizes.leftHeight-=i._cellSizes.topHeight,i._cellSizes.rightHeight=i._cellSizes.leftHeight):n.classed("borderHandle_left")&&(n.style("left",i._handleLeft-e+"px"),i._cellSizes.leftWidth=i._handleLeft-e),s.each(function(){const t=o(this);t.classed("borderHandle_top")?(t.style("width",i._cellSizes.width+"px"),t.style("top",i._cellSizes.topHeight-3+"px")):t.classed("borderHandle_right")?(t.style("left",i._cellSizes.width-i._cellSizes.rightWidth+"px"),t.style("top",i._cellSizes.topHeight+3+"px"),t.style("height",i._cellSizes.rightHeight+"px")):t.classed("borderHandle_bottom")?(t.style("width",i._cellSizes.width+"px"),t.style("top",i._cellSizes.height-i._cellSizes.bottomHeight-3+"px")):t.classed("borderHandle_left")&&(t.style("left",i._cellSizes.leftWidth+"px"),t.style("height",i._cellSizes.leftHeight+"px"),t.style("top",i._cellSizes.topHeight+3+"px"))})}e(a,"_moveHandles")}dragEnd(t){if(t){const e=r(),i=this._dragPrevX-e.sourceEvent.clientX,s=this._dragPrevY-e.sourceEvent.clientY;switch(t){case"top":0!==s&&(this.topPercentage(0),this.topSize(0===this.topSize()?this.getContent("top").getBBox().height-s:this.topSize()-s));break;case"right":0!==i&&(this.rightPercentage(0),this.rightSize(0===this.rightSize()?this.getContent("right").getBBox().width+i:this.rightSize()+i));break;case"bottom":0!==s&&(this.bottomPercentage(0),this.bottomSize(0===this.bottomSize()?this.getContent("bottom").getBBox().height+s:this.bottomSize()+s));break;case"left":0!==i&&(this.leftPercentage(0),this.leftSize(0===this.leftSize()?this.getContent("left").getBBox().width-i:this.leftSize()-i))}this._dragPrevX=e.sourceEvent.clientX,this._dragPrevY=e.sourceEvent.clientY}this.render()}size(t){const e=i.prototype.size.apply(this,arguments);return arguments.length&&this.contentDiv&&this.contentDiv.style("width",this._size.width+"px").style("height",this._size.height+"px"),e}enter(t,e){super.enter(t,e);const i=this;e.style("position","relative"),this.contentDiv=e.append("div").classed("border-content",!0),this._scrollBarWidth=h.getScrollbarWidth(),this._borderHandles=["top","left","right","bottom"];e.selectAll("div.borderHandle").data(this._borderHandles).enter().append("div").classed("borderHandle",!0).each(function(t){o(this).classed("borderHandle_"+t,!0).classed("borderHandleDisabled",null===i.getContent(t))})}update(t,e){super.update(t,e),this._sectionTypeArr=this.sectionTypes();const i=this;e.classed("design-mode",this.designMode()),this.setLayoutOffsets();const s=this.contentDiv.selectAll(".cell_"+this._id).data(this.content(),function(t){return t._id}),l=s.enter().append("div").classed("cell_"+this._id,!0).style("position","absolute").each(function(t,e){o(this).classed("border-cell border-cell-"+i._sectionTypeArr[e],!0),t.target(this),o("#"+i.id()+" > div.borderHandle_"+i._sectionTypeArr[e]).classed("borderHandleDisabled",!1)}).merge(s);l.each(function(t,e){const s=i.sectionTypes()[e];void 0!==i[s+"ShrinkWrap"]&&i[s+"ShrinkWrap"]()?(t.render(),i._shrinkWrapBoxes[s]=t.widget().getBBox(!0)):delete i._shrinkWrapBoxes[s]});const n=a().on("start",function(t,e){i.dragStart.call(i,t,e)}).on("drag",function(t,e){i.dragTick.call(i,t,e)}).on("end",function(t,e){i.dragEnd.call(i,t,e)});this.designMode()?e.selectAll("#"+this.id()+" > div.borderHandle").call(n):e.selectAll("#"+this.id()+" > div.borderHandle").on(".drag",null);const r=this.borderLayoutObject();this.content().forEach(function(t,e){t._fixedLeft=r[this.sectionTypes()[e]].left,t._fixedTop=r[this.sectionTypes()[e]].top,t._fixedWidth=r[this.sectionTypes()[e]].width,t._fixedHeight=r[this.sectionTypes()[e]].height,t._dragHandles=[]},this),l.style("left",function(t){return t._fixedLeft+"px"}).style("top",function(t){return t._fixedTop+"px"}).style("width",function(t){return t._fixedWidth-i.gutter()+"px"}).style("height",function(t){return t._fixedHeight-i.gutter()+"px"}).each(function(t){t._placeholderElement.attr("draggable",i.designMode()).selectAll(".dragHandle").attr("draggable",i.designMode()),t.surfacePadding(i.surfacePadding()).resize()}),s.exit().each(function(t){t.target(null)}).remove(),this.getCellSizes(),e.selectAll("#"+this.id()+" > div.borderHandle").each(function(){const t=o(this);t.classed("borderHandle_top")?(t.style("width",i._cellSizes.width+"px"),t.style("top",i._cellSizes.topHeight-3+"px")):t.classed("borderHandle_right")?(t.style("left",i._cellSizes.width-i._cellSizes.rightWidth+"px"),t.style("top",i._cellSizes.topHeight+3+"px"),t.style("height",i._cellSizes.rightHeight+"px")):t.classed("borderHandle_bottom")?(t.style("width",i._cellSizes.width+"px"),t.style("top",i._cellSizes.height-i._cellSizes.bottomHeight-3+"px")):t.classed("borderHandle_left")&&(t.style("left",i._cellSizes.leftWidth+"px"),t.style("height",i._cellSizes.leftHeight+"px"),t.style("top",i._cellSizes.topHeight+3+"px"))})}getCellSizes(){const t=this;t._cellSizes={};const e=this.element().node().getBoundingClientRect();t._cellSizes.width=e.width,t._cellSizes.height=e.height,this.element().selectAll("#"+this.id()+" > div > div.border-cell").each(function(){const e=o(this);if("function"==typeof e.node){const i=e.node().getBoundingClientRect();e.classed("border-cell-top")?t._cellSizes.topHeight=i.height:e.classed("border-cell-left")?(t._cellSizes.leftWidth=i.width,t._cellSizes.leftHeight=i.height):e.classed("border-cell-right")?(t._cellSizes.rightWidth=i.width,t._cellSizes.rightHeight=i.height):e.classed("border-cell-bottom")&&(t._cellSizes.bottomHeight=i.height)}});["height","width","topHeight","bottomHeight","leftHeight","rightHeight","leftWidth","rightWidth"].forEach(function(e){t._cellSizes[e]=void 0===t._cellSizes[e]?0:t._cellSizes[e]})}postUpdate(t,e){const i=this;this.content().forEach(function(t){if(null!==t._element.node()&&t.widget()){const e=t.widget().getBBox(!1,!0),s=t.widget().getBBox(!0,!0);e.width===s.width&&e.height===s.height||i.lazyRender()}})}exit(t,e){this.content().forEach(t=>t.target(null)),super.exit(t,e)}};e(X,"Border");let Y=X;Y.prototype._class+=" layout_Border",Y.prototype.publish("designMode",!1,"boolean","Design Mode",null,{tags:["Basic"]}),Y.prototype.publish("content",[],"widgetArray","widgets",null,{tags:["Intermediate"]}),Y.prototype.publish("gutter",0,"number","Gap Between Widgets",null,{tags:["Basic"]}),Y.prototype.publish("topShrinkWrap",!1,"boolean","'Top' Cell shrinks to fit content",null,{tags:["Intermediate"]}),Y.prototype.publish("leftShrinkWrap",!1,"boolean","'Left' Cell shrinks to fit content",null,{tags:["Intermediate"]}),Y.prototype.publish("rightShrinkWrap",!1,"boolean","'Right' Cell shrinks to fit content",null,{tags:["Intermediate"]}),Y.prototype.publish("bottomShrinkWrap",!1,"boolean","'Bottom' Cell shrinks to fit content",null,{tags:["Intermediate"]}),Y.prototype.publish("topSize",0,"number","Height of the 'Top' Cell (px)",null,{tags:["Private"]}),Y.prototype.publish("leftSize",0,"number","Width of the 'Left' Cell (px)",null,{tags:["Private"]}),Y.prototype.publish("rightSize",0,"number","Width of the 'Right' Cell (px)",null,{tags:["Private"]}),Y.prototype.publish("bottomSize",0,"number","Height of the 'Bottom' Cell (px)",null,{tags:["Private"]}),Y.prototype.publish("topPercentage",20,"number","Percentage (of parent) Height of the 'Top' Cell",null,{tags:["Private"]}),Y.prototype.publish("leftPercentage",20,"number","Percentage (of parent) Width of the 'Left' Cell",null,{tags:["Private"]}),Y.prototype.publish("rightPercentage",20,"number","Percentage (of parent) Width of the 'Right' Cell",null,{tags:["Private"]}),Y.prototype.publish("bottomPercentage",20,"number","Percentage (of parent) Height of the 'Bottom' Cell",null,{tags:["Private"]}),Y.prototype.publish("surfacePadding",0,"number","Cell Padding (px)",null,{tags:["Intermediate"]}),Y.prototype.publish("sectionTypes",[],"array","Section Types sharing an index with 'content' - Used to determine position/size.",null,{tags:["Private"]});const V=class _WidgetDiv{_div;_overlay=!1;_overflowX="visible";_overflowY="visible";_widget;constructor(t){this._div=t}overlay(t){return arguments.length?(this._overlay=t,this):this._overlay}overflowX(t){return arguments.length?(this._overflowX=t,this._div.style("overflow-x",t),this):this._overflowX}overflowY(t){return arguments.length?(this._overflowY=t,this._div.style("overflow-y",t),this):this._overflowY}element(){return this._div}node(){return this._div.node()}widget(t){return arguments.length?(this._widget!==t&&(this._widget&&this._widget.target(null),this._widget=t,this._widget&&this._widget.target(this._div.node())),this):this._widget}resize(t){return this._widget&&(this._div.style("width",`${t.width}px`).style("height",`${t.height}px`),this._widget.resize(t)),this}async render(t,e,i){let s=this.overflowX();this.overlay()||"visible"!==s||(s=null);let o=this.overflowY();return this.overlay()||"visible"!==o||(o=null),this._div.style("height",this.overlay()?"0px":null).style("overflow-x",s).style("overflow-y",o),this._widget?this._widget.renderPromise().then(s=>{if(t&&this._widget.visible()){const t=this._widget.getBBox();return t.width+=8,void 0!==e&&t.height>e&&(t.width+=h.getScrollbarWidth()),void 0!==i&&t.width>i&&(t.height+=h.getScrollbarWidth()),this.overlay()?t.height=0:t.height+=4,t}return t?{x:0,y:0,width:0,height:0}:void 0}):Promise.resolve(t?{x:0,y:0,width:0,height:0}:void 0)}};e(V,"WidgetDiv");let N=V;const $=class _Border2 extends i{_bodyElement;_topWA;_leftWA;_centerWA;_rightWA;_bottomWA;_topPrevOverflow;_leftPrevOverflow;_rightPrevOverflow;_bottomPrevOverflow;constructor(){super(),this._tag="div"}enter(t,e){super.enter(t,e);const i=e.append("header");this._bodyElement=e.append("div").attr("class","body");const s=this._bodyElement.append("div").attr("class","center"),o=this._bodyElement.append("div").attr("class","lhs"),l=this._bodyElement.append("div").attr("class","rhs"),n=e.append("div").attr("class","footer");this._topWA=new N(i),this._centerWA=new N(s),this._leftWA=new N(o),this._rightWA=new N(l),this._bottomWA=new N(n)}update(t,e){super.update(t,e),this._topWA.element().style("display",this.showTop()?null:"none"),this._rightWA.element().style("display",this.showRight()?null:"none"),this._bottomWA.element().style("display",this.showBottom()?null:"none"),this._leftWA.element().style("display",this.showLeft()?null:"none"),this.topOverflowX()!==this._topWA.overflowX()&&this._topWA.overflowX(this.topOverflowX()),this.rightOverflowX()!==this._rightWA.overflowX()&&this._rightWA.overflowX(this.rightOverflowX()),this.bottomOverflowX()!==this._bottomWA.overflowX()&&this._bottomWA.overflowX(this.bottomOverflowX()),this.leftOverflowX()!==this._leftWA.overflowX()&&this._leftWA.overflowX(this.leftOverflowX()),this.topOverflowY()!==this._topWA.overflowY()&&this._topWA.overflowY(this.topOverflowY()),this.rightOverflowY()!==this._rightWA.overflowY()&&this._rightWA.overflowY(this.rightOverflowY()),this.bottomOverflowY()!==this._bottomWA.overflowY()&&this._bottomWA.overflowY(this.bottomOverflowY()),this.leftOverflowY()!==this._leftWA.overflowY()&&this._leftWA.overflowY(this.leftOverflowY()),this.element().style("width",`${this.width()}px`).style("height",`${this.height()}px`)}targetNull(t){t&&t.target(null)}exit(t,e){this.targetNull(this.center()),this.targetNull(this.bottom()),this.targetNull(this.right()),this.targetNull(this.left()),this.targetNull(this.top()),super.exit(t,e)}swap(t,e){const i=this[t](),s=this[e]();return this.targetNull(i),this.targetNull(s),this[`_${t}WA`].widget(null),this[`_${e}WA`].widget(null),this[t](s),this[e](i),this}render(t){return super.render(e=>{this._topWA?this._topWA.widget(this.top()).overlay(this.topOverlay()).render(!0).then(async e=>{const i=await this._bottomWA.widget(this.bottom()).render(!0,void 0,this.width()),s=this.height()-(e.height+i.height),o=await this._leftWA.widget(this.left()).render(!0,s),l=await this._rightWA.widget(this.right()).render(!0,s);this.bottomHeight_exists()&&(i.height=this.bottomHeight());const n=this.width()-(o.width+l.width),r=this.height()-(e.height+i.height),h=this.centerOverflowX(),a=this.centerOverflowY(),d=-1!==["auto","scroll"].indexOf(h),p=-1!==["auto","scroll"].indexOf(a);(d||p)&&this._centerWA.overflowX(this.centerOverflowX()).overflowY(this.centerOverflowY()).widget(this.center()).resize({width:n,height:r}).render(),this._bodyElement.style("height",`${r}px`);const c=[this._topWA.overflowX(this.topOverflowX()).overflowY(this.topOverflowY()).resize({width:this.width(),height:e.height}).render(),this._leftWA.overflowX(this.leftOverflowX()).overflowY(this.leftOverflowY()).resize({width:o.width,height:r}).render(),this._rightWA.overflowX(this.rightOverflowX()).overflowY(this.rightOverflowY()).resize({width:l.width,height:r}).render(),this._centerWA.overflowX(this.centerOverflowX()).overflowY(this.centerOverflowY()).widget(this.center()).resize({width:n,height:r}).render(),this._bottomWA.overflowX(this.bottomOverflowX()).overflowY(this.bottomOverflowY()).resize({width:this.width(),height:i.height}).render()];Promise.all(c).then(e=>{t&&t(this)})}):t&&t(this)})}};e($,"Border2");let U=$;U.prototype._class+=" layout_Border2",U.prototype.publish("showTop",!0,"boolean","If true, top widget adapter will display"),U.prototype.publish("showRight",!0,"boolean","If true, right widget adapter will display"),U.prototype.publish("showBottom",!0,"boolean","If true, bottom widget adapter will display"),U.prototype.publish("showLeft",!0,"boolean","If true, left widget adapter will display"),U.prototype.publish("topOverflowX","visible","set","Sets the overflow-x css style for the top widget adapter",["hidden","scroll","visible","auto"]),U.prototype.publish("rightOverflowX","visible","set","Sets the overflow-x css style for the right widget adapter",["hidden","scroll","visible","auto"]),U.prototype.publish("bottomOverflowX","visible","set","Sets the overflow-x css style for the bottom widget adapter",["hidden","scroll","visible","auto"]),U.prototype.publish("leftOverflowX","visible","set","Sets the overflow-x css style for the left widget adapter",["hidden","scroll","visible","auto"]),U.prototype.publish("centerOverflowX","visible","set","Sets the overflow-x css style for the center widget adapter",["hidden","scroll","visible","auto"]),U.prototype.publish("topOverflowY","visible","set","Sets the overflow-y css style for the top widget adapter",["hidden","scroll","visible","auto"]),U.prototype.publish("rightOverflowY","visible","set","Sets the overflow-y css style for the right widget adapter",["hidden","scroll","visible","auto"]),U.prototype.publish("bottomOverflowY","visible","set","Sets the overflow-y css style for the bottom widget adapter",["hidden","scroll","visible","auto"]),U.prototype.publish("leftOverflowY","visible","set","Sets the overflow-y css style for the left widget adapter",["hidden","scroll","visible","auto"]),U.prototype.publish("centerOverflowY","visible","set","Sets the overflow-y css style for the center widget adapter",["hidden","scroll","visible","auto"]),U.prototype.publish("top",null,"widget","Top Widget",void 0,{render:!1}),U.prototype.publish("topOverlay",!1,"boolean","Overlay Top Widget"),U.prototype.publish("left",null,"widget","Left Widget",void 0,{render:!1}),U.prototype.publish("center",null,"widget","Center Widget",void 0,{render:!1}),U.prototype.publish("right",null,"widget","Right Widget",void 0,{render:!1}),U.prototype.publish("bottom",null,"widget","Bottom Widget",void 0,{render:!1}),U.prototype.publish("bottomHeight",null,"number","Bottom Fixed Height",void 0,{optional:!0});const j=class _Carousel extends i{_prevActive=0;_root;activeWidget(){return this.widgets()[this.active()]}enter(t,e){super.enter(t,e),this._root=e.append("div").attr("id",`${this.id()}_root`)}update(t,e){super.update(t,e);const i=this.active(),s=this.width();this._root.style("width",`${s}px`).style("height",`${this.height()}px`);const l=this._root.selectAll(`#${this.id()}_root > .carouselItem`).data(this.widgets(),t=>t.id()),n=l.enter().append("div").attr("class","carouselItem").each(function(t){t.target(this)}).merge(l).style("left",(t,e)=>(e-this._prevActive)*s+"px").style("width",`${s}px`);this._prevActive!==i&&(n.style("display",(t,e)=>e===this._prevActive||e===i?null:"none").transition().duration(this.transitionDuration()).style("left",(t,e)=>(e-i)*s+"px").on("end",function(t,e){o(this).style("display",()=>e===i?null:"none")}),this._prevActive=i),l.exit().each(function(t){t.target(null)}).remove()}exit(t,e){this.widgets().forEach(t=>t.target(null)),super.exit(t,e)}render(t){return super.render(e=>{if(!this.visible()||this.isDOMHidden())t&&t(e);else{const i=this.activeWidget();i&&i.resize(this.size()).render(i=>{t&&t(e)})}})}};e(j,"Carousel");let q=j;q.prototype._class+=" layout_Carousel",q.prototype.publish("widgets",[],"widgetArray","Widgets",null,{render:!1}),q.prototype.publish("active",0,"number","Active widget"),q.prototype.publish("transitionDuration",500,"number","Transition duration");var J=Math.PI,Z=2*J,K=1e-6,Q=Z-K;function tt(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function et(){return new tt}function it(t){/* @__PURE__ */
2
+ return e(function(){return t},"constant")}e(tt,"Path"),e(et,"path"),tt.prototype=et.prototype={constructor:tt,moveTo:/* @__PURE__ */e(function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},"moveTo"),closePath:/* @__PURE__ */e(function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},"closePath"),lineTo:/* @__PURE__ */e(function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},"lineTo"),quadraticCurveTo:/* @__PURE__ */e(function(t,e,i,s){this._+="Q"+ +t+","+ +e+","+(this._x1=+i)+","+(this._y1=+s)},"quadraticCurveTo"),bezierCurveTo:/* @__PURE__ */e(function(t,e,i,s,o,l){this._+="C"+ +t+","+ +e+","+ +i+","+ +s+","+(this._x1=+o)+","+(this._y1=+l)},"bezierCurveTo"),arcTo:/* @__PURE__ */e(function(t,e,i,s,o){t=+t,e=+e,i=+i,s=+s,o=+o;var l=this._x1,n=this._y1,r=i-t,h=s-e,a=l-t,d=n-e,p=a*a+d*d;if(o<0)throw new Error("negative radius: "+o);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(p>K)if(Math.abs(d*r-h*a)>K&&o){var c=i-l,u=s-n,g=r*r+h*h,f=c*c+u*u,_=Math.sqrt(g),y=Math.sqrt(p),b=o*Math.tan((J-Math.acos((g+p-f)/(2*_*y)))/2),w=b/y,m=b/_;Math.abs(w-1)>K&&(this._+="L"+(t+w*a)+","+(e+w*d)),this._+="A"+o+","+o+",0,0,"+ +(d*c>a*u)+","+(this._x1=t+m*r)+","+(this._y1=e+m*h)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},"arcTo"),arc:/* @__PURE__ */e(function(t,e,i,s,o,l){t=+t,e=+e,l=!!l;var n=(i=+i)*Math.cos(s),r=i*Math.sin(s),h=t+n,a=e+r,d=1^l,p=l?s-o:o-s;if(i<0)throw new Error("negative radius: "+i);null===this._x1?this._+="M"+h+","+a:(Math.abs(this._x1-h)>K||Math.abs(this._y1-a)>K)&&(this._+="L"+h+","+a),i&&(p<0&&(p=p%Z+Z),p>Q?this._+="A"+i+","+i+",0,1,"+d+","+(t-n)+","+(e-r)+"A"+i+","+i+",0,1,"+d+","+(this._x1=h)+","+(this._y1=a):p>K&&(this._+="A"+i+","+i+",0,"+ +(p>=J)+","+d+","+(this._x1=t+i*Math.cos(o))+","+(this._y1=e+i*Math.sin(o))))},"arc"),rect:/* @__PURE__ */e(function(t,e,i,s){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +i+"v"+ +s+"h"+-i+"Z"},"rect"),toString:/* @__PURE__ */e(function(){return this._},"toString")},e(it,"constant");var st=Math.PI,ot=2*st;const lt={draw:/* @__PURE__ */e(function(t,e){var i=Math.sqrt(e/st);t.moveTo(i,0),t.arc(0,0,i,0,ot)},"draw")},nt={draw:/* @__PURE__ */e(function(t,e){var i=Math.sqrt(e/5)/2;t.moveTo(-3*i,-i),t.lineTo(-i,-i),t.lineTo(-i,-3*i),t.lineTo(i,-3*i),t.lineTo(i,-i),t.lineTo(3*i,-i),t.lineTo(3*i,i),t.lineTo(i,i),t.lineTo(i,3*i),t.lineTo(-i,3*i),t.lineTo(-i,i),t.lineTo(-3*i,i),t.closePath()},"draw")};var rt=Math.sqrt(1/3),ht=2*rt;const at={draw:/* @__PURE__ */e(function(t,e){var i=Math.sqrt(e/ht),s=i*rt;t.moveTo(0,-i),t.lineTo(s,0),t.lineTo(0,i),t.lineTo(-s,0),t.closePath()},"draw")};var dt=Math.sin(st/10)/Math.sin(7*st/10),pt=Math.sin(ot/10)*dt,ct=-Math.cos(ot/10)*dt;const ut={draw:/* @__PURE__ */e(function(t,e){var i=Math.sqrt(.8908130915292852*e),s=pt*i,o=ct*i;t.moveTo(0,-i),t.lineTo(s,o);for(var l=1;l<5;++l){var n=ot*l/5,r=Math.cos(n),h=Math.sin(n);t.lineTo(h*i,-r*i),t.lineTo(r*s-h*o,h*s+r*o)}t.closePath()},"draw")},gt={draw:/* @__PURE__ */e(function(t,e){var i=Math.sqrt(e),s=-i/2;t.rect(s,s,i,i)},"draw")};var ft=Math.sqrt(3);const _t={draw:/* @__PURE__ */e(function(t,e){var i=-Math.sqrt(e/(3*ft));t.moveTo(0,2*i),t.lineTo(-ft*i,-i),t.lineTo(ft*i,-i),t.closePath()},"draw")};var yt=-.5,bt=Math.sqrt(3)/2,wt=1/Math.sqrt(12),mt=3*(wt/2+1);const vt={draw:/* @__PURE__ */e(function(t,e){var i=Math.sqrt(e/mt),s=i/2,o=i*wt,l=s,n=i*wt+i,r=-l,h=n;t.moveTo(s,o),t.lineTo(l,n),t.lineTo(r,h),t.lineTo(yt*s-bt*o,bt*s+yt*o),t.lineTo(yt*l-bt*n,bt*l+yt*n),t.lineTo(yt*r-bt*h,bt*r+yt*h),t.lineTo(yt*s+bt*o,yt*o-bt*s),t.lineTo(yt*l+bt*n,yt*n-bt*l),t.lineTo(yt*r+bt*h,yt*h-bt*r),t.closePath()},"draw")};function xt(){var t=it(lt),i=it(64),s=null;function o(){var e;if(s||(s=e=et()),t.apply(this,arguments).draw(s,+i.apply(this,arguments)),e)return s=null,e+""||null}return e(o,"symbol"),o.type=function(e){return arguments.length?(t="function"==typeof e?e:it(e),o):t},o.size=function(t){return arguments.length?(i="function"==typeof t?t:it(+t),o):i},o.context=function(t){return arguments.length?(s=null==t?null:t,o):s},o}e(xt,"d3Symbol");var St="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ct=/* @__PURE__ */e(function(t){return t},"d3_identity"),Pt=/* @__PURE__ */e(function(t){for(var e=[],i=0,s=t.length;i<s;i++)e[i]=t[s-i-1];return e},"d3_reverse"),Tt=/* @__PURE__ */e(function(t,e){t.each(function(){var t,i=o(this),s=i.text().split(/\s+/).reverse(),l=[];i.attr("y");for(var n=parseFloat(i.attr("dy"))||0,r=i.text(null).append("tspan").attr("x",0).attr("dy",n+"em");t=s.pop();)l.push(t),r.text(l.join(" ")),r.node().getComputedTextLength()>e&&l.length>1&&(l.pop(),r.text(l.join(" ")),l=[t],r=i.append("tspan").attr("x",0).attr("dy",1.2+n+"em").text(t))})},"d3_textWrapping"),zt=/* @__PURE__ */e(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments[1],i=arguments[2],s=arguments[3],o=arguments[4];if("object"===(void 0===e?"undefined":St(e))){if(0===e.length)return t;for(var l=e.length;l<t.length;l++)e.push(t[l]);return e}if("function"==typeof e){for(var n=[],r=t.length,h=0;h<r;h++)n.push(e({i:h,genLength:r,generatedLabels:t,domain:i,range:s,labelDelimiter:o}));return n}return t},"d3_mergeLabels"),Wt=/* @__PURE__ */e(function(t,i,s){var o=[];if(i.length>1)o=i;else for(var l=t.domain(),n=(l[l.length-1]-l[0])/(i-1),r=0;r<i;r++)o.push(l[0]+r*n);var h=o.map(s);return{data:o,labels:h,feature:/* @__PURE__ */e(function(e){return t(e)},"feature")}},"d3_linearLegend"),Bt=/* @__PURE__ */e(function(t,e,i){var s=t.range().map(function(s){var o=t.invertExtent(s);return e(o[0])+" "+i+" "+e(o[1])});return{data:t.range(),labels:s,feature:Ct}},"d3_quantLegend"),It=/* @__PURE__ */e(function(t){return{data:t.domain(),labels:t.domain(),feature:/* @__PURE__ */e(function(e){return t(e)},"feature")}},"d3_ordinalLegend"),At=/* @__PURE__ */e(function(t,e,i){t.call("cellover",i,e)},"d3_cellOver"),Ht=/* @__PURE__ */e(function(t,e,i){t.call("cellout",i,e)},"d3_cellOut"),Mt=/* @__PURE__ */e(function(t,e,i){t.call("cellclick",i,e)},"d3_cellClick"),kt={d3_drawShapes:/* @__PURE__ */e(function(t,e,i,s,o,l){"rect"===t?e.attr("height",i).attr("width",s):"circle"===t?e.attr("r",o):"line"===t?e.attr("x1",0).attr("x2",s).attr("y1",0).attr("y2",0):"path"===t&&e.attr("d",l)},"d3_drawShapes"),d3_addText:/* @__PURE__ */e(function(t,e,i,s,o){e.append("text").attr("class",s+"label");var l=t.selectAll("g."+s+"cell text."+s+"label").data(i).text(Ct);return o&&t.selectAll("g."+s+"cell text."+s+"label").call(Tt,o),l},"d3_addText"),d3_calcType:/* @__PURE__ */e(function(t,e,i,s,o,l){var n=t.invertExtent?Bt(t,o,l):t.ticks?Wt(t,i,o):It(t),r=t.range&&t.range()||t.domain();return n.labels=zt(n.labels,s,t.domain(),r,l),e&&(n.labels=Pt(n.labels),n.data=Pt(n.data)),n},"d3_calcType"),d3_filterCells:/* @__PURE__ */e(function(t,e){var i=t.data.map(function(e,i){return{data:e,label:t.labels[i]}}).filter(e),s=i.map(function(t){return t.data}),o=i.map(function(t){return t.label});return t.data=t.data.filter(function(t){return-1!==s.indexOf(t)}),t.labels=t.labels.filter(function(t){return-1!==o.indexOf(t)}),t},"d3_filterCells"),d3_placement:/* @__PURE__ */e(function(t,e,i,s,o,l){e.attr("transform",i),s.attr("transform",o),"horizontal"===t&&s.style("text-anchor",l)},"d3_placement"),d3_addEvents:/* @__PURE__ */e(function(t,e){t.on("mouseover.legend",function(t){At(e,t,this)}).on("mouseout.legend",function(t){Ht(e,t,this)}).on("click.legend",function(t){Mt(e,t,this)})},"d3_addEvents"),d3_title:/* @__PURE__ */e(function(t,e,i,s){if(""!==e){t.selectAll("text."+i+"legendTitle").data([e]).enter().append("text").attr("class",i+"legendTitle"),t.selectAll("text."+i+"legendTitle").text(e),s&&t.selectAll("text."+i+"legendTitle").call(Tt,s);var o=t.select("."+i+"legendCells"),l=t.select("."+i+"legendTitle").nodes().map(function(t){return t.getBBox().height})[0],n=-o.nodes().map(function(t){return t.getBBox().x})[0];o.attr("transform","translate("+n+","+l+")")}},"d3_title"),d3_defaultLocale:{format:u,formatPrefix:c},d3_defaultFormatSpecifier:".01f",d3_defaultDelimiter:"to"};function Ft(){var t=d(),i="rect",s=15,o=15,l=10,n=2,r=[5],h=void 0,a=[],c="",u=!1,y="",b=kt.d3_defaultLocale,w=kt.d3_defaultFormatSpecifier,m=10,v="middle",x=kt.d3_defaultDelimiter,S=void 0,C="vertical",P=!1,T=void 0,z=void 0,W=p("cellover","cellout","cellclick");function B(d){var p=kt.d3_calcType(t,P,r,a,b.format(w),x);d.selectAll("g").data([t]).enter().append("g").attr("class",c+"legendCells"),h&&kt.d3_filterCells(p,h);var g=d.select("."+c+"legendCells").selectAll("."+c+"cell").data(p.data),f=g.enter().append("g").attr("class",c+"cell");f.append(i).attr("class",c+"swatch");var B=d.selectAll("g."+c+"cell "+i+"."+c+"swatch").data(p.data);kt.d3_addEvents(f,W),g.exit().transition().style("opacity",0).remove(),B.exit().transition().style("opacity",0).remove(),B=B.merge(B),kt.d3_drawShapes(i,B,o,s,l,T);var I=kt.d3_addText(d,f,p.labels,c,S);g=f.merge(g);var A=I.nodes().map(function(t){return t.getBBox()}),H=B.nodes().map(function(t){return t.getBBox()});u?B.attr("class",function(t){return c+"swatch "+p.feature(t)}):"line"==i?B.style("stroke",p.feature):B.style("fill",p.feature);var M,k=void 0,F=void 0,O="start"==v?0:"middle"==v?.5:1;"vertical"===C?(M=A.map(function(t,e){return Math.max(t.height,H[e].height)}),k=/* @__PURE__ */e(function(t,e){return"translate(0, "+(_(M.slice(0,e))+e*n)+")"},"cellTrans"),F=/* @__PURE__ */e(function(t,e){return"translate( "+(H[e].width+H[e].x+m)+", "+(H[e].y+H[e].height/2+5)+")"},"textTrans")):"horizontal"===C&&(k=/* @__PURE__ */e(function(t,e){return"translate("+e*(H[e].width+n)+",0)"},"cellTrans"),F=/* @__PURE__ */e(function(t,e){return"translate("+(H[e].width*O+H[e].x)+",\n "+(H[e].height+H[e].y+m+8)+")"},"textTrans")),kt.d3_placement(C,g,k,I,F,v),kt.d3_title(d,y,c,z),g.transition().style("opacity",1)}return e(B,"legend"),B.scale=function(e){return arguments.length?(t=e,B):t},B.cells=function(t){return arguments.length?((t.length>1||t>=2)&&(r=t),B):r},B.cellFilter=function(t){return arguments.length?(h=t,B):h},B.shape=function(t,e){return arguments.length?(("rect"==t||"circle"==t||"line"==t||"path"==t&&"string"==typeof e)&&(i=t,T=e),B):i},B.shapeWidth=function(t){return arguments.length?(s=+t,B):s},B.shapeHeight=function(t){return arguments.length?(o=+t,B):o},B.shapeRadius=function(t){return arguments.length?(l=+t,B):l},B.shapePadding=function(t){return arguments.length?(n=+t,B):n},B.labels=function(t){return arguments.length?(a=t,B):a},B.labelAlign=function(t){return arguments.length?("start"!=t&&"end"!=t&&"middle"!=t||(v=t),B):v},B.locale=function(t){return arguments.length?(b=g(t),B):b},B.labelFormat=function(t){return arguments.length?(w=f(t),B):B.locale().format(w)},B.labelOffset=function(t){return arguments.length?(m=+t,B):m},B.labelDelimiter=function(t){return arguments.length?(x=t,B):x},B.labelWrap=function(t){return arguments.length?(S=t,B):S},B.useClass=function(t){return arguments.length?(!0!==t&&!1!==t||(u=t),B):u},B.orient=function(t){return arguments.length?("horizontal"!=(t=t.toLowerCase())&&"vertical"!=t||(C=t),B):C},B.ascending=function(t){return arguments.length?(P=!!t,B):P},B.classPrefix=function(t){return arguments.length?(c=t,B):c},B.title=function(t){return arguments.length?(y=t,B):y},B.titleWidth=function(t){return arguments.length?(z=t,B):z},B.textWrap=function(t){return arguments.length?(textWrap=t,B):textWrap},B.on=function(){var t=W.on.apply(W,arguments);return t===W?B:t},B}e(Ft,"color");const Ot=class _Legend extends y{_owner;_targetWidget;_targetWidgetMonitor;_legendOrdinal;_disabled=[];_symbolTypeMap={circle:lt,cross:nt,diamond:at,square:gt,star:ut,triangle:_t,wye:vt};constructor(t){super(),this._owner=t,this._drawStartPos="origin";const e=this;this._legendOrdinal=Ft().shape("path",xt().type(lt).size(150)()).shapePadding(10).shapeRadius(10).on("cellclick",function(t){e.onClick(t,this)}).on("cellover",t=>{e.onOver(t,this)}).on("cellout",t=>{e.onOut(t,this)})}isDisabled(t){return void 0!==t&&("string"==typeof t?0===t.indexOf("__")||this._disabled.indexOf(t)>=0:t instanceof b.Field?0===t.id().indexOf("__")||this._disabled.indexOf(t.id())>=0:this._disabled.indexOf(t)>=0)}filteredFields(){switch(this.dataFamily()){case"2D":return this.fields();case"ND":return this.fields().filter(t=>!this.isDisabled(t))}return this.fields()}filteredColumns(){switch(this.dataFamily()){case"2D":return this.columns();case"ND":return this.columns().filter(t=>!this.isDisabled(t))}return this.columns()}filteredData(){switch(this.dataFamily()){case"2D":return this.data().filter(t=>!this.isDisabled(t[0]));case"ND":const t={};let e=!1;return this.columns().forEach((i,s)=>{const o=this.isDisabled(i);t[s]=o,o&&(e=!0)}),e?this.data().map(e=>e.filter((e,i)=>!t[i])):this.data()}return this.data()}isRainbow(){const t=this.getWidget();return t&&t._palette&&"rainbow"===t._palette.type()}targetWidget(t){if(!arguments.length)return this._targetWidget;if(this._targetWidget=t,this._targetWidgetMonitor&&(this._targetWidgetMonitor.remove(),delete this._targetWidgetMonitor),this._targetWidget){const t=this;this._targetWidgetMonitor=this._targetWidget.monitor(function(e,i,s,o){switch(e){case"chart":case"columns":case"data":case"paletteID":t.lazyRender()}})}return this}getWidget(){return this._targetWidget&&"composite_MultiChart"===this._targetWidget.classID()?this._targetWidget.chart():this._targetWidget}getPalette(){const t=this.getWidget();if(t&&t._palette)switch(t._palette.type()){case"ordinal":return w.ordinal(t._palette.id());case"rainbow":return w.rainbow(t._palette.id())}return w.ordinal("default")}getPaletteType(){return this.getPalette().type()}fillColorFunc(){const t=this.getWidget();if(t&&t.fillColor)return t._palette&&t.paletteID&&t._palette.name!==t.paletteID()&&(t._palette=t._palette.switch(t.paletteID())),(e,i,s)=>t.fillColor(e,i,s);const e=w.ordinal(t&&t.paletteID&&t.paletteID()||"default");return(t,i,s)=>e(i)}fillColor(t,e,i){return this.fillColorFunc()(t,e,i)}_g;enter(t,e){super.enter(t,e),this._g=e.append("g").attr("class","legendOrdinal")}calcMetaData(){let t=[],e=0,i=0;const s=this.columns().length;if(this._targetWidget){const o=this.columns();switch(this.getPaletteType()){case"ordinal":const l=this.fillColorFunc();let n=0;switch(this.dataFamily()){case"2D":t=this.data().map(function(t,o){n=this.data()[o].slice(1,s).reduce((t,e)=>t+e,0);const r=this.isDisabled(t[0]);r||(e+=n);const h=t[0]+(!r&&this.showSeriesTotal()?` (${n})`:""),a=this.textSize(h);return i<a.width&&(i=a.width),[l(t,t[0],!1),t[0],h]},this);break;case"ND":t=this.columns().filter(t=>0!==t.indexOf("__")).filter(function(t,e){return e>0}).map(function(t,s){n=this.data().reduce((t,e)=>t+e[s+1],0);const r=this.isDisabled(o[s+1]),h=t+(!r&&this.showSeriesTotal()?` (${n})`:"");r||(e+=n);const a=this.textSize(h);return i<a.width&&(i=a.width),[l(void 0,t,!1),t,h]},this);break;default:t=this.columns().map(function(t){return[l(void 0,t,!1),t]},this)}break;case"rainbow":const r=this.getPalette(),h=u(this.rainbowFormat()),a=this.getWidget(),d=this.rainbowBins(),p=a._dataMinWeight,c=a._dataMaxWeight,g=(c-p)/(d-1);t.push([r(p,p,c),h(p)]);for(let e=1;e<d-1;++e){let i=g*e;Math.floor(i)>parseInt(t[0][1])&&(i=Math.floor(i)),t.push([r(i,p,c),h(i)])}t.push([r(c,p,c),h(c)])}}return{dataArr:t,total:e,maxLabelWidth:i}}update(t,e){super.update(t,e);const{dataArr:i,maxLabelWidth:s,total:o}=this.calcMetaData(),l=this.shapeRadius(),n=this.radiusToSymbolSize(l);let r=this.itemPadding();"horizontal"===this.orientation()&&(r+=s-2*l);const h=m().domain(i.map(t=>t[1])).range(i.map(t=>t[0]));this._legendOrdinal.shape("path",xt().type(this._symbolTypeMap[this.symbolType()]).size(n)()).orient(this.orientation()).title(this.title()).labelWrap(this.labelMaxWidth()).labelAlign(this.labelAlign()).shapePadding(r).scale(h).labels(t=>i[t.i][2]),this._g.call(this._legendOrdinal),this.updateDisabled(e,i);const a=this._g.select(".legendCells").node().getBBox();let d=Math.abs(a.x),p=Math.abs(a.y)+1;if("horizontal"===this.orientation()){if("start"===this.labelAlign()?d+=1:"end"===this.labelAlign()&&(d-=1),this.width()>a.width){d+=(this.width()-a.width)/2}}else if("vertical"===this.orientation()&&(d+=1,this._containerSize.height>a.height)){p+=(this.height()-a.height)/2}this._g.attr("transform",`translate(${d}, ${p})`),this.pos({x:0,y:0}),this._legendOrdinal.labelOffset(this.itemPadding());const c=this._g.selectAll(".legendTotal").data(i.length&&this.showLegendTotal()?[o]:[]),u=`Total: ${o}`,g=-d,f=a.height+this.itemPadding()+1;this.enableOverflowScroll(!1),this.enableOverflow(!0),c.enter().append("text").classed("legendTotal",!0).merge(c).attr("transform",`translate(${g}, ${f})`).text(u),c.exit().remove()}updateDisabled(t,e){t.style("cursor","pointer").selectAll("path.swatch").filter((t,i)=>i<e.length).style("stroke",(t,i)=>e[i][0]).style("fill",(t,i)=>this._disabled.indexOf(t)<0?e[i][0]:"white")}postUpdate(t,e){let i;this._boundingBox&&(i=this._boundingBox.width,this._boundingBox.width=this._size.width),super.postUpdate(t,e),void 0!==i&&(this._boundingBox.width=i),this._parentRelativeDiv.style("overflow","hidden")}exit(t,e){super.exit(t,e)}radiusToSymbolSize(t){const e=Math.pow(t,2)*Math.PI;switch(this.symbolType()){case"star":return.45*e;case"triangle":return.65*e;case"cross":case"diamond":case"wye":return.75*e;case"circle":return e;case"square":return 1.3*e}}onClick(t,e){if("ordinal"===this.getPaletteType())switch(this.dataFamily()){case"2D":case"ND":const e=this._disabled.indexOf(t);e<0?this._disabled.push(t):this._disabled.splice(e,1),this._owner.refreshColumns(),this._owner.refreshData(),this._owner.render()}}onOver(t,e){if(B(this._owner)&&"ordinal"===this.getPaletteType())switch(this.dataFamily()){case"2D":case"ND":this._disabled.indexOf(t)<0&&this._owner.highlightColumn(t)}}onOut(t,e){if(B(this._owner)&&"ordinal"===this.getPaletteType())switch(this.dataFamily()){case"2D":case"ND":this._owner.highlightColumn()}}onDblClick(t,e){}onMouseOver(t,e){}_containerSize;resize(t){let e;if(this.fitToContent()){this._containerSize=t;const i=this.getBBox();t.width>i.width&&(i.width=t.width),t.height>i.height&&(i.height=t.height),e=super.resize.apply(this,[{...i}])}else e=super.resize.apply(this,arguments);return e}};e(Ot,"Legend");let Lt=Ot;Lt.prototype._class+=" layout_Legend",Lt.prototype.publish("title","","string","Title"),Lt.prototype.publish("symbolType","circle","set","Shape of each legend item",["circle","cross","diamond","square","star","triangle","wye"]),Lt.prototype.publish("labelMaxWidth",null,"number","Max Label Width (pixels)",null,{optional:!0}),Lt.prototype.publish("orientation","vertical","set","Orientation of Legend rows",["vertical","horizontal"],{tags:["Private"]}),Lt.prototype.publish("dataFamily","ND","set","Type of data",["1D","2D","ND","map","graph","any"],{tags:["Private"]}),Lt.prototype.publish("rainbowFormat",",","string","Rainbow number formatting",null,{tags:["Private"],optional:!0,disable:/* @__PURE__ */e(t=>!t.isRainbow(),"disable")}),Lt.prototype.publish("rainbowBins",8,"number","Number of rainbow bins",null,{tags:["Private"],disable:/* @__PURE__ */e(t=>!t.isRainbow(),"disable")}),Lt.prototype.publish("showSeriesTotal",!1,"boolean","Show value next to series"),Lt.prototype.publish("showLegendTotal",!1,"boolean","Show a total of the series values under the legend",null),Lt.prototype.publish("itemPadding",8,"number","Padding between legend items (pixels)"),Lt.prototype.publish("shapeRadius",7,"number","Radius of legend shape (pixels)"),Lt.prototype.publish("fitToContent",!0,"boolean","If true, resize will simply reapply the bounding box dimensions"),Lt.prototype.publish("labelAlign","start","set","Horizontal alignment of legend item label (for horizontal orientation only)",["start","middle","end"],{optional:!0,disable:/* @__PURE__ */e(t=>"vertical"===t.orientation(),"disable")});const Dt=class _Modal extends i{_widget;_relativeTarget;_fade;_modal;_modalHeader;_modalBody;_modalHeaderAnnotations;_modalHeaderCloseButton;_close;constructor(){super(),this._tag="div"}closeModal(){this.visible(!1)}getRelativeTarget(){let t;return this.relativeTargetId()&&(t=document.getElementById(this.relativeTargetId()),t)?t:!t&&(t=this.locateAncestor("layout_Grid"),t&&t.element)?t.element().node():document.body}setModalSize(){null!==this.fixedHeight()&&null!==this.fixedWidth()?this._modal.style("height",this.fixedHeight()).style("width",this.fixedWidth()).style("min-height",null).style("min-width",null).style("max-height",null).style("max-width",null):(this.minHeight()||this.minWidth())&&this._modal.style("min-height",this.minHeight()).style("min-width",this.minWidth()).style("max-height",this.maxHeight()).style("max-width",this.maxWidth());const t=this._modal.node().getBoundingClientRect(),e=this._modalHeader.node().getBoundingClientRect();return this._modalBody.style("height",t.height-e.height+"px").style("width",t.width),t}setFadePosition(t){this._fade.style("top",t.top+"px").style("left",t.left+"px").style("width",t.width+"px").style("height",t.height+"px")}setModalPosition(t){const e=this.setModalSize();if(null!==this.fixedTop()&&null!==this.fixedLeft())this._modal.style("top",`calc(${this.fixedTop()} + ${t.top}px)`).style("left",`calc(${this.fixedLeft()} + ${t.left}px)`);else if(null!==this.fixedHeight()&&null!==this.fixedWidth())this._modal.style("top",t.top+t.height/2-e.height/2+"px").style("left",t.left+t.width/2-e.width/2+"px");else if(this.minHeight()||this.minWidth()){const e=this._modal.node().getBoundingClientRect();this._modal.style("top",t.top+t.height/2-e.height/2+"px").style("left",t.left+t.width/2-e.width/2+"px")}}resize(t){return super.resize(),this._modal&&this.setModalSize(),this}resizeBodySync(t,e){const i=this._modalHeader.node().getBoundingClientRect();return this._modal.style("width",t+"px").style("height",e+i.height+"px").style("min-width",t+"px").style("min-height",e+i.height+"px"),this._modalHeader.style("width",t+"px"),this._modalBody.style("width",t+"px").style("height",e+"px"),this.minWidth(t+"px").minHeight(e+i.height+"px").resize({height:e+i.height,width:t})}enter(t,e){super.enter(t,e),this._fade=e.append("div").classed("layout_Modal-fade",!0).classed("layout_Modal-fadeClickable",this.enableClickFadeToClose()).classed("layout_Modal-fade-hidden",!this.showFade());const i=2*this.titleFontSize();this._modal=e.append("div").classed("layout_Modal-content",!0),this._modalHeader=this._modal.append("div").classed("layout_Modal-header",!0).style("color",this.titleFontColor()).style("font-size",this.titleFontSize()+"px").style("height",i+"px"),this._modalBody=this._modal.append("div").classed("layout_Modal-body",!0).style("height",`calc( 100% - ${i}px )`).style("overflow-x",this.overflowX()).style("overflow-y",this.overflowY()),this._modalHeader.append("div").classed("layout_Modal-title",!0).style("line-height",this.titleFontSize()+"px").style("top",this.titleFontSize()/2+"px").style("left",this.titleFontSize()/2+"px").text(this.formattedTitle()),this._modalHeaderAnnotations=this._modalHeader.append("div").classed("layout_Modal-annotations",!0),this._modalHeaderCloseButton=this._modalHeaderAnnotations.append("div").classed("layout_Modal-closeButton",!0).html('<i class="fa fa-close"></i>'),this._modalHeaderAnnotations.style("line-height",this.titleFontSize()+"px").style("right",this.titleFontSize()/2+"px").style("top",this.titleFontSize()/2+"px"),this._modalHeaderCloseButton.on("click",()=>{this.closeModal()}),this._fade.on("click",t=>{this.enableClickFadeToClose()&&this.closeModal()})}update(t,e){super.update(t,e),e.style("display",this.show()?null:"none"),this._fade.classed("layout_Modal-fade-hidden",!this.showFade()),this._relativeTarget=this.getRelativeTarget(),this.setModalSize();const i=this._relativeTarget.getBoundingClientRect();this.setFadePosition(i),this.setModalPosition(i),this.show()?(this._widget.target()||this._widget.target(this._modalBody.node()),this._widget.resize().render()):this._widget.target(null).render()}exit(t,e){this._widget&&this._widget.target(null),super.exit(t,e)}formattedTitle(){const t=this.title_exists()?this.title().trim():"";return t.length>0&&"("===t.slice(0,1)&&")"===t.slice(-1)?t.slice(1,-1):this.title()}};e(Dt,"Modal");let Rt=Dt;Rt.prototype._class+=" layout_Modal",Rt.prototype.publish("title",null,"string","title"),Rt.prototype.publish("widget",null,"widget","widget"),Rt.prototype.publish("titleFontSize",18,"number","titleFontSize (in pixels)"),Rt.prototype.publish("titleFontColor","#ffffff","html-color","titleFontColor"),Rt.prototype.publish("relativeTargetId",null,"string","relativeTargetId"),Rt.prototype.publish("show",!0,"boolean","show"),Rt.prototype.publish("showFade",!0,"boolean","showFade"),Rt.prototype.publish("enableClickFadeToClose",!0,"boolean","enableClickFadeToClose"),Rt.prototype.publish("minWidth","400px","string","minWidth"),Rt.prototype.publish("minHeight","400px","string","minHeight"),Rt.prototype.publish("maxWidth","800px","string","maxWidth"),Rt.prototype.publish("maxHeight","800px","string","maxHeight"),Rt.prototype.publish("fixedWidth",null,"string","fixedWidth"),Rt.prototype.publish("fixedHeight",null,"string","fixedHeight"),Rt.prototype.publish("fixedTop",null,"string","fixedTop"),Rt.prototype.publish("fixedLeft",null,"string","fixedLeft"),Rt.prototype.publish("overflowX","hidden","string","overflowX"),Rt.prototype.publish("overflowY","scroll","string","overflowY");const Gt=class _ChartPanel extends U{_legend=new Lt(this).enableOverflow(!0);_progressBar=new v;_autoScale=!1;_resolutions={tiny:{width:100,height:100},small:{width:300,height:300}};_modal=new Rt;_highlight;_scale;_orig_size;_toggleInfo=(new x).faChar("fa-info-circle").tooltip(".Description").selected(!1).on("enabled",()=>""!==this.description()).on("click",()=>{if(this._toggleInfo.selected()){this._modal.title(this.title()).widget((new S).text(this.description())).show(!0).render();const t=this._modal._close;this._modal._close=()=>{this._toggleInfo.selected(!1).render(),this._modal._close=t}}}).on("mouseMove",()=>{}).on("mouseOut",()=>{});_toggleData=(new x).faChar("fa-table").tooltip("Data").on("click",()=>{this.dataVisible(this._toggleData.selected()),this.render()});_buttonDownload=(new C).faChar("fa-download").tooltip("Download").on("click",()=>{this.downloadCSV()});_buttonDownloadImage=(new C).faChar("fa-image").tooltip("Download Image").on("click",()=>{this.downloadPNG()});_toggleLegend=(new x).faChar("fa-list-ul").tooltip("Legend").selected(!1).on("click",()=>{const t=this._toggleLegend.selected();"bottom"===this.legendPosition()?this.showBottom(t):"right"===this.legendPosition()&&this.showRight(t),this.legendVisible(t),this.render()});_spacer=new P;_titleBar=(new T).buttons([this._toggleData,this._buttonDownload,this._buttonDownloadImage,this._spacer,this._toggleLegend]);_carousel=new q;_table=new W;_widget;_hideLegendToggleList=["dgrid_Table"];constructor(){super(),this._tag="div"}fields(t){return arguments.length?(super.fields(t),this._legend.fields(t),this.refreshFields(),this):super.fields()}refreshFields(){return this._widget.fields(this._legend.filteredFields()),this._table.fields(this._legend.filteredFields()),this}columns(t,e){return arguments.length?(super.columns(t,e),this._legend.columns(t,e),this.refreshColumns(),this):super.columns()}refreshColumns(){return this._widget.columns(this._legend.filteredColumns()),this._table.columns(this._legend.filteredColumns()),this}data(t){return arguments.length?(super.data(t),this._legend.data(t),this.refreshData(),this):super.data()}refreshData(){return this._widget.data(this._legend.filteredData()),this._table.data(this._legend.filteredData()),this}highlight(t){return arguments.length?(this._highlight=t,this):this._highlight}startProgress(){this._progressBar.start()}finishProgress(){this._progressBar.finish()}buttons(t){return arguments.length?(this._titleBar.buttons(t),this):this._titleBar.buttons()}downloadCSV(){const t=this.downloadTitle()?this.downloadTitle():this.title()?this.title():"data",e=this.downloadTimestampSuffix()?"_"+n.timestamp():"";return n.downloadString("CSV",this._widget.export("CSV"),t+e),this}downloadPNG(){const t=this.widget();return t instanceof y&&(this.legendVisible()?t.downloadPNG(this.title(),void 0,this._legend):t.downloadPNG(this.title())),this}highlightColumn(t){if(t){const e=`series-${this.cssTag(t)}`;this._centerWA.element().selectAll(".series").each(function(){const t=o(this),i=t.classed(e);t.classed("highlight",i).classed("lowlight",!i)})}else this._centerWA.element().selectAll(".series").classed("highlight",!1).classed("lowlight",!1);return this}getResponsiveMode(){return this.enableAutoscaling()?this._autoScale?this.size().width<=this._resolutions.tiny.width||this.size().height<=this._resolutions.tiny.height?"tiny":this.size().width<=this._resolutions.small.width||this.size().height<=this._resolutions.small.height?"small":"regular":"regular":"none"}setOrigSize(){this._orig_size=JSON.parse(JSON.stringify(this.size()))}enter(t,e){super.enter(t,e),this._modal.target(this.target()).relativeTargetId(this.id()),this.top(this._titleBar),this.center(this._carousel),this._legend.targetWidget(this._widget).orientation("vertical").title("").visible(!1),this._progressBar.enter(t,e),this.setOrigSize()}preUpdateTiny(t){t.selectAll("div.body,div.title-text,div.icon-bar").style("display","none")}preUpdateSmall(t){const e=this._orig_size.width/this._resolutions.small.width,i=this._orig_size.height/this._resolutions.small.height;this._scale=Math.min(e,i);const s=this._scale===e;this.size({width:s?this._resolutions.small.width:this._orig_size.width*(1/this._scale),height:s?this._orig_size.height*(1/this._scale):this._resolutions.small.height}),t.select("div.title-icon").style("position","static"),t.selectAll("lhs").style("display","none"),t.selectAll("div.body,div.title-text,div.icon-bar").style("display",""),t.selectAll("div.data-count").style("visibility","hidden"),t.style("transform",`scale(${this._scale})`)}preUpdateRegular(t){t.selectAll("div.body,div.title-text,div.icon-bar").style("display",""),t.selectAll("div.data-count").style("visibility","hidden"),t.select("div.title-icon").style("position","static"),t.style("transform","translate(0px,0px) scale(1)")}_prevdataVisible;_prevlegendVisible;_prevLegendPosition;_prevChartDataFamily;_prevChart;_prevButtons;update(t,e){super.update(t,e)}preUpdate(t,e){switch(super.preUpdate(t,e),this._prevLegendPosition!==this.legendPosition()&&(null!==this._legend.target()&&this._legend.target(null),void 0!==this._prevLegendPosition?this.swap(this._prevLegendPosition,this.legendPosition()):this[this.legendPosition()](this._legend),"right"===this.legendPosition()?(this.rightOverflowX("hidden"),this.rightOverflowY("auto"),this.bottomOverflowX("visible"),this.bottomOverflowY("visible")):(this.rightOverflowX("visible"),this.rightOverflowY("visible"),this.bottomOverflowX("auto"),this.bottomOverflowY("hidden")),this._prevLegendPosition=this.legendPosition()),this._prevdataVisible!==this.dataVisible()&&(this._prevdataVisible=this.dataVisible(),this._toggleData.selected(this._prevdataVisible),this._legend.visible(this._prevlegendVisible&&!this._prevdataVisible),this._carousel.active(this._prevdataVisible?1:0)),this._prevlegendVisible!==this.legendVisible()&&(this._prevlegendVisible=this.legendVisible(),this._toggleLegend.selected(this._prevlegendVisible),this._legend.visible(this._prevlegendVisible&&!this._prevdataVisible)),this._legend.orientation("bottom"===this.legendPosition()?"horizontal":"vertical"),this.showLeft(!this.left()),this.getResponsiveMode()){case"tiny":this.preUpdateTiny(e);break;case"small":this.preUpdateSmall(e);break;case"regular":this.preUpdateRegular(e)}const i="composite_MultiChart"===this._widget.classID()?this._widget.chart():this._widget;if(this._legend.dataFamily(i._dataFamily||"any"),this._prevChartDataFamily!==this._legend.dataFamily()&&(this._prevChartDataFamily=this._legend.dataFamily(),"any"===this._prevChartDataFamily))this._toggleLegend.selected(!1),this._legend.visible(!1);if(e.style("box-shadow",this.highlight()?`inset 0px 0px 0px ${this.highlightSize()}px ${this.highlightColor()}`:"none"),-1!==this._hideLegendToggleList.indexOf(i.classID())?(this._spacer.visible(!1),this._toggleLegend.visible(!1)):(this._spacer.visible(!0),this._toggleLegend.visible(!0)),this._prevChart!==i){this._prevChart=i;const t=i?i._titleBar||i._iconBar:void 0;if(t&&t instanceof z){this._prevButtons=this._prevButtons||[...this.buttons()];const e=[...t.buttons(),new P,...this._prevButtons];t.buttons([]).render(),this.buttons(e)}else this._prevButtons&&this.buttons(this._prevButtons)}const s=[];this.dataButtonVisible()||s.push(this._toggleData),this.downloadButtonVisible()||s.push(this._buttonDownload),this.downloadImageButtonVisible()||s.push(this._buttonDownloadImage),this.legendButtonVisible()||s.push(this._toggleLegend),this._buttonDownloadImage.enabled(this.widget()instanceof y),this._titleBar.hiddenButtons(s).visible(this.titleVisible()),this.topOverlay(this.titleOverlay()||!this.titleVisible())}postUpdate(t,e){switch(super.postUpdate(t,e),this.getResponsiveMode()){case"tiny":this.postUpdateTiny(e);break;case"small":this.postUpdateSmall(e);break;case"regular":this.postUpdateRegular(e)}}postUpdateTiny(t){t.selectAll("div.body,div.title-text,div.icon-bar").style("display","none"),t.selectAll("div.data-count").style("visibility","visible").style("font-size",this.titleIconFontSize()/3+"px").style("line-height",this.titleIconFontSize()/3+"px").style("left",this.titleIconFontSize()+"px").text(this.data().length),t.style("transform","translate(0px,0px) scale(1)");const e=t.selectAll("div.title-icon"),i=e.node(),s=t.node().parentElement.getBoundingClientRect();if(i){const i=e.node().getBoundingClientRect(),o=s.height/2;e.style("position","absolute").style("left",`calc(50% - ${i.width/2}px)`).style("top",o-i.height/2+"px"),t.selectAll("div.data-count").style("position","absolute").style("left",`calc(50% + ${i.width/2}px)`).style("top",o-i.height/2+"px")}}postUpdateSmall(t){t.selectAll("lhs").style("display","none"),t.selectAll("div.title-icon").style("position","static"),t.selectAll("div.body,div.title-text,div.icon-bar").style("display",""),t.selectAll("div.data-count").style("visibility","hidden");const e=t.node().getBoundingClientRect(),i=t.node().parentElement.getBoundingClientRect();t.style("transform",`translate(${i.x-e.x}px, ${i.y-e.y}px) scale(${this._scale})`)}postUpdateRegular(t){t.selectAll("div.title-icon").style("position","static"),t.selectAll("div.body,div.title-text,div.icon-bar").style("display",""),t.selectAll("div.data-count").style("visibility","hidden")}exit(t,e){this._progressBar.exit(t,e),this.right(null),this._legend.target(null),this.center(null),this._carousel.target(null),this.top(null),this._titleBar.target(null),this._modal.target(null),delete this._prevChart,delete this._prevButtons,delete this._prevChartDataFamily,delete this._prevPos,delete this._prevdataVisible,delete this._prevlegendVisible,super.exit(t,e)}click(t,e,i){}dblclick(t,e,i){}vertex_click(t,e,i,s){s&&s.vertex}vertex_dblclick(t,e,i,s){s&&s.vertex}edge_click(t,e,i,s){s&&s.edge}edge_dblclick(t,e,i,s){s&&s.edge}};e(Gt,"ChartPanel");let Et=Gt;Et.prototype._class+=" layout_ChartPanel",Et.prototype.publishReset(),Et.prototype.publishProxy("title","_titleBar"),Et.prototype.publish("titleVisible",!0,"boolean"),Et.prototype.publish("titleOverlay",!1,"boolean"),Et.prototype.publishProxy("titleIcon","_titleBar"),Et.prototype.publishProxy("titleIconFont","_titleBar"),Et.prototype.publishProxy("titleFont","_titleBar"),Et.prototype.publishProxy("titleIconFontSize","_titleBar"),Et.prototype.publishProxy("titleFontSize","_titleBar"),Et.prototype.publishProxy("description","_titleBar"),Et.prototype.publishProxy("descriptionFont","_titleBar"),Et.prototype.publishProxy("descriptionFontSize","_titleBar"),Et.prototype.publish("dataVisible",!1,"boolean","Show data table"),Et.prototype.publish("dataButtonVisible",!0,"boolean","Show data table button"),Et.prototype.publish("downloadButtonVisible",!0,"boolean","Show data download button"),Et.prototype.publish("downloadImageButtonVisible",!1,"boolean","Show image download button"),Et.prototype.publish("downloadTitle","","string","File name when downloaded"),Et.prototype.publish("downloadTimestampSuffix",!0,"boolean","Use timestamp as file name suffix"),Et.prototype.publish("legendVisible",!1,"boolean","Show legend"),Et.prototype.publish("legendButtonVisible",!0,"boolean","Show legend button"),Et.prototype.publish("legendPosition","right","set","Position of legend",["right","bottom"]),Et.prototype.publishProxy("legend_labelMaxWidth","_legend","labelMaxWidth"),Et.prototype.publishProxy("legend_showSeriesTotal","_legend","showSeriesTotal"),Et.prototype.publishProxy("legend_showLegendTotal","_legend","showLegendTotal"),Et.prototype.publishProxy("legend_itemPadding","_legend","itemPadding"),Et.prototype.publishProxy("legend_shapeRadius","_legend","shapeRadius"),Et.prototype.publishProxy("legend_symbolType","_legend","symbolType"),Et.prototype.publishProxy("legend_labelAlign","_legend","labelAlign"),Et.prototype.publish("widget",null,"widget","Widget",void 0,{render:!1}),Et.prototype.publish("enableAutoscaling",!1,"boolean"),Et.prototype.publish("highlightSize",4,"number"),Et.prototype.publish("highlightColor","#e67e22","html-color"),Et.prototype.publishProxy("progress_halfLife","_progressBar","halfLife"),Et.prototype.publishProxy("progress_decay","_progressBar","decay"),Et.prototype.publishProxy("progress_size","_progressBar","size"),Et.prototype.publishProxy("progress_color","_progressBar","color"),Et.prototype.publishProxy("progress_blurBar","_progressBar","blurBar"),Et.prototype.publishProxy("progress_blurSize","_progressBar","blurSize"),Et.prototype.publishProxy("progress_blurColor","_progressBar","blurColor"),Et.prototype.publishProxy("progress_blurOpacity","_progressBar","blurOpacity"),Et.prototype.widget=function(t){if(!arguments.length)return this._widget;this._carousel.widgets([t,this._table]),this._widget=t,this._widget.fields(this._legend.filteredFields()).data(this._legend.filteredData());const e=this,i=this._widget;return i.click=function(){e.click.apply(e,arguments)},i.dblclick=function(){e.dblclick.apply(e,arguments)},i.vertex_click=function(){e.vertex_click.apply(e,arguments)},i.vertex_dblclick=function(){e.vertex_dblclick.apply(e,arguments)},i.edge_click=function(){e.edge_click.apply(e,arguments)},i.edge_dblclick=function(){e.edge_dblclick.apply(e,arguments)},this};const Xt=class _FlexGrid extends i{constructor(){super()}enter(t,e){super.enter(t,e),o(t.parentNode).style("height","100%").style("width","100%")}update(t,e){super.update(t,e);const i=this,s=[];this.updateFlexParent(e);const o=e.selectAll(".FlexGrid-list-item").data(this.widgets(),t=>t.id());o.enter().append("div").classed("FlexGrid-list-item",!0).each(function(t){t.target(this)}).merge(o).style("min-height",this.itemMinHeight()+"px").style("min-width",this.itemMinWidth()+"px").style("flex-basis",(t,e)=>{const i=this.widgetsFlexBasis()[e];return void 0!==i?i:this.flexBasis()}).style("flex-grow",(t,e)=>{const i=this.widgetsFlexGrow()[e];return void 0!==i?i:this.flexGrow()}).style("border-width",this.borderWidth()+"px").style("border-color",this.itemBorderColor()).each(function(){this.firstChild.style.display="none"}).each(function(){const t=this.getBoundingClientRect();s.push([t.width,t.height])}).each(function(t,e){this.firstChild.style.display="block",t.resize({width:s[e][0]-2*i.borderWidth(),height:s[e][1]-2*i.borderWidth()})}),o.exit().remove()}exit(t,e){super.exit(t,e)}updateFlexParent(t){t.style("height","100%").style("flex-direction","horizontal"===this.orientation()?"row":"column").style("flex-wrap",this.flexWrap()).style("align-items",this.alignItems()).style("align-content",this.alignContent()).style("overflow-x",()=>this.forceXScroll()||"horizontal"===this.orientation()&&"nowrap"===this.flexWrap()&&!this.disableScroll()?"scroll":"hidden").style("overflow-y",()=>this.forceYScroll()||"vertical"===this.orientation()&&"nowrap"===this.flexWrap()&&!this.disableScroll()?"scroll":"hidden")}};e(Xt,"FlexGrid");let Yt=Xt;function Vt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}Yt.prototype._class+=" layout_FlexGrid",Yt.prototype.publish("itemBorderColor","transparent","html-color","Color of list item borders"),Yt.prototype.publish("borderWidth",0,"number","Width of list item borders (pixels)"),Yt.prototype.publish("orientation","horizontal","set","Controls the flex-direction of the list items",["horizontal","vertical"]),Yt.prototype.publish("flexWrap","wrap","set","Controls the line wrap when overflow occurs",["nowrap","wrap","wrap-reverse"]),Yt.prototype.publish("disableScroll",!1,"boolean","If false, scrollbar will show (when flexWrap is set to 'nowrap')",null,{disable:/* @__PURE__ */e(t=>"nowrap"!==t.flexWrap(),"disable")}),Yt.prototype.publish("forceXScroll",!1,"boolean","If true, horzontal scrollbar will show"),Yt.prototype.publish("forceYScroll",!1,"boolean","If true, vertical scrollbar will show"),Yt.prototype.publish("itemMinHeight",64,"number","Minimum height of a list item (pixels)"),Yt.prototype.publish("itemMinWidth",64,"number","Minimum width of a list item (pixels)"),Yt.prototype.publish("alignItems","stretch","set","Controls normal alignment of items",["flex-start","center","flex-end","stretch"]),Yt.prototype.publish("alignContent","stretch","set","Controls normal alignment of item rows",["flex-start","center","flex-end","stretch","space-between","space-around"]),Yt.prototype.publish("flexGrow",1,"number","Default flex-grow style for all list items"),Yt.prototype.publish("flexBasis","10%","string","Default flex-basis style for all list items"),Yt.prototype.publish("widgetsFlexGrow",[],"array","Array of flex-grow values keyed on the widgets array"),Yt.prototype.publish("widgetsFlexBasis",[],"array","Array of flex-basis values keyed on the widgets array"),Yt.prototype.publish("widgets",[],"widgetArray","Array of widgets to be rendered as list items"),e(Vt,"getDefaultExportFromCjs");var Nt,$t={exports:{}};function Ut(){return Nt?$t.exports:(Nt=1,$t.exports=function(){var t=/* @__PURE__ */e(function(t,e){for(var i in this._options=e,this.defaults)this._options.hasOwnProperty(i)||(this._options[i]=this.defaults[i]);this.items=t,this._adjustSizeOfItems(),this.generateGrid()},"GridList");t.cloneItems=function(t,e){var i,s;for(void 0===e&&(e=[]),i=0;i<t.length;i++)for(s in e[i]||(e[i]={}),t[i])e[i][s]=t[i][s];return e},t.prototype={defaults:{lanes:5,direction:"horizontal"},toString:/* @__PURE__ */e(function(){var t,e,i,s=this.grid.length,o="\n #|",l="\n --";for(e=0;e<s;e++)o+=" "+this._padNumber(e," "),l+="---";for(o+=l,e=0;e<this._options.lanes;e++)for(o+="\n"+this._padNumber(e," ")+"|",i=0;i<s;i++)o+=" ",o+=(t=this.grid[i][e])?this._padNumber(this.items.indexOf(t),"0"):"--";return o+="\n"},"toString"),generateGrid:/* @__PURE__ */e(function(){var t;for(this._resetGrid(),t=0;t<this.items.length;t++)this._markItemPositionToGrid(this.items[t])},"generateGrid"),resizeGrid:/* @__PURE__ */e(function(t){var e=0;this._options.lanes=t,this._adjustSizeOfItems(),this._sortItemsByPosition(),this._resetGrid();for(var i=0;i<this.items.length;i++){var s=this.items[i],o=this._getItemPosition(s);this._updateItemPosition(s,this.findPositionForItem(s,{x:e,y:0})),e=Math.max(e,o.x)}this._pullItemsToLeft()},"resizeGrid"),findPositionForItem:/* @__PURE__ */e(function(t,e,i){var s,o,l;for(s=e.x;s<this.grid.length;s++)if(void 0!==i){if(l=[s,i],this._itemFitsAtPosition(t,l))return l}else for(o=e.y;o<this._options.lanes;o++)if(l=[s,o],this._itemFitsAtPosition(t,l))return l;var n=this.grid.length,r=0;return void 0!==i&&this._itemFitsAtPosition(t,[n,i])&&(r=i),[n,r]},"findPositionForItem"),moveItemToPosition:/* @__PURE__ */e(function(t,e){var i=this._getItemPosition({x:e[0],y:e[1],w:t.w,h:t.h});this._updateItemPosition(t,[i.x,i.y]),this._resolveCollisions(t)},"moveItemToPosition"),resizeItem:/* @__PURE__ */e(function(t,e){var i=e.w||t.w,s=e.h||t.h;this._updateItemSize(t,i,s),this._resolveCollisions(t),this._pullItemsToLeft()},"resizeItem"),getChangedItems:/* @__PURE__ */e(function(t,e){for(var i=[],s=0;s<t.length;s++){var o=this._getItemByAttribute(e,t[s][e]);o.x===t[s].x&&o.y===t[s].y&&o.w===t[s].w&&o.h===t[s].h||i.push(o)}return i},"getChangedItems"),_sortItemsByPosition:/* @__PURE__ */e(function(){this.items.sort(function(t,e){var i=this._getItemPosition(t),s=this._getItemPosition(e);return i.x!=s.x?i.x-s.x:i.y!=s.y?i.y-s.y:0}.bind(this))},"_sortItemsByPosition"),_adjustSizeOfItems:/* @__PURE__ */e(function(){for(var t=0;t<this.items.length;t++){var e=this.items[t];void 0===e.autoSize&&(e.autoSize=0===e.w||0===e.h),e.autoSize&&("horizontal"===this._options.direction?e.h=this._options.lanes:e.w=this._options.lanes)}},"_adjustSizeOfItems"),_resetGrid:/* @__PURE__ */e(function(){this.grid=[]},"_resetGrid"),_itemFitsAtPosition:/* @__PURE__ */e(function(t,e){var i,s,o=this._getItemPosition(t);if(e[0]<0||e[1]<0)return!1;if(e[1]+o.h>this._options.lanes)return!1;for(i=e[0];i<e[0]+o.w;i++){var l=this.grid[i];if(l)for(s=e[1];s<e[1]+o.h;s++)if(l[s]&&l[s]!==t)return!1}return!0},"_itemFitsAtPosition"),_updateItemPosition:/* @__PURE__ */e(function(t,e){null!==t.x&&null!==t.y&&this._deleteItemPositionFromGrid(t),this._setItemPosition(t,e),this._markItemPositionToGrid(t)},"_updateItemPosition"),_updateItemSize:/* @__PURE__ */e(function(t,e,i){null!==t.x&&null!==t.y&&this._deleteItemPositionFromGrid(t),t.w=e,t.h=i,this._markItemPositionToGrid(t)},"_updateItemSize"),_markItemPositionToGrid:/* @__PURE__ */e(function(t){var e,i,s=this._getItemPosition(t);for(this._ensureColumns(s.x+s.w),e=s.x;e<s.x+s.w;e++)for(i=s.y;i<s.y+s.h;i++)this.grid[e][i]=t},"_markItemPositionToGrid"),_deleteItemPositionFromGrid:/* @__PURE__ */e(function(t){var e,i,s=this._getItemPosition(t);for(e=s.x;e<s.x+s.w;e++)if(this.grid[e])for(i=s.y;i<s.y+s.h;i++)this.grid[e][i]==t&&(this.grid[e][i]=null)},"_deleteItemPositionFromGrid"),_ensureColumns:/* @__PURE__ */e(function(t){var e;for(e=0;e<t;e++)this.grid[e]||this.grid.push(new i(this._options.lanes))},"_ensureColumns"),_getItemsCollidingWithItem:/* @__PURE__ */e(function(t){for(var e=[],i=0;i<this.items.length;i++)t!=this.items[i]&&this._itemsAreColliding(t,this.items[i])&&e.push(i);return e},"_getItemsCollidingWithItem"),_itemsAreColliding:/* @__PURE__ */e(function(t,e){var i=this._getItemPosition(t),s=this._getItemPosition(e);return!(s.x>=i.x+i.w||s.x+s.w<=i.x||s.y>=i.y+i.h||s.y+s.h<=i.y)},"_itemsAreColliding"),_resolveCollisions:/* @__PURE__ */e(function(t){this._tryToResolveCollisionsLocally(t)||this._pullItemsToLeft(t),this._pullItemsToLeft()},"_resolveCollisions"),_tryToResolveCollisionsLocally:/* @__PURE__ */e(function(e){var i=this._getItemsCollidingWithItem(e);if(!i.length)return!0;var s,o,l,n,r=new t([],this._options);t.cloneItems(this.items,r.items),r.generateGrid();for(var h=0;h<i.length;h++){var a=r.items[i[h]],d=this._getItemPosition(a),p=this._getItemPosition(e);if(s=[p.x-d.w,d.y],o=[p.x+p.w,d.y],l=[d.x,p.y-d.h],n=[d.x,p.y+p.h],r._itemFitsAtPosition(a,s))r._updateItemPosition(a,s);else if(r._itemFitsAtPosition(a,l))r._updateItemPosition(a,l);else if(r._itemFitsAtPosition(a,n))r._updateItemPosition(a,n);else{if(!r._itemFitsAtPosition(a,o))return!1;r._updateItemPosition(a,o)}}return t.cloneItems(r.items,this.items),this.generateGrid(),!0},"_tryToResolveCollisionsLocally"),_pullItemsToLeft:/* @__PURE__ */e(function(t){if(this._sortItemsByPosition(),this._resetGrid(),t){var e=this._getItemPosition(t);this._updateItemPosition(t,[e.x,e.y])}for(var i=0;i<this.items.length;i++){var s=this.items[i],o=this._getItemPosition(s);if(!t||s!=t){var l=this._findLeftMostPositionForItem(s),n=this.findPositionForItem(s,{x:l,y:0},o.y);this._updateItemPosition(s,n)}}},"_pullItemsToLeft"),_findLeftMostPositionForItem:/* @__PURE__ */e(function(t){for(var e=0,i=this._getItemPosition(t),s=0;s<this.grid.length;s++)for(var o=i.y;o<i.y+i.h;o++){var l=this.grid[s][o];if(l){var n=this._getItemPosition(l);this.items.indexOf(l)<this.items.indexOf(t)&&(e=n.x+n.w)}}return e},"_findLeftMostPositionForItem"),_getItemByAttribute:/* @__PURE__ */e(function(t,e){for(var i=0;i<this.items.length;i++)if(this.items[i][t]===e)return this.items[i];return null},"_getItemByAttribute"),_padNumber:/* @__PURE__ */e(function(t,e){return t>=10?t:e+t},"_padNumber"),_getItemPosition:/* @__PURE__ */e(function(t){return"horizontal"===this._options.direction?t:{x:t.y,y:t.x,w:t.h,h:t.w}},"_getItemPosition"),_setItemPosition:/* @__PURE__ */e(function(t,e){"horizontal"===this._options.direction?(t.x=e[0],t.y=e[1]):(t.x=e[1],t.y=e[0])},"_setItemPosition")};var i=/* @__PURE__ */e(function(t){for(var e=0;e<t;e++)this.push(null)},"GridCol");return i.prototype=[],t}())}e(Ut,"requireGridList");var jt=Ut();const qt=/* @__PURE__ */Vt(jt),Jt=/* @__PURE__ */I({__proto__:null,default:qt},[jt]),Zt=Jt&&qt||Jt,Kt=class _Grid extends i{divItems;gridList;items;itemsMap;origItems;cellWidth;cellHeight;dragItem;dragItemPos;_d3Drag;_d3DragResize;_selectionBag;_scrollBarWidth;constructor(){super(),this._tag="div",this._selectionBag=new n.Selection(this),this.content([])}getDimensions(){const t={width:0,height:0};return this.content().forEach(function(e){t.width<e.gridCol()+e.gridColSpan()&&(t.width=e.gridCol()+e.gridColSpan()),t.height<e.gridRow()+e.gridRowSpan()&&(t.height=e.gridRow()+e.gridRowSpan())},this),t}clearContent(t){this.content(this.content().filter(function(e){if(!t)return e.target(null),!1;let i=e;for(;i;){if(t===i)return e.target(null),!1;i=i.widget?i.widget():null}return!0}))}setContent(t,e,i,s,o,l){if(o=o||1,l=l||1,s=s||"",this.content(this.content().filter(function(i){return i.gridRow()!==t||i.gridCol()!==e||(i.target(null),!1)})),i){const n=(new E).gridRow(t).gridCol(e).widget(i).title(s).gridRowSpan(o).gridColSpan(l);this.content().push(n)}return this}sortedContent(){return this.content().sort(function(t,e){return t.gridRow()===e.gridRow()?t.gridCol()-e.gridCol():t.gridRow()-e.gridRow()})}getCell(t,e){let i=null;return this.content().some(function(s){return t>=s.gridRow()&&t<s.gridRow()+s.gridRowSpan()&&e>=s.gridCol()&&e<s.gridCol()+s.gridColSpan()&&(i=s,!0)}),i}getWidgetCell(t){let e=null;return this.content().some(function(i){return i.widget().id()===t&&(e=i,!0)}),e}getContent(t){let e=null;return this.content().some(function(i){return i.widget().id()===t&&(e=i.widget(),!0)}),e}cellToGridItem(t){return{x:t.gridCol(),y:t.gridRow(),w:t.gridColSpan(),h:t.gridRowSpan(),id:t.id(),cell:t}}gridItemToCell(t){t.cell.gridCol(t.x).gridRow(t.y).gridColSpan(t.w).gridRowSpan(t.h)}resetItemsPos(){this.origItems.forEach(function(t){const e=this.itemsMap[t.id];e.x=t.x,e.y=t.y},this)}initGridList(){this.itemsMap={},this.items=this.content().map(function(t){const e=this.cellToGridItem(t);return this.itemsMap[e.id]=e,e},this),this.origItems=this.content().map(this.cellToGridItem),this.gridList=new Zt(this.items,{direction:this.snapping(),lanes:"horizontal"===this.snapping()?this.snappingRows():this.snappingColumns()})}killGridList(){this.gridList=null,delete this.items,delete this.itemsMap}enter(t,e){super.enter(t,e),this._scrollBarWidth=h.getScrollbarWidth();const i=this;this._d3Drag=a().subject(function(t){const e=i.cellToGridItem(t);return{x:e.x*i.cellWidth,y:e.y*i.cellHeight}}).on("start",function(t){if(!i.designMode())return;r().sourceEvent.stopPropagation(),i.initGridList();const s=i.itemsMap[t.id()];i.dragItem=e.append("div").attr("class","dragging").style("transform",function(){return"translate("+s.x*i.cellWidth+"px, "+s.y*i.cellHeight+"px)"}).style("width",function(){return s.w*i.cellWidth-i.gutter()+"px"}).style("height",function(){return s.h*i.cellHeight-i.gutter()+"px"}),i.selectionBagClick(t)}).on("drag",function(t){if(!i.designMode())return;const e=r();e.sourceEvent.stopPropagation();const s=i.itemsMap[t.id()];e.x<0&&(e.x=0),e.x+s.w*i.cellWidth>i.snappingColumns()*i.cellWidth&&(e.x=i.snappingColumns()*i.cellWidth-s.w*i.cellWidth),e.y<0&&(e.y=0),e.y+s.h*i.cellWidth>i.snappingRows()*i.cellWidth&&(e.y=i.snappingRows()*i.cellWidth-s.h*i.cellWidth);const o=[Math.max(0,Math.floor((e.x+i.cellWidth/2)/i.cellWidth)),Math.max(0,Math.floor((e.y+i.cellHeight/2)/i.cellHeight))];s.x===o[0]&&s.y===o[1]||("none"!==i.snapping()?(i.resetItemsPos(),i.gridList.moveItemToPosition(s,o)):(s.x=o[0],s.y=o[1]),t.gridCol()===s.x&&t.gridRow()===s.y||(i.items.forEach(i.gridItemToCell),i.updateGrid(!1,100))),i.dragItem.style("transform",function(){return"translate("+e.x+"px, "+e.y+"px)"}).style("width",function(){return s.w*i.cellWidth+"px"}).style("height",function(){return s.h*i.cellHeight+"px"})}).on("end",function(){i.designMode()&&(r().sourceEvent.stopPropagation(),i.dragItem.remove(),i.dragItem=null,i.killGridList())}),this._d3DragResize=a().subject(function(t){const e=i.cellToGridItem(t);return{x:(e.x+e.w-1)*i.cellWidth,y:(e.y+e.h-1)*i.cellHeight}}).on("start",function(t){if(!i.designMode())return;r().sourceEvent.stopPropagation(),i.initGridList();const s=i.itemsMap[t.id()];i.dragItem=e.append("div").attr("class","resizing").style("transform",function(){return"translate("+s.x*i.cellWidth+"px, "+s.y*i.cellHeight+"px)"}).style("width",function(){return s.w*i.cellWidth-i.gutter()+"px"}).style("height",function(){return s.h*i.cellHeight-i.gutter()+"px"}),i.dragItemPos={x:s.x,y:s.y}}).on("drag",function(t){if(!i.designMode())return;const e=r();e.sourceEvent.stopPropagation();const s=i.itemsMap[t.id()],o=[Math.max(0,Math.round(e.x/i.cellWidth)),Math.max(0,Math.round(e.y/i.cellHeight))],l={w:Math.max(1,o[0]-s.x+1),h:Math.max(1,o[1]-s.y+1)};s.w===l.w&&s.h===l.h||("none"!==i.snapping()?(i.resetItemsPos(),i.gridList.resizeItem(s,l)):(s.w=l.w,s.h=l.h),t.gridColSpan()===s.w&&t.gridRowSpan()===s.h||(i.items.forEach(i.gridItemToCell),i.updateGrid(s.id,100))),i.dragItem.style("width",function(){return(1-s.x)*i.cellWidth+e.x-i.gutter()+"px"}).style("height",function(){return(1-s.y)*i.cellHeight+e.y-i.gutter()+"px"})}).on("end",function(){i.designMode()&&(r().sourceEvent.stopPropagation(),i.dragItem.remove(),i.dragItem=null,i.killGridList())})}updateGrid(t,e=0,i=!1){e=e||0;const s=this;this.divItems.classed("draggable",this.designMode()).transition().duration(e).style("left",function(t){return t.gridCol()*s.cellWidth+s.gutter()/2+"px"}).style("top",function(t){return t.gridRow()*s.cellHeight+s.gutter()/2+"px"}).style("width",function(t){return t.gridColSpan()*s.cellWidth-s.gutter()+"px"}).style("height",function(t){return t.gridRowSpan()*s.cellHeight-s.gutter()+"px"}).on("end",function(e){e.surfaceShadow_default(s.surfaceShadow()).surfacePadding_default(s.surfacePadding()).surfaceBorderWidth_default(s.surfaceBorderWidth()).surfaceBackgroundColor_default(s.surfaceBackgroundColor()),!0!==t&&t!==e.id()||e.resize().lazyRender()})}update(t,e){super.update(t,e),this._placeholderElement.style("overflow-x","width"===this.fitTo()?"hidden":null),this._placeholderElement.style("overflow-y","width"===this.fitTo()?"scroll":null);const i=this.getDimensions(),s=this.width()-("width"===this.fitTo()?this._scrollBarWidth:0);if(this.cellWidth=s/i.width,this.cellHeight="all"===this.fitTo()?this.height()/i.height:this.cellWidth,this.designMode()){const t=Math.min(this.width()/this.snappingColumns(),this.height()/this.snappingRows()),e=Math.floor(t);this.cellWidth=e,this.cellHeight=this.cellWidth}const l=this,n=e.selectAll("#"+this.id()+" > .ddCell").data(this.content(),function(t){return t.id()});this.divItems=n.enter().append("div").attr("class","ddCell").each(function(t){t.target(this),t.__grid_watch=t.monitor(function(e,i,s){!l._renderCount||"snapping"!==e&&0!==e.indexOf("grid")||i===s||l.gridList||(l.initGridList(),"none"!==l.snapping()&&l.gridList.resizeGrid("horizontal"===l.snapping()?l.snappingRows():l.snappingColumns()),l.items.forEach(l.gridItemToCell),l.updateGrid(t.id(),100),l.killGridList())});o(this).append("div").attr("class","resizeHandle").call(l._d3DragResize).append("div").attr("class","resizeHandleDisplay")}).merge(n),this.divItems.each(function(t){const e=o(this);l.designMode()?e.call(l._d3Drag):e.on("mousedown.drag",null).on("touchstart.drag",null)}),this.divItems.select(".resizeHandle").style("display",this.designMode()?null:"none"),this.updateGrid(!0),n.exit().each(function(t){t.target(null),t.__grid_watch&&t.__grid_watch.remove()}).remove();const r=e.selectAll("#"+this.id()+" > .laneBackground").data(this.designMode()?[""]:[]);r.enter().insert("div",":first-child").attr("class","laneBackground").style("left","1px").style("top","1px").on("click",function(){l.selectionBagClear()}).merge(r).style("width",this.snappingColumns()*this.cellWidth+"px").style("height",this.snappingRows()*this.cellHeight+"px"),r.exit().each(function(){l.selectionBagClear()}).remove();const h=e.selectAll("#"+this.id()+" > .lane").data(this.designMode()?[""]:[]);h.enter().append("div").attr("class","lane").style("left","1px").style("top","1px"),h.style("display",this.showLanes()?null:"none").style("width",this.snappingColumns()*this.cellWidth+"px").style("height",this.snappingRows()*this.cellHeight+"px").style("background-image","linear-gradient(to right, grey 1px, transparent 1px), linear-gradient(to bottom, grey 1px, transparent 1px)").style("background-size",this.cellWidth+"px "+this.cellHeight+"px"),h.exit().remove()}exit(t,e){this.content().forEach(t=>t.target(null)),super.exit(t,e)}_createSelectionObject(t){return{_id:t._id,element:/* @__PURE__ */e(()=>t._element,"element"),widget:t}}selection(t){return arguments.length?(this._selectionBag.set(t.map(function(t){return this._createSelectionObject(t)},this)),this):this._selectionBag.get().map(function(t){return t._id})}selectionBagClear(){this._selectionBag.isEmpty()||(this._selectionBag.clear(),this.postSelectionChange())}selectionBagClick(t){if(null!==t){const e=this._createSelectionObject(t);if(r().sourceEvent.ctrlKey)this._selectionBag.isSelected(e)?(this._selectionBag.remove(e),this.postSelectionChange()):(this._selectionBag.append(e),this.postSelectionChange());else{const t=this._selectionBag.get();1===t.length&&t[0]._id===e._id?this.selectionBagClear():this._selectionBag.set([e]),this.postSelectionChange()}}}postSelectionChange(){}applyLayout(t){this.divItems.each((e,i)=>{if(t[i]){const[s,o,l,n]=t[i];e.gridCol(s).gridRow(o).gridColSpan(l).gridRowSpan(n)}}),this.updateGrid(!0)}vizActivation(t){}};e(Kt,"Grid");let Qt=Kt;Qt.prototype._class+=" layout_Grid",Qt.prototype.publish("designMode",!1,"boolean","Design Mode",null,{tags:["Basic"]}),Qt.prototype.publish("showLanes",!0,"boolean","Show snapping lanes when in design mode",null,{tags:["Basic"],disable:/* @__PURE__ */e(t=>!t.designMode(),"disable")}),Qt.prototype.publish("fitTo","all","set","Sizing Strategy",["all","width"],{tags:["Basic"]}),Qt.prototype.publish("snapping","vertical","set","Snapping Strategy",["vertical","horizontal","none"]),Qt.prototype.publish("snappingColumns",12,"number","Snapping Columns"),Qt.prototype.publish("snappingRows",16,"number","Snapping Rows"),Qt.prototype.publish("gutter",6,"number","Gap Between Widgets",null,{tags:["Basic"]}),Qt.prototype.publish("surfaceShadow",!0,"boolean","3D Shadow"),Qt.prototype.publish("surfacePadding",null,"string","Cell Padding (px)",null,{tags:["Intermediate"]}),Qt.prototype.publish("surfaceBorderWidth",1,"number","Width (px) of Cell Border",null,{tags:["Intermediate"]}),Qt.prototype.publish("surfaceBackgroundColor",null,"html-color","Surface Background Color",null,{tags:["Advanced"]}),Qt.prototype.publish("content",[],"widgetArray","widgets",null,{tags:["Basic"],render:!1});const te=class _HorizontalList extends Yt{constructor(){super(),this.orientation_default("horizontal"),this.flexWrap_default("nowrap")}};e(te,"HorizontalList");let ee=te;ee.prototype._class+=" layout_HorizontalList";const ie=class _Layered extends i{_contentContainer;_widgetPlacements;_widgetRatios;constructor(){super(),this._tag="div",this._widgetPlacements=[],this._widgetRatios=[]}addLayer(t,e="default",i=1,s=1){const o=this.widgets();return o.push(t||(new S).text("No widget defined for layer.")),this.widgets(o),this._widgetPlacements.push(e),this._widgetRatios.push([i,s]),this}enter(t,e){super.enter(t,e),this._contentContainer=e.append("div").attr("class","container")}update(t,e){super.update(t,e);const i=this;e.style("padding",this.surfacePadding()+"px");const s=this._contentContainer.selectAll(".content.id"+this.id()).data(this.widgets(),function(t){return t.id()});s.enter().append("div").attr("class","content id"+this.id()).each(function(t,e){t.target(this)}).merge(s).each(function(t,e){const s={width:i.clientWidth(),height:i.clientHeight()},o=i.widgetSize(e,s),l=i.widgetPosition(e,s,o);this.style.top=l.y+"px",this.style.left=l.x+"px",t.resize(o).render()}),s.exit().each(function(t,e){t.target(null)}).remove(),s.order()}widgetSize(t,e){return this._widgetPlacements[t],{width:e.width*this._widgetRatios[t][0],height:e.height*this._widgetRatios[t][1]}}widgetPosition(t,e,i){switch(this._widgetPlacements[t]){default:return{x:0,y:0};case"top":return{x:e.width/2-i.width/2,y:0};case"bottom":return{x:e.width/2-i.width/2,y:e.height-i.height};case"left":return{x:0,y:e.height/2-i.height/2};case"right":return{x:e.width-i.width,y:e.height/2-i.height/2};case"center":return{x:e.width/2-i.width/2,y:e.height/2-i.height/2}}}};e(ie,"Layered");let se=ie;se.prototype._class+=" layout_Layered",se.prototype.publish("surfacePadding",0,"number","Padding"),se.prototype.publish("widgets",[],"widgetArray","widgets",null,{tags:["Private"]});const oe=class _Popup extends i{_surfaceButtons;_originalPosition;constructor(){super(),this._tag="div",this._surfaceButtons=[]}updateState(t){t=t||!this.popupState(),this.popupState(t).render()}enter(t,e){super.enter(t,e),this.widget().target(t),this._originalPosition=this.position()}update(t,e){super.update(t,e),e.style("visibility",this.popupState()?null:"hidden").style("opacity",this.popupState()?null:0).style("width",this.shrinkWrap()?this.widget().width()+"px":this._size.width+"px").style("height",this.shrinkWrap()?this.widget().height()+"px":this._size.height+"px"),0===this.widget().size().height&&this.widget().resize(this.size())}postUpdate(t,e){let i,s;switch(this.centerPopup()){case"container":this._placeholderElement&&(i=parseInt(this._placeholderElement.style("width"))/2-this.widget().width()/2,s=parseInt(this._placeholderElement.style("height"))/2-this.widget().height()/2),this.position("absolute");break;case"window":i=window.innerWidth/2-this.widget().width()/2,s=window.innerHeight/2-this.widget().height()/2,this.position("fixed");break;default:i=0,s=0,this.position(this._originalPosition)}this.pos({x:i,y:s}),super.postUpdate(t,e),e.style("position",this.position()).style("left",this.left()+"px").style("right",this.right()+"px").style("top",this.top()+"px").style("bottom",this.bottom()+"px")}exit(t,e){this.widget()&&this.widget().target(null),super.exit(t,e)}click(t){}};e(oe,"Popup");let le=oe;le.prototype._class+=" layout_Popup",le.prototype.publish("popupState",!1,"boolean","State of the popup, visible (true) or hidden (false)",null,{}),le.prototype.publish("shrinkWrap",!1,"boolean","The popup parent container either shrinks to the size of its contents (true) or expands to fit thge popup's parentDiv (false)",null,{}),le.prototype.publish("centerPopup","none","set","Center the widget in its container element (target) or in the window",["none","container","window"],{}),le.prototype.publish("top",null,"number","Top position property of popup",null,{}),le.prototype.publish("bottom",null,"number","Bottom position property of popup",null,{}),le.prototype.publish("left",null,"number","Left position property of popup",null,{}),le.prototype.publish("right",null,"number","Right position property of popup",null,{}),le.prototype.publish("position","relative","set","Value of the 'position' property",["absolute","relative","fixed","static","initial","inherit"],{tags:["Private"]}),le.prototype.publish("widget",null,"widget","Widget",null,{tags:["Private"]});const ne=class _Tabbed extends i{_tabContainer;_contentContainer;constructor(){super(),this._tag="div"}clearTabs(){return this.labels([]),this.widgets([]),this}addTab(t,e,i,s){const o=t.size();0===o.width&&0===o.height&&t.size({width:"100%",height:"100%"});const l=this.labels(),n=this.widgets();i&&this.activeTabIdx(this.widgets().length),l.push(e);const r=(new R).widget(t||(new S).text("No widget defined for tab"));return n.push(r),this.labels(l),this.widgets(n),s&&s(r),this}widgetSize(t){const e=this.clientWidth();let i=this.clientHeight();const s=this._tabContainer.node().getBoundingClientRect();return void 0!==s.height&&(i-=s.height),{width:e,height:i}}enter(t,e){super.enter(t,e),this._tabContainer=e.append("div"),this._contentContainer=e.append("div")}update(t,e){super.update(t,e);const i=this;e.style("padding",this.surfacePadding_exists()?this.surfacePadding()+"px":null);const s=this._tabContainer.selectAll(".tab-button.id"+this.id()).data(this.showTabs()?this.labels():[],function(t){return t});s.enter().append("span").attr("class","tab-button id"+this.id()).style("cursor","pointer").on("click",function(t,e){i.click(i.widgets()[e].widget(),t,e),i.activeTabIdx(e).render()}).merge(s).classed("active",function(t,e){return i.activeTabIdx()===e}).text(function(t){return t}),s.exit().remove();const l=this._contentContainer.selectAll(".tab-content.id"+this.id()).data(this.widgets(),function(t){return t.id()});if(l.enter().append("div").attr("class","tab-content id"+this.id()).each(function(t,e){t.target(this)}).merge(l).classed("active",function(t,e){return i.activeTabIdx()===e}).style("display",function(t,e){return i.activeTabIdx()===e?"block":"none"}).each(function(t,e){if(t.visible(i.activeTabIdx()===e),i.activeTabIdx()===e){const e=i.widgetSize(o(this));t.surfaceBorderWidth(i.showTabs()?null:0).surfacePadding(i.showTabs()?null:0).resize(e)}}),l.exit().each(function(t,e){t.target(null)}).remove(),"bottom"===this.tabLocation())this._tabContainer.attr("class","on_bottom").style("top",this._contentContainer.node().offsetHeight+this.surfacePadding()+"px").style("position","absolute"),this._contentContainer.style("top",this.surfacePadding_exists()?this.surfacePadding()+"px":null).style("position","absolute");else this._tabContainer.attr("class","on_top").style("top",null).style("position","relative"),this._contentContainer.style("top",this._tabContainer.node().offsetHeight+this.surfacePadding()+"px").style("position","absolute")}click(t,e,i){}};e(ne,"Tabbed");let re=ne;re.prototype._class+=" layout_Tabbed",re.prototype.publish("showTabs",!0,"boolean","Show Tabs",null,{}),re.prototype.publish("surfacePadding",4,"number","Padding"),re.prototype.publish("activeTabIdx",0,"number","Index of active tab",null,{}),re.prototype.publish("labels",[],"array","Array of tab labels sharing an index with ",null,{tags:["Private"]}),re.prototype.publish("tabLocation","top","set","Position the tabs at the bottom of the widget",["top","bottom"],{tags:["Private"]}),re.prototype.publish("widgets",[],"widgetArray","widgets",null,{tags:["Private"]});const he=class _Toolbar extends i{constructor(){super(),this._tag="div"}enter(t,e){super.enter(t,e)}update(t,e){super.update(t,e);const i=this;e.attr("title",i.title()).style("background-color",this.backgroundColor());const s=e.selectAll("div.toolbar-title").data(this.title()?[this.title()]:[]);s.enter().append("div").classed("toolbar-title",!0).append("span"),s.selectAll("div.toolbar-title > span").style("font-size",this.fontSize_exists()?this.fontSize()+"px":null).style("color",this.fontColor_exists()?this.fontColor():null).style("font-family",this.fontFamily_exists()?this.fontFamily():null).style("font-weight",this.fontBold_exists()?this.fontBold()?"bold":"normal":null).style("background-color",this.backgroundColor_exists()?this.backgroundColor():null).text(i.title()),s.exit().remove();const l=e.selectAll("div.toolbar-child").data(null!==this.widgets()?this.widgets():[],function(t){return t.id()});l.enter().insert("div","div.toolbar-title").each(function(t,e){const s=i.widgetClasses()[e]?i.widgetClasses()[e]+" toolbar-child":"toolbar-child";o(this).classed(s,!0),t.target(this)}),l.exit().each(function(t){t.target(null)}).remove(),l.order()}render(t){const e=this;return super.render(function(i){const s=e.element().node().getBoundingClientRect();let o=s.left+s.width;e.element().selectAll("div.toolbar-child").each(function(t,e){const i=this.getBoundingClientRect();o>i.left&&(o=i.left)}),e.element().select(".toolbar-title").style("width",o-s.left-4+"px"),t&&t(i)})}exit(t,e){this.widgets().forEach(function(t){t.target(null)}),super.exit(t,e)}};e(he,"Toolbar");let ae=he;ae.prototype._class+=" layout_Toolbar",ae.prototype.publish("title","","string","Title",null,{tags:["Intermediate"]}),ae.prototype.publish("fontSize",null,"number","Title Font Size (px)",null,{tags:["Advanced"],optional:!0}),ae.prototype.publish("fontColor",null,"html-color","Title Font Color",null,{tags:["Advanced"],optional:!0}),ae.prototype.publish("fontFamily",null,"string","Title Font Family",null,{tags:["Advanced"],optional:!0}),ae.prototype.publish("fontBold",!0,"boolean","Enable Bold Title Font",null,{tags:["Advanced"],optional:!0}),ae.prototype.publish("backgroundColor",null,"html-color","Background Color",null,{tags:["Intermediate"],optional:!0}),ae.prototype.publish("responsive",!0,"boolean","Adapts to pixel width",null,{tags:["Basic"]}),ae.prototype.publish("widgets",[],"widgetArray","Child widgets of the toolbar",null,{tags:["Basic"]}),ae.prototype.publish("widgetClasses",[],"array","Array of Html Element classes to be assigned to the child widgets (shares index with widgets param)",null,{tags:["Basic"]});const de=class _VerticalList extends Yt{constructor(){super(),this.orientation_default("vertical"),this.flexWrap_default("nowrap")}};e(de,"VerticalList");let pe=de;pe.prototype._class+=" layout_VerticalList";export{F as AbsoluteSurface,L as Accordion,M as BUILD_VERSION,Y as Border,U as Border2,q as Carousel,E as Cell,Et as ChartPanel,Yt as FlexGrid,Qt as Grid,ee as HorizontalList,se as Layered,Lt as Legend,Rt as Modal,A as PKG_NAME,H as PKG_VERSION,le as Popup,R as Surface,re as Tabbed,ae as Toolbar,pe as VerticalList,N as WidgetDiv};
3
+ //# sourceMappingURL=index.js.map
4
+ !function(){"use strict";try{if("undefined"!=typeof document){var o=document.createElement("style");o.appendChild(document.createTextNode('.layout_AbsoluteSurface{pointer-events:none!important}.layout_AbsoluteSurface>.placeholder{position:relative;overflow:hidden;pointer-events:all}.layout_Accordion>ul{position:relative}.layout_Accordion.open>span{font-style:italic}.layout_Accordion.closed>ul{height:0px;overflow:hidden}.layout_Accordion.open>ul{display:block}.layout_Accordion>.collapsible-icon,.layout_Accordion>.collapsible-title{cursor:pointer;box-sizing:border-box}.layout_Accordion>.collapsible-title{display:block;width:100%}.layout_Accordion>.collapsible-title{font-size:13px;color:#fff;padding:4px 8px;height:26px;-webkit-box-shadow:inset 0px -1px 1px 0px rgba(0,0,0,.2);-moz-box-shadow:inset 0px -1px 1px 0px rgba(0,0,0,.2);box-shadow:inset 0 -1px 1px #0003}.layout_Accordion li{background-color:#fff}.layout_Accordion>ul,.layout_Accordion>.collapsible-title{background-color:#333}.layout_Accordion .layout_Accordion>ul,.layout_Accordion .layout_Accordion>.collapsible-title{background-color:#555}.layout_Accordion .layout_Accordion .layout_Accordion>ul,.layout_Accordion .layout_Accordion .layout_Accordion>.collapsible-title{background-color:#777}.layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion>ul,.layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion>.collapsible-title{background-color:#999}.layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion>ul,.layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion>.collapsible-title{background-color:#bbb}.layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion>ul,.layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion>.collapsible-title{background-color:#ccc}.layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion>ul,.layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion .layout_Accordion>.collapsible-title{background-color:#ddd}.layout_Accordion>ul,.layout_Accordion>span{padding-left:0}.layout_Accordion .layout_Accordion>ul,.layout_Accordion .layout_Accordion>span{padding-left:12px}.layout_Accordion>.collapsible-title:before{padding:4px 8px;position:absolute;left:0;top:0}.layout_Accordion>.collapsible-icon{position:absolute;top:0;right:0;width:24px;height:24px;color:#fff}.layout_Surface{box-sizing:border-box;margin:0;border:1px solid #e5e5e5;overflow:hidden;height:100%;width:100%}.layout_Surface.shadow2{box-shadow:0 2px 2px #00000024,0 3px 1px -2px #0003,0 1px 5px #0000001f}.layout_Surface>h3{margin:0;padding:2px;background-color:#e5e5e5}.layout_Surface .html-button-container{position:absolute;right:0;top:3px}.layout_Surface>div{padding:8px}.layout_Surface .html-button-container .surface-button{margin-right:5px}.layout_Surface .html-button-container .surface-button i{opacity:.8}.layout_Surface .html-button-container .surface-button:hover{opacity:1}.layout_Surface .html-button-container .surface-button:active{opacity:.5}div[draggable=true].hideDragCellContent.content-icon:before{content:"";font-family:FontAwesome;position:absolute;top:calc(50% - 74px);left:calc(50% - 56px);font-size:100px}div[draggable=true].hideDragCellContent.content-icon-Line:before{content:""}div[draggable=true].hideDragCellContent.content-icon-Pie:before{top:calc(50% - 72px);left:calc(50% - 45px);content:""}div[draggable=true].hideDragCellContent.content-icon-Area:before{content:""}div[draggable=true].hideDragCellContent.content-icon-Gauge:before{content:""}div[draggable=true].hideDragCellContent.content-icon-Table:before{content:""}div[draggable=true].hideDragCellContent.content-icon-Form:before{content:""}div[draggable=true].hideDragCellContent.content-icon-Grid:before,div[draggable=true].hideDragCellContent.content-icon-Graph:before,div[draggable=true].hideDragCellContent.content-icon-Border:before,div[draggable=true].hideDragCellContent.content-icon-Tabbed:before,div[draggable=true].hideDragCellContent.content-icon-Accordion:before,div[draggable=true].hideDragCellContent.content-icon-MultiChart:before,div[draggable=true].hideDragCellContent.content-icon-MultiChartSurface:before{content:""}div[draggable=true].hideDragCellContent.content-icon-ChoroplethStates:before,div[draggable=true].hideDragCellContent.content-icon-ChoroplethStatesHeat:before,div[draggable=true].hideDragCellContent.content-icon-ChoroplethCounties:before,div[draggable=true].hideDragCellContent.content-icon-ChoroplethCountries:before,div[draggable=true].hideDragCellContent.content-icon-GMap:before,div[draggable=true].hideDragCellContent.content-icon-GMapHeat:before,div[draggable=true].hideDragCellContent.content-icon-GMapGraph:before{content:""}div[draggable=true].hideDragCellContent.content-icon-Text:before,div[draggable=true].hideDragCellContent.content-icon-TextBox:before,div[draggable=true].hideDragCellContent.content-icon-FAChar:before{content:""}.layout_Cell .update-indicator{box-sizing:border-box;position:absolute;top:0;left:0;padding:0;z-index:1000;border-width:0px;border-style:solid;pointer-events:none}.layout_Border{width:100%;height:100%}.layout_Border>.border-content{width:100%;height:100%;position:relative}.layout_Border>.borderHandle{width:6px;height:6px;background-color:#444;opacity:.3;position:absolute;visibility:hidden}.layout_Border.design-mode>.borderHandle{visibility:visible}.layout_Border>.borderHandle:hover{background-color:#666}.layout_Border>.borderHandle.borderHandleDisabled{display:none}.layout_Border>.borderHandle_top,.layout_Border>.borderHandle_bottom{cursor:ns-resize}.layout_Border>.borderHandle_left,.layout_Border>.borderHandle_right{cursor:ew-resize}.layout_Border .cell{border-radius:5px;border:1px solid #e5e5e5;display:inline-block;overflow:hidden}.layout_Border .cell h2{margin:0;padding-top:4px;-webkit-margin:0px;text-align:center}.layout_Border .layout_BorderCell.over{border:2px dashed #000}.layout_Border .dragItem{z-index:-1;opacity:.33}.layout_Border .notDragItem{z-index:-1;opacity:1}.layout_Border div[draggable=true]{opacity:.75;cursor:default}.layout_Border div[draggable=true] .dragHandle{opacity:1}.layout_Border div[draggable=true] .dragHandle_n,.layout_Border div[draggable=true] .dragHandle_e,.layout_Border div[draggable=true] .dragHandle_s,.layout_Border div[draggable=true] .dragHandle_w{background-color:#aaa}.layout_Border div[draggable=true] .dragHandle_nw,.layout_Border div[draggable=true] .dragHandle_ne,.layout_Border div[draggable=true] .dragHandle_se,.layout_Border div[draggable=true] .dragHandle_sw{background-color:#333}.layout_Border div[draggable=true] .dragHandle_nw{cursor:nw-resize}.layout_Border div[draggable=true] .dragHandle_n{cursor:n-resize}.layout_Border div[draggable=true] .dragHandle_ne{cursor:ne-resize}.layout_Border div[draggable=true] .dragHandle_e{cursor:e-resize}.layout_Border div[draggable=true] .dragHandle_se{cursor:se-resize}.layout_Border div[draggable=true] .dragHandle_s{cursor:s-resize}.layout_Border div[draggable=true] .dragHandle_sw{cursor:sw-resize}.layout_Border div[draggable=true] .dragHandle_w{cursor:w-resize}.layout_Border div[draggable=false]>div>.dragHandle{display:none}.layout_Border .grid-drop-target{position:fixed;box-sizing:border-box;border:2px dashed #7f8c8d;border-radius:0;background:repeating-linear-gradient(-45deg,#0000,#0000 4px,#6464641a 4px 8px)}.layout_Border .grid-drop-target.drop-target-over{border:2px dashed #179BD7;background:repeating-linear-gradient(-45deg,#0000,#0000 6px,#119bd71a 6px 12px)}.layout_Border2{display:flex;flex-direction:column}.layout_Border2>.body{margin:0;padding:0;display:flex;flex-flow:row}.layout_Border2>.body>.center{flex:1}.layout_Border2>.header{display:block}.layout_Border2>.footer{display:block}.layout_Carousel>div{position:relative;overflow:hidden}.layout_Carousel>div>.carouselItem{position:absolute}.layout_Modal-header{background-color:#3f51b5;overflow:hidden}.layout_Modal-body{background-color:#fff;overflow-y:scroll;overflow-x:hidden}.layout_Modal-title,.layout_Modal-annotations{position:absolute}.layout_Modal-closeButton{cursor:pointer}.layout_Modal-closeButton:hover{opacity:.7}.layout_Modal-closeButton:active{opacity:.5}.layout_Modal-fade{position:fixed;background-color:#000;opacity:.5;z-index:10000}.layout_Modal-content{position:fixed;background-color:#fff;z-index:10100}.layout_Modal-fade-hidden{display:none}.layout_Modal-fadeClickable{cursor:pointer}.layout_ChartPanel .series.highlight{stroke-width:2px;opacity:1}.layout_ChartPanel .series.lowlight{opacity:.3!important}.layout_FlexGrid{display:flex}.FlexGrid-list-item{overflow:hidden;border-style:solid;flex-grow:1}.layout_Grid>.ddCell{position:absolute}.layout_Grid>.laneBackground{position:absolute;border-style:solid;border-width:1px;background:#f5f5f5}.layout_Grid>.lane{position:absolute;border-style:none;opacity:.25;border-radius:0;pointer-events:none}.layout_Grid>.ddCell.draggable{border-style:solid;border-width:1px;background-color:#f8f8ff;border-radius:0;cursor:move}.layout_Grid>.ddCell.draggable>.resizeHandle{bottom:0;right:0;width:8px;height:8px;border-style:none;position:absolute;cursor:nwse-resize}.layout_Grid>.ddCell.draggable .resizeHandleDisplay{bottom:2px;right:2px;width:4px;height:4px;border-style:solid;border-left-width:0px;border-top-width:0px;border-right-width:2px;border-bottom-width:2px;border-color:#a9a9a9;background-color:none;position:absolute}.layout_Grid>.ddCell.draggable .resizeHandleDisplay:hover{border-color:orange}.layout_Grid>.dragging{border-style:solid;border-width:1px;border-color:gray;border-radius:0;position:absolute;background:repeating-linear-gradient(-45deg,#0000,#0000 4px,#6464641a 4px 8px)}.layout_Grid>.resizing{border-style:solid;border-width:1px;border-color:gray;background-color:orange;border-radius:0;position:absolute;opacity:.3;background:repeating-linear-gradient(-45deg,#0000,#0000 4px,orange 4px 8px)}.layout_Grid>.ddCell.draggable .common_Widget.selected{border-style:solid;border-width:1px;border-color:red;background-color:gray;border-radius:0;position:absolute;background:repeating-linear-gradient(-45deg,#0000,#0000 4px,#6400001a 4px 8px)}.layout_Grid #drag-me:before{content:"#" attr(id);font-weight:700}.layout_Layered{pointer-events:none}.layout_Layered>.container>.content{position:absolute}.layout_Layered>.container>.content>div>.common_Widget,.layout_Layered>.container>.content>div>svg>.common_Widget{pointer-events:all}.layout_Tabbed .tab-button{position:relative;top:1px;display:inline-block;border-left:1px solid #ddd;border-top:1px solid #ddd;border-right:1px solid #ddd;background-color:transparent;margin-right:4px;padding:2px 2px 4px;background-color:#ccc}.layout_Tabbed .tab-button.active{background-color:#fff;z-index:999}.layout_Tabbed .on_bottom .tab-button{border-bottom:1px solid #ddd;border-top:none;top:-1px}.layout_Toolbar{height:100%;background-color:#ddd;white-space:nowrap;overflow:hidden}.layout_Toolbar .toolbar-title{display:inline-block;position:relative;top:50%;transform:translateY(-50%);-ms-transform:translateY(-50%);margin-left:4px;font-weight:700;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.layout_Toolbar .toolbar-child{position:relative;top:50%;transform:translateY(-50%);-ms-transform:translateY(-50%);float:right;margin-left:4px;margin-right:4px;line-height:16px}')),document.head.appendChild(o)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}}();