@unicom-cloud/ui 0.8.96 → 0.8.98
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/Affix.js +1 -1
- package/Carousel.js +1 -1
- package/LiquidFill.js +4 -0
- package/OverflowEllipsis.js +1 -1
- package/PageHeader.js +1 -1
- package/QrCode.js +57 -0
- package/Tour.js +63 -0
- package/Trigger.js +1 -1
- package/_virtual/_commonjsHelpers.js +6 -0
- package/_virtual/index.js +7 -0
- package/_virtual/index2.js +4 -0
- package/affix/index.js +70 -72
- package/alert/index.js +56 -56
- package/anchor/Anchor.js +55 -55
- package/anchor/Link.js +34 -34
- package/anchor/util.js +5 -5
- package/auto-complete/index.js +116 -122
- package/avatar/Avatar.js +33 -33
- package/avatar/Group.js +26 -26
- package/back-top/index.js +58 -61
- package/badge/index.js +46 -46
- package/breadcrumb/Item.js +42 -43
- package/breadcrumb/index.js +47 -47
- package/button/Group.js +6 -6
- package/button/index.js +91 -91
- package/calendar/Month.js +75 -75
- package/calendar/Year.js +35 -35
- package/calendar/header/index.js +25 -25
- package/calendar/index.js +103 -103
- package/card/Grid.js +8 -8
- package/card/Meta.js +16 -16
- package/card/index.js +49 -49
- package/carousel/Arrow.js +19 -19
- package/carousel/Indicator.js +26 -26
- package/carousel/index.js +108 -108
- package/cascader/Cascader.js +178 -191
- package/cascader/base/node.js +133 -136
- package/cascader/base/store.js +82 -85
- package/cascader/panel/List.js +125 -129
- package/cascader/panel/Search.js +79 -81
- package/cascader/util.js +13 -13
- package/checkbox/Checkbox.js +94 -96
- package/checkbox/Group.js +54 -56
- package/checkbox/GroupBlock.js +28 -29
- package/collapse/Collapse.js +45 -45
- package/collapse/Item.js +53 -55
- package/color-picker/ControlBar.js +43 -43
- package/color-picker/InputAlpha.js +12 -12
- package/color-picker/InputHex.js +30 -31
- package/color-picker/InputRgb.js +24 -24
- package/color-picker/Palette.js +18 -18
- package/color-picker/Panel.js +122 -125
- package/color-picker/hooks/useColorPicker.js +85 -88
- package/color-picker/hooks/useControlBlock.js +38 -40
- package/color-picker/index.js +47 -47
- package/comment/index.js +29 -29
- package/components/common/higher-order/with-speech-synthesis/index.js +37 -40
- package/components/common/hooks/useId.js +8 -8
- package/components/common/hooks/useInView.js +16 -16
- package/components/common/hooks/useIntersectionObserver.js +1 -1
- package/components/common/hooks/useKeyboardEvent.js +9 -10
- package/components/common/hooks/useOverflowHidden.js +1 -4
- package/components/common/hooks/usePersistCallback.js +7 -7
- package/components/common/hooks/useStateCallback.js +9 -10
- package/components/common/hooks/useWindowSize.js +8 -8
- package/components/common/space/index.js +9 -7
- package/components/common/utils/convertToDurationBasedOnTimeUnits.js +6 -0
- package/components/common/utils/dom.js +27 -29
- package/components/common/utils/findScrollParent.js +17 -0
- package/components/common/utils/intersectionObserver.js +21 -0
- package/components/common/utils/is.js +99 -109
- package/components/common/utils/mutationObserver.js +19 -0
- package/components/common/utils/reactDOM.js +34 -34
- package/components/common/utils/resizeObserver.js +21 -0
- package/copy/index.js +38 -40
- package/date-picker/Picker.js +290 -295
- package/date-picker/RangePicker.js +367 -372
- package/date-picker/index.js +33 -35
- package/date-picker/panel/Body.js +46 -47
- package/date-picker/panel/Header.js +33 -33
- package/date-picker/panel/Shortcut.js +31 -31
- package/date-picker/panel/date/index.js +85 -85
- package/date-picker/panel/month/index.js +59 -59
- package/date-picker/panel/quarter/index.js +67 -70
- package/date-picker/panel/range/index.js +101 -101
- package/date-picker/panel/year/index.js +39 -39
- package/date-picker/util.js +17 -18
- package/descriptions/index.js +62 -62
- package/details/index.js +53 -55
- package/development/index.js +9 -9
- package/dist/tinycolor/chunk/BOzCVdr0.js +1 -1
- package/dist/validate/src/index.js +5 -5
- package/dist/validate/src/util.js +1 -1
- package/divider/index.js +21 -21
- package/draggable/Item.js +35 -35
- package/draggable/index.js +22 -22
- package/drawer/Drawer.js +142 -147
- package/dropdown/Button.js +48 -48
- package/dropdown/index.js +88 -92
- package/empty/index.js +16 -16
- package/form/Control.js +211 -225
- package/form/Form.js +109 -113
- package/form/FormItem.js +118 -120
- package/form/FormList.js +60 -66
- package/form/FormProvider.js +31 -34
- package/form/hook/useContext.js +17 -19
- package/form/hook/useState.js +22 -23
- package/form/hook/useWatch.js +26 -27
- package/form/promisify.js +14 -18
- package/form/store.js +304 -316
- package/form/util.js +14 -15
- package/grid/Col.js +64 -64
- package/grid/Grid.js +51 -51
- package/grid/GridItem.js +48 -48
- package/grid/Row.js +39 -39
- package/hooks/useVerificationCode.js +41 -43
- package/hooks/useWatermark.js +89 -92
- package/icon/index.js +23 -24
- package/icon-hover/index.js +16 -16
- package/icons/file.js +11 -11
- package/image/Image.js +140 -141
- package/image/ImagePreview.js +252 -255
- package/image/ImagePreviewArrow.js +25 -25
- package/image/ImagePreviewGroup.js +62 -62
- package/image/util/getScale.js +25 -28
- package/index.js +684 -675
- package/input/Button.js +48 -50
- package/input/Group.js +9 -9
- package/input/Input.js +145 -154
- package/input/InputElement.js +108 -115
- package/input/Password.js +38 -38
- package/input/Search.js +51 -55
- package/input/Textarea.js +80 -81
- package/input/useComposition.js +23 -23
- package/input-number/decimal.js +59 -62
- package/input-number/index.js +139 -141
- package/input-tag/InputTag.js +222 -230
- package/layout/Content.js +6 -6
- package/layout/Footer.js +8 -8
- package/layout/Header.js +7 -7
- package/layout/Sider.js +88 -90
- package/layout/index.js +30 -30
- package/link/index.js +45 -46
- package/liquid-fill/LiquidFill.js +226 -0
- package/liquid-fill/LiquidFill2.js +3 -0
- package/liquid-fill/index.js +4 -0
- package/list/Item.js +28 -28
- package/list/Meta.js +12 -12
- package/list/index.js +146 -148
- package/mentions/index.js +75 -76
- package/menu/Item.js +58 -58
- package/menu/Menu.js +125 -127
- package/menu/OverflowWrap.js +39 -40
- package/menu/sub-menu/Inline.js +45 -45
- package/menu/util.js +26 -28
- package/message/index.js +96 -99
- package/message/useMessage.js +26 -27
- package/modal/Confirm.js +47 -49
- package/modal/Modal.js +250 -257
- package/modal/use-modal/Hook.js +26 -28
- package/modal/use-modal/index.js +46 -49
- package/notice/index.js +89 -90
- package/notification/index.js +60 -65
- package/notification/withNotification.js +35 -35
- package/overflow-ellipsis/OverflowItem.js +19 -20
- package/overflow-ellipsis/index.js +45 -46
- package/package.json +1 -1
- package/page-header/index.js +45 -45
- package/pagination/PageItem.js +87 -91
- package/pagination/PageJumper.js +40 -41
- package/pagination/PageOption.js +31 -35
- package/pagination/Pagination.js +162 -163
- package/picker/Input.js +90 -96
- package/picker/InputRange.js +115 -122
- package/popconfirm/index.js +98 -100
- package/popover/index.js +28 -28
- package/portal/Portal.js +10 -11
- package/progress/index.js +36 -36
- package/qr-code/index.js +99 -0
- package/qr-code/interface.js +1 -0
- package/radio/Group.js +48 -48
- package/radio/GroupBlock.js +32 -33
- package/radio/Radio.js +62 -64
- package/rate/index.js +88 -88
- package/resize-box/ResizeTrigger.js +39 -39
- package/resize-box/Split.js +92 -96
- package/resize-box/SplitGroup.js +116 -122
- package/resize-box/index.js +112 -115
- package/result/index.js +44 -44
- package/select/Option.js +53 -56
- package/select/Select.js +365 -381
- package/select/util.js +95 -99
- package/select-view/Core.js +159 -160
- package/skeleton/index.js +23 -23
- package/slider/Button.js +84 -92
- package/slider/Input.js +47 -49
- package/slider/Tick.js +28 -31
- package/slider/index.js +107 -107
- package/space/index.js +26 -26
- package/space-/index.js +51 -51
- package/spin/DotLoading.js +8 -8
- package/spin/index.js +47 -47
- package/statistic/Countdown.js +37 -37
- package/statistic/index.js +58 -58
- package/steps/Step.js +42 -42
- package/steps/index.js +54 -54
- package/style.css +1 -1
- package/switch/index.js +77 -78
- package/table/ColGroup.js +36 -37
- package/table/Table.js +447 -450
- package/table/hook/useExpand.js +24 -24
- package/table/hook/useRowSelection.js +62 -62
- package/table/summary/Row.js +16 -17
- package/table/tbody/Td.js +119 -118
- package/table/tbody/Tr.js +119 -121
- package/table/tbody/index.js +62 -63
- package/table/th-resizable/index.js +30 -30
- package/table/thead/Column.js +148 -148
- package/table/thead/index.js +87 -88
- package/tabs/Tab.js +55 -55
- package/tabs/TabContent.js +8 -8
- package/tabs/TabPane.js +15 -15
- package/tabs/hook/useHeaderScroll.js +36 -36
- package/tabs/tab-header/TabInk.js +31 -33
- package/tabs/tab-header/TabNavIcon.js +34 -35
- package/tabs/tab-header/index.js +192 -195
- package/tag/index.js +94 -97
- package/time-picker/Picker.js +167 -172
- package/time-picker/RangePicker.js +28 -28
- package/time-picker/TimePicker.js +146 -146
- package/timeline/Item.js +46 -46
- package/timeline/Timeline.js +52 -52
- package/tooltip/index.js +89 -95
- package/tour/index.js +289 -0
- package/transfer/Item.js +54 -54
- package/transfer/List.js +134 -136
- package/transfer/index.js +91 -91
- package/tree/Animation.js +49 -52
- package/tree/Node.js +114 -122
- package/tree/NodeList.js +51 -51
- package/tree/Tree.js +386 -393
- package/tree-select/List.js +71 -72
- package/tree-select/Select.js +135 -143
- package/tree-select/hook/useKeyCache.js +39 -39
- package/tree-select/hook/useStateValue.js +12 -12
- package/trigger/getPopupStyle.js +60 -61
- package/trigger/index.js +337 -346
- package/types/common/space/interface.d.ts +1 -1
- package/types/common/utils/convertToDurationBasedOnTimeUnits.d.ts +3 -0
- package/types/common/utils/findScrollParent.d.ts +2 -0
- package/types/common/utils/index.d.ts +5 -0
- package/types/common/utils/intersectionObserver.d.ts +2 -0
- package/types/common/utils/mutationObserver.d.ts +2 -0
- package/types/common/utils/resizeObserver.d.ts +2 -0
- package/types/pc/config-provider/interface.d.ts +6 -0
- package/types/pc/index.d.ts +3 -0
- package/types/pc/liquid-fill/LiquidFill.d.ts +115 -0
- package/types/pc/liquid-fill/LiquidFill2.d.ts +1 -0
- package/types/pc/liquid-fill/index.d.ts +2 -0
- package/types/pc/qr-code/index.d.ts +34 -0
- package/types/pc/qr-code/interface.d.ts +39 -0
- package/types/pc/table/interface.d.ts +2 -2
- package/types/pc/tour/index.d.ts +42 -0
- package/types/pc/utils/convertToDurationBasedOnTimeUnits.d.ts +3 -0
- package/types/pc/utils/findScrollParent.d.ts +2 -0
- package/types/pc/utils/index.d.ts +5 -0
- package/types/pc/utils/intersectionObserver.d.ts +2 -0
- package/types/pc/utils/mutationObserver.d.ts +2 -0
- package/types/pc/utils/names.d.ts +18 -0
- package/types/pc/utils/resizeObserver.d.ts +2 -0
- package/typography/Base.js +79 -81
- package/typography/EditContent.js +30 -33
- package/typography/Ellipsis.js +77 -73
- package/typography/Operations.js +50 -52
- package/typography/Paragraph.js +7 -7
- package/typography/Typography.js +7 -7
- package/typography/useEllipsis.js +105 -106
- package/upload/TriggerNode.js +69 -76
- package/upload/Upload.js +84 -87
- package/upload/Uploader.js +115 -118
- package/upload/list/PictureItem.js +61 -71
- package/upload/list/TextItem.js +61 -67
- package/upload/list/UploadProgress.js +42 -49
- package/upload/list/index.js +48 -49
- package/upload/request_.js +37 -38
- package/upload/util.js +39 -39
- package/utils/convertToDurationBasedOnTimeUnits.js +6 -0
- package/utils/findScrollParent.js +4 -0
- package/utils/index.js +281 -278
- package/utils/intersectionObserver.js +4 -0
- package/utils/mutationObserver.js +4 -0
- package/utils/names.js +12 -0
- package/utils/resizeObserver.js +4 -0
- package/verification-code/VerificationCode.js +50 -51
- package/version/index.js +1 -1
- package/virtual-list/VirtualList.js +243 -244
- package/virtual-list/util/item.js +3 -4
- package/watermark/Watermark.js +27 -31
- package/components/common/utils/resizeObserverEffect.js +0 -23
- package/types/common/utils/resizeObserverEffect.d.ts +0 -2
- package/types/pc/utils/resizeObserverEffect.d.ts +0 -2
- package/utils/resizeObserverEffect.js +0 -4
package/image/ImagePreview.js
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import { jsx as o, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
1
|
+
import { jsx as o, jsxs as P } from "react/jsx-runtime";
|
|
2
|
+
import me from "@unicom-cloud/icons/IconUiClose";
|
|
3
|
+
import pt from "@unicom-cloud/icons/IconUiCopy";
|
|
4
|
+
import dt from "@unicom-cloud/icons/IconUiFullscreen";
|
|
5
|
+
import gt from "@unicom-cloud/icons/IconUiLeft";
|
|
6
|
+
import vt from "@unicom-cloud/icons/IconUiLoading";
|
|
7
|
+
import kt from "@unicom-cloud/icons/IconUiOriginalSize";
|
|
8
8
|
import wt from "@unicom-cloud/icons/IconUiRight";
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
9
|
+
import yt from "@unicom-cloud/icons/IconUiRotateLeft";
|
|
10
|
+
import Ct from "@unicom-cloud/icons/IconUiRotateRight";
|
|
11
|
+
import bt from "@unicom-cloud/icons/IconUiZoomIn";
|
|
12
|
+
import ht from "@unicom-cloud/icons/IconUiZoomOut";
|
|
13
13
|
import xt from "lodash/isUndefined";
|
|
14
|
-
import { forwardRef as
|
|
15
|
-
import
|
|
14
|
+
import { forwardRef as It, useContext as ue, useState as m, useRef as d, useMemo as fe, useImperativeHandle as St, useCallback as Rt, useEffect as u } from "react";
|
|
15
|
+
import Pt from "../config-provider/ConfigProvider.js";
|
|
16
16
|
import "lodash/isEqualWith";
|
|
17
|
-
import
|
|
17
|
+
import Nt from "../components/common/hooks/useMergeValue.js";
|
|
18
18
|
import "../components/common/utils/is.js";
|
|
19
|
-
import { ArrowDown as
|
|
19
|
+
import { ArrowDown as zt, ArrowUp as Lt, ArrowLeft as Mt, ArrowRight as Tt, Esc as Et } from "@unicom-cloud/utils/constant/keyboardCode";
|
|
20
20
|
import "lodash/isNumber";
|
|
21
21
|
import "lodash/merge";
|
|
22
|
-
import { isServerRendering as
|
|
22
|
+
import { isServerRendering as Ot, on as B, off as F } from "../components/common/utils/dom.js";
|
|
23
23
|
import "../components/common/hooks/useIntersectionObserver.js";
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import { findDOMNode_ as
|
|
24
|
+
import $t from "../components/common/hooks/useMergeProps.js";
|
|
25
|
+
import Ut from "../components/common/hooks/useOverflowHidden.js";
|
|
26
|
+
import { findDOMNode_ as Dt } from "../components/common/utils/reactDOM.js";
|
|
27
27
|
import "@unicom-cloud/utils/constant";
|
|
28
|
-
import
|
|
28
|
+
import At from "../components/common/hooks/useUpdateEffect.js";
|
|
29
29
|
import "lodash/debounce";
|
|
30
|
-
import
|
|
31
|
-
import { PqbCSSTransition as
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import {
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import { PreviewGroupContext as
|
|
38
|
-
import
|
|
39
|
-
import
|
|
40
|
-
import
|
|
41
|
-
import
|
|
42
|
-
const
|
|
30
|
+
import Vt from "../portal/index.js";
|
|
31
|
+
import { PqbCSSTransition as pe } from "../components/common/utils/PqbCSSTransition.js";
|
|
32
|
+
import de from "@unicom-cloud/utils/class-name";
|
|
33
|
+
import Yt from "@unicom-cloud/utils/clipboard-copy";
|
|
34
|
+
import { resizeObserver as Xt } from "../components/common/utils/resizeObserver.js";
|
|
35
|
+
import Wt from "./ImagePreviewArrow.js";
|
|
36
|
+
import Bt from "./ImagePreviewToolbar.js";
|
|
37
|
+
import { PreviewGroupContext as Ft } from "./previewGroupContext.js";
|
|
38
|
+
import Zt from "./util/getFixTranslate.js";
|
|
39
|
+
import jt, { defaultScales as Ht } from "./util/getScale.js";
|
|
40
|
+
import Gt from "./util/hook/useImageStatus.js";
|
|
41
|
+
import _t from "../config-provider/context.js";
|
|
42
|
+
const Z = 90, qt = {
|
|
43
43
|
maskClosable: !0,
|
|
44
44
|
closable: !0,
|
|
45
45
|
breakPoint: 316,
|
|
@@ -60,304 +60,301 @@ const J = 90, Kt = {
|
|
|
60
60
|
],
|
|
61
61
|
getPopupContainer: () => document.body,
|
|
62
62
|
escToExit: !0,
|
|
63
|
-
scales:
|
|
63
|
+
scales: Ht,
|
|
64
64
|
resetTranslate: !0
|
|
65
65
|
};
|
|
66
|
-
function
|
|
66
|
+
function Kt(ge, ve) {
|
|
67
67
|
const {
|
|
68
|
-
previewGroup:
|
|
69
|
-
previewUrlMap:
|
|
70
|
-
currentIndex:
|
|
71
|
-
setCurrentIndex:
|
|
68
|
+
previewGroup: v,
|
|
69
|
+
previewUrlMap: y,
|
|
70
|
+
currentIndex: a,
|
|
71
|
+
setCurrentIndex: ke,
|
|
72
72
|
infinite: C,
|
|
73
|
-
previewPropsMap:
|
|
74
|
-
} =
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
73
|
+
previewPropsMap: we
|
|
74
|
+
} = ue(Ft), ye = v ? we.get(a) : {}, N = $t(
|
|
75
|
+
ge,
|
|
76
|
+
qt,
|
|
77
|
+
ye
|
|
78
78
|
), {
|
|
79
|
-
className:
|
|
80
|
-
style:
|
|
81
|
-
src:
|
|
82
|
-
defaultVisible:
|
|
83
|
-
maskClosable:
|
|
84
|
-
closable:
|
|
85
|
-
breakPoint:
|
|
86
|
-
actions:
|
|
87
|
-
actionsLayout:
|
|
88
|
-
getPopupContainer:
|
|
89
|
-
onVisibleChange:
|
|
90
|
-
scales:
|
|
91
|
-
escToExit:
|
|
92
|
-
imgAttributes:
|
|
93
|
-
imageRender:
|
|
94
|
-
extra:
|
|
95
|
-
resetTranslate:
|
|
96
|
-
} =
|
|
97
|
-
defaultValue:
|
|
98
|
-
value:
|
|
99
|
-
}),
|
|
100
|
-
|
|
79
|
+
className: Ce,
|
|
80
|
+
style: be,
|
|
81
|
+
src: he,
|
|
82
|
+
defaultVisible: xe,
|
|
83
|
+
maskClosable: Ie,
|
|
84
|
+
closable: Se,
|
|
85
|
+
breakPoint: Re,
|
|
86
|
+
actions: Pe,
|
|
87
|
+
actionsLayout: Ne,
|
|
88
|
+
getPopupContainer: j,
|
|
89
|
+
onVisibleChange: ze,
|
|
90
|
+
scales: z,
|
|
91
|
+
escToExit: H,
|
|
92
|
+
imgAttributes: Le = {},
|
|
93
|
+
imageRender: Me,
|
|
94
|
+
extra: Te = null,
|
|
95
|
+
resetTranslate: G
|
|
96
|
+
} = N, b = v ? y.get(a) : he, [L, Ee] = m(b), [r, Oe] = Nt(!1, {
|
|
97
|
+
defaultValue: xe,
|
|
98
|
+
value: N.visible
|
|
99
|
+
}), _ = ue(_t), { getPrefixCls: $e, locale: k, rtl: Ue } = _, q = $e?.("image"), i = `${q}-preview`, De = de(
|
|
100
|
+
i,
|
|
101
101
|
{
|
|
102
|
-
[`${
|
|
103
|
-
[`${
|
|
102
|
+
[`${i}-hide`]: !r,
|
|
103
|
+
[`${i}-rtl`]: Ue
|
|
104
104
|
},
|
|
105
|
-
|
|
106
|
-
),
|
|
105
|
+
Ce
|
|
106
|
+
), h = d(), Ae = d(), f = d(), K = d(), M = d(!1), w = d({
|
|
107
107
|
pageX: 0,
|
|
108
108
|
pageY: 0,
|
|
109
109
|
originX: 0,
|
|
110
110
|
originY: 0
|
|
111
|
-
}), { isLoading:
|
|
112
|
-
onLoad:
|
|
113
|
-
onError:
|
|
114
|
-
onMouseDown:
|
|
111
|
+
}), { isLoading: Ve, isLoaded: Ye, setStatus: T } = Gt("loading"), [Xe, We] = m(!1), [s, E] = m({ x: 0, y: 0 }), [n, O] = m(1), [J, Q] = m(!1), [x, $] = m(0), [c, ee] = m(!1), p = fe(() => new jt(z), []), {
|
|
112
|
+
onLoad: Be,
|
|
113
|
+
onError: Fe,
|
|
114
|
+
onMouseDown: Ze,
|
|
115
115
|
style: je,
|
|
116
116
|
className: He,
|
|
117
117
|
...Ge
|
|
118
|
-
} =
|
|
119
|
-
function
|
|
120
|
-
|
|
118
|
+
} = Le, te = !C && a <= 0, oe = !C && a >= y.size - 1;
|
|
119
|
+
function U() {
|
|
120
|
+
E({ x: 0, y: 0 }), O(1), $(0);
|
|
121
121
|
}
|
|
122
|
-
|
|
123
|
-
reset:
|
|
124
|
-
getRootDOMNode: () =>
|
|
122
|
+
St(ve, () => ({
|
|
123
|
+
reset: U,
|
|
124
|
+
getRootDOMNode: () => K.current
|
|
125
125
|
}));
|
|
126
|
-
const [
|
|
127
|
-
|
|
128
|
-
const e =
|
|
126
|
+
const [I, _e] = m(), ne = Rt(() => I, [I]);
|
|
127
|
+
u(() => {
|
|
128
|
+
const e = j?.(), t = Dt(e) || document.body;
|
|
129
129
|
_e(t);
|
|
130
|
-
}, [
|
|
131
|
-
const qe =
|
|
132
|
-
() => !
|
|
133
|
-
[
|
|
130
|
+
}, [j]), Ut(ne, { hidden: r });
|
|
131
|
+
const qe = fe(
|
|
132
|
+
() => !Ot && I === document.body,
|
|
133
|
+
[I]
|
|
134
134
|
);
|
|
135
|
-
function
|
|
136
|
-
const t =
|
|
137
|
-
C && (e %= t, e < 0 && (e = t - Math.abs(e))), e !==
|
|
135
|
+
function re(e) {
|
|
136
|
+
const t = y.size;
|
|
137
|
+
C && (e %= t, e < 0 && (e = t - Math.abs(e))), e !== a && e >= 0 && e <= t - 1 && ke(e);
|
|
138
138
|
}
|
|
139
|
-
function
|
|
140
|
-
|
|
139
|
+
function D() {
|
|
140
|
+
re(a - 1);
|
|
141
141
|
}
|
|
142
|
-
function
|
|
143
|
-
|
|
142
|
+
function A() {
|
|
143
|
+
re(a + 1);
|
|
144
144
|
}
|
|
145
145
|
function Ke() {
|
|
146
|
-
|
|
146
|
+
$(x === 0 ? 360 - Z : x - Z);
|
|
147
147
|
}
|
|
148
148
|
function Je() {
|
|
149
|
-
|
|
149
|
+
$((x + Z) % 360);
|
|
150
150
|
}
|
|
151
|
-
const
|
|
152
|
-
!
|
|
153
|
-
|
|
151
|
+
const V = d(null), Qe = () => {
|
|
152
|
+
!J && Q(!0), V.current && clearTimeout(V.current), V.current = setTimeout(() => {
|
|
153
|
+
Q(!1);
|
|
154
154
|
}, 1e3);
|
|
155
|
-
},
|
|
156
|
-
n !== e && (
|
|
155
|
+
}, S = (e) => {
|
|
156
|
+
n !== e && (O(e), Qe());
|
|
157
157
|
};
|
|
158
|
-
function
|
|
159
|
-
const e =
|
|
160
|
-
|
|
158
|
+
function Y() {
|
|
159
|
+
const e = p.getNextScale(n, "zoomIn");
|
|
160
|
+
S(e);
|
|
161
161
|
}
|
|
162
|
-
function
|
|
163
|
-
const e =
|
|
164
|
-
|
|
162
|
+
function X() {
|
|
163
|
+
const e = p.getNextScale(n, "zoomOut");
|
|
164
|
+
S(e);
|
|
165
165
|
}
|
|
166
166
|
function et(e) {
|
|
167
|
-
e.deltaY > 0 ? n >=
|
|
167
|
+
e.deltaY > 0 ? n >= p.minScale && X() : n <= p.maxScale && Y();
|
|
168
168
|
}
|
|
169
169
|
function tt() {
|
|
170
|
-
|
|
170
|
+
S(1);
|
|
171
171
|
}
|
|
172
172
|
function ot() {
|
|
173
|
-
const e =
|
|
174
|
-
|
|
173
|
+
const e = f.current.getBoundingClientRect(), t = h.current.getBoundingClientRect(), l = e.height / (t.height / n), g = e.width / (t.width / n), W = Math.max(l, g);
|
|
174
|
+
S(W);
|
|
175
175
|
}
|
|
176
|
-
function
|
|
177
|
-
e.target === e.currentTarget &&
|
|
176
|
+
function ie(e) {
|
|
177
|
+
e.target === e.currentTarget && Ie && R();
|
|
178
178
|
}
|
|
179
179
|
function nt() {
|
|
180
|
-
|
|
180
|
+
Yt(L);
|
|
181
181
|
}
|
|
182
|
-
function
|
|
183
|
-
|
|
182
|
+
function ae() {
|
|
183
|
+
R();
|
|
184
184
|
}
|
|
185
185
|
function rt(e) {
|
|
186
|
-
|
|
186
|
+
R();
|
|
187
187
|
}
|
|
188
|
-
function
|
|
189
|
-
|
|
188
|
+
function R() {
|
|
189
|
+
r && (ze?.(!1, r), xt(N.visible) && Oe(!1));
|
|
190
190
|
}
|
|
191
191
|
function it(e) {
|
|
192
192
|
if (e && e.length) {
|
|
193
|
-
const
|
|
194
|
-
|
|
193
|
+
const l = e[0].contentRect.width < Re;
|
|
194
|
+
We(l);
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
|
-
const
|
|
198
|
-
if (!
|
|
197
|
+
const se = () => {
|
|
198
|
+
if (!f.current || !h.current)
|
|
199
199
|
return;
|
|
200
|
-
const e =
|
|
200
|
+
const e = f.current.getBoundingClientRect(), t = h.current.getBoundingClientRect(), [l, g] = Zt(
|
|
201
201
|
e,
|
|
202
202
|
t,
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
s.x,
|
|
204
|
+
s.y,
|
|
205
205
|
n
|
|
206
206
|
);
|
|
207
|
-
(
|
|
208
|
-
x:
|
|
209
|
-
y:
|
|
207
|
+
(l !== s.x || g !== s.y) && E({
|
|
208
|
+
x: l,
|
|
209
|
+
y: g
|
|
210
210
|
});
|
|
211
|
-
},
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
y: pt
|
|
211
|
+
}, ce = (e) => {
|
|
212
|
+
if (r && c) {
|
|
213
|
+
e.preventDefault?.();
|
|
214
|
+
const { originX: t, originY: l, pageX: g, pageY: W } = w.current, ut = t + (e.pageX - g) / n, ft = l + (e.pageY - W) / n;
|
|
215
|
+
E({
|
|
216
|
+
x: ut,
|
|
217
|
+
y: ft
|
|
219
218
|
});
|
|
220
219
|
}
|
|
221
|
-
},
|
|
222
|
-
|
|
223
|
-
(t = e.preventDefault) == null || t.call(e), ae(!1);
|
|
220
|
+
}, le = (e) => {
|
|
221
|
+
e.preventDefault?.(), ee(!1);
|
|
224
222
|
};
|
|
225
223
|
function at(e) {
|
|
226
|
-
|
|
224
|
+
T("loaded"), Be?.(e);
|
|
227
225
|
}
|
|
228
226
|
function st(e) {
|
|
229
|
-
|
|
227
|
+
T("error"), Fe?.(e);
|
|
230
228
|
}
|
|
231
229
|
const ct = (e) => {
|
|
232
|
-
|
|
233
|
-
(s = e.preventDefault) == null || s.call(e), ae(!0);
|
|
230
|
+
e.preventDefault?.(), ee(!0);
|
|
234
231
|
const t = e.type === "touchstart" ? e.touches[0] : e;
|
|
235
|
-
|
|
232
|
+
w.current.pageX = t.pageX, w.current.pageY = t.pageY, w.current.originX = s.x, w.current.originY = s.y, Ze?.(e);
|
|
236
233
|
};
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
}), [
|
|
240
|
-
|
|
241
|
-
}, [
|
|
242
|
-
|
|
243
|
-
}, [n]),
|
|
244
|
-
|
|
245
|
-
}, [
|
|
246
|
-
|
|
247
|
-
}, [
|
|
248
|
-
|
|
249
|
-
}, [
|
|
234
|
+
u(() => (r && c && (B(document, "mousemove", ce, !1), B(document, "mouseup", le, !1)), () => {
|
|
235
|
+
F(document, "mousemove", ce, !1), F(document, "mouseup", le, !1);
|
|
236
|
+
}), [r, c]), u(() => {
|
|
237
|
+
G && !c && se();
|
|
238
|
+
}, [c, s]), u(() => {
|
|
239
|
+
G && se();
|
|
240
|
+
}, [n]), u(() => {
|
|
241
|
+
r && U();
|
|
242
|
+
}, [r]), u(() => {
|
|
243
|
+
Ee(b), T(b ? "loading" : "loaded"), U();
|
|
244
|
+
}, [b]), At(() => {
|
|
245
|
+
p.updateScale(z), O(1);
|
|
246
|
+
}, [z]), u(() => {
|
|
250
247
|
const e = (t) => {
|
|
251
248
|
if (t)
|
|
252
249
|
switch (t.key) {
|
|
253
250
|
case Et.key:
|
|
254
|
-
|
|
251
|
+
H && R();
|
|
255
252
|
break;
|
|
256
|
-
case
|
|
257
|
-
|
|
253
|
+
case Tt.key:
|
|
254
|
+
A();
|
|
258
255
|
break;
|
|
259
|
-
case
|
|
260
|
-
|
|
256
|
+
case Mt.key:
|
|
257
|
+
D();
|
|
261
258
|
break;
|
|
262
259
|
case Lt.key:
|
|
263
|
-
|
|
260
|
+
Y();
|
|
264
261
|
break;
|
|
265
|
-
case
|
|
266
|
-
|
|
262
|
+
case zt.key:
|
|
263
|
+
X();
|
|
267
264
|
break;
|
|
268
265
|
}
|
|
269
266
|
};
|
|
270
|
-
return
|
|
271
|
-
M.current = !1,
|
|
267
|
+
return r && !c && !M.current && (M.current = !0, B(document, "keydown", e)), () => {
|
|
268
|
+
M.current = !1, F(document, "keydown", e);
|
|
272
269
|
};
|
|
273
|
-
}, [
|
|
274
|
-
const
|
|
270
|
+
}, [r, H, c, a, n]);
|
|
271
|
+
const lt = [
|
|
275
272
|
!1,
|
|
276
273
|
{
|
|
277
274
|
key: "rotateRight",
|
|
278
|
-
name:
|
|
279
|
-
content: /* @__PURE__ */ o(
|
|
275
|
+
name: k?.ImagePreview.rotateRight,
|
|
276
|
+
content: /* @__PURE__ */ o(Ct, {}),
|
|
280
277
|
onClick: Je
|
|
281
278
|
},
|
|
282
279
|
{
|
|
283
280
|
key: "rotateLeft",
|
|
284
|
-
name:
|
|
285
|
-
content: /* @__PURE__ */ o(
|
|
281
|
+
name: k?.ImagePreview.rotateLeft,
|
|
282
|
+
content: /* @__PURE__ */ o(yt, {}),
|
|
286
283
|
onClick: Ke
|
|
287
284
|
},
|
|
288
285
|
{
|
|
289
286
|
key: "zoomIn",
|
|
290
|
-
name:
|
|
291
|
-
content: /* @__PURE__ */ o(
|
|
292
|
-
onClick:
|
|
293
|
-
disabled: n ===
|
|
287
|
+
name: k?.ImagePreview.zoomIn,
|
|
288
|
+
content: /* @__PURE__ */ o(bt, {}),
|
|
289
|
+
onClick: Y,
|
|
290
|
+
disabled: n === p.maxScale
|
|
294
291
|
},
|
|
295
292
|
{
|
|
296
293
|
key: "zoomOut",
|
|
297
|
-
name:
|
|
298
|
-
content: /* @__PURE__ */ o(
|
|
299
|
-
onClick:
|
|
300
|
-
disabled: n ===
|
|
294
|
+
name: k?.ImagePreview.zoomOut,
|
|
295
|
+
content: /* @__PURE__ */ o(ht, {}),
|
|
296
|
+
onClick: X,
|
|
297
|
+
disabled: n === p.minScale
|
|
301
298
|
},
|
|
302
299
|
{
|
|
303
300
|
key: "originalSize",
|
|
304
|
-
name:
|
|
305
|
-
content: /* @__PURE__ */ o(
|
|
301
|
+
name: k?.ImagePreview.originalSize,
|
|
302
|
+
content: /* @__PURE__ */ o(kt, {}),
|
|
306
303
|
onClick: tt
|
|
307
304
|
},
|
|
308
305
|
{
|
|
309
306
|
key: "maximize",
|
|
310
307
|
name: "最大化",
|
|
311
|
-
content: /* @__PURE__ */ o(
|
|
308
|
+
content: /* @__PURE__ */ o(dt, {}),
|
|
312
309
|
onClick: ot
|
|
313
310
|
},
|
|
314
|
-
!!
|
|
311
|
+
!!v && {
|
|
315
312
|
key: "next",
|
|
316
313
|
name: "下一张",
|
|
317
314
|
content: /* @__PURE__ */ o(wt, {}),
|
|
318
|
-
disabled:
|
|
319
|
-
onClick:
|
|
315
|
+
disabled: oe,
|
|
316
|
+
onClick: A
|
|
320
317
|
},
|
|
321
|
-
!!
|
|
318
|
+
!!v && {
|
|
322
319
|
key: "prev",
|
|
323
320
|
name: "上一张",
|
|
324
|
-
content: /* @__PURE__ */ o(
|
|
325
|
-
disabled:
|
|
326
|
-
onClick:
|
|
321
|
+
content: /* @__PURE__ */ o(gt, {}),
|
|
322
|
+
disabled: te,
|
|
323
|
+
onClick: D
|
|
327
324
|
},
|
|
328
325
|
{
|
|
329
326
|
key: "copy",
|
|
330
327
|
name: "复制",
|
|
331
|
-
content: /* @__PURE__ */ o(
|
|
328
|
+
content: /* @__PURE__ */ o(pt, {}),
|
|
332
329
|
onClick: nt
|
|
333
330
|
},
|
|
334
331
|
{
|
|
335
332
|
key: "close",
|
|
336
333
|
name: "关闭",
|
|
337
|
-
content: /* @__PURE__ */ o(
|
|
338
|
-
onClick:
|
|
334
|
+
content: /* @__PURE__ */ o(me, {}),
|
|
335
|
+
onClick: ae
|
|
339
336
|
}
|
|
340
337
|
].filter(Boolean);
|
|
341
|
-
|
|
342
|
-
const e =
|
|
338
|
+
u(() => {
|
|
339
|
+
const e = Xt([f.current], it);
|
|
343
340
|
return () => {
|
|
344
341
|
e();
|
|
345
342
|
};
|
|
346
|
-
}, [
|
|
347
|
-
const
|
|
343
|
+
}, [f.current]);
|
|
344
|
+
const mt = () => {
|
|
348
345
|
const e = /* @__PURE__ */ o(
|
|
349
346
|
"img",
|
|
350
347
|
{
|
|
351
348
|
onWheel: et,
|
|
352
|
-
ref:
|
|
353
|
-
className:
|
|
354
|
-
[`${
|
|
349
|
+
ref: h,
|
|
350
|
+
className: de(He, `${i}-img`, {
|
|
351
|
+
[`${i}-img-moving`]: c
|
|
355
352
|
}),
|
|
356
353
|
style: {
|
|
357
354
|
...je,
|
|
358
|
-
transform: `translate(${
|
|
355
|
+
transform: `translate(${s.x}px, ${s.y}px) rotate(${x}deg)`
|
|
359
356
|
},
|
|
360
|
-
src:
|
|
357
|
+
src: L,
|
|
361
358
|
...Ge,
|
|
362
359
|
onLoad: at,
|
|
363
360
|
onError: st,
|
|
@@ -365,30 +362,30 @@ function Jt(be, he) {
|
|
|
365
362
|
t.button === 0 && ct(t);
|
|
366
363
|
}
|
|
367
364
|
},
|
|
368
|
-
|
|
365
|
+
L
|
|
369
366
|
);
|
|
370
|
-
return (
|
|
367
|
+
return Me?.(e) ?? e;
|
|
371
368
|
};
|
|
372
|
-
return /* @__PURE__ */ o(
|
|
373
|
-
|
|
369
|
+
return /* @__PURE__ */ o(Vt, { visible: r, forceRender: !1, getContainer: ne, children: /* @__PURE__ */ o(
|
|
370
|
+
Pt,
|
|
374
371
|
{
|
|
375
|
-
...
|
|
372
|
+
..._,
|
|
376
373
|
childrenName: "ImagePreview",
|
|
377
|
-
getPopupContainer: () =>
|
|
378
|
-
children: /* @__PURE__ */
|
|
374
|
+
getPopupContainer: () => f.current,
|
|
375
|
+
children: /* @__PURE__ */ P(
|
|
379
376
|
"div",
|
|
380
377
|
{
|
|
381
|
-
className:
|
|
378
|
+
className: De,
|
|
382
379
|
style: {
|
|
383
|
-
...
|
|
380
|
+
...be || {},
|
|
384
381
|
...qe ? {} : { zIndex: "inherit", position: "absolute" }
|
|
385
382
|
},
|
|
386
|
-
ref:
|
|
383
|
+
ref: K,
|
|
387
384
|
children: [
|
|
388
385
|
/* @__PURE__ */ o(
|
|
389
|
-
|
|
386
|
+
pe,
|
|
390
387
|
{
|
|
391
|
-
in:
|
|
388
|
+
in: r,
|
|
392
389
|
timeout: 400,
|
|
393
390
|
appear: !0,
|
|
394
391
|
classNames: "fadeImage",
|
|
@@ -400,75 +397,75 @@ function Jt(be, he) {
|
|
|
400
397
|
onExited: (e) => {
|
|
401
398
|
e && (e.parentNode.style.display = "", e.style.display = "none");
|
|
402
399
|
},
|
|
403
|
-
children: /* @__PURE__ */ o("div", { className: `${
|
|
400
|
+
children: /* @__PURE__ */ o("div", { className: `${i}-mask`, onClick: rt })
|
|
404
401
|
}
|
|
405
402
|
),
|
|
406
|
-
|
|
403
|
+
r && /* @__PURE__ */ P(
|
|
407
404
|
"div",
|
|
408
405
|
{
|
|
409
|
-
ref:
|
|
410
|
-
className: `${
|
|
411
|
-
onClick:
|
|
406
|
+
ref: f,
|
|
407
|
+
className: `${i}-wrapper`,
|
|
408
|
+
onClick: ie,
|
|
412
409
|
children: [
|
|
413
|
-
/* @__PURE__ */
|
|
410
|
+
/* @__PURE__ */ P(
|
|
414
411
|
"div",
|
|
415
412
|
{
|
|
416
|
-
ref:
|
|
417
|
-
className: `${
|
|
413
|
+
ref: Ae,
|
|
414
|
+
className: `${i}-img-container`,
|
|
418
415
|
style: { transform: `scale(${n}, ${n})` },
|
|
419
|
-
onClick:
|
|
416
|
+
onClick: ie,
|
|
420
417
|
children: [
|
|
421
|
-
|
|
422
|
-
|
|
418
|
+
mt(),
|
|
419
|
+
Ve && /* @__PURE__ */ o("div", { className: `${i}-loading`, children: /* @__PURE__ */ o(vt, {}) })
|
|
423
420
|
]
|
|
424
421
|
}
|
|
425
422
|
),
|
|
426
423
|
/* @__PURE__ */ o(
|
|
427
|
-
|
|
424
|
+
pe,
|
|
428
425
|
{
|
|
429
|
-
in:
|
|
426
|
+
in: J,
|
|
430
427
|
timeout: 400,
|
|
431
428
|
appear: !0,
|
|
432
429
|
classNames: "fadeImage",
|
|
433
430
|
unmountOnExit: !0,
|
|
434
|
-
children: /* @__PURE__ */
|
|
431
|
+
children: /* @__PURE__ */ P("div", { className: `${i}-scale-value`, children: [
|
|
435
432
|
(n * 100).toFixed(0),
|
|
436
433
|
"%"
|
|
437
434
|
] })
|
|
438
435
|
}
|
|
439
436
|
),
|
|
440
|
-
|
|
441
|
-
|
|
437
|
+
Ye && /* @__PURE__ */ o(
|
|
438
|
+
Bt,
|
|
442
439
|
{
|
|
443
|
-
prefixCls:
|
|
444
|
-
previewPrefixCls:
|
|
445
|
-
actions:
|
|
446
|
-
actionsLayout:
|
|
447
|
-
defaultActions:
|
|
448
|
-
simple:
|
|
440
|
+
prefixCls: q,
|
|
441
|
+
previewPrefixCls: i,
|
|
442
|
+
actions: Pe,
|
|
443
|
+
actionsLayout: Ne,
|
|
444
|
+
defaultActions: lt,
|
|
445
|
+
simple: Xe
|
|
449
446
|
}
|
|
450
447
|
),
|
|
451
|
-
|
|
448
|
+
Se && /* @__PURE__ */ o(
|
|
452
449
|
"div",
|
|
453
450
|
{
|
|
454
|
-
className: `${
|
|
455
|
-
onClick:
|
|
456
|
-
children: /* @__PURE__ */ o(
|
|
451
|
+
className: `${i}-close-btn`,
|
|
452
|
+
onClick: ae,
|
|
453
|
+
children: /* @__PURE__ */ o(me, {})
|
|
457
454
|
}
|
|
458
455
|
),
|
|
459
|
-
|
|
460
|
-
|
|
456
|
+
v && /* @__PURE__ */ o(
|
|
457
|
+
Wt,
|
|
461
458
|
{
|
|
462
|
-
previewCount:
|
|
463
|
-
current:
|
|
459
|
+
previewCount: y.size,
|
|
460
|
+
current: a,
|
|
464
461
|
infinite: C,
|
|
465
|
-
disableLeft:
|
|
466
|
-
disableRight:
|
|
467
|
-
onPrev:
|
|
468
|
-
onNext:
|
|
462
|
+
disableLeft: te,
|
|
463
|
+
disableRight: oe,
|
|
464
|
+
onPrev: D,
|
|
465
|
+
onNext: A
|
|
469
466
|
}
|
|
470
467
|
),
|
|
471
|
-
|
|
468
|
+
Te
|
|
472
469
|
]
|
|
473
470
|
}
|
|
474
471
|
)
|
|
@@ -478,10 +475,10 @@ function Jt(be, he) {
|
|
|
478
475
|
}
|
|
479
476
|
) });
|
|
480
477
|
}
|
|
481
|
-
const
|
|
482
|
-
|
|
478
|
+
const Jt = It(
|
|
479
|
+
Kt
|
|
483
480
|
);
|
|
484
|
-
|
|
481
|
+
Jt.displayName = "ImagePreview";
|
|
485
482
|
export {
|
|
486
|
-
|
|
483
|
+
Jt as default
|
|
487
484
|
};
|