@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.
- package/dist/css/semi.css +66 -51
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +298 -132
- 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/carousel/index.d.ts +1 -0
- package/lib/cjs/carousel/index.js +17 -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/form/baseForm.d.ts +1 -1
- package/lib/cjs/form/field.d.ts +1 -1
- package/lib/cjs/image/previewInner.d.ts +1 -2
- package/lib/cjs/image/previewInner.js +5 -6
- package/lib/cjs/layout/index.d.ts +1 -1
- package/lib/cjs/modal/confirm.d.ts +1 -1
- package/lib/cjs/popconfirm/index.js +10 -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/select/index.d.ts +2 -2
- package/lib/cjs/select/index.js +3 -7
- package/lib/cjs/select/virtualRow.js +3 -2
- package/lib/cjs/table/Body/index.js +4 -8
- package/lib/cjs/table/ColumnSelection.d.ts +4 -3
- package/lib/cjs/table/Table.d.ts +9 -1
- package/lib/cjs/table/Table.js +30 -11
- 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/treeSelect/index.d.ts +1 -1
- package/lib/cjs/treeSelect/index.js +18 -18
- 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/carousel/index.d.ts +1 -0
- package/lib/es/carousel/index.js +16 -2
- 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/form/baseForm.d.ts +1 -1
- package/lib/es/form/field.d.ts +1 -1
- package/lib/es/image/previewInner.d.ts +1 -2
- package/lib/es/image/previewInner.js +5 -6
- package/lib/es/layout/index.d.ts +1 -1
- package/lib/es/modal/confirm.d.ts +1 -1
- package/lib/es/popconfirm/index.js +10 -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/select/index.d.ts +2 -2
- package/lib/es/select/index.js +3 -6
- package/lib/es/select/virtualRow.js +3 -2
- package/lib/es/table/Body/index.js +4 -7
- package/lib/es/table/ColumnSelection.d.ts +4 -3
- package/lib/es/table/Table.d.ts +9 -1
- package/lib/es/table/Table.js +30 -11
- 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/treeSelect/index.d.ts +1 -1
- package/lib/es/treeSelect/index.js +17 -18
- package/lib/es/typography/copyable.d.ts +3 -0
- package/lib/es/typography/copyable.js +28 -9
- package/package.json +8 -8
|
@@ -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
|
};
|
|
@@ -245,7 +245,7 @@ declare class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState>
|
|
|
245
245
|
getTreeNodeKey: (treeNode: TreeNodeData) => string;
|
|
246
246
|
handlePopoverClose: (isVisible: any) => void;
|
|
247
247
|
renderTreeNode: (treeNode: FlattenNode, ind: number, style: React.CSSProperties) => JSX.Element;
|
|
248
|
-
itemKey: (index: number, data:
|
|
248
|
+
itemKey: (index: number, data: Record<string, any>) => any;
|
|
249
249
|
renderNodeList: () => JSX.Element;
|
|
250
250
|
renderTree: () => JSX.Element;
|
|
251
251
|
render(): JSX.Element;
|
|
@@ -77,6 +77,8 @@ var _checkboxGroup = _interopRequireDefault(require("../checkbox/checkboxGroup")
|
|
|
77
77
|
|
|
78
78
|
var _index3 = _interopRequireDefault(require("../popover/index"));
|
|
79
79
|
|
|
80
|
+
var _virtualRow = _interopRequireDefault(require("../select/virtualRow"));
|
|
81
|
+
|
|
80
82
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
81
83
|
|
|
82
84
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -813,8 +815,11 @@ class TreeSelect extends _baseComponent.default {
|
|
|
813
815
|
};
|
|
814
816
|
|
|
815
817
|
this.itemKey = (index, data) => {
|
|
816
|
-
|
|
817
|
-
|
|
818
|
+
const {
|
|
819
|
+
visibleOptions
|
|
820
|
+
} = data; // Find the item at the specified index.
|
|
821
|
+
|
|
822
|
+
const item = visibleOptions[index]; // Return a value that uniquely identifies this item.
|
|
818
823
|
|
|
819
824
|
return item.key;
|
|
820
825
|
};
|
|
@@ -848,23 +853,18 @@ class TreeSelect extends _baseComponent.default {
|
|
|
848
853
|
});
|
|
849
854
|
}
|
|
850
855
|
|
|
851
|
-
const
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
style,
|
|
855
|
-
data
|
|
856
|
-
} = _ref;
|
|
857
|
-
return this.renderTreeNode(data[index], index, style);
|
|
856
|
+
const data = {
|
|
857
|
+
visibleOptions: flattenNodes,
|
|
858
|
+
renderOption: this.renderTreeNode
|
|
858
859
|
};
|
|
859
|
-
|
|
860
860
|
return /*#__PURE__*/_react.default.createElement(_autoSizer.default, {
|
|
861
861
|
defaultHeight: virtualize.height,
|
|
862
862
|
defaultWidth: virtualize.width
|
|
863
|
-
},
|
|
863
|
+
}, _ref => {
|
|
864
864
|
let {
|
|
865
865
|
height,
|
|
866
866
|
width
|
|
867
|
-
} =
|
|
867
|
+
} = _ref;
|
|
868
868
|
return /*#__PURE__*/_react.default.createElement(_reactWindow.FixedSizeList, {
|
|
869
869
|
itemCount: flattenNodes.length,
|
|
870
870
|
itemSize: virtualize.itemSize,
|
|
@@ -872,12 +872,12 @@ class TreeSelect extends _baseComponent.default {
|
|
|
872
872
|
width: width,
|
|
873
873
|
// @ts-ignore avoid strict check of itemKey
|
|
874
874
|
itemKey: this.itemKey,
|
|
875
|
-
itemData:
|
|
875
|
+
itemData: data,
|
|
876
876
|
className: `${prefixTree}-virtual-list`,
|
|
877
877
|
style: {
|
|
878
878
|
direction
|
|
879
879
|
}
|
|
880
|
-
},
|
|
880
|
+
}, _virtualRow.default);
|
|
881
881
|
});
|
|
882
882
|
};
|
|
883
883
|
|
|
@@ -1188,11 +1188,11 @@ class TreeSelect extends _baseComponent.default {
|
|
|
1188
1188
|
};
|
|
1189
1189
|
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, super.adapter), filterAdapter), treeSelectAdapter), treeAdapter), {
|
|
1190
1190
|
updateLoadKeys: (data, resolve) => {
|
|
1191
|
-
this.setState(
|
|
1191
|
+
this.setState(_ref2 => {
|
|
1192
1192
|
let {
|
|
1193
1193
|
loadedKeys,
|
|
1194
1194
|
loadingKeys
|
|
1195
|
-
} =
|
|
1195
|
+
} = _ref2;
|
|
1196
1196
|
return this.foundation.handleNodeLoad(loadedKeys, loadingKeys, data, resolve);
|
|
1197
1197
|
});
|
|
1198
1198
|
},
|
|
@@ -1229,11 +1229,11 @@ class TreeSelect extends _baseComponent.default {
|
|
|
1229
1229
|
notifyChangeWithObject: (node, e) => {
|
|
1230
1230
|
this.props.onChange && this.props.onChange(node, e);
|
|
1231
1231
|
},
|
|
1232
|
-
notifyExpand: (expandedKeys,
|
|
1232
|
+
notifyExpand: (expandedKeys, _ref3) => {
|
|
1233
1233
|
let {
|
|
1234
1234
|
expanded: bool,
|
|
1235
1235
|
node
|
|
1236
|
-
} =
|
|
1236
|
+
} = _ref3;
|
|
1237
1237
|
this.props.onExpand && this.props.onExpand([...expandedKeys], {
|
|
1238
1238
|
expanded: bool,
|
|
1239
1239
|
node
|
|
@@ -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;
|
|
@@ -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
|
-
},
|
|
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: '',
|
package/lib/es/_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
|
}
|
package/lib/es/anchor/index.d.ts
CHANGED
|
@@ -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;
|
|
@@ -38,6 +38,7 @@ declare class Carousel extends BaseComponent<CarouselProps, CarouselState> {
|
|
|
38
38
|
get adapter(): CarouselAdapter<CarouselProps, CarouselState>;
|
|
39
39
|
static getDerivedStateFromProps(props: CarouselProps, state: CarouselState): Partial<CarouselState>;
|
|
40
40
|
componentDidMount(): void;
|
|
41
|
+
componentDidUpdate(prevProps: Readonly<CarouselProps>, prevState: Readonly<CarouselState>, snapshot?: any): void;
|
|
41
42
|
componentWillUnmount(): void;
|
|
42
43
|
play: () => void;
|
|
43
44
|
stop: () => void;
|
package/lib/es/carousel/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import _isEqual from "lodash/isEqual";
|
|
1
2
|
import _debounce from "lodash/debounce";
|
|
2
3
|
|
|
3
4
|
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
|
4
|
-
import React, { Children } from 'react';
|
|
5
|
+
import React, { Children, isValidElement } from 'react';
|
|
5
6
|
import cls from 'classnames';
|
|
6
7
|
import PropTypes from 'prop-types';
|
|
7
8
|
import BaseComponent from "../_base/baseComponent";
|
|
@@ -17,10 +18,12 @@ class Carousel extends BaseComponent {
|
|
|
17
18
|
super(props);
|
|
18
19
|
|
|
19
20
|
this.play = () => {
|
|
21
|
+
this.foundation.setForcePlay(true);
|
|
20
22
|
return this.foundation.handleAutoPlay();
|
|
21
23
|
};
|
|
22
24
|
|
|
23
25
|
this.stop = () => {
|
|
26
|
+
this.foundation.setForcePlay(false);
|
|
24
27
|
return this.foundation.stop();
|
|
25
28
|
};
|
|
26
29
|
|
|
@@ -47,7 +50,7 @@ class Carousel extends BaseComponent {
|
|
|
47
50
|
autoPlay
|
|
48
51
|
} = this.props;
|
|
49
52
|
|
|
50
|
-
if (typeof autoPlay
|
|
53
|
+
if (autoPlay === true || typeof autoPlay === 'object' && autoPlay.hoverToPause) {
|
|
51
54
|
this.foundation.stop();
|
|
52
55
|
}
|
|
53
56
|
};
|
|
@@ -227,6 +230,17 @@ class Carousel extends BaseComponent {
|
|
|
227
230
|
this.handleAutoPlay();
|
|
228
231
|
}
|
|
229
232
|
|
|
233
|
+
componentDidUpdate(prevProps, prevState, snapshot) {
|
|
234
|
+
const prevChildrenKeys = React.Children.toArray(prevProps.children).map(child => /*#__PURE__*/isValidElement(child) ? child.key : null);
|
|
235
|
+
const nowChildrenKeys = React.Children.toArray(this.props.children).map(child => /*#__PURE__*/isValidElement(child) ? child.key : null);
|
|
236
|
+
|
|
237
|
+
if (!_isEqual(prevChildrenKeys, nowChildrenKeys)) {
|
|
238
|
+
this.setState({
|
|
239
|
+
children: this.getChildren()
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
230
244
|
componentWillUnmount() {
|
|
231
245
|
this.foundation.destroy();
|
|
232
246
|
}
|
package/lib/es/cascader/index.js
CHANGED
|
@@ -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
|
|
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;
|