@dazhicheng/ui 1.6.17 → 1.6.18

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.
@@ -1,7 +1,7 @@
1
- import { unref as V, ref as n, computed as N, watch as k } from "vue";
1
+ import { unref as V, ref as n, shallowRef as N, computed as O, watch as j, toRaw as k } from "vue";
2
2
  import "axios";
3
3
  import "element-plus";
4
- import { isFunction as o, isBoolean as E, isString as S } from "../../../../packages/utils/src/is.js";
4
+ import { isFunction as o, isBoolean as E, isObject as A, isString as q } from "../../../../packages/utils/src/is.js";
5
5
  import "dayjs";
6
6
  import "numeral";
7
7
  import "xe-utils";
@@ -13,76 +13,76 @@ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/en
13
13
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
14
14
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
15
15
  import "lodash-es";
16
- import { get as A } from "es-toolkit/compat";
17
- import { useFormValues as B } from "vee-validate";
18
- import { injectFormProps as C } from "../useFormContext.js";
19
- const K = /* @__PURE__ */ new Set(["ElInput", "FormElInput", "ElInputNumber", "ElInputTag", "ElMention"]);
20
- function ir(r) {
21
- const e = S(r) ? r : (r == null ? void 0 : r.name) ?? (r == null ? void 0 : r.__name);
22
- return S(e) && K.has(e) ? "required" : "selectRequired";
16
+ import { get as B } from "es-toolkit/compat";
17
+ import { useFormValues as C } from "vee-validate";
18
+ import { injectFormProps as K } from "../useFormContext.js";
19
+ const M = /* @__PURE__ */ new Set(["ElInput", "FormElInput", "ElInputNumber", "ElInputTag", "ElMention"]);
20
+ function ar(r) {
21
+ const t = q(r) ? r : (r == null ? void 0 : r.name) ?? (r == null ? void 0 : r.__name);
22
+ return q(t) && M.has(t) ? "required" : "selectRequired";
23
23
  }
24
- function M(r, e) {
25
- if (e.startsWith("[") && e.endsWith("]")) {
26
- const w = e.slice(1, -1);
27
- return r[w];
24
+ function W(r, t) {
25
+ if (t.startsWith("[") && t.endsWith("]")) {
26
+ const p = t.slice(1, -1);
27
+ return r[p];
28
28
  }
29
- return A(r, e);
29
+ return B(r, t);
30
30
  }
31
- function ur(r) {
31
+ function or(r) {
32
32
  var x;
33
- const e = B(), [w] = C(), u = V(w).formApi;
34
- if (!e)
33
+ const t = C(), [p] = K(), s = V(p).formApi;
34
+ if (!t)
35
35
  throw new Error("useDependencies should be used within <TtForm>");
36
- const l = n(!0), f = n(!1), m = n(!0), g = n(!1), h = n({}), F = n(), _ = N(() => {
36
+ const l = n(!0), f = n(!1), m = n(!0), g = n(!1), h = n({}), F = N(), S = O(() => {
37
37
  var i;
38
- return (((i = r()) == null ? void 0 : i.triggerFields) ?? []).map((d) => M(e.value, d));
38
+ return (((i = r()) == null ? void 0 : i.triggerFields) ?? []).map((d) => W(t.value, d));
39
39
  });
40
40
  let I = 0;
41
- return k(
42
- [_, r],
43
- async ([b, i]) => {
44
- var R;
45
- if (!i || !((R = i == null ? void 0 : i.triggerFields) != null && R.length))
41
+ return j(
42
+ [S, r],
43
+ async ([_, i]) => {
44
+ var b;
45
+ if (!i || !((b = i == null ? void 0 : i.triggerFields) != null && b.length))
46
46
  return;
47
- const d = ++I, s = () => d !== I, { componentProps: y, disabled: v, if: c, required: P, rules: T, show: p, trigger: q } = i, a = e.value;
47
+ const d = ++I, u = () => d !== I, { componentProps: R, disabled: v, if: c, required: y, rules: P, show: w, trigger: T } = i, a = t.value;
48
48
  if (o(c)) {
49
- const t = !!await c(a, u);
50
- if (s() || (l.value = t, !l.value)) return;
49
+ const e = !!await c(a, s);
50
+ if (u() || (l.value = e, !l.value)) return;
51
51
  } else if (E(c)) {
52
52
  if (l.value = c, !l.value) return;
53
53
  } else
54
54
  l.value = !0;
55
- if (o(p)) {
56
- const t = !!await p(a, u);
57
- if (s()) return;
58
- m.value = t;
59
- } else E(p) ? m.value = p : m.value = !0;
60
- if (o(y)) {
61
- const t = await y(a, u);
62
- if (s()) return;
63
- h.value = t;
55
+ if (o(w)) {
56
+ const e = !!await w(a, s);
57
+ if (u()) return;
58
+ m.value = e;
59
+ } else E(w) ? m.value = w : m.value = !0;
60
+ if (o(R)) {
61
+ const e = await R(a, s);
62
+ if (u()) return;
63
+ h.value = e;
64
64
  } else
65
65
  h.value = {};
66
- if (o(T)) {
67
- const t = await T(a, u);
68
- if (s()) return;
69
- F.value = t;
66
+ if (o(P)) {
67
+ const e = await P(a, s);
68
+ if (u()) return;
69
+ F.value = A(e) ? k(e) : e;
70
70
  } else
71
71
  F.value = void 0;
72
72
  if (o(v)) {
73
- const t = !!await v(a, u);
74
- if (s()) return;
75
- f.value = t;
73
+ const e = !!await v(a, s);
74
+ if (u()) return;
75
+ f.value = e;
76
76
  } else E(v) ? f.value = v : f.value = !1;
77
- if (o(P)) {
78
- const t = !!await P(a, u);
79
- if (s()) return;
80
- g.value = t;
77
+ if (o(y)) {
78
+ const e = !!await y(a, s);
79
+ if (u()) return;
80
+ g.value = e;
81
81
  } else
82
82
  g.value = !1;
83
- if (o(q)) {
84
- if (s()) return;
85
- await q(a, u);
83
+ if (o(T)) {
84
+ if (u()) return;
85
+ await T(a, s);
86
86
  }
87
87
  },
88
88
  { deep: !0, immediate: ((x = r()) == null ? void 0 : x.immediate) ?? !0 }
@@ -96,7 +96,7 @@ function ur(r) {
96
96
  };
97
97
  }
98
98
  export {
99
- ur as default,
100
- ir as resolveRequiredRuleName,
101
- M as resolveValueByFieldName
99
+ or as default,
100
+ ar as resolveRequiredRuleName,
101
+ W as resolveValueByFieldName
102
102
  };
@@ -1,33 +1,33 @@
1
- import { defineComponent as ee, useSlots as oe, computed as n, createBlock as C, openBlock as p, resolveDynamicComponent as D, normalizeProps as re, guardReactiveProps as te, withCtx as g, createElementVNode as le, normalizeClass as y, createElementBlock as f, renderSlot as d, Fragment as v, renderList as M, unref as b, mergeProps as R, createSlots as se } from "vue";
1
+ import { defineComponent as ee, useSlots as oe, computed as n, toRaw as re, createBlock as v, openBlock as p, resolveDynamicComponent as D, normalizeProps as te, guardReactiveProps as le, withCtx as g, createElementVNode as se, normalizeClass as y, createElementBlock as d, renderSlot as c, Fragment as b, renderList as M, unref as R, mergeProps as w, createSlots as ne } from "vue";
2
2
  import "../components/Slot.js";
3
3
  import "axios";
4
4
  import "element-plus";
5
- import { isString as ne, isFunction as ae } from "../../../../packages/utils/src/is.js";
5
+ import { isString as ae, isFunction as pe } from "../../../../packages/utils/src/is.js";
6
6
  import "dayjs";
7
7
  import "numeral";
8
- import { clnm as w } from "../../../../packages/utils/src/tool.js";
9
- import { mergeWithArrayOverride as pe } from "../../../../packages/utils/src/merge.js";
8
+ import { clnm as F } from "../../../../packages/utils/src/tool.js";
9
+ import { mergeWithArrayOverride as me } from "../../../../packages/utils/src/merge.js";
10
10
  import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
11
11
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
12
12
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
13
13
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
14
14
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
15
15
  import "lodash-es";
16
- import { Form as me } from "vee-validate";
16
+ import { Form as ie } from "vee-validate";
17
17
  import "../../../tt-form-item-error-tooltip/index.js";
18
18
  import "../../../tt-icon/index.js";
19
19
  import "@vueuse/core";
20
20
  /* empty css */
21
21
  import "../form/RenderContent.vue.js";
22
- import { provideFormRenderProps as ie } from "./context.js";
23
- import { useExpandable as ue } from "./expandable.js";
24
- import { FORM_RENDER_DEFAULT_WRAPPER_CLASS as fe, getFormRootWrapperClass as de } from "./rootWrapperClass.js";
25
- import { FieldRenderer as ce } from "./FormFieldContact.js";
26
- import { getBaseRules as Ce, getDefaultValueInZodStack as ge } from "./helper.js";
22
+ import { provideFormRenderProps as ue } from "./context.js";
23
+ import { useExpandable as fe } from "./expandable.js";
24
+ import { FORM_RENDER_DEFAULT_WRAPPER_CLASS as de, getFormRootWrapperClass as ce } from "./rootWrapperClass.js";
25
+ import { FieldRenderer as Ce } from "./FormFieldContact.js";
26
+ import { getBaseRules as ve, getDefaultValueInZodStack as ge } from "./helper.js";
27
27
  import "../../../../node_modules/.pnpm/vue-types@5.1.3_vue@3.5.21_typescript@5.9.3_/node_modules/vue-types/shim/index.modern.js";
28
28
  import { useDesign as ye } from "../../../../packages/hooks/src/useDesign.js";
29
29
  import "vue-router";
30
- const He = /* @__PURE__ */ ee({
30
+ const Je = /* @__PURE__ */ ee({
31
31
  name: "FormRender",
32
32
  __name: "form",
33
33
  props: {
@@ -44,57 +44,58 @@ const He = /* @__PURE__ */ ee({
44
44
  layout: {},
45
45
  schema: {},
46
46
  showCollapseButton: { type: Boolean, default: !1 },
47
- wrapperClass: { default: fe },
47
+ wrapperClass: { default: de },
48
48
  globalCommonConfig: { default: () => ({}) }
49
49
  },
50
50
  emits: ["submit"],
51
51
  setup(A, { expose: T, emit: W }) {
52
- const r = A, F = W, z = oe(), V = n(
53
- () => de({
52
+ const r = A, P = W, z = oe(), V = n(
53
+ () => ce({
54
54
  layout: r.layout,
55
55
  compact: r.compact,
56
56
  wrapperClass: r.wrapperClass
57
57
  })
58
58
  );
59
- ie(r);
60
- const { prefixCls: P } = ye("form-render"), u = r.form;
59
+ ue(r);
60
+ const { prefixCls: _ } = ye("form-render"), f = r.form;
61
61
  function i(e) {
62
62
  return e && e.type === "slot";
63
63
  }
64
64
  function Z(e) {
65
65
  return !i(e) && !e.useArraySchema;
66
66
  }
67
- const _ = n(() => ({
68
- values: (u == null ? void 0 : u.values) ?? {},
69
- formActions: u
70
- })), { isCalculated: q, keepFormItemIndex: h, wrapperRef: k } = ue(r), j = n(() => {
67
+ const k = n(() => ({
68
+ values: (f == null ? void 0 : f.values) ?? {},
69
+ formActions: f
70
+ })), { isCalculated: q, keepFormItemIndex: j, wrapperRef: I } = fe(r), U = n(() => {
71
71
  const e = [];
72
72
  return (r.schema || []).forEach((a) => {
73
+ var u;
73
74
  if (i(a)) return;
74
- const { fieldName: o } = a, l = a.rules;
75
+ const { fieldName: o } = a, t = a.rules ? re(a.rules) : void 0;
75
76
  let s = "";
76
- l && !ne(l) && (s = l.def.type);
77
- const m = Ce(l);
77
+ t && !ae(t) && (s = ((u = t.def) == null ? void 0 : u.type) ?? "");
78
+ const m = t ? ve(t) : null;
78
79
  e.push({
79
- default: ge(l),
80
+ default: t ? ge(t) : void 0,
80
81
  fieldName: o,
81
82
  required: !["ZodNullable", "ZodOptional"].includes(s),
82
83
  rules: m
83
84
  });
84
85
  }), e;
85
- }), U = n(() => r.form ? "form" : me), G = n(() => r.form ? {
86
- onSubmit: r.form.handleSubmit((e) => F("submit", e))
86
+ }), h = n(() => r.form ? "form" : ie), G = n(() => r.form ? {
87
+ onSubmit: r.form.handleSubmit((e) => P("submit", e))
87
88
  } : {
88
- onSubmit: (e) => F("submit", e)
89
+ onSubmit: (e) => P("submit", e)
89
90
  }), H = n(() => r.collapsed && q.value), J = n(() => {
90
91
  const {
91
92
  colon: e = !1,
92
93
  componentProps: a = {},
93
94
  controlClass: o = "",
94
- disabled: l,
95
+ disabled: t,
95
96
  disabledOnChangeListener: s = !0,
96
97
  disabledOnInputListener: m = !0,
97
- emptyStateValue: I = void 0,
98
+ emptyStateValue: u = void 0,
98
99
  formFieldProps: B = {},
99
100
  formItemClass: Q = "",
100
101
  hideLabel: S = !1,
@@ -103,17 +104,17 @@ const He = /* @__PURE__ */ ee({
103
104
  labelWidth: $ = 70,
104
105
  modelPropName: x = "",
105
106
  wrapperClass: X = ""
106
- } = pe(r.commonConfig, r.globalCommonConfig);
107
+ } = me(r.commonConfig, r.globalCommonConfig);
107
108
  let L = 0;
108
- return (r.schema || []).map((t) => {
109
- if (i(t)) return t;
110
- if (!Z(t))
109
+ return (r.schema || []).map((l) => {
110
+ if (i(l)) return l;
111
+ if (!Z(l))
111
112
  return {
112
113
  colon: e,
113
- disabled: l,
114
+ disabled: t,
114
115
  disabledOnChangeListener: s,
115
116
  disabledOnInputListener: m,
116
- emptyStateValue: I,
117
+ emptyStateValue: u,
117
118
  hideLabel: S,
118
119
  hideRequiredMark: E,
119
120
  labelWidth: $,
@@ -122,82 +123,82 @@ const He = /* @__PURE__ */ ee({
122
123
  controlClass: o,
123
124
  formFieldProps: B,
124
125
  labelClass: N,
125
- ...t
126
+ ...l
126
127
  };
127
- const O = h.value, Y = r.showCollapseButton && H.value && O ? O <= L : !1;
128
+ const O = j.value, Y = r.showCollapseButton && H.value && O ? O <= L : !1;
128
129
  L++;
129
- let c = t.formItemClass;
130
- if (ae(t.formItemClass))
130
+ let C = l.formItemClass;
131
+ if (pe(l.formItemClass))
131
132
  try {
132
- c = t.formItemClass();
133
+ C = l.formItemClass();
133
134
  } catch {
134
- c = "";
135
+ C = "";
135
136
  }
136
137
  return {
137
138
  colon: e,
138
- disabled: l,
139
+ disabled: t,
139
140
  disabledOnChangeListener: s,
140
141
  disabledOnInputListener: m,
141
- emptyStateValue: I,
142
+ emptyStateValue: u,
142
143
  hideLabel: S,
143
144
  hideRequiredMark: E,
144
145
  labelWidth: $,
145
146
  modelPropName: x,
146
147
  wrapperClass: X,
147
- ...t,
148
+ ...l,
148
149
  commonComponentProps: a,
149
- componentProps: t.componentProps,
150
- controlClass: w(o, t.controlClass),
150
+ componentProps: l.componentProps,
151
+ controlClass: F(o, l.controlClass),
151
152
  formFieldProps: {
152
153
  ...B,
153
- ...t.formFieldProps
154
+ ...l.formFieldProps
154
155
  },
155
- formItemClass: w("flex-shrink-0", { hidden: Y }, Q, c),
156
- labelClass: w(N, t.labelClass)
156
+ formItemClass: F("flex-shrink-0", { hidden: Y }, Q, C),
157
+ labelClass: F(N, l.labelClass)
157
158
  };
158
159
  });
159
160
  }), K = n(() => Object.keys(z).filter((e) => e !== "default"));
160
161
  return T({
161
- wrapperRef: n(() => k.value)
162
- }), (e, a) => (p(), C(D(U.value), re(te(G.value)), {
162
+ wrapperRef: n(() => I.value)
163
+ }), (e, a) => (p(), v(D(h.value), te(le(G.value)), {
163
164
  default: g(() => [
164
- le("div", {
165
+ se("div", {
165
166
  ref_key: "wrapperRef",
166
- ref: k,
167
+ ref: I,
167
168
  class: y(V.value)
168
169
  }, [
169
- (p(!0), f(v, null, M(J.value, (o, l) => (p(), f(v, {
170
- key: i(o) ? `slot-${l}` : o.fieldName
170
+ (p(!0), d(b, null, M(J.value, (o, t) => (p(), d(b, {
171
+ key: i(o) ? `slot-${t}` : o.fieldName
171
172
  }, [
172
- i(o) ? (p(), f(v, { key: 0 }, [
173
- typeof o.content == "string" ? (p(), f("div", {
173
+ i(o) ? (p(), d(b, { key: 0 }, [
174
+ typeof o.content == "string" ? (p(), d("div", {
174
175
  key: 0,
175
- class: y([`${b(P)}__slot`, o.wrapperClass])
176
+ class: y([`${R(_)}__slot`, o.wrapperClass])
176
177
  }, [
177
- d(e.$slots, o.content, R({ ref_for: !0 }, _.value))
178
- ], 2)) : (p(), C(D(o.content(_.value)), {
178
+ c(e.$slots, o.content, w({ ref_for: !0 }, k.value))
179
+ ], 2)) : (p(), v(D(o.content(k.value)), {
179
180
  key: 1,
180
- class: y([`${b(P)}__slot`, o.wrapperClass])
181
+ class: y([`${R(_)}__slot`, o.wrapperClass])
181
182
  }, null, 8, ["class"]))
182
- ], 64)) : (p(), C(b(ce), {
183
+ ], 64)) : (p(), v(R(Ce), {
183
184
  key: 1,
184
185
  "field-config": o,
185
186
  rules: o.rules
186
- }, se({
187
+ }, ne({
187
188
  default: g((s) => [
188
- d(e.$slots, o.fieldName, R({ ref_for: !0 }, s))
189
+ c(e.$slots, o.fieldName, w({ ref_for: !0 }, s))
189
190
  ]),
190
191
  _: 2
191
192
  }, [
192
193
  M(K.value, (s) => ({
193
194
  name: s,
194
195
  fn: g((m) => [
195
- d(e.$slots, s, R({ ref_for: !0 }, m))
196
+ c(e.$slots, s, w({ ref_for: !0 }, m))
196
197
  ])
197
198
  }))
198
199
  ]), 1032, ["field-config", "rules"]))
199
200
  ], 64))), 128)),
200
- d(e.$slots, "default", { shapes: j.value })
201
+ c(e.$slots, "default", { shapes: U.value })
201
202
  ], 2)
202
203
  ]),
203
204
  _: 3
@@ -205,5 +206,5 @@ const He = /* @__PURE__ */ ee({
205
206
  }
206
207
  });
207
208
  export {
208
- He as default
209
+ Je as default
209
210
  };
@@ -1,7 +1,7 @@
1
+ import { toRaw as i } from "vue";
1
2
  import "axios";
2
3
  import "element-plus";
3
- import { isObject as f, isString as n } from "../../../../packages/utils/src/is.js";
4
- import "vue";
4
+ import { isObject as p, isString as o } from "../../../../packages/utils/src/is.js";
5
5
  import "dayjs";
6
6
  import "numeral";
7
7
  import "xe-utils";
@@ -13,24 +13,28 @@ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/en
13
13
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
14
14
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
15
15
  import "lodash-es";
16
- function r(t) {
17
- return !t || n(t) ? null : "innerType" in t.def ? r(t.def.innerType) : "schema" in t.def ? r(t.def.schema) : t;
16
+ function n(e) {
17
+ if (!e || o(e)) return null;
18
+ const r = i(e);
19
+ return r.def ? "innerType" in r.def ? n(i(r.def.innerType)) : "schema" in r.def ? n(i(r.def.schema)) : r : r;
18
20
  }
19
- function i(t) {
20
- if (!t || n(t))
21
+ function f(e) {
22
+ if (!e || o(e))
21
23
  return;
22
- const e = t;
23
- if (e.def.type === "default") return e.def.defaultValue;
24
- if ("innerType" in e.def)
25
- return i(e.def.innerType);
26
- if ("schema" in e.def)
27
- return i(e.def.schema);
24
+ const t = i(e);
25
+ if (t.def) {
26
+ if (t.def.type === "default") return t.def.defaultValue;
27
+ if ("innerType" in t.def)
28
+ return f(i(t.def.innerType));
29
+ if ("schema" in t.def)
30
+ return f(i(t.def.schema));
31
+ }
28
32
  }
29
- function v(t) {
30
- return !t || !f(t) ? !1 : Reflect.has(t, "target") && Reflect.has(t, "stopPropagation");
33
+ function v(e) {
34
+ return !e || !p(e) ? !1 : Reflect.has(e, "target") && Reflect.has(e, "stopPropagation");
31
35
  }
32
36
  export {
33
- r as getBaseRules,
34
- i as getDefaultValueInZodStack,
37
+ n as getBaseRules,
38
+ f as getDefaultValueInZodStack,
35
39
  v as isEventObjectLike
36
40
  };