@gpa-gemstone/react-forms 1.1.59 → 1.1.61
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/lib/ArrayCheckBoxes.d.ts +33 -11
- package/lib/ArrayCheckBoxes.js +81 -79
- package/lib/ArrayMultiSelect.d.ts +47 -13
- package/lib/ArrayMultiSelect.js +49 -47
- package/lib/CheckBox.d.ts +37 -11
- package/lib/CheckBox.js +62 -60
- package/lib/ColorPicker.d.ts +59 -15
- package/lib/ColorPicker.js +114 -114
- package/lib/DatePicker.d.ts +23 -21
- package/lib/DatePicker.js +221 -214
- package/lib/DateRangePicker.d.ts +64 -13
- package/lib/DateRangePicker.js +143 -132
- package/lib/DateTimeUI/Calender.d.ts +7 -8
- package/lib/DateTimeUI/Calender.js +180 -180
- package/lib/DateTimeUI/Clock.d.ts +9 -10
- package/lib/DateTimeUI/Clock.js +153 -153
- package/lib/DateTimeUI/DateTimePopup.d.ts +16 -17
- package/lib/DateTimeUI/DateTimePopup.js +59 -59
- package/lib/DoubleInput.d.ts +58 -12
- package/lib/DoubleInput.js +55 -51
- package/lib/EnumCheckBoxes.d.ts +41 -9
- package/lib/EnumCheckBoxes.js +65 -58
- package/lib/HelperMessage.d.ts +37 -10
- package/lib/HelperMessage.js +93 -83
- package/lib/Input.d.ts +80 -18
- package/lib/Input.js +111 -106
- package/lib/InputWithButton.d.ts +109 -23
- package/lib/InputWithButton.js +107 -107
- package/lib/MutliCheckBoxSelect.d.ts +42 -18
- package/lib/MutliCheckBoxSelect.js +110 -104
- package/lib/RadioButtons.d.ts +15 -0
- package/lib/RadioButtons.js +62 -0
- package/lib/SearchableSelect.d.ts +60 -18
- package/lib/SearchableSelect.js +84 -85
- package/lib/Select.d.ts +57 -17
- package/lib/Select.js +84 -80
- package/lib/StylableSelect.d.ts +53 -17
- package/lib/StylableSelect.js +106 -100
- package/lib/TextArea.d.ts +54 -14
- package/lib/TextArea.js +76 -72
- package/lib/TimePicker.d.ts +50 -11
- package/lib/TimePicker.js +60 -51
- package/lib/ToggleSwitch.d.ts +44 -12
- package/lib/ToggleSwitch.js +57 -61
- package/lib/index.d.ts +19 -18
- package/lib/index.js +61 -59
- package/package.json +4 -3
package/lib/TextArea.js
CHANGED
|
@@ -1,72 +1,76 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
// the
|
|
21
|
-
//
|
|
22
|
-
// file
|
|
23
|
-
//
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
-
//
|
|
33
|
-
//
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
var
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
var
|
|
45
|
-
var
|
|
46
|
-
React.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
internal.current
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.default = TextArea;
|
|
15
|
+
// ******************************************************************************************************
|
|
16
|
+
// TextArea.tsx - Gbtc
|
|
17
|
+
//
|
|
18
|
+
// Copyright © 2020, Grid Protection Alliance. All Rights Reserved.
|
|
19
|
+
//
|
|
20
|
+
// Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
|
|
21
|
+
// the NOTICE file distributed with this work for additional information regarding copyright ownership.
|
|
22
|
+
// The GPA licenses this file to you under the MIT License (MIT), the "License"; you may not use this
|
|
23
|
+
// file except in compliance with the License. You may obtain a copy of the License at:
|
|
24
|
+
//
|
|
25
|
+
// http://opensource.org/licenses/MIT
|
|
26
|
+
//
|
|
27
|
+
// Unless agreed to in writing, the subject software distributed under the License is distributed on an
|
|
28
|
+
// "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
|
|
29
|
+
// License for the specific language governing permissions and limitations.
|
|
30
|
+
//
|
|
31
|
+
// Code Modification History:
|
|
32
|
+
// ----------------------------------------------------------------------------------------------------
|
|
33
|
+
// 01/22/2020 - Billy Ernest
|
|
34
|
+
// Generated original version of source code.
|
|
35
|
+
// 11/03/2023 - C Lackner
|
|
36
|
+
// Added internal state to avoid cursor jumping.
|
|
37
|
+
//
|
|
38
|
+
// ******************************************************************************************************
|
|
39
|
+
var React = require("react");
|
|
40
|
+
var helper_functions_1 = require("@gpa-gemstone/helper-functions");
|
|
41
|
+
var HelperMessage_1 = require("./HelperMessage");
|
|
42
|
+
function TextArea(props) {
|
|
43
|
+
// Internal ref and state hooks for managing the component state.
|
|
44
|
+
var internal = React.useRef(false);
|
|
45
|
+
var guid = React.useRef((0, helper_functions_1.CreateGuid)());
|
|
46
|
+
var _a = React.useState(false), showHelp = _a[0], setShowHelp = _a[1];
|
|
47
|
+
var _b = React.useState(''), heldVal = _b[0], setHeldVal = _b[1];
|
|
48
|
+
// Effect to handle changes to the record's field value.
|
|
49
|
+
React.useEffect(function () {
|
|
50
|
+
if (!internal.current) {
|
|
51
|
+
setHeldVal(props.Record[props.Field] == null ? '' : props.Record[props.Field].toString());
|
|
52
|
+
}
|
|
53
|
+
internal.current = false;
|
|
54
|
+
}, [props.Record[props.Field]]);
|
|
55
|
+
// Handle value change of the textarea.
|
|
56
|
+
function valueChange(value) {
|
|
57
|
+
var _a;
|
|
58
|
+
internal.current = true;
|
|
59
|
+
props.Setter(__assign(__assign({}, props.Record), (_a = {}, _a[props.Field] = value !== '' ? value : null, _a)));
|
|
60
|
+
setHeldVal(value);
|
|
61
|
+
}
|
|
62
|
+
// Variables to control the rendering of label and help icon.
|
|
63
|
+
var showLabel = props.Label !== "";
|
|
64
|
+
var showHelpIcon = props.Help !== undefined;
|
|
65
|
+
var label = props.Label === undefined ? props.Field : props.Label;
|
|
66
|
+
return (React.createElement("div", { className: "form-group", "data-help": guid.current },
|
|
67
|
+
showHelpIcon || showLabel ?
|
|
68
|
+
React.createElement("label", null,
|
|
69
|
+
showLabel ? label : '',
|
|
70
|
+
showHelpIcon ? 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) : null,
|
|
71
|
+
showHelpIcon ?
|
|
72
|
+
React.createElement(HelperMessage_1.default, { Show: showHelp, Target: guid.current }, props.Help)
|
|
73
|
+
: null,
|
|
74
|
+
React.createElement("textarea", { rows: props.Rows, className: props.Valid(props.Field) ? 'form-control' : 'form-control is-invalid', onChange: function (evt) { return valueChange(evt.target.value); }, value: heldVal == null ? '' : heldVal, disabled: props.Disabled == null ? false : props.Disabled }),
|
|
75
|
+
React.createElement("div", { className: "invalid-feedback" }, props.Feedback == null ? props.Field + ' is a required field.' : props.Feedback)));
|
|
76
|
+
}
|
package/lib/TimePicker.d.ts
CHANGED
|
@@ -1,11 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
interface IProps<T> {
|
|
2
|
+
/**
|
|
3
|
+
* Record to be used in form
|
|
4
|
+
* @type {T}
|
|
5
|
+
*/
|
|
6
|
+
Record: T;
|
|
7
|
+
/**
|
|
8
|
+
* Field of the record to be edited
|
|
9
|
+
* @type {keyof T}
|
|
10
|
+
*/
|
|
11
|
+
Field: keyof T;
|
|
12
|
+
/**
|
|
13
|
+
* Setter function to update the Record
|
|
14
|
+
* @param record - Updated Record
|
|
15
|
+
*/
|
|
16
|
+
Setter: (record: T) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Function to determine the validity of a field
|
|
19
|
+
* @param field - Field of the record to check
|
|
20
|
+
* @returns {boolean}
|
|
21
|
+
*/
|
|
22
|
+
Valid: (field: keyof T) => boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Label to display for the form, defaults to the Field prop
|
|
25
|
+
* @type {string}
|
|
26
|
+
* @optional
|
|
27
|
+
*/
|
|
28
|
+
Label?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Flag to disable the input field
|
|
31
|
+
* @type {boolean}
|
|
32
|
+
* @optional
|
|
33
|
+
*/
|
|
34
|
+
Disabled?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Feedback message to show when input is invalid
|
|
37
|
+
* @type {string}
|
|
38
|
+
* @optional
|
|
39
|
+
*/
|
|
40
|
+
Feedback?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Defines the number of intervals for time value
|
|
43
|
+
* @type {number}
|
|
44
|
+
* @optional
|
|
45
|
+
*/
|
|
46
|
+
Step?: number;
|
|
47
|
+
Help?: string | JSX.Element;
|
|
48
|
+
}
|
|
49
|
+
export default function DatePicker<T>(props: IProps<T>): JSX.Element;
|
|
50
|
+
export {};
|
package/lib/TimePicker.js
CHANGED
|
@@ -1,51 +1,60 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// ******************************************************************************************************
|
|
3
|
-
// TimePicker.tsx - Gbtc
|
|
4
|
-
//
|
|
5
|
-
// Copyright © 2022, 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
|
-
// 03/21/2022 - 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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
props.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
// ******************************************************************************************************
|
|
3
|
+
// TimePicker.tsx - Gbtc
|
|
4
|
+
//
|
|
5
|
+
// Copyright © 2022, 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
|
+
// 03/21/2022 - 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
|
+
exports.default = DatePicker;
|
|
37
|
+
var React = require("react");
|
|
38
|
+
var HelperMessage_1 = require("./HelperMessage");
|
|
39
|
+
var helper_functions_1 = require("@gpa-gemstone/helper-functions");
|
|
40
|
+
function DatePicker(props) {
|
|
41
|
+
var _a;
|
|
42
|
+
var guid = React.useRef((0, helper_functions_1.CreateGuid)());
|
|
43
|
+
var _b = React.useState(false), showHelp = _b[0], setShowHelp = _b[1];
|
|
44
|
+
return (React.createElement("div", { className: "form-group" },
|
|
45
|
+
(props.Help != null || props.Label !== "") ?
|
|
46
|
+
React.createElement("label", null, (_a = props.Label) !== null && _a !== void 0 ? _a : props.Field,
|
|
47
|
+
props.Help != null ?
|
|
48
|
+
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); } }, " ? ") : React.createElement(React.Fragment, null))
|
|
49
|
+
: React.createElement(React.Fragment, null),
|
|
50
|
+
React.createElement(HelperMessage_1.default, { Show: showHelp, Target: guid.current }, props.Help),
|
|
51
|
+
React.createElement("input", { className: 'form-control' + (props.Valid(props.Field) ? '' : ' is-invalid'), type: "time", step: props.Step === null ? 60 : props.Step, onChange: function (evt) {
|
|
52
|
+
var record = __assign({}, props.Record);
|
|
53
|
+
if (evt.target.value !== '')
|
|
54
|
+
record[props.Field] = evt.target.value;
|
|
55
|
+
else
|
|
56
|
+
record[props.Field] = null;
|
|
57
|
+
props.Setter(record);
|
|
58
|
+
}, value: props.Record[props.Field] == null ? '' : props.Record[props.Field].toString(), disabled: props.Disabled == null ? false : props.Disabled }),
|
|
59
|
+
React.createElement("div", { className: "invalid-feedback" }, props.Feedback == null ? props.Field.toString() + ' is a required field.' : props.Feedback)));
|
|
60
|
+
}
|
package/lib/ToggleSwitch.d.ts
CHANGED
|
@@ -1,12 +1,44 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
interface IProps<T> {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
interface IProps<T> {
|
|
3
|
+
/**
|
|
4
|
+
* Record to be used in form
|
|
5
|
+
* @type {T}
|
|
6
|
+
*/
|
|
7
|
+
Record: T;
|
|
8
|
+
/**
|
|
9
|
+
* Field of the record to be edited
|
|
10
|
+
* @type {keyof T}
|
|
11
|
+
*/
|
|
12
|
+
Field: keyof T;
|
|
13
|
+
/**
|
|
14
|
+
* Setter function to update the Record
|
|
15
|
+
* @param record - Updated Record
|
|
16
|
+
*/
|
|
17
|
+
Setter: (record: T) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Label to display for the form, defaults to the Field prop
|
|
20
|
+
* @type {string}
|
|
21
|
+
* @optional
|
|
22
|
+
*/
|
|
23
|
+
Label?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Flag to disable the input field
|
|
26
|
+
* @type {boolean}
|
|
27
|
+
* @optional
|
|
28
|
+
*/
|
|
29
|
+
Disabled?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Help message or element to display
|
|
32
|
+
* @type {string | JSX.Element}
|
|
33
|
+
* @optional
|
|
34
|
+
*/
|
|
35
|
+
Help?: string | JSX.Element;
|
|
36
|
+
/**
|
|
37
|
+
* CSS styles to apply to the form group
|
|
38
|
+
* @type {React.CSSProperties}
|
|
39
|
+
* @optional
|
|
40
|
+
*/
|
|
41
|
+
Style?: React.CSSProperties;
|
|
42
|
+
}
|
|
43
|
+
export default function ToggleSwitch<T>(props: IProps<T>): JSX.Element;
|
|
44
|
+
export {};
|
package/lib/ToggleSwitch.js
CHANGED
|
@@ -1,61 +1,57 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// ******************************************************************************************************
|
|
3
|
-
// ToggleSwitch.tsx - Gbtc
|
|
4
|
-
//
|
|
5
|
-
// Copyright
|
|
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
|
-
// 04/19/2024 - Preston Crawford
|
|
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
|
-
|
|
37
|
-
var
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
var
|
|
42
|
-
var
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
React.createElement(HelperMessage_1.default, { Show: showHelp, Target: helpID, Zindex: 9999 }, props.Help))
|
|
59
|
-
: null));
|
|
60
|
-
}
|
|
61
|
-
exports.default = ToggleSwitch;
|
|
1
|
+
"use strict";
|
|
2
|
+
// ******************************************************************************************************
|
|
3
|
+
// ToggleSwitch.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
|
+
// 04/19/2024 - Preston Crawford
|
|
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
|
+
exports.default = ToggleSwitch;
|
|
37
|
+
var React = require("react");
|
|
38
|
+
var helper_functions_1 = require("@gpa-gemstone/helper-functions");
|
|
39
|
+
var HelperMessage_1 = require("./HelperMessage");
|
|
40
|
+
function ToggleSwitch(props) {
|
|
41
|
+
var helpID = React.useRef((0, helper_functions_1.CreateGuid)());
|
|
42
|
+
var switchID = React.useRef((0, helper_functions_1.CreateGuid)());
|
|
43
|
+
var _a = React.useState(false), showHelp = _a[0], setShowHelp = _a[1];
|
|
44
|
+
var showHelpIcon = props.Help !== undefined;
|
|
45
|
+
return (React.createElement("div", { className: "custom-control custom-switch", "data-help": helpID.current, style: props.Style },
|
|
46
|
+
React.createElement("input", { type: "checkbox", className: "custom-control-input", onChange: function (evt) {
|
|
47
|
+
var record = __assign({}, props.Record);
|
|
48
|
+
record[props.Field] = evt.target.checked;
|
|
49
|
+
props.Setter(record);
|
|
50
|
+
}, value: props.Record[props.Field] ? 'on' : 'off', checked: props.Record[props.Field], disabled: props.Disabled == null ? false : props.Disabled, id: switchID.current }),
|
|
51
|
+
React.createElement("label", { className: "custom-control-label", htmlFor: switchID.current }, props.Label == null ? props.Field : props.Label),
|
|
52
|
+
showHelpIcon ?
|
|
53
|
+
React.createElement(React.Fragment, null,
|
|
54
|
+
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); } }, "?"),
|
|
55
|
+
React.createElement(HelperMessage_1.default, { Show: showHelp, Target: helpID.current, Zindex: 9999 }, props.Help))
|
|
56
|
+
: null));
|
|
57
|
+
}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import CheckBox from './CheckBox';
|
|
2
|
-
import Input from './Input';
|
|
3
|
-
import DatePicker from './DatePicker';
|
|
4
|
-
import Select from './Select';
|
|
5
|
-
import TextArea from './TextArea';
|
|
6
|
-
import DateRangePicker from './DateRangePicker';
|
|
7
|
-
import EnumCheckBoxes from './EnumCheckBoxes';
|
|
8
|
-
import ArrayMultiSelect from './ArrayMultiSelect';
|
|
9
|
-
import ArrayCheckBoxes from './ArrayCheckBoxes';
|
|
10
|
-
import MultiCheckBoxSelect from './MutliCheckBoxSelect';
|
|
11
|
-
import DoubleInput from './DoubleInput';
|
|
12
|
-
import TimePicker from './TimePicker';
|
|
13
|
-
import StylableSelect from './StylableSelect';
|
|
14
|
-
import ColorPicker from './ColorPicker';
|
|
15
|
-
import SearchableSelect from './SearchableSelect';
|
|
16
|
-
import ToggleSwitch from './ToggleSwitch';
|
|
17
|
-
import InputWithButton from './InputWithButton';
|
|
18
|
-
|
|
1
|
+
import CheckBox from './CheckBox';
|
|
2
|
+
import Input from './Input';
|
|
3
|
+
import DatePicker from './DatePicker';
|
|
4
|
+
import Select from './Select';
|
|
5
|
+
import TextArea from './TextArea';
|
|
6
|
+
import DateRangePicker from './DateRangePicker';
|
|
7
|
+
import EnumCheckBoxes from './EnumCheckBoxes';
|
|
8
|
+
import ArrayMultiSelect from './ArrayMultiSelect';
|
|
9
|
+
import ArrayCheckBoxes from './ArrayCheckBoxes';
|
|
10
|
+
import MultiCheckBoxSelect from './MutliCheckBoxSelect';
|
|
11
|
+
import DoubleInput from './DoubleInput';
|
|
12
|
+
import TimePicker from './TimePicker';
|
|
13
|
+
import StylableSelect from './StylableSelect';
|
|
14
|
+
import ColorPicker from './ColorPicker';
|
|
15
|
+
import SearchableSelect from './SearchableSelect';
|
|
16
|
+
import ToggleSwitch from './ToggleSwitch';
|
|
17
|
+
import InputWithButton from './InputWithButton';
|
|
18
|
+
import RadioButtons from './RadioButtons';
|
|
19
|
+
export { CheckBox, Input, DatePicker, Select, TextArea, DateRangePicker, EnumCheckBoxes, ArrayMultiSelect, ArrayCheckBoxes, MultiCheckBoxSelect, DoubleInput, TimePicker, StylableSelect, ColorPicker, SearchableSelect, ToggleSwitch, InputWithButton, RadioButtons };
|