You've already forked DataMate
Compare commits
2 Commits
626c0fcd9a
...
a73571bd73
| Author | SHA1 | Date | |
|---|---|---|---|
| a73571bd73 | |||
| 00fa1b86eb |
@@ -247,19 +247,35 @@ const createNode = (
|
||||
attrs[attr] = "";
|
||||
});
|
||||
|
||||
if (objectConfig && attrs.name !== undefined) {
|
||||
if (objectConfig) {
|
||||
const name = getDefaultName(tag);
|
||||
if (!attrs.name) {
|
||||
attrs.name = name;
|
||||
if (attrs.value !== undefined) {
|
||||
attrs.value = `$${name}`;
|
||||
}
|
||||
if (!attrs.value) {
|
||||
attrs.value = `$${attrs.name}`;
|
||||
}
|
||||
}
|
||||
|
||||
if (controlConfig && attrs.name !== undefined) {
|
||||
if (controlConfig) {
|
||||
const isLabeling = controlConfig.category === "labeling";
|
||||
|
||||
if (isLabeling) {
|
||||
if (!attrs.name) {
|
||||
attrs.name = getDefaultName(tag);
|
||||
if (attrs.toName !== undefined) {
|
||||
}
|
||||
if (!attrs.toName) {
|
||||
attrs.toName = objectNames[0] || "";
|
||||
}
|
||||
} else {
|
||||
// For layout controls, only fill if required
|
||||
if (attrs.name !== undefined && !attrs.name) {
|
||||
attrs.name = getDefaultName(tag);
|
||||
}
|
||||
if (attrs.toName !== undefined && !attrs.toName) {
|
||||
attrs.toName = objectNames[0] || "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (CHILD_TAGS.includes(tag)) {
|
||||
@@ -426,8 +442,6 @@ const TemplateConfigurationTreeEditor = ({
|
||||
const [selectedId, setSelectedId] = useState<string>(tree.id);
|
||||
const [parseError, setParseError] = useState<string | null>(null);
|
||||
const lastSerialized = useRef<string>("");
|
||||
const [addChildTag, setAddChildTag] = useState<string | undefined>();
|
||||
const [addSiblingTag, setAddSiblingTag] = useState<string | undefined>();
|
||||
|
||||
useEffect(() => {
|
||||
if (!value) {
|
||||
@@ -763,9 +777,8 @@ const TemplateConfigurationTreeEditor = ({
|
||||
<Select
|
||||
placeholder="添加子节点"
|
||||
options={tagOptions}
|
||||
value={addChildTag}
|
||||
value={null}
|
||||
onChange={(value) => {
|
||||
setAddChildTag(undefined);
|
||||
handleAddNode(value, "child");
|
||||
}}
|
||||
disabled={isStructureLocked}
|
||||
@@ -773,9 +786,8 @@ const TemplateConfigurationTreeEditor = ({
|
||||
<Select
|
||||
placeholder="添加同级节点"
|
||||
options={tagOptions}
|
||||
value={addSiblingTag}
|
||||
value={null}
|
||||
onChange={(value) => {
|
||||
setAddSiblingTag(undefined);
|
||||
handleAddNode(value, "sibling");
|
||||
}}
|
||||
disabled={isStructureLocked || selectedNode.id === tree.id}
|
||||
|
||||
Reference in New Issue
Block a user