@hpcc-js/form 2.12.3 → 2.12.5

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/src/Range.ts CHANGED
@@ -1,104 +1,104 @@
1
- import { IInput } from "@hpcc-js/api";
2
- import { HTMLWidget } from "@hpcc-js/common";
3
- import { rgb as d3Rgb } from "d3-color";
4
-
5
- import "../src/Input.css";
6
-
7
- export class Range extends HTMLWidget {
8
- _inputElement = [];
9
-
10
- constructor() {
11
- super();
12
-
13
- IInput.call(this);
14
-
15
- this._tag = "div";
16
- }
17
-
18
- enter(domNode, element) {
19
- super.enter(domNode, element);
20
-
21
- const context = this;
22
-
23
- this._inputElement[0] = element.append("input").attr("type", "range");
24
- this._inputElement[1] = element.append("input").attr("type", "number");
25
-
26
- this._inputElement.forEach(function (e, idx) {
27
- e.attr("name", context.name());
28
- e.on("click", function (w) {
29
- w.click(w);
30
- });
31
- e.on("blur", function (w) {
32
- w.blur(w);
33
- });
34
- e.on("change", function (w) {
35
- if (idx === 0) {
36
- context._inputElement[1].property("value", d3Rgb(context._inputElement[0].property("value")).toString());
37
- context.value(context._inputElement[0].property("value"));
38
- } else {
39
- context._inputElement[0].property("value", context._inputElement[1].property("value"));
40
- context.value(d3Rgb(context._inputElement[1].property("value")).toString());
41
- }
42
- w.change(w, true);
43
- });
44
- });
45
- }
46
-
47
- update(domNode, element) {
48
- super.update(domNode, element);
49
-
50
- this._inputElement[0].attr("type", "range");
51
- this._inputElement[0].property("value", this.value());
52
- this._inputElement[0].attr("min", this.low());
53
- this._inputElement[0].attr("max", this.high());
54
- this._inputElement[0].attr("step", this.step());
55
- this._inputElement[1].attr("type", "number");
56
- this._inputElement[1].property("value", this.value());
57
- this._inputElement[1].attr("min", this.low());
58
- this._inputElement[1].attr("max", this.high());
59
- this._inputElement[1].attr("step", this.step());
60
- }
61
-
62
- insertSelectOptions(optionsArr) {
63
- let optionHTML = "";
64
- if (optionsArr.length > 0) {
65
- optionsArr.forEach(function (opt) {
66
- const val = (opt instanceof Array ? opt[0] : opt);
67
- const text = (opt instanceof Array ? (opt[1] ? opt[1] : opt[0]) : opt);
68
- optionHTML += "<option value='" + val + "'>" + text + "</option>";
69
- });
70
- } else {
71
- optionHTML += "<option>selectOptions not set</option>";
72
- }
73
- this._inputElement[0].html(optionHTML);
74
- }
75
-
76
- type: { (): string; (_: string): Range };
77
- type_exists: () => boolean;
78
- selectOptions: { (): any[]; (_: any[]): Range };
79
- selectOptions_exists: () => boolean;
80
- low: { (): number; (_: number): Range };
81
- low_exists: () => boolean;
82
- high: { (): number; (_: number): Range };
83
- high_exists: () => boolean;
84
- step: { (): number; (_: number): Range };
85
- step_exists: () => boolean;
86
-
87
- // IInput ---
88
- name: { (): string; (_: string): Range };
89
- name_exists: () => boolean;
90
- label: { (): string; (_: string): Range };
91
- label_exists: () => boolean;
92
- value: { (): any; (_: any): Range };
93
- value_exists: () => boolean;
94
- validate: { (): string; (_: string): Range };
95
- validate_exists: () => boolean;
96
- }
97
- Range.prototype._class += " form_Range";
98
- Range.prototype.implements(IInput.prototype);
99
-
100
- Range.prototype.publish("type", "text", "set", "Input type", ["html-color", "number", "checkbox", "button", "select", "textarea", "date", "text", "range", "search", "email", "time", "datetime"]);
101
- Range.prototype.publish("selectOptions", [], "array", "Array of options used to fill a dropdown list");
102
- Range.prototype.publish("low", null, "number", "Minimum value for Range input");
103
- Range.prototype.publish("high", null, "number", "Maximum value for Range input");
104
- Range.prototype.publish("step", null, "number", "Step value for Range input");
1
+ import { IInput } from "@hpcc-js/api";
2
+ import { HTMLWidget } from "@hpcc-js/common";
3
+ import { rgb as d3Rgb } from "d3-color";
4
+
5
+ import "../src/Input.css";
6
+
7
+ export class Range extends HTMLWidget {
8
+ _inputElement = [];
9
+
10
+ constructor() {
11
+ super();
12
+
13
+ IInput.call(this);
14
+
15
+ this._tag = "div";
16
+ }
17
+
18
+ enter(domNode, element) {
19
+ super.enter(domNode, element);
20
+
21
+ const context = this;
22
+
23
+ this._inputElement[0] = element.append("input").attr("type", "range");
24
+ this._inputElement[1] = element.append("input").attr("type", "number");
25
+
26
+ this._inputElement.forEach(function (e, idx) {
27
+ e.attr("name", context.name());
28
+ e.on("click", function (w) {
29
+ w.click(w);
30
+ });
31
+ e.on("blur", function (w) {
32
+ w.blur(w);
33
+ });
34
+ e.on("change", function (w) {
35
+ if (idx === 0) {
36
+ context._inputElement[1].property("value", d3Rgb(context._inputElement[0].property("value")).toString());
37
+ context.value(context._inputElement[0].property("value"));
38
+ } else {
39
+ context._inputElement[0].property("value", context._inputElement[1].property("value"));
40
+ context.value(d3Rgb(context._inputElement[1].property("value")).toString());
41
+ }
42
+ w.change(w, true);
43
+ });
44
+ });
45
+ }
46
+
47
+ update(domNode, element) {
48
+ super.update(domNode, element);
49
+
50
+ this._inputElement[0].attr("type", "range");
51
+ this._inputElement[0].property("value", this.value());
52
+ this._inputElement[0].attr("min", this.low());
53
+ this._inputElement[0].attr("max", this.high());
54
+ this._inputElement[0].attr("step", this.step());
55
+ this._inputElement[1].attr("type", "number");
56
+ this._inputElement[1].property("value", this.value());
57
+ this._inputElement[1].attr("min", this.low());
58
+ this._inputElement[1].attr("max", this.high());
59
+ this._inputElement[1].attr("step", this.step());
60
+ }
61
+
62
+ insertSelectOptions(optionsArr) {
63
+ let optionHTML = "";
64
+ if (optionsArr.length > 0) {
65
+ optionsArr.forEach(function (opt) {
66
+ const val = (opt instanceof Array ? opt[0] : opt);
67
+ const text = (opt instanceof Array ? (opt[1] ? opt[1] : opt[0]) : opt);
68
+ optionHTML += "<option value='" + val + "'>" + text + "</option>";
69
+ });
70
+ } else {
71
+ optionHTML += "<option>selectOptions not set</option>";
72
+ }
73
+ this._inputElement[0].html(optionHTML);
74
+ }
75
+
76
+ type: { (): string; (_: string): Range };
77
+ type_exists: () => boolean;
78
+ selectOptions: { (): any[]; (_: any[]): Range };
79
+ selectOptions_exists: () => boolean;
80
+ low: { (): number; (_: number): Range };
81
+ low_exists: () => boolean;
82
+ high: { (): number; (_: number): Range };
83
+ high_exists: () => boolean;
84
+ step: { (): number; (_: number): Range };
85
+ step_exists: () => boolean;
86
+
87
+ // IInput ---
88
+ name: { (): string; (_: string): Range };
89
+ name_exists: () => boolean;
90
+ label: { (): string; (_: string): Range };
91
+ label_exists: () => boolean;
92
+ value: { (): any; (_: any): Range };
93
+ value_exists: () => boolean;
94
+ validate: { (): string; (_: string): Range };
95
+ validate_exists: () => boolean;
96
+ }
97
+ Range.prototype._class += " form_Range";
98
+ Range.prototype.implements(IInput.prototype);
99
+
100
+ Range.prototype.publish("type", "text", "set", "Input type", ["html-color", "number", "checkbox", "button", "select", "textarea", "date", "text", "range", "search", "email", "time", "datetime"]);
101
+ Range.prototype.publish("selectOptions", [], "array", "Array of options used to fill a dropdown list");
102
+ Range.prototype.publish("low", null, "number", "Minimum value for Range input");
103
+ Range.prototype.publish("high", null, "number", "Maximum value for Range input");
104
+ Range.prototype.publish("step", null, "number", "Step value for Range input");
package/src/Select.ts CHANGED
@@ -1,80 +1,80 @@
1
- import { IInput } from "@hpcc-js/api";
2
- import { HTMLWidget } from "@hpcc-js/common";
3
-
4
- import "../src/Input.css";
5
-
6
- export class Select extends HTMLWidget {
7
- _inputElement = [];
8
-
9
- constructor() {
10
- super();
11
-
12
- IInput.call(this);
13
-
14
- this._tag = "div";
15
- }
16
-
17
- enter(domNode, element) {
18
- super.enter(domNode, element);
19
-
20
- const context = this;
21
-
22
- this._inputElement[0] = element.append("select")
23
- .attr("name", this.name())
24
- .on("click", function (w) {
25
- w.click(w);
26
- })
27
- .on("blur", function (w) {
28
- w.blur(w);
29
- })
30
- .on("change", function (w) {
31
- context.value([context._inputElement[0].property("value")]);
32
- w.change(w, true);
33
- })
34
- ;
35
- }
36
-
37
- update(domNode, element) {
38
- super.update(domNode, element);
39
-
40
- this.insertSelectOptions(this.selectOptions());
41
- this._inputElement[0]
42
- .property("value", this.value())
43
- .style("max-width", this.maxWidth_exists() ? this.maxWidth() + "px" : null)
44
- ;
45
- }
46
-
47
- insertSelectOptions(optionsArr) {
48
- let optionHTML = "";
49
- if (optionsArr.length > 0) {
50
- optionsArr.forEach(function (opt) {
51
- const val = (opt instanceof Array ? opt[0] : opt);
52
- const text = (opt instanceof Array ? (opt[1] ? opt[1] : opt[0]) : opt);
53
- optionHTML += "<option value='" + val + "'>" + text + "</option>";
54
- });
55
- } else {
56
- optionHTML += "<option>selectOptions not set</option>";
57
- }
58
- this._inputElement[0].html(optionHTML);
59
- }
60
-
61
- selectOptions: { (): any[]; (_: any[]): Select };
62
- selectOptions_exists: () => boolean;
63
- maxWidth: { (): number; (_: number): Select };
64
- maxWidth_exists: () => boolean;
65
-
66
- // IInput ---
67
- name: { (): string; (_: string): Select };
68
- name_exists: () => boolean;
69
- label: { (): string; (_: string): Select };
70
- label_exists: () => boolean;
71
- value: { (): any; (_: any): Select };
72
- value_exists: () => boolean;
73
- validate: { (): string; (_: string): Select };
74
- validate_exists: () => boolean;
75
- }
76
- Select.prototype._class += " form_Select";
77
- Select.prototype.implements(IInput.prototype);
78
-
79
- Select.prototype.publish("selectOptions", [], "array", "Array of options used to fill a dropdown list");
80
- Select.prototype.publish("maxWidth", 120, "number", "Width", null, { optional: true });
1
+ import { IInput } from "@hpcc-js/api";
2
+ import { HTMLWidget } from "@hpcc-js/common";
3
+
4
+ import "../src/Input.css";
5
+
6
+ export class Select extends HTMLWidget {
7
+ _inputElement = [];
8
+
9
+ constructor() {
10
+ super();
11
+
12
+ IInput.call(this);
13
+
14
+ this._tag = "div";
15
+ }
16
+
17
+ enter(domNode, element) {
18
+ super.enter(domNode, element);
19
+
20
+ const context = this;
21
+
22
+ this._inputElement[0] = element.append("select")
23
+ .attr("name", this.name())
24
+ .on("click", function (w) {
25
+ w.click(w);
26
+ })
27
+ .on("blur", function (w) {
28
+ w.blur(w);
29
+ })
30
+ .on("change", function (w) {
31
+ context.value([context._inputElement[0].property("value")]);
32
+ w.change(w, true);
33
+ })
34
+ ;
35
+ }
36
+
37
+ update(domNode, element) {
38
+ super.update(domNode, element);
39
+
40
+ this.insertSelectOptions(this.selectOptions());
41
+ this._inputElement[0]
42
+ .property("value", this.value())
43
+ .style("max-width", this.maxWidth_exists() ? this.maxWidth() + "px" : null)
44
+ ;
45
+ }
46
+
47
+ insertSelectOptions(optionsArr) {
48
+ let optionHTML = "";
49
+ if (optionsArr.length > 0) {
50
+ optionsArr.forEach(function (opt) {
51
+ const val = (opt instanceof Array ? opt[0] : opt);
52
+ const text = (opt instanceof Array ? (opt[1] ? opt[1] : opt[0]) : opt);
53
+ optionHTML += "<option value='" + val + "'>" + text + "</option>";
54
+ });
55
+ } else {
56
+ optionHTML += "<option>selectOptions not set</option>";
57
+ }
58
+ this._inputElement[0].html(optionHTML);
59
+ }
60
+
61
+ selectOptions: { (): any[]; (_: any[]): Select };
62
+ selectOptions_exists: () => boolean;
63
+ maxWidth: { (): number; (_: number): Select };
64
+ maxWidth_exists: () => boolean;
65
+
66
+ // IInput ---
67
+ name: { (): string; (_: string): Select };
68
+ name_exists: () => boolean;
69
+ label: { (): string; (_: string): Select };
70
+ label_exists: () => boolean;
71
+ value: { (): any; (_: any): Select };
72
+ value_exists: () => boolean;
73
+ validate: { (): string; (_: string): Select };
74
+ validate_exists: () => boolean;
75
+ }
76
+ Select.prototype._class += " form_Select";
77
+ Select.prototype.implements(IInput.prototype);
78
+
79
+ Select.prototype.publish("selectOptions", [], "array", "Array of options used to fill a dropdown list");
80
+ Select.prototype.publish("maxWidth", 120, "number", "Width", null, { optional: true });
package/src/Slider.css CHANGED
@@ -1,41 +1,41 @@
1
- .form_Slider .ticks {
2
- font: 10px sans-serif;
3
- }
4
-
5
- .form_Slider .track,
6
- .form_Slider .track-inset,
7
- .form_Slider .track-overlay {
8
- stroke-linecap: round;
9
- }
10
-
11
- .form_Slider .track {
12
- stroke: #000;
13
- stroke-opacity: 0.3;
14
- stroke-width: 10px;
15
- }
16
-
17
- .form_Slider .track-inset {
18
- stroke: #ddd;
19
- stroke-width: 8px;
20
- }
21
-
22
- .form_Slider .track-overlay {
23
- pointer-events: stroke;
24
- stroke-width: 50px;
25
- stroke: transparent;
26
- cursor: crosshair;
27
- }
28
-
29
- .form_Slider .handle {
30
- fill: #fff;
31
- stroke: #000;
32
- stroke-opacity: 0.5;
33
- stroke-width: 1.25px;
34
- }
35
-
36
- .form_Slider .tick-line {
37
- stroke: #000;
38
- stroke-opacity: 0.5;
39
- stroke-width: 1px;
40
- shape-rendering: crispEdges;
1
+ .form_Slider .ticks {
2
+ font: 10px sans-serif;
3
+ }
4
+
5
+ .form_Slider .track,
6
+ .form_Slider .track-inset,
7
+ .form_Slider .track-overlay {
8
+ stroke-linecap: round;
9
+ }
10
+
11
+ .form_Slider .track {
12
+ stroke: #000;
13
+ stroke-opacity: 0.3;
14
+ stroke-width: 10px;
15
+ }
16
+
17
+ .form_Slider .track-inset {
18
+ stroke: #ddd;
19
+ stroke-width: 8px;
20
+ }
21
+
22
+ .form_Slider .track-overlay {
23
+ pointer-events: stroke;
24
+ stroke-width: 50px;
25
+ stroke: transparent;
26
+ cursor: crosshair;
27
+ }
28
+
29
+ .form_Slider .handle {
30
+ fill: #fff;
31
+ stroke: #000;
32
+ stroke-opacity: 0.5;
33
+ stroke-width: 1.25px;
34
+ }
35
+
36
+ .form_Slider .tick-line {
37
+ stroke: #000;
38
+ stroke-opacity: 0.5;
39
+ stroke-width: 1px;
40
+ shape-rendering: crispEdges;
41
41
  }