@steroidsjs/core 2.2.45 → 2.2.48
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/useDataSelect.js +8 -2
- package/hooks/useFetch.d.ts +1 -1
- package/hooks/useFile.js +1 -1
- package/package.json +1 -1
- package/ui/form/Form/Form.js +2 -2
package/hooks/useDataSelect.js
CHANGED
|
@@ -30,6 +30,12 @@ var getLinearItems = function (items, groupAttribute) {
|
|
|
30
30
|
return result;
|
|
31
31
|
};
|
|
32
32
|
exports.getLinearItems = getLinearItems;
|
|
33
|
+
var isIdExists = function (id) {
|
|
34
|
+
if (typeof id === 'boolean') {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
return !!id;
|
|
38
|
+
};
|
|
33
39
|
function useDataSelect(config) {
|
|
34
40
|
// Get primary key
|
|
35
41
|
var primaryKey = config.primaryKey || defaultProps.primaryKey;
|
|
@@ -51,7 +57,7 @@ function useDataSelect(config) {
|
|
|
51
57
|
&& initialSelectedIds.length > 0
|
|
52
58
|
? initialSelectedIds
|
|
53
59
|
.map(function (selectedId) { return linearItems.find(function (item) { return item.id === selectedId; }); })
|
|
54
|
-
.filter(
|
|
60
|
+
.filter(isIdExists)
|
|
55
61
|
: []; }, [initialSelectedIds, linearItems]);
|
|
56
62
|
// State
|
|
57
63
|
var _a = react_1.useState(false), isOpened = _a[0], setIsOpened = _a[1];
|
|
@@ -70,7 +76,7 @@ function useDataSelect(config) {
|
|
|
70
76
|
}
|
|
71
77
|
else {
|
|
72
78
|
var id_1 = ids;
|
|
73
|
-
if (!id_1) {
|
|
79
|
+
if (!isIdExists(id_1)) {
|
|
74
80
|
setSelectedIdsInternal([]);
|
|
75
81
|
}
|
|
76
82
|
else if (config.multiple) {
|
package/hooks/useFetch.d.ts
CHANGED
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
package/ui/form/Form/Form.js
CHANGED
|
@@ -160,9 +160,9 @@ function Form(props) {
|
|
|
160
160
|
// OnChange handler
|
|
161
161
|
react_use_1.useUpdateEffect(function () {
|
|
162
162
|
if (props.onChange) {
|
|
163
|
-
props.onChange(values);
|
|
163
|
+
props.onChange.call(null, values);
|
|
164
164
|
}
|
|
165
|
-
}, [props, values]);
|
|
165
|
+
}, [props.onChange, values]);
|
|
166
166
|
// OnSubmit handler
|
|
167
167
|
var onSubmit = react_1.useCallback(function (e) {
|
|
168
168
|
if (e === void 0) { e = null; }
|