@vunk/form 2.10.4 → 2.11.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/editable-text/index.cjs +12 -6
- package/components/editable-text/index.css +3 -0
- package/components/editable-text/index.mjs +12 -6
- package/components/form/index.cjs +12 -1
- package/components/form/index.mjs +12 -1
- package/components/form/src/ctx.d.ts +8 -1
- package/components/form/src/index.vue.d.ts +20 -0
- package/components/forms-provider/index.cjs +99 -0
- package/components/forms-provider/index.d.ts +6 -0
- package/components/forms-provider/index.mjs +91 -0
- package/components/forms-provider/src/core.d.ts +6 -0
- package/components/forms-provider/src/index.vue.d.ts +2 -0
- package/components/forms-provider/src/segment.vue.d.ts +9 -0
- package/components/forms-provider/src/types.d.ts +10 -0
- package/components/forms-provider/src/view.vue.d.ts +7 -0
- package/index.css +3 -0
- package/package.json +6 -1
|
@@ -61,7 +61,8 @@ const emits = {
|
|
|
61
61
|
|
|
62
62
|
var _sfc_main = /* @__PURE__ */vue.defineComponent({
|
|
63
63
|
...{
|
|
64
|
-
name: "VkfEditableText"
|
|
64
|
+
name: "VkfEditableText",
|
|
65
|
+
inheritAttrs: false
|
|
65
66
|
},
|
|
66
67
|
__name: "index",
|
|
67
68
|
props: props,
|
|
@@ -138,7 +139,6 @@ var _sfc_main = /* @__PURE__ */vue.defineComponent({
|
|
|
138
139
|
editable.value = false;
|
|
139
140
|
}).catch(() => {
|
|
140
141
|
console.warn("Validation failed, editable text remains open.");
|
|
141
|
-
handleCancel();
|
|
142
142
|
});
|
|
143
143
|
} else {
|
|
144
144
|
editable.value = false;
|
|
@@ -202,7 +202,10 @@ const _hoisted_1 = { class: "vkf-editable-text-actions" };
|
|
|
202
202
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
203
203
|
return $setup.readonly || !$setup.editable ? (vue.openBlock(), vue.createBlock(
|
|
204
204
|
$setup["VkfFormItem"],
|
|
205
|
-
vue.normalizeProps(vue.mergeProps({ key: 0 },
|
|
205
|
+
vue.normalizeProps(vue.mergeProps({ key: 0 }, {
|
|
206
|
+
...$setup.formItemBindProps,
|
|
207
|
+
..._ctx.$attrs
|
|
208
|
+
})),
|
|
206
209
|
{
|
|
207
210
|
default: vue.withCtx(() => [
|
|
208
211
|
vue.renderSlot(_ctx.$slots, "text", { handleEdit: $setup.handleEdit }, () => [
|
|
@@ -238,7 +241,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
238
241
|
default: vue.withCtx(() => [
|
|
239
242
|
vue.createVNode(
|
|
240
243
|
$setup["VkfFormItem"],
|
|
241
|
-
{
|
|
244
|
+
vue.mergeProps({
|
|
245
|
+
ref: "formItemContainerRef",
|
|
246
|
+
class: "vk-editable-text-edit-x"
|
|
247
|
+
}, _ctx.$attrs),
|
|
242
248
|
{
|
|
243
249
|
default: vue.withCtx(() => [
|
|
244
250
|
vue.createVNode($setup["VkfFormItemRenderer"], { source: $setup.editSource }, {
|
|
@@ -266,8 +272,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
266
272
|
_: 1
|
|
267
273
|
/* STABLE */
|
|
268
274
|
},
|
|
269
|
-
|
|
270
|
-
/*
|
|
275
|
+
16
|
|
276
|
+
/* FULL_PROPS */
|
|
271
277
|
)
|
|
272
278
|
]),
|
|
273
279
|
_: 1
|
|
@@ -57,7 +57,8 @@ const emits = {
|
|
|
57
57
|
|
|
58
58
|
var _sfc_main = /* @__PURE__ */defineComponent({
|
|
59
59
|
...{
|
|
60
|
-
name: "VkfEditableText"
|
|
60
|
+
name: "VkfEditableText",
|
|
61
|
+
inheritAttrs: false
|
|
61
62
|
},
|
|
62
63
|
__name: "index",
|
|
63
64
|
props: props,
|
|
@@ -134,7 +135,6 @@ var _sfc_main = /* @__PURE__ */defineComponent({
|
|
|
134
135
|
editable.value = false;
|
|
135
136
|
}).catch(() => {
|
|
136
137
|
console.warn("Validation failed, editable text remains open.");
|
|
137
|
-
handleCancel();
|
|
138
138
|
});
|
|
139
139
|
} else {
|
|
140
140
|
editable.value = false;
|
|
@@ -198,7 +198,10 @@ const _hoisted_1 = { class: "vkf-editable-text-actions" };
|
|
|
198
198
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
199
199
|
return $setup.readonly || !$setup.editable ? (openBlock(), createBlock(
|
|
200
200
|
$setup["VkfFormItem"],
|
|
201
|
-
normalizeProps(mergeProps({ key: 0 },
|
|
201
|
+
normalizeProps(mergeProps({ key: 0 }, {
|
|
202
|
+
...$setup.formItemBindProps,
|
|
203
|
+
..._ctx.$attrs
|
|
204
|
+
})),
|
|
202
205
|
{
|
|
203
206
|
default: withCtx(() => [
|
|
204
207
|
renderSlot(_ctx.$slots, "text", { handleEdit: $setup.handleEdit }, () => [
|
|
@@ -234,7 +237,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
234
237
|
default: withCtx(() => [
|
|
235
238
|
createVNode(
|
|
236
239
|
$setup["VkfFormItem"],
|
|
237
|
-
{
|
|
240
|
+
mergeProps({
|
|
241
|
+
ref: "formItemContainerRef",
|
|
242
|
+
class: "vk-editable-text-edit-x"
|
|
243
|
+
}, _ctx.$attrs),
|
|
238
244
|
{
|
|
239
245
|
default: withCtx(() => [
|
|
240
246
|
createVNode($setup["VkfFormItemRenderer"], { source: $setup.editSource }, {
|
|
@@ -262,8 +268,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
262
268
|
_: 1
|
|
263
269
|
/* STABLE */
|
|
264
270
|
},
|
|
265
|
-
|
|
266
|
-
/*
|
|
271
|
+
16
|
|
272
|
+
/* FULL_PROPS */
|
|
267
273
|
)
|
|
268
274
|
]),
|
|
269
275
|
_: 1
|
|
@@ -15,6 +15,7 @@ var utilsObject = require('@vunk/core/shared/utils-object');
|
|
|
15
15
|
var form = require('@vunk/form/shared/form');
|
|
16
16
|
var rendererData = require('@vunk/form/components/renderer-data');
|
|
17
17
|
var object = require('@vunk/shared/object');
|
|
18
|
+
var formsProvider = require('@vunk/form/components/forms-provider');
|
|
18
19
|
var _pluginVue_exportHelper = require('../_plugin-vue_export-helper.cjs');
|
|
19
20
|
|
|
20
21
|
const props = {
|
|
@@ -58,6 +59,13 @@ const props = {
|
|
|
58
59
|
colSource: {
|
|
59
60
|
type: Object,
|
|
60
61
|
default: () => ({})
|
|
62
|
+
},
|
|
63
|
+
/**
|
|
64
|
+
* 需要传递给 FormsProvider 的属性
|
|
65
|
+
*/
|
|
66
|
+
segmentAttrs: {
|
|
67
|
+
type: Object,
|
|
68
|
+
default: () => ({})
|
|
61
69
|
}
|
|
62
70
|
};
|
|
63
71
|
const createBindProps = utilsVue.bindPropsFactory(props);
|
|
@@ -118,7 +126,8 @@ var _sfc_main = vue.defineComponent({
|
|
|
118
126
|
ElForm: elementPlus.ElForm,
|
|
119
127
|
VkfFormItemRenderer: formItemRenderer.VkfFormItemRenderer,
|
|
120
128
|
VkfTemplatesDefault: templatesDefault.VkfTemplatesDefault,
|
|
121
|
-
VkfTemplatesLayout: templatesLayout.VkfTemplatesLayout
|
|
129
|
+
VkfTemplatesLayout: templatesLayout.VkfTemplatesLayout,
|
|
130
|
+
VkfFormsSegment: formsProvider.VkfFormsSegment
|
|
122
131
|
},
|
|
123
132
|
props,
|
|
124
133
|
emits,
|
|
@@ -182,6 +191,7 @@ var _sfc_main = vue.defineComponent({
|
|
|
182
191
|
});
|
|
183
192
|
|
|
184
193
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
194
|
+
const _component_VkfFormsSegment = vue.resolveComponent("VkfFormsSegment");
|
|
185
195
|
const _component_VkfTemplatesDefault = vue.resolveComponent("VkfTemplatesDefault");
|
|
186
196
|
const _component_VkfTemplatesLayout = vue.resolveComponent("VkfTemplatesLayout");
|
|
187
197
|
const _component_VkfFormItemRenderer = vue.resolveComponent("VkfFormItemRenderer");
|
|
@@ -200,6 +210,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
200
210
|
onSetData: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("setData", $event))
|
|
201
211
|
}, {
|
|
202
212
|
default: vue.withCtx(() => [
|
|
213
|
+
vue.createVNode(_component_VkfFormsSegment, vue.mergeProps({ data: _ctx.data }, _ctx.segmentAttrs), null, 16, ["data"]),
|
|
203
214
|
vue.createVNode(_component_VkfFormItemRenderer, { source: _ctx.rendererSource }, {
|
|
204
215
|
placeholder: vue.withCtx(() => [
|
|
205
216
|
vue.createVNode(_component_VkfTemplatesDefault),
|
|
@@ -11,6 +11,7 @@ import { pickObject } from '@vunk/core/shared/utils-object';
|
|
|
11
11
|
import { genTemplateIfFunc } from '@vunk/form/shared/form';
|
|
12
12
|
import { VkfRendererData } from '@vunk/form/components/renderer-data';
|
|
13
13
|
import { pickObject as pickObject$1 } from '@vunk/shared/object';
|
|
14
|
+
import { VkfFormsSegment } from '@vunk/form/components/forms-provider';
|
|
14
15
|
import { _ as _export_sfc } from '../_plugin-vue_export-helper.mjs';
|
|
15
16
|
|
|
16
17
|
const props = {
|
|
@@ -54,6 +55,13 @@ const props = {
|
|
|
54
55
|
colSource: {
|
|
55
56
|
type: Object,
|
|
56
57
|
default: () => ({})
|
|
58
|
+
},
|
|
59
|
+
/**
|
|
60
|
+
* 需要传递给 FormsProvider 的属性
|
|
61
|
+
*/
|
|
62
|
+
segmentAttrs: {
|
|
63
|
+
type: Object,
|
|
64
|
+
default: () => ({})
|
|
57
65
|
}
|
|
58
66
|
};
|
|
59
67
|
const createBindProps = bindPropsFactory(props);
|
|
@@ -114,7 +122,8 @@ var _sfc_main = defineComponent({
|
|
|
114
122
|
ElForm,
|
|
115
123
|
VkfFormItemRenderer,
|
|
116
124
|
VkfTemplatesDefault,
|
|
117
|
-
VkfTemplatesLayout
|
|
125
|
+
VkfTemplatesLayout,
|
|
126
|
+
VkfFormsSegment
|
|
118
127
|
},
|
|
119
128
|
props,
|
|
120
129
|
emits,
|
|
@@ -178,6 +187,7 @@ var _sfc_main = defineComponent({
|
|
|
178
187
|
});
|
|
179
188
|
|
|
180
189
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
190
|
+
const _component_VkfFormsSegment = resolveComponent("VkfFormsSegment");
|
|
181
191
|
const _component_VkfTemplatesDefault = resolveComponent("VkfTemplatesDefault");
|
|
182
192
|
const _component_VkfTemplatesLayout = resolveComponent("VkfTemplatesLayout");
|
|
183
193
|
const _component_VkfFormItemRenderer = resolveComponent("VkfFormItemRenderer");
|
|
@@ -196,6 +206,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
196
206
|
onSetData: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("setData", $event))
|
|
197
207
|
}, {
|
|
198
208
|
default: withCtx(() => [
|
|
209
|
+
createVNode(_component_VkfFormsSegment, mergeProps({ data: _ctx.data }, _ctx.segmentAttrs), null, 16, ["data"]),
|
|
199
210
|
createVNode(_component_VkfFormItemRenderer, { source: _ctx.rendererSource }, {
|
|
200
211
|
placeholder: withCtx(() => [
|
|
201
212
|
createVNode(_component_VkfTemplatesDefault),
|
|
@@ -43,6 +43,13 @@ export declare const props: {
|
|
|
43
43
|
type: PropType<Partial<ColItem>>;
|
|
44
44
|
default: () => ColItem;
|
|
45
45
|
};
|
|
46
|
+
/**
|
|
47
|
+
* 需要传递给 FormsProvider 的属性
|
|
48
|
+
*/
|
|
49
|
+
segmentAttrs: {
|
|
50
|
+
type: ObjectConstructor;
|
|
51
|
+
default: () => {};
|
|
52
|
+
};
|
|
46
53
|
model: ObjectConstructor;
|
|
47
54
|
rules: {
|
|
48
55
|
readonly type: PropType<Partial<Record<string, import("element-plus").FormItemRule | import("element-plus").FormItemRule[]>>>;
|
|
@@ -119,7 +126,7 @@ export declare const props: {
|
|
|
119
126
|
};
|
|
120
127
|
disabled: BooleanConstructor;
|
|
121
128
|
};
|
|
122
|
-
export declare const createBindProps: <T2 extends import("@vunk/core").NormalObject, EX extends (Extract<"size", keyof T2> | Extract<"elRef", keyof T2> | Extract<"inline", keyof T2> | Extract<"readonly", keyof T2> | Extract<"labelWidth", keyof T2> | Extract<"labelPosition", keyof T2> | Extract<"rules", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2> | Extract<"disabled", keyof T2> | Extract<"data", keyof T2> | Extract<"layout", keyof T2> | Extract<"model", keyof T2> | Extract<"requireAsteriskPosition", keyof T2> | Extract<"labelSuffix", keyof T2> | Extract<"statusIcon", keyof T2> | Extract<"validateOnRuleChange", keyof T2> | Extract<"hideRequiredAsterisk", keyof T2> | Extract<"scrollToError", keyof T2> | Extract<"scrollIntoViewOptions", keyof T2> | Extract<"formItems", keyof T2> | Extract<"rowSource", keyof T2> | Extract<"colSource", keyof T2>)[]>(propsArg: T2, excludes?: EX) => import("vue").ComputedRef<{ [P in EX extends (infer KE)[] ? Exclude<Extract<"size", keyof T2>, KE> | Exclude<Extract<"elRef", keyof T2>, KE> | Exclude<Extract<"inline", keyof T2>, KE> | Exclude<Extract<"readonly", keyof T2>, KE> | Exclude<Extract<"labelWidth", keyof T2>, KE> | Exclude<Extract<"labelPosition", keyof T2>, KE> | Exclude<Extract<"rules", keyof T2>, KE> | Exclude<Extract<"inlineMessage", keyof T2>, KE> | Exclude<Extract<"showMessage", keyof T2>, KE> | Exclude<Extract<"disabled", keyof T2>, KE> | Exclude<Extract<"data", keyof T2>, KE> | Exclude<Extract<"layout", keyof T2>, KE> | Exclude<Extract<"model", keyof T2>, KE> | Exclude<Extract<"requireAsteriskPosition", keyof T2>, KE> | Exclude<Extract<"labelSuffix", keyof T2>, KE> | Exclude<Extract<"statusIcon", keyof T2>, KE> | Exclude<Extract<"validateOnRuleChange", keyof T2>, KE> | Exclude<Extract<"hideRequiredAsterisk", keyof T2>, KE> | Exclude<Extract<"scrollToError", keyof T2>, KE> | Exclude<Extract<"scrollIntoViewOptions", keyof T2>, KE> | Exclude<Extract<"formItems", keyof T2>, KE> | Exclude<Extract<"rowSource", keyof T2>, KE> | Exclude<Extract<"colSource", keyof T2>, KE> : Extract<"size", keyof T2> | Extract<"elRef", keyof T2> | Extract<"inline", keyof T2> | Extract<"readonly", keyof T2> | Extract<"labelWidth", keyof T2> | Extract<"labelPosition", keyof T2> | Extract<"rules", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2> | Extract<"disabled", keyof T2> | Extract<"data", keyof T2> | Extract<"layout", keyof T2> | Extract<"model", keyof T2> | Extract<"requireAsteriskPosition", keyof T2> | Extract<"labelSuffix", keyof T2> | Extract<"statusIcon", keyof T2> | Extract<"validateOnRuleChange", keyof T2> | Extract<"hideRequiredAsterisk", keyof T2> | Extract<"scrollToError", keyof T2> | Extract<"scrollIntoViewOptions", keyof T2> | Extract<"formItems", keyof T2> | Extract<"rowSource", keyof T2> | Extract<"colSource", keyof T2>]: { [k in Extract<"size", keyof T2> | Extract<"elRef", keyof T2> | Extract<"inline", keyof T2> | Extract<"readonly", keyof T2> | Extract<"labelWidth", keyof T2> | Extract<"labelPosition", keyof T2> | Extract<"rules", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2> | Extract<"disabled", keyof T2> | Extract<"data", keyof T2> | Extract<"layout", keyof T2> | Extract<"model", keyof T2> | Extract<"requireAsteriskPosition", keyof T2> | Extract<"labelSuffix", keyof T2> | Extract<"statusIcon", keyof T2> | Extract<"validateOnRuleChange", keyof T2> | Extract<"hideRequiredAsterisk", keyof T2> | Extract<"scrollToError", keyof T2> | Extract<"scrollIntoViewOptions", keyof T2> | Extract<"formItems", keyof T2> | Extract<"rowSource", keyof T2> | Extract<"colSource", keyof T2>]: T2[k]; }[P]; }>;
|
|
129
|
+
export declare const createBindProps: <T2 extends import("@vunk/core").NormalObject, EX extends (Extract<"size", keyof T2> | Extract<"elRef", keyof T2> | Extract<"inline", keyof T2> | Extract<"readonly", keyof T2> | Extract<"labelWidth", keyof T2> | Extract<"labelPosition", keyof T2> | Extract<"rules", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2> | Extract<"disabled", keyof T2> | Extract<"data", keyof T2> | Extract<"layout", keyof T2> | Extract<"model", keyof T2> | Extract<"requireAsteriskPosition", keyof T2> | Extract<"labelSuffix", keyof T2> | Extract<"statusIcon", keyof T2> | Extract<"validateOnRuleChange", keyof T2> | Extract<"hideRequiredAsterisk", keyof T2> | Extract<"scrollToError", keyof T2> | Extract<"scrollIntoViewOptions", keyof T2> | Extract<"formItems", keyof T2> | Extract<"rowSource", keyof T2> | Extract<"colSource", keyof T2> | Extract<"segmentAttrs", keyof T2>)[]>(propsArg: T2, excludes?: EX) => import("vue").ComputedRef<{ [P in EX extends (infer KE)[] ? Exclude<Extract<"size", keyof T2>, KE> | Exclude<Extract<"elRef", keyof T2>, KE> | Exclude<Extract<"inline", keyof T2>, KE> | Exclude<Extract<"readonly", keyof T2>, KE> | Exclude<Extract<"labelWidth", keyof T2>, KE> | Exclude<Extract<"labelPosition", keyof T2>, KE> | Exclude<Extract<"rules", keyof T2>, KE> | Exclude<Extract<"inlineMessage", keyof T2>, KE> | Exclude<Extract<"showMessage", keyof T2>, KE> | Exclude<Extract<"disabled", keyof T2>, KE> | Exclude<Extract<"data", keyof T2>, KE> | Exclude<Extract<"layout", keyof T2>, KE> | Exclude<Extract<"model", keyof T2>, KE> | Exclude<Extract<"requireAsteriskPosition", keyof T2>, KE> | Exclude<Extract<"labelSuffix", keyof T2>, KE> | Exclude<Extract<"statusIcon", keyof T2>, KE> | Exclude<Extract<"validateOnRuleChange", keyof T2>, KE> | Exclude<Extract<"hideRequiredAsterisk", keyof T2>, KE> | Exclude<Extract<"scrollToError", keyof T2>, KE> | Exclude<Extract<"scrollIntoViewOptions", keyof T2>, KE> | Exclude<Extract<"formItems", keyof T2>, KE> | Exclude<Extract<"rowSource", keyof T2>, KE> | Exclude<Extract<"colSource", keyof T2>, KE> | Exclude<Extract<"segmentAttrs", keyof T2>, KE> : Extract<"size", keyof T2> | Extract<"elRef", keyof T2> | Extract<"inline", keyof T2> | Extract<"readonly", keyof T2> | Extract<"labelWidth", keyof T2> | Extract<"labelPosition", keyof T2> | Extract<"rules", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2> | Extract<"disabled", keyof T2> | Extract<"data", keyof T2> | Extract<"layout", keyof T2> | Extract<"model", keyof T2> | Extract<"requireAsteriskPosition", keyof T2> | Extract<"labelSuffix", keyof T2> | Extract<"statusIcon", keyof T2> | Extract<"validateOnRuleChange", keyof T2> | Extract<"hideRequiredAsterisk", keyof T2> | Extract<"scrollToError", keyof T2> | Extract<"scrollIntoViewOptions", keyof T2> | Extract<"formItems", keyof T2> | Extract<"rowSource", keyof T2> | Extract<"colSource", keyof T2> | Extract<"segmentAttrs", keyof T2>]: { [k in Extract<"size", keyof T2> | Extract<"elRef", keyof T2> | Extract<"inline", keyof T2> | Extract<"readonly", keyof T2> | Extract<"labelWidth", keyof T2> | Extract<"labelPosition", keyof T2> | Extract<"rules", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2> | Extract<"disabled", keyof T2> | Extract<"data", keyof T2> | Extract<"layout", keyof T2> | Extract<"model", keyof T2> | Extract<"requireAsteriskPosition", keyof T2> | Extract<"labelSuffix", keyof T2> | Extract<"statusIcon", keyof T2> | Extract<"validateOnRuleChange", keyof T2> | Extract<"hideRequiredAsterisk", keyof T2> | Extract<"scrollToError", keyof T2> | Extract<"scrollIntoViewOptions", keyof T2> | Extract<"formItems", keyof T2> | Extract<"rowSource", keyof T2> | Extract<"colSource", keyof T2> | Extract<"segmentAttrs", keyof T2>]: T2[k]; }[P]; }>;
|
|
123
130
|
export declare const emits: {
|
|
124
131
|
setData: (e: SetDataEvent) => SetDataEvent;
|
|
125
132
|
validate: any;
|
|
@@ -28,6 +28,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
28
28
|
type: import("vue").PropType<Partial<import("./types").ColItem>>;
|
|
29
29
|
default: () => import("./types").ColItem;
|
|
30
30
|
};
|
|
31
|
+
segmentAttrs: {
|
|
32
|
+
type: ObjectConstructor;
|
|
33
|
+
default: () => {};
|
|
34
|
+
};
|
|
31
35
|
model: ObjectConstructor;
|
|
32
36
|
rules: {
|
|
33
37
|
readonly type: import("vue").PropType<Partial<Record<string, import("element-plus").FormItemRule | import("element-plus").FormItemRule[]>>>;
|
|
@@ -159,6 +163,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
159
163
|
type: import("vue").PropType<Partial<import("./types").ColItem>>;
|
|
160
164
|
default: () => import("./types").ColItem;
|
|
161
165
|
};
|
|
166
|
+
segmentAttrs: {
|
|
167
|
+
type: ObjectConstructor;
|
|
168
|
+
default: () => {};
|
|
169
|
+
};
|
|
162
170
|
model: ObjectConstructor;
|
|
163
171
|
rules: {
|
|
164
172
|
readonly type: import("vue").PropType<Partial<Record<string, import("element-plus").FormItemRule | import("element-plus").FormItemRule[]>>>;
|
|
@@ -1673,6 +1681,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
1673
1681
|
formItems: any[];
|
|
1674
1682
|
rowSource: Partial<RowItem>;
|
|
1675
1683
|
colSource: Partial<import("./types").ColItem>;
|
|
1684
|
+
segmentAttrs: Record<string, any>;
|
|
1676
1685
|
}, {}, {
|
|
1677
1686
|
VkfRendererData: {
|
|
1678
1687
|
new (...args: any[]): any;
|
|
@@ -4003,5 +4012,16 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
4003
4012
|
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & {
|
|
4004
4013
|
install(app: import("vue").App): void;
|
|
4005
4014
|
};
|
|
4015
|
+
VkfFormsSegment: {
|
|
4016
|
+
new (...args: any[]): any;
|
|
4017
|
+
__isFragment?: never;
|
|
4018
|
+
__isTeleport?: never;
|
|
4019
|
+
__isSuspense?: never;
|
|
4020
|
+
} & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<Record<string | symbol, any>>>, Record<string | symbol, any>, any, import("vue").ComputedOptions, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
|
|
4021
|
+
[x: string]: any;
|
|
4022
|
+
[x: symbol]: any;
|
|
4023
|
+
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & {
|
|
4024
|
+
install(app: import("vue").App): void;
|
|
4025
|
+
};
|
|
4006
4026
|
}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
4007
4027
|
export default _default;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var segmentRenderer = require('@vunk/core/components/segment-renderer');
|
|
6
|
+
var _pluginVue_exportHelper = require('../_plugin-vue_export-helper.cjs');
|
|
7
|
+
var vue = require('vue');
|
|
8
|
+
var elementPlus = require('element-plus');
|
|
9
|
+
|
|
10
|
+
const {
|
|
11
|
+
SegmentRenderer,
|
|
12
|
+
Segment,
|
|
13
|
+
SegmentView,
|
|
14
|
+
useSegmentRendererContext
|
|
15
|
+
} = segmentRenderer.createSegmentRenderer("@vunk/form:provider");
|
|
16
|
+
|
|
17
|
+
SegmentRenderer.name = "VkfFormsProvider";
|
|
18
|
+
|
|
19
|
+
var VkfFormsProvider = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(SegmentRenderer, [["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/forms-provider/src/index.vue"]]);
|
|
20
|
+
|
|
21
|
+
var types = /*#__PURE__*/Object.freeze({
|
|
22
|
+
__proto__: null
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
var _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
26
|
+
...{
|
|
27
|
+
name: "VkfFormsSegment",
|
|
28
|
+
inheritAttrs: false
|
|
29
|
+
},
|
|
30
|
+
__name: "segment",
|
|
31
|
+
setup(__props, { expose: __expose }) {
|
|
32
|
+
__expose();
|
|
33
|
+
function trySegmentRendererContext() {
|
|
34
|
+
try {
|
|
35
|
+
return useSegmentRendererContext();
|
|
36
|
+
} catch {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const segmentRendererContext = trySegmentRendererContext();
|
|
41
|
+
const formContext = vue.inject(elementPlus.formContextKey);
|
|
42
|
+
const validate = async (callback) => formContext.validateField(
|
|
43
|
+
void 0,
|
|
44
|
+
callback
|
|
45
|
+
);
|
|
46
|
+
const __returned__ = { trySegmentRendererContext, segmentRendererContext, formContext, validate, get Segment() {
|
|
47
|
+
return Segment;
|
|
48
|
+
} };
|
|
49
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
50
|
+
return __returned__;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
55
|
+
return $setup.segmentRendererContext ? (vue.openBlock(), vue.createBlock($setup["Segment"], vue.mergeProps({
|
|
56
|
+
key: 0,
|
|
57
|
+
validate: $setup.validate,
|
|
58
|
+
form: $setup.formContext
|
|
59
|
+
}, _ctx.$attrs), null, 16, ["form"])) : vue.renderSlot(_ctx.$slots, "default", { key: 1 });
|
|
60
|
+
}
|
|
61
|
+
var segment = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/forms-provider/src/segment.vue"]]);
|
|
62
|
+
|
|
63
|
+
var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
64
|
+
__name: "view",
|
|
65
|
+
setup(__props, { expose: __expose }) {
|
|
66
|
+
const segmentRendererContext = useSegmentRendererContext();
|
|
67
|
+
const forms = vue.computed(() => {
|
|
68
|
+
return segmentRendererContext.items.map((item) => {
|
|
69
|
+
return item.attrs;
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
async function validate() {
|
|
73
|
+
return Promise.all(
|
|
74
|
+
forms.value.map((form) => form.validate?.())
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
__expose({
|
|
78
|
+
forms: forms.value,
|
|
79
|
+
validate
|
|
80
|
+
});
|
|
81
|
+
const __returned__ = { segmentRendererContext, forms, validate };
|
|
82
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
83
|
+
return __returned__;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
88
|
+
return vue.renderSlot(_ctx.$slots, "default", {
|
|
89
|
+
forms: $setup.forms,
|
|
90
|
+
validate: $setup.validate
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
var view = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/forms-provider/src/view.vue"]]);
|
|
94
|
+
|
|
95
|
+
exports.VkfFormsProvider = VkfFormsProvider;
|
|
96
|
+
exports.VkfFormsSegment = segment;
|
|
97
|
+
exports.VkfFormsView = view;
|
|
98
|
+
exports.__VkfFormsProvider = types;
|
|
99
|
+
exports.default = VkfFormsProvider;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import VkfFormsProvider from './src/index.vue';
|
|
2
|
+
export * as __VkfFormsProvider from './src/types';
|
|
3
|
+
import VkfFormsSegment from './src/segment.vue';
|
|
4
|
+
import VkfFormsView from './src/view.vue';
|
|
5
|
+
export { VkfFormsProvider, VkfFormsSegment, VkfFormsView, };
|
|
6
|
+
export default VkfFormsProvider;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { createSegmentRenderer } from '@vunk/core/components/segment-renderer';
|
|
2
|
+
import { _ as _export_sfc } from '../_plugin-vue_export-helper.mjs';
|
|
3
|
+
import { defineComponent, inject, openBlock, createBlock, mergeProps, renderSlot, computed } from 'vue';
|
|
4
|
+
import { formContextKey } from 'element-plus';
|
|
5
|
+
|
|
6
|
+
const {
|
|
7
|
+
SegmentRenderer,
|
|
8
|
+
Segment,
|
|
9
|
+
SegmentView,
|
|
10
|
+
useSegmentRendererContext
|
|
11
|
+
} = createSegmentRenderer("@vunk/form:provider");
|
|
12
|
+
|
|
13
|
+
SegmentRenderer.name = "VkfFormsProvider";
|
|
14
|
+
|
|
15
|
+
var VkfFormsProvider = /* @__PURE__ */ _export_sfc(SegmentRenderer, [["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/forms-provider/src/index.vue"]]);
|
|
16
|
+
|
|
17
|
+
var types = /*#__PURE__*/Object.freeze({
|
|
18
|
+
__proto__: null
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
var _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
22
|
+
...{
|
|
23
|
+
name: "VkfFormsSegment",
|
|
24
|
+
inheritAttrs: false
|
|
25
|
+
},
|
|
26
|
+
__name: "segment",
|
|
27
|
+
setup(__props, { expose: __expose }) {
|
|
28
|
+
__expose();
|
|
29
|
+
function trySegmentRendererContext() {
|
|
30
|
+
try {
|
|
31
|
+
return useSegmentRendererContext();
|
|
32
|
+
} catch {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const segmentRendererContext = trySegmentRendererContext();
|
|
37
|
+
const formContext = inject(formContextKey);
|
|
38
|
+
const validate = async (callback) => formContext.validateField(
|
|
39
|
+
void 0,
|
|
40
|
+
callback
|
|
41
|
+
);
|
|
42
|
+
const __returned__ = { trySegmentRendererContext, segmentRendererContext, formContext, validate, get Segment() {
|
|
43
|
+
return Segment;
|
|
44
|
+
} };
|
|
45
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
46
|
+
return __returned__;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
51
|
+
return $setup.segmentRendererContext ? (openBlock(), createBlock($setup["Segment"], mergeProps({
|
|
52
|
+
key: 0,
|
|
53
|
+
validate: $setup.validate,
|
|
54
|
+
form: $setup.formContext
|
|
55
|
+
}, _ctx.$attrs), null, 16, ["form"])) : renderSlot(_ctx.$slots, "default", { key: 1 });
|
|
56
|
+
}
|
|
57
|
+
var segment = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/forms-provider/src/segment.vue"]]);
|
|
58
|
+
|
|
59
|
+
var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
60
|
+
__name: "view",
|
|
61
|
+
setup(__props, { expose: __expose }) {
|
|
62
|
+
const segmentRendererContext = useSegmentRendererContext();
|
|
63
|
+
const forms = computed(() => {
|
|
64
|
+
return segmentRendererContext.items.map((item) => {
|
|
65
|
+
return item.attrs;
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
async function validate() {
|
|
69
|
+
return Promise.all(
|
|
70
|
+
forms.value.map((form) => form.validate?.())
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
__expose({
|
|
74
|
+
forms: forms.value,
|
|
75
|
+
validate
|
|
76
|
+
});
|
|
77
|
+
const __returned__ = { segmentRendererContext, forms, validate };
|
|
78
|
+
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
|
79
|
+
return __returned__;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
84
|
+
return renderSlot(_ctx.$slots, "default", {
|
|
85
|
+
forms: $setup.forms,
|
|
86
|
+
validate: $setup.validate
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
var view = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/private-vunk-form/private-vunk-form/packages/components/forms-provider/src/view.vue"]]);
|
|
90
|
+
|
|
91
|
+
export { VkfFormsProvider, segment as VkfFormsSegment, view as VkfFormsView, types as __VkfFormsProvider, VkfFormsProvider as default };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
declare const SegmentRenderer: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
2
|
+
[key: string]: any;
|
|
3
|
+
}>[], {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, Segment: import("vue").DefineComponent<{}, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, SegmentView: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
}>[], {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, useSegmentRendererContext: () => import("@vunk/core/components/segment-renderer/src/types").SegmentRendererContext;
|
|
6
|
+
export { SegmentRenderer, Segment, SegmentView, useSegmentRendererContext, };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FormContext, FormValidateCallback, FormValidationResult } from 'element-plus';
|
|
2
|
+
declare const _default: import("vue").DefineComponent<{}, {
|
|
3
|
+
trySegmentRendererContext: () => import("@vunk/core/components/segment-renderer/src/types").SegmentRendererContext;
|
|
4
|
+
segmentRendererContext: import("@vunk/core/components/segment-renderer/src/types").SegmentRendererContext;
|
|
5
|
+
formContext: FormContext;
|
|
6
|
+
validate: (callback?: FormValidateCallback) => FormValidationResult;
|
|
7
|
+
readonly Segment: import("vue").DefineComponent<{}, () => any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
8
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FormContext, FormValidateCallback, FormValidationResult } from 'element-plus';
|
|
2
|
+
export interface SegmentAttrs {
|
|
3
|
+
form: FormContext;
|
|
4
|
+
validate: (callback?: FormValidateCallback) => FormValidationResult;
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
}
|
|
7
|
+
export interface ViewRef {
|
|
8
|
+
forms: SegmentAttrs[];
|
|
9
|
+
validate: () => Promise<FormValidationResult[]>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SegmentAttrs } from './types';
|
|
2
|
+
declare const _default: import("vue").DefineComponent<{}, {
|
|
3
|
+
segmentRendererContext: import("@vunk/core/components/segment-renderer/src/types").SegmentRendererContext;
|
|
4
|
+
forms: import("vue").ComputedRef<SegmentAttrs[]>;
|
|
5
|
+
validate: () => Promise<boolean[]>;
|
|
6
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
7
|
+
export default _default;
|
package/index.css
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vunk/form",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.esm.js",
|
|
6
6
|
"scripts": {
|
|
@@ -225,6 +225,11 @@
|
|
|
225
225
|
"types": "./components/information/index.d.ts",
|
|
226
226
|
"require": "./components/information/index.cjs"
|
|
227
227
|
},
|
|
228
|
+
"./components/forms-provider": {
|
|
229
|
+
"import": "./components/forms-provider/index.mjs",
|
|
230
|
+
"types": "./components/forms-provider/index.d.ts",
|
|
231
|
+
"require": "./components/forms-provider/index.cjs"
|
|
232
|
+
},
|
|
228
233
|
"./components/form-item-renderer-template": {
|
|
229
234
|
"import": "./components/form-item-renderer-template/index.mjs",
|
|
230
235
|
"types": "./components/form-item-renderer-template/index.d.ts",
|