@douyinfe/semi-ui 2.50.1 → 2.51.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.
@@ -1,3 +1,4 @@
1
+ import _omit from "lodash/omit";
1
2
  import _isEqual from "lodash/isEqual";
2
3
  import _isObject from "lodash/isObject";
3
4
  var __rest = this && this.__rest || function (s, e) {
@@ -145,6 +146,10 @@ export default class Preview extends BaseComponent {
145
146
  setDownloadName
146
147
  } = _a,
147
148
  restProps = __rest(_a, ["src", "className", "style", "lazyLoad", "setDownloadName"]);
149
+ const previewInnerProps = Object.assign(Object.assign({}, _omit(restProps, ['previewCls', 'previewStyle'])), {
150
+ className: restProps === null || restProps === void 0 ? void 0 : restProps.previewCls,
151
+ style: restProps === null || restProps === void 0 ? void 0 : restProps.previewStyle
152
+ });
148
153
  const {
149
154
  currentIndex,
150
155
  visible
@@ -173,7 +178,7 @@ export default class Preview extends BaseComponent {
173
178
  id: this.previewGroupId,
174
179
  style: style,
175
180
  className: cls(`${prefixCls}-preview-group`, className)
176
- }, newChildren), /*#__PURE__*/React.createElement(PreviewInner, Object.assign({}, restProps, {
181
+ }, newChildren), /*#__PURE__*/React.createElement(PreviewInner, Object.assign({}, previewInnerProps, {
177
182
  ref: this.previewRef,
178
183
  src: finalSrcList,
179
184
  currentIndex: currentIndex,
@@ -207,6 +212,8 @@ Preview.propTypes = {
207
212
  lazyLoadMargin: PropTypes.string,
208
213
  preLoad: PropTypes.bool,
209
214
  preLoadGap: PropTypes.number,
215
+ previewCls: PropTypes.string,
216
+ previewStyle: PropTypes.object,
210
217
  disableDownload: PropTypes.bool,
211
218
  zIndex: PropTypes.number,
212
219
  renderHeader: PropTypes.func,
@@ -226,5 +233,6 @@ Preview.propTypes = {
226
233
  Preview.defaultProps = {
227
234
  src: [],
228
235
  lazyLoad: true,
229
- lazyLoadMargin: "0px 100px 100px 0px"
236
+ lazyLoadMargin: "0px 100px 100px 0px",
237
+ closable: true
230
238
  };
@@ -85,11 +85,13 @@ export default class Footer extends BaseComponent {
85
85
  // 根据 props 中的 showTooltip 决定是否使用 Tooltip 包一层
86
86
  this.getFinalIconElement = (element, content, key) => {
87
87
  const {
88
- showTooltip
88
+ showTooltip,
89
+ zIndex
89
90
  } = this.props;
90
91
  return showTooltip ? /*#__PURE__*/React.createElement(Tooltip, {
91
92
  content: content,
92
- key: `tooltip-${key}`
93
+ key: `tooltip-${key}`,
94
+ zIndex: zIndex + 1
93
95
  }, element) : element;
94
96
  };
95
97
  this.getLocalTextByKey = key => /*#__PURE__*/React.createElement(LocaleConsumer, {
@@ -9,7 +9,8 @@ const Header = /*#__PURE__*/forwardRef((_ref, ref) => {
9
9
  onClose,
10
10
  titleStyle,
11
11
  className,
12
- renderHeader
12
+ renderHeader,
13
+ closable
13
14
  } = _ref;
14
15
  return /*#__PURE__*/React.createElement(PreviewContext.Consumer, null, _ref2 => {
15
16
  let {
@@ -26,7 +27,7 @@ const Header = /*#__PURE__*/forwardRef((_ref, ref) => {
26
27
  }, /*#__PURE__*/React.createElement("section", {
27
28
  className: `${prefixCls}-title`,
28
29
  style: titleStyle
29
- }, renderHeader ? renderHeader(title) : title), /*#__PURE__*/React.createElement("section", {
30
+ }, renderHeader ? renderHeader(title) : title), closable && /*#__PURE__*/React.createElement("section", {
30
31
  className: `${prefixCls}-close`,
31
32
  onMouseUp: onClose
32
33
  }, /*#__PURE__*/React.createElement(IconClose, null)));
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import BaseComponent from "../_base/baseComponent";
3
- import { PreviewProps as PreviewInnerProps, PreviewInnerStates } from "./interface";
3
+ import { PreviewInnerProps, PreviewInnerStates } from "./interface";
4
4
  import PropTypes from "prop-types";
5
5
  import PreviewInnerFoundation, { PreviewInnerAdapter, RatioType } from '@douyinfe/semi-foundation/lib/es/image/previewInnerFoundation';
6
6
  import { PreviewContextProps } from "./previewContext";
@@ -3,7 +3,7 @@ import _isEqual from "lodash/isEqual";
3
3
  import React from "react";
4
4
  import BaseComponent from "../_base/baseComponent";
5
5
  import PropTypes from "prop-types";
6
- import { cssClasses } from '@douyinfe/semi-foundation/lib/es/image/constants';
6
+ import { cssClasses, numbers } from '@douyinfe/semi-foundation/lib/es/image/constants';
7
7
  import cls from "classnames";
8
8
  import Portal from "../_portal";
9
9
  import { IconArrowLeft, IconArrowRight } from "@douyinfe/semi-icons";
@@ -263,6 +263,7 @@ export default class PreviewInner extends BaseComponent {
263
263
  render() {
264
264
  const {
265
265
  getPopupContainer,
266
+ closable,
266
267
  zIndex,
267
268
  visible,
268
269
  className,
@@ -309,13 +310,10 @@ export default class PreviewInner extends BaseComponent {
309
310
  const total = imgSrc.length;
310
311
  const showPrev = total !== 1 && (infinite || currentIndex !== 0);
311
312
  const showNext = total !== 1 && (infinite || currentIndex !== total - 1);
312
- return /*#__PURE__*/React.createElement(Portal, {
313
+ return visible && /*#__PURE__*/React.createElement(Portal, {
313
314
  getPopupContainer: getPopupContainer,
314
315
  style: wrapperStyle
315
- }, visible &&
316
- /*#__PURE__*/
317
- // eslint-disable-next-line jsx-a11y/mouse-events-have-key-events,jsx-a11y/no-static-element-interactions
318
- React.createElement("div", {
316
+ }, /*#__PURE__*/React.createElement("div", {
319
317
  className: previewWrapperCls,
320
318
  style: style,
321
319
  onMouseDown: this.handleMouseDown,
@@ -326,7 +324,8 @@ export default class PreviewInner extends BaseComponent {
326
324
  ref: this.headerRef,
327
325
  className: cls(hideViewerCls),
328
326
  onClose: this.handlePreviewClose,
329
- renderHeader: renderHeader
327
+ renderHeader: renderHeader,
328
+ closable: closable
330
329
  }), /*#__PURE__*/React.createElement(PreviewImage, {
331
330
  src: imgSrc[currentIndex],
332
331
  onZoom: this.handleZoomImage,
@@ -369,6 +368,7 @@ export default class PreviewInner extends BaseComponent {
369
368
  ratio: ratio,
370
369
  prevTip: prevTip,
371
370
  nextTip: nextTip,
371
+ zIndex: zIndex,
372
372
  zoomInTip: zoomInTip,
373
373
  zoomOutTip: zoomOutTip,
374
374
  rotateTip: rotateTip,
@@ -439,7 +439,7 @@ PreviewInner.defaultProps = {
439
439
  lazyLoad: false,
440
440
  preLoad: true,
441
441
  preLoadGap: 2,
442
- zIndex: 1000,
442
+ zIndex: numbers.DEFAULT_Z_INDEX,
443
443
  maskClosable: true,
444
444
  viewerVisibleDelay: 10000,
445
445
  maxZoom: 5,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-ui",
3
- "version": "2.50.1",
3
+ "version": "2.51.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.50.1",
24
- "@douyinfe/semi-animation-react": "2.50.1",
25
- "@douyinfe/semi-foundation": "2.50.1",
26
- "@douyinfe/semi-icons": "2.50.1",
27
- "@douyinfe/semi-illustrations": "2.50.1",
28
- "@douyinfe/semi-theme-default": "2.50.1",
23
+ "@douyinfe/semi-animation": "2.51.0",
24
+ "@douyinfe/semi-animation-react": "2.51.0",
25
+ "@douyinfe/semi-foundation": "2.51.0",
26
+ "@douyinfe/semi-icons": "2.51.0",
27
+ "@douyinfe/semi-illustrations": "2.51.0",
28
+ "@douyinfe/semi-theme-default": "2.51.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": "aa51082cdb589792e9224e02c29288991c442344",
78
+ "gitHead": "5a554bf517411b933e891ad51b874bd9eb6c87c6",
79
79
  "devDependencies": {
80
80
  "@babel/plugin-proposal-decorators": "^7.15.8",
81
81
  "@babel/plugin-transform-runtime": "^7.15.8",