@hpcc-js/form 3.3.1 → 3.3.3

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