@schemx/vue 1.0.0-next.1 → 1.0.0-next.3
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 +72 -44
- package/dist/analyze.html +1 -1
- package/dist/bridge/fieldBridge.d.ts +23 -0
- package/dist/bridge/fieldBridge.d.ts.map +1 -0
- package/dist/bridge/formBridge.d.ts +81 -0
- package/dist/bridge/formBridge.d.ts.map +1 -0
- package/dist/bridge/formFacade.d.ts +65 -0
- package/dist/bridge/formFacade.d.ts.map +1 -0
- package/dist/bridge/helpers.d.ts +31 -0
- package/dist/bridge/helpers.d.ts.map +1 -0
- package/dist/bridge/index.d.ts +11 -0
- package/dist/bridge/index.d.ts.map +1 -0
- package/dist/bridge/types.d.ts +109 -0
- package/dist/bridge/types.d.ts.map +1 -0
- package/dist/components/Button/index.d.ts +3 -0
- package/dist/components/Button/index.d.ts.map +1 -0
- package/dist/components/Button/index.vue.d.ts +30 -0
- package/dist/components/Button/index.vue.d.ts.map +1 -0
- package/dist/components/Button/types.d.ts +21 -0
- package/dist/components/Button/types.d.ts.map +1 -0
- package/dist/components/FormItem/index.d.ts +1 -1
- package/dist/components/FormItem/index.d.ts.map +1 -1
- package/dist/config/appConfig.d.ts.map +1 -1
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/provideFormContext.d.ts +4 -3
- package/dist/hooks/provideFormContext.d.ts.map +1 -1
- package/dist/hooks/useField.d.ts +3 -29
- package/dist/hooks/useField.d.ts.map +1 -1
- package/dist/hooks/useForm.d.ts +3 -2
- package/dist/hooks/useForm.d.ts.map +1 -1
- package/dist/hooks/useFormSelector.d.ts +38 -0
- package/dist/hooks/useFormSelector.d.ts.map +1 -0
- package/dist/hooks/useViewSchemas.d.ts +23 -3
- package/dist/hooks/useViewSchemas.d.ts.map +1 -1
- package/dist/hooks/useWatch.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +614 -109
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/field.d.ts +1 -1
- package/dist/types/form.d.ts +33 -1
- package/dist/types/form.d.ts.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
如果项目使用 Vant,推荐直接安装 [`@schemx/vant`](../vant)。该包已经注册常用的移动端表单 Renderer。
|
|
6
6
|
|
|
7
|
+
适用于使用自研组件或设计系统的 Vue 3 项目。该包提供表单组件、响应式 Hook 和 Renderer 注册机制,但不内置具体输入控件;每种 `componentType` 都需要由应用自行注册 Renderer。
|
|
8
|
+
|
|
7
9
|
## 安装与样式
|
|
8
10
|
|
|
9
11
|
```bash
|
|
@@ -83,6 +85,7 @@ console.log(Schemx === schemxForm) // true
|
|
|
83
85
|
| `modelValue` | `T` | `{}` | `v-model` 的输入端;非空值参与初始快照,后续替换会同步到内部表单,字段变化会通过 `update:modelValue` 输出 |
|
|
84
86
|
| `initialValues` | `T` | `{}` | 创建内部表单时的初始值,也是 `reset()` 的还原基准 |
|
|
85
87
|
| `form` | `SchemxInstance<T>` | `undefined` | 外部表单实例;传入后组件不再创建实例,但仍会提供 Vue 上下文并同步 `schemas`;组件级回调不会写入该实例,`v-model` 仍监听实例变化 |
|
|
88
|
+
| `rendererProps` | `SchemxRendererPropsMap<T>` | `undefined` | 按 Renderer 类型设置静态默认 Props;字段 `componentProps` 与 Runtime 注入值优先 |
|
|
86
89
|
| `rendererRegistry` | `RendererRegistry` | 全局 `rendererRegistry` | 当前表单使用的 Renderer Registry |
|
|
87
90
|
| `defaultRendererType` | `SchemxRendererKey` | `undefined` | 创建内部表单且未传 `rendererRegistry` 时的默认 Renderer 类型;Vue 全局 Registry 存在时由该 Registry 的 fallback 决定 |
|
|
88
91
|
| `validationRuleRegistry` | `ValidationRuleRegistry` | 全局 `validationRuleRegistry` | 当前表单使用的校验规则 Registry |
|
|
@@ -100,9 +103,13 @@ console.log(Schemx === schemxForm) // true
|
|
|
100
103
|
| `colon` | `boolean` | `undefined` | 表单级标签冒号默认值;字段自身配置优先,均未配置时为 `true` |
|
|
101
104
|
| `onFinish` | `(values: Readonly<T>) => void \| Promise<void>` | `undefined` | `submit()` 校验通过后的回调 Prop |
|
|
102
105
|
| `onFinishFailed` | `(failure: ValidationFailure<T>) => void` | `undefined` | `submit()` 校验失败后的回调 Prop |
|
|
106
|
+
| `onReset` | `() => void` | `undefined` | 内部表单完整 `reset()` 完成后的回调;不在 `resetFields()` 后触发 |
|
|
107
|
+
| `onLoadingChange` | `(loading: boolean) => void` | `undefined` | 内部表单提交开始和结束时的回调 |
|
|
103
108
|
| `onValuesChange` | `(changedValues, latestSnapshot) => void` | `undefined` | 字段值变化后的回调 Prop |
|
|
104
109
|
| `onFieldsChange` | `(changedFields, allFields) => void` | `undefined` | 字段路径变化后的回调 Prop |
|
|
105
110
|
| `onRuleError` | `CreateValidatorOptions<T>["onRuleError"]` | `undefined` | 规则解析异常回调;内部创建实例时当前不会透传,需在外部 `form` 实例上配置 |
|
|
111
|
+
| `loading` | `boolean` | `undefined` | 覆盖内置操作区显示的提交状态,不改变 Core 的真实提交状态 |
|
|
112
|
+
| `submitter` / `resetter` | `boolean \| SchemxFormActionConfig` | `undefined` | 控制内置提交 / 重置按钮;未配置时不渲染,设为 `false` 隐藏,配置可设置 `text` 和 `buttonProps` |
|
|
106
113
|
| `class` | `string` | `""` | 添加到根 `.schemx` 元素的类名 |
|
|
107
114
|
| `style` | `StyleValue` | `{}` | 绑定到根 `.schemx` 元素 |
|
|
108
115
|
|
|
@@ -118,6 +125,7 @@ console.log(Schemx === schemxForm) // true
|
|
|
118
125
|
- 外部替换 `modelValue` 后,组件会调用 `setFieldsValue()` 同步内部表单。
|
|
119
126
|
- 内部或外部 `form` 的字段变化都会发出 `update:modelValue`,值为最新表单快照;同步来自 `modelValue` 的变化不会重复发出该事件。
|
|
120
127
|
- 传入外部 `form` 时,组件级 `onFinish`、`onFinishFailed`、`onValuesChange` 和 `onFieldsChange` 不会重新配置该实例;这些回调应在创建外部实例时配置。
|
|
128
|
+
- 传入外部 `form` 时,`onReset` 与 `onLoadingChange` 同样不会重新配置该实例;请在创建该实例时传入回调。
|
|
121
129
|
- `onFinish`、`onFinishFailed`、`onValuesChange` 和 `onFieldsChange` 是声明过的回调 Props,不在 `defineEmits` 的事件列表中。模板中的 `@finish` 等写法会按 Vue listener Prop 规则映射到这些 Props,但 TypeScript 用户更适合显式传回调。
|
|
122
130
|
|
|
123
131
|
内部表单模式还存在一个 `onFinish` 等待边界:组件传给 core 的包装函数会调用 `props.onFinish(values)`,但没有 `return` 或 `await` 其返回值。因此 `submit()` 只等待这层立即完成的包装 Promise,不等待业务 `onFinish` 返回的异步任务;该任务后续 reject 也不会沿 `submit()` 传播。业务回调若在返回 Promise 前同步抛错,包装函数会转为 rejected Promise,core 的 `submit()` 仍会收到该拒绝。传入外部 `form` 时组件不会安装这层包装,等待和错误传播完全取决于外部实例创建者配置的回调;core `createForm()` 本身会 `await` 直接传给它的 `onFinish`。
|
|
@@ -132,17 +140,21 @@ console.log(Schemx === schemxForm) // true
|
|
|
132
140
|
|
|
133
141
|
### Slots
|
|
134
142
|
|
|
135
|
-
`Schemx` 把收到的所有 Slots 继续传给每个 `FormItem`。字符串字段名直接参与 Slot 命名。数组路径目前存在两种不同的字符串化规则:整体字段 Slot 和 Renderer 子 Slot 会先经过 `normalizeNameKey()`,用 `.`
|
|
143
|
+
`Schemx` 把收到的所有 Slots 继续传给每个 `FormItem`。字符串字段名直接参与 Slot 命名。数组路径目前存在两种不同的字符串化规则:整体字段 Slot 和 Renderer 子 Slot 会先经过 `normalizeNameKey()`,用 `.` 连接;标签、前置、内容、后置和错误 Slot 则直接把数组插入模板字符串,使用 JavaScript 默认的逗号连接。这是当前实现差异,并非统一的命名约定。
|
|
136
144
|
|
|
137
145
|
| Slot 名称 | Slot Props | 行为 |
|
|
138
146
|
| ------------------- | -------------------------------------- | -------------------------------------------------------------------------------------------------------- |
|
|
139
147
|
| `{name}` | 当前字段的 `SchemxViewSchema` | 完全接管整个字段,不渲染默认 FormItem 结构;数组路径 `['user', 'name']` 对应 `user.name` |
|
|
140
148
|
| `{name}Label` | 当前字段的 `SchemxViewSchema` | 替换标签区域;同一数组路径当前对应 `user,nameLabel` |
|
|
149
|
+
| `{name}Before` | 当前字段的 `value` 与 Renderer Props | 渲染在 Renderer 前;同一数组路径当前对应 `user,nameBefore` |
|
|
141
150
|
| `{name}Content` | 当前字段 Schema 字段及 `columnElement` | 替换控件内容区域;`columnElement` 是已经创建的 Renderer VNode;同一数组路径当前对应 `user,nameContent` |
|
|
151
|
+
| `{name}After` | 当前字段的 `value` 与 Renderer Props | 渲染在 Renderer 后、错误区域前;同一数组路径当前对应 `user,nameAfter` |
|
|
142
152
|
| `{name}Error` | 当前字段 Schema 字段及 `errors` | 替换错误区域;同一数组路径当前对应 `user,nameError` |
|
|
143
153
|
| `{name}:{slotName}` | 原样传给 Renderer | 去掉 `{name}:` 前缀后作为 Renderer 命名 Slot;同一数组路径的前缀为 `user.name:`,例如 `user.name:prefix` |
|
|
154
|
+
| `submitter` | `{ form, loading, disabled, submit }` | 替换内置提交按钮。 |
|
|
155
|
+
| `resetter` | `{ form, loading, disabled, reset }` | 替换内置重置按钮。 |
|
|
144
156
|
|
|
145
|
-
字段名和 `Label` / `Content` / `Error` 组合支持 camelCase 与 kebab-case 互查。子 Renderer Slot 的字段名前缀也支持这两种形式。
|
|
157
|
+
字段名和 `Label` / `Before` / `Content` / `After` / `Error` 组合支持 camelCase 与 kebab-case 互查。子 Renderer Slot 的字段名前缀也支持这两种形式。
|
|
146
158
|
|
|
147
159
|
```vue
|
|
148
160
|
<Schemx :schemas="schemas">
|
|
@@ -150,6 +162,14 @@ console.log(Schemx === schemxForm) // true
|
|
|
150
162
|
<strong>{{ schema.label }}</strong>
|
|
151
163
|
</template>
|
|
152
164
|
|
|
165
|
+
<template #nicknameBefore>
|
|
166
|
+
<span>@</span>
|
|
167
|
+
</template>
|
|
168
|
+
|
|
169
|
+
<template #nicknameAfter="{ value }">
|
|
170
|
+
<small>{{ String(value).length }}/20</small>
|
|
171
|
+
</template>
|
|
172
|
+
|
|
153
173
|
<template #nicknameError="{ errors }">
|
|
154
174
|
<small v-if="errors?.length">{{ errors.join(";") }}</small>
|
|
155
175
|
</template>
|
|
@@ -701,6 +721,8 @@ componentProps: {
|
|
|
701
721
|
| `useDictionary()` | 管理依赖字段的函数式选项来源 |
|
|
702
722
|
| `useStableRef()` | 创建引用保持稳定的 `shallowRef` |
|
|
703
723
|
| `useViewSchemas()` | 把 `subscribeViewSchemas()` 桥接为 Vue `shallowRef` |
|
|
724
|
+
| `useFormSelector()` | 从共享表单值 Bridge 派生只读 Vue Ref |
|
|
725
|
+
| `getCoreForm()` | 从 Vue Facade 取得原始 Core Form |
|
|
704
726
|
|
|
705
727
|
`useForm()` 只负责创建和销毁实例。如需让自定义组件树中的 `useField()`、`useDictionary()` 或 `FormItem` 找到实例,Provider 必须在 `setup()` 的同步调用栈中调用 `createFormContext(form)`;展示层还应调用 `createFormConfigContext({ schemaConfig })`。直接使用 `<Schemx>` 时,这两种上下文已经由组件提供。
|
|
706
728
|
|
|
@@ -713,10 +735,10 @@ componentProps: {
|
|
|
713
735
|
```ts
|
|
714
736
|
function useForm<TValues extends Values = Values>(
|
|
715
737
|
options?: CreateFormOptions<TValues, NamePath<TValues>>
|
|
716
|
-
):
|
|
738
|
+
): VueSchemxInstance<TValues>
|
|
717
739
|
```
|
|
718
740
|
|
|
719
|
-
源码中参数类型名为 `UseFormOptions<TValues>`,结构等同上面的 `CreateFormOptions`;`UseFormOptions` 未从根入口导出。`options` 可选,未传 Registry 时使用 Vue 全局 `rendererRegistry` 和 `validationRuleRegistry`。函数同步返回 `SchemxInstance<TValues
|
|
741
|
+
源码中参数类型名为 `UseFormOptions<TValues>`,结构等同上面的 `CreateFormOptions`;`UseFormOptions` 未从根入口导出。`options` 可选,未传 Registry 时使用 Vue 全局 `rendererRegistry` 和 `validationRuleRegistry`。函数同步返回 `VueSchemxInstance<TValues>`:它与 `SchemxInstance<TValues>` 结构兼容,但 `getFieldValue()`、`getFieldErrors()`、`isFieldTouched()`、`isFieldPending()`、`getFieldsValue()` 和聚合状态读取可被 Vue effect 追踪。需要原始 Core 实例时使用 `getCoreForm(form)`。`useForm()` 不读取 Context,也**不会自动 `provide`**;当前 Vue effect scope 销毁时会释放 Bridge 并销毁 Form。非 Vue scope 场景应改用 Core `createForm()` 并自行销毁。
|
|
720
742
|
|
|
721
743
|
```ts
|
|
722
744
|
import { createFormContext, useForm } from "@schemx/vue"
|
|
@@ -730,6 +752,12 @@ createFormContext(form)
|
|
|
730
752
|
|
|
731
753
|
`useForm()` 除了补全 Vue 全局 Registry 外,会把 Core options 原样传给 `createForm()`。因此直接调用时,`modelValue` 会按 Core 规则覆盖同名 `initialValues` 并形成初始快照,`submit()` 也会等待直接传入的 `onFinish` Promise。前文 `modelValue` 不初始化、不持续反向同步,以及 `onFinish` Promise 不被等待的限制,只属于 `<Schemx>` 内部创建实例时的 Props 转换与回调包装,不属于 `useForm()` 本身。`defaultRendererType` 仍会受全局 Renderer Registry 已被补全的影响,见前文说明。
|
|
732
754
|
|
|
755
|
+
### Vue Facade 与共享 Bridge
|
|
756
|
+
|
|
757
|
+
同一 Core Form 始终复用一个 Facade;Vue Bridge 按需创建,并在存活期间由各个 Vue owner 共享。Facade 的写入、校验、提交、Schema 与 Registry 方法都委托原始 Core Form;仅常用状态读取会额外建立 Vue 依赖。`getFieldsValue()` 无参数时依赖全表值,传入路径时仅依赖这些字段。`getFieldSnapshot()`、`getFieldsSnapshot()`、`getInitialValue()` 与 `getInitialValues()` 保持 Core 的无依赖快照语义。
|
|
758
|
+
|
|
759
|
+
`useFormSelector()` 和 `useField()` 复用这个 Bridge;前者返回 selector 结果的只读 Ref,后者复用字段 `value`、`errors`、`touched` 和 `pending` Ref。Bridge 通过 `@schemx/core/adapter` 的 `createFormStateAdapter()` 消费 Core `SnapshotSource`。最后一个 Vue owner 释放或手动调用 `form.destroy()` 后,Bridge 会停止订阅并释放这些快照来源。
|
|
760
|
+
|
|
733
761
|
### 3 组 Context API
|
|
734
762
|
|
|
735
763
|
3 组 Reader 都要求 Context 存在,没有可选读取模式或默认值。`create*Context()` 必须在 Provider 组件的 `setup()` 同步阶段调用,且只对后代可见;`use*Context()` 仅读取最近祖先提供的值。
|
|
@@ -737,8 +765,8 @@ createFormContext(form)
|
|
|
737
765
|
```ts
|
|
738
766
|
function createFormContext<TValues extends Values = Values>(
|
|
739
767
|
instance: SchemxInstance<TValues>
|
|
740
|
-
):
|
|
741
|
-
function useFormContext<TValues extends Values = Values>():
|
|
768
|
+
): VueSchemxInstance<TValues>
|
|
769
|
+
function useFormContext<TValues extends Values = Values>(): VueSchemxInstance<TValues>
|
|
742
770
|
|
|
743
771
|
function createFieldContext<TValues extends Values = Values>(
|
|
744
772
|
field: FieldInstance<TValues>
|
|
@@ -753,11 +781,11 @@ function useFormConfigContext(): FormContextProps
|
|
|
753
781
|
|
|
754
782
|
上面签名中的 `FieldInstance` 已从 `@schemx/vue` 根入口导出。`createFieldContext()` 当前只有 `TValues extends Values = Values`,**没有独立的 `TName` 泛型**;`field` 必须是 `useField()` 返回的 Vue 字段控制器,字段路径已由创建该返回值时的 `name` 捕获。调用方可以显式导入 `FieldInstance`,也可以依靠 `useField()` 推导参数。
|
|
755
783
|
|
|
756
|
-
| Provider 签名
|
|
757
|
-
|
|
|
758
|
-
| `createFormContext<T>(form: SchemxInstance<T>):
|
|
759
|
-
| `createFieldContext<TValues extends Values = Values>(field): void`
|
|
760
|
-
| `createFormConfigContext<T>(props: FormContextProps<T>): void`
|
|
784
|
+
| Provider 签名 | Reader 签名 | 职责、所有权与缺失行为 |
|
|
785
|
+
| --------------------------------------------------------------------- | ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
786
|
+
| `createFormContext<T>(form: SchemxInstance<T>): VueSchemxInstance<T>` | `useFormContext<T>(): VueSchemxInstance<T>` | 将 Core Form 或已有 Facade 归一化后提供 / 读取。Provider 只持有 Bridge,不销毁外部 Core Form;缺失时 Reader 抛出带 `createFormContext(form)` 指引的 `Error`。 |
|
|
787
|
+
| `createFieldContext<TValues extends Values = Values>(field): void` | `useFieldContext(): FieldInstance<Values>` | 提供 / 读取 `useField()` 返回的字段控制器。Provider 不创建字段、不接管订阅;缺失时 Reader 抛出指向 `createFieldContext(field)` 的 `Error`。 |
|
|
788
|
+
| `createFormConfigContext<T>(props: FormContextProps<T>): void` | `useFormConfigContext(): FormContextProps` | 提供 / 读取表单展示配置。Provider 不复制、不更新传入对象;缺失时 Reader 抛出带 `createFormConfigContext(props)` 指引的 `Error`。 |
|
|
761
789
|
|
|
762
790
|
```ts
|
|
763
791
|
import {
|
|
@@ -803,9 +831,9 @@ function useField<TValues extends Values = Values>(
|
|
|
803
831
|
): FieldInstance<TValues>
|
|
804
832
|
```
|
|
805
833
|
|
|
806
|
-
Hook 从 `useFormContext()`
|
|
834
|
+
Hook 从 `useFormContext()` 取得 Facade,为 `name` 创建 Core 字段控制器,并复用共享 Vue Field Bridge。它保留 Core `SchemxFieldInstance` 的全部成员,并增加 `value: Ref<FieldValue<...> | undefined>`、`errors: ComputedRef<readonly string[]>`、`dirty: ComputedRef<boolean>` 与 `pending: ComputedRef<boolean>`;`dirty` 读取字段 touched Ref。`getValue()`、`getErrors()`、`isTouched()` 和 `isPending()` 都读取对应 Vue Ref,`getValues()` 则通过 Facade 读取全表值。只有 `value` 可通过 `.value` 写入,其余三个 computed 状态只读。Core 方法的完整签名见 [Core 单字段控制器](../core#单字段控制器)。
|
|
807
835
|
|
|
808
|
-
`useField()`
|
|
836
|
+
`useField()` 不缓存字段控制器对象;每次调用只创建轻量的 Core 控制器包装,并复用当前 Form Bridge 中按字段 `SnapshotSource` 缓存的字段 Ref。Bridge 以公开 `NamePath` 规范化结果复用字段;当前公开类型仅支持字符串路径。Form Bridge 由 `useForm()`、Form Context 和 `useFormSelector()` 等 Vue owner 的引用计数持有,最后一个 owner 释放或手动销毁后停止订阅。`FieldInstance` 可从 `@schemx/vue` 根入口导入;不需要依赖深层路径。
|
|
809
837
|
|
|
810
838
|
```ts
|
|
811
839
|
import { createFieldContext, useField } from "@schemx/vue"
|
|
@@ -1044,37 +1072,37 @@ Vue 根入口自有以下公开类型:
|
|
|
1044
1072
|
|
|
1045
1073
|
### Vue 自有导出
|
|
1046
1074
|
|
|
1047
|
-
| 分类 | 导出
|
|
1048
|
-
| --------------- |
|
|
1049
|
-
| 表单组件 | `schemxForm`
|
|
1050
|
-
| 组件 | `FormItem`
|
|
1051
|
-
| 组件 | `FormGroup`
|
|
1052
|
-
| HOC | `WithRemoteOptions`
|
|
1053
|
-
| Registry | `rendererRegistry`
|
|
1054
|
-
| Registry | `validationRuleRegistry`
|
|
1055
|
-
| Hook | `useForm`
|
|
1056
|
-
| Context | `createFormContext`
|
|
1057
|
-
| Context | `useFormContext`
|
|
1058
|
-
| Hook | `useField`
|
|
1059
|
-
| Context | `createFieldContext`
|
|
1060
|
-
| Context | `useFieldContext`
|
|
1061
|
-
| Context | `createFormConfigContext`
|
|
1062
|
-
| Context | `useFormConfigContext`
|
|
1063
|
-
| Watch | `useWatch`
|
|
1064
|
-
| Watch | `useWatchField`
|
|
1065
|
-
| Watch | `useWatchFields`
|
|
1066
|
-
| Watch | `useWatchAll`
|
|
1067
|
-
| Dictionary | `useDictionary`
|
|
1068
|
-
| Vue 响应式 | `useStableRef`
|
|
1069
|
-
| ViewSchema | `useViewSchemas`
|
|
1070
|
-
| 默认导出 | `default`
|
|
1071
|
-
| Context 类型 | `FormContextProps`
|
|
1072
|
-
| Dictionary 类型 | `SchemxDictionary`
|
|
1073
|
-
| 插件类型 | `SchemxInstallOptions`
|
|
1074
|
-
| Dictionary 类型 | `SchemxWithDictionary`
|
|
1075
|
-
| Dictionary 类型 | `UseDictionaryReturn`
|
|
1076
|
-
| 表单类型 | `SchemxFormProps<TValues>`
|
|
1077
|
-
| 字段类型 | `FieldInstance<TValues>`
|
|
1075
|
+
| 分类 | 导出 | 用途 |
|
|
1076
|
+
| --------------- | --------------------------------------- | --------------------------------------------- |
|
|
1077
|
+
| 表单组件 | `schemxForm` | 可安装的表单组件;与 `default` 指向同一对象。 |
|
|
1078
|
+
| 组件 | `FormItem` | 渲染字段或分组 ViewSchema。 |
|
|
1079
|
+
| 组件 | `FormGroup` | 渲染分组 ViewSchema。 |
|
|
1080
|
+
| HOC | `WithRemoteOptions` | 为 Renderer 接入 Dictionary。 |
|
|
1081
|
+
| Registry | `rendererRegistry` | Vue 全局 Renderer Registry。 |
|
|
1082
|
+
| Registry | `validationRuleRegistry` | Vue 全局 ValidationRuleRegistry。 |
|
|
1083
|
+
| Hook | `useForm` | 创建并按 Vue scope 销毁表单。 |
|
|
1084
|
+
| Context | `createFormContext` | 提供表单实例。 |
|
|
1085
|
+
| Context | `useFormContext` | 读取表单实例。 |
|
|
1086
|
+
| Hook | `useField` | 创建 Vue 字段控制器。 |
|
|
1087
|
+
| Context | `createFieldContext` | 提供字段控制器。 |
|
|
1088
|
+
| Context | `useFieldContext` | 读取字段控制器。 |
|
|
1089
|
+
| Context | `createFormConfigContext` | 提供表单展示配置。 |
|
|
1090
|
+
| Context | `useFormConfigContext` | 读取表单展示配置。 |
|
|
1091
|
+
| Watch | `useWatch` | 统一分发 Vue Watch。 |
|
|
1092
|
+
| Watch | `useWatchField` | 单字段 Vue Watch。 |
|
|
1093
|
+
| Watch | `useWatchFields` | 多字段 Vue Watch。 |
|
|
1094
|
+
| Watch | `useWatchAll` | 全表 Vue Watch。 |
|
|
1095
|
+
| Dictionary | `useDictionary` | 管理函数式选项源。 |
|
|
1096
|
+
| Vue 响应式 | `useStableRef` | 建立浅比较稳定 Ref。 |
|
|
1097
|
+
| ViewSchema | `useViewSchemas` | 桥接 ViewSchemas 为 Ref。 |
|
|
1098
|
+
| 默认导出 | `default` | 与 `schemxForm` 严格相等。 |
|
|
1099
|
+
| Context 类型 | `FormContextProps` | 表单展示 Context。 |
|
|
1100
|
+
| Dictionary 类型 | `SchemxDictionary` | 函数式选项源配置。 |
|
|
1101
|
+
| 插件类型 | `SchemxInstallOptions` | 当前 Vue App 的默认配置安装选项。 |
|
|
1102
|
+
| Dictionary 类型 | `SchemxWithDictionary` | 为 Props 增加 `dict`。 |
|
|
1103
|
+
| Dictionary 类型 | `UseDictionaryReturn` | `useDictionary()` 返回值。 |
|
|
1104
|
+
| 表单类型 | `SchemxFormProps<TValues>` | `<Schemx>` 组件 Props 类型。 |
|
|
1105
|
+
| 字段类型 | `FieldInstance<TValues>` | Vue Ref / Computed 桥接后的字段控制器类型。 |
|
|
1078
1106
|
|
|
1079
1107
|
根入口没有名为 `SchemxForm` 的命名导出。
|
|
1080
1108
|
|
package/dist/analyze.html
CHANGED
|
@@ -4929,7 +4929,7 @@ var drawChart = (function (exports) {
|
|
|
4929
4929
|
</script>
|
|
4930
4930
|
<script>
|
|
4931
4931
|
/*<!--*/
|
|
4932
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.cjs","children":[{"name":"src","children":[{"name":"styles/index.css","uid":"59ce7164-1"},{"name":"config/appConfig.ts","uid":"59ce7164-3"},{"name":"utils","children":[{"uid":"59ce7164-5","name":"rendererProvider.ts"},{"uid":"59ce7164-7","name":"rulesProvider.ts"},{"uid":"59ce7164-23","name":"equal.ts"},{"uid":"59ce7164-29","name":"validation.ts"},{"uid":"59ce7164-31","name":"slot.ts"},{"uid":"59ce7164-39","name":"helpers.ts"}]},{"name":"hooks","children":[{"uid":"59ce7164-9","name":"useForm.ts"},{"uid":"59ce7164-11","name":"provideFormContext.ts"},{"uid":"59ce7164-13","name":"useField.ts"},{"uid":"59ce7164-15","name":"provideFieldContext.ts"},{"uid":"59ce7164-17","name":"useWatch.ts"},{"uid":"59ce7164-19","name":"useDictionary.ts"},{"uid":"59ce7164-21","name":"provideFormConfigContext.ts"},{"uid":"59ce7164-25","name":"useStableRef.ts"},{"uid":"59ce7164-27","name":"useViewSchemas.ts"}]},{"name":"components","children":[{"name":"FormGroup/index.tsx","uid":"59ce7164-33"},{"name":"FormItem","children":[{"uid":"59ce7164-35","name":"slot.tsx"},{"uid":"59ce7164-37","name":"index.tsx"}]}]},{"uid":"59ce7164-41","name":"form.vue?vue&type=script&setup=true&lang.ts"},{"uid":"59ce7164-43","name":"form.ts"},{"name":"hocs/withRemoteOptions.ts","uid":"59ce7164-45"},{"uid":"59ce7164-47","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"59ce7164-1":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"metaUid":"59ce7164-0"},"59ce7164-3":{"renderedLength":957,"gzipLength":384,"brotliLength":326,"metaUid":"59ce7164-2"},"59ce7164-5":{"renderedLength":65,"gzipLength":72,"brotliLength":52,"metaUid":"59ce7164-4"},"59ce7164-7":{"renderedLength":67,"gzipLength":68,"brotliLength":53,"metaUid":"59ce7164-6"},"59ce7164-9":{"renderedLength":815,"gzipLength":323,"brotliLength":286,"metaUid":"59ce7164-8"},"59ce7164-11":{"renderedLength":468,"gzipLength":280,"brotliLength":223,"metaUid":"59ce7164-10"},"59ce7164-13":{"renderedLength":1600,"gzipLength":561,"brotliLength":498,"metaUid":"59ce7164-12"},"59ce7164-15":{"renderedLength":410,"gzipLength":249,"brotliLength":198,"metaUid":"59ce7164-14"},"59ce7164-17":{"renderedLength":551,"gzipLength":219,"brotliLength":186,"metaUid":"59ce7164-16"},"59ce7164-19":{"renderedLength":2879,"gzipLength":953,"brotliLength":814,"metaUid":"59ce7164-18"},"59ce7164-21":{"renderedLength":483,"gzipLength":288,"brotliLength":239,"metaUid":"59ce7164-20"},"59ce7164-23":{"renderedLength":206,"gzipLength":156,"brotliLength":122,"metaUid":"59ce7164-22"},"59ce7164-25":{"renderedLength":240,"gzipLength":168,"brotliLength":143,"metaUid":"59ce7164-24"},"59ce7164-27":{"renderedLength":269,"gzipLength":168,"brotliLength":140,"metaUid":"59ce7164-26"},"59ce7164-29":{"renderedLength":788,"gzipLength":325,"brotliLength":267,"metaUid":"59ce7164-28"},"59ce7164-31":{"renderedLength":1278,"gzipLength":491,"brotliLength":404,"metaUid":"59ce7164-30"},"59ce7164-33":{"renderedLength":3726,"gzipLength":1330,"brotliLength":1126,"metaUid":"59ce7164-32"},"59ce7164-35":{"renderedLength":4194,"gzipLength":1528,"brotliLength":1268,"metaUid":"59ce7164-34"},"59ce7164-37":{"renderedLength":5525,"gzipLength":1897,"brotliLength":1561,"metaUid":"59ce7164-36"},"59ce7164-39":{"renderedLength":1052,"gzipLength":382,"brotliLength":332,"metaUid":"59ce7164-38"},"59ce7164-41":{"renderedLength":4713,"gzipLength":1498,"brotliLength":1309,"metaUid":"59ce7164-40"},"59ce7164-43":{"renderedLength":384,"gzipLength":269,"brotliLength":214,"metaUid":"59ce7164-42"},"59ce7164-45":{"renderedLength":1052,"gzipLength":455,"brotliLength":378,"metaUid":"59ce7164-44"},"59ce7164-47":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"metaUid":"59ce7164-46"}},"nodeMetas":{"59ce7164-0":{"id":"/src/styles/index.css","moduleParts":{"index.cjs":"59ce7164-1"},"imported":[],"importedBy":[{"uid":"59ce7164-46"},{"uid":"59ce7164-40"}]},"59ce7164-2":{"id":"/src/config/appConfig.ts","moduleParts":{"index.cjs":"59ce7164-3"},"imported":[{"uid":"59ce7164-55"}],"importedBy":[{"uid":"59ce7164-52"}]},"59ce7164-4":{"id":"/src/utils/rendererProvider.ts","moduleParts":{"index.cjs":"59ce7164-5"},"imported":[{"uid":"59ce7164-54"}],"importedBy":[{"uid":"59ce7164-46"},{"uid":"59ce7164-8"}]},"59ce7164-6":{"id":"/src/utils/rulesProvider.ts","moduleParts":{"index.cjs":"59ce7164-7"},"imported":[{"uid":"59ce7164-50"}],"importedBy":[{"uid":"59ce7164-46"},{"uid":"59ce7164-8"}]},"59ce7164-8":{"id":"/src/hooks/useForm.ts","moduleParts":{"index.cjs":"59ce7164-9"},"imported":[{"uid":"59ce7164-55"},{"uid":"59ce7164-50"},{"uid":"59ce7164-52"},{"uid":"59ce7164-4"},{"uid":"59ce7164-6"}],"importedBy":[{"uid":"59ce7164-48"}]},"59ce7164-10":{"id":"/src/hooks/provideFormContext.ts","moduleParts":{"index.cjs":"59ce7164-11"},"imported":[{"uid":"59ce7164-55"}],"importedBy":[{"uid":"59ce7164-48"},{"uid":"59ce7164-12"},{"uid":"59ce7164-16"},{"uid":"59ce7164-18"}]},"59ce7164-12":{"id":"/src/hooks/useField.ts","moduleParts":{"index.cjs":"59ce7164-13"},"imported":[{"uid":"59ce7164-55"},{"uid":"59ce7164-50"},{"uid":"59ce7164-10"}],"importedBy":[{"uid":"59ce7164-48"}]},"59ce7164-14":{"id":"/src/hooks/provideFieldContext.ts","moduleParts":{"index.cjs":"59ce7164-15"},"imported":[{"uid":"59ce7164-55"}],"importedBy":[{"uid":"59ce7164-48"},{"uid":"59ce7164-44"}]},"59ce7164-16":{"id":"/src/hooks/useWatch.ts","moduleParts":{"index.cjs":"59ce7164-17"},"imported":[{"uid":"59ce7164-55"},{"uid":"59ce7164-50"},{"uid":"59ce7164-10"}],"importedBy":[{"uid":"59ce7164-48"},{"uid":"59ce7164-18"}]},"59ce7164-18":{"id":"/src/hooks/useDictionary.ts","moduleParts":{"index.cjs":"59ce7164-19"},"imported":[{"uid":"59ce7164-55"},{"uid":"59ce7164-10"},{"uid":"59ce7164-16"}],"importedBy":[{"uid":"59ce7164-48"},{"uid":"59ce7164-44"}]},"59ce7164-20":{"id":"/src/hooks/provideFormConfigContext.ts","moduleParts":{"index.cjs":"59ce7164-21"},"imported":[{"uid":"59ce7164-55"}],"importedBy":[{"uid":"59ce7164-48"}]},"59ce7164-22":{"id":"/src/utils/equal.ts","moduleParts":{"index.cjs":"59ce7164-23"},"imported":[],"importedBy":[{"uid":"59ce7164-24"}]},"59ce7164-24":{"id":"/src/hooks/useStableRef.ts","moduleParts":{"index.cjs":"59ce7164-25"},"imported":[{"uid":"59ce7164-55"},{"uid":"59ce7164-22"}],"importedBy":[{"uid":"59ce7164-48"}]},"59ce7164-26":{"id":"/src/hooks/useViewSchemas.ts","moduleParts":{"index.cjs":"59ce7164-27"},"imported":[{"uid":"59ce7164-55"}],"importedBy":[{"uid":"59ce7164-48"}]},"59ce7164-28":{"id":"/src/utils/validation.ts","moduleParts":{"index.cjs":"59ce7164-29"},"imported":[],"importedBy":[{"uid":"59ce7164-57"}]},"59ce7164-30":{"id":"/src/utils/slot.ts","moduleParts":{"index.cjs":"59ce7164-31"},"imported":[],"importedBy":[{"uid":"59ce7164-57"}]},"59ce7164-32":{"id":"/src/components/FormGroup/index.tsx","moduleParts":{"index.cjs":"59ce7164-33"},"imported":[{"uid":"59ce7164-55"},{"uid":"59ce7164-56"},{"uid":"59ce7164-36"}],"importedBy":[{"uid":"59ce7164-46"},{"uid":"59ce7164-36"}]},"59ce7164-34":{"id":"/src/components/FormItem/slot.tsx","moduleParts":{"index.cjs":"59ce7164-35"},"imported":[{"uid":"59ce7164-55"},{"uid":"59ce7164-57"}],"importedBy":[{"uid":"59ce7164-36"}]},"59ce7164-36":{"id":"/src/components/FormItem/index.tsx","moduleParts":{"index.cjs":"59ce7164-37"},"imported":[{"uid":"59ce7164-55"},{"uid":"59ce7164-50"},{"uid":"59ce7164-56"},{"uid":"59ce7164-48"},{"uid":"59ce7164-57"},{"uid":"59ce7164-32"},{"uid":"59ce7164-34"}],"importedBy":[{"uid":"59ce7164-46"},{"uid":"59ce7164-42"},{"uid":"59ce7164-32"},{"uid":"59ce7164-40"}]},"59ce7164-38":{"id":"/src/utils/helpers.ts","moduleParts":{"index.cjs":"59ce7164-39"},"imported":[{"uid":"59ce7164-50"}],"importedBy":[{"uid":"59ce7164-40"}]},"59ce7164-40":{"id":"/src/form.vue?vue&type=script&setup=true&lang.ts","moduleParts":{"index.cjs":"59ce7164-41"},"imported":[{"uid":"59ce7164-55"},{"uid":"59ce7164-50"},{"uid":"59ce7164-64"},{"uid":"59ce7164-36"},{"uid":"59ce7164-48"},{"uid":"59ce7164-38"},{"uid":"59ce7164-0"}],"importedBy":[{"uid":"59ce7164-61"}]},"59ce7164-42":{"id":"/src/form.ts","moduleParts":{"index.cjs":"59ce7164-43"},"imported":[{"uid":"59ce7164-36"},{"uid":"59ce7164-52"},{"uid":"59ce7164-53"}],"importedBy":[{"uid":"59ce7164-46"}]},"59ce7164-44":{"id":"/src/hocs/withRemoteOptions.ts","moduleParts":{"index.cjs":"59ce7164-45"},"imported":[{"uid":"59ce7164-55"},{"uid":"59ce7164-14"},{"uid":"59ce7164-18"}],"importedBy":[{"uid":"59ce7164-49"}]},"59ce7164-46":{"id":"/src/index.ts","moduleParts":{"index.cjs":"59ce7164-47"},"imported":[{"uid":"59ce7164-0"},{"uid":"59ce7164-42"},{"uid":"59ce7164-4"},{"uid":"59ce7164-6"},{"uid":"59ce7164-48"},{"uid":"59ce7164-49"},{"uid":"59ce7164-36"},{"uid":"59ce7164-32"},{"uid":"59ce7164-50"},{"uid":"59ce7164-51"}],"importedBy":[],"isEntry":true},"59ce7164-48":{"id":"/src/hooks/index.ts","moduleParts":{},"imported":[{"uid":"59ce7164-8"},{"uid":"59ce7164-10"},{"uid":"59ce7164-12"},{"uid":"59ce7164-14"},{"uid":"59ce7164-16"},{"uid":"59ce7164-18"},{"uid":"59ce7164-20"},{"uid":"59ce7164-24"},{"uid":"59ce7164-26"}],"importedBy":[{"uid":"59ce7164-46"},{"uid":"59ce7164-36"},{"uid":"59ce7164-40"}]},"59ce7164-49":{"id":"/src/hocs/index.ts","moduleParts":{},"imported":[{"uid":"59ce7164-44"}],"importedBy":[{"uid":"59ce7164-46"}]},"59ce7164-50":{"id":"@schemx/core","moduleParts":{},"imported":[],"importedBy":[{"uid":"59ce7164-46"},{"uid":"59ce7164-6"},{"uid":"59ce7164-36"},{"uid":"59ce7164-8"},{"uid":"59ce7164-12"},{"uid":"59ce7164-16"},{"uid":"59ce7164-40"},{"uid":"59ce7164-38"}],"isExternal":true},"59ce7164-51":{"id":"/src/types/index.ts","moduleParts":{},"imported":[{"uid":"59ce7164-58"},{"uid":"59ce7164-59"},{"uid":"59ce7164-60"}],"importedBy":[{"uid":"59ce7164-46"}]},"59ce7164-52":{"id":"/src/config/index.ts","moduleParts":{},"imported":[{"uid":"59ce7164-2"}],"importedBy":[{"uid":"59ce7164-42"},{"uid":"59ce7164-8"}]},"59ce7164-53":{"id":"/src/formRuntime.js","moduleParts":{},"imported":[{"uid":"59ce7164-61"}],"importedBy":[{"uid":"59ce7164-42"}]},"59ce7164-54":{"id":"@schemx/core/adapter","moduleParts":{},"imported":[],"importedBy":[{"uid":"59ce7164-4"}],"isExternal":true},"59ce7164-55":{"id":"vue","moduleParts":{},"imported":[],"importedBy":[{"uid":"59ce7164-36"},{"uid":"59ce7164-32"},{"uid":"59ce7164-8"},{"uid":"59ce7164-10"},{"uid":"59ce7164-12"},{"uid":"59ce7164-14"},{"uid":"59ce7164-16"},{"uid":"59ce7164-18"},{"uid":"59ce7164-20"},{"uid":"59ce7164-24"},{"uid":"59ce7164-26"},{"uid":"59ce7164-44"},{"uid":"59ce7164-34"},{"uid":"59ce7164-2"},{"uid":"59ce7164-40"}],"isExternal":true},"59ce7164-56":{"id":"classnames","moduleParts":{},"imported":[],"importedBy":[{"uid":"59ce7164-36"},{"uid":"59ce7164-32"}],"isExternal":true},"59ce7164-57":{"id":"/src/utils/index.ts","moduleParts":{},"imported":[{"uid":"59ce7164-62"},{"uid":"59ce7164-28"},{"uid":"59ce7164-30"},{"uid":"59ce7164-63"}],"importedBy":[{"uid":"59ce7164-36"},{"uid":"59ce7164-34"}]},"59ce7164-58":{"id":"/src/types/dictionary.ts","moduleParts":{},"imported":[],"importedBy":[{"uid":"59ce7164-51"}]},"59ce7164-59":{"id":"/src/types/form.ts","moduleParts":{},"imported":[],"importedBy":[{"uid":"59ce7164-51"}]},"59ce7164-60":{"id":"/src/types/field.ts","moduleParts":{},"imported":[],"importedBy":[{"uid":"59ce7164-51"}]},"59ce7164-61":{"id":"/src/form.vue","moduleParts":{},"imported":[{"uid":"59ce7164-40"}],"importedBy":[{"uid":"59ce7164-53"}]},"59ce7164-62":{"id":"/src/utils/dynamic.ts","moduleParts":{},"imported":[{"uid":"59ce7164-64"}],"importedBy":[{"uid":"59ce7164-57"}]},"59ce7164-63":{"id":"/src/utils/diff.ts","moduleParts":{},"imported":[{"uid":"59ce7164-65"}],"importedBy":[{"uid":"59ce7164-57"}]},"59ce7164-64":{"id":"es-toolkit","moduleParts":{},"imported":[],"importedBy":[{"uid":"59ce7164-62"},{"uid":"59ce7164-40"}],"isExternal":true},"59ce7164-65":{"id":"es-toolkit/compat","moduleParts":{},"imported":[],"importedBy":[{"uid":"59ce7164-63"}],"isExternal":true}},"env":{"rollup":"4.14.3"},"options":{"gzip":true,"brotli":true,"sourcemap":false}};
|
|
4932
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.cjs","children":[{"name":"src","children":[{"name":"styles/index.css","uid":"48c3f3fa-1"},{"name":"bridge","children":[{"uid":"48c3f3fa-3","name":"helpers.ts"},{"uid":"48c3f3fa-5","name":"fieldBridge.ts"},{"uid":"48c3f3fa-7","name":"formFacade.ts"},{"uid":"48c3f3fa-9","name":"formBridge.ts"}]},{"name":"config/appConfig.ts","uid":"48c3f3fa-11"},{"name":"utils","children":[{"uid":"48c3f3fa-13","name":"rendererProvider.ts"},{"uid":"48c3f3fa-15","name":"rulesProvider.ts"},{"uid":"48c3f3fa-31","name":"equal.ts"},{"uid":"48c3f3fa-39","name":"validation.ts"},{"uid":"48c3f3fa-41","name":"slot.ts"},{"uid":"48c3f3fa-53","name":"helpers.ts"}]},{"name":"hooks","children":[{"uid":"48c3f3fa-17","name":"useForm.ts"},{"uid":"48c3f3fa-19","name":"provideFormContext.ts"},{"uid":"48c3f3fa-21","name":"useField.ts"},{"uid":"48c3f3fa-23","name":"provideFieldContext.ts"},{"uid":"48c3f3fa-25","name":"useWatch.ts"},{"uid":"48c3f3fa-27","name":"useDictionary.ts"},{"uid":"48c3f3fa-29","name":"provideFormConfigContext.ts"},{"uid":"48c3f3fa-33","name":"useStableRef.ts"},{"uid":"48c3f3fa-35","name":"useViewSchemas.ts"},{"uid":"48c3f3fa-37","name":"useFormSelector.ts"}]},{"name":"components","children":[{"name":"FormGroup/index.tsx","uid":"48c3f3fa-43"},{"name":"FormItem","children":[{"uid":"48c3f3fa-45","name":"slot.tsx"},{"uid":"48c3f3fa-47","name":"index.tsx"}]},{"name":"Button","children":[{"uid":"48c3f3fa-49","name":"index.vue?vue&type=script&setup=true&lang.ts"},{"uid":"48c3f3fa-51","name":"index.vue?vue&type=style&index=0&lang.css"}]}]},{"uid":"48c3f3fa-55","name":"form.vue?vue&type=script&setup=true&lang.ts"},{"uid":"48c3f3fa-57","name":"form.ts"},{"name":"hocs/withRemoteOptions.ts","uid":"48c3f3fa-59"},{"uid":"48c3f3fa-61","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"48c3f3fa-1":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"metaUid":"48c3f3fa-0"},"48c3f3fa-3":{"renderedLength":221,"gzipLength":161,"brotliLength":119,"metaUid":"48c3f3fa-2"},"48c3f3fa-5":{"renderedLength":1253,"gzipLength":416,"brotliLength":362,"metaUid":"48c3f3fa-4"},"48c3f3fa-7":{"renderedLength":2380,"gzipLength":463,"brotliLength":393,"metaUid":"48c3f3fa-6"},"48c3f3fa-9":{"renderedLength":3540,"gzipLength":827,"brotliLength":751,"metaUid":"48c3f3fa-8"},"48c3f3fa-11":{"renderedLength":1317,"gzipLength":489,"brotliLength":422,"metaUid":"48c3f3fa-10"},"48c3f3fa-13":{"renderedLength":65,"gzipLength":72,"brotliLength":52,"metaUid":"48c3f3fa-12"},"48c3f3fa-15":{"renderedLength":67,"gzipLength":68,"brotliLength":53,"metaUid":"48c3f3fa-14"},"48c3f3fa-17":{"renderedLength":1079,"gzipLength":482,"brotliLength":400,"metaUid":"48c3f3fa-16"},"48c3f3fa-19":{"renderedLength":628,"gzipLength":340,"brotliLength":290,"metaUid":"48c3f3fa-18"},"48c3f3fa-21":{"renderedLength":1038,"gzipLength":344,"brotliLength":307,"metaUid":"48c3f3fa-20"},"48c3f3fa-23":{"renderedLength":410,"gzipLength":249,"brotliLength":198,"metaUid":"48c3f3fa-22"},"48c3f3fa-25":{"renderedLength":564,"gzipLength":229,"brotliLength":192,"metaUid":"48c3f3fa-24"},"48c3f3fa-27":{"renderedLength":2879,"gzipLength":953,"brotliLength":814,"metaUid":"48c3f3fa-26"},"48c3f3fa-29":{"renderedLength":483,"gzipLength":288,"brotliLength":239,"metaUid":"48c3f3fa-28"},"48c3f3fa-31":{"renderedLength":206,"gzipLength":156,"brotliLength":122,"metaUid":"48c3f3fa-30"},"48c3f3fa-33":{"renderedLength":240,"gzipLength":168,"brotliLength":143,"metaUid":"48c3f3fa-32"},"48c3f3fa-35":{"renderedLength":1781,"gzipLength":706,"brotliLength":590,"metaUid":"48c3f3fa-34"},"48c3f3fa-37":{"renderedLength":594,"gzipLength":306,"brotliLength":266,"metaUid":"48c3f3fa-36"},"48c3f3fa-39":{"renderedLength":788,"gzipLength":325,"brotliLength":267,"metaUid":"48c3f3fa-38"},"48c3f3fa-41":{"renderedLength":1278,"gzipLength":491,"brotliLength":404,"metaUid":"48c3f3fa-40"},"48c3f3fa-43":{"renderedLength":3726,"gzipLength":1330,"brotliLength":1126,"metaUid":"48c3f3fa-42"},"48c3f3fa-45":{"renderedLength":4194,"gzipLength":1528,"brotliLength":1268,"metaUid":"48c3f3fa-44"},"48c3f3fa-47":{"renderedLength":5674,"gzipLength":2071,"brotliLength":1707,"metaUid":"48c3f3fa-46"},"48c3f3fa-49":{"renderedLength":2486,"gzipLength":913,"brotliLength":789,"metaUid":"48c3f3fa-48"},"48c3f3fa-51":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"metaUid":"48c3f3fa-50"},"48c3f3fa-53":{"renderedLength":1052,"gzipLength":382,"brotliLength":332,"metaUid":"48c3f3fa-52"},"48c3f3fa-55":{"renderedLength":10221,"gzipLength":2767,"brotliLength":2328,"metaUid":"48c3f3fa-54"},"48c3f3fa-57":{"renderedLength":384,"gzipLength":269,"brotliLength":214,"metaUid":"48c3f3fa-56"},"48c3f3fa-59":{"renderedLength":1052,"gzipLength":455,"brotliLength":378,"metaUid":"48c3f3fa-58"},"48c3f3fa-61":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"metaUid":"48c3f3fa-60"}},"nodeMetas":{"48c3f3fa-0":{"id":"/src/styles/index.css","moduleParts":{"index.cjs":"48c3f3fa-1"},"imported":[],"importedBy":[{"uid":"48c3f3fa-60"},{"uid":"48c3f3fa-54"}]},"48c3f3fa-2":{"id":"/src/bridge/helpers.ts","moduleParts":{"index.cjs":"48c3f3fa-3"},"imported":[{"uid":"48c3f3fa-70"}],"importedBy":[{"uid":"48c3f3fa-8"},{"uid":"48c3f3fa-4"}]},"48c3f3fa-4":{"id":"/src/bridge/fieldBridge.ts","moduleParts":{"index.cjs":"48c3f3fa-5"},"imported":[{"uid":"48c3f3fa-2"}],"importedBy":[{"uid":"48c3f3fa-69"},{"uid":"48c3f3fa-8"}]},"48c3f3fa-6":{"id":"/src/bridge/formFacade.ts","moduleParts":{"index.cjs":"48c3f3fa-7"},"imported":[],"importedBy":[{"uid":"48c3f3fa-8"}]},"48c3f3fa-8":{"id":"/src/bridge/formBridge.ts","moduleParts":{"index.cjs":"48c3f3fa-9"},"imported":[{"uid":"48c3f3fa-68"},{"uid":"48c3f3fa-4"},{"uid":"48c3f3fa-6"},{"uid":"48c3f3fa-2"}],"importedBy":[{"uid":"48c3f3fa-69"}]},"48c3f3fa-10":{"id":"/src/config/appConfig.ts","moduleParts":{"index.cjs":"48c3f3fa-11"},"imported":[{"uid":"48c3f3fa-70"}],"importedBy":[{"uid":"48c3f3fa-66"}]},"48c3f3fa-12":{"id":"/src/utils/rendererProvider.ts","moduleParts":{"index.cjs":"48c3f3fa-13"},"imported":[{"uid":"48c3f3fa-68"}],"importedBy":[{"uid":"48c3f3fa-60"},{"uid":"48c3f3fa-16"}]},"48c3f3fa-14":{"id":"/src/utils/rulesProvider.ts","moduleParts":{"index.cjs":"48c3f3fa-15"},"imported":[{"uid":"48c3f3fa-64"}],"importedBy":[{"uid":"48c3f3fa-60"},{"uid":"48c3f3fa-16"}]},"48c3f3fa-16":{"id":"/src/hooks/useForm.ts","moduleParts":{"index.cjs":"48c3f3fa-17"},"imported":[{"uid":"48c3f3fa-70"},{"uid":"48c3f3fa-64"},{"uid":"48c3f3fa-69"},{"uid":"48c3f3fa-66"},{"uid":"48c3f3fa-12"},{"uid":"48c3f3fa-14"}],"importedBy":[{"uid":"48c3f3fa-62"}]},"48c3f3fa-18":{"id":"/src/hooks/provideFormContext.ts","moduleParts":{"index.cjs":"48c3f3fa-19"},"imported":[{"uid":"48c3f3fa-70"},{"uid":"48c3f3fa-69"}],"importedBy":[{"uid":"48c3f3fa-62"},{"uid":"48c3f3fa-20"},{"uid":"48c3f3fa-24"},{"uid":"48c3f3fa-26"}]},"48c3f3fa-20":{"id":"/src/hooks/useField.ts","moduleParts":{"index.cjs":"48c3f3fa-21"},"imported":[{"uid":"48c3f3fa-70"},{"uid":"48c3f3fa-64"},{"uid":"48c3f3fa-69"},{"uid":"48c3f3fa-18"}],"importedBy":[{"uid":"48c3f3fa-62"}]},"48c3f3fa-22":{"id":"/src/hooks/provideFieldContext.ts","moduleParts":{"index.cjs":"48c3f3fa-23"},"imported":[{"uid":"48c3f3fa-70"}],"importedBy":[{"uid":"48c3f3fa-62"},{"uid":"48c3f3fa-58"}]},"48c3f3fa-24":{"id":"/src/hooks/useWatch.ts","moduleParts":{"index.cjs":"48c3f3fa-25"},"imported":[{"uid":"48c3f3fa-70"},{"uid":"48c3f3fa-64"},{"uid":"48c3f3fa-69"},{"uid":"48c3f3fa-18"}],"importedBy":[{"uid":"48c3f3fa-62"},{"uid":"48c3f3fa-26"}]},"48c3f3fa-26":{"id":"/src/hooks/useDictionary.ts","moduleParts":{"index.cjs":"48c3f3fa-27"},"imported":[{"uid":"48c3f3fa-70"},{"uid":"48c3f3fa-18"},{"uid":"48c3f3fa-24"}],"importedBy":[{"uid":"48c3f3fa-62"},{"uid":"48c3f3fa-58"}]},"48c3f3fa-28":{"id":"/src/hooks/provideFormConfigContext.ts","moduleParts":{"index.cjs":"48c3f3fa-29"},"imported":[{"uid":"48c3f3fa-70"}],"importedBy":[{"uid":"48c3f3fa-62"}]},"48c3f3fa-30":{"id":"/src/utils/equal.ts","moduleParts":{"index.cjs":"48c3f3fa-31"},"imported":[],"importedBy":[{"uid":"48c3f3fa-32"}]},"48c3f3fa-32":{"id":"/src/hooks/useStableRef.ts","moduleParts":{"index.cjs":"48c3f3fa-33"},"imported":[{"uid":"48c3f3fa-70"},{"uid":"48c3f3fa-30"}],"importedBy":[{"uid":"48c3f3fa-62"}]},"48c3f3fa-34":{"id":"/src/hooks/useViewSchemas.ts","moduleParts":{"index.cjs":"48c3f3fa-35"},"imported":[{"uid":"48c3f3fa-70"},{"uid":"48c3f3fa-64"},{"uid":"48c3f3fa-69"}],"importedBy":[{"uid":"48c3f3fa-62"},{"uid":"48c3f3fa-46"}]},"48c3f3fa-36":{"id":"/src/hooks/useFormSelector.ts","moduleParts":{"index.cjs":"48c3f3fa-37"},"imported":[{"uid":"48c3f3fa-70"},{"uid":"48c3f3fa-69"}],"importedBy":[{"uid":"48c3f3fa-62"}]},"48c3f3fa-38":{"id":"/src/utils/validation.ts","moduleParts":{"index.cjs":"48c3f3fa-39"},"imported":[],"importedBy":[{"uid":"48c3f3fa-72"}]},"48c3f3fa-40":{"id":"/src/utils/slot.ts","moduleParts":{"index.cjs":"48c3f3fa-41"},"imported":[],"importedBy":[{"uid":"48c3f3fa-72"}]},"48c3f3fa-42":{"id":"/src/components/FormGroup/index.tsx","moduleParts":{"index.cjs":"48c3f3fa-43"},"imported":[{"uid":"48c3f3fa-70"},{"uid":"48c3f3fa-71"},{"uid":"48c3f3fa-46"}],"importedBy":[{"uid":"48c3f3fa-60"},{"uid":"48c3f3fa-46"}]},"48c3f3fa-44":{"id":"/src/components/FormItem/slot.tsx","moduleParts":{"index.cjs":"48c3f3fa-45"},"imported":[{"uid":"48c3f3fa-70"},{"uid":"48c3f3fa-72"}],"importedBy":[{"uid":"48c3f3fa-46"}]},"48c3f3fa-46":{"id":"/src/components/FormItem/index.tsx","moduleParts":{"index.cjs":"48c3f3fa-47"},"imported":[{"uid":"48c3f3fa-70"},{"uid":"48c3f3fa-64"},{"uid":"48c3f3fa-71"},{"uid":"48c3f3fa-62"},{"uid":"48c3f3fa-34"},{"uid":"48c3f3fa-72"},{"uid":"48c3f3fa-42"},{"uid":"48c3f3fa-44"}],"importedBy":[{"uid":"48c3f3fa-60"},{"uid":"48c3f3fa-56"},{"uid":"48c3f3fa-42"},{"uid":"48c3f3fa-54"}]},"48c3f3fa-48":{"id":"/src/components/Button/index.vue?vue&type=script&setup=true&lang.ts","moduleParts":{"index.cjs":"48c3f3fa-49"},"imported":[{"uid":"48c3f3fa-70"}],"importedBy":[{"uid":"48c3f3fa-82"}]},"48c3f3fa-50":{"id":"/src/components/Button/index.vue?vue&type=style&index=0&lang.css","moduleParts":{"index.cjs":"48c3f3fa-51"},"imported":[],"importedBy":[{"uid":"48c3f3fa-82"}]},"48c3f3fa-52":{"id":"/src/utils/helpers.ts","moduleParts":{"index.cjs":"48c3f3fa-53"},"imported":[{"uid":"48c3f3fa-64"}],"importedBy":[{"uid":"48c3f3fa-54"}]},"48c3f3fa-54":{"id":"/src/form.vue?vue&type=script&setup=true&lang.ts","moduleParts":{"index.cjs":"48c3f3fa-55"},"imported":[{"uid":"48c3f3fa-70"},{"uid":"48c3f3fa-64"},{"uid":"48c3f3fa-79"},{"uid":"48c3f3fa-81"},{"uid":"48c3f3fa-46"},{"uid":"48c3f3fa-62"},{"uid":"48c3f3fa-52"},{"uid":"48c3f3fa-0"}],"importedBy":[{"uid":"48c3f3fa-76"}]},"48c3f3fa-56":{"id":"/src/form.ts","moduleParts":{"index.cjs":"48c3f3fa-57"},"imported":[{"uid":"48c3f3fa-46"},{"uid":"48c3f3fa-66"},{"uid":"48c3f3fa-67"}],"importedBy":[{"uid":"48c3f3fa-60"}]},"48c3f3fa-58":{"id":"/src/hocs/withRemoteOptions.ts","moduleParts":{"index.cjs":"48c3f3fa-59"},"imported":[{"uid":"48c3f3fa-70"},{"uid":"48c3f3fa-22"},{"uid":"48c3f3fa-26"}],"importedBy":[{"uid":"48c3f3fa-63"}]},"48c3f3fa-60":{"id":"/src/index.ts","moduleParts":{"index.cjs":"48c3f3fa-61"},"imported":[{"uid":"48c3f3fa-0"},{"uid":"48c3f3fa-56"},{"uid":"48c3f3fa-12"},{"uid":"48c3f3fa-14"},{"uid":"48c3f3fa-62"},{"uid":"48c3f3fa-63"},{"uid":"48c3f3fa-46"},{"uid":"48c3f3fa-42"},{"uid":"48c3f3fa-64"},{"uid":"48c3f3fa-65"}],"importedBy":[],"isEntry":true},"48c3f3fa-62":{"id":"/src/hooks/index.ts","moduleParts":{},"imported":[{"uid":"48c3f3fa-16"},{"uid":"48c3f3fa-69"},{"uid":"48c3f3fa-18"},{"uid":"48c3f3fa-20"},{"uid":"48c3f3fa-22"},{"uid":"48c3f3fa-24"},{"uid":"48c3f3fa-26"},{"uid":"48c3f3fa-28"},{"uid":"48c3f3fa-32"},{"uid":"48c3f3fa-34"},{"uid":"48c3f3fa-36"}],"importedBy":[{"uid":"48c3f3fa-60"},{"uid":"48c3f3fa-46"},{"uid":"48c3f3fa-54"}]},"48c3f3fa-63":{"id":"/src/hocs/index.ts","moduleParts":{},"imported":[{"uid":"48c3f3fa-58"}],"importedBy":[{"uid":"48c3f3fa-60"}]},"48c3f3fa-64":{"id":"@schemx/core","moduleParts":{},"imported":[],"importedBy":[{"uid":"48c3f3fa-60"},{"uid":"48c3f3fa-14"},{"uid":"48c3f3fa-46"},{"uid":"48c3f3fa-16"},{"uid":"48c3f3fa-20"},{"uid":"48c3f3fa-24"},{"uid":"48c3f3fa-34"},{"uid":"48c3f3fa-54"},{"uid":"48c3f3fa-52"}],"isExternal":true},"48c3f3fa-65":{"id":"/src/types/index.ts","moduleParts":{},"imported":[{"uid":"48c3f3fa-73"},{"uid":"48c3f3fa-74"},{"uid":"48c3f3fa-75"}],"importedBy":[{"uid":"48c3f3fa-60"}]},"48c3f3fa-66":{"id":"/src/config/index.ts","moduleParts":{},"imported":[{"uid":"48c3f3fa-10"}],"importedBy":[{"uid":"48c3f3fa-56"},{"uid":"48c3f3fa-16"}]},"48c3f3fa-67":{"id":"/src/formRuntime.js","moduleParts":{},"imported":[{"uid":"48c3f3fa-76"}],"importedBy":[{"uid":"48c3f3fa-56"}]},"48c3f3fa-68":{"id":"@schemx/core/adapter","moduleParts":{},"imported":[],"importedBy":[{"uid":"48c3f3fa-12"},{"uid":"48c3f3fa-8"}],"isExternal":true},"48c3f3fa-69":{"id":"/src/bridge/index.ts","moduleParts":{},"imported":[{"uid":"48c3f3fa-8"},{"uid":"48c3f3fa-4"}],"importedBy":[{"uid":"48c3f3fa-62"},{"uid":"48c3f3fa-16"},{"uid":"48c3f3fa-18"},{"uid":"48c3f3fa-20"},{"uid":"48c3f3fa-24"},{"uid":"48c3f3fa-34"},{"uid":"48c3f3fa-36"}]},"48c3f3fa-70":{"id":"vue","moduleParts":{},"imported":[],"importedBy":[{"uid":"48c3f3fa-46"},{"uid":"48c3f3fa-42"},{"uid":"48c3f3fa-16"},{"uid":"48c3f3fa-18"},{"uid":"48c3f3fa-20"},{"uid":"48c3f3fa-22"},{"uid":"48c3f3fa-24"},{"uid":"48c3f3fa-26"},{"uid":"48c3f3fa-28"},{"uid":"48c3f3fa-32"},{"uid":"48c3f3fa-34"},{"uid":"48c3f3fa-36"},{"uid":"48c3f3fa-58"},{"uid":"48c3f3fa-44"},{"uid":"48c3f3fa-10"},{"uid":"48c3f3fa-54"},{"uid":"48c3f3fa-2"},{"uid":"48c3f3fa-48"}],"isExternal":true},"48c3f3fa-71":{"id":"classnames","moduleParts":{},"imported":[],"importedBy":[{"uid":"48c3f3fa-46"},{"uid":"48c3f3fa-42"}],"isExternal":true},"48c3f3fa-72":{"id":"/src/utils/index.ts","moduleParts":{},"imported":[{"uid":"48c3f3fa-77"},{"uid":"48c3f3fa-38"},{"uid":"48c3f3fa-40"},{"uid":"48c3f3fa-78"}],"importedBy":[{"uid":"48c3f3fa-46"},{"uid":"48c3f3fa-44"}]},"48c3f3fa-73":{"id":"/src/types/dictionary.ts","moduleParts":{},"imported":[],"importedBy":[{"uid":"48c3f3fa-65"}]},"48c3f3fa-74":{"id":"/src/types/form.ts","moduleParts":{},"imported":[],"importedBy":[{"uid":"48c3f3fa-65"}]},"48c3f3fa-75":{"id":"/src/types/field.ts","moduleParts":{},"imported":[],"importedBy":[{"uid":"48c3f3fa-65"}]},"48c3f3fa-76":{"id":"/src/form.vue","moduleParts":{},"imported":[{"uid":"48c3f3fa-54"}],"importedBy":[{"uid":"48c3f3fa-67"}]},"48c3f3fa-77":{"id":"/src/utils/dynamic.ts","moduleParts":{},"imported":[{"uid":"48c3f3fa-79"}],"importedBy":[{"uid":"48c3f3fa-72"}]},"48c3f3fa-78":{"id":"/src/utils/diff.ts","moduleParts":{},"imported":[{"uid":"48c3f3fa-80"}],"importedBy":[{"uid":"48c3f3fa-72"}]},"48c3f3fa-79":{"id":"es-toolkit","moduleParts":{},"imported":[],"importedBy":[{"uid":"48c3f3fa-77"},{"uid":"48c3f3fa-54"}],"isExternal":true},"48c3f3fa-80":{"id":"es-toolkit/compat","moduleParts":{},"imported":[],"importedBy":[{"uid":"48c3f3fa-78"}],"isExternal":true},"48c3f3fa-81":{"id":"/src/components/Button/index.ts","moduleParts":{},"imported":[{"uid":"48c3f3fa-82"}],"importedBy":[{"uid":"48c3f3fa-54"}]},"48c3f3fa-82":{"id":"/src/components/Button/index.vue","moduleParts":{},"imported":[{"uid":"48c3f3fa-48"},{"uid":"48c3f3fa-50"}],"importedBy":[{"uid":"48c3f3fa-81"}]}},"env":{"rollup":"4.14.3"},"options":{"gzip":true,"brotli":true,"sourcemap":false}};
|
|
4933
4933
|
|
|
4934
4934
|
const run = () => {
|
|
4935
4935
|
const width = window.innerWidth;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { VueFieldBridge, VueFormBridge } from './types';
|
|
2
|
+
import { NamePath, Values } from '@schemx/core';
|
|
3
|
+
/**
|
|
4
|
+
* 获取一个字段的共享 Vue Ref 投影。
|
|
5
|
+
*
|
|
6
|
+
* 字段 Bridge 以 Core `FieldSnapshotSource` 的对象身份缓存,因此同一 Form
|
|
7
|
+
* 中对同一规范化字段路径的多次读取会复用同一组 Ref。
|
|
8
|
+
*
|
|
9
|
+
* @typeParam TValues - Form 的值类型。
|
|
10
|
+
* @typeParam TName - 字段路径类型。
|
|
11
|
+
* @param bridge - 所属 Form Bridge。
|
|
12
|
+
* @param name - 字段路径。
|
|
13
|
+
* @returns 对应字段的共享 Vue Bridge。
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const bridge = getVueFormBridge(form)
|
|
18
|
+
* const field = getVueFieldBridge(bridge, "email")
|
|
19
|
+
* watchEffect(() => console.log(field.value.value))
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function getVueFieldBridge<TValues extends Values = Values, TName extends NamePath<TValues> = NamePath<TValues>>(bridge: VueFormBridge<TValues>, name: TName): VueFieldBridge<TValues, TName>;
|
|
23
|
+
//# sourceMappingURL=fieldBridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fieldBridge.d.ts","sourceRoot":"","sources":["../../src/bridge/fieldBridge.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAyB,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACnF,OAAO,KAAK,EAAc,QAAQ,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAEhE;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,SAAS,MAAM,GAAG,MAAM,EAC/B,KAAK,SAAS,QAAQ,CAAC,OAAO,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,EACnD,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,GAAG,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,CAmE7E"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { VueFormBridge, VueSchemxInstance } from './types';
|
|
2
|
+
import { SchemxInstance, Values } from '@schemx/core';
|
|
3
|
+
/**
|
|
4
|
+
* 返回原始 Core Form;普通 Core Form 输入时保持引用不变。
|
|
5
|
+
*
|
|
6
|
+
* @param form - Core Form 或 Vue Facade。
|
|
7
|
+
* @returns 原始 Core Form。
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const coreForm = getCoreForm(form)
|
|
12
|
+
* const snapshot = coreForm.getFieldsSnapshot()
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function getCoreForm<TValues extends Values = Values>(form: SchemxInstance<TValues> | VueSchemxInstance<TValues>): SchemxInstance<TValues>;
|
|
16
|
+
/**
|
|
17
|
+
* 获取指定 Form 的共享 Vue Bridge。
|
|
18
|
+
*
|
|
19
|
+
* @param form - Core Form 或 Vue Facade。
|
|
20
|
+
* @returns 对应的共享 Bridge。
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* 首次调用会创建 SnapshotSource 订阅;调用方应使用
|
|
24
|
+
* `retainVueFormBridge()` 持有 Bridge,并在 owner 销毁时释放。
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* const bridge = getVueFormBridge(form)
|
|
29
|
+
* const release = retainVueFormBridge(bridge)
|
|
30
|
+
* onScopeDispose(release)
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function getVueFormBridge<TValues extends Values = Values>(form: SchemxInstance<TValues> | VueSchemxInstance<TValues>): VueFormBridge<TValues>;
|
|
34
|
+
/**
|
|
35
|
+
* 获取指定 Form 的唯一 Vue Facade。
|
|
36
|
+
*
|
|
37
|
+
* @param form - Core Form 或已有 Vue Facade。
|
|
38
|
+
* @returns 可被 Vue effect 追踪的 Facade。
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* const reactiveForm = getVueFormFacade(form)
|
|
43
|
+
* watchEffect(() => {
|
|
44
|
+
* console.log(reactiveForm.getFieldsValue())
|
|
45
|
+
* })
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare function getVueFormFacade<TValues extends Values = Values>(form: SchemxInstance<TValues> | VueSchemxInstance<TValues>): VueSchemxInstance<TValues>;
|
|
49
|
+
/**
|
|
50
|
+
* 为一个 Vue owner 保留 Bridge,并返回对应的幂等释放函数。
|
|
51
|
+
*
|
|
52
|
+
* @param bridge - 要保留的共享 Bridge。
|
|
53
|
+
* @returns 释放当前 owner 的函数。
|
|
54
|
+
*
|
|
55
|
+
* @remarks
|
|
56
|
+
* 返回的释放函数可安全重复调用;最后一个 owner 释放后,Bridge 会自动销毁。
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* const bridge = getVueFormBridge(form)
|
|
61
|
+
* const release = retainVueFormBridge(bridge)
|
|
62
|
+
* onScopeDispose(release)
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export declare function retainVueFormBridge<TValues extends Values>(bridge: VueFormBridge<TValues>): () => void;
|
|
66
|
+
/**
|
|
67
|
+
* 销毁共享 Bridge、全部字段订阅与 Core 状态适配器。
|
|
68
|
+
*
|
|
69
|
+
* @param bridge - 要销毁的共享 Form Bridge。
|
|
70
|
+
*
|
|
71
|
+
* @remarks
|
|
72
|
+
* 销毁后 Bridge、字段 Ref 投影和状态适配器均不可继续使用;通常由
|
|
73
|
+
* `retainVueFormBridge()` 返回的最后一个释放函数自动触发。
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```ts
|
|
77
|
+
* disposeVueFormBridge(bridge)
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export declare function disposeVueFormBridge<TValues extends Values>(bridge: VueFormBridge<TValues>): void;
|
|
81
|
+
//# sourceMappingURL=formBridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formBridge.d.ts","sourceRoot":"","sources":["../../src/bridge/formBridge.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,OAAO,KAAK,EAGV,aAAa,EACb,iBAAiB,EAClB,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EAAY,cAAc,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAiBpE;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EACzD,IAAI,EAAE,cAAc,CAAC,OAAO,CAAC,GAAG,iBAAiB,CAAC,OAAO,CAAC,GACzD,cAAc,CAAC,OAAO,CAAC,CAIzB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EAC9D,IAAI,EAAE,cAAc,CAAC,OAAO,CAAC,GAAG,iBAAiB,CAAC,OAAO,CAAC,GACzD,aAAa,CAAC,OAAO,CAAC,CAcxB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EAC9D,IAAI,EAAE,cAAc,CAAC,OAAO,CAAC,GAAG,iBAAiB,CAAC,OAAO,CAAC,GACzD,iBAAiB,CAAC,OAAO,CAAC,CAwB5B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,SAAS,MAAM,EACxD,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,GAC7B,MAAM,IAAI,CAqBZ;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,SAAS,MAAM,EACzD,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,GAC7B,IAAI,CAgBN"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { VueFieldBridge, VueFormBridge, VueSchemxInstance } from './types';
|
|
2
|
+
import { NamePath, SchemxInstance, Values } from '@schemx/core';
|
|
3
|
+
/**
|
|
4
|
+
* 创建 Facade 所需的 Bridge 生命周期操作。
|
|
5
|
+
*
|
|
6
|
+
* @internal
|
|
7
|
+
* @typeParam TValues - Form 的值类型。
|
|
8
|
+
*/
|
|
9
|
+
export interface VueFormFacadeDependencies<TValues extends Values> {
|
|
10
|
+
/**
|
|
11
|
+
* 获取指定 Form 的共享 Bridge。
|
|
12
|
+
*
|
|
13
|
+
* @param form - 要获取 Bridge 的 Core Form。
|
|
14
|
+
* @returns 对应的共享 Form Bridge。
|
|
15
|
+
*/
|
|
16
|
+
getFormBridge(form: SchemxInstance<TValues>): VueFormBridge<TValues>;
|
|
17
|
+
/**
|
|
18
|
+
* 获取指定字段的共享 Bridge。
|
|
19
|
+
*
|
|
20
|
+
* @param bridge - 所属 Form Bridge。
|
|
21
|
+
* @param name - 字段路径。
|
|
22
|
+
* @returns 对应字段的 Vue Bridge。
|
|
23
|
+
*/
|
|
24
|
+
getFieldBridge<TName extends NamePath<TValues>>(bridge: VueFormBridge<TValues>, name: TName): VueFieldBridge<TValues, TName>;
|
|
25
|
+
/**
|
|
26
|
+
* 查找已创建的 Form Bridge,但不因销毁动作创建新 Bridge。
|
|
27
|
+
*
|
|
28
|
+
* @param form - 要查找的 Core Form。
|
|
29
|
+
* @returns 已缓存的 Bridge;不存在时返回 `undefined`。
|
|
30
|
+
*/
|
|
31
|
+
getCachedFormBridge(form: SchemxInstance<TValues>): VueFormBridge<TValues> | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* 销毁指定的共享 Form Bridge。
|
|
34
|
+
*
|
|
35
|
+
* @param bridge - 要销毁的 Form Bridge。
|
|
36
|
+
*/
|
|
37
|
+
disposeFormBridge(bridge: VueFormBridge<TValues>): void;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* 为 Core Form 创建保持完整 API 的 Vue Facade。
|
|
41
|
+
*
|
|
42
|
+
* Facade 将字段和聚合状态读取转发给 Core,并在读取期间访问 Vue Ref,
|
|
43
|
+
* 从而让当前 Vue effect 建立对应的响应式依赖。
|
|
44
|
+
*
|
|
45
|
+
* @typeParam TValues - Form 的值类型。
|
|
46
|
+
* @param form - 要包装的原始 Core Form。
|
|
47
|
+
* @param dependencies - 提供 Bridge 获取、字段读取和销毁能力的运行时依赖。
|
|
48
|
+
* @param dependencies.getFormBridge - 获取共享 Form Bridge。
|
|
49
|
+
* @param dependencies.getFieldBridge - 获取共享字段 Bridge。
|
|
50
|
+
* @param dependencies.getCachedFormBridge - 查找已缓存的 Form Bridge。
|
|
51
|
+
* @param dependencies.disposeFormBridge - 销毁共享 Form Bridge。
|
|
52
|
+
* @returns 可被 Vue effect 追踪的 Facade。
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* const facade = createVueFormFacade(form, {
|
|
57
|
+
* getFormBridge,
|
|
58
|
+
* getFieldBridge,
|
|
59
|
+
* getCachedFormBridge,
|
|
60
|
+
* disposeFormBridge,
|
|
61
|
+
* })
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export declare function createVueFormFacade<TValues extends Values>(form: SchemxInstance<TValues>, dependencies: VueFormFacadeDependencies<TValues>): VueSchemxInstance<TValues>;
|
|
65
|
+
//# sourceMappingURL=formFacade.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formFacade.d.ts","sourceRoot":"","sources":["../../src/bridge/formFacade.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAC/E,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAEpE;;;;;GAKG;AACH,MAAM,WAAW,yBAAyB,CAAC,OAAO,SAAS,MAAM;IAC/D;;;;;OAKG;IACH,aAAa,CAAC,IAAI,EAAE,cAAc,CAAC,OAAO,CAAC,GAAG,aAAa,CAAC,OAAO,CAAC,CAAA;IACpE;;;;;;OAMG;IACH,cAAc,CAAC,KAAK,SAAS,QAAQ,CAAC,OAAO,CAAC,EAC5C,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,EAC9B,IAAI,EAAE,KAAK,GACV,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;IACjC;;;;;OAKG;IACH,mBAAmB,CAAC,IAAI,EAAE,cAAc,CAAC,OAAO,CAAC,GAAG,aAAa,CAAC,OAAO,CAAC,GAAG,SAAS,CAAA;IACtF;;;;OAIG;IACH,iBAAiB,CAAC,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,GAAG,IAAI,CAAA;CACxD;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,SAAS,MAAM,EACxD,IAAI,EAAE,cAAc,CAAC,OAAO,CAAC,EAC7B,YAAY,EAAE,yBAAyB,CAAC,OAAO,CAAC,GAC/C,iBAAiB,CAAC,OAAO,CAAC,CA0J5B"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ShallowRef } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* 创建类型为 `ShallowRef` 的 Vue 浅层 Ref。
|
|
4
|
+
*
|
|
5
|
+
* 运行时直接委托 Vue 的 `shallowRef`,类型断言用于保留当前 Bridge 对快照引用的控制。
|
|
6
|
+
*
|
|
7
|
+
* @typeParam TValue - Ref 中保存的值类型。
|
|
8
|
+
* @param value - 要包装为 shallow Ref 的当前值。
|
|
9
|
+
* @returns 包装后的 shallow Ref。
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const ready = createVueShallowRef(false)
|
|
14
|
+
* ready.value = true
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare function createVueShallowRef<TValue>(value: TValue): ShallowRef<TValue>;
|
|
18
|
+
/**
|
|
19
|
+
* 比较两份错误消息列表,避免无变化时写入 Vue Ref。
|
|
20
|
+
*
|
|
21
|
+
* @param previous - 当前 Ref 中保存的错误消息列表。
|
|
22
|
+
* @param next - SnapshotSource 返回的最新错误消息列表。
|
|
23
|
+
* @returns 两个列表的长度和每一项都相同时返回 `true`。
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* const changed = !areStringListsEqual(previous, next)
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function areStringListsEqual(previous: readonly string[], next: readonly string[]): boolean;
|
|
31
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/bridge/helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAErC;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,CAE7E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,IAAI,EAAE,SAAS,MAAM,EAAE,GACtB,OAAO,CAKT"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue Bridge 的内部统一入口。
|
|
3
|
+
*
|
|
4
|
+
* 该目录消费 Core 的 `FormStateAdapter`,并将快照同步为 Vue Ref 与 Facade。
|
|
5
|
+
*
|
|
6
|
+
* @module vue/bridge
|
|
7
|
+
*/
|
|
8
|
+
export { disposeVueFormBridge, getCoreForm, getVueFormBridge, getVueFormFacade, retainVueFormBridge, } from './formBridge';
|
|
9
|
+
export { getVueFieldBridge } from './fieldBridge';
|
|
10
|
+
export type { VueFieldBridge, VueFormBridge, VueSchemxInstance } from './types';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bridge/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,oBAAoB,EACpB,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACjD,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA"}
|