@vunk/form 2.19.24 → 2.19.25
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 -1
- package/components/ai-provider/index.d.ts +2 -2
- package/components/ai-provider/index.mjs +98 -44
- package/components/ai-provider/src/ctx.d.ts +9 -1
- package/components/ai-provider/src/index.vue.d.ts +43 -6
- package/components/ai-provider/src/types.d.ts +45 -0
- package/components/ai-provider/src/use.d.ts +3 -1
- package/components/api-tables-select/src/ctx.d.ts +4 -4
- package/components/api-tables-select/src/index.vue.d.ts +5 -5
- package/components/button/src/ctx.d.ts +4 -4
- package/components/button/src/index.vue.d.ts +10 -10
- package/components/card-input-collection/src/core.vue.d.ts +10 -10
- package/components/card-input-collection/src/ctx.d.ts +4 -4
- package/components/card-input-collection/src/index.vue.d.ts +10 -10
- package/components/cascader/src/ctx.d.ts +5 -5
- package/components/cascader/src/index.vue.d.ts +9 -9
- package/components/checkbox/src/ctx.d.ts +5 -5
- package/components/checkbox/src/index.vue.d.ts +10 -10
- package/components/color-picker/src/ctx.d.ts +4 -4
- package/components/color-picker/src/index.vue.d.ts +9 -9
- package/components/components.css +1 -1
- package/components/date-picker/src/ctx.d.ts +5 -5
- package/components/date-picker/src/index.vue.d.ts +9 -9
- package/components/date-picker-range/src/ctx.d.ts +4 -4
- package/components/date-picker-range/src/index.vue.d.ts +18 -18
- package/components/dialog-input-collection/src/ctx.d.ts +4 -4
- package/components/dialog-input-collection/src/index.vue.d.ts +9 -9
- package/components/download-plus/src/ctx.d.ts +4 -4
- package/components/download-plus/src/index.vue.d.ts +10 -10
- package/components/editable-text/src/ctx.d.ts +4 -4
- package/components/editable-text/src/index.vue.d.ts +9 -9
- package/components/esri-input-geojson/src/append.vue.d.ts +1 -1
- package/components/esri-input-geojson/src/ctx.d.ts +5 -5
- package/components/esri-input-geojson/src/index.vue.d.ts +20 -20
- package/components/form/src/ctx.d.ts +1 -1
- package/components/form/src/index.vue.d.ts +1 -1
- package/components/form-item/index.cjs +1 -1
- package/components/form-item/index.mjs +218 -144
- package/components/form-item/src/core.vue.d.ts +7 -7
- package/components/form-item/src/ctx.d.ts +1 -1
- package/components/form-item/src/index.vue.d.ts +1 -1
- package/components/form-item/src/use.d.ts +5 -1
- package/components/form-item/src/validate-guard.vue.d.ts +25 -0
- package/components/information-collection/src/ctx.d.ts +4 -4
- package/components/information-collection/src/index.vue.d.ts +9 -9
- package/components/information-tag/src/index.vue.d.ts +1 -1
- package/components/input/src/ctx.d.ts +5 -5
- package/components/input/src/index.vue.d.ts +10 -10
- package/components/input-array/src/ctx.d.ts +4 -4
- package/components/input-array/src/index.vue.d.ts +9 -9
- package/components/input-collection/src/core.vue.d.ts +13 -13
- package/components/input-collection/src/ctx.d.ts +4 -4
- package/components/input-collection/src/index.vue.d.ts +13 -13
- package/components/input-file/src/index.vue.d.ts +10 -10
- package/components/input-link/src/ctx.d.ts +4 -4
- package/components/input-link/src/index.vue.d.ts +19 -19
- package/components/input-number/src/ctx.d.ts +5 -5
- package/components/input-number/src/index.vue.d.ts +10 -10
- package/components/input-tag/src/ctx.d.ts +5 -5
- package/components/input-tag/src/index.vue.d.ts +10 -10
- package/components/monaco-editor/src/ctx.d.ts +4 -4
- package/components/monaco-editor/src/index.vue.d.ts +10 -10
- package/components/radio/src/ctx.d.ts +4 -4
- package/components/radio/src/index.vue.d.ts +10 -10
- package/components/radio/src/wraper.vue.d.ts +9 -9
- package/components/select/src/core.vue.d.ts +10 -10
- package/components/select/src/ctx.d.ts +5 -5
- package/components/select/src/index.vue.d.ts +9 -9
- package/components/slider/src/ctx.d.ts +4 -4
- package/components/slider/src/index.vue.d.ts +9 -9
- package/components/switch/src/ctx.d.ts +4 -4
- package/components/switch/src/index.vue.d.ts +9 -9
- package/components/tables-select/src/ctx.d.ts +5 -5
- package/components/tables-select/src/index.vue.d.ts +6 -6
- package/components/templates-default/src/index.vue.d.ts +141 -141
- package/components/templates-esri/src/index.vue.d.ts +20 -20
- package/components/templates-variant/src/index.vue.d.ts +18 -18
- package/components/time-picker/src/ctx.d.ts +5 -5
- package/components/time-picker/src/index.vue.d.ts +9 -9
- package/components/upload/src/ctx.d.ts +5 -5
- package/components/upload/src/index.vue.d.ts +12 -12
- package/components/upload/src/wraper.vue.d.ts +10 -10
- package/components/upload-plus/src/ctx.d.ts +4 -4
- package/components/upload-plus/src/index.vue.d.ts +9 -9
- package/components/van-cascader/src/ctx.d.ts +4 -4
- package/components/van-cascader/src/index.vue.d.ts +9 -9
- package/components/var-datetime-picker/src/ctx.d.ts +4 -4
- package/components/var-datetime-picker/src/index.vue.d.ts +10 -10
- package/components/vditor/src/ctx.d.ts +4 -4
- package/components/vditor/src/index.vue.d.ts +10 -10
- package/index.css +1 -1
- package/locale/index.cjs +1 -1
- package/locale/index.mjs +9 -3
- package/locale/lang/ar.d.ts +2 -0
- package/locale/lang/en.d.ts +2 -0
- package/locale/lang/zh-cn.d.ts +2 -0
- package/package.json +1 -1
- package/shared/element-plus/ctx.d.ts +1 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { formItemProps as w, ElFormItem as
|
|
2
|
-
import { bindPropsFactory as
|
|
3
|
-
import { ref as
|
|
4
|
-
import { createFormItemBindProps as
|
|
5
|
-
import { useRendererData as
|
|
6
|
-
import { useLocale as
|
|
7
|
-
import { isPlainObject as
|
|
8
|
-
import { PATTERN_OPTIONS as
|
|
9
|
-
import { w as
|
|
10
|
-
import { useCollapseItemContext as
|
|
11
|
-
import { VkfGenerateIcon as
|
|
12
|
-
import { useAi as
|
|
13
|
-
import { useAiSchema as
|
|
14
|
-
const
|
|
15
|
-
...
|
|
1
|
+
import { formItemProps as Y, formItemContextKey as w, ElFormItem as Z, ElTooltip as ee, ElButton as G, ElIcon as te } from "element-plus";
|
|
2
|
+
import { bindPropsFactory as le } from "@vunk/core/shared/utils-vue";
|
|
3
|
+
import { ref as B, computed as C, defineComponent as D, inject as ae, provide as ne, renderSlot as k, openBlock as I, createBlock as j, unref as o, mergeProps as M, withCtx as y, normalizeProps as N, guardReactiveProps as K, createElementBlock as A, toDisplayString as R, createCommentVNode as h, createVNode as P, createElementVNode as L, normalizeClass as re, h as oe } from "vue";
|
|
4
|
+
import { createFormItemBindProps as ie } from "@vunk/form/shared/element-plus";
|
|
5
|
+
import { useRendererData as W, useFormMitt as ue, useComputedReadonly as se, useComputedLabelPosition as fe } from "@vunk/form/composables";
|
|
6
|
+
import { useLocale as J } from "@vunk/form/composables/element-plus";
|
|
7
|
+
import { isPlainObject as H } from "@vunk/core/shared/utils-object";
|
|
8
|
+
import { PATTERN_OPTIONS as me } from "@vunk/form/shared/rules";
|
|
9
|
+
import { w as ce } from "../index-DCNYT7Wv.mjs";
|
|
10
|
+
import { useCollapseItemContext as de } from "@vunk/form/components/collapse-item";
|
|
11
|
+
import { VkfGenerateIcon as pe } from "@vunk/form/components/generate-icon";
|
|
12
|
+
import { useAi as be, useAiHost as ve } from "@vunk/form/components/ai-provider";
|
|
13
|
+
import { useAiSchema as ye } from "@vunk/form/components/form-item-renderer";
|
|
14
|
+
const Q = {
|
|
15
|
+
...Y,
|
|
16
16
|
labelPosition: {
|
|
17
17
|
type: String,
|
|
18
18
|
default: void 0
|
|
@@ -62,69 +62,127 @@ const M = {
|
|
|
62
62
|
},
|
|
63
63
|
aiOutput: null
|
|
64
64
|
};
|
|
65
|
-
Reflect.deleteProperty(
|
|
66
|
-
const
|
|
65
|
+
Reflect.deleteProperty(Q, "size");
|
|
66
|
+
const E = Q, ge = le(E), qe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
67
67
|
__proto__: null,
|
|
68
|
-
createBindProps:
|
|
69
|
-
props:
|
|
68
|
+
createBindProps: ge,
|
|
69
|
+
props: E
|
|
70
70
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
71
|
-
function
|
|
72
|
-
const r =
|
|
71
|
+
function Ie(e, f = {}) {
|
|
72
|
+
const r = be(), i = ve(), { data: m, getDataValue: c, emitSetData: d } = W(), { tr: v } = J(), T = ye(), p = B(!1), l = B(""), u = C(() => {
|
|
73
|
+
if (!p.value) return "";
|
|
74
|
+
const a = l.value;
|
|
75
|
+
if (!a)
|
|
76
|
+
return v("vkf.formItem.aiThinking", "AI 思考中…");
|
|
77
|
+
const b = a.slice(-60);
|
|
78
|
+
return v("vkf.formItem.aiThinkingText", "AI 思考中:{text}", {
|
|
79
|
+
text: `${a.length > b.length ? "…" : ""}${b}`
|
|
80
|
+
});
|
|
81
|
+
}), n = (a) => Array.isArray(a) ? a.join() : String(a), S = C(() => T?.find((a) => n(a.prop) === n(e.prop))), t = C(() => typeof e.ai == "object" && e.ai !== null ? e.ai : void 0), s = C(() => !!r && !!t.value && t.value.enable !== !1), _ = (a) => v(
|
|
73
82
|
"vkf.formItem.aiPrompt",
|
|
74
83
|
"请为表单字段「{label}」生成一个合理的值,只输出值本身。",
|
|
75
|
-
{ label:
|
|
84
|
+
{ label: a }
|
|
76
85
|
);
|
|
77
|
-
function
|
|
78
|
-
const
|
|
86
|
+
function V() {
|
|
87
|
+
const a = t.value ?? {};
|
|
79
88
|
return {
|
|
80
|
-
...
|
|
81
|
-
prompt:
|
|
82
|
-
output:
|
|
89
|
+
...a,
|
|
90
|
+
prompt: a.prompt ?? _(e.label ?? n(e.prop)),
|
|
91
|
+
output: a.output ?? e.aiOutput
|
|
83
92
|
};
|
|
84
93
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
emitSetData: i,
|
|
94
|
+
function U() {
|
|
95
|
+
return {
|
|
96
|
+
data: m?.value,
|
|
97
|
+
getDataValue: c,
|
|
98
|
+
emitSetData: d,
|
|
91
99
|
client: r,
|
|
92
|
-
formItem:
|
|
93
|
-
ai:
|
|
100
|
+
formItem: S.value,
|
|
101
|
+
ai: V()
|
|
94
102
|
};
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
103
|
+
}
|
|
104
|
+
async function F(a, b) {
|
|
105
|
+
if (r) {
|
|
106
|
+
f.onBeforeGenerate?.(), p.value = !0, l.value = "";
|
|
107
|
+
try {
|
|
108
|
+
if (a.ai.stream && r.generateStream) {
|
|
109
|
+
let g = "", q = !0;
|
|
110
|
+
const x = () => {
|
|
111
|
+
q && (q = !1, b?.onFirstChunk?.(g));
|
|
112
|
+
};
|
|
113
|
+
await r.generateStream(a, {
|
|
114
|
+
onChunk($) {
|
|
115
|
+
g += $, d?.({ k: e.prop, v: g }), x();
|
|
116
|
+
},
|
|
117
|
+
onReasoning($) {
|
|
118
|
+
l.value += $, x();
|
|
119
|
+
},
|
|
120
|
+
onDone() {
|
|
121
|
+
g && d?.({ k: e.prop, v: g });
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const O = (await r.generate(a))?.[n(e.prop)];
|
|
127
|
+
O !== void 0 && d?.({ k: e.prop, v: O });
|
|
128
|
+
} finally {
|
|
129
|
+
p.value = !1;
|
|
108
130
|
}
|
|
109
|
-
const g = (await r.generate(t))?.[o(e.prop)];
|
|
110
|
-
g !== void 0 && i?.({ k: e.prop, v: g });
|
|
111
|
-
} finally {
|
|
112
|
-
a.value = !1;
|
|
113
131
|
}
|
|
114
132
|
}
|
|
133
|
+
async function X(a) {
|
|
134
|
+
if (!r || p.value || e.prop == null) return;
|
|
135
|
+
const b = U();
|
|
136
|
+
if (i?.hasDialog) {
|
|
137
|
+
const z = {
|
|
138
|
+
...b,
|
|
139
|
+
el: a?.currentTarget,
|
|
140
|
+
generate: (O, g) => F(
|
|
141
|
+
{
|
|
142
|
+
...b,
|
|
143
|
+
ai: { ...b.ai, ...O }
|
|
144
|
+
},
|
|
145
|
+
g
|
|
146
|
+
)
|
|
147
|
+
};
|
|
148
|
+
i.openDialog(z);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
await F(b);
|
|
152
|
+
}
|
|
115
153
|
return {
|
|
116
|
-
hasAi:
|
|
117
|
-
generating:
|
|
118
|
-
|
|
154
|
+
hasAi: s,
|
|
155
|
+
generating: p,
|
|
156
|
+
aiTip: u,
|
|
157
|
+
handleGenerate: X
|
|
119
158
|
};
|
|
120
159
|
}
|
|
121
|
-
const
|
|
160
|
+
const ke = /* @__PURE__ */ D({
|
|
161
|
+
__name: "validate-guard",
|
|
162
|
+
props: {
|
|
163
|
+
suspended: {
|
|
164
|
+
type: Boolean,
|
|
165
|
+
default: !1
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
setup(e) {
|
|
169
|
+
const f = e, r = ae(w, null);
|
|
170
|
+
if (r) {
|
|
171
|
+
const i = Object.create(r);
|
|
172
|
+
i.validate = (m, c) => f.suspended ? (c?.(!0), Promise.resolve(!0)) : r.validate(m, c), ne(w, i);
|
|
173
|
+
}
|
|
174
|
+
return (i, m) => k(i.$slots, "default");
|
|
175
|
+
}
|
|
176
|
+
}), Te = {
|
|
177
|
+
key: 0,
|
|
178
|
+
class: "vkf-form-item__tip vkf-form-item__tip--ai"
|
|
179
|
+
}, he = {
|
|
122
180
|
key: 0,
|
|
123
181
|
class: "vkf-form-item-label__span"
|
|
124
|
-
},
|
|
182
|
+
}, Ce = {
|
|
125
183
|
key: 3,
|
|
126
184
|
class: "vkf-form-item-label__actions"
|
|
127
|
-
},
|
|
185
|
+
}, Pe = /* @__PURE__ */ D({
|
|
128
186
|
inheritAttrs: !1,
|
|
129
187
|
__name: "core",
|
|
130
188
|
props: {
|
|
@@ -145,56 +203,72 @@ const ie = {
|
|
|
145
203
|
aiOutput: null
|
|
146
204
|
},
|
|
147
205
|
setup(e) {
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
206
|
+
const f = e, { mittOn: r } = ue();
|
|
207
|
+
let i = null;
|
|
208
|
+
function m(l) {
|
|
209
|
+
i = l, f.elRef?.(l);
|
|
210
|
+
}
|
|
211
|
+
const { hasAi: c, generating: d, aiTip: v, handleGenerate: T } = Ie(f, {
|
|
212
|
+
// 思考提示与校验信息同占一个位置,生成开始先清掉校验
|
|
213
|
+
onBeforeGenerate: () => i?.clearValidate?.()
|
|
214
|
+
}), p = de();
|
|
215
|
+
return r("afterValidate", ({ invalidFields: l }) => {
|
|
216
|
+
if (!l || f.prop == null || !(f.prop in l)) return;
|
|
217
|
+
const u = p;
|
|
218
|
+
if (!u) return;
|
|
219
|
+
const n = u.name;
|
|
220
|
+
if (u.accordion) {
|
|
221
|
+
if (Object.keys(l)[0] === f.prop) {
|
|
222
|
+
if (u.activeNames.includes(n)) return;
|
|
223
|
+
u.handleItemClick(n);
|
|
158
224
|
}
|
|
159
225
|
} else {
|
|
160
|
-
if (
|
|
161
|
-
|
|
226
|
+
if (u.activeNames.includes(n)) return;
|
|
227
|
+
u.handleItemClick(n);
|
|
162
228
|
}
|
|
163
|
-
}), (
|
|
164
|
-
ref:
|
|
229
|
+
}), (l, u) => (I(), j(o(Z), M(l.$attrs, {
|
|
230
|
+
ref: m,
|
|
165
231
|
prop: e.prop,
|
|
166
232
|
class: ["vkf-form-item", {
|
|
167
|
-
"has-label-actions":
|
|
233
|
+
"has-label-actions": l.$slots.labelActions
|
|
168
234
|
}],
|
|
169
235
|
label: e.label
|
|
170
236
|
}), {
|
|
171
|
-
default:
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
237
|
+
default: y(() => [
|
|
238
|
+
k(l.$slots, "before"),
|
|
239
|
+
P(ke, { suspended: o(d) }, {
|
|
240
|
+
default: y(() => [
|
|
241
|
+
k(l.$slots, "default")
|
|
242
|
+
]),
|
|
243
|
+
_: 3
|
|
244
|
+
}, 8, ["suspended"]),
|
|
245
|
+
k(l.$slots, "after"),
|
|
246
|
+
o(v) ? (I(), A("div", Te, [
|
|
247
|
+
L("span", null, R(o(v)), 1)
|
|
248
|
+
])) : h("", !0),
|
|
249
|
+
e.formItemTip ? (I(), A("div", {
|
|
250
|
+
key: 1,
|
|
251
|
+
class: re(["vkf-form-item__tip", e.formItemTipClass])
|
|
178
252
|
}, [
|
|
179
|
-
|
|
180
|
-
], 2)) :
|
|
253
|
+
L("span", null, R(e.formItemTip), 1)
|
|
254
|
+
], 2)) : h("", !0)
|
|
181
255
|
]),
|
|
182
|
-
label:
|
|
183
|
-
|
|
184
|
-
e.label ? (
|
|
185
|
-
e.labelTip ? (
|
|
256
|
+
label: y((n) => [
|
|
257
|
+
k(l.$slots, "label", N(K(n)), () => [
|
|
258
|
+
e.label ? (I(), A("span", he, R(n.label), 1)) : h("", !0),
|
|
259
|
+
e.labelTip ? (I(), j(o(ee), M({
|
|
186
260
|
key: 1,
|
|
187
261
|
content: e.labelTip
|
|
188
262
|
}, e.labelTipProps), {
|
|
189
|
-
default:
|
|
190
|
-
|
|
263
|
+
default: y(() => [
|
|
264
|
+
P(o(G), {
|
|
191
265
|
text: "",
|
|
192
266
|
class: "vkf-form-item-label-tip-button"
|
|
193
267
|
}, {
|
|
194
|
-
default:
|
|
195
|
-
|
|
196
|
-
default:
|
|
197
|
-
|
|
268
|
+
default: y(() => [
|
|
269
|
+
P(o(te), null, {
|
|
270
|
+
default: y(() => [
|
|
271
|
+
P(o(ce))
|
|
198
272
|
]),
|
|
199
273
|
_: 1
|
|
200
274
|
})
|
|
@@ -203,85 +277,85 @@ const ie = {
|
|
|
203
277
|
})
|
|
204
278
|
]),
|
|
205
279
|
_: 1
|
|
206
|
-
}, 16, ["content"])) :
|
|
207
|
-
|
|
280
|
+
}, 16, ["content"])) : h("", !0),
|
|
281
|
+
o(c) ? (I(), j(o(G), {
|
|
208
282
|
key: 2,
|
|
209
283
|
text: "",
|
|
210
284
|
class: "vkf-form-item-label-tip-button",
|
|
211
285
|
type: "primary",
|
|
212
|
-
onClick:
|
|
286
|
+
onClick: o(T)
|
|
213
287
|
}, {
|
|
214
|
-
default:
|
|
215
|
-
|
|
288
|
+
default: y(() => [
|
|
289
|
+
P(o(pe), { generating: o(d) }, null, 8, ["generating"])
|
|
216
290
|
]),
|
|
217
291
|
_: 1
|
|
218
|
-
}, 8, ["onClick"])) :
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
])) :
|
|
292
|
+
}, 8, ["onClick"])) : h("", !0),
|
|
293
|
+
l.$slots.labelActions ? (I(), A("div", Ce, [
|
|
294
|
+
k(l.$slots, "labelActions")
|
|
295
|
+
])) : h("", !0)
|
|
222
296
|
])
|
|
223
297
|
]),
|
|
224
|
-
error:
|
|
225
|
-
|
|
298
|
+
error: y((n) => [
|
|
299
|
+
k(l.$slots, "error", N(K(n)))
|
|
226
300
|
]),
|
|
227
301
|
_: 3
|
|
228
302
|
}, 16, ["prop", "class", "label"]));
|
|
229
303
|
}
|
|
230
|
-
}),
|
|
304
|
+
}), xe = /* @__PURE__ */ D({
|
|
231
305
|
name: "VkfFormItem",
|
|
232
|
-
props:
|
|
306
|
+
props: E,
|
|
233
307
|
setup(e, {
|
|
234
|
-
slots:
|
|
308
|
+
slots: f
|
|
235
309
|
}) {
|
|
236
|
-
const
|
|
237
|
-
tr:
|
|
238
|
-
} =
|
|
239
|
-
if (
|
|
240
|
-
|
|
241
|
-
label:
|
|
310
|
+
const r = ie(e, ["rules"]), i = se(e), {
|
|
311
|
+
tr: m
|
|
312
|
+
} = J(), c = B(), d = C(() => e.labelPosition), v = fe(c, d), T = () => e.label || m("vkf.formItem.defaultField", "该字段"), p = (t) => {
|
|
313
|
+
if (t.message) return;
|
|
314
|
+
t.required && (t.message = m("vkf.formItem.required", "{label}不能为空", {
|
|
315
|
+
label: T()
|
|
242
316
|
}));
|
|
243
|
-
const
|
|
244
|
-
|
|
245
|
-
label:
|
|
246
|
-
pattern:
|
|
317
|
+
const s = me.find((_) => _.value === t.pattern);
|
|
318
|
+
s && (t.message = m("vkf.formItem.pattern", "输入 {label} {pattern}", {
|
|
319
|
+
label: T(),
|
|
320
|
+
pattern: s.title
|
|
247
321
|
}));
|
|
248
|
-
},
|
|
249
|
-
let
|
|
250
|
-
return !e.rules && e.required &&
|
|
322
|
+
}, l = C(() => {
|
|
323
|
+
let t = [];
|
|
324
|
+
return !e.rules && e.required && t.push({
|
|
251
325
|
required: !0
|
|
252
|
-
}),
|
|
326
|
+
}), H(e.rules) && (t = [e.rules]), Array.isArray(e.rules) && (t = e.rules, e.required && !e.rules.find((s) => s.required) && t.push({
|
|
253
327
|
required: !0
|
|
254
|
-
})),
|
|
255
|
-
if (
|
|
256
|
-
return Object.keys(
|
|
257
|
-
}),
|
|
258
|
-
|
|
259
|
-
}),
|
|
328
|
+
})), t = t.filter((s) => {
|
|
329
|
+
if (s && H(s))
|
|
330
|
+
return Object.keys(s).filter((V) => !V.startsWith("data-")).length > 0;
|
|
331
|
+
}), t.forEach((s) => {
|
|
332
|
+
p(s);
|
|
333
|
+
}), t;
|
|
260
334
|
}), {
|
|
261
|
-
getDataValue:
|
|
262
|
-
emitSetData:
|
|
263
|
-
} =
|
|
335
|
+
getDataValue: u,
|
|
336
|
+
emitSetData: n
|
|
337
|
+
} = W();
|
|
264
338
|
setTimeout(() => {
|
|
265
|
-
e.defaultModelValue !== void 0 && e.prop &&
|
|
339
|
+
e.defaultModelValue !== void 0 && e.prop && u?.(e.prop) === void 0 && n?.({
|
|
266
340
|
k: e.prop,
|
|
267
341
|
v: e.defaultModelValue
|
|
268
342
|
});
|
|
269
343
|
});
|
|
270
|
-
const
|
|
271
|
-
|
|
344
|
+
const S = (t) => {
|
|
345
|
+
c.value = t?.$el ?? t, typeof e.elRef == "function" && e.elRef(t);
|
|
272
346
|
};
|
|
273
|
-
return () =>
|
|
274
|
-
...
|
|
275
|
-
"label-position":
|
|
276
|
-
elRef:
|
|
347
|
+
return () => oe(Pe, {
|
|
348
|
+
...r.value,
|
|
349
|
+
"label-position": v.value,
|
|
350
|
+
elRef: S,
|
|
277
351
|
class: {
|
|
278
|
-
"is-readonly":
|
|
352
|
+
"is-readonly": i.value,
|
|
279
353
|
"vkf-form-item--inline": e.inline,
|
|
280
354
|
"is-empty-label": !e.label,
|
|
281
355
|
"is-information": e.information
|
|
282
356
|
},
|
|
283
357
|
size: e.formItemSize,
|
|
284
|
-
rules:
|
|
358
|
+
rules: l.value,
|
|
285
359
|
formItemTip: e.formItemTip,
|
|
286
360
|
formItemTipClass: e.formItemTipClass,
|
|
287
361
|
labelTip: e.labelTip,
|
|
@@ -290,16 +364,16 @@ const ie = {
|
|
|
290
364
|
ai: e.ai,
|
|
291
365
|
aiOutput: e.aiOutput
|
|
292
366
|
}, {
|
|
293
|
-
...
|
|
367
|
+
...f,
|
|
294
368
|
...e.formItemSlots
|
|
295
369
|
});
|
|
296
370
|
}
|
|
297
|
-
}),
|
|
371
|
+
}), we = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
298
372
|
__proto__: null
|
|
299
373
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
300
374
|
export {
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
375
|
+
xe as VkfFormItem,
|
|
376
|
+
qe as _VkfFormItemCtx,
|
|
377
|
+
we as __VkfFormItem,
|
|
378
|
+
xe as default
|
|
305
379
|
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
declare var __VLS_9: {},
|
|
1
|
+
declare var __VLS_9: {}, __VLS_17: {}, __VLS_19: {}, __VLS_22: {
|
|
2
2
|
label: string;
|
|
3
|
-
},
|
|
3
|
+
}, __VLS_60: {}, __VLS_63: {
|
|
4
4
|
error: string;
|
|
5
5
|
};
|
|
6
6
|
type __VLS_Slots = {} & {
|
|
7
7
|
before?: (props: typeof __VLS_9) => any;
|
|
8
8
|
} & {
|
|
9
|
-
default?: (props: typeof
|
|
9
|
+
default?: (props: typeof __VLS_17) => any;
|
|
10
10
|
} & {
|
|
11
|
-
after?: (props: typeof
|
|
11
|
+
after?: (props: typeof __VLS_19) => any;
|
|
12
12
|
} & {
|
|
13
|
-
label?: (props: typeof
|
|
13
|
+
label?: (props: typeof __VLS_22) => any;
|
|
14
14
|
} & {
|
|
15
|
-
labelActions?: (props: typeof
|
|
15
|
+
labelActions?: (props: typeof __VLS_60) => any;
|
|
16
16
|
} & {
|
|
17
|
-
error?: (props: typeof
|
|
17
|
+
error?: (props: typeof __VLS_63) => any;
|
|
18
18
|
};
|
|
19
19
|
declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
20
20
|
labelTip: {
|
|
@@ -83,5 +83,5 @@ declare const _props: {
|
|
|
83
83
|
};
|
|
84
84
|
};
|
|
85
85
|
export declare const props: Omit<typeof _props, "size">;
|
|
86
|
-
export declare const createBindProps: <T2 extends import("@vunk/core").NormalObject, EX extends (Extract<"required", keyof T2> | Extract<"error", keyof T2> | Extract<"prop", keyof T2> | Extract<"
|
|
86
|
+
export declare const createBindProps: <T2 extends import("@vunk/core").NormalObject, EX extends (Extract<"required", keyof T2> | Extract<"error", keyof T2> | Extract<"prop", keyof T2> | Extract<"ai", keyof T2> | Extract<"labelPosition", keyof T2> | Extract<"formItemSize", keyof T2> | Extract<"formItemSlots", keyof T2> | Extract<"elRef", keyof T2> | Extract<"inline", keyof T2> | Extract<"readonly", keyof T2> | Extract<"formItemTip", keyof T2> | Extract<"formItemTipClass", keyof T2> | Extract<"labelTip", keyof T2> | Extract<"information", keyof T2> | Extract<"defaultModelValue", keyof T2> | Extract<"labelTipProps", keyof T2> | Extract<"aiOutput", keyof T2> | Extract<"label", keyof T2> | Extract<"labelWidth", keyof T2> | Extract<"rules", keyof T2> | Extract<"validateStatus", keyof T2> | Extract<"for", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2>)[]>(propsArg: T2, excludes?: EX | undefined) => import("vue").ComputedRef<{ [P in EX extends (infer KE)[] ? Exclude<Extract<"required", keyof T2>, KE> | Exclude<Extract<"error", keyof T2>, KE> | Exclude<Extract<"prop", keyof T2>, KE> | Exclude<Extract<"ai", keyof T2>, KE> | Exclude<Extract<"labelPosition", keyof T2>, KE> | Exclude<Extract<"formItemSize", keyof T2>, KE> | Exclude<Extract<"formItemSlots", keyof T2>, KE> | Exclude<Extract<"elRef", keyof T2>, KE> | Exclude<Extract<"inline", keyof T2>, KE> | Exclude<Extract<"readonly", keyof T2>, KE> | Exclude<Extract<"formItemTip", keyof T2>, KE> | Exclude<Extract<"formItemTipClass", keyof T2>, KE> | Exclude<Extract<"labelTip", keyof T2>, KE> | Exclude<Extract<"information", keyof T2>, KE> | Exclude<Extract<"defaultModelValue", keyof T2>, KE> | Exclude<Extract<"labelTipProps", keyof T2>, KE> | Exclude<Extract<"aiOutput", keyof T2>, KE> | Exclude<Extract<"label", keyof T2>, KE> | Exclude<Extract<"labelWidth", keyof T2>, KE> | Exclude<Extract<"rules", keyof T2>, KE> | Exclude<Extract<"validateStatus", keyof T2>, KE> | Exclude<Extract<"for", keyof T2>, KE> | Exclude<Extract<"inlineMessage", keyof T2>, KE> | Exclude<Extract<"showMessage", keyof T2>, KE> : Extract<"required", keyof T2> | Extract<"error", keyof T2> | Extract<"prop", keyof T2> | Extract<"ai", keyof T2> | Extract<"labelPosition", keyof T2> | Extract<"formItemSize", keyof T2> | Extract<"formItemSlots", keyof T2> | Extract<"elRef", keyof T2> | Extract<"inline", keyof T2> | Extract<"readonly", keyof T2> | Extract<"formItemTip", keyof T2> | Extract<"formItemTipClass", keyof T2> | Extract<"labelTip", keyof T2> | Extract<"information", keyof T2> | Extract<"defaultModelValue", keyof T2> | Extract<"labelTipProps", keyof T2> | Extract<"aiOutput", keyof T2> | Extract<"label", keyof T2> | Extract<"labelWidth", keyof T2> | Extract<"rules", keyof T2> | Extract<"validateStatus", keyof T2> | Extract<"for", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2>]: { [k in Extract<"required", keyof T2> | Extract<"error", keyof T2> | Extract<"prop", keyof T2> | Extract<"ai", keyof T2> | Extract<"labelPosition", keyof T2> | Extract<"formItemSize", keyof T2> | Extract<"formItemSlots", keyof T2> | Extract<"elRef", keyof T2> | Extract<"inline", keyof T2> | Extract<"readonly", keyof T2> | Extract<"formItemTip", keyof T2> | Extract<"formItemTipClass", keyof T2> | Extract<"labelTip", keyof T2> | Extract<"information", keyof T2> | Extract<"defaultModelValue", keyof T2> | Extract<"labelTipProps", keyof T2> | Extract<"aiOutput", keyof T2> | Extract<"label", keyof T2> | Extract<"labelWidth", keyof T2> | Extract<"rules", keyof T2> | Extract<"validateStatus", keyof T2> | Extract<"for", keyof T2> | Extract<"inlineMessage", keyof T2> | Extract<"showMessage", keyof T2>]: T2[k]; }[P]; }>;
|
|
87
87
|
export {};
|
|
@@ -163,6 +163,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
163
163
|
};
|
|
164
164
|
}, "size">>> & Readonly<{}>, {
|
|
165
165
|
required: import("element-plus/es/utils/index.mjs").EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
166
|
+
ai: import("../../ai-provider/index.ts").AiConfig;
|
|
166
167
|
labelPosition: "start" | "left" | "right" | "top" | "end";
|
|
167
168
|
formItemSize: "small" | "default" | "large";
|
|
168
169
|
formItemSlots: import("./types.ts").FormItemSlots;
|
|
@@ -172,7 +173,6 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
172
173
|
labelTip: string;
|
|
173
174
|
information: boolean;
|
|
174
175
|
labelTipProps: import("element-plus").UseTooltipProps;
|
|
175
|
-
ai: import("../../ai-provider/index.ts").AiConfig;
|
|
176
176
|
inlineMessage: import("element-plus/es/utils/index.mjs").EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
177
177
|
showMessage: import("element-plus/es/utils/index.mjs").EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
178
178
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -4,8 +4,12 @@ export declare function useAiGenerate(props: {
|
|
|
4
4
|
aiOutput?: any;
|
|
5
5
|
prop?: any;
|
|
6
6
|
label?: string;
|
|
7
|
+
}, options?: {
|
|
8
|
+
/** 生成开始前调用,此时字段尚未进入生成态 */
|
|
9
|
+
onBeforeGenerate?: () => void;
|
|
7
10
|
}): {
|
|
8
11
|
hasAi: import("vue").ComputedRef<boolean>;
|
|
9
12
|
generating: import("vue").Ref<boolean, boolean>;
|
|
10
|
-
|
|
13
|
+
aiTip: import("vue").ComputedRef<string>;
|
|
14
|
+
handleGenerate: (event?: MouseEvent) => Promise<void>;
|
|
11
15
|
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare var __VLS_1: {};
|
|
2
|
+
type __VLS_Slots = {} & {
|
|
3
|
+
default?: (props: typeof __VLS_1) => any;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
6
|
+
suspended: {
|
|
7
|
+
type: BooleanConstructor;
|
|
8
|
+
default: boolean;
|
|
9
|
+
};
|
|
10
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
11
|
+
suspended: {
|
|
12
|
+
type: BooleanConstructor;
|
|
13
|
+
default: boolean;
|
|
14
|
+
};
|
|
15
|
+
}>> & Readonly<{}>, {
|
|
16
|
+
suspended: boolean;
|
|
17
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
18
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
21
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
22
|
+
new (): {
|
|
23
|
+
$slots: S;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -56,6 +56,10 @@ export declare const props: {
|
|
|
56
56
|
required: import("element-plus/es/utils/index.mjs").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
|
|
57
57
|
error: StringConstructor;
|
|
58
58
|
prop: null;
|
|
59
|
+
ai: {
|
|
60
|
+
type: PropType<import("../../ai-provider").AiConfig>;
|
|
61
|
+
default: undefined;
|
|
62
|
+
};
|
|
59
63
|
labelPosition: {
|
|
60
64
|
type: PropType<"left" | "right" | "top" | "start" | "end">;
|
|
61
65
|
default: undefined;
|
|
@@ -94,10 +98,6 @@ export declare const props: {
|
|
|
94
98
|
type: PropType<import("element-plus").UseTooltipProps>;
|
|
95
99
|
default: () => {};
|
|
96
100
|
};
|
|
97
|
-
ai: {
|
|
98
|
-
type: PropType<import("../../ai-provider").AiConfig>;
|
|
99
|
-
default: undefined;
|
|
100
|
-
};
|
|
101
101
|
aiOutput: null;
|
|
102
102
|
label: StringConstructor;
|
|
103
103
|
labelWidth: {
|