@flowgram-vue/test-run-plugin 0.2.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.
Files changed (46) hide show
  1. package/LICENSE +22 -0
  2. package/dist/index.cjs +765 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.d.ts +408 -0
  5. package/dist/index.js +759 -0
  6. package/dist/index.js.map +1 -0
  7. package/package.json +63 -0
  8. package/src/create-test-run-plugin.ts +39 -0
  9. package/src/env.d.ts +10 -0
  10. package/src/form-engine/contexts.ts +16 -0
  11. package/src/form-engine/fields/create-field.ts +41 -0
  12. package/src/form-engine/fields/general-field.ts +42 -0
  13. package/src/form-engine/fields/index.ts +9 -0
  14. package/src/form-engine/fields/object-field.ts +25 -0
  15. package/src/form-engine/fields/reactive-field.ts +55 -0
  16. package/src/form-engine/fields/recursion-field.ts +28 -0
  17. package/src/form-engine/fields/schema-field.ts +29 -0
  18. package/src/form-engine/form/form.ts +57 -0
  19. package/src/form-engine/form/index.ts +6 -0
  20. package/src/form-engine/hooks/index.ts +8 -0
  21. package/src/form-engine/hooks/use-create-form.ts +63 -0
  22. package/src/form-engine/hooks/use-field.ts +19 -0
  23. package/src/form-engine/hooks/use-form.ts +19 -0
  24. package/src/form-engine/index.ts +19 -0
  25. package/src/form-engine/model/index.ts +89 -0
  26. package/src/form-engine/types.ts +56 -0
  27. package/src/form-engine/utils.ts +69 -0
  28. package/src/index.ts +23 -0
  29. package/src/reactive/hooks/index.ts +7 -0
  30. package/src/reactive/hooks/use-create-form.ts +101 -0
  31. package/src/reactive/hooks/use-test-run-service.ts +10 -0
  32. package/src/reactive/index.ts +6 -0
  33. package/src/services/config.ts +42 -0
  34. package/src/services/form/factory.ts +9 -0
  35. package/src/services/form/form.ts +77 -0
  36. package/src/services/form/index.ts +8 -0
  37. package/src/services/form/manager.ts +43 -0
  38. package/src/services/index.ts +14 -0
  39. package/src/services/pipeline/factory.ts +9 -0
  40. package/src/services/pipeline/index.ts +12 -0
  41. package/src/services/pipeline/pipeline.ts +155 -0
  42. package/src/services/pipeline/plugin.ts +13 -0
  43. package/src/services/pipeline/tap.ts +34 -0
  44. package/src/services/store.ts +27 -0
  45. package/src/services/test-run.ts +108 -0
  46. package/src/types.ts +29 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/services/config.ts","../src/form-engine/utils.ts","../src/form-engine/model/index.ts","../src/form-engine/hooks/use-create-form.ts","../src/form-engine/contexts.ts","../src/form-engine/hooks/use-field.ts","../src/form-engine/hooks/use-form.ts","../src/form-engine/fields/reactive-field.ts","../src/form-engine/fields/object-field.ts","../src/form-engine/fields/general-field.ts","../src/form-engine/fields/recursion-field.ts","../src/form-engine/fields/schema-field.ts","../src/form-engine/fields/create-field.ts","../src/form-engine/form/form.ts","../src/services/form/form.ts","../src/services/form/factory.ts","../src/services/form/manager.ts","../src/services/pipeline/factory.ts","../src/services/test-run.ts","../src/services/pipeline/tap.ts","../src/services/store.ts","../src/services/pipeline/pipeline.ts","../src/create-test-run-plugin.ts","../src/reactive/hooks/use-test-run-service.ts","../src/reactive/hooks/use-create-form.ts"],"names":["inject","useObserve","defineComponent","h","provide","SchemaField","injectable","Emitter","nanoid","useCreateForm","DisposableCollection","onBeforeUnmount"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA8BO,IAAM,aAAA,0BAAuB,eAAe,CAAA;AAC5C,IAAM,YAAA,GAAe,CAAC,MAAA,KAAmC;AAC9D,EAAA,MAAM,aAAA,GAA+B;AAAA,IACnC,YAAY,EAAC;AAAA,IACb,OAAO,EAAC;AAAA,IACR,SAAS;AAAC,GACZ;AACA,EAAA,OAAO;AAAA,IACL,GAAG,aAAA;AAAA,IACH,GAAG;AAAA,GACL;AACF,CAAA;AC/BO,IAAM,kBAAA,GAAqB,CAAA,GAAI,IAAA,KACpC,IAAA,CAAK,MAAA,CAAO,CAAC,IAAA,KAAS,IAAI,CAAA,CAAE,IAAA,CAAK,GAAG,CAAA;AAE/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M,aAAa,IAAIC,oBAAAA;AAAA,QACrB,IAAA,CAAK,aAAA,CAAc,CAAC,IAAA,KAAS;AAC3B,UAAA,SAAA,GAAY,IAAI,CAAA;AAAA,QAClB,CAAC,CAAA;AAAA,QACD,IAAA,CAAK,gBAAgB,MAAM;AACzB,UAAA,WAAA,IAAc;AAAA,QAChB,CAAC;AAAA,OACH;AACA,MAAA,SAAA,CAAU,MAAM,UAAA,CAAW,OAAA,EAAS,CAAA;AAAA,IACtC;AAAA,GACF;AAEA,EAAAC,gBAAgB,MAAM;AACpB,IAAA,IAAA,CAAK,KAAA,GAAQ,IAAA;AAAA,EACf,CAAC,CAAA;AAED,EAAA,OAAO;AAAA,IACL,QAAA;AAAA,IACA,OAAA;AAAA,IACA;AAAA,GACF;AACF","file":"index.js","sourcesContent":["/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport type { FlowNodeType, FlowNodeEntity } from '@flowgram-vue/document';\n\nimport type { MaybePromise } from '../types';\nimport type { FormSchema, FormComponents } from '../form-engine';\nimport type { TestRunPipelinePlugin } from './pipeline';\n\ntype PropertiesFunctionParams = {\n node: FlowNodeEntity;\n};\nexport type NodeMap = Record<FlowNodeType, NodeTestConfig>;\nexport interface NodeTestConfig {\n /** Enable node TestRun */\n enabled?: boolean;\n /** Input schema properties */\n properties?:\n | Record<string, FormSchema>\n | ((params: PropertiesFunctionParams) => MaybePromise<Record<string, FormSchema>>);\n}\n\nexport interface TestRunConfig {\n components: FormComponents;\n nodes: NodeMap;\n plugins: (new () => TestRunPipelinePlugin)[];\n}\n\nexport const TestRunConfig = Symbol('TestRunConfig');\nexport const defineConfig = (config: Partial<TestRunConfig>) => {\n const defaultConfig: TestRunConfig = {\n components: {},\n nodes: {},\n plugins: [],\n };\n return {\n ...defaultConfig,\n ...config,\n };\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { defineComponent, h, type Component } from 'vue';\n\nimport type { FormSchema, FormSchemaValidate, FormComponentProps } from './types';\n\n/** Splice form item unique name */\nexport const getUniqueFieldName = (...args: (string | undefined)[]) =>\n args.filter((path) => path).join('.');\n\nexport const mergeFieldPath = (path?: string[], name?: string) =>\n [...(path || []), name].filter((i): i is string => Boolean(i));\n\n/** Create validation rules */\nexport const createValidate = (schema: FormSchema) => {\n const rules: Record<string, FormSchemaValidate> = {};\n\n visit(schema);\n\n return rules;\n\n function visit(current: FormSchema, name?: string) {\n if (name && current['x-validator']) {\n rules[name] = current['x-validator'];\n }\n if (current.type === 'object' && current.properties) {\n Object.entries(current.properties).forEach(([key, value]) => {\n visit(value, getUniqueFieldName(name, key));\n });\n }\n }\n};\n\nexport const connect = <T = any>(\n Comp: Component,\n mapProps: (p: FormComponentProps) => T\n) => {\n const Connected = defineComponent({\n name: 'ConnectedFormComponent',\n setup(props: FormComponentProps, { slots }) {\n return () => {\n const mappedProps = mapProps(props);\n return h(Comp, mappedProps as any, () => slots.default?.() ?? (mappedProps as any).children);\n };\n },\n });\n\n return Connected;\n};\n\nexport const isFormEmpty = (schema: FormSchema) => {\n /** is not general field and not has children */\n const isEmpty = (s: FormSchema): boolean => {\n if (!s.type || s.type === 'object' || !s.name) {\n return Object.entries(schema.properties || {})\n .map(([key, value]) => ({\n name: key,\n ...value,\n }))\n .every(isFormEmpty);\n }\n return false;\n };\n\n return isEmpty(schema);\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { ReactiveState } from '@flowgram-vue/reactive';\n\nimport { getUniqueFieldName, mergeFieldPath } from '../utils';\nimport { FormSchema, FormSchemaType, FormSchemaModelState } from '../types';\n\nexport class FormSchemaModel implements FormSchema {\n name?: string;\n\n type?: FormSchemaType;\n\n defaultValue?: any;\n\n properties?: Record<string, FormSchema>;\n\n ['x-index']?: number;\n\n ['x-component']?: string;\n\n ['x-component-props']?: Record<string, unknown>;\n\n ['x-decorator']?: string;\n\n ['x-decorator-props']?: Record<string, unknown>;\n\n [key: string]: any;\n\n path: string[] = [];\n\n state = new ReactiveState<FormSchemaModelState>({ disabled: false });\n\n get componentType() {\n return this['x-component'];\n }\n\n get componentProps() {\n return this['x-component-props'];\n }\n\n get decoratorType() {\n return this['x-decorator'];\n }\n\n get decoratorProps() {\n return this['x-decorator-props'];\n }\n\n get uniqueName() {\n return getUniqueFieldName(...this.path);\n }\n\n constructor(json: FormSchema, path: string[] = []) {\n this.fromJSON(json);\n this.path = path;\n }\n\n private fromJSON(json: FormSchema) {\n Object.entries(json).forEach(([key, value]) => {\n this[key] = value;\n });\n }\n\n getPropertyList() {\n const orderProperties: FormSchemaModel[] = [];\n const unOrderProperties: FormSchemaModel[] = [];\n Object.entries(this.properties || {}).forEach(([key, item]) => {\n const index = item['x-index'];\n const defaultValues = this.defaultValue;\n /**\n * The upper layer's default value has a higher priority than its own default value,\n * because the upper layer's default value ultimately comes from the outside world.\n */\n if (typeof defaultValues === 'object' && defaultValues !== null && key in defaultValues) {\n item.defaultValue = defaultValues[key];\n }\n const current = new FormSchemaModel(item, mergeFieldPath(this.path, key));\n if (index !== undefined && !isNaN(index)) {\n orderProperties[index] = current;\n } else {\n unOrderProperties.push(current);\n }\n });\n return orderProperties.concat(unOrderProperties).filter((item) => !!item);\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { onBeforeUnmount } from 'vue';\n\nimport type { OnFormValuesChangePayload } from '@flowgram-vue/form-core';\nimport { createForm, ValidateTrigger, type IForm } from '@flowgram-vue/form';\n\nimport { createValidate } from '../utils';\nimport { FormSchema, FormSchemaValidate } from '../types';\nimport { FormSchemaModel } from '../model';\n\nexport interface FormInstance {\n model: FormSchemaModel;\n form: IForm;\n}\nexport interface UseCreateFormOptions {\n defaultValues?: any;\n validate?: Record<string, FormSchemaValidate>;\n validateTrigger?: ValidateTrigger;\n onMounted?: (form: FormInstance) => void;\n onFormValuesChange?: (payload: OnFormValuesChangePayload) => void;\n onUnmounted?: () => void;\n}\n\nexport const useCreateForm = (schema: FormSchema, options: UseCreateFormOptions = {}) => {\n const { form, control } = createForm({\n validate: {\n ...createValidate(schema),\n ...options.validate,\n },\n validateTrigger: options.validateTrigger ?? ValidateTrigger.onBlur,\n });\n\n const model = new FormSchemaModel({\n type: 'object',\n ...schema,\n defaultValue: options.defaultValues,\n });\n\n if (options.onMounted) {\n options.onMounted({ model, form });\n }\n const disposable = control._formModel.onFormValuesChange((payload) => {\n if (options.onFormValuesChange) {\n options.onFormValuesChange(payload);\n }\n });\n onBeforeUnmount(() => {\n disposable.dispose();\n if (options.onUnmounted) {\n options.onUnmounted();\n }\n });\n\n return {\n form,\n control,\n model,\n };\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport type { InjectionKey } from 'vue';\n\nimport type { FormComponents } from './types';\nimport type { FormSchemaModel } from './model';\n\n/** Model context for each form item */\nexport const FieldModelKey: InjectionKey<FormSchemaModel> = Symbol('FieldModelContext');\n/** The form's model context */\nexport const FormModelKey: InjectionKey<FormSchemaModel> = Symbol('FormModelContext');\n/** Context of material component map */\nexport const ComponentsKey: InjectionKey<FormComponents> = Symbol('ComponentsContext');\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { inject } from 'vue';\n\nimport { useObserve } from '@flowgram-vue/reactive';\n\nimport { FieldModelKey } from '../contexts';\n\nexport const useFieldModel = () => {\n const model = inject(FieldModelKey);\n if (!model) {\n throw new Error('useFieldModel must be used within FieldModelKey provider');\n }\n return model;\n};\nexport const useFieldState = () => useObserve(useFieldModel().state.value);\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { inject } from 'vue';\n\nimport { useObserve } from '@flowgram-vue/reactive';\n\nimport { FormModelKey } from '../contexts';\n\nexport const useFormModel = () => {\n const model = inject(FormModelKey);\n if (!model) {\n throw new Error('useFormModel must be used within FormModelKey provider');\n }\n return model;\n};\nexport const useFormState = () => useObserve(useFormModel().state.value);\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { defineComponent, h, inject, type PropType } from 'vue';\n\nimport { useFormState } from '../hooks/use-form';\nimport { useFieldModel, useFieldState } from '../hooks/use-field';\nimport { ComponentsKey } from '../contexts';\n\nexport const ReactiveField = defineComponent({\n name: 'ReactiveField',\n props: {\n componentProps: { type: Object as PropType<Record<string, unknown>>, default: undefined },\n decoratorProps: { type: Object as PropType<Record<string, unknown>>, default: undefined },\n },\n setup(props, { slots }) {\n const formState = useFormState();\n const model = useFieldModel();\n const modelState = useFieldState();\n const components = inject(ComponentsKey, {});\n\n return () => {\n const disabled = modelState.disabled || formState.disabled;\n let children = slots.default?.();\n if (model.componentType && components[model.componentType]) {\n children = [\n h(\n components[model.componentType],\n {\n disabled,\n ...model.componentProps,\n ...props.componentProps,\n },\n () => slots.default?.()\n ),\n ];\n }\n if (!model.decoratorType || !components[model.decoratorType]) {\n return children;\n }\n return h(\n components[model.decoratorType],\n {\n type: model.type,\n required: model.required,\n ...model.decoratorProps,\n ...props.decoratorProps,\n },\n () => children\n );\n };\n },\n});\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { defineComponent, h, provide, type PropType } from 'vue';\n\nimport type { FormSchemaModel } from '../model';\nimport { FieldModelKey } from '../contexts';\nimport { ReactiveField } from './reactive-field';\n\nexport interface ObjectFieldProps {\n model: FormSchemaModel;\n}\n\nexport const ObjectField = defineComponent({\n name: 'ObjectField',\n props: {\n model: { type: Object as PropType<FormSchemaModel>, required: true },\n },\n setup(props, { slots }) {\n provide(FieldModelKey, props.model);\n return () => h(ReactiveField, null, () => slots.default?.());\n },\n});\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { defineComponent, h, provide, type PropType } from 'vue';\n\nimport { Field, type FieldRenderProps } from '@flowgram-vue/form';\n\nimport { ReactiveField } from './reactive-field';\nimport type { FormSchemaModel } from '../model';\nimport { FieldModelKey } from '../contexts';\n\nexport interface GeneralFieldProps {\n model: FormSchemaModel;\n}\n\nexport const GeneralField = defineComponent({\n name: 'GeneralField',\n props: {\n model: { type: Object as PropType<FormSchemaModel>, required: true },\n },\n setup(props) {\n provide(FieldModelKey, props.model);\n return () =>\n h(Field, {\n name: props.model.uniqueName,\n defaultValue: props.model.defaultValue,\n render: ({ field, fieldState }: FieldRenderProps<any>) =>\n h(ReactiveField, {\n componentProps: {\n value: field.value,\n onChange: field.onChange,\n onFocus: field.onFocus,\n onBlur: field.onBlur,\n ...fieldState,\n },\n decoratorProps: fieldState,\n }),\n });\n },\n});\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { defineComponent, h, type PropType, type VNode } from 'vue';\n\nimport { FormSchemaModel } from '../model';\nimport { ObjectField } from './object-field';\nimport { GeneralField } from './general-field';\n\nexport const RecursionField = defineComponent({\n name: 'RecursionField',\n props: {\n model: { type: Object as PropType<FormSchemaModel>, required: true },\n },\n setup(props): () => VNode {\n return () => {\n const properties = props.model.getPropertyList();\n if (props.model.type !== 'object') {\n return h(GeneralField, { model: props.model });\n }\n return h(ObjectField, { model: props.model }, () =>\n properties.map((item) => h(RecursionField, { key: item.uniqueName, model: item }))\n );\n };\n },\n});\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { defineComponent, h, provide, type PropType } from 'vue';\n\nimport type { FormComponents } from '../types';\nimport { FormSchemaModel } from '../model';\nimport { ComponentsKey, FormModelKey } from '../contexts';\nimport { RecursionField } from './recursion-field';\n\nexport interface SchemaFieldProps {\n model: FormSchemaModel;\n components?: FormComponents;\n}\n\nexport const SchemaField = defineComponent({\n name: 'SchemaField',\n props: {\n model: { type: Object as PropType<FormSchemaModel>, required: true },\n components: { type: Object as PropType<FormComponents>, default: () => ({}) },\n },\n setup(props, { slots }) {\n provide(ComponentsKey, props.components || {});\n provide(FormModelKey, props.model);\n return () => [h(RecursionField, { model: props.model }), slots.default?.()];\n },\n});\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { defineComponent, h, type PropType } from 'vue';\n\nimport { SchemaField, type SchemaFieldProps } from './schema-field';\nimport { FormComponents } from '../types';\n\ntype InnerSchemaFieldProps = Omit<SchemaFieldProps, 'components'> &\n Pick<Partial<SchemaFieldProps>, 'components'>;\n\nexport interface CreateSchemaFieldOptions {\n components?: FormComponents;\n}\nexport const createSchemaField = (options: CreateSchemaFieldOptions) => {\n const InnerSchemaField = defineComponent({\n name: 'InnerSchemaField',\n props: {\n model: { type: Object as PropType<InnerSchemaFieldProps['model']>, required: true },\n components: { type: Object as PropType<FormComponents>, default: undefined },\n },\n setup(props, { slots }) {\n return () =>\n h(\n SchemaField,\n {\n model: props.model,\n components: {\n ...options.components,\n ...props.components,\n },\n },\n () => slots.default?.()\n );\n },\n });\n\n return InnerSchemaField;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { defineComponent, h, type PropType, type VNode } from 'vue';\n\nimport { Form } from '@flowgram-vue/form';\n\nimport { FormSchema, FormComponents } from '../types';\nimport { useCreateForm, type UseCreateFormOptions } from '../hooks';\nimport { createSchemaField } from '../fields';\n\nconst SchemaField = createSchemaField({});\n\nexport type FormEngineProps = {\n /** Form schema */\n schema: FormSchema;\n /** form material map */\n components?: FormComponents;\n children?: VNode | VNode[] | null;\n} & UseCreateFormOptions;\n\nexport const FormEngine = defineComponent({\n name: 'FormEngine',\n props: {\n schema: { type: Object as PropType<FormSchema>, required: true },\n components: { type: Object as PropType<FormComponents>, default: undefined },\n defaultValues: { default: undefined },\n validate: { type: Object, default: undefined },\n validateTrigger: { default: undefined },\n onMounted: { type: Function as PropType<UseCreateFormOptions['onMounted']>, default: undefined },\n onFormValuesChange: {\n type: Function as PropType<UseCreateFormOptions['onFormValuesChange']>,\n default: undefined,\n },\n onUnmounted: {\n type: Function as PropType<UseCreateFormOptions['onUnmounted']>,\n default: undefined,\n },\n },\n setup(props, { slots }) {\n const { model, control } = useCreateForm(props.schema, {\n defaultValues: props.defaultValues,\n validate: props.validate as UseCreateFormOptions['validate'],\n validateTrigger: props.validateTrigger as UseCreateFormOptions['validateTrigger'],\n onMounted: props.onMounted,\n onFormValuesChange: props.onFormValuesChange,\n onUnmounted: props.onUnmounted,\n });\n\n return () =>\n h(Form, { control }, () =>\n h(SchemaField, { model, components: props.components }, () => slots.default?.())\n );\n },\n});\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { h, type Component, type VNode } from 'vue';\nimport { nanoid } from 'nanoid';\nimport { injectable, inject } from 'inversify';\nimport { Emitter } from '@flowgram-vue/utils';\n\nimport { TestRunConfig } from '../config';\nimport { FormSchema, FormEngine, type FormInstance, type FormEngineProps } from '../../form-engine';\n\nexport type FormRenderProps = Omit<\n FormEngineProps,\n 'schema' | 'components' | 'onMounted' | 'onUnmounted'\n>;\n\n@injectable()\nexport class TestRunFormEntity {\n @inject(TestRunConfig) private readonly config: TestRunConfig;\n\n private _schema: FormSchema;\n\n private initialized = false;\n\n id = nanoid();\n\n form: FormInstance | null = null;\n\n onFormMountedEmitter = new Emitter<FormInstance>();\n\n onFormMounted = this.onFormMountedEmitter.event;\n\n onFormUnmountedEmitter = new Emitter<void>();\n\n onFormUnmounted = this.onFormUnmountedEmitter.event;\n\n get schema() {\n return this._schema;\n }\n\n init(options: { schema: FormSchema }) {\n if (this.initialized) return;\n\n this._schema = options.schema;\n this.initialized = true;\n }\n\n render(props?: FormRenderProps): VNode | null {\n if (!this.initialized) {\n return null;\n }\n const { children, ...restProps } = props || {};\n return h(\n FormEngine as Component,\n {\n schema: this.schema,\n components: this.config.components,\n onMounted: (instance: FormInstance) => {\n this.form = instance;\n this.onFormMountedEmitter.fire(instance);\n },\n onUnmounted: this.onFormUnmountedEmitter.fire.bind(this.onFormUnmountedEmitter),\n ...restProps,\n },\n () => children as any\n );\n }\n\n dispose() {\n this._schema = {};\n this.form = null;\n this.onFormMountedEmitter.dispose();\n this.onFormUnmountedEmitter.dispose();\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport type { TestRunFormEntity } from './form';\n\nexport const TestRunFormFactory = Symbol('TestRunFormFactory');\nexport type TestRunFormFactory = () => TestRunFormEntity;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { inject, injectable } from 'inversify';\n\nimport type { TestRunFormEntity } from './form';\nimport { TestRunFormFactory } from './factory';\n\n@injectable()\nexport class TestRunFormManager {\n @inject(TestRunFormFactory) private readonly factory: TestRunFormFactory;\n\n private entities = new Map<string, TestRunFormEntity>();\n\n createForm() {\n return this.factory();\n }\n\n getForm(id: string) {\n return this.entities.get(id);\n }\n\n getAllForm() {\n return Array.from(this.entities);\n }\n\n disposeForm(id: string) {\n const form = this.entities.get(id);\n if (!form) {\n return;\n }\n form.dispose();\n this.entities.delete(id);\n }\n\n disposeAllForm() {\n for (const id of this.entities.keys()) {\n this.disposeForm(id);\n }\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport type { TestRunPipelineEntity } from './pipeline';\n\nexport const TestRunPipelineFactory = Symbol('TestRunPipelineFactory');\nexport type TestRunPipelineFactory = () => TestRunPipelineEntity;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { inject, injectable } from 'inversify';\nimport { Disposable, DisposableCollection, Emitter } from '@flowgram-vue/utils';\nimport type { FlowNodeEntity, FlowNodeType } from '@flowgram-vue/document';\n\nimport { TestRunPipelineFactory } from './pipeline/factory';\nimport { TestRunFormManager } from './form';\nimport { FormSchema } from '../form-engine';\nimport { TestRunPipelineEntity, type TestRunPipelineEntityOptions } from './pipeline';\nimport { TestRunConfig } from './config';\n\n@injectable()\nexport class TestRunService {\n @inject(TestRunConfig) private readonly config: TestRunConfig;\n\n @inject(TestRunPipelineFactory) private readonly pipelineFactory: TestRunPipelineFactory;\n\n @inject(TestRunFormManager) readonly formManager: TestRunFormManager;\n\n pipelineEntities = new Map<string, TestRunPipelineEntity>();\n\n pipelineBindings = new Map<string, Disposable>();\n\n onPipelineProgressEmitter = new Emitter();\n\n onPipelineProgress = this.onPipelineProgressEmitter.event;\n\n onPipelineFinishedEmitter = new Emitter();\n\n onPipelineFinished = this.onPipelineFinishedEmitter.event;\n\n public isEnabled(nodeType: FlowNodeType) {\n const config = this.config.nodes[nodeType];\n return config && config?.enabled !== false;\n }\n\n async toSchema(node: FlowNodeEntity) {\n const nodeType = node.flowNodeType;\n const config = this.config.nodes[nodeType];\n if (!this.isEnabled(nodeType)) {\n return {};\n }\n const properties =\n typeof config.properties === 'function'\n ? await config.properties({ node })\n : config.properties;\n\n return {\n type: 'object',\n properties,\n };\n }\n\n createFormWithSchema(schema: FormSchema) {\n const form = this.formManager.createForm();\n form.init({ schema });\n return form;\n }\n\n async createForm(node: FlowNodeEntity) {\n const schema = await this.toSchema(node);\n return this.createFormWithSchema(schema);\n }\n\n createPipeline(options: TestRunPipelineEntityOptions) {\n const pipeline = this.pipelineFactory();\n this.pipelineEntities.set(pipeline.id, pipeline);\n pipeline.init(options);\n return pipeline;\n }\n\n disposePipeline(id: string) {\n const pipeline = this.pipelineEntities.get(id);\n if (pipeline) {\n this.pipelineEntities.delete(id);\n pipeline.dispose();\n }\n }\n\n connectPipeline(pipeline: TestRunPipelineEntity) {\n if (this.pipelineBindings.get(pipeline.id)) {\n return;\n }\n const disposable = new DisposableCollection(\n pipeline.onProgress(this.onPipelineProgressEmitter.fire.bind(this.onPipelineProgressEmitter)),\n pipeline.onFinished(this.onPipelineFinishedEmitter.fire.bind(this.onPipelineFinishedEmitter))\n );\n this.pipelineBindings.set(pipeline.id, disposable);\n }\n\n disconnectPipeline(id: string) {\n if (this.pipelineBindings.has(id)) {\n const disposable = this.pipelineBindings.get(id);\n disposable?.dispose();\n this.pipelineBindings.delete(id);\n }\n }\n\n disconnectAllPipeline() {\n for (const id of this.pipelineBindings.keys()) {\n this.disconnectPipeline(id);\n }\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { MaybePromise } from '../../types';\n\ninterface TapValue<T> {\n name: string;\n fn: (arg: T) => MaybePromise<void>;\n}\n\nexport class Tap<T> {\n private taps: TapValue<T>[] = [];\n\n private frozen = false;\n\n tap(name: string, fn: TapValue<T>['fn']) {\n this.taps.push({ name, fn });\n }\n\n async call(ctx: T) {\n for (const tap of this.taps) {\n if (this.frozen) {\n return;\n }\n await tap.fn(ctx);\n }\n }\n\n freeze() {\n this.frozen = true;\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { createStore } from 'zustand/vanilla';\nimport type { StoreApi, StateCreator } from 'zustand';\nimport { injectable, unmanaged } from 'inversify';\n/**\n * 包含 Store 的 Service\n */\n@injectable()\nexport class StoreService<State> {\n store: StoreApi<State>;\n\n get getState() {\n return this.store.getState.bind(this.store);\n }\n\n get setState() {\n return this.store.setState.bind(this.store);\n }\n\n constructor(@unmanaged() stateCreator: StateCreator<State>) {\n this.store = createStore(stateCreator);\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport type { StoreApi } from 'zustand';\nimport { nanoid } from 'nanoid';\nimport { injectable, interfaces } from 'inversify';\nimport { Emitter } from '@flowgram-vue/utils';\n\nimport { Tap } from './tap';\nimport type { TestRunPipelinePlugin } from './plugin';\nimport { StoreService } from '../store';\nexport interface TestRunPipelineEntityOptions {\n plugins: (new () => TestRunPipelinePlugin)[];\n}\n\ninterface TestRunPipelineEntityState<T = any> {\n status: 'idle' | 'preparing' | 'executing' | 'canceled' | 'finished' | 'disposed';\n data?: T;\n result?: any;\n getData: () => T;\n setData: (next: any) => void;\n}\n\nexport interface TestRunPipelineEntityCtx<T = any> {\n id: string;\n store: StoreApi<TestRunPipelineEntityState<T>>;\n operate: {\n update: (data: any) => void;\n cancel: () => void;\n };\n}\n\nconst initialState: Omit<TestRunPipelineEntityState, 'getData' | 'setData'> = {\n status: 'idle',\n data: {},\n};\n\n@injectable()\nexport class TestRunPipelineEntity extends StoreService<TestRunPipelineEntityState> {\n container: interfaces.Container | undefined;\n\n id = nanoid();\n\n plugins: TestRunPipelinePlugin[] = [];\n\n prepare = new Tap<TestRunPipelineEntityCtx>();\n\n private execute?: (ctx: TestRunPipelineEntityCtx) => Promise<void> | void;\n\n private progress?: (ctx: TestRunPipelineEntityCtx) => Promise<void> | void;\n\n get status() {\n return this.getState().status;\n }\n\n set status(next: TestRunPipelineEntityState['status']) {\n this.setState({ status: next });\n }\n\n onProgressEmitter = new Emitter<any>();\n\n onProgress = this.onProgressEmitter.event;\n\n onFinishedEmitter = new Emitter();\n\n onFinished = this.onFinishedEmitter.event;\n\n constructor() {\n super((set, get) => ({\n ...initialState,\n getData: () => get().data || {},\n setData: (next: any) => set((state) => ({ ...state, data: { ...state.data, ...next } })),\n }));\n }\n\n public init(options: TestRunPipelineEntityOptions) {\n if (!this.container) {\n return;\n }\n const { plugins } = options;\n for (const PluginClass of plugins) {\n const plugin = this.container.resolve<TestRunPipelinePlugin>(PluginClass);\n plugin.apply(this);\n this.plugins.push(plugin);\n }\n }\n\n public registerExecute(fn: (ctx: TestRunPipelineEntityCtx) => Promise<void> | void) {\n this.execute = fn;\n }\n\n public registerProgress(fn: (ctx: TestRunPipelineEntityCtx) => Promise<void> | void) {\n this.progress = fn;\n }\n\n async start<T>(options?: { data: T }) {\n const { data } = options || {};\n if (this.status !== 'idle') {\n return;\n }\n /** initialization data */\n this.setState({ data });\n const ctx: TestRunPipelineEntityCtx = {\n id: this.id,\n store: this.store,\n operate: {\n update: this.update.bind(this),\n cancel: this.cancel.bind(this),\n },\n };\n\n this.status = 'preparing';\n await this.prepare.call(ctx);\n if (this.status !== 'preparing') {\n return;\n }\n\n this.status = 'executing';\n if (this.execute) {\n await this.execute(ctx);\n }\n if (this.progress) {\n await this.progress(ctx);\n }\n if (this.status === 'executing') {\n this.status = 'finished';\n this.onFinishedEmitter.fire(this.getState().result);\n }\n }\n\n update(result: any) {\n this.setState({ result });\n this.onProgressEmitter.fire(result);\n }\n\n cancel() {\n if ((this.status = 'preparing')) {\n this.prepare.freeze();\n }\n this.status = 'canceled';\n }\n\n dispose() {\n this.status = 'disposed';\n this.plugins.forEach((p) => {\n if (p.dispose) {\n p.dispose();\n }\n });\n this.onProgressEmitter.dispose();\n this.onFinishedEmitter.dispose();\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { definePluginCreator } from '@flowgram-vue/core';\n\nimport { TestRunFormEntity, TestRunFormFactory, TestRunFormManager } from './services/form';\nimport {\n TestRunService,\n TestRunPipelineEntity,\n TestRunPipelineFactory,\n TestRunConfig,\n defineConfig,\n} from './services';\n\nexport const createTestRunPlugin = definePluginCreator<Partial<TestRunConfig>>({\n onBind: ({ bind }, opt) => {\n /** service */\n bind(TestRunService).toSelf().inSingletonScope();\n /** config */\n bind(TestRunConfig).toConstantValue(defineConfig(opt));\n /** form manager */\n bind(TestRunFormManager).toSelf().inSingletonScope();\n /** form entity */\n bind<TestRunFormFactory>(TestRunFormFactory).toFactory<TestRunFormEntity>((context) => () => {\n const e = context.container.resolve(TestRunFormEntity);\n return e;\n });\n /** pipeline entity */\n bind<TestRunPipelineFactory>(TestRunPipelineFactory).toFactory<TestRunPipelineEntity>(\n (context) => () => {\n const e = context.container.resolve(TestRunPipelineEntity);\n e.container = context.container.createChild();\n return e;\n }\n );\n },\n});\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useService } from '@flowgram-vue/core';\n\nimport { TestRunService } from '../../services/test-run';\n\nexport const useTestRunService = () => useService<TestRunService>(TestRunService);\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { computed, onBeforeUnmount, ref, shallowRef, watch, type VNode } from 'vue';\n\nimport { DisposableCollection } from '@flowgram-vue/utils';\nimport type { FlowNodeEntity } from '@flowgram-vue/document';\n\nimport { TestRunFormEntity } from '../../services/form/form';\nimport { FormEngineProps, isFormEmpty } from '../../form-engine';\nimport { useTestRunService } from './use-test-run-service';\n\ninterface UseFormOptions {\n node?: FlowNodeEntity;\n /** form loading */\n loadingRenderer?: VNode | null;\n /** form empty */\n emptyRenderer?: VNode | null;\n defaultValues?: FormEngineProps['defaultValues'];\n onMounted?: FormEngineProps['onMounted'];\n onUnmounted?: FormEngineProps['onUnmounted'];\n onFormValuesChange?: FormEngineProps['onFormValuesChange'];\n}\n\nexport const useCreateForm = ({\n node,\n loadingRenderer,\n emptyRenderer,\n defaultValues,\n onMounted,\n onUnmounted,\n onFormValuesChange,\n}: UseFormOptions) => {\n const testRun = useTestRunService();\n const loading = ref(false);\n const form = shallowRef<TestRunFormEntity | null>(null);\n const renderer = computed(() => {\n if (loading.value || !form.value) {\n return loadingRenderer;\n }\n\n const isEmpty = isFormEmpty(form.value.schema);\n\n return form.value.render({\n defaultValues,\n onFormValuesChange,\n children: isEmpty ? emptyRenderer : null,\n });\n });\n\n const compute = async () => {\n if (!node) {\n return;\n }\n try {\n loading.value = true;\n const formEntity = await testRun.createForm(node);\n form.value = formEntity;\n } finally {\n loading.value = false;\n }\n };\n\n watch(\n () => node,\n () => {\n void compute();\n },\n { immediate: true }\n );\n\n watch(\n form,\n (next, _prev, onCleanup) => {\n if (!next) {\n return;\n }\n const disposable = new DisposableCollection(\n next.onFormMounted((data) => {\n onMounted?.(data);\n }),\n next.onFormUnmounted(() => {\n onUnmounted?.();\n })\n );\n onCleanup(() => disposable.dispose());\n }\n );\n\n onBeforeUnmount(() => {\n form.value = null;\n });\n\n return {\n renderer,\n loading,\n form,\n };\n};\n"]}
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@flowgram-vue/test-run-plugin",
3
+ "version": "0.2.0",
4
+ "type": "module",
5
+ "homepage": "https://flowgram.ai/",
6
+ "repository": "https://github.com/Crayon-hua/flowgram-vue",
7
+ "license": "MIT",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js",
12
+ "require": "./dist/index.cjs"
13
+ }
14
+ },
15
+ "main": "./dist/index.cjs",
16
+ "module": "./dist/index.js",
17
+ "types": "./dist/index.d.ts",
18
+ "files": [
19
+ "src",
20
+ "dist"
21
+ ],
22
+ "dependencies": {
23
+ "inversify": "^6.0.1",
24
+ "nanoid": "^5.0.9",
25
+ "zustand": "^4.5.5",
26
+ "@flowgram-vue/core": "0.2.0",
27
+ "@flowgram-vue/document": "0.2.0",
28
+ "@flowgram-vue/reactive": "0.2.0",
29
+ "@flowgram-vue/utils": "0.2.0",
30
+ "@flowgram-vue/form-core": "0.2.0",
31
+ "@flowgram-vue/form": "0.2.0"
32
+ },
33
+ "peerDependencies": {
34
+ "vue": "^3.5.0"
35
+ },
36
+ "devDependencies": {
37
+ "@types/node": "^20",
38
+ "@vitejs/plugin-vue": "^6.0.1",
39
+ "@vitest/coverage-v8": "^3.2.4",
40
+ "@vue/test-utils": "^2.4.6",
41
+ "eslint": "^9.0.0",
42
+ "jsdom": "^26.1.0",
43
+ "typescript": "^5.8.3",
44
+ "vitest": "^3.2.4",
45
+ "vue": "^3.5.18",
46
+ "@flowgram-vue/build-config": "0.2.0",
47
+ "@flowgram-vue/ts-config": "0.2.0",
48
+ "@flowgram-vue/eslint-config": "0.2.0"
49
+ },
50
+ "publishConfig": {
51
+ "access": "public",
52
+ "registry": "https://registry.npmjs.org/"
53
+ },
54
+ "scripts": {
55
+ "build": "flowgram-build",
56
+ "test": "vitest run --passWithNoTests",
57
+ "lint": "eslint .",
58
+ "ts-check": "tsc --noEmit",
59
+ "type-check": "tsc --noEmit",
60
+ "build:fast": "flowgram-build --fast",
61
+ "build:watch": "flowgram-build --watch"
62
+ }
63
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import { definePluginCreator } from '@flowgram-vue/core';
7
+
8
+ import { TestRunFormEntity, TestRunFormFactory, TestRunFormManager } from './services/form';
9
+ import {
10
+ TestRunService,
11
+ TestRunPipelineEntity,
12
+ TestRunPipelineFactory,
13
+ TestRunConfig,
14
+ defineConfig,
15
+ } from './services';
16
+
17
+ export const createTestRunPlugin = definePluginCreator<Partial<TestRunConfig>>({
18
+ onBind: ({ bind }, opt) => {
19
+ /** service */
20
+ bind(TestRunService).toSelf().inSingletonScope();
21
+ /** config */
22
+ bind(TestRunConfig).toConstantValue(defineConfig(opt));
23
+ /** form manager */
24
+ bind(TestRunFormManager).toSelf().inSingletonScope();
25
+ /** form entity */
26
+ bind<TestRunFormFactory>(TestRunFormFactory).toFactory<TestRunFormEntity>((context) => () => {
27
+ const e = context.container.resolve(TestRunFormEntity);
28
+ return e;
29
+ });
30
+ /** pipeline entity */
31
+ bind<TestRunPipelineFactory>(TestRunPipelineFactory).toFactory<TestRunPipelineEntity>(
32
+ (context) => () => {
33
+ const e = context.container.resolve(TestRunPipelineEntity);
34
+ e.container = context.container.createChild();
35
+ return e;
36
+ }
37
+ );
38
+ },
39
+ });
package/src/env.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ declare module '*.vue' {
7
+ import type { DefineComponent } from 'vue';
8
+ const component: DefineComponent<object, object, unknown>;
9
+ export default component;
10
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import type { InjectionKey } from 'vue';
7
+
8
+ import type { FormComponents } from './types';
9
+ import type { FormSchemaModel } from './model';
10
+
11
+ /** Model context for each form item */
12
+ export const FieldModelKey: InjectionKey<FormSchemaModel> = Symbol('FieldModelContext');
13
+ /** The form's model context */
14
+ export const FormModelKey: InjectionKey<FormSchemaModel> = Symbol('FormModelContext');
15
+ /** Context of material component map */
16
+ export const ComponentsKey: InjectionKey<FormComponents> = Symbol('ComponentsContext');
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import { defineComponent, h, type PropType } from 'vue';
7
+
8
+ import { SchemaField, type SchemaFieldProps } from './schema-field';
9
+ import { FormComponents } from '../types';
10
+
11
+ type InnerSchemaFieldProps = Omit<SchemaFieldProps, 'components'> &
12
+ Pick<Partial<SchemaFieldProps>, 'components'>;
13
+
14
+ export interface CreateSchemaFieldOptions {
15
+ components?: FormComponents;
16
+ }
17
+ export const createSchemaField = (options: CreateSchemaFieldOptions) => {
18
+ const InnerSchemaField = defineComponent({
19
+ name: 'InnerSchemaField',
20
+ props: {
21
+ model: { type: Object as PropType<InnerSchemaFieldProps['model']>, required: true },
22
+ components: { type: Object as PropType<FormComponents>, default: undefined },
23
+ },
24
+ setup(props, { slots }) {
25
+ return () =>
26
+ h(
27
+ SchemaField,
28
+ {
29
+ model: props.model,
30
+ components: {
31
+ ...options.components,
32
+ ...props.components,
33
+ },
34
+ },
35
+ () => slots.default?.()
36
+ );
37
+ },
38
+ });
39
+
40
+ return InnerSchemaField;
41
+ };
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import { defineComponent, h, provide, type PropType } from 'vue';
7
+
8
+ import { Field, type FieldRenderProps } from '@flowgram-vue/form';
9
+
10
+ import { ReactiveField } from './reactive-field';
11
+ import type { FormSchemaModel } from '../model';
12
+ import { FieldModelKey } from '../contexts';
13
+
14
+ export interface GeneralFieldProps {
15
+ model: FormSchemaModel;
16
+ }
17
+
18
+ export const GeneralField = defineComponent({
19
+ name: 'GeneralField',
20
+ props: {
21
+ model: { type: Object as PropType<FormSchemaModel>, required: true },
22
+ },
23
+ setup(props) {
24
+ provide(FieldModelKey, props.model);
25
+ return () =>
26
+ h(Field, {
27
+ name: props.model.uniqueName,
28
+ defaultValue: props.model.defaultValue,
29
+ render: ({ field, fieldState }: FieldRenderProps<any>) =>
30
+ h(ReactiveField, {
31
+ componentProps: {
32
+ value: field.value,
33
+ onChange: field.onChange,
34
+ onFocus: field.onFocus,
35
+ onBlur: field.onBlur,
36
+ ...fieldState,
37
+ },
38
+ decoratorProps: fieldState,
39
+ }),
40
+ });
41
+ },
42
+ });
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /** field components */
7
+ export { SchemaField, type SchemaFieldProps } from './schema-field';
8
+ /** field functions */
9
+ export { createSchemaField, type CreateSchemaFieldOptions } from './create-field';
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import { defineComponent, h, provide, type PropType } from 'vue';
7
+
8
+ import type { FormSchemaModel } from '../model';
9
+ import { FieldModelKey } from '../contexts';
10
+ import { ReactiveField } from './reactive-field';
11
+
12
+ export interface ObjectFieldProps {
13
+ model: FormSchemaModel;
14
+ }
15
+
16
+ export const ObjectField = defineComponent({
17
+ name: 'ObjectField',
18
+ props: {
19
+ model: { type: Object as PropType<FormSchemaModel>, required: true },
20
+ },
21
+ setup(props, { slots }) {
22
+ provide(FieldModelKey, props.model);
23
+ return () => h(ReactiveField, null, () => slots.default?.());
24
+ },
25
+ });
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import { defineComponent, h, inject, type PropType } from 'vue';
7
+
8
+ import { useFormState } from '../hooks/use-form';
9
+ import { useFieldModel, useFieldState } from '../hooks/use-field';
10
+ import { ComponentsKey } from '../contexts';
11
+
12
+ export const ReactiveField = defineComponent({
13
+ name: 'ReactiveField',
14
+ props: {
15
+ componentProps: { type: Object as PropType<Record<string, unknown>>, default: undefined },
16
+ decoratorProps: { type: Object as PropType<Record<string, unknown>>, default: undefined },
17
+ },
18
+ setup(props, { slots }) {
19
+ const formState = useFormState();
20
+ const model = useFieldModel();
21
+ const modelState = useFieldState();
22
+ const components = inject(ComponentsKey, {});
23
+
24
+ return () => {
25
+ const disabled = modelState.disabled || formState.disabled;
26
+ let children = slots.default?.();
27
+ if (model.componentType && components[model.componentType]) {
28
+ children = [
29
+ h(
30
+ components[model.componentType],
31
+ {
32
+ disabled,
33
+ ...model.componentProps,
34
+ ...props.componentProps,
35
+ },
36
+ () => slots.default?.()
37
+ ),
38
+ ];
39
+ }
40
+ if (!model.decoratorType || !components[model.decoratorType]) {
41
+ return children;
42
+ }
43
+ return h(
44
+ components[model.decoratorType],
45
+ {
46
+ type: model.type,
47
+ required: model.required,
48
+ ...model.decoratorProps,
49
+ ...props.decoratorProps,
50
+ },
51
+ () => children
52
+ );
53
+ };
54
+ },
55
+ });
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import { defineComponent, h, type PropType, type VNode } from 'vue';
7
+
8
+ import { FormSchemaModel } from '../model';
9
+ import { ObjectField } from './object-field';
10
+ import { GeneralField } from './general-field';
11
+
12
+ export const RecursionField = defineComponent({
13
+ name: 'RecursionField',
14
+ props: {
15
+ model: { type: Object as PropType<FormSchemaModel>, required: true },
16
+ },
17
+ setup(props): () => VNode {
18
+ return () => {
19
+ const properties = props.model.getPropertyList();
20
+ if (props.model.type !== 'object') {
21
+ return h(GeneralField, { model: props.model });
22
+ }
23
+ return h(ObjectField, { model: props.model }, () =>
24
+ properties.map((item) => h(RecursionField, { key: item.uniqueName, model: item }))
25
+ );
26
+ };
27
+ },
28
+ });
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import { defineComponent, h, provide, type PropType } from 'vue';
7
+
8
+ import type { FormComponents } from '../types';
9
+ import { FormSchemaModel } from '../model';
10
+ import { ComponentsKey, FormModelKey } from '../contexts';
11
+ import { RecursionField } from './recursion-field';
12
+
13
+ export interface SchemaFieldProps {
14
+ model: FormSchemaModel;
15
+ components?: FormComponents;
16
+ }
17
+
18
+ export const SchemaField = defineComponent({
19
+ name: 'SchemaField',
20
+ props: {
21
+ model: { type: Object as PropType<FormSchemaModel>, required: true },
22
+ components: { type: Object as PropType<FormComponents>, default: () => ({}) },
23
+ },
24
+ setup(props, { slots }) {
25
+ provide(ComponentsKey, props.components || {});
26
+ provide(FormModelKey, props.model);
27
+ return () => [h(RecursionField, { model: props.model }), slots.default?.()];
28
+ },
29
+ });
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import { defineComponent, h, type PropType, type VNode } from 'vue';
7
+
8
+ import { Form } from '@flowgram-vue/form';
9
+
10
+ import { FormSchema, FormComponents } from '../types';
11
+ import { useCreateForm, type UseCreateFormOptions } from '../hooks';
12
+ import { createSchemaField } from '../fields';
13
+
14
+ const SchemaField = createSchemaField({});
15
+
16
+ export type FormEngineProps = {
17
+ /** Form schema */
18
+ schema: FormSchema;
19
+ /** form material map */
20
+ components?: FormComponents;
21
+ children?: VNode | VNode[] | null;
22
+ } & UseCreateFormOptions;
23
+
24
+ export const FormEngine = defineComponent({
25
+ name: 'FormEngine',
26
+ props: {
27
+ schema: { type: Object as PropType<FormSchema>, required: true },
28
+ components: { type: Object as PropType<FormComponents>, default: undefined },
29
+ defaultValues: { default: undefined },
30
+ validate: { type: Object, default: undefined },
31
+ validateTrigger: { default: undefined },
32
+ onMounted: { type: Function as PropType<UseCreateFormOptions['onMounted']>, default: undefined },
33
+ onFormValuesChange: {
34
+ type: Function as PropType<UseCreateFormOptions['onFormValuesChange']>,
35
+ default: undefined,
36
+ },
37
+ onUnmounted: {
38
+ type: Function as PropType<UseCreateFormOptions['onUnmounted']>,
39
+ default: undefined,
40
+ },
41
+ },
42
+ setup(props, { slots }) {
43
+ const { model, control } = useCreateForm(props.schema, {
44
+ defaultValues: props.defaultValues,
45
+ validate: props.validate as UseCreateFormOptions['validate'],
46
+ validateTrigger: props.validateTrigger as UseCreateFormOptions['validateTrigger'],
47
+ onMounted: props.onMounted,
48
+ onFormValuesChange: props.onFormValuesChange,
49
+ onUnmounted: props.onUnmounted,
50
+ });
51
+
52
+ return () =>
53
+ h(Form, { control }, () =>
54
+ h(SchemaField, { model, components: props.components }, () => slots.default?.())
55
+ );
56
+ },
57
+ });
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ export { FormEngine, type FormEngineProps } from './form';
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ export { useCreateForm, type UseCreateFormOptions } from './use-create-form';
7
+ export { useFieldModel, useFieldState } from './use-field';
8
+ export { useFormModel, useFormState } from './use-form';
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import { onBeforeUnmount } from 'vue';
7
+
8
+ import type { OnFormValuesChangePayload } from '@flowgram-vue/form-core';
9
+ import { createForm, ValidateTrigger, type IForm } from '@flowgram-vue/form';
10
+
11
+ import { createValidate } from '../utils';
12
+ import { FormSchema, FormSchemaValidate } from '../types';
13
+ import { FormSchemaModel } from '../model';
14
+
15
+ export interface FormInstance {
16
+ model: FormSchemaModel;
17
+ form: IForm;
18
+ }
19
+ export interface UseCreateFormOptions {
20
+ defaultValues?: any;
21
+ validate?: Record<string, FormSchemaValidate>;
22
+ validateTrigger?: ValidateTrigger;
23
+ onMounted?: (form: FormInstance) => void;
24
+ onFormValuesChange?: (payload: OnFormValuesChangePayload) => void;
25
+ onUnmounted?: () => void;
26
+ }
27
+
28
+ export const useCreateForm = (schema: FormSchema, options: UseCreateFormOptions = {}) => {
29
+ const { form, control } = createForm({
30
+ validate: {
31
+ ...createValidate(schema),
32
+ ...options.validate,
33
+ },
34
+ validateTrigger: options.validateTrigger ?? ValidateTrigger.onBlur,
35
+ });
36
+
37
+ const model = new FormSchemaModel({
38
+ type: 'object',
39
+ ...schema,
40
+ defaultValue: options.defaultValues,
41
+ });
42
+
43
+ if (options.onMounted) {
44
+ options.onMounted({ model, form });
45
+ }
46
+ const disposable = control._formModel.onFormValuesChange((payload) => {
47
+ if (options.onFormValuesChange) {
48
+ options.onFormValuesChange(payload);
49
+ }
50
+ });
51
+ onBeforeUnmount(() => {
52
+ disposable.dispose();
53
+ if (options.onUnmounted) {
54
+ options.onUnmounted();
55
+ }
56
+ });
57
+
58
+ return {
59
+ form,
60
+ control,
61
+ model,
62
+ };
63
+ };