@vunk/form 2.12.0 → 2.12.2
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/dialog-input-collection/index.cjs +129 -106
- package/components/dialog-input-collection/index.mjs +128 -105
- package/components/dialog-input-collection/src/ctx.d.ts +6 -3
- package/components/dialog-input-collection/src/dialog-form.vue.d.ts +1184 -49
- package/components/dialog-input-collection/src/index.vue.d.ts +1365 -223
- package/components/dialog-input-collection/src/layout.vue.d.ts +27 -27
- package/components/dialog-input-collection/src/types.d.ts +1 -1
- package/components/form-item-renderer/index.cjs +5 -3
- package/components/form-item-renderer/index.mjs +5 -3
- package/package.json +1 -1
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import { defineComponent,
|
|
1
|
+
import { defineComponent, ref, watch, resolveComponent, openBlock, createBlock, withCtx, renderSlot, createVNode, createTextVNode, mergeProps, computed, Fragment, reactive, createElementBlock, normalizeProps, guardReactiveProps, createSlots, createCommentVNode, createElementVNode, toDisplayString } from 'vue';
|
|
2
2
|
import { p as plus_default, e as edit_default, d as delete_default } from '../index.mjs';
|
|
3
3
|
import { setData, ensetData, getValue } from '@vunk/core';
|
|
4
4
|
import { _VkfFormItemCtx, VkfFormItem } from '@vunk/form/components/form-item';
|
|
5
|
-
import {
|
|
5
|
+
import { VkfInformationData, VkfInformationTemplates, VkfInformationRenderer } from '@vunk/form/components/information-renderer';
|
|
6
6
|
import { useComputedReadonly } from '@vunk/form/composables';
|
|
7
|
+
import { VkAvatar } from '@vunk/plus/components/avatar';
|
|
7
8
|
import { VkTableColumns } from '@vunk/plus/components/table-columns';
|
|
9
|
+
import { CRUD } from '@vunk/shared/enum';
|
|
10
|
+
import { isCallable } from '@vunk/shared/function';
|
|
8
11
|
import { ElDialog, ElButton, ElPopconfirm, ElTable } from 'element-plus';
|
|
12
|
+
import { useDeferred } from '@vunk/core/composables';
|
|
13
|
+
import { VkfForm } from '@vunk/form/components/form';
|
|
14
|
+
import { validateCatch } from '@vunk/form/shared/form';
|
|
15
|
+
import { _ as _export_sfc } from '../_plugin-vue_export-helper.mjs';
|
|
16
|
+
import { VkfInformationTemplatesDefault } from '@vunk/form/components/information-templates-default';
|
|
9
17
|
import { VkfRendererData } from '@vunk/form/components/renderer-data';
|
|
10
18
|
import { VkfTemplateInstancesProvider } from '@vunk/form/components/template-instances-provider';
|
|
11
|
-
import { VkfInformationTemplatesDefault } from '@vunk/form/components/information-templates-default';
|
|
12
19
|
import { VkfTemplatesDefault } from '@vunk/form/components/templates-default';
|
|
13
|
-
import { _ as _export_sfc } from '../_plugin-vue_export-helper.mjs';
|
|
14
|
-
import { CRUD } from '@vunk/shared/enum';
|
|
15
|
-
import { VkAvatar } from '@vunk/plus/components/avatar';
|
|
16
|
-
import { VkfForm } from '@vunk/form/components/form';
|
|
17
|
-
import { isCallable } from '@vunk/shared/function';
|
|
18
20
|
import { c as cloneDeep } from '../cloneDeep.mjs';
|
|
19
21
|
import '../isObject.mjs';
|
|
20
22
|
|
|
@@ -60,6 +62,9 @@ const props = {
|
|
|
60
62
|
type: Object,
|
|
61
63
|
default: () => ({})
|
|
62
64
|
},
|
|
65
|
+
validateCatch: {
|
|
66
|
+
type: Function
|
|
67
|
+
},
|
|
63
68
|
modules: {
|
|
64
69
|
type: Array,
|
|
65
70
|
default: () => ["operations:add"]
|
|
@@ -70,76 +75,6 @@ const emits = {
|
|
|
70
75
|
};
|
|
71
76
|
|
|
72
77
|
var _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
73
|
-
__name: "layout",
|
|
74
|
-
props: {
|
|
75
|
-
data: {
|
|
76
|
-
type: Object,
|
|
77
|
-
default: () => ({})
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
emits: ["setData"],
|
|
81
|
-
setup(__props, { expose: __expose }) {
|
|
82
|
-
__expose();
|
|
83
|
-
const __returned__ = { get VkfRendererData() {
|
|
84
|
-
return VkfRendererData;
|
|
85
|
-
}, get VkfTemplateInstancesProvider() {
|
|
86
|
-
return VkfTemplateInstancesProvider;
|
|
87
|
-
}, get VkfInformationTemplates() {
|
|
88
|
-
return VkfInformationTemplates;
|
|
89
|
-
}, get VkfInformationData() {
|
|
90
|
-
return VkfInformationData;
|
|
91
|
-
}, get VkfInformationTemplatesDefault() {
|
|
92
|
-
return VkfInformationTemplatesDefault;
|
|
93
|
-
}, get VkfTemplatesDefault() {
|
|
94
|
-
return VkfTemplatesDefault;
|
|
95
|
-
} };
|
|
96
|
-
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
97
|
-
return __returned__;
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
102
|
-
return openBlock(), createBlock($setup["VkfTemplateInstancesProvider"], null, {
|
|
103
|
-
placeholder: withCtx(() => [
|
|
104
|
-
createVNode($setup["VkfTemplatesDefault"])
|
|
105
|
-
]),
|
|
106
|
-
default: withCtx(() => [
|
|
107
|
-
createVNode($setup["VkfInformationTemplates"], null, {
|
|
108
|
-
placeholder: withCtx(() => [
|
|
109
|
-
createVNode($setup["VkfInformationTemplatesDefault"])
|
|
110
|
-
]),
|
|
111
|
-
default: withCtx(() => [
|
|
112
|
-
createVNode($setup["VkfRendererData"], {
|
|
113
|
-
data: $props.data,
|
|
114
|
-
onSetData: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("setData", $event))
|
|
115
|
-
}, {
|
|
116
|
-
default: withCtx(() => [
|
|
117
|
-
createVNode($setup["VkfInformationData"], {
|
|
118
|
-
data: $props.data,
|
|
119
|
-
onSetData: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("setData", $event))
|
|
120
|
-
}, {
|
|
121
|
-
default: withCtx(() => [
|
|
122
|
-
renderSlot(_ctx.$slots, "default")
|
|
123
|
-
]),
|
|
124
|
-
_: 3
|
|
125
|
-
/* FORWARDED */
|
|
126
|
-
}, 8, ["data"])
|
|
127
|
-
]),
|
|
128
|
-
_: 3
|
|
129
|
-
/* FORWARDED */
|
|
130
|
-
}, 8, ["data"])
|
|
131
|
-
]),
|
|
132
|
-
_: 3
|
|
133
|
-
/* FORWARDED */
|
|
134
|
-
})
|
|
135
|
-
]),
|
|
136
|
-
_: 3
|
|
137
|
-
/* FORWARDED */
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
var TemplatesLayout = /* @__PURE__ */ _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"]]);
|
|
141
|
-
|
|
142
|
-
var _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
143
78
|
__name: "dialog-form",
|
|
144
79
|
props: {
|
|
145
80
|
title: {
|
|
@@ -165,6 +100,10 @@ var _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
165
100
|
dialogFormProps: {
|
|
166
101
|
type: Object,
|
|
167
102
|
default: () => ({})
|
|
103
|
+
},
|
|
104
|
+
validateCatch: {
|
|
105
|
+
type: Function,
|
|
106
|
+
default: validateCatch
|
|
168
107
|
}
|
|
169
108
|
},
|
|
170
109
|
emits: ["update:modelValue", "update:visible", "change"],
|
|
@@ -173,32 +112,42 @@ var _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
173
112
|
const props = __props;
|
|
174
113
|
const emit = __emit;
|
|
175
114
|
const formData = ref(props.modelValue);
|
|
115
|
+
const formDef = useDeferred();
|
|
116
|
+
formDef.promise.then((form) => {
|
|
117
|
+
props.dialogFormProps.elRef?.(form);
|
|
118
|
+
});
|
|
176
119
|
watch(() => props.visible, (v) => {
|
|
177
120
|
if (props.openReset && v) {
|
|
178
121
|
formData.value = { ...props.modelValue };
|
|
122
|
+
setTimeout(() => {
|
|
123
|
+
formDef.value?.clearValidate();
|
|
124
|
+
});
|
|
179
125
|
}
|
|
180
126
|
});
|
|
181
127
|
function handleSubmit() {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
128
|
+
formDef.value?.validate().then(() => {
|
|
129
|
+
emit("update:modelValue", formData.value);
|
|
130
|
+
emit("change", formData.value);
|
|
131
|
+
emit("update:visible", false);
|
|
132
|
+
}).catch(props.validateCatch);
|
|
185
133
|
}
|
|
186
|
-
const __returned__ = { props, emit, formData, handleSubmit, get
|
|
134
|
+
const __returned__ = { props, emit, formData, formDef, handleSubmit, get setData() {
|
|
135
|
+
return setData;
|
|
136
|
+
}, get VkfForm() {
|
|
187
137
|
return VkfForm;
|
|
188
138
|
}, get ElDialog() {
|
|
189
139
|
return ElDialog;
|
|
190
|
-
}, get setData() {
|
|
191
|
-
return setData;
|
|
192
140
|
} };
|
|
193
141
|
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
194
142
|
return __returned__;
|
|
195
143
|
}
|
|
196
144
|
});
|
|
197
145
|
|
|
198
|
-
function _sfc_render$
|
|
146
|
+
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
199
147
|
const _component_ElButton = resolveComponent("ElButton");
|
|
200
148
|
return openBlock(), createBlock($setup["ElDialog"], {
|
|
201
149
|
"model-value": $props.visible,
|
|
150
|
+
"append-to-body": "",
|
|
202
151
|
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => _ctx.$emit("update:visible", $event))
|
|
203
152
|
}, {
|
|
204
153
|
header: withCtx(() => [
|
|
@@ -227,16 +176,87 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
227
176
|
]),
|
|
228
177
|
default: withCtx(() => [
|
|
229
178
|
createVNode($setup["VkfForm"], mergeProps($props.dialogFormProps, {
|
|
179
|
+
"el-ref": $setup.formDef.resolve,
|
|
230
180
|
"form-items": $props.formItems,
|
|
231
181
|
data: $setup.formData,
|
|
232
182
|
onSetData: _cache[0] || (_cache[0] = ($event) => $setup.setData($setup.formData, $event))
|
|
233
|
-
}), null, 16, ["form-items", "data"])
|
|
183
|
+
}), null, 16, ["el-ref", "form-items", "data"])
|
|
234
184
|
]),
|
|
235
185
|
_: 3
|
|
236
186
|
/* FORWARDED */
|
|
237
187
|
}, 8, ["model-value"]);
|
|
238
188
|
}
|
|
239
|
-
var DialogForm = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
189
|
+
var DialogForm = /* @__PURE__ */ _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/dialog-form.vue"]]);
|
|
190
|
+
|
|
191
|
+
var _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
192
|
+
__name: "layout",
|
|
193
|
+
props: {
|
|
194
|
+
data: {
|
|
195
|
+
type: Object,
|
|
196
|
+
default: () => ({})
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
emits: ["setData"],
|
|
200
|
+
setup(__props, { expose: __expose }) {
|
|
201
|
+
__expose();
|
|
202
|
+
const __returned__ = { get VkfInformationData() {
|
|
203
|
+
return VkfInformationData;
|
|
204
|
+
}, get VkfInformationTemplates() {
|
|
205
|
+
return VkfInformationTemplates;
|
|
206
|
+
}, get VkfInformationTemplatesDefault() {
|
|
207
|
+
return VkfInformationTemplatesDefault;
|
|
208
|
+
}, get VkfRendererData() {
|
|
209
|
+
return VkfRendererData;
|
|
210
|
+
}, get VkfTemplateInstancesProvider() {
|
|
211
|
+
return VkfTemplateInstancesProvider;
|
|
212
|
+
}, get VkfTemplatesDefault() {
|
|
213
|
+
return VkfTemplatesDefault;
|
|
214
|
+
} };
|
|
215
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
216
|
+
return __returned__;
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
221
|
+
return openBlock(), createBlock($setup["VkfTemplateInstancesProvider"], null, {
|
|
222
|
+
placeholder: withCtx(() => [
|
|
223
|
+
createVNode($setup["VkfTemplatesDefault"])
|
|
224
|
+
]),
|
|
225
|
+
default: withCtx(() => [
|
|
226
|
+
createVNode($setup["VkfInformationTemplates"], null, {
|
|
227
|
+
placeholder: withCtx(() => [
|
|
228
|
+
createVNode($setup["VkfInformationTemplatesDefault"])
|
|
229
|
+
]),
|
|
230
|
+
default: withCtx(() => [
|
|
231
|
+
createVNode($setup["VkfRendererData"], {
|
|
232
|
+
data: $props.data,
|
|
233
|
+
onSetData: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("setData", $event))
|
|
234
|
+
}, {
|
|
235
|
+
default: withCtx(() => [
|
|
236
|
+
createVNode($setup["VkfInformationData"], {
|
|
237
|
+
data: $props.data,
|
|
238
|
+
onSetData: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("setData", $event))
|
|
239
|
+
}, {
|
|
240
|
+
default: withCtx(() => [
|
|
241
|
+
renderSlot(_ctx.$slots, "default")
|
|
242
|
+
]),
|
|
243
|
+
_: 3
|
|
244
|
+
/* FORWARDED */
|
|
245
|
+
}, 8, ["data"])
|
|
246
|
+
]),
|
|
247
|
+
_: 3
|
|
248
|
+
/* FORWARDED */
|
|
249
|
+
}, 8, ["data"])
|
|
250
|
+
]),
|
|
251
|
+
_: 3
|
|
252
|
+
/* FORWARDED */
|
|
253
|
+
})
|
|
254
|
+
]),
|
|
255
|
+
_: 3
|
|
256
|
+
/* FORWARDED */
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
var TemplatesLayout = /* @__PURE__ */ _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/layout.vue"]]);
|
|
240
260
|
|
|
241
261
|
var _sfc_main = /* @__PURE__ */defineComponent({
|
|
242
262
|
...{
|
|
@@ -250,9 +270,9 @@ var _sfc_main = /* @__PURE__ */defineComponent({
|
|
|
250
270
|
emit: __emit
|
|
251
271
|
}) {
|
|
252
272
|
__expose();
|
|
253
|
-
const ElTable$1 = ElTable;
|
|
254
273
|
const props = __props;
|
|
255
274
|
const emit = __emit;
|
|
275
|
+
const ElTable$1 = ElTable;
|
|
256
276
|
const hasColAdd = computed(() => {
|
|
257
277
|
return props.modules.includes("operations:add");
|
|
258
278
|
});
|
|
@@ -388,9 +408,9 @@ var _sfc_main = /* @__PURE__ */defineComponent({
|
|
|
388
408
|
emit("update:modelValue", getValue(data, props.prop));
|
|
389
409
|
};
|
|
390
410
|
const __returned__ = {
|
|
391
|
-
ElTable: ElTable$1,
|
|
392
411
|
props,
|
|
393
412
|
emit,
|
|
413
|
+
ElTable: ElTable$1,
|
|
394
414
|
hasColAdd,
|
|
395
415
|
formItemBindProps,
|
|
396
416
|
readonly,
|
|
@@ -405,29 +425,29 @@ var _sfc_main = /* @__PURE__ */defineComponent({
|
|
|
405
425
|
handleEdit,
|
|
406
426
|
handleDialogFormChange,
|
|
407
427
|
handleFormSetData,
|
|
408
|
-
get Plus() {
|
|
409
|
-
return plus_default;
|
|
410
|
-
},
|
|
411
428
|
get Edit() {
|
|
412
429
|
return edit_default;
|
|
413
430
|
},
|
|
431
|
+
get Plus() {
|
|
432
|
+
return plus_default;
|
|
433
|
+
},
|
|
414
434
|
get VkfFormItem() {
|
|
415
435
|
return VkfFormItem;
|
|
416
436
|
},
|
|
437
|
+
get VkAvatar() {
|
|
438
|
+
return VkAvatar;
|
|
439
|
+
},
|
|
417
440
|
get VkTableColumns() {
|
|
418
441
|
return VkTableColumns;
|
|
419
442
|
},
|
|
420
|
-
get ElButton() {
|
|
421
|
-
return ElButton;
|
|
422
|
-
},
|
|
423
|
-
TemplatesLayout,
|
|
424
443
|
get CRUD() {
|
|
425
444
|
return CRUD;
|
|
426
445
|
},
|
|
427
|
-
get
|
|
428
|
-
return
|
|
446
|
+
get ElButton() {
|
|
447
|
+
return ElButton;
|
|
429
448
|
},
|
|
430
|
-
DialogForm
|
|
449
|
+
DialogForm,
|
|
450
|
+
TemplatesLayout
|
|
431
451
|
};
|
|
432
452
|
Object.defineProperty(__returned__, "__isScriptSetup", {
|
|
433
453
|
enumerable: false,
|
|
@@ -484,10 +504,12 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
484
504
|
_: 2
|
|
485
505
|
/* DYNAMIC */
|
|
486
506
|
}, [
|
|
487
|
-
|
|
507
|
+
_ctx.labelActions ? {
|
|
488
508
|
name: "labelActions",
|
|
489
509
|
fn: withCtx(() => [
|
|
490
|
-
|
|
510
|
+
renderSlot(_ctx.$slots, "labelActions"),
|
|
511
|
+
!$setup.readonly && _ctx.splicable ? (openBlock(), createBlock($setup["ElButton"], {
|
|
512
|
+
key: 0,
|
|
491
513
|
size: "small",
|
|
492
514
|
icon: $setup.Plus,
|
|
493
515
|
onClick: _cache[0] || (_cache[0] = ($event) => $setup.handlePlus(-1))
|
|
@@ -497,7 +519,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
497
519
|
])),
|
|
498
520
|
_: 1,
|
|
499
521
|
__: [4]
|
|
500
|
-
}, 8, ["icon"])
|
|
522
|
+
}, 8, ["icon"])) : createCommentVNode("v-if", true)
|
|
501
523
|
]),
|
|
502
524
|
key: "0"
|
|
503
525
|
} : void 0
|
|
@@ -512,6 +534,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
512
534
|
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $setup.cuState.data = $event),
|
|
513
535
|
"form-items": $setup.cuFormItems,
|
|
514
536
|
"dialog-form-props": _ctx.dialogFormProps,
|
|
537
|
+
"validate-catch": _ctx.validateCatch,
|
|
515
538
|
onChange: $setup.handleDialogFormChange
|
|
516
539
|
}, {
|
|
517
540
|
header: withCtx(() => [
|
|
@@ -530,10 +553,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
530
553
|
]),
|
|
531
554
|
_: 1
|
|
532
555
|
/* STABLE */
|
|
533
|
-
}, 8, ["visible", "modelValue", "form-items", "dialog-form-props"])
|
|
556
|
+
}, 8, ["visible", "modelValue", "form-items", "dialog-form-props", "validate-catch"])
|
|
534
557
|
]),
|
|
535
|
-
_:
|
|
536
|
-
/*
|
|
558
|
+
_: 3
|
|
559
|
+
/* FORWARDED */
|
|
537
560
|
}, 8, ["data"]),
|
|
538
561
|
renderSlot(_ctx.$slots, "default")
|
|
539
562
|
],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Modules } from './types';
|
|
1
|
+
import type { AnyFunc, NormalObject } from '@vunk/shared';
|
|
2
|
+
import type { PropType } from 'vue';
|
|
3
|
+
import type { Modules } from './types';
|
|
4
4
|
export declare const props: {
|
|
5
5
|
columns: {
|
|
6
6
|
type: PropType<any[]>;
|
|
@@ -42,6 +42,9 @@ export declare const props: {
|
|
|
42
42
|
type: ObjectConstructor;
|
|
43
43
|
default: () => {};
|
|
44
44
|
};
|
|
45
|
+
validateCatch: {
|
|
46
|
+
type: PropType<AnyFunc>;
|
|
47
|
+
};
|
|
45
48
|
modules: {
|
|
46
49
|
type: PropType<Modules[]>;
|
|
47
50
|
default: () => string[];
|