@ccs-ui/rc-pro 2.0.5 → 2.0.6
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/es/dialog/DialogRequestButton.d.ts +1 -1
- package/es/dialog/DialogSelfOkButton.d.ts +1 -1
- package/es/full-screen/index.d.ts +1 -5
- package/es/full-screen/index.js +2 -4
- package/es/layout-keep-alive/index.d.ts +12 -0
- package/es/layout-keep-alive/index.js +8 -3
- package/es/layout-keep-alive/page.d.ts +3 -8
- package/es/layout-keep-alive/page.js +9 -3
- package/es/layout-single-page/index.js +14 -47
- package/es/layout-single-page/index.less +4 -62
- package/es/layout-single-page/page.d.ts +2 -3
- package/es/layout-single-page/page.js +11 -3
- package/es/pro-table/operation.js +1 -6
- package/es/pro-table/table.js +5 -2
- package/es/table/index.d.ts +0 -2
- package/es/table/index.js +37 -42
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FormProps } from 'antd';
|
|
2
2
|
import { DialogFormRef } from './form';
|
|
3
3
|
import { CcsDialogModalProps } from './hook';
|
|
4
|
-
declare const DialogRequestButton: ({ auth, formRef, extraBtn, formInitialValues, request, onCancel, onRequestBefore, }: Pick<CcsDialogModalProps, "
|
|
4
|
+
declare const DialogRequestButton: ({ auth, formRef, extraBtn, formInitialValues, request, onCancel, onRequestBefore, }: Pick<CcsDialogModalProps, "request" | "auth" | "onCancel" | "extraBtn" | "onRequestBefore"> & {
|
|
5
5
|
formRef: React.RefObject<DialogFormRef>;
|
|
6
6
|
formInitialValues: FormProps['initialValues'];
|
|
7
7
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FormProps } from 'antd';
|
|
2
2
|
import { DialogFormRef } from './form';
|
|
3
3
|
import { CcsDialogModalProps } from './hook';
|
|
4
|
-
declare const DialogSelfOkButton: ({ auth, formRef, extraBtn, formInitialValues, onCancel, onOk, }: Pick<CcsDialogModalProps, "
|
|
4
|
+
declare const DialogSelfOkButton: ({ auth, formRef, extraBtn, formInitialValues, onCancel, onOk, }: Pick<CcsDialogModalProps, "auth" | "onOk" | "onCancel" | "extraBtn"> & {
|
|
5
5
|
formRef: React.RefObject<DialogFormRef>;
|
|
6
6
|
formInitialValues: FormProps['initialValues'];
|
|
7
7
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
onFullScreen?: (isFull: boolean) => void;
|
|
3
|
-
};
|
|
4
|
-
declare const _default: ({ onFullScreen }: PropsType) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
export default _default;
|
|
1
|
+
export default function FullScreen(): import("react/jsx-runtime").JSX.Element;
|
package/es/full-screen/index.js
CHANGED
|
@@ -9,8 +9,7 @@ import { Button, Tooltip } from 'antd';
|
|
|
9
9
|
import { useState } from 'react';
|
|
10
10
|
import { classPrefix } from "../pro-table/table";
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
export default
|
|
13
|
-
var onFullScreen = _ref.onFullScreen;
|
|
12
|
+
export default function FullScreen() {
|
|
14
13
|
var _useState = useState(false),
|
|
15
14
|
_useState2 = _slicedToArray(_useState, 2),
|
|
16
15
|
isFull = _useState2[0],
|
|
@@ -28,7 +27,6 @@ export default (function (_ref) {
|
|
|
28
27
|
}
|
|
29
28
|
var inf = !isFull;
|
|
30
29
|
setIsFull(inf);
|
|
31
|
-
if (onFullScreen) onFullScreen(inf);
|
|
32
30
|
};
|
|
33
31
|
return /*#__PURE__*/_jsx(Tooltip, {
|
|
34
32
|
title: isFull ? '取消全屏' : '全屏',
|
|
@@ -57,4 +55,4 @@ export default (function (_ref) {
|
|
|
57
55
|
className: "ccs-pl-fullbtn"
|
|
58
56
|
})
|
|
59
57
|
});
|
|
60
|
-
}
|
|
58
|
+
}
|
|
@@ -1,5 +1,17 @@
|
|
|
1
|
+
import { JSXElementConstructor, ReactElement } from 'react';
|
|
1
2
|
import CCS from '..';
|
|
3
|
+
import { MenuType } from '../ccs';
|
|
2
4
|
import './index.less';
|
|
5
|
+
export type CacheComponent = {
|
|
6
|
+
key: string;
|
|
7
|
+
label: string;
|
|
8
|
+
locationKey: string;
|
|
9
|
+
urlAuthList: string[];
|
|
10
|
+
timestamp: number;
|
|
11
|
+
outlet: ReactElement<any, string | JSXElementConstructor<any>> | null;
|
|
12
|
+
children?: ReactElement<any, string | JSXElementConstructor<any>> | null;
|
|
13
|
+
breadcrumb: MenuType['breadcrumb'];
|
|
14
|
+
};
|
|
3
15
|
type PropsType = {
|
|
4
16
|
maxLen?: number;
|
|
5
17
|
appName: string;
|
|
@@ -136,7 +136,9 @@ export default function KeepAliveTabs(_ref) {
|
|
|
136
136
|
if (!component) {
|
|
137
137
|
var _ref3 = curMenu || {},
|
|
138
138
|
_ref3$urlAuthList = _ref3.urlAuthList,
|
|
139
|
-
urlAuthList = _ref3$urlAuthList === void 0 ? [] : _ref3$urlAuthList
|
|
139
|
+
urlAuthList = _ref3$urlAuthList === void 0 ? [] : _ref3$urlAuthList,
|
|
140
|
+
_ref3$breadcrumb = _ref3.breadcrumb,
|
|
141
|
+
breadcrumb = _ref3$breadcrumb === void 0 ? [] : _ref3$breadcrumb;
|
|
140
142
|
components.current = [].concat(_toConsumableArray(components.current), [{
|
|
141
143
|
locationKey: locationKey,
|
|
142
144
|
key: pathname,
|
|
@@ -145,7 +147,8 @@ export default function KeepAliveTabs(_ref) {
|
|
|
145
147
|
outlet: curMenu ? outlet : /*#__PURE__*/_jsx(Empty, {
|
|
146
148
|
description: "\u672A\u77E5\u9875\u9762"
|
|
147
149
|
}),
|
|
148
|
-
urlAuthList: urlAuthList
|
|
150
|
+
urlAuthList: urlAuthList,
|
|
151
|
+
breadcrumb: breadcrumb
|
|
149
152
|
}]);
|
|
150
153
|
}
|
|
151
154
|
|
|
@@ -224,13 +227,15 @@ export default function KeepAliveTabs(_ref) {
|
|
|
224
227
|
var key = _ref4.key,
|
|
225
228
|
urlAuthList = _ref4.urlAuthList,
|
|
226
229
|
timestamp = _ref4.timestamp,
|
|
227
|
-
outlet = _ref4.outlet
|
|
230
|
+
outlet = _ref4.outlet,
|
|
231
|
+
breadcrumb = _ref4.breadcrumb;
|
|
228
232
|
return /*#__PURE__*/_jsx(Page, {
|
|
229
233
|
active: key === pathname,
|
|
230
234
|
location: location,
|
|
231
235
|
onDestroy: onDestroy,
|
|
232
236
|
urlAuthList: urlAuthList,
|
|
233
237
|
timestamp: timestamp,
|
|
238
|
+
breadcrumb: breadcrumb,
|
|
234
239
|
children: outlet
|
|
235
240
|
}, key);
|
|
236
241
|
})]
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { Location } from 'react-router';
|
|
3
|
-
|
|
3
|
+
import { CacheComponent } from '.';
|
|
4
|
+
export type CachePageProps = Pick<CacheComponent, 'breadcrumb' | 'urlAuthList' | 'children' | 'timestamp'> & {
|
|
4
5
|
/** 选中状态 */
|
|
5
6
|
active: boolean;
|
|
6
7
|
/** router location */
|
|
7
8
|
location: Location;
|
|
8
|
-
/** 时间戳 */
|
|
9
|
-
timestamp: number;
|
|
10
|
-
/** 按钮权限列表 */
|
|
11
|
-
urlAuthList: string[];
|
|
12
|
-
/** children */
|
|
13
|
-
children: ReactElement<any, string | JSXElementConstructor<any>> | null;
|
|
14
9
|
/** 销毁页面 */
|
|
15
10
|
onDestroy: (path: string) => void;
|
|
16
11
|
};
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
+
import { Breadcrumb } from 'antd';
|
|
1
2
|
import classNames from 'classnames';
|
|
2
3
|
import { memo, useRef } from 'react';
|
|
3
4
|
import Scrollbars from 'react-custom-scrollbars';
|
|
4
5
|
import { PageContext } from "../context";
|
|
5
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
8
|
export default /*#__PURE__*/memo(function (props) {
|
|
7
9
|
var locationRef = useRef(props.location);
|
|
8
10
|
var children = props.children,
|
|
9
11
|
active = props.active,
|
|
10
12
|
urlAuthList = props.urlAuthList,
|
|
11
|
-
onDestroy = props.onDestroy
|
|
13
|
+
onDestroy = props.onDestroy,
|
|
14
|
+
breadcrumb = props.breadcrumb;
|
|
12
15
|
var id = "_tab_content_".concat(locationRef.current.key);
|
|
13
16
|
return /*#__PURE__*/_jsx(PageContext.Provider, {
|
|
14
17
|
value: {
|
|
@@ -27,12 +30,15 @@ export default /*#__PURE__*/memo(function (props) {
|
|
|
27
30
|
},
|
|
28
31
|
className: "ccs-tab-item",
|
|
29
32
|
"data-display": active,
|
|
30
|
-
children: /*#__PURE__*/
|
|
33
|
+
children: /*#__PURE__*/_jsxs(Scrollbars, {
|
|
31
34
|
autoHide: true,
|
|
32
35
|
className: classNames('ccs-table-item-scroll', {
|
|
33
36
|
'route-avtive': active
|
|
34
37
|
}),
|
|
35
|
-
children:
|
|
38
|
+
children: [/*#__PURE__*/_jsx(Breadcrumb, {
|
|
39
|
+
items: breadcrumb,
|
|
40
|
+
className: "ccs-breadcrumb"
|
|
41
|
+
}), children]
|
|
36
42
|
})
|
|
37
43
|
})
|
|
38
44
|
});
|
|
@@ -1,42 +1,19 @@
|
|
|
1
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
7
|
-
import { useUpdate, useUpdateEffect } from 'ahooks';
|
|
8
|
-
import { Breadcrumb } from 'antd';
|
|
9
1
|
import classnames from 'classnames';
|
|
10
|
-
import { useMemo
|
|
2
|
+
import { useMemo } from 'react';
|
|
11
3
|
import { useLocation } from 'react-router';
|
|
12
4
|
import { useOutlet } from 'react-router-dom';
|
|
13
5
|
import CcsResult from "../result";
|
|
14
6
|
import "./index.less";
|
|
15
7
|
import Page from "./page";
|
|
16
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
9
|
export default function SinglePage(_ref) {
|
|
19
10
|
var appName = _ref.appName,
|
|
20
11
|
_ref$menus = _ref.menus,
|
|
21
12
|
menus = _ref$menus === void 0 ? [] : _ref$menus,
|
|
22
13
|
className = _ref.className;
|
|
23
|
-
var components = useRef([]);
|
|
24
14
|
var location = useLocation();
|
|
25
15
|
var pathname = location.pathname;
|
|
26
16
|
var outlet = useOutlet();
|
|
27
|
-
var update = useUpdate();
|
|
28
|
-
|
|
29
|
-
// 菜单改变,更新用户权限信息
|
|
30
|
-
useUpdateEffect(function () {
|
|
31
|
-
components.current.forEach(function (component) {
|
|
32
|
-
var menu = menus.find(function (m) {
|
|
33
|
-
return m.menuUrl === component.key;
|
|
34
|
-
});
|
|
35
|
-
component.urlAuthList = (menu === null || menu === void 0 ? void 0 : menu.urlAuthList) || [];
|
|
36
|
-
component.timestamp = new Date().getTime();
|
|
37
|
-
});
|
|
38
|
-
update();
|
|
39
|
-
}, [menus]);
|
|
40
17
|
|
|
41
18
|
// 当前菜单
|
|
42
19
|
var menuInfo = useMemo(function () {
|
|
@@ -55,32 +32,22 @@ export default function SinglePage(_ref) {
|
|
|
55
32
|
}, 10);
|
|
56
33
|
return {
|
|
57
34
|
auth: menu.urlAuthList || [],
|
|
58
|
-
|
|
35
|
+
breadcrumb: menu.breadcrumb,
|
|
59
36
|
menu: menu
|
|
60
37
|
};
|
|
61
38
|
}, [pathname, menus]);
|
|
62
|
-
return /*#__PURE__*/
|
|
39
|
+
return /*#__PURE__*/_jsx("div", {
|
|
63
40
|
className: classnames(className, "ccs-single-page"),
|
|
64
|
-
children:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
location: location,
|
|
76
|
-
urlAuthList: menuInfo.auth,
|
|
77
|
-
children: outlet
|
|
78
|
-
}) : /*#__PURE__*/_jsx(CcsResult.NotFound, {
|
|
79
|
-
style: {
|
|
80
|
-
marginTop: 100
|
|
81
|
-
},
|
|
82
|
-
iconWidth: 200
|
|
83
|
-
})
|
|
84
|
-
})]
|
|
41
|
+
children: menuInfo !== null && menuInfo !== void 0 && menuInfo.auth ? /*#__PURE__*/_jsx(Page, {
|
|
42
|
+
location: location,
|
|
43
|
+
urlAuthList: menuInfo.auth,
|
|
44
|
+
breadcrumb: menuInfo.breadcrumb,
|
|
45
|
+
children: outlet
|
|
46
|
+
}) : /*#__PURE__*/_jsx(CcsResult.NotFound, {
|
|
47
|
+
style: {
|
|
48
|
+
marginTop: 100
|
|
49
|
+
},
|
|
50
|
+
iconWidth: 200
|
|
51
|
+
})
|
|
85
52
|
});
|
|
86
53
|
}
|
|
@@ -3,37 +3,10 @@
|
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-direction: column;
|
|
5
5
|
|
|
6
|
-
.page-breadcrumb {
|
|
7
|
-
position: relative;
|
|
8
|
-
flex: 0 0 34px;
|
|
9
|
-
line-height: 34px;
|
|
10
|
-
|
|
11
|
-
&::after {
|
|
12
|
-
content: '';
|
|
13
|
-
position: absolute;
|
|
14
|
-
left: 0;
|
|
15
|
-
right: 0;
|
|
16
|
-
top: 0;
|
|
17
|
-
bottom: 0;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.breadcrumb-name {
|
|
22
|
-
padding: 6px 16px;
|
|
23
|
-
position: absolute;
|
|
24
|
-
left: 0;
|
|
25
|
-
right: 0;
|
|
26
|
-
top: 0;
|
|
27
|
-
bottom: 0;
|
|
28
|
-
z-index: 11;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.page-content {
|
|
32
|
-
flex: 1 1 auto;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
6
|
.ccs-table-item-scroll > div {
|
|
36
7
|
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
padding: 16px;
|
|
37
10
|
}
|
|
38
11
|
}
|
|
39
12
|
|
|
@@ -41,39 +14,8 @@
|
|
|
41
14
|
.page-content {
|
|
42
15
|
background-color: #fff;
|
|
43
16
|
}
|
|
44
|
-
|
|
45
|
-
.page-breadcrumb {
|
|
46
|
-
position: relative;
|
|
47
|
-
flex: 0 0 34px;
|
|
48
|
-
line-height: 34px;
|
|
49
|
-
|
|
50
|
-
&::after {
|
|
51
|
-
background: #fff;
|
|
52
|
-
opacity: 0.1;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.breadcrumb-name {
|
|
57
|
-
.ant-breadcrumb,
|
|
58
|
-
.ant-breadcrumb-separator,
|
|
59
|
-
.ant-breadcrumb-link {
|
|
60
|
-
color: rgba(255, 255, 255, 85%);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
17
|
}
|
|
64
18
|
|
|
65
|
-
.
|
|
66
|
-
|
|
67
|
-
&::after {
|
|
68
|
-
background-color: #fff;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.dark-theme {
|
|
74
|
-
.page-breadcrumb {
|
|
75
|
-
&::after {
|
|
76
|
-
background-color: #252525;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
19
|
+
.ccs-breadcrumb {
|
|
20
|
+
margin-bottom: 10px;
|
|
79
21
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { JSXElementConstructor, ReactElement } from 'react';
|
|
2
2
|
import { Location } from 'react-router';
|
|
3
|
-
|
|
3
|
+
import { MenuType } from '../ccs';
|
|
4
|
+
export type SinglePageProps = Pick<MenuType, 'breadcrumb' | 'urlAuthList'> & {
|
|
4
5
|
/** router location */
|
|
5
6
|
location: Location;
|
|
6
|
-
/** 按钮权限列表 */
|
|
7
|
-
urlAuthList: string[];
|
|
8
7
|
/** children */
|
|
9
8
|
children: ReactElement<any, string | JSXElementConstructor<any>> | null;
|
|
10
9
|
};
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
+
import { Breadcrumb } from 'antd';
|
|
1
2
|
import { memo, useRef } from 'react';
|
|
2
3
|
import Scrollbars from 'react-custom-scrollbars';
|
|
3
4
|
import { PageContext } from "../context";
|
|
4
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
7
|
export default /*#__PURE__*/memo(function (props) {
|
|
6
8
|
var locationRef = useRef(props.location);
|
|
7
9
|
var children = props.children,
|
|
8
|
-
urlAuthList = props.urlAuthList
|
|
10
|
+
_props$urlAuthList = props.urlAuthList,
|
|
11
|
+
urlAuthList = _props$urlAuthList === void 0 ? [] : _props$urlAuthList,
|
|
12
|
+
_props$breadcrumb = props.breadcrumb,
|
|
13
|
+
breadcrumb = _props$breadcrumb === void 0 ? [] : _props$breadcrumb;
|
|
9
14
|
return /*#__PURE__*/_jsx(PageContext.Provider, {
|
|
10
15
|
value: {
|
|
11
16
|
id: '',
|
|
@@ -18,10 +23,13 @@ export default /*#__PURE__*/memo(function (props) {
|
|
|
18
23
|
return urlAuthList.includes(e);
|
|
19
24
|
}
|
|
20
25
|
},
|
|
21
|
-
children: /*#__PURE__*/
|
|
26
|
+
children: /*#__PURE__*/_jsxs(Scrollbars, {
|
|
22
27
|
autoHide: true,
|
|
23
28
|
className: "ccs-table-item-scroll",
|
|
24
|
-
children:
|
|
29
|
+
children: [/*#__PURE__*/_jsx(Breadcrumb, {
|
|
30
|
+
items: breadcrumb,
|
|
31
|
+
className: "ccs-breadcrumb"
|
|
32
|
+
}), children]
|
|
25
33
|
})
|
|
26
34
|
});
|
|
27
35
|
});
|
|
@@ -123,9 +123,6 @@ export default function TableOperation(_ref) {
|
|
|
123
123
|
})]
|
|
124
124
|
});
|
|
125
125
|
};
|
|
126
|
-
var onFullScreen = function onFullScreen() {
|
|
127
|
-
// tableRef.current?.onFullScreen();
|
|
128
|
-
};
|
|
129
126
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
130
127
|
children: [/*#__PURE__*/_jsx(Tooltip, {
|
|
131
128
|
title: "\u91CD\u7F6E",
|
|
@@ -190,8 +187,6 @@ export default function TableOperation(_ref) {
|
|
|
190
187
|
}
|
|
191
188
|
})
|
|
192
189
|
})
|
|
193
|
-
}), !isInModalOrDrawer && /*#__PURE__*/_jsx(CcsFullScreenButton, {
|
|
194
|
-
onFullScreen: onFullScreen
|
|
195
|
-
})]
|
|
190
|
+
}), !isInModalOrDrawer && /*#__PURE__*/_jsx(CcsFullScreenButton, {})]
|
|
196
191
|
});
|
|
197
192
|
}
|
package/es/pro-table/table.js
CHANGED
|
@@ -123,8 +123,11 @@ var InternalProTable = function InternalProTable(props) {
|
|
|
123
123
|
// 监听容器尺寸变化
|
|
124
124
|
var size = useSize(containerRef);
|
|
125
125
|
useEffect(function () {
|
|
126
|
-
var _table$scroll,
|
|
127
|
-
if ((table === null || table === void 0 || (_table$scroll = table.scroll) === null || _table$scroll === void 0 ? void 0 : _table$scroll.y) === 'auto'
|
|
126
|
+
var _table$scroll, _tableContentRef$curr;
|
|
127
|
+
if ((table === null || table === void 0 || (_table$scroll = table.scroll) === null || _table$scroll === void 0 ? void 0 : _table$scroll.y) === 'auto' && ((_tableContentRef$curr = tableContentRef.current) === null || _tableContentRef$curr === void 0 ? void 0 : _tableContentRef$curr.clientHeight) !== 0) {
|
|
128
|
+
var _tableRef$current;
|
|
129
|
+
(_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 || _tableRef$current.onFixedThead();
|
|
130
|
+
}
|
|
128
131
|
}, [size === null || size === void 0 ? void 0 : size.height]);
|
|
129
132
|
|
|
130
133
|
// 获取数据
|
package/es/table/index.d.ts
CHANGED
package/es/table/index.js
CHANGED
|
@@ -11,7 +11,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
11
11
|
import { useDebounceFn, useUpdate } from 'ahooks';
|
|
12
12
|
import { Table, Tooltip, theme } from 'antd';
|
|
13
13
|
import classNames from 'classnames';
|
|
14
|
-
import { useEffect, useImperativeHandle
|
|
14
|
+
import { useEffect, useImperativeHandle } from 'react';
|
|
15
15
|
import { Resizable } from 'react-resizable';
|
|
16
16
|
import "./index.less";
|
|
17
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -57,9 +57,6 @@ var CustomTable = function CustomTable(props) {
|
|
|
57
57
|
className = _props$className === void 0 ? '' : _props$className,
|
|
58
58
|
tableContentRef = props.tableContentRef,
|
|
59
59
|
restProps = _objectWithoutProperties(props, _excluded2);
|
|
60
|
-
|
|
61
|
-
// 固定表头获取table可视高度
|
|
62
|
-
var ref = useRef(null);
|
|
63
60
|
var update = useUpdate();
|
|
64
61
|
var _ref = data || DEFAULT_PAGE,
|
|
65
62
|
totalNum = _ref.totalNum,
|
|
@@ -70,18 +67,20 @@ var CustomTable = function CustomTable(props) {
|
|
|
70
67
|
// table 固定表头,内容滚动
|
|
71
68
|
var _useDebounceFn = useDebounceFn(function () {
|
|
72
69
|
if ((scroll === null || scroll === void 0 ? void 0 : scroll.y) === 'auto') {
|
|
73
|
-
var
|
|
74
|
-
var
|
|
70
|
+
var _tableContentRef$curr;
|
|
71
|
+
var tableTarget = tableContentRef === null || tableContentRef === void 0 ? void 0 : tableContentRef.current;
|
|
72
|
+
if (!tableTarget) return;
|
|
73
|
+
var tableBody = tableTarget.getElementsByClassName('ant-table-body')[0];
|
|
75
74
|
if (!tableBody) return;
|
|
76
75
|
var headerHeight = 0,
|
|
77
76
|
pageHeight = 0,
|
|
78
77
|
footerHeight = 0;
|
|
79
|
-
var _pagination =
|
|
78
|
+
var _pagination = tableTarget.getElementsByClassName('ant-pagination');
|
|
80
79
|
if (_pagination && _pagination.length > 0) {
|
|
81
80
|
pageHeight = _pagination[0].clientHeight;
|
|
82
81
|
}
|
|
83
|
-
var header =
|
|
84
|
-
var footer =
|
|
82
|
+
var header = tableTarget.getElementsByClassName('ant-table-header');
|
|
83
|
+
var footer = tableTarget.getElementsByClassName('ant-table-footer');
|
|
85
84
|
if (footer && footer.length > 0) {
|
|
86
85
|
footerHeight = footer[0].clientHeight;
|
|
87
86
|
}
|
|
@@ -116,7 +115,6 @@ var CustomTable = function CustomTable(props) {
|
|
|
116
115
|
});
|
|
117
116
|
update();
|
|
118
117
|
},
|
|
119
|
-
onFullScreen: onFixedThead,
|
|
120
118
|
onFixedThead: onFixedThead
|
|
121
119
|
};
|
|
122
120
|
});
|
|
@@ -184,39 +182,36 @@ var CustomTable = function CustomTable(props) {
|
|
|
184
182
|
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
185
183
|
background: token.colorBgContainer
|
|
186
184
|
}),
|
|
187
|
-
children: /*#__PURE__*/_jsx(
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
header: {
|
|
211
|
-
cell: ResizableTitle
|
|
212
|
-
}
|
|
185
|
+
children: /*#__PURE__*/_jsx(Table, _objectSpread(_objectSpread({
|
|
186
|
+
rowKey: rowKey,
|
|
187
|
+
dataSource: result,
|
|
188
|
+
pagination: pagination === false ? false : _objectSpread({
|
|
189
|
+
total: totalNum,
|
|
190
|
+
pageSize: pageSize,
|
|
191
|
+
current: pageNo,
|
|
192
|
+
showSizeChanger: true,
|
|
193
|
+
showQuickJumper: true,
|
|
194
|
+
showTotal: function showTotal() {
|
|
195
|
+
return "\u5171".concat(totalNum, "\u6761\u8BB0\u5F55");
|
|
196
|
+
},
|
|
197
|
+
pageSizeOptions: ['10', '20', '30', '50', '100'],
|
|
198
|
+
size: restProps.size === 'small' ? 'small' : 'default',
|
|
199
|
+
simple: restProps.size === 'small'
|
|
200
|
+
}, pagination),
|
|
201
|
+
rowSelection: rowSelection ? _objectSpread(_objectSpread({}, rowSelection), {}, {
|
|
202
|
+
columnWidth: 60
|
|
203
|
+
}) : undefined,
|
|
204
|
+
columns: filterColumns(),
|
|
205
|
+
components: {
|
|
206
|
+
header: {
|
|
207
|
+
cell: ResizableTitle
|
|
213
208
|
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
})
|
|
209
|
+
}
|
|
210
|
+
}, restProps), {}, {
|
|
211
|
+
size: restProps.size || 'middle',
|
|
212
|
+
className: classNames(_defineProperty(_defineProperty(_defineProperty({}, 'ccs-table-nodata', !result || result.length === 0), 'ccs-table-wrapper', !rowSelection), "className", className)),
|
|
213
|
+
scroll: scroll
|
|
214
|
+
}))
|
|
220
215
|
});
|
|
221
216
|
};
|
|
222
217
|
export default CustomTable;
|