@steroidsjs/core 2.2.41 → 2.2.44
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.
|
@@ -58,11 +58,15 @@ var LocaleComponent = /** @class */ (function () {
|
|
|
58
58
|
LocaleComponent.prototype.moment = function (date, format) {
|
|
59
59
|
if (date === void 0) { date = undefined; }
|
|
60
60
|
if (format === void 0) { format = undefined; }
|
|
61
|
-
if (this.backendTimeZone
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
if (date && this.backendTimeZone) {
|
|
62
|
+
if (date.length === 16
|
|
63
|
+
&& moment_1["default"](date, 'YYYY-MM-DD HH:mm').isValid()) {
|
|
64
|
+
date += ':00';
|
|
65
|
+
}
|
|
66
|
+
if (date.length === 19
|
|
67
|
+
&& moment_1["default"](date, 'YYYY-MM-DD HH:mm:ss').isValid()) {
|
|
68
|
+
date += this.backendTimeZone;
|
|
69
|
+
}
|
|
66
70
|
}
|
|
67
71
|
return moment_1["default"](date, format).locale(this.language);
|
|
68
72
|
};
|
package/package.json
CHANGED
package/reducers/form.js
CHANGED
|
@@ -35,7 +35,7 @@ function reducerItem(state, action) {
|
|
|
35
35
|
}
|
|
36
36
|
switch (action.type) {
|
|
37
37
|
case form_1.FORM_INITIALIZE:
|
|
38
|
-
return __assign(__assign({ errors: {}, isInvalid: false, isSubmitting: false }, state), { values: (state === null || state === void 0 ? void 0 : state.values)
|
|
38
|
+
return __assign(__assign({ errors: {}, isInvalid: false, isSubmitting: false }, state), { values: cloneDeep_1["default"](action.values || {}) || (state === null || state === void 0 ? void 0 : state.values), initialValues: action.values || (state === null || state === void 0 ? void 0 : state.values) || null });
|
|
39
39
|
case form_1.FORM_CHANGE:
|
|
40
40
|
if (isObject_1["default"](action.nameOrObject)) {
|
|
41
41
|
var newValues = __assign(__assign({}, state.values), action.nameOrObject);
|
|
@@ -15,6 +15,11 @@ export interface IDropDownProps extends IAbsolutePositioningInputProps {
|
|
|
15
15
|
* @example MyCustomView
|
|
16
16
|
*/
|
|
17
17
|
view?: any;
|
|
18
|
+
/**
|
|
19
|
+
* В каком случае закрывать DropDown. По-умолчанию - `click-away`
|
|
20
|
+
* @example click-any
|
|
21
|
+
*/
|
|
22
|
+
closeMode?: 'click-away' | 'click-any';
|
|
18
23
|
}
|
|
19
24
|
export interface IDropDownViewProps extends IDropDownProps, IAbsolutePositioningOutputProps {
|
|
20
25
|
/**
|
|
@@ -36,15 +36,23 @@ function DropDown(props) {
|
|
|
36
36
|
// Outside click -> close
|
|
37
37
|
var forwardedRef = react_1.useRef(null);
|
|
38
38
|
react_use_1.useClickAway(forwardedRef, function (event) {
|
|
39
|
-
if (
|
|
40
|
-
if (
|
|
41
|
-
props.onClose
|
|
39
|
+
if (props.closeMode === 'click-away') {
|
|
40
|
+
if (isManualControl) {
|
|
41
|
+
if (!childRef.current.contains(event.target) && props.onClose) {
|
|
42
|
+
props.onClose();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
onHide();
|
|
42
47
|
}
|
|
43
48
|
}
|
|
44
|
-
|
|
49
|
+
});
|
|
50
|
+
// Any click -> close
|
|
51
|
+
react_use_1.useEvent('click', react_1.useCallback(function () {
|
|
52
|
+
if (isComponentExist && isComponentVisible && props.closeMode === 'click-any') {
|
|
45
53
|
onHide();
|
|
46
54
|
}
|
|
47
|
-
});
|
|
55
|
+
}, [isComponentExist, isComponentVisible, onHide, props.closeMode]));
|
|
48
56
|
var calculatePosition = react_1.useCallback(function (componentSize) {
|
|
49
57
|
calculateAbsolutePosition(position, childRef.current, componentSize);
|
|
50
58
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -68,7 +76,7 @@ function DropDown(props) {
|
|
|
68
76
|
isComponentExist && (
|
|
69
77
|
// TODO Change Portal to global
|
|
70
78
|
React.createElement(TooltipPortalInner_1["default"], null,
|
|
71
|
-
React.createElement(DropDownView, { className: props.className, forwardedRef: forwardedRef, content: props.content, position: position, style: style, calculatePosition: calculatePosition, isComponentVisible: isComponentVisible })))));
|
|
79
|
+
React.createElement(DropDownView, { className: props.className, forwardedRef: forwardedRef, content: props.content, position: position, style: style, calculatePosition: calculatePosition, isComponentVisible: isComponentVisible, onClose: onHide })))));
|
|
72
80
|
}
|
|
73
81
|
DropDown.defaultProps = {
|
|
74
82
|
autoPositioning: false,
|
package/ui/form/Form/Form.js
CHANGED
|
@@ -74,6 +74,7 @@ var React = __importStar(require("react"));
|
|
|
74
74
|
var get_1 = __importDefault(require("lodash-es/get"));
|
|
75
75
|
var isUndefined_1 = __importDefault(require("lodash-es/isUndefined"));
|
|
76
76
|
var set_1 = __importDefault(require("lodash-es/set"));
|
|
77
|
+
var cloneDeep_1 = __importDefault(require("lodash-es/cloneDeep"));
|
|
77
78
|
var react_1 = require("react");
|
|
78
79
|
var react_use_1 = require("react-use");
|
|
79
80
|
var notifications_1 = require("../../../actions/notifications");
|
|
@@ -186,7 +187,7 @@ function Form(props) {
|
|
|
186
187
|
}
|
|
187
188
|
});
|
|
188
189
|
}
|
|
189
|
-
cleanedValues = form_1.cleanEmptyObject(values);
|
|
190
|
+
cleanedValues = cloneDeep_1["default"](form_1.cleanEmptyObject(values));
|
|
190
191
|
// Event onBeforeSubmit
|
|
191
192
|
if (props.onBeforeSubmit && props.onBeforeSubmit.call(null, cleanedValues) === false) {
|
|
192
193
|
dispatch(form_2.formSetSubmitting(props.formId, false));
|