@gpa-gemstone/react-forms 1.1.60 → 1.1.62
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 -101
- 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 +6 -5
package/lib/DatePicker.js
CHANGED
|
@@ -1,214 +1,221 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// ******************************************************************************************************
|
|
3
|
-
// DatePicker.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
|
-
// 02/05/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
|
-
|
|
37
|
-
var
|
|
38
|
-
var
|
|
39
|
-
var
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
var
|
|
48
|
-
var
|
|
49
|
-
//
|
|
50
|
-
var
|
|
51
|
-
|
|
52
|
-
var
|
|
53
|
-
var
|
|
54
|
-
var
|
|
55
|
-
|
|
56
|
-
React.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
React.
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
return
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
if (
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
// ******************************************************************************************************
|
|
3
|
+
// DatePicker.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
|
+
// 02/05/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
|
+
exports.default = DateTimePicker;
|
|
37
|
+
var React = require("react");
|
|
38
|
+
var moment = require("moment");
|
|
39
|
+
var DateTimePopup_1 = require("./DateTimeUI/DateTimePopup");
|
|
40
|
+
var helper_functions_1 = require("@gpa-gemstone/helper-functions");
|
|
41
|
+
var HelperMessage_1 = require("./HelperMessage");
|
|
42
|
+
/**
|
|
43
|
+
* Component that allows a user to pick a date or datetime.
|
|
44
|
+
*/
|
|
45
|
+
function DateTimePicker(props) {
|
|
46
|
+
// Formats for displaying dates in the input box and storing in the record.
|
|
47
|
+
var boxFormat = getBoxFormat(props.Type, props.Accuracy);
|
|
48
|
+
var recordFormat = props.Format !== undefined ? props.Format : "YYYY-MM-DD" + (props.Type === undefined || props.Type === 'date' ? "" : "[T]HH:mm:ss.SSS[Z]");
|
|
49
|
+
// Parse the date from the record.
|
|
50
|
+
var parse = function (r) { return moment(props.Record[props.Field], recordFormat); };
|
|
51
|
+
// State and ref declarations.
|
|
52
|
+
var divRef = React.useRef(null);
|
|
53
|
+
var _a = React.useState(""), guid = _a[0], setGuid = _a[1];
|
|
54
|
+
var _b = React.useState(false), showHelp = _b[0], setShowHelp = _b[1];
|
|
55
|
+
// Adds a buffer between the outside props and what the box is reading to prevent box overwriting every render with a keystroke
|
|
56
|
+
var _c = React.useState(parse(props.Record).format(boxFormat)), boxRecord = _c[0], setBoxRecord = _c[1];
|
|
57
|
+
var _d = React.useState(parse(props.Record)), pickerRecord = _d[0], setPickerRecord = _d[1];
|
|
58
|
+
var _e = React.useState(""), feedbackMessage = _e[0], setFeedbackMessage = _e[1];
|
|
59
|
+
var _f = React.useState(false), showOverlay = _f[0], setShowOverlay = _f[1];
|
|
60
|
+
var _g = React.useState(0), top = _g[0], setTop = _g[1];
|
|
61
|
+
var _h = React.useState(0), left = _h[0], setLeft = _h[1];
|
|
62
|
+
React.useEffect(function () {
|
|
63
|
+
setGuid((0, helper_functions_1.CreateGuid)());
|
|
64
|
+
}, []);
|
|
65
|
+
React.useEffect(function () {
|
|
66
|
+
if (props.Record[props.Field] !== null) {
|
|
67
|
+
setPickerRecord(parse(props.Record));
|
|
68
|
+
setBoxRecord(parse(props.Record).format(boxFormat));
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
setPickerRecord(undefined);
|
|
72
|
+
setBoxRecord('');
|
|
73
|
+
}
|
|
74
|
+
}, [props.Record]);
|
|
75
|
+
React.useLayoutEffect(function () {
|
|
76
|
+
var node = (divRef.current !== null ? (0, helper_functions_1.GetNodeSize)(divRef.current) : { top: top, left: left, height: 0, width: 0 });
|
|
77
|
+
if (node.height === 0 && node.width === 0) {
|
|
78
|
+
setLeft(0);
|
|
79
|
+
setTop(-9999);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
setLeft(node.left + 0.5 * node.width);
|
|
83
|
+
setTop(node.top + node.height + 10);
|
|
84
|
+
});
|
|
85
|
+
React.useEffect(function () {
|
|
86
|
+
window.addEventListener('click', onWindowClick);
|
|
87
|
+
return function () { window.removeEventListener('click', onWindowClick); };
|
|
88
|
+
}, [props.Record, props.Field, boxFormat]);
|
|
89
|
+
function setPickerAndRecord(arg) {
|
|
90
|
+
var _a, _b;
|
|
91
|
+
var _c;
|
|
92
|
+
setPickerRecord(arg);
|
|
93
|
+
if (((_c = props.AllowEmpty) !== null && _c !== void 0 ? _c : false) && arg === undefined && props.Record[props.Field] !== null)
|
|
94
|
+
props.Setter(__assign(__assign({}, props.Record), (_a = {}, _a[props.Field] = null, _a)));
|
|
95
|
+
var valid = arg != undefined && validateDate(arg);
|
|
96
|
+
if (valid && props.Record[props.Field].toString() !== arg.format(recordFormat))
|
|
97
|
+
props.Setter(__assign(__assign({}, props.Record), (_b = {}, _b[props.Field] = arg.format(recordFormat), _b)));
|
|
98
|
+
}
|
|
99
|
+
// Handle clicks outside the component.
|
|
100
|
+
function onWindowClick(evt) {
|
|
101
|
+
if (evt.target.closest(".gpa-gemstone-datetime") == null) {
|
|
102
|
+
setShowOverlay(false);
|
|
103
|
+
if (props.Record[props.Field] !== null) {
|
|
104
|
+
setPickerAndRecord(parse(props.Record));
|
|
105
|
+
setBoxRecord(parse(props.Record).format(boxFormat));
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
setPickerAndRecord(undefined);
|
|
109
|
+
setBoxRecord('');
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function getBoxFormat(type, accuracy) {
|
|
114
|
+
var dateTime = type !== null && type !== void 0 ? type : 'date';
|
|
115
|
+
var timeUnit = accuracy !== null && accuracy !== void 0 ? accuracy : 'second';
|
|
116
|
+
if (dateTime === 'time') {
|
|
117
|
+
if (timeUnit === 'minute') {
|
|
118
|
+
return "HH:mm";
|
|
119
|
+
}
|
|
120
|
+
else if (timeUnit === 'second') {
|
|
121
|
+
return "HH:mm:ss";
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
return "HH:mm:ss.SSS";
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
else if (dateTime === 'datetime-local') {
|
|
128
|
+
if (timeUnit === 'minute') {
|
|
129
|
+
return "YYYY-MM-DD[T]HH:mm";
|
|
130
|
+
}
|
|
131
|
+
else if (timeUnit === 'second') {
|
|
132
|
+
return "YYYY-MM-DD[T]HH:mm:ss";
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
return "YYYY-MM-DD[T]HH:mm:ss.SSS";
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
return "YYYY-MM-DD";
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
function getFeedbackMessage() {
|
|
143
|
+
if (feedbackMessage.length != 0) {
|
|
144
|
+
return feedbackMessage;
|
|
145
|
+
}
|
|
146
|
+
else if (props.Feedback == null || props.Feedback.length == 0) {
|
|
147
|
+
return "".concat(props.Field.toString(), " is a required field.");
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
return props.Feedback;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function validateDate(date) {
|
|
154
|
+
var minStartDate = props.MinDate != null ? props.MinDate.startOf('day') : moment("1753-01-01", "YYYY-MM-DD").startOf('day');
|
|
155
|
+
if (!date.isValid()) {
|
|
156
|
+
setFeedbackMessage("Please enter a valid date.");
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
else if (date.startOf('day').isBefore(minStartDate)) {
|
|
160
|
+
setFeedbackMessage("Date must be on or after ".concat(minStartDate.format("MM-DD-YYYY")));
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
setFeedbackMessage("");
|
|
165
|
+
return true;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
// Variables for rendering labels and help icons.
|
|
169
|
+
var showLabel = props.Label !== "";
|
|
170
|
+
var showHelpIcon = props.Help !== undefined;
|
|
171
|
+
var label = props.Label === undefined ? props.Field : props.Label;
|
|
172
|
+
var step = props.Accuracy === 'millisecond' ? '0.001' : (props.Accuracy === 'minute' ? '60' : '1');
|
|
173
|
+
var IsValid = function () {
|
|
174
|
+
if (feedbackMessage.length > 0)
|
|
175
|
+
return false;
|
|
176
|
+
return props.Valid(props.Field);
|
|
177
|
+
};
|
|
178
|
+
function valueChange(value) {
|
|
179
|
+
var _a, _b;
|
|
180
|
+
var allowNull = props.AllowEmpty === undefined ? false : props.AllowEmpty;
|
|
181
|
+
var date = moment(value, boxFormat);
|
|
182
|
+
if (allowNull && value === '') {
|
|
183
|
+
props.Setter(__assign(__assign({}, props.Record), (_a = {}, _a[props.Field] = null, _a)));
|
|
184
|
+
setPickerAndRecord(undefined);
|
|
185
|
+
}
|
|
186
|
+
else if (validateDate(date)) {
|
|
187
|
+
props.Setter(__assign(__assign({}, props.Record), (_b = {}, _b[props.Field] = moment(value, boxFormat).format(recordFormat), _b)));
|
|
188
|
+
setPickerAndRecord(moment(value, boxFormat));
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
setPickerAndRecord(undefined);
|
|
192
|
+
}
|
|
193
|
+
setBoxRecord(value);
|
|
194
|
+
}
|
|
195
|
+
return (React.createElement("div", { className: "form-group", ref: divRef },
|
|
196
|
+
showHelpIcon || showLabel ?
|
|
197
|
+
React.createElement("label", null,
|
|
198
|
+
showLabel ? label : '',
|
|
199
|
+
showHelpIcon ? React.createElement("div", { style: {
|
|
200
|
+
width: 20,
|
|
201
|
+
height: 20,
|
|
202
|
+
borderRadius: '50%',
|
|
203
|
+
display: 'inline-block',
|
|
204
|
+
background: '#0D6EFD',
|
|
205
|
+
marginLeft: 10,
|
|
206
|
+
textAlign: 'center',
|
|
207
|
+
fontWeight: 'bold'
|
|
208
|
+
}, onMouseEnter: function () { return setShowHelp(true); }, onMouseLeave: function () { return setShowHelp(false); } }, " ? ") : null) : null,
|
|
209
|
+
showHelpIcon ?
|
|
210
|
+
React.createElement(HelperMessage_1.default, { Show: showHelp, Target: guid }, props.Help)
|
|
211
|
+
: null,
|
|
212
|
+
React.createElement("input", { "data-help": guid, className: "gpa-gemstone-datetime form-control ".concat(IsValid() ? '' : 'is-invalid'), type: props.Type === undefined ? 'date' : props.Type, onChange: function (evt) {
|
|
213
|
+
valueChange(evt.target.value);
|
|
214
|
+
}, onFocus: function () { setShowOverlay(true); }, value: boxRecord, disabled: props.Disabled === undefined ? false : props.Disabled, onClick: function (e) { e.preventDefault(); }, step: step }),
|
|
215
|
+
React.createElement("div", { className: "invalid-feedback" }, getFeedbackMessage()),
|
|
216
|
+
React.createElement(DateTimePopup_1.default, { Setter: function (d) {
|
|
217
|
+
setPickerAndRecord(d);
|
|
218
|
+
if (props.Type === 'date')
|
|
219
|
+
setShowOverlay(false);
|
|
220
|
+
}, Show: showOverlay, DateTime: pickerRecord, Valid: props.Valid(props.Field), Top: top, Center: left, Type: props.Type === undefined ? 'date' : props.Type, Accuracy: props.Accuracy })));
|
|
221
|
+
}
|
package/lib/DateRangePicker.d.ts
CHANGED
|
@@ -1,13 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
interface IProps<T> {
|
|
2
|
+
/**
|
|
3
|
+
* Record to be used in form
|
|
4
|
+
* @type {T}
|
|
5
|
+
*/
|
|
6
|
+
Record: T;
|
|
7
|
+
/**
|
|
8
|
+
* Field representing the start date in the record
|
|
9
|
+
* @type {keyof T}
|
|
10
|
+
*/
|
|
11
|
+
FromField: keyof T;
|
|
12
|
+
/**
|
|
13
|
+
* Field representing the end date in the record
|
|
14
|
+
* @type {keyof T}
|
|
15
|
+
*/
|
|
16
|
+
ToField: keyof T;
|
|
17
|
+
/**
|
|
18
|
+
* Setter function to update the Record
|
|
19
|
+
* @param record - Updated Record
|
|
20
|
+
*/
|
|
21
|
+
Setter: (record: T) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Label to display for the form, defaults to the Field prop
|
|
24
|
+
* @type {string}
|
|
25
|
+
* @optional
|
|
26
|
+
*/
|
|
27
|
+
Label: string;
|
|
28
|
+
/**
|
|
29
|
+
* Function to determine the validity of a field
|
|
30
|
+
* @param field - Field of the record to check
|
|
31
|
+
* @returns {boolean}
|
|
32
|
+
*/
|
|
33
|
+
Valid: (fieldFrom: keyof T, fieldTo: keyof T) => boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Flag to disable the input field
|
|
36
|
+
* @type {boolean}
|
|
37
|
+
* @optional
|
|
38
|
+
*/
|
|
39
|
+
Disabled?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Feedback message to show when input is invalid
|
|
42
|
+
* @type {string}
|
|
43
|
+
* @optional
|
|
44
|
+
*/
|
|
45
|
+
Feedback?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Date format to use for the input fields
|
|
48
|
+
* @type {string}
|
|
49
|
+
* @optional
|
|
50
|
+
*/
|
|
51
|
+
Format?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Value for the type attribute in input element, either 'datetime-local' or the default 'date'
|
|
54
|
+
* @type {'datetime-local' | 'date'}
|
|
55
|
+
* @optional
|
|
56
|
+
*/
|
|
57
|
+
Type?: ('datetime-local' | 'date');
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* DateRangePicker Component.
|
|
61
|
+
* Allows users to select a date range either by choosing predefined durations or by specifying custom dates.
|
|
62
|
+
*/
|
|
63
|
+
export default function DateRangePicker<T>(props: IProps<T>): JSX.Element;
|
|
64
|
+
export {};
|