@steroidsjs/core 2.2.53 → 2.2.56
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/package.json +1 -1
- package/ui/form/BlankField/BlankField.js +2 -1
- package/ui/form/DateField/useDateTime.d.ts +1 -1
- package/ui/form/DateField/useDateTime.js +4 -4
- package/ui/form/DateTimeField/DateTimeField.js +6 -3
- package/ui/form/RadioListField/RadioListField.js +2 -0
- package/ui/form/TimeField/TimeField.js +2 -1
package/package.json
CHANGED
|
@@ -25,6 +25,7 @@ exports.__esModule = true;
|
|
|
25
25
|
var React = __importStar(require("react"));
|
|
26
26
|
var fieldWrapper_1 = __importDefault(require("../Field/fieldWrapper"));
|
|
27
27
|
function BlankField(props) {
|
|
28
|
-
|
|
28
|
+
var _a;
|
|
29
|
+
return React.createElement("span", null, props.text || props.children || ((_a = props.input) === null || _a === void 0 ? void 0 : _a.value));
|
|
29
30
|
}
|
|
30
31
|
exports["default"] = fieldWrapper_1["default"]('BlankField', BlankField);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IDateInputStateInput } from '../../form/DateField/useDateInputState';
|
|
2
|
-
interface IUseDateTimeProps extends Pick<IDateInputStateInput, 'displayFormat' | 'valueFormat' | 'input'> {
|
|
2
|
+
interface IUseDateTimeProps extends Pick<IDateInputStateInput, 'displayFormat' | 'valueFormat' | 'input' | 'useUTC'> {
|
|
3
3
|
dateTimeSeparator: string;
|
|
4
4
|
}
|
|
5
5
|
/**
|
|
@@ -13,16 +13,16 @@ var calendar_1 = require("../../../utils/calendar");
|
|
|
13
13
|
*/
|
|
14
14
|
function useDateTime(props) {
|
|
15
15
|
var _a = props.valueFormat.split(props.dateTimeSeparator), dateValueFormat = _a[0], timeValueFormat = _a[1];
|
|
16
|
-
var dateValue = react_1.useMemo(function () { return calendar_1.convertDate(props.input.value, [props.valueFormat, props.displayFormat], dateValueFormat, false,
|
|
17
|
-
var timeValue = react_1.useMemo(function () { return calendar_1.convertDate(props.input.value, [props.displayFormat, props.valueFormat], timeValueFormat, false,
|
|
16
|
+
var dateValue = react_1.useMemo(function () { return calendar_1.convertDate(props.input.value, [props.valueFormat, props.displayFormat], dateValueFormat, false, props.useUTC); }, [dateValueFormat, props.displayFormat, props.input.value, props.valueFormat]);
|
|
17
|
+
var timeValue = react_1.useMemo(function () { return calendar_1.convertDate(props.input.value, [props.displayFormat, props.valueFormat], timeValueFormat, false, props.useUTC); }, [props.displayFormat, props.input.value, props.valueFormat, timeValueFormat]);
|
|
18
18
|
// Handler for calendar and time picker changes
|
|
19
19
|
var onDateSelect = react_1.useCallback(function (date) {
|
|
20
20
|
var result = date + props.dateTimeSeparator + (timeValue || '00:00');
|
|
21
|
-
props.input.onChange.call(null, calendar_1.convertDate(result, [props.valueFormat, 'YYYY-MM-DD HH:mm'], props.valueFormat,
|
|
21
|
+
props.input.onChange.call(null, calendar_1.convertDate(result, [props.valueFormat, 'YYYY-MM-DD HH:mm'], props.valueFormat, props.useUTC));
|
|
22
22
|
}, [props.dateTimeSeparator, props.input.onChange, props.valueFormat, timeValue]);
|
|
23
23
|
var onTimeSelect = react_1.useCallback(function (time) {
|
|
24
24
|
var result = (dateValue || moment_1["default"]().format(dateValueFormat)) + props.dateTimeSeparator + time;
|
|
25
|
-
props.input.onChange.call(null, calendar_1.convertDate(result, [props.valueFormat, 'YYYY-MM-DD HH:mm'], props.valueFormat,
|
|
25
|
+
props.input.onChange.call(null, calendar_1.convertDate(result, [props.valueFormat, 'YYYY-MM-DD HH:mm'], props.valueFormat, props.useUTC));
|
|
26
26
|
}, [dateValue, dateValueFormat, props.dateTimeSeparator, props.input.onChange, props.valueFormat]);
|
|
27
27
|
return {
|
|
28
28
|
dateValue: dateValue,
|
|
@@ -35,13 +35,15 @@ function DateTimeField(props) {
|
|
|
35
35
|
placeholder: props.placeholder,
|
|
36
36
|
valueFormat: props.valueFormat,
|
|
37
37
|
displayFormat: props.displayFormat,
|
|
38
|
-
useUTC:
|
|
38
|
+
useUTC: props.useUTC
|
|
39
39
|
}), onClear = _a.onClear, onClose = _a.onClose, isOpened = _a.isOpened, inputProps = _a.inputProps;
|
|
40
|
+
console.log("DATETIME INPUT", inputProps);
|
|
40
41
|
var _b = useDateTime_1["default"]({
|
|
41
42
|
displayFormat: props.displayFormat,
|
|
42
43
|
dateTimeSeparator: DATE_TIME_SEPARATOR,
|
|
43
44
|
input: props.input,
|
|
44
|
-
valueFormat: props.valueFormat
|
|
45
|
+
valueFormat: props.valueFormat,
|
|
46
|
+
useUTC: props.useUTC
|
|
45
47
|
}), dateValueFormat = _b.dateValueFormat, dateValue = _b.dateValue, timeValue = _b.timeValue, onDateSelect = _b.onDateSelect, onTimeSelect = _b.onTimeSelect;
|
|
46
48
|
// Calendar props
|
|
47
49
|
var calendarProps = react_1.useMemo(function () { return ({
|
|
@@ -69,6 +71,7 @@ DateTimeField.defaultProps = {
|
|
|
69
71
|
required: false,
|
|
70
72
|
className: '',
|
|
71
73
|
displayFormat: 'DD.MM.YYYY' + DATE_TIME_SEPARATOR + 'HH:mm',
|
|
72
|
-
valueFormat: 'YYYY-MM-DD' + DATE_TIME_SEPARATOR + 'HH:mm'
|
|
74
|
+
valueFormat: 'YYYY-MM-DD' + DATE_TIME_SEPARATOR + 'HH:mm',
|
|
75
|
+
useUTC: true
|
|
73
76
|
};
|
|
74
77
|
exports["default"] = fieldWrapper_1["default"]('DateTimeField', DateTimeField);
|
|
@@ -37,7 +37,9 @@ function RadioListField(props) {
|
|
|
37
37
|
var inputProps = react_1.useMemo(function () { return (__assign(__assign({}, props.inputProps), { type: 'radio', name: props.input.name, disabled: props.disabled, onChange: function (value) { return props.input.onChange(value); } })); }, [props.disabled, props.input, props.inputProps]);
|
|
38
38
|
// Sync with form
|
|
39
39
|
react_1.useEffect(function () {
|
|
40
|
+
var _a;
|
|
40
41
|
props.input.onChange.call(null, selectedIds[0]);
|
|
42
|
+
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(null, selectedIds[0]);
|
|
41
43
|
}, [props.input.onChange, selectedIds]);
|
|
42
44
|
return components.ui.renderView(props.view || 'form.RadioListFieldView', __assign(__assign({}, props), { items: items,
|
|
43
45
|
inputProps: inputProps,
|