@ucloud-fe/react-components 1.17.0 → 1.18.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/CHANGELOG.md +12 -0
- package/dist/main.min.js +7 -7
- package/index.d.ts +3 -39
- package/lib/components/Popover/index.d.ts +34 -1
- package/lib/components/Popover/index.js +18 -0
- package/lib/components/Table/Table.js +49 -23
- package/lib/components/Table/TableRow.d.ts +2 -0
- package/lib/components/Table/TableRow.js +41 -13
- package/lib/components/Tooltip/Tooltip.d.ts +5 -1
- package/lib/components/Tooltip/Tooltip.js +18 -21
- package/lib/components/Tooltip/index.d.ts +2 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Component, CSSProperties, HTMLAttributes, PureComponent, ReactNode, TextareaHTMLAttributes } from 'react';
|
|
2
2
|
|
|
3
3
|
// 忽略 T 对象中 键在 K 中的所有的属性
|
|
4
4
|
type Override<T1, T2> = Omit<T1, keyof T2> & T2;
|
|
@@ -446,44 +446,8 @@ export declare class Tag extends PureComponent<TagProps> {
|
|
|
446
446
|
}
|
|
447
447
|
|
|
448
448
|
// Popover
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
offset?: number[];
|
|
452
|
-
}
|
|
453
|
-
export type PopoverPlacement =
|
|
454
|
-
| 'topLeft'
|
|
455
|
-
| 'top'
|
|
456
|
-
| 'topRight'
|
|
457
|
-
| 'bottomLeft'
|
|
458
|
-
| 'bottom'
|
|
459
|
-
| 'bottomRight'
|
|
460
|
-
| 'leftTop'
|
|
461
|
-
| 'left'
|
|
462
|
-
| 'leftBottom'
|
|
463
|
-
| 'rightTop'
|
|
464
|
-
| 'right'
|
|
465
|
-
| 'rightBottom';
|
|
466
|
-
export interface GetPopupContainer {
|
|
467
|
-
(): HTMLElement;
|
|
468
|
-
}
|
|
469
|
-
export interface PopoverProps extends HTMLAttributes<HTMLDivElement> {
|
|
470
|
-
visible?: boolean;
|
|
471
|
-
defaultVisible?: boolean;
|
|
472
|
-
onVisibleChange?: (visible: boolean) => void;
|
|
473
|
-
trigger?: 'hover' | 'focus' | 'click' | 'contextMenu';
|
|
474
|
-
alignPoint?: boolean;
|
|
475
|
-
placement?: PopoverPlacement;
|
|
476
|
-
align?: PopupAlign;
|
|
477
|
-
stretch?: 'with' | 'minWidth' | 'height' | 'minHeight';
|
|
478
|
-
popup?: ReactNode;
|
|
479
|
-
popupClassName?: string;
|
|
480
|
-
popupStyle?: CSSProperties;
|
|
481
|
-
zIndex?: number;
|
|
482
|
-
getPopupContainer?: GetPopupContainer;
|
|
483
|
-
forwardPopupContainer?: boolean | GetPopupContainer;
|
|
484
|
-
prefixCls?: string;
|
|
485
|
-
animation?: 'fade' | 'zoom' | 'bounce' | 'slide-up';
|
|
486
|
-
}
|
|
449
|
+
import { GetPopupContainer, PopoverPlacement, PopoverProps, PopupAlign } from './lib/components/Popover';
|
|
450
|
+
export type { GetPopupContainer, PopoverPlacement, PopoverProps, PopupAlign };
|
|
487
451
|
export declare class Popover extends Component<PopoverProps> {}
|
|
488
452
|
|
|
489
453
|
// Modal
|
|
@@ -1,3 +1,36 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { CSSProperties, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { Animation, Placement, Trigger } from './Popover';
|
|
2
3
|
declare const FinalPopover: React.ForwardRefExoticComponent<Pick<any, string | number | symbol> & React.RefAttributes<unknown>>;
|
|
4
|
+
export interface GetPopupContainer {
|
|
5
|
+
(): HTMLElement;
|
|
6
|
+
}
|
|
7
|
+
export interface PopupAlign {
|
|
8
|
+
points?: string[];
|
|
9
|
+
offset?: number[];
|
|
10
|
+
targetOffset?: number[];
|
|
11
|
+
overflow?: {
|
|
12
|
+
adjustX?: number;
|
|
13
|
+
adjustY?: number;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export declare type PopoverPlacement = 'topLeft' | 'top' | 'topRight' | 'bottomLeft' | 'bottom' | 'bottomRight' | 'leftTop' | 'left' | 'leftBottom' | 'rightTop' | 'right' | 'rightBottom';
|
|
17
|
+
export interface PopoverProps extends HTMLAttributes<HTMLDivElement> {
|
|
18
|
+
visible?: boolean;
|
|
19
|
+
defaultVisible?: boolean;
|
|
20
|
+
onVisibleChange?: (visible: boolean) => void;
|
|
21
|
+
trigger?: 'hover' | 'focus' | 'click' | 'contextMenu';
|
|
22
|
+
alignPoint?: boolean;
|
|
23
|
+
placement?: PopoverPlacement;
|
|
24
|
+
align?: PopupAlign;
|
|
25
|
+
stretch?: 'with' | 'minWidth' | 'height' | 'minHeight';
|
|
26
|
+
popup?: ReactNode;
|
|
27
|
+
popupClassName?: string;
|
|
28
|
+
popupStyle?: CSSProperties;
|
|
29
|
+
zIndex?: number;
|
|
30
|
+
getPopupContainer?: GetPopupContainer;
|
|
31
|
+
forwardPopupContainer?: boolean | GetPopupContainer;
|
|
32
|
+
prefixCls?: string;
|
|
33
|
+
animation?: 'fade' | 'zoom' | 'bounce' | 'slide-up';
|
|
34
|
+
}
|
|
35
|
+
export { Animation, Placement, Trigger };
|
|
3
36
|
export default FinalPopover;
|
|
@@ -7,6 +7,24 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
+
Object.defineProperty(exports, "Animation", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function get() {
|
|
13
|
+
return _Popover.Animation;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, "Placement", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function get() {
|
|
19
|
+
return _Popover.Placement;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(exports, "Trigger", {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function get() {
|
|
25
|
+
return _Popover.Trigger;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
10
28
|
exports.default = void 0;
|
|
11
29
|
|
|
12
30
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
@@ -416,18 +416,34 @@ var Table = (_dec = (0, _localeConsumerDecorator.default)({
|
|
|
416
416
|
var _this14 = this;
|
|
417
417
|
|
|
418
418
|
(0, _newArrowCheck2.default)(this, _this3);
|
|
419
|
-
var
|
|
419
|
+
var _this2$props = _this2.props,
|
|
420
|
+
rowSelection = _this2$props.rowSelection,
|
|
421
|
+
dataSource = _this2$props.dataSource;
|
|
420
422
|
var parentSelectedRowKeys = _this2.state.parentSelectedRowKeys;
|
|
421
423
|
if (!rowSelection) return;
|
|
422
424
|
var selectedRowKeys = [];
|
|
423
425
|
(0, _each2.default)(selectedRowKeyMap, function (selected, key) {
|
|
424
426
|
(0, _newArrowCheck2.default)(this, _this14);
|
|
425
427
|
selected && selectedRowKeys.push(key);
|
|
428
|
+
}.bind(this)); // 计算所有选中的行数据,包括折叠的子项
|
|
429
|
+
|
|
430
|
+
var flatDataSource = _this2.flatDataSource(dataSource);
|
|
431
|
+
|
|
432
|
+
flatDataSource.forEach(function (item) {
|
|
433
|
+
(0, _newArrowCheck2.default)(this, _this14);
|
|
434
|
+
|
|
435
|
+
if (selectedRowKeyMap[item.key]) {
|
|
436
|
+
_this2._selectedRowsMap[item.key] = item.record;
|
|
437
|
+
}
|
|
426
438
|
}.bind(this));
|
|
427
439
|
|
|
428
440
|
if ((0, _isObject2.default)(rowSelection)) {
|
|
429
441
|
if (rowSelection.onChange) {
|
|
430
|
-
|
|
442
|
+
var selectedRows = selectedRowKeys.map(function (key) {
|
|
443
|
+
(0, _newArrowCheck2.default)(this, _this14);
|
|
444
|
+
return _this2._selectedRowsMap[key];
|
|
445
|
+
}.bind(this));
|
|
446
|
+
rowSelection.onChange(selectedRowKeys, selectedRows);
|
|
431
447
|
}
|
|
432
448
|
|
|
433
449
|
if (!('selectedRowKeys' in rowSelection)) {
|
|
@@ -692,10 +708,10 @@ var Table = (_dec = (0, _localeConsumerDecorator.default)({
|
|
|
692
708
|
var _this20 = this;
|
|
693
709
|
|
|
694
710
|
(0, _newArrowCheck2.default)(this, _this3);
|
|
695
|
-
var _this2$
|
|
696
|
-
dataSource = _this2$
|
|
697
|
-
handleSearch = _this2$
|
|
698
|
-
doNotHandleCondition = _this2$
|
|
711
|
+
var _this2$props2 = _this2.props,
|
|
712
|
+
dataSource = _this2$props2.dataSource,
|
|
713
|
+
handleSearch = _this2$props2.handleSearch,
|
|
714
|
+
doNotHandleCondition = _this2$props2.doNotHandleCondition;
|
|
699
715
|
var _this2$state2 = _this2.state,
|
|
700
716
|
order = _this2$state2.order,
|
|
701
717
|
searchValue = _this2$state2.searchValue;
|
|
@@ -1011,10 +1027,10 @@ var Table = (_dec = (0, _localeConsumerDecorator.default)({
|
|
|
1011
1027
|
var _this31 = this;
|
|
1012
1028
|
|
|
1013
1029
|
(0, _newArrowCheck2.default)(this, _this3);
|
|
1014
|
-
var _this2$
|
|
1015
|
-
dragSorting = _this2$
|
|
1016
|
-
expandedRowRender = _this2$
|
|
1017
|
-
columns = _this2$
|
|
1030
|
+
var _this2$props3 = _this2.props,
|
|
1031
|
+
dragSorting = _this2$props3.dragSorting,
|
|
1032
|
+
expandedRowRender = _this2$props3.expandedRowRender,
|
|
1033
|
+
columns = _this2$props3.columns;
|
|
1018
1034
|
if (!dragSorting) return false; // 排序暂不支持有展开行配置的table
|
|
1019
1035
|
|
|
1020
1036
|
if (expandedRowRender || columns && columns.findIndex(function (column) {
|
|
@@ -1032,13 +1048,13 @@ var Table = (_dec = (0, _localeConsumerDecorator.default)({
|
|
|
1032
1048
|
var _this32 = this;
|
|
1033
1049
|
|
|
1034
1050
|
(0, _newArrowCheck2.default)(this, _this3);
|
|
1035
|
-
var _this2$
|
|
1036
|
-
columns = _this2$
|
|
1037
|
-
rowSelection = _this2$
|
|
1038
|
-
columnPlaceholder = _this2$
|
|
1039
|
-
locale = _this2$
|
|
1040
|
-
dataSource = _this2$
|
|
1041
|
-
columnResizable = _this2$
|
|
1051
|
+
var _this2$props4 = _this2.props,
|
|
1052
|
+
columns = _this2$props4.columns,
|
|
1053
|
+
rowSelection = _this2$props4.rowSelection,
|
|
1054
|
+
columnPlaceholder = _this2$props4.columnPlaceholder,
|
|
1055
|
+
locale = _this2$props4.locale,
|
|
1056
|
+
dataSource = _this2$props4.dataSource,
|
|
1057
|
+
columnResizable = _this2$props4.columnResizable;
|
|
1042
1058
|
var _this2$state3 = _this2.state,
|
|
1043
1059
|
_this2$state3$order = _this2$state3.order,
|
|
1044
1060
|
currentOrder = _this2$state3$order === void 0 ? {} : _this2$state3$order,
|
|
@@ -1587,13 +1603,15 @@ var Table = (_dec = (0, _localeConsumerDecorator.default)({
|
|
|
1587
1603
|
|
|
1588
1604
|
_this2.onRow = function (record, index) {
|
|
1589
1605
|
(0, _newArrowCheck2.default)(this, _this3);
|
|
1590
|
-
var _this2$
|
|
1591
|
-
_this2$
|
|
1592
|
-
onRow = _this2$
|
|
1593
|
-
contextMenu = _this2$
|
|
1606
|
+
var _this2$props5 = _this2.props,
|
|
1607
|
+
_this2$props5$onRow = _this2$props5.onRow,
|
|
1608
|
+
onRow = _this2$props5$onRow === void 0 ? noop : _this2$props5$onRow,
|
|
1609
|
+
contextMenu = _this2$props5.contextMenu,
|
|
1610
|
+
rowTooltip = _this2$props5.rowTooltip;
|
|
1594
1611
|
return _objectSpread(_objectSpread({}, onRow(record, index)), {}, {
|
|
1595
1612
|
record: record,
|
|
1596
|
-
contextMenu: contextMenu
|
|
1613
|
+
contextMenu: contextMenu,
|
|
1614
|
+
rowTooltip: rowTooltip
|
|
1597
1615
|
});
|
|
1598
1616
|
}.bind(this);
|
|
1599
1617
|
|
|
@@ -1618,7 +1636,8 @@ var Table = (_dec = (0, _localeConsumerDecorator.default)({
|
|
|
1618
1636
|
columnConfig: _props.defaultColumnConfig,
|
|
1619
1637
|
searchValue: ''
|
|
1620
1638
|
};
|
|
1621
|
-
_this2.tableId = "uc_table_uid_".concat(uid++);
|
|
1639
|
+
_this2.tableId = "uc_table_uid_".concat(uid++);
|
|
1640
|
+
_this2._selectedRowsMap = {}; // init pagination
|
|
1622
1641
|
|
|
1623
1642
|
var _pagination = _props.pagination;
|
|
1624
1643
|
|
|
@@ -2216,6 +2235,13 @@ var Table = (_dec = (0, _localeConsumerDecorator.default)({
|
|
|
2216
2235
|
*/
|
|
2217
2236
|
contextMenu: _propTypes.default.func,
|
|
2218
2237
|
|
|
2238
|
+
/**
|
|
2239
|
+
* 行提示
|
|
2240
|
+
* @param record - 该行的记录值
|
|
2241
|
+
* @return TooltipProps
|
|
2242
|
+
*/
|
|
2243
|
+
rowTooltip: _propTypes.default.func,
|
|
2244
|
+
|
|
2219
2245
|
/** @ignore */
|
|
2220
2246
|
className: _propTypes.default.string,
|
|
2221
2247
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
+
import type { TooltipProps } from '../../components/Tooltip';
|
|
2
3
|
interface TableRowProps {
|
|
3
4
|
record: any;
|
|
4
5
|
contextMenu?: (record: any, hideContextMenu: () => void) => ReactNode;
|
|
5
6
|
draggable?: boolean;
|
|
6
7
|
'data-row-key'?: string | number;
|
|
8
|
+
rowTooltip?: (record: any) => TooltipProps;
|
|
7
9
|
}
|
|
8
10
|
declare const _default: React.MemoExoticComponent<({ ...restProps }: TableRowProps) => JSX.Element>;
|
|
9
11
|
export default _default;
|
|
@@ -11,10 +11,10 @@ exports.default = void 0;
|
|
|
11
11
|
|
|
12
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
13
|
|
|
14
|
-
var _newArrowCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/newArrowCheck"));
|
|
15
|
-
|
|
16
14
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
15
|
|
|
16
|
+
var _newArrowCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/newArrowCheck"));
|
|
17
|
+
|
|
18
18
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
19
19
|
|
|
20
20
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -23,30 +23,51 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
23
23
|
|
|
24
24
|
var _Popover = _interopRequireDefault(require("../../components/Popover"));
|
|
25
25
|
|
|
26
|
+
var _Tooltip = _interopRequireDefault(require("../../components/Tooltip"));
|
|
27
|
+
|
|
26
28
|
var _DragWrap = require("./DragWrap");
|
|
27
29
|
|
|
28
|
-
var
|
|
30
|
+
var _this3 = void 0;
|
|
29
31
|
|
|
30
|
-
var _excluded = ["record", "
|
|
32
|
+
var _excluded = ["record", "rowTooltip"],
|
|
33
|
+
_excluded2 = ["record", "contextMenu", "rowTooltip"];
|
|
31
34
|
|
|
32
35
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
33
36
|
|
|
34
37
|
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; }
|
|
35
38
|
|
|
36
|
-
var
|
|
39
|
+
var TableRowWithTooltip = /*#__PURE__*/_react.default.memo(function TableRowWithTooltip(_ref) {
|
|
37
40
|
var _this = this;
|
|
38
41
|
|
|
39
42
|
var record = _ref.record,
|
|
40
|
-
|
|
43
|
+
rowTooltip = _ref.rowTooltip,
|
|
41
44
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
42
45
|
|
|
46
|
+
var tooltipProps = _react.default.useMemo(function () {
|
|
47
|
+
(0, _newArrowCheck2.default)(this, _this);
|
|
48
|
+
return rowTooltip === null || rowTooltip === void 0 ? void 0 : rowTooltip(record);
|
|
49
|
+
}.bind(this), [record, rowTooltip]);
|
|
50
|
+
|
|
51
|
+
if (!rowTooltip) return /*#__PURE__*/_react.default.createElement("tr", rest);
|
|
52
|
+
if (!tooltipProps) return /*#__PURE__*/_react.default.createElement("tr", rest);
|
|
53
|
+
return /*#__PURE__*/_react.default.createElement(_Tooltip.default, tooltipProps, /*#__PURE__*/_react.default.createElement("tr", rest));
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
var TableRowWithContextMenu = /*#__PURE__*/_react.default.memo(function TableRowWithContextMenu(_ref2) {
|
|
57
|
+
var _this2 = this;
|
|
58
|
+
|
|
59
|
+
var record = _ref2.record,
|
|
60
|
+
contextMenu = _ref2.contextMenu,
|
|
61
|
+
rowTooltip = _ref2.rowTooltip,
|
|
62
|
+
rest = (0, _objectWithoutProperties2.default)(_ref2, _excluded2);
|
|
63
|
+
|
|
43
64
|
var _useState = (0, _react.useState)(false),
|
|
44
65
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
45
66
|
contextMenuVisible = _useState2[0],
|
|
46
67
|
setContextMenuVisible = _useState2[1];
|
|
47
68
|
|
|
48
69
|
var hideContextMenu = (0, _react.useCallback)(function () {
|
|
49
|
-
(0, _newArrowCheck2.default)(this,
|
|
70
|
+
(0, _newArrowCheck2.default)(this, _this2);
|
|
50
71
|
setContextMenuVisible(false);
|
|
51
72
|
}.bind(this), []);
|
|
52
73
|
|
|
@@ -59,10 +80,16 @@ var TableRowWithContextMenu = /*#__PURE__*/_react.default.memo(function TableRow
|
|
|
59
80
|
onVisibleChange: setContextMenuVisible,
|
|
60
81
|
animation: null,
|
|
61
82
|
alignPoint: true
|
|
62
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
83
|
+
}, /*#__PURE__*/_react.default.createElement(TableRowWithTooltip, (0, _extends2.default)({
|
|
84
|
+
record: record,
|
|
85
|
+
rowTooltip: rowTooltip
|
|
86
|
+
}, rest)));
|
|
63
87
|
}
|
|
64
88
|
|
|
65
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
89
|
+
return /*#__PURE__*/_react.default.createElement(TableRowWithTooltip, (0, _extends2.default)({
|
|
90
|
+
record: record,
|
|
91
|
+
rowTooltip: rowTooltip
|
|
92
|
+
}, rest));
|
|
66
93
|
});
|
|
67
94
|
|
|
68
95
|
var TableRowWithDrag = /*#__PURE__*/_react.default.memo(function TableRowWithDrag(props) {
|
|
@@ -75,9 +102,9 @@ var TableRowWithDrag = /*#__PURE__*/_react.default.memo(function TableRowWithDra
|
|
|
75
102
|
}));
|
|
76
103
|
});
|
|
77
104
|
|
|
78
|
-
var TableRow = function TableRow(
|
|
79
|
-
(0, _newArrowCheck2.default)(this,
|
|
80
|
-
var restProps = (0, _extends2.default)({},
|
|
105
|
+
var TableRow = function TableRow(_ref3) {
|
|
106
|
+
(0, _newArrowCheck2.default)(this, _this3);
|
|
107
|
+
var restProps = (0, _extends2.default)({}, _ref3);
|
|
81
108
|
|
|
82
109
|
var _useContext2 = (0, _react.useContext)(_DragWrap.DragContext),
|
|
83
110
|
draggable = _useContext2.draggable;
|
|
@@ -90,7 +117,8 @@ TableRow.propTypes = {
|
|
|
90
117
|
record: _propTypes.default.any.isRequired,
|
|
91
118
|
contextMenu: _propTypes.default.func,
|
|
92
119
|
draggable: _propTypes.default.bool,
|
|
93
|
-
'data-row-key': _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number])
|
|
120
|
+
'data-row-key': _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
121
|
+
rowTooltip: _propTypes.default.func
|
|
94
122
|
};
|
|
95
123
|
|
|
96
124
|
var _default = /*#__PURE__*/_react.default.memo(TableRow);
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { PopoverProps } from '../../components/Popover';
|
|
3
|
+
export interface TooltipProps extends PopoverProps {
|
|
2
4
|
/** 是否显示箭头 */
|
|
3
5
|
arrow?: boolean;
|
|
4
6
|
/** 主题风格 */
|
|
@@ -8,6 +10,8 @@ interface TooltipProps {
|
|
|
8
10
|
/** 弹出层外层 padding */
|
|
9
11
|
popupWrapperPadding?: string;
|
|
10
12
|
};
|
|
13
|
+
/** 弹出层内容 */
|
|
14
|
+
popup?: ReactNode;
|
|
11
15
|
}
|
|
12
16
|
declare const Tooltip: ({ popup: _popup, theme, popupClassName, arrow, placement, customStyle, ...rest }: TooltipProps & any) => JSX.Element;
|
|
13
17
|
export default Tooltip;
|
|
@@ -21,7 +21,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
21
21
|
|
|
22
22
|
var _react = _interopRequireWildcard(require("react"));
|
|
23
23
|
|
|
24
|
-
var _Popover =
|
|
24
|
+
var _Popover = _interopRequireWildcard(require("../../components/Popover"));
|
|
25
25
|
|
|
26
26
|
var _placements = require("../../components/Popover/placements");
|
|
27
27
|
|
|
@@ -37,29 +37,25 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
37
37
|
|
|
38
38
|
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; }
|
|
39
39
|
|
|
40
|
-
var _ref = _Popover.default,
|
|
41
|
-
Animation = _ref.Animation,
|
|
42
|
-
Trigger = _ref.Trigger,
|
|
43
|
-
Placement = _ref.Placement;
|
|
44
40
|
var arrowPlacements = (0, _placements.getPlacements)(10);
|
|
45
41
|
var placements = (0, _placements.getPlacements)();
|
|
46
42
|
var Theme = ['light', 'dark'];
|
|
47
43
|
|
|
48
|
-
var Tooltip = function Tooltip(
|
|
44
|
+
var Tooltip = function Tooltip(_ref) {
|
|
49
45
|
var _this2 = this;
|
|
50
46
|
|
|
51
47
|
(0, _newArrowCheck2.default)(this, _this);
|
|
52
|
-
var _popup =
|
|
53
|
-
|
|
54
|
-
theme =
|
|
55
|
-
popupClassName =
|
|
56
|
-
|
|
57
|
-
arrow =
|
|
58
|
-
|
|
59
|
-
placement =
|
|
60
|
-
|
|
61
|
-
customStyle =
|
|
62
|
-
rest = (0, _objectWithoutProperties2.default)(
|
|
48
|
+
var _popup = _ref.popup,
|
|
49
|
+
_ref$theme = _ref.theme,
|
|
50
|
+
theme = _ref$theme === void 0 ? 'light' : _ref$theme,
|
|
51
|
+
popupClassName = _ref.popupClassName,
|
|
52
|
+
_ref$arrow = _ref.arrow,
|
|
53
|
+
arrow = _ref$arrow === void 0 ? true : _ref$arrow,
|
|
54
|
+
_ref$placement = _ref.placement,
|
|
55
|
+
placement = _ref$placement === void 0 ? 'topLeft' : _ref$placement,
|
|
56
|
+
_ref$customStyle = _ref.customStyle,
|
|
57
|
+
customStyle = _ref$customStyle === void 0 ? {} : _ref$customStyle,
|
|
58
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
63
59
|
var popup = (0, _react.useMemo)(function () {
|
|
64
60
|
(0, _newArrowCheck2.default)(this, _this2);
|
|
65
61
|
return _popup == null ? _popup : /*#__PURE__*/_react.default.createElement(_style.TooltipWrap, {
|
|
@@ -83,12 +79,13 @@ Tooltip.propTypes = {
|
|
|
83
79
|
theme: _propTypes.default.oneOf(['light', 'dark']),
|
|
84
80
|
customStyle: _propTypes.default.shape({
|
|
85
81
|
popupWrapperPadding: _propTypes.default.string
|
|
86
|
-
})
|
|
82
|
+
}),
|
|
83
|
+
popup: _propTypes.default.node
|
|
87
84
|
};
|
|
88
85
|
Object.assign(Tooltip, {
|
|
89
|
-
Animation: Animation,
|
|
90
|
-
Trigger: Trigger,
|
|
91
|
-
Placement: Placement,
|
|
86
|
+
Animation: _Popover.Animation,
|
|
87
|
+
Trigger: _Popover.Trigger,
|
|
88
|
+
Placement: _Popover.Placement,
|
|
92
89
|
Theme: Theme,
|
|
93
90
|
defaultProps: {}
|
|
94
91
|
});
|