@douyinfe/semi-ui 2.30.2 → 2.31.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 (97) 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 +298 -132
  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/carousel/index.d.ts +1 -0
  12. package/lib/cjs/carousel/index.js +17 -1
  13. package/lib/cjs/cascader/index.js +2 -1
  14. package/lib/cjs/checkbox/checkbox.d.ts +1 -1
  15. package/lib/cjs/checkbox/checkboxGroup.d.ts +1 -1
  16. package/lib/cjs/descriptions/index.d.ts +1 -1
  17. package/lib/cjs/form/baseForm.d.ts +1 -1
  18. package/lib/cjs/form/field.d.ts +1 -1
  19. package/lib/cjs/image/previewInner.d.ts +1 -2
  20. package/lib/cjs/image/previewInner.js +5 -6
  21. package/lib/cjs/layout/index.d.ts +1 -1
  22. package/lib/cjs/modal/confirm.d.ts +1 -1
  23. package/lib/cjs/popconfirm/index.js +10 -1
  24. package/lib/cjs/popover/index.d.ts +1 -0
  25. package/lib/cjs/progress/index.d.ts +3 -3
  26. package/lib/cjs/radio/radio.d.ts +1 -1
  27. package/lib/cjs/select/index.d.ts +2 -2
  28. package/lib/cjs/select/index.js +3 -7
  29. package/lib/cjs/select/virtualRow.js +3 -2
  30. package/lib/cjs/table/Body/index.js +4 -8
  31. package/lib/cjs/table/ColumnSelection.d.ts +4 -3
  32. package/lib/cjs/table/Table.d.ts +9 -1
  33. package/lib/cjs/table/Table.js +30 -11
  34. package/lib/cjs/table/TableCell.js +30 -7
  35. package/lib/cjs/table/TableContextProvider.d.ts +1 -1
  36. package/lib/cjs/table/TableContextProvider.js +5 -3
  37. package/lib/cjs/table/TableHeaderRow.js +28 -9
  38. package/lib/cjs/table/index.d.ts +3 -0
  39. package/lib/cjs/table/index.js +11 -3
  40. package/lib/cjs/table/interface.d.ts +1 -0
  41. package/lib/cjs/table/table-context.d.ts +2 -0
  42. package/lib/cjs/tabs/interface.d.ts +1 -1
  43. package/lib/cjs/tag/index.js +4 -2
  44. package/lib/cjs/tagInput/index.d.ts +1 -1
  45. package/lib/cjs/tagInput/index.js +1 -3
  46. package/lib/cjs/tooltip/index.d.ts +4 -0
  47. package/lib/cjs/tooltip/index.js +21 -6
  48. package/lib/cjs/treeSelect/index.d.ts +1 -1
  49. package/lib/cjs/treeSelect/index.js +18 -18
  50. package/lib/cjs/typography/copyable.d.ts +3 -0
  51. package/lib/cjs/typography/copyable.js +30 -9
  52. package/lib/es/_base/base.d.ts +3 -3
  53. package/lib/es/anchor/index.d.ts +1 -1
  54. package/lib/es/autoComplete/index.d.ts +1 -1
  55. package/lib/es/button/Button.d.ts +1 -1
  56. package/lib/es/carousel/index.d.ts +1 -0
  57. package/lib/es/carousel/index.js +16 -2
  58. package/lib/es/cascader/index.js +2 -1
  59. package/lib/es/checkbox/checkbox.d.ts +1 -1
  60. package/lib/es/checkbox/checkboxGroup.d.ts +1 -1
  61. package/lib/es/descriptions/index.d.ts +1 -1
  62. package/lib/es/form/baseForm.d.ts +1 -1
  63. package/lib/es/form/field.d.ts +1 -1
  64. package/lib/es/image/previewInner.d.ts +1 -2
  65. package/lib/es/image/previewInner.js +5 -6
  66. package/lib/es/layout/index.d.ts +1 -1
  67. package/lib/es/modal/confirm.d.ts +1 -1
  68. package/lib/es/popconfirm/index.js +10 -1
  69. package/lib/es/popover/index.d.ts +1 -0
  70. package/lib/es/progress/index.d.ts +3 -3
  71. package/lib/es/radio/radio.d.ts +1 -1
  72. package/lib/es/select/index.d.ts +2 -2
  73. package/lib/es/select/index.js +3 -6
  74. package/lib/es/select/virtualRow.js +3 -2
  75. package/lib/es/table/Body/index.js +4 -7
  76. package/lib/es/table/ColumnSelection.d.ts +4 -3
  77. package/lib/es/table/Table.d.ts +9 -1
  78. package/lib/es/table/Table.js +30 -11
  79. package/lib/es/table/TableCell.js +31 -8
  80. package/lib/es/table/TableContextProvider.d.ts +1 -1
  81. package/lib/es/table/TableContextProvider.js +5 -3
  82. package/lib/es/table/TableHeaderRow.js +29 -10
  83. package/lib/es/table/index.d.ts +3 -0
  84. package/lib/es/table/index.js +10 -3
  85. package/lib/es/table/interface.d.ts +1 -0
  86. package/lib/es/table/table-context.d.ts +2 -0
  87. package/lib/es/tabs/interface.d.ts +1 -1
  88. package/lib/es/tag/index.js +7 -2
  89. package/lib/es/tagInput/index.d.ts +1 -1
  90. package/lib/es/tagInput/index.js +1 -3
  91. package/lib/es/tooltip/index.d.ts +4 -0
  92. package/lib/es/tooltip/index.js +21 -6
  93. package/lib/es/treeSelect/index.d.ts +1 -1
  94. package/lib/es/treeSelect/index.js +17 -18
  95. package/lib/es/typography/copyable.d.ts +3 -0
  96. package/lib/es/typography/copyable.js +28 -9
  97. package/package.json +8 -8
@@ -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> {
@@ -83,7 +83,7 @@ declare class Form<Values extends Record<string, any> = any> extends BaseCompone
83
83
  onDropdownVisibleChange?: (visible: boolean) => void;
84
84
  zIndex?: number;
85
85
  position?: "left" | "top" | "right" | "bottom" | "topLeft" | "topRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver";
86
- onSearch?: (value: string) => void;
86
+ onSearch?: (value: string, event: React.KeyboardEvent<Element> | React.MouseEvent<Element, MouseEvent>) => void;
87
87
  dropdownClassName?: string;
88
88
  dropdownStyle?: React.CSSProperties;
89
89
  dropdownMargin?: number | {
@@ -31,7 +31,7 @@ declare const FormSelect: import("react").ComponentType<import("utility-types").
31
31
  onDropdownVisibleChange?: (visible: boolean) => void;
32
32
  zIndex?: number;
33
33
  position?: "left" | "top" | "right" | "bottom" | "topLeft" | "topRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver";
34
- onSearch?: (value: string) => void;
34
+ onSearch?: (value: string, event: import("react").KeyboardEvent<Element> | import("react").MouseEvent<Element, MouseEvent>) => void;
35
35
  dropdownClassName?: string;
36
36
  dropdownStyle?: import("react").CSSProperties;
37
37
  dropdownMargin?: number | {
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import BaseComponent from "../_base/baseComponent";
3
- import { PreviewProps as PreviewInnerProps, PreviewInnerStates, RatioType } from "./interface";
3
+ import { PreviewProps as PreviewInnerProps, PreviewInnerStates } from "./interface";
4
4
  import PropTypes from "prop-types";
5
5
  import PreviewInnerFoundation, { PreviewInnerAdapter } from '@douyinfe/semi-foundation/lib/es/image/previewInnerFoundation';
6
6
  import { PreviewContextProps } from "./previewContext";
@@ -87,6 +87,5 @@ export default class PreviewInner extends BaseComponent<PreviewInnerProps, Previ
87
87
  onImageError: () => void;
88
88
  onImageLoad: (src: any) => void;
89
89
  handleMouseDown: (e: any) => void;
90
- handleRatio: (type: RatioType) => void;
91
90
  render(): JSX.Element;
92
91
  }
@@ -83,10 +83,6 @@ export default class PreviewInner extends BaseComponent {
83
83
  this.foundation.handleMouseDown(e);
84
84
  };
85
85
 
86
- this.handleRatio = type => {
87
- this.foundation.handleRatio(type);
88
- };
89
-
90
86
  this.state = {
91
87
  imgSrc: [],
92
88
  imgLoadStatus: new Map(),
@@ -237,7 +233,10 @@ export default class PreviewInner extends BaseComponent {
237
233
  }
238
234
 
239
235
  if ("currentIndex" in props && props.currentIndex !== state.currentIndex) {
240
- willUpdateStates.currentIndex = props.currentIndex;
236
+ willUpdateStates.currentIndex = props.currentIndex; // ratio will set to adaptation when change picture,
237
+ // attention: If the ratio is controlled, the ratio should not change as the index changes
238
+
239
+ willUpdateStates.ratio = 'adaptation';
241
240
  }
242
241
 
243
242
  return willUpdateStates;
@@ -359,7 +358,7 @@ export default class PreviewInner extends BaseComponent {
359
358
  src: imgSrc[currentIndex],
360
359
  onZoom: this.handleZoomImage,
361
360
  disableDownload: disableDownload,
362
- setRatio: this.handleRatio,
361
+ setRatio: this.handleAdjustRatio,
363
362
  zoom: zoom,
364
363
  ratio: ratio,
365
364
  zoomStep: zoomStep,
@@ -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;
@@ -231,7 +231,16 @@ export default class Popconfirm extends BaseComponent {
231
231
  return /*#__PURE__*/React.createElement(Popover, Object.assign({
232
232
  ref: this.popoverRef
233
233
  }, attrs, {
234
- content: this.renderConfirmPopCard,
234
+ // A arrow function needs to be passed here, otherwise the content will not be updated after the Popconfirm state is updated
235
+ // Popover is a PureComponent, same props will not trigger update
236
+ content: _ref2 => {
237
+ let {
238
+ initialFocusRef
239
+ } = _ref2;
240
+ return this.renderConfirmPopCard({
241
+ initialFocusRef
242
+ });
243
+ },
235
244
  visible: visible,
236
245
  position: position
237
246
  }, popProps), children);
@@ -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;
@@ -86,7 +86,7 @@ export declare type SelectProps = {
86
86
  onDropdownVisibleChange?: (visible: boolean) => void;
87
87
  zIndex?: number;
88
88
  position?: Position;
89
- onSearch?: (value: string) => void;
89
+ onSearch?: (value: string, event: React.KeyboardEvent | React.MouseEvent) => void;
90
90
  dropdownClassName?: string;
91
91
  dropdownStyle?: React.CSSProperties;
92
92
  dropdownMargin?: PopoverProps['margin'];
@@ -252,7 +252,7 @@ declare class Select extends BaseComponent<SelectProps, SelectState> {
252
252
  componentDidMount(): void;
253
253
  componentWillUnmount(): void;
254
254
  componentDidUpdate(prevProps: SelectProps, prevState: SelectState): void;
255
- handleInputChange: (value: string) => void;
255
+ handleInputChange: (value: string, event: React.KeyboardEvent) => void;
256
256
  renderInput(): JSX.Element;
257
257
  close(): void;
258
258
  open(): void;
@@ -35,7 +35,6 @@ import Spin from '../spin';
35
35
  import Trigger from '../trigger';
36
36
  import { IconChevronDown, IconClear } from '@douyinfe/semi-icons';
37
37
  import { isSemiIcon, getFocusableElements, getActiveElement } from '../_utils';
38
- import warning from '@douyinfe/semi-foundation/lib/es/utils/warning';
39
38
  import { getUuidShort } from '@douyinfe/semi-foundation/lib/es/utils/uuid';
40
39
  import '@douyinfe/semi-foundation/lib/es/select/select.css';
41
40
  const prefixcls = cssClasses.PREFIX;
@@ -49,7 +48,7 @@ class Select extends BaseComponent {
49
48
  current: node
50
49
  };
51
50
 
52
- this.handleInputChange = value => this.foundation.handleInputChange(value);
51
+ this.handleInputChange = (value, event) => this.foundation.handleInputChange(value, event);
53
52
 
54
53
  this.getTagItem = (item, i, renderSelectedItem) => {
55
54
  const {
@@ -136,8 +135,6 @@ class Select extends BaseComponent {
136
135
  this.onKeyPress = this.onKeyPress.bind(this);
137
136
  this.eventManager = new Event();
138
137
  this.foundation = new SelectFoundation(this.adapter);
139
- warning('optionLabelProp' in this.props, '[Semi Select] \'optionLabelProp\' has already been deprecated, please use \'renderSelectedItem\' instead.');
140
- warning('labelInValue' in this.props, '[Semi Select] \'labelInValue\' has already been deprecated, please use \'onChangeWithObject\' instead.');
141
138
  }
142
139
 
143
140
  get adapter() {
@@ -306,8 +303,8 @@ class Select extends BaseComponent {
306
303
  notifyDropdownVisibleChange: visible => {
307
304
  this.props.onDropdownVisibleChange(visible);
308
305
  },
309
- notifySearch: input => {
310
- this.props.onSearch(input);
306
+ notifySearch: (input, event) => {
307
+ this.props.onSearch(input, event);
311
308
  },
312
309
  notifyCreate: input => {
313
310
  this.props.onCreate(input);
@@ -5,10 +5,11 @@ const VirtualRow = _ref => {
5
5
  style
6
6
  } = _ref;
7
7
  const {
8
- visibleOptions
8
+ visibleOptions,
9
+ renderOption
9
10
  } = data;
10
11
  const option = visibleOptions[index];
11
- return data.renderOption(option, index, style);
12
+ return renderOption(option, index, style);
12
13
  };
13
14
 
14
15
  export default VirtualRow;
@@ -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
  }
@@ -1,13 +1,13 @@
1
1
  import React from 'react';
2
2
  import BaseComponent from '../_base/baseComponent';
3
3
  import PropTypes from 'prop-types';
4
- import { TableSelectionCellAdapter, TableSelectionCellEvent } from '@douyinfe/semi-foundation/lib/es/table/tableSelectionCellFoundation';
4
+ import TableSelectionCellFoundation, { TableSelectionCellAdapter, TableSelectionCellEvent } from '@douyinfe/semi-foundation/lib/es/table/tableSelectionCellFoundation';
5
5
  import { CheckboxEvent, CheckboxProps } from '../checkbox';
6
6
  export interface TableSelectionCellProps {
7
7
  columnTitle?: string;
8
8
  getCheckboxProps?: () => CheckboxProps;
9
9
  type?: string;
10
- onChange?: (value: any, e: TableSelectionCellEvent) => void;
10
+ onChange?: (checked: boolean, e: TableSelectionCellEvent) => void;
11
11
  selected?: boolean;
12
12
  disabled?: boolean;
13
13
  indeterminate?: boolean;
@@ -37,7 +37,8 @@ export default class TableSelectionCell extends BaseComponent<TableSelectionCell
37
37
  prefixCls: "semi-table";
38
38
  };
39
39
  get adapter(): TableSelectionCellAdapter;
40
+ foundation: TableSelectionCellFoundation;
40
41
  constructor(props: TableSelectionCellProps);
41
- handleChange: (e: CheckboxEvent) => any;
42
+ handleChange: (e: CheckboxEvent) => void;
42
43
  render(): JSX.Element;
43
44
  }
@@ -32,6 +32,14 @@ export interface NormalTableState<RecordType extends Record<string, any> = Data>
32
32
  prePropRowSelection?: TableStateRowSelection<RecordType>;
33
33
  tableWidth?: number;
34
34
  prePagination?: Pagination;
35
+ /**
36
+ * Disabled row keys in sorted and filtered data
37
+ */
38
+ allDisabledRowKeys?: BaseRowKeyType[];
39
+ /**
40
+ * Disabled row keys set in sorted and filtered data
41
+ */
42
+ allDisabledRowKeysSet?: Set<BaseRowKeyType>;
35
43
  }
36
44
  export declare type TableStateRowSelection<RecordType extends Record<string, any> = Data> = (RowSelectionProps<RecordType> & {
37
45
  selectedRowKeysSet?: Set<(string | number)>;
@@ -227,7 +235,7 @@ declare class Table<RecordType extends Record<string, any>> extends BaseComponen
227
235
  */
228
236
  addFnsInColumn: (column?: ColumnProps) => ColumnProps<any>;
229
237
  toggleSelectRow: (selected: boolean, realKey: string | number, e: TableSelectionCellEvent) => void;
230
- toggleSelectAllRow: (status: boolean, e: TableSelectionCellEvent) => void;
238
+ toggleSelectAllRow: (selected: boolean, e: TableSelectionCellEvent) => void;
231
239
  /**
232
240
  * render pagination
233
241
  * @param {object} pagination
@@ -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');
@@ -297,7 +298,7 @@ class Table extends BaseComponent {
297
298
  let inHeader = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
298
299
  const {
299
300
  rowSelection,
300
- disabledRowKeysSet
301
+ allDisabledRowKeysSet
301
302
  } = _this.state;
302
303
 
303
304
  if (rowSelection && typeof rowSelection === 'object') {
@@ -314,7 +315,7 @@ class Table extends BaseComponent {
314
315
  const allRowKeys = _this.cachedFilteredSortedRowKeys;
315
316
  const allRowKeysSet = _this.cachedFilteredSortedRowKeysSet;
316
317
 
317
- const allIsSelected = _this.foundation.allIsSelected(selectedRowKeysSet, disabledRowKeysSet, allRowKeys);
318
+ const allIsSelected = _this.foundation.allIsSelected(selectedRowKeysSet, allDisabledRowKeysSet, allRowKeys);
318
319
 
319
320
  const hasRowSelected = _this.foundation.hasRowSelected(selectedRowKeys, allRowKeysSet);
320
321
 
@@ -324,8 +325,8 @@ class Table extends BaseComponent {
324
325
  key: columnKey,
325
326
  selected: allIsSelected,
326
327
  indeterminate: hasRowSelected && !allIsSelected,
327
- onChange: (status, e) => {
328
- _this.toggleSelectAllRow(status, e);
328
+ onChange: (selected, e) => {
329
+ _this.toggleSelectAllRow(selected, e);
329
330
  }
330
331
  });
331
332
  } else {
@@ -528,8 +529,8 @@ class Table extends BaseComponent {
528
529
  this.foundation.handleSelectRow(realKey, selected, e);
529
530
  };
530
531
 
531
- this.toggleSelectAllRow = (status, e) => {
532
- this.foundation.handleSelectAllRow(status, e);
532
+ this.toggleSelectAllRow = (selected, e) => {
533
+ this.foundation.handleSelectAllRow(selected, e);
533
534
  };
534
535
  /**
535
536
  * render pagination
@@ -847,6 +848,8 @@ class Table extends BaseComponent {
847
848
  allRowKeys: [],
848
849
  disabledRowKeys: [],
849
850
  disabledRowKeysSet: new Set(),
851
+ allDisabledRowKeys: [],
852
+ allDisabledRowKeysSet: new Set(),
850
853
  headWidths: [],
851
854
  bodyHasScrollBar: false,
852
855
  prePropRowSelection: undefined,
@@ -951,11 +954,20 @@ class Table extends BaseComponent {
951
954
  this.cachedFilteredSortedRowKeys = filteredSortedRowKeys;
952
955
  this.cachedFilteredSortedRowKeysSet = new Set(filteredSortedRowKeys);
953
956
  },
957
+ setAllDisabledRowKeys: allDisabledRowKeys => {
958
+ const allDisabledRowKeysSet = new Set(allDisabledRowKeys);
959
+ this.setState({
960
+ allDisabledRowKeys,
961
+ allDisabledRowKeysSet
962
+ });
963
+ },
954
964
  getCurrentPage: () => _get(this.state, 'pagination.currentPage', 1),
955
965
  getCurrentPageSize: () => _get(this.state, 'pagination.pageSize', numbers.DEFAULT_PAGE_SIZE),
956
966
  getCachedFilteredSortedDataSource: () => this.cachedFilteredSortedDataSource,
957
967
  getCachedFilteredSortedRowKeys: () => this.cachedFilteredSortedRowKeys,
958
968
  getCachedFilteredSortedRowKeysSet: () => this.cachedFilteredSortedRowKeysSet,
969
+ getAllDisabledRowKeys: () => this.state.allDisabledRowKeys,
970
+ getAllDisabledRowKeysSet: () => this.state.allDisabledRowKeysSet,
959
971
  notifyFilterDropdownVisibleChange: (visible, dataIndex) => this._invokeColumnFn(dataIndex, 'onFilterDropdownVisibleChange', visible),
960
972
  notifyChange: function () {
961
973
  return _this2.props.onChange(...arguments);
@@ -1159,8 +1171,11 @@ class Table extends BaseComponent {
1159
1171
  childrenRecordName,
1160
1172
  rowKey
1161
1173
  });
1174
+ const disabledRowKeysSet = new Set(disabledRowKeys);
1162
1175
  willUpdateStates.disabledRowKeys = disabledRowKeys;
1163
- willUpdateStates.disabledRowKeysSet = new Set(disabledRowKeys);
1176
+ willUpdateStates.disabledRowKeysSet = disabledRowKeysSet;
1177
+ willUpdateStates.allDisabledRowKeys = disabledRowKeys;
1178
+ willUpdateStates.allDisabledRowKeysSet = disabledRowKeysSet;
1164
1179
  }
1165
1180
 
1166
1181
  willUpdateStates.rowSelection = newSelectionStates;
@@ -1264,7 +1279,9 @@ class Table extends BaseComponent {
1264
1279
  // Temporarily use _dataSource=[...dataSource] for processing
1265
1280
  const _dataSource = [...dataSource];
1266
1281
  const filteredSortedDataSource = this.foundation.getFilteredSortedDataSource(_dataSource, stateQueries);
1282
+ const allDataDisabledRowKeys = this.foundation.getAllDisabledRowKeys(filteredSortedDataSource);
1267
1283
  this.foundation.setCachedFilteredSortedDataSource(filteredSortedDataSource);
1284
+ this.foundation.setAllDisabledRowKeys(allDataDisabledRowKeys);
1268
1285
  states.dataSource = filteredSortedDataSource;
1269
1286
 
1270
1287
  if (this.props.groupBy) {
@@ -1461,11 +1478,13 @@ class Table extends BaseComponent {
1461
1478
  });
1462
1479
  return /*#__PURE__*/React.createElement("div", {
1463
1480
  ref: this.rootWrapRef,
1464
- className: classnames(className, `${prefixCls}-wrapper`),
1481
+ className: classnames(className, `${prefixCls}-wrapper`, `${prefixCls}-wrapper-${props.direction}`),
1465
1482
  "data-column-fixed": anyColumnFixed,
1466
1483
  style: wrapStyle,
1467
1484
  id: id
1468
- }, /*#__PURE__*/React.createElement(TableContextProvider, Object.assign({}, tableContextValue), /*#__PURE__*/React.createElement(Spin, {
1485
+ }, /*#__PURE__*/React.createElement(TableContextProvider, Object.assign({}, tableContextValue, {
1486
+ direction: props.direction
1487
+ }), /*#__PURE__*/React.createElement(Spin, {
1469
1488
  spinning: loading,
1470
1489
  size: "large"
1471
1490
  }, /*#__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;