@bigbinary/neeto-folders-frontend 2.0.15 → 2.0.17
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/dist/components.js
CHANGED
|
@@ -42,7 +42,7 @@ import Checkbox from '@bigbinary/neetoui/Checkbox';
|
|
|
42
42
|
import Tree from '@bigbinary/neetoui/Tree';
|
|
43
43
|
import Lock from '@bigbinary/neeto-icons/Lock';
|
|
44
44
|
import { ConfigProvider, TreeSelect as TreeSelect$1 } from 'antd';
|
|
45
|
-
import { useField } from 'formik';
|
|
45
|
+
import { useField, useFormikContext } from 'formik';
|
|
46
46
|
import Down from '@bigbinary/neeto-icons/Down';
|
|
47
47
|
import Label from '@bigbinary/neetoui/Label';
|
|
48
48
|
import 'zustand';
|
|
@@ -1553,6 +1553,8 @@ var TreeSelect = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
1553
1553
|
_useField2$ = _useField2[2],
|
|
1554
1554
|
setValue = _useField2$.setValue,
|
|
1555
1555
|
setTouched = _useField2$.setTouched;
|
|
1556
|
+
var _useFormikContext = useFormikContext(),
|
|
1557
|
+
values = _useFormikContext.values;
|
|
1556
1558
|
var foldersMap = useMemo(function () {
|
|
1557
1559
|
return folders ? treeToMap(folders, "sid") : null;
|
|
1558
1560
|
}, [folders]);
|
|
@@ -1561,7 +1563,9 @@ var TreeSelect = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
1561
1563
|
var isValidParent = (activeFolder === null || activeFolder === void 0 ? void 0 : activeFolder.meta.depth) < config.maxDepth;
|
|
1562
1564
|
var parentId = isValidParent ? activeFolder.id : null;
|
|
1563
1565
|
useEffect(function () {
|
|
1564
|
-
|
|
1566
|
+
if (values.name === "") {
|
|
1567
|
+
setValue(parentId);
|
|
1568
|
+
}
|
|
1565
1569
|
}, [parentId]);
|
|
1566
1570
|
var folderOptions = useMemo(function () {
|
|
1567
1571
|
return createFolderOptions(foldersMap, config);
|