@hkyhy/marsun-components-core 0.1.78 → 0.1.81
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/DispositionBar/index.d.ts +17 -0
- package/dist/components/DispositionBar/index.js +37 -0
- package/dist/components/DispositionBar/index.js.map +1 -0
- package/dist/components/DispositionBar/style.module.scss.js +11 -0
- package/dist/components/DispositionBar/style.module.scss.js.map +1 -0
- package/dist/components/Navigation/DrillNav/index.d.ts +24 -0
- package/dist/components/Navigation/DrillNav/index.js +70 -0
- package/dist/components/Navigation/DrillNav/index.js.map +1 -0
- package/dist/components/Navigation/DrillNav/style.module.scss.js +17 -0
- package/dist/components/Navigation/DrillNav/style.module.scss.js.map +1 -0
- package/dist/components/Navigation/index.d.ts +2 -0
- package/dist/components/Stat/StatCard/index.d.ts +14 -2
- package/dist/components/Stat/StatCard/index.js +48 -35
- package/dist/components/Stat/StatCard/index.js.map +1 -1
- package/dist/components/Stat/StatCard/style.module.scss.js +5 -3
- package/dist/components/Stat/StatCard/style.module.scss.js.map +1 -1
- package/dist/components/Stat/StatCardList.js +22 -13
- package/dist/components/Stat/StatCardList.js.map +1 -1
- package/dist/components/Stat/StatCardList.module.scss.js +7 -0
- package/dist/components/Stat/StatCardList.module.scss.js.map +1 -0
- package/dist/components/Stat/index.d.ts +2 -2
- package/dist/components/Table/ResizableHeaderCell.d.ts +17 -0
- package/dist/components/Table/ResizableHeaderCell.js +70 -0
- package/dist/components/Table/ResizableHeaderCell.js.map +1 -0
- package/dist/components/Table/Table.d.ts +8 -2
- package/dist/components/Table/Table.js +458 -290
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/Table/columnConfigUtils.d.ts +25 -2
- package/dist/components/Table/columnConfigUtils.js +224 -116
- package/dist/components/Table/columnConfigUtils.js.map +1 -1
- package/dist/components/Table/index.d.ts +1 -1
- package/dist/components/Table/style.module.scss.js +36 -30
- package/dist/components/Table/style.module.scss.js.map +1 -1
- package/dist/components/index.d.ts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +707 -693
- package/dist/index.js.map +1 -1
- package/dist/marsun-components-core.css +1 -1
- package/dist/styles/global.css +1 -1
- package/package.json +1 -1
|
@@ -1,274 +1,415 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Space as
|
|
3
|
-
import
|
|
4
|
-
import { forwardRef as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import { jsx as y, jsxs as et } from "react/jsx-runtime";
|
|
2
|
+
import { Space as ve, Button as kt, Tooltip as Ut, Table as _e } from "antd";
|
|
3
|
+
import at from "classnames";
|
|
4
|
+
import { forwardRef as Pe, useImperativeHandle as Ie, useMemo as x, useRef as yt, useState as tt, useEffect as gt, useCallback as z } from "react";
|
|
5
|
+
import { flushSync as Ee } from "react-dom";
|
|
6
|
+
import Mt from "./columnConfig.module.scss.js";
|
|
7
|
+
import { ColumnConfigTrigger as Te } from "./ColumnConfigPanel.js";
|
|
8
|
+
import { COLUMN_RESIZE_MAX_WIDTH as Ae, COLUMN_RESIZE_MIN_WIDTH as Ne, columnsLeafPathSignature as je, applyColumnConfig as ke, applyLeafWidthOverrides as Ft, columnsToPanelItems as Me, copyColumnWidths as Fe, columnsToConfig as Dt, clampColumnWidth as St, setColumnWidthAtPath as De, clearColumnWidthAtPath as Be, hideColumnAtPath as Ue, configHasLeafWidths as $e, FLEX_SPACER_COL_KEY as Ge, COLUMN_CONFIG_COL_KEY as qe, isInternalColumnKey as Ct, shortChildId as $t } from "./columnConfigUtils.js";
|
|
9
|
+
import Xe from "./ResizableHeaderCell.js";
|
|
10
|
+
import p from "./style.module.scss.js";
|
|
11
|
+
import { emptyTablePrefs as Ze } from "./tablePrefsTypes.js";
|
|
12
|
+
import { normalizeHiddenRowKeys as Wt, mergeTablePrefs as lt, applyHiddenRows as Ye } from "./tablePrefsUtils.js";
|
|
13
|
+
import { parseTablePrefs as Hn, serializeTablePrefs as On } from "./tablePrefsUtils.js";
|
|
14
|
+
import { useTableFetch as Je } from "./useTableFetch.js";
|
|
15
|
+
import { useMarsunFetch as Qe } from "../../provider/context.js";
|
|
16
|
+
import Bt from "../Empty/Empty.js";
|
|
17
|
+
import { Eye as Gt } from "../Icons/Eye.js";
|
|
18
|
+
const Ve = { x: "max-content" }, G = 40, we = 64;
|
|
19
|
+
function Ke(i) {
|
|
20
|
+
return `共 ${i} 项`;
|
|
20
21
|
}
|
|
21
|
-
function
|
|
22
|
-
var
|
|
23
|
-
if (!(
|
|
24
|
-
let
|
|
25
|
-
for (const
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
28
|
-
if ((
|
|
29
|
-
|
|
22
|
+
function qt(i) {
|
|
23
|
+
var f;
|
|
24
|
+
if (!(i != null && i.length)) return 0;
|
|
25
|
+
let l = 0;
|
|
26
|
+
for (const o of i) {
|
|
27
|
+
const a = o.key != null ? String(o.key) : "";
|
|
28
|
+
if (a && Ct(a)) continue;
|
|
29
|
+
if ((f = o.children) != null && f.length) {
|
|
30
|
+
l += qt(o.children);
|
|
30
31
|
continue;
|
|
31
32
|
}
|
|
32
|
-
const
|
|
33
|
-
typeof
|
|
33
|
+
const c = o.width;
|
|
34
|
+
typeof c == "number" && Number.isFinite(c) && c > 0 ? l += c : l += we;
|
|
34
35
|
}
|
|
35
|
-
return
|
|
36
|
+
return l;
|
|
36
37
|
}
|
|
37
|
-
function
|
|
38
|
-
return
|
|
38
|
+
function Xt(i, l) {
|
|
39
|
+
return i.key != null && String(i.key) !== "" ? String(i.key) : i.dataIndex != null ? Array.isArray(i.dataIndex) ? i.dataIndex.join(".") : String(i.dataIndex) : `__col_${l}`;
|
|
39
40
|
}
|
|
40
|
-
function
|
|
41
|
-
if (typeof
|
|
42
|
-
if (typeof
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
41
|
+
function tn(i, l, f) {
|
|
42
|
+
if (typeof f == "function") return String(f(i, l));
|
|
43
|
+
if (typeof f == "string" && f) {
|
|
44
|
+
const o = i[f];
|
|
45
|
+
if (o != null && o !== "") return String(o);
|
|
45
46
|
}
|
|
46
|
-
return String(
|
|
47
|
+
return String(l);
|
|
47
48
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const
|
|
54
|
-
if (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
49
|
+
function Zt(i, l, f, o = []) {
|
|
50
|
+
return i.map((a, c) => {
|
|
51
|
+
var b;
|
|
52
|
+
const _ = Xt(a, c);
|
|
53
|
+
if (Ct(_)) return a;
|
|
54
|
+
const d = f ? $t(f, _) : _, O = [...o, d], u = a.onHeaderCell;
|
|
55
|
+
if ((b = a.children) != null && b.length)
|
|
56
|
+
return {
|
|
57
|
+
...a,
|
|
58
|
+
children: Zt(
|
|
59
|
+
a.children,
|
|
60
|
+
l,
|
|
61
|
+
_,
|
|
62
|
+
O
|
|
63
|
+
)
|
|
64
|
+
};
|
|
65
|
+
const q = O.join("/"), P = l.widthByPath[q] ?? (typeof a.width == "number" && Number.isFinite(a.width) ? a.width : void 0);
|
|
66
|
+
return {
|
|
67
|
+
...a,
|
|
68
|
+
onHeaderCell: (C) => ({
|
|
69
|
+
...typeof u == "function" ? u(C) : u || {},
|
|
70
|
+
"data-marsun-col-path": q,
|
|
71
|
+
width: P,
|
|
72
|
+
minWidth: l.minWidth,
|
|
73
|
+
maxWidth: l.maxWidth,
|
|
74
|
+
onResizeStart: () => l.onResizeStartPath(O),
|
|
75
|
+
onResize: (I) => l.onResizePath(O, I),
|
|
76
|
+
onResizeStop: (I) => l.onResizeStopPath(O, I),
|
|
77
|
+
onReset: () => l.onResetPath(O)
|
|
78
|
+
})
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
const en = 6;
|
|
83
|
+
function Yt(i, l, f, o = [], a = 0, c) {
|
|
84
|
+
let _ = 0;
|
|
85
|
+
return i.map((d, O) => {
|
|
86
|
+
var g, N;
|
|
87
|
+
const u = Xt(d, O);
|
|
88
|
+
if (Ct(u)) return d;
|
|
89
|
+
const q = f ? $t(f, u) : u, P = [...o, q], b = d.onHeaderCell;
|
|
90
|
+
let C = c;
|
|
91
|
+
a === 0 && (C = (g = d.children) != null && g.length ? _++ : void 0);
|
|
92
|
+
const B = C == null ? void 0 : a === 0 ? p.headerDepth0 : a === 1 ? p.headerDepth1 : p.headerDepth2, I = C == null ? void 0 : p[`headerGroup${C % en}`], U = /* @__PURE__ */ et("span", { className: p.headerTitleWithEye, children: [
|
|
93
|
+
/* @__PURE__ */ y("span", { className: p.headerTitleText, children: d.title }),
|
|
94
|
+
/* @__PURE__ */ y(Ut, { title: "隐藏此列", children: /* @__PURE__ */ y(
|
|
61
95
|
"button",
|
|
62
96
|
{
|
|
63
97
|
type: "button",
|
|
64
|
-
className:
|
|
98
|
+
className: p.headerEyeBtn,
|
|
65
99
|
"aria-label": "隐藏此列",
|
|
66
|
-
onClick: (
|
|
67
|
-
|
|
100
|
+
onClick: (j) => {
|
|
101
|
+
j.stopPropagation(), l(P);
|
|
68
102
|
},
|
|
69
|
-
children: /* @__PURE__ */
|
|
103
|
+
children: /* @__PURE__ */ y(Gt, { size: 12 })
|
|
70
104
|
}
|
|
71
105
|
) })
|
|
72
|
-
] }),
|
|
73
|
-
const
|
|
106
|
+
] }), L = (j) => {
|
|
107
|
+
const X = typeof b == "function" ? b(j) : b || {};
|
|
74
108
|
return {
|
|
75
|
-
...
|
|
76
|
-
className:
|
|
109
|
+
...X,
|
|
110
|
+
className: at(X.className, I, B)
|
|
77
111
|
};
|
|
78
112
|
};
|
|
79
|
-
return (
|
|
80
|
-
...
|
|
81
|
-
title:
|
|
82
|
-
onHeaderCell:
|
|
83
|
-
children:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
113
|
+
return (N = d.children) != null && N.length ? {
|
|
114
|
+
...d,
|
|
115
|
+
title: U,
|
|
116
|
+
onHeaderCell: L,
|
|
117
|
+
children: Yt(
|
|
118
|
+
d.children,
|
|
119
|
+
l,
|
|
120
|
+
u,
|
|
121
|
+
P,
|
|
122
|
+
a + 1,
|
|
123
|
+
C
|
|
90
124
|
)
|
|
91
125
|
} : {
|
|
92
|
-
...
|
|
93
|
-
title:
|
|
94
|
-
onHeaderCell:
|
|
126
|
+
...d,
|
|
127
|
+
title: U,
|
|
128
|
+
onHeaderCell: L
|
|
95
129
|
};
|
|
96
130
|
});
|
|
97
131
|
}
|
|
98
|
-
function
|
|
99
|
-
className:
|
|
100
|
-
style:
|
|
101
|
-
scroll:
|
|
102
|
-
pagination:
|
|
103
|
-
locale:
|
|
104
|
-
columns:
|
|
105
|
-
dataSource:
|
|
106
|
-
rowKey:
|
|
107
|
-
loading:
|
|
108
|
-
tableName:
|
|
109
|
-
columnConfigEnabled:
|
|
110
|
-
fetchColumnConfig:
|
|
111
|
-
saveColumnConfig:
|
|
112
|
-
onColumnConfigChange:
|
|
113
|
-
fetchTablePrefs:
|
|
114
|
-
saveTablePrefs:
|
|
115
|
-
onTablePrefsChange:
|
|
116
|
-
rowConfigEnabled:
|
|
117
|
-
lockedRowKeys:
|
|
118
|
-
hiddenRowKeys:
|
|
119
|
-
onHiddenRowKeysChange:
|
|
120
|
-
rowHideSelectedKeys:
|
|
121
|
-
rowConfigToolbar:
|
|
122
|
-
rowSelection:
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
132
|
+
function nn({
|
|
133
|
+
className: i,
|
|
134
|
+
style: l,
|
|
135
|
+
scroll: f,
|
|
136
|
+
pagination: o,
|
|
137
|
+
locale: a,
|
|
138
|
+
columns: c,
|
|
139
|
+
dataSource: _,
|
|
140
|
+
rowKey: d,
|
|
141
|
+
loading: O,
|
|
142
|
+
tableName: u,
|
|
143
|
+
columnConfigEnabled: q,
|
|
144
|
+
fetchColumnConfig: P,
|
|
145
|
+
saveColumnConfig: b,
|
|
146
|
+
onColumnConfigChange: C,
|
|
147
|
+
fetchTablePrefs: B,
|
|
148
|
+
saveTablePrefs: I,
|
|
149
|
+
onTablePrefsChange: U,
|
|
150
|
+
rowConfigEnabled: L = !1,
|
|
151
|
+
lockedRowKeys: g,
|
|
152
|
+
hiddenRowKeys: N,
|
|
153
|
+
onHiddenRowKeysChange: j,
|
|
154
|
+
rowHideSelectedKeys: X,
|
|
155
|
+
rowConfigToolbar: nt,
|
|
156
|
+
rowSelection: R,
|
|
157
|
+
columnResizeEnabled: Jt,
|
|
158
|
+
columnResizeMinWidth: Qt = Ne,
|
|
159
|
+
columnResizeMaxWidth: Vt = Ae,
|
|
160
|
+
fetchData: wt,
|
|
161
|
+
fetchUrl: Kt,
|
|
162
|
+
fetchOptions: te,
|
|
163
|
+
transformData: ee,
|
|
164
|
+
fetchParams: ne,
|
|
165
|
+
enabled: re = !0,
|
|
166
|
+
defaultPageSize: se = 20,
|
|
167
|
+
onFetched: ie,
|
|
168
|
+
components: Z,
|
|
169
|
+
...le
|
|
170
|
+
}, ae) {
|
|
171
|
+
var jt;
|
|
172
|
+
const ot = Qe(), {
|
|
173
|
+
fetchMode: ct,
|
|
174
|
+
rows: oe,
|
|
175
|
+
total: ce,
|
|
176
|
+
loading: ue,
|
|
177
|
+
error: xt,
|
|
178
|
+
currentPage: de,
|
|
179
|
+
pageSize: he,
|
|
180
|
+
setPage: fe,
|
|
181
|
+
reload: zt
|
|
182
|
+
} = Je({
|
|
183
|
+
dataSource: _,
|
|
184
|
+
fetchData: wt,
|
|
185
|
+
fetchUrl: Kt,
|
|
186
|
+
fetchOptions: te,
|
|
187
|
+
transformData: ee,
|
|
188
|
+
fetchParams: ne,
|
|
189
|
+
enabled: re,
|
|
190
|
+
defaultPageSize: se,
|
|
191
|
+
baseUrl: ot.baseUrl,
|
|
192
|
+
defaultHeaders: ot.headers,
|
|
193
|
+
timeoutMs: ot.timeoutMs,
|
|
194
|
+
onFetched: ie
|
|
157
195
|
});
|
|
158
|
-
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
196
|
+
Ie(ae, () => ({ reload: zt }), [zt]);
|
|
197
|
+
const ut = ct ? oe : _, me = !!O || ct && ue, k = q ?? !!u, v = Jt ?? !!u, E = Qt, T = Vt, Y = x(
|
|
198
|
+
() => ({ minWidth: E, maxWidth: T }),
|
|
199
|
+
[E, T]
|
|
200
|
+
), rt = yt(c), dt = yt(null), [s, st] = tt(null), [Ht, pe] = tt(!1), [ht, ft] = tt(!k), [Ot, ye] = tt([]), [M, Q] = tt({}), $ = yt(M);
|
|
201
|
+
$.current = M, gt(() => {
|
|
202
|
+
rt.current = c;
|
|
203
|
+
}, [c]);
|
|
204
|
+
const ge = x(
|
|
205
|
+
() => je(c || []),
|
|
206
|
+
[c]
|
|
207
|
+
);
|
|
208
|
+
gt(() => {
|
|
209
|
+
Q({}), $.current = {};
|
|
210
|
+
}, [ge]), gt(() => {
|
|
211
|
+
if (!k && !v || !u || !(B || P)) {
|
|
212
|
+
ft(!0);
|
|
165
213
|
return;
|
|
166
214
|
}
|
|
167
215
|
let t = !1;
|
|
168
|
-
return
|
|
169
|
-
var
|
|
216
|
+
return ft(!1), (async () => {
|
|
217
|
+
var n;
|
|
170
218
|
try {
|
|
171
|
-
if (
|
|
172
|
-
const
|
|
173
|
-
t ||
|
|
174
|
-
} else if (
|
|
175
|
-
const
|
|
176
|
-
t ||
|
|
219
|
+
if (B) {
|
|
220
|
+
const r = await B(u);
|
|
221
|
+
t || st((n = r == null ? void 0 : r.columns) != null && n.length ? r : null);
|
|
222
|
+
} else if (P) {
|
|
223
|
+
const r = await P(u);
|
|
224
|
+
t || st(r != null && r.length ? Ze(r) : null);
|
|
177
225
|
}
|
|
178
226
|
} catch {
|
|
179
|
-
t ||
|
|
227
|
+
t || st(null);
|
|
180
228
|
} finally {
|
|
181
|
-
t ||
|
|
229
|
+
t || ft(!0);
|
|
182
230
|
}
|
|
183
231
|
})(), () => {
|
|
184
232
|
t = !0;
|
|
185
233
|
};
|
|
186
|
-
}, [
|
|
187
|
-
const
|
|
234
|
+
}, [k, v, u, B, P]);
|
|
235
|
+
const A = (jt = s == null ? void 0 : s.columns) != null && jt.length ? s.columns : null, F = x(() => N !== void 0 ? Wt(N, g) : Wt(Ot, g), [N, Ot, g]), J = z(
|
|
188
236
|
(t) => {
|
|
189
|
-
const
|
|
190
|
-
|
|
237
|
+
const e = Wt(t, g);
|
|
238
|
+
N === void 0 && ye(e), j == null || j(e);
|
|
191
239
|
},
|
|
192
|
-
[
|
|
193
|
-
),
|
|
240
|
+
[N, g, j]
|
|
241
|
+
), D = z(
|
|
194
242
|
async (t) => {
|
|
195
|
-
if (
|
|
196
|
-
await
|
|
243
|
+
if (st(t), U == null || U(t), C == null || C(t.columns), u && I) {
|
|
244
|
+
await I(u, t);
|
|
197
245
|
return;
|
|
198
246
|
}
|
|
199
|
-
|
|
247
|
+
u && b && await b(u, t.columns);
|
|
200
248
|
},
|
|
201
|
-
[
|
|
202
|
-
),
|
|
203
|
-
const t =
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
249
|
+
[u, I, b, U, C]
|
|
250
|
+
), bt = x(() => {
|
|
251
|
+
const t = c || [];
|
|
252
|
+
let e;
|
|
253
|
+
if (k)
|
|
254
|
+
e = ke(t, A, Y);
|
|
255
|
+
else if (v && (A != null && A.length)) {
|
|
256
|
+
const n = {}, r = (h, S) => {
|
|
257
|
+
var H;
|
|
258
|
+
for (const m of h) {
|
|
259
|
+
const W = S ? `${S}/${m.id}` : m.id;
|
|
260
|
+
typeof m.width == "number" && Number.isFinite(m.width) && (n[W] = m.width), (H = m.children) != null && H.length && r(m.children, W);
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
r(A, ""), e = Ft(t, n, Y);
|
|
264
|
+
} else
|
|
265
|
+
e = t;
|
|
266
|
+
return v && Object.keys(M).length && (e = Ft(e, M, Y)), e;
|
|
267
|
+
}, [c, k, v, A, Y, M]), Lt = x(
|
|
268
|
+
() => Me(
|
|
269
|
+
rt.current || c
|
|
208
270
|
),
|
|
209
271
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- 随 columns 结构变
|
|
210
|
-
[
|
|
211
|
-
),
|
|
272
|
+
[c]
|
|
273
|
+
), Rt = z(
|
|
212
274
|
async (t) => {
|
|
213
|
-
|
|
275
|
+
const e = Fe(t, s == null ? void 0 : s.columns);
|
|
276
|
+
await D(lt(s, { columns: e }));
|
|
277
|
+
},
|
|
278
|
+
[s, D]
|
|
279
|
+
), it = z(() => {
|
|
280
|
+
var t;
|
|
281
|
+
return (t = s == null ? void 0 : s.columns) != null && t.length ? s.columns : Dt(
|
|
282
|
+
rt.current || c
|
|
283
|
+
);
|
|
284
|
+
}, [s, c]), vt = z((t, e) => {
|
|
285
|
+
const n = t.join("/");
|
|
286
|
+
Q((r) => {
|
|
287
|
+
const h = { ...r, [n]: e };
|
|
288
|
+
return $.current = h, h;
|
|
289
|
+
});
|
|
290
|
+
}, []), _t = z(
|
|
291
|
+
(t) => {
|
|
292
|
+
const e = dt.current;
|
|
293
|
+
if (!e) return;
|
|
294
|
+
const n = e.querySelectorAll("[data-marsun-col-path]");
|
|
295
|
+
n.length && Ee(() => {
|
|
296
|
+
Q((r) => {
|
|
297
|
+
const h = { ...r };
|
|
298
|
+
return n.forEach((S) => {
|
|
299
|
+
const H = S.getAttribute("data-marsun-col-path");
|
|
300
|
+
if (!H) return;
|
|
301
|
+
const m = S.offsetWidth;
|
|
302
|
+
m > 0 && (h[H] = St(m, E, T));
|
|
303
|
+
}), $.current = h, h;
|
|
304
|
+
});
|
|
305
|
+
});
|
|
306
|
+
},
|
|
307
|
+
[E, T]
|
|
308
|
+
), Pt = z(
|
|
309
|
+
async (t, e) => {
|
|
310
|
+
const n = t.join("/"), r = St(e, E, T), h = dt.current, S = { ...$.current, [n]: r };
|
|
311
|
+
h && h.querySelectorAll("[data-marsun-col-path]").forEach((m) => {
|
|
312
|
+
const W = m.getAttribute("data-marsun-col-path");
|
|
313
|
+
if (!W || W === n || S[W] != null) return;
|
|
314
|
+
const K = m.offsetWidth;
|
|
315
|
+
K > 0 && (S[W] = St(K, E, T));
|
|
316
|
+
}), S[n] = r, $.current = S, Q(S);
|
|
317
|
+
let H = it();
|
|
318
|
+
for (const [m, W] of Object.entries(S))
|
|
319
|
+
H = De(H, m.split("/"), W, Y);
|
|
320
|
+
await D(lt(s, { columns: H }));
|
|
214
321
|
},
|
|
215
|
-
[
|
|
216
|
-
),
|
|
322
|
+
[it, D, s, T, E, Y]
|
|
323
|
+
), It = z(
|
|
217
324
|
async (t) => {
|
|
218
|
-
|
|
325
|
+
const e = t.join("/");
|
|
326
|
+
Q((r) => {
|
|
327
|
+
if (!(e in r)) return r;
|
|
328
|
+
const h = { ...r };
|
|
329
|
+
return delete h[e], $.current = h, h;
|
|
330
|
+
});
|
|
331
|
+
const n = Be(it(), t);
|
|
332
|
+
await D(lt(s, { columns: n }));
|
|
333
|
+
},
|
|
334
|
+
[it, D, s]
|
|
335
|
+
), Et = z(
|
|
336
|
+
async (t) => {
|
|
337
|
+
var n;
|
|
219
338
|
if (!t.length) return;
|
|
220
|
-
const
|
|
221
|
-
|
|
339
|
+
const e = (n = s == null ? void 0 : s.columns) != null && n.length && s.columns.length ? s.columns : Dt(
|
|
340
|
+
rt.current || c
|
|
222
341
|
);
|
|
223
|
-
await
|
|
342
|
+
await D(lt(s, { columns: Ue(e, t) }));
|
|
224
343
|
},
|
|
225
|
-
[
|
|
226
|
-
),
|
|
227
|
-
const t = (
|
|
228
|
-
t.length &&
|
|
229
|
-
}, [
|
|
230
|
-
|
|
231
|
-
}, [
|
|
344
|
+
[s, c, D]
|
|
345
|
+
), Se = z(() => {
|
|
346
|
+
const t = (X || []).map(String);
|
|
347
|
+
t.length && J([...F, ...t]);
|
|
348
|
+
}, [X, F, J]), We = z(() => {
|
|
349
|
+
J([]);
|
|
350
|
+
}, [J]), Tt = z(
|
|
232
351
|
(t) => {
|
|
233
|
-
const
|
|
234
|
-
|
|
352
|
+
const e = String(t);
|
|
353
|
+
e && ((g || []).map(String).includes(e) || J([...F, e]));
|
|
235
354
|
},
|
|
236
|
-
[
|
|
237
|
-
),
|
|
238
|
-
let t =
|
|
239
|
-
if (
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
355
|
+
[g, F, J]
|
|
356
|
+
), mt = x(() => {
|
|
357
|
+
let t = bt;
|
|
358
|
+
if (k && ht && (t = Yt(t, (n) => {
|
|
359
|
+
Et(n);
|
|
360
|
+
})), v && (t = Zt(t, {
|
|
361
|
+
minWidth: E,
|
|
362
|
+
maxWidth: T,
|
|
363
|
+
widthByPath: M,
|
|
364
|
+
onResizeStartPath: _t,
|
|
365
|
+
onResizePath: vt,
|
|
366
|
+
onResizeStopPath: (n, r) => {
|
|
367
|
+
Pt(n, r);
|
|
368
|
+
},
|
|
369
|
+
onResetPath: (n) => {
|
|
370
|
+
It(n);
|
|
371
|
+
}
|
|
372
|
+
})), v && (Object.keys(M).length > 0 || $e(A))) {
|
|
243
373
|
const n = {
|
|
244
|
-
key:
|
|
245
|
-
|
|
374
|
+
key: Ge,
|
|
375
|
+
title: "",
|
|
376
|
+
className: p.flexSpacerCol,
|
|
377
|
+
onHeaderCell: () => ({ className: p.flexSpacerCol }),
|
|
378
|
+
onCell: () => ({ className: p.flexSpacerCol }),
|
|
379
|
+
render: () => null
|
|
380
|
+
};
|
|
381
|
+
t = [...t, n];
|
|
382
|
+
}
|
|
383
|
+
if (k && ht) {
|
|
384
|
+
const n = {
|
|
385
|
+
key: qe,
|
|
386
|
+
width: G,
|
|
246
387
|
fixed: "right",
|
|
247
388
|
align: "center",
|
|
248
|
-
className:
|
|
389
|
+
className: Mt.configCol,
|
|
249
390
|
onHeaderCell: () => ({
|
|
250
|
-
className:
|
|
391
|
+
className: Mt.configColHeader,
|
|
251
392
|
style: {
|
|
252
|
-
width:
|
|
253
|
-
minWidth:
|
|
254
|
-
maxWidth:
|
|
393
|
+
width: G,
|
|
394
|
+
minWidth: G,
|
|
395
|
+
maxWidth: G
|
|
255
396
|
}
|
|
256
397
|
}),
|
|
257
398
|
onCell: () => ({
|
|
258
399
|
style: {
|
|
259
|
-
width:
|
|
260
|
-
minWidth:
|
|
261
|
-
maxWidth:
|
|
400
|
+
width: G,
|
|
401
|
+
minWidth: G,
|
|
402
|
+
maxWidth: G
|
|
262
403
|
}
|
|
263
404
|
}),
|
|
264
|
-
title: /* @__PURE__ */
|
|
265
|
-
|
|
405
|
+
title: /* @__PURE__ */ y(
|
|
406
|
+
Te,
|
|
266
407
|
{
|
|
267
|
-
open:
|
|
268
|
-
onOpenChange:
|
|
269
|
-
defaultItems:
|
|
270
|
-
savedConfig:
|
|
271
|
-
onConfirm:
|
|
408
|
+
open: Ht,
|
|
409
|
+
onOpenChange: pe,
|
|
410
|
+
defaultItems: Lt,
|
|
411
|
+
savedConfig: A,
|
|
412
|
+
onConfirm: Rt
|
|
272
413
|
}
|
|
273
414
|
),
|
|
274
415
|
render: () => null
|
|
@@ -277,118 +418,145 @@ function He({
|
|
|
277
418
|
}
|
|
278
419
|
return t;
|
|
279
420
|
}, [
|
|
421
|
+
k,
|
|
422
|
+
v,
|
|
423
|
+
ht,
|
|
424
|
+
bt,
|
|
425
|
+
Ht,
|
|
426
|
+
Lt,
|
|
427
|
+
A,
|
|
428
|
+
Rt,
|
|
429
|
+
Et,
|
|
430
|
+
_t,
|
|
431
|
+
vt,
|
|
432
|
+
Pt,
|
|
433
|
+
It,
|
|
434
|
+
E,
|
|
280
435
|
T,
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
nt,
|
|
284
|
-
it,
|
|
285
|
-
B,
|
|
286
|
-
at,
|
|
287
|
-
ct
|
|
288
|
-
]), Zt = L(() => g ? he(Z, x, typeof s == "function" || typeof s == "string" ? s : void 0, o) : Z, [g, Z, x, s, o]), Jt = r === !1 ? !1 : {
|
|
436
|
+
M
|
|
437
|
+
]), Ce = x(() => L ? Ye(ut, F, typeof d == "function" || typeof d == "string" ? d : void 0, g) : ut, [L, ut, F, d, g]), xe = o === !1 ? !1 : {
|
|
289
438
|
showSizeChanger: !0,
|
|
290
|
-
showTotal:
|
|
291
|
-
...
|
|
292
|
-
...
|
|
293
|
-
current:
|
|
294
|
-
pageSize:
|
|
295
|
-
total:
|
|
296
|
-
onChange: (t,
|
|
297
|
-
|
|
439
|
+
showTotal: Ke,
|
|
440
|
+
...o && typeof o == "object" ? o : {},
|
|
441
|
+
...ct ? {
|
|
442
|
+
current: de,
|
|
443
|
+
pageSize: he,
|
|
444
|
+
total: ce,
|
|
445
|
+
onChange: (t, e) => {
|
|
446
|
+
fe(t, e), o && typeof o == "object" && o.onChange && o.onChange(t, e);
|
|
298
447
|
}
|
|
299
448
|
} : null
|
|
300
|
-
},
|
|
301
|
-
...
|
|
302
|
-
emptyText: (
|
|
303
|
-
},
|
|
304
|
-
const
|
|
305
|
-
return
|
|
306
|
-
}),
|
|
307
|
-
|
|
449
|
+
}, ze = {
|
|
450
|
+
...a,
|
|
451
|
+
emptyText: (a == null ? void 0 : a.emptyText) ?? (xt ? /* @__PURE__ */ y(Bt, { iconType: "simple", description: xt.message || "加载失败" }) : /* @__PURE__ */ y(Bt, { iconType: "simple", description: "暂无数据" }))
|
|
452
|
+
}, pt = x(() => new Set((g || []).map(String)), [g]), He = L && (X || []).some((t) => {
|
|
453
|
+
const e = String(t);
|
|
454
|
+
return e && !pt.has(e);
|
|
455
|
+
}), At = L && F.length > 0, Oe = L && nt !== !1 ? /* @__PURE__ */ et(
|
|
456
|
+
ve,
|
|
308
457
|
{
|
|
309
458
|
size: "small",
|
|
310
|
-
className:
|
|
459
|
+
className: at("marsun-table-row-config", p["marsun-table-row-config"]),
|
|
311
460
|
children: [
|
|
312
|
-
/* @__PURE__ */
|
|
313
|
-
/* @__PURE__ */
|
|
461
|
+
/* @__PURE__ */ y(kt, { size: "small", disabled: !He, onClick: Se, children: "隐藏选中行" }),
|
|
462
|
+
/* @__PURE__ */ et(kt, { size: "small", disabled: !At, onClick: We, children: [
|
|
314
463
|
"恢复隐藏行",
|
|
315
|
-
|
|
464
|
+
At ? `(${F.length})` : ""
|
|
316
465
|
] })
|
|
317
466
|
]
|
|
318
467
|
}
|
|
319
|
-
) : null,
|
|
320
|
-
if (!
|
|
321
|
-
const t = typeof
|
|
468
|
+
) : null, Nt = nt === !1 ? null : nt !== void 0 ? nt : Oe, V = x(() => {
|
|
469
|
+
if (!R || !L) return R;
|
|
470
|
+
const t = typeof R.columnWidth == "number" ? R.columnWidth : 48;
|
|
322
471
|
return {
|
|
323
|
-
...
|
|
472
|
+
...R,
|
|
324
473
|
columnWidth: t + 20,
|
|
325
|
-
renderCell: (n,
|
|
326
|
-
var
|
|
327
|
-
const
|
|
328
|
-
return /* @__PURE__ */
|
|
329
|
-
|
|
330
|
-
/* @__PURE__ */
|
|
474
|
+
renderCell: (e, n, r, h) => {
|
|
475
|
+
var K;
|
|
476
|
+
const H = ((K = R.renderCell) == null ? void 0 : K.call(R, e, n, r, h)) ?? h, m = tn(n, r, d), W = pt.has(m);
|
|
477
|
+
return /* @__PURE__ */ et("span", { className: p.rowSelectWithEye, children: [
|
|
478
|
+
H,
|
|
479
|
+
/* @__PURE__ */ y(Ut, { title: W ? "主对标不可隐藏" : "隐藏此行", children: /* @__PURE__ */ y(
|
|
331
480
|
"button",
|
|
332
481
|
{
|
|
333
482
|
type: "button",
|
|
334
|
-
className:
|
|
335
|
-
"aria-label":
|
|
336
|
-
disabled:
|
|
337
|
-
onClick: (
|
|
338
|
-
|
|
483
|
+
className: p.rowEyeBtn,
|
|
484
|
+
"aria-label": W ? "主对标不可隐藏" : "隐藏此行",
|
|
485
|
+
disabled: W,
|
|
486
|
+
onClick: (Re) => {
|
|
487
|
+
Re.stopPropagation(), Tt(m);
|
|
339
488
|
},
|
|
340
|
-
children: /* @__PURE__ */
|
|
489
|
+
children: /* @__PURE__ */ y(Gt, { size: 14 })
|
|
341
490
|
}
|
|
342
491
|
) })
|
|
343
492
|
] });
|
|
344
493
|
}
|
|
345
494
|
};
|
|
346
|
-
}, [
|
|
347
|
-
const t =
|
|
495
|
+
}, [R, L, d, pt, Tt]), w = x(() => {
|
|
496
|
+
const t = qt(mt);
|
|
348
497
|
if (!t) return 0;
|
|
349
|
-
const
|
|
350
|
-
return t +
|
|
351
|
-
}, [
|
|
352
|
-
const t =
|
|
353
|
-
return
|
|
354
|
-
}, [
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
498
|
+
const e = V ? typeof V.columnWidth == "number" ? V.columnWidth : 48 : 0;
|
|
499
|
+
return t + e;
|
|
500
|
+
}, [mt, V]), be = x(() => {
|
|
501
|
+
const t = f === void 0 ? { ...Ve } : { ...f };
|
|
502
|
+
return w > 0 ? { ...t, x: w } : t;
|
|
503
|
+
}, [f, w]), Le = x(() => {
|
|
504
|
+
const t = Z == null ? void 0 : Z.header, e = t && "cell" in t ? t.cell : void 0;
|
|
505
|
+
return v ? {
|
|
506
|
+
...Z,
|
|
507
|
+
header: {
|
|
508
|
+
...t,
|
|
509
|
+
cell: (r) => !(typeof r.onResize == "function") && e ? /* @__PURE__ */ y(e, { ...r }) : /* @__PURE__ */ y(Xe, { ...r })
|
|
510
|
+
}
|
|
511
|
+
} : Z;
|
|
512
|
+
}, [Z, v]);
|
|
513
|
+
return /* @__PURE__ */ et("div", { ref: dt, className: at("marsun-table-shell", p["marsun-table-shell"]), children: [
|
|
514
|
+
Nt ? /* @__PURE__ */ y("div", { className: p["marsun-table-toolbar"], children: Nt }) : null,
|
|
515
|
+
/* @__PURE__ */ y(
|
|
516
|
+
_e,
|
|
359
517
|
{
|
|
360
|
-
className:
|
|
518
|
+
className: at("marsun-table", p["marsun-table"], i),
|
|
361
519
|
style: {
|
|
362
|
-
...
|
|
363
|
-
...
|
|
520
|
+
...l,
|
|
521
|
+
...w > 0 ? { "--marsun-table-scroll-x": `${w}px` } : null
|
|
364
522
|
},
|
|
365
|
-
scroll:
|
|
366
|
-
pagination:
|
|
367
|
-
locale:
|
|
368
|
-
columns:
|
|
369
|
-
dataSource:
|
|
370
|
-
rowKey:
|
|
371
|
-
loading:
|
|
372
|
-
rowSelection:
|
|
373
|
-
|
|
523
|
+
scroll: be,
|
|
524
|
+
pagination: xe,
|
|
525
|
+
locale: ze,
|
|
526
|
+
columns: mt,
|
|
527
|
+
dataSource: Ce,
|
|
528
|
+
rowKey: d,
|
|
529
|
+
loading: me,
|
|
530
|
+
rowSelection: V,
|
|
531
|
+
components: Le,
|
|
532
|
+
...le
|
|
374
533
|
}
|
|
375
534
|
)
|
|
376
535
|
] });
|
|
377
536
|
}
|
|
378
|
-
const
|
|
537
|
+
const Cn = Pe(nn);
|
|
379
538
|
export {
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
539
|
+
qe as COLUMN_CONFIG_COL_KEY,
|
|
540
|
+
Ae as COLUMN_RESIZE_MAX_WIDTH,
|
|
541
|
+
Ne as COLUMN_RESIZE_MIN_WIDTH,
|
|
542
|
+
Ge as FLEX_SPACER_COL_KEY,
|
|
543
|
+
ke as applyColumnConfig,
|
|
544
|
+
Ye as applyHiddenRows,
|
|
545
|
+
Ft as applyLeafWidthOverrides,
|
|
546
|
+
St as clampColumnWidth,
|
|
547
|
+
Be as clearColumnWidthAtPath,
|
|
548
|
+
je as columnsLeafPathSignature,
|
|
549
|
+
Dt as columnsToConfig,
|
|
550
|
+
$e as configHasLeafWidths,
|
|
551
|
+
Fe as copyColumnWidths,
|
|
552
|
+
Cn as default,
|
|
553
|
+
Ze as emptyTablePrefs,
|
|
554
|
+
Ue as hideColumnAtPath,
|
|
555
|
+
Ct as isInternalColumnKey,
|
|
556
|
+
lt as mergeTablePrefs,
|
|
557
|
+
Wt as normalizeHiddenRowKeys,
|
|
558
|
+
Hn as parseTablePrefs,
|
|
559
|
+
On as serializeTablePrefs,
|
|
560
|
+
De as setColumnWidthAtPath
|
|
393
561
|
};
|
|
394
562
|
//# sourceMappingURL=Table.js.map
|