@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/lib/Table/Table.js
CHANGED
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _classnames3 = _interopRequireDefault(require("classnames"));
|
|
11
11
|
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
|
|
@@ -31,10 +31,6 @@ var _TableHead = _interopRequireDefault(require("./components/TableHead"));
|
|
|
31
31
|
|
|
32
32
|
var _TableBodyRowList = _interopRequireDefault(require("./components/TableBodyRowList"));
|
|
33
33
|
|
|
34
|
-
var _useFrame = require("./hooks/useFrame");
|
|
35
|
-
|
|
36
|
-
var _variable = _interopRequireDefault(require("./style/variable.less"));
|
|
37
|
-
|
|
38
34
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
39
35
|
|
|
40
36
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -59,13 +55,14 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
59
55
|
|
|
60
56
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
61
57
|
|
|
62
|
-
var
|
|
58
|
+
var tableHeadRowHeight = 44;
|
|
63
59
|
var ZERO = 0;
|
|
64
60
|
|
|
65
61
|
function Table(props, ref) {
|
|
66
|
-
var
|
|
62
|
+
var _classnames2;
|
|
67
63
|
|
|
68
|
-
var
|
|
64
|
+
var outerKey = props.key,
|
|
65
|
+
columns = props.columns,
|
|
69
66
|
data = props.data,
|
|
70
67
|
onRowSelected = props.onRowSelected,
|
|
71
68
|
loadMore = props.loadMore,
|
|
@@ -88,21 +85,19 @@ function Table(props, ref) {
|
|
|
88
85
|
rowKey = props.rowKey,
|
|
89
86
|
height = props.height;
|
|
90
87
|
|
|
91
|
-
var _useState = (0, _react.useState)(
|
|
88
|
+
var _useState = (0, _react.useState)(undefined),
|
|
92
89
|
_useState2 = _slicedToArray(_useState, 2),
|
|
93
90
|
tableClientWidth = _useState2[0],
|
|
94
91
|
setTableClientWidth = _useState2[1];
|
|
95
92
|
|
|
96
|
-
var _useState3 = (0, _react.useState)(
|
|
93
|
+
var _useState3 = (0, _react.useState)(undefined),
|
|
97
94
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
98
95
|
tableClientHeight = _useState4[0],
|
|
99
96
|
setTableClientHeight = _useState4[1];
|
|
100
97
|
|
|
101
98
|
var prefixCls = (0, _usePrefixCls.default)('', 'ald-table');
|
|
102
99
|
var tableRef = (0, _react.useRef)(null);
|
|
103
|
-
var tableHeadRef = (0, _react.useRef)(null);
|
|
104
100
|
var tableBodyRef = (0, _react.useRef)(null);
|
|
105
|
-
var columnsRef = (0, _react.useRef)([]);
|
|
106
101
|
var columnsWidthMapRef = (0, _react.useRef)();
|
|
107
102
|
var columnsTotalWidthRef = (0, _react.useRef)(ZERO);
|
|
108
103
|
|
|
@@ -111,19 +106,23 @@ function Table(props, ref) {
|
|
|
111
106
|
loadMoreLoading = _useState6[0],
|
|
112
107
|
setLoadMoreLoading = _useState6[1];
|
|
113
108
|
|
|
114
|
-
var lastOffsetLeftRef = (0, _react.useRef)(ZERO);
|
|
115
109
|
var lastOffsetTopRef = (0, _react.useRef)(ZERO);
|
|
116
110
|
|
|
117
|
-
var
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
111
|
+
var _useState7 = (0, _react.useState)(ZERO),
|
|
112
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
113
|
+
tableBodyContentHeight = _useState8[0],
|
|
114
|
+
setTableBodyContentHeight = _useState8[1]; // 如果列长度存在变化时,触发重新计算页面的宽度,否则需要用户手动更改key
|
|
115
|
+
|
|
121
116
|
|
|
117
|
+
var tableKey = (0, _react.useMemo)(function () {
|
|
118
|
+
var columnLength = (columns === null || columns === void 0 ? void 0 : columns.length) || ZERO;
|
|
122
119
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
120
|
+
if (outerKey) {
|
|
121
|
+
return "".concat(outerKey, "-").concat(columnLength);
|
|
122
|
+
}
|
|
126
123
|
|
|
124
|
+
return "".concat(columnLength);
|
|
125
|
+
}, [columns === null || columns === void 0 ? void 0 : columns.length, outerKey]); // 初始化进入时 渲染表格容器宽度
|
|
127
126
|
|
|
128
127
|
(0, _react.useEffect)(function () {
|
|
129
128
|
if (tableRef.current) {
|
|
@@ -132,18 +131,22 @@ function Table(props, ref) {
|
|
|
132
131
|
}, []); // 转换外部传入的columns
|
|
133
132
|
|
|
134
133
|
var newColumns = (0, _react.useMemo)(function () {
|
|
135
|
-
|
|
134
|
+
if (!tableClientWidth) {
|
|
135
|
+
return [];
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
var _getColumnsWidthMap = (0, _utils.getColumnsWidthMap)(columns, tableClientWidth, columnsWidthMapRef.current),
|
|
136
139
|
columnsWidthMap = _getColumnsWidthMap.columnsWidthMap,
|
|
137
140
|
totalColumnWidth = _getColumnsWidthMap.totalColumnWidth;
|
|
138
141
|
|
|
139
142
|
columnsWidthMapRef.current = columnsWidthMap;
|
|
140
143
|
columnsTotalWidthRef.current = totalColumnWidth;
|
|
141
|
-
return
|
|
144
|
+
return columns.map(function (column, index) {
|
|
142
145
|
var _columnsWidthMapRef$c, _columnsWidthMapRef$c2;
|
|
143
146
|
|
|
144
147
|
var key = index.toString(); // 不设置dataIndex同时进行排序 则报错
|
|
145
148
|
|
|
146
|
-
if (
|
|
149
|
+
if (column.dataIndex === undefined && sortable) {
|
|
147
150
|
_message.default.error('不支持未设置dataIndex时进行排序设置');
|
|
148
151
|
}
|
|
149
152
|
|
|
@@ -161,7 +164,7 @@ function Table(props, ref) {
|
|
|
161
164
|
}
|
|
162
165
|
});
|
|
163
166
|
});
|
|
164
|
-
}, [sortable, tableClientWidth]); // 将rowId转为React Table支持的值
|
|
167
|
+
}, [columns, sortable, tableClientWidth]); // 将rowId转为React Table支持的值
|
|
165
168
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
166
169
|
|
|
167
170
|
var transformRowId = function transformRowId(row, relativeIndex, parent) {
|
|
@@ -176,10 +179,23 @@ function Table(props, ref) {
|
|
|
176
179
|
}
|
|
177
180
|
|
|
178
181
|
return relativeIndex.toString();
|
|
179
|
-
};
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* 计算初始传递给 React Table的排序字段
|
|
185
|
+
* 1. 不存在 sortable 或者存在loadMore(内部滚动时),不进行排序操作防止内部滚动时冲突;
|
|
186
|
+
* 2. 存在默认排序以及默认排序规则,以默认为准
|
|
187
|
+
* 3. 如果给了排序但没有默认,则按第一行排序
|
|
188
|
+
* @returns
|
|
189
|
+
*/
|
|
180
190
|
|
|
181
191
|
|
|
182
192
|
var getTableInitSort = function getTableInitSort() {
|
|
193
|
+
var EMPTY_SIZE = 0;
|
|
194
|
+
|
|
195
|
+
if (!sortable || loadMore || newColumns.length === EMPTY_SIZE) {
|
|
196
|
+
return [];
|
|
197
|
+
}
|
|
198
|
+
|
|
183
199
|
if (defaultSort && defaultSort.id) {
|
|
184
200
|
return [defaultSort];
|
|
185
201
|
}
|
|
@@ -232,7 +248,6 @@ function Table(props, ref) {
|
|
|
232
248
|
var tableHeadNode = /*#__PURE__*/_react.default.createElement(_TableHead.default, {
|
|
233
249
|
canResizeColumn: resizeColumn,
|
|
234
250
|
headerGroups: headerGroups,
|
|
235
|
-
tableContentWidth: columnsTotalWidthRef.current,
|
|
236
251
|
defaultSort: defaultSort,
|
|
237
252
|
sortable: sortable,
|
|
238
253
|
columns: newColumns,
|
|
@@ -270,33 +285,32 @@ function Table(props, ref) {
|
|
|
270
285
|
};
|
|
271
286
|
|
|
272
287
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
273
|
-
className: (0,
|
|
288
|
+
className: (0, _classnames3.default)("".concat(prefixCls, "-inner-wrap"))
|
|
274
289
|
}, tableHeadNode, /*#__PURE__*/_react.default.createElement("div", Object.assign({}, getTableBodyProps(), {
|
|
275
|
-
className: (0,
|
|
290
|
+
className: (0, _classnames3.default)("".concat(prefixCls, "-tbody")),
|
|
276
291
|
style: {
|
|
277
292
|
width: columnsTotalWidthRef.current
|
|
278
293
|
}
|
|
279
294
|
}), renderNoHeightTableBody()));
|
|
280
|
-
};
|
|
295
|
+
}; // 存在高度时,内部的纵向的滚动
|
|
281
296
|
|
|
282
|
-
|
|
283
|
-
|
|
297
|
+
|
|
298
|
+
var onBodyVerticalScroll = (0, _react.useCallback)(function (e) {
|
|
299
|
+
if (!tableClientHeight) {
|
|
284
300
|
return;
|
|
285
301
|
}
|
|
286
302
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
303
|
+
var _e$target = e.target,
|
|
304
|
+
scrollHeight = _e$target.scrollHeight,
|
|
305
|
+
clientHeight = _e$target.clientHeight,
|
|
306
|
+
currentTargetScrollTop = _e$target.scrollTop; // 说明是横向滚动
|
|
307
|
+
|
|
308
|
+
if (lastOffsetTopRef.current === currentTargetScrollTop) {
|
|
309
|
+
return;
|
|
292
310
|
}
|
|
293
|
-
}, []); // 内部滚动时 纵向的滚动
|
|
294
311
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
clientHeight = target.clientHeight,
|
|
298
|
-
scrollTop = target.scrollTop;
|
|
299
|
-
var currentPosToBottomGap = scrollHeight - clientHeight - scrollTop;
|
|
312
|
+
var currentPosToBottomGap = scrollHeight - clientHeight - currentTargetScrollTop + tableHeadRowHeight; // 当前滚动条到底部的距离
|
|
313
|
+
|
|
300
314
|
var scrollThresholdValue = (0, _utils.getValidScrollThreshold)(scrollThreshold, tableClientHeight);
|
|
301
315
|
|
|
302
316
|
if (currentPosToBottomGap < scrollThresholdValue && hasNextPage && !loadMoreLoading) {
|
|
@@ -308,36 +322,8 @@ function Table(props, ref) {
|
|
|
308
322
|
});
|
|
309
323
|
}
|
|
310
324
|
|
|
311
|
-
lastOffsetTopRef.current =
|
|
312
|
-
}, [hasNextPage, loadMore, loadMoreLoading, scrollThreshold, tableClientHeight]);
|
|
313
|
-
|
|
314
|
-
var onBodyScroll = (0, _react.useCallback)(function (e) {
|
|
315
|
-
var currentTarget = e.target;
|
|
316
|
-
|
|
317
|
-
if (!currentTarget) {
|
|
318
|
-
return;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
var scrollLeftNum = currentTarget.scrollLeft;
|
|
322
|
-
var scrollTopNum = currentTarget.scrollTop; // 纵向滚动
|
|
323
|
-
|
|
324
|
-
if (scrollTopNum !== lastOffsetLeftRef.current) {
|
|
325
|
-
onBodyVerticalScroll(currentTarget);
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
if (scrollLeftNum === lastOffsetLeftRef.current) {
|
|
329
|
-
return;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
var compareTarget = currentTarget; // 横向滚动
|
|
333
|
-
|
|
334
|
-
if (!getScrollTarget() || getScrollTarget() === compareTarget) {
|
|
335
|
-
setScrollTarget(compareTarget);
|
|
336
|
-
forceScroll(scrollLeftNum, tableBodyRef.current);
|
|
337
|
-
forceScroll(scrollLeftNum, tableHeadRef.current);
|
|
338
|
-
lastOffsetLeftRef.current = scrollLeftNum;
|
|
339
|
-
}
|
|
340
|
-
}, [forceScroll, getScrollTarget, onBodyVerticalScroll, setScrollTarget]);
|
|
325
|
+
lastOffsetTopRef.current = currentTargetScrollTop;
|
|
326
|
+
}, [hasNextPage, loadMore, loadMoreLoading, scrollThreshold, tableClientHeight]);
|
|
341
327
|
(0, _react.useEffect)(function () {
|
|
342
328
|
if (!hasNextPage) {
|
|
343
329
|
setLoadMoreLoading(false);
|
|
@@ -345,7 +331,11 @@ function Table(props, ref) {
|
|
|
345
331
|
}, [hasNextPage]); // 渲染有设置高度的表格
|
|
346
332
|
|
|
347
333
|
var renderTableWithHeight = function renderTableWithHeight() {
|
|
348
|
-
|
|
334
|
+
if (!tableClientWidth || !tableClientHeight) {
|
|
335
|
+
return null;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
var renderTableBody = function renderTableBody() {
|
|
349
339
|
if (loading && !rows.length) {
|
|
350
340
|
return /*#__PURE__*/_react.default.createElement(_Loading.default, null);
|
|
351
341
|
}
|
|
@@ -354,42 +344,46 @@ function Table(props, ref) {
|
|
|
354
344
|
return /*#__PURE__*/_react.default.createElement(_Empty.default, null);
|
|
355
345
|
}
|
|
356
346
|
|
|
357
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
ref: tableBodyRef,
|
|
364
|
-
onScroll: onBodyScroll
|
|
365
|
-
}, tableRowListNode, loadMoreLoading && /*#__PURE__*/_react.default.createElement(_Loading.default, null));
|
|
347
|
+
return /*#__PURE__*/_react.default.createElement(_rcResizeObserver.default, {
|
|
348
|
+
onResize: function onResize(_ref2) {
|
|
349
|
+
var clientHeight = _ref2.height;
|
|
350
|
+
setTableBodyContentHeight(clientHeight);
|
|
351
|
+
}
|
|
352
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, tableRowListNode, loadMoreLoading && /*#__PURE__*/_react.default.createElement(_Loading.default, null)));
|
|
366
353
|
};
|
|
367
354
|
|
|
368
355
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
369
|
-
className: (0,
|
|
356
|
+
className: (0, _classnames3.default)("".concat(prefixCls, "-inner-wrap"), _defineProperty({}, "".concat(prefixCls, "-innerScroll"), !!height)),
|
|
357
|
+
ref: tableBodyRef,
|
|
358
|
+
onScroll: onBodyVerticalScroll
|
|
359
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
360
|
+
style: {
|
|
361
|
+
width: columnsTotalWidthRef.current,
|
|
362
|
+
height: tableBodyContentHeight
|
|
363
|
+
}
|
|
370
364
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
371
|
-
ref: tableHeadRef,
|
|
372
365
|
className: "".concat(prefixCls, "-tableHeadScrollWrap")
|
|
373
366
|
}, tableHeadNode), /*#__PURE__*/_react.default.createElement("div", Object.assign({}, getTableBodyProps(), {
|
|
374
|
-
className: (0,
|
|
375
|
-
}),
|
|
367
|
+
className: (0, _classnames3.default)("".concat(prefixCls, "-tbody"))
|
|
368
|
+
}), renderTableBody())));
|
|
376
369
|
};
|
|
377
370
|
|
|
378
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
379
|
-
|
|
380
|
-
var clientWidth = _ref2.width,
|
|
381
|
-
clientHeight = _ref2.height;
|
|
382
|
-
setTableClientWidth(clientWidth);
|
|
383
|
-
setTableClientHeight(clientHeight);
|
|
384
|
-
}
|
|
385
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
371
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
372
|
+
key: tableKey,
|
|
386
373
|
className: prefixCls,
|
|
387
374
|
ref: tableRef,
|
|
388
375
|
style: {
|
|
389
376
|
height: !height ? 'unset' : height
|
|
390
377
|
}
|
|
391
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
392
|
-
|
|
378
|
+
}, /*#__PURE__*/_react.default.createElement(_rcResizeObserver.default, {
|
|
379
|
+
onResize: function onResize(_ref3) {
|
|
380
|
+
var clientWidth = _ref3.width,
|
|
381
|
+
clientHeight = _ref3.height;
|
|
382
|
+
setTableClientWidth(clientWidth);
|
|
383
|
+
setTableClientHeight(clientHeight);
|
|
384
|
+
}
|
|
385
|
+
}, !tableClientWidth ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", null)) : /*#__PURE__*/_react.default.createElement("div", Object.assign({}, getTableProps(), {
|
|
386
|
+
className: (0, _classnames3.default)("".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))
|
|
393
387
|
}), height ? renderTableWithHeight() : renderTableWithoutHeight())));
|
|
394
388
|
}
|
|
395
389
|
|
|
@@ -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;
|
|
@@ -59,7 +59,6 @@ var ARRAY_FIRST_INDEX = 0;
|
|
|
59
59
|
|
|
60
60
|
function TableHead(props) {
|
|
61
61
|
var headerGroups = props.headerGroups,
|
|
62
|
-
tableContentWidth = props.tableContentWidth,
|
|
63
62
|
canResizeColumn = props.canResizeColumn,
|
|
64
63
|
defaultSort = props.defaultSort,
|
|
65
64
|
_props$sortable = props.sortable,
|
|
@@ -251,7 +250,7 @@ function TableHead(props) {
|
|
|
251
250
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
252
251
|
className: "".concat(prefixCls, "-thead"),
|
|
253
252
|
style: {
|
|
254
|
-
width:
|
|
253
|
+
width: columnsTotalWidthRef.current
|
|
255
254
|
}
|
|
256
255
|
}, headerGroups.map(function (headerGroup) {
|
|
257
256
|
var _headerGroup$getHeade = headerGroup.getHeaderGroupProps(),
|
package/lib/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/lib/Table/utils.js
CHANGED
|
@@ -12,7 +12,7 @@ exports.isPercentageWidth = isPercentageWidth;
|
|
|
12
12
|
exports.isSpecificPxWidth = isSpecificPxWidth;
|
|
13
13
|
var ZERO = 0;
|
|
14
14
|
var NOT_SET = -1;
|
|
15
|
-
var COLUMN_MIN_WIDTH =
|
|
15
|
+
var COLUMN_MIN_WIDTH = 80;
|
|
16
16
|
var HUNDRED = 100; // TODO: 添加单侧
|
|
17
17
|
|
|
18
18
|
function getColumnsWidthMap(columns, clientWidth, lastWidthMap) {
|
|
@@ -21,12 +21,19 @@ function getColumnsWidthMap(columns, clientWidth, lastWidthMap) {
|
|
|
21
21
|
var widthMap = new Map();
|
|
22
22
|
var totalColumnWidth = ZERO;
|
|
23
23
|
columns.forEach(function (item, index) {
|
|
24
|
-
var _lastWidthMap$get;
|
|
25
|
-
|
|
26
24
|
var key = index.toString();
|
|
27
|
-
var
|
|
25
|
+
var widthFlex = item.widthFlex;
|
|
26
|
+
var width = getWidthByColumnsWidth(clientWidth, item.width, widthFlex); // 首先判断是否是否是容器宽度的变化
|
|
27
|
+
|
|
28
|
+
var isSpecific;
|
|
28
29
|
|
|
29
|
-
|
|
30
|
+
if (widthFlex) {
|
|
31
|
+
isSpecific = false;
|
|
32
|
+
} else {
|
|
33
|
+
var _lastWidthMap$get;
|
|
34
|
+
|
|
35
|
+
isSpecific = lastWidthMap ? (_lastWidthMap$get = lastWidthMap.get(key)) === null || _lastWidthMap$get === void 0 ? void 0 : _lastWidthMap$get.isSpecific : isSpecificWidth(item.width);
|
|
36
|
+
}
|
|
30
37
|
|
|
31
38
|
if (lastWidthMap && isSpecific) {
|
|
32
39
|
var _lastWidthMap$get2;
|
|
@@ -52,7 +59,7 @@ function getColumnsWidthMap(columns, clientWidth, lastWidthMap) {
|
|
|
52
59
|
|
|
53
60
|
return widthMap.set(item, {
|
|
54
61
|
isSpecific: (_widthMap$get = widthMap.get(item)) === null || _widthMap$get === void 0 ? void 0 : _widthMap$get.isSpecific,
|
|
55
|
-
width:
|
|
62
|
+
width: COLUMN_MIN_WIDTH
|
|
56
63
|
});
|
|
57
64
|
});
|
|
58
65
|
} // 设定宽度小于容器宽度时
|
|
@@ -84,8 +91,8 @@ function getColumnsWidthMap(columns, clientWidth, lastWidthMap) {
|
|
|
84
91
|
};
|
|
85
92
|
}
|
|
86
93
|
|
|
87
|
-
function getWidthByColumnsWidth(clientWidth, width) {
|
|
88
|
-
if (width === undefined) {
|
|
94
|
+
function getWidthByColumnsWidth(clientWidth, width, widthFlex) {
|
|
95
|
+
if (width === undefined || widthFlex) {
|
|
89
96
|
return NOT_SET;
|
|
90
97
|
}
|
|
91
98
|
|
|
@@ -138,7 +145,7 @@ function getValidScrollThreshold(height, clientHeight) {
|
|
|
138
145
|
}
|
|
139
146
|
|
|
140
147
|
function getPercentageValue(percentage, containerNum) {
|
|
141
|
-
var percent =
|
|
148
|
+
var percent = Number(percentage.replace('%', '')) / HUNDRED;
|
|
142
149
|
return getValidWidthByNumber(containerNum * percent);
|
|
143
150
|
}
|
|
144
151
|
|
package/lib/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/lib/Tabs/index.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.default = Tabs;
|
|
|
7
7
|
|
|
8
8
|
require("@aloudata/icons-react/styles/index.less");
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _MoreFill2 = _interopRequireDefault(require("@aloudata/icons-react/es/icons/MoreFill"));
|
|
11
11
|
|
|
12
12
|
require("antd/es/tabs/style");
|
|
13
13
|
|
|
@@ -15,8 +15,6 @@ var _tabs = _interopRequireDefault(require("antd/es/tabs"));
|
|
|
15
15
|
|
|
16
16
|
var _react = _interopRequireDefault(require("react"));
|
|
17
17
|
|
|
18
|
-
var _TabPane = _interopRequireDefault(require("./TabPane"));
|
|
19
|
-
|
|
20
18
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
21
19
|
|
|
22
20
|
var _excluded = ["size", "className", "popupClassName", "adaptHeight"];
|
|
@@ -49,7 +47,7 @@ function Tabs(props) {
|
|
|
49
47
|
return /*#__PURE__*/_react.default.createElement(_tabs.default, Object.assign({
|
|
50
48
|
moreIcon: /*#__PURE__*/_react.default.createElement("div", {
|
|
51
49
|
className: "ald-tabs-moreIcon"
|
|
52
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
50
|
+
}, /*#__PURE__*/_react.default.createElement(_MoreFill2.default, {
|
|
53
51
|
color: "currentColor"
|
|
54
52
|
})),
|
|
55
53
|
tabBarGutter: 24,
|
|
@@ -59,6 +57,4 @@ function Tabs(props) {
|
|
|
59
57
|
'ald-tabs-default': size !== 'large'
|
|
60
58
|
})
|
|
61
59
|
}, tabsProps));
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
Tabs.TabPane = _TabPane.default;
|
|
60
|
+
}
|
package/lib/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/lib/Tooltip/index.js
CHANGED
|
@@ -16,8 +16,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
16
16
|
function Tooltip(props) {
|
|
17
17
|
var children = props.children,
|
|
18
18
|
title = props.title,
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
open = props.open,
|
|
20
|
+
onOpenChange = props.onOpenChange,
|
|
21
21
|
trigger = props.trigger,
|
|
22
22
|
zIndex = props.zIndex,
|
|
23
23
|
placement = props.placement,
|
|
@@ -30,8 +30,8 @@ function Tooltip(props) {
|
|
|
30
30
|
return /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
31
31
|
title: title,
|
|
32
32
|
overlayClassName: (0, _classnames.default)('ald-tooltip-overlay', overlayClassName),
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
open: open,
|
|
34
|
+
onOpenChange: onOpenChange,
|
|
35
35
|
trigger: trigger,
|
|
36
36
|
zIndex: zIndex,
|
|
37
37
|
placement: placement,
|