@steroidsjs/core 2.2.43 → 2.2.46
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/hooks/useDataProvider.js
CHANGED
|
@@ -157,7 +157,7 @@ function useDataProvider(config) {
|
|
|
157
157
|
else if (!isEqual_1["default"](prevValues, config.initialSelectedIds)) {
|
|
158
158
|
fetchRemote(false);
|
|
159
159
|
}
|
|
160
|
-
else if (autoComplete.enable) {
|
|
160
|
+
else if (autoComplete.enable || (config.autoFetch && isAutoFetchedRef.current === true)) {
|
|
161
161
|
if (delayTimerRef.current) {
|
|
162
162
|
clearTimeout(delayTimerRef.current);
|
|
163
163
|
}
|
package/hooks/useFile.js
CHANGED
|
@@ -50,7 +50,7 @@ function useFile(props) {
|
|
|
50
50
|
var initialFiles = props.initialFiles;
|
|
51
51
|
if (!initialFiles) {
|
|
52
52
|
// Find in form values
|
|
53
|
-
initialFiles = form.formSelector(function (state) { return get_1["default"](state,
|
|
53
|
+
initialFiles = form.formSelector(function (state) { return get_1["default"](state, 'values.' + props.input.name.replace(/Ids?$/, '')); });
|
|
54
54
|
}
|
|
55
55
|
react_1.useEffect(function () {
|
|
56
56
|
if (initialFiles) {
|
package/package.json
CHANGED
|
@@ -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,
|