bitz-react-admin-ui 1.7.7 → 1.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.
- package/dist/components/BitzConfigProvider/context.d.ts +1 -0
- package/dist/components/BitzConfigProvider/index.d.ts +10 -0
- package/dist/components/BitzConfirmModal/index.d.ts +5 -0
- package/dist/components/BitzConvert/DropdownToButton/index.d.ts +6 -6
- package/dist/components/BitzTable/Store/index.d.ts +25 -13
- package/dist/components/BitzTable/Store/index.mjs +168 -117
- package/dist/components/BitzTable/Table/index.d.ts +6 -1
- package/dist/components/BitzTable/Table/index.mjs +190 -185
- package/dist/components/BitzTable/ToolBar/ColConfigIcon/ColumnSettingModal.d.ts +5 -3
- package/dist/components/BitzTable/ToolBar/ColConfigIcon/ColumnSettingModal.mjs +93 -89
- package/dist/components/BitzTable/ToolBar/ColConfigIcon/index.d.ts +2 -1
- package/dist/components/BitzTable/ToolBar/ColConfigIcon/index.mjs +21 -17
- package/dist/components/BitzTable/ToolBar/DensityIcon/index.mjs +27 -21
- package/dist/components/BitzTable/ToolBar/index.d.ts +2 -1
- package/dist/components/BitzTable/index.d.ts +2 -2
- package/dist/style.css +1 -1
- package/package.json +5 -1
|
@@ -14,6 +14,16 @@ export interface BitzTableComponentToken extends TableComponentToken {
|
|
|
14
14
|
radioCheckboxBorderColor?: string;
|
|
15
15
|
/** 展开按钮border颜色 */
|
|
16
16
|
expandIconBorderColor?: string;
|
|
17
|
+
/** xl */
|
|
18
|
+
xlFontSize?: number;
|
|
19
|
+
/** lg */
|
|
20
|
+
lgFontSize?: number;
|
|
21
|
+
/** md */
|
|
22
|
+
mdFontSize?: number;
|
|
23
|
+
/** sm */
|
|
24
|
+
smFontSize?: number;
|
|
25
|
+
/** xs */
|
|
26
|
+
xsFontSize?: number;
|
|
17
27
|
/** list背景颜色 移动端 */
|
|
18
28
|
mobileListBgColor?: string;
|
|
19
29
|
/** listItem背景颜色 移动端 */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FC, ReactNode } from 'react';
|
|
2
2
|
import { ModalProps } from 'antd';
|
|
3
|
+
import { NiceModalHandler } from '@ebay/nice-modal-react';
|
|
3
4
|
import './index.less';
|
|
4
5
|
export interface BitzConfirmModalProps extends Omit<ModalProps, 'onOk' | 'onCancel'> {
|
|
5
6
|
okButtonProps: any;
|
|
@@ -13,5 +14,9 @@ export interface BitzConfirmModalProps extends Omit<ModalProps, 'onOk' | 'onCanc
|
|
|
13
14
|
/** 点击cancel按钮,返回'cancel' */
|
|
14
15
|
onCancel?: () => any;
|
|
15
16
|
}
|
|
17
|
+
export type BitzConfirmModalResolveType = 'ok' | 'cancel';
|
|
18
|
+
export interface BitzConfirmModalHandler extends Omit<NiceModalHandler, 'resolve'> {
|
|
19
|
+
resolve: (args?: BitzConfirmModalResolveType) => void;
|
|
20
|
+
}
|
|
16
21
|
declare const _default: FC<BitzConfirmModalProps & import("@ebay/nice-modal-react").NiceModalHocProps>;
|
|
17
22
|
export default _default;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { DropdownProps as AntDropdownProps, MenuProps as AntMenuProps } from 'antd';
|
|
2
2
|
import { MenuItemType as AntMenuItemType } from 'antd/es/menu/hooks/useItems';
|
|
3
|
-
import { FC } from 'react';
|
|
3
|
+
import { FC, Key } from 'react';
|
|
4
4
|
import { BitzConvertBaseProps } from '..';
|
|
5
|
-
type DropdownClickEvent = (menuInfo: {
|
|
6
|
-
key:
|
|
5
|
+
type DropdownClickEvent<T extends Key = any> = (menuInfo: {
|
|
6
|
+
key: T;
|
|
7
7
|
}) => void;
|
|
8
8
|
type MenuItemType = Omit<AntMenuItemType, 'onClick'>;
|
|
9
|
-
type BitzDropdownToButtonMenuProps = Omit<AntMenuProps, 'items' | 'onClick'> & {
|
|
9
|
+
export type BitzDropdownToButtonMenuProps<T extends Key = any> = Omit<AntMenuProps, 'items' | 'onClick'> & {
|
|
10
10
|
items?: MenuItemType[];
|
|
11
|
-
onClick?: DropdownClickEvent
|
|
11
|
+
onClick?: DropdownClickEvent<T>;
|
|
12
12
|
};
|
|
13
|
-
type DropdownProps = Omit<AntDropdownProps, 'menu'> & {
|
|
13
|
+
export type DropdownProps = Omit<AntDropdownProps, 'menu'> & {
|
|
14
14
|
menu?: BitzDropdownToButtonMenuProps;
|
|
15
15
|
};
|
|
16
16
|
export type BitzDropdownToButtonProps = DropdownProps & BitzConvertBaseProps;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ColumnsConfigProps, BitzTableColumnsType } from '..';
|
|
3
3
|
export type DensitySize = 'xl' | 'lg' | 'md' | 'sm' | 'xs' | undefined;
|
|
4
|
-
export type ColumnStateType = {
|
|
4
|
+
export type ColumnStateType<TableKey extends string = any> = {
|
|
5
5
|
/**
|
|
6
6
|
* 持久化的类型,支持 localStorage 和 sessionStorage
|
|
7
7
|
*
|
|
@@ -10,16 +10,25 @@ export type ColumnStateType = {
|
|
|
10
10
|
*/
|
|
11
11
|
persistenceType?: 'localStorage' | 'sessionStorage' | 'online';
|
|
12
12
|
/** 持久化的key,用于存储到 storage 中 */
|
|
13
|
-
persistenceKey?:
|
|
13
|
+
persistenceKey?: TableKey;
|
|
14
14
|
/** ColumnsState 的值,columnsStateMap将会废弃 */
|
|
15
15
|
defaultValue?: Record<string, ColumnsConfigProps>;
|
|
16
16
|
/** ColumnsState 的值,columnsStateMap将会废弃 */
|
|
17
17
|
value?: Record<string, ColumnsConfigProps>;
|
|
18
18
|
onChange?: (map: Record<string, ColumnsConfigProps>) => void;
|
|
19
19
|
/** 仅在 persistenceType=online 有效 用于数据修改后数据上报 */
|
|
20
|
-
onlineChange?: (key:
|
|
20
|
+
onlineChange?: (key: TableKey, ColumnsState: Record<string, ColumnsConfigProps>) => void;
|
|
21
21
|
/** 仅在 persistenceType=online 有效 用于获取网络数据 */
|
|
22
|
-
onlineGet?: (key:
|
|
22
|
+
onlineGet?: (key: TableKey) => Promise<Record<string, ColumnsConfigProps> | null | undefined>;
|
|
23
|
+
};
|
|
24
|
+
export type SizeStateType<TableKey = any> = {
|
|
25
|
+
persistenceType?: 'localStorage' | 'sessionStorage' | 'online';
|
|
26
|
+
persistenceKey?: TableKey;
|
|
27
|
+
defaultValue?: DensitySize;
|
|
28
|
+
value?: DensitySize;
|
|
29
|
+
onChange?: (val: DensitySize) => void;
|
|
30
|
+
onlineChange?: (key: TableKey, sizeState: DensitySize) => void;
|
|
31
|
+
onlineGet?: (key: TableKey) => Promise<DensitySize | null | undefined>;
|
|
23
32
|
};
|
|
24
33
|
export type UseContainerProps<T = any> = {
|
|
25
34
|
columnsStateMap?: Record<string, ColumnsConfigProps>;
|
|
@@ -27,24 +36,24 @@ export type UseContainerProps<T = any> = {
|
|
|
27
36
|
size?: DensitySize;
|
|
28
37
|
defaultSize?: DensitySize;
|
|
29
38
|
onSizeChange?: (size: DensitySize) => void;
|
|
39
|
+
sizeState?: SizeStateType;
|
|
30
40
|
columns?: BitzTableColumnsType<T>;
|
|
31
41
|
columnsState?: ColumnStateType;
|
|
32
|
-
/** 仅在 persistenceType=online 有效 用于数据修改后数据上报 */
|
|
33
|
-
onlineChange?: (key: string, ColumnsState: ColumnsConfigProps) => void;
|
|
34
|
-
/** 持久化的key,用于存储到 storage 中 */
|
|
35
|
-
persistenceKey?: string;
|
|
36
42
|
};
|
|
37
|
-
declare function useContainer(props
|
|
43
|
+
declare function useContainer(props: UseContainerProps): {
|
|
38
44
|
uuid: string;
|
|
39
45
|
persistenceType: "online" | "localStorage" | "sessionStorage" | undefined;
|
|
40
|
-
persistenceKey:
|
|
41
|
-
onlineChange: ((key:
|
|
46
|
+
persistenceKey: any;
|
|
47
|
+
onlineChange: ((key: any, ColumnsState: Record<string, ColumnsConfigProps>) => void) | undefined;
|
|
42
48
|
sortKeyColumns: string[];
|
|
43
49
|
setSortKeyColumns: (keys: string[]) => void;
|
|
44
50
|
columnsMap: Record<string, ColumnsConfigProps>;
|
|
45
51
|
setColumnsMap: (updater: Record<string, ColumnsConfigProps> | ((origin: Record<string, ColumnsConfigProps>) => Record<string, ColumnsConfigProps>), ignoreDestroy?: boolean | undefined) => void;
|
|
46
52
|
setTableSize: (updater: DensitySize | ((origin: DensitySize) => DensitySize), ignoreDestroy?: boolean | undefined) => void;
|
|
47
53
|
tableSize: DensitySize;
|
|
54
|
+
sizeStorageType: "online" | "localStorage" | "sessionStorage" | undefined;
|
|
55
|
+
sizeStorageKey: any;
|
|
56
|
+
onlineSizeChange: ((key: any, sizeState: DensitySize) => void) | undefined;
|
|
48
57
|
columns: BitzTableColumnsType<any> | undefined;
|
|
49
58
|
clearPersistenceStorage: () => void;
|
|
50
59
|
defaultColumnKeyMap: Record<string, any>;
|
|
@@ -52,14 +61,17 @@ declare function useContainer(props?: UseContainerProps): {
|
|
|
52
61
|
declare const TableContext: import("react").Context<{
|
|
53
62
|
uuid: string;
|
|
54
63
|
persistenceType: "online" | "localStorage" | "sessionStorage" | undefined;
|
|
55
|
-
persistenceKey:
|
|
56
|
-
onlineChange: ((key:
|
|
64
|
+
persistenceKey: any;
|
|
65
|
+
onlineChange: ((key: any, ColumnsState: Record<string, ColumnsConfigProps>) => void) | undefined;
|
|
57
66
|
sortKeyColumns: string[];
|
|
58
67
|
setSortKeyColumns: (keys: string[]) => void;
|
|
59
68
|
columnsMap: Record<string, ColumnsConfigProps>;
|
|
60
69
|
setColumnsMap: (updater: Record<string, ColumnsConfigProps> | ((origin: Record<string, ColumnsConfigProps>) => Record<string, ColumnsConfigProps>), ignoreDestroy?: boolean | undefined) => void;
|
|
61
70
|
setTableSize: (updater: DensitySize | ((origin: DensitySize) => DensitySize), ignoreDestroy?: boolean | undefined) => void;
|
|
62
71
|
tableSize: DensitySize;
|
|
72
|
+
sizeStorageType: "online" | "localStorage" | "sessionStorage" | undefined;
|
|
73
|
+
sizeStorageKey: any;
|
|
74
|
+
onlineSizeChange: ((key: any, sizeState: DensitySize) => void) | undefined;
|
|
63
75
|
columns: BitzTableColumnsType<any> | undefined;
|
|
64
76
|
clearPersistenceStorage: () => void;
|
|
65
77
|
defaultColumnKeyMap: Record<string, any>;
|
|
@@ -1,157 +1,208 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import
|
|
3
|
-
import { createContext as
|
|
4
|
-
import { genColumnKey as
|
|
5
|
-
import { getUuid as
|
|
6
|
-
import
|
|
7
|
-
function
|
|
8
|
-
var
|
|
9
|
-
const f =
|
|
10
|
-
() =>
|
|
1
|
+
import { j as A } from "../../../node_modules/.store/react@18.2.0/node_modules/react/jsx-runtime.mjs";
|
|
2
|
+
import G from "../../../hooks/useMergedState.mjs";
|
|
3
|
+
import { createContext as B, useRef as U, useEffect as m, useMemo as D, useCallback as F } from "react";
|
|
4
|
+
import { genColumnKey as H } from "./utils/index.mjs";
|
|
5
|
+
import { getUuid as L } from "../../../utils/uuid.mjs";
|
|
6
|
+
import r from "../../../node_modules/.store/lodash-es@4.17.21/node_modules/lodash-es/merge.mjs";
|
|
7
|
+
function Q(e) {
|
|
8
|
+
var C, T, V, v, O, J, M, N, b, x, I, j, P, E, R, k;
|
|
9
|
+
const f = U(L()), w = U([]), { defaultSize: q = "lg" } = e, [h, g] = G(
|
|
10
|
+
() => {
|
|
11
|
+
var n, i, a, l;
|
|
12
|
+
const { persistenceType: t, persistenceKey: c, onlineGet: u } = e.sizeState || {};
|
|
13
|
+
if (c && t && typeof window < "u" && t !== "online") {
|
|
14
|
+
const s = window[t];
|
|
15
|
+
try {
|
|
16
|
+
const o = s == null ? void 0 : s.getItem(c);
|
|
17
|
+
if (o)
|
|
18
|
+
return (n = e == null ? void 0 : e.sizeState) != null && n.defaultValue ? r(
|
|
19
|
+
JSON.parse(o),
|
|
20
|
+
(i = e == null ? void 0 : e.sizeState) == null ? void 0 : i.defaultValue
|
|
21
|
+
) : JSON.parse(o);
|
|
22
|
+
} catch (o) {
|
|
23
|
+
console.warn(o);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return e.size || ((a = e.sizeState) == null ? void 0 : a.value) || ((l = e.sizeState) == null ? void 0 : l.defaultValue) || q;
|
|
27
|
+
},
|
|
11
28
|
{
|
|
12
|
-
value: e.size,
|
|
13
|
-
onChange: e.onSizeChange
|
|
29
|
+
value: ((C = e.sizeState) == null ? void 0 : C.value) || e.size,
|
|
30
|
+
onChange: ((T = e.sizeState) == null ? void 0 : T.onChange) || e.onSizeChange
|
|
14
31
|
}
|
|
15
|
-
)
|
|
32
|
+
);
|
|
33
|
+
m(() => {
|
|
16
34
|
var u, n;
|
|
17
|
-
if ((u = e
|
|
35
|
+
if (!((u = e.sizeState) != null && u.persistenceKey) || !((n = e.sizeState) != null && n.persistenceType) || typeof window > "u")
|
|
36
|
+
return;
|
|
37
|
+
const {
|
|
38
|
+
persistenceType: t,
|
|
39
|
+
persistenceKey: c
|
|
40
|
+
// onlineChange
|
|
41
|
+
} = e.sizeState;
|
|
42
|
+
if (t !== "online") {
|
|
43
|
+
const i = window[t];
|
|
44
|
+
try {
|
|
45
|
+
i == null || i.setItem(c, JSON.stringify(d));
|
|
46
|
+
} catch (a) {
|
|
47
|
+
console.warn(a), z();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}, [
|
|
51
|
+
(V = e.sizeState) == null ? void 0 : V.persistenceKey,
|
|
52
|
+
h,
|
|
53
|
+
(v = e.sizeState) == null ? void 0 : v.persistenceType
|
|
54
|
+
]), m(() => {
|
|
55
|
+
var t, c, u;
|
|
56
|
+
if ((t = e.sizeState) != null && t.persistenceKey && ((c = e.sizeState) == null ? void 0 : c.persistenceType) === "online") {
|
|
57
|
+
const { onlineGet: n, persistenceKey: i } = e.sizeState;
|
|
58
|
+
try {
|
|
59
|
+
(u = n == null ? void 0 : n(i)) == null || u.then((a) => {
|
|
60
|
+
var s;
|
|
61
|
+
const l = r(a, (s = e == null ? void 0 : e.sizeState) == null ? void 0 : s.value);
|
|
62
|
+
g(l ?? "lg");
|
|
63
|
+
});
|
|
64
|
+
} catch (a) {
|
|
65
|
+
console.warn(a);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}, []);
|
|
69
|
+
const y = D(() => {
|
|
70
|
+
var c, u;
|
|
71
|
+
if ((c = e == null ? void 0 : e.columnsState) != null && c.defaultValue)
|
|
18
72
|
return e.columnsState.defaultValue;
|
|
19
73
|
const t = {};
|
|
20
|
-
return (
|
|
21
|
-
const
|
|
22
|
-
|
|
74
|
+
return (u = e.columns) == null || u.forEach(({ key: n, dataIndex: i, fixed: a, disable: l }, s) => {
|
|
75
|
+
const o = H(n ?? i, s);
|
|
76
|
+
o && (t[o] = {
|
|
23
77
|
show: !0,
|
|
24
|
-
fixed:
|
|
25
|
-
disable:
|
|
78
|
+
fixed: a,
|
|
79
|
+
disable: l
|
|
26
80
|
});
|
|
27
81
|
}), t;
|
|
28
|
-
}, [e.columns]), [
|
|
82
|
+
}, [e.columns]), [d, S] = G(
|
|
29
83
|
() => {
|
|
30
|
-
var
|
|
31
|
-
const { persistenceType: t, persistenceKey:
|
|
32
|
-
if (
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
try {
|
|
47
|
-
(o = n == null ? void 0 : n(u)) == null || o.then((c) => {
|
|
48
|
-
var s, z;
|
|
49
|
-
if (c)
|
|
50
|
-
return (s = e == null ? void 0 : e.columnsState) != null && s.defaultValue ? d(c, (z = e == null ? void 0 : e.columnsState) == null ? void 0 : z.defaultValue) : c;
|
|
51
|
-
});
|
|
52
|
-
} catch (c) {
|
|
53
|
-
console.warn(c);
|
|
54
|
-
}
|
|
55
|
-
return e.columnsStateMap || ((a = e.columnsState) == null ? void 0 : a.value) || ((l = e.columnsState) == null ? void 0 : l.defaultValue) || r;
|
|
84
|
+
var n, i, a, l;
|
|
85
|
+
const { persistenceType: t, persistenceKey: c, onlineGet: u } = e.columnsState || {};
|
|
86
|
+
if (c && t && typeof window < "u" && t !== "online") {
|
|
87
|
+
const s = window[t];
|
|
88
|
+
try {
|
|
89
|
+
const o = s == null ? void 0 : s.getItem(c);
|
|
90
|
+
if (o)
|
|
91
|
+
return (n = e == null ? void 0 : e.columnsState) != null && n.defaultValue ? r(
|
|
92
|
+
JSON.parse(o),
|
|
93
|
+
(i = e == null ? void 0 : e.columnsState) == null ? void 0 : i.defaultValue
|
|
94
|
+
) : JSON.parse(o);
|
|
95
|
+
} catch (o) {
|
|
96
|
+
console.warn(o);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return e.columnsStateMap || ((a = e.columnsState) == null ? void 0 : a.value) || ((l = e.columnsState) == null ? void 0 : l.defaultValue) || y;
|
|
56
100
|
},
|
|
57
101
|
{
|
|
58
|
-
value: ((
|
|
59
|
-
onChange: ((
|
|
102
|
+
value: ((O = e.columnsState) == null ? void 0 : O.value) || e.columnsStateMap,
|
|
103
|
+
onChange: ((J = e.columnsState) == null ? void 0 : J.onChange) || e.onColumnsStateChange
|
|
60
104
|
}
|
|
61
105
|
);
|
|
62
|
-
|
|
63
|
-
var
|
|
64
|
-
const { persistenceType: t, persistenceKey:
|
|
65
|
-
if (
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
} else
|
|
80
|
-
try {
|
|
81
|
-
(o = n == null ? void 0 : n(u)) == null || o.then((a) => {
|
|
82
|
-
var l, c;
|
|
83
|
-
if (a)
|
|
84
|
-
return (l = e == null ? void 0 : e.columnsState) != null && l.defaultValue ? d(a, (c = e == null ? void 0 : e.columnsState) == null ? void 0 : c.defaultValue) : a;
|
|
85
|
-
});
|
|
86
|
-
} catch (a) {
|
|
87
|
-
console.warn(a);
|
|
88
|
-
}
|
|
106
|
+
m(() => {
|
|
107
|
+
var n, i;
|
|
108
|
+
const { persistenceType: t, persistenceKey: c, onlineGet: u } = e.columnsState || {};
|
|
109
|
+
if (c && t && typeof window < "u" && t !== "online") {
|
|
110
|
+
const a = window[t];
|
|
111
|
+
try {
|
|
112
|
+
const l = a == null ? void 0 : a.getItem(c);
|
|
113
|
+
l ? (n = e == null ? void 0 : e.columnsState) != null && n.defaultValue ? S(
|
|
114
|
+
r(
|
|
115
|
+
JSON.parse(l),
|
|
116
|
+
(i = e == null ? void 0 : e.columnsState) == null ? void 0 : i.defaultValue
|
|
117
|
+
)
|
|
118
|
+
) : S(JSON.parse(l)) : S(y);
|
|
119
|
+
} catch (l) {
|
|
120
|
+
console.warn(l);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
89
123
|
}, [
|
|
90
|
-
(
|
|
91
|
-
(
|
|
92
|
-
|
|
124
|
+
(M = e.columnsState) == null ? void 0 : M.persistenceKey,
|
|
125
|
+
(N = e.columnsState) == null ? void 0 : N.persistenceType,
|
|
126
|
+
y
|
|
93
127
|
]);
|
|
94
|
-
const
|
|
95
|
-
const { persistenceType: t, persistenceKey:
|
|
96
|
-
if (!
|
|
128
|
+
const z = F(() => {
|
|
129
|
+
const { persistenceType: t, persistenceKey: c } = e.columnsState || {};
|
|
130
|
+
if (!c || !t || typeof window > "u")
|
|
97
131
|
return;
|
|
98
|
-
const
|
|
132
|
+
const u = window[t];
|
|
99
133
|
try {
|
|
100
|
-
|
|
101
|
-
} catch (
|
|
102
|
-
console.warn(
|
|
134
|
+
u == null || u.removeItem(c);
|
|
135
|
+
} catch (n) {
|
|
136
|
+
console.warn(n);
|
|
103
137
|
}
|
|
104
138
|
}, [e.columnsState]);
|
|
105
|
-
|
|
106
|
-
var
|
|
107
|
-
if (!((
|
|
139
|
+
m(() => {
|
|
140
|
+
var u, n;
|
|
141
|
+
if (!((u = e.columnsState) != null && u.persistenceKey) || !((n = e.columnsState) != null && n.persistenceType) || typeof window > "u")
|
|
108
142
|
return;
|
|
109
143
|
const {
|
|
110
144
|
persistenceType: t,
|
|
111
|
-
persistenceKey:
|
|
145
|
+
persistenceKey: c
|
|
112
146
|
// onlineChange
|
|
113
147
|
} = e.columnsState;
|
|
114
148
|
if (t !== "online") {
|
|
115
|
-
const
|
|
149
|
+
const i = window[t];
|
|
116
150
|
try {
|
|
117
|
-
|
|
118
|
-
} catch (
|
|
119
|
-
console.warn(
|
|
151
|
+
i == null || i.setItem(c, JSON.stringify(d));
|
|
152
|
+
} catch (a) {
|
|
153
|
+
console.warn(a), z();
|
|
120
154
|
}
|
|
121
155
|
}
|
|
122
156
|
}, [
|
|
123
|
-
(
|
|
124
|
-
|
|
125
|
-
(
|
|
126
|
-
])
|
|
127
|
-
|
|
157
|
+
(b = e.columnsState) == null ? void 0 : b.persistenceKey,
|
|
158
|
+
d,
|
|
159
|
+
(x = e.columnsState) == null ? void 0 : x.persistenceType
|
|
160
|
+
]), m(() => {
|
|
161
|
+
var t, c, u;
|
|
162
|
+
if ((t = e.columnsState) != null && t.persistenceKey && ((c = e.columnsState) == null ? void 0 : c.persistenceType) === "online") {
|
|
163
|
+
const { onlineGet: n, persistenceKey: i } = e.columnsState;
|
|
164
|
+
try {
|
|
165
|
+
(u = n == null ? void 0 : n(i)) == null || u.then((a) => {
|
|
166
|
+
var s;
|
|
167
|
+
const l = r(a, (s = e == null ? void 0 : e.columnsState) == null ? void 0 : s.value);
|
|
168
|
+
S(l ?? {});
|
|
169
|
+
});
|
|
170
|
+
} catch (a) {
|
|
171
|
+
console.warn(a);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}, []);
|
|
175
|
+
const K = {
|
|
128
176
|
uuid: f.current,
|
|
129
|
-
persistenceType: (
|
|
130
|
-
persistenceKey: (
|
|
131
|
-
onlineChange: (
|
|
132
|
-
sortKeyColumns:
|
|
177
|
+
persistenceType: (I = e.columnsState) == null ? void 0 : I.persistenceType,
|
|
178
|
+
persistenceKey: (j = e.columnsState) == null ? void 0 : j.persistenceKey,
|
|
179
|
+
onlineChange: (P = e.columnsState) == null ? void 0 : P.onlineChange,
|
|
180
|
+
sortKeyColumns: w.current,
|
|
133
181
|
setSortKeyColumns: (t) => {
|
|
134
|
-
|
|
182
|
+
w.current = t;
|
|
135
183
|
},
|
|
136
|
-
columnsMap:
|
|
184
|
+
columnsMap: d,
|
|
137
185
|
setColumnsMap: S,
|
|
138
|
-
setTableSize:
|
|
139
|
-
tableSize:
|
|
186
|
+
setTableSize: g,
|
|
187
|
+
tableSize: h,
|
|
188
|
+
sizeStorageType: (E = e.sizeState) == null ? void 0 : E.persistenceType,
|
|
189
|
+
sizeStorageKey: (R = e.sizeState) == null ? void 0 : R.persistenceKey,
|
|
190
|
+
onlineSizeChange: (k = e.sizeState) == null ? void 0 : k.onlineChange,
|
|
140
191
|
columns: e.columns,
|
|
141
|
-
clearPersistenceStorage:
|
|
142
|
-
defaultColumnKeyMap:
|
|
192
|
+
clearPersistenceStorage: z,
|
|
193
|
+
defaultColumnKeyMap: y
|
|
143
194
|
};
|
|
144
|
-
return Object.defineProperty(
|
|
145
|
-
get: () =>
|
|
146
|
-
}), Object.defineProperty(
|
|
195
|
+
return Object.defineProperty(K, "sortKeyColumns", {
|
|
196
|
+
get: () => w.current
|
|
197
|
+
}), Object.defineProperty(K, "uuid", {
|
|
147
198
|
get: () => f.current
|
|
148
|
-
}),
|
|
199
|
+
}), K;
|
|
149
200
|
}
|
|
150
|
-
const
|
|
151
|
-
const f =
|
|
152
|
-
return /* @__PURE__ */
|
|
201
|
+
const W = B({}), ee = (e) => {
|
|
202
|
+
const f = Q(e.initValue);
|
|
203
|
+
return /* @__PURE__ */ A.jsx(W.Provider, { value: f, children: e.children });
|
|
153
204
|
};
|
|
154
205
|
export {
|
|
155
|
-
|
|
156
|
-
|
|
206
|
+
W as TableContext,
|
|
207
|
+
ee as default
|
|
157
208
|
};
|
|
@@ -2,7 +2,7 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { TableProps } from 'antd';
|
|
3
3
|
import { SkeletonParagraphProps } from 'antd/es/skeleton/Paragraph';
|
|
4
4
|
import { AnyObject } from 'antd/es/_util/type';
|
|
5
|
-
import { ColumnStateType, DensitySize } from '../Store';
|
|
5
|
+
import { ColumnStateType, DensitySize, SizeStateType } from '../Store';
|
|
6
6
|
import { ActionsFunType, BitzTableColumnsType } from '..';
|
|
7
7
|
import './index.less';
|
|
8
8
|
export interface BitzTableProps<RecordType = any> extends Omit<TableProps<RecordType>, 'size' | 'pagination'> {
|
|
@@ -121,6 +121,11 @@ export interface BitzTableProps<RecordType = any> extends Omit<TableProps<Record
|
|
|
121
121
|
* 是否展示工具栏 默认为 true
|
|
122
122
|
*/
|
|
123
123
|
showTableTool?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* 配置表格缓存 用于存储列配置
|
|
126
|
+
* 为空不会缓存
|
|
127
|
+
*/
|
|
128
|
+
sizeState?: SizeStateType;
|
|
124
129
|
/**
|
|
125
130
|
* 配置表格缓存 用于存储列配置
|
|
126
131
|
* 为空不会缓存
|