diff --git a/packages/client/src/components/schema-renderer/index.tsx b/packages/client/src/components/schema-renderer/index.tsx
index eca28d6bd..63371ee74 100644
--- a/packages/client/src/components/schema-renderer/index.tsx
+++ b/packages/client/src/components/schema-renderer/index.tsx
@@ -47,6 +47,7 @@ import { Upload } from '../../schemas/upload';
import { FormItem } from '../../schemas/form-item';
import { BlockItem } from '../../schemas/block-item';
import { DragAndDrop } from '../../schemas/drag-and-drop';
+import { TreeSelect } from '../../schemas/tree-select';
export const BlockContext = createContext({ dragRef: null });
@@ -67,6 +68,7 @@ export const SchemaField = createSchemaField({
ArrayCollapse,
ArrayTable,
FormLayout,
+ TreeSelect,
DragAndDrop,
@@ -175,15 +177,21 @@ export function useDesignable(path?: any) {
const { schema = new Schema({}), refresh } = useContext(DesignableContext);
const schemaPath = path || useSchemaPath();
const fieldSchema = useFieldSchema();
- const currentSchema =
+ let currentSchema =
findPropertyByPath(schema, schemaPath) || ({} as Schema);
+ if (!currentSchema) {
+ currentSchema = fieldSchema;
+ }
+ if (Object.keys(currentSchema).length === 0) {
+ currentSchema = fieldSchema;
+ }
// console.log('useDesignable', { schema, schemaPath, currentSchema });
const options = useContext(SchemaOptionsContext);
const DesignableBar =
get(options.components, currentSchema['x-designable-bar']) || (() => null);
return {
DesignableBar,
- schema: currentSchema || fieldSchema,
+ schema: currentSchema,
refresh,
prepend: (property: ISchema, targetPath?: any): Schema => {
let target = currentSchema;
diff --git a/packages/client/src/schemas/menu/index.tsx b/packages/client/src/schemas/menu/index.tsx
index 8799f240c..ec288b98a 100644
--- a/packages/client/src/schemas/menu/index.tsx
+++ b/packages/client/src/schemas/menu/index.tsx
@@ -42,6 +42,12 @@ import {
PlusOutlined,
GroupOutlined,
LinkOutlined,
+ DeleteOutlined,
+ EditOutlined,
+ ArrowUpOutlined,
+ ArrowDownOutlined,
+ ArrowRightOutlined,
+ DragOutlined,
} from '@ant-design/icons';
import { IconPicker } from '../../components/icon-picker';
import {
@@ -54,12 +60,13 @@ import {
import { useMount } from 'ahooks';
import './style.less';
import { Link } from 'react-router-dom';
-import { findPropertyByPath, useSchemaPath } from '@nocobase/client/lib';
+import { findPropertyByPath, getSchemaPath, useSchemaPath } from '../../';
import { request } from '../';
import defaultSchemas from './defaultSchemas';
import _, { cloneDeep, get, isNull } from 'lodash';
import { FormDialog, FormItem, FormLayout, Input } from '@formily/antd';
import deepmerge from 'deepmerge';
+import { onFieldChange } from '@formily/core';
export const MenuModeContext = createContext(null);
@@ -91,6 +98,8 @@ const SideMenu = (props: any) => {
export const Menu: any = observer((props: any) => {
const { mode, onSelect, sideMenuRef, ...others } = props;
const { schema } = useDesignable();
+ const fieldSchema = useFieldSchema();
+ console.log('Menu.schema', schema, fieldSchema);
const [selectedKey, setSelectedKey] = useState(null);
const ref = useRef();
const path = useSchemaPath();
@@ -134,7 +143,9 @@ export const Menu: any = observer((props: any) => {
{/* */}