@dazhicheng/ui 1.5.211 → 1.5.213

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 fe, useTemplateRef as K, computed as a, reactive as pe, markRaw as ve, toRaw as he, watch as G, nextTick as be, onUnmounted as ye, createBlock as h, createCommentVNode as c, unref as l, openBlock as u, mergeProps as N, withCtx as b, withDirectives as Ce, createVNode as w, createElementVNode as $, createElementBlock as H, normalizeClass as O, normalizeStyle as J, renderSlot as ge, normalizeProps as we, guardReactiveProps as Fe, resolveDynamicComponent as Re, createSlots as Se, renderList as ke, Transition as Ne, vShow as Oe } from "vue";
1
+ import { defineComponent as fe, useTemplateRef as K, computed as i, reactive as pe, markRaw as ve, toRaw as he, watch as G, nextTick as be, onUnmounted as ye, createBlock as h, createCommentVNode as c, unref as l, openBlock as u, mergeProps as N, withCtx as b, withDirectives as Ce, createVNode as F, createElementVNode as $, createElementBlock as H, normalizeClass as O, normalizeStyle as J, renderSlot as ge, normalizeProps as we, guardReactiveProps as Fe, resolveDynamicComponent as Re, createSlots as Se, renderList as ke, Transition as Ne, vShow as Oe } from "vue";
2
2
  import Ee from "../form/FormControl.vue.js";
3
3
  import Be from "../form/FormDescription.vue.js";
4
4
  import Pe from "../form/FormItem.vue.js";
@@ -66,7 +66,7 @@ const Ge = { class: "flex-auto overflow-hidden" }, He = {
66
66
  commonComponentProps: {}
67
67
  },
68
68
  setup(n) {
69
- const B = K("wrapperRef"), { componentBindEventMap: X, componentMap: Y, isVertical: C } = We(), M = ze(), k = qe(), Z = je(n.fieldName), f = K("fieldComponentRef"), F = M.form, R = a(() => M.compact), S = a(() => {
69
+ const B = K("wrapperRef"), { componentBindEventMap: X, componentMap: Y, isVertical: C } = We(), M = ze(), k = qe(), Z = je(n.fieldName), f = K("fieldComponentRef"), R = M.form, S = i(() => M.compact), g = i(() => {
70
70
  var e;
71
71
  return ((e = Z.value) == null ? void 0 : e.length) > 0;
72
72
  }), P = pe(
@@ -86,21 +86,21 @@ const Ge = { class: "flex-auto overflow-hidden" }, He = {
86
86
  * @returns 是否设置成功
87
87
  */
88
88
  set(e, t, o) {
89
- return Ve(k.value, t, o), F == null || F.validateField(t), !0;
89
+ return Ve(k.value, t, o), R == null || R.validateField(t), !0;
90
90
  }
91
91
  })
92
- ), _ = a(() => {
92
+ ), _ = i(() => {
93
93
  const e = y(n.component) ? Y.value[n.component] : n.component;
94
94
  return ve(he(e));
95
95
  }), { dynamicComponentProps: ee, dynamicRules: ne, isDisabled: te, isIf: U, isRequired: T, isShow: D } = xe(
96
96
  () => n.dependencies
97
- ), oe = a(() => {
97
+ ), oe = i(() => {
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(() => ne.value || n.rules), W = a(() => !n.hide && U.value && D.value), V = a(() => {
103
- var o, i, d;
102
+ }), s = i(() => ne.value || n.rules), W = i(() => !n.hide && U.value && D.value), V = i(() => {
103
+ var o, a, d;
104
104
  if (!W.value)
105
105
  return !1;
106
106
  if (!s.value)
@@ -109,14 +109,14 @@ const Ge = { class: "flex-auto overflow-hidden" }, He = {
109
109
  return !0;
110
110
  if (y(s.value))
111
111
  return ["required", "selectRequired"].includes(s.value);
112
- let e = (i = (o = s == null ? void 0 : s.value) == null ? void 0 : o.isOptional) == null ? void 0 : i.call(o);
112
+ let e = (a = (o = s == null ? void 0 : s.value) == null ? void 0 : o.isOptional) == null ? void 0 : a.call(o);
113
113
  const t = s.value.def;
114
114
  if ((t == null ? void 0 : t.type) === "default" && "innerType" in t) {
115
115
  const v = t.innerType;
116
116
  v && (e = (d = v.isOptional) == null ? void 0 : d.call(v));
117
117
  }
118
118
  return !e;
119
- }), le = a(() => {
119
+ }), le = i(() => {
120
120
  var o;
121
121
  if (!W.value)
122
122
  return null;
@@ -126,19 +126,19 @@ const Ge = { class: "flex-auto overflow-hidden" }, He = {
126
126
  if (y(e))
127
127
  return e;
128
128
  if (!!V.value) {
129
- const i = (o = e == null ? void 0 : e.unwrap) == null ? void 0 : o.call(e);
130
- i && (e = i);
129
+ const a = (o = e == null ? void 0 : e.unwrap) == null ? void 0 : o.call(e);
130
+ a && (e = a);
131
131
  }
132
132
  return Ue(e);
133
- }), r = a(() => {
134
- const e = q(n.componentProps) ? n.componentProps(k.value, F) : n.componentProps;
133
+ }), r = i(() => {
134
+ const e = q(n.componentProps) ? n.componentProps(k.value, R) : n.componentProps;
135
135
  return {
136
136
  ...n.commonComponentProps,
137
137
  ...e,
138
138
  ...ee.value
139
139
  };
140
- }), { selectComponentProps: ie } = Ke(
141
- a(() => ({
140
+ }), { selectComponentProps: ae } = Ke(
141
+ i(() => ({
142
142
  componentProps: r,
143
143
  component: n.component,
144
144
  selectWrapRef: B,
@@ -157,10 +157,10 @@ const Ge = { class: "flex-auto overflow-hidden" }, He = {
157
157
  },
158
158
  { immediate: !0 }
159
159
  );
160
- const I = a(() => {
160
+ const I = i(() => {
161
161
  var e;
162
162
  return te.value || n.disabled || ((e = r.value) == null ? void 0 : e.disabled);
163
- }), z = a(() => q(n.renderComponentContent) ? n.renderComponentContent(k.value, F) : {}), ae = a(() => Object.keys(z.value)), re = a(() => {
163
+ }), z = i(() => q(n.renderComponentContent) ? n.renderComponentContent(k.value, R) : {}), ie = i(() => Object.keys(z.value)), re = i(() => {
164
164
  const e = le.value;
165
165
  return {
166
166
  keepValue: !0,
@@ -171,22 +171,22 @@ const Ge = { class: "flex-auto overflow-hidden" }, He = {
171
171
  });
172
172
  function ue(e) {
173
173
  var v;
174
- const t = e.componentField.modelValue, o = e.componentField["onUpdate:modelValue"], i = n.modelPropName || (y(n.component) ? (v = X.value) == null ? void 0 : v[n.component] : null);
174
+ const t = e.componentField.modelValue, o = e.componentField["onUpdate:modelValue"], a = n.modelPropName || (y(n.component) ? (v = X.value) == null ? void 0 : v[n.component] : null);
175
175
  let d = t;
176
- if (t && Te(t) && i) {
176
+ if (t && Te(t) && a) {
177
177
  const m = t.target;
178
- d = Q(t) ? m == null ? void 0 : m[i] : (t == null ? void 0 : t[i]) ?? t;
178
+ d = Q(t) ? m == null ? void 0 : m[a] : (t == null ? void 0 : t[a]) ?? t;
179
179
  }
180
- return i ? {
181
- [`onUpdate:${i}`]: o,
182
- [i]: d === void 0 ? n.emptyStateValue : d,
180
+ return a ? {
181
+ [`onUpdate:${a}`]: o,
182
+ [a]: d === void 0 ? n.emptyStateValue : d,
183
183
  onChange: n.disabledOnChangeListener ? void 0 : (m) => {
184
184
  var A;
185
- const ce = Q(m), g = (A = e == null ? void 0 : e.componentField) == null ? void 0 : A.onChange;
185
+ const ce = Q(m), w = (A = e == null ? void 0 : e.componentField) == null ? void 0 : A.onChange;
186
186
  if (!ce)
187
- return g == null ? void 0 : g(m);
187
+ return w == null ? void 0 : w(m);
188
188
  const L = m.target;
189
- return g == null ? void 0 : g((L == null ? void 0 : L[i]) ?? m);
189
+ return w == null ? void 0 : w((L == null ? void 0 : L[a]) ?? m);
190
190
  },
191
191
  ...n.disabledOnInputListener ? { onInput: void 0 } : {}
192
192
  } : {
@@ -199,7 +199,7 @@ const Ge = { class: "flex-auto overflow-hidden" }, He = {
199
199
  const t = ue(e), o = {
200
200
  ...e.componentField,
201
201
  ...r.value,
202
- ...ie.value,
202
+ ...ae.value,
203
203
  ...t,
204
204
  ...Reflect.has(r.value, "onChange") ? { onChange: r.value.onChange } : {},
205
205
  ...Reflect.has(r.value, "onInput") ? { onInput: r.value.onInput } : {}
@@ -218,12 +218,12 @@ const Ge = { class: "flex-auto overflow-hidden" }, He = {
218
218
  p != null && p.has(n.fieldName) && p.delete(n.fieldName);
219
219
  }), (e, t) => !e.hide && l(U) ? (u(), h(l(Me), N({ key: 0 }, re.value, { name: e.fieldName }), {
220
220
  default: b((o) => [
221
- Ce(w(l(Pe), N({
221
+ Ce(F(l(Pe), N({
222
222
  class: [{
223
- "form-valid-error": S.value,
223
+ "form-valid-error": g.value,
224
224
  "form-is-required": V.value,
225
- "pb-(--form-valid-error-nocompact-padding-bottom)": !R.value,
226
- "pb-2": R.value
225
+ "pb-(--form-valid-error-nocompact-padding-bottom)": !S.value,
226
+ "pb-2": S.value
227
227
  }, "relative"]
228
228
  }, e.$attrs), {
229
229
  default: b(() => [
@@ -266,7 +266,7 @@ const Ge = { class: "flex-auto overflow-hidden" }, He = {
266
266
  ref: B,
267
267
  class: O(l(j)("relative flex w-full items-center", e.wrapperClass))
268
268
  }, [
269
- w(l(Ee), {
269
+ F(l(Ee), {
270
270
  class: O(l(j)(e.controlClass))
271
271
  }, {
272
272
  default: b(() => [
@@ -274,7 +274,7 @@ const Ge = { class: "flex-auto overflow-hidden" }, He = {
274
274
  ...o,
275
275
  ...x(o),
276
276
  disabled: I.value,
277
- isInValid: S.value,
277
+ isInValid: g.value,
278
278
  form: P,
279
279
  fieldName: e.fieldName
280
280
  })), () => [
@@ -282,20 +282,20 @@ const Ge = { class: "flex-auto overflow-hidden" }, He = {
282
282
  ref_key: "fieldComponentRef",
283
283
  ref: f,
284
284
  class: {
285
- "border-destructive hover:border-destructive/80 focus:border-destructive focus:shadow-[0_0_0_2px_rgba(255,38,5,0.06)]": S.value
285
+ "border-destructive hover:border-destructive/80 focus:border-destructive focus:shadow-[0_0_0_2px_rgba(255,38,5,0.06)]": g.value
286
286
  }
287
287
  }, {
288
288
  ...x(o),
289
289
  disabled: I.value,
290
- isInValid: S.value,
290
+ isInValid: g.value,
291
291
  form: P,
292
292
  fieldName: e.fieldName
293
293
  }, { disabled: I.value }), Se({ _: 2 }, [
294
- ke(ae.value, (i) => ({
295
- name: i,
294
+ ke(ie.value, (a) => ({
295
+ name: a,
296
296
  fn: b((d) => [
297
- w(l(E), N({
298
- content: z.value[i]
297
+ F(l(E), N({
298
+ content: z.value[a]
299
299
  }, { ...d, formContext: o }), null, 16, ["content"])
300
300
  ])
301
301
  }))
@@ -305,16 +305,16 @@ const Ge = { class: "flex-auto overflow-hidden" }, He = {
305
305
  _: 2
306
306
  }, 1032, ["class"]),
307
307
  e.suffix ? (u(), H("div", He, [
308
- w(l(E), { content: e.suffix }, null, 8, ["content"])
308
+ F(l(E), { content: e.suffix }, null, 8, ["content"])
309
309
  ])) : c("", !0),
310
- R.value && S.value ? (u(), h(l(Le), {
310
+ S.value && g.value ? (u(), h(l(Le), {
311
311
  key: 1,
312
312
  "ref-dom": B.value
313
313
  }, null, 8, ["ref-dom"])) : c("", !0)
314
314
  ], 2)
315
315
  ])
316
316
  ], 2),
317
- e.description || !R.value ? (u(), H("div", {
317
+ e.description || !S.value ? (u(), H("div", {
318
318
  key: 0,
319
319
  style: J(!l(C) && !e.hideLabel ? { paddingLeft: `${(e.labelWidth || 0) + 8}px` } : {})
320
320
  }, [
@@ -323,19 +323,19 @@ const Ge = { class: "flex-auto overflow-hidden" }, He = {
323
323
  class: "text-[12px]"
324
324
  }, {
325
325
  default: b(() => [
326
- w(l(E), { content: e.description }, null, 8, ["content"])
326
+ F(l(E), { content: e.description }, null, 8, ["content"])
327
327
  ]),
328
328
  _: 1
329
329
  })) : c("", !0),
330
- R.value ? c("", !0) : (u(), h(Ne, {
331
- key: 1,
332
- name: "slide-up"
333
- }, {
330
+ F(Ne, { name: "slide-up" }, {
334
331
  default: b(() => [
335
- w(l($e), { class: "absolute" })
332
+ !S.value && g.value ? (u(), h(l($e), {
333
+ key: 0,
334
+ class: "absolute"
335
+ })) : c("", !0)
336
336
  ]),
337
337
  _: 1
338
- }))
338
+ })
339
339
  ], 4)) : c("", !0)
340
340
  ]),
341
341
  _: 2
@@ -1,9 +1,9 @@
1
- import { queryDataPermissionDetailDataTypeContext as x, pageUser as T } from "../api/dataTypeContext.js";
2
- import { ref as K, watchEffect as L, unref as q, watch as U, computed as b } from "vue";
3
- import { useRoute as M } from "vue-router";
4
- const c = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map();
5
- let C, m;
6
- const V = "all", _ = { label: "全部", value: V }, j = {
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 = {
7
7
  platformId: ["platformName", "platformId"],
8
8
  shopId: ["shopName", "shopId"],
9
9
  purchasePlaceId: ["purchasePlaceName", "purchasePlaceCode"],
@@ -11,114 +11,117 @@ const V = "all", _ = { label: "全部", value: V }, j = {
11
11
  lockUserId: ["userName", "userId"],
12
12
  userId: ["fullName", "id"]
13
13
  };
14
- async function E() {
15
- if (C) return C;
16
- if (m) return m;
17
- m = T({ pageNo: 1, pageSize: 9999 }).then((a) => {
18
- const l = a.records || [];
19
- return C = l, l;
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;
20
20
  });
21
21
  try {
22
- return await m;
22
+ return await h;
23
23
  } finally {
24
- m = void 0;
24
+ h = void 0;
25
25
  }
26
26
  }
27
- function G(a) {
28
- const l = M(), P = K({});
29
- function p(t = {}) {
30
- P.value = a.codes.reduce(
27
+ function J(n) {
28
+ const l = _(), v = U({});
29
+ function m(t = {}) {
30
+ v.value = n.codes.reduce(
31
31
  (e, r) => {
32
- const [s, d] = j[r], y = (t[r] || []).map((f) => {
33
- const u = r === "purchasePlaceId" ? f.purchaseInfo || {} : f;
32
+ const [s, d] = z[r], g = (t[r] || []).map((f) => {
33
+ const o = r === "purchasePlaceId" ? f.purchaseInfo || {} : f;
34
34
  return {
35
35
  ...f,
36
- label: u == null ? void 0 : u[s],
37
- value: u == null ? void 0 : u[d]
36
+ label: o == null ? void 0 : o[s],
37
+ value: o == null ? void 0 : o[d]
38
38
  };
39
39
  });
40
- return e[r] = y, e;
40
+ return e[r] = g, e;
41
41
  },
42
42
  {}
43
43
  );
44
44
  }
45
- function N(t) {
45
+ function A(t) {
46
46
  var e;
47
- return typeof a.showAll == "boolean" ? a.showAll : ((e = a.showAll) == null ? void 0 : e[t]) ?? !1;
47
+ return typeof n.showAll == "boolean" ? n.showAll : ((e = n.showAll) == null ? void 0 : e[t]) ?? !1;
48
48
  }
49
- function O() {
50
- I.clear(), c.clear(), g.clear(), C = void 0, m = void 0;
49
+ function x() {
50
+ C.clear(), c.clear(), p.clear(), D = void 0, h = void 0;
51
51
  }
52
- function A(t) {
52
+ function T(t) {
53
53
  c.delete(t);
54
54
  }
55
- async function D(t = !1) {
56
- const e = l.path, r = q(a.dataSource);
55
+ async function S(t = !1) {
56
+ const e = l.path, r = O(n.dataSource);
57
57
  if (r) {
58
58
  const i = { ...c.get(e) || {}, ...r };
59
- c.set(e, i), p(i);
59
+ c.set(e, i), m(i);
60
60
  return;
61
61
  }
62
62
  const s = c.get(e) || {};
63
- let d = t ? [...a.codes] : a.codes.filter((n) => !Object.prototype.hasOwnProperty.call(s, n));
63
+ let d = t ? [...n.codes] : n.codes.filter((a) => !Object.prototype.hasOwnProperty.call(s, a));
64
64
  if (!d.length) {
65
- p(s);
65
+ m(s);
66
66
  return;
67
67
  }
68
- const y = t ? void 0 : I.get(e);
69
- if (y) {
70
- const n = await y, o = { ...c.get(e) || {}, ...n };
71
- if (c.set(e, o), d = a.codes.filter((h) => !Object.prototype.hasOwnProperty.call(o, h)), !d.length) {
72
- p(o);
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);
73
73
  return;
74
74
  }
75
75
  }
76
- const f = d.filter((n) => n !== "userId"), u = d.includes("userId"), v = Promise.all([
77
- f.length ? x({ dataTypeName: f }).then(
78
- (n) => n
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
79
79
  ) : Promise.resolve([]),
80
- u ? E() : Promise.resolve(void 0)
81
- ]).then(([n, i]) => ({
82
- ...i ? { userId: i } : {},
83
- ...n.reduce((o, h) => {
84
- const S = h == null ? void 0 : h.dataTypeCode;
85
- return S && (o[S] = h.originalItems || []), o;
86
- }, {})
87
- })), w = (g.get(e) || 0) + 1;
88
- g.set(e, w), I.set(e, v);
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;
83
+ 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
+ }, {})
89
+ };
90
+ }), w = (p.get(e) || 0) + 1;
91
+ p.set(e, w), C.set(e, q);
89
92
  try {
90
- const n = await v;
91
- if (g.get(e) !== w) return;
92
- const o = { ...c.get(e) || {}, ...n };
93
- c.set(e, o), p(o);
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);
94
97
  } finally {
95
- g.get(e) === w && I.delete(e);
98
+ p.get(e) === w && C.delete(e);
96
99
  }
97
100
  }
98
- async function R() {
101
+ async function K() {
99
102
  const t = l.path;
100
- O(), A(t), await D(!0);
103
+ x(), T(t), await S(!0);
101
104
  }
102
- return L(() => {
103
- const t = q(a.dataSource);
105
+ return b(() => {
106
+ const t = O(n.dataSource);
104
107
  if (!t) return;
105
108
  const e = l.path, s = { ...c.get(e) || {}, ...t };
106
- c.set(e, s), p(s);
107
- }), U(
109
+ c.set(e, s), m(s);
110
+ }), M(
108
111
  () => l.path,
109
112
  () => {
110
- D();
113
+ S();
111
114
  },
112
115
  { immediate: !0 }
113
116
  ), {
114
117
  /**
115
118
  * 数据源
116
119
  */
117
- dataSource: b(() => {
118
- const t = a.codes.reduce(
120
+ dataSource: V(() => {
121
+ const t = n.codes.reduce(
119
122
  (e, r) => {
120
- const s = P.value[r] || [];
121
- return e[r] = N(r) ? [_, ...s] : s, e;
123
+ const s = v.value[r] || [];
124
+ return e[r] = A(r) ? [E, ...s] : s, e;
122
125
  },
123
126
  {}
124
127
  );
@@ -134,9 +137,9 @@ function G(a) {
134
137
  /**
135
138
  * @description 清空所有缓存,重新请求
136
139
  */
137
- reload: R
140
+ reload: K
138
141
  };
139
142
  }
140
143
  export {
141
- G as useDataPermissionOptions
144
+ J as useDataPermissionOptions
142
145
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dazhicheng/ui",
3
- "version": "1.5.211",
3
+ "version": "1.5.213",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",