@aloudata/aloudata-design 0.4.0-beta.1 → 0.4.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/Avatar/component/Avatar/index.d.ts +84 -0
- package/es/Avatar/component/Avatar/index.js +42 -0
- package/es/Avatar/index.d.ts +1 -13
- package/es/Avatar/index.js +1 -30
- package/es/Avatar/style/index.less +1 -1
- package/es/Breadcrumb/index.d.ts +5 -2
- package/es/Breadcrumb/index.js +17 -7
- package/es/Button/index.d.ts +1 -1
- package/es/Button/index.js +3 -8
- package/es/Button/style/index.less +6 -0
- package/es/Button/style/variables.less +26 -26
- package/es/Checkbox/component/CheckboxGroup/index.d.ts +4 -0
- package/es/Checkbox/component/CheckboxGroup/index.js +27 -0
- package/es/Checkbox/index.d.ts +4 -5
- package/es/Checkbox/index.js +3 -12
- package/es/Checkbox/style/index.less +36 -16
- package/es/Checkbox/type.d.ts +94 -0
- package/es/Checkbox/type.js +6 -0
- package/es/Divider/index.d.ts +40 -2
- package/es/Divider/index.js +10 -1
- package/es/Divider/style/index.less +4 -0
- package/es/Divider/style/index.less.d.ts +183 -0
- package/es/Dropdown/Button.d.ts +4 -4
- package/es/Dropdown/Button.js +5 -5
- package/es/Dropdown/index.d.ts +5 -5
- package/es/Dropdown/index.js +5 -5
- package/es/Icon/icons.d.ts +9 -0
- package/es/Icon/icons.js +1590 -0
- package/es/Input/components/Input/index.d.ts +13 -1
- package/es/Input/components/Input/index.js +1 -3
- package/es/Input/components/Password/index.d.ts +6 -1
- package/es/Input/components/Password/index.js +11 -3
- package/es/Input/components/TextArea/index.d.ts +1 -1
- package/es/Input/style/index.less +139 -59
- package/es/InputNumber/index.d.ts +3 -3
- package/es/InputNumber/style/index.less +66 -26
- package/es/InputNumber/type.d.ts +161 -0
- package/es/InputNumber/type.js +1 -0
- package/es/Menu/index.d.ts +2 -0
- package/es/Popconfirm/index.d.ts +90 -0
- package/es/Popconfirm/index.js +111 -0
- package/es/Popconfirm/style/index.d.ts +2 -0
- package/es/Popconfirm/style/index.js +2 -0
- package/es/Popconfirm/style/index.less +57 -0
- package/es/Progress/index.d.ts +3 -0
- package/es/Progress/index.js +2 -0
- package/es/Progress/style/index.d.ts +2 -0
- package/es/Progress/style/index.js +2 -0
- package/es/Progress/style/index.less +1 -0
- package/es/Select/style/variables.less.d.ts +6 -0
- package/es/Steps/style/index.less +10 -4
- package/es/Table/Table.js +87 -91
- package/es/Table/components/TableHead/index.d.ts +0 -1
- package/es/Table/components/TableHead/index.js +1 -2
- package/es/Table/interface.d.ts +2 -0
- package/es/Table/style/index.less +14 -5
- package/es/Table/style/variable.less +0 -5
- package/es/Table/style/variable.less.d.ts +1 -1
- package/es/Table/utils.js +16 -9
- package/es/Tabs/index.d.ts +21 -6
- package/es/Tabs/index.js +3 -5
- package/es/Tabs/style/index.less +1 -1
- package/es/Tooltip/index.d.ts +2 -2
- package/es/Tooltip/index.js +4 -4
- package/es/index.d.ts +7 -3
- package/es/index.js +3 -1
- package/es/style/themes/default/scrollBar.less +10 -7
- package/es/style/themes/default/themeColor.module.less +176 -166
- package/es/style/themes/default/themeColor.module.less.d.ts +6 -0
- package/lib/Avatar/component/Avatar/index.d.ts +84 -0
- package/lib/Avatar/component/Avatar/index.js +61 -0
- package/lib/Avatar/index.d.ts +1 -13
- package/lib/Avatar/index.js +3 -44
- package/lib/Avatar/style/index.less +1 -1
- package/lib/Breadcrumb/index.d.ts +5 -2
- package/lib/Breadcrumb/index.js +17 -8
- package/lib/Button/index.d.ts +1 -1
- package/lib/Button/index.js +3 -8
- package/lib/Button/style/index.less +6 -0
- package/lib/Button/style/variables.less +26 -26
- package/lib/Checkbox/component/CheckboxGroup/index.d.ts +4 -0
- package/lib/Checkbox/component/CheckboxGroup/index.js +42 -0
- package/lib/Checkbox/index.d.ts +4 -5
- package/lib/Checkbox/index.js +4 -13
- package/lib/Checkbox/style/index.less +36 -16
- package/lib/Checkbox/type.d.ts +94 -0
- package/lib/Checkbox/type.js +13 -0
- package/lib/Divider/index.d.ts +40 -2
- package/lib/Divider/index.js +11 -1
- package/lib/Divider/style/index.less +4 -0
- package/lib/Divider/style/index.less.d.ts +183 -0
- package/lib/Dropdown/Button.d.ts +4 -4
- package/lib/Dropdown/Button.js +5 -5
- package/lib/Dropdown/index.d.ts +5 -5
- package/lib/Dropdown/index.js +5 -5
- package/lib/Icon/icons.d.ts +9 -0
- package/lib/Icon/icons.js +1597 -0
- package/lib/Input/components/Input/index.d.ts +13 -1
- package/lib/Input/components/Input/index.js +1 -3
- package/lib/Input/components/Password/index.d.ts +6 -1
- package/lib/Input/components/Password/index.js +14 -4
- package/lib/Input/components/TextArea/index.d.ts +1 -1
- package/lib/Input/style/index.less +139 -59
- package/lib/InputNumber/index.d.ts +3 -3
- package/lib/InputNumber/style/index.less +66 -26
- package/lib/InputNumber/type.d.ts +161 -0
- package/lib/InputNumber/type.js +5 -0
- package/lib/Menu/index.d.ts +2 -0
- package/lib/Popconfirm/index.d.ts +90 -0
- package/lib/Popconfirm/index.js +127 -0
- package/lib/Popconfirm/style/index.d.ts +2 -0
- package/lib/Popconfirm/style/index.js +5 -0
- package/lib/Popconfirm/style/index.less +57 -0
- package/lib/Progress/index.d.ts +3 -0
- package/lib/Progress/index.js +13 -0
- package/lib/Progress/style/index.d.ts +2 -0
- package/lib/Progress/style/index.js +5 -0
- package/lib/Progress/style/index.less +1 -0
- package/lib/Select/style/variables.less.d.ts +6 -0
- package/lib/Steps/style/index.less +10 -4
- package/lib/Table/Table.js +90 -96
- package/lib/Table/components/TableHead/index.d.ts +0 -1
- package/lib/Table/components/TableHead/index.js +1 -2
- package/lib/Table/interface.d.ts +2 -0
- package/lib/Table/style/index.less +14 -5
- package/lib/Table/style/variable.less +0 -5
- package/lib/Table/style/variable.less.d.ts +1 -1
- package/lib/Table/utils.js +16 -9
- package/lib/Tabs/index.d.ts +21 -6
- package/lib/Tabs/index.js +3 -7
- package/lib/Tabs/style/index.less +1 -1
- package/lib/Tooltip/index.d.ts +2 -2
- package/lib/Tooltip/index.js +4 -4
- package/lib/index.d.ts +7 -3
- package/lib/index.js +16 -0
- package/lib/style/themes/default/scrollBar.less +10 -7
- package/lib/style/themes/default/themeColor.module.less +176 -166
- package/lib/style/themes/default/themeColor.module.less.d.ts +6 -0
- package/package.json +4 -3
- package/es/Icon/icons.json +0 -418
- package/es/Table/hooks/useFrame.d.ts +0 -7
- package/es/Table/hooks/useFrame.js +0 -90
- package/es/Table/hooks/useTableColumn.d.ts +0 -28
- package/es/Table/hooks/useTableColumn.js +0 -53
- package/es/Table/style/index.less.d.ts +0 -126
- package/es/Tabs/TabPane.d.ts +0 -21
- package/es/Tabs/TabPane.js +0 -6
- package/lib/Icon/icons.json +0 -418
- package/lib/Table/hooks/useFrame.d.ts +0 -7
- package/lib/Table/hooks/useFrame.js +0 -98
- package/lib/Table/hooks/useTableColumn.d.ts +0 -28
- package/lib/Table/hooks/useTableColumn.js +0 -66
- package/lib/Table/style/index.less.d.ts +0 -126
- package/lib/Tabs/TabPane.d.ts +0 -21
- package/lib/Tabs/TabPane.js +0 -18
package/es/Table/Table.js
CHANGED
|
@@ -30,15 +30,14 @@ import Loading from './components/Loading';
|
|
|
30
30
|
import Empty from './components/Empty';
|
|
31
31
|
import TableHead from './components/TableHead';
|
|
32
32
|
import TableBodyRowList from './components/TableBodyRowList';
|
|
33
|
-
|
|
34
|
-
import StylesVariable from './style/variable.less';
|
|
35
|
-
var SCROLLBAR_SIZE = 15;
|
|
33
|
+
var tableHeadRowHeight = 44;
|
|
36
34
|
var ZERO = 0;
|
|
37
35
|
|
|
38
36
|
function Table(props, ref) {
|
|
39
|
-
var
|
|
37
|
+
var _classnames2;
|
|
40
38
|
|
|
41
|
-
var
|
|
39
|
+
var outerKey = props.key,
|
|
40
|
+
columns = props.columns,
|
|
42
41
|
data = props.data,
|
|
43
42
|
onRowSelected = props.onRowSelected,
|
|
44
43
|
loadMore = props.loadMore,
|
|
@@ -61,21 +60,19 @@ function Table(props, ref) {
|
|
|
61
60
|
rowKey = props.rowKey,
|
|
62
61
|
height = props.height;
|
|
63
62
|
|
|
64
|
-
var _useState = useState(
|
|
63
|
+
var _useState = useState(undefined),
|
|
65
64
|
_useState2 = _slicedToArray(_useState, 2),
|
|
66
65
|
tableClientWidth = _useState2[0],
|
|
67
66
|
setTableClientWidth = _useState2[1];
|
|
68
67
|
|
|
69
|
-
var _useState3 = useState(
|
|
68
|
+
var _useState3 = useState(undefined),
|
|
70
69
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
71
70
|
tableClientHeight = _useState4[0],
|
|
72
71
|
setTableClientHeight = _useState4[1];
|
|
73
72
|
|
|
74
73
|
var prefixCls = usePrefixCls('', 'ald-table');
|
|
75
74
|
var tableRef = useRef(null);
|
|
76
|
-
var tableHeadRef = useRef(null);
|
|
77
75
|
var tableBodyRef = useRef(null);
|
|
78
|
-
var columnsRef = useRef([]);
|
|
79
76
|
var columnsWidthMapRef = useRef();
|
|
80
77
|
var columnsTotalWidthRef = useRef(ZERO);
|
|
81
78
|
|
|
@@ -84,19 +81,23 @@ function Table(props, ref) {
|
|
|
84
81
|
loadMoreLoading = _useState6[0],
|
|
85
82
|
setLoadMoreLoading = _useState6[1];
|
|
86
83
|
|
|
87
|
-
var lastOffsetLeftRef = useRef(ZERO);
|
|
88
84
|
var lastOffsetTopRef = useRef(ZERO);
|
|
89
85
|
|
|
90
|
-
var
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
86
|
+
var _useState7 = useState(ZERO),
|
|
87
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
88
|
+
tableBodyContentHeight = _useState8[0],
|
|
89
|
+
setTableBodyContentHeight = _useState8[1]; // 如果列长度存在变化时,触发重新计算页面的宽度,否则需要用户手动更改key
|
|
94
90
|
|
|
95
91
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
} // 初始化进入时 渲染表格容器宽度
|
|
92
|
+
var tableKey = useMemo(function () {
|
|
93
|
+
var columnLength = (columns === null || columns === void 0 ? void 0 : columns.length) || ZERO;
|
|
99
94
|
|
|
95
|
+
if (outerKey) {
|
|
96
|
+
return "".concat(outerKey, "-").concat(columnLength);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return "".concat(columnLength);
|
|
100
|
+
}, [columns === null || columns === void 0 ? void 0 : columns.length, outerKey]); // 初始化进入时 渲染表格容器宽度
|
|
100
101
|
|
|
101
102
|
useEffect(function () {
|
|
102
103
|
if (tableRef.current) {
|
|
@@ -105,18 +106,22 @@ function Table(props, ref) {
|
|
|
105
106
|
}, []); // 转换外部传入的columns
|
|
106
107
|
|
|
107
108
|
var newColumns = useMemo(function () {
|
|
108
|
-
|
|
109
|
+
if (!tableClientWidth) {
|
|
110
|
+
return [];
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
var _getColumnsWidthMap = getColumnsWidthMap(columns, tableClientWidth, columnsWidthMapRef.current),
|
|
109
114
|
columnsWidthMap = _getColumnsWidthMap.columnsWidthMap,
|
|
110
115
|
totalColumnWidth = _getColumnsWidthMap.totalColumnWidth;
|
|
111
116
|
|
|
112
117
|
columnsWidthMapRef.current = columnsWidthMap;
|
|
113
118
|
columnsTotalWidthRef.current = totalColumnWidth;
|
|
114
|
-
return
|
|
119
|
+
return columns.map(function (column, index) {
|
|
115
120
|
var _columnsWidthMapRef$c, _columnsWidthMapRef$c2;
|
|
116
121
|
|
|
117
122
|
var key = index.toString(); // 不设置dataIndex同时进行排序 则报错
|
|
118
123
|
|
|
119
|
-
if (
|
|
124
|
+
if (column.dataIndex === undefined && sortable) {
|
|
120
125
|
message.error('不支持未设置dataIndex时进行排序设置');
|
|
121
126
|
}
|
|
122
127
|
|
|
@@ -134,7 +139,7 @@ function Table(props, ref) {
|
|
|
134
139
|
}
|
|
135
140
|
});
|
|
136
141
|
});
|
|
137
|
-
}, [sortable, tableClientWidth]); // 将rowId转为React Table支持的值
|
|
142
|
+
}, [columns, sortable, tableClientWidth]); // 将rowId转为React Table支持的值
|
|
138
143
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
139
144
|
|
|
140
145
|
var transformRowId = function transformRowId(row, relativeIndex, parent) {
|
|
@@ -149,10 +154,23 @@ function Table(props, ref) {
|
|
|
149
154
|
}
|
|
150
155
|
|
|
151
156
|
return relativeIndex.toString();
|
|
152
|
-
};
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* 计算初始传递给 React Table的排序字段
|
|
160
|
+
* 1. 不存在 sortable 或者存在loadMore(内部滚动时),不进行排序操作防止内部滚动时冲突;
|
|
161
|
+
* 2. 存在默认排序以及默认排序规则,以默认为准
|
|
162
|
+
* 3. 如果给了排序但没有默认,则按第一行排序
|
|
163
|
+
* @returns
|
|
164
|
+
*/
|
|
153
165
|
|
|
154
166
|
|
|
155
167
|
var getTableInitSort = function getTableInitSort() {
|
|
168
|
+
var EMPTY_SIZE = 0;
|
|
169
|
+
|
|
170
|
+
if (!sortable || loadMore || newColumns.length === EMPTY_SIZE) {
|
|
171
|
+
return [];
|
|
172
|
+
}
|
|
173
|
+
|
|
156
174
|
if (defaultSort && defaultSort.id) {
|
|
157
175
|
return [defaultSort];
|
|
158
176
|
}
|
|
@@ -204,7 +222,6 @@ function Table(props, ref) {
|
|
|
204
222
|
var tableHeadNode = /*#__PURE__*/React.createElement(TableHead, {
|
|
205
223
|
canResizeColumn: resizeColumn,
|
|
206
224
|
headerGroups: headerGroups,
|
|
207
|
-
tableContentWidth: columnsTotalWidthRef.current,
|
|
208
225
|
defaultSort: defaultSort,
|
|
209
226
|
sortable: sortable,
|
|
210
227
|
columns: newColumns,
|
|
@@ -247,26 +264,25 @@ function Table(props, ref) {
|
|
|
247
264
|
width: columnsTotalWidthRef.current
|
|
248
265
|
}
|
|
249
266
|
}), renderNoHeightTableBody()));
|
|
250
|
-
};
|
|
267
|
+
}; // 存在高度时,内部的纵向的滚动
|
|
251
268
|
|
|
252
|
-
|
|
253
|
-
|
|
269
|
+
|
|
270
|
+
var onBodyVerticalScroll = useCallback(function (e) {
|
|
271
|
+
if (!tableClientHeight) {
|
|
254
272
|
return;
|
|
255
273
|
}
|
|
256
274
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
275
|
+
var _e$target = e.target,
|
|
276
|
+
scrollHeight = _e$target.scrollHeight,
|
|
277
|
+
clientHeight = _e$target.clientHeight,
|
|
278
|
+
currentTargetScrollTop = _e$target.scrollTop; // 说明是横向滚动
|
|
279
|
+
|
|
280
|
+
if (lastOffsetTopRef.current === currentTargetScrollTop) {
|
|
281
|
+
return;
|
|
262
282
|
}
|
|
263
|
-
}, []); // 内部滚动时 纵向的滚动
|
|
264
283
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
clientHeight = target.clientHeight,
|
|
268
|
-
scrollTop = target.scrollTop;
|
|
269
|
-
var currentPosToBottomGap = scrollHeight - clientHeight - scrollTop;
|
|
284
|
+
var currentPosToBottomGap = scrollHeight - clientHeight - currentTargetScrollTop + tableHeadRowHeight; // 当前滚动条到底部的距离
|
|
285
|
+
|
|
270
286
|
var scrollThresholdValue = getValidScrollThreshold(scrollThreshold, tableClientHeight);
|
|
271
287
|
|
|
272
288
|
if (currentPosToBottomGap < scrollThresholdValue && hasNextPage && !loadMoreLoading) {
|
|
@@ -278,36 +294,8 @@ function Table(props, ref) {
|
|
|
278
294
|
});
|
|
279
295
|
}
|
|
280
296
|
|
|
281
|
-
lastOffsetTopRef.current =
|
|
282
|
-
}, [hasNextPage, loadMore, loadMoreLoading, scrollThreshold, tableClientHeight]);
|
|
283
|
-
|
|
284
|
-
var onBodyScroll = useCallback(function (e) {
|
|
285
|
-
var currentTarget = e.target;
|
|
286
|
-
|
|
287
|
-
if (!currentTarget) {
|
|
288
|
-
return;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
var scrollLeftNum = currentTarget.scrollLeft;
|
|
292
|
-
var scrollTopNum = currentTarget.scrollTop; // 纵向滚动
|
|
293
|
-
|
|
294
|
-
if (scrollTopNum !== lastOffsetLeftRef.current) {
|
|
295
|
-
onBodyVerticalScroll(currentTarget);
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
if (scrollLeftNum === lastOffsetLeftRef.current) {
|
|
299
|
-
return;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
var compareTarget = currentTarget; // 横向滚动
|
|
303
|
-
|
|
304
|
-
if (!getScrollTarget() || getScrollTarget() === compareTarget) {
|
|
305
|
-
setScrollTarget(compareTarget);
|
|
306
|
-
forceScroll(scrollLeftNum, tableBodyRef.current);
|
|
307
|
-
forceScroll(scrollLeftNum, tableHeadRef.current);
|
|
308
|
-
lastOffsetLeftRef.current = scrollLeftNum;
|
|
309
|
-
}
|
|
310
|
-
}, [forceScroll, getScrollTarget, onBodyVerticalScroll, setScrollTarget]);
|
|
297
|
+
lastOffsetTopRef.current = currentTargetScrollTop;
|
|
298
|
+
}, [hasNextPage, loadMore, loadMoreLoading, scrollThreshold, tableClientHeight]);
|
|
311
299
|
useEffect(function () {
|
|
312
300
|
if (!hasNextPage) {
|
|
313
301
|
setLoadMoreLoading(false);
|
|
@@ -315,7 +303,11 @@ function Table(props, ref) {
|
|
|
315
303
|
}, [hasNextPage]); // 渲染有设置高度的表格
|
|
316
304
|
|
|
317
305
|
var renderTableWithHeight = function renderTableWithHeight() {
|
|
318
|
-
|
|
306
|
+
if (!tableClientWidth || !tableClientHeight) {
|
|
307
|
+
return null;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
var renderTableBody = function renderTableBody() {
|
|
319
311
|
if (loading && !rows.length) {
|
|
320
312
|
return /*#__PURE__*/React.createElement(Loading, null);
|
|
321
313
|
}
|
|
@@ -324,42 +316,46 @@ function Table(props, ref) {
|
|
|
324
316
|
return /*#__PURE__*/React.createElement(Empty, null);
|
|
325
317
|
}
|
|
326
318
|
|
|
327
|
-
return /*#__PURE__*/React.createElement(
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
ref: tableBodyRef,
|
|
334
|
-
onScroll: onBodyScroll
|
|
335
|
-
}, tableRowListNode, loadMoreLoading && /*#__PURE__*/React.createElement(Loading, null));
|
|
319
|
+
return /*#__PURE__*/React.createElement(ResizeObserver, {
|
|
320
|
+
onResize: function onResize(_ref2) {
|
|
321
|
+
var clientHeight = _ref2.height;
|
|
322
|
+
setTableBodyContentHeight(clientHeight);
|
|
323
|
+
}
|
|
324
|
+
}, /*#__PURE__*/React.createElement("div", null, tableRowListNode, loadMoreLoading && /*#__PURE__*/React.createElement(Loading, null)));
|
|
336
325
|
};
|
|
337
326
|
|
|
338
327
|
return /*#__PURE__*/React.createElement("div", {
|
|
339
|
-
className: classnames("".concat(prefixCls, "-inner-wrap"), _defineProperty({}, "".concat(prefixCls, "-innerScroll"), height))
|
|
328
|
+
className: classnames("".concat(prefixCls, "-inner-wrap"), _defineProperty({}, "".concat(prefixCls, "-innerScroll"), !!height)),
|
|
329
|
+
ref: tableBodyRef,
|
|
330
|
+
onScroll: onBodyVerticalScroll
|
|
331
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
332
|
+
style: {
|
|
333
|
+
width: columnsTotalWidthRef.current,
|
|
334
|
+
height: tableBodyContentHeight
|
|
335
|
+
}
|
|
340
336
|
}, /*#__PURE__*/React.createElement("div", {
|
|
341
|
-
ref: tableHeadRef,
|
|
342
337
|
className: "".concat(prefixCls, "-tableHeadScrollWrap")
|
|
343
338
|
}, tableHeadNode), /*#__PURE__*/React.createElement("div", Object.assign({}, getTableBodyProps(), {
|
|
344
|
-
className: classnames("".concat(prefixCls, "-tbody")
|
|
345
|
-
}),
|
|
339
|
+
className: classnames("".concat(prefixCls, "-tbody"))
|
|
340
|
+
}), renderTableBody())));
|
|
346
341
|
};
|
|
347
342
|
|
|
348
|
-
return /*#__PURE__*/React.createElement(
|
|
349
|
-
|
|
350
|
-
var clientWidth = _ref2.width,
|
|
351
|
-
clientHeight = _ref2.height;
|
|
352
|
-
setTableClientWidth(clientWidth);
|
|
353
|
-
setTableClientHeight(clientHeight);
|
|
354
|
-
}
|
|
355
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
343
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
344
|
+
key: tableKey,
|
|
356
345
|
className: prefixCls,
|
|
357
346
|
ref: tableRef,
|
|
358
347
|
style: {
|
|
359
348
|
height: !height ? 'unset' : height
|
|
360
349
|
}
|
|
361
|
-
}, /*#__PURE__*/React.createElement(
|
|
362
|
-
|
|
350
|
+
}, /*#__PURE__*/React.createElement(ResizeObserver, {
|
|
351
|
+
onResize: function onResize(_ref3) {
|
|
352
|
+
var clientWidth = _ref3.width,
|
|
353
|
+
clientHeight = _ref3.height;
|
|
354
|
+
setTableClientWidth(clientWidth);
|
|
355
|
+
setTableClientHeight(clientHeight);
|
|
356
|
+
}
|
|
357
|
+
}, !tableClientWidth ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", null)) : /*#__PURE__*/React.createElement("div", Object.assign({}, getTableProps(), {
|
|
358
|
+
className: classnames("".concat(prefixCls, "-table-wrap"), (_classnames2 = {}, _defineProperty(_classnames2, "".concat(prefixCls, "-init-loading"), data.length === ZERO && loading), _defineProperty(_classnames2, "".concat(prefixCls, "-empty"), data.length === ZERO && loading), _classnames2))
|
|
363
359
|
}), height ? renderTableWithHeight() : renderTableWithoutHeight())));
|
|
364
360
|
}
|
|
365
361
|
|
|
@@ -4,7 +4,6 @@ import { ISort, TSortOrder } from '../../interface';
|
|
|
4
4
|
import { IWidthDetail } from '../../utils';
|
|
5
5
|
interface ITableWithoutHeightProps<T extends object = {}> {
|
|
6
6
|
headerGroups: HeaderGroup<T>[];
|
|
7
|
-
tableContentWidth: number;
|
|
8
7
|
canResizeColumn?: boolean;
|
|
9
8
|
defaultSort?: ISort<T>;
|
|
10
9
|
sortable?: boolean;
|
|
@@ -36,7 +36,6 @@ var ARRAY_FIRST_INDEX = 0;
|
|
|
36
36
|
|
|
37
37
|
function TableHead(props) {
|
|
38
38
|
var headerGroups = props.headerGroups,
|
|
39
|
-
tableContentWidth = props.tableContentWidth,
|
|
40
39
|
canResizeColumn = props.canResizeColumn,
|
|
41
40
|
defaultSort = props.defaultSort,
|
|
42
41
|
_props$sortable = props.sortable,
|
|
@@ -228,7 +227,7 @@ function TableHead(props) {
|
|
|
228
227
|
return /*#__PURE__*/React.createElement("div", {
|
|
229
228
|
className: "".concat(prefixCls, "-thead"),
|
|
230
229
|
style: {
|
|
231
|
-
width:
|
|
230
|
+
width: columnsTotalWidthRef.current
|
|
232
231
|
}
|
|
233
232
|
}, headerGroups.map(function (headerGroup) {
|
|
234
233
|
var _headerGroup$getHeade = headerGroup.getHeaderGroupProps(),
|
package/es/Table/interface.d.ts
CHANGED
|
@@ -11,12 +11,14 @@ export interface IColumn<RecordType> {
|
|
|
11
11
|
render?: (value: any, row: RecordType, index: number) => React.ReactNode;
|
|
12
12
|
width?: number | string;
|
|
13
13
|
minWidth?: number;
|
|
14
|
+
widthFlex?: boolean;
|
|
14
15
|
sorter?: boolean | 'string' | 'number' | 'basic' | 'datetime' | 'alphanumeric';
|
|
15
16
|
sortOrder?: TSortOrder;
|
|
16
17
|
sortDirections?: Array<'ascend' | 'descend'>;
|
|
17
18
|
selected?: boolean;
|
|
18
19
|
}
|
|
19
20
|
export interface ITableProps<RecordType> {
|
|
21
|
+
key?: React.Key;
|
|
20
22
|
columns: IColumn<RecordType>[];
|
|
21
23
|
data: RecordType[];
|
|
22
24
|
onRowSelected?: (row: RecordType) => void;
|
|
@@ -24,20 +24,25 @@
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
&-inner-wrap {
|
|
27
|
+
position: relative;
|
|
27
28
|
width: 100%;
|
|
28
29
|
height: 100%;
|
|
29
30
|
overflow-x: overlay;
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
&-tableHeadScrollWrap {
|
|
34
|
+
position: sticky;
|
|
35
|
+
top: 0;
|
|
36
|
+
z-index: 1;
|
|
37
|
+
display: flex;
|
|
33
38
|
width: 100%;
|
|
34
|
-
overflow
|
|
39
|
+
overflow: hidden;
|
|
35
40
|
}
|
|
36
41
|
|
|
37
42
|
&-cell {
|
|
38
43
|
flex-grow: 1;
|
|
39
44
|
height: unset;
|
|
40
|
-
color:
|
|
45
|
+
color: inherit;
|
|
41
46
|
text-align: left;
|
|
42
47
|
word-break: break-all;
|
|
43
48
|
border-bottom: 1px solid @NL95;
|
|
@@ -66,6 +71,7 @@
|
|
|
66
71
|
.ald-table-row {
|
|
67
72
|
min-width: 9999px; // 防止拖动时的闪动
|
|
68
73
|
height: @table-head-row-height;
|
|
74
|
+
background-color: @BG95;
|
|
69
75
|
}
|
|
70
76
|
|
|
71
77
|
.ald-table-cell {
|
|
@@ -73,7 +79,6 @@
|
|
|
73
79
|
padding: 14px 24px;
|
|
74
80
|
color: @NL50;
|
|
75
81
|
line-height: 20px;
|
|
76
|
-
background-color: @BG95;
|
|
77
82
|
|
|
78
83
|
.ald-table-cell-content {
|
|
79
84
|
overflow: hidden;
|
|
@@ -125,6 +130,10 @@
|
|
|
125
130
|
display: flex;
|
|
126
131
|
align-items: center;
|
|
127
132
|
padding-left: 24px;
|
|
133
|
+
|
|
134
|
+
.ald-table-cell-container {
|
|
135
|
+
width: 100%;
|
|
136
|
+
}
|
|
128
137
|
}
|
|
129
138
|
|
|
130
139
|
&:hover {
|
|
@@ -141,8 +150,8 @@
|
|
|
141
150
|
}
|
|
142
151
|
}
|
|
143
152
|
|
|
144
|
-
&-
|
|
145
|
-
overflow:
|
|
153
|
+
&-innerScroll {
|
|
154
|
+
overflow-y: overlay;
|
|
146
155
|
}
|
|
147
156
|
|
|
148
157
|
&-row-list-wrap {
|
package/es/Table/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var ZERO = 0;
|
|
2
2
|
var NOT_SET = -1;
|
|
3
|
-
var COLUMN_MIN_WIDTH =
|
|
3
|
+
var COLUMN_MIN_WIDTH = 80;
|
|
4
4
|
var HUNDRED = 100; // TODO: 添加单侧
|
|
5
5
|
|
|
6
6
|
export function getColumnsWidthMap(columns, clientWidth, lastWidthMap) {
|
|
@@ -9,12 +9,19 @@ export function getColumnsWidthMap(columns, clientWidth, lastWidthMap) {
|
|
|
9
9
|
var widthMap = new Map();
|
|
10
10
|
var totalColumnWidth = ZERO;
|
|
11
11
|
columns.forEach(function (item, index) {
|
|
12
|
-
var _lastWidthMap$get;
|
|
13
|
-
|
|
14
12
|
var key = index.toString();
|
|
15
|
-
var
|
|
13
|
+
var widthFlex = item.widthFlex;
|
|
14
|
+
var width = getWidthByColumnsWidth(clientWidth, item.width, widthFlex); // 首先判断是否是否是容器宽度的变化
|
|
15
|
+
|
|
16
|
+
var isSpecific;
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
if (widthFlex) {
|
|
19
|
+
isSpecific = false;
|
|
20
|
+
} else {
|
|
21
|
+
var _lastWidthMap$get;
|
|
22
|
+
|
|
23
|
+
isSpecific = lastWidthMap ? (_lastWidthMap$get = lastWidthMap.get(key)) === null || _lastWidthMap$get === void 0 ? void 0 : _lastWidthMap$get.isSpecific : isSpecificWidth(item.width);
|
|
24
|
+
}
|
|
18
25
|
|
|
19
26
|
if (lastWidthMap && isSpecific) {
|
|
20
27
|
var _lastWidthMap$get2;
|
|
@@ -40,7 +47,7 @@ export function getColumnsWidthMap(columns, clientWidth, lastWidthMap) {
|
|
|
40
47
|
|
|
41
48
|
return widthMap.set(item, {
|
|
42
49
|
isSpecific: (_widthMap$get = widthMap.get(item)) === null || _widthMap$get === void 0 ? void 0 : _widthMap$get.isSpecific,
|
|
43
|
-
width:
|
|
50
|
+
width: COLUMN_MIN_WIDTH
|
|
44
51
|
});
|
|
45
52
|
});
|
|
46
53
|
} // 设定宽度小于容器宽度时
|
|
@@ -72,8 +79,8 @@ export function getColumnsWidthMap(columns, clientWidth, lastWidthMap) {
|
|
|
72
79
|
};
|
|
73
80
|
}
|
|
74
81
|
|
|
75
|
-
function getWidthByColumnsWidth(clientWidth, width) {
|
|
76
|
-
if (width === undefined) {
|
|
82
|
+
function getWidthByColumnsWidth(clientWidth, width, widthFlex) {
|
|
83
|
+
if (width === undefined || widthFlex) {
|
|
77
84
|
return NOT_SET;
|
|
78
85
|
}
|
|
79
86
|
|
|
@@ -123,7 +130,7 @@ export function getValidScrollThreshold(height, clientHeight) {
|
|
|
123
130
|
return scrollThreshold;
|
|
124
131
|
}
|
|
125
132
|
export function getPercentageValue(percentage, containerNum) {
|
|
126
|
-
var percent =
|
|
133
|
+
var percent = Number(percentage.replace('%', '')) / HUNDRED;
|
|
127
134
|
return getValidWidthByNumber(containerNum * percent);
|
|
128
135
|
}
|
|
129
136
|
export function getPxValue(px) {
|
package/es/Tabs/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { TabsProps } from 'antd';
|
|
3
3
|
export declare type TabsSize = 'default' | 'large';
|
|
4
4
|
export interface ITabsProps extends Omit<TabsProps, 'size'> {
|
|
@@ -38,10 +38,25 @@ export interface ITabsProps extends Omit<TabsProps, 'size'> {
|
|
|
38
38
|
*/
|
|
39
39
|
tabPosition?: 'left' | 'right' | 'top' | 'bottom';
|
|
40
40
|
className?: string;
|
|
41
|
-
|
|
41
|
+
items: ITabItem[];
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
export default function Tabs(props: ITabsProps): JSX.Element;
|
|
44
|
+
export interface ITabItem {
|
|
45
|
+
/**
|
|
46
|
+
* @description 被隐藏时是否渲染 DOM 结构
|
|
47
|
+
* @default false
|
|
48
|
+
*/
|
|
49
|
+
forceRender?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* @description 对应 activeKey
|
|
52
|
+
* @default -
|
|
53
|
+
*/
|
|
54
|
+
key: string;
|
|
55
|
+
/**
|
|
56
|
+
* @description 选项卡头显示的内容
|
|
57
|
+
* @default -
|
|
58
|
+
*/
|
|
59
|
+
label: ReactNode;
|
|
60
|
+
className?: string;
|
|
61
|
+
children?: ReactNode;
|
|
46
62
|
}
|
|
47
|
-
export default Tabs;
|
package/es/Tabs/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "@aloudata/icons-react/styles/index.less";
|
|
2
|
-
import
|
|
2
|
+
import _MoreFill from "@aloudata/icons-react/es/icons/MoreFill";
|
|
3
3
|
import "antd/es/tabs/style";
|
|
4
4
|
import _Tabs from "antd/es/tabs";
|
|
5
5
|
var _excluded = ["size", "className", "popupClassName", "adaptHeight"];
|
|
@@ -16,7 +16,6 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
16
16
|
|
|
17
17
|
import React from 'react'; // import AntdTabs, { TabsProps } from 'antd/lib/tabs';
|
|
18
18
|
|
|
19
|
-
import TabPane from './TabPane';
|
|
20
19
|
import classNames from 'classnames';
|
|
21
20
|
export default function Tabs(props) {
|
|
22
21
|
var size = props.size,
|
|
@@ -34,7 +33,7 @@ export default function Tabs(props) {
|
|
|
34
33
|
return /*#__PURE__*/React.createElement(_Tabs, Object.assign({
|
|
35
34
|
moreIcon: /*#__PURE__*/React.createElement("div", {
|
|
36
35
|
className: "ald-tabs-moreIcon"
|
|
37
|
-
}, /*#__PURE__*/React.createElement(
|
|
36
|
+
}, /*#__PURE__*/React.createElement(_MoreFill, {
|
|
38
37
|
color: "currentColor"
|
|
39
38
|
})),
|
|
40
39
|
tabBarGutter: 24,
|
|
@@ -44,5 +43,4 @@ export default function Tabs(props) {
|
|
|
44
43
|
'ald-tabs-default': size !== 'large'
|
|
45
44
|
})
|
|
46
45
|
}, tabsProps));
|
|
47
|
-
}
|
|
48
|
-
Tabs.TabPane = TabPane;
|
|
46
|
+
}
|
package/es/Tabs/style/index.less
CHANGED
package/es/Tooltip/index.d.ts
CHANGED
|
@@ -46,12 +46,12 @@ export interface ITooltipProps {
|
|
|
46
46
|
* @description 用于手动控制浮层显隐
|
|
47
47
|
* @default -
|
|
48
48
|
*/
|
|
49
|
-
|
|
49
|
+
open?: boolean;
|
|
50
50
|
/**
|
|
51
51
|
* @description 显示隐藏的回调
|
|
52
52
|
* @default -
|
|
53
53
|
*/
|
|
54
|
-
|
|
54
|
+
onOpenChange?: (open: boolean) => void;
|
|
55
55
|
/**
|
|
56
56
|
* @description 卡片类名
|
|
57
57
|
* @default -
|
package/es/Tooltip/index.js
CHANGED
|
@@ -4,8 +4,8 @@ import classNames from 'classnames';
|
|
|
4
4
|
export default function Tooltip(props) {
|
|
5
5
|
var children = props.children,
|
|
6
6
|
title = props.title,
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
open = props.open,
|
|
8
|
+
onOpenChange = props.onOpenChange,
|
|
9
9
|
trigger = props.trigger,
|
|
10
10
|
zIndex = props.zIndex,
|
|
11
11
|
placement = props.placement,
|
|
@@ -18,8 +18,8 @@ export default function Tooltip(props) {
|
|
|
18
18
|
return /*#__PURE__*/React.createElement(AntdTooltip, {
|
|
19
19
|
title: title,
|
|
20
20
|
overlayClassName: classNames('ald-tooltip-overlay', overlayClassName),
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
open: open,
|
|
22
|
+
onOpenChange: onOpenChange,
|
|
23
23
|
trigger: trigger,
|
|
24
24
|
zIndex: zIndex,
|
|
25
25
|
placement: placement,
|
package/es/index.d.ts
CHANGED
|
@@ -46,6 +46,8 @@ export type { SpaceProps } from './Space';
|
|
|
46
46
|
export { default as Space } from './Space';
|
|
47
47
|
export type { SpinProps } from './Spin';
|
|
48
48
|
export { default as Spin } from './Spin';
|
|
49
|
+
export type { ProgressProps } from './Progress';
|
|
50
|
+
export { default as Progress } from './Progress';
|
|
49
51
|
export type { ISwitchProps as SwitchProps } from './Switch';
|
|
50
52
|
export { default as Switch } from './Switch';
|
|
51
53
|
export type { IStepProps as StepProps, IStepsProps as StepsProps } from './Steps';
|
|
@@ -53,18 +55,18 @@ export { default as Steps } from './Steps';
|
|
|
53
55
|
export { default as Form } from './Form';
|
|
54
56
|
export type { FormInstance, FormProps, FormItemProps } from './Form';
|
|
55
57
|
export { default as Divider } from './Divider';
|
|
56
|
-
export type { DividerProps } from './Divider';
|
|
58
|
+
export type { IDividerProps as DividerProps } from './Divider';
|
|
57
59
|
export { default as Drawer } from './Drawer';
|
|
58
60
|
export type { DrawerProps } from './Drawer';
|
|
59
61
|
export { default as Radio } from './Radio';
|
|
60
62
|
export type { RadioProps, RadioGroupProps } from './Radio';
|
|
61
63
|
export { default as Checkbox } from './Checkbox';
|
|
62
|
-
export type { CheckboxProps, CheckboxOptionType } from './Checkbox';
|
|
64
|
+
export type { ICheckboxProps as CheckboxProps, CheckboxOptionType } from './Checkbox';
|
|
63
65
|
export { default as Modal } from './Modal';
|
|
64
66
|
export type { ModalProps, ModalFuncProps } from './Modal';
|
|
65
67
|
export { default as Popover } from './Popover';
|
|
66
68
|
export type { PopoverProps } from './Popover';
|
|
67
|
-
export type { InputNumberProps } from './InputNumber';
|
|
69
|
+
export type { IInputNumberProps as InputNumberProps } from './InputNumber';
|
|
68
70
|
export { default as InputNumber } from './InputNumber';
|
|
69
71
|
export { default as Breadcrumb } from './Breadcrumb';
|
|
70
72
|
export type { BreadcrumbProps, BreadcrumbItemProps } from './Breadcrumb';
|
|
@@ -75,3 +77,5 @@ export type { IAvatarProps as AvatarProps } from './Avatar';
|
|
|
75
77
|
export { default as Icon } from './Icon';
|
|
76
78
|
export type { PageHeaderProps } from './PageHeader';
|
|
77
79
|
export { default as PageHeader } from './PageHeader';
|
|
80
|
+
export type { IPopconfirmProps as PopconfirmProps } from './Popconfirm';
|
|
81
|
+
export { default as Popconfirm } from './Popconfirm';
|
package/es/index.js
CHANGED
|
@@ -23,6 +23,7 @@ export { default as Skeleton } from './Skeleton';
|
|
|
23
23
|
export { default as Row } from './Row';
|
|
24
24
|
export { default as Space } from './Space';
|
|
25
25
|
export { default as Spin } from './Spin';
|
|
26
|
+
export { default as Progress } from './Progress';
|
|
26
27
|
export { default as Switch } from './Switch';
|
|
27
28
|
export { default as Steps } from './Steps';
|
|
28
29
|
export { default as Form } from './Form';
|
|
@@ -37,4 +38,5 @@ export { default as Breadcrumb } from './Breadcrumb';
|
|
|
37
38
|
export { default as Empty } from './Empty';
|
|
38
39
|
export { default as Avatar } from './Avatar';
|
|
39
40
|
export { default as Icon } from './Icon';
|
|
40
|
-
export { default as PageHeader } from './PageHeader';
|
|
41
|
+
export { default as PageHeader } from './PageHeader';
|
|
42
|
+
export { default as Popconfirm } from './Popconfirm';
|