@qin-ui/element-plus-pro 1.4.2 → 1.4.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/api.json +2 -2
- package/es/components/form/components/BaseFormItem/index.vue.d.ts +60 -9
- package/es/components/form/components/BaseFormItem/index.vue.d.ts.map +1 -1
- package/es/components/form/components/BaseFormItems/index.vue.d.ts +13 -0
- package/es/components/form/components/BaseFormItems/index.vue.d.ts.map +1 -0
- package/es/components/form/components/index.d.ts +6 -6
- package/es/components/form/components/index.d.ts.map +1 -1
- package/es/components/form/hooks/useGroupFieldAttrs.d.ts +10 -2
- package/es/components/form/hooks/useGroupFieldAttrs.d.ts.map +1 -1
- package/es/components/form/utils/fieldKey.d.ts +12 -0
- package/es/components/form/utils/fieldKey.d.ts.map +1 -1
- package/es/element-plus-pro.css +2 -1
- package/es/index.js +274 -149
- package/es/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/form/components/BaseFormItem/index.vue +145 -176
- package/src/components/form/components/BaseFormItems/index.vue +183 -0
- package/src/components/form/components/ProForm/index.vue +4 -4
- package/src/components/form/components/index.ts +6 -6
- package/src/components/form/hooks/useGroupFieldAttrs.ts +104 -79
- package/src/components/form/utils/fieldKey.ts +64 -0
package/api.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"generatedAt": "2026-10-
|
|
2
|
+
"generatedAt": "2026-10-30T05:57:37.317Z",
|
|
3
3
|
"name": "@qin-ui/element-plus-pro",
|
|
4
4
|
"api": [
|
|
5
5
|
{
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"type": "component",
|
|
52
52
|
"package": "@qin-ui/element-plus-pro",
|
|
53
53
|
"signature": "<ProForm>",
|
|
54
|
-
"description": "配置驱动表单组件\n架构设计说明 (Architecture Overview)\n[ 数据层 (Core) ] => [ 绑定层 (ProForm) ] => [ 渲染层 (BaseFormItem / BaseField) ]\n1. 数据隔离:ProForm 本身不负责存储和管理表单状态,所有核心状态(formData, fields, 校验规则)\n均交由底层的 `useForm`(@qin-ui/pro-components-core)驱动。\n2. 上下文透传:通过 `provide` 将核心状态下发给子组件。\n3. 递归渲染:网格布局和具体字段的解析交由 `<
|
|
54
|
+
"description": "配置驱动表单组件\n架构设计说明 (Architecture Overview)\n[ 数据层 (Core) ] => [ 绑定层 (ProForm) ] => [ 渲染层 (BaseFormItems / BaseFormItem / BaseField) ]\n1. 数据隔离:ProForm 本身不负责存储和管理表单状态,所有核心状态(formData, fields, 校验规则)\n均交由底层的 `useForm`(@qin-ui/pro-components-core)驱动。\n2. 上下文透传:通过 `provide` 将核心状态下发给子组件。\n3. 递归渲染:网格布局和具体字段的解析交由 `<BaseFormItems>` 递归完成。\n通过配置驱动的方式快速构建表单,支持:\n- 字段联动(通过 setField、watch 等实现)\n- 嵌套字段(通过 fields 递归配置)\n- 自定义组件(通过 component 属性和 custom 类型)\n- 网格布局(通过 grid 属性)\n- 动态插槽(以字段 path 命名的插槽)\n- 全局配置注入(通过 ProComponentProvider)",
|
|
55
55
|
"params": [
|
|
56
56
|
{
|
|
57
57
|
"name": "form",
|
|
@@ -1,13 +1,64 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { PropType, VNode } from 'vue';
|
|
2
|
+
import { Field, Grid } from '../../types';
|
|
3
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
4
|
+
/** 字段配置 */
|
|
5
|
+
field: {
|
|
6
|
+
type: PropType<Field>;
|
|
7
|
+
required: true;
|
|
8
|
+
};
|
|
9
|
+
/** 是否启用网格布局 */
|
|
10
|
+
grid: {
|
|
11
|
+
type: PropType<Grid>;
|
|
12
|
+
default: undefined;
|
|
13
|
+
};
|
|
14
|
+
/** 上层下发的禁用状态 */
|
|
15
|
+
disabled: {
|
|
16
|
+
type: BooleanConstructor;
|
|
17
|
+
default: undefined;
|
|
18
|
+
};
|
|
19
|
+
/** FormItem 实例登记回调 */
|
|
20
|
+
setFormItemRef: {
|
|
21
|
+
type: PropType<(field: Field, el: any, getFormItemProps: () => any) => void>;
|
|
22
|
+
default: undefined;
|
|
23
|
+
};
|
|
24
|
+
/** 控件实例登记回调 */
|
|
25
|
+
setComponentRef: {
|
|
26
|
+
type: PropType<(field: Field, el: any) => void>;
|
|
27
|
+
default: undefined;
|
|
28
|
+
};
|
|
29
|
+
}>, () => VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
30
|
+
[key: string]: any;
|
|
31
|
+
}>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
32
|
+
/** 字段配置 */
|
|
33
|
+
field: {
|
|
34
|
+
type: PropType<Field>;
|
|
35
|
+
required: true;
|
|
36
|
+
};
|
|
37
|
+
/** 是否启用网格布局 */
|
|
38
|
+
grid: {
|
|
39
|
+
type: PropType<Grid>;
|
|
40
|
+
default: undefined;
|
|
41
|
+
};
|
|
42
|
+
/** 上层下发的禁用状态 */
|
|
43
|
+
disabled: {
|
|
44
|
+
type: BooleanConstructor;
|
|
45
|
+
default: undefined;
|
|
46
|
+
};
|
|
47
|
+
/** FormItem 实例登记回调 */
|
|
48
|
+
setFormItemRef: {
|
|
49
|
+
type: PropType<(field: Field, el: any, getFormItemProps: () => any) => void>;
|
|
50
|
+
default: undefined;
|
|
51
|
+
};
|
|
52
|
+
/** 控件实例登记回调 */
|
|
53
|
+
setComponentRef: {
|
|
54
|
+
type: PropType<(field: Field, el: any) => void>;
|
|
55
|
+
default: undefined;
|
|
56
|
+
};
|
|
57
|
+
}>> & Readonly<{}>, {
|
|
8
58
|
disabled: boolean;
|
|
9
|
-
fields: Fields;
|
|
10
59
|
grid: Grid;
|
|
11
|
-
|
|
60
|
+
setFormItemRef: (field: Field, el: any, getFormItemProps: () => any) => void;
|
|
61
|
+
setComponentRef: (field: Field, el: any) => void;
|
|
62
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
12
63
|
export default _default;
|
|
13
64
|
//# sourceMappingURL=index.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.vue.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/BaseFormItem/index.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.vue.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/BaseFormItem/index.vue"],"names":[],"mappings":"AAiLA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAML,KAAK,QAAQ,EACb,KAAK,KAAK,EACX,MAAM,KAAK,CAAC;AAGb,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;;IAa3C,WAAW;;cACc,QAAQ,CAAC,KAAK,CAAC;;;IACxC,eAAe;;cAEc,QAAQ,CAAC,IAAI,CAAC;;;IAG3C,gBAAgB;;;;;IAEhB,sBAAsB;;cAEF,QAAQ,CACxB,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,gBAAgB,EAAE,MAAM,GAAG,KAAK,IAAI,CAC7D;;;IAGH,eAAe;;cAEK,QAAQ,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,KAAK,IAAI,CAAC;;;;;;IAlB7D,WAAW;;cACc,QAAQ,CAAC,KAAK,CAAC;;;IACxC,eAAe;;cAEc,QAAQ,CAAC,IAAI,CAAC;;;IAG3C,gBAAgB;;;;;IAEhB,sBAAsB;;cAEF,QAAQ,CACxB,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,gBAAgB,EAAE,MAAM,GAAG,KAAK,IAAI,CAC7D;;;IAGH,eAAe;;cAEK,QAAQ,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,KAAK,IAAI,CAAC;;;;;;4BANjD,KAAK,MAAM,GAAG,oBAAoB,MAAM,GAAG,KAAK,IAAI;6BAM3B,KAAK,MAAM,GAAG,KAAK,IAAI;;AAtBhE,wBA+HG"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Fields, Grid } from '../../types';
|
|
2
|
+
type Props = {
|
|
3
|
+
grid?: Grid;
|
|
4
|
+
fields?: Fields;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
fields: Fields;
|
|
10
|
+
grid: Grid;
|
|
11
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
12
|
+
export default _default;
|
|
13
|
+
//# sourceMappingURL=index.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.vue.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/BaseFormItems/index.vue"],"names":[],"mappings":"AA0NA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAOhD,KAAK,KAAK,GAAG;IACX,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;;cADW,OAAO;YADT,MAAM;UADR,IAAI;;AA8Nb,wBAOG"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { ComponentProps, ComponentExposed } from 'vue-component-type-helpers';
|
|
2
2
|
import { default as ProForm } from './ProForm/index.vue';
|
|
3
|
-
import { default as
|
|
3
|
+
import { default as BaseFormItems } from './BaseFormItems/index.vue';
|
|
4
4
|
export { default as BaseField } from './BaseField/index.vue';
|
|
5
5
|
export { default as ContainerFragment } from './ContainerFragment/index.vue';
|
|
6
6
|
export { default as SlotComponent } from './SlotComponent/index.vue';
|
|
7
|
-
export { ProForm,
|
|
7
|
+
export { ProForm, BaseFormItems };
|
|
8
8
|
/** ProForm 组件实例 */
|
|
9
9
|
export type ProFormInstance = ComponentExposed<typeof ProForm>;
|
|
10
10
|
/** ProForm 组件属性 */
|
|
11
11
|
export type ProFormProps = ComponentProps<typeof ProForm>;
|
|
12
|
-
/**
|
|
13
|
-
export type
|
|
14
|
-
/**
|
|
15
|
-
export type
|
|
12
|
+
/** BaseFormItems 组件实例(字段级 FormItem) */
|
|
13
|
+
export type ProFormItemsInstance = ComponentExposed<typeof BaseFormItems>;
|
|
14
|
+
/** BaseFormItems 组件属性(字段级 FormItem) */
|
|
15
|
+
export type ProFormItemsProps = ComponentProps<typeof BaseFormItems>;
|
|
16
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/form/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EACjB,MAAM,4BAA4B,CAAC;AACpC,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAC1C,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/form/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EACjB,MAAM,4BAA4B,CAAC;AACpC,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAC1C,OAAO,aAAa,MAAM,2BAA2B,CAAC;AAEtD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC;AAGlC,mBAAmB;AACnB,MAAM,MAAM,eAAe,GAAG,gBAAgB,CAAC,OAAO,OAAO,CAAC,CAAC;AAC/D,mBAAmB;AACnB,MAAM,MAAM,YAAY,GAAG,cAAc,CAAC,OAAO,OAAO,CAAC,CAAC;AAE1D,uCAAuC;AACvC,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,CAAC,OAAO,aAAa,CAAC,CAAC;AAC1E,uCAAuC;AACvC,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC,OAAO,aAAa,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComputedRef } from 'vue';
|
|
1
|
+
import { ComputedRef, MaybeRefOrGetter } from 'vue';
|
|
2
2
|
import { FormItemProps, GridItemProps } from '../../../shared/ui';
|
|
3
3
|
import { FORM_ITEM_SLOT_KEYS } from '../constants';
|
|
4
4
|
import { Base, Field } from '../types';
|
|
@@ -11,7 +11,6 @@ export interface GroupedField {
|
|
|
11
11
|
componentProps: Record<string, any>;
|
|
12
12
|
container?: Base['formItemContainer'];
|
|
13
13
|
rawField: Field;
|
|
14
|
-
renderKey: string | number;
|
|
15
14
|
}
|
|
16
15
|
/**
|
|
17
16
|
* 将 fields 配置数组逐个拆分为 grid / formItem / component / slots 分组。
|
|
@@ -24,4 +23,13 @@ export interface GroupedField {
|
|
|
24
23
|
* @returns {ComputedRef<GroupedField[]>} 分组后的字段属性数组
|
|
25
24
|
*/
|
|
26
25
|
export declare function useGroupFieldAttrs(validFields: ComputedRef<Field[]>): ComputedRef<GroupedField[]>;
|
|
26
|
+
/**
|
|
27
|
+
* 将单个字段配置拆分为 grid / formItem / component / slots 分组
|
|
28
|
+
*
|
|
29
|
+
* @description 拆分规则与 `useGroupFieldAttrs` 一致,结果依赖该字段自身配置与 Provider 的 `pro-form-item` 默认值。
|
|
30
|
+
*
|
|
31
|
+
* @param {MaybeRefOrGetter<Field>} field - 待拆分的字段配置
|
|
32
|
+
* @returns {ComputedRef<GroupedField>} 单字段渲染分组
|
|
33
|
+
*/
|
|
34
|
+
export declare function useGroupedField(field: MaybeRefOrGetter<Field>): ComputedRef<GroupedField>;
|
|
27
35
|
//# sourceMappingURL=useGroupFieldAttrs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGroupFieldAttrs.d.ts","sourceRoot":"","sources":["../../../../src/components/form/hooks/useGroupFieldAttrs.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"useGroupFieldAttrs.d.ts","sourceRoot":"","sources":["../../../../src/components/form/hooks/useGroupFieldAttrs.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACtB,MAAM,KAAK,CAAC;AACb,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,aAAa,EACnB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAA+B,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAQ5C,wCAAwC;AACxC,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,aAAa,CAAC;IAC7B,aAAa,EAAE,aAAa,CAAC;IAC7B,aAAa,EAAE,MAAM,CAAC,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC;IACjE,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACpC,SAAS,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;IACtC,QAAQ,EAAE,KAAK,CAAC;CACjB;AAiFD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,WAAW,CAAC,KAAK,EAAE,CAAC,+BAQnE;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC,6BAO7D"}
|
|
@@ -10,4 +10,16 @@
|
|
|
10
10
|
* @returns 字段渲染 key
|
|
11
11
|
*/
|
|
12
12
|
export declare const getFieldKey: (field: unknown) => string | number;
|
|
13
|
+
/**
|
|
14
|
+
* 字段的数据行渲染 key
|
|
15
|
+
*
|
|
16
|
+
* @description 沿字段路径逐段解析原始表单数据,取路径经过的对象数组行元素身份与行内剩余路径组成 key;
|
|
17
|
+
* 同一数据行对象在数组增删 / 重排后恒得同一 key。路径不经过对象数组行、行元素为原始值或数据缺失时,
|
|
18
|
+
* 回退到 {@link getFieldKey} 的字段对象身份。同 key 的去重由调用方按兄弟列表收敛。
|
|
19
|
+
*
|
|
20
|
+
* @param field - 字段配置项
|
|
21
|
+
* @param rawFormData - 原始表单数据(非响应式对象)
|
|
22
|
+
* @returns 数据行 key;无法定位数据行时返回字段对象身份 key
|
|
23
|
+
*/
|
|
24
|
+
export declare const getFieldDataKey: (field: unknown, rawFormData: unknown) => string | number;
|
|
13
25
|
//# sourceMappingURL=fieldKey.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fieldKey.d.ts","sourceRoot":"","sources":["../../../../src/components/form/utils/fieldKey.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fieldKey.d.ts","sourceRoot":"","sources":["../../../../src/components/form/utils/fieldKey.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,GAAI,OAAO,OAAO,KAAG,MAAM,GAAG,MAUrD,CAAC;AAmBF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,OAAO,EACd,aAAa,OAAO,KACnB,MAAM,GAAG,MA6BX,CAAC"}
|
package/es/element-plus-pro.css
CHANGED