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