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

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 (241) 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/AiAnalysis/index.js +4 -1
  90. package/esm/modules/ai-question/components/BootVideo/index.js +1 -1
  91. package/esm/modules/ai-question/components/QuestionModel/Item.js +14 -9
  92. package/esm/modules/ai-question/components/QuestionTemplate/AiEvaluation.js +17 -6
  93. package/esm/modules/ai-question/components/QuestionUpdate/Chioce.d.ts +17 -0
  94. package/esm/modules/ai-question/components/QuestionUpdate/Chioce.js +97 -0
  95. package/esm/modules/ai-question/components/QuestionUpdate/Form.js +37 -12
  96. package/esm/modules/ai-question/components/QuestionUpdate/RandomQuestion.js +14 -4
  97. package/esm/modules/ai-question/components/QuestionUpdate/Score.d.ts +15 -0
  98. package/esm/modules/ai-question/components/QuestionUpdate/Score.js +53 -0
  99. package/esm/modules/ai-question/components/QuestionUpdate/const.js +4 -0
  100. package/esm/modules/ai-question/components/QuestionUpdate/index.js +35 -17
  101. package/esm/modules/ai-question/components/QuestionUpdate/interface.d.ts +10 -0
  102. package/esm/modules/ai-question/components/QuestionUpdate/styled.d.ts +15 -0
  103. package/esm/modules/ai-question/components/QuestionUpdate/styled.js +56 -1
  104. package/esm/modules/ai-report/Root.js +1 -1
  105. package/esm/modules/ai-report/components/ScoreReport/Score.js +4 -1
  106. package/esm/modules/ai-report/components/VideoQuestion/Abilities.js +5 -3
  107. package/esm/modules/ai-report/components/VideoQuestion/BodyImages.d.ts +7 -0
  108. package/esm/modules/ai-report/components/VideoQuestion/BodyImages.js +40 -0
  109. package/esm/modules/ai-report/components/VideoQuestion/QuestionItem.js +9 -4
  110. package/esm/modules/ai-report/components/VideoQuestion/ScoreSlider.js +4 -4
  111. package/esm/modules/ai-report/components/VideoQuestion/SingleChoice.d.ts +8 -0
  112. package/esm/modules/ai-report/components/VideoQuestion/SingleChoice.js +31 -0
  113. package/esm/modules/ai-report/components/VideoQuestion/index.js +1 -1
  114. package/esm/modules/ai-report/components/VideoQuestion/interface.d.ts +2 -0
  115. package/esm/modules/ai-report/components/VideoQuestion/styled.d.ts +1 -0
  116. package/esm/modules/ai-report/components/VideoQuestion/styled.js +7 -1
  117. package/esm/modules/ai-report/interface.d.ts +19 -0
  118. package/esm/services/ai-ability.d.ts +1 -1
  119. package/esm/services/ai-ability.js +1 -1
  120. package/esm/store/ai-question/ai-analysis-store.js +0 -1
  121. package/lib/components/react-photo-view/Photo.css +14 -0
  122. package/lib/components/react-photo-view/Photo.d.ts +18 -0
  123. package/lib/components/react-photo-view/Photo.js +60 -0
  124. package/lib/components/react-photo-view/PhotoBox.css +18 -0
  125. package/lib/components/react-photo-view/PhotoBox.d.ts +22 -0
  126. package/lib/components/react-photo-view/PhotoBox.js +308 -0
  127. package/lib/components/react-photo-view/PhotoPage.d.ts +9 -0
  128. package/lib/components/react-photo-view/PhotoPage.js +79 -0
  129. package/lib/components/react-photo-view/PhotoProvider.d.ts +14 -0
  130. package/lib/components/react-photo-view/PhotoProvider.js +104 -0
  131. package/lib/components/react-photo-view/PhotoSlider.css +125 -0
  132. package/lib/components/react-photo-view/PhotoSlider.d.ts +12 -0
  133. package/lib/components/react-photo-view/PhotoSlider.js +268 -0
  134. package/lib/components/react-photo-view/PhotoView.d.ts +30 -0
  135. package/lib/components/react-photo-view/PhotoView.js +53 -0
  136. package/lib/components/react-photo-view/components/ArrowLeft.d.ts +3 -0
  137. package/lib/components/react-photo-view/components/ArrowLeft.js +20 -0
  138. package/lib/components/react-photo-view/components/ArrowRight.d.ts +3 -0
  139. package/lib/components/react-photo-view/components/ArrowRight.js +20 -0
  140. package/lib/components/react-photo-view/components/CloseIcon.d.ts +3 -0
  141. package/lib/components/react-photo-view/components/CloseIcon.js +18 -0
  142. package/lib/components/react-photo-view/components/PreventScroll.d.ts +1 -0
  143. package/lib/components/react-photo-view/components/PreventScroll.js +15 -0
  144. package/lib/components/react-photo-view/components/SlidePortal.css +10 -0
  145. package/lib/components/react-photo-view/components/SlidePortal.d.ts +7 -0
  146. package/lib/components/react-photo-view/components/SlidePortal.js +32 -0
  147. package/lib/components/react-photo-view/components/Spinner.css +23 -0
  148. package/lib/components/react-photo-view/components/Spinner.d.ts +4 -0
  149. package/lib/components/react-photo-view/components/Spinner.js +31 -0
  150. package/lib/components/react-photo-view/hooks/useAdjacentImages.d.ts +5 -0
  151. package/lib/components/react-photo-view/hooks/useAdjacentImages.js +17 -0
  152. package/lib/components/react-photo-view/hooks/useAnimationOrigin.d.ts +6 -0
  153. package/lib/components/react-photo-view/hooks/useAnimationOrigin.js +78 -0
  154. package/lib/components/react-photo-view/hooks/useAnimationPosition.d.ts +2 -0
  155. package/lib/components/react-photo-view/hooks/useAnimationPosition.js +34 -0
  156. package/lib/components/react-photo-view/hooks/useAnimationVisible.d.ts +6 -0
  157. package/lib/components/react-photo-view/hooks/useAnimationVisible.js +55 -0
  158. package/lib/components/react-photo-view/hooks/useContinuousTap.d.ts +8 -0
  159. package/lib/components/react-photo-view/hooks/useContinuousTap.js +42 -0
  160. package/lib/components/react-photo-view/hooks/useDebounceCallback.d.ts +10 -0
  161. package/lib/components/react-photo-view/hooks/useDebounceCallback.js +51 -0
  162. package/lib/components/react-photo-view/hooks/useEventListener.d.ts +1 -0
  163. package/lib/components/react-photo-view/hooks/useEventListener.js +21 -0
  164. package/lib/components/react-photo-view/hooks/useForkedVariable.d.ts +5 -0
  165. package/lib/components/react-photo-view/hooks/useForkedVariable.js +20 -0
  166. package/lib/components/react-photo-view/hooks/useInitial.d.ts +1 -0
  167. package/lib/components/react-photo-view/hooks/useInitial.js +12 -0
  168. package/lib/components/react-photo-view/hooks/useIsomorphicLayoutEffect.d.ts +3 -0
  169. package/lib/components/react-photo-view/hooks/useIsomorphicLayoutEffect.js +5 -0
  170. package/lib/components/react-photo-view/hooks/useMethods.d.ts +4 -0
  171. package/lib/components/react-photo-view/hooks/useMethods.js +38 -0
  172. package/lib/components/react-photo-view/hooks/useMountedRef.d.ts +3 -0
  173. package/lib/components/react-photo-view/hooks/useMountedRef.js +14 -0
  174. package/lib/components/react-photo-view/hooks/useScrollPosition.d.ts +4 -0
  175. package/lib/components/react-photo-view/hooks/useScrollPosition.js +163 -0
  176. package/lib/components/react-photo-view/hooks/useSetState.d.ts +2 -0
  177. package/lib/components/react-photo-view/hooks/useSetState.js +18 -0
  178. package/lib/components/react-photo-view/hooks/useTargetScale.d.ts +4 -0
  179. package/lib/components/react-photo-view/hooks/useTargetScale.js +76 -0
  180. package/lib/components/react-photo-view/index.d.ts +4 -0
  181. package/lib/components/react-photo-view/index.js +12 -0
  182. package/lib/components/react-photo-view/photo-context.d.ts +11 -0
  183. package/lib/components/react-photo-view/photo-context.js +4 -0
  184. package/lib/components/react-photo-view/types.d.ts +196 -0
  185. package/lib/components/react-photo-view/types.js +2 -0
  186. package/lib/components/react-photo-view/utils/edgeHandle.d.ts +15 -0
  187. package/lib/components/react-photo-view/utils/edgeHandle.js +45 -0
  188. package/lib/components/react-photo-view/utils/getMultipleTouchPosition.d.ts +5 -0
  189. package/lib/components/react-photo-view/utils/getMultipleTouchPosition.js +14 -0
  190. package/lib/components/react-photo-view/utils/getPositionOnMoveOrScale.d.ts +9 -0
  191. package/lib/components/react-photo-view/utils/getPositionOnMoveOrScale.js +34 -0
  192. package/lib/components/react-photo-view/utils/getRotateSize.d.ts +4 -0
  193. package/lib/components/react-photo-view/utils/getRotateSize.js +14 -0
  194. package/lib/components/react-photo-view/utils/getSuitableImageSize.d.ts +10 -0
  195. package/lib/components/react-photo-view/utils/getSuitableImageSize.js +48 -0
  196. package/lib/components/react-photo-view/utils/isTouchDevice.d.ts +5 -0
  197. package/lib/components/react-photo-view/utils/isTouchDevice.js +7 -0
  198. package/lib/components/react-photo-view/utils/limitTarget.d.ts +5 -0
  199. package/lib/components/react-photo-view/utils/limitTarget.js +17 -0
  200. package/lib/components/react-photo-view/variables.d.ts +48 -0
  201. package/lib/components/react-photo-view/variables.js +51 -0
  202. package/lib/constants/ai-question.d.ts +9 -0
  203. package/lib/constants/ai-question.js +34 -5
  204. package/lib/enum/ai-question.d.ts +5 -2
  205. package/lib/enum/ai-question.js +3 -0
  206. package/lib/modules/ai-ability/Root.js +15 -4
  207. package/lib/modules/ai-ability-select/Root.js +2 -2
  208. package/lib/modules/ai-ability-select/interface.d.ts +1 -0
  209. package/lib/modules/ai-question/components/AiAnalysis/index.js +4 -1
  210. package/lib/modules/ai-question/components/BootVideo/index.js +1 -1
  211. package/lib/modules/ai-question/components/QuestionModel/Item.js +11 -6
  212. package/lib/modules/ai-question/components/QuestionTemplate/AiEvaluation.js +15 -4
  213. package/lib/modules/ai-question/components/QuestionUpdate/Chioce.d.ts +17 -0
  214. package/lib/modules/ai-question/components/QuestionUpdate/Chioce.js +104 -0
  215. package/lib/modules/ai-question/components/QuestionUpdate/Form.js +35 -10
  216. package/lib/modules/ai-question/components/QuestionUpdate/RandomQuestion.js +12 -2
  217. package/lib/modules/ai-question/components/QuestionUpdate/Score.d.ts +15 -0
  218. package/lib/modules/ai-question/components/QuestionUpdate/Score.js +57 -0
  219. package/lib/modules/ai-question/components/QuestionUpdate/const.js +4 -0
  220. package/lib/modules/ai-question/components/QuestionUpdate/index.js +34 -16
  221. package/lib/modules/ai-question/components/QuestionUpdate/interface.d.ts +10 -0
  222. package/lib/modules/ai-question/components/QuestionUpdate/styled.d.ts +15 -0
  223. package/lib/modules/ai-question/components/QuestionUpdate/styled.js +56 -1
  224. package/lib/modules/ai-report/Root.js +1 -1
  225. package/lib/modules/ai-report/components/ScoreReport/Score.js +4 -1
  226. package/lib/modules/ai-report/components/VideoQuestion/Abilities.js +5 -3
  227. package/lib/modules/ai-report/components/VideoQuestion/BodyImages.d.ts +7 -0
  228. package/lib/modules/ai-report/components/VideoQuestion/BodyImages.js +45 -0
  229. package/lib/modules/ai-report/components/VideoQuestion/QuestionItem.js +8 -3
  230. package/lib/modules/ai-report/components/VideoQuestion/ScoreSlider.js +4 -4
  231. package/lib/modules/ai-report/components/VideoQuestion/SingleChoice.d.ts +8 -0
  232. package/lib/modules/ai-report/components/VideoQuestion/SingleChoice.js +33 -0
  233. package/lib/modules/ai-report/components/VideoQuestion/index.js +1 -1
  234. package/lib/modules/ai-report/components/VideoQuestion/interface.d.ts +2 -0
  235. package/lib/modules/ai-report/components/VideoQuestion/styled.d.ts +1 -0
  236. package/lib/modules/ai-report/components/VideoQuestion/styled.js +8 -2
  237. package/lib/modules/ai-report/interface.d.ts +19 -0
  238. package/lib/services/ai-ability.d.ts +1 -1
  239. package/lib/services/ai-ability.js +1 -1
  240. package/lib/store/ai-question/ai-analysis-store.js +0 -1
  241. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- export declare const PostQuestionCollectionList: <R>() => import("axios").AxiosPromise<R>;
1
+ export declare const PostQuestionCollectionList: <R>(data: any) => import("axios").AxiosPromise<R>;
2
2
  export declare const PostQuestionCollectionDelete: <R>(token: string) => import("axios").AxiosPromise<R>;
3
3
  interface workPlaceItem {
4
4
  name: string;
@@ -11,7 +11,7 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import { GET, POST } from "../utils/request";
13
13
  // 考察能力列表
14
- export var PostQuestionCollectionList = function () { return POST({ url: '/standard/b/questionCollection/list' }); };
14
+ export var PostQuestionCollectionList = function (data) { return POST({ url: '/standard/b/questionCollection/list', data: data }); };
15
15
  // 删除考察能力
16
16
  export var PostQuestionCollectionDelete = function (token) { return POST({ url: 'standard/b/questionCollection/delete', data: { token: token } }); };
17
17
  export var PostQuestionCollectionUpsert = function (data) {
@@ -72,7 +72,6 @@ export var useAiAnalysisStore = (_a = createStore(function () {
72
72
  ];
73
73
  });
74
74
  var resAiAbilities = update(data, { $splice: $splice });
75
- console.log('resAiAbilities', resAiAbilities);
76
75
  setAiAbilities(resAiAbilities);
77
76
  }, []);
78
77
  /**
@@ -0,0 +1,14 @@
1
+ .PhotoView__Photo {
2
+ max-width: initial;
3
+ cursor: grab;
4
+ }
5
+ .PhotoView__Photo:active {
6
+ cursor: grabbing;
7
+ }
8
+ .PhotoView__icon {
9
+ position: absolute;
10
+ top: 0;
11
+ left: 0;
12
+ display: inline-block;
13
+ transform: translate(-50%, -50%);
14
+ }
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import './Photo.css';
3
+ import type { BrokenElementParams } from './types';
4
+ export interface IPhotoLoadedParams {
5
+ loaded?: boolean;
6
+ naturalWidth?: number;
7
+ naturalHeight?: number;
8
+ broken?: boolean;
9
+ }
10
+ export interface IPhotoProps extends React.HTMLAttributes<HTMLElement> {
11
+ src: string;
12
+ loaded: boolean;
13
+ broken: boolean;
14
+ onPhotoLoad: (params: IPhotoLoadedParams) => void;
15
+ loadingElement?: JSX.Element;
16
+ brokenElement?: JSX.Element | ((photoProps: BrokenElementParams) => JSX.Element);
17
+ }
18
+ export default function Photo({ src, loaded, broken, className, onPhotoLoad, loadingElement, brokenElement, ...restProps }: IPhotoProps): JSX.Element | null;
@@ -0,0 +1,60 @@
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 Spinner_1 = __importDefault(require("./components/Spinner"));
30
+ var useMountedRef_1 = __importDefault(require("./hooks/useMountedRef"));
31
+ require("./Photo.css");
32
+ function Photo(_a) {
33
+ var src = _a.src, loaded = _a.loaded, broken = _a.broken, className = _a.className, onPhotoLoad = _a.onPhotoLoad, loadingElement = _a.loadingElement, brokenElement = _a.brokenElement, restProps = __rest(_a, ["src", "loaded", "broken", "className", "onPhotoLoad", "loadingElement", "brokenElement"]);
34
+ var mountedRef = (0, useMountedRef_1.default)();
35
+ function handleImageLoaded(e) {
36
+ var _a = e.target, naturalWidth = _a.naturalWidth, naturalHeight = _a.naturalHeight;
37
+ if (mountedRef.current) {
38
+ onPhotoLoad({
39
+ loaded: true,
40
+ naturalWidth: naturalWidth,
41
+ naturalHeight: naturalHeight,
42
+ });
43
+ }
44
+ }
45
+ function handleImageBroken() {
46
+ if (mountedRef.current) {
47
+ onPhotoLoad({
48
+ broken: true,
49
+ });
50
+ }
51
+ }
52
+ if (src && !broken) {
53
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("img", __assign({ className: "PhotoView__Photo".concat(className ? " ".concat(className) : ''), src: src, onLoad: handleImageLoaded, onError: handleImageBroken, alt: "" }, restProps)), !loaded && ((0, jsx_runtime_1.jsx)("span", __assign({ className: "PhotoView__icon" }, { children: loadingElement })) || (0, jsx_runtime_1.jsx)(Spinner_1.default, { className: "PhotoView__icon" }))] }));
54
+ }
55
+ if (brokenElement) {
56
+ return (0, jsx_runtime_1.jsx)("span", __assign({ className: "PhotoView__icon" }, { children: typeof brokenElement === 'function' ? brokenElement({ src: src }) : brokenElement }));
57
+ }
58
+ return null;
59
+ }
60
+ exports.default = Photo;
@@ -0,0 +1,18 @@
1
+ .PhotoView__PhotoWrap,
2
+ .PhotoView__PhotoBox {
3
+ position: absolute;
4
+ top: 24px;
5
+ right: 0;
6
+ bottom: 182px;
7
+ left: 0;
8
+ width: 100%;
9
+ touch-action: none;
10
+ direction: ltr;
11
+ }
12
+ .PhotoView__PhotoWrap {
13
+ z-index: 10;
14
+ overflow: hidden;
15
+ }
16
+ .PhotoView__PhotoBox {
17
+ transform-origin: left top;
18
+ }
@@ -0,0 +1,22 @@
1
+ /// <reference types="react" />
2
+ import './PhotoBox.css';
3
+ import type { BrokenElementParams, DataType, ExposedProperties, PhotoTapFunction, ReachFunction, ReachMoveFunction } from './types';
4
+ export interface PhotoBoxProps {
5
+ item: DataType;
6
+ visible: boolean;
7
+ speed: number;
8
+ easing: string;
9
+ wrapClassName?: string;
10
+ className?: string;
11
+ style?: object;
12
+ loadingElement?: JSX.Element;
13
+ brokenElement?: JSX.Element | ((photoProps: BrokenElementParams) => JSX.Element);
14
+ onPhotoTap: PhotoTapFunction;
15
+ onMaskTap: PhotoTapFunction;
16
+ onReachMove: ReachMoveFunction;
17
+ onReachUp: ReachFunction;
18
+ onPhotoResize: () => void;
19
+ expose: (state: ExposedProperties) => void;
20
+ isActive: boolean;
21
+ }
22
+ export default function PhotoBox({ item: { src, render, width: customWidth, height: customHeight, originRef }, visible, speed, easing, wrapClassName, className, style, loadingElement, brokenElement, onPhotoTap, onMaskTap, onReachMove, onReachUp, onPhotoResize, isActive, expose, }: PhotoBoxProps): JSX.Element;
@@ -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 {};