@dazhicheng/ui 1.5.215 → 1.5.217

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 (30) hide show
  1. package/dist/components/tt-form/src/config.js +44 -42
  2. package/dist/components/tt-form/src/form-render/FormField.vue2.js +67 -70
  3. package/dist/components/tt-form/src/form-render/FormFieldContact.d.ts +9 -0
  4. package/dist/components/tt-form/src/form-render/FormFieldContact.js +28 -25
  5. package/dist/components/tt-form/src/form-render/array-register/FormArrayRegister.d.ts +3 -0
  6. package/dist/components/tt-form/src/form-render/array-register/FormArrayRegister.js +20 -18
  7. package/dist/components/tt-form/src/form-render/array-register/props.d.ts +4 -0
  8. package/dist/components/tt-form/src/form-render/array-register/props.js +1 -0
  9. package/dist/components/tt-form/src/form-render/array-register/types.d.ts +4 -0
  10. package/dist/components/tt-form/src/form-render/dependencies.d.ts +5 -0
  11. package/dist/components/tt-form/src/form-render/dependencies.js +77 -39
  12. package/dist/components/tt-form/src/group-form/GroupForm.vue.d.ts +15 -7
  13. package/dist/components/tt-form/src/group-form/GroupForm.vue2.js +120 -104
  14. package/dist/components/tt-form/src/group-form/GroupSection.vue.d.ts +1 -0
  15. package/dist/components/tt-form/src/group-form/GroupSection.vue2.js +68 -64
  16. package/dist/components/tt-form/src/group-form/LazyFormField.vue.d.ts +1 -0
  17. package/dist/components/tt-form/src/group-form/LazyFormField.vue.js +131 -101
  18. package/dist/components/tt-form/src/group-form/groupFormApi.d.ts +110 -46
  19. package/dist/components/tt-form/src/group-form/groupFormApi.js +465 -314
  20. package/dist/components/tt-form/src/group-form/lazyContext.d.ts +15 -13
  21. package/dist/components/tt-form/src/group-form/lazyContext.js +42 -26
  22. package/dist/components/tt-form/src/group-form/types.d.ts +13 -3
  23. package/dist/components/tt-form/src/group-form/useGroupForm.js +47 -50
  24. package/dist/components/tt-form/src/hooks/useFieldArray.js +101 -93
  25. package/dist/components/tt-form/src/hooks/useSelectCollapse.js +47 -47
  26. package/dist/components/tt-form/src/types.d.ts +3 -5
  27. package/dist/components/tt-modal-form/index.vue.js +12 -11
  28. package/dist/components/tt-table/src/TableForm.vue.js +3 -2
  29. package/dist/style.css +1 -1
  30. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  import "axios";
2
2
  import "element-plus";
3
3
  import { isString as x } from "../../../../packages/utils/src/is.js";
4
- import { ref as A, computed as i, toValue as E, watch as z, nextTick as T } from "vue";
4
+ import { ref as A, computed as c, toValue as E, watch as z, nextTick as y } from "vue";
5
5
  import { calcWordsWidth as L } from "../../../../packages/utils/src/tool.js";
6
6
  import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
7
7
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
@@ -10,81 +10,81 @@ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mo
10
10
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
11
11
  import "lodash-es";
12
12
  import { useResizeObserver as F } from "@vueuse/core";
13
- function I(r) {
14
- const n = A(1), a = ["ElSelect", "ElSelectV2"], u = () => r.value.component, s = () => E(r.value.componentProps), p = () => r.value.selectWrapRef, b = () => r.value.selectRef, m = i(() => {
15
- const t = u();
16
- return x(t) && a.includes(t);
17
- }), f = i(() => {
18
- var o;
19
- const t = u(), e = s();
20
- return t === "TtApiComponent" && a.includes((o = e == null ? void 0 : e.component) == null ? void 0 : o.name);
21
- }), R = i(() => {
22
- const t = s();
23
- if (m.value || f.value) {
24
- const e = {
25
- clearable: !0,
26
- filterable: !0
13
+ function J(r) {
14
+ const o = A(1), s = ["ElSelect", "ElSelectV2"], u = () => r.value.component, a = () => E(r.value.componentProps), p = () => r.value.selectWrapRef, T = () => r.value.selectRef, f = c(() => {
15
+ const e = u();
16
+ return x(e) && s.includes(e);
17
+ }), m = c(() => {
18
+ var l;
19
+ const e = u(), t = a();
20
+ return e === "TtApiComponent" && s.includes((l = t == null ? void 0 : t.component) == null ? void 0 : l.name);
21
+ }), R = c(() => {
22
+ const e = a();
23
+ if (f.value || m.value) {
24
+ const t = {
25
+ clearable: (e == null ? void 0 : e.clearable) ?? !0,
26
+ filterable: (e == null ? void 0 : e.filterable) ?? !0
27
27
  };
28
- return t != null && t.multiple && (e.collapseTagsTooltip = !0, e.collapseTags = !0, e.maxCollapseTags = n.value), e;
28
+ return e != null && e.multiple && (t.collapseTagsTooltip = !0, t.collapseTags = !0, t.maxCollapseTags = o.value, (e == null ? void 0 : e.placeholder) === void 0 && (t.placeholder = "支持多选")), t;
29
29
  }
30
30
  return {};
31
31
  });
32
32
  function v() {
33
- var e, o, l, c;
34
- const t = b();
35
- if (f.value)
36
- return (l = (o = (e = t.value) == null ? void 0 : e.getComponentRef) == null ? void 0 : o.call(e)) == null ? void 0 : l.selectedLabel;
33
+ var t, l, n, i;
34
+ const e = T();
37
35
  if (m.value)
38
- return (c = t.value) == null ? void 0 : c.selectedLabel;
36
+ return (n = (l = (t = e.value) == null ? void 0 : t.getComponentRef) == null ? void 0 : l.call(t)) == null ? void 0 : n.selectedLabel;
37
+ if (f.value)
38
+ return (i = e.value) == null ? void 0 : i.selectedLabel;
39
39
  }
40
- function g() {
41
- var h;
42
- if (!((h = s()) != null && h.multiple)) {
43
- n.value = 1;
40
+ function d() {
41
+ var C;
42
+ if (!((C = a()) != null && C.multiple)) {
43
+ o.value = 1;
44
44
  return;
45
45
  }
46
- const t = v();
47
- if (!Array.isArray(t)) {
48
- n.value = 1;
46
+ const e = v();
47
+ if (!Array.isArray(e)) {
48
+ o.value = 1;
49
49
  return;
50
50
  }
51
- if (!t.length) {
52
- n.value = 1;
51
+ if (!e.length) {
52
+ o.value = 1;
53
53
  return;
54
54
  }
55
- const e = p().value;
56
- if (!e) {
57
- n.value = 1;
55
+ const t = p().value;
56
+ if (!t) {
57
+ o.value = 1;
58
58
  return;
59
59
  }
60
- const o = e.querySelector(".el-select__selection");
61
- if (!o) {
62
- n.value = 1;
60
+ const l = t.querySelector(".el-select__selection");
61
+ if (!l) {
62
+ o.value = 1;
63
63
  return;
64
64
  }
65
- const l = window.getComputedStyle(o), c = l.fontFamily, W = l.fontSize, d = o.clientWidth - 48;
66
- if (d <= 0) {
67
- n.value = 1;
65
+ const n = window.getComputedStyle(l), i = n.fontFamily, W = n.fontSize, g = l.clientWidth - 48;
66
+ if (g <= 0) {
67
+ o.value = 1;
68
68
  return;
69
69
  }
70
- let S = 0, C = 0;
71
- t.slice(0).forEach((w) => {
72
- const y = L(w, W, c) + 32 + 4;
73
- S + y < d && (S += y, C += 1);
74
- }), n.value = Math.max(1, C);
70
+ let h = 0, S = 0;
71
+ e.slice(0).forEach((w) => {
72
+ const b = L(w, W, i) + 32 + 4;
73
+ h + b < g && (h += b, S += 1);
74
+ }), o.value = Math.max(1, S);
75
75
  }
76
76
  return z(
77
77
  v,
78
78
  async () => {
79
- await T(), g();
79
+ await y(), d();
80
80
  },
81
81
  { flush: "post", deep: !0 }
82
82
  ), F(p(), async () => {
83
- await T(), g();
83
+ await y(), d();
84
84
  }), {
85
85
  selectComponentProps: R
86
86
  };
87
87
  }
88
88
  export {
89
- I as useSelectCollapseOptions
89
+ J as useSelectCollapseOptions
90
90
  };
@@ -1,4 +1,4 @@
1
- import { ButtonProps, CheckboxProps, CheckboxGroupProps, DatePickerProps, InputProps, InputNumberProps, RadioProps, RadioGroupProps, SelectProps, SelectV2Props, SwitchProps, TimePickerDefaultProps, UploadProps, CascaderProps, ColorPickerProps } from 'element-plus';
1
+ import { ButtonProps, CheckboxProps, CheckboxGroupProps, DatePickerProps, InputProps, InputNumberProps, InputTagProps, MentionProps, RadioProps, RadioGroupProps, SelectProps, SelectV2Props, SwitchProps, TimePickerDefaultProps, UploadProps, CascaderProps, ColorPickerProps } from 'element-plus';
2
2
  import { FieldOptions, FormContext, GenericObject } from 'vee-validate';
3
3
  import { Component, HtmlHTMLAttributes, MaybeRefOrGetter, Ref, VNodeChild } from 'vue';
4
4
  import { ZodTypeAny } from 'zod';
@@ -23,6 +23,8 @@ export interface BaseFormComponentMap {
23
23
  ElDatePicker: DatePickerProps;
24
24
  ElInput: InputProps;
25
25
  ElInputNumber: InputNumberProps;
26
+ ElInputTag: InputTagProps;
27
+ ElMention: MentionProps;
26
28
  ElRadio: RadioProps;
27
29
  ElRadioGroup: RadioGroupProps;
28
30
  ElSelect: SelectProps;
@@ -561,10 +563,6 @@ export type ExtendedFormApi = Omit<FormApi, "getValues" | "validate" | "setState
561
563
  * @param {string[]} fieldNames - 要移除的字段名列表
562
564
  */
563
565
  removeFields?: (fieldNames: string[]) => void;
564
- /**
565
- * @description 分组表单 reset 时递增(仅 GroupFormApi / useGroupForm)
566
- */
567
- resetSignal?: Ref<number>;
568
566
  };
569
567
  export interface TtFormAdapterOptions<T extends BaseFormComponentType = BaseFormComponentType> {
570
568
  config?: {
@@ -1,7 +1,7 @@
1
1
  import { defineComponent as G, useSlots as H, ref as K, computed as F, toValue as J, nextTick as y, watch as Q, createBlock as C, openBlock as M, unref as d, createSlots as B, withCtx as A, renderSlot as h, createVNode as W, renderList as P, normalizeProps as S, guardReactiveProps as b, createCommentVNode as X } from "vue";
2
2
  import "axios";
3
3
  import { ElCheckbox as Y, ElMessage as V } from "element-plus";
4
- import { isFunction as m } from "../../packages/utils/src/is.js";
4
+ import { isFunction as u } from "../../packages/utils/src/is.js";
5
5
  import "xe-utils";
6
6
  import "dayjs";
7
7
  import "dayjs/plugin/utc";
@@ -21,6 +21,7 @@ import "../tt-api-component/index.js";
21
21
  import "vee-validate";
22
22
  import { useForm as ee } from "../tt-form/src/useForm.js";
23
23
  import "zod";
24
+ import "@vee-validate/zod";
24
25
  import "@tanstack/vue-store";
25
26
  import "es-toolkit/compat";
26
27
  import "../tt-form/src/shared/zod-defaults.js";
@@ -38,7 +39,7 @@ import "../tt-form/src/form-render/FormFieldContact.js";
38
39
  import "../tt-modal/index.js";
39
40
  import { useModalFormSlot as oe } from "./hooks/useModalFormSlot.js";
40
41
  import { useModalRender as te } from "../tt-modal/src/hooks/useModalRender.js";
41
- const je = /* @__PURE__ */ G({
42
+ const Ue = /* @__PURE__ */ G({
42
43
  name: "TtModalForm",
43
44
  __name: "index",
44
45
  props: {
@@ -76,7 +77,7 @@ const je = /* @__PURE__ */ G({
76
77
  }
77
78
  if (e.schemas && s.setState({ schema: e.schemas }), e != null && e.title && a.setModalProps({ title: e.title }), f.value = e[o.infoApiIdKey], e != null && e[o.infoApiIdKey]) {
78
79
  const i = o.infoApi;
79
- if (!m(i)) {
80
+ if (!u(i)) {
80
81
  v(e);
81
82
  return;
82
83
  }
@@ -85,8 +86,8 @@ const je = /* @__PURE__ */ G({
85
86
  const t = {
86
87
  ...o.infoApiParams,
87
88
  [o.infoApiIdKey]: e[o.infoApiIdKey]
88
- }, n = m(o.infoApiBefore) ? await o.infoApiBefore(t) : t, l = await i(n), c = o.dataField ? Z(l, o.dataField) : l, u = m(o.infoApiAfter) ? await o.infoApiAfter(c) : c;
89
- g(u), p("getinfo", u), await y(), await s.resetForm({ values: u });
89
+ }, n = u(o.infoApiBefore) ? await o.infoApiBefore(t) : t, l = await i(n), c = o.dataField ? Z(l, o.dataField) : l, m = u(o.infoApiAfter) ? await o.infoApiAfter(c) : c;
90
+ g(m), p("getinfo", m), await y(), await s.resetForm({ values: m });
90
91
  } finally {
91
92
  a.changeLoading(!1);
92
93
  }
@@ -106,8 +107,8 @@ const je = /* @__PURE__ */ G({
106
107
  function g(e) {
107
108
  const i = Object.keys(o.checkedOptions || {});
108
109
  i.length && i.forEach((t) => {
109
- var u;
110
- const n = (u = o.checkedOptions) == null ? void 0 : u[t];
110
+ var m;
111
+ const n = (m = o.checkedOptions) == null ? void 0 : m[t];
111
112
  if (!Array.isArray(n) || n.length === 0)
112
113
  return;
113
114
  const [l, c] = n.length === 1 ? [n[0], n[0]] : n;
@@ -123,18 +124,18 @@ const je = /* @__PURE__ */ G({
123
124
  ...e,
124
125
  ...i
125
126
  };
126
- return t = m(o.saveApiBefore) ? await o.saveApiBefore(t) : t, { reqParams: t, formValue: e };
127
+ return t = u(o.saveApiBefore) ? await o.saveApiBefore(t) : t, { reqParams: t, formValue: e };
127
128
  }
128
129
  async function j(e, i) {
129
130
  const { editApi: t } = o;
130
- !t || !m(t) || (e[o.infoApiIdKey] = f.value, await t(e, i.files), V.success("修改成功"), p("submit", {
131
+ !t || !u(t) || (e[o.infoApiIdKey] = f.value, await t(e, i.files), V.success("修改成功"), p("submit", {
131
132
  ...e,
132
133
  continuousChecked: r.value
133
134
  }), a.closeModal());
134
135
  }
135
136
  async function U(e, i) {
136
137
  const { addApi: t } = o;
137
- !t || !m(t) || (await t(e, i.files), V.success("新增成功"), p("submit", {
138
+ !t || !u(t) || (await t(e, i.files), V.success("新增成功"), p("submit", {
138
139
  ...e,
139
140
  continuousChecked: r.value
140
141
  }), (!r.value || !o.isContinuousChecked) && a.closeModal());
@@ -207,5 +208,5 @@ const je = /* @__PURE__ */ G({
207
208
  }
208
209
  });
209
210
  export {
210
- je as default
211
+ Ue as default
211
212
  };
@@ -26,6 +26,7 @@ import "../../tt-api-component/index.js";
26
26
  import "vee-validate";
27
27
  import { useForm as De } from "../../tt-form/src/useForm.js";
28
28
  import "zod";
29
+ import "@vee-validate/zod";
29
30
  import { useStore as Ne } from "@tanstack/vue-store";
30
31
  import "es-toolkit/compat";
31
32
  import "../../tt-form/src/shared/zod-defaults.js";
@@ -72,7 +73,7 @@ import { useTableSlot as Ze } from "./hooks/useTableSlot.js";
72
73
  import { tableFormProps as et } from "./props.js";
73
74
  import { getDefaultState as tt } from "./utils/table-api.js";
74
75
  import { TableFormApi as ot } from "./utils/table-form-api.js";
75
- const rt = ["data-testid"], st = ["data-testid"], Io = /* @__PURE__ */ Me({
76
+ const rt = ["data-testid"], st = ["data-testid"], Mo = /* @__PURE__ */ Me({
76
77
  name: "TtTableForm",
77
78
  __name: "TableForm",
78
79
  props: et,
@@ -365,5 +366,5 @@ const rt = ["data-testid"], st = ["data-testid"], Io = /* @__PURE__ */ Me({
365
366
  }
366
367
  });
367
368
  export {
368
- Io as default
369
+ Mo as default
369
370
  };