@dazhicheng/ui 1.5.241 → 1.5.243

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,4 +1,4 @@
1
- import { defineComponent as ve, useTemplateRef as K, unref as l, computed as a, reactive as he, markRaw as be, toRaw as ye, watch as G, nextTick as Ce, onUnmounted as ge, createBlock as h, createCommentVNode as c, openBlock as u, mergeProps as N, withCtx as b, withDirectives as Fe, createVNode as F, createElementVNode as L, createElementBlock as H, normalizeClass as k, normalizeStyle as J, renderSlot as Re, normalizeProps as we, guardReactiveProps as Se, resolveDynamicComponent as Ne, createSlots as ke, renderList as Oe, Transition as Ee, vShow as Pe } from "vue";
1
+ import { defineComponent as ve, useTemplateRef as K, unref as l, computed as a, reactive as he, markRaw as be, toRaw as ye, watch as G, nextTick as Ce, onUnmounted as ge, createBlock as h, createCommentVNode as c, openBlock as u, mergeProps as k, withCtx as b, withDirectives as Fe, createVNode as F, createElementVNode as L, createElementBlock as H, normalizeClass as O, normalizeStyle as J, renderSlot as Re, normalizeProps as we, guardReactiveProps as Se, resolveDynamicComponent as Ne, createSlots as ke, renderList as Oe, Transition as Ee, vShow as Pe } from "vue";
2
2
  import Be from "../form/FormControl.vue.js";
3
3
  import Te from "../form/FormDescription.vue.js";
4
4
  import Ve from "../form/FormItem.vue.js";
@@ -18,7 +18,7 @@ import "../../../tt-icon/index.js";
18
18
  import "@vueuse/core";
19
19
  import { useFormValues as Ae, useFieldError as Me, Field as Ue } from "vee-validate";
20
20
  /* empty css */
21
- import O from "../form/RenderContent.vue.js";
21
+ import E from "../form/RenderContent.vue.js";
22
22
  import { toTypedSchema as De } from "@vee-validate/zod";
23
23
  import { injectFormProps as We, injectComponentRefMap as ze } from "../useFormContext.js";
24
24
  import { useFormContext as xe, injectRenderFormProps as Ke } from "./context.js";
@@ -66,10 +66,10 @@ const Xe = { class: "flex-auto overflow-hidden" }, Ye = {
66
66
  commonComponentProps: {}
67
67
  },
68
68
  setup(n) {
69
- const E = K("wrapperRef"), { componentBindEventMap: X, componentMap: Y, isVertical: C } = xe(), Z = Ke(), S = Ae(), _ = Me(n.fieldName), f = K("fieldComponentRef"), [ee, ne] = We(), j = l(ee).formApi, R = a(() => Z.compact), w = a(() => {
69
+ const P = K("wrapperRef"), { componentBindEventMap: X, componentMap: Y, isVertical: C } = xe(), Z = Ke(), S = Ae(), _ = Me(n.fieldName), f = K("fieldComponentRef"), [ee, ne] = We(), j = l(ee).formApi, R = a(() => Z.compact), w = a(() => {
70
70
  var e;
71
71
  return ((e = _.value) == null ? void 0 : e.length) > 0;
72
- }), P = he(
72
+ }), B = he(
73
73
  new Proxy({}, {
74
74
  /**
75
75
  * @param _target 代理目标(空对象,不实际存储)
@@ -92,20 +92,20 @@ const Xe = { class: "flex-auto overflow-hidden" }, Ye = {
92
92
  ), A = a(() => {
93
93
  const e = y(n.component) ? Y.value[n.component] : n.component;
94
94
  return be(ye(e));
95
- }), { dynamicComponentProps: te, dynamicRules: oe, isDisabled: le, isIf: M, isRequired: B, isShow: U } = Ge(
95
+ }), { dynamicComponentProps: te, dynamicRules: oe, isDisabled: le, isIf: M, isRequired: T, isShow: U } = Ge(
96
96
  () => n.dependencies
97
97
  ), ie = a(() => {
98
98
  var e;
99
99
  return (e = n.labelClass) != null && e.includes("w-") || C.value ? {} : {
100
100
  width: `${n.labelWidth}px`
101
101
  };
102
- }), s = a(() => oe.value || n.rules), D = a(() => !n.hide && M.value && U.value), T = a(() => {
102
+ }), s = a(() => oe.value || n.rules), D = a(() => !n.hide && M.value && U.value), V = a(() => {
103
103
  var o, i, m;
104
104
  if (!D.value)
105
105
  return !1;
106
106
  if (!s.value)
107
- return B.value;
108
- if (B.value)
107
+ return T.value;
108
+ if (T.value)
109
109
  return !0;
110
110
  if (y(s.value))
111
111
  return ["required", "selectRequired"].includes(s.value);
@@ -122,10 +122,10 @@ const Xe = { class: "flex-auto overflow-hidden" }, Ye = {
122
122
  return null;
123
123
  let e = s.value;
124
124
  if (!e)
125
- return B.value ? He(A.value) : null;
125
+ return T.value ? He(A.value) : null;
126
126
  if (y(e))
127
127
  return e;
128
- if (!!T.value) {
128
+ if (!!V.value) {
129
129
  const i = (o = e == null ? void 0 : e.unwrap) == null ? void 0 : o.call(e);
130
130
  i && (e = i);
131
131
  }
@@ -141,7 +141,7 @@ const Xe = { class: "flex-auto overflow-hidden" }, Ye = {
141
141
  a(() => ({
142
142
  componentProps: r,
143
143
  component: n.component,
144
- selectWrapRef: E,
144
+ selectWrapRef: P,
145
145
  selectRef: f
146
146
  }))
147
147
  );
@@ -157,7 +157,7 @@ const Xe = { class: "flex-auto overflow-hidden" }, Ye = {
157
157
  },
158
158
  { immediate: !0 }
159
159
  );
160
- const V = a(() => {
160
+ const N = a(() => {
161
161
  var e;
162
162
  return le.value || n.disabled || ((e = r.value) == null ? void 0 : e.disabled);
163
163
  }), W = a(() => $(n.renderComponentContent) ? n.renderComponentContent(S.value, j) : {}), ue = a(() => Object.keys(W.value)), se = a(() => {
@@ -204,7 +204,10 @@ const Xe = { class: "flex-auto overflow-hidden" }, Ye = {
204
204
  ...Reflect.has(r.value, "onChange") ? { onChange: r.value.onChange } : {},
205
205
  ...Reflect.has(r.value, "onInput") ? { onInput: r.value.onInput } : {}
206
206
  };
207
- return Reflect.has(r.value, "name") || delete o.name, y(n.component) && de.has(n.component) && o.modelValue === void 0 && (o.modelValue = !1), y(n.component) && ce.has(n.component) && (o.controls = !1, o.align = "left"), o;
207
+ return Reflect.has(r.value, "name") || delete o.name, y(n.component) && de.has(n.component) && o.modelValue === void 0 && (o.modelValue = !1), y(n.component) && ce.has(n.component) && (o.controls = !1, o.align = "left"), {
208
+ ...o,
209
+ placeholder: N.value ? "" : r.value.placeholder
210
+ };
208
211
  }
209
212
  function fe() {
210
213
  var e, t;
@@ -216,23 +219,23 @@ const Xe = { class: "flex-auto overflow-hidden" }, Ye = {
216
219
  p == null || p.set(n.fieldName, e);
217
220
  }), ge(() => {
218
221
  p != null && p.has(n.fieldName) && p.delete(n.fieldName);
219
- }), (e, t) => !e.hide && l(M) ? (u(), h(l(Ue), N({ key: 0 }, se.value, { name: e.fieldName }), {
222
+ }), (e, t) => !e.hide && l(M) ? (u(), h(l(Ue), k({ key: 0 }, se.value, { name: e.fieldName }), {
220
223
  default: b((o) => [
221
- Fe(F(l(Ve), N({
224
+ Fe(F(l(Ve), k({
222
225
  class: [{
223
226
  "form-valid-error": w.value,
224
- "form-is-required": T.value,
227
+ "form-is-required": V.value,
225
228
  "pb-(--form-valid-error-nocompact-padding-bottom)": !R.value,
226
229
  "pb-2": R.value
227
230
  }, "relative"]
228
231
  }, e.$attrs), {
229
232
  default: b(() => [
230
233
  L("div", {
231
- class: k([{ "flex-col": l(C), "flex-row items-center": !l(C) }, "flex"])
234
+ class: O([{ "flex-col": l(C), "flex-row items-center": !l(C) }, "flex"])
232
235
  }, [
233
236
  e.hideLabel ? c("", !0) : (u(), h(Je, {
234
237
  key: 0,
235
- class: k(
238
+ class: O(
236
239
  l(q)(
237
240
  "flex leading-6",
238
241
  {
@@ -245,15 +248,15 @@ const Xe = { class: "flex-auto overflow-hidden" }, Ye = {
245
248
  help: e.help,
246
249
  colon: e.colon,
247
250
  label: e.label,
248
- required: T.value && !e.hideRequiredMark,
251
+ required: V.value && !e.hideRequiredMark,
249
252
  style: J(ie.value),
250
253
  "tool-tip": e.toolTip,
251
254
  "help-trigger": e.helpTrigger,
252
- form: P,
255
+ form: B,
253
256
  "tool-tip-text": e.toolTipText
254
257
  }, {
255
258
  default: b(() => [
256
- e.label ? (u(), h(l(O), {
259
+ e.label ? (u(), h(l(E), {
257
260
  key: 0,
258
261
  content: e.label
259
262
  }, null, 8, ["content"])) : c("", !0)
@@ -263,35 +266,35 @@ const Xe = { class: "flex-auto overflow-hidden" }, Ye = {
263
266
  L("div", Xe, [
264
267
  L("div", {
265
268
  ref_key: "wrapperRef",
266
- ref: E,
267
- class: k(l(q)("relative flex w-full items-center", e.wrapperClass))
269
+ ref: P,
270
+ class: O(l(q)("relative flex w-full items-center", e.wrapperClass))
268
271
  }, [
269
272
  F(l(Be), {
270
- class: k(l(q)(e.controlClass))
273
+ class: O(l(q)(e.controlClass))
271
274
  }, {
272
275
  default: b(() => [
273
276
  Re(e.$slots, "default", we(Se({
274
277
  ...o,
275
278
  ...z(o),
276
- disabled: V.value,
279
+ disabled: N.value,
277
280
  isInValid: w.value,
278
- form: P,
281
+ form: B,
279
282
  fieldName: e.fieldName
280
283
  })), () => [
281
- (u(), h(Ne(A.value), N({
284
+ (u(), h(Ne(A.value), k({
282
285
  ref_key: "fieldComponentRef",
283
286
  ref: f
284
287
  }, {
285
288
  ...z(o),
286
- disabled: V.value,
289
+ disabled: N.value,
287
290
  isInValid: w.value,
288
- form: P,
291
+ form: B,
289
292
  fieldName: e.fieldName
290
- }, { disabled: V.value }), ke({ _: 2 }, [
293
+ }, { disabled: N.value }), ke({ _: 2 }, [
291
294
  Oe(ue.value, (i) => ({
292
295
  name: i,
293
296
  fn: b((m) => [
294
- F(l(O), N({
297
+ F(l(E), k({
295
298
  content: W.value[i]
296
299
  }, { ...m, formContext: o }), null, 16, ["content"])
297
300
  ])
@@ -302,11 +305,11 @@ const Xe = { class: "flex-auto overflow-hidden" }, Ye = {
302
305
  _: 2
303
306
  }, 1032, ["class"]),
304
307
  e.suffix ? (u(), H("div", Ye, [
305
- F(l(O), { content: e.suffix }, null, 8, ["content"])
308
+ F(l(E), { content: e.suffix }, null, 8, ["content"])
306
309
  ])) : c("", !0),
307
310
  R.value && w.value ? (u(), h(l(qe), {
308
311
  key: 1,
309
- "ref-dom": E.value
312
+ "ref-dom": P.value
310
313
  }, null, 8, ["ref-dom"])) : c("", !0)
311
314
  ], 2)
312
315
  ])
@@ -320,7 +323,7 @@ const Xe = { class: "flex-auto overflow-hidden" }, Ye = {
320
323
  class: "text-[12px]"
321
324
  }, {
322
325
  default: b(() => [
323
- F(l(O), { content: e.description }, null, 8, ["content"])
326
+ F(l(E), { content: e.description }, null, 8, ["content"])
324
327
  ]),
325
328
  _: 1
326
329
  })) : c("", !0),
@@ -69,7 +69,7 @@ function J(r) {
69
69
  }
70
70
  let h = 0, S = 0;
71
71
  e.slice(0).forEach((w) => {
72
- const b = L(w, W, i) + 32 + 4;
72
+ const b = L(w, W, i) + 32 + 8;
73
73
  h + b < g && (h += b, S += 1);
74
74
  }), o.value = Math.max(1, S);
75
75
  }
@@ -107,17 +107,13 @@ const p = 4, Fl = /* @__PURE__ */ Te({
107
107
  a.value = t.multiple ? [...e] : e.at(-1);
108
108
  }
109
109
  });
110
- V(
111
- [() => t.multiple, () => a.value],
112
- ([e, l]) => {
113
- if (e) {
114
- Array.isArray(l) || (a.value = l === void 0 ? [] : [l]);
115
- return;
116
- }
117
- Array.isArray(l) && (a.value = l.at(-1));
118
- },
119
- { immediate: !0 }
120
- );
110
+ V([() => t.multiple, () => a.value], ([e, l]) => {
111
+ if (e) {
112
+ Array.isArray(l) || (a.value = l === void 0 ? [] : [l]);
113
+ return;
114
+ }
115
+ Array.isArray(l) && (a.value = l.at(-1));
116
+ });
121
117
  const C = h(), A = h(""), x = h(""), b = h(), G = S("middleRef"), v = S("selectWrapRef"), M = S("selectRef"), O = h(0);
122
118
  function L() {
123
119
  const e = v.value;
@@ -1,9 +1,9 @@
1
- import { queryDataPermissionDetailDataTypeContext as L, pageUser as R } from "../api/dataTypeContext.js";
2
- import { ref as U, watchEffect as b, unref as O, watch as M, computed as V } from "vue";
3
- import { useRoute as _ } from "vue-router";
4
- const c = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map();
5
- let D, h;
6
- const j = "all", E = { label: "全部", value: j }, z = {
1
+ import { queryDataPermissionDetailDataTypeContext as V, pageUser as _ } from "../api/dataTypeContext.js";
2
+ import { ref as j, watchEffect as F, unref as T, watch as k, computed as B } from "vue";
3
+ import { useRoute as G } from "vue-router";
4
+ const c = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), P = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map();
5
+ let v, m;
6
+ const H = "all", J = { label: "全部", value: H }, Q = {
7
7
  platformId: ["platformName", "platformId"],
8
8
  shopId: ["shopName", "shopId"],
9
9
  purchasePlaceId: ["purchasePlaceName", "purchasePlaceCode"],
@@ -11,117 +11,132 @@ const j = "all", E = { label: "全部", value: j }, z = {
11
11
  lockUserId: ["userName", "userId"],
12
12
  userId: ["fullName", "id"]
13
13
  };
14
- async function k() {
15
- if (D) return D;
16
- if (h) return h;
17
- h = R({ pageNo: 1, pageSize: 9999 }).then((n) => {
18
- const l = n.records || [];
19
- return D = l, l;
14
+ async function W() {
15
+ if (v) return v;
16
+ if (m) return m;
17
+ m = _({ pageNo: 1, pageSize: 9999 }).then((s) => {
18
+ const o = s.records || [];
19
+ return v = o, o;
20
20
  });
21
21
  try {
22
- return await h;
22
+ return await m;
23
23
  } finally {
24
- h = void 0;
24
+ m = void 0;
25
25
  }
26
26
  }
27
- function J(n) {
28
- const l = _(), v = U({});
29
- function m(t = {}) {
30
- v.value = n.codes.reduce(
27
+ function K(s) {
28
+ const o = G(), N = j({});
29
+ function g(t = {}) {
30
+ N.value = s.codes.reduce(
31
31
  (e, r) => {
32
- const [s, d] = z[r], g = (t[r] || []).map((f) => {
33
- const o = r === "purchasePlaceId" ? f.purchaseInfo || {} : f;
32
+ const [a, C] = Q[r], d = (t[r] || []).map((p) => {
33
+ const u = r === "purchasePlaceId" ? p.purchaseInfo || {} : p;
34
34
  return {
35
- ...f,
36
- label: o == null ? void 0 : o[s],
37
- value: o == null ? void 0 : o[d]
35
+ ...p,
36
+ label: u == null ? void 0 : u[a],
37
+ value: u == null ? void 0 : u[C]
38
38
  };
39
39
  });
40
- return e[r] = g, e;
40
+ return e[r] = d, e;
41
41
  },
42
42
  {}
43
43
  );
44
44
  }
45
- function A(t) {
45
+ function L(t) {
46
46
  var e;
47
- return typeof n.showAll == "boolean" ? n.showAll : ((e = n.showAll) == null ? void 0 : e[t]) ?? !1;
47
+ return typeof s.showAll == "boolean" ? s.showAll : ((e = s.showAll) == null ? void 0 : e[t]) ?? !1;
48
48
  }
49
- function x() {
50
- C.clear(), c.clear(), p.clear(), D = void 0, h = void 0;
49
+ function U() {
50
+ P.clear(), h.clear(), c.clear(), f.clear(), w.clear(), v = void 0, m = void 0;
51
51
  }
52
- function T(t) {
53
- c.delete(t);
52
+ function b(t) {
53
+ c.delete(t), f.delete(t), h.delete(t);
54
54
  }
55
- async function S(t = !1) {
56
- const e = l.path, r = O(n.dataSource);
55
+ function O(t) {
56
+ const e = f.get(t) || /* @__PURE__ */ new Set(), r = e.size;
57
+ s.codes.forEach((a) => e.add(a)), f.set(t, e), e.size !== r && (h.delete(t), y(t));
58
+ }
59
+ async function A(t = !1) {
60
+ const e = o.path, r = T(s.dataSource);
57
61
  if (r) {
58
62
  const i = { ...c.get(e) || {}, ...r };
59
- c.set(e, i), m(i);
63
+ c.set(e, i), g(i);
60
64
  return;
61
65
  }
62
- const s = c.get(e) || {};
63
- let d = t ? [...n.codes] : n.codes.filter((a) => !Object.prototype.hasOwnProperty.call(s, a));
66
+ const a = c.get(e) || {}, C = [...f.get(e) || s.codes];
67
+ let d = t ? C : C.filter((n) => !Object.prototype.hasOwnProperty.call(a, n));
64
68
  if (!d.length) {
65
- m(s);
69
+ g(a);
66
70
  return;
67
71
  }
68
- const g = t ? void 0 : C.get(e);
69
- if (g) {
70
- const a = await g, u = { ...c.get(e) || {}, ...a };
71
- if (c.set(e, u), d = n.codes.filter((y) => !Object.prototype.hasOwnProperty.call(u, y)), !d.length) {
72
- m(u);
72
+ const p = t ? void 0 : P.get(e);
73
+ if (p) {
74
+ const n = await p, l = { ...c.get(e) || {}, ...n };
75
+ if (c.set(e, l), d = C.filter((D) => !Object.prototype.hasOwnProperty.call(l, D)), !d.length) {
76
+ g(l);
73
77
  return;
74
78
  }
75
79
  }
76
- const f = d.filter((a) => a !== "userId"), o = d.includes("userId"), q = Promise.allSettled([
77
- f.length ? L({ dataTypeName: f }).then(
78
- (a) => a
80
+ const u = d.filter((n) => n !== "userId"), E = d.includes("userId"), x = Promise.allSettled([
81
+ u.length ? V({ dataTypeName: u }).then(
82
+ (n) => n
79
83
  ) : Promise.resolve([]),
80
- o ? k() : Promise.resolve(void 0)
81
- ]).then(([a, i]) => {
82
- const u = a.status === "fulfilled" ? a.value : [], y = i.status === "fulfilled" ? i.value : void 0;
84
+ E ? W() : Promise.resolve(void 0)
85
+ ]).then(([n, i]) => {
86
+ const l = n.status === "fulfilled" ? n.value : [], D = i.status === "fulfilled" ? i.value : void 0;
83
87
  return {
84
- ...y ? { userId: y } : {},
85
- ...u.reduce((P, I) => {
86
- const N = I == null ? void 0 : I.dataTypeCode;
87
- return N && (P[N] = I.originalItems || []), P;
88
+ ...D ? { userId: D } : {},
89
+ ...l.reduce((q, I) => {
90
+ const M = I == null ? void 0 : I.dataTypeCode;
91
+ return M && (q[M] = I.originalItems || []), q;
88
92
  }, {})
89
93
  };
90
- }), w = (p.get(e) || 0) + 1;
91
- p.set(e, w), C.set(e, q);
94
+ }), S = (w.get(e) || 0) + 1;
95
+ w.set(e, S), P.set(e, x);
92
96
  try {
93
- const a = await q;
94
- if (p.get(e) !== w) return;
95
- const u = { ...c.get(e) || {}, ...a };
96
- c.set(e, u), m(u);
97
+ const n = await x;
98
+ if (w.get(e) !== S) return;
99
+ const l = { ...c.get(e) || {}, ...n };
100
+ c.set(e, l), g(l);
97
101
  } finally {
98
- p.get(e) === w && C.delete(e);
102
+ w.get(e) === S && P.delete(e);
99
103
  }
100
104
  }
101
- async function K() {
102
- const t = l.path;
103
- x(), T(t), await S(!0);
105
+ async function z() {
106
+ const t = o.path, e = new Set(f.get(t) || s.codes);
107
+ U(), f.set(t, e), b(t), await A(!0);
108
+ }
109
+ function y(t) {
110
+ const e = h.get(t);
111
+ if (e) return e;
112
+ const r = Promise.resolve().then(() => A());
113
+ return h.set(t, r), r.finally(() => {
114
+ h.get(t) === r && h.delete(t);
115
+ }), r;
104
116
  }
105
- return b(() => {
106
- const t = O(n.dataSource);
117
+ F(() => {
118
+ const t = T(s.dataSource);
107
119
  if (!t) return;
108
- const e = l.path, s = { ...c.get(e) || {}, ...t };
109
- c.set(e, s), m(s);
110
- }), M(
111
- () => l.path,
112
- () => {
113
- S();
114
- },
115
- { immediate: !0 }
120
+ const e = o.path, a = { ...c.get(e) || {}, ...t };
121
+ c.set(e, a), g(a);
122
+ });
123
+ function R(t) {
124
+ g(c.get(t));
125
+ }
126
+ return O(o.path), y(o.path).then(() => R(o.path)), k(
127
+ () => o.path,
128
+ (t) => {
129
+ O(t), y(t).then(() => R(t));
130
+ }
116
131
  ), {
117
132
  /**
118
133
  * 数据源
119
134
  */
120
- dataSource: V(() => {
121
- const t = n.codes.reduce(
135
+ dataSource: B(() => {
136
+ const t = s.codes.reduce(
122
137
  (e, r) => {
123
- const s = v.value[r] || [];
124
- return e[r] = A(r) ? [E, ...s] : s, e;
138
+ const a = N.value[r] || [];
139
+ return e[r] = L(r) ? [J, ...a] : a, e;
125
140
  },
126
141
  {}
127
142
  );
@@ -137,9 +152,9 @@ function J(n) {
137
152
  /**
138
153
  * @description 清空所有缓存,重新请求
139
154
  */
140
- reload: K
155
+ reload: z
141
156
  };
142
157
  }
143
158
  export {
144
- J as useDataPermissionOptions
159
+ K as useDataPermissionOptions
145
160
  };