@hpcc-js/form 2.10.11 → 2.10.13

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,1288 +1,1293 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@hpcc-js/api'), require('@hpcc-js/common')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@hpcc-js/api', '@hpcc-js/common'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@hpcc-js/form"] = {}, global["@hpcc-js/api"], global["@hpcc-js/common"]));
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@hpcc-js/api'), require('@hpcc-js/common')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', '@hpcc-js/api', '@hpcc-js/common'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@hpcc-js/form"] = {}, global["@hpcc-js/api"], global["@hpcc-js/common"]));
5
5
  })(this, (function (exports, api, common) { 'use strict';
6
6
 
7
- var PKG_NAME = "@hpcc-js/form";
8
- var PKG_VERSION = "2.10.11";
9
- var BUILD_VERSION = "2.104.28";
7
+ var PKG_NAME = "@hpcc-js/form";
8
+ var PKG_VERSION = "2.10.13";
9
+ var BUILD_VERSION = "2.104.32";
10
10
 
11
- /******************************************************************************
12
- Copyright (c) Microsoft Corporation.
13
-
14
- Permission to use, copy, modify, and/or distribute this software for any
15
- purpose with or without fee is hereby granted.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
18
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
19
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
20
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
21
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
22
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
23
- PERFORMANCE OF THIS SOFTWARE.
24
- ***************************************************************************** */
25
- /* global Reflect, Promise */
26
-
27
- var extendStatics = function(d, b) {
28
- extendStatics = Object.setPrototypeOf ||
29
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
30
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
31
- return extendStatics(d, b);
32
- };
33
-
34
- function __extends(d, b) {
35
- if (typeof b !== "function" && b !== null)
36
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
37
- extendStatics(d, b);
38
- function __() { this.constructor = d; }
39
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
40
- }
11
+ /******************************************************************************
12
+ Copyright (c) Microsoft Corporation.
13
+
14
+ Permission to use, copy, modify, and/or distribute this software for any
15
+ purpose with or without fee is hereby granted.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
18
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
19
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
20
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
21
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
22
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
23
+ PERFORMANCE OF THIS SOFTWARE.
24
+ ***************************************************************************** */
25
+ /* global Reflect, Promise, SuppressedError, Symbol */
26
+
27
+ var extendStatics = function(d, b) {
28
+ extendStatics = Object.setPrototypeOf ||
29
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
30
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
31
+ return extendStatics(d, b);
32
+ };
41
33
 
42
- function styleInject(css, ref) {
43
- if ( ref === void 0 ) ref = {};
44
- var insertAt = ref.insertAt;
34
+ function __extends(d, b) {
35
+ if (typeof b !== "function" && b !== null)
36
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
37
+ extendStatics(d, b);
38
+ function __() { this.constructor = d; }
39
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
40
+ }
45
41
 
46
- if (!css || typeof document === 'undefined') { return; }
42
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
43
+ var e = new Error(message);
44
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
45
+ };
47
46
 
48
- var head = document.head || document.getElementsByTagName('head')[0];
49
- var style = document.createElement('style');
50
- style.type = 'text/css';
47
+ function styleInject(css, ref) {
48
+ if ( ref === void 0 ) ref = {};
49
+ var insertAt = ref.insertAt;
51
50
 
52
- if (insertAt === 'top') {
53
- if (head.firstChild) {
54
- head.insertBefore(style, head.firstChild);
55
- } else {
56
- head.appendChild(style);
57
- }
51
+ if (!css || typeof document === 'undefined') { return; }
52
+
53
+ var head = document.head || document.getElementsByTagName('head')[0];
54
+ var style = document.createElement('style');
55
+ style.type = 'text/css';
56
+
57
+ if (insertAt === 'top') {
58
+ if (head.firstChild) {
59
+ head.insertBefore(style, head.firstChild);
58
60
  } else {
59
61
  head.appendChild(style);
60
62
  }
63
+ } else {
64
+ head.appendChild(style);
65
+ }
61
66
 
62
- if (style.styleSheet) {
63
- style.styleSheet.cssText = css;
64
- } else {
65
- style.appendChild(document.createTextNode(css));
66
- }
67
+ if (style.styleSheet) {
68
+ style.styleSheet.cssText = css;
69
+ } else {
70
+ style.appendChild(document.createTextNode(css));
67
71
  }
72
+ }
68
73
 
69
- var css_248z$3 = ".form_Input button,.form_Input input,.form_Input select,.form_Input textarea{padding:2px}.form_Input button{cursor:pointer}.form_Input input.color-text{width:120px}.form_Input input.color-text+input{position:absolute;width:57px}.form_Input input[type=textbox],.form_Input textarea{box-sizing:border-box;display:block;width:100%}.form_Input ul{float:left;list-style-type:none;margin:0;padding:0}.form_Input li{float:left;list-style-position:inside}";
70
- styleInject(css_248z$3);
74
+ var css_248z$3 = ".form_Input button,.form_Input input,.form_Input select,.form_Input textarea{padding:2px}.form_Input button{cursor:pointer}.form_Input input.color-text{width:120px}.form_Input input.color-text+input{position:absolute;width:57px}.form_Input input[type=textbox],.form_Input textarea{box-sizing:border-box;display:block;width:100%}.form_Input ul{float:left;list-style-type:none;margin:0;padding:0}.form_Input li{float:left;list-style-position:inside}";
75
+ styleInject(css_248z$3);
71
76
 
72
- var Button = /** @class */ (function (_super) {
73
- __extends(Button, _super);
74
- function Button() {
75
- var _this = _super.call(this) || this;
76
- _this._inputElement = [];
77
- api.IInput.call(_this);
78
- _this._tag = "div";
79
- return _this;
80
- }
81
- Button.prototype.enter = function (domNode, element) {
82
- _super.prototype.enter.call(this, domNode, element);
83
- var context = this;
84
- this._inputElement[0] = element.append("button")
85
- .attr("name", this.name())
86
- .on("click", function (w) {
87
- w.click(w);
88
- })
89
- .on("blur", function (w) {
90
- w.blur(w);
91
- })
92
- .on("change", function (w) {
93
- context.value([context._inputElement[0].property("value")]);
94
- w.change(w, true);
95
- });
96
- };
97
- Button.prototype.update = function (domNode, element) {
98
- _super.prototype.update.call(this, domNode, element);
99
- this._inputElement[0].text(this.value());
100
- };
101
- return Button;
102
- }(common.HTMLWidget));
103
- Button.prototype._class += " form_Button";
104
- Button.prototype.implements(api.IInput.prototype);
77
+ var Button = /** @class */ (function (_super) {
78
+ __extends(Button, _super);
79
+ function Button() {
80
+ var _this = _super.call(this) || this;
81
+ _this._inputElement = [];
82
+ api.IInput.call(_this);
83
+ _this._tag = "div";
84
+ return _this;
85
+ }
86
+ Button.prototype.enter = function (domNode, element) {
87
+ _super.prototype.enter.call(this, domNode, element);
88
+ var context = this;
89
+ this._inputElement[0] = element.append("button")
90
+ .attr("name", this.name())
91
+ .on("click", function (w) {
92
+ w.click(w);
93
+ })
94
+ .on("blur", function (w) {
95
+ w.blur(w);
96
+ })
97
+ .on("change", function (w) {
98
+ context.value([context._inputElement[0].property("value")]);
99
+ w.change(w, true);
100
+ });
101
+ };
102
+ Button.prototype.update = function (domNode, element) {
103
+ _super.prototype.update.call(this, domNode, element);
104
+ this._inputElement[0].text(this.value());
105
+ };
106
+ return Button;
107
+ }(common.HTMLWidget));
108
+ Button.prototype._class += " form_Button";
109
+ Button.prototype.implements(api.IInput.prototype);
105
110
 
106
- var CheckBox = /** @class */ (function (_super) {
107
- __extends(CheckBox, _super);
108
- function CheckBox() {
109
- var _this = _super.call(this) || this;
110
- _this._inputElement = [];
111
- api.IInput.call(_this);
112
- _this._tag = "div";
113
- return _this;
114
- }
115
- CheckBox.prototype.enter = function (domNode, element) {
116
- _super.prototype.enter.call(this, domNode, element);
117
- var context = this;
118
- var checkboxContainer = element.append("ul");
119
- if (!this.selectOptions().length) {
120
- this.selectOptions().push(""); // create an empty radio if we using .value and not selectOptions array
121
- }
122
- this.selectOptions().forEach(function (val, idx) {
123
- context._inputElement[idx] = checkboxContainer.append("li").append("input").attr("type", "checkbox");
124
- context._inputElement[idx].node().insertAdjacentHTML("afterend", "<text>" + val + "</text>");
125
- });
126
- this._inputElement.forEach(function (e, idx) {
127
- e.attr("name", context.name());
128
- e.on("click", function (w) {
129
- w.click(w);
130
- });
131
- e.on("blur", function (w) {
132
- w.blur(w);
133
- });
134
- e.on("change", function (w) {
135
- var vals = [];
136
- context._inputElement.forEach(function (d) {
137
- if (d.property("checked")) {
138
- vals.push(d.property("value"));
139
- }
140
- });
141
- context.value(vals);
142
- w.change(w, true);
143
- });
144
- });
145
- };
146
- CheckBox.prototype.update = function (domNode, element) {
147
- _super.prototype.update.call(this, domNode, element);
148
- var context = this;
149
- this._inputElement.forEach(function (e, idx) {
150
- e.property("value", context.selectOptions()[idx]);
151
- if (context.value().indexOf(context.selectOptions()[idx]) !== -1 && context.value() !== "false") {
152
- e.property("checked", true);
153
- }
154
- else {
155
- e.property("checked", false);
156
- }
157
- });
158
- };
159
- CheckBox.prototype.insertSelectOptions = function (optionsArr) {
160
- var optionHTML = "";
161
- if (optionsArr.length > 0) {
162
- optionsArr.forEach(function (opt) {
163
- var val = (opt instanceof Array ? opt[0] : opt);
164
- var text = (opt instanceof Array ? (opt[1] ? opt[1] : opt[0]) : opt);
165
- optionHTML += "<option value='" + val + "'>" + text + "</option>";
166
- });
167
- }
168
- else {
169
- optionHTML += "<option>selectOptions not set</option>";
170
- }
171
- this._inputElement[0].html(optionHTML);
172
- };
173
- return CheckBox;
174
- }(common.HTMLWidget));
175
- CheckBox.prototype._class += " form_CheckBox";
176
- CheckBox.prototype.implements(api.IInput.prototype);
177
- CheckBox.prototype.publish("selectOptions", [], "array", "Array of options used to fill a dropdown list");
111
+ var CheckBox = /** @class */ (function (_super) {
112
+ __extends(CheckBox, _super);
113
+ function CheckBox() {
114
+ var _this = _super.call(this) || this;
115
+ _this._inputElement = [];
116
+ api.IInput.call(_this);
117
+ _this._tag = "div";
118
+ return _this;
119
+ }
120
+ CheckBox.prototype.enter = function (domNode, element) {
121
+ _super.prototype.enter.call(this, domNode, element);
122
+ var context = this;
123
+ var checkboxContainer = element.append("ul");
124
+ if (!this.selectOptions().length) {
125
+ this.selectOptions().push(""); // create an empty radio if we using .value and not selectOptions array
126
+ }
127
+ this.selectOptions().forEach(function (val, idx) {
128
+ context._inputElement[idx] = checkboxContainer.append("li").append("input").attr("type", "checkbox");
129
+ context._inputElement[idx].node().insertAdjacentHTML("afterend", "<text>" + val + "</text>");
130
+ });
131
+ this._inputElement.forEach(function (e, idx) {
132
+ e.attr("name", context.name());
133
+ e.on("click", function (w) {
134
+ w.click(w);
135
+ });
136
+ e.on("blur", function (w) {
137
+ w.blur(w);
138
+ });
139
+ e.on("change", function (w) {
140
+ var vals = [];
141
+ context._inputElement.forEach(function (d) {
142
+ if (d.property("checked")) {
143
+ vals.push(d.property("value"));
144
+ }
145
+ });
146
+ context.value(vals);
147
+ w.change(w, true);
148
+ });
149
+ });
150
+ };
151
+ CheckBox.prototype.update = function (domNode, element) {
152
+ _super.prototype.update.call(this, domNode, element);
153
+ var context = this;
154
+ this._inputElement.forEach(function (e, idx) {
155
+ e.property("value", context.selectOptions()[idx]);
156
+ if (context.value().indexOf(context.selectOptions()[idx]) !== -1 && context.value() !== "false") {
157
+ e.property("checked", true);
158
+ }
159
+ else {
160
+ e.property("checked", false);
161
+ }
162
+ });
163
+ };
164
+ CheckBox.prototype.insertSelectOptions = function (optionsArr) {
165
+ var optionHTML = "";
166
+ if (optionsArr.length > 0) {
167
+ optionsArr.forEach(function (opt) {
168
+ var val = (opt instanceof Array ? opt[0] : opt);
169
+ var text = (opt instanceof Array ? (opt[1] ? opt[1] : opt[0]) : opt);
170
+ optionHTML += "<option value='" + val + "'>" + text + "</option>";
171
+ });
172
+ }
173
+ else {
174
+ optionHTML += "<option>selectOptions not set</option>";
175
+ }
176
+ this._inputElement[0].html(optionHTML);
177
+ };
178
+ return CheckBox;
179
+ }(common.HTMLWidget));
180
+ CheckBox.prototype._class += " form_CheckBox";
181
+ CheckBox.prototype.implements(api.IInput.prototype);
182
+ CheckBox.prototype.publish("selectOptions", [], "array", "Array of options used to fill a dropdown list");
178
183
 
179
- var ColorInput = /** @class */ (function (_super) {
180
- __extends(ColorInput, _super);
181
- function ColorInput() {
182
- var _this = _super.call(this) || this;
183
- _this._inputElement = [];
184
- api.IInput.call(_this);
185
- _this._tag = "div";
186
- return _this;
187
- }
188
- ColorInput.prototype.enter = function (domNode, element) {
189
- _super.prototype.enter.call(this, domNode, element);
190
- var context = this;
191
- this._inputElement[0] = element.append("input").attr("type", "text");
192
- this._inputElement[0].classed("color-text", true);
193
- this._inputElement[1] = element.append("input").attr("type", "color");
194
- this._inputElement.forEach(function (e, idx) {
195
- e.on("click", function (w) {
196
- w.click(w);
197
- });
198
- e.on("blur", function (w) {
199
- w.blur(w);
200
- });
201
- e.on("change", function (w) {
202
- if (idx === 0) {
203
- context._inputElement[1].property("value", common.rgb(context._inputElement[0].property("value")).toString());
204
- context.value(context._inputElement[0].property("value"));
205
- }
206
- else {
207
- context._inputElement[0].property("value", context._inputElement[1].property("value"));
208
- context.value(common.rgb(context._inputElement[1].property("value")).toString());
209
- }
210
- w.change(w, true);
211
- });
212
- });
213
- };
214
- ColorInput.prototype.update = function (domNode, element) {
215
- _super.prototype.update.call(this, domNode, element);
216
- var context = this;
217
- this._inputElement.forEach(function (e) {
218
- e.attr("name", context.name());
219
- });
220
- this._inputElement[0].attr("type", "text");
221
- this._inputElement[1].attr("type", "color");
222
- this._inputElement[0].property("value", this.value());
223
- this._inputElement[1].property("value", common.rgb(this.value()).toString());
224
- var bbox = this._inputElement[0].node().getBoundingClientRect();
225
- this._inputElement[1].style("height", (bbox.height - 2) + "px");
226
- };
227
- return ColorInput;
228
- }(common.HTMLWidget));
229
- ColorInput.prototype._class += " form_ColorInput";
230
- ColorInput.prototype.implements(api.IInput.prototype);
184
+ var ColorInput = /** @class */ (function (_super) {
185
+ __extends(ColorInput, _super);
186
+ function ColorInput() {
187
+ var _this = _super.call(this) || this;
188
+ _this._inputElement = [];
189
+ api.IInput.call(_this);
190
+ _this._tag = "div";
191
+ return _this;
192
+ }
193
+ ColorInput.prototype.enter = function (domNode, element) {
194
+ _super.prototype.enter.call(this, domNode, element);
195
+ var context = this;
196
+ this._inputElement[0] = element.append("input").attr("type", "text");
197
+ this._inputElement[0].classed("color-text", true);
198
+ this._inputElement[1] = element.append("input").attr("type", "color");
199
+ this._inputElement.forEach(function (e, idx) {
200
+ e.on("click", function (w) {
201
+ w.click(w);
202
+ });
203
+ e.on("blur", function (w) {
204
+ w.blur(w);
205
+ });
206
+ e.on("change", function (w) {
207
+ if (idx === 0) {
208
+ context._inputElement[1].property("value", common.rgb(context._inputElement[0].property("value")).toString());
209
+ context.value(context._inputElement[0].property("value"));
210
+ }
211
+ else {
212
+ context._inputElement[0].property("value", context._inputElement[1].property("value"));
213
+ context.value(common.rgb(context._inputElement[1].property("value")).toString());
214
+ }
215
+ w.change(w, true);
216
+ });
217
+ });
218
+ };
219
+ ColorInput.prototype.update = function (domNode, element) {
220
+ _super.prototype.update.call(this, domNode, element);
221
+ var context = this;
222
+ this._inputElement.forEach(function (e) {
223
+ e.attr("name", context.name());
224
+ });
225
+ this._inputElement[0].attr("type", "text");
226
+ this._inputElement[1].attr("type", "color");
227
+ this._inputElement[0].property("value", this.value());
228
+ this._inputElement[1].property("value", common.rgb(this.value()).toString());
229
+ var bbox = this._inputElement[0].node().getBoundingClientRect();
230
+ this._inputElement[1].style("height", (bbox.height - 2) + "px");
231
+ };
232
+ return ColorInput;
233
+ }(common.HTMLWidget));
234
+ ColorInput.prototype._class += " form_ColorInput";
235
+ ColorInput.prototype.implements(api.IInput.prototype);
231
236
 
232
- var css_248z$2 = ".form_Form{color:#404040}.form_Form tbody td{border:1px solid #e5e5e5;white-space:nowrap}.form_Form td.prompt{background-color:#e5e5e5;padding:2px;vertical-align:middle}.form_Form td.input{padding:2px;vertical-align:middle;width:100%}.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{word-wrap:break-word;background-position:-1px -1px;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 3px 3px 3px;bottom:0;box-sizing:border-box;color:#24292e;column-rule-color:#24292e;cursor:pointer;height:28px;left:0;outline:0 none #24292e;overflow-wrap:break-word;padding:3px 10px;perspective-origin:57.2938px 14px;position:relative;right:0;text-decoration:none solid #24292e;top:0;transform-origin:57.2938px 14px;user-select:none;vertical-align:middle;white-space:nowrap}.form_Form .form_Button button[disabled=disabled]{background:#dbdfe2}.form_Form .form_Button button:focus{box-shadow:0 0 0 .2em rgba(3,102,214,.3)}.form_Form .form_Button button:hover{background:#dbdfe2}.form_Form .form_Button.default button{word-wrap:break-word;background:#28a745 linear-gradient(-180deg,#34d058,#28a745 90%) repeat-x scroll -1px -1px /110% 110% padding-box border-box;color:#fff;column-rule-color:#fff;outline:0 none #fff;perspective-origin:44.975px 17px;text-decoration:none solid #fff;transform-origin:44.975px 17px}.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}";
233
- styleInject(css_248z$2);
237
+ var css_248z$2 = ".form_Form{color:#404040}.form_Form tbody td{border:1px solid #e5e5e5;white-space:nowrap}.form_Form td.prompt{background-color:#e5e5e5;padding:2px;vertical-align:middle}.form_Form td.input{padding:2px;vertical-align:middle;width:100%}.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{word-wrap:break-word;background-position:-1px -1px;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 3px 3px 3px;bottom:0;box-sizing:border-box;color:#24292e;column-rule-color:#24292e;cursor:pointer;height:28px;left:0;outline:0 none #24292e;overflow-wrap:break-word;padding:3px 10px;perspective-origin:57.2938px 14px;position:relative;right:0;text-decoration:none solid #24292e;top:0;transform-origin:57.2938px 14px;user-select:none;vertical-align:middle;white-space:nowrap}.form_Form .form_Button button[disabled=disabled]{background:#dbdfe2}.form_Form .form_Button button:focus{box-shadow:0 0 0 .2em rgba(3,102,214,.3)}.form_Form .form_Button button:hover{background:#dbdfe2}.form_Form .form_Button.default button{word-wrap:break-word;background:#28a745 linear-gradient(-180deg,#34d058,#28a745 90%) repeat-x scroll -1px -1px /110% 110% padding-box border-box;color:#fff;column-rule-color:#fff;outline:0 none #fff;perspective-origin:44.975px 17px;text-decoration:none solid #fff;transform-origin:44.975px 17px}.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}";
238
+ styleInject(css_248z$2);
234
239
 
235
- var Form = /** @class */ (function (_super) {
236
- __extends(Form, _super);
237
- function Form() {
238
- var _this = _super.call(this) || this;
239
- _this._tag = "form";
240
- return _this;
241
- }
242
- Form.prototype.data = function (_) {
243
- if (!arguments.length) {
244
- var retVal_1 = [];
245
- this.inputsForEach(function (input) {
246
- retVal_1.push(input.value());
247
- });
248
- return retVal_1;
249
- }
250
- else {
251
- this.inputsForEach(function (input, idx) {
252
- if (_ && _.length > idx) {
253
- input.value(_[idx]).render();
254
- }
255
- });
256
- }
257
- return this;
258
- };
259
- Form.prototype.inputsForEach = function (callback, scope) {
260
- var idx = 0;
261
- this.inputs().forEach(function (inp) {
262
- var inpArray = inp instanceof common.WidgetArray ? inp.content() : [inp];
263
- inpArray.forEach(function (inp2) {
264
- if (scope) {
265
- callback.call(scope, inp2, idx++);
266
- }
267
- else {
268
- callback(inp2, idx++);
269
- }
270
- });
271
- });
272
- };
273
- Form.prototype.inputsMap = function () {
274
- var retVal = {};
275
- this.inputs().forEach(function (inp) {
276
- retVal[inp.name()] = inp;
277
- });
278
- return retVal;
279
- };
280
- Form.prototype.calcMaxColumns = function () {
281
- var retVal = 0;
282
- this.inputs().forEach(function (inputWidget) {
283
- var inputWidgetArray = inputWidget instanceof common.WidgetArray ? inputWidget.content() : [inputWidget];
284
- if (inputWidgetArray.length > retVal) {
285
- retVal = inputWidgetArray.length;
286
- }
287
- });
288
- return retVal;
289
- };
290
- Form.prototype.values = function (_) {
291
- if (!arguments.length) {
292
- var dataArr_1 = {};
293
- this.inputsForEach(function (inp) {
294
- var type = inp.type ? inp.type() : "text";
295
- var value = inp.value();
296
- if (value || !this.omitBlank()) {
297
- switch (type) {
298
- case "checkbox":
299
- dataArr_1[inp.name()] = inp.value_exists() ? !!inp.value() : undefined;
300
- break;
301
- case "number":
302
- var v = inp.value();
303
- dataArr_1[inp.name()] = v === "" ? undefined : +v;
304
- break;
305
- case "text":
306
- default:
307
- dataArr_1[inp.name()] = inp.value_exists() ? inp.value() : undefined;
308
- break;
309
- }
310
- }
311
- }, this);
312
- return dataArr_1;
313
- }
314
- else {
315
- this.inputsForEach(function (inp) {
316
- if (_[inp.name()]) {
317
- inp.value(_[inp.name()]);
318
- }
319
- else if (this.omitBlank()) {
320
- inp.value("");
321
- }
322
- }, this);
323
- }
324
- return this;
325
- };
326
- Form.prototype.submit = function () {
327
- var isValid = true;
328
- if (this.validate()) {
329
- isValid = this.checkValidation();
330
- }
331
- if (!this.allowEmptyRequest() && !this.inputs().some(function (w) {
332
- if (w._class.indexOf("WidgetArray") !== -1) {
333
- return w.content().some(function (wa) {
334
- return wa.hasValue();
335
- });
336
- }
337
- return w.hasValue();
338
- })) {
339
- return;
340
- }
341
- this.click(isValid ? this.values() : null, null, isValid);
342
- };
343
- Form.prototype.clear = function () {
344
- this.inputsForEach(function (inp) {
345
- switch (inp.classID()) {
346
- case "form_Slider":
347
- if (inp.allowRange()) {
348
- inp.value([inp.low(), inp.low()]).render();
349
- }
350
- else {
351
- inp.value(inp.low()).render();
352
- }
353
- break;
354
- case "form_CheckBox":
355
- inp.value(false).render();
356
- break;
357
- case "form_Button":
358
- /* skip */
359
- break;
360
- default:
361
- inp.value(undefined).render();
362
- break;
363
- }
364
- });
365
- };
366
- Form.prototype.checkValidation = function () {
367
- var ret = true;
368
- var msgArr = [];
369
- this.inputsForEach(function (inp) {
370
- if (!inp.isValid()) {
371
- msgArr.push("'" + inp.label() + "'" + " value is invalid.");
372
- }
373
- });
374
- if (msgArr.length > 0) {
375
- alert(msgArr.join("\n"));
376
- ret = false;
377
- }
378
- return ret;
379
- };
380
- Form.prototype.enter = function (domNode, element) {
381
- _super.prototype.enter.call(this, domNode, element);
382
- element.on("submit", function () {
383
- common.d3Event().preventDefault();
384
- });
385
- this._placeholderElement.style("overflow", "auto");
386
- var table = element
387
- .append("table");
388
- this.tbody = table.append("tbody");
389
- this.tfoot = table.append("tfoot");
390
- this.btntd = this.tfoot.append("tr").append("td")
391
- .attr("colspan", 2);
392
- var context = this;
393
- this._controls = [
394
- new Button()
395
- .classed({ default: true })
396
- .value("Submit")
397
- .on("click", function () {
398
- context.submit();
399
- }, true),
400
- new Button()
401
- .value("Clear")
402
- .on("click", function () {
403
- context.clear();
404
- }, true)
405
- ];
406
- var rightJust = context.btntd
407
- .append("div")
408
- .style("float", "right");
409
- this._controls.forEach(function (w) {
410
- var leftJust = rightJust
411
- .append("span")
412
- .style("float", "left");
413
- w.target(leftJust.node()).render();
414
- });
415
- };
416
- Form.prototype.update = function (domNode, element) {
417
- _super.prototype.update.call(this, domNode, element);
418
- this._maxCols = this.calcMaxColumns();
419
- var context = this;
420
- var rows = this.tbody.selectAll("tr").data(this.inputs());
421
- rows.enter().append("tr")
422
- .each(function (inputWidget, i) {
423
- var element2 = common.select(this);
424
- var inputWidgetArray = inputWidget instanceof common.WidgetArray ? inputWidget.content() : [inputWidget];
425
- inputWidgetArray.forEach(function (inputWidget2, idx) {
426
- element2.append("td")
427
- .attr("class", "prompt");
428
- var input = element2.append("td")
429
- .attr("class", "input");
430
- if (idx === inputWidgetArray.length - 1 && inputWidgetArray.length < context._maxCols) {
431
- input.attr("colspan", (context._maxCols - inputWidgetArray.length + 1) * 2);
432
- }
433
- inputWidget2.target(input.node()).render();
434
- if (inputWidget2 instanceof common.SVGWidget) {
435
- var bbox = inputWidget2.element().node().getBBox();
436
- input.style("height", bbox.height + "px");
437
- inputWidget2.resize().render();
438
- }
439
- if (inputWidget2._inputElement instanceof Array) {
440
- inputWidget2._inputElement.forEach(function (e) {
441
- e.on("keyup.form", function (w) {
442
- setTimeout(function () {
443
- context._controls[0].disable(!context.allowEmptyRequest() && !context.inputs().some(function (w2) {
444
- if (w2._class.indexOf("WidgetArray") !== -1) {
445
- return w2.content().some(function (wa) {
446
- return wa.hasValue();
447
- });
448
- }
449
- return w2.hasValue();
450
- }));
451
- }, 100);
452
- });
453
- });
454
- }
455
- });
456
- })
457
- .merge(rows)
458
- .each(function (inputWidget, i) {
459
- var element2 = common.select(this);
460
- var inputWidgetArray = inputWidget instanceof common.WidgetArray ? inputWidget.content() : [inputWidget];
461
- inputWidgetArray.forEach(function (inputWidget2, idx) {
462
- element2.select("td.prompt")
463
- .text(inputWidget2.label() + ":");
464
- });
465
- });
466
- rows.each(function (inputWidget, i) {
467
- if (i === 0 && inputWidget.setFocus) {
468
- inputWidget.setFocus();
469
- }
470
- });
471
- rows.exit()
472
- .each(function (inputWidget, i) {
473
- var inputWidgetArray = inputWidget instanceof common.WidgetArray ? inputWidget.content() : [inputWidget];
474
- inputWidgetArray.forEach(function (inputWidget2, idx) {
475
- inputWidget2.target(null);
476
- });
477
- })
478
- .remove();
479
- this.tfoot
480
- .style("display", this.showSubmit() ? "table-footer-group" : "none");
481
- this.btntd
482
- .attr("colspan", this._maxCols * 2);
483
- // Disable Submit unless there is data
484
- if (!this.allowEmptyRequest()) {
485
- setTimeout(function () {
486
- context._controls[0].disable(!context.allowEmptyRequest() && !context.inputs().some(function (w) {
487
- if (w._class.indexOf("WidgetArray") !== -1) {
488
- return w.content().some(function (wa) {
489
- return wa.hasValue();
490
- });
491
- }
492
- return w.hasValue();
493
- }));
494
- }, 100);
495
- }
496
- };
497
- Form.prototype.exit = function (domNode, element) {
498
- this.inputsForEach(function (input) { return input.target(null); });
499
- _super.prototype.exit.call(this, domNode, element);
500
- };
501
- Form.prototype.click = function (row, col, sel) {
502
- };
503
- return Form;
504
- }(common.HTMLWidget));
505
- Form.prototype._class += " form_Form";
506
- Form.prototype.publish("validate", true, "boolean", "Enable/Disable input validation");
507
- Form.prototype.publish("inputs", [], "widgetArray", "Array of input widgets", null, { render: false });
508
- Form.prototype.publish("showSubmit", true, "boolean", "Show Submit/Cancel Controls");
509
- Form.prototype.publish("omitBlank", false, "boolean", "Drop Blank Fields From Submit");
510
- Form.prototype.publish("allowEmptyRequest", false, "boolean", "Allow Blank Form to be Submitted");
240
+ var Form = /** @class */ (function (_super) {
241
+ __extends(Form, _super);
242
+ function Form() {
243
+ var _this = _super.call(this) || this;
244
+ _this._tag = "form";
245
+ return _this;
246
+ }
247
+ Form.prototype.data = function (_) {
248
+ if (!arguments.length) {
249
+ var retVal_1 = [];
250
+ this.inputsForEach(function (input) {
251
+ retVal_1.push(input.value());
252
+ });
253
+ return retVal_1;
254
+ }
255
+ else {
256
+ this.inputsForEach(function (input, idx) {
257
+ if (_ && _.length > idx) {
258
+ input.value(_[idx]).render();
259
+ }
260
+ });
261
+ }
262
+ return this;
263
+ };
264
+ Form.prototype.inputsForEach = function (callback, scope) {
265
+ var idx = 0;
266
+ this.inputs().forEach(function (inp) {
267
+ var inpArray = inp instanceof common.WidgetArray ? inp.content() : [inp];
268
+ inpArray.forEach(function (inp2) {
269
+ if (scope) {
270
+ callback.call(scope, inp2, idx++);
271
+ }
272
+ else {
273
+ callback(inp2, idx++);
274
+ }
275
+ });
276
+ });
277
+ };
278
+ Form.prototype.inputsMap = function () {
279
+ var retVal = {};
280
+ this.inputs().forEach(function (inp) {
281
+ retVal[inp.name()] = inp;
282
+ });
283
+ return retVal;
284
+ };
285
+ Form.prototype.calcMaxColumns = function () {
286
+ var retVal = 0;
287
+ this.inputs().forEach(function (inputWidget) {
288
+ var inputWidgetArray = inputWidget instanceof common.WidgetArray ? inputWidget.content() : [inputWidget];
289
+ if (inputWidgetArray.length > retVal) {
290
+ retVal = inputWidgetArray.length;
291
+ }
292
+ });
293
+ return retVal;
294
+ };
295
+ Form.prototype.values = function (_) {
296
+ if (!arguments.length) {
297
+ var dataArr_1 = {};
298
+ this.inputsForEach(function (inp) {
299
+ var type = inp.type ? inp.type() : "text";
300
+ var value = inp.value();
301
+ if (value || !this.omitBlank()) {
302
+ switch (type) {
303
+ case "checkbox":
304
+ dataArr_1[inp.name()] = inp.value_exists() ? !!inp.value() : undefined;
305
+ break;
306
+ case "number":
307
+ var v = inp.value();
308
+ dataArr_1[inp.name()] = v === "" ? undefined : +v;
309
+ break;
310
+ case "text":
311
+ default:
312
+ dataArr_1[inp.name()] = inp.value_exists() ? inp.value() : undefined;
313
+ break;
314
+ }
315
+ }
316
+ }, this);
317
+ return dataArr_1;
318
+ }
319
+ else {
320
+ this.inputsForEach(function (inp) {
321
+ if (_[inp.name()]) {
322
+ inp.value(_[inp.name()]);
323
+ }
324
+ else if (this.omitBlank()) {
325
+ inp.value("");
326
+ }
327
+ }, this);
328
+ }
329
+ return this;
330
+ };
331
+ Form.prototype.submit = function () {
332
+ var isValid = true;
333
+ if (this.validate()) {
334
+ isValid = this.checkValidation();
335
+ }
336
+ if (!this.allowEmptyRequest() && !this.inputs().some(function (w) {
337
+ if (w._class.indexOf("WidgetArray") !== -1) {
338
+ return w.content().some(function (wa) {
339
+ return wa.hasValue();
340
+ });
341
+ }
342
+ return w.hasValue();
343
+ })) {
344
+ return;
345
+ }
346
+ this.click(isValid ? this.values() : null, null, isValid);
347
+ };
348
+ Form.prototype.clear = function () {
349
+ this.inputsForEach(function (inp) {
350
+ switch (inp.classID()) {
351
+ case "form_Slider":
352
+ if (inp.allowRange()) {
353
+ inp.value([inp.low(), inp.low()]).render();
354
+ }
355
+ else {
356
+ inp.value(inp.low()).render();
357
+ }
358
+ break;
359
+ case "form_CheckBox":
360
+ inp.value(false).render();
361
+ break;
362
+ case "form_Button":
363
+ /* skip */
364
+ break;
365
+ default:
366
+ inp.value(undefined).render();
367
+ break;
368
+ }
369
+ });
370
+ };
371
+ Form.prototype.checkValidation = function () {
372
+ var ret = true;
373
+ var msgArr = [];
374
+ this.inputsForEach(function (inp) {
375
+ if (!inp.isValid()) {
376
+ msgArr.push("'" + inp.label() + "'" + " value is invalid.");
377
+ }
378
+ });
379
+ if (msgArr.length > 0) {
380
+ alert(msgArr.join("\n"));
381
+ ret = false;
382
+ }
383
+ return ret;
384
+ };
385
+ Form.prototype.enter = function (domNode, element) {
386
+ _super.prototype.enter.call(this, domNode, element);
387
+ element.on("submit", function () {
388
+ common.d3Event().preventDefault();
389
+ });
390
+ this._placeholderElement.style("overflow", "auto");
391
+ var table = element
392
+ .append("table");
393
+ this.tbody = table.append("tbody");
394
+ this.tfoot = table.append("tfoot");
395
+ this.btntd = this.tfoot.append("tr").append("td")
396
+ .attr("colspan", 2);
397
+ var context = this;
398
+ this._controls = [
399
+ new Button()
400
+ .classed({ default: true })
401
+ .value("Submit")
402
+ .on("click", function () {
403
+ context.submit();
404
+ }, true),
405
+ new Button()
406
+ .value("Clear")
407
+ .on("click", function () {
408
+ context.clear();
409
+ }, true)
410
+ ];
411
+ var rightJust = context.btntd
412
+ .append("div")
413
+ .style("float", "right");
414
+ this._controls.forEach(function (w) {
415
+ var leftJust = rightJust
416
+ .append("span")
417
+ .style("float", "left");
418
+ w.target(leftJust.node()).render();
419
+ });
420
+ };
421
+ Form.prototype.update = function (domNode, element) {
422
+ _super.prototype.update.call(this, domNode, element);
423
+ this._maxCols = this.calcMaxColumns();
424
+ var context = this;
425
+ var rows = this.tbody.selectAll("tr").data(this.inputs());
426
+ rows.enter().append("tr")
427
+ .each(function (inputWidget, i) {
428
+ var element2 = common.select(this);
429
+ var inputWidgetArray = inputWidget instanceof common.WidgetArray ? inputWidget.content() : [inputWidget];
430
+ inputWidgetArray.forEach(function (inputWidget2, idx) {
431
+ element2.append("td")
432
+ .attr("class", "prompt");
433
+ var input = element2.append("td")
434
+ .attr("class", "input");
435
+ if (idx === inputWidgetArray.length - 1 && inputWidgetArray.length < context._maxCols) {
436
+ input.attr("colspan", (context._maxCols - inputWidgetArray.length + 1) * 2);
437
+ }
438
+ inputWidget2.target(input.node()).render();
439
+ if (inputWidget2 instanceof common.SVGWidget) {
440
+ var bbox = inputWidget2.element().node().getBBox();
441
+ input.style("height", bbox.height + "px");
442
+ inputWidget2.resize().render();
443
+ }
444
+ if (inputWidget2._inputElement instanceof Array) {
445
+ inputWidget2._inputElement.forEach(function (e) {
446
+ e.on("keyup.form", function (w) {
447
+ setTimeout(function () {
448
+ context._controls[0].disable(!context.allowEmptyRequest() && !context.inputs().some(function (w2) {
449
+ if (w2._class.indexOf("WidgetArray") !== -1) {
450
+ return w2.content().some(function (wa) {
451
+ return wa.hasValue();
452
+ });
453
+ }
454
+ return w2.hasValue();
455
+ }));
456
+ }, 100);
457
+ });
458
+ });
459
+ }
460
+ });
461
+ })
462
+ .merge(rows)
463
+ .each(function (inputWidget, i) {
464
+ var element2 = common.select(this);
465
+ var inputWidgetArray = inputWidget instanceof common.WidgetArray ? inputWidget.content() : [inputWidget];
466
+ inputWidgetArray.forEach(function (inputWidget2, idx) {
467
+ element2.select("td.prompt")
468
+ .text(inputWidget2.label() + ":");
469
+ });
470
+ });
471
+ rows.each(function (inputWidget, i) {
472
+ if (i === 0 && inputWidget.setFocus) {
473
+ inputWidget.setFocus();
474
+ }
475
+ });
476
+ rows.exit()
477
+ .each(function (inputWidget, i) {
478
+ var inputWidgetArray = inputWidget instanceof common.WidgetArray ? inputWidget.content() : [inputWidget];
479
+ inputWidgetArray.forEach(function (inputWidget2, idx) {
480
+ inputWidget2.target(null);
481
+ });
482
+ })
483
+ .remove();
484
+ this.tfoot
485
+ .style("display", this.showSubmit() ? "table-footer-group" : "none");
486
+ this.btntd
487
+ .attr("colspan", this._maxCols * 2);
488
+ // Disable Submit unless there is data
489
+ if (!this.allowEmptyRequest()) {
490
+ setTimeout(function () {
491
+ context._controls[0].disable(!context.allowEmptyRequest() && !context.inputs().some(function (w) {
492
+ if (w._class.indexOf("WidgetArray") !== -1) {
493
+ return w.content().some(function (wa) {
494
+ return wa.hasValue();
495
+ });
496
+ }
497
+ return w.hasValue();
498
+ }));
499
+ }, 100);
500
+ }
501
+ };
502
+ Form.prototype.exit = function (domNode, element) {
503
+ this.inputsForEach(function (input) { return input.target(null); });
504
+ _super.prototype.exit.call(this, domNode, element);
505
+ };
506
+ Form.prototype.click = function (row, col, sel) {
507
+ };
508
+ return Form;
509
+ }(common.HTMLWidget));
510
+ Form.prototype._class += " form_Form";
511
+ Form.prototype.publish("validate", true, "boolean", "Enable/Disable input validation");
512
+ Form.prototype.publish("inputs", [], "widgetArray", "Array of input widgets", null, { render: false });
513
+ Form.prototype.publish("showSubmit", true, "boolean", "Show Submit/Cancel Controls");
514
+ Form.prototype.publish("omitBlank", false, "boolean", "Drop Blank Fields From Submit");
515
+ Form.prototype.publish("allowEmptyRequest", false, "boolean", "Allow Blank Form to be Submitted");
511
516
 
512
- var Input = /** @class */ (function (_super) {
513
- __extends(Input, _super);
514
- function Input() {
515
- var _this = _super.call(this) || this;
516
- _this._inputElement = [];
517
- _this._labelElement = [];
518
- api.IInput.call(_this);
519
- _this._tag = "div";
520
- return _this;
521
- }
522
- Input.prototype.checked = function (_) {
523
- if (!arguments.length)
524
- return this._inputElement[0] ? this._inputElement[0].property("checked") : false;
525
- if (this._inputElement[0]) {
526
- this._inputElement[0].property("checked", _);
527
- }
528
- return this;
529
- };
530
- Input.prototype.enter = function (domNode, element) {
531
- _super.prototype.enter.call(this, domNode, element);
532
- this._labelElement[0] = element.append("label")
533
- .attr("for", this.id() + "_input")
534
- .style("visibility", this.inlineLabel_exists() ? "visible" : "hidden");
535
- var context = this;
536
- switch (this.type()) {
537
- case "button":
538
- this._inputElement[0] = element.append("button")
539
- .attr("id", this.id() + "_input");
540
- break;
541
- case "textarea":
542
- this._inputElement[0] = element.append("textarea")
543
- .attr("id", this.id() + "_input");
544
- break;
545
- default:
546
- this._inputElement[0] = element.append("input")
547
- .attr("id", this.id() + "_input")
548
- .attr("type", this.type());
549
- break;
550
- }
551
- this._inputElement.forEach(function (e, idx) {
552
- e.attr("name", context.name());
553
- e.on("click", function (w) {
554
- w.click(w);
555
- });
556
- e.on("blur", function (w) {
557
- w.blur(w);
558
- });
559
- e.on("change", function (w) {
560
- context.value([e.property("value")]);
561
- w.change(w, true);
562
- });
563
- e.on("keyup", function (w) {
564
- context.value([e.property("value")]);
565
- w.change(w, false);
566
- });
567
- });
568
- };
569
- Input.prototype.update = function (domNode, element) {
570
- _super.prototype.update.call(this, domNode, element);
571
- this._labelElement[0]
572
- .style("visibility", this.inlineLabel_exists() ? "visible" : "hidden")
573
- .text(this.inlineLabel());
574
- switch (this.type()) {
575
- case "button":
576
- this._inputElement[0].text(this.value());
577
- break;
578
- case "textarea":
579
- this._inputElement[0].property("value", this.value());
580
- break;
581
- default:
582
- this._inputElement[0].attr("type", this.type());
583
- this._inputElement[0].property("value", this.value());
584
- break;
585
- }
586
- };
587
- return Input;
588
- }(common.HTMLWidget));
589
- Input.prototype._class += " form_Input";
590
- Input.prototype.implements(api.IInput.prototype);
591
- Input.prototype.publish("type", "text", "set", "Input type", ["number", "button", "checkbox", "date", "text", "textarea", "search", "email", "time", "datetime", "hidden"]);
592
- Input.prototype.publish("inlineLabel", null, "string", "Input Label", null, { optional: true });
517
+ var Input = /** @class */ (function (_super) {
518
+ __extends(Input, _super);
519
+ function Input() {
520
+ var _this = _super.call(this) || this;
521
+ _this._inputElement = [];
522
+ _this._labelElement = [];
523
+ api.IInput.call(_this);
524
+ _this._tag = "div";
525
+ return _this;
526
+ }
527
+ Input.prototype.checked = function (_) {
528
+ if (!arguments.length)
529
+ return this._inputElement[0] ? this._inputElement[0].property("checked") : false;
530
+ if (this._inputElement[0]) {
531
+ this._inputElement[0].property("checked", _);
532
+ }
533
+ return this;
534
+ };
535
+ Input.prototype.enter = function (domNode, element) {
536
+ _super.prototype.enter.call(this, domNode, element);
537
+ this._labelElement[0] = element.append("label")
538
+ .attr("for", this.id() + "_input")
539
+ .style("visibility", this.inlineLabel_exists() ? "visible" : "hidden");
540
+ var context = this;
541
+ switch (this.type()) {
542
+ case "button":
543
+ this._inputElement[0] = element.append("button")
544
+ .attr("id", this.id() + "_input");
545
+ break;
546
+ case "textarea":
547
+ this._inputElement[0] = element.append("textarea")
548
+ .attr("id", this.id() + "_input");
549
+ break;
550
+ default:
551
+ this._inputElement[0] = element.append("input")
552
+ .attr("id", this.id() + "_input")
553
+ .attr("type", this.type());
554
+ break;
555
+ }
556
+ this._inputElement.forEach(function (e, idx) {
557
+ e.attr("name", context.name());
558
+ e.on("click", function (w) {
559
+ w.click(w);
560
+ });
561
+ e.on("blur", function (w) {
562
+ w.blur(w);
563
+ });
564
+ e.on("change", function (w) {
565
+ context.value([e.property("value")]);
566
+ w.change(w, true);
567
+ });
568
+ e.on("keyup", function (w) {
569
+ context.value([e.property("value")]);
570
+ w.change(w, false);
571
+ });
572
+ });
573
+ };
574
+ Input.prototype.update = function (domNode, element) {
575
+ _super.prototype.update.call(this, domNode, element);
576
+ this._labelElement[0]
577
+ .style("visibility", this.inlineLabel_exists() ? "visible" : "hidden")
578
+ .text(this.inlineLabel());
579
+ switch (this.type()) {
580
+ case "button":
581
+ this._inputElement[0].text(this.value());
582
+ break;
583
+ case "textarea":
584
+ this._inputElement[0].property("value", this.value());
585
+ break;
586
+ default:
587
+ this._inputElement[0].attr("type", this.type());
588
+ this._inputElement[0].property("value", this.value());
589
+ break;
590
+ }
591
+ };
592
+ return Input;
593
+ }(common.HTMLWidget));
594
+ Input.prototype._class += " form_Input";
595
+ Input.prototype.implements(api.IInput.prototype);
596
+ Input.prototype.publish("type", "text", "set", "Input type", ["number", "button", "checkbox", "date", "text", "textarea", "search", "email", "time", "datetime", "hidden"]);
597
+ Input.prototype.publish("inlineLabel", null, "string", "Input Label", null, { optional: true });
593
598
 
594
- var FieldForm = /** @class */ (function (_super) {
595
- __extends(FieldForm, _super);
596
- function FieldForm() {
597
- var _this = _super.call(this) || this;
598
- _this._tag = "form";
599
- return _this;
600
- }
601
- FieldForm.prototype.fields = function (_) {
602
- var retVal = _super.prototype.fields.apply(this, arguments);
603
- if (arguments.length) {
604
- var inpMap_1 = this.inputsMap();
605
- this.inputs(_.map(function (f) { return inpMap_1[f.id()] || new Input()
606
- .name(f.id())
607
- .label(f.label())
608
- .type(f.type()); }));
609
- }
610
- return retVal;
611
- };
612
- FieldForm.prototype.data = function (_) {
613
- if (!arguments.length)
614
- return _super.prototype.data.call(this);
615
- _super.prototype.data.call(this, _[0]);
616
- if (_[0]) {
617
- // Update input "name" with the __lparam ids ---
618
- var inputs = this.inputs();
619
- var __lparam = _[0][this.columns().length];
620
- var i = 0;
621
- for (var key in __lparam) {
622
- inputs[i].name(key);
623
- ++i;
624
- }
625
- }
626
- return this;
627
- };
628
- return FieldForm;
629
- }(Form));
630
- FieldForm.prototype._class += " form_FieldForm";
599
+ var FieldForm = /** @class */ (function (_super) {
600
+ __extends(FieldForm, _super);
601
+ function FieldForm() {
602
+ var _this = _super.call(this) || this;
603
+ _this._tag = "form";
604
+ return _this;
605
+ }
606
+ FieldForm.prototype.fields = function (_) {
607
+ var retVal = _super.prototype.fields.apply(this, arguments);
608
+ if (arguments.length) {
609
+ var inpMap_1 = this.inputsMap();
610
+ this.inputs(_.map(function (f) { return inpMap_1[f.id()] || new Input()
611
+ .name(f.id())
612
+ .label(f.label())
613
+ .type(f.type()); }));
614
+ }
615
+ return retVal;
616
+ };
617
+ FieldForm.prototype.data = function (_) {
618
+ if (!arguments.length)
619
+ return _super.prototype.data.call(this);
620
+ _super.prototype.data.call(this, _[0]);
621
+ if (_[0]) {
622
+ // Update input "name" with the __lparam ids ---
623
+ var inputs = this.inputs();
624
+ var __lparam = _[0][this.columns().length];
625
+ var i = 0;
626
+ for (var key in __lparam) {
627
+ inputs[i].name(key);
628
+ ++i;
629
+ }
630
+ }
631
+ return this;
632
+ };
633
+ return FieldForm;
634
+ }(Form));
635
+ FieldForm.prototype._class += " form_FieldForm";
631
636
 
632
- var InputRange = /** @class */ (function (_super) {
633
- __extends(InputRange, _super);
634
- function InputRange() {
635
- var _this = _super.call(this) || this;
636
- _this._inputElement = [];
637
- _this._labelElement = [];
638
- _this._rangeData = [];
639
- api.IInput.call(_this);
640
- _this._tag = "div";
641
- return _this;
642
- }
643
- InputRange.prototype.enter = function (domNode, element) {
644
- _super.prototype.enter.call(this, domNode, element);
645
- this._labelElement[0] = element.append("label")
646
- .attr("for", this.id() + "_input")
647
- .style("visibility", this.inlineLabel_exists() ? "visible" : "hidden");
648
- this._inputElement.push(element.append("input")
649
- .attr("id", this.id() + "_input_min")
650
- .attr("type", this.type()));
651
- this._inputElement.push(element.append("input")
652
- .attr("id", this.id() + "_input_max")
653
- .attr("type", this.type()));
654
- var context = this;
655
- this._inputElement.forEach(function (e, idx) {
656
- e.attr("name", context.name());
657
- e.on("click", function (w) {
658
- w.click(w);
659
- });
660
- e.on("blur", function (w) {
661
- w.blur(w);
662
- });
663
- e.on("change", function (w) {
664
- context._rangeData[idx] = e.property("value");
665
- context.value(context._rangeData);
666
- w.change(w, true);
667
- });
668
- });
669
- };
670
- InputRange.prototype.update = function (domNode, element) {
671
- _super.prototype.update.call(this, domNode, element);
672
- this._labelElement[0]
673
- .style("visibility", this.inlineLabel_exists() ? "visible" : "hidden")
674
- .text(this.inlineLabel());
675
- this._rangeData = this.value();
676
- this._inputElement.forEach(function (e, idx) {
677
- e
678
- .attr("type", this.type())
679
- .property("value", this._rangeData.length > idx ? this._rangeData[idx] : "");
680
- }, this);
681
- };
682
- return InputRange;
683
- }(common.HTMLWidget));
684
- InputRange.prototype._class += " form_InputRange";
685
- InputRange.prototype.implements(api.IInput.prototype);
686
- InputRange.prototype.publish("type", "text", "set", "InputRange type", ["number", "date", "text", "time", "datetime", "hidden"]);
687
- InputRange.prototype.publish("inlineLabel", null, "string", "InputRange Label", null, { optional: true });
688
- InputRange.prototype.publish("value", ["", ""], "array", "Input Current Value", null, { override: true });
637
+ var InputRange = /** @class */ (function (_super) {
638
+ __extends(InputRange, _super);
639
+ function InputRange() {
640
+ var _this = _super.call(this) || this;
641
+ _this._inputElement = [];
642
+ _this._labelElement = [];
643
+ _this._rangeData = [];
644
+ api.IInput.call(_this);
645
+ _this._tag = "div";
646
+ return _this;
647
+ }
648
+ InputRange.prototype.enter = function (domNode, element) {
649
+ _super.prototype.enter.call(this, domNode, element);
650
+ this._labelElement[0] = element.append("label")
651
+ .attr("for", this.id() + "_input")
652
+ .style("visibility", this.inlineLabel_exists() ? "visible" : "hidden");
653
+ this._inputElement.push(element.append("input")
654
+ .attr("id", this.id() + "_input_min")
655
+ .attr("type", this.type()));
656
+ this._inputElement.push(element.append("input")
657
+ .attr("id", this.id() + "_input_max")
658
+ .attr("type", this.type()));
659
+ var context = this;
660
+ this._inputElement.forEach(function (e, idx) {
661
+ e.attr("name", context.name());
662
+ e.on("click", function (w) {
663
+ w.click(w);
664
+ });
665
+ e.on("blur", function (w) {
666
+ w.blur(w);
667
+ });
668
+ e.on("change", function (w) {
669
+ context._rangeData[idx] = e.property("value");
670
+ context.value(context._rangeData);
671
+ w.change(w, true);
672
+ });
673
+ });
674
+ };
675
+ InputRange.prototype.update = function (domNode, element) {
676
+ _super.prototype.update.call(this, domNode, element);
677
+ this._labelElement[0]
678
+ .style("visibility", this.inlineLabel_exists() ? "visible" : "hidden")
679
+ .text(this.inlineLabel());
680
+ this._rangeData = this.value();
681
+ this._inputElement.forEach(function (e, idx) {
682
+ e
683
+ .attr("type", this.type())
684
+ .property("value", this._rangeData.length > idx ? this._rangeData[idx] : "");
685
+ }, this);
686
+ };
687
+ return InputRange;
688
+ }(common.HTMLWidget));
689
+ InputRange.prototype._class += " form_InputRange";
690
+ InputRange.prototype.implements(api.IInput.prototype);
691
+ InputRange.prototype.publish("type", "text", "set", "InputRange type", ["number", "date", "text", "time", "datetime", "hidden"]);
692
+ InputRange.prototype.publish("inlineLabel", null, "string", "InputRange Label", null, { optional: true });
693
+ InputRange.prototype.publish("value", ["", ""], "array", "Input Current Value", null, { override: true });
689
694
 
690
- var css_248z$1 = ".onoffswitch-checkbox{display:none}.onoffswitch{height:20px;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;width:100px}.onoffswitch-label{border:1px solid #999;cursor:pointer;display:block;height:20px;overflow:hidden}.onoffswitch-inner{display:block;position:relative;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;text-align:right;transition:all .3s ease-in 0s;width:100%}.onoffswitch-inner>.onoffswitch-onText{font-weight:700;left:-100%;position:absolute;text-align:left;transition:all .3s ease-in 0s;width:100%}.onoffswitch-switch{background:#fff;border:1px solid #999;bottom:0;display:block;left:4px;margin:-1px;position:absolute;right:78px;top:0;transition:all .3s ease-in 0s;width:20px}.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)}";
691
- styleInject(css_248z$1);
695
+ var css_248z$1 = ".onoffswitch-checkbox{display:none}.onoffswitch{height:20px;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;width:100px}.onoffswitch-label{border:1px solid #999;cursor:pointer;display:block;height:20px;overflow:hidden}.onoffswitch-inner{display:block;position:relative;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;text-align:right;transition:all .3s ease-in 0s;width:100%}.onoffswitch-inner>.onoffswitch-onText{font-weight:700;left:-100%;position:absolute;text-align:left;transition:all .3s ease-in 0s;width:100%}.onoffswitch-switch{background:#fff;border:1px solid #999;bottom:0;display:block;left:4px;margin:-1px;position:absolute;right:78px;top:0;transition:all .3s ease-in 0s;width:20px}.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)}";
696
+ styleInject(css_248z$1);
692
697
 
693
- var OnOff = /** @class */ (function (_super) {
694
- __extends(OnOff, _super);
695
- function OnOff() {
696
- var _this = _super.call(this) || this;
697
- _this._inputElement = [];
698
- api.IInput.call(_this);
699
- _this._tag = "div";
700
- return _this;
701
- }
702
- OnOff.prototype.enter = function (domNode, element) {
703
- _super.prototype.enter.call(this, domNode, element);
704
- element.classed("onoffswitch", true);
705
- var context = this;
706
- this._input = element.append("input")
707
- .attr("class", "onoffswitch-checkbox")
708
- .attr("type", "checkbox")
709
- .attr("id", this.id() + "_onOff")
710
- .on("click", function (w) {
711
- w.click(w);
712
- })
713
- .on("blur", function (w) {
714
- w.blur(w);
715
- })
716
- .on("change", function (w) {
717
- var vals = [];
718
- context._inputElement.forEach(function (d, idx) {
719
- if (d.property("checked")) {
720
- vals.push(d.property("value"));
721
- }
722
- });
723
- context.value(vals);
724
- w.change(w, true);
725
- });
726
- var label = element.append("label")
727
- .attr("class", "onoffswitch-label")
728
- .attr("for", this.id() + "_onOff");
729
- var inner = label.append("div")
730
- .attr("class", "onoffswitch-inner");
731
- inner.append("div")
732
- .attr("class", "onoffswitch-offText")
733
- .style("padding-right", (this.containerRadius() / 2) + "px")
734
- .text(this.offText());
735
- inner.append("div")
736
- .attr("class", "onoffswitch-onText")
737
- .style("padding-left", (this.containerRadius() / 2) + "px")
738
- .style("width", "calc(100% - ".concat((this.containerRadius() / 2), "px)"))
739
- .text(this.onText());
740
- label.append("div")
741
- .attr("class", "onoffswitch-switch");
742
- };
743
- OnOff.prototype.update = function (domNode, element) {
744
- _super.prototype.update.call(this, domNode, element);
745
- this._input
746
- .attr("name", this.name());
747
- element
748
- .style("margin-left", this.marginLeft() + "px")
749
- .style("margin-bottom", this.marginBottom() + "px")
750
- .style("width", this.minWidth() + "px");
751
- var _switch_size = this.minHeight() - (this.gutter() * 4);
752
- element.select(".onoffswitch-switch")
753
- .style("height", _switch_size + "px")
754
- .style("width", _switch_size + "px")
755
- .style("top", (this.gutter() * 2) + 1 + "px")
756
- .style("border-radius", this.switchRadius() + "px");
757
- element.select(".onoffswitch-inner")
758
- .style("min-height", this.minHeight() + "px");
759
- element.select(".onoffswitch-label")
760
- .style("border-radius", this.containerRadius() + "px");
761
- element.select(".onoffswitch-offText")
762
- .style("color", this.offFontColor())
763
- .style("background-color", this.offColor());
764
- element.select(".onoffswitch-onText")
765
- .style("color", this.onFontColor())
766
- .style("background-color", this.onColor());
767
- };
768
- return OnOff;
769
- }(common.HTMLWidget));
770
- OnOff.prototype._class += " form_OnOff";
771
- OnOff.prototype.implements(api.IInput.prototype);
772
- OnOff.prototype.publish("marginLeft", 0, "number", "Margin left of OnOff");
773
- OnOff.prototype.publish("marginBottom", 0, "number", "Margin bottom of OnOff");
774
- OnOff.prototype.publish("minWidth", 100, "number", "Minimum width of OnOff (pixels)");
775
- OnOff.prototype.publish("minHeight", 20, "number", "Minimum height of OnOff (pixels)");
776
- OnOff.prototype.publish("gutter", 1, "number", "Space between switch and border of OnOff (pixels)");
777
- OnOff.prototype.publish("onText", "Save", "string", "Text to display when 'ON'");
778
- OnOff.prototype.publish("offText", "Properties", "string", "Text to display when 'OFF'");
779
- OnOff.prototype.publish("switchRadius", 10, "number", "Border radius of switch (pixels)");
780
- OnOff.prototype.publish("containerRadius", 10, "number", "Border radius of OnOff (pixels)");
781
- OnOff.prototype.publish("onColor", "#2ecc71", "html-color", "Background color when 'ON'");
782
- OnOff.prototype.publish("offColor", "#ecf0f1", "html-color", "Background color when 'OFF'");
783
- OnOff.prototype.publish("onFontColor", "#2c3e50", "html-color", "Font color when 'ON'");
784
- OnOff.prototype.publish("offFontColor", "#7f8c8d", "html-color", "Font color when 'OFF'");
698
+ var OnOff = /** @class */ (function (_super) {
699
+ __extends(OnOff, _super);
700
+ function OnOff() {
701
+ var _this = _super.call(this) || this;
702
+ _this._inputElement = [];
703
+ api.IInput.call(_this);
704
+ _this._tag = "div";
705
+ return _this;
706
+ }
707
+ OnOff.prototype.enter = function (domNode, element) {
708
+ _super.prototype.enter.call(this, domNode, element);
709
+ element.classed("onoffswitch", true);
710
+ var context = this;
711
+ this._input = element.append("input")
712
+ .attr("class", "onoffswitch-checkbox")
713
+ .attr("type", "checkbox")
714
+ .attr("id", this.id() + "_onOff")
715
+ .on("click", function (w) {
716
+ w.click(w);
717
+ })
718
+ .on("blur", function (w) {
719
+ w.blur(w);
720
+ })
721
+ .on("change", function (w) {
722
+ var vals = [];
723
+ context._inputElement.forEach(function (d, idx) {
724
+ if (d.property("checked")) {
725
+ vals.push(d.property("value"));
726
+ }
727
+ });
728
+ context.value(vals);
729
+ w.change(w, true);
730
+ });
731
+ var label = element.append("label")
732
+ .attr("class", "onoffswitch-label")
733
+ .attr("for", this.id() + "_onOff");
734
+ var inner = label.append("div")
735
+ .attr("class", "onoffswitch-inner");
736
+ inner.append("div")
737
+ .attr("class", "onoffswitch-offText")
738
+ .style("padding-right", (this.containerRadius() / 2) + "px")
739
+ .text(this.offText());
740
+ inner.append("div")
741
+ .attr("class", "onoffswitch-onText")
742
+ .style("padding-left", (this.containerRadius() / 2) + "px")
743
+ .style("width", "calc(100% - ".concat((this.containerRadius() / 2), "px)"))
744
+ .text(this.onText());
745
+ label.append("div")
746
+ .attr("class", "onoffswitch-switch");
747
+ };
748
+ OnOff.prototype.update = function (domNode, element) {
749
+ _super.prototype.update.call(this, domNode, element);
750
+ this._input
751
+ .attr("name", this.name());
752
+ element
753
+ .style("margin-left", this.marginLeft() + "px")
754
+ .style("margin-bottom", this.marginBottom() + "px")
755
+ .style("width", this.minWidth() + "px");
756
+ var _switch_size = this.minHeight() - (this.gutter() * 4);
757
+ element.select(".onoffswitch-switch")
758
+ .style("height", _switch_size + "px")
759
+ .style("width", _switch_size + "px")
760
+ .style("top", (this.gutter() * 2) + 1 + "px")
761
+ .style("border-radius", this.switchRadius() + "px");
762
+ element.select(".onoffswitch-inner")
763
+ .style("min-height", this.minHeight() + "px");
764
+ element.select(".onoffswitch-label")
765
+ .style("border-radius", this.containerRadius() + "px");
766
+ element.select(".onoffswitch-offText")
767
+ .style("color", this.offFontColor())
768
+ .style("background-color", this.offColor());
769
+ element.select(".onoffswitch-onText")
770
+ .style("color", this.onFontColor())
771
+ .style("background-color", this.onColor());
772
+ };
773
+ return OnOff;
774
+ }(common.HTMLWidget));
775
+ OnOff.prototype._class += " form_OnOff";
776
+ OnOff.prototype.implements(api.IInput.prototype);
777
+ OnOff.prototype.publish("marginLeft", 0, "number", "Margin left of OnOff");
778
+ OnOff.prototype.publish("marginBottom", 0, "number", "Margin bottom of OnOff");
779
+ OnOff.prototype.publish("minWidth", 100, "number", "Minimum width of OnOff (pixels)");
780
+ OnOff.prototype.publish("minHeight", 20, "number", "Minimum height of OnOff (pixels)");
781
+ OnOff.prototype.publish("gutter", 1, "number", "Space between switch and border of OnOff (pixels)");
782
+ OnOff.prototype.publish("onText", "Save", "string", "Text to display when 'ON'");
783
+ OnOff.prototype.publish("offText", "Properties", "string", "Text to display when 'OFF'");
784
+ OnOff.prototype.publish("switchRadius", 10, "number", "Border radius of switch (pixels)");
785
+ OnOff.prototype.publish("containerRadius", 10, "number", "Border radius of OnOff (pixels)");
786
+ OnOff.prototype.publish("onColor", "#2ecc71", "html-color", "Background color when 'ON'");
787
+ OnOff.prototype.publish("offColor", "#ecf0f1", "html-color", "Background color when 'OFF'");
788
+ OnOff.prototype.publish("onFontColor", "#2c3e50", "html-color", "Font color when 'ON'");
789
+ OnOff.prototype.publish("offFontColor", "#7f8c8d", "html-color", "Font color when 'OFF'");
785
790
 
786
- var Radio = /** @class */ (function (_super) {
787
- __extends(Radio, _super);
788
- function Radio() {
789
- var _this = _super.call(this) || this;
790
- _this._inputElement = [];
791
- api.IInput.call(_this);
792
- _this._tag = "div";
793
- return _this;
794
- }
795
- Radio.prototype.enter = function (domNode, element) {
796
- _super.prototype.enter.call(this, domNode, element);
797
- var context = this;
798
- var radioContainer = element.append("ul");
799
- if (!this.selectOptions().length) {
800
- this.selectOptions().push(""); // create an empty radio if we using .value and not selectOptions array
801
- }
802
- this.selectOptions().forEach(function (val, idx) {
803
- context._inputElement[idx] = radioContainer.append("li").append("input").attr("type", "radio");
804
- context._inputElement[idx].node().insertAdjacentHTML("afterend", "<text>" + val + "</text>");
805
- });
806
- this._inputElement.forEach(function (e, idx) {
807
- e.attr("name", context.name());
808
- e.on("click", function (w) {
809
- w.click(w);
810
- });
811
- e.on("blur", function (w) {
812
- w.blur(w);
813
- });
814
- e.on("change", function (w) {
815
- context.value([e.property("value")]);
816
- w.change(w, true);
817
- });
818
- });
819
- };
820
- Radio.prototype.update = function (domNode, element) {
821
- _super.prototype.update.call(this, domNode, element);
822
- var context = this;
823
- this._inputElement.forEach(function (e, idx) {
824
- e.property("value", context.selectOptions()[idx]);
825
- if (context.value().indexOf(context.selectOptions()[idx]) !== -1 && context.value() !== "false") {
826
- e.property("checked", true);
827
- }
828
- else {
829
- e.property("checked", false);
830
- }
831
- });
832
- };
833
- return Radio;
834
- }(common.HTMLWidget));
835
- Radio.prototype._class += " form_Radio";
836
- Radio.prototype.implements(api.IInput.prototype);
837
- Radio.prototype.publish("selectOptions", [], "array", "Array of options used to fill a dropdown list");
791
+ var Radio = /** @class */ (function (_super) {
792
+ __extends(Radio, _super);
793
+ function Radio() {
794
+ var _this = _super.call(this) || this;
795
+ _this._inputElement = [];
796
+ api.IInput.call(_this);
797
+ _this._tag = "div";
798
+ return _this;
799
+ }
800
+ Radio.prototype.enter = function (domNode, element) {
801
+ _super.prototype.enter.call(this, domNode, element);
802
+ var context = this;
803
+ var radioContainer = element.append("ul");
804
+ if (!this.selectOptions().length) {
805
+ this.selectOptions().push(""); // create an empty radio if we using .value and not selectOptions array
806
+ }
807
+ this.selectOptions().forEach(function (val, idx) {
808
+ context._inputElement[idx] = radioContainer.append("li").append("input").attr("type", "radio");
809
+ context._inputElement[idx].node().insertAdjacentHTML("afterend", "<text>" + val + "</text>");
810
+ });
811
+ this._inputElement.forEach(function (e, idx) {
812
+ e.attr("name", context.name());
813
+ e.on("click", function (w) {
814
+ w.click(w);
815
+ });
816
+ e.on("blur", function (w) {
817
+ w.blur(w);
818
+ });
819
+ e.on("change", function (w) {
820
+ context.value([e.property("value")]);
821
+ w.change(w, true);
822
+ });
823
+ });
824
+ };
825
+ Radio.prototype.update = function (domNode, element) {
826
+ _super.prototype.update.call(this, domNode, element);
827
+ var context = this;
828
+ this._inputElement.forEach(function (e, idx) {
829
+ e.property("value", context.selectOptions()[idx]);
830
+ if (context.value().indexOf(context.selectOptions()[idx]) !== -1 && context.value() !== "false") {
831
+ e.property("checked", true);
832
+ }
833
+ else {
834
+ e.property("checked", false);
835
+ }
836
+ });
837
+ };
838
+ return Radio;
839
+ }(common.HTMLWidget));
840
+ Radio.prototype._class += " form_Radio";
841
+ Radio.prototype.implements(api.IInput.prototype);
842
+ Radio.prototype.publish("selectOptions", [], "array", "Array of options used to fill a dropdown list");
838
843
 
839
- var Range = /** @class */ (function (_super) {
840
- __extends(Range, _super);
841
- function Range() {
842
- var _this = _super.call(this) || this;
843
- _this._inputElement = [];
844
- api.IInput.call(_this);
845
- _this._tag = "div";
846
- return _this;
847
- }
848
- Range.prototype.enter = function (domNode, element) {
849
- _super.prototype.enter.call(this, domNode, element);
850
- var context = this;
851
- this._inputElement[0] = element.append("input").attr("type", "range");
852
- this._inputElement[1] = element.append("input").attr("type", "number");
853
- this._inputElement.forEach(function (e, idx) {
854
- e.attr("name", context.name());
855
- e.on("click", function (w) {
856
- w.click(w);
857
- });
858
- e.on("blur", function (w) {
859
- w.blur(w);
860
- });
861
- e.on("change", function (w) {
862
- if (idx === 0) {
863
- context._inputElement[1].property("value", common.rgb(context._inputElement[0].property("value")).toString());
864
- context.value(context._inputElement[0].property("value"));
865
- }
866
- else {
867
- context._inputElement[0].property("value", context._inputElement[1].property("value"));
868
- context.value(common.rgb(context._inputElement[1].property("value")).toString());
869
- }
870
- w.change(w, true);
871
- });
872
- });
873
- };
874
- Range.prototype.update = function (domNode, element) {
875
- _super.prototype.update.call(this, domNode, element);
876
- this._inputElement[0].attr("type", "range");
877
- this._inputElement[0].property("value", this.value());
878
- this._inputElement[0].attr("min", this.low());
879
- this._inputElement[0].attr("max", this.high());
880
- this._inputElement[0].attr("step", this.step());
881
- this._inputElement[1].attr("type", "number");
882
- this._inputElement[1].property("value", this.value());
883
- this._inputElement[1].attr("min", this.low());
884
- this._inputElement[1].attr("max", this.high());
885
- this._inputElement[1].attr("step", this.step());
886
- };
887
- Range.prototype.insertSelectOptions = function (optionsArr) {
888
- var optionHTML = "";
889
- if (optionsArr.length > 0) {
890
- optionsArr.forEach(function (opt) {
891
- var val = (opt instanceof Array ? opt[0] : opt);
892
- var text = (opt instanceof Array ? (opt[1] ? opt[1] : opt[0]) : opt);
893
- optionHTML += "<option value='" + val + "'>" + text + "</option>";
894
- });
895
- }
896
- else {
897
- optionHTML += "<option>selectOptions not set</option>";
898
- }
899
- this._inputElement[0].html(optionHTML);
900
- };
901
- return Range;
902
- }(common.HTMLWidget));
903
- Range.prototype._class += " form_Range";
904
- Range.prototype.implements(api.IInput.prototype);
905
- Range.prototype.publish("type", "text", "set", "Input type", ["html-color", "number", "checkbox", "button", "select", "textarea", "date", "text", "range", "search", "email", "time", "datetime"]);
906
- Range.prototype.publish("selectOptions", [], "array", "Array of options used to fill a dropdown list");
907
- Range.prototype.publish("low", null, "number", "Minimum value for Range input");
908
- Range.prototype.publish("high", null, "number", "Maximum value for Range input");
909
- Range.prototype.publish("step", null, "number", "Step value for Range input");
844
+ var Range = /** @class */ (function (_super) {
845
+ __extends(Range, _super);
846
+ function Range() {
847
+ var _this = _super.call(this) || this;
848
+ _this._inputElement = [];
849
+ api.IInput.call(_this);
850
+ _this._tag = "div";
851
+ return _this;
852
+ }
853
+ Range.prototype.enter = function (domNode, element) {
854
+ _super.prototype.enter.call(this, domNode, element);
855
+ var context = this;
856
+ this._inputElement[0] = element.append("input").attr("type", "range");
857
+ this._inputElement[1] = element.append("input").attr("type", "number");
858
+ this._inputElement.forEach(function (e, idx) {
859
+ e.attr("name", context.name());
860
+ e.on("click", function (w) {
861
+ w.click(w);
862
+ });
863
+ e.on("blur", function (w) {
864
+ w.blur(w);
865
+ });
866
+ e.on("change", function (w) {
867
+ if (idx === 0) {
868
+ context._inputElement[1].property("value", common.rgb(context._inputElement[0].property("value")).toString());
869
+ context.value(context._inputElement[0].property("value"));
870
+ }
871
+ else {
872
+ context._inputElement[0].property("value", context._inputElement[1].property("value"));
873
+ context.value(common.rgb(context._inputElement[1].property("value")).toString());
874
+ }
875
+ w.change(w, true);
876
+ });
877
+ });
878
+ };
879
+ Range.prototype.update = function (domNode, element) {
880
+ _super.prototype.update.call(this, domNode, element);
881
+ this._inputElement[0].attr("type", "range");
882
+ this._inputElement[0].property("value", this.value());
883
+ this._inputElement[0].attr("min", this.low());
884
+ this._inputElement[0].attr("max", this.high());
885
+ this._inputElement[0].attr("step", this.step());
886
+ this._inputElement[1].attr("type", "number");
887
+ this._inputElement[1].property("value", this.value());
888
+ this._inputElement[1].attr("min", this.low());
889
+ this._inputElement[1].attr("max", this.high());
890
+ this._inputElement[1].attr("step", this.step());
891
+ };
892
+ Range.prototype.insertSelectOptions = function (optionsArr) {
893
+ var optionHTML = "";
894
+ if (optionsArr.length > 0) {
895
+ optionsArr.forEach(function (opt) {
896
+ var val = (opt instanceof Array ? opt[0] : opt);
897
+ var text = (opt instanceof Array ? (opt[1] ? opt[1] : opt[0]) : opt);
898
+ optionHTML += "<option value='" + val + "'>" + text + "</option>";
899
+ });
900
+ }
901
+ else {
902
+ optionHTML += "<option>selectOptions not set</option>";
903
+ }
904
+ this._inputElement[0].html(optionHTML);
905
+ };
906
+ return Range;
907
+ }(common.HTMLWidget));
908
+ Range.prototype._class += " form_Range";
909
+ Range.prototype.implements(api.IInput.prototype);
910
+ Range.prototype.publish("type", "text", "set", "Input type", ["html-color", "number", "checkbox", "button", "select", "textarea", "date", "text", "range", "search", "email", "time", "datetime"]);
911
+ Range.prototype.publish("selectOptions", [], "array", "Array of options used to fill a dropdown list");
912
+ Range.prototype.publish("low", null, "number", "Minimum value for Range input");
913
+ Range.prototype.publish("high", null, "number", "Maximum value for Range input");
914
+ Range.prototype.publish("step", null, "number", "Step value for Range input");
910
915
 
911
- var Select = /** @class */ (function (_super) {
912
- __extends(Select, _super);
913
- function Select() {
914
- var _this = _super.call(this) || this;
915
- _this._inputElement = [];
916
- api.IInput.call(_this);
917
- _this._tag = "div";
918
- return _this;
919
- }
920
- Select.prototype.enter = function (domNode, element) {
921
- _super.prototype.enter.call(this, domNode, element);
922
- var context = this;
923
- this._inputElement[0] = element.append("select")
924
- .attr("name", this.name())
925
- .on("click", function (w) {
926
- w.click(w);
927
- })
928
- .on("blur", function (w) {
929
- w.blur(w);
930
- })
931
- .on("change", function (w) {
932
- context.value([context._inputElement[0].property("value")]);
933
- w.change(w, true);
934
- });
935
- };
936
- Select.prototype.update = function (domNode, element) {
937
- _super.prototype.update.call(this, domNode, element);
938
- this.insertSelectOptions(this.selectOptions());
939
- this._inputElement[0]
940
- .property("value", this.value())
941
- .style("max-width", this.maxWidth_exists() ? this.maxWidth() + "px" : null);
942
- };
943
- Select.prototype.insertSelectOptions = function (optionsArr) {
944
- var optionHTML = "";
945
- if (optionsArr.length > 0) {
946
- optionsArr.forEach(function (opt) {
947
- var val = (opt instanceof Array ? opt[0] : opt);
948
- var text = (opt instanceof Array ? (opt[1] ? opt[1] : opt[0]) : opt);
949
- optionHTML += "<option value='" + val + "'>" + text + "</option>";
950
- });
951
- }
952
- else {
953
- optionHTML += "<option>selectOptions not set</option>";
954
- }
955
- this._inputElement[0].html(optionHTML);
956
- };
957
- return Select;
958
- }(common.HTMLWidget));
959
- Select.prototype._class += " form_Select";
960
- Select.prototype.implements(api.IInput.prototype);
961
- Select.prototype.publish("selectOptions", [], "array", "Array of options used to fill a dropdown list");
962
- Select.prototype.publish("maxWidth", 120, "number", "Width", null, { optional: true });
916
+ var Select = /** @class */ (function (_super) {
917
+ __extends(Select, _super);
918
+ function Select() {
919
+ var _this = _super.call(this) || this;
920
+ _this._inputElement = [];
921
+ api.IInput.call(_this);
922
+ _this._tag = "div";
923
+ return _this;
924
+ }
925
+ Select.prototype.enter = function (domNode, element) {
926
+ _super.prototype.enter.call(this, domNode, element);
927
+ var context = this;
928
+ this._inputElement[0] = element.append("select")
929
+ .attr("name", this.name())
930
+ .on("click", function (w) {
931
+ w.click(w);
932
+ })
933
+ .on("blur", function (w) {
934
+ w.blur(w);
935
+ })
936
+ .on("change", function (w) {
937
+ context.value([context._inputElement[0].property("value")]);
938
+ w.change(w, true);
939
+ });
940
+ };
941
+ Select.prototype.update = function (domNode, element) {
942
+ _super.prototype.update.call(this, domNode, element);
943
+ this.insertSelectOptions(this.selectOptions());
944
+ this._inputElement[0]
945
+ .property("value", this.value())
946
+ .style("max-width", this.maxWidth_exists() ? this.maxWidth() + "px" : null);
947
+ };
948
+ Select.prototype.insertSelectOptions = function (optionsArr) {
949
+ var optionHTML = "";
950
+ if (optionsArr.length > 0) {
951
+ optionsArr.forEach(function (opt) {
952
+ var val = (opt instanceof Array ? opt[0] : opt);
953
+ var text = (opt instanceof Array ? (opt[1] ? opt[1] : opt[0]) : opt);
954
+ optionHTML += "<option value='" + val + "'>" + text + "</option>";
955
+ });
956
+ }
957
+ else {
958
+ optionHTML += "<option>selectOptions not set</option>";
959
+ }
960
+ this._inputElement[0].html(optionHTML);
961
+ };
962
+ return Select;
963
+ }(common.HTMLWidget));
964
+ Select.prototype._class += " form_Select";
965
+ Select.prototype.implements(api.IInput.prototype);
966
+ Select.prototype.publish("selectOptions", [], "array", "Array of options used to fill a dropdown list");
967
+ Select.prototype.publish("maxWidth", 120, "number", "Width", null, { optional: true });
963
968
 
964
- var css_248z = ".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{stroke-width:50px;stroke:transparent;cursor:crosshair;pointer-events:stroke}.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}";
965
- styleInject(css_248z);
969
+ var css_248z = ".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{stroke-width:50px;stroke:transparent;cursor:crosshair;pointer-events:stroke}.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}";
970
+ styleInject(css_248z);
966
971
 
967
- var Slider = /** @class */ (function (_super) {
968
- __extends(Slider, _super);
969
- function Slider() {
970
- var _this = _super.call(this) || this;
971
- _this.handleLeftPos = 0;
972
- _this.handleRightPos = 0;
973
- _this.handlePath = function (d) {
974
- var e = +(d === "r");
975
- var x = e ? 1 : -1;
976
- var xOffset = this.allowRange() ? 0.5 : 0.0;
977
- var y = 18;
978
- var retVal = "M" + (xOffset * x) + "," + y +
979
- "A6,6 0 0 " + e + " " + (6.5 * x) + "," + (y + 6) +
980
- "V" + (2 * y - 6) +
981
- "A6,6 0 0 " + e + " " + (xOffset * x) + "," + (2 * y);
982
- if (this.allowRange()) {
983
- retVal += "Z" +
984
- "M" + (2.5 * x) + "," + (y + 8) +
985
- "V" + (2 * y - 8) +
986
- "M" + (4.5 * x) + "," + (y + 8) +
987
- "V" + (2 * y - 8);
988
- }
989
- else {
990
- retVal += "M" + (1 * x) + "," + (y + 8) +
991
- "V" + (2 * y - 8);
992
- }
993
- return retVal;
994
- };
995
- api.IInput.call(_this);
996
- return _this;
997
- }
998
- Slider.prototype.enter = function (domNode, element) {
999
- var _this = this;
1000
- _super.prototype.enter.call(this, domNode, element);
1001
- this.resize({ width: this.width(), height: 50 });
1002
- this.xScale = common.scaleLinear()
1003
- .clamp(true);
1004
- this.slider = element.append("g")
1005
- .attr("class", "slider");
1006
- if (this.low() === null && this.high() === null) {
1007
- if (this.lowDatetime() !== null && this.highDatetime() !== null) {
1008
- var time_parser = common.timeParse(this.timePattern() ? this.timePattern() : "%Q");
1009
- this.low(time_parser(this.lowDatetime()).getTime());
1010
- this.high(time_parser(this.highDatetime()).getTime());
1011
- }
1012
- }
1013
- this.slider.append("line")
1014
- .attr("class", "track")
1015
- .select(function () { return this.parentNode.appendChild(this.cloneNode(true)); })
1016
- .attr("class", "track-inset")
1017
- .select(function () { return this.parentNode.appendChild(this.cloneNode(true)); })
1018
- .attr("class", "track-overlay")
1019
- .call(common.drag()
1020
- .on("start", function () {
1021
- var event = common.d3Event();
1022
- _this.moveStartPos = event.x;
1023
- _this.handleLeftStartPos = _this.handleLeftPos;
1024
- _this.handleRightStartPos = _this.handleRightPos;
1025
- if (_this.allowRange() && _this.handleLeftPos <= event.x && event.x <= _this.handleRightPos) {
1026
- _this.moveMode = "both";
1027
- }
1028
- else if (Math.abs(event.x - _this.handleLeftPos) < Math.abs(event.x - _this.handleRightPos)) {
1029
- _this.moveMode = "left";
1030
- }
1031
- else {
1032
- _this.moveMode = "right";
1033
- }
1034
- _this.moveHandleTo(event.x);
1035
- })
1036
- .on("drag", function () {
1037
- _this.moveHandleTo(common.d3Event().x);
1038
- })
1039
- .on("end", function () {
1040
- _this.moveHandleTo(common.d3Event().x);
1041
- _this.data([[_this.xScale.invert(_this.handleLeftPos), _this.xScale.invert(_this.handleRightPos)]]);
1042
- _this.checkChangedValue();
1043
- }));
1044
- this.slider.insert("g", ".track-overlay")
1045
- .attr("class", "ticks")
1046
- .attr("transform", "translate(0, ".concat(this.fontSize() + (this.tickHeight() / 2), ")"));
1047
- this.handleRight = this.slider.insert("path", ".track-overlay")
1048
- .attr("class", "handle");
1049
- this.handleLeft = this.slider.insert("path", ".track-overlay")
1050
- .attr("class", "handle");
1051
- };
1052
- Slider.prototype.update = function (domNode, element) {
1053
- _super.prototype.update.call(this, domNode, element);
1054
- var context = this;
1055
- this.xScale
1056
- .domain([this.low(), this.high()])
1057
- .range([0, this.width() - this.padding() * 2]);
1058
- this.slider
1059
- .attr("transform", "translate(" + (-this.width() / 2 + this.padding()) + "," + 0 + ")");
1060
- this.slider.selectAll("line.track,line.track-inset,line.track-overlay")
1061
- .attr("x1", this.xScale.range()[0])
1062
- .attr("x2", this.xScale.range()[1]);
1063
- var x_distance = (this.width() - (this.padding() * 2)) / (this.tickCount() - 1);
1064
- var tick_text_arr = [];
1065
- if (this.tickDateFormat() !== null && this.timePattern() !== null) {
1066
- var Q_parser = common.timeParse("%Q");
1067
- var time_formatter = common.timeFormat(this.tickDateFormat());
1068
- var time_segment = (this.high() - this.low()) / (this.tickCount() - 1);
1069
- for (var i = 0; i < this.tickCount(); i++) {
1070
- var date_to_parse = "" + (this.low() + (time_segment * i));
1071
- var parsed_date = Q_parser(date_to_parse);
1072
- tick_text_arr.push(time_formatter(parsed_date));
1073
- }
1074
- }
1075
- else {
1076
- var value_formatter = common.format(this.tickValueFormat());
1077
- var value_segment = (this.high() - this.low()) / (this.tickCount() - 1);
1078
- for (var i = 0; i < this.tickCount(); i++) {
1079
- var tick_value = this.low() + (value_segment * i);
1080
- tick_text_arr.push(value_formatter(tick_value));
1081
- }
1082
- }
1083
- var tickText = this.slider.selectAll("g.tick").data(tick_text_arr);
1084
- var tickTextEnter = tickText.enter().append("g").attr("class", "tick");
1085
- tickTextEnter.append("text").attr("class", "tick-text");
1086
- tickTextEnter.append("line").attr("class", "tick-line");
1087
- tickTextEnter
1088
- .merge(tickText)
1089
- .each(function (d, i) {
1090
- var x = x_distance * i;
1091
- common.select(this).select("text.tick-text")
1092
- .style("font-size", context.fontSize())
1093
- .attr("x", function () {
1094
- if (i === 0)
1095
- return x - 2;
1096
- return i === context.tickCount() - 1 ? x + 2 : x;
1097
- })
1098
- .attr("y", context.tickHeight() + (context.tickOffset() / 2) + context.fontSize())
1099
- .attr("text-basline", "text-before-edge")
1100
- .attr("text-anchor", function () {
1101
- if (i === 0)
1102
- return "start";
1103
- return i === context.tickCount() - 1 ? "end" : "middle";
1104
- })
1105
- .text(function () { return d; });
1106
- common.select(this).select("line.tick-line")
1107
- .attr("x1", x)
1108
- .attr("x2", x)
1109
- .attr("y1", context.tickOffset() - 1)
1110
- .attr("y2", context.tickOffset() + context.tickHeight())
1111
- .style("stroke", "#000")
1112
- .style("stroke-width", 1);
1113
- });
1114
- this.slider.node().appendChild(this.handleRight.node());
1115
- this.slider.node().appendChild(this.handleLeft.node());
1116
- this.handleLeftPos = this.lowPos();
1117
- this.handleRightPos = this.highPos();
1118
- this.updateHandles();
1119
- this.checkChangedValue();
1120
- };
1121
- Slider.prototype.checkChangedValue = function () {
1122
- if (this.prevValue !== this.value() && typeof this.prevValue !== "undefined") {
1123
- this.change(this);
1124
- }
1125
- this.prevValue = this.value();
1126
- };
1127
- Slider.prototype.updateHandles = function () {
1128
- var _this = this;
1129
- this.handleLeft
1130
- .attr("transform", "translate(".concat(this.handleLeftPos, ", -28)"))
1131
- .attr("d", function (d) { return _this.handlePath("l"); });
1132
- this.handleRight
1133
- .attr("transform", "translate(".concat(this.handleRightPos, ", -28)"))
1134
- .attr("d", function (d) { return _this.handlePath("r"); });
1135
- };
1136
- Slider.prototype.lowPos = function () {
1137
- var data = [[this.low(), this.high()]];
1138
- if (this.data().length > 0 && typeof this.data()[0][0] === "number" && typeof this.data()[0][1] === "number") {
1139
- data = this.data();
1140
- }
1141
- return this.xScale(data[0][0]);
1142
- };
1143
- Slider.prototype.highPos = function () {
1144
- var data = [[this.low(), this.high()]];
1145
- if (this.data().length > 0 && typeof this.data()[0][0] === "number" && typeof this.data()[0][1] === "number") {
1146
- data = this.data();
1147
- }
1148
- return this.xScale(data[0][this.allowRange() ? 1 : 0]);
1149
- };
1150
- Slider.prototype.moveHandleTo = function (pos) {
1151
- if (this.allowRange()) {
1152
- switch (this.moveMode) {
1153
- case "both":
1154
- this.handleLeftPos = this.handleLeftStartPos + pos - this.moveStartPos;
1155
- this.handleRightPos = this.handleRightStartPos + pos - this.moveStartPos;
1156
- break;
1157
- case "left":
1158
- this.handleLeftPos = pos;
1159
- if (this.handleLeftPos > this.handleRightPos) {
1160
- this.handleRightPos = this.handleLeftPos;
1161
- }
1162
- break;
1163
- case "right":
1164
- this.handleRightPos = pos;
1165
- if (this.handleRightPos < this.handleLeftPos) {
1166
- this.handleLeftPos = this.handleRightPos;
1167
- }
1168
- break;
1169
- }
1170
- }
1171
- else {
1172
- this.handleLeftPos = this.handleRightPos = pos;
1173
- }
1174
- this.handleLeftPos = this.constrain(this.handleLeftPos);
1175
- this.handleRightPos = this.constrain(this.handleRightPos);
1176
- this.value(this.allowRange() ? [this.xScale.invert(this.handleLeftPos), this.xScale.invert(this.handleRightPos)] : this.xScale.invert(this.handleLeftPos));
1177
- this.updateHandles();
1178
- };
1179
- Slider.prototype.constrain = function (pos) {
1180
- var range = this.xScale.range();
1181
- if (pos < range[0])
1182
- pos = range[0];
1183
- if (pos > range[1])
1184
- pos = range[1];
1185
- return this.nearestStep(pos);
1186
- };
1187
- Slider.prototype.nearestStep = function (pos) {
1188
- var value = this.xScale.invert(pos);
1189
- return this.xScale(this.low() + Math.round((value - this.low()) / this.step()) * this.step());
1190
- };
1191
- return Slider;
1192
- }(common.SVGWidget));
1193
- Slider.prototype._class += " form_Slider";
1194
- Slider.prototype.implements(api.IInput.prototype);
1195
- Slider.prototype.publish("padding", 16, "number", "Outer Padding", null, { tags: ["Basic"] });
1196
- Slider.prototype.publish("fontSize", 12, "number", "Font Size", null, { tags: ["Basic"] });
1197
- Slider.prototype.publish("fontFamily", null, "string", "Font Name", null, { tags: ["Basic"] });
1198
- Slider.prototype.publish("fontColor", null, "html-color", "Font Color", null, { tags: ["Basic"] });
1199
- Slider.prototype.publish("allowRange", false, "boolean", "Allow Range Selection", null, { tags: ["Intermediate"] });
1200
- Slider.prototype.publish("low", null, "number", "Low", null, { tags: ["Intermediate"] });
1201
- Slider.prototype.publish("high", null, "number", "High", null, { tags: ["Intermediate"] });
1202
- Slider.prototype.publish("step", 10, "number", "Step", null, { tags: ["Intermediate"] });
1203
- Slider.prototype.publish("lowDatetime", null, "string", "Low", null, { tags: ["Intermediate"] });
1204
- Slider.prototype.publish("highDatetime", null, "string", "High", null, { tags: ["Intermediate"] });
1205
- Slider.prototype.publish("selectionLabel", "", "string", "Selection Label", null, { tags: ["Intermediate"] });
1206
- Slider.prototype.publish("timePattern", "%Y-%m-%d", "string");
1207
- Slider.prototype.publish("tickCount", 10, "number");
1208
- Slider.prototype.publish("tickOffset", 5, "number");
1209
- Slider.prototype.publish("tickHeight", 8, "number");
1210
- Slider.prototype.publish("tickDateFormat", null, "string");
1211
- Slider.prototype.publish("tickValueFormat", ",.0f", "string");
1212
- var name = Slider.prototype.name;
1213
- Slider.prototype.name = function (_) {
1214
- var retVal = name.apply(this, arguments);
1215
- if (arguments.length) {
1216
- var val = _ instanceof Array ? _ : [_];
1217
- common.SVGWidget.prototype.columns.call(this, val);
1218
- }
1219
- return retVal;
1220
- };
1221
- var value = Slider.prototype.value;
1222
- Slider.prototype.value = function (_) {
1223
- var retVal = value.apply(this, arguments);
1224
- if (!arguments.length) {
1225
- if (!this.allowRange()) {
1226
- return common.SVGWidget.prototype.data.call(this)[0][0];
1227
- }
1228
- return common.SVGWidget.prototype.data.call(this)[0];
1229
- }
1230
- else {
1231
- common.SVGWidget.prototype.data.call(this, [this.allowRange() ? _ : [_, _]]);
1232
- }
1233
- return retVal;
1234
- };
972
+ var Slider = /** @class */ (function (_super) {
973
+ __extends(Slider, _super);
974
+ function Slider() {
975
+ var _this = _super.call(this) || this;
976
+ _this.handleLeftPos = 0;
977
+ _this.handleRightPos = 0;
978
+ _this.handlePath = function (d) {
979
+ var e = +(d === "r");
980
+ var x = e ? 1 : -1;
981
+ var xOffset = this.allowRange() ? 0.5 : 0.0;
982
+ var y = 18;
983
+ var retVal = "M" + (xOffset * x) + "," + y +
984
+ "A6,6 0 0 " + e + " " + (6.5 * x) + "," + (y + 6) +
985
+ "V" + (2 * y - 6) +
986
+ "A6,6 0 0 " + e + " " + (xOffset * x) + "," + (2 * y);
987
+ if (this.allowRange()) {
988
+ retVal += "Z" +
989
+ "M" + (2.5 * x) + "," + (y + 8) +
990
+ "V" + (2 * y - 8) +
991
+ "M" + (4.5 * x) + "," + (y + 8) +
992
+ "V" + (2 * y - 8);
993
+ }
994
+ else {
995
+ retVal += "M" + (1 * x) + "," + (y + 8) +
996
+ "V" + (2 * y - 8);
997
+ }
998
+ return retVal;
999
+ };
1000
+ api.IInput.call(_this);
1001
+ return _this;
1002
+ }
1003
+ Slider.prototype.enter = function (domNode, element) {
1004
+ var _this = this;
1005
+ _super.prototype.enter.call(this, domNode, element);
1006
+ this.resize({ width: this.width(), height: 50 });
1007
+ this.xScale = common.scaleLinear()
1008
+ .clamp(true);
1009
+ this.slider = element.append("g")
1010
+ .attr("class", "slider");
1011
+ if (this.low() === null && this.high() === null) {
1012
+ if (this.lowDatetime() !== null && this.highDatetime() !== null) {
1013
+ var time_parser = common.timeParse(this.timePattern() ? this.timePattern() : "%Q");
1014
+ this.low(time_parser(this.lowDatetime()).getTime());
1015
+ this.high(time_parser(this.highDatetime()).getTime());
1016
+ }
1017
+ }
1018
+ this.slider.append("line")
1019
+ .attr("class", "track")
1020
+ .select(function () { return this.parentNode.appendChild(this.cloneNode(true)); })
1021
+ .attr("class", "track-inset")
1022
+ .select(function () { return this.parentNode.appendChild(this.cloneNode(true)); })
1023
+ .attr("class", "track-overlay")
1024
+ .call(common.drag()
1025
+ .on("start", function () {
1026
+ var event = common.d3Event();
1027
+ _this.moveStartPos = event.x;
1028
+ _this.handleLeftStartPos = _this.handleLeftPos;
1029
+ _this.handleRightStartPos = _this.handleRightPos;
1030
+ if (_this.allowRange() && _this.handleLeftPos <= event.x && event.x <= _this.handleRightPos) {
1031
+ _this.moveMode = "both";
1032
+ }
1033
+ else if (Math.abs(event.x - _this.handleLeftPos) < Math.abs(event.x - _this.handleRightPos)) {
1034
+ _this.moveMode = "left";
1035
+ }
1036
+ else {
1037
+ _this.moveMode = "right";
1038
+ }
1039
+ _this.moveHandleTo(event.x);
1040
+ })
1041
+ .on("drag", function () {
1042
+ _this.moveHandleTo(common.d3Event().x);
1043
+ })
1044
+ .on("end", function () {
1045
+ _this.moveHandleTo(common.d3Event().x);
1046
+ _this.data([[_this.xScale.invert(_this.handleLeftPos), _this.xScale.invert(_this.handleRightPos)]]);
1047
+ _this.checkChangedValue();
1048
+ }));
1049
+ this.slider.insert("g", ".track-overlay")
1050
+ .attr("class", "ticks")
1051
+ .attr("transform", "translate(0, ".concat(this.fontSize() + (this.tickHeight() / 2), ")"));
1052
+ this.handleRight = this.slider.insert("path", ".track-overlay")
1053
+ .attr("class", "handle");
1054
+ this.handleLeft = this.slider.insert("path", ".track-overlay")
1055
+ .attr("class", "handle");
1056
+ };
1057
+ Slider.prototype.update = function (domNode, element) {
1058
+ _super.prototype.update.call(this, domNode, element);
1059
+ var context = this;
1060
+ this.xScale
1061
+ .domain([this.low(), this.high()])
1062
+ .range([0, this.width() - this.padding() * 2]);
1063
+ this.slider
1064
+ .attr("transform", "translate(" + (-this.width() / 2 + this.padding()) + "," + 0 + ")");
1065
+ this.slider.selectAll("line.track,line.track-inset,line.track-overlay")
1066
+ .attr("x1", this.xScale.range()[0])
1067
+ .attr("x2", this.xScale.range()[1]);
1068
+ var x_distance = (this.width() - (this.padding() * 2)) / (this.tickCount() - 1);
1069
+ var tick_text_arr = [];
1070
+ if (this.tickDateFormat() !== null && this.timePattern() !== null) {
1071
+ var Q_parser = common.timeParse("%Q");
1072
+ var time_formatter = common.timeFormat(this.tickDateFormat());
1073
+ var time_segment = (this.high() - this.low()) / (this.tickCount() - 1);
1074
+ for (var i = 0; i < this.tickCount(); i++) {
1075
+ var date_to_parse = "" + (this.low() + (time_segment * i));
1076
+ var parsed_date = Q_parser(date_to_parse);
1077
+ tick_text_arr.push(time_formatter(parsed_date));
1078
+ }
1079
+ }
1080
+ else {
1081
+ var value_formatter = common.format(this.tickValueFormat());
1082
+ var value_segment = (this.high() - this.low()) / (this.tickCount() - 1);
1083
+ for (var i = 0; i < this.tickCount(); i++) {
1084
+ var tick_value = this.low() + (value_segment * i);
1085
+ tick_text_arr.push(value_formatter(tick_value));
1086
+ }
1087
+ }
1088
+ var tickText = this.slider.selectAll("g.tick").data(tick_text_arr);
1089
+ var tickTextEnter = tickText.enter().append("g").attr("class", "tick");
1090
+ tickTextEnter.append("text").attr("class", "tick-text");
1091
+ tickTextEnter.append("line").attr("class", "tick-line");
1092
+ tickTextEnter
1093
+ .merge(tickText)
1094
+ .each(function (d, i) {
1095
+ var x = x_distance * i;
1096
+ common.select(this).select("text.tick-text")
1097
+ .style("font-size", context.fontSize())
1098
+ .attr("x", function () {
1099
+ if (i === 0)
1100
+ return x - 2;
1101
+ return i === context.tickCount() - 1 ? x + 2 : x;
1102
+ })
1103
+ .attr("y", context.tickHeight() + (context.tickOffset() / 2) + context.fontSize())
1104
+ .attr("text-basline", "text-before-edge")
1105
+ .attr("text-anchor", function () {
1106
+ if (i === 0)
1107
+ return "start";
1108
+ return i === context.tickCount() - 1 ? "end" : "middle";
1109
+ })
1110
+ .text(function () { return d; });
1111
+ common.select(this).select("line.tick-line")
1112
+ .attr("x1", x)
1113
+ .attr("x2", x)
1114
+ .attr("y1", context.tickOffset() - 1)
1115
+ .attr("y2", context.tickOffset() + context.tickHeight())
1116
+ .style("stroke", "#000")
1117
+ .style("stroke-width", 1);
1118
+ });
1119
+ this.slider.node().appendChild(this.handleRight.node());
1120
+ this.slider.node().appendChild(this.handleLeft.node());
1121
+ this.handleLeftPos = this.lowPos();
1122
+ this.handleRightPos = this.highPos();
1123
+ this.updateHandles();
1124
+ this.checkChangedValue();
1125
+ };
1126
+ Slider.prototype.checkChangedValue = function () {
1127
+ if (this.prevValue !== this.value() && typeof this.prevValue !== "undefined") {
1128
+ this.change(this);
1129
+ }
1130
+ this.prevValue = this.value();
1131
+ };
1132
+ Slider.prototype.updateHandles = function () {
1133
+ var _this = this;
1134
+ this.handleLeft
1135
+ .attr("transform", "translate(".concat(this.handleLeftPos, ", -28)"))
1136
+ .attr("d", function (d) { return _this.handlePath("l"); });
1137
+ this.handleRight
1138
+ .attr("transform", "translate(".concat(this.handleRightPos, ", -28)"))
1139
+ .attr("d", function (d) { return _this.handlePath("r"); });
1140
+ };
1141
+ Slider.prototype.lowPos = function () {
1142
+ var data = [[this.low(), this.high()]];
1143
+ if (this.data().length > 0 && typeof this.data()[0][0] === "number" && typeof this.data()[0][1] === "number") {
1144
+ data = this.data();
1145
+ }
1146
+ return this.xScale(data[0][0]);
1147
+ };
1148
+ Slider.prototype.highPos = function () {
1149
+ var data = [[this.low(), this.high()]];
1150
+ if (this.data().length > 0 && typeof this.data()[0][0] === "number" && typeof this.data()[0][1] === "number") {
1151
+ data = this.data();
1152
+ }
1153
+ return this.xScale(data[0][this.allowRange() ? 1 : 0]);
1154
+ };
1155
+ Slider.prototype.moveHandleTo = function (pos) {
1156
+ if (this.allowRange()) {
1157
+ switch (this.moveMode) {
1158
+ case "both":
1159
+ this.handleLeftPos = this.handleLeftStartPos + pos - this.moveStartPos;
1160
+ this.handleRightPos = this.handleRightStartPos + pos - this.moveStartPos;
1161
+ break;
1162
+ case "left":
1163
+ this.handleLeftPos = pos;
1164
+ if (this.handleLeftPos > this.handleRightPos) {
1165
+ this.handleRightPos = this.handleLeftPos;
1166
+ }
1167
+ break;
1168
+ case "right":
1169
+ this.handleRightPos = pos;
1170
+ if (this.handleRightPos < this.handleLeftPos) {
1171
+ this.handleLeftPos = this.handleRightPos;
1172
+ }
1173
+ break;
1174
+ }
1175
+ }
1176
+ else {
1177
+ this.handleLeftPos = this.handleRightPos = pos;
1178
+ }
1179
+ this.handleLeftPos = this.constrain(this.handleLeftPos);
1180
+ this.handleRightPos = this.constrain(this.handleRightPos);
1181
+ this.value(this.allowRange() ? [this.xScale.invert(this.handleLeftPos), this.xScale.invert(this.handleRightPos)] : this.xScale.invert(this.handleLeftPos));
1182
+ this.updateHandles();
1183
+ };
1184
+ Slider.prototype.constrain = function (pos) {
1185
+ var range = this.xScale.range();
1186
+ if (pos < range[0])
1187
+ pos = range[0];
1188
+ if (pos > range[1])
1189
+ pos = range[1];
1190
+ return this.nearestStep(pos);
1191
+ };
1192
+ Slider.prototype.nearestStep = function (pos) {
1193
+ var value = this.xScale.invert(pos);
1194
+ return this.xScale(this.low() + Math.round((value - this.low()) / this.step()) * this.step());
1195
+ };
1196
+ return Slider;
1197
+ }(common.SVGWidget));
1198
+ Slider.prototype._class += " form_Slider";
1199
+ Slider.prototype.implements(api.IInput.prototype);
1200
+ Slider.prototype.publish("padding", 16, "number", "Outer Padding", null, { tags: ["Basic"] });
1201
+ Slider.prototype.publish("fontSize", 12, "number", "Font Size", null, { tags: ["Basic"] });
1202
+ Slider.prototype.publish("fontFamily", null, "string", "Font Name", null, { tags: ["Basic"] });
1203
+ Slider.prototype.publish("fontColor", null, "html-color", "Font Color", null, { tags: ["Basic"] });
1204
+ Slider.prototype.publish("allowRange", false, "boolean", "Allow Range Selection", null, { tags: ["Intermediate"] });
1205
+ Slider.prototype.publish("low", null, "number", "Low", null, { tags: ["Intermediate"] });
1206
+ Slider.prototype.publish("high", null, "number", "High", null, { tags: ["Intermediate"] });
1207
+ Slider.prototype.publish("step", 10, "number", "Step", null, { tags: ["Intermediate"] });
1208
+ Slider.prototype.publish("lowDatetime", null, "string", "Low", null, { tags: ["Intermediate"] });
1209
+ Slider.prototype.publish("highDatetime", null, "string", "High", null, { tags: ["Intermediate"] });
1210
+ Slider.prototype.publish("selectionLabel", "", "string", "Selection Label", null, { tags: ["Intermediate"] });
1211
+ Slider.prototype.publish("timePattern", "%Y-%m-%d", "string");
1212
+ Slider.prototype.publish("tickCount", 10, "number");
1213
+ Slider.prototype.publish("tickOffset", 5, "number");
1214
+ Slider.prototype.publish("tickHeight", 8, "number");
1215
+ Slider.prototype.publish("tickDateFormat", null, "string");
1216
+ Slider.prototype.publish("tickValueFormat", ",.0f", "string");
1217
+ var name = Slider.prototype.name;
1218
+ Slider.prototype.name = function (_) {
1219
+ var retVal = name.apply(this, arguments);
1220
+ if (arguments.length) {
1221
+ var val = _ instanceof Array ? _ : [_];
1222
+ common.SVGWidget.prototype.columns.call(this, val);
1223
+ }
1224
+ return retVal;
1225
+ };
1226
+ var value = Slider.prototype.value;
1227
+ Slider.prototype.value = function (_) {
1228
+ var retVal = value.apply(this, arguments);
1229
+ if (!arguments.length) {
1230
+ if (!this.allowRange()) {
1231
+ return common.SVGWidget.prototype.data.call(this)[0][0];
1232
+ }
1233
+ return common.SVGWidget.prototype.data.call(this)[0];
1234
+ }
1235
+ else {
1236
+ common.SVGWidget.prototype.data.call(this, [this.allowRange() ? _ : [_, _]]);
1237
+ }
1238
+ return retVal;
1239
+ };
1235
1240
 
1236
- var TextArea = /** @class */ (function (_super) {
1237
- __extends(TextArea, _super);
1238
- function TextArea() {
1239
- var _this = _super.call(this) || this;
1240
- _this._tag = "div";
1241
- _this.type("textarea");
1242
- return _this;
1243
- }
1244
- TextArea.prototype.enter = function (domNode, element) {
1245
- _super.prototype.enter.call(this, domNode, element);
1246
- };
1247
- TextArea.prototype.calcHeight = function () {
1248
- return Math.max(this.minHeight_exists() ? this.minHeight() : 0, this.height());
1249
- };
1250
- TextArea.prototype.update = function (domNode, element) {
1251
- _super.prototype.update.call(this, domNode, element);
1252
- this._inputElement[0]
1253
- .attr("rows", this.rows())
1254
- .attr("cols", this.cols())
1255
- .attr("wrap", this.wrap())
1256
- .attr("spellcheck", this.spellcheck())
1257
- .style("height", this.calcHeight() + "px");
1258
- };
1259
- return TextArea;
1260
- }(Input));
1261
- TextArea.prototype._class += " form_TextArea";
1262
- TextArea.prototype.publish("rows", null, "number", "Rows", null, { optional: true });
1263
- TextArea.prototype.publish("cols", null, "number", "Columns", null, { optional: true });
1264
- TextArea.prototype.publish("wrap", "off", "set", "Wrap", ["off", "on"]);
1265
- TextArea.prototype.publish("minHeight", null, "number", "Minimum Height", null, { optional: true });
1266
- TextArea.prototype.publish("spellcheck", null, "boolean", "Input spell checking", { optional: true });
1241
+ var TextArea = /** @class */ (function (_super) {
1242
+ __extends(TextArea, _super);
1243
+ function TextArea() {
1244
+ var _this = _super.call(this) || this;
1245
+ _this._tag = "div";
1246
+ _this.type("textarea");
1247
+ return _this;
1248
+ }
1249
+ TextArea.prototype.enter = function (domNode, element) {
1250
+ _super.prototype.enter.call(this, domNode, element);
1251
+ };
1252
+ TextArea.prototype.calcHeight = function () {
1253
+ return Math.max(this.minHeight_exists() ? this.minHeight() : 0, this.height());
1254
+ };
1255
+ TextArea.prototype.update = function (domNode, element) {
1256
+ _super.prototype.update.call(this, domNode, element);
1257
+ this._inputElement[0]
1258
+ .attr("rows", this.rows())
1259
+ .attr("cols", this.cols())
1260
+ .attr("wrap", this.wrap())
1261
+ .attr("spellcheck", this.spellcheck())
1262
+ .style("height", this.calcHeight() + "px");
1263
+ };
1264
+ return TextArea;
1265
+ }(Input));
1266
+ TextArea.prototype._class += " form_TextArea";
1267
+ TextArea.prototype.publish("rows", null, "number", "Rows", null, { optional: true });
1268
+ TextArea.prototype.publish("cols", null, "number", "Columns", null, { optional: true });
1269
+ TextArea.prototype.publish("wrap", "off", "set", "Wrap", ["off", "on"]);
1270
+ TextArea.prototype.publish("minHeight", null, "number", "Minimum Height", null, { optional: true });
1271
+ TextArea.prototype.publish("spellcheck", null, "boolean", "Input spell checking", { optional: true });
1267
1272
 
1268
- exports.BUILD_VERSION = BUILD_VERSION;
1269
- exports.Button = Button;
1270
- exports.CheckBox = CheckBox;
1271
- exports.ColorInput = ColorInput;
1272
- exports.FieldForm = FieldForm;
1273
- exports.Form = Form;
1274
- exports.Input = Input;
1275
- exports.InputRange = InputRange;
1276
- exports.OnOff = OnOff;
1277
- exports.PKG_NAME = PKG_NAME;
1278
- exports.PKG_VERSION = PKG_VERSION;
1279
- exports.Radio = Radio;
1280
- exports.Range = Range;
1281
- exports.Select = Select;
1282
- exports.Slider = Slider;
1283
- exports.TextArea = TextArea;
1273
+ exports.BUILD_VERSION = BUILD_VERSION;
1274
+ exports.Button = Button;
1275
+ exports.CheckBox = CheckBox;
1276
+ exports.ColorInput = ColorInput;
1277
+ exports.FieldForm = FieldForm;
1278
+ exports.Form = Form;
1279
+ exports.Input = Input;
1280
+ exports.InputRange = InputRange;
1281
+ exports.OnOff = OnOff;
1282
+ exports.PKG_NAME = PKG_NAME;
1283
+ exports.PKG_VERSION = PKG_VERSION;
1284
+ exports.Radio = Radio;
1285
+ exports.Range = Range;
1286
+ exports.Select = Select;
1287
+ exports.Slider = Slider;
1288
+ exports.TextArea = TextArea;
1284
1289
 
1285
- Object.defineProperty(exports, '__esModule', { value: true });
1290
+ Object.defineProperty(exports, '__esModule', { value: true });
1286
1291
 
1287
1292
  }));
1288
1293
  //# sourceMappingURL=index.js.map