@hpcc-js/form 3.4.2 → 3.4.4

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/Input.css CHANGED
@@ -1,43 +1,43 @@
1
- .form_Input input,
2
- .form_Input select,
3
- .form_Input button,
4
- .form_Input textarea {
5
- padding: 2px;
6
- }
7
-
8
- .form_Input button {
9
- cursor: pointer;
10
- }
11
-
12
- .form_Input input.color-text {
13
- width: 120px;
14
- }
15
-
16
- .form_Input input.color-text+input {
17
- width: 57px;
18
- position: absolute;
19
- }
20
-
21
- .form_Input textarea {
22
- width: 100%;
23
- box-sizing: border-box;
24
- display: block;
25
- }
26
-
27
- .form_Input input[type="textbox"] {
28
- width: 100%;
29
- box-sizing: border-box;
30
- display: block;
31
- }
32
-
33
- .form_Input ul {
34
- list-style-type: none;
35
- float: left;
36
- padding: 0px;
37
- margin: 0px;
38
- }
39
-
40
- .form_Input li {
41
- float: left;
42
- list-style-position: inside
1
+ .form_Input input,
2
+ .form_Input select,
3
+ .form_Input button,
4
+ .form_Input textarea {
5
+ padding: 2px;
6
+ }
7
+
8
+ .form_Input button {
9
+ cursor: pointer;
10
+ }
11
+
12
+ .form_Input input.color-text {
13
+ width: 120px;
14
+ }
15
+
16
+ .form_Input input.color-text+input {
17
+ width: 57px;
18
+ position: absolute;
19
+ }
20
+
21
+ .form_Input textarea {
22
+ width: 100%;
23
+ box-sizing: border-box;
24
+ display: block;
25
+ }
26
+
27
+ .form_Input input[type="textbox"] {
28
+ width: 100%;
29
+ box-sizing: border-box;
30
+ display: block;
31
+ }
32
+
33
+ .form_Input ul {
34
+ list-style-type: none;
35
+ float: left;
36
+ padding: 0px;
37
+ margin: 0px;
38
+ }
39
+
40
+ .form_Input li {
41
+ float: left;
42
+ list-style-position: inside
43
43
  }
package/src/Input.ts CHANGED
@@ -1,136 +1,136 @@
1
- import { IInput } from "@hpcc-js/api";
2
- import { Database, HTMLWidget } from "@hpcc-js/common";
3
-
4
- import "../src/Input.css";
5
-
6
- export class Input extends HTMLWidget {
7
- _inputElement = [];
8
- _labelElement = [];
9
-
10
- constructor() {
11
- super();
12
- IInput.call(this);
13
-
14
- this._tag = "div";
15
- }
16
-
17
- checked(_) {
18
- if (!arguments.length) return this._inputElement[0] ? this._inputElement[0].property("checked") : false;
19
- if (this._inputElement[0]) {
20
- this._inputElement[0].property("checked", _);
21
- }
22
- return this;
23
- }
24
-
25
- enter(domNode, element) {
26
- super.enter(domNode, element);
27
-
28
- this._labelElement[0] = element.append("label")
29
- .attr("for", this.id() + "_input")
30
- .style("visibility", this.inlineLabel_exists() ? "visible" : "hidden")
31
- ;
32
-
33
- const context = this;
34
- switch (this.type()) {
35
- case "button":
36
- this._inputElement[0] = element.append("button")
37
- .attr("id", this.id() + "_input")
38
- ;
39
- break;
40
- case "textarea":
41
- this._inputElement[0] = element.append("textarea")
42
- .attr("id", this.id() + "_input")
43
- ;
44
- break;
45
- default:
46
- this._inputElement[0] = element.append("input")
47
- .attr("id", this.id() + "_input")
48
- .attr("type", this.type())
49
- ;
50
- break;
51
- }
52
-
53
- this._inputElement.forEach(function (e, idx) {
54
- e.attr("name", context.name());
55
- e.on("click", function (w: Input) {
56
- w.click(w);
57
- });
58
- e.on("blur", function (w: Input) {
59
- w.blur(w);
60
- });
61
- e.on("change", function (w: Input) {
62
- context.value([e.property("value")]);
63
- w.change(w, true);
64
- });
65
- e.on("keyup", function (w: Input) {
66
- context.value([e.property("value")]);
67
- w.change(w, false);
68
- });
69
- });
70
- }
71
-
72
- update(domNode, element) {
73
- super.update(domNode, element);
74
-
75
- this._labelElement[0]
76
- .style("visibility", this.inlineLabel_exists() ? "visible" : "hidden")
77
- .text(this.inlineLabel())
78
- ;
79
- switch (this.type()) {
80
- case "button":
81
- this._inputElement[0].text(this.value());
82
- break;
83
- case "textarea":
84
- this._inputElement[0].property("value", this.value());
85
- break;
86
- default:
87
- this._inputElement[0].attr("type", this.type());
88
- this._inputElement[0].property("value", this.value());
89
- break;
90
- }
91
- }
92
-
93
- // IInput Events ---
94
- blur(w: Input) {
95
- }
96
- keyup(w: Input) {
97
- }
98
- focus(w: Input) {
99
- }
100
- click(w: Input) {
101
- }
102
- dblclick(w: Input) {
103
- }
104
- change(w: Input, complete: boolean) {
105
- }
106
- }
107
- Input.prototype._class += " form_Input";
108
- Input.prototype.implements(IInput.prototype);
109
-
110
- export interface Input {
111
- // IInput ---
112
- name(): string;
113
- name(_: string): this;
114
- name_exists(): boolean;
115
- label(): string;
116
- label(_: string): this;
117
- label_exists(): boolean;
118
- value(): any;
119
- value(_: any): this;
120
- value_exists(): boolean;
121
- validate(): string;
122
- validate(_: string): this;
123
- validate_exists(): boolean;
124
-
125
- // Properties ---
126
- type(): Database.FieldType | "button" | "checkbox" | "text" | "textarea" | "search" | "email" | "datetime";
127
- type(_: Database.FieldType | "button" | "checkbox" | "text" | "textarea" | "search" | "email" | "datetime"): this;
128
- type_exists(): boolean;
129
- type_default(): string;
130
- inlineLabel(): string;
131
- inlineLabel(_: string): this;
132
- inlineLabel_exists(): boolean;
133
- }
134
-
135
- Input.prototype.publish("type", "text", "set", "Input type", ["string", "number", "boolean", "date", "time", "hidden", "nested", "button", "checkbox", "text", "textarea", "search", "email", "datetime"]);
136
- Input.prototype.publish("inlineLabel", null, "string", "Input Label", null, { optional: true });
1
+ import { IInput } from "@hpcc-js/api";
2
+ import { Database, HTMLWidget } from "@hpcc-js/common";
3
+
4
+ import "../src/Input.css";
5
+
6
+ export class Input extends HTMLWidget {
7
+ _inputElement = [];
8
+ _labelElement = [];
9
+
10
+ constructor() {
11
+ super();
12
+ IInput.call(this);
13
+
14
+ this._tag = "div";
15
+ }
16
+
17
+ checked(_) {
18
+ if (!arguments.length) return this._inputElement[0] ? this._inputElement[0].property("checked") : false;
19
+ if (this._inputElement[0]) {
20
+ this._inputElement[0].property("checked", _);
21
+ }
22
+ return this;
23
+ }
24
+
25
+ enter(domNode, element) {
26
+ super.enter(domNode, element);
27
+
28
+ this._labelElement[0] = element.append("label")
29
+ .attr("for", this.id() + "_input")
30
+ .style("visibility", this.inlineLabel_exists() ? "visible" : "hidden")
31
+ ;
32
+
33
+ const context = this;
34
+ switch (this.type()) {
35
+ case "button":
36
+ this._inputElement[0] = element.append("button")
37
+ .attr("id", this.id() + "_input")
38
+ ;
39
+ break;
40
+ case "textarea":
41
+ this._inputElement[0] = element.append("textarea")
42
+ .attr("id", this.id() + "_input")
43
+ ;
44
+ break;
45
+ default:
46
+ this._inputElement[0] = element.append("input")
47
+ .attr("id", this.id() + "_input")
48
+ .attr("type", this.type())
49
+ ;
50
+ break;
51
+ }
52
+
53
+ this._inputElement.forEach(function (e, idx) {
54
+ e.attr("name", context.name());
55
+ e.on("click", function (w: Input) {
56
+ w.click(w);
57
+ });
58
+ e.on("blur", function (w: Input) {
59
+ w.blur(w);
60
+ });
61
+ e.on("change", function (w: Input) {
62
+ context.value([e.property("value")]);
63
+ w.change(w, true);
64
+ });
65
+ e.on("keyup", function (w: Input) {
66
+ context.value([e.property("value")]);
67
+ w.change(w, false);
68
+ });
69
+ });
70
+ }
71
+
72
+ update(domNode, element) {
73
+ super.update(domNode, element);
74
+
75
+ this._labelElement[0]
76
+ .style("visibility", this.inlineLabel_exists() ? "visible" : "hidden")
77
+ .text(this.inlineLabel())
78
+ ;
79
+ switch (this.type()) {
80
+ case "button":
81
+ this._inputElement[0].text(this.value());
82
+ break;
83
+ case "textarea":
84
+ this._inputElement[0].property("value", this.value());
85
+ break;
86
+ default:
87
+ this._inputElement[0].attr("type", this.type());
88
+ this._inputElement[0].property("value", this.value());
89
+ break;
90
+ }
91
+ }
92
+
93
+ // IInput Events ---
94
+ blur(w: Input) {
95
+ }
96
+ keyup(w: Input) {
97
+ }
98
+ focus(w: Input) {
99
+ }
100
+ click(w: Input) {
101
+ }
102
+ dblclick(w: Input) {
103
+ }
104
+ change(w: Input, complete: boolean) {
105
+ }
106
+ }
107
+ Input.prototype._class += " form_Input";
108
+ Input.prototype.implements(IInput.prototype);
109
+
110
+ export interface Input {
111
+ // IInput ---
112
+ name(): string;
113
+ name(_: string): this;
114
+ name_exists(): boolean;
115
+ label(): string;
116
+ label(_: string): this;
117
+ label_exists(): boolean;
118
+ value(): any;
119
+ value(_: any): this;
120
+ value_exists(): boolean;
121
+ validate(): string;
122
+ validate(_: string): this;
123
+ validate_exists(): boolean;
124
+
125
+ // Properties ---
126
+ type(): Database.FieldType | "button" | "checkbox" | "text" | "textarea" | "search" | "email" | "datetime";
127
+ type(_: Database.FieldType | "button" | "checkbox" | "text" | "textarea" | "search" | "email" | "datetime"): this;
128
+ type_exists(): boolean;
129
+ type_default(): string;
130
+ inlineLabel(): string;
131
+ inlineLabel(_: string): this;
132
+ inlineLabel_exists(): boolean;
133
+ }
134
+
135
+ Input.prototype.publish("type", "text", "set", "Input type", ["string", "number", "boolean", "date", "time", "hidden", "nested", "button", "checkbox", "text", "textarea", "search", "email", "datetime"]);
136
+ Input.prototype.publish("inlineLabel", null, "string", "Input Label", null, { optional: true });
package/src/InputRange.ts CHANGED
@@ -1,95 +1,95 @@
1
- import { IInput } from "@hpcc-js/api";
2
- import { HTMLWidget } from "@hpcc-js/common";
3
-
4
- import "../src/Input.css";
5
-
6
- export class InputRange extends HTMLWidget {
7
- _inputElement = [];
8
- _labelElement = [];
9
- _rangeData = [];
10
-
11
- constructor() {
12
- super();
13
- IInput.call(this);
14
-
15
- this._tag = "div";
16
- }
17
-
18
- enter(domNode, element) {
19
- super.enter(domNode, element);
20
-
21
- this._labelElement[0] = element.append("label")
22
- .attr("for", this.id() + "_input")
23
- .style("visibility", this.inlineLabel_exists() ? "visible" : "hidden")
24
- ;
25
-
26
- this._inputElement.push(element.append("input")
27
- .attr("id", this.id() + "_input_min")
28
- .attr("type", this.type()));
29
- this._inputElement.push(element.append("input")
30
- .attr("id", this.id() + "_input_max")
31
- .attr("type", this.type()));
32
-
33
- const context = this;
34
- this._inputElement.forEach(function (e, idx) {
35
- e.attr("name", context.name());
36
- e.on("click", function (w) {
37
- w.click(w);
38
- });
39
- e.on("blur", function (w) {
40
- w.blur(w);
41
- });
42
- e.on("change", function (w) {
43
- context._rangeData[idx] = e.property("value");
44
- context.value(context._rangeData);
45
- w.change(w, true);
46
- });
47
- });
48
- }
49
-
50
- update(domNode, element) {
51
- super.update(domNode, element);
52
-
53
- this._labelElement[0]
54
- .style("visibility", this.inlineLabel_exists() ? "visible" : "hidden")
55
- .text(this.inlineLabel())
56
- ;
57
-
58
- this._rangeData = this.value();
59
- this._inputElement.forEach(function (e, idx) {
60
- e
61
- .attr("type", this.type())
62
- .property("value", this._rangeData.length > idx ? this._rangeData[idx] : "");
63
- }, this);
64
- }
65
- }
66
- InputRange.prototype._class += " form_InputRange";
67
- InputRange.prototype.implements(IInput.prototype);
68
-
69
- export interface InputRange {
70
- // IInput ---
71
- name(): string;
72
- name(_: string): this;
73
- name_exists(): boolean;
74
- label(): string;
75
- label(_: string): this;
76
- label_exists(): boolean;
77
- value(): any[];
78
- value(_: any[]): this;
79
- value_exists(): boolean;
80
- validate(): string;
81
- validate(_: string): this;
82
- validate_exists(): boolean;
83
-
84
- // Properties ---
85
- type(): string;
86
- type(_: string): this;
87
- type_exists(): boolean;
88
- inlineLabel(): string;
89
- inlineLabel(_: string): this;
90
- inlineLabel_exists(): boolean;
91
- }
92
-
93
- InputRange.prototype.publish("type", "text", "set", "InputRange type", ["number", "date", "text", "time", "datetime", "hidden"]);
94
- InputRange.prototype.publish("inlineLabel", null, "string", "InputRange Label", null, { optional: true });
95
- InputRange.prototype.publish("value", ["", ""], "array", "Input Current Value", null, { override: 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 InputRange extends HTMLWidget {
7
+ _inputElement = [];
8
+ _labelElement = [];
9
+ _rangeData = [];
10
+
11
+ constructor() {
12
+ super();
13
+ IInput.call(this);
14
+
15
+ this._tag = "div";
16
+ }
17
+
18
+ enter(domNode, element) {
19
+ super.enter(domNode, element);
20
+
21
+ this._labelElement[0] = element.append("label")
22
+ .attr("for", this.id() + "_input")
23
+ .style("visibility", this.inlineLabel_exists() ? "visible" : "hidden")
24
+ ;
25
+
26
+ this._inputElement.push(element.append("input")
27
+ .attr("id", this.id() + "_input_min")
28
+ .attr("type", this.type()));
29
+ this._inputElement.push(element.append("input")
30
+ .attr("id", this.id() + "_input_max")
31
+ .attr("type", this.type()));
32
+
33
+ const context = this;
34
+ this._inputElement.forEach(function (e, idx) {
35
+ e.attr("name", context.name());
36
+ e.on("click", function (w) {
37
+ w.click(w);
38
+ });
39
+ e.on("blur", function (w) {
40
+ w.blur(w);
41
+ });
42
+ e.on("change", function (w) {
43
+ context._rangeData[idx] = e.property("value");
44
+ context.value(context._rangeData);
45
+ w.change(w, true);
46
+ });
47
+ });
48
+ }
49
+
50
+ update(domNode, element) {
51
+ super.update(domNode, element);
52
+
53
+ this._labelElement[0]
54
+ .style("visibility", this.inlineLabel_exists() ? "visible" : "hidden")
55
+ .text(this.inlineLabel())
56
+ ;
57
+
58
+ this._rangeData = this.value();
59
+ this._inputElement.forEach(function (e, idx) {
60
+ e
61
+ .attr("type", this.type())
62
+ .property("value", this._rangeData.length > idx ? this._rangeData[idx] : "");
63
+ }, this);
64
+ }
65
+ }
66
+ InputRange.prototype._class += " form_InputRange";
67
+ InputRange.prototype.implements(IInput.prototype);
68
+
69
+ export interface InputRange {
70
+ // IInput ---
71
+ name(): string;
72
+ name(_: string): this;
73
+ name_exists(): boolean;
74
+ label(): string;
75
+ label(_: string): this;
76
+ label_exists(): boolean;
77
+ value(): any[];
78
+ value(_: any[]): this;
79
+ value_exists(): boolean;
80
+ validate(): string;
81
+ validate(_: string): this;
82
+ validate_exists(): boolean;
83
+
84
+ // Properties ---
85
+ type(): string;
86
+ type(_: string): this;
87
+ type_exists(): boolean;
88
+ inlineLabel(): string;
89
+ inlineLabel(_: string): this;
90
+ inlineLabel_exists(): boolean;
91
+ }
92
+
93
+ InputRange.prototype.publish("type", "text", "set", "InputRange type", ["number", "date", "text", "time", "datetime", "hidden"]);
94
+ InputRange.prototype.publish("inlineLabel", null, "string", "InputRange Label", null, { optional: true });
95
+ InputRange.prototype.publish("value", ["", ""], "array", "Input Current Value", null, { override: true });