@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.
- package/dist/css/semi.css +66 -51
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +186 -64
- package/dist/umd/semi-ui.js.map +1 -1
- package/dist/umd/semi-ui.min.js +1 -1
- package/dist/umd/semi-ui.min.js.map +1 -1
- package/lib/cjs/_base/base.d.ts +3 -3
- package/lib/cjs/anchor/index.d.ts +1 -1
- package/lib/cjs/autoComplete/index.d.ts +1 -1
- package/lib/cjs/button/Button.d.ts +1 -1
- package/lib/cjs/cascader/index.js +2 -1
- package/lib/cjs/checkbox/checkbox.d.ts +1 -1
- package/lib/cjs/checkbox/checkboxGroup.d.ts +1 -1
- package/lib/cjs/descriptions/index.d.ts +1 -1
- package/lib/cjs/layout/index.d.ts +1 -1
- package/lib/cjs/modal/confirm.d.ts +1 -1
- package/lib/cjs/popover/index.d.ts +1 -0
- package/lib/cjs/progress/index.d.ts +3 -3
- package/lib/cjs/radio/radio.d.ts +1 -1
- package/lib/cjs/table/Body/index.js +4 -8
- package/lib/cjs/table/Table.js +7 -4
- package/lib/cjs/table/TableCell.js +30 -7
- package/lib/cjs/table/TableContextProvider.d.ts +1 -1
- package/lib/cjs/table/TableContextProvider.js +5 -3
- package/lib/cjs/table/TableHeaderRow.js +28 -9
- package/lib/cjs/table/index.d.ts +3 -0
- package/lib/cjs/table/index.js +11 -3
- package/lib/cjs/table/interface.d.ts +1 -0
- package/lib/cjs/table/table-context.d.ts +2 -0
- package/lib/cjs/tabs/interface.d.ts +1 -1
- package/lib/cjs/tag/index.js +4 -2
- package/lib/cjs/tagInput/index.d.ts +1 -1
- package/lib/cjs/tagInput/index.js +1 -3
- package/lib/cjs/tooltip/index.d.ts +4 -0
- package/lib/cjs/tooltip/index.js +21 -6
- package/lib/cjs/typography/copyable.d.ts +3 -0
- package/lib/cjs/typography/copyable.js +30 -9
- package/lib/es/_base/base.d.ts +3 -3
- package/lib/es/anchor/index.d.ts +1 -1
- package/lib/es/autoComplete/index.d.ts +1 -1
- package/lib/es/button/Button.d.ts +1 -1
- package/lib/es/cascader/index.js +2 -1
- package/lib/es/checkbox/checkbox.d.ts +1 -1
- package/lib/es/checkbox/checkboxGroup.d.ts +1 -1
- package/lib/es/descriptions/index.d.ts +1 -1
- package/lib/es/layout/index.d.ts +1 -1
- package/lib/es/modal/confirm.d.ts +1 -1
- package/lib/es/popover/index.d.ts +1 -0
- package/lib/es/progress/index.d.ts +3 -3
- package/lib/es/radio/radio.d.ts +1 -1
- package/lib/es/table/Body/index.js +4 -7
- package/lib/es/table/Table.js +7 -4
- package/lib/es/table/TableCell.js +31 -8
- package/lib/es/table/TableContextProvider.d.ts +1 -1
- package/lib/es/table/TableContextProvider.js +5 -3
- package/lib/es/table/TableHeaderRow.js +29 -10
- package/lib/es/table/index.d.ts +3 -0
- package/lib/es/table/index.js +10 -3
- package/lib/es/table/interface.d.ts +1 -0
- package/lib/es/table/table-context.d.ts +2 -0
- package/lib/es/tabs/interface.d.ts +1 -1
- package/lib/es/tag/index.js +7 -2
- package/lib/es/tagInput/index.d.ts +1 -1
- package/lib/es/tagInput/index.js +1 -3
- package/lib/es/tooltip/index.d.ts +4 -0
- package/lib/es/tooltip/index.js +21 -6
- package/lib/es/typography/copyable.d.ts +3 -0
- package/lib/es/typography/copyable.js +28 -9
- package/package.json +8 -8
package/lib/cjs/_base/base.d.ts
CHANGED
|
@@ -25,8 +25,8 @@ export interface MotionChildrenProps {
|
|
|
25
25
|
animationFillMode?: string;
|
|
26
26
|
};
|
|
27
27
|
animateEvents?: {
|
|
28
|
-
onAnimationIteration?: React.AnimationEventHandler<any
|
|
29
|
-
onAnimationStart?: React.AnimationEventHandler<any
|
|
30
|
-
onAnimationEnd?: React.AnimationEventHandler<any
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
19
|
+
children?: React.ReactNode;
|
|
20
20
|
data?: Data[];
|
|
21
21
|
}
|
|
22
22
|
declare class Descriptions extends PureComponent<DescriptionsProps> {
|
|
@@ -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;
|
|
@@ -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
|
|
9
|
-
'aria-labelledby'?: string
|
|
10
|
-
'aria-valuetext'?: string
|
|
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;
|
package/lib/cjs/radio/radio.d.ts
CHANGED
|
@@ -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
|
|
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
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
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
|
}
|
package/lib/cjs/table/Table.js
CHANGED
|
@@ -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
|
-
|
|
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
|
|
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
|
|
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`]:
|
|
345
|
-
[`${prefixCls}-cell-fixed-left-last`]:
|
|
346
|
-
[`${prefixCls}-cell-fixed-right`]:
|
|
347
|
-
[`${prefixCls}-cell-fixed-right-first`]:
|
|
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
|
-
|
|
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
|
|
126
|
+
textAlign
|
|
124
127
|
});
|
|
125
128
|
customProps.className = (0, _classnames.default)(customProps.className, column.className, {
|
|
126
|
-
[`${prefixCls}-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`]:
|
|
133
|
-
[`${prefixCls}-cell-fixed-left-last`]:
|
|
134
|
-
[`${prefixCls}-cell-fixed-right`]:
|
|
135
|
-
[`${prefixCls}-cell-fixed-right-first`]:
|
|
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
|
-
|
|
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
|
-
|
|
169
|
+
[xPositionKey]: (0, _utils.arrayAdd)(headWidths, indexOfSlicedColumns + 1)
|
|
151
170
|
});
|
|
152
171
|
}
|
|
153
172
|
}
|
package/lib/cjs/table/index.d.ts
CHANGED
|
@@ -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;
|
package/lib/cjs/table/index.js
CHANGED
|
@@ -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;
|
package/lib/cjs/tag/index.js
CHANGED
|
@@ -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'] ||
|
|
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:
|
|
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[]
|
|
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>;
|
package/lib/cjs/tooltip/index.js
CHANGED
|
@@ -125,7 +125,12 @@ class Tooltip extends _baseComponent.default {
|
|
|
125
125
|
|
|
126
126
|
|
|
127
127
|
this.didLeave = () => {
|
|
128
|
-
this.
|
|
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
|
|
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;
|