@hpcc-js/layout 3.4.1 → 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,3989 +1,4 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- import { HTMLWidget, FAChar, select, selectAll, Utility, d3Event, Platform, drag, scaleLinear, dispatch, formatPrefix, format, formatLocale, formatSpecifier, sum, SVGWidget, Database, Palette, scaleOrdinal, ProgressBar, ToggleButton, Text, Button, Spacer, TitleBar, IconBar } from "@hpcc-js/common";
4
- import { Table } from "@hpcc-js/dgrid";
5
- import { instanceOfIHighlight } from "@hpcc-js/api";
6
- function _mergeNamespaces(n, m) {
7
- for (var i = 0; i < m.length; i++) {
8
- const e = m[i];
9
- if (typeof e !== "string" && !Array.isArray(e)) {
10
- for (const k2 in e) {
11
- if (k2 !== "default" && !(k2 in n)) {
12
- const d = Object.getOwnPropertyDescriptor(e, k2);
13
- if (d) {
14
- Object.defineProperty(n, k2, d.get ? d : {
15
- enumerable: true,
16
- get: /* @__PURE__ */ __name(() => e[k2], "get")
17
- });
18
- }
19
- }
20
- }
21
- }
22
- }
23
- return Object.freeze(Object.defineProperty(n, Symbol.toStringTag, { value: "Module" }));
24
- }
25
- __name(_mergeNamespaces, "_mergeNamespaces");
26
- const PKG_NAME = "@hpcc-js/layout";
27
- const PKG_VERSION = "3.4.1";
28
- const BUILD_VERSION = "3.15.1";
29
- const _AbsoluteSurface = class _AbsoluteSurface extends HTMLWidget {
30
- constructor() {
31
- super();
32
- this._tag = "div";
33
- }
34
- enter(domNode, element) {
35
- super.enter(domNode, element);
36
- }
37
- update(domNode, element) {
38
- super.update(domNode, element);
39
- let xPos = 0;
40
- let yPos = 0;
41
- let width = this.clientWidth();
42
- let height = this.clientHeight();
43
- switch (this.units()) {
44
- case "pixels":
45
- xPos = this.widgetX();
46
- yPos = this.widgetY();
47
- width = this.widgetWidth() === "" ? width - xPos : Number(this.widgetWidth());
48
- height = this.widgetHeight() === "" ? height - yPos : Number(this.widgetHeight());
49
- break;
50
- case "percent":
51
- xPos = this.widgetX() * width / 100;
52
- yPos = this.widgetY() * height / 100;
53
- width = this.widgetWidth() === "" ? width - xPos : Number(this.widgetWidth()) * width / 100;
54
- height = this.widgetHeight() === "" ? height - yPos : Number(this.widgetHeight()) * height / 100;
55
- break;
56
- }
57
- element.style("opacity", this.opacity());
58
- const widgets = element.selectAll("#" + this._id + " > .placeholder").data(this.widget() ? [this.widget()] : [], function(d) {
59
- return d._id;
60
- });
61
- widgets.enter().append("div").attr("class", "placeholder").each(function(d) {
62
- d.target(this);
63
- }).merge(widgets).style("left", xPos + "px").style("top", yPos + "px").style("width", width + "px").style("bottom", height + "px").each(function(d) {
64
- d.resize({ width, height });
65
- });
66
- widgets.exit().each(function(d) {
67
- d.target(null);
68
- }).remove();
69
- }
70
- exit(domNode, element) {
71
- if (this.widget()) {
72
- this.widget().target(null);
73
- }
74
- super.exit(domNode, element);
75
- }
76
- };
77
- __name(_AbsoluteSurface, "AbsoluteSurface");
78
- let AbsoluteSurface = _AbsoluteSurface;
79
- AbsoluteSurface.prototype._class += " layout_AbsoluteSurface";
80
- AbsoluteSurface.prototype.publish("units", "percent", "set", "Units", ["pixels", "percent"]);
81
- AbsoluteSurface.prototype.publish("widgetX", 0, "number", "Widget XPos");
82
- AbsoluteSurface.prototype.publish("widgetY", 0, "number", "Widget YPos");
83
- AbsoluteSurface.prototype.publish("widgetWidth", "100", "string", "Widget Width, omit for full");
84
- AbsoluteSurface.prototype.publish("widgetHeight", "100", "string", "Widget Height, omit for full");
85
- AbsoluteSurface.prototype.publish("widget", null, "widget", "Widget", null, { tags: ["Private"] });
86
- AbsoluteSurface.prototype.publish("opacity", 1, "number", "Opacity");
87
- const _Accordion = class _Accordion extends HTMLWidget {
88
- _isClosed;
89
- titleSpan;
90
- iconDiv;
91
- ul;
92
- icon;
93
- constructor() {
94
- super();
95
- this._tag = "div";
96
- this._isClosed = false;
97
- }
98
- pushListItem(widget, prepend = false, protect = false) {
99
- const contentArr = this.content();
100
- widget._protected = protect;
101
- if (prepend) {
102
- contentArr.unshift(widget);
103
- } else {
104
- contentArr.push(widget);
105
- }
106
- this.content(contentArr);
107
- return this;
108
- }
109
- clearListItems() {
110
- const arr = [];
111
- for (const i in this.content()) {
112
- if (this.content()[i]._protected) {
113
- arr.push(this.content()[i]);
114
- }
115
- }
116
- this.content(arr);
117
- return this;
118
- }
119
- collapseClick(element) {
120
- if (element.classed("closed")) {
121
- this._isClosed = false;
122
- element.classed("open", true);
123
- element.classed("closed", false);
124
- } else {
125
- this._isClosed = true;
126
- element.classed("open", false);
127
- element.classed("closed", true);
128
- }
129
- }
130
- enter(domNode, element) {
131
- super.enter(domNode, element);
132
- const context = this;
133
- this._isClosed = this.defaultCollapsed();
134
- element.classed(this._isClosed ? "closed" : "open", true);
135
- this.titleSpan = element.append("span").classed("collapsible-title", true);
136
- this.iconDiv = element.append("div").classed("collapsible-icon", true);
137
- this.ul = element.append("ul");
138
- this.icon = new FAChar().size({ height: 24, width: 24 }).target(this.iconDiv.node());
139
- this.iconDiv.on("click", function() {
140
- context.collapseClick(element);
141
- context.render();
142
- });
143
- this.titleSpan.on("click", function() {
144
- context.collapseClick(element);
145
- context.render();
146
- });
147
- }
148
- update(domNode, element) {
149
- super.update(domNode, element);
150
- const context = this;
151
- const this_id = "";
152
- this.titleSpan.text(context.title().length > 0 ? context.title() + this_id : "Accordion [" + context._id + "]" + this_id);
153
- const rows = this.ul.selectAll("#" + context._id + " > ul > li").data(this.content(), function(d) {
154
- return d._id;
155
- });
156
- rows.enter().append(function(widget) {
157
- const li = document.createElement("li");
158
- if (widget._target === null) {
159
- const wSize = widget.size();
160
- if (wSize.width === 0 || wSize.height === 0) {
161
- const cSize = context.size();
162
- widget.size({
163
- width: cSize.width,
164
- height: cSize.width
165
- });
166
- }
167
- widget.target(li);
168
- } else {
169
- return widget._target;
170
- }
171
- return li;
172
- });
173
- rows.exit().remove();
174
- this.icon.text_colorFill(this.titleFontColor()).char(this._isClosed ? this.closedIcon() : this.openIcon()).render();
175
- }
176
- exit(domNode, element) {
177
- super.exit(domNode, element);
178
- }
179
- };
180
- __name(_Accordion, "Accordion");
181
- let Accordion = _Accordion;
182
- Accordion.prototype._class += " layout_Accordion";
183
- Accordion.prototype.publish("content", [], "widgetArray", "Array of widgets", null, { tags: ["Basic"] });
184
- Accordion.prototype.publish("title", "", "string", "Title of collapsible section", null, { tags: ["Private"] });
185
- Accordion.prototype.publish("openIcon", "", "string", "Icon to display when list is open", null, { tags: ["Private"] });
186
- Accordion.prototype.publish("closedIcon", "", "string", "Icon to display when list is closed", null, { tags: ["Private"] });
187
- Accordion.prototype.publish("titleFontColor", "#FFFFFF", "html-color", "Title font color", null, { tags: ["Private"] });
188
- Accordion.prototype.publish("titleBackgroundColor", "#333333", "html-color", "Title background color", null, { tags: ["Private"] });
189
- Accordion.prototype.publish("defaultCollapsed", false, "boolean", "Collapsed by default if true", null, { tags: ["Private"] });
190
- const _Surface = class _Surface extends HTMLWidget {
191
- _surfaceButtons;
192
- constructor() {
193
- super();
194
- this._tag = "div";
195
- this._surfaceButtons = [];
196
- }
197
- widgetSize(titleDiv, widgetDiv) {
198
- let width = this.clientWidth();
199
- let height = this.clientHeight();
200
- if (this.title()) {
201
- height -= this.calcHeight(titleDiv);
202
- }
203
- height -= this.calcFrameHeight(widgetDiv);
204
- width -= this.calcFrameWidth(widgetDiv);
205
- return { width, height };
206
- }
207
- enter(domNode, element) {
208
- super.enter(domNode, element);
209
- }
210
- update(domNode, element2) {
211
- super.update(domNode, element2);
212
- const context = this;
213
- 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());
214
- const titles = element2.selectAll(".surfaceTitle").data(this.title() ? [this.title()] : []);
215
- titles.enter().insert("h3", "div").attr("class", "surfaceTitle").merge(titles).text(function(d) {
216
- return d;
217
- }).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);
218
- titles.exit().remove();
219
- const surfaceTitle = element2.select(".surfaceTitle");
220
- const surfaceButtons = surfaceTitle.append("div").attr("class", "html-button-container").selectAll(".surface-button").data(this.buttonAnnotations());
221
- surfaceButtons.enter().append("button").classed("surface-button", true).each(function(button, idx) {
222
- 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");
223
- if (button.font === "FontAwesome") {
224
- el.style("background", "transparent").style("border", "none").on("click", function(d) {
225
- context.click(d);
226
- }).append("i").attr("class", "fa").text(function() {
227
- return button.label;
228
- });
229
- } else {
230
- el.text(function() {
231
- return button.label;
232
- }).on("click", function(d) {
233
- context.click(d);
234
- });
235
- }
236
- });
237
- surfaceButtons.exit().each(function(_d, idx) {
238
- const element = select(this);
239
- delete context._surfaceButtons[idx];
240
- element.remove();
241
- });
242
- const widgets = element2.selectAll("#" + this._id + " > .surfaceWidget").data(this.widget() ? [this.widget()] : [], function(d) {
243
- return d._id;
244
- });
245
- widgets.enter().append("div").attr("class", "surfaceWidget").each(function(d) {
246
- select(context.element().node().parentElement).classed("content-icon content-icon-" + d.classID().split("_")[1], true);
247
- d.target(this);
248
- }).merge(widgets).style("padding", this.surfacePadding_exists() ? this.surfacePadding() + "px" : null).each(function(d) {
249
- const widgetSize = context.widgetSize(element2.select("h3"), select(this));
250
- if (widgetSize.width < 0) widgetSize.width = 0;
251
- if (widgetSize.height < 0) widgetSize.height = 0;
252
- d.resize({ width: widgetSize.width, height: widgetSize.height });
253
- });
254
- widgets.exit().each(function(d) {
255
- d.target(null);
256
- }).remove();
257
- }
258
- exit(domNode, element) {
259
- if (this.widget()) {
260
- this.widget().target(null);
261
- }
262
- super.exit(domNode, element);
263
- }
264
- // Events ---
265
- click(obj) {
266
- }
267
- };
268
- __name(_Surface, "Surface");
269
- let Surface = _Surface;
270
- Surface.prototype._class += " layout_Surface";
271
- Surface.prototype.publish("title", "", "string", "Title", null, { tags: ["Intermediate"] });
272
- Surface.prototype.publish("altText", null, "string", "Alt text", null, { optional: true });
273
- Surface.prototype.publish("surfaceTitlePadding", null, "number", "Title Padding (px)", null, { tags: ["Advanced"], disable: /* @__PURE__ */ __name((w) => !w.title(), "disable") });
274
- Surface.prototype.publish("surfaceTitleFontSize", null, "number", "Title Font Size (px)", null, { tags: ["Advanced"], disable: /* @__PURE__ */ __name((w) => !w.title(), "disable") });
275
- Surface.prototype.publish("surfaceTitleFontColor", null, "html-color", "Title Font Color", null, { tags: ["Advanced"], disable: /* @__PURE__ */ __name((w) => !w.title(), "disable") });
276
- Surface.prototype.publish("surfaceTitleFontFamily", null, "string", "Title Font Family", null, { tags: ["Advanced"], disable: /* @__PURE__ */ __name((w) => !w.title(), "disable") });
277
- Surface.prototype.publish("surfaceTitleFontBold", true, "boolean", "Enable Bold Title Font", null, { tags: ["Advanced"], disable: /* @__PURE__ */ __name((w) => !w.title(), "disable") });
278
- Surface.prototype.publish("surfaceTitleBackgroundColor", null, "html-color", "Title Background Color", null, { tags: ["Advanced"], disable: /* @__PURE__ */ __name((w) => !w.title(), "disable") });
279
- Surface.prototype.publish("surfaceTitleAlignment", "center", "set", "Title Alignment", ["left", "right", "center"], { tags: ["Basic"], disable: /* @__PURE__ */ __name((w) => !w.title(), "disable") });
280
- Surface.prototype.publish("surfaceShadow", false, "boolean", "3D Shadow");
281
- Surface.prototype.publish("surfacePadding", null, "string", "Surface Padding (px)", null, { tags: ["Intermediate"] });
282
- Surface.prototype.publish("surfaceBackgroundColor", null, "html-color", "Surface Background Color", null, { tags: ["Advanced"] });
283
- Surface.prototype.publish("surfaceBorderWidth", null, "number", "Surface Border Width (px)", null, { tags: ["Advanced"] });
284
- Surface.prototype.publish("surfaceBorderColor", null, "html-color", "Surface Border Color", null, { tags: ["Advanced"] });
285
- Surface.prototype.publish("surfaceBorderRadius", null, "number", "Surface Border Radius (px)", null, { tags: ["Advanced"] });
286
- Surface.prototype.publish("buttonAnnotations", [], "array", "Button Array", null, { tags: ["Private"] });
287
- Surface.prototype.publish("widget", null, "widget", "Widget", null, { tags: ["Basic"] });
288
- const _Cell = class _Cell extends Surface {
289
- _indicateTheseIds;
290
- constructor() {
291
- super();
292
- this._indicateTheseIds = [];
293
- }
294
- indicateTheseIds(_) {
295
- if (!arguments.length) return this._indicateTheseIds;
296
- this._indicateTheseIds = _;
297
- return this;
298
- }
299
- enter(domNode, element) {
300
- super.enter(domNode, element);
301
- const context = this;
302
- element.classed("layout_Surface", true).on("mouseenter", function() {
303
- context.onMouseEnter();
304
- }).on("mouseleave", function() {
305
- context.onMouseLeave();
306
- });
307
- }
308
- update(domNode, element) {
309
- super.update(domNode, element);
310
- }
311
- onMouseEnter() {
312
- const arr = this.indicateTheseIds();
313
- const opacity = this.indicatorOpacity();
314
- const indicatorBorderColor = this.indicatorBorderColor();
315
- const indicatorGlowColor = this.indicatorGlowColor();
316
- for (let i = 0; i < arr.length; i++) {
317
- const otherElement = select("#" + arr[i]);
318
- const otherWidget = otherElement.datum();
319
- if (otherElement && otherWidget) {
320
- 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);
321
- }
322
- }
323
- }
324
- onMouseLeave() {
325
- const arr = this.indicateTheseIds();
326
- for (let i = 0; i < arr.length; i++) {
327
- selectAll("#" + arr[i] + " > div.update-indicator").remove();
328
- }
329
- }
330
- };
331
- __name(_Cell, "Cell");
332
- let Cell = _Cell;
333
- Cell.prototype._class += " layout_Cell";
334
- Cell.prototype.publish("gridRow", 0, "number", "Grid Row Position", null, { tags: ["Private"] });
335
- Cell.prototype.publish("gridCol", 0, "number", "Grid Column Position", null, { tags: ["Private"] });
336
- Cell.prototype.publish("gridRowSpan", 1, "number", "Grid Row Span", null, { tags: ["Private"] });
337
- Cell.prototype.publish("gridColSpan", 1, "number", "Grid Column Span", null, { tags: ["Private"] });
338
- Cell.prototype.publish("indicatorGlowColor", "#EEEE11", "html-color", "Glow color of update-indicator", null, { tags: ["Basic"] });
339
- Cell.prototype.publish("indicatorBorderColor", "#F48A00", "html-color", "Border color of update-indicator", null, { tags: ["Basic"] });
340
- Cell.prototype.publish("indicatorOpacity", 0.8, "number", "Opacity of update-indicator", null, { tags: ["Basic"] });
341
- const _Border = class _Border extends HTMLWidget {
342
- _colCount;
343
- _rowCount;
344
- _colSize;
345
- _rowSize;
346
- _shrinkWrapBoxes;
347
- _watch;
348
- _offsetX;
349
- _offsetY;
350
- _dragCell;
351
- _dragCellSize;
352
- _dragCellStartSize;
353
- _handleTop;
354
- _handleLeft;
355
- _dragPrevX;
356
- _dragPrevY;
357
- _cellSizes;
358
- contentDiv;
359
- _scrollBarWidth;
360
- _borderHandles;
361
- _sectionTypeArr;
362
- constructor() {
363
- super();
364
- this._tag = "div";
365
- this._colCount = 0;
366
- this._rowCount = 0;
367
- this._colSize = 0;
368
- this._rowSize = 0;
369
- this._shrinkWrapBoxes = {};
370
- this.content([]);
371
- this.sectionTypes([]);
372
- }
373
- watchWidget(widget) {
374
- if (this._watch === void 0) {
375
- this._watch = {};
376
- }
377
- if (this._watch[widget.id()]) {
378
- this._watch[widget.id()].remove();
379
- delete this._watch[widget.id()];
380
- }
381
- if (widget) {
382
- const context = this;
383
- this._watch[widget.id()] = widget.monitor(function(paramId, newVal, oldVal) {
384
- if (oldVal !== newVal) {
385
- context.lazyPostUpdate();
386
- }
387
- });
388
- }
389
- }
390
- lazyPostUpdate = Utility.debounce(function() {
391
- this.postUpdate();
392
- }, 100);
393
- applyLayoutType() {
394
- const layoutObj = this.borderLayoutObject();
395
- this.content().forEach(function(cell, i) {
396
- cell._fixedLeft = layoutObj[this.sectionTypes()[i]].left;
397
- cell._fixedTop = layoutObj[this.sectionTypes()[i]].top;
398
- cell._fixedWidth = layoutObj[this.sectionTypes()[i]].width;
399
- cell._fixedHeight = layoutObj[this.sectionTypes()[i]].height;
400
- cell._dragHandles = this.cellSpecificDragHandles(this.sectionTypes()[i]);
401
- }, this);
402
- }
403
- cellSpecificDragHandles(sectionType) {
404
- switch (sectionType) {
405
- case "top":
406
- return ["s"];
407
- case "right":
408
- return ["w"];
409
- case "bottom":
410
- return ["n"];
411
- case "left":
412
- return ["e"];
413
- case "center":
414
- return [];
415
- }
416
- }
417
- borderLayoutObject(layoutType) {
418
- const retObj = {};
419
- const context = this;
420
- let topSize;
421
- let topPerc;
422
- let bottomSize;
423
- let bottomPerc;
424
- let leftSize;
425
- let leftPerc;
426
- let rightSize;
427
- let rightPerc;
428
- const bcRect = this.target().getBoundingClientRect();
429
- bcRect.top;
430
- bcRect.left;
431
- bcRect.bottom;
432
- bcRect.right;
433
- if (this.target() instanceof SVGElement) {
434
- parseFloat(this.target().getAttribute("width"));
435
- parseFloat(this.target().getAttribute("height"));
436
- } else {
437
- bcRect.width;
438
- bcRect.height;
439
- }
440
- if (this.sectionTypes().indexOf("top") !== -1) {
441
- topSize = this.topSize();
442
- topPerc = this.topPercentage();
443
- if (typeof this._shrinkWrapBoxes["top"] !== "undefined") {
444
- topSize = this._shrinkWrapBoxes["top"].height + this.gutter();
445
- topPerc = 0;
446
- }
447
- }
448
- if (this.sectionTypes().indexOf("bottom") !== -1) {
449
- bottomSize = this.bottomSize();
450
- bottomPerc = this.bottomPercentage();
451
- if (typeof this._shrinkWrapBoxes["bottom"] !== "undefined") {
452
- bottomSize = this._shrinkWrapBoxes["bottom"].height + this.gutter();
453
- bottomPerc = 0;
454
- }
455
- }
456
- if (this.sectionTypes().indexOf("left") !== -1) {
457
- leftSize = this.leftSize();
458
- leftPerc = this.leftPercentage();
459
- if (typeof this._shrinkWrapBoxes["left"] !== "undefined") {
460
- leftSize = this._shrinkWrapBoxes["left"].width + this.gutter();
461
- leftPerc = 0;
462
- }
463
- }
464
- if (this.sectionTypes().indexOf("right") !== -1) {
465
- rightSize = this.rightSize();
466
- rightPerc = this.rightPercentage();
467
- if (typeof this._shrinkWrapBoxes["right"] !== "undefined") {
468
- rightSize = this._shrinkWrapBoxes["right"].width + this.gutter();
469
- rightPerc = 0;
470
- }
471
- }
472
- const t = _sectionPlacementObject({
473
- width: { "px": 0, "%": 100 },
474
- height: { "px": topSize, "%": topPerc },
475
- top: { "px": 0, "%": 0 },
476
- left: { "px": 0, "%": 0 }
477
- });
478
- const b = _sectionPlacementObject({
479
- width: { "px": 0, "%": 100 },
480
- height: { "px": bottomSize, "%": bottomPerc },
481
- top: { "px": 0, "%": 100 },
482
- left: { "px": 0, "%": 0 }
483
- });
484
- b.top -= b.height;
485
- const l = _sectionPlacementObject({
486
- width: { "px": leftSize, "%": leftPerc },
487
- height: { "px": -t.height - b.height, "%": 100 },
488
- top: { "px": t.height, "%": 0 },
489
- left: { "px": 0, "%": 0 }
490
- });
491
- const r = _sectionPlacementObject({
492
- width: { "px": rightSize, "%": rightPerc },
493
- height: { "px": -t.height - b.height, "%": 100 },
494
- top: { "px": t.height, "%": 0 },
495
- left: { "px": 0, "%": 100 }
496
- });
497
- r.left -= r.width;
498
- const c2 = _sectionPlacementObject({
499
- width: { "px": -r.width - l.width, "%": 100 },
500
- height: { "px": -t.height - b.height, "%": 100 },
501
- top: { "px": t.height, "%": 0 },
502
- left: { "px": l.width, "%": 0 }
503
- });
504
- retObj["top"] = t;
505
- retObj["bottom"] = b;
506
- retObj["right"] = r;
507
- retObj["left"] = l;
508
- retObj["center"] = c2;
509
- return retObj;
510
- function _sectionPlacementObject(obj) {
511
- obj.width["px"] = typeof obj.width["px"] !== "undefined" ? obj.width["px"] : 0;
512
- obj.width["%"] = typeof obj.width["%"] !== "undefined" ? obj.width["%"] : 0;
513
- obj.height["px"] = typeof obj.height["px"] !== "undefined" ? obj.height["px"] : 0;
514
- obj.height["%"] = typeof obj.height["%"] !== "undefined" ? obj.height["%"] : 0;
515
- const ret = {
516
- width: obj.width["px"] + obj.width["%"] / 100 * context.width(),
517
- height: obj.height["px"] + obj.height["%"] / 100 * context.height(),
518
- top: obj.top["px"] + obj.top["%"] / 100 * context.height() + context.gutter() / 2,
519
- left: obj.left["px"] + obj.left["%"] / 100 * context.width() + context.gutter() / 2
520
- };
521
- return ret;
522
- }
523
- __name(_sectionPlacementObject, "_sectionPlacementObject");
524
- }
525
- clearContent(sectionType) {
526
- if (!sectionType) {
527
- this.content().forEach(function(contentWidget) {
528
- contentWidget.target(null);
529
- return false;
530
- });
531
- select("#" + this.id() + " > div.borderHandle").classed("borderHandleDisabled", true);
532
- delete this._watch;
533
- this.content([]);
534
- this.sectionTypes([]);
535
- } else {
536
- const idx = this.sectionTypes().indexOf(sectionType);
537
- if (idx >= 0) {
538
- if (this._watch && this.content()[idx]) {
539
- delete this._watch[this.content()[idx].id()];
540
- }
541
- this.content()[idx].target(null);
542
- select("#" + this.id() + " > div.borderHandle_" + sectionType).classed("borderHandleDisabled", true);
543
- this.content().splice(idx, 1);
544
- this.sectionTypes().splice(idx, 1);
545
- }
546
- }
547
- }
548
- hasContent(sectionType, widget, title) {
549
- return this.sectionTypes().indexOf(sectionType) >= 0;
550
- }
551
- setContent(sectionType, widget, title) {
552
- this.clearContent(sectionType);
553
- title = typeof title !== "undefined" ? title : "";
554
- if (widget) {
555
- const cell = new Cell().surfaceBorderWidth(0).widget(widget).title(title);
556
- this.watchWidget(widget);
557
- this.content().push(cell);
558
- this.sectionTypes().push(sectionType);
559
- }
560
- return this;
561
- }
562
- getCell(id) {
563
- const idx = this.sectionTypes().indexOf(id);
564
- if (idx >= 0) {
565
- return this.content()[idx];
566
- }
567
- return null;
568
- }
569
- getContent(id) {
570
- const idx = this.sectionTypes().indexOf(id);
571
- if (idx >= 0) {
572
- return this.content()[idx].widget();
573
- }
574
- return null;
575
- }
576
- setLayoutOffsets() {
577
- this._offsetX = this._element.node().getBoundingClientRect().left + this.gutter() / 2;
578
- this._offsetY = this._element.node().getBoundingClientRect().top + this.gutter() / 2;
579
- }
580
- dragStart(handle) {
581
- const event = d3Event();
582
- event.sourceEvent.stopPropagation();
583
- const context = this;
584
- this._dragCell = handle;
585
- this._dragCellStartSize = this[handle + "Size"]();
586
- if (this[handle + "ShrinkWrap"]()) {
587
- this[handle + "Percentage"](0);
588
- this[handle + "ShrinkWrap"](false);
589
- }
590
- const handleElm = select("#" + context.id() + " > div.borderHandle_" + handle);
591
- context._handleTop = parseFloat(handleElm.style("top").split("px")[0]);
592
- context._handleLeft = parseFloat(handleElm.style("left").split("px")[0]);
593
- this._dragPrevX = event.sourceEvent.clientX;
594
- this._dragPrevY = event.sourceEvent.clientY;
595
- }
596
- dragTick(handle) {
597
- const context = this;
598
- const event = d3Event();
599
- const xDelta = this._dragPrevX - event.sourceEvent.clientX;
600
- const yDelta = this._dragPrevY - event.sourceEvent.clientY;
601
- switch (handle) {
602
- case "top":
603
- case "bottom":
604
- _moveHandles(handle, yDelta);
605
- break;
606
- case "right":
607
- case "left":
608
- _moveHandles(handle, xDelta);
609
- break;
610
- }
611
- function _moveHandles(handle2, delta) {
612
- if (delta === 0) return;
613
- const handles = selectAll("#" + context.id() + " > div.borderHandle");
614
- const grabbedHandle = select("#" + context.id() + " > div.borderHandle_" + handle2);
615
- if (grabbedHandle.classed("borderHandle_top")) {
616
- grabbedHandle.style("top", context._handleTop - delta + "px");
617
- context._cellSizes.topHeight = context._handleTop - delta;
618
- context._cellSizes.leftHeight = context._cellSizes.height;
619
- context._cellSizes.leftHeight -= context._cellSizes.topHeight;
620
- context._cellSizes.leftHeight -= context._cellSizes.bottomHeight;
621
- context._cellSizes.rightHeight = context._cellSizes.leftHeight;
622
- } else if (grabbedHandle.classed("borderHandle_right")) {
623
- grabbedHandle.style("left", context._handleLeft - delta + "px");
624
- context._cellSizes.rightWidth = context._cellSizes.width - context._handleLeft + delta;
625
- } else if (grabbedHandle.classed("borderHandle_bottom")) {
626
- grabbedHandle.style("top", context._handleTop - delta + "px");
627
- context._cellSizes.bottomHeight = context._cellSizes.height - context._handleTop + delta;
628
- context._cellSizes.leftHeight = context._cellSizes.height;
629
- context._cellSizes.leftHeight -= context._cellSizes.bottomHeight;
630
- context._cellSizes.leftHeight -= context._cellSizes.topHeight;
631
- context._cellSizes.rightHeight = context._cellSizes.leftHeight;
632
- } else if (grabbedHandle.classed("borderHandle_left")) {
633
- grabbedHandle.style("left", context._handleLeft - delta + "px");
634
- context._cellSizes.leftWidth = context._handleLeft - delta;
635
- }
636
- handles.each(function() {
637
- const handle3 = select(this);
638
- if (handle3.classed("borderHandle_top")) {
639
- handle3.style("width", context._cellSizes.width + "px");
640
- handle3.style("top", context._cellSizes.topHeight - 3 + "px");
641
- } else if (handle3.classed("borderHandle_right")) {
642
- handle3.style("left", context._cellSizes.width - context._cellSizes.rightWidth + "px");
643
- handle3.style("top", context._cellSizes.topHeight + 3 + "px");
644
- handle3.style("height", context._cellSizes.rightHeight + "px");
645
- } else if (handle3.classed("borderHandle_bottom")) {
646
- handle3.style("width", context._cellSizes.width + "px");
647
- handle3.style("top", context._cellSizes.height - context._cellSizes.bottomHeight - 3 + "px");
648
- } else if (handle3.classed("borderHandle_left")) {
649
- handle3.style("left", context._cellSizes.leftWidth + "px");
650
- handle3.style("height", context._cellSizes.leftHeight + "px");
651
- handle3.style("top", context._cellSizes.topHeight + 3 + "px");
652
- }
653
- });
654
- }
655
- __name(_moveHandles, "_moveHandles");
656
- }
657
- dragEnd(handle) {
658
- if (handle) {
659
- const event = d3Event();
660
- const xDelta = this._dragPrevX - event.sourceEvent.clientX;
661
- const yDelta = this._dragPrevY - event.sourceEvent.clientY;
662
- switch (handle) {
663
- case "top":
664
- if (yDelta !== 0) {
665
- this.topPercentage(0);
666
- this.topSize(this.topSize() === 0 ? this.getContent("top").getBBox().height - yDelta : this.topSize() - yDelta);
667
- }
668
- break;
669
- case "right":
670
- if (xDelta !== 0) {
671
- this.rightPercentage(0);
672
- this.rightSize(this.rightSize() === 0 ? this.getContent("right").getBBox().width + xDelta : this.rightSize() + xDelta);
673
- }
674
- break;
675
- case "bottom":
676
- if (yDelta !== 0) {
677
- this.bottomPercentage(0);
678
- this.bottomSize(this.bottomSize() === 0 ? this.getContent("bottom").getBBox().height + yDelta : this.bottomSize() + yDelta);
679
- }
680
- break;
681
- case "left":
682
- if (xDelta !== 0) {
683
- this.leftPercentage(0);
684
- this.leftSize(this.leftSize() === 0 ? this.getContent("left").getBBox().width - xDelta : this.leftSize() - xDelta);
685
- }
686
- break;
687
- }
688
- this._dragPrevX = event.sourceEvent.clientX;
689
- this._dragPrevY = event.sourceEvent.clientY;
690
- }
691
- this.render();
692
- }
693
- size(_) {
694
- const retVal = HTMLWidget.prototype.size.apply(this, arguments);
695
- if (arguments.length && this.contentDiv) {
696
- this.contentDiv.style("width", this._size.width + "px").style("height", this._size.height + "px");
697
- }
698
- return retVal;
699
- }
700
- enter(domNode, element) {
701
- super.enter(domNode, element);
702
- const context = this;
703
- element.style("position", "relative");
704
- this.contentDiv = element.append("div").classed("border-content", true);
705
- this._scrollBarWidth = Platform.getScrollbarWidth();
706
- this._borderHandles = ["top", "left", "right", "bottom"];
707
- const handles = element.selectAll("div.borderHandle").data(this._borderHandles);
708
- handles.enter().append("div").classed("borderHandle", true).each(function(handle) {
709
- const h = select(this);
710
- h.classed("borderHandle_" + handle, true).classed("borderHandleDisabled", context.getContent(handle) === null);
711
- });
712
- }
713
- update(domNode, element) {
714
- super.update(domNode, element);
715
- this._sectionTypeArr = this.sectionTypes();
716
- const context = this;
717
- element.classed("design-mode", this.designMode());
718
- this.setLayoutOffsets();
719
- const rows = this.contentDiv.selectAll(".cell_" + this._id).data(this.content(), function(d) {
720
- return d._id;
721
- });
722
- const rowsUpdate = rows.enter().append("div").classed("cell_" + this._id, true).style("position", "absolute").each(function(d, i) {
723
- select(this).classed("border-cell border-cell-" + context._sectionTypeArr[i], true);
724
- d.target(this);
725
- select("#" + context.id() + " > div.borderHandle_" + context._sectionTypeArr[i]).classed("borderHandleDisabled", false);
726
- }).merge(rows);
727
- rowsUpdate.each(function(d, idx) {
728
- const sectionType = context.sectionTypes()[idx];
729
- if (typeof context[sectionType + "ShrinkWrap"] !== "undefined" && context[sectionType + "ShrinkWrap"]()) {
730
- d.render();
731
- context._shrinkWrapBoxes[sectionType] = d.widget().getBBox(true);
732
- } else {
733
- delete context._shrinkWrapBoxes[sectionType];
734
- }
735
- });
736
- const drag$1 = drag().on("start", function(d, i) {
737
- context.dragStart.call(context, d, i);
738
- }).on("drag", function(d, i) {
739
- context.dragTick.call(context, d, i);
740
- }).on("end", function(d, i) {
741
- context.dragEnd.call(context, d, i);
742
- });
743
- if (this.designMode()) {
744
- element.selectAll("#" + this.id() + " > div.borderHandle").call(drag$1);
745
- } else {
746
- element.selectAll("#" + this.id() + " > div.borderHandle").on(".drag", null);
747
- }
748
- const layoutObj = this.borderLayoutObject();
749
- this.content().forEach(function(cell, i) {
750
- cell._fixedLeft = layoutObj[this.sectionTypes()[i]].left;
751
- cell._fixedTop = layoutObj[this.sectionTypes()[i]].top;
752
- cell._fixedWidth = layoutObj[this.sectionTypes()[i]].width;
753
- cell._fixedHeight = layoutObj[this.sectionTypes()[i]].height;
754
- cell._dragHandles = [];
755
- }, this);
756
- rowsUpdate.style("left", function(d) {
757
- return d._fixedLeft + "px";
758
- }).style("top", function(d) {
759
- return d._fixedTop + "px";
760
- }).style("width", function(d) {
761
- return d._fixedWidth - context.gutter() + "px";
762
- }).style("height", function(d) {
763
- return d._fixedHeight - context.gutter() + "px";
764
- }).each(function(d) {
765
- d._placeholderElement.attr("draggable", context.designMode()).selectAll(".dragHandle").attr("draggable", context.designMode());
766
- d.surfacePadding(context.surfacePadding()).resize();
767
- });
768
- rows.exit().each(function(d) {
769
- d.target(null);
770
- }).remove();
771
- this.getCellSizes();
772
- element.selectAll("#" + this.id() + " > div.borderHandle").each(function() {
773
- const handle = select(this);
774
- if (handle.classed("borderHandle_top")) {
775
- handle.style("width", context._cellSizes.width + "px");
776
- handle.style("top", context._cellSizes.topHeight - 3 + "px");
777
- } else if (handle.classed("borderHandle_right")) {
778
- handle.style("left", context._cellSizes.width - context._cellSizes.rightWidth + "px");
779
- handle.style("top", context._cellSizes.topHeight + 3 + "px");
780
- handle.style("height", context._cellSizes.rightHeight + "px");
781
- } else if (handle.classed("borderHandle_bottom")) {
782
- handle.style("width", context._cellSizes.width + "px");
783
- handle.style("top", context._cellSizes.height - context._cellSizes.bottomHeight - 3 + "px");
784
- } else if (handle.classed("borderHandle_left")) {
785
- handle.style("left", context._cellSizes.leftWidth + "px");
786
- handle.style("height", context._cellSizes.leftHeight + "px");
787
- handle.style("top", context._cellSizes.topHeight + 3 + "px");
788
- }
789
- });
790
- }
791
- getCellSizes() {
792
- const context = this;
793
- context._cellSizes = {};
794
- const contentRect = this.element().node().getBoundingClientRect();
795
- context._cellSizes.width = contentRect.width;
796
- context._cellSizes.height = contentRect.height;
797
- this.element().selectAll("#" + this.id() + " > div > div.border-cell").each(function() {
798
- const cell = select(this);
799
- if (typeof cell.node === "function") {
800
- const rect = cell.node().getBoundingClientRect();
801
- if (cell.classed("border-cell-top")) {
802
- context._cellSizes.topHeight = rect.height;
803
- } else if (cell.classed("border-cell-left")) {
804
- context._cellSizes.leftWidth = rect.width;
805
- context._cellSizes.leftHeight = rect.height;
806
- } else if (cell.classed("border-cell-right")) {
807
- context._cellSizes.rightWidth = rect.width;
808
- context._cellSizes.rightHeight = rect.height;
809
- } else if (cell.classed("border-cell-bottom")) {
810
- context._cellSizes.bottomHeight = rect.height;
811
- }
812
- }
813
- });
814
- const sizes = ["height", "width", "topHeight", "bottomHeight", "leftHeight", "rightHeight", "leftWidth", "rightWidth"];
815
- sizes.forEach(function(size) {
816
- context._cellSizes[size] = context._cellSizes[size] === void 0 ? 0 : context._cellSizes[size];
817
- });
818
- }
819
- postUpdate(domNode, element) {
820
- const context = this;
821
- this.content().forEach(function(n) {
822
- if (n._element.node() !== null && n.widget()) {
823
- const prevBox = n.widget().getBBox(false, true);
824
- const currBox = n.widget().getBBox(true, true);
825
- if (prevBox.width !== currBox.width || prevBox.height !== currBox.height) {
826
- context.lazyRender();
827
- }
828
- }
829
- });
830
- }
831
- exit(domNode, element) {
832
- this.content().forEach((w) => w.target(null));
833
- super.exit(domNode, element);
834
- }
835
- };
836
- __name(_Border, "Border");
837
- let Border = _Border;
838
- Border.prototype._class += " layout_Border";
839
- Border.prototype.publish("designMode", false, "boolean", "Design Mode", null, { tags: ["Basic"] });
840
- Border.prototype.publish("content", [], "widgetArray", "widgets", null, { tags: ["Intermediate"] });
841
- Border.prototype.publish("gutter", 0, "number", "Gap Between Widgets", null, { tags: ["Basic"] });
842
- Border.prototype.publish("topShrinkWrap", false, "boolean", "'Top' Cell shrinks to fit content", null, { tags: ["Intermediate"] });
843
- Border.prototype.publish("leftShrinkWrap", false, "boolean", "'Left' Cell shrinks to fit content", null, { tags: ["Intermediate"] });
844
- Border.prototype.publish("rightShrinkWrap", false, "boolean", "'Right' Cell shrinks to fit content", null, { tags: ["Intermediate"] });
845
- Border.prototype.publish("bottomShrinkWrap", false, "boolean", "'Bottom' Cell shrinks to fit content", null, { tags: ["Intermediate"] });
846
- Border.prototype.publish("topSize", 0, "number", "Height of the 'Top' Cell (px)", null, { tags: ["Private"] });
847
- Border.prototype.publish("leftSize", 0, "number", "Width of the 'Left' Cell (px)", null, { tags: ["Private"] });
848
- Border.prototype.publish("rightSize", 0, "number", "Width of the 'Right' Cell (px)", null, { tags: ["Private"] });
849
- Border.prototype.publish("bottomSize", 0, "number", "Height of the 'Bottom' Cell (px)", null, { tags: ["Private"] });
850
- Border.prototype.publish("topPercentage", 20, "number", "Percentage (of parent) Height of the 'Top' Cell", null, { tags: ["Private"] });
851
- Border.prototype.publish("leftPercentage", 20, "number", "Percentage (of parent) Width of the 'Left' Cell", null, { tags: ["Private"] });
852
- Border.prototype.publish("rightPercentage", 20, "number", "Percentage (of parent) Width of the 'Right' Cell", null, { tags: ["Private"] });
853
- Border.prototype.publish("bottomPercentage", 20, "number", "Percentage (of parent) Height of the 'Bottom' Cell", null, { tags: ["Private"] });
854
- Border.prototype.publish("surfacePadding", 0, "number", "Cell Padding (px)", null, { tags: ["Intermediate"] });
855
- Border.prototype.publish("sectionTypes", [], "array", "Section Types sharing an index with 'content' - Used to determine position/size.", null, { tags: ["Private"] });
856
- const _WidgetDiv = class _WidgetDiv {
857
- _div;
858
- _overlay = false;
859
- _overflowX = "visible";
860
- _overflowY = "visible";
861
- _widget;
862
- constructor(div) {
863
- this._div = div;
864
- }
865
- overlay(_) {
866
- if (!arguments.length) return this._overlay;
867
- this._overlay = _;
868
- return this;
869
- }
870
- overflowX(_) {
871
- if (!arguments.length) return this._overflowX;
872
- this._overflowX = _;
873
- this._div.style("overflow-x", _);
874
- return this;
875
- }
876
- overflowY(_) {
877
- if (!arguments.length) return this._overflowY;
878
- this._overflowY = _;
879
- this._div.style("overflow-y", _);
880
- return this;
881
- }
882
- element() {
883
- return this._div;
884
- }
885
- node() {
886
- return this._div.node();
887
- }
888
- widget(_) {
889
- if (!arguments.length) return this._widget;
890
- if (this._widget !== _) {
891
- if (this._widget) {
892
- this._widget.target(null);
893
- }
894
- this._widget = _;
895
- if (this._widget) {
896
- this._widget.target(this._div.node());
897
- }
898
- }
899
- return this;
900
- }
901
- resize(size) {
902
- if (this._widget) {
903
- this._div.style("width", `${size.width}px`).style("height", `${size.height}px`);
904
- this._widget.resize(size);
905
- }
906
- return this;
907
- }
908
- async render(getBBox, availableHeight, availableWidth) {
909
- let overflowX = this.overflowX();
910
- if (!this.overlay() && overflowX === "visible") {
911
- overflowX = null;
912
- }
913
- let overflowY = this.overflowY();
914
- if (!this.overlay() && overflowY === "visible") {
915
- overflowY = null;
916
- }
917
- this._div.style("height", this.overlay() ? "0px" : null).style("overflow-x", overflowX).style("overflow-y", overflowY);
918
- if (this._widget) {
919
- return this._widget.renderPromise().then((w) => {
920
- if (getBBox && this._widget.visible()) {
921
- const retVal = this._widget.getBBox();
922
- retVal.width += 8;
923
- if (availableHeight !== void 0 && retVal.height > availableHeight) {
924
- retVal.width += Platform.getScrollbarWidth();
925
- }
926
- if (availableWidth !== void 0 && retVal.width > availableWidth) {
927
- retVal.height += Platform.getScrollbarWidth();
928
- }
929
- if (this.overlay()) {
930
- retVal.height = 0;
931
- } else {
932
- retVal.height += 4;
933
- }
934
- return retVal;
935
- }
936
- return getBBox ? { x: 0, y: 0, width: 0, height: 0 } : void 0;
937
- });
938
- } else {
939
- return Promise.resolve(getBBox ? { x: 0, y: 0, width: 0, height: 0 } : void 0);
940
- }
941
- }
942
- };
943
- __name(_WidgetDiv, "WidgetDiv");
944
- let WidgetDiv = _WidgetDiv;
945
- const _Border2 = class _Border2 extends HTMLWidget {
946
- _bodyElement;
947
- _topWA;
948
- _leftWA;
949
- _centerWA;
950
- _rightWA;
951
- _bottomWA;
952
- _topPrevOverflow;
953
- _leftPrevOverflow;
954
- _rightPrevOverflow;
955
- _bottomPrevOverflow;
956
- constructor() {
957
- super();
958
- this._tag = "div";
959
- }
960
- enter(domNode, element) {
961
- super.enter(domNode, element);
962
- const topElement = element.append("header");
963
- this._bodyElement = element.append("div").attr("class", "body");
964
- const centerElement = this._bodyElement.append("div").attr("class", "center");
965
- const leftElement = this._bodyElement.append("div").attr("class", "lhs");
966
- const rightElement = this._bodyElement.append("div").attr("class", "rhs");
967
- const bottomElement = element.append("div").attr("class", "footer");
968
- this._topWA = new WidgetDiv(topElement);
969
- this._centerWA = new WidgetDiv(centerElement);
970
- this._leftWA = new WidgetDiv(leftElement);
971
- this._rightWA = new WidgetDiv(rightElement);
972
- this._bottomWA = new WidgetDiv(bottomElement);
973
- }
974
- update(domNode, element) {
975
- super.update(domNode, element);
976
- this._topWA.element().style("display", this.showTop() ? null : "none");
977
- this._rightWA.element().style("display", this.showRight() ? null : "none");
978
- this._bottomWA.element().style("display", this.showBottom() ? null : "none");
979
- this._leftWA.element().style("display", this.showLeft() ? null : "none");
980
- if (this.topOverflowX() !== this._topWA.overflowX()) {
981
- this._topWA.overflowX(this.topOverflowX());
982
- }
983
- if (this.rightOverflowX() !== this._rightWA.overflowX()) {
984
- this._rightWA.overflowX(this.rightOverflowX());
985
- }
986
- if (this.bottomOverflowX() !== this._bottomWA.overflowX()) {
987
- this._bottomWA.overflowX(this.bottomOverflowX());
988
- }
989
- if (this.leftOverflowX() !== this._leftWA.overflowX()) {
990
- this._leftWA.overflowX(this.leftOverflowX());
991
- }
992
- if (this.topOverflowY() !== this._topWA.overflowY()) {
993
- this._topWA.overflowY(this.topOverflowY());
994
- }
995
- if (this.rightOverflowY() !== this._rightWA.overflowY()) {
996
- this._rightWA.overflowY(this.rightOverflowY());
997
- }
998
- if (this.bottomOverflowY() !== this._bottomWA.overflowY()) {
999
- this._bottomWA.overflowY(this.bottomOverflowY());
1000
- }
1001
- if (this.leftOverflowY() !== this._leftWA.overflowY()) {
1002
- this._leftWA.overflowY(this.leftOverflowY());
1003
- }
1004
- this.element().style("width", `${this.width()}px`).style("height", `${this.height()}px`);
1005
- }
1006
- targetNull(w) {
1007
- if (w) {
1008
- w.target(null);
1009
- }
1010
- }
1011
- exit(domNode, element) {
1012
- this.targetNull(this.center());
1013
- this.targetNull(this.bottom());
1014
- this.targetNull(this.right());
1015
- this.targetNull(this.left());
1016
- this.targetNull(this.top());
1017
- super.exit(domNode, element);
1018
- }
1019
- swap(sectionA, sectionB) {
1020
- const a2 = this[sectionA]();
1021
- const b = this[sectionB]();
1022
- this.targetNull(a2);
1023
- this.targetNull(b);
1024
- this[`_${sectionA}WA`].widget(null);
1025
- this[`_${sectionB}WA`].widget(null);
1026
- this[sectionA](b);
1027
- this[sectionB](a2);
1028
- return this;
1029
- }
1030
- render(callback) {
1031
- const retVal = super.render((w) => {
1032
- if (this._topWA) {
1033
- this._topWA.widget(this.top()).overlay(this.topOverlay()).render(true).then(async (topBBox) => {
1034
- const bottomBBox = await this._bottomWA.widget(this.bottom()).render(true, void 0, this.width());
1035
- const availableHeight = this.height() - (topBBox.height + bottomBBox.height);
1036
- const leftBBox = await this._leftWA.widget(this.left()).render(true, availableHeight);
1037
- const rightBBox = await this._rightWA.widget(this.right()).render(true, availableHeight);
1038
- if (this.bottomHeight_exists()) {
1039
- bottomBBox.height = this.bottomHeight();
1040
- }
1041
- const bodyWidth = this.width() - (leftBBox.width + rightBBox.width);
1042
- const bodyHeight = this.height() - (topBBox.height + bottomBBox.height);
1043
- const centerOverflowX = this.centerOverflowX();
1044
- const centerOverflowY = this.centerOverflowY();
1045
- const scrollCenterX = ["auto", "scroll"].indexOf(centerOverflowX) !== -1;
1046
- const scrollCenterY = ["auto", "scroll"].indexOf(centerOverflowY) !== -1;
1047
- if (scrollCenterX || scrollCenterY) {
1048
- this._centerWA.overflowX(this.centerOverflowX()).overflowY(this.centerOverflowY()).widget(this.center()).resize({
1049
- width: bodyWidth,
1050
- height: bodyHeight
1051
- }).render();
1052
- }
1053
- this._bodyElement.style("height", `${bodyHeight}px`);
1054
- const promises = [
1055
- this._topWA.overflowX(this.topOverflowX()).overflowY(this.topOverflowY()).resize({
1056
- width: this.width(),
1057
- height: topBBox.height
1058
- }).render(),
1059
- this._leftWA.overflowX(this.leftOverflowX()).overflowY(this.leftOverflowY()).resize({
1060
- width: leftBBox.width,
1061
- height: bodyHeight
1062
- }).render(),
1063
- this._rightWA.overflowX(this.rightOverflowX()).overflowY(this.rightOverflowY()).resize({
1064
- width: rightBBox.width,
1065
- height: bodyHeight
1066
- }).render(),
1067
- this._centerWA.overflowX(this.centerOverflowX()).overflowY(this.centerOverflowY()).widget(this.center()).resize({
1068
- width: bodyWidth,
1069
- height: bodyHeight
1070
- }).render(),
1071
- this._bottomWA.overflowX(this.bottomOverflowX()).overflowY(this.bottomOverflowY()).resize({
1072
- width: this.width(),
1073
- height: bottomBBox.height
1074
- }).render()
1075
- ];
1076
- Promise.all(promises).then((promises2) => {
1077
- if (callback) {
1078
- callback(this);
1079
- }
1080
- });
1081
- });
1082
- } else {
1083
- if (callback) {
1084
- callback(this);
1085
- }
1086
- }
1087
- });
1088
- return retVal;
1089
- }
1090
- };
1091
- __name(_Border2, "Border2");
1092
- let Border2 = _Border2;
1093
- Border2.prototype._class += " layout_Border2";
1094
- Border2.prototype.publish("showTop", true, "boolean", "If true, top widget adapter will display");
1095
- Border2.prototype.publish("showRight", true, "boolean", "If true, right widget adapter will display");
1096
- Border2.prototype.publish("showBottom", true, "boolean", "If true, bottom widget adapter will display");
1097
- Border2.prototype.publish("showLeft", true, "boolean", "If true, left widget adapter will display");
1098
- Border2.prototype.publish("topOverflowX", "visible", "set", "Sets the overflow-x css style for the top widget adapter", ["hidden", "scroll", "visible", "auto"]);
1099
- Border2.prototype.publish("rightOverflowX", "visible", "set", "Sets the overflow-x css style for the right widget adapter", ["hidden", "scroll", "visible", "auto"]);
1100
- Border2.prototype.publish("bottomOverflowX", "visible", "set", "Sets the overflow-x css style for the bottom widget adapter", ["hidden", "scroll", "visible", "auto"]);
1101
- Border2.prototype.publish("leftOverflowX", "visible", "set", "Sets the overflow-x css style for the left widget adapter", ["hidden", "scroll", "visible", "auto"]);
1102
- Border2.prototype.publish("centerOverflowX", "visible", "set", "Sets the overflow-x css style for the center widget adapter", ["hidden", "scroll", "visible", "auto"]);
1103
- Border2.prototype.publish("topOverflowY", "visible", "set", "Sets the overflow-y css style for the top widget adapter", ["hidden", "scroll", "visible", "auto"]);
1104
- Border2.prototype.publish("rightOverflowY", "visible", "set", "Sets the overflow-y css style for the right widget adapter", ["hidden", "scroll", "visible", "auto"]);
1105
- Border2.prototype.publish("bottomOverflowY", "visible", "set", "Sets the overflow-y css style for the bottom widget adapter", ["hidden", "scroll", "visible", "auto"]);
1106
- Border2.prototype.publish("leftOverflowY", "visible", "set", "Sets the overflow-y css style for the left widget adapter", ["hidden", "scroll", "visible", "auto"]);
1107
- Border2.prototype.publish("centerOverflowY", "visible", "set", "Sets the overflow-y css style for the center widget adapter", ["hidden", "scroll", "visible", "auto"]);
1108
- Border2.prototype.publish("top", null, "widget", "Top Widget", void 0, { render: false });
1109
- Border2.prototype.publish("topOverlay", false, "boolean", "Overlay Top Widget");
1110
- Border2.prototype.publish("left", null, "widget", "Left Widget", void 0, { render: false });
1111
- Border2.prototype.publish("center", null, "widget", "Center Widget", void 0, { render: false });
1112
- Border2.prototype.publish("right", null, "widget", "Right Widget", void 0, { render: false });
1113
- Border2.prototype.publish("bottom", null, "widget", "Bottom Widget", void 0, { render: false });
1114
- Border2.prototype.publish("bottomHeight", null, "number", "Bottom Fixed Height", void 0, { optional: true });
1115
- const _Carousel = class _Carousel extends HTMLWidget {
1116
- _prevActive = 0;
1117
- _root;
1118
- activeWidget() {
1119
- return this.widgets()[this.active()];
1120
- }
1121
- enter(domNode, element) {
1122
- super.enter(domNode, element);
1123
- this._root = element.append("div").attr("id", `${this.id()}_root`);
1124
- }
1125
- update(domNode, element) {
1126
- super.update(domNode, element);
1127
- const active = this.active();
1128
- const width = this.width();
1129
- this._root.style("width", `${width}px`).style("height", `${this.height()}px`);
1130
- const widgetElements = this._root.selectAll(`#${this.id()}_root > .carouselItem`).data(this.widgets(), (d) => d.id());
1131
- const update = widgetElements.enter().append("div").attr("class", "carouselItem").each(function(w) {
1132
- w.target(this);
1133
- }).merge(widgetElements).style("left", (d, i) => `${(i - this._prevActive) * width}px`).style("width", `${width}px`);
1134
- if (this._prevActive !== active) {
1135
- 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) {
1136
- select(this).style("display", () => i === active ? null : "none");
1137
- });
1138
- this._prevActive = active;
1139
- }
1140
- widgetElements.exit().each(function(w) {
1141
- w.target(null);
1142
- }).remove();
1143
- }
1144
- exit(domNode, element) {
1145
- this.widgets().forEach((w) => w.target(null));
1146
- super.exit(domNode, element);
1147
- }
1148
- render(callback) {
1149
- return super.render((w) => {
1150
- if (!this.visible() || this.isDOMHidden()) {
1151
- if (callback) {
1152
- callback(w);
1153
- }
1154
- } else {
1155
- const aw = this.activeWidget();
1156
- if (aw) {
1157
- aw.resize(this.size()).render((w2) => {
1158
- if (callback) {
1159
- callback(w);
1160
- }
1161
- });
1162
- }
1163
- }
1164
- });
1165
- }
1166
- };
1167
- __name(_Carousel, "Carousel");
1168
- let Carousel = _Carousel;
1169
- Carousel.prototype._class += " layout_Carousel";
1170
- Carousel.prototype.publish("widgets", [], "widgetArray", "Widgets", null, { render: false });
1171
- Carousel.prototype.publish("active", 0, "number", "Active widget");
1172
- Carousel.prototype.publish("transitionDuration", 500, "number", "Transition duration");
1173
- var pi$1 = Math.PI, tau$1 = 2 * pi$1, epsilon = 1e-6, tauEpsilon = tau$1 - epsilon;
1174
- function Path() {
1175
- this._x0 = this._y0 = // start of current subpath
1176
- this._x1 = this._y1 = null;
1177
- this._ = "";
1178
- }
1179
- __name(Path, "Path");
1180
- function path() {
1181
- return new Path();
1182
- }
1183
- __name(path, "path");
1184
- Path.prototype = path.prototype = {
1185
- constructor: Path,
1186
- moveTo: /* @__PURE__ */ __name(function(x, y) {
1187
- this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y);
1188
- }, "moveTo"),
1189
- closePath: /* @__PURE__ */ __name(function() {
1190
- if (this._x1 !== null) {
1191
- this._x1 = this._x0, this._y1 = this._y0;
1192
- this._ += "Z";
1193
- }
1194
- }, "closePath"),
1195
- lineTo: /* @__PURE__ */ __name(function(x, y) {
1196
- this._ += "L" + (this._x1 = +x) + "," + (this._y1 = +y);
1197
- }, "lineTo"),
1198
- quadraticCurveTo: /* @__PURE__ */ __name(function(x1, y1, x, y) {
1199
- this._ += "Q" + +x1 + "," + +y1 + "," + (this._x1 = +x) + "," + (this._y1 = +y);
1200
- }, "quadraticCurveTo"),
1201
- bezierCurveTo: /* @__PURE__ */ __name(function(x1, y1, x2, y2, x, y) {
1202
- this._ += "C" + +x1 + "," + +y1 + "," + +x2 + "," + +y2 + "," + (this._x1 = +x) + "," + (this._y1 = +y);
1203
- }, "bezierCurveTo"),
1204
- arcTo: /* @__PURE__ */ __name(function(x1, y1, x2, y2, r) {
1205
- x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;
1206
- 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;
1207
- if (r < 0) throw new Error("negative radius: " + r);
1208
- if (this._x1 === null) {
1209
- this._ += "M" + (this._x1 = x1) + "," + (this._y1 = y1);
1210
- } else if (!(l01_2 > epsilon)) ;
1211
- else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) {
1212
- this._ += "L" + (this._x1 = x1) + "," + (this._y1 = y1);
1213
- } else {
1214
- 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;
1215
- if (Math.abs(t01 - 1) > epsilon) {
1216
- this._ += "L" + (x1 + t01 * x01) + "," + (y1 + t01 * y01);
1217
- }
1218
- this._ += "A" + r + "," + r + ",0,0," + +(y01 * x20 > x01 * y20) + "," + (this._x1 = x1 + t21 * x21) + "," + (this._y1 = y1 + t21 * y21);
1219
- }
1220
- }, "arcTo"),
1221
- arc: /* @__PURE__ */ __name(function(x, y, r, a0, a1, ccw) {
1222
- x = +x, y = +y, r = +r, ccw = !!ccw;
1223
- 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;
1224
- if (r < 0) throw new Error("negative radius: " + r);
1225
- if (this._x1 === null) {
1226
- this._ += "M" + x0 + "," + y0;
1227
- } else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) {
1228
- this._ += "L" + x0 + "," + y0;
1229
- }
1230
- if (!r) return;
1231
- if (da < 0) da = da % tau$1 + tau$1;
1232
- if (da > tauEpsilon) {
1233
- this._ += "A" + r + "," + r + ",0,1," + cw + "," + (x - dx) + "," + (y - dy) + "A" + r + "," + r + ",0,1," + cw + "," + (this._x1 = x0) + "," + (this._y1 = y0);
1234
- } else if (da > epsilon) {
1235
- this._ += "A" + r + "," + r + ",0," + +(da >= pi$1) + "," + cw + "," + (this._x1 = x + r * Math.cos(a1)) + "," + (this._y1 = y + r * Math.sin(a1));
1236
- }
1237
- }, "arc"),
1238
- rect: /* @__PURE__ */ __name(function(x, y, w, h) {
1239
- this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y) + "h" + +w + "v" + +h + "h" + -w + "Z";
1240
- }, "rect"),
1241
- toString: /* @__PURE__ */ __name(function() {
1242
- return this._;
1243
- }, "toString")
1244
- };
1245
- function constant(x) {
1246
- return /* @__PURE__ */ __name(function constant2() {
1247
- return x;
1248
- }, "constant");
1249
- }
1250
- __name(constant, "constant");
1251
- var pi = Math.PI;
1252
- var tau = 2 * pi;
1253
- const d3SymbolCircle = {
1254
- draw: /* @__PURE__ */ __name(function(context, size) {
1255
- var r = Math.sqrt(size / pi);
1256
- context.moveTo(r, 0);
1257
- context.arc(0, 0, r, 0, tau);
1258
- }, "draw")
1259
- };
1260
- const d3SymbolCross = {
1261
- draw: /* @__PURE__ */ __name(function(context, size) {
1262
- var r = Math.sqrt(size / 5) / 2;
1263
- context.moveTo(-3 * r, -r);
1264
- context.lineTo(-r, -r);
1265
- context.lineTo(-r, -3 * r);
1266
- context.lineTo(r, -3 * r);
1267
- context.lineTo(r, -r);
1268
- context.lineTo(3 * r, -r);
1269
- context.lineTo(3 * r, r);
1270
- context.lineTo(r, r);
1271
- context.lineTo(r, 3 * r);
1272
- context.lineTo(-r, 3 * r);
1273
- context.lineTo(-r, r);
1274
- context.lineTo(-3 * r, r);
1275
- context.closePath();
1276
- }, "draw")
1277
- };
1278
- var tan30 = Math.sqrt(1 / 3), tan30_2 = tan30 * 2;
1279
- const d3SymbolDiamond = {
1280
- draw: /* @__PURE__ */ __name(function(context, size) {
1281
- var y = Math.sqrt(size / tan30_2), x = y * tan30;
1282
- context.moveTo(0, -y);
1283
- context.lineTo(x, 0);
1284
- context.lineTo(0, y);
1285
- context.lineTo(-x, 0);
1286
- context.closePath();
1287
- }, "draw")
1288
- };
1289
- var ka = 0.8908130915292852, kr = Math.sin(pi / 10) / Math.sin(7 * pi / 10), kx = Math.sin(tau / 10) * kr, ky = -Math.cos(tau / 10) * kr;
1290
- const d3SymbolStar = {
1291
- draw: /* @__PURE__ */ __name(function(context, size) {
1292
- var r = Math.sqrt(size * ka), x = kx * r, y = ky * r;
1293
- context.moveTo(0, -r);
1294
- context.lineTo(x, y);
1295
- for (var i = 1; i < 5; ++i) {
1296
- var a2 = tau * i / 5, c2 = Math.cos(a2), s2 = Math.sin(a2);
1297
- context.lineTo(s2 * r, -c2 * r);
1298
- context.lineTo(c2 * x - s2 * y, s2 * x + c2 * y);
1299
- }
1300
- context.closePath();
1301
- }, "draw")
1302
- };
1303
- const d3SymbolSquare = {
1304
- draw: /* @__PURE__ */ __name(function(context, size) {
1305
- var w = Math.sqrt(size), x = -w / 2;
1306
- context.rect(x, x, w, w);
1307
- }, "draw")
1308
- };
1309
- var sqrt3 = Math.sqrt(3);
1310
- const d3SymbolTriangle = {
1311
- draw: /* @__PURE__ */ __name(function(context, size) {
1312
- var y = -Math.sqrt(size / (sqrt3 * 3));
1313
- context.moveTo(0, y * 2);
1314
- context.lineTo(-sqrt3 * y, -y);
1315
- context.lineTo(sqrt3 * y, -y);
1316
- context.closePath();
1317
- }, "draw")
1318
- };
1319
- var c = -0.5, s = Math.sqrt(3) / 2, k = 1 / Math.sqrt(12), a = (k / 2 + 1) * 3;
1320
- const d3SymbolWye = {
1321
- draw: /* @__PURE__ */ __name(function(context, size) {
1322
- var r = Math.sqrt(size / a), x0 = r / 2, y0 = r * k, x1 = x0, y1 = r * k + r, x2 = -x1, y2 = y1;
1323
- context.moveTo(x0, y0);
1324
- context.lineTo(x1, y1);
1325
- context.lineTo(x2, y2);
1326
- context.lineTo(c * x0 - s * y0, s * x0 + c * y0);
1327
- context.lineTo(c * x1 - s * y1, s * x1 + c * y1);
1328
- context.lineTo(c * x2 - s * y2, s * x2 + c * y2);
1329
- context.lineTo(c * x0 + s * y0, c * y0 - s * x0);
1330
- context.lineTo(c * x1 + s * y1, c * y1 - s * x1);
1331
- context.lineTo(c * x2 + s * y2, c * y2 - s * x2);
1332
- context.closePath();
1333
- }, "draw")
1334
- };
1335
- function d3Symbol() {
1336
- var type = constant(d3SymbolCircle), size = constant(64), context = null;
1337
- function symbol() {
1338
- var buffer;
1339
- if (!context) context = buffer = path();
1340
- type.apply(this, arguments).draw(context, +size.apply(this, arguments));
1341
- if (buffer) return context = null, buffer + "" || null;
1342
- }
1343
- __name(symbol, "symbol");
1344
- symbol.type = function(_) {
1345
- return arguments.length ? (type = typeof _ === "function" ? _ : constant(_), symbol) : type;
1346
- };
1347
- symbol.size = function(_) {
1348
- return arguments.length ? (size = typeof _ === "function" ? _ : constant(+_), symbol) : size;
1349
- };
1350
- symbol.context = function(_) {
1351
- return arguments.length ? (context = _ == null ? null : _, symbol) : context;
1352
- };
1353
- return symbol;
1354
- }
1355
- __name(d3Symbol, "d3Symbol");
1356
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function(obj) {
1357
- return typeof obj;
1358
- } : function(obj) {
1359
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1360
- };
1361
- var d3_identity = /* @__PURE__ */ __name(function d3_identity2(d) {
1362
- return d;
1363
- }, "d3_identity");
1364
- var d3_reverse = /* @__PURE__ */ __name(function d3_reverse2(arr) {
1365
- var mirror = [];
1366
- for (var i = 0, l = arr.length; i < l; i++) {
1367
- mirror[i] = arr[l - i - 1];
1368
- }
1369
- return mirror;
1370
- }, "d3_reverse");
1371
- var d3_textWrapping = /* @__PURE__ */ __name(function d3_textWrapping2(text, width) {
1372
- text.each(function() {
1373
- var text2 = select(this), words = text2.text().split(/\s+/).reverse(), word, line = [], lineHeight = 1.2;
1374
- text2.attr("y");
1375
- var dy = parseFloat(text2.attr("dy")) || 0, tspan = text2.text(null).append("tspan").attr("x", 0).attr("dy", dy + "em");
1376
- while (word = words.pop()) {
1377
- line.push(word);
1378
- tspan.text(line.join(" "));
1379
- if (tspan.node().getComputedTextLength() > width && line.length > 1) {
1380
- line.pop();
1381
- tspan.text(line.join(" "));
1382
- line = [word];
1383
- tspan = text2.append("tspan").attr("x", 0).attr("dy", lineHeight + dy + "em").text(word);
1384
- }
1385
- }
1386
- });
1387
- }, "d3_textWrapping");
1388
- var d3_mergeLabels = /* @__PURE__ */ __name(function d3_mergeLabels2() {
1389
- var gen = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
1390
- var labels = arguments[1];
1391
- var domain = arguments[2];
1392
- var range = arguments[3];
1393
- var labelDelimiter = arguments[4];
1394
- if ((typeof labels === "undefined" ? "undefined" : _typeof(labels)) === "object") {
1395
- if (labels.length === 0) return gen;
1396
- var i = labels.length;
1397
- for (; i < gen.length; i++) {
1398
- labels.push(gen[i]);
1399
- }
1400
- return labels;
1401
- } else if (typeof labels === "function") {
1402
- var customLabels = [];
1403
- var genLength = gen.length;
1404
- for (var _i = 0; _i < genLength; _i++) {
1405
- customLabels.push(labels({
1406
- i: _i,
1407
- genLength,
1408
- generatedLabels: gen,
1409
- domain,
1410
- range,
1411
- labelDelimiter
1412
- }));
1413
- }
1414
- return customLabels;
1415
- }
1416
- return gen;
1417
- }, "d3_mergeLabels");
1418
- var d3_linearLegend = /* @__PURE__ */ __name(function d3_linearLegend2(scale, cells, labelFormat) {
1419
- var data = [];
1420
- if (cells.length > 1) {
1421
- data = cells;
1422
- } else {
1423
- var domain = scale.domain(), increment = (domain[domain.length - 1] - domain[0]) / (cells - 1);
1424
- var i = 0;
1425
- for (; i < cells; i++) {
1426
- data.push(domain[0] + i * increment);
1427
- }
1428
- }
1429
- var labels = data.map(labelFormat);
1430
- return {
1431
- data,
1432
- labels,
1433
- feature: /* @__PURE__ */ __name(function feature(d) {
1434
- return scale(d);
1435
- }, "feature")
1436
- };
1437
- }, "d3_linearLegend");
1438
- var d3_quantLegend = /* @__PURE__ */ __name(function d3_quantLegend2(scale, labelFormat, labelDelimiter) {
1439
- var labels = scale.range().map(function(d) {
1440
- var invert = scale.invertExtent(d);
1441
- return labelFormat(invert[0]) + " " + labelDelimiter + " " + labelFormat(invert[1]);
1442
- });
1443
- return {
1444
- data: scale.range(),
1445
- labels,
1446
- feature: d3_identity
1447
- };
1448
- }, "d3_quantLegend");
1449
- var d3_ordinalLegend = /* @__PURE__ */ __name(function d3_ordinalLegend2(scale) {
1450
- return {
1451
- data: scale.domain(),
1452
- labels: scale.domain(),
1453
- feature: /* @__PURE__ */ __name(function feature(d) {
1454
- return scale(d);
1455
- }, "feature")
1456
- };
1457
- }, "d3_ordinalLegend");
1458
- var d3_cellOver = /* @__PURE__ */ __name(function d3_cellOver2(cellDispatcher, d, obj) {
1459
- cellDispatcher.call("cellover", obj, d);
1460
- }, "d3_cellOver");
1461
- var d3_cellOut = /* @__PURE__ */ __name(function d3_cellOut2(cellDispatcher, d, obj) {
1462
- cellDispatcher.call("cellout", obj, d);
1463
- }, "d3_cellOut");
1464
- var d3_cellClick = /* @__PURE__ */ __name(function d3_cellClick2(cellDispatcher, d, obj) {
1465
- cellDispatcher.call("cellclick", obj, d);
1466
- }, "d3_cellClick");
1467
- var helper = {
1468
- d3_drawShapes: /* @__PURE__ */ __name(function d3_drawShapes(shape, shapes, shapeHeight, shapeWidth, shapeRadius, path2) {
1469
- if (shape === "rect") {
1470
- shapes.attr("height", shapeHeight).attr("width", shapeWidth);
1471
- } else if (shape === "circle") {
1472
- shapes.attr("r", shapeRadius);
1473
- } else if (shape === "line") {
1474
- shapes.attr("x1", 0).attr("x2", shapeWidth).attr("y1", 0).attr("y2", 0);
1475
- } else if (shape === "path") {
1476
- shapes.attr("d", path2);
1477
- }
1478
- }, "d3_drawShapes"),
1479
- d3_addText: /* @__PURE__ */ __name(function d3_addText(svg, enter, labels, classPrefix, labelWidth) {
1480
- enter.append("text").attr("class", classPrefix + "label");
1481
- var text = svg.selectAll("g." + classPrefix + "cell text." + classPrefix + "label").data(labels).text(d3_identity);
1482
- if (labelWidth) {
1483
- svg.selectAll("g." + classPrefix + "cell text." + classPrefix + "label").call(d3_textWrapping, labelWidth);
1484
- }
1485
- return text;
1486
- }, "d3_addText"),
1487
- d3_calcType: /* @__PURE__ */ __name(function d3_calcType(scale, ascending, cells, labels, labelFormat, labelDelimiter) {
1488
- var type = scale.invertExtent ? d3_quantLegend(scale, labelFormat, labelDelimiter) : scale.ticks ? d3_linearLegend(scale, cells, labelFormat) : d3_ordinalLegend(scale);
1489
- var range = scale.range && scale.range() || scale.domain();
1490
- type.labels = d3_mergeLabels(type.labels, labels, scale.domain(), range, labelDelimiter);
1491
- if (ascending) {
1492
- type.labels = d3_reverse(type.labels);
1493
- type.data = d3_reverse(type.data);
1494
- }
1495
- return type;
1496
- }, "d3_calcType"),
1497
- d3_filterCells: /* @__PURE__ */ __name(function d3_filterCells(type, cellFilter) {
1498
- var filterCells = type.data.map(function(d, i) {
1499
- return { data: d, label: type.labels[i] };
1500
- }).filter(cellFilter);
1501
- var dataValues = filterCells.map(function(d) {
1502
- return d.data;
1503
- });
1504
- var labelValues = filterCells.map(function(d) {
1505
- return d.label;
1506
- });
1507
- type.data = type.data.filter(function(d) {
1508
- return dataValues.indexOf(d) !== -1;
1509
- });
1510
- type.labels = type.labels.filter(function(d) {
1511
- return labelValues.indexOf(d) !== -1;
1512
- });
1513
- return type;
1514
- }, "d3_filterCells"),
1515
- d3_placement: /* @__PURE__ */ __name(function d3_placement(orient, cell, cellTrans, text, textTrans, labelAlign) {
1516
- cell.attr("transform", cellTrans);
1517
- text.attr("transform", textTrans);
1518
- if (orient === "horizontal") {
1519
- text.style("text-anchor", labelAlign);
1520
- }
1521
- }, "d3_placement"),
1522
- d3_addEvents: /* @__PURE__ */ __name(function d3_addEvents(cells, dispatcher) {
1523
- cells.on("mouseover.legend", function(d) {
1524
- d3_cellOver(dispatcher, d, this);
1525
- }).on("mouseout.legend", function(d) {
1526
- d3_cellOut(dispatcher, d, this);
1527
- }).on("click.legend", function(d) {
1528
- d3_cellClick(dispatcher, d, this);
1529
- });
1530
- }, "d3_addEvents"),
1531
- d3_title: /* @__PURE__ */ __name(function d3_title(svg, title, classPrefix, titleWidth) {
1532
- if (title !== "") {
1533
- var titleText = svg.selectAll("text." + classPrefix + "legendTitle");
1534
- titleText.data([title]).enter().append("text").attr("class", classPrefix + "legendTitle");
1535
- svg.selectAll("text." + classPrefix + "legendTitle").text(title);
1536
- if (titleWidth) {
1537
- svg.selectAll("text." + classPrefix + "legendTitle").call(d3_textWrapping, titleWidth);
1538
- }
1539
- var cellsSvg = svg.select("." + classPrefix + "legendCells");
1540
- var yOffset = svg.select("." + classPrefix + "legendTitle").nodes().map(function(d) {
1541
- return d.getBBox().height;
1542
- })[0], xOffset = -cellsSvg.nodes().map(function(d) {
1543
- return d.getBBox().x;
1544
- })[0];
1545
- cellsSvg.attr("transform", "translate(" + xOffset + "," + yOffset + ")");
1546
- }
1547
- }, "d3_title"),
1548
- d3_defaultLocale: {
1549
- format,
1550
- formatPrefix
1551
- },
1552
- d3_defaultFormatSpecifier: ".01f",
1553
- d3_defaultDelimiter: "to"
1554
- };
1555
- function color() {
1556
- 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, path2 = void 0, titleWidth = void 0, legendDispatcher = dispatch("cellover", "cellout", "cellclick");
1557
- function legend(svg) {
1558
- var type = helper.d3_calcType(scale, ascending, cells, labels, locale.format(specifier), labelDelimiter), legendG = svg.selectAll("g").data([scale]);
1559
- legendG.enter().append("g").attr("class", classPrefix + "legendCells");
1560
- if (cellFilter) {
1561
- helper.d3_filterCells(type, cellFilter);
1562
- }
1563
- var cell = svg.select("." + classPrefix + "legendCells").selectAll("." + classPrefix + "cell").data(type.data);
1564
- var cellEnter = cell.enter().append("g").attr("class", classPrefix + "cell");
1565
- cellEnter.append(shape).attr("class", classPrefix + "swatch");
1566
- var shapes = svg.selectAll("g." + classPrefix + "cell " + shape + "." + classPrefix + "swatch").data(type.data);
1567
- helper.d3_addEvents(cellEnter, legendDispatcher);
1568
- cell.exit().transition().style("opacity", 0).remove();
1569
- shapes.exit().transition().style("opacity", 0).remove();
1570
- shapes = shapes.merge(shapes);
1571
- helper.d3_drawShapes(shape, shapes, shapeHeight, shapeWidth, shapeRadius, path2);
1572
- var text = helper.d3_addText(svg, cellEnter, type.labels, classPrefix, labelWrap);
1573
- cell = cellEnter.merge(cell);
1574
- var textSize = text.nodes().map(function(d) {
1575
- return d.getBBox();
1576
- }), shapeSize = shapes.nodes().map(function(d) {
1577
- return d.getBBox();
1578
- });
1579
- if (!useClass) {
1580
- if (shape == "line") {
1581
- shapes.style("stroke", type.feature);
1582
- } else {
1583
- shapes.style("fill", type.feature);
1584
- }
1585
- } else {
1586
- shapes.attr("class", function(d) {
1587
- return classPrefix + "swatch " + type.feature(d);
1588
- });
1589
- }
1590
- var cellTrans = void 0, textTrans = void 0, textAlign = labelAlign == "start" ? 0 : labelAlign == "middle" ? 0.5 : 1;
1591
- if (orient === "vertical") {
1592
- (function() {
1593
- var cellSize = textSize.map(function(d, i) {
1594
- return Math.max(d.height, shapeSize[i].height);
1595
- });
1596
- cellTrans = /* @__PURE__ */ __name(function cellTrans2(d, i) {
1597
- var height = sum(cellSize.slice(0, i));
1598
- return "translate(0, " + (height + i * shapePadding) + ")";
1599
- }, "cellTrans");
1600
- textTrans = /* @__PURE__ */ __name(function textTrans2(d, i) {
1601
- return "translate( " + (shapeSize[i].width + shapeSize[i].x + labelOffset) + ", " + (shapeSize[i].y + shapeSize[i].height / 2 + 5) + ")";
1602
- }, "textTrans");
1603
- })();
1604
- } else if (orient === "horizontal") {
1605
- cellTrans = /* @__PURE__ */ __name(function cellTrans2(d, i) {
1606
- return "translate(" + i * (shapeSize[i].width + shapePadding) + ",0)";
1607
- }, "cellTrans");
1608
- textTrans = /* @__PURE__ */ __name(function textTrans2(d, i) {
1609
- return "translate(" + (shapeSize[i].width * textAlign + shapeSize[i].x) + ",\n " + (shapeSize[i].height + shapeSize[i].y + labelOffset + 8) + ")";
1610
- }, "textTrans");
1611
- }
1612
- helper.d3_placement(orient, cell, cellTrans, text, textTrans, labelAlign);
1613
- helper.d3_title(svg, title, classPrefix, titleWidth);
1614
- cell.transition().style("opacity", 1);
1615
- }
1616
- __name(legend, "legend");
1617
- legend.scale = function(_) {
1618
- if (!arguments.length) return scale;
1619
- scale = _;
1620
- return legend;
1621
- };
1622
- legend.cells = function(_) {
1623
- if (!arguments.length) return cells;
1624
- if (_.length > 1 || _ >= 2) {
1625
- cells = _;
1626
- }
1627
- return legend;
1628
- };
1629
- legend.cellFilter = function(_) {
1630
- if (!arguments.length) return cellFilter;
1631
- cellFilter = _;
1632
- return legend;
1633
- };
1634
- legend.shape = function(_, d) {
1635
- if (!arguments.length) return shape;
1636
- if (_ == "rect" || _ == "circle" || _ == "line" || _ == "path" && typeof d === "string") {
1637
- shape = _;
1638
- path2 = d;
1639
- }
1640
- return legend;
1641
- };
1642
- legend.shapeWidth = function(_) {
1643
- if (!arguments.length) return shapeWidth;
1644
- shapeWidth = +_;
1645
- return legend;
1646
- };
1647
- legend.shapeHeight = function(_) {
1648
- if (!arguments.length) return shapeHeight;
1649
- shapeHeight = +_;
1650
- return legend;
1651
- };
1652
- legend.shapeRadius = function(_) {
1653
- if (!arguments.length) return shapeRadius;
1654
- shapeRadius = +_;
1655
- return legend;
1656
- };
1657
- legend.shapePadding = function(_) {
1658
- if (!arguments.length) return shapePadding;
1659
- shapePadding = +_;
1660
- return legend;
1661
- };
1662
- legend.labels = function(_) {
1663
- if (!arguments.length) return labels;
1664
- labels = _;
1665
- return legend;
1666
- };
1667
- legend.labelAlign = function(_) {
1668
- if (!arguments.length) return labelAlign;
1669
- if (_ == "start" || _ == "end" || _ == "middle") {
1670
- labelAlign = _;
1671
- }
1672
- return legend;
1673
- };
1674
- legend.locale = function(_) {
1675
- if (!arguments.length) return locale;
1676
- locale = formatLocale(_);
1677
- return legend;
1678
- };
1679
- legend.labelFormat = function(_) {
1680
- if (!arguments.length) return legend.locale().format(specifier);
1681
- specifier = formatSpecifier(_);
1682
- return legend;
1683
- };
1684
- legend.labelOffset = function(_) {
1685
- if (!arguments.length) return labelOffset;
1686
- labelOffset = +_;
1687
- return legend;
1688
- };
1689
- legend.labelDelimiter = function(_) {
1690
- if (!arguments.length) return labelDelimiter;
1691
- labelDelimiter = _;
1692
- return legend;
1693
- };
1694
- legend.labelWrap = function(_) {
1695
- if (!arguments.length) return labelWrap;
1696
- labelWrap = _;
1697
- return legend;
1698
- };
1699
- legend.useClass = function(_) {
1700
- if (!arguments.length) return useClass;
1701
- if (_ === true || _ === false) {
1702
- useClass = _;
1703
- }
1704
- return legend;
1705
- };
1706
- legend.orient = function(_) {
1707
- if (!arguments.length) return orient;
1708
- _ = _.toLowerCase();
1709
- if (_ == "horizontal" || _ == "vertical") {
1710
- orient = _;
1711
- }
1712
- return legend;
1713
- };
1714
- legend.ascending = function(_) {
1715
- if (!arguments.length) return ascending;
1716
- ascending = !!_;
1717
- return legend;
1718
- };
1719
- legend.classPrefix = function(_) {
1720
- if (!arguments.length) return classPrefix;
1721
- classPrefix = _;
1722
- return legend;
1723
- };
1724
- legend.title = function(_) {
1725
- if (!arguments.length) return title;
1726
- title = _;
1727
- return legend;
1728
- };
1729
- legend.titleWidth = function(_) {
1730
- if (!arguments.length) return titleWidth;
1731
- titleWidth = _;
1732
- return legend;
1733
- };
1734
- legend.textWrap = function(_) {
1735
- if (!arguments.length) return textWrap;
1736
- textWrap = _;
1737
- return legend;
1738
- };
1739
- legend.on = function() {
1740
- var value = legendDispatcher.on.apply(legendDispatcher, arguments);
1741
- return value === legendDispatcher ? legend : value;
1742
- };
1743
- return legend;
1744
- }
1745
- __name(color, "color");
1746
- const _Legend = class _Legend extends SVGWidget {
1747
- _owner;
1748
- _targetWidget;
1749
- _targetWidgetMonitor;
1750
- _legendOrdinal;
1751
- _disabled = [];
1752
- _symbolTypeMap = {
1753
- "circle": d3SymbolCircle,
1754
- "cross": d3SymbolCross,
1755
- "diamond": d3SymbolDiamond,
1756
- "square": d3SymbolSquare,
1757
- "star": d3SymbolStar,
1758
- "triangle": d3SymbolTriangle,
1759
- "wye": d3SymbolWye
1760
- };
1761
- constructor(owner) {
1762
- super();
1763
- this._owner = owner;
1764
- this._drawStartPos = "origin";
1765
- const context = this;
1766
- this._legendOrdinal = color().shape("path", d3Symbol().type(d3SymbolCircle).size(150)()).shapePadding(10).shapeRadius(10).on("cellclick", function(d) {
1767
- context.onClick(d, this);
1768
- }).on("cellover", (d) => {
1769
- context.onOver(d, this);
1770
- }).on("cellout", (d) => {
1771
- context.onOut(d, this);
1772
- });
1773
- }
1774
- isDisabled(d) {
1775
- if (typeof d === "undefined") {
1776
- return false;
1777
- } else if (typeof d === "string") {
1778
- return d.indexOf("__") === 0 || this._disabled.indexOf(d) >= 0;
1779
- } else if (d instanceof Database.Field) {
1780
- return d.id().indexOf("__") === 0 || this._disabled.indexOf(d.id()) >= 0;
1781
- }
1782
- return this._disabled.indexOf(d) >= 0;
1783
- }
1784
- filteredFields() {
1785
- switch (this.dataFamily()) {
1786
- case "2D":
1787
- return this.fields();
1788
- case "ND":
1789
- return this.fields().filter((d) => !this.isDisabled(d));
1790
- }
1791
- return this.fields();
1792
- }
1793
- filteredColumns() {
1794
- switch (this.dataFamily()) {
1795
- case "2D":
1796
- return this.columns();
1797
- case "ND":
1798
- return this.columns().filter((d) => !this.isDisabled(d));
1799
- }
1800
- return this.columns();
1801
- }
1802
- filteredData() {
1803
- switch (this.dataFamily()) {
1804
- case "2D":
1805
- return this.data().filter((row) => !this.isDisabled(row[0]));
1806
- case "ND":
1807
- const disabledCols = {};
1808
- let anyDisabled = false;
1809
- this.columns().forEach((col, idx) => {
1810
- const disabled = this.isDisabled(col);
1811
- disabledCols[idx] = disabled;
1812
- if (disabled) {
1813
- anyDisabled = true;
1814
- }
1815
- });
1816
- return !anyDisabled ? this.data() : this.data().map((row) => {
1817
- return row.filter((cell, idx) => !disabledCols[idx]);
1818
- });
1819
- }
1820
- return this.data();
1821
- }
1822
- isRainbow() {
1823
- const widget = this.getWidget();
1824
- return widget && widget._palette && widget._palette.type() === "rainbow";
1825
- }
1826
- targetWidget(_) {
1827
- if (!arguments.length) return this._targetWidget;
1828
- this._targetWidget = _;
1829
- if (this._targetWidgetMonitor) {
1830
- this._targetWidgetMonitor.remove();
1831
- delete this._targetWidgetMonitor;
1832
- }
1833
- if (this._targetWidget) {
1834
- const context = this;
1835
- this._targetWidgetMonitor = this._targetWidget.monitor(function(key, newProp, oldProp, source) {
1836
- switch (key) {
1837
- case "chart":
1838
- case "columns":
1839
- case "data":
1840
- case "paletteID":
1841
- context.lazyRender();
1842
- break;
1843
- }
1844
- });
1845
- }
1846
- return this;
1847
- }
1848
- getWidget() {
1849
- if (this._targetWidget) {
1850
- switch (this._targetWidget.classID()) {
1851
- case "composite_MultiChart":
1852
- return this._targetWidget.chart();
1853
- }
1854
- }
1855
- return this._targetWidget;
1856
- }
1857
- getPalette() {
1858
- const widget = this.getWidget();
1859
- if (widget && widget._palette) {
1860
- switch (widget._palette.type()) {
1861
- case "ordinal":
1862
- return Palette.ordinal(widget._palette.id());
1863
- case "rainbow":
1864
- return Palette.rainbow(widget._palette.id());
1865
- }
1866
- }
1867
- return Palette.ordinal("default");
1868
- }
1869
- getPaletteType() {
1870
- return this.getPalette().type();
1871
- }
1872
- fillColorFunc() {
1873
- const widget = this.getWidget();
1874
- if (widget && widget.fillColor) {
1875
- if (widget._palette && widget.paletteID && widget._palette.name !== widget.paletteID()) {
1876
- widget._palette = widget._palette.switch(widget.paletteID());
1877
- }
1878
- return (row, col, sel) => {
1879
- return widget.fillColor(row, col, sel);
1880
- };
1881
- }
1882
- const palette = Palette.ordinal(widget && widget.paletteID ? widget.paletteID() || "default" : "default");
1883
- return (row, col, sel) => {
1884
- return palette(col);
1885
- };
1886
- }
1887
- fillColor(row, col, sel) {
1888
- return this.fillColorFunc()(row, col, sel);
1889
- }
1890
- _g;
1891
- enter(domNode, element) {
1892
- super.enter(domNode, element);
1893
- this._g = element.append("g").attr("class", "legendOrdinal");
1894
- }
1895
- calcMetaData() {
1896
- let dataArr = [];
1897
- let total = 0;
1898
- let maxLabelWidth = 0;
1899
- const colLength = this.columns().length;
1900
- if (this._targetWidget) {
1901
- const columns = this.columns();
1902
- switch (this.getPaletteType()) {
1903
- case "ordinal":
1904
- const fillColor = this.fillColorFunc();
1905
- let val = 0;
1906
- switch (this.dataFamily()) {
1907
- case "2D":
1908
- dataArr = this.data().map(function(n, i) {
1909
- val = this.data()[i].slice(1, colLength).reduce((acc, n2) => acc + n2, 0);
1910
- const disabled = this.isDisabled(n[0]);
1911
- if (!disabled) total += val;
1912
- const label = n[0] + (!disabled && this.showSeriesTotal() ? ` (${val})` : "");
1913
- const textSize = this.textSize(label);
1914
- if (maxLabelWidth < textSize.width) maxLabelWidth = textSize.width;
1915
- return [fillColor(n, n[0], false), n[0], label];
1916
- }, this);
1917
- break;
1918
- case "ND":
1919
- const widgetColumns = this.columns().filter((col) => col.indexOf("__") !== 0);
1920
- dataArr = widgetColumns.filter(function(n, i) {
1921
- return i > 0;
1922
- }).map(function(n, i) {
1923
- val = this.data().reduce((acc, n2) => acc + n2[i + 1], 0);
1924
- const disabled = this.isDisabled(columns[i + 1]);
1925
- const label = n + (!disabled && this.showSeriesTotal() ? ` (${val})` : "");
1926
- if (!disabled) total += val;
1927
- const textSize = this.textSize(label);
1928
- if (maxLabelWidth < textSize.width) maxLabelWidth = textSize.width;
1929
- return [fillColor(void 0, n, false), n, label];
1930
- }, this);
1931
- break;
1932
- default:
1933
- const widgetColumns2 = this.columns();
1934
- dataArr = widgetColumns2.map(function(n) {
1935
- return [fillColor(void 0, n, false), n];
1936
- }, this);
1937
- break;
1938
- }
1939
- break;
1940
- case "rainbow":
1941
- const palette = this.getPalette();
1942
- const format$1 = format(this.rainbowFormat());
1943
- const widget = this.getWidget();
1944
- const steps = this.rainbowBins();
1945
- const weightMin = widget._dataMinWeight;
1946
- const weightMax = widget._dataMaxWeight;
1947
- const stepWeightDiff = (weightMax - weightMin) / (steps - 1);
1948
- dataArr.push([palette(weightMin, weightMin, weightMax), format$1(weightMin)]);
1949
- for (let x = 1; x < steps - 1; ++x) {
1950
- let mid = stepWeightDiff * x;
1951
- if (Math.floor(mid) > parseInt(dataArr[0][1])) {
1952
- mid = Math.floor(mid);
1953
- }
1954
- dataArr.push([palette(mid, weightMin, weightMax), format$1(mid)]);
1955
- }
1956
- dataArr.push([palette(weightMax, weightMin, weightMax), format$1(weightMax)]);
1957
- break;
1958
- }
1959
- }
1960
- return {
1961
- dataArr,
1962
- total,
1963
- maxLabelWidth
1964
- };
1965
- }
1966
- update(domNode, element) {
1967
- super.update(domNode, element);
1968
- const { dataArr, maxLabelWidth, total } = this.calcMetaData();
1969
- const radius = this.shapeRadius();
1970
- const size = this.radiusToSymbolSize(radius);
1971
- const strokeWidth = 1;
1972
- let shapePadding = this.itemPadding();
1973
- if (this.orientation() === "horizontal") {
1974
- shapePadding += maxLabelWidth - radius * 2;
1975
- }
1976
- const ordinal = scaleOrdinal().domain(dataArr.map((row) => row[1])).range(dataArr.map((row) => row[0]));
1977
- this._legendOrdinal.shape("path", d3Symbol().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]);
1978
- this._g.call(this._legendOrdinal);
1979
- this.updateDisabled(element, dataArr);
1980
- const legendCellsBbox = this._g.select(".legendCells").node().getBBox();
1981
- let offsetX = Math.abs(legendCellsBbox.x);
1982
- let offsetY = Math.abs(legendCellsBbox.y) + strokeWidth;
1983
- if (this.orientation() === "horizontal") {
1984
- if (this.labelAlign() === "start") {
1985
- offsetX += strokeWidth;
1986
- } else if (this.labelAlign() === "end") {
1987
- offsetX -= strokeWidth;
1988
- }
1989
- if (this.width() > legendCellsBbox.width) {
1990
- const extraWidth = this.width() - legendCellsBbox.width;
1991
- offsetX += extraWidth / 2;
1992
- }
1993
- } else if (this.orientation() === "vertical") {
1994
- offsetX += strokeWidth;
1995
- if (this._containerSize.height > legendCellsBbox.height) {
1996
- const extraHeight = this.height() - legendCellsBbox.height;
1997
- offsetY += extraHeight / 2;
1998
- }
1999
- }
2000
- this._g.attr("transform", `translate(${offsetX}, ${offsetY})`);
2001
- this.pos({
2002
- x: 0,
2003
- y: 0
2004
- });
2005
- this._legendOrdinal.labelOffset(this.itemPadding());
2006
- const legendTotal = this._g.selectAll(".legendTotal").data(dataArr.length && this.showLegendTotal() ? [total] : []);
2007
- const totalText = `Total: ${total}`;
2008
- const totalOffsetX = -offsetX;
2009
- const totalOffsetY = legendCellsBbox.height + this.itemPadding() + strokeWidth;
2010
- this.enableOverflowScroll(false);
2011
- this.enableOverflow(true);
2012
- legendTotal.enter().append("text").classed("legendTotal", true).merge(legendTotal).attr("transform", `translate(${totalOffsetX}, ${totalOffsetY})`).text(totalText);
2013
- legendTotal.exit().remove();
2014
- }
2015
- updateDisabled(element, dataArr) {
2016
- element.style("cursor", "pointer").selectAll("path.swatch").filter((d, i) => i < dataArr.length).style("stroke", (d, i) => dataArr[i][0]).style(
2017
- "fill",
2018
- (d, i) => this._disabled.indexOf(d) < 0 ? dataArr[i][0] : "white"
2019
- );
2020
- }
2021
- postUpdate(domNode, element) {
2022
- let w;
2023
- if (this._boundingBox) {
2024
- w = this._boundingBox.width;
2025
- this._boundingBox.width = this._size.width;
2026
- }
2027
- super.postUpdate(domNode, element);
2028
- if (w !== void 0) {
2029
- this._boundingBox.width = w;
2030
- }
2031
- this._parentRelativeDiv.style("overflow", "hidden");
2032
- }
2033
- exit(domNode, element) {
2034
- super.exit(domNode, element);
2035
- }
2036
- radiusToSymbolSize(radius) {
2037
- const circleSize = Math.pow(radius, 2) * Math.PI;
2038
- switch (this.symbolType()) {
2039
- case "star":
2040
- return circleSize * 0.45;
2041
- case "triangle":
2042
- return circleSize * 0.65;
2043
- case "cross":
2044
- case "diamond":
2045
- case "wye":
2046
- return circleSize * 0.75;
2047
- case "circle":
2048
- return circleSize;
2049
- case "square":
2050
- return circleSize * 1.3;
2051
- }
2052
- }
2053
- onClick(d, domNode) {
2054
- switch (this.getPaletteType()) {
2055
- case "ordinal":
2056
- switch (this.dataFamily()) {
2057
- case "2D":
2058
- case "ND":
2059
- const disabledIdx = this._disabled.indexOf(d);
2060
- if (disabledIdx < 0) {
2061
- this._disabled.push(d);
2062
- } else {
2063
- this._disabled.splice(disabledIdx, 1);
2064
- }
2065
- this._owner.refreshColumns();
2066
- this._owner.refreshData();
2067
- this._owner.render();
2068
- break;
2069
- }
2070
- break;
2071
- }
2072
- }
2073
- onOver(d, domNode) {
2074
- if (instanceOfIHighlight(this._owner)) {
2075
- switch (this.getPaletteType()) {
2076
- case "ordinal":
2077
- switch (this.dataFamily()) {
2078
- case "2D":
2079
- case "ND":
2080
- if (this._disabled.indexOf(d) < 0) {
2081
- this._owner.highlightColumn(d);
2082
- }
2083
- break;
2084
- }
2085
- break;
2086
- }
2087
- }
2088
- }
2089
- onOut(d, domNode) {
2090
- if (instanceOfIHighlight(this._owner)) {
2091
- switch (this.getPaletteType()) {
2092
- case "ordinal":
2093
- switch (this.dataFamily()) {
2094
- case "2D":
2095
- case "ND":
2096
- this._owner.highlightColumn();
2097
- break;
2098
- }
2099
- break;
2100
- }
2101
- }
2102
- }
2103
- onDblClick(rowData, rowIdx) {
2104
- }
2105
- onMouseOver(rowData, rowIdx) {
2106
- }
2107
- _containerSize;
2108
- resize(_size) {
2109
- let retVal;
2110
- if (this.fitToContent()) {
2111
- this._containerSize = _size;
2112
- const bbox = this.getBBox();
2113
- if (_size.width > bbox.width) {
2114
- bbox.width = _size.width;
2115
- }
2116
- if (_size.height > bbox.height) {
2117
- bbox.height = _size.height;
2118
- }
2119
- retVal = super.resize.apply(this, [{ ...bbox }]);
2120
- } else {
2121
- retVal = super.resize.apply(this, arguments);
2122
- }
2123
- return retVal;
2124
- }
2125
- };
2126
- __name(_Legend, "Legend");
2127
- let Legend = _Legend;
2128
- Legend.prototype._class += " layout_Legend";
2129
- Legend.prototype.publish("title", "", "string", "Title");
2130
- Legend.prototype.publish("symbolType", "circle", "set", "Shape of each legend item", ["circle", "cross", "diamond", "square", "star", "triangle", "wye"]);
2131
- Legend.prototype.publish("labelMaxWidth", null, "number", "Max Label Width (pixels)", null, { optional: true });
2132
- Legend.prototype.publish("orientation", "vertical", "set", "Orientation of Legend rows", ["vertical", "horizontal"], { tags: ["Private"] });
2133
- Legend.prototype.publish("dataFamily", "ND", "set", "Type of data", ["1D", "2D", "ND", "map", "graph", "any"], { tags: ["Private"] });
2134
- Legend.prototype.publish("rainbowFormat", ",", "string", "Rainbow number formatting", null, { tags: ["Private"], optional: true, disable: /* @__PURE__ */ __name((w) => !w.isRainbow(), "disable") });
2135
- Legend.prototype.publish("rainbowBins", 8, "number", "Number of rainbow bins", null, { tags: ["Private"], disable: /* @__PURE__ */ __name((w) => !w.isRainbow(), "disable") });
2136
- Legend.prototype.publish("showSeriesTotal", false, "boolean", "Show value next to series");
2137
- Legend.prototype.publish("showLegendTotal", false, "boolean", "Show a total of the series values under the legend", null);
2138
- Legend.prototype.publish("itemPadding", 8, "number", "Padding between legend items (pixels)");
2139
- Legend.prototype.publish("shapeRadius", 7, "number", "Radius of legend shape (pixels)");
2140
- Legend.prototype.publish("fitToContent", true, "boolean", "If true, resize will simply reapply the bounding box dimensions");
2141
- Legend.prototype.publish("labelAlign", "start", "set", "Horizontal alignment of legend item label (for horizontal orientation only)", ["start", "middle", "end"], { optional: true, disable: /* @__PURE__ */ __name((w) => w.orientation() === "vertical", "disable") });
2142
- const _Modal = class _Modal extends HTMLWidget {
2143
- _widget;
2144
- _relativeTarget;
2145
- _fade;
2146
- _modal;
2147
- _modalHeader;
2148
- _modalBody;
2149
- _modalHeaderAnnotations;
2150
- _modalHeaderCloseButton;
2151
- _close;
2152
- constructor() {
2153
- super();
2154
- this._tag = "div";
2155
- }
2156
- closeModal() {
2157
- this.visible(false);
2158
- }
2159
- getRelativeTarget() {
2160
- let relativeTarget;
2161
- if (this.relativeTargetId()) {
2162
- relativeTarget = document.getElementById(this.relativeTargetId());
2163
- if (relativeTarget) {
2164
- return relativeTarget;
2165
- }
2166
- }
2167
- if (!relativeTarget) {
2168
- relativeTarget = this.locateAncestor("layout_Grid");
2169
- if (relativeTarget && relativeTarget.element) {
2170
- return relativeTarget.element().node();
2171
- }
2172
- }
2173
- return document.body;
2174
- }
2175
- setModalSize() {
2176
- if (this.fixedHeight() !== null && this.fixedWidth() !== null) {
2177
- 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);
2178
- } else if (this.minHeight() || this.minWidth()) {
2179
- this._modal.style("min-height", this.minHeight()).style("min-width", this.minWidth()).style("max-height", this.maxHeight()).style("max-width", this.maxWidth());
2180
- }
2181
- const modalRect = this._modal.node().getBoundingClientRect();
2182
- const headerRect = this._modalHeader.node().getBoundingClientRect();
2183
- this._modalBody.style("height", modalRect.height - headerRect.height + "px").style("width", modalRect.width);
2184
- return modalRect;
2185
- }
2186
- setFadePosition(rect) {
2187
- this._fade.style("top", rect.top + "px").style("left", rect.left + "px").style("width", rect.width + "px").style("height", rect.height + "px");
2188
- }
2189
- setModalPosition(rect) {
2190
- const modalRect = this.setModalSize();
2191
- if (this.fixedTop() !== null && this.fixedLeft() !== null) {
2192
- this._modal.style("top", `calc(${this.fixedTop()} + ${rect.top}px)`).style("left", `calc(${this.fixedLeft()} + ${rect.left}px)`);
2193
- } else if (this.fixedHeight() !== null && this.fixedWidth() !== null) {
2194
- this._modal.style("top", rect.top + rect.height / 2 - modalRect.height / 2 + "px").style("left", rect.left + rect.width / 2 - modalRect.width / 2 + "px");
2195
- } else if (this.minHeight() || this.minWidth()) {
2196
- const contentRect = this._modal.node().getBoundingClientRect();
2197
- this._modal.style("top", rect.top + rect.height / 2 - contentRect.height / 2 + "px").style("left", rect.left + rect.width / 2 - contentRect.width / 2 + "px");
2198
- }
2199
- }
2200
- resize(size) {
2201
- super.resize();
2202
- if (this._modal) this.setModalSize();
2203
- return this;
2204
- }
2205
- resizeBodySync(width, height) {
2206
- const header = this._modalHeader.node();
2207
- const headerRect = header.getBoundingClientRect();
2208
- this._modal.style("width", width + "px").style("height", height + headerRect.height + "px").style("min-width", width + "px").style("min-height", height + headerRect.height + "px");
2209
- this._modalHeader.style("width", width + "px");
2210
- this._modalBody.style("width", width + "px").style("height", height + "px");
2211
- return this.minWidth(width + "px").minHeight(height + headerRect.height + "px").resize({
2212
- height: height + headerRect.height,
2213
- width
2214
- });
2215
- }
2216
- enter(domNode, element) {
2217
- super.enter(domNode, element);
2218
- this._fade = element.append("div").classed("layout_Modal-fade", true).classed("layout_Modal-fadeClickable", this.enableClickFadeToClose()).classed("layout_Modal-fade-hidden", !this.showFade());
2219
- const header_h = this.titleFontSize() * 2;
2220
- this._modal = element.append("div").classed("layout_Modal-content", true);
2221
- 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");
2222
- 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());
2223
- 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());
2224
- this._modalHeaderAnnotations = this._modalHeader.append("div").classed("layout_Modal-annotations", true);
2225
- this._modalHeaderCloseButton = this._modalHeaderAnnotations.append("div").classed("layout_Modal-closeButton", true).html('<i class="fa fa-close"></i>');
2226
- this._modalHeaderAnnotations.style("line-height", this.titleFontSize() + "px").style("right", this.titleFontSize() / 2 + "px").style("top", this.titleFontSize() / 2 + "px");
2227
- this._modalHeaderCloseButton.on("click", () => {
2228
- this.closeModal();
2229
- });
2230
- this._fade.on("click", (n) => {
2231
- if (this.enableClickFadeToClose()) {
2232
- this.closeModal();
2233
- }
2234
- });
2235
- }
2236
- update(domNode, element) {
2237
- super.update(domNode, element);
2238
- element.style("display", this.show() ? null : "none");
2239
- this._fade.classed("layout_Modal-fade-hidden", !this.showFade());
2240
- this._relativeTarget = this.getRelativeTarget();
2241
- this.setModalSize();
2242
- const rect = this._relativeTarget.getBoundingClientRect();
2243
- this.setFadePosition(rect);
2244
- this.setModalPosition(rect);
2245
- if (this.show()) {
2246
- if (!this._widget.target()) {
2247
- this._widget.target(this._modalBody.node());
2248
- }
2249
- this._widget.resize().render();
2250
- } else {
2251
- this._widget.target(null).render();
2252
- }
2253
- }
2254
- exit(domNode, element) {
2255
- if (this._widget) {
2256
- this._widget.target(null);
2257
- }
2258
- super.exit(domNode, element);
2259
- }
2260
- formattedTitle() {
2261
- const title = this.title_exists() ? this.title().trim() : "";
2262
- if (title.length > 0 && title.slice(0, 1) === "(" && title.slice(-1) === ")") {
2263
- return title.slice(1, -1);
2264
- }
2265
- return this.title();
2266
- }
2267
- };
2268
- __name(_Modal, "Modal");
2269
- let Modal = _Modal;
2270
- Modal.prototype._class += " layout_Modal";
2271
- Modal.prototype.publish("title", null, "string", "title");
2272
- Modal.prototype.publish("widget", null, "widget", "widget");
2273
- Modal.prototype.publish("titleFontSize", 18, "number", "titleFontSize (in pixels)");
2274
- Modal.prototype.publish("titleFontColor", "#ffffff", "html-color", "titleFontColor");
2275
- Modal.prototype.publish("relativeTargetId", null, "string", "relativeTargetId");
2276
- Modal.prototype.publish("show", true, "boolean", "show");
2277
- Modal.prototype.publish("showFade", true, "boolean", "showFade");
2278
- Modal.prototype.publish("enableClickFadeToClose", true, "boolean", "enableClickFadeToClose");
2279
- Modal.prototype.publish("minWidth", "400px", "string", "minWidth");
2280
- Modal.prototype.publish("minHeight", "400px", "string", "minHeight");
2281
- Modal.prototype.publish("maxWidth", "800px", "string", "maxWidth");
2282
- Modal.prototype.publish("maxHeight", "800px", "string", "maxHeight");
2283
- Modal.prototype.publish("fixedWidth", null, "string", "fixedWidth");
2284
- Modal.prototype.publish("fixedHeight", null, "string", "fixedHeight");
2285
- Modal.prototype.publish("fixedTop", null, "string", "fixedTop");
2286
- Modal.prototype.publish("fixedLeft", null, "string", "fixedLeft");
2287
- Modal.prototype.publish("overflowX", "hidden", "string", "overflowX");
2288
- Modal.prototype.publish("overflowY", "scroll", "string", "overflowY");
2289
- const _ChartPanel = class _ChartPanel extends Border2 {
2290
- _legend = new Legend(this).enableOverflow(true);
2291
- _progressBar = new ProgressBar();
2292
- _autoScale = false;
2293
- _resolutions = {
2294
- tiny: { width: 100, height: 100 },
2295
- small: { width: 300, height: 300 }
2296
- };
2297
- _modal = new Modal();
2298
- _highlight;
2299
- _scale;
2300
- _orig_size;
2301
- _toggleInfo = new ToggleButton().faChar("fa-info-circle").tooltip(".Description").selected(false).on("enabled", () => {
2302
- return this.description() !== "";
2303
- }).on("click", () => {
2304
- if (this._toggleInfo.selected()) {
2305
- this._modal.title(this.title()).widget(new Text().text(this.description())).show(true).render();
2306
- const origCloseFunc = this._modal._close;
2307
- this._modal._close = () => {
2308
- this._toggleInfo.selected(false).render();
2309
- this._modal._close = origCloseFunc;
2310
- };
2311
- }
2312
- }).on("mouseMove", () => {
2313
- }).on("mouseOut", () => {
2314
- });
2315
- _toggleData = new ToggleButton().faChar("fa-table").tooltip("Data").on("click", () => {
2316
- this.dataVisible(this._toggleData.selected());
2317
- this.render();
2318
- });
2319
- _buttonDownload = new Button().faChar("fa-download").tooltip("Download").on("click", () => {
2320
- this.downloadCSV();
2321
- });
2322
- _buttonDownloadImage = new Button().faChar("fa-image").tooltip("Download Image").on("click", () => {
2323
- this.downloadPNG();
2324
- });
2325
- _toggleLegend = new ToggleButton().faChar("fa-list-ul").tooltip("Legend").selected(false).on("click", () => {
2326
- const selected = this._toggleLegend.selected();
2327
- if (this.legendPosition() === "bottom") {
2328
- this.showBottom(selected);
2329
- } else if (this.legendPosition() === "right") {
2330
- this.showRight(selected);
2331
- }
2332
- this.legendVisible(selected);
2333
- this.render();
2334
- });
2335
- _spacer = new Spacer();
2336
- _titleBar = new TitleBar().buttons([this._toggleData, this._buttonDownload, this._buttonDownloadImage, this._spacer, this._toggleLegend]);
2337
- _carousel = new Carousel();
2338
- _table = new Table();
2339
- _widget;
2340
- _hideLegendToggleList = ["dgrid_Table"];
2341
- constructor() {
2342
- super();
2343
- this._tag = "div";
2344
- }
2345
- fields(_) {
2346
- if (!arguments.length) return super.fields();
2347
- super.fields(_);
2348
- this._legend.fields(_);
2349
- this.refreshFields();
2350
- return this;
2351
- }
2352
- refreshFields() {
2353
- this._widget.fields(this._legend.filteredFields());
2354
- this._table.fields(this._legend.filteredFields());
2355
- return this;
2356
- }
2357
- columns(_, asDefault) {
2358
- if (!arguments.length) return super.columns();
2359
- super.columns(_, asDefault);
2360
- this._legend.columns(_, asDefault);
2361
- this.refreshColumns();
2362
- return this;
2363
- }
2364
- refreshColumns() {
2365
- this._widget.columns(this._legend.filteredColumns());
2366
- this._table.columns(this._legend.filteredColumns());
2367
- return this;
2368
- }
2369
- data(_) {
2370
- if (!arguments.length) return super.data();
2371
- super.data(_);
2372
- this._legend.data(_);
2373
- this.refreshData();
2374
- return this;
2375
- }
2376
- refreshData() {
2377
- this._widget.data(this._legend.filteredData());
2378
- this._table.data(this._legend.filteredData());
2379
- return this;
2380
- }
2381
- highlight(_) {
2382
- if (!arguments.length) return this._highlight;
2383
- this._highlight = _;
2384
- return this;
2385
- }
2386
- startProgress() {
2387
- this._progressBar.start();
2388
- }
2389
- finishProgress() {
2390
- this._progressBar.finish();
2391
- }
2392
- buttons(_) {
2393
- if (!arguments.length) return this._titleBar.buttons();
2394
- this._titleBar.buttons(_);
2395
- return this;
2396
- }
2397
- downloadCSV() {
2398
- const namePrefix = this.downloadTitle() ? this.downloadTitle() : this.title() ? this.title() : "data";
2399
- const nameSuffix = this.downloadTimestampSuffix() ? "_" + Utility.timestamp() : "";
2400
- Utility.downloadString("CSV", this._widget.export("CSV"), namePrefix + nameSuffix);
2401
- return this;
2402
- }
2403
- downloadPNG() {
2404
- const widget = this.widget();
2405
- if (widget instanceof SVGWidget) {
2406
- if (!this.legendVisible()) {
2407
- widget.downloadPNG(this.title());
2408
- } else {
2409
- widget.downloadPNG(this.title(), void 0, this._legend);
2410
- }
2411
- }
2412
- return this;
2413
- }
2414
- highlightColumn(column) {
2415
- if (column) {
2416
- const cssTag = `series-${this.cssTag(column)}`;
2417
- this._centerWA.element().selectAll(".series").each(function() {
2418
- const element = select(this);
2419
- const highlight = element.classed(cssTag);
2420
- element.classed("highlight", highlight).classed("lowlight", !highlight);
2421
- });
2422
- } else {
2423
- this._centerWA.element().selectAll(".series").classed("highlight", false).classed("lowlight", false);
2424
- }
2425
- return this;
2426
- }
2427
- getResponsiveMode() {
2428
- if (!this.enableAutoscaling()) return "none";
2429
- if (!this._autoScale) return "regular";
2430
- if (this.size().width <= this._resolutions.tiny.width || this.size().height <= this._resolutions.tiny.height) {
2431
- return "tiny";
2432
- } else if (this.size().width <= this._resolutions.small.width || this.size().height <= this._resolutions.small.height) {
2433
- return "small";
2434
- }
2435
- return "regular";
2436
- }
2437
- setOrigSize() {
2438
- this._orig_size = JSON.parse(JSON.stringify(this.size()));
2439
- }
2440
- enter(domNode, element) {
2441
- super.enter(domNode, element);
2442
- this._modal.target(this.target()).relativeTargetId(this.id());
2443
- this.top(this._titleBar);
2444
- this.center(this._carousel);
2445
- this._legend.targetWidget(this._widget).orientation("vertical").title("").visible(false);
2446
- this._progressBar.enter(domNode, element);
2447
- this.setOrigSize();
2448
- }
2449
- preUpdateTiny(element) {
2450
- element.selectAll("div.body,div.title-text,div.icon-bar").style("display", "none");
2451
- }
2452
- preUpdateSmall(element) {
2453
- const scale_x = this._orig_size.width / this._resolutions.small.width;
2454
- const scale_y = this._orig_size.height / this._resolutions.small.height;
2455
- this._scale = Math.min(scale_x, scale_y);
2456
- const x_is_smaller = this._scale === scale_x;
2457
- this.size({
2458
- width: x_is_smaller ? this._resolutions.small.width : this._orig_size.width * (1 / this._scale),
2459
- height: !x_is_smaller ? this._resolutions.small.height : this._orig_size.height * (1 / this._scale)
2460
- });
2461
- element.select("div.title-icon").style("position", "static");
2462
- element.selectAll("lhs").style("display", "none");
2463
- element.selectAll("div.body,div.title-text,div.icon-bar").style("display", "");
2464
- element.selectAll("div.data-count").style("visibility", "hidden");
2465
- element.style("transform", `scale(${this._scale})`);
2466
- }
2467
- preUpdateRegular(element) {
2468
- element.selectAll("div.body,div.title-text,div.icon-bar").style("display", "");
2469
- element.selectAll("div.data-count").style("visibility", "hidden");
2470
- element.select("div.title-icon").style("position", "static");
2471
- element.style("transform", "translate(0px,0px) scale(1)");
2472
- }
2473
- _prevdataVisible;
2474
- _prevlegendVisible;
2475
- _prevLegendPosition;
2476
- _prevChartDataFamily;
2477
- _prevChart;
2478
- _prevButtons;
2479
- update(domNode, element) {
2480
- super.update(domNode, element);
2481
- }
2482
- preUpdate(domNode, element) {
2483
- super.preUpdate(domNode, element);
2484
- if (this._prevLegendPosition !== this.legendPosition()) {
2485
- if (this._legend.target() !== null) this._legend.target(null);
2486
- if (this._prevLegendPosition !== void 0) {
2487
- this.swap(this._prevLegendPosition, this.legendPosition());
2488
- } else {
2489
- this[this.legendPosition()](this._legend);
2490
- }
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) {
2560
- this.buttons(this._prevButtons);
2561
- }
2562
- }
2563
- const hiddenButtons = [];
2564
- if (!this.dataButtonVisible()) hiddenButtons.push(this._toggleData);
2565
- if (!this.downloadButtonVisible()) hiddenButtons.push(this._buttonDownload);
2566
- if (!this.downloadImageButtonVisible()) hiddenButtons.push(this._buttonDownloadImage);
2567
- if (!this.legendButtonVisible()) hiddenButtons.push(this._toggleLegend);
2568
- this._buttonDownloadImage.enabled(this.widget() instanceof SVGWidget);
2569
- this._titleBar.hiddenButtons(hiddenButtons).visible(this.titleVisible());
2570
- this.topOverlay(this.titleOverlay() || !this.titleVisible());
2571
- }
2572
- postUpdate(domNode, element) {
2573
- super.postUpdate(domNode, element);
2574
- switch (this.getResponsiveMode()) {
2575
- case "tiny":
2576
- this.postUpdateTiny(element);
2577
- break;
2578
- case "small":
2579
- this.postUpdateSmall(element);
2580
- break;
2581
- case "regular":
2582
- this.postUpdateRegular(element);
2583
- break;
2584
- }
2585
- }
2586
- postUpdateTiny(element) {
2587
- element.selectAll("div.body,div.title-text,div.icon-bar").style("display", "none");
2588
- 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);
2589
- element.style("transform", "translate(0px,0px) scale(1)");
2590
- const iconDiv = element.selectAll("div.title-icon");
2591
- const _node = iconDiv.node();
2592
- const _container = element.node().parentElement;
2593
- const containerRect = _container.getBoundingClientRect();
2594
- if (_node) {
2595
- const rect = iconDiv.node().getBoundingClientRect();
2596
- const icon_top = containerRect.height / 2;
2597
- iconDiv.style("position", "absolute").style("left", `calc(50% - ${rect.width / 2}px)`).style("top", `${icon_top - rect.height / 2}px`);
2598
- element.selectAll("div.data-count").style("position", "absolute").style("left", `calc(50% + ${rect.width / 2}px)`).style("top", `${icon_top - rect.height / 2}px`);
2599
- }
2600
- }
2601
- postUpdateSmall(element) {
2602
- element.selectAll("lhs").style("display", "none");
2603
- element.selectAll("div.title-icon").style("position", "static");
2604
- element.selectAll("div.body,div.title-text,div.icon-bar").style("display", "");
2605
- element.selectAll("div.data-count").style("visibility", "hidden");
2606
- const rect = element.node().getBoundingClientRect();
2607
- const parentRect = element.node().parentElement.getBoundingClientRect();
2608
- element.style("transform", `translate(${parentRect.x - rect.x}px, ${parentRect.y - rect.y}px) scale(${this._scale})`);
2609
- }
2610
- postUpdateRegular(element) {
2611
- element.selectAll("div.title-icon").style("position", "static");
2612
- element.selectAll("div.body,div.title-text,div.icon-bar").style("display", "");
2613
- element.selectAll("div.data-count").style("visibility", "hidden");
2614
- }
2615
- exit(domNode, element) {
2616
- this._progressBar.exit(domNode, element);
2617
- this.right(null);
2618
- this._legend.target(null);
2619
- this.center(null);
2620
- this._carousel.target(null);
2621
- this.top(null);
2622
- this._titleBar.target(null);
2623
- this._modal.target(null);
2624
- delete this._prevChart;
2625
- delete this._prevButtons;
2626
- delete this._prevChartDataFamily;
2627
- delete this._prevPos;
2628
- delete this._prevdataVisible;
2629
- delete this._prevlegendVisible;
2630
- super.exit(domNode, element);
2631
- }
2632
- // Event Handlers ---
2633
- // Events ---
2634
- click(row, column, selected) {
2635
- }
2636
- dblclick(row, column, selected) {
2637
- }
2638
- vertex_click(row, col, sel, more) {
2639
- if (more && more.vertex) ;
2640
- }
2641
- vertex_dblclick(row, col, sel, more) {
2642
- if (more && more.vertex) ;
2643
- }
2644
- edge_click(row, col, sel, more) {
2645
- if (more && more.edge) ;
2646
- }
2647
- edge_dblclick(row, col, sel, more) {
2648
- if (more && more.edge) ;
2649
- }
2650
- };
2651
- __name(_ChartPanel, "ChartPanel");
2652
- let ChartPanel = _ChartPanel;
2653
- ChartPanel.prototype._class += " layout_ChartPanel";
2654
- ChartPanel.prototype.publishReset();
2655
- ChartPanel.prototype.publishProxy("title", "_titleBar");
2656
- ChartPanel.prototype.publish("titleVisible", true, "boolean");
2657
- ChartPanel.prototype.publish("titleOverlay", false, "boolean");
2658
- ChartPanel.prototype.publishProxy("titleIcon", "_titleBar");
2659
- ChartPanel.prototype.publishProxy("titleIconFont", "_titleBar");
2660
- ChartPanel.prototype.publishProxy("titleFont", "_titleBar");
2661
- ChartPanel.prototype.publishProxy("titleIconFontSize", "_titleBar");
2662
- ChartPanel.prototype.publishProxy("titleFontSize", "_titleBar");
2663
- ChartPanel.prototype.publishProxy("description", "_titleBar");
2664
- ChartPanel.prototype.publishProxy("descriptionFont", "_titleBar");
2665
- ChartPanel.prototype.publishProxy("descriptionFontSize", "_titleBar");
2666
- ChartPanel.prototype.publish("dataVisible", false, "boolean", "Show data table");
2667
- ChartPanel.prototype.publish("dataButtonVisible", true, "boolean", "Show data table button");
2668
- ChartPanel.prototype.publish("downloadButtonVisible", true, "boolean", "Show data download button");
2669
- ChartPanel.prototype.publish("downloadImageButtonVisible", false, "boolean", "Show image download button");
2670
- ChartPanel.prototype.publish("downloadTitle", "", "string", "File name when downloaded");
2671
- ChartPanel.prototype.publish("downloadTimestampSuffix", true, "boolean", "Use timestamp as file name suffix");
2672
- ChartPanel.prototype.publish("legendVisible", false, "boolean", "Show legend");
2673
- ChartPanel.prototype.publish("legendButtonVisible", true, "boolean", "Show legend button");
2674
- ChartPanel.prototype.publish("legendPosition", "right", "set", "Position of legend", ["right", "bottom"]);
2675
- ChartPanel.prototype.publishProxy("legend_labelMaxWidth", "_legend", "labelMaxWidth");
2676
- ChartPanel.prototype.publishProxy("legend_showSeriesTotal", "_legend", "showSeriesTotal");
2677
- ChartPanel.prototype.publishProxy("legend_showLegendTotal", "_legend", "showLegendTotal");
2678
- ChartPanel.prototype.publishProxy("legend_itemPadding", "_legend", "itemPadding");
2679
- ChartPanel.prototype.publishProxy("legend_shapeRadius", "_legend", "shapeRadius");
2680
- ChartPanel.prototype.publishProxy("legend_symbolType", "_legend", "symbolType");
2681
- ChartPanel.prototype.publishProxy("legend_labelAlign", "_legend", "labelAlign");
2682
- ChartPanel.prototype.publish("widget", null, "widget", "Widget", void 0, { render: false });
2683
- ChartPanel.prototype.publish("enableAutoscaling", false, "boolean");
2684
- ChartPanel.prototype.publish("highlightSize", 4, "number");
2685
- ChartPanel.prototype.publish("highlightColor", "#e67e22", "html-color");
2686
- ChartPanel.prototype.publishProxy("progress_halfLife", "_progressBar", "halfLife");
2687
- ChartPanel.prototype.publishProxy("progress_decay", "_progressBar", "decay");
2688
- ChartPanel.prototype.publishProxy("progress_size", "_progressBar", "size");
2689
- ChartPanel.prototype.publishProxy("progress_color", "_progressBar", "color");
2690
- ChartPanel.prototype.publishProxy("progress_blurBar", "_progressBar", "blurBar");
2691
- ChartPanel.prototype.publishProxy("progress_blurSize", "_progressBar", "blurSize");
2692
- ChartPanel.prototype.publishProxy("progress_blurColor", "_progressBar", "blurColor");
2693
- ChartPanel.prototype.publishProxy("progress_blurOpacity", "_progressBar", "blurOpacity");
2694
- ChartPanel.prototype.widget = function(_) {
2695
- if (!arguments.length) return this._widget;
2696
- this._carousel.widgets([_, this._table]);
2697
- this._widget = _;
2698
- this._widget.fields(this._legend.filteredFields()).data(this._legend.filteredData());
2699
- const context = this;
2700
- const tmpAny = this._widget;
2701
- tmpAny.click = function() {
2702
- context.click.apply(context, arguments);
2703
- };
2704
- tmpAny.dblclick = function() {
2705
- context.dblclick.apply(context, arguments);
2706
- };
2707
- tmpAny.vertex_click = function() {
2708
- context.vertex_click.apply(context, arguments);
2709
- };
2710
- tmpAny.vertex_dblclick = function() {
2711
- context.vertex_dblclick.apply(context, arguments);
2712
- };
2713
- tmpAny.edge_click = function() {
2714
- context.edge_click.apply(context, arguments);
2715
- };
2716
- tmpAny.edge_dblclick = function() {
2717
- context.edge_dblclick.apply(context, arguments);
2718
- };
2719
- return this;
2720
- };
2721
- const _FlexGrid = class _FlexGrid extends HTMLWidget {
2722
- constructor() {
2723
- super();
2724
- }
2725
- enter(domNode, element) {
2726
- super.enter(domNode, element);
2727
- select(domNode.parentNode).style("height", "100%").style("width", "100%");
2728
- }
2729
- update(domNode, element) {
2730
- super.update(domNode, element);
2731
- const context = this;
2732
- const cachedSizes = [];
2733
- this.updateFlexParent(element);
2734
- const listItems = element.selectAll(".FlexGrid-list-item").data(this.widgets(), (w) => w.id());
2735
- listItems.enter().append("div").classed("FlexGrid-list-item", true).each(function(w) {
2736
- w.target(this);
2737
- }).merge(listItems).style("min-height", this.itemMinHeight() + "px").style("min-width", this.itemMinWidth() + "px").style("flex-basis", (n, i) => {
2738
- const flexBasis = this.widgetsFlexBasis()[i];
2739
- return typeof flexBasis !== "undefined" ? flexBasis : this.flexBasis();
2740
- }).style("flex-grow", (n, i) => {
2741
- const flexGrow = this.widgetsFlexGrow()[i];
2742
- return typeof flexGrow !== "undefined" ? flexGrow : this.flexGrow();
2743
- }).style("border-width", this.borderWidth() + "px").style("border-color", this.itemBorderColor()).each(function() {
2744
- this.firstChild.style.display = "none";
2745
- }).each(function() {
2746
- const rect = this.getBoundingClientRect();
2747
- cachedSizes.push([
2748
- rect.width,
2749
- rect.height
2750
- ]);
2751
- }).each(function(w, i) {
2752
- this.firstChild.style.display = "block";
2753
- w.resize({
2754
- width: cachedSizes[i][0] - 2 * context.borderWidth(),
2755
- height: cachedSizes[i][1] - 2 * context.borderWidth()
2756
- });
2757
- });
2758
- listItems.exit().remove();
2759
- }
2760
- exit(domNode, element) {
2761
- super.exit(domNode, element);
2762
- }
2763
- updateFlexParent(element) {
2764
- 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", () => {
2765
- if (this.forceXScroll() || this.orientation() === "horizontal" && this.flexWrap() === "nowrap" && !this.disableScroll()) {
2766
- return "scroll";
2767
- }
2768
- return "hidden";
2769
- }).style("overflow-y", () => {
2770
- if (this.forceYScroll() || this.orientation() === "vertical" && this.flexWrap() === "nowrap" && !this.disableScroll()) {
2771
- return "scroll";
2772
- }
2773
- return "hidden";
2774
- });
2775
- }
2776
- };
2777
- __name(_FlexGrid, "FlexGrid");
2778
- let FlexGrid = _FlexGrid;
2779
- FlexGrid.prototype._class += " layout_FlexGrid";
2780
- FlexGrid.prototype.publish("itemBorderColor", "transparent", "html-color", "Color of list item borders");
2781
- FlexGrid.prototype.publish("borderWidth", 0, "number", "Width of list item borders (pixels)");
2782
- FlexGrid.prototype.publish("orientation", "horizontal", "set", "Controls the flex-direction of the list items", ["horizontal", "vertical"]);
2783
- FlexGrid.prototype.publish("flexWrap", "wrap", "set", "Controls the line wrap when overflow occurs", ["nowrap", "wrap", "wrap-reverse"]);
2784
- FlexGrid.prototype.publish("disableScroll", false, "boolean", "If false, scrollbar will show (when flexWrap is set to 'nowrap')", null, { disable: /* @__PURE__ */ __name((w) => w.flexWrap() !== "nowrap", "disable") });
2785
- FlexGrid.prototype.publish("forceXScroll", false, "boolean", "If true, horzontal scrollbar will show");
2786
- FlexGrid.prototype.publish("forceYScroll", false, "boolean", "If true, vertical scrollbar will show");
2787
- FlexGrid.prototype.publish("itemMinHeight", 64, "number", "Minimum height of a list item (pixels)");
2788
- FlexGrid.prototype.publish("itemMinWidth", 64, "number", "Minimum width of a list item (pixels)");
2789
- FlexGrid.prototype.publish("alignItems", "stretch", "set", "Controls normal alignment of items", ["flex-start", "center", "flex-end", "stretch"]);
2790
- FlexGrid.prototype.publish("alignContent", "stretch", "set", "Controls normal alignment of item rows", ["flex-start", "center", "flex-end", "stretch", "space-between", "space-around"]);
2791
- FlexGrid.prototype.publish("flexGrow", 1, "number", "Default flex-grow style for all list items");
2792
- FlexGrid.prototype.publish("flexBasis", "10%", "string", "Default flex-basis style for all list items");
2793
- FlexGrid.prototype.publish("widgetsFlexGrow", [], "array", "Array of flex-grow values keyed on the widgets array");
2794
- FlexGrid.prototype.publish("widgetsFlexBasis", [], "array", "Array of flex-basis values keyed on the widgets array");
2795
- FlexGrid.prototype.publish("widgets", [], "widgetArray", "Array of widgets to be rendered as list items");
2796
- function getDefaultExportFromCjs(x) {
2797
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
2798
- }
2799
- __name(getDefaultExportFromCjs, "getDefaultExportFromCjs");
2800
- var gridList$2 = { exports: {} };
2801
- var gridList$1 = gridList$2.exports;
2802
- var hasRequiredGridList;
2803
- function requireGridList() {
2804
- if (hasRequiredGridList) return gridList$2.exports;
2805
- hasRequiredGridList = 1;
2806
- (function(module, exports) {
2807
- (function(root, factory) {
2808
- {
2809
- module.exports = factory();
2810
- }
2811
- })(gridList$1, function() {
2812
- var GridList2 = /* @__PURE__ */ __name(function(items, options) {
2813
- this._options = options;
2814
- for (var k2 in this.defaults) {
2815
- if (!this._options.hasOwnProperty(k2)) {
2816
- this._options[k2] = this.defaults[k2];
2817
- }
2818
- }
2819
- this.items = items;
2820
- this._adjustSizeOfItems();
2821
- this.generateGrid();
2822
- }, "GridList");
2823
- GridList2.cloneItems = function(items, _items) {
2824
- var i, k2;
2825
- if (_items === void 0) {
2826
- _items = [];
2827
- }
2828
- for (i = 0; i < items.length; i++) {
2829
- if (!_items[i]) {
2830
- _items[i] = {};
2831
- }
2832
- for (k2 in items[i]) {
2833
- _items[i][k2] = items[i][k2];
2834
- }
2835
- }
2836
- return _items;
2837
- };
2838
- GridList2.prototype = {
2839
- defaults: {
2840
- lanes: 5,
2841
- direction: "horizontal"
2842
- },
2843
- /**
2844
- * Illustates grid as text-based table, using a number identifier for each
2845
- * item. E.g.
2846
- *
2847
- * #| 0 1 2 3 4 5 6 7 8 9 10 11 12 13
2848
- * --------------------------------------------
2849
- * 0| 00 02 03 04 04 06 08 08 08 12 12 13 14 16
2850
- * 1| 01 -- 03 05 05 07 09 10 11 11 -- 13 15 --
2851
- *
2852
- * Warn: Does not work if items don't have a width or height specified
2853
- * besides their position in the grid.
2854
- */
2855
- toString: /* @__PURE__ */ __name(function() {
2856
- var widthOfGrid = this.grid.length, output = "\n #|", border = "\n --", item, i, j;
2857
- for (i = 0; i < widthOfGrid; i++) {
2858
- output += " " + this._padNumber(i, " ");
2859
- border += "---";
2860
- }
2861
- output += border;
2862
- for (i = 0; i < this._options.lanes; i++) {
2863
- output += "\n" + this._padNumber(i, " ") + "|";
2864
- for (j = 0; j < widthOfGrid; j++) {
2865
- output += " ";
2866
- item = this.grid[j][i];
2867
- output += item ? this._padNumber(this.items.indexOf(item), "0") : "--";
2868
- }
2869
- }
2870
- output += "\n";
2871
- return output;
2872
- }, "toString"),
2873
- generateGrid: /* @__PURE__ */ __name(function() {
2874
- var i;
2875
- this._resetGrid();
2876
- for (i = 0; i < this.items.length; i++) {
2877
- this._markItemPositionToGrid(this.items[i]);
2878
- }
2879
- }, "generateGrid"),
2880
- resizeGrid: /* @__PURE__ */ __name(function(lanes) {
2881
- var currentColumn = 0;
2882
- this._options.lanes = lanes;
2883
- this._adjustSizeOfItems();
2884
- this._sortItemsByPosition();
2885
- this._resetGrid();
2886
- for (var i = 0; i < this.items.length; i++) {
2887
- var item = this.items[i], position = this._getItemPosition(item);
2888
- this._updateItemPosition(
2889
- item,
2890
- this.findPositionForItem(item, { x: currentColumn, y: 0 })
2891
- );
2892
- currentColumn = Math.max(currentColumn, position.x);
2893
- }
2894
- this._pullItemsToLeft();
2895
- }, "resizeGrid"),
2896
- findPositionForItem: /* @__PURE__ */ __name(function(item, start, fixedRow) {
2897
- var x, y, position;
2898
- for (x = start.x; x < this.grid.length; x++) {
2899
- if (fixedRow !== void 0) {
2900
- position = [x, fixedRow];
2901
- if (this._itemFitsAtPosition(item, position)) {
2902
- return position;
2903
- }
2904
- } else {
2905
- for (y = start.y; y < this._options.lanes; y++) {
2906
- position = [x, y];
2907
- if (this._itemFitsAtPosition(item, position)) {
2908
- return position;
2909
- }
2910
- }
2911
- }
2912
- }
2913
- var newCol = this.grid.length, newRow = 0;
2914
- if (fixedRow !== void 0 && this._itemFitsAtPosition(item, [newCol, fixedRow])) {
2915
- newRow = fixedRow;
2916
- }
2917
- return [newCol, newRow];
2918
- }, "findPositionForItem"),
2919
- moveItemToPosition: /* @__PURE__ */ __name(function(item, newPosition) {
2920
- var position = this._getItemPosition({
2921
- x: newPosition[0],
2922
- y: newPosition[1],
2923
- w: item.w,
2924
- h: item.h
2925
- });
2926
- this._updateItemPosition(item, [position.x, position.y]);
2927
- this._resolveCollisions(item);
2928
- }, "moveItemToPosition"),
2929
- resizeItem: /* @__PURE__ */ __name(function(item, size) {
2930
- var width = size.w || item.w, height = size.h || item.h;
2931
- this._updateItemSize(item, width, height);
2932
- this._resolveCollisions(item);
2933
- this._pullItemsToLeft();
2934
- }, "resizeItem"),
2935
- getChangedItems: /* @__PURE__ */ __name(function(initialItems, idAttribute) {
2936
- var changedItems = [];
2937
- for (var i = 0; i < initialItems.length; i++) {
2938
- var item = this._getItemByAttribute(
2939
- idAttribute,
2940
- initialItems[i][idAttribute]
2941
- );
2942
- if (item.x !== initialItems[i].x || item.y !== initialItems[i].y || item.w !== initialItems[i].w || item.h !== initialItems[i].h) {
2943
- changedItems.push(item);
2944
- }
2945
- }
2946
- return changedItems;
2947
- }, "getChangedItems"),
2948
- _sortItemsByPosition: /* @__PURE__ */ __name(function() {
2949
- this.items.sort((function(item1, item2) {
2950
- var position1 = this._getItemPosition(item1), position2 = this._getItemPosition(item2);
2951
- if (position1.x != position2.x) {
2952
- return position1.x - position2.x;
2953
- }
2954
- if (position1.y != position2.y) {
2955
- return position1.y - position2.y;
2956
- }
2957
- return 0;
2958
- }).bind(this));
2959
- }, "_sortItemsByPosition"),
2960
- _adjustSizeOfItems: /* @__PURE__ */ __name(function() {
2961
- for (var i = 0; i < this.items.length; i++) {
2962
- var item = this.items[i];
2963
- if (item.autoSize === void 0) {
2964
- item.autoSize = item.w === 0 || item.h === 0;
2965
- }
2966
- if (item.autoSize) {
2967
- if (this._options.direction === "horizontal") {
2968
- item.h = this._options.lanes;
2969
- } else {
2970
- item.w = this._options.lanes;
2971
- }
2972
- }
2973
- }
2974
- }, "_adjustSizeOfItems"),
2975
- _resetGrid: /* @__PURE__ */ __name(function() {
2976
- this.grid = [];
2977
- }, "_resetGrid"),
2978
- _itemFitsAtPosition: /* @__PURE__ */ __name(function(item, newPosition) {
2979
- var position = this._getItemPosition(item), x, y;
2980
- if (newPosition[0] < 0 || newPosition[1] < 0) {
2981
- return false;
2982
- }
2983
- if (newPosition[1] + position.h > this._options.lanes) {
2984
- return false;
2985
- }
2986
- for (x = newPosition[0]; x < newPosition[0] + position.w; x++) {
2987
- var col = this.grid[x];
2988
- if (!col) {
2989
- continue;
2990
- }
2991
- for (y = newPosition[1]; y < newPosition[1] + position.h; y++) {
2992
- if (col[y] && col[y] !== item) {
2993
- return false;
2994
- }
2995
- }
2996
- }
2997
- return true;
2998
- }, "_itemFitsAtPosition"),
2999
- _updateItemPosition: /* @__PURE__ */ __name(function(item, position) {
3000
- if (item.x !== null && item.y !== null) {
3001
- this._deleteItemPositionFromGrid(item);
3002
- }
3003
- this._setItemPosition(item, position);
3004
- this._markItemPositionToGrid(item);
3005
- }, "_updateItemPosition"),
3006
- _updateItemSize: /* @__PURE__ */ __name(function(item, width, height) {
3007
- if (item.x !== null && item.y !== null) {
3008
- this._deleteItemPositionFromGrid(item);
3009
- }
3010
- item.w = width;
3011
- item.h = height;
3012
- this._markItemPositionToGrid(item);
3013
- }, "_updateItemSize"),
3014
- _markItemPositionToGrid: /* @__PURE__ */ __name(function(item) {
3015
- var position = this._getItemPosition(item), x, y;
3016
- this._ensureColumns(position.x + position.w);
3017
- for (x = position.x; x < position.x + position.w; x++) {
3018
- for (y = position.y; y < position.y + position.h; y++) {
3019
- this.grid[x][y] = item;
3020
- }
3021
- }
3022
- }, "_markItemPositionToGrid"),
3023
- _deleteItemPositionFromGrid: /* @__PURE__ */ __name(function(item) {
3024
- var position = this._getItemPosition(item), x, y;
3025
- for (x = position.x; x < position.x + position.w; x++) {
3026
- if (!this.grid[x]) {
3027
- continue;
3028
- }
3029
- for (y = position.y; y < position.y + position.h; y++) {
3030
- if (this.grid[x][y] == item) {
3031
- this.grid[x][y] = null;
3032
- }
3033
- }
3034
- }
3035
- }, "_deleteItemPositionFromGrid"),
3036
- _ensureColumns: /* @__PURE__ */ __name(function(N) {
3037
- var i;
3038
- for (i = 0; i < N; i++) {
3039
- if (!this.grid[i]) {
3040
- this.grid.push(new GridCol(this._options.lanes));
3041
- }
3042
- }
3043
- }, "_ensureColumns"),
3044
- _getItemsCollidingWithItem: /* @__PURE__ */ __name(function(item) {
3045
- var collidingItems = [];
3046
- for (var i = 0; i < this.items.length; i++) {
3047
- if (item != this.items[i] && this._itemsAreColliding(item, this.items[i])) {
3048
- collidingItems.push(i);
3049
- }
3050
- }
3051
- return collidingItems;
3052
- }, "_getItemsCollidingWithItem"),
3053
- _itemsAreColliding: /* @__PURE__ */ __name(function(item1, item2) {
3054
- var position1 = this._getItemPosition(item1), position2 = this._getItemPosition(item2);
3055
- 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);
3056
- }, "_itemsAreColliding"),
3057
- _resolveCollisions: /* @__PURE__ */ __name(function(item) {
3058
- if (!this._tryToResolveCollisionsLocally(item)) {
3059
- this._pullItemsToLeft(item);
3060
- }
3061
- this._pullItemsToLeft();
3062
- }, "_resolveCollisions"),
3063
- _tryToResolveCollisionsLocally: /* @__PURE__ */ __name(function(item) {
3064
- var collidingItems = this._getItemsCollidingWithItem(item);
3065
- if (!collidingItems.length) {
3066
- return true;
3067
- }
3068
- var _gridList = new GridList2([], this._options), leftOfItem, rightOfItem, aboveOfItem, belowOfItem;
3069
- GridList2.cloneItems(this.items, _gridList.items);
3070
- _gridList.generateGrid();
3071
- for (var i = 0; i < collidingItems.length; i++) {
3072
- var collidingItem = _gridList.items[collidingItems[i]], collidingPosition = this._getItemPosition(collidingItem);
3073
- var position = this._getItemPosition(item);
3074
- leftOfItem = [position.x - collidingPosition.w, collidingPosition.y];
3075
- rightOfItem = [position.x + position.w, collidingPosition.y];
3076
- aboveOfItem = [collidingPosition.x, position.y - collidingPosition.h];
3077
- belowOfItem = [collidingPosition.x, position.y + position.h];
3078
- if (_gridList._itemFitsAtPosition(collidingItem, leftOfItem)) {
3079
- _gridList._updateItemPosition(collidingItem, leftOfItem);
3080
- } else if (_gridList._itemFitsAtPosition(collidingItem, aboveOfItem)) {
3081
- _gridList._updateItemPosition(collidingItem, aboveOfItem);
3082
- } else if (_gridList._itemFitsAtPosition(collidingItem, belowOfItem)) {
3083
- _gridList._updateItemPosition(collidingItem, belowOfItem);
3084
- } else if (_gridList._itemFitsAtPosition(collidingItem, rightOfItem)) {
3085
- _gridList._updateItemPosition(collidingItem, rightOfItem);
3086
- } else {
3087
- return false;
3088
- }
3089
- }
3090
- GridList2.cloneItems(_gridList.items, this.items);
3091
- this.generateGrid();
3092
- return true;
3093
- }, "_tryToResolveCollisionsLocally"),
3094
- _pullItemsToLeft: /* @__PURE__ */ __name(function(fixedItem) {
3095
- this._sortItemsByPosition();
3096
- this._resetGrid();
3097
- if (fixedItem) {
3098
- var fixedPosition = this._getItemPosition(fixedItem);
3099
- this._updateItemPosition(fixedItem, [fixedPosition.x, fixedPosition.y]);
3100
- }
3101
- for (var i = 0; i < this.items.length; i++) {
3102
- var item = this.items[i], position = this._getItemPosition(item);
3103
- if (fixedItem && item == fixedItem) {
3104
- continue;
3105
- }
3106
- var x = this._findLeftMostPositionForItem(item), newPosition = this.findPositionForItem(
3107
- item,
3108
- { x, y: 0 },
3109
- position.y
3110
- );
3111
- this._updateItemPosition(item, newPosition);
3112
- }
3113
- }, "_pullItemsToLeft"),
3114
- _findLeftMostPositionForItem: /* @__PURE__ */ __name(function(item) {
3115
- var tail = 0, position = this._getItemPosition(item);
3116
- for (var i = 0; i < this.grid.length; i++) {
3117
- for (var j = position.y; j < position.y + position.h; j++) {
3118
- var otherItem = this.grid[i][j];
3119
- if (!otherItem) {
3120
- continue;
3121
- }
3122
- var otherPosition = this._getItemPosition(otherItem);
3123
- if (this.items.indexOf(otherItem) < this.items.indexOf(item)) {
3124
- tail = otherPosition.x + otherPosition.w;
3125
- }
3126
- }
3127
- }
3128
- return tail;
3129
- }, "_findLeftMostPositionForItem"),
3130
- _getItemByAttribute: /* @__PURE__ */ __name(function(key, value) {
3131
- for (var i = 0; i < this.items.length; i++) {
3132
- if (this.items[i][key] === value) {
3133
- return this.items[i];
3134
- }
3135
- }
3136
- return null;
3137
- }, "_getItemByAttribute"),
3138
- _padNumber: /* @__PURE__ */ __name(function(nr, prefix) {
3139
- return nr >= 10 ? nr : prefix + nr;
3140
- }, "_padNumber"),
3141
- _getItemPosition: /* @__PURE__ */ __name(function(item) {
3142
- if (this._options.direction === "horizontal") {
3143
- return item;
3144
- } else {
3145
- return {
3146
- x: item.y,
3147
- y: item.x,
3148
- w: item.h,
3149
- h: item.w
3150
- };
3151
- }
3152
- }, "_getItemPosition"),
3153
- _setItemPosition: /* @__PURE__ */ __name(function(item, position) {
3154
- if (this._options.direction === "horizontal") {
3155
- item.x = position[0];
3156
- item.y = position[1];
3157
- } else {
3158
- item.x = position[1];
3159
- item.y = position[0];
3160
- }
3161
- }, "_setItemPosition")
3162
- };
3163
- var GridCol = /* @__PURE__ */ __name(function(lanes) {
3164
- for (var i = 0; i < lanes; i++) {
3165
- this.push(null);
3166
- }
3167
- }, "GridCol");
3168
- GridCol.prototype = [];
3169
- return GridList2;
3170
- });
3171
- })(gridList$2);
3172
- return gridList$2.exports;
3173
- }
3174
- __name(requireGridList, "requireGridList");
3175
- var gridListExports = requireGridList();
3176
- const gridList = /* @__PURE__ */ getDefaultExportFromCjs(gridListExports);
3177
- const _GridList = /* @__PURE__ */ _mergeNamespaces({
3178
- __proto__: null,
3179
- default: gridList
3180
- }, [gridListExports]);
3181
- const GridList = _GridList && gridList || _GridList;
3182
- const _Grid = class _Grid extends HTMLWidget {
3183
- divItems;
3184
- gridList;
3185
- items;
3186
- itemsMap;
3187
- origItems;
3188
- cellWidth;
3189
- cellHeight;
3190
- dragItem;
3191
- dragItemPos;
3192
- _d3Drag;
3193
- _d3DragResize;
3194
- _selectionBag;
3195
- _scrollBarWidth;
3196
- constructor() {
3197
- super();
3198
- this._tag = "div";
3199
- this._selectionBag = new Utility.Selection(this);
3200
- this.content([]);
3201
- }
3202
- getDimensions() {
3203
- const size = { width: 0, height: 0 };
3204
- this.content().forEach(function(cell) {
3205
- if (size.width < cell.gridCol() + cell.gridColSpan()) {
3206
- size.width = cell.gridCol() + cell.gridColSpan();
3207
- }
3208
- if (size.height < cell.gridRow() + cell.gridRowSpan()) {
3209
- size.height = cell.gridRow() + cell.gridRowSpan();
3210
- }
3211
- }, this);
3212
- return size;
3213
- }
3214
- clearContent(widget) {
3215
- this.content(this.content().filter(function(contentWidget) {
3216
- if (!widget) {
3217
- contentWidget.target(null);
3218
- return false;
3219
- }
3220
- let w = contentWidget;
3221
- while (w) {
3222
- if (widget === w) {
3223
- contentWidget.target(null);
3224
- return false;
3225
- }
3226
- w = w.widget ? w.widget() : null;
3227
- }
3228
- return true;
3229
- }));
3230
- }
3231
- setContent(row, col, widget, title, rowSpan, colSpan) {
3232
- rowSpan = rowSpan || 1;
3233
- colSpan = colSpan || 1;
3234
- title = title || "";
3235
- this.content(this.content().filter(function(contentWidget) {
3236
- if (contentWidget.gridRow() === row && contentWidget.gridCol() === col) {
3237
- contentWidget.target(null);
3238
- return false;
3239
- }
3240
- return true;
3241
- }));
3242
- if (widget) {
3243
- const cell = new Cell().gridRow(row).gridCol(col).widget(widget).title(title).gridRowSpan(rowSpan).gridColSpan(colSpan);
3244
- this.content().push(cell);
3245
- }
3246
- return this;
3247
- }
3248
- sortedContent() {
3249
- return this.content().sort(function(l, r) {
3250
- if (l.gridRow() === r.gridRow()) {
3251
- return l.gridCol() - r.gridCol();
3252
- }
3253
- return l.gridRow() - r.gridRow();
3254
- });
3255
- }
3256
- getCell(row, col) {
3257
- let retVal = null;
3258
- this.content().some(function(cell) {
3259
- if (row >= cell.gridRow() && row < cell.gridRow() + cell.gridRowSpan() && col >= cell.gridCol() && col < cell.gridCol() + cell.gridColSpan()) {
3260
- retVal = cell;
3261
- return true;
3262
- }
3263
- return false;
3264
- });
3265
- return retVal;
3266
- }
3267
- getWidgetCell(id) {
3268
- let retVal = null;
3269
- this.content().some(function(cell) {
3270
- if (cell.widget().id() === id) {
3271
- retVal = cell;
3272
- return true;
3273
- }
3274
- return false;
3275
- });
3276
- return retVal;
3277
- }
3278
- getContent(id) {
3279
- let retVal = null;
3280
- this.content().some(function(cell) {
3281
- if (cell.widget().id() === id) {
3282
- retVal = cell.widget();
3283
- return true;
3284
- }
3285
- return false;
3286
- });
3287
- return retVal;
3288
- }
3289
- cellToGridItem(cell) {
3290
- return {
3291
- x: cell.gridCol(),
3292
- y: cell.gridRow(),
3293
- w: cell.gridColSpan(),
3294
- h: cell.gridRowSpan(),
3295
- id: cell.id(),
3296
- cell
3297
- };
3298
- }
3299
- gridItemToCell(item) {
3300
- item.cell.gridCol(item.x).gridRow(item.y).gridColSpan(item.w).gridRowSpan(item.h);
3301
- }
3302
- resetItemsPos() {
3303
- this.origItems.forEach(function(origItem) {
3304
- const item = this.itemsMap[origItem.id];
3305
- item.x = origItem.x;
3306
- item.y = origItem.y;
3307
- }, this);
3308
- }
3309
- initGridList() {
3310
- this.itemsMap = {};
3311
- this.items = this.content().map(function(cell) {
3312
- const retVal = this.cellToGridItem(cell);
3313
- this.itemsMap[retVal.id] = retVal;
3314
- return retVal;
3315
- }, this);
3316
- this.origItems = this.content().map(this.cellToGridItem);
3317
- this.gridList = new GridList(this.items, {
3318
- direction: this.snapping(),
3319
- lanes: this.snapping() === "horizontal" ? this.snappingRows() : this.snappingColumns()
3320
- });
3321
- }
3322
- killGridList() {
3323
- this.gridList = null;
3324
- delete this.items;
3325
- delete this.itemsMap;
3326
- }
3327
- enter(domNode, element) {
3328
- super.enter(domNode, element);
3329
- this._scrollBarWidth = Platform.getScrollbarWidth();
3330
- const context = this;
3331
- this._d3Drag = drag().subject(function(_d) {
3332
- const d = context.cellToGridItem(_d);
3333
- return { x: d.x * context.cellWidth, y: d.y * context.cellHeight };
3334
- }).on("start", function(_d) {
3335
- if (!context.designMode()) return;
3336
- d3Event().sourceEvent.stopPropagation();
3337
- context.initGridList();
3338
- const d = context.itemsMap[_d.id()];
3339
- context.dragItem = element.append("div").attr("class", "dragging").style("transform", function() {
3340
- return "translate(" + d.x * context.cellWidth + "px, " + d.y * context.cellHeight + "px)";
3341
- }).style("width", function() {
3342
- return d.w * context.cellWidth - context.gutter() + "px";
3343
- }).style("height", function() {
3344
- return d.h * context.cellHeight - context.gutter() + "px";
3345
- });
3346
- context.selectionBagClick(_d);
3347
- }).on("drag", function(_d) {
3348
- if (!context.designMode()) return;
3349
- const event = d3Event();
3350
- event.sourceEvent.stopPropagation();
3351
- const d = context.itemsMap[_d.id()];
3352
- if (event.x < 0) {
3353
- event.x = 0;
3354
- }
3355
- if (event.x + d.w * context.cellWidth > context.snappingColumns() * context.cellWidth) {
3356
- event.x = context.snappingColumns() * context.cellWidth - d.w * context.cellWidth;
3357
- }
3358
- if (event.y < 0) {
3359
- event.y = 0;
3360
- }
3361
- if (event.y + d.h * context.cellWidth > context.snappingRows() * context.cellWidth) {
3362
- event.y = context.snappingRows() * context.cellWidth - d.h * context.cellWidth;
3363
- }
3364
- 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))];
3365
- if (d.x !== pos[0] || d.y !== pos[1]) {
3366
- if (context.snapping() !== "none") {
3367
- context.resetItemsPos();
3368
- context.gridList.moveItemToPosition(d, pos);
3369
- } else {
3370
- d.x = pos[0];
3371
- d.y = pos[1];
3372
- }
3373
- if (_d.gridCol() !== d.x || _d.gridRow() !== d.y) {
3374
- context.items.forEach(context.gridItemToCell);
3375
- context.updateGrid(false, 100);
3376
- }
3377
- }
3378
- context.dragItem.style("transform", function() {
3379
- return "translate(" + event.x + "px, " + event.y + "px)";
3380
- }).style("width", function() {
3381
- return d.w * context.cellWidth + "px";
3382
- }).style("height", function() {
3383
- return d.h * context.cellHeight + "px";
3384
- });
3385
- }).on("end", function() {
3386
- if (!context.designMode()) return;
3387
- d3Event().sourceEvent.stopPropagation();
3388
- context.dragItem.remove();
3389
- context.dragItem = null;
3390
- context.killGridList();
3391
- });
3392
- this._d3DragResize = drag().subject(function(_d) {
3393
- const d = context.cellToGridItem(_d);
3394
- return { x: (d.x + d.w - 1) * context.cellWidth, y: (d.y + d.h - 1) * context.cellHeight };
3395
- }).on("start", function(_d) {
3396
- if (!context.designMode()) return;
3397
- d3Event().sourceEvent.stopPropagation();
3398
- context.initGridList();
3399
- const d = context.itemsMap[_d.id()];
3400
- context.dragItem = element.append("div").attr("class", "resizing").style("transform", function() {
3401
- return "translate(" + d.x * context.cellWidth + "px, " + d.y * context.cellHeight + "px)";
3402
- }).style("width", function() {
3403
- return d.w * context.cellWidth - context.gutter() + "px";
3404
- }).style("height", function() {
3405
- return d.h * context.cellHeight - context.gutter() + "px";
3406
- });
3407
- context.dragItemPos = { x: d.x, y: d.y };
3408
- }).on("drag", function(_d) {
3409
- if (!context.designMode()) return;
3410
- const event = d3Event();
3411
- event.sourceEvent.stopPropagation();
3412
- const d = context.itemsMap[_d.id()];
3413
- const pos = [Math.max(0, Math.round(event.x / context.cellWidth)), Math.max(0, Math.round(event.y / context.cellHeight))];
3414
- const size = {
3415
- w: Math.max(1, pos[0] - d.x + 1),
3416
- h: Math.max(1, pos[1] - d.y + 1)
3417
- };
3418
- if (d.w !== size.w || d.h !== size.h) {
3419
- if (context.snapping() !== "none") {
3420
- context.resetItemsPos();
3421
- context.gridList.resizeItem(d, size);
3422
- } else {
3423
- d.w = size.w;
3424
- d.h = size.h;
3425
- }
3426
- if (_d.gridColSpan() !== d.w || _d.gridRowSpan() !== d.h) {
3427
- context.items.forEach(context.gridItemToCell);
3428
- context.updateGrid(d.id, 100);
3429
- }
3430
- }
3431
- context.dragItem.style("width", function() {
3432
- return (-d.x + 1) * context.cellWidth + event.x - context.gutter() + "px";
3433
- }).style("height", function() {
3434
- return (-d.y + 1) * context.cellHeight + event.y - context.gutter() + "px";
3435
- });
3436
- }).on("end", function() {
3437
- if (!context.designMode()) return;
3438
- d3Event().sourceEvent.stopPropagation();
3439
- context.dragItem.remove();
3440
- context.dragItem = null;
3441
- context.killGridList();
3442
- });
3443
- }
3444
- updateGrid(resize, transitionDuration = 0, _noRender = false) {
3445
- transitionDuration = transitionDuration || 0;
3446
- const context = this;
3447
- this.divItems.classed("draggable", this.designMode()).transition().duration(transitionDuration).style("left", function(d) {
3448
- return d.gridCol() * context.cellWidth + context.gutter() / 2 + "px";
3449
- }).style("top", function(d) {
3450
- return d.gridRow() * context.cellHeight + context.gutter() / 2 + "px";
3451
- }).style("width", function(d) {
3452
- return d.gridColSpan() * context.cellWidth - context.gutter() + "px";
3453
- }).style("height", function(d) {
3454
- return d.gridRowSpan() * context.cellHeight - context.gutter() + "px";
3455
- }).on("end", function(d) {
3456
- d.surfaceShadow_default(context.surfaceShadow()).surfacePadding_default(context.surfacePadding()).surfaceBorderWidth_default(context.surfaceBorderWidth()).surfaceBackgroundColor_default(context.surfaceBackgroundColor());
3457
- if (resize === true || resize === d.id()) {
3458
- d.resize().lazyRender();
3459
- }
3460
- });
3461
- }
3462
- update(domNode, element2) {
3463
- super.update(domNode, element2);
3464
- this._placeholderElement.style("overflow-x", this.fitTo() === "width" ? "hidden" : null);
3465
- this._placeholderElement.style("overflow-y", this.fitTo() === "width" ? "scroll" : null);
3466
- const dimensions = this.getDimensions();
3467
- const clientWidth = this.width() - (this.fitTo() === "width" ? this._scrollBarWidth : 0);
3468
- this.cellWidth = clientWidth / dimensions.width;
3469
- this.cellHeight = this.fitTo() === "all" ? this.height() / dimensions.height : this.cellWidth;
3470
- if (this.designMode()) {
3471
- const cellLaneRatio = Math.min(this.width() / this.snappingColumns(), this.height() / this.snappingRows());
3472
- const laneWidth = Math.floor(cellLaneRatio);
3473
- this.cellWidth = laneWidth;
3474
- this.cellHeight = this.cellWidth;
3475
- }
3476
- const context = this;
3477
- const divItems = element2.selectAll("#" + this.id() + " > .ddCell").data(this.content(), function(d) {
3478
- return d.id();
3479
- });
3480
- this.divItems = divItems.enter().append("div").attr("class", "ddCell").each(function(d) {
3481
- d.target(this);
3482
- d.__grid_watch = d.monitor(function(key, newVal, oldVal) {
3483
- if (context._renderCount && (key === "snapping" || key.indexOf("grid") === 0) && newVal !== oldVal) {
3484
- if (!context.gridList) {
3485
- context.initGridList();
3486
- if (context.snapping() !== "none") {
3487
- context.gridList.resizeGrid(context.snapping() === "horizontal" ? context.snappingRows() : context.snappingColumns());
3488
- }
3489
- context.items.forEach(context.gridItemToCell);
3490
- context.updateGrid(d.id(), 100);
3491
- context.killGridList();
3492
- }
3493
- }
3494
- });
3495
- const element = select(this);
3496
- element.append("div").attr("class", "resizeHandle").call(context._d3DragResize).append("div").attr("class", "resizeHandleDisplay");
3497
- }).merge(divItems);
3498
- this.divItems.each(function(d) {
3499
- const element = select(this);
3500
- if (context.designMode()) {
3501
- element.call(context._d3Drag);
3502
- } else {
3503
- element.on("mousedown.drag", null).on("touchstart.drag", null);
3504
- }
3505
- });
3506
- this.divItems.select(".resizeHandle").style("display", this.designMode() ? null : "none");
3507
- this.updateGrid(true);
3508
- divItems.exit().each(function(d) {
3509
- d.target(null);
3510
- if (d.__grid_watch) {
3511
- d.__grid_watch.remove();
3512
- }
3513
- }).remove();
3514
- const lanesBackground = element2.selectAll("#" + this.id() + " > .laneBackground").data(this.designMode() ? [""] : []);
3515
- lanesBackground.enter().insert("div", ":first-child").attr("class", "laneBackground").style("left", "1px").style("top", "1px").on("click", function() {
3516
- context.selectionBagClear();
3517
- }).merge(lanesBackground).style("width", this.snappingColumns() * this.cellWidth + "px").style("height", this.snappingRows() * this.cellHeight + "px");
3518
- lanesBackground.exit().each(function() {
3519
- context.selectionBagClear();
3520
- }).remove();
3521
- const lanes = element2.selectAll("#" + this.id() + " > .lane").data(this.designMode() ? [""] : []);
3522
- lanes.enter().append("div").attr("class", "lane").style("left", "1px").style("top", "1px");
3523
- 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");
3524
- lanes.exit().remove();
3525
- }
3526
- exit(domNode, element) {
3527
- this.content().forEach((w) => w.target(null));
3528
- super.exit(domNode, element);
3529
- }
3530
- _createSelectionObject(d) {
3531
- return {
3532
- _id: d._id,
3533
- element: /* @__PURE__ */ __name(() => {
3534
- return d._element;
3535
- }, "element"),
3536
- widget: d
3537
- };
3538
- }
3539
- selection(_) {
3540
- if (!arguments.length) return this._selectionBag.get().map(function(d) {
3541
- return d._id;
3542
- });
3543
- this._selectionBag.set(_.map(function(row) {
3544
- return this._createSelectionObject(row);
3545
- }, this));
3546
- return this;
3547
- }
3548
- selectionBagClear() {
3549
- if (!this._selectionBag.isEmpty()) {
3550
- this._selectionBag.clear();
3551
- this.postSelectionChange();
3552
- }
3553
- }
3554
- selectionBagClick(d) {
3555
- if (d !== null) {
3556
- const selectionObj = this._createSelectionObject(d);
3557
- if (d3Event().sourceEvent.ctrlKey) {
3558
- 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) {
3568
- this.selectionBagClear();
3569
- } else {
3570
- this._selectionBag.set([selectionObj]);
3571
- }
3572
- this.postSelectionChange();
3573
- }
3574
- }
3575
- }
3576
- postSelectionChange() {
3577
- }
3578
- applyLayout(layoutArr) {
3579
- this.divItems.each((d, i) => {
3580
- if (layoutArr[i]) {
3581
- const [x, y, w, h] = layoutArr[i];
3582
- d.gridCol(x).gridRow(y).gridColSpan(w).gridRowSpan(h);
3583
- }
3584
- });
3585
- this.updateGrid(true);
3586
- }
3587
- vizActivation(elem) {
3588
- }
3589
- };
3590
- __name(_Grid, "Grid");
3591
- let Grid = _Grid;
3592
- Grid.prototype._class += " layout_Grid";
3593
- Grid.prototype.publish("designMode", false, "boolean", "Design Mode", null, { tags: ["Basic"] });
3594
- Grid.prototype.publish("showLanes", true, "boolean", "Show snapping lanes when in design mode", null, { tags: ["Basic"], disable: /* @__PURE__ */ __name((w) => !w.designMode(), "disable") });
3595
- Grid.prototype.publish("fitTo", "all", "set", "Sizing Strategy", ["all", "width"], { tags: ["Basic"] });
3596
- Grid.prototype.publish("snapping", "vertical", "set", "Snapping Strategy", ["vertical", "horizontal", "none"]);
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, { tags: ["Basic"], render: false });
3605
- const _HorizontalList = class _HorizontalList extends FlexGrid {
3606
- constructor() {
3607
- super();
3608
- this.orientation_default("horizontal");
3609
- this.flexWrap_default("nowrap");
3610
- }
3611
- };
3612
- __name(_HorizontalList, "HorizontalList");
3613
- let HorizontalList = _HorizontalList;
3614
- HorizontalList.prototype._class += " layout_HorizontalList";
3615
- const _Layered = class _Layered extends HTMLWidget {
3616
- _contentContainer;
3617
- _widgetPlacements;
3618
- _widgetRatios;
3619
- constructor() {
3620
- super();
3621
- this._tag = "div";
3622
- this._widgetPlacements = [];
3623
- this._widgetRatios = [];
3624
- }
3625
- addLayer(widget, placement = "default", widthRatio = 1, heightRatio = 1) {
3626
- const widgets = this.widgets();
3627
- widgets.push(widget ? widget : new Text().text("No widget defined for layer."));
3628
- this.widgets(widgets);
3629
- this._widgetPlacements.push(placement);
3630
- this._widgetRatios.push([widthRatio, heightRatio]);
3631
- return this;
3632
- }
3633
- enter(domNode, element) {
3634
- super.enter(domNode, element);
3635
- this._contentContainer = element.append("div").attr("class", "container");
3636
- }
3637
- update(domNode, element) {
3638
- super.update(domNode, element);
3639
- const context = this;
3640
- element.style("padding", this.surfacePadding() + "px");
3641
- const content = this._contentContainer.selectAll(".content.id" + this.id()).data(this.widgets(), function(d) {
3642
- return d.id();
3643
- });
3644
- content.enter().append("div").attr("class", "content id" + this.id()).each(function(widget, idx) {
3645
- widget.target(this);
3646
- }).merge(content).each(function(widget, idx) {
3647
- const clientSize = {
3648
- width: context.clientWidth(),
3649
- height: context.clientHeight()
3650
- };
3651
- const widgetSize = context.widgetSize(idx, clientSize);
3652
- const widgetPosition = context.widgetPosition(idx, clientSize, widgetSize);
3653
- this.style.top = widgetPosition.y + "px";
3654
- this.style.left = widgetPosition.x + "px";
3655
- widget.resize(widgetSize).render();
3656
- });
3657
- content.exit().each(function(widget, idx) {
3658
- widget.target(null);
3659
- }).remove();
3660
- content.order();
3661
- }
3662
- widgetSize(idx, clientSize) {
3663
- if (this._widgetPlacements[idx] === "default") {
3664
- return {
3665
- width: clientSize.width * this._widgetRatios[idx][0],
3666
- height: clientSize.height * this._widgetRatios[idx][1]
3667
- };
3668
- } else {
3669
- return {
3670
- width: clientSize.width * this._widgetRatios[idx][0],
3671
- height: clientSize.height * this._widgetRatios[idx][1]
3672
- };
3673
- }
3674
- }
3675
- widgetPosition(idx, clientSize, widgetSize) {
3676
- switch (this._widgetPlacements[idx]) {
3677
- default:
3678
- return {
3679
- x: 0,
3680
- y: 0
3681
- };
3682
- case "top":
3683
- return {
3684
- x: clientSize.width / 2 - widgetSize.width / 2,
3685
- y: 0
3686
- };
3687
- case "bottom":
3688
- return {
3689
- x: clientSize.width / 2 - widgetSize.width / 2,
3690
- y: clientSize.height - widgetSize.height
3691
- };
3692
- case "left":
3693
- return {
3694
- x: 0,
3695
- y: clientSize.height / 2 - widgetSize.height / 2
3696
- };
3697
- case "right":
3698
- return {
3699
- x: clientSize.width - widgetSize.width,
3700
- y: clientSize.height / 2 - widgetSize.height / 2
3701
- };
3702
- case "center":
3703
- return {
3704
- x: clientSize.width / 2 - widgetSize.width / 2,
3705
- y: clientSize.height / 2 - widgetSize.height / 2
3706
- };
3707
- }
3708
- }
3709
- };
3710
- __name(_Layered, "Layered");
3711
- let Layered = _Layered;
3712
- Layered.prototype._class += " layout_Layered";
3713
- Layered.prototype.publish("surfacePadding", 0, "number", "Padding");
3714
- Layered.prototype.publish("widgets", [], "widgetArray", "widgets", null, { tags: ["Private"] });
3715
- const _Popup = class _Popup extends HTMLWidget {
3716
- _surfaceButtons;
3717
- _originalPosition;
3718
- constructor() {
3719
- super();
3720
- this._tag = "div";
3721
- this._surfaceButtons = [];
3722
- }
3723
- updateState(visible) {
3724
- visible = visible || !this.popupState();
3725
- this.popupState(visible).render();
3726
- }
3727
- enter(domNode, element) {
3728
- super.enter(domNode, element);
3729
- this.widget().target(domNode);
3730
- this._originalPosition = this.position();
3731
- }
3732
- update(domNode, element) {
3733
- super.update(domNode, element);
3734
- 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");
3735
- if (this.widget().size().height === 0) {
3736
- this.widget().resize(this.size());
3737
- }
3738
- }
3739
- postUpdate(domNode, element) {
3740
- let left;
3741
- let top;
3742
- switch (this.centerPopup()) {
3743
- case "container":
3744
- if (this._placeholderElement) {
3745
- left = parseInt(this._placeholderElement.style("width")) / 2 - this.widget().width() / 2;
3746
- top = parseInt(this._placeholderElement.style("height")) / 2 - this.widget().height() / 2;
3747
- }
3748
- this.position("absolute");
3749
- break;
3750
- case "window":
3751
- left = window.innerWidth / 2 - this.widget().width() / 2;
3752
- top = window.innerHeight / 2 - this.widget().height() / 2;
3753
- this.position("fixed");
3754
- break;
3755
- default:
3756
- left = 0;
3757
- top = 0;
3758
- this.position(this._originalPosition);
3759
- break;
3760
- }
3761
- this.pos({ x: left, y: top });
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()) {
3767
- this.widget().target(null);
3768
- }
3769
- super.exit(domNode, element);
3770
- }
3771
- click(obj) {
3772
- }
3773
- };
3774
- __name(_Popup, "Popup");
3775
- let Popup = _Popup;
3776
- Popup.prototype._class += " layout_Popup";
3777
- Popup.prototype.publish("popupState", false, "boolean", "State of the popup, visible (true) or hidden (false)", null, {});
3778
- 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, {});
3779
- Popup.prototype.publish("centerPopup", "none", "set", "Center the widget in its container element (target) or in the window", ["none", "container", "window"], {});
3780
- Popup.prototype.publish("top", null, "number", "Top position property of popup", null, {});
3781
- Popup.prototype.publish("bottom", null, "number", "Bottom position property of popup", null, {});
3782
- Popup.prototype.publish("left", null, "number", "Left position property of popup", null, {});
3783
- Popup.prototype.publish("right", null, "number", "Right position property of popup", null, {});
3784
- Popup.prototype.publish("position", "relative", "set", "Value of the 'position' property", ["absolute", "relative", "fixed", "static", "initial", "inherit"], { tags: ["Private"] });
3785
- Popup.prototype.publish("widget", null, "widget", "Widget", null, { tags: ["Private"] });
3786
- const _Tabbed = class _Tabbed extends HTMLWidget {
3787
- _tabContainer;
3788
- _contentContainer;
3789
- constructor() {
3790
- super();
3791
- this._tag = "div";
3792
- }
3793
- clearTabs() {
3794
- this.labels([]);
3795
- this.widgets([]);
3796
- return this;
3797
- }
3798
- addTab(widget, label, isActive, callback) {
3799
- const widgetSize = widget.size();
3800
- if (widgetSize.width === 0 && widgetSize.height === 0) {
3801
- widget.size({ width: "100%", height: "100%" });
3802
- }
3803
- const labels = this.labels();
3804
- const widgets = this.widgets();
3805
- if (isActive) {
3806
- this.activeTabIdx(this.widgets().length);
3807
- }
3808
- labels.push(label);
3809
- const surface = new Surface().widget(widget ? widget : new Text().text("No widget defined for tab"));
3810
- widgets.push(surface);
3811
- this.labels(labels);
3812
- this.widgets(widgets);
3813
- if (callback) {
3814
- callback(surface);
3815
- }
3816
- return this;
3817
- }
3818
- widgetSize(widgetDiv) {
3819
- const width = this.clientWidth();
3820
- let height = this.clientHeight();
3821
- const tcBox = this._tabContainer.node().getBoundingClientRect();
3822
- if (typeof tcBox.height !== "undefined") {
3823
- height -= tcBox.height;
3824
- }
3825
- return { width, height };
3826
- }
3827
- enter(domNode, element) {
3828
- super.enter(domNode, element);
3829
- this._tabContainer = element.append("div");
3830
- this._contentContainer = element.append("div");
3831
- }
3832
- update(domNode, element) {
3833
- super.update(domNode, element);
3834
- const context = this;
3835
- element.style("padding", this.surfacePadding_exists() ? this.surfacePadding() + "px" : null);
3836
- const tabs = this._tabContainer.selectAll(".tab-button.id" + this.id()).data(this.showTabs() ? this.labels() : [], function(d) {
3837
- return d;
3838
- });
3839
- tabs.enter().append("span").attr("class", "tab-button id" + this.id()).style("cursor", "pointer").on("click", function(d, idx) {
3840
- context.click(context.widgets()[idx].widget(), d, idx);
3841
- context.activeTabIdx(idx).render();
3842
- }).merge(tabs).classed("active", function(d, idx) {
3843
- return context.activeTabIdx() === idx;
3844
- }).text(function(d) {
3845
- return d;
3846
- });
3847
- tabs.exit().remove();
3848
- const content = this._contentContainer.selectAll(".tab-content.id" + this.id()).data(this.widgets(), function(d) {
3849
- return d.id();
3850
- });
3851
- content.enter().append("div").attr("class", "tab-content id" + this.id()).each(function(widget, idx) {
3852
- widget.target(this);
3853
- }).merge(content).classed("active", function(d, idx) {
3854
- return context.activeTabIdx() === idx;
3855
- }).style("display", function(d, idx) {
3856
- return context.activeTabIdx() === idx ? "block" : "none";
3857
- }).each(function(surface, idx) {
3858
- surface.visible(context.activeTabIdx() === idx);
3859
- if (context.activeTabIdx() === idx) {
3860
- const wSize = context.widgetSize(select(this));
3861
- surface.surfaceBorderWidth(context.showTabs() ? null : 0).surfacePadding(context.showTabs() ? null : 0).resize(wSize);
3862
- }
3863
- });
3864
- content.exit().each(function(widget, idx) {
3865
- widget.target(null);
3866
- }).remove();
3867
- switch (this.tabLocation()) {
3868
- case "bottom":
3869
- this._tabContainer.attr("class", "on_bottom").style("top", this._contentContainer.node().offsetHeight + this.surfacePadding() + "px").style("position", "absolute");
3870
- this._contentContainer.style("top", this.surfacePadding_exists() ? this.surfacePadding() + "px" : null).style("position", "absolute");
3871
- break;
3872
- default:
3873
- this._tabContainer.attr("class", "on_top").style("top", null).style("position", "relative");
3874
- this._contentContainer.style("top", this._tabContainer.node().offsetHeight + this.surfacePadding() + "px").style("position", "absolute");
3875
- break;
3876
- }
3877
- }
3878
- click(widget, column, idx) {
3879
- }
3880
- };
3881
- __name(_Tabbed, "Tabbed");
3882
- let Tabbed = _Tabbed;
3883
- Tabbed.prototype._class += " layout_Tabbed";
3884
- Tabbed.prototype.publish("showTabs", true, "boolean", "Show Tabs", null, {});
3885
- Tabbed.prototype.publish("surfacePadding", 4, "number", "Padding");
3886
- Tabbed.prototype.publish("activeTabIdx", 0, "number", "Index of active tab", null, {});
3887
- Tabbed.prototype.publish("labels", [], "array", "Array of tab labels sharing an index with ", null, { tags: ["Private"] });
3888
- Tabbed.prototype.publish("tabLocation", "top", "set", "Position the tabs at the bottom of the widget", ["top", "bottom"], { tags: ["Private"] });
3889
- Tabbed.prototype.publish("widgets", [], "widgetArray", "widgets", null, { tags: ["Private"] });
3890
- const _Toolbar = class _Toolbar extends HTMLWidget {
3891
- constructor() {
3892
- super();
3893
- this._tag = "div";
3894
- }
3895
- enter(domNode, element) {
3896
- super.enter(domNode, element);
3897
- }
3898
- update(domNode, element) {
3899
- super.update(domNode, element);
3900
- const context = this;
3901
- element.attr("title", context.title()).style("background-color", this.backgroundColor());
3902
- const title = element.selectAll("div.toolbar-title").data(this.title() ? [this.title()] : []);
3903
- title.enter().append("div").classed("toolbar-title", true).append("span");
3904
- 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());
3905
- title.exit().remove();
3906
- const childWidgets = element.selectAll("div.toolbar-child").data(this.widgets() !== null ? this.widgets() : [], function(d) {
3907
- return d.id();
3908
- });
3909
- childWidgets.enter().insert("div", "div.toolbar-title").each(function(d, i) {
3910
- const widgetClass = context.widgetClasses()[i] ? context.widgetClasses()[i] + " toolbar-child" : "toolbar-child";
3911
- select(this).classed(widgetClass, true);
3912
- d.target(this);
3913
- });
3914
- childWidgets.exit().each(function(d) {
3915
- d.target(null);
3916
- }).remove();
3917
- childWidgets.order();
3918
- }
3919
- render(callback) {
3920
- const context = this;
3921
- return super.render(function(w) {
3922
- const toolbarBBox = context.element().node().getBoundingClientRect();
3923
- let minX = toolbarBBox.left + toolbarBBox.width;
3924
- context.element().selectAll("div.toolbar-child").each(function(d, i) {
3925
- const childBBox = this.getBoundingClientRect();
3926
- if (minX > childBBox.left)
3927
- minX = childBBox.left;
3928
- });
3929
- context.element().select(".toolbar-title").style("width", minX - toolbarBBox.left - 4 + "px");
3930
- if (callback) {
3931
- callback(w);
3932
- }
3933
- });
3934
- }
3935
- exit(domNode, element) {
3936
- this.widgets().forEach(function(w) {
3937
- w.target(null);
3938
- });
3939
- super.exit(domNode, element);
3940
- }
3941
- };
3942
- __name(_Toolbar, "Toolbar");
3943
- let Toolbar = _Toolbar;
3944
- Toolbar.prototype._class += " layout_Toolbar";
3945
- Toolbar.prototype.publish("title", "", "string", "Title", null, { tags: ["Intermediate"] });
3946
- Toolbar.prototype.publish("fontSize", null, "number", "Title Font Size (px)", null, { tags: ["Advanced"], optional: true });
3947
- Toolbar.prototype.publish("fontColor", null, "html-color", "Title Font Color", null, { tags: ["Advanced"], optional: true });
3948
- Toolbar.prototype.publish("fontFamily", null, "string", "Title Font Family", null, { tags: ["Advanced"], optional: true });
3949
- Toolbar.prototype.publish("fontBold", true, "boolean", "Enable Bold Title Font", null, { tags: ["Advanced"], optional: true });
3950
- Toolbar.prototype.publish("backgroundColor", null, "html-color", "Background Color", null, { tags: ["Intermediate"], optional: true });
3951
- Toolbar.prototype.publish("responsive", true, "boolean", "Adapts to pixel width", null, { tags: ["Basic"] });
3952
- Toolbar.prototype.publish("widgets", [], "widgetArray", "Child widgets of the toolbar", null, { tags: ["Basic"] });
3953
- 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"] });
3954
- const _VerticalList = class _VerticalList extends FlexGrid {
3955
- constructor() {
3956
- super();
3957
- this.orientation_default("vertical");
3958
- this.flexWrap_default("nowrap");
3959
- }
3960
- };
3961
- __name(_VerticalList, "VerticalList");
3962
- let VerticalList = _VerticalList;
3963
- VerticalList.prototype._class += " layout_VerticalList";
3964
- export {
3965
- AbsoluteSurface,
3966
- Accordion,
3967
- BUILD_VERSION,
3968
- Border,
3969
- Border2,
3970
- Carousel,
3971
- Cell,
3972
- ChartPanel,
3973
- FlexGrid,
3974
- Grid,
3975
- HorizontalList,
3976
- Layered,
3977
- Legend,
3978
- Modal,
3979
- PKG_NAME,
3980
- PKG_VERSION,
3981
- Popup,
3982
- Surface,
3983
- Tabbed,
3984
- Toolbar,
3985
- VerticalList,
3986
- WidgetDiv
3987
- };
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};
3988
3
  //# sourceMappingURL=index.js.map
3989
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)}}();