@hkyhy/marsun-components-core 0.1.82 → 0.1.89
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/Table/ResizableHeaderCell.js +37 -38
- package/dist/components/Table/ResizableHeaderCell.js.map +1 -1
- package/dist/components/Table/Table.js +88 -89
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/Table/columnConfigUtils.d.ts +1 -1
- package/dist/components/Table/columnConfigUtils.js.map +1 -1
- package/dist/components/Table/style.module.scss.js +34 -34
- package/dist/marsun-components-core.css +1 -1
- package/dist/styles/global.css +1 -1
- package/package.json +1 -1
|
@@ -1,66 +1,65 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { useRef as
|
|
4
|
-
import { COLUMN_RESIZE_MIN_WIDTH as
|
|
5
|
-
import
|
|
1
|
+
import { jsx as C, jsxs as H } from "react/jsx-runtime";
|
|
2
|
+
import I from "classnames";
|
|
3
|
+
import { useRef as D } from "react";
|
|
4
|
+
import { COLUMN_RESIZE_MIN_WIDTH as x, COLUMN_RESIZE_MAX_WIDTH as X, clampColumnWidth as P } from "./columnConfigUtils.js";
|
|
5
|
+
import N from "./style.module.scss.js";
|
|
6
6
|
function T({
|
|
7
|
-
width:
|
|
8
|
-
minWidth:
|
|
9
|
-
maxWidth:
|
|
7
|
+
width: o,
|
|
8
|
+
minWidth: a = x,
|
|
9
|
+
maxWidth: L = X,
|
|
10
10
|
onResizeStart: n,
|
|
11
11
|
onResize: l,
|
|
12
|
-
onResizeStop:
|
|
13
|
-
onReset:
|
|
12
|
+
onResizeStop: s,
|
|
13
|
+
onReset: u,
|
|
14
14
|
children: i,
|
|
15
15
|
className: f,
|
|
16
|
-
style:
|
|
17
|
-
...
|
|
16
|
+
style: r,
|
|
17
|
+
...d
|
|
18
18
|
}) {
|
|
19
|
-
const
|
|
20
|
-
typeof
|
|
19
|
+
const c = D(null), m = D(
|
|
20
|
+
typeof o == "number" && Number.isFinite(o) ? o : void 0
|
|
21
21
|
);
|
|
22
22
|
if (!l)
|
|
23
|
-
return /* @__PURE__ */
|
|
24
|
-
const
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
m.current =
|
|
23
|
+
return /* @__PURE__ */ C("th", { ...d, className: f, style: r, ref: c, children: i });
|
|
24
|
+
const M = (e) => {
|
|
25
|
+
var y;
|
|
26
|
+
e.preventDefault(), e.stopPropagation(), n == null || n();
|
|
27
|
+
const _ = ((y = c.current) == null ? void 0 : y.offsetWidth) || (typeof o == "number" && Number.isFinite(o) && o > 0 ? o : a), g = e.clientX, p = _;
|
|
28
|
+
m.current = p;
|
|
29
29
|
const v = (t) => {
|
|
30
|
-
const
|
|
31
|
-
m.current =
|
|
30
|
+
const E = P(p + (t.clientX - g), a, L);
|
|
31
|
+
m.current = E, l(E);
|
|
32
32
|
}, b = () => {
|
|
33
33
|
document.removeEventListener("mousemove", v), document.removeEventListener("mouseup", b), document.body.style.cursor = "", document.body.style.userSelect = "";
|
|
34
34
|
const t = m.current;
|
|
35
|
-
typeof t == "number" && (
|
|
35
|
+
typeof t == "number" && (s == null || s(t));
|
|
36
36
|
};
|
|
37
37
|
document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", v), document.addEventListener("mouseup", b);
|
|
38
|
-
},
|
|
39
|
-
...
|
|
40
|
-
|
|
41
|
-
overflow: (e == null ? void 0 : e.overflow) ?? "visible"
|
|
38
|
+
}, W = {
|
|
39
|
+
...r,
|
|
40
|
+
overflow: (r == null ? void 0 : r.overflow) ?? "visible"
|
|
42
41
|
};
|
|
43
|
-
return /* @__PURE__ */
|
|
42
|
+
return /* @__PURE__ */ H(
|
|
44
43
|
"th",
|
|
45
44
|
{
|
|
46
|
-
...
|
|
47
|
-
ref:
|
|
48
|
-
className:
|
|
49
|
-
style:
|
|
45
|
+
...d,
|
|
46
|
+
ref: c,
|
|
47
|
+
className: I(f, N.resizableHeaderCell),
|
|
48
|
+
style: W,
|
|
50
49
|
children: [
|
|
51
50
|
i,
|
|
52
|
-
/* @__PURE__ */
|
|
51
|
+
/* @__PURE__ */ C(
|
|
53
52
|
"span",
|
|
54
53
|
{
|
|
55
54
|
role: "separator",
|
|
56
55
|
"aria-orientation": "vertical",
|
|
57
56
|
"aria-label": "拖拽调整列宽,双击重置",
|
|
58
57
|
title: "拖拽调宽 · 双击重置",
|
|
59
|
-
className:
|
|
60
|
-
onClick: (
|
|
61
|
-
onMouseDown:
|
|
62
|
-
onDoubleClick: (
|
|
63
|
-
|
|
58
|
+
className: N.resizeHandle,
|
|
59
|
+
onClick: (e) => e.stopPropagation(),
|
|
60
|
+
onMouseDown: M,
|
|
61
|
+
onDoubleClick: (e) => {
|
|
62
|
+
e.preventDefault(), e.stopPropagation(), u == null || u();
|
|
64
63
|
}
|
|
65
64
|
}
|
|
66
65
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResizableHeaderCell.js","sources":["../../../src/components/Table/ResizableHeaderCell.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport {\n useRef,\n type MouseEvent as ReactMouseEvent,\n type ReactNode,\n type ThHTMLAttributes,\n} from 'react';\nimport {\n clampColumnWidth,\n COLUMN_RESIZE_MAX_WIDTH,\n COLUMN_RESIZE_MIN_WIDTH,\n} from './columnConfigUtils';\nimport styles from './style.module.scss';\n\nexport type ResizableHeaderCellProps = ThHTMLAttributes<HTMLTableCellElement> & {\n width?: number;\n minWidth?: number;\n maxWidth?: number;\n /** 开始拖拽前调用(用于锁死其它列宽) */\n onResizeStart?: () => void;\n onResize?: (width: number) => void;\n onResizeStop?: (width: number) => void;\n /** 双击把手:清除自定义 width */\n onReset?: () => void;\n children?: ReactNode;\n};\n\n/**\n * antd Table header.cell:表头右缘拖拽调宽;无 onResize 时退化为普通 th。\n */\nexport default function ResizableHeaderCell({\n width,\n minWidth = COLUMN_RESIZE_MIN_WIDTH,\n maxWidth = COLUMN_RESIZE_MAX_WIDTH,\n onResizeStart,\n onResize,\n onResizeStop,\n onReset,\n children,\n className,\n style,\n ...rest\n}: ResizableHeaderCellProps) {\n const thRef = useRef<HTMLTableCellElement>(null);\n const lastWidthRef = useRef<number | undefined>(\n typeof width === 'number' && Number.isFinite(width) ? width : undefined,\n );\n\n if (!onResize) {\n return (\n <th {...rest} className={className} style={style} ref={thRef}>\n {children}\n </th>\n );\n }\n\n const startDrag = (e: ReactMouseEvent<HTMLSpanElement>) => {\n e.preventDefault();\n e.stopPropagation();\n // 先锁兄弟列,再量本列(锁宽可能触发重排,故本列尽量用当前 offsetWidth)\n onResizeStart?.();\n const measured =\n thRef.current?.offsetWidth ||\n (typeof width === 'number' && Number.isFinite(width) && width > 0 ? width : minWidth);\n const startX = e.clientX;\n const startW = measured;\n lastWidthRef.current = startW;\n\n const onMove = (ev: MouseEvent) => {\n const next = clampColumnWidth(startW + (ev.clientX - startX), minWidth, maxWidth);\n lastWidthRef.current = next;\n onResize(next);\n };\n const onUp = () => {\n document.removeEventListener('mousemove', onMove);\n document.removeEventListener('mouseup', onUp);\n document.body.style.cursor = '';\n document.body.style.userSelect = '';\n const finalW = lastWidthRef.current;\n if (typeof finalW === 'number') onResizeStop?.(finalW);\n };\n document.body.style.cursor = 'col-resize';\n document.body.style.userSelect = 'none';\n document.addEventListener('mousemove', onMove);\n document.addEventListener('mouseup', onUp);\n };\n\n //
|
|
1
|
+
{"version":3,"file":"ResizableHeaderCell.js","sources":["../../../src/components/Table/ResizableHeaderCell.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport {\n useRef,\n type MouseEvent as ReactMouseEvent,\n type ReactNode,\n type ThHTMLAttributes,\n} from 'react';\nimport {\n clampColumnWidth,\n COLUMN_RESIZE_MAX_WIDTH,\n COLUMN_RESIZE_MIN_WIDTH,\n} from './columnConfigUtils';\nimport styles from './style.module.scss';\n\nexport type ResizableHeaderCellProps = ThHTMLAttributes<HTMLTableCellElement> & {\n width?: number;\n minWidth?: number;\n maxWidth?: number;\n /** 开始拖拽前调用(用于锁死其它列宽) */\n onResizeStart?: () => void;\n onResize?: (width: number) => void;\n onResizeStop?: (width: number) => void;\n /** 双击把手:清除自定义 width */\n onReset?: () => void;\n children?: ReactNode;\n};\n\n/**\n * antd Table header.cell:表头右缘拖拽调宽;无 onResize 时退化为普通 th。\n */\nexport default function ResizableHeaderCell({\n width,\n minWidth = COLUMN_RESIZE_MIN_WIDTH,\n maxWidth = COLUMN_RESIZE_MAX_WIDTH,\n onResizeStart,\n onResize,\n onResizeStop,\n onReset,\n children,\n className,\n style,\n ...rest\n}: ResizableHeaderCellProps) {\n const thRef = useRef<HTMLTableCellElement>(null);\n const lastWidthRef = useRef<number | undefined>(\n typeof width === 'number' && Number.isFinite(width) ? width : undefined,\n );\n\n if (!onResize) {\n return (\n <th {...rest} className={className} style={style} ref={thRef}>\n {children}\n </th>\n );\n }\n\n const startDrag = (e: ReactMouseEvent<HTMLSpanElement>) => {\n e.preventDefault();\n e.stopPropagation();\n // 先锁兄弟列,再量本列(锁宽可能触发重排,故本列尽量用当前 offsetWidth)\n onResizeStart?.();\n const measured =\n thRef.current?.offsetWidth ||\n (typeof width === 'number' && Number.isFinite(width) && width > 0 ? width : minWidth);\n const startX = e.clientX;\n const startW = measured;\n lastWidthRef.current = startW;\n\n const onMove = (ev: MouseEvent) => {\n const next = clampColumnWidth(startW + (ev.clientX - startX), minWidth, maxWidth);\n lastWidthRef.current = next;\n onResize(next);\n };\n const onUp = () => {\n document.removeEventListener('mousemove', onMove);\n document.removeEventListener('mouseup', onUp);\n document.body.style.cursor = '';\n document.body.style.userSelect = '';\n const finalW = lastWidthRef.current;\n if (typeof finalW === 'number') onResizeStop?.(finalW);\n };\n document.body.style.cursor = 'col-resize';\n document.body.style.userSelect = 'none';\n document.addEventListener('mousemove', onMove);\n document.addEventListener('mouseup', onUp);\n };\n\n // 勿写 inline position:relative——会覆盖 .ant-table-cell-fix 的 sticky,导致固定列分裂。\n // 普通列的定位上下文由 .resizableHeaderCell 的 CSS :not(.ant-table-cell-fix*) 提供;\n // sticky 自身可作为 absolute 把手的 containing block。\n const mergedStyle = {\n ...style,\n overflow: style?.overflow ?? 'visible',\n };\n\n return (\n <th\n {...rest}\n ref={thRef}\n className={classNames(className, styles.resizableHeaderCell)}\n style={mergedStyle}\n >\n {children}\n <span\n role=\"separator\"\n aria-orientation=\"vertical\"\n aria-label=\"拖拽调整列宽,双击重置\"\n title=\"拖拽调宽 · 双击重置\"\n className={styles.resizeHandle}\n onClick={(e) => e.stopPropagation()}\n onMouseDown={startDrag}\n onDoubleClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n onReset?.();\n }}\n />\n </th>\n );\n}\n"],"names":["ResizableHeaderCell","width","minWidth","COLUMN_RESIZE_MIN_WIDTH","maxWidth","COLUMN_RESIZE_MAX_WIDTH","onResizeStart","onResize","onResizeStop","onReset","children","className","style","rest","thRef","useRef","lastWidthRef","jsx","startDrag","measured","_a","startX","startW","onMove","ev","next","clampColumnWidth","onUp","finalW","mergedStyle","jsxs","classNames","styles"],"mappings":";;;;;AA8BA,SAAwBA,EAAoB;AAAA,EAC1C,OAAAC;AAAA,EACA,UAAAC,IAAWC;AAAA,EACX,UAAAC,IAAWC;AAAA,EACX,eAAAC;AAAA,EACA,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,GAAGC;AACL,GAA6B;AAC3B,QAAMC,IAAQC,EAA6B,IAAI,GACzCC,IAAeD;AAAA,IACnB,OAAOd,KAAU,YAAY,OAAO,SAASA,CAAK,IAAIA,IAAQ;AAAA,EAAA;AAGhE,MAAI,CAACM;AACH,WACE,gBAAAU,EAAC,QAAI,GAAGJ,GAAM,WAAAF,GAAsB,OAAAC,GAAc,KAAKE,GACpD,UAAAJ,GACH;AAIJ,QAAMQ,IAAY,CAAC,MAAwC;;AACzD,MAAE,eAAA,GACF,EAAE,gBAAA,GAEFZ,KAAA,QAAAA;AACA,UAAMa,MACJC,IAAAN,EAAM,YAAN,gBAAAM,EAAe,iBACd,OAAOnB,KAAU,YAAY,OAAO,SAASA,CAAK,KAAKA,IAAQ,IAAIA,IAAQC,IACxEmB,IAAS,EAAE,SACXC,IAASH;AACf,IAAAH,EAAa,UAAUM;AAEvB,UAAMC,IAAS,CAACC,MAAmB;AACjC,YAAMC,IAAOC,EAAiBJ,KAAUE,EAAG,UAAUH,IAASnB,GAAUE,CAAQ;AAChF,MAAAY,EAAa,UAAUS,GACvBlB,EAASkB,CAAI;AAAA,IACf,GACME,IAAO,MAAM;AACjB,eAAS,oBAAoB,aAAaJ,CAAM,GAChD,SAAS,oBAAoB,WAAWI,CAAI,GAC5C,SAAS,KAAK,MAAM,SAAS,IAC7B,SAAS,KAAK,MAAM,aAAa;AACjC,YAAMC,IAASZ,EAAa;AAC5B,MAAI,OAAOY,KAAW,aAAUpB,KAAA,QAAAA,EAAeoB;AAAA,IACjD;AACA,aAAS,KAAK,MAAM,SAAS,cAC7B,SAAS,KAAK,MAAM,aAAa,QACjC,SAAS,iBAAiB,aAAaL,CAAM,GAC7C,SAAS,iBAAiB,WAAWI,CAAI;AAAA,EAC3C,GAKME,IAAc;AAAA,IAClB,GAAGjB;AAAA,IACH,WAAUA,KAAA,gBAAAA,EAAO,aAAY;AAAA,EAAA;AAG/B,SACE,gBAAAkB;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAGjB;AAAA,MACJ,KAAKC;AAAA,MACL,WAAWiB,EAAWpB,GAAWqB,EAAO,mBAAmB;AAAA,MAC3D,OAAOH;AAAA,MAEN,UAAA;AAAA,QAAAnB;AAAA,QACD,gBAAAO;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,oBAAiB;AAAA,YACjB,cAAW;AAAA,YACX,OAAM;AAAA,YACN,WAAWe,EAAO;AAAA,YAClB,SAAS,CAAC,MAAM,EAAE,gBAAA;AAAA,YAClB,aAAad;AAAA,YACb,eAAe,CAAC,MAAM;AACpB,gBAAE,eAAA,GACF,EAAE,gBAAA,GACFT,KAAA,QAAAA;AAAA,YACF;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -5,93 +5,92 @@ import { forwardRef as Pe, useImperativeHandle as Ie, useMemo as x, useRef as yt
|
|
|
5
5
|
import { flushSync as Ee } from "react-dom";
|
|
6
6
|
import kt from "./columnConfig.module.scss.js";
|
|
7
7
|
import { ColumnConfigTrigger as Te } from "./ColumnConfigPanel.js";
|
|
8
|
-
import { COLUMN_RESIZE_MAX_WIDTH as Ae, COLUMN_RESIZE_MIN_WIDTH as Ne, columnsLeafPathSignature as Fe, applyColumnConfig as je, applyLeafWidthOverrides as Mt, columnsToPanelItems as ke, copyColumnWidths as Me, columnsToConfig as Bt, clampColumnWidth as St, setColumnWidthAtPath as Be, clearColumnWidthAtPath as De, hideColumnAtPath as Ue, configHasLeafWidths as $e, insertBeforeFixedRight as Ge, FLEX_SPACER_COL_KEY as qe, COLUMN_CONFIG_COL_KEY as Xe, isInternalColumnKey as Wt,
|
|
9
|
-
import
|
|
8
|
+
import { COLUMN_RESIZE_MAX_WIDTH as Ae, COLUMN_RESIZE_MIN_WIDTH as Ne, columnsLeafPathSignature as Fe, applyColumnConfig as je, applyLeafWidthOverrides as Mt, columnsToPanelItems as ke, copyColumnWidths as Me, columnsToConfig as Bt, clampColumnWidth as St, setColumnWidthAtPath as Be, clearColumnWidthAtPath as De, hideColumnAtPath as Ue, configHasLeafWidths as $e, insertBeforeFixedRight as Ge, FLEX_SPACER_COL_KEY as qe, COLUMN_CONFIG_COL_KEY as Xe, isInternalColumnKey as Wt, shortChildId as $t } from "./columnConfigUtils.js";
|
|
9
|
+
import { isFixedColumn as On } from "./columnConfigUtils.js";
|
|
10
|
+
import Ze from "./ResizableHeaderCell.js";
|
|
10
11
|
import p from "./style.module.scss.js";
|
|
11
|
-
import { emptyTablePrefs as
|
|
12
|
-
import { normalizeHiddenRowKeys as Ct, mergeTablePrefs as lt, applyHiddenRows as
|
|
13
|
-
import { parseTablePrefs as
|
|
14
|
-
import { useTableFetch as
|
|
15
|
-
import { useMarsunFetch as
|
|
12
|
+
import { emptyTablePrefs as Ye } from "./tablePrefsTypes.js";
|
|
13
|
+
import { normalizeHiddenRowKeys as Ct, mergeTablePrefs as lt, applyHiddenRows as Je } from "./tablePrefsUtils.js";
|
|
14
|
+
import { parseTablePrefs as bn, serializeTablePrefs as Ln } from "./tablePrefsUtils.js";
|
|
15
|
+
import { useTableFetch as Qe } from "./useTableFetch.js";
|
|
16
|
+
import { useMarsunFetch as Ve } from "../../provider/context.js";
|
|
16
17
|
import Dt from "../Empty/Empty.js";
|
|
17
18
|
import { Eye as Gt } from "../Icons/Eye.js";
|
|
18
|
-
const
|
|
19
|
-
function
|
|
20
|
-
return `共 ${
|
|
19
|
+
const we = { x: "max-content" }, G = 40, Ke = 64;
|
|
20
|
+
function tn(i) {
|
|
21
|
+
return `共 ${i} 项`;
|
|
21
22
|
}
|
|
22
|
-
function qt(
|
|
23
|
+
function qt(i) {
|
|
23
24
|
var f;
|
|
24
|
-
if (!(
|
|
25
|
-
let
|
|
26
|
-
for (const o of
|
|
27
|
-
const
|
|
28
|
-
if (
|
|
25
|
+
if (!(i != null && i.length)) return 0;
|
|
26
|
+
let l = 0;
|
|
27
|
+
for (const o of i) {
|
|
28
|
+
const a = o.key != null ? String(o.key) : "";
|
|
29
|
+
if (a && Wt(a)) continue;
|
|
29
30
|
if ((f = o.children) != null && f.length) {
|
|
30
|
-
|
|
31
|
+
l += qt(o.children);
|
|
31
32
|
continue;
|
|
32
33
|
}
|
|
33
34
|
const c = o.width;
|
|
34
|
-
typeof c == "number" && Number.isFinite(c) && c > 0 ?
|
|
35
|
+
typeof c == "number" && Number.isFinite(c) && c > 0 ? l += c : l += Ke;
|
|
35
36
|
}
|
|
36
|
-
return
|
|
37
|
+
return l;
|
|
37
38
|
}
|
|
38
|
-
function Xt(
|
|
39
|
-
return
|
|
39
|
+
function Xt(i, l) {
|
|
40
|
+
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}`;
|
|
40
41
|
}
|
|
41
|
-
function
|
|
42
|
-
if (typeof f == "function") return String(f(
|
|
42
|
+
function en(i, l, f) {
|
|
43
|
+
if (typeof f == "function") return String(f(i, l));
|
|
43
44
|
if (typeof f == "string" && f) {
|
|
44
|
-
const o =
|
|
45
|
+
const o = i[f];
|
|
45
46
|
if (o != null && o !== "") return String(o);
|
|
46
47
|
}
|
|
47
|
-
return String(
|
|
48
|
+
return String(l);
|
|
48
49
|
}
|
|
49
|
-
function Zt(
|
|
50
|
-
return
|
|
50
|
+
function Zt(i, l, f, o = []) {
|
|
51
|
+
return i.map((a, c) => {
|
|
51
52
|
var R;
|
|
52
|
-
const _ = Xt(
|
|
53
|
-
if (Wt(_)) return
|
|
54
|
-
const d = f ? $t(f, _) : _, O = [...o, d], u =
|
|
55
|
-
if ((R =
|
|
53
|
+
const _ = Xt(a, c);
|
|
54
|
+
if (Wt(_)) return a;
|
|
55
|
+
const d = f ? $t(f, _) : _, O = [...o, d], u = a.onHeaderCell;
|
|
56
|
+
if ((R = a.children) != null && R.length)
|
|
56
57
|
return {
|
|
57
|
-
...
|
|
58
|
+
...a,
|
|
58
59
|
children: Zt(
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
a.children,
|
|
61
|
+
l,
|
|
61
62
|
_,
|
|
62
63
|
O
|
|
63
64
|
)
|
|
64
65
|
};
|
|
65
|
-
|
|
66
|
-
return s;
|
|
67
|
-
const q = O.join("/"), P = a.widthByPath[q] ?? (typeof s.width == "number" && Number.isFinite(s.width) ? s.width : void 0);
|
|
66
|
+
const q = O.join("/"), P = l.widthByPath[q] ?? (typeof a.width == "number" && Number.isFinite(a.width) ? a.width : void 0);
|
|
68
67
|
return {
|
|
69
|
-
...
|
|
68
|
+
...a,
|
|
70
69
|
onHeaderCell: (W) => ({
|
|
71
70
|
...typeof u == "function" ? u(W) : u || {},
|
|
72
71
|
"data-marsun-col-path": q,
|
|
73
72
|
width: P,
|
|
74
|
-
minWidth:
|
|
75
|
-
maxWidth:
|
|
76
|
-
onResizeStart: () =>
|
|
77
|
-
onResize: (I) =>
|
|
78
|
-
onResizeStop: (I) =>
|
|
79
|
-
onReset: () =>
|
|
73
|
+
minWidth: l.minWidth,
|
|
74
|
+
maxWidth: l.maxWidth,
|
|
75
|
+
onResizeStart: () => l.onResizeStartPath(O),
|
|
76
|
+
onResize: (I) => l.onResizePath(O, I),
|
|
77
|
+
onResizeStop: (I) => l.onResizeStopPath(O, I),
|
|
78
|
+
onReset: () => l.onResetPath(O)
|
|
80
79
|
})
|
|
81
80
|
};
|
|
82
81
|
});
|
|
83
82
|
}
|
|
84
|
-
const
|
|
85
|
-
function Yt(
|
|
83
|
+
const nn = 6;
|
|
84
|
+
function Yt(i, l, f, o = [], a = 0, c) {
|
|
86
85
|
let _ = 0;
|
|
87
|
-
return
|
|
86
|
+
return i.map((d, O) => {
|
|
88
87
|
var g, N;
|
|
89
88
|
const u = Xt(d, O);
|
|
90
89
|
if (Wt(u)) return d;
|
|
91
90
|
const q = f ? $t(f, u) : u, P = [...o, q], R = d.onHeaderCell;
|
|
92
91
|
let W = c;
|
|
93
|
-
|
|
94
|
-
const D = W == null ? void 0 :
|
|
92
|
+
a === 0 && (W = (g = d.children) != null && g.length ? _++ : void 0);
|
|
93
|
+
const D = W == null ? void 0 : a === 0 ? p.headerDepth0 : a === 1 ? p.headerDepth1 : p.headerDepth2, I = W == null ? void 0 : p[`headerGroup${W % nn}`], U = /* @__PURE__ */ et("span", { className: p.headerTitleWithEye, children: [
|
|
95
94
|
/* @__PURE__ */ y("span", { className: p.headerTitleText, children: d.title }),
|
|
96
95
|
/* @__PURE__ */ y(Ut, { title: "隐藏此列", children: /* @__PURE__ */ y(
|
|
97
96
|
"button",
|
|
@@ -100,7 +99,7 @@ function Yt(l, a, f, o = [], s = 0, c) {
|
|
|
100
99
|
className: p.headerEyeBtn,
|
|
101
100
|
"aria-label": "隐藏此列",
|
|
102
101
|
onClick: (F) => {
|
|
103
|
-
F.stopPropagation(),
|
|
102
|
+
F.stopPropagation(), l(P);
|
|
104
103
|
},
|
|
105
104
|
children: /* @__PURE__ */ y(Gt, { size: 12 })
|
|
106
105
|
}
|
|
@@ -118,10 +117,10 @@ function Yt(l, a, f, o = [], s = 0, c) {
|
|
|
118
117
|
onHeaderCell: b,
|
|
119
118
|
children: Yt(
|
|
120
119
|
d.children,
|
|
121
|
-
|
|
120
|
+
l,
|
|
122
121
|
u,
|
|
123
122
|
P,
|
|
124
|
-
|
|
123
|
+
a + 1,
|
|
125
124
|
W
|
|
126
125
|
)
|
|
127
126
|
} : {
|
|
@@ -131,12 +130,12 @@ function Yt(l, a, f, o = [], s = 0, c) {
|
|
|
131
130
|
};
|
|
132
131
|
});
|
|
133
132
|
}
|
|
134
|
-
function
|
|
135
|
-
className:
|
|
136
|
-
style:
|
|
133
|
+
function rn({
|
|
134
|
+
className: i,
|
|
135
|
+
style: l,
|
|
137
136
|
scroll: f,
|
|
138
137
|
pagination: o,
|
|
139
|
-
locale:
|
|
138
|
+
locale: a,
|
|
140
139
|
columns: c,
|
|
141
140
|
dataSource: _,
|
|
142
141
|
rowKey: d,
|
|
@@ -171,7 +170,7 @@ function sn({
|
|
|
171
170
|
...le
|
|
172
171
|
}, ae) {
|
|
173
172
|
var Ft;
|
|
174
|
-
const ot =
|
|
173
|
+
const ot = Ve(), {
|
|
175
174
|
fetchMode: ct,
|
|
176
175
|
rows: oe,
|
|
177
176
|
total: ce,
|
|
@@ -181,7 +180,7 @@ function sn({
|
|
|
181
180
|
pageSize: he,
|
|
182
181
|
setPage: fe,
|
|
183
182
|
reload: zt
|
|
184
|
-
} =
|
|
183
|
+
} = Qe({
|
|
185
184
|
dataSource: _,
|
|
186
185
|
fetchData: wt,
|
|
187
186
|
fetchUrl: Kt,
|
|
@@ -199,7 +198,7 @@ function sn({
|
|
|
199
198
|
const ut = ct ? oe : _, me = !!O || ct && ue, j = q ?? !!u, v = Jt ?? !!u, E = Qt, T = Vt, Y = x(
|
|
200
199
|
() => ({ minWidth: E, maxWidth: T }),
|
|
201
200
|
[E, T]
|
|
202
|
-
), rt = yt(c), dt = yt(null), [
|
|
201
|
+
), rt = yt(c), dt = yt(null), [s, st] = tt(null), [Ht, pe] = tt(!1), [ht, ft] = tt(!j), [Ot, ye] = tt([]), [k, Q] = tt({}), $ = yt(k);
|
|
203
202
|
$.current = k, gt(() => {
|
|
204
203
|
rt.current = c;
|
|
205
204
|
}, [c]);
|
|
@@ -223,7 +222,7 @@ function sn({
|
|
|
223
222
|
t || st((n = r == null ? void 0 : r.columns) != null && n.length ? r : null);
|
|
224
223
|
} else if (P) {
|
|
225
224
|
const r = await P(u);
|
|
226
|
-
t || st(r != null && r.length ?
|
|
225
|
+
t || st(r != null && r.length ? Ye(r) : null);
|
|
227
226
|
}
|
|
228
227
|
} catch {
|
|
229
228
|
t || st(null);
|
|
@@ -234,7 +233,7 @@ function sn({
|
|
|
234
233
|
t = !0;
|
|
235
234
|
};
|
|
236
235
|
}, [j, v, u, D, P]);
|
|
237
|
-
const A = (Ft =
|
|
236
|
+
const A = (Ft = s == null ? void 0 : s.columns) != null && Ft.length ? s.columns : null, M = x(() => N !== void 0 ? Ct(N, g) : Ct(Ot, g), [N, Ot, g]), J = z(
|
|
238
237
|
(t) => {
|
|
239
238
|
const e = Ct(t, g);
|
|
240
239
|
N === void 0 && ye(e), F == null || F(e);
|
|
@@ -274,16 +273,16 @@ function sn({
|
|
|
274
273
|
[c]
|
|
275
274
|
), Lt = z(
|
|
276
275
|
async (t) => {
|
|
277
|
-
const e = Me(t,
|
|
278
|
-
await B(lt(
|
|
276
|
+
const e = Me(t, s == null ? void 0 : s.columns);
|
|
277
|
+
await B(lt(s, { columns: e }));
|
|
279
278
|
},
|
|
280
|
-
[
|
|
279
|
+
[s, B]
|
|
281
280
|
), it = z(() => {
|
|
282
281
|
var t;
|
|
283
|
-
return (t =
|
|
282
|
+
return (t = s == null ? void 0 : s.columns) != null && t.length ? s.columns : Bt(
|
|
284
283
|
rt.current || c
|
|
285
284
|
);
|
|
286
|
-
}, [
|
|
285
|
+
}, [s, c]), vt = z((t, e) => {
|
|
287
286
|
const n = t.join("/");
|
|
288
287
|
Q((r) => {
|
|
289
288
|
const h = { ...r, [n]: e };
|
|
@@ -319,9 +318,9 @@ function sn({
|
|
|
319
318
|
let H = it();
|
|
320
319
|
for (const [m, C] of Object.entries(S))
|
|
321
320
|
H = Be(H, m.split("/"), C, Y);
|
|
322
|
-
await B(lt(
|
|
321
|
+
await B(lt(s, { columns: H }));
|
|
323
322
|
},
|
|
324
|
-
[it, B,
|
|
323
|
+
[it, B, s, T, E, Y]
|
|
325
324
|
), It = z(
|
|
326
325
|
async (t) => {
|
|
327
326
|
const e = t.join("/");
|
|
@@ -331,19 +330,19 @@ function sn({
|
|
|
331
330
|
return delete h[e], $.current = h, h;
|
|
332
331
|
});
|
|
333
332
|
const n = De(it(), t);
|
|
334
|
-
await B(lt(
|
|
333
|
+
await B(lt(s, { columns: n }));
|
|
335
334
|
},
|
|
336
|
-
[it, B,
|
|
335
|
+
[it, B, s]
|
|
337
336
|
), Et = z(
|
|
338
337
|
async (t) => {
|
|
339
338
|
var n;
|
|
340
339
|
if (!t.length) return;
|
|
341
|
-
const e = (n =
|
|
340
|
+
const e = (n = s == null ? void 0 : s.columns) != null && n.length && s.columns.length ? s.columns : Bt(
|
|
342
341
|
rt.current || c
|
|
343
342
|
);
|
|
344
|
-
await B(lt(
|
|
343
|
+
await B(lt(s, { columns: Ue(e, t) }));
|
|
345
344
|
},
|
|
346
|
-
[
|
|
345
|
+
[s, c, B]
|
|
347
346
|
), Se = z(() => {
|
|
348
347
|
const t = (X || []).map(String);
|
|
349
348
|
t.length && J([...M, ...t]);
|
|
@@ -439,9 +438,9 @@ function sn({
|
|
|
439
438
|
E,
|
|
440
439
|
T,
|
|
441
440
|
k
|
|
442
|
-
]), We = x(() => b ?
|
|
441
|
+
]), We = x(() => b ? Je(ut, M, typeof d == "function" || typeof d == "string" ? d : void 0, g) : ut, [b, ut, M, d, g]), xe = o === !1 ? !1 : {
|
|
443
442
|
showSizeChanger: !0,
|
|
444
|
-
showTotal:
|
|
443
|
+
showTotal: tn,
|
|
445
444
|
...o && typeof o == "object" ? o : {},
|
|
446
445
|
...ct ? {
|
|
447
446
|
current: de,
|
|
@@ -452,8 +451,8 @@ function sn({
|
|
|
452
451
|
}
|
|
453
452
|
} : null
|
|
454
453
|
}, ze = {
|
|
455
|
-
...
|
|
456
|
-
emptyText: (
|
|
454
|
+
...a,
|
|
455
|
+
emptyText: (a == null ? void 0 : a.emptyText) ?? (xt ? /* @__PURE__ */ y(Dt, { iconType: "simple", description: xt.message || "加载失败" }) : /* @__PURE__ */ y(Dt, { iconType: "simple", description: "暂无数据" }))
|
|
457
456
|
}, pt = x(() => new Set((g || []).map(String)), [g]), He = b && (X || []).some((t) => {
|
|
458
457
|
const e = String(t);
|
|
459
458
|
return e && !pt.has(e);
|
|
@@ -478,7 +477,7 @@ function sn({
|
|
|
478
477
|
columnWidth: t + 20,
|
|
479
478
|
renderCell: (e, n, r, h) => {
|
|
480
479
|
var K;
|
|
481
|
-
const H = ((K = L.renderCell) == null ? void 0 : K.call(L, e, n, r, h)) ?? h, m =
|
|
480
|
+
const H = ((K = L.renderCell) == null ? void 0 : K.call(L, e, n, r, h)) ?? h, m = en(n, r, d), C = pt.has(m);
|
|
482
481
|
return /* @__PURE__ */ et("span", { className: p.rowSelectWithEye, children: [
|
|
483
482
|
H,
|
|
484
483
|
/* @__PURE__ */ y(Ut, { title: C ? "主对标不可隐藏" : "隐藏此行", children: /* @__PURE__ */ y(
|
|
@@ -503,7 +502,7 @@ function sn({
|
|
|
503
502
|
const e = V ? typeof V.columnWidth == "number" ? V.columnWidth : 48 : 0;
|
|
504
503
|
return t + e;
|
|
505
504
|
}, [mt, V]), Re = x(() => {
|
|
506
|
-
const t = f === void 0 ? { ...
|
|
505
|
+
const t = f === void 0 ? { ...we } : { ...f };
|
|
507
506
|
return w > 0 ? { ...t, x: w } : t;
|
|
508
507
|
}, [f, w]), be = x(() => {
|
|
509
508
|
const t = Z == null ? void 0 : Z.header, e = t && "cell" in t ? t.cell : void 0;
|
|
@@ -511,7 +510,7 @@ function sn({
|
|
|
511
510
|
...Z,
|
|
512
511
|
header: {
|
|
513
512
|
...t,
|
|
514
|
-
cell: (r) => !(typeof r.onResize == "function") && e ? /* @__PURE__ */ y(e, { ...r }) : /* @__PURE__ */ y(
|
|
513
|
+
cell: (r) => !(typeof r.onResize == "function") && e ? /* @__PURE__ */ y(e, { ...r }) : /* @__PURE__ */ y(Ze, { ...r })
|
|
515
514
|
}
|
|
516
515
|
} : Z;
|
|
517
516
|
}, [Z, v]);
|
|
@@ -520,9 +519,9 @@ function sn({
|
|
|
520
519
|
/* @__PURE__ */ y(
|
|
521
520
|
_e,
|
|
522
521
|
{
|
|
523
|
-
className: at("marsun-table", p["marsun-table"],
|
|
522
|
+
className: at("marsun-table", p["marsun-table"], i),
|
|
524
523
|
style: {
|
|
525
|
-
...
|
|
524
|
+
...l,
|
|
526
525
|
...w > 0 ? { "--marsun-table-scroll-x": `${w}px` } : null
|
|
527
526
|
},
|
|
528
527
|
scroll: Re,
|
|
@@ -539,14 +538,14 @@ function sn({
|
|
|
539
538
|
)
|
|
540
539
|
] });
|
|
541
540
|
}
|
|
542
|
-
const
|
|
541
|
+
const xn = Pe(rn);
|
|
543
542
|
export {
|
|
544
543
|
Xe as COLUMN_CONFIG_COL_KEY,
|
|
545
544
|
Ae as COLUMN_RESIZE_MAX_WIDTH,
|
|
546
545
|
Ne as COLUMN_RESIZE_MIN_WIDTH,
|
|
547
546
|
qe as FLEX_SPACER_COL_KEY,
|
|
548
547
|
je as applyColumnConfig,
|
|
549
|
-
|
|
548
|
+
Je as applyHiddenRows,
|
|
550
549
|
Mt as applyLeafWidthOverrides,
|
|
551
550
|
St as clampColumnWidth,
|
|
552
551
|
De as clearColumnWidthAtPath,
|
|
@@ -554,16 +553,16 @@ export {
|
|
|
554
553
|
Bt as columnsToConfig,
|
|
555
554
|
$e as configHasLeafWidths,
|
|
556
555
|
Me as copyColumnWidths,
|
|
557
|
-
|
|
558
|
-
|
|
556
|
+
xn as default,
|
|
557
|
+
Ye as emptyTablePrefs,
|
|
559
558
|
Ue as hideColumnAtPath,
|
|
560
559
|
Ge as insertBeforeFixedRight,
|
|
561
|
-
|
|
560
|
+
On as isFixedColumn,
|
|
562
561
|
Wt as isInternalColumnKey,
|
|
563
562
|
lt as mergeTablePrefs,
|
|
564
563
|
Ct as normalizeHiddenRowKeys,
|
|
565
|
-
|
|
566
|
-
|
|
564
|
+
bn as parseTablePrefs,
|
|
565
|
+
Ln as serializeTablePrefs,
|
|
567
566
|
Be as setColumnWidthAtPath
|
|
568
567
|
};
|
|
569
568
|
//# sourceMappingURL=Table.js.map
|