@aloudata/aloudata-design 0.4.0-beta.6 → 0.4.0-beta.8
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/Button/index.d.ts +1 -1
- package/es/Button/index.js +3 -8
- package/es/Button/style/index.less +7 -1
- 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 -12
- 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/Icon/icons.js +135 -58
- 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/Steps/style/index.less +10 -4
- package/es/Table/Table.js +31 -23
- 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 +1 -0
- package/es/Table/style/index.less +2 -1
- package/es/Table/utils.js +16 -9
- package/es/Tabs/style/index.less +1 -1
- package/es/Tooltip/style/index.less +1 -1
- package/es/index.d.ts +3 -3
- package/es/style/themes/default/scrollBar.less +10 -7
- package/es/style/themes/default/themeColor.module.less +164 -166
- 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/Button/index.d.ts +1 -1
- package/lib/Button/index.js +3 -8
- package/lib/Button/style/index.less +7 -1
- 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 -12
- 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/Icon/icons.js +135 -58
- 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/Steps/style/index.less +10 -4
- package/lib/Table/Table.js +31 -23
- 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 +1 -0
- package/lib/Table/style/index.less +2 -1
- package/lib/Table/utils.js +16 -9
- package/lib/Tabs/style/index.less +1 -1
- package/lib/Tooltip/style/index.less +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/style/themes/default/scrollBar.less +10 -7
- package/lib/style/themes/default/themeColor.module.less +164 -166
- package/package.json +2 -2
- package/es/Table/hooks/useTableColumn.d.ts +0 -28
- package/es/Table/hooks/useTableColumn.js +0 -53
- package/lib/Table/hooks/useTableColumn.d.ts +0 -28
- package/lib/Table/hooks/useTableColumn.js +0 -66
package/es/Table/Table.js
CHANGED
|
@@ -62,12 +62,12 @@ function Table(props, ref) {
|
|
|
62
62
|
rowKey = props.rowKey,
|
|
63
63
|
height = props.height;
|
|
64
64
|
|
|
65
|
-
var _useState = useState(
|
|
65
|
+
var _useState = useState(undefined),
|
|
66
66
|
_useState2 = _slicedToArray(_useState, 2),
|
|
67
67
|
tableClientWidth = _useState2[0],
|
|
68
68
|
setTableClientWidth = _useState2[1];
|
|
69
69
|
|
|
70
|
-
var _useState3 = useState(
|
|
70
|
+
var _useState3 = useState(undefined),
|
|
71
71
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
72
72
|
tableClientHeight = _useState4[0],
|
|
73
73
|
setTableClientHeight = _useState4[1];
|
|
@@ -76,7 +76,6 @@ function Table(props, ref) {
|
|
|
76
76
|
var tableRef = useRef(null);
|
|
77
77
|
var tableHeadRef = useRef(null);
|
|
78
78
|
var tableBodyRef = useRef(null);
|
|
79
|
-
var columnsRef = useRef([]);
|
|
80
79
|
var columnsWidthMapRef = useRef();
|
|
81
80
|
var columnsTotalWidthRef = useRef(ZERO);
|
|
82
81
|
|
|
@@ -91,12 +90,7 @@ function Table(props, ref) {
|
|
|
91
90
|
var _useTimeoutLock = useTimeoutLock(),
|
|
92
91
|
_useTimeoutLock2 = _slicedToArray(_useTimeoutLock, 2),
|
|
93
92
|
setScrollTarget = _useTimeoutLock2[0],
|
|
94
|
-
getScrollTarget = _useTimeoutLock2[1]; //
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
if (columns && columnsRef.current.length === ZERO) {
|
|
98
|
-
columnsRef.current = columns;
|
|
99
|
-
} // 初始化进入时 渲染表格容器宽度
|
|
93
|
+
getScrollTarget = _useTimeoutLock2[1]; // 初始化进入时 渲染表格容器宽度
|
|
100
94
|
|
|
101
95
|
|
|
102
96
|
useEffect(function () {
|
|
@@ -106,13 +100,17 @@ function Table(props, ref) {
|
|
|
106
100
|
}, []); // 转换外部传入的columns
|
|
107
101
|
|
|
108
102
|
var newColumns = useMemo(function () {
|
|
109
|
-
|
|
103
|
+
if (!tableClientWidth) {
|
|
104
|
+
return [];
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
var _getColumnsWidthMap = getColumnsWidthMap(columns, tableClientWidth, columnsWidthMapRef.current),
|
|
110
108
|
columnsWidthMap = _getColumnsWidthMap.columnsWidthMap,
|
|
111
109
|
totalColumnWidth = _getColumnsWidthMap.totalColumnWidth;
|
|
112
110
|
|
|
113
111
|
columnsWidthMapRef.current = columnsWidthMap;
|
|
114
112
|
columnsTotalWidthRef.current = totalColumnWidth;
|
|
115
|
-
return
|
|
113
|
+
return columns.map(function (column, index) {
|
|
116
114
|
var _columnsWidthMapRef$c, _columnsWidthMapRef$c2;
|
|
117
115
|
|
|
118
116
|
var key = index.toString(); // 不设置dataIndex同时进行排序 则报错
|
|
@@ -135,7 +133,7 @@ function Table(props, ref) {
|
|
|
135
133
|
}
|
|
136
134
|
});
|
|
137
135
|
});
|
|
138
|
-
}, [sortable, tableClientWidth]); // 将rowId转为React Table支持的值
|
|
136
|
+
}, [columns, sortable, tableClientWidth]); // 将rowId转为React Table支持的值
|
|
139
137
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
140
138
|
|
|
141
139
|
var transformRowId = function transformRowId(row, relativeIndex, parent) {
|
|
@@ -161,7 +159,9 @@ function Table(props, ref) {
|
|
|
161
159
|
|
|
162
160
|
|
|
163
161
|
var getTableInitSort = function getTableInitSort() {
|
|
164
|
-
|
|
162
|
+
var EMPTY_SIZE = 0;
|
|
163
|
+
|
|
164
|
+
if (!sortable || loadMore || newColumns.length === EMPTY_SIZE) {
|
|
165
165
|
return [];
|
|
166
166
|
}
|
|
167
167
|
|
|
@@ -216,7 +216,7 @@ function Table(props, ref) {
|
|
|
216
216
|
var tableHeadNode = /*#__PURE__*/React.createElement(TableHead, {
|
|
217
217
|
canResizeColumn: resizeColumn,
|
|
218
218
|
headerGroups: headerGroups,
|
|
219
|
-
tableContentWidth
|
|
219
|
+
// tableContentWidth={columnsTotalWidthRef.current}
|
|
220
220
|
defaultSort: defaultSort,
|
|
221
221
|
sortable: sortable,
|
|
222
222
|
columns: newColumns,
|
|
@@ -275,6 +275,10 @@ function Table(props, ref) {
|
|
|
275
275
|
}, []); // 内部滚动时 纵向的滚动
|
|
276
276
|
|
|
277
277
|
var onBodyVerticalScroll = useCallback(function (target) {
|
|
278
|
+
if (!tableClientHeight) {
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
|
|
278
282
|
var scrollHeight = target.scrollHeight,
|
|
279
283
|
clientHeight = target.clientHeight,
|
|
280
284
|
scrollTop = target.scrollTop;
|
|
@@ -328,6 +332,10 @@ function Table(props, ref) {
|
|
|
328
332
|
}, [hasNextPage]); // 渲染有设置高度的表格
|
|
329
333
|
|
|
330
334
|
var renderTableWithHeight = function renderTableWithHeight() {
|
|
335
|
+
if (!tableClientWidth || !tableClientHeight) {
|
|
336
|
+
return null;
|
|
337
|
+
}
|
|
338
|
+
|
|
331
339
|
var renderNoHeightTableBody = function renderNoHeightTableBody() {
|
|
332
340
|
if (loading && !rows.length) {
|
|
333
341
|
return /*#__PURE__*/React.createElement(Loading, null);
|
|
@@ -358,21 +366,21 @@ function Table(props, ref) {
|
|
|
358
366
|
}), renderNoHeightTableBody()));
|
|
359
367
|
};
|
|
360
368
|
|
|
361
|
-
return /*#__PURE__*/React.createElement(
|
|
362
|
-
onResize: function onResize(_ref2) {
|
|
363
|
-
var clientWidth = _ref2.width,
|
|
364
|
-
clientHeight = _ref2.height;
|
|
365
|
-
setTableClientWidth(clientWidth);
|
|
366
|
-
setTableClientHeight(clientHeight);
|
|
367
|
-
}
|
|
368
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
369
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
369
370
|
key: tableKey,
|
|
370
371
|
className: prefixCls,
|
|
371
372
|
ref: tableRef,
|
|
372
373
|
style: {
|
|
373
374
|
height: !height ? 'unset' : height
|
|
374
375
|
}
|
|
375
|
-
}, /*#__PURE__*/React.createElement(
|
|
376
|
+
}, /*#__PURE__*/React.createElement(ResizeObserver, {
|
|
377
|
+
onResize: function onResize(_ref2) {
|
|
378
|
+
var clientWidth = _ref2.width,
|
|
379
|
+
clientHeight = _ref2.height;
|
|
380
|
+
setTableClientWidth(clientWidth);
|
|
381
|
+
setTableClientHeight(clientHeight);
|
|
382
|
+
}
|
|
383
|
+
}, !tableClientWidth ? null : /*#__PURE__*/React.createElement("div", Object.assign({}, getTableProps(), {
|
|
376
384
|
className: classnames("".concat(prefixCls, "-table-wrap"), (_classnames3 = {}, _defineProperty(_classnames3, "".concat(prefixCls, "-init-loading"), data.length === ZERO && loading), _defineProperty(_classnames3, "".concat(prefixCls, "-empty"), data.length === ZERO && loading), _classnames3))
|
|
377
385
|
}), height ? renderTableWithHeight() : renderTableWithoutHeight())));
|
|
378
386
|
}
|
|
@@ -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,6 +11,7 @@ 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'>;
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
&-tableHeadScrollWrap {
|
|
33
|
+
display: flex;
|
|
33
34
|
width: 100%;
|
|
34
35
|
overflow-x: hidden;
|
|
35
36
|
}
|
|
@@ -37,7 +38,7 @@
|
|
|
37
38
|
&-cell {
|
|
38
39
|
flex-grow: 1;
|
|
39
40
|
height: unset;
|
|
40
|
-
color:
|
|
41
|
+
color: inherit;
|
|
41
42
|
text-align: left;
|
|
42
43
|
word-break: break-all;
|
|
43
44
|
border-bottom: 1px solid @NL95;
|
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/style/index.less
CHANGED
package/es/index.d.ts
CHANGED
|
@@ -55,18 +55,18 @@ export { default as Steps } from './Steps';
|
|
|
55
55
|
export { default as Form } from './Form';
|
|
56
56
|
export type { FormInstance, FormProps, FormItemProps } from './Form';
|
|
57
57
|
export { default as Divider } from './Divider';
|
|
58
|
-
export type { DividerProps } from './Divider';
|
|
58
|
+
export type { IDividerProps as DividerProps } from './Divider';
|
|
59
59
|
export { default as Drawer } from './Drawer';
|
|
60
60
|
export type { DrawerProps } from './Drawer';
|
|
61
61
|
export { default as Radio } from './Radio';
|
|
62
62
|
export type { RadioProps, RadioGroupProps } from './Radio';
|
|
63
63
|
export { default as Checkbox } from './Checkbox';
|
|
64
|
-
export type { CheckboxProps, CheckboxOptionType } from './Checkbox';
|
|
64
|
+
export type { ICheckboxProps as CheckboxProps, CheckboxOptionType } from './Checkbox';
|
|
65
65
|
export { default as Modal } from './Modal';
|
|
66
66
|
export type { ModalProps, ModalFuncProps } from './Modal';
|
|
67
67
|
export { default as Popover } from './Popover';
|
|
68
68
|
export type { PopoverProps } from './Popover';
|
|
69
|
-
export type { InputNumberProps } from './InputNumber';
|
|
69
|
+
export type { IInputNumberProps as InputNumberProps } from './InputNumber';
|
|
70
70
|
export { default as InputNumber } from './InputNumber';
|
|
71
71
|
export { default as Breadcrumb } from './Breadcrumb';
|
|
72
72
|
export type { BreadcrumbProps, BreadcrumbItemProps } from './Breadcrumb';
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
&::-webkit-scrollbar {
|
|
2
|
+
width: 12px !important;
|
|
3
|
+
height: 12px !important;
|
|
4
|
+
opacity: 0.5;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
&::-webkit-scrollbar-thumb {
|
|
8
|
+
background-color: rgba(152, 162, 179, 0.5);
|
|
4
9
|
border: 3px solid transparent;
|
|
5
10
|
border-radius: 6px;
|
|
11
|
+
background-clip: padding-box;
|
|
6
12
|
}
|
|
7
13
|
|
|
8
|
-
|
|
9
|
-
width: 12px;
|
|
10
|
-
height: 12px;
|
|
11
|
-
min-height: 12px;
|
|
14
|
+
&::-webkit-scrollbar-track {
|
|
12
15
|
background-color: transparent;
|
|
13
16
|
}
|