@douyinfe/semi-ui 2.30.1 → 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 +203 -71
- 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/form/baseForm.js +9 -4
- package/lib/cjs/layout/index.d.ts +1 -1
- package/lib/cjs/modal/confirm.d.ts +303 -26
- package/lib/cjs/modal/confirm.js +7 -2
- 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 +6 -3
- 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/form/baseForm.js +9 -4
- package/lib/es/layout/index.d.ts +1 -1
- package/lib/es/modal/confirm.d.ts +303 -26
- package/lib/es/modal/confirm.js +6 -2
- 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 +9 -3
- 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 +9 -9
|
@@ -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
|
@@ -178,11 +178,12 @@ class Tag extends _react.Component {
|
|
|
178
178
|
|
|
179
179
|
const a11yProps = {
|
|
180
180
|
role: 'button',
|
|
181
|
-
tabIndex: tabIndex
|
|
181
|
+
tabIndex: tabIndex || 0,
|
|
182
182
|
onKeyDown: this.handleKeyDown
|
|
183
183
|
};
|
|
184
184
|
const baseProps = Object.assign(Object.assign({}, attr), {
|
|
185
185
|
onClick,
|
|
186
|
+
tabIndex: tabIndex,
|
|
186
187
|
className: (0, _classnames.default)(prefixCls, {
|
|
187
188
|
[`${prefixCls}-default`]: size === 'default',
|
|
188
189
|
[`${prefixCls}-small`]: size === 'small',
|
|
@@ -206,10 +207,12 @@ class Tag extends _react.Component {
|
|
|
206
207
|
}, /*#__PURE__*/_react.default.createElement(_semiIcons.IconClose, {
|
|
207
208
|
size: "small"
|
|
208
209
|
})) : null;
|
|
210
|
+
const stringChild = (0, _isString2.default)(children);
|
|
211
|
+
const contentCls = (0, _classnames.default)(`${prefixCls}-content`, `${prefixCls}-content-${stringChild ? 'ellipsis' : 'center'}`);
|
|
209
212
|
return /*#__PURE__*/_react.default.createElement("div", Object.assign({
|
|
210
|
-
"aria-label": this.props['aria-label'] ||
|
|
213
|
+
"aria-label": this.props['aria-label'] || stringChild ? `${closable ? 'Closable ' : ''}Tag: ${children}` : ''
|
|
211
214
|
}, wrapProps), avatarSrc ? this.renderAvatar() : null, /*#__PURE__*/_react.default.createElement("div", {
|
|
212
|
-
className:
|
|
215
|
+
className: contentCls
|
|
213
216
|
}, children), closeIcon);
|
|
214
217
|
}
|
|
215
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;
|
|
@@ -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;
|
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;
|
|
@@ -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> {
|
package/lib/es/form/baseForm.js
CHANGED
|
@@ -105,7 +105,11 @@ class Form extends BaseComponent {
|
|
|
105
105
|
const {
|
|
106
106
|
formId
|
|
107
107
|
} = this.state;
|
|
108
|
-
|
|
108
|
+
const {
|
|
109
|
+
id
|
|
110
|
+
} = this.props;
|
|
111
|
+
const xId = id ? id : formId;
|
|
112
|
+
return document.querySelectorAll(`form[x-form-id="${xId}"] .${cssClasses.PREFIX}-field-error-message`);
|
|
109
113
|
},
|
|
110
114
|
getFieldDOM: field => document.querySelector(`.${cssClasses.PREFIX}-field[x-field-id="${field}"]`)
|
|
111
115
|
});
|
|
@@ -180,9 +184,10 @@ class Form extends BaseComponent {
|
|
|
180
184
|
allowEmpty,
|
|
181
185
|
autoScrollToError,
|
|
182
186
|
showValidateIcon,
|
|
183
|
-
extraTextPosition
|
|
187
|
+
extraTextPosition,
|
|
188
|
+
id
|
|
184
189
|
} = _a,
|
|
185
|
-
rest = __rest(_a, ["children", "getFormApi", "onChange", "onSubmit", "onSubmitFail", "onValueChange", "component", "render", "validateFields", "initValues", "layout", "style", "className", "labelPosition", "labelWidth", "labelAlign", "labelCol", "wrapperCol", "allowEmpty", "autoScrollToError", "showValidateIcon", "extraTextPosition"]);
|
|
190
|
+
rest = __rest(_a, ["children", "getFormApi", "onChange", "onSubmit", "onSubmitFail", "onValueChange", "component", "render", "validateFields", "initValues", "layout", "style", "className", "labelPosition", "labelWidth", "labelAlign", "labelCol", "wrapperCol", "allowEmpty", "autoScrollToError", "showValidateIcon", "extraTextPosition", "id"]);
|
|
186
191
|
|
|
187
192
|
const formCls = classNames(prefix, className, {
|
|
188
193
|
[prefix + '-vertical']: layout === 'vertical',
|
|
@@ -195,7 +200,7 @@ class Form extends BaseComponent {
|
|
|
195
200
|
onReset: this.reset,
|
|
196
201
|
onSubmit: this.submit,
|
|
197
202
|
className: formCls,
|
|
198
|
-
"x-form-id": formId
|
|
203
|
+
"x-form-id": id ? id : formId
|
|
199
204
|
}), this.content);
|
|
200
205
|
const withRowForm = /*#__PURE__*/React.createElement(Row, null, formContent);
|
|
201
206
|
return /*#__PURE__*/React.createElement(FormUpdaterContext.Provider, {
|
package/lib/es/layout/index.d.ts
CHANGED