bitz-react-admin-ui 2.7.1 → 2.7.3

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,127 +1,133 @@
1
1
  import { j as C } from "../../../node_modules/.store/react@18.3.1/node_modules/react/jsx-runtime.mjs";
2
- import { useContext as L, useRef as ee, useMemo as o, useCallback as j } from "react";
3
- import { Table as te } from "antd";
4
- import ne from "../../../node_modules/.store/classnames@2.5.1/node_modules/classnames/index.mjs";
5
- import { BitzTableContext as re, toolCols as oe } from "../Store/index.mjs";
6
- import se from "../../../node_modules/.store/ahooks@3.8.0/node_modules/ahooks/es/useSize/index.mjs";
7
- import ae from "../../BitzTheme/index.mjs";
8
- import le from "../../../node_modules/.store/antd@5.18.3/node_modules/antd/es/table/ExpandIcon.mjs";
2
+ import { useContext as L, useRef as tt, useMemo as a, useCallback as j } from "react";
3
+ import { Table as et } from "antd";
4
+ import nt from "../../../node_modules/.store/classnames@2.5.1/node_modules/classnames/index.mjs";
5
+ import { BitzTableContext as rt, toolCols as ot } from "../Store/index.mjs";
6
+ import at from "../../../node_modules/.store/ahooks@3.8.0/node_modules/ahooks/es/useSize/index.mjs";
7
+ import st from "../../BitzTheme/index.mjs";
8
+ import it from "../../../node_modules/.store/antd@5.18.3/node_modules/antd/es/table/ExpandIcon.mjs";
9
9
  import "../../../node_modules/.store/antd@5.18.3/node_modules/antd/es/config-provider/index.mjs";
10
- import ie from "../../../node_modules/.store/antd@5.18.3/node_modules/antd/locale/en_US.mjs";
11
- import { getColumnsWithTool as ce, loopBuildSkeleton as ue } from "../Table/utils.mjs";
12
- import { tablePaddingInline as me } from "../../BitzConfigProvider/context.mjs";
13
- import { ConfigContext as fe } from "../../../node_modules/.store/antd@5.18.3/node_modules/antd/es/config-provider/context.mjs";
14
- function Te({
10
+ import lt from "../../../node_modules/.store/antd@5.18.3/node_modules/antd/locale/en_US.mjs";
11
+ import { getColumnsWithTool as ct, loopBuildSkeleton as ut } from "../Table/utils.mjs";
12
+ import { tablePaddingInline as mt } from "../../BitzConfigProvider/context.mjs";
13
+ import ft from "../../../node_modules/.store/lodash-es@4.17.21/node_modules/lodash-es/omit.mjs";
14
+ import { ConfigContext as ht } from "../../../node_modules/.store/antd@5.18.3/node_modules/antd/es/config-provider/context.mjs";
15
+ function Wt({
15
16
  dataSource: u,
16
17
  columns: g,
17
- loading: l,
18
- scroll: s,
18
+ loading: i,
19
+ scroll: r,
19
20
  components: f,
20
- expandable: i,
21
+ expandable: l,
21
22
  rowSelection: m,
22
- ...a
23
+ ...s
23
24
  }) {
24
25
  var p, W, E;
25
- const { token: x } = ae.useToken(), K = ((p = x.Table) == null ? void 0 : p.cellPaddingInline) ?? me, { showColumnBorder: M, rowHoverable: P } = L(re), h = ee(null), w = se((W = h.current) == null ? void 0 : W.nativeElement), q = o(() => {
26
- let e = (s == null ? void 0 : s.x) ?? 1e3;
27
- return s != null && s.x ? { x: e, y: s.y || 400 } : s != null && s.y ? { x: e, y: s.y } : { x: e, y: 400 };
28
- }, [s]), A = () => {
29
- var r, n;
30
- const e = (n = (r = h.current) == null ? void 0 : r.nativeElement) == null ? void 0 : n.querySelectorAll(
26
+ const { token: x } = st.useToken(), K = ((p = x.Table) == null ? void 0 : p.cellPaddingInline) ?? mt, { showColumnBorder: M, rowHoverable: P } = L(rt), h = tt(null), w = at((W = h.current) == null ? void 0 : W.nativeElement), q = a(() => {
27
+ if (r != null && r.auto)
28
+ return {
29
+ ...ft(r, "auto"),
30
+ x: void 0
31
+ };
32
+ let t = (r == null ? void 0 : r.x) ?? 1e3;
33
+ return r != null && r.x ? { x: t, y: r.y || 400 } : r != null && r.y ? { x: t, y: r.y } : { x: t, y: 400 };
34
+ }, [r]), A = () => {
35
+ var o, n;
36
+ const t = (n = (o = h.current) == null ? void 0 : o.nativeElement) == null ? void 0 : n.querySelectorAll(
31
37
  "& > .bitzTableContainerBody > .ant-table-wrapper.bitzTable > .ant-spin-nested-loading > .ant-spin-container > .ant-table > .ant-table-container > .ant-table-body > table > .ant-table-tbody > tr:not(.ant-table-measure-row, .ant-table-expanded-row)"
32
- ), t = [];
33
- if (e == null || e.forEach((c) => {
38
+ ), e = [];
39
+ if (t == null || t.forEach((c) => {
34
40
  var b;
35
- t.push(
41
+ e.push(
36
42
  ((b = c.querySelector("& > .operationCol .actionGroup")) == null ? void 0 : b.clientWidth) || 0
37
43
  );
38
- }), t.length)
39
- return Math.ceil(Math.max(...t)) + K * 2;
44
+ }), e.length)
45
+ return Math.ceil(Math.max(...e)) + K * 2;
40
46
  }, $ = () => {
41
- var b, I, v, N, D;
42
- const e = (I = (b = h.current) == null ? void 0 : b.nativeElement) == null ? void 0 : I.querySelector(
47
+ var b, v, I, N, D;
48
+ const t = (v = (b = h.current) == null ? void 0 : b.nativeElement) == null ? void 0 : v.querySelector(
43
49
  ".ant-table-body"
44
- ), t = e == null ? void 0 : e.clientWidth, n = ((e == null ? void 0 : e.offsetWidth) || 0) - t > 0, c = (D = (N = (v = h.current) == null ? void 0 : v.nativeElement) == null ? void 0 : N.querySelector(
50
+ ), e = t == null ? void 0 : t.clientWidth, n = ((t == null ? void 0 : t.offsetWidth) || 0) - e > 0, c = (D = (N = (I = h.current) == null ? void 0 : I.nativeElement) == null ? void 0 : N.querySelector(
45
51
  ".ant-table-cell-scrollbar"
46
52
  )) == null ? void 0 : D.offsetWidth;
47
- return { tbodyWidth: t, scrollbarSize: c, hasScrollBar: n };
48
- }, { hasScrollBar: R, scrollbarSize: k } = o(() => {
49
- const { hasScrollBar: e, scrollbarSize: t } = $();
53
+ return { tbodyWidth: e, scrollbarSize: c, hasScrollBar: n };
54
+ }, { hasScrollBar: R, scrollbarSize: k } = a(() => {
55
+ const { hasScrollBar: t, scrollbarSize: e } = $();
50
56
  return {
51
- hasScrollBar: e,
52
- scrollbarSize: t
57
+ hasScrollBar: t,
58
+ scrollbarSize: e
53
59
  };
54
- }, [w == null ? void 0 : w.height]), d = o(() => {
55
- const e = g ?? [], r = e.filter((n) => !oe.includes(n)).map((n) => ({
60
+ }, [w == null ? void 0 : w.height]), d = a(() => {
61
+ const t = g ?? [], o = t.filter((n) => !ot.includes(n)).map((n) => ({
56
62
  ...n,
57
63
  width: n.useMaxWidth ? A() ?? n.width : n.width
58
64
  }));
59
- return ce(
60
- e,
61
- r,
65
+ return ct(
66
+ t,
67
+ o,
62
68
  !1,
63
69
  !!m,
64
- !!i
70
+ !!l
65
71
  );
66
- }, [g]), S = o(() => ue(d), [d]), F = o(() => l ? S : d, [l, d, S]), z = o(() => {
67
- const e = (u == null ? void 0 : u.length) ?? 0, t = e > 4 ? e >= 8 ? 8 : e : 4;
68
- return Array.from({ length: t }).map((n, c) => ({
72
+ }, [g]), S = a(() => ut(d), [d]), F = a(() => i ? S : d, [i, d, S]), z = a(() => {
73
+ const t = (u == null ? void 0 : u.length) ?? 0, e = t > 4 ? t >= 8 ? 8 : t : 4;
74
+ return Array.from({ length: e }).map((n, c) => ({
69
75
  key: `${Date.now()}${c}`
70
76
  }));
71
- }, [u]), G = o(() => l ? z : u, [l, u, z]), { table: y, locale: H = ie } = L(fe), _ = { ...H.Table }, J = ((E = y == null ? void 0 : y.expandable) == null ? void 0 : E.expandIcon) || (i == null ? void 0 : i.expandIcon) || le(_), B = o(() => {
72
- if (i)
77
+ }, [u]), G = a(() => i ? z : u, [i, u, z]), { table: y, locale: H = lt } = L(ht), _ = { ...H.Table }, J = ((E = y == null ? void 0 : y.expandable) == null ? void 0 : E.expandIcon) || (l == null ? void 0 : l.expandIcon) || it(_), B = a(() => {
78
+ if (l)
73
79
  return {
74
- ...i,
80
+ ...l,
75
81
  expandedRowRender: () => /* @__PURE__ */ C.jsx(C.Fragment, {}),
76
- expandIcon: (e) => {
77
- const t = J(e);
82
+ expandIcon: (t) => {
83
+ const e = J(t);
78
84
  return {
79
- ...t,
85
+ ...e,
80
86
  props: {
81
- ...t.props,
87
+ ...e.props,
82
88
  disabled: !0,
83
89
  style: {
84
- ...t.props.style,
90
+ ...e.props.style,
85
91
  backgroundColor: x.colorBgContainerDisabled
86
92
  }
87
93
  }
88
94
  };
89
95
  }
90
96
  };
91
- }, [i]), O = o(() => l ? B : i, [l, i, B]), T = o(() => {
97
+ }, [l]), O = a(() => i ? B : l, [i, l, B]), T = a(() => {
92
98
  if (m)
93
99
  return {
94
100
  ...m,
95
101
  selectedRowKeys: [],
96
102
  getCheckboxProps: () => ({ disabled: !0 })
97
103
  };
98
- }, [m]), Q = o(() => l ? T : m, [l, m, T]), U = o(() => l ? void 0 : a.rowKey, [l, a.rowKey]), V = j(
99
- (e, t) => {
104
+ }, [m]), Q = a(() => i ? T : m, [i, m, T]), U = a(() => i ? void 0 : s.rowKey, [i, s.rowKey]), V = j(
105
+ (t, e) => {
100
106
  var n;
101
- if (!a.onRow)
107
+ if (!s.onRow)
102
108
  return {};
103
- const r = (n = a.onRow) == null ? void 0 : n.call(a, e, t);
104
- return r.onClick && (r.className = "rowPointerCursor"), r;
109
+ const o = (n = s.onRow) == null ? void 0 : n.call(s, t, e);
110
+ return o.onClick && (o.className = "rowPointerCursor"), o;
105
111
  },
106
- [a.onRow]
112
+ [s.onRow]
107
113
  ), X = j(
108
- (e, t, r) => {
109
- const n = t % 2 === 0 ? "oddRow" : "evenRow";
110
- if (a.rowClassName) {
111
- const c = a.rowClassName(e, t, r);
112
- return ne(n, c);
114
+ (t, e, o) => {
115
+ const n = e % 2 === 0 ? "oddRow" : "evenRow";
116
+ if (s.rowClassName) {
117
+ const c = s.rowClassName(t, e, o);
118
+ return nt(n, c);
113
119
  }
114
120
  return n;
115
121
  },
116
- [a.rowClassName]
117
- ), Y = (e) => {
118
- var r;
119
- const t = { ...e };
120
- return t.className.includes("ant-table-cell-fix-right") && !R && ((r = t.style) != null && r.right) && (t.style = {
121
- ...t.style,
122
- right: t.style.right - (k || 0)
123
- }), /* @__PURE__ */ C.jsx("th", { ...t });
124
- }, Z = o(() => ({
122
+ [s.rowClassName]
123
+ ), Y = (t) => {
124
+ var o;
125
+ const e = { ...t };
126
+ return e.className.includes("ant-table-cell-fix-right") && !R && ((o = e.style) != null && o.right) && (e.style = {
127
+ ...e.style,
128
+ right: e.style.right - (k || 0)
129
+ }), /* @__PURE__ */ C.jsx("th", { ...e });
130
+ }, Z = a(() => ({
125
131
  ...f,
126
132
  header: {
127
133
  ...f == null ? void 0 : f.header,
@@ -129,9 +135,9 @@ function Te({
129
135
  }
130
136
  }), [f, R, k]);
131
137
  return /* @__PURE__ */ C.jsx(
132
- te,
138
+ et,
133
139
  {
134
- ...a,
140
+ ...s,
135
141
  bordered: M,
136
142
  columns: F,
137
143
  dataSource: G,
@@ -150,5 +156,5 @@ function Te({
150
156
  );
151
157
  }
152
158
  export {
153
- Te as default
159
+ Wt as default
154
160
  };