@oceanbase/design 0.2.23 → 0.2.25
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/design.min.js +1 -1
- package/es/_util/genComponentStyleHook.js +1 -1
- package/es/alert/index.js +3 -3
- package/es/alert/style/index.js +1 -1
- package/es/badge/index.js +3 -3
- package/es/badge/style/index.js +1 -1
- package/es/button/index.js +3 -3
- package/es/button/style/index.js +1 -1
- package/es/card/index.js +3 -3
- package/es/card/style/index.js +3 -3
- package/es/config-provider/index.js +3 -3
- package/es/descriptions/index.js +3 -3
- package/es/descriptions/style/index.js +3 -3
- package/es/form/FormItem.d.ts +1 -1
- package/es/form/FormItem.js +5 -5
- package/es/index.d.ts +2 -0
- package/es/index.js +2 -0
- package/es/locale/en-US.js +3 -3
- package/es/locale/zh-CN.js +3 -3
- package/es/locale/zh-TW.js +3 -3
- package/es/lottie/index.js +4 -4
- package/es/modal/Modal.js +3 -3
- package/es/modal/Progress.js +3 -3
- package/es/modal/style/index.js +1 -1
- package/es/select/index.d.ts +4 -0
- package/es/select/index.js +39 -1
- package/es/select/style/index.d.ts +9 -0
- package/es/select/style/index.js +17 -0
- package/es/spin/index.js +3 -3
- package/es/spin/style/index.js +3 -3
- package/es/static-function/index.js +3 -3
- package/es/table/index.js +7 -7
- package/es/table/style/index.js +9 -8
- package/es/tabs/hooks/useLegacyItems.js +3 -3
- package/es/tabs/index.js +3 -3
- package/es/tabs/style/index.js +1 -1
- package/es/tag/index.d.ts +11 -0
- package/es/tag/index.js +54 -1
- package/es/tag/style/index.d.ts +9 -0
- package/es/tag/style/index.js +55 -0
- package/es/theme/index.js +3 -3
- package/es/tooltip/MouseTooltip.js +9 -7
- package/es/tooltip/hooks/useTooltipTypeList.d.ts +5 -0
- package/es/tooltip/hooks/useTooltipTypeList.js +26 -0
- package/es/tooltip/index.d.ts +0 -5
- package/es/tooltip/index.js +46 -59
- package/es/tooltip/style/index.js +1 -1
- package/lib/form/FormItem.d.ts +1 -1
- package/lib/form/FormItem.js +2 -2
- package/lib/index.d.ts +2 -0
- package/lib/index.js +6 -0
- package/lib/select/index.d.ts +4 -0
- package/lib/select/index.js +37 -1
- package/lib/select/style/index.d.ts +9 -0
- package/lib/select/style/index.js +46 -0
- package/lib/static-function/index.d.ts +1 -1
- package/lib/table/index.js +1 -1
- package/lib/table/style/index.js +8 -5
- package/lib/tag/index.d.ts +11 -0
- package/lib/tag/index.js +55 -1
- package/lib/tag/style/index.d.ts +9 -0
- package/lib/tag/style/index.js +92 -0
- package/lib/tooltip/MouseTooltip.js +6 -5
- package/lib/tooltip/hooks/useTooltipTypeList.d.ts +5 -0
- package/lib/tooltip/hooks/useTooltipTypeList.js +69 -0
- package/lib/tooltip/index.d.ts +0 -5
- package/lib/tooltip/index.js +30 -50
- package/package.json +6 -6
package/es/table/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
function _typeof(
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
2
|
var _excluded = ["batchOperationBar"];
|
|
3
3
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
4
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
5
5
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
6
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
7
|
-
function _iterableToArrayLimit(
|
|
7
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
8
8
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
|
-
function ownKeys(
|
|
10
|
-
function _objectSpread(
|
|
9
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11
11
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
12
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
13
13
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
@@ -64,7 +64,7 @@ function Table(props) {
|
|
|
64
64
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
65
65
|
currentSelectedInfo = _useState8[0],
|
|
66
66
|
setCurrentSelectedInfo = _useState8[1];
|
|
67
|
-
var newColumns = columns.map(function (item) {
|
|
67
|
+
var newColumns = columns === null || columns === void 0 ? void 0 : columns.map(function (item) {
|
|
68
68
|
if (item.ellipsis) {
|
|
69
69
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
70
70
|
ellipsis: item.ellipsis === true ? item.ellipsis : _objectSpread({
|
|
@@ -96,7 +96,7 @@ function Table(props) {
|
|
|
96
96
|
setCurrentSelectedInfo(info);
|
|
97
97
|
};
|
|
98
98
|
var handleOptionsCancel = function handleOptionsCancel() {
|
|
99
|
-
rowSelection === null || rowSelection === void 0
|
|
99
|
+
rowSelection === null || rowSelection === void 0 || rowSelection.onChange([], [], currentSelectedInfo);
|
|
100
100
|
handleSelectedData([], [], currentSelectedInfo);
|
|
101
101
|
};
|
|
102
102
|
useEffect(function () {
|
|
@@ -165,7 +165,7 @@ function Table(props) {
|
|
|
165
165
|
rowSelection: rowSelection ? _objectSpread(_objectSpread({}, rowSelection), {}, {
|
|
166
166
|
onChange: function onChange(selectedRowKeys, selectedRows, info) {
|
|
167
167
|
handleSelectedData(selectedRowKeys, selectedRows, info);
|
|
168
|
-
rowSelection === null || rowSelection === void 0
|
|
168
|
+
rowSelection === null || rowSelection === void 0 || rowSelection.onChange(selectedRowKeys, selectedRows, info);
|
|
169
169
|
}
|
|
170
170
|
}) : undefined,
|
|
171
171
|
pagination: pagination === false ? false : _objectSpread(_objectSpread({}, pagination), {}, {
|
package/es/table/style/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
function _typeof(
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
2
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3
3
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
4
4
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
5
5
|
import { genComponentStyleHook } from "../../_util/genComponentStyleHook";
|
|
6
6
|
export var genTableStyle = function genTableStyle(token) {
|
|
7
|
-
var _$concat, _trTd$concat$co, _$concat4, _$concat$concat, _$concat5, _$concat8, _trNthChild2nNot, _$
|
|
7
|
+
var _$concat, _trTd$concat$co, _$concat4, _$concat$concat, _$concat5, _$concat8, _trNthChild2nNot, _$concat14, _$concat16, _ref;
|
|
8
8
|
var antCls = token.antCls,
|
|
9
9
|
componentCls = token.componentCls,
|
|
10
10
|
colorTextBase = token.colorTextBase,
|
|
@@ -75,19 +75,17 @@ export var genTableStyle = function genTableStyle(token) {
|
|
|
75
75
|
padding: largeCellPadding
|
|
76
76
|
})), _$concat8)), _defineProperty(_ref, "".concat(componentCls, "-wrapper:not(").concat(componentCls, "-expandable)"), _defineProperty({}, "".concat(componentCls, ":not(").concat(componentCls, "-bordered)"), _defineProperty({}, "".concat(componentCls, "-tbody"), _defineProperty({}, "tr:not(".concat(componentCls, "-measure-row) > td"), {
|
|
77
77
|
border: 'none'
|
|
78
|
-
})))), _defineProperty(_ref, "".concat(componentCls, "-wrapper").concat(componentCls, "-expandable"), (
|
|
78
|
+
})))), _defineProperty(_ref, "".concat(componentCls, "-wrapper").concat(componentCls, "-expandable"), _defineProperty({}, "".concat(componentCls), _defineProperty({}, "".concat(componentCls, "-tbody"), _defineProperty({}, "tr:nth-child(2n):not(".concat(componentCls, "-placeholder):not(").concat(componentCls, "-row-selected):not(").concat(componentCls, "-expanded-row)"), (_trNthChild2nNot = {}, _defineProperty(_trNthChild2nNot, '& > td', {
|
|
79
79
|
backgroundColor: colorBgBase
|
|
80
80
|
}), _defineProperty(_trNthChild2nNot, '&:hover', {
|
|
81
81
|
td: {
|
|
82
82
|
backgroundColor: colorPrimaryBgHover
|
|
83
83
|
}
|
|
84
|
-
}), _trNthChild2nNot)))), _defineProperty(_$
|
|
85
|
-
borderTop: 'none'
|
|
86
|
-
})), _$concat$concat4)), _defineProperty(_ref, "".concat(componentCls, "-wrapper"), _defineProperty({}, "".concat(componentCls, "-pagination"), (_$concat15 = {}, _defineProperty(_$concat15, "&".concat(antCls, "-pagination"), {
|
|
84
|
+
}), _trNthChild2nNot))))), _defineProperty(_ref, "".concat(componentCls, "-wrapper"), (_$concat16 = {}, _defineProperty(_$concat16, "".concat(componentCls, "-pagination"), (_$concat14 = {}, _defineProperty(_$concat14, "&".concat(antCls, "-pagination"), {
|
|
87
85
|
padding: "".concat(padding, "px 0"),
|
|
88
86
|
margin: '0 !important',
|
|
89
87
|
borderTop: "1px solid ".concat(colorBorderSecondary)
|
|
90
|
-
}), _defineProperty(_$
|
|
88
|
+
}), _defineProperty(_$concat14, "".concat(componentCls, "-batch-operation-bar"), _defineProperty({
|
|
91
89
|
position: 'absolute',
|
|
92
90
|
left: 0,
|
|
93
91
|
display: 'inline-block',
|
|
@@ -98,7 +96,10 @@ export var genTableStyle = function genTableStyle(token) {
|
|
|
98
96
|
}, "".concat(componentCls, "-batch-operation-selection-count"), {
|
|
99
97
|
margin: "0 ".concat(marginXS, "px"),
|
|
100
98
|
color: colorLink
|
|
101
|
-
}))), _$
|
|
99
|
+
}))), _$concat14)), _defineProperty(_$concat16, "".concat(componentCls).concat(componentCls, "-bordered"), _defineProperty({}, "&+".concat(componentCls, "-pagination"), _defineProperty({}, "&".concat(antCls, "-pagination"), {
|
|
100
|
+
// Remove pagination borderTop for bordered Table
|
|
101
|
+
borderTop: 'none'
|
|
102
|
+
}))), _$concat16)), _defineProperty(_ref, "".concat(antCls, "-popover").concat(componentCls, "-batch-operation-selection-popover"), _defineProperty({}, "".concat(antCls, "-popover-inner"), {
|
|
102
103
|
padding: 0
|
|
103
104
|
})), _ref;
|
|
104
105
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
function _typeof(
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
2
|
var _excluded = ["tab", "tag"];
|
|
3
|
-
function ownKeys(
|
|
4
|
-
function _objectSpread(
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
7
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
package/es/tabs/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
function _typeof(
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
2
|
var _excluded = ["children", "items", "type", "tabPosition", "prefixCls", "className"];
|
|
3
|
-
function ownKeys(
|
|
4
|
-
function _objectSpread(
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
7
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
package/es/tabs/style/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function _typeof(
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
2
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3
3
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
4
4
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
package/es/tag/index.d.ts
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
|
+
import type { TagProps as AntTagProps } from 'antd/es/tag';
|
|
2
|
+
import React from 'react';
|
|
1
3
|
export * from 'antd/es/tag';
|
|
4
|
+
export interface TagProps extends AntTagProps {
|
|
5
|
+
ellipsis?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const Tag: {
|
|
8
|
+
({ prefixCls: customizePrefixCls, className, ellipsis, ...restProps }: TagProps): import("@emotion/react/types/jsx-namespace").EmotionJSX.Element;
|
|
9
|
+
displayName: string;
|
|
10
|
+
CheckableTag: React.ForwardRefExoticComponent<import("antd/es/tag").CheckableTagProps & React.RefAttributes<HTMLSpanElement>>;
|
|
11
|
+
};
|
|
12
|
+
export default Tag;
|
package/es/tag/index.js
CHANGED
|
@@ -1 +1,54 @@
|
|
|
1
|
-
|
|
1
|
+
var _excluded = ["prefixCls", "className", "ellipsis"];
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
9
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
10
|
+
import { Tag as AntTag } from 'antd';
|
|
11
|
+
import { Typography } from "./..";
|
|
12
|
+
import classNames from 'classnames';
|
|
13
|
+
import React, { useContext } from 'react';
|
|
14
|
+
import ConfigProvider from "../config-provider";
|
|
15
|
+
import useStyle from "./style";
|
|
16
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
+
export * from 'antd/es/tag';
|
|
18
|
+
var CheckableTag = AntTag.CheckableTag;
|
|
19
|
+
var Tag = function Tag(_ref) {
|
|
20
|
+
var _restProps$children, _restProps$children2;
|
|
21
|
+
var customizePrefixCls = _ref.prefixCls,
|
|
22
|
+
className = _ref.className,
|
|
23
|
+
_ref$ellipsis = _ref.ellipsis,
|
|
24
|
+
ellipsis = _ref$ellipsis === void 0 ? true : _ref$ellipsis,
|
|
25
|
+
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
26
|
+
var _useContext = useContext(ConfigProvider.ConfigContext),
|
|
27
|
+
getPrefixCls = _useContext.getPrefixCls;
|
|
28
|
+
var prefixCls = getPrefixCls('tag', customizePrefixCls);
|
|
29
|
+
var _useStyle = useStyle(prefixCls),
|
|
30
|
+
wrapSSR = _useStyle.wrapSSR;
|
|
31
|
+
var tagCls = classNames(_defineProperty({}, "".concat(prefixCls, "-ellipsis"), ellipsis), className);
|
|
32
|
+
var childrenType = (_restProps$children = restProps.children) === null || _restProps$children === void 0 ? void 0 : _restProps$children.type;
|
|
33
|
+
var _ref2 = ((_restProps$children2 = restProps.children) === null || _restProps$children2 === void 0 ? void 0 : _restProps$children2.props) || {},
|
|
34
|
+
defalutEllipsis = _ref2.ellipsis,
|
|
35
|
+
defaultChildren = _ref2.children;
|
|
36
|
+
var ellipsisConfig = _typeof(defalutEllipsis) === 'object' ? defalutEllipsis : {
|
|
37
|
+
tooltip: childrenType !== null && childrenType !== void 0 && childrenType.__ANT_TOOLTIP ? false : defaultChildren || restProps.children
|
|
38
|
+
};
|
|
39
|
+
return ellipsis ? wrapSSR( /*#__PURE__*/_jsx(Typography.Text, {
|
|
40
|
+
ellipsis: _objectSpread({}, ellipsisConfig),
|
|
41
|
+
children: /*#__PURE__*/_jsx(AntTag, _objectSpread({
|
|
42
|
+
prefixCls: customizePrefixCls,
|
|
43
|
+
className: tagCls
|
|
44
|
+
}, restProps))
|
|
45
|
+
})) : /*#__PURE__*/_jsx(AntTag, _objectSpread({
|
|
46
|
+
prefixCls: customizePrefixCls,
|
|
47
|
+
className: tagCls
|
|
48
|
+
}, restProps));
|
|
49
|
+
};
|
|
50
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
51
|
+
Tag.displayName = AntTag.displayName;
|
|
52
|
+
}
|
|
53
|
+
Tag.CheckableTag = CheckableTag;
|
|
54
|
+
export default Tag;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type FullToken, type GenerateStyle } from 'antd/es/theme/internal';
|
|
3
|
+
export type TagToken = FullToken<'Tag'>;
|
|
4
|
+
export declare const genTagStyle: GenerateStyle<TagToken>;
|
|
5
|
+
declare const _default: (prefixCls: string) => {
|
|
6
|
+
wrapSSR: (node: import("react").ReactNode) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
7
|
+
hashId: string;
|
|
8
|
+
};
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
4
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
5
|
+
import { genComponentStyleHook } from "../../_util/genComponentStyleHook";
|
|
6
|
+
import { genPresetColor } from 'antd/lib/theme/internal';
|
|
7
|
+
import { TinyColor } from '@ctrl/tinycolor';
|
|
8
|
+
var getTagBorderColor = function getTagBorderColor(color) {
|
|
9
|
+
return new TinyColor(color).setAlpha(0.4).toHex8String();
|
|
10
|
+
};
|
|
11
|
+
var genTagPresetStatusStyle = function genTagPresetStatusStyle(token, status) {
|
|
12
|
+
var borderColorMap = {
|
|
13
|
+
success: token.colorSuccessBorder,
|
|
14
|
+
processing: token.colorInfoBorder,
|
|
15
|
+
error: token.colorErrorBorder,
|
|
16
|
+
warning: token.colorWarningBorder
|
|
17
|
+
};
|
|
18
|
+
return _defineProperty({}, "".concat(token.componentCls).concat(token.componentCls, "-").concat(status), {
|
|
19
|
+
borderColor: getTagBorderColor(borderColorMap[status])
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var genPresetStyle = function genPresetStyle(token) {
|
|
23
|
+
return genPresetColor(token, function (colorKey, _ref2) {
|
|
24
|
+
var textColor = _ref2.textColor,
|
|
25
|
+
lightBorderColor = _ref2.lightBorderColor;
|
|
26
|
+
return _defineProperty({}, "".concat(token.componentCls).concat(token.componentCls, "-").concat(colorKey), {
|
|
27
|
+
color: textColor,
|
|
28
|
+
borderColor: getTagBorderColor(lightBorderColor)
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
export var genTagStyle = function genTagStyle(token) {
|
|
33
|
+
var _$concat;
|
|
34
|
+
var componentCls = token.componentCls;
|
|
35
|
+
return _defineProperty({}, "".concat(componentCls), (_$concat = {
|
|
36
|
+
borderColor: getTagBorderColor(token.colorBorder)
|
|
37
|
+
}, _defineProperty(_$concat, "&-ellipsis", {
|
|
38
|
+
maxWidth: '100%',
|
|
39
|
+
textOverflow: 'ellipsis',
|
|
40
|
+
overflow: 'hidden',
|
|
41
|
+
verticalAlign: 'bottom'
|
|
42
|
+
}), _defineProperty(_$concat, "&-checkable", {
|
|
43
|
+
borderColor: 'transparent'
|
|
44
|
+
}), _defineProperty(_$concat, "&-hidden", {
|
|
45
|
+
display: 'none'
|
|
46
|
+
}), _defineProperty(_$concat, "&-borderless", {
|
|
47
|
+
border: 'transparent'
|
|
48
|
+
}), _$concat));
|
|
49
|
+
};
|
|
50
|
+
export default (function (prefixCls) {
|
|
51
|
+
var useStyle = genComponentStyleHook('Tag', function (token) {
|
|
52
|
+
return [genTagStyle(token), genPresetStyle(token), genTagPresetStatusStyle(token, 'success'), genTagPresetStatusStyle(token, 'error'), genTagPresetStatusStyle(token, 'processing'), genTagPresetStatusStyle(token, 'warning')];
|
|
53
|
+
});
|
|
54
|
+
return useStyle(prefixCls);
|
|
55
|
+
});
|
package/es/theme/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
function _typeof(
|
|
2
|
-
function ownKeys(
|
|
3
|
-
function _objectSpread(
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
5
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
6
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
function _typeof(
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
2
|
var _excluded = ["children", "title", "color", "visible", "open", "onOpenChange", "onVisibleChange", "overlayInnerStyle", "mouseEnterDelay", "mouseLeaveDelay"],
|
|
3
3
|
_excluded2 = ["color"];
|
|
4
|
-
function ownKeys(
|
|
5
|
-
function _objectSpread(
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
6
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
7
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
8
8
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
@@ -10,14 +10,14 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
|
10
10
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
11
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
12
12
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
13
|
-
function _iterableToArrayLimit(
|
|
13
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
14
14
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
15
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
16
16
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
17
17
|
import { useMouse, useSize } from 'ahooks';
|
|
18
18
|
import React, { useRef, useState } from 'react';
|
|
19
19
|
import ReactStickyMouseTooltip from 'react-sticky-mouse-tooltip';
|
|
20
|
-
import
|
|
20
|
+
import theme from "../theme";
|
|
21
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
22
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
23
23
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -37,6 +37,8 @@ var MouseTooltip = function MouseTooltip(_ref) {
|
|
|
37
37
|
_ref$mouseLeaveDelay = _ref.mouseLeaveDelay,
|
|
38
38
|
mouseLeaveDelay = _ref$mouseLeaveDelay === void 0 ? 0.1 : _ref$mouseLeaveDelay,
|
|
39
39
|
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
40
|
+
var _theme$useToken = theme.useToken(),
|
|
41
|
+
token = _theme$useToken.token;
|
|
40
42
|
var _useState = useState(false),
|
|
41
43
|
_useState2 = _slicedToArray(_useState, 2),
|
|
42
44
|
visible = _useState2[0],
|
|
@@ -46,8 +48,8 @@ var MouseTooltip = function MouseTooltip(_ref) {
|
|
|
46
48
|
restOverlayInnerStyle = _objectWithoutProperties(_ref2, _excluded2);
|
|
47
49
|
var handleVisibleChange = function handleVisibleChange(value) {
|
|
48
50
|
setVisible(value);
|
|
49
|
-
onOpenChange === null || onOpenChange === void 0
|
|
50
|
-
onVisibleChange === null || onVisibleChange === void 0
|
|
51
|
+
onOpenChange === null || onOpenChange === void 0 || onOpenChange(value);
|
|
52
|
+
onVisibleChange === null || onVisibleChange === void 0 || onVisibleChange(value);
|
|
51
53
|
};
|
|
52
54
|
|
|
53
55
|
// 获取鼠标位置
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import theme from "../../theme";
|
|
2
|
+
export var useTooltipTypeList = function useTooltipTypeList() {
|
|
3
|
+
var _theme$useToken = theme.useToken(),
|
|
4
|
+
token = _theme$useToken.token;
|
|
5
|
+
return [{
|
|
6
|
+
type: 'light',
|
|
7
|
+
color: token.colorText,
|
|
8
|
+
backgroundColor: token.colorBgElevated
|
|
9
|
+
}, {
|
|
10
|
+
type: 'success',
|
|
11
|
+
color: token.colorSuccess,
|
|
12
|
+
backgroundColor: token.colorSuccessBg
|
|
13
|
+
}, {
|
|
14
|
+
type: 'info',
|
|
15
|
+
color: token.colorInfo,
|
|
16
|
+
backgroundColor: token.colorInfoBg
|
|
17
|
+
}, {
|
|
18
|
+
type: 'warning',
|
|
19
|
+
color: token.colorWarning,
|
|
20
|
+
backgroundColor: token.colorWarningBg
|
|
21
|
+
}, {
|
|
22
|
+
type: 'error',
|
|
23
|
+
color: token.colorError,
|
|
24
|
+
backgroundColor: token.colorErrorBg
|
|
25
|
+
}];
|
|
26
|
+
};
|
package/es/tooltip/index.d.ts
CHANGED
|
@@ -8,11 +8,6 @@ export interface TooltipProps extends AntTooltipPropsWithTitle {
|
|
|
8
8
|
closeIcon?: boolean | React.ReactNode;
|
|
9
9
|
onClose?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
10
10
|
}
|
|
11
|
-
export declare const getTooltipTypeList: () => {
|
|
12
|
-
type: string;
|
|
13
|
-
color: string;
|
|
14
|
-
backgroundColor: string;
|
|
15
|
-
}[];
|
|
16
11
|
type CompoundedComponent = React.FC<TooltipProps> & {
|
|
17
12
|
/** @internal */
|
|
18
13
|
__ANT_TOOLTIP: boolean;
|
package/es/tooltip/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
function _typeof(
|
|
2
|
-
var _excluded = ["children", "
|
|
3
|
-
function ownKeys(
|
|
4
|
-
function _objectSpread(
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["children", "title", "type", "color", "mouseFollow", "closeIcon", "onClose", "open", "defaultOpen", "onOpenChange", "visible", "defaultVisible", "onVisibleChange", "overlayInnerStyle", "className"];
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
7
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
@@ -9,58 +9,41 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
|
9
9
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
10
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
11
11
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
12
|
-
function _iterableToArrayLimit(
|
|
12
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
13
13
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
14
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
15
15
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
16
16
|
import { Tooltip as AntTooltip, Space } from 'antd';
|
|
17
|
-
import React, { useContext,
|
|
17
|
+
import React, { useContext, useEffect, useState } from 'react';
|
|
18
18
|
import { CloseOutlined } from '@oceanbase/icons';
|
|
19
|
+
import classNames from 'classnames';
|
|
19
20
|
import { isNil } from 'lodash';
|
|
20
|
-
import { token } from "../static-function";
|
|
21
21
|
import MouseTooltip from "./MouseTooltip";
|
|
22
22
|
import ConfigProvider from "../config-provider";
|
|
23
23
|
import useStyle from "./style";
|
|
24
|
-
import
|
|
24
|
+
import { useTooltipTypeList } from "./hooks/useTooltipTypeList";
|
|
25
25
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
26
26
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
27
27
|
export * from 'antd/es/tooltip';
|
|
28
|
-
export var getTooltipTypeList = function getTooltipTypeList() {
|
|
29
|
-
return [{
|
|
30
|
-
type: 'light',
|
|
31
|
-
color: token.colorText,
|
|
32
|
-
backgroundColor: token.colorBgElevated
|
|
33
|
-
}, {
|
|
34
|
-
type: 'success',
|
|
35
|
-
color: token.colorSuccess,
|
|
36
|
-
backgroundColor: token.colorSuccessBg
|
|
37
|
-
}, {
|
|
38
|
-
type: 'info',
|
|
39
|
-
color: token.colorInfo,
|
|
40
|
-
backgroundColor: token.colorInfoBg
|
|
41
|
-
}, {
|
|
42
|
-
type: 'warning',
|
|
43
|
-
color: token.colorWarning,
|
|
44
|
-
backgroundColor: token.colorWarningBg
|
|
45
|
-
}, {
|
|
46
|
-
type: 'error',
|
|
47
|
-
color: token.colorError,
|
|
48
|
-
backgroundColor: token.colorErrorBg
|
|
49
|
-
}];
|
|
50
|
-
};
|
|
51
28
|
var Tooltip = function Tooltip(_ref) {
|
|
29
|
+
var _ref2, _ref3, _ref4;
|
|
52
30
|
var children = _ref.children,
|
|
31
|
+
title = _ref.title,
|
|
53
32
|
_ref$type = _ref.type,
|
|
54
33
|
type = _ref$type === void 0 ? 'default' : _ref$type,
|
|
55
34
|
color = _ref.color,
|
|
56
|
-
overlayInnerStyle = _ref.overlayInnerStyle,
|
|
57
35
|
mouseFollow = _ref.mouseFollow,
|
|
58
36
|
_ref$closeIcon = _ref.closeIcon,
|
|
59
37
|
closeIcon = _ref$closeIcon === void 0 ? false : _ref$closeIcon,
|
|
60
38
|
onClose = _ref.onClose,
|
|
61
|
-
|
|
39
|
+
open = _ref.open,
|
|
40
|
+
defaultOpen = _ref.defaultOpen,
|
|
41
|
+
_onOpenChange = _ref.onOpenChange,
|
|
42
|
+
visible = _ref.visible,
|
|
43
|
+
defaultVisible = _ref.defaultVisible,
|
|
44
|
+
onVisibleChange = _ref.onVisibleChange,
|
|
45
|
+
overlayInnerStyle = _ref.overlayInnerStyle,
|
|
62
46
|
className = _ref.className,
|
|
63
|
-
propOpen = _ref.open,
|
|
64
47
|
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
65
48
|
var _useContext = useContext(ConfigProvider.ConfigContext),
|
|
66
49
|
getPrefixCls = _useContext.getPrefixCls;
|
|
@@ -70,39 +53,40 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
70
53
|
wrapSSR = _useStyle.wrapSSR,
|
|
71
54
|
hashId = _useStyle.hashId;
|
|
72
55
|
var tooltipCls = classNames(className, hashId);
|
|
73
|
-
var _useState = useState(
|
|
56
|
+
var _useState = useState((_ref2 = (_ref3 = open !== null && open !== void 0 ? open : visible) !== null && _ref3 !== void 0 ? _ref3 : defaultOpen) !== null && _ref2 !== void 0 ? _ref2 : defaultVisible),
|
|
74
57
|
_useState2 = _slicedToArray(_useState, 2),
|
|
75
58
|
innerOpen = _useState2[0],
|
|
76
59
|
setInnerOpen = _useState2[1];
|
|
77
|
-
var
|
|
60
|
+
var newOpen = (_ref4 = open !== null && open !== void 0 ? open : visible) !== null && _ref4 !== void 0 ? _ref4 : innerOpen;
|
|
61
|
+
useEffect(function () {
|
|
62
|
+
if (!isNil(open)) {
|
|
63
|
+
setInnerOpen(open);
|
|
64
|
+
} else if (!isNil(visible)) {
|
|
65
|
+
setInnerOpen(visible);
|
|
66
|
+
}
|
|
67
|
+
}, [open, visible]);
|
|
78
68
|
var handleCloseClick = function handleCloseClick(e) {
|
|
79
69
|
e.stopPropagation();
|
|
80
|
-
onClose === null || onClose === void 0
|
|
70
|
+
onClose === null || onClose === void 0 || onClose(e);
|
|
81
71
|
if (e.defaultPrevented) {
|
|
82
72
|
return;
|
|
83
73
|
}
|
|
84
74
|
setInnerOpen(false);
|
|
85
75
|
};
|
|
86
|
-
var
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}) : /*#__PURE__*/_jsx("span", {
|
|
95
|
-
className: "".concat(prefixCls, "-close-icon"),
|
|
96
|
-
onClick: handleCloseClick,
|
|
97
|
-
children: closeIcon
|
|
98
|
-
});
|
|
99
|
-
}, [closeIcon]);
|
|
76
|
+
var closeIconNode = closeIcon ? closeIcon === true ? /*#__PURE__*/_jsx(CloseOutlined, {
|
|
77
|
+
className: "".concat(prefixCls, "-close-icon"),
|
|
78
|
+
onClick: handleCloseClick
|
|
79
|
+
}) : /*#__PURE__*/_jsx("span", {
|
|
80
|
+
className: "".concat(prefixCls, "-close-icon"),
|
|
81
|
+
onClick: handleCloseClick,
|
|
82
|
+
children: closeIcon
|
|
83
|
+
}) : null;
|
|
100
84
|
var titleNode = typeof title === 'function' ? title() : title;
|
|
101
|
-
var
|
|
85
|
+
var newTitle = closeIcon ? /*#__PURE__*/_jsxs(Space, {
|
|
102
86
|
className: "".concat(prefixCls, "-close-icon-wrap"),
|
|
103
|
-
children: [titleNode,
|
|
104
|
-
});
|
|
105
|
-
var typeList =
|
|
87
|
+
children: [titleNode, closeIconNode]
|
|
88
|
+
}) : titleNode;
|
|
89
|
+
var typeList = useTooltipTypeList();
|
|
106
90
|
var typeItem = typeList.find(function (item) {
|
|
107
91
|
return item.type === type;
|
|
108
92
|
});
|
|
@@ -116,11 +100,14 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
116
100
|
}, restProps), {}, {
|
|
117
101
|
children: children
|
|
118
102
|
})) : /*#__PURE__*/_jsx(AntTooltip, _objectSpread(_objectSpread({
|
|
119
|
-
title:
|
|
103
|
+
title: newTitle,
|
|
120
104
|
color: color || (typeItem === null || typeItem === void 0 ? void 0 : typeItem.backgroundColor),
|
|
121
|
-
open:
|
|
122
|
-
|
|
123
|
-
|
|
105
|
+
open: newOpen,
|
|
106
|
+
defaultOpen: defaultOpen,
|
|
107
|
+
onOpenChange: function onOpenChange(value) {
|
|
108
|
+
setInnerOpen(value);
|
|
109
|
+
onVisibleChange === null || onVisibleChange === void 0 || onVisibleChange(value);
|
|
110
|
+
_onOpenChange === null || _onOpenChange === void 0 || _onOpenChange(value);
|
|
124
111
|
},
|
|
125
112
|
overlayInnerStyle: _objectSpread({
|
|
126
113
|
color: typeItem === null || typeItem === void 0 ? void 0 : typeItem.color
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function _typeof(
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
2
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3
3
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
4
4
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|