@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
@@ -79,6 +79,33 @@ class Copyable extends _react.default.PureComponent {
79
79
  }, locale => /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement(_semiIcons.IconTick, null), locale.copied));
80
80
  };
81
81
 
82
+ this.renderCopyIcon = () => {
83
+ const {
84
+ icon
85
+ } = this.props;
86
+ const copyProps = {
87
+ role: "button",
88
+ tabIndex: 0,
89
+ onClick: this.copy,
90
+ onKeyPress: e => (0, _isEnterPress.default)(e) && this.copy(e)
91
+ };
92
+ {
93
+ /* TODO: replace `a` tag with `span` in next major version
94
+ NOTE: may have effect on style */
95
+ }
96
+
97
+ const defaultIcon =
98
+ /*#__PURE__*/
99
+ // eslint-disable-next-line jsx-a11y/anchor-is-valid
100
+ _react.default.createElement("a", {
101
+ className: `${prefixCls}-action-copy-icon`
102
+ }, /*#__PURE__*/_react.default.createElement(_semiIcons.IconCopy, Object.assign({
103
+ onClick: this.copy
104
+ }, copyProps)));
105
+
106
+ return /*#__PURE__*/_react.default.isValidElement(icon) ? /*#__PURE__*/_react.default.cloneElement(icon, copyProps) : defaultIcon;
107
+ };
108
+
82
109
  this.state = {
83
110
  copied: false,
84
111
  item: ''
@@ -116,14 +143,7 @@ class Copyable extends _react.default.PureComponent {
116
143
  ref: forwardRef
117
144
  }, copied ? this.renderSuccessTip() : /*#__PURE__*/_react.default.createElement(_index.default, {
118
145
  content: typeof copyTip !== 'undefined' ? copyTip : locale.copy
119
- }, /*#__PURE__*/_react.default.createElement("a", {
120
- className: `${prefixCls}-action-copy-icon`
121
- }, /*#__PURE__*/_react.default.createElement(_semiIcons.IconCopy, {
122
- role: "button",
123
- tabIndex: 0,
124
- onClick: this.copy,
125
- onKeyPress: e => (0, _isEnterPress.default)(e) && this.copy(e)
126
- })))));
146
+ }, this.renderCopyIcon())));
127
147
  }
128
148
 
129
149
  }
@@ -136,7 +156,8 @@ Copyable.propTypes = {
136
156
  copyTip: _propTypes.default.node,
137
157
  duration: _propTypes.default.number,
138
158
  style: _propTypes.default.object,
139
- className: _propTypes.default.string
159
+ className: _propTypes.default.string,
160
+ icon: _propTypes.default.node
140
161
  };
141
162
  Copyable.defaultProps = {
142
163
  content: '',
@@ -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;
@@ -889,7 +889,8 @@ class Cascader extends BaseComponent {
889
889
  onChange: this.handleInputChange
890
890
  };
891
891
  const wrappercls = cls({
892
- [`${prefixcls}-search-wrapper`]: true
892
+ [`${prefixcls}-search-wrapper`]: true,
893
+ [`${prefixcls}-search-wrapper-${size}`]: size !== 'default'
893
894
  });
894
895
  const displayText = this.renderDisplayText();
895
896
  const spanCls = cls({
@@ -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/es/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;
@@ -38,7 +38,6 @@ import BaseRow from './BaseRow';
38
38
  import ExpandedRow from './ExpandedRow';
39
39
  import SectionRow from './SectionRow';
40
40
  import TableHeader from '../TableHeader';
41
- import ConfigContext from '../../configProvider/context';
42
41
  import TableContext from '../table-context';
43
42
 
44
43
  class Body extends BaseComponent {
@@ -804,12 +803,10 @@ class Body extends BaseComponent {
804
803
  const {
805
804
  virtualized
806
805
  } = this.props;
807
- return /*#__PURE__*/React.createElement(ConfigContext.Consumer, null, _ref => {
808
- let {
809
- direction
810
- } = _ref;
811
- return virtualized ? this.renderVirtualizedBody(direction) : this.renderBody(direction);
812
- });
806
+ const {
807
+ direction
808
+ } = this.context;
809
+ return virtualized ? this.renderVirtualizedBody(direction) : this.renderBody(direction);
813
810
  }
814
811
 
815
812
  }
@@ -269,8 +269,9 @@ class Table extends BaseComponent {
269
269
  const node = this.bodyWrapRef.current;
270
270
 
271
271
  if (node && node.children && node.children.length) {
272
- const scrollToLeft = node.scrollLeft === 0;
273
- const scrollToRight = node.scrollLeft + 1 >= node.children[0].getBoundingClientRect().width - node.getBoundingClientRect().width;
272
+ const scrollToLeft = node.scrollLeft === 0; // why use Math.abs? @see https://bugzilla.mozilla.org/show_bug.cgi?id=1447743
273
+
274
+ const scrollToRight = Math.abs(node.scrollLeft) + 1 >= node.children[0].getBoundingClientRect().width - node.getBoundingClientRect().width;
274
275
 
275
276
  if (scrollToLeft && scrollToRight) {
276
277
  this.setScrollPosition('both');
@@ -1461,11 +1462,13 @@ class Table extends BaseComponent {
1461
1462
  });
1462
1463
  return /*#__PURE__*/React.createElement("div", {
1463
1464
  ref: this.rootWrapRef,
1464
- className: classnames(className, `${prefixCls}-wrapper`),
1465
+ className: classnames(className, `${prefixCls}-wrapper`, `${prefixCls}-wrapper-${props.direction}`),
1465
1466
  "data-column-fixed": anyColumnFixed,
1466
1467
  style: wrapStyle,
1467
1468
  id: id
1468
- }, /*#__PURE__*/React.createElement(TableContextProvider, Object.assign({}, tableContextValue), /*#__PURE__*/React.createElement(Spin, {
1469
+ }, /*#__PURE__*/React.createElement(TableContextProvider, Object.assign({}, tableContextValue, {
1470
+ direction: props.direction
1471
+ }), /*#__PURE__*/React.createElement(Spin, {
1469
1472
  spinning: loading,
1470
1473
  size: "large"
1471
1474
  }, /*#__PURE__*/React.createElement("div", {
@@ -13,7 +13,7 @@ import classnames from 'classnames';
13
13
  import PropTypes from 'prop-types';
14
14
  import { cssClasses, numbers } from '@douyinfe/semi-foundation/lib/es/table/constants';
15
15
  import TableCellFoundation from '@douyinfe/semi-foundation/lib/es/table/cellFoundation';
16
- import { isSelectionColumn, isExpandedColumn } from '@douyinfe/semi-foundation/lib/es/table/utils';
16
+ import { isSelectionColumn, isExpandedColumn, getRTLAlign } from '@douyinfe/semi-foundation/lib/es/table/utils';
17
17
  import BaseComponent from '../_base/baseComponent';
18
18
  import Context from './table-context';
19
19
  import { amendTableWidth } from './utils';
@@ -121,13 +121,17 @@ export default class TableCell extends BaseComponent {
121
121
  } = this.props;
122
122
  let tdProps = {};
123
123
  let customCellProps = {};
124
+ const {
125
+ direction
126
+ } = this.context;
127
+ const isRTL = direction === 'rtl';
124
128
  const fixedLeftFlag = fixedLeft || typeof fixedLeft === 'number';
125
129
  const fixedRightFlag = fixedRight || typeof fixedRight === 'number';
126
130
 
127
131
  if (fixedLeftFlag) {
128
- _set(tdProps, 'style.left', typeof fixedLeft === 'number' ? fixedLeft : 0);
132
+ _set(tdProps, isRTL ? 'style.right' : 'style.left', typeof fixedLeft === 'number' ? fixedLeft : 0);
129
133
  } else if (fixedRightFlag) {
130
- _set(tdProps, 'style.right', typeof fixedRight === 'number' ? fixedRight : 0);
134
+ _set(tdProps, isRTL ? 'style.left' : 'style.right', typeof fixedRight === 'number' ? fixedRight : 0);
131
135
  }
132
136
 
133
137
  if (width != null) {
@@ -147,8 +151,9 @@ export default class TableCell extends BaseComponent {
147
151
  }
148
152
 
149
153
  if (column.align) {
154
+ const textAlign = getRTLAlign(column.align, direction);
150
155
  tdProps.style = Object.assign(Object.assign({}, tdProps.style), {
151
- textAlign: column.align
156
+ textAlign
152
157
  });
153
158
  }
154
159
 
@@ -286,6 +291,10 @@ export default class TableCell extends BaseComponent {
286
291
  firstFixedRight,
287
292
  colIndex
288
293
  } = this.props;
294
+ const {
295
+ direction
296
+ } = this.context;
297
+ const isRTL = direction === 'rtl';
289
298
  const {
290
299
  className
291
300
  } = column;
@@ -316,11 +325,25 @@ export default class TableCell extends BaseComponent {
316
325
  }
317
326
 
318
327
  const inner = this.renderInner(text, indentText, realExpandIcon);
328
+ let isFixedLeft, isFixedLeftLast, isFixedRight, isFixedRightFirst;
329
+
330
+ if (isRTL) {
331
+ isFixedLeft = fixedRightFlag;
332
+ isFixedLeftLast = firstFixedRight;
333
+ isFixedRight = fixedLeftFlag;
334
+ isFixedRightFirst = lastFixedLeft;
335
+ } else {
336
+ isFixedLeft = fixedLeftFlag;
337
+ isFixedLeftLast = lastFixedLeft;
338
+ isFixedRight = fixedRightFlag;
339
+ isFixedRightFirst = firstFixedRight;
340
+ }
341
+
319
342
  const columnCls = classnames(className, `${prefixCls}-row-cell`, _get(customCellProps, 'className'), {
320
- [`${prefixCls}-cell-fixed-left`]: fixedLeftFlag,
321
- [`${prefixCls}-cell-fixed-left-last`]: lastFixedLeft,
322
- [`${prefixCls}-cell-fixed-right`]: fixedRightFlag,
323
- [`${prefixCls}-cell-fixed-right-first`]: firstFixedRight
343
+ [`${prefixCls}-cell-fixed-left`]: isFixedLeft,
344
+ [`${prefixCls}-cell-fixed-left-last`]: isFixedLeftLast,
345
+ [`${prefixCls}-cell-fixed-right`]: isFixedRight,
346
+ [`${prefixCls}-cell-fixed-right-first`]: isFixedRightFirst
324
347
  });
325
348
  return /*#__PURE__*/React.createElement(BodyCell, Object.assign({
326
349
  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;
@@ -15,7 +15,8 @@ const TableContextProvider = _ref => {
15
15
  renderExpandIcon,
16
16
  renderSelection,
17
17
  getVirtualizedListRef,
18
- setBodyHasScrollbar
18
+ setBodyHasScrollbar,
19
+ direction
19
20
  } = _ref;
20
21
  const tableContextValue = useMemo(() => ({
21
22
  anyColumnFixed,
@@ -29,8 +30,9 @@ const TableContextProvider = _ref => {
29
30
  tableWidth,
30
31
  handleRowExpanded,
31
32
  getVirtualizedListRef,
32
- setBodyHasScrollbar
33
- }), [anyColumnFixed, flattenedColumns, renderExpandIcon, renderSelection, setHeadWidths, getHeadWidths, getCellWidths, headWidths, tableWidth, handleRowExpanded, getVirtualizedListRef, setBodyHasScrollbar]);
33
+ setBodyHasScrollbar,
34
+ direction
35
+ }), [anyColumnFixed, flattenedColumns, renderExpandIcon, renderSelection, setHeadWidths, getHeadWidths, getCellWidths, headWidths, tableWidth, handleRowExpanded, getVirtualizedListRef, setBodyHasScrollbar, direction]);
34
36
  return /*#__PURE__*/React.createElement(Context.Provider, {
35
37
  value: tableContextValue
36
38
  }, children);
@@ -22,7 +22,7 @@ import React from 'react';
22
22
  import classnames from 'classnames';
23
23
  import PropTypes from 'prop-types';
24
24
  import { cssClasses } from '@douyinfe/semi-foundation/lib/es/table/constants';
25
- import { arrayAdd, isFirstFixedRight, isLastLeftFixed, isFixedLeft, isFixedRight, sliceColumnsByLevel } from '@douyinfe/semi-foundation/lib/es/table/utils';
25
+ import { arrayAdd, isFirstFixedRight, isLastLeftFixed, isFixedLeft, isFixedRight, sliceColumnsByLevel, getRTLAlign } from '@douyinfe/semi-foundation/lib/es/table/utils';
26
26
  import BaseComponent from '../_base/baseComponent';
27
27
  import TableContext from './table-context';
28
28
  export default class TableHeaderRow extends BaseComponent {
@@ -81,8 +81,10 @@ export default class TableHeaderRow extends BaseComponent {
81
81
  columns
82
82
  } = this.props;
83
83
  const {
84
- getCellWidths
84
+ getCellWidths,
85
+ direction
85
86
  } = this.context;
87
+ const isRTL = direction === 'rtl';
86
88
  const slicedColumns = sliceColumnsByLevel(columns, index);
87
89
  const headWidths = getCellWidths(slicedColumns);
88
90
 
@@ -104,20 +106,35 @@ export default class TableHeaderRow extends BaseComponent {
104
106
  let cellStyle = Object.assign({}, customProps.style);
105
107
 
106
108
  if (column.align) {
109
+ const textAlign = getRTLAlign(column.align, direction);
107
110
  cellStyle = Object.assign(Object.assign({}, cellStyle), {
108
- textAlign: column.align
111
+ textAlign
109
112
  });
110
113
  customProps.className = classnames(customProps.className, column.className, {
111
- [`${prefixCls}-align-${column.align}`]: Boolean(column.align)
114
+ [`${prefixCls}-align-${textAlign}`]: Boolean(textAlign)
112
115
  });
113
116
  }
114
117
 
118
+ let fixedLeft, fixedRight, fixedLeftLast, fixedRightFirst;
119
+
120
+ if (isRTL) {
121
+ fixedLeft = isFixedRight(column);
122
+ fixedRight = isFixedLeft(column);
123
+ fixedLeftLast = isFirstFixedRight(slicedColumns, column);
124
+ fixedRightFirst = isLastLeftFixed(slicedColumns, column);
125
+ } else {
126
+ fixedLeft = isFixedLeft(column);
127
+ fixedRight = isFixedRight(column);
128
+ fixedLeftLast = isLastLeftFixed(slicedColumns, column);
129
+ fixedRightFirst = isFirstFixedRight(slicedColumns, column);
130
+ }
131
+
115
132
  customProps.className = classnames(`${prefixCls}-row-head`, column.className, customProps.className, // `${prefixCls}-fixed-columns`,
116
133
  {
117
- [`${prefixCls}-cell-fixed-left`]: isFixedLeft(column),
118
- [`${prefixCls}-cell-fixed-left-last`]: isLastLeftFixed(slicedColumns, column),
119
- [`${prefixCls}-cell-fixed-right`]: isFixedRight(column),
120
- [`${prefixCls}-cell-fixed-right-first`]: isFirstFixedRight(slicedColumns, column)
134
+ [`${prefixCls}-cell-fixed-left`]: fixedLeft,
135
+ [`${prefixCls}-cell-fixed-left-last`]: fixedLeftLast,
136
+ [`${prefixCls}-cell-fixed-right`]: fixedRight,
137
+ [`${prefixCls}-cell-fixed-right-first`]: fixedRightFirst
121
138
  });
122
139
 
123
140
  if (headWidths.length && slicedColumns.length) {
@@ -125,14 +142,16 @@ export default class TableHeaderRow extends BaseComponent {
125
142
 
126
143
  if (indexOfSlicedColumns > -1) {
127
144
  if (isFixedLeft(column)) {
145
+ const xPositionKey = isRTL ? 'right' : 'left';
128
146
  cellStyle = Object.assign(Object.assign({}, cellStyle), {
129
147
  position: 'sticky',
130
- left: arrayAdd(headWidths, 0, indexOfSlicedColumns)
148
+ [xPositionKey]: arrayAdd(headWidths, 0, indexOfSlicedColumns)
131
149
  });
132
150
  } else if (isFixedRight(column)) {
151
+ const xPositionKey = isRTL ? 'left' : 'right';
133
152
  cellStyle = Object.assign(Object.assign({}, cellStyle), {
134
153
  position: 'sticky',
135
- right: arrayAdd(headWidths, indexOfSlicedColumns + 1)
154
+ [xPositionKey]: arrayAdd(headWidths, indexOfSlicedColumns + 1)
136
155
  });
137
156
  }
138
157
  }
@@ -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;
@@ -4,6 +4,7 @@ import NormalTable from './Table';
4
4
  import ResizableTable from './ResizableTable';
5
5
  import Column from './Column';
6
6
  import { strings } from '@douyinfe/semi-foundation/lib/es/table/constants';
7
+ import ConfigContext from '../configProvider/context';
7
8
 
8
9
  class Table extends React.PureComponent {
9
10
  constructor(props) {
@@ -15,16 +16,21 @@ class Table extends React.PureComponent {
15
16
  }
16
17
 
17
18
  render() {
18
- // eslint-disable-next-line prefer-destructuring
19
+ var _a; // eslint-disable-next-line prefer-destructuring
20
+
21
+
19
22
  const props = this.props;
23
+ const direction = (_a = this.props.direction) !== null && _a !== void 0 ? _a : this.context.direction;
20
24
 
21
25
  if (props.resizable) {
22
26
  return /*#__PURE__*/React.createElement(ResizableTable, Object.assign({}, props, {
23
- ref: this.tableRef
27
+ ref: this.tableRef,
28
+ direction: direction
24
29
  }));
25
30
  } else {
26
31
  return /*#__PURE__*/React.createElement(NormalTable, Object.assign({}, props, {
27
- ref: this.tableRef
32
+ ref: this.tableRef,
33
+ direction: direction
28
34
  }));
29
35
  }
30
36
  }
@@ -40,5 +46,6 @@ Table.propTypes = Object.assign(Object.assign({}, NormalTable.propTypes), {
40
46
  Table.defaultProps = {
41
47
  hideExpandedColumn: true
42
48
  };
49
+ Table.contextType = ConfigContext;
43
50
  export * from './interface';
44
51
  export default Table;
@@ -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/es/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;
@@ -21,6 +21,7 @@ import Avatar from '../avatar/index';
21
21
  import { IconClose } from '@douyinfe/semi-icons';
22
22
  import { handlePrevent } from '@douyinfe/semi-foundation/lib/es/utils/a11y';
23
23
  import '@douyinfe/semi-foundation/lib/es/tag/tag.css';
24
+ import cls from 'classnames';
24
25
  export * from './interface';
25
26
  const prefixCls = cssClasses.PREFIX;
26
27
  const tagColors = strings.TAG_COLOR;
@@ -169,10 +170,14 @@ export default class Tag extends Component {
169
170
  }, /*#__PURE__*/React.createElement(IconClose, {
170
171
  size: "small"
171
172
  })) : null;
173
+
174
+ const stringChild = _isString(children);
175
+
176
+ const contentCls = cls(`${prefixCls}-content`, `${prefixCls}-content-${stringChild ? 'ellipsis' : 'center'}`);
172
177
  return /*#__PURE__*/React.createElement("div", Object.assign({
173
- "aria-label": this.props['aria-label'] || _isString(children) ? `${closable ? 'Closable ' : ''}Tag: ${children}` : ''
178
+ "aria-label": this.props['aria-label'] || stringChild ? `${closable ? 'Closable ' : ''}Tag: ${children}` : ''
174
179
  }, wrapProps), avatarSrc ? this.renderAvatar() : null, /*#__PURE__*/React.createElement("div", {
175
- className: `${prefixCls}-content`
180
+ className: contentCls
176
181
  }, children), closeIcon);
177
182
  }
178
183
 
@@ -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;
@@ -140,15 +140,13 @@ class TagInput extends BaseComponent {
140
140
  key: elementKey,
141
141
  visible: true,
142
142
  "aria-label": `${!disabled ? 'Closable ' : ''}Tag: ${value}`
143
- }, /*#__PURE__*/React.createElement("div", {
144
- className: `${prefixCls}-tag-content-wrapper`
145
143
  }, showIconHandler && /*#__PURE__*/React.createElement(DragHandle, null), /*#__PURE__*/React.createElement(Paragraph, {
146
144
  className: typoCls,
147
145
  ellipsis: {
148
146
  showTooltip: showContentTooltip,
149
147
  rows: 1
150
148
  }
151
- }, value)));
149
+ }, value));
152
150
  }
153
151
  });
154
152
  };
@@ -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>;