@vunk/form 2.7.0 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/form-item-renderer/index.cjs +28 -4
- package/components/form-item-renderer/index.mjs +29 -5
- package/components/form-item-renderer/src/utils.d.ts +5 -0
- package/components/form-item-renderer-template/src/types.d.ts +7 -1
- package/components/information-collection/index.cjs +10 -2
- package/components/information-collection/index.mjs +10 -2
- package/components/information-collection/src/ctx.d.ts +9 -4
- package/components/information-collection/src/index.vue.d.ts +17 -8
- package/components/information-collection/src/types.d.ts +3 -1
- package/components/information-tag/src/index.vue.d.ts +1 -1
- package/components/input-collection/src/types.d.ts +2 -3
- package/package.json +1 -1
- package/shared/types/source/index.d.ts +12 -5
|
@@ -25,6 +25,20 @@ const props = {
|
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
+
const genInputEffectFunc = (inputEffectRaw) => {
|
|
29
|
+
if (!inputEffectRaw) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (typeof inputEffectRaw === "function") {
|
|
33
|
+
return inputEffectRaw;
|
|
34
|
+
}
|
|
35
|
+
if (typeof inputEffectRaw === "string") {
|
|
36
|
+
const inputEffect = new Function("value", "context", inputEffectRaw);
|
|
37
|
+
return inputEffect;
|
|
38
|
+
}
|
|
39
|
+
return _function.noop;
|
|
40
|
+
};
|
|
41
|
+
|
|
28
42
|
const VkfFormItemRenderer$1 = vue.defineComponent({
|
|
29
43
|
name: "VkfFormItemRenderer",
|
|
30
44
|
props: props,
|
|
@@ -65,10 +79,12 @@ const VkfFormItemRenderer$1 = vue.defineComponent({
|
|
|
65
79
|
_function.isCallable(c.templateProps) ? c.templateProps(rendererData?.value) : c.templateProps
|
|
66
80
|
);
|
|
67
81
|
const informationProps = _function.isCallable(slotData.informationProps) ? slotData.informationProps(rendererData?.value) : slotData.informationProps;
|
|
82
|
+
const inputEffect = genInputEffectFunc(slotData.inputEffect);
|
|
68
83
|
Reflect.deleteProperty(slotData, "templateType");
|
|
69
84
|
Reflect.deleteProperty(slotData, "templateIf");
|
|
70
85
|
Reflect.deleteProperty(slotData, "templateProps");
|
|
71
86
|
Reflect.deleteProperty(slotData, "informationProps");
|
|
87
|
+
Reflect.deleteProperty(slotData, "inputEffect");
|
|
72
88
|
const nodeKey = currentK.join(",") + "-" + c.templateType + "-" + (c.prop || "no-prop");
|
|
73
89
|
const modelValue = vue.computed({
|
|
74
90
|
get: () => c.prop && getDataValue?.(c.prop),
|
|
@@ -77,7 +93,7 @@ const VkfFormItemRenderer$1 = vue.defineComponent({
|
|
|
77
93
|
v
|
|
78
94
|
})
|
|
79
95
|
});
|
|
80
|
-
const
|
|
96
|
+
const defaultSlotArguments = {
|
|
81
97
|
// for legacy
|
|
82
98
|
data: slotData,
|
|
83
99
|
raw: c,
|
|
@@ -85,13 +101,21 @@ const VkfFormItemRenderer$1 = vue.defineComponent({
|
|
|
85
101
|
k: currentK,
|
|
86
102
|
key: nodeKey,
|
|
87
103
|
value: modelValue.value,
|
|
88
|
-
input: (v) =>
|
|
104
|
+
input: (v) => {
|
|
105
|
+
modelValue.value = v;
|
|
106
|
+
inputEffect?.(v, {
|
|
107
|
+
...defaultSlotArguments,
|
|
108
|
+
parentProp: [c.prop].flat(Infinity).slice(0, -1)
|
|
109
|
+
});
|
|
110
|
+
},
|
|
89
111
|
informationProps,
|
|
90
112
|
templateIf,
|
|
91
113
|
Renderer,
|
|
92
114
|
getDataValue,
|
|
93
|
-
emitSetData
|
|
94
|
-
|
|
115
|
+
emitSetData,
|
|
116
|
+
inputEffect
|
|
117
|
+
};
|
|
118
|
+
const nodes = getTemplateInstance(c.templateType)?.slots.default?.(defaultSlotArguments);
|
|
95
119
|
nodes && a.push(nodes);
|
|
96
120
|
} else {
|
|
97
121
|
validateTemplateType();
|
|
@@ -2,7 +2,7 @@ import { defineComponent, computed, h, nextTick, openBlock, createBlock, withCtx
|
|
|
2
2
|
import { VkfTemplateInstancesProvider } from '@vunk/form/components/template-instances-provider';
|
|
3
3
|
import { genTemplateIfFunc } from '@vunk/form/shared/form';
|
|
4
4
|
import { useTemplateInstancesContext, useRendererData } from '@vunk/form/composables';
|
|
5
|
-
import { isCallable } from '@vunk/shared/function';
|
|
5
|
+
import { noop, isCallable } from '@vunk/shared/function';
|
|
6
6
|
import { _ as _export_sfc } from '../_plugin-vue_export-helper.mjs';
|
|
7
7
|
|
|
8
8
|
const props = {
|
|
@@ -21,6 +21,20 @@ const props = {
|
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
+
const genInputEffectFunc = (inputEffectRaw) => {
|
|
25
|
+
if (!inputEffectRaw) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (typeof inputEffectRaw === "function") {
|
|
29
|
+
return inputEffectRaw;
|
|
30
|
+
}
|
|
31
|
+
if (typeof inputEffectRaw === "string") {
|
|
32
|
+
const inputEffect = new Function("value", "context", inputEffectRaw);
|
|
33
|
+
return inputEffect;
|
|
34
|
+
}
|
|
35
|
+
return noop;
|
|
36
|
+
};
|
|
37
|
+
|
|
24
38
|
const VkfFormItemRenderer$1 = defineComponent({
|
|
25
39
|
name: "VkfFormItemRenderer",
|
|
26
40
|
props: props,
|
|
@@ -61,10 +75,12 @@ const VkfFormItemRenderer$1 = defineComponent({
|
|
|
61
75
|
isCallable(c.templateProps) ? c.templateProps(rendererData?.value) : c.templateProps
|
|
62
76
|
);
|
|
63
77
|
const informationProps = isCallable(slotData.informationProps) ? slotData.informationProps(rendererData?.value) : slotData.informationProps;
|
|
78
|
+
const inputEffect = genInputEffectFunc(slotData.inputEffect);
|
|
64
79
|
Reflect.deleteProperty(slotData, "templateType");
|
|
65
80
|
Reflect.deleteProperty(slotData, "templateIf");
|
|
66
81
|
Reflect.deleteProperty(slotData, "templateProps");
|
|
67
82
|
Reflect.deleteProperty(slotData, "informationProps");
|
|
83
|
+
Reflect.deleteProperty(slotData, "inputEffect");
|
|
68
84
|
const nodeKey = currentK.join(",") + "-" + c.templateType + "-" + (c.prop || "no-prop");
|
|
69
85
|
const modelValue = computed({
|
|
70
86
|
get: () => c.prop && getDataValue?.(c.prop),
|
|
@@ -73,7 +89,7 @@ const VkfFormItemRenderer$1 = defineComponent({
|
|
|
73
89
|
v
|
|
74
90
|
})
|
|
75
91
|
});
|
|
76
|
-
const
|
|
92
|
+
const defaultSlotArguments = {
|
|
77
93
|
// for legacy
|
|
78
94
|
data: slotData,
|
|
79
95
|
raw: c,
|
|
@@ -81,13 +97,21 @@ const VkfFormItemRenderer$1 = defineComponent({
|
|
|
81
97
|
k: currentK,
|
|
82
98
|
key: nodeKey,
|
|
83
99
|
value: modelValue.value,
|
|
84
|
-
input: (v) =>
|
|
100
|
+
input: (v) => {
|
|
101
|
+
modelValue.value = v;
|
|
102
|
+
inputEffect?.(v, {
|
|
103
|
+
...defaultSlotArguments,
|
|
104
|
+
parentProp: [c.prop].flat(Infinity).slice(0, -1)
|
|
105
|
+
});
|
|
106
|
+
},
|
|
85
107
|
informationProps,
|
|
86
108
|
templateIf,
|
|
87
109
|
Renderer,
|
|
88
110
|
getDataValue,
|
|
89
|
-
emitSetData
|
|
90
|
-
|
|
111
|
+
emitSetData,
|
|
112
|
+
inputEffect
|
|
113
|
+
};
|
|
114
|
+
const nodes = getTemplateInstance(c.templateType)?.slots.default?.(defaultSlotArguments);
|
|
91
115
|
nodes && a.push(nodes);
|
|
92
116
|
} else {
|
|
93
117
|
validateTemplateType();
|
|
@@ -2,7 +2,9 @@ import { __VkfFormItemRenderer } from '@vunk/form/components/form-item-renderer'
|
|
|
2
2
|
import { NormalObject } from '@vunk/shared';
|
|
3
3
|
import type { VkfFormItemRenderer } from '@vunk/form/components/form-item-renderer';
|
|
4
4
|
import { MaybeArray, SetDataEvent } from '@vunk/core';
|
|
5
|
+
import { InputEffectContext } from '@vunk/form/shared';
|
|
5
6
|
type RendererTreeData = __VkfFormItemRenderer.RendererTreeData;
|
|
7
|
+
type InternalField = 'templateType' | 'templateIf' | 'informationProps' | 'templateProps' | 'inputEffect';
|
|
6
8
|
export interface DefaultSlotArguments {
|
|
7
9
|
raw: RendererTreeData;
|
|
8
10
|
/**
|
|
@@ -16,7 +18,7 @@ export interface DefaultSlotArguments {
|
|
|
16
18
|
/**
|
|
17
19
|
* 当前表单项的数据,排除渲染占用字段
|
|
18
20
|
*/
|
|
19
|
-
props: Omit<RendererTreeData,
|
|
21
|
+
props: Omit<RendererTreeData, InternalField>;
|
|
20
22
|
/**
|
|
21
23
|
* 提供给 Information 组件的 props
|
|
22
24
|
*/
|
|
@@ -37,6 +39,10 @@ export interface DefaultSlotArguments {
|
|
|
37
39
|
* 更新表单数据(如果formItem提供prop)
|
|
38
40
|
*/
|
|
39
41
|
input?: (v: any) => void;
|
|
42
|
+
/**
|
|
43
|
+
* input 执行后的副操作
|
|
44
|
+
*/
|
|
45
|
+
inputEffect?: (v: any, e: InputEffectContext) => void;
|
|
40
46
|
/**
|
|
41
47
|
* 从表单数据中获取对应的值
|
|
42
48
|
*/
|
|
@@ -11,6 +11,10 @@ var _pluginVue_exportHelper = require('../_plugin-vue_export-helper.cjs');
|
|
|
11
11
|
|
|
12
12
|
const props = {
|
|
13
13
|
...formItem._VkfFormItemCtx.props,
|
|
14
|
+
information: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: true
|
|
17
|
+
},
|
|
14
18
|
modelValue: {
|
|
15
19
|
type: Array,
|
|
16
20
|
default: () => []
|
|
@@ -22,6 +26,10 @@ const props = {
|
|
|
22
26
|
labelRender: {
|
|
23
27
|
type: Function,
|
|
24
28
|
default: void 0
|
|
29
|
+
},
|
|
30
|
+
typeRender: {
|
|
31
|
+
type: Function,
|
|
32
|
+
default: void 0
|
|
25
33
|
}
|
|
26
34
|
};
|
|
27
35
|
const emits = {};
|
|
@@ -35,8 +43,7 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
35
43
|
}) {
|
|
36
44
|
const formItemProps = formItem._VkfFormItemCtx.createBindProps(props2);
|
|
37
45
|
return () => vue.createVNode(formItem.VkfFormItem, vue.mergeProps({
|
|
38
|
-
"class": "vk-information-collection"
|
|
39
|
-
"information": true
|
|
46
|
+
"class": "vk-information-collection"
|
|
40
47
|
}, formItemProps.value), {
|
|
41
48
|
default: () => [vue.createVNode("div", {
|
|
42
49
|
"class": "vk-information-collection-value"
|
|
@@ -45,6 +52,7 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
45
52
|
default: () => props2.modelValue.map((item, index) => vue.createVNode(informationTag.VkfInformationTag, {
|
|
46
53
|
"key": index,
|
|
47
54
|
"data": item,
|
|
55
|
+
"type": props2.typeRender?.(item),
|
|
48
56
|
"labelRender": props2.labelRender,
|
|
49
57
|
"formItems": props2.columns.map(v => ({
|
|
50
58
|
...v,
|
|
@@ -7,6 +7,10 @@ import { _ as _export_sfc } from '../_plugin-vue_export-helper.mjs';
|
|
|
7
7
|
|
|
8
8
|
const props = {
|
|
9
9
|
..._VkfFormItemCtx.props,
|
|
10
|
+
information: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
default: true
|
|
13
|
+
},
|
|
10
14
|
modelValue: {
|
|
11
15
|
type: Array,
|
|
12
16
|
default: () => []
|
|
@@ -18,6 +22,10 @@ const props = {
|
|
|
18
22
|
labelRender: {
|
|
19
23
|
type: Function,
|
|
20
24
|
default: void 0
|
|
25
|
+
},
|
|
26
|
+
typeRender: {
|
|
27
|
+
type: Function,
|
|
28
|
+
default: void 0
|
|
21
29
|
}
|
|
22
30
|
};
|
|
23
31
|
const emits = {};
|
|
@@ -31,8 +39,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
31
39
|
}) {
|
|
32
40
|
const formItemProps = _VkfFormItemCtx.createBindProps(props2);
|
|
33
41
|
return () => createVNode(VkfFormItem, mergeProps({
|
|
34
|
-
"class": "vk-information-collection"
|
|
35
|
-
"information": true
|
|
42
|
+
"class": "vk-information-collection"
|
|
36
43
|
}, formItemProps.value), {
|
|
37
44
|
default: () => [createVNode("div", {
|
|
38
45
|
"class": "vk-information-collection-value"
|
|
@@ -41,6 +48,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
41
48
|
default: () => props2.modelValue.map((item, index) => createVNode(VkfInformationTag, {
|
|
42
49
|
"key": index,
|
|
43
50
|
"data": item,
|
|
51
|
+
"type": props2.typeRender?.(item),
|
|
44
52
|
"labelRender": props2.labelRender,
|
|
45
53
|
"formItems": props2.columns.map(v => ({
|
|
46
54
|
...v,
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { Func } from '@vunk/core';
|
|
2
2
|
import { NormalObject } from '@vunk/shared';
|
|
3
3
|
import { PropType } from 'vue';
|
|
4
|
+
import { TagProps } from 'element-plus';
|
|
4
5
|
export declare const props: {
|
|
6
|
+
information: {
|
|
7
|
+
type: BooleanConstructor;
|
|
8
|
+
default: boolean;
|
|
9
|
+
};
|
|
5
10
|
modelValue: {
|
|
6
11
|
type: {
|
|
7
12
|
(arrayLength: number): NormalObject[];
|
|
@@ -44,6 +49,10 @@ export declare const props: {
|
|
|
44
49
|
type: PropType<Func<any, string>>;
|
|
45
50
|
default: any;
|
|
46
51
|
};
|
|
52
|
+
typeRender: {
|
|
53
|
+
type: PropType<Func<any, TagProps["type"]>>;
|
|
54
|
+
default: any;
|
|
55
|
+
};
|
|
47
56
|
required: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
|
|
48
57
|
formItemSize: {
|
|
49
58
|
type: PropType<"default" | "small" | "large">;
|
|
@@ -74,10 +83,6 @@ export declare const props: {
|
|
|
74
83
|
type: StringConstructor;
|
|
75
84
|
default: any;
|
|
76
85
|
};
|
|
77
|
-
information: {
|
|
78
|
-
type: BooleanConstructor;
|
|
79
|
-
default: boolean;
|
|
80
|
-
};
|
|
81
86
|
label: StringConstructor;
|
|
82
87
|
labelWidth: import("element-plus/es/utils").EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, "", boolean>;
|
|
83
88
|
labelPosition: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "" | "top" | "left" | "right", unknown, "", boolean>;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
|
+
information: {
|
|
3
|
+
type: BooleanConstructor;
|
|
4
|
+
default: boolean;
|
|
5
|
+
};
|
|
2
6
|
modelValue: {
|
|
3
7
|
type: {
|
|
4
8
|
(arrayLength: number): import("@vunk/shared").NormalObject[];
|
|
@@ -41,6 +45,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
41
45
|
type: import("vue").PropType<import("@vunk/core").Func<any, string>>;
|
|
42
46
|
default: any;
|
|
43
47
|
};
|
|
48
|
+
typeRender: {
|
|
49
|
+
type: import("vue").PropType<import("@vunk/core").Func<any, import("element-plus").TagProps["type"]>>;
|
|
50
|
+
default: any;
|
|
51
|
+
};
|
|
44
52
|
required: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
|
|
45
53
|
formItemSize: {
|
|
46
54
|
type: import("vue").PropType<"default" | "small" | "large">;
|
|
@@ -71,10 +79,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
71
79
|
type: StringConstructor;
|
|
72
80
|
default: any;
|
|
73
81
|
};
|
|
74
|
-
information: {
|
|
75
|
-
type: BooleanConstructor;
|
|
76
|
-
default: boolean;
|
|
77
|
-
};
|
|
78
82
|
label: StringConstructor;
|
|
79
83
|
labelWidth: import("element-plus/es/utils").EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, "", boolean>;
|
|
80
84
|
labelPosition: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "" | "top" | "left" | "right", unknown, "", boolean>;
|
|
@@ -101,6 +105,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
101
105
|
inlineMessage: import("element-plus/es/utils").EpPropFinalized<readonly [StringConstructor, BooleanConstructor], unknown, unknown, "", boolean>;
|
|
102
106
|
showMessage: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
|
|
103
107
|
}>, () => JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
108
|
+
information: {
|
|
109
|
+
type: BooleanConstructor;
|
|
110
|
+
default: boolean;
|
|
111
|
+
};
|
|
104
112
|
modelValue: {
|
|
105
113
|
type: {
|
|
106
114
|
(arrayLength: number): import("@vunk/shared").NormalObject[];
|
|
@@ -143,6 +151,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
143
151
|
type: import("vue").PropType<import("@vunk/core").Func<any, string>>;
|
|
144
152
|
default: any;
|
|
145
153
|
};
|
|
154
|
+
typeRender: {
|
|
155
|
+
type: import("vue").PropType<import("@vunk/core").Func<any, import("element-plus").TagProps["type"]>>;
|
|
156
|
+
default: any;
|
|
157
|
+
};
|
|
146
158
|
required: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
|
|
147
159
|
formItemSize: {
|
|
148
160
|
type: import("vue").PropType<"default" | "small" | "large">;
|
|
@@ -173,10 +185,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
173
185
|
type: StringConstructor;
|
|
174
186
|
default: any;
|
|
175
187
|
};
|
|
176
|
-
information: {
|
|
177
|
-
type: BooleanConstructor;
|
|
178
|
-
default: boolean;
|
|
179
|
-
};
|
|
180
188
|
label: StringConstructor;
|
|
181
189
|
labelWidth: import("element-plus/es/utils").EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, "", boolean>;
|
|
182
190
|
labelPosition: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "" | "top" | "left" | "right", unknown, "", boolean>;
|
|
@@ -219,5 +227,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
219
227
|
modelValue: import("@vunk/shared").NormalObject[];
|
|
220
228
|
columns: any[];
|
|
221
229
|
labelRender: ((...args: any) => string) | ((arg: any) => string);
|
|
230
|
+
typeRender: ((...args: any) => import("element-plus/es/utils").EpPropMergeType<StringConstructor, "success" | "warning" | "info" | "primary" | "danger", unknown>) | ((arg: any) => import("element-plus/es/utils").EpPropMergeType<StringConstructor, "success" | "warning" | "info" | "primary" | "danger", unknown>);
|
|
222
231
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
223
232
|
export default _default;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { __VkfInputCollection } from '@vunk/form/components/input-collection';
|
|
2
2
|
import { __VkfTemplatesDefault } from '@vunk/form';
|
|
3
|
-
import { Keyof, NormalObject } from '@vunk/shared';
|
|
3
|
+
import { Keyof, NormalObject, VueComponentPropsType } from '@vunk/shared';
|
|
4
|
+
import type Core from './index.vue';
|
|
4
5
|
export type Column<R extends NormalObject = NormalObject, SourceType extends NormalObject = __VkfTemplatesDefault.CoreSource<Keyof<R>>> = __VkfInputCollection.Column<R, SourceType>;
|
|
6
|
+
export type ComponentProps = VueComponentPropsType<typeof Core>;
|
|
@@ -98,9 +98,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
98
98
|
round: boolean;
|
|
99
99
|
formItems: any[];
|
|
100
100
|
title: string | ((data: any) => string);
|
|
101
|
-
labelRender: (data: import("@vunk/shared").NormalObject) => string;
|
|
102
101
|
closable: boolean;
|
|
103
102
|
disableTransitions: boolean;
|
|
104
103
|
hit: boolean;
|
|
104
|
+
labelRender: (data: import("@vunk/shared").NormalObject) => string;
|
|
105
105
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
106
106
|
export default _default;
|
|
@@ -4,12 +4,11 @@ import type { __VkTableColumns } from '@vunk/plus/components/table-columns';
|
|
|
4
4
|
import type { Keyof, NormalObject, VueComponentPropsType } from '@vunk/shared';
|
|
5
5
|
import type { TableColumnCtx } from 'element-plus';
|
|
6
6
|
import type Core from './index.vue';
|
|
7
|
+
import type { __VkfInformationCollection } from '@vunk/form/components/information-collection';
|
|
7
8
|
export interface Source<P extends string = string> extends VueComponentPropsType<typeof Core>, BasicSource {
|
|
8
9
|
prop?: P | P[];
|
|
9
10
|
templateType: 'VkfInputCollection';
|
|
10
|
-
informationProps?:
|
|
11
|
-
labelRender?: (row: any) => string;
|
|
12
|
-
};
|
|
11
|
+
informationProps?: Partial<__VkfInformationCollection.ComponentProps>;
|
|
13
12
|
}
|
|
14
13
|
export type Column<R extends NormalObject = NormalObject, SourceType extends NormalObject = __VkfTemplatesDefault.CoreSource<Keyof<R>>> = Omit<__VkTableColumns.Source<R>, 'slots'> & {
|
|
15
14
|
templateType: SourceType['templateType'];
|
package/package.json
CHANGED
|
@@ -4,24 +4,31 @@ import { __VkfTemplatesElementPlus } from '@vunk/form/components/templates-eleme
|
|
|
4
4
|
import { __VkfTemplatesEsri } from '@vunk/form/components/templates-esri';
|
|
5
5
|
import { AnyFunc, NormalObject } from '@vunk/core';
|
|
6
6
|
import { __VkfTemplatesVariant } from '@vunk/form/components/templates-variant';
|
|
7
|
+
import { __VkfFormItemRendererTemplate } from '@vunk/form/components/form-item-renderer-template';
|
|
8
|
+
export interface InputEffectContext extends __VkfFormItemRendererTemplate.DefaultSlotArguments {
|
|
9
|
+
parentProp: Array<string | number>;
|
|
10
|
+
}
|
|
7
11
|
export interface BasicSource {
|
|
8
12
|
/**
|
|
9
13
|
* @description 渲染的组件
|
|
10
14
|
*/
|
|
11
15
|
templateType?: string;
|
|
12
|
-
/**
|
|
13
|
-
* @description 渲染时提供给组件的 props
|
|
14
|
-
*/
|
|
15
|
-
templateProps?: NormalObject | AnyFunc;
|
|
16
16
|
/**
|
|
17
17
|
* @description 条件渲染
|
|
18
18
|
*/
|
|
19
19
|
templateIf?: ((data: NormalObject) => boolean) | string | boolean;
|
|
20
|
+
/**
|
|
21
|
+
* @description 渲染时提供给组件的 props
|
|
22
|
+
*/
|
|
23
|
+
templateProps?: NormalObject | AnyFunc;
|
|
20
24
|
/**
|
|
21
25
|
* @description 当被 Information 渲染时, 提供的 props
|
|
22
|
-
*
|
|
23
26
|
*/
|
|
24
27
|
informationProps?: NormalObject | AnyFunc;
|
|
28
|
+
/**
|
|
29
|
+
* @description 当 input 触发时, 产生的副作用
|
|
30
|
+
*/
|
|
31
|
+
inputEffect?: (value: any, context: InputEffectContext) => void;
|
|
25
32
|
/**
|
|
26
33
|
* @description dom class
|
|
27
34
|
*/
|