@hw-component/table 1.6.7 → 1.6.8
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/HTableBody/Options/utils.d.ts +1 -1
- package/es/ModalTable/Content.d.ts +3 -0
- package/es/ModalTable/Content.js +34 -0
- package/es/ModalTable/index.d.ts +1 -1
- package/es/ModalTable/index.js +12 -7
- package/es/index.css +8 -0
- package/es/modal.d.ts +1 -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/HTableBody/Options/utils.d.ts +1 -1
- package/lib/ModalTable/Content.d.ts +3 -0
- package/lib/ModalTable/Content.js +37 -0
- package/lib/ModalTable/index.d.ts +1 -1
- package/lib/ModalTable/index.js +12 -7
- package/lib/index.css +8 -0
- package/lib/modal.d.ts +1 -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/ModalTable/Content.tsx +15 -0
- package/src/components/ModalTable/hooks.ts +0 -1
- package/src/components/ModalTable/index.tsx +10 -7
- package/src/components/index.less +11 -0
- package/src/components/modal.ts +1 -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/ModalTable/index.tsx +8 -0
- package/src/pages/Table/index.tsx +15 -3
|
@@ -44,7 +44,7 @@ export declare const getItemValue: (data: ConfigItemModal) => {
|
|
|
44
44
|
status?: "" | "success" | "warning" | "error" | "validating" | undefined;
|
|
45
45
|
help?: React.ReactNode;
|
|
46
46
|
itemProps?: import("@hw-component/form/es/Form/modal").ItemPropsType | undefined;
|
|
47
|
-
helper?:
|
|
47
|
+
helper?: React.ReactNode | import("@hw-component/form/es/Form/modal").HelperModal;
|
|
48
48
|
hover?: string | import("@hw-component/form/es/Form/modal").HoverModal | undefined;
|
|
49
49
|
labelWidth?: number | undefined;
|
|
50
50
|
hide?: boolean | import("@hw-component/form/es/Form/modal").HideModal | undefined;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import _Object$keys from '@babel/runtime-corejs3/core-js/object/keys';
|
|
3
|
+
import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js/object/get-own-property-symbols';
|
|
4
|
+
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js/instance/filter';
|
|
5
|
+
import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptor';
|
|
6
|
+
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js/instance/for-each';
|
|
7
|
+
import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptors';
|
|
8
|
+
import _Object$defineProperties from '@babel/runtime-corejs3/core-js/object/define-properties';
|
|
9
|
+
import _Object$defineProperty from '@babel/runtime-corejs3/core-js/object/define-property';
|
|
10
|
+
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
11
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
12
|
+
import Table from '../Table.js';
|
|
13
|
+
|
|
14
|
+
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; }
|
|
15
|
+
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; }
|
|
16
|
+
var Content = (function (_ref) {
|
|
17
|
+
var tableProps = _ref.tableProps,
|
|
18
|
+
configData = _ref.configData,
|
|
19
|
+
dialogTable = _ref.dialogTable,
|
|
20
|
+
request = _ref.request,
|
|
21
|
+
contentRender = _ref.contentRender;
|
|
22
|
+
var node = jsx(Table, _objectSpread(_objectSpread({}, tableProps), {}, {
|
|
23
|
+
configData: configData || [],
|
|
24
|
+
table: dialogTable,
|
|
25
|
+
request: request,
|
|
26
|
+
affixProps: false
|
|
27
|
+
}));
|
|
28
|
+
return jsx(Fragment, {
|
|
29
|
+
children: contentRender ? contentRender(node) : node
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export { Content as default };
|
|
34
|
+
// powered by hdj
|
package/es/ModalTable/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ModalTableProps } from "../modal";
|
|
2
|
-
declare const _default: ({ configData: configDataProps, request: requestProps, tableProps, dialogTable, visible, onCancel, bodyStyle, afterClose, ...props }: ModalTableProps) => JSX.Element;
|
|
2
|
+
declare const _default: ({ configData: configDataProps, request: requestProps, tableProps, dialogTable, visible, onCancel, bodyStyle, afterClose, contentRender, width, ...props }: ModalTableProps) => JSX.Element;
|
|
3
3
|
export default _default;
|
package/es/ModalTable/index.js
CHANGED
|
@@ -11,10 +11,10 @@ import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
|
11
11
|
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
12
12
|
import { jsx } from 'react/jsx-runtime';
|
|
13
13
|
import { Modal } from 'antd';
|
|
14
|
-
import Table from '../Table.js';
|
|
15
14
|
import { useVisible, useTableProps, useCurrentTable } from './hooks.js';
|
|
15
|
+
import Content from './Content.js';
|
|
16
16
|
|
|
17
|
-
var _excluded = ["configData", "request", "tableProps", "dialogTable", "visible", "onCancel", "bodyStyle", "afterClose"];
|
|
17
|
+
var _excluded = ["configData", "request", "tableProps", "dialogTable", "visible", "onCancel", "bodyStyle", "afterClose", "contentRender", "width"];
|
|
18
18
|
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; }
|
|
19
19
|
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; }
|
|
20
20
|
var index = (function (_ref) {
|
|
@@ -29,6 +29,9 @@ var index = (function (_ref) {
|
|
|
29
29
|
_ref$bodyStyle = _ref.bodyStyle,
|
|
30
30
|
bodyStyle = _ref$bodyStyle === void 0 ? {} : _ref$bodyStyle,
|
|
31
31
|
_afterClose = _ref.afterClose,
|
|
32
|
+
contentRender = _ref.contentRender,
|
|
33
|
+
_ref$width = _ref.width,
|
|
34
|
+
width = _ref$width === void 0 ? 666 : _ref$width,
|
|
32
35
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
33
36
|
var _useVisible = useVisible(visible),
|
|
34
37
|
modalVisible = _useVisible.modalVisible,
|
|
@@ -86,6 +89,7 @@ var index = (function (_ref) {
|
|
|
86
89
|
},
|
|
87
90
|
destroyOnClose: true,
|
|
88
91
|
title: title,
|
|
92
|
+
width: width,
|
|
89
93
|
bodyStyle: _objectSpread({
|
|
90
94
|
padding: 0,
|
|
91
95
|
paddingBottom: 12
|
|
@@ -94,12 +98,13 @@ var index = (function (_ref) {
|
|
|
94
98
|
currentTable.form.resetFields();
|
|
95
99
|
_afterClose === null || _afterClose === void 0 || _afterClose();
|
|
96
100
|
},
|
|
97
|
-
children: jsx(
|
|
101
|
+
children: jsx(Content, {
|
|
102
|
+
contentRender: contentRender,
|
|
103
|
+
tableProps: tableProps,
|
|
98
104
|
configData: configData || [],
|
|
99
|
-
|
|
100
|
-
request: req
|
|
101
|
-
|
|
102
|
-
}))
|
|
105
|
+
dialogTable: currentTable,
|
|
106
|
+
request: req
|
|
107
|
+
})
|
|
103
108
|
}));
|
|
104
109
|
});
|
|
105
110
|
|
package/es/index.css
CHANGED
package/es/modal.d.ts
CHANGED
|
@@ -119,6 +119,7 @@ export interface ModalTableProps extends ModalProps {
|
|
|
119
119
|
params?: Record<string, any>;
|
|
120
120
|
configData?: HTableProps["configData"];
|
|
121
121
|
request?: HTableProps["request"];
|
|
122
|
+
contentRender?: (node: React.ReactNode) => React.ReactNode;
|
|
122
123
|
}
|
|
123
124
|
export type ValueTypeConfigRenderFn = (config: ConfigItemModal, itemData: any, index: number, tableInstance: HTableInstance) => React.ReactNode;
|
|
124
125
|
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,26 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import copy from 'copy-to-clipboard';
|
|
4
|
+
import { Typography, message } from 'antd';
|
|
5
|
+
import { useClassName } from '../hooks/index.js';
|
|
6
|
+
|
|
7
|
+
var Paragraph = Typography.Paragraph;
|
|
8
|
+
var CopyComponent = (function (_ref) {
|
|
9
|
+
var cpText = _ref.cpText,
|
|
10
|
+
text = _ref.text,
|
|
11
|
+
successMsg = _ref.successMsg,
|
|
12
|
+
ellipsis = _ref.ellipsis;
|
|
13
|
+
var className = useClassName("hw-table-render-copy");
|
|
14
|
+
return jsx(Paragraph, {
|
|
15
|
+
ellipsis: ellipsis,
|
|
16
|
+
className: className,
|
|
17
|
+
onClick: function onClick() {
|
|
18
|
+
copy(cpText || text);
|
|
19
|
+
message.success(successMsg);
|
|
20
|
+
},
|
|
21
|
+
children: text
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export { CopyComponent as default };
|
|
26
|
+
// powered by hdj
|
package/es/render/config.js
CHANGED
|
@@ -11,8 +11,8 @@ import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
|
11
11
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
12
12
|
import moment from 'moment';
|
|
13
13
|
import TagsComponent from './TagsComponent.js';
|
|
14
|
-
import
|
|
15
|
-
import
|
|
14
|
+
import { Typography, Image, Avatar } from 'antd';
|
|
15
|
+
import CopyComponent from './CopyComponent.js';
|
|
16
16
|
|
|
17
17
|
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; }
|
|
18
18
|
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; }
|
|
@@ -56,7 +56,8 @@ var copyRender = function copyRender(config, itemData) {
|
|
|
56
56
|
title = config.title,
|
|
57
57
|
titleStr = config.titleStr;
|
|
58
58
|
var successMsg = valueTypeProps.successMsg,
|
|
59
|
-
text = valueTypeProps.text
|
|
59
|
+
text = valueTypeProps.text,
|
|
60
|
+
ellipsis = valueTypeProps.ellipsis;
|
|
60
61
|
var msg = successMsg || "\u590D\u5236".concat(title || titleStr, "\u6210\u529F!");
|
|
61
62
|
var tableVal = getTableVal(config, itemData);
|
|
62
63
|
if (!tableVal) {
|
|
@@ -66,15 +67,11 @@ var copyRender = function copyRender(config, itemData) {
|
|
|
66
67
|
if (typeof text === "function") {
|
|
67
68
|
cpText = text(itemData);
|
|
68
69
|
}
|
|
69
|
-
return jsx(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
copy(cpText || tableVal);
|
|
75
|
-
message.success(msg);
|
|
76
|
-
},
|
|
77
|
-
children: tableVal
|
|
70
|
+
return jsx(CopyComponent, {
|
|
71
|
+
ellipsis: ellipsis,
|
|
72
|
+
successMsg: msg,
|
|
73
|
+
text: tableVal,
|
|
74
|
+
cpText: cpText
|
|
78
75
|
});
|
|
79
76
|
};
|
|
80
77
|
var linkRender = function linkRender(config, itemData) {
|
|
@@ -44,7 +44,7 @@ export declare const getItemValue: (data: ConfigItemModal) => {
|
|
|
44
44
|
status?: "" | "success" | "warning" | "error" | "validating" | undefined;
|
|
45
45
|
help?: React.ReactNode;
|
|
46
46
|
itemProps?: import("@hw-component/form/es/Form/modal").ItemPropsType | undefined;
|
|
47
|
-
helper?:
|
|
47
|
+
helper?: React.ReactNode | import("@hw-component/form/es/Form/modal").HelperModal;
|
|
48
48
|
hover?: string | import("@hw-component/form/es/Form/modal").HoverModal | undefined;
|
|
49
49
|
labelWidth?: number | undefined;
|
|
50
50
|
hide?: boolean | import("@hw-component/form/es/Form/modal").HideModal | undefined;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _Object$keys = require('@babel/runtime-corejs3/core-js/object/keys');
|
|
6
|
+
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js/object/get-own-property-symbols');
|
|
7
|
+
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/filter');
|
|
8
|
+
var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js/object/get-own-property-descriptor');
|
|
9
|
+
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/for-each');
|
|
10
|
+
var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js/object/get-own-property-descriptors');
|
|
11
|
+
var _Object$defineProperties = require('@babel/runtime-corejs3/core-js/object/define-properties');
|
|
12
|
+
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js/object/define-property');
|
|
13
|
+
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
14
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
15
|
+
var Table = require('../Table.js');
|
|
16
|
+
|
|
17
|
+
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; }
|
|
18
|
+
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; }
|
|
19
|
+
var Content = (function (_ref) {
|
|
20
|
+
var tableProps = _ref.tableProps,
|
|
21
|
+
configData = _ref.configData,
|
|
22
|
+
dialogTable = _ref.dialogTable,
|
|
23
|
+
request = _ref.request,
|
|
24
|
+
contentRender = _ref.contentRender;
|
|
25
|
+
var node = jsxRuntime.jsx(Table.default, _objectSpread(_objectSpread({}, tableProps), {}, {
|
|
26
|
+
configData: configData || [],
|
|
27
|
+
table: dialogTable,
|
|
28
|
+
request: request,
|
|
29
|
+
affixProps: false
|
|
30
|
+
}));
|
|
31
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
32
|
+
children: contentRender ? contentRender(node) : node
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
exports.default = Content;
|
|
37
|
+
// powered by h
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ModalTableProps } from "../modal";
|
|
2
|
-
declare const _default: ({ configData: configDataProps, request: requestProps, tableProps, dialogTable, visible, onCancel, bodyStyle, afterClose, ...props }: ModalTableProps) => JSX.Element;
|
|
2
|
+
declare const _default: ({ configData: configDataProps, request: requestProps, tableProps, dialogTable, visible, onCancel, bodyStyle, afterClose, contentRender, width, ...props }: ModalTableProps) => JSX.Element;
|
|
3
3
|
export default _default;
|
package/lib/ModalTable/index.js
CHANGED
|
@@ -14,10 +14,10 @@ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
|
14
14
|
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
15
15
|
var jsxRuntime = require('react/jsx-runtime');
|
|
16
16
|
var antd = require('antd');
|
|
17
|
-
var Table = require('../Table.js');
|
|
18
17
|
var hooks = require('./hooks.js');
|
|
18
|
+
var Content = require('./Content.js');
|
|
19
19
|
|
|
20
|
-
var _excluded = ["configData", "request", "tableProps", "dialogTable", "visible", "onCancel", "bodyStyle", "afterClose"];
|
|
20
|
+
var _excluded = ["configData", "request", "tableProps", "dialogTable", "visible", "onCancel", "bodyStyle", "afterClose", "contentRender", "width"];
|
|
21
21
|
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; }
|
|
22
22
|
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; }
|
|
23
23
|
var index = (function (_ref) {
|
|
@@ -32,6 +32,9 @@ var index = (function (_ref) {
|
|
|
32
32
|
_ref$bodyStyle = _ref.bodyStyle,
|
|
33
33
|
bodyStyle = _ref$bodyStyle === void 0 ? {} : _ref$bodyStyle,
|
|
34
34
|
_afterClose = _ref.afterClose,
|
|
35
|
+
contentRender = _ref.contentRender,
|
|
36
|
+
_ref$width = _ref.width,
|
|
37
|
+
width = _ref$width === void 0 ? 666 : _ref$width,
|
|
35
38
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
36
39
|
var _useVisible = hooks.useVisible(visible),
|
|
37
40
|
modalVisible = _useVisible.modalVisible,
|
|
@@ -89,6 +92,7 @@ var index = (function (_ref) {
|
|
|
89
92
|
},
|
|
90
93
|
destroyOnClose: true,
|
|
91
94
|
title: title,
|
|
95
|
+
width: width,
|
|
92
96
|
bodyStyle: _objectSpread({
|
|
93
97
|
padding: 0,
|
|
94
98
|
paddingBottom: 12
|
|
@@ -97,12 +101,13 @@ var index = (function (_ref) {
|
|
|
97
101
|
currentTable.form.resetFields();
|
|
98
102
|
_afterClose === null || _afterClose === void 0 || _afterClose();
|
|
99
103
|
},
|
|
100
|
-
children: jsxRuntime.jsx(
|
|
104
|
+
children: jsxRuntime.jsx(Content.default, {
|
|
105
|
+
contentRender: contentRender,
|
|
106
|
+
tableProps: tableProps,
|
|
101
107
|
configData: configData || [],
|
|
102
|
-
|
|
103
|
-
request: req
|
|
104
|
-
|
|
105
|
-
}))
|
|
108
|
+
dialogTable: currentTable,
|
|
109
|
+
request: req
|
|
110
|
+
})
|
|
106
111
|
}));
|
|
107
112
|
});
|
|
108
113
|
|
package/lib/index.css
CHANGED
package/lib/modal.d.ts
CHANGED
|
@@ -119,6 +119,7 @@ export interface ModalTableProps extends ModalProps {
|
|
|
119
119
|
params?: Record<string, any>;
|
|
120
120
|
configData?: HTableProps["configData"];
|
|
121
121
|
request?: HTableProps["request"];
|
|
122
|
+
contentRender?: (node: React.ReactNode) => React.ReactNode;
|
|
122
123
|
}
|
|
123
124
|
export type ValueTypeConfigRenderFn = (config: ConfigItemModal, itemData: any, index: number, tableInstance: HTableInstance) => React.ReactNode;
|
|
124
125
|
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
|
+
}
|
|
@@ -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
|
);
|
|
@@ -114,3 +114,14 @@
|
|
|
114
114
|
margin-right: 12px;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
.@{ant-prefix}-hw-table-render-copy{
|
|
118
|
+
margin-bottom: 0 !important;
|
|
119
|
+
color:#1890ff !important;
|
|
120
|
+
cursor: pointer;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.@{ant-prefix}-hw-table-render-text-basic{
|
|
124
|
+
width: 100%;
|
|
125
|
+
|
|
126
|
+
}
|
|
127
|
+
|
package/src/components/modal.ts
CHANGED
|
@@ -152,6 +152,7 @@ export interface ModalTableProps extends ModalProps {
|
|
|
152
152
|
params?: Record<string, any>;
|
|
153
153
|
configData?: HTableProps["configData"];
|
|
154
154
|
request?: HTableProps["request"];
|
|
155
|
+
contentRender?:(node:React.ReactNode)=>React.ReactNode;
|
|
155
156
|
}
|
|
156
157
|
|
|
157
158
|
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;
|
|
@@ -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={() => {
|
|
@@ -31,12 +31,24 @@ export const configData =[
|
|
|
31
31
|
title: '报警联系人名称',
|
|
32
32
|
width: 120,
|
|
33
33
|
dataIndex: 'name',
|
|
34
|
+
valueType: "copy",
|
|
35
|
+
valueTypeProps: {
|
|
36
|
+
ellipsis:{
|
|
37
|
+
rows:1,
|
|
38
|
+
tooltip:true
|
|
39
|
+
}
|
|
40
|
+
}
|
|
34
41
|
},
|
|
35
42
|
{
|
|
36
43
|
title:"短信接收手机号",
|
|
37
44
|
dataIndex: 'mobileList',
|
|
38
45
|
width: 120,
|
|
39
46
|
valueType:"tags",
|
|
47
|
+
valueTypeProps:{
|
|
48
|
+
fieldNames:{
|
|
49
|
+
label:"name"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
40
52
|
},
|
|
41
53
|
{
|
|
42
54
|
title:"邮箱",
|
|
@@ -86,7 +98,7 @@ export default () => {
|
|
|
86
98
|
for (let i = 0; i < 1; i = i + 1) {
|
|
87
99
|
arrayData.push({
|
|
88
100
|
"id": i,
|
|
89
|
-
"name": "
|
|
101
|
+
"name": "仙人仙人仙人仙人仙人仙人仙人仙人仙人仙人仙人仙人仙人仙人仙人仙人仙人仙人仙人仙人仙人仙人仙人仙人",
|
|
90
102
|
"mobileList": null,
|
|
91
103
|
"mailList": null,
|
|
92
104
|
"openidList": [
|
|
@@ -176,8 +188,8 @@ export default () => {
|
|
|
176
188
|
for (let i = 0; i < 1; i = i + 1) {
|
|
177
189
|
arrayData.push({
|
|
178
190
|
"id": i,
|
|
179
|
-
"name": "
|
|
180
|
-
"mobileList":
|
|
191
|
+
"name": "仙人仙人仙人仙人仙人仙人仙人仙人仙人仙人仙人仙人仙人仙人仙人仙人仙人仙人仙人仙人仙人仙人仙人仙人仙人仙人",
|
|
192
|
+
"mobileList": [{name:"1"},{name:"2"}],
|
|
181
193
|
"mailList": null,
|
|
182
194
|
"openidList": [
|
|
183
195
|
"okSMy58P_PE9sQkAG03gkpiTk-hs"
|