@hpcc-js/form 3.3.0 → 3.3.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,988 +1,3 @@
1
- import { IInput } from "@hpcc-js/api";
2
- import { HTMLWidget, SVGWidget, WidgetArray, d3Event, drag, format, rgb, scaleLinear, select, timeFormat, timeParse } from "@hpcc-js/common";
3
-
4
- //#region src/__package__.ts
5
- const PKG_NAME = "@hpcc-js/form";
6
- const PKG_VERSION = "3.3.0";
7
- const BUILD_VERSION = "3.15.0";
8
-
9
- //#endregion
10
- //#region src/Button.ts
11
- var Button = class extends HTMLWidget {
12
- _inputElement = [];
13
- constructor() {
14
- super();
15
- IInput.call(this);
16
- this._tag = "div";
17
- }
18
- enter(domNode, element) {
19
- super.enter(domNode, element);
20
- const context = this;
21
- this._inputElement[0] = element.append("button").attr("name", this.name()).on("click", function(w) {
22
- w.click(w);
23
- }).on("blur", function(w) {
24
- w.blur(w);
25
- }).on("change", function(w) {
26
- context.value([context._inputElement[0].property("value")]);
27
- w.change(w, true);
28
- });
29
- }
30
- update(domNode, element) {
31
- super.update(domNode, element);
32
- this._inputElement[0].text(this.value());
33
- }
34
- };
35
- Button.prototype._class += " form_Button";
36
- Button.prototype.implements(IInput.prototype);
37
-
38
- //#endregion
39
- //#region src/CheckBox.ts
40
- var CheckBox = class extends HTMLWidget {
41
- _inputElement = [];
42
- constructor() {
43
- super();
44
- IInput.call(this);
45
- this._tag = "div";
46
- }
47
- enter(domNode, element) {
48
- super.enter(domNode, element);
49
- const context = this;
50
- const checkboxContainer = element.append("ul");
51
- if (!this.selectOptions().length) this.selectOptions().push("");
52
- this.selectOptions().forEach(function(val, idx) {
53
- context._inputElement[idx] = checkboxContainer.append("li").append("input").attr("type", "checkbox");
54
- context._inputElement[idx].node().insertAdjacentHTML("afterend", "<text>" + val + "</text>");
55
- });
56
- this._inputElement.forEach(function(e, idx) {
57
- e.attr("name", context.name());
58
- e.on("click", function(w) {
59
- w.click(w);
60
- });
61
- e.on("blur", function(w) {
62
- w.blur(w);
63
- });
64
- e.on("change", function(w) {
65
- const vals = [];
66
- context._inputElement.forEach(function(d) {
67
- if (d.property("checked")) vals.push(d.property("value"));
68
- });
69
- context.value(vals);
70
- w.change(w, true);
71
- });
72
- });
73
- }
74
- update(domNode, element) {
75
- super.update(domNode, element);
76
- const context = this;
77
- this._inputElement.forEach(function(e, idx) {
78
- e.property("value", context.selectOptions()[idx]);
79
- if (context.value().indexOf(context.selectOptions()[idx]) !== -1 && context.value() !== "false") e.property("checked", true);
80
- else e.property("checked", false);
81
- });
82
- }
83
- insertSelectOptions(optionsArr) {
84
- let optionHTML = "";
85
- if (optionsArr.length > 0) optionsArr.forEach(function(opt) {
86
- const val = opt instanceof Array ? opt[0] : opt;
87
- const text = opt instanceof Array ? opt[1] ? opt[1] : opt[0] : opt;
88
- optionHTML += "<option value='" + val + "'>" + text + "</option>";
89
- });
90
- else optionHTML += "<option>selectOptions not set</option>";
91
- this._inputElement[0].html(optionHTML);
92
- }
93
- };
94
- CheckBox.prototype._class += " form_CheckBox";
95
- CheckBox.prototype.implements(IInput.prototype);
96
- CheckBox.prototype.publish("selectOptions", [], "array", "Array of options used to fill a dropdown list");
97
-
98
- //#endregion
99
- //#region src/ColorInput.ts
100
- var ColorInput = class extends HTMLWidget {
101
- _inputElement = [];
102
- constructor() {
103
- super();
104
- IInput.call(this);
105
- this._tag = "div";
106
- }
107
- enter(domNode, element) {
108
- super.enter(domNode, element);
109
- const context = this;
110
- this._inputElement[0] = element.append("input").attr("type", "text");
111
- this._inputElement[0].classed("color-text", true);
112
- this._inputElement[1] = element.append("input").attr("type", "color");
113
- this._inputElement.forEach(function(e, idx) {
114
- e.on("click", function(w) {
115
- w.click(w);
116
- });
117
- e.on("blur", function(w) {
118
- w.blur(w);
119
- });
120
- e.on("change", function(w) {
121
- if (idx === 0) {
122
- context._inputElement[1].property("value", rgb(context._inputElement[0].property("value")).toString());
123
- context.value(context._inputElement[0].property("value"));
124
- } else {
125
- context._inputElement[0].property("value", context._inputElement[1].property("value"));
126
- context.value(rgb(context._inputElement[1].property("value")).toString());
127
- }
128
- w.change(w, true);
129
- });
130
- });
131
- }
132
- update(domNode, element) {
133
- super.update(domNode, element);
134
- const context = this;
135
- this._inputElement.forEach(function(e) {
136
- e.attr("name", context.name());
137
- });
138
- this._inputElement[0].attr("type", "text");
139
- this._inputElement[1].attr("type", "color");
140
- this._inputElement[0].property("value", this.value());
141
- this._inputElement[1].property("value", rgb(this.value()).toString());
142
- const bbox = this._inputElement[0].node().getBoundingClientRect();
143
- this._inputElement[1].style("height", bbox.height - 2 + "px");
144
- }
145
- };
146
- ColorInput.prototype._class += " form_ColorInput";
147
- ColorInput.prototype.implements(IInput.prototype);
148
-
149
- //#endregion
150
- //#region src/Form.ts
151
- var Form = class extends HTMLWidget {
152
- tbody;
153
- tfoot;
154
- btntd;
155
- _controls;
156
- _maxCols;
157
- constructor() {
158
- super();
159
- this._tag = "form";
160
- }
161
- data(_) {
162
- if (!arguments.length) {
163
- const retVal = [];
164
- this.inputsForEach(function(input) {
165
- retVal.push(input.value());
166
- });
167
- return retVal;
168
- } else this.inputsForEach(function(input, idx) {
169
- if (_ && _.length > idx) input.value(_[idx]).render();
170
- });
171
- return this;
172
- }
173
- inputsForEach(callback, scope) {
174
- let idx = 0;
175
- this.inputs().forEach(function(inp) {
176
- (inp instanceof WidgetArray ? inp.content() : [inp]).forEach(function(inp2) {
177
- if (scope) callback.call(scope, inp2, idx++);
178
- else callback(inp2, idx++);
179
- });
180
- });
181
- }
182
- inputsMap() {
183
- const retVal = {};
184
- this.inputs().forEach(function(inp) {
185
- retVal[inp.name()] = inp;
186
- });
187
- return retVal;
188
- }
189
- calcMaxColumns() {
190
- let retVal = 0;
191
- this.inputs().forEach(function(inputWidget) {
192
- const inputWidgetArray = inputWidget instanceof WidgetArray ? inputWidget.content() : [inputWidget];
193
- if (inputWidgetArray.length > retVal) retVal = inputWidgetArray.length;
194
- });
195
- return retVal;
196
- }
197
- values(_) {
198
- if (!arguments.length) {
199
- const dataArr = {};
200
- this.inputsForEach(function(inp) {
201
- const type = inp.type ? inp.type() : "text";
202
- if (inp.value() || !this.omitBlank()) switch (type) {
203
- case "checkbox":
204
- dataArr[inp.name()] = inp.value_exists() ? !!inp.value() : void 0;
205
- break;
206
- case "number":
207
- const v = inp.value();
208
- dataArr[inp.name()] = v === "" ? void 0 : +v;
209
- break;
210
- case "text":
211
- default:
212
- dataArr[inp.name()] = inp.value_exists() ? inp.value() : void 0;
213
- break;
214
- }
215
- }, this);
216
- return dataArr;
217
- } else this.inputsForEach(function(inp) {
218
- if (_[inp.name()]) inp.value(_[inp.name()]);
219
- else if (this.omitBlank()) inp.value("");
220
- }, this);
221
- return this;
222
- }
223
- submit() {
224
- let isValid = true;
225
- if (this.validate()) isValid = this.checkValidation();
226
- if (!this.allowEmptyRequest() && !this.inputs().some(function(w) {
227
- if (w._class.indexOf("WidgetArray") !== -1) return w.content().some(function(wa) {
228
- return wa.hasValue();
229
- });
230
- return w.hasValue();
231
- })) return;
232
- this.click(isValid ? this.values() : null, null, isValid);
233
- }
234
- clear() {
235
- this.inputsForEach(function(inp) {
236
- switch (inp.classID()) {
237
- case "form_Slider":
238
- if (inp.allowRange()) inp.value([inp.low(), inp.low()]).render();
239
- else inp.value(inp.low()).render();
240
- break;
241
- case "form_CheckBox":
242
- inp.value(false).render();
243
- break;
244
- case "form_Button": break;
245
- default:
246
- inp.value(void 0).render();
247
- break;
248
- }
249
- });
250
- }
251
- checkValidation() {
252
- let ret = true;
253
- const msgArr = [];
254
- this.inputsForEach(function(inp) {
255
- if (!inp.isValid()) msgArr.push("'" + inp.label() + "' value is invalid.");
256
- });
257
- if (msgArr.length > 0) {
258
- alert(msgArr.join("\n"));
259
- ret = false;
260
- }
261
- return ret;
262
- }
263
- enter(domNode, element) {
264
- super.enter(domNode, element);
265
- element.on("submit", function() {
266
- d3Event().preventDefault();
267
- });
268
- this._placeholderElement.style("overflow", "auto");
269
- const table = element.append("table");
270
- this.tbody = table.append("tbody");
271
- this.tfoot = table.append("tfoot");
272
- this.btntd = this.tfoot.append("tr").append("td").attr("colspan", 2);
273
- const context = this;
274
- this._controls = [new Button().classed({ default: true }).value("Submit").on("click", function() {
275
- context.submit();
276
- }, true), new Button().value("Clear").on("click", function() {
277
- context.clear();
278
- }, true)];
279
- const rightJust = context.btntd.append("div").style("float", "right");
280
- this._controls.forEach(function(w) {
281
- const leftJust = rightJust.append("span").style("float", "left");
282
- w.target(leftJust.node()).render();
283
- });
284
- }
285
- update(domNode, element) {
286
- super.update(domNode, element);
287
- this._maxCols = this.calcMaxColumns();
288
- const context = this;
289
- const rows = this.tbody.selectAll("tr").data(this.inputs());
290
- rows.enter().append("tr").each(function(inputWidget, i) {
291
- const element2 = select(this);
292
- const inputWidgetArray = inputWidget instanceof WidgetArray ? inputWidget.content() : [inputWidget];
293
- inputWidgetArray.forEach(function(inputWidget2, idx) {
294
- element2.append("td").attr("class", "prompt");
295
- const input = element2.append("td").attr("class", "input");
296
- if (idx === inputWidgetArray.length - 1 && inputWidgetArray.length < context._maxCols) input.attr("colspan", (context._maxCols - inputWidgetArray.length + 1) * 2);
297
- inputWidget2.target(input.node()).render();
298
- if (inputWidget2 instanceof SVGWidget) {
299
- const bbox = inputWidget2.element().node().getBBox();
300
- input.style("height", bbox.height + "px");
301
- inputWidget2.resize().render();
302
- }
303
- if (inputWidget2._inputElement instanceof Array) inputWidget2._inputElement.forEach(function(e) {
304
- e.on("keyup.form", function(w) {
305
- setTimeout(function() {
306
- context._controls[0].disable(!context.allowEmptyRequest() && !context.inputs().some(function(w2) {
307
- if (w2._class.indexOf("WidgetArray") !== -1) return w2.content().some(function(wa) {
308
- return wa.hasValue();
309
- });
310
- return w2.hasValue();
311
- }));
312
- }, 100);
313
- });
314
- });
315
- });
316
- }).merge(rows).each(function(inputWidget, i) {
317
- const element2 = select(this);
318
- (inputWidget instanceof WidgetArray ? inputWidget.content() : [inputWidget]).forEach(function(inputWidget2, idx) {
319
- element2.select("td.prompt").text(inputWidget2.label() + ":");
320
- });
321
- });
322
- rows.each(function(inputWidget, i) {
323
- if (i === 0 && inputWidget.setFocus) inputWidget.setFocus();
324
- });
325
- rows.exit().each(function(inputWidget, i) {
326
- (inputWidget instanceof WidgetArray ? inputWidget.content() : [inputWidget]).forEach(function(inputWidget2, idx) {
327
- inputWidget2.target(null);
328
- });
329
- }).remove();
330
- this.tfoot.style("display", this.showSubmit() ? "table-footer-group" : "none");
331
- this.btntd.attr("colspan", this._maxCols * 2);
332
- if (!this.allowEmptyRequest()) setTimeout(function() {
333
- context._controls[0].disable(!context.allowEmptyRequest() && !context.inputs().some(function(w) {
334
- if (w._class.indexOf("WidgetArray") !== -1) return w.content().some(function(wa) {
335
- return wa.hasValue();
336
- });
337
- return w.hasValue();
338
- }));
339
- }, 100);
340
- }
341
- exit(domNode, element) {
342
- this.inputsForEach((input) => input.target(null));
343
- super.exit(domNode, element);
344
- }
345
- click(row, col, sel) {}
346
- };
347
- Form.prototype._class += " form_Form";
348
- Form.prototype.publish("validate", true, "boolean", "Enable/Disable input validation");
349
- Form.prototype.publish("inputs", [], "widgetArray", "Array of input widgets", null, { render: false });
350
- Form.prototype.publish("showSubmit", true, "boolean", "Show Submit/Cancel Controls");
351
- Form.prototype.publish("omitBlank", false, "boolean", "Drop Blank Fields From Submit");
352
- Form.prototype.publish("allowEmptyRequest", false, "boolean", "Allow Blank Form to be Submitted");
353
-
354
- //#endregion
355
- //#region src/Input.ts
356
- var Input = class extends HTMLWidget {
357
- _inputElement = [];
358
- _labelElement = [];
359
- constructor() {
360
- super();
361
- IInput.call(this);
362
- this._tag = "div";
363
- }
364
- checked(_) {
365
- if (!arguments.length) return this._inputElement[0] ? this._inputElement[0].property("checked") : false;
366
- if (this._inputElement[0]) this._inputElement[0].property("checked", _);
367
- return this;
368
- }
369
- enter(domNode, element) {
370
- super.enter(domNode, element);
371
- this._labelElement[0] = element.append("label").attr("for", this.id() + "_input").style("visibility", this.inlineLabel_exists() ? "visible" : "hidden");
372
- const context = this;
373
- switch (this.type()) {
374
- case "button":
375
- this._inputElement[0] = element.append("button").attr("id", this.id() + "_input");
376
- break;
377
- case "textarea":
378
- this._inputElement[0] = element.append("textarea").attr("id", this.id() + "_input");
379
- break;
380
- default:
381
- this._inputElement[0] = element.append("input").attr("id", this.id() + "_input").attr("type", this.type());
382
- break;
383
- }
384
- this._inputElement.forEach(function(e, idx) {
385
- e.attr("name", context.name());
386
- e.on("click", function(w) {
387
- w.click(w);
388
- });
389
- e.on("blur", function(w) {
390
- w.blur(w);
391
- });
392
- e.on("change", function(w) {
393
- context.value([e.property("value")]);
394
- w.change(w, true);
395
- });
396
- e.on("keyup", function(w) {
397
- context.value([e.property("value")]);
398
- w.change(w, false);
399
- });
400
- });
401
- }
402
- update(domNode, element) {
403
- super.update(domNode, element);
404
- this._labelElement[0].style("visibility", this.inlineLabel_exists() ? "visible" : "hidden").text(this.inlineLabel());
405
- switch (this.type()) {
406
- case "button":
407
- this._inputElement[0].text(this.value());
408
- break;
409
- case "textarea":
410
- this._inputElement[0].property("value", this.value());
411
- break;
412
- default:
413
- this._inputElement[0].attr("type", this.type());
414
- this._inputElement[0].property("value", this.value());
415
- break;
416
- }
417
- }
418
- blur(w) {}
419
- keyup(w) {}
420
- focus(w) {}
421
- click(w) {}
422
- dblclick(w) {}
423
- change(w, complete) {}
424
- };
425
- Input.prototype._class += " form_Input";
426
- Input.prototype.implements(IInput.prototype);
427
- Input.prototype.publish("type", "text", "set", "Input type", [
428
- "string",
429
- "number",
430
- "boolean",
431
- "date",
432
- "time",
433
- "hidden",
434
- "nested",
435
- "button",
436
- "checkbox",
437
- "text",
438
- "textarea",
439
- "search",
440
- "email",
441
- "datetime"
442
- ]);
443
- Input.prototype.publish("inlineLabel", null, "string", "Input Label", null, { optional: true });
444
-
445
- //#endregion
446
- //#region src/FieldForm.ts
447
- var FieldForm = class extends Form {
448
- constructor() {
449
- super();
450
- this._tag = "form";
451
- }
452
- fields(_) {
453
- const retVal = super.fields.apply(this, arguments);
454
- if (arguments.length) {
455
- const inpMap = this.inputsMap();
456
- this.inputs(_.map((f) => inpMap[f.id()] || new Input().name(f.id()).label(f.label()).type(f.type())));
457
- }
458
- return retVal;
459
- }
460
- data(_) {
461
- if (!arguments.length) return super.data();
462
- super.data(_[0]);
463
- if (_[0]) {
464
- const inputs = this.inputs();
465
- const __lparam = _[0][this.columns().length];
466
- let i = 0;
467
- for (const key in __lparam) {
468
- inputs[i].name(key);
469
- ++i;
470
- }
471
- }
472
- return this;
473
- }
474
- };
475
- FieldForm.prototype._class += " form_FieldForm";
476
-
477
- //#endregion
478
- //#region src/InputRange.ts
479
- var InputRange = class extends HTMLWidget {
480
- _inputElement = [];
481
- _labelElement = [];
482
- _rangeData = [];
483
- constructor() {
484
- super();
485
- IInput.call(this);
486
- this._tag = "div";
487
- }
488
- enter(domNode, element) {
489
- super.enter(domNode, element);
490
- this._labelElement[0] = element.append("label").attr("for", this.id() + "_input").style("visibility", this.inlineLabel_exists() ? "visible" : "hidden");
491
- this._inputElement.push(element.append("input").attr("id", this.id() + "_input_min").attr("type", this.type()));
492
- this._inputElement.push(element.append("input").attr("id", this.id() + "_input_max").attr("type", this.type()));
493
- const context = this;
494
- this._inputElement.forEach(function(e, idx) {
495
- e.attr("name", context.name());
496
- e.on("click", function(w) {
497
- w.click(w);
498
- });
499
- e.on("blur", function(w) {
500
- w.blur(w);
501
- });
502
- e.on("change", function(w) {
503
- context._rangeData[idx] = e.property("value");
504
- context.value(context._rangeData);
505
- w.change(w, true);
506
- });
507
- });
508
- }
509
- update(domNode, element) {
510
- super.update(domNode, element);
511
- this._labelElement[0].style("visibility", this.inlineLabel_exists() ? "visible" : "hidden").text(this.inlineLabel());
512
- this._rangeData = this.value();
513
- this._inputElement.forEach(function(e, idx) {
514
- e.attr("type", this.type()).property("value", this._rangeData.length > idx ? this._rangeData[idx] : "");
515
- }, this);
516
- }
517
- };
518
- InputRange.prototype._class += " form_InputRange";
519
- InputRange.prototype.implements(IInput.prototype);
520
- InputRange.prototype.publish("type", "text", "set", "InputRange type", [
521
- "number",
522
- "date",
523
- "text",
524
- "time",
525
- "datetime",
526
- "hidden"
527
- ]);
528
- InputRange.prototype.publish("inlineLabel", null, "string", "InputRange Label", null, { optional: true });
529
- InputRange.prototype.publish("value", ["", ""], "array", "Input Current Value", null, { override: true });
530
-
531
- //#endregion
532
- //#region src/OnOff.ts
533
- var OnOff = class extends HTMLWidget {
534
- _inputElement = [];
535
- _input;
536
- constructor() {
537
- super();
538
- IInput.call(this);
539
- this._tag = "div";
540
- }
541
- enter(domNode, element) {
542
- super.enter(domNode, element);
543
- element.classed("onoffswitch", true);
544
- const context = this;
545
- this._input = element.append("input").attr("class", "onoffswitch-checkbox").attr("type", "checkbox").attr("id", this.id() + "_onOff").on("click", function(w) {
546
- w.click(w);
547
- }).on("blur", function(w) {
548
- w.blur(w);
549
- }).on("change", function(w) {
550
- const vals = [];
551
- context._inputElement.forEach(function(d, idx) {
552
- if (d.property("checked")) vals.push(d.property("value"));
553
- });
554
- context.value(vals);
555
- w.change(w, true);
556
- });
557
- const label = element.append("label").attr("class", "onoffswitch-label").attr("for", this.id() + "_onOff");
558
- const inner = label.append("div").attr("class", "onoffswitch-inner");
559
- inner.append("div").attr("class", "onoffswitch-offText").style("padding-right", this.containerRadius() / 2 + "px").text(this.offText());
560
- inner.append("div").attr("class", "onoffswitch-onText").style("padding-left", this.containerRadius() / 2 + "px").style("width", `calc(100% - ${this.containerRadius() / 2}px)`).text(this.onText());
561
- label.append("div").attr("class", "onoffswitch-switch");
562
- }
563
- update(domNode, element) {
564
- super.update(domNode, element);
565
- this._input.attr("name", this.name());
566
- element.style("margin-left", this.marginLeft() + "px").style("margin-bottom", this.marginBottom() + "px").style("width", this.minWidth() + "px");
567
- const _switch_size = this.minHeight() - this.gutter() * 4;
568
- element.select(".onoffswitch-switch").style("height", _switch_size + "px").style("width", _switch_size + "px").style("top", this.gutter() * 2 + 1 + "px").style("border-radius", this.switchRadius() + "px");
569
- element.select(".onoffswitch-inner").style("min-height", this.minHeight() + "px");
570
- element.select(".onoffswitch-label").style("border-radius", this.containerRadius() + "px");
571
- element.select(".onoffswitch-offText").style("color", this.offFontColor()).style("background-color", this.offColor());
572
- element.select(".onoffswitch-onText").style("color", this.onFontColor()).style("background-color", this.onColor());
573
- }
574
- };
575
- OnOff.prototype._class += " form_OnOff";
576
- OnOff.prototype.implements(IInput.prototype);
577
- OnOff.prototype.publish("marginLeft", 0, "number", "Margin left of OnOff");
578
- OnOff.prototype.publish("marginBottom", 0, "number", "Margin bottom of OnOff");
579
- OnOff.prototype.publish("minWidth", 100, "number", "Minimum width of OnOff (pixels)");
580
- OnOff.prototype.publish("minHeight", 20, "number", "Minimum height of OnOff (pixels)");
581
- OnOff.prototype.publish("gutter", 1, "number", "Space between switch and border of OnOff (pixels)");
582
- OnOff.prototype.publish("onText", "Save", "string", "Text to display when 'ON'");
583
- OnOff.prototype.publish("offText", "Properties", "string", "Text to display when 'OFF'");
584
- OnOff.prototype.publish("switchRadius", 10, "number", "Border radius of switch (pixels)");
585
- OnOff.prototype.publish("containerRadius", 10, "number", "Border radius of OnOff (pixels)");
586
- OnOff.prototype.publish("onColor", "#2ecc71", "html-color", "Background color when 'ON'");
587
- OnOff.prototype.publish("offColor", "#ecf0f1", "html-color", "Background color when 'OFF'");
588
- OnOff.prototype.publish("onFontColor", "#2c3e50", "html-color", "Font color when 'ON'");
589
- OnOff.prototype.publish("offFontColor", "#7f8c8d", "html-color", "Font color when 'OFF'");
590
-
591
- //#endregion
592
- //#region src/Radio.ts
593
- var Radio = class extends HTMLWidget {
594
- _inputElement = [];
595
- constructor() {
596
- super();
597
- IInput.call(this);
598
- this._tag = "div";
599
- }
600
- enter(domNode, element) {
601
- super.enter(domNode, element);
602
- const context = this;
603
- const radioContainer = element.append("ul");
604
- if (!this.selectOptions().length) this.selectOptions().push("");
605
- this.selectOptions().forEach(function(val, idx) {
606
- context._inputElement[idx] = radioContainer.append("li").append("input").attr("type", "radio");
607
- context._inputElement[idx].node().insertAdjacentHTML("afterend", "<text>" + val + "</text>");
608
- });
609
- this._inputElement.forEach(function(e, idx) {
610
- e.attr("name", context.name());
611
- e.on("click", function(w) {
612
- w.click(w);
613
- });
614
- e.on("blur", function(w) {
615
- w.blur(w);
616
- });
617
- e.on("change", function(w) {
618
- context.value([e.property("value")]);
619
- w.change(w, true);
620
- });
621
- });
622
- }
623
- update(domNode, element) {
624
- super.update(domNode, element);
625
- const context = this;
626
- this._inputElement.forEach(function(e, idx) {
627
- e.property("value", context.selectOptions()[idx]);
628
- if (context.value().indexOf(context.selectOptions()[idx]) !== -1 && context.value() !== "false") e.property("checked", true);
629
- else e.property("checked", false);
630
- });
631
- }
632
- };
633
- Radio.prototype._class += " form_Radio";
634
- Radio.prototype.implements(IInput.prototype);
635
- Radio.prototype.publish("selectOptions", [], "array", "Array of options used to fill a dropdown list");
636
-
637
- //#endregion
638
- //#region src/Range.ts
639
- var Range = class extends HTMLWidget {
640
- _inputElement = [];
641
- constructor() {
642
- super();
643
- IInput.call(this);
644
- this._tag = "div";
645
- }
646
- enter(domNode, element) {
647
- super.enter(domNode, element);
648
- const context = this;
649
- this._inputElement[0] = element.append("input").attr("type", "range");
650
- this._inputElement[1] = element.append("input").attr("type", "number");
651
- this._inputElement.forEach(function(e, idx) {
652
- e.attr("name", context.name());
653
- e.on("click", function(w) {
654
- w.click(w);
655
- });
656
- e.on("blur", function(w) {
657
- w.blur(w);
658
- });
659
- e.on("change", function(w) {
660
- if (idx === 0) {
661
- context._inputElement[1].property("value", rgb(context._inputElement[0].property("value")).toString());
662
- context.value(context._inputElement[0].property("value"));
663
- } else {
664
- context._inputElement[0].property("value", context._inputElement[1].property("value"));
665
- context.value(rgb(context._inputElement[1].property("value")).toString());
666
- }
667
- w.change(w, true);
668
- });
669
- });
670
- }
671
- update(domNode, element) {
672
- super.update(domNode, element);
673
- this._inputElement[0].attr("type", "range");
674
- this._inputElement[0].property("value", this.value());
675
- this._inputElement[0].attr("min", this.low());
676
- this._inputElement[0].attr("max", this.high());
677
- this._inputElement[0].attr("step", this.step());
678
- this._inputElement[1].attr("type", "number");
679
- this._inputElement[1].property("value", this.value());
680
- this._inputElement[1].attr("min", this.low());
681
- this._inputElement[1].attr("max", this.high());
682
- this._inputElement[1].attr("step", this.step());
683
- }
684
- insertSelectOptions(optionsArr) {
685
- let optionHTML = "";
686
- if (optionsArr.length > 0) optionsArr.forEach(function(opt) {
687
- const val = opt instanceof Array ? opt[0] : opt;
688
- const text = opt instanceof Array ? opt[1] ? opt[1] : opt[0] : opt;
689
- optionHTML += "<option value='" + val + "'>" + text + "</option>";
690
- });
691
- else optionHTML += "<option>selectOptions not set</option>";
692
- this._inputElement[0].html(optionHTML);
693
- }
694
- };
695
- Range.prototype._class += " form_Range";
696
- Range.prototype.implements(IInput.prototype);
697
- Range.prototype.publish("type", "text", "set", "Input type", [
698
- "html-color",
699
- "number",
700
- "checkbox",
701
- "button",
702
- "select",
703
- "textarea",
704
- "date",
705
- "text",
706
- "range",
707
- "search",
708
- "email",
709
- "time",
710
- "datetime"
711
- ]);
712
- Range.prototype.publish("selectOptions", [], "array", "Array of options used to fill a dropdown list");
713
- Range.prototype.publish("low", null, "number", "Minimum value for Range input");
714
- Range.prototype.publish("high", null, "number", "Maximum value for Range input");
715
- Range.prototype.publish("step", null, "number", "Step value for Range input");
716
-
717
- //#endregion
718
- //#region src/Select.ts
719
- var Select = class extends HTMLWidget {
720
- _inputElement = [];
721
- constructor() {
722
- super();
723
- IInput.call(this);
724
- this._tag = "div";
725
- }
726
- enter(domNode, element) {
727
- super.enter(domNode, element);
728
- const context = this;
729
- this._inputElement[0] = element.append("select").attr("name", this.name()).on("click", function(w) {
730
- w.click(w);
731
- }).on("blur", function(w) {
732
- w.blur(w);
733
- }).on("change", function(w) {
734
- context.value([context._inputElement[0].property("value")]);
735
- w.change(w, true);
736
- });
737
- }
738
- update(domNode, element) {
739
- super.update(domNode, element);
740
- this.insertSelectOptions(this.selectOptions());
741
- this._inputElement[0].property("value", this.value()).style("max-width", this.maxWidth_exists() ? this.maxWidth() + "px" : null);
742
- }
743
- insertSelectOptions(optionsArr) {
744
- let optionHTML = "";
745
- if (optionsArr.length > 0) optionsArr.forEach(function(opt) {
746
- const val = opt instanceof Array ? opt[0] : opt;
747
- const text = opt instanceof Array ? opt[1] ? opt[1] : opt[0] : opt;
748
- optionHTML += "<option value='" + val + "'>" + text + "</option>";
749
- });
750
- else optionHTML += "<option>selectOptions not set</option>";
751
- this._inputElement[0].html(optionHTML);
752
- }
753
- };
754
- Select.prototype._class += " form_Select";
755
- Select.prototype.implements(IInput.prototype);
756
- Select.prototype.publish("selectOptions", [], "array", "Array of options used to fill a dropdown list");
757
- Select.prototype.publish("maxWidth", 120, "number", "Width", null, { optional: true });
758
-
759
- //#endregion
760
- //#region src/Slider.ts
761
- var Slider = class extends SVGWidget {
762
- xScale;
763
- moveMode;
764
- moveStartPos;
765
- prevValue;
766
- slider;
767
- handleLeft;
768
- handleLeftPos = 0;
769
- handleLeftStartPos;
770
- handleRight;
771
- handleRightPos = 0;
772
- handleRightStartPos;
773
- constructor() {
774
- super();
775
- IInput.call(this);
776
- }
777
- enter(domNode, element) {
778
- super.enter(domNode, element);
779
- this.resize({
780
- width: this.width(),
781
- height: 50
782
- });
783
- this.xScale = scaleLinear().clamp(true);
784
- this.slider = element.append("g").attr("class", "slider");
785
- if (this.low() === null && this.high() === null) {
786
- if (this.lowDatetime() !== null && this.highDatetime() !== null) {
787
- const time_parser = timeParse(this.timePattern() ? this.timePattern() : "%Q");
788
- this.low(time_parser(this.lowDatetime()).getTime());
789
- this.high(time_parser(this.highDatetime()).getTime());
790
- }
791
- }
792
- this.slider.append("line").attr("class", "track").select(function() {
793
- return this.parentNode.appendChild(this.cloneNode(true));
794
- }).attr("class", "track-inset").select(function() {
795
- return this.parentNode.appendChild(this.cloneNode(true));
796
- }).attr("class", "track-overlay").call(drag().on("start", () => {
797
- const event = d3Event();
798
- this.moveStartPos = event.x;
799
- this.handleLeftStartPos = this.handleLeftPos;
800
- this.handleRightStartPos = this.handleRightPos;
801
- if (this.allowRange() && this.handleLeftPos <= event.x && event.x <= this.handleRightPos) this.moveMode = "both";
802
- else if (Math.abs(event.x - this.handleLeftPos) < Math.abs(event.x - this.handleRightPos)) this.moveMode = "left";
803
- else this.moveMode = "right";
804
- this.moveHandleTo(event.x);
805
- }).on("drag", () => {
806
- this.moveHandleTo(d3Event().x);
807
- }).on("end", () => {
808
- this.moveHandleTo(d3Event().x);
809
- this.data([[this.xScale.invert(this.handleLeftPos), this.xScale.invert(this.handleRightPos)]]);
810
- this.checkChangedValue();
811
- }));
812
- this.slider.insert("g", ".track-overlay").attr("class", "ticks").attr("transform", `translate(0, ${this.fontSize() + this.tickHeight() / 2})`);
813
- this.handleRight = this.slider.insert("path", ".track-overlay").attr("class", "handle");
814
- this.handleLeft = this.slider.insert("path", ".track-overlay").attr("class", "handle");
815
- }
816
- update(domNode, element) {
817
- super.update(domNode, element);
818
- const context = this;
819
- this.xScale.domain([this.low(), this.high()]).range([0, this.width() - this.padding() * 2]);
820
- this.slider.attr("transform", "translate(" + (-this.width() / 2 + this.padding()) + ",0)");
821
- this.slider.selectAll("line.track,line.track-inset,line.track-overlay").attr("x1", this.xScale.range()[0]).attr("x2", this.xScale.range()[1]);
822
- const x_distance = (this.width() - this.padding() * 2) / (this.tickCount() - 1);
823
- const tick_text_arr = [];
824
- if (this.tickDateFormat() !== null && this.timePattern() !== null) {
825
- const Q_parser = timeParse("%Q");
826
- const time_formatter = timeFormat(this.tickDateFormat());
827
- const time_segment = (this.high() - this.low()) / (this.tickCount() - 1);
828
- for (let i = 0; i < this.tickCount(); i++) {
829
- const parsed_date = Q_parser("" + (this.low() + time_segment * i));
830
- tick_text_arr.push(time_formatter(parsed_date));
831
- }
832
- } else {
833
- const value_formatter = format(this.tickValueFormat());
834
- const value_segment = (this.high() - this.low()) / (this.tickCount() - 1);
835
- for (let i = 0; i < this.tickCount(); i++) {
836
- const tick_value = this.low() + value_segment * i;
837
- tick_text_arr.push(value_formatter(tick_value));
838
- }
839
- }
840
- const tickText = this.slider.selectAll("g.tick").data(tick_text_arr);
841
- const tickTextEnter = tickText.enter().append("g").attr("class", "tick");
842
- tickTextEnter.append("text").attr("class", "tick-text");
843
- tickTextEnter.append("line").attr("class", "tick-line");
844
- tickTextEnter.merge(tickText).each(function(d, i) {
845
- const x = x_distance * i;
846
- select(this).select("text.tick-text").style("font-size", context.fontSize()).attr("x", function() {
847
- if (i === 0) return x - 2;
848
- return i === context.tickCount() - 1 ? x + 2 : x;
849
- }).attr("y", context.tickHeight() + context.tickOffset() / 2 + context.fontSize()).attr("text-basline", "text-before-edge").attr("text-anchor", function() {
850
- if (i === 0) return "start";
851
- return i === context.tickCount() - 1 ? "end" : "middle";
852
- }).text(() => d);
853
- select(this).select("line.tick-line").attr("x1", x).attr("x2", x).attr("y1", context.tickOffset() - 1).attr("y2", context.tickOffset() + context.tickHeight()).style("stroke", "#000").style("stroke-width", 1);
854
- });
855
- this.slider.node().appendChild(this.handleRight.node());
856
- this.slider.node().appendChild(this.handleLeft.node());
857
- this.handleLeftPos = this.lowPos();
858
- this.handleRightPos = this.highPos();
859
- this.updateHandles();
860
- this.checkChangedValue();
861
- }
862
- checkChangedValue() {
863
- if (this.prevValue !== this.value() && typeof this.prevValue !== "undefined") this.change(this);
864
- this.prevValue = this.value();
865
- }
866
- updateHandles() {
867
- this.handleLeft.attr("transform", `translate(${this.handleLeftPos}, -28)`).attr("d", (d) => this.handlePath("l"));
868
- this.handleRight.attr("transform", `translate(${this.handleRightPos}, -28)`).attr("d", (d) => this.handlePath("r"));
869
- }
870
- lowPos() {
871
- let data = [[this.low(), this.high()]];
872
- if (this.data().length > 0 && typeof this.data()[0][0] === "number" && typeof this.data()[0][1] === "number") data = this.data();
873
- return this.xScale(data[0][0]);
874
- }
875
- highPos() {
876
- let data = [[this.low(), this.high()]];
877
- if (this.data().length > 0 && typeof this.data()[0][0] === "number" && typeof this.data()[0][1] === "number") data = this.data();
878
- return this.xScale(data[0][this.allowRange() ? 1 : 0]);
879
- }
880
- moveHandleTo(pos) {
881
- if (this.allowRange()) switch (this.moveMode) {
882
- case "both":
883
- this.handleLeftPos = this.handleLeftStartPos + pos - this.moveStartPos;
884
- this.handleRightPos = this.handleRightStartPos + pos - this.moveStartPos;
885
- break;
886
- case "left":
887
- this.handleLeftPos = pos;
888
- if (this.handleLeftPos > this.handleRightPos) this.handleRightPos = this.handleLeftPos;
889
- break;
890
- case "right":
891
- this.handleRightPos = pos;
892
- if (this.handleRightPos < this.handleLeftPos) this.handleLeftPos = this.handleRightPos;
893
- break;
894
- }
895
- else this.handleLeftPos = this.handleRightPos = pos;
896
- this.handleLeftPos = this.constrain(this.handleLeftPos);
897
- this.handleRightPos = this.constrain(this.handleRightPos);
898
- this.value(this.allowRange() ? [this.xScale.invert(this.handleLeftPos), this.xScale.invert(this.handleRightPos)] : this.xScale.invert(this.handleLeftPos));
899
- this.updateHandles();
900
- }
901
- constrain(pos) {
902
- const range = this.xScale.range();
903
- if (pos < range[0]) pos = range[0];
904
- if (pos > range[1]) pos = range[1];
905
- return this.nearestStep(pos);
906
- }
907
- nearestStep(pos) {
908
- const value$1 = this.xScale.invert(pos);
909
- return this.xScale(this.low() + Math.round((value$1 - this.low()) / this.step()) * this.step());
910
- }
911
- handlePath = function(d) {
912
- const e = +(d === "r");
913
- const x = e ? 1 : -1;
914
- const xOffset = this.allowRange() ? .5 : 0;
915
- const y = 18;
916
- let retVal = "M" + xOffset * x + ",18A6,6 0 0 " + e + " " + 6.5 * x + "," + (y + 6) + "V" + (2 * y - 6) + "A6,6 0 0 " + e + " " + xOffset * x + "," + 2 * y;
917
- if (this.allowRange()) retVal += "ZM" + 2.5 * x + "," + (y + 8) + "V" + (2 * y - 8) + "M" + 4.5 * x + "," + (y + 8) + "V" + (2 * y - 8);
918
- else retVal += "M" + 1 * x + "," + (y + 8) + "V" + (2 * y - 8);
919
- return retVal;
920
- };
921
- };
922
- Slider.prototype._class += " form_Slider";
923
- Slider.prototype.implements(IInput.prototype);
924
- Slider.prototype.publish("padding", 16, "number", "Outer Padding", null, { tags: ["Basic"] });
925
- Slider.prototype.publish("fontSize", 12, "number", "Font Size", null, { tags: ["Basic"] });
926
- Slider.prototype.publish("fontFamily", null, "string", "Font Name", null, { tags: ["Basic"] });
927
- Slider.prototype.publish("fontColor", null, "html-color", "Font Color", null, { tags: ["Basic"] });
928
- Slider.prototype.publish("allowRange", false, "boolean", "Allow Range Selection", null, { tags: ["Intermediate"] });
929
- Slider.prototype.publish("low", null, "number", "Low", null, { tags: ["Intermediate"] });
930
- Slider.prototype.publish("high", null, "number", "High", null, { tags: ["Intermediate"] });
931
- Slider.prototype.publish("step", 10, "number", "Step", null, { tags: ["Intermediate"] });
932
- Slider.prototype.publish("lowDatetime", null, "string", "Low", null, { tags: ["Intermediate"] });
933
- Slider.prototype.publish("highDatetime", null, "string", "High", null, { tags: ["Intermediate"] });
934
- Slider.prototype.publish("selectionLabel", "", "string", "Selection Label", null, { tags: ["Intermediate"] });
935
- Slider.prototype.publish("timePattern", "%Y-%m-%d", "string");
936
- Slider.prototype.publish("tickCount", 10, "number");
937
- Slider.prototype.publish("tickOffset", 5, "number");
938
- Slider.prototype.publish("tickHeight", 8, "number");
939
- Slider.prototype.publish("tickDateFormat", null, "string");
940
- Slider.prototype.publish("tickValueFormat", ",.0f", "string");
941
- var name = Slider.prototype.name;
942
- Slider.prototype.name = function(_) {
943
- const retVal = name.apply(this, arguments);
944
- if (arguments.length) {
945
- const val = _ instanceof Array ? _ : [_];
946
- SVGWidget.prototype.columns.call(this, val);
947
- }
948
- return retVal;
949
- };
950
- var value = Slider.prototype.value;
951
- Slider.prototype.value = function(_) {
952
- const retVal = value.apply(this, arguments);
953
- if (!arguments.length) {
954
- if (!this.allowRange()) return SVGWidget.prototype.data.call(this)[0][0];
955
- return SVGWidget.prototype.data.call(this)[0];
956
- } else SVGWidget.prototype.data.call(this, [this.allowRange() ? _ : [_, _]]);
957
- return retVal;
958
- };
959
-
960
- //#endregion
961
- //#region src/TextArea.ts
962
- var TextArea = class extends Input {
963
- constructor() {
964
- super();
965
- this._tag = "div";
966
- this.type("textarea");
967
- }
968
- enter(domNode, element) {
969
- super.enter(domNode, element);
970
- }
971
- calcHeight() {
972
- return Math.max(this.minHeight_exists() ? this.minHeight() : 0, this.height());
973
- }
974
- update(domNode, element) {
975
- super.update(domNode, element);
976
- this._inputElement[0].attr("rows", this.rows()).attr("cols", this.cols()).attr("wrap", this.wrap()).attr("spellcheck", this.spellcheck()).style("height", this.calcHeight() + "px");
977
- }
978
- };
979
- TextArea.prototype._class += " form_TextArea";
980
- TextArea.prototype.publish("rows", null, "number", "Rows", null, { optional: true });
981
- TextArea.prototype.publish("cols", null, "number", "Columns", null, { optional: true });
982
- TextArea.prototype.publish("wrap", "off", "set", "Wrap", ["off", "on"]);
983
- TextArea.prototype.publish("minHeight", null, "number", "Minimum Height", null, { optional: true });
984
- TextArea.prototype.publish("spellcheck", null, "boolean", "Input spell checking", { optional: true });
985
-
986
- //#endregion
987
- export { BUILD_VERSION, Button, CheckBox, ColorInput, FieldForm, Form, Input, InputRange, OnOff, PKG_NAME, PKG_VERSION, Radio, Range, Select, Slider, TextArea };
988
- //# sourceMappingURL=index.js.map!function(){try{if("undefined"!=typeof document){var o=document.createElement("style");o.appendChild(document.createTextNode(".form_Input input,.form_Input select,.form_Input button,.form_Input textarea{padding:2px}.form_Input button{cursor:pointer}.form_Input input.color-text{width:120px}.form_Input input.color-text+input{width:57px;position:absolute}.form_Input textarea,.form_Input input[type=textbox]{box-sizing:border-box;width:100%;display:block}.form_Input ul{float:left;margin:0;padding:0;list-style-type:none}.form_Input li{float:left;list-style-position:inside}.form_Form{color:#404040}.form_Form tbody td{white-space:nowrap;border:1px solid #e5e5e5}.form_Form td.prompt{vertical-align:middle;background-color:#e5e5e5;padding:2px}.form_Form td.input{vertical-align:middle;width:100%;padding:2px}.form_Form td.input .common_HTMLWidget ul{margin:0}.form_Form tfoot button{margin:5px}.form_Form tbody tr:hover{background-color:#fafafa}.form_Form .form_Button button{box-sizing:border-box;color:#24292e;cursor:pointer;overflow-wrap:break-word;vertical-align:middle;white-space:nowrap;word-wrap:break-word;column-rule-color:#24292e;perspective-origin:57.2938px 14px;transform-origin:57.2938px 14px;-webkit-user-select:none;user-select:none;background:#eff3f6 linear-gradient(-180deg,#fafbfc 0%,#eff3f6 90%) -1px -1px/110% 110% repeat-x;border:1px solid #1b1f2333;border-radius:3px;outline:0 #24292e;height:28px;padding:3px 10px;-webkit-text-decoration:none;text-decoration:none;position:relative;inset:0}.form_Form .form_Button button[disabled=disabled]{background:#dbdfe2}.form_Form .form_Button button:focus{box-shadow:0 0 0 .2em #0366d64d}.form_Form .form_Button button:hover{background:#dbdfe2}.form_Form .form_Button.default button{color:#fff;word-wrap:break-word;column-rule-color:#fff;perspective-origin:44.975px 17px;transform-origin:44.975px 17px;background:#28a745 linear-gradient(-180deg,#34d058 0%,#28a745 90%) -1px -1px/110% 110% repeat-x;outline:0 #fff;-webkit-text-decoration:none;text-decoration:none}.form_Form .form_Button.default button[disabled=disabled],.form_Form .form_Button.default button[disabled=disabled]:hover{background:#dbdfe2}.form_Form .form_Button.default button:hover{background:#149331}.onoffswitch-checkbox{display:none}.onoffswitch{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;width:100px;height:20px;position:relative}.onoffswitch-label{cursor:pointer;border:1px solid #999;height:20px;display:block;overflow:hidden}.onoffswitch-inner{transition:margin .3s ease-in;display:block;position:relative}.onoffswitch-inner>.onoffswitch-offText,.onoffswitch-inner>.onoffswitch-onText{height:100%}.onoffswitch-inner>.onoffswitch-offText{text-align:right;width:100%;font-weight:700;transition:all .3s ease-in;position:absolute;right:0}.onoffswitch-inner>.onoffswitch-onText{text-align:left;width:100%;font-weight:700;transition:all .3s ease-in;position:absolute;left:-100%}.onoffswitch-switch{background:#fff;border:1px solid #999;width:20px;margin:-1px;transition:all .3s ease-in;display:block;position:absolute;inset:0 78px 0 4px}.onoffswitch-checkbox:checked+.onoffswitch-label .onoffswitch-inner>.onoffswitch-offText{right:-100%}.onoffswitch-checkbox:checked+.onoffswitch-label .onoffswitch-inner>.onoffswitch-onText{left:0}.onoffswitch-checkbox:checked+.onoffswitch-label .onoffswitch-switch{left:calc(100% - 20px)}.form_Slider .ticks{font:10px sans-serif}.form_Slider .track,.form_Slider .track-inset,.form_Slider .track-overlay{stroke-linecap:round}.form_Slider .track{stroke:#000;stroke-opacity:.3;stroke-width:10px}.form_Slider .track-inset{stroke:#ddd;stroke-width:8px}.form_Slider .track-overlay{pointer-events:stroke;stroke-width:50px;stroke:#0000;cursor:crosshair}.form_Slider .handle{fill:#fff;stroke:#000;stroke-opacity:.5;stroke-width:1.25px}.form_Slider .tick-line{stroke:#000;stroke-opacity:.5;stroke-width:1px;shape-rendering:crispEdges}\n/*$vite$:1*/")),document.head.appendChild(o)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}}();
1
+ var t=Object.defineProperty,e=(e,n)=>t(e,"name",{value:n,configurable:!0});import{IInput as n}from"@hpcc-js/api";import{HTMLWidget as i,rgb as s,WidgetArray as o,d3Event as l,select as a,SVGWidget as r,scaleLinear as p,timeParse as h,drag as u,timeFormat as c,format as d}from"@hpcc-js/common";const m="@hpcc-js/form",f="3.3.2",y="3.16.0",g=class _Button extends i{_inputElement=[];constructor(){super(),n.call(this),this._tag="div"}enter(t,e){super.enter(t,e);const n=this;this._inputElement[0]=e.append("button").attr("name",this.name()).on("click",function(t){t.click(t)}).on("blur",function(t){t.blur(t)}).on("change",function(t){n.value([n._inputElement[0].property("value")]),t.change(t,!0)})}update(t,e){super.update(t,e),this._inputElement[0].text(this.value())}};e(g,"Button");let b=g;b.prototype._class+=" form_Button",b.prototype.implements(n.prototype);const _=class _CheckBox extends i{_inputElement=[];constructor(){super(),n.call(this),this._tag="div"}enter(t,e){super.enter(t,e);const n=this,i=e.append("ul");this.selectOptions().length||this.selectOptions().push(""),this.selectOptions().forEach(function(t,e){n._inputElement[e]=i.append("li").append("input").attr("type","checkbox"),n._inputElement[e].node().insertAdjacentHTML("afterend","<text>"+t+"</text>")}),this._inputElement.forEach(function(t,e){t.attr("name",n.name()),t.on("click",function(t){t.click(t)}),t.on("blur",function(t){t.blur(t)}),t.on("change",function(t){const e=[];n._inputElement.forEach(function(t){t.property("checked")&&e.push(t.property("value"))}),n.value(e),t.change(t,!0)})})}update(t,e){super.update(t,e);const n=this;this._inputElement.forEach(function(t,e){t.property("value",n.selectOptions()[e]),-1!==n.value().indexOf(n.selectOptions()[e])&&"false"!==n.value()?t.property("checked",!0):t.property("checked",!1)})}insertSelectOptions(t){let e="";t.length>0?t.forEach(function(t){const n=t instanceof Array?t[0]:t,i=t instanceof Array?t[1]?t[1]:t[0]:t;e+="<option value='"+n+"'>"+i+"</option>"}):e+="<option>selectOptions not set</option>",this._inputElement[0].html(e)}};e(_,"CheckBox");let v=_;v.prototype._class+=" form_CheckBox",v.prototype.implements(n.prototype),v.prototype.publish("selectOptions",[],"array","Array of options used to fill a dropdown list");const x=class _ColorInput extends i{_inputElement=[];constructor(){super(),n.call(this),this._tag="div"}enter(t,e){super.enter(t,e);const n=this;this._inputElement[0]=e.append("input").attr("type","text"),this._inputElement[0].classed("color-text",!0),this._inputElement[1]=e.append("input").attr("type","color"),this._inputElement.forEach(function(t,e){t.on("click",function(t){t.click(t)}),t.on("blur",function(t){t.blur(t)}),t.on("change",function(t){0===e?(n._inputElement[1].property("value",s(n._inputElement[0].property("value")).toString()),n.value(n._inputElement[0].property("value"))):(n._inputElement[0].property("value",n._inputElement[1].property("value")),n.value(s(n._inputElement[1].property("value")).toString())),t.change(t,!0)})})}update(t,e){super.update(t,e);const n=this;this._inputElement.forEach(function(t){t.attr("name",n.name())}),this._inputElement[0].attr("type","text"),this._inputElement[1].attr("type","color"),this._inputElement[0].property("value",this.value()),this._inputElement[1].property("value",s(this.value()).toString());const i=this._inputElement[0].node().getBoundingClientRect();this._inputElement[1].style("height",i.height-2+"px")}};e(x,"ColorInput");let E=x;E.prototype._class+=" form_ColorInput",E.prototype.implements(n.prototype);const k=class _Form extends i{tbody;tfoot;btntd;_controls;_maxCols;constructor(){super(),this._tag="form"}data(t){if(!arguments.length){const t=[];return this.inputsForEach(function(e){t.push(e.value())}),t}return this.inputsForEach(function(e,n){t&&t.length>n&&e.value(t[n]).render()}),this}inputsForEach(t,e){let n=0;this.inputs().forEach(function(i){(i instanceof o?i.content():[i]).forEach(function(i){e?t.call(e,i,n++):t(i,n++)})})}inputsMap(){const t={};return this.inputs().forEach(function(e){t[e.name()]=e}),t}calcMaxColumns(){let t=0;return this.inputs().forEach(function(e){const n=e instanceof o?e.content():[e];n.length>t&&(t=n.length)}),t}values(t){if(!arguments.length){const t={};return this.inputsForEach(function(e){const n=e.type?e.type():"text";if(e.value()||!this.omitBlank())switch(n){case"checkbox":t[e.name()]=e.value_exists()?!!e.value():void 0;break;case"number":const n=e.value();t[e.name()]=""===n?void 0:+n;break;default:t[e.name()]=e.value_exists()?e.value():void 0}},this),t}return this.inputsForEach(function(e){t[e.name()]?e.value(t[e.name()]):this.omitBlank()&&e.value("")},this),this}submit(){let t=!0;this.validate()&&(t=this.checkValidation()),(this.allowEmptyRequest()||this.inputs().some(function(t){return-1!==t._class.indexOf("WidgetArray")?t.content().some(function(t){return t.hasValue()}):t.hasValue()}))&&this.click(t?this.values():null,null,t)}clear(){this.inputsForEach(function(t){switch(t.classID()){case"form_Slider":t.allowRange()?t.value([t.low(),t.low()]).render():t.value(t.low()).render();break;case"form_CheckBox":t.value(!1).render();break;case"form_Button":break;default:t.value(void 0).render()}})}checkValidation(){let t=!0;const e=[];return this.inputsForEach(function(t){t.isValid()||e.push("'"+t.label()+"' value is invalid.")}),e.length>0&&(alert(e.join("\n")),t=!1),t}enter(t,e){super.enter(t,e),e.on("submit",function(){l().preventDefault()}),this._placeholderElement.style("overflow","auto");const n=e.append("table");this.tbody=n.append("tbody"),this.tfoot=n.append("tfoot"),this.btntd=this.tfoot.append("tr").append("td").attr("colspan",2);const i=this;this._controls=[(new b).classed({default:!0}).value("Submit").on("click",function(){i.submit()},!0),(new b).value("Clear").on("click",function(){i.clear()},!0)];const s=i.btntd.append("div").style("float","right");this._controls.forEach(function(t){const e=s.append("span").style("float","left");t.target(e.node()).render()})}update(t,e){super.update(t,e),this._maxCols=this.calcMaxColumns();const n=this,i=this.tbody.selectAll("tr").data(this.inputs());i.enter().append("tr").each(function(t,e){const i=a(this),s=t instanceof o?t.content():[t];s.forEach(function(t,e){i.append("td").attr("class","prompt");const o=i.append("td").attr("class","input");if(e===s.length-1&&s.length<n._maxCols&&o.attr("colspan",2*(n._maxCols-s.length+1)),t.target(o.node()).render(),t instanceof r){const e=t.element().node().getBBox();o.style("height",e.height+"px"),t.resize().render()}t._inputElement instanceof Array&&t._inputElement.forEach(function(t){t.on("keyup.form",function(t){setTimeout(function(){n._controls[0].disable(!n.allowEmptyRequest()&&!n.inputs().some(function(t){return-1!==t._class.indexOf("WidgetArray")?t.content().some(function(t){return t.hasValue()}):t.hasValue()}))},100)})})})}).merge(i).each(function(t,e){const n=a(this);(t instanceof o?t.content():[t]).forEach(function(t,e){n.select("td.prompt").text(t.label()+":")})}),i.each(function(t,e){0===e&&t.setFocus&&t.setFocus()}),i.exit().each(function(t,e){(t instanceof o?t.content():[t]).forEach(function(t,e){t.target(null)})}).remove(),this.tfoot.style("display",this.showSubmit()?"table-footer-group":"none"),this.btntd.attr("colspan",2*this._maxCols),this.allowEmptyRequest()||setTimeout(function(){n._controls[0].disable(!n.allowEmptyRequest()&&!n.inputs().some(function(t){return-1!==t._class.indexOf("WidgetArray")?t.content().some(function(t){return t.hasValue()}):t.hasValue()}))},100)}exit(t,e){this.inputsForEach(t=>t.target(null)),super.exit(t,e)}click(t,e,n){}};e(k,"Form");let w=k;w.prototype._class+=" form_Form",w.prototype.publish("validate",!0,"boolean","Enable/Disable input validation"),w.prototype.publish("inputs",[],"widgetArray","Array of input widgets",null,{render:!1}),w.prototype.publish("showSubmit",!0,"boolean","Show Submit/Cancel Controls"),w.prototype.publish("omitBlank",!1,"boolean","Drop Blank Fields From Submit"),w.prototype.publish("allowEmptyRequest",!1,"boolean","Allow Blank Form to be Submitted");const R=class _Input extends i{_inputElement=[];_labelElement=[];constructor(){super(),n.call(this),this._tag="div"}checked(t){return arguments.length?(this._inputElement[0]&&this._inputElement[0].property("checked",t),this):!!this._inputElement[0]&&this._inputElement[0].property("checked")}enter(t,e){super.enter(t,e),this._labelElement[0]=e.append("label").attr("for",this.id()+"_input").style("visibility",this.inlineLabel_exists()?"visible":"hidden");const n=this;switch(this.type()){case"button":this._inputElement[0]=e.append("button").attr("id",this.id()+"_input");break;case"textarea":this._inputElement[0]=e.append("textarea").attr("id",this.id()+"_input");break;default:this._inputElement[0]=e.append("input").attr("id",this.id()+"_input").attr("type",this.type())}this._inputElement.forEach(function(t,e){t.attr("name",n.name()),t.on("click",function(t){t.click(t)}),t.on("blur",function(t){t.blur(t)}),t.on("change",function(e){n.value([t.property("value")]),e.change(e,!0)}),t.on("keyup",function(e){n.value([t.property("value")]),e.change(e,!1)})})}update(t,e){switch(super.update(t,e),this._labelElement[0].style("visibility",this.inlineLabel_exists()?"visible":"hidden").text(this.inlineLabel()),this.type()){case"button":this._inputElement[0].text(this.value());break;case"textarea":this._inputElement[0].property("value",this.value());break;default:this._inputElement[0].attr("type",this.type()),this._inputElement[0].property("value",this.value())}}blur(t){}keyup(t){}focus(t){}click(t){}dblclick(t){}change(t,e){}};e(R,"Input");let S=R;S.prototype._class+=" form_Input",S.prototype.implements(n.prototype),S.prototype.publish("type","text","set","Input type",["string","number","boolean","date","time","hidden","nested","button","checkbox","text","textarea","search","email","datetime"]),S.prototype.publish("inlineLabel",null,"string","Input Label",null,{optional:!0});const P=class _FieldForm extends w{constructor(){super(),this._tag="form"}fields(t){const e=super.fields.apply(this,arguments);if(arguments.length){const e=this.inputsMap();this.inputs(t.map(t=>e[t.id()]||(new S).name(t.id()).label(t.label()).type(t.type())))}return e}data(t){if(!arguments.length)return super.data();if(super.data(t[0]),t[0]){const e=this.inputs(),n=t[0][this.columns().length];let i=0;for(const t in n)e[i].name(t),++i}return this}};e(P,"FieldForm");let O=P;O.prototype._class+=" form_FieldForm";const C=class _InputRange extends i{_inputElement=[];_labelElement=[];_rangeData=[];constructor(){super(),n.call(this),this._tag="div"}enter(t,e){super.enter(t,e),this._labelElement[0]=e.append("label").attr("for",this.id()+"_input").style("visibility",this.inlineLabel_exists()?"visible":"hidden"),this._inputElement.push(e.append("input").attr("id",this.id()+"_input_min").attr("type",this.type())),this._inputElement.push(e.append("input").attr("id",this.id()+"_input_max").attr("type",this.type()));const n=this;this._inputElement.forEach(function(t,e){t.attr("name",n.name()),t.on("click",function(t){t.click(t)}),t.on("blur",function(t){t.blur(t)}),t.on("change",function(i){n._rangeData[e]=t.property("value"),n.value(n._rangeData),i.change(i,!0)})})}update(t,e){super.update(t,e),this._labelElement[0].style("visibility",this.inlineLabel_exists()?"visible":"hidden").text(this.inlineLabel()),this._rangeData=this.value(),this._inputElement.forEach(function(t,e){t.attr("type",this.type()).property("value",this._rangeData.length>e?this._rangeData[e]:"")},this)}};e(C,"InputRange");let F=C;F.prototype._class+=" form_InputRange",F.prototype.implements(n.prototype),F.prototype.publish("type","text","set","InputRange type",["number","date","text","time","datetime","hidden"]),F.prototype.publish("inlineLabel",null,"string","InputRange Label",null,{optional:!0}),F.prototype.publish("value",["",""],"array","Input Current Value",null,{override:!0});const L=class _OnOff extends i{_inputElement=[];_input;constructor(){super(),n.call(this),this._tag="div"}enter(t,e){super.enter(t,e),e.classed("onoffswitch",!0);const n=this;this._input=e.append("input").attr("class","onoffswitch-checkbox").attr("type","checkbox").attr("id",this.id()+"_onOff").on("click",function(t){t.click(t)}).on("blur",function(t){t.blur(t)}).on("change",function(t){const e=[];n._inputElement.forEach(function(t,n){t.property("checked")&&e.push(t.property("value"))}),n.value(e),t.change(t,!0)});const i=e.append("label").attr("class","onoffswitch-label").attr("for",this.id()+"_onOff"),s=i.append("div").attr("class","onoffswitch-inner");s.append("div").attr("class","onoffswitch-offText").style("padding-right",this.containerRadius()/2+"px").text(this.offText()),s.append("div").attr("class","onoffswitch-onText").style("padding-left",this.containerRadius()/2+"px").style("width",`calc(100% - ${this.containerRadius()/2}px)`).text(this.onText()),i.append("div").attr("class","onoffswitch-switch")}update(t,e){super.update(t,e),this._input.attr("name",this.name()),e.style("margin-left",this.marginLeft()+"px").style("margin-bottom",this.marginBottom()+"px").style("width",this.minWidth()+"px");const n=this.minHeight()-4*this.gutter();e.select(".onoffswitch-switch").style("height",n+"px").style("width",n+"px").style("top",2*this.gutter()+1+"px").style("border-radius",this.switchRadius()+"px"),e.select(".onoffswitch-inner").style("min-height",this.minHeight()+"px"),e.select(".onoffswitch-label").style("border-radius",this.containerRadius()+"px"),e.select(".onoffswitch-offText").style("color",this.offFontColor()).style("background-color",this.offColor()),e.select(".onoffswitch-onText").style("color",this.onFontColor()).style("background-color",this.onColor())}};e(L,"OnOff");let A=L;A.prototype._class+=" form_OnOff",A.prototype.implements(n.prototype),A.prototype.publish("marginLeft",0,"number","Margin left of OnOff"),A.prototype.publish("marginBottom",0,"number","Margin bottom of OnOff"),A.prototype.publish("minWidth",100,"number","Minimum width of OnOff (pixels)"),A.prototype.publish("minHeight",20,"number","Minimum height of OnOff (pixels)"),A.prototype.publish("gutter",1,"number","Space between switch and border of OnOff (pixels)"),A.prototype.publish("onText","Save","string","Text to display when 'ON'"),A.prototype.publish("offText","Properties","string","Text to display when 'OFF'"),A.prototype.publish("switchRadius",10,"number","Border radius of switch (pixels)"),A.prototype.publish("containerRadius",10,"number","Border radius of OnOff (pixels)"),A.prototype.publish("onColor","#2ecc71","html-color","Background color when 'ON'"),A.prototype.publish("offColor","#ecf0f1","html-color","Background color when 'OFF'"),A.prototype.publish("onFontColor","#2c3e50","html-color","Font color when 'ON'"),A.prototype.publish("offFontColor","#7f8c8d","html-color","Font color when 'OFF'");const B=class _Radio extends i{_inputElement=[];constructor(){super(),n.call(this),this._tag="div"}enter(t,e){super.enter(t,e);const n=this,i=e.append("ul");this.selectOptions().length||this.selectOptions().push(""),this.selectOptions().forEach(function(t,e){n._inputElement[e]=i.append("li").append("input").attr("type","radio"),n._inputElement[e].node().insertAdjacentHTML("afterend","<text>"+t+"</text>")}),this._inputElement.forEach(function(t,e){t.attr("name",n.name()),t.on("click",function(t){t.click(t)}),t.on("blur",function(t){t.blur(t)}),t.on("change",function(e){n.value([t.property("value")]),e.change(e,!0)})})}update(t,e){super.update(t,e);const n=this;this._inputElement.forEach(function(t,e){t.property("value",n.selectOptions()[e]),-1!==n.value().indexOf(n.selectOptions()[e])&&"false"!==n.value()?t.property("checked",!0):t.property("checked",!1)})}};e(B,"Radio");let M=B;M.prototype._class+=" form_Radio",M.prototype.implements(n.prototype),M.prototype.publish("selectOptions",[],"array","Array of options used to fill a dropdown list");const H=class _Range extends i{_inputElement=[];constructor(){super(),n.call(this),this._tag="div"}enter(t,e){super.enter(t,e);const n=this;this._inputElement[0]=e.append("input").attr("type","range"),this._inputElement[1]=e.append("input").attr("type","number"),this._inputElement.forEach(function(t,e){t.attr("name",n.name()),t.on("click",function(t){t.click(t)}),t.on("blur",function(t){t.blur(t)}),t.on("change",function(t){0===e?(n._inputElement[1].property("value",s(n._inputElement[0].property("value")).toString()),n.value(n._inputElement[0].property("value"))):(n._inputElement[0].property("value",n._inputElement[1].property("value")),n.value(s(n._inputElement[1].property("value")).toString())),t.change(t,!0)})})}update(t,e){super.update(t,e),this._inputElement[0].attr("type","range"),this._inputElement[0].property("value",this.value()),this._inputElement[0].attr("min",this.low()),this._inputElement[0].attr("max",this.high()),this._inputElement[0].attr("step",this.step()),this._inputElement[1].attr("type","number"),this._inputElement[1].property("value",this.value()),this._inputElement[1].attr("min",this.low()),this._inputElement[1].attr("max",this.high()),this._inputElement[1].attr("step",this.step())}insertSelectOptions(t){let e="";t.length>0?t.forEach(function(t){const n=t instanceof Array?t[0]:t,i=t instanceof Array?t[1]?t[1]:t[0]:t;e+="<option value='"+n+"'>"+i+"</option>"}):e+="<option>selectOptions not set</option>",this._inputElement[0].html(e)}};e(H,"Range");let I=H;I.prototype._class+=" form_Range",I.prototype.implements(n.prototype),I.prototype.publish("type","text","set","Input type",["html-color","number","checkbox","button","select","textarea","date","text","range","search","email","time","datetime"]),I.prototype.publish("selectOptions",[],"array","Array of options used to fill a dropdown list"),I.prototype.publish("low",null,"number","Minimum value for Range input"),I.prototype.publish("high",null,"number","Maximum value for Range input"),I.prototype.publish("step",null,"number","Step value for Range input");const T=class _Select extends i{_inputElement=[];constructor(){super(),n.call(this),this._tag="div"}enter(t,e){super.enter(t,e);const n=this;this._inputElement[0]=e.append("select").attr("name",this.name()).on("click",function(t){t.click(t)}).on("blur",function(t){t.blur(t)}).on("change",function(t){n.value([n._inputElement[0].property("value")]),t.change(t,!0)})}update(t,e){super.update(t,e),this.insertSelectOptions(this.selectOptions()),this._inputElement[0].property("value",this.value()).style("max-width",this.maxWidth_exists()?this.maxWidth()+"px":null)}insertSelectOptions(t){let e="";t.length>0?t.forEach(function(t){const n=t instanceof Array?t[0]:t,i=t instanceof Array?t[1]?t[1]:t[0]:t;e+="<option value='"+n+"'>"+i+"</option>"}):e+="<option>selectOptions not set</option>",this._inputElement[0].html(e)}};e(T,"Select");let V=T;V.prototype._class+=" form_Select",V.prototype.implements(n.prototype),V.prototype.publish("selectOptions",[],"array","Array of options used to fill a dropdown list"),V.prototype.publish("maxWidth",120,"number","Width",null,{optional:!0});const D=class _Slider extends r{xScale;moveMode;moveStartPos;prevValue;slider;handleLeft;handleLeftPos=0;handleLeftStartPos;handleRight;handleRightPos=0;handleRightStartPos;constructor(){super(),n.call(this)}enter(t,e){if(super.enter(t,e),this.resize({width:this.width(),height:50}),this.xScale=p().clamp(!0),this.slider=e.append("g").attr("class","slider"),null===this.low()&&null===this.high()&&null!==this.lowDatetime()&&null!==this.highDatetime()){const t=h(this.timePattern()?this.timePattern():"%Q");this.low(t(this.lowDatetime()).getTime()),this.high(t(this.highDatetime()).getTime())}this.slider.append("line").attr("class","track").select(function(){return this.parentNode.appendChild(this.cloneNode(!0))}).attr("class","track-inset").select(function(){return this.parentNode.appendChild(this.cloneNode(!0))}).attr("class","track-overlay").call(u().on("start",()=>{const t=l();this.moveStartPos=t.x,this.handleLeftStartPos=this.handleLeftPos,this.handleRightStartPos=this.handleRightPos,this.allowRange()&&this.handleLeftPos<=t.x&&t.x<=this.handleRightPos?this.moveMode="both":Math.abs(t.x-this.handleLeftPos)<Math.abs(t.x-this.handleRightPos)?this.moveMode="left":this.moveMode="right",this.moveHandleTo(t.x)}).on("drag",()=>{this.moveHandleTo(l().x)}).on("end",()=>{this.moveHandleTo(l().x),this.data([[this.xScale.invert(this.handleLeftPos),this.xScale.invert(this.handleRightPos)]]),this.checkChangedValue()})),this.slider.insert("g",".track-overlay").attr("class","ticks").attr("transform",`translate(0, ${this.fontSize()+this.tickHeight()/2})`),this.handleRight=this.slider.insert("path",".track-overlay").attr("class","handle"),this.handleLeft=this.slider.insert("path",".track-overlay").attr("class","handle")}update(t,e){super.update(t,e);const n=this;this.xScale.domain([this.low(),this.high()]).range([0,this.width()-2*this.padding()]),this.slider.attr("transform","translate("+(-this.width()/2+this.padding())+",0)"),this.slider.selectAll("line.track,line.track-inset,line.track-overlay").attr("x1",this.xScale.range()[0]).attr("x2",this.xScale.range()[1]);const i=(this.width()-2*this.padding())/(this.tickCount()-1),s=[];if(null!==this.tickDateFormat()&&null!==this.timePattern()){const t=h("%Q"),e=c(this.tickDateFormat()),n=(this.high()-this.low())/(this.tickCount()-1);for(let i=0;i<this.tickCount();i++){const o=t(""+(this.low()+n*i));s.push(e(o))}}else{const t=d(this.tickValueFormat()),e=(this.high()-this.low())/(this.tickCount()-1);for(let n=0;n<this.tickCount();n++){const i=this.low()+e*n;s.push(t(i))}}const o=this.slider.selectAll("g.tick").data(s),l=o.enter().append("g").attr("class","tick");l.append("text").attr("class","tick-text"),l.append("line").attr("class","tick-line"),l.merge(o).each(function(t,e){const s=i*e;a(this).select("text.tick-text").style("font-size",n.fontSize()).attr("x",function(){return 0===e?s-2:e===n.tickCount()-1?s+2:s}).attr("y",n.tickHeight()+n.tickOffset()/2+n.fontSize()).attr("text-basline","text-before-edge").attr("text-anchor",function(){return 0===e?"start":e===n.tickCount()-1?"end":"middle"}).text(()=>t),a(this).select("line.tick-line").attr("x1",s).attr("x2",s).attr("y1",n.tickOffset()-1).attr("y2",n.tickOffset()+n.tickHeight()).style("stroke","#000").style("stroke-width",1)}),this.slider.node().appendChild(this.handleRight.node()),this.slider.node().appendChild(this.handleLeft.node()),this.handleLeftPos=this.lowPos(),this.handleRightPos=this.highPos(),this.updateHandles(),this.checkChangedValue()}checkChangedValue(){this.prevValue!==this.value()&&void 0!==this.prevValue&&this.change(this),this.prevValue=this.value()}updateHandles(){this.handleLeft.attr("transform",`translate(${this.handleLeftPos}, -28)`).attr("d",t=>this.handlePath("l")),this.handleRight.attr("transform",`translate(${this.handleRightPos}, -28)`).attr("d",t=>this.handlePath("r"))}lowPos(){let t=[[this.low(),this.high()]];return this.data().length>0&&"number"==typeof this.data()[0][0]&&"number"==typeof this.data()[0][1]&&(t=this.data()),this.xScale(t[0][0])}highPos(){let t=[[this.low(),this.high()]];return this.data().length>0&&"number"==typeof this.data()[0][0]&&"number"==typeof this.data()[0][1]&&(t=this.data()),this.xScale(t[0][this.allowRange()?1:0])}moveHandleTo(t){if(this.allowRange())switch(this.moveMode){case"both":this.handleLeftPos=this.handleLeftStartPos+t-this.moveStartPos,this.handleRightPos=this.handleRightStartPos+t-this.moveStartPos;break;case"left":this.handleLeftPos=t,this.handleLeftPos>this.handleRightPos&&(this.handleRightPos=this.handleLeftPos);break;case"right":this.handleRightPos=t,this.handleRightPos<this.handleLeftPos&&(this.handleLeftPos=this.handleRightPos)}else this.handleLeftPos=this.handleRightPos=t;this.handleLeftPos=this.constrain(this.handleLeftPos),this.handleRightPos=this.constrain(this.handleRightPos),this.value(this.allowRange()?[this.xScale.invert(this.handleLeftPos),this.xScale.invert(this.handleRightPos)]:this.xScale.invert(this.handleLeftPos)),this.updateHandles()}constrain(t){const e=this.xScale.range();return t<e[0]&&(t=e[0]),t>e[1]&&(t=e[1]),this.nearestStep(t)}nearestStep(t){const e=this.xScale.invert(t);return this.xScale(this.low()+Math.round((e-this.low())/this.step())*this.step())}handlePath=/* @__PURE__ */e(function(t){const e=+("r"===t),n=e?1:-1,i=this.allowRange()?.5:0;let s="M"+i*n+","+"18A6,6 0 0 "+e+" "+6.5*n+",24V30A6,6 0 0 "+e+" "+i*n+",36";return this.allowRange()?s+="ZM"+2.5*n+",26V28M"+4.5*n+",26V28":s+="M"+1*n+",26V28",s},"handlePath")};e(D,"Slider");let W=D;W.prototype._class+=" form_Slider",W.prototype.implements(n.prototype),W.prototype.publish("padding",16,"number","Outer Padding",null,{tags:["Basic"]}),W.prototype.publish("fontSize",12,"number","Font Size",null,{tags:["Basic"]}),W.prototype.publish("fontFamily",null,"string","Font Name",null,{tags:["Basic"]}),W.prototype.publish("fontColor",null,"html-color","Font Color",null,{tags:["Basic"]}),W.prototype.publish("allowRange",!1,"boolean","Allow Range Selection",null,{tags:["Intermediate"]}),W.prototype.publish("low",null,"number","Low",null,{tags:["Intermediate"]}),W.prototype.publish("high",null,"number","High",null,{tags:["Intermediate"]}),W.prototype.publish("step",10,"number","Step",null,{tags:["Intermediate"]}),W.prototype.publish("lowDatetime",null,"string","Low",null,{tags:["Intermediate"]}),W.prototype.publish("highDatetime",null,"string","High",null,{tags:["Intermediate"]}),W.prototype.publish("selectionLabel","","string","Selection Label",null,{tags:["Intermediate"]}),W.prototype.publish("timePattern","%Y-%m-%d","string"),W.prototype.publish("tickCount",10,"number"),W.prototype.publish("tickOffset",5,"number"),W.prototype.publish("tickHeight",8,"number"),W.prototype.publish("tickDateFormat",null,"string"),W.prototype.publish("tickValueFormat",",.0f","string");const z=W.prototype.name;W.prototype.name=function(t){const e=z.apply(this,arguments);if(arguments.length){const e=t instanceof Array?t:[t];r.prototype.columns.call(this,e)}return e};const N=W.prototype.value;W.prototype.value=function(t){const e=N.apply(this,arguments);return arguments.length?(r.prototype.data.call(this,[this.allowRange()?t:[t,t]]),e):this.allowRange()?r.prototype.data.call(this)[0]:r.prototype.data.call(this)[0][0]};const j=class _TextArea extends S{constructor(){super(),this._tag="div",this.type("textarea")}enter(t,e){super.enter(t,e)}calcHeight(){return Math.max(this.minHeight_exists()?this.minHeight():0,this.height())}update(t,e){super.update(t,e),this._inputElement[0].attr("rows",this.rows()).attr("cols",this.cols()).attr("wrap",this.wrap()).attr("spellcheck",this.spellcheck()).style("height",this.calcHeight()+"px")}};e(j,"TextArea");let q=j;q.prototype._class+=" form_TextArea",q.prototype.publish("rows",null,"number","Rows",null,{optional:!0}),q.prototype.publish("cols",null,"number","Columns",null,{optional:!0}),q.prototype.publish("wrap","off","set","Wrap",["off","on"]),q.prototype.publish("minHeight",null,"number","Minimum Height",null,{optional:!0}),q.prototype.publish("spellcheck",null,"boolean","Input spell checking",{optional:!0});export{y as BUILD_VERSION,b as Button,v as CheckBox,E as ColorInput,O as FieldForm,w as Form,S as Input,F as InputRange,A as OnOff,m as PKG_NAME,f as PKG_VERSION,M as Radio,I as Range,V as Select,W as Slider,q as TextArea};
2
+ //# sourceMappingURL=index.js.map
3
+ !function(){"use strict";try{if("undefined"!=typeof document){var o=document.createElement("style");o.appendChild(document.createTextNode(".form_Input input,.form_Input select,.form_Input button,.form_Input textarea{padding:2px}.form_Input button{cursor:pointer}.form_Input input.color-text{width:120px}.form_Input input.color-text+input{width:57px;position:absolute}.form_Input textarea,.form_Input input[type=textbox]{width:100%;box-sizing:border-box;display:block}.form_Input ul{list-style-type:none;float:left;padding:0;margin:0}.form_Input li{float:left;list-style-position:inside}.form_Form{color:#404040}.form_Form tbody td{white-space:nowrap;border:1px solid #E5E5E5}.form_Form td.prompt{padding:2px;vertical-align:middle;background-color:#e5e5e5}.form_Form td.input{padding:2px;width:100%;vertical-align:middle}.form_Form td.input .common_HTMLWidget ul{margin:0}.form_Form tfoot button{margin:5px}.form_Form tbody tr:hover{background-color:#fafafa}.form_Form .form_Button button{background-position:-1px -1px;box-sizing:border-box;color:#24292e;cursor:pointer;height:28px;inset:0;overflow-wrap:break-word;position:relative;text-decoration:none solid rgb(36,41,46);vertical-align:middle;white-space:nowrap;word-wrap:break-word;column-rule-color:#24292e;perspective-origin:57.2938px 14px;transform-origin:57.2938px 14px;-webkit-user-select:none;user-select:none;background:#eff3f6 linear-gradient(-180deg,#fafbfc,#eff3f6 90%) repeat-x scroll -1px -1px / 110% 110% padding-box border-box;border:1px solid rgba(27,31,35,.2);border-radius:3px;outline:rgb(36,41,46) none 0px;padding:3px 10px}.form_Form .form_Button button[disabled=disabled]{background:#dbdfe2}.form_Form .form_Button button:focus{box-shadow:0 0 0 .2em #0366d64d}.form_Form .form_Button button:hover{background:#dbdfe2}.form_Form .form_Button.default button{color:#fff;text-decoration:none solid rgb(255,255,255);word-wrap:break-word;column-rule-color:#fff;perspective-origin:44.975px 17px;transform-origin:44.975px 17px;background:#28a745 linear-gradient(-180deg,#34d058,#28a745 90%) repeat-x scroll -1px -1px / 110% 110% padding-box border-box;outline:rgb(255,255,255) none 0px}.form_Form .form_Button.default button[disabled=disabled],.form_Form .form_Button.default button[disabled=disabled]:hover{background:#dbdfe2}.form_Form .form_Button.default button:hover{background:#149331}.onoffswitch-checkbox{display:none}.onoffswitch{position:relative;height:20px;width:100px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}.onoffswitch-label{display:block;overflow:hidden;cursor:pointer;border:1px solid #999999;height:20px}.onoffswitch-inner{position:relative;display:block;transition:margin .3s ease-in 0s}.onoffswitch-inner>.onoffswitch-offText,.onoffswitch-inner>.onoffswitch-onText{height:100%}.onoffswitch-inner>.onoffswitch-offText{font-weight:700;position:absolute;right:0;transition:all .3s ease-in 0s;width:100%;text-align:right}.onoffswitch-inner>.onoffswitch-onText{font-weight:700;position:absolute;left:-100%;transition:all .3s ease-in 0s;width:100%;text-align:left}.onoffswitch-switch{display:block;width:20px;margin:-1px;background:#fff;position:absolute;border:1px solid #999999;transition:all .3s ease-in 0s;inset:0 78px 0 4px}.onoffswitch-checkbox:checked+.onoffswitch-label .onoffswitch-inner>.onoffswitch-offText{right:-100%}.onoffswitch-checkbox:checked+.onoffswitch-label .onoffswitch-inner>.onoffswitch-onText{left:0}.onoffswitch-checkbox:checked+.onoffswitch-label .onoffswitch-switch{left:calc(100% - 20px)}.form_Slider .ticks{font:10px sans-serif}.form_Slider .track,.form_Slider .track-inset,.form_Slider .track-overlay{stroke-linecap:round}.form_Slider .track{stroke:#000;stroke-opacity:.3;stroke-width:10px}.form_Slider .track-inset{stroke:#ddd;stroke-width:8px}.form_Slider .track-overlay{pointer-events:stroke;stroke-width:50px;stroke:transparent;cursor:crosshair}.form_Slider .handle{fill:#fff;stroke:#000;stroke-opacity:.5;stroke-width:1.25px}.form_Slider .tick-line{stroke:#000;stroke-opacity:.5;stroke-width:1px;shape-rendering:crispEdges}")),document.head.appendChild(o)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}}();