@aloudata/aloudata-design 1.7.0 → 1.8.0
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/dist/AldTable/helper.d.ts +22 -0
- package/dist/AldTable/helper.js +102 -0
- package/dist/AldTable/index.d.ts +4 -0
- package/dist/AldTable/index.js +124 -0
- package/dist/AldTable/style/index.d.ts +2 -0
- package/dist/AldTable/style/index.js +2 -0
- package/dist/AldTable/style/index.less +96 -0
- package/dist/AldTable/types.d.ts +25 -0
- package/dist/AldTable/types.js +1 -0
- package/dist/Checkbox/style/index.less +1 -0
- package/dist/Form/index.d.ts +1 -1
- package/dist/Icon/style/index.d.ts +2 -0
- package/dist/Icon/style/index.js +2 -0
- package/dist/Icon/style/index.less +24 -0
- package/dist/Menu/Divider.d.ts +1 -2
- package/dist/Menu/Divider.js +1 -1
- package/dist/Navigator/style/index.less +2 -2
- package/dist/Pagination/index.d.ts +24 -0
- package/dist/Pagination/index.js +171 -0
- package/dist/Pagination/style/index.d.ts +2 -0
- package/dist/Pagination/style/index.js +2 -0
- package/dist/Pagination/style/index.less +22 -0
- package/dist/Pagination/types.d.ts +6 -0
- package/dist/Pagination/types.js +1 -0
- package/dist/Table/Table.d.ts +1 -1
- package/dist/Table/Table.js +0 -1
- package/dist/Table/components/TableHead/index.d.ts +2 -2
- package/dist/Table/components/TableHead/index.js +9 -16
- package/dist/Table/utils.js +11 -8
- package/dist/Tree/index.d.ts +2 -2
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -0
- package/package.json +2 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type Column } from 'react-table';
|
|
2
|
+
import { ITableColumn } from './types';
|
|
3
|
+
export declare function getTableColumns<TDataItem extends object>({ columns, columnSizing, totalWidth, }: {
|
|
4
|
+
columns: ITableColumn<TDataItem>[];
|
|
5
|
+
columnSizing: boolean;
|
|
6
|
+
totalWidth: number;
|
|
7
|
+
}): Column<TDataItem>[];
|
|
8
|
+
/**
|
|
9
|
+
* 计算
|
|
10
|
+
* @param columns
|
|
11
|
+
* @param columnSizing
|
|
12
|
+
* @param totalWidth
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
export declare function getColumnWidths(columns: ITableColumn<unknown>[], columnSizing: boolean, totalWidth: number): number[];
|
|
16
|
+
/**
|
|
17
|
+
* 判断是否百分比字符串
|
|
18
|
+
* @param str
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
export declare function isPercentage(str: string): boolean;
|
|
22
|
+
export declare function prefixCls(className: string): string;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export function getTableColumns(_ref) {
|
|
4
|
+
var columns = _ref.columns,
|
|
5
|
+
columnSizing = _ref.columnSizing,
|
|
6
|
+
totalWidth = _ref.totalWidth;
|
|
7
|
+
var columnWidths = getColumnWidths(columns, columnSizing, totalWidth);
|
|
8
|
+
return _.map(columns, function (col, index) {
|
|
9
|
+
return {
|
|
10
|
+
id: col.dataIndex || "column-".concat(index),
|
|
11
|
+
accessor: col.dataIndex,
|
|
12
|
+
Header: typeof col.title === 'string' ? /*#__PURE__*/React.createElement("div", {
|
|
13
|
+
key: col.dataIndex,
|
|
14
|
+
className: prefixCls('th-default')
|
|
15
|
+
}, col.title) : col.title,
|
|
16
|
+
Cell: function Cell(_ref2) {
|
|
17
|
+
var row = _ref2.row;
|
|
18
|
+
|
|
19
|
+
var colValue = _.get(row.original, col.dataIndex || '');
|
|
20
|
+
|
|
21
|
+
var node = col.render ? col.render(colValue, row.original, row.index) : colValue;
|
|
22
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
23
|
+
className: prefixCls('td-default')
|
|
24
|
+
}, col.ellipsis ? /*#__PURE__*/React.createElement("div", {
|
|
25
|
+
className: prefixCls('td-ellipsis-content')
|
|
26
|
+
}, node) : node);
|
|
27
|
+
},
|
|
28
|
+
width: columnWidths[index]
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* 计算
|
|
34
|
+
* @param columns
|
|
35
|
+
* @param columnSizing
|
|
36
|
+
* @param totalWidth
|
|
37
|
+
* @returns
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
export function getColumnWidths(columns, columnSizing, totalWidth) {
|
|
41
|
+
// 可改变列宽情况,react-table 可拖动列宽要求列宽值必须是数字,因为将百分比列宽转换为数字
|
|
42
|
+
var DEFAULT_WIDTH = 150; // 计算出每个列的具体宽度值
|
|
43
|
+
|
|
44
|
+
var columnWidths = _.map(columns, function (col) {
|
|
45
|
+
var width = col.width;
|
|
46
|
+
|
|
47
|
+
if (typeof width === 'number') {
|
|
48
|
+
return width;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (typeof width === 'string' && isPercentage(width)) {
|
|
52
|
+
var widthNum = getNumberFromPercentageStr(width);
|
|
53
|
+
return widthNum * totalWidth / 100;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return DEFAULT_WIDTH;
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
var totalColumnWidth = _.sum(columnWidths); // 如果实际宽度大于列总宽度之和,则将多余的宽度按列宽的比例分配给各个列
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
if (totalWidth !== totalColumnWidth) {
|
|
63
|
+
// 如果实际宽度大于或小于列总宽度之和,则将差额的宽度按列宽的比例分配给各个列
|
|
64
|
+
var widthDiff = totalWidth - totalColumnWidth;
|
|
65
|
+
var widthRatios = columnWidths.map(function (width) {
|
|
66
|
+
return width / totalColumnWidth;
|
|
67
|
+
});
|
|
68
|
+
var newColumnWidths = columnWidths.map(function (width, index) {
|
|
69
|
+
return width + widthDiff * widthRatios[index];
|
|
70
|
+
}); // 计算新的列宽度总和
|
|
71
|
+
|
|
72
|
+
var newTotalColumnWidth = _.sum(newColumnWidths); // 计算并处理可能存在的误差
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
var errorWidth = totalWidth - newTotalColumnWidth; // 将误差加到最后一个列宽上
|
|
76
|
+
|
|
77
|
+
newColumnWidths[newColumnWidths.length - 1] += errorWidth;
|
|
78
|
+
return newColumnWidths;
|
|
79
|
+
} else {
|
|
80
|
+
return columnWidths;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function getNumberFromPercentageStr(str) {
|
|
85
|
+
var numberStr = str.replace('%', '');
|
|
86
|
+
return parseFloat(numberStr);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* 判断是否百分比字符串
|
|
90
|
+
* @param str
|
|
91
|
+
* @returns
|
|
92
|
+
*/
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
export function isPercentage(str) {
|
|
96
|
+
var regex = /^100(\.\d+)?%?$|^\d{1,2}(\.\d+)?%$/;
|
|
97
|
+
return regex.test(str);
|
|
98
|
+
}
|
|
99
|
+
var ALD_PREFIX = 'ald-tmp-table';
|
|
100
|
+
export function prefixCls(className) {
|
|
101
|
+
return "".concat(ALD_PREFIX, "-").concat(className);
|
|
102
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
3
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
+
|
|
5
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
+
|
|
7
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
8
|
+
|
|
9
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
+
|
|
11
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
12
|
+
|
|
13
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
14
|
+
|
|
15
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
+
|
|
17
|
+
import classnames from 'classnames';
|
|
18
|
+
import _ from 'lodash';
|
|
19
|
+
import ResizeObserver from 'rc-resize-observer';
|
|
20
|
+
import React, { useMemo, useState } from 'react';
|
|
21
|
+
import { useBlockLayout, useResizeColumns, useTable } from 'react-table';
|
|
22
|
+
import { Empty, Pagination, Spin } from '..';
|
|
23
|
+
import { getTableColumns, prefixCls } from "./helper";
|
|
24
|
+
|
|
25
|
+
function AldTable(props) {
|
|
26
|
+
var columns = props.columns,
|
|
27
|
+
data = props.data,
|
|
28
|
+
rowKey = props.rowKey,
|
|
29
|
+
columnSizing = props.columnSizing,
|
|
30
|
+
sticky = props.sticky,
|
|
31
|
+
loading = props.loading,
|
|
32
|
+
pagination = props.pagination;
|
|
33
|
+
|
|
34
|
+
var _useState = useState(null),
|
|
35
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
36
|
+
totalSize = _useState2[0],
|
|
37
|
+
setTotalSize = _useState2[1];
|
|
38
|
+
|
|
39
|
+
var tableColumns = useMemo(function () {
|
|
40
|
+
if (!totalSize) {
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return getTableColumns({
|
|
45
|
+
columns: columns,
|
|
46
|
+
columnSizing: !!columnSizing,
|
|
47
|
+
totalWidth: totalSize.width
|
|
48
|
+
});
|
|
49
|
+
}, [columns, totalSize, columnSizing]);
|
|
50
|
+
|
|
51
|
+
var _useTable = useTable({
|
|
52
|
+
columns: tableColumns,
|
|
53
|
+
data: data,
|
|
54
|
+
getRowId: function getRowId(row, index) {
|
|
55
|
+
var rowKeyStr = index;
|
|
56
|
+
|
|
57
|
+
if (typeof rowKey === 'function') {
|
|
58
|
+
rowKeyStr = rowKey(row);
|
|
59
|
+
} else if (rowKey !== undefined) {
|
|
60
|
+
rowKeyStr = _.get(row, rowKey, index);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return _.toString(rowKeyStr);
|
|
64
|
+
}
|
|
65
|
+
}, useBlockLayout, useResizeColumns),
|
|
66
|
+
getTableProps = _useTable.getTableProps,
|
|
67
|
+
getTableBodyProps = _useTable.getTableBodyProps,
|
|
68
|
+
rows = _useTable.rows,
|
|
69
|
+
prepareRow = _useTable.prepareRow,
|
|
70
|
+
headerGroups = _useTable.headerGroups;
|
|
71
|
+
|
|
72
|
+
var tableProps = useMemo(function () {
|
|
73
|
+
return getTableProps();
|
|
74
|
+
}, [getTableProps]);
|
|
75
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
76
|
+
className: prefixCls('container')
|
|
77
|
+
}, /*#__PURE__*/React.createElement(ResizeObserver, {
|
|
78
|
+
onResize: function onResize(size) {
|
|
79
|
+
setTotalSize(size);
|
|
80
|
+
}
|
|
81
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
82
|
+
className: prefixCls('main')
|
|
83
|
+
}, /*#__PURE__*/React.createElement("div", _extends({
|
|
84
|
+
className: prefixCls('main')
|
|
85
|
+
}, tableProps), _.map(headerGroups, function (headerGroup) {
|
|
86
|
+
var topStyle = sticky && _.get(sticky, 'offsetHeader') ? {
|
|
87
|
+
style: {
|
|
88
|
+
top: _.get(sticky, 'offsetHeader', 0)
|
|
89
|
+
}
|
|
90
|
+
} : {};
|
|
91
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, headerGroup.getHeaderGroupProps(topStyle), {
|
|
92
|
+
className: classnames(prefixCls('tr'), _defineProperty({}, prefixCls('sticky'), !!sticky))
|
|
93
|
+
}), _.map(headerGroup.headers, function (column) {
|
|
94
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, column.getHeaderProps(), {
|
|
95
|
+
className: prefixCls('th')
|
|
96
|
+
}), column.render('Header'), columnSizing && /*#__PURE__*/React.createElement("div", _extends({}, column.getResizerProps(), {
|
|
97
|
+
className: classnames(prefixCls('resizer'), {
|
|
98
|
+
isResizing: column.isResizing
|
|
99
|
+
})
|
|
100
|
+
})));
|
|
101
|
+
}));
|
|
102
|
+
}), /*#__PURE__*/React.createElement("div", getTableBodyProps(), /*#__PURE__*/React.createElement(Spin, {
|
|
103
|
+
spinning: !!loading,
|
|
104
|
+
tip: "Loading..."
|
|
105
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
106
|
+
className: prefixCls('body')
|
|
107
|
+
}, rows.length === 0 && !loading ? /*#__PURE__*/React.createElement(Empty, {
|
|
108
|
+
title: "No Data",
|
|
109
|
+
image: Empty.PRESENTED_IMAGE_SEARCH
|
|
110
|
+
}) : _.map(rows, function (row) {
|
|
111
|
+
prepareRow(row);
|
|
112
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
113
|
+
className: prefixCls('tr')
|
|
114
|
+
}, row.getRowProps()), _.map(row.cells, function (cell) {
|
|
115
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
116
|
+
className: prefixCls('td')
|
|
117
|
+
}, cell.getCellProps()), cell.render('Cell'));
|
|
118
|
+
}));
|
|
119
|
+
}))))))), pagination && /*#__PURE__*/React.createElement("div", {
|
|
120
|
+
className: prefixCls('pagination')
|
|
121
|
+
}, /*#__PURE__*/React.createElement(Pagination, pagination)));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export default AldTable;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
@import '../../style/index.less';
|
|
2
|
+
@import '../../Pagination/style/index.less';
|
|
3
|
+
@import '../../Spin/style/index.less';
|
|
4
|
+
|
|
5
|
+
.ald-tmp-table-container {
|
|
6
|
+
position: relative;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.ald-tmp-table-main {
|
|
10
|
+
width: 100%;
|
|
11
|
+
color: #171717;
|
|
12
|
+
font-size: 13px;
|
|
13
|
+
line-height: 20px;
|
|
14
|
+
background: #fff;
|
|
15
|
+
|
|
16
|
+
.ald-tmp-table-main {
|
|
17
|
+
display: inline-block;
|
|
18
|
+
border-spacing: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.ald-tmp-table-resizer {
|
|
22
|
+
position: absolute;
|
|
23
|
+
right: 0;
|
|
24
|
+
top: 0;
|
|
25
|
+
height: 100%;
|
|
26
|
+
width: 5px;
|
|
27
|
+
background: rgb(0 0 0 / 0.5);
|
|
28
|
+
cursor: col-resize;
|
|
29
|
+
user-select: none;
|
|
30
|
+
touch-action: none;
|
|
31
|
+
|
|
32
|
+
&.isResizing {
|
|
33
|
+
background: blue;
|
|
34
|
+
opacity: 1;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.ald-tmp-table-th,
|
|
39
|
+
.ald-tmp-table-td {
|
|
40
|
+
position: relative;
|
|
41
|
+
overflow: hidden;
|
|
42
|
+
border-bottom: 1px solid #e8e8e8;
|
|
43
|
+
background-color: #fff;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.ald-tmp-table-th {
|
|
47
|
+
border-bottom: 1px solid #e8e8e8;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.ald-tmp-table-th-default {
|
|
51
|
+
font-weight: 500;
|
|
52
|
+
padding: 6px 12px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.ald-tmp-table-td-default {
|
|
56
|
+
padding: 0 12px;
|
|
57
|
+
display: flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
height: 100%;
|
|
60
|
+
min-height: 48px;
|
|
61
|
+
|
|
62
|
+
.ald-tmp-table-td-ellipsis-content {
|
|
63
|
+
overflow: hidden;
|
|
64
|
+
text-overflow: ellipsis;
|
|
65
|
+
white-space: nowrap;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.ald-tmp-table-sticky {
|
|
70
|
+
position: sticky;
|
|
71
|
+
top: 0;
|
|
72
|
+
// 需要大于 Spin 的 z-index,Spin 的 z-index 为4
|
|
73
|
+
z-index: 5;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.ald-tmp-table-body {
|
|
77
|
+
min-height: 200px;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.ald-tmp-table-pagination {
|
|
82
|
+
margin-top: 18px;
|
|
83
|
+
display: flex;
|
|
84
|
+
justify-content: end;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.ald-tmp-table-loading {
|
|
88
|
+
position: absolute;
|
|
89
|
+
top: 50%;
|
|
90
|
+
left: 50%;
|
|
91
|
+
transform: translate(-50%, -50%);
|
|
92
|
+
|
|
93
|
+
.ald-tmp-table-loading-inner {
|
|
94
|
+
width: 100%;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IPaginationProps } from '../Pagination/types';
|
|
3
|
+
export interface ITableProps<TDataItem extends object> {
|
|
4
|
+
columns: ITableColumn<TDataItem>[];
|
|
5
|
+
data: TDataItem[];
|
|
6
|
+
rowKey?: string | ((record: TDataItem) => string | number);
|
|
7
|
+
columnSizing?: boolean;
|
|
8
|
+
sticky?: boolean | {
|
|
9
|
+
offsetHeader: number;
|
|
10
|
+
};
|
|
11
|
+
loading?: boolean;
|
|
12
|
+
scroll?: {
|
|
13
|
+
x: number | string;
|
|
14
|
+
y: number | string;
|
|
15
|
+
};
|
|
16
|
+
pagination?: IPaginationProps;
|
|
17
|
+
}
|
|
18
|
+
export interface ITableColumn<TDataItem = unknown> {
|
|
19
|
+
title: string | React.ReactNode;
|
|
20
|
+
dataIndex?: string;
|
|
21
|
+
width?: number | string;
|
|
22
|
+
render?: (text: any, record: TDataItem, rowIndex: number) => React.ReactNode;
|
|
23
|
+
ellipsis?: boolean;
|
|
24
|
+
noPadding?: boolean;
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
z-index: 10;
|
|
75
75
|
width: 10px;
|
|
76
76
|
height: 8px;
|
|
77
|
+
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
77
78
|
background: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAiIGhlaWdodD0iOCIgdmlld0JveD0iMCAwIDEwIDgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNOS42NzU3MyAwLjI2Mjg1MkMxMC4wODI4IDAuNjM2MDQ0IDEwLjExMDQgMS4yNjg2MSA5LjczNzE2IDEuNjc1NzNMNC4yMzcxNiA3LjY3NTczQzQuMDQ3NzUgNy44ODIzNiAzLjc4MDMxIDguMDAwMDEgMy41MDAwMSA4LjAwMDAxQzMuMjE5NyA4LjAwMDAxIDIuOTUyMjYgNy44ODIzNiAyLjc2Mjg1IDcuNjc1NzNMMC4yNjI4NTIgNC45NDg0NkMtMC4xMTAzNDEgNC41NDEzNCAtMC4wODI4Mzc4IDMuOTA4NzcgMC4zMjQyODEgMy41MzU1OEMwLjczMTQgMy4xNjIzOSAxLjM2Mzk3IDMuMTg5ODkgMS43MzcxNiAzLjU5NzAxTDMuNTAwMDEgNS41MjAxMUw4LjI2Mjg1IDAuMzI0MjgxQzguNjM2MDQgLTAuMDgyODM3OCA5LjI2ODYxIC0wLjExMDM0MSA5LjY3NTczIDAuMjYyODUyWiIgZmlsbD0iIzE1NzBFRiIvPgo8L3N2Zz4K');
|
|
78
79
|
background-size: 100%, 100%;
|
|
79
80
|
border-width: 0;
|
package/dist/Form/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ interface IFormItemProps extends FormItemProps {
|
|
|
18
18
|
declare const AldFormItem: {
|
|
19
19
|
(props: IFormItemProps): JSX.Element;
|
|
20
20
|
useStatus: () => {
|
|
21
|
-
status?: "" | "
|
|
21
|
+
status?: "" | "success" | "error" | "warning" | "validating" | undefined;
|
|
22
22
|
errors: React.ReactNode[];
|
|
23
23
|
warnings: React.ReactNode[];
|
|
24
24
|
};
|
package/dist/Icon/style/index.js
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.icon {
|
|
2
|
+
font-size: 16px;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
// 用于替换antd内的某些无法通过外部传入的图标
|
|
6
|
+
.ald-iconSvg(@svgName; @size: 16px) {
|
|
7
|
+
font-size: @size;
|
|
8
|
+
font-style: normal;
|
|
9
|
+
-webkit-font-smoothing: antialiased;
|
|
10
|
+
-moz-osx-font-smoothing: grayscale;
|
|
11
|
+
|
|
12
|
+
&::before {
|
|
13
|
+
content: url('iconSvgs/@{svgName}.svg');
|
|
14
|
+
width: @size;
|
|
15
|
+
height: @size;
|
|
16
|
+
font-size: @size;
|
|
17
|
+
color: inherit;
|
|
18
|
+
display: inline-block;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
& > svg {
|
|
22
|
+
display: none;
|
|
23
|
+
}
|
|
24
|
+
}
|
package/dist/Menu/Divider.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { MenuDividerProps } from 'antd/lib/menu/MenuDivider';
|
|
3
|
-
export
|
|
4
|
-
}
|
|
3
|
+
export declare type IMenuDividerProps = MenuDividerProps;
|
|
5
4
|
export default function Menu(props: IMenuDividerProps): JSX.Element;
|
package/dist/Menu/Divider.js
CHANGED
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
&::before {
|
|
127
|
-
animation: 0.26s linear 0s
|
|
127
|
+
animation: 0.26s linear 0s hover-bg-change;
|
|
128
128
|
animation-fill-mode: forwards;
|
|
129
129
|
}
|
|
130
130
|
}
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
@keyframes
|
|
144
|
+
@keyframes hover-bg-change {
|
|
145
145
|
0% {
|
|
146
146
|
width: 0%;
|
|
147
147
|
background-color: @ND80;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IPaginationProps } from './types';
|
|
3
|
+
declare function Pagination(props: IPaginationProps): JSX.Element;
|
|
4
|
+
export default Pagination;
|
|
5
|
+
/**
|
|
6
|
+
* 获取在安全范围内的当前页数
|
|
7
|
+
*/
|
|
8
|
+
export declare function getSafeCurrent(totalPage: number, current?: number): number;
|
|
9
|
+
export declare const ELLIPSIS = "...";
|
|
10
|
+
export declare type PaginationItemType = number | typeof ELLIPSIS;
|
|
11
|
+
/**
|
|
12
|
+
* 获取分页组件需要显示的页码范围。
|
|
13
|
+
*
|
|
14
|
+
* @param totalPage 最大页码。
|
|
15
|
+
* @param currentPage 当前所在的页码。
|
|
16
|
+
*
|
|
17
|
+
* 如果总页数不超过5页,直接返回所有页码。
|
|
18
|
+
* 否则,在生成页码时,除了第一页和最后一页,还会显示以当前页为中心的连续页码,数量为 `surroundCount`*2 个,
|
|
19
|
+
* 当当前页码距离边界过近时,会在页码前后添加省略号。
|
|
20
|
+
* 当前页码 `currentPage` 的值必须介于 1 和总页数之间,如果超出这个范围,会自动修正。
|
|
21
|
+
*
|
|
22
|
+
* @returns 一个包含了所有要显示的页码和省略号的数组。
|
|
23
|
+
*/
|
|
24
|
+
export declare function getPaginationRange(totalPage: number, currentPage: number): PaginationItemType[];
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
|
|
5
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
+
|
|
7
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
+
|
|
9
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
10
|
+
|
|
11
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
12
|
+
|
|
13
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
+
|
|
15
|
+
import { ChevronLeftLine, ChevronRightLine } from '@aloudata/icons-react';
|
|
16
|
+
import classnames from 'classnames';
|
|
17
|
+
import _ from 'lodash';
|
|
18
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
19
|
+
import Button from "../Button";
|
|
20
|
+
|
|
21
|
+
function Pagination(props) {
|
|
22
|
+
var _props$current = props.current,
|
|
23
|
+
currPage = _props$current === void 0 ? 1 : _props$current,
|
|
24
|
+
pageSize = props.pageSize,
|
|
25
|
+
total = props.total,
|
|
26
|
+
onChange = props.onChange;
|
|
27
|
+
var totalPage = getTotalPage(total, pageSize);
|
|
28
|
+
|
|
29
|
+
var _useState = useState(getSafeCurrent(totalPage, currPage)),
|
|
30
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
31
|
+
current = _useState2[0],
|
|
32
|
+
setCurrent = _useState2[1];
|
|
33
|
+
|
|
34
|
+
useEffect(function () {
|
|
35
|
+
var safeCurrent = getSafeCurrent(totalPage, currPage);
|
|
36
|
+
setCurrent(safeCurrent);
|
|
37
|
+
}, [currPage, totalPage]);
|
|
38
|
+
|
|
39
|
+
if (pageSize === 0) {
|
|
40
|
+
throw new Error('pageSize must be greater than 0');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
var onChangePage = useCallback(function (page) {
|
|
44
|
+
return function () {
|
|
45
|
+
if (page === current) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
setCurrent(page);
|
|
50
|
+
onChange(page);
|
|
51
|
+
};
|
|
52
|
+
}, [onChange, current]);
|
|
53
|
+
var pageRange = getPaginationRange(totalPage, current);
|
|
54
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
55
|
+
className: prefixCls('container')
|
|
56
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
57
|
+
icon: /*#__PURE__*/React.createElement(ChevronLeftLine, {
|
|
58
|
+
size: 16
|
|
59
|
+
}),
|
|
60
|
+
onClick: onChangePage(current - 1),
|
|
61
|
+
disabled: current === 1
|
|
62
|
+
}), _.map(pageRange, function (page, index) {
|
|
63
|
+
if (page === ELLIPSIS) {
|
|
64
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
65
|
+
key: index,
|
|
66
|
+
className: prefixCls('ellipsis')
|
|
67
|
+
}, "...");
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
71
|
+
key: index,
|
|
72
|
+
icon: /*#__PURE__*/React.createElement("span", null, page),
|
|
73
|
+
className: classnames(_defineProperty({}, prefixCls('active'), page === current)),
|
|
74
|
+
onClick: onChangePage(page)
|
|
75
|
+
});
|
|
76
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
77
|
+
icon: /*#__PURE__*/React.createElement(ChevronRightLine, {
|
|
78
|
+
size: 16
|
|
79
|
+
}),
|
|
80
|
+
onClick: onChangePage(current + 1),
|
|
81
|
+
disabled: current >= totalPage
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export default Pagination;
|
|
86
|
+
/**
|
|
87
|
+
* 获取在安全范围内的当前页数
|
|
88
|
+
*/
|
|
89
|
+
|
|
90
|
+
export function getSafeCurrent(totalPage, current) {
|
|
91
|
+
if (current === undefined) {
|
|
92
|
+
return 1;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return Math.max(1, Math.min(current, totalPage));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function getTotalPage(total, pageSize) {
|
|
99
|
+
return Math.max(1, Math.ceil(total / pageSize));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export var ELLIPSIS = '...';
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* 获取分页组件需要显示的页码范围。
|
|
106
|
+
*
|
|
107
|
+
* @param totalPage 最大页码。
|
|
108
|
+
* @param currentPage 当前所在的页码。
|
|
109
|
+
*
|
|
110
|
+
* 如果总页数不超过5页,直接返回所有页码。
|
|
111
|
+
* 否则,在生成页码时,除了第一页和最后一页,还会显示以当前页为中心的连续页码,数量为 `surroundCount`*2 个,
|
|
112
|
+
* 当当前页码距离边界过近时,会在页码前后添加省略号。
|
|
113
|
+
* 当前页码 `currentPage` 的值必须介于 1 和总页数之间,如果超出这个范围,会自动修正。
|
|
114
|
+
*
|
|
115
|
+
* @returns 一个包含了所有要显示的页码和省略号的数组。
|
|
116
|
+
*/
|
|
117
|
+
export function getPaginationRange(totalPage, currentPage) {
|
|
118
|
+
// 如果总页数不超过5页,直接返回所有页码
|
|
119
|
+
if (totalPage <= 5) {
|
|
120
|
+
return Array.from({
|
|
121
|
+
length: totalPage
|
|
122
|
+
}, function (_, i) {
|
|
123
|
+
return i + 1;
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
var surroundCount = 2;
|
|
128
|
+
var current = Math.max(1, Math.min(currentPage, totalPage));
|
|
129
|
+
var start = Math.max(2, current - surroundCount);
|
|
130
|
+
var end = Math.min(totalPage - 1, current + surroundCount); // Adjust start and end based on current page
|
|
131
|
+
|
|
132
|
+
if (current - start < surroundCount) {
|
|
133
|
+
end = Math.min(end + (surroundCount - (current - start)), totalPage - 1);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (end - current < surroundCount) {
|
|
137
|
+
start = Math.max(start - (surroundCount - (end - current)), 2);
|
|
138
|
+
} // Check if current page is out of range
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
if (current < start || current > end) {
|
|
142
|
+
start = Math.max(2, current - surroundCount);
|
|
143
|
+
end = Math.min(totalPage - 1, current + surroundCount);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
var range = [];
|
|
147
|
+
|
|
148
|
+
for (var i = start; i <= end; i++) {
|
|
149
|
+
range.push(i);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
range.unshift(1);
|
|
153
|
+
|
|
154
|
+
if (start > 2 && range[1] !== ELLIPSIS) {
|
|
155
|
+
range.splice(1, 0, ELLIPSIS);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (totalPage !== range[range.length - 1]) {
|
|
159
|
+
if (end < totalPage - 1 && range[range.length - 1] !== ELLIPSIS) {
|
|
160
|
+
range.splice(range.length, 0, ELLIPSIS);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
range.push(totalPage);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return range;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function prefixCls(name) {
|
|
170
|
+
return "ald-pagination-".concat(name);
|
|
171
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
@import '../../style/index.less';
|
|
2
|
+
@import '../../Button/style/index.less';
|
|
3
|
+
|
|
4
|
+
.ald-pagination-container {
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
gap: 10px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.ald-pagination-active.ald-btn.ald-btn.ald-btn-secondary {
|
|
11
|
+
&,
|
|
12
|
+
&:focus,
|
|
13
|
+
&:hover {
|
|
14
|
+
border: 1px solid #3271c9;
|
|
15
|
+
color: #3271c9;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.ald-pagination-ellipsis {
|
|
20
|
+
border: none;
|
|
21
|
+
color: #858585;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/Table/Table.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { ReactElement } from 'react';
|
|
2
2
|
import { ITableProps } from './interface';
|
|
3
3
|
import './style/index';
|
|
4
|
-
declare function Table<RecordType extends
|
|
4
|
+
declare function Table<RecordType extends Record<string, unknown>>(props: ITableProps<RecordType>, ref?: React.Ref<unknown>): ReactElement;
|
|
5
5
|
declare const _default: typeof Table;
|
|
6
6
|
export default _default;
|
package/dist/Table/Table.js
CHANGED
|
@@ -34,7 +34,6 @@ import { useTimeoutLock } from "./hooks/useFrame";
|
|
|
34
34
|
import "./style/index";
|
|
35
35
|
import { getColumnsWidthMap, getValidScrollThreshold } from "./utils";
|
|
36
36
|
var tableHeadRowHeight = 44;
|
|
37
|
-
var SCROLLBAR_SIZE = 15;
|
|
38
37
|
var ZERO = 0;
|
|
39
38
|
|
|
40
39
|
function Table(props, ref) {
|
|
@@ -2,7 +2,7 @@ import React, { MutableRefObject } from 'react';
|
|
|
2
2
|
import { HeaderGroup, SortingRule } from 'react-table';
|
|
3
3
|
import { ISort, TSortOrder } from '../../interface';
|
|
4
4
|
import { IWidthDetail } from '../../utils';
|
|
5
|
-
interface ITableWithoutHeightProps<T extends
|
|
5
|
+
interface ITableWithoutHeightProps<T extends Record<string, unknown>> {
|
|
6
6
|
headerGroups: HeaderGroup<T>[];
|
|
7
7
|
canResizeColumn?: boolean;
|
|
8
8
|
defaultSort?: ISort<T>;
|
|
@@ -19,5 +19,5 @@ interface ITableWithoutHeightProps<T extends object = {}> {
|
|
|
19
19
|
columnsWidthMapRef: MutableRefObject<Map<string, IWidthDetail> | undefined>;
|
|
20
20
|
columnsTotalWidthRef: MutableRefObject<number>;
|
|
21
21
|
}
|
|
22
|
-
declare function TableHead<T extends
|
|
22
|
+
declare function TableHead<T extends Record<string, unknown>>(props: ITableWithoutHeightProps<T>): JSX.Element;
|
|
23
23
|
export default TableHead;
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
var _excluded = ["style"];
|
|
2
|
-
|
|
3
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
2
|
|
|
5
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
6
|
-
|
|
7
|
-
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; }
|
|
8
|
-
|
|
9
3
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
4
|
|
|
11
5
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -195,11 +189,10 @@ function TableHead(props) {
|
|
|
195
189
|
|
|
196
190
|
|
|
197
191
|
var adjustColumnsMapAfterDrag = function adjustColumnsMapAfterDrag(key, width) {
|
|
198
|
-
var _columnsWidthMapRef$c, _columnsWidthMapRef$c2;
|
|
199
|
-
|
|
200
|
-
var newMap = _.cloneDeep(columnsWidthMapRef.current);
|
|
192
|
+
var _$cloneDeep, _columnsWidthMapRef$c, _columnsWidthMapRef$c2, _columnsWidthMapRef$c3;
|
|
201
193
|
|
|
202
|
-
var
|
|
194
|
+
var newMap = (_$cloneDeep = _.cloneDeep(columnsWidthMapRef.current)) !== null && _$cloneDeep !== void 0 ? _$cloneDeep : new Map();
|
|
195
|
+
var originWidth = (_columnsWidthMapRef$c = (_columnsWidthMapRef$c2 = columnsWidthMapRef.current) === null || _columnsWidthMapRef$c2 === void 0 ? void 0 : (_columnsWidthMapRef$c3 = _columnsWidthMapRef$c2.get(key)) === null || _columnsWidthMapRef$c3 === void 0 ? void 0 : _columnsWidthMapRef$c3.width) !== null && _columnsWidthMapRef$c !== void 0 ? _columnsWidthMapRef$c : 0;
|
|
203
196
|
var newWidth = getValidWidthByNumber(width);
|
|
204
197
|
newMap.set(key, {
|
|
205
198
|
isSpecific: true,
|
|
@@ -210,14 +203,14 @@ function TableHead(props) {
|
|
|
210
203
|
};
|
|
211
204
|
|
|
212
205
|
var handleStyleAndReturn = function handleStyleAndReturn(column, index) {
|
|
213
|
-
var
|
|
206
|
+
var _columnsWidthMapRef$c4, _columnsWidthMapRef$c5, _getHeaderProps$style, _getHeaderProps$style2;
|
|
214
207
|
|
|
215
208
|
var key = index.toString();
|
|
216
|
-
var lastColumnsMapWidth = (
|
|
209
|
+
var lastColumnsMapWidth = (_columnsWidthMapRef$c4 = columnsWidthMapRef.current) === null || _columnsWidthMapRef$c4 === void 0 ? void 0 : (_columnsWidthMapRef$c5 = _columnsWidthMapRef$c4.get(key)) === null || _columnsWidthMapRef$c5 === void 0 ? void 0 : _columnsWidthMapRef$c5.width; // Optional chaining to handle undefined
|
|
217
210
|
|
|
218
|
-
var currentRenderWidth = Number((_getHeaderProps$style = getHeaderProps(column).style) === null || _getHeaderProps$style === void 0 ? void 0 : (_getHeaderProps$style2 = _getHeaderProps$style.width) === null || _getHeaderProps$style2 === void 0 ? void 0 : _getHeaderProps$style2.toString().replace('px', '')); //
|
|
211
|
+
var currentRenderWidth = Number((_getHeaderProps$style = getHeaderProps(column).style) === null || _getHeaderProps$style === void 0 ? void 0 : (_getHeaderProps$style2 = _getHeaderProps$style.width) === null || _getHeaderProps$style2 === void 0 ? void 0 : _getHeaderProps$style2.toString().replace('px', '')); // Table's internal calculated width in 'px'
|
|
219
212
|
|
|
220
|
-
if (currentRenderWidth !== lastColumnsMapWidth) {
|
|
213
|
+
if (lastColumnsMapWidth !== undefined && currentRenderWidth !== lastColumnsMapWidth) {
|
|
221
214
|
adjustColumnsMapAfterDrag(key, currentRenderWidth);
|
|
222
215
|
}
|
|
223
216
|
|
|
@@ -234,10 +227,10 @@ function TableHead(props) {
|
|
|
234
227
|
}
|
|
235
228
|
}, headerGroups.map(function (headerGroup) {
|
|
236
229
|
var _headerGroup$getHeade = headerGroup.getHeaderGroupProps(),
|
|
237
|
-
|
|
238
|
-
headerGroupProps = _objectWithoutProperties(_headerGroup$getHeade, _excluded);
|
|
230
|
+
headerGroupProps = Object.assign({}, _headerGroup$getHeade);
|
|
239
231
|
|
|
240
232
|
return /*#__PURE__*/React.createElement("div", _extends({}, headerGroupProps, {
|
|
233
|
+
key: headerGroupProps.key,
|
|
241
234
|
className: "".concat(prefixCls, "-row")
|
|
242
235
|
}), headerGroup.headers.map(function (column, index) {
|
|
243
236
|
var barProps = canResizeColumn ? column.getResizerProps() : {};
|
package/dist/Table/utils.js
CHANGED
|
@@ -83,9 +83,9 @@ export function getColumnsWidthMap(columns, clientWidth, lastWidthMap // 容器
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
if (lastWidthMap && isSpecific) {
|
|
86
|
-
var _lastWidthMap$get2;
|
|
86
|
+
var _lastWidthMap$get$wid, _lastWidthMap$get2;
|
|
87
87
|
|
|
88
|
-
width = (_lastWidthMap$get2 = lastWidthMap.get(key)) === null || _lastWidthMap$get2 === void 0 ? void 0 : _lastWidthMap$get2.width;
|
|
88
|
+
width = (_lastWidthMap$get$wid = (_lastWidthMap$get2 = lastWidthMap.get(key)) === null || _lastWidthMap$get2 === void 0 ? void 0 : _lastWidthMap$get2.width) !== null && _lastWidthMap$get$wid !== void 0 ? _lastWidthMap$get$wid : width;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
if (width === NOT_SET) {
|
|
@@ -96,16 +96,16 @@ export function getColumnsWidthMap(columns, clientWidth, lastWidthMap // 容器
|
|
|
96
96
|
|
|
97
97
|
widthMap.set(key, {
|
|
98
98
|
width: width,
|
|
99
|
-
isSpecific: isSpecific
|
|
99
|
+
isSpecific: Boolean(isSpecific)
|
|
100
100
|
});
|
|
101
101
|
}); // 设定宽度大于容器宽度时
|
|
102
102
|
|
|
103
103
|
if (settedTotalWidth < clientWidth) {
|
|
104
104
|
unsetWidthIndex.map(function (item) {
|
|
105
|
-
var _widthMap$get;
|
|
105
|
+
var _widthMap$get$isSpeci, _widthMap$get;
|
|
106
106
|
|
|
107
107
|
return widthMap.set(item, {
|
|
108
|
-
isSpecific: (_widthMap$get = widthMap.get(item)) === null || _widthMap$get === void 0 ? void 0 : _widthMap$get.isSpecific,
|
|
108
|
+
isSpecific: (_widthMap$get$isSpeci = (_widthMap$get = widthMap.get(item)) === null || _widthMap$get === void 0 ? void 0 : _widthMap$get.isSpecific) !== null && _widthMap$get$isSpeci !== void 0 ? _widthMap$get$isSpeci : false,
|
|
109
109
|
width: COLUMN_MIN_WIDTH
|
|
110
110
|
});
|
|
111
111
|
});
|
|
@@ -116,10 +116,10 @@ export function getColumnsWidthMap(columns, clientWidth, lastWidthMap // 容器
|
|
|
116
116
|
var leftWidth = clientWidth - settedTotalWidth;
|
|
117
117
|
var average = getValidWidthByNumber(leftWidth / unsetWidthIndex.length);
|
|
118
118
|
unsetWidthIndex.map(function (item) {
|
|
119
|
-
var _widthMap$get2;
|
|
119
|
+
var _widthMap$get$isSpeci2, _widthMap$get2;
|
|
120
120
|
|
|
121
121
|
return widthMap.set(item, {
|
|
122
|
-
isSpecific: (_widthMap$get2 = widthMap.get(item)) === null || _widthMap$get2 === void 0 ? void 0 : _widthMap$get2.isSpecific,
|
|
122
|
+
isSpecific: (_widthMap$get$isSpeci2 = (_widthMap$get2 = widthMap.get(item)) === null || _widthMap$get2 === void 0 ? void 0 : _widthMap$get2.isSpecific) !== null && _widthMap$get$isSpeci2 !== void 0 ? _widthMap$get$isSpeci2 : false,
|
|
123
123
|
width: average
|
|
124
124
|
});
|
|
125
125
|
});
|
|
@@ -130,7 +130,10 @@ export function getColumnsWidthMap(columns, clientWidth, lastWidthMap // 容器
|
|
|
130
130
|
|
|
131
131
|
var key = index.toString();
|
|
132
132
|
var width = (_widthMap$get3 = widthMap.get(key)) === null || _widthMap$get3 === void 0 ? void 0 : _widthMap$get3.width;
|
|
133
|
-
|
|
133
|
+
|
|
134
|
+
if (width !== undefined) {
|
|
135
|
+
totalColumnWidth += width;
|
|
136
|
+
}
|
|
134
137
|
});
|
|
135
138
|
return {
|
|
136
139
|
columnsWidthMap: widthMap,
|
package/dist/Tree/index.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ import { BasicDataNode } from 'rc-tree/lib/interface';
|
|
|
5
5
|
import React, { ForwardedRef } from 'react';
|
|
6
6
|
export type { DataNode, EventDataNode } from 'antd/lib/tree';
|
|
7
7
|
export type { DirectoryTreeProps, ExpandAction as DirectoryTreeExpandAction, } from 'antd/lib/tree/DirectoryTree';
|
|
8
|
-
export type {
|
|
9
|
-
declare type TreeProps<T extends BasicDataNode = DataNode> = Omit<AntdTreeProps<T>, 'switcherIcon'>;
|
|
8
|
+
export type { AntTreeNode, AntTreeNodeMouseEvent, AntTreeNodeExpandedEvent, AntTreeNodeCheckedEvent, AntTreeNodeSelectedEvent, AntdTreeNodeAttribute, AntTreeNodeProps, };
|
|
9
|
+
export declare type TreeProps<T extends BasicDataNode = DataNode> = Omit<AntdTreeProps<T>, 'switcherIcon'>;
|
|
10
10
|
declare const _default: <T extends BasicDataNode = DataNode>(props: TreeProps<T> & {
|
|
11
11
|
ref?: React.ForwardedRef<RcTree<DataNode>> | undefined;
|
|
12
12
|
}) => React.ReactElement;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { MenuClickEventHandler } from 'rc-menu/lib/interface';
|
|
2
|
+
export { default as AldTable } from './AldTable';
|
|
3
|
+
export type { ITableColumn, ITableProps as IAldTableProps, } from './AldTable/types';
|
|
2
4
|
export { default as Alert } from './Alert';
|
|
3
5
|
export type { AlertProps } from './Alert';
|
|
4
6
|
export { default as App } from './App';
|
|
@@ -55,6 +57,7 @@ export type { ModalFuncProps, ModalProps } from './Modal';
|
|
|
55
57
|
export { default as Navigator } from './Navigator';
|
|
56
58
|
export type { IMenuItem as NavigatorMenu, INavigatorProps as NavigatorProps, ISelectedMenuInfo as SelectedMenuInfo, } from './Navigator';
|
|
57
59
|
export { default as notification } from './notification';
|
|
60
|
+
export { default as Pagination } from './Pagination';
|
|
58
61
|
export { default as Popconfirm } from './Popconfirm';
|
|
59
62
|
export type { PopconfirmProps } from './Popconfirm';
|
|
60
63
|
export { default as Popover } from './Popover';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// / <reference path="../typings.d.ts" />
|
|
2
2
|
export { MenuClickEventHandler } from 'rc-menu/lib/interface';
|
|
3
|
+
export { default as AldTable } from "./AldTable";
|
|
3
4
|
export { default as Alert } from "./Alert";
|
|
4
5
|
export { default as App } from "./App";
|
|
5
6
|
export { default as AProgress } from "./AProgress";
|
|
@@ -32,6 +33,7 @@ export { default as message } from "./message"; // alias, keep API the same as a
|
|
|
32
33
|
export { default as Modal } from "./Modal";
|
|
33
34
|
export { default as Navigator } from "./Navigator";
|
|
34
35
|
export { default as notification } from "./notification";
|
|
36
|
+
export { default as Pagination } from "./Pagination";
|
|
35
37
|
export { default as Popconfirm } from "./Popconfirm";
|
|
36
38
|
export { default as Popover } from "./Popover";
|
|
37
39
|
export { default as Progress } from "./Progress";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aloudata/aloudata-design",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
"@testing-library/react": "^13.4.0",
|
|
82
82
|
"@types/jest": "^29.4.0",
|
|
83
83
|
"@types/lodash": "^4.14.191",
|
|
84
|
+
"@types/react-table": "^7.7.14",
|
|
84
85
|
"@umijs/lint": "^4.0.0",
|
|
85
86
|
"babel-jest": "^29.4.2",
|
|
86
87
|
"babel-plugin-import": "^1.13.5",
|