eli-video-interview 1.2.39 → 1.2.40-alpha.2

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 (223) hide show
  1. package/esm/components/react-photo-view/Photo.css +14 -0
  2. package/esm/components/react-photo-view/Photo.d.ts +18 -0
  3. package/esm/components/react-photo-view/Photo.js +54 -0
  4. package/esm/components/react-photo-view/PhotoBox.css +18 -0
  5. package/esm/components/react-photo-view/PhotoBox.d.ts +22 -0
  6. package/esm/components/react-photo-view/PhotoBox.js +302 -0
  7. package/esm/components/react-photo-view/PhotoPage.d.ts +9 -0
  8. package/esm/components/react-photo-view/PhotoPage.js +77 -0
  9. package/esm/components/react-photo-view/PhotoProvider.d.ts +14 -0
  10. package/esm/components/react-photo-view/PhotoProvider.js +98 -0
  11. package/esm/components/react-photo-view/PhotoSlider.css +125 -0
  12. package/esm/components/react-photo-view/PhotoSlider.d.ts +12 -0
  13. package/esm/components/react-photo-view/PhotoSlider.js +262 -0
  14. package/esm/components/react-photo-view/PhotoView.d.ts +30 -0
  15. package/esm/components/react-photo-view/PhotoView.js +48 -0
  16. package/esm/components/react-photo-view/components/ArrowLeft.d.ts +3 -0
  17. package/esm/components/react-photo-view/components/ArrowLeft.js +18 -0
  18. package/esm/components/react-photo-view/components/ArrowRight.d.ts +3 -0
  19. package/esm/components/react-photo-view/components/ArrowRight.js +18 -0
  20. package/esm/components/react-photo-view/components/CloseIcon.d.ts +3 -0
  21. package/esm/components/react-photo-view/components/CloseIcon.js +16 -0
  22. package/esm/components/react-photo-view/components/PreventScroll.d.ts +1 -0
  23. package/esm/components/react-photo-view/components/PreventScroll.js +12 -0
  24. package/esm/components/react-photo-view/components/SlidePortal.css +10 -0
  25. package/esm/components/react-photo-view/components/SlidePortal.d.ts +7 -0
  26. package/esm/components/react-photo-view/components/SlidePortal.js +30 -0
  27. package/esm/components/react-photo-view/components/Spinner.css +23 -0
  28. package/esm/components/react-photo-view/components/Spinner.d.ts +4 -0
  29. package/esm/components/react-photo-view/components/Spinner.js +29 -0
  30. package/esm/components/react-photo-view/hooks/useAdjacentImages.d.ts +5 -0
  31. package/esm/components/react-photo-view/hooks/useAdjacentImages.js +14 -0
  32. package/esm/components/react-photo-view/hooks/useAnimationOrigin.d.ts +6 -0
  33. package/esm/components/react-photo-view/hooks/useAnimationOrigin.js +72 -0
  34. package/esm/components/react-photo-view/hooks/useAnimationPosition.d.ts +2 -0
  35. package/esm/components/react-photo-view/hooks/useAnimationPosition.js +28 -0
  36. package/esm/components/react-photo-view/hooks/useAnimationVisible.d.ts +6 -0
  37. package/esm/components/react-photo-view/hooks/useAnimationVisible.js +49 -0
  38. package/esm/components/react-photo-view/hooks/useContinuousTap.d.ts +8 -0
  39. package/esm/components/react-photo-view/hooks/useContinuousTap.js +36 -0
  40. package/esm/components/react-photo-view/hooks/useDebounceCallback.d.ts +10 -0
  41. package/esm/components/react-photo-view/hooks/useDebounceCallback.js +48 -0
  42. package/esm/components/react-photo-view/hooks/useEventListener.d.ts +1 -0
  43. package/esm/components/react-photo-view/hooks/useEventListener.js +18 -0
  44. package/esm/components/react-photo-view/hooks/useForkedVariable.d.ts +5 -0
  45. package/esm/components/react-photo-view/hooks/useForkedVariable.js +17 -0
  46. package/esm/components/react-photo-view/hooks/useInitial.d.ts +1 -0
  47. package/esm/components/react-photo-view/hooks/useInitial.js +9 -0
  48. package/esm/components/react-photo-view/hooks/useIsomorphicLayoutEffect.d.ts +3 -0
  49. package/esm/components/react-photo-view/hooks/useIsomorphicLayoutEffect.js +3 -0
  50. package/esm/components/react-photo-view/hooks/useMethods.d.ts +4 -0
  51. package/esm/components/react-photo-view/hooks/useMethods.js +35 -0
  52. package/esm/components/react-photo-view/hooks/useMountedRef.d.ts +3 -0
  53. package/esm/components/react-photo-view/hooks/useMountedRef.js +12 -0
  54. package/esm/components/react-photo-view/hooks/useScrollPosition.d.ts +4 -0
  55. package/esm/components/react-photo-view/hooks/useScrollPosition.js +157 -0
  56. package/esm/components/react-photo-view/hooks/useSetState.d.ts +2 -0
  57. package/esm/components/react-photo-view/hooks/useSetState.js +15 -0
  58. package/esm/components/react-photo-view/hooks/useTargetScale.d.ts +4 -0
  59. package/esm/components/react-photo-view/hooks/useTargetScale.js +70 -0
  60. package/esm/components/react-photo-view/index.d.ts +4 -0
  61. package/esm/components/react-photo-view/index.js +4 -0
  62. package/esm/components/react-photo-view/photo-context.d.ts +11 -0
  63. package/esm/components/react-photo-view/photo-context.js +2 -0
  64. package/esm/components/react-photo-view/types.d.ts +196 -0
  65. package/esm/components/react-photo-view/types.js +1 -0
  66. package/esm/components/react-photo-view/utils/edgeHandle.d.ts +15 -0
  67. package/esm/components/react-photo-view/utils/edgeHandle.js +40 -0
  68. package/esm/components/react-photo-view/utils/getMultipleTouchPosition.d.ts +5 -0
  69. package/esm/components/react-photo-view/utils/getMultipleTouchPosition.js +11 -0
  70. package/esm/components/react-photo-view/utils/getPositionOnMoveOrScale.d.ts +9 -0
  71. package/esm/components/react-photo-view/utils/getPositionOnMoveOrScale.js +31 -0
  72. package/esm/components/react-photo-view/utils/getRotateSize.d.ts +4 -0
  73. package/esm/components/react-photo-view/utils/getRotateSize.js +11 -0
  74. package/esm/components/react-photo-view/utils/getSuitableImageSize.d.ts +10 -0
  75. package/esm/components/react-photo-view/utils/getSuitableImageSize.js +42 -0
  76. package/esm/components/react-photo-view/utils/isTouchDevice.d.ts +5 -0
  77. package/esm/components/react-photo-view/utils/isTouchDevice.js +5 -0
  78. package/esm/components/react-photo-view/utils/limitTarget.d.ts +5 -0
  79. package/esm/components/react-photo-view/utils/limitTarget.js +12 -0
  80. package/esm/components/react-photo-view/variables.d.ts +48 -0
  81. package/esm/components/react-photo-view/variables.js +48 -0
  82. package/esm/constants/ai-question.d.ts +9 -0
  83. package/esm/constants/ai-question.js +33 -4
  84. package/esm/enum/ai-question.d.ts +5 -2
  85. package/esm/enum/ai-question.js +3 -0
  86. package/esm/modules/ai-ability/Root.js +15 -4
  87. package/esm/modules/ai-ability-select/Root.js +2 -2
  88. package/esm/modules/ai-ability-select/interface.d.ts +1 -0
  89. package/esm/modules/ai-question/components/BootVideo/index.js +1 -1
  90. package/esm/modules/ai-question/components/QuestionModel/Item.js +14 -9
  91. package/esm/modules/ai-question/components/QuestionTemplate/AiEvaluation.js +10 -5
  92. package/esm/modules/ai-question/components/QuestionUpdate/Chioce.d.ts +17 -0
  93. package/esm/modules/ai-question/components/QuestionUpdate/Chioce.js +96 -0
  94. package/esm/modules/ai-question/components/QuestionUpdate/Form.js +42 -12
  95. package/esm/modules/ai-question/components/QuestionUpdate/RandomQuestion.js +14 -4
  96. package/esm/modules/ai-question/components/QuestionUpdate/const.js +4 -0
  97. package/esm/modules/ai-question/components/QuestionUpdate/index.js +12 -14
  98. package/esm/modules/ai-question/components/QuestionUpdate/interface.d.ts +8 -0
  99. package/esm/modules/ai-question/components/QuestionUpdate/styled.d.ts +15 -0
  100. package/esm/modules/ai-question/components/QuestionUpdate/styled.js +53 -1
  101. package/esm/modules/ai-report/components/ScoreReport/Score.js +4 -1
  102. package/esm/modules/ai-report/components/VideoQuestion/BodyImages.d.ts +7 -0
  103. package/esm/modules/ai-report/components/VideoQuestion/BodyImages.js +40 -0
  104. package/esm/modules/ai-report/components/VideoQuestion/QuestionItem.js +5 -3
  105. package/esm/modules/ai-report/components/VideoQuestion/SingleChoice.d.ts +8 -0
  106. package/esm/modules/ai-report/components/VideoQuestion/SingleChoice.js +25 -0
  107. package/esm/modules/ai-report/components/VideoQuestion/styled.d.ts +1 -0
  108. package/esm/modules/ai-report/components/VideoQuestion/styled.js +7 -1
  109. package/esm/modules/ai-report/interface.d.ts +19 -0
  110. package/esm/services/ai-ability.d.ts +1 -1
  111. package/esm/services/ai-ability.js +1 -1
  112. package/lib/components/react-photo-view/Photo.css +14 -0
  113. package/lib/components/react-photo-view/Photo.d.ts +18 -0
  114. package/lib/components/react-photo-view/Photo.js +60 -0
  115. package/lib/components/react-photo-view/PhotoBox.css +18 -0
  116. package/lib/components/react-photo-view/PhotoBox.d.ts +22 -0
  117. package/lib/components/react-photo-view/PhotoBox.js +308 -0
  118. package/lib/components/react-photo-view/PhotoPage.d.ts +9 -0
  119. package/lib/components/react-photo-view/PhotoPage.js +79 -0
  120. package/lib/components/react-photo-view/PhotoProvider.d.ts +14 -0
  121. package/lib/components/react-photo-view/PhotoProvider.js +104 -0
  122. package/lib/components/react-photo-view/PhotoSlider.css +125 -0
  123. package/lib/components/react-photo-view/PhotoSlider.d.ts +12 -0
  124. package/lib/components/react-photo-view/PhotoSlider.js +268 -0
  125. package/lib/components/react-photo-view/PhotoView.d.ts +30 -0
  126. package/lib/components/react-photo-view/PhotoView.js +53 -0
  127. package/lib/components/react-photo-view/components/ArrowLeft.d.ts +3 -0
  128. package/lib/components/react-photo-view/components/ArrowLeft.js +20 -0
  129. package/lib/components/react-photo-view/components/ArrowRight.d.ts +3 -0
  130. package/lib/components/react-photo-view/components/ArrowRight.js +20 -0
  131. package/lib/components/react-photo-view/components/CloseIcon.d.ts +3 -0
  132. package/lib/components/react-photo-view/components/CloseIcon.js +18 -0
  133. package/lib/components/react-photo-view/components/PreventScroll.d.ts +1 -0
  134. package/lib/components/react-photo-view/components/PreventScroll.js +15 -0
  135. package/lib/components/react-photo-view/components/SlidePortal.css +10 -0
  136. package/lib/components/react-photo-view/components/SlidePortal.d.ts +7 -0
  137. package/lib/components/react-photo-view/components/SlidePortal.js +32 -0
  138. package/lib/components/react-photo-view/components/Spinner.css +23 -0
  139. package/lib/components/react-photo-view/components/Spinner.d.ts +4 -0
  140. package/lib/components/react-photo-view/components/Spinner.js +31 -0
  141. package/lib/components/react-photo-view/hooks/useAdjacentImages.d.ts +5 -0
  142. package/lib/components/react-photo-view/hooks/useAdjacentImages.js +17 -0
  143. package/lib/components/react-photo-view/hooks/useAnimationOrigin.d.ts +6 -0
  144. package/lib/components/react-photo-view/hooks/useAnimationOrigin.js +78 -0
  145. package/lib/components/react-photo-view/hooks/useAnimationPosition.d.ts +2 -0
  146. package/lib/components/react-photo-view/hooks/useAnimationPosition.js +34 -0
  147. package/lib/components/react-photo-view/hooks/useAnimationVisible.d.ts +6 -0
  148. package/lib/components/react-photo-view/hooks/useAnimationVisible.js +55 -0
  149. package/lib/components/react-photo-view/hooks/useContinuousTap.d.ts +8 -0
  150. package/lib/components/react-photo-view/hooks/useContinuousTap.js +42 -0
  151. package/lib/components/react-photo-view/hooks/useDebounceCallback.d.ts +10 -0
  152. package/lib/components/react-photo-view/hooks/useDebounceCallback.js +51 -0
  153. package/lib/components/react-photo-view/hooks/useEventListener.d.ts +1 -0
  154. package/lib/components/react-photo-view/hooks/useEventListener.js +21 -0
  155. package/lib/components/react-photo-view/hooks/useForkedVariable.d.ts +5 -0
  156. package/lib/components/react-photo-view/hooks/useForkedVariable.js +20 -0
  157. package/lib/components/react-photo-view/hooks/useInitial.d.ts +1 -0
  158. package/lib/components/react-photo-view/hooks/useInitial.js +12 -0
  159. package/lib/components/react-photo-view/hooks/useIsomorphicLayoutEffect.d.ts +3 -0
  160. package/lib/components/react-photo-view/hooks/useIsomorphicLayoutEffect.js +5 -0
  161. package/lib/components/react-photo-view/hooks/useMethods.d.ts +4 -0
  162. package/lib/components/react-photo-view/hooks/useMethods.js +38 -0
  163. package/lib/components/react-photo-view/hooks/useMountedRef.d.ts +3 -0
  164. package/lib/components/react-photo-view/hooks/useMountedRef.js +14 -0
  165. package/lib/components/react-photo-view/hooks/useScrollPosition.d.ts +4 -0
  166. package/lib/components/react-photo-view/hooks/useScrollPosition.js +163 -0
  167. package/lib/components/react-photo-view/hooks/useSetState.d.ts +2 -0
  168. package/lib/components/react-photo-view/hooks/useSetState.js +18 -0
  169. package/lib/components/react-photo-view/hooks/useTargetScale.d.ts +4 -0
  170. package/lib/components/react-photo-view/hooks/useTargetScale.js +76 -0
  171. package/lib/components/react-photo-view/index.d.ts +4 -0
  172. package/lib/components/react-photo-view/index.js +12 -0
  173. package/lib/components/react-photo-view/photo-context.d.ts +11 -0
  174. package/lib/components/react-photo-view/photo-context.js +4 -0
  175. package/lib/components/react-photo-view/types.d.ts +196 -0
  176. package/lib/components/react-photo-view/types.js +2 -0
  177. package/lib/components/react-photo-view/utils/edgeHandle.d.ts +15 -0
  178. package/lib/components/react-photo-view/utils/edgeHandle.js +45 -0
  179. package/lib/components/react-photo-view/utils/getMultipleTouchPosition.d.ts +5 -0
  180. package/lib/components/react-photo-view/utils/getMultipleTouchPosition.js +14 -0
  181. package/lib/components/react-photo-view/utils/getPositionOnMoveOrScale.d.ts +9 -0
  182. package/lib/components/react-photo-view/utils/getPositionOnMoveOrScale.js +34 -0
  183. package/lib/components/react-photo-view/utils/getRotateSize.d.ts +4 -0
  184. package/lib/components/react-photo-view/utils/getRotateSize.js +14 -0
  185. package/lib/components/react-photo-view/utils/getSuitableImageSize.d.ts +10 -0
  186. package/lib/components/react-photo-view/utils/getSuitableImageSize.js +48 -0
  187. package/lib/components/react-photo-view/utils/isTouchDevice.d.ts +5 -0
  188. package/lib/components/react-photo-view/utils/isTouchDevice.js +7 -0
  189. package/lib/components/react-photo-view/utils/limitTarget.d.ts +5 -0
  190. package/lib/components/react-photo-view/utils/limitTarget.js +17 -0
  191. package/lib/components/react-photo-view/variables.d.ts +48 -0
  192. package/lib/components/react-photo-view/variables.js +51 -0
  193. package/lib/constants/ai-question.d.ts +9 -0
  194. package/lib/constants/ai-question.js +34 -5
  195. package/lib/enum/ai-question.d.ts +5 -2
  196. package/lib/enum/ai-question.js +3 -0
  197. package/lib/modules/ai-ability/Root.js +15 -4
  198. package/lib/modules/ai-ability-select/Root.js +2 -2
  199. package/lib/modules/ai-ability-select/interface.d.ts +1 -0
  200. package/lib/modules/ai-question/components/BootVideo/index.js +1 -1
  201. package/lib/modules/ai-question/components/QuestionModel/Item.js +11 -6
  202. package/lib/modules/ai-question/components/QuestionTemplate/AiEvaluation.js +8 -3
  203. package/lib/modules/ai-question/components/QuestionUpdate/Chioce.d.ts +17 -0
  204. package/lib/modules/ai-question/components/QuestionUpdate/Chioce.js +103 -0
  205. package/lib/modules/ai-question/components/QuestionUpdate/Form.js +40 -10
  206. package/lib/modules/ai-question/components/QuestionUpdate/RandomQuestion.js +12 -2
  207. package/lib/modules/ai-question/components/QuestionUpdate/const.js +4 -0
  208. package/lib/modules/ai-question/components/QuestionUpdate/index.js +11 -13
  209. package/lib/modules/ai-question/components/QuestionUpdate/interface.d.ts +8 -0
  210. package/lib/modules/ai-question/components/QuestionUpdate/styled.d.ts +15 -0
  211. package/lib/modules/ai-question/components/QuestionUpdate/styled.js +53 -1
  212. package/lib/modules/ai-report/components/ScoreReport/Score.js +4 -1
  213. package/lib/modules/ai-report/components/VideoQuestion/BodyImages.d.ts +7 -0
  214. package/lib/modules/ai-report/components/VideoQuestion/BodyImages.js +45 -0
  215. package/lib/modules/ai-report/components/VideoQuestion/QuestionItem.js +4 -2
  216. package/lib/modules/ai-report/components/VideoQuestion/SingleChoice.d.ts +8 -0
  217. package/lib/modules/ai-report/components/VideoQuestion/SingleChoice.js +27 -0
  218. package/lib/modules/ai-report/components/VideoQuestion/styled.d.ts +1 -0
  219. package/lib/modules/ai-report/components/VideoQuestion/styled.js +8 -2
  220. package/lib/modules/ai-report/interface.d.ts +19 -0
  221. package/lib/services/ai-ability.d.ts +1 -1
  222. package/lib/services/ai-ability.js +1 -1
  223. package/package.json +2 -2
@@ -0,0 +1,308 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ var jsx_runtime_1 = require("react/jsx-runtime");
18
+ var react_1 = require("react");
19
+ var useAnimationPosition_1 = __importDefault(require("./hooks/useAnimationPosition"));
20
+ var useContinuousTap_1 = __importDefault(require("./hooks/useContinuousTap"));
21
+ var useDebounceCallback_1 = __importDefault(require("./hooks/useDebounceCallback"));
22
+ var useEventListener_1 = __importDefault(require("./hooks/useEventListener"));
23
+ var useIsomorphicLayoutEffect_1 = __importDefault(require("./hooks/useIsomorphicLayoutEffect"));
24
+ var useMethods_1 = __importDefault(require("./hooks/useMethods"));
25
+ var useMountedRef_1 = __importDefault(require("./hooks/useMountedRef"));
26
+ var useScrollPosition_1 = __importDefault(require("./hooks/useScrollPosition"));
27
+ var useSetState_1 = __importDefault(require("./hooks/useSetState"));
28
+ var Photo_1 = __importDefault(require("./Photo"));
29
+ require("./PhotoBox.css");
30
+ var edgeHandle_1 = require("./utils/edgeHandle");
31
+ var getMultipleTouchPosition_1 = __importDefault(require("./utils/getMultipleTouchPosition"));
32
+ var getPositionOnMoveOrScale_1 = __importDefault(require("./utils/getPositionOnMoveOrScale"));
33
+ var getRotateSize_1 = __importDefault(require("./utils/getRotateSize"));
34
+ var getSuitableImageSize_1 = __importDefault(require("./utils/getSuitableImageSize"));
35
+ var isTouchDevice_1 = __importDefault(require("./utils/isTouchDevice"));
36
+ var limitTarget_1 = require("./utils/limitTarget");
37
+ var variables_1 = require("./variables");
38
+ var initialState = {
39
+ // 真实宽度
40
+ naturalWidth: undefined,
41
+ // 真实高度
42
+ naturalHeight: undefined,
43
+ // 宽度
44
+ width: undefined,
45
+ // 高度
46
+ height: undefined,
47
+ // 加载成功状态
48
+ loaded: undefined,
49
+ // 破碎状态
50
+ broken: false,
51
+ // 图片 X 偏移量
52
+ x: 0,
53
+ // 图片 y 偏移量
54
+ y: 0,
55
+ // 图片处于触摸的状态
56
+ touched: false,
57
+ // 背景处于触摸状态
58
+ maskTouched: false,
59
+ // 旋转状态
60
+ rotate: 0,
61
+ // 放大缩小
62
+ scale: 1,
63
+ // 触摸开始时 x 原始坐标
64
+ CX: 0,
65
+ // 触摸开始时 y 原始坐标
66
+ CY: 0,
67
+ // 触摸开始时图片 x 偏移量
68
+ lastX: 0,
69
+ // 触摸开始时图片 y 偏移量
70
+ lastY: 0,
71
+ // 上一个触摸状态 x 原始坐标
72
+ lastCX: 0,
73
+ // 上一个触摸状态 y 原始坐标
74
+ lastCY: 0,
75
+ // 上一个触摸状态的 scale
76
+ lastScale: 1,
77
+ // 触摸开始时时间
78
+ touchTime: 0,
79
+ // 多指触控间距
80
+ touchLength: 0,
81
+ // 是否暂停 transition
82
+ pause: true,
83
+ // 停止 Raf
84
+ stopRaf: true,
85
+ // 当前边缘触发状态
86
+ reach: undefined,
87
+ };
88
+ function PhotoBox(_a) {
89
+ var _b = _a.item, src = _b.src, render = _b.render, _c = _b.width, customWidth = _c === void 0 ? 0 : _c, _d = _b.height, customHeight = _d === void 0 ? 0 : _d, originRef = _b.originRef, visible = _a.visible, speed = _a.speed, easing = _a.easing, wrapClassName = _a.wrapClassName, className = _a.className, style = _a.style, loadingElement = _a.loadingElement, brokenElement = _a.brokenElement, onPhotoTap = _a.onPhotoTap, onMaskTap = _a.onMaskTap, onReachMove = _a.onReachMove, onReachUp = _a.onReachUp, onPhotoResize = _a.onPhotoResize, isActive = _a.isActive, expose = _a.expose;
90
+ var _e = (0, useSetState_1.default)(initialState), state = _e[0], updateState = _e[1];
91
+ var initialTouchRef = (0, react_1.useRef)(0);
92
+ var mounted = (0, useMountedRef_1.default)();
93
+ var _f = state.naturalWidth, naturalWidth = _f === void 0 ? customWidth : _f, _g = state.naturalHeight, naturalHeight = _g === void 0 ? customHeight : _g, _h = state.width, width = _h === void 0 ? customWidth : _h, _j = state.height, height = _j === void 0 ? customHeight : _j, _k = state.loaded, loaded = _k === void 0 ? !src : _k, broken = state.broken, x = state.x, y = state.y, touched = state.touched, stopRaf = state.stopRaf, maskTouched = state.maskTouched, rotate = state.rotate, scale = state.scale, CX = state.CX, CY = state.CY, lastX = state.lastX, lastY = state.lastY, lastCX = state.lastCX, lastCY = state.lastCY, lastScale = state.lastScale, touchTime = state.touchTime, touchLength = state.touchLength, pause = state.pause, reach = state.reach;
94
+ var fn = (0, useMethods_1.default)({
95
+ onScale: function (current) { return onScale((0, limitTarget_1.limitScale)(current)); },
96
+ onRotate: function (current) {
97
+ if (rotate !== current) {
98
+ expose({ rotate: current });
99
+ updateState(__assign({ rotate: current }, (0, getSuitableImageSize_1.default)(naturalWidth, naturalHeight, current)));
100
+ }
101
+ },
102
+ });
103
+ // 默认为屏幕中心缩放
104
+ function onScale(current, clientX, clientY) {
105
+ if (scale !== current) {
106
+ expose({ scale: current });
107
+ updateState(__assign(__assign({ scale: current }, (0, getPositionOnMoveOrScale_1.default)(x, y, width, height, scale, current, clientX, clientY)), (current <= 1 && { x: 0, y: 0 })));
108
+ }
109
+ }
110
+ var handleMove = (0, useDebounceCallback_1.default)(function (nextClientX, nextClientY, currentTouchLength) {
111
+ if (currentTouchLength === void 0) { currentTouchLength = 0; }
112
+ if ((touched || maskTouched) && isActive) {
113
+ // 通过旋转调换宽高
114
+ var _a = (0, getRotateSize_1.default)(rotate, width, height), currentWidth_1 = _a[0], currentHeight_1 = _a[1];
115
+ // 单指最小缩放下,以初始移动距离来判断意图
116
+ if (currentTouchLength === 0 && initialTouchRef.current === 0) {
117
+ var isStillX = Math.abs(nextClientX - CX) <= variables_1.minStartTouchOffset;
118
+ var isStillY = Math.abs(nextClientY - CY) <= variables_1.minStartTouchOffset;
119
+ // 初始移动距离不足
120
+ if (isStillX && isStillY) {
121
+ // 方向记录上次移动距离,以便平滑过渡
122
+ updateState({ lastCX: nextClientX, lastCY: nextClientY });
123
+ return;
124
+ }
125
+ // 设置响应状态
126
+ initialTouchRef.current = !isStillX ? 1 : nextClientY > CY ? 3 : 2;
127
+ }
128
+ var offsetX = nextClientX - lastCX;
129
+ var offsetY = nextClientY - lastCY;
130
+ // 边缘触发状态
131
+ var currentReach = undefined;
132
+ if (currentTouchLength === 0) {
133
+ // 边缘超出状态
134
+ var horizontalCloseEdge = (0, edgeHandle_1.computePositionEdge)(offsetX + lastX, scale, currentWidth_1, window.innerWidth)[0];
135
+ var verticalCloseEdge = (0, edgeHandle_1.computePositionEdge)(offsetY + lastY, scale, currentHeight_1, window.innerHeight)[0];
136
+ // 边缘触发检测
137
+ currentReach = (0, edgeHandle_1.getReachType)(initialTouchRef.current, horizontalCloseEdge, verticalCloseEdge, reach);
138
+ // 接触边缘
139
+ if (currentReach !== undefined) {
140
+ onReachMove(currentReach, nextClientX, nextClientY, scale);
141
+ }
142
+ }
143
+ // 横向边缘触发、背景触发禁用当前滑动
144
+ if (currentReach === 'x' || maskTouched) {
145
+ updateState({ reach: 'x' });
146
+ return;
147
+ }
148
+ // 目标倍数
149
+ var toScale = (0, limitTarget_1.limitScale)(scale + ((currentTouchLength - touchLength) / 100 / 2) * scale, naturalWidth / width, variables_1.scaleBuffer);
150
+ // 导出变量
151
+ expose({ scale: toScale });
152
+ updateState(__assign({ touchLength: currentTouchLength, reach: currentReach, scale: toScale }, (0, getPositionOnMoveOrScale_1.default)(x, y, width, height, scale, toScale, nextClientX, nextClientY, offsetX, offsetY)));
153
+ }
154
+ }, {
155
+ maxWait: 8,
156
+ });
157
+ function updateRaf(position) {
158
+ if (stopRaf || touched) {
159
+ return false;
160
+ }
161
+ if (mounted.current) {
162
+ // 下拉关闭时可以有动画
163
+ updateState(__assign(__assign({}, position), { pause: visible }));
164
+ }
165
+ return mounted.current;
166
+ }
167
+ var slideToPosition = (0, useScrollPosition_1.default)(function (nextX) { return updateRaf({ x: nextX }); }, function (nextY) { return updateRaf({ y: nextY }); }, function (nextScale) {
168
+ if (mounted.current) {
169
+ expose({ scale: nextScale });
170
+ updateState({ scale: nextScale });
171
+ }
172
+ return !touched && mounted.current;
173
+ });
174
+ var handlePhotoTap = (0, useContinuousTap_1.default)(onPhotoTap, function (currentClientX, currentClientY) {
175
+ if (!reach) {
176
+ // 若图片足够大,则放大适应的倍数
177
+ var endScale = scale !== 1 ? 1 : Math.max(2, naturalWidth / width);
178
+ onScale(endScale, currentClientX, currentClientY);
179
+ }
180
+ });
181
+ function handleUp(nextClientX, nextClientY) {
182
+ // 重置响应状态
183
+ initialTouchRef.current = 0;
184
+ if ((touched || maskTouched) && isActive) {
185
+ updateState({
186
+ touched: false,
187
+ maskTouched: false,
188
+ pause: false,
189
+ stopRaf: false,
190
+ reach: undefined,
191
+ });
192
+ var safeScale = (0, limitTarget_1.limitScale)(scale, naturalWidth / width);
193
+ // Go
194
+ slideToPosition(x, y, lastX, lastY, width, height, scale, safeScale, lastScale, rotate, touchTime);
195
+ onReachUp(nextClientX, nextClientY);
196
+ // 触发 Tap 事件
197
+ if (CX === nextClientX && CY === nextClientY) {
198
+ if (touched) {
199
+ handlePhotoTap(nextClientX, nextClientY);
200
+ return;
201
+ }
202
+ if (maskTouched) {
203
+ onMaskTap(nextClientX, nextClientY);
204
+ }
205
+ }
206
+ }
207
+ }
208
+ (0, useEventListener_1.default)(isTouchDevice_1.default ? undefined : 'mousemove', function (e) {
209
+ e.preventDefault();
210
+ handleMove(e.clientX, e.clientY);
211
+ });
212
+ (0, useEventListener_1.default)(isTouchDevice_1.default ? undefined : 'mouseup', function (e) {
213
+ handleUp(e.clientX, e.clientY);
214
+ });
215
+ (0, useEventListener_1.default)(isTouchDevice_1.default ? 'touchmove' : undefined, function (e) {
216
+ e.preventDefault();
217
+ var position = (0, getMultipleTouchPosition_1.default)(e);
218
+ handleMove.apply(void 0, position);
219
+ }, { passive: false });
220
+ (0, useEventListener_1.default)(isTouchDevice_1.default ? 'touchend' : undefined, function (_a) {
221
+ var changedTouches = _a.changedTouches;
222
+ var touch = changedTouches[0];
223
+ handleUp(touch.clientX, touch.clientY);
224
+ }, { passive: false });
225
+ (0, useEventListener_1.default)('resize', (0, useDebounceCallback_1.default)(function () {
226
+ if (loaded && !touched) {
227
+ updateState((0, getSuitableImageSize_1.default)(naturalWidth, naturalHeight, rotate));
228
+ onPhotoResize();
229
+ }
230
+ }, { maxWait: 8 }));
231
+ (0, useIsomorphicLayoutEffect_1.default)(function () {
232
+ if (isActive) {
233
+ expose(__assign({ scale: scale, rotate: rotate }, fn));
234
+ }
235
+ }, [isActive]);
236
+ function handlePhotoLoad(params) {
237
+ updateState(__assign(__assign({}, params), (params.loaded && (0, getSuitableImageSize_1.default)(params.naturalWidth || 0, params.naturalHeight || 0, rotate))));
238
+ }
239
+ function handleStart(currentClientX, currentClientY, currentTouchLength) {
240
+ if (currentTouchLength === void 0) { currentTouchLength = 0; }
241
+ updateState({
242
+ touched: true,
243
+ CX: currentClientX,
244
+ CY: currentClientY,
245
+ lastCX: currentClientX,
246
+ lastCY: currentClientY,
247
+ lastX: x,
248
+ lastY: y,
249
+ lastScale: scale,
250
+ touchLength: currentTouchLength,
251
+ touchTime: Date.now(),
252
+ });
253
+ }
254
+ function handleWheel(e) {
255
+ if (!reach) {
256
+ // 限制最大倍数和最小倍数
257
+ var toScale = (0, limitTarget_1.limitScale)(scale - e.deltaY / 100 / 2, naturalWidth / width);
258
+ updateState({ stopRaf: true });
259
+ onScale(toScale, e.clientX, e.clientY);
260
+ }
261
+ }
262
+ function handleMaskStart(e) {
263
+ updateState({
264
+ maskTouched: true,
265
+ CX: e.clientX,
266
+ CY: e.clientY,
267
+ lastX: x,
268
+ lastY: y,
269
+ });
270
+ }
271
+ function handleTouchStart(e) {
272
+ e.stopPropagation();
273
+ handleStart.apply(void 0, (0, getMultipleTouchPosition_1.default)(e));
274
+ }
275
+ function handleMouseDown(e) {
276
+ e.stopPropagation();
277
+ if (e.button === 0) {
278
+ handleStart(e.clientX, e.clientY, 0);
279
+ }
280
+ }
281
+ // 计算位置
282
+ var _l = (0, useAnimationPosition_1.default)(visible, originRef, loaded, x, y, width, height, scale, speed, function (isPause) { return updateState({ pause: isPause }); }), translateX = _l[0], translateY = _l[1], currentWidth = _l[2], currentHeight = _l[3], currentScale = _l[4], opacity = _l[5], easingMode = _l[6], FIT = _l[7];
283
+ // 图片 objectFit 渐变时间
284
+ var transitionLayoutTime = easingMode < 4 ? speed / 2 : easingMode > 4 ? speed : 0;
285
+ var transitionCSS = "transform ".concat(speed, "ms ").concat(easing);
286
+ var attrs = {
287
+ className: className,
288
+ onMouseDown: isTouchDevice_1.default ? undefined : handleMouseDown,
289
+ onTouchStart: isTouchDevice_1.default ? handleTouchStart : undefined,
290
+ onWheel: handleWheel,
291
+ style: {
292
+ width: currentWidth,
293
+ height: currentHeight,
294
+ opacity: opacity,
295
+ objectFit: easingMode === 4 ? undefined : FIT,
296
+ transform: rotate ? "rotate(".concat(rotate, "deg)") : undefined,
297
+ transition:
298
+ // 初始状态无渐变
299
+ easingMode > 2 ? "".concat(transitionCSS, ", opacity ").concat(speed, "ms ease, height ").concat(transitionLayoutTime, "ms ").concat(easing) : undefined,
300
+ },
301
+ };
302
+ return ((0, jsx_runtime_1.jsx)("div", __assign({ className: "PhotoView__PhotoWrap".concat(wrapClassName ? " ".concat(wrapClassName) : ''), style: style, onMouseDown: !isTouchDevice_1.default && isActive ? handleMaskStart : undefined, onTouchStart: isTouchDevice_1.default && isActive ? function (e) { return handleMaskStart(e.touches[0]); } : undefined }, { children: (0, jsx_runtime_1.jsx)("div", __assign({ className: "PhotoView__PhotoBox", style: {
303
+ transform: "matrix(".concat(currentScale, ", 0, 0, ").concat(currentScale, ", ").concat(translateX, ", ").concat(translateY - 107, ")"),
304
+ transition: touched || pause ? undefined : transitionCSS,
305
+ willChange: isActive ? 'transform' : undefined,
306
+ } }, { children: src ? ((0, jsx_runtime_1.jsx)(Photo_1.default, __assign({ src: src, loaded: loaded, broken: broken }, attrs, { onPhotoLoad: handlePhotoLoad, loadingElement: loadingElement, brokenElement: brokenElement }))) : (render && render({ attrs: attrs, scale: currentScale, rotate: rotate })) })) })));
307
+ }
308
+ exports.default = PhotoBox;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { DataType } from './types';
3
+ interface PhotoPageProps {
4
+ images: DataType[];
5
+ index: number;
6
+ onSelected?: (string: any, number: any) => void;
7
+ }
8
+ declare const PhotoPage: React.FC<PhotoPageProps>;
9
+ export default PhotoPage;
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
14
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
15
+ if (ar || !(i in from)) {
16
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
17
+ ar[i] = from[i];
18
+ }
19
+ }
20
+ return to.concat(ar || Array.prototype.slice.call(from));
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ var jsx_runtime_1 = require("react/jsx-runtime");
24
+ var react_1 = require("react");
25
+ var fbm_ui_1 = require("fbm-ui");
26
+ var mui_1 = require("fbm-ui/lib/mui");
27
+ var chunk = function (a, n) { return __spreadArray([], Array(Math.ceil(a.length / n)), true).map(function (_, i) { return a.slice(n * i, n + n * i); }); };
28
+ var IconButton = (0, fbm_ui_1.styled)(fbm_ui_1.Box)(function (_a) {
29
+ var disabled = _a.disabled;
30
+ return ({
31
+ marginTop: -56,
32
+ width: 48,
33
+ height: 48,
34
+ display: 'flex',
35
+ justifyContent: 'center',
36
+ alignItems: 'center',
37
+ color: disabled ? 'RGBA(255, 255, 255, 0.26)' : 'white',
38
+ backgroundColor: disabled ? 'RGBA(0, 0, 0, 0.26)' : 'RGBA(0, 0, 0, 0.56)',
39
+ borderRadius: 24,
40
+ cursor: disabled ? 'default' : 'pointer',
41
+ flexShrink: 0,
42
+ '& .MuiBox-root': {
43
+ backgroundColor: 'transparent',
44
+ },
45
+ });
46
+ });
47
+ var Image = (0, fbm_ui_1.styled)('img')(function (_a) {
48
+ var selected = _a.selected;
49
+ return ({
50
+ width: 96,
51
+ height: 96,
52
+ objectFit: 'cover',
53
+ cursor: 'pointer',
54
+ boxSizing: 'border-box',
55
+ border: "".concat(selected ? 'solid 5px RGB(76, 175, 80) ' : 'none'),
56
+ });
57
+ });
58
+ var PhotoPage = function (_a) {
59
+ var images = _a.images, index = _a.index, onSelected = _a.onSelected;
60
+ var pre = Math.floor((window.innerWidth - 200) / 110);
61
+ var maxPage = Math.ceil(images.length / pre);
62
+ var _b = (0, react_1.useState)(0), page = _b[0], setPage = _b[1];
63
+ var handleNext = function () {
64
+ if (page < maxPage - 1)
65
+ setPage(function (prevPage) { return prevPage + 1; });
66
+ };
67
+ var handleBack = function () {
68
+ if (page > 0)
69
+ setPage(function (prevPage) { return prevPage - 1; });
70
+ };
71
+ (0, react_1.useEffect)(function () {
72
+ setPage(Math.floor(index / pre));
73
+ }, [index, images, pre]);
74
+ return ((0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ sx: { flexGrow: 1, display: 'flex', alignItems: 'center', px: 7 } }, { children: [(0, jsx_runtime_1.jsx)(IconButton, __assign({ onClick: handleBack, disabled: page === 0 }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.KeyboardArrowLeftIcon, {}) })), (0, jsx_runtime_1.jsx)(mui_1.Stack, __assign({ spacing: 1, direction: "row", sx: { height: 150, display: 'flex', justifyContent: 'center', flexGrow: 1, p: 2 } }, { children: chunk(images, pre)[page].map(function (_a, i) {
75
+ var key = _a.key, src = _a.src, title = _a.title;
76
+ return ((0, jsx_runtime_1.jsxs)(mui_1.Stack, __assign({ alignItems: "center", spacing: 1, onClick: function () { return onSelected === null || onSelected === void 0 ? void 0 : onSelected(src, i); } }, { children: [(0, jsx_runtime_1.jsx)(Image, { src: src, selected: key === images[index].key }), (0, jsx_runtime_1.jsx)(fbm_ui_1.Typography, __assign({ sx: { width: 96, lineHeight: '14px', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }, variant: "body2", color: "white" }, { children: title }))] }), key));
77
+ }) })), (0, jsx_runtime_1.jsx)(IconButton, __assign({ onClick: handleNext, disabled: page === maxPage - 1 }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.KeyboardArrowRightIcon, {}) }))] })));
78
+ };
79
+ exports.default = PhotoPage;
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import type { DataType, PhotoProviderBase } from './types';
3
+ export interface PhotoProviderProps extends PhotoProviderBase {
4
+ children: React.ReactNode;
5
+ onIndexChange?: (index: number, state: PhotoProviderState) => void;
6
+ onVisibleChange?: (visible: boolean, index: number, state: PhotoProviderState) => void;
7
+ }
8
+ declare type PhotoProviderState = {
9
+ images: DataType[];
10
+ visible: boolean;
11
+ index: number;
12
+ };
13
+ export default function PhotoProvider({ children, onIndexChange, onVisibleChange, ...restProps }: PhotoProviderProps): JSX.Element;
14
+ export {};
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
24
+ var __importDefault = (this && this.__importDefault) || function (mod) {
25
+ return (mod && mod.__esModule) ? mod : { "default": mod };
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ var jsx_runtime_1 = require("react/jsx-runtime");
29
+ var react_1 = require("react");
30
+ var useMethods_1 = __importDefault(require("./hooks/useMethods"));
31
+ var useSetState_1 = __importDefault(require("./hooks/useSetState"));
32
+ var photo_context_1 = __importDefault(require("./photo-context"));
33
+ var PhotoSlider_1 = __importDefault(require("./PhotoSlider"));
34
+ var initialState = {
35
+ images: [],
36
+ visible: false,
37
+ index: 0,
38
+ };
39
+ function PhotoProvider(_a) {
40
+ var children = _a.children, onIndexChange = _a.onIndexChange, onVisibleChange = _a.onVisibleChange, restProps = __rest(_a, ["children", "onIndexChange", "onVisibleChange"]);
41
+ var _b = (0, useSetState_1.default)(initialState), state = _b[0], updateState = _b[1];
42
+ var uniqueIdRef = (0, react_1.useRef)(0);
43
+ var images = state.images, visible = state.visible, index = state.index;
44
+ var methods = (0, useMethods_1.default)({
45
+ nextId: function () {
46
+ return (uniqueIdRef.current += 1);
47
+ },
48
+ update: function (imageItem) {
49
+ var currentIndex = images.findIndex(function (n) { return n.key === imageItem.key; });
50
+ if (currentIndex > -1) {
51
+ var nextImages = images.slice();
52
+ nextImages.splice(currentIndex, 1, imageItem);
53
+ updateState({
54
+ images: nextImages,
55
+ });
56
+ return;
57
+ }
58
+ updateState(function (prev) { return ({
59
+ images: prev.images.concat(imageItem),
60
+ }); });
61
+ },
62
+ remove: function (key) {
63
+ updateState(function (prev) {
64
+ var nextImages = prev.images.filter(function (item) { return item.key !== key; });
65
+ var nextEndIndex = nextImages.length - 1;
66
+ return {
67
+ images: nextImages,
68
+ index: Math.min(nextEndIndex, index),
69
+ };
70
+ });
71
+ },
72
+ show: function (key) {
73
+ var currentIndex = images.findIndex(function (item) { return item.key === key; });
74
+ updateState({
75
+ visible: true,
76
+ index: currentIndex,
77
+ });
78
+ if (onVisibleChange) {
79
+ onVisibleChange(true, currentIndex, state);
80
+ }
81
+ },
82
+ });
83
+ var fn = (0, useMethods_1.default)({
84
+ close: function () {
85
+ updateState({
86
+ visible: false,
87
+ });
88
+ if (onVisibleChange) {
89
+ onVisibleChange(false, index, state);
90
+ }
91
+ },
92
+ changeIndex: function (nextIndex) {
93
+ updateState({
94
+ index: nextIndex,
95
+ });
96
+ if (onIndexChange) {
97
+ onIndexChange(nextIndex, state);
98
+ }
99
+ },
100
+ });
101
+ var value = (0, react_1.useMemo)(function () { return (__assign(__assign({}, state), methods)); }, [state, methods]);
102
+ return ((0, jsx_runtime_1.jsxs)(photo_context_1.default.Provider, __assign({ value: value }, { children: [children, (0, jsx_runtime_1.jsx)(PhotoSlider_1.default, __assign({ images: images, visible: visible, index: index, onIndexChange: fn.changeIndex, onClose: fn.close }, restProps))] })));
103
+ }
104
+ exports.default = PhotoProvider;
@@ -0,0 +1,125 @@
1
+ @keyframes PhotoView__fade {
2
+ from {
3
+ opacity: 0;
4
+ }
5
+ to {
6
+ opacity: 1;
7
+ }
8
+ }
9
+ .PhotoView-Slider__clean .PhotoView-Slider__BannerWrap,
10
+ .PhotoView-Slider__clean .PhotoView-Slider__ArrowLeft,
11
+ .PhotoView-Slider__clean .PhotoView-Slider__ArrowRight,
12
+ .PhotoView-Slider__clean .PhotoView-Slider__Overlay {
13
+ opacity: 0;
14
+ }
15
+ .PhotoView-Slider__willClose .PhotoView-Slider__BannerWrap:hover {
16
+ opacity: 0;
17
+ }
18
+ .PhotoView-Slider__Backdrop {
19
+ position: absolute;
20
+ top: 0;
21
+ left: 0;
22
+ width: 100%;
23
+ height: 100%;
24
+ background: #000000;
25
+ transition-property: background-color;
26
+ z-index: -1;
27
+ }
28
+ .PhotoView-Slider__fadeIn {
29
+ opacity: 0;
30
+ animation: PhotoView__fade linear both;
31
+ }
32
+ .PhotoView-Slider__fadeOut {
33
+ opacity: 0;
34
+ animation: PhotoView__fade linear both reverse;
35
+ }
36
+ .PhotoView-Slider__BannerWrap {
37
+ position: absolute;
38
+ left: 0;
39
+ top: 0;
40
+ display: flex;
41
+ justify-content: space-between;
42
+ align-items: center;
43
+ width: 100%;
44
+ height: 44px;
45
+ color: white;
46
+ transition: opacity 0.2s ease-out;
47
+ z-index: 20;
48
+ }
49
+ .PhotoView-Slider__BannerWrap:hover {
50
+ opacity: 1;
51
+ }
52
+ .PhotoView-Slider__Counter {
53
+ padding: 0 10px;
54
+ font-size: 14px;
55
+ opacity: 0.75;
56
+ }
57
+ .PhotoView-Slider__BannerRight {
58
+ display: flex;
59
+ align-items: center;
60
+ justify-content: center;
61
+ width: 48px;
62
+ height: 48px;
63
+ z-index: 20;
64
+ cursor: pointer;
65
+ user-select: none;
66
+ border-radius: 24px;
67
+ margin-top: 16px;
68
+ margin-right: 16px;
69
+ background: rgba(0, 0, 0, 0.56);
70
+ }
71
+ .PhotoView-Slider__BannerRight svg {
72
+ box-sizing: content-box;
73
+ padding: 10px;
74
+ width: 24px;
75
+ height: 24px;
76
+ fill: white;
77
+ }
78
+ .PhotoView-Slider__toolbarIcon {
79
+ box-sizing: border-box;
80
+ padding: 10px;
81
+ fill: white;
82
+ opacity: 0.75;
83
+ cursor: pointer;
84
+ transition: opacity 0.2s linear;
85
+ }
86
+ .PhotoView-Slider__toolbarIcon:hover {
87
+ opacity: 1;
88
+ }
89
+ .PhotoView-Slider__ArrowLeft,
90
+ .PhotoView-Slider__ArrowRight {
91
+ position: absolute;
92
+ top: 0;
93
+ bottom: 0;
94
+ display: flex;
95
+ justify-content: center;
96
+ align-items: center;
97
+ width: 56px;
98
+ height: 56px;
99
+ margin: auto;
100
+ opacity: 0.75;
101
+ z-index: 20;
102
+ cursor: pointer;
103
+ user-select: none;
104
+ transition: opacity 0.2s linear;
105
+ border-radius: 28px;
106
+ background: rgba(0, 0, 0, 0.56);
107
+ }
108
+ .PhotoView-Slider__ArrowLeft:hover,
109
+ .PhotoView-Slider__ArrowRight:hover {
110
+ opacity: 1;
111
+ }
112
+ .PhotoView-Slider__ArrowLeft svg,
113
+ .PhotoView-Slider__ArrowRight svg {
114
+ box-sizing: content-box;
115
+ padding: 10px;
116
+ width: 24px;
117
+ height: 24px;
118
+ fill: white;
119
+ }
120
+ .PhotoView-Slider__ArrowLeft {
121
+ left: 24px;
122
+ }
123
+ .PhotoView-Slider__ArrowRight {
124
+ right: 24px;
125
+ }
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import './PhotoSlider.css';
3
+ import type { DataType, PhotoProviderBase } from './types';
4
+ export interface IPhotoSliderProps extends PhotoProviderBase {
5
+ images: DataType[];
6
+ index?: number;
7
+ onIndexChange?: (index: number) => void;
8
+ visible: boolean;
9
+ onClose: (evt?: React.MouseEvent | React.TouchEvent) => void;
10
+ afterClose?: () => void;
11
+ }
12
+ export default function PhotoSlider(props: IPhotoSliderProps): JSX.Element | null;