feat: 添加动态 Tab 分组支持,优化配置界面 UI 元数据

This commit is contained in:
DrSmoothl
2026-03-07 23:13:04 +08:00
parent d3a4e3f3e7
commit b056ad2c34
5 changed files with 321 additions and 124 deletions

View File

@@ -28,13 +28,26 @@ class ConfigSchemaGenerator:
if nested_schema is not None:
nested[field_name] = nested_schema
return {
schema: dict[str, Any] = {
"className": config_class.__name__,
"classDoc": (config_class.__doc__ or "").strip(),
"fields": fields,
"nested": nested,
}
# 将 UI 分组元数据写入 schema
ui_parent = getattr(config_class, "__ui_parent__", "")
ui_label = getattr(config_class, "__ui_label__", "")
ui_icon = getattr(config_class, "__ui_icon__", "")
if ui_parent:
schema["uiParent"] = ui_parent
if ui_label:
schema["uiLabel"] = ui_label
if ui_icon:
schema["uiIcon"] = ui_icon
return schema
@classmethod
def _build_nested_schema(cls, annotation: Any) -> dict[str, Any] | None:
origin = get_origin(annotation)