@aloudata/aloudata-design 0.2.0-beta.18 → 0.2.0-beta.20

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.
@@ -1,8 +1,13 @@
1
1
  import React, { ReactNode } from 'react';
2
- import type { ShowCountProps, InputProps } from 'antd/lib/input/Input';
3
- import AntdInput from 'antd/lib/input/Input';
2
+ import type { InputProps, InputRef } from 'antd/lib/input/Input';
3
+ interface IShowCountProps {
4
+ formatter: (args: {
5
+ count: number;
6
+ maxLength?: number;
7
+ }) => string;
8
+ }
4
9
  export declare type TSize = 'small' | 'default' | 'large';
5
- export declare type InputRef = React.Ref<AntdInput>;
10
+ export type { InputRef };
6
11
  declare type ChangeEventHandler = (e: React.ChangeEvent<HTMLInputElement>) => void;
7
12
  export interface IInputProps extends Omit<InputProps, 'size' | 'id' | 'prefix' | 'allowClear' | 'disabled' | 'showCount' | 'maxLength' | 'value' | 'defaultValue' | 'onPressEnter' | 'onChange'> {
8
13
  /**
@@ -33,7 +38,7 @@ export interface IInputProps extends Omit<InputProps, 'size' | 'id' | 'prefix' |
33
38
  * @default false
34
39
  * @type boolean | { formatter: (args: { count: number; maxLength?: number; }) => string; };
35
40
  */
36
- showCount?: boolean | ShowCountProps;
41
+ showCount?: boolean | IShowCountProps;
37
42
  /**
38
43
  * @description 最大长度
39
44
  */
@@ -57,5 +62,5 @@ export interface IInputProps extends Omit<InputProps, 'size' | 'id' | 'prefix' |
57
62
  */
58
63
  onChange?: ChangeEventHandler;
59
64
  }
60
- declare const Input: React.ForwardRefExoticComponent<IInputProps & React.RefAttributes<AntdInput>>;
65
+ declare const Input: React.ForwardRefExoticComponent<IInputProps & React.RefAttributes<InputRef>>;
61
66
  export default Input;
@@ -47,14 +47,14 @@ function Menu(props) {
47
47
 
48
48
  if (isOpen) {
49
49
  return /*#__PURE__*/React.createElement(Icon, {
50
- type: "arrow_drop_down",
50
+ type: "arrow_drop_up",
51
51
  size: 20,
52
52
  className: "ald-nav-menu-icon-right"
53
53
  });
54
54
  }
55
55
 
56
56
  return /*#__PURE__*/React.createElement(Icon, {
57
- type: "arrow_drop_up",
57
+ type: "arrow_drop_down",
58
58
  size: 20,
59
59
  className: "ald-nav-menu-icon-right"
60
60
  });
@@ -1,3 +1,4 @@
1
+ import 'antd/lib/checkbox/style';
1
2
  declare const RenderLabelIcon: ({ isSelected, multiple, disabled, prefixCls, isIndeterminate }: {
2
3
  isSelected: boolean;
3
4
  multiple: boolean;
@@ -2,6 +2,7 @@ import "antd/es/checkbox/style";
2
2
  import _Checkbox from "antd/es/checkbox";
3
3
  import React from 'react';
4
4
  import { noop } from 'lodash';
5
+ import 'antd/lib/checkbox/style';
5
6
  import Icon from '../../../Icon';
6
7
 
7
8
  var RenderLabelIcon = function RenderLabelIcon(_ref) {
@@ -161,6 +161,7 @@ var OptionsList = function OptionsList(props, ref) {
161
161
  }, multiple && renderAllOptions(), data.length > ZERO_LENGTH ? data.map(function (option, index) {
162
162
  return /*#__PURE__*/React.createElement(ForwardRenderTooltip, {
163
163
  tooltip: option === null || option === void 0 ? void 0 : option.tooltip,
164
+ key: option === null || option === void 0 ? void 0 : option.value,
164
165
  render: /*#__PURE__*/React.createElement(ForwardRenderOption, _objectSpread({
165
166
  option: option,
166
167
  prefixCls: prefixCls,
@@ -40,6 +40,8 @@ import color from '../../style/themes/default/themeColor.module.less';
40
40
  var ZERO = 0;
41
41
  var ICON_LARGE_SIZE = 20;
42
42
  var ICON_SMALL_SIZE = 16;
43
+ var FIRST_INDEX = 0;
44
+ var REVERSE_INDEX = -1;
43
45
 
44
46
  var defaultArrowComponent = function defaultArrowComponent(prefix, size) {
45
47
  return /*#__PURE__*/React.createElement(Icon, {
@@ -163,14 +165,14 @@ var Selector = function Selector(props, ref) {
163
165
 
164
166
  var renderMultipleValue = function renderMultipleValue() {
165
167
  // @ts-ignore
166
- var allValueLabel = value === null || value === void 0 ? void 0 : value.reduce(function (prev, curr) {
168
+ var allTooltipTitleNode = value === null || value === void 0 ? void 0 : value.reduce(function (prev, curr) {
167
169
  var item = getOptionByValue(curr);
168
170
 
169
171
  if (item) {
170
- return [].concat(_toConsumableArray(prev), [(item === null || item === void 0 ? void 0 : item.title) || (item === null || item === void 0 ? void 0 : item.label)]);
172
+ return [].concat(_toConsumableArray(prev), [(item === null || item === void 0 ? void 0 : item.title) || optionLabelRenderer(curr, getOptionByValue(curr)) || (item === null || item === void 0 ? void 0 : item.label), ',']);
171
173
  }
172
174
 
173
- return [].concat(_toConsumableArray(prev), [curr]);
175
+ return [].concat(_toConsumableArray(prev), [curr, ',']);
174
176
  }, []);
175
177
 
176
178
  if (Array.isArray(value) && value.length === filteredOptions.length && !isEmpty(value)) {
@@ -188,7 +190,7 @@ var Selector = function Selector(props, ref) {
188
190
  return !input && !isNil(value) ? /*#__PURE__*/React.createElement(Tooltip // @ts-ignore
189
191
  , {
190
192
  // @ts-ignore
191
- title: allValueLabel === null || allValueLabel === void 0 ? void 0 : allValueLabel.join(','),
193
+ title: allTooltipTitleNode.slice(FIRST_INDEX, REVERSE_INDEX),
192
194
  placement: "top",
193
195
  getTooltipContainer: function getTooltipContainer() {
194
196
  var _selectorRef$current4;
@@ -117,6 +117,9 @@ export interface ISelectProps {
117
117
  labelRenderer?: (input: string) => (option: IOption, isGroup: boolean) => React.ReactNode;
118
118
  searchPredicate?: (input: string) => _.ListIterateeCustom<IOption, boolean>;
119
119
  matchPredicate?: (input: string) => _.ListIterateeCustom<IOption, boolean>;
120
+ /**
121
+ * @description 渲染选中条目对应的内容
122
+ */
120
123
  optionLabelRenderer?: (value: string | number, option?: IOption) => React.ReactNode;
121
124
  /**
122
125
  * @description 选中值改变时的回调
@@ -465,7 +465,7 @@
465
465
  transform: translateY(-50%);
466
466
  left: 12px;
467
467
  color: @B40;
468
- margin-top: 2px;
468
+ margin-top: -2px;
469
469
 
470
470
  &-checkbox {
471
471
  .@{component-prefix}-checkbox-inner {
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { ITableProps } from './interface';
3
- declare const _default: React.ForwardRefExoticComponent<Pick<ITableProps<Record<string, unknown>>, "onChange" | "loading" | "data" | "columns" | "total" | "renderHeaderLeft" | "renderHeaderRight" | "onRowSelected" | "loadMore" | "hasNextPage" | "sortable" | "defaultSort" | "resizeColumn" | "sortDirections" | "showHeader" | "innerScroll"> & React.RefAttributes<unknown>>;
3
+ declare const _default: React.ForwardRefExoticComponent<Pick<ITableProps<Record<string, unknown>>, "onChange" | "loading" | "data" | "ellipsis" | "columns" | "total" | "renderHeaderLeft" | "renderHeaderRight" | "onRowSelected" | "loadMore" | "hasNextPage" | "sortable" | "defaultSort" | "resizeColumn" | "sortDirections" | "showHeader" | "innerScroll" | "scrollThreshold" | "rowClassName" | "renderEmpty" | "rowKey"> & React.RefAttributes<unknown>>;
4
4
  export default _default;
package/es/Table/index.js CHANGED
@@ -59,7 +59,15 @@ function Table(_ref, ref) {
59
59
  _ref$onChange = _ref.onChange,
60
60
  onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
61
61
  _ref$innerScroll = _ref.innerScroll,
62
- innerScroll = _ref$innerScroll === void 0 ? false : _ref$innerScroll;
62
+ innerScroll = _ref$innerScroll === void 0 ? false : _ref$innerScroll,
63
+ _ref$scrollThreshold = _ref.scrollThreshold,
64
+ scrollThreshold = _ref$scrollThreshold === void 0 ? '150px' : _ref$scrollThreshold,
65
+ _ref$rowClassName = _ref.rowClassName,
66
+ rowClassName = _ref$rowClassName === void 0 ? '' : _ref$rowClassName,
67
+ _ref$ellipsis = _ref.ellipsis,
68
+ ellipsis = _ref$ellipsis === void 0 ? true : _ref$ellipsis,
69
+ renderEmpty = _ref.renderEmpty,
70
+ rowKey = _ref.rowKey;
63
71
 
64
72
  var _React$useState = React.useState(null),
65
73
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -182,6 +190,7 @@ function Table(_ref, ref) {
182
190
  data: data,
183
191
  disableMultiSort: true,
184
192
  disableSortBy: !sortable,
193
+ getRowId: rowKey,
185
194
  initialState: {
186
195
  sortBy: getInitSortBy()
187
196
  }
@@ -358,13 +367,15 @@ function Table(_ref, ref) {
358
367
  }
359
368
 
360
369
  if (!loading && !rows.length) {
361
- return /*#__PURE__*/React.createElement(Empty, {
370
+ return renderEmpty ? renderEmpty() : /*#__PURE__*/React.createElement(Empty, {
362
371
  description: "\u5F53\u524D\u65E0\u6570\u636E"
363
372
  });
364
373
  }
365
374
 
366
375
  var renderRowList = function renderRowList() {
367
376
  return data.map(function (item, index) {
377
+ var _classnames;
378
+
368
379
  var row = rows[index];
369
380
  prepareRow(row);
370
381
 
@@ -374,7 +385,7 @@ function Table(_ref, ref) {
374
385
 
375
386
  return /*#__PURE__*/React.createElement("div", _objectSpread(_objectSpread({}, rowProps), {}, {
376
387
  style: _objectSpread({}, rowStyle),
377
- className: classnames("".concat(prefixCls, "-row"), _defineProperty({}, "".concat(prefixCls, "-row-selected"), row.id === selectedRowId)),
388
+ className: classnames("".concat(prefixCls, "-row"), (_classnames = {}, _defineProperty(_classnames, "".concat(prefixCls, "-row-selected"), row.id === selectedRowId), _defineProperty(_classnames, rowClassName, rowClassName), _defineProperty(_classnames, "".concat(prefixCls, "-row-ellipsis"), ellipsis), _classnames)),
378
389
  onClick: function onClick() {
379
390
  return onRowClick(row);
380
391
  },
@@ -396,7 +407,8 @@ function Table(_ref, ref) {
396
407
  next: loadMore,
397
408
  hasMore: !!hasNextPage,
398
409
  loader: LoadingNode,
399
- scrollableTarget: RANDOM_ID
410
+ scrollableTarget: RANDOM_ID,
411
+ scrollThreshold: scrollThreshold
400
412
  }, renderRowList()) : renderRowList());
401
413
  };
402
414
 
@@ -34,4 +34,9 @@ export interface ITableProps<T extends object> {
34
34
  showHeader?: boolean;
35
35
  innerScroll?: boolean;
36
36
  ref?: React.RefObject<unknown>;
37
+ scrollThreshold?: string | number;
38
+ rowKey?: ((row: any) => string);
39
+ rowClassName?: string;
40
+ ellipsis?: boolean;
41
+ renderEmpty?: () => React.ReactNode;
37
42
  }
@@ -10,7 +10,6 @@
10
10
  width: 100%;
11
11
  height: 100%;
12
12
  overflow: hidden;
13
- user-select: none;
14
13
 
15
14
  &-page-loading {
16
15
  opacity: 0;
@@ -31,9 +30,7 @@
31
30
  text-align: left;
32
31
  border-bottom: 1px solid @NL95;
33
32
  word-break: break-all;
34
- display: flex !important; // 目前都让表格先居左、居中处理,所以这里需要强制设置为flex
35
- padding: 11.5px 12px;
36
- align-items: center;
33
+ padding: 12px;
37
34
 
38
35
  &-content {
39
36
  flex: 1;
@@ -42,6 +39,15 @@
42
39
 
43
40
  &-row {
44
41
  max-width: 100%;
42
+ height: 40px;
43
+
44
+ &-ellipsis {
45
+ .ant-block-table-cell {
46
+ overflow: hidden;
47
+ text-overflow: ellipsis;
48
+ white-space: nowrap;
49
+ }
50
+ }
45
51
  }
46
52
 
47
53
  &-thead {
@@ -52,19 +58,17 @@
52
58
  &-sorting {
53
59
  color: @B40;
54
60
  }
55
- // border: 1px solid red;
56
61
 
57
62
  .ant-block-table-bar {
58
63
  position: absolute;
59
64
  top: 50%;
60
- right: 0;
65
+ right: -12px;
61
66
  z-index: 1;
62
67
  display: inline-block;
63
68
  width: 12px;
64
69
  height: 12px;
65
70
  transform: translateY(-50%);
66
71
  touch-action: none;
67
- padding-left: 5px;
68
72
 
69
73
  &::after {
70
74
  display: block;
@@ -105,12 +109,6 @@
105
109
  background-color: @BBG97;
106
110
  }
107
111
  }
108
-
109
- &:last-of-type {
110
- .ant-block-table-cell {
111
- border-bottom: 1px solid transparent;
112
- }
113
- }
114
112
  }
115
113
  }
116
114
 
@@ -1,8 +1,13 @@
1
1
  import React, { ReactNode } from 'react';
2
- import type { ShowCountProps, InputProps } from 'antd/lib/input/Input';
3
- import AntdInput from 'antd/lib/input/Input';
2
+ import type { InputProps, InputRef } from 'antd/lib/input/Input';
3
+ interface IShowCountProps {
4
+ formatter: (args: {
5
+ count: number;
6
+ maxLength?: number;
7
+ }) => string;
8
+ }
4
9
  export declare type TSize = 'small' | 'default' | 'large';
5
- export declare type InputRef = React.Ref<AntdInput>;
10
+ export type { InputRef };
6
11
  declare type ChangeEventHandler = (e: React.ChangeEvent<HTMLInputElement>) => void;
7
12
  export interface IInputProps extends Omit<InputProps, 'size' | 'id' | 'prefix' | 'allowClear' | 'disabled' | 'showCount' | 'maxLength' | 'value' | 'defaultValue' | 'onPressEnter' | 'onChange'> {
8
13
  /**
@@ -33,7 +38,7 @@ export interface IInputProps extends Omit<InputProps, 'size' | 'id' | 'prefix' |
33
38
  * @default false
34
39
  * @type boolean | { formatter: (args: { count: number; maxLength?: number; }) => string; };
35
40
  */
36
- showCount?: boolean | ShowCountProps;
41
+ showCount?: boolean | IShowCountProps;
37
42
  /**
38
43
  * @description 最大长度
39
44
  */
@@ -57,5 +62,5 @@ export interface IInputProps extends Omit<InputProps, 'size' | 'id' | 'prefix' |
57
62
  */
58
63
  onChange?: ChangeEventHandler;
59
64
  }
60
- declare const Input: React.ForwardRefExoticComponent<IInputProps & React.RefAttributes<AntdInput>>;
65
+ declare const Input: React.ForwardRefExoticComponent<IInputProps & React.RefAttributes<InputRef>>;
61
66
  export default Input;
@@ -64,14 +64,14 @@ function Menu(props) {
64
64
 
65
65
  if (isOpen) {
66
66
  return /*#__PURE__*/_react.default.createElement(_Icon.default, {
67
- type: "arrow_drop_down",
67
+ type: "arrow_drop_up",
68
68
  size: 20,
69
69
  className: "ald-nav-menu-icon-right"
70
70
  });
71
71
  }
72
72
 
73
73
  return /*#__PURE__*/_react.default.createElement(_Icon.default, {
74
- type: "arrow_drop_up",
74
+ type: "arrow_drop_down",
75
75
  size: 20,
76
76
  className: "ald-nav-menu-icon-right"
77
77
  });
@@ -1,3 +1,4 @@
1
+ import 'antd/lib/checkbox/style';
1
2
  declare const RenderLabelIcon: ({ isSelected, multiple, disabled, prefixCls, isIndeterminate }: {
2
3
  isSelected: boolean;
3
4
  multiple: boolean;
@@ -13,6 +13,8 @@ var _react = _interopRequireDefault(require("react"));
13
13
 
14
14
  var _lodash = require("lodash");
15
15
 
16
+ require("antd/lib/checkbox/style");
17
+
16
18
  var _Icon = _interopRequireDefault(require("../../../Icon"));
17
19
 
18
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -178,6 +178,7 @@ var OptionsList = function OptionsList(props, ref) {
178
178
  }, multiple && renderAllOptions(), data.length > ZERO_LENGTH ? data.map(function (option, index) {
179
179
  return /*#__PURE__*/_react.default.createElement(_OptionItem.ForwardRenderTooltip, {
180
180
  tooltip: option === null || option === void 0 ? void 0 : option.tooltip,
181
+ key: option === null || option === void 0 ? void 0 : option.value,
181
182
  render: /*#__PURE__*/_react.default.createElement(_OptionItem.ForwardRenderOption, _objectSpread({
182
183
  option: option,
183
184
  prefixCls: prefixCls,
@@ -62,6 +62,8 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
62
62
  var ZERO = 0;
63
63
  var ICON_LARGE_SIZE = 20;
64
64
  var ICON_SMALL_SIZE = 16;
65
+ var FIRST_INDEX = 0;
66
+ var REVERSE_INDEX = -1;
65
67
 
66
68
  var defaultArrowComponent = function defaultArrowComponent(prefix, size) {
67
69
  return /*#__PURE__*/_react.default.createElement(_Icon.default, {
@@ -185,14 +187,14 @@ var Selector = function Selector(props, ref) {
185
187
 
186
188
  var renderMultipleValue = function renderMultipleValue() {
187
189
  // @ts-ignore
188
- var allValueLabel = value === null || value === void 0 ? void 0 : value.reduce(function (prev, curr) {
190
+ var allTooltipTitleNode = value === null || value === void 0 ? void 0 : value.reduce(function (prev, curr) {
189
191
  var item = getOptionByValue(curr);
190
192
 
191
193
  if (item) {
192
- return [].concat(_toConsumableArray(prev), [(item === null || item === void 0 ? void 0 : item.title) || (item === null || item === void 0 ? void 0 : item.label)]);
194
+ return [].concat(_toConsumableArray(prev), [(item === null || item === void 0 ? void 0 : item.title) || optionLabelRenderer(curr, getOptionByValue(curr)) || (item === null || item === void 0 ? void 0 : item.label), ',']);
193
195
  }
194
196
 
195
- return [].concat(_toConsumableArray(prev), [curr]);
197
+ return [].concat(_toConsumableArray(prev), [curr, ',']);
196
198
  }, []);
197
199
 
198
200
  if (Array.isArray(value) && value.length === filteredOptions.length && !(0, _lodash.isEmpty)(value)) {
@@ -210,7 +212,7 @@ var Selector = function Selector(props, ref) {
210
212
  return !input && !(0, _lodash.isNil)(value) ? /*#__PURE__*/_react.default.createElement(_Tooltip.default // @ts-ignore
211
213
  , {
212
214
  // @ts-ignore
213
- title: allValueLabel === null || allValueLabel === void 0 ? void 0 : allValueLabel.join(','),
215
+ title: allTooltipTitleNode.slice(FIRST_INDEX, REVERSE_INDEX),
214
216
  placement: "top",
215
217
  getTooltipContainer: function getTooltipContainer() {
216
218
  var _selectorRef$current4;
@@ -117,6 +117,9 @@ export interface ISelectProps {
117
117
  labelRenderer?: (input: string) => (option: IOption, isGroup: boolean) => React.ReactNode;
118
118
  searchPredicate?: (input: string) => _.ListIterateeCustom<IOption, boolean>;
119
119
  matchPredicate?: (input: string) => _.ListIterateeCustom<IOption, boolean>;
120
+ /**
121
+ * @description 渲染选中条目对应的内容
122
+ */
120
123
  optionLabelRenderer?: (value: string | number, option?: IOption) => React.ReactNode;
121
124
  /**
122
125
  * @description 选中值改变时的回调
@@ -465,7 +465,7 @@
465
465
  transform: translateY(-50%);
466
466
  left: 12px;
467
467
  color: @B40;
468
- margin-top: 2px;
468
+ margin-top: -2px;
469
469
 
470
470
  &-checkbox {
471
471
  .@{component-prefix}-checkbox-inner {
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { ITableProps } from './interface';
3
- declare const _default: React.ForwardRefExoticComponent<Pick<ITableProps<Record<string, unknown>>, "onChange" | "loading" | "data" | "columns" | "total" | "renderHeaderLeft" | "renderHeaderRight" | "onRowSelected" | "loadMore" | "hasNextPage" | "sortable" | "defaultSort" | "resizeColumn" | "sortDirections" | "showHeader" | "innerScroll"> & React.RefAttributes<unknown>>;
3
+ declare const _default: React.ForwardRefExoticComponent<Pick<ITableProps<Record<string, unknown>>, "onChange" | "loading" | "data" | "ellipsis" | "columns" | "total" | "renderHeaderLeft" | "renderHeaderRight" | "onRowSelected" | "loadMore" | "hasNextPage" | "sortable" | "defaultSort" | "resizeColumn" | "sortDirections" | "showHeader" | "innerScroll" | "scrollThreshold" | "rowClassName" | "renderEmpty" | "rowKey"> & React.RefAttributes<unknown>>;
4
4
  export default _default;
@@ -81,7 +81,15 @@ function Table(_ref, ref) {
81
81
  _ref$onChange = _ref.onChange,
82
82
  onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
83
83
  _ref$innerScroll = _ref.innerScroll,
84
- innerScroll = _ref$innerScroll === void 0 ? false : _ref$innerScroll;
84
+ innerScroll = _ref$innerScroll === void 0 ? false : _ref$innerScroll,
85
+ _ref$scrollThreshold = _ref.scrollThreshold,
86
+ scrollThreshold = _ref$scrollThreshold === void 0 ? '150px' : _ref$scrollThreshold,
87
+ _ref$rowClassName = _ref.rowClassName,
88
+ rowClassName = _ref$rowClassName === void 0 ? '' : _ref$rowClassName,
89
+ _ref$ellipsis = _ref.ellipsis,
90
+ ellipsis = _ref$ellipsis === void 0 ? true : _ref$ellipsis,
91
+ renderEmpty = _ref.renderEmpty,
92
+ rowKey = _ref.rowKey;
85
93
 
86
94
  var _React$useState = _react.default.useState(null),
87
95
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -204,6 +212,7 @@ function Table(_ref, ref) {
204
212
  data: data,
205
213
  disableMultiSort: true,
206
214
  disableSortBy: !sortable,
215
+ getRowId: rowKey,
207
216
  initialState: {
208
217
  sortBy: getInitSortBy()
209
218
  }
@@ -382,13 +391,15 @@ function Table(_ref, ref) {
382
391
  }
383
392
 
384
393
  if (!loading && !rows.length) {
385
- return /*#__PURE__*/_react.default.createElement(_Empty.default, {
394
+ return renderEmpty ? renderEmpty() : /*#__PURE__*/_react.default.createElement(_Empty.default, {
386
395
  description: "\u5F53\u524D\u65E0\u6570\u636E"
387
396
  });
388
397
  }
389
398
 
390
399
  var renderRowList = function renderRowList() {
391
400
  return data.map(function (item, index) {
401
+ var _classnames;
402
+
392
403
  var row = rows[index];
393
404
  prepareRow(row);
394
405
 
@@ -398,7 +409,7 @@ function Table(_ref, ref) {
398
409
 
399
410
  return /*#__PURE__*/_react.default.createElement("div", _objectSpread(_objectSpread({}, rowProps), {}, {
400
411
  style: _objectSpread({}, rowStyle),
401
- className: (0, _classnames7.default)("".concat(prefixCls, "-row"), _defineProperty({}, "".concat(prefixCls, "-row-selected"), row.id === selectedRowId)),
412
+ className: (0, _classnames7.default)("".concat(prefixCls, "-row"), (_classnames = {}, _defineProperty(_classnames, "".concat(prefixCls, "-row-selected"), row.id === selectedRowId), _defineProperty(_classnames, rowClassName, rowClassName), _defineProperty(_classnames, "".concat(prefixCls, "-row-ellipsis"), ellipsis), _classnames)),
402
413
  onClick: function onClick() {
403
414
  return onRowClick(row);
404
415
  },
@@ -420,7 +431,8 @@ function Table(_ref, ref) {
420
431
  next: loadMore,
421
432
  hasMore: !!hasNextPage,
422
433
  loader: LoadingNode,
423
- scrollableTarget: RANDOM_ID
434
+ scrollableTarget: RANDOM_ID,
435
+ scrollThreshold: scrollThreshold
424
436
  }, renderRowList()) : renderRowList());
425
437
  };
426
438
 
@@ -34,4 +34,9 @@ export interface ITableProps<T extends object> {
34
34
  showHeader?: boolean;
35
35
  innerScroll?: boolean;
36
36
  ref?: React.RefObject<unknown>;
37
+ scrollThreshold?: string | number;
38
+ rowKey?: ((row: any) => string);
39
+ rowClassName?: string;
40
+ ellipsis?: boolean;
41
+ renderEmpty?: () => React.ReactNode;
37
42
  }
@@ -10,7 +10,6 @@
10
10
  width: 100%;
11
11
  height: 100%;
12
12
  overflow: hidden;
13
- user-select: none;
14
13
 
15
14
  &-page-loading {
16
15
  opacity: 0;
@@ -31,9 +30,7 @@
31
30
  text-align: left;
32
31
  border-bottom: 1px solid @NL95;
33
32
  word-break: break-all;
34
- display: flex !important; // 目前都让表格先居左、居中处理,所以这里需要强制设置为flex
35
- padding: 11.5px 12px;
36
- align-items: center;
33
+ padding: 12px;
37
34
 
38
35
  &-content {
39
36
  flex: 1;
@@ -42,6 +39,15 @@
42
39
 
43
40
  &-row {
44
41
  max-width: 100%;
42
+ height: 40px;
43
+
44
+ &-ellipsis {
45
+ .ant-block-table-cell {
46
+ overflow: hidden;
47
+ text-overflow: ellipsis;
48
+ white-space: nowrap;
49
+ }
50
+ }
45
51
  }
46
52
 
47
53
  &-thead {
@@ -52,19 +58,17 @@
52
58
  &-sorting {
53
59
  color: @B40;
54
60
  }
55
- // border: 1px solid red;
56
61
 
57
62
  .ant-block-table-bar {
58
63
  position: absolute;
59
64
  top: 50%;
60
- right: 0;
65
+ right: -12px;
61
66
  z-index: 1;
62
67
  display: inline-block;
63
68
  width: 12px;
64
69
  height: 12px;
65
70
  transform: translateY(-50%);
66
71
  touch-action: none;
67
- padding-left: 5px;
68
72
 
69
73
  &::after {
70
74
  display: block;
@@ -105,12 +109,6 @@
105
109
  background-color: @BBG97;
106
110
  }
107
111
  }
108
-
109
- &:last-of-type {
110
- .ant-block-table-cell {
111
- border-bottom: 1px solid transparent;
112
- }
113
- }
114
112
  }
115
113
  }
116
114
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aloudata/aloudata-design",
3
- "version": "0.2.0-beta.18",
3
+ "version": "0.2.0-beta.20",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -85,7 +85,7 @@
85
85
  "eslint-plugin-jsx-a11y": "^6.4.1",
86
86
  "eslint-plugin-react": "^7.24.0",
87
87
  "eslint-plugin-react-hooks": "^4.2.0",
88
- "father-build": "^1.21.2",
88
+ "father-build": "^1.22.1",
89
89
  "gh-pages": "^3.0.0",
90
90
  "husky": "^3.0.9",
91
91
  "lint-staged": "^10.0.7",