@hkyhy/marsun-components-core 0.1.31 → 0.1.33

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 (31) hide show
  1. package/dist/components/Filter/FilterCascader/index.js +194 -184
  2. package/dist/components/Filter/FilterCascader/index.js.map +1 -1
  3. package/dist/components/Form/FormDataSync.d.ts +11 -0
  4. package/dist/components/Form/FormDataSync.js +20 -0
  5. package/dist/components/Form/FormDataSync.js.map +1 -0
  6. package/dist/components/Form/index.d.ts +3 -1
  7. package/dist/components/Form/kneFormInfo.d.ts +1 -0
  8. package/dist/components/Form/kneFormInfo.js +12 -11
  9. package/dist/components/Form/kneFormInfo.js.map +1 -1
  10. package/dist/components/Icons/index.d.ts +3 -1
  11. package/dist/components/Icons/index.js +165 -159
  12. package/dist/components/Icons/index.js.map +1 -1
  13. package/dist/components/InteractiveBlock/InteractiveBlock.d.ts +31 -0
  14. package/dist/components/InteractiveBlock/InteractiveBlock.js +171 -0
  15. package/dist/components/InteractiveBlock/InteractiveBlock.js.map +1 -0
  16. package/dist/components/InteractiveBlock/index.d.ts +3 -0
  17. package/dist/components/InteractiveBlock/style.module.scss.js +19 -0
  18. package/dist/components/InteractiveBlock/style.module.scss.js.map +1 -0
  19. package/dist/components/Layout/ContentCard/index.d.ts +14 -0
  20. package/dist/components/Layout/ContentCard/index.js +20 -0
  21. package/dist/components/Layout/ContentCard/index.js.map +1 -0
  22. package/dist/components/Layout/ContentCard/style.module.scss.js +9 -0
  23. package/dist/components/Layout/ContentCard/style.module.scss.js.map +1 -0
  24. package/dist/components/Layout/index.d.ts +2 -0
  25. package/dist/components/index.d.ts +1 -0
  26. package/dist/index.d.ts +1 -0
  27. package/dist/index.js +387 -378
  28. package/dist/index.js.map +1 -1
  29. package/dist/marsun-components-core.css +1 -1
  30. package/dist/styles/global.css +1 -1
  31. package/package.json +1 -1
@@ -1,57 +1,57 @@
1
- import { jsx as u, jsxs as Z } from "react/jsx-runtime";
2
- import { Input as br, Spin as yr, Cascader as K, Space as Ar } from "antd";
3
- import h from "classnames";
4
- import { useRef as $, useState as F, useEffect as q, useMemo as L, useCallback as O } from "react";
5
- import Lr from "../FilterPopover/index.js";
1
+ import { jsx as g, jsxs as K } from "react/jsx-runtime";
2
+ import { Input as Lr, Spin as wr, Cascader as O, Space as pr } from "antd";
3
+ import y from "classnames";
4
+ import { useRef as _, useState as M, useEffect as $, useMemo as L, useCallback as k } from "react";
5
+ import Mr from "../FilterPopover/index.js";
6
6
  import { resolveFilterVisible as C } from "../types.js";
7
- import { useFilterFieldBridge as pr, useFilterRegister as wr } from "../useFilterState.js";
7
+ import { useFilterFieldBridge as Nr, useFilterRegister as Fr } from "../useFilterState.js";
8
8
  import v from "./style.module.scss.js";
9
- import Mr from "../../Empty/Empty.js";
10
- const { Search: Nr } = br;
11
- function rr(r, i = (c) => c.name) {
12
- return r != null && r.length ? r.map((c) => {
13
- var l;
14
- const t = (l = c.children) != null && l.length ? rr(c.children, i) : void 0;
9
+ import Tr from "../../Empty/Empty.js";
10
+ const { Search: Vr } = Lr;
11
+ function rr(r, i = (s) => s.name) {
12
+ return r != null && r.length ? r.map((s) => {
13
+ var a;
14
+ const t = (a = s.children) != null && a.length ? rr(s.children, i) : void 0;
15
15
  return {
16
- value: c.id,
17
- label: i(c),
16
+ value: s.id,
17
+ label: i(s),
18
18
  children: t,
19
19
  isLeaf: !(t != null && t.length)
20
20
  };
21
21
  }) : [];
22
22
  }
23
- function Fr(r, i) {
23
+ function Ir(r, i) {
24
24
  if (!i.trim()) return r;
25
- const c = i.toLowerCase(), t = (l) => {
26
- var n;
27
- const s = [];
28
- for (const e of l) {
29
- const a = typeof e.label == "string" || typeof e.label == "number" ? String(e.label) : String(e.value), f = (n = e.children) != null && n.length ? t(e.children) : [];
30
- (a.toLowerCase().includes(c) || f.length > 0) && s.push({
25
+ const s = i.toLowerCase(), t = (a) => {
26
+ var c;
27
+ const n = [];
28
+ for (const e of a) {
29
+ const o = typeof e.label == "string" || typeof e.label == "number" ? String(e.label) : String(e.value), u = (c = e.children) != null && c.length ? t(e.children) : [];
30
+ (o.toLowerCase().includes(s) || u.length > 0) && n.push({
31
31
  ...e,
32
- children: f.length > 0 ? f : void 0,
33
- isLeaf: !(f.length > 0)
32
+ children: u.length > 0 ? u : void 0,
33
+ isLeaf: !(u.length > 0)
34
34
  });
35
35
  }
36
- return s;
36
+ return n;
37
37
  };
38
38
  return t(r);
39
39
  }
40
- function Vr(r) {
41
- const i = /* @__PURE__ */ new Map(), c = (t, l) => {
42
- var s;
43
- for (const n of t) {
44
- const e = [...l, String(n.value)];
45
- (s = n.children) != null && s.length ? c(n.children, e) : i.set(String(n.value), e);
40
+ function kr(r) {
41
+ const i = /* @__PURE__ */ new Map(), s = (t, a) => {
42
+ var n;
43
+ for (const c of t) {
44
+ const e = [...a, String(c.value)];
45
+ (n = c.children) != null && n.length ? s(c.children, e) : i.set(String(c.value), e);
46
46
  }
47
47
  };
48
- return c(r, []), i;
48
+ return s(r, []), i;
49
49
  }
50
- function Tr(r, i) {
51
- let c = r, t = null;
52
- for (const l of i) {
53
- if (t = c.find((s) => String(s.value) === String(l)) ?? null, !t) return null;
54
- c = t.children ?? [];
50
+ function zr(r, i) {
51
+ let s = r, t = null;
52
+ for (const a of i) {
53
+ if (t = s.find((n) => String(n.value) === String(a)) ?? null, !t) return null;
54
+ s = t.children ?? [];
55
55
  }
56
56
  return t;
57
57
  }
@@ -59,251 +59,261 @@ function er(r) {
59
59
  var i;
60
60
  return (i = r.children) != null && i.length ? r.children.flatMap(er) : [String(r.value)];
61
61
  }
62
- function P(r, i, c, t) {
63
- const l = [], s = /* @__PURE__ */ new Set(), n = (e) => {
64
- !e || s.has(e) || (s.add(e), l.push(e));
62
+ function P(r, i, s, t) {
63
+ const a = [], n = /* @__PURE__ */ new Set(), c = (e) => {
64
+ !e || n.has(e) || (n.add(e), a.push(e));
65
65
  };
66
66
  for (const e of r) {
67
67
  if (!(e != null && e.length)) continue;
68
- const a = String(e[e.length - 1]);
69
- if (c.has(a)) {
70
- n(a);
68
+ const o = String(e[e.length - 1]);
69
+ if (s.has(o)) {
70
+ c(o);
71
71
  continue;
72
72
  }
73
73
  if (!t) {
74
- n(a);
74
+ c(o);
75
75
  continue;
76
76
  }
77
- const f = Tr(i, e.map(String));
78
- f && er(f).forEach(n);
77
+ const u = zr(i, e.map(String));
78
+ u && er(u).forEach(c);
79
79
  }
80
- return l;
80
+ return a;
81
81
  }
82
- function kr(r) {
83
- const i = /* @__PURE__ */ new Map(), c = (t) => {
84
- var l;
85
- for (const s of t) {
86
- const n = typeof s.label == "string" || typeof s.label == "number" ? String(s.label) : String(s.value);
87
- i.set(String(s.value), n), (l = s.children) != null && l.length && c(s.children);
82
+ function jr(r) {
83
+ const i = /* @__PURE__ */ new Map(), s = (t) => {
84
+ var a;
85
+ for (const n of t) {
86
+ const c = typeof n.label == "string" || typeof n.label == "number" ? String(n.label) : String(n.value);
87
+ i.set(String(n.value), c), (a = n.children) != null && a.length && s(n.children);
88
88
  }
89
89
  };
90
- return c(r), i;
90
+ return s(r), i;
91
91
  }
92
- function zr(r, i, c) {
93
- if (r == null || r === "") return c ? [] : void 0;
94
- if (c)
95
- return (Array.isArray(r) ? r : [r]).map((s) => i.get(String(s)) || [String(s)]).filter((s) => s.length);
92
+ function Rr(r, i, s) {
93
+ if (r == null || r === "") return s ? [] : void 0;
94
+ if (s)
95
+ return (Array.isArray(r) ? r : [r]).map((n) => i.get(String(n)) || [String(n)]).filter((n) => n.length);
96
96
  const t = Array.isArray(r) ? r[0] : r;
97
97
  if (!(t == null || t === ""))
98
98
  return i.get(String(t)) || [String(t)];
99
99
  }
100
- function Ir(r, i, c, t, l) {
100
+ function Br(r, i, s, t, a) {
101
101
  if (r == null || Array.isArray(r) && r.length === 0)
102
102
  return i ? [] : void 0;
103
103
  if (i) {
104
- const e = r.filter((a) => Array.isArray(a) && a.length);
104
+ const e = r.filter((o) => Array.isArray(o) && o.length);
105
105
  return P(
106
- e.map((a) => a.map(String)),
106
+ e.map((o) => o.map(String)),
107
107
  t,
108
- l,
109
- c
108
+ a,
109
+ s
110
110
  );
111
111
  }
112
- const s = r.map(String);
113
- if (!s.length) return;
114
- const n = P([s], t, l, c);
115
- if (!(c && n.length === 0))
116
- return n[0];
112
+ const n = r.map(String);
113
+ if (!n.length) return;
114
+ const c = P([n], t, a, s);
115
+ if (!(s && c.length === 0))
116
+ return c[0];
117
117
  }
118
- const qr = ({
118
+ const Jr = ({
119
119
  filterKey: r,
120
120
  label: i,
121
- treeData: c,
121
+ treeData: s,
122
122
  options: t,
123
- loadData: l,
124
- enabled: s = !0,
125
- value: n,
123
+ loadData: a,
124
+ enabled: n = !0,
125
+ value: c,
126
126
  onChange: e,
127
- onChangePath: a,
128
- showSearch: f = !1,
129
- multiple: o = !1,
130
- leafOnly: V = !0,
127
+ onChangePath: o,
128
+ showSearch: u = !1,
129
+ multiple: d = !1,
130
+ leafOnly: N = !0,
131
131
  active: tr,
132
- hidden: I,
133
- display: R,
134
- dependsOn: nr,
135
- clearOnDepsChange: cr = !0,
136
- getNodeLabel: D = (S) => S.name,
137
- panelExtra: j,
138
- panelWidth: sr,
132
+ hidden: z,
133
+ display: j,
134
+ dependsOn: cr,
135
+ clearOnDepsChange: sr = !0,
136
+ getNodeLabel: q = (A) => A.name,
137
+ panelExtra: R,
138
+ panelWidth: nr,
139
139
  loading: ir = !1
140
140
  }) => {
141
- const S = $(e);
142
- S.current = e;
143
- const T = $(a);
144
- T.current = a;
145
- const lr = sr ?? (j ? 520 : 440), { resolvedLabel: p, values: ar, depsKey: or } = pr({
141
+ const A = _(e);
142
+ A.current = e;
143
+ const F = _(o);
144
+ F.current = o;
145
+ const lr = nr ?? (R ? 520 : 440), { resolvedLabel: w, values: ar, depsKey: or } = Nr({
146
146
  filterKey: r,
147
- value: n,
147
+ value: c,
148
148
  label: i,
149
- dependsOn: nr,
150
- clearOnDepsChange: cr,
149
+ dependsOn: cr,
150
+ clearOnDepsChange: sr,
151
151
  onDepsClear: () => {
152
- var d, g;
153
- (d = S.current) == null || d.call(S, o ? [] : void 0), (g = T.current) == null || g.call(T, void 0);
152
+ var l, f;
153
+ (l = A.current) == null || l.call(A, d ? [] : void 0), (f = F.current) == null || f.call(F, void 0);
154
154
  }
155
- }), [G, J] = F([]), [dr, Q] = F(!1), x = $(l);
156
- x.current = l, q(() => {
157
- if (!x.current || c != null || t != null || !s) return;
158
- let d = !1;
155
+ }), [G, J] = M([]), [dr, Q] = M(!1), B = _(a);
156
+ B.current = a, $(() => {
157
+ if (!B.current || s != null || t != null || !n) return;
158
+ let l = !1;
159
159
  return Q(!0), (async () => {
160
160
  try {
161
- const g = await x.current({ values: ar });
162
- d || J(g ?? []);
161
+ const f = await B.current({ values: ar });
162
+ l || J(f ?? []);
163
163
  } catch {
164
- d || J([]);
164
+ l || J([]);
165
165
  } finally {
166
- d || Q(!1);
166
+ l || Q(!1);
167
167
  }
168
168
  })(), () => {
169
- d = !0;
169
+ l = !0;
170
170
  };
171
- }, [or, s, c, t, l]);
172
- const m = L(() => t != null && t.length ? t : rr(c ?? (l ? G : []), D), [t, c, l, G, D]), U = ir || dr, b = L(() => Vr(m), [m]), B = L(() => kr(m), [m]), [fr, ur] = F(!1), [k, H] = F(""), [w, X] = F(
173
- n ?? (o ? [] : void 0)
171
+ }, [or, n, s, t, a]);
172
+ const m = L(() => t != null && t.length ? t : rr(s ?? (a ? G : []), q), [t, s, a, G, q]), U = ir || dr, S = L(() => kr(m), [m]), D = L(() => jr(m), [m]), [fr, T] = M(!1), [V, H] = M(""), [b, I] = M(
173
+ c ?? (d ? [] : void 0)
174
174
  );
175
- q(() => {
176
- X(n ?? (o ? [] : void 0)), n == null && H("");
177
- }, [n, o]);
175
+ $(() => {
176
+ I(c ?? (d ? [] : void 0)), c == null && H("");
177
+ }, [c, d]);
178
178
  const W = L(() => {
179
- if (n == null) return "";
180
- if (o) {
181
- const d = n;
182
- return d.length > 0 ? d.map((g) => B.get(g) ?? g).join("、") : "";
179
+ if (c == null) return "";
180
+ if (d) {
181
+ const l = c;
182
+ return l.length > 0 ? l.map((f) => D.get(f) ?? f).join("、") : "";
183
183
  }
184
- return B.get(n) ?? "";
185
- }, [n, o, B]), M = wr(), E = { filterKey: r, label: p, value: n };
186
- q(() => {
187
- if (M) {
188
- if (!C({ display: R, hidden: I }, E)) {
189
- M.unregister(r);
184
+ return D.get(c) ?? "";
185
+ }, [c, d, D]), p = Fr(), x = { filterKey: r, label: w, value: c };
186
+ $(() => {
187
+ if (p) {
188
+ if (!C({ display: j, hidden: z }, x)) {
189
+ p.unregister(r);
190
190
  return;
191
191
  }
192
- W ? M.register(r, {
193
- label: p,
192
+ W ? p.register(r, {
193
+ label: w,
194
194
  valueLabel: W,
195
195
  onRemove: () => {
196
- e == null || e(o ? [] : void 0), a == null || a(void 0);
196
+ e == null || e(d ? [] : void 0), o == null || o(void 0);
197
197
  }
198
- }) : M.unregister(r);
198
+ }) : p.unregister(r);
199
199
  }
200
200
  }, [
201
201
  W,
202
202
  r,
203
+ w,
204
+ j,
205
+ z,
203
206
  p,
204
- R,
205
- I,
206
- M,
207
207
  e,
208
- a,
209
208
  o,
210
- E
209
+ d,
210
+ x
211
211
  ]);
212
- const Y = L(
213
- () => f && k ? Fr(m, k) : m,
214
- [f, k, m]
215
- ), gr = L(
216
- () => zr(w, b, o),
217
- [w, b, o]
218
- ), z = O(
219
- (d, g) => {
220
- X(d), e == null || e(d), a == null || a(g);
212
+ const X = L(
213
+ () => u && V ? Ir(m, V) : m,
214
+ [u, V, m]
215
+ ), ur = L(
216
+ () => Rr(b, S, d),
217
+ [b, S, d]
218
+ ), gr = k(
219
+ (l) => l.map((f) => S.get(String(f))).filter((f) => !!(f != null && f.length)),
220
+ [S]
221
+ ), Y = k(
222
+ (l, f) => {
223
+ I(l), e == null || e(l), o == null || o(f);
221
224
  },
222
- [e, a]
223
- ), mr = O(
224
- (d) => {
225
- const y = Ir(
225
+ [e, o]
226
+ ), Z = k(() => {
227
+ I(c ?? (d ? [] : void 0)), H("");
228
+ }, [c, d]), mr = k(
229
+ (l) => {
230
+ const h = Br(
231
+ l,
226
232
  d,
227
- o,
228
- V,
233
+ N,
229
234
  m,
230
- b
235
+ S
231
236
  );
232
- if (o) {
233
- const A = Array.isArray(y) ? y : y ? [y] : [], _ = A.map((N) => b.get(String(N))).filter((N) => !!(N != null && N.length));
234
- z(A, _);
235
- } else {
236
- const A = typeof y == "string" ? y : void 0, _ = A ? b.get(A) : void 0;
237
- z(A, _);
237
+ if (d) {
238
+ const hr = Array.isArray(h) ? h : h ? [h] : [];
239
+ I(hr);
240
+ return;
238
241
  }
242
+ const E = typeof h == "string" ? h : void 0, Ar = E ? S.get(E) : void 0;
243
+ Y(E, Ar), T(!1);
239
244
  },
240
- [o, V, m, b, z]
245
+ [d, N, m, S, Y]
241
246
  ), vr = () => {
242
- }, hr = () => {
243
- z(o ? [] : void 0, void 0), H("");
244
- }, Sr = tr ?? (o ? Array.isArray(n) && n.length > 0 : n != null && n !== "");
245
- return C({ display: R, hidden: I }, E) ? /* @__PURE__ */ u(
246
- Lr,
247
+ if (!d) return;
248
+ const l = Array.isArray(b) ? b : [], f = gr(l);
249
+ e == null || e(l), o == null || o(f), T(!1);
250
+ }, Sr = () => {
251
+ Z(), T(!1);
252
+ }, br = (l) => {
253
+ !l && d && Z(), T(l);
254
+ }, yr = tr ?? (d ? Array.isArray(c) && c.length > 0 : c != null && c !== "");
255
+ return C({ display: j, hidden: z }, x) ? /* @__PURE__ */ g(
256
+ Mr,
247
257
  {
248
- label: p,
249
- active: Sr,
258
+ label: w,
259
+ active: yr,
250
260
  loading: U,
251
261
  width: lr,
252
262
  open: fr,
253
- onOpenChange: ur,
254
- onConfirm: vr,
255
- onReset: hr,
256
- children: /* @__PURE__ */ Z("div", { className: h("filter-cascader-root", v["filter-cascader-root"]), children: [
257
- j ? /* @__PURE__ */ u(
263
+ onOpenChange: br,
264
+ onConfirm: d ? vr : void 0,
265
+ onReset: d ? Sr : void 0,
266
+ children: /* @__PURE__ */ K("div", { className: y("filter-cascader-root", v["filter-cascader-root"]), children: [
267
+ R ? /* @__PURE__ */ g(
258
268
  "div",
259
269
  {
260
- className: h(
270
+ className: y(
261
271
  "filter-cascader-panel-extra",
262
272
  v["filter-cascader-panel-extra"]
263
273
  ),
264
- children: j
274
+ children: R
265
275
  }
266
276
  ) : null,
267
- f ? /* @__PURE__ */ u("div", { className: h("filter-cascader-search", v["filter-cascader-search"]), children: /* @__PURE__ */ u(
268
- Nr,
277
+ u ? /* @__PURE__ */ g("div", { className: y("filter-cascader-search", v["filter-cascader-search"]), children: /* @__PURE__ */ g(
278
+ Vr,
269
279
  {
270
- placeholder: `搜索${p}`,
280
+ placeholder: `搜索${w}`,
271
281
  allowClear: !0,
272
- value: k,
273
- onChange: (d) => H(d.target.value)
282
+ value: V,
283
+ onChange: (l) => H(l.target.value)
274
284
  }
275
285
  ) }) : null,
276
- U ? /* @__PURE__ */ u("div", { className: h("filter-cascader-loading", v["filter-cascader-loading"]), children: /* @__PURE__ */ u(yr, { size: "small" }) }) : Y.length === 0 ? /* @__PURE__ */ u(Mr, { iconType: "simple", description: "暂无选项" }) : /* @__PURE__ */ u(
286
+ U ? /* @__PURE__ */ g("div", { className: y("filter-cascader-loading", v["filter-cascader-loading"]), children: /* @__PURE__ */ g(wr, { size: "small" }) }) : X.length === 0 ? /* @__PURE__ */ g(Tr, { iconType: "simple", description: "暂无选项" }) : /* @__PURE__ */ g(
277
287
  "div",
278
288
  {
279
- className: h(
289
+ className: y(
280
290
  "filter-cascader-panel-wrap",
281
291
  v["filter-cascader-panel-wrap"]
282
292
  ),
283
- children: /* @__PURE__ */ u(
284
- K.Panel,
293
+ children: /* @__PURE__ */ g(
294
+ O.Panel,
285
295
  {
286
- className: h("filter-cascader-panel", v["filter-cascader-panel"]),
287
- options: Y,
288
- value: gr,
296
+ className: y("filter-cascader-panel", v["filter-cascader-panel"]),
297
+ options: X,
298
+ value: ur,
289
299
  onChange: mr,
290
- multiple: o,
291
- changeOnSelect: !V,
292
- ...o && V ? { showCheckedStrategy: K.SHOW_CHILD } : {}
300
+ multiple: d,
301
+ changeOnSelect: !N,
302
+ ...d && N ? { showCheckedStrategy: O.SHOW_CHILD } : {}
293
303
  }
294
304
  )
295
305
  }
296
306
  ),
297
- o && Array.isArray(w) && w.length > 0 ? /* @__PURE__ */ u(
307
+ d && Array.isArray(b) && b.length > 0 ? /* @__PURE__ */ g(
298
308
  "div",
299
309
  {
300
- className: h(
310
+ className: y(
301
311
  "filter-cascader-selected-bar",
302
312
  v["filter-cascader-selected-bar"]
303
313
  ),
304
- children: /* @__PURE__ */ u(Ar, { size: [4, 4], wrap: !0, children: /* @__PURE__ */ Z("span", { className: v["filter-cascader-selected-count"], children: [
314
+ children: /* @__PURE__ */ g(pr, { size: [4, 4], wrap: !0, children: /* @__PURE__ */ K("span", { className: v["filter-cascader-selected-count"], children: [
305
315
  "已选 ",
306
- w.length
316
+ b.length
307
317
  ] }) })
308
318
  }
309
319
  ) : null
@@ -312,7 +322,7 @@ const qr = ({
312
322
  ) : null;
313
323
  };
314
324
  export {
315
- qr as default,
325
+ Jr as default,
316
326
  rr as treeToCascaderOptions
317
327
  };
318
328
  //# sourceMappingURL=index.js.map