You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1815 lines
73 KiB
1815 lines
73 KiB
"use strict";
|
|
(self["webpackChunk"] = self["webpackChunk"] || []).push([[11611],{
|
|
|
|
/***/ 11611:
|
|
/*!**********************************************************************!*\
|
|
!*** ./node_modules/_antd@5.9.0@antd/es/image/index.js + 26 modules ***!
|
|
\**********************************************************************/
|
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
Z: function() { return /* binding */ es_image; }
|
|
});
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
|
|
var _react_17_0_2_react = __webpack_require__(59301);
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.6.1@@ant-design/icons/es/icons/EyeOutlined.js + 1 modules
|
|
var EyeOutlined = __webpack_require__(15277);
|
|
// EXTERNAL MODULE: ./node_modules/_classnames@2.5.1@classnames/index.js
|
|
var _classnames_2_5_1_classnames = __webpack_require__(92310);
|
|
var _classnames_2_5_1_classnames_default = /*#__PURE__*/__webpack_require__.n(_classnames_2_5_1_classnames);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.27.0@@babel/runtime/helpers/esm/extends.js
|
|
var esm_extends = __webpack_require__(72308);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.27.0@@babel/runtime/helpers/esm/objectSpread2.js
|
|
var objectSpread2 = __webpack_require__(77321);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.27.0@@babel/runtime/helpers/esm/defineProperty.js
|
|
var defineProperty = __webpack_require__(49618);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.27.0@@babel/runtime/helpers/esm/slicedToArray.js + 1 modules
|
|
var slicedToArray = __webpack_require__(52487);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.27.0@@babel/runtime/helpers/esm/typeof.js
|
|
var esm_typeof = __webpack_require__(62853);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.27.0@@babel/runtime/helpers/esm/objectWithoutProperties.js
|
|
var objectWithoutProperties = __webpack_require__(74416);
|
|
// EXTERNAL MODULE: ./node_modules/_rc-util@5.44.4@rc-util/es/Dom/css.js
|
|
var css = __webpack_require__(55468);
|
|
// EXTERNAL MODULE: ./node_modules/_rc-util@5.44.4@rc-util/es/hooks/useMergedState.js
|
|
var useMergedState = __webpack_require__(18929);
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-image@7.2.0@rc-image/es/common.js
|
|
var COMMON_PROPS = ['crossOrigin', 'decoding', 'draggable', 'loading', 'referrerPolicy', 'sizes', 'srcSet', 'useMap', 'alt'];
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-image@7.2.0@rc-image/es/context.js
|
|
|
|
var PreviewGroupContext = /*#__PURE__*/_react_17_0_2_react.createContext(null);
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-image@7.2.0@rc-image/es/hooks/useRegisterImage.js
|
|
|
|
|
|
|
|
var uid = 0;
|
|
function useRegisterImage(canPreview, data) {
|
|
var _React$useState = _react_17_0_2_react.useState(function () {
|
|
uid += 1;
|
|
return String(uid);
|
|
}),
|
|
_React$useState2 = (0,slicedToArray/* default */.Z)(_React$useState, 1),
|
|
id = _React$useState2[0];
|
|
var groupContext = _react_17_0_2_react.useContext(PreviewGroupContext);
|
|
var registerData = {
|
|
data: data,
|
|
canPreview: canPreview
|
|
};
|
|
|
|
// Keep order start
|
|
// Resolve https://github.com/ant-design/ant-design/issues/28881
|
|
// Only need unRegister when component unMount
|
|
_react_17_0_2_react.useEffect(function () {
|
|
if (groupContext) {
|
|
return groupContext.register(id, registerData);
|
|
}
|
|
}, []);
|
|
_react_17_0_2_react.useEffect(function () {
|
|
if (groupContext) {
|
|
groupContext.register(id, registerData);
|
|
}
|
|
}, [canPreview, data]);
|
|
return id;
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-image@7.2.0@rc-image/es/util.js
|
|
function isImageValid(src) {
|
|
return new Promise(function (resolve) {
|
|
var img = document.createElement('img');
|
|
img.onerror = function () {
|
|
return resolve(false);
|
|
};
|
|
img.onload = function () {
|
|
return resolve(true);
|
|
};
|
|
img.src = src;
|
|
});
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-image@7.2.0@rc-image/es/hooks/useStatus.js
|
|
|
|
|
|
|
|
function useStatus(_ref) {
|
|
var src = _ref.src,
|
|
isCustomPlaceholder = _ref.isCustomPlaceholder,
|
|
fallback = _ref.fallback;
|
|
var _useState = (0,_react_17_0_2_react.useState)(isCustomPlaceholder ? 'loading' : 'normal'),
|
|
_useState2 = (0,slicedToArray/* default */.Z)(_useState, 2),
|
|
status = _useState2[0],
|
|
setStatus = _useState2[1];
|
|
var isLoaded = (0,_react_17_0_2_react.useRef)(false);
|
|
var isError = status === 'error';
|
|
|
|
// https://github.com/react-component/image/pull/187
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
isImageValid(src).then(function (isValid) {
|
|
if (!isValid) {
|
|
setStatus('error');
|
|
}
|
|
});
|
|
}, [src]);
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
if (isCustomPlaceholder && !isLoaded.current) {
|
|
setStatus('loading');
|
|
} else if (isError) {
|
|
setStatus('normal');
|
|
}
|
|
}, [src]);
|
|
var onLoad = function onLoad() {
|
|
setStatus('normal');
|
|
};
|
|
var getImgRef = function getImgRef(img) {
|
|
isLoaded.current = false;
|
|
if (status !== 'loading') {
|
|
return;
|
|
}
|
|
if (img !== null && img !== void 0 && img.complete && (img.naturalWidth || img.naturalHeight)) {
|
|
isLoaded.current = true;
|
|
onLoad();
|
|
}
|
|
};
|
|
var srcAndOnload = isError && fallback ? {
|
|
src: fallback
|
|
} : {
|
|
onLoad: onLoad,
|
|
src: src
|
|
};
|
|
return [getImgRef, srcAndOnload, status];
|
|
}
|
|
// EXTERNAL MODULE: ./node_modules/_rc-dialog@9.2.0@rc-dialog/es/index.js + 8 modules
|
|
var es = __webpack_require__(86923);
|
|
// EXTERNAL MODULE: ./node_modules/_rc-util@5.44.4@rc-util/es/Dom/addEventListener.js
|
|
var addEventListener = __webpack_require__(8224);
|
|
// EXTERNAL MODULE: ./node_modules/_rc-util@5.44.4@rc-util/es/KeyCode.js
|
|
var KeyCode = __webpack_require__(10228);
|
|
// EXTERNAL MODULE: ./node_modules/_rc-util@5.44.4@rc-util/es/warning.js
|
|
var warning = __webpack_require__(48736);
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-image@7.2.0@rc-image/es/getFixScaleEleTransPosition.js
|
|
|
|
|
|
|
|
function fixPoint(key, start, width, clientWidth) {
|
|
var startAddWidth = start + width;
|
|
var offsetStart = (width - clientWidth) / 2;
|
|
if (width > clientWidth) {
|
|
if (start > 0) {
|
|
return (0,defineProperty/* default */.Z)({}, key, offsetStart);
|
|
}
|
|
if (start < 0 && startAddWidth < clientWidth) {
|
|
return (0,defineProperty/* default */.Z)({}, key, -offsetStart);
|
|
}
|
|
} else if (start < 0 || startAddWidth > clientWidth) {
|
|
return (0,defineProperty/* default */.Z)({}, key, start < 0 ? offsetStart : -offsetStart);
|
|
}
|
|
return {};
|
|
}
|
|
|
|
/**
|
|
* Fix positon x,y point when
|
|
*
|
|
* Ele width && height < client
|
|
* - Back origin
|
|
*
|
|
* - Ele width | height > clientWidth | clientHeight
|
|
* - left | top > 0 -> Back 0
|
|
* - left | top + width | height < clientWidth | clientHeight -> Back left | top + width | height === clientWidth | clientHeight
|
|
*
|
|
* Regardless of other
|
|
*/
|
|
function getFixScaleEleTransPosition(width, height, left, top) {
|
|
var _getClientSize = (0,css/* getClientSize */.g1)(),
|
|
clientWidth = _getClientSize.width,
|
|
clientHeight = _getClientSize.height;
|
|
var fixPos = null;
|
|
if (width <= clientWidth && height <= clientHeight) {
|
|
fixPos = {
|
|
x: 0,
|
|
y: 0
|
|
};
|
|
} else if (width > clientWidth || height > clientHeight) {
|
|
fixPos = (0,objectSpread2/* default */.Z)((0,objectSpread2/* default */.Z)({}, fixPoint('x', left, width, clientWidth)), fixPoint('y', top, height, clientHeight));
|
|
}
|
|
return fixPos;
|
|
}
|
|
// EXTERNAL MODULE: ./node_modules/_rc-util@5.44.4@rc-util/es/isEqual.js
|
|
var isEqual = __webpack_require__(13697);
|
|
// EXTERNAL MODULE: ./node_modules/_rc-util@5.44.4@rc-util/es/raf.js
|
|
var raf = __webpack_require__(16089);
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-image@7.2.0@rc-image/es/hooks/useImageTransform.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var initialTransform = {
|
|
x: 0,
|
|
y: 0,
|
|
rotate: 0,
|
|
scale: 1,
|
|
flipX: false,
|
|
flipY: false
|
|
};
|
|
function useImageTransform(imgRef, minScale, maxScale, onTransform) {
|
|
var frame = (0,_react_17_0_2_react.useRef)(null);
|
|
var queue = (0,_react_17_0_2_react.useRef)([]);
|
|
var _useState = (0,_react_17_0_2_react.useState)(initialTransform),
|
|
_useState2 = (0,slicedToArray/* default */.Z)(_useState, 2),
|
|
transform = _useState2[0],
|
|
setTransform = _useState2[1];
|
|
var resetTransform = function resetTransform(action) {
|
|
setTransform(initialTransform);
|
|
if (onTransform && !(0,isEqual/* default */.Z)(initialTransform, transform)) {
|
|
onTransform({
|
|
transform: initialTransform,
|
|
action: action
|
|
});
|
|
}
|
|
};
|
|
|
|
/** Direct update transform */
|
|
var updateTransform = function updateTransform(newTransform, action) {
|
|
if (frame.current === null) {
|
|
queue.current = [];
|
|
frame.current = (0,raf/* default */.Z)(function () {
|
|
setTransform(function (preState) {
|
|
var memoState = preState;
|
|
queue.current.forEach(function (queueState) {
|
|
memoState = (0,objectSpread2/* default */.Z)((0,objectSpread2/* default */.Z)({}, memoState), queueState);
|
|
});
|
|
frame.current = null;
|
|
onTransform === null || onTransform === void 0 ? void 0 : onTransform({
|
|
transform: memoState,
|
|
action: action
|
|
});
|
|
return memoState;
|
|
});
|
|
});
|
|
}
|
|
queue.current.push((0,objectSpread2/* default */.Z)((0,objectSpread2/* default */.Z)({}, transform), newTransform));
|
|
};
|
|
|
|
/** Scale according to the position of clientX and clientY */
|
|
var dispatchZoomChange = function dispatchZoomChange(ratio, action, clientX, clientY) {
|
|
var _imgRef$current = imgRef.current,
|
|
width = _imgRef$current.width,
|
|
height = _imgRef$current.height,
|
|
offsetWidth = _imgRef$current.offsetWidth,
|
|
offsetHeight = _imgRef$current.offsetHeight,
|
|
offsetLeft = _imgRef$current.offsetLeft,
|
|
offsetTop = _imgRef$current.offsetTop;
|
|
var newRatio = ratio;
|
|
var newScale = transform.scale * ratio;
|
|
if (newScale > maxScale) {
|
|
newRatio = maxScale / transform.scale;
|
|
newScale = maxScale;
|
|
} else if (newScale < minScale) {
|
|
newRatio = minScale / transform.scale;
|
|
newScale = minScale;
|
|
}
|
|
|
|
/** Default center point scaling */
|
|
var mergedClientX = clientX !== null && clientX !== void 0 ? clientX : innerWidth / 2;
|
|
var mergedClientY = clientY !== null && clientY !== void 0 ? clientY : innerHeight / 2;
|
|
var diffRatio = newRatio - 1;
|
|
/** Deviation calculated from image size */
|
|
var diffImgX = diffRatio * width * 0.5;
|
|
var diffImgY = diffRatio * height * 0.5;
|
|
/** The difference between the click position and the edge of the document */
|
|
var diffOffsetLeft = diffRatio * (mergedClientX - transform.x - offsetLeft);
|
|
var diffOffsetTop = diffRatio * (mergedClientY - transform.y - offsetTop);
|
|
/** Final positioning */
|
|
var newX = transform.x - (diffOffsetLeft - diffImgX);
|
|
var newY = transform.y - (diffOffsetTop - diffImgY);
|
|
|
|
/**
|
|
* When zooming the image
|
|
* When the image size is smaller than the width and height of the window, the position is initialized
|
|
*/
|
|
if (ratio < 1 && newScale === 1) {
|
|
var mergedWidth = offsetWidth * newScale;
|
|
var mergedHeight = offsetHeight * newScale;
|
|
var _getClientSize = (0,css/* getClientSize */.g1)(),
|
|
clientWidth = _getClientSize.width,
|
|
clientHeight = _getClientSize.height;
|
|
if (mergedWidth <= clientWidth && mergedHeight <= clientHeight) {
|
|
newX = 0;
|
|
newY = 0;
|
|
}
|
|
}
|
|
updateTransform({
|
|
x: newX,
|
|
y: newY,
|
|
scale: newScale
|
|
}, action);
|
|
};
|
|
return {
|
|
transform: transform,
|
|
resetTransform: resetTransform,
|
|
updateTransform: updateTransform,
|
|
dispatchZoomChange: dispatchZoomChange
|
|
};
|
|
}
|
|
// EXTERNAL MODULE: ./node_modules/_@rc-component_portal@1.1.2@@rc-component/portal/es/index.js + 6 modules
|
|
var portal_es = __webpack_require__(43403);
|
|
// EXTERNAL MODULE: ./node_modules/_rc-motion@2.9.5@rc-motion/es/index.js + 13 modules
|
|
var _rc_motion_2_9_5_rc_motion_es = __webpack_require__(77900);
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-image@7.2.0@rc-image/es/Operations.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Operations = function Operations(props) {
|
|
var visible = props.visible,
|
|
maskTransitionName = props.maskTransitionName,
|
|
getContainer = props.getContainer,
|
|
prefixCls = props.prefixCls,
|
|
rootClassName = props.rootClassName,
|
|
icons = props.icons,
|
|
countRender = props.countRender,
|
|
showSwitch = props.showSwitch,
|
|
showProgress = props.showProgress,
|
|
current = props.current,
|
|
transform = props.transform,
|
|
count = props.count,
|
|
scale = props.scale,
|
|
minScale = props.minScale,
|
|
maxScale = props.maxScale,
|
|
closeIcon = props.closeIcon,
|
|
onSwitchLeft = props.onSwitchLeft,
|
|
onSwitchRight = props.onSwitchRight,
|
|
onClose = props.onClose,
|
|
onZoomIn = props.onZoomIn,
|
|
onZoomOut = props.onZoomOut,
|
|
onRotateRight = props.onRotateRight,
|
|
onRotateLeft = props.onRotateLeft,
|
|
onFlipX = props.onFlipX,
|
|
onFlipY = props.onFlipY,
|
|
toolbarRender = props.toolbarRender;
|
|
var groupContext = (0,_react_17_0_2_react.useContext)(PreviewGroupContext);
|
|
var rotateLeft = icons.rotateLeft,
|
|
rotateRight = icons.rotateRight,
|
|
zoomIn = icons.zoomIn,
|
|
zoomOut = icons.zoomOut,
|
|
close = icons.close,
|
|
left = icons.left,
|
|
right = icons.right,
|
|
flipX = icons.flipX,
|
|
flipY = icons.flipY;
|
|
var toolClassName = "".concat(prefixCls, "-operations-operation");
|
|
_react_17_0_2_react.useEffect(function () {
|
|
var onKeyDown = function onKeyDown(e) {
|
|
if (e.keyCode === KeyCode/* default */.Z.ESC) {
|
|
onClose();
|
|
}
|
|
};
|
|
if (visible) {
|
|
window.addEventListener('keydown', onKeyDown);
|
|
}
|
|
return function () {
|
|
window.removeEventListener('keydown', onKeyDown);
|
|
};
|
|
}, [visible]);
|
|
var tools = [{
|
|
icon: flipY,
|
|
onClick: onFlipY,
|
|
type: 'flipY'
|
|
}, {
|
|
icon: flipX,
|
|
onClick: onFlipX,
|
|
type: 'flipX'
|
|
}, {
|
|
icon: rotateLeft,
|
|
onClick: onRotateLeft,
|
|
type: 'rotateLeft'
|
|
}, {
|
|
icon: rotateRight,
|
|
onClick: onRotateRight,
|
|
type: 'rotateRight'
|
|
}, {
|
|
icon: zoomOut,
|
|
onClick: onZoomOut,
|
|
type: 'zoomOut',
|
|
disabled: scale === minScale
|
|
}, {
|
|
icon: zoomIn,
|
|
onClick: onZoomIn,
|
|
type: 'zoomIn',
|
|
disabled: scale === maxScale
|
|
}];
|
|
var toolsNode = tools.map(function (_ref) {
|
|
var _classnames;
|
|
var icon = _ref.icon,
|
|
onClick = _ref.onClick,
|
|
type = _ref.type,
|
|
disabled = _ref.disabled;
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement("div", {
|
|
className: _classnames_2_5_1_classnames_default()(toolClassName, (_classnames = {}, (0,defineProperty/* default */.Z)(_classnames, "".concat(prefixCls, "-operations-operation-").concat(type), true), (0,defineProperty/* default */.Z)(_classnames, "".concat(prefixCls, "-operations-operation-disabled"), !!disabled), _classnames)),
|
|
onClick: onClick,
|
|
key: type
|
|
}, icon);
|
|
});
|
|
var toolbarNode = /*#__PURE__*/_react_17_0_2_react.createElement("div", {
|
|
className: "".concat(prefixCls, "-operations")
|
|
}, toolsNode);
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(_rc_motion_2_9_5_rc_motion_es["default"], {
|
|
visible: visible,
|
|
motionName: maskTransitionName
|
|
}, function (_ref2) {
|
|
var className = _ref2.className,
|
|
style = _ref2.style;
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(portal_es/* default */.Z, {
|
|
open: true,
|
|
getContainer: getContainer !== null && getContainer !== void 0 ? getContainer : document.body
|
|
}, /*#__PURE__*/_react_17_0_2_react.createElement("div", {
|
|
className: _classnames_2_5_1_classnames_default()("".concat(prefixCls, "-operations-wrapper"), className, rootClassName),
|
|
style: style
|
|
}, closeIcon === null ? null : /*#__PURE__*/_react_17_0_2_react.createElement("button", {
|
|
className: "".concat(prefixCls, "-close"),
|
|
onClick: onClose
|
|
}, closeIcon || close), showSwitch && /*#__PURE__*/_react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null, /*#__PURE__*/_react_17_0_2_react.createElement("div", {
|
|
className: _classnames_2_5_1_classnames_default()("".concat(prefixCls, "-switch-left"), (0,defineProperty/* default */.Z)({}, "".concat(prefixCls, "-switch-left-disabled"), current === 0)),
|
|
onClick: onSwitchLeft
|
|
}, left), /*#__PURE__*/_react_17_0_2_react.createElement("div", {
|
|
className: _classnames_2_5_1_classnames_default()("".concat(prefixCls, "-switch-right"), (0,defineProperty/* default */.Z)({}, "".concat(prefixCls, "-switch-right-disabled"), current === count - 1)),
|
|
onClick: onSwitchRight
|
|
}, right)), /*#__PURE__*/_react_17_0_2_react.createElement("div", {
|
|
className: "".concat(prefixCls, "-footer")
|
|
}, showProgress && /*#__PURE__*/_react_17_0_2_react.createElement("div", {
|
|
className: "".concat(prefixCls, "-progress")
|
|
}, countRender ? countRender(current + 1, count) : "".concat(current + 1, " / ").concat(count)), toolbarRender ? toolbarRender(toolbarNode, (0,objectSpread2/* default */.Z)({
|
|
icons: {
|
|
flipYIcon: toolsNode[0],
|
|
flipXIcon: toolsNode[1],
|
|
rotateLeftIcon: toolsNode[2],
|
|
rotateRightIcon: toolsNode[3],
|
|
zoomOutIcon: toolsNode[4],
|
|
zoomInIcon: toolsNode[5]
|
|
},
|
|
actions: {
|
|
onFlipY: onFlipY,
|
|
onFlipX: onFlipX,
|
|
onRotateLeft: onRotateLeft,
|
|
onRotateRight: onRotateRight,
|
|
onZoomOut: onZoomOut,
|
|
onZoomIn: onZoomIn
|
|
},
|
|
transform: transform
|
|
}, groupContext ? {
|
|
current: current,
|
|
total: count
|
|
} : {})) : toolbarNode)));
|
|
});
|
|
};
|
|
/* harmony default export */ var es_Operations = (Operations);
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-image@7.2.0@rc-image/es/previewConfig.js
|
|
/** Scale the ratio base */
|
|
var BASE_SCALE_RATIO = 1;
|
|
/** The maximum zoom ratio when the mouse zooms in, adjustable */
|
|
var WHEEL_MAX_SCALE_RATIO = 1;
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-image@7.2.0@rc-image/es/Preview.js
|
|
|
|
|
|
|
|
|
|
|
|
var _excluded = ["fallback", "src", "imgRef"],
|
|
_excluded2 = ["prefixCls", "src", "alt", "fallback", "movable", "onClose", "visible", "icons", "rootClassName", "closeIcon", "getContainer", "current", "count", "countRender", "scaleStep", "minScale", "maxScale", "transitionName", "maskTransitionName", "imageRender", "imgCommonProps", "toolbarRender", "onTransform", "onChange"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var PreviewImage = function PreviewImage(_ref) {
|
|
var fallback = _ref.fallback,
|
|
src = _ref.src,
|
|
imgRef = _ref.imgRef,
|
|
props = (0,objectWithoutProperties/* default */.Z)(_ref, _excluded);
|
|
var _useStatus = useStatus({
|
|
src: src,
|
|
fallback: fallback
|
|
}),
|
|
_useStatus2 = (0,slicedToArray/* default */.Z)(_useStatus, 2),
|
|
getImgRef = _useStatus2[0],
|
|
srcAndOnload = _useStatus2[1];
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement("img", (0,esm_extends/* default */.Z)({
|
|
ref: function ref(_ref2) {
|
|
imgRef.current = _ref2;
|
|
getImgRef(_ref2);
|
|
}
|
|
}, props, srcAndOnload));
|
|
};
|
|
var Preview = function Preview(props) {
|
|
var prefixCls = props.prefixCls,
|
|
src = props.src,
|
|
alt = props.alt,
|
|
fallback = props.fallback,
|
|
_props$movable = props.movable,
|
|
movable = _props$movable === void 0 ? true : _props$movable,
|
|
onClose = props.onClose,
|
|
visible = props.visible,
|
|
_props$icons = props.icons,
|
|
icons = _props$icons === void 0 ? {} : _props$icons,
|
|
rootClassName = props.rootClassName,
|
|
closeIcon = props.closeIcon,
|
|
getContainer = props.getContainer,
|
|
_props$current = props.current,
|
|
current = _props$current === void 0 ? 0 : _props$current,
|
|
_props$count = props.count,
|
|
count = _props$count === void 0 ? 1 : _props$count,
|
|
countRender = props.countRender,
|
|
_props$scaleStep = props.scaleStep,
|
|
scaleStep = _props$scaleStep === void 0 ? 0.5 : _props$scaleStep,
|
|
_props$minScale = props.minScale,
|
|
minScale = _props$minScale === void 0 ? 1 : _props$minScale,
|
|
_props$maxScale = props.maxScale,
|
|
maxScale = _props$maxScale === void 0 ? 50 : _props$maxScale,
|
|
_props$transitionName = props.transitionName,
|
|
transitionName = _props$transitionName === void 0 ? 'zoom' : _props$transitionName,
|
|
_props$maskTransition = props.maskTransitionName,
|
|
maskTransitionName = _props$maskTransition === void 0 ? 'fade' : _props$maskTransition,
|
|
imageRender = props.imageRender,
|
|
imgCommonProps = props.imgCommonProps,
|
|
toolbarRender = props.toolbarRender,
|
|
onTransform = props.onTransform,
|
|
onChange = props.onChange,
|
|
restProps = (0,objectWithoutProperties/* default */.Z)(props, _excluded2);
|
|
var imgRef = (0,_react_17_0_2_react.useRef)();
|
|
var downPositionRef = (0,_react_17_0_2_react.useRef)({
|
|
deltaX: 0,
|
|
deltaY: 0,
|
|
transformX: 0,
|
|
transformY: 0
|
|
});
|
|
var _useState = (0,_react_17_0_2_react.useState)(false),
|
|
_useState2 = (0,slicedToArray/* default */.Z)(_useState, 2),
|
|
isMoving = _useState2[0],
|
|
setMoving = _useState2[1];
|
|
var groupContext = (0,_react_17_0_2_react.useContext)(PreviewGroupContext);
|
|
var showLeftOrRightSwitches = groupContext && count > 1;
|
|
var showOperationsProgress = groupContext && count >= 1;
|
|
var _useImageTransform = useImageTransform(imgRef, minScale, maxScale, onTransform),
|
|
transform = _useImageTransform.transform,
|
|
resetTransform = _useImageTransform.resetTransform,
|
|
updateTransform = _useImageTransform.updateTransform,
|
|
dispatchZoomChange = _useImageTransform.dispatchZoomChange;
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(true),
|
|
_useState4 = (0,slicedToArray/* default */.Z)(_useState3, 2),
|
|
enableTransition = _useState4[0],
|
|
setEnableTransition = _useState4[1];
|
|
var rotate = transform.rotate,
|
|
scale = transform.scale,
|
|
x = transform.x,
|
|
y = transform.y;
|
|
var wrapClassName = _classnames_2_5_1_classnames_default()((0,defineProperty/* default */.Z)({}, "".concat(prefixCls, "-moving"), isMoving));
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
if (!enableTransition) {
|
|
setEnableTransition(true);
|
|
}
|
|
}, [enableTransition]);
|
|
var onAfterClose = function onAfterClose() {
|
|
resetTransform('close');
|
|
};
|
|
var onZoomIn = function onZoomIn() {
|
|
dispatchZoomChange(BASE_SCALE_RATIO + scaleStep, 'zoomIn');
|
|
};
|
|
var onZoomOut = function onZoomOut() {
|
|
dispatchZoomChange(BASE_SCALE_RATIO / (BASE_SCALE_RATIO + scaleStep), 'zoomOut');
|
|
};
|
|
var onRotateRight = function onRotateRight() {
|
|
updateTransform({
|
|
rotate: rotate + 90
|
|
}, 'rotateRight');
|
|
};
|
|
var onRotateLeft = function onRotateLeft() {
|
|
updateTransform({
|
|
rotate: rotate - 90
|
|
}, 'rotateLeft');
|
|
};
|
|
var onFlipX = function onFlipX() {
|
|
updateTransform({
|
|
flipX: !transform.flipX
|
|
}, 'flipX');
|
|
};
|
|
var onFlipY = function onFlipY() {
|
|
updateTransform({
|
|
flipY: !transform.flipY
|
|
}, 'flipY');
|
|
};
|
|
var onSwitchLeft = function onSwitchLeft(event) {
|
|
event === null || event === void 0 ? void 0 : event.preventDefault();
|
|
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
|
if (current > 0) {
|
|
setEnableTransition(false);
|
|
resetTransform('prev');
|
|
onChange === null || onChange === void 0 ? void 0 : onChange(current - 1, current);
|
|
}
|
|
};
|
|
var onSwitchRight = function onSwitchRight(event) {
|
|
event === null || event === void 0 ? void 0 : event.preventDefault();
|
|
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
|
if (current < count - 1) {
|
|
setEnableTransition(false);
|
|
resetTransform('next');
|
|
onChange === null || onChange === void 0 ? void 0 : onChange(current + 1, current);
|
|
}
|
|
};
|
|
var onMouseUp = function onMouseUp() {
|
|
if (visible && isMoving) {
|
|
setMoving(false);
|
|
/** No need to restore the position when the picture is not moved, So as not to interfere with the click */
|
|
var _downPositionRef$curr = downPositionRef.current,
|
|
transformX = _downPositionRef$curr.transformX,
|
|
transformY = _downPositionRef$curr.transformY;
|
|
var hasChangedPosition = x !== transformX && y !== transformY;
|
|
if (!hasChangedPosition) {
|
|
return;
|
|
}
|
|
var width = imgRef.current.offsetWidth * scale;
|
|
var height = imgRef.current.offsetHeight * scale;
|
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
var _imgRef$current$getBo = imgRef.current.getBoundingClientRect(),
|
|
left = _imgRef$current$getBo.left,
|
|
top = _imgRef$current$getBo.top;
|
|
var isRotate = rotate % 180 !== 0;
|
|
var fixState = getFixScaleEleTransPosition(isRotate ? height : width, isRotate ? width : height, left, top);
|
|
if (fixState) {
|
|
updateTransform((0,objectSpread2/* default */.Z)({}, fixState), 'dragRebound');
|
|
}
|
|
}
|
|
};
|
|
var onMouseDown = function onMouseDown(event) {
|
|
// Only allow main button
|
|
if (!movable || event.button !== 0) return;
|
|
event.preventDefault();
|
|
event.stopPropagation();
|
|
downPositionRef.current = {
|
|
deltaX: event.pageX - transform.x,
|
|
deltaY: event.pageY - transform.y,
|
|
transformX: transform.x,
|
|
transformY: transform.y
|
|
};
|
|
setMoving(true);
|
|
};
|
|
var onMouseMove = function onMouseMove(event) {
|
|
if (visible && isMoving) {
|
|
updateTransform({
|
|
x: event.pageX - downPositionRef.current.deltaX,
|
|
y: event.pageY - downPositionRef.current.deltaY
|
|
}, 'move');
|
|
}
|
|
};
|
|
var onWheel = function onWheel(event) {
|
|
if (!visible || event.deltaY == 0) return;
|
|
// Scale ratio depends on the deltaY size
|
|
var scaleRatio = Math.abs(event.deltaY / 100);
|
|
// Limit the maximum scale ratio
|
|
var mergedScaleRatio = Math.min(scaleRatio, WHEEL_MAX_SCALE_RATIO);
|
|
// Scale the ratio each time
|
|
var ratio = BASE_SCALE_RATIO + mergedScaleRatio * scaleStep;
|
|
if (event.deltaY > 0) {
|
|
ratio = BASE_SCALE_RATIO / ratio;
|
|
}
|
|
dispatchZoomChange(ratio, 'wheel', event.clientX, event.clientY);
|
|
};
|
|
var onKeyDown = function onKeyDown(event) {
|
|
if (!visible || !showLeftOrRightSwitches) return;
|
|
if (event.keyCode === KeyCode/* default */.Z.LEFT) {
|
|
onSwitchLeft();
|
|
} else if (event.keyCode === KeyCode/* default */.Z.RIGHT) {
|
|
onSwitchRight();
|
|
}
|
|
};
|
|
var onDoubleClick = function onDoubleClick(event) {
|
|
if (visible) {
|
|
if (scale !== 1) {
|
|
updateTransform({
|
|
x: 0,
|
|
y: 0,
|
|
scale: 1
|
|
}, 'doubleClick');
|
|
} else {
|
|
dispatchZoomChange(BASE_SCALE_RATIO + scaleStep, 'doubleClick', event.clientX, event.clientY);
|
|
}
|
|
}
|
|
};
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
var onTopMouseUpListener;
|
|
var onTopMouseMoveListener;
|
|
var onMouseUpListener;
|
|
var onMouseMoveListener;
|
|
if (movable) {
|
|
onMouseUpListener = (0,addEventListener/* default */.Z)(window, 'mouseup', onMouseUp, false);
|
|
onMouseMoveListener = (0,addEventListener/* default */.Z)(window, 'mousemove', onMouseMove, false);
|
|
try {
|
|
// Resolve if in iframe lost event
|
|
/* istanbul ignore next */
|
|
if (window.top !== window.self) {
|
|
onTopMouseUpListener = (0,addEventListener/* default */.Z)(window.top, 'mouseup', onMouseUp, false);
|
|
onTopMouseMoveListener = (0,addEventListener/* default */.Z)(window.top, 'mousemove', onMouseMove, false);
|
|
}
|
|
} catch (error) {
|
|
/* istanbul ignore next */
|
|
(0,warning/* warning */.Kp)(false, "[rc-image] ".concat(error));
|
|
}
|
|
}
|
|
return function () {
|
|
var _onMouseUpListener, _onMouseMoveListener, _onTopMouseUpListener, _onTopMouseMoveListen;
|
|
(_onMouseUpListener = onMouseUpListener) === null || _onMouseUpListener === void 0 ? void 0 : _onMouseUpListener.remove();
|
|
(_onMouseMoveListener = onMouseMoveListener) === null || _onMouseMoveListener === void 0 ? void 0 : _onMouseMoveListener.remove();
|
|
/* istanbul ignore next */
|
|
(_onTopMouseUpListener = onTopMouseUpListener) === null || _onTopMouseUpListener === void 0 ? void 0 : _onTopMouseUpListener.remove();
|
|
/* istanbul ignore next */
|
|
(_onTopMouseMoveListen = onTopMouseMoveListener) === null || _onTopMouseMoveListen === void 0 ? void 0 : _onTopMouseMoveListen.remove();
|
|
};
|
|
}, [visible, isMoving, x, y, rotate, movable]);
|
|
(0,_react_17_0_2_react.useEffect)(function () {
|
|
var onKeyDownListener = (0,addEventListener/* default */.Z)(window, 'keydown', onKeyDown, false);
|
|
return function () {
|
|
onKeyDownListener.remove();
|
|
};
|
|
}, [visible, showLeftOrRightSwitches, current]);
|
|
var imgNode = /*#__PURE__*/_react_17_0_2_react.createElement(PreviewImage, (0,esm_extends/* default */.Z)({}, imgCommonProps, {
|
|
width: props.width,
|
|
height: props.height,
|
|
imgRef: imgRef,
|
|
className: "".concat(prefixCls, "-img"),
|
|
alt: alt,
|
|
style: {
|
|
transform: "translate3d(".concat(transform.x, "px, ").concat(transform.y, "px, 0) scale3d(").concat(transform.flipX ? '-' : '').concat(scale, ", ").concat(transform.flipY ? '-' : '').concat(scale, ", 1) rotate(").concat(rotate, "deg)"),
|
|
transitionDuration: !enableTransition && '0s'
|
|
},
|
|
fallback: fallback,
|
|
src: src,
|
|
onWheel: onWheel,
|
|
onMouseDown: onMouseDown,
|
|
onDoubleClick: onDoubleClick
|
|
}));
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null, /*#__PURE__*/_react_17_0_2_react.createElement(es/* default */.Z, (0,esm_extends/* default */.Z)({
|
|
transitionName: transitionName,
|
|
maskTransitionName: maskTransitionName,
|
|
closable: false,
|
|
keyboard: true,
|
|
prefixCls: prefixCls,
|
|
onClose: onClose,
|
|
visible: visible,
|
|
wrapClassName: wrapClassName,
|
|
rootClassName: rootClassName,
|
|
getContainer: getContainer
|
|
}, restProps, {
|
|
afterClose: onAfterClose
|
|
}), /*#__PURE__*/_react_17_0_2_react.createElement("div", {
|
|
className: "".concat(prefixCls, "-img-wrapper")
|
|
}, imageRender ? imageRender(imgNode, (0,objectSpread2/* default */.Z)({
|
|
transform: transform
|
|
}, groupContext ? {
|
|
current: current
|
|
} : {})) : imgNode)), /*#__PURE__*/_react_17_0_2_react.createElement(es_Operations, {
|
|
visible: visible,
|
|
transform: transform,
|
|
maskTransitionName: maskTransitionName,
|
|
closeIcon: closeIcon,
|
|
getContainer: getContainer,
|
|
prefixCls: prefixCls,
|
|
rootClassName: rootClassName,
|
|
icons: icons,
|
|
countRender: countRender,
|
|
showSwitch: showLeftOrRightSwitches,
|
|
showProgress: showOperationsProgress,
|
|
current: current,
|
|
count: count,
|
|
scale: scale,
|
|
minScale: minScale,
|
|
maxScale: maxScale,
|
|
toolbarRender: toolbarRender,
|
|
onSwitchLeft: onSwitchLeft,
|
|
onSwitchRight: onSwitchRight,
|
|
onZoomIn: onZoomIn,
|
|
onZoomOut: onZoomOut,
|
|
onRotateRight: onRotateRight,
|
|
onRotateLeft: onRotateLeft,
|
|
onFlipX: onFlipX,
|
|
onFlipY: onFlipY,
|
|
onClose: onClose
|
|
}));
|
|
};
|
|
/* harmony default export */ var es_Preview = (Preview);
|
|
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.27.0@@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
|
|
var toConsumableArray = __webpack_require__(80702);
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-image@7.2.0@rc-image/es/hooks/usePreviewItems.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Merge props provided `items` or context collected images
|
|
*/
|
|
function usePreviewItems(items) {
|
|
// Context collection image data
|
|
var _React$useState = _react_17_0_2_react.useState({}),
|
|
_React$useState2 = (0,slicedToArray/* default */.Z)(_React$useState, 2),
|
|
images = _React$useState2[0],
|
|
setImages = _React$useState2[1];
|
|
var registerImage = _react_17_0_2_react.useCallback(function (id, data) {
|
|
setImages(function (imgs) {
|
|
return (0,objectSpread2/* default */.Z)((0,objectSpread2/* default */.Z)({}, imgs), {}, (0,defineProperty/* default */.Z)({}, id, data));
|
|
});
|
|
return function () {
|
|
setImages(function (imgs) {
|
|
var cloneImgs = (0,objectSpread2/* default */.Z)({}, imgs);
|
|
delete cloneImgs[id];
|
|
return cloneImgs;
|
|
});
|
|
};
|
|
}, []);
|
|
|
|
// items
|
|
var mergedItems = _react_17_0_2_react.useMemo(function () {
|
|
if (items) {
|
|
return items.map(function (item) {
|
|
if (typeof item === 'string') {
|
|
return {
|
|
data: {
|
|
src: item
|
|
}
|
|
};
|
|
}
|
|
var data = {};
|
|
Object.keys(item).forEach(function (key) {
|
|
if (['src'].concat((0,toConsumableArray/* default */.Z)(COMMON_PROPS)).includes(key)) {
|
|
data[key] = item[key];
|
|
}
|
|
});
|
|
return {
|
|
data: data
|
|
};
|
|
});
|
|
}
|
|
return Object.keys(images).reduce(function (total, id) {
|
|
var _images$id = images[id],
|
|
canPreview = _images$id.canPreview,
|
|
data = _images$id.data;
|
|
if (canPreview) {
|
|
total.push({
|
|
data: data,
|
|
id: id
|
|
});
|
|
}
|
|
return total;
|
|
}, []);
|
|
}, [items, images]);
|
|
return [mergedItems, registerImage];
|
|
}
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-image@7.2.0@rc-image/es/PreviewGroup.js
|
|
|
|
|
|
|
|
|
|
var PreviewGroup_excluded = ["visible", "onVisibleChange", "getContainer", "current", "movable", "minScale", "maxScale", "countRender", "closeIcon", "onChange", "onTransform", "toolbarRender", "imageRender"],
|
|
PreviewGroup_excluded2 = ["src"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Group = function Group(_ref) {
|
|
var _mergedItems$current;
|
|
var _ref$previewPrefixCls = _ref.previewPrefixCls,
|
|
previewPrefixCls = _ref$previewPrefixCls === void 0 ? 'rc-image-preview' : _ref$previewPrefixCls,
|
|
children = _ref.children,
|
|
_ref$icons = _ref.icons,
|
|
icons = _ref$icons === void 0 ? {} : _ref$icons,
|
|
items = _ref.items,
|
|
preview = _ref.preview,
|
|
fallback = _ref.fallback;
|
|
var _ref2 = (0,esm_typeof/* default */.Z)(preview) === 'object' ? preview : {},
|
|
previewVisible = _ref2.visible,
|
|
onVisibleChange = _ref2.onVisibleChange,
|
|
getContainer = _ref2.getContainer,
|
|
currentIndex = _ref2.current,
|
|
movable = _ref2.movable,
|
|
minScale = _ref2.minScale,
|
|
maxScale = _ref2.maxScale,
|
|
countRender = _ref2.countRender,
|
|
closeIcon = _ref2.closeIcon,
|
|
onChange = _ref2.onChange,
|
|
onTransform = _ref2.onTransform,
|
|
toolbarRender = _ref2.toolbarRender,
|
|
imageRender = _ref2.imageRender,
|
|
dialogProps = (0,objectWithoutProperties/* default */.Z)(_ref2, PreviewGroup_excluded);
|
|
|
|
// ========================== Items ===========================
|
|
var _usePreviewItems = usePreviewItems(items),
|
|
_usePreviewItems2 = (0,slicedToArray/* default */.Z)(_usePreviewItems, 2),
|
|
mergedItems = _usePreviewItems2[0],
|
|
register = _usePreviewItems2[1];
|
|
|
|
// ========================= Preview ==========================
|
|
// >>> Index
|
|
var _useMergedState = (0,useMergedState/* default */.Z)(0, {
|
|
value: currentIndex
|
|
}),
|
|
_useMergedState2 = (0,slicedToArray/* default */.Z)(_useMergedState, 2),
|
|
current = _useMergedState2[0],
|
|
setCurrent = _useMergedState2[1];
|
|
var _useState = (0,_react_17_0_2_react.useState)(false),
|
|
_useState2 = (0,slicedToArray/* default */.Z)(_useState, 2),
|
|
keepOpenIndex = _useState2[0],
|
|
setKeepOpenIndex = _useState2[1];
|
|
|
|
// >>> Image
|
|
var _ref3 = ((_mergedItems$current = mergedItems[current]) === null || _mergedItems$current === void 0 ? void 0 : _mergedItems$current.data) || {},
|
|
src = _ref3.src,
|
|
imgCommonProps = (0,objectWithoutProperties/* default */.Z)(_ref3, PreviewGroup_excluded2);
|
|
// >>> Visible
|
|
var _useMergedState3 = (0,useMergedState/* default */.Z)(!!previewVisible, {
|
|
value: previewVisible,
|
|
onChange: function onChange(val, prevVal) {
|
|
onVisibleChange === null || onVisibleChange === void 0 ? void 0 : onVisibleChange(val, prevVal, current);
|
|
}
|
|
}),
|
|
_useMergedState4 = (0,slicedToArray/* default */.Z)(_useMergedState3, 2),
|
|
isShowPreview = _useMergedState4[0],
|
|
setShowPreview = _useMergedState4[1];
|
|
|
|
// >>> Position
|
|
var _useState3 = (0,_react_17_0_2_react.useState)(null),
|
|
_useState4 = (0,slicedToArray/* default */.Z)(_useState3, 2),
|
|
mousePosition = _useState4[0],
|
|
setMousePosition = _useState4[1];
|
|
var onPreviewFromImage = _react_17_0_2_react.useCallback(function (id, mouseX, mouseY) {
|
|
var index = mergedItems.findIndex(function (item) {
|
|
return item.id === id;
|
|
});
|
|
setShowPreview(true);
|
|
setMousePosition({
|
|
x: mouseX,
|
|
y: mouseY
|
|
});
|
|
setCurrent(index < 0 ? 0 : index);
|
|
setKeepOpenIndex(true);
|
|
}, [mergedItems]);
|
|
|
|
// Reset current when reopen
|
|
_react_17_0_2_react.useEffect(function () {
|
|
if (isShowPreview) {
|
|
if (!keepOpenIndex) {
|
|
setCurrent(0);
|
|
}
|
|
} else {
|
|
setKeepOpenIndex(false);
|
|
}
|
|
}, [isShowPreview]);
|
|
|
|
// ========================== Events ==========================
|
|
var onInternalChange = function onInternalChange(next, prev) {
|
|
setCurrent(next);
|
|
onChange === null || onChange === void 0 ? void 0 : onChange(next, prev);
|
|
};
|
|
var onPreviewClose = function onPreviewClose() {
|
|
setShowPreview(false);
|
|
setMousePosition(null);
|
|
};
|
|
|
|
// ========================= Context ==========================
|
|
var previewGroupContext = _react_17_0_2_react.useMemo(function () {
|
|
return {
|
|
register: register,
|
|
onPreview: onPreviewFromImage
|
|
};
|
|
}, [register, onPreviewFromImage]);
|
|
|
|
// ========================== Render ==========================
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(PreviewGroupContext.Provider, {
|
|
value: previewGroupContext
|
|
}, children, /*#__PURE__*/_react_17_0_2_react.createElement(es_Preview, (0,esm_extends/* default */.Z)({
|
|
"aria-hidden": !isShowPreview,
|
|
movable: movable,
|
|
visible: isShowPreview,
|
|
prefixCls: previewPrefixCls,
|
|
closeIcon: closeIcon,
|
|
onClose: onPreviewClose,
|
|
mousePosition: mousePosition,
|
|
imgCommonProps: imgCommonProps,
|
|
src: src,
|
|
fallback: fallback,
|
|
icons: icons,
|
|
minScale: minScale,
|
|
maxScale: maxScale,
|
|
getContainer: getContainer,
|
|
current: current,
|
|
count: mergedItems.length,
|
|
countRender: countRender,
|
|
onTransform: onTransform,
|
|
toolbarRender: toolbarRender,
|
|
imageRender: imageRender,
|
|
onChange: onInternalChange
|
|
}, dialogProps)));
|
|
};
|
|
/* harmony default export */ var PreviewGroup = (Group);
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-image@7.2.0@rc-image/es/Image.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var Image_excluded = ["src", "alt", "onPreviewClose", "prefixCls", "previewPrefixCls", "placeholder", "fallback", "width", "height", "style", "preview", "className", "onClick", "onError", "wrapperClassName", "wrapperStyle", "rootClassName"],
|
|
Image_excluded2 = ["src", "visible", "onVisibleChange", "getContainer", "mask", "maskClassName", "movable", "icons", "scaleStep", "minScale", "maxScale", "imageRender", "toolbarRender"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var ImageInternal = function ImageInternal(props) {
|
|
var imgSrc = props.src,
|
|
alt = props.alt,
|
|
onInitialPreviewClose = props.onPreviewClose,
|
|
_props$prefixCls = props.prefixCls,
|
|
prefixCls = _props$prefixCls === void 0 ? 'rc-image' : _props$prefixCls,
|
|
_props$previewPrefixC = props.previewPrefixCls,
|
|
previewPrefixCls = _props$previewPrefixC === void 0 ? "".concat(prefixCls, "-preview") : _props$previewPrefixC,
|
|
placeholder = props.placeholder,
|
|
fallback = props.fallback,
|
|
width = props.width,
|
|
height = props.height,
|
|
style = props.style,
|
|
_props$preview = props.preview,
|
|
preview = _props$preview === void 0 ? true : _props$preview,
|
|
className = props.className,
|
|
onClick = props.onClick,
|
|
onError = props.onError,
|
|
wrapperClassName = props.wrapperClassName,
|
|
wrapperStyle = props.wrapperStyle,
|
|
rootClassName = props.rootClassName,
|
|
otherProps = (0,objectWithoutProperties/* default */.Z)(props, Image_excluded);
|
|
var isCustomPlaceholder = placeholder && placeholder !== true;
|
|
var _ref = (0,esm_typeof/* default */.Z)(preview) === 'object' ? preview : {},
|
|
previewSrc = _ref.src,
|
|
_ref$visible = _ref.visible,
|
|
previewVisible = _ref$visible === void 0 ? undefined : _ref$visible,
|
|
_ref$onVisibleChange = _ref.onVisibleChange,
|
|
onPreviewVisibleChange = _ref$onVisibleChange === void 0 ? onInitialPreviewClose : _ref$onVisibleChange,
|
|
_ref$getContainer = _ref.getContainer,
|
|
getPreviewContainer = _ref$getContainer === void 0 ? undefined : _ref$getContainer,
|
|
previewMask = _ref.mask,
|
|
maskClassName = _ref.maskClassName,
|
|
movable = _ref.movable,
|
|
icons = _ref.icons,
|
|
scaleStep = _ref.scaleStep,
|
|
minScale = _ref.minScale,
|
|
maxScale = _ref.maxScale,
|
|
imageRender = _ref.imageRender,
|
|
toolbarRender = _ref.toolbarRender,
|
|
dialogProps = (0,objectWithoutProperties/* default */.Z)(_ref, Image_excluded2);
|
|
var src = previewSrc !== null && previewSrc !== void 0 ? previewSrc : imgSrc;
|
|
var _useMergedState = (0,useMergedState/* default */.Z)(!!previewVisible, {
|
|
value: previewVisible,
|
|
onChange: onPreviewVisibleChange
|
|
}),
|
|
_useMergedState2 = (0,slicedToArray/* default */.Z)(_useMergedState, 2),
|
|
isShowPreview = _useMergedState2[0],
|
|
setShowPreview = _useMergedState2[1];
|
|
var _useStatus = useStatus({
|
|
src: imgSrc,
|
|
isCustomPlaceholder: isCustomPlaceholder,
|
|
fallback: fallback
|
|
}),
|
|
_useStatus2 = (0,slicedToArray/* default */.Z)(_useStatus, 3),
|
|
getImgRef = _useStatus2[0],
|
|
srcAndOnload = _useStatus2[1],
|
|
status = _useStatus2[2];
|
|
var _useState = (0,_react_17_0_2_react.useState)(null),
|
|
_useState2 = (0,slicedToArray/* default */.Z)(_useState, 2),
|
|
mousePosition = _useState2[0],
|
|
setMousePosition = _useState2[1];
|
|
var groupContext = (0,_react_17_0_2_react.useContext)(PreviewGroupContext);
|
|
var canPreview = !!preview;
|
|
var onPreviewClose = function onPreviewClose() {
|
|
setShowPreview(false);
|
|
setMousePosition(null);
|
|
};
|
|
var wrapperClass = _classnames_2_5_1_classnames_default()(prefixCls, wrapperClassName, rootClassName, (0,defineProperty/* default */.Z)({}, "".concat(prefixCls, "-error"), status === 'error'));
|
|
|
|
// ========================= ImageProps =========================
|
|
var imgCommonProps = (0,_react_17_0_2_react.useMemo)(function () {
|
|
var obj = {};
|
|
COMMON_PROPS.forEach(function (prop) {
|
|
if (props[prop] !== undefined) {
|
|
obj[prop] = props[prop];
|
|
}
|
|
});
|
|
return obj;
|
|
}, COMMON_PROPS.map(function (prop) {
|
|
return props[prop];
|
|
}));
|
|
|
|
// ========================== Register ==========================
|
|
var registerData = (0,_react_17_0_2_react.useMemo)(function () {
|
|
return (0,objectSpread2/* default */.Z)((0,objectSpread2/* default */.Z)({}, imgCommonProps), {}, {
|
|
src: src
|
|
});
|
|
}, [src, imgCommonProps]);
|
|
var imageId = useRegisterImage(canPreview, registerData);
|
|
|
|
// ========================== Preview ===========================
|
|
var onPreview = function onPreview(e) {
|
|
var _getOffset = (0,css/* getOffset */.os)(e.target),
|
|
left = _getOffset.left,
|
|
top = _getOffset.top;
|
|
if (groupContext) {
|
|
groupContext.onPreview(imageId, left, top);
|
|
} else {
|
|
setMousePosition({
|
|
x: left,
|
|
y: top
|
|
});
|
|
setShowPreview(true);
|
|
}
|
|
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
};
|
|
|
|
// =========================== Render ===========================
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(_react_17_0_2_react.Fragment, null, /*#__PURE__*/_react_17_0_2_react.createElement("div", (0,esm_extends/* default */.Z)({}, otherProps, {
|
|
className: wrapperClass,
|
|
onClick: canPreview ? onPreview : onClick,
|
|
style: (0,objectSpread2/* default */.Z)({
|
|
width: width,
|
|
height: height
|
|
}, wrapperStyle)
|
|
}), /*#__PURE__*/_react_17_0_2_react.createElement("img", (0,esm_extends/* default */.Z)({}, imgCommonProps, {
|
|
className: _classnames_2_5_1_classnames_default()("".concat(prefixCls, "-img"), (0,defineProperty/* default */.Z)({}, "".concat(prefixCls, "-img-placeholder"), placeholder === true), className),
|
|
style: (0,objectSpread2/* default */.Z)({
|
|
height: height
|
|
}, style),
|
|
ref: getImgRef
|
|
}, srcAndOnload, {
|
|
width: width,
|
|
height: height,
|
|
onError: onError
|
|
})), status === 'loading' && /*#__PURE__*/_react_17_0_2_react.createElement("div", {
|
|
"aria-hidden": "true",
|
|
className: "".concat(prefixCls, "-placeholder")
|
|
}, placeholder), previewMask && canPreview && /*#__PURE__*/_react_17_0_2_react.createElement("div", {
|
|
className: _classnames_2_5_1_classnames_default()("".concat(prefixCls, "-mask"), maskClassName),
|
|
style: {
|
|
display: (style === null || style === void 0 ? void 0 : style.display) === 'none' ? 'none' : undefined
|
|
}
|
|
}, previewMask)), !groupContext && canPreview && /*#__PURE__*/_react_17_0_2_react.createElement(es_Preview, (0,esm_extends/* default */.Z)({
|
|
"aria-hidden": !isShowPreview,
|
|
visible: isShowPreview,
|
|
prefixCls: previewPrefixCls,
|
|
onClose: onPreviewClose,
|
|
mousePosition: mousePosition,
|
|
src: src,
|
|
alt: alt,
|
|
fallback: fallback,
|
|
getContainer: getPreviewContainer,
|
|
icons: icons,
|
|
movable: movable,
|
|
scaleStep: scaleStep,
|
|
minScale: minScale,
|
|
maxScale: maxScale,
|
|
rootClassName: rootClassName,
|
|
imageRender: imageRender,
|
|
imgCommonProps: imgCommonProps,
|
|
toolbarRender: toolbarRender
|
|
}, dialogProps)));
|
|
};
|
|
ImageInternal.PreviewGroup = PreviewGroup;
|
|
ImageInternal.displayName = 'Image';
|
|
/* harmony default export */ var Image = (ImageInternal);
|
|
;// CONCATENATED MODULE: ./node_modules/_rc-image@7.2.0@rc-image/es/index.js
|
|
|
|
|
|
/* harmony default export */ var _rc_image_7_2_0_rc_image_es = (Image);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/_util/motion.js
|
|
var motion = __webpack_require__(62892);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/config-provider/context.js
|
|
var context = __webpack_require__(36355);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/locale/en_US.js
|
|
var en_US = __webpack_require__(96700);
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.6.1@@ant-design/icons/es/icons/CloseOutlined.js + 1 modules
|
|
var CloseOutlined = __webpack_require__(99267);
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.6.1@@ant-design/icons/es/icons/LeftOutlined.js + 1 modules
|
|
var LeftOutlined = __webpack_require__(33853);
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.6.1@@ant-design/icons/es/icons/RightOutlined.js + 1 modules
|
|
var RightOutlined = __webpack_require__(38819);
|
|
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons-svg@4.4.2@@ant-design/icons-svg/es/asn/RotateLeftOutlined.js
|
|
// This icon file is generated automatically.
|
|
var RotateLeftOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "defs", "attrs": {}, "children": [{ "tag": "style", "attrs": {} }] }, { "tag": "path", "attrs": { "d": "M672 418H144c-17.7 0-32 14.3-32 32v414c0 17.7 14.3 32 32 32h528c17.7 0 32-14.3 32-32V450c0-17.7-14.3-32-32-32zm-44 402H188V494h440v326z" } }, { "tag": "path", "attrs": { "d": "M819.3 328.5c-78.8-100.7-196-153.6-314.6-154.2l-.2-64c0-6.5-7.6-10.1-12.6-6.1l-128 101c-4 3.1-3.9 9.1 0 12.3L492 318.6c5.1 4 12.7.4 12.6-6.1v-63.9c12.9.1 25.9.9 38.8 2.5 42.1 5.2 82.1 18.2 119 38.7 38.1 21.2 71.2 49.7 98.4 84.3 27.1 34.7 46.7 73.7 58.1 115.8a325.95 325.95 0 016.5 140.9h74.9c14.8-103.6-11.3-213-81-302.3z" } }] }, "name": "rotate-left", "theme": "outlined" };
|
|
/* harmony default export */ var asn_RotateLeftOutlined = (RotateLeftOutlined);
|
|
|
|
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.6.1@@ant-design/icons/es/components/AntdIcon.js + 3 modules
|
|
var AntdIcon = __webpack_require__(7657);
|
|
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons@5.6.1@@ant-design/icons/es/icons/RotateLeftOutlined.js
|
|
|
|
// GENERATE BY ./scripts/generate.ts
|
|
// DON NOT EDIT IT MANUALLY
|
|
|
|
|
|
|
|
|
|
var RotateLeftOutlined_RotateLeftOutlined = function RotateLeftOutlined(props, ref) {
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(AntdIcon/* default */.Z, (0,esm_extends/* default */.Z)({}, props, {
|
|
ref: ref,
|
|
icon: asn_RotateLeftOutlined
|
|
}));
|
|
};
|
|
|
|
/** */
|
|
var RefIcon = /*#__PURE__*/_react_17_0_2_react.forwardRef(RotateLeftOutlined_RotateLeftOutlined);
|
|
if (false) {}
|
|
/* harmony default export */ var icons_RotateLeftOutlined = (RefIcon);
|
|
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons-svg@4.4.2@@ant-design/icons-svg/es/asn/RotateRightOutlined.js
|
|
// This icon file is generated automatically.
|
|
var RotateRightOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "defs", "attrs": {}, "children": [{ "tag": "style", "attrs": {} }] }, { "tag": "path", "attrs": { "d": "M480.5 251.2c13-1.6 25.9-2.4 38.8-2.5v63.9c0 6.5 7.5 10.1 12.6 6.1L660 217.6c4-3.2 4-9.2 0-12.3l-128-101c-5.1-4-12.6-.4-12.6 6.1l-.2 64c-118.6.5-235.8 53.4-314.6 154.2A399.75 399.75 0 00123.5 631h74.9c-.9-5.3-1.7-10.7-2.4-16.1-5.1-42.1-2.1-84.1 8.9-124.8 11.4-42.2 31-81.1 58.1-115.8 27.2-34.7 60.3-63.2 98.4-84.3 37-20.6 76.9-33.6 119.1-38.8z" } }, { "tag": "path", "attrs": { "d": "M880 418H352c-17.7 0-32 14.3-32 32v414c0 17.7 14.3 32 32 32h528c17.7 0 32-14.3 32-32V450c0-17.7-14.3-32-32-32zm-44 402H396V494h440v326z" } }] }, "name": "rotate-right", "theme": "outlined" };
|
|
/* harmony default export */ var asn_RotateRightOutlined = (RotateRightOutlined);
|
|
|
|
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons@5.6.1@@ant-design/icons/es/icons/RotateRightOutlined.js
|
|
|
|
// GENERATE BY ./scripts/generate.ts
|
|
// DON NOT EDIT IT MANUALLY
|
|
|
|
|
|
|
|
|
|
var RotateRightOutlined_RotateRightOutlined = function RotateRightOutlined(props, ref) {
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(AntdIcon/* default */.Z, (0,esm_extends/* default */.Z)({}, props, {
|
|
ref: ref,
|
|
icon: asn_RotateRightOutlined
|
|
}));
|
|
};
|
|
|
|
/** */
|
|
var RotateRightOutlined_RefIcon = /*#__PURE__*/_react_17_0_2_react.forwardRef(RotateRightOutlined_RotateRightOutlined);
|
|
if (false) {}
|
|
/* harmony default export */ var icons_RotateRightOutlined = (RotateRightOutlined_RefIcon);
|
|
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons-svg@4.4.2@@ant-design/icons-svg/es/asn/SwapOutlined.js
|
|
// This icon file is generated automatically.
|
|
var SwapOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M847.9 592H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h605.2L612.9 851c-4.1 5.2-.4 13 6.3 13h72.5c4.9 0 9.5-2.2 12.6-6.1l168.8-214.1c16.5-21 1.6-51.8-25.2-51.8zM872 356H266.8l144.3-183c4.1-5.2.4-13-6.3-13h-72.5c-4.9 0-9.5 2.2-12.6 6.1L150.9 380.2c-16.5 21-1.6 51.8 25.1 51.8h696c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z" } }] }, "name": "swap", "theme": "outlined" };
|
|
/* harmony default export */ var asn_SwapOutlined = (SwapOutlined);
|
|
|
|
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons@5.6.1@@ant-design/icons/es/icons/SwapOutlined.js
|
|
|
|
// GENERATE BY ./scripts/generate.ts
|
|
// DON NOT EDIT IT MANUALLY
|
|
|
|
|
|
|
|
|
|
var SwapOutlined_SwapOutlined = function SwapOutlined(props, ref) {
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(AntdIcon/* default */.Z, (0,esm_extends/* default */.Z)({}, props, {
|
|
ref: ref,
|
|
icon: asn_SwapOutlined
|
|
}));
|
|
};
|
|
|
|
/** */
|
|
var SwapOutlined_RefIcon = /*#__PURE__*/_react_17_0_2_react.forwardRef(SwapOutlined_SwapOutlined);
|
|
if (false) {}
|
|
/* harmony default export */ var icons_SwapOutlined = (SwapOutlined_RefIcon);
|
|
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons-svg@4.4.2@@ant-design/icons-svg/es/asn/ZoomInOutlined.js
|
|
// This icon file is generated automatically.
|
|
var ZoomInOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M637 443H519V309c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v134H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h118v134c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V519h118c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z" } }] }, "name": "zoom-in", "theme": "outlined" };
|
|
/* harmony default export */ var asn_ZoomInOutlined = (ZoomInOutlined);
|
|
|
|
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons@5.6.1@@ant-design/icons/es/icons/ZoomInOutlined.js
|
|
|
|
// GENERATE BY ./scripts/generate.ts
|
|
// DON NOT EDIT IT MANUALLY
|
|
|
|
|
|
|
|
|
|
var ZoomInOutlined_ZoomInOutlined = function ZoomInOutlined(props, ref) {
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(AntdIcon/* default */.Z, (0,esm_extends/* default */.Z)({}, props, {
|
|
ref: ref,
|
|
icon: asn_ZoomInOutlined
|
|
}));
|
|
};
|
|
|
|
/** */
|
|
var ZoomInOutlined_RefIcon = /*#__PURE__*/_react_17_0_2_react.forwardRef(ZoomInOutlined_ZoomInOutlined);
|
|
if (false) {}
|
|
/* harmony default export */ var icons_ZoomInOutlined = (ZoomInOutlined_RefIcon);
|
|
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons-svg@4.4.2@@ant-design/icons-svg/es/asn/ZoomOutOutlined.js
|
|
// This icon file is generated automatically.
|
|
var ZoomOutOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M637 443H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h312c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z" } }] }, "name": "zoom-out", "theme": "outlined" };
|
|
/* harmony default export */ var asn_ZoomOutOutlined = (ZoomOutOutlined);
|
|
|
|
;// CONCATENATED MODULE: ./node_modules/_@ant-design_icons@5.6.1@@ant-design/icons/es/icons/ZoomOutOutlined.js
|
|
|
|
// GENERATE BY ./scripts/generate.ts
|
|
// DON NOT EDIT IT MANUALLY
|
|
|
|
|
|
|
|
|
|
var ZoomOutOutlined_ZoomOutOutlined = function ZoomOutOutlined(props, ref) {
|
|
return /*#__PURE__*/_react_17_0_2_react.createElement(AntdIcon/* default */.Z, (0,esm_extends/* default */.Z)({}, props, {
|
|
ref: ref,
|
|
icon: asn_ZoomOutOutlined
|
|
}));
|
|
};
|
|
|
|
/** */
|
|
var ZoomOutOutlined_RefIcon = /*#__PURE__*/_react_17_0_2_react.forwardRef(ZoomOutOutlined_ZoomOutOutlined);
|
|
if (false) {}
|
|
/* harmony default export */ var icons_ZoomOutOutlined = (ZoomOutOutlined_RefIcon);
|
|
// EXTERNAL MODULE: ./node_modules/_@ctrl_tinycolor@3.6.1@@ctrl/tinycolor/dist/module/index.js
|
|
var dist_module = __webpack_require__(64993);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/modal/style/index.js
|
|
var style = __webpack_require__(73819);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/style/index.js
|
|
var es_style = __webpack_require__(17313);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/style/motion/zoom.js
|
|
var zoom = __webpack_require__(29878);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/style/motion/fade.js
|
|
var fade = __webpack_require__(1950);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/theme/util/genComponentStyleHook.js
|
|
var genComponentStyleHook = __webpack_require__(83116);
|
|
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/theme/util/statistic.js
|
|
var statistic = __webpack_require__(37613);
|
|
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/image/style/index.js
|
|
|
|
|
|
|
|
|
|
|
|
const genBoxStyle = position => ({
|
|
position: position || 'absolute',
|
|
inset: 0
|
|
});
|
|
const genImageMaskStyle = token => {
|
|
const {
|
|
iconCls,
|
|
motionDurationSlow,
|
|
paddingXXS,
|
|
marginXXS,
|
|
prefixCls,
|
|
colorTextLightSolid
|
|
} = token;
|
|
return {
|
|
position: 'absolute',
|
|
inset: 0,
|
|
display: 'flex',
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
color: colorTextLightSolid,
|
|
background: new dist_module/* TinyColor */.C('#000').setAlpha(0.5).toRgbString(),
|
|
cursor: 'pointer',
|
|
opacity: 0,
|
|
transition: `opacity ${motionDurationSlow}`,
|
|
[`.${prefixCls}-mask-info`]: Object.assign(Object.assign({}, es_style/* textEllipsis */.vS), {
|
|
padding: `0 ${paddingXXS}px`,
|
|
[iconCls]: {
|
|
marginInlineEnd: marginXXS,
|
|
svg: {
|
|
verticalAlign: 'baseline'
|
|
}
|
|
}
|
|
})
|
|
};
|
|
};
|
|
const genPreviewOperationsStyle = token => {
|
|
const {
|
|
previewCls,
|
|
modalMaskBg,
|
|
paddingSM,
|
|
marginXL,
|
|
margin,
|
|
paddingLG,
|
|
previewOperationColorDisabled,
|
|
previewOperationHoverColor,
|
|
motionDurationSlow,
|
|
iconCls,
|
|
colorTextLightSolid
|
|
} = token;
|
|
const operationBg = new dist_module/* TinyColor */.C(modalMaskBg).setAlpha(0.1);
|
|
const operationBgHover = operationBg.clone().setAlpha(0.2);
|
|
return {
|
|
[`${previewCls}-footer`]: {
|
|
position: 'fixed',
|
|
bottom: marginXL,
|
|
left: {
|
|
_skip_check_: true,
|
|
value: 0
|
|
},
|
|
width: '100%',
|
|
display: 'flex',
|
|
flexDirection: 'column',
|
|
alignItems: 'center',
|
|
color: token.previewOperationColor
|
|
},
|
|
[`${previewCls}-progress`]: {
|
|
marginBottom: margin
|
|
},
|
|
[`${previewCls}-close`]: {
|
|
position: 'fixed',
|
|
top: marginXL,
|
|
right: {
|
|
_skip_check_: true,
|
|
value: marginXL
|
|
},
|
|
display: 'flex',
|
|
color: colorTextLightSolid,
|
|
backgroundColor: operationBg.toRgbString(),
|
|
borderRadius: '50%',
|
|
padding: paddingSM,
|
|
outline: 0,
|
|
border: 0,
|
|
cursor: 'pointer',
|
|
transition: `all ${motionDurationSlow}`,
|
|
'&:hover': {
|
|
backgroundColor: operationBgHover.toRgbString()
|
|
},
|
|
[`& > ${iconCls}`]: {
|
|
fontSize: token.previewOperationSize
|
|
}
|
|
},
|
|
[`${previewCls}-operations`]: {
|
|
display: 'flex',
|
|
alignItems: 'center',
|
|
padding: `0 ${paddingLG}px`,
|
|
backgroundColor: operationBg.toRgbString(),
|
|
borderRadius: 100,
|
|
'&-operation': {
|
|
marginInlineStart: paddingSM,
|
|
padding: paddingSM,
|
|
cursor: 'pointer',
|
|
transition: `all ${motionDurationSlow}`,
|
|
userSelect: 'none',
|
|
[`&:not(${previewCls}-operations-operation-disabled):hover > ${iconCls}`]: {
|
|
color: previewOperationHoverColor
|
|
},
|
|
'&-disabled': {
|
|
color: previewOperationColorDisabled,
|
|
cursor: 'not-allowed'
|
|
},
|
|
'&:first-of-type': {
|
|
marginInlineStart: 0
|
|
},
|
|
[`& > ${iconCls}`]: {
|
|
fontSize: token.previewOperationSize
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
const genPreviewSwitchStyle = token => {
|
|
const {
|
|
modalMaskBg,
|
|
iconCls,
|
|
previewOperationColorDisabled,
|
|
previewCls,
|
|
zIndexPopup,
|
|
motionDurationSlow
|
|
} = token;
|
|
const operationBg = new dist_module/* TinyColor */.C(modalMaskBg).setAlpha(0.1);
|
|
const operationBgHover = operationBg.clone().setAlpha(0.2);
|
|
return {
|
|
[`${previewCls}-switch-left, ${previewCls}-switch-right`]: {
|
|
position: 'fixed',
|
|
insetBlockStart: '50%',
|
|
zIndex: zIndexPopup + 1,
|
|
display: 'flex',
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
width: token.imagePreviewSwitchSize,
|
|
height: token.imagePreviewSwitchSize,
|
|
marginTop: -token.imagePreviewSwitchSize / 2,
|
|
color: token.previewOperationColor,
|
|
background: operationBg.toRgbString(),
|
|
borderRadius: '50%',
|
|
transform: `translateY(-50%)`,
|
|
cursor: 'pointer',
|
|
transition: `all ${motionDurationSlow}`,
|
|
userSelect: 'none',
|
|
'&:hover': {
|
|
background: operationBgHover.toRgbString()
|
|
},
|
|
[`&-disabled`]: {
|
|
'&, &:hover': {
|
|
color: previewOperationColorDisabled,
|
|
background: 'transparent',
|
|
cursor: 'not-allowed',
|
|
[`> ${iconCls}`]: {
|
|
cursor: 'not-allowed'
|
|
}
|
|
}
|
|
},
|
|
[`> ${iconCls}`]: {
|
|
fontSize: token.previewOperationSize
|
|
}
|
|
},
|
|
[`${previewCls}-switch-left`]: {
|
|
insetInlineStart: token.marginSM
|
|
},
|
|
[`${previewCls}-switch-right`]: {
|
|
insetInlineEnd: token.marginSM
|
|
}
|
|
};
|
|
};
|
|
const genImagePreviewStyle = token => {
|
|
const {
|
|
motionEaseOut,
|
|
previewCls,
|
|
motionDurationSlow,
|
|
componentCls
|
|
} = token;
|
|
return [{
|
|
[`${componentCls}-preview-root`]: {
|
|
[previewCls]: {
|
|
height: '100%',
|
|
textAlign: 'center',
|
|
pointerEvents: 'none'
|
|
},
|
|
[`${previewCls}-body`]: Object.assign(Object.assign({}, genBoxStyle()), {
|
|
overflow: 'hidden'
|
|
}),
|
|
[`${previewCls}-img`]: {
|
|
maxWidth: '100%',
|
|
maxHeight: '70%',
|
|
verticalAlign: 'middle',
|
|
transform: 'scale3d(1, 1, 1)',
|
|
cursor: 'grab',
|
|
transition: `transform ${motionDurationSlow} ${motionEaseOut} 0s`,
|
|
userSelect: 'none',
|
|
'&-wrapper': Object.assign(Object.assign({}, genBoxStyle()), {
|
|
transition: `transform ${motionDurationSlow} ${motionEaseOut} 0s`,
|
|
// https://github.com/ant-design/ant-design/issues/39913
|
|
// TailwindCSS will reset img default style.
|
|
// Let's set back.
|
|
display: 'flex',
|
|
justifyContent: 'center',
|
|
alignItems: 'center',
|
|
'& > *': {
|
|
pointerEvents: 'auto'
|
|
},
|
|
'&::before': {
|
|
display: 'inline-block',
|
|
width: 1,
|
|
height: '50%',
|
|
marginInlineEnd: -1,
|
|
content: '""'
|
|
}
|
|
})
|
|
},
|
|
[`${previewCls}-moving`]: {
|
|
[`${previewCls}-preview-img`]: {
|
|
cursor: 'grabbing',
|
|
'&-wrapper': {
|
|
transitionDuration: '0s'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
// Override
|
|
{
|
|
[`${componentCls}-preview-root`]: {
|
|
[`${previewCls}-wrap`]: {
|
|
zIndex: token.zIndexPopup
|
|
}
|
|
}
|
|
},
|
|
// Preview operations & switch
|
|
{
|
|
[`${componentCls}-preview-operations-wrapper`]: {
|
|
position: 'fixed',
|
|
zIndex: token.zIndexPopup + 1
|
|
},
|
|
'&': [genPreviewOperationsStyle(token), genPreviewSwitchStyle(token)]
|
|
}];
|
|
};
|
|
const genImageStyle = token => {
|
|
const {
|
|
componentCls
|
|
} = token;
|
|
return {
|
|
// ============================== image ==============================
|
|
[componentCls]: {
|
|
position: 'relative',
|
|
display: 'inline-block',
|
|
[`${componentCls}-img`]: {
|
|
width: '100%',
|
|
height: 'auto',
|
|
verticalAlign: 'middle'
|
|
},
|
|
[`${componentCls}-img-placeholder`]: {
|
|
backgroundColor: token.colorBgContainerDisabled,
|
|
backgroundImage: "url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTQuNSAyLjVoLTEzQS41LjUgMCAwIDAgMSAzdjEwYS41LjUgMCAwIDAgLjUuNWgxM2EuNS41IDAgMCAwIC41LS41VjNhLjUuNSAwIDAgMC0uNS0uNXpNNS4yODEgNC43NWExIDEgMCAwIDEgMCAyIDEgMSAwIDAgMSAwLTJ6bTguMDMgNi44M2EuMTI3LjEyNyAwIDAgMS0uMDgxLjAzSDIuNzY5YS4xMjUuMTI1IDAgMCAxLS4wOTYtLjIwN2wyLjY2MS0zLjE1NmEuMTI2LjEyNiAwIDAgMSAuMTc3LS4wMTZsLjAxNi4wMTZMNy4wOCAxMC4wOWwyLjQ3LTIuOTNhLjEyNi4xMjYgMCAwIDEgLjE3Ny0uMDE2bC4wMTUuMDE2IDMuNTg4IDQuMjQ0YS4xMjcuMTI3IDAgMCAxLS4wMi4xNzV6IiBmaWxsPSIjOEM4QzhDIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48L3N2Zz4=')",
|
|
backgroundRepeat: 'no-repeat',
|
|
backgroundPosition: 'center center',
|
|
backgroundSize: '30%'
|
|
},
|
|
[`${componentCls}-mask`]: Object.assign({}, genImageMaskStyle(token)),
|
|
[`${componentCls}-mask:hover`]: {
|
|
opacity: 1
|
|
},
|
|
[`${componentCls}-placeholder`]: Object.assign({}, genBoxStyle())
|
|
}
|
|
};
|
|
};
|
|
const genPreviewMotion = token => {
|
|
const {
|
|
previewCls
|
|
} = token;
|
|
return {
|
|
[`${previewCls}-root`]: (0,zoom/* initZoomMotion */._y)(token, 'zoom'),
|
|
[`&`]: (0,fade/* initFadeMotion */.J$)(token, true)
|
|
};
|
|
};
|
|
// ============================== Export ==============================
|
|
/* harmony default export */ var image_style = ((0,genComponentStyleHook/* default */.Z)('Image', token => {
|
|
const previewCls = `${token.componentCls}-preview`;
|
|
const imageToken = (0,statistic/* merge */.TS)(token, {
|
|
previewCls,
|
|
modalMaskBg: new dist_module/* TinyColor */.C('#000').setAlpha(0.45).toRgbString(),
|
|
imagePreviewSwitchSize: token.controlHeightLG
|
|
});
|
|
return [genImageStyle(imageToken), genImagePreviewStyle(imageToken), (0,style/* genModalMaskStyle */.QA)((0,statistic/* merge */.TS)(imageToken, {
|
|
componentCls: previewCls
|
|
})), genPreviewMotion(imageToken)];
|
|
}, token => ({
|
|
zIndexPopup: token.zIndexPopupBase + 80,
|
|
previewOperationColor: new dist_module/* TinyColor */.C(token.colorTextLightSolid).setAlpha(0.65).toRgbString(),
|
|
previewOperationHoverColor: new dist_module/* TinyColor */.C(token.colorTextLightSolid).setAlpha(0.85).toRgbString(),
|
|
previewOperationColorDisabled: new dist_module/* TinyColor */.C(token.colorTextLightSolid).setAlpha(0.25).toRgbString(),
|
|
previewOperationSize: token.fontSizeIcon * 1.5 // FIXME: fontSizeIconLG
|
|
})));
|
|
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/image/PreviewGroup.js
|
|
"use client";
|
|
|
|
var __rest = undefined && undefined.__rest || function (s, e) {
|
|
var t = {};
|
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
}
|
|
return t;
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// CSSINJS
|
|
|
|
const icons = {
|
|
rotateLeft: /*#__PURE__*/_react_17_0_2_react.createElement(icons_RotateLeftOutlined, null),
|
|
rotateRight: /*#__PURE__*/_react_17_0_2_react.createElement(icons_RotateRightOutlined, null),
|
|
zoomIn: /*#__PURE__*/_react_17_0_2_react.createElement(icons_ZoomInOutlined, null),
|
|
zoomOut: /*#__PURE__*/_react_17_0_2_react.createElement(icons_ZoomOutOutlined, null),
|
|
close: /*#__PURE__*/_react_17_0_2_react.createElement(CloseOutlined/* default */.Z, null),
|
|
left: /*#__PURE__*/_react_17_0_2_react.createElement(LeftOutlined/* default */.Z, null),
|
|
right: /*#__PURE__*/_react_17_0_2_react.createElement(RightOutlined/* default */.Z, null),
|
|
flipX: /*#__PURE__*/_react_17_0_2_react.createElement(icons_SwapOutlined, null),
|
|
flipY: /*#__PURE__*/_react_17_0_2_react.createElement(icons_SwapOutlined, {
|
|
rotate: 90
|
|
})
|
|
};
|
|
const InternalPreviewGroup = _a => {
|
|
var {
|
|
previewPrefixCls: customizePrefixCls,
|
|
preview
|
|
} = _a,
|
|
props = __rest(_a, ["previewPrefixCls", "preview"]);
|
|
const {
|
|
getPrefixCls
|
|
} = _react_17_0_2_react.useContext(context/* ConfigContext */.E_);
|
|
const prefixCls = getPrefixCls('image', customizePrefixCls);
|
|
const previewPrefixCls = `${prefixCls}-preview`;
|
|
const rootPrefixCls = getPrefixCls();
|
|
const [wrapSSR, hashId] = image_style(prefixCls);
|
|
const mergedPreview = _react_17_0_2_react.useMemo(() => {
|
|
var _a;
|
|
if (preview === false) {
|
|
return preview;
|
|
}
|
|
const _preview = typeof preview === 'object' ? preview : {};
|
|
const mergedRootClassName = _classnames_2_5_1_classnames_default()(hashId, (_a = _preview.rootClassName) !== null && _a !== void 0 ? _a : '');
|
|
return Object.assign(Object.assign({}, _preview), {
|
|
transitionName: (0,motion/* getTransitionName */.m)(rootPrefixCls, 'zoom', _preview.transitionName),
|
|
maskTransitionName: (0,motion/* getTransitionName */.m)(rootPrefixCls, 'fade', _preview.maskTransitionName),
|
|
rootClassName: mergedRootClassName
|
|
});
|
|
}, [preview]);
|
|
return wrapSSR( /*#__PURE__*/_react_17_0_2_react.createElement(_rc_image_7_2_0_rc_image_es.PreviewGroup, Object.assign({
|
|
preview: mergedPreview,
|
|
previewPrefixCls: previewPrefixCls,
|
|
icons: icons
|
|
}, props)));
|
|
};
|
|
/* harmony default export */ var image_PreviewGroup = (InternalPreviewGroup);
|
|
;// CONCATENATED MODULE: ./node_modules/_antd@5.9.0@antd/es/image/index.js
|
|
"use client";
|
|
|
|
var image_rest = undefined && undefined.__rest || function (s, e) {
|
|
var t = {};
|
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
}
|
|
return t;
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// CSSINJS
|
|
|
|
|
|
const image_Image = props => {
|
|
const {
|
|
prefixCls: customizePrefixCls,
|
|
preview,
|
|
className,
|
|
rootClassName,
|
|
style
|
|
} = props,
|
|
otherProps = image_rest(props, ["prefixCls", "preview", "className", "rootClassName", "style"]);
|
|
const {
|
|
getPrefixCls,
|
|
locale: contextLocale = en_US/* default */.Z,
|
|
getPopupContainer: getContextPopupContainer,
|
|
image
|
|
} = _react_17_0_2_react.useContext(context/* ConfigContext */.E_);
|
|
const prefixCls = getPrefixCls('image', customizePrefixCls);
|
|
const rootPrefixCls = getPrefixCls();
|
|
const imageLocale = contextLocale.Image || en_US/* default */.Z.Image;
|
|
// Style
|
|
const [wrapSSR, hashId] = image_style(prefixCls);
|
|
const mergedRootClassName = _classnames_2_5_1_classnames_default()(rootClassName, hashId);
|
|
const mergedClassName = _classnames_2_5_1_classnames_default()(className, hashId, image === null || image === void 0 ? void 0 : image.className);
|
|
const mergedPreview = _react_17_0_2_react.useMemo(() => {
|
|
if (preview === false) {
|
|
return preview;
|
|
}
|
|
const _preview = typeof preview === 'object' ? preview : {};
|
|
const {
|
|
getContainer
|
|
} = _preview,
|
|
restPreviewProps = image_rest(_preview, ["getContainer"]);
|
|
return Object.assign(Object.assign({
|
|
mask: /*#__PURE__*/_react_17_0_2_react.createElement("div", {
|
|
className: `${prefixCls}-mask-info`
|
|
}, /*#__PURE__*/_react_17_0_2_react.createElement(EyeOutlined/* default */.Z, null), imageLocale === null || imageLocale === void 0 ? void 0 : imageLocale.preview),
|
|
icons: icons
|
|
}, restPreviewProps), {
|
|
getContainer: getContainer || getContextPopupContainer,
|
|
transitionName: (0,motion/* getTransitionName */.m)(rootPrefixCls, 'zoom', _preview.transitionName),
|
|
maskTransitionName: (0,motion/* getTransitionName */.m)(rootPrefixCls, 'fade', _preview.maskTransitionName)
|
|
});
|
|
}, [preview, imageLocale]);
|
|
const mergedStyle = Object.assign(Object.assign({}, image === null || image === void 0 ? void 0 : image.style), style);
|
|
return wrapSSR( /*#__PURE__*/_react_17_0_2_react.createElement(_rc_image_7_2_0_rc_image_es, Object.assign({
|
|
prefixCls: prefixCls,
|
|
preview: mergedPreview,
|
|
rootClassName: mergedRootClassName,
|
|
className: mergedClassName,
|
|
style: mergedStyle
|
|
}, otherProps)));
|
|
};
|
|
image_Image.PreviewGroup = image_PreviewGroup;
|
|
if (false) {}
|
|
/* harmony default export */ var es_image = (image_Image);
|
|
|
|
/***/ })
|
|
|
|
}]); |