dlt-for-react 1.1.11 → 1.1.13
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/README.md +15 -7
- package/assets/components/KyEditableTable/index.less +107 -89
- package/assets/components/KyTableCardList/index.less +28 -11
- package/lib/components/KyEditableTable/index.js +1 -1
- package/lib/components/KyTableCardList/index.js +20 -7
- package/lib/components/KyTableCardList/overflowColumn.js +113 -0
- package/lib/index.js +168 -162
- package/lib/utils/common.js +129 -51
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ npm publish
|
|
|
8
8
|
|
|
9
9
|
## 前端 dlt-for-react 依赖包版本更新记录
|
|
10
10
|
|
|
11
|
-
##### 当前最新版本:1.1.
|
|
11
|
+
##### 当前最新版本:1.1.13
|
|
12
12
|
|
|
13
13
|
##### 安装依赖
|
|
14
14
|
|
|
@@ -16,29 +16,37 @@ npm publish
|
|
|
16
16
|
|
|
17
17
|
##### 版本修改记录
|
|
18
18
|
|
|
19
|
+
#### V1.1.13—2024 年 2 月 22 日
|
|
20
|
+
|
|
21
|
+
1. 解决KyEditableTable样式的问题
|
|
22
|
+
|
|
23
|
+
#### V1.1.11—2024 年 2 月 1 日
|
|
24
|
+
|
|
25
|
+
1. 解决 KyTableCardList 配置列内容溢出隐藏问题
|
|
26
|
+
|
|
19
27
|
#### V1.1.11—2024 年 1 月 25 日
|
|
20
28
|
|
|
21
|
-
1. 解决KyTableCardList查询的问题
|
|
29
|
+
1. 解决 KyTableCardList 查询的问题
|
|
22
30
|
|
|
23
31
|
#### V1.1.10—2024 年 1 月 24 日
|
|
24
32
|
|
|
25
|
-
1. 解决NHFetch表单提交的问题
|
|
33
|
+
1. 解决 NHFetch 表单提交的问题
|
|
26
34
|
|
|
27
35
|
#### V1.1.8—2023 年 12 月 29 日
|
|
28
36
|
|
|
29
|
-
1. 解决table查询强制重置了分页加载量的问题
|
|
37
|
+
1. 解决 table 查询强制重置了分页加载量的问题
|
|
30
38
|
|
|
31
39
|
#### V1.1.7—2023 年 12 月 22 日
|
|
32
40
|
|
|
33
|
-
1. 优化KyTable列表样式问题
|
|
41
|
+
1. 优化 KyTable 列表样式问题
|
|
34
42
|
|
|
35
43
|
#### V1.1.6—2023 年 11 月 22 日
|
|
36
44
|
|
|
37
|
-
1. 解决KyTable存在二级表头时,无法固定操作列的问题
|
|
45
|
+
1. 解决 KyTable 存在二级表头时,无法固定操作列的问题
|
|
38
46
|
|
|
39
47
|
#### V1.1.5—2023 年 11 月 22 日
|
|
40
48
|
|
|
41
|
-
1. 修改getSizebug
|
|
49
|
+
1. 修改 getSizebug
|
|
42
50
|
|
|
43
51
|
#### V1.1.4—2023 年 11 月 21 日
|
|
44
52
|
|
|
@@ -3,114 +3,132 @@
|
|
|
3
3
|
@BUTTON_COLOR: #1890ff;
|
|
4
4
|
|
|
5
5
|
:global {
|
|
6
|
-
.
|
|
7
|
-
.
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
.KyEditableTable {
|
|
7
|
+
.self-editable-table {
|
|
8
|
+
.ant-table-small > .ant-table-content > .ant-table-body {
|
|
9
|
+
margin: 0;
|
|
10
|
+
}
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
.ant-table {
|
|
13
|
+
border-radius: 3px;
|
|
14
|
+
}
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
.editableTable-item-required::before {
|
|
17
|
+
display: inline-block;
|
|
18
|
+
margin-right: 4px;
|
|
19
|
+
color: #f5222d;
|
|
20
|
+
font-weight: 500;
|
|
21
|
+
font-size: 14px;
|
|
22
|
+
font-family: SimSun, sans-serif;
|
|
23
|
+
line-height: 1;
|
|
24
|
+
content: "*";
|
|
25
|
+
}
|
|
24
26
|
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.operation {
|
|
28
|
-
margin-bottom: 16px;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
27
|
|
|
32
|
-
.
|
|
33
|
-
|
|
34
|
-
th {
|
|
35
|
-
padding: 13px 8px !important;
|
|
36
|
-
// height : 52px !important;
|
|
37
|
-
background-color: @TR_COLOR !important;
|
|
28
|
+
.operation {
|
|
29
|
+
margin-bottom: 16px;
|
|
38
30
|
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.ant-table-small>.ant-table-content>.ant-table-body {
|
|
42
|
-
margin: 0;
|
|
43
|
-
}
|
|
44
31
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
float: left;
|
|
53
|
-
max-width: 100%;
|
|
54
|
-
overflow: hidden;
|
|
55
|
-
white-space: nowrap;
|
|
56
|
-
text-overflow: ellipsis;
|
|
32
|
+
.self-editable-table {
|
|
33
|
+
.ant-table-thead {
|
|
34
|
+
th {
|
|
35
|
+
padding: 13px 8px !important;
|
|
36
|
+
// height : 52px !important;
|
|
37
|
+
background-color: @TR_COLOR !important;
|
|
38
|
+
}
|
|
57
39
|
}
|
|
58
|
-
}
|
|
59
40
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
line-height: 100%;
|
|
41
|
+
.ant-table-small > .ant-table-content > .ant-table-body {
|
|
42
|
+
margin: 0;
|
|
63
43
|
}
|
|
64
44
|
|
|
65
|
-
|
|
66
|
-
|
|
45
|
+
.ant-table-tbody {
|
|
46
|
+
td {
|
|
47
|
+
position: relative;
|
|
48
|
+
max-width: 234px;
|
|
49
|
+
padding: 13px 8px !important;
|
|
50
|
+
|
|
51
|
+
.ellipsis_dom {
|
|
52
|
+
float: left;
|
|
53
|
+
max-width: 100%;
|
|
54
|
+
overflow: hidden;
|
|
55
|
+
white-space: nowrap;
|
|
56
|
+
text-overflow: ellipsis;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
tr {
|
|
61
|
+
.ant-form-item-control {
|
|
62
|
+
line-height: 100%;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&:nth-child(even) {
|
|
66
|
+
background-color: @TR_COLOR;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
67
69
|
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
.self-editable-row .ant-form-explain {
|
|
72
|
+
position: absolute;
|
|
73
|
+
font-size: 12px;
|
|
74
|
+
}
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
.ant-input,
|
|
77
|
+
.ant-select-disabled .ant-select-selection {
|
|
78
|
+
// background: transparent;
|
|
79
|
+
// border: 0;
|
|
80
|
+
}
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
82
|
+
.ant-table-header-column {
|
|
83
|
+
color: #262626;
|
|
84
|
+
font-weight: bold;
|
|
85
|
+
font-family: inherit;
|
|
86
|
+
}
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
.ant-table-column-title {
|
|
89
|
+
font-weight: bold;
|
|
90
|
+
}
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
92
|
+
.ant-table-thead
|
|
93
|
+
> tr.ant-table-row-hover:not(.ant-table-expanded-row):not(
|
|
94
|
+
.ant-table-row-selected
|
|
95
|
+
)
|
|
96
|
+
> td,
|
|
97
|
+
.ant-table-tbody
|
|
98
|
+
> tr.ant-table-row-hover:not(.ant-table-expanded-row):not(
|
|
99
|
+
.ant-table-row-selected
|
|
100
|
+
)
|
|
101
|
+
> td,
|
|
102
|
+
.ant-table-thead
|
|
103
|
+
> tr:hover:not(.ant-table-expanded-row):not(.ant-table-row-selected)
|
|
104
|
+
> td,
|
|
105
|
+
.ant-table-tbody
|
|
106
|
+
> tr:hover:not(.ant-table-expanded-row):not(.ant-table-row-selected)
|
|
107
|
+
> td {
|
|
108
|
+
// background-color: #f0f0f0 !important;
|
|
109
|
+
}
|
|
98
110
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
111
|
+
.ant-pagination-item-active {
|
|
112
|
+
background: #f0f0f0;
|
|
113
|
+
border-color: transparent;
|
|
114
|
+
}
|
|
103
115
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
116
|
+
.ant-table-pagination.ant-pagination {
|
|
117
|
+
float: unset;
|
|
118
|
+
text-align: center;
|
|
119
|
+
}
|
|
108
120
|
|
|
109
|
-
|
|
110
|
-
|
|
121
|
+
.option_btns {
|
|
122
|
+
margin-right: 12px;
|
|
111
123
|
|
|
112
|
-
|
|
113
|
-
|
|
124
|
+
& a {
|
|
125
|
+
color: @BUTTON_COLOR;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
114
128
|
}
|
|
129
|
+
|
|
130
|
+
// .self-editable-table .ant-table-tbody tr:nth-child(even) {
|
|
131
|
+
// background-color: #fff;
|
|
132
|
+
// }
|
|
115
133
|
}
|
|
116
|
-
}
|
|
134
|
+
}
|
|
@@ -100,18 +100,29 @@
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
103
|
+
.column {
|
|
104
|
+
display: flex;
|
|
105
|
+
align-items: center;
|
|
106
|
+
.label,
|
|
107
|
+
.value {
|
|
108
|
+
display: inline-block;
|
|
109
|
+
color: rgba(0, 0, 0, 0.85);
|
|
110
|
+
font-weight: bold;
|
|
111
|
+
font-size: 14px;
|
|
112
|
+
font-family: Source Han Sans CN;
|
|
113
|
+
}
|
|
114
|
+
.label {
|
|
115
|
+
min-width: 70px;
|
|
116
|
+
}
|
|
117
|
+
.value {
|
|
118
|
+
color: rgba(0, 0, 0, 0.65);
|
|
119
|
+
font-weight: 400;
|
|
120
|
+
white-space: nowrap;
|
|
121
|
+
overflow: hidden;
|
|
122
|
+
text-overflow: ellipsis;
|
|
123
|
+
}
|
|
114
124
|
}
|
|
125
|
+
|
|
115
126
|
.warningText {
|
|
116
127
|
color: #ff4d4f;
|
|
117
128
|
cursor: pointer;
|
|
@@ -182,6 +193,12 @@
|
|
|
182
193
|
}
|
|
183
194
|
}
|
|
184
195
|
}
|
|
196
|
+
.textOverFlow {
|
|
197
|
+
position: relative;
|
|
198
|
+
overflow: hidden;
|
|
199
|
+
line-height: normal;
|
|
200
|
+
text-overflow: ellipsis;
|
|
201
|
+
}
|
|
185
202
|
}
|
|
186
203
|
.ant-dropdown-menu-item .action {
|
|
187
204
|
color: #397ef0;
|
|
@@ -1422,7 +1422,7 @@ var KyEditableTable = function (_Component2) {
|
|
|
1422
1422
|
};
|
|
1423
1423
|
return _react2.default.createElement(
|
|
1424
1424
|
'div',
|
|
1425
|
-
|
|
1425
|
+
{ className: "KyEditableTable" },
|
|
1426
1426
|
!readOnly && _react2.default.createElement(
|
|
1427
1427
|
'div',
|
|
1428
1428
|
{ layout: 'inline', className: 'operation' },
|
|
@@ -149,17 +149,20 @@ var _highSearchForm = require("./highSearchForm");
|
|
|
149
149
|
|
|
150
150
|
var _highSearchForm2 = _interopRequireDefault(_highSearchForm);
|
|
151
151
|
|
|
152
|
+
var _overflowColumn = require("./overflowColumn");
|
|
153
|
+
|
|
154
|
+
var _overflowColumn2 = _interopRequireDefault(_overflowColumn);
|
|
155
|
+
|
|
152
156
|
var _KyIcon = require("../KyIcon");
|
|
153
157
|
|
|
154
158
|
var _KyIcon2 = _interopRequireDefault(_KyIcon);
|
|
155
159
|
|
|
156
160
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
157
161
|
|
|
158
|
-
/*******
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
var Search = _input2.default.Search;
|
|
162
|
+
var Search = _input2.default.Search; /*******
|
|
163
|
+
* @description: 科研卡片表格-KyTableCardList
|
|
164
|
+
* @author: 琴时
|
|
165
|
+
*/
|
|
163
166
|
|
|
164
167
|
var KyTableCardList = function (_React$Component) {
|
|
165
168
|
(0, _inherits3.default)(KyTableCardList, _React$Component);
|
|
@@ -580,6 +583,11 @@ var KyTableCardList = function (_React$Component) {
|
|
|
580
583
|
_this.props.onClick && _this.props.onClick(row);
|
|
581
584
|
};
|
|
582
585
|
|
|
586
|
+
_this.handelPopoverDom = function (itemM, item) {
|
|
587
|
+
var dom = itemM.render ? itemM.render(item[itemM.dataIndex], item, itemM) : item[itemM.dataIndex];
|
|
588
|
+
return _react2.default.createElement(_overflowColumn2.default, { text: dom });
|
|
589
|
+
};
|
|
590
|
+
|
|
583
591
|
_this.state = {
|
|
584
592
|
filterDropdownVisibleMap: {},
|
|
585
593
|
searchParams: (0, _extends3.default)({}, _this.props.searchParams), //自定义的搜索条件
|
|
@@ -674,6 +682,11 @@ var KyTableCardList = function (_React$Component) {
|
|
|
674
682
|
|
|
675
683
|
//pageSize 变化的回调
|
|
676
684
|
|
|
685
|
+
|
|
686
|
+
/**
|
|
687
|
+
* 将列溢出的处理为Popover
|
|
688
|
+
*/
|
|
689
|
+
|
|
677
690
|
}, {
|
|
678
691
|
key: "render",
|
|
679
692
|
value: function render() {
|
|
@@ -931,7 +944,7 @@ var KyTableCardList = function (_React$Component) {
|
|
|
931
944
|
{
|
|
932
945
|
span: 24 / newColumns.length,
|
|
933
946
|
key: indexM,
|
|
934
|
-
className: itemM.dataIndex,
|
|
947
|
+
className: (0, _classnames2.default)("column", "" + itemM.dataIndex),
|
|
935
948
|
style: {
|
|
936
949
|
width: itemM.width,
|
|
937
950
|
minWidth: itemM.minWidth
|
|
@@ -950,7 +963,7 @@ var KyTableCardList = function (_React$Component) {
|
|
|
950
963
|
{
|
|
951
964
|
className: (0, _classnames2.default)("value", "value_" + itemM.dataIndex)
|
|
952
965
|
},
|
|
953
|
-
|
|
966
|
+
_this2.handelPopoverDom(itemM, item)
|
|
954
967
|
)
|
|
955
968
|
);
|
|
956
969
|
})
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _popover = require('antd/lib/popover');
|
|
8
|
+
|
|
9
|
+
var _popover2 = _interopRequireDefault(_popover);
|
|
10
|
+
|
|
11
|
+
var _slicedToArray2 = require('babel-runtime/helpers/slicedToArray');
|
|
12
|
+
|
|
13
|
+
var _slicedToArray3 = _interopRequireDefault(_slicedToArray2);
|
|
14
|
+
|
|
15
|
+
require('antd/lib/popover/style');
|
|
16
|
+
|
|
17
|
+
var _react = require('react');
|
|
18
|
+
|
|
19
|
+
var _react2 = _interopRequireDefault(_react);
|
|
20
|
+
|
|
21
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
|
+
|
|
23
|
+
var parentDomTimer = []; /**
|
|
24
|
+
* @Description:将列溢出的处理为Popover
|
|
25
|
+
* @Version: 1.0
|
|
26
|
+
* @Author: 琴时
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
var OverflowColumn = function OverflowColumn(_ref) {
|
|
30
|
+
var _ref$text = _ref.text,
|
|
31
|
+
text = _ref$text === undefined ? '' : _ref$text,
|
|
32
|
+
_ref$style = _ref.style,
|
|
33
|
+
style = _ref$style === undefined ? {} : _ref$style;
|
|
34
|
+
|
|
35
|
+
var _useState = (0, _react.useState)(false),
|
|
36
|
+
_useState2 = (0, _slicedToArray3.default)(_useState, 2),
|
|
37
|
+
overflowFlag = _useState2[0],
|
|
38
|
+
setoverflowFlag = _useState2[1]; //是否溢出
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
var _useState3 = (0, _react.useState)({}),
|
|
42
|
+
_useState4 = (0, _slicedToArray3.default)(_useState3, 2),
|
|
43
|
+
parentSize = _useState4[0],
|
|
44
|
+
setparentSize = _useState4[1]; //真实宽高
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
var parentDom = (0, _react.useCallback)(function (node) {
|
|
48
|
+
// 此处使用setTimeout获取真正渲染完成的元素,不够保险也不够优雅,后续若有好方法可替换此处
|
|
49
|
+
var Timer = setTimeout(function () {
|
|
50
|
+
if (node !== null) {
|
|
51
|
+
var height = node.getBoundingClientRect().height;
|
|
52
|
+
var width = node.getBoundingClientRect().width;
|
|
53
|
+
setparentSize({ height: height, width: width });
|
|
54
|
+
}
|
|
55
|
+
}, 100);
|
|
56
|
+
parentDomTimer.push(Timer);
|
|
57
|
+
}, []);
|
|
58
|
+
|
|
59
|
+
(0, _react.useEffect)(function () {
|
|
60
|
+
return function () {
|
|
61
|
+
clearparentDomTimer();
|
|
62
|
+
};
|
|
63
|
+
}, []);
|
|
64
|
+
|
|
65
|
+
// 清除定时器
|
|
66
|
+
var clearparentDomTimer = function clearparentDomTimer() {
|
|
67
|
+
if (parentDomTimer.length > 0) {
|
|
68
|
+
parentDomTimer.forEach(function (item) {
|
|
69
|
+
clearTimeout(item);
|
|
70
|
+
});
|
|
71
|
+
parentDomTimer = [];
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
var childDom = (0, _react.useCallback)(function (node) {
|
|
76
|
+
if (node !== null && parentSize.width) {
|
|
77
|
+
var height = node.getBoundingClientRect().height;
|
|
78
|
+
var width = node.getBoundingClientRect().width;
|
|
79
|
+
if (width > parentSize.width) {
|
|
80
|
+
//这里判断内容是否溢出
|
|
81
|
+
setoverflowFlag(true);
|
|
82
|
+
} else {
|
|
83
|
+
setoverflowFlag(false);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}, [parentSize]);
|
|
87
|
+
return _react2.default.createElement(
|
|
88
|
+
'div',
|
|
89
|
+
{ ref: parentDom, className: 'textOverFlow', style: style },
|
|
90
|
+
overflowFlag ? _react2.default.createElement(
|
|
91
|
+
_popover2.default,
|
|
92
|
+
{
|
|
93
|
+
placement: 'topLeft',
|
|
94
|
+
content: _react2.default.createElement(
|
|
95
|
+
'div',
|
|
96
|
+
{ style: { maxWidth: 200, wordBreak: 'break-all' } },
|
|
97
|
+
text
|
|
98
|
+
)
|
|
99
|
+
},
|
|
100
|
+
_react2.default.createElement(
|
|
101
|
+
'div',
|
|
102
|
+
{ className: 'textOverFlow' },
|
|
103
|
+
text
|
|
104
|
+
)
|
|
105
|
+
) : _react2.default.createElement(
|
|
106
|
+
'span',
|
|
107
|
+
{ ref: childDom },
|
|
108
|
+
text
|
|
109
|
+
)
|
|
110
|
+
);
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
exports.default = (0, _react.memo)(OverflowColumn);
|