@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.
@@ -1,51 +1,51 @@
1
- "use strict";
2
- // ******************************************************************************************************
3
- // DoubleInput.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/07/2021 - C. Lackner
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 DoubleInput(props) {
38
- return (React.createElement("div", { className: "form-group" },
39
- React.createElement("label", null, props.Label == null ? (props.Field1 + ' ' + props.Field2) : props.Label),
40
- React.createElement("div", { className: "input-group" },
41
- React.createElement("input", { type: props.Type === undefined ? 'text' : props.Type, className: props.Valid(props.Field1) ? 'form-control' : 'form-control is-invalid', onChange: function (evt) {
42
- var _a;
43
- return props.Setter(__assign(__assign({}, props.Record), (_a = {}, _a[props.Field1] = evt.target.value !== '' ? evt.target.value : null, _a)));
44
- }, value: props.Record[props.Field1] == null ? '' : props.Record[props.Field1].toString(), disabled: props.Disabled == null ? false : props.Disabled }),
45
- React.createElement("input", { type: props.Type === undefined ? 'text' : props.Type, className: props.Valid(props.Field2) ? 'form-control' : 'form-control is-invalid', onChange: function (evt) {
46
- var _a;
47
- return props.Setter(__assign(__assign({}, props.Record), (_a = {}, _a[props.Field2] = evt.target.value !== '' ? evt.target.value : null, _a)));
48
- }, value: props.Record[props.Field2] == null ? '' : props.Record[props.Field2].toString(), disabled: props.Disabled == null ? false : props.Disabled })),
49
- React.createElement("div", { className: "invalid-feedback" }, props.Feedback == null ? (props.Field1 + ' ' + props.Field2 + ' is a required field.') : props.Feedback)));
50
- }
51
- exports.default = DoubleInput;
1
+ "use strict";
2
+ // ******************************************************************************************************
3
+ // DoubleInput.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/07/2021 - C. Lackner
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 DoubleInput(props) {
38
+ return (React.createElement("div", { className: "form-group" },
39
+ React.createElement("label", null, props.Label == null ? (props.Field1 + ' ' + props.Field2) : props.Label),
40
+ React.createElement("div", { className: "input-group" },
41
+ React.createElement("input", { type: props.Type === undefined ? 'text' : props.Type, className: props.Valid(props.Field1) ? 'form-control' : 'form-control is-invalid', onChange: function (evt) {
42
+ var _a;
43
+ return props.Setter(__assign(__assign({}, props.Record), (_a = {}, _a[props.Field1] = evt.target.value !== '' ? evt.target.value : null, _a)));
44
+ }, value: props.Record[props.Field1] == null ? '' : props.Record[props.Field1].toString(), disabled: props.Disabled == null ? false : props.Disabled }),
45
+ React.createElement("input", { type: props.Type === undefined ? 'text' : props.Type, className: props.Valid(props.Field2) ? 'form-control' : 'form-control is-invalid', onChange: function (evt) {
46
+ var _a;
47
+ return props.Setter(__assign(__assign({}, props.Record), (_a = {}, _a[props.Field2] = evt.target.value !== '' ? evt.target.value : null, _a)));
48
+ }, value: props.Record[props.Field2] == null ? '' : props.Record[props.Field2].toString(), disabled: props.Disabled == null ? false : props.Disabled })),
49
+ React.createElement("div", { className: "invalid-feedback" }, props.Feedback == null ? (props.Field1 + ' ' + props.Field2 + ' is a required field.') : props.Feedback)));
50
+ }
51
+ exports.default = DoubleInput;
@@ -1,8 +1,8 @@
1
- /// <reference types="react" />
2
- export default function EnumCheckBoxes<T>(props: {
3
- Record: T;
4
- Field: keyof T;
5
- Setter: (record: T) => void;
6
- Enum: string[];
7
- Label?: string;
8
- }): JSX.Element;
1
+ /// <reference types="react" />
2
+ export default function EnumCheckBoxes<T>(props: {
3
+ Record: T;
4
+ Field: keyof T;
5
+ Setter: (record: T) => void;
6
+ Enum: string[];
7
+ Label?: string;
8
+ }): JSX.Element;
@@ -1,58 +1,58 @@
1
- "use strict";
2
- // ******************************************************************************************************
3
- // EnumCheckBoxes.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 EnumCheckBoxes(props) {
38
- /* tslint:disable-next-line:no-bitwise */
39
- var EquateFlag = function (index) { return ((props.Record[props.Field] / Math.pow(2, index)) & 1) !== 0; };
40
- var DecrementFlag = function (index) { return props.Record[props.Field] - Math.pow(2, index); };
41
- var IncrementFlag = function (index) { return props.Record[props.Field] + Math.pow(2, index); };
42
- return (React.createElement("div", { className: "form-group" },
43
- React.createElement("label", null, props.Label == null ? props.Field : props.Label),
44
- React.createElement("br", null),
45
- React.createElement("div", { className: "form-check form-check-inline" },
46
- React.createElement("input", { className: "form-check-input", type: "checkbox", checked: props.Record[props.Field] === (Math.pow(2, props.Enum.length) - 1), onChange: function (evt) {
47
- var _a;
48
- return props.Setter(__assign(__assign({}, props.Record), (_a = {}, _a[props.Field] = evt.target.checked ? Math.pow(2, props.Enum.length) - 1 : 0, _a)));
49
- } }),
50
- React.createElement("label", { className: "form-check-label" }, "All")),
51
- props.Enum.map(function (flag, i) { return (React.createElement("div", { key: i, className: "form-check form-check-inline" },
52
- React.createElement("input", { className: "form-check-input", type: "checkbox", checked: EquateFlag(i), onChange: function (evt) {
53
- var _a;
54
- return props.Setter(__assign(__assign({}, props.Record), (_a = {}, _a[props.Field] = evt.target.checked ? IncrementFlag(i) : DecrementFlag(i), _a)));
55
- } }),
56
- React.createElement("label", { className: "form-check-label" }, flag))); })));
57
- }
58
- exports.default = EnumCheckBoxes;
1
+ "use strict";
2
+ // ******************************************************************************************************
3
+ // EnumCheckBoxes.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 EnumCheckBoxes(props) {
38
+ /* tslint:disable-next-line:no-bitwise */
39
+ var EquateFlag = function (index) { return ((props.Record[props.Field] / Math.pow(2, index)) & 1) !== 0; };
40
+ var DecrementFlag = function (index) { return props.Record[props.Field] - Math.pow(2, index); };
41
+ var IncrementFlag = function (index) { return props.Record[props.Field] + Math.pow(2, index); };
42
+ return (React.createElement("div", { className: "form-group" },
43
+ React.createElement("label", null, props.Label == null ? props.Field : props.Label),
44
+ React.createElement("br", null),
45
+ React.createElement("div", { className: "form-check form-check-inline" },
46
+ React.createElement("input", { className: "form-check-input", type: "checkbox", checked: props.Record[props.Field] === (Math.pow(2, props.Enum.length) - 1), onChange: function (evt) {
47
+ var _a;
48
+ return props.Setter(__assign(__assign({}, props.Record), (_a = {}, _a[props.Field] = evt.target.checked ? Math.pow(2, props.Enum.length) - 1 : 0, _a)));
49
+ } }),
50
+ React.createElement("label", { className: "form-check-label" }, "All")),
51
+ props.Enum.map(function (flag, i) { return (React.createElement("div", { key: i, className: "form-check form-check-inline" },
52
+ React.createElement("input", { className: "form-check-input", type: "checkbox", checked: EquateFlag(i), onChange: function (evt) {
53
+ var _a;
54
+ return props.Setter(__assign(__assign({}, props.Record), (_a = {}, _a[props.Field] = evt.target.checked ? IncrementFlag(i) : DecrementFlag(i), _a)));
55
+ } }),
56
+ React.createElement("label", { className: "form-check-label" }, flag))); })));
57
+ }
58
+ exports.default = EnumCheckBoxes;
@@ -0,0 +1,8 @@
1
+ import * as React from 'react';
2
+ interface IProps {
3
+ Show: boolean;
4
+ Target?: string;
5
+ Zindex?: number;
6
+ }
7
+ declare const HelperMessage: React.FunctionComponent<IProps>;
8
+ export default HelperMessage;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ // ******************************************************************************************************
3
+ // HelperMessage.tsx - Gbtc
4
+ //
5
+ // Copyright © 2021, 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
+ // 05/05/2021 - C. Lackner
21
+ // Generated original version of source code.
22
+ //
23
+ // ******************************************************************************************************
24
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
25
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
26
+ return cooked;
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ var React = require("react");
30
+ var styled_components_1 = require("styled-components");
31
+ var helper_functions_1 = require("@gpa-gemstone/helper-functions");
32
+ var WrapperDiv = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n & {\n border-radius: 3px;\n display: inline-block;\n font-size: 13px;\n padding: 8px 21px;\n position: fixed;\n pointer-events: none;\n transition: opacity 0.3s ease-out;\n z-index: ", ";\n opacity: ", ";\n color: #000;\n background: #0DCAF0;\n top: ", ";\n left: ", ";\n\twidth: ", ";\n border: 1px solid transparent;\n }\n \n ", ""], ["\n & {\n border-radius: 3px;\n display: inline-block;\n font-size: 13px;\n padding: 8px 21px;\n position: fixed;\n pointer-events: none;\n transition: opacity 0.3s ease-out;\n z-index: ", ";\n opacity: ", ";\n color: #000;\n background: #0DCAF0;\n top: ", ";\n left: ", ";\n\twidth: ", ";\n border: 1px solid transparent;\n }\n \n ", ""])), function (props) { return props.Zindex; }, function (props) { return props.Show ? "1.0" : "0"; }, function (props) { return props.Top + "px"; }, function (props) { return props.Left + "px"; }, function (props) { return props.Width + "px"; }, function (props) { return "\n &::before {\n border-left: 8px solid transparent;\n border-right: 8px solid transparent;\n border-bottom: 8px solid #0DCAF0;\n left: 50%;\n top: -6px;\n margin-left: -8px;\n content: \"\";\n width: 0px;\n height: 0px;\n position: absolute\n }\n "; });
33
+ var HelperMessage = function (props) {
34
+ var _a = React.useState(0), top = _a[0], setTop = _a[1];
35
+ var _b = React.useState(0), left = _b[0], setLeft = _b[1];
36
+ var _c = React.useState(0), width = _c[0], setWidth = _c[1];
37
+ var _d = React.useState(""), guid = _d[0], setGuid = _d[1];
38
+ React.useEffect(function () {
39
+ setGuid(helper_functions_1.CreateGuid());
40
+ }, []);
41
+ React.useLayoutEffect(function () {
42
+ var _a = UpdatePosition(), t = _a[0], l = _a[1], w = _a[2];
43
+ if (t !== top)
44
+ setTop(t);
45
+ if (l !== left)
46
+ setLeft(l);
47
+ if (w !== width)
48
+ setWidth(w);
49
+ });
50
+ var zIndex = (props.Zindex === undefined ? 2000 : props.Zindex);
51
+ function UpdatePosition() {
52
+ var target = document.querySelectorAll("[data-help" + (props.Target === undefined ? '' : "=\"" + props.Target + "\"") + "]");
53
+ if (target.length === 0)
54
+ return [-999, -999];
55
+ var targetLocation = helper_functions_1.GetNodeSize(target[0]);
56
+ var message = document.getElementById(guid);
57
+ if (message === null)
58
+ return [-999, -999];
59
+ var msgLocation = helper_functions_1.GetNodeSize(message);
60
+ var offset = 5;
61
+ var result = [0, 0, 0];
62
+ result[0] = targetLocation.top + targetLocation.height + offset;
63
+ result[1] = targetLocation.left;
64
+ result[2] = targetLocation.width;
65
+ return result;
66
+ }
67
+ return (React.createElement(WrapperDiv, { Show: props.Show, Top: top, Left: left, Width: width, id: guid, Zindex: zIndex }, props.children));
68
+ };
69
+ exports.default = HelperMessage;
70
+ var templateObject_1;
package/lib/Input.d.ts CHANGED
@@ -1,11 +1,14 @@
1
- /// <reference types="react" />
2
- export default function Input<T>(props: {
3
- Record: T;
4
- Field: keyof T;
5
- Setter: (record: T) => void;
6
- Valid: (field: keyof T) => boolean;
7
- Label?: string;
8
- Feedback?: string;
9
- Disabled?: boolean;
10
- Type?: 'number' | 'text' | 'password' | 'email' | 'color';
11
- }): JSX.Element;
1
+ /// <reference types="react" />
2
+ interface IProps<T> {
3
+ Record: T;
4
+ Field: keyof T;
5
+ Setter: (record: T) => void;
6
+ Valid: (field: keyof T) => boolean;
7
+ Label?: string;
8
+ Feedback?: string;
9
+ Disabled?: boolean;
10
+ Type?: 'number' | 'text' | 'password' | 'email' | 'color';
11
+ Help?: string | JSX.Element;
12
+ }
13
+ export default function Input<T>(props: IProps<T>): JSX.Element;
14
+ export {};
package/lib/Input.js CHANGED
@@ -1,46 +1,60 @@
1
- "use strict";
2
- // ******************************************************************************************************
3
- // Input.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 Input(props) {
38
- return (React.createElement("div", { className: "form-group" },
39
- React.createElement("label", null, props.Label == null ? props.Field : props.Label),
40
- React.createElement("input", { type: props.Type === undefined ? 'text' : props.Type, className: props.Valid(props.Field) ? 'form-control' : 'form-control is-invalid', onChange: function (evt) {
41
- var _a;
42
- return props.Setter(__assign(__assign({}, props.Record), (_a = {}, _a[props.Field] = evt.target.value !== '' ? evt.target.value : null, _a)));
43
- }, value: props.Record[props.Field] == null ? '' : props.Record[props.Field].toString(), disabled: props.Disabled == null ? false : props.Disabled }),
44
- React.createElement("div", { className: "invalid-feedback" }, props.Feedback == null ? props.Field + ' is a required field.' : props.Feedback)));
45
- }
46
- exports.default = Input;
1
+ "use strict";
2
+ // ******************************************************************************************************
3
+ // Input.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
+ // 05/05/2021 - C. Lackner
23
+ // Added Help Message.
24
+ //
25
+ // ******************************************************************************************************
26
+ var __assign = (this && this.__assign) || function () {
27
+ __assign = Object.assign || function(t) {
28
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
29
+ s = arguments[i];
30
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
31
+ t[p] = s[p];
32
+ }
33
+ return t;
34
+ };
35
+ return __assign.apply(this, arguments);
36
+ };
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ var React = require("react");
39
+ var HelperMessage_1 = require("./HelperMessage");
40
+ var helper_functions_1 = require("@gpa-gemstone/helper-functions");
41
+ function Input(props) {
42
+ var _a = React.useState(""), guid = _a[0], setGuid = _a[1];
43
+ var _b = React.useState(false), showHelp = _b[0], setShowHelp = _b[1];
44
+ React.useEffect(function () {
45
+ setGuid(helper_functions_1.CreateGuid());
46
+ }, []);
47
+ return (React.createElement("div", { className: "form-group" },
48
+ React.createElement("label", null,
49
+ props.Label == null ? props.Field : props.Label,
50
+ props.Help !== undefined ? React.createElement("div", { style: { width: 20, height: 20, borderRadius: '50%', display: 'inline-block', background: '#0D6EFD', marginLeft: 10, textAlign: 'center', fontWeight: 'bold' }, onMouseEnter: function () { return setShowHelp(true); }, onMouseLeave: function () { return setShowHelp(false); } }, " ? ") : null),
51
+ props.Help !== undefined ?
52
+ React.createElement(HelperMessage_1.default, { Show: showHelp, Target: guid }, props.Help)
53
+ : null,
54
+ React.createElement("input", { "data-help": guid, type: props.Type === undefined ? 'text' : props.Type, className: props.Valid(props.Field) ? 'form-control' : 'form-control is-invalid', onChange: function (evt) {
55
+ var _a;
56
+ return props.Setter(__assign(__assign({}, props.Record), (_a = {}, _a[props.Field] = evt.target.value !== '' ? evt.target.value : null, _a)));
57
+ }, value: props.Record[props.Field] == null ? '' : props.Record[props.Field].toString(), disabled: props.Disabled == null ? false : props.Disabled }),
58
+ React.createElement("div", { className: "invalid-feedback" }, props.Feedback == null ? props.Field + ' is a required field.' : props.Feedback)));
59
+ }
60
+ exports.default = Input;
@@ -1,14 +1,14 @@
1
- /// <reference types="react" />
2
- declare const MultiSelect: (props: {
3
- Options: {
4
- Value: number;
5
- Text: string;
6
- Selected: boolean;
7
- }[];
8
- OnChange: (evt: any, Options: {
9
- Value: number;
10
- Text: string;
11
- Selected: boolean;
12
- }[]) => void;
13
- }) => JSX.Element;
14
- export default MultiSelect;
1
+ /// <reference types="react" />
2
+ declare const MultiSelect: (props: {
3
+ Options: {
4
+ Value: number;
5
+ Text: string;
6
+ Selected: boolean;
7
+ }[];
8
+ OnChange: (evt: any, Options: {
9
+ Value: number;
10
+ Text: string;
11
+ Selected: boolean;
12
+ }[]) => void;
13
+ }) => JSX.Element;
14
+ export default MultiSelect;