@vunk/form 2.19.20 → 2.19.21
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/ai-provider/index.cjs +1 -0
- package/components/ai-provider/index.d.ts +7 -0
- package/components/ai-provider/index.mjs +61 -0
- package/components/ai-provider/src/ctx.d.ts +8 -0
- package/components/ai-provider/src/index.vue.d.ts +23 -0
- package/components/ai-provider/src/types.d.ts +56 -0
- package/components/ai-provider/src/use.d.ts +3 -0
- package/components/api-tables-select/index.cjs +1 -1
- package/components/api-tables-select/index.mjs +1 -1
- package/components/api-tables-select/src/ctx.d.ts +57 -57
- package/components/api-tables-select/src/index.vue.d.ts +46 -419
- package/components/button/index.cjs +1 -1
- package/components/button/index.mjs +12 -12
- package/components/button/src/ctx.d.ts +7 -2
- package/components/button/src/index.vue.d.ts +36 -14
- package/components/card-input-collection/index.cjs +1 -1
- package/components/card-input-collection/index.mjs +136 -141
- package/components/card-input-collection/src/core.vue.d.ts +18 -7
- package/components/card-input-collection/src/ctx.d.ts +7 -2
- package/components/card-input-collection/src/index.vue.d.ts +18 -7
- package/components/cascader/index.cjs +1 -1
- package/components/cascader/index.mjs +38 -39
- package/components/cascader/src/ctx.d.ts +8 -3
- package/components/cascader/src/index.vue.d.ts +19 -8
- package/components/checkbox/src/ctx.d.ts +8 -3
- package/components/checkbox/src/index.vue.d.ts +43 -21
- package/components/{cloneDeep-DE0l40hv.mjs → cloneDeep-2YeQ7w2t.mjs} +10 -10
- package/components/cloneDeep-Btpy0oPF.js +1 -0
- package/components/collapse/index.cjs +1 -1
- package/components/collapse/index.mjs +19 -22
- package/components/collapse-item/index.cjs +1 -1
- package/components/collapse-item/index.mjs +21 -21
- package/components/collapse-item/src/index.vue.d.ts +2 -2
- package/components/color-picker/index.cjs +1 -1
- package/components/color-picker/index.mjs +26 -27
- package/components/color-picker/src/ctx.d.ts +7 -2
- package/components/color-picker/src/index.vue.d.ts +17 -6
- package/components/{style.css → components.css} +1 -1
- package/components/date-picker/index.cjs +1 -1
- package/components/date-picker/index.mjs +40 -41
- package/components/date-picker/src/ctx.d.ts +8 -3
- package/components/date-picker/src/index.vue.d.ts +17 -6
- package/components/date-picker-range/index.cjs +1 -1
- package/components/date-picker-range/index.mjs +17 -17
- package/components/date-picker-range/src/ctx.d.ts +14 -9
- package/components/date-picker-range/src/index.vue.d.ts +48 -26
- package/components/dialog/index.cjs +1 -1
- package/components/dialog/index.mjs +41 -52
- package/components/dialog/src/ctx.d.ts +1 -1
- package/components/dialog/src/index.vue.d.ts +1 -1
- package/components/dialog-input-collection/index.cjs +1 -1
- package/components/dialog-input-collection/index.mjs +124 -122
- package/components/dialog-input-collection/src/ctx.d.ts +7 -2
- package/components/dialog-input-collection/src/dialog-form.vue.d.ts +1 -1
- package/components/dialog-input-collection/src/index.vue.d.ts +17 -6
- package/components/download-plus/index.cjs +1 -1
- package/components/download-plus/index.mjs +193 -202
- package/components/download-plus/src/ctx.d.ts +7 -2
- package/components/download-plus/src/index.vue.d.ts +32 -10
- package/components/editable-text/index.cjs +1 -1
- package/components/editable-text/index.mjs +72 -75
- package/components/editable-text/src/ctx.d.ts +7 -2
- package/components/editable-text/src/index.vue.d.ts +18 -7
- package/components/el-slider/index.cjs +1 -1
- package/components/el-slider/index.mjs +230 -233
- package/components/el-slider/src/composables/index.cjs +1 -1
- package/components/el-slider/src/composables/index.mjs +1 -1
- package/components/el-slider/src/slider-core.vue.d.ts +3 -3
- package/components/esri-input-geojson/index.cjs +1 -5
- package/components/esri-input-geojson/index.mjs +59 -68
- package/components/esri-input-geojson/src/append.vue.d.ts +2 -2
- package/components/esri-input-geojson/src/ctx.d.ts +9 -4
- package/components/esri-input-geojson/src/index.vue.d.ts +65 -30
- package/components/fieldset/src/index.vue.d.ts +1 -1
- package/components/form/index.cjs +1 -1
- package/components/form/index.mjs +96 -101
- package/components/form/src/ctx.d.ts +2 -2
- package/components/form/src/index.vue.d.ts +4 -4
- package/components/form/src/use.d.ts +2 -2
- package/components/form-item/index.cjs +1 -1
- package/components/form-item/index.mjs +179 -107
- package/components/form-item/src/core.vue.d.ts +7 -3
- package/components/form-item/src/ctx.d.ts +7 -1
- package/components/form-item/src/index.vue.d.ts +13 -2
- package/components/form-item/src/use.d.ts +11 -0
- package/components/form-item-renderer/index.cjs +1 -1
- package/components/form-item-renderer/index.d.ts +1 -0
- package/components/form-item-renderer/index.mjs +85 -78
- package/components/form-item-renderer/src/use.d.ts +3 -0
- package/components/forms-provider/index.cjs +1 -1
- package/components/forms-provider/index.mjs +18 -21
- package/components/index-BIo_4rr_.mjs +18620 -0
- package/components/index-Bc7UifHG.js +1 -0
- package/components/index-D0D9ABpH.js +108 -0
- package/components/{index-CeHbpfCD.mjs → index-DCNYT7Wv.mjs} +0 -1
- package/components/information-collection/index.cjs +1 -1
- package/components/information-collection/index.mjs +32 -38
- package/components/information-collection/src/ctx.d.ts +7 -2
- package/components/information-collection/src/index.vue.d.ts +17 -6
- package/components/information-tag/index.cjs +1 -1
- package/components/information-tag/index.mjs +9 -12
- package/components/information-tag/src/index.vue.d.ts +1 -1
- package/components/input/index.cjs +1 -1
- package/components/input/index.mjs +27 -27
- package/components/input/src/ctx.d.ts +9 -4
- package/components/input/src/index.vue.d.ts +35 -13
- package/components/input-array/index.cjs +1 -1
- package/components/input-array/index.mjs +71 -74
- package/components/input-array/src/ctx.d.ts +7 -2
- package/components/input-array/src/index.vue.d.ts +18 -7
- package/components/input-collection/index.cjs +1 -1
- package/components/input-collection/index.mjs +121 -126
- package/components/input-collection/src/core.vue.d.ts +17 -6
- package/components/input-collection/src/ctx.d.ts +7 -2
- package/components/input-collection/src/index.vue.d.ts +17 -6
- package/components/input-file/src/index.vue.d.ts +19 -8
- package/components/input-link/index.cjs +1 -1
- package/components/input-link/index.mjs +1 -1
- package/components/input-link/src/ctx.d.ts +7 -2
- package/components/input-link/src/index.vue.d.ts +54 -21
- package/components/input-number/index.cjs +1 -1
- package/components/input-number/index.mjs +30 -33
- package/components/input-number/src/ctx.d.ts +8 -3
- package/components/input-number/src/index.vue.d.ts +33 -11
- package/components/input-tag/index.cjs +1 -1
- package/components/input-tag/index.mjs +24 -24
- package/components/input-tag/src/ctx.d.ts +9 -4
- package/components/input-tag/src/index.vue.d.ts +33 -11
- package/components/monaco-editor/src/ctx.d.ts +8 -3
- package/components/monaco-editor/src/index.vue.d.ts +38 -16
- package/components/radio/src/ctx.d.ts +7 -2
- package/components/radio/src/index.vue.d.ts +40 -18
- package/components/radio/src/wraper.vue.d.ts +22 -11
- package/components/renderer-data/index.cjs +1 -1
- package/components/renderer-data/index.mjs +14 -17
- package/components/select/index.cjs +1 -1
- package/components/select/index.mjs +167 -131
- package/components/select/src/core.vue.d.ts +96 -69
- package/components/select/src/ctx.d.ts +9 -4
- package/components/select/src/index.vue.d.ts +53 -42
- package/components/slider/index.cjs +1 -1
- package/components/slider/index.mjs +30 -31
- package/components/slider/src/ctx.d.ts +7 -2
- package/components/slider/src/index.vue.d.ts +18 -7
- package/components/switch/src/ctx.d.ts +7 -2
- package/components/switch/src/index.vue.d.ts +18 -7
- package/components/tables-select/index.cjs +1 -1
- package/components/tables-select/index.mjs +4 -4
- package/components/tables-select/src/ctx.d.ts +68 -68
- package/components/tables-select/src/index.vue.d.ts +52 -420
- package/components/template-instances-provider/index.cjs +1 -1
- package/components/template-instances-provider/index.mjs +11 -17
- package/components/templates-default/src/index.vue.d.ts +404 -185
- package/components/templates-esri/src/index.vue.d.ts +65 -30
- package/components/templates-variant/src/index.vue.d.ts +48 -26
- package/components/time-picker/index.cjs +1 -1
- package/components/time-picker/index.mjs +38 -39
- package/components/time-picker/src/ctx.d.ts +8 -3
- package/components/time-picker/src/index.vue.d.ts +17 -6
- package/components/upload/index.cjs +1 -1
- package/components/upload/index.mjs +244 -253
- package/components/upload/src/ctx.d.ts +8 -3
- package/components/upload/src/file.vue.d.ts +3 -3
- package/components/upload/src/index.vue.d.ts +37 -15
- package/components/upload/src/wraper.vue.d.ts +19 -8
- package/components/upload-plus/index.cjs +7 -15
- package/components/upload-plus/index.mjs +1879 -1897
- package/components/upload-plus/src/ctx.d.ts +7 -2
- package/components/upload-plus/src/index.vue.d.ts +18 -7
- package/components/use-watch-C3iIa2DX.js +1 -0
- package/components/use-watch-Dp64x0si.mjs +411 -0
- package/components/van-cascader/src/ctx.d.ts +7 -2
- package/components/van-cascader/src/index.vue.d.ts +19 -8
- package/components/var-datetime-picker/src/ctx.d.ts +7 -2
- package/components/var-datetime-picker/src/index.vue.d.ts +30 -8
- package/components/vditor/src/ctx.d.ts +7 -2
- package/components/vditor/src/index.vue.d.ts +41 -19
- package/composables/element-plus/index.cjs +1 -1
- package/composables/element-plus/index.mjs +10 -10
- package/composables/form-mitt/index.mjs +1 -1
- package/composables/index.cjs +1 -1
- package/composables/index.mjs +53 -53
- package/index.css +1 -1
- package/locale/index.cjs +1 -1
- package/locale/index.mjs +8 -5
- package/locale/lang/ar.d.ts +1 -0
- package/locale/lang/en.d.ts +1 -0
- package/locale/lang/zh-cn.d.ts +1 -0
- package/package.json +9 -1
- package/shared/element-plus/ctx.d.ts +16 -16
- package/shared/types/source/index.d.ts +5 -0
- package/shared/upload/index.cjs +1 -1
- package/shared/upload/index.mjs +166 -165
- package/components/cloneDeep-DaYwfXwD.js +0 -1
- package/components/index-BBriTmQP.js +0 -1
- package/components/use-watch-Bfrz9pv_.js +0 -1
- package/components/use-watch-t49wP7jy.mjs +0 -414
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { formProps as
|
|
2
|
-
import { bindPropsFactory as
|
|
3
|
-
import { NOOP as
|
|
4
|
-
import { defineComponent as
|
|
5
|
-
import { VkfFormItemRenderer as
|
|
6
|
-
import { createFormBindProps as
|
|
7
|
-
import { getValue as
|
|
8
|
-
import { VkfTemplatesDefault as
|
|
9
|
-
import { VkfTemplatesLayout as
|
|
10
|
-
import { pickObject as
|
|
11
|
-
import { genTemplateIfFunc as
|
|
12
|
-
import { VkfRendererData as
|
|
13
|
-
import { pickObject as
|
|
14
|
-
import { VkfFormsSegment as
|
|
15
|
-
import { noop as
|
|
16
|
-
import { initFormMitt as
|
|
17
|
-
import { useFormMitt as
|
|
18
|
-
import { _ as
|
|
19
|
-
const
|
|
20
|
-
...
|
|
1
|
+
import { formProps as w, formEmits as v, formContextKey as R, ElForm as h } from "element-plus";
|
|
2
|
+
import { bindPropsFactory as O, onEmitsFactory as I } from "@vunk/core/shared/utils-vue";
|
|
3
|
+
import { NOOP as C } from "@vunk/core/shared/utils-function";
|
|
4
|
+
import { defineComponent as E, inject as T, computed as y, provide as F, reactive as j, toRefs as D, renderSlot as S, shallowRef as L, getCurrentInstance as $, resolveComponent as f, openBlock as A, createBlock as B, mergeProps as g, toHandlers as M, withCtx as c, createVNode as u } from "vue";
|
|
5
|
+
import { VkfFormItemRenderer as q } from "@vunk/form/components/form-item-renderer";
|
|
6
|
+
import { createFormBindProps as z, createFormOnEmits as N } from "@vunk/form/shared/element-plus";
|
|
7
|
+
import { getValue as H } from "@vunk/core/shared/helper";
|
|
8
|
+
import { VkfTemplatesDefault as K } from "@vunk/form/components/templates-default";
|
|
9
|
+
import { VkfTemplatesLayout as G } from "@vunk/form/components/templates-layout";
|
|
10
|
+
import { pickObject as J } from "@vunk/core/shared/utils-object";
|
|
11
|
+
import { genTemplateIfFunc as Q } from "@vunk/form/shared/form";
|
|
12
|
+
import { VkfRendererData as U } from "@vunk/form/components/renderer-data";
|
|
13
|
+
import { pickObject as W } from "@vunk/shared/object";
|
|
14
|
+
import { VkfFormsSegment as X } from "@vunk/form/components/forms-provider";
|
|
15
|
+
import { noop as Y } from "@vunk/shared/function";
|
|
16
|
+
import { initFormMitt as Z } from "@vunk/form/composables/form-mitt";
|
|
17
|
+
import { useFormMitt as Te } from "@vunk/form/composables/form-mitt";
|
|
18
|
+
import { _ as x } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
19
|
+
const V = {
|
|
20
|
+
...w,
|
|
21
21
|
labelPosition: {
|
|
22
22
|
type: String,
|
|
23
23
|
default: void 0
|
|
@@ -35,7 +35,7 @@ const _ = {
|
|
|
35
35
|
},
|
|
36
36
|
elRef: {
|
|
37
37
|
type: Function,
|
|
38
|
-
default: () =>
|
|
38
|
+
default: () => C
|
|
39
39
|
},
|
|
40
40
|
/**
|
|
41
41
|
* 是否开启布局模式
|
|
@@ -69,22 +69,22 @@ const _ = {
|
|
|
69
69
|
type: Object,
|
|
70
70
|
default: () => ({})
|
|
71
71
|
}
|
|
72
|
-
},
|
|
73
|
-
...
|
|
72
|
+
}, ee = O(V), _ = {
|
|
73
|
+
...v,
|
|
74
74
|
setData: (e) => e,
|
|
75
75
|
validate: null,
|
|
76
76
|
submit: null
|
|
77
|
-
},
|
|
77
|
+
}, te = I(_), ve = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
78
78
|
__proto__: null,
|
|
79
|
-
createBindProps:
|
|
80
|
-
createOnEmits:
|
|
81
|
-
emits:
|
|
82
|
-
props:
|
|
83
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
79
|
+
createBindProps: ee,
|
|
80
|
+
createOnEmits: te,
|
|
81
|
+
emits: _,
|
|
82
|
+
props: V
|
|
83
|
+
}, Symbol.toStringTag, { value: "Module" })), oe = (e) => 24 - e.templateSlots.reduce((t, o) => {
|
|
84
84
|
if (!o.span)
|
|
85
85
|
throw new Error("ElColSource span is required");
|
|
86
86
|
return t + o.span;
|
|
87
|
-
}, 0),
|
|
87
|
+
}, 0), re = (e, t = {}) => {
|
|
88
88
|
const o = e.span ?? t.span;
|
|
89
89
|
if (o == null)
|
|
90
90
|
throw new Error("genColItem ElColSource span is required");
|
|
@@ -93,141 +93,136 @@ const _ = {
|
|
|
93
93
|
templateType: "ElCol",
|
|
94
94
|
span: o,
|
|
95
95
|
templateSlots: [
|
|
96
|
-
|
|
96
|
+
J(e, {
|
|
97
97
|
excludes: ["span"]
|
|
98
98
|
})
|
|
99
99
|
]
|
|
100
100
|
};
|
|
101
|
-
},
|
|
101
|
+
}, ne = (e, t = {}) => ({
|
|
102
102
|
...t,
|
|
103
103
|
templateType: "ElRow",
|
|
104
104
|
templateSlots: e ? [
|
|
105
105
|
e
|
|
106
106
|
] : []
|
|
107
|
-
}),
|
|
107
|
+
}), ae = /* @__PURE__ */ E({
|
|
108
108
|
__name: "provide-label-postion",
|
|
109
109
|
props: {
|
|
110
110
|
labelPosition: null
|
|
111
111
|
},
|
|
112
112
|
setup(e) {
|
|
113
113
|
const t = e, o = {
|
|
114
|
-
addField:
|
|
115
|
-
}, r =
|
|
116
|
-
return
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
...r === o ? o :
|
|
120
|
-
labelPosition:
|
|
114
|
+
addField: Y
|
|
115
|
+
}, r = T(R, o), i = y(() => t.labelPosition ?? r.labelPosition);
|
|
116
|
+
return F(
|
|
117
|
+
R,
|
|
118
|
+
j({
|
|
119
|
+
...r === o ? o : D(r),
|
|
120
|
+
labelPosition: i
|
|
121
121
|
})
|
|
122
|
-
), (
|
|
122
|
+
), (s, l) => S(s.$slots, "default");
|
|
123
123
|
}
|
|
124
124
|
});
|
|
125
125
|
function le(e) {
|
|
126
|
-
const t =
|
|
126
|
+
const t = L(), o = (r) => {
|
|
127
127
|
if (r) {
|
|
128
|
-
const
|
|
129
|
-
r.validate = (
|
|
130
|
-
const l =
|
|
128
|
+
const i = r.validate;
|
|
129
|
+
r.validate = (s) => {
|
|
130
|
+
const l = i.call(r);
|
|
131
131
|
return l && typeof l.then == "function" ? l.then(
|
|
132
|
-
(
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
},
|
|
136
|
-
(s) => {
|
|
137
|
-
var f;
|
|
138
|
-
throw (f = e.onAfterValidate) == null || f.call(e, !1, s), a == null || a(!1, s), s;
|
|
132
|
+
(m) => (e.onAfterValidate?.(!0), s?.(!0), m),
|
|
133
|
+
(m) => {
|
|
134
|
+
throw e.onAfterValidate?.(!1, m), s?.(!1, m), m;
|
|
139
135
|
}
|
|
140
136
|
) : l;
|
|
141
137
|
};
|
|
142
138
|
}
|
|
143
139
|
t.value = r, e.elRef(r);
|
|
144
140
|
};
|
|
145
|
-
return
|
|
141
|
+
return F("elFormRef", t), {
|
|
146
142
|
setFormRef: o,
|
|
147
143
|
formRef: t
|
|
148
144
|
};
|
|
149
145
|
}
|
|
150
|
-
const
|
|
146
|
+
const me = E({
|
|
151
147
|
name: "VkfForm",
|
|
152
148
|
components: {
|
|
153
|
-
VkfRendererData:
|
|
154
|
-
ElForm:
|
|
155
|
-
VkfFormItemRenderer:
|
|
156
|
-
VkfTemplatesDefault:
|
|
157
|
-
VkfTemplatesLayout:
|
|
158
|
-
VkfFormsSegment:
|
|
159
|
-
ProvideLabelPostion:
|
|
149
|
+
VkfRendererData: U,
|
|
150
|
+
ElForm: h,
|
|
151
|
+
VkfFormItemRenderer: q,
|
|
152
|
+
VkfTemplatesDefault: K,
|
|
153
|
+
VkfTemplatesLayout: G,
|
|
154
|
+
VkfFormsSegment: X,
|
|
155
|
+
ProvideLabelPostion: ae
|
|
160
156
|
},
|
|
161
|
-
props:
|
|
162
|
-
emits:
|
|
157
|
+
props: V,
|
|
158
|
+
emits: _,
|
|
163
159
|
setup(e, { emit: t }) {
|
|
164
|
-
const o =
|
|
160
|
+
const o = z(e, ["model", "labelPosition"]), r = N(t), i = Z(), { setFormRef: s } = le({
|
|
165
161
|
elRef: e.elRef,
|
|
166
|
-
onAfterValidate: (n,
|
|
167
|
-
|
|
162
|
+
onAfterValidate: (n, a) => {
|
|
163
|
+
i.emit("afterValidate", {
|
|
168
164
|
isValid: n,
|
|
169
|
-
invalidFields:
|
|
165
|
+
invalidFields: a
|
|
170
166
|
});
|
|
171
167
|
}
|
|
172
|
-
}), l =
|
|
173
|
-
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
if (!((R = m.templateLayout) != null && R.allowEmpty) && Reflect.has(m, "templateIf") && !U(m.templateIf)(e.data))
|
|
168
|
+
}), l = $();
|
|
169
|
+
F("vkfFormVm", l);
|
|
170
|
+
const m = y(() => e.layout ? e.formItems.reduce((n, a) => {
|
|
171
|
+
const p = n.findLast((P) => P.templateType === "ElRow"), d = a.span ?? e.colSource.span;
|
|
172
|
+
if (!d)
|
|
173
|
+
return n.push(a), n;
|
|
174
|
+
if (!a.templateLayout?.allowEmpty && Reflect.has(a, "templateIf") && !Q(a.templateIf)(e.data))
|
|
180
175
|
return n;
|
|
181
|
-
const
|
|
176
|
+
const b = re(a, W({
|
|
182
177
|
...e.colSource,
|
|
183
|
-
...
|
|
178
|
+
...a.templateLayout
|
|
184
179
|
}, {
|
|
185
180
|
excludes: ["allowEmpty"]
|
|
186
181
|
}));
|
|
187
|
-
return !
|
|
182
|
+
return !p || oe(p) < d ? n.push(ne(b, e.rowSource)) : p.templateSlots.push(b), n;
|
|
188
183
|
}, []) : e.formItems);
|
|
189
184
|
return {
|
|
190
185
|
formProps: o,
|
|
191
186
|
formEmits: r,
|
|
192
|
-
getValue:
|
|
193
|
-
setFormRef:
|
|
194
|
-
computed:
|
|
195
|
-
rendererSource:
|
|
187
|
+
getValue: H,
|
|
188
|
+
setFormRef: s,
|
|
189
|
+
computed: y,
|
|
190
|
+
rendererSource: m,
|
|
196
191
|
handleSubmit: (n) => {
|
|
197
192
|
n.preventDefault(), t("submit", n);
|
|
198
193
|
}
|
|
199
194
|
};
|
|
200
195
|
}
|
|
201
196
|
});
|
|
202
|
-
function
|
|
203
|
-
const l =
|
|
204
|
-
return
|
|
197
|
+
function se(e, t, o, r, i, s) {
|
|
198
|
+
const l = f("VkfFormsSegment"), m = f("VkfTemplatesDefault"), k = f("VkfTemplatesLayout"), n = f("VkfFormItemRenderer"), a = f("VkfRendererData"), p = f("ProvideLabelPostion"), d = f("ElForm");
|
|
199
|
+
return A(), B(d, g(e.formProps, {
|
|
205
200
|
ref: e.setFormRef,
|
|
206
201
|
class: {
|
|
207
202
|
"is-readonly": e.readonly
|
|
208
203
|
},
|
|
209
204
|
model: e.model || e.data
|
|
210
|
-
},
|
|
205
|
+
}, M(e.formEmits), { onSubmit: e.handleSubmit }), {
|
|
211
206
|
default: c(() => [
|
|
212
|
-
p
|
|
207
|
+
u(p, { "label-position": e.labelPosition }, {
|
|
213
208
|
default: c(() => [
|
|
214
|
-
|
|
209
|
+
u(a, {
|
|
215
210
|
data: e.data,
|
|
216
|
-
onSetData: t[0] || (t[0] = (
|
|
211
|
+
onSetData: t[0] || (t[0] = (b) => e.$emit("setData", b))
|
|
217
212
|
}, {
|
|
218
213
|
default: c(() => [
|
|
219
|
-
|
|
220
|
-
|
|
214
|
+
u(l, g({ data: e.data }, e.segmentAttrs), null, 16, ["data"]),
|
|
215
|
+
u(n, { source: e.rendererSource }, {
|
|
221
216
|
placeholder: c(() => [
|
|
222
|
-
|
|
223
|
-
|
|
217
|
+
u(m),
|
|
218
|
+
u(k)
|
|
224
219
|
]),
|
|
225
220
|
default: c(() => [
|
|
226
|
-
|
|
221
|
+
S(e.$slots, "rendererTemplate")
|
|
227
222
|
]),
|
|
228
223
|
_: 3
|
|
229
224
|
}, 8, ["source"]),
|
|
230
|
-
|
|
225
|
+
S(e.$slots, "default")
|
|
231
226
|
]),
|
|
232
227
|
_: 3
|
|
233
228
|
}, 8, ["data"])
|
|
@@ -238,13 +233,13 @@ function fe(e, t, o, r, u, a) {
|
|
|
238
233
|
_: 3
|
|
239
234
|
}, 16, ["class", "model", "onSubmit"]);
|
|
240
235
|
}
|
|
241
|
-
const
|
|
236
|
+
const he = /* @__PURE__ */ x(me, [["render", se]]), Oe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
242
237
|
__proto__: null
|
|
243
238
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
244
239
|
export {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
240
|
+
he as VkfForm,
|
|
241
|
+
ve as _VkfFormCtx,
|
|
242
|
+
Oe as __VkfForm,
|
|
243
|
+
he as default,
|
|
244
|
+
Te as useFormMitt
|
|
250
245
|
};
|
|
@@ -80,13 +80,13 @@ export declare const props: {
|
|
|
80
80
|
};
|
|
81
81
|
disabled: BooleanConstructor;
|
|
82
82
|
};
|
|
83
|
-
export declare const createBindProps: <T2 extends import("@vunk/core").NormalObject, EX extends (Extract<"
|
|
83
|
+
export declare const createBindProps: <T2 extends import("@vunk/core").NormalObject, EX extends (Extract<"model", keyof T2> | Extract<"size", keyof T2> | Extract<"labelPosition", keyof T2> | Extract<"elRef", keyof T2> | Extract<"inline", keyof T2> | Extract<"readonly", keyof T2> | Extract<"labelWidth", keyof T2> | Extract<"rules", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2> | Extract<"disabled", keyof T2> | Extract<"data", 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<"layout", keyof T2> | Extract<"formItems", keyof T2> | Extract<"rowSource", keyof T2> | Extract<"colSource", keyof T2> | Extract<"segmentAttrs", keyof T2>)[]>(propsArg: T2, excludes?: EX | undefined) => import("vue").ComputedRef<{ [P in EX extends (infer KE)[] ? Exclude<Extract<"model", keyof T2>, KE> | Exclude<Extract<"size", keyof T2>, KE> | Exclude<Extract<"labelPosition", 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<"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<"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<"layout", 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<"model", keyof T2> | Extract<"size", keyof T2> | Extract<"labelPosition", keyof T2> | Extract<"elRef", keyof T2> | Extract<"inline", keyof T2> | Extract<"readonly", keyof T2> | Extract<"labelWidth", keyof T2> | Extract<"rules", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2> | Extract<"disabled", keyof T2> | Extract<"data", 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<"layout", keyof T2> | Extract<"formItems", keyof T2> | Extract<"rowSource", keyof T2> | Extract<"colSource", keyof T2> | Extract<"segmentAttrs", keyof T2>]: { [k in Extract<"model", keyof T2> | Extract<"size", keyof T2> | Extract<"labelPosition", keyof T2> | Extract<"elRef", keyof T2> | Extract<"inline", keyof T2> | Extract<"readonly", keyof T2> | Extract<"labelWidth", keyof T2> | Extract<"rules", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2> | Extract<"disabled", keyof T2> | Extract<"data", 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<"layout", keyof T2> | Extract<"formItems", keyof T2> | Extract<"rowSource", keyof T2> | Extract<"colSource", keyof T2> | Extract<"segmentAttrs", keyof T2>]: T2[k]; }[P]; }>;
|
|
84
84
|
export declare const emits: {
|
|
85
85
|
setData: (e: SetDataEvent) => SetDataEvent;
|
|
86
86
|
validate: null;
|
|
87
87
|
submit: null;
|
|
88
88
|
};
|
|
89
|
-
export declare const createOnEmits: <T2 extends import("@vunk/core").AnyFunc, EX extends ("
|
|
89
|
+
export declare const createOnEmits: <T2 extends import("@vunk/core").AnyFunc, EX extends ("validate" | "submit" | "setData")[]>(emit: T2, excludes?: EX | undefined) => { [P in EX extends (infer KE)[] ? Exclude<"validate", KE> | Exclude<"submit", KE> | Exclude<"setData", KE> : "validate" | "submit" | "setData"]: {
|
|
90
90
|
setData: (...e: import("@vunk/core").RestParameters<T2>) => void;
|
|
91
91
|
validate: (...e: import("@vunk/core").RestParameters<T2>) => void;
|
|
92
92
|
submit: (...e: import("@vunk/core").RestParameters<T2>) => void;
|
|
@@ -64,7 +64,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
64
64
|
disabled: BooleanConstructor;
|
|
65
65
|
}>, {
|
|
66
66
|
formProps: import("vue").ComputedRef<{
|
|
67
|
-
size: import("element-plus/es/utils/index.mjs").EpPropMergeType<StringConstructor, "" | "
|
|
67
|
+
size: import("element-plus/es/utils/index.mjs").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", unknown> | undefined;
|
|
68
68
|
inline: boolean;
|
|
69
69
|
labelWidth: import("element-plus/es/utils/index.mjs").EpPropMergeType<readonly [StringConstructor, NumberConstructor], unknown, unknown>;
|
|
70
70
|
rules: Partial<Record<string, Record<string, any> | import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemRule>>> | undefined;
|
|
@@ -151,11 +151,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
151
151
|
};
|
|
152
152
|
disabled: BooleanConstructor;
|
|
153
153
|
}>> & Readonly<{
|
|
154
|
-
onSubmit?: ((...args: any[]) => any) | undefined;
|
|
155
154
|
onValidate?: ((...args: any[]) => any) | undefined;
|
|
155
|
+
onSubmit?: ((...args: any[]) => any) | undefined;
|
|
156
156
|
onSetData?: ((e: import("@vunk/core").SetDataEvent) => any) | undefined;
|
|
157
157
|
}>, {
|
|
158
|
-
labelPosition: "
|
|
158
|
+
labelPosition: "start" | "left" | "right" | "top" | "end";
|
|
159
159
|
elRef: import("@vunk/shared").AnyFunc;
|
|
160
160
|
inline: boolean;
|
|
161
161
|
readonly: boolean;
|
|
@@ -289,7 +289,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
289
289
|
readonly hideRequiredAsterisk?: boolean | (() => boolean) | undefined;
|
|
290
290
|
readonly scrollToError?: boolean | (() => boolean) | undefined;
|
|
291
291
|
readonly scrollIntoViewOptions?: boolean | (() => boolean | ScrollIntoViewOptions) | undefined;
|
|
292
|
-
readonly size?: "" | "
|
|
292
|
+
readonly size?: "" | "small" | "default" | "large" | (() => "" | "small" | "default" | "large") | undefined;
|
|
293
293
|
readonly disabled?: boolean | (() => boolean) | undefined;
|
|
294
294
|
}) => void;
|
|
295
295
|
} & {
|
|
@@ -91,7 +91,7 @@ export declare function initFormRef(props: {
|
|
|
91
91
|
scrollIntoViewOptions: ScrollIntoViewOptions | boolean;
|
|
92
92
|
}> & Omit<Readonly<import("element-plus").FormProps> & Readonly<{
|
|
93
93
|
onValidate?: ((prop: import("element-plus").FormItemProp, isValid: boolean, message: string) => any) | undefined;
|
|
94
|
-
}>, "
|
|
94
|
+
}>, "validate" | "labelPosition" | "labelWidth" | "showMessage" | "requireAsteriskPosition" | "labelSuffix" | "validateOnRuleChange" | "scrollIntoViewOptions" | "validateField" | "resetFields" | "clearValidate" | "scrollToField" | "getField" | "fields" | "setInitialValues"> & {
|
|
95
95
|
validate: (callback?: FormValidateCallback) => FormValidationResult;
|
|
96
96
|
validateField: (props?: import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemProp>, callback?: FormValidateCallback) => FormValidationResult;
|
|
97
97
|
resetFields: (props?: import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemProp>) => void;
|
|
@@ -189,7 +189,7 @@ export declare function initFormRef(props: {
|
|
|
189
189
|
scrollIntoViewOptions: ScrollIntoViewOptions | boolean;
|
|
190
190
|
}> & Omit<Readonly<import("element-plus").FormProps> & Readonly<{
|
|
191
191
|
onValidate?: ((prop: import("element-plus").FormItemProp, isValid: boolean, message: string) => any) | undefined;
|
|
192
|
-
}>, "
|
|
192
|
+
}>, "validate" | "labelPosition" | "labelWidth" | "showMessage" | "requireAsteriskPosition" | "labelSuffix" | "validateOnRuleChange" | "scrollIntoViewOptions" | "validateField" | "resetFields" | "clearValidate" | "scrollToField" | "getField" | "fields" | "setInitialValues"> & {
|
|
193
193
|
validate: (callback?: FormValidateCallback) => FormValidationResult;
|
|
194
194
|
validateField: (props?: import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemProp>, callback?: FormValidateCallback) => FormValidationResult;
|
|
195
195
|
resetFields: (props?: import("element-plus/es/utils/typescript.mjs").Arrayable<import("element-plus").FormItemProp>) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("element-plus"),O=require("@vunk/core/shared/utils-vue"),e=require("vue"),B=require("@vunk/form/shared/element-plus"),p=require("@vunk/form/composables"),T=require("@vunk/form/composables/element-plus"),S=require("@vunk/core/shared/utils-object"),j=require("@vunk/form/shared/rules"),R=require("../index-Bc7UifHG.js"),A=require("@vunk/form/components/collapse-item"),N=require("@vunk/form/icons/generate"),$=require("@vunk/form/components/ai-provider"),E=require("@vunk/form/components/form-item-renderer"),h={...c.formItemProps,labelPosition:{type:String,default:void 0},formItemSize:{type:String,default:void 0},formItemSlots:{type:Object,default:void 0},elRef:{type:Function,required:!1},inline:{type:Boolean,default:!1},readonly:{type:Boolean,default:void 0},formItemTip:{type:String,default:void 0},formItemTipClass:null,labelTip:{type:String,default:void 0},information:{type:Boolean,default:!1},prop:null,defaultModelValue:null,labelTipProps:{type:Object,default:()=>({})},ai:{type:Object,default:void 0},aiOutput:null};Reflect.deleteProperty(h,"size");const C=h,D=O.bindPropsFactory(C),_=Object.freeze(Object.defineProperty({__proto__:null,createBindProps:D,props:C},Symbol.toStringTag,{value:"Module"}));function w(t){const i=$.useAi(),{data:m,getDataValue:d,emitSetData:u}=p.useRendererData(),{tr:s}=T.useLocale(),b=E.useAiSchema(),a=e.ref(!1),r=l=>Array.isArray(l)?l.join():String(l),o=e.computed(()=>b?.find(l=>r(l.prop)===r(t.prop))),f=e.computed(()=>typeof t.ai=="object"&&t.ai!==null?t.ai:void 0),k=e.computed(()=>!!i&&!!f.value&&f.value.enable!==!1),g=l=>s("vkf.formItem.aiPrompt","请为表单字段「{label}」生成一个合理的值,只输出值本身。",{label:l});function I(){const l=f.value??{};return{...l,prompt:l.prompt??g(t.label??r(t.prop)),output:l.output??t.aiOutput}}async function n(){if(!i||a.value||t.prop==null)return;const l={data:m?.value,getDataValue:d,emitSetData:u,client:i,formItem:o.value,ai:I()};a.value=!0;try{if(l.ai.stream&&i.generateStream){let y="";await i.generateStream(l,{onChunk(q){y+=q,u?.({k:t.prop,v:y})},onDone(){y&&u?.({k:t.prop,v:y})}});return}const v=(await i.generate(l))?.[r(t.prop)];v!==void 0&&u?.({k:t.prop,v})}finally{a.value=!1}}return{hasAi:k,generating:a,handleGenerate:n}}const z={key:0,class:"vkf-form-item-label__span"},x={key:3,class:"vkf-form-item-label__actions"},M=e.defineComponent({inheritAttrs:!1,__name:"core",props:{labelTip:{type:String,default:""},formItemTip:{type:String,default:""},formItemTipClass:null,elRef:null,label:null,prop:null,labelTipProps:null,ai:null,aiOutput:null},setup(t){const i=t,{mittOn:m}=p.useFormMitt(),{hasAi:d,generating:u,handleGenerate:s}=w(i),b=A.useCollapseItemContext();return m("afterValidate",({invalidFields:a})=>{if(!a||i.prop==null||!(i.prop in a))return;const r=b;if(!r)return;const o=r.name;if(r.accordion){if(Object.keys(a)[0]===i.prop){if(r.activeNames.includes(o))return;r.handleItemClick(o)}}else{if(r.activeNames.includes(o))return;r.handleItemClick(o)}}),(a,r)=>(e.openBlock(),e.createBlock(e.unref(c.ElFormItem),e.mergeProps(a.$attrs,{ref:o=>i.elRef?.(o),prop:t.prop,class:["vkf-form-item",{"has-label-actions":a.$slots.labelActions}],label:t.label}),{default:e.withCtx(()=>[e.renderSlot(a.$slots,"before"),e.renderSlot(a.$slots,"default"),e.renderSlot(a.$slots,"after"),t.formItemTip?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["vkf-form-item__tip",t.formItemTipClass])},[e.createElementVNode("span",null,e.toDisplayString(t.formItemTip),1)],2)):e.createCommentVNode("",!0)]),label:e.withCtx(o=>[e.renderSlot(a.$slots,"label",e.normalizeProps(e.guardReactiveProps(o)),()=>[t.label?(e.openBlock(),e.createElementBlock("span",z,e.toDisplayString(o.label),1)):e.createCommentVNode("",!0),t.labelTip?(e.openBlock(),e.createBlock(e.unref(c.ElTooltip),e.mergeProps({key:1,content:t.labelTip},t.labelTipProps),{default:e.withCtx(()=>[e.createVNode(e.unref(c.ElButton),{text:"",class:"vkf-form-item-label-tip-button"},{default:e.withCtx(()=>[e.createVNode(e.unref(c.ElIcon),null,{default:e.withCtx(()=>[e.createVNode(e.unref(R.warning_default))]),_:1})]),_:1})]),_:1},16,["content"])):e.createCommentVNode("",!0),e.unref(d)?(e.openBlock(),e.createBlock(e.unref(c.ElButton),{key:2,text:"",class:"vkf-form-item-label-tip-button",type:"primary",onClick:e.unref(s)},{default:e.withCtx(()=>[e.createVNode(e.unref(N.VkfGenerateIcon),{generating:e.unref(u)},null,8,["generating"])]),_:1},8,["onClick"])):e.createCommentVNode("",!0),a.$slots.labelActions?(e.openBlock(),e.createElementBlock("div",x,[e.renderSlot(a.$slots,"labelActions")])):e.createCommentVNode("",!0)])]),error:e.withCtx(o=>[e.renderSlot(a.$slots,"error",e.normalizeProps(e.guardReactiveProps(o)))]),_:3},16,["prop","class","label"]))}}),V=e.defineComponent({name:"VkfFormItem",props:C,setup(t,{slots:i}){const m=B.createFormItemBindProps(t,["rules"]),d=p.useComputedReadonly(t),{tr:u}=T.useLocale(),s=e.ref(),b=e.computed(()=>t.labelPosition),a=p.useComputedLabelPosition(s,b),r=()=>t.label||u("vkf.formItem.defaultField","该字段"),o=n=>{if(n.message)return;n.required&&(n.message=u("vkf.formItem.required","{label}不能为空",{label:r()}));const l=j.PATTERN_OPTIONS.find(P=>P.value===n.pattern);l&&(n.message=u("vkf.formItem.pattern","输入 {label} {pattern}",{label:r(),pattern:l.title}))},f=e.computed(()=>{let n=[];return!t.rules&&t.required&&n.push({required:!0}),S.isPlainObject(t.rules)&&(n=[t.rules]),Array.isArray(t.rules)&&(n=t.rules,t.required&&!t.rules.find(l=>l.required)&&n.push({required:!0})),n=n.filter(l=>{if(l&&S.isPlainObject(l))return Object.keys(l).filter(v=>!v.startsWith("data-")).length>0}),n.forEach(l=>{o(l)}),n}),{getDataValue:k,emitSetData:g}=p.useRendererData();setTimeout(()=>{t.defaultModelValue!==void 0&&t.prop&&k?.(t.prop)===void 0&&g?.({k:t.prop,v:t.defaultModelValue})});const I=n=>{s.value=n?.$el??n,typeof t.elRef=="function"&&t.elRef(n)};return()=>e.h(M,{...m.value,"label-position":a.value,elRef:I,class:{"is-readonly":d.value,"vkf-form-item--inline":t.inline,"is-empty-label":!t.label,"is-information":t.information},size:t.formItemSize,rules:f.value,formItemTip:t.formItemTip,formItemTipClass:t.formItemTipClass,labelTip:t.labelTip,label:t.label,labelTipProps:t.labelTipProps,ai:t.ai,aiOutput:t.aiOutput},{...i,...t.formItemSlots})}}),F=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));exports.VkfFormItem=V;exports._VkfFormItemCtx=_;exports.__VkfFormItem=F;exports.default=V;
|