@steroidsjs/core 2.2.54 → 2.2.57
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/Form/Form.d.ts +1 -0
- package/ui/form/Form/Form.js +1 -14
- 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);
|
package/ui/form/Form/Form.d.ts
CHANGED
package/ui/form/Form/Form.js
CHANGED
|
@@ -131,19 +131,6 @@ function Form(props) {
|
|
|
131
131
|
react_use_1.useUpdateEffect(function () {
|
|
132
132
|
updateQuery(values);
|
|
133
133
|
}, [updateQuery, values]);
|
|
134
|
-
// Auto focus
|
|
135
|
-
react_use_1.useMount(function () {
|
|
136
|
-
if (props.autoFocus && process.env.IS_WEB) {
|
|
137
|
-
// TODO
|
|
138
|
-
/*const element: any = findDOMNode(this);
|
|
139
|
-
const inputEl = element.querySelector('input:not([type=hidden])');
|
|
140
|
-
setTimeout(() => {
|
|
141
|
-
if (inputEl && inputEl.focus) {
|
|
142
|
-
inputEl.focus();
|
|
143
|
-
}
|
|
144
|
-
}, 10);*/
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
134
|
// Auto save
|
|
148
135
|
react_use_1.useUpdateEffect(function () {
|
|
149
136
|
if (props.autoSave && values) {
|
|
@@ -346,7 +333,7 @@ function Form(props) {
|
|
|
346
333
|
? components.ui.renderView(props.view || 'form.FormView', __assign(__assign({}, props.viewProps), { isInvalid: isInvalid,
|
|
347
334
|
isSubmitting: isSubmitting,
|
|
348
335
|
layout: layout,
|
|
349
|
-
onSubmit: onSubmit, submitLabel: props.submitLabel, fields: props.fields, children: props.children, isBordered: props.isBordered, className: props.className, style: props.style }))
|
|
336
|
+
onSubmit: onSubmit, submitLabel: props.submitLabel, fields: props.fields, children: props.children, isBordered: props.isBordered, className: props.className, style: props.style, autoFocus: props.autoFocus }))
|
|
350
337
|
: props.children));
|
|
351
338
|
}
|
|
352
339
|
Form.defaultProps = {
|