vft 0.0.494 → 0.0.495

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 (42) hide show
  1. package/dist/index.css +1 -1
  2. package/es/components/carousel/use-carousel.js +1 -1
  3. package/es/components/input/input.vue2.js +4 -4
  4. package/es/components/input-tag/composables/use-input-tag.js +1 -1
  5. package/es/components/super-form/index.d.ts +9 -0
  6. package/es/components/super-form/super-form-item.vue2.js +219 -219
  7. package/es/components/super-form/super-form.vue2.js +97 -95
  8. package/es/components/super-form/types.d.ts +4 -0
  9. package/es/components/super-form/use/use-form-events.d.ts +1 -0
  10. package/es/components/super-form/use/use-form-events.js +205 -171
  11. package/es/components/table/field.js +60 -55
  12. package/es/components/table/index.d.ts +3 -3
  13. package/es/components/table/table.vue.d.ts +1 -1
  14. package/es/components/table/types.d.ts +2 -2
  15. package/es/components/table/use/use-data-source.d.ts +1 -1
  16. package/es/components/table/use/use-data-source.js +136 -119
  17. package/es/components/table/use/use-loading.js +15 -13
  18. package/es/hooks/use-z-index/index.js +3 -3
  19. package/es/package.json.d.ts +1 -1
  20. package/es/package.json.js +1 -1
  21. package/es/utils/vue/vnode.js +1 -1
  22. package/lib/components/input/input.vue2.cjs +1 -1
  23. package/lib/components/super-form/index.d.ts +9 -0
  24. package/lib/components/super-form/super-form-item.vue2.cjs +1 -1
  25. package/lib/components/super-form/super-form.vue2.cjs +1 -1
  26. package/lib/components/super-form/types.d.ts +4 -0
  27. package/lib/components/super-form/use/use-form-events.cjs +1 -1
  28. package/lib/components/super-form/use/use-form-events.d.ts +1 -0
  29. package/lib/components/table/field.cjs +1 -1
  30. package/lib/components/table/index.d.ts +3 -3
  31. package/lib/components/table/table.vue.d.ts +1 -1
  32. package/lib/components/table/types.d.ts +2 -2
  33. package/lib/components/table/use/use-data-source.cjs +1 -1
  34. package/lib/components/table/use/use-data-source.d.ts +1 -1
  35. package/lib/components/table/use/use-loading.cjs +1 -1
  36. package/lib/package.json.cjs +1 -1
  37. package/lib/package.json.d.ts +1 -1
  38. package/package.json +4 -4
  39. package/theme-style/index.css +1 -1
  40. package/theme-style/src/table.scss +2 -4
  41. package/theme-style/vft-table.css +1 -1
  42. package/web-types.json +1 -1
@@ -1,26 +1,26 @@
1
- import { defineComponent as J, useAttrs as le, reactive as ue, ref as m, computed as u, unref as n, watch as d, nextTick as ie, useSlots as me, createBlock as i, createCommentVNode as U, openBlock as l, mergeProps as B, withKeys as fe, withModifiers as ce, withCtx as h, renderSlot as O, normalizeProps as W, createElementBlock as pe, Fragment as de, renderList as j, createSlots as Be, resolveDynamicComponent as A, h as he } from "vue";
2
- import { VftCol as ye } from "../col/index.js";
3
- import { VftForm as ve } from "../form/index.js";
4
- import { VftRow as be } from "../row/index.js";
5
- import { useTimeoutFn as ge, useDebounceFn as we } from "@vueuse/core";
6
- import { cloneDeep as Fe, isEqual as Re, pick as Se, deepMerge as Ce } from "@vft/utils";
1
+ import { defineComponent as j, useAttrs as ue, reactive as ie, ref as m, computed as u, unref as n, watch as d, nextTick as me, useSlots as fe, createBlock as i, createCommentVNode as K, openBlock as r, mergeProps as B, withKeys as ce, withModifiers as pe, withCtx as h, renderSlot as O, normalizeProps as U, createElementBlock as de, Fragment as Be, renderList as W, createSlots as he, resolveDynamicComponent as A, h as ye } from "vue";
2
+ import { VftCol as ve } from "../col/index.js";
3
+ import { VftForm as be } from "../form/index.js";
4
+ import { VftRow as ge } from "../row/index.js";
5
+ import { useTimeoutFn as we, useDebounceFn as Fe } from "@vueuse/core";
6
+ import { cloneDeep as Re, isEqual as Se, pick as Ce, deepMerge as ke } from "@vft/utils";
7
7
  import "../config-provider/hooks/use-global-config.js";
8
8
  import "lodash-es";
9
- import { useNamespace as ke } from "../../hooks/use-namespace/index.js";
9
+ import { useNamespace as Ee } from "../../hooks/use-namespace/index.js";
10
10
  import "../../hooks/use-model-toggle/index.js";
11
11
  import "@popperjs/core";
12
12
  import "../../hooks/use-z-index/index.js";
13
- import Ee from "./super-form-action.vue2.js";
14
- import Oe from "./super-form-item.vue2.js";
15
- import { useAutoFocus as Ae } from "./use/use-auto-focus.js";
13
+ import Oe from "./super-form-action.vue2.js";
14
+ import Ae from "./super-form-item.vue2.js";
15
+ import { useAutoFocus as Me } from "./use/use-auto-focus.js";
16
16
  import { createFormContext as Pe } from "./use/use-form-context.js";
17
17
  import { useFormEvents as Ve } from "./use/use-form-events.js";
18
18
  import { useFormValues as Ie } from "./use/use-form-values.js";
19
- import { willFormExceedOneRow as Me } from "./use/helper.js";
20
- const _e = J({
19
+ import { willFormExceedOneRow as _e } from "./use/helper.js";
20
+ const De = j({
21
21
  name: "vft-super-form"
22
- }), et = /* @__PURE__ */ J({
23
- ..._e,
22
+ }), tt = /* @__PURE__ */ j({
23
+ ...De,
24
24
  props: {
25
25
  size: {
26
26
  default: "default"
@@ -111,6 +111,7 @@ const _e = J({
111
111
  labelWidth: {
112
112
  default: "auto"
113
113
  },
114
+ formatter: {},
114
115
  disabled: {
115
116
  type: Boolean
116
117
  },
@@ -149,30 +150,30 @@ const _e = J({
149
150
  }
150
151
  },
151
152
  emits: ["register", "reset", "submit", "field-value-change", "common-btn-click"],
152
- setup(Q, {
153
- expose: X,
154
- emit: Y
153
+ setup(J, {
154
+ expose: Q,
155
+ emit: X
155
156
  }) {
156
- const P = Q, y = Y, V = ke("super-form"), Z = le(), r = ue({}), p = m({}), v = m(!1), b = m({}), I = m(), g = m(null), M = m(), t = u(() => ({
157
- ...P,
157
+ const M = J, y = X, P = Ee("super-form"), Y = ue(), l = ie({}), p = m({}), v = m(!1), b = m({}), V = m(), g = m(null), I = m(), t = u(() => ({
158
+ ...M,
158
159
  ...n(b)
159
160
  })), f = u(() => ({
160
- ...Z,
161
- ...P,
161
+ ...Y,
162
+ ...M,
162
163
  ...n(t)
163
164
  })), a = u(() => {
164
- const e = n(I);
165
- return Fe(e);
165
+ const e = n(V);
166
+ return Re(e);
166
167
  }), {
167
- handleFormValues: _,
168
+ handleFormValues: Z,
168
169
  initDefault: ee
169
170
  } = Ie({
170
171
  getProps: t,
171
172
  defaultValueRef: p,
172
173
  getSchema: a,
173
- formModel: r
174
+ formModel: l
174
175
  });
175
- Ae({
176
+ Me({
176
177
  getSchema: a,
177
178
  getProps: t,
178
179
  isInitedDefault: v,
@@ -181,28 +182,29 @@ const _e = J({
181
182
  const {
182
183
  handleSubmit: c,
183
184
  setFieldsValue: w,
184
- clearValidate: D,
185
- validate: T,
186
- validateField: x,
185
+ clearValidate: _,
186
+ validate: D,
187
+ validateField: T,
187
188
  getFieldsValue: F,
188
189
  updateSchema: R,
189
190
  resetSchema: S,
190
- appendSchemaByField: q,
191
- removeSchemaByField: L,
191
+ appendSchemaByField: x,
192
+ removeSchemaByField: q,
192
193
  resetFields: C,
193
194
  scrollToField: te,
194
- getFieldValue: $,
195
- setFormItemError: N
195
+ getFieldValue: L,
196
+ setFormItemError: $,
197
+ getFormattedFormModel: oe
196
198
  } = Ve({
197
199
  emit: y,
198
200
  getProps: t,
199
- formModel: r,
201
+ formModel: l,
200
202
  getSchema: a,
201
203
  defaultValueRef: p,
202
204
  formElRef: g,
203
- schemaRef: I,
204
- handleFormValues: _,
205
- initValues: M
205
+ schemaRef: V,
206
+ handleFormValues: Z,
207
+ initValues: I
206
208
  });
207
209
  Pe({
208
210
  resetAction: C,
@@ -216,24 +218,24 @@ const _e = J({
216
218
  }, {
217
219
  immediate: !0
218
220
  }), d(() => n(t).schemas, (e, o) => {
219
- Re(e, o) || S(e ?? []);
221
+ Se(e, o) || S(e ?? []);
220
222
  }), d(() => a.value, (e) => {
221
- ie(() => {
222
- }), !n(v) && e?.length && (ee(), v.value = !0, t.value?.watchDataIsChange && ge(() => {
223
- M.value = F();
223
+ me(() => {
224
+ }), !n(v) && e?.length && (ee(), v.value = !0, t.value?.watchDataIsChange && we(() => {
225
+ I.value = F();
224
226
  }, 40));
225
- }), d(() => r, we(() => {
227
+ }), d(() => l, Fe(() => {
226
228
  n(t).submitOnChange && c();
227
229
  }, 300), {
228
230
  deep: !0
229
231
  });
230
- async function G(e) {
231
- b.value = Ce(n(b) || {}, e);
232
+ async function N(e) {
233
+ b.value = ke(n(b) || {}, e);
232
234
  }
233
- function oe(e, o, s) {
234
- r[e] = o;
235
+ function ne(e, o, s) {
236
+ l[e] = o;
235
237
  }
236
- function ne(e) {
238
+ function ae(e) {
237
239
  const {
238
240
  autoSubmitOnEnter: o
239
241
  } = n(t);
@@ -242,113 +244,113 @@ const _e = J({
242
244
  s && s.tagName && s.tagName.toUpperCase() === "INPUT" && c();
243
245
  }
244
246
  }
245
- const H = {
247
+ const G = {
246
248
  getFieldsValue: F,
247
- getFieldValue: $,
249
+ getFieldValue: L,
248
250
  setFieldsValue: w,
249
251
  resetFields: C,
250
252
  updateSchema: R,
251
253
  resetSchema: S,
252
- setProps: G,
253
- removeSchemaByField: L,
254
- appendSchemaByField: q,
255
- clearValidate: D,
256
- validateField: x,
257
- setFormItemError: N,
258
- validate: T,
254
+ setProps: N,
255
+ removeSchemaByField: q,
256
+ appendSchemaByField: x,
257
+ clearValidate: _,
258
+ validateField: T,
259
+ setFormItemError: $,
260
+ validate: D,
259
261
  submit: c,
260
262
  scrollToField: te
261
263
  };
262
- y("register", H);
263
- const ae = u(() => Se(t.value, ["showResetButton", "showCommonButton", "showSubmitButton", "resetButtonOptions", "submitButtonOptions", "commonButtonOptions", "actionRowOptions", "actionSpan", "submitResetReverse"])), se = u(() => {
264
+ y("register", G);
265
+ const se = u(() => Ce(t.value, ["showResetButton", "showCommonButton", "showSubmitButton", "resetButtonOptions", "submitButtonOptions", "commonButtonOptions", "actionRowOptions", "actionSpan", "submitResetReverse"])), re = u(() => {
264
266
  const {
265
267
  showCommonButton: e,
266
268
  showResetButton: o,
267
269
  showSubmitButton: s
268
270
  } = t.value;
269
271
  return !!(e || o || s);
270
- }), z = u(() => {
272
+ }), H = u(() => {
271
273
  const e = n(a);
272
274
  if (!e || e.length === 0)
273
275
  return !1;
274
276
  try {
275
- return Me(e, t.value, r, p.value).willExceed;
277
+ return _e(e, t.value, l, p.value).willExceed;
276
278
  } catch {
277
279
  return !1;
278
280
  }
279
- }), k = me(), E = (e) => e ? he(Ee, ae.value, {
281
+ }), k = fe(), E = (e) => e ? ye(Oe, se.value, {
280
282
  resetBefore: (o) => k.resetBefore?.(o),
281
283
  submitBefore: (o) => k.submitBefore?.(o),
282
284
  submitAfter: (o) => k.submitAfter?.(o)
283
285
  }) : null;
284
- return X({
286
+ return Q({
285
287
  getFieldsValue: F,
286
- getFieldValue: $,
288
+ getFieldValue: L,
287
289
  setFieldsValue: w,
288
290
  resetFields: C,
289
291
  updateSchema: R,
290
292
  resetSchema: S,
291
- setProps: G,
292
- removeSchemaByField: L,
293
- appendSchemaByField: q,
294
- clearValidate: D,
295
- validateField: x,
296
- validate: T,
293
+ setProps: N,
294
+ removeSchemaByField: q,
295
+ appendSchemaByField: x,
296
+ clearValidate: _,
297
+ validateField: T,
298
+ validate: D,
297
299
  submit: c,
298
300
  getSchema: a,
299
- setFormItemError: N,
300
- formModel: u(() => _(r)),
301
- hasActionButton: se,
302
- willExceedOneRow: z
303
- }), (e, o) => a.value?.length ? (l(), i(n(ve), B({
301
+ setFormItemError: $,
302
+ formModel: u(() => oe()),
303
+ hasActionButton: re,
304
+ willExceedOneRow: H
305
+ }), (e, o) => a.value?.length ? (r(), i(n(be), B({
304
306
  key: 0
305
307
  }, f.value, {
306
308
  ref_key: "formElRef",
307
309
  ref: g,
308
- class: [n(V).b(), {
309
- [n(V).is("exceed-one-row")]: z.value
310
+ class: [n(P).b(), {
311
+ [n(P).is("exceed-one-row")]: H.value
310
312
  }],
311
- model: r,
312
- onSubmit: o[0] || (o[0] = ce(() => {
313
+ model: l,
314
+ onSubmit: o[0] || (o[0] = pe(() => {
313
315
  }, ["prevent"])),
314
- onKeypress: fe(ne, ["enter"])
316
+ onKeypress: ce(ae, ["enter"])
315
317
  }), {
316
- default: h(() => [a.value?.length ? (l(), i(n(be), W(B({
318
+ default: h(() => [a.value?.length ? (r(), i(n(ge), U(B({
317
319
  key: 0
318
320
  }, f.value?.rowProps)), {
319
- default: h(() => [O(e.$slots, "formHeader"), (l(!0), pe(de, null, j(a.value, (s) => (l(), i(Oe, {
321
+ default: h(() => [O(e.$slots, "formHeader"), (r(!0), de(Be, null, W(a.value, (s) => (r(), i(Ae, {
320
322
  key: s.field,
321
- "form-action-type": H,
323
+ "form-action-type": G,
322
324
  schema: s,
323
325
  "form-props": t.value,
324
326
  "all-default-values": p.value,
325
- "form-model": r,
326
- "set-form-model": oe,
327
+ "form-model": l,
328
+ "set-form-model": ne,
327
329
  "update-schema": n(R)
328
- }, Be({
330
+ }, he({
329
331
  _: 2
330
- }, [j(Object.keys(e.$slots), (K) => ({
331
- name: K,
332
- fn: h((re) => [O(e.$slots, K, B({
332
+ }, [W(Object.keys(e.$slots), (z) => ({
333
+ name: z,
334
+ fn: h((le) => [O(e.$slots, z, B({
333
335
  ref_for: !0
334
- }, re || {}))])
335
- }))]), 1032, ["schema", "form-props", "all-default-values", "form-model", "update-schema"]))), 128)), t.value?.customLayout ? (l(), i(A(E(t.value?.showActionButtonGroup && t.value?.actionInline)), {
336
+ }, le || {}))])
337
+ }))]), 1032, ["schema", "form-props", "all-default-values", "form-model", "update-schema"]))), 128)), t.value?.customLayout ? (r(), i(A(E(t.value?.showActionButtonGroup && t.value?.actionInline)), {
336
338
  key: 1
337
- })) : (l(), i(n(ye), W(B({
339
+ })) : (r(), i(n(ve), U(B({
338
340
  key: 0
339
341
  }, f.value?.quickColSpan ? {
340
342
  span: Math.ceil(24 / f.value?.quickColSpan),
341
343
  ...f.value?.baseColProps
342
344
  } : {})), {
343
- default: h(() => [(l(), i(A(E(t.value?.showActionButtonGroup && t.value?.actionInline))))]),
345
+ default: h(() => [(r(), i(A(E(t.value?.showActionButtonGroup && t.value?.actionInline))))]),
344
346
  _: 1
345
347
  }, 16))]),
346
348
  _: 3
347
- }, 16)) : U("", !0), (l(), i(A(E(t.value?.showActionButtonGroup && !t.value?.actionInline)))), O(e.$slots, "formFooter")]),
349
+ }, 16)) : K("", !0), (r(), i(A(E(t.value?.showActionButtonGroup && !t.value?.actionInline)))), O(e.$slots, "formFooter")]),
348
350
  _: 3
349
- }, 16, ["class", "model"])) : U("", !0);
351
+ }, 16, ["class", "model"])) : K("", !0);
350
352
  }
351
353
  });
352
354
  export {
353
- et as default
355
+ tt as default
354
356
  };
@@ -195,6 +195,8 @@ export interface SuperFormProps extends FormInnerProps {
195
195
  submitResetReverse?: boolean;
196
196
  labelPosition?: 'left' | 'right' | 'top';
197
197
  labelWidth?: string | number;
198
+ /** 表单值格式化函数,用于格式化 getFieldsValue 的输出值 */
199
+ formatter?: (values: Recordable) => Recordable;
198
200
  }
199
201
  /** 表单配置模式接口 */
200
202
  export interface FormSchema {
@@ -280,6 +282,8 @@ export interface FormSchema {
280
282
  helpIcon?: IconProps | string;
281
283
  /** 帮助提示配置 */
282
284
  helpTooltip?: string | ToolTipProps;
285
+ /** 字段值格式化函数,用于格式化该字段在 getFieldsValue 中的输出值 */
286
+ formatter?: (value: any, field: string, values: Recordable, schema: FormSchema) => any;
283
287
  }
284
288
  /** 表单项属性接口 */
285
289
  export interface SuperFormItemProps {
@@ -27,5 +27,6 @@ export declare function useFormEvents({ emit, getProps, formModel, getSchema, de
27
27
  scrollToField: (name: any, options?: ScrollOptions | undefined) => Promise<void>;
28
28
  getFieldValue: (field: string) => string | number | Recordable;
29
29
  setFormItemError: (field: string, errMess: string) => Promise<void>;
30
+ getFormattedFormModel: () => Recordable;
30
31
  };
31
32
  export {};