@gpa-gemstone/react-forms 1.1.8 → 1.1.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/README.md CHANGED
@@ -1,38 +1,38 @@
1
- # react-forms
2
-
3
- ![gemstone logo](https://raw.githubusercontent.com/gemstone/web/master/docs/img/gemstone-wide-600.png)
4
-
5
- The Gemstone Web Library organizes all Gemstone functionality related to web.
6
-
7
- [![GitHub license](https://img.shields.io/github/license/gemstone/web?color=4CC61E)](https://github.com/gemstone/web/blob/master/LICENSE)
8
-
9
- This library includes helpful npm package for creating strongly typed form components in react.
10
-
11
- * Input
12
- * CheckBox
13
- * TextArea
14
- * DatePicker
15
- * Select
16
- * EnumCheckBoxes
17
- * DateRangePicker
18
- * ArrayCheckBoxes
19
- * ArrayMultiSelect
20
- * MultiCheckBoxSelect
21
- * DoubleInput
22
-
23
- ## Usage
24
-
25
- ```ts
26
- interface iType = { Field1: string, Field2: number, Field3: boolean, Field4: string, Field5: string, EnumField: number, FromField: string, ToField: string}
27
- let record:iType = {Field1: 'Hello', Field2: 1, Field3: false, Field4: 'alot of text blah blah blah', Field5: '01/01/2021', FromField: '01/01/2020', ToField: '01/01/2021'}
28
- let options = [{Value: 1, Label: 'first'}, {Value:2, Label: 'second'}]
29
-
30
- <Input<iType> Record={record} Field="Field1" Setter={(event) => record.Field1 = event.target.value} Valid={(field) => /*some criteria*/}>
31
- <CheckBox<iType> Record={record} Field="Field3" Setter={(event) => record.Field3 = event.target.value}}>
32
- <Select<iType> Record={record} Field="Field2" Setter={(event) => record.Field3 = event.target.value}} Options={options}>
33
- <TextArea<iType> Record={record} Field="Field4" Setter={(event) => record.Field1 = event.target.value} Valid={(field) => /*some criteria*/}>
34
- <DatePicker<iType> Record={record} Field="Field5" Setter={(event) => record.Field1 = event.target.value}>
35
- <DateRangePicker<iType> Record={record} FromField="FromField" ToField="ToField" Label="Date Range" Setter={(event) => record.Field1 = event.target.value}>
36
- <EnumCheckBoxes<iType> Record={record} Field="EnumField" Setter={(event) => record.Field3 = event.target.value}} Enum={['Monday', 'Tuesday','Wednesday']}>
37
- <DoubleInput<iType> Record={record} Field1="Field4" Field1="Field5" Setter={(r) => record = r} Valid={(field) => /*some criteria*/}>
38
- ```
1
+ # react-forms
2
+
3
+ ![gemstone logo](https://raw.githubusercontent.com/gemstone/web/master/docs/img/gemstone-wide-600.png)
4
+
5
+ The Gemstone Web Library organizes all Gemstone functionality related to web.
6
+
7
+ [![GitHub license](https://img.shields.io/github/license/gemstone/web?color=4CC61E)](https://github.com/gemstone/web/blob/master/LICENSE)
8
+
9
+ This library includes helpful npm package for creating strongly typed form components in react.
10
+
11
+ * Input
12
+ * CheckBox
13
+ * TextArea
14
+ * DatePicker
15
+ * Select
16
+ * EnumCheckBoxes
17
+ * DateRangePicker
18
+ * ArrayCheckBoxes
19
+ * ArrayMultiSelect
20
+ * MultiCheckBoxSelect
21
+ * DoubleInput
22
+
23
+ ## Usage
24
+
25
+ ```ts
26
+ interface iType = { Field1: string, Field2: number, Field3: boolean, Field4: string, Field5: string, EnumField: number, FromField: string, ToField: string}
27
+ let record:iType = {Field1: 'Hello', Field2: 1, Field3: false, Field4: 'alot of text blah blah blah', Field5: '01/01/2021', FromField: '01/01/2020', ToField: '01/01/2021'}
28
+ let options = [{Value: 1, Label: 'first'}, {Value:2, Label: 'second'}]
29
+
30
+ <Input<iType> Record={record} Field="Field1" Setter={(event) => record.Field1 = event.target.value} Valid={(field) => /*some criteria*/}>
31
+ <CheckBox<iType> Record={record} Field="Field3" Setter={(event) => record.Field3 = event.target.value}}>
32
+ <Select<iType> Record={record} Field="Field2" Setter={(event) => record.Field3 = event.target.value}} Options={options}>
33
+ <TextArea<iType> Record={record} Field="Field4" Setter={(event) => record.Field1 = event.target.value} Valid={(field) => /*some criteria*/}>
34
+ <DatePicker<iType> Record={record} Field="Field5" Setter={(event) => record.Field1 = event.target.value}>
35
+ <DateRangePicker<iType> Record={record} FromField="FromField" ToField="ToField" Label="Date Range" Setter={(event) => record.Field1 = event.target.value}>
36
+ <EnumCheckBoxes<iType> Record={record} Field="EnumField" Setter={(event) => record.Field3 = event.target.value}} Enum={['Monday', 'Tuesday','Wednesday']}>
37
+ <DoubleInput<iType> Record={record} Field1="Field4" Field1="Field5" Setter={(r) => record = r} Valid={(field) => /*some criteria*/}>
38
+ ```
@@ -1,11 +1,11 @@
1
- /// <reference types="react" />
2
- export default function ArrayCheckBoxes<T>(props: {
3
- Record: T;
4
- Field: keyof T;
5
- Setter: (record: T) => void;
6
- Checkboxes: {
7
- ID: string;
8
- Label: string;
9
- }[];
10
- Label?: string;
11
- }): JSX.Element;
1
+ /// <reference types="react" />
2
+ export default function ArrayCheckBoxes<T>(props: {
3
+ Record: T;
4
+ Field: keyof T;
5
+ Setter: (record: T) => void;
6
+ Checkboxes: {
7
+ ID: string;
8
+ Label: string;
9
+ }[];
10
+ Label?: string;
11
+ }): JSX.Element;
@@ -1,75 +1,73 @@
1
- "use strict";
2
- // ******************************************************************************************************
3
- // ArrayCheckBoxes.tsx - Gbtc
4
- //
5
- // Copyright © 2020, Grid Protection Alliance. All Rights Reserved.
6
- //
7
- // Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
8
- // the NOTICE file distributed with this work for additional information regarding copyright ownership.
9
- // The GPA licenses this file to you under the MIT License (MIT), the "License"; you may not use this
10
- // file except in compliance with the License. You may obtain a copy of the License at:
11
- //
12
- // http://opensource.org/licenses/MIT
13
- //
14
- // Unless agreed to in writing, the subject software distributed under the License is distributed on an
15
- // "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
16
- // License for the specific language governing permissions and limitations.
17
- //
18
- // Code Modification History:
19
- // ----------------------------------------------------------------------------------------------------
20
- // 01/22/2020 - Billy Ernest
21
- // Generated original version of source code.
22
- //
23
- // ******************************************************************************************************
24
- var __assign = (this && this.__assign) || function () {
25
- __assign = Object.assign || function(t) {
26
- for (var s, i = 1, n = arguments.length; i < n; i++) {
27
- s = arguments[i];
28
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
29
- t[p] = s[p];
30
- }
31
- return t;
32
- };
33
- return __assign.apply(this, arguments);
34
- };
35
- var __spreadArrays = (this && this.__spreadArrays) || function () {
36
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
37
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
38
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
39
- r[k] = a[j];
40
- return r;
41
- };
42
- Object.defineProperty(exports, "__esModule", { value: true });
43
- var React = require("react");
44
- function ArrayCheckBoxes(props) {
45
- var Remove = function (cb) {
46
- var a = __spreadArrays(props.Record[props.Field]);
47
- var i = a.indexOf(cb.ID);
48
- a.splice(i, 1);
49
- return a;
50
- };
51
- var Add = function (cb) {
52
- var a = __spreadArrays(props.Record[props.Field]);
53
- var i = a.indexOf(cb.ID);
54
- if (i < 0)
55
- a.push(cb.ID);
56
- a.sort();
57
- return a;
58
- };
59
- return (React.createElement("div", { className: "form-group" },
60
- React.createElement("label", null, props.Label == null ? props.Field : props.Label),
61
- React.createElement("br", null),
62
- React.createElement("div", { className: "form-check form-check-inline" },
63
- React.createElement("input", { className: "form-check-input", type: "checkbox", checked: JSON.stringify(props.Record[props.Field]) === JSON.stringify(props.Checkboxes.map(function (x) { return x.ID; })), onChange: function (evt) {
64
- var _a;
65
- return props.Setter(__assign(__assign({}, props.Record), (_a = {}, _a[props.Field] = evt.target.checked ? props.Checkboxes.map(function (x) { return x.ID; }) : [], _a)));
66
- } }),
67
- React.createElement("label", { className: "form-check-label" }, "All")),
68
- props.Checkboxes.map(function (cb, i) { return (React.createElement("div", { key: i, className: "form-check form-check-inline" },
69
- React.createElement("input", { className: "form-check-input", type: "checkbox", checked: props.Record[props.Field].find(function (x) { return cb.ID === x; }) !== undefined, onChange: function (evt) {
70
- var _a;
71
- return props.Setter(__assign(__assign({}, props.Record), (_a = {}, _a[props.Field] = evt.target.checked ? Add(cb) : Remove(cb), _a)));
72
- } }),
73
- React.createElement("label", { className: "form-check-label" }, cb.Label))); })));
74
- }
75
- exports.default = ArrayCheckBoxes;
1
+ "use strict";
2
+ // ******************************************************************************************************
3
+ // ArrayCheckBoxes.tsx - Gbtc
4
+ //
5
+ // Copyright © 2020, Grid Protection Alliance. All Rights Reserved.
6
+ //
7
+ // Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
8
+ // the NOTICE file distributed with this work for additional information regarding copyright ownership.
9
+ // The GPA licenses this file to you under the MIT License (MIT), the "License"; you may not use this
10
+ // file except in compliance with the License. You may obtain a copy of the License at:
11
+ //
12
+ // http://opensource.org/licenses/MIT
13
+ //
14
+ // Unless agreed to in writing, the subject software distributed under the License is distributed on an
15
+ // "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
16
+ // License for the specific language governing permissions and limitations.
17
+ //
18
+ // Code Modification History:
19
+ // ----------------------------------------------------------------------------------------------------
20
+ // 01/22/2020 - Billy Ernest
21
+ // Generated original version of source code.
22
+ //
23
+ // ******************************************************************************************************
24
+ var __assign = (this && this.__assign) || function () {
25
+ __assign = Object.assign || function(t) {
26
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
27
+ s = arguments[i];
28
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
29
+ t[p] = s[p];
30
+ }
31
+ return t;
32
+ };
33
+ return __assign.apply(this, arguments);
34
+ };
35
+ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
36
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
37
+ to[j] = from[i];
38
+ return to;
39
+ };
40
+ Object.defineProperty(exports, "__esModule", { value: true });
41
+ var React = require("react");
42
+ function ArrayCheckBoxes(props) {
43
+ var Remove = function (cb) {
44
+ var a = __spreadArray([], props.Record[props.Field]);
45
+ var i = a.indexOf(cb.ID);
46
+ a.splice(i, 1);
47
+ return a;
48
+ };
49
+ var Add = function (cb) {
50
+ var a = __spreadArray([], props.Record[props.Field]);
51
+ var i = a.indexOf(cb.ID);
52
+ if (i < 0)
53
+ a.push(cb.ID);
54
+ a.sort();
55
+ return a;
56
+ };
57
+ return (React.createElement("div", { className: "form-group" },
58
+ React.createElement("label", null, props.Label == null ? props.Field : props.Label),
59
+ React.createElement("br", null),
60
+ React.createElement("div", { className: "form-check form-check-inline" },
61
+ React.createElement("input", { className: "form-check-input", type: "checkbox", checked: JSON.stringify(props.Record[props.Field]) === JSON.stringify(props.Checkboxes.map(function (x) { return x.ID; })), onChange: function (evt) {
62
+ var _a;
63
+ return props.Setter(__assign(__assign({}, props.Record), (_a = {}, _a[props.Field] = evt.target.checked ? props.Checkboxes.map(function (x) { return x.ID; }) : [], _a)));
64
+ } }),
65
+ React.createElement("label", { className: "form-check-label" }, "All")),
66
+ props.Checkboxes.map(function (cb, i) { return (React.createElement("div", { key: i, className: "form-check form-check-inline" },
67
+ React.createElement("input", { className: "form-check-input", type: "checkbox", checked: props.Record[props.Field].find(function (x) { return cb.ID === x; }) !== undefined, onChange: function (evt) {
68
+ var _a;
69
+ return props.Setter(__assign(__assign({}, props.Record), (_a = {}, _a[props.Field] = evt.target.checked ? Add(cb) : Remove(cb), _a)));
70
+ } }),
71
+ React.createElement("label", { className: "form-check-label" }, cb.Label))); })));
72
+ }
73
+ exports.default = ArrayCheckBoxes;
@@ -1,13 +1,13 @@
1
- import * as React from 'react';
2
- export default function ArrayMultiSelect<T>(props: {
3
- Record: T;
4
- Field: keyof T;
5
- Setter: (record: T) => void;
6
- Options: {
7
- Value: string;
8
- Label: string;
9
- }[];
10
- Label?: string;
11
- Disabled?: boolean;
12
- Style?: React.CSSProperties;
13
- }): JSX.Element;
1
+ import * as React from 'react';
2
+ export default function ArrayMultiSelect<T>(props: {
3
+ Record: T;
4
+ Field: keyof T;
5
+ Setter: (record: T) => void;
6
+ Options: {
7
+ Value: string;
8
+ Label: string;
9
+ }[];
10
+ Label?: string;
11
+ Disabled?: boolean;
12
+ Style?: React.CSSProperties;
13
+ }): JSX.Element;
@@ -1,47 +1,47 @@
1
- "use strict";
2
- // ******************************************************************************************************
3
- // ArrayMultiSelect.tsx - Gbtc
4
- //
5
- // Copyright © 2020, Grid Protection Alliance. All Rights Reserved.
6
- //
7
- // Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
8
- // the NOTICE file distributed with this work for additional information regarding copyright ownership.
9
- // The GPA licenses this file to you under the MIT License (MIT), the "License"; you may not use this
10
- // file except in compliance with the License. You may obtain a copy of the License at:
11
- //
12
- // http://opensource.org/licenses/MIT
13
- //
14
- // Unless agreed to in writing, the subject software distributed under the License is distributed on an
15
- // "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
16
- // License for the specific language governing permissions and limitations.
17
- //
18
- // Code Modification History:
19
- // ----------------------------------------------------------------------------------------------------
20
- // 01/22/2020 - Billy Ernest
21
- // Generated original version of source code.
22
- //
23
- // ******************************************************************************************************
24
- var __assign = (this && this.__assign) || function () {
25
- __assign = Object.assign || function(t) {
26
- for (var s, i = 1, n = arguments.length; i < n; i++) {
27
- s = arguments[i];
28
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
29
- t[p] = s[p];
30
- }
31
- return t;
32
- };
33
- return __assign.apply(this, arguments);
34
- };
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- var React = require("react");
37
- function ArrayMultiSelect(props) {
38
- var _a;
39
- return (React.createElement("div", { className: "form-group" },
40
- React.createElement("label", null, props.Label == null ? props.Field : props.Label),
41
- React.createElement("select", { multiple: true, className: "form-control", onChange: function (evt) {
42
- var _a;
43
- var record = __assign(__assign({}, props.Record), (_a = {}, _a[props.Field] = Array.from(evt.target.selectedOptions).map(function (a) { return a.value; }), _a));
44
- props.Setter(record);
45
- }, value: (_a = props.Record[props.Field]) !== null && _a !== void 0 ? _a : [], disabled: props.Disabled == null ? false : props.Disabled, style: props.Style }, props.Options.map(function (a, i) { return (React.createElement("option", { key: i, value: a.Value }, a.Label)); }))));
46
- }
47
- exports.default = ArrayMultiSelect;
1
+ "use strict";
2
+ // ******************************************************************************************************
3
+ // ArrayMultiSelect.tsx - Gbtc
4
+ //
5
+ // Copyright © 2020, Grid Protection Alliance. All Rights Reserved.
6
+ //
7
+ // Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
8
+ // the NOTICE file distributed with this work for additional information regarding copyright ownership.
9
+ // The GPA licenses this file to you under the MIT License (MIT), the "License"; you may not use this
10
+ // file except in compliance with the License. You may obtain a copy of the License at:
11
+ //
12
+ // http://opensource.org/licenses/MIT
13
+ //
14
+ // Unless agreed to in writing, the subject software distributed under the License is distributed on an
15
+ // "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
16
+ // License for the specific language governing permissions and limitations.
17
+ //
18
+ // Code Modification History:
19
+ // ----------------------------------------------------------------------------------------------------
20
+ // 01/22/2020 - Billy Ernest
21
+ // Generated original version of source code.
22
+ //
23
+ // ******************************************************************************************************
24
+ var __assign = (this && this.__assign) || function () {
25
+ __assign = Object.assign || function(t) {
26
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
27
+ s = arguments[i];
28
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
29
+ t[p] = s[p];
30
+ }
31
+ return t;
32
+ };
33
+ return __assign.apply(this, arguments);
34
+ };
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ var React = require("react");
37
+ function ArrayMultiSelect(props) {
38
+ var _a;
39
+ return (React.createElement("div", { className: "form-group" },
40
+ React.createElement("label", null, props.Label == null ? props.Field : props.Label),
41
+ React.createElement("select", { multiple: true, className: "form-control", onChange: function (evt) {
42
+ var _a;
43
+ var record = __assign(__assign({}, props.Record), (_a = {}, _a[props.Field] = Array.from(evt.target.selectedOptions).map(function (a) { return a.value; }), _a));
44
+ props.Setter(record);
45
+ }, value: (_a = props.Record[props.Field]) !== null && _a !== void 0 ? _a : [], disabled: props.Disabled == null ? false : props.Disabled, style: props.Style }, props.Options.map(function (a, i) { return (React.createElement("option", { key: i, value: a.Value }, a.Label)); }))));
46
+ }
47
+ exports.default = ArrayMultiSelect;
package/lib/CheckBox.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import * as React from 'react';
2
- export default class CheckBox<T> extends React.Component<{
3
- Record: T;
4
- Field: keyof T;
5
- Setter: (record: T) => void;
6
- Label?: string;
7
- Disabled?: boolean;
8
- }, {}, {}> {
9
- render(): JSX.Element;
10
- }
1
+ import * as React from 'react';
2
+ export default class CheckBox<T> extends React.Component<{
3
+ Record: T;
4
+ Field: keyof T;
5
+ Setter: (record: T) => void;
6
+ Label?: string;
7
+ Disabled?: boolean;
8
+ }, {}, {}> {
9
+ render(): JSX.Element;
10
+ }
package/lib/CheckBox.js CHANGED
@@ -1,67 +1,69 @@
1
- "use strict";
2
- // ******************************************************************************************************
3
- // CheckBox.tsx - Gbtc
4
- //
5
- // Copyright © 2020, Grid Protection Alliance. All Rights Reserved.
6
- //
7
- // Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
8
- // the NOTICE file distributed with this work for additional information regarding copyright ownership.
9
- // The GPA licenses this file to you under the MIT License (MIT), the "License"; you may not use this
10
- // file except in compliance with the License. You may obtain a copy of the License at:
11
- //
12
- // http://opensource.org/licenses/MIT
13
- //
14
- // Unless agreed to in writing, the subject software distributed under the License is distributed on an
15
- // "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
16
- // License for the specific language governing permissions and limitations.
17
- //
18
- // Code Modification History:
19
- // ----------------------------------------------------------------------------------------------------
20
- // 01/22/2020 - Billy Ernest
21
- // Generated original version of source code.
22
- //
23
- // ******************************************************************************************************
24
- var __extends = (this && this.__extends) || (function () {
25
- var extendStatics = function (d, b) {
26
- extendStatics = Object.setPrototypeOf ||
27
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
28
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
29
- return extendStatics(d, b);
30
- };
31
- return function (d, b) {
32
- extendStatics(d, b);
33
- function __() { this.constructor = d; }
34
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
35
- };
36
- })();
37
- var __assign = (this && this.__assign) || function () {
38
- __assign = Object.assign || function(t) {
39
- for (var s, i = 1, n = arguments.length; i < n; i++) {
40
- s = arguments[i];
41
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
42
- t[p] = s[p];
43
- }
44
- return t;
45
- };
46
- return __assign.apply(this, arguments);
47
- };
48
- Object.defineProperty(exports, "__esModule", { value: true });
49
- var React = require("react");
50
- var CheckBox = /** @class */ (function (_super) {
51
- __extends(CheckBox, _super);
52
- function CheckBox() {
53
- return _super !== null && _super.apply(this, arguments) || this;
54
- }
55
- CheckBox.prototype.render = function () {
56
- var _this = this;
57
- return (React.createElement("div", { className: "form-check" },
58
- React.createElement("input", { type: "checkbox", className: "form-check-input", style: { zIndex: 1 }, onChange: function (evt) {
59
- var record = __assign({}, _this.props.Record);
60
- record[_this.props.Field] = evt.target.checked;
61
- _this.props.Setter(record);
62
- }, value: this.props.Record[this.props.Field] ? 'on' : 'off', checked: this.props.Record[this.props.Field] ? true : false, disabled: this.props.Disabled == null ? false : this.props.Disabled }),
63
- React.createElement("label", { className: "form-check-label" }, this.props.Label == null ? this.props.Field : this.props.Label)));
64
- };
65
- return CheckBox;
66
- }(React.Component));
67
- exports.default = CheckBox;
1
+ "use strict";
2
+ // ******************************************************************************************************
3
+ // CheckBox.tsx - Gbtc
4
+ //
5
+ // Copyright © 2020, Grid Protection Alliance. All Rights Reserved.
6
+ //
7
+ // Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
8
+ // the NOTICE file distributed with this work for additional information regarding copyright ownership.
9
+ // The GPA licenses this file to you under the MIT License (MIT), the "License"; you may not use this
10
+ // file except in compliance with the License. You may obtain a copy of the License at:
11
+ //
12
+ // http://opensource.org/licenses/MIT
13
+ //
14
+ // Unless agreed to in writing, the subject software distributed under the License is distributed on an
15
+ // "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
16
+ // License for the specific language governing permissions and limitations.
17
+ //
18
+ // Code Modification History:
19
+ // ----------------------------------------------------------------------------------------------------
20
+ // 01/22/2020 - Billy Ernest
21
+ // Generated original version of source code.
22
+ //
23
+ // ******************************************************************************************************
24
+ var __extends = (this && this.__extends) || (function () {
25
+ var extendStatics = function (d, b) {
26
+ extendStatics = Object.setPrototypeOf ||
27
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
28
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
29
+ return extendStatics(d, b);
30
+ };
31
+ return function (d, b) {
32
+ if (typeof b !== "function" && b !== null)
33
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
34
+ extendStatics(d, b);
35
+ function __() { this.constructor = d; }
36
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
37
+ };
38
+ })();
39
+ var __assign = (this && this.__assign) || function () {
40
+ __assign = Object.assign || function(t) {
41
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
42
+ s = arguments[i];
43
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
44
+ t[p] = s[p];
45
+ }
46
+ return t;
47
+ };
48
+ return __assign.apply(this, arguments);
49
+ };
50
+ Object.defineProperty(exports, "__esModule", { value: true });
51
+ var React = require("react");
52
+ var CheckBox = /** @class */ (function (_super) {
53
+ __extends(CheckBox, _super);
54
+ function CheckBox() {
55
+ return _super !== null && _super.apply(this, arguments) || this;
56
+ }
57
+ CheckBox.prototype.render = function () {
58
+ var _this = this;
59
+ return (React.createElement("div", { className: "form-check" },
60
+ React.createElement("input", { type: "checkbox", className: "form-check-input", style: { zIndex: 1 }, onChange: function (evt) {
61
+ var record = __assign({}, _this.props.Record);
62
+ record[_this.props.Field] = evt.target.checked;
63
+ _this.props.Setter(record);
64
+ }, value: this.props.Record[this.props.Field] ? 'on' : 'off', checked: this.props.Record[this.props.Field] ? true : false, disabled: this.props.Disabled == null ? false : this.props.Disabled }),
65
+ React.createElement("label", { className: "form-check-label" }, this.props.Label == null ? this.props.Field : this.props.Label)));
66
+ };
67
+ return CheckBox;
68
+ }(React.Component));
69
+ exports.default = CheckBox;
@@ -1,10 +1,10 @@
1
- import * as React from 'react';
2
- export default class DatePicker<T> extends React.Component<{
3
- Record: T;
4
- Field: keyof T;
5
- Setter: (record: T) => void;
6
- Label?: string;
7
- Disabled?: boolean;
8
- }, {}, {}> {
9
- render(): JSX.Element;
10
- }
1
+ import * as React from 'react';
2
+ export default class DatePicker<T> extends React.Component<{
3
+ Record: T;
4
+ Field: keyof T;
5
+ Setter: (record: T) => void;
6
+ Label?: string;
7
+ Disabled?: boolean;
8
+ }, {}, {}> {
9
+ render(): JSX.Element;
10
+ }