xmirror-components 1.0.29 → 1.0.30-alpha.1
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/build/dist/index.cjs +161 -16
- package/build/dist/index.mjs +1756 -1583
- package/build/es/components/Table/Footer/index.d.ts +0 -1
- package/build/es/components/Table/Footer/index.js +20 -17
- package/build/es/components/Table/Footer/styles.d.ts +25 -0
- package/build/es/components/Table/Footer/styles.js +25 -0
- package/build/es/components/Table/PopoverSetColumns/index.d.ts +0 -1
- package/build/es/components/Table/PopoverSetColumns/index.js +2 -2
- package/build/es/components/Table/PopoverSetColumns/styles.d.ts +8 -0
- package/build/es/components/Table/PopoverSetColumns/styles.js +11 -0
- package/build/es/components/Table/index.d.ts +0 -1
- package/build/es/components/Table/index.js +2 -2
- package/build/es/components/Table/styles.d.ts +4 -0
- package/build/es/components/Table/styles.js +7 -0
- package/build/lib/components/Table/Footer/index.js +19 -16
- package/build/lib/components/Table/Footer/styles.js +31 -0
- package/build/lib/components/Table/PopoverSetColumns/index.js +2 -2
- package/build/lib/components/Table/PopoverSetColumns/styles.js +17 -0
- package/build/lib/components/Table/index.js +2 -2
- package/build/lib/components/Table/styles.js +13 -0
- package/build/package.json +1 -1
- package/build/types/components/Table/Footer/index.d.ts +0 -1
- package/build/types/components/Table/Footer/styles.d.ts +25 -0
- package/build/types/components/Table/PopoverSetColumns/index.d.ts +0 -1
- package/build/types/components/Table/PopoverSetColumns/styles.d.ts +8 -0
- package/build/types/components/Table/index.d.ts +0 -1
- package/build/types/components/Table/styles.d.ts +4 -0
- package/package.json +1 -1
- package/build/dist/index.css +0 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React, { useMemo, useRef } from 'react';
|
|
2
2
|
import { FormattedMessage } from 'react-intl';
|
|
3
|
-
import { Checkbox,
|
|
3
|
+
import { Checkbox, Col } from 'antd';
|
|
4
4
|
import { CSSTransition } from 'react-transition-group';
|
|
5
5
|
import { CloseOutlined } from '@ant-design/icons';
|
|
6
|
-
import '
|
|
6
|
+
import { Global } from '@emotion/react';
|
|
7
|
+
import { TableFooterWrapper, TableFooterTotal, StyledRow, CloseButton, zoomStyles, globalStyles } from './styles';
|
|
7
8
|
function Index(props) {
|
|
8
9
|
var _a;
|
|
9
10
|
var transitionNodeRef = useRef(null);
|
|
@@ -67,20 +68,22 @@ function Index(props) {
|
|
|
67
68
|
var selectedRowKeys = (_a = rowSelection.selectedRowKeys) !== null && _a !== void 0 ? _a : [];
|
|
68
69
|
return !!(selectedRowKeys.length > 0 && selectedRowKeys.length === optionalNum);
|
|
69
70
|
}, [rowSelection.selectedRowKeys, optionalNum]);
|
|
70
|
-
return (React.createElement(
|
|
71
|
-
React.createElement(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
React.createElement(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
71
|
+
return (React.createElement(React.Fragment, null,
|
|
72
|
+
React.createElement(Global, { styles: globalStyles }),
|
|
73
|
+
React.createElement(TableFooterWrapper, null,
|
|
74
|
+
React.createElement(CSSTransition, { in: Boolean(props.rowSelection && props.selectionPopover && (checked || indeterminate)), nodeRef: transitionNodeRef, classNames: zoomStyles, unmountOnExit: true, timeout: 300 }, function () {
|
|
75
|
+
var _a, _b;
|
|
76
|
+
return (React.createElement(StyledRow, { ref: transitionNodeRef, justify: "space-between" },
|
|
77
|
+
React.createElement(Col, { style: { display: 'flex', alignItems: 'center' } },
|
|
78
|
+
React.createElement(Checkbox, { checked: checked, indeterminate: indeterminate, onChange: changeCheckAll },
|
|
79
|
+
React.createElement(FormattedMessage, { id: "component.table.selected", defaultMessage: '已选{length}条', values: {
|
|
80
|
+
length: (_b = (_a = rowSelection.selectedRowKeys) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0
|
|
81
|
+
} }))),
|
|
82
|
+
React.createElement(Col, { style: { display: 'flex', alignItems: 'center' } },
|
|
83
|
+
selectionPopover,
|
|
84
|
+
React.createElement(CloseButton, { onClick: function () { changeCheckAll({ target: { checked: false } }); } },
|
|
85
|
+
React.createElement(CloseOutlined, null)))));
|
|
86
|
+
}),
|
|
87
|
+
pagination && (React.createElement(TableFooterTotal, null, pagination.showTotal ? pagination.showTotal((_a = pagination.total) !== null && _a !== void 0 ? _a : 0, [0, 0]) : null)))));
|
|
85
88
|
}
|
|
86
89
|
export default Index;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const TableFooterWrapper: import("@emotion/styled").StyledComponent<{
|
|
2
|
+
theme?: import("@emotion/react").Theme;
|
|
3
|
+
as?: React.ElementType;
|
|
4
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
5
|
+
export declare const TableFooterTotal: import("@emotion/styled").StyledComponent<{
|
|
6
|
+
theme?: import("@emotion/react").Theme;
|
|
7
|
+
as?: React.ElementType;
|
|
8
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
9
|
+
export declare const TableBatchDialog: import("@emotion/styled").StyledComponent<{
|
|
10
|
+
theme?: import("@emotion/react").Theme;
|
|
11
|
+
as?: React.ElementType;
|
|
12
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
13
|
+
export declare const StyledRow: import("@emotion/styled").StyledComponent<import("antd").RowProps & import("react").RefAttributes<HTMLDivElement> & {
|
|
14
|
+
theme?: import("@emotion/react").Theme;
|
|
15
|
+
}, {}, {}>;
|
|
16
|
+
export declare const CloseButton: import("@emotion/styled").StyledComponent<{
|
|
17
|
+
theme?: import("@emotion/react").Theme;
|
|
18
|
+
as?: React.ElementType;
|
|
19
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
20
|
+
export declare const zoomStyles: {
|
|
21
|
+
enter: string;
|
|
22
|
+
enterActive: string;
|
|
23
|
+
leaveActive: string;
|
|
24
|
+
};
|
|
25
|
+
export declare const globalStyles = "\n .zoom-enter {\n transform: scale(0);\n }\n\n .zoom-enter-active {\n transform: scale(1);\n }\n\n .zoom-leave-active {\n transform: scale(0);\n }\n";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
5
|
+
import styled from '@emotion/styled';
|
|
6
|
+
import { Row } from 'antd';
|
|
7
|
+
export var TableFooterWrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: absolute;\n left: 8px;\n"], ["\n position: absolute;\n left: 8px;\n"])));
|
|
8
|
+
export var TableFooterTotal = styled.span(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-size: 14px;\n color: #666;\n"], ["\n font-size: 14px;\n color: #666;\n"])));
|
|
9
|
+
export var TableBatchDialog = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: fixed;\n right: 0;\n bottom: 30px;\n left: 0;\n z-index: 9;\n width: 600px;\n padding: 15px 20px;\n margin: auto;\n color: #fff;\n background-color: #666;\n border-radius: 5px;\n transition: all 0.5s;\n\n .ant-checkbox-wrapper {\n margin-right: 10px;\n color: #fff;\n\n .ant-checkbox-indeterminate .ant-checkbox-inner {\n background-color: transparent;\n border-color: #d9d9d9;\n }\n }\n"], ["\n position: fixed;\n right: 0;\n bottom: 30px;\n left: 0;\n z-index: 9;\n width: 600px;\n padding: 15px 20px;\n margin: auto;\n color: #fff;\n background-color: #666;\n border-radius: 5px;\n transition: all 0.5s;\n\n .ant-checkbox-wrapper {\n margin-right: 10px;\n color: #fff;\n\n .ant-checkbox-indeterminate .ant-checkbox-inner {\n background-color: transparent;\n border-color: #d9d9d9;\n }\n }\n"
|
|
10
|
+
// 包装 Row 组件的样式
|
|
11
|
+
])));
|
|
12
|
+
// 包装 Row 组件的样式
|
|
13
|
+
export var StyledRow = styled(Row)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n position: fixed;\n right: 0;\n bottom: 30px;\n left: 0;\n z-index: 9;\n width: 600px;\n padding: 15px 20px;\n margin: auto;\n color: #fff;\n background-color: #666;\n border-radius: 5px;\n transition: all 0.5s;\n\n .ant-checkbox-wrapper {\n margin-right: 10px;\n color: #fff;\n\n .ant-checkbox-indeterminate .ant-checkbox-inner {\n background-color: transparent;\n border-color: #d9d9d9;\n }\n }\n"], ["\n position: fixed;\n right: 0;\n bottom: 30px;\n left: 0;\n z-index: 9;\n width: 600px;\n padding: 15px 20px;\n margin: auto;\n color: #fff;\n background-color: #666;\n border-radius: 5px;\n transition: all 0.5s;\n\n .ant-checkbox-wrapper {\n margin-right: 10px;\n color: #fff;\n\n .ant-checkbox-indeterminate .ant-checkbox-inner {\n background-color: transparent;\n border-color: #d9d9d9;\n }\n }\n"])));
|
|
14
|
+
export var CloseButton = styled.span(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n margin-left: 20px;\n cursor: pointer;\n opacity: 0.5;\n transition: all 0.5s;\n\n &:hover {\n opacity: 1;\n }\n"], ["\n margin-left: 20px;\n cursor: pointer;\n opacity: 0.5;\n transition: all 0.5s;\n\n &:hover {\n opacity: 1;\n }\n"
|
|
15
|
+
// 动画样式 - 使用 CSS 类名
|
|
16
|
+
])));
|
|
17
|
+
// 动画样式 - 使用 CSS 类名
|
|
18
|
+
export var zoomStyles = {
|
|
19
|
+
enter: 'zoom-enter',
|
|
20
|
+
enterActive: 'zoom-enter-active',
|
|
21
|
+
leaveActive: 'zoom-leave-active'
|
|
22
|
+
};
|
|
23
|
+
// 全局样式注入
|
|
24
|
+
export var globalStyles = "\n .zoom-enter {\n transform: scale(0);\n }\n\n .zoom-enter-active {\n transform: scale(1);\n }\n\n .zoom-leave-active {\n transform: scale(0);\n }\n";
|
|
25
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
|
@@ -14,7 +14,7 @@ import { HolderOutlined } from '@ant-design/icons';
|
|
|
14
14
|
// import { message, IconFont } from 'xmirror-components'
|
|
15
15
|
import { message } from '../../AntdApp';
|
|
16
16
|
import IconFont from '../../IconFont';
|
|
17
|
-
import './
|
|
17
|
+
import { ColumnsSettingWrapper } from './styles';
|
|
18
18
|
function PopoverSetColumns(_a) {
|
|
19
19
|
var order = _a.order, visibleItems = _a.visibleItems, _b = _a.columns, columns = _b === void 0 ? [] : _b, onChangeOrder = _a.onChangeOrder, columnsVisible = _a.columnsVisible, columnsSort = _a.columnsSort, onChangeVisible = _a.onChangeVisible;
|
|
20
20
|
var dragged = useRef(null);
|
|
@@ -160,7 +160,7 @@ function PopoverSetColumns(_a) {
|
|
|
160
160
|
: null;
|
|
161
161
|
});
|
|
162
162
|
}, [order, visibleItems, columns, columnsSort, columnsVisible]);
|
|
163
|
-
return (React.createElement(Popover, { overlayClassName: "table-columns-setting-popover", content: React.createElement(
|
|
163
|
+
return (React.createElement(Popover, { overlayClassName: "table-columns-setting-popover", content: React.createElement(ColumnsSettingWrapper, { onDragOver: dragOver }, renderList), trigger: "click", align: {
|
|
164
164
|
offset: [-60, -14]
|
|
165
165
|
} },
|
|
166
166
|
React.createElement(IconFont, { type: "icon-setting", style: {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const PopoverWrapper: import("@emotion/styled").StyledComponent<{
|
|
2
|
+
theme?: import("@emotion/react").Theme;
|
|
3
|
+
as?: React.ElementType;
|
|
4
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
5
|
+
export declare const ColumnsSettingWrapper: import("@emotion/styled").StyledComponent<{
|
|
6
|
+
theme?: import("@emotion/react").Theme;
|
|
7
|
+
as?: React.ElementType;
|
|
8
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, {}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
5
|
+
import styled from '@emotion/styled';
|
|
6
|
+
import { keyframes } from '@emotion/react';
|
|
7
|
+
var dragUpAnimation = keyframes(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n from {\n margin-top: 0;\n }\n to {\n margin-top: 32px;\n }\n"], ["\n from {\n margin-top: 0;\n }\n to {\n margin-top: 32px;\n }\n"])));
|
|
8
|
+
var dragDownAnimation = keyframes(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n from {\n margin-top: 32px;\n margin-bottom: 0;\n }\n to {\n margin-top: 0;\n margin-bottom: 32px;\n }\n"], ["\n from {\n margin-top: 32px;\n margin-bottom: 0;\n }\n to {\n margin-top: 0;\n margin-bottom: 32px;\n }\n"])));
|
|
9
|
+
export var PopoverWrapper = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n .ant-popover-inner-content {\n max-height: 360px;\n padding: 0;\n overflow-y: auto;\n }\n"], ["\n .ant-popover-inner-content {\n max-height: 360px;\n padding: 0;\n overflow-y: auto;\n }\n"])));
|
|
10
|
+
export var ColumnsSettingWrapper = styled.ul(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n padding: 10px 0;\n\n .drag-up {\n border: solid 2px #ccc;\n animation: ", " ease 0.2s 1;\n animation-fill-mode: forwards;\n }\n\n .drag-down {\n border: solid 2px #ccc;\n animation: ", " ease 0.2s 1;\n animation-fill-mode: forwards;\n }\n\n li {\n width: 150px;\n padding: 5px 12px;\n overflow: hidden;\n text-overflow: ellipsis;\n word-break: keep-all;\n white-space: nowrap;\n user-select: none;\n transition: background-color 0.5s;\n\n .icon-drag {\n margin-right: 10px;\n color: #999;\n cursor: move;\n }\n\n &[draggable=\"false\"] {\n .icon-drag {\n cursor: no-drop;\n opacity: 0.2;\n }\n }\n\n &:hover {\n background-color: #f0f0f0;\n }\n }\n"], ["\n padding: 10px 0;\n\n .drag-up {\n border: solid 2px #ccc;\n animation: ", " ease 0.2s 1;\n animation-fill-mode: forwards;\n }\n\n .drag-down {\n border: solid 2px #ccc;\n animation: ", " ease 0.2s 1;\n animation-fill-mode: forwards;\n }\n\n li {\n width: 150px;\n padding: 5px 12px;\n overflow: hidden;\n text-overflow: ellipsis;\n word-break: keep-all;\n white-space: nowrap;\n user-select: none;\n transition: background-color 0.5s;\n\n .icon-drag {\n margin-right: 10px;\n color: #999;\n cursor: move;\n }\n\n &[draggable=\"false\"] {\n .icon-drag {\n cursor: no-drop;\n opacity: 0.2;\n }\n }\n\n &:hover {\n background-color: #f0f0f0;\n }\n }\n"])), dragUpAnimation, dragDownAnimation);
|
|
11
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { AnyObject, TableComponentProps } from './types';
|
|
3
|
-
import './index.less';
|
|
4
3
|
declare const _default: React.ForwardRefExoticComponent<TableComponentProps<AnyObject> & React.RefAttributes<HTMLDivElement>>;
|
|
5
4
|
export default _default;
|
|
@@ -15,7 +15,7 @@ import { useLocalStorageState } from 'ahooks';
|
|
|
15
15
|
import { DownOutlined } from '@ant-design/icons';
|
|
16
16
|
import PopoverSetColumns from './PopoverSetColumns';
|
|
17
17
|
import Footer from './Footer';
|
|
18
|
-
import './
|
|
18
|
+
import { TableWrapper } from './styles';
|
|
19
19
|
function Index(props, ref) {
|
|
20
20
|
var _a = props.columns, columns = _a === void 0 ? [] : _a, columnsSort = props.columnsSort, columnsVisible = props.columnsVisible, _b = props.tableId, tableId = _b === void 0 ? '' : _b, pagination = props.pagination, dataSource = props.dataSource;
|
|
21
21
|
var pathname = location.pathname;
|
|
@@ -181,7 +181,7 @@ function Index(props, ref) {
|
|
|
181
181
|
useEffect(function () {
|
|
182
182
|
initColumnsSort();
|
|
183
183
|
}, []);
|
|
184
|
-
return (React.createElement(
|
|
184
|
+
return (React.createElement(TableWrapper, { ref: ref },
|
|
185
185
|
React.createElement(Table, __assign({ ref: tableRef, scroll: {
|
|
186
186
|
x: 900
|
|
187
187
|
} }, props, { pagination: paginationProps, columns: renderColumns }))));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
5
|
+
import styled from '@emotion/styled';
|
|
6
|
+
export var TableWrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n\n .ant-pagination-options {\n .ant-select {\n width: auto !important;\n }\n }\n"], ["\n position: relative;\n\n .ant-pagination-options {\n .ant-select {\n width: auto !important;\n }\n }\n"])));
|
|
7
|
+
var templateObject_1;
|
|
@@ -38,7 +38,8 @@ var react_intl_1 = require("react-intl");
|
|
|
38
38
|
var antd_1 = require("antd");
|
|
39
39
|
var react_transition_group_1 = require("react-transition-group");
|
|
40
40
|
var icons_1 = require("@ant-design/icons");
|
|
41
|
-
require("
|
|
41
|
+
var react_2 = require("@emotion/react");
|
|
42
|
+
var styles_1 = require("./styles");
|
|
42
43
|
function Index(props) {
|
|
43
44
|
var _a;
|
|
44
45
|
var transitionNodeRef = (0, react_1.useRef)(null);
|
|
@@ -102,20 +103,22 @@ function Index(props) {
|
|
|
102
103
|
var selectedRowKeys = (_a = rowSelection.selectedRowKeys) !== null && _a !== void 0 ? _a : [];
|
|
103
104
|
return !!(selectedRowKeys.length > 0 && selectedRowKeys.length === optionalNum);
|
|
104
105
|
}, [rowSelection.selectedRowKeys, optionalNum]);
|
|
105
|
-
return (react_1.default.createElement(
|
|
106
|
-
react_1.default.createElement(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
react_1.default.createElement(
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
106
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
107
|
+
react_1.default.createElement(react_2.Global, { styles: styles_1.globalStyles }),
|
|
108
|
+
react_1.default.createElement(styles_1.TableFooterWrapper, null,
|
|
109
|
+
react_1.default.createElement(react_transition_group_1.CSSTransition, { in: Boolean(props.rowSelection && props.selectionPopover && (checked || indeterminate)), nodeRef: transitionNodeRef, classNames: styles_1.zoomStyles, unmountOnExit: true, timeout: 300 }, function () {
|
|
110
|
+
var _a, _b;
|
|
111
|
+
return (react_1.default.createElement(styles_1.StyledRow, { ref: transitionNodeRef, justify: "space-between" },
|
|
112
|
+
react_1.default.createElement(antd_1.Col, { style: { display: 'flex', alignItems: 'center' } },
|
|
113
|
+
react_1.default.createElement(antd_1.Checkbox, { checked: checked, indeterminate: indeterminate, onChange: changeCheckAll },
|
|
114
|
+
react_1.default.createElement(react_intl_1.FormattedMessage, { id: "component.table.selected", defaultMessage: '已选{length}条', values: {
|
|
115
|
+
length: (_b = (_a = rowSelection.selectedRowKeys) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0
|
|
116
|
+
} }))),
|
|
117
|
+
react_1.default.createElement(antd_1.Col, { style: { display: 'flex', alignItems: 'center' } },
|
|
118
|
+
selectionPopover,
|
|
119
|
+
react_1.default.createElement(styles_1.CloseButton, { onClick: function () { changeCheckAll({ target: { checked: false } }); } },
|
|
120
|
+
react_1.default.createElement(icons_1.CloseOutlined, null)))));
|
|
121
|
+
}),
|
|
122
|
+
pagination && (react_1.default.createElement(styles_1.TableFooterTotal, null, pagination.showTotal ? pagination.showTotal((_a = pagination.total) !== null && _a !== void 0 ? _a : 0, [0, 0]) : null)))));
|
|
120
123
|
}
|
|
121
124
|
exports.default = Index;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
+
return cooked;
|
|
5
|
+
};
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.globalStyles = exports.zoomStyles = exports.CloseButton = exports.StyledRow = exports.TableBatchDialog = exports.TableFooterTotal = exports.TableFooterWrapper = void 0;
|
|
11
|
+
var styled_1 = __importDefault(require("@emotion/styled"));
|
|
12
|
+
var antd_1 = require("antd");
|
|
13
|
+
exports.TableFooterWrapper = styled_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: absolute;\n left: 8px;\n"], ["\n position: absolute;\n left: 8px;\n"])));
|
|
14
|
+
exports.TableFooterTotal = styled_1.default.span(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-size: 14px;\n color: #666;\n"], ["\n font-size: 14px;\n color: #666;\n"])));
|
|
15
|
+
exports.TableBatchDialog = styled_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: fixed;\n right: 0;\n bottom: 30px;\n left: 0;\n z-index: 9;\n width: 600px;\n padding: 15px 20px;\n margin: auto;\n color: #fff;\n background-color: #666;\n border-radius: 5px;\n transition: all 0.5s;\n\n .ant-checkbox-wrapper {\n margin-right: 10px;\n color: #fff;\n\n .ant-checkbox-indeterminate .ant-checkbox-inner {\n background-color: transparent;\n border-color: #d9d9d9;\n }\n }\n"], ["\n position: fixed;\n right: 0;\n bottom: 30px;\n left: 0;\n z-index: 9;\n width: 600px;\n padding: 15px 20px;\n margin: auto;\n color: #fff;\n background-color: #666;\n border-radius: 5px;\n transition: all 0.5s;\n\n .ant-checkbox-wrapper {\n margin-right: 10px;\n color: #fff;\n\n .ant-checkbox-indeterminate .ant-checkbox-inner {\n background-color: transparent;\n border-color: #d9d9d9;\n }\n }\n"
|
|
16
|
+
// 包装 Row 组件的样式
|
|
17
|
+
])));
|
|
18
|
+
// 包装 Row 组件的样式
|
|
19
|
+
exports.StyledRow = (0, styled_1.default)(antd_1.Row)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n position: fixed;\n right: 0;\n bottom: 30px;\n left: 0;\n z-index: 9;\n width: 600px;\n padding: 15px 20px;\n margin: auto;\n color: #fff;\n background-color: #666;\n border-radius: 5px;\n transition: all 0.5s;\n\n .ant-checkbox-wrapper {\n margin-right: 10px;\n color: #fff;\n\n .ant-checkbox-indeterminate .ant-checkbox-inner {\n background-color: transparent;\n border-color: #d9d9d9;\n }\n }\n"], ["\n position: fixed;\n right: 0;\n bottom: 30px;\n left: 0;\n z-index: 9;\n width: 600px;\n padding: 15px 20px;\n margin: auto;\n color: #fff;\n background-color: #666;\n border-radius: 5px;\n transition: all 0.5s;\n\n .ant-checkbox-wrapper {\n margin-right: 10px;\n color: #fff;\n\n .ant-checkbox-indeterminate .ant-checkbox-inner {\n background-color: transparent;\n border-color: #d9d9d9;\n }\n }\n"])));
|
|
20
|
+
exports.CloseButton = styled_1.default.span(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n margin-left: 20px;\n cursor: pointer;\n opacity: 0.5;\n transition: all 0.5s;\n\n &:hover {\n opacity: 1;\n }\n"], ["\n margin-left: 20px;\n cursor: pointer;\n opacity: 0.5;\n transition: all 0.5s;\n\n &:hover {\n opacity: 1;\n }\n"
|
|
21
|
+
// 动画样式 - 使用 CSS 类名
|
|
22
|
+
])));
|
|
23
|
+
// 动画样式 - 使用 CSS 类名
|
|
24
|
+
exports.zoomStyles = {
|
|
25
|
+
enter: 'zoom-enter',
|
|
26
|
+
enterActive: 'zoom-enter-active',
|
|
27
|
+
leaveActive: 'zoom-leave-active'
|
|
28
|
+
};
|
|
29
|
+
// 全局样式注入
|
|
30
|
+
exports.globalStyles = "\n .zoom-enter {\n transform: scale(0);\n }\n\n .zoom-enter-active {\n transform: scale(1);\n }\n\n .zoom-leave-active {\n transform: scale(0);\n }\n";
|
|
31
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
|
@@ -52,7 +52,7 @@ var icons_1 = require("@ant-design/icons");
|
|
|
52
52
|
// import { message, IconFont } from 'xmirror-components'
|
|
53
53
|
var AntdApp_1 = require("../../AntdApp");
|
|
54
54
|
var IconFont_1 = __importDefault(require("../../IconFont"));
|
|
55
|
-
require("./
|
|
55
|
+
var styles_1 = require("./styles");
|
|
56
56
|
function PopoverSetColumns(_a) {
|
|
57
57
|
var order = _a.order, visibleItems = _a.visibleItems, _b = _a.columns, columns = _b === void 0 ? [] : _b, onChangeOrder = _a.onChangeOrder, columnsVisible = _a.columnsVisible, columnsSort = _a.columnsSort, onChangeVisible = _a.onChangeVisible;
|
|
58
58
|
var dragged = (0, react_1.useRef)(null);
|
|
@@ -198,7 +198,7 @@ function PopoverSetColumns(_a) {
|
|
|
198
198
|
: null;
|
|
199
199
|
});
|
|
200
200
|
}, [order, visibleItems, columns, columnsSort, columnsVisible]);
|
|
201
|
-
return (react_1.default.createElement(antd_1.Popover, { overlayClassName: "table-columns-setting-popover", content: react_1.default.createElement(
|
|
201
|
+
return (react_1.default.createElement(antd_1.Popover, { overlayClassName: "table-columns-setting-popover", content: react_1.default.createElement(styles_1.ColumnsSettingWrapper, { onDragOver: dragOver }, renderList), trigger: "click", align: {
|
|
202
202
|
offset: [-60, -14]
|
|
203
203
|
} },
|
|
204
204
|
react_1.default.createElement(IconFont_1.default, { type: "icon-setting", style: {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
+
return cooked;
|
|
5
|
+
};
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ColumnsSettingWrapper = exports.PopoverWrapper = void 0;
|
|
11
|
+
var styled_1 = __importDefault(require("@emotion/styled"));
|
|
12
|
+
var react_1 = require("@emotion/react");
|
|
13
|
+
var dragUpAnimation = (0, react_1.keyframes)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n from {\n margin-top: 0;\n }\n to {\n margin-top: 32px;\n }\n"], ["\n from {\n margin-top: 0;\n }\n to {\n margin-top: 32px;\n }\n"])));
|
|
14
|
+
var dragDownAnimation = (0, react_1.keyframes)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n from {\n margin-top: 32px;\n margin-bottom: 0;\n }\n to {\n margin-top: 0;\n margin-bottom: 32px;\n }\n"], ["\n from {\n margin-top: 32px;\n margin-bottom: 0;\n }\n to {\n margin-top: 0;\n margin-bottom: 32px;\n }\n"])));
|
|
15
|
+
exports.PopoverWrapper = styled_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n .ant-popover-inner-content {\n max-height: 360px;\n padding: 0;\n overflow-y: auto;\n }\n"], ["\n .ant-popover-inner-content {\n max-height: 360px;\n padding: 0;\n overflow-y: auto;\n }\n"])));
|
|
16
|
+
exports.ColumnsSettingWrapper = styled_1.default.ul(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n padding: 10px 0;\n\n .drag-up {\n border: solid 2px #ccc;\n animation: ", " ease 0.2s 1;\n animation-fill-mode: forwards;\n }\n\n .drag-down {\n border: solid 2px #ccc;\n animation: ", " ease 0.2s 1;\n animation-fill-mode: forwards;\n }\n\n li {\n width: 150px;\n padding: 5px 12px;\n overflow: hidden;\n text-overflow: ellipsis;\n word-break: keep-all;\n white-space: nowrap;\n user-select: none;\n transition: background-color 0.5s;\n\n .icon-drag {\n margin-right: 10px;\n color: #999;\n cursor: move;\n }\n\n &[draggable=\"false\"] {\n .icon-drag {\n cursor: no-drop;\n opacity: 0.2;\n }\n }\n\n &:hover {\n background-color: #f0f0f0;\n }\n }\n"], ["\n padding: 10px 0;\n\n .drag-up {\n border: solid 2px #ccc;\n animation: ", " ease 0.2s 1;\n animation-fill-mode: forwards;\n }\n\n .drag-down {\n border: solid 2px #ccc;\n animation: ", " ease 0.2s 1;\n animation-fill-mode: forwards;\n }\n\n li {\n width: 150px;\n padding: 5px 12px;\n overflow: hidden;\n text-overflow: ellipsis;\n word-break: keep-all;\n white-space: nowrap;\n user-select: none;\n transition: background-color 0.5s;\n\n .icon-drag {\n margin-right: 10px;\n color: #999;\n cursor: move;\n }\n\n &[draggable=\"false\"] {\n .icon-drag {\n cursor: no-drop;\n opacity: 0.2;\n }\n }\n\n &:hover {\n background-color: #f0f0f0;\n }\n }\n"])), dragUpAnimation, dragDownAnimation);
|
|
17
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
@@ -53,7 +53,7 @@ var ahooks_1 = require("ahooks");
|
|
|
53
53
|
var icons_1 = require("@ant-design/icons");
|
|
54
54
|
var PopoverSetColumns_1 = __importDefault(require("./PopoverSetColumns"));
|
|
55
55
|
var Footer_1 = __importDefault(require("./Footer"));
|
|
56
|
-
require("./
|
|
56
|
+
var styles_1 = require("./styles");
|
|
57
57
|
function Index(props, ref) {
|
|
58
58
|
var _a = props.columns, columns = _a === void 0 ? [] : _a, columnsSort = props.columnsSort, columnsVisible = props.columnsVisible, _b = props.tableId, tableId = _b === void 0 ? '' : _b, pagination = props.pagination, dataSource = props.dataSource;
|
|
59
59
|
var pathname = location.pathname;
|
|
@@ -219,7 +219,7 @@ function Index(props, ref) {
|
|
|
219
219
|
(0, react_1.useEffect)(function () {
|
|
220
220
|
initColumnsSort();
|
|
221
221
|
}, []);
|
|
222
|
-
return (react_1.default.createElement(
|
|
222
|
+
return (react_1.default.createElement(styles_1.TableWrapper, { ref: ref },
|
|
223
223
|
react_1.default.createElement(antd_1.Table, __assign({ ref: tableRef, scroll: {
|
|
224
224
|
x: 900
|
|
225
225
|
} }, props, { pagination: paginationProps, columns: renderColumns }))));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
+
return cooked;
|
|
5
|
+
};
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.TableWrapper = void 0;
|
|
11
|
+
var styled_1 = __importDefault(require("@emotion/styled"));
|
|
12
|
+
exports.TableWrapper = styled_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n\n .ant-pagination-options {\n .ant-select {\n width: auto !important;\n }\n }\n"], ["\n position: relative;\n\n .ant-pagination-options {\n .ant-select {\n width: auto !important;\n }\n }\n"])));
|
|
13
|
+
var templateObject_1;
|
package/build/package.json
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const TableFooterWrapper: import("@emotion/styled").StyledComponent<{
|
|
2
|
+
theme?: import("@emotion/react").Theme;
|
|
3
|
+
as?: React.ElementType;
|
|
4
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
5
|
+
export declare const TableFooterTotal: import("@emotion/styled").StyledComponent<{
|
|
6
|
+
theme?: import("@emotion/react").Theme;
|
|
7
|
+
as?: React.ElementType;
|
|
8
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
9
|
+
export declare const TableBatchDialog: import("@emotion/styled").StyledComponent<{
|
|
10
|
+
theme?: import("@emotion/react").Theme;
|
|
11
|
+
as?: React.ElementType;
|
|
12
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
13
|
+
export declare const StyledRow: import("@emotion/styled").StyledComponent<import("antd").RowProps & import("react").RefAttributes<HTMLDivElement> & {
|
|
14
|
+
theme?: import("@emotion/react").Theme;
|
|
15
|
+
}, {}, {}>;
|
|
16
|
+
export declare const CloseButton: import("@emotion/styled").StyledComponent<{
|
|
17
|
+
theme?: import("@emotion/react").Theme;
|
|
18
|
+
as?: React.ElementType;
|
|
19
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
20
|
+
export declare const zoomStyles: {
|
|
21
|
+
enter: string;
|
|
22
|
+
enterActive: string;
|
|
23
|
+
leaveActive: string;
|
|
24
|
+
};
|
|
25
|
+
export declare const globalStyles = "\n .zoom-enter {\n transform: scale(0);\n }\n\n .zoom-enter-active {\n transform: scale(1);\n }\n\n .zoom-leave-active {\n transform: scale(0);\n }\n";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const PopoverWrapper: import("@emotion/styled").StyledComponent<{
|
|
2
|
+
theme?: import("@emotion/react").Theme;
|
|
3
|
+
as?: React.ElementType;
|
|
4
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
5
|
+
export declare const ColumnsSettingWrapper: import("@emotion/styled").StyledComponent<{
|
|
6
|
+
theme?: import("@emotion/react").Theme;
|
|
7
|
+
as?: React.ElementType;
|
|
8
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, {}>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { AnyObject, TableComponentProps } from './types';
|
|
3
|
-
import './index.less';
|
|
4
3
|
declare const _default: React.ForwardRefExoticComponent<TableComponentProps<AnyObject> & React.RefAttributes<HTMLDivElement>>;
|
|
5
4
|
export default _default;
|
package/package.json
CHANGED
package/build/dist/index.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.table-columns-setting-popover .ant-popover-inner-content{max-height:360px;padding:0;overflow-y:auto}.table-columns-setting-popover .table-columns-setting-wrapper{padding:10px 0}.table-columns-setting-popover .table-columns-setting-wrapper .drag-up{border:solid 2px #ccc;animation:dragup ease .2s 1;animation-fill-mode:forwards}.table-columns-setting-popover .table-columns-setting-wrapper .drag-down{border:solid 2px #ccc;animation:dragdown ease .2s 1;animation-fill-mode:forwards}.table-columns-setting-popover .table-columns-setting-wrapper li{width:150px;padding:5px 12px;overflow:hidden;text-overflow:ellipsis;word-break:keep-all;white-space:nowrap;-webkit-user-select:none;user-select:none;transition:background-color .5s}.table-columns-setting-popover .table-columns-setting-wrapper li .icon-drag{margin-right:10px;color:#999;cursor:move}.table-columns-setting-popover .table-columns-setting-wrapper li[draggable=false] .icon-drag{cursor:no-drop;opacity:.2}.table-columns-setting-popover .table-columns-setting-wrapper li:hover{background-color:#f0f0f0}@keyframes dragup{0%{margin-top:0}to{margin-top:32px}}@keyframes dragdown{0%{margin-top:32px;margin-bottom:0}to{margin-top:0;margin-bottom:32px}}.table-wrapper .table-footer{position:absolute;left:8px}.table-wrapper .table-footer .table-footer-total{font-size:14px;color:#666}.table-wrapper .table-footer .table-batch-dialog{position:fixed;right:0;bottom:30px;left:0;z-index:9;width:600px;padding:15px 20px;margin:auto;color:#fff;background-color:#666;border-radius:5px;transition:all .5s}.table-wrapper .table-footer .table-batch-dialog .ant-checkbox-wrapper{margin-right:10px;color:#fff}.table-wrapper .table-footer .table-batch-dialog .ant-checkbox-wrapper .ant-checkbox-indeterminate .ant-checkbox-inner{background-color:transparent;border-color:#d9d9d9}.table-wrapper .table-footer .table-batch-dialog .btn-close{margin-left:20px;cursor:pointer;opacity:.5;transition:all .5s}.table-wrapper .table-footer .table-batch-dialog .btn-close:hover{opacity:1}.table-wrapper .table-footer .zoom-enter{transform:scale(0)}.table-wrapper .table-footer .zoom-enter-active{transform:scale(1)}.table-wrapper .table-footer .zoom-leave-active{transform:scale(0)}.table-wrapper{position:relative}.table-wrapper .ant-pagination-options .ant-select{width:auto!important}
|