@steroidsjs/core 2.2.52 → 2.2.55
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/content/DropDown/DropDown.d.ts +1 -0
- package/ui/content/DropDown/DropDown.js +7 -4
- 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
|
@@ -46,13 +46,15 @@ function DropDown(props) {
|
|
|
46
46
|
onHide();
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
});
|
|
49
|
+
}, ['mousedown', 'touchstart']);
|
|
50
50
|
// Any click -> close
|
|
51
|
-
|
|
51
|
+
var onAnyClick = react_1.useCallback(function () {
|
|
52
52
|
if (isComponentExist && isComponentVisible && props.closeMode === 'click-any') {
|
|
53
53
|
onHide();
|
|
54
54
|
}
|
|
55
|
-
}, [isComponentExist, isComponentVisible, onHide, props.closeMode])
|
|
55
|
+
}, [isComponentExist, isComponentVisible, onHide, props.closeMode]);
|
|
56
|
+
react_use_1.useEvent('mousedown', onAnyClick);
|
|
57
|
+
react_use_1.useEvent('touchstart', onAnyClick);
|
|
56
58
|
var calculatePosition = react_1.useCallback(function (componentSize) {
|
|
57
59
|
calculateAbsolutePosition(position, childRef.current, componentSize);
|
|
58
60
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -83,6 +85,7 @@ DropDown.defaultProps = {
|
|
|
83
85
|
componentDestroyDelay: 300,
|
|
84
86
|
defaultVisible: false,
|
|
85
87
|
gap: 15,
|
|
86
|
-
position: 'bottom'
|
|
88
|
+
position: 'bottom',
|
|
89
|
+
closeMode: 'click-away'
|
|
87
90
|
};
|
|
88
91
|
exports["default"] = DropDown;
|
|
@@ -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,
|