@chamn/engine 0.0.10 → 0.0.12
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/component/CustomSchemaForm/components/Form/context.d.ts +2 -0
- package/dist/component/CustomSchemaForm/components/Form/index.d.ts +1 -0
- package/dist/component/CustomSchemaForm/components/SetterSwitcher/index.d.ts +2 -0
- package/dist/component/CustomSchemaForm/index.d.ts +3 -0
- package/dist/component/Workbench/index.d.ts +4 -0
- package/dist/core/pluginManager.d.ts +5 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +197 -0
- package/dist/index.js.map +1 -0
- package/dist/{index.es.js → index.mjs} +3849 -3814
- package/dist/index.mjs.map +1 -0
- package/dist/material/innerMaterial.d.ts +1 -1
- package/dist/plugins/RightPanel/view.d.ts +4 -0
- package/package.json +12 -9
- package/.eslintignore +0 -1
- package/.eslintrc.js +0 -36
- package/.prettierrc.json +0 -7
- package/.storybook/main.js +0 -24
- package/.storybook/preview.js +0 -9
- package/CHANGELOG.md +0 -54
- package/__tests__/demo.test.ts +0 -3
- package/build.config.js +0 -88
- package/dist/index.cjs.js +0 -197
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.es.js.map +0 -1
- package/index.html +0 -16
- package/jest.config.js +0 -196
- package/public/Engine.module.scss.d.ts +0 -5
- package/public/_dev_/render.d.ts +0 -2
- package/public/component/CSSEditor/style.module.scss.d.ts +0 -6
- package/public/component/CSSPropertiesEditor/style.module.scss.d.ts +0 -15
- package/public/component/CSSPropertiesVariableBindEditor/style.module.scss.d.ts +0 -15
- package/public/component/CustomSchemaForm/components/Form/Field/style.module.scss.d.ts +0 -8
- package/public/component/CustomSchemaForm/components/SetterSwitcher/style.module.scss.d.ts +0 -7
- package/public/component/CustomSchemaForm/components/Setters/ArraySetter/style.module.scss.d.ts +0 -7
- package/public/component/CustomSchemaForm/components/Setters/CSSValueSetter/style.module.scss.d.ts +0 -6
- package/public/component/CustomSchemaForm/style.module.scss.d.ts +0 -11
- package/public/component/Workbench/style.module.scss.d.ts +0 -25
- package/public/plugins/AdvancePanel/style.module.scss.d.ts +0 -7
- package/public/plugins/ComponentLibrary/components/DragItem/style.module.scss.d.ts +0 -9
- package/public/plugins/ComponentLibrary/components/ListView/style.module.scss.d.ts +0 -12
- package/public/plugins/ComponentLibrary/style.module.scss.d.ts +0 -11
- package/public/plugins/Designer/components/DefaultSelectToolBar/style.module.scss.d.ts +0 -11
- package/public/plugins/Designer/style.module.scss.d.ts +0 -5
- package/public/plugins/GlobalStatePanel/style.module.scss.d.ts +0 -5
- package/public/plugins/OutlineTree/components/TreeView/style.module.scss.d.ts +0 -16
- package/public/plugins/PropertyPanel/style.module.scss.d.ts +0 -10
- package/public/plugins/RightPanel/style.module.scss.d.ts +0 -10
- package/public/plugins/VisualPanelPlus/style.module.scss.d.ts +0 -10
- package/public/render.umd.js +0 -42
- package/public/render.umd.js.map +0 -1
- package/src/Engine.module.scss +0 -10
- package/src/Engine.module.scss.d.ts +0 -5
- package/src/_dev_/index.css +0 -22
- package/src/_dev_/index.tsx +0 -5
- package/src/_dev_/page/Editor/index.tsx +0 -198
- package/src/_dev_/page/Editor/indexCustom.tsx +0 -274
- package/src/_dev_/page/Preview/index.tsx +0 -56
- package/src/_dev_/render.ts +0 -3
- package/src/_dev_/router.tsx +0 -14
- package/src/assets/react.svg +0 -4
- package/src/assets/styles/mixin.scss +0 -15
- package/src/component/CSSEditor/index.tsx +0 -247
- package/src/component/CSSEditor/style.module.scss +0 -22
- package/src/component/CSSEditor/style.module.scss.d.ts +0 -6
- package/src/component/CSSPropertiesEditor/cssProperties.ts +0 -1062
- package/src/component/CSSPropertiesEditor/index.tsx +0 -389
- package/src/component/CSSPropertiesEditor/style.module.scss +0 -46
- package/src/component/CSSPropertiesEditor/style.module.scss.d.ts +0 -15
- package/src/component/CSSPropertiesEditor/util.ts +0 -19
- package/src/component/CSSPropertiesVariableBindEditor/cssProperties.ts +0 -782
- package/src/component/CSSPropertiesVariableBindEditor/index.tsx +0 -366
- package/src/component/CSSPropertiesVariableBindEditor/style.module.scss +0 -48
- package/src/component/CSSPropertiesVariableBindEditor/style.module.scss.d.ts +0 -15
- package/src/component/CSSPropertiesVariableBindEditor/util.ts +0 -19
- package/src/component/ClassNameEditor/index.tsx +0 -91
- package/src/component/ClassNameEditor/style.module.scss +0 -0
- package/src/component/CustomSchemaForm/components/Form/Field/index.tsx +0 -81
- package/src/component/CustomSchemaForm/components/Form/Field/style.module.scss +0 -32
- package/src/component/CustomSchemaForm/components/Form/Field/style.module.scss.d.ts +0 -8
- package/src/component/CustomSchemaForm/components/Form/context.ts +0 -23
- package/src/component/CustomSchemaForm/components/Form/index.tsx +0 -71
- package/src/component/CustomSchemaForm/components/SetterSwitcher/index.tsx +0 -273
- package/src/component/CustomSchemaForm/components/SetterSwitcher/style.module.scss +0 -16
- package/src/component/CustomSchemaForm/components/SetterSwitcher/style.module.scss.d.ts +0 -7
- package/src/component/CustomSchemaForm/components/Setters/ArraySetter/ArrayItem.tsx +0 -55
- package/src/component/CustomSchemaForm/components/Setters/ArraySetter/SortItemOrderModal.tsx +0 -160
- package/src/component/CustomSchemaForm/components/Setters/ArraySetter/index.tsx +0 -129
- package/src/component/CustomSchemaForm/components/Setters/ArraySetter/style.module.scss +0 -22
- package/src/component/CustomSchemaForm/components/Setters/ArraySetter/style.module.scss.d.ts +0 -7
- package/src/component/CustomSchemaForm/components/Setters/BooleanSetter/index.tsx +0 -32
- package/src/component/CustomSchemaForm/components/Setters/CSSValueSetter/index.tsx +0 -78
- package/src/component/CustomSchemaForm/components/Setters/CSSValueSetter/style.module.scss +0 -7
- package/src/component/CustomSchemaForm/components/Setters/CSSValueSetter/style.module.scss.d.ts +0 -6
- package/src/component/CustomSchemaForm/components/Setters/ExpressionSetter/index.tsx +0 -47
- package/src/component/CustomSchemaForm/components/Setters/FunctionSetter/defaultDts.ts +0 -28
- package/src/component/CustomSchemaForm/components/Setters/FunctionSetter/index.tsx +0 -93
- package/src/component/CustomSchemaForm/components/Setters/JSONSetter/index.tsx +0 -80
- package/src/component/CustomSchemaForm/components/Setters/NumberSetter/index.tsx +0 -34
- package/src/component/CustomSchemaForm/components/Setters/SelectSetter/index.tsx +0 -35
- package/src/component/CustomSchemaForm/components/Setters/ShapeSetter/index.tsx +0 -65
- package/src/component/CustomSchemaForm/components/Setters/StringSetter/index.tsx +0 -30
- package/src/component/CustomSchemaForm/components/Setters/TextAreaSetter/index.tsx +0 -31
- package/src/component/CustomSchemaForm/components/Setters/index.ts +0 -26
- package/src/component/CustomSchemaForm/components/Setters/type.ts +0 -18
- package/src/component/CustomSchemaForm/context.ts +0 -20
- package/src/component/CustomSchemaForm/index.tsx +0 -93
- package/src/component/CustomSchemaForm/style.module.scss +0 -15
- package/src/component/CustomSchemaForm/style.module.scss.d.ts +0 -11
- package/src/component/CustomSchemaForm/utils.ts +0 -13
- package/src/component/MonacoEditor/index.tsx +0 -81
- package/src/component/Workbench/index.tsx +0 -329
- package/src/component/Workbench/style.module.scss +0 -159
- package/src/component/Workbench/style.module.scss.d.ts +0 -25
- package/src/core/pluginManager.ts +0 -151
- package/src/i18n/en_US/index.ts +0 -5
- package/src/i18n/index.ts +0 -39
- package/src/i18n/zh_CN/index.ts +0 -5
- package/src/index.tsx +0 -150
- package/src/material/innerMaterial.ts +0 -343
- package/src/plugins/AdvancePanel/index.tsx +0 -191
- package/src/plugins/AdvancePanel/style.module.scss +0 -8
- package/src/plugins/AdvancePanel/style.module.scss.d.ts +0 -7
- package/src/plugins/ComponentLibrary/components/DragItem/index.tsx +0 -65
- package/src/plugins/ComponentLibrary/components/DragItem/style.module.scss +0 -58
- package/src/plugins/ComponentLibrary/components/DragItem/style.module.scss.d.ts +0 -9
- package/src/plugins/ComponentLibrary/components/ListView/index.tsx +0 -50
- package/src/plugins/ComponentLibrary/components/ListView/style.module.scss +0 -27
- package/src/plugins/ComponentLibrary/components/ListView/style.module.scss.d.ts +0 -12
- package/src/plugins/ComponentLibrary/index.tsx +0 -184
- package/src/plugins/ComponentLibrary/localize/en_US/index.ts +0 -3
- package/src/plugins/ComponentLibrary/localize/index.ts +0 -3
- package/src/plugins/ComponentLibrary/localize/zh_CN/index.ts +0 -3
- package/src/plugins/ComponentLibrary/style.module.scss +0 -31
- package/src/plugins/ComponentLibrary/style.module.scss.d.ts +0 -11
- package/src/plugins/ComponentLibrary/util.ts +0 -14
- package/src/plugins/ComponentStatePanel/index.tsx +0 -59
- package/src/plugins/Designer/components/DefaultSelectToolBar/index.tsx +0 -94
- package/src/plugins/Designer/components/DefaultSelectToolBar/style.module.scss +0 -59
- package/src/plugins/Designer/components/DefaultSelectToolBar/style.module.scss.d.ts +0 -11
- package/src/plugins/Designer/components/GhostView/index.tsx +0 -18
- package/src/plugins/Designer/config.ts +0 -1
- package/src/plugins/Designer/index.tsx +0 -61
- package/src/plugins/Designer/localize/en_US/index.ts +0 -3
- package/src/plugins/Designer/localize/index.ts +0 -3
- package/src/plugins/Designer/localize/zh_CN/index.ts +0 -3
- package/src/plugins/Designer/style.module.scss +0 -10
- package/src/plugins/Designer/style.module.scss.d.ts +0 -5
- package/src/plugins/Designer/util.ts +0 -18
- package/src/plugins/Designer/view.tsx +0 -225
- package/src/plugins/DisplaySourceSchema/index.tsx +0 -76
- package/src/plugins/GlobalStatePanel/index.tsx +0 -96
- package/src/plugins/GlobalStatePanel/localize/en_US/index.ts +0 -3
- package/src/plugins/GlobalStatePanel/localize/index.ts +0 -3
- package/src/plugins/GlobalStatePanel/localize/zh_CN/index.ts +0 -3
- package/src/plugins/GlobalStatePanel/style.module.scss +0 -8
- package/src/plugins/GlobalStatePanel/style.module.scss.d.ts +0 -5
- package/src/plugins/History/index.tsx +0 -110
- package/src/plugins/OutlineTree/components/TreeView/context.ts +0 -43
- package/src/plugins/OutlineTree/components/TreeView/dataStruct.ts +0 -58
- package/src/plugins/OutlineTree/components/TreeView/index.tsx +0 -376
- package/src/plugins/OutlineTree/components/TreeView/style.module.scss +0 -93
- package/src/plugins/OutlineTree/components/TreeView/style.module.scss.d.ts +0 -16
- package/src/plugins/OutlineTree/components/TreeView/treeNode.tsx +0 -271
- package/src/plugins/OutlineTree/index.tsx +0 -39
- package/src/plugins/OutlineTree/localize/en_US/index.ts +0 -3
- package/src/plugins/OutlineTree/localize/index.ts +0 -3
- package/src/plugins/OutlineTree/localize/zh_CN/index.ts +0 -3
- package/src/plugins/OutlineTree/util.tsx +0 -302
- package/src/plugins/PropertyPanel/index.tsx +0 -63
- package/src/plugins/PropertyPanel/style.module.scss +0 -12
- package/src/plugins/PropertyPanel/style.module.scss.d.ts +0 -10
- package/src/plugins/PropertyPanel/utils.ts +0 -13
- package/src/plugins/RightPanel/index.tsx +0 -30
- package/src/plugins/RightPanel/style.module.scss +0 -16
- package/src/plugins/RightPanel/style.module.scss.d.ts +0 -10
- package/src/plugins/RightPanel/view.tsx +0 -177
- package/src/plugins/VisualPanel/index.tsx +0 -185
- package/src/plugins/VisualPanel/style.module.scss +0 -17
- package/src/plugins/VisualPanelPlus/index.tsx +0 -103
- package/src/plugins/VisualPanelPlus/style.module.scss +0 -20
- package/src/plugins/VisualPanelPlus/style.module.scss.d.ts +0 -10
- package/src/plugins/index.tsx +0 -26
- package/src/stories/Button.jsx +0 -50
- package/src/stories/Button.stories.jsx +0 -40
- package/src/stories/Introduction.stories.mdx +0 -194
- package/src/stories/assets/code-brackets.svg +0 -1
- package/src/stories/assets/colors.svg +0 -1
- package/src/stories/assets/comments.svg +0 -1
- package/src/stories/assets/direction.svg +0 -1
- package/src/stories/assets/flow.svg +0 -1
- package/src/stories/assets/plugin.svg +0 -1
- package/src/stories/assets/repo.svg +0 -1
- package/src/stories/assets/stackalt.svg +0 -1
- package/src/stories/button.css +0 -30
- package/src/stories/plugins/CSSEditor.stories.tsx +0 -75
- package/src/stories/plugins/VisualPanelPlus.stories.tsx +0 -74
- package/src/style.d.ts +0 -2
- package/src/typing.d.ts +0 -9
- package/src/utils/css.ts +0 -88
- package/src/utils/defaultEngineConfig.tsx +0 -55
- package/src/utils/index.ts +0 -12
- package/src/utils/logger.ts +0 -4
- package/src/vite-env.d.ts +0 -1
- package/tsconfig.json +0 -32
|
@@ -1,271 +0,0 @@
|
|
|
1
|
-
import { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
-
import { CopyOutlined, DeleteOutlined, EyeInvisibleOutlined, EyeOutlined, RightOutlined } from '@ant-design/icons';
|
|
3
|
-
import clsx from 'clsx';
|
|
4
|
-
import { CTreeContext, DragState } from './context';
|
|
5
|
-
import { TreeNodeData } from './dataStruct';
|
|
6
|
-
import styles from './style.module.scss';
|
|
7
|
-
import { LOGGER } from '../../../../utils/logger';
|
|
8
|
-
import { CNode } from '@chamn/model';
|
|
9
|
-
import { Input, InputRef } from 'antd';
|
|
10
|
-
|
|
11
|
-
export const DRAG_ITEM_KEY = 'data-drag-key';
|
|
12
|
-
|
|
13
|
-
export type TreeNodeProps = {
|
|
14
|
-
item: TreeNodeData;
|
|
15
|
-
level?: number;
|
|
16
|
-
paths?: (string | number)[];
|
|
17
|
-
};
|
|
18
|
-
export const TreeNode = (props: TreeNodeProps) => {
|
|
19
|
-
const allStateRef = useRef<{ titleEditable: boolean }>({
|
|
20
|
-
titleEditable: false,
|
|
21
|
-
});
|
|
22
|
-
const { level = 0, item, paths = ['0'] } = props;
|
|
23
|
-
const [nodeVisible, setNodeVisible] = useState(true);
|
|
24
|
-
const {
|
|
25
|
-
state: ctxState,
|
|
26
|
-
updateState,
|
|
27
|
-
onSelectNode,
|
|
28
|
-
onDeleteNode,
|
|
29
|
-
getDesignerHandler,
|
|
30
|
-
onCopyNode,
|
|
31
|
-
} = useContext(CTreeContext);
|
|
32
|
-
|
|
33
|
-
const [titleEditable, setTitleEditable] = useState(allStateRef.current?.titleEditable);
|
|
34
|
-
const [editInputValue, setEditInputValue] = useState('');
|
|
35
|
-
allStateRef.current.titleEditable = titleEditable;
|
|
36
|
-
const expanded = ctxState.expandKeys.find((el) => el === item.key);
|
|
37
|
-
const toggleExpandNode = () => {
|
|
38
|
-
let newExpandKeys = ctxState.expandKeys;
|
|
39
|
-
if (expanded) {
|
|
40
|
-
newExpandKeys = newExpandKeys.filter((el) => el !== item.key);
|
|
41
|
-
} else {
|
|
42
|
-
newExpandKeys.push(item.key || '');
|
|
43
|
-
}
|
|
44
|
-
updateState({
|
|
45
|
-
expandKeys: newExpandKeys,
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
const selected = ctxState.currentSelectNodeKeys.find((el) => el === item.key);
|
|
49
|
-
const titleEditInputRef = useRef<InputRef>(null);
|
|
50
|
-
const toggleSelectNode = () => {
|
|
51
|
-
if (titleEditable) {
|
|
52
|
-
titleEditInputRef?.current?.focus();
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
if (item.canBeSelected !== undefined && item.canBeSelected === false) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
let newKeys = ctxState.currentSelectNodeKeys;
|
|
59
|
-
if (!ctxState.multiSelect) {
|
|
60
|
-
if (item.key) {
|
|
61
|
-
onSelectNode?.({ keys: [item.key], node: item });
|
|
62
|
-
} else {
|
|
63
|
-
onSelectNode?.({ keys: [], node: item });
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
updateState({
|
|
67
|
-
currentSelectNodeKeys: [String(item.key)],
|
|
68
|
-
});
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
if (selected) {
|
|
72
|
-
newKeys = newKeys.filter((el) => el !== item.key);
|
|
73
|
-
} else {
|
|
74
|
-
newKeys.push(String(item.key));
|
|
75
|
-
}
|
|
76
|
-
onSelectNode?.({ keys: newKeys, node: item });
|
|
77
|
-
updateState({
|
|
78
|
-
currentSelectNodeKeys: newKeys,
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
|
-
const singPadding = 20;
|
|
82
|
-
const indent = singPadding * level;
|
|
83
|
-
const canBeSelected = item.canBeSelected ?? true;
|
|
84
|
-
|
|
85
|
-
const dragKeyProps = {
|
|
86
|
-
[DRAG_ITEM_KEY]: item.key,
|
|
87
|
-
};
|
|
88
|
-
const updateExpandKeyRef = useRef<(key: string) => void>();
|
|
89
|
-
const ctxStateRef = useRef<typeof ctxState>();
|
|
90
|
-
ctxStateRef.current = ctxState;
|
|
91
|
-
updateExpandKeyRef.current = (key) => {
|
|
92
|
-
const oldExpandKeys = ctxState.expandKeys;
|
|
93
|
-
const newExpandKeys = Array.from(new Set([...oldExpandKeys, key]));
|
|
94
|
-
updateState({
|
|
95
|
-
expandKeys: newExpandKeys,
|
|
96
|
-
});
|
|
97
|
-
};
|
|
98
|
-
const domRef = useRef<HTMLDivElement>(null);
|
|
99
|
-
useEffect(() => {
|
|
100
|
-
// auto expand on dragging
|
|
101
|
-
let timerHandler = 0;
|
|
102
|
-
domRef.current?.addEventListener('mouseenter', () => {
|
|
103
|
-
timerHandler = window.setTimeout(() => {
|
|
104
|
-
if (ctxStateRef.current?.dragState === DragState.DRAGGING) {
|
|
105
|
-
updateExpandKeyRef.current?.(item.key || '');
|
|
106
|
-
}
|
|
107
|
-
}, 0.8 * 1000);
|
|
108
|
-
});
|
|
109
|
-
domRef.current?.addEventListener('mouseleave', () => {
|
|
110
|
-
clearTimeout(timerHandler);
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
const clickHandle = (e: MouseEvent) => {
|
|
114
|
-
if (allStateRef.current.titleEditable) {
|
|
115
|
-
if (e.target === titleEditInputRef.current?.input) {
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
setTitleEditable(false);
|
|
119
|
-
targetNodeModel.updateValue();
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
document.addEventListener('click', clickHandle);
|
|
124
|
-
|
|
125
|
-
return () => {
|
|
126
|
-
if (timerHandler) {
|
|
127
|
-
clearTimeout(timerHandler);
|
|
128
|
-
}
|
|
129
|
-
document.removeEventListener('click', clickHandle);
|
|
130
|
-
};
|
|
131
|
-
}, []);
|
|
132
|
-
|
|
133
|
-
const targetNodeModel = ctxState.pageModel?.getNode(item.key || '') as CNode;
|
|
134
|
-
|
|
135
|
-
const toggleNodeVisible = () => {
|
|
136
|
-
const newVisible = !nodeVisible;
|
|
137
|
-
|
|
138
|
-
if (!targetNodeModel) {
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
const devState = targetNodeModel.value.configure.devState ?? {};
|
|
142
|
-
devState.condition = newVisible;
|
|
143
|
-
targetNodeModel.value.configure.devState = devState;
|
|
144
|
-
targetNodeModel.updateValue();
|
|
145
|
-
setNodeVisible(newVisible);
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
let titleView = item.title;
|
|
149
|
-
if (item.titleViewRender) {
|
|
150
|
-
titleView = item.titleViewRender({
|
|
151
|
-
item,
|
|
152
|
-
titleView: item.title,
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
const titleText = targetNodeModel?.value.title || targetNodeModel?.value.componentName;
|
|
156
|
-
|
|
157
|
-
const bodyView = (
|
|
158
|
-
<div className={styles.nodeBox}>
|
|
159
|
-
<div
|
|
160
|
-
className={clsx([styles.nodeContent, selected && canBeSelected && styles.selected])}
|
|
161
|
-
style={{ marginLeft: `${-indent}px`, paddingLeft: `${indent + 8}px` }}
|
|
162
|
-
onMouseMove={async () => {
|
|
163
|
-
if (!item.key) {
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
const designerHandler = await getDesignerHandler?.();
|
|
167
|
-
const compInstances = designerHandler?.getDynamicComponentInstances(item.key);
|
|
168
|
-
if (typeof compInstances?._CONDITION !== 'undefined') {
|
|
169
|
-
setNodeVisible(compInstances?._CONDITION);
|
|
170
|
-
}
|
|
171
|
-
}}
|
|
172
|
-
>
|
|
173
|
-
{item.children?.length ? (
|
|
174
|
-
<span style={{ paddingRight: '5px' }} className={styles.arrowSpan} onClickCapture={toggleExpandNode}>
|
|
175
|
-
<RightOutlined className={clsx([styles.nodeArrow, expanded && styles.expanded])} />
|
|
176
|
-
</span>
|
|
177
|
-
) : null}
|
|
178
|
-
<div
|
|
179
|
-
className={styles.nodeRenderView}
|
|
180
|
-
{...dragKeyProps}
|
|
181
|
-
ref={domRef}
|
|
182
|
-
onClick={toggleSelectNode}
|
|
183
|
-
onDoubleClick={() => {
|
|
184
|
-
// slot 节点,属性节点不能编辑 title
|
|
185
|
-
if (!targetNodeModel) {
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
const node = targetNodeModel;
|
|
189
|
-
const nodeMeta = node.materialsModel.findByComponentName(node.value.componentName)?.value.title;
|
|
190
|
-
const inputValue = node.value.title || nodeMeta || node.value.componentName || '';
|
|
191
|
-
setEditInputValue(inputValue);
|
|
192
|
-
setTitleEditable(true);
|
|
193
|
-
setTimeout(() => {
|
|
194
|
-
titleEditInputRef.current?.focus();
|
|
195
|
-
}, 100);
|
|
196
|
-
}}
|
|
197
|
-
>
|
|
198
|
-
{!titleEditable && titleView}
|
|
199
|
-
{titleEditable && (
|
|
200
|
-
<div
|
|
201
|
-
style={{
|
|
202
|
-
paddingRight: '10px',
|
|
203
|
-
}}
|
|
204
|
-
>
|
|
205
|
-
<Input
|
|
206
|
-
size="small"
|
|
207
|
-
maxLength={20}
|
|
208
|
-
ref={titleEditInputRef}
|
|
209
|
-
value={editInputValue}
|
|
210
|
-
onPressEnter={() => {
|
|
211
|
-
setTitleEditable(false);
|
|
212
|
-
targetNodeModel.updateValue();
|
|
213
|
-
}}
|
|
214
|
-
onChange={(e) => {
|
|
215
|
-
targetNodeModel.value.title = e.target.value;
|
|
216
|
-
setEditInputValue(e.target.value);
|
|
217
|
-
}}
|
|
218
|
-
/>
|
|
219
|
-
</div>
|
|
220
|
-
)}
|
|
221
|
-
</div>
|
|
222
|
-
|
|
223
|
-
{!titleEditable && !item.rootNode && (
|
|
224
|
-
<div className={styles.toolbarBox}>
|
|
225
|
-
<div className={styles.iconItem}>
|
|
226
|
-
{!nodeVisible && <EyeOutlined onClick={toggleNodeVisible} />}
|
|
227
|
-
{nodeVisible && <EyeInvisibleOutlined onClick={toggleNodeVisible} />}
|
|
228
|
-
</div>
|
|
229
|
-
<div
|
|
230
|
-
className={styles.iconItem}
|
|
231
|
-
onClick={() => {
|
|
232
|
-
onCopyNode(item.key || '');
|
|
233
|
-
}}
|
|
234
|
-
>
|
|
235
|
-
<CopyOutlined />
|
|
236
|
-
</div>
|
|
237
|
-
<div
|
|
238
|
-
className={styles.iconItem}
|
|
239
|
-
onClick={() => {
|
|
240
|
-
onDeleteNode(item.key || '');
|
|
241
|
-
}}
|
|
242
|
-
>
|
|
243
|
-
<DeleteOutlined />
|
|
244
|
-
</div>
|
|
245
|
-
</div>
|
|
246
|
-
)}
|
|
247
|
-
</div>
|
|
248
|
-
<div
|
|
249
|
-
className={clsx([styles.nodeChildren, selected && styles.selected])}
|
|
250
|
-
style={{
|
|
251
|
-
paddingLeft: `${singPadding}px`,
|
|
252
|
-
height: expanded ? 'auto' : '0',
|
|
253
|
-
}}
|
|
254
|
-
>
|
|
255
|
-
{expanded &&
|
|
256
|
-
item.children?.map((el, index) => {
|
|
257
|
-
const key = `${el.key}-${index}`;
|
|
258
|
-
return <TreeNode key={key} item={el} paths={[...paths, index]} level={level + 1} />;
|
|
259
|
-
})}
|
|
260
|
-
</div>
|
|
261
|
-
</div>
|
|
262
|
-
);
|
|
263
|
-
if (item.containerRender) {
|
|
264
|
-
const containerView = item.containerRender({
|
|
265
|
-
item: item,
|
|
266
|
-
treeNodeView: bodyView,
|
|
267
|
-
});
|
|
268
|
-
return containerView;
|
|
269
|
-
}
|
|
270
|
-
return bodyView;
|
|
271
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { ApartmentOutlined } from '@ant-design/icons';
|
|
2
|
-
import { CPlugin } from '../../core/pluginManager';
|
|
3
|
-
import { withTranslation } from 'react-i18next';
|
|
4
|
-
import { TreeView } from './components/TreeView';
|
|
5
|
-
import localize from './localize';
|
|
6
|
-
|
|
7
|
-
export const PLUGIN_NAME = 'OutlineTree';
|
|
8
|
-
const i18nNamespace = `plugin:${PLUGIN_NAME}`;
|
|
9
|
-
|
|
10
|
-
export const OutlineTreePlugin: CPlugin = {
|
|
11
|
-
name: PLUGIN_NAME,
|
|
12
|
-
async init(ctx) {
|
|
13
|
-
const { i18n } = ctx;
|
|
14
|
-
Object.keys(localize).forEach((lng) => {
|
|
15
|
-
i18n.addResourceBundle(lng, i18nNamespace, localize[lng], true, true);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
const TreeViewWithLocalize = withTranslation(i18nNamespace)(TreeView);
|
|
19
|
-
const Title = withTranslation(i18nNamespace)(({ t }) => <>{t('pluginName')}</>);
|
|
20
|
-
const workbench = ctx.getWorkbench();
|
|
21
|
-
workbench.addLeftPanel({
|
|
22
|
-
title: <Title />,
|
|
23
|
-
name: PLUGIN_NAME,
|
|
24
|
-
icon: <ApartmentOutlined />,
|
|
25
|
-
render: <TreeViewWithLocalize pluginCtx={ctx} />,
|
|
26
|
-
});
|
|
27
|
-
},
|
|
28
|
-
async destroy(ctx) {
|
|
29
|
-
console.log('destroy', ctx);
|
|
30
|
-
},
|
|
31
|
-
exports: (ctx) => {
|
|
32
|
-
return {};
|
|
33
|
-
},
|
|
34
|
-
meta: {
|
|
35
|
-
engine: {
|
|
36
|
-
version: '1.0.0',
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
};
|
|
@@ -1,302 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { DropPosType } from '@chamn/layout/dist/components/DropAnchor/util';
|
|
3
|
-
import {
|
|
4
|
-
ArraySetterObjType,
|
|
5
|
-
CNode,
|
|
6
|
-
CNodeDataType,
|
|
7
|
-
CPage,
|
|
8
|
-
CPageDataType,
|
|
9
|
-
getMTitle,
|
|
10
|
-
isJSSlotPropNode,
|
|
11
|
-
isSpecialMaterialPropType,
|
|
12
|
-
MaterialPropType,
|
|
13
|
-
MTitle,
|
|
14
|
-
RenderPropType,
|
|
15
|
-
SetterObjType,
|
|
16
|
-
SetterType,
|
|
17
|
-
} from '@chamn/model';
|
|
18
|
-
import { isPlainObject } from 'lodash-es';
|
|
19
|
-
import { TreeNodeData } from './components/TreeView/dataStruct';
|
|
20
|
-
import { ShapeSetterObjType } from '@chamn/model/src/types/material';
|
|
21
|
-
|
|
22
|
-
export const getTargetMNodeKeyVal = (dom: HTMLElement | null, key: string): null | string => {
|
|
23
|
-
if (!dom) {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
const val = dom.getAttribute(key);
|
|
27
|
-
if (!val) {
|
|
28
|
-
return getTargetMNodeKeyVal(dom.parentElement, key);
|
|
29
|
-
} else {
|
|
30
|
-
return val;
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export const transformNodeSchemaToTreeData = (
|
|
35
|
-
nodeSchema: CNodeDataType | CNodeDataType[],
|
|
36
|
-
parent: TreeNodeData,
|
|
37
|
-
pageModel: CPage
|
|
38
|
-
): TreeNodeData | TreeNodeData[] => {
|
|
39
|
-
const tb = (node: CNodeDataType, parent?: TreeNodeData | null): TreeNodeData => {
|
|
40
|
-
let nodeChild: any[] = node.children || [];
|
|
41
|
-
if (!Array.isArray(nodeChild)) {
|
|
42
|
-
// TODO: 暂时不处理字符串的情况
|
|
43
|
-
nodeChild = [];
|
|
44
|
-
}
|
|
45
|
-
// 过滤掉字符串的情况
|
|
46
|
-
nodeChild = nodeChild.filter((el) => typeof el !== 'string');
|
|
47
|
-
const nodeMeta = pageModel.materialsModel.findByComponentName(node.componentName)?.value.title;
|
|
48
|
-
const newCurrentNode: TreeNodeData = {
|
|
49
|
-
title: node.title || nodeMeta || node.componentName,
|
|
50
|
-
key: node.id,
|
|
51
|
-
children: [],
|
|
52
|
-
parent: parent,
|
|
53
|
-
};
|
|
54
|
-
// 还需要处理 props 中的节点
|
|
55
|
-
const propsNodeList: TreeNodeData[] = [];
|
|
56
|
-
const slotNode: TreeNodeData = {
|
|
57
|
-
title: 'SLOT',
|
|
58
|
-
key: `${node.id}-SLOT`,
|
|
59
|
-
children: propsNodeList,
|
|
60
|
-
canBeSelected: false,
|
|
61
|
-
canDrop: false,
|
|
62
|
-
parent: null,
|
|
63
|
-
containerRender: ({ treeNodeView }) => {
|
|
64
|
-
return (
|
|
65
|
-
<div
|
|
66
|
-
style={{
|
|
67
|
-
border: '1px solid #a97cf8',
|
|
68
|
-
borderTopWidth: '6px',
|
|
69
|
-
marginRight: '2px',
|
|
70
|
-
marginTop: '5px',
|
|
71
|
-
}}
|
|
72
|
-
>
|
|
73
|
-
{treeNodeView}
|
|
74
|
-
</div>
|
|
75
|
-
);
|
|
76
|
-
},
|
|
77
|
-
};
|
|
78
|
-
const props = node.props || {};
|
|
79
|
-
|
|
80
|
-
const processProps = (val: unknown, key: string, keys: string[]) => {
|
|
81
|
-
const flag = isJSSlotPropNode(val);
|
|
82
|
-
|
|
83
|
-
if (flag) {
|
|
84
|
-
const tempVal = val as RenderPropType;
|
|
85
|
-
const pageModeNode = pageModel.getNode(node.id!);
|
|
86
|
-
let propsTitle = '';
|
|
87
|
-
if (pageModeNode) {
|
|
88
|
-
const tempTitle = getPropsLabel(pageModeNode as CNode, [...keys, key]);
|
|
89
|
-
propsTitle = getMTitle(tempTitle);
|
|
90
|
-
}
|
|
91
|
-
let plainTitle = key;
|
|
92
|
-
if (propsTitle) {
|
|
93
|
-
plainTitle = getMTitle(propsTitle) || key;
|
|
94
|
-
}
|
|
95
|
-
const tempNode: TreeNodeData = {
|
|
96
|
-
title: plainTitle,
|
|
97
|
-
key: `${node.id}-${keys.join('_')}`,
|
|
98
|
-
children: [],
|
|
99
|
-
canBeSelected: false,
|
|
100
|
-
canDrag: false,
|
|
101
|
-
canDrop: ['current'],
|
|
102
|
-
parent: slotNode,
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
let propValue: CNodeDataType[] = [];
|
|
106
|
-
if (tempVal.value && !Array.isArray(tempVal.value)) {
|
|
107
|
-
propValue = [tempVal.value];
|
|
108
|
-
} else {
|
|
109
|
-
propValue = tempVal.value;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
tempNode.children = transformNodeSchemaToTreeData(propValue, tempNode, pageModel) as TreeNodeData[];
|
|
113
|
-
propsNodeList.push(tempNode);
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
if (isPlainObject(val)) {
|
|
117
|
-
const tempVal = val as any;
|
|
118
|
-
Object.keys(tempVal).forEach((newKey) => {
|
|
119
|
-
processProps(tempVal[newKey], newKey, [...keys, key]);
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
if (Array.isArray(val)) {
|
|
123
|
-
const tempVal = val as any[];
|
|
124
|
-
tempVal.forEach((item, index) => {
|
|
125
|
-
processProps(item, String(index), [...keys, key]);
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
const getPropsLabel = (nodeModel: CNode, keyPath: string[]) => {
|
|
130
|
-
const propsLabelMap = getNodePropsLabelMap(nodeModel);
|
|
131
|
-
const newKeyPath = keyPath.map((el) => {
|
|
132
|
-
if (String(parseInt(el, 10)) === el) {
|
|
133
|
-
return '$NUM';
|
|
134
|
-
} else {
|
|
135
|
-
return el;
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
return propsLabelMap[newKeyPath.join('.')] || '';
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
Object.keys(props).forEach((key) => {
|
|
142
|
-
processProps(props[key], key, []);
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
if (propsNodeList.length > 0) {
|
|
146
|
-
newCurrentNode.children?.push(slotNode);
|
|
147
|
-
slotNode.parent = newCurrentNode;
|
|
148
|
-
}
|
|
149
|
-
const childNodeList = nodeChild.map((el) => tb(el, newCurrentNode)) || [];
|
|
150
|
-
newCurrentNode.children = [...newCurrentNode.children!, ...childNodeList];
|
|
151
|
-
return newCurrentNode;
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
if (Array.isArray(nodeSchema)) {
|
|
155
|
-
return nodeSchema.map((el) => {
|
|
156
|
-
return tb(el, parent);
|
|
157
|
-
});
|
|
158
|
-
} else {
|
|
159
|
-
return tb(nodeSchema, parent);
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
export const transformPageSchemaToTreeData = (pageSchema: CPageDataType, pageModel: CPage): TreeNodeData[] => {
|
|
164
|
-
const tree = pageSchema.componentsTree;
|
|
165
|
-
let child = (tree.children || []) as CNodeDataType[];
|
|
166
|
-
if (!Array.isArray(child)) {
|
|
167
|
-
child = [];
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
const rootNode: TreeNodeData = {
|
|
171
|
-
title: 'Page',
|
|
172
|
-
key: tree.id || 'Page',
|
|
173
|
-
rootNode: true,
|
|
174
|
-
children: [],
|
|
175
|
-
};
|
|
176
|
-
rootNode.children = transformNodeSchemaToTreeData(child, rootNode, pageModel) as TreeNodeData[];
|
|
177
|
-
return [rootNode];
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
export const traverseTree = (tree: TreeNodeData | TreeNodeData[], handler: (node: TreeNodeData) => boolean) => {
|
|
181
|
-
let tempTree: TreeNodeData[] = [];
|
|
182
|
-
if (Array.isArray(tree)) {
|
|
183
|
-
tempTree = tree;
|
|
184
|
-
} else {
|
|
185
|
-
tempTree = [tree];
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
let stop = false;
|
|
189
|
-
|
|
190
|
-
const traverseCb = (node: TreeNodeData, conditionCb: (node: TreeNodeData) => boolean) => {
|
|
191
|
-
if (stop) {
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
const res = conditionCb(node);
|
|
195
|
-
if (res) {
|
|
196
|
-
stop = true;
|
|
197
|
-
} else {
|
|
198
|
-
node.children?.forEach((el) => {
|
|
199
|
-
traverseCb(el, conditionCb);
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
};
|
|
203
|
-
tempTree.forEach((el) => {
|
|
204
|
-
traverseCb(el, handler);
|
|
205
|
-
});
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
export function calculateDropPosInfo(params: { point: { x: number; y: number }; dom: HTMLElement }): DropPosType {
|
|
209
|
-
const { point, dom } = params;
|
|
210
|
-
let pos: DropPosType['pos'];
|
|
211
|
-
|
|
212
|
-
const mousePos = point;
|
|
213
|
-
const targetRect = dom.getBoundingClientRect();
|
|
214
|
-
const targetDomH = targetRect.height;
|
|
215
|
-
const xCenter = targetRect.x + 50;
|
|
216
|
-
const yCenter = targetRect.y + Math.round(targetDomH / 2);
|
|
217
|
-
|
|
218
|
-
if (mousePos.y > yCenter) {
|
|
219
|
-
pos = 'after';
|
|
220
|
-
} else {
|
|
221
|
-
pos = 'before';
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
if (mousePos.x > xCenter && pos == 'after') {
|
|
225
|
-
pos = 'current';
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
return {
|
|
229
|
-
pos,
|
|
230
|
-
direction: 'vertical',
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
//TODO: 移动到 model 包中去
|
|
235
|
-
export const getNodePropsLabelMap = (node: CNode) => {
|
|
236
|
-
const resMap: Record<string, MTitle> = {};
|
|
237
|
-
const props = node.material?.value.props;
|
|
238
|
-
if (!props) {
|
|
239
|
-
return resMap;
|
|
240
|
-
}
|
|
241
|
-
const singleProcessUnit = (val: SetterType, paths: string[]) => {
|
|
242
|
-
if (isPlainObject(val)) {
|
|
243
|
-
const newPaths = [...paths];
|
|
244
|
-
const objSetter = val as SetterObjType;
|
|
245
|
-
const componentName = objSetter.componentName;
|
|
246
|
-
if (componentName === 'ArraySetter') {
|
|
247
|
-
const setter = objSetter as ArraySetterObjType;
|
|
248
|
-
const arrItemSetter = setter.props?.item.setters || [];
|
|
249
|
-
const parentTitle = resMap[paths.join('.')];
|
|
250
|
-
let currentTitle = '';
|
|
251
|
-
if (typeof parentTitle === 'string') {
|
|
252
|
-
currentTitle = parentTitle;
|
|
253
|
-
} else {
|
|
254
|
-
currentTitle = parentTitle.label;
|
|
255
|
-
}
|
|
256
|
-
newPaths.push('$NUM');
|
|
257
|
-
arrItemSetter.forEach((el) => {
|
|
258
|
-
currentTitle = `${currentTitle}`;
|
|
259
|
-
resMap[newPaths.join('.')] = currentTitle;
|
|
260
|
-
singleProcessUnit(el, newPaths);
|
|
261
|
-
});
|
|
262
|
-
} else if (componentName === 'ShapeSetter') {
|
|
263
|
-
const setter = objSetter as ShapeSetterObjType;
|
|
264
|
-
const elements = setter.props?.elements || [];
|
|
265
|
-
elements.forEach((it) => {
|
|
266
|
-
const newObjPaths = [...newPaths];
|
|
267
|
-
newObjPaths.push(it.name);
|
|
268
|
-
resMap[newObjPaths.join('.')] = it.title;
|
|
269
|
-
const subSetter = it.setters || [];
|
|
270
|
-
subSetter.forEach((it2) => {
|
|
271
|
-
singleProcessUnit(it2, [...newObjPaths]);
|
|
272
|
-
});
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
};
|
|
277
|
-
|
|
278
|
-
props.forEach((item) => {
|
|
279
|
-
let targetItem: MaterialPropType | MaterialPropType[] | null = null;
|
|
280
|
-
if (isSpecialMaterialPropType(item)) {
|
|
281
|
-
targetItem = item.content;
|
|
282
|
-
} else {
|
|
283
|
-
targetItem = item;
|
|
284
|
-
}
|
|
285
|
-
let itemArr: MaterialPropType[] = [];
|
|
286
|
-
if (Array.isArray(targetItem)) {
|
|
287
|
-
itemArr = targetItem;
|
|
288
|
-
} else {
|
|
289
|
-
itemArr = [targetItem];
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
itemArr.forEach((it) => {
|
|
293
|
-
const newPaths: string[] = [it.name];
|
|
294
|
-
resMap[newPaths.join('.')] = it.title;
|
|
295
|
-
it.setters?.forEach((it2) => {
|
|
296
|
-
singleProcessUnit(it2, newPaths);
|
|
297
|
-
});
|
|
298
|
-
});
|
|
299
|
-
});
|
|
300
|
-
|
|
301
|
-
return resMap;
|
|
302
|
-
};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useRef } from 'react';
|
|
2
|
-
import { CNode, CRootNode } from '@chamn/model';
|
|
3
|
-
import { CPluginCtx } from '../../core/pluginManager';
|
|
4
|
-
import { CRightPanelItem } from '../RightPanel/view';
|
|
5
|
-
|
|
6
|
-
import styles from './style.module.scss';
|
|
7
|
-
import { CustomSchemaForm, CustomSchemaFormInstance, CustomSchemaFormProps } from '../../component/CustomSchemaForm';
|
|
8
|
-
|
|
9
|
-
export const PropertyPanel = (props: { node: CNode | CRootNode; pluginCtx: CPluginCtx }) => {
|
|
10
|
-
const { node } = props;
|
|
11
|
-
const properties = node.material?.value.props || [];
|
|
12
|
-
const formRef = useRef<CustomSchemaFormInstance>(null);
|
|
13
|
-
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
const handel = () => {
|
|
16
|
-
const newVal = node.getPlainProps?.() || {};
|
|
17
|
-
formRef.current?.setFields(newVal);
|
|
18
|
-
};
|
|
19
|
-
handel();
|
|
20
|
-
node.emitter.on('onNodeChange', handel);
|
|
21
|
-
() => {
|
|
22
|
-
node.emitter.off('onNodeChange', handel);
|
|
23
|
-
};
|
|
24
|
-
}, [node]);
|
|
25
|
-
|
|
26
|
-
const value = node.getPlainProps?.() || {};
|
|
27
|
-
|
|
28
|
-
const onValueChange: CustomSchemaFormProps['onValueChange'] = (val) => {
|
|
29
|
-
node.updateValue({
|
|
30
|
-
props: val,
|
|
31
|
-
});
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const onSetterChange: CustomSchemaFormProps['onSetterChange'] = (keyPaths, setterName) => {
|
|
35
|
-
node.value.configure = node.value.configure || {};
|
|
36
|
-
node.value.configure.propsSetter = node.value.configure.propsSetter || {};
|
|
37
|
-
node.value.configure.propsSetter[keyPaths.join('.')] = {
|
|
38
|
-
name: keyPaths.join('.'),
|
|
39
|
-
setter: setterName,
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<div className={styles.CFromRenderBox}>
|
|
45
|
-
<CustomSchemaForm
|
|
46
|
-
pluginCtx={props.pluginCtx}
|
|
47
|
-
key={node.id}
|
|
48
|
-
defaultSetterConfig={node.value.configure.propsSetter || {}}
|
|
49
|
-
onSetterChange={onSetterChange}
|
|
50
|
-
properties={properties}
|
|
51
|
-
initialValue={value}
|
|
52
|
-
ref={formRef}
|
|
53
|
-
onValueChange={onValueChange}
|
|
54
|
-
/>
|
|
55
|
-
</div>
|
|
56
|
-
);
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export const PropertyPanelConfig: CRightPanelItem = {
|
|
60
|
-
key: 'Property',
|
|
61
|
-
name: 'Property',
|
|
62
|
-
view: ({ node, pluginCtx }) => <PropertyPanel node={node} pluginCtx={pluginCtx} />,
|
|
63
|
-
};
|