@vunk/form 2.19.24 → 2.19.26

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.
Files changed (106) hide show
  1. package/components/ai-provider/index.cjs +1 -1
  2. package/components/ai-provider/index.d.ts +2 -2
  3. package/components/ai-provider/index.mjs +98 -44
  4. package/components/ai-provider/src/ctx.d.ts +9 -1
  5. package/components/ai-provider/src/index.vue.d.ts +43 -6
  6. package/components/ai-provider/src/types.d.ts +45 -0
  7. package/components/ai-provider/src/use.d.ts +3 -1
  8. package/components/api-tables-select/src/ctx.d.ts +7 -7
  9. package/components/api-tables-select/src/index.vue.d.ts +9 -9
  10. package/components/button/src/ctx.d.ts +7 -7
  11. package/components/button/src/index.vue.d.ts +35 -35
  12. package/components/card-input-collection/src/core.vue.d.ts +12 -12
  13. package/components/card-input-collection/src/ctx.d.ts +5 -5
  14. package/components/card-input-collection/src/index.vue.d.ts +12 -12
  15. package/components/cascader/src/ctx.d.ts +8 -109
  16. package/components/cascader/src/index.vue.d.ts +16 -217
  17. package/components/checkbox/src/ctx.d.ts +7 -7
  18. package/components/checkbox/src/index.vue.d.ts +54 -54
  19. package/components/color-picker/src/ctx.d.ts +7 -108
  20. package/components/color-picker/src/index.vue.d.ts +16 -217
  21. package/components/components.css +1 -1
  22. package/components/date-picker/src/ctx.d.ts +9 -110
  23. package/components/date-picker/src/index.vue.d.ts +20 -221
  24. package/components/date-picker-range/src/ctx.d.ts +6 -107
  25. package/components/date-picker-range/src/index.vue.d.ts +34 -436
  26. package/components/dialog/src/ctx.d.ts +4 -4
  27. package/components/dialog/src/index.vue.d.ts +12 -8
  28. package/components/dialog-input-collection/src/ctx.d.ts +5 -5
  29. package/components/dialog-input-collection/src/index.vue.d.ts +11 -11
  30. package/components/download-plus/src/ctx.d.ts +5 -5
  31. package/components/download-plus/src/index.vue.d.ts +75 -75
  32. package/components/editable-text/src/ctx.d.ts +5 -5
  33. package/components/editable-text/src/index.vue.d.ts +11 -11
  34. package/components/esri-input-geojson/src/append.vue.d.ts +25 -25
  35. package/components/esri-input-geojson/src/ctx.d.ts +11 -11
  36. package/components/esri-input-geojson/src/index.vue.d.ts +101 -101
  37. package/components/form/src/ctx.d.ts +2 -2
  38. package/components/form/src/index.vue.d.ts +12 -12
  39. package/components/form-item/index.cjs +1 -1
  40. package/components/form-item/index.mjs +218 -144
  41. package/components/form-item/src/core.vue.d.ts +7 -7
  42. package/components/form-item/src/ctx.d.ts +3 -3
  43. package/components/form-item/src/index.vue.d.ts +5 -5
  44. package/components/form-item/src/use.d.ts +5 -1
  45. package/components/form-item/src/validate-guard.vue.d.ts +25 -0
  46. package/components/information-collection/src/ctx.d.ts +5 -5
  47. package/components/information-collection/src/index.vue.d.ts +11 -11
  48. package/components/information-tag/src/ctx.d.ts +1 -1
  49. package/components/information-tag/src/index.vue.d.ts +3 -3
  50. package/components/input/src/ctx.d.ts +11 -11
  51. package/components/input/src/index.vue.d.ts +71 -71
  52. package/components/input-array/src/ctx.d.ts +5 -5
  53. package/components/input-array/src/index.vue.d.ts +11 -11
  54. package/components/input-collection/src/core.vue.d.ts +15 -15
  55. package/components/input-collection/src/ctx.d.ts +5 -5
  56. package/components/input-collection/src/index.vue.d.ts +15 -15
  57. package/components/input-file/src/index.vue.d.ts +12 -12
  58. package/components/input-link/src/ctx.d.ts +9 -9
  59. package/components/input-link/src/index.vue.d.ts +95 -95
  60. package/components/input-number/src/ctx.d.ts +9 -9
  61. package/components/input-number/src/index.vue.d.ts +51 -51
  62. package/components/input-tag/src/ctx.d.ts +8 -8
  63. package/components/input-tag/src/index.vue.d.ts +41 -41
  64. package/components/monaco-editor/src/ctx.d.ts +5 -5
  65. package/components/monaco-editor/src/index.vue.d.ts +16 -16
  66. package/components/radio/src/ctx.d.ts +6 -6
  67. package/components/radio/src/index.vue.d.ts +33 -33
  68. package/components/radio/src/wraper.vue.d.ts +13 -13
  69. package/components/select/src/core.vue.d.ts +34 -43
  70. package/components/select/src/ctx.d.ts +9 -14
  71. package/components/select/src/index.vue.d.ts +25 -34
  72. package/components/slider/src/ctx.d.ts +8 -8
  73. package/components/slider/src/index.vue.d.ts +18 -18
  74. package/components/switch/src/ctx.d.ts +6 -6
  75. package/components/switch/src/index.vue.d.ts +13 -13
  76. package/components/tables-select/index.mjs +4 -1
  77. package/components/tables-select/src/ctx.d.ts +13 -13
  78. package/components/tables-select/src/index.vue.d.ts +15 -15
  79. package/components/templates-default/src/index.vue.d.ts +420 -1131
  80. package/components/templates-esri/src/index.vue.d.ts +101 -101
  81. package/components/templates-layout/src/index.vue.d.ts +3 -3
  82. package/components/templates-variant/src/index.vue.d.ts +34 -436
  83. package/components/time-picker/src/ctx.d.ts +9 -110
  84. package/components/time-picker/src/index.vue.d.ts +19 -220
  85. package/components/upload/src/ctx.d.ts +6 -6
  86. package/components/upload/src/file.vue.d.ts +21 -21
  87. package/components/upload/src/index.vue.d.ts +45 -45
  88. package/components/upload/src/wraper.vue.d.ts +12 -12
  89. package/components/upload-plus/src/ctx.d.ts +5 -5
  90. package/components/upload-plus/src/index.vue.d.ts +11 -11
  91. package/components/van-cascader/src/ctx.d.ts +7 -108
  92. package/components/van-cascader/src/index.vue.d.ts +16 -217
  93. package/components/var-datetime-picker/src/const.d.ts +1 -1
  94. package/components/var-datetime-picker/src/ctx.d.ts +5 -5
  95. package/components/var-datetime-picker/src/index.vue.d.ts +37 -238
  96. package/components/vditor/src/ctx.d.ts +5 -5
  97. package/components/vditor/src/index.vue.d.ts +17 -17
  98. package/index.css +1 -1
  99. package/locale/index.cjs +1 -1
  100. package/locale/index.mjs +9 -3
  101. package/locale/lang/ar.d.ts +2 -0
  102. package/locale/lang/en.d.ts +2 -0
  103. package/locale/lang/zh-cn.d.ts +2 -0
  104. package/package.json +1 -1
  105. package/shared/element-plus/ctx.d.ts +2 -2
  106. package/shared/element-plus/instances.d.ts +6 -208
@@ -1,18 +1,18 @@
1
- import { formItemProps as w, ElFormItem as L, ElTooltip as G, ElButton as j, ElIcon as K } from "element-plus";
2
- import { bindPropsFactory as x } from "@vunk/core/shared/utils-vue";
3
- import { ref as _, computed as I, defineComponent as z, openBlock as c, createBlock as O, unref as f, mergeProps as R, withCtx as u, renderSlot as d, normalizeProps as $, guardReactiveProps as B, createElementBlock as A, toDisplayString as D, createCommentVNode as y, createVNode as T, normalizeClass as W, createElementVNode as H, h as J } from "vue";
4
- import { createFormItemBindProps as Q } from "@vunk/form/shared/element-plus";
5
- import { useRendererData as q, useFormMitt as U, useComputedReadonly as X, useComputedLabelPosition as Y } from "@vunk/form/composables";
6
- import { useLocale as F } from "@vunk/form/composables/element-plus";
7
- import { isPlainObject as E } from "@vunk/core/shared/utils-object";
8
- import { PATTERN_OPTIONS as Z } from "@vunk/form/shared/rules";
9
- import { w as ee } from "../index-DCNYT7Wv.mjs";
10
- import { useCollapseItemContext as te } from "@vunk/form/components/collapse-item";
11
- import { VkfGenerateIcon as le } from "@vunk/form/components/generate-icon";
12
- import { useAi as ae } from "@vunk/form/components/ai-provider";
13
- import { useAiSchema as oe } from "@vunk/form/components/form-item-renderer";
14
- const M = {
15
- ...w,
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(M, "size");
66
- const V = M, ne = x(V), Se = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
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: ne,
69
- props: V
68
+ createBindProps: ge,
69
+ props: E
70
70
  }, Symbol.toStringTag, { value: "Module" }));
71
- function re(e) {
72
- const r = ae(), { data: b, getDataValue: p, emitSetData: i } = q(), { tr: s } = F(), v = oe(), a = _(!1), o = (t) => Array.isArray(t) ? t.join() : String(t), n = I(() => v?.find((t) => o(t.prop) === o(e.prop))), m = I(() => typeof e.ai == "object" && e.ai !== null ? e.ai : void 0), P = I(() => !!r && !!m.value && m.value.enable !== !1), S = (t) => s(
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: t }
84
+ { label: a }
76
85
  );
77
- function h() {
78
- const t = m.value ?? {};
86
+ function V() {
87
+ const a = t.value ?? {};
79
88
  return {
80
- ...t,
81
- prompt: t.prompt ?? S(e.label ?? o(e.prop)),
82
- output: t.output ?? e.aiOutput
89
+ ...a,
90
+ prompt: a.prompt ?? _(e.label ?? n(e.prop)),
91
+ output: a.output ?? e.aiOutput
83
92
  };
84
93
  }
85
- async function l() {
86
- if (!r || a.value || e.prop == null) return;
87
- const t = {
88
- data: b?.value,
89
- getDataValue: p,
90
- emitSetData: i,
94
+ function U() {
95
+ return {
96
+ data: m?.value,
97
+ getDataValue: c,
98
+ emitSetData: d,
91
99
  client: r,
92
- formItem: n.value,
93
- ai: h()
100
+ formItem: S.value,
101
+ ai: V()
94
102
  };
95
- a.value = !0;
96
- try {
97
- if (t.ai.stream && r.generateStream) {
98
- let k = "";
99
- await r.generateStream(t, {
100
- onChunk(N) {
101
- k += N, i?.({ k: e.prop, v: k });
102
- },
103
- onDone() {
104
- k && i?.({ k: e.prop, v: k });
105
- }
106
- });
107
- return;
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: P,
117
- generating: a,
118
- handleGenerate: l
154
+ hasAi: s,
155
+ generating: p,
156
+ aiTip: u,
157
+ handleGenerate: X
119
158
  };
120
159
  }
121
- const ie = {
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
- }, fe = {
182
+ }, Ce = {
125
183
  key: 3,
126
184
  class: "vkf-form-item-label__actions"
127
- }, ue = /* @__PURE__ */ z({
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 r = e, { mittOn: b } = U(), { hasAi: p, generating: i, handleGenerate: s } = re(r), v = te();
149
- return b("afterValidate", ({ invalidFields: a }) => {
150
- if (!a || r.prop == null || !(r.prop in a)) return;
151
- const o = v;
152
- if (!o) return;
153
- const n = o.name;
154
- if (o.accordion) {
155
- if (Object.keys(a)[0] === r.prop) {
156
- if (o.activeNames.includes(n)) return;
157
- o.handleItemClick(n);
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 (o.activeNames.includes(n)) return;
161
- o.handleItemClick(n);
226
+ if (u.activeNames.includes(n)) return;
227
+ u.handleItemClick(n);
162
228
  }
163
- }), (a, o) => (c(), O(f(L), R(a.$attrs, {
164
- ref: (n) => r.elRef?.(n),
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": a.$slots.labelActions
233
+ "has-label-actions": l.$slots.labelActions
168
234
  }],
169
235
  label: e.label
170
236
  }), {
171
- default: u(() => [
172
- d(a.$slots, "before"),
173
- d(a.$slots, "default"),
174
- d(a.$slots, "after"),
175
- e.formItemTip ? (c(), A("div", {
176
- key: 0,
177
- class: W(["vkf-form-item__tip", e.formItemTipClass])
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
- H("span", null, D(e.formItemTip), 1)
180
- ], 2)) : y("", !0)
253
+ L("span", null, R(e.formItemTip), 1)
254
+ ], 2)) : h("", !0)
181
255
  ]),
182
- label: u((n) => [
183
- d(a.$slots, "label", $(B(n)), () => [
184
- e.label ? (c(), A("span", ie, D(n.label), 1)) : y("", !0),
185
- e.labelTip ? (c(), O(f(G), R({
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: u(() => [
190
- T(f(j), {
263
+ default: y(() => [
264
+ P(o(G), {
191
265
  text: "",
192
266
  class: "vkf-form-item-label-tip-button"
193
267
  }, {
194
- default: u(() => [
195
- T(f(K), null, {
196
- default: u(() => [
197
- T(f(ee))
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"])) : y("", !0),
207
- f(p) ? (c(), O(f(j), {
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: f(s)
286
+ onClick: o(T)
213
287
  }, {
214
- default: u(() => [
215
- T(f(le), { generating: f(i) }, null, 8, ["generating"])
288
+ default: y(() => [
289
+ P(o(pe), { generating: o(d) }, null, 8, ["generating"])
216
290
  ]),
217
291
  _: 1
218
- }, 8, ["onClick"])) : y("", !0),
219
- a.$slots.labelActions ? (c(), A("div", fe, [
220
- d(a.$slots, "labelActions")
221
- ])) : y("", !0)
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: u((n) => [
225
- d(a.$slots, "error", $(B(n)))
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
- }), he = /* @__PURE__ */ z({
304
+ }), xe = /* @__PURE__ */ D({
231
305
  name: "VkfFormItem",
232
- props: V,
306
+ props: E,
233
307
  setup(e, {
234
- slots: r
308
+ slots: f
235
309
  }) {
236
- const b = Q(e, ["rules"]), p = X(e), {
237
- tr: i
238
- } = F(), s = _(), v = I(() => e.labelPosition), a = Y(s, v), o = () => e.label || i("vkf.formItem.defaultField", "该字段"), n = (l) => {
239
- if (l.message) return;
240
- l.required && (l.message = i("vkf.formItem.required", "{label}不能为空", {
241
- label: o()
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 t = Z.find((C) => C.value === l.pattern);
244
- t && (l.message = i("vkf.formItem.pattern", "输入 {label} {pattern}", {
245
- label: o(),
246
- pattern: t.title
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
- }, m = I(() => {
249
- let l = [];
250
- return !e.rules && e.required && l.push({
322
+ }, l = C(() => {
323
+ let t = [];
324
+ return !e.rules && e.required && t.push({
251
325
  required: !0
252
- }), E(e.rules) && (l = [e.rules]), Array.isArray(e.rules) && (l = e.rules, e.required && !e.rules.find((t) => t.required) && l.push({
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
- })), l = l.filter((t) => {
255
- if (t && E(t))
256
- return Object.keys(t).filter((g) => !g.startsWith("data-")).length > 0;
257
- }), l.forEach((t) => {
258
- n(t);
259
- }), l;
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: P,
262
- emitSetData: S
263
- } = q();
335
+ getDataValue: u,
336
+ emitSetData: n
337
+ } = W();
264
338
  setTimeout(() => {
265
- e.defaultModelValue !== void 0 && e.prop && P?.(e.prop) === void 0 && S?.({
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 h = (l) => {
271
- s.value = l?.$el ?? l, typeof e.elRef == "function" && e.elRef(l);
344
+ const S = (t) => {
345
+ c.value = t?.$el ?? t, typeof e.elRef == "function" && e.elRef(t);
272
346
  };
273
- return () => J(ue, {
274
- ...b.value,
275
- "label-position": a.value,
276
- elRef: h,
347
+ return () => oe(Pe, {
348
+ ...r.value,
349
+ "label-position": v.value,
350
+ elRef: S,
277
351
  class: {
278
- "is-readonly": p.value,
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: m.value,
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
- ...r,
367
+ ...f,
294
368
  ...e.formItemSlots
295
369
  });
296
370
  }
297
- }), Ce = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
371
+ }), we = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
298
372
  __proto__: null
299
373
  }, Symbol.toStringTag, { value: "Module" }));
300
374
  export {
301
- he as VkfFormItem,
302
- Se as _VkfFormItemCtx,
303
- Ce as __VkfFormItem,
304
- he as default
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: {}, __VLS_11: {}, __VLS_13: {}, __VLS_16: {
1
+ declare var __VLS_9: {}, __VLS_17: {}, __VLS_19: {}, __VLS_22: {
2
2
  label: string;
3
- }, __VLS_54: {}, __VLS_57: {
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 __VLS_11) => any;
9
+ default?: (props: typeof __VLS_17) => any;
10
10
  } & {
11
- after?: (props: typeof __VLS_13) => any;
11
+ after?: (props: typeof __VLS_19) => any;
12
12
  } & {
13
- label?: (props: typeof __VLS_16) => any;
13
+ label?: (props: typeof __VLS_22) => any;
14
14
  } & {
15
- labelActions?: (props: typeof __VLS_54) => any;
15
+ labelActions?: (props: typeof __VLS_60) => any;
16
16
  } & {
17
- error?: (props: typeof __VLS_57) => any;
17
+ error?: (props: typeof __VLS_63) => any;
18
18
  };
19
19
  declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
20
20
  labelTip: {
@@ -67,7 +67,7 @@ declare const _props: {
67
67
  };
68
68
  error: StringConstructor;
69
69
  validateStatus: {
70
- readonly type: PropType<import("element-plus/es/utils/index.mjs").EpPropMergeType<StringConstructor, "" | "success" | "error" | "validating", unknown>>;
70
+ readonly type: PropType<import("element-plus/es/utils/index.mjs").EpPropMergeType<StringConstructor, "" | "error" | "success" | "validating", unknown>>;
71
71
  readonly required: false;
72
72
  readonly validator: ((val: unknown) => boolean) | undefined;
73
73
  __epPropKey: true;
@@ -76,12 +76,12 @@ declare const _props: {
76
76
  inlineMessage: import("element-plus/es/utils/index.mjs").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
77
77
  showMessage: import("element-plus/es/utils/index.mjs").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
78
78
  size: {
79
- readonly type: PropType<import("element-plus/es/utils/index.mjs").EpPropMergeType<StringConstructor, "" | "default" | "small" | "large", unknown>>;
79
+ readonly type: PropType<import("element-plus/es/utils/index.mjs").EpPropMergeType<StringConstructor, "" | "default" | "large" | "small", unknown>>;
80
80
  readonly required: false;
81
81
  readonly validator: ((val: unknown) => boolean) | undefined;
82
82
  __epPropKey: true;
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<"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<"ai", 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<"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<"ai", 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<"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<"ai", 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<"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<"ai", 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]; }>;
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 {};
@@ -66,7 +66,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
66
66
  };
67
67
  error: StringConstructor;
68
68
  validateStatus: {
69
- readonly type: import("vue").PropType<import("element-plus/es/utils/index.mjs").EpPropMergeType<StringConstructor, "" | "success" | "error" | "validating", unknown>>;
69
+ readonly type: import("vue").PropType<import("element-plus/es/utils/index.mjs").EpPropMergeType<StringConstructor, "" | "error" | "success" | "validating", unknown>>;
70
70
  readonly required: false;
71
71
  readonly validator: ((val: unknown) => boolean) | undefined;
72
72
  __epPropKey: true;
@@ -75,7 +75,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
75
75
  inlineMessage: import("element-plus/es/utils/index.mjs").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
76
76
  showMessage: import("element-plus/es/utils/index.mjs").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
77
77
  size: {
78
- readonly type: import("vue").PropType<import("element-plus/es/utils/index.mjs").EpPropMergeType<StringConstructor, "" | "default" | "small" | "large", unknown>>;
78
+ readonly type: import("vue").PropType<import("element-plus/es/utils/index.mjs").EpPropMergeType<StringConstructor, "" | "default" | "large" | "small", unknown>>;
79
79
  readonly required: false;
80
80
  readonly validator: ((val: unknown) => boolean) | undefined;
81
81
  __epPropKey: true;
@@ -147,7 +147,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
147
147
  };
148
148
  error: StringConstructor;
149
149
  validateStatus: {
150
- readonly type: import("vue").PropType<import("element-plus/es/utils/index.mjs").EpPropMergeType<StringConstructor, "" | "success" | "error" | "validating", unknown>>;
150
+ readonly type: import("vue").PropType<import("element-plus/es/utils/index.mjs").EpPropMergeType<StringConstructor, "" | "error" | "success" | "validating", unknown>>;
151
151
  readonly required: false;
152
152
  readonly validator: ((val: unknown) => boolean) | undefined;
153
153
  __epPropKey: true;
@@ -156,13 +156,14 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
156
156
  inlineMessage: import("element-plus/es/utils/index.mjs").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
157
157
  showMessage: import("element-plus/es/utils/index.mjs").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
158
158
  size: {
159
- readonly type: import("vue").PropType<import("element-plus/es/utils/index.mjs").EpPropMergeType<StringConstructor, "" | "default" | "small" | "large", unknown>>;
159
+ readonly type: import("vue").PropType<import("element-plus/es/utils/index.mjs").EpPropMergeType<StringConstructor, "" | "default" | "large" | "small", unknown>>;
160
160
  readonly required: false;
161
161
  readonly validator: ((val: unknown) => boolean) | undefined;
162
162
  __epPropKey: true;
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
- handleGenerate: () => Promise<void>;
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
+ };