@sparqjs/schema-designer 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -0
- package/dist/app/root.d.ts +63 -0
- package/dist/app/root.d.ts.map +1 -0
- package/dist/app/toolbar.d.ts +36 -0
- package/dist/app/toolbar.d.ts.map +1 -0
- package/dist/canvas/adapter.d.ts +47 -0
- package/dist/canvas/adapter.d.ts.map +1 -0
- package/dist/canvas/canvas.d.ts +20 -0
- package/dist/canvas/canvas.d.ts.map +1 -0
- package/dist/canvas/node-frame.d.ts +121 -0
- package/dist/canvas/node-frame.d.ts.map +1 -0
- package/dist/canvas/sortable-list.d.ts +44 -0
- package/dist/canvas/sortable-list.d.ts.map +1 -0
- package/dist/dialogs/dialogs.d.ts +58 -0
- package/dist/dialogs/dialogs.d.ts.map +1 -0
- package/dist/dialogs/resource-tree-model.d.ts +62 -0
- package/dist/dialogs/resource-tree-model.d.ts.map +1 -0
- package/dist/extensions/context.d.ts +76 -0
- package/dist/extensions/context.d.ts.map +1 -0
- package/dist/extensions/instance.d.ts +56 -0
- package/dist/extensions/instance.d.ts.map +1 -0
- package/dist/extensions/material.d.ts +49 -0
- package/dist/extensions/material.d.ts.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10190 -0
- package/dist/index.js.map +1 -0
- package/dist/inspector/boolean-checkbox.d.ts +26 -0
- package/dist/inspector/boolean-checkbox.d.ts.map +1 -0
- package/dist/inspector/capabilities/adapters.d.ts +16 -0
- package/dist/inspector/capabilities/adapters.d.ts.map +1 -0
- package/dist/inspector/capabilities/cards/color-palette.d.ts +4 -0
- package/dist/inspector/capabilities/cards/color-palette.d.ts.map +1 -0
- package/dist/inspector/capabilities/cards/component-settings.d.ts +8 -0
- package/dist/inspector/capabilities/cards/component-settings.d.ts.map +1 -0
- package/dist/inspector/capabilities/cards/input-slots.d.ts +4 -0
- package/dist/inspector/capabilities/cards/input-slots.d.ts.map +1 -0
- package/dist/inspector/capabilities/cards/interaction-rules.d.ts +4 -0
- package/dist/inspector/capabilities/cards/interaction-rules.d.ts.map +1 -0
- package/dist/inspector/capabilities/cards/option-source.d.ts +4 -0
- package/dist/inspector/capabilities/cards/option-source.d.ts.map +1 -0
- package/dist/inspector/capabilities/cards/validation-rules.d.ts +4 -0
- package/dist/inspector/capabilities/cards/validation-rules.d.ts.map +1 -0
- package/dist/inspector/capabilities/cards/value-strategy.d.ts +4 -0
- package/dist/inspector/capabilities/cards/value-strategy.d.ts.map +1 -0
- package/dist/inspector/capabilities/index.d.ts +5 -0
- package/dist/inspector/capabilities/index.d.ts.map +1 -0
- package/dist/inspector/capabilities/keys.d.ts +20 -0
- package/dist/inspector/capabilities/keys.d.ts.map +1 -0
- package/dist/inspector/capabilities/register-built-ins.d.ts +4 -0
- package/dist/inspector/capabilities/register-built-ins.d.ts.map +1 -0
- package/dist/inspector/capabilities/registry.d.ts +7 -0
- package/dist/inspector/capabilities/registry.d.ts.map +1 -0
- package/dist/inspector/capabilities/types.d.ts +44 -0
- package/dist/inspector/capabilities/types.d.ts.map +1 -0
- package/dist/inspector/color-palette-editor.d.ts +10 -0
- package/dist/inspector/color-palette-editor.d.ts.map +1 -0
- package/dist/inspector/commands/component-migration.d.ts +25 -0
- package/dist/inspector/commands/component-migration.d.ts.map +1 -0
- package/dist/inspector/commands/field-property.d.ts +51 -0
- package/dist/inspector/commands/field-property.d.ts.map +1 -0
- package/dist/inspector/commands/form-property.d.ts +25 -0
- package/dist/inspector/commands/form-property.d.ts.map +1 -0
- package/dist/inspector/component-settings-editor.d.ts +37 -0
- package/dist/inspector/component-settings-editor.d.ts.map +1 -0
- package/dist/inspector/computed-expression-editor.d.ts +20 -0
- package/dist/inspector/computed-expression-editor.d.ts.map +1 -0
- package/dist/inspector/condition-editor-model.d.ts +63 -0
- package/dist/inspector/condition-editor-model.d.ts.map +1 -0
- package/dist/inspector/condition-visual-editor.d.ts +30 -0
- package/dist/inspector/condition-visual-editor.d.ts.map +1 -0
- package/dist/inspector/container-items-editor.d.ts +42 -0
- package/dist/inspector/container-items-editor.d.ts.map +1 -0
- package/dist/inspector/date-time-format-editor.d.ts +30 -0
- package/dist/inspector/date-time-format-editor.d.ts.map +1 -0
- package/dist/inspector/default-value-editor.d.ts +30 -0
- package/dist/inspector/default-value-editor.d.ts.map +1 -0
- package/dist/inspector/field-property-view.d.ts +44 -0
- package/dist/inspector/field-property-view.d.ts.map +1 -0
- package/dist/inspector/field-schema/build-sections.d.ts +9 -0
- package/dist/inspector/field-schema/build-sections.d.ts.map +1 -0
- package/dist/inspector/field-schema/component-options.d.ts +14 -0
- package/dist/inspector/field-schema/component-options.d.ts.map +1 -0
- package/dist/inspector/field-schema/fields.d.ts +21 -0
- package/dist/inspector/field-schema/fields.d.ts.map +1 -0
- package/dist/inspector/field-schema/index.d.ts +5 -0
- package/dist/inspector/field-schema/index.d.ts.map +1 -0
- package/dist/inspector/field-schema/keys.d.ts +15 -0
- package/dist/inspector/field-schema/keys.d.ts.map +1 -0
- package/dist/inspector/field-schema/registry.d.ts +99 -0
- package/dist/inspector/field-schema/registry.d.ts.map +1 -0
- package/dist/inspector/field-schema/types.d.ts +113 -0
- package/dist/inspector/field-schema/types.d.ts.map +1 -0
- package/dist/inspector/form-property-view.d.ts +14 -0
- package/dist/inspector/form-property-view.d.ts.map +1 -0
- package/dist/inspector/form-schema.d.ts +64 -0
- package/dist/inspector/form-schema.d.ts.map +1 -0
- package/dist/inspector/input-slots-editor.d.ts +11 -0
- package/dist/inspector/input-slots-editor.d.ts.map +1 -0
- package/dist/inspector/inspector.d.ts +34 -0
- package/dist/inspector/inspector.d.ts.map +1 -0
- package/dist/inspector/interaction-rules-editor.d.ts +24 -0
- package/dist/inspector/interaction-rules-editor.d.ts.map +1 -0
- package/dist/inspector/option-source-editor.d.ts +35 -0
- package/dist/inspector/option-source-editor.d.ts.map +1 -0
- package/dist/inspector/option-source-summary.d.ts +4 -0
- package/dist/inspector/option-source-summary.d.ts.map +1 -0
- package/dist/inspector/property-commit.d.ts +23 -0
- package/dist/inspector/property-commit.d.ts.map +1 -0
- package/dist/inspector/property-section.d.ts +4 -0
- package/dist/inspector/property-section.d.ts.map +1 -0
- package/dist/inspector/property-ui-adapter.d.ts +4 -0
- package/dist/inspector/property-ui-adapter.d.ts.map +1 -0
- package/dist/inspector/required-validation.d.ts +16 -0
- package/dist/inspector/required-validation.d.ts.map +1 -0
- package/dist/inspector/validation-rule-editor.d.ts +25 -0
- package/dist/inspector/validation-rule-editor.d.ts.map +1 -0
- package/dist/inspector/value-strategy-editor.d.ts +31 -0
- package/dist/inspector/value-strategy-editor.d.ts.map +1 -0
- package/dist/services/registry.d.ts +68 -0
- package/dist/services/registry.d.ts.map +1 -0
- package/dist/shared/clone.d.ts +8 -0
- package/dist/shared/clone.d.ts.map +1 -0
- package/dist/shared/component-registry.d.ts +10 -0
- package/dist/shared/component-registry.d.ts.map +1 -0
- package/dist/shared/icons.d.ts +8 -0
- package/dist/shared/icons.d.ts.map +1 -0
- package/dist/shared/object-path.d.ts +14 -0
- package/dist/shared/object-path.d.ts.map +1 -0
- package/dist/shared/ui-adapter.d.ts +12 -0
- package/dist/shared/ui-adapter.d.ts.map +1 -0
- package/dist/shared/view-node.d.ts +9 -0
- package/dist/shared/view-node.d.ts.map +1 -0
- package/dist/sidebar/components.d.ts +24 -0
- package/dist/sidebar/components.d.ts.map +1 -0
- package/dist/sidebar/sidebar.d.ts +25 -0
- package/dist/sidebar/sidebar.d.ts.map +1 -0
- package/dist/state/component-config.d.ts +41 -0
- package/dist/state/component-config.d.ts.map +1 -0
- package/dist/state/create-state.d.ts +8 -0
- package/dist/state/create-state.d.ts.map +1 -0
- package/dist/state/draft.d.ts +12 -0
- package/dist/state/draft.d.ts.map +1 -0
- package/dist/state/field.d.ts +10 -0
- package/dist/state/field.d.ts.map +1 -0
- package/dist/state/form-actions.d.ts +17 -0
- package/dist/state/form-actions.d.ts.map +1 -0
- package/dist/state/form-view.d.ts +6 -0
- package/dist/state/form-view.d.ts.map +1 -0
- package/dist/state/history.d.ts +16 -0
- package/dist/state/history.d.ts.map +1 -0
- package/dist/state/node-actions.d.ts +66 -0
- package/dist/state/node-actions.d.ts.map +1 -0
- package/dist/state/node-permissions.d.ts +17 -0
- package/dist/state/node-permissions.d.ts.map +1 -0
- package/dist/state/output.d.ts +5 -0
- package/dist/state/output.d.ts.map +1 -0
- package/dist/state/schema.d.ts +10 -0
- package/dist/state/schema.d.ts.map +1 -0
- package/dist/state/tree.d.ts +28 -0
- package/dist/state/tree.d.ts.map +1 -0
- package/dist/state/types.d.ts +81 -0
- package/dist/state/types.d.ts.map +1 -0
- package/dist/state/visibility.d.ts +17 -0
- package/dist/state/visibility.d.ts.map +1 -0
- package/package.json +46 -0
- package/src/style.css +2129 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/services/registry.ts","../src/shared/clone.ts","../src/state/form-view.ts","../src/state/tree.ts","../src/state/schema.ts","../src/state/create-state.ts","../src/state/output.ts","../src/shared/object-path.ts","../src/extensions/instance.ts","../src/shared/view-node.ts","../src/state/component-config.ts","../src/state/field.ts","../src/state/node-permissions.ts","../src/state/history.ts","../src/state/form-actions.ts","../src/state/visibility.ts","../src/state/node-actions.ts","../../../../internal/frontend-core/src/kernel.ts","../src/inspector/capabilities/keys.ts","../src/inspector/condition-editor-model.ts","../src/inspector/required-validation.ts","../src/inspector/capabilities/adapters.ts","../src/inspector/capabilities/cards/interaction-rules.ts","../src/inspector/option-source-summary.ts","../src/inspector/capabilities/cards/option-source.ts","../src/inspector/capabilities/cards/validation-rules.ts","../src/inspector/capabilities/cards/value-strategy.ts","../src/inspector/capabilities/cards/input-slots.ts","../src/inspector/capabilities/cards/color-palette.ts","../src/inspector/capabilities/cards/component-settings.ts","../src/inspector/capabilities/register-built-ins.ts","../src/inspector/capabilities/registry.ts","../src/inspector/field-schema/keys.ts","../src/inspector/field-schema/fields.ts","../src/inspector/field-schema/registry.ts","../src/inspector/field-schema/component-options.ts","../src/inspector/field-schema/build-sections.ts","../src/sidebar/components.ts","../src/extensions/context.ts","../src/shared/icons.tsx","../src/app/toolbar.tsx","../src/canvas/sortable-list.tsx","../src/sidebar/sidebar.tsx","../src/canvas/node-frame.tsx","../src/shared/ui-adapter.ts","../src/canvas/adapter.ts","../src/canvas/canvas.tsx","../src/inspector/property-section.ts","../src/inspector/field-property-view.ts","../src/inspector/commands/component-migration.ts","../src/inspector/commands/field-property.ts","../src/inspector/form-schema.ts","../src/inspector/form-property-view.ts","../src/inspector/commands/form-property.ts","../src/inspector/property-commit.ts","../src/inspector/validation-rule-editor.tsx","../src/inspector/option-source-editor.tsx","../src/inspector/computed-expression-editor.tsx","../src/inspector/value-strategy-editor.tsx","../src/inspector/condition-visual-editor.tsx","../src/inspector/interaction-rules-editor.tsx","../src/inspector/component-settings-editor.tsx","../src/inspector/boolean-checkbox.tsx","../src/inspector/input-slots-editor.tsx","../src/inspector/date-time-format-editor.tsx","../src/inspector/color-palette-editor.tsx","../src/inspector/default-value-editor.tsx","../src/inspector/container-items-editor.tsx","../src/inspector/property-ui-adapter.ts","../src/inspector/inspector.tsx","../src/dialogs/resource-tree-model.ts","../src/dialogs/dialogs.tsx","../src/shared/component-registry.ts","../src/app/root.tsx"],"sourcesContent":["import type { ResourceField, SchemaResource, ViewNode } from '@sparqjs/schema-protocol'\n\n/**\n * 设计期服务返回给属性控件或弹层选择器的通用选项。\n *\n * meta 用于保留服务侧原始对象,方便自定义编辑器继续读取字段类型、资源标识等上下文;\n * 核心控件只依赖 label/value,不应该解析 meta 中的业务结构。\n */\nexport interface DesignerServiceOption {\n label: string\n value: string\n disabled?: boolean\n meta?: Record<string, unknown>\n}\n\n/**\n * 设计期服务的调用上下文。\n *\n * 该上下文只描述设计器当前状态,不携带鉴权、HTTP client 或租户配置。真实接口请求由外部\n * provider 自己封装,避免设计器核心绑定具体后端实现。\n */\nexport interface DesignerServiceContext {\n schema?: SchemaResource\n node?: ViewNode\n field?: ResourceField\n fields?: ResourceField[]\n values?: Record<string, unknown>\n}\n\n/**\n * 设计期外部能力提供者。\n *\n * load 用于下拉、选择器、模板列表等查询型场景;run 用于表达式校验、请求测试、模板套用等\n * 动作型场景。signal 必须向下传递给真实请求,节点切换或依赖值变化时才能取消旧请求。\n */\nexport interface DesignerServiceProvider<T = unknown> {\n key: string\n load?: (context: DesignerServiceContext, params?: Record<string, unknown>, signal?: AbortSignal) => Promise<T>\n run?: (context: DesignerServiceContext, params?: Record<string, unknown>, signal?: AbortSignal) => Promise<T>\n}\n\n/** 单个设计器实例的服务映射,key 与属性 dataSource.provider 对应。 */\nexport type DesignerServiceRegistry = Map<string, DesignerServiceProvider>\n\n/** 无需宿主接口即可工作的内置设计期服务;正常 Shell 会把它们安装到实例 Kernel 的 builtin 层。 */\nexport const builtInDesignerServiceProviders: readonly DesignerServiceProvider[] = [\n {\n key: 'schema.fields',\n async load(context) {\n const fields = context.fields ?? context.schema?.schema.fields ?? []\n return fields.map((field) => ({\n label: `${field.label || field.name}(${field.name})`,\n value: `form.${field.name}`,\n meta: {\n field,\n },\n }))\n },\n },\n]\n\n/**\n * 创建设计器实例级服务注册表。\n *\n * 正常设计器传入扩展上下文已经解析完成的 provider;独立编辑器和测试也可以创建只含局部\n * provider 的注册表,并由读取函数回退到内置服务。\n */\nexport function createDesignerServiceRegistry(providers: DesignerServiceProvider[] = []): DesignerServiceRegistry {\n const registry: DesignerServiceRegistry = new Map()\n for (const provider of providers) {\n registry.set(provider.key, provider)\n }\n return registry\n}\n\n/**\n * 读取设计期服务。\n *\n * 返回值可能为空。内置 fallback 只服务于没有经过 DesignerExtensionContext 的独立调用,\n * 正常设计器的覆盖顺序和重复诊断已经在实例 Kernel 中完成。\n */\nexport function getDesignerServiceProvider<T = unknown>(\n key: string,\n registry?: DesignerServiceRegistry,\n): DesignerServiceProvider<T> | undefined {\n return (registry?.get(key) ?? builtInDesignerServiceProviders.find((provider) => provider.key === key)) as\n | DesignerServiceProvider<T>\n | undefined\n}\n\n/**\n * 执行查询型设计期服务。\n *\n * 这里统一校验 provider 是否支持 load,避免各个属性控件重复处理“服务不存在”和“能力不匹配”。\n */\nexport async function loadDesignerService<T = unknown>(\n key: string,\n context: DesignerServiceContext,\n params?: Record<string, unknown>,\n signal?: AbortSignal,\n registry?: DesignerServiceRegistry,\n): Promise<T> {\n const provider = getDesignerServiceProvider<T>(key, registry)\n if (!provider?.load) {\n throw new Error(`Designer service \"${key}\" does not support load.`)\n }\n\n return provider.load(context, params, signal)\n}\n\n/**\n * 执行动作型设计期服务。\n *\n * 第一阶段主要为后续模板套用、表达式校验和请求测试预留统一入口,当前不在右侧面板直接使用。\n */\nexport async function runDesignerService<T = unknown>(\n key: string,\n context: DesignerServiceContext,\n params?: Record<string, unknown>,\n signal?: AbortSignal,\n registry?: DesignerServiceRegistry,\n): Promise<T> {\n const provider = getDesignerServiceProvider<T>(key, registry)\n if (!provider?.run) {\n throw new Error(`Designer service \"${key}\" does not support run.`)\n }\n\n return provider.run(context, params, signal)\n}\n","/**\n * 克隆基于 JSON 的可序列化值。\n *\n * Designer 的 schema、field 和 view node 都是纯数据结构。\n * 这里统一处理深拷贝,避免同类 JSON 克隆逻辑散落在各个模块中。\n */\nexport function cloneSerializable<T>(value: T): T {\n return JSON.parse(JSON.stringify(value)) as T\n}\n","import type { FormView, SchemaResource, ViewNode } from '@sparqjs/schema-protocol'\n\ntype FormMap = Record<string, false | FormView>\n\n/** 获取当前 FormView 的可写 children,并在缺失时初始化空数组。 */\nexport function getFormChildren(schema: SchemaResource, viewName: string): ViewNode[] {\n const currentForm = getFormView(schema, viewName)\n\n const formChildren = currentForm.children ?? []\n currentForm.children = formChildren\n return formChildren\n}\n\n/** 获取可编辑 FormView;视图缺失或显式为 false 时创建带 schema 标题的空表单。 */\nexport function getFormView(schema: SchemaResource, viewName: string): FormView {\n const forms = getWritableForms(schema)\n const configuredForm = forms[viewName]\n if (!configuredForm) {\n forms[viewName] = {\n title: schema.schema.title,\n children: [],\n }\n }\n\n const currentForm = forms[viewName]\n if (!currentForm) {\n forms[viewName] = {\n title: schema.schema.title,\n children: [],\n }\n return forms[viewName] as FormView\n }\n\n return currentForm\n}\n\nfunction getWritableForms(schema: SchemaResource): FormMap {\n schema.schema.views ??= {}\n\n if (!schema.schema.views.forms) {\n const defaultForm = schema.schema.views.form\n schema.schema.views.forms = defaultForm ? { default: defaultForm } : {}\n delete schema.schema.views.form\n }\n\n return schema.schema.views.forms\n}\n","import type { SchemaResource, ViewNode } from '@sparqjs/schema-protocol'\nimport { cloneSerializable } from '../shared/clone'\nimport type { DraftState } from './types'\nimport { getFormChildren } from './form-view'\n\nlet nextNodeId = 1\n\n/** 节点在树中的可写位置,siblings 与当前草稿保持同一数组引用。 */\nexport interface NodeLocation {\n parentId?: string\n siblings: ViewNode[]\n index: number\n node: ViewNode\n}\n\n/** 在嵌套 ViewNode 树中按设计器内部 ID 查找节点。 */\nexport function getNodeById(nodes: ViewNode[], id: string): ViewNode | undefined {\n for (const node of nodes) {\n if (node.id === id) {\n return node\n }\n const child = getNodeById(node.children ?? [], id)\n if (child) {\n return child\n }\n }\n\n return undefined\n}\n\n/** 返回节点、父级和兄弟数组位置,供移动、复制和删除事务复用。 */\nexport function findNodeLocation(nodes: ViewNode[], id: string, parentId?: string): NodeLocation | undefined {\n for (let index = 0; index < nodes.length; index += 1) {\n const node = nodes[index]\n if (!node) {\n continue\n }\n if (node.id === id) {\n return {\n parentId,\n siblings: nodes,\n index,\n node,\n }\n }\n\n const child = findNodeLocation(node.children ?? [], id, node.id)\n if (child) {\n return child\n }\n }\n\n return undefined\n}\n\n/** 返回节点在表单根级的索引;嵌套节点返回 -1。 */\nexport function getRootIndexById(state: DraftState, id: string): number {\n return getFormChildren(state.schema, state.viewName).findIndex((node) => node.id === id)\n}\n\n/** 取得目标容器的可写 children;容器存在但尚无 children 时会初始化空数组。 */\nexport function getNodeChildren(\n schema: SchemaResource,\n viewName: string,\n parentId: string | undefined,\n): ViewNode[] | undefined {\n if (!parentId) {\n return getFormChildren(schema, viewName)\n }\n\n const parent = getNodeById(getFormChildren(schema, viewName), parentId)\n if (!parent) {\n return undefined\n }\n\n parent.children ??= []\n return parent.children\n}\n\n/** 判断目标 ID 是否位于节点后代中,用于阻止形成循环树。 */\nexport function isDescendantNode(node: ViewNode, targetId: string): boolean {\n return (node.children ?? []).some((child) => child.id === targetId || isDescendantNode(child, targetId))\n}\n\n/** 深复制节点并为整棵副本树生成新的设计器内部 ID。 */\nexport function cloneNode(node: ViewNode): ViewNode {\n return prepareNode(cloneSerializable(node))\n}\n\n/** 将插入索引限制在数组首尾之间。 */\nexport function clampIndex(index: number, length: number): number {\n return Math.max(0, Math.min(index, length))\n}\n\n/** 为当前表单视图中缺少 ID 的节点补齐设计器内部标识,不覆盖已有 ID。 */\nexport function ensureNodeIds(schema: SchemaResource, viewName: string): void {\n getFormChildren(schema, viewName).forEach((node) => assignNodeIds(node))\n}\n\n/** 准备新插入节点,并强制为节点及后代生成全新 ID。 */\nexport function prepareNode(node: ViewNode): ViewNode {\n assignNodeIds(node, true)\n return node\n}\n\nfunction assignNodeIds(node: ViewNode, force = false): void {\n if (force || !node.id) {\n node.id = createNodeId()\n }\n node.children?.forEach((child) => assignNodeIds(child, force))\n}\n\nfunction createNodeId(): string {\n return `node_${Date.now().toString(36)}_${nextNodeId++}`\n}\n","import type { SchemaResource } from '@sparqjs/schema-protocol'\nimport { toRaw } from 'vue'\nimport { cloneSerializable } from '../shared/clone'\nimport { ensureNodeIds } from './tree'\n\n/** 深复制可序列化 schema,隔离 props、history 和宿主传入对象。 */\nexport function cloneSchema(schema: SchemaResource): SchemaResource {\n return cloneSerializable(toRaw(schema))\n}\n\n/** 创建可编辑草稿并为当前表单视图补齐设计器内部节点 ID。 */\nexport function prepareDraftSchema(schema: SchemaResource, viewName: string): SchemaResource {\n const draft = cloneSchema(schema)\n ensureNodeIds(draft, viewName)\n return draft\n}\n\n/** 将当前 schema 格式化为可导出和人工检查的 JSON。 */\nexport function formatSchema(schema: SchemaResource): string {\n return JSON.stringify(schema, null, 2)\n}\n\n/** 解析导入的 JSON 文本;协议完整性由后续草稿准备和业务校验负责。 */\nexport function parseSchema(text: string): SchemaResource {\n return JSON.parse(text) as SchemaResource\n}\n","import type { SchemaResource } from '@sparqjs/schema-protocol'\nimport { createDesignerServiceRegistry } from '../services/registry'\nimport type { DesignerExtensionContext } from '../extensions/context'\nimport type { DraftState, RootProps } from './types'\nimport { cloneSchema, prepareDraftSchema } from './schema'\n\n/** 创建设计器草稿状态,并隔离宿主 schema、保存快照、服务和扩展上下文。 */\nexport function createState(\n schema: SchemaResource,\n viewName = 'default',\n services?: RootProps['services'],\n extensionContext?: DesignerExtensionContext,\n): DraftState {\n const draft = prepareDraftSchema(schema, viewName)\n\n return {\n schema: draft,\n schemaVersion: 0,\n viewName,\n device: 'pc',\n sidebarTab: 'components',\n inspectorTab: 'field',\n jsonOpen: false,\n previewOpen: false,\n previewLoading: false,\n saving: false,\n resourceTreeOpen: false,\n savedSchema: cloneSchema(draft),\n history: [],\n future: [],\n serviceRegistry: resolveDesignerServiceRegistry(services),\n extensionContext,\n }\n}\n\n/** 将 services prop 归一为实例 Map;宿主传入 Map 时保留其对象身份。 */\nexport function resolveDesignerServiceRegistry(services: RootProps['services'] | undefined) {\n if (!services) {\n return undefined\n }\n if (services instanceof Map) {\n return services\n }\n return createDesignerServiceRegistry(services)\n}\n","import type { SchemaResource } from '@sparqjs/schema-protocol'\nimport type { DesignerOutputScope } from '../extensions/instance'\nimport { cloneSchema } from './schema'\n\n/** 按宿主声明的范围投影输出;form 保留资源字段和表单视图,移除其他视图。 */\nexport function createDesignerOutputSchema(draft: SchemaResource, scope: DesignerOutputScope): SchemaResource {\n if (scope === 'resource') {\n return cloneSchema(draft)\n }\n\n const output = cloneSchema(draft)\n const form = output.schema.views?.form\n const forms = output.schema.views?.forms\n if (form === undefined && forms === undefined) {\n delete output.schema.views\n } else {\n output.schema.views = {\n ...(form !== undefined ? { form } : {}),\n ...(forms !== undefined ? { forms } : {}),\n }\n }\n\n return output\n}\n","function normalizeObjectPath(path: string | string[]): string[] {\n return Array.isArray(path) ? path : path.split('.')\n}\n\n/** 判断值是否可作为属性路径容器,数组不会被当成 schema 对象继续遍历。 */\nexport function isPlainObjectRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === 'object' && !Array.isArray(value)\n}\n\n/** 读取嵌套对象路径;任一中间节点不是普通对象时返回 undefined。 */\nexport function getObjectPathValue(target: Record<string, unknown>, path: string | string[]): unknown {\n return normalizeObjectPath(path).reduce<unknown>((current, segment) => {\n if (!isPlainObjectRecord(current)) {\n return undefined\n }\n\n return current[segment]\n }, target)\n}\n\n/**\n * 按对象路径设置值。\n *\n * 当 value 为 undefined 时会删除目标字段,并向上清理因此变成空对象的父级容器,\n * 这样表单属性编辑不会在 schema 中残留无意义的空 props / wrapper / footer 对象。\n */\nexport function setObjectPathValue(target: Record<string, unknown>, path: string | string[], value: unknown): void {\n const segments = normalizeObjectPath(path)\n const chain: Array<{ parent: Record<string, unknown>; key: string }> = []\n let current = target\n\n for (let index = 0; index < segments.length - 1; index += 1) {\n const key = segments[index] as string\n const next = current[key]\n\n if (!isPlainObjectRecord(next)) {\n if (value === undefined) {\n return\n }\n current[key] = {}\n }\n\n chain.push({ parent: current, key })\n current = current[key] as Record<string, unknown>\n }\n\n const lastKey = segments[segments.length - 1] as string\n if (value === undefined) {\n delete current[lastKey]\n } else {\n current[lastKey] = value\n }\n\n pruneEmptyObjectChain(chain)\n}\n\n/** 递归删除空对象,用于属性写回后清理无业务含义的空 schema 容器。 */\nexport function cleanupEmptyObjects(value: Record<string, unknown> | undefined): void {\n if (!value) {\n return\n }\n\n for (const key of Object.keys(value)) {\n const next = value[key]\n if (!isPlainObjectRecord(next)) {\n continue\n }\n\n cleanupEmptyObjects(next)\n if (Object.keys(next).length === 0) {\n delete value[key]\n }\n }\n}\n\nfunction pruneEmptyObjectChain(chain: Array<{ parent: Record<string, unknown>; key: string }>): void {\n for (let index = chain.length - 1; index >= 0; index -= 1) {\n const item = chain[index] as { parent: Record<string, unknown>; key: string }\n const value = item.parent[item.key]\n if (!isPlainObjectRecord(value) || Object.keys(value).length > 0) {\n break\n }\n delete item.parent[item.key]\n }\n}\n","import type { ResourceField, SchemaResource, ViewNode } from '@sparqjs/schema-protocol'\n\n/** Designer 输出范围;form 只保留字段定义和表单视图。 */\nexport type DesignerOutputScope = 'resource' | 'form'\n\n/** 宿主按设计场景控制 Designer 的通用入口,不在核心内识别具体业务模块。 */\nexport interface DesignerFeatureOptions {\n resourceTree?: boolean\n templates?: boolean\n formProperties?: boolean\n deviceModes?: boolean\n importJson?: boolean\n exportJson?: boolean\n preview?: boolean\n jsonView?: boolean\n}\n\n/** Designer 内部使用的完整能力开关。 */\nexport type ResolvedDesignerFeatures = Required<DesignerFeatureOptions>\n\nexport const defaultDesignerFeatures: ResolvedDesignerFeatures = Object.freeze({\n resourceTree: true,\n templates: true,\n formProperties: true,\n deviceModes: true,\n importJson: true,\n exportJson: true,\n preview: true,\n jsonView: true,\n})\n\n/** 补齐宿主未声明的入口,保持现有 Designer 实例行为不变。 */\nexport function resolveDesignerFeatures(features?: DesignerFeatureOptions): ResolvedDesignerFeatures {\n return { ...defaultDesignerFeatures, ...features }\n}\n\n/** 单个表单节点可执行的操作;未声明的布尔项默认允许。 */\nexport interface DesignerNodePermissions {\n selectable?: boolean\n editable?: boolean\n movable?: boolean\n copyable?: boolean\n deletable?: boolean\n /** 允许成为直接父级的节点 ID;null 表示当前表单根级。 */\n allowedParentIds?: readonly (string | null)[]\n}\n\n/** 节点权限解析器获得的当前草稿上下文。 */\nexport interface DesignerNodePermissionContext {\n node: ViewNode\n parent?: ViewNode\n field?: ResourceField\n schema: SchemaResource\n viewName: string\n}\n\n/** 宿主按节点、字段或父容器动态声明权限,不把业务所有权写入 Designer。 */\nexport type DesignerNodePermissionResolver = (\n context: DesignerNodePermissionContext,\n) => DesignerNodePermissions | undefined\n\n/** 解析后的节点权限包含完整默认值,调用方无需重复补齐缺省项。 */\nexport interface ResolvedDesignerNodePermissions {\n selectable: boolean\n editable: boolean\n movable: boolean\n copyable: boolean\n deletable: boolean\n allowedParentIds?: readonly (string | null)[]\n}\n\n/** 当前实例统一使用的节点权限策略。 */\nexport interface DesignerNodePermissionPolicy {\n resolve(context: DesignerNodePermissionContext): ResolvedDesignerNodePermissions\n}\n\nexport const defaultDesignerNodePermissions: ResolvedDesignerNodePermissions = Object.freeze({\n selectable: true,\n editable: true,\n movable: true,\n copyable: true,\n deletable: true,\n})\n\n/** 将宿主权限结果补齐为不可受外部数组后续修改影响的实例策略。 */\nexport function createDesignerNodePermissionPolicy(\n resolver?: DesignerNodePermissionResolver,\n): DesignerNodePermissionPolicy {\n return {\n resolve(context) {\n const permissions = resolver?.(context)\n if (!permissions) {\n return defaultDesignerNodePermissions\n }\n\n return {\n selectable: permissions.selectable ?? true,\n editable: permissions.editable ?? true,\n movable: permissions.movable ?? true,\n copyable: permissions.copyable ?? true,\n deletable: permissions.deletable ?? true,\n allowedParentIds: permissions.allowedParentIds ? [...permissions.allowedParentIds] : undefined,\n }\n },\n }\n}\n","const containerNodeTypes = new Set([\n 'group',\n 'section',\n 'card',\n 'grid',\n 'row',\n 'col',\n 'tabs',\n 'tab',\n 'collapse',\n 'collapse-item',\n 'custom',\n])\n\n/** 判断节点类型是否具备 children 容器语义。 */\nexport function isContainerNodeType(type: string | undefined): boolean {\n return containerNodeTypes.has(type ?? '')\n}\n\n/** 判断 ViewNode 能否成为指定父节点的直接子节点;undefined 父节点表示表单根级。 */\nexport function canContainViewNode(parent: { type?: string } | undefined, child: { type?: string }): boolean {\n if (!parent) {\n return child.type !== 'tab' && child.type !== 'collapse-item'\n }\n if (!isContainerNodeType(parent.type)) {\n return false\n }\n if (parent.type === 'tabs') {\n return child.type === 'tab'\n }\n if (parent.type === 'collapse') {\n return child.type === 'collapse-item'\n }\n\n return child.type !== 'tab' && child.type !== 'collapse-item'\n}\n","import type { ResourceField, ViewNode } from '@sparqjs/schema-protocol'\n\n/** 设计器允许用户切换的 ResourceField 类型子集。 */\nexport type DesignerFieldType = 'string' | 'text' | 'number' | 'boolean' | 'date' | 'datetime' | 'time' | 'json'\n\n/** 字段类型下拉使用的标签和值。 */\nexport interface DesignerFieldTypeOption {\n label: string\n value: DesignerFieldType\n}\n\n/** 组件声明的默认字段类型和可兼容类型边界。 */\nexport interface DesignerComponentFieldTypeConfig {\n defaultType: DesignerFieldType\n allowedTypes: DesignerFieldType[]\n}\n\n/** 字段基数由组件固定、字段快捷项控制,或由组件私有配置推导。 */\nexport type DesignerMultiplePolicy = 'single' | 'multiple' | 'field-configurable' | 'component-configurable'\n\n/** 带组件 key 的完整字段类型配置,用于内置映射解析。 */\nexport interface ComponentFieldConfig extends DesignerComponentFieldTypeConfig {\n component: string\n multiple: DesignerMultiplePolicy\n}\n\n/** Inspector 可展示的字段协议类型及中文标签。 */\nexport const designerFieldTypeOptions: DesignerFieldTypeOption[] = [\n { label: '字符串', value: 'string' },\n { label: '长文本', value: 'text' },\n { label: '数字', value: 'number' },\n { label: '布尔', value: 'boolean' },\n { label: '日期', value: 'date' },\n { label: '日期时间', value: 'datetime' },\n { label: '时间', value: 'time' },\n { label: 'JSON', value: 'json' },\n]\n\nconst componentFieldConfigs: Record<string, ComponentFieldConfig> = {\n text: textLike('text'),\n password: textLike('password'),\n textarea: textLike('textarea'),\n select: scalarChoice('select'),\n 'multi-select': scalarChoice('multi-select', 'multiple'),\n radio: scalarChoice('radio'),\n checkbox: scalarChoice('checkbox', 'multiple'),\n color: textLike('color'),\n 'icon-input': textLike('icon-input'),\n 'rich-text': { component: 'rich-text', defaultType: 'text', allowedTypes: ['text'], multiple: 'single' },\n number: { component: 'number', defaultType: 'number', allowedTypes: ['number'], multiple: 'single' },\n slider: { component: 'slider', defaultType: 'number', allowedTypes: ['number'], multiple: 'single' },\n rate: { component: 'rate', defaultType: 'number', allowedTypes: ['number'], multiple: 'single' },\n switch: { component: 'switch', defaultType: 'boolean', allowedTypes: ['boolean'], multiple: 'single' },\n 'date-picker': {\n component: 'date-picker',\n defaultType: 'date',\n allowedTypes: ['date', 'string'],\n multiple: 'single',\n },\n 'datetime-picker': {\n component: 'datetime-picker',\n defaultType: 'datetime',\n allowedTypes: ['datetime', 'string'],\n multiple: 'single',\n },\n 'time-picker': {\n component: 'time-picker',\n defaultType: 'time',\n allowedTypes: ['time', 'string'],\n multiple: 'single',\n },\n 'date-range-picker': {\n component: 'date-range-picker',\n defaultType: 'json',\n allowedTypes: ['json'],\n multiple: 'single',\n },\n 'time-range-picker': {\n component: 'time-range-picker',\n defaultType: 'json',\n allowedTypes: ['json'],\n multiple: 'single',\n },\n 'json-editor': {\n component: 'json-editor',\n defaultType: 'json',\n allowedTypes: ['json'],\n multiple: 'single',\n },\n 'key-value': {\n component: 'key-value',\n defaultType: 'json',\n allowedTypes: ['json'],\n multiple: 'single',\n },\n 'select-tree': scalarChoice('select-tree', 'field-configurable'),\n cascader: scalarChoice('cascader', 'field-configurable'),\n 'image-upload': {\n component: 'image-upload',\n defaultType: 'number',\n allowedTypes: ['number', 'string', 'json'],\n multiple: 'component-configurable',\n },\n 'file-upload': {\n component: 'file-upload',\n defaultType: 'number',\n allowedTypes: ['number', 'string', 'json'],\n multiple: 'component-configurable',\n },\n}\n\n/** 解析组件允许的字段类型;扩展声明优先于设计器内置映射。 */\nexport function getComponentFieldConfig(\n component: string | undefined,\n fieldTypes?: DesignerComponentFieldTypeConfig,\n): ComponentFieldConfig {\n if (!component) {\n return textLike('text')\n }\n if (fieldTypes) {\n return {\n component,\n defaultType: fieldTypes.defaultType,\n allowedTypes: [...fieldTypes.allowedTypes],\n multiple: componentFieldConfigs[component]?.multiple ?? 'single',\n }\n }\n return componentFieldConfigs[component] ?? textLike(component)\n}\n\n/** 返回新建字段时应使用的协议类型。 */\nexport function defaultFieldTypeForComponent(\n component: string | undefined,\n fieldTypes?: DesignerComponentFieldTypeConfig,\n): DesignerFieldType {\n return getComponentFieldConfig(component, fieldTypes).defaultType\n}\n\n/** 返回新节点需要立即写入的组件默认 props,未配置时保持 schema 精简。 */\nexport function defaultNodePropsForComponent(component: string | undefined): Record<string, unknown> | undefined {\n switch (component) {\n case 'text':\n case 'textarea':\n return { showWordLimit: true }\n case 'color':\n return { showAlpha: false, colorFormat: 'hex' }\n case 'icon-input':\n return { allowCustom: false }\n case 'image-upload':\n return { valueMode: 'id', multiple: false, accept: 'image/*' }\n case 'file-upload':\n return { valueMode: 'id', multiple: false }\n default:\n return undefined\n }\n}\n\n/** 列出组件可切换的字段类型,并保留已有字段的当前类型供兼容展示。 */\nexport function fieldTypeOptionsForComponent(\n component: string | undefined,\n field?: ResourceField,\n fieldTypes?: DesignerComponentFieldTypeConfig,\n): DesignerFieldTypeOption[] {\n const allowed = new Set<DesignerFieldType>(getComponentFieldConfig(component, fieldTypes).allowedTypes)\n const currentType = field?.type as DesignerFieldType | undefined\n if (isDesignerFieldType(currentType)) {\n allowed.add(currentType)\n }\n return designerFieldTypeOptions.filter((item) => allowed.has(item.value))\n}\n\n/** 判断字段类型是否存在多个有效选择,用于控制 Inspector 是否展示类型控件。 */\nexport function shouldShowFieldTypeForComponent(\n component: string | undefined,\n field?: ResourceField,\n fieldTypes?: DesignerComponentFieldTypeConfig,\n): boolean {\n return fieldTypeOptionsForComponent(component, field, fieldTypes).length > 1\n}\n\n/** 已持久化字段存在后端标识时锁定类型,避免设计期修改破坏存量数据。 */\nexport function isFieldTypeLocked(field: ResourceField | undefined): boolean {\n return Boolean(field?.id || field?.resource_id || field?.version_id)\n}\n\n/** 判断字段当前协议类型能否由目标组件稳定输出。 */\nexport function isFieldTypeCompatibleWithComponent(\n component: string | undefined,\n field: ResourceField | undefined,\n fieldTypes?: DesignerComponentFieldTypeConfig,\n): boolean {\n if (!field) {\n return true\n }\n return getComponentFieldConfig(component, fieldTypes).allowedTypes.some((type) => type === field.type)\n}\n\n/** 按组件能力归一化字段类型;锁定字段始终保留后端当前类型。 */\nexport function normalizeFieldTypeForNode(\n node: ViewNode,\n field: ResourceField | undefined,\n fieldTypes?: DesignerComponentFieldTypeConfig,\n): DesignerFieldType {\n const currentType = field?.type as DesignerFieldType | undefined\n if (isFieldTypeLocked(field) && isDesignerFieldType(currentType)) {\n return currentType\n }\n const allowed = getComponentFieldConfig(node.component, fieldTypes).allowedTypes\n return currentType && allowed.includes(currentType)\n ? currentType\n : defaultFieldTypeForComponent(node.component, fieldTypes)\n}\n\nfunction textLike(component: string): ComponentFieldConfig {\n return { component, defaultType: 'string', allowedTypes: ['string'], multiple: 'single' }\n}\n\nfunction scalarChoice(component: string, multiple: DesignerMultiplePolicy = 'single'): ComponentFieldConfig {\n return { component, defaultType: 'string', allowedTypes: ['string', 'number'], multiple }\n}\n\n/** 收窄设计器支持的字段类型,外部协议值必须通过该判断后才能进入类型选项。 */\nexport function isDesignerFieldType(value: unknown): value is DesignerFieldType {\n return designerFieldTypeOptions.some((item) => item.value === value)\n}\n","import type { ResourceField, SchemaResource, ViewNode } from '@sparqjs/schema-protocol'\nimport { getComponentFieldConfig } from './component-config'\nimport { cloneNode } from './tree'\n\n/** 返回 schema 当前字段数组;未配置 fields 时返回空数组但不修改原 schema。 */\nexport function getFields(schema: SchemaResource): ResourceField[] {\n return schema.schema.fields ?? []\n}\n\n/** 复制节点树及其引用字段,清除后端标识并重写所有字段引用。 */\nexport function cloneNodeWithFields(schema: SchemaResource, node: ViewNode): ViewNode {\n const nextNode = cloneNode(node)\n const fieldMap = new Map<string, string>()\n duplicateNodeFields(schema, nextNode, fieldMap)\n return nextNode\n}\n\n/** 根据字段类型和展示组件生成新字段的最小业务默认值。 */\nexport function createFieldDefaults(type: string, component?: string): Partial<ResourceField> {\n const defaults: Partial<ResourceField> = { persisted: true }\n\n if (getComponentFieldConfig(component ?? type).multiple === 'multiple') {\n defaults.multiple = true\n }\n\n switch (component ?? type) {\n case 'text':\n defaults.validation = [{ type: 'max_length', value: 199 }]\n break\n case 'textarea':\n defaults.validation = [{ type: 'max_length', value: 255 }]\n break\n case 'color':\n defaults.validation = [{ type: 'format', value: 'color' }]\n break\n case 'checkbox':\n case 'multi-select':\n defaults.options = createStaticOptions()\n break\n case 'radio':\n case 'select':\n defaults.options = createStaticOptions()\n break\n case 'select-tree':\n case 'cascader':\n defaults.options = createNestedStaticOptions()\n break\n case 'date-range-picker':\n defaults.validation = [{ type: 'range', params: { ordered: true, span_unit: 'day' } }]\n break\n case 'time-range-picker':\n defaults.validation = [{ type: 'range', params: { ordered: true, span_unit: 'minute' } }]\n break\n }\n\n return defaults\n}\n\n/** 基于语义前缀生成 schema 内唯一字段名,不依赖可修改的字段标签。 */\nexport function createUniqueFieldName(schema: SchemaResource, type: string): string {\n const base = normalizeFieldName(type)\n const names = new Set(getFields(schema).map((field) => field.name))\n let index = 1\n let name = `${base}_${index}`\n\n while (names.has(name)) {\n index += 1\n name = `${base}_${index}`\n }\n\n return name\n}\n\nfunction duplicateNodeFields(schema: SchemaResource, node: ViewNode, fieldMap: Map<string, string>): void {\n if (node.field) {\n node.field = cloneField(schema, node.field, fieldMap)\n }\n\n node.children?.forEach((child) => duplicateNodeFields(schema, child, fieldMap))\n}\n\nfunction cloneField(schema: SchemaResource, fieldName: string, fieldMap: Map<string, string>): string {\n const mappedName = fieldMap.get(fieldName)\n if (mappedName) {\n return mappedName\n }\n\n const source = getFields(schema).find((field) => field.name === fieldName)\n const nextName = createUniqueFieldName(schema, source?.name ?? fieldName)\n\n if (source) {\n schema.schema.fields ??= []\n const nextField: ResourceField = {\n ...source,\n name: nextName,\n label: createCopiedFieldLabel(source.label),\n }\n\n delete nextField.id\n delete nextField.resource_id\n delete nextField.version_id\n delete nextField.created_at\n delete nextField.updated_at\n\n schema.schema.fields.push(nextField)\n }\n\n fieldMap.set(fieldName, nextName)\n return nextName\n}\n\nfunction createCopiedFieldLabel(label: string): string {\n return label.endsWith('副本') ? label : `${label}副本`\n}\n\nfunction normalizeFieldName(type: string): string {\n const normalized = type\n .replace(/[^a-zA-Z0-9]+/g, '_')\n .replace(/^_+|_+$/g, '')\n .toLowerCase()\n\n return normalized || 'field'\n}\n\nfunction createStaticOptions(): NonNullable<ResourceField['options']> {\n return {\n mode: 'static',\n value_policy: 'closed',\n items: [\n { label: '选项1', value: 'option_1' },\n { label: '选项2', value: 'option_2' },\n ],\n }\n}\n\nfunction createNestedStaticOptions(): NonNullable<ResourceField['options']> {\n return {\n mode: 'static',\n value_policy: 'closed',\n items: [\n {\n label: '一级分组 A',\n value: 'group_a',\n children: [\n { label: '子项 A-1', value: 'group_a_1' },\n { label: '子项 A-2', value: 'group_a_2' },\n ],\n },\n {\n label: '一级分组 B',\n value: 'group_b',\n children: [\n { label: '子项 B-1', value: 'group_b_1' },\n { label: '子项 B-2', value: 'group_b_2' },\n ],\n },\n ],\n }\n}\n","import type { ResourceField, SchemaResource, ViewNode } from '@sparqjs/schema-protocol'\nimport { defaultDesignerNodePermissions, type ResolvedDesignerNodePermissions } from '../extensions/instance'\nimport { canContainViewNode } from '../shared/view-node'\nimport type { DraftState } from './types'\nimport { getFields } from './field'\nimport { getFormChildren } from './form-view'\nimport { findNodeLocation, getNodeById } from './tree'\n\n/** 解析当前草稿中指定节点的完整权限;节点不存在时返回默认允许。 */\nexport function getDesignerNodePermissions(state: DraftState, nodeId: string): ResolvedDesignerNodePermissions {\n const location = findNodeLocation(getFormChildren(state.schema, state.viewName), nodeId)\n return location\n ? resolveDesignerNodePermissions(state, location.node, location.parentId)\n : defaultDesignerNodePermissions\n}\n\n/** 使用指定 schema 和父级解析节点权限,供插入、移动和 history 候选快照复用。 */\nexport function resolveDesignerNodePermissions(\n state: DraftState,\n node: ViewNode,\n parentId?: string,\n schema: SchemaResource = state.schema,\n fieldOverride?: ResourceField,\n): ResolvedDesignerNodePermissions {\n const policy = state.extensionContext?.nodePermissions\n if (!policy) {\n return defaultDesignerNodePermissions\n }\n\n const roots = getFormChildren(schema, state.viewName)\n return policy.resolve({\n node,\n parent: parentId ? getNodeById(roots, parentId) : undefined,\n field: fieldOverride ?? (node.field ? getFields(schema).find((field) => field.name === node.field) : undefined),\n schema,\n viewName: state.viewName,\n })\n}\n\n/** 判断节点权限是否允许指定直接父级;undefined 父级按表单根级 null 匹配。 */\nexport function canPlaceDesignerNode(\n state: DraftState,\n node: ViewNode,\n parentId?: string,\n schema: SchemaResource = state.schema,\n fieldOverride?: ResourceField,\n): boolean {\n const roots = getFormChildren(schema, state.viewName)\n const parent = parentId ? getNodeById(roots, parentId) : undefined\n if ((parentId && !parent) || !canContainViewNode(parent, node)) {\n return false\n }\n\n const allowed = resolveDesignerNodePermissions(state, node, parentId, schema, fieldOverride).allowedParentIds\n return allowed === undefined || allowed.includes(parentId ?? null)\n}\n\n/**\n * 验证 history 候选快照不会间接改动当前受保护节点。\n *\n * editable 保护节点自身属性和关联字段;movable 保护父级与同级索引;deletable\n * 保护节点存在性。新节点和父级变化还必须同时满足协议结构与宿主父级白名单。\n */\nexport function isDesignerHistorySnapshotAllowed(state: DraftState, candidate: SchemaResource): boolean {\n const currentRoots = getFormChildren(state.schema, state.viewName)\n const candidateRoots = getFormChildren(candidate, state.viewName)\n\n for (const current of flattenNodeLocations(currentRoots)) {\n const permissions = resolveDesignerNodePermissions(state, current.node, current.parentId)\n const next = current.node.id ? findNodeLocation(candidateRoots, current.node.id) : undefined\n if (!next) {\n if (!permissions.deletable) {\n return false\n }\n continue\n }\n\n if (!permissions.movable && (current.parentId !== next.parentId || current.index !== next.index)) {\n return false\n }\n if (!permissions.editable && !hasSameProtectedNodeValue(state.schema, current.node, candidate, next.node)) {\n return false\n }\n }\n\n return flattenNodeLocations(candidateRoots).every(({ node, parentId }) => {\n const current = node.id ? findNodeLocation(currentRoots, node.id) : undefined\n return current?.parentId === parentId || canPlaceDesignerNode(state, node, parentId, candidate)\n })\n}\n\nfunction flattenNodeLocations(\n nodes: ViewNode[],\n parentId?: string,\n): Array<{ node: ViewNode; parentId?: string; index: number }> {\n return nodes.flatMap((node, index) => [\n { node, parentId, index },\n ...flattenNodeLocations(node.children ?? [], node.id),\n ])\n}\n\nfunction hasSameProtectedNodeValue(\n currentSchema: SchemaResource,\n currentNode: ViewNode,\n candidateSchema: SchemaResource,\n candidateNode: ViewNode,\n): boolean {\n const { children: _currentChildren, ...currentValue } = currentNode\n const { children: _candidateChildren, ...candidateValue } = candidateNode\n if (JSON.stringify(currentValue) !== JSON.stringify(candidateValue)) {\n return false\n }\n\n if (!currentNode.field) {\n return true\n }\n const currentField = getFields(currentSchema).find((field) => field.name === currentNode.field)\n const candidateField = getFields(candidateSchema).find((field) => field.name === currentNode.field)\n return JSON.stringify(currentField) === JSON.stringify(candidateField)\n}\n","import type { SchemaResource } from '@sparqjs/schema-protocol'\nimport type { DraftState } from './types'\nimport { cloneSchema, prepareDraftSchema } from './schema'\nimport { isDesignerHistorySnapshotAllowed } from './node-permissions'\n\n/**\n * 执行一次设计器 schema 事务。\n *\n * 当前 schema 在事务中只读,可直接作为历史快照;修改始终发生在隔离的新草稿中。\n * 提交后清空 redo 队列,并确保新节点 ID 已准备完成。\n */\nexport function updateSchema(state: DraftState, mutate: (schema: SchemaResource) => void): void {\n const current = state.schema\n const next = prepareDraftSchema(state.schema, state.viewName)\n mutate(next)\n if (!isDesignerHistorySnapshotAllowed(state, next)) {\n return\n }\n\n state.history.push(current)\n state.future = []\n state.schema = next\n state.schemaVersion += 1\n}\n\n/** 恢复上一份 schema 快照,并把当前状态放入 redo 队列。 */\nexport function undo(state: DraftState): void {\n while (state.history.length) {\n const previous = state.history.pop()\n if (!previous || !isDesignerHistorySnapshotAllowed(state, previous)) {\n continue\n }\n\n state.future.push(state.schema)\n state.schema = previous\n state.schemaVersion += 1\n return\n }\n}\n\n/** 重新应用最近撤销的 schema 快照,并恢复对应 undo 历史。 */\nexport function redo(state: DraftState): void {\n while (state.future.length) {\n const next = state.future.pop()\n if (!next || !isDesignerHistorySnapshotAllowed(state, next)) {\n continue\n }\n\n state.history.push(state.schema)\n state.schema = next\n state.schemaVersion += 1\n return\n }\n}\n\n/** 回到最近保存成功的 schema,同时保留一次撤销机会。 */\nexport function restoreSaved(state: DraftState): void {\n if (state.savedSchema && isDesignerHistorySnapshotAllowed(state, state.savedSchema)) {\n state.history.push(state.schema)\n state.future = []\n state.schema = cloneSchema(state.savedSchema)\n state.schemaVersion += 1\n }\n}\n","import type { ActionRef, FormView } from '@sparqjs/schema-protocol'\nimport { setObjectPathValue } from '../shared/object-path'\nimport type { DraftState } from './types'\nimport { getFormView } from './form-view'\nimport { updateSchema } from './history'\n\n/** 合并更新当前 FormView 的顶层配置,并记录一次 history。 */\nexport function updateFormView(state: DraftState, patch: Partial<FormView>): void {\n updateSchema(state, (schema) => {\n Object.assign(getFormView(schema, state.viewName), patch)\n })\n}\n\n/** 用完整 FormView 替换当前视图,供属性面板批量写回使用。 */\nexport function replaceFormView(state: DraftState, form: FormView): void {\n updateSchema(state, (schema) => {\n schema.schema.views ??= {}\n if (!schema.schema.views.forms) {\n schema.schema.views.forms = {}\n }\n schema.schema.views.forms[state.viewName] = form\n })\n}\n\n/** 按对象路径更新 FormView;空路径会被忽略,避免意外替换整个视图。 */\nexport function updateFormViewAtPath(state: DraftState, path: string, value: unknown): void {\n if (!path) {\n return\n }\n\n updateSchema(state, (schema) => {\n const form = getFormView(schema, state.viewName)\n setObjectPathValue(form as Record<string, unknown>, path, value)\n })\n}\n\n/** 显示或关闭表单 footer;重新显示时恢复可编辑对象而不强行写入默认动作。 */\nexport function setFormFooterVisible(state: DraftState, visible: boolean): void {\n updateSchema(state, (schema) => {\n const form = getFormView(schema, state.viewName)\n if (!visible) {\n form.footer = false\n return\n }\n\n if (form.footer === false) {\n form.footer = {}\n }\n })\n}\n\n/** 更新指定 footer action 的标题,并清理空标题产生的冗余协议字段。 */\nexport function updateFormFooterActionTitle(state: DraftState, action: string, title: string | undefined): void {\n updateSchema(state, (schema) => {\n const form = getFormView(schema, state.viewName)\n if (form.footer === false) {\n form.footer = {}\n }\n\n const actions = ensureEditableFooterActions(form)\n const item = findOrCreateFooterAction(actions, action)\n item.title = title\n cleanupFooterActions(form, actions)\n })\n}\n\n/** 在 reset、cancel 和无次要动作之间切换,同时保留 submit 配置。 */\nexport function updateFormFooterSecondaryAction(state: DraftState, action: 'reset' | 'cancel' | 'none'): void {\n updateSchema(state, (schema) => {\n const form = getFormView(schema, state.viewName)\n const actions = ensureEditableFooterActions(form)\n const submit = actions.find((item) => item.action === 'submit')\n const secondary = actions.find((item) => item.action === 'reset' || item.action === 'cancel')\n const nextSecondary =\n action === 'none'\n ? undefined\n : {\n action,\n title: secondary?.action === action ? secondary.title : undefined,\n }\n\n const footer = ensureFooterObject(form)\n form.footer = {\n ...footer,\n actions: [submit ?? { action: 'submit' }, ...(nextSecondary ? [nextSecondary] : [])],\n }\n\n cleanupFooterActions(form, form.footer.actions ?? [])\n })\n}\n\n/** 解析 footer 实际展示的动作;未显式配置时返回 submit 与 reset 默认组合。 */\nexport function getEffectiveFormFooterActions(form: FormView): ActionRef[] {\n if (form.footer === false) {\n return []\n }\n\n if (form.footer?.actions?.length) {\n return form.footer.actions.map((item) => ({ ...item }))\n }\n\n return [{ action: 'submit' }, { action: 'reset' }]\n}\n\nfunction ensureEditableFooterActions(form: FormView): ActionRef[] {\n const footer = ensureFooterObject(form)\n const actions = footer.actions?.length\n ? footer.actions.map((item: ActionRef) => ({ ...item }))\n : getEffectiveFormFooterActions(form)\n form.footer = { ...footer, actions }\n return actions\n}\n\nfunction findOrCreateFooterAction(actions: ActionRef[], action: string): ActionRef {\n const existing = actions.find((item) => item.action === action)\n if (existing) {\n return existing\n }\n\n const next: ActionRef = { action }\n actions.push(next)\n return next\n}\n\nfunction cleanupFooterActions(form: FormView, actions: ActionRef[]): void {\n for (const item of actions) {\n if (item.title === undefined || item.title === '') {\n delete item.title\n }\n }\n\n if (form.footer === false) {\n return\n }\n\n if (!actions.length) {\n const footer = ensureFooterObject(form)\n delete footer.actions\n }\n}\n\nfunction ensureFooterObject(form: FormView): NonNullable<Exclude<FormView['footer'], false>> {\n if (form.footer === false || !form.footer) {\n form.footer = {}\n }\n\n return form.footer\n}\n","import { evaluateCondition, type ExpressionContext } from '@sparqjs/schema-core'\nimport type { ViewNode } from '@sparqjs/schema-protocol'\nimport type { DraftState } from './types'\nimport { getFormChildren } from './form-view'\nimport { findNodeLocation } from './tree'\n\n/** 节点移动时评估 show_when 使用的运行时数据和可见性策略。 */\nexport interface NodeMoveContext {\n form?: Record<string, unknown>\n query?: Record<string, unknown>\n selection?: unknown[]\n respectVisibility?: boolean\n}\n\n/** 根据当前可见兄弟节点计算上下移动可用状态。 */\nexport function getNodeMoveAvailability(\n state: DraftState,\n nodeId: string,\n context: NodeMoveContext = {},\n): { canMoveUp: boolean; canMoveDown: boolean } {\n const location = findNodeLocation(getFormChildren(state.schema, state.viewName), nodeId)\n if (!location) {\n return {\n canMoveUp: false,\n canMoveDown: false,\n }\n }\n const visibleSiblings = getVisibleSiblings(location.siblings, context)\n const visibleIndex = visibleSiblings.findIndex((node) => node.id === nodeId)\n if (visibleIndex < 0) {\n return {\n canMoveUp: false,\n canMoveDown: false,\n }\n }\n\n return {\n canMoveUp: visibleIndex > 0,\n canMoveDown: visibleIndex < visibleSiblings.length - 1,\n }\n}\n\n/** 按 show_when 和当前表达式上下文过滤移动参照节点;可显式关闭可见性过滤。 */\nexport function getVisibleSiblings(siblings: ViewNode[], context: NodeMoveContext): ViewNode[] {\n if (context.respectVisibility === false) {\n return siblings\n }\n\n const expressionContext = createMoveExpressionContext(context)\n return siblings.filter((node) => evaluateCondition(node.show_when, expressionContext))\n}\n\nfunction createMoveExpressionContext(context: NodeMoveContext): ExpressionContext {\n return {\n form: context.form,\n query: context.query,\n selection: context.selection,\n }\n}\n","import type { ResourceField, ViewNode } from '@sparqjs/schema-protocol'\nimport type { DesignerMaterial } from '../extensions/material'\nimport { cloneSerializable } from '../shared/clone'\nimport type { DraftState } from './types'\nimport {\n defaultFieldTypeForComponent,\n defaultNodePropsForComponent,\n getComponentFieldConfig,\n isDesignerFieldType,\n} from './component-config'\nimport { getFields, createFieldDefaults, createUniqueFieldName, cloneNodeWithFields } from './field'\nimport { getFormChildren } from './form-view'\nimport { updateSchema } from './history'\nimport { clampIndex, findNodeLocation, getNodeById, getNodeChildren, isDescendantNode, prepareNode } from './tree'\nimport { getVisibleSiblings, type NodeMoveContext } from './visibility'\nimport { canPlaceDesignerNode, getDesignerNodePermissions } from './node-permissions'\n\n/** 从组件面板创建字段节点时所需的最小输入。 */\nexport interface GeneratedFieldInput {\n component?: string\n label: string\n nameBase?: string\n type: string\n}\n\n/** 将设计器选区切换到指定节点 ID;后续属性命令和工具栏操作都以该选区为目标。 */\nexport function selectNode(state: DraftState, path: string): boolean {\n if (!getDesignerNodePermissions(state, path).selectable) {\n return false\n }\n state.selection = { type: 'form-node', path }\n return true\n}\n\n/** 从当前表单树解析选中节点;字段选区或视图选区不会被误当成表单节点。 */\nexport function getSelectedNode(state: DraftState): ViewNode | undefined {\n if (state.selection?.type !== 'form-node') {\n return undefined\n }\n\n return getNodeById(getFormChildren(state.schema, state.viewName), state.selection.path)\n}\n\n/** 在表单根级插入已有节点,并作为一次可撤销事务选中新节点。 */\nexport function insertNodeAt(state: DraftState, node: ViewNode, index: number): void {\n insertNodeInto(state, undefined, node, index)\n}\n\n/** 向指定容器插入节点;父节点不存在时不产生选区变化。 */\nexport function insertNodeInto(state: DraftState, parentId: string | undefined, node: ViewNode, index: number): void {\n const nextNode = prepareNode(node)\n if (!canPlaceDesignerNode(state, nextNode, parentId)) {\n return\n }\n let inserted = false\n\n updateSchema(state, (schema) => {\n const children = getNodeChildren(schema, state.viewName, parentId)\n if (!children) {\n return\n }\n children.splice(clampIndex(index, children.length), 0, nextNode)\n inserted = true\n })\n if (inserted) {\n state.selection = { type: 'form-node', path: nextNode.id as string }\n }\n}\n\n/** 在表单根级同时创建字段协议和字段节点,确保二者名称与默认类型保持一致。 */\nexport function insertGeneratedFieldNodeAt(state: DraftState, input: GeneratedFieldInput, index: number): void {\n insertGeneratedFieldNodeInto(state, undefined, input, index)\n}\n\n/**\n * 向指定容器创建字段节点。\n *\n * 字段定义和 ViewNode 在同一次 history 事务中写入,避免撤销后只剩其中一部分。\n */\nexport function insertGeneratedFieldNodeInto(\n state: DraftState,\n parentId: string | undefined,\n input: GeneratedFieldInput,\n index: number,\n): void {\n const fieldName = createUniqueFieldName(state.schema, input.nameBase ?? input.component ?? input.type)\n const fieldType = normalizeGeneratedFieldType(input)\n const nextNode = prepareNode({\n type: 'field',\n field: fieldName,\n component: input.component,\n props: defaultNodePropsForComponent(input.component),\n })\n const nextField: ResourceField = {\n name: fieldName,\n label: input.label,\n type: fieldType,\n formable: true,\n listable: false,\n ...createFieldDefaults(fieldType, input.component),\n }\n if (!canPlaceDesignerNode(state, nextNode, parentId, state.schema, nextField)) {\n return\n }\n let inserted = false\n\n updateSchema(state, (schema) => {\n schema.schema.fields ??= []\n schema.schema.fields.push(nextField)\n const children = getNodeChildren(schema, state.viewName, parentId)\n if (!children) {\n return\n }\n children.splice(clampIndex(index, children.length), 0, nextNode)\n inserted = true\n })\n if (inserted) {\n state.selection = { type: 'form-node', path: nextNode.id as string }\n }\n}\n\n/**\n * 把实例物料创建的字段和节点作为一次 schema 事务插入目标容器。\n *\n * 插件工厂输出会在 history 变更前完成协议校验;无效输出不会留下字段、节点或撤销记录。\n */\nexport function insertDesignerMaterialInto(\n state: DraftState,\n parentId: string | undefined,\n material: DesignerMaterial,\n index: number,\n): void {\n if (state.extensionContext && !state.extensionContext.getMaterial(material.key)) {\n throw new Error(`设计器物料 ${material.key} 不在当前实例的可见范围内`)\n }\n validateMaterialTarget(state, parentId, material.key)\n\n const existingFieldNames = new Set(getFields(state.schema).map((field) => field.name))\n let nextField: ResourceField | undefined\n let nextNode: ViewNode\n\n if (material.kind === 'field') {\n const fieldName = createUniqueFieldName(state.schema, material.fieldNameBase)\n const result = material.create({ fieldName }) as { field?: ResourceField; node?: ViewNode }\n if (!result?.field || !result.node) {\n throw new Error(`设计器物料 ${material.key} 必须同时返回字段和节点`)\n }\n nextField = cloneSerializable(result.field)\n nextNode = cloneSerializable(result.node)\n validateCreatedField(material.key, nextField, nextNode, fieldName, existingFieldNames)\n } else {\n const result = material.create({}) as { node?: ViewNode; field?: unknown }\n if (!result || typeof result !== 'object') {\n throw new Error(`设计器物料 ${material.key} 没有返回有效结果`)\n }\n if (result.field !== undefined) {\n throw new Error(`设计器物料 ${material.key} 不能通过节点物料创建字段`)\n }\n if (!result.node) {\n throw new Error(`设计器物料 ${material.key} 没有返回节点`)\n }\n nextNode = cloneSerializable(result.node)\n }\n\n validateMaterialNode(material.key, nextNode, existingFieldNames, nextField?.name)\n const preparedNode = prepareNode(nextNode)\n if (!canPlaceDesignerNode(state, preparedNode, parentId, state.schema, nextField)) {\n throw new Error(`设计器物料 ${material.key} 不能插入目标容器`)\n }\n\n updateSchema(state, (schema) => {\n const children = getNodeChildren(schema, state.viewName, parentId)\n if (!children) {\n return\n }\n if (nextField) {\n schema.schema.fields ??= []\n schema.schema.fields.push(nextField)\n }\n children.splice(clampIndex(index, children.length), 0, preparedNode)\n })\n state.selection = { type: 'form-node', path: preparedNode.id as string }\n}\n\nconst materialNodeTypes = new Set([\n 'field',\n 'group',\n 'section',\n 'card',\n 'collapse',\n 'collapse-item',\n 'grid',\n 'row',\n 'col',\n 'tabs',\n 'tab',\n 'divider',\n 'custom',\n 'view',\n])\n\nconst materialRootNodeTypes = new Set([\n 'field',\n 'group',\n 'section',\n 'card',\n 'collapse',\n 'grid',\n 'row',\n 'col',\n 'tabs',\n 'divider',\n 'custom',\n 'view',\n])\n\nconst materialContainerNodeTypes = new Set([\n 'group',\n 'section',\n 'card',\n 'collapse',\n 'collapse-item',\n 'grid',\n 'row',\n 'col',\n 'tabs',\n 'tab',\n 'custom',\n])\n\nfunction validateMaterialTarget(state: DraftState, parentId: string | undefined, materialKey: string): void {\n if (!parentId) {\n return\n }\n const parent = getNodeById(getFormChildren(state.schema, state.viewName), parentId)\n if (!parent) {\n throw new Error(`设计器物料 ${materialKey} 的目标容器 ${parentId} 不存在`)\n }\n if (!materialContainerNodeTypes.has(parent.type)) {\n throw new Error(`设计器物料 ${materialKey} 不能插入 ${parent.type} 节点`)\n }\n}\n\nfunction validateCreatedField(\n materialKey: string,\n field: ResourceField,\n node: ViewNode,\n expectedName: string,\n existingFieldNames: Set<string>,\n): void {\n if (!field || typeof field !== 'object') {\n throw new Error(`设计器物料 ${materialKey} 没有返回有效字段`)\n }\n if (typeof field.name !== 'string' || !field.name.trim()) {\n throw new Error(`设计器物料 ${materialKey} 返回的字段名不能为空`)\n }\n if (field.name !== expectedName || node?.field !== expectedName) {\n throw new Error(`设计器物料 ${materialKey} 返回的字段名与节点引用必须等于 ${expectedName}`)\n }\n if (existingFieldNames.has(field.name)) {\n throw new Error(`设计器物料 ${materialKey} 返回了重复字段名 ${field.name}`)\n }\n if (\n typeof field.type !== 'string' ||\n !field.type.trim() ||\n typeof field.label !== 'string' ||\n !field.label.trim()\n ) {\n throw new Error(`设计器物料 ${materialKey} 返回的字段必须包含 type 和 label`)\n }\n}\n\nfunction validateMaterialNode(\n materialKey: string,\n node: ViewNode,\n existingFieldNames: Set<string>,\n createdFieldName?: string,\n): void {\n if (!node || typeof node !== 'object' || !materialRootNodeTypes.has(node.type)) {\n throw new Error(`设计器物料 ${materialKey} 返回了无效的根节点类型`)\n }\n validateNodeTree(materialKey, node, existingFieldNames, createdFieldName)\n}\n\nfunction validateNodeTree(\n materialKey: string,\n node: ViewNode,\n existingFieldNames: Set<string>,\n createdFieldName?: string,\n): void {\n if (!materialNodeTypes.has(node.type)) {\n throw new Error(`设计器物料 ${materialKey} 返回了无效节点类型 ${String(node.type)}`)\n }\n if (node.component !== undefined && (typeof node.component !== 'string' || !node.component.trim())) {\n throw new Error(`设计器物料 ${materialKey} 返回了空组件 key`)\n }\n if (node.field !== undefined) {\n if (typeof node.field !== 'string' || !node.field.trim()) {\n throw new Error(`设计器物料 ${materialKey} 返回了空字段引用`)\n }\n if (node.field !== createdFieldName && !existingFieldNames.has(node.field)) {\n throw new Error(`设计器物料 ${materialKey} 引用了不存在的字段 ${node.field}`)\n }\n }\n if (node.children !== undefined && !Array.isArray(node.children)) {\n throw new Error(`设计器物料 ${materialKey} 返回的 children 必须是节点数组`)\n }\n node.children?.forEach((child) => validateNodeTree(materialKey, child, existingFieldNames, createdFieldName))\n}\n\nfunction normalizeGeneratedFieldType(input: GeneratedFieldInput): string {\n const component = input.component ?? input.type\n const config = getComponentFieldConfig(component)\n return isDesignerFieldType(input.type) && config.allowedTypes.includes(input.type)\n ? input.type\n : defaultFieldTypeForComponent(component)\n}\n\n/** 调整表单根节点顺序,并把选区跟随到移动后的节点。 */\nexport function moveNode(state: DraftState, fromIndex: number, toIndex: number): void {\n if (fromIndex === toIndex) {\n return\n }\n\n const node = getFormChildren(state.schema, state.viewName)[fromIndex]\n if (!node?.id || !getDesignerNodePermissions(state, node.id).movable || !canPlaceDesignerNode(state, node)) {\n return\n }\n\n updateSchema(state, (schema) => {\n const children = getFormChildren(schema, state.viewName)\n const [node] = children.splice(fromIndex, 1)\n if (!node) {\n return\n }\n children.splice(clampIndex(toIndex, children.length), 0, node)\n })\n const children = getFormChildren(state.schema, state.viewName)\n const moved = children[clampIndex(toIndex, children.length - 1)]\n state.selection = moved?.id ? { type: 'form-node', path: moved.id } : undefined\n}\n\n/**\n * 将节点移动到目标父级和位置。\n *\n * 该操作拒绝移入自身后代;目标容器失效时会把已取出的节点放回原位。\n */\nexport function moveNodeToParent(\n state: DraftState,\n nodeId: string,\n targetParentId: string | undefined,\n targetIndex: number,\n options: { adjustSameParentIndex?: boolean } = {},\n): void {\n const currentLocation = findNodeLocation(getFormChildren(state.schema, state.viewName), nodeId)\n if (\n !currentLocation ||\n !getDesignerNodePermissions(state, nodeId).movable ||\n !canPlaceDesignerNode(state, currentLocation.node, targetParentId)\n ) {\n return\n }\n\n updateSchema(state, (schema) => {\n const source = findNodeLocation(getFormChildren(schema, state.viewName), nodeId)\n if (!source) {\n return\n }\n if (targetParentId && isDescendantNode(source.node, targetParentId)) {\n return\n }\n\n const [node] = source.siblings.splice(source.index, 1)\n if (!node) {\n return\n }\n\n const targetChildren = getNodeChildren(schema, state.viewName, targetParentId)\n if (!targetChildren) {\n source.siblings.splice(source.index, 0, node)\n return\n }\n const adjustedIndex =\n options.adjustSameParentIndex !== false && source.siblings === targetChildren && source.index < targetIndex\n ? targetIndex - 1\n : targetIndex\n targetChildren.splice(clampIndex(adjustedIndex, targetChildren.length), 0, node)\n })\n state.selection = { type: 'form-node', path: nodeId }\n}\n\n/** 把节点追加到目标容器末尾,目标不存在时保持 schema 不变。 */\nexport function moveNodeIntoParentEnd(state: DraftState, nodeId: string, targetParentId: string): void {\n const target = getNodeById(getFormChildren(state.schema, state.viewName), targetParentId)\n if (!target) {\n return\n }\n\n moveNodeToParent(state, nodeId, targetParentId, target.children?.length ?? 0)\n}\n\n/** 将节点移到当前父容器之后,用于资源树中的“移出一层”。 */\nexport function moveNodeOutOfParent(state: DraftState, nodeId: string): void {\n const location = findNodeLocation(getFormChildren(state.schema, state.viewName), nodeId)\n if (!location?.parentId) {\n return\n }\n\n const parentLocation = findNodeLocation(getFormChildren(state.schema, state.viewName), location.parentId)\n if (!parentLocation) {\n return\n }\n\n moveNodeToParent(state, nodeId, parentLocation.parentId, parentLocation.index + 1)\n}\n\n/** 删除当前选中节点并记录 history;字段定义不会随视图节点删除。 */\nexport function removeSelectedNode(state: DraftState): void {\n if (state.selection?.type !== 'form-node') {\n return\n }\n\n const selectedId = state.selection.path\n const location = findNodeLocation(getFormChildren(state.schema, state.viewName), selectedId)\n if (!location || !getDesignerNodePermissions(state, selectedId).deletable) {\n return\n }\n updateSchema(state, (schema) => {\n const nextLocation = findNodeLocation(\n getFormChildren(schema, state.viewName),\n state.selection?.type === 'form-node' ? state.selection.path : '',\n )\n nextLocation?.siblings.splice(nextLocation.index, 1)\n })\n state.selection = undefined\n}\n\n/** 复制选中节点及其引用字段,生成独立字段名和节点 ID 后插入原节点之后。 */\nexport function copySelectedNode(state: DraftState): void {\n if (state.selection?.type !== 'form-node') {\n return\n }\n\n const selectedId = state.selection.path\n const location = findNodeLocation(getFormChildren(state.schema, state.viewName), selectedId)\n if (\n !location ||\n !getDesignerNodePermissions(state, selectedId).copyable ||\n !canPlaceDesignerNode(state, location.node, location.parentId)\n ) {\n return\n }\n\n const targetIndex = clampIndex(location.index + 1, location.siblings.length)\n let nextNodeId: string | undefined\n\n updateSchema(state, (schema) => {\n const nextLocation = findNodeLocation(\n getFormChildren(schema, state.viewName),\n state.selection?.type === 'form-node' ? state.selection.path : '',\n )\n if (!nextLocation) {\n return\n }\n const nextNode = cloneNodeWithFields(schema, nextLocation.node)\n nextLocation.siblings.splice(targetIndex, 0, nextNode)\n nextNodeId = nextNode.id\n })\n if (nextNodeId) {\n state.selection = { type: 'form-node', path: nextNodeId }\n }\n}\n\n/** 在当前可见兄弟节点中上移或下移选中节点,隐藏节点不会改变用户看到的移动步长。 */\nexport function moveSelectedNode(state: DraftState, direction: -1 | 1, context: NodeMoveContext = {}): void {\n if (state.selection?.type !== 'form-node') {\n return\n }\n\n const selectedId = state.selection.path\n const location = findNodeLocation(getFormChildren(state.schema, state.viewName), selectedId)\n if (!location) {\n return\n }\n const visibleSiblings = getVisibleSiblings(location.siblings, context)\n const visibleIndex = visibleSiblings.findIndex((node) => node.id === selectedId)\n const target = visibleSiblings[visibleIndex + direction]\n if (visibleIndex < 0 || !target?.id) {\n return\n }\n\n const targetLocation = findNodeLocation(getFormChildren(state.schema, state.viewName), target.id)\n if (!targetLocation || targetLocation.siblings !== location.siblings) {\n return\n }\n const targetIndex = direction > 0 ? targetLocation.index + 1 : targetLocation.index\n moveNodeToParent(state, selectedId, location.parentId, targetIndex)\n}\n\n/** 合并更新选中 ViewNode,并通过统一 schema 事务记录撤销历史。 */\nexport function updateSelectedNode(state: DraftState, patch: Partial<ViewNode>): void {\n if (state.selection?.type !== 'form-node') {\n return\n }\n\n const path = state.selection.path\n if (!getDesignerNodePermissions(state, path).editable) {\n return\n }\n updateSchema(state, (schema) => {\n const node = getNodeById(getFormChildren(schema, state.viewName), path)\n if (node) {\n Object.assign(node, patch)\n }\n })\n}\n\n/**\n * 原子替换选中节点及其字段定义。\n *\n * 组件迁移使用该入口保证节点协议和 ResourceField 不会被拆成两条 history。\n */\nexport function replaceSelectedNodeAndField(state: DraftState, nextNode: ViewNode, nextField?: ResourceField): void {\n if (state.selection?.type !== 'form-node') {\n return\n }\n\n const selectedId = state.selection.path\n if (!getDesignerNodePermissions(state, selectedId).editable) {\n return\n }\n const fieldName = getSelectedNode(state)?.field\n\n updateSchema(state, (schema) => {\n const node = getNodeById(getFormChildren(schema, state.viewName), selectedId)\n if (node) {\n const id = node.id\n Object.keys(node).forEach((key) => {\n delete (node as unknown as Record<string, unknown>)[key]\n })\n Object.assign(node, nextNode, { id })\n }\n\n if (fieldName && nextField) {\n const field = getFields(schema).find((item) => item.name === fieldName)\n if (field) {\n Object.keys(field).forEach((key) => {\n delete (field as unknown as Record<string, unknown>)[key]\n })\n Object.assign(field, nextField)\n }\n }\n })\n}\n\n/** 根据选中字段节点的 field 引用解析 ResourceField。 */\nexport function getSelectedField(state: DraftState): ResourceField | undefined {\n const node = getSelectedNode(state)\n if (!node?.field) {\n return undefined\n }\n return getFields(state.schema).find((field) => field.name === node.field)\n}\n\n/** 合并更新选中节点对应的字段定义,并记录一次可撤销事务。 */\nexport function updateSelectedField(state: DraftState, patch: Partial<ResourceField>): void {\n const selected = getSelectedField(state)\n const selectedNode = getSelectedNode(state)\n if (!selected || !selectedNode?.id || !getDesignerNodePermissions(state, selectedNode.id).editable) {\n return\n }\n\n updateSchema(state, (schema) => {\n const field = getFields(schema).find((item) => item.name === selected.name)\n if (field) {\n Object.assign(field, patch)\n }\n })\n}\n","/** 贡献来源层级。层级决定覆盖顺序,priority 只能在同层级内调整顺序。 */\nexport type ContributionLayer = 'builtin' | 'plugin' | 'host' | 'local'\n\n/**\n * 领域声明的强类型贡献点。\n *\n * key 必须在整个前端应用中稳定且唯一;泛型只约束该贡献点允许安装和读取的 value 类型。\n */\nexport interface ContributionPoint<T> {\n /** 贡献点稳定标识,例如 designer.capability-cards。 */\n readonly key: string\n /** 仅用于保留泛型关系,不会写入运行时对象。 */\n readonly __value?: T\n}\n\n/** 单个贡献项。同一贡献点内使用 key 参与覆盖和恢复。 */\nexport interface ContributionInput<T> {\n /** 领域内稳定标识,例如组件名或 capability key。 */\n key: string\n /** 由领域注册表解释的贡献内容。 */\n value: T\n /** 同层级内的解析优先级,数值更大的贡献生效。 */\n priority?: number\n}\n\n/** 同一贡献点、同一来源层级的一组贡献。 */\nexport interface ContributionSet<T> {\n point: ContributionPoint<T>\n entries: readonly ContributionInput<T>[]\n /** 默认按 plugin 层安装,宿主和内置能力必须显式声明自己的层级。 */\n layer?: ContributionLayer\n}\n\n/**\n * 一个 owner 的原子安装单元。\n *\n * 插件可以在一个 bundle 中贡献多个领域;卸载 handle 时这些内容会一起移除,避免部分残留。\n */\nexport interface ContributionBundle {\n /** 贡献来源稳定标识,用于冲突诊断和插件卸载定位。 */\n owner: string\n contributions: readonly ContributionSet<unknown>[]\n}\n\n/** registry 对外暴露的当前生效项,保留来源信息供诊断和管理界面使用。 */\nexport interface ResolvedContribution<T> {\n point: string\n key: string\n owner: string\n layer: ContributionLayer\n priority: number\n value: T\n}\n\n/** 重复贡献诊断。覆盖仍会生效,但宿主可以向开发者展示冲突来源。 */\nexport interface ContributionDiagnostic {\n code: 'duplicate-contribution'\n point: string\n key: string\n owners: string[]\n activeOwner: string\n message: string\n}\n\n/** 安装结果。dispose 可重复调用,并会恢复仍然有效的上一层贡献。 */\nexport interface ContributionHandle {\n dispose(): void\n}\n\n/** 单个贡献点的只读解析入口。 */\nexport interface ContributionRegistry<T> {\n /** 获取当前生效 value,不暴露被覆盖的内部注册栈。 */\n get(key: string): T | undefined\n /** 判断指定 key 当前是否存在生效贡献。 */\n has(key: string): boolean\n /** 按贡献首次安装顺序返回当前生效项,领域需要其他顺序时自行排序。 */\n entries(): readonly ResolvedContribution<T>[]\n /**\n * 按层级、同层优先级和安装时间查找第一个匹配项。\n *\n * matcher 只负责领域判断;Kernel 负责统一选择顺序,适用于资源预览等多个不同 key 都可能匹配的贡献点。\n */\n find(matcher: (entry: ResolvedContribution<T>) => boolean): ResolvedContribution<T> | undefined\n /** 返回当前贡献点内的重复 key,不把正常覆盖静默隐藏。 */\n diagnostics(): readonly ContributionDiagnostic[]\n /** 监听当前贡献点的安装和卸载;返回函数取消监听,取消后不会再接收通知。 */\n subscribe(listener: () => void): () => void\n}\n\n/** 一个应用或领域实例的贡献运行环境,不使用模块级全局状态。 */\nexport interface FrontendKernel {\n /** 原子安装 bundle,并返回控制本次安装生命周期的 handle。 */\n install(bundle: ContributionBundle): ContributionHandle\n /** 获取贡献点的稳定 registry facade;同一 kernel 内重复调用会返回同一对象。 */\n registry<T>(point: ContributionPoint<T>): ContributionRegistry<T>\n}\n\n/** 创建贡献运行环境时的宿主级错误处理配置。 */\nexport interface CreateFrontendKernelOptions {\n /**\n * 接收 registry 订阅者抛出的异常。\n *\n * 订阅者只观察解析结果,不能阻断已经完成的贡献安装或卸载;该回调自身的异常也会被隔离。\n */\n onSubscriberError?: (error: unknown) => void\n}\n\ninterface StoredContribution {\n id: symbol\n sequence: number\n point: string\n key: string\n owner: string\n layer: ContributionLayer\n priority: number\n value: unknown\n}\n\nconst layerWeights: Record<ContributionLayer, number> = {\n builtin: 0,\n plugin: 100,\n host: 200,\n local: 300,\n}\n\n/**\n * 声明领域贡献点。\n *\n * 该函数只建立类型和稳定 key,不创建全局 registry;实际状态归属于 FrontendKernel 实例。\n */\nexport function defineContributionPoint<T>(key: string): ContributionPoint<T> {\n requireIdentifier(key, '贡献点 key')\n return Object.freeze({ key })\n}\n\n/** 创建类型安全的贡献集合,供 ContributionBundle 组合多个领域贡献。 */\nexport function defineContributionSet<T>(\n point: ContributionPoint<T>,\n entries: readonly ContributionInput<T>[],\n layer: ContributionLayer = 'plugin',\n): ContributionSet<T> {\n return { point, entries, layer }\n}\n\n/**\n * 创建隔离的前端贡献运行环境。\n *\n * 注册、订阅和卸载都只影响当前实例,适用于 Admin 应用、设计器实例和测试隔离。\n */\nexport function createFrontendKernel(options: CreateFrontendKernelOptions = {}): FrontendKernel {\n const registrations = new Map<string, Map<string, StoredContribution[]>>()\n const listeners = new Map<string, Set<() => void>>()\n const registries = new Map<string, ContributionRegistry<unknown>>()\n let sequence = 0\n\n function install(bundle: ContributionBundle): ContributionHandle {\n requireIdentifier(bundle.owner, '贡献 owner')\n const pending = bundle.contributions.flatMap((set) => {\n requireIdentifier(set.point.key, '贡献点 key')\n return set.entries.map((entry) => {\n requireIdentifier(entry.key, `贡献点 ${set.point.key} 的条目 key`)\n return {\n id: Symbol(`${bundle.owner}:${set.point.key}:${entry.key}`),\n sequence: sequence++,\n point: set.point.key,\n key: entry.key,\n owner: bundle.owner,\n layer: set.layer ?? 'plugin',\n priority: entry.priority ?? 0,\n value: entry.value,\n } satisfies StoredContribution\n })\n })\n const affectedPoints = new Set(pending.map((entry) => entry.point))\n\n for (const entry of pending) {\n const point = registrations.get(entry.point) ?? new Map<string, StoredContribution[]>()\n const entries = point.get(entry.key) ?? []\n entries.push(entry)\n point.set(entry.key, entries)\n registrations.set(entry.point, point)\n }\n notify(affectedPoints)\n\n let disposed = false\n return {\n dispose() {\n if (disposed) {\n return\n }\n disposed = true\n const ids = new Set(pending.map((entry) => entry.id))\n for (const pointKey of affectedPoints) {\n const point = registrations.get(pointKey)\n if (!point) {\n continue\n }\n for (const [entryKey, entries] of point) {\n const next = entries.filter((entry) => !ids.has(entry.id))\n if (next.length) {\n point.set(entryKey, next)\n } else {\n point.delete(entryKey)\n }\n }\n if (!point.size) {\n registrations.delete(pointKey)\n }\n }\n notify(affectedPoints)\n },\n }\n }\n\n function registry<T>(point: ContributionPoint<T>): ContributionRegistry<T> {\n const existing = registries.get(point.key)\n if (existing) {\n return existing as ContributionRegistry<T>\n }\n\n const resolved: ContributionRegistry<T> = {\n get(key) {\n return activeEntry(point.key, key)?.value as T | undefined\n },\n has(key) {\n return activeEntry(point.key, key) !== undefined\n },\n entries() {\n const stored = registrations.get(point.key)\n if (!stored) {\n return []\n }\n return [...stored.entries()]\n .map(([, entries]) => resolveActiveEntry(entries))\n .filter((entry): entry is StoredContribution => entry !== undefined)\n .map((entry) => toResolvedContribution<T>(entry))\n },\n find(matcher) {\n const stored = registrations.get(point.key)\n if (!stored) {\n return undefined\n }\n const candidates = [...stored.values()]\n .map((entries) => resolveActiveEntry(entries))\n .filter((entry): entry is StoredContribution => entry !== undefined)\n .sort(compareStoredContributionPrecedence)\n const matched = candidates.find((entry) => matcher(toResolvedContribution<T>(entry)))\n return matched ? toResolvedContribution<T>(matched) : undefined\n },\n diagnostics() {\n const stored = registrations.get(point.key)\n if (!stored) {\n return []\n }\n return [...stored.entries()].flatMap(([key, entries]) => {\n if (entries.length < 2) {\n return []\n }\n const active = resolveActiveEntry(entries)\n if (!active) {\n return []\n }\n const owners = [...new Set(entries.map((entry) => entry.owner))]\n return [\n {\n code: 'duplicate-contribution' as const,\n point: point.key,\n key,\n owners,\n activeOwner: active.owner,\n message: `贡献点 ${point.key} 的 ${key} 由 ${owners.join('、')} 重复提供,当前使用 ${active.owner}。`,\n },\n ]\n })\n },\n subscribe(listener) {\n const pointListeners = listeners.get(point.key) ?? new Set<() => void>()\n pointListeners.add(listener)\n listeners.set(point.key, pointListeners)\n return () => {\n pointListeners.delete(listener)\n if (!pointListeners.size) {\n listeners.delete(point.key)\n }\n }\n },\n }\n registries.set(point.key, resolved as ContributionRegistry<unknown>)\n return resolved\n }\n\n function activeEntry(point: string, key: string): StoredContribution | undefined {\n return resolveActiveEntry(registrations.get(point)?.get(key) ?? [])\n }\n\n function notify(points: Iterable<string>): void {\n for (const point of points) {\n for (const listener of listeners.get(point) ?? []) {\n try {\n listener()\n } catch (error) {\n reportSubscriberError(error)\n }\n }\n }\n }\n\n function reportSubscriberError(error: unknown): void {\n try {\n options.onSubscriberError?.(error)\n } catch {\n // 错误报告属于观察行为,不能反向破坏已经完成的贡献状态变更。\n }\n }\n\n return { install, registry }\n}\n\nfunction resolveActiveEntry(entries: readonly StoredContribution[]): StoredContribution | undefined {\n return entries.reduce<StoredContribution | undefined>((active, entry) => {\n if (!active) {\n return entry\n }\n const activeLayer = layerWeights[active.layer]\n const entryLayer = layerWeights[entry.layer]\n if (entryLayer !== activeLayer) {\n return entryLayer > activeLayer ? entry : active\n }\n if (entry.priority !== active.priority) {\n return entry.priority > active.priority ? entry : active\n }\n return entry.sequence > active.sequence ? entry : active\n }, undefined)\n}\n\nfunction compareStoredContributionPrecedence(left: StoredContribution, right: StoredContribution): number {\n const layer = layerWeights[right.layer] - layerWeights[left.layer]\n if (layer !== 0) {\n return layer\n }\n const priority = right.priority - left.priority\n if (priority !== 0) {\n return priority\n }\n return right.sequence - left.sequence\n}\n\nfunction toResolvedContribution<T>(entry: StoredContribution): ResolvedContribution<T> {\n return {\n point: entry.point,\n key: entry.key,\n owner: entry.owner,\n layer: entry.layer,\n priority: entry.priority,\n value: entry.value as T,\n }\n}\n\nfunction requireIdentifier(value: string, label: string): void {\n if (!value) {\n throw new Error(`${label} 不能为空`)\n }\n}\n","/**\n * 设计器能力卡片 key。\n *\n * 这些 key 是右侧“字段能力”中复杂配置入口的稳定标识,只用于 DesignerExtensionContext 和\n * 外部组件声明能力;业务 schema 不会写入这些 key,最终仍写回各自 affectedPaths。\n */\nexport const designerCapabilityCardKeys = {\n valueStrategy: 'value-strategy',\n validationRules: 'validation-rules',\n optionSource: 'option-source',\n interactionRules: 'interaction-rules',\n uploadSettings: 'upload-settings',\n richTextSettings: 'rich-text-settings',\n inputSlots: 'input-slots',\n colorPalette: 'color-palette',\n advancedConfig: 'advanced-config',\n} as const\n\n/** 能力卡领域稳定标识;内置 key 有常量,插件可使用命名空间字符串。 */\nexport type DesignerCapabilityCardKey = string\n","import {\n isConditionOperator,\n type Condition,\n type ConditionOperator,\n type ResourceField,\n type ViewNode,\n} from '@sparqjs/schema-protocol'\n\n/** 设计器允许在交互规则中编辑的节点条件字段。 */\nexport type DesignerConditionName = 'show_when' | 'disabled_when' | 'readonly_when'\n/** 可视模式处理常见规则,JSON 模式保留完整高级协议。 */\nexport type DesignerConditionMode = 'visual' | 'json'\n/** 条件组内子项的组合关系。 */\nexport type DesignerConditionGroupLogic = 'all' | 'any'\n\n/** 单类交互条件的标题和说明。 */\nexport interface DesignerConditionConfig {\n name: DesignerConditionName\n title: string\n description: string\n}\n\n/** 条件编辑器完整表单状态,同时保留可视树和 JSON 文本。 */\nexport interface ConditionEditorValues {\n mode: DesignerConditionMode\n json: string\n root: ConditionEditorGroupValues\n}\n\n/** 可视条件树中的单条字段判断。 */\nexport interface ConditionEditorRuleValues {\n kind: 'rule'\n field: string\n op: ConditionOperator\n value: string\n}\n\n/** 可视条件树中的嵌套 all/any 分组。 */\nexport interface ConditionEditorGroupValues {\n kind: 'group'\n logic: DesignerConditionGroupLogic\n items: ConditionEditorItemValues[]\n}\n\n/** 可视条件树允许递归包含规则或分组。 */\nexport type ConditionEditorItemValues = ConditionEditorRuleValues | ConditionEditorGroupValues\n\n/** 节点交互条件的标题和业务含义,决定能力编辑器展示顺序。 */\nexport const conditionConfigs: DesignerConditionConfig[] = [\n {\n name: 'show_when',\n title: '显示条件',\n description: '控制当前节点是否渲染。',\n },\n {\n name: 'disabled_when',\n title: '禁用条件',\n description: '条件成立时控件不可操作。',\n },\n {\n name: 'readonly_when',\n title: '只读条件',\n description: '条件成立时控件进入只读状态。',\n },\n]\n\n/** 可视条件编辑器支持的操作符;其他协议结构会进入 JSON 模式。 */\nexport const conditionOperatorOptions: Array<{ label: string; value: ConditionOperator }> = [\n { label: '等于', value: 'eq' },\n { label: '不等于', value: 'neq' },\n { label: '大于', value: 'gt' },\n { label: '大于等于', value: 'gte' },\n { label: '小于', value: 'lt' },\n { label: '小于等于', value: 'lte' },\n { label: '包含', value: 'contains' },\n { label: '等于任一值', value: 'in' },\n { label: '不等于任一值', value: 'not_in' },\n { label: '为空', value: 'empty' },\n { label: '不为空', value: 'not_empty' },\n]\n\n/** 字段节点显示全部交互条件,布局节点只允许配置显示条件。 */\nexport function visibleConditionConfigs(node: ViewNode): DesignerConditionConfig[] {\n return conditionConfigs.filter((config) => {\n if (config.name === 'disabled_when' || config.name === 'readonly_when') {\n return node.type === 'field'\n }\n\n return true\n })\n}\n\n/** 将协议 Condition 转换为可视模型;表达式等高级结构自动切换到 JSON 模式。 */\nexport function createConditionEditorValues(condition: Condition | undefined): ConditionEditorValues {\n if (!condition) {\n return {\n mode: 'visual',\n json: '',\n root: createEmptyGroup(),\n }\n }\n\n const visualValues = createVisualEditorValues(condition)\n if (visualValues) {\n return visualValues\n }\n\n if (isJsonCondition(condition)) {\n return {\n mode: 'json',\n json: JSON.stringify(condition, undefined, 2),\n root: createEmptyGroup(),\n }\n }\n\n return {\n mode: 'visual',\n json: '',\n root: {\n kind: 'group',\n logic: 'all',\n items: [createRuleFromCondition(condition) ?? createEmptyRule()],\n },\n }\n}\n\n/** 将编辑器值写回 Condition;单条规则保持扁平协议,多条规则生成 all/any 分组。 */\nexport function applyConditionEditorValues(values: ConditionEditorValues): Condition {\n if (values.mode === 'json') {\n return parseConditionValue(values.json) ?? { field: '', op: 'eq' }\n }\n\n const items = values.root.items.length ? values.root.items : [createEmptyRule()]\n if (items.length === 1 && items[0]?.kind === 'rule') {\n return createSimpleCondition(items[0])\n }\n\n return createGroupCondition({\n ...values.root,\n items,\n })\n}\n\n/** 创建可直接插入规则列表的空白条件行。 */\nexport function createEmptyRule(): ConditionEditorRuleValues {\n return {\n kind: 'rule',\n field: '',\n op: 'eq',\n value: '',\n }\n}\n\n/** 创建包含一条空规则的 AND 条件组,保证可视编辑器始终有可操作入口。 */\nexport function createEmptyGroup(): ConditionEditorGroupValues {\n return {\n kind: 'group',\n logic: 'all',\n items: [createEmptyRule()],\n }\n}\n\n/** 生成 form 字段路径选项,并保留协议中已存在但当前 schema 未声明的路径。 */\nexport function createConditionFieldOptions(\n fields: ResourceField[],\n currentField: string,\n): Array<{ label: string; value: string }> {\n const options = fields\n .filter((field) => field.formable !== false)\n .map((field) => ({\n label: field.label && field.label !== field.name ? `${field.label}(${field.name})` : field.name,\n value: toFormFieldPath(field.name),\n }))\n\n if (currentField && !options.some((option) => option.value === currentField)) {\n options.unshift({\n label: currentField,\n value: currentField,\n })\n }\n\n return options\n}\n\nfunction toFormFieldPath(fieldName: string): string {\n return `form.${fieldName}`\n}\n\n/** 将一行可视规则转换为扁平 Condition,并按操作符解析标量值。 */\nexport function createSimpleCondition(values: ConditionEditorRuleValues): Condition {\n const next: Condition = {\n field: values.field.trim(),\n op: normalizeConditionOperator(values.op),\n }\n\n if (next.op !== 'empty' && next.op !== 'not_empty') {\n const value = parseConditionScalar(values.value)\n if (value !== undefined) {\n next.value = value\n }\n }\n\n return next\n}\n\n/** 生成人类可读的条件摘要,供能力卡在未展开时展示。 */\nexport function summarizeCondition(condition: Condition | undefined): string {\n if (!condition) {\n return '未设置'\n }\n\n if (isJsonCondition(condition) || condition.all || condition.any) {\n if (condition.all?.length) {\n return `AND 全部满足 ${condition.all.length} 条`\n }\n if (condition.any?.length) {\n return `OR 任一满足 ${condition.any.length} 条`\n }\n if (condition.not) {\n return '取反条件'\n }\n if (condition.expr) {\n return '表达式条件'\n }\n if (condition.selection_empty !== undefined) {\n return condition.selection_empty ? '选择为空' : '选择不为空'\n }\n return '高级条件'\n }\n\n const op = condition.op ?? 'eq'\n const field = condition.field || '字段'\n if (op === 'empty' || op === 'not_empty') {\n return `${field} ${resolveConditionOperatorLabel(op)}`\n }\n\n return `${field} ${resolveConditionOperatorLabel(op)} ${formatConditionValue(condition.value)}`\n}\n\n/** 判断条件是否需要 JSON 模式,包含分组、取反、表达式和选择状态结构。 */\nexport function isAdvancedCondition(condition: Condition | undefined): boolean {\n return isJsonCondition(condition) || Boolean(condition?.all || condition?.any)\n}\n\nfunction isJsonCondition(condition: Condition | undefined): boolean {\n if (!condition) {\n return false\n }\n\n return Boolean(condition.not || condition.expr || condition.selection_empty !== undefined)\n}\n\nfunction createVisualEditorValues(condition: Condition): ConditionEditorValues | undefined {\n if (isJsonCondition(condition)) {\n return undefined\n }\n\n const root = createGroupFromCondition(condition)\n if (!root) {\n return undefined\n }\n\n return {\n mode: 'visual',\n json: '',\n root,\n }\n}\n\nfunction createGroupFromCondition(condition: Condition): ConditionEditorGroupValues | undefined {\n const groupLogic: DesignerConditionGroupLogic | undefined = condition.all\n ? 'all'\n : condition.any\n ? 'any'\n : undefined\n const conditions = groupLogic === 'all' ? condition.all : groupLogic === 'any' ? condition.any : undefined\n if (groupLogic && conditions?.length) {\n const items = conditions.map(createItemFromCondition)\n if (items.some((item) => !item)) {\n return undefined\n }\n\n return {\n kind: 'group',\n logic: groupLogic,\n items: items as ConditionEditorItemValues[],\n }\n }\n\n const rule = createRuleFromCondition(condition)\n if (!rule) {\n return undefined\n }\n\n return {\n kind: 'group',\n logic: 'all',\n items: [rule],\n }\n}\n\nfunction createItemFromCondition(condition: Condition): ConditionEditorItemValues | undefined {\n if (isJsonCondition(condition)) {\n return undefined\n }\n if (condition.all || condition.any) {\n return createGroupFromCondition(condition)\n }\n\n return createRuleFromCondition(condition)\n}\n\nfunction createRuleFromCondition(condition: Condition): ConditionEditorRuleValues | undefined {\n if (!isSimpleCondition(condition)) {\n return undefined\n }\n\n return {\n kind: 'rule',\n field: condition.field ?? '',\n op: normalizeConditionOperator(condition.op),\n value: condition.value === undefined ? '' : JSON.stringify(condition.value, undefined, 2),\n }\n}\n\nfunction createConditionFromItem(item: ConditionEditorItemValues): Condition {\n return item.kind === 'group' ? createGroupCondition(item) : createSimpleCondition(item)\n}\n\nfunction createGroupCondition(group: ConditionEditorGroupValues): Condition {\n const items = group.items.length ? group.items : [createEmptyRule()]\n const conditions = items.map(createConditionFromItem)\n\n return group.logic === 'all' ? { all: conditions } : { any: conditions }\n}\n\nfunction isSimpleCondition(condition: Condition): boolean {\n return (\n Boolean(condition.field) &&\n !condition.all &&\n !condition.any &&\n !condition.not &&\n !condition.expr &&\n condition.selection_empty === undefined\n )\n}\n\nfunction parseConditionValue(value: unknown): Condition | undefined {\n if (!value) {\n return undefined\n }\n if (typeof value === 'object') {\n return value as Condition\n }\n if (typeof value !== 'string' || value.trim() === '') {\n return undefined\n }\n\n try {\n const parsed = JSON.parse(value)\n return parsed && typeof parsed === 'object' ? (parsed as Condition) : undefined\n } catch {\n return undefined\n }\n}\n\nfunction parseConditionScalar(value: unknown): unknown {\n if (typeof value !== 'string') {\n return value\n }\n if (value.trim() === '') {\n return undefined\n }\n\n try {\n return JSON.parse(value)\n } catch {\n return value\n }\n}\n\nfunction normalizeConditionOperator(value: unknown): ConditionOperator {\n return isConditionOperator(value) ? value : 'eq'\n}\n\nfunction resolveConditionOperatorLabel(op: ConditionOperator): string {\n return conditionOperatorOptions.find((item) => item.value === op)?.label ?? op\n}\n\nfunction formatConditionValue(value: unknown): string {\n if (value === undefined) {\n return ''\n }\n if (typeof value === 'string') {\n return value\n }\n\n return JSON.stringify(value)\n}\n","import type { ResourceField } from '@sparqjs/schema-protocol'\nimport { cloneSerializable } from '../shared/clone'\n\nexport type FieldValidationRule = NonNullable<ResourceField['validation']>[number]\n\n/** 返回 validation 中接管必填语义的规则;快捷必填据此进入只读状态。 */\nexport function getRequiredValidationRule(field: ResourceField | undefined): FieldValidationRule | undefined {\n return field?.validation?.find((rule) => rule.type === 'required')\n}\n\n/**\n * 为校验编辑器生成统一投影。\n *\n * field.required 只在 validation 尚未声明 required 时补成临时规则,已有双入口状态保持原样,\n * 直到用户确认编辑后再由写回边界规范化。\n */\nexport function createFieldValidationEditorValue(\n field: ResourceField | undefined,\n): NonNullable<ResourceField['validation']> {\n const rules = cloneSerializable(field?.validation ?? [])\n if (field?.required && !rules.some((rule) => rule.type === 'required')) {\n rules.unshift({ type: 'required' })\n }\n return rules\n}\n\n/** 校验编辑器确认后,将 required 的两种协议表达收敛为单一入口。 */\nexport function applyFieldValidationEditorValue(\n field: ResourceField,\n rules: NonNullable<ResourceField['validation']>,\n): void {\n const validation: NonNullable<ResourceField['validation']> = []\n let requiredHandled = false\n\n for (const rule of rules) {\n if (rule.type !== 'required') {\n validation.push(cloneSerializable(rule))\n continue\n }\n if (requiredHandled) {\n continue\n }\n\n requiredHandled = true\n if (isSimpleRequiredRule(rule)) {\n field.required = true\n } else {\n delete field.required\n validation.push(cloneSerializable(rule))\n }\n }\n\n if (!requiredHandled) {\n delete field.required\n }\n if (validation.length > 0) {\n field.validation = validation\n } else {\n delete field.validation\n }\n}\n\n/** 只有无条件、无自定义提示且无扩展参数的规则能由 field.required 完整表达。 */\nexport function isSimpleRequiredRule(rule: FieldValidationRule): boolean {\n return (\n rule.type === 'required' &&\n rule.when === undefined &&\n rule.value === undefined &&\n rule.value_expr === undefined &&\n rule.params === undefined &&\n (rule.message === undefined || rule.message === '')\n )\n}\n","import type { ResourceField, ViewNode } from '@sparqjs/schema-protocol'\nimport { cloneSerializable } from '../../shared/clone'\nimport type { FieldSchemaContext } from '../field-schema'\nimport { applyFieldValidationEditorValue, createFieldValidationEditorValue } from '../required-validation'\n\n/** 复杂取值逻辑的设计期投影,只覆盖动态默认值、计算值和对应持久化状态。 */\nexport function readFieldValueStrategy({ field }: FieldSchemaContext): Record<string, unknown> {\n const persisted = field?.persisted === true\n if (field?.computed_expr) {\n return {\n mode: 'computed',\n computed_expr: cloneSerializable(field.computed_expr),\n computed_triggers: cloneOptional(field.computed_triggers ?? []),\n persisted,\n }\n }\n if (field?.default_expr) {\n return { mode: 'dynamic', default_expr: cloneSerializable(field.default_expr), persisted }\n }\n return { persisted }\n}\n\n/** 动态与计算编辑器确认后一次替换其拥有的字段路径。 */\nexport function writeFieldValueStrategy({ field }: FieldSchemaContext, value: unknown): void {\n if (!field) {\n return\n }\n if (!isPlainRecord(value) || (value.mode !== 'dynamic' && value.mode !== 'computed')) {\n clearFieldValueStrategy(field)\n return\n }\n\n setFieldPersisted(field, value.persisted)\n delete field.default_expr\n delete field.computed_expr\n delete field.computed_triggers\n\n if (value.mode === 'dynamic' && isFieldValueExpression(value.default_expr)) {\n field.default_expr = cloneSerializable(value.default_expr)\n } else if (value.mode === 'computed' && isValueExpression(value.computed_expr)) {\n field.computed_expr = cloneSerializable(value.computed_expr)\n const triggers = normalizeTriggerList(value.computed_triggers)\n if (triggers.length > 0) {\n field.computed_triggers = triggers\n }\n }\n}\n\n/** 数据选项能力统一读写候选来源和字段引用,避免资源语义落入 UI 查询配置。 */\nexport function readFieldOptions({ field }: FieldSchemaContext): Record<string, unknown> {\n return {\n options: cloneOptional(field?.options),\n reference: cloneOptional(field?.reference),\n }\n}\n\nexport function writeFieldOptions({ field }: FieldSchemaContext, value: unknown): void {\n if (!field) {\n return\n }\n if (!isPlainRecord(value) || !isFieldOptions(value.options)) {\n delete field.options\n delete field.reference\n return\n }\n field.options = cloneSerializable(value.options)\n if (isFieldReference(value.reference)) {\n field.reference = cloneSerializable(value.reference)\n } else {\n delete field.reference\n }\n}\n\n/** 校验能力读取统一编辑投影,写回时规范化 required 的快捷属性和复杂规则入口。 */\nexport function readFieldValidation({ field }: FieldSchemaContext): NonNullable<ResourceField['validation']> {\n return createFieldValidationEditorValue(field)\n}\n\nexport function writeFieldValidation({ field }: FieldSchemaContext, value: unknown): void {\n if (!field) {\n return\n }\n const rules = Array.isArray(value)\n ? value\n .filter((rule): rule is NonNullable<ResourceField['validation']>[number] => isValidationRule(rule))\n .map((rule) => cloneSerializable(rule))\n : []\n applyFieldValidationEditorValue(field, rules)\n}\n\n/** 交互能力把三个条件路径聚合成一个编辑器值,但仍写回正式 ViewNode 协议。 */\nexport function readNodeInteractionRules({ node }: FieldSchemaContext): Record<string, unknown> {\n return {\n show_when: cloneOptional(node.show_when),\n disabled_when: cloneOptional(node.disabled_when),\n readonly_when: cloneOptional(node.readonly_when),\n }\n}\n\nexport function writeNodeInteractionRules({ node }: FieldSchemaContext, value: unknown): void {\n if (!isPlainRecord(value)) {\n delete node.show_when\n delete node.disabled_when\n delete node.readonly_when\n return\n }\n setNodeCondition(node, 'show_when', value.show_when)\n setNodeCondition(node, 'disabled_when', value.disabled_when)\n setNodeCondition(node, 'readonly_when', value.readonly_when)\n}\n\nfunction clearFieldValueStrategy(field: ResourceField): void {\n delete field.default_expr\n delete field.computed_expr\n delete field.computed_triggers\n}\n\nfunction setFieldPersisted(field: ResourceField, value: unknown): void {\n field.persisted = value !== false\n}\n\nfunction isFieldValueExpression(value: unknown): value is NonNullable<ResourceField['default_expr']> {\n return isPlainRecord(value) && typeof value.type === 'string'\n}\n\nfunction isValueExpression(value: unknown): value is NonNullable<ResourceField['computed_expr']> {\n return isPlainRecord(value) && typeof value.type === 'string'\n}\n\nfunction normalizeTriggerList(value: unknown): string[] {\n return Array.isArray(value) ? value.filter((item): item is string => typeof item === 'string' && item !== '') : []\n}\n\nfunction isFieldOptions(value: unknown): value is NonNullable<ResourceField['options']> {\n return isPlainRecord(value) && typeof value.mode === 'string'\n}\n\nfunction isFieldReference(value: unknown): value is NonNullable<ResourceField['reference']> {\n return (\n isPlainRecord(value) &&\n typeof value.resource === 'string' &&\n typeof value.value_field === 'string' &&\n typeof value.label_field === 'string'\n )\n}\n\nfunction isValidationRule(value: unknown): value is NonNullable<ResourceField['validation']>[number] {\n return isPlainRecord(value) && typeof value.type === 'string'\n}\n\nfunction setNodeCondition(node: ViewNode, key: 'show_when' | 'disabled_when' | 'readonly_when', value: unknown): void {\n if (isPlainRecord(value)) {\n node[key] = cloneSerializable(value) as NonNullable<ViewNode['show_when']>\n } else {\n delete node[key]\n }\n}\n\nfunction isPlainRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nfunction cloneOptional<T>(value: T): T {\n return value === undefined ? value : cloneSerializable(value)\n}\n","import { visibleConditionConfigs } from '../../condition-editor-model'\nimport type { DesignerCapabilityCard } from '../types'\nimport { designerCapabilityCardKeys } from '../keys'\nimport { readNodeInteractionRules, writeNodeInteractionRules } from '../adapters'\n\n/** 统一读写节点显示、禁用和只读条件,并提供配置摘要。 */\nexport const interactionRulesCapabilityCard: DesignerCapabilityCard = {\n key: designerCapabilityCardKeys.interactionRules,\n title: '交互条件',\n group: 'interaction',\n order: 40,\n field: {\n storage: { target: 'capability' },\n editLevel: 'capability',\n commitMode: 'confirm',\n migrationOwner: 'schema',\n key: 'node.interaction_rules_editor',\n kind: 'json',\n label: '交互条件',\n hideLabel: true,\n component: 'designer.interaction-rules-editor',\n },\n affectedPaths: [\n { target: 'node', path: 'show_when' },\n { target: 'node', path: 'disabled_when' },\n { target: 'node', path: 'readonly_when' },\n ],\n read: readNodeInteractionRules,\n write: writeNodeInteractionRules,\n visible({ node }) {\n return visibleConditionConfigs(node).length > 0\n },\n summary({ node }) {\n const configs = visibleConditionConfigs(node)\n const count = configs.filter((config) => Boolean(node[config.name])).length\n return count > 0 ? { status: 'configured', text: `${count} 条条件` } : { status: 'empty', text: '未配置' }\n },\n}\n","import type { ResourceField } from '@sparqjs/schema-protocol'\n\nconst optionSourceTypeLabels: Record<NonNullable<ResourceField['options']>['mode'], string> = {\n static: '静态选项',\n reference: '资源引用',\n dictionary: '字典',\n remote: '远程',\n}\n\n/** 数据选项摘要只表达来源类型,具体配置保留在弹层内查看和编辑。 */\nexport function summarizeOptionSourceType(options: ResourceField['options'] | undefined): string {\n return options ? optionSourceTypeLabels[options.mode] : '未配置'\n}\n","import type { DesignerCapabilityCard } from '../types'\nimport { designerCapabilityCardKeys } from '../keys'\nimport { readFieldOptions, writeFieldOptions } from '../adapters'\nimport { summarizeOptionSourceType } from '../../option-source-summary'\n\n/** 管理静态选项、数据字典和资源引用,同时写回字段引用语义与候选查询配置。 */\nexport const optionSourceCapabilityCard: DesignerCapabilityCard = {\n key: designerCapabilityCardKeys.optionSource,\n title: '数据选项',\n group: 'data',\n order: 30,\n field: {\n storage: { target: 'capability' },\n editLevel: 'capability',\n commitMode: 'confirm',\n migrationOwner: 'schema',\n key: 'field.options_editor',\n kind: 'json',\n label: '数据选项',\n tip: '设置下拉、单选等控件的候选值,可使用静态选项、字典或资源引用。',\n component: 'designer.option-source-editor',\n usesServiceRegistry: true,\n },\n affectedPaths: [\n { target: 'field', path: 'options' },\n { target: 'field', path: 'reference' },\n ],\n read: readFieldOptions,\n write: writeFieldOptions,\n summary({ field }) {\n const options = field?.options\n if (!options) {\n return { status: 'empty', text: '未配置' }\n }\n return { status: 'configured', text: summarizeOptionSourceType(options) }\n },\n}\n","import type { DesignerCapabilityCard } from '../types'\nimport { designerCapabilityCardKeys } from '../keys'\nimport { readFieldValidation, writeFieldValidation } from '../adapters'\n\n/** 聚合 required 与 validation 规则,避免校验状态分散在多个属性入口。 */\nexport const validationRulesCapabilityCard: DesignerCapabilityCard = {\n key: designerCapabilityCardKeys.validationRules,\n title: '校验规则',\n group: 'validation',\n order: 20,\n field: {\n storage: { target: 'capability' },\n editLevel: 'capability',\n commitMode: 'confirm',\n migrationOwner: 'schema',\n key: 'field.validation_editor',\n kind: 'json',\n label: '校验规则',\n tip: '设置必填、长度、范围和格式等校验。后端仍是最终校验边界。',\n component: 'designer.validation-rule-editor',\n },\n affectedPaths: [\n { target: 'field', path: 'required' },\n { target: 'field', path: 'validation' },\n ],\n read: readFieldValidation,\n write: writeFieldValidation,\n summary({ field }) {\n const ruleCount = field?.validation?.length ?? 0\n if (field?.required && ruleCount > 0) {\n return { status: 'configured', text: `始终必填 + ${ruleCount} 条规则` }\n }\n if (field?.required) {\n return { status: 'configured', text: '始终必填' }\n }\n if (ruleCount > 0) {\n return { status: 'configured', text: `${ruleCount} 条规则` }\n }\n return { status: 'empty', text: '未配置' }\n },\n}\n","import type { DesignerCapabilityCard } from '../types'\nimport { designerCapabilityCardKeys } from '../keys'\nimport { readFieldValueStrategy, writeFieldValueStrategy } from '../adapters'\n\n/** 统一编辑动态默认值、计算表达式和计算字段持久化策略。 */\nexport const valueStrategyCapabilityCard: DesignerCapabilityCard = {\n key: designerCapabilityCardKeys.valueStrategy,\n title: '动态与计算',\n group: 'value',\n order: 10,\n field: {\n storage: { target: 'capability' },\n editLevel: 'capability',\n commitMode: 'confirm',\n migrationOwner: 'schema',\n key: 'field.value_strategy_editor',\n kind: 'json',\n label: '动态与计算',\n tip: '设置新增时动态生成的值,或根据其他字段计算当前值。静态默认值在基础信息中编辑。',\n component: 'designer.value-strategy-editor',\n },\n affectedPaths: [\n { target: 'field', path: 'default' },\n { target: 'field', path: 'default_expr' },\n { target: 'field', path: 'computed_expr' },\n { target: 'field', path: 'computed_triggers' },\n { target: 'field', path: 'persisted' },\n ],\n read: readFieldValueStrategy,\n write: writeFieldValueStrategy,\n summary({ field }) {\n if (!field) {\n return { status: 'empty', text: '未配置' }\n }\n if (field.computed_expr) {\n return {\n status: 'configured',\n text: field.persisted === true ? '计算值 / 落库' : '计算值 / 不落库',\n }\n }\n if (field.default_expr) {\n return {\n status: 'configured',\n text: `动态默认值:${field.default_expr.type}`,\n }\n }\n return { status: 'empty', text: '未配置' }\n },\n}\n","import type { ViewNodeSlotContent, ViewNodeSlots } from '@sparqjs/schema-protocol'\nimport { cloneSerializable } from '../../../shared/clone'\nimport { isPlainObjectRecord } from '../../../shared/object-path'\nimport type { DesignerCapabilityCard } from '../types'\nimport { designerCapabilityCardKeys } from '../keys'\n\nconst slotNames = ['prefix', 'suffix', 'prepend', 'append'] as const\n\n/** 单行输入组件的静态文本和图标插槽,复杂交互继续由自定义组件承担。 */\nexport const inputSlotsCapabilityCard: DesignerCapabilityCard = {\n key: designerCapabilityCardKeys.inputSlots,\n title: '输入插槽',\n group: 'advanced',\n order: 45,\n field: {\n storage: { target: 'capability' },\n editLevel: 'capability',\n commitMode: 'confirm',\n migrationOwner: 'schema',\n capability: designerCapabilityCardKeys.inputSlots,\n key: 'node.input_slots_editor',\n kind: 'json',\n label: '输入插槽',\n component: 'designer.input-slots-editor',\n },\n affectedPaths: slotNames.map((path) => ({ target: 'node' as const, path: `slots.${path}` })),\n read({ node }) {\n return cloneSerializable(node.slots ?? {})\n },\n write({ node }, value) {\n const slots = normalizeSlots(value)\n if (Object.keys(slots).length) {\n node.slots = slots\n } else {\n delete node.slots\n }\n },\n summary({ node }) {\n const configured = slotNames.filter((name) => node.slots?.[name])\n return {\n status: configured.length ? 'configured' : 'empty',\n text: configured.length ? `${configured.length} 个插槽` : '未配置',\n detail: configured.map(slotLabel).join('、'),\n }\n },\n}\n\nfunction normalizeSlots(value: unknown): ViewNodeSlots {\n if (!isPlainObjectRecord(value)) {\n return {}\n }\n\n return Object.fromEntries(\n slotNames\n .map((name) => [name, normalizeSlotContent(value[name])] as const)\n .filter((entry): entry is readonly [(typeof slotNames)[number], ViewNodeSlotContent] => Boolean(entry[1])),\n )\n}\n\nfunction normalizeSlotContent(value: unknown): ViewNodeSlotContent | undefined {\n if (!isPlainObjectRecord(value)) {\n return undefined\n }\n if (value.type === 'text' && typeof value.text === 'string' && value.text !== '') {\n return { type: 'text', text: value.text }\n }\n if (value.type === 'icon' && typeof value.icon === 'string' && value.icon !== '') {\n return { type: 'icon', icon: value.icon }\n }\n return undefined\n}\n\nfunction slotLabel(name: (typeof slotNames)[number]): string {\n const labels = {\n prefix: '内部前缀',\n suffix: '内部后缀',\n prepend: '外部前置',\n append: '外部后置',\n }\n return labels[name]\n}\n","import { matchesValidationFormat } from '@sparqjs/schema-core'\nimport { cloneSerializable } from '../../../shared/clone'\nimport type { DesignerCapabilityCard } from '../types'\nimport { designerCapabilityCardKeys } from '../keys'\n\n/** 将颜色预设列表作为一次能力配置写入节点 props,避免在 Inspector 平铺不定数量输入框。 */\nexport const colorPaletteCapabilityCard: DesignerCapabilityCard = {\n key: designerCapabilityCardKeys.colorPalette,\n title: '预设色板',\n group: 'advanced',\n order: 50,\n field: {\n storage: { target: 'capability' },\n editLevel: 'capability',\n commitMode: 'confirm',\n migrationOwner: 'component',\n capability: designerCapabilityCardKeys.colorPalette,\n key: 'node.color_palette_editor',\n kind: 'json',\n label: '预设色板',\n component: 'designer.color-palette-editor',\n },\n affectedPaths: [{ target: 'node', path: 'props.predefine' }],\n read({ node }) {\n return Array.isArray(node.props?.predefine)\n ? node.props.predefine.filter((value): value is string => typeof value === 'string')\n : []\n },\n write({ node }, value) {\n const colors = normalizeColorPalette(value)\n if (colors.length === 0) {\n delete node.props?.predefine\n if (node.props && Object.keys(node.props).length === 0) {\n delete node.props\n }\n return\n }\n node.props ??= {}\n node.props.predefine = cloneSerializable(colors)\n },\n summary({ node }) {\n const colors = normalizeColorPalette(node.props?.predefine)\n return {\n status: colors.length > 0 ? 'configured' : 'empty',\n text: colors.length > 0 ? `${colors.length} 个预设颜色` : '未配置',\n }\n },\n}\n\nfunction normalizeColorPalette(value: unknown): string[] {\n if (!Array.isArray(value)) {\n return []\n }\n return value.filter(\n (color): color is string => typeof color === 'string' && matchesValidationFormat('color', color),\n )\n}\n","import { cloneSerializable } from '../../../shared/clone'\nimport { getObjectPathValue, isPlainObjectRecord, setObjectPathValue } from '../../../shared/object-path'\nimport type { DesignerCapabilityCard } from '../types'\nimport { designerCapabilityCardKeys } from '../keys'\n\nconst uploadSettingPaths = [\n 'valueMode',\n 'limit',\n 'accept',\n 'maxSize',\n 'multiple',\n 'editableTitle',\n 'uploadText',\n 'pickText',\n]\n\nconst richTextSettingPaths = ['editor', 'height', 'toolbar.mode', 'toolbar.sticky', 'toolbar.stickyOffset']\n\n/** 将上传值模式、数量、类型和标题编辑聚合为一次能力配置。 */\nexport const uploadSettingsCapabilityCard: DesignerCapabilityCard = {\n key: designerCapabilityCardKeys.uploadSettings,\n title: '上传配置',\n group: 'advanced',\n order: 50,\n field: {\n storage: { target: 'capability' },\n editLevel: 'capability',\n commitMode: 'confirm',\n migrationOwner: 'component',\n capability: designerCapabilityCardKeys.uploadSettings,\n key: 'node.upload_settings_editor',\n kind: 'json',\n label: '上传配置',\n tip: '设置上传后保存的值、文件限制和多选方式。',\n component: 'designer.component-settings-editor',\n props: {\n settingsLevel: 'capability',\n settingsKind: 'upload',\n dialogTitle: '上传配置',\n },\n },\n affectedPaths: uploadSettingPaths.map((path) => ({ target: 'node' as const, path: `props.${path}` })),\n read: readUploadNodeProps,\n write: writeNodeProps(uploadSettingPaths),\n summary({ node }) {\n const props = node.props ?? {}\n const details: string[] = []\n const valueMode = props.valueMode\n if (valueMode === 'id') {\n details.push('资源 ID')\n } else if (valueMode === 'asset') {\n details.push('资源对象')\n } else {\n details.push('URL')\n }\n if (typeof props.limit === 'number' && props.limit > 0) {\n details.push(`最多 ${props.limit} 个`)\n }\n if (props.multiple === true) {\n details.push('允许多选')\n }\n return {\n status: uploadSettingPaths.some((path) => getObjectPathValue(props, path) !== undefined)\n ? 'configured'\n : 'empty',\n text: details.join(' / '),\n }\n },\n}\n\n/** 管理富文本编辑器选择、尺寸和工具栏配置,不展开编辑器私有 props。 */\nexport const richTextSettingsCapabilityCard: DesignerCapabilityCard = {\n key: designerCapabilityCardKeys.richTextSettings,\n title: '富文本配置',\n group: 'advanced',\n order: 50,\n field: {\n storage: { target: 'capability' },\n editLevel: 'capability',\n commitMode: 'confirm',\n migrationOwner: 'component',\n capability: designerCapabilityCardKeys.richTextSettings,\n key: 'node.rich_text_settings_editor',\n kind: 'json',\n label: '富文本配置',\n tip: '选择编辑器,并设置编辑区高度和工具栏。',\n component: 'designer.component-settings-editor',\n props: {\n settingsLevel: 'capability',\n settingsKind: 'rich-text',\n dialogTitle: '富文本配置',\n },\n },\n affectedPaths: richTextSettingPaths.map((path) => ({ target: 'node' as const, path: `props.${path}` })),\n read: readNodeProps,\n write: writeNodeProps(richTextSettingPaths),\n summary({ node }) {\n const props = node.props ?? {}\n const editorLabels: Record<string, string> = {\n tinymce: 'TinyMCE',\n wang: 'WangEditor',\n markdown: 'Markdown',\n editorjs: 'Editor.js',\n fallback: 'Fallback',\n }\n const editor = typeof props.editor === 'string' ? (editorLabels[props.editor] ?? props.editor) : '默认编辑器'\n return {\n status: richTextSettingPaths.some((path) => getObjectPathValue(props, path) !== undefined)\n ? 'configured'\n : 'empty',\n text: editor,\n }\n },\n}\n\n/** 承载节点 class、style、writeBack 和扩展 props 等低频高级配置。 */\nexport const advancedConfigCapabilityCard: DesignerCapabilityCard = {\n key: designerCapabilityCardKeys.advancedConfig,\n title: '高级配置',\n group: 'advanced',\n order: 90,\n field: {\n storage: { target: 'capability' },\n editLevel: 'readonly',\n commitMode: 'confirm',\n migrationOwner: 'extension',\n capability: designerCapabilityCardKeys.advancedConfig,\n key: 'node.advanced_config_status',\n kind: 'text',\n label: '高级配置',\n tip: '这些配置暂不能在当前面板直接编辑,保存时会原样保留。',\n component: 'designer.advanced-config-status',\n },\n affectedPaths: [\n { target: 'node', path: 'className' },\n { target: 'node', path: 'style' },\n { target: 'node', path: 'props.writeBack' },\n { target: 'node', path: 'props.editorProps' },\n { target: 'node', path: 'props.emptyValue' },\n ],\n visible({ node }) {\n return advancedConfigLabels(node).length > 0\n },\n summary({ node }) {\n const labels = advancedConfigLabels(node)\n return {\n status: labels.length > 0 ? 'configured' : 'empty',\n text: labels.length > 0 ? `${labels.length} 项已保留` : '未配置',\n detail: labels.join('、'),\n }\n },\n}\n\nfunction readNodeProps({ node }: Parameters<NonNullable<DesignerCapabilityCard['read']>>[0]): Record<string, unknown> {\n return cloneSerializable(node.props ?? {})\n}\n\nfunction writeNodeProps(paths: string[]): NonNullable<DesignerCapabilityCard['write']> {\n return ({ node }, value) => {\n if (!isPlainObjectRecord(value)) {\n return\n }\n\n node.props ??= {}\n for (const path of paths) {\n setObjectPathValue(node.props, path, cloneOptional(getObjectPathValue(value, path)))\n }\n if (Object.keys(node.props).length === 0) {\n delete node.props\n }\n }\n}\n\nfunction cloneOptional(value: unknown): unknown {\n return value === undefined ? undefined : cloneSerializable(value)\n}\n\nfunction readUploadNodeProps(\n context: Parameters<NonNullable<DesignerCapabilityCard['read']>>[0],\n): Record<string, unknown> {\n const props = readNodeProps(context)\n props.valueMode ??= 'url'\n return props\n}\n\nfunction advancedConfigLabels(node: Parameters<DesignerCapabilityCard['summary']>[0]['node']): string[] {\n const labels: string[] = []\n if (node.className) {\n labels.push('节点类名')\n }\n if (node.style && Object.keys(node.style).length > 0) {\n labels.push('节点样式')\n }\n if (hasOwn(node.props, 'writeBack')) {\n labels.push('回写规则')\n }\n if (hasOwn(node.props, 'editorProps')) {\n labels.push('编辑器扩展')\n }\n if (hasOwn(node.props, 'emptyValue')) {\n labels.push('空值结构')\n }\n return labels\n}\n\nfunction hasOwn(target: Record<string, unknown> | undefined, key: string): boolean {\n return Boolean(target && Object.prototype.hasOwnProperty.call(target, key))\n}\n","import type { DesignerCapabilityCard } from './types'\nimport { interactionRulesCapabilityCard } from './cards/interaction-rules'\nimport { optionSourceCapabilityCard } from './cards/option-source'\nimport { validationRulesCapabilityCard } from './cards/validation-rules'\nimport { valueStrategyCapabilityCard } from './cards/value-strategy'\nimport { inputSlotsCapabilityCard } from './cards/input-slots'\nimport { colorPaletteCapabilityCard } from './cards/color-palette'\nimport {\n advancedConfigCapabilityCard,\n richTextSettingsCapabilityCard,\n uploadSettingsCapabilityCard,\n} from './cards/component-settings'\n\n/** 每个设计器实例都会安装的内置能力卡定义,不在模块加载时写入全局注册表。 */\nexport const builtInDesignerCapabilityCards: readonly DesignerCapabilityCard[] = [\n valueStrategyCapabilityCard,\n validationRulesCapabilityCard,\n optionSourceCapabilityCard,\n interactionRulesCapabilityCard,\n inputSlotsCapabilityCard,\n colorPaletteCapabilityCard,\n uploadSettingsCapabilityCard,\n richTextSettingsCapabilityCard,\n advancedConfigCapabilityCard,\n]\n","import type { DesignerCapabilityCard } from './types'\nimport type { DesignerCapabilityCardKey } from './keys'\nimport { builtInDesignerCapabilityCards } from './register-built-ins'\n\n/** 读取设计器内置能力卡;插件能力卡必须通过当前实例的 DesignerExtensionContext 查询。 */\nexport function getDesignerCapabilityCard(key: DesignerCapabilityCardKey): DesignerCapabilityCard | undefined {\n return builtInDesignerCapabilityCards.find((card) => card.key === key)\n}\n\n/** 返回按 order 排序的内置能力卡,供实例 Kernel 安装 builtin 层。 */\nexport function listDesignerCapabilityCards(keys?: DesignerCapabilityCardKey[]): DesignerCapabilityCard[] {\n const cards = keys?.length ? keys.map(getDesignerCapabilityCard).filter(isDefined) : builtInDesignerCapabilityCards\n\n return [...cards].sort((left, right) => (left.order ?? 0) - (right.order ?? 0))\n}\n\nfunction isDefined<T>(value: T | undefined): value is T {\n return value !== undefined\n}\n","/**\n * 字段快捷能力 key。\n *\n * 这些 key 只控制右侧“字段能力”里的布尔快捷开关,最终写回 ResourceField\n * 上的同名字段。复杂能力入口应使用 designerCapabilityCardKeys,避免把快捷开关\n * 和弹层能力混在同一个配置字段里。\n */\nexport const designerFieldCapabilityKeys = {\n multiple: 'multiple',\n listable: 'listable',\n searchable: 'searchable',\n} as const\n\n/** 组件允许在字段属性面板暴露的布尔字段能力。 */\nexport type DesignerComponentFieldCapability =\n (typeof designerFieldCapabilityKeys)[keyof typeof designerFieldCapabilityKeys]\n","import type {\n FieldPropertyCommitMode,\n FieldPropertyEditLevel,\n FieldPropertyField,\n FieldPropertyMigrationOwner,\n FieldSchemaContext,\n} from './types'\nimport { designerCapabilityCardKeys, type DesignerCapabilityCardKey } from '../capabilities'\nimport { designerFieldCapabilityKeys, type DesignerComponentFieldCapability } from './keys'\nimport type {\n DesignerComponentCapabilityProfile,\n DesignerComponentPropertyConfig,\n DesignerOptionSourceMode,\n DesignerValueStrategyMode,\n} from './registry'\nimport { isContainerNodeType } from '../../shared/view-node'\nimport { getComponentFieldConfig } from '../../state/component-config'\n\ntype DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never\n\ntype StoredPropertyDefinition = DistributiveOmit<\n FieldPropertyField,\n 'storage' | 'editLevel' | 'commitMode' | 'migrationOwner'\n> & {\n path: string\n editLevel?: FieldPropertyEditLevel\n commitMode?: FieldPropertyCommitMode\n migrationOwner?: FieldPropertyMigrationOwner\n}\n\n/**\n * 为内置属性补齐四个正交声明维度。\n *\n * 公开扩展仍需完整声明,避免插件属性依赖控件类型或注册来源推导写回和迁移行为。\n */\nfunction storedProperty(\n target: 'node' | 'field',\n defaultOwner: FieldPropertyMigrationOwner,\n definition: StoredPropertyDefinition,\n): FieldPropertyField {\n const {\n path,\n editLevel = 'inline',\n commitMode = defaultCommitMode(definition.kind, editLevel),\n migrationOwner = defaultOwner,\n ...field\n } = definition\n return {\n ...field,\n storage: { target, path },\n editLevel,\n commitMode,\n migrationOwner,\n } as FieldPropertyField\n}\n\nfunction nodeProperty(definition: StoredPropertyDefinition): FieldPropertyField {\n return storedProperty('node', 'schema', definition)\n}\n\nfunction fieldProperty(definition: StoredPropertyDefinition): FieldPropertyField {\n return storedProperty('field', 'schema', definition)\n}\n\nfunction componentProperty(definition: StoredPropertyDefinition): FieldPropertyField {\n return storedProperty('node', 'component', {\n ...definition,\n path: `props.${definition.path}`,\n })\n}\n\nfunction defaultCommitMode(\n kind: FieldPropertyField['kind'],\n editLevel: FieldPropertyEditLevel,\n): FieldPropertyCommitMode {\n if (editLevel === 'capability' || editLevel === 'extension') {\n return 'confirm'\n }\n if (kind === 'text' || kind === 'textarea' || kind === 'number' || kind === 'json') {\n return 'blur'\n }\n return 'immediate'\n}\n\n/** ViewNode 级通用属性,不随展示组件切换迁移。 */\nexport const nodeCommonFields: FieldPropertyField[] = [\n nodeProperty({\n key: 'node.name',\n kind: 'text',\n label: '节点名称',\n path: 'name',\n placeholder: '需要稳定 name 的节点可显式填写',\n }),\n nodeProperty({\n key: 'node.title',\n kind: 'text',\n label: '节点标题',\n path: 'title',\n placeholder: '默认使用字段标签',\n }),\n nodeProperty({\n key: 'node.tip',\n kind: 'textarea',\n label: '标题提示',\n tip: '显示在业务字段标题旁,适合补充术语或背景说明。填写要求请放在辅助说明中。',\n path: 'tip',\n rows: 3,\n }),\n nodeProperty({\n key: 'node.help',\n kind: 'textarea',\n label: '辅助说明',\n tip: '始终显示在控件下方,适合说明填写要求、格式或限制。',\n path: 'help',\n rows: 3,\n }),\n nodeProperty({\n key: 'node.component',\n kind: 'select',\n label: '展示组件',\n tip: '决定当前视图使用哪种控件,不改变字段实际保存的数据类型。',\n path: 'component',\n commitMode: 'command',\n options: [],\n }),\n nodeProperty({\n key: 'node.span',\n kind: 'select',\n label: '列宽',\n path: 'span',\n options: [\n { label: '整行', value: '24' },\n { label: '3/4', value: '18' },\n { label: '2/3', value: '16' },\n { label: '1/2', value: '12' },\n { label: '1/3', value: '8' },\n { label: '1/4', value: '6' },\n ],\n }),\n nodeProperty({\n key: 'node.gap',\n kind: 'number',\n label: '子项间距',\n path: 'gap',\n min: 0,\n max: 48,\n step: 1,\n visible: ({ node }) => isContainerNodeType(node.type),\n }),\n nodeProperty({\n key: 'node.shadow',\n kind: 'select',\n label: '阴影',\n path: 'props.shadow',\n options: [\n { label: '始终显示', value: 'always' },\n { label: '悬停显示', value: 'hover' },\n { label: '不显示', value: 'never' },\n ],\n visible: ({ node }) => node.type === 'card',\n }),\n nodeProperty({\n key: 'node.items',\n kind: 'json',\n label: '项目',\n path: 'children',\n component: 'designer.container-items-editor',\n commitMode: 'immediate',\n hideLabel: true,\n rawValue: true,\n visible: ({ node }) => node.type === 'tabs' || node.type === 'collapse',\n }),\n nodeProperty({\n key: 'node.className',\n editLevel: 'extension',\n kind: 'text',\n label: '节点类名',\n path: 'className',\n }),\n nodeProperty({\n key: 'node.style',\n editLevel: 'extension',\n kind: 'json',\n label: '节点样式',\n path: 'style',\n rows: 4,\n placeholder: '{\"maxWidth\":\"720px\"}',\n }),\n]\n\n/** 节点基础分组允许直接编辑的字段 key。 */\nexport const nodeBasicFieldKeys = ['node.name', 'node.component']\n/** 布局分组使用的节点属性 key,复杂 JSON 配置会由能力卡接管。 */\nexport const nodeLayoutFieldKeys = [\n 'node.title',\n 'node.tip',\n 'node.help',\n 'node.span',\n 'node.gap',\n 'node.shadow',\n 'node.className',\n 'node.style',\n]\n/** 标签页和手风琴外层容器的专用项目管理属性。 */\nexport const nodeItemsFieldKeys = ['node.items']\n\nconst relationRefreshOptions = [\n { label: '刷新当前页', value: 'reload-current' },\n { label: '回到首页并刷新', value: 'reload-first' },\n { label: '不自动刷新', value: 'none' },\n]\n\n/** has-many 关系列表节点的设计器属性。 */\nexport const relationListFields: FieldPropertyField[] = [\n nodeProperty({\n key: 'node.resource',\n kind: 'select',\n label: '目标资源',\n tip: '独立子资源的资源编码。',\n path: 'resource',\n clearable: true,\n options: [],\n dataSource: { provider: 'resources.list' },\n }),\n nodeProperty({\n key: 'node.view',\n kind: 'select',\n label: '列表视图',\n path: 'view',\n clearable: true,\n options: [],\n dataSource: {\n provider: 'resources.views',\n params: { kind: 'table' },\n paramsFromValues: { resource: 'node.resource' },\n },\n }),\n nodeProperty({\n key: 'binding.relation',\n kind: 'text',\n label: '关系名',\n path: 'binding.relation',\n placeholder: 'items',\n }),\n nodeProperty({\n key: 'binding.relationType',\n kind: 'select',\n label: '关系类型',\n tip: '当前前端通用执行语义只开放 has-many。',\n path: 'binding.relationType',\n options: [{ label: 'Has many', value: 'has-many' }],\n }),\n nodeProperty({\n key: 'binding.parentKey',\n kind: 'text',\n label: '父资源主键',\n path: 'binding.parentKey',\n placeholder: 'id',\n }),\n nodeProperty({\n key: 'binding.foreignKey',\n kind: 'select',\n label: '子资源外键',\n path: 'binding.foreignKey',\n clearable: true,\n options: [],\n dataSource: {\n provider: 'resources.fields',\n paramsFromValues: { resource: 'node.resource' },\n },\n }),\n nodeProperty({\n key: 'binding.requireParent',\n kind: 'checkbox',\n label: '要求父记录已保存',\n path: 'binding.requireParent',\n }),\n nodeProperty({\n key: 'binding.whenParentMissing',\n kind: 'select',\n label: '父记录缺失时',\n path: 'binding.whenParentMissing',\n options: [\n { label: '显示并禁用', value: 'disabled' },\n { label: '隐藏关系列表', value: 'hidden' },\n { label: '只读显示', value: 'readonly' },\n ],\n }),\n ...createRelationOperationFields('create', '新增资源'),\n ...createRelationOperationFields('attach', '选择已有'),\n ...createRelationOperationFields('update', '编辑资源'),\n ...createRelationOperationFields('detach', '解除关联'),\n ...createRelationOperationFields('delete', '删除资源'),\n nodeProperty({\n key: 'binding.pagination.enabled',\n kind: 'checkbox',\n label: '显示分页',\n path: 'binding.pagination.enabled',\n }),\n nodeProperty({\n key: 'binding.pagination.pageSize',\n kind: 'number',\n label: '每页条数',\n path: 'binding.pagination.pageSize',\n min: 1,\n max: 200,\n step: 1,\n }),\n nodeProperty({\n key: 'binding.refresh.afterCreate',\n kind: 'select',\n label: '新增或关联后',\n path: 'binding.refresh.afterCreate',\n options: relationRefreshOptions,\n }),\n nodeProperty({\n key: 'binding.refresh.afterUpdate',\n kind: 'select',\n label: '编辑后',\n path: 'binding.refresh.afterUpdate',\n options: relationRefreshOptions,\n }),\n nodeProperty({\n key: 'binding.refresh.afterDelete',\n kind: 'select',\n label: '解除或删除后',\n path: 'binding.refresh.afterDelete',\n options: relationRefreshOptions,\n }),\n]\n\nfunction createRelationOperationFields(\n operation: 'create' | 'attach' | 'update' | 'detach' | 'delete',\n label: string,\n): FieldPropertyField[] {\n const prefix = `binding.operations.${operation}`\n return [\n nodeProperty({\n key: `${prefix}.enabled`,\n kind: 'checkbox',\n label,\n path: `${prefix}.enabled`,\n }),\n nodeProperty({\n key: `${prefix}.title`,\n kind: 'text',\n label: '按钮文案',\n path: `${prefix}.title`,\n visible: operationEnabled(operation),\n }),\n nodeProperty({\n key: `${prefix}.placement`,\n kind: 'select',\n label: '按钮位置',\n path: `${prefix}.placement`,\n options: [\n { label: '工具栏', value: 'toolbar' },\n { label: '行操作', value: 'row' },\n ],\n visible: operationEnabled(operation),\n }),\n nodeProperty({\n key: `${prefix}.interaction.type`,\n kind: 'select',\n label: '交互方式',\n path: `${prefix}.interaction.type`,\n options: [\n { label: '表单', value: 'form' },\n { label: '选择资源', value: 'selection' },\n { label: '直接执行', value: 'direct' },\n { label: '自定义处理器', value: 'handler' },\n ],\n visible: operationEnabled(operation),\n }),\n nodeProperty({\n key: `${prefix}.interaction.form`,\n kind: 'select',\n label: '表单视图',\n path: `${prefix}.interaction.form`,\n clearable: true,\n options: [],\n dataSource: {\n provider: 'resources.views',\n params: { kind: 'form' },\n paramsFromValues: { resource: 'node.resource' },\n },\n visible: operationInteraction(operation, 'form'),\n }),\n nodeProperty({\n key: `${prefix}.interaction.mode`,\n kind: 'select',\n label: '表单状态',\n path: `${prefix}.interaction.mode`,\n options: [\n { label: '新增状态', value: 'create' },\n { label: '编辑当前行', value: 'edit' },\n ],\n visible: operationInteraction(operation, 'form'),\n }),\n nodeProperty({\n key: `${prefix}.interaction.table`,\n kind: 'select',\n label: '选择列表视图',\n path: `${prefix}.interaction.table`,\n clearable: true,\n options: [],\n dataSource: {\n provider: 'resources.views',\n params: { kind: 'table' },\n paramsFromValues: { resource: 'node.resource' },\n },\n visible: operationInteraction(operation, 'selection'),\n }),\n nodeProperty({\n key: `${prefix}.interaction.multiple`,\n kind: 'checkbox',\n label: '允许批量选择',\n path: `${prefix}.interaction.multiple`,\n visible: operationInteraction(operation, 'selection'),\n }),\n nodeProperty({\n key: `${prefix}.interaction.source`,\n kind: 'select',\n label: '候选范围',\n path: `${prefix}.interaction.source`,\n options: [\n { label: '当前已关联', value: 'related' },\n { label: '尚未关联', value: 'unassigned' },\n { label: '全部资源', value: 'all' },\n ],\n visible: operationInteraction(operation, 'selection'),\n }),\n nodeProperty({\n key: `${prefix}.interaction.handler`,\n kind: 'text',\n label: '交互处理器',\n tip: '由宿主 onAction 或 session action handler 完整处理前端交互。',\n path: `${prefix}.interaction.handler`,\n placeholder: 'order_item.openCustomFlow',\n visible: operationInteraction(operation, 'handler'),\n }),\n nodeProperty({\n key: `${prefix}.execution.type`,\n kind: 'select',\n label: '执行方式',\n path: `${prefix}.execution.type`,\n options: [\n { label: '资源操作', value: 'resource' },\n { label: '业务 Action', value: 'action' },\n ],\n visible: operationEnabled(operation),\n }),\n nodeProperty({\n key: `${prefix}.execution.action`,\n kind: 'text',\n label: '业务 Action',\n tip: '直接传给 DataAdapter.executeAction,不要求在目标资源 schema.actions 中声明。',\n path: `${prefix}.execution.action`,\n placeholder: 'order_item.customAction',\n visible: operationExecution(operation, 'action'),\n }),\n ]\n}\n\nfunction operationEnabled(operation: 'create' | 'attach' | 'update' | 'detach' | 'delete') {\n return ({ node }: FieldSchemaContext): boolean => {\n if (node.binding?.type !== 'relation-list') {\n return false\n }\n const config = node.binding.operations?.[operation]\n return Boolean(config && config.enabled !== false)\n }\n}\n\nfunction operationInteraction(\n operation: 'create' | 'attach' | 'update' | 'detach' | 'delete',\n type: 'form' | 'selection' | 'direct' | 'handler',\n) {\n return ({ node }: FieldSchemaContext): boolean => {\n if (node.binding?.type !== 'relation-list') {\n return false\n }\n const config = node.binding.operations?.[operation]\n return Boolean(\n config && config.enabled !== false && (config.interaction?.type ?? defaultInteraction(operation)) === type,\n )\n }\n}\n\nfunction operationExecution(\n operation: 'create' | 'attach' | 'update' | 'detach' | 'delete',\n type: 'resource' | 'action',\n) {\n return ({ node }: FieldSchemaContext): boolean => {\n if (node.binding?.type !== 'relation-list') {\n return false\n }\n const config = node.binding.operations?.[operation]\n return Boolean(config && config.enabled !== false && (config.execution?.type ?? 'resource') === type)\n }\n}\n\nfunction defaultInteraction(operation: 'create' | 'attach' | 'update' | 'detach' | 'delete') {\n if (operation === 'create' || operation === 'update') return 'form'\n if (operation === 'attach') return 'selection'\n return 'direct'\n}\n\n/** ResourceField 级通用属性声明,组件能力会进一步限制其可见范围。 */\nexport const fieldCommonFields: FieldPropertyField[] = [\n fieldProperty({\n key: 'field.name',\n kind: 'text',\n label: '字段名',\n tip: '接口数据和表单值使用这个名称。已有字段改名时,需要同步调整后端和已有数据。',\n path: 'name',\n }),\n fieldProperty({ key: 'field.label', kind: 'text', label: '字段标签', path: 'label' }),\n fieldProperty({\n key: 'field.type',\n kind: 'select',\n label: '数据类型',\n tip: '决定字段实际保存的单项值类型,不代表页面使用哪种控件。',\n path: 'type',\n options: [],\n }),\n fieldProperty({\n key: 'field.required',\n kind: 'checkbox',\n label: '必填',\n tip: '表示字段始终必填。有条件的必填规则请在校验规则中设置。',\n path: 'required',\n }),\n fieldProperty({\n key: 'field.readonly',\n kind: 'checkbox',\n label: '只读',\n tip: '字段可以查看,但不能在表单中修改。',\n path: 'readonly',\n }),\n fieldProperty({\n key: 'field.disabled',\n kind: 'checkbox',\n label: '禁用',\n tip: '控件不可操作,只影响当前界面,不代表后端禁止写入。',\n path: 'disabled',\n }),\n fieldProperty({\n key: 'field.multiple',\n kind: 'checkbox',\n label: '多值',\n tip: '开启后保存多个同类型值。JSON 数组本身是一个 JSON 值,不使用此开关。',\n path: 'multiple',\n }),\n fieldProperty({\n key: 'field.formable',\n kind: 'checkbox',\n label: '表单可用',\n tip: '决定自动生成表单时是否包含这个字段。显式配置的表单不受影响。',\n path: 'formable',\n }),\n fieldProperty({\n key: 'field.listable',\n kind: 'checkbox',\n label: '列表可见',\n tip: '决定自动生成列表时是否包含这个字段。显式配置的列表列不受影响。',\n path: 'listable',\n }),\n fieldProperty({\n key: 'field.searchable',\n kind: 'checkbox',\n label: '可搜索',\n tip: '决定自动生成搜索区域时是否包含这个字段。显式配置的搜索项不受影响。',\n path: 'searchable',\n }),\n]\n\n/** 字段基础信息分组的稳定 key。 */\nexport const fieldBasicFieldKeys = ['field.name', 'field.label', 'field.type']\n/** 字段状态分组的稳定 key。 */\nexport const fieldStateFieldKeys = ['field.required', 'field.readonly', 'field.disabled']\n\nfunction placeholderProperty(): FieldPropertyField {\n return componentProperty({ key: 'props.placeholder', kind: 'text', label: '占位提示', path: 'placeholder' })\n}\n\nfunction clearableProperty(): FieldPropertyField {\n return componentProperty({ key: 'props.clearable', kind: 'switch', label: '允许清空', path: 'clearable' })\n}\n\nfunction colorProperties(): FieldPropertyField[] {\n return [\n clearableProperty(),\n componentProperty({ key: 'props.showAlpha', kind: 'switch', label: '允许透明度', path: 'showAlpha' }),\n componentProperty({\n key: 'props.colorFormat',\n kind: 'select',\n label: '颜色格式',\n path: 'colorFormat',\n options: [\n { label: 'HEX', value: 'hex' },\n { label: 'RGB', value: 'rgb' },\n ],\n }),\n ]\n}\n\nfunction iconInputProperties(): FieldPropertyField[] {\n return [\n placeholderProperty(),\n clearableProperty(),\n componentProperty({\n key: 'props.namespace',\n kind: 'select',\n label: '图标命名空间',\n path: 'namespace',\n clearable: true,\n options: [],\n visible: ({ node, extensionContext }) =>\n typeof node.props?.namespace === 'string' || hasIconNamespaces(extensionContext?.icons),\n }),\n componentProperty({\n key: 'props.allowCustom',\n kind: 'switch',\n label: '允许自定义值',\n path: 'allowCustom',\n }),\n ]\n}\n\nfunction hasIconNamespaces(icons: NonNullable<FieldSchemaContext['extensionContext']>['icons']): boolean {\n return [...(icons?.entries() ?? [])].some(([, definition]) => Boolean(definition.namespace))\n}\n\nconst dateFormatPresets = [\n { label: '2026-07-14', value: 'YYYY-MM-DD' },\n { label: '2026/07/14', value: 'YYYY/MM/DD' },\n { label: '2026年07月14日', value: 'YYYY年MM月DD日' },\n]\nconst dateTimeFormatPresets = [\n { label: '2026-07-14 14:30:00', value: 'YYYY-MM-DD HH:mm:ss' },\n { label: '2026/07/14 14:30', value: 'YYYY/MM/DD HH:mm' },\n { label: '2026年07月14日 14:30', value: 'YYYY年MM月DD日 HH:mm' },\n]\nconst timeFormatPresets = [\n { label: '14:30:00', value: 'HH:mm:ss' },\n { label: '14:30', value: 'HH:mm' },\n]\n\nfunction dateTimeFormatProperty(\n key: 'props.format' | 'props.valueFormat',\n label: string,\n path: 'format' | 'valueFormat',\n presets: Array<{ label: string; value: string }>,\n valueFormat = false,\n): FieldPropertyField {\n return componentProperty({\n key,\n kind: 'text',\n label,\n tip: valueFormat\n ? '决定表单提交的字符串格式。只在字段数据类型为字符串时设置。'\n : '只改变页面显示格式,不改变表单提交的值。',\n path,\n component: 'designer.date-time-format-editor',\n props: { presets },\n visible: valueFormat ? ({ field }) => field?.type === 'string' : undefined,\n })\n}\n\nfunction rangePlaceholderProperties(): FieldPropertyField[] {\n return [\n componentProperty({\n key: 'props.startPlaceholder',\n kind: 'text',\n label: '开始提示',\n path: 'startPlaceholder',\n }),\n componentProperty({\n key: 'props.endPlaceholder',\n kind: 'text',\n label: '结束提示',\n path: 'endPlaceholder',\n }),\n componentProperty({\n key: 'props.rangeSeparator',\n kind: 'text',\n label: '范围分隔符',\n path: 'rangeSeparator',\n }),\n ]\n}\n\nfunction showWordLimitProperty(): FieldPropertyField {\n return componentProperty({ key: 'props.showWordLimit', kind: 'switch', label: '显示字数', path: 'showWordLimit' })\n}\n\nconst textComponentFields = [placeholderProperty(), clearableProperty(), showWordLimitProperty()]\nconst passwordComponentFields = [placeholderProperty(), clearableProperty()]\nconst textareaComponentFields = [\n placeholderProperty(),\n clearableProperty(),\n showWordLimitProperty(),\n componentProperty({ key: 'props.rows', kind: 'number', label: '行数', path: 'rows', min: 1, step: 1 }),\n componentProperty({ key: 'props.autosize', kind: 'switch', label: '自适应', path: 'autosize' }),\n]\nconst numberComponentFields = [\n placeholderProperty(),\n clearableProperty(),\n componentProperty({ key: 'props.min', kind: 'number', label: '最小值', path: 'min' }),\n componentProperty({ key: 'props.max', kind: 'number', label: '最大值', path: 'max' }),\n componentProperty({ key: 'props.step', kind: 'number', label: '步长', path: 'step' }),\n componentProperty({ key: 'props.precision', kind: 'number', label: '精度', path: 'precision', min: 0, step: 1 }),\n]\nconst sliderComponentFields = [\n componentProperty({ key: 'props.min', kind: 'number', label: '最小值', path: 'min' }),\n componentProperty({ key: 'props.max', kind: 'number', label: '最大值', path: 'max' }),\n componentProperty({ key: 'props.step', kind: 'number', label: '步长', path: 'step' }),\n]\nconst rateComponentFields = [\n componentProperty({ key: 'props.max', kind: 'number', label: '最大分值', path: 'max', min: 1 }),\n]\nconst switchComponentFields = [\n componentProperty({ key: 'props.activeText', kind: 'text', label: '启用文案', path: 'activeText' }),\n componentProperty({ key: 'props.inactiveText', kind: 'text', label: '停用文案', path: 'inactiveText' }),\n]\nconst selectComponentFields = [\n placeholderProperty(),\n clearableProperty(),\n componentProperty({ key: 'props.filterable', kind: 'switch', label: '可搜索', path: 'filterable' }),\n]\nconst dateComponentFields = [\n placeholderProperty(),\n clearableProperty(),\n dateTimeFormatProperty('props.format', '展示格式', 'format', dateFormatPresets),\n dateTimeFormatProperty('props.valueFormat', '提交格式', 'valueFormat', dateFormatPresets, true),\n]\nconst dateTimeComponentFields = [\n placeholderProperty(),\n clearableProperty(),\n dateTimeFormatProperty('props.format', '展示格式', 'format', dateTimeFormatPresets),\n dateTimeFormatProperty('props.valueFormat', '提交格式', 'valueFormat', dateTimeFormatPresets, true),\n]\nconst timeComponentFields = [\n placeholderProperty(),\n clearableProperty(),\n dateTimeFormatProperty('props.format', '展示格式', 'format', timeFormatPresets),\n dateTimeFormatProperty('props.valueFormat', '提交格式', 'valueFormat', timeFormatPresets, true),\n]\nconst dateRangeComponentFields = [\n ...rangePlaceholderProperties(),\n clearableProperty(),\n dateTimeFormatProperty('props.format', '展示格式', 'format', dateFormatPresets),\n]\nconst timeRangeComponentFields = [\n ...rangePlaceholderProperties(),\n clearableProperty(),\n dateTimeFormatProperty('props.format', '展示格式', 'format', timeFormatPresets),\n]\n\nconst richTextComponentFields = [\n componentProperty({\n key: 'props.editor',\n editLevel: 'capability',\n kind: 'select',\n label: '编辑器',\n path: 'editor',\n options: [\n { label: 'TinyMCE', value: 'tinymce' },\n { label: 'WangEditor', value: 'wang' },\n { label: 'Markdown', value: 'markdown' },\n { label: 'Editor.js', value: 'editorjs' },\n { label: 'Fallback', value: 'fallback' },\n ],\n }),\n componentProperty({\n key: 'props.height',\n editLevel: 'capability',\n kind: 'number',\n label: '编辑高度',\n path: 'height',\n min: 120,\n step: 10,\n }),\n componentProperty({\n key: 'props.toolbar.mode',\n editLevel: 'capability',\n kind: 'select',\n label: '工具栏',\n path: 'toolbar.mode',\n options: [\n { label: '默认', value: 'default' },\n { label: '简洁', value: 'simple' },\n { label: '完整', value: 'full' },\n { label: '自定义', value: 'custom' },\n ],\n }),\n componentProperty({\n key: 'props.toolbar.sticky',\n editLevel: 'capability',\n kind: 'switch',\n label: '工具吸顶',\n path: 'toolbar.sticky',\n }),\n componentProperty({\n key: 'props.toolbar.stickyOffset',\n editLevel: 'capability',\n kind: 'number',\n label: '吸顶偏移',\n path: 'toolbar.stickyOffset',\n min: 0,\n step: 1,\n }),\n componentProperty({\n key: 'props.editorProps',\n editLevel: 'extension',\n migrationOwner: 'extension',\n kind: 'json',\n label: '扩展配置',\n path: 'editorProps',\n rows: 6,\n placeholder: '{\"init\":{\"statusbar\":true}}',\n }),\n]\n\nconst uploadComponentFields = [\n componentProperty({\n key: 'props.valueMode',\n editLevel: 'capability',\n kind: 'select',\n label: '值模式',\n tip: '决定保存 URL、资源 ID 还是完整资源对象。切换后字段的数据类型会随之调整。',\n path: 'valueMode',\n options: [\n { label: 'URL', value: 'url' },\n { label: '资源 ID', value: 'id' },\n { label: '资源', value: 'asset' },\n ],\n }),\n componentProperty({\n key: 'props.limit',\n editLevel: 'capability',\n kind: 'number',\n label: '数量限制',\n path: 'limit',\n min: 0,\n step: 1,\n placeholder: '0 表示不限制',\n visible: ({ node }) => node.props?.multiple === true,\n }),\n componentProperty({\n key: 'props.accept',\n editLevel: 'capability',\n kind: 'text',\n label: '文件类型',\n path: 'accept',\n placeholder: '例如 image/*,.pdf',\n }),\n componentProperty({\n key: 'props.maxSize',\n editLevel: 'capability',\n kind: 'number',\n label: '单文件上限(字节)',\n path: 'maxSize',\n min: 0,\n step: 1,\n placeholder: '0 表示不限制',\n }),\n componentProperty({\n key: 'props.multiple',\n editLevel: 'capability',\n kind: 'switch',\n label: '允许多选',\n tip: '允许一次选择多个资源。最终保存的值结构还取决于值模式。',\n path: 'multiple',\n }),\n componentProperty({\n key: 'props.editableTitle',\n editLevel: 'capability',\n kind: 'switch',\n label: '编辑标题',\n path: 'editableTitle',\n }),\n componentProperty({\n key: 'props.uploadText',\n editLevel: 'capability',\n kind: 'text',\n label: '上传文案',\n path: 'uploadText',\n }),\n componentProperty({\n key: 'props.pickText',\n editLevel: 'capability',\n kind: 'text',\n label: '选择文案',\n path: 'pickText',\n }),\n componentProperty({\n key: 'props.writeBack',\n editLevel: 'extension',\n migrationOwner: 'extension',\n kind: 'json',\n label: '回写规则',\n path: 'writeBack',\n rows: 6,\n placeholder: '[{\"from\":\"asset.metadata.coverUrl\",\"to\":\"cover_url\",\"strategy\":\"empty\",\"events\":[\"upload\"]}]',\n }),\n]\n\nconst jsonComponentFields = [\n componentProperty({ key: 'props.rows', kind: 'number', label: '编辑行数', path: 'rows', min: 2, step: 1 }),\n componentProperty({ key: 'props.indent', kind: 'number', label: '缩进', path: 'indent', min: 0, step: 1 }),\n componentProperty({ key: 'props.formatOnBlur', kind: 'switch', label: '失焦格式', path: 'formatOnBlur' }),\n componentProperty({\n key: 'props.emptyValue',\n editLevel: 'extension',\n migrationOwner: 'extension',\n kind: 'json',\n label: '空值结构',\n path: 'emptyValue',\n rows: 4,\n placeholder: '{}',\n }),\n]\n\n/** 返回每个 Designer 实例安装到 builtin 层的组件属性贡献。 */\nexport function createBuiltInDesignerComponentProperties(): DesignerComponentPropertyConfig[] {\n const baseCapabilities: DesignerCapabilityCardKey[] = [designerCapabilityCardKeys.interactionRules]\n const validatedCapabilities: DesignerCapabilityCardKey[] = [\n designerCapabilityCardKeys.validationRules,\n designerCapabilityCardKeys.interactionRules,\n ]\n const choiceCapabilities: DesignerCapabilityCardKey[] = [\n designerCapabilityCardKeys.validationRules,\n designerCapabilityCardKeys.optionSource,\n designerCapabilityCardKeys.interactionRules,\n ]\n const computedCapabilities = [designerCapabilityCardKeys.valueStrategy, ...validatedCapabilities]\n const dynamicCapabilities = [designerCapabilityCardKeys.valueStrategy, ...validatedCapabilities]\n const textFieldCapabilities: DesignerComponentFieldCapability[] = [\n designerFieldCapabilityKeys.listable,\n designerFieldCapabilityKeys.searchable,\n ]\n const flexibleMultipleFieldCapabilities: DesignerComponentFieldCapability[] = [\n designerFieldCapabilityKeys.multiple,\n designerFieldCapabilityKeys.listable,\n designerFieldCapabilityKeys.searchable,\n ]\n const uploadFieldCapabilities: DesignerComponentFieldCapability[] = [designerFieldCapabilityKeys.listable]\n const noValueStrategies: DesignerValueStrategyMode[] = []\n const computedStrategies: DesignerValueStrategyMode[] = ['computed']\n const dynamicStrategies: DesignerValueStrategyMode[] = ['dynamic']\n const noOptionSources: DesignerOptionSourceMode[] = []\n const choiceOptionSources: DesignerOptionSourceMode[] = ['static', 'dictionary', 'reference']\n const compactChoiceOptionSources: DesignerOptionSourceMode[] = ['static', 'dictionary']\n\n return [\n componentConfig('text', '单行文本', textComponentFields, {\n group: 'text-input',\n fieldCapabilities: textFieldCapabilities,\n defaultValue: 'inline',\n valueStrategies: computedStrategies,\n optionSources: noOptionSources,\n validation: ['required', 'format', 'min_length', 'max_length', 'pattern'],\n capabilities: [...computedCapabilities, designerCapabilityCardKeys.inputSlots],\n }),\n componentConfig('password', '密码框', passwordComponentFields, {\n group: 'text-input',\n fieldCapabilities: textFieldCapabilities,\n defaultValue: 'none',\n valueStrategies: noValueStrategies,\n optionSources: noOptionSources,\n validation: ['required', 'complexity'],\n capabilities: [...validatedCapabilities, designerCapabilityCardKeys.inputSlots],\n }),\n componentConfig('textarea', '多行文本', textareaComponentFields, {\n group: 'text-input',\n fieldCapabilities: textFieldCapabilities,\n defaultValue: 'inline',\n valueStrategies: computedStrategies,\n optionSources: noOptionSources,\n validation: ['required', 'min_length', 'max_length', 'pattern'],\n capabilities: computedCapabilities,\n }),\n componentConfig('number', '数字', numberComponentFields, {\n fieldCapabilities: textFieldCapabilities,\n defaultValue: 'inline',\n valueStrategies: computedStrategies,\n optionSources: noOptionSources,\n validation: ['required', 'min', 'max'],\n capabilities: computedCapabilities,\n }),\n componentConfig('slider', '滑块', sliderComponentFields, {\n fieldCapabilities: textFieldCapabilities,\n defaultValue: 'inline',\n valueStrategies: computedStrategies,\n optionSources: noOptionSources,\n validation: ['required', 'min', 'max'],\n capabilities: computedCapabilities,\n }),\n componentConfig('rate', '评分', rateComponentFields, {\n fieldCapabilities: textFieldCapabilities,\n defaultValue: 'inline',\n valueStrategies: computedStrategies,\n optionSources: noOptionSources,\n validation: ['required', 'min', 'max'],\n capabilities: computedCapabilities,\n }),\n componentConfig('switch', '开关', switchComponentFields, {\n fieldCapabilities: textFieldCapabilities,\n defaultValue: 'inline',\n valueStrategies: noValueStrategies,\n optionSources: noOptionSources,\n capabilities: baseCapabilities,\n }),\n componentConfig('select', '下拉', selectComponentFields, {\n group: 'single-choice',\n fieldCapabilities: textFieldCapabilities,\n defaultValue: 'inline',\n valueStrategies: noValueStrategies,\n optionSources: choiceOptionSources,\n validation: ['required'],\n capabilities: choiceCapabilities,\n }),\n componentConfig('multi-select', '下拉多选', selectComponentFields, {\n group: 'multiple-choice',\n fieldCapabilities: textFieldCapabilities,\n defaultValue: 'inline',\n valueStrategies: noValueStrategies,\n optionSources: choiceOptionSources,\n validation: ['required'],\n capabilities: choiceCapabilities,\n }),\n componentConfig('select-tree', '树选择', selectComponentFields, {\n fieldCapabilities: flexibleMultipleFieldCapabilities,\n defaultValue: 'inline',\n valueStrategies: noValueStrategies,\n optionSources: choiceOptionSources,\n validation: ['required'],\n capabilities: choiceCapabilities,\n }),\n componentConfig('cascader', '级联选择', selectComponentFields, {\n fieldCapabilities: flexibleMultipleFieldCapabilities,\n defaultValue: 'inline',\n valueStrategies: noValueStrategies,\n optionSources: choiceOptionSources,\n validation: ['required'],\n capabilities: choiceCapabilities,\n }),\n componentConfig('radio', '单选', [], {\n group: 'single-choice',\n fieldCapabilities: textFieldCapabilities,\n defaultValue: 'inline',\n valueStrategies: noValueStrategies,\n optionSources: compactChoiceOptionSources,\n validation: ['required'],\n capabilities: choiceCapabilities,\n }),\n componentConfig('checkbox', '多选', [], {\n group: 'multiple-choice',\n fieldCapabilities: textFieldCapabilities,\n defaultValue: 'inline',\n valueStrategies: noValueStrategies,\n optionSources: compactChoiceOptionSources,\n validation: ['required'],\n capabilities: choiceCapabilities,\n }),\n componentConfig('date-picker', '日期', dateComponentFields, {\n group: 'single-date-time',\n fieldCapabilities: textFieldCapabilities,\n defaultValue: 'inline',\n valueStrategies: dynamicStrategies,\n optionSources: noOptionSources,\n validation: ['required', 'min', 'max'],\n capabilities: dynamicCapabilities,\n }),\n componentConfig('datetime-picker', '日期时间', dateTimeComponentFields, {\n group: 'single-date-time',\n fieldCapabilities: textFieldCapabilities,\n defaultValue: 'inline',\n valueStrategies: dynamicStrategies,\n optionSources: noOptionSources,\n validation: ['required', 'min', 'max'],\n capabilities: dynamicCapabilities,\n }),\n componentConfig('time-picker', '时间', timeComponentFields, {\n group: 'single-date-time',\n fieldCapabilities: textFieldCapabilities,\n defaultValue: 'inline',\n valueStrategies: dynamicStrategies,\n optionSources: noOptionSources,\n validation: ['required', 'min', 'max'],\n capabilities: dynamicCapabilities,\n }),\n componentConfig('date-range-picker', '日期范围', dateRangeComponentFields, {\n group: 'range-date-time',\n fieldCapabilities: textFieldCapabilities,\n defaultValue: 'inline',\n valueStrategies: noValueStrategies,\n optionSources: noOptionSources,\n validation: ['required', 'range'],\n capabilities: validatedCapabilities,\n }),\n componentConfig('time-range-picker', '时间范围', timeRangeComponentFields, {\n group: 'range-date-time',\n fieldCapabilities: textFieldCapabilities,\n defaultValue: 'inline',\n valueStrategies: noValueStrategies,\n optionSources: noOptionSources,\n validation: ['required', 'range'],\n capabilities: validatedCapabilities,\n }),\n componentConfig('color', '颜色', colorProperties(), {\n fieldCapabilities: textFieldCapabilities,\n defaultValue: 'inline',\n valueStrategies: noValueStrategies,\n optionSources: noOptionSources,\n validation: ['required', 'format'],\n capabilities: [...validatedCapabilities, designerCapabilityCardKeys.colorPalette],\n }),\n componentConfig('rich-text', '富文本', richTextComponentFields, {\n fieldCapabilities: textFieldCapabilities,\n defaultValue: 'dialog',\n valueStrategies: noValueStrategies,\n optionSources: noOptionSources,\n capabilities: [...baseCapabilities, designerCapabilityCardKeys.richTextSettings],\n }),\n componentConfig('json-editor', 'JSON', jsonComponentFields, {\n fieldCapabilities: textFieldCapabilities,\n defaultValue: 'dialog',\n valueStrategies: noValueStrategies,\n optionSources: noOptionSources,\n capabilities: baseCapabilities,\n }),\n componentConfig('key-value', '键值对', jsonComponentFields, {\n fieldCapabilities: textFieldCapabilities,\n defaultValue: 'dialog',\n valueStrategies: noValueStrategies,\n optionSources: noOptionSources,\n capabilities: baseCapabilities,\n }),\n componentConfig('icon-input', '图标', iconInputProperties(), {\n fieldCapabilities: textFieldCapabilities,\n defaultValue: 'inline',\n valueStrategies: noValueStrategies,\n optionSources: noOptionSources,\n validation: ['required'],\n capabilities: baseCapabilities,\n }),\n componentConfig('image-upload', '图片上传', uploadComponentFields, {\n fieldCapabilities: uploadFieldCapabilities,\n defaultValue: 'dialog',\n valueStrategies: noValueStrategies,\n optionSources: noOptionSources,\n validation: ['required'],\n capabilities: [\n ...baseCapabilities,\n designerCapabilityCardKeys.validationRules,\n designerCapabilityCardKeys.uploadSettings,\n ],\n }),\n componentConfig('file-upload', '文件上传', uploadComponentFields, {\n fieldCapabilities: uploadFieldCapabilities,\n defaultValue: 'dialog',\n valueStrategies: noValueStrategies,\n optionSources: noOptionSources,\n validation: ['required'],\n capabilities: [\n ...baseCapabilities,\n designerCapabilityCardKeys.validationRules,\n designerCapabilityCardKeys.uploadSettings,\n ],\n }),\n ]\n}\n\ntype BuiltInProfileConfig = Omit<DesignerComponentCapabilityProfile, 'fieldTypes' | 'multiple' | 'validation'> & {\n group?: string\n validation?: string[]\n}\n\nfunction componentConfig(\n component: string,\n label: string,\n props: FieldPropertyField[],\n config: BuiltInProfileConfig,\n): DesignerComponentPropertyConfig {\n const fieldTypes = getComponentFieldConfig(component)\n return {\n component,\n option: { label, value: component, group: config.group },\n props,\n profile: {\n fieldTypes: {\n defaultType: fieldTypes.defaultType,\n allowedTypes: [...fieldTypes.allowedTypes],\n },\n multiple: fieldTypes.multiple,\n fieldCapabilities: [...config.fieldCapabilities],\n defaultValue: config.defaultValue,\n valueStrategies: [...config.valueStrategies],\n optionSources: [...config.optionSources],\n validation: config.validation ? { supported: [...config.validation] } : undefined,\n capabilities: [...config.capabilities],\n },\n }\n}\n","import type { ResourceField, ViewNode } from '@sparqjs/schema-protocol'\nimport type { DesignerComponentFieldTypeConfig, DesignerMultiplePolicy } from '../../state/component-config'\nimport type { FieldPropertyField } from './types'\nimport type { DesignerComponentFieldCapability } from './keys'\nimport type { DesignerCapabilityCardKey } from '../capabilities'\nimport { createBuiltInDesignerComponentProperties } from './fields'\n\n/**\n * 设计器组件在右侧“展示组件”下拉中的描述。\n *\n * group 用于控制哪些组件可以在同一个字段节点上互相切换。切换组不是组件分类展示,\n * 而是数据结构兼容边界,例如 text/password/textarea 都能共享 string 字段。\n */\nexport interface DesignerComponentOption {\n label: string\n value: string\n group?: string\n}\n\n/** 组件支持的校验规则类型及可选私有编辑器。 */\nexport interface DesignerComponentValidationConfig {\n supported: string[]\n editor?: string\n}\n\n/** 默认值在 Inspector 中的编辑方式。 */\nexport type DesignerDefaultValueEditor = 'inline' | 'dialog' | 'none'\n\n/** 复杂取值逻辑编辑器允许用户选择的模式。 */\nexport type DesignerValueStrategyMode = 'dynamic' | 'computed'\n\n/** 数据选项编辑器允许用户选择的候选来源。 */\nexport type DesignerOptionSourceMode = 'static' | 'dictionary' | 'reference'\n\nexport type { DesignerMultiplePolicy } from '../../state/component-config'\n\n/**\n * 组件字段能力的单一声明来源。\n *\n * Profile 只约束 Designer 可编辑能力,不写入业务 schema。组件迁移、属性面板和能力编辑器\n * 必须读取同一个 Profile,不能再按组件名称分别推导类型、基数或允许模式。\n */\nexport interface DesignerComponentCapabilityProfile {\n fieldTypes: DesignerComponentFieldTypeConfig\n multiple: DesignerMultiplePolicy\n fieldCapabilities: DesignerComponentFieldCapability[]\n defaultValue: DesignerDefaultValueEditor\n valueStrategies: DesignerValueStrategyMode[]\n optionSources: DesignerOptionSourceMode[]\n validation?: DesignerComponentValidationConfig\n capabilities: DesignerCapabilityCardKey[]\n}\n\n/** 迁移摘要中的单项协议变化,用于确认弹层而不是直接执行。 */\nexport interface DesignerComponentMigrationChange {\n action: 'add' | 'change' | 'remove' | 'preserve'\n target: 'node' | 'field'\n path: string\n label: string\n before?: unknown\n after?: unknown\n}\n\n/** 组件迁移器获得的源数据、当前计划副本和已检测变化。 */\nexport interface DesignerComponentMigrationContext {\n sourceComponent: string\n targetComponent: string\n sourceNode: ViewNode\n sourceField?: ResourceField\n node: ViewNode\n field?: ResourceField\n fields: ResourceField[]\n changes: DesignerComponentMigrationChange[]\n}\n\n/** 扩展迁移器返回的新节点、字段和额外确认信息。 */\nexport interface DesignerComponentMigrationResult {\n node: ViewNode\n field?: ResourceField\n changes?: DesignerComponentMigrationChange[]\n requiresConfirmation?: boolean\n}\n\n/**\n * 目标组件拥有迁入规则。迁移器只返回新的计划数据,不直接修改设计器状态或 history。\n */\nexport type DesignerComponentMigrator = (context: DesignerComponentMigrationContext) => DesignerComponentMigrationResult\n\n/**\n * 单个设计器组件的属性能力声明。\n *\n * props 声明轻量属性和组件级 capability 配置,capabilities 引用复合能力卡。\n * migration 只处理迁入当前组件时的特殊协议转换。\n */\nexport interface DesignerComponentPropertyConfig {\n component: string\n option?: DesignerComponentOption\n props?: FieldPropertyField[]\n profile?: DesignerComponentCapabilityProfile\n dataSource?: FieldPropertyField[]\n advanced?: FieldPropertyField[]\n migration?: DesignerComponentMigrator\n}\n\n/** 文本输入类组件共享少量迁移规则,不能泛化到所有 string 组件。 */\nexport const textInputComponents = new Set(['text', 'password', 'textarea'])\n\n/** 读取设计器内置组件属性;插件组件必须通过当前实例的 DesignerExtensionContext 查询。 */\nexport function getDesignerComponentPropertyConfig(\n component: string | undefined,\n): DesignerComponentPropertyConfig | undefined {\n if (!component) {\n return undefined\n }\n\n return createBuiltInDesignerComponentProperties().find((config) => config.component === component)\n}\n\n/** 返回每个设计器实例安装到 builtin 层的完整组件属性定义。 */\nexport function listDesignerComponentPropertyConfigs(): DesignerComponentPropertyConfig[] {\n return createBuiltInDesignerComponentProperties()\n}\n\n/** 按兼容分组列出内置组件切换选项,不包含任何实例扩展。 */\nexport function listDesignerComponentOptions(group?: string): DesignerComponentOption[] {\n return listDesignerComponentPropertyConfigs()\n .map((config) => config.option)\n .filter((option): option is DesignerComponentOption => Boolean(option))\n .filter((option) => option.group === group)\n}\n","import type { ResourceField, ViewNode } from '@sparqjs/schema-protocol'\nimport type { DesignerExtensionContext } from '../../extensions/context'\nimport { isFieldTypeCompatibleWithComponent, isFieldTypeLocked } from '../../state/component-config'\nimport { getDesignerComponentPropertyConfig, listDesignerComponentOptions, textInputComponents } from './registry'\n\n// 组件选项只描述“当前字段节点能安全切换到哪些展示组件”。\n// 可切换范围来自 registry 的 group,避免把字段切到数据类型或校验规则不兼容的组件。\nexport { textInputComponents }\n\n/** 根据组件兼容分组返回当前节点可安全切换的展示组件。 */\nexport function componentOptionsForNode(\n node: ViewNode,\n field?: ResourceField,\n extensionContext?: DesignerExtensionContext,\n): Array<{ label: string; value: string }> {\n const component = resolveNodeComponent(node)\n const config =\n extensionContext?.getComponentPropertyConfig(component) ?? getDesignerComponentPropertyConfig(component)\n const group = config?.option?.group\n const groupedOptions = group\n ? (extensionContext?.listComponentOptions(group) ?? listDesignerComponentOptions(group))\n : config?.option\n ? [config.option]\n : []\n const options = isFieldTypeLocked(field)\n ? groupedOptions.filter((option) => {\n if (option.value === component) {\n return true\n }\n const optionConfig =\n extensionContext?.getComponentPropertyConfig(option.value) ??\n getDesignerComponentPropertyConfig(option.value)\n return isFieldTypeCompatibleWithComponent(option.value, field, optionConfig?.profile?.fieldTypes)\n })\n : groupedOptions\n\n if (options.length) {\n return options.map(({ label, value }) => ({ label, value }))\n }\n\n // 未注册组件保留当前值,避免扩展暂时缺失时丢失节点配置。\n return [{ label: component || '默认', value: component }]\n}\n\n/** 解析节点实际组件;字段节点未声明 component 时使用 text。 */\nexport function resolveNodeComponent(node: ViewNode): string {\n if (node.component) {\n return node.component\n }\n\n return node.type === 'field' ? 'text' : ''\n}\n\n/** 只有布局与容器节点显示协议 name,字段和 view 使用各自业务标识。 */\nexport function shouldShowNodeName(node: ViewNode): boolean {\n return node.type !== 'field' && node.type !== 'view'\n}\n","import type { OptionValue } from '@sparqjs/schema-protocol'\nimport {\n fieldTypeOptionsForComponent,\n isFieldTypeLocked,\n shouldShowFieldTypeForComponent,\n} from '../../state/component-config'\nimport { type FieldPropertyField, type FieldSchemaContext, type FieldSchemaSection } from './types'\nimport {\n componentOptionsForNode,\n resolveNodeComponent,\n shouldShowNodeName,\n textInputComponents,\n} from './component-options'\nimport {\n fieldBasicFieldKeys,\n fieldStateFieldKeys,\n fieldCommonFields,\n nodeBasicFieldKeys,\n nodeCommonFields,\n nodeLayoutFieldKeys,\n nodeItemsFieldKeys,\n relationListFields,\n} from './fields'\nimport { getDesignerComponentPropertyConfig } from './registry'\nimport type { DesignerComponentFieldCapability } from './keys'\nimport {\n designerCapabilityCardKeys,\n listDesignerCapabilityCards,\n type DesignerCapabilityCardKey,\n} from '../capabilities'\nimport { getRequiredValidationRule } from '../required-validation'\n\n/**\n * 根据当前选中节点生成右侧字段属性分组。\n *\n * 本层只负责“哪些分组在当前上下文出现”,具体属性定义来自 fields,组件和能力卡由\n * DesignerExtensionContext 解析。插件新增组件时只提供扩展声明,不需要修改核心组装流程。\n */\nexport function createFieldSchemaSections(context: FieldSchemaContext): FieldSchemaSection[] {\n if (context.node.binding?.type === 'relation-list') {\n return createRelationListSections(context)\n }\n\n const component = resolveNodeComponent(context.node)\n const componentFields = createComponentFields(context, component)\n const capabilityFields = createCapabilityFields(context, component)\n const componentCapabilityFields = capabilityFields.filter(isComponentSettingsCapability)\n const dataCapabilityFields = capabilityFields.filter((field) =>\n ['value', 'validation', 'data'].includes(capabilityGroup(field) ?? ''),\n )\n const interactionCapabilityFields = capabilityFields.filter((field) => capabilityGroup(field) === 'interaction')\n const advancedCapabilityFields = capabilityFields.filter(\n (field) => capabilityGroup(field) === 'advanced' && !isComponentSettingsCapability(field),\n )\n const sections: FieldSchemaSection[] = []\n\n if (context.field) {\n pushSection(sections, context, {\n key: 'basic',\n title: '基础信息',\n fields: [\n ...createFieldCommonFields(context, fieldsByKey(fieldCommonFields, fieldBasicFieldKeys)),\n ...createDefaultValueFields(context, component),\n ...createFieldStateFields(context),\n ],\n })\n\n pushSection(sections, context, {\n key: 'layout',\n title: '显示与布局',\n fields: [\n ...createNodeComponentFields(context),\n ...componentFields,\n ...componentCapabilityFields,\n ...createNodeLayoutFields(context),\n ],\n })\n\n pushSection(sections, context, {\n key: 'data-validation',\n title: '数据与校验',\n fields: [...createFieldCapabilitySettings(context), ...dataCapabilityFields],\n })\n } else {\n pushSection(sections, context, {\n key: 'basic',\n title: '基础信息',\n fields: createNodeInformationFields(context),\n })\n\n pushSection(sections, context, {\n key: 'items',\n title: '项目管理',\n fields: createNodeItemsFields(context),\n })\n\n pushSection(sections, context, {\n key: 'layout',\n title: '显示与布局',\n fields: [\n ...createNodeComponentFields(context),\n ...componentFields,\n ...componentCapabilityFields,\n ...createNodeLayoutFields(context),\n ],\n })\n }\n\n pushSection(sections, context, {\n key: 'interaction',\n title: '交互与高级',\n fields: [...interactionCapabilityFields, ...advancedCapabilityFields],\n })\n\n return sections\n}\n\nfunction createRelationListSections(context: FieldSchemaContext): FieldSchemaSection[] {\n const sections: FieldSchemaSection[] = []\n pushSection(sections, context, {\n key: 'basic',\n title: '基础信息',\n fields: createNodeInformationFields(context),\n })\n pushSection(sections, context, {\n key: 'relation',\n title: '目标与关系',\n fields: relationFieldsByKeys([\n 'node.resource',\n 'node.view',\n 'binding.relation',\n 'binding.relationType',\n 'binding.parentKey',\n 'binding.foreignKey',\n 'binding.requireParent',\n 'binding.whenParentMissing',\n ]),\n })\n pushSection(sections, context, {\n key: 'relation-create',\n title: '新增与选择',\n fields: relationFieldsByPrefixes(['binding.operations.create.', 'binding.operations.attach.']),\n })\n pushSection(sections, context, {\n key: 'relation-manage',\n title: '编辑与移除',\n fields: relationFieldsByPrefixes([\n 'binding.operations.update.',\n 'binding.operations.detach.',\n 'binding.operations.delete.',\n ]),\n })\n pushSection(sections, context, {\n key: 'relation-runtime',\n title: '分页与刷新',\n fields: relationFieldsByPrefixes(['binding.pagination.', 'binding.refresh.']),\n })\n pushSection(sections, context, {\n key: 'layout',\n title: '显示与布局',\n fields: createNodeLayoutFields(context),\n })\n return sections\n}\n\nfunction relationFieldsByKeys(keys: string[]): FieldPropertyField[] {\n return keys\n .map((key) => relationListFields.find((field) => field.key === key))\n .filter((field): field is FieldPropertyField => Boolean(field))\n}\n\nfunction relationFieldsByPrefixes(prefixes: string[]): FieldPropertyField[] {\n return relationListFields.filter((field) => prefixes.some((prefix) => field.key.startsWith(prefix)))\n}\n\nfunction createComponentFields(context: FieldSchemaContext, component: string): FieldPropertyField[] {\n const componentConfig = resolveComponentConfig(context, component)\n return (componentConfig?.props ?? [])\n .filter((field) => field.editLevel === 'inline' && !isComputedManualInputProperty(context, field))\n .map((field) => withInstancePropertyOptions(context, field))\n}\n\nfunction withInstancePropertyOptions(context: FieldSchemaContext, field: FieldPropertyField): FieldPropertyField {\n if (field.key !== 'props.namespace' || field.kind !== 'select') {\n return field\n }\n const namespaces = new Set(\n [...(context.extensionContext?.icons?.entries() ?? [])]\n .map(([, definition]) => definition.namespace)\n .filter((namespace): namespace is string => Boolean(namespace)),\n )\n const current = context.node.props?.namespace\n if (typeof current === 'string' && current) {\n namespaces.add(current)\n }\n return {\n ...field,\n options: [...namespaces].sort().map((namespace) => ({ label: namespace, value: namespace })),\n }\n}\n\nfunction isComputedManualInputProperty(context: FieldSchemaContext, field: FieldPropertyField): boolean {\n return Boolean(\n context.field?.computed_expr && (field.key === 'props.placeholder' || field.key === 'props.clearable'),\n )\n}\n\nfunction pushSection(sections: FieldSchemaSection[], context: FieldSchemaContext, section: FieldSchemaSection): void {\n const fields = filterVisible(section.fields, context)\n if (!fields.length) {\n return\n }\n\n sections.push({\n ...section,\n fields,\n })\n}\n\nfunction createNodeLayoutFields(context: FieldSchemaContext): FieldPropertyField[] {\n return fieldsByKey(\n nodeCommonFields,\n nodeLayoutFieldKeys.filter(\n (key) =>\n key === 'node.span' ||\n key === 'node.gap' ||\n key === 'node.shadow' ||\n (context.field && (key === 'node.tip' || key === 'node.help')),\n ),\n ).filter((field) => field.editLevel === 'inline')\n}\n\nfunction createNodeInformationFields(context: FieldSchemaContext): FieldPropertyField[] {\n return [\n ...createNodeBasicFields(context).filter((field) => field.key !== 'node.component'),\n ...fieldsByKey(nodeCommonFields, ['node.title', 'node.help']).filter((field) => field.editLevel === 'inline'),\n ]\n}\n\nfunction createNodeComponentFields(context: FieldSchemaContext): FieldPropertyField[] {\n return createNodeBasicFields(context).filter((field) => field.key === 'node.component')\n}\n\nfunction createNodeItemsFields(context: FieldSchemaContext): FieldPropertyField[] {\n if (context.node.type !== 'tabs' && context.node.type !== 'collapse') {\n return []\n }\n return fieldsByKey(nodeCommonFields, nodeItemsFieldKeys).map((field) => ({\n ...field,\n props: {\n ...(field.props ?? {}),\n containerItems: {\n containerType: context.node.type,\n },\n },\n }))\n}\n\nfunction filterVisible(fields: FieldPropertyField[], context: FieldSchemaContext): FieldPropertyField[] {\n return fields.filter((field) => (field.visible ? field.visible(context) : true))\n}\n\nfunction fieldsByKey(fields: FieldPropertyField[], keys: string[]): FieldPropertyField[] {\n return keys\n .map((key) => fields.find((field) => field.key === key))\n .filter((field): field is FieldPropertyField => Boolean(field))\n}\n\nfunction capabilityGroup(field: FieldPropertyField): string | undefined {\n return (field.props?.capability as { group?: string } | undefined)?.group\n}\n\nfunction isComponentSettingsCapability(field: FieldPropertyField): boolean {\n return (\n field.capability === designerCapabilityCardKeys.uploadSettings ||\n field.capability === designerCapabilityCardKeys.richTextSettings ||\n field.capability === designerCapabilityCardKeys.colorPalette\n )\n}\n\nfunction createCapabilityFields(context: FieldSchemaContext, component: string): FieldPropertyField[] {\n const config = resolveComponentConfig(context, component)\n const capabilityKeys = resolveComponentCapabilities(config)\n const cards =\n capabilityKeys.length === 0\n ? []\n : (context.extensionContext?.listCapabilityCards(capabilityKeys) ??\n listDesignerCapabilityCards(capabilityKeys))\n\n return cards.flatMap((card) => {\n const summary = card.summary(context)\n if (card.visible && !card.visible(context)) {\n return []\n }\n const field = card.field\n return {\n ...field,\n capability: card.key,\n label: card.title,\n props: {\n ...(field.props ?? {}),\n settings:\n field.props?.settingsLevel === 'capability'\n ? config?.props?.filter((item) => item.editLevel === 'capability')\n : undefined,\n capability: {\n key: card.key,\n group: card.group,\n affectedPaths: card.affectedPaths,\n summary,\n },\n node: context.node,\n field: context.field,\n fields: context.fields ?? [],\n component,\n supported: config?.profile?.validation?.supported,\n valueStrategies: config?.profile?.valueStrategies ?? [],\n optionSources: config?.profile?.optionSources ?? [],\n fieldLabel: context.field?.label ?? context.node.title ?? context.node.field,\n },\n }\n })\n}\n\nfunction resolveComponentCapabilities(\n config: ReturnType<typeof getDesignerComponentPropertyConfig>,\n): DesignerCapabilityCardKey[] {\n return (config?.profile?.capabilities ?? []).filter(\n (capability) => capability !== designerCapabilityCardKeys.advancedConfig,\n )\n}\n\nfunction createDefaultValueFields(context: FieldSchemaContext, component: string): FieldPropertyField[] {\n const field = context.field\n if (!field) {\n return []\n }\n\n const config = resolveComponentConfig(context, component)\n const editor = config?.profile?.defaultValue\n if (!editor || editor === 'none') {\n return []\n }\n\n const configured = Object.prototype.hasOwnProperty.call(field, 'default')\n const inline = editor === 'inline'\n const definition = defaultValuePropertyDefinition(context, component, inline)\n\n return [\n {\n ...definition,\n storage: { target: 'field', path: 'default' },\n editLevel: 'inline',\n commitMode: editor === 'dialog' ? 'confirm' : definition.commitMode,\n migrationOwner: 'schema',\n key: 'field.default',\n label: '默认值',\n component: inline ? definition.component : 'designer.default-value-editor',\n props: inline\n ? definition.props\n : {\n defaultValueEditor: {\n mode: 'dialog',\n component,\n nodeProps: context.node.props ?? {},\n field,\n configured,\n upload: component === 'image-upload' || component === 'file-upload',\n },\n },\n } as FieldPropertyField,\n ]\n}\n\nfunction defaultValuePropertyDefinition(\n context: FieldSchemaContext,\n component: string,\n inline: boolean,\n): DefaultValuePropertyDefinition {\n const sourceProps: Record<string, unknown> = { ...(context.node.props ?? {}), clearable: true }\n if (component === 'text' || component === 'textarea') {\n sourceProps.showWordLimit = false\n }\n if (!inline) {\n return {\n kind: 'json',\n commitMode: 'confirm',\n component: 'designer.default-value-editor',\n props: {},\n }\n }\n if (component === 'switch') {\n return {\n kind: 'select',\n commitMode: 'immediate',\n component: 'select',\n clearable: true,\n options: [\n { label: '开启', value: true },\n { label: '关闭', value: false },\n ],\n props: sourceProps,\n }\n }\n if (component === 'number' || component === 'slider' || component === 'rate') {\n return {\n kind: 'number',\n commitMode: 'blur',\n component: 'number',\n props: sourceProps,\n }\n }\n if (component === 'textarea') {\n return {\n kind: 'textarea',\n commitMode: 'blur',\n component,\n props: sourceProps,\n }\n }\n if (component === 'radio') {\n return {\n kind: 'select',\n commitMode: 'immediate',\n component: 'select',\n clearable: true,\n options: [],\n props: sourceProps,\n }\n }\n if (component === 'checkbox') {\n return {\n kind: 'json',\n commitMode: 'immediate',\n component: 'multi-select',\n props: sourceProps,\n }\n }\n if (context.field?.multiple === true || component === 'date-range-picker' || component === 'time-range-picker') {\n return {\n kind: 'json',\n commitMode: 'immediate',\n component,\n props: sourceProps,\n }\n }\n if (component === 'select' || component === 'select-tree' || component === 'cascader') {\n return {\n kind: 'select',\n commitMode: 'immediate',\n component,\n clearable: true,\n options: [],\n props: sourceProps,\n }\n }\n return {\n kind: 'text',\n commitMode: component === 'text' || component === 'icon-input' ? 'blur' : 'immediate',\n component,\n props: sourceProps,\n }\n}\n\ninterface DefaultValuePropertyDefinition {\n kind: FieldPropertyField['kind']\n commitMode: FieldPropertyField['commitMode']\n component: string\n props: Record<string, unknown>\n clearable?: boolean\n options?: Array<{ label: string; value: OptionValue }>\n}\n\nfunction createNodeBasicFields(context: FieldSchemaContext): FieldPropertyField[] {\n return fieldsByKey(nodeCommonFields, nodeBasicFieldKeys).flatMap((field) => {\n if (field.key === 'node.name' && !shouldShowNodeName(context.node)) {\n return []\n }\n\n if (field.key !== 'node.component' || field.kind !== 'select') {\n return [field]\n }\n\n const options = componentOptionsForNode(context.node, context.field, context.extensionContext)\n if (options.length <= 1) {\n return []\n }\n\n return {\n ...field,\n options,\n }\n })\n}\n\nfunction createFieldCommonFields(context: FieldSchemaContext, fields: FieldPropertyField[]): FieldPropertyField[] {\n const fieldTypes = resolveComponentConfig(context, resolveNodeComponent(context.node))?.profile?.fieldTypes\n return fields.flatMap((field) => {\n if (field.key === 'field.multiple' && isTextInputNode(context.node)) {\n return []\n }\n if (field.key !== 'field.type' || field.kind !== 'select') {\n return [field]\n }\n\n if (!shouldShowFieldTypeForComponent(context.node.component, context.field, fieldTypes)) {\n return []\n }\n\n return [\n {\n ...field,\n editLevel: isFieldTypeLocked(context.field) ? 'readonly' : field.editLevel,\n options: fieldTypeOptionsForComponent(context.node.component, context.field, fieldTypes),\n },\n ]\n })\n}\n\nfunction createFieldStateFields(context: FieldSchemaContext): FieldPropertyField[] {\n const requiredRule = getRequiredValidationRule(context.field)\n return createFieldCommonFields(context, fieldsByKey(fieldCommonFields, fieldStateFieldKeys)).map((field) => {\n const validationManaged = field.key === 'field.required' && requiredRule !== undefined\n return {\n ...field,\n editLevel: validationManaged ? 'readonly' : field.editLevel,\n span: 8,\n props: {\n ...(field.props ?? {}),\n inlineBooleanLabel: validationManaged ? requiredValidationLabel(requiredRule) : field.label,\n inlineBooleanTip: field.tip,\n inlineBooleanTipId: field.key,\n },\n }\n })\n}\n\nfunction requiredValidationLabel(rule: NonNullable<ReturnType<typeof getRequiredValidationRule>>): string {\n if (rule.when) {\n return '条件必填'\n }\n if (rule.message) {\n return '必填(自定义提示)'\n }\n return '必填(校验规则)'\n}\n\nfunction createFieldCapabilitySettings(context: FieldSchemaContext): FieldPropertyField[] {\n const component = resolveNodeComponent(context.node)\n const config = resolveComponentConfig(context, component)\n return createFieldCommonFields(\n context,\n fieldsByKey(fieldCommonFields, resolveFieldCapabilityFieldKeys(config)),\n ).map((field) => ({\n ...field,\n span: field.key === 'field.multiple' ? 24 : 12,\n props: {\n ...(field.props ?? {}),\n inlineBooleanLabel: field.label,\n inlineBooleanTip: field.tip,\n inlineBooleanTipId: field.key,\n },\n }))\n}\n\nfunction resolveFieldCapabilityFieldKeys(config: ReturnType<typeof getDesignerComponentPropertyConfig>): string[] {\n if (!config) {\n return []\n }\n if (config.profile) {\n return config.profile.fieldCapabilities.map(fieldKeyForCapability)\n }\n return []\n}\n\nfunction fieldKeyForCapability(capability: DesignerComponentFieldCapability): string {\n return `field.${capability}`\n}\n\nfunction resolveComponentConfig(context: FieldSchemaContext, component: string) {\n return (\n context.extensionContext?.getComponentPropertyConfig(component) ?? getDesignerComponentPropertyConfig(component)\n )\n}\n\nfunction isTextInputNode(node: FieldSchemaContext['node']): boolean {\n return textInputComponents.has(node.component ?? 'text')\n}\n","import type { ResourceField, ViewNode } from '@sparqjs/schema-protocol'\nimport type { ComponentItem, TemplateItem } from '../state/types'\nimport { defaultFieldTypeForComponent, defaultNodePropsForComponent } from '../state/component-config'\nimport { createFieldDefaults } from '../state/field'\nimport type { DesignerMaterial, DesignerMaterialCategory } from '../extensions/material'\n\n/** 左侧面板的组件分类,items 顺序同时决定展示和键盘导航顺序。 */\nexport interface ComponentCategory {\n key: 'form' | 'function' | 'layout'\n title: string\n items: ComponentItem[]\n}\n\n/** 左侧组件面板的内置分类与节点工厂;插件组件由 DesignerExtension 另行提供。 */\nexport const componentCategories: ComponentCategory[] = [\n {\n key: 'form',\n title: '表单组件',\n items: [\n createFieldComponent('text', '文本输入', 'text', defaultFieldTypeForComponent('text'), 'text'),\n createFieldComponent('number', '数字', 'number', defaultFieldTypeForComponent('number'), 'number'),\n createFieldComponent('select', '下拉选择', 'select', defaultFieldTypeForComponent('select'), 'select'),\n createFieldComponent(\n 'multi-select',\n '下拉多选',\n 'multi-select',\n defaultFieldTypeForComponent('multi-select'),\n 'multi-select',\n ),\n createFieldComponent(\n 'select-tree',\n '树选择',\n 'select-tree',\n defaultFieldTypeForComponent('select-tree'),\n 'select-tree',\n ),\n createFieldComponent(\n 'cascader',\n '级联选择',\n 'cascader',\n defaultFieldTypeForComponent('cascader'),\n 'cascader',\n ),\n createFieldComponent('radio', '单选', 'radio', defaultFieldTypeForComponent('radio'), 'radio'),\n createFieldComponent('checkbox', '多选', 'checkbox', defaultFieldTypeForComponent('checkbox'), 'checkbox'),\n createFieldComponent(\n 'date-time',\n '日期时间',\n 'datetime',\n defaultFieldTypeForComponent('date-picker'),\n 'date-picker',\n ),\n createFieldComponent(\n 'date-time-range',\n '日期时间范围',\n 'date-range',\n defaultFieldTypeForComponent('date-range-picker'),\n 'date-range-picker',\n ),\n createFieldComponent('switch', '开关', 'switch', defaultFieldTypeForComponent('switch'), 'switch'),\n createFieldComponent('slider', '滑块', 'slider', defaultFieldTypeForComponent('slider'), 'slider'),\n createFieldComponent('rate', '评分', 'rate', defaultFieldTypeForComponent('rate'), 'rate'),\n createFieldComponent('color', '颜色', 'color', defaultFieldTypeForComponent('color'), 'color'),\n createFieldComponent(\n 'icon-input',\n '图标',\n 'icon-input',\n defaultFieldTypeForComponent('icon-input'),\n 'icon-input',\n ),\n ],\n },\n {\n key: 'function',\n title: '功能组件',\n items: [\n createFieldComponent(\n 'rich-text',\n '富文本',\n 'rich-text',\n defaultFieldTypeForComponent('rich-text'),\n 'rich-text',\n ),\n createFieldComponent(\n 'json-editor',\n 'JSON',\n 'json-editor',\n defaultFieldTypeForComponent('json-editor'),\n 'json-editor',\n ),\n createFieldComponent(\n 'key-value',\n '键值对',\n 'key-value',\n defaultFieldTypeForComponent('key-value'),\n 'key-value',\n ),\n createFieldComponent(\n 'image-upload',\n '图片上传',\n 'image-upload',\n defaultFieldTypeForComponent('image-upload'),\n 'image-upload',\n ),\n createFieldComponent(\n 'file-upload',\n '文件上传',\n 'file-upload',\n defaultFieldTypeForComponent('file-upload'),\n 'file-upload',\n ),\n {\n key: 'nested-table',\n title: '嵌套表格',\n icon: 'table',\n group: 'function' as const,\n createNode: () => ({\n type: 'view',\n title: '嵌套表格',\n mode: 'table',\n binding: {\n type: 'relation-list',\n relation: 'items',\n relationType: 'has-many',\n parentKey: 'id',\n foreignKey: 'parent_id',\n requireParent: true,\n whenParentMissing: 'disabled',\n pagination: { enabled: true, pageSize: 10 },\n refresh: {\n afterCreate: 'reload-current',\n afterUpdate: 'reload-current',\n afterDelete: 'reload-current',\n },\n operations: {\n create: {\n enabled: true,\n title: '新增',\n placement: 'toolbar',\n interaction: { type: 'form', form: 'default', mode: 'create' },\n execution: { type: 'resource' },\n },\n attach: {\n enabled: true,\n title: '选择已有',\n placement: 'toolbar',\n interaction: {\n type: 'selection',\n table: 'default',\n multiple: true,\n source: 'unassigned',\n },\n execution: { type: 'resource' },\n },\n update: {\n enabled: true,\n title: '编辑',\n placement: 'row',\n interaction: { type: 'form', form: 'default', mode: 'edit' },\n execution: { type: 'resource' },\n },\n detach: {\n enabled: true,\n title: '解除关联',\n placement: 'row',\n interaction: { type: 'direct' },\n execution: { type: 'resource' },\n },\n delete: {\n enabled: true,\n title: '删除',\n placement: 'row',\n interaction: { type: 'direct' },\n execution: { type: 'resource' },\n },\n },\n },\n }),\n },\n ],\n },\n {\n key: 'layout',\n title: '布局组件',\n items: [\n {\n key: 'section',\n title: '区块',\n icon: 'section',\n group: 'layout' as const,\n createNode: () => ({\n type: 'section',\n title: '新区块',\n children: [],\n }),\n },\n {\n key: 'card',\n title: '卡片',\n icon: 'card',\n group: 'layout' as const,\n createNode: () => ({\n type: 'card',\n title: '新卡片',\n children: [],\n }),\n },\n {\n key: 'divider',\n title: '分割线',\n icon: 'divider',\n group: 'layout' as const,\n createNode: () => ({\n type: 'divider',\n title: '分割线',\n props: {\n contentPosition: 'left',\n },\n }),\n },\n {\n key: 'tabs',\n title: '标签页',\n icon: 'tabs',\n group: 'layout' as const,\n createNode: () => ({\n type: 'tabs',\n span: 24,\n children: [\n {\n type: 'tab',\n name: 'tab_1',\n title: '标签一',\n children: [],\n },\n {\n type: 'tab',\n name: 'tab_2',\n title: '标签二',\n children: [],\n },\n ],\n }),\n },\n {\n key: 'collapse',\n title: '手风琴',\n icon: 'collapse',\n group: 'layout' as const,\n createNode: () => ({\n type: 'collapse',\n span: 24,\n props: {\n accordion: true,\n },\n children: [\n {\n type: 'collapse-item',\n name: 'panel_1',\n title: '面板一',\n children: [],\n },\n {\n type: 'collapse-item',\n name: 'panel_2',\n title: '面板二',\n children: [],\n },\n ],\n }),\n },\n ],\n },\n]\n\n/** 兼容现有 Sidebar 命名的组件分类别名,与 componentCategories 保持同一对象。 */\nexport const componentGroups: ComponentCategory[] = componentCategories\n\n/** Sidebar 使用的稳定分类标题;插件只能选择分类,不能覆盖设计器整体结构。 */\nexport const designerMaterialCategories: ReadonlyArray<{ key: DesignerMaterialCategory; title: string }> = [\n { key: 'form', title: '表单组件' },\n { key: 'function', title: '功能组件' },\n { key: 'layout', title: '布局组件' },\n]\n\n/** 从现有内置组件工厂生成 builtin 层物料,确保迁移前后的字段和节点默认值一致。 */\nexport const builtInDesignerMaterials: readonly DesignerMaterial[] = componentCategories.flatMap((category) =>\n category.items.map((item) => createBuiltInMaterial(category.key, item)),\n)\n\n/** 按分类读取内置物料,供没有扩展上下文的独立 Sidebar 测试安全降级。 */\nexport function listBuiltInDesignerMaterials(category?: DesignerMaterialCategory): DesignerMaterial[] {\n return builtInDesignerMaterials.filter((material) => !category || material.category === category)\n}\n\n/** 第一阶段内置模板列表,模板拖入流程尚未接入插件贡献。 */\nexport const templateItems: TemplateItem[] = [\n { key: 'basic', title: '基础信息表单', description: '常规名称、状态和备注字段。' },\n { key: 'audit', title: '审核表单', description: '包含状态、意见和只读信息区。' },\n { key: 'upload', title: '资源上传表单', description: '图片、文件和标题配置组合。' },\n]\n\nfunction createFieldComponent(\n key: string,\n title: string,\n icon: string,\n fieldType: string,\n component?: string,\n): ComponentItem {\n return {\n key,\n title,\n icon,\n group: 'field' as const,\n fieldType,\n component,\n createNode(field?: ResourceField): ViewNode {\n return {\n type: 'field',\n field: field?.name,\n component,\n props: defaultNodePropsForComponent(component),\n }\n },\n }\n}\n\nfunction createBuiltInMaterial(category: DesignerMaterialCategory, item: ComponentItem): DesignerMaterial {\n if (item.group !== 'field') {\n return {\n key: item.key,\n title: item.title,\n description: item.description,\n icon: item.icon,\n category,\n kind: 'node',\n create: () => ({ node: item.createNode() }),\n }\n }\n\n const component = item.component ?? item.key\n const fieldType = item.fieldType ?? defaultFieldTypeForComponent(component)\n return {\n key: item.key,\n title: item.title,\n description: item.description,\n icon: item.icon,\n category,\n kind: 'field',\n fieldNameBase: item.key,\n create: ({ fieldName }) => {\n const field: ResourceField = {\n name: fieldName,\n label: item.title,\n type: fieldType,\n formable: true,\n listable: false,\n ...createFieldDefaults(fieldType, component),\n }\n return {\n field,\n node: item.createNode(field),\n }\n },\n }\n}\n","import {\n createFrontendKernel,\n defineContributionPoint,\n defineContributionSet,\n type ContributionBundle,\n type ContributionDiagnostic,\n} from '@sparqjs/frontend-core'\nimport {\n createSchemaComponentRegistry,\n type SchemaComponent,\n type SchemaComponentRegistry,\n type SparqIconRegistry,\n} from '@sparqjs/schema-vue'\nimport {\n listDesignerCapabilityCards,\n type DesignerCapabilityCard,\n type DesignerCapabilityCardKey,\n} from '../inspector/capabilities'\nimport {\n listDesignerComponentPropertyConfigs,\n type DesignerComponentOption,\n type DesignerComponentPropertyConfig,\n type FieldPropertyField,\n} from '../inspector/field-schema'\nimport {\n builtInDesignerServiceProviders,\n type DesignerServiceProvider,\n type DesignerServiceRegistry,\n} from '../services/registry'\nimport { builtInDesignerMaterials } from '../sidebar/components'\nimport type { DesignerMaterial, DesignerMaterialCategory } from './material'\nimport {\n createDesignerNodePermissionPolicy,\n type DesignerNodePermissionResolver,\n type DesignerNodePermissionPolicy,\n} from './instance'\n\n/** 当前 Designer 扩展上下文需要解析的宿主实例配置。 */\nexport interface DesignerExtensionContextOptions {\n materialKeys?: readonly string[]\n nodePermissions?: DesignerNodePermissionResolver\n}\n\n/**\n * 设计器插件的稳定贡献描述。\n *\n * 扩展只声明当前设计器需要的物料、运行时组件、属性配置、能力卡和设计期服务;插件发现、权限和远程加载由宿主负责。\n */\nexport interface DesignerExtension {\n /** 扩展稳定标识,同时作为重复贡献诊断中的 owner。 */\n key: string\n /** 扩展实际提供的运行时组件,不应包含 renderer 的完整默认 registry。 */\n components?: Readonly<Record<string, SchemaComponent>>\n /** 声明可从 Sidebar 拖入当前设计器实例的字段或节点物料。 */\n materials?: readonly DesignerMaterial[]\n /** 声明字段组件在 Inspector 中允许编辑的属性和迁移规则。 */\n componentProperties?: readonly DesignerComponentPropertyConfig[]\n /** 声明复杂配置的摘要、编辑器和写回边界。 */\n capabilityCards?: readonly DesignerCapabilityCard[]\n /** 设计期查询或动作服务;鉴权、缓存和错误归一化由 provider 自己处理。 */\n services?: readonly DesignerServiceProvider[]\n}\n\n/** 扩展冲突和完整性检查的稳定诊断代码。 */\nexport type DesignerExtensionDiagnosticCode =\n | 'duplicate-extension-key'\n | 'duplicate-component-property'\n | 'duplicate-capability-card'\n | 'duplicate-runtime-component'\n | 'duplicate-material'\n | 'duplicate-service-provider'\n | 'missing-component-renderer'\n | 'missing-capability-editor'\n\n/** 扩展安装和完整性检查产生的可定位诊断。 */\nexport interface DesignerExtensionDiagnostic {\n code: DesignerExtensionDiagnosticCode\n extension: string\n key: string\n message: string\n}\n\n/**\n * 当前设计器实例解析后的扩展快照。\n *\n * Sidebar、Canvas、Preview、Inspector 和属性命令共享该对象,避免同一扩展在不同区域得到不一致结果。\n */\nexport interface DesignerExtensionContext {\n /** 合并内置、插件和宿主覆盖后的运行时组件。 */\n components: SchemaComponentRegistry\n /** 当前实例画布、预览和 Inspector 共用的宿主图标注册表。 */\n icons?: SparqIconRegistry\n /** 当前实例统一使用的节点权限;UI 和命令层必须读取同一结果。 */\n nodePermissions: DesignerNodePermissionPolicy\n /** 合并内置、插件和宿主覆盖后的设计期服务。 */\n services: DesignerServiceProvider[]\n diagnostics: DesignerExtensionDiagnostic[]\n /** 按稳定 key 解析当前实例生效的物料。 */\n getMaterial: (key: string) => DesignerMaterial | undefined\n /** 列出当前实例物料;传入分类时只返回对应 Sidebar 分组。 */\n listMaterials: (category?: DesignerMaterialCategory) => DesignerMaterial[]\n /** 按稳定 key 解析当前实例生效的设计期服务。 */\n getServiceProvider: (key: string) => DesignerServiceProvider | undefined\n /** 列出当前实例最终生效的设计期服务。 */\n listServiceProviders: () => DesignerServiceProvider[]\n getComponentPropertyConfig: (component: string | undefined) => DesignerComponentPropertyConfig | undefined\n hasExtensionComponentProperty: (component: string | undefined) => boolean\n listComponentPropertyConfigs: () => DesignerComponentPropertyConfig[]\n listComponentOptions: (group?: string) => DesignerComponentOption[]\n getCapabilityCard: (key: DesignerCapabilityCardKey) => DesignerCapabilityCard | undefined\n listCapabilityCards: (keys?: DesignerCapabilityCardKey[]) => DesignerCapabilityCard[]\n}\n\nconst runtimeComponentPoint = defineContributionPoint<SchemaComponent>('designer.runtime-components')\nconst materialPoint = defineContributionPoint<DesignerMaterial>('designer.materials')\nconst componentPropertyPoint = defineContributionPoint<DesignerComponentPropertyConfig>('designer.component-properties')\nconst capabilityCardPoint = defineContributionPoint<DesignerCapabilityCard>('designer.capability-cards')\nconst serviceProviderPoint = defineContributionPoint<DesignerServiceProvider>('designer.services')\n\nconst designerBuiltinOwner = '@sparqjs/schema-designer'\nconst designerHostOwner = '@sparqjs/schema-designer:host'\n\n/**\n * 将内置能力、宿主组件和 DesignerExtension 解析为实例级扩展快照。\n *\n * 每次调用都会创建隔离的 FrontendKernel,不会让同页多个设计器或测试用例共享注册状态。\n */\nexport function createDesignerExtensionContext(\n extensions: DesignerExtension[] = [],\n hostComponents?: SchemaComponentRegistry,\n hostServices?: DesignerServiceProvider[] | DesignerServiceRegistry,\n icons?: SparqIconRegistry,\n options?: DesignerExtensionContextOptions,\n): DesignerExtensionContext {\n const kernel = createFrontendKernel()\n const diagnostics: DesignerExtensionDiagnostic[] = []\n const extensionKeys = new Set<string>()\n const baseComponents = hostComponents ?? createSchemaComponentRegistry()\n const materialKeys = options?.materialKeys ? new Set(options.materialKeys) : undefined\n const nodePermissions = createDesignerNodePermissionPolicy(options?.nodePermissions)\n\n kernel.install(createBaseContribution(baseComponents, hostComponents ? 'host' : 'builtin'))\n\n for (const extension of extensions) {\n if (extensionKeys.has(extension.key)) {\n diagnostics.push(\n createDiagnostic(\n 'duplicate-extension-key',\n extension.key,\n extension.key,\n `设计器扩展 ${extension.key} 重复注册,后声明内容将继续参与覆盖。`,\n ),\n )\n }\n extensionKeys.add(extension.key)\n validateExtension(extension)\n kernel.install(createExtensionContribution(extension))\n }\n if (hostServices) {\n kernel.install(createHostServiceContribution(hostServices))\n }\n\n const runtimeComponents = kernel.registry(runtimeComponentPoint)\n const materials = kernel.registry(materialPoint)\n const componentProperties = kernel.registry(componentPropertyPoint)\n const capabilityCards = kernel.registry(capabilityCardPoint)\n const services = kernel.registry(serviceProviderPoint)\n\n diagnostics.push(\n ...mapKernelDiagnostics(runtimeComponents.diagnostics(), 'duplicate-runtime-component'),\n ...mapKernelDiagnostics(materials.diagnostics(), 'duplicate-material'),\n ...mapKernelDiagnostics(componentProperties.diagnostics(), 'duplicate-component-property'),\n ...mapKernelDiagnostics(capabilityCards.diagnostics(), 'duplicate-capability-card'),\n ...mapKernelDiagnostics(services.diagnostics(), 'duplicate-service-provider'),\n )\n\n const components = createSchemaComponentRegistry(\n runtimeComponents.entries().map((entry) => [entry.key, entry.value] as const),\n )\n\n for (const extension of extensions) {\n for (const config of extension.componentProperties ?? []) {\n if (!components.has(config.component)) {\n diagnostics.push(\n createDiagnostic(\n 'missing-component-renderer',\n extension.key,\n config.component,\n `组件属性 ${config.component} 没有对应运行时组件,画布将显示不可用占位。`,\n ),\n )\n }\n }\n for (const card of extension.capabilityCards ?? []) {\n const editor = card.field.component\n if (editor && !editor.startsWith('designer.') && !components.has(editor)) {\n diagnostics.push(\n createDiagnostic(\n 'missing-capability-editor',\n extension.key,\n editor,\n `能力卡 ${card.key} 的编辑器 ${editor} 未注册,Inspector 无法打开该配置。`,\n ),\n )\n }\n }\n }\n\n const extensionComponentKeys = new Set(\n extensions.flatMap((extension) => (extension.componentProperties ?? []).map((config) => config.component)),\n )\n\n return {\n components,\n icons,\n nodePermissions,\n services: services.entries().map((entry) => entry.value),\n diagnostics,\n getMaterial(key) {\n return !materialKeys || materialKeys.has(key) ? materials.get(key) : undefined\n },\n listMaterials(category) {\n return materials\n .entries()\n .map((entry) => entry.value)\n .filter((material) => !category || material.category === category)\n .filter((material) => !materialKeys || materialKeys.has(material.key))\n },\n getServiceProvider(key) {\n return services.get(key)\n },\n listServiceProviders() {\n return services.entries().map((entry) => entry.value)\n },\n getComponentPropertyConfig(component) {\n return component ? componentProperties.get(component) : undefined\n },\n hasExtensionComponentProperty(component) {\n return component ? extensionComponentKeys.has(component) : false\n },\n listComponentPropertyConfigs() {\n return componentProperties.entries().map((entry) => entry.value)\n },\n listComponentOptions(group) {\n return componentProperties\n .entries()\n .map((entry) => entry.value.option)\n .filter((option): option is DesignerComponentOption => Boolean(option))\n .filter((option) => option.group === group)\n },\n getCapabilityCard(key) {\n return capabilityCards.get(key)\n },\n listCapabilityCards(keys) {\n const cards = keys?.length\n ? keys.map((key) => capabilityCards.get(key)).filter(isDefined)\n : capabilityCards.entries().map((entry) => entry.value)\n return cards.sort((left, right) => (left.order ?? 0) - (right.order ?? 0))\n },\n }\n}\n\nfunction createBaseContribution(\n components: SchemaComponentRegistry,\n componentLayer: 'builtin' | 'host',\n): ContributionBundle {\n return {\n owner: designerBuiltinOwner,\n contributions: [\n defineContributionSet(\n runtimeComponentPoint,\n [...components.entries()].map(([key, value]) => ({ key, value })),\n componentLayer,\n ),\n defineContributionSet(\n materialPoint,\n builtInDesignerMaterials.map((value) => ({ key: value.key, value })),\n 'builtin',\n ),\n defineContributionSet(\n componentPropertyPoint,\n listDesignerComponentPropertyConfigs().map((value) => ({ key: value.component, value })),\n 'builtin',\n ),\n defineContributionSet(\n capabilityCardPoint,\n listDesignerCapabilityCards().map((value) => ({ key: value.key, value })),\n 'builtin',\n ),\n defineContributionSet(\n serviceProviderPoint,\n builtInDesignerServiceProviders.map((value) => ({ key: value.key, value })),\n 'builtin',\n ),\n ],\n }\n}\n\nfunction createHostServiceContribution(\n services: DesignerServiceProvider[] | DesignerServiceRegistry,\n): ContributionBundle {\n const providers = services instanceof Map ? [...services.values()] : services\n return {\n owner: designerHostOwner,\n contributions: [\n defineContributionSet(\n serviceProviderPoint,\n providers.map((value) => ({ key: value.key, value })),\n 'host',\n ),\n ],\n }\n}\n\nfunction createExtensionContribution(extension: DesignerExtension): ContributionBundle {\n return {\n owner: extension.key,\n contributions: [\n defineContributionSet(\n runtimeComponentPoint,\n Object.entries(extension.components ?? {}).map(([key, value]) => ({ key, value })),\n ),\n defineContributionSet(\n materialPoint,\n (extension.materials ?? []).map((value) => ({ key: value.key, value: cloneMaterial(value) })),\n ),\n defineContributionSet(\n componentPropertyPoint,\n (extension.componentProperties ?? []).map((value) => ({\n key: value.component,\n value: cloneComponentPropertyConfig(value),\n })),\n ),\n defineContributionSet(\n capabilityCardPoint,\n (extension.capabilityCards ?? []).map((value) => ({\n key: value.key,\n value: cloneCapabilityCard(value),\n })),\n ),\n defineContributionSet(\n serviceProviderPoint,\n (extension.services ?? []).map((value) => ({ key: value.key, value })),\n ),\n ],\n }\n}\n\nfunction validateExtension(extension: DesignerExtension): void {\n if (!extension.key) {\n throw new Error('设计器扩展 key 不能为空')\n }\n for (const material of extension.materials ?? []) {\n validateMaterial(material)\n }\n for (const card of extension.capabilityCards ?? []) {\n validateCapabilityCard(card)\n }\n}\n\nfunction validateMaterial(material: DesignerMaterial): void {\n requireMaterialText(material.key, 'key')\n requireMaterialText(material.title, `${material.key} 的 title`)\n requireMaterialText(material.icon, `${material.key} 的 icon`)\n if (!['form', 'function', 'layout'].includes(material.category)) {\n throw new Error(`设计器物料 ${material.key} 的 category 无效`)\n }\n if (material.kind === 'field') {\n requireMaterialText(material.fieldNameBase, `${material.key} 的 fieldNameBase`)\n }\n}\n\nfunction requireMaterialText(value: string, label: string): void {\n if (!value || !value.trim()) {\n throw new Error(`设计器物料 ${label} 不能为空`)\n }\n}\n\nfunction validateCapabilityCard(card: DesignerCapabilityCard): void {\n if (card.field.editLevel !== 'capability') {\n throw new Error(`能力卡 ${card.key} 的属性必须声明为 capability`)\n }\n if (!card.affectedPaths.length) {\n throw new Error(`能力卡 ${card.key} 必须声明 affectedPaths`)\n }\n\n const paths = new Set<string>()\n for (const affectedPath of card.affectedPaths) {\n const path = `${affectedPath.target}:${affectedPath.path}`\n if (paths.has(path)) {\n throw new Error(`能力卡 ${card.key} 重复声明受影响路径 ${path}`)\n }\n paths.add(path)\n }\n}\n\nfunction mapKernelDiagnostics(\n kernelDiagnostics: readonly ContributionDiagnostic[],\n code: DesignerExtensionDiagnosticCode,\n): DesignerExtensionDiagnostic[] {\n return kernelDiagnostics.map((diagnostic) =>\n createDiagnostic(code, diagnostic.activeOwner, diagnostic.key, diagnostic.message),\n )\n}\n\nfunction createDiagnostic(\n code: DesignerExtensionDiagnosticCode,\n extension: string,\n key: string,\n message: string,\n): DesignerExtensionDiagnostic {\n return { code, extension, key, message }\n}\n\nfunction cloneComponentPropertyConfig(config: DesignerComponentPropertyConfig): DesignerComponentPropertyConfig {\n return {\n ...config,\n option: config.option ? { ...config.option } : undefined,\n props: config.props?.map(cloneFieldProperty),\n profile: config.profile\n ? {\n ...config.profile,\n fieldTypes: {\n ...config.profile.fieldTypes,\n allowedTypes: [...config.profile.fieldTypes.allowedTypes],\n },\n fieldCapabilities: [...config.profile.fieldCapabilities],\n valueStrategies: [...config.profile.valueStrategies],\n optionSources: [...config.profile.optionSources],\n validation: config.profile.validation\n ? {\n ...config.profile.validation,\n supported: [...config.profile.validation.supported],\n }\n : undefined,\n capabilities: [...config.profile.capabilities],\n }\n : undefined,\n dataSource: config.dataSource?.map(cloneFieldProperty),\n advanced: config.advanced?.map(cloneFieldProperty),\n }\n}\n\nfunction cloneCapabilityCard(card: DesignerCapabilityCard): DesignerCapabilityCard {\n return {\n ...card,\n field: cloneFieldProperty(card.field),\n affectedPaths: card.affectedPaths.map((path) => ({ ...path })),\n }\n}\n\nfunction cloneMaterial(material: DesignerMaterial): DesignerMaterial {\n return { ...material }\n}\n\nfunction cloneFieldProperty<T extends FieldPropertyField>(field: T): T {\n return {\n ...field,\n storage: { ...field.storage },\n props: field.props ? cloneExtensionValue(field.props) : undefined,\n dataSource: field.dataSource ? cloneExtensionValue(field.dataSource) : undefined,\n } as T\n}\n\nfunction cloneExtensionValue<T>(value: T): T {\n if (Array.isArray(value)) {\n return value.map(cloneExtensionValue) as T\n }\n if (value && typeof value === 'object') {\n return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, cloneExtensionValue(entry)])) as T\n }\n return value\n}\n\nfunction isDefined<T>(value: T | undefined): value is T {\n return value !== undefined\n}\n","import { h, type VNode } from 'vue'\n\n/** 渲染左侧组件面板图标;未知名称使用统一占位图标,避免面板布局跳动。 */\nexport function renderPaletteIcon(name: string): VNode {\n const common = {\n viewBox: '0 0 24 24',\n fill: 'none',\n 'aria-hidden': true,\n }\n\n switch (name) {\n case 'password':\n return (\n <svg {...common}>\n <rect x='4' y='10' width='16' height='10' rx='2.5' />\n <path d='M8 10V7.5a4 4 0 0 1 8 0V10M8 15h.01M12 15h.01M16 15h.01' />\n </svg>\n )\n case 'number':\n return (\n <svg {...common}>\n <rect x='3.5' y='6' width='17' height='12' rx='2.5' />\n <path d='M7 14.5h2.5M8.25 14.5v-5l-1.1.7M11.5 10.5c.35-.75 1.1-1.1 2-1 1.05.1 1.7.75 1.7 1.55 0 .7-.4 1.2-1.25 1.7l-2.2 1.75h3.6M17.2 9.6h1.25c.75 0 1.25.42 1.25 1.05 0 .55-.35.9-.85 1.05.62.1 1.05.55 1.05 1.2 0 .8-.65 1.3-1.55 1.3H17' />\n </svg>\n )\n case 'select':\n return (\n <svg {...common}>\n <rect x='3.5' y='6' width='17' height='12' rx='2.5' />\n <path d='M7.5 10h6M7.5 14h4.5M15.5 11l2 2 2-2' />\n </svg>\n )\n case 'multi-select':\n return (\n <svg {...common}>\n <rect x='3.5' y='5' width='17' height='14' rx='2.5' />\n <path d='m7 9 1.3 1.3L10.5 8M13 9h4M7 14l1.3 1.3 2.2-2.3M13 14h4' />\n </svg>\n )\n case 'select-tree':\n return (\n <svg {...common}>\n <rect x='4' y='4' width='6' height='4' rx='1' />\n <rect x='14' y='10' width='6' height='4' rx='1' />\n <rect x='14' y='17' width='6' height='4' rx='1' />\n <path d='M7 8v6h7M7 14v5h7' />\n </svg>\n )\n case 'cascader':\n return (\n <svg {...common}>\n <rect x='3.5' y='5' width='6' height='14' rx='1.5' />\n <rect x='14.5' y='5' width='6' height='14' rx='1.5' />\n <path d='M6 9h1M6 12h1M6 15h1M12 12h2.5M12.5 10.5 14 12l-1.5 1.5M17 9h1M17 12h1M17 15h1' />\n </svg>\n )\n case 'radio':\n return (\n <svg {...common}>\n <circle cx='7' cy='8' r='2.6' />\n <circle cx='7' cy='16' r='2.6' />\n <path d='M12 8h7M12 16h7' />\n <circle cx='7' cy='8' r='.9' fill='currentColor' />\n </svg>\n )\n case 'checkbox':\n return (\n <svg {...common}>\n <rect x='4' y='5' width='6' height='6' rx='1.5' />\n <rect x='4' y='14' width='6' height='6' rx='1.5' />\n <path d='m5.5 8 1.2 1.2L9 6.8M13 8h7M13 17h7' />\n </svg>\n )\n case 'switch':\n return (\n <svg {...common}>\n <rect x='3.5' y='7' width='17' height='10' rx='5' />\n <circle cx='15.5' cy='12' r='2.6' fill='currentColor' />\n <path d='M7.5 12h3' />\n </svg>\n )\n case 'slider':\n return (\n <svg {...common}>\n <path d='M4 8h8M16 8h4M4 16h3M11 16h9' />\n <circle cx='14' cy='8' r='2' />\n <circle cx='9' cy='16' r='2' />\n </svg>\n )\n case 'rate':\n return (\n <svg {...common}>\n <path d='m12 4 2.15 4.35 4.8.7-3.47 3.38.82 4.77L12 14.94 7.7 17.2l.82-4.77L5.05 9.05l4.8-.7z' />\n </svg>\n )\n case 'color':\n return (\n <svg {...common}>\n <path d='M12 4c4 3.5 6 6.4 6 9a6 6 0 0 1-12 0c0-2.6 2-5.5 6-9Z' />\n <path d='M8.5 14.5a3.8 3.8 0 0 0 5 2' />\n </svg>\n )\n case 'date':\n return (\n <svg {...common}>\n <rect x='4' y='5' width='16' height='15' rx='2.5' />\n <path d='M8 3.5v4M16 3.5v4M4 10h16M8 14h2M12 14h2M16 14h1M8 17h2M12 17h2' />\n </svg>\n )\n case 'date-range':\n return (\n <svg {...common}>\n <rect x='3.5' y='5' width='17' height='15' rx='2.5' />\n <path d='M7 3.5v4M17 3.5v4M3.5 10h17M7.5 14h3M13.5 14h3M10.5 15.5h3' />\n </svg>\n )\n case 'datetime':\n return (\n <svg {...common}>\n <rect x='4' y='5' width='16' height='15' rx='2.5' />\n <path d='M8 3.5v4M16 3.5v4M4 10h16M8 14h3' />\n <circle cx='16' cy='15.5' r='2.5' />\n <path d='M16 14v1.7l1.2.8' />\n </svg>\n )\n case 'time':\n return (\n <svg {...common}>\n <circle cx='12' cy='12' r='8' />\n <path d='M12 7.5V12l3 2' />\n </svg>\n )\n case 'time-range':\n return (\n <svg {...common}>\n <circle cx='8.5' cy='12' r='4.5' />\n <circle cx='15.5' cy='12' r='4.5' />\n <path d='M8.5 9.5V12l1.7 1M15.5 9.5V12l1.7 1' />\n </svg>\n )\n case 'textarea':\n return (\n <svg {...common}>\n <rect x='3.5' y='5' width='17' height='14' rx='2.5' />\n <path d='M7 9h10M7 12h9M7 15h6M16.5 16.5 18 15M18.5 17.5 20 16' />\n </svg>\n )\n case 'rich-text':\n return (\n <svg {...common}>\n <rect x='3.5' y='5' width='17' height='14' rx='2.5' />\n <path d='M7 9h10M7 13h4M13 13h4M7 16h8M8 9v7M11 9v7' />\n </svg>\n )\n case 'json-editor':\n return (\n <svg {...common}>\n <rect x='4' y='5' width='16' height='14' rx='2.5' />\n <path d='M9 9 7 12l2 3M15 9l2 3-2 3M12.5 8.5l-1 7' />\n </svg>\n )\n case 'key-value':\n return (\n <svg {...common}>\n <rect x='4' y='5' width='16' height='14' rx='2.5' />\n <path d='M7 9h4M14 9h3M7 13h4M14 13h3M7 17h4M14 17h3' />\n </svg>\n )\n case 'icon-input':\n return (\n <svg {...common}>\n <rect x='4' y='6' width='16' height='12' rx='2.5' />\n <path d='m9 11 1.5 1.5L13 9l2 5M7 15h10' />\n </svg>\n )\n case 'relation-picker':\n return (\n <svg {...common}>\n <circle cx='8' cy='8' r='3' />\n <circle cx='16' cy='16' r='3' />\n <path d='M10.2 10.2 13.8 13.8M14 8h2a2 2 0 0 1 2 2v1M10 16H8a2 2 0 0 1-2-2v-1' />\n </svg>\n )\n case 'image-upload':\n return (\n <svg {...common}>\n <rect x='4' y='6' width='16' height='13' rx='2.5' />\n <path d='m7 16 3-3 2 2 3-4 2 5M8 10h.01M12 4v7M9.5 6.5 12 4l2.5 2.5' />\n </svg>\n )\n case 'file-upload':\n return (\n <svg {...common}>\n <path d='M7 3.5h7l4 4V20.5H7zM14 3.5v5h4M12 17v-6M9.5 13.5 12 11l2.5 2.5' />\n </svg>\n )\n case 'section':\n return (\n <svg {...common}>\n <rect x='4' y='4.5' width='16' height='15' rx='2.5' />\n <path d='M7 8h10M7 12h10M7 16h6' />\n </svg>\n )\n case 'card':\n return (\n <svg {...common}>\n <rect x='4' y='5' width='16' height='14' rx='3' />\n <path d='M4 9h16M7.5 13h6M7.5 16h9' />\n </svg>\n )\n case 'divider':\n return (\n <svg {...common}>\n <path d='M4 12h16' />\n <path d='M7 8h10M9 16h6' />\n </svg>\n )\n case 'tabs':\n return (\n <svg {...common}>\n <path d='M5 6.5h5l1.5 3H20v8H4v-11h1z' />\n <path d='M11.5 9.5H4M8 13h8M8 16h5' />\n </svg>\n )\n case 'collapse':\n return (\n <svg {...common}>\n <rect x='4' y='5' width='16' height='14' rx='2.5' />\n <path d='M7 9h10M8 13h8M8 16h5M17 13l-2 2-2-2' />\n </svg>\n )\n case 'table':\n return (\n <svg {...common}>\n <rect x='4' y='5' width='16' height='14' rx='2.5' />\n <path d='M4 10h16M4 14h16M10 5v14M15 5v14' />\n </svg>\n )\n case 'text':\n default:\n return (\n <svg {...common}>\n <rect x='3.5' y='6' width='17' height='12' rx='2.5' />\n <path d='M7.5 12h7M8 9.5v5M16.5 9.5v5' />\n </svg>\n )\n }\n}\n\n/** 渲染设计器顶部工具栏图标,图标尺寸由工具栏按钮样式统一约束。 */\nexport function renderToolbarIcon(name: string): VNode {\n const common = {\n viewBox: '0 0 24 24',\n fill: 'none',\n 'aria-hidden': true,\n }\n\n switch (name) {\n case 'tree':\n return (\n <svg {...common}>\n <rect x='4' y='4' width='6' height='4' rx='1' />\n <rect x='14' y='10' width='6' height='4' rx='1' />\n <rect x='14' y='17' width='6' height='4' rx='1' />\n <path d='M7 8v11h7M7 12h7' />\n </svg>\n )\n case 'undo':\n return (\n <svg {...common}>\n <path d='M9 7 5 11l4 4' />\n <path d='M5 11h8a6 6 0 0 1 6 6v1' />\n </svg>\n )\n case 'redo':\n return (\n <svg {...common}>\n <path d='m15 7 4 4-4 4' />\n <path d='M19 11h-8a6 6 0 0 0-6 6v1' />\n </svg>\n )\n case 'phone':\n return (\n <svg {...common}>\n <rect x='8' y='3' width='8' height='18' rx='2' />\n <path d='M11 18h2' />\n </svg>\n )\n case 'pad':\n return (\n <svg {...common}>\n <rect x='6' y='3.5' width='12' height='17' rx='2.5' />\n <path d='M11 17.5h2' />\n </svg>\n )\n case 'pc':\n return (\n <svg {...common}>\n <rect x='3.5' y='5' width='17' height='11' rx='2' />\n <path d='M9 20h6M12 16v4' />\n </svg>\n )\n case 'import':\n return (\n <svg {...common}>\n <path d='M12 3v10' />\n <path d='m8.5 9.5 3.5 3.5 3.5-3.5' />\n <path d='M5 15v3a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3' />\n </svg>\n )\n case 'export':\n return (\n <svg {...common}>\n <path d='M12 14V4' />\n <path d='m8.5 7.5 3.5-3.5 3.5 3.5' />\n <path d='M5 15v3a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3' />\n </svg>\n )\n case 'json':\n return (\n <svg {...common}>\n <path d='M8 9 5 12l3 3M16 9l3 3-3 3' />\n <path d='m14 6-4 12' />\n </svg>\n )\n case 'preview':\n return (\n <svg {...common}>\n <path d='M3.5 12s3-5 8.5-5 8.5 5 8.5 5-3 5-8.5 5-8.5-5-8.5-5Z' />\n <circle cx='12' cy='12' r='2.5' />\n </svg>\n )\n case 'save':\n default:\n return (\n <svg {...common}>\n <path d='M5 4h12l2 2v16H5z' />\n <path d='M8 4v6h8V4M8 18h8v-5H8z' />\n </svg>\n )\n }\n}\n\n/** 渲染节点悬浮操作图标,供移动、复制和删除按钮共享。 */\nexport function renderNodeActionIcon(name: string): VNode {\n const common = {\n viewBox: '0 0 24 24',\n fill: 'none',\n 'aria-hidden': true,\n }\n\n switch (name) {\n case 'add':\n return (\n <svg {...common}>\n <path d='M12 5v14M5 12h14' />\n </svg>\n )\n case 'drag':\n return (\n <svg {...common}>\n <path d='M9 5h.01M15 5h.01M9 12h.01M15 12h.01M9 19h.01M15 19h.01' />\n </svg>\n )\n case 'copy':\n return (\n <svg {...common}>\n <rect x='8' y='8' width='11' height='11' rx='2' />\n <path d='M5 15V7a2 2 0 0 1 2-2h8' />\n </svg>\n )\n case 'up':\n return (\n <svg {...common}>\n <path d='m12 5-5 5M12 5l5 5M12 5v14' />\n </svg>\n )\n case 'down':\n return (\n <svg {...common}>\n <path d='M12 19V5M12 19l-5-5M12 19l5-5' />\n </svg>\n )\n case 'indent':\n return (\n <svg {...common}>\n <path d='M4 6h16M4 18h16M11 12h9M6 9l3 3-3 3' />\n </svg>\n )\n case 'outdent':\n return (\n <svg {...common}>\n <path d='M4 6h16M4 18h16M11 12h9M9 9l-3 3 3 3' />\n </svg>\n )\n case 'lock':\n return (\n <svg {...common}>\n <rect x='5' y='10' width='14' height='10' rx='2' />\n <path d='M8 10V7a4 4 0 0 1 8 0v3M12 14v2' />\n </svg>\n )\n case 'remove':\n default:\n return (\n <svg {...common}>\n <path d='M4 7h16M10 11v6M14 11v6M6 7l1 14h10l1-14M9 7V4h6v3' />\n </svg>\n )\n }\n}\n","import { defineComponent, h, type PropType } from 'vue'\nimport type { DraftState, DeviceMode } from '../state/types'\nimport { defaultDesignerFeatures, type ResolvedDesignerFeatures } from '../extensions/instance'\nimport { redo, undo } from '../state/draft'\nimport { renderToolbarIcon } from '../shared/icons'\n\n/** 打开完整预览并锁定入口,直到 PreviewDialog 完成运行时挂载。 */\nexport function openDesignerPreview(state: DraftState): boolean {\n if (state.previewOpen || state.previewLoading) {\n return false\n }\n state.previewLoading = true\n state.previewOpen = true\n return true\n}\n\n/** 设计器顶部命令栏,统一触发保存、导入导出、预览和历史操作。 */\nexport const Toolbar = defineComponent({\n name: 'SparqDesignerToolbar',\n props: {\n state: {\n type: Object as PropType<DraftState>,\n required: true,\n },\n features: {\n type: Object as PropType<ResolvedDesignerFeatures>,\n default: () => defaultDesignerFeatures,\n },\n },\n emits: {\n save: () => true,\n export: () => true,\n import: () => true,\n },\n setup(props, { emit }) {\n const setDevice = (device: DeviceMode) => {\n props.state.device = device\n }\n\n return () => {\n const features = props.features ?? defaultDesignerFeatures\n return (\n <header class='sparq-designer-toolbar'>\n <div class='sparq-designer-toolbar__group sparq-designer-button-group'>\n {features.resourceTree ? (\n <button\n type='button'\n class={[\n 'sparq-designer-icon-button',\n props.state.resourceTreeOpen ? 'is-active' : undefined,\n ]}\n title='资源树'\n aria-label='资源树'\n onClick={() => (props.state.resourceTreeOpen = true)}\n >\n {renderToolbarIcon('tree')}\n </button>\n ) : undefined}\n <button\n type='button'\n class='sparq-designer-icon-button'\n title='上一步'\n aria-label='上一步'\n disabled={props.state.history.length === 0}\n onClick={() => undo(props.state)}\n >\n {renderToolbarIcon('undo')}\n </button>\n <button\n type='button'\n class='sparq-designer-icon-button'\n title='下一步'\n aria-label='下一步'\n disabled={props.state.future.length === 0}\n onClick={() => redo(props.state)}\n >\n {renderToolbarIcon('redo')}\n </button>\n </div>\n {features.deviceModes ? (\n <div\n class='sparq-designer-toolbar__group sparq-designer-button-group is-center'\n role='tablist'\n aria-label='舞台尺寸'\n >\n {(['phone', 'pad', 'pc'] as DeviceMode[]).map((device) => (\n <button\n type='button'\n class={[\n 'sparq-designer-icon-button',\n props.state.device === device ? 'is-active' : undefined,\n ]}\n title={device === 'phone' ? '手机端' : device === 'pad' ? 'Pad 端' : 'PC 端'}\n aria-label={device === 'phone' ? '手机端' : device === 'pad' ? 'Pad 端' : 'PC 端'}\n onClick={() => setDevice(device)}\n >\n {renderToolbarIcon(device)}\n </button>\n ))}\n </div>\n ) : (\n <span />\n )}\n <div class='sparq-designer-toolbar__group sparq-designer-button-group'>\n {features.importJson ? (\n <button\n type='button'\n class='sparq-designer-icon-button'\n title='导入 JSON'\n aria-label='导入 JSON'\n onClick={() => emit('import')}\n >\n {renderToolbarIcon('import')}\n </button>\n ) : undefined}\n {features.exportJson ? (\n <button\n type='button'\n class='sparq-designer-icon-button'\n title='导出 JSON'\n aria-label='导出 JSON'\n onClick={() => emit('export')}\n >\n {renderToolbarIcon('export')}\n </button>\n ) : undefined}\n {features.preview ? (\n <button\n type='button'\n class={[\n 'sparq-designer-icon-button',\n props.state.previewLoading ? 'is-loading' : undefined,\n ]}\n title={props.state.previewLoading ? '预览加载中' : '预览表单'}\n aria-label='预览表单'\n aria-busy={props.state.previewLoading ? 'true' : 'false'}\n disabled={props.state.previewOpen || props.state.previewLoading}\n onClick={() => openDesignerPreview(props.state)}\n >\n {renderToolbarIcon('preview')}\n </button>\n ) : undefined}\n {features.jsonView ? (\n <button\n type='button'\n class='sparq-designer-icon-button'\n title='查看 JSON'\n aria-label='查看 JSON'\n onClick={() => (props.state.jsonOpen = true)}\n >\n {renderToolbarIcon('json')}\n </button>\n ) : undefined}\n <button\n type='button'\n class={['sparq-designer-icon-button', props.state.saving ? 'is-loading' : undefined]}\n title={props.state.saving ? '正在保存' : '保存表单'}\n aria-label='保存表单'\n aria-busy={props.state.saving ? 'true' : 'false'}\n disabled={props.state.saving}\n onClick={() => emit('save')}\n >\n {renderToolbarIcon('save')}\n </button>\n </div>\n </header>\n )\n }\n },\n})\n","import Sortable, { type SortableOptions } from 'sortablejs'\nimport { defineComponent, h, onBeforeUnmount, onMounted, ref, watch, type PropType, type VNode } from 'vue'\n\n/** 管理 SortableJS 实例生命周期,并把 Vue children 渲染为稳定拖放容器。 */\nexport const SortableList = defineComponent({\n name: 'SparqDesignerSortableList',\n props: {\n options: {\n type: Object as PropType<SortableOptions>,\n required: true,\n },\n tag: {\n type: String,\n default: 'div',\n },\n optionsKey: {\n type: String,\n default: '',\n },\n },\n emits: {\n sort: (_event: Sortable.SortableEvent) => true,\n add: (_event: Sortable.SortableEvent) => true,\n start: (_event: Sortable.SortableEvent) => true,\n end: (_event: Sortable.SortableEvent) => true,\n },\n setup(props, { attrs, emit, slots }) {\n const el = ref<HTMLElement>()\n let sortable: Sortable | undefined\n\n const mount = () => {\n if (!el.value) {\n return\n }\n\n sortable?.destroy()\n sortable = Sortable.create(el.value, {\n animation: 140,\n ...props.options,\n onSort(event) {\n props.options.onSort?.(event)\n emit('sort', event)\n },\n onAdd(event) {\n props.options.onAdd?.(event)\n emit('add', event)\n },\n onStart(event) {\n props.options.onStart?.(event)\n emit('start', event)\n },\n onEnd(event) {\n props.options.onEnd?.(event)\n emit('end', event)\n },\n })\n }\n\n onMounted(mount)\n watch(() => props.optionsKey, mount)\n onBeforeUnmount(() => sortable?.destroy())\n\n return () =>\n h(\n props.tag,\n {\n ...attrs,\n ref: el,\n },\n slots.default?.(),\n ) as VNode\n },\n})\n","import { defineComponent, h, type PropType } from 'vue'\nimport type { DraftState } from '../state/types'\nimport type { DesignerMaterial, DesignerMaterialCategory } from '../extensions/material'\nimport { designerMaterialCategories, listBuiltInDesignerMaterials, templateItems } from './components'\nimport { renderPaletteIcon } from '../shared/icons'\nimport { SortableList } from '../canvas/sortable-list'\n\nconst paletteSortableOptions = {\n group: {\n name: 'sparq-designer',\n pull: 'clone' as const,\n put: false,\n },\n sort: false,\n draggable: '[data-designer-material]',\n}\n\n/** 左侧组件与模板面板,输出拖放数据但不直接修改草稿 schema。 */\nexport const Sidebar = defineComponent({\n name: 'SparqDesignerSidebar',\n props: {\n state: {\n type: Object as PropType<DraftState>,\n required: true,\n },\n showTemplates: {\n type: Boolean,\n default: true,\n },\n },\n setup(props) {\n return () => (\n <aside class='sparq-designer-sidebar'>\n <div class='sparq-designer-tabs'>\n <button\n type='button'\n class={props.state.sidebarTab === 'components' ? 'is-active' : undefined}\n onClick={() => (props.state.sidebarTab = 'components')}\n >\n 组件\n </button>\n {props.showTemplates ? (\n <button\n type='button'\n class={props.state.sidebarTab === 'templates' ? 'is-active' : undefined}\n onClick={() => (props.state.sidebarTab = 'templates')}\n >\n 模板\n </button>\n ) : undefined}\n </div>\n {props.state.sidebarTab === 'components' ? (\n <div class='sparq-designer-sidebar__scroll'>\n {designerMaterialCategories.flatMap((category) => {\n const materials = listMaterials(props.state, category.key)\n return materials.length\n ? [\n <section class='sparq-designer-category' key={category.key}>\n <h3>{category.title}</h3>\n {renderMaterialList(materials)}\n </section>,\n ]\n : []\n })}\n </div>\n ) : (\n <div class='sparq-designer-sidebar__scroll'>\n <section class='sparq-designer-group'>\n <h3>表单模板</h3>\n {templateItems.map((item) => (\n <button type='button' class='sparq-designer-template' disabled>\n <strong>{item.title}</strong>\n <small>{item.description}</small>\n </button>\n ))}\n </section>\n </div>\n )}\n </aside>\n )\n },\n})\n\nfunction listMaterials(state: DraftState, category: DesignerMaterialCategory): DesignerMaterial[] {\n return state.extensionContext?.listMaterials(category) ?? listBuiltInDesignerMaterials(category)\n}\n\nfunction renderMaterialList(materials: DesignerMaterial[]) {\n return h(\n SortableList,\n {\n tag: 'div',\n class: 'sparq-designer-palette-list',\n options: paletteSortableOptions,\n },\n {\n default: () =>\n materials.map((material) => (\n <button\n type='button'\n class='sparq-designer-component'\n data-designer-material=''\n data-material-key={material.key}\n >\n <span class='sparq-designer-component__icon'>{renderPaletteIcon(material.icon)}</span>\n <span>\n <strong>{material.title}</strong>\n </span>\n </button>\n )),\n },\n )\n}\n","import { defineComponent, h, type PropType, type VNodeChild } from 'vue'\nimport type { RuntimeViewNode } from '@sparqjs/schema-core'\nimport { renderNodeActionIcon } from '../shared/icons'\n\n/** 包裹单个画布节点,提供选中边框、拖动手柄和节点快捷操作。 */\nexport const NodeFrame = defineComponent({\n name: 'SparqDesignerNodeFrame',\n props: {\n node: {\n type: Object as PropType<RuntimeViewNode>,\n required: true,\n },\n selectedNodeIds: Object as PropType<ReadonlySet<string>>,\n selected: {\n type: Boolean,\n default: false,\n },\n path: {\n type: String,\n required: true,\n },\n content: {\n type: null as unknown as PropType<VNodeChild>,\n default: undefined,\n },\n span: Number,\n canMoveUp: {\n type: Boolean,\n default: true,\n },\n canMoveDown: {\n type: Boolean,\n default: true,\n },\n selectable: {\n type: Boolean,\n default: true,\n },\n editable: {\n type: Boolean,\n default: true,\n },\n movable: {\n type: Boolean,\n default: true,\n },\n copyable: {\n type: Boolean,\n default: true,\n },\n deletable: {\n type: Boolean,\n default: true,\n },\n },\n emits: {\n select: (_path: string) => true,\n copy: () => true,\n up: () => true,\n down: () => true,\n remove: () => true,\n },\n setup(props, { emit }) {\n const stop = (event: MouseEvent) => {\n event.preventDefault()\n event.stopPropagation()\n }\n\n return () => (\n <div\n class={[\n 'sparq-designer-node',\n (props.selectedNodeIds ? props.selectedNodeIds.has(props.path) : props.selected)\n ? 'is-selected'\n : undefined,\n !props.editable ? 'is-readonly' : undefined,\n !props.selectable ? 'is-unselectable' : undefined,\n ]}\n style={{ '--sparq-designer-node-span': String(props.span ?? props.node.span ?? 24) }}\n data-designer-node=''\n data-node-id={props.node.id}\n data-node-path={props.path}\n data-designer-movable={props.movable ? 'true' : 'false'}\n onClick={(event: MouseEvent) => {\n event.stopPropagation()\n if (props.selectable) {\n emit('select', props.path)\n }\n }}\n >\n <div class='sparq-designer-node__overlay' aria-hidden='true' />\n {!props.editable ? (\n <span class='sparq-designer-node__readonly' title='只读节点'>\n {renderNodeActionIcon('lock')}\n <span>只读</span>\n </span>\n ) : undefined}\n {props.movable || props.copyable || props.deletable ? (\n <div class='sparq-designer-node__bar' role='toolbar' aria-label='节点操作'>\n {props.movable ? (\n <span class='sparq-designer-node__move-actions'>\n <button\n type='button'\n class='sparq-designer-node__drag'\n title='拖拽'\n aria-label='拖拽'\n onClick={stop}\n >\n {renderNodeActionIcon('drag')}\n </button>\n <button\n type='button'\n title='上移'\n aria-label='上移'\n disabled={!props.canMoveUp}\n onClick={(event) => {\n stop(event)\n if (props.canMoveUp) {\n emit('up')\n }\n }}\n >\n {renderNodeActionIcon('up')}\n </button>\n <button\n type='button'\n title='下移'\n aria-label='下移'\n disabled={!props.canMoveDown}\n onClick={(event) => {\n stop(event)\n if (props.canMoveDown) {\n emit('down')\n }\n }}\n >\n {renderNodeActionIcon('down')}\n </button>\n </span>\n ) : undefined}\n {props.copyable ? (\n <button\n type='button'\n title='复制'\n aria-label='复制'\n onClick={(event) => (stop(event), emit('copy'))}\n >\n {renderNodeActionIcon('copy')}\n </button>\n ) : undefined}\n {props.deletable ? (\n <button\n type='button'\n class='is-danger'\n title='删除'\n aria-label='删除'\n onClick={(event) => (stop(event), emit('remove'))}\n >\n {renderNodeActionIcon('remove')}\n </button>\n ) : undefined}\n </div>\n ) : undefined}\n <div class='sparq-designer-node__body'>{props.content}</div>\n </div>\n )\n },\n})\n","import { createElementPlusUiAdapter, createElementPlusUiKit } from '@sparqjs/schema-ui-element-plus'\nimport { createSchemaUiProxy, type SchemaUiAdapter, type SchemaUiProxy, type UiKit } from '@sparqjs/schema-vue'\n\n/** 创建 Inspector 与设计器弹层使用的 Element Plus 基础 UiKit。 */\nexport function createDesignerElementPlusUiKit(): UiKit {\n return createElementPlusUiKit()\n}\n\n/** 创建面向旧 Schema UI 调用方式的 Element Plus proxy,保持设计器内部兼容。 */\nexport function createDesignerElementPlusSchemaUi(): SchemaUiProxy {\n return createSchemaUiProxy(createDesignerElementPlusUiKit())\n}\n\n/**\n * 创建 Designer 使用的 Element Plus adapter。\n *\n * Inspector 可注入命令拒绝错误,adapter 只负责把错误合并到对应字段绑定,不承担业务校验。\n */\nexport function createDesignerElementPlusUiAdapter(\n fieldErrors: Readonly<Record<string, string[]>> = {},\n): SchemaUiAdapter {\n const adapter = createElementPlusUiAdapter()\n return {\n ...adapter,\n renderField(context) {\n const key = context.node.field\n const errors = key ? fieldErrors[key] : undefined\n if (!context.binding || !errors?.length) {\n return adapter.renderField?.(context)\n }\n return adapter.renderField?.({\n ...context,\n binding: {\n ...context.binding,\n errors: [...context.binding.errors, ...errors],\n },\n })\n },\n }\n}\n","import { cloneVNode, h, isVNode, type VNodeChild } from 'vue'\nimport type { RuntimeViewNode } from '@sparqjs/schema-core'\nimport {\n SectionBlock,\n resolveFormChildLayout,\n type SchemaContainerContext,\n type SchemaFieldContext,\n type SchemaFormState,\n type SchemaLayoutNodeContext,\n type SchemaUiAdapter,\n} from '@sparqjs/schema-vue'\nimport type Sortable from 'sortablejs'\nimport type { ResourceField, SchemaResource, ViewNode } from '@sparqjs/schema-protocol'\nimport { NodeFrame } from './node-frame'\nimport { SortableList } from './sortable-list'\nimport type { DraftState } from '../state/types'\nimport type { ResolvedDesignerNodePermissions } from '../extensions/instance'\nimport { createDesignerElementPlusUiAdapter } from '../shared/ui-adapter'\nimport {\n copySelectedNode,\n canPlaceDesignerNode,\n getFormView,\n getDesignerNodePermissions,\n getFields,\n getFormChildren,\n getNodeMoveAvailability,\n insertDesignerMaterialInto,\n moveNodeToParent,\n moveSelectedNode,\n removeSelectedNode,\n resolveDesignerNodePermissions,\n selectNode,\n} from '../state/draft'\nimport { getVisibleSiblings, type NodeMoveContext } from '../state/visibility'\nimport { builtInDesignerMaterials } from '../sidebar/components'\n\nconst builtInMaterialMap = new Map(builtInDesignerMaterials.map((material) => [material.key, material] as const))\n\n/** Canvas adapter 组合真实表单状态、草稿状态和可选基础渲染器所需输入。 */\nexport interface AdapterOptions {\n state: DraftState\n form?: SchemaFormState\n base?: SchemaUiAdapter\n selectedNodeIds?: ReadonlySet<string>\n}\n\n/**\n * 创建画布专用 Schema UI adapter。\n *\n * 它复用真实 UI 渲染结果,并在字段和布局外包裹选中、拖放、复制和删除交互。\n */\nexport function createCanvasAdapter(options: AdapterOptions): SchemaUiAdapter {\n const base = options.base ?? createDesignerElementPlusUiAdapter()\n const resolveNodeMetadata = createCanvasNodeMetadataResolver(options)\n const renderOptions: CanvasRenderOptions = { ...options, resolveNodeMetadata }\n const renderField = createCachedCanvasFieldRenderer(renderOptions, base)\n\n return {\n ...base,\n renderContainer(context: SchemaContainerContext) {\n if (context.kind === 'form') {\n return renderFormContainer(options.state, context, base)\n }\n\n return base.renderContainer?.(context)\n },\n renderField(context: SchemaFieldContext) {\n return renderField(context)\n },\n renderLayoutNode(context: SchemaLayoutNodeContext) {\n const content = renderLayoutNodeWithDropZone(options.state, context, base, { form: options.form?.values })\n return renderFrame(renderOptions, context.node, content)\n },\n }\n}\n\nfunction createCachedCanvasFieldRenderer(\n options: CanvasRenderOptions,\n base: SchemaUiAdapter,\n): (context: SchemaFieldContext) => VNodeChild {\n const frames = new Map<string, { signature: string; vnode: VNodeChild }>()\n let schema: SchemaResource | undefined\n let extensionContext = options.state.extensionContext\n\n return (context) => {\n if (schema !== options.state.schema) {\n schema = options.state.schema\n const nodeIds = collectCanvasNodeIds(options.state)\n for (const nodeId of frames.keys()) {\n if (!nodeIds.has(nodeId)) {\n frames.delete(nodeId)\n }\n }\n }\n if (extensionContext !== options.state.extensionContext) {\n frames.clear()\n extensionContext = options.state.extensionContext\n }\n\n const id = context.node.raw.id ?? context.node.id\n const frameState = resolveCanvasFrameState(options, context.node)\n const signature = JSON.stringify({\n node: context.node.raw,\n span: context.node.span,\n field: context.node.fieldSchema,\n disabled: context.disabled,\n readonly: context.readonly,\n placeholder: context.placeholder,\n options: context.options,\n value: context.binding?.value,\n errors: context.binding?.errors,\n loading: context.binding?.loading,\n move: frameState.move,\n permissions: frameState.permissions,\n })\n const cached = frames.get(id)\n if (cached?.signature === signature) {\n return cached.vnode\n }\n\n const content = base.renderField?.(context)\n const vnode = renderFrame(options, context.node, content, frameState)\n frames.set(id, { signature, vnode })\n return vnode\n }\n}\n\nfunction collectCanvasNodeIds(state: DraftState): Set<string> {\n const ids = new Set<string>()\n const collect = (nodes: ViewNode[]) => {\n for (const node of nodes) {\n if (node.id) {\n ids.add(node.id)\n }\n collect(node.children ?? [])\n }\n }\n\n collect(getFormChildren(state.schema, state.viewName))\n return ids\n}\n\n/** 渲染设计器 section,并把其 children 区域转换为可接收节点的嵌套拖放区。 */\nexport function renderDesignerSection(\n state: DraftState,\n node: RuntimeViewNode,\n children: VNodeChild[] | undefined,\n form?: SchemaFormState,\n): VNodeChild {\n const id = node.raw.id ?? node.id\n\n return renderFrame(\n { state, form },\n node,\n SectionBlock(\n {\n node,\n title: node.raw.title,\n help: node.raw.help,\n props: node.raw.props,\n },\n {\n default: () =>\n renderChildrenDropZone(state, id, children, '拖入字段或视图节点', { form: form?.values }),\n },\n ),\n )\n}\n\nfunction renderFormContainer(state: DraftState, context: SchemaContainerContext, base: SchemaUiAdapter): VNodeChild {\n const dropZone = renderChildrenDropZone(\n state,\n undefined,\n context.items?.map((item) => withCanvasItemSpan(item.content, item.span ?? context.layout?.span)),\n '拖入左侧字段或视图节点',\n { form: context.form?.values },\n { gap: context.layout?.gap },\n )\n\n const content = base.renderContainer?.({\n ...context,\n props: {\n ...context.props,\n },\n items: [\n {\n span: 24,\n content: dropZone,\n },\n ],\n children: dropZone,\n })\n\n return h('div', { class: 'sparq-designer-form-canvas' }, [content])\n}\n\nfunction withCanvasItemSpan(content: VNodeChild, span: number | undefined): VNodeChild {\n if (span === undefined || !isVNode(content) || content.type !== NodeFrame) {\n return content\n }\n\n return cloneVNode(content, { span })\n}\n\ninterface CanvasDragSession {\n schema: SchemaResource\n node?: ViewNode\n nodeId?: string\n movable: boolean\n placement: Map<string | undefined, boolean>\n}\n\nconst canvasDragSessions = new WeakMap<DraftState, CanvasDragSession>()\n\n/** 创建共享同一草稿拖拽会话的 Sortable 配置,供根级与嵌套放置区复用。 */\nexport function createSortableOptions(state: DraftState, parentId: string | undefined, context: NodeMoveContext = {}) {\n return {\n group: {\n name: 'sparq-designer',\n pull: true,\n put: true,\n },\n handle: '.sparq-designer-node__drag',\n draggable: '[data-designer-node]',\n ghostClass: 'is-ghost',\n chosenClass: 'is-chosen',\n emptyInsertThreshold: 24,\n swapThreshold: 0.65,\n invertSwap: true,\n onStart(event: Sortable.SortableEvent) {\n canvasDragSessions.set(state, createCanvasDragSession(state, event.item.dataset.nodePath))\n },\n onMove(event: Sortable.MoveEvent) {\n const nodeId = event.dragged.dataset.nodePath\n if (!nodeId) {\n return true\n }\n\n let session = canvasDragSessions.get(state)\n if (session?.schema !== state.schema || session.nodeId !== nodeId) {\n session = createCanvasDragSession(state, nodeId)\n canvasDragSessions.set(state, session)\n }\n if (!session.node || !session.movable) {\n return false\n }\n\n const targetParentId = event.to.dataset.designerParentId || undefined\n const cached = session.placement.get(targetParentId)\n if (cached !== undefined) {\n return cached\n }\n\n const allowed = canPlaceDesignerNode(state, session.node, targetParentId)\n session.placement.set(targetParentId, allowed)\n return allowed\n },\n onAdd(event: Sortable.SortableEvent) {\n const dataset = (event.item as HTMLElement).dataset\n const targetIndex = resolveCanvasDropIndex(state, parentId, event.newIndex, context, dataset.nodePath)\n if (dataset.materialKey) {\n event.item.remove()\n const material = state.extensionContext\n ? state.extensionContext.getMaterial(dataset.materialKey)\n : builtInMaterialMap.get(dataset.materialKey)\n if (material) {\n insertDesignerMaterialInto(state, parentId, material, targetIndex)\n }\n return\n }\n\n if (dataset.nodePath) {\n moveNodeToParent(state, dataset.nodePath, parentId, targetIndex, { adjustSameParentIndex: false })\n }\n },\n onEnd(event: Sortable.SortableEvent) {\n try {\n if (\n event.from !== event.to ||\n event.oldIndex === undefined ||\n event.newIndex === undefined ||\n event.item.dataset.materialKey\n ) {\n return\n }\n const nodeId = event.item.dataset.nodePath\n if (!nodeId) {\n return\n }\n\n const targetIndex = resolveCanvasDropIndex(state, parentId, event.newIndex, context, nodeId)\n moveNodeToParent(state, nodeId, parentId, targetIndex)\n } finally {\n canvasDragSessions.delete(state)\n }\n },\n }\n}\n\nfunction createCanvasDragSession(state: DraftState, nodeId: string | undefined): CanvasDragSession {\n const roots = getFormChildren(state.schema, state.viewName)\n const node = nodeId ? findNodeInTree(roots, nodeId) : undefined\n return {\n schema: state.schema,\n node,\n nodeId,\n movable: Boolean(nodeId && node && getDesignerNodePermissions(state, nodeId).movable),\n placement: new Map(),\n }\n}\n\n/**\n * 将可见节点索引转换为真实 siblings 索引。\n *\n * 条件隐藏节点仍保留在 schema 中,拖放不能因为它们不可见而插入到错误位置。\n */\nexport function resolveCanvasDropIndex(\n state: DraftState,\n parentId: string | undefined,\n visibleIndex: number | undefined,\n context: NodeMoveContext = {},\n movingNodeId?: string,\n): number {\n const siblings = getCanvasChildren(state, parentId)\n if (!siblings.length) {\n return 0\n }\n\n const visibleSiblings = getVisibleSiblings(siblings, context).filter((node) => node.id !== movingNodeId)\n if (!visibleSiblings.length || visibleIndex === undefined) {\n return siblings.length\n }\n\n const nextVisibleIndex = Math.max(0, Math.min(visibleIndex, visibleSiblings.length))\n if (nextVisibleIndex <= 0) {\n return resolveNodeIndex(siblings, visibleSiblings[0]?.id)\n }\n if (nextVisibleIndex >= visibleSiblings.length) {\n return siblings.length\n }\n\n return resolveNodeIndex(siblings, visibleSiblings[nextVisibleIndex]?.id)\n}\n\nfunction getCanvasChildren(state: DraftState, parentId: string | undefined): ViewNode[] {\n const roots = getFormChildren(state.schema, state.viewName)\n if (!parentId) {\n return roots\n }\n\n return findNodeChildren(roots, parentId) ?? []\n}\n\nfunction findNodeChildren(nodes: ViewNode[], parentId: string): ViewNode[] | undefined {\n for (const node of nodes) {\n if (node.id === parentId) {\n return node.children ?? []\n }\n const children = findNodeChildren(node.children ?? [], parentId)\n if (children) {\n return children\n }\n }\n\n return undefined\n}\n\nfunction findNodeInTree(nodes: ViewNode[], nodeId: string): ViewNode | undefined {\n for (const node of nodes) {\n if (node.id === nodeId) {\n return node\n }\n const child = findNodeInTree(node.children ?? [], nodeId)\n if (child) {\n return child\n }\n }\n\n return undefined\n}\n\nfunction resolveNodeIndex(siblings: ViewNode[], nodeId: string | undefined): number {\n const index = siblings.findIndex((node) => node.id === nodeId)\n return index >= 0 ? index : siblings.length\n}\n\nfunction renderChildrenDropZone(\n state: DraftState,\n parentId: string | undefined,\n children: VNodeChild[] | undefined,\n emptyText: string,\n context: NodeMoveContext = {},\n layout: { gap?: number } = {},\n): VNodeChild {\n return h(\n SortableList,\n {\n tag: 'div',\n class: ['sparq-designer-node-list', parentId ? 'is-nested' : undefined],\n options: createSortableOptions(state, parentId, context),\n optionsKey: parentId ?? 'root',\n 'data-designer-parent-id': parentId ?? '',\n style: layout.gap === undefined ? undefined : { gap: `${layout.gap}px` },\n },\n {\n default: () =>\n children?.length ? children : h('div', { class: 'sparq-designer-node-list__empty' }, emptyText),\n },\n )\n}\n\ninterface CanvasNodeMetadata {\n node: ViewNode\n parentId?: string\n field?: ResourceField\n canMoveUp: boolean\n canMoveDown: boolean\n}\n\ninterface CanvasRenderOptions extends AdapterOptions {\n resolveNodeMetadata?: (nodeId: string) => CanvasNodeMetadata | undefined\n}\n\ninterface CanvasFrameState {\n move: { canMoveUp: boolean; canMoveDown: boolean }\n permissions: ResolvedDesignerNodePermissions\n}\n\nfunction resolveCanvasFrameState(options: CanvasRenderOptions, node: RuntimeViewNode): CanvasFrameState {\n const state = options.state\n const id = node.raw.id ?? node.id\n const moveContext = { form: options.form?.values }\n const metadata = options.resolveNodeMetadata?.(id)\n const move = metadata ?? getNodeMoveAvailability(state, id, moveContext)\n const permissions = metadata\n ? resolveDesignerNodePermissions(state, metadata.node, metadata.parentId, state.schema, metadata.field)\n : getDesignerNodePermissions(state, id)\n\n return { move, permissions }\n}\n\nfunction renderFrame(\n options: CanvasRenderOptions,\n node: RuntimeViewNode,\n content: VNodeChild,\n frameState = resolveCanvasFrameState(options, node),\n): VNodeChild {\n const state = options.state\n const id = node.raw.id ?? node.id\n const { move, permissions } = frameState\n const moveContext = { form: options.form?.values }\n\n return h(NodeFrame, {\n key: id,\n node,\n path: id,\n canMoveUp: move.canMoveUp,\n canMoveDown: move.canMoveDown,\n selectable: permissions.selectable,\n editable: permissions.editable,\n movable: permissions.selectable && permissions.movable,\n copyable: permissions.selectable && permissions.copyable,\n deletable: permissions.selectable && permissions.deletable,\n selected:\n options.selectedNodeIds === undefined &&\n state.selection?.type === 'form-node' &&\n state.selection.path === id,\n selectedNodeIds: options.selectedNodeIds,\n content,\n onSelect(nextPath: string) {\n selectNode(state, nextPath)\n },\n onCopy() {\n state.selection = { type: 'form-node', path: id }\n copySelectedNode(state)\n },\n onUp() {\n state.selection = { type: 'form-node', path: id }\n moveSelectedNode(state, -1, moveContext)\n },\n onDown() {\n state.selection = { type: 'form-node', path: id }\n moveSelectedNode(state, 1, moveContext)\n },\n onRemove() {\n state.selection = { type: 'form-node', path: id }\n removeSelectedNode(state)\n },\n })\n}\n\nfunction createCanvasNodeMetadataResolver(options: AdapterOptions): (nodeId: string) => CanvasNodeMetadata | undefined {\n let cachedSchema: SchemaResource | undefined\n let cachedExtensionContext = options.state.extensionContext\n let cachedFormValues = options.form?.values\n let metadata = new Map<string, CanvasNodeMetadata>()\n\n return (nodeId) => {\n if (\n cachedSchema !== options.state.schema ||\n cachedExtensionContext !== options.state.extensionContext ||\n cachedFormValues !== options.form?.values\n ) {\n cachedSchema = options.state.schema\n cachedExtensionContext = options.state.extensionContext\n cachedFormValues = options.form?.values\n metadata = createCanvasNodeMetadata(options.state, { form: cachedFormValues })\n }\n return metadata.get(nodeId)\n }\n}\n\nfunction createCanvasNodeMetadata(state: DraftState, context: NodeMoveContext): Map<string, CanvasNodeMetadata> {\n const metadata = new Map<string, CanvasNodeMetadata>()\n const fields = new Map(getFields(state.schema).map((field) => [field.name, field]))\n\n const visit = (nodes: ViewNode[], parentId?: string) => {\n const visibleNodes = getVisibleSiblings(nodes, context)\n const visibleIndexes = new Map(visibleNodes.map((node, index) => [node.id, index]))\n\n for (const node of nodes) {\n if (node.id) {\n const visibleIndex = visibleIndexes.get(node.id)\n metadata.set(node.id, {\n node,\n parentId,\n field: node.field ? fields.get(node.field) : undefined,\n canMoveUp: visibleIndex !== undefined && visibleIndex > 0,\n canMoveDown: visibleIndex !== undefined && visibleIndex < visibleNodes.length - 1,\n })\n }\n visit(node.children ?? [], node.id)\n }\n }\n\n visit(getFormChildren(state.schema, state.viewName))\n return metadata\n}\n\nfunction renderLayoutNodeWithDropZone(\n state: DraftState,\n context: SchemaLayoutNodeContext,\n base: SchemaUiAdapter,\n moveContext: NodeMoveContext = {},\n): VNodeChild {\n const node = context.node\n if (!isContainerLayoutNode(node.type)) {\n return base.renderLayoutNode?.(context)\n }\n\n const id = node.raw.id ?? node.id\n const formView = getFormView(state.schema, state.viewName)\n const childLayout = resolveFormChildLayout(formView, node)\n const dropZone = renderChildrenDropZone(\n state,\n id,\n context.items?.map((item) => withCanvasItemSpan(item.content, item.span ?? childLayout?.span)),\n '拖入字段或视图节点',\n moveContext,\n { gap: childLayout?.gap },\n )\n\n return base.renderLayoutNode?.({\n ...context,\n items: [\n {\n node,\n span: 24,\n content: dropZone,\n },\n ],\n children: [dropZone],\n })\n}\n\n/** 判断布局节点是否允许 Canvas 在其内部创建子节点拖放区。 */\nfunction isContainerLayoutNode(type: RuntimeViewNode['type']): boolean {\n return [\n 'group',\n 'section',\n 'card',\n 'grid',\n 'row',\n 'col',\n 'tabs',\n 'tab',\n 'collapse',\n 'collapse-item',\n 'custom',\n ].includes(type)\n}\n","import { computed, defineComponent, h, reactive, toRaw, watch, type PropType, type VNodeChild } from 'vue'\nimport { SCHEMA_COMPONENT_SECTION, createDefaultInitialValues, createSchemaRuntime } from '@sparqjs/schema-core'\nimport {\n SparqView,\n createSchemaComponentRegistry,\n createSparqViewController,\n type SchemaComponentRegistry,\n type SparqRichTextRegistry,\n} from '@sparqjs/schema-vue'\nimport { createCanvasAdapter, renderDesignerSection } from './adapter'\nimport type { DraftState } from '../state/types'\nimport { createDesignerElementPlusUiKit } from '../shared/ui-adapter'\n\n/** 使用真实 schema renderer 展示草稿,并叠加设计器节点交互和拖放能力。 */\nexport const Canvas = defineComponent({\n name: 'SparqDesignerCanvas',\n props: {\n state: {\n type: Object as PropType<DraftState>,\n required: true,\n },\n components: Object as PropType<SchemaComponentRegistry>,\n richTextEditors: Object as PropType<SparqRichTextRegistry>,\n },\n setup(props) {\n const runtime = createSchemaRuntime()\n const controller = createSparqViewController({\n applyDefaults: true,\n schema: props.state.schema.schema,\n })\n watch(\n () => props.state.schema,\n (schema) => {\n controller.setValues(createDefaultInitialValues({ schema: schema.schema }))\n },\n { deep: true },\n )\n const selectedNodeIds = reactive(new Set<string>())\n watch(\n () => (props.state.selection?.type === 'form-node' ? props.state.selection.path : undefined),\n (selectedNodeId, previousNodeId) => {\n if (previousNodeId) {\n selectedNodeIds.delete(previousNodeId)\n }\n if (selectedNodeId) {\n selectedNodeIds.add(selectedNodeId)\n }\n },\n { immediate: true, flush: 'sync' },\n )\n const adapter = computed(() =>\n createCanvasAdapter({ state: props.state, form: controller.form, selectedNodeIds }),\n )\n const uiKit = createDesignerElementPlusUiKit()\n const components = computed(() =>\n createSchemaComponentRegistry([\n ...(props.components?.entries() ?? []),\n [\n SCHEMA_COMPONENT_SECTION,\n {\n render(_props, slots, context) {\n if (!context?.node) {\n return undefined\n }\n return renderDesignerSection(\n props.state,\n context.node,\n normalizeSlotChildren(slots),\n controller.form,\n )\n },\n },\n ],\n ]),\n )\n\n return () => (\n <main class='sparq-designer-canvas'>\n <div class={['sparq-designer-stage', `is-${props.state.device}`]}>\n <SparqView\n schema={toRaw(props.state.schema)}\n mode='form'\n view={props.state.viewName}\n runtime={runtime}\n controller={controller}\n uiAdapter={adapter.value}\n uiKit={uiKit}\n components={components.value}\n icons={props.state.extensionContext?.icons}\n richTextEditors={props.richTextEditors}\n />\n </div>\n </main>\n )\n },\n})\n\nfunction normalizeSlotChildren(slots: unknown): VNodeChild[] | undefined {\n if (!slots || typeof slots !== 'object' || !('default' in slots)) {\n return undefined\n }\n\n const slot = (slots as { default?: () => VNodeChild }).default\n const children = slot?.()\n return Array.isArray(children) ? children : children === undefined ? undefined : [children]\n}\n","import type { ViewNode } from '@sparqjs/schema-protocol'\n\n/** 将一组属性控件包装为 Inspector 专用的可折叠 section。 */\nexport function createPropertySectionNode(\n key: string,\n title: string,\n children: ViewNode[],\n defaultOpen: boolean,\n): ViewNode {\n return {\n type: 'custom',\n name: key,\n title,\n className: 'sparq-designer-property-section',\n props: { defaultOpen },\n children: [\n {\n type: 'custom',\n span: 24,\n gap: 8,\n className: 'sparq-designer-property-group',\n children,\n },\n ],\n }\n}\n","import { type ResourceField, type SchemaResource, type ViewNode } from '@sparqjs/schema-protocol'\nimport { cloneSerializable } from '../shared/clone'\nimport { cleanupEmptyObjects, getObjectPathValue, isPlainObjectRecord, setObjectPathValue } from '../shared/object-path'\nimport {\n createFieldSchemaSections,\n getDesignerComponentPropertyConfig,\n type DesignerMultiplePolicy,\n type FieldPropertyField,\n type FieldSchemaContext,\n type FieldSchemaSection,\n} from './field-schema'\nimport { designerCapabilityCardKeys, getDesignerCapabilityCard } from './capabilities'\nimport { getRequiredValidationRule } from './required-validation'\nimport { createPropertySectionNode } from './property-section'\nimport { defaultNodePropsForComponent, isFieldTypeLocked, normalizeFieldTypeForNode } from '../state/component-config'\nimport { loadDesignerService, type DesignerServiceOption, type DesignerServiceRegistry } from '../services/registry'\n\n/** Inspector 字段表单的扁平值映射,key 对应 FieldPropertyField.key。 */\nexport type FieldPropertyValues = Record<string, unknown>\n/** 异步数据源加载后的属性选项映射。 */\nexport type FieldPropertyOptionState = Record<string, DesignerServiceOption[]>\n\n/** 已确认的一项属性写回请求。 */\nexport interface FieldPropertyChange {\n property: FieldPropertyField\n value: unknown\n}\n\n/**\n * 把字段属性声明转换为 SqRender 可渲染的临时 SchemaResource。\n *\n * 该 schema 只服务 Inspector,不会写入用户业务 schema。\n */\nexport function createFieldPropertySchema(\n context: FieldSchemaContext,\n options: FieldPropertyOptionState = {},\n serviceRegistry?: DesignerServiceRegistry,\n sections: readonly FieldSchemaSection[] = createFieldSchemaSections(context),\n): SchemaResource {\n const fields: ResourceField[] = []\n const children: ViewNode[] = []\n\n for (const section of sections) {\n fields.push(\n ...section.fields.map((field) => createPropertyField(field, options[field.key], context.readonly, context)),\n )\n children.push(\n createPropertySectionNode(\n section.key,\n section.title,\n section.fields.map((field) => createPropertyNode(field, serviceRegistry)),\n true,\n ),\n )\n }\n\n return {\n schema: {\n version: '1.0',\n name: 'designer_field_properties',\n fields,\n views: {\n forms: {\n default: {\n footer: false,\n span: 24,\n gap: 10,\n children,\n props: {\n labelPosition: 'left',\n labelWidth: '96px',\n size: 'default',\n showMessage: true,\n },\n },\n },\n },\n },\n }\n}\n\n/** 生成反映当前属性结构的稳定 key,Inspector 用它判断是否需要重建属性表单。 */\nexport function createFieldPropertySchemaKey(\n context: FieldSchemaContext,\n sections: readonly FieldSchemaSection[] = createFieldSchemaSections(context),\n): string {\n const key = sections\n .flatMap((section) => [\n section.key,\n ...section.fields.map(\n (field) => `${field.key}:${field.editLevel}:${field.commitMode}:${field.component ?? field.kind}`,\n ),\n ])\n .join('|')\n const defaultValueSignature = sections.some((section) =>\n section.fields.some((field) => field.key === 'field.default'),\n )\n ? JSON.stringify({\n component: context.node.component,\n props: context.node.props,\n type: context.field?.type,\n multiple: context.field?.multiple,\n options: context.field?.options,\n reference: context.field?.reference,\n readonly: context.field?.readonly,\n dynamic: Boolean(context.field?.default_expr),\n computed: Boolean(context.field?.computed_expr),\n })\n : ''\n return `${context.readonly ? 'readonly' : 'editable'}|${key}|${defaultValueSignature}`\n}\n\n/**\n * 加载字段属性声明中的设计期选项数据源。\n *\n * 属性 schema 本身保持同步生成,异步结果由 Inspector 注入后重建 schema。这样请求取消、\n * 节点切换和后续缓存策略都留在设计器状态层,不进入纯 schema 组装函数。\n */\nexport async function loadFieldPropertyDataSourceOptions(\n context: FieldSchemaContext,\n values: FieldPropertyValues,\n signal?: AbortSignal,\n registry?: DesignerServiceRegistry,\n sections: readonly FieldSchemaSection[] = createFieldSchemaSections(context),\n): Promise<FieldPropertyOptionState> {\n const entries = sections\n .flatMap((section) => section.fields)\n .filter((field) => field.kind === 'select' && field.dataSource)\n .map(async (field) => {\n const dataSource = field.dataSource\n if (!dataSource) {\n return undefined\n }\n\n const params = resolveFieldPropertyDataSourceParams(dataSource, values)\n if (hasMissingDependentPropertyValue(dataSource, values)) {\n return [field.key, [] as DesignerServiceOption[]] as const\n }\n const result = await loadDesignerService<DesignerServiceOption[]>(\n dataSource.provider,\n context,\n params,\n signal,\n registry,\n )\n\n return [field.key, result] as const\n })\n\n const loaded = await Promise.all(entries)\n const next: FieldPropertyOptionState = {}\n for (const entry of loaded) {\n if (entry) {\n next[entry[0]] = entry[1]\n }\n }\n return next\n}\n\nfunction hasMissingDependentPropertyValue(\n dataSource: NonNullable<FieldPropertyField['dataSource']>,\n values: FieldPropertyValues,\n): boolean {\n return Object.values(dataSource.paramsFromValues ?? {}).some((valuePath) => {\n const value = values[valuePath]\n return value === undefined || value === null || value === ''\n })\n}\n\nfunction resolveFieldPropertyDataSourceParams(\n dataSource: NonNullable<FieldPropertyField['dataSource']>,\n values: FieldPropertyValues,\n): Record<string, unknown> | undefined {\n const params: Record<string, unknown> = { ...(dataSource.params ?? {}) }\n for (const [paramName, valuePath] of Object.entries(dataSource.paramsFromValues ?? {})) {\n params[paramName] = values[valuePath]\n }\n\n return Object.keys(params).length ? params : undefined\n}\n\n/** 从当前节点和字段读取属性表单初始值,JSON 字段会转换为可编辑文本。 */\nexport function createFieldPropertyValues(\n context: FieldSchemaContext,\n sections: readonly FieldSchemaSection[] = createFieldSchemaSections(context),\n): FieldPropertyValues {\n const values: FieldPropertyValues = {}\n\n for (const section of sections) {\n for (const field of section.fields) {\n const value = getFieldPropertyValue(context, field)\n if (value !== undefined) {\n values[field.key] = stringifyJsonField(field, value)\n }\n }\n }\n\n return values\n}\n\n/**\n * 批量应用完整属性表单值。\n *\n * 该兼容入口会执行组件切换归一化;命令式更新优先使用 applyFieldPropertyChanges。\n */\nexport function applyFieldPropertyValues(\n context: FieldSchemaContext,\n values: FieldPropertyValues,\n): { node: ViewNode; field?: ResourceField } {\n const changes: FieldPropertyChange[] = []\n\n for (const section of createFieldSchemaSections(context)) {\n for (const field of section.fields) {\n if (field.editLevel === 'readonly') {\n continue\n }\n\n changes.push({ property: field, value: values[field.key] })\n }\n }\n\n const { node: nextNode, field: nextField } = applyNormalizedFieldPropertyChanges(context, changes)\n normalizeFieldNameChange(context, nextNode, nextField)\n if (hasNodeComponentChanged(nextNode, context.node)) {\n normalizeNodePropsForComponent(nextNode)\n if (nextField) {\n nextField.type = normalizeFieldTypeForNode(\n nextNode,\n nextField,\n resolveComponentProfile(context, nextNode.component)?.fieldTypes,\n )\n normalizeFieldForNodeComponent(\n nextNode,\n context.node,\n nextField,\n resolveMultiplePolicy(context, nextNode.component),\n )\n }\n }\n\n cleanupEmptyObjects(nextNode.props)\n cleanupEmptyObjects(nextField?.options as Record<string, unknown> | undefined)\n\n return {\n node: nextNode,\n field: nextField,\n }\n}\n\n/** 只应用已确认的属性变更,保留未涉及的扩展字段和节点协议。 */\nexport function applyFieldPropertyChanges(\n context: FieldSchemaContext,\n changes: FieldPropertyChange[],\n): { node: ViewNode; field?: ResourceField } {\n const next = applyNormalizedFieldPropertyChanges(context, changes)\n if (changes.some((change) => change.property.key === 'field.name')) {\n normalizeFieldNameChange(context, next.node, next.field)\n }\n if (\n changes.some((change) => isNodePropsStorage(change.property)) &&\n next.node.props &&\n Object.keys(next.node.props).length === 0\n ) {\n delete next.node.props\n }\n if (next.field) {\n if (changes.some((change) => isUploadStorageProperty(change.property)) && isFieldTypeLocked(context.field)) {\n restoreLockedUploadStorageProps(context.node, next.node)\n } else {\n normalizeFieldForNodeComponent(\n next.node,\n context.node,\n next.field,\n resolveMultiplePolicy(context, next.node.component),\n hasNodeComponentChanged(next.node, context.node) ||\n changes.some((change) => isUploadStorageProperty(change.property)),\n )\n }\n }\n return next\n}\n\nfunction applyNormalizedFieldPropertyChanges(\n context: FieldSchemaContext,\n changes: FieldPropertyChange[],\n): { node: ViewNode; field?: ResourceField } {\n const node = cloneSerializable(context.node)\n const field = context.field ? cloneSerializable(context.field) : undefined\n\n for (const change of changes) {\n applyFieldPropertyValue(\n context,\n node,\n field,\n change.property,\n normalizeFieldValue(change.property, change.value),\n )\n }\n\n return { node, field }\n}\n\nfunction normalizeFieldNameChange(context: FieldSchemaContext, node: ViewNode, field: ResourceField | undefined): void {\n if (!field || !context.field) {\n return\n }\n\n const originalName = context.field.name\n const nextName = field.name\n if (nextName === originalName) {\n return\n }\n\n if (node.type === 'field' && node.field === originalName) {\n node.field = nextName\n }\n}\n\nfunction hasNodeComponentChanged(node: ViewNode, previousNode: ViewNode): boolean {\n return resolveNodeComponentForEdit(node) !== resolveNodeComponentForEdit(previousNode)\n}\n\nfunction resolveNodeComponentForEdit(node: ViewNode): string | undefined {\n return node.type === 'field' ? (node.component ?? 'text') : node.component\n}\n\nfunction normalizeFieldForNodeComponent(\n node: ViewNode,\n previousNode: ViewNode,\n field: ResourceField,\n multiplePolicy: DesignerMultiplePolicy | undefined,\n normalizeUpload = true,\n): void {\n if (!isFieldTypeLocked(field)) {\n if (multiplePolicy === 'multiple') {\n field.multiple = true\n } else if (multiplePolicy === 'single') {\n delete field.multiple\n }\n }\n\n if (normalizeUpload) {\n normalizeUploadFieldContract(node, field)\n }\n\n normalizeValidationRulesForComponent(node, previousNode, field)\n}\n\nfunction resolveMultiplePolicy(\n context: FieldSchemaContext,\n component: string | undefined,\n): DesignerMultiplePolicy | undefined {\n return resolveComponentProfile(context, component)?.multiple\n}\n\nfunction resolveComponentProfile(context: FieldSchemaContext, component: string | undefined) {\n const config =\n context.extensionContext?.getComponentPropertyConfig(component ?? '') ??\n getDesignerComponentPropertyConfig(component)\n return config?.profile\n}\n\nfunction normalizeUploadFieldContract(node: ViewNode, field: ResourceField): void {\n if (node.component !== 'image-upload' && node.component !== 'file-upload') {\n return\n }\n\n const valueMode = node.props?.valueMode === 'url' || node.props?.valueMode === 'asset' ? node.props.valueMode : 'id'\n const multiple = node.props?.multiple === true\n node.props ??= {}\n node.props.valueMode = valueMode\n node.props.multiple = multiple\n\n if (valueMode === 'asset') {\n field.type = 'json'\n delete field.multiple\n return\n }\n\n field.type = valueMode === 'url' ? 'string' : 'number'\n if (multiple) {\n field.multiple = true\n } else {\n delete field.multiple\n }\n}\n\nfunction isLockedUploadStorageProperty(property: FieldPropertyField): boolean {\n return property.key === 'props.valueMode' || property.key === 'props.multiple'\n}\n\nfunction isUploadStorageProperty(property: FieldPropertyField): boolean {\n return isLockedUploadStorageProperty(property) || property.capability === designerCapabilityCardKeys.uploadSettings\n}\n\nfunction restoreLockedUploadStorageProps(previousNode: ViewNode, node: ViewNode): void {\n node.props ??= {}\n restoreNodeProp(previousNode, node, 'valueMode')\n restoreNodeProp(previousNode, node, 'multiple')\n}\n\nfunction restoreNodeProp(previousNode: ViewNode, node: ViewNode, key: string): void {\n if (previousNode.props && Object.hasOwn(previousNode.props, key)) {\n node.props![key] = previousNode.props[key]\n } else {\n delete node.props![key]\n }\n}\n\nfunction normalizeValidationRulesForComponent(node: ViewNode, previousNode: ViewNode, field: ResourceField): void {\n const component = node.component ?? 'text'\n const previousComponent = previousNode.component ?? 'text'\n const allowed = validationRuleTypesForComponent(component)\n if (!allowed && component === previousComponent) {\n return\n }\n\n const nextRules = (field.validation ?? []).filter((rule) => {\n if (!allowed?.has(rule.type)) {\n return false\n }\n\n return component === 'password' || rule.type !== 'complexity'\n })\n\n if (nextRules.length) {\n field.validation = nextRules\n } else {\n delete field.validation\n }\n}\n\nfunction validationRuleTypesForComponent(component: string): Set<string> | undefined {\n switch (component) {\n case 'text':\n return new Set(['required', 'format', 'min_length', 'max_length', 'pattern'])\n case 'password':\n return new Set(['required', 'complexity'])\n case 'textarea':\n return new Set(['required', 'min_length', 'max_length', 'pattern'])\n case 'number':\n case 'slider':\n case 'rate':\n case 'date-picker':\n case 'datetime-picker':\n case 'time-picker':\n return new Set(['required', 'min', 'max'])\n case 'select':\n case 'multi-select':\n case 'select-tree':\n case 'cascader':\n case 'radio':\n case 'checkbox':\n case 'image-upload':\n case 'file-upload':\n return new Set(['required'])\n default:\n return undefined\n }\n}\n\nfunction createPropertyField(\n field: FieldPropertyField,\n loadedOptions?: DesignerServiceOption[],\n readonly = false,\n context?: FieldSchemaContext,\n): ResourceField {\n if (field.key === 'field.default' && context?.field) {\n return createDefaultValueResourceField(field, context.field, readonly)\n }\n const options = loadedOptions ?? (field.kind === 'select' ? field.options : undefined)\n return {\n name: field.key,\n label: field.kind === 'checkbox' || field.hideLabel ? '' : field.label,\n type: resolveFieldType(field),\n formable: true,\n readonly: readonly || field.editLevel === 'readonly',\n options:\n field.kind === 'select'\n ? {\n mode: 'static',\n value_policy: 'closed',\n items: (options ?? []).map((option) => ({\n label: option.label,\n value: option.value,\n })),\n }\n : undefined,\n }\n}\n\nfunction createDefaultValueResourceField(\n property: FieldPropertyField,\n source: ResourceField,\n readonly: boolean,\n): ResourceField {\n const propertyOptions = property.kind === 'select' && property.options.length > 0 ? property.options : undefined\n return {\n name: property.key,\n label: property.label,\n type: source.type,\n formable: true,\n readonly: readonly || property.editLevel === 'readonly',\n multiple: source.multiple,\n reference: source.reference ? cloneSerializable(source.reference) : undefined,\n options: propertyOptions\n ? {\n mode: 'static',\n value_policy: 'closed',\n items: propertyOptions.map((option) => ({ ...option })),\n }\n : source.options\n ? cloneSerializable(source.options)\n : undefined,\n validation: source.validation\n ?.filter((rule) => rule.type !== 'required')\n .map((rule) => cloneSerializable(rule)),\n }\n}\n\nfunction createPropertyNode(field: FieldPropertyField, serviceRegistry?: DesignerServiceRegistry): ViewNode {\n return {\n type: 'field',\n field: field.key,\n tip: field.tip,\n component: field.component ?? resolveComponent(field),\n span: field.span,\n props: {\n class: createPropertyNodeClass(field),\n labelWidth:\n field.hideLabel || field.kind === 'checkbox'\n ? '0'\n : field.kind === 'switch' && field.span === 12\n ? '96px'\n : undefined,\n placeholder: field.placeholder,\n min: field.kind === 'number' ? field.min : undefined,\n max: field.kind === 'number' ? field.max : undefined,\n step: field.kind === 'number' ? field.step : undefined,\n clearable: field.kind === 'select' ? field.clearable : undefined,\n rows: field.kind === 'textarea' || field.kind === 'json' ? field.rows : undefined,\n serviceRegistry: needsDesignerServiceRegistry(field) ? serviceRegistry : undefined,\n inlineBooleanLabel:\n field.kind === 'checkbox' ? (field.props?.inlineBooleanLabel ?? field.label) : undefined,\n inlineBooleanTip: field.kind === 'checkbox' ? (field.props?.inlineBooleanTip ?? field.tip) : undefined,\n inlineBooleanTipId: field.kind === 'checkbox' ? (field.props?.inlineBooleanTipId ?? field.key) : undefined,\n ...(field.props ?? {}),\n },\n }\n}\n\nfunction needsDesignerServiceRegistry(field: FieldPropertyField): boolean {\n return field.usesServiceRegistry === true\n}\n\nfunction createPropertyNodeClass(field: FieldPropertyField): string | undefined {\n if (field.kind === 'checkbox') {\n return 'sparq-designer-property-checkbox-item'\n }\n\n if (field.kind === 'switch' && field.span === 12) {\n return 'sparq-designer-property-switch-item'\n }\n\n return undefined\n}\n\nfunction getFieldPropertyValue(context: FieldSchemaContext, property: FieldPropertyField): unknown {\n const capability = property.capability\n ? context.extensionContext\n ? context.extensionContext.getCapabilityCard(property.capability)\n : getDesignerCapabilityCard(property.capability)\n : undefined\n if (capability?.read) {\n return capability.read(context)\n }\n\n if (property.key === 'field.required' && getRequiredValidationRule(context.field)) {\n return true\n }\n\n if (property.storage.target === 'node') {\n const relationDefault = getRelationListPropertyDefault(context, property)\n if (relationDefault !== undefined) {\n return relationDefault\n }\n if (property.key === 'node.span') {\n return String(\n getObjectPathValue(context.node as unknown as Record<string, unknown>, property.storage.path) ?? 24,\n )\n }\n if (property.key === 'node.shadow') {\n return (\n getObjectPathValue(context.node as unknown as Record<string, unknown>, property.storage.path) ??\n 'always'\n )\n }\n if (property.storage.path === 'component') {\n return context.node.component ?? (context.node.type === 'field' ? 'text' : undefined)\n }\n const value = getObjectPathValue(context.node as unknown as Record<string, unknown>, property.storage.path)\n if (value !== undefined || !property.storage.path.startsWith('props.')) {\n return value\n }\n return getObjectPathValue(\n defaultNodePropsForComponent(context.node.component) ?? {},\n property.storage.path.slice('props.'.length),\n )\n }\n\n return property.storage.target === 'field' && context.field\n ? getObjectPathValue(context.field as unknown as Record<string, unknown>, property.storage.path)\n : undefined\n}\n\nfunction getRelationListPropertyDefault(context: FieldSchemaContext, property: FieldPropertyField): unknown {\n if (context.node.binding?.type !== 'relation-list' || property.storage.target !== 'node') {\n return undefined\n }\n if (property.key === 'binding.relationType') {\n return context.node.binding.relationType ?? 'has-many'\n }\n if (property.key === 'binding.requireParent') {\n return context.node.binding.requireParent !== false\n }\n if (property.key === 'binding.whenParentMissing') {\n return context.node.binding.whenParentMissing ?? 'disabled'\n }\n if (property.key === 'binding.pagination.enabled' && context.node.binding.pagination) {\n return context.node.binding.pagination.enabled !== false\n }\n const operationMatch = property.key.match(/^binding\\.operations\\.(create|attach|update|detach|delete)\\.(.+)$/)\n if (operationMatch) {\n const operation = operationMatch[1] as 'create' | 'attach' | 'update' | 'detach' | 'delete'\n const key = operationMatch[2]\n const config = context.node.binding.operations?.[operation]\n if (key === 'placement') {\n return config?.placement ?? (operation === 'create' || operation === 'attach' ? 'toolbar' : 'row')\n }\n if (key === 'interaction.type') {\n return config?.interaction?.type ?? defaultRelationInteractionType(operation)\n }\n if (\n key === 'interaction.form' &&\n (config?.interaction?.type ?? defaultRelationInteractionType(operation)) === 'form'\n ) {\n return config?.interaction?.type === 'form' ? (config.interaction.form ?? 'default') : 'default'\n }\n if (\n key === 'interaction.mode' &&\n (config?.interaction?.type ?? defaultRelationInteractionType(operation)) === 'form'\n ) {\n return config?.interaction?.type === 'form'\n ? (config.interaction.mode ?? (operation === 'create' ? 'create' : 'edit'))\n : operation === 'create'\n ? 'create'\n : 'edit'\n }\n if (\n key === 'interaction.table' &&\n (config?.interaction?.type ?? defaultRelationInteractionType(operation)) === 'selection'\n ) {\n return config?.interaction?.type === 'selection' ? (config.interaction.table ?? 'default') : 'default'\n }\n if (\n key === 'interaction.multiple' &&\n (config?.interaction?.type ?? defaultRelationInteractionType(operation)) === 'selection'\n ) {\n return config?.interaction?.type === 'selection' ? config.interaction.multiple !== false : true\n }\n if (\n key === 'interaction.source' &&\n (config?.interaction?.type ?? defaultRelationInteractionType(operation)) === 'selection'\n ) {\n return config?.interaction?.type === 'selection'\n ? (config.interaction.source ?? (operation === 'attach' ? 'unassigned' : 'related'))\n : operation === 'attach'\n ? 'unassigned'\n : 'related'\n }\n if (key === 'execution.type') {\n return config?.execution?.type ?? 'resource'\n }\n }\n if (property.key.startsWith('binding.operations.') && property.key.endsWith('.enabled')) {\n const operationPath = property.storage.path.slice(0, -'.enabled'.length)\n const operation = getObjectPathValue(context.node as unknown as Record<string, unknown>, operationPath)\n if (isPlainObjectRecord(operation)) {\n return operation.enabled !== false\n }\n }\n return undefined\n}\n\nfunction defaultRelationInteractionType(\n operation: 'create' | 'attach' | 'update' | 'detach' | 'delete',\n): 'form' | 'selection' | 'direct' {\n if (operation === 'create' || operation === 'update') return 'form'\n if (operation === 'attach') return 'selection'\n return 'direct'\n}\n\nfunction normalizeNodePropsForComponent(node: ViewNode): void {\n if (node.component === 'password') {\n delete node.props?.showWordLimit\n return\n }\n\n const defaults = defaultNodePropsForComponent(node.component)\n if (!defaults) {\n return\n }\n\n node.props ??= {}\n for (const [key, value] of Object.entries(defaults)) {\n if (node.props[key] === undefined) {\n node.props[key] = value\n }\n }\n}\n\nfunction applyFieldPropertyValue(\n context: FieldSchemaContext,\n node: ViewNode,\n field: ResourceField | undefined,\n property: FieldPropertyField,\n value: unknown,\n): void {\n const capability = property.capability\n ? context.extensionContext\n ? context.extensionContext.getCapabilityCard(property.capability)\n : getDesignerCapabilityCard(property.capability)\n : undefined\n if (capability?.write) {\n capability.write({ node, field, fields: context.fields, extensionContext: context.extensionContext }, value)\n return\n }\n\n if (property.storage.target === 'node') {\n if (property.key.endsWith('.interaction.type') && typeof value === 'string') {\n const interactionPath = property.storage.path.slice(0, -'.type'.length)\n setObjectPathValue(node as unknown as Record<string, unknown>, interactionPath, { type: value })\n return\n }\n if (property.key.endsWith('.execution.type') && typeof value === 'string') {\n const executionPath = property.storage.path.slice(0, -'.type'.length)\n setObjectPathValue(node as unknown as Record<string, unknown>, executionPath, { type: value })\n return\n }\n setObjectPathValue(node as unknown as Record<string, unknown>, property.storage.path, value)\n } else if (property.storage.target === 'field' && field) {\n setObjectPathValue(field as unknown as Record<string, unknown>, property.storage.path, value)\n }\n}\n\nfunction resolveFieldType(field: FieldPropertyField): string {\n if (usesRawPropertyValue(field)) {\n return 'json'\n }\n\n switch (field.kind) {\n case 'number':\n return 'number'\n case 'switch':\n case 'checkbox':\n return 'boolean'\n case 'json':\n return 'string'\n default:\n return 'string'\n }\n}\n\nfunction resolveComponent(field: FieldPropertyField): string {\n switch (field.kind) {\n case 'textarea':\n case 'json':\n return 'textarea'\n case 'number':\n return 'number'\n case 'switch':\n return 'switch'\n case 'checkbox':\n return 'designer.boolean-checkbox'\n case 'select':\n return 'select'\n default:\n return 'text'\n }\n}\n\nfunction stringifyJsonField(field: FieldPropertyField, value: unknown): unknown {\n if (usesRawPropertyValue(field)) {\n return value\n }\n\n if (field.kind !== 'json') {\n return value\n }\n\n return value === undefined ? undefined : JSON.stringify(value, undefined, 2)\n}\n\nfunction normalizeFieldValue(field: FieldPropertyField, value: unknown): unknown {\n if (field.key === 'field.default') {\n if (value === undefined || value === null || value === '' || (Array.isArray(value) && value.length === 0)) {\n return undefined\n }\n return cloneSerializable(value)\n }\n\n if (usesRawPropertyValue(field)) {\n return value\n }\n\n if (field.key === 'node.span') {\n const numeric = typeof value === 'number' ? value : Number(value)\n return Number.isFinite(numeric) && numeric > 0 ? numeric : undefined\n }\n\n if (field.kind === 'number') {\n return typeof value === 'number' && Number.isFinite(value) ? value : undefined\n }\n\n if (field.key === 'field.required') {\n return value === true ? true : undefined\n }\n\n if (field.kind === 'switch' || field.kind === 'checkbox') {\n return value === true\n }\n\n if (field.kind === 'json') {\n if (typeof value !== 'string' || value.trim() === '') {\n return undefined\n }\n\n try {\n return JSON.parse(value)\n } catch {\n return undefined\n }\n }\n\n if (typeof value === 'string') {\n return value === '' ? undefined : value\n }\n\n return value\n}\n\nfunction usesRawPropertyValue(field: FieldPropertyField): boolean {\n return field.rawValue === true || field.storage.target === 'capability' || field.key === 'field.default'\n}\n\nfunction isNodePropsStorage(field: FieldPropertyField): boolean {\n return field.storage.target === 'node' && field.storage.path.startsWith('props.')\n}\n","import type { ResourceField, ViewNode } from '@sparqjs/schema-protocol'\nimport { cloneSerializable } from '../../shared/clone'\nimport { getObjectPathValue, setObjectPathValue } from '../../shared/object-path'\nimport {\n defaultNodePropsForComponent,\n isFieldTypeCompatibleWithComponent,\n isFieldTypeLocked,\n normalizeFieldTypeForNode,\n} from '../../state/component-config'\nimport { designerCapabilityCardKeys, listDesignerCapabilityCards } from '../capabilities'\nimport {\n designerFieldCapabilityKeys,\n getDesignerComponentPropertyConfig,\n type DesignerComponentCapabilityProfile,\n type DesignerMultiplePolicy,\n type DesignerComponentMigrationChange,\n type FieldPropertyField,\n type FieldSchemaContext,\n} from '../field-schema'\n\n/** 源组件与目标组件的数据协议兼容程度。 */\nexport type DesignerComponentMigrationCompatibility = 'unchanged' | 'same-group' | 'cross-group' | 'unknown'\n\n/** 迁移是否可以直接提交,或必须先向用户展示变化摘要。 */\nexport type DesignerComponentMigrationRisk = 'none' | 'confirmation'\n\n/** 组件切换的完整预演结果,不会直接修改 DraftState。 */\nexport interface DesignerComponentMigrationPlan {\n sourceComponent: string\n sourceLabel: string\n targetComponent: string\n targetLabel: string\n compatibility: DesignerComponentMigrationCompatibility\n risk: DesignerComponentMigrationRisk\n changes: DesignerComponentMigrationChange[]\n node: ViewNode\n field?: ResourceField\n}\n\n/**\n * 规划组件切换后的节点和字段变化。\n *\n * 该方法只返回迁移计划,不修改 DraftState;调用方必须根据 risk 请求确认后再整体提交。\n */\nexport function planComponentMigration(\n context: FieldSchemaContext,\n targetComponent: string,\n): DesignerComponentMigrationPlan {\n const sourceComponent = resolveNodeComponent(context.node)\n const sourceConfig = resolveComponentConfig(context, sourceComponent)\n const targetConfig = resolveComponentConfig(context, targetComponent)\n const compatibility = resolveCompatibility(context, sourceComponent, targetComponent)\n const sourceNode = cloneSerializable(context.node)\n const sourceField = context.field ? cloneSerializable(context.field) : undefined\n let node = cloneSerializable(sourceNode)\n let field = sourceField ? cloneSerializable(sourceField) : undefined\n const changes: DesignerComponentMigrationChange[] = []\n\n if (compatibility === 'unchanged') {\n return {\n sourceComponent,\n sourceLabel: componentLabel(context, sourceComponent),\n targetComponent,\n targetLabel: componentLabel(context, targetComponent),\n compatibility,\n risk: 'none',\n changes,\n node,\n field,\n }\n }\n\n if (\n isFieldTypeLocked(context.field) &&\n targetConfig?.profile &&\n !isFieldTypeCompatibleWithComponent(targetComponent, context.field, targetConfig.profile.fieldTypes)\n ) {\n throw new Error(\n `已有后端字段类型 ${context.field?.type} 与目标组件 ${componentLabel(context, targetComponent)} 不兼容`,\n )\n }\n\n node.component = targetComponent\n changes.push({\n action: 'change',\n target: 'node',\n path: 'component',\n label: `展示组件:${componentLabel(context, sourceComponent)} → ${componentLabel(context, targetComponent)}`,\n before: sourceComponent,\n after: targetComponent,\n })\n\n migrateDeclaredNodeProps(node, sourceConfig?.props ?? [], targetConfig?.props ?? [], changes)\n migrateComponentCapabilityPaths(\n context,\n node,\n field,\n sourceConfig?.profile?.capabilities ?? [],\n targetConfig?.profile?.capabilities ?? [],\n changes,\n )\n addTargetNodeDefaults(node, targetComponent, changes)\n migrateFieldCapabilities(field, targetConfig?.profile?.fieldCapabilities ?? [], changes)\n migrateFieldMultiplicity(field, targetConfig?.profile?.multiple, changes)\n migrateValidation(field, targetConfig?.profile?.validation?.supported ?? [], changes)\n migrateRangeValidation(field, targetComponent, targetConfig?.profile?.validation?.supported ?? [], changes)\n migrateColorValidation(field, sourceComponent, targetComponent, changes)\n migrateOptions(field, sourceConfig?.profile?.capabilities ?? [], targetConfig?.profile?.capabilities ?? [], changes)\n preserveUnsupportedProfileModes(field, targetConfig?.profile, changes)\n if (targetConfig) {\n migrateFieldType(context, node, field, changes)\n }\n\n let requiresConfirmation = false\n if (targetConfig?.migration) {\n const result = targetConfig.migration({\n sourceComponent,\n targetComponent,\n sourceNode: cloneSerializable(sourceNode),\n sourceField: sourceField ? cloneSerializable(sourceField) : undefined,\n node: cloneSerializable(node),\n field: field ? cloneSerializable(field) : undefined,\n fields: cloneSerializable(context.fields ?? []),\n changes: cloneSerializable(changes),\n })\n if (resolveNodeComponent(result.node) !== targetComponent) {\n throw new Error(`组件迁移器必须返回目标组件 ${targetComponent}`)\n }\n node = cloneSerializable(result.node)\n field = result.field ? cloneSerializable(result.field) : undefined\n changes.push(...cloneSerializable(result.changes ?? []))\n requiresConfirmation = result.requiresConfirmation === true\n }\n\n if (node.props && Object.keys(node.props).length === 0) {\n delete node.props\n }\n\n const risk =\n !requiresConfirmation && compatibility === 'same-group' && !hasDestructiveChange(changes)\n ? 'none'\n : 'confirmation'\n\n return {\n sourceComponent,\n sourceLabel: componentLabel(context, sourceComponent),\n targetComponent,\n targetLabel: componentLabel(context, targetComponent),\n compatibility,\n risk,\n changes,\n node,\n field,\n }\n}\n\nfunction migrateDeclaredNodeProps(\n node: ViewNode,\n sourceProperties: NonNullable<ReturnType<typeof getDesignerComponentPropertyConfig>>['props'],\n targetProperties: NonNullable<ReturnType<typeof getDesignerComponentPropertyConfig>>['props'],\n changes: DesignerComponentMigrationChange[],\n): void {\n const targetPaths = new Set((targetProperties ?? []).map(propertyStorageKey))\n\n for (const property of sourceProperties ?? []) {\n if (property.migrationOwner !== 'component' || targetPaths.has(propertyStorageKey(property))) {\n continue\n }\n if (property.storage.target !== 'node') {\n continue\n }\n\n const before = getObjectPathValue(node as unknown as Record<string, unknown>, property.storage.path)\n if (before === undefined) {\n continue\n }\n\n setObjectPathValue(node as unknown as Record<string, unknown>, property.storage.path, undefined)\n changes.push({\n action: 'remove',\n target: 'node',\n path: property.storage.path,\n label: `移除组件属性:${property.label}`,\n before,\n })\n }\n}\n\nfunction propertyStorageKey(property: FieldPropertyField): string {\n return property.storage.target === 'capability'\n ? 'capability'\n : `${property.storage.target}:${property.storage.path}`\n}\n\nfunction migrateComponentCapabilityPaths(\n context: FieldSchemaContext,\n node: ViewNode,\n field: ResourceField | undefined,\n sourceCapabilities: string[],\n targetCapabilities: string[],\n changes: DesignerComponentMigrationChange[],\n): void {\n const target = new Set(targetCapabilities)\n const cards =\n context.extensionContext?.listCapabilityCards(sourceCapabilities) ??\n listDesignerCapabilityCards(sourceCapabilities)\n\n for (const card of cards) {\n if (target.has(card.key) || card.field.migrationOwner !== 'component') {\n continue\n }\n for (const affected of card.affectedPaths) {\n if (affected.target === 'schema') {\n continue\n }\n const owner = affected.target === 'node' ? node : affected.target === 'field' ? field : undefined\n if (!owner) {\n continue\n }\n const record = owner as unknown as Record<string, unknown>\n const before = getObjectPathValue(record, affected.path)\n if (before === undefined) {\n continue\n }\n setObjectPathValue(record, affected.path, undefined)\n changes.push({\n action: 'remove',\n target: affected.target,\n path: affected.path,\n label: `移除组件能力:${card.title}`,\n before,\n })\n }\n }\n}\n\nfunction addTargetNodeDefaults(\n node: ViewNode,\n targetComponent: string,\n changes: DesignerComponentMigrationChange[],\n): void {\n const defaults = defaultNodePropsForComponent(targetComponent)\n if (!defaults) {\n return\n }\n\n node.props ??= {}\n for (const [path, value] of Object.entries(defaults)) {\n if (node.props[path] !== undefined) {\n continue\n }\n\n node.props[path] = cloneSerializable(value)\n changes.push({\n action: 'add',\n target: 'node',\n path: `props.${path}`,\n label: `补充默认属性:${path}`,\n after: value,\n })\n }\n}\n\nfunction migrateFieldCapabilities(\n field: ResourceField | undefined,\n targetCapabilities: string[],\n changes: DesignerComponentMigrationChange[],\n): void {\n if (!field) {\n return\n }\n\n const target = new Set(targetCapabilities)\n const fieldRecord = field as unknown as Record<string, unknown>\n for (const capability of Object.values(designerFieldCapabilityKeys)) {\n if (capability === designerFieldCapabilityKeys.multiple && isFieldTypeLocked(field)) {\n continue\n }\n if (target.has(capability)) {\n continue\n }\n\n const before = fieldRecord[capability]\n if (before === undefined) {\n continue\n }\n\n delete fieldRecord[capability]\n changes.push({\n action: 'remove',\n target: 'field',\n path: capability,\n label: `移除字段能力:${fieldCapabilityLabel(capability)}`,\n before,\n })\n }\n}\n\nfunction migrateFieldMultiplicity(\n field: ResourceField | undefined,\n policy: DesignerMultiplePolicy | undefined,\n changes: DesignerComponentMigrationChange[],\n): void {\n if (!field || !policy || isFieldTypeLocked(field)) {\n return\n }\n if (policy === 'multiple' && field.multiple !== true) {\n field.multiple = true\n changes.push({\n action: 'add',\n target: 'field',\n path: 'multiple',\n label: '启用多值字段',\n after: true,\n })\n } else if (policy === 'single' && field.multiple !== undefined) {\n const before = field.multiple\n delete field.multiple\n changes.push({\n action: 'remove',\n target: 'field',\n path: 'multiple',\n label: '切换为单值字段',\n before,\n })\n }\n}\n\nfunction migrateValidation(\n field: ResourceField | undefined,\n supportedTypes: string[],\n changes: DesignerComponentMigrationChange[],\n): void {\n if (!field?.validation?.length) {\n return\n }\n\n const supported = new Set(supportedTypes)\n const retained = field.validation.filter((rule) => supported.has(rule.type))\n const removed = field.validation.filter((rule) => !supported.has(rule.type))\n if (!removed.length) {\n return\n }\n\n if (retained.length) {\n field.validation = retained\n } else {\n delete field.validation\n }\n\n for (const rule of removed) {\n changes.push({\n action: 'remove',\n target: 'field',\n path: `validation.${rule.type}`,\n label: `移除校验规则:${rule.type}`,\n before: rule,\n })\n }\n}\n\nfunction migrateRangeValidation(\n field: ResourceField | undefined,\n targetComponent: string,\n supportedTypes: string[],\n changes: DesignerComponentMigrationChange[],\n): void {\n if (\n !field ||\n !supportedTypes.includes('range') ||\n (targetComponent !== 'date-range-picker' && targetComponent !== 'time-range-picker')\n ) {\n return\n }\n const spanUnit = targetComponent === 'date-range-picker' ? 'day' : 'minute'\n field.validation ??= []\n let rule = field.validation.find((item) => item.type === 'range')\n if (!rule) {\n rule = { type: 'range', params: { ordered: true, span_unit: spanUnit } }\n field.validation.push(rule)\n changes.push({\n action: 'add',\n target: 'field',\n path: 'validation.range',\n label: '补充范围结构与起止顺序校验',\n after: cloneSerializable(rule),\n })\n return\n }\n\n const params = { ...(rule.params ?? {}) }\n const previousUnit = params.span_unit\n if (previousUnit !== undefined && previousUnit !== spanUnit) {\n for (const key of Object.keys(params)) {\n if (key === 'ordered' || key === 'span_unit') {\n continue\n }\n changes.push({\n action: 'remove',\n target: 'field',\n path: `validation.range.params.${key}`,\n label: `移除与${spanUnit === 'day' ? '日期' : '时间'}范围不兼容的 ${rangeParamLabel(key)}`,\n before: params[key],\n })\n delete params[key]\n }\n changes.push({\n action: 'change',\n target: 'field',\n path: 'validation.range.params.span_unit',\n label: `范围跨度单位:${previousUnit} → ${spanUnit}`,\n before: previousUnit,\n after: spanUnit,\n })\n } else if (previousUnit === undefined) {\n changes.push({\n action: 'add',\n target: 'field',\n path: 'validation.range.params.span_unit',\n label: `补充范围跨度单位:${spanUnit}`,\n after: spanUnit,\n })\n }\n if (params.ordered !== true) {\n changes.push({\n action: params.ordered === undefined ? 'add' : 'change',\n target: 'field',\n path: 'validation.range.params.ordered',\n label: '固定启用起止顺序校验',\n before: params.ordered,\n after: true,\n })\n }\n params.ordered = true\n params.span_unit = spanUnit\n rule.params = params\n delete rule.value\n delete rule.value_expr\n}\n\nfunction rangeParamLabel(key: string): string {\n const labels: Record<string, string> = {\n min: '最小边界',\n max: '最大边界',\n max_span: '最大跨度',\n }\n return labels[key] ?? `range 参数 ${key}`\n}\n\nfunction migrateColorValidation(\n field: ResourceField | undefined,\n sourceComponent: string,\n targetComponent: string,\n changes: DesignerComponentMigrationChange[],\n): void {\n if (!field) {\n return\n }\n if (targetComponent === 'color') {\n field.validation ??= []\n const unsupported = field.validation.filter((rule) => rule.type === 'format' && rule.value !== 'color')\n if (unsupported.length > 0) {\n field.validation = field.validation.filter((rule) => !unsupported.includes(rule))\n for (const rule of unsupported) {\n changes.push({\n action: 'remove',\n target: 'field',\n path: 'validation.format',\n label: `移除与颜色组件不兼容的格式校验:${String(rule.value ?? '')}`,\n before: rule,\n })\n }\n }\n if (!field.validation.some((rule) => rule.type === 'format' && rule.value === 'color')) {\n const rule = { type: 'format', value: 'color' }\n field.validation.push(rule)\n changes.push({\n action: 'add',\n target: 'field',\n path: 'validation.format',\n label: '补充颜色格式校验',\n after: rule,\n })\n }\n return\n }\n if (sourceComponent !== 'color' || !field.validation?.length) {\n return\n }\n const removed = field.validation.filter((rule) => rule.type === 'format' && rule.value === 'color')\n if (removed.length === 0) {\n return\n }\n field.validation = field.validation.filter((rule) => !removed.includes(rule))\n if (field.validation.length === 0) {\n delete field.validation\n }\n for (const rule of removed) {\n changes.push({\n action: 'remove',\n target: 'field',\n path: 'validation.format',\n label: '移除颜色格式校验',\n before: rule,\n })\n }\n}\n\nfunction migrateOptions(\n field: ResourceField | undefined,\n sourceCapabilities: string[],\n targetCapabilities: string[],\n changes: DesignerComponentMigrationChange[],\n): void {\n if (\n !field?.options ||\n !sourceCapabilities.includes(designerCapabilityCardKeys.optionSource) ||\n targetCapabilities.includes(designerCapabilityCardKeys.optionSource)\n ) {\n return\n }\n\n const before = field.options\n delete field.options\n changes.push({\n action: 'remove',\n target: 'field',\n path: 'options',\n label: '移除数据选项',\n before,\n })\n}\n\nfunction preserveUnsupportedProfileModes(\n field: ResourceField | undefined,\n profile: DesignerComponentCapabilityProfile | undefined,\n changes: DesignerComponentMigrationChange[],\n): void {\n if (!field || !profile) {\n return\n }\n\n const valueMode = configuredValueStrategyMode(field)\n if (valueMode && !profile.valueStrategies.includes(valueMode)) {\n changes.push({\n action: 'preserve',\n target: 'field',\n path: valueStrategyPath(valueMode),\n label: `保留目标组件不支持的复杂取值逻辑:${valueStrategyLabel(valueMode)}`,\n before: valueMode,\n after: valueMode,\n })\n }\n\n const optionMode = field.options?.mode\n if (optionMode && !profile.optionSources.some((source) => source === optionMode)) {\n changes.push({\n action: 'preserve',\n target: 'field',\n path: 'options.mode',\n label: `保留目标组件不支持的选项来源:${optionSourceLabel(optionMode)}`,\n before: optionMode,\n after: optionMode,\n })\n }\n}\n\nfunction configuredValueStrategyMode(field: ResourceField): 'dynamic' | 'computed' | undefined {\n if (field.computed_expr) {\n return 'computed'\n }\n if (field.default_expr) {\n return 'dynamic'\n }\n return undefined\n}\n\nfunction valueStrategyPath(mode: 'dynamic' | 'computed'): string {\n if (mode === 'computed') {\n return 'computed_expr'\n }\n return 'default_expr'\n}\n\nfunction valueStrategyLabel(mode: 'dynamic' | 'computed'): string {\n const labels = {\n dynamic: '动态默认值',\n computed: '计算表达式',\n }\n return labels[mode]\n}\n\nfunction optionSourceLabel(mode: NonNullable<ResourceField['options']>['mode']): string {\n const labels: Record<string, string> = {\n static: '静态选项',\n dictionary: '数据字典',\n reference: '资源引用',\n remote: '远程来源',\n }\n return labels[mode] ?? mode\n}\n\nfunction migrateFieldType(\n context: FieldSchemaContext,\n node: ViewNode,\n field: ResourceField | undefined,\n changes: DesignerComponentMigrationChange[],\n): void {\n if (!field) {\n return\n }\n\n const before = field.type\n const after = normalizeFieldTypeForNode(\n node,\n field,\n resolveComponentConfig(context, node.component ?? '')?.profile?.fieldTypes,\n )\n if (before === after) {\n return\n }\n\n field.type = after\n changes.push({\n action: 'change',\n target: 'field',\n path: 'type',\n label: `调整数据类型:${before} → ${after}`,\n before,\n after,\n })\n}\n\nfunction resolveCompatibility(\n context: FieldSchemaContext,\n sourceComponent: string,\n targetComponent: string,\n): DesignerComponentMigrationCompatibility {\n if (sourceComponent === targetComponent) {\n return 'unchanged'\n }\n\n const sourceConfig = resolveComponentConfig(context, sourceComponent)\n const targetConfig = resolveComponentConfig(context, targetComponent)\n if (!sourceConfig || !targetConfig) {\n return 'unknown'\n }\n\n const sourceGroup = sourceConfig.option?.group\n const targetGroup = targetConfig.option?.group\n return sourceGroup && sourceGroup === targetGroup ? 'same-group' : 'cross-group'\n}\n\nfunction hasDestructiveChange(changes: DesignerComponentMigrationChange[]): boolean {\n return changes.some(\n (change) => change.action === 'remove' || change.action === 'preserve' || change.path === 'type',\n )\n}\n\nfunction resolveNodeComponent(node: ViewNode): string {\n return node.type === 'field' ? (node.component ?? 'text') : (node.component ?? '')\n}\n\nfunction componentLabel(context: FieldSchemaContext, component: string): string {\n return resolveComponentConfig(context, component)?.option?.label ?? (component || '默认组件')\n}\n\nfunction resolveComponentConfig(context: FieldSchemaContext, component: string) {\n return (\n context.extensionContext?.getComponentPropertyConfig(component) ?? getDesignerComponentPropertyConfig(component)\n )\n}\n\nfunction fieldCapabilityLabel(capability: string): string {\n const labels: Record<string, string> = {\n multiple: '多值',\n listable: '列表可见',\n searchable: '可搜索',\n }\n return labels[capability] ?? capability\n}\n","import { getDesignerCapabilityCard, type DesignerCapabilityCardKey } from '../capabilities'\nimport {\n applyFieldPropertyChanges,\n createFieldPropertyValues,\n type FieldPropertyChange,\n type FieldPropertyValues,\n} from '../field-property-view'\nimport {\n createFieldSchemaSections,\n type FieldPropertyField,\n type FieldSchemaContext,\n type FieldSchemaSection,\n} from '../field-schema'\nimport {\n getDesignerNodePermissions,\n getFields,\n getSelectedField,\n getSelectedNode,\n replaceSelectedNodeAndField,\n} from '../../state/draft'\nimport type { DraftState } from '../../state/types'\nimport { planComponentMigration, type DesignerComponentMigrationPlan } from './component-migration'\n\n/** 一次提交多个轻量属性的命令,不允许夹带组件切换。 */\nexport interface UpdateInlinePropertiesCommand {\n type: 'update-inline-properties'\n values: FieldPropertyValues\n}\n\n/** 通过能力卡边界写回复合配置的命令。 */\nexport interface ConfigureCapabilityCommand {\n type: 'configure-capability'\n capability: DesignerCapabilityCardKey\n value: unknown\n}\n\n/** 组件切换命令;风险迁移只有 confirmed 后才会写入草稿。 */\nexport interface ChangeComponentCommand {\n type: 'change-component'\n component: string\n confirmed?: boolean\n}\n\n/** 字段属性面板可提交的封闭命令集合。 */\nexport type FieldPropertyCommand = UpdateInlinePropertiesCommand | ConfigureCapabilityCommand | ChangeComponentCommand\n\nexport interface FieldPropertyCommandIssue {\n key: string\n code: 'required' | 'invalid-format' | 'duplicate'\n message: string\n}\n\n/** 属性命令执行结果,确认态携带完整迁移计划供 UI 展示。 */\nexport type FieldPropertyCommandResult =\n | { status: 'applied' }\n | { status: 'unchanged' }\n | { status: 'confirmation-required'; plan: DesignerComponentMigrationPlan }\n | { status: 'rejected'; message: string; issues?: FieldPropertyCommandIssue[] }\n\n/**\n * 将一次属性表单更新拆成明确命令。组件变更独占一次更新,避免与普通属性混入同一迁移。\n */\nexport function createFieldPropertyCommands(\n context: FieldSchemaContext,\n values: FieldPropertyValues,\n sections: readonly FieldSchemaSection[] = createFieldSchemaSections(context),\n): FieldPropertyCommand[] {\n const currentValues = createFieldPropertyValues(context, sections)\n const requestedComponent = values['node.component']\n if (\n Object.prototype.hasOwnProperty.call(values, 'node.component') &&\n requestedComponent !== resolveNodeComponent(context)\n ) {\n return [\n {\n type: 'change-component',\n component: typeof requestedComponent === 'string' ? requestedComponent : '',\n },\n ]\n }\n\n const inlineValues: FieldPropertyValues = {}\n const capabilityCommands: ConfigureCapabilityCommand[] = []\n\n for (const property of listFieldProperties(context, sections)) {\n if (!Object.prototype.hasOwnProperty.call(values, property.key)) {\n continue\n }\n const value = values[property.key]\n if (isSameValue(value, currentValues[property.key])) {\n continue\n }\n\n if (property.key === 'node.component') {\n continue\n }\n\n if (property.editLevel === 'inline') {\n inlineValues[property.key] = value\n } else if (property.editLevel === 'capability' && property.capability) {\n capabilityCommands.push({\n type: 'configure-capability',\n capability: property.capability,\n value,\n })\n }\n }\n\n return [\n ...(Object.keys(inlineValues).length\n ? [{ type: 'update-inline-properties' as const, values: inlineValues }]\n : []),\n ...capabilityCommands,\n ]\n}\n\n/**\n * 整批命令在校验通过后只提交一次 schema 更新,拒绝和无变化都不会产生 history。\n */\nexport function executeFieldPropertyCommands(\n state: DraftState,\n commands: FieldPropertyCommand[],\n): FieldPropertyCommandResult {\n const node = getSelectedNode(state)\n if (!node) {\n return { status: 'rejected', message: '字段属性命令缺少当前选中节点' }\n }\n if (node.id && !getDesignerNodePermissions(state, node.id).editable) {\n return { status: 'rejected', message: '当前节点为只读,不能修改字段或节点属性' }\n }\n\n const context: FieldSchemaContext = {\n node,\n field: getSelectedField(state),\n fields: getFields(state.schema),\n extensionContext: state.extensionContext,\n }\n const componentCommands = commands.filter(\n (command): command is ChangeComponentCommand => command.type === 'change-component',\n )\n if (componentCommands.length) {\n if (commands.length !== 1) {\n return { status: 'rejected', message: '组件切换不能与其他属性命令同时执行' }\n }\n return executeChangeComponent(state, context, componentCommands[0] as ChangeComponentCommand)\n }\n\n const properties = listFieldProperties(context)\n const changes: FieldPropertyChange[] = []\n\n for (const command of commands) {\n const result = resolveCommandChanges(command, properties, context)\n if ('message' in result) {\n return { status: 'rejected', message: result.message }\n }\n changes.push(...result.changes)\n }\n\n const issues = validateFieldPropertyChanges(context, changes)\n if (issues.length > 0) {\n return {\n status: 'rejected',\n message: issues.map((issue) => issue.message).join(';'),\n issues,\n }\n }\n\n if (!changes.length) {\n return { status: 'unchanged' }\n }\n\n const next = applyFieldPropertyChanges(context, changes)\n if (isSameValue(next.node, context.node) && isSameValue(next.field, context.field)) {\n return { status: 'unchanged' }\n }\n\n replaceSelectedNodeAndField(state, next.node, next.field)\n return { status: 'applied' }\n}\n\nfunction validateFieldPropertyChanges(\n context: FieldSchemaContext,\n changes: FieldPropertyChange[],\n): FieldPropertyCommandIssue[] {\n const formatIssues = validateDateTimeFormatChanges(context, changes)\n if (formatIssues.length > 0) {\n return formatIssues\n }\n\n const nameChange = changes.find((change) => change.property.key === 'field.name')\n if (!nameChange || !context.field) {\n return []\n }\n if (typeof nameChange.value !== 'string' || nameChange.value === '') {\n return [{ key: 'field.name', code: 'required', message: '字段名不能为空' }]\n }\n if (!/^[a-z][a-z0-9_]{0,62}$/.test(nameChange.value)) {\n return [\n {\n key: 'field.name',\n code: 'invalid-format',\n message: '字段名必须以小写字母开头,只能包含小写字母、数字和下划线,且不超过 63 个字符',\n },\n ]\n }\n if ((context.fields ?? []).some((field) => field.name === nameChange.value && field.name !== context.field?.name)) {\n return [{ key: 'field.name', code: 'duplicate', message: `字段名 ${nameChange.value} 已存在` }]\n }\n return []\n}\n\nfunction validateDateTimeFormatChanges(\n context: FieldSchemaContext,\n changes: FieldPropertyChange[],\n): FieldPropertyCommandIssue[] {\n const issues: FieldPropertyCommandIssue[] = []\n for (const change of changes) {\n if (change.property.key !== 'props.format' && change.property.key !== 'props.valueFormat') {\n continue\n }\n if (change.property.key === 'props.valueFormat' && context.field?.type !== 'string') {\n issues.push({\n key: change.property.key,\n code: 'invalid-format',\n message: '只有 string 字段可以自定义提交格式',\n })\n continue\n }\n if (\n change.value !== undefined &&\n (typeof change.value !== 'string' || !isSupportedDateTimeFormat(change.value))\n ) {\n issues.push({\n key: change.property.key,\n code: 'invalid-format',\n message: `${change.property.label}包含当前日期时间适配器不支持的格式字符`,\n })\n }\n }\n return issues\n}\n\nconst dateTimeFormatTokenPattern = /YYYY|YY|MM|M|DD|D|HH|H|hh|h|mm|m|ss|s|SSS|A|a|X|x|ZZ|Z/g\n\nfunction isSupportedDateTimeFormat(value: string): boolean {\n const withoutLiterals = removeBracketLiterals(value)\n if (withoutLiterals === undefined || !dateTimeFormatTokenPattern.test(withoutLiterals)) {\n dateTimeFormatTokenPattern.lastIndex = 0\n return false\n }\n dateTimeFormatTokenPattern.lastIndex = 0\n const remainder = withoutLiterals.replace(dateTimeFormatTokenPattern, '')\n dateTimeFormatTokenPattern.lastIndex = 0\n return !/[A-Za-z]/.test(remainder)\n}\n\nfunction removeBracketLiterals(value: string): string | undefined {\n let depth = 0\n let output = ''\n for (const character of value) {\n if (character === '[') {\n depth += 1\n if (depth > 1) {\n return undefined\n }\n continue\n }\n if (character === ']') {\n depth -= 1\n if (depth < 0) {\n return undefined\n }\n continue\n }\n if (depth === 0) {\n output += character\n }\n }\n return depth === 0 ? output : undefined\n}\n\nfunction executeChangeComponent(\n state: DraftState,\n context: FieldSchemaContext,\n command: ChangeComponentCommand,\n): FieldPropertyCommandResult {\n if (!command.component) {\n return { status: 'rejected', message: 'change-component 命令缺少目标组件' }\n }\n\n const plan = planComponentMigration(context, command.component)\n if (plan.compatibility === 'unchanged') {\n return { status: 'unchanged' }\n }\n if (plan.risk === 'confirmation' && command.confirmed !== true) {\n return { status: 'confirmation-required', plan }\n }\n\n replaceSelectedNodeAndField(state, plan.node, plan.field)\n return { status: 'applied' }\n}\n\nfunction resolveCommandChanges(\n command: FieldPropertyCommand,\n properties: FieldPropertyField[],\n context: FieldSchemaContext,\n): { changes: FieldPropertyChange[] } | { message: string } {\n if (command.type === 'change-component') {\n return { message: 'change-component 命令必须独立执行' }\n }\n\n if (command.type === 'update-inline-properties') {\n const changes: FieldPropertyChange[] = []\n for (const [key, value] of Object.entries(command.values)) {\n if (key === 'node.component') {\n return { message: '组件切换必须使用 change-component 命令' }\n }\n const property = properties.find((item) => item.key === key)\n if (!property || property.editLevel !== 'inline') {\n return { message: `属性 ${key} 不是当前节点可编辑的 inline 属性` }\n }\n changes.push({ property, value })\n }\n return { changes }\n }\n\n const card = context.extensionContext\n ? context.extensionContext.getCapabilityCard(command.capability)\n : getDesignerCapabilityCard(command.capability)\n const property = properties.find((item) => item.capability === command.capability)\n if (!card?.write || !property || property.editLevel === 'readonly') {\n return { message: `能力 ${command.capability} 不是当前节点可配置的能力` }\n }\n\n return { changes: [{ property, value: command.value }] }\n}\n\nfunction listFieldProperties(\n context: FieldSchemaContext,\n sections: readonly FieldSchemaSection[] = createFieldSchemaSections(context),\n): FieldPropertyField[] {\n return sections.flatMap((section) => section.fields)\n}\n\nfunction resolveNodeComponent(context: FieldSchemaContext): string | undefined {\n return context.node.type === 'field' ? (context.node.component ?? 'text') : context.node.component\n}\n\nfunction isSameValue(left: unknown, right: unknown): boolean {\n return JSON.stringify(left) === JSON.stringify(right)\n}\n","import type { FormView } from '@sparqjs/schema-protocol'\nimport { getObjectPathValue } from '../shared/object-path'\nimport { getEffectiveFormFooterActions } from '../state/form-actions'\nimport type { FieldPropertyCommitMode } from './field-schema'\n\n/** 表单级 Inspector 支持的属性控件联合类型。 */\nexport type FormPropertyField =\n | FormTextField\n | FormTextareaField\n | FormNumberField\n | FormSwitchField\n | FormSelectField\n | FormDividerField\n\n/** FormView 属性面板中的语义分组。 */\nexport interface FormSchemaSection {\n key: string\n title: string\n fields: FormPropertyField[]\n}\n\ninterface BaseFormField {\n key: string\n label: string\n commitMode: FieldPropertyCommitMode\n /** 属性标题旁的设计期说明,只进入 Inspector 临时 Schema。 */\n tip?: string\n path?: string\n visible?: (form: FormView) => boolean\n}\n\n/** 表单单行文本属性。 */\nexport interface FormTextField extends BaseFormField {\n kind: 'text'\n placeholder?: string\n}\n\n/** 表单多行文本属性。 */\nexport interface FormTextareaField extends BaseFormField {\n kind: 'textarea'\n placeholder?: string\n rows?: number\n}\n\n/** 表单数值属性及步进约束。 */\nexport interface FormNumberField extends BaseFormField {\n kind: 'number'\n min?: number\n max?: number\n step?: number\n placeholder?: string\n}\n\n/** 表单开关属性。 */\nexport interface FormSwitchField extends BaseFormField {\n kind: 'switch'\n}\n\n/** 表单静态选项属性。 */\nexport interface FormSelectField extends BaseFormField {\n kind: 'select'\n options: Array<{ label: string; value: string }>\n}\n\n/** 只参与布局分组、不生成业务字段的分隔项。 */\nexport interface FormDividerField extends BaseFormField {\n kind: 'divider'\n}\n\n/** 表单级 Inspector 的属性分组,字段可见性由当前 FormView 动态判断。 */\nexport const formSchemaSections: FormSchemaSection[] = [\n {\n key: 'form-info',\n title: '表单信息',\n fields: [\n {\n key: 'title',\n kind: 'text',\n label: '表单标题',\n commitMode: 'blur',\n path: 'title',\n placeholder: '请输入表单标题',\n },\n {\n key: 'help',\n kind: 'textarea',\n label: '表单说明',\n commitMode: 'blur',\n path: 'help',\n placeholder: '请输入表单说明',\n rows: 3,\n },\n ],\n },\n {\n key: 'layout',\n title: '布局',\n fields: [\n {\n key: 'span',\n kind: 'number',\n label: '默认列宽',\n tip: '没有单独设置列宽的字段使用这个值。24 表示占满一行。',\n commitMode: 'blur',\n path: 'span',\n min: 1,\n max: 24,\n step: 1,\n placeholder: '例如 24',\n },\n {\n key: 'gap',\n kind: 'number',\n label: '字段间距',\n tip: '设置表单字段之间的水平和垂直间距。',\n commitMode: 'blur',\n path: 'gap',\n min: 0,\n max: 48,\n step: 1,\n placeholder: '例如 16',\n },\n ],\n },\n {\n key: 'container',\n title: '容器',\n fields: [\n {\n key: 'wrapper.type',\n kind: 'select',\n label: '外层容器',\n tip: '决定表单外层的展示方式。弹窗和抽屉的尺寸可以在下方设置。',\n commitMode: 'immediate',\n path: 'wrapper.type',\n options: [\n { label: '卡片', value: 'card' },\n { label: '弹窗', value: 'dialog' },\n { label: '抽屉', value: 'drawer' },\n { label: '面板', value: 'panel' },\n ],\n },\n {\n key: 'wrapper.props.width',\n kind: 'text',\n label: '弹窗宽度',\n commitMode: 'blur',\n path: 'wrapper.props.width',\n placeholder: '例如 720px / 60%',\n visible: (form) => form.wrapper?.type === 'dialog',\n },\n {\n key: 'wrapper.props.size',\n kind: 'text',\n label: '抽屉尺寸',\n commitMode: 'blur',\n path: 'wrapper.props.size',\n placeholder: '例如 520px / 40%',\n visible: (form) => form.wrapper?.type === 'drawer',\n },\n ],\n },\n {\n key: 'appearance',\n title: '控件表现',\n fields: [\n {\n key: 'props.labelPosition',\n kind: 'select',\n label: '标签位置',\n commitMode: 'immediate',\n path: 'props.labelPosition',\n options: [\n { label: '顶部', value: 'top' },\n { label: '左侧', value: 'left' },\n { label: '右侧', value: 'right' },\n ],\n },\n {\n key: 'props.labelWidth',\n kind: 'text',\n label: '标签宽度',\n tip: '设置左侧或右侧标签占用的宽度。顶部标签不使用这个值。',\n commitMode: 'blur',\n path: 'props.labelWidth',\n placeholder: '例如 120px / 120',\n },\n {\n key: 'props.size',\n kind: 'select',\n label: '控件尺寸',\n commitMode: 'immediate',\n path: 'props.size',\n options: [\n { label: '大', value: 'large' },\n { label: '小', value: 'small' },\n ],\n },\n {\n key: 'props.inline',\n kind: 'switch',\n label: '行内布局',\n tip: '开启后,表单项按行内方式排列;空间不足时仍可能换行。',\n commitMode: 'immediate',\n path: 'props.inline',\n },\n {\n key: 'props.statusIcon',\n kind: 'switch',\n label: '校验图标',\n commitMode: 'immediate',\n path: 'props.statusIcon',\n },\n {\n key: 'props.showMessage',\n kind: 'switch',\n label: '校验信息',\n tip: '控制校验失败时是否显示错误文案。关闭后仍会执行校验。',\n commitMode: 'immediate',\n path: 'props.showMessage',\n },\n {\n key: 'props.inlineMessage',\n kind: 'switch',\n label: '行内校验',\n tip: '开启后,错误文案显示在控件旁边;关闭时显示在控件下方。',\n commitMode: 'immediate',\n path: 'props.inlineMessage',\n },\n {\n key: 'props.showRequiredAsterisk',\n kind: 'switch',\n label: '必填星号',\n tip: '只控制必填标记是否显示,不改变字段的校验规则。',\n commitMode: 'immediate',\n },\n ],\n },\n {\n key: 'footer',\n title: '提交操作',\n fields: [\n {\n key: 'footer.visible',\n kind: 'switch',\n label: '底部按钮',\n commitMode: 'immediate',\n },\n {\n key: 'footer.secondary',\n kind: 'select',\n label: '次按钮类型',\n commitMode: 'immediate',\n options: [\n { label: '重置', value: 'reset' },\n { label: '取消', value: 'cancel' },\n { label: '不显示', value: 'none' },\n ],\n visible: (form) => form.footer !== false,\n },\n {\n key: 'footer.submitTitle',\n kind: 'text',\n label: '提交文案',\n commitMode: 'blur',\n placeholder: '默认使用提交',\n visible: (form) => form.footer !== false,\n },\n {\n key: 'footer.secondaryTitle',\n kind: 'text',\n label: '次按钮文案',\n commitMode: 'blur',\n placeholder: '默认使用系统文案',\n visible: (form) => form.footer !== false && getSecondaryFooterAction(form) !== undefined,\n },\n ],\n },\n]\n\n/** 返回当前表单状态允许的分组,供投影、命令校验和提交策略查询复用。 */\nexport function listVisibleFormSchemaSections(form: FormView): FormSchemaSection[] {\n return formSchemaSections\n .map((section) => ({\n ...section,\n fields: section.fields.filter((field) => !field.visible || field.visible(form)),\n }))\n .filter((section) => section.fields.some((field) => field.kind !== 'divider'))\n}\n\n/** 返回当前 FormView 实际可编辑的属性声明。 */\nexport function listVisibleFormProperties(form: FormView): Exclude<FormPropertyField, FormDividerField>[] {\n return listVisibleFormSchemaSections(form).flatMap((section) =>\n section.fields.filter(\n (field): field is Exclude<FormPropertyField, FormDividerField> => field.kind !== 'divider',\n ),\n )\n}\n\n/** 读取 FormView 属性值,并为 footer 的派生字段解析有效默认动作。 */\nexport function getFormFieldValue(form: FormView, field: FormPropertyField): unknown {\n if (field.key === 'props.showRequiredAsterisk') {\n return form.props?.hideRequiredAsterisk !== true\n }\n\n if (field.key === 'footer.visible') {\n return form.footer !== false\n }\n\n if (field.key === 'wrapper.type' && form.wrapper?.type === 'default') {\n return undefined\n }\n\n if (field.key === 'props.size' && form.props?.size === 'default') {\n return undefined\n }\n\n if (field.key === 'footer.secondary') {\n return getSecondaryFooterAction(form)?.action ?? 'reset'\n }\n\n if (field.key === 'footer.submitTitle') {\n return getEffectiveFormFooterActions(form).find((item) => item.action === 'submit')?.title ?? ''\n }\n\n if (field.key === 'footer.secondaryTitle') {\n return getSecondaryFooterAction(form)?.title ?? ''\n }\n\n if (!field.path) {\n return undefined\n }\n\n return getObjectPathValue(form as Record<string, unknown>, field.path)\n}\n\nfunction getSecondaryFooterAction(form: FormView) {\n return getEffectiveFormFooterActions(form).find((item) => item.action === 'reset' || item.action === 'cancel')\n}\n","import type { FooterConfig, FormView, ResourceField, SchemaResource, ViewNode } from '@sparqjs/schema-protocol'\nimport { cloneSerializable } from '../shared/clone'\nimport { setObjectPathValue } from '../shared/object-path'\nimport { getFormFieldValue, listVisibleFormSchemaSections, type FormPropertyField } from './form-schema'\nimport { createPropertySectionNode } from './property-section'\n\n/** 表单级 Inspector 的扁平值映射。 */\nexport type FormPropertyValues = Record<string, unknown>\n\n/** 把可见的 FormView 属性声明转换为 Inspector 使用的临时 SchemaResource。 */\nexport function createFormPropertySchema(form: FormView): SchemaResource {\n const fields: ResourceField[] = []\n const children: ViewNode[] = []\n\n for (const section of listVisibleFormSchemaSections(form)) {\n const sectionChildren: ViewNode[] = []\n for (const field of section.fields) {\n if (field.kind === 'divider') {\n continue\n }\n\n fields.push(createPropertyField(field))\n sectionChildren.push(createPropertyNode(field))\n }\n\n if (!sectionChildren.length) {\n continue\n }\n\n children.push(createPropertySectionNode(section.key, section.title, sectionChildren, true))\n }\n\n return {\n schema: {\n version: '1.0',\n name: 'designer_form_properties',\n fields,\n views: {\n forms: {\n default: {\n footer: false,\n span: 24,\n gap: 10,\n children,\n props: {\n labelPosition: 'left',\n labelWidth: '96px',\n size: 'default',\n showMessage: true,\n },\n },\n },\n },\n },\n }\n}\n\n/** 根据当前可见属性生成结构 key,footer 状态变化时可触发表单重建。 */\nexport function createFormPropertySchemaKey(form: FormView): string {\n const keys: string[] = []\n\n for (const section of listVisibleFormSchemaSections(form)) {\n for (const field of section.fields) {\n if (field.kind === 'divider') {\n continue\n }\n\n keys.push(field.key)\n }\n }\n\n return keys.join('|')\n}\n\n/** 从 FormView 读取当前可见属性值,供 Inspector 表单初始化。 */\nexport function createFormPropertyValues(form: FormView): FormPropertyValues {\n const values: FormPropertyValues = {}\n\n for (const section of listVisibleFormSchemaSections(form)) {\n for (const field of section.fields) {\n if (field.kind === 'divider') {\n continue\n }\n\n const value = getFormFieldValue(form, field)\n if (value !== undefined) {\n values[field.key] = value\n }\n }\n }\n\n return values\n}\n\n/** 将 Inspector 表单值写回 FormView 副本,不直接修改当前草稿对象。 */\nexport function applyFormPropertyValues(form: FormView, values: FormPropertyValues): FormView {\n return applyFormPropertyChanges(form, values)\n}\n\n/** 只写入本次命令携带的表单属性,未包含的草稿值不会被清空。 */\nexport function applyFormPropertyChanges(form: FormView, values: FormPropertyValues): FormView {\n const next = cloneSerializable(form)\n\n for (const [key, value] of Object.entries(values)) {\n const field = listVisibleFormSchemaSections(form)\n .flatMap((section) => section.fields)\n .find((item) => item.kind !== 'divider' && item.key === key)\n if (field && field.kind !== 'divider') {\n applyFormPropertyValue(next, field, normalizePropertyValue(field, value))\n }\n }\n\n return next\n}\n\nfunction createPropertyField(field: FormPropertyField): ResourceField {\n return {\n name: field.key,\n label: field.label,\n type: resolveFieldType(field),\n formable: true,\n multiple: false,\n options:\n field.kind === 'select'\n ? {\n mode: 'static',\n value_policy: 'closed',\n items: field.options.map((item) => ({\n label: item.label,\n value: item.value,\n })),\n }\n : undefined,\n }\n}\n\nfunction createPropertyNode(field: FormPropertyField): ViewNode {\n return {\n type: 'field',\n field: field.key,\n tip: field.tip,\n component: resolveComponent(field),\n props: {\n placeholder:\n field.kind === 'text' || field.kind === 'textarea' || field.kind === 'number'\n ? field.placeholder\n : undefined,\n min: field.kind === 'number' ? field.min : undefined,\n max: field.kind === 'number' ? field.max : undefined,\n step: field.kind === 'number' ? field.step : undefined,\n rows: field.kind === 'textarea' ? field.rows : undefined,\n clearable: field.kind === 'select' ? true : undefined,\n },\n }\n}\n\nfunction applyFormPropertyValue(form: FormView, field: FormPropertyField, value: unknown): void {\n if (field.key === 'props.showRequiredAsterisk') {\n setObjectPathValue(\n form as Record<string, unknown>,\n 'props.hideRequiredAsterisk',\n value === true ? undefined : true,\n )\n return\n }\n\n if (field.key === 'footer.visible') {\n if (value === false) {\n form.footer = false\n } else if (form.footer === false) {\n form.footer = {}\n }\n return\n }\n\n if (field.key === 'footer.secondary') {\n setFooterSecondaryAction(form, value === 'cancel' || value === 'none' ? value : 'reset')\n return\n }\n\n if (field.key === 'footer.submitTitle') {\n setFooterActionTitle(form, 'submit', normalizeOptionalString(value))\n return\n }\n\n if (field.key === 'footer.secondaryTitle') {\n const secondary = getFooterActions(form).find((item) => item.action === 'reset' || item.action === 'cancel')\n if (secondary?.action) {\n setFooterActionTitle(form, secondary.action, normalizeOptionalString(value))\n }\n return\n }\n\n if (!field.path) {\n return\n }\n\n setObjectPathValue(form as Record<string, unknown>, field.path, value)\n}\n\nfunction setFooterSecondaryAction(form: FormView, action: 'reset' | 'cancel' | 'none'): void {\n const footer = ensureFooterObject(form)\n const actions = getFooterActions(form)\n const submit = actions.find((item) => item.action === 'submit')\n const secondary = actions.find((item) => item.action === 'reset' || item.action === 'cancel')\n const nextSecondary =\n action === 'none'\n ? undefined\n : {\n action,\n title: secondary?.action === action ? secondary.title : undefined,\n }\n\n form.footer = {\n ...footer,\n actions: [submit ?? { action: 'submit' }, ...(nextSecondary ? [nextSecondary] : [])],\n }\n\n cleanupFooter(form.footer)\n}\n\nfunction setFooterActionTitle(form: FormView, action: string, title: string | undefined): void {\n const footer = ensureFooterObject(form)\n const actions = getFooterActions(form)\n const item = actions.find((next) => next.action === action) ?? { action }\n if (!actions.includes(item)) {\n actions.push(item)\n }\n\n item.title = title\n form.footer = {\n ...footer,\n actions,\n }\n\n cleanupFooter(form.footer)\n}\n\nfunction getFooterActions(form: FormView) {\n if (form.footer === false) {\n return []\n }\n\n if (form.footer?.actions?.length) {\n return form.footer.actions.map((item) => ({ ...item }))\n }\n\n return [{ action: 'submit' }, { action: 'reset' }]\n}\n\nfunction cleanupFooter(footer: FooterConfig | undefined): void {\n if (!footer) {\n return\n }\n\n for (const action of footer.actions ?? []) {\n if (!action.title) {\n delete action.title\n }\n }\n}\n\nfunction ensureFooterObject(form: FormView): NonNullable<Exclude<FormView['footer'], false>> {\n if (form.footer === false || !form.footer) {\n form.footer = {}\n }\n\n return form.footer\n}\n\nfunction resolveFieldType(field: FormPropertyField): string {\n switch (field.kind) {\n case 'number':\n return 'number'\n case 'switch':\n return 'boolean'\n default:\n return 'string'\n }\n}\n\nfunction resolveComponent(field: FormPropertyField): string {\n switch (field.kind) {\n case 'textarea':\n return 'textarea'\n case 'number':\n return 'number'\n case 'switch':\n return 'switch'\n case 'select':\n return 'select'\n default:\n return 'text'\n }\n}\n\nfunction normalizePropertyValue(field: FormPropertyField, value: unknown): unknown {\n if (field.kind === 'number') {\n return typeof value === 'number' && Number.isFinite(value) ? value : undefined\n }\n\n if (field.kind === 'switch') {\n return value === true\n }\n\n if (typeof value === 'string') {\n return value === '' ? undefined : value\n }\n\n return value\n}\n\nfunction normalizeOptionalString(value: unknown): string | undefined {\n return typeof value === 'string' && value !== '' ? value : undefined\n}\n","import { getFormView, replaceFormView } from '../../state/draft'\nimport type { DraftState } from '../../state/types'\nimport { applyFormPropertyChanges, type FormPropertyValues } from '../form-property-view'\nimport { listVisibleFormProperties } from '../form-schema'\n\n/** 一次表单属性提交,只携带已经到达 commitMode 边界的局部值。 */\nexport interface UpdateFormPropertiesCommand {\n type: 'update-form-properties'\n values: FormPropertyValues\n}\n\nexport interface FormPropertyCommandIssue {\n key: string\n code: 'unknown-property'\n message: string\n}\n\n/** 表单属性命令结果与字段命令保持相同状态语义,但领域类型独立。 */\nexport type FormPropertyCommandResult =\n | { status: 'applied' }\n | { status: 'unchanged' }\n | { status: 'rejected'; message: string; issues: FormPropertyCommandIssue[] }\n\n/** 校验局部属性后一次替换 FormView,因此一个用户操作只产生一个 history。 */\nexport function executeFormPropertyCommand(\n state: DraftState,\n command: UpdateFormPropertiesCommand,\n): FormPropertyCommandResult {\n const form = getFormView(state.schema, state.viewName)\n const properties = new Set(listVisibleFormProperties(form).map((field) => field.key))\n const issues = Object.keys(command.values)\n .filter((key) => !properties.has(key))\n .map(\n (key): FormPropertyCommandIssue => ({\n key,\n code: 'unknown-property',\n message: `表单属性 ${key} 当前不可编辑`,\n }),\n )\n if (issues.length > 0) {\n return {\n status: 'rejected',\n message: issues.map((issue) => issue.message).join(';'),\n issues,\n }\n }\n if (Object.keys(command.values).length === 0) {\n return { status: 'unchanged' }\n }\n\n const next = applyFormPropertyChanges(form, command.values)\n if (isSameValue(form, next)) {\n return { status: 'unchanged' }\n }\n\n replaceFormView(state, next)\n return { status: 'applied' }\n}\n\nfunction isSameValue(left: unknown, right: unknown): boolean {\n return JSON.stringify(left) === JSON.stringify(right)\n}\n","import type { FieldPropertyCommitMode } from './field-schema'\n\nexport interface PropertyCommitDefinition {\n key: string\n kind: string\n commitMode: FieldPropertyCommitMode\n}\n\nexport interface PropertyCommitKeyEvent {\n key: string\n ctrlKey?: boolean\n metaKey?: boolean\n isComposing?: boolean\n}\n\n/** 返回一次模型更新中真正变化的属性 key,供 Inspector 标记局部草稿。 */\nexport function changedPropertyKeys(previous: Record<string, unknown>, next: Record<string, unknown>): string[] {\n return [...new Set([...Object.keys(previous), ...Object.keys(next)])].filter(\n (key) => !isSameValue(previous[key], next[key]),\n )\n}\n\n/** 离散值、能力确认和组件命令在 change 事件后立即进入命令边界。 */\nexport function shouldCommitPropertyOnChange(field: PropertyCommitDefinition): boolean {\n return field.commitMode !== 'blur'\n}\n\n/** 只有 blur 模式字段在失焦时提交,其他控件已经由 change 或弹层确认提交。 */\nexport function shouldCommitPropertyOnBlur(field: PropertyCommitDefinition): boolean {\n return field.commitMode === 'blur'\n}\n\n/** 文本和数值支持 Enter;textarea 只接受 Cmd/Ctrl + Enter,避免抢占换行。 */\nexport function shouldCommitPropertyOnKeydown(field: PropertyCommitDefinition, event: PropertyCommitKeyEvent): boolean {\n if (field.commitMode !== 'blur' || event.key !== 'Enter' || event.isComposing) {\n return false\n }\n if (field.kind === 'textarea') {\n return event.ctrlKey === true || event.metaKey === true\n }\n return true\n}\n\n/** 同步 schema 后保留尚未提交或被拒绝的局部草稿。 */\nexport function mergePersistedPropertyValues(\n persisted: Record<string, unknown>,\n draft: Record<string, unknown>,\n dirtyKeys: ReadonlySet<string>,\n): Record<string, unknown> {\n const next = { ...persisted }\n for (const key of dirtyKeys) {\n if (Object.prototype.hasOwnProperty.call(draft, key)) {\n next[key] = draft[key]\n }\n }\n return next\n}\n\nfunction isSameValue(left: unknown, right: unknown): boolean {\n return JSON.stringify(left) === JSON.stringify(right)\n}\n","import { computed, defineComponent, Fragment, h, ref, watch, type PropType } from 'vue'\nimport {\n compareValidationRuleValue,\n evaluateFieldValueExpression,\n normalizeValidationDateTimeValue,\n normalizeValidationTimeValue,\n resolveRangeValidationParams,\n} from '@sparqjs/schema-core'\nimport type { Condition, ConditionOperator, ResourceField } from '@sparqjs/schema-protocol'\nimport { createDesignerElementPlusSchemaUi } from '../shared/ui-adapter'\n\ntype ValidationRule = NonNullable<ResourceField['validation']>[number]\n\ninterface ValidationRuleEditorProps {\n component?: string\n field?: ResourceField\n fieldLabel?: string\n fields?: Array<{ label: string; value: string }>\n supported?: string[]\n}\n\nconst formatOptions = [\n { label: '邮箱', value: 'email' },\n { label: '手机号', value: 'cn_mobile' },\n { label: '电话', value: 'phone' },\n { label: 'URL', value: 'url' },\n { label: '身份证', value: 'cn_id_card' },\n { label: 'UUID', value: 'uuid' },\n { label: '标识符', value: 'identifier' },\n { label: '字母', value: 'alpha' },\n { label: '字母数字', value: 'alpha_num' },\n { label: '短标识', value: 'slug' },\n]\n\nconst passwordPresets = [\n {\n label: '大小写 + 数字',\n value: 'upper_lower_num',\n params: {\n min_length: 8,\n require_lower: true,\n require_upper: true,\n require_digit: true,\n },\n message: '密码至少 8 位,且包含大小写字母和数字。',\n },\n {\n label: '大小写 + 数字 + 特殊字符',\n value: 'strong',\n params: {\n min_length: 8,\n require_lower: true,\n require_upper: true,\n require_digit: true,\n require_symbol: true,\n },\n message: '密码至少 8 位,且包含大小写字母、数字和特殊字符。',\n },\n]\n\nconst complexityParamKeys = [\n 'min_length',\n 'max_length',\n 'require_lower',\n 'require_upper',\n 'require_digit',\n 'require_symbol',\n]\n\nconst validationUi = createDesignerElementPlusSchemaUi()\n\n/** 编辑当前组件支持的字段校验规则,保留未识别规则供扩展兼容。 */\nexport const ValidationRuleEditor = defineComponent({\n name: 'ValidationRuleEditor',\n props: {\n value: Array as PropType<ValidationRule[]>,\n onChange: Function as PropType<(value: ValidationRule[]) => void>,\n props: Object as PropType<ValidationRuleEditorProps>,\n },\n setup(props) {\n const open = ref(false)\n const draft = ref<ValidationRule[]>([])\n const commitError = ref('')\n const component = computed(() => props.props?.component || 'text')\n const label = computed(() => props.props?.fieldLabel || '字段')\n const fields = computed(() => props.props?.fields ?? [])\n const supported = computed(() => props.props?.supported)\n const summary = computed(() => summarizeRules(props.value ?? []))\n const configured = computed(() => (props.value?.length ?? 0) > 0)\n\n watch(\n () => props.value,\n (value) => {\n if (!open.value) {\n draft.value = cloneRules(value ?? [])\n }\n },\n { immediate: true, deep: true },\n )\n\n function openDialog() {\n draft.value = cloneRules(props.value ?? [])\n ensureRangeRule(draft.value, component.value)\n ensureColorFormatRule(draft.value, component.value)\n commitError.value = ''\n open.value = true\n }\n\n function closeDialog() {\n open.value = false\n }\n\n function commit() {\n const normalized = normalizeRulesForComponent(draft.value, component.value, supported.value)\n const issue = validateBoundaryRules(normalized, component.value, props.props?.field)\n if (issue) {\n commitError.value = issue\n return\n }\n props.onChange?.(normalized)\n open.value = false\n }\n\n return () => (\n <div class='sparq-capability-editor sparq-validation-editor'>\n <div class='sparq-capability-editor__summary'>\n <span class='sparq-capability-editor__status' title={configured.value ? summary.value : undefined}>\n {configured.value ? '已设置' : '未设置'}\n </span>\n <div class='sparq-capability-editor__actions'>\n <button type='button' class='sparq-capability-editor__button' onClick={openDialog}>\n 配置\n </button>\n </div>\n </div>\n\n {open.value ? (\n <div class='sparq-validation-dialog' role='dialog' aria-modal='true'>\n <div class='sparq-validation-dialog__mask' onClick={closeDialog}></div>\n <section class='sparq-validation-dialog__panel'>\n <header class='sparq-validation-dialog__header'>\n <div>\n <h3>校验规则</h3>\n <p>{label.value}</p>\n </div>\n <button type='button' onClick={closeDialog}>\n 关闭\n </button>\n </header>\n\n <div\n class='sparq-validation-dialog__body'\n onInput={() => (commitError.value = '')}\n onChange={() => (commitError.value = '')}\n >\n {renderRulesByComponent(component.value, draft.value, fields.value, supported.value)}\n {commitError.value ? (\n <p class='sparq-validation-dialog__error' role='alert'>\n {commitError.value}\n </p>\n ) : undefined}\n </div>\n\n <footer class='sparq-validation-dialog__footer'>\n <button type='button' onClick={closeDialog}>\n 取消\n </button>\n <button type='button' class='is-primary' onClick={commit}>\n 确认\n </button>\n </footer>\n </section>\n </div>\n ) : undefined}\n </div>\n )\n },\n})\n\nfunction renderRulesByComponent(\n component: string,\n rules: ValidationRule[],\n fields: Array<{ label: string; value: string }>,\n supported?: string[],\n) {\n const allowed = allowedRuleTypes(component, supported)\n if (allowed.size === 1 && allowed.has('required')) {\n return renderRequiredRule(rules, fields)\n }\n\n switch (component) {\n case 'password':\n return (\n <>\n {renderRequiredRule(rules, fields)}\n {renderPasswordRules(rules)}\n </>\n )\n case 'textarea':\n return (\n <>\n {renderRequiredRule(rules, fields)}\n {renderLengthRules(rules)}\n {renderPatternRule(rules)}\n </>\n )\n case 'number':\n case 'slider':\n case 'rate':\n return (\n <>\n {renderRequiredRule(rules, fields)}\n {renderBoundaryRules(rules, '最小值', '最大值', '例如 0')}\n </>\n )\n case 'date-picker':\n return (\n <>\n {renderRequiredRule(rules, fields)}\n {renderBoundaryRules(rules, '最早日期', '最晚日期', 'YYYY-MM-DD', component)}\n </>\n )\n case 'datetime-picker':\n return (\n <>\n {renderRequiredRule(rules, fields)}\n {renderBoundaryRules(rules, '最早时间', '最晚时间', 'YYYY-MM-DD HH:mm:ss', component)}\n </>\n )\n case 'time-picker':\n return (\n <>\n {renderRequiredRule(rules, fields)}\n {renderBoundaryRules(rules, '最早时间', '最晚时间', 'HH:mm:ss', component)}\n </>\n )\n case 'date-range-picker':\n case 'time-range-picker':\n return (\n <>\n {renderRequiredRule(rules, fields)}\n {renderRangeRule(rules, component)}\n </>\n )\n case 'color':\n return (\n <>\n {renderRequiredRule(rules, fields)}\n {renderColorFormatRule(rules)}\n </>\n )\n case 'select':\n case 'multi-select':\n case 'select-tree':\n case 'cascader':\n case 'radio':\n case 'checkbox':\n case 'image-upload':\n case 'file-upload':\n return renderRequiredRule(rules, fields)\n case 'text':\n default:\n return (\n <>\n {renderRequiredRule(rules, fields)}\n {renderFormatRule(rules)}\n {renderLengthRules(rules)}\n {renderPatternRule(rules)}\n </>\n )\n }\n}\n\nfunction renderColorFormatRule(rules: ValidationRule[]) {\n const rule = ensureColorFormatRule(rules, 'color')\n if (!rule) {\n return undefined\n }\n return (\n <section class='sparq-validation-rule'>\n <header>\n <strong>颜色格式</strong>\n <small>固定校验 HEX、RGB 和 RGBA</small>\n </header>\n {renderMessageInput(rule, '颜色错误提示')}\n </section>\n )\n}\n\nfunction ensureColorFormatRule(rules: ValidationRule[], component: string): ValidationRule | undefined {\n if (component !== 'color') {\n return undefined\n }\n for (let index = rules.length - 1; index >= 0; index -= 1) {\n if (rules[index]?.type === 'format' && rules[index]?.value !== 'color') {\n rules.splice(index, 1)\n }\n }\n const existing = rules.find((rule) => rule.type === 'format' && rule.value === 'color')\n if (existing) {\n return existing\n }\n const rule: ValidationRule = { type: 'format', value: 'color' }\n rules.push(rule)\n return rule\n}\n\nfunction renderRangeRule(rules: ValidationRule[], component: string) {\n const rule = ensureRangeRule(rules, component)\n if (!rule) {\n return undefined\n }\n const params = rule.params ?? {}\n const spanUnit = component === 'date-range-picker' ? 'day' : 'minute'\n const format = spanUnit === 'day' ? 'YYYY-MM-DD' : 'HH:mm:ss'\n const issues = new Map(resolveRangeValidationParams(params).issues.map((issue) => [issue.key, issue.message]))\n return (\n <section class='sparq-validation-rule'>\n <header>\n <strong>范围限制</strong>\n <small>起止顺序固定校验</small>\n </header>\n <div class='sparq-validation-grid'>\n <label>\n <span>最小边界</span>\n {validationUi.text({\n value: typeof params.min === 'string' ? params.min : '',\n class: 'sparq-validation-rule__control',\n placeholder: format,\n 'aria-label': '最小边界',\n onChange: (value: unknown) =>\n setRangeStringParam(rule, 'min', typeof value === 'string' ? value : ''),\n })}\n {renderRangeParamIssue(issues.get('min'))}\n </label>\n <label>\n <span>最大边界</span>\n {validationUi.text({\n value: typeof params.max === 'string' ? params.max : '',\n class: 'sparq-validation-rule__control',\n placeholder: format,\n 'aria-label': '最大边界',\n onChange: (value: unknown) =>\n setRangeStringParam(rule, 'max', typeof value === 'string' ? value : ''),\n })}\n {renderRangeParamIssue(issues.get('max'))}\n </label>\n <label>\n <span>最大跨度({spanUnit === 'day' ? '天' : '分钟'})</span>\n {validationUi.number({\n min: 0,\n step: 1,\n value: typeof params.max_span === 'number' ? params.max_span : undefined,\n class: 'sparq-validation-rule__control',\n placeholder: '不限制',\n 'aria-label': `最大跨度(${spanUnit === 'day' ? '天' : '分钟'})`,\n onChange: (value: unknown) =>\n setRangeSpanParam(rule, typeof value === 'number' ? String(value) : ''),\n })}\n {renderRangeParamIssue(issues.get('max_span'))}\n </label>\n </div>\n {renderMessageInput(rule, '范围错误提示')}\n </section>\n )\n}\n\nfunction renderRangeParamIssue(message: string | undefined) {\n return message ? (\n <small class='sparq-validation-rule__error' role='alert'>\n {message}\n </small>\n ) : undefined\n}\n\nfunction ensureRangeRule(rules: ValidationRule[], component: string): ValidationRule | undefined {\n if (component !== 'date-range-picker' && component !== 'time-range-picker') {\n return undefined\n }\n const spanUnit = component === 'date-range-picker' ? 'day' : 'minute'\n const existing = findRule(rules, 'range')\n if (existing) {\n existing.params = {\n ...existing.params,\n ordered: true,\n span_unit: spanUnit,\n }\n delete existing.value\n delete existing.value_expr\n return existing\n }\n const rule: ValidationRule = {\n type: 'range',\n params: { ordered: true, span_unit: spanUnit },\n }\n rules.push(rule)\n return rule\n}\n\nfunction setRangeStringParam(rule: ValidationRule, key: 'min' | 'max', value: string) {\n rule.params ??= {}\n if (value === '') {\n delete rule.params[key]\n return\n }\n rule.params[key] = value\n}\n\nfunction setRangeSpanParam(rule: ValidationRule, value: string) {\n rule.params ??= {}\n if (value === '') {\n delete rule.params.max_span\n return\n }\n rule.params.max_span = Number(value)\n}\n\nfunction renderRequiredRule(rules: ValidationRule[], fields: Array<{ label: string; value: string }>) {\n const rule = findRule(rules, 'required')\n const mode = resolveRequiredMode(rule)\n return (\n <section class='sparq-validation-rule'>\n <header>\n <strong>必填规则</strong>\n {rule ? (\n <button type='button' onClick={() => removeRule(rules, 'required')}>\n 清除\n </button>\n ) : undefined}\n </header>\n <div class='sparq-validation-options'>\n {[\n { label: '始终', value: 'always' },\n { label: '新增时', value: 'create' },\n { label: '修改时', value: 'update' },\n { label: '字段条件', value: 'condition' },\n ].map((option) => (\n <button\n type='button'\n class={mode === option.value ? 'is-active' : undefined}\n onClick={() => setRequiredMode(rules, option.value, fields)}\n >\n {option.label}\n </button>\n ))}\n </div>\n {rule && mode === 'condition' ? renderRequiredCondition(rule, fields) : undefined}\n {rule && mode === 'advanced' ? (\n <p class='sparq-validation-rule__hint'>当前为高级条件,请通过 JSON 或后续条件编辑器调整。</p>\n ) : undefined}\n {rule ? renderMessageInput(rule, '必填错误提示') : undefined}\n </section>\n )\n}\n\nfunction renderRequiredCondition(rule: ValidationRule, fields: Array<{ label: string; value: string }>) {\n const condition = normalizeRequiredCondition(rule, fields)\n const op = normalizeConditionOperator(condition.op)\n return (\n <div class='sparq-validation-condition'>\n <label>\n <span>字段</span>\n {renderValidationSelect(\n condition.field ?? '',\n fields.length ? fields : [{ label: '暂无可选字段', value: '', disabled: true }],\n (value) => {\n rule.when = {\n ...condition,\n field: value,\n }\n },\n { placeholder: '选择字段', 'aria-label': '条件字段' },\n )}\n </label>\n <label>\n <span>条件</span>\n {renderValidationSelect(\n op,\n requiredConditionOperatorOptions,\n (value) => {\n const nextOp = value as ConditionOperator\n rule.when = createRequiredCondition(\n condition.field ?? firstFieldValue(fields),\n nextOp,\n condition.value,\n )\n },\n { 'aria-label': '条件操作符' },\n )}\n </label>\n {op === 'empty' || op === 'not_empty' ? undefined : (\n <label>\n <span>值</span>\n {validationUi.text({\n value: condition.value === undefined ? '' : String(condition.value),\n class: 'sparq-validation-rule__control',\n placeholder: '请输入比较值',\n 'aria-label': '条件比较值',\n onChange: (value: unknown) => {\n rule.when = {\n ...condition,\n value: parseConditionValue(typeof value === 'string' ? value : ''),\n }\n },\n })}\n </label>\n )}\n </div>\n )\n}\n\nfunction renderFormatRule(rules: ValidationRule[]) {\n const rule = findRule(rules, 'format')\n return (\n <section class='sparq-validation-rule'>\n <header>\n <strong>格式校验</strong>\n {rule ? (\n <button type='button' onClick={() => removeRule(rules, 'format')}>\n 清除\n </button>\n ) : undefined}\n </header>\n <div class='sparq-validation-options'>\n {formatOptions.map((option) => (\n <button\n type='button'\n class={rule?.value === option.value ? 'is-active' : undefined}\n onClick={() => setRule(rules, { type: 'format', value: option.value })}\n >\n {option.label}\n </button>\n ))}\n </div>\n {rule ? renderMessageInput(rule, '格式错误提示') : undefined}\n </section>\n )\n}\n\nfunction renderLengthRules(rules: ValidationRule[]) {\n return (\n <section class='sparq-validation-rule'>\n <header>\n <strong>长度限制</strong>\n </header>\n <div class='sparq-validation-grid'>\n {renderRuleInput(rules, 'min_length', '最小长度', '例如 2')}\n {renderRuleInput(rules, 'max_length', '最大长度', '例如 199')}\n </div>\n </section>\n )\n}\n\nfunction renderBoundaryRules(\n rules: ValidationRule[],\n minLabel: string,\n maxLabel: string,\n placeholder: string,\n component?: string,\n) {\n return (\n <section class='sparq-validation-rule'>\n <header>\n <strong>边界限制</strong>\n </header>\n <div class='sparq-validation-grid'>\n {component\n ? renderBoundaryRuleInput(rules, 'min', minLabel, placeholder, component)\n : renderRuleInput(rules, 'min', minLabel, placeholder)}\n {component\n ? renderBoundaryRuleInput(rules, 'max', maxLabel, placeholder, component)\n : renderRuleInput(rules, 'max', maxLabel, placeholder)}\n </div>\n </section>\n )\n}\n\nfunction renderBoundaryRuleInput(\n rules: ValidationRule[],\n type: 'min' | 'max',\n label: string,\n placeholder: string,\n component: string,\n) {\n const rule = findRule(rules, type)\n const mode = resolveBoundaryMode(rule)\n const options = boundaryExpressionOptions(component)\n const unknownExpression =\n rule?.value_expr &&\n rule.value_expr.type !== 'literal' &&\n !options.some((option) => option.value === rule.value_expr?.type)\n ? rule.value_expr.type\n : undefined\n return (\n <label class='sparq-validation-boundary'>\n <span>{label}</span>\n {renderValidationSelect(\n mode,\n [\n { label: '固定值', value: 'static' },\n ...options,\n ...(unknownExpression\n ? [{ label: `现有表达式(${unknownExpression})`, value: unknownExpression }]\n : []),\n ],\n (value) => setBoundaryMode(rules, type, value, rule),\n { 'aria-label': `${label}方式` },\n )}\n {mode === 'static' ? (\n validationUi.text({\n value: staticBoundaryValue(rule),\n class: 'sparq-validation-rule__control',\n placeholder,\n 'aria-label': label,\n onChange: (value: unknown) =>\n setBoundaryStaticValue(rules, type, typeof value === 'string' ? value : ''),\n })\n ) : boundaryOffsetSummary(rule) ? (\n <small>{boundaryOffsetSummary(rule)}</small>\n ) : undefined}\n </label>\n )\n}\n\nconst dateBoundaryExpressions = [\n { label: '今天', value: 'today' },\n { label: '本月开始', value: 'start_of_month' },\n { label: '本月结束', value: 'end_of_month' },\n]\nconst dateTimeBoundaryExpressions = [\n { label: '当前时间', value: 'now' },\n { label: '今天', value: 'today' },\n { label: '当天开始', value: 'start_of_day' },\n { label: '当天结束', value: 'end_of_day' },\n { label: '本月开始', value: 'start_of_month' },\n { label: '本月结束', value: 'end_of_month' },\n]\nconst timeBoundaryExpressions = [\n { label: '当前时间', value: 'now' },\n { label: '当天开始', value: 'start_of_day' },\n { label: '当天结束', value: 'end_of_day' },\n]\n\nfunction boundaryExpressionOptions(component: string): Array<{ label: string; value: string }> {\n if (component === 'date-picker') {\n return dateBoundaryExpressions\n }\n if (component === 'time-picker') {\n return timeBoundaryExpressions\n }\n return dateTimeBoundaryExpressions\n}\n\nfunction resolveBoundaryMode(rule: ValidationRule | undefined): string {\n return rule?.value_expr && rule.value_expr.type !== 'literal' ? rule.value_expr.type : 'static'\n}\n\nfunction staticBoundaryValue(rule: ValidationRule | undefined): string {\n const value = rule?.value_expr?.type === 'literal' ? rule.value_expr.value : rule?.value\n return value === undefined ? '' : String(value)\n}\n\nfunction setBoundaryMode(rules: ValidationRule[], type: 'min' | 'max', mode: string, rule?: ValidationRule) {\n if (mode === 'static') {\n const value = staticBoundaryValue(rule)\n if (value) {\n replaceBoundaryValue(rules, type, { value })\n } else {\n removeRule(rules, type)\n }\n return\n }\n\n const existing = rule?.value_expr?.type === mode ? rule.value_expr : undefined\n replaceBoundaryValue(rules, type, {\n value_expr: existing\n ? { ...existing, offset: existing.offset ? { ...existing.offset } : undefined }\n : { type: mode },\n })\n}\n\nfunction setBoundaryStaticValue(rules: ValidationRule[], type: 'min' | 'max', value: string) {\n const trimmed = value.trim()\n if (!trimmed) {\n removeRule(rules, type)\n return\n }\n replaceBoundaryValue(rules, type, { value: trimmed })\n}\n\nfunction replaceBoundaryValue(\n rules: ValidationRule[],\n type: 'min' | 'max',\n value: Pick<ValidationRule, 'value' | 'value_expr'>,\n) {\n const existing = findRule(rules, type)\n const next: ValidationRule = { ...existing, type }\n delete next.value\n delete next.value_expr\n Object.assign(next, value)\n setRule(rules, next)\n}\n\nfunction boundaryOffsetSummary(rule: ValidationRule | undefined): string | undefined {\n const entries = Object.entries(rule?.value_expr?.offset ?? {}).filter(([, value]) => value !== 0)\n return entries.length\n ? `保留偏移:${entries.map(([key, value]) => `${boundaryOffsetLabels[key] ?? key} ${value}`).join(',')}`\n : undefined\n}\n\nconst boundaryOffsetLabels: Record<string, string> = {\n years: '年',\n months: '月',\n weeks: '周',\n days: '天',\n hours: '小时',\n minutes: '分钟',\n seconds: '秒',\n milliseconds: '毫秒',\n}\n\nfunction renderPatternRule(rules: ValidationRule[]) {\n const rule = findRule(rules, 'pattern')\n return (\n <section class='sparq-validation-rule'>\n <header>\n <strong>正则校验</strong>\n {rule ? (\n <button type='button' onClick={() => removeRule(rules, 'pattern')}>\n 清除\n </button>\n ) : undefined}\n </header>\n {validationUi.text({\n value: typeof rule?.value === 'string' ? rule.value : '',\n class: 'sparq-validation-rule__control',\n placeholder: '^1[3-9][0-9]{9}$',\n 'aria-label': '正则表达式',\n onChange: (value: unknown) => setRuleValue(rules, 'pattern', typeof value === 'string' ? value : ''),\n })}\n {rule ? renderMessageInput(rule, '正则错误提示') : undefined}\n </section>\n )\n}\n\nfunction renderPasswordRules(rules: ValidationRule[]) {\n const preset = resolvePasswordPreset(rules)\n const complexity = findRule(rules, 'complexity')\n return (\n <section class='sparq-validation-rule'>\n <header>\n <strong>密码复杂度</strong>\n {complexity ? (\n <button type='button' onClick={() => removeRule(rules, 'complexity')}>\n 清除\n </button>\n ) : undefined}\n </header>\n <div class='sparq-validation-options'>\n {passwordPresets.map((option) => (\n <button\n type='button'\n class={preset === option.value ? 'is-active' : undefined}\n onClick={() =>\n setRule(rules, {\n type: 'complexity',\n message: option.message,\n params: { ...option.params },\n })\n }\n >\n {option.label}\n </button>\n ))}\n </div>\n {complexity ? renderMessageInput(complexity, '密码错误提示') : undefined}\n </section>\n )\n}\n\nfunction renderRuleInput(rules: ValidationRule[], type: string, label: string, placeholder: string) {\n const rule = findRule(rules, type)\n return (\n <label>\n <span>{label}</span>\n {validationUi.text({\n value: rule?.value === undefined ? '' : String(rule.value),\n class: 'sparq-validation-rule__control',\n placeholder,\n 'aria-label': label,\n onChange: (value: unknown) => setRuleValue(rules, type, typeof value === 'string' ? value : ''),\n })}\n </label>\n )\n}\n\nfunction renderMessageInput(rule: ValidationRule, label: string) {\n return (\n <label>\n <span>{label}</span>\n {validationUi.text({\n value: rule.message ?? '',\n class: 'sparq-validation-rule__control',\n placeholder: '留空使用默认提示',\n 'aria-label': label,\n onChange: (input: unknown) => {\n const value = typeof input === 'string' ? input.trim() : ''\n if (value) {\n rule.message = value\n } else {\n delete rule.message\n }\n },\n })}\n </label>\n )\n}\n\nfunction renderValidationSelect(\n value: string,\n options: Array<{ label: string; value: string; disabled?: boolean }>,\n onChange: (value: string) => void,\n props: Record<string, unknown> = {},\n) {\n return validationUi.select(\n {\n ...props,\n class: ['sparq-validation-rule__control', props.class],\n value,\n onChange: (next: unknown) => onChange(typeof next === 'string' ? next : ''),\n },\n {\n default: () => options.map((option) => validationUi.option(option)),\n },\n )\n}\n\nfunction setRuleValue(rules: ValidationRule[], type: string, value: string) {\n const trimmed = value.trim()\n if (!trimmed) {\n removeRule(rules, type)\n return\n }\n setRule(rules, { type, value: trimmed })\n}\n\nfunction setRule(rules: ValidationRule[], rule: ValidationRule) {\n removeRule(rules, rule.type)\n rules.push(rule)\n}\n\nfunction removeRule(rules: ValidationRule[], type: string) {\n const index = rules.findIndex((rule) => rule.type === type)\n if (index >= 0) {\n rules.splice(index, 1)\n }\n}\n\nfunction findRule(rules: ValidationRule[], type: string): ValidationRule | undefined {\n return rules.find((rule) => rule.type === type)\n}\n\nfunction resolvePasswordPreset(rules: ValidationRule[]): string | undefined {\n const rule = findRule(rules, 'complexity')\n if (!rule?.params) {\n return undefined\n }\n for (const preset of passwordPresets) {\n if (isSameRuleParams(rule.params, preset.params)) {\n return preset.value\n }\n }\n return undefined\n}\n\nfunction isSameRuleParams(params: Record<string, unknown>, expected: Record<string, unknown>): boolean {\n return complexityParamKeys.every((key) => params[key] === expected[key])\n}\n\nfunction summarizeRules(rules: ValidationRule[]): string {\n const labels = rules.map((rule) => {\n if (rule.type === 'required') {\n return '必填'\n }\n if (rule.type === 'format') {\n return rule.value === 'color'\n ? '颜色格式'\n : (formatOptions.find((option) => option.value === rule.value)?.label ?? '格式')\n }\n if (rule.type === 'min_length' || rule.type === 'max_length') {\n return '长度'\n }\n if (rule.type === 'min' || rule.type === 'max') {\n return '边界'\n }\n if (rule.type === 'pattern') {\n return '正则'\n }\n if (rule.type === 'complexity') {\n return '密码复杂度'\n }\n if (rule.type === 'range') {\n return '范围'\n }\n return rule.type\n })\n return [...new Set(labels)].join('、')\n}\n\nfunction normalizeRulesForComponent(\n rules: ValidationRule[],\n component: string,\n supported?: string[],\n): ValidationRule[] {\n const allowed = allowedRuleTypes(component, supported)\n return cloneRules(rules).filter((rule) => {\n if (!allowed.has(rule.type)) {\n return false\n }\n if (rule.type === 'required') {\n return true\n }\n if (rule.type === 'complexity') {\n return true\n }\n if (rule.type === 'range') {\n return Boolean(rule.params)\n }\n return (rule.value !== undefined && rule.value !== '') || rule.value_expr !== undefined\n })\n}\n\nfunction validateBoundaryRules(\n rules: ValidationRule[],\n component: string,\n field: ResourceField | undefined,\n): string | undefined {\n if (component === 'date-range-picker' || component === 'time-range-picker') {\n const rule = findRule(rules, 'range')\n return rule ? resolveRangeValidationParams(rule.params).issues[0]?.message : undefined\n }\n if (!['date-picker', 'datetime-picker', 'time-picker'].includes(component)) {\n return undefined\n }\n\n const now = new Date()\n const min = resolvedBoundaryValue(findRule(rules, 'min'), field, now)\n const max = resolvedBoundaryValue(findRule(rules, 'max'), field, now)\n const formatIssue =\n validateSemanticBoundaryValue(min, component, field, '最早值') ??\n validateSemanticBoundaryValue(max, component, field, '最晚值')\n if (formatIssue) {\n return formatIssue\n }\n if (min !== undefined && max !== undefined && (compareValidationRuleValue(min, max) ?? 0) > 0) {\n return '最早值不能晚于最晚值,请调整边界后再确认。'\n }\n return undefined\n}\n\nfunction resolvedBoundaryValue(rule: ValidationRule | undefined, field: ResourceField | undefined, now: Date): unknown {\n if (!rule) {\n return undefined\n }\n return rule.value_expr ? evaluateFieldValueExpression(rule.value_expr, { field, now }) : rule.value\n}\n\nfunction validateSemanticBoundaryValue(\n value: unknown,\n component: string,\n field: ResourceField | undefined,\n label: string,\n): string | undefined {\n if (value === undefined || field?.type === 'string') {\n return undefined\n }\n if (component === 'time-picker') {\n return normalizeValidationTimeValue(value) === undefined ? `${label}应使用 HH:mm 或 HH:mm:ss。` : undefined\n }\n return normalizeValidationDateTimeValue(value) === undefined\n ? `${label}应使用 YYYY-MM-DD${component === 'datetime-picker' ? ' HH:mm:ss' : ''}。`\n : undefined\n}\n\nfunction allowedRuleTypes(component: string, supported?: string[]): Set<string> {\n if (supported) {\n return new Set(supported)\n }\n switch (component) {\n case 'password':\n return new Set(['required', 'complexity'])\n case 'number':\n case 'slider':\n case 'rate':\n case 'date-picker':\n case 'datetime-picker':\n case 'time-picker':\n return new Set(['required', 'min', 'max'])\n case 'date-range-picker':\n case 'time-range-picker':\n return new Set(['required', 'range'])\n case 'color':\n return new Set(['required', 'format'])\n case 'textarea':\n return new Set(['required', 'min_length', 'max_length', 'pattern'])\n case 'select':\n case 'multi-select':\n case 'select-tree':\n case 'cascader':\n case 'radio':\n case 'checkbox':\n case 'image-upload':\n case 'file-upload':\n return new Set(['required'])\n case 'text':\n default:\n return new Set(['required', 'format', 'min_length', 'max_length', 'pattern'])\n }\n}\n\nfunction cloneRules(rules: ValidationRule[]): ValidationRule[] {\n return rules.map((rule) => ({\n ...rule,\n when: rule.when ? cloneCondition(rule.when) : undefined,\n params: rule.params ? { ...rule.params } : undefined,\n }))\n}\n\nconst requiredConditionOperatorOptions: Array<{ label: string; value: ConditionOperator }> = [\n { label: '等于', value: 'eq' },\n { label: '不等于', value: 'neq' },\n { label: '大于', value: 'gt' },\n { label: '大于等于', value: 'gte' },\n { label: '小于', value: 'lt' },\n { label: '小于等于', value: 'lte' },\n { label: '为空', value: 'empty' },\n { label: '不为空', value: 'not_empty' },\n]\n\nfunction resolveRequiredMode(\n rule: ValidationRule | undefined,\n): 'none' | 'always' | 'create' | 'update' | 'condition' | 'advanced' {\n if (!rule) {\n return 'none'\n }\n if (!rule.when) {\n return 'always'\n }\n if (rule.when.field === 'action' && rule.when.op === 'eq' && rule.when.value === 'create') {\n return 'create'\n }\n if (rule.when.field === 'action' && rule.when.op === 'eq' && rule.when.value === 'update') {\n return 'update'\n }\n if (isSimpleRequiredCondition(rule.when)) {\n return 'condition'\n }\n return 'advanced'\n}\n\nfunction setRequiredMode(rules: ValidationRule[], mode: string, fields: Array<{ label: string; value: string }>) {\n if (mode === 'always') {\n setRule(rules, { type: 'required' })\n return\n }\n if (mode === 'create' || mode === 'update') {\n setRule(rules, {\n type: 'required',\n when: { field: 'action', op: 'eq', value: mode },\n })\n return\n }\n setRule(rules, {\n type: 'required',\n when: createRequiredCondition(firstFieldValue(fields), 'not_empty'),\n })\n}\n\nfunction normalizeRequiredCondition(rule: ValidationRule, fields: Array<{ label: string; value: string }>): Condition {\n if (isSimpleRequiredCondition(rule.when)) {\n return rule.when\n }\n const condition = createRequiredCondition(firstFieldValue(fields), 'not_empty')\n rule.when = condition\n return condition\n}\n\nfunction createRequiredCondition(field: string, op: ConditionOperator, value?: unknown): Condition {\n const condition: Condition = {\n field,\n op,\n }\n if (op !== 'empty' && op !== 'not_empty') {\n condition.value = value ?? ''\n }\n return condition\n}\n\nfunction isSimpleRequiredCondition(condition: Condition | undefined): condition is Condition {\n if (\n !condition ||\n condition.all ||\n condition.any ||\n condition.not ||\n condition.expr ||\n condition.selection_empty !== undefined\n ) {\n return false\n }\n return typeof condition.field === 'string' && condition.field.startsWith('form.')\n}\n\nfunction firstFieldValue(fields: Array<{ label: string; value: string }>): string {\n return fields[0]?.value ?? ''\n}\n\nfunction normalizeConditionOperator(op: Condition['op']): ConditionOperator {\n return requiredConditionOperatorOptions.some((option) => option.value === op) ? (op as ConditionOperator) : 'eq'\n}\n\nfunction parseConditionValue(value: string): unknown {\n const trimmed = value.trim()\n if (trimmed === 'true') {\n return true\n }\n if (trimmed === 'false') {\n return false\n }\n if (trimmed !== '' && Number.isFinite(Number(trimmed))) {\n return Number(trimmed)\n }\n return trimmed\n}\n\nfunction cloneCondition(condition: Condition): Condition {\n return {\n ...condition,\n all: condition.all?.map(cloneCondition),\n any: condition.any?.map(cloneCondition),\n not: condition.not ? cloneCondition(condition.not) : undefined,\n }\n}\n","import { computed, defineComponent, h, ref, watch, type PropType } from 'vue'\nimport { SCHEMA_UI_TEXT, createSchemaRuntime } from '@sparqjs/schema-core'\nimport type { OptionItem, ResourceField, SchemaResource, ViewNode } from '@sparqjs/schema-protocol'\nimport { createSchemaComponentRegistry, SparqView } from '@sparqjs/schema-vue'\nimport { createDesignerElementPlusUiAdapter, createDesignerElementPlusUiKit } from '../shared/ui-adapter'\nimport { loadDesignerService, type DesignerServiceOption, type DesignerServiceRegistry } from '../services/registry'\nimport type { DesignerOptionSourceMode } from './field-schema'\nimport { summarizeOptionSourceType } from './option-source-summary'\n\ntype FieldOptions = NonNullable<ResourceField['options']>\ntype OptionMode = FieldOptions['mode']\ntype OptionSourceModel = Record<string, unknown>\ntype StaticOptionItem = Pick<OptionItem, 'label' | 'value'>\n\ninterface OptionSourceValue {\n options?: FieldOptions\n reference?: ResourceField['reference']\n}\n\ninterface OptionSourceEditorProps {\n node?: ViewNode\n field?: ResourceField\n fields?: ResourceField[]\n serviceRegistry?: DesignerServiceRegistry\n optionSources?: DesignerOptionSourceMode[]\n}\n\nconst optionModeOptions = [\n { label: '静态', value: 'static' },\n { label: '资源引用', value: 'reference' },\n { label: '字典', value: 'dictionary' },\n]\n\n// 数据选项编辑器只负责弹层、草稿和协议转换;弹层内字段统一交给 SparqView 渲染。\n// 静态选项是行数据而非独立表单,行内 label/value 直接复用当前 UiKit 的输入控件。\n/** 编辑静态、数据字典或资源引用候选来源。 */\nexport const OptionSourceEditor = defineComponent({\n name: 'OptionSourceEditor',\n props: {\n value: Object as PropType<OptionSourceValue>,\n onChange: Function as PropType<(value: OptionSourceValue) => void>,\n props: Object as PropType<OptionSourceEditorProps>,\n },\n setup(props) {\n const open = ref(false)\n const model = ref<OptionSourceModel>({})\n const resources = ref<DesignerServiceOption[]>([])\n const relationFields = ref<DesignerServiceOption[]>([])\n const dicts = ref<DesignerServiceOption[]>([])\n const resourceController = ref<AbortController>()\n const relationFieldController = ref<AbortController>()\n const dictController = ref<AbortController>()\n const resourceLoading = ref(false)\n const relationFieldLoading = ref(false)\n const dictLoading = ref(false)\n const resourceError = ref('')\n const relationFieldError = ref('')\n const dictError = ref('')\n const runtime = createSchemaRuntime()\n const uiAdapter = createDesignerElementPlusUiAdapter()\n const uiKit = createDesignerElementPlusUiKit()\n const components = createSchemaComponentRegistry({\n 'designer.static-options-list': {\n component: StaticOptionsListEditor,\n },\n })\n const serviceContext = computed(() => ({\n node: props.props?.node,\n field: props.props?.field,\n fields: props.props?.fields ?? [],\n }))\n const summary = computed(() => summarizeOptionSourceType(props.value?.options))\n const optionSources = computed(() => props.props?.optionSources ?? [])\n const referenceModeSupported = computed(() => optionSources.value.includes('reference'))\n const dictionaryModeSupported = computed(() => optionSources.value.includes('dictionary'))\n const customValueSupported = computed(() =>\n ['select', 'multi-select'].includes(props.props?.node?.component ?? ''),\n )\n const modeOptions = computed(() => optionModeOptionsForProfile(optionSources.value, currentMode(model.value)))\n const schema = computed(() =>\n createOptionSourceSchema(\n currentMode(model.value),\n modeOptions.value,\n referenceModeSupported.value,\n customValueSupported.value,\n model.value['options.value_policy_open'] === true,\n includeCurrentOption(resources.value, stringModelValue(model.value, 'reference.resource')),\n relationFieldOptions(model.value, relationFields.value),\n includeCurrentOption(dicts.value, stringModelValue(model.value, 'options.dictionary.code')),\n ),\n )\n\n watch(\n () => props.value,\n (value) => {\n if (!open.value) {\n model.value = modelFromOptions(value)\n }\n },\n { immediate: true, deep: true },\n )\n\n watch(\n () => (open.value ? stringModelValue(model.value, 'reference.resource') : ''),\n (resource) => {\n if (open.value && referenceModeSupported.value && currentMode(model.value) === 'reference') {\n loadRelationFields(resource)\n }\n },\n )\n\n function openDialog() {\n model.value = modelFromOptions(props.value)\n open.value = true\n if (referenceModeSupported.value) {\n loadResources()\n }\n if (dictionaryModeSupported.value) {\n loadDicts()\n }\n if (referenceModeSupported.value && currentMode(model.value) === 'reference') {\n loadRelationFields(stringModelValue(model.value, 'reference.resource'))\n }\n }\n\n function closeDialog() {\n abortLoads()\n open.value = false\n }\n\n function commit() {\n props.onChange?.(optionSourceFromModel(model.value, props.props?.field?.type))\n closeDialog()\n }\n\n function updateModel(values: Record<string, unknown>) {\n const previousMode = currentMode(model.value)\n const nextMode = currentMode(values)\n const next = { ...model.value, ...values }\n\n if (previousMode !== nextMode) {\n applyModeDefaults(next, nextMode)\n }\n\n if (isSameRecord(model.value, next)) {\n return\n }\n\n model.value = next\n }\n\n return () => (\n <div class='sparq-capability-editor sparq-option-source-editor'>\n <div class='sparq-capability-editor__summary'>\n <span>{summary.value}</span>\n <div class='sparq-capability-editor__actions'>\n <button type='button' class='sparq-capability-editor__button' onClick={openDialog}>\n 配置\n </button>\n </div>\n </div>\n\n {open.value ? (\n <div class='sparq-option-source-dialog' role='dialog' aria-modal='true'>\n <div class='sparq-option-source-dialog__mask' onClick={closeDialog}></div>\n <section class='sparq-option-source-dialog__panel'>\n <header class='sparq-option-source-dialog__header'>\n <div>\n <h3>数据选项</h3>\n <p>配置字段候选项来源</p>\n </div>\n <button type='button' onClick={closeDialog}>\n 关闭\n </button>\n </header>\n\n <div class='sparq-option-source-dialog__body'>\n {currentMode(model.value) === 'reference' && resourceLoading.value ? (\n <p class='sparq-capability-editor__service-state' role='status'>\n 正在加载资源列表…\n </p>\n ) : undefined}\n {currentMode(model.value) === 'reference' && resourceError.value ? (\n <p class='sparq-capability-editor__service-state is-error' role='alert'>\n {resourceError.value}\n <button type='button' onClick={loadResources}>\n 重试\n </button>\n </p>\n ) : undefined}\n {currentMode(model.value) === 'reference' && relationFieldLoading.value ? (\n <p class='sparq-capability-editor__service-state' role='status'>\n 正在加载资源字段…\n </p>\n ) : undefined}\n {currentMode(model.value) === 'reference' && relationFieldError.value ? (\n <p class='sparq-capability-editor__service-state is-error' role='alert'>\n {relationFieldError.value}\n <button\n type='button'\n onClick={() =>\n loadRelationFields(stringModelValue(model.value, 'reference.resource'))\n }\n >\n 重试\n </button>\n </p>\n ) : undefined}\n {currentMode(model.value) === 'dictionary' && dictLoading.value ? (\n <p class='sparq-capability-editor__service-state' role='status'>\n 正在加载数据字典…\n </p>\n ) : undefined}\n {currentMode(model.value) === 'dictionary' && dictError.value ? (\n <p class='sparq-capability-editor__service-state is-error' role='alert'>\n {dictError.value}\n <button type='button' onClick={loadDicts}>\n 重试\n </button>\n </p>\n ) : undefined}\n <SparqView\n schema={schema.value}\n mode='form'\n view='default'\n modelValue={model.value}\n runtime={runtime}\n uiAdapter={uiAdapter}\n uiKit={uiKit}\n components={components}\n onUpdate:modelValue={updateModel}\n />\n </div>\n\n <footer class='sparq-option-source-dialog__footer'>\n <button type='button' onClick={closeDialog}>\n 取消\n </button>\n <button type='button' class='is-primary' onClick={commit}>\n 确认\n </button>\n </footer>\n </section>\n </div>\n ) : undefined}\n </div>\n )\n\n function loadResources() {\n resourceController.value?.abort()\n const controller = new AbortController()\n resourceController.value = controller\n resourceLoading.value = true\n resourceError.value = ''\n loadDesignerService<DesignerServiceOption[]>(\n 'resources.list',\n serviceContext.value,\n undefined,\n controller.signal,\n props.props?.serviceRegistry,\n )\n .then((options) => {\n if (!controller.signal.aborted) {\n resources.value = options\n }\n })\n .catch(() => {\n if (!controller.signal.aborted) {\n resources.value = []\n resourceError.value = '资源列表加载失败,请重试。'\n }\n })\n .finally(() => {\n if (!controller.signal.aborted) {\n resourceLoading.value = false\n }\n })\n }\n\n function loadRelationFields(resource: string) {\n relationFieldController.value?.abort()\n const controller = new AbortController()\n relationFieldController.value = controller\n relationFieldLoading.value = true\n relationFieldError.value = ''\n loadDesignerService<DesignerServiceOption[]>(\n 'resources.fields',\n serviceContext.value,\n { resource },\n controller.signal,\n props.props?.serviceRegistry,\n )\n .then((options) => {\n if (!controller.signal.aborted) {\n relationFields.value = options\n }\n })\n .catch(() => {\n if (!controller.signal.aborted) {\n relationFields.value = []\n relationFieldError.value = '资源字段加载失败,请重试。'\n }\n })\n .finally(() => {\n if (!controller.signal.aborted) {\n relationFieldLoading.value = false\n }\n })\n }\n\n function loadDicts() {\n dictController.value?.abort()\n const controller = new AbortController()\n dictController.value = controller\n dictLoading.value = true\n dictError.value = ''\n loadDesignerService<DesignerServiceOption[]>(\n 'dicts.list',\n serviceContext.value,\n undefined,\n controller.signal,\n props.props?.serviceRegistry,\n )\n .then((options) => {\n if (!controller.signal.aborted) {\n dicts.value = options\n }\n })\n .catch(() => {\n if (!controller.signal.aborted) {\n dicts.value = []\n dictError.value = '数据字典加载失败,请重试。'\n }\n })\n .finally(() => {\n if (!controller.signal.aborted) {\n dictLoading.value = false\n }\n })\n }\n\n function abortLoads() {\n resourceController.value?.abort()\n relationFieldController.value?.abort()\n dictController.value?.abort()\n }\n },\n})\n\nexport const StaticOptionsListEditor = defineComponent({\n name: 'StaticOptionsListEditor',\n props: {\n value: Array as PropType<OptionItem[]>,\n onChange: Function as PropType<(value: OptionItem[]) => void>,\n },\n setup(props) {\n const items = computed(() => cloneStaticOptions(props.value ?? []))\n const uiKit = createDesignerElementPlusUiKit()\n\n function update(next: OptionItem[]) {\n props.onChange?.(next)\n }\n\n return () => (\n <div class='sparq-static-options-inline'>\n <div class='sparq-static-options-table' role='table' aria-label='静态选项'>\n <div class='sparq-static-options-table__head' role='row'>\n <span role='columnheader'>显示文本</span>\n <span role='columnheader'>选项值</span>\n <span role='columnheader'>操作</span>\n </div>\n {items.value.map((option, index) => (\n <div class='sparq-static-options-row' role='row' key={index}>\n <div class='sparq-static-options-row__field' role='cell'>\n <span class='sparq-static-options-row__label'>显示文本</span>\n {uiKit.render(SCHEMA_UI_TEXT, {\n modelValue: option.label,\n placeholder: '显示文本',\n 'aria-label': `第 ${index + 1} 项显示文本`,\n 'onUpdate:modelValue'(value: unknown) {\n updateStaticOption(items.value, index, { label: value }, update)\n },\n })}\n </div>\n <div class='sparq-static-options-row__field' role='cell'>\n <span class='sparq-static-options-row__label'>选项值</span>\n {uiKit.render(SCHEMA_UI_TEXT, {\n modelValue: option.value,\n placeholder: '选项值',\n 'aria-label': `第 ${index + 1} 项选项值`,\n 'onUpdate:modelValue'(value: unknown) {\n updateStaticOption(items.value, index, { value }, update)\n },\n })}\n </div>\n <div class='sparq-static-options-row__actions' role='cell'>\n <button\n type='button'\n disabled={index === 0}\n aria-label={`上移第 ${index + 1} 项`}\n onClick={() => moveStaticOption(items.value, index, -1, update)}\n >\n 上移\n </button>\n <button\n type='button'\n disabled={index === items.value.length - 1}\n aria-label={`下移第 ${index + 1} 项`}\n onClick={() => moveStaticOption(items.value, index, 1, update)}\n >\n 下移\n </button>\n <button\n type='button'\n aria-label={`删除第 ${index + 1} 项`}\n onClick={() => removeStaticOption(items.value, index, update)}\n >\n 删除\n </button>\n </div>\n </div>\n ))}\n </div>\n {!items.value.length ? <p class='sparq-option-source-empty'>暂无选项。</p> : undefined}\n <div class='sparq-option-source-toolbar'>\n <button\n type='button'\n onClick={() => update([...items.value, createOption(items.value.length + 1)])}\n >\n 新增选项\n </button>\n <button type='button' onClick={() => update([])}>\n 清空\n </button>\n </div>\n </div>\n )\n },\n})\n\nfunction createOptionSourceSchema(\n mode: OptionMode,\n modeOptions: DesignerServiceOption[],\n referenceModeSupported: boolean,\n customValueSupported: boolean,\n openPolicyConfigured: boolean,\n resources: DesignerServiceOption[],\n relationFields: DesignerServiceOption[],\n dicts: DesignerServiceOption[],\n): SchemaResource {\n const fields: ResourceField[] = [createSelectField('options.mode', '来源', modeOptions)]\n const children: ViewNode[] = [{ type: 'field', field: 'options.mode', component: 'radio' }]\n\n if (mode === 'reference' && referenceModeSupported) {\n fields.push(\n createSelectField('reference.resource', '关联资源', resources),\n createSelectField('reference.value_field', '值字段', relationFields),\n createSelectField('reference.label_field', '标题字段', relationFields),\n createSelectField('options.reference.search_field', '搜索字段', relationFields),\n createSelectField('options.reference.parent_field', '父级字段', relationFields),\n createSelectField('options.reference.load_mode', '加载模式', [\n { label: '分页', value: 'paged' },\n { label: '树形', value: 'tree' },\n { label: '全量', value: 'all' },\n ]),\n { name: 'options.reference.limit', label: '加载上限', type: 'number', formable: true },\n )\n children.push(\n {\n type: 'field',\n field: 'reference.resource',\n component: 'select',\n span: 12,\n props: { clearable: true },\n },\n {\n type: 'field',\n field: 'reference.value_field',\n component: 'select',\n span: 12,\n props: { clearable: true },\n },\n {\n type: 'field',\n field: 'reference.label_field',\n component: 'select',\n span: 12,\n props: { clearable: true },\n },\n {\n type: 'field',\n field: 'options.reference.search_field',\n component: 'select',\n span: 12,\n props: { clearable: true },\n },\n {\n type: 'field',\n field: 'options.reference.parent_field',\n component: 'select',\n span: 12,\n props: { clearable: true },\n },\n { type: 'field', field: 'options.reference.load_mode', component: 'select', span: 12 },\n { type: 'field', field: 'options.reference.limit', component: 'number', span: 12 },\n )\n } else if (mode === 'dictionary') {\n fields.push(createSelectField('options.dictionary.code', '字典', dicts))\n children.push({\n type: 'field',\n field: 'options.dictionary.code',\n component: 'select',\n props: { clearable: true },\n })\n } else if (mode === 'static') {\n fields.push({ name: 'options.items', label: '选项', type: 'json', formable: true })\n children.push({ type: 'field', field: 'options.items', component: 'designer.static-options-list', span: 24 })\n }\n\n if (mode === 'static' && (customValueSupported || openPolicyConfigured)) {\n fields.push({\n name: 'options.value_policy_open',\n label: '允许自定义值',\n type: 'boolean',\n formable: true,\n disabled: !customValueSupported,\n })\n children.push({\n type: 'field',\n field: 'options.value_policy_open',\n component: 'switch',\n span: 12,\n help: customValueSupported ? undefined : '当前组件不支持自定义值,已有配置仅保留。',\n })\n }\n\n return {\n schema: {\n version: '1.0',\n name: 'designer_option_source_editor',\n fields,\n views: {\n forms: {\n default: {\n footer: false,\n span: 24,\n gap: 10,\n children,\n },\n },\n },\n },\n }\n}\n\nfunction createSelectField(name: string, label: string, options: DesignerServiceOption[]): ResourceField {\n return {\n name,\n label,\n type: 'string',\n formable: true,\n options: {\n mode: 'static',\n value_policy: 'closed',\n items: options.map((option) => ({\n label: option.label,\n value: option.value,\n disabled: option.disabled,\n })),\n },\n }\n}\n\nfunction modelFromOptions(value: OptionSourceValue | undefined): OptionSourceModel {\n const options = value?.options\n if (!options) {\n return {\n 'options.mode': 'static',\n 'options.value_policy_open': false,\n 'options.items': [],\n }\n }\n\n return {\n 'options.mode': options.mode,\n 'options.value_policy_open': options.value_policy === 'open',\n 'options.items': cloneStaticOptions(options.items ?? []),\n 'reference.resource': value?.reference?.resource ?? '',\n 'reference.value_field': value?.reference?.value_field ?? 'id',\n 'reference.label_field': value?.reference?.label_field ?? 'title',\n 'options.reference.search_field': options.reference?.search_field ?? 'title',\n 'options.reference.parent_field': options.reference?.parent_field ?? '',\n 'options.reference.load_mode': options.reference?.load_mode ?? 'paged',\n 'options.reference.limit': options.reference?.limit,\n 'options.dictionary.code': options.dictionary?.code ?? '',\n 'options.remote': options.remote,\n }\n}\n\nfunction optionSourceFromModel(model: OptionSourceModel, fieldType: string | undefined): OptionSourceValue {\n const mode = currentMode(model)\n if (mode === 'reference') {\n return {\n reference: {\n resource: stringModelValue(model, 'reference.resource'),\n value_field: stringModelValue(model, 'reference.value_field') || 'id',\n label_field: stringModelValue(model, 'reference.label_field') || 'title',\n },\n options: {\n mode: 'reference',\n value_policy: fieldOptionValuePolicy(model),\n reference: {\n search_field: stringModelValue(model, 'options.reference.search_field') || 'title',\n parent_field: stringModelValue(model, 'options.reference.parent_field') || undefined,\n load_mode: normalizeLoadMode(model['options.reference.load_mode']),\n limit: normalizePositiveNumber(model['options.reference.limit']),\n },\n },\n }\n }\n\n if (mode === 'dictionary') {\n return {\n options: {\n mode: 'dictionary',\n value_policy: fieldOptionValuePolicy(model),\n dictionary: {\n code: stringModelValue(model, 'options.dictionary.code'),\n },\n },\n }\n }\n\n if (mode === 'remote') {\n const remote = model['options.remote']\n return {\n options: {\n mode: 'remote',\n value_policy: fieldOptionValuePolicy(model),\n remote: isRecord(remote) ? remote : undefined,\n },\n }\n }\n\n return {\n options: {\n mode: 'static',\n value_policy: fieldOptionValuePolicy(model),\n items: normalizeStaticOptions(\n Array.isArray(model['options.items']) ? (model['options.items'] as OptionItem[]) : [],\n fieldType,\n ),\n },\n }\n}\n\nfunction applyModeDefaults(model: OptionSourceModel, mode: OptionMode): void {\n model['options.mode'] = mode\n if (mode === 'static') {\n model['options.items'] = Array.isArray(model['options.items']) ? model['options.items'] : []\n return\n }\n\n model['options.value_policy_open'] = false\n\n if (mode === 'reference') {\n model['reference.value_field'] ||= 'id'\n model['reference.label_field'] ||= 'title'\n model['options.reference.search_field'] ||= 'title'\n model['options.reference.load_mode'] ||= 'paged'\n return\n }\n\n model['options.dictionary.code'] ||= ''\n}\n\nfunction currentMode(model: OptionSourceModel): OptionMode {\n const mode = model['options.mode']\n return mode === 'reference' || mode === 'dictionary' || mode === 'remote' ? mode : 'static'\n}\n\nfunction optionModeOptionsForProfile(\n allowed: DesignerOptionSourceMode[],\n current: OptionMode,\n): DesignerServiceOption[] {\n const options = optionModeOptions.filter((option) => allowed.includes(option.value as DesignerOptionSourceMode))\n if (current === 'remote') {\n return [...options, { label: '远程(只读保留)', value: 'remote', disabled: true }]\n }\n if (!allowed.includes(current as DesignerOptionSourceMode)) {\n const label = optionModeOptions.find((option) => option.value === current)?.label ?? current\n return [...options, { label: `${label}(当前组件不支持)`, value: current, disabled: true }]\n }\n return options\n}\n\nfunction stringModelValue(model: OptionSourceModel, key: string): string {\n const value = model[key]\n return typeof value === 'string' ? value : ''\n}\n\nfunction fieldOptionValuePolicy(model: OptionSourceModel): NonNullable<FieldOptions['value_policy']> {\n return model['options.value_policy_open'] === true ? 'open' : 'closed'\n}\n\nfunction relationFieldOptions(model: OptionSourceModel, options: DesignerServiceOption[]): DesignerServiceOption[] {\n return includeCurrentOption(\n includeCurrentOption(\n includeCurrentOption(\n includeCurrentOption(options, stringModelValue(model, 'reference.value_field')),\n stringModelValue(model, 'reference.label_field'),\n ),\n stringModelValue(model, 'options.reference.search_field'),\n ),\n stringModelValue(model, 'options.reference.parent_field'),\n )\n}\n\nfunction cloneStaticOptions(options: OptionItem[]): OptionItem[] {\n return options.map((option, index) => ({\n label: typeof option.label === 'string' ? option.label : `选项${index + 1}`,\n value: normalizeOptionValue(option.value, index + 1),\n }))\n}\n\nfunction normalizeStaticOptions(options: OptionItem[], fieldType: string | undefined): OptionItem[] {\n return options\n .map((option, index) => {\n const label = typeof option.label === 'string' ? option.label.trim() : ''\n const value = normalizeOptionValueForField(option.value, index + 1, fieldType)\n return {\n label: label || String(value),\n value,\n }\n })\n .filter((option) => option.label !== '' && option.value !== '')\n}\n\nfunction createOption(index: number): OptionItem {\n return {\n label: `选项${index}`,\n value: `option_${index}`,\n }\n}\n\nfunction updateStaticOption(\n options: OptionItem[],\n index: number,\n patch: Partial<StaticOptionItem> | Record<string, unknown>,\n update: (value: OptionItem[]) => void,\n): void {\n const next = cloneStaticOptions(options)\n const option = next[index]\n if (!option) {\n return\n }\n\n next[index] = {\n ...option,\n ...normalizeStaticOptionPatch(patch),\n }\n if (isSameOption(option, next[index])) {\n return\n }\n update(next)\n}\n\nfunction removeStaticOption(options: OptionItem[], index: number, update: (value: OptionItem[]) => void): void {\n const next = cloneStaticOptions(options)\n next.splice(index, 1)\n update(next)\n}\n\nfunction moveStaticOption(\n options: OptionItem[],\n index: number,\n offset: number,\n update: (value: OptionItem[]) => void,\n): void {\n const next = cloneStaticOptions(options)\n const target = index + offset\n if (target < 0 || target >= next.length) {\n return\n }\n\n const current = next[index]\n const targetItem = next[target]\n if (!current || !targetItem) {\n return\n }\n\n next[index] = targetItem\n next[target] = current\n update(next)\n}\n\nfunction normalizeOptionValue(value: unknown, index: number): OptionItem['value'] {\n if (typeof value === 'string') {\n return value.trim() || `option_${index}`\n }\n if (typeof value === 'number' || typeof value === 'boolean') {\n return value\n }\n\n return `option_${index}`\n}\n\nfunction normalizeOptionValueForField(\n value: unknown,\n index: number,\n fieldType: string | undefined,\n): OptionItem['value'] {\n const normalized = normalizeOptionValue(value, index)\n if (fieldType === 'number' && typeof normalized === 'string') {\n const numeric = Number(normalized)\n return normalized !== '' && Number.isFinite(numeric) ? numeric : normalized\n }\n if (fieldType === 'string' && typeof normalized !== 'string') {\n return String(normalized)\n }\n return normalized\n}\n\nfunction normalizeStaticOptionPatch(\n patch: Partial<StaticOptionItem> | Record<string, unknown>,\n): Partial<StaticOptionItem> {\n const next: Partial<StaticOptionItem> = {}\n if (typeof patch.label === 'string') {\n next.label = patch.label\n }\n if (typeof patch.value === 'string' || typeof patch.value === 'number' || typeof patch.value === 'boolean') {\n next.value = patch.value\n }\n\n return next\n}\n\nfunction normalizeLoadMode(value: unknown): NonNullable<NonNullable<FieldOptions['reference']>['load_mode']> {\n return value === 'tree' || value === 'all' ? value : 'paged'\n}\n\nfunction normalizePositiveNumber(value: unknown): number | undefined {\n const numeric = typeof value === 'number' ? value : Number(value)\n return Number.isFinite(numeric) && numeric > 0 ? numeric : undefined\n}\n\nfunction includeCurrentOption(options: DesignerServiceOption[], current: string | undefined): DesignerServiceOption[] {\n if (!current || options.some((option) => option.value === current)) {\n return options\n }\n\n return [\n ...options,\n {\n label: current,\n value: current,\n },\n ]\n}\n\nfunction isSameRecord(left: Record<string, unknown>, right: Record<string, unknown>): boolean {\n return JSON.stringify(left) === JSON.stringify(right)\n}\n\nfunction isRecord(value: unknown): value is NonNullable<FieldOptions['remote']> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nfunction isSameOption(left: OptionItem, right: OptionItem): boolean {\n return left.label === right.label && left.value === right.value\n}\n","import { computed, defineComponent, h, type PropType } from 'vue'\nimport type { ResourceField, ValueExpression } from '@sparqjs/schema-protocol'\nimport { createDesignerElementPlusSchemaUi } from '../shared/ui-adapter'\n\ntype SupportedExpressionType = 'field' | 'sum' | 'concat' | 'template'\n\nexport interface ComputedExpressionEditorValue {\n expression: ValueExpression\n triggers: string[]\n}\n\n/** 使用受限结构编辑字段计算,不执行任意脚本或字符串表达式。 */\nexport const ComputedExpressionEditor = defineComponent({\n name: 'ComputedExpressionEditor',\n props: {\n expression: Object as PropType<ValueExpression>,\n fields: Array as PropType<ResourceField[]>,\n targetField: Object as PropType<ResourceField>,\n onChange: Function as PropType<(value: ComputedExpressionEditorValue) => void>,\n },\n setup(props) {\n const ui = createDesignerElementPlusSchemaUi()\n const availableFields = computed(() =>\n (props.fields ?? []).filter((field) => field.name !== props.targetField?.name),\n )\n const currentType = computed(() => expressionType(props.expression))\n const supported = computed(() =>\n expressionTypeOptions(props.targetField).some((option) => option.value === props.expression?.type),\n )\n\n function changeType(value: unknown) {\n const type = value as SupportedExpressionType\n props.onChange?.(valueForType(type, availableFields.value, props.targetField))\n }\n\n function changeSingleField(value: unknown) {\n const field = typeof value === 'string' ? value : ''\n props.onChange?.({ expression: { type: 'field', field }, triggers: field ? [field] : [] })\n }\n\n function toggleField(field: string, checked: boolean) {\n const available = new Set(\n fieldsForExpression(currentType.value, availableFields.value).map((item) => item.name),\n )\n const selected = selectedFields(props.expression).filter((item) => available.has(item))\n const next = checked ? [...new Set([...selected, field])] : selected.filter((item) => item !== field)\n if (currentType.value === 'sum') {\n props.onChange?.({ expression: { type: 'sum', fields: next }, triggers: next })\n return\n }\n props.onChange?.({\n expression: {\n type: 'concat',\n items: next.map((name) => ({ type: 'field', field: name })),\n separator: props.expression?.separator ?? '',\n },\n triggers: next,\n })\n }\n\n function changeSeparator(value: unknown) {\n const selected = selectedFields(props.expression)\n props.onChange?.({\n expression: {\n type: 'concat',\n items: selected.map((field) => ({ type: 'field', field })),\n separator: typeof value === 'string' ? value : '',\n },\n triggers: selected,\n })\n }\n\n function changeTemplate(value: unknown) {\n const template = typeof value === 'string' ? value : ''\n props.onChange?.({\n expression: { type: 'template', template },\n triggers: templateFields(template, availableFields.value),\n })\n }\n\n return () => (\n <section class='sparq-computed-expression-editor' aria-label='计算表达式'>\n <label class='sparq-computed-expression-editor__field'>\n <span>计算方式</span>\n {ui.select(\n {\n value: currentType.value,\n class: 'sparq-computed-expression-editor__control',\n 'aria-label': '计算方式',\n onChange: changeType,\n },\n {\n default: () => [\n supported.value\n ? undefined\n : ui.option({\n label: `${currentType.value}(只读保留)`,\n value: currentType.value,\n disabled: true,\n }),\n ...expressionTypeOptions(props.targetField).map((option) => ui.option(option)),\n ],\n },\n )}\n </label>\n\n {!supported.value ? (\n <p class='sparq-computed-expression-editor__notice' role='status'>\n 当前表达式暂不支持可视化编辑。选择新的计算方式后会替换原表达式。\n </p>\n ) : undefined}\n\n {currentType.value === 'field' && supported.value ? (\n <label class='sparq-computed-expression-editor__field'>\n <span>来源字段</span>\n {ui.select(\n {\n value: props.expression?.field ?? '',\n class: 'sparq-computed-expression-editor__control',\n clearable: true,\n placeholder: '请选择字段',\n 'aria-label': '来源字段',\n onChange: changeSingleField,\n },\n {\n default: () =>\n availableFields.value.map((field) =>\n ui.option({ label: field.label || field.name, value: field.name }),\n ),\n },\n )}\n </label>\n ) : undefined}\n\n {(currentType.value === 'sum' || currentType.value === 'concat') && supported.value ? (\n <fieldset class='sparq-computed-expression-editor__fields'>\n <legend>{currentType.value === 'sum' ? '参与求和的字段' : '参与拼接的字段'}</legend>\n {fieldsForExpression(currentType.value, availableFields.value).length > 0 ? (\n fieldsForExpression(currentType.value, availableFields.value).map((field) =>\n ui.checkbox(\n {\n modelValue: selectedFields(props.expression).includes(field.name),\n 'aria-label': field.label || field.name,\n 'onUpdate:modelValue': (checked: unknown) =>\n toggleField(field.name, checked === true),\n },\n { default: () => field.label || field.name },\n ),\n )\n ) : (\n <p class='sparq-computed-expression-editor__empty'>没有可用字段</p>\n )}\n </fieldset>\n ) : undefined}\n\n {currentType.value === 'concat' && supported.value ? (\n <label class='sparq-computed-expression-editor__field'>\n <span>分隔符</span>\n {ui.text({\n value: props.expression?.separator ?? '',\n class: 'sparq-computed-expression-editor__control',\n 'aria-label': '分隔符',\n onChange: changeSeparator,\n })}\n </label>\n ) : undefined}\n\n {currentType.value === 'template' && supported.value ? (\n <label class='sparq-computed-expression-editor__field'>\n <span>模板</span>\n {ui.textarea({\n rows: 3,\n value: props.expression?.template ?? '',\n class: 'sparq-computed-expression-editor__control',\n placeholder: '例如:${form.first_name} ${form.last_name}',\n 'aria-label': '计算模板',\n onChange: changeTemplate,\n })}\n </label>\n ) : undefined}\n </section>\n )\n },\n})\n\nexport function createInitialComputedExpression(\n fields: ResourceField[] | undefined,\n targetField: ResourceField | undefined,\n): ComputedExpressionEditorValue {\n const available = (fields ?? []).filter((field) => field.name !== targetField?.name)\n const type = targetField?.type === 'number' ? 'sum' : 'field'\n return valueForType(type, available, targetField)\n}\n\nfunction expressionType(expression: ValueExpression | undefined): string {\n return typeof expression?.type === 'string' ? expression.type : 'field'\n}\n\nfunction expressionTypeOptions(field: ResourceField | undefined) {\n if (field?.type === 'number') {\n return [\n { label: '引用字段', value: 'field' },\n { label: '字段求和', value: 'sum' },\n ] as const\n }\n return [\n { label: '引用字段', value: 'field' },\n { label: '文本拼接', value: 'concat' },\n { label: '模板', value: 'template' },\n ] as const\n}\n\nfunction valueForType(\n type: SupportedExpressionType,\n fields: ResourceField[],\n targetField: ResourceField | undefined,\n): ComputedExpressionEditorValue {\n if (type === 'sum') {\n const selected = fields\n .filter((field) => field.type === 'number')\n .slice(0, 2)\n .map((field) => field.name)\n return { expression: { type, fields: selected }, triggers: selected }\n }\n if (type === 'concat') {\n const selected = fields.slice(0, 2).map((field) => field.name)\n return {\n expression: { type, items: selected.map((field) => ({ type: 'field', field })), separator: '' },\n triggers: selected,\n }\n }\n if (type === 'template') {\n return { expression: { type, template: '' }, triggers: [] }\n }\n const field = fields.find((item) => item.type === targetField?.type)?.name ?? fields[0]?.name ?? ''\n return { expression: { type, field }, triggers: field ? [field] : [] }\n}\n\nfunction fieldsForExpression(type: string, fields: ResourceField[]): ResourceField[] {\n return type === 'sum' ? fields.filter((field) => field.type === 'number') : fields\n}\n\nfunction selectedFields(expression: ValueExpression | undefined): string[] {\n if (expression?.type === 'sum') {\n return expression.fields ?? []\n }\n if (expression?.type === 'concat') {\n return (expression.items ?? [])\n .filter((item) => item.type === 'field' && typeof item.field === 'string')\n .map((item) => item.field as string)\n }\n return expression?.type === 'field' && expression.field ? [expression.field] : []\n}\n\nfunction templateFields(template: string, fields: ResourceField[]): string[] {\n const available = new Set(fields.map((field) => field.name))\n return [\n ...new Set(\n [...template.matchAll(/\\$\\{form\\.([a-z][a-z0-9_]*)\\}/g)]\n .map((match) => match[1])\n .filter((field): field is string => Boolean(field && available.has(field))),\n ),\n ]\n}\n","import { computed, defineComponent, h, ref, watch, type PropType } from 'vue'\nimport { createSchemaRuntime } from '@sparqjs/schema-core'\nimport type {\n FieldValueExpression,\n ResourceField,\n SchemaResource,\n ValueExpression,\n ViewNode,\n} from '@sparqjs/schema-protocol'\nimport { SparqView } from '@sparqjs/schema-vue'\nimport { createDesignerElementPlusUiAdapter, createDesignerElementPlusUiKit } from '../shared/ui-adapter'\nimport type { DesignerValueStrategyMode } from './field-schema'\nimport {\n ComputedExpressionEditor,\n createInitialComputedExpression,\n type ComputedExpressionEditorValue,\n} from './computed-expression-editor'\n\ninterface ValueStrategyEditorProps {\n node?: ViewNode\n field?: ResourceField\n fields?: ResourceField[]\n valueStrategies?: DesignerValueStrategyMode[]\n}\n\n/** 字段值来源模式,决定哪些 ResourceField 协议字段生效。 */\nexport type ValueStrategyMode = DesignerValueStrategyMode\ntype ValueStrategyModel = Record<string, unknown>\n\n/** 动态与计算能力编辑器一次读写的完整配置。 */\nexport interface ValueStrategyEditorValue {\n mode?: unknown\n default_expr?: FieldValueExpression\n computed_expr?: ValueExpression\n computed_triggers?: string[]\n persisted?: boolean\n}\n\nconst strategyModeOptions: Array<{ label: string; value: DesignerValueStrategyMode }> = [\n { label: '动态默认值', value: 'dynamic' },\n { label: '计算表达式', value: 'computed' },\n]\n\nconst expressionTypeOptions = [\n { label: '当前时间', value: 'now' },\n { label: '今天', value: 'today' },\n { label: '当天开始', value: 'start_of_day' },\n { label: '当天结束', value: 'end_of_day' },\n { label: '本月开始', value: 'start_of_month' },\n { label: '本月结束', value: 'end_of_month' },\n]\n\nconst expressionFormatOptions = [\n { label: '自动', value: '' },\n { label: '日期', value: 'date' },\n { label: '日期时间', value: 'datetime' },\n { label: '时间', value: 'time' },\n { label: '时间戳', value: 'timestamp' },\n]\n\n/** 编辑动态默认值和计算字段策略,并保持策略自身的协议字段一致。 */\nexport const ValueStrategyEditor = defineComponent({\n name: 'ValueStrategyEditor',\n props: {\n value: Object as PropType<ValueStrategyEditorValue>,\n onChange: Function as PropType<(value: ValueStrategyEditorValue) => void>,\n props: Object as PropType<ValueStrategyEditorProps>,\n },\n setup(props) {\n const open = ref(false)\n const model = ref<ValueStrategyModel>({})\n const runtime = createSchemaRuntime()\n const uiAdapter = createDesignerElementPlusUiAdapter()\n const uiKit = createDesignerElementPlusUiKit()\n const allowedModes = computed(\n () => props.props?.valueStrategies ?? strategyModeOptions.map((option) => option.value),\n )\n const editorValue = computed(() => normalizeEditorValue(props.value))\n const configured = computed(() => currentModeFromValue(editorValue.value) !== undefined)\n const summary = computed(() => summarizeValueStrategy(editorValue.value))\n const schema = computed(() => {\n const mode = currentMode(model.value) ?? allowedModes.value[0]\n return createValueStrategySchema(\n mode,\n strategyOptionsForProfile(allowedModes.value, mode),\n mode !== undefined && allowedModes.value.includes(mode),\n )\n })\n\n watch(\n () => props.value,\n (value) => {\n if (!open.value) {\n model.value = modelFromEditorValue(normalizeEditorValue(value))\n }\n },\n { immediate: true, deep: true },\n )\n\n function openDialog() {\n model.value = modelFromEditorValue(editorValue.value)\n if (!currentMode(model.value) && allowedModes.value[0]) {\n applyModeDefaults(model.value, allowedModes.value[0], props.props?.fields, props.props?.field)\n }\n open.value = true\n }\n\n function closeDialog() {\n open.value = false\n }\n\n function updateModel(values: Record<string, unknown>) {\n const previousMode = currentMode(model.value)\n const nextMode = currentMode(values)\n const next = { ...model.value, ...values }\n if (previousMode !== nextMode && nextMode) {\n applyModeDefaults(next, nextMode, props.props?.fields, props.props?.field)\n }\n if (isSameModel(model.value, next)) {\n return\n }\n model.value = next\n }\n\n function commit() {\n const mode = currentMode(model.value)\n if (!mode || !allowedModes.value.includes(mode)) {\n return\n }\n props.onChange?.(editorValueFromModel(model.value))\n closeDialog()\n }\n\n function clearValue() {\n props.onChange?.({})\n closeDialog()\n }\n\n function canCommit() {\n const mode = currentMode(model.value)\n return mode !== undefined && allowedModes.value.includes(mode)\n }\n\n function updateComputedExpression(value: ComputedExpressionEditorValue) {\n model.value = {\n ...model.value,\n computed_expr: value.expression,\n computed_triggers: value.triggers,\n }\n }\n\n return () => (\n <div class='sparq-capability-editor sparq-value-strategy-editor'>\n <div class='sparq-capability-editor__summary'>\n <span class='sparq-capability-editor__status' title={configured.value ? summary.value : undefined}>\n {configured.value ? '已设置' : '未设置'}\n </span>\n <div class='sparq-capability-editor__actions'>\n <button type='button' class='sparq-capability-editor__button' onClick={openDialog}>\n 配置\n </button>\n {configured.value ? (\n <button type='button' class='sparq-capability-editor__button' onClick={clearValue}>\n 清除\n </button>\n ) : undefined}\n </div>\n </div>\n\n {open.value ? (\n <div class='sparq-value-strategy-dialog' role='dialog' aria-modal='true'>\n <div class='sparq-value-strategy-dialog__mask' onClick={closeDialog}></div>\n <section class='sparq-value-strategy-dialog__panel'>\n <header class='sparq-value-strategy-dialog__header'>\n <div>\n <h3>动态与计算</h3>\n <p>配置动态默认值、计算表达式和落库方式</p>\n </div>\n <button type='button' onClick={closeDialog}>\n 关闭\n </button>\n </header>\n\n <div class='sparq-value-strategy-dialog__body'>\n <SparqView\n schema={schema.value}\n mode='form'\n view='default'\n modelValue={model.value}\n runtime={runtime}\n uiAdapter={uiAdapter}\n uiKit={uiKit}\n onUpdate:modelValue={updateModel}\n />\n {currentMode(model.value) === 'computed' && allowedModes.value.includes('computed') ? (\n <ComputedExpressionEditor\n expression={normalizeComputedExpression(model.value.computed_expr)}\n fields={props.props?.fields ?? []}\n targetField={props.props?.field}\n onChange={updateComputedExpression}\n />\n ) : undefined}\n </div>\n\n <footer class='sparq-value-strategy-dialog__footer'>\n <button type='button' onClick={closeDialog}>\n 取消\n </button>\n <button type='button' class='is-primary' disabled={!canCommit()} onClick={commit}>\n 确认\n </button>\n </footer>\n </section>\n </div>\n ) : undefined}\n </div>\n )\n },\n})\n\nfunction createValueStrategySchema(\n mode: ValueStrategyMode | undefined,\n modeOptions: Array<{ label: string; value: string; disabled?: boolean }>,\n modeSupported: boolean,\n): SchemaResource {\n const fields: ResourceField[] = [\n createSelectField('mode', '取值方式', modeOptions),\n { name: 'persisted', label: '写入后端', type: 'boolean', formable: true },\n ]\n const children: ViewNode[] = [\n { type: 'field', field: 'mode', component: 'radio' },\n { type: 'field', field: 'persisted', component: 'switch', span: 12 },\n ]\n\n if (mode === 'dynamic' && modeSupported) {\n fields.push(\n createSelectField('default_expr.type', '表达式', expressionTypeOptions),\n createSelectField('default_expr.format', '输出格式', expressionFormatOptions),\n { name: 'default_expr.offset.years', label: '年偏移', type: 'number', formable: true },\n { name: 'default_expr.offset.months', label: '月偏移', type: 'number', formable: true },\n { name: 'default_expr.offset.weeks', label: '周偏移', type: 'number', formable: true },\n { name: 'default_expr.offset.days', label: '日偏移', type: 'number', formable: true },\n { name: 'default_expr.offset.hours', label: '时偏移', type: 'number', formable: true },\n { name: 'default_expr.offset.minutes', label: '分偏移', type: 'number', formable: true },\n )\n children.push(\n { type: 'field', field: 'default_expr.type', component: 'select', span: 12 },\n { type: 'field', field: 'default_expr.format', component: 'select', span: 12 },\n { type: 'field', field: 'default_expr.offset.years', component: 'number', span: 8 },\n { type: 'field', field: 'default_expr.offset.months', component: 'number', span: 8 },\n { type: 'field', field: 'default_expr.offset.weeks', component: 'number', span: 8 },\n { type: 'field', field: 'default_expr.offset.days', component: 'number', span: 8 },\n { type: 'field', field: 'default_expr.offset.hours', component: 'number', span: 8 },\n { type: 'field', field: 'default_expr.offset.minutes', component: 'number', span: 8 },\n )\n }\n\n return {\n schema: {\n version: '1.0',\n name: 'designer_value_strategy_editor',\n fields,\n views: {\n forms: {\n default: {\n footer: false,\n span: 24,\n gap: 10,\n children,\n },\n },\n },\n },\n }\n}\n\nfunction createSelectField(\n name: string,\n label: string,\n options: Array<{ label: string; value: string; disabled?: boolean }>,\n): ResourceField {\n return {\n name,\n label,\n type: 'string',\n formable: true,\n options: {\n mode: 'static',\n value_policy: 'closed',\n items: options,\n },\n }\n}\n\nfunction strategyOptionsForProfile(\n allowed: DesignerValueStrategyMode[],\n current: DesignerValueStrategyMode | undefined,\n): Array<{ label: string; value: string; disabled?: boolean }> {\n const options = strategyModeOptions.filter((option) => allowed.includes(option.value))\n if (!current || allowed.includes(current)) {\n return options\n }\n const label = strategyModeOptions.find((option) => option.value === current)?.label ?? current\n return [...options, { label: `${label}(当前组件不支持)`, value: current, disabled: true }]\n}\n\nfunction normalizeEditorValue(value: ValueStrategyEditorValue | undefined): ValueStrategyEditorValue {\n if (!value || typeof value !== 'object') {\n return { persisted: true }\n }\n if (value.mode === 'dynamic' && value.default_expr) {\n return { mode: 'dynamic', default_expr: value.default_expr, persisted: value.persisted !== false }\n }\n if (value.mode === 'computed' && value.computed_expr) {\n return {\n mode: 'computed',\n computed_expr: value.computed_expr,\n computed_triggers: value.computed_triggers ?? [],\n persisted: value.persisted !== false,\n }\n }\n return { persisted: value.persisted !== false }\n}\n\nfunction modelFromEditorValue(value: ValueStrategyEditorValue): ValueStrategyModel {\n const mode = currentModeFromValue(value)\n if (mode === 'dynamic') {\n return {\n mode,\n persisted: value.persisted !== false,\n 'default_expr.type': value.default_expr?.type ?? 'now',\n 'default_expr.format': value.default_expr?.format ?? '',\n 'default_expr.offset.years': value.default_expr?.offset?.years,\n 'default_expr.offset.months': value.default_expr?.offset?.months,\n 'default_expr.offset.weeks': value.default_expr?.offset?.weeks,\n 'default_expr.offset.days': value.default_expr?.offset?.days,\n 'default_expr.offset.hours': value.default_expr?.offset?.hours,\n 'default_expr.offset.minutes': value.default_expr?.offset?.minutes,\n }\n }\n if (mode === 'computed') {\n return {\n mode,\n persisted: value.persisted !== false,\n computed_expr: value.computed_expr ?? { type: 'literal', value: null },\n computed_triggers: value.computed_triggers ?? [],\n }\n }\n\n return { persisted: value.persisted !== false }\n}\n\nfunction editorValueFromModel(model: ValueStrategyModel): ValueStrategyEditorValue {\n const base = { persisted: model.persisted !== false }\n if (currentMode(model) === 'dynamic') {\n return { ...base, mode: 'dynamic', default_expr: normalizeDefaultExpression(model) }\n }\n if (currentMode(model) === 'computed') {\n return {\n ...base,\n mode: 'computed',\n computed_expr: normalizeComputedExpression(model.computed_expr),\n computed_triggers: normalizeComputedTriggers(model.computed_triggers),\n }\n }\n return base\n}\n\nfunction normalizeDefaultExpression(model: ValueStrategyModel): FieldValueExpression {\n const expression: FieldValueExpression = {\n type: normalizeDefaultExpressionType(model['default_expr.type']),\n }\n const format = stringValue(model['default_expr.format'])\n const offset = normalizeOffset(model)\n if (format) {\n expression.format = format\n }\n if (Object.keys(offset).length > 0) {\n expression.offset = offset\n }\n return expression\n}\n\nfunction normalizeComputedExpression(value: unknown): ValueExpression {\n if (isValueExpression(value)) {\n return value\n }\n return { type: 'literal', value: null }\n}\n\nfunction isValueExpression(value: unknown): value is ValueExpression {\n return (\n typeof value === 'object' &&\n value !== null &&\n !Array.isArray(value) &&\n typeof (value as { type?: unknown }).type === 'string'\n )\n}\n\nfunction normalizeDefaultExpressionType(value: unknown): string {\n const text = stringValue(value)\n return expressionTypeOptions.some((option) => option.value === text) ? text : 'now'\n}\n\nfunction normalizeOffset(model: ValueStrategyModel): NonNullable<FieldValueExpression['offset']> {\n return {\n ...integerOffset('years', model['default_expr.offset.years']),\n ...integerOffset('months', model['default_expr.offset.months']),\n ...integerOffset('weeks', model['default_expr.offset.weeks']),\n ...integerOffset('days', model['default_expr.offset.days']),\n ...integerOffset('hours', model['default_expr.offset.hours']),\n ...integerOffset('minutes', model['default_expr.offset.minutes']),\n }\n}\n\nfunction integerOffset(\n key: keyof NonNullable<FieldValueExpression['offset']>,\n value: unknown,\n): Partial<NonNullable<FieldValueExpression['offset']>> {\n const numeric = typeof value === 'number' ? value : Number(value)\n return Number.isFinite(numeric) && numeric !== 0 ? { [key]: Math.trunc(numeric) } : {}\n}\n\nfunction normalizeComputedTriggers(value: unknown): string[] {\n if (Array.isArray(value)) {\n return value.filter((item): item is string => typeof item === 'string' && item !== '')\n }\n if (typeof value !== 'string') {\n return []\n }\n return value\n .split(',')\n .map((item) => item.trim())\n .filter(Boolean)\n}\n\nfunction applyModeDefaults(\n model: ValueStrategyModel,\n mode: ValueStrategyMode,\n fields: ResourceField[] | undefined,\n targetField: ResourceField | undefined,\n): void {\n model.mode = mode\n if (mode === 'dynamic') {\n model['default_expr.type'] ||= 'now'\n model['default_expr.format'] ??= ''\n }\n if (mode === 'computed') {\n const initial = createInitialComputedExpression(fields, targetField)\n model.computed_expr ||= initial.expression\n model.computed_triggers ??= initial.triggers\n }\n model.persisted ??= true\n}\n\nfunction currentMode(model: ValueStrategyModel): ValueStrategyMode | undefined {\n return model.mode === 'dynamic' || model.mode === 'computed' ? model.mode : undefined\n}\n\nfunction currentModeFromValue(value: ValueStrategyEditorValue): ValueStrategyMode | undefined {\n return value.mode === 'dynamic' || value.mode === 'computed' ? value.mode : undefined\n}\n\nfunction summarizeValueStrategy(value: ValueStrategyEditorValue): string {\n const persistedText = value.persisted === false ? '不落库' : '落库'\n if (value.mode === 'computed') {\n return `计算值 / ${persistedText}`\n }\n if (value.mode === 'dynamic') {\n return `动态默认值:${summarizeDefaultExpression(value.default_expr)} / ${persistedText}`\n }\n return '未配置'\n}\n\nfunction summarizeDefaultExpression(expression: FieldValueExpression | undefined): string {\n const type =\n expressionTypeOptions.find((option) => option.value === expression?.type)?.label ??\n expression?.type ??\n '当前时间'\n const format = expression?.format\n ? (expressionFormatOptions.find((option) => option.value === expression.format)?.label ?? expression.format)\n : ''\n return format ? `${type} / ${format}` : type\n}\n\nfunction stringValue(value: unknown): string {\n return typeof value === 'string' ? value : ''\n}\n\nfunction isSameModel(left: ValueStrategyModel, right: ValueStrategyModel): boolean {\n return JSON.stringify(left) === JSON.stringify(right)\n}\n","import { defineComponent, h, type PropType } from 'vue'\nimport type { ResourceField } from '@sparqjs/schema-protocol'\nimport type { SchemaUiProxy } from '@sparqjs/schema-vue'\nimport { createDesignerElementPlusSchemaUi } from '../shared/ui-adapter'\nimport {\n applyConditionEditorValues,\n conditionOperatorOptions,\n createConditionEditorValues,\n createConditionFieldOptions,\n createEmptyGroup,\n createEmptyRule,\n type ConditionEditorGroupValues,\n type ConditionEditorItemValues,\n type ConditionEditorRuleValues,\n type ConditionEditorValues,\n} from './condition-editor-model'\n\nconst MAX_CONDITION_GROUP_DEPTH = 1\n\n/** 编辑单条或嵌套条件组,并在无法可视化的协议结构上保留 JSON 模式。 */\nexport const ConditionVisualEditor = defineComponent({\n name: 'ConditionVisualEditor',\n props: {\n values: {\n type: Object as PropType<ConditionEditorValues>,\n required: true,\n },\n fields: {\n type: Array as PropType<ResourceField[]>,\n default: () => [],\n },\n onChange: Function as PropType<(values: ConditionEditorValues) => void>,\n },\n setup(props) {\n const ui = createDesignerElementPlusSchemaUi()\n\n const updateEditor = (values: Partial<ConditionEditorValues>) => {\n props.onChange?.({\n ...props.values,\n ...values,\n })\n }\n const updateRoot = (root: ConditionEditorGroupValues) => {\n updateEditor({ root })\n }\n const updateGroup = (path: number[], values: Partial<ConditionEditorGroupValues>) => {\n updateRoot(\n updateConditionGroup(props.values.root, path, (group) => ({\n ...group,\n ...values,\n })),\n )\n }\n const updateRule = (path: number[], values: Partial<ConditionEditorRuleValues>) => {\n updateRoot(updateConditionRule(props.values.root, path, values))\n }\n const addRule = (groupPath: number[]) => {\n updateRoot(appendConditionItem(props.values.root, groupPath, createEmptyRule()))\n }\n const addGroup = (groupPath: number[]) => {\n updateRoot(appendConditionItem(props.values.root, groupPath, createEmptyGroup()))\n }\n const removeItem = (path: number[]) => {\n updateRoot(removeConditionItem(props.values.root, path))\n }\n\n return () => (\n <div class='sparq-designer-condition-editor'>\n {props.values.mode === 'json' ? (\n renderConditionJsonEditor(ui, props.values, updateEditor)\n ) : (\n <div class='sparq-designer-condition-visual'>\n <div class='sparq-designer-condition-visual__toolbar'>\n {renderButton(\n ui,\n '高级 JSON',\n () =>\n updateEditor({\n mode: 'json',\n json: JSON.stringify(applyConditionEditorValues(props.values), undefined, 2),\n }),\n { size: 'small' },\n )}\n </div>\n {renderConditionGroup(\n ui,\n props.values.root,\n props.fields,\n [],\n 0,\n updateGroup,\n updateRule,\n addRule,\n addGroup,\n removeItem,\n )}\n </div>\n )}\n </div>\n )\n },\n})\n\nfunction renderConditionJsonEditor(\n ui: SchemaUiProxy,\n values: ConditionEditorValues,\n onUpdate: (values: Partial<ConditionEditorValues>) => void,\n) {\n return ui.form(\n {\n labelPosition: 'left',\n labelWidth: '76px',\n size: 'small',\n showMessage: false,\n class: 'sparq-designer-condition-editor-form',\n },\n {\n default: () => [\n renderConditionFormItem(\n ui,\n '条件 JSON',\n ui.textarea({\n value: values.json,\n rows: 12,\n placeholder: '{\"all\":[{\"field\":\"form.status\",\"op\":\"eq\",\"value\":\"published\"}]}',\n onChange: (json: string) => onUpdate({ json }),\n }),\n ),\n renderConditionFormItem(\n ui,\n '',\n renderButton(\n ui,\n '转为可视化',\n () => onUpdate(createConditionEditorValues(applyConditionEditorValues(values))),\n { size: 'small' },\n ),\n ),\n ],\n },\n )\n}\n\nfunction renderConditionGroup(\n ui: SchemaUiProxy,\n group: ConditionEditorGroupValues,\n fields: ResourceField[],\n path: number[],\n depth: number,\n onUpdateGroup: (path: number[], values: Partial<ConditionEditorGroupValues>) => void,\n onUpdateRule: (path: number[], values: Partial<ConditionEditorRuleValues>) => void,\n onAddRule: (groupPath: number[]) => void,\n onAddGroup: (groupPath: number[]) => void,\n onRemoveItem: (path: number[]) => void,\n) {\n const isRoot = path.length === 0\n\n return (\n <div class={['sparq-designer-condition-group', isRoot ? 'is-root' : undefined]} key={path.join('-') || 'root'}>\n <div class='sparq-designer-condition-group__head'>\n <strong>{isRoot ? '根条件组' : '子条件组'}</strong>\n <div class='sparq-designer-condition-group__logic'>\n {renderSelect(\n ui,\n group.logic,\n [\n { label: 'AND 全部满足', value: 'all' },\n { label: 'OR 任一满足', value: 'any' },\n ],\n (logic) => onUpdateGroup(path, { logic: logic === 'any' ? 'any' : 'all' }),\n { size: 'small' },\n )}\n </div>\n {!isRoot ? renderButton(ui, '删除', () => onRemoveItem(path), { size: 'small' }) : undefined}\n </div>\n <div class='sparq-designer-condition-group__items'>\n {group.items.map((item, index) => {\n const itemPath = [...path, index]\n return item.kind === 'group'\n ? renderConditionGroup(\n ui,\n item,\n fields,\n itemPath,\n depth + 1,\n onUpdateGroup,\n onUpdateRule,\n onAddRule,\n onAddGroup,\n onRemoveItem,\n )\n : renderConditionRule(ui, item, fields, itemPath, onUpdateRule, onRemoveItem)\n })}\n </div>\n <div class='sparq-designer-condition-group__actions'>\n {renderButton(ui, '添加条件', () => onAddRule(path), { type: 'primary', size: 'small' })}\n {depth < MAX_CONDITION_GROUP_DEPTH\n ? renderButton(ui, '添加分组', () => onAddGroup(path), { size: 'small' })\n : undefined}\n </div>\n </div>\n )\n}\n\nfunction renderConditionRule(\n ui: SchemaUiProxy,\n rule: ConditionEditorRuleValues,\n fields: ResourceField[],\n path: number[],\n onUpdateRule: (path: number[], values: Partial<ConditionEditorRuleValues>) => void,\n onRemoveItem: (path: number[]) => void,\n) {\n const fieldOptions = createConditionFieldOptions(fields, rule.field)\n\n return (\n <div class='sparq-designer-condition-rule' key={path.join('-')}>\n {renderSelect(ui, rule.field, fieldOptions, (field) => onUpdateRule(path, { field }), {\n placeholder: '选择字段',\n filterable: true,\n size: 'small',\n })}\n {renderSelect(\n ui,\n rule.op,\n conditionOperatorOptions,\n (op) => onUpdateRule(path, { op: op as ConditionEditorRuleValues['op'] }),\n { placeholder: '操作符', size: 'small' },\n )}\n {rule.op !== 'empty' && rule.op !== 'not_empty' ? (\n ui.text({\n value: rule.value,\n placeholder: createConditionValuePlaceholder(rule),\n class: 'sparq-designer-condition-rule__value',\n size: 'small',\n onChange: (value: string) => onUpdateRule(path, { value }),\n })\n ) : (\n <div class='sparq-designer-condition-rule__value-placeholder'>无需比较值</div>\n )}\n {renderButton(ui, '删除', () => onRemoveItem(path), { size: 'small' })}\n </div>\n )\n}\n\nfunction createConditionValuePlaceholder(rule: ConditionEditorRuleValues): string {\n if (rule.op === 'in' || rule.op === 'not_in') {\n return '多个值用 JSON 数组,如 [\"draft\",\"pending\"]'\n }\n if (rule.op === 'contains') {\n return '包含的内容,如 \"keyword\"'\n }\n\n return '比较值,如 \"published\" / true / 100'\n}\n\nfunction renderConditionFormItem(ui: SchemaUiProxy, label: string, content: ReturnType<SchemaUiProxy['render']>) {\n return ui.formItem(\n {\n label,\n },\n {\n default: () => content,\n },\n )\n}\n\nfunction renderSelect(\n ui: SchemaUiProxy,\n value: string,\n options: Array<{ label: string; value: string }>,\n onChange: (value: string) => void,\n props: Record<string, unknown> = {},\n) {\n return ui.select(\n {\n ...props,\n value,\n onChange,\n },\n {\n default: () => options.map((option) => ui.option(option)),\n },\n )\n}\n\nfunction renderButton(ui: SchemaUiProxy, label: string, onClick: () => void, props: Record<string, unknown> = {}) {\n return ui.button(\n {\n ...props,\n onClick,\n },\n {\n default: () => label,\n },\n )\n}\n\nfunction updateConditionGroup(\n root: ConditionEditorGroupValues,\n path: number[],\n updater: (group: ConditionEditorGroupValues) => ConditionEditorGroupValues,\n): ConditionEditorGroupValues {\n if (!path.length) {\n return updater(root)\n }\n\n const [index, ...rest] = path\n return {\n ...root,\n items: root.items.map((item, itemIndex) => {\n if (itemIndex !== index || item.kind !== 'group') {\n return item\n }\n\n return updateConditionGroup(item, rest, updater)\n }),\n }\n}\n\nfunction updateConditionRule(\n root: ConditionEditorGroupValues,\n path: number[],\n values: Partial<ConditionEditorRuleValues>,\n): ConditionEditorGroupValues {\n if (!path.length) {\n return root\n }\n\n const [index, ...rest] = path\n return {\n ...root,\n items: root.items.map((item, itemIndex) => {\n if (itemIndex !== index) {\n return item\n }\n if (!rest.length && item.kind === 'rule') {\n return {\n ...item,\n ...values,\n kind: 'rule',\n }\n }\n if (item.kind === 'group') {\n return updateConditionRule(item, rest, values)\n }\n\n return item\n }),\n }\n}\n\nfunction appendConditionItem(\n root: ConditionEditorGroupValues,\n groupPath: number[],\n item: ConditionEditorItemValues,\n): ConditionEditorGroupValues {\n return updateConditionGroup(root, groupPath, (group) => ({\n ...group,\n items: [...group.items, item],\n }))\n}\n\nfunction removeConditionItem(root: ConditionEditorGroupValues, path: number[]): ConditionEditorGroupValues {\n if (!path.length) {\n return root\n }\n\n const [index, ...rest] = path\n if (!rest.length) {\n const items = root.items.filter((_, itemIndex) => itemIndex !== index)\n return {\n ...root,\n items: items.length ? items : [createEmptyRule()],\n }\n }\n\n return {\n ...root,\n items: root.items.map((item, itemIndex) => {\n if (itemIndex !== index || item.kind !== 'group') {\n return item\n }\n\n return removeConditionItem(item, rest)\n }),\n }\n}\n\n/** 判断条件编辑器是否包含有效输入,用于空配置摘要和清除操作。 */\nexport function hasConditionEditorValue(values: ConditionEditorValues): boolean {\n if (values.mode === 'json') {\n return values.json.trim() !== ''\n }\n\n return hasConditionGroupValue(values.root)\n}\n\nfunction hasConditionGroupValue(group: ConditionEditorGroupValues): boolean {\n return group.items.some((item) => {\n if (item.kind === 'group') {\n return hasConditionGroupValue(item)\n }\n\n return item.field.trim() !== ''\n })\n}\n","import { computed, defineComponent, h, ref, watch, type PropType } from 'vue'\nimport type { Condition, ResourceField, ViewNode } from '@sparqjs/schema-protocol'\nimport {\n applyConditionEditorValues,\n createConditionEditorValues,\n summarizeCondition,\n visibleConditionConfigs,\n type ConditionEditorValues,\n type DesignerConditionName,\n} from './condition-editor-model'\nimport { ConditionVisualEditor, hasConditionEditorValue } from './condition-visual-editor'\n\ninterface InteractionRulesEditorProps {\n node?: ViewNode\n fields?: ResourceField[]\n}\n\n/** 交互规则能力编辑器一次读写的三个节点条件。 */\nexport interface InteractionRulesValue {\n show_when?: Condition\n disabled_when?: Condition\n readonly_when?: Condition\n}\n\n/** 聚合 show_when、disabled_when 和 readonly_when,并作为一个能力值统一写回节点。 */\nexport const InteractionRulesEditor = defineComponent({\n name: 'InteractionRulesEditor',\n props: {\n value: Object as PropType<InteractionRulesValue>,\n onChange: Function as PropType<(value: InteractionRulesValue) => void>,\n props: Object as PropType<InteractionRulesEditorProps>,\n },\n setup(props) {\n const editing = ref<DesignerConditionName>()\n const editorValues = ref<ConditionEditorValues>(createConditionEditorValues(undefined))\n const value = computed(() => props.value ?? {})\n const configs = computed(() => (props.props?.node ? visibleConditionConfigs(props.props.node) : []))\n\n watch(\n () => props.value,\n () => {\n if (!editing.value) {\n editorValues.value = createConditionEditorValues(undefined)\n }\n },\n { deep: true },\n )\n\n function openEditor(name: DesignerConditionName) {\n editing.value = name\n editorValues.value = createConditionEditorValues(value.value[name])\n }\n\n function closeEditor() {\n editing.value = undefined\n editorValues.value = createConditionEditorValues(undefined)\n }\n\n function updateEditor(values: ConditionEditorValues) {\n editorValues.value = values\n }\n\n function saveEditor() {\n const name = editing.value\n if (!name) {\n return\n }\n props.onChange?.({\n ...value.value,\n [name]: hasConditionEditorValue(editorValues.value)\n ? applyConditionEditorValues(editorValues.value)\n : undefined,\n })\n closeEditor()\n }\n\n function clearCondition(name: DesignerConditionName) {\n props.onChange?.({\n ...value.value,\n [name]: undefined,\n })\n if (editing.value === name) {\n closeEditor()\n }\n }\n\n return () => {\n const editingConfig = configs.value.find((config) => config.name === editing.value)\n return (\n <div class='sparq-capability-editor sparq-interaction-rules-editor'>\n <div class='sparq-interaction-rules-editor__list'>\n {configs.value.map((config) => {\n const condition = value.value[config.name]\n const configured = Boolean(condition)\n\n return (\n <div\n class={['sparq-interaction-rule-row', configured ? 'is-configured' : undefined]}\n key={config.name}\n >\n <div class='sparq-interaction-rule-row__main'>\n <div class='sparq-interaction-rule-row__title'>\n <span>{config.title}</span>\n <strong>{configured ? '已设置' : '未设置'}</strong>\n </div>\n <p>{summarizeCondition(condition)}</p>\n </div>\n <div class='sparq-interaction-rule-row__actions'>\n <button\n type='button'\n class='sparq-capability-editor__button'\n onClick={() => openEditor(config.name)}\n >\n 设置\n </button>\n {configured ? (\n <button\n type='button'\n class='sparq-capability-editor__button'\n onClick={() => clearCondition(config.name)}\n >\n 清除\n </button>\n ) : undefined}\n </div>\n </div>\n )\n })}\n </div>\n\n {editingConfig ? (\n <div class='sparq-interaction-rules-dialog' role='dialog' aria-modal='true'>\n <div class='sparq-interaction-rules-dialog__mask' onClick={closeEditor}></div>\n <section class='sparq-interaction-rules-dialog__panel'>\n <header class='sparq-interaction-rules-dialog__header'>\n <div>\n <h3>{editingConfig.title}</h3>\n <p>{editingConfig.description}</p>\n </div>\n <button type='button' onClick={closeEditor}>\n 关闭\n </button>\n </header>\n\n <div class='sparq-interaction-rules-dialog__body'>\n <ConditionVisualEditor\n values={editorValues.value}\n fields={props.props?.fields ?? []}\n onChange={updateEditor}\n />\n </div>\n\n <footer class='sparq-interaction-rules-dialog__footer'>\n <button type='button' onClick={() => clearCondition(editingConfig.name)}>\n 清除\n </button>\n <button type='button' onClick={closeEditor}>\n 取消\n </button>\n <button type='button' class='is-primary' onClick={saveEditor}>\n 确认\n </button>\n </footer>\n </section>\n </div>\n ) : undefined}\n </div>\n )\n }\n },\n})\n","import { computed, defineComponent, h, ref, watch, type PropType } from 'vue'\nimport type { ResourceField, SchemaResource, ViewNode } from '@sparqjs/schema-protocol'\nimport { createSchemaRuntime } from '@sparqjs/schema-core'\nimport { SparqView } from '@sparqjs/schema-vue'\nimport { cloneSerializable } from '../shared/clone'\nimport { createDesignerElementPlusUiAdapter, createDesignerElementPlusUiKit } from '../shared/ui-adapter'\nimport type { FieldPropertyField } from './field-schema'\n\ninterface CapabilitySummaryProps {\n summary?: {\n text?: string\n detail?: string\n }\n}\n\ninterface ComponentSettingsProps {\n settings?: FieldPropertyField[]\n dialogTitle?: string\n settingsKind?: 'upload' | 'rich-text'\n capability?: CapabilitySummaryProps\n}\n\ntype ComponentSettingsValue = Record<string, unknown>\n\n/** 根据能力卡字段 schema 打开组件复合配置弹层,并在确认后一次提交完整值。 */\nexport const ComponentSettingsEditor = defineComponent({\n name: 'ComponentSettingsEditor',\n props: {\n value: Object as PropType<ComponentSettingsValue>,\n onChange: Function as PropType<(value: ComponentSettingsValue) => void>,\n props: Object as PropType<ComponentSettingsProps>,\n },\n setup(props) {\n const open = ref(false)\n const model = ref<ComponentSettingsValue>({})\n const runtime = createSchemaRuntime()\n const uiAdapter = createDesignerElementPlusUiAdapter()\n const uiKit = createDesignerElementPlusUiKit()\n const settings = computed(() => props.props?.settings ?? [])\n const schema = computed(() => createComponentSettingsSchema(settings.value))\n const summary = computed(() => summarizeSettings(props.value, props.props))\n\n watch(\n () => props.value,\n (value) => {\n if (!open.value) {\n model.value = cloneSettingsValue(value)\n }\n },\n { immediate: true, deep: true },\n )\n\n function openDialog() {\n model.value = cloneSettingsValue(props.value)\n open.value = true\n }\n\n function closeDialog() {\n open.value = false\n }\n\n function updateModel(values: Record<string, unknown>) {\n const next = {\n ...model.value,\n ...cloneSerializable(values),\n }\n if (isSameSettingsValue(model.value, next)) {\n return\n }\n model.value = next\n }\n\n function commit() {\n props.onChange?.(cloneSerializable(model.value))\n closeDialog()\n }\n\n return () => (\n <div class='sparq-capability-editor sparq-component-settings-editor'>\n <div class='sparq-capability-editor__summary'>\n <span>{summary.value}</span>\n <div class='sparq-capability-editor__actions'>\n <button type='button' class='sparq-capability-editor__button' onClick={openDialog}>\n 配置\n </button>\n </div>\n </div>\n\n {open.value ? (\n <div\n class='sparq-value-strategy-dialog sparq-component-settings-dialog'\n role='dialog'\n aria-modal='true'\n >\n <div class='sparq-value-strategy-dialog__mask' onClick={closeDialog}></div>\n <section class='sparq-value-strategy-dialog__panel'>\n <header class='sparq-value-strategy-dialog__header'>\n <h3>{props.props?.dialogTitle ?? '组件配置'}</h3>\n <button type='button' onClick={closeDialog}>\n 关闭\n </button>\n </header>\n\n <div class='sparq-value-strategy-dialog__body'>\n <SparqView\n schema={schema.value}\n mode='form'\n view='default'\n modelValue={model.value}\n runtime={runtime}\n uiAdapter={uiAdapter}\n uiKit={uiKit}\n onUpdate:modelValue={updateModel}\n />\n </div>\n\n <footer class='sparq-value-strategy-dialog__footer'>\n <button type='button' onClick={closeDialog}>\n 取消\n </button>\n <button type='button' class='is-primary' onClick={commit}>\n 确认\n </button>\n </footer>\n </section>\n </div>\n ) : undefined}\n </div>\n )\n },\n})\n\n/** 展示高级配置是否存在,不在主属性面板直接展开扩展 JSON。 */\nexport const AdvancedConfigStatus = defineComponent({\n name: 'AdvancedConfigStatus',\n props: {\n props: Object as PropType<{ capability?: CapabilitySummaryProps }>,\n },\n setup(props) {\n return () => (\n <div class='sparq-capability-editor'>\n <div class='sparq-capability-editor__summary'>\n <span title={props.props?.capability?.summary?.detail}>\n {props.props?.capability?.summary?.text ?? '已保留'}\n </span>\n <span class='sparq-capability-editor__readonly'>只读</span>\n </div>\n </div>\n )\n },\n})\n\nfunction createComponentSettingsSchema(settings: FieldPropertyField[]): SchemaResource {\n return {\n schema: {\n version: '1.0',\n name: 'designer_component_settings',\n fields: settings.map(createSettingResourceField),\n views: {\n forms: {\n default: {\n footer: false,\n span: 24,\n gap: 12,\n props: {\n labelPosition: 'top',\n size: 'default',\n showMessage: false,\n },\n children: settings.map(createSettingNode),\n },\n },\n },\n },\n }\n}\n\nfunction createSettingResourceField(setting: FieldPropertyField): ResourceField {\n return {\n name: componentSettingPath(setting),\n label: setting.label,\n type:\n setting.kind === 'number'\n ? 'number'\n : setting.kind === 'switch' || setting.kind === 'checkbox'\n ? 'boolean'\n : 'string',\n formable: true,\n options:\n setting.kind === 'select'\n ? {\n mode: 'static',\n value_policy: 'closed',\n items: setting.options,\n }\n : undefined,\n }\n}\n\nfunction createSettingNode(setting: FieldPropertyField): ViewNode {\n return {\n type: 'field',\n field: componentSettingPath(setting),\n tip: setting.tip,\n component: setting.component ?? componentForSetting(setting),\n span: setting.kind === 'switch' || setting.kind === 'checkbox' ? 12 : 24,\n props: {\n placeholder: setting.placeholder,\n min: setting.kind === 'number' ? setting.min : undefined,\n max: setting.kind === 'number' ? setting.max : undefined,\n step: setting.kind === 'number' ? setting.step : undefined,\n clearable: setting.kind === 'select' ? setting.clearable : undefined,\n },\n }\n}\n\n/** 组件设置弹层编辑的是 node.props 投影,临时字段名使用 props 内部相对路径。 */\nfunction componentSettingPath(setting: FieldPropertyField): string {\n if (setting.storage.target !== 'node' || !setting.storage.path.startsWith('props.')) {\n throw new Error(`组件设置属性 ${setting.key} 必须写入 node.props`)\n }\n return setting.storage.path.slice('props.'.length)\n}\n\nfunction componentForSetting(setting: FieldPropertyField): string {\n switch (setting.kind) {\n case 'number':\n return 'number'\n case 'switch':\n case 'checkbox':\n return 'switch'\n case 'select':\n return 'select'\n case 'textarea':\n return 'textarea'\n default:\n return 'text'\n }\n}\n\nfunction summarizeSettings(\n value: ComponentSettingsValue | undefined,\n props: ComponentSettingsProps | undefined,\n): string {\n if (props?.settingsKind === 'upload') {\n const details = [value?.valueMode === 'id' ? '资源 ID' : value?.valueMode === 'asset' ? '资源对象' : 'URL']\n if (typeof value?.limit === 'number' && value.limit > 0) {\n details.push(`最多 ${value.limit} 个`)\n }\n if (value?.multiple === true) {\n details.push('允许多选')\n }\n return details.join(' / ')\n }\n if (props?.settingsKind === 'rich-text') {\n const editorLabels: Record<string, string> = {\n tinymce: 'TinyMCE',\n wang: 'WangEditor',\n markdown: 'Markdown',\n editorjs: 'Editor.js',\n fallback: 'Fallback',\n }\n const editor = typeof value?.editor === 'string' ? (editorLabels[value.editor] ?? value.editor) : '默认编辑器'\n return editor\n }\n return props?.capability?.summary?.text ?? '默认配置'\n}\n\nfunction cloneSettingsValue(value: ComponentSettingsValue | undefined): ComponentSettingsValue {\n return value ? cloneSerializable(value) : {}\n}\nfunction isSameSettingsValue(left: ComponentSettingsValue, right: ComponentSettingsValue): boolean {\n return JSON.stringify(left) === JSON.stringify(right)\n}\n","import { defineComponent, type PropType } from 'vue'\nimport { renderFieldLabelContent } from '@sparqjs/schema-ui-element-plus'\nimport { createDesignerElementPlusSchemaUi } from '../shared/ui-adapter'\n\ninterface BooleanCheckboxProps {\n inlineBooleanLabel?: string\n inlineBooleanTip?: string\n inlineBooleanTipId?: string\n}\n\n/** Inspector 使用的布尔控件,保持 false 与未设置值的写回语义明确。 */\nexport const BooleanCheckbox = defineComponent({\n name: 'BooleanCheckbox',\n props: {\n value: Boolean,\n disabled: Boolean,\n readonly: Boolean,\n onChange: Function as PropType<(value: boolean) => void>,\n props: Object as PropType<BooleanCheckboxProps>,\n },\n setup(props) {\n const ui = createDesignerElementPlusSchemaUi()\n\n function updateValue(value: unknown) {\n if (props.disabled || props.readonly) {\n return\n }\n\n props.onChange?.(value === true)\n }\n\n return () =>\n ui.checkbox(\n {\n class: [\n 'sparq-designer-property-checkbox',\n props.disabled || props.readonly ? 'is-disabled' : undefined,\n ],\n modelValue: props.value === true,\n disabled: props.disabled || props.readonly,\n 'onUpdate:modelValue': updateValue,\n },\n {\n default: () =>\n renderFieldLabelContent(\n props.props?.inlineBooleanLabel,\n props.props?.inlineBooleanTip,\n props.props?.inlineBooleanTipId,\n ),\n },\n )\n },\n})\n","import { computed, defineComponent, h, ref, watch, type PropType } from 'vue'\nimport { createSchemaRuntime } from '@sparqjs/schema-core'\nimport type { ResourceField, SchemaResource, ViewNode, ViewNodeSlots } from '@sparqjs/schema-protocol'\nimport { SparqView } from '@sparqjs/schema-vue'\nimport { createDesignerElementPlusUiAdapter, createDesignerElementPlusUiKit } from '../shared/ui-adapter'\n\ntype SlotName = 'prefix' | 'suffix' | 'prepend' | 'append'\ntype SlotType = 'none' | 'text' | 'icon'\ntype SlotEditorModel = Record<string, unknown>\n\nconst slotDefinitions: Array<{ name: SlotName; label: string }> = [\n { name: 'prefix', label: '内部前缀' },\n { name: 'suffix', label: '内部后缀' },\n { name: 'prepend', label: '外部前置' },\n { name: 'append', label: '外部后置' },\n]\n\n/** 编辑输入框四个稳定静态插槽,输出正式 ViewNode.slots 协议。 */\nexport const InputSlotsEditor = defineComponent({\n name: 'InputSlotsEditor',\n props: {\n value: Object as PropType<ViewNodeSlots>,\n onChange: Function as PropType<(value: ViewNodeSlots) => void>,\n },\n setup(props) {\n const open = ref(false)\n const model = ref<SlotEditorModel>({})\n const runtime = createSchemaRuntime()\n const uiAdapter = createDesignerElementPlusUiAdapter()\n const uiKit = createDesignerElementPlusUiKit()\n const schema = createInputSlotsSchema()\n const summary = computed(() => {\n const count = slotDefinitions.filter(({ name }) => props.value?.[name]).length\n return count ? `${count} 个插槽` : '未配置'\n })\n\n watch(\n () => props.value,\n (value) => {\n if (!open.value) {\n model.value = modelFromSlots(value)\n }\n },\n { immediate: true, deep: true },\n )\n\n function openDialog() {\n model.value = modelFromSlots(props.value)\n open.value = true\n }\n\n function closeDialog() {\n open.value = false\n }\n\n function commit() {\n props.onChange?.(slotsFromModel(model.value))\n closeDialog()\n }\n\n function clear() {\n props.onChange?.({})\n closeDialog()\n }\n\n return () => (\n <div class='sparq-capability-editor sparq-input-slots-editor'>\n <div class='sparq-capability-editor__summary'>\n <span>{summary.value}</span>\n <div class='sparq-capability-editor__actions'>\n <button type='button' class='sparq-capability-editor__button' onClick={openDialog}>\n 配置\n </button>\n </div>\n </div>\n\n {open.value ? (\n <div class='sparq-value-strategy-dialog' role='dialog' aria-modal='true'>\n <div class='sparq-value-strategy-dialog__mask' onClick={closeDialog}></div>\n <section class='sparq-value-strategy-dialog__panel'>\n <header class='sparq-value-strategy-dialog__header'>\n <div>\n <h3>输入插槽</h3>\n <p>配置静态文本或图标</p>\n </div>\n <button type='button' onClick={closeDialog}>\n 关闭\n </button>\n </header>\n <div class='sparq-value-strategy-dialog__body'>\n <SparqView\n schema={schema}\n mode='form'\n view='default'\n modelValue={model.value}\n runtime={runtime}\n uiAdapter={uiAdapter}\n uiKit={uiKit}\n onUpdate:modelValue={(value) => {\n model.value = value\n }}\n />\n </div>\n <footer class='sparq-value-strategy-dialog__footer'>\n <button type='button' onClick={clear}>\n 清除\n </button>\n <button type='button' onClick={closeDialog}>\n 取消\n </button>\n <button type='button' class='is-primary' onClick={commit}>\n 确认\n </button>\n </footer>\n </section>\n </div>\n ) : undefined}\n </div>\n )\n },\n})\n\nfunction createInputSlotsSchema(): SchemaResource {\n const fields: ResourceField[] = []\n const children: ViewNode[] = []\n const typeOptions = [\n { label: '无', value: 'none' },\n { label: '文本', value: 'text' },\n { label: '图标', value: 'icon' },\n ]\n\n for (const slot of slotDefinitions) {\n fields.push(\n {\n name: `${slot.name}.type`,\n label: slot.label,\n type: 'string',\n formable: true,\n options: { mode: 'static', value_policy: 'closed', items: typeOptions },\n },\n {\n name: `${slot.name}.value`,\n label: '内容',\n type: 'string',\n formable: true,\n },\n )\n children.push(\n { type: 'field', field: `${slot.name}.type`, component: 'select', span: 10 },\n {\n type: 'field',\n field: `${slot.name}.value`,\n component: 'text',\n span: 14,\n props: { placeholder: '文本内容或图标 key' },\n show_when: { field: `${slot.name}.type`, op: 'neq', value: 'none' },\n },\n )\n }\n\n return {\n schema: {\n version: '1.0',\n name: 'designer_input_slots_editor',\n fields,\n views: { forms: { default: { footer: false, span: 24, gap: 8, children } } },\n },\n }\n}\n\nfunction modelFromSlots(slots: ViewNodeSlots | undefined): SlotEditorModel {\n const model: SlotEditorModel = {}\n for (const { name } of slotDefinitions) {\n const content = slots?.[name]\n model[`${name}.type`] = content?.type ?? 'none'\n model[`${name}.value`] = content?.type === 'text' ? content.text : content?.type === 'icon' ? content.icon : ''\n }\n return model\n}\n\nfunction slotsFromModel(model: SlotEditorModel): ViewNodeSlots {\n const slots: ViewNodeSlots = {}\n for (const { name } of slotDefinitions) {\n const type = slotType(model[`${name}.type`])\n const rawValue = model[`${name}.value`]\n const value = typeof rawValue === 'string' ? rawValue : ''\n if (type === 'text' && value !== '') {\n slots[name] = { type, text: value }\n } else if (type === 'icon' && value !== '') {\n slots[name] = { type, icon: value }\n }\n }\n return slots\n}\n\nfunction slotType(value: unknown): SlotType {\n return value === 'text' || value === 'icon' ? value : 'none'\n}\n","import { computed, defineComponent, h, ref, watch, type PropType } from 'vue'\nimport { createDesignerElementPlusSchemaUi } from '../shared/ui-adapter'\n\nexport interface DateTimeFormatPreset {\n label: string\n value: string\n}\n\ninterface DateTimeFormatEditorProps {\n presets?: DateTimeFormatPreset[]\n defaultLabel?: string\n}\n\nconst customFormatValue = '__custom__'\n\n/** 日期时间格式的渐进式编辑器:常用格式直接选择,其他格式进入高级输入。 */\nexport const DateTimeFormatEditor = defineComponent({\n name: 'DateTimeFormatEditor',\n props: {\n value: String,\n disabled: Boolean,\n readonly: Boolean,\n onChange: Function as PropType<(value: string | undefined) => void>,\n onBlur: Function as PropType<() => void>,\n props: Object as PropType<DateTimeFormatEditorProps>,\n },\n setup(props) {\n const ui = createDesignerElementPlusSchemaUi()\n const customOpen = ref(false)\n const presets = computed(() => props.props?.presets ?? [])\n const selectedValue = computed(() => {\n if (customOpen.value) {\n return customFormatValue\n }\n if (!props.value) {\n return ''\n }\n return presets.value.some((preset) => preset.value === props.value) ? props.value : customFormatValue\n })\n\n watch(\n () => props.value,\n (value) => {\n if (value && !presets.value.some((preset) => preset.value === value)) {\n customOpen.value = true\n }\n },\n { immediate: true },\n )\n\n function selectFormat(value: unknown) {\n if (value === customFormatValue) {\n customOpen.value = true\n return\n }\n customOpen.value = false\n props.onChange?.(typeof value === 'string' && value ? value : undefined)\n }\n\n function updateCustomFormat(value: unknown) {\n props.onChange?.(typeof value === 'string' && value ? value : undefined)\n }\n\n return () => (\n <div class='sparq-date-time-format-editor'>\n {ui.select(\n {\n value: selectedValue.value,\n class: 'sparq-date-time-format-editor__control',\n disabled: props.disabled || props.readonly,\n clearable: true,\n placeholder: props.props?.defaultLabel ?? '选择格式',\n 'aria-label': '格式预设',\n onChange: selectFormat,\n onBlur: props.onBlur,\n },\n {\n default: () => [\n ...presets.value.map((preset) => ui.option({ label: preset.label, value: preset.value })),\n ui.option({ label: '高级自定义', value: customFormatValue }),\n ],\n },\n )}\n {customOpen.value\n ? ui.text({\n value: props.value ?? '',\n class: 'sparq-date-time-format-editor__control',\n disabled: props.disabled || props.readonly,\n 'aria-label': '自定义格式',\n placeholder: '例如 YYYY-MM-DD',\n onChange: updateCustomFormat,\n onBlur: props.onBlur,\n })\n : undefined}\n </div>\n )\n },\n})\n","import { matchesValidationFormat } from '@sparqjs/schema-core'\nimport { defineComponent, h, ref, watch, type PropType } from 'vue'\nimport { createDesignerElementPlusSchemaUi } from '../shared/ui-adapter'\n\n/** 使用 swatch 列表编辑颜色组件的预设值,确认后一次写回 capability。 */\nexport const ColorPaletteEditor = defineComponent({\n name: 'ColorPaletteEditor',\n props: {\n value: Array as PropType<string[]>,\n onChange: Function as PropType<(value: string[]) => void>,\n },\n setup(props) {\n const ui = createDesignerElementPlusSchemaUi()\n const open = ref(false)\n const draft = ref<string[]>([])\n const error = ref('')\n\n watch(\n () => props.value,\n (value) => {\n if (!open.value) {\n draft.value = [...(value ?? [])]\n }\n },\n { immediate: true, deep: true },\n )\n\n function openDialog() {\n draft.value = [...(props.value ?? [])]\n error.value = ''\n open.value = true\n }\n\n function commit() {\n const issue = validatePalette(draft.value)\n if (issue) {\n error.value = issue\n return\n }\n props.onChange?.([...draft.value])\n open.value = false\n }\n\n return () => (\n <div class='sparq-capability-editor sparq-color-palette-editor'>\n <div class='sparq-capability-editor__summary'>\n <div class='sparq-color-palette-editor__preview' aria-label='预设颜色预览'>\n {draftPreview(props.value ?? [])}\n </div>\n <div class='sparq-capability-editor__actions'>\n <button type='button' class='sparq-capability-editor__button' onClick={openDialog}>\n 配置\n </button>\n </div>\n </div>\n {open.value ? (\n <div class='sparq-validation-dialog' role='dialog' aria-modal='true'>\n <div class='sparq-validation-dialog__mask' onClick={() => (open.value = false)}></div>\n <section class='sparq-validation-dialog__panel sparq-color-palette-dialog'>\n <header class='sparq-validation-dialog__header'>\n <div>\n <h3>预设色板</h3>\n <p>颜色选择器中的快捷候选</p>\n </div>\n <button type='button' onClick={() => (open.value = false)}>\n 关闭\n </button>\n </header>\n <div class='sparq-validation-dialog__body'>\n <div class='sparq-color-palette-dialog__list'>\n {draft.value.map((color, index) => (\n <div class='sparq-color-palette-dialog__row' key={index}>\n {ui.colorPicker({\n class: 'sparq-color-palette-dialog__swatch',\n value: colorToNativeValue(color),\n 'aria-label': `选择第 ${index + 1} 个颜色`,\n onChange: (value: unknown) =>\n updateColor(index, typeof value === 'string' ? value : ''),\n })}\n {ui.text({\n class: 'sparq-color-palette-dialog__value',\n value: color,\n 'aria-label': `第 ${index + 1} 个颜色值`,\n onChange: (value: unknown) =>\n updateColor(index, typeof value === 'string' ? value : ''),\n })}\n <button\n type='button'\n title='上移'\n aria-label={`上移第 ${index + 1} 个颜色`}\n disabled={index === 0}\n onClick={() => moveColor(index, index - 1)}\n >\n ↑\n </button>\n <button\n type='button'\n title='下移'\n aria-label={`下移第 ${index + 1} 个颜色`}\n disabled={index === draft.value.length - 1}\n onClick={() => moveColor(index, index + 1)}\n >\n ↓\n </button>\n <button\n type='button'\n title='删除'\n aria-label={`删除第 ${index + 1} 个颜色`}\n onClick={() => removeColor(index)}\n >\n ×\n </button>\n </div>\n ))}\n {draft.value.length === 0 ? (\n <p class='sparq-color-palette-dialog__empty'>未配置预设颜色。</p>\n ) : undefined}\n </div>\n <button\n type='button'\n class='sparq-color-palette-dialog__add'\n onClick={() => {\n draft.value.push('#409EFF')\n error.value = ''\n }}\n >\n 添加颜色\n </button>\n {error.value ? (\n <p class='sparq-validation-dialog__error' role='alert'>\n {error.value}\n </p>\n ) : undefined}\n </div>\n <footer class='sparq-validation-dialog__footer'>\n <button type='button' onClick={() => (open.value = false)}>\n 取消\n </button>\n <button type='button' class='is-primary' onClick={commit}>\n 确认\n </button>\n </footer>\n </section>\n </div>\n ) : undefined}\n </div>\n )\n\n function updateColor(index: number, value: string) {\n draft.value[index] = value\n error.value = ''\n }\n\n function moveColor(from: number, to: number) {\n if (to < 0 || to >= draft.value.length) {\n return\n }\n const [color] = draft.value.splice(from, 1)\n draft.value.splice(to, 0, color)\n }\n\n function removeColor(index: number) {\n draft.value.splice(index, 1)\n error.value = ''\n }\n },\n})\n\nfunction draftPreview(colors: string[]) {\n if (colors.length === 0) {\n return <span>未配置</span>\n }\n return colors\n .slice(0, 6)\n .map((color, index) => (\n <span\n key={`${color}-${index}`}\n class='sparq-color-palette-editor__swatch'\n style={{ backgroundColor: matchesValidationFormat('color', color) ? color : 'transparent' }}\n title={color}\n ></span>\n ))\n}\n\nfunction validatePalette(colors: string[]): string | undefined {\n const invalidIndex = colors.findIndex((color) => !matchesValidationFormat('color', color))\n if (invalidIndex >= 0) {\n return `第 ${invalidIndex + 1} 个颜色格式无效,请使用标准颜色格式。`\n }\n if (new Set(colors.map((color) => color.toLowerCase())).size !== colors.length) {\n return '预设色板中存在重复颜色,请删除重复项后再确认。'\n }\n return undefined\n}\n\nfunction colorToNativeValue(color: string): string {\n if (/^#[0-9a-fA-F]{6}$/.test(color)) {\n return color\n }\n if (/^#[0-9a-fA-F]{3}$/.test(color)) {\n return `#${[...color.slice(1)].map((char) => char + char).join('')}`\n }\n const rgb = /^rgba?\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})/.exec(color)\n if (rgb && rgb.slice(1, 4).every((channel) => Number(channel) <= 255)) {\n return `#${rgb\n .slice(1, 4)\n .map((channel) => Number(channel).toString(16).padStart(2, '0'))\n .join('')}`\n }\n return '#409EFF'\n}\n","import { computed, defineComponent, h, ref, type PropType } from 'vue'\nimport type { ResourceField, SchemaResource, ViewNode } from '@sparqjs/schema-protocol'\nimport { createSchemaRuntime } from '@sparqjs/schema-core'\nimport { SparqView, type SparqAssetService, type SparqRichTextRegistry } from '@sparqjs/schema-vue'\nimport { cloneSerializable } from '../shared/clone'\nimport { createDesignerElementPlusUiAdapter, createDesignerElementPlusUiKit } from '../shared/ui-adapter'\n\ninterface DefaultValueEditorConfig {\n mode?: 'dialog'\n component?: string\n nodeProps?: Record<string, unknown>\n field?: ResourceField\n configured?: boolean\n upload?: boolean\n}\n\ninterface DefaultValueEditorProps {\n defaultValueEditor?: DefaultValueEditorConfig\n}\n\n/** 复杂默认值只在用户打开弹层后挂载完整 Runtime,避免增加 Inspector 首屏选择成本。 */\nexport const DefaultValueEditor = defineComponent({\n name: 'DefaultValueEditor',\n props: {\n value: null as unknown as PropType<unknown>,\n onChange: Function as PropType<(value: unknown) => void>,\n props: Object as PropType<DefaultValueEditorProps>,\n assetService: Object as PropType<SparqAssetService>,\n richTextEditors: Object as PropType<SparqRichTextRegistry>,\n },\n setup(props) {\n const open = ref(false)\n const model = ref<Record<string, unknown>>({})\n const runtime = createSchemaRuntime()\n const uiAdapter = createDesignerElementPlusUiAdapter()\n const uiKit = createDesignerElementPlusUiKit()\n const config = computed(() => props.props?.defaultValueEditor)\n const missingAssetService = computed(() => config.value?.upload === true && !props.assetService)\n const canConfigure = computed(() => config.value?.mode === 'dialog' && !missingAssetService.value)\n const canClear = computed(\n () => config.value?.configured === true && config.value.mode === 'dialog' && !missingAssetService.value,\n )\n const schema = computed(() => createDefaultValueSchema(config.value))\n const status = computed(() => {\n if (missingAssetService.value) {\n return config.value?.configured === true\n ? '未配置资源服务,已有默认值只读保留'\n : '未配置资源服务,无法设置默认值'\n }\n if (config.value?.configured === true) {\n return summarizeDefaultValue(props.value, config.value.component)\n }\n return '未设置'\n })\n\n function openDialog() {\n if (!canConfigure.value) {\n return\n }\n model.value = config.value?.configured === true ? { value: cloneOptional(props.value) } : {}\n open.value = true\n }\n\n function closeDialog() {\n open.value = false\n }\n\n function updateModel(values: Record<string, unknown>) {\n model.value = cloneSerializable(values)\n }\n\n function commit() {\n props.onChange?.(Object.prototype.hasOwnProperty.call(model.value, 'value') ? model.value.value : undefined)\n closeDialog()\n }\n\n function clearValue() {\n if (!canClear.value) {\n return\n }\n props.onChange?.(undefined)\n }\n\n return () => (\n <div class='sparq-capability-editor sparq-default-value-editor'>\n <div class='sparq-capability-editor__summary'>\n <span class='sparq-capability-editor__status' title={status.value}>\n {status.value}\n </span>\n <div class='sparq-capability-editor__actions'>\n {config.value?.mode === 'dialog' ? (\n <button\n type='button'\n class='sparq-capability-editor__button'\n disabled={!canConfigure.value}\n onClick={openDialog}\n >\n {config.value.configured === true ? '修改' : '设置'}\n </button>\n ) : undefined}\n {canClear.value ? (\n <button type='button' class='sparq-capability-editor__button' onClick={clearValue}>\n 清除\n </button>\n ) : undefined}\n {missingAssetService.value ? (\n <span class='sparq-capability-editor__readonly'>只读</span>\n ) : undefined}\n </div>\n </div>\n\n {open.value && schema.value ? (\n <div class='sparq-value-strategy-dialog sparq-default-value-dialog' role='dialog' aria-modal='true'>\n <div class='sparq-value-strategy-dialog__mask' onClick={closeDialog}></div>\n <section class='sparq-value-strategy-dialog__panel'>\n <header class='sparq-value-strategy-dialog__header'>\n <h3>默认值</h3>\n <button type='button' onClick={closeDialog}>\n 关闭\n </button>\n </header>\n\n <div class='sparq-value-strategy-dialog__body'>\n <SparqView\n schema={schema.value}\n mode='form'\n view='default'\n modelValue={model.value}\n runtime={runtime}\n uiAdapter={uiAdapter}\n uiKit={uiKit}\n assetService={props.assetService}\n richTextEditors={props.richTextEditors}\n onUpdate:modelValue={updateModel}\n />\n </div>\n\n <footer class='sparq-value-strategy-dialog__footer'>\n <button type='button' onClick={closeDialog}>\n 取消\n </button>\n <button type='button' class='is-primary' onClick={commit}>\n 确认\n </button>\n </footer>\n </section>\n </div>\n ) : undefined}\n </div>\n )\n },\n})\n\nfunction createDefaultValueSchema(config: DefaultValueEditorConfig | undefined): SchemaResource | undefined {\n if (!config?.field || !config.component) {\n return undefined\n }\n const field = createDefaultValueField(config.field)\n const node: ViewNode = {\n type: 'field',\n field: 'value',\n component: config.component,\n props: {\n ...(config.nodeProps ?? {}),\n clearable: true,\n },\n }\n return {\n schema: {\n version: '1.0',\n name: 'designer_default_value_editor',\n fields: [field],\n views: {\n forms: {\n default: {\n footer: false,\n span: 24,\n gap: 12,\n props: {\n labelPosition: 'top',\n size: 'default',\n showMessage: true,\n },\n children: [node],\n },\n },\n },\n },\n }\n}\n\nfunction createDefaultValueField(source: ResourceField): ResourceField {\n const field = cloneSerializable(source)\n field.name = 'value'\n field.label = '默认值'\n field.formable = true\n field.readonly = false\n field.disabled = false\n field.required = false\n field.validation = field.validation?.filter((rule) => rule.type !== 'required')\n delete field.default\n delete field.default_expr\n delete field.computed_expr\n delete field.computed_triggers\n return field\n}\n\nfunction summarizeDefaultValue(value: unknown, component: string | undefined): string {\n if (component === 'rich-text') {\n return '已设置初始内容'\n }\n if (component === 'image-upload' || component === 'file-upload') {\n if (Array.isArray(value)) {\n return `已选择 ${value.length} 个文件`\n }\n if (value && typeof value === 'object') {\n const asset = value as { title?: unknown; name?: unknown; url?: unknown }\n const title = [asset.title, asset.name, asset.url].find((item) => typeof item === 'string')\n return typeof title === 'string' ? title : '已选择 1 个文件'\n }\n return value === undefined ? '未设置' : `已设置:${String(value)}`\n }\n if (Array.isArray(value)) {\n return `已设置 ${value.length} 项`\n }\n if (value && typeof value === 'object') {\n return '已设置结构值'\n }\n if (typeof value === 'boolean') {\n return value ? '开启' : '关闭'\n }\n return value === undefined ? '未设置' : `已设置:${String(value)}`\n}\n\nfunction cloneOptional<T>(value: T): T {\n return value === undefined ? value : cloneSerializable(value)\n}\n","import { defineComponent, h, nextTick, ref, watch, type PropType } from 'vue'\nimport type { ViewNode } from '@sparqjs/schema-protocol'\nimport { cloneSerializable } from '../shared/clone'\nimport { renderNodeActionIcon } from '../shared/icons'\nimport { createDesignerElementPlusSchemaUi } from '../shared/ui-adapter'\nimport { prepareNode } from '../state/tree'\n\nexport type ContainerItemsType = 'tabs' | 'collapse'\n\ninterface ContainerItemsEditorConfig {\n containerType?: ContainerItemsType\n}\n\ninterface ContainerItemsEditorProps {\n containerItems?: ContainerItemsEditorConfig\n}\n\ninterface FocusableInput {\n focus(): void\n blur(): void\n}\n\nconst itemDefinitions = {\n tabs: {\n itemType: 'tab',\n namePrefix: 'tab',\n title: '标签页',\n },\n collapse: {\n itemType: 'collapse-item',\n namePrefix: 'panel',\n title: '面板',\n },\n} as const\n\n/** 管理 tabs/collapse 的专用子节点,重排和改名时完整保留每个项目的内容树。 */\nexport const ContainerItemsEditor = defineComponent({\n name: 'ContainerItemsEditor',\n props: {\n value: Array as PropType<ViewNode[]>,\n onChange: Function as PropType<(value: ViewNode[]) => void>,\n disabled: { type: Boolean, default: false },\n readonly: { type: Boolean, default: false },\n props: Object as PropType<ContainerItemsEditorProps>,\n },\n setup(props) {\n const ui = createDesignerElementPlusSchemaUi()\n const items = ref<ViewNode[]>([])\n const pendingDeleteId = ref<string>()\n const itemInputs = new Map<string, FocusableInput>()\n const locked = () => props.disabled || props.readonly\n\n watch(\n () => props.value,\n (value) => {\n items.value = cloneSerializable(value ?? [])\n if (!items.value.some((item, index) => itemKey(item, index) === pendingDeleteId.value)) {\n pendingDeleteId.value = undefined\n }\n },\n { immediate: true, deep: true },\n )\n\n function commit(nextItems: ViewNode[]) {\n items.value = cloneSerializable(nextItems)\n pendingDeleteId.value = undefined\n props.onChange?.(cloneSerializable(nextItems))\n }\n\n function addItem() {\n const containerType = resolveContainerType(props.props?.containerItems?.containerType)\n if (!containerType || locked()) {\n return\n }\n const nextItems = cloneSerializable(items.value)\n const nextItem = createContainerItem(nextItems, containerType)\n nextItems.push(nextItem)\n commit(nextItems)\n void nextTick(() => itemInputs.get(nextItem.id as string)?.focus())\n }\n\n function updateTitle(index: number, title: string) {\n const nextItems = cloneSerializable(items.value)\n const item = nextItems[index]\n if (!item) {\n return\n }\n item.title = title\n items.value = nextItems\n }\n\n function commitTitle(index: number) {\n const containerType = resolveContainerType(props.props?.containerItems?.containerType)\n const current = items.value[index]\n if (!containerType || !current || locked()) {\n return\n }\n const title = current.title?.trim() || `${itemDefinitions[containerType].title} ${index + 1}`\n if (title === props.value?.[index]?.title) {\n return\n }\n const nextItems = cloneSerializable(items.value)\n const item = nextItems[index]\n if (item) {\n item.title = title\n }\n commit(nextItems)\n }\n\n function moveItem(index: number, direction: -1 | 1) {\n if (locked()) {\n return\n }\n const targetIndex = index + direction\n if (targetIndex < 0 || targetIndex >= items.value.length) {\n return\n }\n const nextItems = cloneSerializable(items.value)\n const [item] = nextItems.splice(index, 1)\n if (!item) {\n return\n }\n nextItems.splice(targetIndex, 0, item)\n commit(nextItems)\n }\n\n function requestDelete(item: ViewNode, index: number) {\n if (locked() || items.value.length <= 1) {\n return\n }\n if ((item.children?.length ?? 0) > 0) {\n pendingDeleteId.value = itemKey(item, index)\n return\n }\n removeItem(index)\n }\n\n function removeItem(index: number) {\n if (locked() || items.value.length <= 1) {\n return\n }\n const nextItems = cloneSerializable(items.value)\n nextItems.splice(index, 1)\n commit(nextItems)\n }\n\n return () => {\n const containerType = resolveContainerType(props.props?.containerItems?.containerType)\n if (!containerType) {\n return null\n }\n const definition = itemDefinitions[containerType]\n return (\n <div class='sparq-container-items-editor'>\n <div class='sparq-container-items-editor__toolbar'>\n <span>{`${items.value.length} 个项目`}</span>\n <button\n type='button'\n class='sparq-container-items-editor__add'\n disabled={locked()}\n onClick={addItem}\n >\n {renderNodeActionIcon('add')}\n <span>添加{definition.title}</span>\n </button>\n </div>\n\n {items.value.length ? (\n <ol class='sparq-container-items-editor__list' aria-label={`${definition.title}项目列表`}>\n {items.value.map((item, index) => {\n const key = itemKey(item, index)\n const confirming = pendingDeleteId.value === key\n return (\n <li key={key} class='sparq-container-items-editor__item'>\n <div class='sparq-container-items-editor__row'>\n {ui.text({\n class: 'sparq-container-items-editor__title',\n size: 'small',\n ref: (element: unknown) => {\n const input = resolveFocusableInput(element)\n if (input) {\n itemInputs.set(key, input)\n } else {\n itemInputs.delete(key)\n }\n },\n value: item.title ?? '',\n disabled: locked(),\n 'aria-label': `${definition.title} ${index + 1} 标题`,\n onChange: (value: unknown) =>\n updateTitle(index, typeof value === 'string' ? value : ''),\n onBlur: () => commitTitle(index),\n onKeydown: (event: KeyboardEvent) => {\n if (event.key === 'Enter') {\n itemInputs.get(key)?.blur()\n }\n },\n })}\n <div class='sparq-container-items-editor__actions'>\n <button\n type='button'\n disabled={locked() || index === 0}\n title='上移'\n aria-label={`上移${definition.title} ${index + 1}`}\n onClick={() => moveItem(index, -1)}\n >\n {renderNodeActionIcon('up')}\n </button>\n <button\n type='button'\n disabled={locked() || index === items.value.length - 1}\n title='下移'\n aria-label={`下移${definition.title} ${index + 1}`}\n onClick={() => moveItem(index, 1)}\n >\n {renderNodeActionIcon('down')}\n </button>\n <button\n type='button'\n class='is-danger'\n disabled={locked() || items.value.length <= 1}\n title={items.value.length <= 1 ? '至少保留一个项目' : '删除'}\n aria-label={`删除${definition.title} ${index + 1}`}\n onClick={() => requestDelete(item, index)}\n >\n {renderNodeActionIcon('remove')}\n </button>\n </div>\n </div>\n {confirming ? (\n <div class='sparq-container-items-editor__confirm' role='alert'>\n <span>{`包含 ${item.children?.length ?? 0} 个内容节点,确认删除?`}</span>\n <div>\n <button\n type='button'\n onClick={() => (pendingDeleteId.value = undefined)}\n >\n 取消\n </button>\n <button\n type='button'\n class='is-danger'\n onClick={() => removeItem(index)}\n >\n 确认删除\n </button>\n </div>\n </div>\n ) : undefined}\n </li>\n )\n })}\n </ol>\n ) : (\n <div class='sparq-container-items-editor__empty'>暂无项目</div>\n )}\n </div>\n )\n }\n },\n})\n\n/** 创建一个具备稳定协议 name 与设计器 ID 的空项目节点。 */\nexport function createContainerItem(items: ViewNode[], containerType: ContainerItemsType): ViewNode {\n const definition = itemDefinitions[containerType]\n const existingNames = new Set(items.flatMap((item) => (item.name ? [item.name] : [])))\n let sequence = items.length + 1\n while (existingNames.has(`${definition.namePrefix}_${sequence}`)) {\n sequence += 1\n }\n return prepareNode({\n type: definition.itemType,\n name: `${definition.namePrefix}_${sequence}`,\n title: `${definition.title} ${sequence}`,\n children: [],\n })\n}\n\nfunction resolveContainerType(value: ContainerItemsType | undefined): ContainerItemsType | undefined {\n return value === 'tabs' || value === 'collapse' ? value : undefined\n}\n\nfunction itemKey(item: ViewNode, index: number): string {\n return item.id ?? item.name ?? `${item.type}_${index}`\n}\n\nfunction resolveFocusableInput(value: unknown): FocusableInput | undefined {\n if (!value || typeof value !== 'object') {\n return undefined\n }\n const candidate = value as Partial<FocusableInput>\n return typeof candidate.focus === 'function' && typeof candidate.blur === 'function'\n ? (candidate as FocusableInput)\n : undefined\n}\n","import { h, isVNode, type VNodeChild } from 'vue'\nimport type { SchemaUiAdapter } from '@sparqjs/schema-vue'\nimport { createDesignerElementPlusUiAdapter } from '../shared/ui-adapter'\n\n/** 创建属性面板 adapter,并用原生 details 承载可折叠 section。 */\nexport function createDesignerPropertyUiAdapter(fieldErrors: Readonly<Record<string, string[]>> = {}): SchemaUiAdapter {\n const adapter = createDesignerElementPlusUiAdapter(fieldErrors)\n return {\n ...adapter,\n renderLayoutNode(context) {\n if (context.node.raw.className !== 'sparq-designer-property-section') {\n return adapter.renderLayoutNode?.(context)\n }\n\n const sectionKey = context.node.raw.name ?? context.node.id\n return h(\n 'details',\n {\n class: 'sparq-designer-property-section',\n open: context.node.raw.props?.defaultOpen === true,\n 'data-sparq-property-section': sectionKey,\n },\n [\n h('summary', { class: 'sparq-designer-property-section__summary' }, context.node.raw.title),\n h('div', { class: 'sparq-designer-property-section__body' }, propertySectionBody(context.children)),\n ],\n )\n },\n }\n}\n\nfunction propertySectionBody(children: VNodeChild): VNodeChild[] {\n if (!Array.isArray(children)) {\n return children === undefined || children === null || typeof children === 'boolean' ? [] : [children]\n }\n return children.filter((child) => !(isVNode(child) && child.props?.['data-slot'] === 'node-header'))\n}\n","import { computed, defineComponent, h, onBeforeUnmount, ref, watch, type PropType } from 'vue'\nimport type { SchemaResource } from '@sparqjs/schema-protocol'\nimport { createSchemaRuntime } from '@sparqjs/schema-core'\nimport {\n SparqView,\n createSchemaComponentRegistry,\n mergeSchemaComponentRegistry,\n type SchemaComponentRegistry,\n type SparqIconRegistry,\n type SparqRichTextRegistry,\n} from '@sparqjs/schema-vue'\nimport type { DraftState } from '../state/types'\nimport { createDesignerElementPlusUiKit } from '../shared/ui-adapter'\nimport { getDesignerNodePermissions, getFormView, getFields, getSelectedNode } from '../state/draft'\nimport {\n createFieldPropertySchema,\n createFieldPropertySchemaKey,\n createFieldPropertyValues,\n loadFieldPropertyDataSourceOptions,\n type FieldPropertyOptionState,\n type FieldPropertyValues,\n} from './field-property-view'\nimport { createFieldPropertyCommands, executeFieldPropertyCommands } from './commands/field-property'\nimport type { DesignerComponentMigrationPlan } from './commands/component-migration'\nimport {\n createFormPropertySchema,\n createFormPropertySchemaKey,\n createFormPropertyValues,\n type FormPropertyValues,\n} from './form-property-view'\nimport { executeFormPropertyCommand } from './commands/form-property'\nimport { createFieldSchemaSections, type FieldSchemaContext } from './field-schema'\nimport { listVisibleFormProperties, type FormPropertyField } from './form-schema'\nimport {\n changedPropertyKeys,\n mergePersistedPropertyValues,\n shouldCommitPropertyOnBlur,\n shouldCommitPropertyOnChange,\n shouldCommitPropertyOnKeydown,\n type PropertyCommitDefinition,\n} from './property-commit'\nimport { ValidationRuleEditor } from './validation-rule-editor'\nimport { OptionSourceEditor } from './option-source-editor'\nimport { ValueStrategyEditor } from './value-strategy-editor'\nimport { InteractionRulesEditor } from './interaction-rules-editor'\nimport { AdvancedConfigStatus, ComponentSettingsEditor } from './component-settings-editor'\nimport { BooleanCheckbox } from './boolean-checkbox'\nimport { InputSlotsEditor } from './input-slots-editor'\nimport { DateTimeFormatEditor } from './date-time-format-editor'\nimport { ColorPaletteEditor } from './color-palette-editor'\nimport { DefaultValueEditor } from './default-value-editor'\nimport { ContainerItemsEditor } from './container-items-editor'\nimport { createDesignerPropertyUiAdapter } from './property-ui-adapter'\n\n/**\n * 右侧属性面板入口。\n *\n * 它根据选区切换字段或表单属性 schema,并把确认后的命令提交给 DraftState。\n */\nexport const Inspector = defineComponent({\n name: 'SparqDesignerInspector',\n props: {\n state: {\n type: Object as PropType<DraftState>,\n required: true,\n },\n components: Object as PropType<SchemaComponentRegistry>,\n richTextEditors: Object as PropType<SparqRichTextRegistry>,\n showFormProperties: {\n type: Boolean,\n default: true,\n },\n },\n setup(props) {\n const runtime = createSchemaRuntime()\n const fieldPropertyValues = ref<FieldPropertyValues>({})\n const fieldPropertyOptions = ref<FieldPropertyOptionState>({})\n const fieldPropertySchema = ref<SchemaResource>()\n const fieldPropertySchemaKey = ref('')\n const fieldPropertyHydrated = ref(true)\n const fieldPropertyViewRevision = ref(0)\n const fieldPropertyOptionsKey = ref('')\n const fieldPropertyOptionsController = ref<AbortController>()\n const fieldPropertyDirtyKeys = ref<Set<string>>(new Set())\n const fieldPropertyErrors = ref<Record<string, string[]>>({})\n const propertyValues = ref<FormPropertyValues>({})\n const propertySchema = ref<SchemaResource>()\n const propertySchemaKey = ref('')\n const formPropertyDirtyKeys = ref<Set<string>>(new Set())\n const formPropertyErrors = ref<Record<string, string[]>>({})\n const syncing = ref(false)\n const pendingComponentMigration = ref<DesignerComponentMigrationPlan>()\n let fieldPropertyHydrationRevision = 0\n let hasHydratedFieldPropertySchema = false\n getFormView(props.state.schema, props.state.viewName)\n const form = computed(() => getFormView(props.state.schema, props.state.viewName))\n const selectedNode = computed(() => getSelectedNode(props.state))\n const fields = computed(() => getFields(props.state.schema))\n const selectedField = computed(() => fields.value.find((field) => field.name === selectedNode.value?.field))\n const selectedNodeReadonly = computed(() =>\n Boolean(selectedNode.value?.id && !getDesignerNodePermissions(props.state, selectedNode.value.id).editable),\n )\n const fieldContext = computed<FieldSchemaContext | undefined>(() => {\n void props.state.schemaVersion\n if (!selectedNode.value) {\n return undefined\n }\n return {\n node: selectedNode.value,\n field: selectedField.value,\n fields: fields.value,\n extensionContext: props.state.extensionContext,\n readonly: selectedNodeReadonly.value,\n }\n })\n const fieldSections = computed(() => (fieldContext.value ? createFieldSchemaSections(fieldContext.value) : []))\n const fieldDefinitions = computed(() => fieldSections.value.flatMap((section) => section.fields))\n const fieldDefinitionsByKey = computed(() => new Map(fieldDefinitions.value.map((field) => [field.key, field])))\n const fieldAdapter = computed(() => createDesignerPropertyUiAdapter(fieldPropertyErrors.value))\n const formAdapter = computed(() => createDesignerPropertyUiAdapter(formPropertyErrors.value))\n\n function currentFieldContext(): FieldSchemaContext | undefined {\n return fieldContext.value\n }\n\n function commitFormProperties(keys: string[]): void {\n const commitKeys = keys.filter((key) => formPropertyDirtyKeys.value.has(key))\n if (commitKeys.length === 0) {\n return\n }\n const result = executeFormPropertyCommand(props.state, {\n type: 'update-form-properties',\n values: pickPropertyValues(propertyValues.value, commitKeys),\n })\n if (result.status === 'rejected') {\n formPropertyErrors.value = withCommandErrors(\n formPropertyErrors.value,\n commitKeys,\n result.message,\n result.issues,\n )\n return\n }\n formPropertyDirtyKeys.value = withoutKeys(formPropertyDirtyKeys.value, commitKeys)\n formPropertyErrors.value = withoutErrorKeys(formPropertyErrors.value, commitKeys)\n }\n\n function commitFieldProperties(keys: string[]): void {\n const context = currentFieldContext()\n const commitKeys = keys.filter((key) => fieldPropertyDirtyKeys.value.has(key))\n if (!context || commitKeys.length === 0) {\n return\n }\n const commands = createFieldPropertyCommands(\n context,\n pickPropertyValues(fieldPropertyValues.value, commitKeys),\n fieldSections.value,\n )\n const result = executeFieldPropertyCommands(props.state, commands)\n if (result.status === 'confirmation-required') {\n pendingComponentMigration.value = result.plan\n return\n }\n if (result.status === 'rejected') {\n fieldPropertyErrors.value = withCommandErrors(\n fieldPropertyErrors.value,\n commitKeys,\n result.message,\n result.issues,\n )\n return\n }\n\n fieldPropertyDirtyKeys.value = withoutKeys(fieldPropertyDirtyKeys.value, commitKeys)\n fieldPropertyErrors.value = withoutErrorKeys(fieldPropertyErrors.value, commitKeys)\n if (result.status === 'applied') {\n pendingComponentMigration.value = undefined\n syncFieldPropertyOptions(fieldPropertyValues.value)\n }\n }\n\n const updateFormProperties = (values: Record<string, unknown>) => {\n if (syncing.value) {\n return\n }\n const changedKeys = changedPropertyKeys(propertyValues.value, values)\n if (changedKeys.length === 0) {\n return\n }\n propertyValues.value = values\n formPropertyDirtyKeys.value = updateDirtyKeys(\n formPropertyDirtyKeys.value,\n changedKeys,\n values,\n createFormPropertyValues(form.value),\n )\n formPropertyErrors.value = withoutErrorKeys(formPropertyErrors.value, changedKeys)\n const definitions = new Map(listVisibleFormProperties(form.value).map((field) => [field.key, field]))\n commitFormProperties(\n changedKeys.filter((key) => {\n const field = definitions.get(key)\n return field ? shouldCommitPropertyOnChange(field) : false\n }),\n )\n }\n const updateFieldProperties = (values: Record<string, unknown>) => {\n const context = currentFieldContext()\n if (syncing.value || !context) {\n return\n }\n const changedKeys = changedPropertyKeys(fieldPropertyValues.value, values)\n if (changedKeys.length === 0) {\n return\n }\n fieldPropertyValues.value = values\n fieldPropertyDirtyKeys.value = updateDirtyKeys(\n fieldPropertyDirtyKeys.value,\n changedKeys,\n values,\n createFieldPropertyValues(context, fieldSections.value),\n )\n fieldPropertyErrors.value = withoutErrorKeys(fieldPropertyErrors.value, changedKeys)\n syncFieldPropertyOptions(values)\n commitFieldProperties(\n changedKeys.filter((key) => {\n const field = fieldDefinitionsByKey.value.get(key)\n return field ? shouldCommitPropertyOnChange(field) : false\n }),\n )\n }\n const uiKit = createDesignerElementPlusUiKit()\n const builtInComponents = createSchemaComponentRegistry({\n 'designer.validation-rule-editor': {\n component: ValidationRuleEditor,\n },\n 'designer.option-source-editor': {\n component: OptionSourceEditor,\n },\n 'designer.value-strategy-editor': {\n component: ValueStrategyEditor,\n },\n 'designer.default-value-editor': {\n render(componentProps, _slots, context) {\n return h(DefaultValueEditor, {\n ...componentProps,\n assetService: context?.assetService,\n richTextEditors: context?.richTextEditors,\n })\n },\n },\n 'designer.container-items-editor': {\n component: ContainerItemsEditor,\n },\n 'designer.interaction-rules-editor': {\n component: InteractionRulesEditor,\n },\n 'designer.boolean-checkbox': {\n component: BooleanCheckbox,\n },\n 'designer.component-settings-editor': {\n component: ComponentSettingsEditor,\n },\n 'designer.input-slots-editor': {\n component: InputSlotsEditor,\n },\n 'designer.advanced-config-status': {\n component: AdvancedConfigStatus,\n },\n 'designer.date-time-format-editor': {\n component: DateTimeFormatEditor,\n },\n 'designer.color-palette-editor': {\n component: ColorPaletteEditor,\n },\n })\n const components = computed(() => mergeSchemaComponentRegistry(builtInComponents, props.components))\n const syncFieldPropertyValues = () => {\n const context = currentFieldContext()\n if (!context) {\n fieldPropertyValues.value = {}\n fieldPropertyDirtyKeys.value = new Set()\n fieldPropertyErrors.value = {}\n return\n }\n\n const values = mergePersistedPropertyValues(\n createFieldPropertyValues(context, fieldSections.value),\n fieldPropertyValues.value,\n fieldPropertyDirtyKeys.value,\n )\n if (isSamePropertyValues(fieldPropertyValues.value, values)) {\n return\n }\n\n syncing.value = true\n fieldPropertyValues.value = values\n syncing.value = false\n }\n const syncFieldPropertySchema = () => {\n const context = currentFieldContext()\n if (!context) {\n fieldPropertyHydrationRevision += 1\n fieldPropertySchema.value = undefined\n fieldPropertySchemaKey.value = ''\n fieldPropertyHydrated.value = true\n return\n }\n\n const sections = fieldSections.value\n const nextKey = `${createFieldPropertySchemaKey(context, sections)}|${stableStringifyOptions(fieldPropertyOptions.value)}`\n if (fieldPropertySchema.value && fieldPropertySchemaKey.value === nextKey) {\n if (!fieldPropertyHydrated.value) {\n fieldPropertyHydrationRevision += 1\n fieldPropertySchema.value = createFieldPropertySchema(\n context,\n fieldPropertyOptions.value,\n props.state.serviceRegistry,\n sections,\n )\n fieldPropertyHydrated.value = true\n }\n return\n }\n\n const hydrationRevision = ++fieldPropertyHydrationRevision\n fieldPropertySchemaKey.value = nextKey\n const createSchema = (visibleSections = sections) =>\n createFieldPropertySchema(\n context,\n fieldPropertyOptions.value,\n props.state.serviceRegistry,\n visibleSections,\n )\n const shouldHydrateBySection =\n !hasHydratedFieldPropertySchema && sections.length > 1 && typeof requestAnimationFrame === 'function'\n hasHydratedFieldPropertySchema = true\n if (!shouldHydrateBySection) {\n fieldPropertySchema.value = createSchema()\n fieldPropertyHydrated.value = true\n return\n }\n\n fieldPropertySchema.value = createSchema(sections.slice(0, 1))\n fieldPropertyHydrated.value = false\n let visibleSectionCount = 1\n const appendSection = () => {\n requestAnimationFrame(() => {\n if (\n hydrationRevision !== fieldPropertyHydrationRevision ||\n fieldPropertySchemaKey.value !== nextKey\n ) {\n return\n }\n visibleSectionCount += 1\n fieldPropertySchema.value = createSchema(sections.slice(0, visibleSectionCount))\n if (visibleSectionCount < sections.length) {\n appendSection()\n return\n }\n fieldPropertyHydrated.value = true\n })\n }\n requestAnimationFrame(appendSection)\n }\n const syncFieldPropertyOptions = (values = fieldPropertyValues.value) => {\n const context = currentFieldContext()\n if (!context) {\n fieldPropertyOptionsController.value?.abort()\n fieldPropertyOptions.value = {}\n fieldPropertyOptionsKey.value = ''\n return\n }\n\n const sections = fieldSections.value\n const nextKey = `${createFieldPropertySchemaKey(context, sections)}|${stableStringify(normalizePropertyValues(values))}`\n if (fieldPropertyOptionsKey.value === nextKey) {\n return\n }\n\n fieldPropertyOptionsKey.value = nextKey\n fieldPropertyOptionsController.value?.abort()\n const controller = new AbortController()\n fieldPropertyOptionsController.value = controller\n\n loadFieldPropertyDataSourceOptions(\n context,\n values,\n controller.signal,\n props.state.serviceRegistry,\n sections,\n )\n .then((options) => {\n if (controller.signal.aborted) {\n return\n }\n if (stableStringifyOptions(fieldPropertyOptions.value) === stableStringifyOptions(options)) {\n return\n }\n fieldPropertyOptions.value = options\n syncFieldPropertySchema()\n })\n .catch((error: unknown) => {\n if (controller.signal.aborted) {\n return\n }\n console.warn('[sparq-designer] load field property options failed', error)\n if (Object.keys(fieldPropertyOptions.value).length === 0) {\n return\n }\n fieldPropertyOptions.value = {}\n syncFieldPropertySchema()\n })\n }\n const syncFormPropertyValues = () => {\n const values = mergePersistedPropertyValues(\n createFormPropertyValues(form.value),\n propertyValues.value,\n formPropertyDirtyKeys.value,\n )\n if (isSamePropertyValues(propertyValues.value, values)) {\n return\n }\n\n syncing.value = true\n propertyValues.value = values\n syncing.value = false\n }\n\n const syncFormPropertySchema = () => {\n const nextKey = createFormPropertySchemaKey(form.value)\n if (propertySchema.value && propertySchemaKey.value === nextKey) {\n return\n }\n\n propertySchemaKey.value = nextKey\n propertySchema.value = createFormPropertySchema(form.value)\n }\n\n const confirmComponentMigration = () => {\n const plan = pendingComponentMigration.value\n if (!plan) {\n return\n }\n\n const result = executeFieldPropertyCommands(props.state, [\n {\n type: 'change-component',\n component: plan.targetComponent,\n confirmed: true,\n },\n ])\n pendingComponentMigration.value = undefined\n if (result.status === 'rejected') {\n fieldPropertyErrors.value = withCommandErrors(\n fieldPropertyErrors.value,\n ['node.component'],\n result.message,\n result.issues,\n )\n return\n }\n fieldPropertyDirtyKeys.value = withoutKeys(fieldPropertyDirtyKeys.value, ['node.component'])\n fieldPropertyErrors.value = withoutErrorKeys(fieldPropertyErrors.value, ['node.component'])\n syncFieldPropertyValues()\n syncFieldPropertySchema()\n syncFieldPropertyOptions()\n }\n const cancelComponentMigration = () => {\n pendingComponentMigration.value = undefined\n fieldPropertyDirtyKeys.value = withoutKeys(fieldPropertyDirtyKeys.value, ['node.component'])\n fieldPropertyErrors.value = withoutErrorKeys(fieldPropertyErrors.value, ['node.component'])\n syncFieldPropertyValues()\n fieldPropertyViewRevision.value += 1\n }\n\n watch(\n () => props.state.schemaVersion,\n () => {\n syncFieldPropertySchema()\n syncFormPropertySchema()\n syncFieldPropertyOptions()\n },\n { immediate: true },\n )\n\n onBeforeUnmount(() => {\n fieldPropertyHydrationRevision += 1\n fieldPropertyOptionsController.value?.abort()\n })\n\n watch(\n () => props.state.schemaVersion,\n () => {\n syncFieldPropertyValues()\n syncFormPropertyValues()\n },\n { immediate: true },\n )\n\n watch(\n () => props.state.serviceRegistry,\n () => {\n fieldPropertyOptionsKey.value = ''\n fieldPropertySchemaKey.value = ''\n syncFieldPropertyOptions()\n syncFieldPropertySchema()\n },\n )\n\n watch(\n () => (props.state.selection?.type === 'form-node' ? props.state.selection.path : ''),\n () => {\n pendingComponentMigration.value = undefined\n fieldPropertyDirtyKeys.value = new Set()\n fieldPropertyErrors.value = {}\n syncFieldPropertySchema()\n syncFieldPropertyValues()\n syncFieldPropertyOptions()\n },\n { immediate: true },\n )\n\n const formDefinitions = (): FormPropertyField[] => listVisibleFormProperties(form.value)\n const handleFieldFocusout = (event: FocusEvent) => {\n commitPropertyFromFocusout(event, fieldDefinitions.value, commitFieldProperties)\n }\n const handleFormFocusout = (event: FocusEvent) => {\n commitPropertyFromFocusout(event, formDefinitions(), commitFormProperties)\n }\n const handleFieldKeydown = (event: KeyboardEvent) => {\n commitPropertyFromKeydown(event, fieldDefinitions.value, commitFieldProperties)\n }\n const handleFormKeydown = (event: KeyboardEvent) => {\n commitPropertyFromKeydown(event, formDefinitions(), commitFormProperties)\n }\n\n return () => {\n return (\n <aside\n class='sparq-designer-inspector'\n data-field-property-ready={fieldPropertyHydrated.value ? '' : undefined}\n >\n <div class='sparq-designer-inspector-tabs'>\n {renderInspectorTab('字段属性', props.state.inspectorTab === 'field', () => {\n syncFieldPropertySchema()\n syncFieldPropertyValues()\n props.state.inspectorTab = 'field'\n })}\n {props.showFormProperties\n ? renderInspectorTab('表单属性', props.state.inspectorTab === 'form', () => {\n syncFormPropertyValues()\n props.state.inspectorTab = 'form'\n })\n : undefined}\n </div>\n {props.state.inspectorTab === 'form' && propertySchema.value ? (\n renderFormProperties(\n propertySchema.value,\n propertySchemaKey.value,\n propertyValues.value,\n runtime,\n formAdapter.value,\n uiKit,\n updateFormProperties,\n handleFormFocusout,\n handleFormKeydown,\n )\n ) : selectedNode.value && fieldPropertySchema.value ? (\n renderFieldProperties(\n fieldPropertySchema.value,\n fieldPropertySchemaKey.value + ':' + fieldPropertyViewRevision.value,\n fieldPropertyValues.value,\n runtime,\n fieldAdapter.value,\n uiKit,\n components.value,\n props.state.extensionContext?.icons,\n props.richTextEditors,\n updateFieldProperties,\n handleFieldFocusout,\n handleFieldKeydown,\n )\n ) : (\n <div class='sparq-designer-empty'>从舞台中选择一个节点后编辑字段属性。</div>\n )}\n {pendingComponentMigration.value\n ? renderComponentMigrationDialog(\n pendingComponentMigration.value,\n confirmComponentMigration,\n cancelComponentMigration,\n )\n : undefined}\n </aside>\n )\n }\n },\n})\n\nfunction renderFieldProperties(\n schema: ReturnType<typeof createFieldPropertySchema>,\n schemaKey: string,\n values: FieldPropertyValues,\n runtime: ReturnType<typeof createSchemaRuntime>,\n adapter: ReturnType<typeof createDesignerPropertyUiAdapter>,\n uiKit: ReturnType<typeof createDesignerElementPlusUiKit>,\n components: SchemaComponentRegistry,\n icons: SparqIconRegistry | undefined,\n richTextEditors: SparqRichTextRegistry | undefined,\n onUpdate: (values: Record<string, unknown>) => void,\n onFocusout: (event: FocusEvent) => void,\n onKeydown: (event: KeyboardEvent) => void,\n) {\n return (\n <div class='sparq-designer-property-view' onFocusout={onFocusout} onKeydown={onKeydown}>\n <SparqView\n key={schemaKey}\n schema={schema}\n mode='form'\n view='default'\n modelValue={values}\n runtime={runtime}\n uiAdapter={adapter}\n uiKit={uiKit}\n components={components}\n icons={icons}\n richTextEditors={richTextEditors}\n onUpdate:modelValue={onUpdate}\n />\n </div>\n )\n}\n\nfunction renderFormProperties(\n schema: ReturnType<typeof createFormPropertySchema>,\n schemaKey: string,\n values: FormPropertyValues,\n runtime: ReturnType<typeof createSchemaRuntime>,\n adapter: ReturnType<typeof createDesignerPropertyUiAdapter>,\n uiKit: ReturnType<typeof createDesignerElementPlusUiKit>,\n onUpdate: (values: Record<string, unknown>) => void,\n onFocusout: (event: FocusEvent) => void,\n onKeydown: (event: KeyboardEvent) => void,\n) {\n return (\n <div class='sparq-designer-property-view' onFocusout={onFocusout} onKeydown={onKeydown}>\n <SparqView\n key={schemaKey}\n schema={schema}\n mode='form'\n view='default'\n modelValue={values}\n runtime={runtime}\n uiAdapter={adapter}\n uiKit={uiKit}\n onUpdate:modelValue={onUpdate}\n />\n </div>\n )\n}\n\nfunction renderComponentMigrationDialog(\n plan: DesignerComponentMigrationPlan,\n onConfirm: () => void,\n onCancel: () => void,\n) {\n return (\n <div class='sparq-value-strategy-dialog sparq-component-migration-dialog' role='dialog' aria-modal='true'>\n <div class='sparq-value-strategy-dialog__mask' onClick={onCancel}></div>\n <section class='sparq-value-strategy-dialog__panel sparq-component-migration-dialog__panel'>\n <header class='sparq-value-strategy-dialog__header'>\n <div>\n <h3>确认切换组件</h3>\n <p>\n {plan.sourceLabel} → {plan.targetLabel}\n </p>\n </div>\n </header>\n <div class='sparq-value-strategy-dialog__body'>\n {plan.compatibility === 'unknown' ? (\n <p class='sparq-component-migration-dialog__notice'>\n 目标组件兼容性无法自动确认,现有未知扩展配置将保留。\n </p>\n ) : undefined}\n <ul class='sparq-component-migration-dialog__changes'>\n {plan.changes.map((change) => (\n <li key={`${change.target}:${change.path}:${change.action}`} class={`is-${change.action}`}>\n {change.label}\n </li>\n ))}\n </ul>\n </div>\n <footer class='sparq-value-strategy-dialog__footer'>\n <button type='button' onClick={onCancel}>\n 取消\n </button>\n <button type='button' class='is-primary' onClick={onConfirm}>\n 确认切换\n </button>\n </footer>\n </section>\n </div>\n )\n}\n\nfunction renderInspectorTab(label: string, active: boolean, onClick: () => void) {\n return (\n <button type='button' class={active ? 'is-active' : undefined} onClick={onClick}>\n {label}\n </button>\n )\n}\n\nfunction commitPropertyFromFocusout(\n event: FocusEvent,\n fields: PropertyCommitDefinition[],\n commit: (keys: string[]) => void,\n): void {\n const key = propertyKeyFromEvent(event)\n const field = fields.find((item) => item.key === key)\n if (field && shouldCommitPropertyOnBlur(field)) {\n commit([field.key])\n }\n}\n\nfunction commitPropertyFromKeydown(\n event: KeyboardEvent,\n fields: PropertyCommitDefinition[],\n commit: (keys: string[]) => void,\n): void {\n const key = propertyKeyFromEvent(event)\n const field = fields.find((item) => item.key === key)\n if (!field || !shouldCommitPropertyOnKeydown(field, event)) {\n return\n }\n event.preventDefault()\n commit([field.key])\n}\n\nfunction propertyKeyFromEvent(event: Event): string | undefined {\n const target = event.target\n if (!(target instanceof Element)) {\n return undefined\n }\n const control = target.closest('[data-sparq-element-plus-control], [data-sparq-field]')\n return (\n control?.getAttribute('data-sparq-element-plus-control') ??\n control?.getAttribute('data-sparq-field') ??\n undefined\n )\n}\n\nfunction pickPropertyValues(values: Record<string, unknown>, keys: string[]): Record<string, unknown> {\n return Object.fromEntries(keys.map((key) => [key, values[key]]))\n}\n\nfunction updateDirtyKeys(\n current: ReadonlySet<string>,\n changedKeys: string[],\n draft: Record<string, unknown>,\n persisted: Record<string, unknown>,\n): Set<string> {\n const next = new Set(current)\n for (const key of changedKeys) {\n if (JSON.stringify(draft[key]) === JSON.stringify(persisted[key])) {\n next.delete(key)\n } else {\n next.add(key)\n }\n }\n return next\n}\n\nfunction withoutKeys(current: ReadonlySet<string>, keys: string[]): Set<string> {\n const next = new Set(current)\n for (const key of keys) {\n next.delete(key)\n }\n return next\n}\n\nfunction withoutErrorKeys(current: Readonly<Record<string, string[]>>, keys: string[]): Record<string, string[]> {\n const next = { ...current }\n for (const key of keys) {\n delete next[key]\n }\n return next\n}\n\nfunction withCommandErrors(\n current: Readonly<Record<string, string[]>>,\n keys: string[],\n message: string,\n issues?: Array<{ key: string; message: string }>,\n): Record<string, string[]> {\n const next = withoutErrorKeys(current, keys)\n if (issues?.length) {\n for (const issue of issues) {\n next[issue.key] = [...(next[issue.key] ?? []), issue.message]\n }\n } else if (keys[0]) {\n next[keys[0]] = [message]\n }\n return next\n}\n\nfunction isSamePropertyValues(left: Record<string, unknown>, right: Record<string, unknown>): boolean {\n return stableStringify(normalizePropertyValues(left)) === stableStringify(normalizePropertyValues(right))\n}\n\nfunction normalizePropertyValues(values: Record<string, unknown>): Record<string, unknown> {\n const normalized: Record<string, unknown> = {}\n\n for (const [key, value] of Object.entries(values)) {\n if (value === undefined || (value === '' && key !== 'field.value_strategy_editor')) {\n continue\n }\n normalized[key] = value\n }\n\n return normalized\n}\n\nfunction stableStringify(value: Record<string, unknown>): string {\n return JSON.stringify(\n Object.keys(value)\n .sort()\n .reduce<Record<string, unknown>>((result, key) => {\n result[key] = value[key]\n return result\n }, {}),\n )\n}\n\nfunction stableStringifyOptions(options: FieldPropertyOptionState): string {\n const normalized: Record<string, unknown> = {}\n for (const key of Object.keys(options).sort()) {\n normalized[key] = options[key]?.map((option) => ({\n label: option.label,\n value: option.value,\n disabled: option.disabled,\n }))\n }\n\n return JSON.stringify(normalized)\n}\n","import type { ResourceField, ViewNode } from '@sparqjs/schema-protocol'\nimport { canContainViewNode, isContainerNodeType } from '../shared/view-node'\n\n/** 资源树使用的节点语义分类,不替代 ViewNode.type。 */\nexport type ResourceTreeNodeKind = 'field' | 'container' | 'layout' | 'view'\n/** 拖放命中位置;inner 表示改变父级,其余表示兄弟排序。 */\nexport type ResourceTreeDropPosition = 'before' | 'after' | 'inner'\n\n/** 资源树展示模型,组合协议信息与当前可执行移动状态。 */\nexport interface ResourceTreeItem {\n id: string\n nodeId?: string\n label: string\n type: string\n kind: ResourceTreeNodeKind\n name?: string\n dataType?: string\n component?: string\n multiple?: boolean\n virtual?: boolean\n conditional?: boolean\n childCount?: number\n parentId?: string\n index?: number\n canMoveUp?: boolean\n canMoveDown?: boolean\n canMoveIn?: boolean\n canMoveOut?: boolean\n selectable?: boolean\n editable?: boolean\n movable?: boolean\n copyable?: boolean\n deletable?: boolean\n disabled?: boolean\n children?: ResourceTreeItem[]\n}\n\n/** 将 ViewNode、字段元数据和移动状态组合成资源树展示模型。 */\nexport function createResourceTreeItem(input: {\n node: ViewNode\n index: number\n label: string\n field?: ResourceField\n parentId?: string\n canMoveUp: boolean\n canMoveDown: boolean\n canMoveIn?: boolean\n canMoveOut?: boolean\n selectable?: boolean\n editable?: boolean\n movable?: boolean\n copyable?: boolean\n deletable?: boolean\n children?: ResourceTreeItem[]\n}): ResourceTreeItem {\n const { node, field } = input\n const nodeId = node.id\n\n return {\n id: nodeId || `node:${input.index}`,\n nodeId,\n label: input.label,\n type: node.type || 'node',\n kind: resolveResourceTreeNodeKind(node),\n name: field?.name ?? node.name,\n dataType: field?.type,\n component: resolveResourceTreeComponentLabel(node),\n multiple: isMultipleTreeNode(node, field),\n virtual: isVirtualField(field),\n conditional: isConditionalTreeNode(node),\n childCount: node.children?.length ?? 0,\n parentId: input.parentId,\n index: input.index,\n canMoveUp: input.canMoveUp,\n canMoveDown: input.canMoveDown,\n canMoveIn: input.canMoveIn ?? false,\n canMoveOut: input.canMoveOut ?? false,\n selectable: input.selectable ?? true,\n editable: input.editable ?? true,\n movable: input.movable ?? true,\n copyable: input.copyable ?? true,\n deletable: input.deletable ?? true,\n disabled: input.selectable === false,\n children: input.children,\n }\n}\n\n/** 判断父子节点协议是否允许嵌套,tabs 和 collapse 只接受各自的专用子节点。 */\nexport function canNestResourceTreeNode(\n parent: Pick<ResourceTreeItem, 'type'>,\n child: Pick<ResourceTreeItem, 'type'>,\n): boolean {\n return canContainViewNode(parent, child)\n}\n\n/** 校验资源树拖放位置;跨父级移动必须使用 inner,兄弟排序必须保持同一父级。 */\nexport function canDropResourceTreeItem(\n dragging: ResourceTreeItem | undefined,\n drop: ResourceTreeItem | undefined,\n position: ResourceTreeDropPosition,\n): boolean {\n if (!dragging?.nodeId || !drop?.nodeId) {\n return false\n }\n\n if (position === 'inner') {\n return canNestResourceTreeNode(drop, dragging)\n }\n\n return dragging.parentId === drop.parentId && canPlaceResourceTreeSibling(dragging, drop)\n}\n\n/** 判断节点能否成为指定父级的直接子节点,根级拒绝 tab 和 collapse-item。 */\nexport function canContainResourceTreeChild(\n parent: Pick<ResourceTreeItem, 'type'> | undefined,\n child: Pick<ResourceTreeItem, 'type'>,\n): boolean {\n return canContainViewNode(parent, child)\n}\n\n/** 将协议节点类型归为资源树使用的字段、容器、布局或视图类别。 */\nexport function resolveResourceTreeNodeKind(node: Pick<ViewNode, 'type'>): ResourceTreeNodeKind {\n if (node.type === 'field') {\n return 'field'\n }\n if (node.type === 'view') {\n return 'view'\n }\n if (isContainerNodeType(node.type)) {\n return 'container'\n }\n\n return 'layout'\n}\n\n/** 返回资源树节点类别的用户可读中文标签。 */\nexport function resolveResourceTreeKindLabel(kind: ResourceTreeNodeKind): string {\n switch (kind) {\n case 'field':\n return '字段'\n case 'container':\n return '容器'\n case 'view':\n return '视图'\n case 'layout':\n return '布局'\n }\n}\n\nfunction canPlaceResourceTreeSibling(dragging: ResourceTreeItem, drop: ResourceTreeItem): boolean {\n if (drop.parentId === undefined) {\n return dragging.type !== 'tab' && dragging.type !== 'collapse-item'\n }\n\n return true\n}\n\nfunction resolveResourceTreeComponentLabel(node: ViewNode): string {\n if (node.type === 'field') {\n return node.component || 'field'\n }\n if (node.type === 'view') {\n return typeof node.mode === 'string' ? `${node.type}:${node.mode}` : node.type\n }\n\n return node.type\n}\n\nfunction isMultipleTreeNode(node: ViewNode, field: ResourceField | undefined): boolean {\n return (\n field?.multiple === true ||\n node.props?.multiple === true ||\n ['multi-select', 'checkbox'].includes(node.component ?? '')\n )\n}\n\nfunction isVirtualField(field: ResourceField | undefined): boolean {\n return field?.persisted !== true || Boolean(field?.computed_expr)\n}\n\nfunction isConditionalTreeNode(node: ViewNode): boolean {\n return Boolean(node.show_when)\n}\n","import { defineComponent, h, inject, nextTick, onBeforeUnmount, ref, watch, type PropType } from 'vue'\nimport { createSchemaRuntime, type SchemaRuntime } from '@sparqjs/schema-core'\nimport {\n SPARQ_SCHEMA_RENDERER_KEY,\n SPARQ_SCHEMA_RUNTIME_KEY,\n SPARQ_SCHEMA_UI_ADAPTER_KEY,\n SPARQ_UI_KIT_KEY,\n SparqView,\n type SchemaComponentRegistry,\n type SchemaRenderer,\n type SparqRichTextRegistry,\n type SchemaUiAdapter,\n type UiKit,\n} from '@sparqjs/schema-vue'\nimport type { ViewNode } from '@sparqjs/schema-protocol'\nimport type { DraftState } from '../state/types'\nimport {\n copySelectedNode,\n canPlaceDesignerNode,\n formatSchema,\n getFields,\n getFormChildren,\n getFormView,\n getDesignerNodePermissions,\n getNodeById,\n getNodeMoveAvailability,\n getSelectedNode,\n moveNodeIntoParentEnd,\n moveNodeOutOfParent,\n moveNodeToParent,\n moveSelectedNode,\n removeSelectedNode,\n selectNode,\n} from '../state/draft'\nimport { renderNodeActionIcon } from '../shared/icons'\nimport {\n createDesignerElementPlusSchemaUi,\n createDesignerElementPlusUiAdapter,\n createDesignerElementPlusUiKit,\n} from '../shared/ui-adapter'\nimport {\n canContainResourceTreeChild,\n createResourceTreeItem,\n resolveResourceTreeKindLabel,\n type ResourceTreeItem,\n} from './resource-tree-model'\n\n/** 展示当前草稿 JSON,只提供检查能力,不直接编辑或写回 schema。 */\nexport const JsonDialog = defineComponent({\n name: 'SparqDesignerJsonDialog',\n props: {\n state: {\n type: Object as PropType<DraftState>,\n required: true,\n },\n },\n setup(props) {\n const ui = createDesignerElementPlusSchemaUi()\n\n return () =>\n props.state.jsonOpen\n ? ui.dialog(\n {\n modelValue: props.state.jsonOpen,\n title: 'JSON 预览',\n width: '1080px',\n class: 'sparq-designer-json-dialog',\n 'onUpdate:modelValue'(value: boolean) {\n props.state.jsonOpen = value\n },\n },\n {\n default: () => (\n <pre class='sparq-designer-json-viewer'>{formatSchema(props.state.schema)}</pre>\n ),\n },\n )\n : undefined\n },\n})\n\n/** 使用宿主真实渲染上下文预览草稿,并跟随设计器设备模式调整画布宽度。 */\nexport const PreviewDialog = defineComponent({\n name: 'SparqDesignerPreviewDialog',\n props: {\n state: {\n type: Object as PropType<DraftState>,\n required: true,\n },\n components: Object as PropType<SchemaComponentRegistry>,\n richTextEditors: Object as PropType<SparqRichTextRegistry>,\n },\n setup(props) {\n const renderContext = resolvePreviewRenderContext({\n renderer: inject(SPARQ_SCHEMA_RENDERER_KEY, undefined),\n runtime: inject(SPARQ_SCHEMA_RUNTIME_KEY, undefined),\n uiAdapter: inject(SPARQ_SCHEMA_UI_ADAPTER_KEY, undefined),\n uiKit: inject(SPARQ_UI_KIT_KEY, undefined),\n })\n const ui = createDesignerElementPlusSchemaUi()\n const previewReadyToMount = ref(false)\n let mountRevision = 0\n let firstFrame: number | undefined\n let secondFrame: number | undefined\n\n const cancelScheduledMount = () => {\n if (typeof cancelAnimationFrame !== 'function') {\n return\n }\n if (firstFrame !== undefined) {\n cancelAnimationFrame(firstFrame)\n firstFrame = undefined\n }\n if (secondFrame !== undefined) {\n cancelAnimationFrame(secondFrame)\n secondFrame = undefined\n }\n }\n const schedulePreviewMount = (revision: number) => {\n const mount = () => {\n if (revision === mountRevision && props.state.previewOpen) {\n previewReadyToMount.value = true\n void nextTick(() => {\n if (revision === mountRevision && props.state.previewOpen) {\n props.state.previewLoading = false\n }\n })\n }\n }\n if (typeof requestAnimationFrame !== 'function') {\n void nextTick(mount)\n return\n }\n firstFrame = requestAnimationFrame(() => {\n firstFrame = undefined\n secondFrame = requestAnimationFrame(() => {\n secondFrame = undefined\n mount()\n })\n })\n }\n watch(\n () => props.state.previewOpen,\n (open) => {\n const revision = ++mountRevision\n cancelScheduledMount()\n previewReadyToMount.value = false\n if (!open) {\n props.state.previewLoading = false\n return\n }\n props.state.previewLoading = true\n schedulePreviewMount(revision)\n },\n { immediate: true, flush: 'sync' },\n )\n\n onBeforeUnmount(() => {\n mountRevision += 1\n cancelScheduledMount()\n props.state.previewLoading = false\n })\n\n return () =>\n props.state.previewOpen\n ? ui.dialog(\n {\n modelValue: props.state.previewOpen,\n title: '预览表单',\n width:\n props.state.device === 'pc' ? '1200px' : props.state.device === 'pad' ? '840px' : '460px',\n class: 'sparq-designer-preview-dialog',\n 'onUpdate:modelValue'(value: boolean) {\n props.state.previewOpen = value\n if (!value) {\n props.state.previewLoading = false\n }\n },\n },\n {\n default: () =>\n previewReadyToMount.value ? (\n <div class={['sparq-designer-preview', `is-${props.state.device}`]}>\n <SparqView\n schema={props.state.schema}\n mode='form'\n view={props.state.viewName}\n applyDefaults\n runtime={renderContext.runtime}\n uiAdapter={renderContext.uiAdapter}\n uiKit={renderContext.uiKit}\n components={props.components}\n icons={props.state.extensionContext?.icons}\n richTextEditors={props.richTextEditors}\n />\n </div>\n ) : (\n <div class='sparq-designer-preview-loading' role='status' aria-live='polite'>\n <span class='sparq-designer-preview-loading__spinner' aria-hidden='true'></span>\n <span>正在加载预览…</span>\n </div>\n ),\n },\n )\n : undefined\n },\n})\n\ninterface PreviewRenderContextInput {\n renderer?: Pick<SchemaRenderer, 'runtime' | 'uiAdapter' | 'uiKit'>\n runtime?: SchemaRuntime\n uiAdapter?: SchemaUiAdapter\n uiKit?: UiKit\n}\n\n/** Preview 优先复用宿主渲染上下文,仅在 Designer 独立运行时创建本地兜底。 */\nexport function resolvePreviewRenderContext(input: PreviewRenderContextInput): {\n runtime: SchemaRuntime\n uiAdapter: SchemaUiAdapter\n uiKit: UiKit\n} {\n return {\n runtime: input.runtime ?? input.renderer?.runtime ?? createSchemaRuntime(),\n uiAdapter: input.uiAdapter ?? input.renderer?.uiAdapter ?? createDesignerElementPlusUiAdapter(),\n uiKit: input.uiKit ?? input.renderer?.uiKit ?? createDesignerElementPlusUiKit(),\n }\n}\n\n/** 以树结构展示并调整当前表单节点层级,移动操作仍通过统一 DraftState 事务提交。 */\nexport const ResourceTreeDialog = defineComponent({\n name: 'SparqDesignerResourceTreeDialog',\n props: {\n state: {\n type: Object as PropType<DraftState>,\n required: true,\n },\n },\n setup(props) {\n const ui = createDesignerElementPlusSchemaUi()\n const scrollSelectedNodeIntoView = () => {\n const selectedId = resolveSelectedNodeId(props.state)\n if (!props.state.resourceTreeOpen || !selectedId) {\n return\n }\n\n void nextTick(() => scrollResourceTreeNodeIntoView(selectedId))\n }\n\n watch(\n () => [\n props.state.resourceTreeOpen,\n props.state.selection?.type === 'form-node' ? props.state.selection.path : '',\n ],\n scrollSelectedNodeIntoView,\n { flush: 'post' },\n )\n\n return () => {\n if (!props.state.resourceTreeOpen) {\n return undefined\n }\n\n const nodes = getFormChildren(props.state.schema, props.state.viewName)\n const title =\n getFormView(props.state.schema, props.state.viewName).title ||\n props.state.schema.schema.title ||\n '当前表单'\n const drawerTitle = `${title}资源`\n const selected = getSelectedNode(props.state)\n const formRootId = `form:${props.state.viewName}`\n const treeData = createResourceTreeData(props.state, nodes)\n\n return ui.drawer(\n {\n modelValue: true,\n title: drawerTitle,\n direction: 'ltr',\n size: 'min(520px, calc(100vw - 24px))',\n class: 'sparq-designer-resource-drawer',\n appendToBody: true,\n 'data-sparq-designer-resource-drawer': '',\n 'onUpdate:modelValue'(value: boolean) {\n props.state.resourceTreeOpen = value\n },\n },\n {\n default: () => (\n <div class='sparq-designer-resource-tree'>\n {nodes.length > 0 ? (\n ui.tree(\n {\n data: [\n {\n id: formRootId,\n label: title,\n type: 'form',\n disabled: true,\n children: treeData,\n },\n ],\n nodeKey: 'id',\n defaultExpandAll: true,\n defaultExpandedKeys: resolveResourceTreeExpandedKeys(\n formRootId,\n treeData,\n selected?.id,\n ),\n draggable: true,\n highlightCurrent: true,\n expandOnClickNode: false,\n currentNodeKey: selected?.id,\n props: {\n label: 'label',\n children: 'children',\n disabled: 'disabled',\n },\n onNodeClick(data: ResourceTreeItem) {\n if (data.nodeId) {\n selectNode(props.state, data.nodeId)\n }\n },\n allowDrag(node: ResourceTreeDragNode) {\n const item = resolveResourceTreeDragItem(node)\n return Boolean(item?.nodeId && item.movable)\n },\n allowDrop(\n draggingNode: ResourceTreeDragNode,\n dropNode: ResourceTreeDragNode,\n type: ResourceTreeDropType,\n ) {\n return canDropResourceTreeNode(props.state, draggingNode, dropNode, type)\n },\n onNodeDrop(\n draggingNode: ResourceTreeDragNode,\n dropNode: ResourceTreeDragNode,\n type: ResourceTreeDropType,\n ) {\n dropResourceTreeNode(props.state, draggingNode, dropNode, type)\n },\n 'data-sparq-designer-resource-tree': '',\n },\n {\n default: (scope: { data: ResourceTreeItem }) =>\n renderResourceTreeNode(props.state, scope.data),\n },\n )\n ) : (\n <div class='sparq-designer-empty'>当前舞台还没有节点。</div>\n )}\n </div>\n ),\n },\n )\n }\n },\n})\n\ntype ResourceTreeDropType = 'before' | 'after' | 'inner'\ntype ResourceTreeDragNode = ResourceTreeItem | { data?: ResourceTreeItem }\n\nfunction createResourceTreeData(\n state: DraftState,\n nodes: ViewNode[],\n parentId?: string,\n ancestors: ViewNode[] = [],\n): ResourceTreeItem[] {\n const fields = getFields(state.schema)\n\n return nodes.map((node, index) => {\n const nodeId = node.id\n const field = node.field ? fields.find((item) => item.name === node.field) : undefined\n const move = nodeId\n ? getNodeMoveAvailability(state, nodeId, { respectVisibility: false })\n : { canMoveUp: false, canMoveDown: false }\n const permissions = nodeId ? getDesignerNodePermissions(state, nodeId) : undefined\n\n return createResourceTreeItem({\n node,\n index,\n label: resolveTreeNodeLabel(state, node),\n field,\n parentId,\n canMoveUp: Boolean(permissions?.movable && move.canMoveUp),\n canMoveDown: Boolean(permissions?.movable && move.canMoveDown),\n canMoveIn: Boolean(permissions?.movable && canMoveResourceTreeNodeIn(state, nodes, index)),\n canMoveOut: Boolean(permissions?.movable && canMoveResourceTreeNodeOut(state, node, ancestors)),\n selectable: permissions?.selectable,\n editable: permissions?.editable,\n movable: Boolean(permissions?.selectable && permissions.movable),\n copyable: Boolean(permissions?.selectable && permissions.copyable),\n deletable: Boolean(permissions?.selectable && permissions.deletable),\n children: node.children?.length\n ? createResourceTreeData(state, node.children, nodeId, [...ancestors, node])\n : undefined,\n })\n })\n}\n\nfunction renderResourceTreeNode(state: DraftState, item: ResourceTreeItem) {\n return (\n <div class='sparq-designer-resource-tree-node' data-sparq-designer-resource-tree-node-id={item.nodeId}>\n <div class='sparq-designer-resource-tree-node__main'>\n <span class='sparq-designer-resource-tree-node__label'>{item.label}</span>\n <span class='sparq-designer-resource-tree-node__tags'>\n <span class={['sparq-designer-resource-tree-node__tag', `is-${item.kind}`]}>\n {resolveResourceTreeKindLabel(item.kind)}\n </span>\n {item.conditional ? (\n <span class='sparq-designer-resource-tree-node__tag is-conditional'>条件</span>\n ) : undefined}\n {item.virtual ? (\n <span class='sparq-designer-resource-tree-node__tag is-virtual'>virtual</span>\n ) : undefined}\n {item.multiple ? <span class='sparq-designer-resource-tree-node__tag'>multi</span> : undefined}\n {item.editable === false ? (\n <span class='sparq-designer-resource-tree-node__tag is-readonly'>\n {renderNodeActionIcon('lock')}\n 只读\n </span>\n ) : undefined}\n {item.childCount ? (\n <span class='sparq-designer-resource-tree-node__tag is-count'>{item.childCount}</span>\n ) : undefined}\n </span>\n {item.nodeId ? renderResourceTreeNodeActions(state, item) : undefined}\n </div>\n <div class='sparq-designer-resource-tree-node__meta'>\n {item.name ? <span title='字段名'>{item.name}</span> : undefined}\n {item.dataType ? <span title='数据类型'>{item.dataType}</span> : undefined}\n {item.component ? <span title='组件类型'>{item.component}</span> : undefined}\n </div>\n </div>\n )\n}\n\nfunction renderResourceTreeNodeActions(state: DraftState, item: ResourceTreeItem) {\n return (\n <span class='sparq-designer-resource-tree-node__actions'>\n {item.movable ? (\n <span class='sparq-designer-resource-tree-node__move-actions'>\n <button\n type='button'\n title='上移'\n aria-label='上移'\n disabled={!item.canMoveUp}\n onClick={(event: MouseEvent) => moveResourceTreeNode(event, state, item, -1)}\n >\n {renderNodeActionIcon('up')}\n </button>\n <button\n type='button'\n title='下移'\n aria-label='下移'\n disabled={!item.canMoveDown}\n onClick={(event: MouseEvent) => moveResourceTreeNode(event, state, item, 1)}\n >\n {renderNodeActionIcon('down')}\n </button>\n <button\n type='button'\n title='移入'\n aria-label='移入'\n disabled={!item.canMoveIn}\n onClick={(event: MouseEvent) => moveResourceTreeNodeIn(event, state, item)}\n >\n {renderNodeActionIcon('indent')}\n </button>\n <button\n type='button'\n title='移出'\n aria-label='移出'\n disabled={!item.canMoveOut}\n onClick={(event: MouseEvent) => moveResourceTreeNodeOut(event, state, item)}\n >\n {renderNodeActionIcon('outdent')}\n </button>\n </span>\n ) : undefined}\n {item.copyable ? (\n <button\n type='button'\n title='复制'\n aria-label='复制'\n onClick={(event: MouseEvent) => copyResourceTreeNode(event, state, item)}\n >\n {renderNodeActionIcon('copy')}\n </button>\n ) : undefined}\n {item.deletable ? (\n <button\n type='button'\n title='删除'\n aria-label='删除'\n onClick={(event: MouseEvent) => removeResourceTreeNode(event, state, item)}\n >\n {renderNodeActionIcon('remove')}\n </button>\n ) : undefined}\n </span>\n )\n}\n\nfunction moveResourceTreeNode(event: MouseEvent, state: DraftState, item: ResourceTreeItem, direction: -1 | 1): void {\n event.preventDefault()\n event.stopPropagation()\n if (!item.nodeId || (direction < 0 && !item.canMoveUp) || (direction > 0 && !item.canMoveDown)) {\n return\n }\n if (!selectNode(state, item.nodeId)) {\n return\n }\n moveSelectedNode(state, direction, { respectVisibility: false })\n}\n\nfunction moveResourceTreeNodeIn(event: MouseEvent, state: DraftState, item: ResourceTreeItem): void {\n event.preventDefault()\n event.stopPropagation()\n const target = resolveMoveInTarget(state, item)\n if (!item.nodeId || !target?.id) {\n return\n }\n\n if (!selectNode(state, item.nodeId)) {\n return\n }\n moveNodeIntoParentEnd(state, item.nodeId, target.id)\n}\n\nfunction moveResourceTreeNodeOut(event: MouseEvent, state: DraftState, item: ResourceTreeItem): void {\n event.preventDefault()\n event.stopPropagation()\n if (!item.nodeId || !resolveCanMoveOut(state, item.nodeId)) {\n return\n }\n\n if (!selectNode(state, item.nodeId)) {\n return\n }\n moveNodeOutOfParent(state, item.nodeId)\n}\n\nfunction copyResourceTreeNode(event: MouseEvent, state: DraftState, item: ResourceTreeItem): void {\n event.preventDefault()\n event.stopPropagation()\n if (!item.nodeId) {\n return\n }\n\n if (!selectNode(state, item.nodeId)) {\n return\n }\n copySelectedNode(state)\n}\n\nfunction removeResourceTreeNode(event: MouseEvent, state: DraftState, item: ResourceTreeItem): void {\n event.preventDefault()\n event.stopPropagation()\n if (!item.nodeId) {\n return\n }\n\n if (!selectNode(state, item.nodeId)) {\n return\n }\n removeSelectedNode(state)\n}\n\nfunction canDropResourceTreeNode(\n state: DraftState,\n draggingNode: ResourceTreeDragNode,\n dropNode: ResourceTreeDragNode,\n type: ResourceTreeDropType,\n): boolean {\n const dragging = resolveResourceTreeDragItem(draggingNode)\n const drop = resolveResourceTreeDragItem(dropNode)\n if (!dragging?.nodeId || !drop?.nodeId || dragging.nodeId === drop.nodeId) {\n return false\n }\n\n const targetParent = resolveResourceTreeDropParent(state, drop, type)\n if (targetParent?.id && isResourceTreeDescendant(state, dragging.nodeId, targetParent.id)) {\n return false\n }\n\n const node = getNodeById(getFormChildren(state.schema, state.viewName), dragging.nodeId)\n return Boolean(\n dragging.movable &&\n node &&\n canContainResourceTreeChild(targetParent, dragging) &&\n canPlaceDesignerNode(state, node, targetParent?.id),\n )\n}\n\nfunction dropResourceTreeNode(\n state: DraftState,\n draggingNode: ResourceTreeDragNode,\n dropNode: ResourceTreeDragNode,\n type: ResourceTreeDropType,\n): void {\n if (!canDropResourceTreeNode(state, draggingNode, dropNode, type)) {\n return\n }\n\n const dragging = resolveResourceTreeDragItem(draggingNode)\n const drop = resolveResourceTreeDragItem(dropNode)\n if (!dragging?.nodeId || !drop?.nodeId) {\n return\n }\n\n if (type === 'inner') {\n const parent = getNodeById(getFormChildren(state.schema, state.viewName), drop.nodeId)\n moveNodeToParent(state, dragging.nodeId, drop.nodeId, parent?.children?.length ?? 0)\n return\n }\n\n if (drop.index === undefined) {\n return\n }\n\n moveNodeToParent(state, dragging.nodeId, drop.parentId, type === 'after' ? drop.index + 1 : drop.index)\n}\n\nfunction resolveResourceTreeDragItem(node: ResourceTreeDragNode | undefined): ResourceTreeItem | undefined {\n if (!node) {\n return undefined\n }\n if ('data' in node) {\n return node.data\n }\n\n return node as ResourceTreeItem\n}\n\nfunction resolveResourceTreeDropParent(\n state: DraftState,\n drop: ResourceTreeItem,\n type: ResourceTreeDropType,\n): ViewNode | undefined {\n const roots = getFormChildren(state.schema, state.viewName)\n if (type === 'inner') {\n return drop.nodeId ? getNodeById(roots, drop.nodeId) : undefined\n }\n\n return drop.parentId ? getNodeById(roots, drop.parentId) : undefined\n}\n\nfunction isResourceTreeDescendant(state: DraftState, nodeId: string, targetId: string): boolean {\n const node = getNodeById(getFormChildren(state.schema, state.viewName), nodeId)\n if (!node) {\n return false\n }\n\n return Boolean(getNodeById(node.children ?? [], targetId))\n}\n\nfunction resolveTreeNodeLabel(state: DraftState, node: ViewNode): string {\n if (node.title) {\n return node.title\n }\n if (node.field) {\n return getFields(state.schema).find((field) => field.name === node.field)?.label || node.field\n }\n\n return node.component || node.type || '未命名节点'\n}\n\nfunction canMoveResourceTreeNodeIn(state: DraftState, siblings: ViewNode[], index: number): boolean {\n const node = siblings[index]\n const previous = siblings[index - 1]\n if (!node?.id || !previous?.id) {\n return false\n }\n\n return canContainResourceTreeChild(previous, node) && canPlaceDesignerNode(state, node, previous.id)\n}\n\nfunction canMoveResourceTreeNodeOut(state: DraftState, node: ViewNode, ancestors: ViewNode[]): boolean {\n const parent = ancestors.at(-1)\n if (!node.id || !parent?.id) {\n return false\n }\n\n const nextParent = ancestors.at(-2)\n return canContainResourceTreeChild(nextParent, node) && canPlaceDesignerNode(state, node, nextParent?.id)\n}\n\nfunction resolveMoveInTarget(state: DraftState, item: ResourceTreeItem): ViewNode | undefined {\n if (!item.nodeId) {\n return undefined\n }\n\n const location = findViewNodeLocation(getFormChildren(state.schema, state.viewName), item.nodeId)\n const previous = location ? location.siblings[location.index - 1] : undefined\n if (!previous?.id || !canContainResourceTreeChild(previous, location?.node ?? item)) {\n return undefined\n }\n\n return previous\n}\n\nfunction resolveCanMoveOut(state: DraftState, nodeId: string): boolean {\n const roots = getFormChildren(state.schema, state.viewName)\n const location = findViewNodeLocation(roots, nodeId)\n if (!location?.parentId) {\n return false\n }\n\n const parent = getNodeById(roots, location.parentId)\n if (!parent?.id) {\n return false\n }\n\n const parentLocation = findViewNodeLocation(roots, parent.id)\n return canContainResourceTreeChild(\n parentLocation?.parentId ? getNodeById(roots, parentLocation.parentId) : undefined,\n location.node,\n )\n}\n\nfunction findViewNodeLocation(\n nodes: ViewNode[],\n nodeId: string,\n parentId?: string,\n): { parentId?: string; siblings: ViewNode[]; index: number; node: ViewNode } | undefined {\n for (let index = 0; index < nodes.length; index += 1) {\n const node = nodes[index]\n if (!node) {\n continue\n }\n if (node.id === nodeId) {\n return { parentId, siblings: nodes, index, node }\n }\n\n const child = findViewNodeLocation(node.children ?? [], nodeId, node.id)\n if (child) {\n return child\n }\n }\n\n return undefined\n}\n\nfunction resolveResourceTreeExpandedKeys(\n rootId: string,\n nodes: ResourceTreeItem[],\n selectedId: string | undefined,\n): string[] {\n if (!selectedId) {\n return [rootId]\n }\n\n const ancestors = findResourceTreeAncestorIds(nodes, selectedId)\n return ancestors ? [rootId, ...ancestors] : [rootId]\n}\n\nfunction findResourceTreeAncestorIds(\n nodes: ResourceTreeItem[],\n selectedId: string,\n ancestors: string[] = [],\n): string[] | undefined {\n for (const node of nodes) {\n if (node.nodeId === selectedId) {\n return ancestors\n }\n\n const nextAncestors = node.nodeId ? [...ancestors, node.nodeId] : ancestors\n const childAncestors = findResourceTreeAncestorIds(node.children ?? [], selectedId, nextAncestors)\n if (childAncestors) {\n return childAncestors\n }\n }\n\n return undefined\n}\n\nfunction resolveSelectedNodeId(state: DraftState): string | undefined {\n return state.selection?.type === 'form-node' ? state.selection.path : undefined\n}\n\nfunction scrollResourceTreeNodeIntoView(nodeId: string): void {\n if (typeof document === 'undefined') {\n return\n }\n\n const selector = `[data-sparq-designer-resource-tree-node-id=\"${escapeAttributeSelector(nodeId)}\"]`\n const element = document.querySelector(selector)\n element?.scrollIntoView({\n block: 'nearest',\n })\n}\n\nfunction escapeAttributeSelector(value: string): string {\n return value.replace(/\\\\/g, '\\\\\\\\').replace(/\"/g, '\\\\\"')\n}\n","import type { SchemaResource, ViewNode } from '@sparqjs/schema-protocol'\nimport { createSchemaComponentRegistry, type SchemaComponent, type SchemaComponentRegistry } from '@sparqjs/schema-vue'\nimport { h } from 'vue'\nimport type { DesignerExtensionContext } from '../extensions/context'\nimport { getDesignerComponentPropertyConfig } from '../inspector/field-schema'\nimport { getFormChildren } from '../state/draft'\n\n/**\n * 创建当前设计器画布专用的运行时组件 registry。\n *\n * schema 引用了缺失插件组件时会注册不可用占位,保证节点仍可选中和修复。\n */\nexport function createDesignerCanvasComponentRegistry(\n schema: SchemaResource,\n viewName: string,\n components?: SchemaComponentRegistry,\n extensionContext?: DesignerExtensionContext,\n): SchemaComponentRegistry {\n const entries = [...(components?.entries() ?? [])]\n for (const component of collectUnavailableComponents(\n getFormChildren(schema, viewName),\n components,\n extensionContext,\n )) {\n entries.push([component, createUnavailableComponent(component)])\n }\n return createSchemaComponentRegistry(entries)\n}\n\nfunction collectUnavailableComponents(\n nodes: ViewNode[],\n components: SchemaComponentRegistry | undefined,\n extensionContext?: DesignerExtensionContext,\n result = new Set<string>(),\n): Set<string> {\n for (const node of nodes) {\n const component = node.type === 'field' ? node.component : undefined\n const config =\n extensionContext?.getComponentPropertyConfig(component) ?? getDesignerComponentPropertyConfig(component)\n if (\n component &&\n !components?.has(component) &&\n (!config || extensionContext?.hasExtensionComponentProperty(component))\n ) {\n result.add(component)\n }\n collectUnavailableComponents(node.children ?? [], components, extensionContext, result)\n }\n return result\n}\n\nfunction createUnavailableComponent(component: string): SchemaComponent {\n return {\n render() {\n return h(\n 'div',\n {\n class: 'sparq-designer-unavailable-component',\n role: 'status',\n },\n '组件不可用:' + component,\n )\n },\n }\n}\n","import { computed, defineComponent, h, inject, onScopeDispose, reactive, watch, type PropType } from 'vue'\nimport type { SchemaResource } from '@sparqjs/schema-protocol'\nimport {\n SPARQ_RICH_TEXT_REGISTRY_KEY,\n SPARQ_SCHEMA_RENDERER_KEY,\n createDefaultRichTextRegistry,\n} from '@sparqjs/schema-vue'\nimport type { RootProps } from '../state/types'\nimport {\n createState,\n cloneSchema,\n createDesignerOutputSchema,\n formatSchema,\n isDesignerHistorySnapshotAllowed,\n parseSchema,\n prepareDraftSchema,\n resolveDesignerServiceRegistry,\n} from '../state/draft'\nimport { createDesignerExtensionContext, type DesignerExtensionContext } from '../extensions/context'\nimport { resolveDesignerFeatures } from '../extensions/instance'\nimport { Toolbar } from './toolbar'\nimport { Sidebar } from '../sidebar/sidebar'\nimport { Canvas } from '../canvas/canvas'\nimport { Inspector } from '../inspector/inspector'\nimport { JsonDialog, PreviewDialog, ResourceTreeDialog } from '../dialogs/dialogs'\nimport { createDesignerCanvasComponentRegistry } from '../shared/component-registry'\n\n/**\n * 设计器根组件。\n *\n * 它负责实例扩展解析、草稿状态生命周期和三栏工作区编排,不承载具体属性业务规则。\n */\nexport const Shell = defineComponent({\n name: 'SparqDesignerShell',\n props: {\n schema: {\n type: Object as PropType<SchemaResource>,\n required: true,\n },\n view: {\n type: String,\n default: 'default',\n },\n services: [Object, Array] as PropType<RootProps['services']>,\n components: Object as PropType<RootProps['components']>,\n icons: Object as PropType<RootProps['icons']>,\n richTextEditors: Object as PropType<RootProps['richTextEditors']>,\n extensions: Array as PropType<RootProps['extensions']>,\n materialKeys: Array as PropType<RootProps['materialKeys']>,\n nodePermissions: Function as PropType<RootProps['nodePermissions']>,\n outputScope: {\n type: String as PropType<NonNullable<RootProps['outputScope']>>,\n default: 'resource',\n },\n features: Object as PropType<RootProps['features']>,\n onSave: Function as PropType<RootProps['onSave']>,\n onSaveError: Function as PropType<RootProps['onSaveError']>,\n onChange: Function as PropType<RootProps['onChange']>,\n onDirtyChange: Function as PropType<RootProps['onDirtyChange']>,\n },\n setup(props, context) {\n const injectedRenderer = inject(SPARQ_SCHEMA_RENDERER_KEY, undefined)\n const injectedRichTextEditors = inject(SPARQ_RICH_TEXT_REGISTRY_KEY, undefined)\n const standaloneRichTextEditors = createDefaultRichTextRegistry()\n const richTextEditors = computed(\n () =>\n props.richTextEditors ??\n injectedRichTextEditors ??\n injectedRenderer?.richTextEditors ??\n standaloneRichTextEditors,\n )\n const extensionContext = computed(() =>\n createDesignerExtensionContext(props.extensions, props.components, props.services, props.icons, {\n materialKeys: props.materialKeys,\n nodePermissions: props.nodePermissions,\n }),\n )\n const state = reactive(\n createState(props.schema, props.view, extensionContext.value.services, extensionContext.value),\n )\n const canvasComponents = computed(() =>\n createDesignerCanvasComponentRegistry(\n state.schema,\n state.viewName,\n extensionContext.value.components,\n extensionContext.value,\n ),\n )\n const features = computed(() => resolveDesignerFeatures(props.features))\n\n reportExtensionDiagnostics(extensionContext.value)\n\n let outputFrame: number | undefined\n let outputMicrotaskPending = false\n const notifyOutput = () => {\n props.onChange?.(createOutputSchema(state.schema, props.outputScope))\n }\n const scheduleOutput = () => {\n if (outputFrame !== undefined || outputMicrotaskPending) {\n return\n }\n if (typeof requestAnimationFrame === 'function') {\n outputFrame = requestAnimationFrame(() => {\n outputFrame = undefined\n notifyOutput()\n })\n return\n }\n outputMicrotaskPending = true\n queueMicrotask(() => {\n if (!outputMicrotaskPending) {\n return\n }\n outputMicrotaskPending = false\n notifyOutput()\n })\n }\n\n onScopeDispose(() => {\n if (outputFrame !== undefined) {\n cancelAnimationFrame(outputFrame)\n outputFrame = undefined\n }\n outputMicrotaskPending = false\n })\n\n watch(\n () => props.schema,\n (schema) => {\n const draft = prepareDraftSchema(schema, state.viewName)\n state.schema = draft\n state.schemaVersion += 1\n state.savedSchema = cloneSchema(draft)\n state.history = []\n state.future = []\n },\n )\n\n watch(extensionContext, (context) => {\n state.extensionContext = context\n state.serviceRegistry = resolveDesignerServiceRegistry(context.services)\n state.schemaVersion += 1\n reportExtensionDiagnostics(context)\n })\n\n watch([() => state.schema, () => props.outputScope], scheduleOutput)\n watch(\n () => state.schemaVersion,\n () => props.onDirtyChange?.(!schemasEqual(state.schema, state.savedSchema)),\n { immediate: true },\n )\n\n const save = async () => {\n if (state.saving) {\n return\n }\n state.saving = true\n const draft = cloneSchema(state.schema)\n try {\n const output = createOutputSchema(draft, props.outputScope)\n await props.onSave?.(cloneSchema(output))\n state.savedSchema = draft\n state.future = []\n state.schemaVersion += 1\n } catch (error) {\n if (props.onSaveError) {\n await props.onSaveError(error)\n } else {\n console.error('[sparq-designer] 保存失败', error)\n }\n } finally {\n state.saving = false\n }\n }\n\n context?.expose?.({\n getOutputSchema: () => createOutputSchema(state.schema, props.outputScope),\n })\n\n const exportJson = () => {\n const output = createOutputSchema(state.schema, props.outputScope)\n const blob = new Blob([formatSchema(output)], { type: 'application/json' })\n const url = URL.createObjectURL(blob)\n const link = document.createElement('a')\n link.href = url\n link.download = `${state.schema.schema.name || 'schema'}.json`\n link.click()\n URL.revokeObjectURL(url)\n }\n\n const importJson = () => {\n const input = document.createElement('input')\n input.type = 'file'\n input.accept = 'application/json'\n input.onchange = () => {\n const file = input.files?.[0]\n if (!file) {\n return\n }\n const reader = new FileReader()\n reader.onload = () => {\n const imported = prepareDraftSchema(parseSchema(String(reader.result ?? '{}')), state.viewName)\n const next = prepareDraftSchema(\n createDesignerOutputSchema(imported, props.outputScope),\n state.viewName,\n )\n if (!isDesignerHistorySnapshotAllowed(state, next)) {\n console.warn('[sparq-designer] 导入内容会修改当前只读节点,已拒绝应用')\n return\n }\n state.history.push(cloneSchema(state.schema))\n state.future = []\n state.schema = next\n state.schemaVersion += 1\n }\n reader.readAsText(file)\n }\n input.click()\n }\n\n return () => (\n <div class='sparq-designer'>\n <div class='sparq-designer__body'>\n <Sidebar state={state} showTemplates={features.value.templates} />\n <section class='sparq-designer-center'>\n <Toolbar\n state={state}\n features={features.value}\n onSave={save}\n onExport={exportJson}\n onImport={importJson}\n />\n <Canvas\n state={state}\n components={canvasComponents.value}\n richTextEditors={richTextEditors.value}\n />\n </section>\n <Inspector\n state={state}\n components={extensionContext.value.components}\n richTextEditors={richTextEditors.value}\n showFormProperties={features.value.formProperties}\n />\n </div>\n {features.value.resourceTree ? <ResourceTreeDialog state={state} /> : undefined}\n {features.value.jsonView ? <JsonDialog state={state} /> : undefined}\n {features.value.preview ? (\n <PreviewDialog\n state={state}\n components={extensionContext.value.components}\n richTextEditors={richTextEditors.value}\n />\n ) : undefined}\n </div>\n )\n },\n})\n\nfunction createOutputSchema(\n schema: SchemaResource,\n outputScope: NonNullable<RootProps['outputScope']>,\n): SchemaResource {\n return createDesignerOutputSchema(schema, outputScope)\n}\n\nfunction schemasEqual(left: SchemaResource, right: SchemaResource | undefined): boolean {\n return right !== undefined && JSON.stringify(left) === JSON.stringify(right)\n}\n\nfunction reportExtensionDiagnostics(context: DesignerExtensionContext): void {\n for (const diagnostic of context.diagnostics) {\n console.warn(`[sparq-designer] ${diagnostic.message}`)\n }\n}\n"],"mappings":";;;;;;;AA6CA,IAAa,KAAsE,CAC/E;CACI,KAAK;CACL,MAAM,KAAK,GAAS;EAEhB,QADe,EAAQ,UAAU,EAAQ,QAAQ,OAAO,UAAU,CAAC,GACrD,KAAK,OAAW;GAC1B,OAAO,GAAG,EAAM,SAAS,EAAM,KAAK,GAAG,EAAM,KAAK;GAClD,OAAO,QAAQ,EAAM;GACrB,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