@aloudata/aloudata-design 0.2.0-beta.15 → 0.2.0-beta.18
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/Button/style/index.less +1 -1
- package/es/Input/style/index.less +31 -2
- package/es/Select/BaseSelect.js +0 -2
- package/es/Select/OptionsList/index.js +11 -19
- package/es/Select/Selector/index.js +1 -1
- package/es/Select/style/index.less +39 -7
- package/es/Table/index.js +70 -39
- package/es/Table/interface.d.ts +1 -1
- package/es/Table/style/index.less +3 -5
- package/es/Tabs/index.js +2 -1
- package/es/Tabs/style/index.less +8 -1
- package/lib/Button/style/index.less +1 -1
- package/lib/Input/style/index.less +31 -2
- package/lib/Select/BaseSelect.js +0 -2
- package/lib/Select/OptionsList/index.js +10 -19
- package/lib/Select/Selector/index.js +1 -1
- package/lib/Select/style/index.less +39 -7
- package/lib/Table/index.js +70 -39
- package/lib/Table/interface.d.ts +1 -1
- package/lib/Table/style/index.less +3 -5
- package/lib/Tabs/index.js +2 -1
- package/lib/Tabs/style/index.less +8 -1
- package/package.json +2 -1
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
.ant-input {
|
|
9
9
|
color: @NL0;
|
|
10
10
|
border-radius: @border-radius-base;
|
|
11
|
+
font-size: 12px;
|
|
12
|
+
height: 28px;
|
|
11
13
|
|
|
12
14
|
&::placeholder {
|
|
13
15
|
color: @NL50;
|
|
@@ -15,6 +17,9 @@
|
|
|
15
17
|
|
|
16
18
|
&-prefix {
|
|
17
19
|
color: @NL30;
|
|
20
|
+
font-weight: 400;
|
|
21
|
+
font-size: 12px;
|
|
22
|
+
line-height: 16px;
|
|
18
23
|
}
|
|
19
24
|
|
|
20
25
|
&-suffix {
|
|
@@ -39,10 +44,19 @@
|
|
|
39
44
|
|
|
40
45
|
&-sm {
|
|
41
46
|
border-radius: @border-radius-sm;
|
|
47
|
+
font-size: 12px;
|
|
48
|
+
height: 24px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&-lg {
|
|
52
|
+
height: 32px;
|
|
53
|
+
font-size: 14px;
|
|
42
54
|
}
|
|
43
55
|
|
|
44
56
|
&-affix-wrapper {
|
|
45
57
|
border-radius: @border-radius-base;
|
|
58
|
+
padding: 0 12px;
|
|
59
|
+
height: 28px;
|
|
46
60
|
|
|
47
61
|
&-hover,
|
|
48
62
|
&-focused,
|
|
@@ -53,10 +67,25 @@
|
|
|
53
67
|
.ant-input {
|
|
54
68
|
border-radius: 0;
|
|
55
69
|
caret-color: @B40;
|
|
70
|
+
height: 100%;
|
|
56
71
|
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.ant-input-affix-wrapper.ant-input-affix-wrapper {
|
|
76
|
+
&-lg {
|
|
77
|
+
padding: 4px 11px;
|
|
78
|
+
height: 32px;
|
|
79
|
+
font-size: 14px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&-sm {
|
|
83
|
+
border-radius: @border-radius-sm;
|
|
84
|
+
padding: 0 12px;
|
|
85
|
+
height: 24px;
|
|
57
86
|
|
|
58
|
-
|
|
59
|
-
|
|
87
|
+
.ant-input-sm {
|
|
88
|
+
height: 22px;
|
|
60
89
|
}
|
|
61
90
|
}
|
|
62
91
|
}
|
package/es/Select/BaseSelect.js
CHANGED
|
@@ -48,7 +48,6 @@ export var Select = function Select(props, ref) {
|
|
|
48
48
|
label = props.label,
|
|
49
49
|
className = props.className,
|
|
50
50
|
style = props.style,
|
|
51
|
-
optionStyle = props.optionStyle,
|
|
52
51
|
groupStyle = props.groupStyle,
|
|
53
52
|
_props$allowClear = props.allowClear,
|
|
54
53
|
allowClear = _props$allowClear === void 0 ? false : _props$allowClear,
|
|
@@ -314,7 +313,6 @@ export var Select = function Select(props, ref) {
|
|
|
314
313
|
visible: visible,
|
|
315
314
|
hasGroup: hasGroup,
|
|
316
315
|
groupStyle: groupStyle,
|
|
317
|
-
optionStyle: optionStyle,
|
|
318
316
|
searchType: "no-search",
|
|
319
317
|
placeholder: placeholder,
|
|
320
318
|
data: flattenOptions,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["input", "prefixCls", "data", "groupStyle", "height", "itemHeight", "selected", "optionChecked", "tempValue", "value", "placeholder", "notFoundContent", "onValueChange", "onTempValueChange", "setTempValue", "onInputChange", "onOptionClick", "activeIndex", "multiple", "visible", "
|
|
1
|
+
var _excluded = ["input", "prefixCls", "data", "groupStyle", "height", "itemHeight", "selected", "optionChecked", "tempValue", "value", "placeholder", "notFoundContent", "onValueChange", "onTempValueChange", "setTempValue", "onInputChange", "onOptionClick", "activeIndex", "multiple", "visible", "setActiveIndex"];
|
|
2
2
|
|
|
3
3
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
4
|
|
|
@@ -25,17 +25,19 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
25
25
|
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
26
26
|
import React, { useCallback, useImperativeHandle, useMemo, useRef, useEffect } from 'react';
|
|
27
27
|
import classnames from 'classnames';
|
|
28
|
-
import
|
|
29
|
-
import { ForwardRenderGroup, ForwardRenderOption, ForwardRenderTooltip, RenderLabelIcon } from './OptionItem';
|
|
28
|
+
import { ForwardRenderOption, ForwardRenderTooltip, RenderLabelIcon } from './OptionItem';
|
|
30
29
|
var ZERO_LENGTH = 0;
|
|
31
30
|
var DEFAULT_ACTIVE_INDEX = -1;
|
|
31
|
+
var DEFAULT_LIST_HEIGHT = 256;
|
|
32
|
+
var DEFAULT_LIST_PADDING = 8;
|
|
32
33
|
|
|
33
34
|
var OptionsList = function OptionsList(props, ref) {
|
|
34
35
|
var input = props.input,
|
|
35
36
|
prefixCls = props.prefixCls,
|
|
36
37
|
data = props.data,
|
|
37
38
|
groupStyle = props.groupStyle,
|
|
38
|
-
height = props.height,
|
|
39
|
+
_props$height = props.height,
|
|
40
|
+
height = _props$height === void 0 ? DEFAULT_LIST_HEIGHT : _props$height,
|
|
39
41
|
itemHeight = props.itemHeight,
|
|
40
42
|
selected = props.selected,
|
|
41
43
|
optionChecked = props.optionChecked,
|
|
@@ -51,7 +53,6 @@ var OptionsList = function OptionsList(props, ref) {
|
|
|
51
53
|
activeIndex = props.activeIndex,
|
|
52
54
|
multiple = props.multiple,
|
|
53
55
|
visible = props.visible,
|
|
54
|
-
style = props.style,
|
|
55
56
|
setActiveIndex = props.setActiveIndex,
|
|
56
57
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
57
58
|
|
|
@@ -146,7 +147,9 @@ var OptionsList = function OptionsList(props, ref) {
|
|
|
146
147
|
|
|
147
148
|
return /*#__PURE__*/React.createElement("div", {
|
|
148
149
|
className: "".concat(prefixCls, "-list"),
|
|
149
|
-
style:
|
|
150
|
+
style: {
|
|
151
|
+
maxHeight: "".concat(height - DEFAULT_LIST_PADDING, "px")
|
|
152
|
+
},
|
|
150
153
|
ref: OptionListRef,
|
|
151
154
|
role: "list",
|
|
152
155
|
"aria-hidden": "true",
|
|
@@ -155,19 +158,8 @@ var OptionsList = function OptionsList(props, ref) {
|
|
|
155
158
|
onMouseLeave: function onMouseLeave() {
|
|
156
159
|
return setActiveIndex(DEFAULT_ACTIVE_INDEX);
|
|
157
160
|
}
|
|
158
|
-
}, multiple && renderAllOptions(), data.length > ZERO_LENGTH ?
|
|
159
|
-
|
|
160
|
-
prefixCls: prefixCls,
|
|
161
|
-
ref: VirtualListRef,
|
|
162
|
-
data: data,
|
|
163
|
-
height: height,
|
|
164
|
-
itemHeight: itemHeight
|
|
165
|
-
}, restProps), function (option, index) {
|
|
166
|
-
return option.isSelectOptGroup ? /*#__PURE__*/React.createElement(ForwardRenderGroup, {
|
|
167
|
-
option: option,
|
|
168
|
-
prefixCls: prefixCls,
|
|
169
|
-
groupStyle: groupStyle
|
|
170
|
-
}) : /*#__PURE__*/React.createElement(ForwardRenderTooltip, {
|
|
161
|
+
}, multiple && renderAllOptions(), data.length > ZERO_LENGTH ? data.map(function (option, index) {
|
|
162
|
+
return /*#__PURE__*/React.createElement(ForwardRenderTooltip, {
|
|
171
163
|
tooltip: option === null || option === void 0 ? void 0 : option.tooltip,
|
|
172
164
|
render: /*#__PURE__*/React.createElement(ForwardRenderOption, _objectSpread({
|
|
173
165
|
option: option,
|
|
@@ -173,7 +173,7 @@ var Selector = function Selector(props, ref) {
|
|
|
173
173
|
return [].concat(_toConsumableArray(prev), [curr]);
|
|
174
174
|
}, []);
|
|
175
175
|
|
|
176
|
-
if (Array.isArray(value) && value.length === filteredOptions.length) {
|
|
176
|
+
if (Array.isArray(value) && value.length === filteredOptions.length && !isEmpty(value)) {
|
|
177
177
|
return /*#__PURE__*/React.createElement("span", null, "\u5168\u90E8");
|
|
178
178
|
}
|
|
179
179
|
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
// Base Text
|
|
36
36
|
// @text-color-base: #313e75;
|
|
37
37
|
// @text-color-disabled: #313e75;
|
|
38
|
-
@text-font-size
|
|
38
|
+
@text-font-base-size: 14px;
|
|
39
39
|
// @text-lint-height-base: 22px;
|
|
40
40
|
|
|
41
41
|
//Background Color
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
|
|
45
45
|
@ald-prefix: ~'@{component-prefix}';
|
|
46
46
|
@select-prefix-cls-legacy: ~'@{component-prefix}-select-legacy';
|
|
47
|
-
@select-input-fontSize: @text-font-size
|
|
48
|
-
@select-input-fontSize-sm: @text-font-size
|
|
47
|
+
@select-input-fontSize: @text-font-base-size;
|
|
48
|
+
@select-input-fontSize-sm: @text-font-base-size - 2px;
|
|
49
49
|
// @color-font-list-primary-normal: @palette-black-6; // $color-black-6
|
|
50
50
|
// @color-box-shadow-focused: #c0c4d3;
|
|
51
51
|
// @color-background-matchHeight: #ffcf3c;
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
overflow: hidden;
|
|
57
57
|
border: 1px solid transparent;
|
|
58
58
|
border-radius: @border-radius-base;
|
|
59
|
-
padding: 0 36px 0
|
|
59
|
+
padding: 0 36px 0 11px;
|
|
60
60
|
outline: none;
|
|
61
61
|
transition: all 0.2s;
|
|
62
62
|
cursor: pointer;
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
&-close {
|
|
142
142
|
position: absolute;
|
|
143
143
|
top: 0;
|
|
144
|
-
right:
|
|
144
|
+
right: 8px;
|
|
145
145
|
display: flex;
|
|
146
146
|
align-items: center;
|
|
147
147
|
justify-content: center;
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
|
|
163
163
|
&-text {
|
|
164
164
|
overflow: hidden;
|
|
165
|
-
font-size:
|
|
165
|
+
font-size: @select-input-fontSize-sm;
|
|
166
166
|
line-height: 22px;
|
|
167
167
|
white-space: nowrap;
|
|
168
168
|
text-overflow: ellipsis;
|
|
@@ -197,7 +197,7 @@
|
|
|
197
197
|
|
|
198
198
|
&-text {
|
|
199
199
|
overflow: hidden;
|
|
200
|
-
font-size:
|
|
200
|
+
font-size: @select-input-fontSize-sm;
|
|
201
201
|
line-height: 22px;
|
|
202
202
|
white-space: nowrap;
|
|
203
203
|
text-overflow: ellipsis;
|
|
@@ -209,6 +209,7 @@
|
|
|
209
209
|
top: 0;
|
|
210
210
|
left: 0;
|
|
211
211
|
color: @select-placeholder-color;
|
|
212
|
+
font-size: @select-input-fontSize-sm;
|
|
212
213
|
}
|
|
213
214
|
|
|
214
215
|
&-input {
|
|
@@ -282,7 +283,27 @@
|
|
|
282
283
|
}
|
|
283
284
|
}
|
|
284
285
|
|
|
286
|
+
&-default {
|
|
287
|
+
height: 28px;
|
|
288
|
+
.@{select-prefix-cls-legacy} {
|
|
289
|
+
&-selector {
|
|
290
|
+
height: 26px;
|
|
291
|
+
min-height: 26px;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
&-values-wrapper {
|
|
295
|
+
line-height: 26px;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
&-selector-label {
|
|
299
|
+
height: 26px;
|
|
300
|
+
font-size: 12px;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
285
305
|
&-large {
|
|
306
|
+
height: @height-lg;
|
|
286
307
|
.@{select-prefix-cls-legacy} {
|
|
287
308
|
&-selector {
|
|
288
309
|
min-height: @height-lg;
|
|
@@ -310,6 +331,14 @@
|
|
|
310
331
|
&-input-tags {
|
|
311
332
|
top: 0;
|
|
312
333
|
}
|
|
334
|
+
|
|
335
|
+
&-placeholder {
|
|
336
|
+
font-size: @select-input-fontSize;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
&-item-text {
|
|
340
|
+
font-size: @select-input-fontSize;
|
|
341
|
+
}
|
|
313
342
|
}
|
|
314
343
|
}
|
|
315
344
|
|
|
@@ -406,6 +435,8 @@
|
|
|
406
435
|
// min-width: 160px;
|
|
407
436
|
// padding: 16px 0 16px 8px;
|
|
408
437
|
outline: none;
|
|
438
|
+
overflow-y: scroll;
|
|
439
|
+
overflow-y: overlay;
|
|
409
440
|
}
|
|
410
441
|
|
|
411
442
|
.@{select-prefix-cls-legacy}-list-option {
|
|
@@ -434,6 +465,7 @@
|
|
|
434
465
|
transform: translateY(-50%);
|
|
435
466
|
left: 12px;
|
|
436
467
|
color: @B40;
|
|
468
|
+
margin-top: 2px;
|
|
437
469
|
|
|
438
470
|
&-checkbox {
|
|
439
471
|
.@{component-prefix}-checkbox-inner {
|
package/es/Table/index.js
CHANGED
|
@@ -23,6 +23,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
23
23
|
|
|
24
24
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
25
25
|
|
|
26
|
+
/* eslint-disable no-unneeded-ternary */
|
|
26
27
|
/// <reference types ='./react-table-config' />
|
|
27
28
|
import _ from 'lodash';
|
|
28
29
|
import classnames from 'classnames';
|
|
@@ -31,6 +32,7 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
|
31
32
|
import usePrefixCls from '../_utils/hooks/usePrefixCls';
|
|
32
33
|
import InfiniteScroll from 'react-infinite-scroll-component';
|
|
33
34
|
import Empty from '../Empty';
|
|
35
|
+
import ResizeObserver from 'rc-resize-observer';
|
|
34
36
|
import { useTable, useBlockLayout, useRowSelect, useSortBy, useResizeColumns } from 'react-table';
|
|
35
37
|
var ARRAY_FIRST_INDEX = 0;
|
|
36
38
|
var DEFAULT_ROW_WIDTH = 0;
|
|
@@ -73,11 +75,18 @@ function Table(_ref, ref) {
|
|
|
73
75
|
setTableClientWidth = _useState2[1];
|
|
74
76
|
|
|
75
77
|
var RANDOM_ID = "INNER_SCROLL_ID_".concat(Math.random());
|
|
78
|
+
|
|
79
|
+
var _useState3 = useState(DEFAULT_ROW_WIDTH),
|
|
80
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
81
|
+
width = _useState4[0],
|
|
82
|
+
setWidth = _useState4[1]; // 如果页面整体宽度变化则重新计算
|
|
83
|
+
|
|
84
|
+
|
|
76
85
|
useEffect(function () {
|
|
77
86
|
if (tableRef.current) {
|
|
78
87
|
setTableClientWidth(tableRef.current.clientWidth);
|
|
79
88
|
}
|
|
80
|
-
}, []);
|
|
89
|
+
}, [width]);
|
|
81
90
|
var initialColumnsWidthMap = useMemo(function () {
|
|
82
91
|
var map = new Map();
|
|
83
92
|
|
|
@@ -125,7 +134,12 @@ function Table(_ref, ref) {
|
|
|
125
134
|
}
|
|
126
135
|
});
|
|
127
136
|
});
|
|
128
|
-
}, [columns, sortable, initialColumnsWidthMap]);
|
|
137
|
+
}, [columns, sortable, initialColumnsWidthMap]); // 默认排序的对象
|
|
138
|
+
|
|
139
|
+
var defaultSortObject = {
|
|
140
|
+
id: newColumns[ARRAY_FIRST_INDEX].accessor,
|
|
141
|
+
desc: newColumns[ARRAY_FIRST_INDEX].sortOrder && newColumns[ARRAY_FIRST_INDEX].sortOrder === 'descend' ? true : false
|
|
142
|
+
}; // 如果支持排序 但是没有默认排序 则默认按第一列倒叙排序
|
|
129
143
|
|
|
130
144
|
var getInitialSortDirection = function getInitialSortDirection() {
|
|
131
145
|
if (defaultSort && defaultSort.id) {
|
|
@@ -133,10 +147,7 @@ function Table(_ref, ref) {
|
|
|
133
147
|
}
|
|
134
148
|
|
|
135
149
|
if (sortable) {
|
|
136
|
-
return
|
|
137
|
-
id: newColumns[ARRAY_FIRST_INDEX].accessor,
|
|
138
|
-
desc: false
|
|
139
|
-
};
|
|
150
|
+
return defaultSortObject;
|
|
140
151
|
}
|
|
141
152
|
|
|
142
153
|
return {
|
|
@@ -202,41 +213,65 @@ function Table(_ref, ref) {
|
|
|
202
213
|
}, "\u5171\u8BA1", total || len, "\u6761"), /*#__PURE__*/React.createElement("div", {
|
|
203
214
|
className: classnames("".concat(prefixCls, "-header-right"))
|
|
204
215
|
}, renderHeaderRight ? renderHeaderRight() : null));
|
|
205
|
-
};
|
|
216
|
+
}; // 排序的方向 倒叙{ id: 'xx', desc: true }、正序{ id: 'xx', desc: false }、无序 { id: '', desc: undefined }
|
|
217
|
+
// 获取排序方向以及排序的id
|
|
218
|
+
|
|
206
219
|
|
|
207
|
-
var
|
|
220
|
+
var getSortBy = function getSortBy(id) {
|
|
208
221
|
var sortDirections = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ['ascend', 'descend'];
|
|
209
|
-
var
|
|
222
|
+
var // 如果传了sortDirections,则使用传入的,否则使用默认的
|
|
223
|
+
sortOrder = arguments.length > 2 ? arguments[2] : undefined;
|
|
224
|
+
var res = {
|
|
225
|
+
id: id,
|
|
226
|
+
desc: undefined // 给个默认的排序
|
|
227
|
+
|
|
228
|
+
};
|
|
229
|
+
var isSameCol = sortDirection.id === id;
|
|
210
230
|
var descMap = new Map([['ascend', false], ['descend', true]]);
|
|
211
|
-
var directions = allSortDirections || sortDirections;
|
|
231
|
+
var directions = allSortDirections || sortDirections; // 如果不是同一列 则返回默认排序 或者排序顺序的第一个
|
|
232
|
+
|
|
233
|
+
if (!isSameCol) {
|
|
234
|
+
if (sortOrder === 'ascend' || sortOrder === 'descend') {
|
|
235
|
+
res.desc = descMap.get(sortOrder);
|
|
236
|
+
} else {
|
|
237
|
+
res.desc = sortOrder ? sortOrder : descMap.get(directions[ARRAY_FIRST_INDEX]);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
return res;
|
|
241
|
+
} // 如果是同一列
|
|
242
|
+
// 如果列给了默认的sortOrder则不在变化
|
|
243
|
+
|
|
212
244
|
|
|
213
245
|
if (sortOrder === 'ascend' || sortOrder === 'descend') {
|
|
214
|
-
|
|
215
|
-
|
|
246
|
+
res.desc = descMap.get(sortOrder);
|
|
247
|
+
return res;
|
|
248
|
+
} // 在所有方向上 往后取一个
|
|
216
249
|
|
|
217
|
-
if (typeof currentDesc === 'undefined') {
|
|
218
|
-
return descMap.get(directions[ARRAY_FIRST_INDEX]);
|
|
219
|
-
}
|
|
220
250
|
|
|
221
|
-
var
|
|
251
|
+
var lastSortDirection = sortDirection.desc ? 'descend' : 'ascend';
|
|
222
252
|
|
|
223
253
|
var index = _.findIndex(directions, function (item) {
|
|
224
|
-
return item ===
|
|
254
|
+
return item === lastSortDirection;
|
|
225
255
|
});
|
|
226
256
|
|
|
227
257
|
var nextIndex = index + 1;
|
|
228
|
-
|
|
258
|
+
res.desc = descMap.get(directions[nextIndex]); // 如果没有排序方向,则返回默认排序对象
|
|
259
|
+
|
|
260
|
+
if (res.desc === undefined) {
|
|
261
|
+
res.id = '';
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
return res;
|
|
229
265
|
};
|
|
230
266
|
|
|
231
267
|
var getHeaderProps = function getHeaderProps(column) {
|
|
232
268
|
// @ts-ignore
|
|
233
269
|
var id = column.id,
|
|
234
|
-
isSortedDesc = column.isSortedDesc,
|
|
235
270
|
canSort = column.canSort,
|
|
236
271
|
sorter = column.sorter,
|
|
237
272
|
sortOrder = column.sortOrder,
|
|
238
273
|
sortDirections = column.sortDirections;
|
|
239
|
-
var toggleProps = column.getSortByToggleProps();
|
|
274
|
+
var toggleProps = column.getSortByToggleProps(); // 仅在Table设置sortable时,所有列的canSort为true,此时为前端排序
|
|
240
275
|
|
|
241
276
|
if (canSort) {
|
|
242
277
|
// client sort
|
|
@@ -245,19 +280,16 @@ function Table(_ref, ref) {
|
|
|
245
280
|
e.stopPropagation();
|
|
246
281
|
|
|
247
282
|
if (typeof toggleProps.onClick === 'function') {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
id: typeof desc === 'undefined' ? '' : id,
|
|
252
|
-
desc: desc
|
|
253
|
-
};
|
|
254
|
-
setSortBy(typeof desc === 'undefined' ? [] : [sortBy]);
|
|
283
|
+
var sortBy = getSortBy(id, sortDirections, sortOrder);
|
|
284
|
+
setSortBy(sortBy.desc === undefined ? [defaultSortObject] : [sortBy]); // 客户端排序时 需要重新设置排序
|
|
285
|
+
|
|
255
286
|
setSortDirection(sortBy);
|
|
256
287
|
onChange(sortBy);
|
|
257
288
|
}
|
|
258
289
|
}
|
|
259
290
|
});
|
|
260
|
-
}
|
|
291
|
+
} // 当列设置sorter属性时,则为服务端排序
|
|
292
|
+
|
|
261
293
|
|
|
262
294
|
if (sorter) {
|
|
263
295
|
// server sort
|
|
@@ -267,14 +299,8 @@ function Table(_ref, ref) {
|
|
|
267
299
|
}
|
|
268
300
|
})), {}, {
|
|
269
301
|
onClick: function onClick(e) {
|
|
270
|
-
e.stopPropagation();
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
var desc = getNextSortDesc(sortDirection.desc, sortDirections, sortOrder);
|
|
274
|
-
var sortBy = {
|
|
275
|
-
id: typeof desc === 'boolean' ? id : '',
|
|
276
|
-
desc: desc
|
|
277
|
-
};
|
|
302
|
+
e.stopPropagation();
|
|
303
|
+
var sortBy = getSortBy(id, sortDirections, sortOrder);
|
|
278
304
|
setSortDirection(sortBy);
|
|
279
305
|
onChange(sortBy);
|
|
280
306
|
}
|
|
@@ -365,7 +391,7 @@ function Table(_ref, ref) {
|
|
|
365
391
|
className: classnames("".concat(prefixCls, "-list"), _defineProperty({}, "".concat(prefixCls, "-innerScroll"), innerScroll)),
|
|
366
392
|
id: RANDOM_ID,
|
|
367
393
|
ref: tableBodyListRef
|
|
368
|
-
}, innerScroll
|
|
394
|
+
}, innerScroll ? /*#__PURE__*/React.createElement(InfiniteScroll, {
|
|
369
395
|
dataLength: rows.length,
|
|
370
396
|
next: loadMore,
|
|
371
397
|
hasMore: !!hasNextPage,
|
|
@@ -374,7 +400,12 @@ function Table(_ref, ref) {
|
|
|
374
400
|
}, renderRowList()) : renderRowList());
|
|
375
401
|
};
|
|
376
402
|
|
|
377
|
-
return /*#__PURE__*/React.createElement(
|
|
403
|
+
return /*#__PURE__*/React.createElement(ResizeObserver, {
|
|
404
|
+
onResize: function onResize(_ref4) {
|
|
405
|
+
var domWidth = _ref4.width;
|
|
406
|
+
setWidth(domWidth);
|
|
407
|
+
}
|
|
408
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
378
409
|
className: prefixCls,
|
|
379
410
|
ref: tableRef
|
|
380
411
|
}, showHeader && renderHeader(data.length), /*#__PURE__*/React.createElement("div", _objectSpread(_objectSpread({}, getTableProps()), {}, {
|
|
@@ -415,7 +446,7 @@ function Table(_ref, ref) {
|
|
|
415
446
|
style: {
|
|
416
447
|
width: totalColumnsWidth
|
|
417
448
|
}
|
|
418
|
-
}), renderTableBody())));
|
|
449
|
+
}), renderTableBody()))));
|
|
419
450
|
}
|
|
420
451
|
|
|
421
452
|
export default /*#__PURE__*/React.forwardRef(Table);
|
package/es/Table/interface.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export interface ISort<T> {
|
|
|
8
8
|
export interface IColumn<T extends object> {
|
|
9
9
|
title: string | null;
|
|
10
10
|
dataIndex: string;
|
|
11
|
-
render?: (value: any, row:
|
|
11
|
+
render?: (value: any, row: any, index: number) => React.ReactNode;
|
|
12
12
|
width?: number;
|
|
13
13
|
minWidth?: number;
|
|
14
14
|
sorter?: boolean | 'string' | 'number' | 'basic' | 'datetime' | 'alphanumeric' | ((rowA: Row<T>, rowB: Row<T>, columnId: IdType<T>, desc?: boolean) => number);
|
|
@@ -26,14 +26,13 @@
|
|
|
26
26
|
&-cell {
|
|
27
27
|
flex-grow: 1;
|
|
28
28
|
height: unset;
|
|
29
|
-
min-height: @table-row-height;
|
|
30
29
|
color: @NL0;
|
|
31
|
-
line-height:
|
|
30
|
+
line-height: 16px;
|
|
32
31
|
text-align: left;
|
|
33
32
|
border-bottom: 1px solid @NL95;
|
|
34
33
|
word-break: break-all;
|
|
35
|
-
display: flex;
|
|
36
|
-
padding:
|
|
34
|
+
display: flex !important; // 目前都让表格先居左、居中处理,所以这里需要强制设置为flex
|
|
35
|
+
padding: 11.5px 12px;
|
|
37
36
|
align-items: center;
|
|
38
37
|
|
|
39
38
|
&-content {
|
|
@@ -126,7 +125,6 @@
|
|
|
126
125
|
align-items: center;
|
|
127
126
|
justify-content: space-between;
|
|
128
127
|
margin-bottom: 24px;
|
|
129
|
-
padding: 0 10px;
|
|
130
128
|
|
|
131
129
|
&-left {
|
|
132
130
|
color: @NL0;
|
package/es/Tabs/index.js
CHANGED
package/es/Tabs/style/index.less
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
@import '../../style/index.less';
|
|
2
2
|
|
|
3
|
-
.ald-tabs {
|
|
3
|
+
.ant-tabs.ald-tabs {
|
|
4
4
|
&.ant-tabs {
|
|
5
5
|
color: @NL30;
|
|
6
6
|
}
|
|
@@ -30,6 +30,13 @@
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
&.ald-tabs-default {
|
|
34
|
+
.ant-tabs-tab {
|
|
35
|
+
font-size: 14px;
|
|
36
|
+
line-height: 20px;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
33
40
|
.ant-tabs-nav-more {
|
|
34
41
|
margin: 0 !important;
|
|
35
42
|
}
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
.ant-input {
|
|
9
9
|
color: @NL0;
|
|
10
10
|
border-radius: @border-radius-base;
|
|
11
|
+
font-size: 12px;
|
|
12
|
+
height: 28px;
|
|
11
13
|
|
|
12
14
|
&::placeholder {
|
|
13
15
|
color: @NL50;
|
|
@@ -15,6 +17,9 @@
|
|
|
15
17
|
|
|
16
18
|
&-prefix {
|
|
17
19
|
color: @NL30;
|
|
20
|
+
font-weight: 400;
|
|
21
|
+
font-size: 12px;
|
|
22
|
+
line-height: 16px;
|
|
18
23
|
}
|
|
19
24
|
|
|
20
25
|
&-suffix {
|
|
@@ -39,10 +44,19 @@
|
|
|
39
44
|
|
|
40
45
|
&-sm {
|
|
41
46
|
border-radius: @border-radius-sm;
|
|
47
|
+
font-size: 12px;
|
|
48
|
+
height: 24px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&-lg {
|
|
52
|
+
height: 32px;
|
|
53
|
+
font-size: 14px;
|
|
42
54
|
}
|
|
43
55
|
|
|
44
56
|
&-affix-wrapper {
|
|
45
57
|
border-radius: @border-radius-base;
|
|
58
|
+
padding: 0 12px;
|
|
59
|
+
height: 28px;
|
|
46
60
|
|
|
47
61
|
&-hover,
|
|
48
62
|
&-focused,
|
|
@@ -53,10 +67,25 @@
|
|
|
53
67
|
.ant-input {
|
|
54
68
|
border-radius: 0;
|
|
55
69
|
caret-color: @B40;
|
|
70
|
+
height: 100%;
|
|
56
71
|
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.ant-input-affix-wrapper.ant-input-affix-wrapper {
|
|
76
|
+
&-lg {
|
|
77
|
+
padding: 4px 11px;
|
|
78
|
+
height: 32px;
|
|
79
|
+
font-size: 14px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&-sm {
|
|
83
|
+
border-radius: @border-radius-sm;
|
|
84
|
+
padding: 0 12px;
|
|
85
|
+
height: 24px;
|
|
57
86
|
|
|
58
|
-
|
|
59
|
-
|
|
87
|
+
.ant-input-sm {
|
|
88
|
+
height: 22px;
|
|
60
89
|
}
|
|
61
90
|
}
|
|
62
91
|
}
|
package/lib/Select/BaseSelect.js
CHANGED
|
@@ -74,7 +74,6 @@ var Select = function Select(props, ref) {
|
|
|
74
74
|
label = props.label,
|
|
75
75
|
className = props.className,
|
|
76
76
|
style = props.style,
|
|
77
|
-
optionStyle = props.optionStyle,
|
|
78
77
|
groupStyle = props.groupStyle,
|
|
79
78
|
_props$allowClear = props.allowClear,
|
|
80
79
|
allowClear = _props$allowClear === void 0 ? false : _props$allowClear,
|
|
@@ -341,7 +340,6 @@ var Select = function Select(props, ref) {
|
|
|
341
340
|
visible: visible,
|
|
342
341
|
hasGroup: hasGroup,
|
|
343
342
|
groupStyle: groupStyle,
|
|
344
|
-
optionStyle: optionStyle,
|
|
345
343
|
searchType: "no-search",
|
|
346
344
|
placeholder: placeholder,
|
|
347
345
|
data: flattenOptions,
|
|
@@ -11,11 +11,9 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
|
|
12
12
|
var _classnames2 = _interopRequireDefault(require("classnames"));
|
|
13
13
|
|
|
14
|
-
var _VirtualList = _interopRequireDefault(require("../VirtualList"));
|
|
15
|
-
|
|
16
14
|
var _OptionItem = require("./OptionItem");
|
|
17
15
|
|
|
18
|
-
var _excluded = ["input", "prefixCls", "data", "groupStyle", "height", "itemHeight", "selected", "optionChecked", "tempValue", "value", "placeholder", "notFoundContent", "onValueChange", "onTempValueChange", "setTempValue", "onInputChange", "onOptionClick", "activeIndex", "multiple", "visible", "
|
|
16
|
+
var _excluded = ["input", "prefixCls", "data", "groupStyle", "height", "itemHeight", "selected", "optionChecked", "tempValue", "value", "placeholder", "notFoundContent", "onValueChange", "onTempValueChange", "setTempValue", "onInputChange", "onOptionClick", "activeIndex", "multiple", "visible", "setActiveIndex"];
|
|
19
17
|
|
|
20
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
19
|
|
|
@@ -47,13 +45,16 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
47
45
|
|
|
48
46
|
var ZERO_LENGTH = 0;
|
|
49
47
|
var DEFAULT_ACTIVE_INDEX = -1;
|
|
48
|
+
var DEFAULT_LIST_HEIGHT = 256;
|
|
49
|
+
var DEFAULT_LIST_PADDING = 8;
|
|
50
50
|
|
|
51
51
|
var OptionsList = function OptionsList(props, ref) {
|
|
52
52
|
var input = props.input,
|
|
53
53
|
prefixCls = props.prefixCls,
|
|
54
54
|
data = props.data,
|
|
55
55
|
groupStyle = props.groupStyle,
|
|
56
|
-
height = props.height,
|
|
56
|
+
_props$height = props.height,
|
|
57
|
+
height = _props$height === void 0 ? DEFAULT_LIST_HEIGHT : _props$height,
|
|
57
58
|
itemHeight = props.itemHeight,
|
|
58
59
|
selected = props.selected,
|
|
59
60
|
optionChecked = props.optionChecked,
|
|
@@ -69,7 +70,6 @@ var OptionsList = function OptionsList(props, ref) {
|
|
|
69
70
|
activeIndex = props.activeIndex,
|
|
70
71
|
multiple = props.multiple,
|
|
71
72
|
visible = props.visible,
|
|
72
|
-
style = props.style,
|
|
73
73
|
setActiveIndex = props.setActiveIndex,
|
|
74
74
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
75
75
|
|
|
@@ -164,7 +164,9 @@ var OptionsList = function OptionsList(props, ref) {
|
|
|
164
164
|
|
|
165
165
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
166
166
|
className: "".concat(prefixCls, "-list"),
|
|
167
|
-
style:
|
|
167
|
+
style: {
|
|
168
|
+
maxHeight: "".concat(height - DEFAULT_LIST_PADDING, "px")
|
|
169
|
+
},
|
|
168
170
|
ref: OptionListRef,
|
|
169
171
|
role: "list",
|
|
170
172
|
"aria-hidden": "true",
|
|
@@ -173,19 +175,8 @@ var OptionsList = function OptionsList(props, ref) {
|
|
|
173
175
|
onMouseLeave: function onMouseLeave() {
|
|
174
176
|
return setActiveIndex(DEFAULT_ACTIVE_INDEX);
|
|
175
177
|
}
|
|
176
|
-
}, multiple && renderAllOptions(), data.length > ZERO_LENGTH ?
|
|
177
|
-
|
|
178
|
-
prefixCls: prefixCls,
|
|
179
|
-
ref: VirtualListRef,
|
|
180
|
-
data: data,
|
|
181
|
-
height: height,
|
|
182
|
-
itemHeight: itemHeight
|
|
183
|
-
}, restProps), function (option, index) {
|
|
184
|
-
return option.isSelectOptGroup ? /*#__PURE__*/_react.default.createElement(_OptionItem.ForwardRenderGroup, {
|
|
185
|
-
option: option,
|
|
186
|
-
prefixCls: prefixCls,
|
|
187
|
-
groupStyle: groupStyle
|
|
188
|
-
}) : /*#__PURE__*/_react.default.createElement(_OptionItem.ForwardRenderTooltip, {
|
|
178
|
+
}, multiple && renderAllOptions(), data.length > ZERO_LENGTH ? data.map(function (option, index) {
|
|
179
|
+
return /*#__PURE__*/_react.default.createElement(_OptionItem.ForwardRenderTooltip, {
|
|
189
180
|
tooltip: option === null || option === void 0 ? void 0 : option.tooltip,
|
|
190
181
|
render: /*#__PURE__*/_react.default.createElement(_OptionItem.ForwardRenderOption, _objectSpread({
|
|
191
182
|
option: option,
|
|
@@ -195,7 +195,7 @@ var Selector = function Selector(props, ref) {
|
|
|
195
195
|
return [].concat(_toConsumableArray(prev), [curr]);
|
|
196
196
|
}, []);
|
|
197
197
|
|
|
198
|
-
if (Array.isArray(value) && value.length === filteredOptions.length) {
|
|
198
|
+
if (Array.isArray(value) && value.length === filteredOptions.length && !(0, _lodash.isEmpty)(value)) {
|
|
199
199
|
return /*#__PURE__*/_react.default.createElement("span", null, "\u5168\u90E8");
|
|
200
200
|
}
|
|
201
201
|
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
// Base Text
|
|
36
36
|
// @text-color-base: #313e75;
|
|
37
37
|
// @text-color-disabled: #313e75;
|
|
38
|
-
@text-font-size
|
|
38
|
+
@text-font-base-size: 14px;
|
|
39
39
|
// @text-lint-height-base: 22px;
|
|
40
40
|
|
|
41
41
|
//Background Color
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
|
|
45
45
|
@ald-prefix: ~'@{component-prefix}';
|
|
46
46
|
@select-prefix-cls-legacy: ~'@{component-prefix}-select-legacy';
|
|
47
|
-
@select-input-fontSize: @text-font-size
|
|
48
|
-
@select-input-fontSize-sm: @text-font-size
|
|
47
|
+
@select-input-fontSize: @text-font-base-size;
|
|
48
|
+
@select-input-fontSize-sm: @text-font-base-size - 2px;
|
|
49
49
|
// @color-font-list-primary-normal: @palette-black-6; // $color-black-6
|
|
50
50
|
// @color-box-shadow-focused: #c0c4d3;
|
|
51
51
|
// @color-background-matchHeight: #ffcf3c;
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
overflow: hidden;
|
|
57
57
|
border: 1px solid transparent;
|
|
58
58
|
border-radius: @border-radius-base;
|
|
59
|
-
padding: 0 36px 0
|
|
59
|
+
padding: 0 36px 0 11px;
|
|
60
60
|
outline: none;
|
|
61
61
|
transition: all 0.2s;
|
|
62
62
|
cursor: pointer;
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
&-close {
|
|
142
142
|
position: absolute;
|
|
143
143
|
top: 0;
|
|
144
|
-
right:
|
|
144
|
+
right: 8px;
|
|
145
145
|
display: flex;
|
|
146
146
|
align-items: center;
|
|
147
147
|
justify-content: center;
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
|
|
163
163
|
&-text {
|
|
164
164
|
overflow: hidden;
|
|
165
|
-
font-size:
|
|
165
|
+
font-size: @select-input-fontSize-sm;
|
|
166
166
|
line-height: 22px;
|
|
167
167
|
white-space: nowrap;
|
|
168
168
|
text-overflow: ellipsis;
|
|
@@ -197,7 +197,7 @@
|
|
|
197
197
|
|
|
198
198
|
&-text {
|
|
199
199
|
overflow: hidden;
|
|
200
|
-
font-size:
|
|
200
|
+
font-size: @select-input-fontSize-sm;
|
|
201
201
|
line-height: 22px;
|
|
202
202
|
white-space: nowrap;
|
|
203
203
|
text-overflow: ellipsis;
|
|
@@ -209,6 +209,7 @@
|
|
|
209
209
|
top: 0;
|
|
210
210
|
left: 0;
|
|
211
211
|
color: @select-placeholder-color;
|
|
212
|
+
font-size: @select-input-fontSize-sm;
|
|
212
213
|
}
|
|
213
214
|
|
|
214
215
|
&-input {
|
|
@@ -282,7 +283,27 @@
|
|
|
282
283
|
}
|
|
283
284
|
}
|
|
284
285
|
|
|
286
|
+
&-default {
|
|
287
|
+
height: 28px;
|
|
288
|
+
.@{select-prefix-cls-legacy} {
|
|
289
|
+
&-selector {
|
|
290
|
+
height: 26px;
|
|
291
|
+
min-height: 26px;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
&-values-wrapper {
|
|
295
|
+
line-height: 26px;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
&-selector-label {
|
|
299
|
+
height: 26px;
|
|
300
|
+
font-size: 12px;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
285
305
|
&-large {
|
|
306
|
+
height: @height-lg;
|
|
286
307
|
.@{select-prefix-cls-legacy} {
|
|
287
308
|
&-selector {
|
|
288
309
|
min-height: @height-lg;
|
|
@@ -310,6 +331,14 @@
|
|
|
310
331
|
&-input-tags {
|
|
311
332
|
top: 0;
|
|
312
333
|
}
|
|
334
|
+
|
|
335
|
+
&-placeholder {
|
|
336
|
+
font-size: @select-input-fontSize;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
&-item-text {
|
|
340
|
+
font-size: @select-input-fontSize;
|
|
341
|
+
}
|
|
313
342
|
}
|
|
314
343
|
}
|
|
315
344
|
|
|
@@ -406,6 +435,8 @@
|
|
|
406
435
|
// min-width: 160px;
|
|
407
436
|
// padding: 16px 0 16px 8px;
|
|
408
437
|
outline: none;
|
|
438
|
+
overflow-y: scroll;
|
|
439
|
+
overflow-y: overlay;
|
|
409
440
|
}
|
|
410
441
|
|
|
411
442
|
.@{select-prefix-cls-legacy}-list-option {
|
|
@@ -434,6 +465,7 @@
|
|
|
434
465
|
transform: translateY(-50%);
|
|
435
466
|
left: 12px;
|
|
436
467
|
color: @B40;
|
|
468
|
+
margin-top: 2px;
|
|
437
469
|
|
|
438
470
|
&-checkbox {
|
|
439
471
|
.@{component-prefix}-checkbox-inner {
|
package/lib/Table/index.js
CHANGED
|
@@ -21,6 +21,8 @@ var _reactInfiniteScrollComponent = _interopRequireDefault(require("react-infini
|
|
|
21
21
|
|
|
22
22
|
var _Empty = _interopRequireDefault(require("../Empty"));
|
|
23
23
|
|
|
24
|
+
var _rcResizeObserver = _interopRequireDefault(require("rc-resize-observer"));
|
|
25
|
+
|
|
24
26
|
var _reactTable = require("react-table");
|
|
25
27
|
|
|
26
28
|
var _excluded = ["style"],
|
|
@@ -95,11 +97,18 @@ function Table(_ref, ref) {
|
|
|
95
97
|
setTableClientWidth = _useState2[1];
|
|
96
98
|
|
|
97
99
|
var RANDOM_ID = "INNER_SCROLL_ID_".concat(Math.random());
|
|
100
|
+
|
|
101
|
+
var _useState3 = (0, _react.useState)(DEFAULT_ROW_WIDTH),
|
|
102
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
103
|
+
width = _useState4[0],
|
|
104
|
+
setWidth = _useState4[1]; // 如果页面整体宽度变化则重新计算
|
|
105
|
+
|
|
106
|
+
|
|
98
107
|
(0, _react.useEffect)(function () {
|
|
99
108
|
if (tableRef.current) {
|
|
100
109
|
setTableClientWidth(tableRef.current.clientWidth);
|
|
101
110
|
}
|
|
102
|
-
}, []);
|
|
111
|
+
}, [width]);
|
|
103
112
|
var initialColumnsWidthMap = (0, _react.useMemo)(function () {
|
|
104
113
|
var map = new Map();
|
|
105
114
|
|
|
@@ -147,7 +156,12 @@ function Table(_ref, ref) {
|
|
|
147
156
|
}
|
|
148
157
|
});
|
|
149
158
|
});
|
|
150
|
-
}, [columns, sortable, initialColumnsWidthMap]);
|
|
159
|
+
}, [columns, sortable, initialColumnsWidthMap]); // 默认排序的对象
|
|
160
|
+
|
|
161
|
+
var defaultSortObject = {
|
|
162
|
+
id: newColumns[ARRAY_FIRST_INDEX].accessor,
|
|
163
|
+
desc: newColumns[ARRAY_FIRST_INDEX].sortOrder && newColumns[ARRAY_FIRST_INDEX].sortOrder === 'descend' ? true : false
|
|
164
|
+
}; // 如果支持排序 但是没有默认排序 则默认按第一列倒叙排序
|
|
151
165
|
|
|
152
166
|
var getInitialSortDirection = function getInitialSortDirection() {
|
|
153
167
|
if (defaultSort && defaultSort.id) {
|
|
@@ -155,10 +169,7 @@ function Table(_ref, ref) {
|
|
|
155
169
|
}
|
|
156
170
|
|
|
157
171
|
if (sortable) {
|
|
158
|
-
return
|
|
159
|
-
id: newColumns[ARRAY_FIRST_INDEX].accessor,
|
|
160
|
-
desc: false
|
|
161
|
-
};
|
|
172
|
+
return defaultSortObject;
|
|
162
173
|
}
|
|
163
174
|
|
|
164
175
|
return {
|
|
@@ -225,41 +236,65 @@ function Table(_ref, ref) {
|
|
|
225
236
|
}, "\u5171\u8BA1", total || len, "\u6761"), /*#__PURE__*/_react.default.createElement("div", {
|
|
226
237
|
className: (0, _classnames7.default)("".concat(prefixCls, "-header-right"))
|
|
227
238
|
}, renderHeaderRight ? renderHeaderRight() : null));
|
|
228
|
-
};
|
|
239
|
+
}; // 排序的方向 倒叙{ id: 'xx', desc: true }、正序{ id: 'xx', desc: false }、无序 { id: '', desc: undefined }
|
|
240
|
+
// 获取排序方向以及排序的id
|
|
241
|
+
|
|
229
242
|
|
|
230
|
-
var
|
|
243
|
+
var getSortBy = function getSortBy(id) {
|
|
231
244
|
var sortDirections = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ['ascend', 'descend'];
|
|
232
|
-
var
|
|
245
|
+
var // 如果传了sortDirections,则使用传入的,否则使用默认的
|
|
246
|
+
sortOrder = arguments.length > 2 ? arguments[2] : undefined;
|
|
247
|
+
var res = {
|
|
248
|
+
id: id,
|
|
249
|
+
desc: undefined // 给个默认的排序
|
|
250
|
+
|
|
251
|
+
};
|
|
252
|
+
var isSameCol = sortDirection.id === id;
|
|
233
253
|
var descMap = new Map([['ascend', false], ['descend', true]]);
|
|
234
|
-
var directions = allSortDirections || sortDirections;
|
|
254
|
+
var directions = allSortDirections || sortDirections; // 如果不是同一列 则返回默认排序 或者排序顺序的第一个
|
|
255
|
+
|
|
256
|
+
if (!isSameCol) {
|
|
257
|
+
if (sortOrder === 'ascend' || sortOrder === 'descend') {
|
|
258
|
+
res.desc = descMap.get(sortOrder);
|
|
259
|
+
} else {
|
|
260
|
+
res.desc = sortOrder ? sortOrder : descMap.get(directions[ARRAY_FIRST_INDEX]);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
return res;
|
|
264
|
+
} // 如果是同一列
|
|
265
|
+
// 如果列给了默认的sortOrder则不在变化
|
|
266
|
+
|
|
235
267
|
|
|
236
268
|
if (sortOrder === 'ascend' || sortOrder === 'descend') {
|
|
237
|
-
|
|
238
|
-
|
|
269
|
+
res.desc = descMap.get(sortOrder);
|
|
270
|
+
return res;
|
|
271
|
+
} // 在所有方向上 往后取一个
|
|
239
272
|
|
|
240
|
-
if (typeof currentDesc === 'undefined') {
|
|
241
|
-
return descMap.get(directions[ARRAY_FIRST_INDEX]);
|
|
242
|
-
}
|
|
243
273
|
|
|
244
|
-
var
|
|
274
|
+
var lastSortDirection = sortDirection.desc ? 'descend' : 'ascend';
|
|
245
275
|
|
|
246
276
|
var index = _lodash.default.findIndex(directions, function (item) {
|
|
247
|
-
return item ===
|
|
277
|
+
return item === lastSortDirection;
|
|
248
278
|
});
|
|
249
279
|
|
|
250
280
|
var nextIndex = index + 1;
|
|
251
|
-
|
|
281
|
+
res.desc = descMap.get(directions[nextIndex]); // 如果没有排序方向,则返回默认排序对象
|
|
282
|
+
|
|
283
|
+
if (res.desc === undefined) {
|
|
284
|
+
res.id = '';
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
return res;
|
|
252
288
|
};
|
|
253
289
|
|
|
254
290
|
var getHeaderProps = function getHeaderProps(column) {
|
|
255
291
|
// @ts-ignore
|
|
256
292
|
var id = column.id,
|
|
257
|
-
isSortedDesc = column.isSortedDesc,
|
|
258
293
|
canSort = column.canSort,
|
|
259
294
|
sorter = column.sorter,
|
|
260
295
|
sortOrder = column.sortOrder,
|
|
261
296
|
sortDirections = column.sortDirections;
|
|
262
|
-
var toggleProps = column.getSortByToggleProps();
|
|
297
|
+
var toggleProps = column.getSortByToggleProps(); // 仅在Table设置sortable时,所有列的canSort为true,此时为前端排序
|
|
263
298
|
|
|
264
299
|
if (canSort) {
|
|
265
300
|
// client sort
|
|
@@ -268,19 +303,16 @@ function Table(_ref, ref) {
|
|
|
268
303
|
e.stopPropagation();
|
|
269
304
|
|
|
270
305
|
if (typeof toggleProps.onClick === 'function') {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
id: typeof desc === 'undefined' ? '' : id,
|
|
275
|
-
desc: desc
|
|
276
|
-
};
|
|
277
|
-
setSortBy(typeof desc === 'undefined' ? [] : [sortBy]);
|
|
306
|
+
var sortBy = getSortBy(id, sortDirections, sortOrder);
|
|
307
|
+
setSortBy(sortBy.desc === undefined ? [defaultSortObject] : [sortBy]); // 客户端排序时 需要重新设置排序
|
|
308
|
+
|
|
278
309
|
setSortDirection(sortBy);
|
|
279
310
|
onChange(sortBy);
|
|
280
311
|
}
|
|
281
312
|
}
|
|
282
313
|
});
|
|
283
|
-
}
|
|
314
|
+
} // 当列设置sorter属性时,则为服务端排序
|
|
315
|
+
|
|
284
316
|
|
|
285
317
|
if (sorter) {
|
|
286
318
|
// server sort
|
|
@@ -290,14 +322,8 @@ function Table(_ref, ref) {
|
|
|
290
322
|
}
|
|
291
323
|
})), {}, {
|
|
292
324
|
onClick: function onClick(e) {
|
|
293
|
-
e.stopPropagation();
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
var desc = getNextSortDesc(sortDirection.desc, sortDirections, sortOrder);
|
|
297
|
-
var sortBy = {
|
|
298
|
-
id: typeof desc === 'boolean' ? id : '',
|
|
299
|
-
desc: desc
|
|
300
|
-
};
|
|
325
|
+
e.stopPropagation();
|
|
326
|
+
var sortBy = getSortBy(id, sortDirections, sortOrder);
|
|
301
327
|
setSortDirection(sortBy);
|
|
302
328
|
onChange(sortBy);
|
|
303
329
|
}
|
|
@@ -389,7 +415,7 @@ function Table(_ref, ref) {
|
|
|
389
415
|
className: (0, _classnames7.default)("".concat(prefixCls, "-list"), _defineProperty({}, "".concat(prefixCls, "-innerScroll"), innerScroll)),
|
|
390
416
|
id: RANDOM_ID,
|
|
391
417
|
ref: tableBodyListRef
|
|
392
|
-
}, innerScroll
|
|
418
|
+
}, innerScroll ? /*#__PURE__*/_react.default.createElement(_reactInfiniteScrollComponent.default, {
|
|
393
419
|
dataLength: rows.length,
|
|
394
420
|
next: loadMore,
|
|
395
421
|
hasMore: !!hasNextPage,
|
|
@@ -398,7 +424,12 @@ function Table(_ref, ref) {
|
|
|
398
424
|
}, renderRowList()) : renderRowList());
|
|
399
425
|
};
|
|
400
426
|
|
|
401
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
427
|
+
return /*#__PURE__*/_react.default.createElement(_rcResizeObserver.default, {
|
|
428
|
+
onResize: function onResize(_ref4) {
|
|
429
|
+
var domWidth = _ref4.width;
|
|
430
|
+
setWidth(domWidth);
|
|
431
|
+
}
|
|
432
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
402
433
|
className: prefixCls,
|
|
403
434
|
ref: tableRef
|
|
404
435
|
}, showHeader && renderHeader(data.length), /*#__PURE__*/_react.default.createElement("div", _objectSpread(_objectSpread({}, getTableProps()), {}, {
|
|
@@ -439,7 +470,7 @@ function Table(_ref, ref) {
|
|
|
439
470
|
style: {
|
|
440
471
|
width: totalColumnsWidth
|
|
441
472
|
}
|
|
442
|
-
}), renderTableBody())));
|
|
473
|
+
}), renderTableBody()))));
|
|
443
474
|
}
|
|
444
475
|
|
|
445
476
|
var _default = /*#__PURE__*/_react.default.forwardRef(Table);
|
package/lib/Table/interface.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export interface ISort<T> {
|
|
|
8
8
|
export interface IColumn<T extends object> {
|
|
9
9
|
title: string | null;
|
|
10
10
|
dataIndex: string;
|
|
11
|
-
render?: (value: any, row:
|
|
11
|
+
render?: (value: any, row: any, index: number) => React.ReactNode;
|
|
12
12
|
width?: number;
|
|
13
13
|
minWidth?: number;
|
|
14
14
|
sorter?: boolean | 'string' | 'number' | 'basic' | 'datetime' | 'alphanumeric' | ((rowA: Row<T>, rowB: Row<T>, columnId: IdType<T>, desc?: boolean) => number);
|
|
@@ -26,14 +26,13 @@
|
|
|
26
26
|
&-cell {
|
|
27
27
|
flex-grow: 1;
|
|
28
28
|
height: unset;
|
|
29
|
-
min-height: @table-row-height;
|
|
30
29
|
color: @NL0;
|
|
31
|
-
line-height:
|
|
30
|
+
line-height: 16px;
|
|
32
31
|
text-align: left;
|
|
33
32
|
border-bottom: 1px solid @NL95;
|
|
34
33
|
word-break: break-all;
|
|
35
|
-
display: flex;
|
|
36
|
-
padding:
|
|
34
|
+
display: flex !important; // 目前都让表格先居左、居中处理,所以这里需要强制设置为flex
|
|
35
|
+
padding: 11.5px 12px;
|
|
37
36
|
align-items: center;
|
|
38
37
|
|
|
39
38
|
&-content {
|
|
@@ -126,7 +125,6 @@
|
|
|
126
125
|
align-items: center;
|
|
127
126
|
justify-content: space-between;
|
|
128
127
|
margin-bottom: 24px;
|
|
129
|
-
padding: 0 10px;
|
|
130
128
|
|
|
131
129
|
&-left {
|
|
132
130
|
color: @NL0;
|
package/lib/Tabs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
@import '../../style/index.less';
|
|
2
2
|
|
|
3
|
-
.ald-tabs {
|
|
3
|
+
.ant-tabs.ald-tabs {
|
|
4
4
|
&.ant-tabs {
|
|
5
5
|
color: @NL30;
|
|
6
6
|
}
|
|
@@ -30,6 +30,13 @@
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
&.ald-tabs-default {
|
|
34
|
+
.ant-tabs-tab {
|
|
35
|
+
font-size: 14px;
|
|
36
|
+
line-height: 20px;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
33
40
|
.ant-tabs-nav-more {
|
|
34
41
|
margin: 0 !important;
|
|
35
42
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aloudata/aloudata-design",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.18",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"start": "dumi dev",
|
|
6
6
|
"docs:build": "dumi build",
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"lodash": "^4.17.21",
|
|
56
56
|
"rc-menu": "^9.3.2",
|
|
57
57
|
"rc-overflow": "^1.2.3",
|
|
58
|
+
"rc-resize-observer": "^1.2.0",
|
|
58
59
|
"rc-trigger": "^5.2.10",
|
|
59
60
|
"rc-virtual-list": "^3.4.2",
|
|
60
61
|
"react-infinite-scroll-component": "^6.1.0",
|