@aloudata/aloudata-design 2.5.2 → 2.6.1

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.
Files changed (40) hide show
  1. package/dist/Icon/components/ArrowDownLightLine.d.ts +11 -0
  2. package/dist/Icon/components/ArrowDownLightLine.js +35 -0
  3. package/dist/Icon/components/CancelledCircleFill.d.ts +11 -0
  4. package/dist/Icon/components/CancelledCircleFill.js +35 -0
  5. package/dist/Icon/components/InProgressFill.d.ts +11 -0
  6. package/dist/Icon/components/InProgressFill.js +38 -0
  7. package/dist/Icon/index.d.ts +3 -0
  8. package/dist/Icon/index.js +3 -0
  9. package/dist/Icon/svg/Cancelled-Circle-fill.svg +5 -0
  10. package/dist/Icon/svg/In-Progress-fill.svg +8 -0
  11. package/dist/Icon/svg/arrow-down-light-line.svg +5 -0
  12. package/dist/Radio/components/Radio/index.js +45 -9
  13. package/dist/Radio/interface/radio.d.ts +3 -0
  14. package/dist/Radio/style/index.less +38 -5
  15. package/dist/Spin/CustomIcon/index.js +4 -1
  16. package/dist/StatusLight/index.d.ts +12 -0
  17. package/dist/StatusLight/index.js +74 -0
  18. package/dist/StatusLight/style/index.d.ts +2 -0
  19. package/dist/StatusLight/style/index.js +2 -0
  20. package/dist/StatusLight/style/index.less +47 -0
  21. package/dist/Table/components/ExpandCell.d.ts +11 -0
  22. package/dist/Table/components/ExpandCell.js +46 -0
  23. package/dist/Table/components/Pagination/index.d.ts +3 -2
  24. package/dist/Table/components/Pagination/index.js +1 -1
  25. package/dist/Table/helper.d.ts +2 -1
  26. package/dist/Table/helper.js +10 -0
  27. package/dist/Table/hooks/useExpandable.d.ts +23 -0
  28. package/dist/Table/hooks/useExpandable.js +152 -0
  29. package/dist/Table/index.d.ts +1 -1
  30. package/dist/Table/index.js +32 -17
  31. package/dist/Table/style/index.less +96 -45
  32. package/dist/Table/types.d.ts +10 -1
  33. package/dist/Tabs/index.d.ts +1 -1
  34. package/dist/Tabs/index.js +13 -13
  35. package/dist/Tabs/style/index.less +1 -0
  36. package/dist/ald.min.css +1 -1
  37. package/dist/index.d.ts +1 -0
  38. package/dist/index.js +1 -0
  39. package/dist/index.less +1 -0
  40. package/package.json +1 -1
@@ -1,8 +1,9 @@
1
1
  import React from 'react';
2
+ import { IPaginationProps } from '../../../Pagination/types';
2
3
  import { ITableProps } from '../../types';
3
- export default function TablePagination<TDataItem extends object>(props: IProps<TDataItem>): React.JSX.Element | undefined;
4
+ export default function TablePagination<TDataItem extends object>(props: IProps<TDataItem>): React.JSX.Element;
4
5
  interface IProps<TDataItem extends object> {
5
- pagination?: ITableProps<TDataItem>['pagination'];
6
+ pagination: IPaginationProps;
6
7
  scroll?: ITableProps<TDataItem>['scroll'];
7
8
  scrollToFirstRow: () => void;
8
9
  }
@@ -18,7 +18,7 @@ export default function TablePagination(props) {
18
18
  }
19
19
  onChange(page);
20
20
  }, [scrollToFirstRow, scroll, pagination]);
21
- return pagination && /*#__PURE__*/React.createElement("div", {
21
+ return /*#__PURE__*/React.createElement("div", {
22
22
  className: prefixCls('pagination')
23
23
  }, /*#__PURE__*/React.createElement(Pagination, _extends({
24
24
  hideOnSinglePage: true
@@ -19,7 +19,7 @@ export declare function getTableColumns<TDataItem extends object>({ columns, tot
19
19
  render?: ((text: any, record: TDataItem, rowIndex: number) => import("react").ReactNode) | undefined;
20
20
  ellipsis?: boolean | undefined;
21
21
  noPadding?: boolean | undefined;
22
- align?: "left" | "center" | "right" | undefined;
22
+ align?: "center" | "left" | "right" | undefined;
23
23
  fixed?: "left" | "right" | undefined;
24
24
  };
25
25
  }[];
@@ -39,3 +39,4 @@ export declare function getNumberFromPercentageStr(str: string): number;
39
39
  */
40
40
  export declare function isPercentage(str: string): boolean;
41
41
  export declare function prefixCls(className: string): string;
42
+ export declare function getRowKey<TDataItem extends object>(row: TDataItem, rowKey: ITableProps<TDataItem>['rowKey'], defaultKey?: string | number): string;
@@ -5,6 +5,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
5
5
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
6
  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); }
7
7
  import _ from 'lodash';
8
+ import { getUUID } from "../_utils/hooks/useId";
8
9
  import Cell from "./components/Cell";
9
10
  import Header from "./components/Header";
10
11
  export function getTableColumns(_ref) {
@@ -142,4 +143,13 @@ export function isPercentage(str) {
142
143
  var ALD_PREFIX = 'ald-table';
143
144
  export function prefixCls(className) {
144
145
  return "".concat(ALD_PREFIX, "-").concat(className);
146
+ }
147
+ export function getRowKey(row, rowKey, defaultKey) {
148
+ var rowKeyStr = defaultKey || getUUID();
149
+ if (typeof rowKey === 'function') {
150
+ rowKeyStr = rowKey(row);
151
+ } else if (rowKey !== undefined) {
152
+ rowKeyStr = _.get(row, rowKey);
153
+ }
154
+ return _.toString(rowKeyStr);
145
155
  }
@@ -0,0 +1,23 @@
1
+ import { ITableProps } from '../types';
2
+ export default function useExpandable<TDataItem extends object>(props: IProps<TDataItem>): IExpandableInfo<TDataItem>;
3
+ export interface IExpandableInfo<TDataItem extends object> {
4
+ expandItemMap: IExpandItemMap;
5
+ onExpand: (record: TDataItem, isExpanded: boolean) => void;
6
+ isExpandable: boolean;
7
+ data: TDataItem[];
8
+ }
9
+ export interface IExpandItem {
10
+ isLeaf: boolean;
11
+ isExpanded?: boolean;
12
+ level: number;
13
+ rowKey: string;
14
+ }
15
+ interface IExpandItemMap {
16
+ [key: string]: IExpandItem;
17
+ }
18
+ interface IProps<TDataItem extends object> {
19
+ expandable: ITableProps<TDataItem>['expandable'];
20
+ data: ITableProps<TDataItem>['data'];
21
+ rowKey: ITableProps<TDataItem>['rowKey'];
22
+ }
23
+ export {};
@@ -0,0 +1,152 @@
1
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
4
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
5
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
+ 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."); }
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
+ 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; }
9
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
10
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
+ import _ from 'lodash';
12
+ import { useCallback, useEffect, useMemo, useState } from 'react';
13
+ import { getRowKey } from "../helper";
14
+ export default function useExpandable(props) {
15
+ var propsExpandable = props.expandable,
16
+ data = props.data,
17
+ rowKey = props.rowKey;
18
+ var expandable = getExpandableConfig(propsExpandable);
19
+ if (!!propsExpandable && !rowKey) {
20
+ throw new Error('rowKey is necessary when expandable is enabled, but is missing');
21
+ }
22
+ var expandedRowKeys = expandable.expandedRowKeys,
23
+ propsOnExpand = expandable.onExpand,
24
+ _expandable$defaultEx = expandable.defaultExpandAllRows,
25
+ defaultExpandAllRows = _expandable$defaultEx === void 0 ? true : _expandable$defaultEx,
26
+ defaultExpandedRowKeys = expandable.defaultExpandedRowKeys,
27
+ childrenColumnName = expandable.childrenColumnName;
28
+ var columnName = getChildrenColumnName(childrenColumnName);
29
+ var flattenList = useMemo(function () {
30
+ return flattenChildren(data, columnName);
31
+ }, [columnName, data]);
32
+ var allCategoryRowKeys = useMemo(function () {
33
+ return getAllExpandRowKeys(flattenList, columnName, defaultExpandAllRows, rowKey);
34
+ }, [columnName, flattenList, defaultExpandAllRows, rowKey]);
35
+
36
+ // 考虑 defaultExpandAllRows 的情况
37
+ var _useState = useState(expandedRowKeys || defaultExpandedRowKeys || allCategoryRowKeys || []),
38
+ _useState2 = _slicedToArray(_useState, 2),
39
+ expandedKeys = _useState2[0],
40
+ setExpandedKeys = _useState2[1];
41
+ var expandItemMap = useMemo(function () {
42
+ var listData = data.map(function (dataItem) {
43
+ return getListItemsByTree(dataItem, expandedKeys, rowKey, childrenColumnName);
44
+ }).flat();
45
+ return _.keyBy(listData, function (dataItem) {
46
+ return dataItem.rowKey;
47
+ });
48
+ }, [childrenColumnName, data, expandedKeys, rowKey]);
49
+ useEffect(function () {
50
+ if (expandedRowKeys) {
51
+ // 展开收起完全受控的情况
52
+ setExpandedKeys(expandedRowKeys);
53
+ }
54
+ }, [expandedRowKeys]);
55
+ var onExpand = useCallback(function (dataItem, isExpanded) {
56
+ var key = getRowKey(dataItem, rowKey);
57
+ if (!expandedRowKeys) {
58
+ setExpandedKeys(function (prev) {
59
+ if (isExpanded) {
60
+ // 折叠
61
+ return prev.filter(function (expandedKey) {
62
+ return expandedKey !== key;
63
+ });
64
+ } else {
65
+ // 展开
66
+ return [].concat(_toConsumableArray(prev), [key]);
67
+ }
68
+ });
69
+ }
70
+ propsOnExpand === null || propsOnExpand === void 0 ? void 0 : propsOnExpand(dataItem, isExpanded);
71
+ }, [propsOnExpand, rowKey, expandedRowKeys]);
72
+ var visibleList = useMemo(function () {
73
+ return flattenList.filter(function (dataItem) {
74
+ var key = getRowKey(dataItem, rowKey);
75
+ // 不在 Map 中的行,即表示被折叠了
76
+ return !!expandItemMap[key];
77
+ });
78
+ }, [expandItemMap, flattenList, rowKey]);
79
+ if (!propsExpandable) {
80
+ return {
81
+ expandItemMap: {},
82
+ onExpand: function onExpand() {},
83
+ isExpandable: false,
84
+ data: data
85
+ };
86
+ }
87
+ return {
88
+ expandItemMap: expandItemMap,
89
+ onExpand: onExpand,
90
+ isExpandable: true,
91
+ data: visibleList
92
+ };
93
+ }
94
+ function getListItemsByTree(currNode, expandedKeys, getKey, childrenColumnName) {
95
+ var level = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
96
+ var subNodes = _.get(currNode, getChildrenColumnName(childrenColumnName));
97
+ var isLeaf = !subNodes;
98
+ var rowKey = getRowKey(currNode, getKey);
99
+ if (isLeaf) {
100
+ return [{
101
+ isLeaf: true,
102
+ level: level,
103
+ rowKey: rowKey
104
+ }];
105
+ }
106
+ // 是目录的情况
107
+ var isExpanded = expandedKeys.includes(rowKey);
108
+ var curr = {
109
+ isLeaf: false,
110
+ level: level,
111
+ rowKey: rowKey
112
+ };
113
+ if (!isExpanded) {
114
+ curr.isExpanded = false;
115
+ return [curr];
116
+ }
117
+ curr.isExpanded = true;
118
+ // 子目录是展开的情况
119
+ var subItems = (subNodes === null || subNodes === void 0 ? void 0 : subNodes.map(function (child) {
120
+ return getListItemsByTree(child, expandedKeys, getKey, childrenColumnName, level + 1);
121
+ })) || [];
122
+ return [curr].concat(_toConsumableArray(_.flatten(subItems)));
123
+ }
124
+ function getExpandableConfig(expandable) {
125
+ if (typeof expandable === 'boolean') {
126
+ return {};
127
+ }
128
+ return expandable || {};
129
+ }
130
+ function getAllExpandRowKeys(list, childrenColumnName, defaultExpandAllRows, rowKey) {
131
+ if (!defaultExpandAllRows) {
132
+ return undefined;
133
+ }
134
+ var itemsWithChildrenProp = list.filter(function (item) {
135
+ return !!_.get(item, childrenColumnName);
136
+ });
137
+ return itemsWithChildrenProp.map(function (item) {
138
+ return getRowKey(item, rowKey);
139
+ });
140
+ }
141
+ function flattenChildren(nodes, childKey) {
142
+ return _.flatMapDeep(nodes, function (node) {
143
+ var children = node[childKey];
144
+ if (children && children.length > 0) {
145
+ return [node].concat(_toConsumableArray(flattenChildren(children, childKey)));
146
+ }
147
+ return [node];
148
+ });
149
+ }
150
+ function getChildrenColumnName(childrenColumnName) {
151
+ return childrenColumnName || 'children';
152
+ }
@@ -2,6 +2,6 @@ import React, { ForwardedRef } from 'react';
2
2
  import { ITableProps, ITableRef } from './types';
3
3
  declare function Table<TDataItem extends object>(props: ITableProps<TDataItem>, ref: ForwardedRef<ITableRef>): React.JSX.Element;
4
4
  declare const _default: <TDataItem extends object>(props: ITableProps<TDataItem> & {
5
- ref?: React.ForwardedRef<HTMLUListElement> | undefined;
5
+ ref?: React.ForwardedRef<ITableRef> | undefined;
6
6
  }) => ReturnType<typeof Table>;
7
7
  export default _default;
@@ -16,13 +16,15 @@ import _ from 'lodash';
16
16
  import ResizeObserver from 'rc-resize-observer';
17
17
  import React, { forwardRef, useCallback, useImperativeHandle, useMemo, useState } from 'react';
18
18
  import { Empty, Spin } from '..';
19
+ import ExpandCell from "./components/ExpandCell";
19
20
  import Pagination from "./components/Pagination";
20
- import { getTableColumns, prefixCls } from "./helper";
21
+ import { getRowKey, getTableColumns, prefixCls } from "./helper";
22
+ import useExpandable from "./hooks/useExpandable";
21
23
  import useFixed from "./hooks/useFixed";
22
24
  import useScroll from "./hooks/useScroll";
23
25
  var HEADER_HEIGHT = 41;
24
26
  function Table(props, ref) {
25
- var _classnames, _classnames5;
27
+ var _classnames, _classnames6;
26
28
  var columns = props.columns,
27
29
  data = props.data,
28
30
  rowKey = props.rowKey,
@@ -38,7 +40,8 @@ function Table(props, ref) {
38
40
  return '';
39
41
  } : _props$rowClassName,
40
42
  onRowClick = props.onRowClick,
41
- onError = props.onError;
43
+ onError = props.onError,
44
+ expandable = props.expandable;
42
45
  var _useState = useState(null),
43
46
  _useState2 = _slicedToArray(_useState, 2),
44
47
  totalSize = _useState2[0],
@@ -66,6 +69,11 @@ function Table(props, ref) {
66
69
  scrollToFirstRow: scrollToFirstRow
67
70
  };
68
71
  });
72
+ var expandableInfo = useExpandable({
73
+ expandable: expandable,
74
+ data: data,
75
+ rowKey: rowKey
76
+ });
69
77
  var tableColumns = useMemo(function () {
70
78
  if (!totalSize || !realWidth) {
71
79
  return [];
@@ -83,16 +91,11 @@ function Table(props, ref) {
83
91
  });
84
92
  var tableInstance = useReactTable({
85
93
  columns: tableColumns,
86
- data: data,
94
+ // 排除掉被折叠的行
95
+ data: expandableInfo.data,
87
96
  getCoreRowModel: getCoreRowModel(),
88
97
  getRowId: function getRowId(row, index) {
89
- var rowKeyStr = index;
90
- if (typeof rowKey === 'function') {
91
- rowKeyStr = rowKey(row);
92
- } else if (rowKey !== undefined) {
93
- rowKeyStr = _.get(row, rowKey, index);
94
- }
95
- return _.toString(rowKeyStr);
98
+ return getRowKey(row, rowKey, index);
96
99
  },
97
100
  columnResizeMode: 'onChange'
98
101
  });
@@ -153,6 +156,11 @@ function Table(props, ref) {
153
156
  onRowClick(rowData, rowIndex);
154
157
  };
155
158
  }, [onRowClick]);
159
+ var isShowPagination = pagination && pagination.total > pagination.pageSize;
160
+
161
+ // 空态切换 size 的阈值
162
+ var EMPTY_SMALL_SIZE_HEIGHT = 288;
163
+ var isSmallEmpty = totalSize && totalSize.height < EMPTY_SMALL_SIZE_HEIGHT;
156
164
 
157
165
  // 渲染 body
158
166
  var bodyContent = /*#__PURE__*/React.createElement("div", {
@@ -161,25 +169,32 @@ function Table(props, ref) {
161
169
  width: realWidth
162
170
  }
163
171
  }, rows.length === 0 && !loading ? emptyComponent || /*#__PURE__*/React.createElement("div", {
164
- className: prefixCls('empty')
172
+ className: classnames(prefixCls('empty'), _defineProperty({}, prefixCls('empty-small'), isSmallEmpty))
165
173
  }, /*#__PURE__*/React.createElement(Empty, {
166
- image: Empty.PRESENTED_IMAGE_SEARCH
174
+ image: isSmallEmpty ? null : Empty.PRESENTED_IMAGE_SEARCH,
175
+ size: isSmallEmpty ? 'small' : undefined
167
176
  })) : _.map(rows, function (row, rowIndex) {
177
+ var _classnames4;
168
178
  return /*#__PURE__*/React.createElement("div", {
169
179
  key: row.id,
170
- className: classnames(prefixCls('tr'), _defineProperty({}, prefixCls('row-hover'), typeof onRowClick === 'function'), rowClassName(row.original, rowIndex)),
180
+ className: classnames(prefixCls('tr'), (_classnames4 = {}, _defineProperty(_classnames4, prefixCls('row-hover'), typeof onRowClick === 'function'), _defineProperty(_classnames4, prefixCls('no-border-tr'), isShowPagination && rowIndex === rows.length - 1), _classnames4), rowClassName(row.original, rowIndex)),
171
181
  onClick: onClickRow(row.original, rowIndex)
172
182
  }, _.map(row.getVisibleCells(), function (cell, colIndex) {
173
183
  var _getColumnFixedInfo2 = getColumnFixedInfo(colIndex),
174
184
  fixedClassName = _getColumnFixedInfo2.className,
175
185
  fixedStyle = _getColumnFixedInfo2.style;
186
+ var tdContent = flexRender(cell.column.columnDef.cell, cell.getContext());
176
187
  return /*#__PURE__*/React.createElement("div", {
177
188
  className: classnames(prefixCls('td'), fixedClassName),
178
189
  key: cell.id,
179
190
  style: _objectSpread({
180
191
  width: cell.column.getSize()
181
192
  }, fixedStyle)
182
- }, flexRender(cell.column.columnDef.cell, cell.getContext()));
193
+ }, colIndex === 0 ? /*#__PURE__*/React.createElement(ExpandCell, {
194
+ expandableInfo: expandableInfo,
195
+ data: row.original,
196
+ rowKey: rowKey
197
+ }, tdContent) : tdContent);
183
198
  }));
184
199
  }));
185
200
  var tableContent = /*#__PURE__*/React.createElement(Spin, {
@@ -211,8 +226,8 @@ function Table(props, ref) {
211
226
  });
212
227
  }
213
228
  }, /*#__PURE__*/React.createElement("div", {
214
- className: classnames(prefixCls('main'), (_classnames5 = {}, _defineProperty(_classnames5, prefixCls('overflow-hidden'), !!y), _defineProperty(_classnames5, prefixCls('ping-left'), isPingLeft), _defineProperty(_classnames5, prefixCls('ping-right'), isPingRight), _classnames5))
215
- }, tableContent)), /*#__PURE__*/React.createElement(Pagination, {
229
+ className: classnames(prefixCls('main'), (_classnames6 = {}, _defineProperty(_classnames6, prefixCls('overflow-hidden'), !!y), _defineProperty(_classnames6, prefixCls('ping-left'), isPingLeft), _defineProperty(_classnames6, prefixCls('ping-right'), isPingRight), _classnames6))
230
+ }, tableContent)), isShowPagination && /*#__PURE__*/React.createElement(Pagination, {
216
231
  pagination: pagination,
217
232
  scroll: scroll,
218
233
  scrollToFirstRow: scrollToFirstRow
@@ -6,25 +6,27 @@
6
6
 
7
7
  @header-height: 40px;
8
8
 
9
- .ald-table-container {
9
+ @ald: ~'ald-table-';
10
+
11
+ .@{ald}container {
10
12
  display: flex;
11
13
  flex-direction: column;
12
14
  width: 100%;
13
15
  }
14
16
 
15
- .ald-table-main {
17
+ .@{ald}main {
16
18
  width: 100%;
17
19
  font-size: 13px;
18
20
  line-height: 20px;
19
21
  background: #fff;
20
22
  color: var(--alias-colors-text-subtle, #4b5563);
21
23
 
22
- .ald-table-content {
24
+ .@{ald}content {
23
25
  display: flex;
24
26
  flex-direction: column;
25
27
  border-spacing: 0;
26
28
 
27
- .ald-table-spin {
29
+ .@{ald}spin {
28
30
  position: absolute;
29
31
  top: 0;
30
32
  left: 0;
@@ -38,7 +40,7 @@
38
40
  }
39
41
  }
40
42
 
41
- .ald-table-spin-mask {
43
+ .@{ald}spin-mask {
42
44
  position: absolute;
43
45
  top: 0;
44
46
  left: 0;
@@ -50,7 +52,7 @@
50
52
  }
51
53
  }
52
54
 
53
- .ald-table-resizer {
55
+ .@{ald}resizer {
54
56
  position: absolute;
55
57
  right: 0;
56
58
  top: 0;
@@ -63,38 +65,51 @@
63
65
  &::after {
64
66
  content: '';
65
67
  display: block;
66
- height: 20px;
67
- width: 2px;
68
+ height: 100%;
69
+ width: 1px;
68
70
  position: absolute;
69
71
  top: 50%;
70
72
  right: -1px;
73
+ z-index: 1;
71
74
  transform: translateY(-50%);
72
- background-color: var(--alias-colors-border-subtle, #f3f4f6);
75
+ background-color: var(--alias-colors-border-default, #e5e7eb);
73
76
  }
74
77
  }
75
78
 
76
- .ald-table-overflow-x {
79
+ .@{ald}overflow-x {
77
80
  overflow-x: hidden;
78
81
  }
79
82
 
80
- .ald-table-tr {
83
+ .@{ald}tr {
81
84
  display: flex;
82
85
  }
83
86
 
84
- .ald-table-th,
85
- .ald-table-td {
87
+ .@{ald}th,
88
+ .@{ald}td {
86
89
  position: relative;
87
90
  border-bottom: 1px solid var(--alias-colors-border-subtle, #f3f4f6);
88
91
  flex: 0 0 auto;
89
92
 
90
- &.ald-table-fixed-left,
91
- &.ald-table-fixed-right {
93
+ &.@{ald}fixed-left,
94
+ &.@{ald}fixed-right {
92
95
  position: sticky;
93
- background-color: #fff;
94
96
  z-index: 2;
95
97
  }
96
98
  }
97
99
 
100
+ .@{ald}no-border-tr {
101
+ .@{ald}td {
102
+ border-bottom: none;
103
+ }
104
+ }
105
+
106
+ .@{ald}td {
107
+ &.@{ald}fixed-left,
108
+ &.@{ald}fixed-right {
109
+ background-color: #fff;
110
+ }
111
+ }
112
+
98
113
  .fixed-left-shadow {
99
114
  &::after {
100
115
  position: absolute;
@@ -125,37 +140,37 @@
125
140
  }
126
141
  }
127
142
 
128
- &.ald-table-ping-left {
129
- .ald-table-fixed-left {
143
+ &.@{ald}ping-left {
144
+ .@{ald}fixed-left {
130
145
  .fixed-left-shadow();
131
146
  }
132
147
  }
133
148
 
134
- &.ald-table-ping-right {
135
- .ald-table-fixed-right {
149
+ &.@{ald}ping-right {
150
+ .@{ald}fixed-right {
136
151
  .fixed-right-shadow();
137
152
  }
138
153
  }
139
154
 
140
- .ald-table-th {
141
- border-bottom: 1px solid var(--alias-colors-border-subtle, #f3f4f6);
142
- background-color: #fff;
155
+ .@{ald}th {
156
+ background: var(--alias-colors-bg-skeleton-strong, #f3f4f6);
143
157
  }
144
158
 
145
- .ald-table-th-default {
159
+ .@{ald}th-default {
146
160
  font-weight: 500;
147
161
  line-height: 16px;
148
- padding-left: var(--alias-spacing-200, 16px);
162
+ padding: @td-padding-size;
149
163
  font-size: 12px;
150
164
  overflow: hidden;
151
165
  height: @header-height;
152
166
  display: flex;
153
167
  align-items: center;
168
+ color: var(--alias-colors-text-subtle, #4b5563);
154
169
  }
155
170
 
156
- .ald-table-td-default {
171
+ .@{ald}td-default {
157
172
  line-height: 20px;
158
- padding-left: var(--alias-spacing-200, 16px);
173
+ padding-left: @td-padding-size;
159
174
  display: flex;
160
175
  align-items: center;
161
176
  height: 100%;
@@ -164,27 +179,27 @@
164
179
  overflow: hidden;
165
180
  }
166
181
 
167
- .ald-table-td-ellipsis-content {
182
+ .@{ald}td-ellipsis-content {
168
183
  overflow: hidden;
169
184
  text-overflow: ellipsis;
170
185
  white-space: nowrap;
171
186
  }
172
187
 
173
- .ald-table-sticky {
188
+ .@{ald}sticky {
174
189
  position: sticky;
175
190
  top: 0;
176
191
  // 需要大于 Spin 的 z-index,Spin 的 z-index 为4
177
192
  z-index: 5;
178
193
  }
179
194
 
180
- .ald-table-body {
195
+ .@{ald}body {
181
196
  min-height: 96px;
182
197
 
183
- .ald-table-tr {
184
- &.ald-table-row-hover:hover {
198
+ .@{ald}tr {
199
+ &.@{ald}row-hover:hover {
185
200
  cursor: pointer;
186
201
 
187
- .ald-table-td {
202
+ .@{ald}td {
188
203
  background-color: var(
189
204
  --alias-colors-bg-interaction-hover,
190
205
  rgba(0, 0, 0, 0.05)
@@ -193,9 +208,40 @@
193
208
  }
194
209
  }
195
210
  }
211
+
212
+ @td-padding-size: 16px;
213
+
214
+ /** Tree Table **/
215
+ .@{ald}expandable-td {
216
+ display: flex;
217
+ width: 100%;
218
+ align-items: center;
219
+ padding-left: @td-padding-size;
220
+
221
+ .@{ald}indent-list {
222
+ display: flex;
223
+ }
224
+
225
+ .@{ald}indent-item {
226
+ width: 10px;
227
+ }
228
+
229
+ .@{ald}expand-btn {
230
+ width: 16px;
231
+ cursor: pointer;
232
+ margin-right: 6px;
233
+ display: flex;
234
+ height: 100%;
235
+ align-items: center;
236
+ }
237
+
238
+ .@{ald}td-default {
239
+ padding-left: 0;
240
+ }
241
+ }
196
242
  }
197
243
 
198
- .ald-table-align {
244
+ .@{ald}align {
199
245
  &-left {
200
246
  text-align: left;
201
247
  justify-content: left;
@@ -212,51 +258,56 @@
212
258
  }
213
259
  }
214
260
 
215
- .ald-table-pagination {
216
- margin-top: 18px;
261
+ .@{ald}pagination {
262
+ padding-top: 16px;
217
263
  display: flex;
218
264
  justify-content: end;
265
+ border-top: 1px solid var(--alias-colors-border-default, #e5e7eb);
219
266
  }
220
267
 
221
- .ald-table-loading {
268
+ .@{ald}loading {
222
269
  position: absolute;
223
270
  top: 50%;
224
271
  left: 50%;
225
272
  transform: translate(-50%, -50%);
226
273
 
227
- .ald-table-loading-inner {
274
+ .@{ald}loading-inner {
228
275
  width: 100%;
229
276
  }
230
277
  }
231
278
 
232
- .ald-table-overflow-hidden {
279
+ .@{ald}overflow-hidden {
233
280
  overflow: hidden;
234
281
  height: 100%;
235
282
  }
236
283
 
237
- .ald-table-header {
284
+ .@{ald}header {
238
285
  background-color: #fff;
239
286
  }
240
287
 
241
- .ald-table-header-scroll-placeholder {
288
+ .@{ald}header-scroll-placeholder {
242
289
  height: @header-height;
243
290
  position: sticky;
244
291
  right: 0;
245
- background-color: #fff;
292
+ background: var(--alias-colors-bg-skeleton-strong, #f3f4f6);
246
293
  z-index: 2;
247
294
  flex: 0 0 auto;
248
295
  }
249
296
 
250
- .ald-table-body-scroll {
297
+ .@{ald}body-scroll {
251
298
  overflow: auto;
252
299
  height: 100%;
253
300
 
254
- &.ald-table-scroll-y {
301
+ &.@{ald}scroll-y {
255
302
  overflow-y: scroll;
256
303
  }
257
304
  }
258
305
 
259
- .ald-table-empty {
306
+ .@{ald}empty {
260
307
  margin-top: 80px;
261
308
  overflow: hidden;
309
+
310
+ &.@{ald}empty-small {
311
+ margin-top: 20px;
312
+ }
262
313
  }