@douyinfe/semi-ui 2.45.3 → 2.46.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.
@@ -356,7 +356,7 @@ class monthCalendar extends _baseComponent.default {
356
356
  }
357
357
  }
358
358
  if (!(0, _isEqual2.default)(prevEventKeys, nowEventKeys) || itemLimitUpdate || !(0, _isEqual2.default)(prevProps.displayValue, this.props.displayValue)) {
359
- this.foundation.parseMonthlyEvents(itemLimit || this.props.events);
359
+ this.foundation.parseMonthlyEvents(itemLimit);
360
360
  }
361
361
  }
362
362
  closeCard(e, key) {
@@ -132,7 +132,6 @@ export default class Base extends Component<BaseTypographyProps, BaseTypographyS
132
132
  shouldTruncated: (rows: number) => boolean;
133
133
  showTooltip: () => boolean | ShowTooltip | {
134
134
  type: string;
135
- opts: {};
136
135
  };
137
136
  getEllipsisState(): boolean;
138
137
  /**
@@ -191,7 +190,7 @@ export default class Base extends Component<BaseTypographyProps, BaseTypographyS
191
190
  renderCopy(): JSX.Element;
192
191
  renderIcon(): JSX.Element;
193
192
  renderContent(): JSX.Element;
194
- renderTipWrapper(): JSX.Element;
193
+ renderTipWrapper(): string | number | boolean | React.ReactFragment | JSX.Element;
195
194
  render(): JSX.Element;
196
195
  }
197
196
  export {};
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+ var _isFunction2 = _interopRequireDefault(require("lodash/isFunction"));
7
8
  var _isNull2 = _interopRequireDefault(require("lodash/isNull"));
8
9
  var _isString2 = _interopRequireDefault(require("lodash/isString"));
9
10
  var _merge2 = _interopRequireDefault(require("lodash/merge"));
@@ -102,6 +103,7 @@ class Base extends _react.Component {
102
103
  return updateOverflow;
103
104
  };
104
105
  this.showTooltip = () => {
106
+ var _a, _b;
105
107
  const {
106
108
  isOverflowed,
107
109
  isTruncated,
@@ -119,8 +121,7 @@ class Base extends _react.Component {
119
121
  return show;
120
122
  }
121
123
  const defaultOpts = {
122
- type: 'tooltip',
123
- opts: {}
124
+ type: 'tooltip'
124
125
  };
125
126
  if (typeof showTooltip === 'object') {
126
127
  if (showTooltip.type && showTooltip.type.toLowerCase() === 'popover') {
@@ -129,7 +130,14 @@ class Base extends _react.Component {
129
130
  // style: { width: '240px' },
130
131
  showArrow: true
131
132
  }
132
- }, showTooltip);
133
+ }, showTooltip, {
134
+ opts: {
135
+ className: (0, _classnames.default)({
136
+ [`${prefixCls}-ellipsis-popover`]: true,
137
+ [(_a = showTooltip === null || showTooltip === void 0 ? void 0 : showTooltip.opts) === null || _a === void 0 ? void 0 : _a.className]: Boolean((_b = showTooltip === null || showTooltip === void 0 ? void 0 : showTooltip.opts) === null || _b === void 0 ? void 0 : _b.className)
138
+ })
139
+ }
140
+ });
133
141
  }
134
142
  return Object.assign(Object.assign({}, defaultOpts), showTooltip);
135
143
  }
@@ -531,9 +539,12 @@ class Base extends _react.Component {
531
539
  if (showTooltip) {
532
540
  const {
533
541
  type,
534
- opts
542
+ opts,
543
+ renderTooltip
535
544
  } = showTooltip;
536
- if (type.toLowerCase() === 'popover') {
545
+ if ((0, _isFunction2.default)(renderTooltip)) {
546
+ return renderTooltip(children, content);
547
+ } else if (type.toLowerCase() === 'popover') {
537
548
  return /*#__PURE__*/_react.default.createElement(_index2.default, Object.assign({
538
549
  content: children,
539
550
  position: "top"
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  import { PopoverProps } from '../popover';
3
3
  import { TooltipProps } from '../tooltip';
4
4
  import { ArrayElement } from '../_base/base';
@@ -7,6 +7,7 @@ export type EllipsisPos = 'end' | 'middle';
7
7
  export type ShowTooltip = {
8
8
  type?: string;
9
9
  opts?: Partial<PopoverProps> & Partial<TooltipProps>;
10
+ renderTooltip?: (content: TooltipProps['content'], children: ReactNode) => ReactNode;
10
11
  };
11
12
  export type Ellipsis = {
12
13
  collapseText?: string;
@@ -348,7 +348,7 @@ export default class monthCalendar extends BaseComponent {
348
348
  }
349
349
  }
350
350
  if (!_isEqual(prevEventKeys, nowEventKeys) || itemLimitUpdate || !_isEqual(prevProps.displayValue, this.props.displayValue)) {
351
- this.foundation.parseMonthlyEvents(itemLimit || this.props.events);
351
+ this.foundation.parseMonthlyEvents(itemLimit);
352
352
  }
353
353
  }
354
354
  closeCard(e, key) {
@@ -132,7 +132,6 @@ export default class Base extends Component<BaseTypographyProps, BaseTypographyS
132
132
  shouldTruncated: (rows: number) => boolean;
133
133
  showTooltip: () => boolean | ShowTooltip | {
134
134
  type: string;
135
- opts: {};
136
135
  };
137
136
  getEllipsisState(): boolean;
138
137
  /**
@@ -191,7 +190,7 @@ export default class Base extends Component<BaseTypographyProps, BaseTypographyS
191
190
  renderCopy(): JSX.Element;
192
191
  renderIcon(): JSX.Element;
193
192
  renderContent(): JSX.Element;
194
- renderTipWrapper(): JSX.Element;
193
+ renderTipWrapper(): string | number | boolean | React.ReactFragment | JSX.Element;
195
194
  render(): JSX.Element;
196
195
  }
197
196
  export {};
@@ -1,3 +1,4 @@
1
+ import _isFunction from "lodash/isFunction";
1
2
  import _isNull from "lodash/isNull";
2
3
  import _isString from "lodash/isString";
3
4
  import _merge from "lodash/merge";
@@ -93,6 +94,7 @@ export default class Base extends Component {
93
94
  return updateOverflow;
94
95
  };
95
96
  this.showTooltip = () => {
97
+ var _a, _b;
96
98
  const {
97
99
  isOverflowed,
98
100
  isTruncated,
@@ -110,8 +112,7 @@ export default class Base extends Component {
110
112
  return show;
111
113
  }
112
114
  const defaultOpts = {
113
- type: 'tooltip',
114
- opts: {}
115
+ type: 'tooltip'
115
116
  };
116
117
  if (typeof showTooltip === 'object') {
117
118
  if (showTooltip.type && showTooltip.type.toLowerCase() === 'popover') {
@@ -120,7 +121,14 @@ export default class Base extends Component {
120
121
  // style: { width: '240px' },
121
122
  showArrow: true
122
123
  }
123
- }, showTooltip);
124
+ }, showTooltip, {
125
+ opts: {
126
+ className: cls({
127
+ [`${prefixCls}-ellipsis-popover`]: true,
128
+ [(_a = showTooltip === null || showTooltip === void 0 ? void 0 : showTooltip.opts) === null || _a === void 0 ? void 0 : _a.className]: Boolean((_b = showTooltip === null || showTooltip === void 0 ? void 0 : showTooltip.opts) === null || _b === void 0 ? void 0 : _b.className)
129
+ })
130
+ }
131
+ });
124
132
  }
125
133
  return Object.assign(Object.assign({}, defaultOpts), showTooltip);
126
134
  }
@@ -522,9 +530,12 @@ export default class Base extends Component {
522
530
  if (showTooltip) {
523
531
  const {
524
532
  type,
525
- opts
533
+ opts,
534
+ renderTooltip
526
535
  } = showTooltip;
527
- if (type.toLowerCase() === 'popover') {
536
+ if (_isFunction(renderTooltip)) {
537
+ return renderTooltip(children, content);
538
+ } else if (type.toLowerCase() === 'popover') {
528
539
  return /*#__PURE__*/React.createElement(Popover, Object.assign({
529
540
  content: children,
530
541
  position: "top"
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  import { PopoverProps } from '../popover';
3
3
  import { TooltipProps } from '../tooltip';
4
4
  import { ArrayElement } from '../_base/base';
@@ -7,6 +7,7 @@ export type EllipsisPos = 'end' | 'middle';
7
7
  export type ShowTooltip = {
8
8
  type?: string;
9
9
  opts?: Partial<PopoverProps> & Partial<TooltipProps>;
10
+ renderTooltip?: (content: TooltipProps['content'], children: ReactNode) => ReactNode;
10
11
  };
11
12
  export type Ellipsis = {
12
13
  collapseText?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-ui",
3
- "version": "2.45.3",
3
+ "version": "2.46.0",
4
4
  "description": "A modern, comprehensive, flexible design system and UI library. Connect DesignOps & DevOps. Quickly build beautiful React apps. Maintained by Douyin-fe team.",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es/index.js",
@@ -20,12 +20,12 @@
20
20
  "@dnd-kit/core": "^6.0.8",
21
21
  "@dnd-kit/sortable": "^7.0.2",
22
22
  "@dnd-kit/utilities": "^3.2.1",
23
- "@douyinfe/semi-animation": "2.45.3",
24
- "@douyinfe/semi-animation-react": "2.45.3",
25
- "@douyinfe/semi-foundation": "2.45.3",
26
- "@douyinfe/semi-icons": "2.45.3",
27
- "@douyinfe/semi-illustrations": "2.45.3",
28
- "@douyinfe/semi-theme-default": "2.45.3",
23
+ "@douyinfe/semi-animation": "2.46.0",
24
+ "@douyinfe/semi-animation-react": "2.46.0",
25
+ "@douyinfe/semi-foundation": "2.46.0",
26
+ "@douyinfe/semi-icons": "2.46.0",
27
+ "@douyinfe/semi-illustrations": "2.46.0",
28
+ "@douyinfe/semi-theme-default": "2.46.0",
29
29
  "async-validator": "^3.5.0",
30
30
  "classnames": "^2.2.6",
31
31
  "copy-text-to-clipboard": "^2.1.1",
@@ -75,7 +75,7 @@
75
75
  ],
76
76
  "author": "",
77
77
  "license": "MIT",
78
- "gitHead": "53c1fbfd1cc2dce6195a49a2797d3d05354d3d87",
78
+ "gitHead": "0de820bf1a275d5c759091247326bbd7fc0d873c",
79
79
  "devDependencies": {
80
80
  "@babel/plugin-proposal-decorators": "^7.15.8",
81
81
  "@babel/plugin-transform-runtime": "^7.15.8",