@schemx/vue 1.0.0-next.6 → 1.0.1
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 +161 -141
- package/dist/analyze.html +1 -1
- package/dist/bridge/fieldBridge.d.ts +12 -0
- package/dist/bridge/fieldBridge.d.ts.map +1 -1
- package/dist/bridge/formBridge.d.ts +33 -0
- package/dist/bridge/formBridge.d.ts.map +1 -1
- package/dist/bridge/formInstance.d.ts +20 -1
- package/dist/bridge/formInstance.d.ts.map +1 -1
- package/dist/bridge/helpers.d.ts +8 -0
- package/dist/bridge/helpers.d.ts.map +1 -1
- package/dist/bridge/index.d.ts +1 -1
- package/dist/bridge/index.d.ts.map +1 -1
- package/dist/bridge/types.d.ts +94 -4
- package/dist/bridge/types.d.ts.map +1 -1
- package/dist/bridge/viewSchemaBridge.d.ts +14 -1
- package/dist/bridge/viewSchemaBridge.d.ts.map +1 -1
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.vue.d.ts +12 -0
- package/dist/components/Button/index.vue.d.ts.map +1 -1
- package/dist/components/Button/types.d.ts +15 -5
- package/dist/components/Button/types.d.ts.map +1 -1
- package/dist/components/Col/index.d.ts +4 -5
- package/dist/components/Col/index.d.ts.map +1 -1
- package/dist/components/ConfigProvider/index.d.ts +8 -2
- package/dist/components/ConfigProvider/index.d.ts.map +1 -1
- package/dist/components/Dynamic/index.d.ts +9 -3
- package/dist/components/Dynamic/index.d.ts.map +1 -1
- package/dist/components/Field/index.d.ts +13 -2
- package/dist/components/Field/index.d.ts.map +1 -1
- package/dist/components/Field/slot.d.ts +32 -9
- package/dist/components/Field/slot.d.ts.map +1 -1
- package/dist/components/Group/index.d.ts +15 -5
- package/dist/components/Group/index.d.ts.map +1 -1
- package/dist/components/Group/slot.d.ts +36 -9
- package/dist/components/Group/slot.d.ts.map +1 -1
- package/dist/components/SchemaList/index.d.ts +15 -5
- package/dist/components/SchemaList/index.d.ts.map +1 -1
- package/dist/components/Wrapper/index.vue.d.ts +6 -0
- package/dist/components/Wrapper/index.vue.d.ts.map +1 -1
- package/dist/config/appConfig.d.ts +10 -0
- package/dist/config/appConfig.d.ts.map +1 -1
- package/dist/config/defaultVueSchemaConfig.d.ts +40 -0
- package/dist/config/defaultVueSchemaConfig.d.ts.map +1 -0
- package/dist/config/index.d.ts +15 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/vueConfig.d.ts +7 -0
- package/dist/config/vueConfig.d.ts.map +1 -1
- package/dist/context/configProviderContext.d.ts +15 -0
- package/dist/context/configProviderContext.d.ts.map +1 -0
- package/dist/context/fieldContext.d.ts +11 -0
- package/dist/context/fieldContext.d.ts.map +1 -0
- package/dist/context/formContext.d.ts +76 -0
- package/dist/context/formContext.d.ts.map +1 -0
- package/dist/context/index.d.ts +18 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/form.d.ts +8 -0
- package/dist/form.d.ts.map +1 -1
- package/dist/hocs/withRemoteOptions.d.ts +6 -2
- package/dist/hocs/withRemoteOptions.d.ts.map +1 -1
- package/dist/hooks/index.d.ts +24 -14
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/useDictionary.d.ts +32 -9
- package/dist/hooks/useDictionary.d.ts.map +1 -1
- package/dist/hooks/useField.d.ts +7 -0
- package/dist/hooks/useField.d.ts.map +1 -1
- package/dist/hooks/useForm.d.ts.map +1 -1
- package/dist/hooks/useFormSelector.d.ts.map +1 -1
- package/dist/hooks/useViewSchemas.d.ts +26 -2
- package/dist/hooks/useViewSchemas.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +33 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +224 -164
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/definition.d.ts +153 -0
- package/dist/types/definition.d.ts.map +1 -0
- package/dist/types/dictionary.d.ts +9 -3
- package/dist/types/dictionary.d.ts.map +1 -1
- package/dist/types/field.d.ts +116 -21
- package/dist/types/field.d.ts.map +1 -1
- package/dist/types/form.d.ts +42 -1
- package/dist/types/form.d.ts.map +1 -1
- package/dist/types/index.d.ts +0 -15
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/layout.d.ts +31 -6
- package/dist/types/layout.d.ts.map +1 -1
- package/dist/utils/colProvider.d.ts +3 -1
- package/dist/utils/colProvider.d.ts.map +1 -1
- package/dist/utils/diff.d.ts +3 -6
- package/dist/utils/diff.d.ts.map +1 -1
- package/dist/utils/dynamic.d.ts +6 -2
- package/dist/utils/dynamic.d.ts.map +1 -1
- package/dist/utils/equal.d.ts +2 -2
- package/dist/utils/helpers.d.ts +26 -2
- package/dist/utils/helpers.d.ts.map +1 -1
- package/dist/utils/index.d.ts +15 -4
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/validation.d.ts +6 -2
- package/dist/utils/validation.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/config/providerConfig.d.ts +0 -22
- package/dist/config/providerConfig.d.ts.map +0 -1
- package/dist/hooks/provideFieldContext.d.ts +0 -40
- package/dist/hooks/provideFieldContext.d.ts.map +0 -1
- package/dist/hooks/provideFormConfigContext.d.ts +0 -71
- package/dist/hooks/provideFormConfigContext.d.ts.map +0 -1
- package/dist/hooks/provideFormContext.d.ts +0 -26
- package/dist/hooks/provideFormContext.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -117,7 +117,7 @@ console.log(Schemx === schemxForm) // true
|
|
|
117
117
|
| `class` | `string` | `""` | 添加到根 `.schemx` 元素的类名 |
|
|
118
118
|
| `style` | `StyleValue` | `{}` | 绑定到根 `.schemx` 元素 |
|
|
119
119
|
|
|
120
|
-
上述 Schema
|
|
120
|
+
上述 Schema 默认配置都会参与字段规范化:Core 负责 `required`、`readonly`、`disabled`、`visible` 和校验触发方式,Vue 适配层负责标签、内容对齐、冒号和必填标记等展示默认值。Registry、默认 Renderer 和 `validatorAdapters` 则按表单显式配置 → 当前 App 安装配置 → Vue 模块级 Registry → Core 模块级配置 → Core 内置默认值解析。必填只能通过 `required: true` 或 `RequiredOptions` 表达;普通 `rules` 只负责执行校验,不会显示必填星号。传入 `form` 时,`initialValues`、Registry 和所有表单回调都由外部实例的创建者配置;组件不会用同名 Props 重建 Core Form,但会通过 Vue bridge 包装该实例,并同步 `schemas` 与组件声明的 schema 配置。
|
|
121
121
|
|
|
122
122
|
`ConfigProvider` 的 `schemaConfig` 和 `colComponent` 更新会同步到已挂载的内部 `<Schemx>`;Registry、校验 adapter 和默认 Renderer 类型仍在 Form 创建时解析。
|
|
123
123
|
|
|
@@ -502,7 +502,7 @@ Renderer 是从 Registry 取出的普通 Vue 组件。`Field` 先展开 `schema.
|
|
|
502
502
|
| `placeholder` | 当前 ViewSchema 的占位文本,覆盖 `componentProps.placeholder` |
|
|
503
503
|
| `formItemProps` | 当前完整 ViewSchema,覆盖 `componentProps.formItemProps` |
|
|
504
504
|
|
|
505
|
-
其他 `componentProps`(例如 `options`、`readonlyPlaceholder`、`align` 和已经通过声明合并注册的组件专属 Props
|
|
505
|
+
其他 `componentProps`(例如 `options`、`readonlyPlaceholder`、`align` 和已经通过声明合并注册的组件专属 Props)原样透传。Vue `Field` 会自动注入当前 Vue Form 实例到 `formInstance`,并用完整 ViewSchema 覆盖 `formItemProps`。
|
|
506
506
|
|
|
507
507
|
当前也不会向普通 Renderer 自动注入 `fieldName`、字段校验 `error` / `errors` 或 `loading`。Renderer 如需当前字段路径或响应式状态,可调用 `useFieldContext()`;`WithRemoteOptions` 会自动使用该 Context 的字段路径处理 `resetOnDepsChange`,但不会把内部路径透传给被包装 Renderer。详见下一节。
|
|
508
508
|
|
|
@@ -723,12 +723,13 @@ componentProps: {
|
|
|
723
723
|
| API | 说明 |
|
|
724
724
|
| --------------------------- | ------------------------------------------------------------------------------------------------------ |
|
|
725
725
|
| `useForm()` | 创建由当前 Vue effect scope 管理生命周期的表单实例;自动使用 Vue 包全局 Registry,但不会自动 `provide` |
|
|
726
|
-
| `
|
|
726
|
+
| `provideFormContext()` | 在当前组件 `setup()` 同步阶段一次向后代提供表单实例和展示配置 |
|
|
727
|
+
| `createFormContext()` | 兼容 API:仅提供表单实例;建议改用 `provideFormContext()` |
|
|
727
728
|
| `useFormContext()` | 获取最近祖先提供的表单实例;缺少上下文时抛错 |
|
|
728
729
|
| `useField()` | 创建字段级读写、校验和状态控制器 |
|
|
729
730
|
| `createFieldContext()` | 向后代提供字段控制器 |
|
|
730
731
|
| `useFieldContext()` | 获取当前字段控制器 |
|
|
731
|
-
| `createFormConfigContext()` |
|
|
732
|
+
| `createFormConfigContext()` | 兼容 API:仅提供表单展示配置;建议改用 `provideFormContext()` |
|
|
732
733
|
| `useFormConfigContext()` | 获取上层表单展示配置 |
|
|
733
734
|
| `useWatch()` | 按单字段、多字段或全表签名监听变化 |
|
|
734
735
|
| `useWatchField()` | 监听单个字段 |
|
|
@@ -739,7 +740,7 @@ componentProps: {
|
|
|
739
740
|
| `useViewSchemas()` | 把 `subscribeViewSchemas()` 桥接为 Vue `shallowRef` |
|
|
740
741
|
| `useFormSelector()` | 从共享表单值 Runtime 派生只读 Vue Ref |
|
|
741
742
|
|
|
742
|
-
`useForm()` 只负责创建和销毁实例。如需让自定义组件树中的 `useField()`、`useDictionary()` 或 `Field`
|
|
743
|
+
`useForm()` 只负责创建和销毁实例。如需让自定义组件树中的 `useField()`、`useDictionary()` 或 `Field` 找到实例,应在 `setup()` 的同步调用栈中调用 `provideFormContext({ form, schemaConfig })`,一次提供表单实例和展示配置。`createFormContext()` 与 `createFormConfigContext()` 仍保留用于兼容旧代码。直接使用 `<Schemx>` 时,统一 Form Context 已由组件提供。
|
|
743
744
|
|
|
744
745
|
### 通用调用规则
|
|
745
746
|
|
|
@@ -756,13 +757,16 @@ function useForm<TValues extends Values = Values>(
|
|
|
756
757
|
源码中参数类型名为 `UseFormOptions<TValues>`,结构等同上面的 `CreateFormOptions`;`UseFormOptions` 未从根入口导出。`options` 可选,未传 Registry 时使用 Vue 全局 `rendererRegistry` 和 `presetRuleRegistry`。函数同步返回 `VueSchemxInstance<TValues>`:它与 `SchemxInstance<TValues>` 结构兼容,但 `getFieldValue()`、`getFieldErrors()`、`isFieldTouched()`、`isFieldPending()`、`getFieldsValue()` 和聚合状态读取可被 Vue effect 追踪。`useForm()` 不读取 Context,也**不会自动 `provide`**;当前 Vue effect scope 销毁时会释放 Runtime 并销毁 Form。非 Vue scope 场景应改用 Core `createForm()` 并自行销毁。
|
|
757
758
|
|
|
758
759
|
```ts
|
|
759
|
-
import {
|
|
760
|
+
import { provideFormContext, useForm } from "@schemx/vue"
|
|
760
761
|
|
|
761
762
|
type ProfileValues = { nickname: string }
|
|
762
763
|
const form = useForm<ProfileValues>({ initialValues: { nickname: "" } })
|
|
763
764
|
|
|
764
|
-
// 需要让后代 Hook
|
|
765
|
-
|
|
765
|
+
// 需要让后代 Hook 读取时,同时提供表单实例和展示配置。
|
|
766
|
+
provideFormContext({
|
|
767
|
+
form,
|
|
768
|
+
schemaConfig: { readonly: false, validationTrigger: "blur" },
|
|
769
|
+
})
|
|
766
770
|
```
|
|
767
771
|
|
|
768
772
|
`useForm()` 除了补全 Vue 全局 Registry 外,会把 Core options 原样传给 `createForm()`。因此直接调用时,`initialValues` 会按 Core 规则形成初始快照,`submit()` 也会等待直接传入的 `onFinish` Promise。前文 `modelValue` 的初始化与同步行为,以及 `onFinish` Promise 不被等待的限制,只属于 `<Schemx>` 内部创建实例时的 Props 转换与回调包装,不属于 `useForm()` 本身。`defaultRendererType` 仍会受全局 Renderer Registry 已被补全的影响,见前文说明。
|
|
@@ -775,66 +779,62 @@ createFormContext(form)
|
|
|
775
779
|
|
|
776
780
|
### 3 组 Context API
|
|
777
781
|
|
|
778
|
-
3 组 Reader 都要求 Context 存在,没有可选读取模式或默认值。`create*Context()` 必须在 Provider 组件的 `setup()` 同步阶段调用,且只对后代可见;`use*Context()` 仅读取最近祖先提供的值。
|
|
782
|
+
3 组 Context Reader 都要求 Context 存在,没有可选读取模式或默认值。`provideFormContext()` 和 `create*Context()` 必须在 Provider 组件的 `setup()` 同步阶段调用,且只对后代可见;`use*Context()` 仅读取最近祖先提供的值。
|
|
779
783
|
|
|
780
784
|
```ts
|
|
785
|
+
function provideFormContext<TValues extends Values = Values>(
|
|
786
|
+
options: ProvideFormContextOptions<TValues>
|
|
787
|
+
): VueSchemxInstance<TValues>
|
|
788
|
+
function useFormContextValue<TValues extends Values = Values>(): FormContextValue<TValues>
|
|
789
|
+
function useFormContext<TValues extends Values = Values>(): VueSchemxInstance<TValues>
|
|
790
|
+
|
|
781
791
|
function createFormContext<TValues extends Values = Values>(
|
|
782
792
|
instance: SchemxInstance<TValues>
|
|
783
793
|
): VueSchemxInstance<TValues>
|
|
784
|
-
function useFormContext<TValues extends Values = Values>(): VueSchemxInstance<TValues>
|
|
785
794
|
|
|
786
795
|
function createFieldContext<TValues extends Values = Values>(
|
|
787
796
|
field: FieldInstance<TValues>
|
|
788
797
|
): void
|
|
789
798
|
function useFieldContext(): FieldInstance<Values>
|
|
790
799
|
|
|
791
|
-
function createFormConfigContext
|
|
792
|
-
props: FormContextProps
|
|
793
|
-
): void
|
|
800
|
+
function createFormConfigContext(props: FormContextProps): void
|
|
794
801
|
function useFormConfigContext(): FormContextProps
|
|
795
802
|
```
|
|
796
803
|
|
|
797
804
|
上面签名中的 `FieldInstance` 已从 `@schemx/vue` 根入口导出。`createFieldContext()` 当前只有 `TValues extends Values = Values`,**没有独立的 `TName` 泛型**;`field` 必须是 `useField()` 返回的 Vue 字段控制器,字段路径已由创建该返回值时的 `name` 捕获。调用方可以显式导入 `FieldInstance`,也可以依靠 `useField()` 推导参数。
|
|
798
805
|
|
|
799
|
-
| Provider 签名
|
|
800
|
-
|
|
|
801
|
-
| `
|
|
802
|
-
| `
|
|
803
|
-
| `
|
|
806
|
+
| Provider 签名 | Reader 签名 | 职责、所有权与缺失行为 |
|
|
807
|
+
| -------------------------------------------------------------------------- | ------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
808
|
+
| `provideFormContext<T>({ form, schemaConfig })` | `useFormContextValue<T>(): FormContextValue<T>` | 一次提供 Vue Form Instance 和展示配置;Provider 只持有 Runtime,不销毁外部 Core Form。 |
|
|
809
|
+
| `provideFormContext<T>({ form, schemaConfig })` | `useFormContext<T>(): VueSchemxInstance<T>` | 只读取统一 Context 中的表单实例;缺失时 Reader 抛出 `Error`。 |
|
|
810
|
+
| `createFormContext<T>(form)`(兼容) | `useFormContext<T>(): VueSchemxInstance<T>` | 仅提供表单实例的旧 API;建议迁移到 `provideFormContext()`。 |
|
|
811
|
+
| `createFieldContext<TValues extends Values = Values>(field): void` | `useFieldContext(): FieldInstance<Values>` | 提供 / 读取 `useField()` 返回的字段控制器。Provider 不创建字段、不接管订阅;缺失时 Reader 抛出 `Error`。 |
|
|
812
|
+
| `createFormConfigContext(props)`(兼容) | `useFormConfigContext(): FormContextProps` | 仅提供 / 读取表单展示配置的旧 API;建议迁移到 `provideFormContext()`。 |
|
|
804
813
|
|
|
805
814
|
```ts
|
|
806
|
-
import {
|
|
807
|
-
createFormConfigContext,
|
|
808
|
-
createFormContext,
|
|
809
|
-
useForm,
|
|
810
|
-
type FormContextProps,
|
|
811
|
-
type SchemxField,
|
|
812
|
-
} from "@schemx/vue"
|
|
815
|
+
import { provideFormContext, useForm, type SchemxField } from "@schemx/vue"
|
|
813
816
|
|
|
814
817
|
type ProfileValues = { nickname: string }
|
|
815
818
|
const schemas: SchemxField<ProfileValues>[] = [
|
|
816
819
|
{ name: "nickname", label: "昵称", componentType: "input" },
|
|
817
820
|
]
|
|
818
821
|
const form = useForm<ProfileValues>({ schemas })
|
|
819
|
-
|
|
822
|
+
provideFormContext({
|
|
823
|
+
form,
|
|
820
824
|
schemaConfig: {
|
|
821
825
|
readonly: false,
|
|
822
826
|
validationTrigger: "blur",
|
|
823
827
|
},
|
|
824
|
-
}
|
|
825
|
-
|
|
826
|
-
createFormContext(form)
|
|
827
|
-
createFormConfigContext(config)
|
|
828
|
+
})
|
|
828
829
|
```
|
|
829
830
|
|
|
830
831
|
在后代组件的 `setup()` 中只读取所需 Context:
|
|
831
832
|
|
|
832
833
|
```ts
|
|
833
|
-
import { useFieldContext,
|
|
834
|
+
import { useFieldContext, useFormContextValue } from "@schemx/vue"
|
|
834
835
|
|
|
835
836
|
type ProfileValues = { nickname: string }
|
|
836
|
-
const form =
|
|
837
|
-
const formConfig = useFormConfigContext()
|
|
837
|
+
const { form, schemaConfig } = useFormContextValue<ProfileValues>()
|
|
838
838
|
const field = useFieldContext()
|
|
839
839
|
```
|
|
840
840
|
|
|
@@ -863,9 +863,9 @@ console.log(nickname.value.value, nickname.errors.value)
|
|
|
863
863
|
|
|
864
864
|
`createFieldContext(field)` 将这一返回值提供给后代并返回 `void`;`useFieldContext()` 无参数,返回最近祖先提供的同一控制器。它们不会替代表单 Context。
|
|
865
865
|
|
|
866
|
-
### `
|
|
866
|
+
### `FormContextValue` 与兼容类型的边界
|
|
867
867
|
|
|
868
|
-
`
|
|
868
|
+
`FormContextValue<T>` 同时包含统一 Context 提供的 `form` 和 `schemaConfig`。旧的 `FormContextProps` 只包含嵌套的 `schemaConfig`,供 `createFormConfigContext()` 兼容使用;这两种类型都不包含 `schemas`、`initialValues`、回调、`class`、`style`、Registry 或 `defaultRendererType`。组件 Props 中的平铺 Schema 字段会在 `<Schemx>` 内部聚合为 `schemaConfig`,再传给 Form 实例和字段展示 Context。
|
|
869
869
|
|
|
870
870
|
### `useWatch`、`useWatchField`、`useWatchFields` 与 `useWatchAll`
|
|
871
871
|
|
|
@@ -991,7 +991,7 @@ console.log(viewSchemas.value)
|
|
|
991
991
|
|
|
992
992
|
它支持与 `Schemx` 一致的动态 Slots:`{name}`、`{name}Label`、`{name}Before`、`{name}Content`、`{name}After`、`{name}Error` 和 `{name}:{slotName}`。完整 Slot Props 见 [Schemx 组件的 Slots](#slots)。
|
|
993
993
|
|
|
994
|
-
`Field`
|
|
994
|
+
`Field` 不能脱离上下文单独工作:普通字段至少需要祖先同步提供表单实例和展示配置,通常直接放在 `<Schemx>` 内部。若自定义 adapter 直接使用它,应调用 `provideFormContext({ form, schemaConfig })`。传给它的 Schema 应来自 `form.getViewSchemas()` 或 `useViewSchemas(form)`,不要把尚未编译的 dependency Schema 直接传入。
|
|
995
995
|
|
|
996
996
|
### `Group`
|
|
997
997
|
|
|
@@ -1061,13 +1061,19 @@ Vue 根入口自有以下公开类型:
|
|
|
1061
1061
|
|
|
1062
1062
|
| 类型 | 定义与用途 |
|
|
1063
1063
|
| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
|
|
1064
|
-
| `
|
|
1064
|
+
| `FormContextValue<TValues>` | 统一 Form Context,包含表单实例和展示配置。见 [Composition API](#formcontextvalue-与兼容类型的边界)。 |
|
|
1065
|
+
| `ProvideFormContextOptions<TValues>` | `provideFormContext()` 的输入配置。 |
|
|
1066
|
+
| `FormContextProps` | 兼容 API 使用的表单展示配置类型。 |
|
|
1065
1067
|
| `SchemxDictionary<TValues, R>` | 函数式选项源配置;`R` 从 `api` 传递到 `formatter`。见 [Dictionary](#dictionary)。 |
|
|
1066
|
-
| `SchemxInstallOptions` |
|
|
1068
|
+
| `SchemxInstallOptions` | 基于 Vue `SchemxVueConfig` 的 App 安装配置,额外包含 `colComponent`;`app.use(Schemx, options)` 会保存为当前 Vue App 的默认配置。 |
|
|
1067
1069
|
| `SchemxWithDictionary<A, TValues>` | `A & { dict?: SchemxDictionary<TValues> }`,只增加可选 `dict`。见 [WithRemoteOptions](#withremoteoptions)。 |
|
|
1068
1070
|
| `UseDictionaryReturn` | `{ list, loading, error, loadDict, refresh, mutate }`,各成员类型见 [`useDictionary`](#usedictionary)。 |
|
|
1069
1071
|
| `SchemxFormProps<TValues>` | `Schemx` 组件 Props 类型,由 Core 表单选项和 Vue 专属 `modelValue`、`form`、`class`、`style` 等属性组合而成。 |
|
|
1070
1072
|
| `FieldInstance<TValues>` | Vue Ref / Computed 桥接后的字段控制器类型,由 `useField()` 返回。 |
|
|
1073
|
+
| `SchemxFieldSlotProps<TValues>` | 字段整体、Label、Before、After 插槽的公共参数。 |
|
|
1074
|
+
| `SchemxFieldContentSlotProps<TValues>` | Content 插槽参数,额外包含默认 Renderer 的 `columnElement`。 |
|
|
1075
|
+
| `SchemxFieldErrorSlotProps<TValues>` | Error 插槽参数,额外包含当前字段的 `errors`。 |
|
|
1076
|
+
| `SchemxFieldSlots<TValues>` | `Field` 组件接收的动态字段插槽与 Renderer 子插槽类型。 |
|
|
1071
1077
|
|
|
1072
1078
|
除上述类型外,不要从 `@schemx/vue/src/*` 或 `@schemx/vue/dist/*` 深层导入。
|
|
1073
1079
|
|
|
@@ -1090,13 +1096,19 @@ Vue 根入口自有以下公开类型:
|
|
|
1090
1096
|
| Registry | `rendererRegistry` | Vue 全局 Renderer Registry。 |
|
|
1091
1097
|
| Registry | `presetRuleRegistry` | Vue 全局 PresetRuleRegistry。 |
|
|
1092
1098
|
| Hook | `useForm` | 创建并按 Vue scope 销毁表单。 |
|
|
1093
|
-
| Context | `
|
|
1099
|
+
| Context | `provideFormContext` | 一次提供表单实例和展示配置。 |
|
|
1100
|
+
| Context | `useFormContextValue` | 读取统一 Form Context。 |
|
|
1094
1101
|
| Context | `useFormContext` | 读取表单实例。 |
|
|
1102
|
+
| Context | `useFormRuntimeContext` | 获取当前表单的共享 Vue Runtime。 |
|
|
1103
|
+
| Context | `createFormContext` | 兼容 API:仅提供表单实例。 |
|
|
1095
1104
|
| Hook | `useField` | 创建 Vue 字段控制器。 |
|
|
1096
1105
|
| Context | `createFieldContext` | 提供字段控制器。 |
|
|
1097
1106
|
| Context | `useFieldContext` | 读取字段控制器。 |
|
|
1098
|
-
| Context | `createFormConfigContext` |
|
|
1099
|
-
| Context | `useFormConfigContext` |
|
|
1107
|
+
| Context | `createFormConfigContext` | 兼容 API:仅提供表单展示配置。 |
|
|
1108
|
+
| Context | `useFormConfigContext` | 读取兼容表单展示配置。 |
|
|
1109
|
+
| Context | `createConfigProviderContext` | 创建 ConfigProvider 上下文。 |
|
|
1110
|
+
| Context | `useConfigProviderContext` | 读取 ConfigProvider 当前配置。 |
|
|
1111
|
+
| Context | `useConfigProviderContextRef` | 读取 ConfigProvider 响应式配置引用。 |
|
|
1100
1112
|
| Watch | `useWatch` | 统一分发 Vue Watch。 |
|
|
1101
1113
|
| Watch | `useWatchField` | 单字段 Vue Watch。 |
|
|
1102
1114
|
| Watch | `useWatchFields` | 多字段 Vue Watch。 |
|
|
@@ -1106,10 +1118,12 @@ Vue 根入口自有以下公开类型:
|
|
|
1106
1118
|
| ViewSchema | `useViewSchemas` | 桥接 ViewSchemas 为 Ref。 |
|
|
1107
1119
|
| Hook | `useFormSelector` | 从表单值派生只读 Vue Ref。 |
|
|
1108
1120
|
| 默认导出 | `default` | 与 `schemxForm` 严格相等。 |
|
|
1109
|
-
| Context 类型 | `
|
|
1121
|
+
| Context 类型 | `FormContextValue<TValues>` | 统一 Form Context,包含表单实例和展示配置。 |
|
|
1122
|
+
| Context 类型 | `ProvideFormContextOptions<TValues>` | `provideFormContext()` 的输入配置。 |
|
|
1123
|
+
| Context 类型 | `FormContextProps` | 兼容 API 使用的表单展示配置类型。 |
|
|
1110
1124
|
| Runtime 类型 | `VueSchemxInstance` | 可在 Vue effect 中追踪读取的 Form Instance。 |
|
|
1111
1125
|
| Dictionary 类型 | `SchemxDictionary` | 函数式选项源配置。 |
|
|
1112
|
-
| 插件类型 | `SchemxInstallOptions` |
|
|
1126
|
+
| 插件类型 | `SchemxInstallOptions` | 基于 Vue `SchemxVueConfig` 且包含 `colComponent` 的 App 默认配置安装选项。 |
|
|
1113
1127
|
| Dictionary 类型 | `SchemxWithDictionary` | 为 Props 增加 `dict`。 |
|
|
1114
1128
|
| Dictionary 类型 | `UseDictionaryReturn` | `useDictionary()` 返回值。 |
|
|
1115
1129
|
| 表单类型 | `SchemxFormProps<TValues>` | `<Schemx>` 组件 Props 类型。 |
|
|
@@ -1135,7 +1149,7 @@ Vue 根入口自有以下公开类型:
|
|
|
1135
1149
|
| 配置 | `mergeSchemxConfig` | 按优先级纯合并配置。 |
|
|
1136
1150
|
| 配置 | `resolveSchemxConfig` | 补齐 `schemaConfig` 默认值。 |
|
|
1137
1151
|
| 配置 | `mergeAndResolveSchemxConfig` | 合并配置并补齐默认值。 |
|
|
1138
|
-
| 配置 | `defaultSchemxConfig` | Core
|
|
1152
|
+
| 配置 | `defaultSchemxConfig` | Core 内置框架无关字段默认值;UI 展示默认值由 Vue 层提供。 |
|
|
1139
1153
|
| 配置 | `defaultSchemxConfigKeys` | 当前默认配置 key 集合。 |
|
|
1140
1154
|
| 配置 | `excludeSchemxConfigKeys` | 不参与字段默认配置的 key。 |
|
|
1141
1155
|
| Watch | `createWatch` | 分发 Core Watch。 |
|
|
@@ -1153,100 +1167,106 @@ Vue 根入口自有以下公开类型:
|
|
|
1153
1167
|
|
|
1154
1168
|
### Core 传递类型
|
|
1155
1169
|
|
|
1156
|
-
| 分类 | 导出 | 用途
|
|
1157
|
-
| ------------------ | ------------------------------- |
|
|
1158
|
-
| Effect | `SignalEffectOptions` | signal effect 配置。
|
|
1159
|
-
| Effect | `SignalEffectDispose` | signal effect 的 dispose 函数类型。
|
|
1160
|
-
| Watch | `SignalWatchOptions` | signal watch 配置。
|
|
1161
|
-
| Watch | `DebouncedSignalWatchOptions` | 带 debounce 的 signal watch 配置。
|
|
1162
|
-
| Watch | `DebouncedSignalWatchControls` | 带 debounce 的 signal watch 控制器。
|
|
1163
|
-
| Watch | `CreateWatchOptions` | Watch 选项。
|
|
1164
|
-
| Watch | `CreateWatchReturn` | Watch 取消函数。
|
|
1165
|
-
| Watch | `WatchFieldCallback` | 单字段 Watch callback。
|
|
1166
|
-
| Watch | `WatchFieldsCallback` | 多字段 Watch callback。
|
|
1167
|
-
| Watch | `WatchAllCallback` | 全表 Watch callback。
|
|
1168
|
-
| 表单 | `CreateFormOptions` | Core 表单创建选项。
|
|
1169
|
-
| 表单 | `FormSchemaOptions` | Schema、初始值和 `schemaConfig` 配置。
|
|
1170
|
-
| 表单 | `FormRegistryOptions` | Renderer、Rule Registry 和 adapter 配置。
|
|
1171
|
-
| 表单 | `FormCallbackOptions` | 提交、值变化和规则错误回调。
|
|
1172
|
-
| 表单 | `FormLifecycleOptions` | Runtime 生命周期钩子。
|
|
1173
|
-
| 表单 | `ResolvedCreateFormOptions` | 已归一化的 Form 创建配置。
|
|
1174
|
-
| 表单 | `SchemxInstance` | Core 表单实例接口。
|
|
1175
|
-
| 基础 | `Values` | 表单值基础约束。
|
|
1176
|
-
| 基础 | `Dynamic` | 静态值或同步 / 异步值函数。
|
|
1177
|
-
| 路径 | `NamePath` | 类型安全字段路径。
|
|
1178
|
-
| 路径 | `FieldValue` | 从路径提取字段值。
|
|
1179
|
-
| 工具类型 | `DeepReadonly` | 深层只读类型。
|
|
1180
|
-
| 工具类型 | `CSSProperties` | CSS 属性类型。
|
|
1181
|
-
| Schema source | `SchemxSchemas` | 可更新 Schema source。
|
|
1182
|
-
| Schema source | `SchemxSchemasInput` | Schema 数组或 source 联合。
|
|
1183
|
-
| Schema source | `SchemxSchemasListener` | Schema source listener。
|
|
1184
|
-
| 字段 | `SchemxFieldInstance` | Core 字段控制器。
|
|
1185
|
-
| 字段数组 | `FieldArrayItemValue` | 数组字段行值类型。
|
|
1186
|
-
| 字段数组 | `FieldArrayPath` | 数组字段路径类型。
|
|
1187
|
-
| 表单 | `SchemxFormApi` | 传递给动态 Schema 回调的表单 API。
|
|
1188
|
-
| 表单 | `SchemxFieldRulesMap` | 按字段路径配置的规则映射。
|
|
1189
|
-
| Schema | `SchemxBase` | 普通字段基础接口。
|
|
1190
|
-
| Schema | `SchemxBaseField` | 按 Renderer key 分布的字段联合。
|
|
1191
|
-
| Schema | `SchemxExactBaseField` | 保留具体 Renderer key 的字段类型。
|
|
1192
|
-
| Schema | `SchemxGroupField` | 原始 Group Schema。
|
|
1193
|
-
| Schema | `SchemxDependencyField` | 原始 Dependency Schema。
|
|
1194
|
-
| Schema | `SchemxField` | 全部原始 Schema 联合。
|
|
1195
|
-
| Schema | `SchemxBaseComponentProps` | Renderer 公共 Props。
|
|
1196
|
-
| Schema | `
|
|
1197
|
-
| Schema | `
|
|
1198
|
-
|
|
|
1199
|
-
| 扩展 | `
|
|
1200
|
-
|
|
|
1201
|
-
|
|
|
1202
|
-
| 依赖 | `
|
|
1203
|
-
| 依赖 | `
|
|
1204
|
-
| 依赖 | `
|
|
1205
|
-
|
|
|
1206
|
-
|
|
|
1207
|
-
|
|
|
1208
|
-
| ViewSchema | `
|
|
1209
|
-
|
|
|
1210
|
-
|
|
|
1211
|
-
|
|
|
1212
|
-
| 配置 | `
|
|
1213
|
-
| 配置 | `
|
|
1214
|
-
|
|
|
1215
|
-
|
|
|
1216
|
-
|
|
|
1217
|
-
|
|
|
1218
|
-
| Renderer
|
|
1219
|
-
|
|
|
1220
|
-
|
|
|
1221
|
-
|
|
|
1222
|
-
|
|
|
1223
|
-
| Validator | `
|
|
1224
|
-
| Validator | `
|
|
1225
|
-
| Validator | `
|
|
1226
|
-
| Validator | `
|
|
1227
|
-
| Validator | `
|
|
1228
|
-
| Validator | `
|
|
1229
|
-
| Validator | `
|
|
1230
|
-
| Validator | `
|
|
1231
|
-
| Validator | `
|
|
1232
|
-
| Validator | `
|
|
1233
|
-
| Validator | `
|
|
1234
|
-
| Validator | `
|
|
1235
|
-
| Validator | `
|
|
1236
|
-
| Validator | `
|
|
1237
|
-
| Validator | `
|
|
1238
|
-
| Validator | `
|
|
1239
|
-
|
|
|
1240
|
-
|
|
|
1241
|
-
|
|
|
1242
|
-
|
|
|
1243
|
-
|
|
|
1244
|
-
|
|
|
1245
|
-
| Rule | `
|
|
1246
|
-
|
|
|
1247
|
-
|
|
|
1248
|
-
|
|
|
1249
|
-
|
|
|
1250
|
-
|
|
|
1251
|
-
|
|
|
1252
|
-
| Validator Registry | `
|
|
1170
|
+
| 分类 | 导出 | 用途 |
|
|
1171
|
+
| ------------------ | ------------------------------- | ----------------------------------------- |
|
|
1172
|
+
| Effect | `SignalEffectOptions` | signal effect 配置。 |
|
|
1173
|
+
| Effect | `SignalEffectDispose` | signal effect 的 dispose 函数类型。 |
|
|
1174
|
+
| Watch | `SignalWatchOptions` | signal watch 配置。 |
|
|
1175
|
+
| Watch | `DebouncedSignalWatchOptions` | 带 debounce 的 signal watch 配置。 |
|
|
1176
|
+
| Watch | `DebouncedSignalWatchControls` | 带 debounce 的 signal watch 控制器。 |
|
|
1177
|
+
| Watch | `CreateWatchOptions` | Watch 选项。 |
|
|
1178
|
+
| Watch | `CreateWatchReturn` | Watch 取消函数。 |
|
|
1179
|
+
| Watch | `WatchFieldCallback` | 单字段 Watch callback。 |
|
|
1180
|
+
| Watch | `WatchFieldsCallback` | 多字段 Watch callback。 |
|
|
1181
|
+
| Watch | `WatchAllCallback` | 全表 Watch callback。 |
|
|
1182
|
+
| 表单 | `CreateFormOptions` | Core 表单创建选项。 |
|
|
1183
|
+
| 表单 | `FormSchemaOptions` | Schema、初始值和 `schemaConfig` 配置。 |
|
|
1184
|
+
| 表单 | `FormRegistryOptions` | Renderer、Rule Registry 和 adapter 配置。 |
|
|
1185
|
+
| 表单 | `FormCallbackOptions` | 提交、值变化和规则错误回调。 |
|
|
1186
|
+
| 表单 | `FormLifecycleOptions` | Runtime 生命周期钩子。 |
|
|
1187
|
+
| 表单 | `ResolvedCreateFormOptions` | 已归一化的 Form 创建配置。 |
|
|
1188
|
+
| 表单 | `SchemxInstance` | Core 表单实例接口。 |
|
|
1189
|
+
| 基础 | `Values` | 表单值基础约束。 |
|
|
1190
|
+
| 基础 | `Dynamic` | 静态值或同步 / 异步值函数。 |
|
|
1191
|
+
| 路径 | `NamePath` | 类型安全字段路径。 |
|
|
1192
|
+
| 路径 | `FieldValue` | 从路径提取字段值。 |
|
|
1193
|
+
| 工具类型 | `DeepReadonly` | 深层只读类型。 |
|
|
1194
|
+
| 工具类型 | `CSSProperties` | CSS 属性类型。 |
|
|
1195
|
+
| Schema source | `SchemxSchemas` | 可更新 Schema source。 |
|
|
1196
|
+
| Schema source | `SchemxSchemasInput` | Schema 数组或 source 联合。 |
|
|
1197
|
+
| Schema source | `SchemxSchemasListener` | Schema source listener。 |
|
|
1198
|
+
| 字段 | `SchemxFieldInstance` | Core 字段控制器。 |
|
|
1199
|
+
| 字段数组 | `FieldArrayItemValue` | 数组字段行值类型。 |
|
|
1200
|
+
| 字段数组 | `FieldArrayPath` | 数组字段路径类型。 |
|
|
1201
|
+
| 表单 | `SchemxFormApi` | 传递给动态 Schema 回调的表单 API。 |
|
|
1202
|
+
| 表单 | `SchemxFieldRulesMap` | 按字段路径配置的规则映射。 |
|
|
1203
|
+
| Schema | `SchemxBase` | 普通字段基础接口。 |
|
|
1204
|
+
| Schema | `SchemxBaseField` | 按 Renderer key 分布的字段联合。 |
|
|
1205
|
+
| Schema | `SchemxExactBaseField` | 保留具体 Renderer key 的字段类型。 |
|
|
1206
|
+
| Schema | `SchemxGroupField` | 原始 Group Schema。 |
|
|
1207
|
+
| Schema | `SchemxDependencyField` | 原始 Dependency Schema。 |
|
|
1208
|
+
| Schema | `SchemxField` | 全部原始 Schema 联合。 |
|
|
1209
|
+
| Schema | `SchemxBaseComponentProps` | Core Renderer 公共 Props。 |
|
|
1210
|
+
| Schema | `SchemxFormItemProps` | Field 展示 Props。 |
|
|
1211
|
+
| Schema | `SchemxVueBaseComponentProps` | Vue Renderer 公共 Props。 |
|
|
1212
|
+
| Schema | `SchemxComponentProps` | Renderer 专属与公共 Props。 |
|
|
1213
|
+
| 扩展 | `SchemxComponentPropsDefinition` | Renderer 公共 Props 的声明合并扩展点。 |
|
|
1214
|
+
| 扩展 | `SchemxFieldDefinition` | 普通字段声明合并接口。 |
|
|
1215
|
+
| 扩展 | `SchemxGroupFieldDefinition` | Group 声明合并接口。 |
|
|
1216
|
+
| 依赖 | `SchemxFieldDependencies` | 普通字段的动态属性与触发字段配置。 |
|
|
1217
|
+
| 依赖 | `SchemxFieldDependenciesDefinition` | 字段依赖配置的适配层声明合并扩展点。 |
|
|
1218
|
+
| 依赖 | `SchemxGroupDependencies` | Group 容器的动态状态配置。 |
|
|
1219
|
+
| 依赖 | `SchemxDependencyDependencies` | Dependency 容器的动态状态配置。 |
|
|
1220
|
+
| 依赖 | `SchemxContainerDependencies` | Group/Dependency 容器动态状态配置。 |
|
|
1221
|
+
| 依赖 | `SchemxConditionFn` | 动态属性条件函数。 |
|
|
1222
|
+
| ViewSchema | `SchemxViewDebugMeta` | ViewSchema 诊断元数据。 |
|
|
1223
|
+
| ViewSchema | `SchemxViewFieldSchema` | 字段渲染投影。 |
|
|
1224
|
+
| ViewSchema | `SchemxViewGroupSchema` | Group 渲染投影。 |
|
|
1225
|
+
| ViewSchema | `SchemxViewSchema` | 字段 / Group 投影联合。 |
|
|
1226
|
+
| 配置 | `MergedSchemxConfig` | 已合并且补齐 `schemaConfig` 默认值。 |
|
|
1227
|
+
| 配置 | `SchemxConfig` | Core 模块级和 Form/App 可继承配置。 |
|
|
1228
|
+
| 配置 | `SchemxSchemaConfig` | 表单级字段默认展示与校验配置。 |
|
|
1229
|
+
| 配置 | `SchemxSchemaConfigDefinition` | 表单级 Schema 配置的适配层声明合并扩展点。 |
|
|
1230
|
+
| 配置 | `SchemxConfigKey` | 当前默认配置 key 类型。 |
|
|
1231
|
+
| 配置 | `ExcludeSchemxConfigKeys` | 排除配置 key 类型。 |
|
|
1232
|
+
| Renderer | `SchemxRendererKey` | Renderer key 类型。 |
|
|
1233
|
+
| Renderer | `SchemxRendererDefinition` | Renderer Props 声明合并接口。 |
|
|
1234
|
+
| Renderer Registry | `RendererRegistry` | Renderer Registry 实例类型。 |
|
|
1235
|
+
| Renderer Registry | `RegistryOptions` | 注册覆盖选项(renderer 与 rule 共享)。 |
|
|
1236
|
+
| Renderer Registry | `RendererMap` | Renderer 批量映射。 |
|
|
1237
|
+
| Validator | `ValidationRule` | 原生规则接口。 |
|
|
1238
|
+
| Validator | `ValidationRuleContext` | 原生规则执行上下文。 |
|
|
1239
|
+
| Validator | `ValidationRuleIssue` | 单条规则产生的问题。 |
|
|
1240
|
+
| Validator | `ValidationRuleResult` | 单条规则执行结果。 |
|
|
1241
|
+
| Validator | `ValidationResult` | 校验成功 / 失败联合。 |
|
|
1242
|
+
| Validator | `ValidationSuccess` | 校验成功结果。 |
|
|
1243
|
+
| Validator | `ValidationFailure` | 普通校验失败结果。 |
|
|
1244
|
+
| Validator | `ValidationCancelled` | 被更新校验或销毁操作中止的结果。 |
|
|
1245
|
+
| Validator | `ValidationError` | 校验失败详情。 |
|
|
1246
|
+
| Validator | `FieldValidationError` | 单字段错误。 |
|
|
1247
|
+
| Validator | `FormValidationError` | 表单级错误。 |
|
|
1248
|
+
| Validator | `AdapterRule` | 第三方 adapter 创建的品牌规则。 |
|
|
1249
|
+
| Validator | `ValidationAdapterRule` | adapter 接收的第三方规则输入类型。 |
|
|
1250
|
+
| Validator | `ValidationAdapterID` | adapter 的唯一标识类型。 |
|
|
1251
|
+
| Validator | `ValidationAdapterV1` | 第三方校验 adapter 协议。 |
|
|
1252
|
+
| Validator | `ValidationAdapter` | `ValidationAdapterV1` 的兼容别名。 |
|
|
1253
|
+
| Validator | `ValidationAdapterRegistration` | adapter 注册及覆盖选项。 |
|
|
1254
|
+
| Validator | `ValidationAdapterOption` | adapter 或带覆盖选项的注册项。 |
|
|
1255
|
+
| Validator | `ValidationTrigger` | 校验触发时机。 |
|
|
1256
|
+
| Validator | `StandardSchemaV1` | Standard Schema v1 协议。 |
|
|
1257
|
+
| Validator | `AsyncValidatorRule` | async-validator 单条规则。 |
|
|
1258
|
+
| Validator | `AsyncValidatorDescriptor` | async-validator 单条或多条规则描述。 |
|
|
1259
|
+
| Rule | `PresetRuleDefinition` | 自定义规则声明合并接口。 |
|
|
1260
|
+
| Rule | `PresetRuleName` | 声明合并推导的规则 key。 |
|
|
1261
|
+
| Rule | `RequiredOptions` | 必填消息与空值判断配置。 |
|
|
1262
|
+
| Rule | `RequiredConfig` | 布尔必填开关或必填配置对象。 |
|
|
1263
|
+
| Rule | `DefinedFieldValue` | 从表单值和路径提取已定义字段值。 |
|
|
1264
|
+
| Rule | `FieldRule` | 单个字段规则联合类型。 |
|
|
1265
|
+
| Rule | `FieldRules` | Standard Schema、内置或自定义规则。 |
|
|
1266
|
+
| Validator Registry | `PresetRuleRegistry` | PresetRuleRegistry 实例类型。 |
|
|
1267
|
+
| Validator Registry | `PresetRuleFactoryContext` | 规则工厂接收的字段上下文。 |
|
|
1268
|
+
| Validator Registry | `PresetRuleFactory` | 按字段 Schema 生成规则的工厂。 |
|
|
1269
|
+
| Validator Registry | `PresetRuleEntry` | Standard Schema、原生规则或工厂联合。 |
|
|
1270
|
+
| Validator Registry | `PresetRuleMap` | 规则名到条目的批量映射。 |
|
|
1271
|
+
| Validator Registry | `PresetRuleRegistryChange` | Registry 变更事件。 |
|
|
1272
|
+
| Validator Registry | `PresetRuleRegistryListener` | Registry 变更监听器。 |
|