@aloudata/aloudata-design 1.9.10 → 1.9.12
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.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
4
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
5
|
+
import classnames from 'classnames';
|
|
1
6
|
import _ from 'lodash';
|
|
2
7
|
import React from 'react';
|
|
3
8
|
export function getTableColumns(_ref) {
|
|
@@ -6,20 +11,29 @@ export function getTableColumns(_ref) {
|
|
|
6
11
|
totalWidth = _ref.totalWidth;
|
|
7
12
|
var columnWidths = getColumnWidths(columns, columnSizing, totalWidth);
|
|
8
13
|
return _.map(columns, function (col, index) {
|
|
14
|
+
var title = col.title,
|
|
15
|
+
_col$dataIndex = col.dataIndex,
|
|
16
|
+
dataIndex = _col$dataIndex === void 0 ? "column-".concat(index) : _col$dataIndex,
|
|
17
|
+
_col$align = col.align,
|
|
18
|
+
align = _col$align === void 0 ? 'left' : _col$align,
|
|
19
|
+
_col$ellipsis = col.ellipsis,
|
|
20
|
+
ellipsis = _col$ellipsis === void 0 ? true : _col$ellipsis,
|
|
21
|
+
render = col.render;
|
|
9
22
|
return {
|
|
10
|
-
id
|
|
23
|
+
// 这里还需要排除掉空字符串的情况,id 不能为 ''
|
|
24
|
+
id: dataIndex || "column-".concat(index),
|
|
11
25
|
accessor: col.dataIndex,
|
|
12
|
-
Header: typeof
|
|
13
|
-
key:
|
|
14
|
-
className: prefixCls('th-default')
|
|
15
|
-
},
|
|
26
|
+
Header: typeof title === 'string' ? /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
key: dataIndex,
|
|
28
|
+
className: classnames(prefixCls('th-default'), prefixCls("align-".concat(align)), _defineProperty({}, prefixCls('td-ellipsis-content'), ellipsis))
|
|
29
|
+
}, title) : title,
|
|
16
30
|
Cell: function Cell(_ref2) {
|
|
17
31
|
var row = _ref2.row;
|
|
18
|
-
var colValue = _.get(row.original,
|
|
19
|
-
var node =
|
|
32
|
+
var colValue = _.get(row.original, dataIndex || '');
|
|
33
|
+
var node = render ? render(colValue, row.original, row.index) : colValue;
|
|
20
34
|
return /*#__PURE__*/React.createElement("div", {
|
|
21
|
-
className: prefixCls('td-default')
|
|
22
|
-
},
|
|
35
|
+
className: classnames(prefixCls('td-default'), prefixCls("align-".concat(align)))
|
|
36
|
+
}, ellipsis ? /*#__PURE__*/React.createElement("div", {
|
|
23
37
|
className: prefixCls('td-ellipsis-content')
|
|
24
38
|
}, node) : node);
|
|
25
39
|
},
|
package/dist/AldTable/index.js
CHANGED
|
@@ -28,7 +28,11 @@ function AldTable(props) {
|
|
|
28
28
|
pagination = props.pagination,
|
|
29
29
|
_props$scroll = props.scroll,
|
|
30
30
|
scroll = _props$scroll === void 0 ? {} : _props$scroll,
|
|
31
|
-
emptyComponent = props.empty
|
|
31
|
+
emptyComponent = props.empty,
|
|
32
|
+
_props$rowClassName = props.rowClassName,
|
|
33
|
+
rowClassName = _props$rowClassName === void 0 ? function () {
|
|
34
|
+
return '';
|
|
35
|
+
} : _props$rowClassName;
|
|
32
36
|
var _useState = useState(null),
|
|
33
37
|
_useState2 = _slicedToArray(_useState, 2),
|
|
34
38
|
totalSize = _useState2[0],
|
|
@@ -98,10 +102,10 @@ function AldTable(props) {
|
|
|
98
102
|
}, /*#__PURE__*/React.createElement(Empty, {
|
|
99
103
|
title: "No Data",
|
|
100
104
|
image: Empty.PRESENTED_IMAGE_SEARCH
|
|
101
|
-
})) : _.map(rows, function (row) {
|
|
105
|
+
})) : _.map(rows, function (row, rowIndex) {
|
|
102
106
|
prepareRow(row);
|
|
103
107
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
104
|
-
className: prefixCls('tr')
|
|
108
|
+
className: classnames(prefixCls('tr'), rowClassName(row.original, rowIndex))
|
|
105
109
|
}, row.getRowProps()), _.map(row.cells, function (cell) {
|
|
106
110
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
107
111
|
className: prefixCls('td')
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
position: relative;
|
|
45
45
|
overflow: hidden;
|
|
46
46
|
border-bottom: 1px solid #e8e8e8;
|
|
47
|
-
background-color: #fff;
|
|
48
47
|
}
|
|
49
48
|
|
|
50
49
|
.ald-tmp-table-th {
|
|
51
50
|
border-bottom: 1px solid #e8e8e8;
|
|
51
|
+
background-color: #fff;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
.ald-tmp-table-th-default {
|
|
@@ -63,12 +63,12 @@
|
|
|
63
63
|
height: 100%;
|
|
64
64
|
font-size: 13px;
|
|
65
65
|
min-height: 48px;
|
|
66
|
+
}
|
|
66
67
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
68
|
+
.ald-tmp-table-td-ellipsis-content {
|
|
69
|
+
overflow: hidden;
|
|
70
|
+
text-overflow: ellipsis;
|
|
71
|
+
white-space: nowrap;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
.ald-tmp-table-sticky {
|
|
@@ -80,6 +80,27 @@
|
|
|
80
80
|
|
|
81
81
|
.ald-tmp-table-body {
|
|
82
82
|
min-height: 200px;
|
|
83
|
+
|
|
84
|
+
.ald-tmp-table-tr:hover {
|
|
85
|
+
background-color: #f4f4f4;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.ald-tmp-table-align {
|
|
91
|
+
&-left {
|
|
92
|
+
text-align: left;
|
|
93
|
+
justify-content: left;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&-right {
|
|
97
|
+
text-align: right;
|
|
98
|
+
justify-content: right;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
&-center {
|
|
102
|
+
text-align: center;
|
|
103
|
+
justify-content: center;
|
|
83
104
|
}
|
|
84
105
|
}
|
|
85
106
|
|
package/dist/AldTable/types.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export interface ITableProps<TDataItem extends object> {
|
|
|
15
15
|
};
|
|
16
16
|
pagination?: IPaginationProps;
|
|
17
17
|
empty?: React.ReactNode;
|
|
18
|
+
rowClassName?: (record: TDataItem, index: number) => string;
|
|
18
19
|
}
|
|
19
20
|
export interface ITableColumn<TDataItem = unknown> {
|
|
20
21
|
title: string | React.ReactNode;
|
|
@@ -23,4 +24,5 @@ export interface ITableColumn<TDataItem = unknown> {
|
|
|
23
24
|
render?: (text: any, record: TDataItem, rowIndex: number) => React.ReactNode;
|
|
24
25
|
ellipsis?: boolean;
|
|
25
26
|
noPadding?: boolean;
|
|
27
|
+
align?: 'left' | 'center' | 'right';
|
|
26
28
|
}
|
|
@@ -15,7 +15,7 @@ var CancelCircleDuotone = function CancelCircleDuotone(_ref, ref) {
|
|
|
15
15
|
width: props.width || props.size || 16,
|
|
16
16
|
height: props.height || props.size || 16,
|
|
17
17
|
fill: "none",
|
|
18
|
-
viewBox: "0 0
|
|
18
|
+
viewBox: "0 0 24 24",
|
|
19
19
|
ref: ref,
|
|
20
20
|
"aria-labelledby": titleId,
|
|
21
21
|
"aria-describedby": descId
|
|
@@ -25,12 +25,12 @@ var CancelCircleDuotone = function CancelCircleDuotone(_ref, ref) {
|
|
|
25
25
|
id: titleId
|
|
26
26
|
}, title) : null, /*#__PURE__*/React.createElement("path", {
|
|
27
27
|
fill: props.color || 'currentColor',
|
|
28
|
-
d: "
|
|
28
|
+
d: "M12 2C6.429 2 2 6.429 2 12s4.429 10 10 10 10-4.429 10-10S17.571 2 12 2Z"
|
|
29
29
|
}), /*#__PURE__*/React.createElement("path", {
|
|
30
|
+
fill: props.fill || 'currentColor',
|
|
30
31
|
fillRule: "evenodd",
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
fill: props.fill || 'currentColor'
|
|
32
|
+
d: "m17.854 8.854-7 7a.5.5 0 0 1-.708 0l-4-4 .708-.708 3.646 3.647 6.646-6.647.708.708Z",
|
|
33
|
+
clipRule: "evenodd"
|
|
34
34
|
}));
|
|
35
35
|
};
|
|
36
36
|
var ForwardRef = /*#__PURE__*/forwardRef(CancelCircleDuotone);
|