@vunk/form 2.11.0 → 2.12.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/button/src/ctx.d.ts +1 -1
- package/components/button/src/index.vue.d.ts +15 -15
- package/components/card-input-collection/src/index.vue.d.ts +12 -12
- package/components/cascader/src/ctx.d.ts +4 -11
- package/components/cascader/src/index.vue.d.ts +10 -24
- package/components/checkbox/src/index.vue.d.ts +27 -27
- package/components/cloneDeep.cjs +269 -37
- package/components/cloneDeep.mjs +269 -37
- package/components/color-picker/src/ctx.d.ts +17 -1
- package/components/color-picker/src/index.vue.d.ts +36 -2
- package/components/date-picker/src/ctx.d.ts +2 -1
- package/components/date-picker/src/index.vue.d.ts +10 -0
- package/components/date-picker-range/src/ctx.d.ts +1 -0
- package/components/date-picker-range/src/index.vue.d.ts +3 -0
- package/components/dialog-input-collection/index.cjs +560 -0
- package/components/dialog-input-collection/index.css +21 -0
- package/components/dialog-input-collection/index.d.ts +4 -0
- package/components/dialog-input-collection/index.mjs +554 -0
- package/components/dialog-input-collection/src/ctx.d.ts +142 -0
- package/components/dialog-input-collection/src/dialog-form.vue.d.ts +647 -0
- package/components/dialog-input-collection/src/index.vue.d.ts +1972 -0
- package/components/dialog-input-collection/src/layout.vue.d.ts +85 -0
- package/components/dialog-input-collection/src/types.d.ts +28 -0
- package/components/download-plus/index.cjs +2 -2
- package/components/download-plus/index.mjs +2 -2
- package/components/download-plus/src/index.vue.d.ts +48 -18
- package/components/editable-text/index.cjs +1 -1
- package/components/editable-text/index.mjs +1 -1
- package/components/editable-text/src/index.vue.d.ts +6 -6
- package/components/esri-input-geojson/index.cjs +1 -1
- package/components/esri-input-geojson/index.mjs +1 -1
- package/components/esri-input-geojson/src/append.vue.d.ts +21 -21
- package/components/esri-input-geojson/src/ctx.d.ts +10 -1
- package/components/esri-input-geojson/src/index.vue.d.ts +21 -0
- package/components/form/src/index.vue.d.ts +8 -2853
- package/components/form-item/index.cjs +1 -1
- package/components/form-item/index.mjs +1 -1
- package/components/form-item/src/index.vue.d.ts +15 -15
- package/components/index.cjs +397 -11
- package/components/index.mjs +378 -11
- package/components/index2.cjs +11 -397
- package/components/index2.mjs +11 -378
- package/components/information/index.cjs +3 -4
- package/components/information/index.mjs +3 -4
- package/components/information-collection/index.cjs +2 -2
- package/components/information-collection/index.mjs +2 -2
- package/components/information-collection/src/ctx.d.ts +2 -2
- package/components/information-collection/src/index.vue.d.ts +4 -4
- package/components/information-renderer/index.cjs +16 -0
- package/components/information-renderer/index.d.ts +73 -0
- package/components/information-renderer/index.mjs +10 -0
- package/components/information-tag/src/ctx.d.ts +1 -1
- package/components/information-tag/src/index.vue.d.ts +3 -3
- package/components/information-templates-default/index.cjs +25 -7
- package/components/information-templates-default/index.mjs +25 -7
- package/components/input/src/ctx.d.ts +10 -1
- package/components/input/src/index.vue.d.ts +51 -0
- package/components/input-collection/index.cjs +12 -1
- package/components/input-collection/index.mjs +12 -1
- package/components/input-collection/src/index.vue.d.ts +12 -12
- package/components/input-collection/src/types.d.ts +2 -2
- package/components/input-link/index.cjs +1 -1
- package/components/input-link/index.mjs +1 -1
- package/components/input-link/src/ctx.d.ts +9 -0
- package/components/input-link/src/index.vue.d.ts +19 -0
- package/components/input-number/src/ctx.d.ts +9 -1
- package/components/input-number/src/index.vue.d.ts +45 -0
- package/components/input-tag/src/ctx.d.ts +3 -10
- package/components/input-tag/src/index.vue.d.ts +25 -60
- package/components/select/src/ctx.d.ts +1 -1
- package/components/select/src/index.vue.d.ts +4 -4
- package/components/templates-element-plus/src/index.vue.d.ts +6 -6
- package/components/upload/index.cjs +1 -1
- package/components/upload/index.mjs +1 -1
- package/components/upload/src/index.vue.d.ts +9 -9
- package/components/upload-plus/index.cjs +2 -2
- package/components/upload-plus/index.mjs +2 -2
- package/components/upload-plus/src/index.vue.d.ts +49 -19
- package/components/van-cascader/src/ctx.d.ts +4 -11
- package/components/van-cascader/src/index.vue.d.ts +27 -41
- package/components/var-datetime-picker/src/index.vue.d.ts +15 -3
- package/components/vditor/src/index.vue.d.ts +1 -1
- package/index.css +22 -0
- package/package.json +14 -1
- package/shared/element-plus/ctx.d.ts +4 -4
- package/shared/element-plus/instances.d.ts +2 -1
|
@@ -0,0 +1,560 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var vue = require('vue');
|
|
6
|
+
var index = require('../index.cjs');
|
|
7
|
+
var core = require('@vunk/core');
|
|
8
|
+
var formItem = require('@vunk/form/components/form-item');
|
|
9
|
+
var informationRenderer = require('@vunk/form/components/information-renderer');
|
|
10
|
+
var composables = require('@vunk/form/composables');
|
|
11
|
+
var tableColumns = require('@vunk/plus/components/table-columns');
|
|
12
|
+
var elementPlus = require('element-plus');
|
|
13
|
+
var rendererData = require('@vunk/form/components/renderer-data');
|
|
14
|
+
var templateInstancesProvider = require('@vunk/form/components/template-instances-provider');
|
|
15
|
+
var informationTemplatesDefault = require('@vunk/form/components/information-templates-default');
|
|
16
|
+
var templatesDefault = require('@vunk/form/components/templates-default');
|
|
17
|
+
var _pluginVue_exportHelper = require('../_plugin-vue_export-helper.cjs');
|
|
18
|
+
var _enum = require('@vunk/shared/enum');
|
|
19
|
+
var avatar = require('@vunk/plus/components/avatar');
|
|
20
|
+
var form = require('@vunk/form/components/form');
|
|
21
|
+
var _function = require('@vunk/shared/function');
|
|
22
|
+
var cloneDeep = require('../cloneDeep.cjs');
|
|
23
|
+
require('../isObject.cjs');
|
|
24
|
+
|
|
25
|
+
const props = {
|
|
26
|
+
...formItem._VkfFormItemCtx.props,
|
|
27
|
+
columns: {
|
|
28
|
+
type: Array,
|
|
29
|
+
default: () => []
|
|
30
|
+
},
|
|
31
|
+
/**
|
|
32
|
+
* @description 表格数据 v-model
|
|
33
|
+
*/
|
|
34
|
+
modelValue: {
|
|
35
|
+
type: Array,
|
|
36
|
+
default: () => []
|
|
37
|
+
},
|
|
38
|
+
readonly: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: void 0
|
|
41
|
+
},
|
|
42
|
+
/**
|
|
43
|
+
* @description 是否可以splice
|
|
44
|
+
*/
|
|
45
|
+
splicable: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: true
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
* @description 开启 form-item 的 label 上的操作区域, 在labelPosition为top时生效
|
|
51
|
+
*/
|
|
52
|
+
labelActions: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: false
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* @description 添加记录时的默认值
|
|
58
|
+
*/
|
|
59
|
+
defaultItemValue: {
|
|
60
|
+
type: Object,
|
|
61
|
+
default: () => ({})
|
|
62
|
+
},
|
|
63
|
+
dialogFormProps: {
|
|
64
|
+
type: Object,
|
|
65
|
+
default: () => ({})
|
|
66
|
+
},
|
|
67
|
+
modules: {
|
|
68
|
+
type: Array,
|
|
69
|
+
default: () => ["operations:add"]
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const emits = {
|
|
73
|
+
"update:modelValue": null
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
var _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
77
|
+
__name: "layout",
|
|
78
|
+
props: {
|
|
79
|
+
data: {
|
|
80
|
+
type: Object,
|
|
81
|
+
default: () => ({})
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
emits: ["setData"],
|
|
85
|
+
setup(__props, { expose: __expose }) {
|
|
86
|
+
__expose();
|
|
87
|
+
const __returned__ = { get VkfRendererData() {
|
|
88
|
+
return rendererData.VkfRendererData;
|
|
89
|
+
}, get VkfTemplateInstancesProvider() {
|
|
90
|
+
return templateInstancesProvider.VkfTemplateInstancesProvider;
|
|
91
|
+
}, get VkfInformationTemplates() {
|
|
92
|
+
return informationRenderer.VkfInformationTemplates;
|
|
93
|
+
}, get VkfInformationData() {
|
|
94
|
+
return informationRenderer.VkfInformationData;
|
|
95
|
+
}, get VkfInformationTemplatesDefault() {
|
|
96
|
+
return informationTemplatesDefault.VkfInformationTemplatesDefault;
|
|
97
|
+
}, get VkfTemplatesDefault() {
|
|
98
|
+
return templatesDefault.VkfTemplatesDefault;
|
|
99
|
+
} };
|
|
100
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
101
|
+
return __returned__;
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
106
|
+
return vue.openBlock(), vue.createBlock($setup["VkfTemplateInstancesProvider"], null, {
|
|
107
|
+
placeholder: vue.withCtx(() => [
|
|
108
|
+
vue.createVNode($setup["VkfTemplatesDefault"])
|
|
109
|
+
]),
|
|
110
|
+
default: vue.withCtx(() => [
|
|
111
|
+
vue.createVNode($setup["VkfInformationTemplates"], null, {
|
|
112
|
+
placeholder: vue.withCtx(() => [
|
|
113
|
+
vue.createVNode($setup["VkfInformationTemplatesDefault"])
|
|
114
|
+
]),
|
|
115
|
+
default: vue.withCtx(() => [
|
|
116
|
+
vue.createVNode($setup["VkfRendererData"], {
|
|
117
|
+
data: $props.data,
|
|
118
|
+
onSetData: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("setData", $event))
|
|
119
|
+
}, {
|
|
120
|
+
default: vue.withCtx(() => [
|
|
121
|
+
vue.createVNode($setup["VkfInformationData"], {
|
|
122
|
+
data: $props.data,
|
|
123
|
+
onSetData: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("setData", $event))
|
|
124
|
+
}, {
|
|
125
|
+
default: vue.withCtx(() => [
|
|
126
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
127
|
+
]),
|
|
128
|
+
_: 3
|
|
129
|
+
/* FORWARDED */
|
|
130
|
+
}, 8, ["data"])
|
|
131
|
+
]),
|
|
132
|
+
_: 3
|
|
133
|
+
/* FORWARDED */
|
|
134
|
+
}, 8, ["data"])
|
|
135
|
+
]),
|
|
136
|
+
_: 3
|
|
137
|
+
/* FORWARDED */
|
|
138
|
+
})
|
|
139
|
+
]),
|
|
140
|
+
_: 3
|
|
141
|
+
/* FORWARDED */
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
var TemplatesLayout = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/dialog-input-collection/src/layout.vue"]]);
|
|
145
|
+
|
|
146
|
+
var _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
147
|
+
__name: "dialog-form",
|
|
148
|
+
props: {
|
|
149
|
+
title: {
|
|
150
|
+
type: String,
|
|
151
|
+
default: ""
|
|
152
|
+
},
|
|
153
|
+
modelValue: {
|
|
154
|
+
type: Object,
|
|
155
|
+
default: () => ({})
|
|
156
|
+
},
|
|
157
|
+
openReset: {
|
|
158
|
+
type: Boolean,
|
|
159
|
+
default: true
|
|
160
|
+
},
|
|
161
|
+
visible: {
|
|
162
|
+
type: Boolean,
|
|
163
|
+
default: false
|
|
164
|
+
},
|
|
165
|
+
formItems: {
|
|
166
|
+
type: Array,
|
|
167
|
+
default: () => []
|
|
168
|
+
},
|
|
169
|
+
dialogFormProps: {
|
|
170
|
+
type: Object,
|
|
171
|
+
default: () => ({})
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
emits: ["update:modelValue", "update:visible", "change"],
|
|
175
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
176
|
+
__expose();
|
|
177
|
+
const props = __props;
|
|
178
|
+
const emit = __emit;
|
|
179
|
+
const formData = vue.ref(props.modelValue);
|
|
180
|
+
vue.watch(() => props.visible, (v) => {
|
|
181
|
+
if (props.openReset && v) {
|
|
182
|
+
formData.value = { ...props.modelValue };
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
function handleSubmit() {
|
|
186
|
+
emit("update:modelValue", formData.value);
|
|
187
|
+
emit("change", formData.value);
|
|
188
|
+
emit("update:visible", false);
|
|
189
|
+
}
|
|
190
|
+
const __returned__ = { props, emit, formData, handleSubmit, get VkfForm() {
|
|
191
|
+
return form.VkfForm;
|
|
192
|
+
}, get ElDialog() {
|
|
193
|
+
return elementPlus.ElDialog;
|
|
194
|
+
}, get setData() {
|
|
195
|
+
return core.setData;
|
|
196
|
+
} };
|
|
197
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
198
|
+
return __returned__;
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
203
|
+
const _component_ElButton = vue.resolveComponent("ElButton");
|
|
204
|
+
return vue.openBlock(), vue.createBlock($setup["ElDialog"], {
|
|
205
|
+
"model-value": $props.visible,
|
|
206
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => _ctx.$emit("update:visible", $event))
|
|
207
|
+
}, {
|
|
208
|
+
header: vue.withCtx(() => [
|
|
209
|
+
vue.renderSlot(_ctx.$slots, "header")
|
|
210
|
+
]),
|
|
211
|
+
footer: vue.withCtx(() => [
|
|
212
|
+
vue.createVNode(_component_ElButton, {
|
|
213
|
+
onClick: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("update:visible", false))
|
|
214
|
+
}, {
|
|
215
|
+
default: vue.withCtx(() => _cache[3] || (_cache[3] = [
|
|
216
|
+
vue.createTextVNode(" \u53D6\u6D88 ")
|
|
217
|
+
])),
|
|
218
|
+
_: 1,
|
|
219
|
+
__: [3]
|
|
220
|
+
}),
|
|
221
|
+
vue.createVNode(_component_ElButton, {
|
|
222
|
+
type: "primary",
|
|
223
|
+
onClick: $setup.handleSubmit
|
|
224
|
+
}, {
|
|
225
|
+
default: vue.withCtx(() => _cache[4] || (_cache[4] = [
|
|
226
|
+
vue.createTextVNode(" \u786E\u5B9A ")
|
|
227
|
+
])),
|
|
228
|
+
_: 1,
|
|
229
|
+
__: [4]
|
|
230
|
+
})
|
|
231
|
+
]),
|
|
232
|
+
default: vue.withCtx(() => [
|
|
233
|
+
vue.createVNode($setup["VkfForm"], vue.mergeProps($props.dialogFormProps, {
|
|
234
|
+
"form-items": $props.formItems,
|
|
235
|
+
data: $setup.formData,
|
|
236
|
+
onSetData: _cache[0] || (_cache[0] = ($event) => $setup.setData($setup.formData, $event))
|
|
237
|
+
}), null, 16, ["form-items", "data"])
|
|
238
|
+
]),
|
|
239
|
+
_: 3
|
|
240
|
+
/* FORWARDED */
|
|
241
|
+
}, 8, ["model-value"]);
|
|
242
|
+
}
|
|
243
|
+
var DialogForm = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/dialog-input-collection/src/dialog-form.vue"]]);
|
|
244
|
+
|
|
245
|
+
var _sfc_main = /* @__PURE__ */vue.defineComponent({
|
|
246
|
+
...{
|
|
247
|
+
name: "VkfDialogInputCollection"
|
|
248
|
+
},
|
|
249
|
+
__name: "index",
|
|
250
|
+
props: props,
|
|
251
|
+
emits,
|
|
252
|
+
setup(__props, {
|
|
253
|
+
expose: __expose,
|
|
254
|
+
emit: __emit
|
|
255
|
+
}) {
|
|
256
|
+
__expose();
|
|
257
|
+
const ElTable = elementPlus.ElTable;
|
|
258
|
+
const props = __props;
|
|
259
|
+
const emit = __emit;
|
|
260
|
+
const hasColAdd = vue.computed(() => {
|
|
261
|
+
return props.modules.includes("operations:add");
|
|
262
|
+
});
|
|
263
|
+
const formItemBindProps = formItem._VkfFormItemCtx.createBindProps(props);
|
|
264
|
+
const readonly = composables.useComputedReadonly(props);
|
|
265
|
+
const formData = vue.computed(() => {
|
|
266
|
+
if (!props.prop || props.prop.length === 0) {
|
|
267
|
+
return props.modelValue;
|
|
268
|
+
}
|
|
269
|
+
const data = {};
|
|
270
|
+
core.ensetData(data, {
|
|
271
|
+
k: props.prop,
|
|
272
|
+
v: props.modelValue
|
|
273
|
+
});
|
|
274
|
+
return data;
|
|
275
|
+
});
|
|
276
|
+
const fullColumns = vue.computed(() => {
|
|
277
|
+
return props.columns.map(column => {
|
|
278
|
+
const tableColProp = Array.isArray(column.prop) ? column.prop.join(".") : column.prop;
|
|
279
|
+
return {
|
|
280
|
+
...column,
|
|
281
|
+
prop: tableColProp,
|
|
282
|
+
slots: e => {
|
|
283
|
+
const prop = [props.prop ?? [], e.$index, column.prop].flat();
|
|
284
|
+
const formItemProps = {
|
|
285
|
+
prop,
|
|
286
|
+
readonly: readonly.value,
|
|
287
|
+
templateType: column.templateType,
|
|
288
|
+
templateProps: column.templateProps
|
|
289
|
+
};
|
|
290
|
+
if (_function.isCallable(column.templateProps)) {
|
|
291
|
+
formItemProps.templateProps = () => {
|
|
292
|
+
return column.templateProps(e.row);
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
return vue.createVNode(informationRenderer.VkfInformationRenderer, {
|
|
296
|
+
"source": [{
|
|
297
|
+
...formItemProps,
|
|
298
|
+
...column.createTemplateProps?.(e, formItemProps)
|
|
299
|
+
}]
|
|
300
|
+
}, null);
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
});
|
|
304
|
+
});
|
|
305
|
+
const buttonsColumn = vue.computed(() => ({
|
|
306
|
+
label: "\u64CD\u4F5C",
|
|
307
|
+
align: "center",
|
|
308
|
+
width: "85",
|
|
309
|
+
hidden: readonly.value || !props.splicable,
|
|
310
|
+
className: "vk-input-collection__buttons",
|
|
311
|
+
slots: ({
|
|
312
|
+
$index
|
|
313
|
+
}) => vue.createVNode(vue.Fragment, null, [hasColAdd.value && vue.createVNode(elementPlus.ElButton, {
|
|
314
|
+
"size": "small",
|
|
315
|
+
"icon": index.plus_default,
|
|
316
|
+
"type": "primary",
|
|
317
|
+
"link": true,
|
|
318
|
+
"onClick": () => handlePlus($index)
|
|
319
|
+
}, null), vue.createVNode(elementPlus.ElButton, {
|
|
320
|
+
"size": "small",
|
|
321
|
+
"icon": index.edit_default,
|
|
322
|
+
"type": "primary",
|
|
323
|
+
"link": true,
|
|
324
|
+
"onClick": () => handleEdit($index)
|
|
325
|
+
}, null), vue.createVNode(elementPlus.ElPopconfirm, {
|
|
326
|
+
"title": "\u786E\u5B9A\u5220\u9664\u5417\uFF1F",
|
|
327
|
+
"onConfirm": () => handleMinus($index),
|
|
328
|
+
"confirmButtonText": "\u5220\u9664",
|
|
329
|
+
"cancelButtonText": "\u53D6\u6D88"
|
|
330
|
+
}, {
|
|
331
|
+
reference: () => vue.createVNode(elementPlus.ElButton, {
|
|
332
|
+
"size": "small",
|
|
333
|
+
"icon": index.delete_default,
|
|
334
|
+
"type": "danger",
|
|
335
|
+
"link": true
|
|
336
|
+
}, null)
|
|
337
|
+
})])
|
|
338
|
+
}));
|
|
339
|
+
const allColumns = vue.computed(() => {
|
|
340
|
+
const data = [...fullColumns.value, buttonsColumn.value];
|
|
341
|
+
return data;
|
|
342
|
+
});
|
|
343
|
+
const cuState = vue.reactive({
|
|
344
|
+
type: _enum.CRUD.create,
|
|
345
|
+
index: 0,
|
|
346
|
+
// 新增时,表示在哪条点击的 +
|
|
347
|
+
data: {},
|
|
348
|
+
dialogVisible: false
|
|
349
|
+
});
|
|
350
|
+
const cuFormItems = vue.computed(() => {
|
|
351
|
+
return props.columns.map(c => {
|
|
352
|
+
return {
|
|
353
|
+
label: c.label,
|
|
354
|
+
readonly: readonly.value,
|
|
355
|
+
prop: c.prop,
|
|
356
|
+
templateType: c.templateType,
|
|
357
|
+
templateProps: c.templateProps
|
|
358
|
+
};
|
|
359
|
+
});
|
|
360
|
+
});
|
|
361
|
+
function handleMinus(index) {
|
|
362
|
+
const data = cloneDeep.cloneDeep(props.modelValue);
|
|
363
|
+
data.splice(index, 1);
|
|
364
|
+
emit("update:modelValue", data);
|
|
365
|
+
}
|
|
366
|
+
function handlePlus(index) {
|
|
367
|
+
cuState.index = index;
|
|
368
|
+
cuState.data = cloneDeep.cloneDeep(props.defaultItemValue);
|
|
369
|
+
cuState.type = _enum.CRUD.create;
|
|
370
|
+
cuState.dialogVisible = true;
|
|
371
|
+
}
|
|
372
|
+
function handleEdit(index) {
|
|
373
|
+
const data = props.modelValue[index];
|
|
374
|
+
cuState.index = index;
|
|
375
|
+
cuState.data = cloneDeep.cloneDeep(data);
|
|
376
|
+
cuState.type = _enum.CRUD.update;
|
|
377
|
+
cuState.dialogVisible = true;
|
|
378
|
+
}
|
|
379
|
+
function handleDialogFormChange(data) {
|
|
380
|
+
const newData = cloneDeep.cloneDeep(props.modelValue);
|
|
381
|
+
if (cuState.type === _enum.CRUD.create) {
|
|
382
|
+
newData.splice(cuState.index + 1, 0, data);
|
|
383
|
+
} else if (cuState.type === _enum.CRUD.update) {
|
|
384
|
+
newData[cuState.index] = data;
|
|
385
|
+
}
|
|
386
|
+
emit("update:modelValue", newData);
|
|
387
|
+
}
|
|
388
|
+
const handleFormSetData = e => {
|
|
389
|
+
console.warn("\u8868\u5355\u9879\u6B63\u5728\u76F4\u63A5\u4FEE\u6539 Data, \u8FD9\u5728 dialog-input-collection \u53EF\u80FD\u662F\u4E00\u4E2A\u610F\u5916\u64CD\u4F5C", e);
|
|
390
|
+
const data = cloneDeep.cloneDeep(formData.value);
|
|
391
|
+
core.ensetData(data, e);
|
|
392
|
+
emit("update:modelValue", core.getValue(data, props.prop));
|
|
393
|
+
};
|
|
394
|
+
const __returned__ = {
|
|
395
|
+
ElTable,
|
|
396
|
+
props,
|
|
397
|
+
emit,
|
|
398
|
+
hasColAdd,
|
|
399
|
+
formItemBindProps,
|
|
400
|
+
readonly,
|
|
401
|
+
formData,
|
|
402
|
+
fullColumns,
|
|
403
|
+
buttonsColumn,
|
|
404
|
+
allColumns,
|
|
405
|
+
cuState,
|
|
406
|
+
cuFormItems,
|
|
407
|
+
handleMinus,
|
|
408
|
+
handlePlus,
|
|
409
|
+
handleEdit,
|
|
410
|
+
handleDialogFormChange,
|
|
411
|
+
handleFormSetData,
|
|
412
|
+
get Plus() {
|
|
413
|
+
return index.plus_default;
|
|
414
|
+
},
|
|
415
|
+
get Edit() {
|
|
416
|
+
return index.edit_default;
|
|
417
|
+
},
|
|
418
|
+
get VkfFormItem() {
|
|
419
|
+
return formItem.VkfFormItem;
|
|
420
|
+
},
|
|
421
|
+
get VkTableColumns() {
|
|
422
|
+
return tableColumns.VkTableColumns;
|
|
423
|
+
},
|
|
424
|
+
get ElButton() {
|
|
425
|
+
return elementPlus.ElButton;
|
|
426
|
+
},
|
|
427
|
+
TemplatesLayout,
|
|
428
|
+
get CRUD() {
|
|
429
|
+
return _enum.CRUD;
|
|
430
|
+
},
|
|
431
|
+
get VkAvatar() {
|
|
432
|
+
return avatar.VkAvatar;
|
|
433
|
+
},
|
|
434
|
+
DialogForm
|
|
435
|
+
};
|
|
436
|
+
Object.defineProperty(__returned__, "__isScriptSetup", {
|
|
437
|
+
enumerable: false,
|
|
438
|
+
value: true
|
|
439
|
+
});
|
|
440
|
+
return __returned__;
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
const _hoisted_1 = {
|
|
445
|
+
key: 0,
|
|
446
|
+
class: "vkf-dialog-input-collection-options"
|
|
447
|
+
};
|
|
448
|
+
const _hoisted_2 = { class: "vkf-dialog-input-collection__dialog-header" };
|
|
449
|
+
const _hoisted_3 = { class: "vkf-dialog-input-collection__dialog-title" };
|
|
450
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
451
|
+
return vue.openBlock(), vue.createElementBlock(
|
|
452
|
+
vue.Fragment,
|
|
453
|
+
null,
|
|
454
|
+
[
|
|
455
|
+
vue.createVNode($setup["TemplatesLayout"], {
|
|
456
|
+
data: $setup.formData,
|
|
457
|
+
onSetData: $setup.handleFormSetData
|
|
458
|
+
}, {
|
|
459
|
+
default: vue.withCtx(() => [
|
|
460
|
+
vue.createVNode(
|
|
461
|
+
$setup["VkfFormItem"],
|
|
462
|
+
vue.normalizeProps(vue.guardReactiveProps($setup.formItemBindProps)),
|
|
463
|
+
vue.createSlots({
|
|
464
|
+
default: vue.withCtx(() => [
|
|
465
|
+
!$setup.readonly && _ctx.splicable && !_ctx.labelActions ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
|
|
466
|
+
vue.createVNode($setup["ElButton"], {
|
|
467
|
+
type: "primary",
|
|
468
|
+
onClick: _cache[1] || (_cache[1] = ($event) => $setup.handlePlus(-1))
|
|
469
|
+
}, {
|
|
470
|
+
default: vue.withCtx(() => _cache[5] || (_cache[5] = [
|
|
471
|
+
vue.createTextVNode(" \u6DFB\u52A0 ")
|
|
472
|
+
])),
|
|
473
|
+
_: 1,
|
|
474
|
+
__: [5]
|
|
475
|
+
})
|
|
476
|
+
])) : vue.createCommentVNode("v-if", true),
|
|
477
|
+
vue.createVNode($setup["ElTable"], {
|
|
478
|
+
data: _ctx.modelValue,
|
|
479
|
+
class: "vkf-dialog-input-collection-table"
|
|
480
|
+
}, {
|
|
481
|
+
default: vue.withCtx(() => [
|
|
482
|
+
vue.createVNode($setup["VkTableColumns"], { source: $setup.allColumns }, null, 8, ["source"])
|
|
483
|
+
]),
|
|
484
|
+
_: 1
|
|
485
|
+
/* STABLE */
|
|
486
|
+
}, 8, ["data"])
|
|
487
|
+
]),
|
|
488
|
+
_: 2
|
|
489
|
+
/* DYNAMIC */
|
|
490
|
+
}, [
|
|
491
|
+
!$setup.readonly && _ctx.splicable && _ctx.labelActions ? {
|
|
492
|
+
name: "labelActions",
|
|
493
|
+
fn: vue.withCtx(() => [
|
|
494
|
+
vue.createVNode($setup["ElButton"], {
|
|
495
|
+
size: "small",
|
|
496
|
+
icon: $setup.Plus,
|
|
497
|
+
onClick: _cache[0] || (_cache[0] = ($event) => $setup.handlePlus(-1))
|
|
498
|
+
}, {
|
|
499
|
+
default: vue.withCtx(() => _cache[4] || (_cache[4] = [
|
|
500
|
+
vue.createTextVNode(" \u6DFB\u52A0 ")
|
|
501
|
+
])),
|
|
502
|
+
_: 1,
|
|
503
|
+
__: [4]
|
|
504
|
+
}, 8, ["icon"])
|
|
505
|
+
]),
|
|
506
|
+
key: "0"
|
|
507
|
+
} : void 0
|
|
508
|
+
]),
|
|
509
|
+
1040
|
|
510
|
+
/* FULL_PROPS, DYNAMIC_SLOTS */
|
|
511
|
+
),
|
|
512
|
+
vue.createVNode($setup["DialogForm"], {
|
|
513
|
+
visible: $setup.cuState.dialogVisible,
|
|
514
|
+
"onUpdate:visible": _cache[2] || (_cache[2] = ($event) => $setup.cuState.dialogVisible = $event),
|
|
515
|
+
modelValue: $setup.cuState.data,
|
|
516
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $setup.cuState.data = $event),
|
|
517
|
+
"form-items": $setup.cuFormItems,
|
|
518
|
+
"dialog-form-props": _ctx.dialogFormProps,
|
|
519
|
+
onChange: $setup.handleDialogFormChange
|
|
520
|
+
}, {
|
|
521
|
+
header: vue.withCtx(() => [
|
|
522
|
+
vue.createElementVNode("div", _hoisted_2, [
|
|
523
|
+
vue.createVNode($setup["VkAvatar"], {
|
|
524
|
+
icon: $setup.cuState.type === $setup.CRUD.create ? $setup.Plus : $setup.Edit
|
|
525
|
+
}, null, 8, ["icon"]),
|
|
526
|
+
vue.createElementVNode(
|
|
527
|
+
"span",
|
|
528
|
+
_hoisted_3,
|
|
529
|
+
vue.toDisplayString($setup.props.label),
|
|
530
|
+
1
|
|
531
|
+
/* TEXT */
|
|
532
|
+
)
|
|
533
|
+
])
|
|
534
|
+
]),
|
|
535
|
+
_: 1
|
|
536
|
+
/* STABLE */
|
|
537
|
+
}, 8, ["visible", "modelValue", "form-items", "dialog-form-props"])
|
|
538
|
+
]),
|
|
539
|
+
_: 1
|
|
540
|
+
/* STABLE */
|
|
541
|
+
}, 8, ["data"]),
|
|
542
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
543
|
+
],
|
|
544
|
+
64
|
|
545
|
+
/* STABLE_FRAGMENT */
|
|
546
|
+
);
|
|
547
|
+
}
|
|
548
|
+
var VkfDialogInputCollection = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/dialog-input-collection/src/index.vue"]]);
|
|
549
|
+
|
|
550
|
+
var types = /*#__PURE__*/Object.freeze({
|
|
551
|
+
__proto__: null
|
|
552
|
+
});
|
|
553
|
+
|
|
554
|
+
VkfDialogInputCollection.install = (app) => {
|
|
555
|
+
app.component(VkfDialogInputCollection.name || "VkfDialogInputCollection", VkfDialogInputCollection);
|
|
556
|
+
};
|
|
557
|
+
|
|
558
|
+
exports.VkfDialogInputCollection = VkfDialogInputCollection;
|
|
559
|
+
exports.__VkfDialogInputCollection = types;
|
|
560
|
+
exports.default = VkfDialogInputCollection;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.vkf-dialog-input-collection__dialog-header{
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
}
|
|
5
|
+
.vkf-dialog-input-collection__dialog-title{
|
|
6
|
+
line-height: 40px;
|
|
7
|
+
}
|
|
8
|
+
.vkf-dialog-input-collection-options{
|
|
9
|
+
width: 100%;
|
|
10
|
+
display: flex;
|
|
11
|
+
justify-content: flex-end;
|
|
12
|
+
}
|
|
13
|
+
.vkf-dialog-input-collection-table{
|
|
14
|
+
margin-top: var(--gap-m, 8px);
|
|
15
|
+
}
|
|
16
|
+
.vkf-dialog-input-collection-table .vkf-form-item {
|
|
17
|
+
margin-bottom: 0;
|
|
18
|
+
}
|
|
19
|
+
.vk-input-collection__buttons .cell{
|
|
20
|
+
padding: 0;
|
|
21
|
+
}
|