@vunk/form 2.14.1 → 2.14.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/components/card-input-collection/index.cjs +111 -43
- package/components/card-input-collection/index.mjs +112 -44
- package/components/card-input-collection/src/ctx.d.ts +30 -2
- package/components/card-input-collection/src/index.vue.d.ts +57 -5
- package/components/card-input-collection/src/types.d.ts +8 -1
- package/components/input-array/src/form-template.vue.d.ts +1 -1
- package/components/input-array/src/index.vue.d.ts +1 -1
- package/components/input-collection/index.cjs +3 -2
- package/components/input-collection/index.mjs +3 -2
- package/package.json +1 -1
|
@@ -11,13 +11,15 @@ var templatesDefault = require('@vunk/form/components/templates-default');
|
|
|
11
11
|
var templateInstancesProvider = require('@vunk/form/components/template-instances-provider');
|
|
12
12
|
var formItemRenderer = require('@vunk/form/components/form-item-renderer');
|
|
13
13
|
var rendererData = require('@vunk/form/components/renderer-data');
|
|
14
|
+
var _function = require('@vunk/shared/function');
|
|
15
|
+
var index = require('../index.cjs');
|
|
14
16
|
var cloneDeep = require('../cloneDeep.cjs');
|
|
15
17
|
var _pluginVue_exportHelper = require('../_plugin-vue_export-helper.cjs');
|
|
16
18
|
require('../isObject.cjs');
|
|
17
19
|
|
|
18
20
|
const props = {
|
|
19
21
|
...formItem._VkfFormItemCtx.props,
|
|
20
|
-
|
|
22
|
+
columns: {
|
|
21
23
|
type: Array,
|
|
22
24
|
default: () => []
|
|
23
25
|
},
|
|
@@ -30,7 +32,7 @@ const props = {
|
|
|
30
32
|
default: void 0
|
|
31
33
|
},
|
|
32
34
|
/**
|
|
33
|
-
* @description
|
|
35
|
+
* @description 是否可以添加或删除
|
|
34
36
|
*/
|
|
35
37
|
splicable: {
|
|
36
38
|
type: Boolean,
|
|
@@ -39,6 +41,34 @@ const props = {
|
|
|
39
41
|
slots: {
|
|
40
42
|
type: Object,
|
|
41
43
|
default: () => ({})
|
|
44
|
+
},
|
|
45
|
+
/**
|
|
46
|
+
* @description 保留最后一个不被删除
|
|
47
|
+
*/
|
|
48
|
+
keepLast: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: false
|
|
51
|
+
},
|
|
52
|
+
/**
|
|
53
|
+
* @description 开启 form-item 的 label 上的操作区域, 在labelPosition为top时生效
|
|
54
|
+
*/
|
|
55
|
+
labelActions: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: false
|
|
58
|
+
},
|
|
59
|
+
/**
|
|
60
|
+
* @description 添加记录时的默认值
|
|
61
|
+
*/
|
|
62
|
+
defaultItemValue: {
|
|
63
|
+
type: Object,
|
|
64
|
+
default: () => ({})
|
|
65
|
+
},
|
|
66
|
+
/**
|
|
67
|
+
* @description 是否开启顶部的添加按钮
|
|
68
|
+
*/
|
|
69
|
+
topSplicable: {
|
|
70
|
+
type: Boolean,
|
|
71
|
+
default: true
|
|
42
72
|
}
|
|
43
73
|
};
|
|
44
74
|
const emits = {};
|
|
@@ -69,7 +99,11 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
69
99
|
});
|
|
70
100
|
function handlePlus(index) {
|
|
71
101
|
const data = cloneDeep.cloneDeep(props.modelValue);
|
|
72
|
-
data.splice(
|
|
102
|
+
data.splice(
|
|
103
|
+
index + 1,
|
|
104
|
+
0,
|
|
105
|
+
cloneDeep.cloneDeep(props.defaultItemValue)
|
|
106
|
+
);
|
|
73
107
|
emit("update:modelValue", data);
|
|
74
108
|
}
|
|
75
109
|
function handleMinus(index) {
|
|
@@ -77,31 +111,43 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
77
111
|
data.splice(index, 1);
|
|
78
112
|
emit("update:modelValue", data);
|
|
79
113
|
}
|
|
80
|
-
const addToFirst = () => {
|
|
81
|
-
emit("update:modelValue", [
|
|
82
|
-
{},
|
|
83
|
-
...props.modelValue ?? []
|
|
84
|
-
]);
|
|
85
|
-
};
|
|
86
114
|
const handleFormSetData = (e) => {
|
|
87
115
|
const data = cloneDeep.cloneDeep(formData.value);
|
|
88
116
|
core.ensetData(data, e);
|
|
89
117
|
emit("update:modelValue", core.getValue(data, props.prop));
|
|
90
118
|
};
|
|
91
119
|
function createTheFormItems(index) {
|
|
92
|
-
return props.
|
|
93
|
-
|
|
120
|
+
return props.columns.map((formItem) => {
|
|
121
|
+
const parentProp = [
|
|
122
|
+
props.prop ?? [],
|
|
123
|
+
index
|
|
124
|
+
].flat();
|
|
125
|
+
const prop = [parentProp, formItem.prop].flat();
|
|
126
|
+
const formItemProps = {
|
|
94
127
|
readonly: readonly.value,
|
|
95
128
|
...formItem,
|
|
96
|
-
prop
|
|
97
|
-
props.prop ?? [],
|
|
98
|
-
index,
|
|
99
|
-
formItem.prop
|
|
100
|
-
].flat()
|
|
129
|
+
prop
|
|
101
130
|
};
|
|
131
|
+
Reflect.deleteProperty(formItemProps, "createTemplateProps");
|
|
132
|
+
if (_function.isCallable(formItem.templateProps)) {
|
|
133
|
+
formItemProps.templateProps = () => {
|
|
134
|
+
return formItem.templateProps(
|
|
135
|
+
core.getValue(formData.value, parentProp)
|
|
136
|
+
);
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
const extraProps = formItem.createTemplateProps?.(
|
|
140
|
+
{
|
|
141
|
+
$index: index,
|
|
142
|
+
row: core.getValue(formData.value, parentProp)
|
|
143
|
+
},
|
|
144
|
+
formItemProps
|
|
145
|
+
) ?? {};
|
|
146
|
+
Object.assign(formItemProps, extraProps);
|
|
147
|
+
return formItemProps;
|
|
102
148
|
});
|
|
103
149
|
}
|
|
104
|
-
const __returned__ = { props, emit, formItemBindProps, readonly, formData, handlePlus, handleMinus,
|
|
150
|
+
const __returned__ = { props, emit, formItemBindProps, readonly, formData, handlePlus, handleMinus, handleFormSetData, createTheFormItems, get VkfFormItem() {
|
|
105
151
|
return formItem.VkfFormItem;
|
|
106
152
|
}, get ElButton() {
|
|
107
153
|
return elementPlus.ElButton;
|
|
@@ -117,13 +163,18 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
117
163
|
return formItemRenderer.VkfFormItemRenderer;
|
|
118
164
|
}, get VkfRendererData() {
|
|
119
165
|
return rendererData.VkfRendererData;
|
|
166
|
+
}, get Plus() {
|
|
167
|
+
return index.plus_default;
|
|
120
168
|
} };
|
|
121
169
|
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
122
170
|
return __returned__;
|
|
123
171
|
}
|
|
124
172
|
});
|
|
125
173
|
|
|
126
|
-
const _hoisted_1 = {
|
|
174
|
+
const _hoisted_1 = {
|
|
175
|
+
key: 0,
|
|
176
|
+
class: "vkf-card-input-collection-options"
|
|
177
|
+
};
|
|
127
178
|
const _hoisted_2 = { class: "vkf-card-input-collection-card__footer" };
|
|
128
179
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
129
180
|
return vue.openBlock(), vue.createBlock($setup["VkfTemplateInstancesProvider"], null, {
|
|
@@ -139,29 +190,25 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
139
190
|
vue.createVNode(
|
|
140
191
|
$setup["VkfFormItem"],
|
|
141
192
|
vue.mergeProps($setup.formItemBindProps, { class: "vkf-card-input-collection" }),
|
|
142
|
-
{
|
|
193
|
+
vue.createSlots({
|
|
143
194
|
default: vue.withCtx(() => [
|
|
144
|
-
vue.
|
|
145
|
-
vue.
|
|
146
|
-
_ctx.slots.options ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.slots.options), { key: 0 })) : vue.createCommentVNode("v-if", true)
|
|
147
|
-
]),
|
|
148
|
-
!$setup.readonly && _ctx.splicable ? (vue.openBlock(), vue.createBlock($setup["ElButton"], {
|
|
149
|
-
key: 0,
|
|
195
|
+
!$setup.readonly && _ctx.splicable && !_ctx.labelActions && _ctx.topSplicable ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
|
|
196
|
+
vue.createVNode($setup["ElButton"], {
|
|
150
197
|
type: "primary",
|
|
151
|
-
onClick: $setup.
|
|
198
|
+
onClick: _cache[1] || (_cache[1] = ($event) => $setup.handlePlus(-1))
|
|
152
199
|
}, {
|
|
153
|
-
default: vue.withCtx(() => _cache[
|
|
200
|
+
default: vue.withCtx(() => _cache[3] || (_cache[3] = [
|
|
154
201
|
vue.createTextVNode(" \u6DFB\u52A0 ")
|
|
155
202
|
])),
|
|
156
203
|
_: 1,
|
|
157
|
-
__: [
|
|
158
|
-
})
|
|
159
|
-
]),
|
|
204
|
+
__: [3]
|
|
205
|
+
})
|
|
206
|
+
])) : vue.createCommentVNode("v-if", true),
|
|
160
207
|
!_ctx.modelValue?.length ? (vue.openBlock(), vue.createBlock($setup["ElEmpty"], {
|
|
161
|
-
key:
|
|
208
|
+
key: 1,
|
|
162
209
|
class: "vkf-card-input-collection-empty"
|
|
163
210
|
}, {
|
|
164
|
-
image: vue.withCtx(() => _cache[
|
|
211
|
+
image: vue.withCtx(() => _cache[4] || (_cache[4] = [
|
|
165
212
|
vue.createTextVNode(vue.toDisplayString(""))
|
|
166
213
|
])),
|
|
167
214
|
_: 1
|
|
@@ -170,7 +217,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
170
217
|
(vue.openBlock(true), vue.createElementBlock(
|
|
171
218
|
vue.Fragment,
|
|
172
219
|
null,
|
|
173
|
-
vue.renderList(_ctx.modelValue, (
|
|
220
|
+
vue.renderList(_ctx.modelValue, (_, index) => {
|
|
174
221
|
return vue.openBlock(), vue.createBlock(
|
|
175
222
|
$setup["ElCard"],
|
|
176
223
|
{
|
|
@@ -195,22 +242,23 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
195
242
|
type: "primary",
|
|
196
243
|
onClick: () => $setup.handlePlus(index)
|
|
197
244
|
}, {
|
|
198
|
-
default: vue.withCtx(() => [..._cache[
|
|
245
|
+
default: vue.withCtx(() => [..._cache[5] || (_cache[5] = [
|
|
199
246
|
vue.createTextVNode(" \u6DFB\u52A0 ")
|
|
200
247
|
])]),
|
|
201
248
|
_: 2,
|
|
202
|
-
__: [
|
|
249
|
+
__: [5]
|
|
203
250
|
}, 1032, ["onClick"]),
|
|
204
251
|
vue.createVNode($setup["ElButton"], {
|
|
205
252
|
type: "danger",
|
|
253
|
+
disabled: _ctx.modelValue.length <= 1 && $setup.props.keepLast,
|
|
206
254
|
onClick: () => $setup.handleMinus(index)
|
|
207
255
|
}, {
|
|
208
|
-
default: vue.withCtx(() => [..._cache[
|
|
256
|
+
default: vue.withCtx(() => [..._cache[6] || (_cache[6] = [
|
|
209
257
|
vue.createTextVNode(" \u5220\u9664 ")
|
|
210
258
|
])]),
|
|
211
259
|
_: 2,
|
|
212
|
-
__: [
|
|
213
|
-
}, 1032, ["onClick"])
|
|
260
|
+
__: [6]
|
|
261
|
+
}, 1032, ["disabled", "onClick"])
|
|
214
262
|
])
|
|
215
263
|
]),
|
|
216
264
|
key: "0"
|
|
@@ -224,11 +272,31 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
224
272
|
/* KEYED_FRAGMENT */
|
|
225
273
|
))
|
|
226
274
|
]),
|
|
227
|
-
_:
|
|
228
|
-
/*
|
|
229
|
-
},
|
|
230
|
-
|
|
231
|
-
|
|
275
|
+
_: 2
|
|
276
|
+
/* DYNAMIC */
|
|
277
|
+
}, [
|
|
278
|
+
_ctx.labelActions ? {
|
|
279
|
+
name: "labelActions",
|
|
280
|
+
fn: vue.withCtx(() => [
|
|
281
|
+
vue.renderSlot(_ctx.$slots, "labelActions"),
|
|
282
|
+
!$setup.readonly && _ctx.splicable && _ctx.topSplicable ? (vue.openBlock(), vue.createBlock($setup["ElButton"], {
|
|
283
|
+
key: 0,
|
|
284
|
+
size: "small",
|
|
285
|
+
icon: $setup.Plus,
|
|
286
|
+
onClick: _cache[0] || (_cache[0] = ($event) => $setup.handlePlus(-1))
|
|
287
|
+
}, {
|
|
288
|
+
default: vue.withCtx(() => _cache[2] || (_cache[2] = [
|
|
289
|
+
vue.createTextVNode(" \u6DFB\u52A0 ")
|
|
290
|
+
])),
|
|
291
|
+
_: 1,
|
|
292
|
+
__: [2]
|
|
293
|
+
}, 8, ["icon"])) : vue.createCommentVNode("v-if", true)
|
|
294
|
+
]),
|
|
295
|
+
key: "0"
|
|
296
|
+
} : void 0
|
|
297
|
+
]),
|
|
298
|
+
1040
|
|
299
|
+
/* FULL_PROPS, DYNAMIC_SLOTS */
|
|
232
300
|
)
|
|
233
301
|
]),
|
|
234
302
|
_: 3
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, computed, openBlock, createBlock, withCtx, createVNode, mergeProps,
|
|
1
|
+
import { defineComponent, computed, openBlock, createBlock, withCtx, createVNode, mergeProps, createSlots, createElementBlock, createTextVNode, createCommentVNode, toDisplayString, Fragment, renderList, createElementVNode, renderSlot } from 'vue';
|
|
2
2
|
import { _VkfFormItemCtx, VkfFormItem } from '@vunk/form/components/form-item';
|
|
3
3
|
import { useComputedReadonly } from '@vunk/form/composables';
|
|
4
4
|
import { ElButton, ElCard, ElEmpty } from 'element-plus';
|
|
@@ -7,13 +7,15 @@ import { VkfTemplatesDefault } from '@vunk/form/components/templates-default';
|
|
|
7
7
|
import { VkfTemplateInstancesProvider } from '@vunk/form/components/template-instances-provider';
|
|
8
8
|
import { VkfFormItemRenderer } from '@vunk/form/components/form-item-renderer';
|
|
9
9
|
import { VkfRendererData } from '@vunk/form/components/renderer-data';
|
|
10
|
+
import { isCallable } from '@vunk/shared/function';
|
|
11
|
+
import { p as plus_default } from '../index.mjs';
|
|
10
12
|
import { c as cloneDeep } from '../cloneDeep.mjs';
|
|
11
13
|
import { _ as _export_sfc } from '../_plugin-vue_export-helper.mjs';
|
|
12
14
|
import '../isObject.mjs';
|
|
13
15
|
|
|
14
16
|
const props = {
|
|
15
17
|
..._VkfFormItemCtx.props,
|
|
16
|
-
|
|
18
|
+
columns: {
|
|
17
19
|
type: Array,
|
|
18
20
|
default: () => []
|
|
19
21
|
},
|
|
@@ -26,7 +28,7 @@ const props = {
|
|
|
26
28
|
default: void 0
|
|
27
29
|
},
|
|
28
30
|
/**
|
|
29
|
-
* @description
|
|
31
|
+
* @description 是否可以添加或删除
|
|
30
32
|
*/
|
|
31
33
|
splicable: {
|
|
32
34
|
type: Boolean,
|
|
@@ -35,6 +37,34 @@ const props = {
|
|
|
35
37
|
slots: {
|
|
36
38
|
type: Object,
|
|
37
39
|
default: () => ({})
|
|
40
|
+
},
|
|
41
|
+
/**
|
|
42
|
+
* @description 保留最后一个不被删除
|
|
43
|
+
*/
|
|
44
|
+
keepLast: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: false
|
|
47
|
+
},
|
|
48
|
+
/**
|
|
49
|
+
* @description 开启 form-item 的 label 上的操作区域, 在labelPosition为top时生效
|
|
50
|
+
*/
|
|
51
|
+
labelActions: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: false
|
|
54
|
+
},
|
|
55
|
+
/**
|
|
56
|
+
* @description 添加记录时的默认值
|
|
57
|
+
*/
|
|
58
|
+
defaultItemValue: {
|
|
59
|
+
type: Object,
|
|
60
|
+
default: () => ({})
|
|
61
|
+
},
|
|
62
|
+
/**
|
|
63
|
+
* @description 是否开启顶部的添加按钮
|
|
64
|
+
*/
|
|
65
|
+
topSplicable: {
|
|
66
|
+
type: Boolean,
|
|
67
|
+
default: true
|
|
38
68
|
}
|
|
39
69
|
};
|
|
40
70
|
const emits = {};
|
|
@@ -65,7 +95,11 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
65
95
|
});
|
|
66
96
|
function handlePlus(index) {
|
|
67
97
|
const data = cloneDeep(props.modelValue);
|
|
68
|
-
data.splice(
|
|
98
|
+
data.splice(
|
|
99
|
+
index + 1,
|
|
100
|
+
0,
|
|
101
|
+
cloneDeep(props.defaultItemValue)
|
|
102
|
+
);
|
|
69
103
|
emit("update:modelValue", data);
|
|
70
104
|
}
|
|
71
105
|
function handleMinus(index) {
|
|
@@ -73,31 +107,43 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
73
107
|
data.splice(index, 1);
|
|
74
108
|
emit("update:modelValue", data);
|
|
75
109
|
}
|
|
76
|
-
const addToFirst = () => {
|
|
77
|
-
emit("update:modelValue", [
|
|
78
|
-
{},
|
|
79
|
-
...props.modelValue ?? []
|
|
80
|
-
]);
|
|
81
|
-
};
|
|
82
110
|
const handleFormSetData = (e) => {
|
|
83
111
|
const data = cloneDeep(formData.value);
|
|
84
112
|
ensetData(data, e);
|
|
85
113
|
emit("update:modelValue", getValue(data, props.prop));
|
|
86
114
|
};
|
|
87
115
|
function createTheFormItems(index) {
|
|
88
|
-
return props.
|
|
89
|
-
|
|
116
|
+
return props.columns.map((formItem) => {
|
|
117
|
+
const parentProp = [
|
|
118
|
+
props.prop ?? [],
|
|
119
|
+
index
|
|
120
|
+
].flat();
|
|
121
|
+
const prop = [parentProp, formItem.prop].flat();
|
|
122
|
+
const formItemProps = {
|
|
90
123
|
readonly: readonly.value,
|
|
91
124
|
...formItem,
|
|
92
|
-
prop
|
|
93
|
-
props.prop ?? [],
|
|
94
|
-
index,
|
|
95
|
-
formItem.prop
|
|
96
|
-
].flat()
|
|
125
|
+
prop
|
|
97
126
|
};
|
|
127
|
+
Reflect.deleteProperty(formItemProps, "createTemplateProps");
|
|
128
|
+
if (isCallable(formItem.templateProps)) {
|
|
129
|
+
formItemProps.templateProps = () => {
|
|
130
|
+
return formItem.templateProps(
|
|
131
|
+
getValue(formData.value, parentProp)
|
|
132
|
+
);
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
const extraProps = formItem.createTemplateProps?.(
|
|
136
|
+
{
|
|
137
|
+
$index: index,
|
|
138
|
+
row: getValue(formData.value, parentProp)
|
|
139
|
+
},
|
|
140
|
+
formItemProps
|
|
141
|
+
) ?? {};
|
|
142
|
+
Object.assign(formItemProps, extraProps);
|
|
143
|
+
return formItemProps;
|
|
98
144
|
});
|
|
99
145
|
}
|
|
100
|
-
const __returned__ = { props, emit, formItemBindProps, readonly, formData, handlePlus, handleMinus,
|
|
146
|
+
const __returned__ = { props, emit, formItemBindProps, readonly, formData, handlePlus, handleMinus, handleFormSetData, createTheFormItems, get VkfFormItem() {
|
|
101
147
|
return VkfFormItem;
|
|
102
148
|
}, get ElButton() {
|
|
103
149
|
return ElButton;
|
|
@@ -113,13 +159,18 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
113
159
|
return VkfFormItemRenderer;
|
|
114
160
|
}, get VkfRendererData() {
|
|
115
161
|
return VkfRendererData;
|
|
162
|
+
}, get Plus() {
|
|
163
|
+
return plus_default;
|
|
116
164
|
} };
|
|
117
165
|
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
118
166
|
return __returned__;
|
|
119
167
|
}
|
|
120
168
|
});
|
|
121
169
|
|
|
122
|
-
const _hoisted_1 = {
|
|
170
|
+
const _hoisted_1 = {
|
|
171
|
+
key: 0,
|
|
172
|
+
class: "vkf-card-input-collection-options"
|
|
173
|
+
};
|
|
123
174
|
const _hoisted_2 = { class: "vkf-card-input-collection-card__footer" };
|
|
124
175
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
125
176
|
return openBlock(), createBlock($setup["VkfTemplateInstancesProvider"], null, {
|
|
@@ -135,29 +186,25 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
135
186
|
createVNode(
|
|
136
187
|
$setup["VkfFormItem"],
|
|
137
188
|
mergeProps($setup.formItemBindProps, { class: "vkf-card-input-collection" }),
|
|
138
|
-
{
|
|
189
|
+
createSlots({
|
|
139
190
|
default: withCtx(() => [
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
_ctx.slots.options ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.slots.options), { key: 0 })) : createCommentVNode("v-if", true)
|
|
143
|
-
]),
|
|
144
|
-
!$setup.readonly && _ctx.splicable ? (openBlock(), createBlock($setup["ElButton"], {
|
|
145
|
-
key: 0,
|
|
191
|
+
!$setup.readonly && _ctx.splicable && !_ctx.labelActions && _ctx.topSplicable ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
192
|
+
createVNode($setup["ElButton"], {
|
|
146
193
|
type: "primary",
|
|
147
|
-
onClick: $setup.
|
|
194
|
+
onClick: _cache[1] || (_cache[1] = ($event) => $setup.handlePlus(-1))
|
|
148
195
|
}, {
|
|
149
|
-
default: withCtx(() => _cache[
|
|
196
|
+
default: withCtx(() => _cache[3] || (_cache[3] = [
|
|
150
197
|
createTextVNode(" \u6DFB\u52A0 ")
|
|
151
198
|
])),
|
|
152
199
|
_: 1,
|
|
153
|
-
__: [
|
|
154
|
-
})
|
|
155
|
-
]),
|
|
200
|
+
__: [3]
|
|
201
|
+
})
|
|
202
|
+
])) : createCommentVNode("v-if", true),
|
|
156
203
|
!_ctx.modelValue?.length ? (openBlock(), createBlock($setup["ElEmpty"], {
|
|
157
|
-
key:
|
|
204
|
+
key: 1,
|
|
158
205
|
class: "vkf-card-input-collection-empty"
|
|
159
206
|
}, {
|
|
160
|
-
image: withCtx(() => _cache[
|
|
207
|
+
image: withCtx(() => _cache[4] || (_cache[4] = [
|
|
161
208
|
createTextVNode(toDisplayString(""))
|
|
162
209
|
])),
|
|
163
210
|
_: 1
|
|
@@ -166,7 +213,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
166
213
|
(openBlock(true), createElementBlock(
|
|
167
214
|
Fragment,
|
|
168
215
|
null,
|
|
169
|
-
renderList(_ctx.modelValue, (
|
|
216
|
+
renderList(_ctx.modelValue, (_, index) => {
|
|
170
217
|
return openBlock(), createBlock(
|
|
171
218
|
$setup["ElCard"],
|
|
172
219
|
{
|
|
@@ -191,22 +238,23 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
191
238
|
type: "primary",
|
|
192
239
|
onClick: () => $setup.handlePlus(index)
|
|
193
240
|
}, {
|
|
194
|
-
default: withCtx(() => [..._cache[
|
|
241
|
+
default: withCtx(() => [..._cache[5] || (_cache[5] = [
|
|
195
242
|
createTextVNode(" \u6DFB\u52A0 ")
|
|
196
243
|
])]),
|
|
197
244
|
_: 2,
|
|
198
|
-
__: [
|
|
245
|
+
__: [5]
|
|
199
246
|
}, 1032, ["onClick"]),
|
|
200
247
|
createVNode($setup["ElButton"], {
|
|
201
248
|
type: "danger",
|
|
249
|
+
disabled: _ctx.modelValue.length <= 1 && $setup.props.keepLast,
|
|
202
250
|
onClick: () => $setup.handleMinus(index)
|
|
203
251
|
}, {
|
|
204
|
-
default: withCtx(() => [..._cache[
|
|
252
|
+
default: withCtx(() => [..._cache[6] || (_cache[6] = [
|
|
205
253
|
createTextVNode(" \u5220\u9664 ")
|
|
206
254
|
])]),
|
|
207
255
|
_: 2,
|
|
208
|
-
__: [
|
|
209
|
-
}, 1032, ["onClick"])
|
|
256
|
+
__: [6]
|
|
257
|
+
}, 1032, ["disabled", "onClick"])
|
|
210
258
|
])
|
|
211
259
|
]),
|
|
212
260
|
key: "0"
|
|
@@ -220,11 +268,31 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
220
268
|
/* KEYED_FRAGMENT */
|
|
221
269
|
))
|
|
222
270
|
]),
|
|
223
|
-
_:
|
|
224
|
-
/*
|
|
225
|
-
},
|
|
226
|
-
|
|
227
|
-
|
|
271
|
+
_: 2
|
|
272
|
+
/* DYNAMIC */
|
|
273
|
+
}, [
|
|
274
|
+
_ctx.labelActions ? {
|
|
275
|
+
name: "labelActions",
|
|
276
|
+
fn: withCtx(() => [
|
|
277
|
+
renderSlot(_ctx.$slots, "labelActions"),
|
|
278
|
+
!$setup.readonly && _ctx.splicable && _ctx.topSplicable ? (openBlock(), createBlock($setup["ElButton"], {
|
|
279
|
+
key: 0,
|
|
280
|
+
size: "small",
|
|
281
|
+
icon: $setup.Plus,
|
|
282
|
+
onClick: _cache[0] || (_cache[0] = ($event) => $setup.handlePlus(-1))
|
|
283
|
+
}, {
|
|
284
|
+
default: withCtx(() => _cache[2] || (_cache[2] = [
|
|
285
|
+
createTextVNode(" \u6DFB\u52A0 ")
|
|
286
|
+
])),
|
|
287
|
+
_: 1,
|
|
288
|
+
__: [2]
|
|
289
|
+
}, 8, ["icon"])) : createCommentVNode("v-if", true)
|
|
290
|
+
]),
|
|
291
|
+
key: "0"
|
|
292
|
+
} : void 0
|
|
293
|
+
]),
|
|
294
|
+
1040
|
|
295
|
+
/* FULL_PROPS, DYNAMIC_SLOTS */
|
|
228
296
|
)
|
|
229
297
|
]),
|
|
230
298
|
_: 3
|
|
@@ -2,7 +2,7 @@ import { PropType } from 'vue';
|
|
|
2
2
|
import { NormalObject } from '@vunk/shared';
|
|
3
3
|
import { Slots } from './types';
|
|
4
4
|
export declare const props: {
|
|
5
|
-
|
|
5
|
+
columns: {
|
|
6
6
|
type: PropType<any[]>;
|
|
7
7
|
default: () => any[];
|
|
8
8
|
};
|
|
@@ -15,7 +15,7 @@ export declare const props: {
|
|
|
15
15
|
default: any;
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
|
-
* @description
|
|
18
|
+
* @description 是否可以添加或删除
|
|
19
19
|
*/
|
|
20
20
|
splicable: {
|
|
21
21
|
type: BooleanConstructor;
|
|
@@ -25,6 +25,34 @@ export declare const props: {
|
|
|
25
25
|
type: PropType<Slots>;
|
|
26
26
|
default: () => {};
|
|
27
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* @description 保留最后一个不被删除
|
|
30
|
+
*/
|
|
31
|
+
keepLast: {
|
|
32
|
+
type: BooleanConstructor;
|
|
33
|
+
default: boolean;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* @description 开启 form-item 的 label 上的操作区域, 在labelPosition为top时生效
|
|
37
|
+
*/
|
|
38
|
+
labelActions: {
|
|
39
|
+
type: BooleanConstructor;
|
|
40
|
+
default: boolean;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* @description 添加记录时的默认值
|
|
44
|
+
*/
|
|
45
|
+
defaultItemValue: {
|
|
46
|
+
type: PropType<NormalObject>;
|
|
47
|
+
default: () => {};
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* @description 是否开启顶部的添加按钮
|
|
51
|
+
*/
|
|
52
|
+
topSplicable: {
|
|
53
|
+
type: BooleanConstructor;
|
|
54
|
+
default: boolean;
|
|
55
|
+
};
|
|
28
56
|
required: {
|
|
29
57
|
readonly type: PropType<boolean>;
|
|
30
58
|
readonly required: false;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NormalObject } from '@vunk/shared';
|
|
2
2
|
import { SetDataEvent } from '@vunk/core';
|
|
3
3
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
-
|
|
4
|
+
columns: {
|
|
5
5
|
type: import("vue").PropType<any[]>;
|
|
6
6
|
default: () => any[];
|
|
7
7
|
};
|
|
@@ -21,6 +21,22 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
21
21
|
type: import("vue").PropType<import("./types").Slots>;
|
|
22
22
|
default: () => {};
|
|
23
23
|
};
|
|
24
|
+
keepLast: {
|
|
25
|
+
type: BooleanConstructor;
|
|
26
|
+
default: boolean;
|
|
27
|
+
};
|
|
28
|
+
labelActions: {
|
|
29
|
+
type: BooleanConstructor;
|
|
30
|
+
default: boolean;
|
|
31
|
+
};
|
|
32
|
+
defaultItemValue: {
|
|
33
|
+
type: import("vue").PropType<NormalObject>;
|
|
34
|
+
default: () => {};
|
|
35
|
+
};
|
|
36
|
+
topSplicable: {
|
|
37
|
+
type: BooleanConstructor;
|
|
38
|
+
default: boolean;
|
|
39
|
+
};
|
|
24
40
|
required: {
|
|
25
41
|
readonly type: import("vue").PropType<boolean>;
|
|
26
42
|
readonly required: false;
|
|
@@ -108,7 +124,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
108
124
|
};
|
|
109
125
|
}>, {
|
|
110
126
|
props: import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
|
111
|
-
|
|
127
|
+
columns: {
|
|
112
128
|
type: import("vue").PropType<any[]>;
|
|
113
129
|
default: () => any[];
|
|
114
130
|
};
|
|
@@ -128,6 +144,22 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
128
144
|
type: import("vue").PropType<import("./types").Slots>;
|
|
129
145
|
default: () => {};
|
|
130
146
|
};
|
|
147
|
+
keepLast: {
|
|
148
|
+
type: BooleanConstructor;
|
|
149
|
+
default: boolean;
|
|
150
|
+
};
|
|
151
|
+
labelActions: {
|
|
152
|
+
type: BooleanConstructor;
|
|
153
|
+
default: boolean;
|
|
154
|
+
};
|
|
155
|
+
defaultItemValue: {
|
|
156
|
+
type: import("vue").PropType<NormalObject>;
|
|
157
|
+
default: () => {};
|
|
158
|
+
};
|
|
159
|
+
topSplicable: {
|
|
160
|
+
type: BooleanConstructor;
|
|
161
|
+
default: boolean;
|
|
162
|
+
};
|
|
131
163
|
required: {
|
|
132
164
|
readonly type: import("vue").PropType<boolean>;
|
|
133
165
|
readonly required: false;
|
|
@@ -220,7 +252,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
220
252
|
formData: import("vue").ComputedRef<NormalObject | NormalObject[]>;
|
|
221
253
|
handlePlus: (index: number) => void;
|
|
222
254
|
handleMinus: (index: number) => void;
|
|
223
|
-
addToFirst: () => void;
|
|
224
255
|
handleFormSetData: (e: SetDataEvent) => void;
|
|
225
256
|
createTheFormItems: (index: number) => any[];
|
|
226
257
|
readonly VkfFormItem: {
|
|
@@ -900,8 +931,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
900
931
|
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & {
|
|
901
932
|
install(app: import("vue").App): void;
|
|
902
933
|
};
|
|
934
|
+
readonly Plus: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
903
935
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
904
|
-
|
|
936
|
+
columns: {
|
|
905
937
|
type: import("vue").PropType<any[]>;
|
|
906
938
|
default: () => any[];
|
|
907
939
|
};
|
|
@@ -921,6 +953,22 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
921
953
|
type: import("vue").PropType<import("./types").Slots>;
|
|
922
954
|
default: () => {};
|
|
923
955
|
};
|
|
956
|
+
keepLast: {
|
|
957
|
+
type: BooleanConstructor;
|
|
958
|
+
default: boolean;
|
|
959
|
+
};
|
|
960
|
+
labelActions: {
|
|
961
|
+
type: BooleanConstructor;
|
|
962
|
+
default: boolean;
|
|
963
|
+
};
|
|
964
|
+
defaultItemValue: {
|
|
965
|
+
type: import("vue").PropType<NormalObject>;
|
|
966
|
+
default: () => {};
|
|
967
|
+
};
|
|
968
|
+
topSplicable: {
|
|
969
|
+
type: BooleanConstructor;
|
|
970
|
+
default: boolean;
|
|
971
|
+
};
|
|
924
972
|
required: {
|
|
925
973
|
readonly type: import("vue").PropType<boolean>;
|
|
926
974
|
readonly required: false;
|
|
@@ -1023,7 +1071,11 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
1023
1071
|
showMessage: boolean;
|
|
1024
1072
|
slots: import("./types").Slots;
|
|
1025
1073
|
modelValue: NormalObject[];
|
|
1026
|
-
|
|
1074
|
+
columns: any[];
|
|
1075
|
+
labelActions: boolean;
|
|
1027
1076
|
splicable: boolean;
|
|
1077
|
+
keepLast: boolean;
|
|
1078
|
+
defaultItemValue: NormalObject;
|
|
1079
|
+
topSplicable: boolean;
|
|
1028
1080
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
1029
1081
|
export default _default;
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import { AnyFunc, VueComponentPropsType } from '@vunk/shared';
|
|
1
|
+
import { AnyFunc, Keyof, NormalObject, VueComponentPropsType } from '@vunk/shared';
|
|
2
2
|
import Core from './index.vue';
|
|
3
3
|
import { BasicSource } from '@vunk/form/shared';
|
|
4
|
+
import { __VkfTemplatesDefault } from '@vunk/form';
|
|
4
5
|
export interface Source<P = string> extends VueComponentPropsType<typeof Core>, BasicSource {
|
|
5
6
|
prop?: P;
|
|
6
7
|
templateType: 'VkfCardInputCollection';
|
|
7
8
|
}
|
|
9
|
+
export type Column<R extends NormalObject = NormalObject, SourceType extends NormalObject = __VkfTemplatesDefault.CoreSource<Keyof<R>>> = SourceType & {
|
|
10
|
+
createTemplateProps?: (columnSlotEvent: {
|
|
11
|
+
row: R;
|
|
12
|
+
$index: number;
|
|
13
|
+
}, formItemProps: SourceType) => Partial<SourceType>;
|
|
14
|
+
};
|
|
8
15
|
export interface Slots {
|
|
9
16
|
options: AnyFunc;
|
|
10
17
|
}
|
|
@@ -859,8 +859,8 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
859
859
|
labelActions: boolean;
|
|
860
860
|
defaultModelValue: any[];
|
|
861
861
|
splicable: boolean;
|
|
862
|
-
source: Record<string, any>;
|
|
863
862
|
defaultItemValue: any;
|
|
863
|
+
source: Record<string, any>;
|
|
864
864
|
keepLastRow: boolean;
|
|
865
865
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
866
866
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -848,8 +848,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
848
848
|
labelActions: boolean;
|
|
849
849
|
defaultModelValue: any[];
|
|
850
850
|
splicable: boolean;
|
|
851
|
-
source: Record<string, any>;
|
|
852
851
|
defaultItemValue: any;
|
|
852
|
+
source: Record<string, any>;
|
|
853
853
|
keepLastRow: boolean;
|
|
854
854
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
855
855
|
export default _default;
|
|
@@ -350,6 +350,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
350
350
|
!$setup.readonly && _ctx.splicable && _ctx.labelActions ? {
|
|
351
351
|
name: "labelActions",
|
|
352
352
|
fn: vue.withCtx(() => [
|
|
353
|
+
vue.renderSlot(_ctx.$slots, "labelActions"),
|
|
353
354
|
vue.createVNode($setup["ElButton"], {
|
|
354
355
|
size: "small",
|
|
355
356
|
icon: $setup.Plus,
|
|
@@ -369,8 +370,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
369
370
|
/* FULL_PROPS, DYNAMIC_SLOTS */
|
|
370
371
|
)
|
|
371
372
|
]),
|
|
372
|
-
_:
|
|
373
|
-
/*
|
|
373
|
+
_: 3
|
|
374
|
+
/* FORWARDED */
|
|
374
375
|
}, 8, ["data"]),
|
|
375
376
|
vue.renderSlot(_ctx.$slots, "default")
|
|
376
377
|
]),
|
|
@@ -346,6 +346,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
346
346
|
!$setup.readonly && _ctx.splicable && _ctx.labelActions ? {
|
|
347
347
|
name: "labelActions",
|
|
348
348
|
fn: withCtx(() => [
|
|
349
|
+
renderSlot(_ctx.$slots, "labelActions"),
|
|
349
350
|
createVNode($setup["ElButton"], {
|
|
350
351
|
size: "small",
|
|
351
352
|
icon: $setup.Plus,
|
|
@@ -365,8 +366,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
365
366
|
/* FULL_PROPS, DYNAMIC_SLOTS */
|
|
366
367
|
)
|
|
367
368
|
]),
|
|
368
|
-
_:
|
|
369
|
-
/*
|
|
369
|
+
_: 3
|
|
370
|
+
/* FORWARDED */
|
|
370
371
|
}, 8, ["data"]),
|
|
371
372
|
renderSlot(_ctx.$slots, "default")
|
|
372
373
|
]),
|