feat(annotation): 优化模板配置树编辑器中的属性填充逻辑

- 修改对象配置属性填充条件,仅在名称不存在时设置默认值
- 为控制配置添加标签类别判断逻辑
- 区分标注类和布局类控件的属性填充策略
- 标注类控件始终填充必需属性,布局类控件仅在需要时填充
- 修复属性值设置逻辑,确保正确引用名称属性
This commit is contained in:
2026-02-02 15:26:25 +08:00
parent 00fa1b86eb
commit a73571bd73

View File

@@ -247,18 +247,34 @@ const createNode = (
attrs[attr] = ""; attrs[attr] = "";
}); });
if (objectConfig && attrs.name !== undefined) { if (objectConfig) {
const name = getDefaultName(tag); const name = getDefaultName(tag);
attrs.name = name; if (!attrs.name) {
if (attrs.value !== undefined) { attrs.name = name;
attrs.value = `$${name}`; }
if (!attrs.value) {
attrs.value = `$${attrs.name}`;
} }
} }
if (controlConfig && attrs.name !== undefined) { if (controlConfig) {
attrs.name = getDefaultName(tag); const isLabeling = controlConfig.category === "labeling";
if (attrs.toName !== undefined) {
attrs.toName = objectNames[0] || ""; if (isLabeling) {
if (!attrs.name) {
attrs.name = getDefaultName(tag);
}
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] || "";
}
} }
} }