@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
|
@@ -7,18 +7,20 @@ var index = require('../index.cjs');
|
|
|
7
7
|
var core = require('@vunk/core');
|
|
8
8
|
var formItem = require('@vunk/form/components/form-item');
|
|
9
9
|
var informationRenderer = require('@vunk/form/components/information-renderer');
|
|
10
|
-
var composables = require('@vunk/form/composables');
|
|
10
|
+
var composables$1 = require('@vunk/form/composables');
|
|
11
|
+
var avatar = require('@vunk/plus/components/avatar');
|
|
11
12
|
var tableColumns = require('@vunk/plus/components/table-columns');
|
|
13
|
+
var _enum = require('@vunk/shared/enum');
|
|
14
|
+
var _function = require('@vunk/shared/function');
|
|
12
15
|
var elementPlus = require('element-plus');
|
|
16
|
+
var composables = require('@vunk/core/composables');
|
|
17
|
+
var form$1 = require('@vunk/form/components/form');
|
|
18
|
+
var form = require('@vunk/form/shared/form');
|
|
19
|
+
var _pluginVue_exportHelper = require('../_plugin-vue_export-helper.cjs');
|
|
20
|
+
var informationTemplatesDefault = require('@vunk/form/components/information-templates-default');
|
|
13
21
|
var rendererData = require('@vunk/form/components/renderer-data');
|
|
14
22
|
var templateInstancesProvider = require('@vunk/form/components/template-instances-provider');
|
|
15
|
-
var informationTemplatesDefault = require('@vunk/form/components/information-templates-default');
|
|
16
23
|
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
24
|
var cloneDeep = require('../cloneDeep.cjs');
|
|
23
25
|
require('../isObject.cjs');
|
|
24
26
|
|
|
@@ -64,6 +66,9 @@ const props = {
|
|
|
64
66
|
type: Object,
|
|
65
67
|
default: () => ({})
|
|
66
68
|
},
|
|
69
|
+
validateCatch: {
|
|
70
|
+
type: Function
|
|
71
|
+
},
|
|
67
72
|
modules: {
|
|
68
73
|
type: Array,
|
|
69
74
|
default: () => ["operations:add"]
|
|
@@ -74,76 +79,6 @@ const emits = {
|
|
|
74
79
|
};
|
|
75
80
|
|
|
76
81
|
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
82
|
__name: "dialog-form",
|
|
148
83
|
props: {
|
|
149
84
|
title: {
|
|
@@ -169,6 +104,10 @@ var _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
169
104
|
dialogFormProps: {
|
|
170
105
|
type: Object,
|
|
171
106
|
default: () => ({})
|
|
107
|
+
},
|
|
108
|
+
validateCatch: {
|
|
109
|
+
type: Function,
|
|
110
|
+
default: form.validateCatch
|
|
172
111
|
}
|
|
173
112
|
},
|
|
174
113
|
emits: ["update:modelValue", "update:visible", "change"],
|
|
@@ -177,32 +116,42 @@ var _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
177
116
|
const props = __props;
|
|
178
117
|
const emit = __emit;
|
|
179
118
|
const formData = vue.ref(props.modelValue);
|
|
119
|
+
const formDef = composables.useDeferred();
|
|
120
|
+
formDef.promise.then((form) => {
|
|
121
|
+
props.dialogFormProps.elRef?.(form);
|
|
122
|
+
});
|
|
180
123
|
vue.watch(() => props.visible, (v) => {
|
|
181
124
|
if (props.openReset && v) {
|
|
182
125
|
formData.value = { ...props.modelValue };
|
|
126
|
+
setTimeout(() => {
|
|
127
|
+
formDef.value?.clearValidate();
|
|
128
|
+
});
|
|
183
129
|
}
|
|
184
130
|
});
|
|
185
131
|
function handleSubmit() {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
132
|
+
formDef.value?.validate().then(() => {
|
|
133
|
+
emit("update:modelValue", formData.value);
|
|
134
|
+
emit("change", formData.value);
|
|
135
|
+
emit("update:visible", false);
|
|
136
|
+
}).catch(props.validateCatch);
|
|
189
137
|
}
|
|
190
|
-
const __returned__ = { props, emit, formData, handleSubmit, get
|
|
191
|
-
return
|
|
138
|
+
const __returned__ = { props, emit, formData, formDef, handleSubmit, get setData() {
|
|
139
|
+
return core.setData;
|
|
140
|
+
}, get VkfForm() {
|
|
141
|
+
return form$1.VkfForm;
|
|
192
142
|
}, get ElDialog() {
|
|
193
143
|
return elementPlus.ElDialog;
|
|
194
|
-
}, get setData() {
|
|
195
|
-
return core.setData;
|
|
196
144
|
} };
|
|
197
145
|
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
198
146
|
return __returned__;
|
|
199
147
|
}
|
|
200
148
|
});
|
|
201
149
|
|
|
202
|
-
function _sfc_render$
|
|
150
|
+
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
203
151
|
const _component_ElButton = vue.resolveComponent("ElButton");
|
|
204
152
|
return vue.openBlock(), vue.createBlock($setup["ElDialog"], {
|
|
205
153
|
"model-value": $props.visible,
|
|
154
|
+
"append-to-body": "",
|
|
206
155
|
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => _ctx.$emit("update:visible", $event))
|
|
207
156
|
}, {
|
|
208
157
|
header: vue.withCtx(() => [
|
|
@@ -231,16 +180,87 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
231
180
|
]),
|
|
232
181
|
default: vue.withCtx(() => [
|
|
233
182
|
vue.createVNode($setup["VkfForm"], vue.mergeProps($props.dialogFormProps, {
|
|
183
|
+
"el-ref": $setup.formDef.resolve,
|
|
234
184
|
"form-items": $props.formItems,
|
|
235
185
|
data: $setup.formData,
|
|
236
186
|
onSetData: _cache[0] || (_cache[0] = ($event) => $setup.setData($setup.formData, $event))
|
|
237
|
-
}), null, 16, ["form-items", "data"])
|
|
187
|
+
}), null, 16, ["el-ref", "form-items", "data"])
|
|
238
188
|
]),
|
|
239
189
|
_: 3
|
|
240
190
|
/* FORWARDED */
|
|
241
191
|
}, 8, ["model-value"]);
|
|
242
192
|
}
|
|
243
|
-
var DialogForm = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main$
|
|
193
|
+
var DialogForm = /* @__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/dialog-form.vue"]]);
|
|
194
|
+
|
|
195
|
+
var _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
196
|
+
__name: "layout",
|
|
197
|
+
props: {
|
|
198
|
+
data: {
|
|
199
|
+
type: Object,
|
|
200
|
+
default: () => ({})
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
emits: ["setData"],
|
|
204
|
+
setup(__props, { expose: __expose }) {
|
|
205
|
+
__expose();
|
|
206
|
+
const __returned__ = { get VkfInformationData() {
|
|
207
|
+
return informationRenderer.VkfInformationData;
|
|
208
|
+
}, get VkfInformationTemplates() {
|
|
209
|
+
return informationRenderer.VkfInformationTemplates;
|
|
210
|
+
}, get VkfInformationTemplatesDefault() {
|
|
211
|
+
return informationTemplatesDefault.VkfInformationTemplatesDefault;
|
|
212
|
+
}, get VkfRendererData() {
|
|
213
|
+
return rendererData.VkfRendererData;
|
|
214
|
+
}, get VkfTemplateInstancesProvider() {
|
|
215
|
+
return templateInstancesProvider.VkfTemplateInstancesProvider;
|
|
216
|
+
}, get VkfTemplatesDefault() {
|
|
217
|
+
return templatesDefault.VkfTemplatesDefault;
|
|
218
|
+
} };
|
|
219
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
220
|
+
return __returned__;
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
225
|
+
return vue.openBlock(), vue.createBlock($setup["VkfTemplateInstancesProvider"], null, {
|
|
226
|
+
placeholder: vue.withCtx(() => [
|
|
227
|
+
vue.createVNode($setup["VkfTemplatesDefault"])
|
|
228
|
+
]),
|
|
229
|
+
default: vue.withCtx(() => [
|
|
230
|
+
vue.createVNode($setup["VkfInformationTemplates"], null, {
|
|
231
|
+
placeholder: vue.withCtx(() => [
|
|
232
|
+
vue.createVNode($setup["VkfInformationTemplatesDefault"])
|
|
233
|
+
]),
|
|
234
|
+
default: vue.withCtx(() => [
|
|
235
|
+
vue.createVNode($setup["VkfRendererData"], {
|
|
236
|
+
data: $props.data,
|
|
237
|
+
onSetData: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("setData", $event))
|
|
238
|
+
}, {
|
|
239
|
+
default: vue.withCtx(() => [
|
|
240
|
+
vue.createVNode($setup["VkfInformationData"], {
|
|
241
|
+
data: $props.data,
|
|
242
|
+
onSetData: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("setData", $event))
|
|
243
|
+
}, {
|
|
244
|
+
default: vue.withCtx(() => [
|
|
245
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
246
|
+
]),
|
|
247
|
+
_: 3
|
|
248
|
+
/* FORWARDED */
|
|
249
|
+
}, 8, ["data"])
|
|
250
|
+
]),
|
|
251
|
+
_: 3
|
|
252
|
+
/* FORWARDED */
|
|
253
|
+
}, 8, ["data"])
|
|
254
|
+
]),
|
|
255
|
+
_: 3
|
|
256
|
+
/* FORWARDED */
|
|
257
|
+
})
|
|
258
|
+
]),
|
|
259
|
+
_: 3
|
|
260
|
+
/* FORWARDED */
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
var TemplatesLayout = /* @__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/layout.vue"]]);
|
|
244
264
|
|
|
245
265
|
var _sfc_main = /* @__PURE__ */vue.defineComponent({
|
|
246
266
|
...{
|
|
@@ -254,14 +274,14 @@ var _sfc_main = /* @__PURE__ */vue.defineComponent({
|
|
|
254
274
|
emit: __emit
|
|
255
275
|
}) {
|
|
256
276
|
__expose();
|
|
257
|
-
const ElTable = elementPlus.ElTable;
|
|
258
277
|
const props = __props;
|
|
259
278
|
const emit = __emit;
|
|
279
|
+
const ElTable = elementPlus.ElTable;
|
|
260
280
|
const hasColAdd = vue.computed(() => {
|
|
261
281
|
return props.modules.includes("operations:add");
|
|
262
282
|
});
|
|
263
283
|
const formItemBindProps = formItem._VkfFormItemCtx.createBindProps(props);
|
|
264
|
-
const readonly = composables.useComputedReadonly(props);
|
|
284
|
+
const readonly = composables$1.useComputedReadonly(props);
|
|
265
285
|
const formData = vue.computed(() => {
|
|
266
286
|
if (!props.prop || props.prop.length === 0) {
|
|
267
287
|
return props.modelValue;
|
|
@@ -392,9 +412,9 @@ var _sfc_main = /* @__PURE__ */vue.defineComponent({
|
|
|
392
412
|
emit("update:modelValue", core.getValue(data, props.prop));
|
|
393
413
|
};
|
|
394
414
|
const __returned__ = {
|
|
395
|
-
ElTable,
|
|
396
415
|
props,
|
|
397
416
|
emit,
|
|
417
|
+
ElTable,
|
|
398
418
|
hasColAdd,
|
|
399
419
|
formItemBindProps,
|
|
400
420
|
readonly,
|
|
@@ -409,29 +429,29 @@ var _sfc_main = /* @__PURE__ */vue.defineComponent({
|
|
|
409
429
|
handleEdit,
|
|
410
430
|
handleDialogFormChange,
|
|
411
431
|
handleFormSetData,
|
|
412
|
-
get Plus() {
|
|
413
|
-
return index.plus_default;
|
|
414
|
-
},
|
|
415
432
|
get Edit() {
|
|
416
433
|
return index.edit_default;
|
|
417
434
|
},
|
|
435
|
+
get Plus() {
|
|
436
|
+
return index.plus_default;
|
|
437
|
+
},
|
|
418
438
|
get VkfFormItem() {
|
|
419
439
|
return formItem.VkfFormItem;
|
|
420
440
|
},
|
|
441
|
+
get VkAvatar() {
|
|
442
|
+
return avatar.VkAvatar;
|
|
443
|
+
},
|
|
421
444
|
get VkTableColumns() {
|
|
422
445
|
return tableColumns.VkTableColumns;
|
|
423
446
|
},
|
|
424
|
-
get ElButton() {
|
|
425
|
-
return elementPlus.ElButton;
|
|
426
|
-
},
|
|
427
|
-
TemplatesLayout,
|
|
428
447
|
get CRUD() {
|
|
429
448
|
return _enum.CRUD;
|
|
430
449
|
},
|
|
431
|
-
get
|
|
432
|
-
return
|
|
450
|
+
get ElButton() {
|
|
451
|
+
return elementPlus.ElButton;
|
|
433
452
|
},
|
|
434
|
-
DialogForm
|
|
453
|
+
DialogForm,
|
|
454
|
+
TemplatesLayout
|
|
435
455
|
};
|
|
436
456
|
Object.defineProperty(__returned__, "__isScriptSetup", {
|
|
437
457
|
enumerable: false,
|
|
@@ -488,10 +508,12 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
488
508
|
_: 2
|
|
489
509
|
/* DYNAMIC */
|
|
490
510
|
}, [
|
|
491
|
-
|
|
511
|
+
_ctx.labelActions ? {
|
|
492
512
|
name: "labelActions",
|
|
493
513
|
fn: vue.withCtx(() => [
|
|
494
|
-
vue.
|
|
514
|
+
vue.renderSlot(_ctx.$slots, "labelActions"),
|
|
515
|
+
!$setup.readonly && _ctx.splicable ? (vue.openBlock(), vue.createBlock($setup["ElButton"], {
|
|
516
|
+
key: 0,
|
|
495
517
|
size: "small",
|
|
496
518
|
icon: $setup.Plus,
|
|
497
519
|
onClick: _cache[0] || (_cache[0] = ($event) => $setup.handlePlus(-1))
|
|
@@ -501,7 +523,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
501
523
|
])),
|
|
502
524
|
_: 1,
|
|
503
525
|
__: [4]
|
|
504
|
-
}, 8, ["icon"])
|
|
526
|
+
}, 8, ["icon"])) : vue.createCommentVNode("v-if", true)
|
|
505
527
|
]),
|
|
506
528
|
key: "0"
|
|
507
529
|
} : void 0
|
|
@@ -516,6 +538,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
516
538
|
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $setup.cuState.data = $event),
|
|
517
539
|
"form-items": $setup.cuFormItems,
|
|
518
540
|
"dialog-form-props": _ctx.dialogFormProps,
|
|
541
|
+
"validate-catch": _ctx.validateCatch,
|
|
519
542
|
onChange: $setup.handleDialogFormChange
|
|
520
543
|
}, {
|
|
521
544
|
header: vue.withCtx(() => [
|
|
@@ -534,10 +557,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
534
557
|
]),
|
|
535
558
|
_: 1
|
|
536
559
|
/* STABLE */
|
|
537
|
-
}, 8, ["visible", "modelValue", "form-items", "dialog-form-props"])
|
|
560
|
+
}, 8, ["visible", "modelValue", "form-items", "dialog-form-props", "validate-catch"])
|
|
538
561
|
]),
|
|
539
|
-
_:
|
|
540
|
-
/*
|
|
562
|
+
_: 3
|
|
563
|
+
/* FORWARDED */
|
|
541
564
|
}, 8, ["data"]),
|
|
542
565
|
vue.renderSlot(_ctx.$slots, "default")
|
|
543
566
|
],
|