@aloudata/aloudata-design 0.2.0-beta.10 → 0.2.0-beta.11
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 -0
- package/es/Dropdown/Button.d.ts +1 -0
- package/es/Dropdown/Button.js +2 -1
- package/es/Dropdown/style/index.d.ts +1 -0
- package/es/Dropdown/style/index.js +1 -0
- package/es/Input/components/TextArea/index.d.ts +1 -0
- package/es/Input/index.d.ts +1 -1
- package/es/Input/style/index.d.ts +1 -0
- package/es/Input/style/index.js +1 -0
- package/es/Menu/style/index.d.ts +1 -0
- package/es/Menu/style/index.js +1 -0
- package/es/Table/index.d.ts +1 -1
- package/es/Table/index.js +54 -35
- package/es/Table/interface.d.ts +0 -1
- package/es/Table/style/index.less +51 -27
- package/es/Tabs/index.js +5 -3
- package/es/Tabs/style/index.d.ts +1 -0
- package/es/Tabs/style/index.js +1 -0
- package/es/index.d.ts +1 -1
- package/es/style/index.d.ts +1 -1
- package/es/style/index.js +1 -1
- package/lib/Button/style/index.less +1 -0
- package/lib/Dropdown/Button.d.ts +1 -0
- package/lib/Dropdown/Button.js +2 -0
- package/lib/Dropdown/style/index.d.ts +1 -0
- package/lib/Dropdown/style/index.js +2 -0
- package/lib/Input/components/TextArea/index.d.ts +1 -0
- package/lib/Input/index.d.ts +1 -1
- package/lib/Input/style/index.d.ts +1 -0
- package/lib/Input/style/index.js +2 -0
- package/lib/Menu/style/index.d.ts +1 -0
- package/lib/Menu/style/index.js +2 -0
- package/lib/Table/index.d.ts +1 -1
- package/lib/Table/index.js +62 -43
- package/lib/Table/interface.d.ts +0 -1
- package/lib/Table/style/index.less +51 -27
- package/lib/Tabs/index.js +4 -2
- package/lib/Tabs/style/index.d.ts +1 -0
- package/lib/Tabs/style/index.js +2 -0
- package/lib/index.d.ts +1 -1
- package/lib/style/index.d.ts +1 -1
- package/lib/style/index.js +1 -1
- package/package.json +2 -2
package/es/Dropdown/Button.d.ts
CHANGED
package/es/Dropdown/Button.js
CHANGED
|
@@ -11,7 +11,8 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
11
11
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
12
12
|
|
|
13
13
|
import React from 'react';
|
|
14
|
-
import Button from '../Button';
|
|
14
|
+
import Button from '../Button';
|
|
15
|
+
import '../Button/style'; // eslint-disable-next-line import/no-cycle
|
|
15
16
|
|
|
16
17
|
import Dropdown from './index';
|
|
17
18
|
import Icon from '../Icon';
|
package/es/Input/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import TextArea from './components/TextArea';
|
|
|
5
5
|
import Password from './components/Password';
|
|
6
6
|
export type { IInputProps, InputRef, TSize } from './components/Input';
|
|
7
7
|
export type { IGroupProps } from './components/Group';
|
|
8
|
-
export type { ITextAreaProps } from './components/TextArea';
|
|
8
|
+
export type { ITextAreaProps, TextAreaRef } from './components/TextArea';
|
|
9
9
|
export type { IPasswordProps } from './components/Password';
|
|
10
10
|
interface ICompoundedComponent extends React.ForwardRefExoticComponent<IInputProps & React.RefAttributes<InputRef>> {
|
|
11
11
|
Group: typeof Group;
|
package/es/Input/style/index.js
CHANGED
package/es/Menu/style/index.d.ts
CHANGED
package/es/Menu/style/index.js
CHANGED
package/es/Table/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { ITableProps } from './interface';
|
|
3
|
-
declare function Table<T extends Record<string, unknown>>({ columns, data, total, renderHeaderLeft, renderHeaderRight,
|
|
3
|
+
declare function Table<T extends Record<string, unknown>>({ columns, data, total, renderHeaderLeft, renderHeaderRight, onRowSelected, loadMore, hasNextPage, loading, sortable, defaultSort, resizeColumn, sortDirections: allSortDirections, showHeader, onChange, }: ITableProps<T>): ReactElement;
|
|
4
4
|
export default Table;
|
package/es/Table/index.js
CHANGED
|
@@ -24,7 +24,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
24
24
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
25
25
|
|
|
26
26
|
/// <reference types ='./react-table-config' />
|
|
27
|
-
import React, { useCallback, useMemo } from 'react';
|
|
27
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
28
28
|
import { useTable, useBlockLayout, useRowSelect, useSortBy, useResizeColumns } from 'react-table';
|
|
29
29
|
import usePrefixCls from '../_utils/hooks/usePrefixCls';
|
|
30
30
|
import { FixedSizeList } from 'react-window';
|
|
@@ -36,6 +36,7 @@ import _ from 'lodash';
|
|
|
36
36
|
var DEFAULT_ROW_HEIGHT = 40;
|
|
37
37
|
var ARRAY_FIRST_INDEX = 0;
|
|
38
38
|
var DEFAULT_ROW_WIDTH = 0;
|
|
39
|
+
var DEFAULT_BODY_HEIGHT = 0;
|
|
39
40
|
|
|
40
41
|
function Table(_ref) {
|
|
41
42
|
var columns = _ref.columns,
|
|
@@ -43,7 +44,6 @@ function Table(_ref) {
|
|
|
43
44
|
total = _ref.total,
|
|
44
45
|
renderHeaderLeft = _ref.renderHeaderLeft,
|
|
45
46
|
renderHeaderRight = _ref.renderHeaderRight,
|
|
46
|
-
scrollY = _ref.scrollY,
|
|
47
47
|
onRowSelected = _ref.onRowSelected,
|
|
48
48
|
_ref$loadMore = _ref.loadMore,
|
|
49
49
|
loadMore = _ref$loadMore === void 0 ? function () {} : _ref$loadMore,
|
|
@@ -65,6 +65,18 @@ function Table(_ref) {
|
|
|
65
65
|
selectedRowId = _React$useState2[0],
|
|
66
66
|
setSelectedRowId = _React$useState2[1];
|
|
67
67
|
|
|
68
|
+
var tableBodyRef = useRef(null);
|
|
69
|
+
|
|
70
|
+
var _useState = useState(DEFAULT_BODY_HEIGHT),
|
|
71
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
72
|
+
bodyClientHeight = _useState2[0],
|
|
73
|
+
setBodyClientHeight = _useState2[1];
|
|
74
|
+
|
|
75
|
+
useEffect(function () {
|
|
76
|
+
if (tableBodyRef.current) {
|
|
77
|
+
setBodyClientHeight(tableBodyRef.current.clientHeight);
|
|
78
|
+
}
|
|
79
|
+
}, []);
|
|
68
80
|
var newColumns = useMemo(function () {
|
|
69
81
|
return columns.map(function (column) {
|
|
70
82
|
return _objectSpread(_objectSpread({}, column), {}, {
|
|
@@ -121,17 +133,6 @@ function Table(_ref) {
|
|
|
121
133
|
|
|
122
134
|
var theadRowWidthRef = React.useRef(DEFAULT_ROW_WIDTH);
|
|
123
135
|
var prefixCls = usePrefixCls('block-table');
|
|
124
|
-
|
|
125
|
-
function getTbodyStyle() {
|
|
126
|
-
if (scrollY) {
|
|
127
|
-
return {
|
|
128
|
-
height: "".concat(scrollY, "px")
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
return {};
|
|
133
|
-
}
|
|
134
|
-
|
|
135
136
|
var onRowClick = useCallback(function (row) {
|
|
136
137
|
if (!onRowSelected) {
|
|
137
138
|
return;
|
|
@@ -293,10 +294,46 @@ function Table(_ref) {
|
|
|
293
294
|
});
|
|
294
295
|
};
|
|
295
296
|
|
|
297
|
+
var renderTableBody = function renderTableBody() {
|
|
298
|
+
if (!loading && !rows.length) {
|
|
299
|
+
return /*#__PURE__*/React.createElement(Empty, {
|
|
300
|
+
description: "\u5F53\u524D\u65E0\u6570\u636E"
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
if (loadMoreItems) {
|
|
305
|
+
return /*#__PURE__*/React.createElement(InfiniteLoader, {
|
|
306
|
+
isItemLoaded: isItemLoaded,
|
|
307
|
+
itemCount: itemCount,
|
|
308
|
+
loadMoreItems: loadMoreItems
|
|
309
|
+
}, function (_ref5) {
|
|
310
|
+
var onItemsRendered = _ref5.onItemsRendered,
|
|
311
|
+
ref = _ref5.ref;
|
|
312
|
+
return /*#__PURE__*/React.createElement(FixedSizeList, {
|
|
313
|
+
itemCount: itemCount,
|
|
314
|
+
onItemsRendered: onItemsRendered,
|
|
315
|
+
height: bodyClientHeight,
|
|
316
|
+
itemSize: DEFAULT_ROW_HEIGHT,
|
|
317
|
+
width: resizeColumn ? theadRowWidthRef.current : '100%',
|
|
318
|
+
ref: ref,
|
|
319
|
+
className: "".concat(prefixCls, "-list")
|
|
320
|
+
}, RenderRow);
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
return /*#__PURE__*/React.createElement(FixedSizeList, {
|
|
325
|
+
itemCount: itemCount,
|
|
326
|
+
height: bodyClientHeight,
|
|
327
|
+
itemSize: DEFAULT_ROW_HEIGHT,
|
|
328
|
+
width: resizeColumn ? theadRowWidthRef.current : '100%',
|
|
329
|
+
className: "".concat(prefixCls, "-list")
|
|
330
|
+
}, RenderRow);
|
|
331
|
+
};
|
|
332
|
+
|
|
296
333
|
return /*#__PURE__*/React.createElement("div", {
|
|
297
334
|
className: prefixCls
|
|
298
335
|
}, showHeader && renderHeader(data.length), /*#__PURE__*/React.createElement("div", _objectSpread(_objectSpread({}, getTableProps()), {}, {
|
|
299
|
-
className: classnames(_defineProperty({}, "".concat(prefixCls, "-column-resizable"), resizeColumn))
|
|
336
|
+
className: classnames("".concat(prefixCls, "-table-wrap"), _defineProperty({}, "".concat(prefixCls, "-column-resizable"), resizeColumn))
|
|
300
337
|
}), /*#__PURE__*/React.createElement("div", {
|
|
301
338
|
className: "".concat(prefixCls, "-thead")
|
|
302
339
|
}, headerGroups.map(function (headerGroup) {
|
|
@@ -324,27 +361,9 @@ function Table(_ref) {
|
|
|
324
361
|
}));
|
|
325
362
|
}));
|
|
326
363
|
})), /*#__PURE__*/React.createElement("div", _objectSpread(_objectSpread({}, getTableBodyProps()), {}, {
|
|
327
|
-
className: classnames("".concat(prefixCls, "-tbody")
|
|
328
|
-
|
|
329
|
-
}),
|
|
330
|
-
description: "\u5F53\u524D\u65E0\u6570\u636E"
|
|
331
|
-
}), /*#__PURE__*/React.createElement(InfiniteLoader, {
|
|
332
|
-
isItemLoaded: isItemLoaded,
|
|
333
|
-
itemCount: itemCount,
|
|
334
|
-
loadMoreItems: loadMoreItems
|
|
335
|
-
}, function (_ref5) {
|
|
336
|
-
var onItemsRendered = _ref5.onItemsRendered,
|
|
337
|
-
ref = _ref5.ref;
|
|
338
|
-
return /*#__PURE__*/React.createElement(FixedSizeList, {
|
|
339
|
-
itemCount: itemCount,
|
|
340
|
-
onItemsRendered: onItemsRendered,
|
|
341
|
-
height: scrollY || data.length * DEFAULT_ROW_HEIGHT,
|
|
342
|
-
itemSize: DEFAULT_ROW_HEIGHT,
|
|
343
|
-
width: resizeColumn ? theadRowWidthRef.current : '100%',
|
|
344
|
-
ref: ref,
|
|
345
|
-
className: "".concat(prefixCls, "-list")
|
|
346
|
-
}, RenderRow);
|
|
347
|
-
}))));
|
|
364
|
+
className: classnames("".concat(prefixCls, "-tbody")),
|
|
365
|
+
ref: tableBodyRef
|
|
366
|
+
}), renderTableBody())));
|
|
348
367
|
}
|
|
349
368
|
|
|
350
369
|
export default Table;
|
package/es/Table/interface.d.ts
CHANGED
|
@@ -20,7 +20,6 @@ export interface ITableProps<T extends object> {
|
|
|
20
20
|
columns: IColumn<T>[];
|
|
21
21
|
data: T[];
|
|
22
22
|
total?: number;
|
|
23
|
-
scrollY?: number;
|
|
24
23
|
onRowSelected?: (row: T) => void;
|
|
25
24
|
loadMore?: (startIndex: number, stopIndex: number) => void | Promise<void>;
|
|
26
25
|
hasNextPage?: boolean;
|
|
@@ -1,24 +1,34 @@
|
|
|
1
1
|
@import '../../style/index.less';
|
|
2
2
|
|
|
3
|
-
@ald-prefix:ant;
|
|
4
|
-
@ald-iconfont-css-prefix:anticon;
|
|
5
|
-
@table-row-height:40px;
|
|
3
|
+
@ald-prefix: ant;
|
|
4
|
+
@ald-iconfont-css-prefix: anticon;
|
|
5
|
+
@table-row-height: 40px;
|
|
6
6
|
|
|
7
7
|
.ant-block-table {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: 100%;
|
|
8
12
|
overflow: hidden;
|
|
9
13
|
user-select: none;
|
|
10
14
|
|
|
15
|
+
&-table-wrap {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex: 1;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
}
|
|
20
|
+
|
|
11
21
|
&-cell {
|
|
12
|
-
|
|
22
|
+
flex-grow: 1;
|
|
13
23
|
height: @table-row-height;
|
|
14
|
-
|
|
15
|
-
border-bottom: 1px solid @NL95;
|
|
16
|
-
text-align: left;
|
|
17
|
-
color: @NL0;
|
|
24
|
+
padding: 0 12px;
|
|
18
25
|
overflow: hidden;
|
|
26
|
+
color: @NL0;
|
|
27
|
+
line-height: @table-row-height;
|
|
19
28
|
white-space: nowrap;
|
|
29
|
+
text-align: left;
|
|
20
30
|
text-overflow: ellipsis;
|
|
21
|
-
|
|
31
|
+
border-bottom: 1px solid @NL95;
|
|
22
32
|
}
|
|
23
33
|
|
|
24
34
|
&-row {
|
|
@@ -36,17 +46,17 @@
|
|
|
36
46
|
// border: 1px solid red;
|
|
37
47
|
|
|
38
48
|
.ant-block-table-bar {
|
|
39
|
-
display: inline-block;
|
|
40
|
-
background: blue;
|
|
41
|
-
width: 1px;
|
|
42
|
-
height: 12px;
|
|
43
49
|
position: absolute;
|
|
44
50
|
top: 50%;
|
|
45
51
|
right: 0;
|
|
46
|
-
transform: translateY(-50%);
|
|
47
52
|
z-index: 1;
|
|
48
|
-
|
|
53
|
+
display: inline-block;
|
|
54
|
+
width: 1px;
|
|
55
|
+
height: 12px;
|
|
56
|
+
background: blue;
|
|
49
57
|
background-color: @NL95;
|
|
58
|
+
transform: translateY(-50%);
|
|
59
|
+
touch-action: none;
|
|
50
60
|
}
|
|
51
61
|
|
|
52
62
|
&:last-child {
|
|
@@ -58,11 +68,11 @@
|
|
|
58
68
|
}
|
|
59
69
|
|
|
60
70
|
&-tbody {
|
|
71
|
+
flex: 1;
|
|
61
72
|
overflow: hidden;
|
|
62
73
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
overflow-y: overlay;
|
|
74
|
+
.ant-empty {
|
|
75
|
+
padding-top: 80px;
|
|
66
76
|
}
|
|
67
77
|
|
|
68
78
|
.ant-block-table-row {
|
|
@@ -87,41 +97,55 @@
|
|
|
87
97
|
}
|
|
88
98
|
|
|
89
99
|
&-loading {
|
|
90
|
-
text-align: center;
|
|
91
|
-
line-height: @table-row-height;
|
|
92
100
|
color: @NL80;
|
|
101
|
+
line-height: @table-row-height;
|
|
102
|
+
text-align: center;
|
|
93
103
|
}
|
|
94
104
|
|
|
95
105
|
&-header {
|
|
96
106
|
display: flex;
|
|
97
|
-
justify-content: space-between;
|
|
98
|
-
padding: 0 10px;
|
|
99
107
|
align-items: center;
|
|
108
|
+
justify-content: space-between;
|
|
100
109
|
margin-bottom: 24px;
|
|
110
|
+
padding: 0 10px;
|
|
101
111
|
|
|
102
112
|
&-left {
|
|
113
|
+
color: @NL0;
|
|
103
114
|
font-weight: 500;
|
|
104
115
|
font-size: 14px;
|
|
105
|
-
color: @NL0;
|
|
106
116
|
}
|
|
107
117
|
|
|
108
118
|
&-right {
|
|
109
119
|
display: flex;
|
|
120
|
+
align-items: center;
|
|
110
121
|
justify-content: flex-end;
|
|
111
122
|
height: 28px;
|
|
112
|
-
align-items: center;
|
|
113
|
-
font-size: 14px;
|
|
114
123
|
color: @NL0;
|
|
124
|
+
font-size: 14px;
|
|
115
125
|
}
|
|
116
126
|
}
|
|
117
127
|
|
|
118
128
|
&-list {
|
|
119
129
|
overflow: overlay !important;
|
|
130
|
+
|
|
131
|
+
&::-webkit-scrollbar-thumb {
|
|
132
|
+
background: @NL90;
|
|
133
|
+
background-clip: padding-box;
|
|
134
|
+
border: 3px solid transparent;
|
|
135
|
+
border-radius: 6px;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
&::-webkit-scrollbar {
|
|
139
|
+
width: 12px;
|
|
140
|
+
height: 12px;
|
|
141
|
+
min-height: 12px;
|
|
142
|
+
background-color: transparent;
|
|
143
|
+
}
|
|
120
144
|
}
|
|
121
145
|
|
|
122
146
|
&-sortIcon {
|
|
123
|
-
margin-left: 4px;
|
|
124
147
|
margin-top: -2px;
|
|
148
|
+
margin-left: 4px;
|
|
125
149
|
}
|
|
126
150
|
|
|
127
151
|
&-column-resizable {
|
|
@@ -148,4 +172,4 @@
|
|
|
148
172
|
}
|
|
149
173
|
}
|
|
150
174
|
}
|
|
151
|
-
}
|
|
175
|
+
}
|
package/es/Tabs/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import "antd/es/tabs/style";
|
|
2
|
+
import _Tabs from "antd/es/tabs";
|
|
1
3
|
var _excluded = ["size", "className", "adaptHeight"];
|
|
2
4
|
|
|
3
5
|
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; }
|
|
@@ -10,8 +12,8 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
10
12
|
|
|
11
13
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
12
14
|
|
|
13
|
-
import React from 'react';
|
|
14
|
-
|
|
15
|
+
import React from 'react'; // import AntdTabs, { TabsProps } from 'antd/lib/tabs';
|
|
16
|
+
|
|
15
17
|
import Icon from '../Icon';
|
|
16
18
|
import TabPane from './TabPane';
|
|
17
19
|
import classNames from 'classnames';
|
|
@@ -27,7 +29,7 @@ export default function Tabs(props) {
|
|
|
27
29
|
tabsProps.size = size;
|
|
28
30
|
}
|
|
29
31
|
|
|
30
|
-
return /*#__PURE__*/React.createElement(
|
|
32
|
+
return /*#__PURE__*/React.createElement(_Tabs, _objectSpread({
|
|
31
33
|
moreIcon: /*#__PURE__*/React.createElement(Icon, {
|
|
32
34
|
type: "more_vert",
|
|
33
35
|
size: 18
|
package/es/Tabs/style/index.d.ts
CHANGED
package/es/Tabs/style/index.js
CHANGED
package/es/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export { MenuClickEventHandler } from 'rc-menu/lib/interface';
|
|
|
7
7
|
export { default as Menu } from './Menu';
|
|
8
8
|
export type { IMenuProps as MenuProps } from './Menu';
|
|
9
9
|
export { default as Input } from './Input';
|
|
10
|
-
export type { IInputProps as InputProps, TSize } from './Input';
|
|
10
|
+
export type { IInputProps as InputProps, TSize, InputRef, TextAreaRef } from './Input';
|
|
11
11
|
export { default as Tabs } from './Tabs';
|
|
12
12
|
export type { ITabsProps as TabsProps, TabsSize } from './Tabs';
|
|
13
13
|
export { default as Tooltip } from './Tooltip';
|
package/es/style/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import 'antd/
|
|
1
|
+
import 'antd/lib/style/compact.less';
|
|
2
2
|
import './index.less';
|
package/es/style/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import 'antd/
|
|
1
|
+
import 'antd/lib/style/compact.less';
|
|
2
2
|
import './index.less';
|
package/lib/Dropdown/Button.d.ts
CHANGED
package/lib/Dropdown/Button.js
CHANGED
|
@@ -9,6 +9,8 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _Button = _interopRequireDefault(require("../Button"));
|
|
11
11
|
|
|
12
|
+
require("../Button/style");
|
|
13
|
+
|
|
12
14
|
var _index = _interopRequireDefault(require("./index"));
|
|
13
15
|
|
|
14
16
|
var _Icon = _interopRequireDefault(require("../Icon"));
|
package/lib/Input/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import TextArea from './components/TextArea';
|
|
|
5
5
|
import Password from './components/Password';
|
|
6
6
|
export type { IInputProps, InputRef, TSize } from './components/Input';
|
|
7
7
|
export type { IGroupProps } from './components/Group';
|
|
8
|
-
export type { ITextAreaProps } from './components/TextArea';
|
|
8
|
+
export type { ITextAreaProps, TextAreaRef } from './components/TextArea';
|
|
9
9
|
export type { IPasswordProps } from './components/Password';
|
|
10
10
|
interface ICompoundedComponent extends React.ForwardRefExoticComponent<IInputProps & React.RefAttributes<InputRef>> {
|
|
11
11
|
Group: typeof Group;
|
package/lib/Input/style/index.js
CHANGED
package/lib/Menu/style/index.js
CHANGED
package/lib/Table/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { ITableProps } from './interface';
|
|
3
|
-
declare function Table<T extends Record<string, unknown>>({ columns, data, total, renderHeaderLeft, renderHeaderRight,
|
|
3
|
+
declare function Table<T extends Record<string, unknown>>({ columns, data, total, renderHeaderLeft, renderHeaderRight, onRowSelected, loadMore, hasNextPage, loading, sortable, defaultSort, resizeColumn, sortDirections: allSortDirections, showHeader, onChange, }: ITableProps<T>): ReactElement;
|
|
4
4
|
export default Table;
|
package/lib/Table/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var _reactWindow = require("react-window");
|
|
|
17
17
|
|
|
18
18
|
var _reactWindowInfiniteLoader = _interopRequireDefault(require("react-window-infinite-loader"));
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _classnames5 = _interopRequireDefault(require("classnames"));
|
|
21
21
|
|
|
22
22
|
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
23
23
|
|
|
@@ -59,6 +59,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
59
59
|
var DEFAULT_ROW_HEIGHT = 40;
|
|
60
60
|
var ARRAY_FIRST_INDEX = 0;
|
|
61
61
|
var DEFAULT_ROW_WIDTH = 0;
|
|
62
|
+
var DEFAULT_BODY_HEIGHT = 0;
|
|
62
63
|
|
|
63
64
|
function Table(_ref) {
|
|
64
65
|
var columns = _ref.columns,
|
|
@@ -66,7 +67,6 @@ function Table(_ref) {
|
|
|
66
67
|
total = _ref.total,
|
|
67
68
|
renderHeaderLeft = _ref.renderHeaderLeft,
|
|
68
69
|
renderHeaderRight = _ref.renderHeaderRight,
|
|
69
|
-
scrollY = _ref.scrollY,
|
|
70
70
|
onRowSelected = _ref.onRowSelected,
|
|
71
71
|
_ref$loadMore = _ref.loadMore,
|
|
72
72
|
loadMore = _ref$loadMore === void 0 ? function () {} : _ref$loadMore,
|
|
@@ -88,6 +88,18 @@ function Table(_ref) {
|
|
|
88
88
|
selectedRowId = _React$useState2[0],
|
|
89
89
|
setSelectedRowId = _React$useState2[1];
|
|
90
90
|
|
|
91
|
+
var tableBodyRef = (0, _react.useRef)(null);
|
|
92
|
+
|
|
93
|
+
var _useState = (0, _react.useState)(DEFAULT_BODY_HEIGHT),
|
|
94
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
95
|
+
bodyClientHeight = _useState2[0],
|
|
96
|
+
setBodyClientHeight = _useState2[1];
|
|
97
|
+
|
|
98
|
+
(0, _react.useEffect)(function () {
|
|
99
|
+
if (tableBodyRef.current) {
|
|
100
|
+
setBodyClientHeight(tableBodyRef.current.clientHeight);
|
|
101
|
+
}
|
|
102
|
+
}, []);
|
|
91
103
|
var newColumns = (0, _react.useMemo)(function () {
|
|
92
104
|
return columns.map(function (column) {
|
|
93
105
|
return _objectSpread(_objectSpread({}, column), {}, {
|
|
@@ -145,17 +157,6 @@ function Table(_ref) {
|
|
|
145
157
|
var theadRowWidthRef = _react.default.useRef(DEFAULT_ROW_WIDTH);
|
|
146
158
|
|
|
147
159
|
var prefixCls = (0, _usePrefixCls.default)('block-table');
|
|
148
|
-
|
|
149
|
-
function getTbodyStyle() {
|
|
150
|
-
if (scrollY) {
|
|
151
|
-
return {
|
|
152
|
-
height: "".concat(scrollY, "px")
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
return {};
|
|
157
|
-
}
|
|
158
|
-
|
|
159
160
|
var onRowClick = (0, _react.useCallback)(function (row) {
|
|
160
161
|
if (!onRowSelected) {
|
|
161
162
|
return;
|
|
@@ -178,7 +179,7 @@ function Table(_ref) {
|
|
|
178
179
|
if (!isItemLoaded(index)) {
|
|
179
180
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
180
181
|
style: style,
|
|
181
|
-
className: (0,
|
|
182
|
+
className: (0, _classnames5.default)("".concat(prefixCls, "-loading"))
|
|
182
183
|
}, /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
183
184
|
type: "waiting",
|
|
184
185
|
size: 16
|
|
@@ -196,24 +197,24 @@ function Table(_ref) {
|
|
|
196
197
|
style: _objectSpread(_objectSpread(_objectSpread({}, style), rowStyle), {}, {
|
|
197
198
|
width: resizeColumn ? style === null || style === void 0 ? void 0 : style.width : '100%'
|
|
198
199
|
}),
|
|
199
|
-
className: (0,
|
|
200
|
+
className: (0, _classnames5.default)("".concat(prefixCls, "-row"), _defineProperty({}, "".concat(prefixCls, "-row-selected"), row.id === selectedRowId)),
|
|
200
201
|
onClick: function onClick() {
|
|
201
202
|
return onRowClick(row);
|
|
202
203
|
}
|
|
203
204
|
}), row.cells.map(function (cell) {
|
|
204
205
|
return /*#__PURE__*/_react.default.createElement("div", _objectSpread(_objectSpread({}, cell.getCellProps()), {}, {
|
|
205
|
-
className: (0,
|
|
206
|
+
className: (0, _classnames5.default)("".concat(prefixCls, "-cell"))
|
|
206
207
|
}), cell.render('Cell'));
|
|
207
208
|
}));
|
|
208
209
|
};
|
|
209
210
|
|
|
210
211
|
var renderHeader = function renderHeader(len) {
|
|
211
212
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
212
|
-
className: (0,
|
|
213
|
+
className: (0, _classnames5.default)("".concat(prefixCls, "-header"))
|
|
213
214
|
}, renderHeaderLeft ? renderHeaderLeft() : /*#__PURE__*/_react.default.createElement("span", {
|
|
214
|
-
className: (0,
|
|
215
|
+
className: (0, _classnames5.default)("".concat(prefixCls, "-header-left"))
|
|
215
216
|
}, "\u5171\u8BA1", total || len, "\u6761"), /*#__PURE__*/_react.default.createElement("div", {
|
|
216
|
-
className: (0,
|
|
217
|
+
className: (0, _classnames5.default)("".concat(prefixCls, "-header-right"))
|
|
217
218
|
}, renderHeaderRight ? renderHeaderRight() : null));
|
|
218
219
|
};
|
|
219
220
|
|
|
@@ -317,10 +318,46 @@ function Table(_ref) {
|
|
|
317
318
|
});
|
|
318
319
|
};
|
|
319
320
|
|
|
321
|
+
var renderTableBody = function renderTableBody() {
|
|
322
|
+
if (!loading && !rows.length) {
|
|
323
|
+
return /*#__PURE__*/_react.default.createElement(_Empty.default, {
|
|
324
|
+
description: "\u5F53\u524D\u65E0\u6570\u636E"
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
if (loadMoreItems) {
|
|
329
|
+
return /*#__PURE__*/_react.default.createElement(_reactWindowInfiniteLoader.default, {
|
|
330
|
+
isItemLoaded: isItemLoaded,
|
|
331
|
+
itemCount: itemCount,
|
|
332
|
+
loadMoreItems: loadMoreItems
|
|
333
|
+
}, function (_ref5) {
|
|
334
|
+
var onItemsRendered = _ref5.onItemsRendered,
|
|
335
|
+
ref = _ref5.ref;
|
|
336
|
+
return /*#__PURE__*/_react.default.createElement(_reactWindow.FixedSizeList, {
|
|
337
|
+
itemCount: itemCount,
|
|
338
|
+
onItemsRendered: onItemsRendered,
|
|
339
|
+
height: bodyClientHeight,
|
|
340
|
+
itemSize: DEFAULT_ROW_HEIGHT,
|
|
341
|
+
width: resizeColumn ? theadRowWidthRef.current : '100%',
|
|
342
|
+
ref: ref,
|
|
343
|
+
className: "".concat(prefixCls, "-list")
|
|
344
|
+
}, RenderRow);
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
return /*#__PURE__*/_react.default.createElement(_reactWindow.FixedSizeList, {
|
|
349
|
+
itemCount: itemCount,
|
|
350
|
+
height: bodyClientHeight,
|
|
351
|
+
itemSize: DEFAULT_ROW_HEIGHT,
|
|
352
|
+
width: resizeColumn ? theadRowWidthRef.current : '100%',
|
|
353
|
+
className: "".concat(prefixCls, "-list")
|
|
354
|
+
}, RenderRow);
|
|
355
|
+
};
|
|
356
|
+
|
|
320
357
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
321
358
|
className: prefixCls
|
|
322
359
|
}, showHeader && renderHeader(data.length), /*#__PURE__*/_react.default.createElement("div", _objectSpread(_objectSpread({}, getTableProps()), {}, {
|
|
323
|
-
className: (0,
|
|
360
|
+
className: (0, _classnames5.default)("".concat(prefixCls, "-table-wrap"), _defineProperty({}, "".concat(prefixCls, "-column-resizable"), resizeColumn))
|
|
324
361
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
325
362
|
className: "".concat(prefixCls, "-thead")
|
|
326
363
|
}, headerGroups.map(function (headerGroup) {
|
|
@@ -338,37 +375,19 @@ function Table(_ref) {
|
|
|
338
375
|
var barPorps = resizeColumn ? column.getResizerProps() : {};
|
|
339
376
|
return /*#__PURE__*/_react.default.createElement("div", _objectSpread(_objectSpread({
|
|
340
377
|
// {...column.getHeaderProps(column.getSortByToggleProps())}
|
|
341
|
-
className: (0,
|
|
378
|
+
className: (0, _classnames5.default)(_defineProperty({}, "".concat(prefixCls, "-cell-sorting"), column.id === sortDirection.id), "".concat(prefixCls, "-cell"))
|
|
342
379
|
}, getHeaderProps(column)), {}, {
|
|
343
380
|
key: column.id
|
|
344
381
|
}), column.render('Header'), /*#__PURE__*/_react.default.createElement("div", _objectSpread(_objectSpread({}, barPorps), {}, {
|
|
345
|
-
className: (0,
|
|
382
|
+
className: (0, _classnames5.default)(_defineProperty({}, "".concat(prefixCls, "-dragBar"), resizeColumn), "".concat(prefixCls, "-bar"))
|
|
346
383
|
})), /*#__PURE__*/_react.default.createElement(SortIcons, {
|
|
347
384
|
id: column.id
|
|
348
385
|
}));
|
|
349
386
|
}));
|
|
350
387
|
})), /*#__PURE__*/_react.default.createElement("div", _objectSpread(_objectSpread({}, getTableBodyProps()), {}, {
|
|
351
|
-
className: (0,
|
|
352
|
-
|
|
353
|
-
}),
|
|
354
|
-
description: "\u5F53\u524D\u65E0\u6570\u636E"
|
|
355
|
-
}), /*#__PURE__*/_react.default.createElement(_reactWindowInfiniteLoader.default, {
|
|
356
|
-
isItemLoaded: isItemLoaded,
|
|
357
|
-
itemCount: itemCount,
|
|
358
|
-
loadMoreItems: loadMoreItems
|
|
359
|
-
}, function (_ref5) {
|
|
360
|
-
var onItemsRendered = _ref5.onItemsRendered,
|
|
361
|
-
ref = _ref5.ref;
|
|
362
|
-
return /*#__PURE__*/_react.default.createElement(_reactWindow.FixedSizeList, {
|
|
363
|
-
itemCount: itemCount,
|
|
364
|
-
onItemsRendered: onItemsRendered,
|
|
365
|
-
height: scrollY || data.length * DEFAULT_ROW_HEIGHT,
|
|
366
|
-
itemSize: DEFAULT_ROW_HEIGHT,
|
|
367
|
-
width: resizeColumn ? theadRowWidthRef.current : '100%',
|
|
368
|
-
ref: ref,
|
|
369
|
-
className: "".concat(prefixCls, "-list")
|
|
370
|
-
}, RenderRow);
|
|
371
|
-
}))));
|
|
388
|
+
className: (0, _classnames5.default)("".concat(prefixCls, "-tbody")),
|
|
389
|
+
ref: tableBodyRef
|
|
390
|
+
}), renderTableBody())));
|
|
372
391
|
}
|
|
373
392
|
|
|
374
393
|
var _default = Table;
|
package/lib/Table/interface.d.ts
CHANGED
|
@@ -20,7 +20,6 @@ export interface ITableProps<T extends object> {
|
|
|
20
20
|
columns: IColumn<T>[];
|
|
21
21
|
data: T[];
|
|
22
22
|
total?: number;
|
|
23
|
-
scrollY?: number;
|
|
24
23
|
onRowSelected?: (row: T) => void;
|
|
25
24
|
loadMore?: (startIndex: number, stopIndex: number) => void | Promise<void>;
|
|
26
25
|
hasNextPage?: boolean;
|
|
@@ -1,24 +1,34 @@
|
|
|
1
1
|
@import '../../style/index.less';
|
|
2
2
|
|
|
3
|
-
@ald-prefix:ant;
|
|
4
|
-
@ald-iconfont-css-prefix:anticon;
|
|
5
|
-
@table-row-height:40px;
|
|
3
|
+
@ald-prefix: ant;
|
|
4
|
+
@ald-iconfont-css-prefix: anticon;
|
|
5
|
+
@table-row-height: 40px;
|
|
6
6
|
|
|
7
7
|
.ant-block-table {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: 100%;
|
|
8
12
|
overflow: hidden;
|
|
9
13
|
user-select: none;
|
|
10
14
|
|
|
15
|
+
&-table-wrap {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex: 1;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
}
|
|
20
|
+
|
|
11
21
|
&-cell {
|
|
12
|
-
|
|
22
|
+
flex-grow: 1;
|
|
13
23
|
height: @table-row-height;
|
|
14
|
-
|
|
15
|
-
border-bottom: 1px solid @NL95;
|
|
16
|
-
text-align: left;
|
|
17
|
-
color: @NL0;
|
|
24
|
+
padding: 0 12px;
|
|
18
25
|
overflow: hidden;
|
|
26
|
+
color: @NL0;
|
|
27
|
+
line-height: @table-row-height;
|
|
19
28
|
white-space: nowrap;
|
|
29
|
+
text-align: left;
|
|
20
30
|
text-overflow: ellipsis;
|
|
21
|
-
|
|
31
|
+
border-bottom: 1px solid @NL95;
|
|
22
32
|
}
|
|
23
33
|
|
|
24
34
|
&-row {
|
|
@@ -36,17 +46,17 @@
|
|
|
36
46
|
// border: 1px solid red;
|
|
37
47
|
|
|
38
48
|
.ant-block-table-bar {
|
|
39
|
-
display: inline-block;
|
|
40
|
-
background: blue;
|
|
41
|
-
width: 1px;
|
|
42
|
-
height: 12px;
|
|
43
49
|
position: absolute;
|
|
44
50
|
top: 50%;
|
|
45
51
|
right: 0;
|
|
46
|
-
transform: translateY(-50%);
|
|
47
52
|
z-index: 1;
|
|
48
|
-
|
|
53
|
+
display: inline-block;
|
|
54
|
+
width: 1px;
|
|
55
|
+
height: 12px;
|
|
56
|
+
background: blue;
|
|
49
57
|
background-color: @NL95;
|
|
58
|
+
transform: translateY(-50%);
|
|
59
|
+
touch-action: none;
|
|
50
60
|
}
|
|
51
61
|
|
|
52
62
|
&:last-child {
|
|
@@ -58,11 +68,11 @@
|
|
|
58
68
|
}
|
|
59
69
|
|
|
60
70
|
&-tbody {
|
|
71
|
+
flex: 1;
|
|
61
72
|
overflow: hidden;
|
|
62
73
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
overflow-y: overlay;
|
|
74
|
+
.ant-empty {
|
|
75
|
+
padding-top: 80px;
|
|
66
76
|
}
|
|
67
77
|
|
|
68
78
|
.ant-block-table-row {
|
|
@@ -87,41 +97,55 @@
|
|
|
87
97
|
}
|
|
88
98
|
|
|
89
99
|
&-loading {
|
|
90
|
-
text-align: center;
|
|
91
|
-
line-height: @table-row-height;
|
|
92
100
|
color: @NL80;
|
|
101
|
+
line-height: @table-row-height;
|
|
102
|
+
text-align: center;
|
|
93
103
|
}
|
|
94
104
|
|
|
95
105
|
&-header {
|
|
96
106
|
display: flex;
|
|
97
|
-
justify-content: space-between;
|
|
98
|
-
padding: 0 10px;
|
|
99
107
|
align-items: center;
|
|
108
|
+
justify-content: space-between;
|
|
100
109
|
margin-bottom: 24px;
|
|
110
|
+
padding: 0 10px;
|
|
101
111
|
|
|
102
112
|
&-left {
|
|
113
|
+
color: @NL0;
|
|
103
114
|
font-weight: 500;
|
|
104
115
|
font-size: 14px;
|
|
105
|
-
color: @NL0;
|
|
106
116
|
}
|
|
107
117
|
|
|
108
118
|
&-right {
|
|
109
119
|
display: flex;
|
|
120
|
+
align-items: center;
|
|
110
121
|
justify-content: flex-end;
|
|
111
122
|
height: 28px;
|
|
112
|
-
align-items: center;
|
|
113
|
-
font-size: 14px;
|
|
114
123
|
color: @NL0;
|
|
124
|
+
font-size: 14px;
|
|
115
125
|
}
|
|
116
126
|
}
|
|
117
127
|
|
|
118
128
|
&-list {
|
|
119
129
|
overflow: overlay !important;
|
|
130
|
+
|
|
131
|
+
&::-webkit-scrollbar-thumb {
|
|
132
|
+
background: @NL90;
|
|
133
|
+
background-clip: padding-box;
|
|
134
|
+
border: 3px solid transparent;
|
|
135
|
+
border-radius: 6px;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
&::-webkit-scrollbar {
|
|
139
|
+
width: 12px;
|
|
140
|
+
height: 12px;
|
|
141
|
+
min-height: 12px;
|
|
142
|
+
background-color: transparent;
|
|
143
|
+
}
|
|
120
144
|
}
|
|
121
145
|
|
|
122
146
|
&-sortIcon {
|
|
123
|
-
margin-left: 4px;
|
|
124
147
|
margin-top: -2px;
|
|
148
|
+
margin-left: 4px;
|
|
125
149
|
}
|
|
126
150
|
|
|
127
151
|
&-column-resizable {
|
|
@@ -148,4 +172,4 @@
|
|
|
148
172
|
}
|
|
149
173
|
}
|
|
150
174
|
}
|
|
151
|
-
}
|
|
175
|
+
}
|
package/lib/Tabs/index.js
CHANGED
|
@@ -5,9 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = Tabs;
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
require("antd/es/tabs/style");
|
|
9
|
+
|
|
10
|
+
var _tabs = _interopRequireDefault(require("antd/es/tabs"));
|
|
9
11
|
|
|
10
|
-
var
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
13
|
|
|
12
14
|
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
13
15
|
|
package/lib/Tabs/style/index.js
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export { MenuClickEventHandler } from 'rc-menu/lib/interface';
|
|
|
7
7
|
export { default as Menu } from './Menu';
|
|
8
8
|
export type { IMenuProps as MenuProps } from './Menu';
|
|
9
9
|
export { default as Input } from './Input';
|
|
10
|
-
export type { IInputProps as InputProps, TSize } from './Input';
|
|
10
|
+
export type { IInputProps as InputProps, TSize, InputRef, TextAreaRef } from './Input';
|
|
11
11
|
export { default as Tabs } from './Tabs';
|
|
12
12
|
export type { ITabsProps as TabsProps, TabsSize } from './Tabs';
|
|
13
13
|
export { default as Tooltip } from './Tooltip';
|
package/lib/style/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import 'antd/
|
|
1
|
+
import 'antd/lib/style/compact.less';
|
|
2
2
|
import './index.less';
|
package/lib/style/index.js
CHANGED
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.11",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"start": "dumi dev",
|
|
6
6
|
"docs:build": "dumi build",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"gh-pages": "^3.0.0",
|
|
88
88
|
"husky": "^3.0.9",
|
|
89
89
|
"lint-staged": "^10.0.7",
|
|
90
|
-
"postcss": "^8.4.
|
|
90
|
+
"postcss": "^8.4.12",
|
|
91
91
|
"postcss-import": "^14.1.0",
|
|
92
92
|
"postcss-less": "^6.0.0",
|
|
93
93
|
"prettier": "^2.2.1",
|