@hw-component/table 1.6.7 → 1.6.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/es/DialogTable/Content.d.ts +3 -0
- package/es/DialogTable/Content.js +34 -0
- package/es/DialogTable/DwTable.d.ts +3 -0
- package/es/DialogTable/DwTable.js +121 -0
- package/{lib/ModalTable/index.d.ts → es/DialogTable/ModalTable.d.ts} +1 -1
- package/es/{ModalTable/index.js → DialogTable/ModalTable.js} +14 -9
- package/es/HTableBody/Options/utils.d.ts +1 -1
- package/es/index.css +11 -0
- package/es/index.d.ts +3 -2
- package/es/index.js +3 -2
- package/es/modal.d.ts +10 -0
- package/es/render/CopyComponent.d.ts +9 -0
- package/es/render/CopyComponent.js +26 -0
- package/es/render/Text.d.ts +2 -0
- package/es/render/config.js +9 -12
- package/lib/DialogTable/Content.d.ts +3 -0
- package/lib/DialogTable/Content.js +37 -0
- package/lib/DialogTable/DwTable.d.ts +3 -0
- package/lib/DialogTable/DwTable.js +124 -0
- package/{es/ModalTable/index.d.ts → lib/DialogTable/ModalTable.d.ts} +1 -1
- package/lib/{ModalTable/index.js → DialogTable/ModalTable.js} +14 -9
- package/lib/HTableBody/Options/utils.d.ts +1 -1
- package/lib/index.css +11 -0
- package/lib/index.d.ts +3 -2
- package/lib/index.js +5 -3
- package/lib/modal.d.ts +10 -0
- package/lib/render/CopyComponent.d.ts +9 -0
- package/lib/render/CopyComponent.js +29 -0
- package/lib/render/Text.d.ts +2 -0
- package/lib/render/config.js +8 -11
- package/package.json +1 -1
- package/src/components/DialogTable/Content.tsx +15 -0
- package/src/components/DialogTable/DwTable.tsx +90 -0
- package/src/components/{ModalTable/index.tsx → DialogTable/ModalTable.tsx} +10 -7
- package/src/components/{ModalTable → DialogTable}/hooks.ts +0 -1
- package/src/components/index.less +14 -0
- package/src/components/index.tsx +3 -2
- package/src/components/modal.ts +11 -0
- package/src/components/render/CopyComponent.tsx +24 -0
- package/src/components/render/Text.tsx +8 -0
- package/src/components/render/config.tsx +9 -14
- package/src/pages/DwTable/index.tsx +152 -0
- package/src/pages/ModalTable/index.tsx +8 -0
- package/src/pages/Table/index.tsx +15 -3
- package/src/routes.tsx +7 -0
- /package/es/{ModalTable → DialogTable}/hooks.d.ts +0 -0
- /package/es/{ModalTable → DialogTable}/hooks.js +0 -0
- /package/lib/{ModalTable → DialogTable}/hooks.d.ts +0 -0
- /package/lib/{ModalTable → DialogTable}/hooks.js +0 -0
package/lib/index.css
CHANGED
|
@@ -106,6 +106,9 @@
|
|
|
106
106
|
.ant-hw-table-pointer:hover {
|
|
107
107
|
color: #1890ff;
|
|
108
108
|
}
|
|
109
|
+
.ant-hw-table-pointer-not-hover {
|
|
110
|
+
cursor: pointer;
|
|
111
|
+
}
|
|
109
112
|
.ant-hw-table-header-title-box {
|
|
110
113
|
-webkit-box-flex: 1;
|
|
111
114
|
-webkit-flex: 1;
|
|
@@ -118,3 +121,11 @@
|
|
|
118
121
|
position: relative;
|
|
119
122
|
margin-right: 12px;
|
|
120
123
|
}
|
|
124
|
+
.ant-hw-table-render-copy {
|
|
125
|
+
margin-bottom: 0 !important;
|
|
126
|
+
color: #1890ff !important;
|
|
127
|
+
cursor: pointer;
|
|
128
|
+
}
|
|
129
|
+
.ant-hw-table-render-text-basic {
|
|
130
|
+
width: 100%;
|
|
131
|
+
}
|
package/lib/index.d.ts
CHANGED
|
@@ -8,5 +8,6 @@ export { default as HTableBody } from "./HTableBody";
|
|
|
8
8
|
export { default as HTableFooter } from "./HTableFooter";
|
|
9
9
|
export { default as HTableHeader } from "./HTableHeader";
|
|
10
10
|
export { default as HTablePagination } from "./HTablePagination";
|
|
11
|
-
export { default as HModalTable } from "./ModalTable";
|
|
12
|
-
export { useHDialogTable } from "./
|
|
11
|
+
export { default as HModalTable } from "./DialogTable/ModalTable";
|
|
12
|
+
export { useHDialogTable } from "./DialogTable/hooks";
|
|
13
|
+
export { default as DwTable } from "./DialogTable/DwTable";
|
package/lib/index.js
CHANGED
|
@@ -8,8 +8,9 @@ var index = require('./HTableBody/index.js');
|
|
|
8
8
|
var index$1 = require('./HTableFooter/index.js');
|
|
9
9
|
var index$2 = require('./HTableHeader/index.js');
|
|
10
10
|
var index$3 = require('./HTablePagination/index.js');
|
|
11
|
-
var
|
|
12
|
-
var hooks = require('./
|
|
11
|
+
var ModalTable = require('./DialogTable/ModalTable.js');
|
|
12
|
+
var hooks = require('./DialogTable/hooks.js');
|
|
13
|
+
var DwTable = require('./DialogTable/DwTable.js');
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
|
|
@@ -21,6 +22,7 @@ exports.HTableBody = index.default;
|
|
|
21
22
|
exports.HTableFooter = index$1.default;
|
|
22
23
|
exports.HTableHeader = index$2.default;
|
|
23
24
|
exports.HTablePagination = index$3.default;
|
|
24
|
-
exports.HModalTable =
|
|
25
|
+
exports.HModalTable = ModalTable.default;
|
|
25
26
|
exports.useHDialogTable = hooks.useHDialogTable;
|
|
27
|
+
exports.DwTable = DwTable.default;
|
|
26
28
|
// powered by h
|
package/lib/modal.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type { ModalProps } from "antd";
|
|
|
7
7
|
import type { TableProps } from "antd/lib/table";
|
|
8
8
|
import type { AffixProps } from "antd/lib/affix";
|
|
9
9
|
import type { OptionModal } from "./HTableBody";
|
|
10
|
+
import { DrawerProps } from "antd";
|
|
10
11
|
export interface RowObj {
|
|
11
12
|
keys?: React.Key[];
|
|
12
13
|
rowData?: any[];
|
|
@@ -113,12 +114,21 @@ export interface HDiaLogTableInstance {
|
|
|
113
114
|
hide: () => void;
|
|
114
115
|
params: any;
|
|
115
116
|
}
|
|
117
|
+
export interface DwTableProps extends DrawerProps {
|
|
118
|
+
tableProps?: Omit<HTableProps, "configData" | "request">;
|
|
119
|
+
dialogTable?: HDiaLogTableInstance;
|
|
120
|
+
params?: Record<string, any>;
|
|
121
|
+
configData?: HTableProps["configData"];
|
|
122
|
+
request?: HTableProps["request"];
|
|
123
|
+
contentRender?: (node: React.ReactNode) => React.ReactNode;
|
|
124
|
+
}
|
|
116
125
|
export interface ModalTableProps extends ModalProps {
|
|
117
126
|
tableProps?: Omit<HTableProps, "configData" | "request">;
|
|
118
127
|
dialogTable?: HDiaLogTableInstance;
|
|
119
128
|
params?: Record<string, any>;
|
|
120
129
|
configData?: HTableProps["configData"];
|
|
121
130
|
request?: HTableProps["request"];
|
|
131
|
+
contentRender?: (node: React.ReactNode) => React.ReactNode;
|
|
122
132
|
}
|
|
123
133
|
export type ValueTypeConfigRenderFn = (config: ConfigItemModal, itemData: any, index: number, tableInstance: HTableInstance) => React.ReactNode;
|
|
124
134
|
export type ValueTypeConfigModal = Record<string, ValueTypeConfigRenderFn>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { EllipsisConfig } from "antd/lib/typography/Base";
|
|
2
|
+
interface IProps {
|
|
3
|
+
text: string;
|
|
4
|
+
cpText?: string;
|
|
5
|
+
successMsg: string;
|
|
6
|
+
ellipsis?: boolean | EllipsisConfig;
|
|
7
|
+
}
|
|
8
|
+
declare const _default: ({ cpText, text, successMsg, ellipsis }: IProps) => JSX.Element;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var copy = require('copy-to-clipboard');
|
|
7
|
+
var antd = require('antd');
|
|
8
|
+
var index = require('../hooks/index.js');
|
|
9
|
+
|
|
10
|
+
var Paragraph = antd.Typography.Paragraph;
|
|
11
|
+
var CopyComponent = (function (_ref) {
|
|
12
|
+
var cpText = _ref.cpText,
|
|
13
|
+
text = _ref.text,
|
|
14
|
+
successMsg = _ref.successMsg,
|
|
15
|
+
ellipsis = _ref.ellipsis;
|
|
16
|
+
var className = index.useClassName("hw-table-render-copy");
|
|
17
|
+
return jsxRuntime.jsx(Paragraph, {
|
|
18
|
+
ellipsis: ellipsis,
|
|
19
|
+
className: className,
|
|
20
|
+
onClick: function onClick() {
|
|
21
|
+
copy(cpText || text);
|
|
22
|
+
antd.message.success(successMsg);
|
|
23
|
+
},
|
|
24
|
+
children: text
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
exports.default = CopyComponent;
|
|
29
|
+
// powered by h
|
package/lib/render/config.js
CHANGED
|
@@ -14,8 +14,8 @@ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
|
14
14
|
var jsxRuntime = require('react/jsx-runtime');
|
|
15
15
|
var moment = require('moment');
|
|
16
16
|
var TagsComponent = require('./TagsComponent.js');
|
|
17
|
-
var copy = require('copy-to-clipboard');
|
|
18
17
|
var antd = require('antd');
|
|
18
|
+
var CopyComponent = require('./CopyComponent.js');
|
|
19
19
|
|
|
20
20
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
21
21
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -59,7 +59,8 @@ var copyRender = function copyRender(config, itemData) {
|
|
|
59
59
|
title = config.title,
|
|
60
60
|
titleStr = config.titleStr;
|
|
61
61
|
var successMsg = valueTypeProps.successMsg,
|
|
62
|
-
text = valueTypeProps.text
|
|
62
|
+
text = valueTypeProps.text,
|
|
63
|
+
ellipsis = valueTypeProps.ellipsis;
|
|
63
64
|
var msg = successMsg || "\u590D\u5236".concat(title || titleStr, "\u6210\u529F!");
|
|
64
65
|
var tableVal = getTableVal(config, itemData);
|
|
65
66
|
if (!tableVal) {
|
|
@@ -69,15 +70,11 @@ var copyRender = function copyRender(config, itemData) {
|
|
|
69
70
|
if (typeof text === "function") {
|
|
70
71
|
cpText = text(itemData);
|
|
71
72
|
}
|
|
72
|
-
return jsxRuntime.jsx(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
copy(cpText || tableVal);
|
|
78
|
-
antd.message.success(msg);
|
|
79
|
-
},
|
|
80
|
-
children: tableVal
|
|
73
|
+
return jsxRuntime.jsx(CopyComponent.default, {
|
|
74
|
+
ellipsis: ellipsis,
|
|
75
|
+
successMsg: msg,
|
|
76
|
+
text: tableVal,
|
|
77
|
+
cpText: cpText
|
|
81
78
|
});
|
|
82
79
|
};
|
|
83
80
|
var linkRender = function linkRender(config, itemData) {
|
package/package.json
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import Table from "@/components/Table";
|
|
2
|
+
import {ModalTableProps} from "@/components/modal";
|
|
3
|
+
|
|
4
|
+
export default ({tableProps,configData,dialogTable,request,contentRender}:ModalTableProps)=>{
|
|
5
|
+
const node=<Table
|
|
6
|
+
{...tableProps}
|
|
7
|
+
configData={configData || []}
|
|
8
|
+
table={dialogTable}
|
|
9
|
+
request={request}
|
|
10
|
+
affixProps={false}
|
|
11
|
+
/>
|
|
12
|
+
return <>
|
|
13
|
+
{contentRender?contentRender(node):node}
|
|
14
|
+
</>
|
|
15
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import {Drawer} from 'antd';
|
|
2
|
+
import type { DwTableProps } from "../modal";
|
|
3
|
+
import {useCurrentTable, useTableProps, useVisible} from "./hooks";
|
|
4
|
+
import Content from "./Content";
|
|
5
|
+
import {CloseOutlined} from '@ant-design/icons'
|
|
6
|
+
import {useClassName} from "../hooks";
|
|
7
|
+
export default ({
|
|
8
|
+
configData: configDataProps,
|
|
9
|
+
request: requestProps,
|
|
10
|
+
tableProps = {},
|
|
11
|
+
dialogTable,
|
|
12
|
+
visible = false,
|
|
13
|
+
bodyStyle = {},
|
|
14
|
+
onClose,
|
|
15
|
+
afterVisibleChange,
|
|
16
|
+
contentRender,
|
|
17
|
+
width=666,
|
|
18
|
+
...props
|
|
19
|
+
}:DwTableProps)=>{
|
|
20
|
+
const { modalVisible, setModalVisible } = useVisible(visible);
|
|
21
|
+
const className=useClassName('hw-table-pointer-not-hover');
|
|
22
|
+
const { modalTableParams, setModalTableParams } = useTableProps({
|
|
23
|
+
...props,
|
|
24
|
+
configData: configDataProps,
|
|
25
|
+
request: requestProps,
|
|
26
|
+
});
|
|
27
|
+
const currentTable = useCurrentTable({
|
|
28
|
+
show: (showParams) => {
|
|
29
|
+
if (showParams) {
|
|
30
|
+
setModalTableParams((oldParams) => {
|
|
31
|
+
const { configData, request, title, params: oldP } = oldParams;
|
|
32
|
+
const {
|
|
33
|
+
title: showTitle = title,
|
|
34
|
+
configData: showConfigData = configData,
|
|
35
|
+
request: showReq = request,
|
|
36
|
+
params = oldP,
|
|
37
|
+
} = showParams;
|
|
38
|
+
currentTable.params = params;
|
|
39
|
+
return {
|
|
40
|
+
title: showTitle,
|
|
41
|
+
request: showReq,
|
|
42
|
+
configData: showConfigData,
|
|
43
|
+
params,
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
setModalVisible(true);
|
|
48
|
+
},
|
|
49
|
+
hide: () => {
|
|
50
|
+
setModalVisible(false);
|
|
51
|
+
},
|
|
52
|
+
dialogTable,
|
|
53
|
+
});
|
|
54
|
+
const { configData, request, title, params } = modalTableParams;
|
|
55
|
+
const req = request
|
|
56
|
+
? (reqParams) => {
|
|
57
|
+
return request({ ...params, ...reqParams });
|
|
58
|
+
}
|
|
59
|
+
: undefined;
|
|
60
|
+
return <Drawer
|
|
61
|
+
{...props}
|
|
62
|
+
visible={modalVisible}
|
|
63
|
+
onClose={(e) => {
|
|
64
|
+
setModalVisible(false);
|
|
65
|
+
onClose?.(e);
|
|
66
|
+
}}
|
|
67
|
+
destroyOnClose
|
|
68
|
+
title={title}
|
|
69
|
+
closable={false}
|
|
70
|
+
extra={
|
|
71
|
+
<CloseOutlined className={className}/>
|
|
72
|
+
}
|
|
73
|
+
width={width}
|
|
74
|
+
bodyStyle={{ padding: 0, paddingBottom: 12, ...bodyStyle }}
|
|
75
|
+
afterVisibleChange={(visible) => {
|
|
76
|
+
if (!visible){
|
|
77
|
+
currentTable.form.resetFields();
|
|
78
|
+
}
|
|
79
|
+
afterVisibleChange?.(visible);
|
|
80
|
+
}}
|
|
81
|
+
>
|
|
82
|
+
<Content
|
|
83
|
+
contentRender={contentRender}
|
|
84
|
+
tableProps={tableProps}
|
|
85
|
+
configData={configData||[]}
|
|
86
|
+
dialogTable={currentTable}
|
|
87
|
+
request={req}
|
|
88
|
+
/>
|
|
89
|
+
</Drawer>
|
|
90
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Modal } from "antd";
|
|
2
|
-
import Table from "../Table";
|
|
3
2
|
import type { ModalTableProps } from "../modal";
|
|
4
3
|
import { useCurrentTable, useTableProps, useVisible } from "./hooks";
|
|
4
|
+
import Content from './Content';
|
|
5
5
|
export default ({
|
|
6
6
|
configData: configDataProps,
|
|
7
7
|
request: requestProps,
|
|
@@ -11,6 +11,8 @@ export default ({
|
|
|
11
11
|
onCancel,
|
|
12
12
|
bodyStyle = {},
|
|
13
13
|
afterClose,
|
|
14
|
+
contentRender,
|
|
15
|
+
width=666,
|
|
14
16
|
...props
|
|
15
17
|
}: ModalTableProps) => {
|
|
16
18
|
const { modalVisible, setModalVisible } = useVisible(visible);
|
|
@@ -63,18 +65,19 @@ export default ({
|
|
|
63
65
|
}}
|
|
64
66
|
destroyOnClose
|
|
65
67
|
title={title}
|
|
68
|
+
width={width}
|
|
66
69
|
bodyStyle={{ padding: 0, paddingBottom: 12, ...bodyStyle }}
|
|
67
70
|
afterClose={() => {
|
|
68
71
|
currentTable.form.resetFields();
|
|
69
72
|
afterClose?.();
|
|
70
73
|
}}
|
|
71
74
|
>
|
|
72
|
-
<
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
<Content
|
|
76
|
+
contentRender={contentRender}
|
|
77
|
+
tableProps={tableProps}
|
|
78
|
+
configData={configData||[]}
|
|
79
|
+
dialogTable={currentTable}
|
|
80
|
+
request={req}
|
|
78
81
|
/>
|
|
79
82
|
</Modal>
|
|
80
83
|
);
|
|
@@ -107,6 +107,9 @@
|
|
|
107
107
|
color:#1890ff;
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
+
.@{ant-prefix}-hw-table-pointer-not-hover{
|
|
111
|
+
cursor: pointer;
|
|
112
|
+
}
|
|
110
113
|
.@{ant-prefix}-hw-table-header-title-box{
|
|
111
114
|
flex: 1;
|
|
112
115
|
display: flex;
|
|
@@ -114,3 +117,14 @@
|
|
|
114
117
|
margin-right: 12px;
|
|
115
118
|
}
|
|
116
119
|
|
|
120
|
+
.@{ant-prefix}-hw-table-render-copy{
|
|
121
|
+
margin-bottom: 0 !important;
|
|
122
|
+
color:#1890ff !important;
|
|
123
|
+
cursor: pointer;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.@{ant-prefix}-hw-table-render-text-basic{
|
|
127
|
+
width: 100%;
|
|
128
|
+
|
|
129
|
+
}
|
|
130
|
+
|
package/src/components/index.tsx
CHANGED
|
@@ -8,5 +8,6 @@ export { default as HTableBody } from "./HTableBody";
|
|
|
8
8
|
export { default as HTableFooter } from "./HTableFooter";
|
|
9
9
|
export { default as HTableHeader } from "./HTableHeader";
|
|
10
10
|
export { default as HTablePagination } from "./HTablePagination";
|
|
11
|
-
export { default as HModalTable } from "./ModalTable";
|
|
12
|
-
export { useHDialogTable } from "./
|
|
11
|
+
export { default as HModalTable } from "./DialogTable/ModalTable";
|
|
12
|
+
export { useHDialogTable } from "./DialogTable/hooks";
|
|
13
|
+
export { default as DwTable } from "./DialogTable/DwTable";
|
package/src/components/modal.ts
CHANGED
|
@@ -11,6 +11,7 @@ import type { TableProps } from "antd/lib/table";
|
|
|
11
11
|
import type { AffixProps } from "antd/lib/affix";
|
|
12
12
|
import type { OptionModal } from "./HTableBody";
|
|
13
13
|
import { GetRowKey } from "rc-table/lib/interface";
|
|
14
|
+
import {DrawerProps} from "antd";
|
|
14
15
|
|
|
15
16
|
export interface RowObj {
|
|
16
17
|
keys?: React.Key[];
|
|
@@ -146,12 +147,22 @@ export interface HDiaLogTableInstance {
|
|
|
146
147
|
hide: () => void;
|
|
147
148
|
params: any;
|
|
148
149
|
}
|
|
150
|
+
export interface DwTableProps extends DrawerProps{
|
|
151
|
+
tableProps?: Omit<HTableProps, "configData" | "request">;
|
|
152
|
+
dialogTable?: HDiaLogTableInstance;
|
|
153
|
+
params?: Record<string, any>;
|
|
154
|
+
configData?: HTableProps["configData"];
|
|
155
|
+
request?: HTableProps["request"];
|
|
156
|
+
contentRender?:(node:React.ReactNode)=>React.ReactNode;
|
|
157
|
+
}
|
|
158
|
+
|
|
149
159
|
export interface ModalTableProps extends ModalProps {
|
|
150
160
|
tableProps?: Omit<HTableProps, "configData" | "request">;
|
|
151
161
|
dialogTable?: HDiaLogTableInstance;
|
|
152
162
|
params?: Record<string, any>;
|
|
153
163
|
configData?: HTableProps["configData"];
|
|
154
164
|
request?: HTableProps["request"];
|
|
165
|
+
contentRender?:(node:React.ReactNode)=>React.ReactNode;
|
|
155
166
|
}
|
|
156
167
|
|
|
157
168
|
export type ValueTypeConfigRenderFn = (
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import copy from "copy-to-clipboard";
|
|
2
|
+
import {message,Typography} from "antd";
|
|
3
|
+
import {EllipsisConfig} from "antd/lib/typography/Base";
|
|
4
|
+
import {useClassName} from "../hooks";
|
|
5
|
+
const {Paragraph}=Typography;
|
|
6
|
+
interface IProps {
|
|
7
|
+
text:string;
|
|
8
|
+
cpText?:string;
|
|
9
|
+
successMsg:string;
|
|
10
|
+
ellipsis?:boolean | EllipsisConfig;
|
|
11
|
+
}
|
|
12
|
+
export default ({cpText,text,successMsg,ellipsis}:IProps)=>{
|
|
13
|
+
const className=useClassName("hw-table-render-copy");
|
|
14
|
+
return <Paragraph
|
|
15
|
+
ellipsis={ellipsis}
|
|
16
|
+
className={className}
|
|
17
|
+
onClick={() => {
|
|
18
|
+
copy(cpText || text);
|
|
19
|
+
message.success(successMsg);
|
|
20
|
+
}}
|
|
21
|
+
>
|
|
22
|
+
{text}
|
|
23
|
+
</Paragraph>
|
|
24
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import moment from "moment";
|
|
2
2
|
import type { ConfigItemModal, HTableInstance } from "@/components/modal";
|
|
3
3
|
import TagsComponent from "./TagsComponent";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import { Image, Typography, Avatar } from "antd";
|
|
5
|
+
import CopyComponent from "./CopyComponent";
|
|
6
6
|
|
|
7
7
|
const { Link, Paragraph } = Typography;
|
|
8
8
|
const getTableVal = (config: ConfigItemModal, itemData: any) => {
|
|
@@ -42,7 +42,7 @@ const tagsRender = (
|
|
|
42
42
|
};
|
|
43
43
|
const copyRender = (config: ConfigItemModal, itemData: any) => {
|
|
44
44
|
const { valueTypeProps = {}, title, titleStr } = config;
|
|
45
|
-
const { successMsg, text } = valueTypeProps;
|
|
45
|
+
const { successMsg, text ,ellipsis} = valueTypeProps;
|
|
46
46
|
const msg = successMsg || `复制${title || titleStr}成功!`;
|
|
47
47
|
const tableVal = getTableVal(config, itemData);
|
|
48
48
|
if (!tableVal) {
|
|
@@ -52,17 +52,12 @@ const copyRender = (config: ConfigItemModal, itemData: any) => {
|
|
|
52
52
|
if (typeof text === "function") {
|
|
53
53
|
cpText = text(itemData);
|
|
54
54
|
}
|
|
55
|
-
return
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}}
|
|
62
|
-
>
|
|
63
|
-
{tableVal}
|
|
64
|
-
</Link>
|
|
65
|
-
);
|
|
55
|
+
return <CopyComponent
|
|
56
|
+
ellipsis={ellipsis}
|
|
57
|
+
successMsg={msg}
|
|
58
|
+
text={tableVal}
|
|
59
|
+
cpText={cpText}
|
|
60
|
+
/>
|
|
66
61
|
};
|
|
67
62
|
const linkRender = (config: ConfigItemModal, itemData: any) => {
|
|
68
63
|
const { valueTypeProps = {} } = config;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { Button } from "antd";
|
|
2
|
+
import { DwTable, HTable, useHDialogTable } from "@/components";
|
|
3
|
+
const configData = [
|
|
4
|
+
{
|
|
5
|
+
title: "座位",
|
|
6
|
+
showSearch: true,
|
|
7
|
+
searchType: "select",
|
|
8
|
+
dataIndex: "name",
|
|
9
|
+
itemProps: {
|
|
10
|
+
options: [{ label: "1", value: 1 }],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
title: "操作",
|
|
15
|
+
name: "aaa",
|
|
16
|
+
fixed: "right",
|
|
17
|
+
width: 200,
|
|
18
|
+
showSearch: true,
|
|
19
|
+
render: () => {
|
|
20
|
+
return <div>fff</div>;
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
const req1 = (params) => {
|
|
25
|
+
console.log(params, "req1");
|
|
26
|
+
const { current = 1 } = params;
|
|
27
|
+
return new Promise((resolve, reject) => {
|
|
28
|
+
setTimeout(() => {
|
|
29
|
+
// reject(new Error("错误"));
|
|
30
|
+
resolve({
|
|
31
|
+
size: "10",
|
|
32
|
+
current: current.toString(10),
|
|
33
|
+
total: "100",
|
|
34
|
+
records: [
|
|
35
|
+
{
|
|
36
|
+
id: 1,
|
|
37
|
+
name: "111",
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
});
|
|
41
|
+
}, 2000);
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const req2 = (params) => {
|
|
46
|
+
const { current = 1 } = params;
|
|
47
|
+
console.log("请求")
|
|
48
|
+
return new Promise((resolve, reject) => {
|
|
49
|
+
setTimeout(() => {
|
|
50
|
+
// reject(new Error("错误"));
|
|
51
|
+
resolve({
|
|
52
|
+
size: "10",
|
|
53
|
+
current: current.toString(10),
|
|
54
|
+
total: "100",
|
|
55
|
+
records: [
|
|
56
|
+
{
|
|
57
|
+
id: 1,
|
|
58
|
+
name: "111",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: 2,
|
|
62
|
+
name: "111",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: 3,
|
|
66
|
+
name: "111",
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: 4,
|
|
70
|
+
name: "111",
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: 5,
|
|
74
|
+
name: "111",
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: 6,
|
|
78
|
+
name: "111",
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: 7,
|
|
82
|
+
name: "111",
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: 8,
|
|
86
|
+
name: "111",
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
});
|
|
90
|
+
}, 2000);
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
const Test = () => {
|
|
94
|
+
const dialogTable1 = useHDialogTable();
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<>
|
|
98
|
+
<DwTable
|
|
99
|
+
dialogTable={dialogTable1}
|
|
100
|
+
title="111"
|
|
101
|
+
configData={configData}
|
|
102
|
+
request={req2}
|
|
103
|
+
contentRender={(node)=>{
|
|
104
|
+
return <>
|
|
105
|
+
<div>fsafsfsa</div>
|
|
106
|
+
{node}
|
|
107
|
+
</>
|
|
108
|
+
}}
|
|
109
|
+
/>
|
|
110
|
+
<Button
|
|
111
|
+
onClick={() => {
|
|
112
|
+
dialogTable1.show();
|
|
113
|
+
}}
|
|
114
|
+
>
|
|
115
|
+
点我
|
|
116
|
+
</Button>
|
|
117
|
+
</>
|
|
118
|
+
);
|
|
119
|
+
};
|
|
120
|
+
export default () => {
|
|
121
|
+
const dialogTable = useHDialogTable();
|
|
122
|
+
const dialogTable1 = useHDialogTable();
|
|
123
|
+
return (
|
|
124
|
+
<>
|
|
125
|
+
<Button
|
|
126
|
+
onClick={() => {
|
|
127
|
+
dialogTable.show({ title: "3333", params: { id: 1 } });
|
|
128
|
+
}}
|
|
129
|
+
>
|
|
130
|
+
点我333
|
|
131
|
+
</Button>
|
|
132
|
+
<DwTable
|
|
133
|
+
dialogTable={dialogTable}
|
|
134
|
+
request={req2}
|
|
135
|
+
width={1200}
|
|
136
|
+
configData={configData}
|
|
137
|
+
tableProps={{
|
|
138
|
+
headerTitle: (
|
|
139
|
+
<div
|
|
140
|
+
onClick={() => {
|
|
141
|
+
console.log(dialogTable.params);
|
|
142
|
+
}}
|
|
143
|
+
>
|
|
144
|
+
点我
|
|
145
|
+
</div>
|
|
146
|
+
),
|
|
147
|
+
}}
|
|
148
|
+
/>
|
|
149
|
+
<HTable configData={configData} headerTitle={<Test />} />
|
|
150
|
+
</>
|
|
151
|
+
);
|
|
152
|
+
};
|
|
@@ -44,6 +44,7 @@ const req1 = (params) => {
|
|
|
44
44
|
|
|
45
45
|
const req2 = (params) => {
|
|
46
46
|
const { current = 1 } = params;
|
|
47
|
+
console.log("请求")
|
|
47
48
|
return new Promise((resolve, reject) => {
|
|
48
49
|
setTimeout(() => {
|
|
49
50
|
// reject(new Error("错误"));
|
|
@@ -98,6 +99,13 @@ const Test = () => {
|
|
|
98
99
|
dialogTable={dialogTable1}
|
|
99
100
|
title="111"
|
|
100
101
|
configData={configData}
|
|
102
|
+
request={req2}
|
|
103
|
+
contentRender={(node)=>{
|
|
104
|
+
return <>
|
|
105
|
+
<div>fsafsfsa</div>
|
|
106
|
+
{node}
|
|
107
|
+
</>
|
|
108
|
+
}}
|
|
101
109
|
/>
|
|
102
110
|
<Button
|
|
103
111
|
onClick={() => {
|