@gpa-gemstone/react-forms 1.1.83 → 1.1.85
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/CheckBox.js +5 -6
- package/lib/DatePicker.js +77 -43
- package/lib/FileUpload.js +1 -1
- package/lib/Input.js +5 -6
- package/lib/InputWithButton.js +5 -3
- package/lib/MultiInput.js +6 -5
- package/lib/MutliCheckBoxSelect.js +4 -4
- package/lib/RadioButtons.js +9 -7
- package/lib/Select.js +7 -12
- package/lib/StylableSelect.js +10 -7
- package/lib/TextArea.js +7 -8
- package/lib/TimePicker.js +13 -10
- package/lib/ToggleSwitch.js +10 -8
- package/package.json +4 -4
package/lib/CheckBox.js
CHANGED
|
@@ -55,12 +55,11 @@ function CheckBox(props) {
|
|
|
55
55
|
props.Setter(record);
|
|
56
56
|
}, value: props.Record[props.Field] ? 'on' : 'off', checked: props.Record[props.Field], disabled: props.Disabled == null ? false : props.Disabled }),
|
|
57
57
|
showHelpIcon || showLabel ?
|
|
58
|
-
React.createElement("label", { className:
|
|
59
|
-
showLabel ? label : '',
|
|
60
|
-
showHelpIcon
|
|
61
|
-
React.createElement(
|
|
62
|
-
|
|
63
|
-
: null) : null,
|
|
58
|
+
React.createElement("label", { className: "form-check-label d-flex align-items-center" },
|
|
59
|
+
React.createElement("span", null, showLabel ? label : ''),
|
|
60
|
+
showHelpIcon && (React.createElement("span", { className: "ml-2 d-flex align-items-center", onMouseEnter: function () { return setShowHelp(true); }, onMouseLeave: function () { return setShowHelp(false); }, "data-tooltip": guid },
|
|
61
|
+
React.createElement(gpa_symbols_1.ReactIcons.QuestionMark, { Color: "var(--info)", Size: 20 }))))
|
|
62
|
+
: null,
|
|
64
63
|
showHelpIcon ?
|
|
65
64
|
React.createElement(ToolTip_1.default, { Show: showHelp, Target: guid, Class: "info", Position: "bottom" }, props.Help)
|
|
66
65
|
: null));
|
package/lib/DatePicker.js
CHANGED
|
@@ -44,6 +44,11 @@ var gpa_symbols_1 = require("@gpa-gemstone/gpa-symbols");
|
|
|
44
44
|
* Component that allows a user to pick a date or datetime.
|
|
45
45
|
*/
|
|
46
46
|
function DateTimePicker(props) {
|
|
47
|
+
var inputRef = React.useRef(null);
|
|
48
|
+
var width = (0, helper_functions_1.useGetContainerPosition)(inputRef).width;
|
|
49
|
+
var _a = React.useState(false), isTextOverflowing = _a[0], setIsTextOverflowing = _a[1];
|
|
50
|
+
var _b = React.useState(false), isInputHovered = _b[0], setIsInputHovered = _b[1];
|
|
51
|
+
var overflowGUID = React.useState((0, helper_functions_1.CreateGuid)())[0];
|
|
47
52
|
// Formats for displaying dates in the input box and storing in the record.
|
|
48
53
|
var boxFormat = getBoxFormat(props.Type, props.Accuracy);
|
|
49
54
|
var recordFormat = props.Format !== undefined ? props.Format : "YYYY-MM-DD" + (props.Type === undefined || props.Type === 'date' ? "" : "[T]HH:mm:ss.SSS[Z]");
|
|
@@ -51,15 +56,15 @@ function DateTimePicker(props) {
|
|
|
51
56
|
var parse = function (r) { return moment(props.Record[props.Field], recordFormat); };
|
|
52
57
|
// State and ref declarations.
|
|
53
58
|
var divRef = React.useRef(null);
|
|
54
|
-
var
|
|
55
|
-
var
|
|
59
|
+
var helpGuid = React.useState((0, helper_functions_1.CreateGuid)())[0];
|
|
60
|
+
var _c = React.useState(false), showHelp = _c[0], setShowHelp = _c[1];
|
|
56
61
|
// Adds a buffer between the outside props and what the box is reading to prevent box overwriting every render with a keystroke
|
|
57
|
-
var
|
|
58
|
-
var
|
|
59
|
-
var
|
|
60
|
-
var
|
|
61
|
-
var
|
|
62
|
-
var
|
|
62
|
+
var _d = React.useState(parse(props.Record).format(boxFormat)), boxRecord = _d[0], setBoxRecord = _d[1];
|
|
63
|
+
var _e = React.useState(parse(props.Record)), pickerRecord = _e[0], setPickerRecord = _e[1];
|
|
64
|
+
var _f = React.useState(""), feedbackMessage = _f[0], setFeedbackMessage = _f[1];
|
|
65
|
+
var _g = React.useState(false), showOverlay = _g[0], setShowOverlay = _g[1];
|
|
66
|
+
var _h = React.useState(0), top = _h[0], setTop = _h[1];
|
|
67
|
+
var _j = React.useState(0), left = _j[0], setLeft = _j[1];
|
|
63
68
|
var allowNull = React.useMemo(function () { var _a; return (_a = props.AllowEmpty) !== null && _a !== void 0 ? _a : false; }, [props.AllowEmpty]);
|
|
64
69
|
React.useEffect(function () {
|
|
65
70
|
if (props.Record[props.Field] !== null) {
|
|
@@ -128,35 +133,6 @@ function DateTimePicker(props) {
|
|
|
128
133
|
}
|
|
129
134
|
}
|
|
130
135
|
}
|
|
131
|
-
function getBoxFormat(type, accuracy) {
|
|
132
|
-
var dateTime = type !== null && type !== void 0 ? type : 'date';
|
|
133
|
-
var timeUnit = accuracy !== null && accuracy !== void 0 ? accuracy : 'second';
|
|
134
|
-
if (dateTime === 'time') {
|
|
135
|
-
if (timeUnit === 'minute') {
|
|
136
|
-
return "HH:mm";
|
|
137
|
-
}
|
|
138
|
-
else if (timeUnit === 'second') {
|
|
139
|
-
return "HH:mm:ss";
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
return "HH:mm:ss.SSS";
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
else if (dateTime === 'datetime-local') {
|
|
146
|
-
if (timeUnit === 'minute') {
|
|
147
|
-
return "YYYY-MM-DD[T]HH:mm";
|
|
148
|
-
}
|
|
149
|
-
else if (timeUnit === 'second') {
|
|
150
|
-
return "YYYY-MM-DD[T]HH:mm:ss";
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
return "YYYY-MM-DD[T]HH:mm:ss.SSS";
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
return "YYYY-MM-DD";
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
136
|
function getFeedbackMessage() {
|
|
161
137
|
if (feedbackMessage.length != 0) {
|
|
162
138
|
return feedbackMessage;
|
|
@@ -214,22 +190,80 @@ function DateTimePicker(props) {
|
|
|
214
190
|
}
|
|
215
191
|
setBoxRecord(value);
|
|
216
192
|
}
|
|
193
|
+
React.useEffect(function () {
|
|
194
|
+
if (inputRef.current == null)
|
|
195
|
+
return;
|
|
196
|
+
var inputWidth = getInputWidth(inputRef.current, boxRecord, step);
|
|
197
|
+
setIsTextOverflowing(inputWidth > width);
|
|
198
|
+
}, [width, boxRecord, step]);
|
|
217
199
|
return (React.createElement("div", { className: "form-group", ref: divRef },
|
|
218
200
|
showHelpIcon || showLabel ?
|
|
219
|
-
React.createElement("label", { className:
|
|
220
|
-
showLabel ? label : '',
|
|
221
|
-
showHelpIcon
|
|
222
|
-
React.createElement(gpa_symbols_1.ReactIcons.QuestionMark, { Color:
|
|
201
|
+
React.createElement("label", { className: "d-flex align-items-center" },
|
|
202
|
+
React.createElement("span", null, showLabel ? label : ''),
|
|
203
|
+
showHelpIcon && (React.createElement("span", { className: "ml-2 d-flex align-items-center", onMouseEnter: function () { return setShowHelp(true); }, onMouseLeave: function () { return setShowHelp(false); }, "data-tooltip": helpGuid },
|
|
204
|
+
React.createElement(gpa_symbols_1.ReactIcons.QuestionMark, { Color: "var(--info)", Size: 20 }))))
|
|
205
|
+
: null,
|
|
223
206
|
showHelpIcon ?
|
|
224
|
-
React.createElement(ToolTip_1.default, { Show: showHelp, Target:
|
|
207
|
+
React.createElement(ToolTip_1.default, { Show: showHelp, Target: helpGuid, Class: "info", Position: "bottom" }, props.Help)
|
|
225
208
|
: null,
|
|
226
209
|
React.createElement("input", { className: "gpa-gemstone-datetime form-control ".concat(IsValid() ? '' : 'is-invalid'), type: props.Type === undefined ? 'date' : props.Type, onChange: function (evt) {
|
|
227
210
|
valueChange(evt.target.value);
|
|
228
|
-
}, onFocus: function () { setShowOverlay(true); }, value: boxRecord, disabled: props.Disabled === undefined ? false : props.Disabled, onClick: function (e) { e.preventDefault(); }, step: step }),
|
|
211
|
+
}, onFocus: function () { setShowOverlay(true); }, value: boxRecord, disabled: props.Disabled === undefined ? false : props.Disabled, onClick: function (e) { e.preventDefault(); }, step: step, ref: inputRef, "data-tooltip": overflowGUID, onMouseOver: function () { return setIsInputHovered(true); }, onMouseOut: function () { return setIsInputHovered(false); } }),
|
|
229
212
|
React.createElement("div", { className: "invalid-feedback" }, getFeedbackMessage()),
|
|
213
|
+
React.createElement(ToolTip_1.default, { Show: isTextOverflowing && isInputHovered, Target: overflowGUID }, props.Format != null ? moment(boxRecord).format(props.Format) : boxRecord),
|
|
230
214
|
React.createElement(DateTimePopup_1.default, { Setter: function (d) {
|
|
231
215
|
setPickerAndRecord(d);
|
|
232
216
|
if (props.Type === 'date')
|
|
233
217
|
setShowOverlay(false);
|
|
234
218
|
}, Show: showOverlay, DateTime: pickerRecord, Valid: props.Valid(props.Field), Top: top, Center: left, Type: props.Type === undefined ? 'date' : props.Type, Accuracy: props.Accuracy })));
|
|
235
219
|
}
|
|
220
|
+
function getBoxFormat(type, accuracy) {
|
|
221
|
+
var dateTime = type !== null && type !== void 0 ? type : 'date';
|
|
222
|
+
var timeUnit = accuracy !== null && accuracy !== void 0 ? accuracy : 'second';
|
|
223
|
+
if (dateTime === 'time') {
|
|
224
|
+
if (timeUnit === 'minute') {
|
|
225
|
+
return "HH:mm";
|
|
226
|
+
}
|
|
227
|
+
else if (timeUnit === 'second') {
|
|
228
|
+
return "HH:mm:ss";
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
return "HH:mm:ss.SSS";
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
else if (dateTime === 'datetime-local') {
|
|
235
|
+
if (timeUnit === 'minute') {
|
|
236
|
+
return "YYYY-MM-DD[T]HH:mm";
|
|
237
|
+
}
|
|
238
|
+
else if (timeUnit === 'second') {
|
|
239
|
+
return "YYYY-MM-DD[T]HH:mm:ss";
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
return "YYYY-MM-DD[T]HH:mm:ss.SSS";
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
return "YYYY-MM-DD";
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
var getInputWidth = function (inputRef, currentValue, currentStep) {
|
|
250
|
+
var computedStyle = window.getComputedStyle(inputRef);
|
|
251
|
+
var dummyInput = document.createElement('input');
|
|
252
|
+
dummyInput.type = inputRef.type;
|
|
253
|
+
dummyInput.value = currentValue;
|
|
254
|
+
dummyInput.step = currentStep;
|
|
255
|
+
dummyInput.style.font = computedStyle.font;
|
|
256
|
+
dummyInput.style.fontSize = computedStyle.fontSize;
|
|
257
|
+
dummyInput.style.fontFamily = computedStyle.fontFamily;
|
|
258
|
+
dummyInput.style.fontWeight = computedStyle.fontWeight;
|
|
259
|
+
dummyInput.style.letterSpacing = computedStyle.letterSpacing;
|
|
260
|
+
dummyInput.style.whiteSpace = 'nowrap';
|
|
261
|
+
// Position it off-screen and hide it so it doesn't affect layout
|
|
262
|
+
dummyInput.style.position = 'absolute';
|
|
263
|
+
dummyInput.style.visibility = 'hidden';
|
|
264
|
+
document.body.appendChild(dummyInput);
|
|
265
|
+
var width = dummyInput.getBoundingClientRect().width;
|
|
266
|
+
// Clean up
|
|
267
|
+
document.body.removeChild(dummyInput);
|
|
268
|
+
return width;
|
|
269
|
+
};
|
package/lib/FileUpload.js
CHANGED
|
@@ -71,7 +71,7 @@ var FileUpload = function (props) {
|
|
|
71
71
|
React.createElement(gpa_symbols_1.ReactIcons.CircledX, { Color: 'red' })))),
|
|
72
72
|
isFileUpload ?
|
|
73
73
|
React.createElement(React.Fragment, null,
|
|
74
|
-
React.createElement("div", { className: 'row align-items-center justify-content-center', style: { border: '2px dashed var(--secondary)' } },
|
|
74
|
+
React.createElement("div", { className: 'row align-items-center justify-content-center', style: { border: '2px dashed var(--secondary)', borderRadius: '0.5em' } },
|
|
75
75
|
React.createElement("div", { className: 'col-auto' },
|
|
76
76
|
"File Name: ", fileName !== null && fileName !== void 0 ? fileName : ''),
|
|
77
77
|
React.createElement("div", { className: 'col-auto' },
|
package/lib/Input.js
CHANGED
|
@@ -104,12 +104,11 @@ function Input(props) {
|
|
|
104
104
|
var label = props.Label === undefined ? props.Field : props.Label;
|
|
105
105
|
return (React.createElement("div", { className: "form-group " + (props.Size === 'large' ? 'form-group-lg' : '') + (props.Size === 'small' ? 'form-group-sm' : ''), style: props.Style },
|
|
106
106
|
showHelpIcon || showLabel ?
|
|
107
|
-
React.createElement("label", { className:
|
|
108
|
-
showLabel ? label : '',
|
|
109
|
-
showHelpIcon
|
|
110
|
-
React.createElement(
|
|
111
|
-
|
|
112
|
-
: null) : null,
|
|
107
|
+
React.createElement("label", { className: "d-flex align-items-center" },
|
|
108
|
+
React.createElement("span", null, showLabel ? label : ''),
|
|
109
|
+
showHelpIcon && (React.createElement("span", { className: "ml-2 d-flex align-items-center", onMouseEnter: function () { return setShowHelp(true); }, onMouseLeave: function () { return setShowHelp(false); }, "data-tooltip": guid },
|
|
110
|
+
React.createElement(gpa_symbols_1.ReactIcons.QuestionMark, { Color: "var(--info)", Size: 20 }))))
|
|
111
|
+
: null,
|
|
113
112
|
showHelpIcon ?
|
|
114
113
|
React.createElement(ToolTip_1.default, { Show: showHelp, Target: guid, Class: "info", Position: "bottom" }, props.Help)
|
|
115
114
|
: null,
|
package/lib/InputWithButton.js
CHANGED
|
@@ -94,10 +94,12 @@ function InputWithButton(props) {
|
|
|
94
94
|
return (React.createElement("div", { className: "form-group " + (props.Size === 'large' ? 'form-group-lg' : '') + (props.Size === 'small' ? 'form-group-sm' : ''), style: props.InputStyle },
|
|
95
95
|
showHelpIcon || showLabel ?
|
|
96
96
|
React.createElement("label", { className: 'd-flex align-items-center' },
|
|
97
|
-
showLabel ? label : '',
|
|
97
|
+
React.createElement("span", null, showLabel ? label : ''),
|
|
98
98
|
showHelpIcon ?
|
|
99
|
-
React.createElement("
|
|
100
|
-
React.createElement(gpa_symbols_1.ReactIcons.QuestionMark, { Color:
|
|
99
|
+
React.createElement("span", { className: "ml-2 d-flex align-items-center", onMouseEnter: function () { return setShowHelp(true); }, onMouseLeave: function () { return setShowHelp(false); }, "data-tooltip": guid },
|
|
100
|
+
React.createElement(gpa_symbols_1.ReactIcons.QuestionMark, { Color: "var(--info)", Size: 20 }))
|
|
101
|
+
: null)
|
|
102
|
+
: null,
|
|
101
103
|
showHelpIcon ?
|
|
102
104
|
React.createElement(ToolTip_1.default, { Show: showHelp, Target: guid, Class: "info", Position: "bottom" }, props.Help)
|
|
103
105
|
: null,
|
package/lib/MultiInput.js
CHANGED
|
@@ -50,7 +50,7 @@ var helper_functions_1 = require("@gpa-gemstone/helper-functions");
|
|
|
50
50
|
//Only supporting string/number arrays for now
|
|
51
51
|
function MultiInput(props) {
|
|
52
52
|
var _a;
|
|
53
|
-
var guid = React.
|
|
53
|
+
var guid = React.useState((0, helper_functions_1.CreateGuid)())[0];
|
|
54
54
|
var _b = React.useState(false), showHelp = _b[0], setShowHelp = _b[1];
|
|
55
55
|
var fieldArray = props.Record[props.Field];
|
|
56
56
|
if ((fieldArray === null || fieldArray === void 0 ? void 0 : fieldArray.constructor) !== Array) {
|
|
@@ -60,10 +60,11 @@ function MultiInput(props) {
|
|
|
60
60
|
return (React.createElement(React.Fragment, null,
|
|
61
61
|
fieldArray.length === 0 ?
|
|
62
62
|
React.createElement(React.Fragment, null,
|
|
63
|
-
React.createElement("label", { className: 'd-flex align-items-center' },
|
|
63
|
+
React.createElement("label", { className: 'd-flex align-items-center' },
|
|
64
|
+
React.createElement("span", null, (_a = props.Label) !== null && _a !== void 0 ? _a : props.Field),
|
|
64
65
|
props.Help != null ?
|
|
65
|
-
React.createElement("
|
|
66
|
-
React.createElement(gpa_symbols_1.ReactIcons.QuestionMark, { Color:
|
|
66
|
+
React.createElement("span", { className: "ml-2 d-flex align-items-center", onMouseEnter: function () { return setShowHelp(true); }, onMouseLeave: function () { return setShowHelp(false); }, "data-tooltip": guid },
|
|
67
|
+
React.createElement(gpa_symbols_1.ReactIcons.QuestionMark, { Color: "var(--info)", Size: 20 }))
|
|
67
68
|
: null,
|
|
68
69
|
React.createElement("button", { className: 'btn', onClick: function () {
|
|
69
70
|
var _a;
|
|
@@ -72,7 +73,7 @@ function MultiInput(props) {
|
|
|
72
73
|
" ",
|
|
73
74
|
React.createElement(gpa_symbols_1.ReactIcons.CirclePlus, null),
|
|
74
75
|
" ")),
|
|
75
|
-
React.createElement(ToolTip_1.default, { Show: showHelp && props.Help != null, Target: guid
|
|
76
|
+
React.createElement(ToolTip_1.default, { Show: showHelp && props.Help != null, Target: guid, Class: "info", Position: "bottom" }, props.Help))
|
|
76
77
|
: null,
|
|
77
78
|
fieldArray.map(function (r, index) {
|
|
78
79
|
var _a, _b;
|
|
@@ -96,11 +96,11 @@ var MultiSelect = function (props) {
|
|
|
96
96
|
return (React.createElement("div", { className: "form-group" },
|
|
97
97
|
showLabel || showHelpIcon ?
|
|
98
98
|
React.createElement("label", { className: 'd-flex align-items-center' },
|
|
99
|
-
showLabel ?
|
|
100
|
-
(props.Label === undefined ? 'Select' : props.Label) : '',
|
|
99
|
+
React.createElement("span", null, showLabel ?
|
|
100
|
+
(props.Label === undefined ? 'Select' : props.Label) : ''),
|
|
101
101
|
showHelpIcon ?
|
|
102
|
-
React.createElement("
|
|
103
|
-
React.createElement(gpa_symbols_1.ReactIcons.QuestionMark, { Color:
|
|
102
|
+
React.createElement("span", { className: "ml-2 d-flex align-items-center", onMouseEnter: function () { return setShowHelp(true); }, onMouseLeave: function () { return setShowHelp(false); }, "data-tooltip": helperGuid },
|
|
103
|
+
React.createElement(gpa_symbols_1.ReactIcons.QuestionMark, { Color: "var(--info)", Size: 20 }))
|
|
104
104
|
: null) : null,
|
|
105
105
|
showHelpIcon ?
|
|
106
106
|
React.createElement(ToolTip_1.default, { Show: showHelp, Target: helperGuid, Class: "info", Position: "bottom" }, props.Help)
|
package/lib/RadioButtons.js
CHANGED
|
@@ -39,17 +39,19 @@ var helper_functions_1 = require("@gpa-gemstone/helper-functions");
|
|
|
39
39
|
var ToolTip_1 = require("./ToolTip");
|
|
40
40
|
var gpa_symbols_1 = require("@gpa-gemstone/gpa-symbols");
|
|
41
41
|
function RadioButtons(props) {
|
|
42
|
-
var
|
|
43
|
-
var
|
|
44
|
-
|
|
42
|
+
var guid = React.useState((0, helper_functions_1.CreateGuid)())[0];
|
|
43
|
+
var _a = React.useState(false), showHelp = _a[0], setShowHelp = _a[1];
|
|
44
|
+
// Variables to control the rendering of label and help icon.
|
|
45
45
|
var showHelpIcon = props.Help !== undefined;
|
|
46
|
+
var label = props.Label === undefined ? props.Field : props.Label;
|
|
46
47
|
return (React.createElement("div", { className: "form-group" },
|
|
47
|
-
React.createElement("label", { className: "form-check-label w-100 d-flex align-items-center" },
|
|
48
|
+
React.createElement("label", { className: "form-check-label w-100 d-flex align-items-center" },
|
|
49
|
+
React.createElement("span", null, label),
|
|
48
50
|
showHelpIcon ?
|
|
49
51
|
React.createElement(React.Fragment, null,
|
|
50
|
-
React.createElement("
|
|
51
|
-
React.createElement(gpa_symbols_1.ReactIcons.QuestionMark, { Color:
|
|
52
|
-
React.createElement(ToolTip_1.default, { Show: showHelp, Target: guid
|
|
52
|
+
React.createElement("span", { className: "ml-2 d-flex align-items-center", onMouseEnter: function () { return setShowHelp(true); }, onMouseLeave: function () { return setShowHelp(false); }, "data-tooltip": guid },
|
|
53
|
+
React.createElement(gpa_symbols_1.ReactIcons.QuestionMark, { Color: "var(--info)", Size: 20 })),
|
|
54
|
+
React.createElement(ToolTip_1.default, { Show: showHelp, Target: guid, Class: "info", Position: "bottom" }, props.Help))
|
|
53
55
|
: null),
|
|
54
56
|
props.Options.map(function (option, index) {
|
|
55
57
|
var _a;
|
package/lib/Select.js
CHANGED
|
@@ -42,12 +42,8 @@ var helper_functions_1 = require("@gpa-gemstone/helper-functions");
|
|
|
42
42
|
var gpa_symbols_1 = require("@gpa-gemstone/gpa-symbols");
|
|
43
43
|
function Select(props) {
|
|
44
44
|
var _a;
|
|
45
|
-
var
|
|
46
|
-
var
|
|
47
|
-
// Effect to generate a unique ID for the component.
|
|
48
|
-
React.useEffect(function () {
|
|
49
|
-
setGuid((0, helper_functions_1.CreateGuid)());
|
|
50
|
-
}, []);
|
|
45
|
+
var guid = React.useState((0, helper_functions_1.CreateGuid)())[0];
|
|
46
|
+
var _b = React.useState(false), showHelp = _b[0], setShowHelp = _b[1];
|
|
51
47
|
// Effect to validate the current value against the available options.
|
|
52
48
|
React.useEffect(function () {
|
|
53
49
|
var _a;
|
|
@@ -81,12 +77,11 @@ function Select(props) {
|
|
|
81
77
|
var label = props.Label === undefined ? props.Field : props.Label;
|
|
82
78
|
return (React.createElement("div", { className: "form-group" },
|
|
83
79
|
showHelpIcon || showLabel ?
|
|
84
|
-
React.createElement("label", { className:
|
|
85
|
-
showLabel ? label : '',
|
|
86
|
-
showHelpIcon
|
|
87
|
-
React.createElement(
|
|
88
|
-
|
|
89
|
-
: null) : null,
|
|
80
|
+
React.createElement("label", { className: "d-flex align-items-center" },
|
|
81
|
+
React.createElement("span", null, showLabel ? label : ''),
|
|
82
|
+
showHelpIcon && (React.createElement("span", { className: "ml-2 d-flex align-items-center", onMouseEnter: function () { return setShowHelp(true); }, onMouseLeave: function () { return setShowHelp(false); }, "data-tooltip": guid },
|
|
83
|
+
React.createElement(gpa_symbols_1.ReactIcons.QuestionMark, { Color: "var(--info)", Size: 20 }))))
|
|
84
|
+
: null,
|
|
90
85
|
showHelpIcon ?
|
|
91
86
|
React.createElement(ToolTip_1.default, { Show: showHelp, Target: guid, Class: "info", Position: "bottom" }, props.Help)
|
|
92
87
|
: null,
|
package/lib/StylableSelect.js
CHANGED
|
@@ -117,14 +117,17 @@ function StylableSelect(props) {
|
|
|
117
117
|
SetRecord(option);
|
|
118
118
|
setShow(false);
|
|
119
119
|
};
|
|
120
|
+
// Variables to control the rendering of label and help icon.
|
|
121
|
+
var showLabel = props.Label !== "";
|
|
122
|
+
var showHelpIcon = props.Help !== undefined;
|
|
123
|
+
var label = props.Label === undefined ? props.Field : props.Label;
|
|
120
124
|
return (React.createElement("div", { ref: stylableSelect, style: { position: 'relative', display: 'inline-block', width: 'inherit' } },
|
|
121
|
-
|
|
122
|
-
React.createElement("label", { className:
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
React.createElement(
|
|
126
|
-
|
|
127
|
-
: null) : null,
|
|
125
|
+
showHelpIcon || showLabel ?
|
|
126
|
+
React.createElement("label", { className: "d-flex align-items-center" },
|
|
127
|
+
React.createElement("span", null, showLabel ? label : ''),
|
|
128
|
+
showHelpIcon && (React.createElement("span", { onMouseEnter: function () { return setShowHelp(true); }, onMouseLeave: function () { return setShowHelp(false); }, "data-tooltip": guid, className: "ml-2 d-flex align-items-center" },
|
|
129
|
+
React.createElement(gpa_symbols_1.ReactIcons.QuestionMark, { Color: "var(--info)", Size: 20 }))))
|
|
130
|
+
: null,
|
|
128
131
|
props.Help !== undefined ?
|
|
129
132
|
React.createElement(ToolTip_1.default, { Show: showHelp, Target: guid, Class: "info", Position: "bottom" }, props.Help)
|
|
130
133
|
: null,
|
package/lib/TextArea.js
CHANGED
|
@@ -43,7 +43,7 @@ var gpa_symbols_1 = require("@gpa-gemstone/gpa-symbols");
|
|
|
43
43
|
function TextArea(props) {
|
|
44
44
|
// Internal ref and state hooks for managing the component state.
|
|
45
45
|
var internal = React.useRef(false);
|
|
46
|
-
var guid = React.
|
|
46
|
+
var guid = React.useState((0, helper_functions_1.CreateGuid)())[0];
|
|
47
47
|
var _a = React.useState(false), showHelp = _a[0], setShowHelp = _a[1];
|
|
48
48
|
var _b = React.useState(''), heldVal = _b[0], setHeldVal = _b[1];
|
|
49
49
|
// Effect to handle changes to the record's field value.
|
|
@@ -66,14 +66,13 @@ function TextArea(props) {
|
|
|
66
66
|
var label = props.Label === undefined ? props.Field : props.Label;
|
|
67
67
|
return (React.createElement("div", { className: "form-group" },
|
|
68
68
|
showHelpIcon || showLabel ?
|
|
69
|
-
React.createElement("label", { className:
|
|
70
|
-
showLabel ? label : '',
|
|
71
|
-
showHelpIcon
|
|
72
|
-
React.createElement(
|
|
73
|
-
|
|
74
|
-
: null) : null,
|
|
69
|
+
React.createElement("label", { className: "d-flex align-items-center" },
|
|
70
|
+
React.createElement("span", null, showLabel ? label : ''),
|
|
71
|
+
showHelpIcon && (React.createElement("span", { className: "ml-2 d-flex align-items-center", onMouseEnter: function () { return setShowHelp(true); }, onMouseLeave: function () { return setShowHelp(false); }, "data-tooltip": guid },
|
|
72
|
+
React.createElement(gpa_symbols_1.ReactIcons.QuestionMark, { Color: "var(--info)", Size: 20 }))))
|
|
73
|
+
: null,
|
|
75
74
|
showHelpIcon ?
|
|
76
|
-
React.createElement(ToolTip_1.default, { Show: showHelp, Target: guid
|
|
75
|
+
React.createElement(ToolTip_1.default, { Show: showHelp, Target: guid, Class: "info", Position: "bottom" }, props.Help)
|
|
77
76
|
: null,
|
|
78
77
|
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 }),
|
|
79
78
|
React.createElement("div", { className: "invalid-feedback" }, props.Feedback == null ? props.Field + ' is a required field.' : props.Feedback)));
|
package/lib/TimePicker.js
CHANGED
|
@@ -39,17 +39,20 @@ var ToolTip_1 = require("./ToolTip");
|
|
|
39
39
|
var helper_functions_1 = require("@gpa-gemstone/helper-functions");
|
|
40
40
|
var gpa_symbols_1 = require("@gpa-gemstone/gpa-symbols");
|
|
41
41
|
function DatePicker(props) {
|
|
42
|
-
var
|
|
43
|
-
var
|
|
44
|
-
|
|
42
|
+
var guid = React.useState((0, helper_functions_1.CreateGuid)())[0];
|
|
43
|
+
var _a = React.useState(false), showHelp = _a[0], setShowHelp = _a[1];
|
|
44
|
+
// Variables to control the rendering of label and help icon.
|
|
45
|
+
var showLabel = props.Label !== "";
|
|
46
|
+
var showHelpIcon = props.Help !== undefined;
|
|
47
|
+
var label = props.Label === undefined ? props.Field : props.Label;
|
|
45
48
|
return (React.createElement("div", { className: "form-group" },
|
|
46
|
-
|
|
47
|
-
React.createElement("label", { className:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
:
|
|
52
|
-
React.createElement(ToolTip_1.default, { Show: showHelp, Target: guid
|
|
49
|
+
showHelpIcon || showLabel ?
|
|
50
|
+
React.createElement("label", { className: "d-flex align-items-center" },
|
|
51
|
+
React.createElement("span", null, showLabel ? label : ''),
|
|
52
|
+
showHelpIcon && (React.createElement("span", { className: "ml-2 d-flex align-items-center", onMouseEnter: function () { return setShowHelp(true); }, onMouseLeave: function () { return setShowHelp(false); }, "data-tooltip": guid },
|
|
53
|
+
React.createElement(gpa_symbols_1.ReactIcons.QuestionMark, { Color: "var(--info)", Size: 20 }))))
|
|
54
|
+
: null,
|
|
55
|
+
React.createElement(ToolTip_1.default, { Show: showHelp, Target: guid, Class: "info", Position: "bottom" }, props.Help),
|
|
53
56
|
React.createElement("input", { className: 'form-control' + (props.Valid(props.Field) ? '' : ' is-invalid'), type: "time", step: props.Step === null ? 60 : props.Step, onChange: function (evt) {
|
|
54
57
|
var record = __assign({}, props.Record);
|
|
55
58
|
if (evt.target.value !== '')
|
package/lib/ToggleSwitch.js
CHANGED
|
@@ -39,22 +39,24 @@ var helper_functions_1 = require("@gpa-gemstone/helper-functions");
|
|
|
39
39
|
var ToolTip_1 = require("./ToolTip");
|
|
40
40
|
var gpa_symbols_1 = require("@gpa-gemstone/gpa-symbols");
|
|
41
41
|
function ToggleSwitch(props) {
|
|
42
|
-
var helpID = React.
|
|
43
|
-
var switchID = React.
|
|
42
|
+
var helpID = React.useState((0, helper_functions_1.CreateGuid)())[0];
|
|
43
|
+
var switchID = React.useState((0, helper_functions_1.CreateGuid)())[0];
|
|
44
44
|
var _a = React.useState(false), showHelp = _a[0], setShowHelp = _a[1];
|
|
45
|
+
// Variables to control the rendering of label and help icon.
|
|
45
46
|
var showHelpIcon = props.Help !== undefined;
|
|
47
|
+
var label = props.Label === undefined ? props.Field : props.Label;
|
|
46
48
|
return (React.createElement("div", { className: "custom-control custom-switch", style: props.Style },
|
|
47
49
|
React.createElement("input", { type: "checkbox", className: "custom-control-input", onChange: function (evt) {
|
|
48
50
|
var record = __assign({}, props.Record);
|
|
49
51
|
record[props.Field] = evt.target.checked;
|
|
50
52
|
props.Setter(record);
|
|
51
|
-
}, value: props.Record[props.Field] ? 'on' : 'off', checked: props.Record[props.Field], disabled: props.Disabled == null ? false : props.Disabled, id: switchID
|
|
52
|
-
React.createElement("label", { className: "custom-control-label", htmlFor: switchID
|
|
53
|
-
|
|
53
|
+
}, value: props.Record[props.Field] ? 'on' : 'off', checked: props.Record[props.Field], disabled: props.Disabled == null ? false : props.Disabled, id: switchID }),
|
|
54
|
+
React.createElement("label", { className: "custom-control-label d-flex align-items-center", htmlFor: switchID },
|
|
55
|
+
React.createElement("span", null, label),
|
|
54
56
|
showHelpIcon ?
|
|
55
57
|
React.createElement(React.Fragment, null,
|
|
56
|
-
React.createElement("
|
|
57
|
-
React.createElement(gpa_symbols_1.ReactIcons.QuestionMark, { Color:
|
|
58
|
-
React.createElement(ToolTip_1.default, { Show: showHelp, Target: helpID
|
|
58
|
+
React.createElement("span", { className: "ml-2 d-flex align-items-center", onMouseEnter: function () { return setShowHelp(true); }, onMouseLeave: function () { return setShowHelp(false); }, "data-tooltip": helpID },
|
|
59
|
+
React.createElement(gpa_symbols_1.ReactIcons.QuestionMark, { Color: "var(--info)", Size: 20 })),
|
|
60
|
+
React.createElement(ToolTip_1.default, { Show: showHelp, Target: helpID, Zindex: 9999, Class: "info", Position: "bottom" }, props.Help))
|
|
59
61
|
: null)));
|
|
60
62
|
}
|
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.85",
|
|
4
4
|
"description": "React Form modules for gpa webapps",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"typescript": "5.5.3"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@gpa-gemstone/application-typings": "0.0.
|
|
49
|
-
"@gpa-gemstone/gpa-symbols": "0.0.
|
|
50
|
-
"@gpa-gemstone/helper-functions": "0.0.
|
|
48
|
+
"@gpa-gemstone/application-typings": "0.0.83",
|
|
49
|
+
"@gpa-gemstone/gpa-symbols": "0.0.49",
|
|
50
|
+
"@gpa-gemstone/helper-functions": "0.0.39",
|
|
51
51
|
"@types/react": "^17.0.14",
|
|
52
52
|
"@types/styled-components": "^5.1.11",
|
|
53
53
|
"lodash": "^4.17.21",
|