@douyinfe/semi-ui 2.30.2 → 2.31.0-beta.0

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 (69) hide show
  1. package/dist/css/semi.css +66 -51
  2. package/dist/css/semi.min.css +1 -1
  3. package/dist/umd/semi-ui.js +186 -64
  4. package/dist/umd/semi-ui.js.map +1 -1
  5. package/dist/umd/semi-ui.min.js +1 -1
  6. package/dist/umd/semi-ui.min.js.map +1 -1
  7. package/lib/cjs/_base/base.d.ts +3 -3
  8. package/lib/cjs/anchor/index.d.ts +1 -1
  9. package/lib/cjs/autoComplete/index.d.ts +1 -1
  10. package/lib/cjs/button/Button.d.ts +1 -1
  11. package/lib/cjs/cascader/index.js +2 -1
  12. package/lib/cjs/checkbox/checkbox.d.ts +1 -1
  13. package/lib/cjs/checkbox/checkboxGroup.d.ts +1 -1
  14. package/lib/cjs/descriptions/index.d.ts +1 -1
  15. package/lib/cjs/layout/index.d.ts +1 -1
  16. package/lib/cjs/modal/confirm.d.ts +1 -1
  17. package/lib/cjs/popover/index.d.ts +1 -0
  18. package/lib/cjs/progress/index.d.ts +3 -3
  19. package/lib/cjs/radio/radio.d.ts +1 -1
  20. package/lib/cjs/table/Body/index.js +4 -8
  21. package/lib/cjs/table/Table.js +7 -4
  22. package/lib/cjs/table/TableCell.js +30 -7
  23. package/lib/cjs/table/TableContextProvider.d.ts +1 -1
  24. package/lib/cjs/table/TableContextProvider.js +5 -3
  25. package/lib/cjs/table/TableHeaderRow.js +28 -9
  26. package/lib/cjs/table/index.d.ts +3 -0
  27. package/lib/cjs/table/index.js +11 -3
  28. package/lib/cjs/table/interface.d.ts +1 -0
  29. package/lib/cjs/table/table-context.d.ts +2 -0
  30. package/lib/cjs/tabs/interface.d.ts +1 -1
  31. package/lib/cjs/tag/index.js +4 -2
  32. package/lib/cjs/tagInput/index.d.ts +1 -1
  33. package/lib/cjs/tagInput/index.js +1 -3
  34. package/lib/cjs/tooltip/index.d.ts +4 -0
  35. package/lib/cjs/tooltip/index.js +21 -6
  36. package/lib/cjs/typography/copyable.d.ts +3 -0
  37. package/lib/cjs/typography/copyable.js +30 -9
  38. package/lib/es/_base/base.d.ts +3 -3
  39. package/lib/es/anchor/index.d.ts +1 -1
  40. package/lib/es/autoComplete/index.d.ts +1 -1
  41. package/lib/es/button/Button.d.ts +1 -1
  42. package/lib/es/cascader/index.js +2 -1
  43. package/lib/es/checkbox/checkbox.d.ts +1 -1
  44. package/lib/es/checkbox/checkboxGroup.d.ts +1 -1
  45. package/lib/es/descriptions/index.d.ts +1 -1
  46. package/lib/es/layout/index.d.ts +1 -1
  47. package/lib/es/modal/confirm.d.ts +1 -1
  48. package/lib/es/popover/index.d.ts +1 -0
  49. package/lib/es/progress/index.d.ts +3 -3
  50. package/lib/es/radio/radio.d.ts +1 -1
  51. package/lib/es/table/Body/index.js +4 -7
  52. package/lib/es/table/Table.js +7 -4
  53. package/lib/es/table/TableCell.js +31 -8
  54. package/lib/es/table/TableContextProvider.d.ts +1 -1
  55. package/lib/es/table/TableContextProvider.js +5 -3
  56. package/lib/es/table/TableHeaderRow.js +29 -10
  57. package/lib/es/table/index.d.ts +3 -0
  58. package/lib/es/table/index.js +10 -3
  59. package/lib/es/table/interface.d.ts +1 -0
  60. package/lib/es/table/table-context.d.ts +2 -0
  61. package/lib/es/tabs/interface.d.ts +1 -1
  62. package/lib/es/tag/index.js +7 -2
  63. package/lib/es/tagInput/index.d.ts +1 -1
  64. package/lib/es/tagInput/index.js +1 -3
  65. package/lib/es/tooltip/index.d.ts +4 -0
  66. package/lib/es/tooltip/index.js +21 -6
  67. package/lib/es/typography/copyable.d.ts +3 -0
  68. package/lib/es/typography/copyable.js +28 -9
  69. package/package.json +8 -8
@@ -25,8 +25,8 @@ export interface MotionChildrenProps {
25
25
  animationFillMode?: string;
26
26
  };
27
27
  animateEvents?: {
28
- onAnimationIteration?: React.AnimationEventHandler<any> | undefined;
29
- onAnimationStart?: React.AnimationEventHandler<any> | undefined;
30
- onAnimationEnd?: React.AnimationEventHandler<any> | undefined;
28
+ onAnimationIteration?: React.AnimationEventHandler<any>;
29
+ onAnimationStart?: React.AnimationEventHandler<any>;
30
+ onAnimationEnd?: React.AnimationEventHandler<any>;
31
31
  };
32
32
  }
@@ -11,7 +11,7 @@ export type { LinkProps } from './link';
11
11
  export interface AnchorProps {
12
12
  autoCollapse?: boolean;
13
13
  className?: string;
14
- children?: ReactNode | undefined;
14
+ children?: ReactNode;
15
15
  defaultAnchor?: string;
16
16
  getContainer?: () => HTMLElement | Window;
17
17
  maxHeight?: string | number;
@@ -27,7 +27,7 @@ export interface AutoCompleteProps<T extends AutoCompleteItems> {
27
27
  autoFocus?: boolean;
28
28
  className?: string;
29
29
  clearIcon?: ReactNode;
30
- children?: ReactNode | undefined;
30
+ children?: ReactNode;
31
31
  data?: T[];
32
32
  disabled?: boolean;
33
33
  defaultOpen?: boolean;
@@ -10,7 +10,7 @@ export interface ButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonE
10
10
  id?: string;
11
11
  block?: boolean;
12
12
  circle?: boolean;
13
- children?: ReactNode | undefined;
13
+ children?: ReactNode;
14
14
  disabled?: boolean;
15
15
  className?: string;
16
16
  icon?: React.ReactNode;
@@ -937,7 +937,8 @@ class Cascader extends _baseComponent.default {
937
937
  onChange: this.handleInputChange
938
938
  };
939
939
  const wrappercls = (0, _classnames.default)({
940
- [`${prefixcls}-search-wrapper`]: true
940
+ [`${prefixcls}-search-wrapper`]: true,
941
+ [`${prefixcls}-search-wrapper-${size}`]: size !== 'default'
941
942
  });
942
943
  const displayText = this.renderDisplayText();
943
944
  const spanCls = (0, _classnames.default)({
@@ -18,7 +18,7 @@ export interface CheckboxProps extends BaseCheckboxProps {
18
18
  'aria-invalid'?: React.AriaAttributes['aria-invalid'];
19
19
  'aria-labelledby'?: React.AriaAttributes['aria-labelledby'];
20
20
  'aria-required'?: React.AriaAttributes['aria-required'];
21
- children?: React.ReactNode | undefined;
21
+ children?: React.ReactNode;
22
22
  onChange?: (e: CheckboxEvent) => any;
23
23
  style?: React.CSSProperties;
24
24
  onMouseEnter?: React.MouseEventHandler<HTMLSpanElement>;
@@ -17,7 +17,7 @@ export declare type CheckboxGroupProps = {
17
17
  options?: any[];
18
18
  value?: any[];
19
19
  onChange?: (value: any[]) => void;
20
- children?: React.ReactNode | undefined;
20
+ children?: React.ReactNode;
21
21
  prefixCls?: string;
22
22
  direction?: CheckboxDirection;
23
23
  style?: React.CSSProperties;
@@ -16,7 +16,7 @@ export interface DescriptionsProps {
16
16
  size?: DescriptionsSize;
17
17
  style?: React.CSSProperties;
18
18
  className?: string;
19
- children?: React.ReactNode | undefined;
19
+ children?: React.ReactNode;
20
20
  data?: Data[];
21
21
  }
22
22
  declare class Descriptions extends PureComponent<DescriptionsProps> {
@@ -16,7 +16,7 @@ export interface BasicLayoutProps {
16
16
  prefixCls?: string;
17
17
  style?: CSSProperties;
18
18
  className?: string;
19
- children?: React.ReactNode | undefined;
19
+ children?: React.ReactNode;
20
20
  hasSider?: boolean;
21
21
  tagName?: keyof HTMLElementTagNameMap;
22
22
  }
@@ -160,12 +160,12 @@ export declare function withError(props: ModalReactProps): {
160
160
  closeOnEsc?: boolean;
161
161
  preventScroll?: boolean;
162
162
  afterClose?: () => void;
163
+ keepDOM?: boolean;
163
164
  cancelText?: string;
164
165
  okText?: string;
165
166
  closeIcon?: React.ReactNode;
166
167
  bodyStyle?: React.CSSProperties;
167
168
  closable?: boolean;
168
- keepDOM?: boolean;
169
169
  onCancel?: (e: React.MouseEvent<Element, MouseEvent>) => void | Promise<any>;
170
170
  maskClosable?: boolean;
171
171
  cancelButtonProps?: import("../button").BaseButtonProps;
@@ -42,6 +42,7 @@ export interface PopoverProps extends BaseProps {
42
42
  clickToHide?: TooltipProps['clickToHide'];
43
43
  disableFocusListener?: boolean;
44
44
  afterClose?: () => void;
45
+ keepDOM?: boolean;
45
46
  }
46
47
  export interface PopoverState {
47
48
  popConfirmVisible: boolean;
@@ -5,9 +5,9 @@ import { Animation } from '@douyinfe/semi-animation';
5
5
  import { Motion } from '../_base/base';
6
6
  import { StrokeArr } from '@douyinfe/semi-foundation/lib/cjs/progress/generates';
7
7
  export interface ProgressProps {
8
- 'aria-label'?: string | undefined;
9
- 'aria-labelledby'?: string | undefined;
10
- 'aria-valuetext'?: string | undefined;
8
+ 'aria-label'?: string;
9
+ 'aria-labelledby'?: string;
10
+ 'aria-valuetext'?: string;
11
11
  className?: string;
12
12
  direction?: 'horizontal' | 'vertical';
13
13
  format?: (percent: number) => React.ReactNode;
@@ -12,7 +12,7 @@ export declare type RadioType = typeof strings.TYPE_DEFAULT | typeof strings.TYP
12
12
  export declare type RadioProps = {
13
13
  autoFocus?: boolean;
14
14
  checked?: boolean;
15
- children?: React.ReactNode | undefined;
15
+ children?: React.ReactNode;
16
16
  defaultChecked?: boolean;
17
17
  value?: string | number;
18
18
  disabled?: boolean;
@@ -49,8 +49,6 @@ var _SectionRow = _interopRequireDefault(require("./SectionRow"));
49
49
 
50
50
  var _TableHeader = _interopRequireDefault(require("../TableHeader"));
51
51
 
52
- var _context = _interopRequireDefault(require("../../configProvider/context"));
53
-
54
52
  var _tableContext = _interopRequireDefault(require("../table-context"));
55
53
 
56
54
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -814,12 +812,10 @@ class Body extends _baseComponent.default {
814
812
  const {
815
813
  virtualized
816
814
  } = this.props;
817
- return /*#__PURE__*/_react.default.createElement(_context.default.Consumer, null, _ref => {
818
- let {
819
- direction
820
- } = _ref;
821
- return virtualized ? this.renderVirtualizedBody(direction) : this.renderBody(direction);
822
- });
815
+ const {
816
+ direction
817
+ } = this.context;
818
+ return virtualized ? this.renderVirtualizedBody(direction) : this.renderBody(direction);
823
819
  }
824
820
 
825
821
  }
@@ -317,8 +317,9 @@ class Table extends _baseComponent.default {
317
317
  const node = this.bodyWrapRef.current;
318
318
 
319
319
  if (node && node.children && node.children.length) {
320
- const scrollToLeft = node.scrollLeft === 0;
321
- const scrollToRight = node.scrollLeft + 1 >= node.children[0].getBoundingClientRect().width - node.getBoundingClientRect().width;
320
+ const scrollToLeft = node.scrollLeft === 0; // why use Math.abs? @see https://bugzilla.mozilla.org/show_bug.cgi?id=1447743
321
+
322
+ const scrollToRight = Math.abs(node.scrollLeft) + 1 >= node.children[0].getBoundingClientRect().width - node.getBoundingClientRect().width;
322
323
 
323
324
  if (scrollToLeft && scrollToRight) {
324
325
  this.setScrollPosition('both');
@@ -1500,11 +1501,13 @@ class Table extends _baseComponent.default {
1500
1501
  });
1501
1502
  return /*#__PURE__*/_react.default.createElement("div", {
1502
1503
  ref: this.rootWrapRef,
1503
- className: (0, _classnames.default)(className, `${prefixCls}-wrapper`),
1504
+ className: (0, _classnames.default)(className, `${prefixCls}-wrapper`, `${prefixCls}-wrapper-${props.direction}`),
1504
1505
  "data-column-fixed": anyColumnFixed,
1505
1506
  style: wrapStyle,
1506
1507
  id: id
1507
- }, /*#__PURE__*/_react.default.createElement(_TableContextProvider.default, Object.assign({}, tableContextValue), /*#__PURE__*/_react.default.createElement(_spin.default, {
1508
+ }, /*#__PURE__*/_react.default.createElement(_TableContextProvider.default, Object.assign({}, tableContextValue, {
1509
+ direction: props.direction
1510
+ }), /*#__PURE__*/_react.default.createElement(_spin.default, {
1508
1511
  spinning: loading,
1509
1512
  size: "large"
1510
1513
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -145,13 +145,17 @@ class TableCell extends _baseComponent.default {
145
145
  } = this.props;
146
146
  let tdProps = {};
147
147
  let customCellProps = {};
148
+ const {
149
+ direction
150
+ } = this.context;
151
+ const isRTL = direction === 'rtl';
148
152
  const fixedLeftFlag = fixedLeft || typeof fixedLeft === 'number';
149
153
  const fixedRightFlag = fixedRight || typeof fixedRight === 'number';
150
154
 
151
155
  if (fixedLeftFlag) {
152
- (0, _set2.default)(tdProps, 'style.left', typeof fixedLeft === 'number' ? fixedLeft : 0);
156
+ (0, _set2.default)(tdProps, isRTL ? 'style.right' : 'style.left', typeof fixedLeft === 'number' ? fixedLeft : 0);
153
157
  } else if (fixedRightFlag) {
154
- (0, _set2.default)(tdProps, 'style.right', typeof fixedRight === 'number' ? fixedRight : 0);
158
+ (0, _set2.default)(tdProps, isRTL ? 'style.left' : 'style.right', typeof fixedRight === 'number' ? fixedRight : 0);
155
159
  }
156
160
 
157
161
  if (width != null) {
@@ -171,8 +175,9 @@ class TableCell extends _baseComponent.default {
171
175
  }
172
176
 
173
177
  if (column.align) {
178
+ const textAlign = (0, _utils.getRTLAlign)(column.align, direction);
174
179
  tdProps.style = Object.assign(Object.assign({}, tdProps.style), {
175
- textAlign: column.align
180
+ textAlign
176
181
  });
177
182
  }
178
183
 
@@ -310,6 +315,10 @@ class TableCell extends _baseComponent.default {
310
315
  firstFixedRight,
311
316
  colIndex
312
317
  } = this.props;
318
+ const {
319
+ direction
320
+ } = this.context;
321
+ const isRTL = direction === 'rtl';
313
322
  const {
314
323
  className
315
324
  } = column;
@@ -340,11 +349,25 @@ class TableCell extends _baseComponent.default {
340
349
  }
341
350
 
342
351
  const inner = this.renderInner(text, indentText, realExpandIcon);
352
+ let isFixedLeft, isFixedLeftLast, isFixedRight, isFixedRightFirst;
353
+
354
+ if (isRTL) {
355
+ isFixedLeft = fixedRightFlag;
356
+ isFixedLeftLast = firstFixedRight;
357
+ isFixedRight = fixedLeftFlag;
358
+ isFixedRightFirst = lastFixedLeft;
359
+ } else {
360
+ isFixedLeft = fixedLeftFlag;
361
+ isFixedLeftLast = lastFixedLeft;
362
+ isFixedRight = fixedRightFlag;
363
+ isFixedRightFirst = firstFixedRight;
364
+ }
365
+
343
366
  const columnCls = (0, _classnames.default)(className, `${prefixCls}-row-cell`, (0, _get2.default)(customCellProps, 'className'), {
344
- [`${prefixCls}-cell-fixed-left`]: fixedLeftFlag,
345
- [`${prefixCls}-cell-fixed-left-last`]: lastFixedLeft,
346
- [`${prefixCls}-cell-fixed-right`]: fixedRightFlag,
347
- [`${prefixCls}-cell-fixed-right-first`]: firstFixedRight
367
+ [`${prefixCls}-cell-fixed-left`]: isFixedLeft,
368
+ [`${prefixCls}-cell-fixed-left-last`]: isFixedLeftLast,
369
+ [`${prefixCls}-cell-fixed-right`]: isFixedRight,
370
+ [`${prefixCls}-cell-fixed-right-first`]: isFixedRightFirst
348
371
  });
349
372
  return /*#__PURE__*/_react.default.createElement(BodyCell, Object.assign({
350
373
  role: "gridcell",
@@ -1,3 +1,3 @@
1
1
  import { TableContextProps } from './table-context';
2
- declare const TableContextProvider: ({ children, anyColumnFixed, flattenedColumns, tableWidth, headWidths, setHeadWidths, getHeadWidths, getCellWidths, handleRowExpanded, renderExpandIcon, renderSelection, getVirtualizedListRef, setBodyHasScrollbar, }: TableContextProps) => JSX.Element;
2
+ declare const TableContextProvider: ({ children, anyColumnFixed, flattenedColumns, tableWidth, headWidths, setHeadWidths, getHeadWidths, getCellWidths, handleRowExpanded, renderExpandIcon, renderSelection, getVirtualizedListRef, setBodyHasScrollbar, direction }: TableContextProps) => JSX.Element;
3
3
  export default TableContextProvider;
@@ -29,7 +29,8 @@ const TableContextProvider = _ref => {
29
29
  renderExpandIcon,
30
30
  renderSelection,
31
31
  getVirtualizedListRef,
32
- setBodyHasScrollbar
32
+ setBodyHasScrollbar,
33
+ direction
33
34
  } = _ref;
34
35
  const tableContextValue = (0, _react.useMemo)(() => ({
35
36
  anyColumnFixed,
@@ -43,8 +44,9 @@ const TableContextProvider = _ref => {
43
44
  tableWidth,
44
45
  handleRowExpanded,
45
46
  getVirtualizedListRef,
46
- setBodyHasScrollbar
47
- }), [anyColumnFixed, flattenedColumns, renderExpandIcon, renderSelection, setHeadWidths, getHeadWidths, getCellWidths, headWidths, tableWidth, handleRowExpanded, getVirtualizedListRef, setBodyHasScrollbar]);
47
+ setBodyHasScrollbar,
48
+ direction
49
+ }), [anyColumnFixed, flattenedColumns, renderExpandIcon, renderSelection, setHeadWidths, getHeadWidths, getCellWidths, headWidths, tableWidth, handleRowExpanded, getVirtualizedListRef, setBodyHasScrollbar, direction]);
48
50
  return /*#__PURE__*/_react.default.createElement(_tableContext.default.Provider, {
49
51
  value: tableContextValue
50
52
  }, children);
@@ -101,8 +101,10 @@ class TableHeaderRow extends _baseComponent.default {
101
101
  columns
102
102
  } = this.props;
103
103
  const {
104
- getCellWidths
104
+ getCellWidths,
105
+ direction
105
106
  } = this.context;
107
+ const isRTL = direction === 'rtl';
106
108
  const slicedColumns = (0, _utils.sliceColumnsByLevel)(columns, index);
107
109
  const headWidths = getCellWidths(slicedColumns);
108
110
  const HeaderRow = (0, _get2.default)(components, 'header.row', 'tr');
@@ -119,20 +121,35 @@ class TableHeaderRow extends _baseComponent.default {
119
121
  let cellStyle = Object.assign({}, customProps.style);
120
122
 
121
123
  if (column.align) {
124
+ const textAlign = (0, _utils.getRTLAlign)(column.align, direction);
122
125
  cellStyle = Object.assign(Object.assign({}, cellStyle), {
123
- textAlign: column.align
126
+ textAlign
124
127
  });
125
128
  customProps.className = (0, _classnames.default)(customProps.className, column.className, {
126
- [`${prefixCls}-align-${column.align}`]: Boolean(column.align)
129
+ [`${prefixCls}-align-${textAlign}`]: Boolean(textAlign)
127
130
  });
128
131
  }
129
132
 
133
+ let fixedLeft, fixedRight, fixedLeftLast, fixedRightFirst;
134
+
135
+ if (isRTL) {
136
+ fixedLeft = (0, _utils.isFixedRight)(column);
137
+ fixedRight = (0, _utils.isFixedLeft)(column);
138
+ fixedLeftLast = (0, _utils.isFirstFixedRight)(slicedColumns, column);
139
+ fixedRightFirst = (0, _utils.isLastLeftFixed)(slicedColumns, column);
140
+ } else {
141
+ fixedLeft = (0, _utils.isFixedLeft)(column);
142
+ fixedRight = (0, _utils.isFixedRight)(column);
143
+ fixedLeftLast = (0, _utils.isLastLeftFixed)(slicedColumns, column);
144
+ fixedRightFirst = (0, _utils.isFirstFixedRight)(slicedColumns, column);
145
+ }
146
+
130
147
  customProps.className = (0, _classnames.default)(`${prefixCls}-row-head`, column.className, customProps.className, // `${prefixCls}-fixed-columns`,
131
148
  {
132
- [`${prefixCls}-cell-fixed-left`]: (0, _utils.isFixedLeft)(column),
133
- [`${prefixCls}-cell-fixed-left-last`]: (0, _utils.isLastLeftFixed)(slicedColumns, column),
134
- [`${prefixCls}-cell-fixed-right`]: (0, _utils.isFixedRight)(column),
135
- [`${prefixCls}-cell-fixed-right-first`]: (0, _utils.isFirstFixedRight)(slicedColumns, column)
149
+ [`${prefixCls}-cell-fixed-left`]: fixedLeft,
150
+ [`${prefixCls}-cell-fixed-left-last`]: fixedLeftLast,
151
+ [`${prefixCls}-cell-fixed-right`]: fixedRight,
152
+ [`${prefixCls}-cell-fixed-right-first`]: fixedRightFirst
136
153
  });
137
154
 
138
155
  if (headWidths.length && slicedColumns.length) {
@@ -140,14 +157,16 @@ class TableHeaderRow extends _baseComponent.default {
140
157
 
141
158
  if (indexOfSlicedColumns > -1) {
142
159
  if ((0, _utils.isFixedLeft)(column)) {
160
+ const xPositionKey = isRTL ? 'right' : 'left';
143
161
  cellStyle = Object.assign(Object.assign({}, cellStyle), {
144
162
  position: 'sticky',
145
- left: (0, _utils.arrayAdd)(headWidths, 0, indexOfSlicedColumns)
163
+ [xPositionKey]: (0, _utils.arrayAdd)(headWidths, 0, indexOfSlicedColumns)
146
164
  });
147
165
  } else if ((0, _utils.isFixedRight)(column)) {
166
+ const xPositionKey = isRTL ? 'left' : 'right';
148
167
  cellStyle = Object.assign(Object.assign({}, cellStyle), {
149
168
  position: 'sticky',
150
- right: (0, _utils.arrayAdd)(headWidths, indexOfSlicedColumns + 1)
169
+ [xPositionKey]: (0, _utils.arrayAdd)(headWidths, indexOfSlicedColumns + 1)
151
170
  });
152
171
  }
153
172
  }
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
3
3
  import NormalTable from './Table';
4
4
  import Column from './Column';
5
5
  import { TableProps, Data } from './interface';
6
+ import { ContextValue } from '../configProvider/context';
6
7
  declare class Table<RecordType extends Record<string, any> = Data> extends React.PureComponent<TableProps<RecordType>> {
7
8
  static Column: typeof Column;
8
9
  static DEFAULT_KEY_COLUMN_SELECTION: "column-selection";
@@ -91,7 +92,9 @@ declare class Table<RecordType extends Record<string, any> = Data> extends React
91
92
  static defaultProps: {
92
93
  hideExpandedColumn: boolean;
93
94
  };
95
+ static contextType: React.Context<ContextValue>;
94
96
  tableRef: React.RefObject<NormalTable<RecordType>>;
97
+ context: ContextValue;
95
98
  constructor(props: TableProps);
96
99
  getCurrentPageData: () => any;
97
100
  render(): JSX.Element;
@@ -18,6 +18,8 @@ var _Column = _interopRequireDefault(require("./Column"));
18
18
 
19
19
  var _constants = require("@douyinfe/semi-foundation/lib/cjs/table/constants");
20
20
 
21
+ var _context = _interopRequireDefault(require("../configProvider/context"));
22
+
21
23
  var _interface = require("./interface");
22
24
 
23
25
  Object.keys(_interface).forEach(function (key) {
@@ -44,16 +46,21 @@ class Table extends _react.default.PureComponent {
44
46
  }
45
47
 
46
48
  render() {
47
- // eslint-disable-next-line prefer-destructuring
49
+ var _a; // eslint-disable-next-line prefer-destructuring
50
+
51
+
48
52
  const props = this.props;
53
+ const direction = (_a = this.props.direction) !== null && _a !== void 0 ? _a : this.context.direction;
49
54
 
50
55
  if (props.resizable) {
51
56
  return /*#__PURE__*/_react.default.createElement(_ResizableTable.default, Object.assign({}, props, {
52
- ref: this.tableRef
57
+ ref: this.tableRef,
58
+ direction: direction
53
59
  }));
54
60
  } else {
55
61
  return /*#__PURE__*/_react.default.createElement(_Table.default, Object.assign({}, props, {
56
- ref: this.tableRef
62
+ ref: this.tableRef,
63
+ direction: direction
57
64
  }));
58
65
  }
59
66
  }
@@ -69,5 +76,6 @@ Table.propTypes = Object.assign(Object.assign({}, _Table.default.propTypes), {
69
76
  Table.defaultProps = {
70
77
  hideExpandedColumn: true
71
78
  };
79
+ Table.contextType = _context.default;
72
80
  var _default = Table;
73
81
  exports.default = _default;
@@ -56,6 +56,7 @@ export interface TableProps<RecordType extends Record<string, any> = any> extend
56
56
  onHeaderRow?: OnHeaderRow<RecordType>;
57
57
  onRow?: OnRow<RecordType>;
58
58
  sticky?: Sticky;
59
+ direction?: Direction;
59
60
  }
60
61
  export interface ColumnProps<RecordType extends Record<string, any> = any> {
61
62
  [x: string]: any;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { ColumnProps, GetVirtualizedListRef, RowKey } from './interface';
3
3
  import { BaseHeadWidth } from '@douyinfe/semi-foundation/lib/cjs/table/foundation';
4
+ import type { ContextValue } from '../configProvider/context';
4
5
  export interface TableContextProps {
5
6
  children?: React.ReactNode;
6
7
  anyColumnFixed?: boolean;
@@ -15,6 +16,7 @@ export interface TableContextProps {
15
16
  renderSelection?: (record?: Record<string, any>, isHeader?: boolean) => React.ReactNode;
16
17
  getVirtualizedListRef?: GetVirtualizedListRef;
17
18
  setBodyHasScrollbar?: (bodyHasScrollBar: boolean) => void;
19
+ direction?: ContextValue['direction'];
18
20
  }
19
21
  declare const TableContext: React.Context<TableContextProps>;
20
22
  export default TableContext;
@@ -54,7 +54,7 @@ export interface TabBarProps {
54
54
  }
55
55
  export interface TabPaneProps {
56
56
  className?: string;
57
- children?: React.ReactNode | undefined;
57
+ children?: React.ReactNode;
58
58
  disabled?: boolean;
59
59
  icon?: ReactNode;
60
60
  itemKey?: string;
@@ -207,10 +207,12 @@ class Tag extends _react.Component {
207
207
  }, /*#__PURE__*/_react.default.createElement(_semiIcons.IconClose, {
208
208
  size: "small"
209
209
  })) : null;
210
+ const stringChild = (0, _isString2.default)(children);
211
+ const contentCls = (0, _classnames.default)(`${prefixCls}-content`, `${prefixCls}-content-${stringChild ? 'ellipsis' : 'center'}`);
210
212
  return /*#__PURE__*/_react.default.createElement("div", Object.assign({
211
- "aria-label": this.props['aria-label'] || (0, _isString2.default)(children) ? `${closable ? 'Closable ' : ''}Tag: ${children}` : ''
213
+ "aria-label": this.props['aria-label'] || stringChild ? `${closable ? 'Closable ' : ''}Tag: ${children}` : ''
212
214
  }, wrapProps), avatarSrc ? this.renderAvatar() : null, /*#__PURE__*/_react.default.createElement("div", {
213
- className: `${prefixCls}-content`
215
+ className: contentCls
214
216
  }, children), closeIcon);
215
217
  }
216
218
 
@@ -46,7 +46,7 @@ export interface TagInputProps {
46
46
  style?: React.CSSProperties;
47
47
  suffix?: React.ReactNode;
48
48
  validateStatus?: ValidateStatus;
49
- value?: string[] | undefined;
49
+ value?: string[];
50
50
  autoFocus?: boolean;
51
51
  'aria-label'?: string;
52
52
  preventScroll?: boolean;
@@ -169,15 +169,13 @@ class TagInput extends _baseComponent.default {
169
169
  key: elementKey,
170
170
  visible: true,
171
171
  "aria-label": `${!disabled ? 'Closable ' : ''}Tag: ${value}`
172
- }, /*#__PURE__*/_react.default.createElement("div", {
173
- className: `${prefixCls}-tag-content-wrapper`
174
172
  }, showIconHandler && /*#__PURE__*/_react.default.createElement(DragHandle, null), /*#__PURE__*/_react.default.createElement(_paragraph.default, {
175
173
  className: typoCls,
176
174
  ellipsis: {
177
175
  showTooltip: showContentTooltip,
178
176
  rows: 1
179
177
  }
180
- }, value)));
178
+ }, value));
181
179
  }
182
180
  });
183
181
  };
@@ -63,6 +63,7 @@ export interface TooltipProps extends BaseProps {
63
63
  preventScroll?: boolean;
64
64
  disableFocusListener?: boolean;
65
65
  afterClose?: () => void;
66
+ keepDOM?: boolean;
66
67
  }
67
68
  interface TooltipState {
68
69
  visible: boolean;
@@ -79,6 +80,7 @@ interface TooltipState {
79
80
  transitionStyle: Record<string, any>;
80
81
  isPositionUpdated: boolean;
81
82
  id: string;
83
+ displayNone: boolean;
82
84
  }
83
85
  export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
84
86
  static contextType: React.Context<ContextValue>;
@@ -120,6 +122,7 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
120
122
  guardFocus: PropTypes.Requireable<boolean>;
121
123
  returnFocusOnClose: PropTypes.Requireable<boolean>;
122
124
  preventScroll: PropTypes.Requireable<boolean>;
125
+ keepDOM: PropTypes.Requireable<boolean>;
123
126
  };
124
127
  static defaultProps: {
125
128
  arrowBounding: {
@@ -151,6 +154,7 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
151
154
  onEscKeyDown: (...args: any[]) => void;
152
155
  disableFocusListener: boolean;
153
156
  disableArrowKeyDown: boolean;
157
+ keepDOM: boolean;
154
158
  };
155
159
  eventManager: Event;
156
160
  triggerEl: React.RefObject<unknown>;
@@ -125,7 +125,12 @@ class Tooltip extends _baseComponent.default {
125
125
 
126
126
 
127
127
  this.didLeave = () => {
128
- this.foundation.removePortal();
128
+ if (this.props.keepDOM) {
129
+ this.foundation.setDisplayNone(true);
130
+ } else {
131
+ this.foundation.removePortal();
132
+ }
133
+
129
134
  this.foundation.unBindEvent();
130
135
  };
131
136
 
@@ -193,6 +198,7 @@ class Tooltip extends _baseComponent.default {
193
198
  visible,
194
199
  portalEventSet,
195
200
  placement,
201
+ displayNone,
196
202
  transitionState,
197
203
  id,
198
204
  isPositionUpdated
@@ -244,7 +250,9 @@ class Tooltip extends _baseComponent.default {
244
250
  } = _ref;
245
251
  return /*#__PURE__*/_react.default.createElement("div", Object.assign({
246
252
  className: (0, _classnames.default)(className, animationClassName),
247
- style: Object.assign(Object.assign(Object.assign(Object.assign({}, animationStyle), {
253
+ style: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, animationStyle), displayNone ? {
254
+ display: "none"
255
+ } : {}), {
248
256
  transformOrigin
249
257
  }), style), {
250
258
  opacity: isPositionUpdated ? opacity : "0"
@@ -330,8 +338,8 @@ class Tooltip extends _baseComponent.default {
330
338
  placement: props.position || 'top',
331
339
  transitionStyle: {},
332
340
  isPositionUpdated: false,
333
- id: props.wrapperId // auto generate id, will be used by children.aria-describedby & content.id, improve a11y
334
-
341
+ id: props.wrapperId,
342
+ displayNone: false
335
343
  };
336
344
  this.foundation = new _foundation.default(this.adapter);
337
345
  this.eventManager = new _Event.default();
@@ -455,6 +463,11 @@ class Tooltip extends _baseComponent.default {
455
463
  this.eventManager.emit('positionUpdated');
456
464
  });
457
465
  },
466
+ setDisplayNone: (displayNone, cb) => {
467
+ this.setState({
468
+ displayNone
469
+ }, cb);
470
+ },
458
471
  updatePlacementAttr: placement => {
459
472
  this.setState({
460
473
  placement
@@ -763,7 +776,8 @@ Tooltip.propTypes = {
763
776
  wrapWhenSpecial: _propTypes.default.bool,
764
777
  guardFocus: _propTypes.default.bool,
765
778
  returnFocusOnClose: _propTypes.default.bool,
766
- preventScroll: _propTypes.default.bool
779
+ preventScroll: _propTypes.default.bool,
780
+ keepDOM: _propTypes.default.bool
767
781
  };
768
782
  Tooltip.defaultProps = {
769
783
  arrowBounding: _constants2.numbers.ARROW_BOUNDING,
@@ -789,5 +803,6 @@ Tooltip.defaultProps = {
789
803
  returnFocusOnClose: false,
790
804
  onEscKeyDown: _noop2.default,
791
805
  disableFocusListener: false,
792
- disableArrowKeyDown: false
806
+ disableArrowKeyDown: false,
807
+ keepDOM: false
793
808
  };
@@ -8,6 +8,7 @@ export interface CopyableProps extends BaseProps {
8
8
  duration?: number;
9
9
  forwardRef?: React.RefObject<any>;
10
10
  successTip?: React.ReactNode;
11
+ icon?: React.ReactNode;
11
12
  onCopy?: (e: React.MouseEvent, content: string, res: boolean) => void;
12
13
  }
13
14
  interface CopyableState {
@@ -23,6 +24,7 @@ export declare class Copyable extends React.PureComponent<CopyableProps, Copyabl
23
24
  duration: PropTypes.Requireable<number>;
24
25
  style: PropTypes.Requireable<object>;
25
26
  className: PropTypes.Requireable<string>;
27
+ icon: PropTypes.Requireable<PropTypes.ReactNodeLike>;
26
28
  };
27
29
  static defaultProps: {
28
30
  content: string;
@@ -38,6 +40,7 @@ export declare class Copyable extends React.PureComponent<CopyableProps, Copyabl
38
40
  setCopied: (item: string, timer: number) => void;
39
41
  resetCopied: () => void;
40
42
  renderSuccessTip: () => string | number | boolean | React.ReactFragment | JSX.Element;
43
+ renderCopyIcon: () => JSX.Element;
41
44
  render(): JSX.Element;
42
45
  }
43
46
  export default Copyable;