bitz-react-admin-ui 2.1.7 → 2.1.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.
- package/dist/components/BitzConfigProvider/context.d.ts +6 -0
- package/dist/components/BitzConfigProvider/index.d.ts +2 -0
- package/dist/components/BitzTable/SubTable/index.d.ts +21 -0
- package/dist/components/BitzTable/SubTable/index.mjs +165 -0
- package/dist/components/BitzTable/Table/index.mjs +135 -134
- package/dist/components/BitzTable/ToolBar/ColConfigIcon/ExportConfig/index.mjs +5 -5
- package/dist/components/BitzTable/ToolBar/ColConfigIcon/style.mjs +18 -10
- package/dist/components/BitzTable/ToolBar/ExportIcon/AnyDataTotalLabel.mjs +57 -76
- package/dist/components/BitzTable/ToolBar/ExportIcon/index.mjs +41 -55
- package/dist/components/BitzTable/ToolBar/ExportIcon/styles.d.ts +3 -0
- package/dist/components/BitzTable/ToolBar/ExportIcon/styles.mjs +47 -0
- package/dist/components/BitzTable/ToolBar/index.d.ts +1 -1
- package/dist/components/BitzTable/index.d.ts +2 -0
- package/dist/components/BitzTable/index.mjs +13 -11
- package/dist/components/BitzTableSelect/SelectPopup/getData.mjs +15 -14
- package/dist/components/BitzTableSelect/SelectPopup/index.mjs +82 -80
- package/dist/components/BitzTableSelect/TableCell/index.mjs +25 -23
- package/dist/components/BitzTableSelect/TextBlock/index.mjs +17 -16
- package/dist/components/BitzTableSelect/index.d.ts +1 -0
- package/dist/components/BitzTableSelect/index.mjs +33 -31
- package/dist/style.css +1 -1
- package/dist/utils/WithFluent.mjs +16 -12
- package/package.json +1 -1
|
@@ -26,7 +26,13 @@ export interface TableComponentContextProps {
|
|
|
26
26
|
/** 外观配置的作用域 */
|
|
27
27
|
setStylesScope?: (value: StylesConfigScopeType) => void;
|
|
28
28
|
}
|
|
29
|
+
/** 控制tableSelect的全局行为 */
|
|
30
|
+
export interface TableSelectComponentContextProps {
|
|
31
|
+
/** 默认size */
|
|
32
|
+
defaultSize?: DensitySize;
|
|
33
|
+
}
|
|
29
34
|
export interface BitzConfigProviderContextProps {
|
|
30
35
|
Table?: TableComponentContextProps;
|
|
36
|
+
TableSelect?: TableSelectComponentContextProps;
|
|
31
37
|
}
|
|
32
38
|
export declare const BitzConfigContext: import("react").Context<BitzConfigProviderContextProps>;
|
|
@@ -14,6 +14,8 @@ interface TableConfigBySize {
|
|
|
14
14
|
export interface BitzTableSelectComponentToken {
|
|
15
15
|
/** table与分页组件的纵向间隙距离 */
|
|
16
16
|
tableSpaceBetweenPage?: number;
|
|
17
|
+
/** 控制padding-block */
|
|
18
|
+
paddingBlock?: number;
|
|
17
19
|
/** list背景颜色 移动端 */
|
|
18
20
|
mobileListBgColor?: string;
|
|
19
21
|
/** listItem背景颜色 移动端 */
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { TableProps } from 'antd';
|
|
2
|
+
import { AnyObject } from 'antd/es/_util/type';
|
|
3
|
+
import type { RowClassName } from 'rc-table/es/interface';
|
|
4
|
+
import { BitzTableColumnsType } from '..';
|
|
5
|
+
export interface BitzSubTableProps<RecordType = any> extends Omit<TableProps<RecordType>, 'size' | 'pagination' | 'bordered'> {
|
|
6
|
+
/** table可滚动区域的最大宽高的值 */
|
|
7
|
+
scroll?: {
|
|
8
|
+
x?: number;
|
|
9
|
+
y?: number;
|
|
10
|
+
};
|
|
11
|
+
/** PC端 & 移动端:后端返回的数组数据 */
|
|
12
|
+
dataSource?: RecordType[];
|
|
13
|
+
/** PC端&移动端:自定义的列表参数 */
|
|
14
|
+
columns?: BitzTableColumnsType<RecordType>;
|
|
15
|
+
/** PC&移动端:请求加载状态 */
|
|
16
|
+
loading?: boolean;
|
|
17
|
+
/** 自定义行类名 */
|
|
18
|
+
rowClassName?: RowClassName<RecordType>;
|
|
19
|
+
}
|
|
20
|
+
declare function SubTable<T extends AnyObject>({ dataSource, columns: tableColumns, loading, scroll, components, expandable, rowSelection, ...props }: BitzSubTableProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export default SubTable;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { j as S } from "../../../node_modules/.store/react@18.2.0/node_modules/react/jsx-runtime.mjs";
|
|
2
|
+
import { useContext as q, useRef as it, useMemo as r, useCallback as $ } from "react";
|
|
3
|
+
import { Table as z } from "antd";
|
|
4
|
+
import lt from "../../../node_modules/.store/classnames@2.5.1/node_modules/classnames/index.mjs";
|
|
5
|
+
import { BitzTableContext as ct } from "../Store/index.mjs";
|
|
6
|
+
import ut from "../../../node_modules/.store/ahooks@3.7.11/node_modules/ahooks/es/useSize/index.mjs";
|
|
7
|
+
import mt from "../ActionCol/style.mjs";
|
|
8
|
+
import ht from "../../BitzTheme/index.mjs";
|
|
9
|
+
import dt from "../../../node_modules/.store/antd@5.16.2/node_modules/antd/es/table/ExpandIcon.mjs";
|
|
10
|
+
import "../../../node_modules/.store/antd@5.16.2/node_modules/antd/es/config-provider/index.mjs";
|
|
11
|
+
import ft from "../../../node_modules/.store/antd@5.16.2/node_modules/antd/locale/en_US.mjs";
|
|
12
|
+
import { getColumnsWithTool as bt, loopBuildSkeleton as yt } from "../Table/utils.mjs";
|
|
13
|
+
import { ConfigContext as Ct } from "../../../node_modules/.store/antd@5.16.2/node_modules/antd/es/config-provider/context.mjs";
|
|
14
|
+
const O = [z.SELECTION_COLUMN, z.EXPAND_COLUMN];
|
|
15
|
+
function Nt({
|
|
16
|
+
dataSource: f = [],
|
|
17
|
+
columns: E,
|
|
18
|
+
loading: i = !1,
|
|
19
|
+
scroll: s,
|
|
20
|
+
components: y,
|
|
21
|
+
expandable: l,
|
|
22
|
+
rowSelection: h,
|
|
23
|
+
...a
|
|
24
|
+
}) {
|
|
25
|
+
var A, D;
|
|
26
|
+
const { token: _ } = ht.useToken(), { gap: G } = mt(), { showColumnBorder: U, rowHoverable: V } = q(ct), d = it(null), R = ut((A = d.current) == null ? void 0 : A.nativeElement), C = r(() => {
|
|
27
|
+
let t = (s == null ? void 0 : s.x) ?? 1e3;
|
|
28
|
+
return s != null && s.x ? { x: t, y: s.y || 400 } : s != null && s.y ? { x: t, y: s.y } : { x: t, y: 400 };
|
|
29
|
+
}, [s]), X = () => {
|
|
30
|
+
var n, o;
|
|
31
|
+
const t = (o = (n = d.current) == null ? void 0 : n.nativeElement) == null ? void 0 : o.querySelectorAll(
|
|
32
|
+
"& > .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)"
|
|
33
|
+
), e = [];
|
|
34
|
+
if (t == null || t.forEach((c) => {
|
|
35
|
+
var u;
|
|
36
|
+
e.push(
|
|
37
|
+
((u = c.querySelector("& > .operationCol .actionGroup")) == null ? void 0 : u.clientWidth) || 0
|
|
38
|
+
);
|
|
39
|
+
}), e.length)
|
|
40
|
+
return Math.ceil(Math.max(...e)) + G * 2;
|
|
41
|
+
}, I = () => {
|
|
42
|
+
var u, b, g, x, p;
|
|
43
|
+
const t = (b = (u = d.current) == null ? void 0 : u.nativeElement) == null ? void 0 : b.querySelector(
|
|
44
|
+
".ant-table-body"
|
|
45
|
+
), e = t == null ? void 0 : t.clientWidth, o = ((t == null ? void 0 : t.offsetWidth) || 0) - e > 0, c = (p = (x = (g = d.current) == null ? void 0 : g.nativeElement) == null ? void 0 : x.querySelector(
|
|
46
|
+
".ant-table-cell-scrollbar"
|
|
47
|
+
)) == null ? void 0 : p.offsetWidth;
|
|
48
|
+
return { tbodyWidth: e, scrollbarSize: c, hasScrollBar: o };
|
|
49
|
+
}, F = (t) => {
|
|
50
|
+
var j, K;
|
|
51
|
+
const e = t.length, n = t.filter((m) => m.width), c = n.map((m) => m.width).reduce((m, k) => m + k, 0);
|
|
52
|
+
let u = 0;
|
|
53
|
+
if ((j = d.current) != null && j.nativeElement) {
|
|
54
|
+
const m = window.getComputedStyle((K = d.current) == null ? void 0 : K.nativeElement), k = parseInt(
|
|
55
|
+
m.getPropertyValue("--toolCell-paddingInline")
|
|
56
|
+
);
|
|
57
|
+
u = parseInt(m.getPropertyValue("--fontSize")) + 4 + 2 * k;
|
|
58
|
+
}
|
|
59
|
+
let b = 0;
|
|
60
|
+
h && (b += u), l && (b += u);
|
|
61
|
+
const { tbodyWidth: g } = I(), x = parseInt(`${C == null ? void 0 : C.x}`) || 0, p = Math.max(x, g), P = (parseInt(`${p}`) || 0) - c - b;
|
|
62
|
+
return P >= 0 ? P / (e - n.length) : void 0;
|
|
63
|
+
}, { hasScrollBar: B, scrollbarSize: T } = r(() => {
|
|
64
|
+
const { hasScrollBar: t, scrollbarSize: e } = I();
|
|
65
|
+
return {
|
|
66
|
+
hasScrollBar: t,
|
|
67
|
+
scrollbarSize: e
|
|
68
|
+
};
|
|
69
|
+
}, [R == null ? void 0 : R.height]), w = r(() => {
|
|
70
|
+
const t = E ?? [], e = t.filter((o) => !O.includes(o));
|
|
71
|
+
F(e);
|
|
72
|
+
const n = e.map((o) => ({
|
|
73
|
+
...o,
|
|
74
|
+
width: o.useMaxWidth ? X() ?? o.width : o.width
|
|
75
|
+
}));
|
|
76
|
+
return bt(t, n, h, l);
|
|
77
|
+
}, [E]), v = r(() => yt(w, O), [w]), H = r(() => i ? v : w, [i, w, v]), N = r(() => {
|
|
78
|
+
const t = f == null ? void 0 : f.length, e = t > 10 ? t >= 20 ? 20 : t : 10;
|
|
79
|
+
return Array.from({ length: e }).map((o, c) => ({
|
|
80
|
+
key: `${Date.now()}${c}`
|
|
81
|
+
}));
|
|
82
|
+
}, [f]), J = r(() => i ? N : f, [i, f, N]), { table: W, locale: Q = ft } = q(Ct), Y = { ...Q.Table }, Z = ((D = W == null ? void 0 : W.expandable) == null ? void 0 : D.expandIcon) || (l == null ? void 0 : l.expandIcon) || dt(Y), L = r(() => {
|
|
83
|
+
if (l)
|
|
84
|
+
return {
|
|
85
|
+
...l,
|
|
86
|
+
expandedRowRender: () => /* @__PURE__ */ S.jsx(S.Fragment, {}),
|
|
87
|
+
expandIcon: (t) => {
|
|
88
|
+
const e = Z(t);
|
|
89
|
+
return {
|
|
90
|
+
...e,
|
|
91
|
+
props: {
|
|
92
|
+
...e.props,
|
|
93
|
+
disabled: !0,
|
|
94
|
+
style: {
|
|
95
|
+
...e.props.style,
|
|
96
|
+
backgroundColor: _.colorBgContainerDisabled
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
}, [l]), tt = r(() => i ? L : l, [i, l, L]), M = r(() => {
|
|
103
|
+
if (h)
|
|
104
|
+
return {
|
|
105
|
+
...h,
|
|
106
|
+
selectedRowKeys: [],
|
|
107
|
+
getCheckboxProps: () => ({ disabled: !0 })
|
|
108
|
+
};
|
|
109
|
+
}, [h]), et = r(() => i ? M : h, [i, h, M]), nt = r(() => i ? void 0 : a.rowKey, [i, a.rowKey]), ot = $(
|
|
110
|
+
(t, e) => {
|
|
111
|
+
var o;
|
|
112
|
+
if (!a.onRow)
|
|
113
|
+
return {};
|
|
114
|
+
const n = (o = a.onRow) == null ? void 0 : o.call(a, t, e);
|
|
115
|
+
return n.onClick && (n.className = "rowPointerCursor"), n;
|
|
116
|
+
},
|
|
117
|
+
[a.onRow]
|
|
118
|
+
), rt = $(
|
|
119
|
+
(t, e, n) => {
|
|
120
|
+
const o = e % 2 === 0 ? "oddRow" : "evenRow";
|
|
121
|
+
if (a.rowClassName) {
|
|
122
|
+
const c = a.rowClassName(t, e, n);
|
|
123
|
+
return lt(o, c);
|
|
124
|
+
}
|
|
125
|
+
return o;
|
|
126
|
+
},
|
|
127
|
+
[a.rowClassName]
|
|
128
|
+
), st = (t) => {
|
|
129
|
+
var n;
|
|
130
|
+
const e = { ...t };
|
|
131
|
+
return e.className.includes("ant-table-cell-fix-right") && !B && ((n = e.style) != null && n.right) && (e.style = {
|
|
132
|
+
...e.style,
|
|
133
|
+
right: e.style.right - (T || 0)
|
|
134
|
+
}), /* @__PURE__ */ S.jsx("th", { ...e });
|
|
135
|
+
}, at = r(() => ({
|
|
136
|
+
...y,
|
|
137
|
+
header: {
|
|
138
|
+
...y == null ? void 0 : y.header,
|
|
139
|
+
cell: st
|
|
140
|
+
}
|
|
141
|
+
}), [y, B, T]);
|
|
142
|
+
return /* @__PURE__ */ S.jsx(
|
|
143
|
+
z,
|
|
144
|
+
{
|
|
145
|
+
...a,
|
|
146
|
+
bordered: U,
|
|
147
|
+
columns: H,
|
|
148
|
+
dataSource: J,
|
|
149
|
+
loading: !1,
|
|
150
|
+
pagination: !1,
|
|
151
|
+
scroll: C,
|
|
152
|
+
expandable: tt,
|
|
153
|
+
rowSelection: et,
|
|
154
|
+
onRow: ot,
|
|
155
|
+
rowClassName: rt,
|
|
156
|
+
components: at,
|
|
157
|
+
rowKey: nt,
|
|
158
|
+
rowHoverable: V,
|
|
159
|
+
ref: d
|
|
160
|
+
}
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
export {
|
|
164
|
+
Nt as default
|
|
165
|
+
};
|