@gpa-gemstone/react-forms 1.1.44 → 1.1.46
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/StylableSelect.d.ts +1 -1
- package/lib/TextArea.js +19 -13
- package/package.json +2 -2
package/lib/StylableSelect.d.ts
CHANGED
package/lib/TextArea.js
CHANGED
|
@@ -31,17 +31,30 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
31
31
|
// ----------------------------------------------------------------------------------------------------
|
|
32
32
|
// 01/22/2020 - Billy Ernest
|
|
33
33
|
// Generated original version of source code.
|
|
34
|
+
// 11/03/2023 - C Lackner
|
|
35
|
+
// Added internal state to avoid cursor jumping.
|
|
34
36
|
//
|
|
35
37
|
// ******************************************************************************************************
|
|
36
38
|
var React = require("react");
|
|
37
39
|
var helper_functions_1 = require("@gpa-gemstone/helper-functions");
|
|
38
40
|
var HelperMessage_1 = require("./HelperMessage");
|
|
39
41
|
function TextArea(props) {
|
|
40
|
-
var
|
|
41
|
-
var
|
|
42
|
+
var internal = React.useRef(false);
|
|
43
|
+
var guid = React.useRef((0, helper_functions_1.CreateGuid)());
|
|
44
|
+
var _a = React.useState(false), showHelp = _a[0], setShowHelp = _a[1];
|
|
45
|
+
var _b = React.useState(''), heldVal = _b[0], setHeldVal = _b[1];
|
|
42
46
|
React.useEffect(function () {
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
if (!internal.current) {
|
|
48
|
+
setHeldVal(props.Record[props.Field] == null ? '' : props.Record[props.Field].toString());
|
|
49
|
+
}
|
|
50
|
+
internal.current = false;
|
|
51
|
+
}, [props.Record[props.Field]]);
|
|
52
|
+
function valueChange(value) {
|
|
53
|
+
var _a;
|
|
54
|
+
internal.current = true;
|
|
55
|
+
props.Setter(__assign(__assign({}, props.Record), (_a = {}, _a[props.Field] = value !== '' ? value : null, _a)));
|
|
56
|
+
setHeldVal(value);
|
|
57
|
+
}
|
|
45
58
|
var showLabel = props.Label !== "";
|
|
46
59
|
var showHelpIcon = props.Help !== undefined;
|
|
47
60
|
var label = props.Label === undefined ? props.Field : props.Label;
|
|
@@ -51,16 +64,9 @@ function TextArea(props) {
|
|
|
51
64
|
showLabel ? label : '',
|
|
52
65
|
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,
|
|
53
66
|
showHelpIcon ?
|
|
54
|
-
React.createElement(HelperMessage_1.default, { Show: showHelp, Target: guid }, props.Help)
|
|
67
|
+
React.createElement(HelperMessage_1.default, { Show: showHelp, Target: guid.current }, props.Help)
|
|
55
68
|
: null,
|
|
56
|
-
React.createElement("textarea", { rows: props.Rows, className: props.Valid(props.Field) ? 'form-control' : 'form-control is-invalid', onChange: function (evt) {
|
|
57
|
-
var record = __assign({}, props.Record);
|
|
58
|
-
if (evt.target.value !== '')
|
|
59
|
-
record[props.Field] = evt.target.value;
|
|
60
|
-
else
|
|
61
|
-
record[props.Field] = null;
|
|
62
|
-
props.Setter(record);
|
|
63
|
-
}, value: props.Record[props.Field] == null ? '' : props.Record[props.Field].toString(), disabled: props.Disabled == null ? false : props.Disabled }),
|
|
69
|
+
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 }),
|
|
64
70
|
React.createElement("div", { className: "invalid-feedback" }, props.Feedback == null ? props.Field + ' is a required field.' : props.Feedback)));
|
|
65
71
|
}
|
|
66
72
|
exports.default = TextArea;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gpa-gemstone/react-forms",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.46",
|
|
4
4
|
"description": "React Form modules for gpa webapps",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"typescript": "4.4.4"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@gpa-gemstone/helper-functions": "0.0.
|
|
46
|
+
"@gpa-gemstone/helper-functions": "0.0.27",
|
|
47
47
|
"@types/react": "^17.0.14",
|
|
48
48
|
"@types/styled-components": "^5.1.11",
|
|
49
49
|
"moment": "2.29.4",
|