@aloudata/aloudata-design 0.3.3 → 0.3.4
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/Breadcrumb/index.d.ts +1 -0
- package/es/Checkbox/index.d.ts +1 -0
- package/es/ConfigProvider/defaultRenderEmpty.d.ts +4 -0
- package/es/ConfigProvider/defaultRenderEmpty.js +37 -0
- package/es/ConfigProvider/sizeContext.d.ts +9 -0
- package/es/ConfigProvider/sizeContext.js +12 -0
- package/es/Empty/image/Authority.d.ts +1 -0
- package/es/Empty/image/Dataspace.d.ts +1 -0
- package/es/Empty/image/Search.d.ts +1 -0
- package/es/Empty/image/Simple.d.ts +1 -0
- package/es/Empty/image/Worksheet.d.ts +1 -0
- package/es/Empty/image/empty.d.ts +1 -0
- package/es/Input/components/Group/index.d.ts +1 -0
- package/es/Input/components/Input/index.d.ts +1 -1
- package/es/Input/components/Input/index.js +0 -1
- package/es/Input/components/TextArea/index.d.ts +8 -1
- package/es/Input/components/TextArea/index.js +8 -1
- package/es/Input/style/index.less +78 -0
- package/es/InputNumber/index.d.ts +1 -0
- package/es/Menu/Divider.d.ts +1 -0
- package/es/Modal/style/index.less +3 -0
- package/es/Navigator/components/Header/index.d.ts +1 -0
- package/es/Navigator/components/Menu/index.d.ts +1 -0
- package/es/Popover/index.d.ts +1 -0
- package/es/Radio/components/Group/index.d.ts +6 -0
- package/es/Radio/components/Group/index.js +72 -0
- package/es/Radio/components/Radio/index.d.ts +3 -0
- package/es/Radio/components/Radio/index.js +95 -0
- package/es/Radio/index.d.ts +9 -2
- package/es/Radio/index.js +5 -3
- package/es/Radio/interface/radio.d.ts +24 -0
- package/es/Radio/interface/radio.js +1 -0
- package/es/Radio/interface/radioGroup.d.ts +42 -0
- package/es/Radio/interface/radioGroup.js +1 -0
- package/es/Radio/style/index.less +348 -0
- package/es/Select/index.js +1 -1
- package/es/Select/style/index.less +1 -0
- package/es/Steps/components/ProcessIcon/index.d.ts +1 -0
- package/es/Table/Table.d.ts +2 -1
- package/es/Table/Table.js +223 -330
- package/es/Table/components/Empty/index.d.ts +3 -0
- package/es/Table/components/Empty/index.js +17 -0
- package/es/Table/components/Loading/index.d.ts +3 -0
- package/es/Table/components/Loading/index.js +19 -0
- package/es/Table/components/TableBodyRowList/index.d.ts +13 -0
- package/es/Table/components/TableBodyRowList/index.js +89 -0
- package/es/Table/components/TableHead/index.d.ts +23 -0
- package/es/Table/components/TableHead/index.js +262 -0
- package/es/Table/constant.d.ts +1 -0
- package/es/Table/constant.js +1 -0
- package/es/Table/hooks/useFrame.d.ts +7 -0
- package/es/Table/hooks/useFrame.js +90 -0
- package/es/Table/hooks/useTableColumn.d.ts +28 -0
- package/es/Table/hooks/useTableColumn.js +53 -0
- package/es/Table/interface.d.ts +3 -2
- package/es/Table/style/index.less +33 -30
- package/es/Table/utils.d.ts +15 -0
- package/es/Table/utils.js +131 -0
- package/es/_utils/hooks/useId.d.ts +4 -0
- package/es/_utils/hooks/useId.js +23 -0
- package/es/index.d.ts +1 -1
- package/es/locale-provider/index.d.ts +5 -1
- package/es/style/index.d.ts +0 -1
- package/es/style/index.js +0 -1
- package/es/style/index.less +2 -2
- package/lib/Breadcrumb/index.d.ts +1 -0
- package/lib/Checkbox/index.d.ts +1 -0
- package/lib/ConfigProvider/defaultRenderEmpty.d.ts +4 -0
- package/lib/ConfigProvider/defaultRenderEmpty.js +55 -0
- package/lib/ConfigProvider/sizeContext.d.ts +9 -0
- package/lib/ConfigProvider/sizeContext.js +30 -0
- package/lib/Empty/image/Authority.d.ts +1 -0
- package/lib/Empty/image/Dataspace.d.ts +1 -0
- package/lib/Empty/image/Search.d.ts +1 -0
- package/lib/Empty/image/Simple.d.ts +1 -0
- package/lib/Empty/image/Worksheet.d.ts +1 -0
- package/lib/Empty/image/empty.d.ts +1 -0
- package/lib/Input/components/Group/index.d.ts +1 -0
- package/lib/Input/components/Input/index.d.ts +1 -1
- package/lib/Input/components/Input/index.js +0 -1
- package/lib/Input/components/TextArea/index.d.ts +8 -1
- package/lib/Input/components/TextArea/index.js +10 -1
- package/lib/Input/style/index.less +78 -0
- package/lib/InputNumber/index.d.ts +1 -0
- package/lib/Menu/Divider.d.ts +1 -0
- package/lib/Modal/style/index.less +3 -0
- package/lib/Navigator/components/Header/index.d.ts +1 -0
- package/lib/Navigator/components/Menu/index.d.ts +1 -0
- package/lib/Popover/index.d.ts +1 -0
- package/lib/Radio/components/Group/index.d.ts +6 -0
- package/lib/Radio/components/Group/index.js +93 -0
- package/lib/Radio/components/Radio/index.d.ts +3 -0
- package/lib/Radio/components/Radio/index.js +115 -0
- package/lib/Radio/index.d.ts +9 -2
- package/lib/Radio/index.js +5 -3
- package/lib/Radio/interface/radio.d.ts +24 -0
- package/lib/Radio/interface/radio.js +5 -0
- package/lib/Radio/interface/radioGroup.d.ts +42 -0
- package/lib/Radio/interface/radioGroup.js +5 -0
- package/lib/Radio/style/index.less +348 -0
- package/lib/Select/index.js +1 -1
- package/lib/Select/style/index.less +1 -0
- package/lib/Steps/components/ProcessIcon/index.d.ts +1 -0
- package/lib/Table/Table.d.ts +2 -1
- package/lib/Table/Table.js +228 -332
- package/lib/Table/components/Empty/index.d.ts +3 -0
- package/lib/Table/components/Empty/index.js +30 -0
- package/lib/Table/components/Loading/index.d.ts +3 -0
- package/lib/Table/components/Loading/index.js +33 -0
- package/lib/Table/components/TableBodyRowList/index.d.ts +13 -0
- package/lib/Table/components/TableBodyRowList/index.js +108 -0
- package/lib/Table/components/TableHead/index.d.ts +23 -0
- package/lib/Table/components/TableHead/index.js +286 -0
- package/lib/Table/constant.d.ts +1 -0
- package/lib/Table/constant.js +1 -0
- package/lib/Table/hooks/useFrame.d.ts +7 -0
- package/lib/Table/hooks/useFrame.js +98 -0
- package/lib/Table/hooks/useTableColumn.d.ts +28 -0
- package/lib/Table/hooks/useTableColumn.js +66 -0
- package/lib/Table/interface.d.ts +3 -2
- package/lib/Table/style/index.less +33 -30
- package/lib/Table/utils.d.ts +15 -0
- package/lib/Table/utils.js +147 -0
- package/lib/_utils/hooks/useId.d.ts +4 -0
- package/lib/_utils/hooks/useId.js +36 -0
- package/lib/index.d.ts +1 -1
- package/lib/locale-provider/index.d.ts +5 -1
- package/lib/style/index.d.ts +0 -1
- package/lib/style/index.js +0 -2
- package/lib/style/index.less +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
var _utils = require("../utils");
|
|
11
|
+
|
|
12
|
+
var _message = _interopRequireDefault(require("../../message"));
|
|
13
|
+
|
|
14
|
+
require("react-table/node_modules/@types/react");
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
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; }
|
|
19
|
+
|
|
20
|
+
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; }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
function useTableColumn(props) {
|
|
25
|
+
var columnsWidthMapRef = props.columnsWidthMapRef,
|
|
26
|
+
columnsTotalWidthRef = props.columnsTotalWidthRef,
|
|
27
|
+
columnsRef = props.columnsRef,
|
|
28
|
+
tableClientWidth = props.tableClientWidth,
|
|
29
|
+
sortable = props.sortable; // 转换外部传入的columns
|
|
30
|
+
|
|
31
|
+
var newColumns = (0, _react.useMemo)(function () {
|
|
32
|
+
var _getColumnsWidthMap = (0, _utils.getColumnsWidthMap)(columnsRef.current, tableClientWidth, columnsWidthMapRef.current),
|
|
33
|
+
columnsWidthMap = _getColumnsWidthMap.columnsWidthMap,
|
|
34
|
+
totalColumnWidth = _getColumnsWidthMap.totalColumnWidth;
|
|
35
|
+
|
|
36
|
+
columnsWidthMapRef.current = columnsWidthMap;
|
|
37
|
+
columnsTotalWidthRef.current = totalColumnWidth;
|
|
38
|
+
return columnsRef.current.map(function (column, index) {
|
|
39
|
+
var _columnsWidthMapRef$c, _columnsWidthMapRef$c2;
|
|
40
|
+
|
|
41
|
+
var key = index.toString(); // 不设置dataIndex同时进行排序 则报错
|
|
42
|
+
|
|
43
|
+
if (!column.dataIndex === undefined && sortable) {
|
|
44
|
+
_message.default.error('不支持未设置dataIndex时进行排序设置');
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return _objectSpread(_objectSpread({}, column), {}, {
|
|
48
|
+
width: (_columnsWidthMapRef$c = columnsWidthMapRef.current) === null || _columnsWidthMapRef$c === void 0 ? void 0 : (_columnsWidthMapRef$c2 = _columnsWidthMapRef$c.get(key)) === null || _columnsWidthMapRef$c2 === void 0 ? void 0 : _columnsWidthMapRef$c2.width,
|
|
49
|
+
Header: column.title ? column.title : function () {
|
|
50
|
+
return null;
|
|
51
|
+
},
|
|
52
|
+
disableSortBy: !sortable || typeof column.sorter === 'boolean',
|
|
53
|
+
accessor: column.dataIndex,
|
|
54
|
+
Cell: function Cell(_ref) {
|
|
55
|
+
var row = _ref.row,
|
|
56
|
+
value = _ref.value;
|
|
57
|
+
return typeof column.render === 'function' ? column.render(value, row.original, row.index) : value;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
}, [columnsRef, columnsTotalWidthRef, columnsWidthMapRef, sortable, tableClientWidth]);
|
|
62
|
+
return newColumns;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
var _default = useTableColumn;
|
|
66
|
+
exports.default = _default;
|
package/lib/Table/interface.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface IColumn<RecordType> {
|
|
|
9
9
|
title: string | null;
|
|
10
10
|
dataIndex: string;
|
|
11
11
|
render?: (value: any, row: RecordType, index: number) => React.ReactNode;
|
|
12
|
-
width?: number;
|
|
12
|
+
width?: number | string;
|
|
13
13
|
minWidth?: number;
|
|
14
14
|
sorter?: boolean | 'string' | 'number' | 'basic' | 'datetime' | 'alphanumeric';
|
|
15
15
|
sortOrder?: TSortOrder;
|
|
@@ -20,7 +20,7 @@ export interface ITableProps<RecordType> {
|
|
|
20
20
|
columns: IColumn<RecordType>[];
|
|
21
21
|
data: RecordType[];
|
|
22
22
|
onRowSelected?: (row: RecordType) => void;
|
|
23
|
-
loadMore?: () =>
|
|
23
|
+
loadMore?: () => Promise<void>;
|
|
24
24
|
hasNextPage?: boolean;
|
|
25
25
|
loading?: boolean;
|
|
26
26
|
sortable?: boolean;
|
|
@@ -29,6 +29,7 @@ export interface ITableProps<RecordType> {
|
|
|
29
29
|
sortDirections?: Array<'ascend' | 'descend'>;
|
|
30
30
|
resizeColumn?: boolean;
|
|
31
31
|
showHeader?: boolean;
|
|
32
|
+
height?: string | number;
|
|
32
33
|
innerScroll?: boolean;
|
|
33
34
|
ref?: React.RefObject<unknown>;
|
|
34
35
|
scrollThreshold?: string | number;
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
@import '../../style/index.less';
|
|
2
2
|
@import '../../Empty/style/index.less';
|
|
3
|
+
@import '../../message/style/index.less';
|
|
4
|
+
|
|
3
5
|
@ald-iconfont-css-prefix: anticon;
|
|
4
|
-
@table-row-height: 48px;
|
|
6
|
+
@table-head-row-height: 48px;
|
|
7
|
+
@table-body-row-height: 68px;
|
|
5
8
|
|
|
6
9
|
.ald-table {
|
|
7
10
|
display: flex;
|
|
8
11
|
flex-direction: column;
|
|
9
12
|
width: 100%;
|
|
10
|
-
height: 100%;
|
|
11
13
|
overflow: hidden;
|
|
14
|
+
user-select: none;
|
|
12
15
|
|
|
13
16
|
&-page-loading {
|
|
14
17
|
opacity: 0;
|
|
@@ -21,6 +24,16 @@
|
|
|
21
24
|
overflow: hidden;
|
|
22
25
|
}
|
|
23
26
|
|
|
27
|
+
&-inner-wrap {
|
|
28
|
+
width: 100%;
|
|
29
|
+
overflow-x: overlay;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&-tableHeadScrollWrap {
|
|
33
|
+
width: 100%;
|
|
34
|
+
overflow-x: hidden;
|
|
35
|
+
}
|
|
36
|
+
|
|
24
37
|
&-cell {
|
|
25
38
|
flex-grow: 1;
|
|
26
39
|
height: unset;
|
|
@@ -35,8 +48,7 @@
|
|
|
35
48
|
}
|
|
36
49
|
|
|
37
50
|
&-row {
|
|
38
|
-
|
|
39
|
-
height: 48px;
|
|
51
|
+
height: @table-head-row-height;
|
|
40
52
|
|
|
41
53
|
&-ellipsis {
|
|
42
54
|
.ald-table-cell {
|
|
@@ -48,8 +60,12 @@
|
|
|
48
60
|
}
|
|
49
61
|
|
|
50
62
|
&-thead {
|
|
63
|
+
flex: 1;
|
|
64
|
+
overflow: hidden;
|
|
65
|
+
|
|
51
66
|
.ald-table-row {
|
|
52
|
-
|
|
67
|
+
min-width: 9999px; // 防止拖动时的闪动
|
|
68
|
+
height: @table-head-row-height;
|
|
53
69
|
}
|
|
54
70
|
|
|
55
71
|
.ald-table-cell {
|
|
@@ -103,7 +119,7 @@
|
|
|
103
119
|
}
|
|
104
120
|
|
|
105
121
|
.ald-table-row {
|
|
106
|
-
height:
|
|
122
|
+
height: @table-body-row-height;
|
|
107
123
|
|
|
108
124
|
.ald-table-cell {
|
|
109
125
|
padding: 24px;
|
|
@@ -124,10 +140,18 @@
|
|
|
124
140
|
}
|
|
125
141
|
}
|
|
126
142
|
|
|
143
|
+
&-tbody&-tbody-innerScroll {
|
|
144
|
+
overflow: hidden;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
&-row-list-wrap {
|
|
148
|
+
overflow: unset;
|
|
149
|
+
}
|
|
150
|
+
|
|
127
151
|
&-loading {
|
|
128
|
-
height:
|
|
152
|
+
height: @table-body-row-height;
|
|
129
153
|
color: @NL80;
|
|
130
|
-
line-height: @table-row-height;
|
|
154
|
+
line-height: @table-body-row-height;
|
|
131
155
|
text-align: center;
|
|
132
156
|
|
|
133
157
|
&-icon {
|
|
@@ -145,6 +169,7 @@
|
|
|
145
169
|
align-items: center;
|
|
146
170
|
justify-content: center;
|
|
147
171
|
padding-top: 84px;
|
|
172
|
+
padding-bottom: 84px;
|
|
148
173
|
}
|
|
149
174
|
}
|
|
150
175
|
|
|
@@ -170,33 +195,11 @@
|
|
|
170
195
|
}
|
|
171
196
|
}
|
|
172
197
|
|
|
173
|
-
/* stylelint-disable-next-line selector-class-pattern */
|
|
174
|
-
&-list&-innerScroll {
|
|
175
|
-
height: 100%;
|
|
176
|
-
overflow: overlay !important;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
198
|
// 当出现多行的时候 会顶出一个滚动条 通过复写三方库的样式覆盖
|
|
180
199
|
&-list&-canNotInnerScroll {
|
|
181
200
|
overflow: hidden !important;
|
|
182
201
|
}
|
|
183
202
|
|
|
184
|
-
&-list {
|
|
185
|
-
&::-webkit-scrollbar-thumb {
|
|
186
|
-
background: @NL90;
|
|
187
|
-
background-clip: padding-box;
|
|
188
|
-
border: 3px solid transparent;
|
|
189
|
-
border-radius: 6px;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
&::-webkit-scrollbar {
|
|
193
|
-
width: 12px;
|
|
194
|
-
height: 12px;
|
|
195
|
-
min-height: 12px;
|
|
196
|
-
background-color: transparent;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
203
|
&-sortIcon {
|
|
201
204
|
margin-top: -2px;
|
|
202
205
|
margin-left: 4px;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IColumn } from './interface';
|
|
2
|
+
export interface IWidthDetail {
|
|
3
|
+
width: number;
|
|
4
|
+
isSpecific: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function getColumnsWidthMap<T>(columns: IColumn<T>[], clientWidth: number, lastWidthMap?: Map<string, IWidthDetail>): {
|
|
7
|
+
columnsWidthMap: Map<string, IWidthDetail>;
|
|
8
|
+
totalColumnWidth: number;
|
|
9
|
+
};
|
|
10
|
+
export declare function isPercentageWidth(width: string): boolean;
|
|
11
|
+
export declare function isSpecificPxWidth(width: string): boolean;
|
|
12
|
+
export declare function getValidWidthByNumber(width: number): number;
|
|
13
|
+
export declare function getValidScrollThreshold(height: string | number, clientHeight: number): number;
|
|
14
|
+
export declare function getPercentageValue(percentage: string, containerNum: number): number;
|
|
15
|
+
export declare function getPxValue(px: string): number;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getColumnsWidthMap = getColumnsWidthMap;
|
|
7
|
+
exports.getPercentageValue = getPercentageValue;
|
|
8
|
+
exports.getPxValue = getPxValue;
|
|
9
|
+
exports.getValidScrollThreshold = getValidScrollThreshold;
|
|
10
|
+
exports.getValidWidthByNumber = getValidWidthByNumber;
|
|
11
|
+
exports.isPercentageWidth = isPercentageWidth;
|
|
12
|
+
exports.isSpecificPxWidth = isSpecificPxWidth;
|
|
13
|
+
var ZERO = 0;
|
|
14
|
+
var NOT_SET = -1;
|
|
15
|
+
var COLUMN_MIN_WIDTH = 72;
|
|
16
|
+
var HUNDRED = 100; // TODO: 添加单侧
|
|
17
|
+
|
|
18
|
+
function getColumnsWidthMap(columns, clientWidth, lastWidthMap) {
|
|
19
|
+
var settedTotalWidth = ZERO;
|
|
20
|
+
var unsetWidthIndex = [];
|
|
21
|
+
var widthMap = new Map();
|
|
22
|
+
var totalColumnWidth = ZERO;
|
|
23
|
+
columns.forEach(function (item, index) {
|
|
24
|
+
var _lastWidthMap$get;
|
|
25
|
+
|
|
26
|
+
var key = index.toString();
|
|
27
|
+
var width = getWidthByColumnsWidth(clientWidth, item.width); // 首先判断是否是否是容器宽度的变化
|
|
28
|
+
|
|
29
|
+
var isSpecific = lastWidthMap ? (_lastWidthMap$get = lastWidthMap.get(key)) === null || _lastWidthMap$get === void 0 ? void 0 : _lastWidthMap$get.isSpecific : isSpecificWidth(item.width);
|
|
30
|
+
|
|
31
|
+
if (lastWidthMap && isSpecific) {
|
|
32
|
+
var _lastWidthMap$get2;
|
|
33
|
+
|
|
34
|
+
width = (_lastWidthMap$get2 = lastWidthMap.get(key)) === null || _lastWidthMap$get2 === void 0 ? void 0 : _lastWidthMap$get2.width;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (width === NOT_SET) {
|
|
38
|
+
unsetWidthIndex.push(key);
|
|
39
|
+
} else {
|
|
40
|
+
settedTotalWidth += width;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
widthMap.set(key, {
|
|
44
|
+
width: width,
|
|
45
|
+
isSpecific: isSpecific
|
|
46
|
+
});
|
|
47
|
+
}); // 设定宽度大于容器宽度时
|
|
48
|
+
|
|
49
|
+
if (settedTotalWidth < clientWidth) {
|
|
50
|
+
unsetWidthIndex.map(function (item) {
|
|
51
|
+
var _widthMap$get;
|
|
52
|
+
|
|
53
|
+
return widthMap.set(item, {
|
|
54
|
+
isSpecific: (_widthMap$get = widthMap.get(item)) === null || _widthMap$get === void 0 ? void 0 : _widthMap$get.isSpecific,
|
|
55
|
+
width: 72
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
} // 设定宽度小于容器宽度时
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
if (unsetWidthIndex.length > ZERO) {
|
|
62
|
+
var leftWidth = clientWidth - settedTotalWidth;
|
|
63
|
+
var average = getValidWidthByNumber(leftWidth / unsetWidthIndex.length);
|
|
64
|
+
unsetWidthIndex.map(function (item) {
|
|
65
|
+
var _widthMap$get2;
|
|
66
|
+
|
|
67
|
+
return widthMap.set(item, {
|
|
68
|
+
isSpecific: (_widthMap$get2 = widthMap.get(item)) === null || _widthMap$get2 === void 0 ? void 0 : _widthMap$get2.isSpecific,
|
|
69
|
+
width: average
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
columns.forEach(function (item, index) {
|
|
75
|
+
var _widthMap$get3;
|
|
76
|
+
|
|
77
|
+
var key = index.toString();
|
|
78
|
+
var width = (_widthMap$get3 = widthMap.get(key)) === null || _widthMap$get3 === void 0 ? void 0 : _widthMap$get3.width;
|
|
79
|
+
totalColumnWidth += width;
|
|
80
|
+
});
|
|
81
|
+
return {
|
|
82
|
+
columnsWidthMap: widthMap,
|
|
83
|
+
totalColumnWidth: totalColumnWidth
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function getWidthByColumnsWidth(clientWidth, width) {
|
|
88
|
+
if (width === undefined) {
|
|
89
|
+
return NOT_SET;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (typeof width === 'number') {
|
|
93
|
+
return getValidWidthByNumber(width);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (isPercentageWidth(width)) {
|
|
97
|
+
return getPercentageValue(width, clientWidth);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (isSpecificPxWidth(width)) {
|
|
101
|
+
var specificNum = getPxValue(width);
|
|
102
|
+
return getValidWidthByNumber(specificNum);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return NOT_SET;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function isPercentageWidth(width) {
|
|
109
|
+
return /[0-9]{1,}%$/.test(width);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function isSpecificPxWidth(width) {
|
|
113
|
+
return /[0-9]{1,}(px)$/.test(width);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function isSpecificWidth(width) {
|
|
117
|
+
return typeof width === 'number' || !!(width && isSpecificPxWidth(width));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function getValidWidthByNumber(width) {
|
|
121
|
+
return width < COLUMN_MIN_WIDTH ? COLUMN_MIN_WIDTH : width;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function getValidScrollThreshold(height, clientHeight) {
|
|
125
|
+
var scrollThreshold = ZERO;
|
|
126
|
+
|
|
127
|
+
if (typeof height === 'string') {
|
|
128
|
+
if (isPercentageWidth(height)) {
|
|
129
|
+
scrollThreshold = getPercentageValue(height, clientHeight);
|
|
130
|
+
} else {
|
|
131
|
+
scrollThreshold = getPxValue(height);
|
|
132
|
+
}
|
|
133
|
+
} else {
|
|
134
|
+
scrollThreshold = height;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return scrollThreshold;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function getPercentageValue(percentage, containerNum) {
|
|
141
|
+
var percent = Math.floor(Number(percentage.replace('%', '')) / HUNDRED);
|
|
142
|
+
return getValidWidthByNumber(containerNum * percent);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function getPxValue(px) {
|
|
146
|
+
return Number(px.replace('px', ''));
|
|
147
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getUUID = getUUID;
|
|
7
|
+
exports.isBrowserClient = void 0;
|
|
8
|
+
|
|
9
|
+
var _canUseDom = _interopRequireDefault(require("rc-util/lib/Dom/canUseDom"));
|
|
10
|
+
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
|
|
13
|
+
// @ts-nocheck
|
|
14
|
+
var uuid = 0;
|
|
15
|
+
/** Is client side and not jsdom */
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
17
|
+
|
|
18
|
+
var isBrowserClient = process.env.NODE_ENV !== 'test' && (0, _canUseDom.default)();
|
|
19
|
+
/** Get unique id for accessibility usage */
|
|
20
|
+
|
|
21
|
+
exports.isBrowserClient = isBrowserClient;
|
|
22
|
+
|
|
23
|
+
function getUUID() {
|
|
24
|
+
var retId; // Test never reach
|
|
25
|
+
|
|
26
|
+
/* istanbul ignore if */
|
|
27
|
+
|
|
28
|
+
if (isBrowserClient) {
|
|
29
|
+
retId = uuid;
|
|
30
|
+
uuid += 1;
|
|
31
|
+
} else {
|
|
32
|
+
retId = 'TEST_OR_SSR';
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return retId;
|
|
36
|
+
}
|
package/lib/index.d.ts
CHANGED
|
@@ -57,7 +57,7 @@ export type { DividerProps } from './Divider';
|
|
|
57
57
|
export { default as Drawer } from './Drawer';
|
|
58
58
|
export type { DrawerProps } from './Drawer';
|
|
59
59
|
export { default as Radio } from './Radio';
|
|
60
|
-
export type { RadioProps,
|
|
60
|
+
export type { RadioProps, RadioGroupProps } from './Radio';
|
|
61
61
|
export { default as Checkbox } from './Checkbox';
|
|
62
62
|
export type { CheckboxProps, CheckboxOptionType } from './Checkbox';
|
|
63
63
|
export { default as Modal } from './Modal';
|
|
@@ -4,10 +4,13 @@ import type { PickerLocale as DatePickerLocale } from 'antd/es/date-picker/gener
|
|
|
4
4
|
import type { TransferLocale as TransferLocaleForEmpty } from 'antd/es/empty';
|
|
5
5
|
import type { ModalLocale } from 'antd/es/modal/locale';
|
|
6
6
|
import type { PaginationLocale } from 'antd/es/pagination/Pagination';
|
|
7
|
-
import type { PopconfirmLocale } from 'antd/es/popconfirm';
|
|
8
7
|
import type { TableLocale } from 'antd/es/table/interface';
|
|
9
8
|
import type { TransferLocale } from 'antd/es/transfer';
|
|
10
9
|
import type { UploadLocale } from 'antd/es/upload/interface';
|
|
10
|
+
interface PopconfirmLocale {
|
|
11
|
+
okText: string;
|
|
12
|
+
cancelText: string;
|
|
13
|
+
}
|
|
11
14
|
export declare const ANT_MARK = "internalMark";
|
|
12
15
|
export interface Locale {
|
|
13
16
|
locale: string;
|
|
@@ -59,3 +62,4 @@ export default class LocaleProvider extends React.Component<LocaleProviderProps,
|
|
|
59
62
|
};
|
|
60
63
|
render(): JSX.Element;
|
|
61
64
|
}
|
|
65
|
+
export {};
|
package/lib/style/index.d.ts
CHANGED
package/lib/style/index.js
CHANGED
package/lib/style/index.less
CHANGED