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