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

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

View File

@@ -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)) {