bitz-react-admin-ui 2.7.8 → 2.7.9

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,32 +1,32 @@
1
- import { j as c } from "../../../../../node_modules/react/jsx-runtime.mjs";
2
- import { css as we } from "../../../../../node_modules/@emotion/css/dist/emotion-css.esm.mjs";
3
- import { theme as Me, Flex as O, Typography as q, Space as je, Checkbox as Se, Button as se } from "antd";
4
- import { forwardRef as Le, useRef as oe, useState as f, useEffect as T, useMemo as S, useContext as be, useImperativeHandle as Ke, memo as Re } from "react";
5
- import { useImmer as ve } from "../../../../../node_modules/use-immer/dist/use-immer.module.mjs";
1
+ import { j as r } from "../../../../../node_modules/react/jsx-runtime.mjs";
2
+ import { css as Me } from "../../../../../node_modules/@emotion/css/dist/emotion-css.esm.mjs";
3
+ import { theme as Se, Flex as F, Alert as Le, Typography as q, Space as be, Checkbox as ve, Button as ne } from "antd";
4
+ import { forwardRef as Ke, useRef as oe, useState as f, useEffect as T, useMemo as b, useContext as Re, useImperativeHandle as Ne, memo as Ee } from "react";
5
+ import { useImmer as Te } from "../../../../../node_modules/use-immer/dist/use-immer.module.mjs";
6
6
  import "../../../index.mjs";
7
- import { columnSort as Ne, genColumnKey as Ee, updateNestedObject as L, removePropertiesWithoutMutation as Te } from "../../../Store/utils/index.mjs";
7
+ import { columnSort as Ie, genColumnKey as ze, updateNestedObject as v, removePropertiesWithoutMutation as Ae } from "../../../Store/utils/index.mjs";
8
8
  import G from "./DndList.mjs";
9
9
  import { BitzTableContext as He } from "../../../Store/index.mjs";
10
- import Ie from "../../../../../node_modules/lodash-es/omit.mjs";
11
- import Ae from "../../../../../node_modules/lodash-es/merge.mjs";
12
- import ne from "../../../../../node_modules/@ant-design/icons/es/icons/RedoOutlined.mjs";
13
- const ze = Le(
14
- ({ display: y, height: B, postHeight: re }, ce) => {
15
- const { token: le } = Me.useToken(), D = oe(null), J = oe(null), [W, ie] = f("auto"), Q = we`
10
+ import Fe from "../../../../../node_modules/lodash-es/omit.mjs";
11
+ import Oe from "../../../../../node_modules/lodash-es/merge.mjs";
12
+ import re from "../../../../../node_modules/@ant-design/icons/es/icons/RedoOutlined.mjs";
13
+ const We = Ke(
14
+ ({ display: y, height: O, postHeight: ce }, ie) => {
15
+ const { token: le } = Se.useToken(), W = oe(null), J = oe(null), [B, ae] = f("auto"), Q = Me`
16
16
  &:hover {
17
17
  color: ${le.colorPrimary} !important;
18
18
  }
19
19
  `;
20
20
  T(() => {
21
- D.current && re();
22
- }, [D.current]), T(() => {
21
+ W.current && ce();
22
+ }, [W.current]), T(() => {
23
23
  var e;
24
- if (typeof B == "number") {
24
+ if (typeof O == "number") {
25
25
  const s = (e = J.current) == null ? void 0 : e.clientHeight;
26
- ie(B - s - 16 - 8);
26
+ ae(O - s - 16 - 8);
27
27
  }
28
- }, [B]);
29
- const ae = S(() => ({
28
+ }, [O]);
29
+ const he = b(() => ({
30
30
  // display: display ? 'flex' : 'none'
31
31
  width: y ? "100%" : 0,
32
32
  pointerEvents: y ? "auto" : "none",
@@ -37,254 +37,275 @@ const ze = Le(
37
37
  left: 0,
38
38
  right: 0
39
39
  }
40
- }), [y]), { defaultColumnKeyMap: U, baseColumns: V, columnsMap: X } = be(He), [i, F] = ve({});
40
+ }), [y]), { defaultColumnKeyMap: U, baseColumns: V, columnsMap: X } = Re(He), [l, D] = Te({});
41
41
  T(() => {
42
42
  const e = Object.keys(X).length ? X : U;
43
- F(e);
43
+ D(e);
44
44
  }, []);
45
- const Y = S(() => ((s, t) => s.map((n) => {
46
- var te;
47
- const { key: o, dataIndex: r, children: l, ...x } = n, C = Ee(
48
- n,
49
- [t == null ? void 0 : t.columnKey, x.index].join("-")
50
- ), u = i[C || "null"] || {
45
+ const Y = b(() => ((s, t) => s.map((o) => {
46
+ var se;
47
+ const { key: n, dataIndex: c, children: i, ...g } = o, C = ze(
48
+ o,
49
+ [t == null ? void 0 : t.columnKey, g.index].join("-")
50
+ ), m = l[C || "null"] || {
51
51
  show: !0
52
52
  };
53
53
  return {
54
54
  key: C,
55
- ...Ie(x, ["className"]),
55
+ ...Fe(g, ["className"]),
56
56
  selectable: !1,
57
- disabled: u.disabled === !0,
58
- disableCheckbox: typeof u.disabled == "boolean" ? u == null ? void 0 : u.disabled : (te = u == null ? void 0 : u.disabled) == null ? void 0 : te.checkbox,
57
+ disabled: m.disabled === !0,
58
+ disableCheckbox: typeof m.disabled == "boolean" ? m == null ? void 0 : m.disabled : (se = m == null ? void 0 : m.disabled) == null ? void 0 : se.checkbox,
59
59
  isLeaf: t ? !0 : void 0,
60
- ...u
60
+ ...m
61
61
  };
62
- }))(V ?? []).sort(Ne(i)), [i, V]);
62
+ }))(V ?? []).sort(Ie(l)), [l, V]);
63
63
  T(() => {
64
- var n, o;
64
+ var o, n;
65
65
  const e = {}, s = {}, t = {};
66
- for (const r in i)
67
- ((n = i[r]) == null ? void 0 : n.fixed) === "left" ? e[r] = i[r] : ((o = i[r]) == null ? void 0 : o.fixed) === "right" ? s[r] = i[r] : t[r] = i[r];
68
- m(e), p(s), g(t);
69
- }, [i]);
70
- const [b, H] = f([]), [k, K] = f([]), [a, m] = f({}), [R, I] = f([]), [w, v] = f([]), [h, p] = f({}), [N, A] = f([]), [M, E] = f([]), [d, g] = f({});
66
+ for (const c in l)
67
+ ((o = l[c]) == null ? void 0 : o.fixed) === "left" ? e[c] = l[c] : ((n = l[c]) == null ? void 0 : n.fixed) === "right" ? s[c] = l[c] : t[c] = l[c];
68
+ u(e), p(s), x(t);
69
+ }, [l]);
70
+ const [j, I] = f([]), [w, K] = f([]), [a, u] = f({}), [k, z] = f([]), [M, R] = f([]), [h, p] = f({}), [N, A] = f([]), [S, E] = f([]), [d, x] = f({});
71
71
  T(() => {
72
- const e = [], s = [], t = [], n = [], o = [], r = [];
73
- Y.forEach((l) => {
74
- l.fixed === "left" ? (e.push(l), s.push(l.key)) : l.fixed === "right" ? (t.push(l), n.push(l.key)) : (o.push(l), r.push(l.key));
75
- }), H(e), K(s), I(t), v(n), A(o), E(r);
72
+ const e = [], s = [], t = [], o = [], n = [], c = [];
73
+ Y.forEach((i) => {
74
+ i.fixed === "left" ? (e.push(i), s.push(i.key)) : i.fixed === "right" ? (t.push(i), o.push(i.key)) : (n.push(i), c.push(i.key));
75
+ }), I(e), K(s), z(t), R(o), A(n), E(c);
76
76
  }, [Y]);
77
- const he = (e) => {
78
- m(e);
79
- }, de = (e, s) => {
80
- m(e), K(s);
81
- }, fe = (e) => {
77
+ const Z = [...j, ...k], de = Z.length < 8, fe = (e) => {
78
+ u(e);
79
+ }, me = (e, s) => {
80
+ u(e), K(s);
81
+ }, ue = (e) => {
82
82
  p(e);
83
- }, ue = (e, s) => {
84
- p(e), v(s);
85
- }, me = (e) => {
86
- g(e);
87
83
  }, pe = (e, s) => {
88
- g(e), E(s);
89
- }, Z = (e, s, t, n) => {
90
- const o = { ...s[e] };
91
- delete s[e], g({
84
+ p(e), R(s);
85
+ }, xe = (e) => {
86
+ x(e);
87
+ }, ge = (e, s) => {
88
+ x(e), E(s);
89
+ }, _ = (e, s, t, o) => {
90
+ const n = { ...s[e] };
91
+ delete s[e], x({
92
92
  ...d,
93
- [e]: { ...o, fixed: void 0, order: N.length }
93
+ [e]: { ...n, fixed: void 0, order: N.length }
94
94
  });
95
- const r = t.findIndex((C) => C.key === e), l = t.splice(r, 1)[0];
96
- A([...N, { ...l, fixed: void 0 }]);
97
- const x = n.splice(r, 1);
98
- return E([...M, ...x]), { map: s, list: t, keys: n };
99
- }, _ = (e, s, t, n) => {
100
- const o = { ...s[e] };
101
- delete s[e], m({
95
+ const c = t.findIndex((C) => C.key === e), i = t.splice(c, 1)[0];
96
+ A([...N, { ...i, fixed: void 0 }]);
97
+ const g = o.splice(c, 1);
98
+ return E([...S, ...g]), { map: s, list: t, keys: o };
99
+ }, ee = (e, s, t, o) => {
100
+ const n = { ...s[e] };
101
+ delete s[e], u({
102
102
  ...a,
103
- [e]: { ...o, fixed: "left", order: b.length, show: !0 }
103
+ [e]: { ...n, fixed: "left", order: j.length, show: !0 }
104
104
  });
105
- const r = t.findIndex((C) => C.key === e), l = t.splice(r, 1)[0];
106
- H([...b, { ...l, fixed: "left" }]);
107
- const x = n.splice(r, 1);
108
- return K([...k, ...x]), { map: s, list: t, keys: n };
109
- }, ee = (e, s, t, n) => {
110
- const o = { ...s[e] };
105
+ const c = t.findIndex((C) => C.key === e), i = t.splice(c, 1)[0];
106
+ I([...j, { ...i, fixed: "left" }]);
107
+ const g = o.splice(c, 1);
108
+ return K([...w, ...g]), { map: s, list: t, keys: o };
109
+ }, te = (e, s, t, o) => {
110
+ const n = { ...s[e] };
111
111
  delete s[e], p({
112
112
  ...h,
113
113
  [e]: {
114
- ...o,
114
+ ...n,
115
115
  fixed: "right",
116
- order: R.length,
116
+ order: k.length,
117
117
  show: !0
118
118
  }
119
119
  });
120
- const r = t.findIndex((C) => C.key === e), l = t.splice(r, 1)[0];
121
- I([...R, { ...l, fixed: "right" }]);
122
- const x = n.splice(r, 1);
123
- return v([...w, ...x]), { map: s, list: t, keys: n };
120
+ const c = t.findIndex((C) => C.key === e), i = t.splice(c, 1)[0];
121
+ z([...k, { ...i, fixed: "right" }]);
122
+ const g = o.splice(c, 1);
123
+ return R([...M, ...g]), { map: s, list: t, keys: o };
124
124
  }, P = (e, s) => {
125
125
  if (s === "left") {
126
- const { map: t, list: n, keys: o } = Z(
126
+ const { map: t, list: o, keys: n } = _(
127
127
  e,
128
128
  a,
129
- b,
130
- k
129
+ j,
130
+ w
131
131
  );
132
- m({ ...t }), H([...n]), K([...o]);
132
+ u({ ...t }), I([...o]), K([...n]);
133
133
  } else if (s === "center") {
134
- const { map: t, list: n, keys: o } = _(
134
+ const { map: t, list: o, keys: n } = ee(
135
135
  e,
136
136
  d,
137
137
  N,
138
- M
138
+ S
139
139
  );
140
- g({ ...t }), A([...n]), E([...o]);
140
+ x({ ...t }), A([...o]), E([...n]);
141
141
  } else {
142
- const { map: t, list: n, keys: o } = _(
142
+ const { map: t, list: o, keys: n } = ee(
143
143
  e,
144
144
  h,
145
- R,
146
- w
145
+ k,
146
+ M
147
147
  );
148
- p({ ...t }), I([...n]), v([...o]);
148
+ p({ ...t }), z([...o]), R([...n]);
149
149
  }
150
150
  }, $ = (e, s) => {
151
151
  if (s === "left") {
152
- const { map: t, list: n, keys: o } = ee(
152
+ const { map: t, list: o, keys: n } = te(
153
153
  e,
154
154
  a,
155
- b,
156
- k
155
+ j,
156
+ w
157
157
  );
158
- m({ ...t }), H([...n]), K([...o]);
158
+ u({ ...t }), I([...o]), K([...n]);
159
159
  } else if (s === "center") {
160
- const { map: t, list: n, keys: o } = ee(
160
+ const { map: t, list: o, keys: n } = te(
161
161
  e,
162
162
  d,
163
163
  N,
164
- M
164
+ S
165
165
  );
166
- g({ ...t }), A([...n]), E([...o]);
166
+ x({ ...t }), A([...o]), E([...n]);
167
167
  } else {
168
- const { map: t, list: n, keys: o } = Z(
168
+ const { map: t, list: o, keys: n } = _(
169
169
  e,
170
170
  h,
171
- R,
172
- w
171
+ k,
172
+ M
173
173
  );
174
- p({ ...t }), I([...n]), v([...o]);
174
+ p({ ...t }), z([...o]), R([...n]);
175
175
  }
176
- }, ge = ({ target: e }) => {
177
- e.checked ? (m(L(a, "show", !0)), g(L(d, "show", !0)), p(L(h, "show", !0))) : (m(L(a, "show", !1)), g(L(d, "show", !1)), p(L(h, "show", !1)));
178
- }, z = S(() => [...k, ...M, ...w], [k, M, w]), j = S(() => {
179
- var s, t, n;
176
+ }, Ce = ({ target: e }) => {
177
+ e.checked ? (u(v(a, "show", !0)), x(v(d, "show", !0)), p(v(h, "show", !0))) : (u(v(a, "show", !1)), x(v(d, "show", !1)), p(v(h, "show", !1)));
178
+ }, H = b(() => [...w, ...S, ...M], [w, S, M]), L = b(() => {
179
+ var s, t, o;
180
180
  const e = [];
181
- for (const o in a)
182
- (s = a[o]) != null && s.show && e.push(o);
183
- for (const o in d)
184
- (t = d[o]) != null && t.show && e.push(o);
185
- for (const o in h)
186
- (n = h[o]) != null && n.show && e.push(o);
181
+ for (const n in a)
182
+ (s = a[n]) != null && s.show && e.push(n);
183
+ for (const n in d)
184
+ (t = d[n]) != null && t.show && e.push(n);
185
+ for (const n in h)
186
+ (o = h[n]) != null && o.show && e.push(n);
187
187
  return e;
188
- }, [a, d, h]), xe = S(() => z.length === j.length, [z, j]), Ce = S(() => j.length > 0 && j.length < z.length, [j, z]), ye = () => {
189
- const e = Ae({ ...i }, U);
190
- F(e);
188
+ }, [a, d, h]), ye = b(() => H.length === L.length, [H, L]), je = b(() => L.length > 0 && L.length < H.length, [L, H]), we = () => {
189
+ const e = Oe({ ...l }, U);
190
+ D(e);
191
191
  }, ke = () => {
192
- const e = Te(i, ["width"]);
193
- F(e);
192
+ const e = Ae(l, ["width"]);
193
+ D(e);
194
194
  };
195
- return Ke(ce, () => ({
195
+ return Ne(ie, () => ({
196
196
  getLeftSortColumns: () => a,
197
197
  getCenterSortColumns: () => d,
198
198
  getRightSortColumns: () => h,
199
- getCheckedKeys: () => j
200
- })), /* @__PURE__ */ c.jsxs(
201
- O,
199
+ getCheckedKeys: () => L
200
+ })), /* @__PURE__ */ r.jsxs(
201
+ F,
202
202
  {
203
203
  vertical: !0,
204
204
  gap: 8,
205
- style: ae,
206
- ref: D,
205
+ style: he,
206
+ ref: W,
207
207
  className: "columnsSortWrapper",
208
208
  children: [
209
- /* @__PURE__ */ c.jsxs("div", { className: "sortContent", children: [
210
- /* @__PURE__ */ c.jsxs(
211
- O,
209
+ !de && /* @__PURE__ */ r.jsx(
210
+ Le,
211
+ {
212
+ showIcon: !0,
213
+ type: "error",
214
+ message: "固定列过多,将影响表格显示效果",
215
+ description: /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
216
+ /* @__PURE__ */ r.jsxs("div", { children: [
217
+ "当前总固定",
218
+ /* @__PURE__ */ r.jsx("em", { style: { fontSize: 18, color: "red" }, children: Z.length }),
219
+ "列"
220
+ ] }),
221
+ /* @__PURE__ */ r.jsxs("div", { children: [
222
+ "左右总固定项建议不超过",
223
+ /* @__PURE__ */ r.jsx("em", { style: { fontWeight: 600, fontSize: 16 }, children: "7" }),
224
+ "列,且不建议单侧固定项过多"
225
+ ] }),
226
+ /* @__PURE__ */ r.jsx("div", { children: "固定项过多会造成表格显示异常,如部分列不可见或滚动条异常等现象" })
227
+ ] })
228
+ }
229
+ ),
230
+ /* @__PURE__ */ r.jsxs("div", { className: "sortContent", children: [
231
+ /* @__PURE__ */ r.jsxs(
232
+ F,
212
233
  {
213
234
  vertical: !0,
214
235
  className: "sortCard",
215
236
  gap: 6,
216
- style: { height: W },
237
+ style: { height: B },
217
238
  children: [
218
- /* @__PURE__ */ c.jsx(q.Title, { level: 5, className: "title", children: "固定在左侧" }),
219
- /* @__PURE__ */ c.jsx(
239
+ /* @__PURE__ */ r.jsx(q.Title, { level: 5, className: "title", children: "固定在左侧" }),
240
+ /* @__PURE__ */ r.jsx(
220
241
  G,
221
242
  {
222
243
  placement: "left",
223
- dataList: b,
224
- keys: k,
244
+ dataList: j,
245
+ keys: w,
225
246
  columnsMap: a,
226
247
  onLeftClick: P,
227
248
  onRightClick: $,
228
- onChange: he,
229
- onMoveEnd: de
249
+ onChange: fe,
250
+ onMoveEnd: me
230
251
  }
231
252
  )
232
253
  ]
233
254
  }
234
255
  ),
235
- /* @__PURE__ */ c.jsxs(
236
- O,
256
+ /* @__PURE__ */ r.jsxs(
257
+ F,
237
258
  {
238
259
  vertical: !0,
239
260
  className: "sortCard",
240
261
  gap: 6,
241
- style: { height: W },
262
+ style: { height: B },
242
263
  children: [
243
- /* @__PURE__ */ c.jsx(q.Title, { level: 5, className: "title", children: "不固定" }),
244
- /* @__PURE__ */ c.jsx(
264
+ /* @__PURE__ */ r.jsx(q.Title, { level: 5, className: "title", children: "不固定" }),
265
+ /* @__PURE__ */ r.jsx(
245
266
  G,
246
267
  {
247
268
  placement: "center",
248
269
  dataList: N,
249
- keys: M,
270
+ keys: S,
250
271
  columnsMap: d,
251
272
  onLeftClick: P,
252
273
  onRightClick: $,
253
- onChange: me,
254
- onMoveEnd: pe
274
+ onChange: xe,
275
+ onMoveEnd: ge
255
276
  }
256
277
  )
257
278
  ]
258
279
  }
259
280
  ),
260
- /* @__PURE__ */ c.jsxs(
261
- O,
281
+ /* @__PURE__ */ r.jsxs(
282
+ F,
262
283
  {
263
284
  vertical: !0,
264
285
  className: "sortCard",
265
286
  gap: 6,
266
- style: { height: W },
287
+ style: { height: B },
267
288
  children: [
268
- /* @__PURE__ */ c.jsx(q.Title, { level: 5, className: "title", children: "固定在右侧" }),
269
- /* @__PURE__ */ c.jsx(
289
+ /* @__PURE__ */ r.jsx(q.Title, { level: 5, className: "title", children: "固定在右侧" }),
290
+ /* @__PURE__ */ r.jsx(
270
291
  G,
271
292
  {
272
293
  placement: "right",
273
- dataList: R,
274
- keys: w,
294
+ dataList: k,
295
+ keys: M,
275
296
  columnsMap: h,
276
297
  onLeftClick: P,
277
298
  onRightClick: $,
278
- onChange: fe,
279
- onMoveEnd: ue
299
+ onChange: ue,
300
+ onMoveEnd: pe
280
301
  }
281
302
  )
282
303
  ]
283
304
  }
284
305
  )
285
306
  ] }),
286
- /* @__PURE__ */ c.jsxs(
287
- je,
307
+ /* @__PURE__ */ r.jsxs(
308
+ be,
288
309
  {
289
310
  size: 16,
290
311
  align: "end",
@@ -292,35 +313,35 @@ const ze = Le(
292
313
  className: "checkAllAndReset",
293
314
  style: { paddingBottom: 8 },
294
315
  children: [
295
- /* @__PURE__ */ c.jsx(
296
- Se,
316
+ /* @__PURE__ */ r.jsx(
317
+ ve,
297
318
  {
298
- indeterminate: Ce,
299
- checked: xe,
300
- onChange: ge,
301
- children: /* @__PURE__ */ c.jsx("span", { style: { whiteSpace: "nowrap" }, children: "全选" })
319
+ indeterminate: je,
320
+ checked: ye,
321
+ onChange: Ce,
322
+ children: /* @__PURE__ */ r.jsx("span", { style: { whiteSpace: "nowrap" }, children: "全选" })
302
323
  }
303
324
  ),
304
- /* @__PURE__ */ c.jsx(
305
- se,
325
+ /* @__PURE__ */ r.jsx(
326
+ ne,
306
327
  {
307
328
  type: "link",
308
- icon: /* @__PURE__ */ c.jsx(ne, {}),
329
+ icon: /* @__PURE__ */ r.jsx(re, {}),
309
330
  size: "small",
310
- onClick: ye,
331
+ onClick: we,
311
332
  className: Q,
312
- children: /* @__PURE__ */ c.jsx("span", { style: { whiteSpace: "nowrap" }, children: "重置排序和显隐" })
333
+ children: /* @__PURE__ */ r.jsx("span", { style: { whiteSpace: "nowrap" }, children: "重置排序和显隐" })
313
334
  }
314
335
  ),
315
- /* @__PURE__ */ c.jsx(
316
- se,
336
+ /* @__PURE__ */ r.jsx(
337
+ ne,
317
338
  {
318
339
  type: "link",
319
- icon: /* @__PURE__ */ c.jsx(ne, {}),
340
+ icon: /* @__PURE__ */ r.jsx(re, {}),
320
341
  size: "small",
321
342
  onClick: ke,
322
343
  className: Q,
323
- children: /* @__PURE__ */ c.jsx("span", { style: { whiteSpace: "nowrap" }, children: "重置列宽" })
344
+ children: /* @__PURE__ */ r.jsx("span", { style: { whiteSpace: "nowrap" }, children: "重置列宽" })
324
345
  }
325
346
  )
326
347
  ]
@@ -330,7 +351,7 @@ const ze = Le(
330
351
  }
331
352
  );
332
353
  }
333
- ), Xe = Re(ze);
354
+ ), _e = Ee(We);
334
355
  export {
335
- Xe as default
356
+ _e as default
336
357
  };