eli-video-interview 1.2.35 → 1.2.36-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/components/Charts/Chart.js +1 -1
- package/esm/components/react-photo-view/Photo.css +14 -0
- package/esm/components/react-photo-view/Photo.d.ts +18 -0
- package/esm/components/react-photo-view/Photo.js +54 -0
- package/esm/components/react-photo-view/PhotoBox.css +18 -0
- package/esm/components/react-photo-view/PhotoBox.d.ts +22 -0
- package/esm/components/react-photo-view/PhotoBox.js +302 -0
- package/esm/components/react-photo-view/PhotoPage.d.ts +9 -0
- package/esm/components/react-photo-view/PhotoPage.js +77 -0
- package/esm/components/react-photo-view/PhotoProvider.d.ts +14 -0
- package/esm/components/react-photo-view/PhotoProvider.js +98 -0
- package/esm/components/react-photo-view/PhotoSlider.css +125 -0
- package/esm/components/react-photo-view/PhotoSlider.d.ts +12 -0
- package/esm/components/react-photo-view/PhotoSlider.js +262 -0
- package/esm/components/react-photo-view/PhotoView.d.ts +30 -0
- package/esm/components/react-photo-view/PhotoView.js +48 -0
- package/esm/components/react-photo-view/components/ArrowLeft.d.ts +3 -0
- package/esm/components/react-photo-view/components/ArrowLeft.js +18 -0
- package/esm/components/react-photo-view/components/ArrowRight.d.ts +3 -0
- package/esm/components/react-photo-view/components/ArrowRight.js +18 -0
- package/esm/components/react-photo-view/components/CloseIcon.d.ts +3 -0
- package/esm/components/react-photo-view/components/CloseIcon.js +16 -0
- package/esm/components/react-photo-view/components/PreventScroll.d.ts +1 -0
- package/esm/components/react-photo-view/components/PreventScroll.js +12 -0
- package/esm/components/react-photo-view/components/SlidePortal.css +10 -0
- package/esm/components/react-photo-view/components/SlidePortal.d.ts +7 -0
- package/esm/components/react-photo-view/components/SlidePortal.js +30 -0
- package/esm/components/react-photo-view/components/Spinner.css +23 -0
- package/esm/components/react-photo-view/components/Spinner.d.ts +4 -0
- package/esm/components/react-photo-view/components/Spinner.js +29 -0
- package/esm/components/react-photo-view/hooks/useAdjacentImages.d.ts +5 -0
- package/esm/components/react-photo-view/hooks/useAdjacentImages.js +14 -0
- package/esm/components/react-photo-view/hooks/useAnimationOrigin.d.ts +6 -0
- package/esm/components/react-photo-view/hooks/useAnimationOrigin.js +72 -0
- package/esm/components/react-photo-view/hooks/useAnimationPosition.d.ts +2 -0
- package/esm/components/react-photo-view/hooks/useAnimationPosition.js +28 -0
- package/esm/components/react-photo-view/hooks/useAnimationVisible.d.ts +6 -0
- package/esm/components/react-photo-view/hooks/useAnimationVisible.js +49 -0
- package/esm/components/react-photo-view/hooks/useContinuousTap.d.ts +8 -0
- package/esm/components/react-photo-view/hooks/useContinuousTap.js +36 -0
- package/esm/components/react-photo-view/hooks/useDebounceCallback.d.ts +10 -0
- package/esm/components/react-photo-view/hooks/useDebounceCallback.js +48 -0
- package/esm/components/react-photo-view/hooks/useEventListener.d.ts +1 -0
- package/esm/components/react-photo-view/hooks/useEventListener.js +18 -0
- package/esm/components/react-photo-view/hooks/useForkedVariable.d.ts +5 -0
- package/esm/components/react-photo-view/hooks/useForkedVariable.js +17 -0
- package/esm/components/react-photo-view/hooks/useInitial.d.ts +1 -0
- package/esm/components/react-photo-view/hooks/useInitial.js +9 -0
- package/esm/components/react-photo-view/hooks/useIsomorphicLayoutEffect.d.ts +3 -0
- package/esm/components/react-photo-view/hooks/useIsomorphicLayoutEffect.js +3 -0
- package/esm/components/react-photo-view/hooks/useMethods.d.ts +4 -0
- package/esm/components/react-photo-view/hooks/useMethods.js +35 -0
- package/esm/components/react-photo-view/hooks/useMountedRef.d.ts +3 -0
- package/esm/components/react-photo-view/hooks/useMountedRef.js +12 -0
- package/esm/components/react-photo-view/hooks/useScrollPosition.d.ts +4 -0
- package/esm/components/react-photo-view/hooks/useScrollPosition.js +157 -0
- package/esm/components/react-photo-view/hooks/useSetState.d.ts +2 -0
- package/esm/components/react-photo-view/hooks/useSetState.js +15 -0
- package/esm/components/react-photo-view/hooks/useTargetScale.d.ts +4 -0
- package/esm/components/react-photo-view/hooks/useTargetScale.js +70 -0
- package/esm/components/react-photo-view/index.d.ts +4 -0
- package/esm/components/react-photo-view/index.js +4 -0
- package/esm/components/react-photo-view/photo-context.d.ts +11 -0
- package/esm/components/react-photo-view/photo-context.js +2 -0
- package/esm/components/react-photo-view/types.d.ts +196 -0
- package/esm/components/react-photo-view/types.js +1 -0
- package/esm/components/react-photo-view/utils/edgeHandle.d.ts +15 -0
- package/esm/components/react-photo-view/utils/edgeHandle.js +40 -0
- package/esm/components/react-photo-view/utils/getMultipleTouchPosition.d.ts +5 -0
- package/esm/components/react-photo-view/utils/getMultipleTouchPosition.js +11 -0
- package/esm/components/react-photo-view/utils/getPositionOnMoveOrScale.d.ts +9 -0
- package/esm/components/react-photo-view/utils/getPositionOnMoveOrScale.js +31 -0
- package/esm/components/react-photo-view/utils/getRotateSize.d.ts +4 -0
- package/esm/components/react-photo-view/utils/getRotateSize.js +11 -0
- package/esm/components/react-photo-view/utils/getSuitableImageSize.d.ts +10 -0
- package/esm/components/react-photo-view/utils/getSuitableImageSize.js +42 -0
- package/esm/components/react-photo-view/utils/isTouchDevice.d.ts +5 -0
- package/esm/components/react-photo-view/utils/isTouchDevice.js +5 -0
- package/esm/components/react-photo-view/utils/limitTarget.d.ts +5 -0
- package/esm/components/react-photo-view/utils/limitTarget.js +12 -0
- package/esm/components/react-photo-view/variables.d.ts +48 -0
- package/esm/components/react-photo-view/variables.js +48 -0
- package/esm/modules/ai-ability/Root.js +12 -3
- package/esm/modules/ai-ability/components/AddAbility/index.js +2 -2
- package/esm/modules/ai-ability/components/UpdateAbility/index.js +2 -2
- package/esm/modules/ai-ability/interface.d.ts +8 -1
- package/esm/modules/ai-ability-select/Root.d.ts +4 -0
- package/esm/modules/ai-ability-select/Root.js +47 -0
- package/esm/modules/ai-ability-select/components/AiAbilityItem/AiAbilityDetail.d.ts +4 -0
- package/esm/modules/ai-ability-select/components/AiAbilityItem/AiAbilityDetail.js +22 -0
- package/esm/modules/ai-ability-select/components/AiAbilityItem/index.d.ts +4 -0
- package/esm/modules/ai-ability-select/components/AiAbilityItem/index.js +42 -0
- package/esm/modules/ai-ability-select/components/AiAbilityItem/interface.d.ts +13 -0
- package/esm/modules/ai-ability-select/components/AiAbilityItem/interface.js +1 -0
- package/esm/modules/ai-ability-select/components/AiAbilityItem/styled.d.ts +2 -0
- package/esm/modules/ai-ability-select/components/AiAbilityItem/styled.js +8 -0
- package/esm/modules/ai-ability-select/components/AiAbilityList/index.d.ts +4 -0
- package/esm/modules/ai-ability-select/components/AiAbilityList/index.js +19 -0
- package/esm/modules/ai-ability-select/components/AiAbilityList/interface.d.ts +4 -0
- package/esm/modules/ai-ability-select/components/AiAbilityList/interface.js +1 -0
- package/esm/modules/ai-ability-select/index.d.ts +4 -0
- package/esm/modules/ai-ability-select/index.js +20 -0
- package/esm/modules/ai-ability-select/interface.d.ts +33 -0
- package/esm/modules/ai-ability-select/interface.js +1 -0
- package/esm/modules/ai-question/Root.d.ts +1 -1
- package/esm/modules/ai-question/Root.js +6 -6
- package/esm/modules/ai-question/components/QuestionModel/AutoCombine.d.ts +4 -0
- package/esm/modules/ai-question/components/QuestionModel/AutoCombine.js +19 -0
- package/esm/modules/ai-question/components/QuestionModel/Interactive.d.ts +3 -0
- package/esm/modules/ai-question/components/QuestionModel/Interactive.js +30 -0
- package/esm/modules/ai-question/components/QuestionUpdate/RandomQuestion.d.ts +4 -0
- package/esm/modules/ai-question/components/QuestionUpdate/RandomQuestion.js +58 -0
- package/esm/modules/ai-question/components/QuestionUpdate/SelectQuestion.d.ts +8 -0
- package/esm/modules/ai-question/components/QuestionUpdate/SelectQuestion.js +62 -0
- package/esm/modules/ai-question/components/QuestionUpdate/VideoVoicePreview.d.ts +6 -0
- package/esm/modules/ai-question/components/QuestionUpdate/VideoVoicePreview.js +47 -0
- package/esm/modules/ai-question/components/QuestionUpdate/VideoVoiceUploader.d.ts +7 -0
- package/esm/modules/ai-question/components/QuestionUpdate/VideoVoiceUploader.js +60 -0
- package/esm/modules/ai-question/components/QuestionUpdate/styled.d.ts +6 -0
- package/esm/modules/ai-question/components/QuestionUpdate/styled.js +52 -0
- package/esm/modules/ai-report/components/ScoreReport/styled.d.ts +1 -1
- package/esm/modules/ai-report/components/VideoQuestion/BodyImages.d.ts +7 -0
- package/esm/modules/ai-report/components/VideoQuestion/BodyImages.js +40 -0
- package/esm/modules/ai-template/Root.js +32 -10
- package/esm/modules/ai-template/components/CapabilityModel/index.js +1 -1
- package/esm/modules/ai-template/components/QuestionList/Item.d.ts +2 -2
- package/esm/modules/ai-template/components/QuestionList/Item.js +28 -7
- package/esm/modules/ai-template/components/QuestionList/index.d.ts +2 -1
- package/esm/modules/ai-template/components/QuestionList/index.js +15 -4
- package/esm/modules/ai-template/components/QuestionList/interface.d.ts +6 -1
- package/esm/modules/ai-template/components/TemplateList/index.js +4 -4
- package/esm/modules/ai-template/components/TemplateList/styled.d.ts +1 -1
- package/esm/modules/ai-template/index.js +2 -2
- package/esm/modules/ai-template/interface.d.ts +2 -0
- package/esm/store/ai-ability-select/question-ability-store.d.ts +21 -0
- package/esm/store/ai-ability-select/question-ability-store.js +21 -0
- package/esm/store/ai-question/interview-room-store.d.ts +20 -0
- package/esm/store/ai-question/interview-room-store.js +21 -0
- package/esm/store/ai-template/global-store.d.ts +3 -0
- package/esm/store/ai-template/global-store.js +3 -3
- package/esm/store/enterprise/enterprise-store.d.ts +29 -0
- package/esm/store/enterprise/enterprise-store.js +13 -0
- package/lib/components/Charts/Chart.js +1 -1
- package/lib/components/react-photo-view/Photo.css +14 -0
- package/lib/components/react-photo-view/Photo.d.ts +18 -0
- package/lib/components/react-photo-view/Photo.js +60 -0
- package/lib/components/react-photo-view/PhotoBox.css +18 -0
- package/lib/components/react-photo-view/PhotoBox.d.ts +22 -0
- package/lib/components/react-photo-view/PhotoBox.js +308 -0
- package/lib/components/react-photo-view/PhotoPage.d.ts +9 -0
- package/lib/components/react-photo-view/PhotoPage.js +79 -0
- package/lib/components/react-photo-view/PhotoProvider.d.ts +14 -0
- package/lib/components/react-photo-view/PhotoProvider.js +104 -0
- package/lib/components/react-photo-view/PhotoSlider.css +125 -0
- package/lib/components/react-photo-view/PhotoSlider.d.ts +12 -0
- package/lib/components/react-photo-view/PhotoSlider.js +268 -0
- package/lib/components/react-photo-view/PhotoView.d.ts +30 -0
- package/lib/components/react-photo-view/PhotoView.js +53 -0
- package/lib/components/react-photo-view/components/ArrowLeft.d.ts +3 -0
- package/lib/components/react-photo-view/components/ArrowLeft.js +20 -0
- package/lib/components/react-photo-view/components/ArrowRight.d.ts +3 -0
- package/lib/components/react-photo-view/components/ArrowRight.js +20 -0
- package/lib/components/react-photo-view/components/CloseIcon.d.ts +3 -0
- package/lib/components/react-photo-view/components/CloseIcon.js +18 -0
- package/lib/components/react-photo-view/components/PreventScroll.d.ts +1 -0
- package/lib/components/react-photo-view/components/PreventScroll.js +15 -0
- package/lib/components/react-photo-view/components/SlidePortal.css +10 -0
- package/lib/components/react-photo-view/components/SlidePortal.d.ts +7 -0
- package/lib/components/react-photo-view/components/SlidePortal.js +32 -0
- package/lib/components/react-photo-view/components/Spinner.css +23 -0
- package/lib/components/react-photo-view/components/Spinner.d.ts +4 -0
- package/lib/components/react-photo-view/components/Spinner.js +31 -0
- package/lib/components/react-photo-view/hooks/useAdjacentImages.d.ts +5 -0
- package/lib/components/react-photo-view/hooks/useAdjacentImages.js +17 -0
- package/lib/components/react-photo-view/hooks/useAnimationOrigin.d.ts +6 -0
- package/lib/components/react-photo-view/hooks/useAnimationOrigin.js +78 -0
- package/lib/components/react-photo-view/hooks/useAnimationPosition.d.ts +2 -0
- package/lib/components/react-photo-view/hooks/useAnimationPosition.js +34 -0
- package/lib/components/react-photo-view/hooks/useAnimationVisible.d.ts +6 -0
- package/lib/components/react-photo-view/hooks/useAnimationVisible.js +55 -0
- package/lib/components/react-photo-view/hooks/useContinuousTap.d.ts +8 -0
- package/lib/components/react-photo-view/hooks/useContinuousTap.js +42 -0
- package/lib/components/react-photo-view/hooks/useDebounceCallback.d.ts +10 -0
- package/lib/components/react-photo-view/hooks/useDebounceCallback.js +51 -0
- package/lib/components/react-photo-view/hooks/useEventListener.d.ts +1 -0
- package/lib/components/react-photo-view/hooks/useEventListener.js +21 -0
- package/lib/components/react-photo-view/hooks/useForkedVariable.d.ts +5 -0
- package/lib/components/react-photo-view/hooks/useForkedVariable.js +20 -0
- package/lib/components/react-photo-view/hooks/useInitial.d.ts +1 -0
- package/lib/components/react-photo-view/hooks/useInitial.js +12 -0
- package/lib/components/react-photo-view/hooks/useIsomorphicLayoutEffect.d.ts +3 -0
- package/lib/components/react-photo-view/hooks/useIsomorphicLayoutEffect.js +5 -0
- package/lib/components/react-photo-view/hooks/useMethods.d.ts +4 -0
- package/lib/components/react-photo-view/hooks/useMethods.js +38 -0
- package/lib/components/react-photo-view/hooks/useMountedRef.d.ts +3 -0
- package/lib/components/react-photo-view/hooks/useMountedRef.js +14 -0
- package/lib/components/react-photo-view/hooks/useScrollPosition.d.ts +4 -0
- package/lib/components/react-photo-view/hooks/useScrollPosition.js +163 -0
- package/lib/components/react-photo-view/hooks/useSetState.d.ts +2 -0
- package/lib/components/react-photo-view/hooks/useSetState.js +18 -0
- package/lib/components/react-photo-view/hooks/useTargetScale.d.ts +4 -0
- package/lib/components/react-photo-view/hooks/useTargetScale.js +76 -0
- package/lib/components/react-photo-view/index.d.ts +4 -0
- package/lib/components/react-photo-view/index.js +12 -0
- package/lib/components/react-photo-view/photo-context.d.ts +11 -0
- package/lib/components/react-photo-view/photo-context.js +4 -0
- package/lib/components/react-photo-view/types.d.ts +196 -0
- package/lib/components/react-photo-view/types.js +2 -0
- package/lib/components/react-photo-view/utils/edgeHandle.d.ts +15 -0
- package/lib/components/react-photo-view/utils/edgeHandle.js +45 -0
- package/lib/components/react-photo-view/utils/getMultipleTouchPosition.d.ts +5 -0
- package/lib/components/react-photo-view/utils/getMultipleTouchPosition.js +14 -0
- package/lib/components/react-photo-view/utils/getPositionOnMoveOrScale.d.ts +9 -0
- package/lib/components/react-photo-view/utils/getPositionOnMoveOrScale.js +34 -0
- package/lib/components/react-photo-view/utils/getRotateSize.d.ts +4 -0
- package/lib/components/react-photo-view/utils/getRotateSize.js +14 -0
- package/lib/components/react-photo-view/utils/getSuitableImageSize.d.ts +10 -0
- package/lib/components/react-photo-view/utils/getSuitableImageSize.js +48 -0
- package/lib/components/react-photo-view/utils/isTouchDevice.d.ts +5 -0
- package/lib/components/react-photo-view/utils/isTouchDevice.js +7 -0
- package/lib/components/react-photo-view/utils/limitTarget.d.ts +5 -0
- package/lib/components/react-photo-view/utils/limitTarget.js +17 -0
- package/lib/components/react-photo-view/variables.d.ts +48 -0
- package/lib/components/react-photo-view/variables.js +51 -0
- package/lib/modules/ai-ability/Root.js +12 -3
- package/lib/modules/ai-ability/components/AddAbility/index.js +2 -2
- package/lib/modules/ai-ability/components/UpdateAbility/index.js +2 -2
- package/lib/modules/ai-ability/interface.d.ts +8 -1
- package/lib/modules/ai-ability-select/Root.d.ts +4 -0
- package/lib/modules/ai-ability-select/Root.js +52 -0
- package/lib/modules/ai-ability-select/components/AiAbilityItem/AiAbilityDetail.d.ts +4 -0
- package/lib/modules/ai-ability-select/components/AiAbilityItem/AiAbilityDetail.js +24 -0
- package/lib/modules/ai-ability-select/components/AiAbilityItem/index.d.ts +4 -0
- package/lib/modules/ai-ability-select/components/AiAbilityItem/index.js +47 -0
- package/lib/modules/ai-ability-select/components/AiAbilityItem/interface.d.ts +13 -0
- package/lib/modules/ai-ability-select/components/AiAbilityItem/interface.js +2 -0
- package/lib/modules/ai-ability-select/components/AiAbilityItem/styled.d.ts +2 -0
- package/lib/modules/ai-ability-select/components/AiAbilityItem/styled.js +11 -0
- package/lib/modules/ai-ability-select/components/AiAbilityList/index.d.ts +4 -0
- package/lib/modules/ai-ability-select/components/AiAbilityList/index.js +24 -0
- package/lib/modules/ai-ability-select/components/AiAbilityList/interface.d.ts +4 -0
- package/lib/modules/ai-ability-select/components/AiAbilityList/interface.js +2 -0
- package/lib/modules/ai-ability-select/index.d.ts +4 -0
- package/lib/modules/ai-ability-select/index.js +25 -0
- package/lib/modules/ai-ability-select/interface.d.ts +33 -0
- package/lib/modules/ai-ability-select/interface.js +2 -0
- package/lib/modules/ai-question/Root.d.ts +1 -1
- package/lib/modules/ai-question/Root.js +6 -6
- package/lib/modules/ai-question/components/QuestionModel/AutoCombine.d.ts +4 -0
- package/lib/modules/ai-question/components/QuestionModel/AutoCombine.js +21 -0
- package/lib/modules/ai-question/components/QuestionModel/Interactive.d.ts +3 -0
- package/lib/modules/ai-question/components/QuestionModel/Interactive.js +35 -0
- package/lib/modules/ai-question/components/QuestionUpdate/RandomQuestion.d.ts +4 -0
- package/lib/modules/ai-question/components/QuestionUpdate/RandomQuestion.js +63 -0
- package/lib/modules/ai-question/components/QuestionUpdate/SelectQuestion.d.ts +8 -0
- package/lib/modules/ai-question/components/QuestionUpdate/SelectQuestion.js +64 -0
- package/lib/modules/ai-question/components/QuestionUpdate/VideoVoicePreview.d.ts +6 -0
- package/lib/modules/ai-question/components/QuestionUpdate/VideoVoicePreview.js +49 -0
- package/lib/modules/ai-question/components/QuestionUpdate/VideoVoiceUploader.d.ts +7 -0
- package/lib/modules/ai-question/components/QuestionUpdate/VideoVoiceUploader.js +62 -0
- package/lib/modules/ai-question/components/QuestionUpdate/styled.d.ts +6 -0
- package/lib/modules/ai-question/components/QuestionUpdate/styled.js +55 -0
- package/lib/modules/ai-report/components/ScoreReport/styled.d.ts +1 -1
- package/lib/modules/ai-report/components/VideoQuestion/BodyImages.d.ts +7 -0
- package/lib/modules/ai-report/components/VideoQuestion/BodyImages.js +45 -0
- package/lib/modules/ai-template/Root.js +32 -10
- package/lib/modules/ai-template/components/CapabilityModel/index.js +1 -1
- package/lib/modules/ai-template/components/QuestionList/Item.d.ts +2 -2
- package/lib/modules/ai-template/components/QuestionList/Item.js +27 -6
- package/lib/modules/ai-template/components/QuestionList/index.d.ts +2 -1
- package/lib/modules/ai-template/components/QuestionList/index.js +15 -4
- package/lib/modules/ai-template/components/QuestionList/interface.d.ts +6 -1
- package/lib/modules/ai-template/components/TemplateList/index.js +4 -4
- package/lib/modules/ai-template/components/TemplateList/styled.d.ts +1 -1
- package/lib/modules/ai-template/index.js +2 -2
- package/lib/modules/ai-template/interface.d.ts +2 -0
- package/lib/store/ai-ability-select/question-ability-store.d.ts +21 -0
- package/lib/store/ai-ability-select/question-ability-store.js +24 -0
- package/lib/store/ai-question/interview-room-store.d.ts +20 -0
- package/lib/store/ai-question/interview-room-store.js +24 -0
- package/lib/store/ai-template/global-store.d.ts +3 -0
- package/lib/store/ai-template/global-store.js +3 -3
- package/lib/store/enterprise/enterprise-store.d.ts +29 -0
- package/lib/store/enterprise/enterprise-store.js +16 -0
- package/package.json +2 -2
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var react_1 = require("react");
|
|
4
|
+
function useInitial(callback) {
|
|
5
|
+
var current = (0, react_1.useRef)({ sign: false, fn: undefined }).current;
|
|
6
|
+
if (!current.sign) {
|
|
7
|
+
current.sign = true;
|
|
8
|
+
current.fn = callback();
|
|
9
|
+
}
|
|
10
|
+
return current.fn;
|
|
11
|
+
}
|
|
12
|
+
exports.default = useInitial;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var react_1 = require("react");
|
|
4
|
+
var isSSR = typeof window === 'undefined' || /ServerSideRendering/.test(navigator && navigator.userAgent);
|
|
5
|
+
exports.default = isSSR ? react_1.useEffect : react_1.useLayoutEffect;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
var react_1 = require("react");
|
|
13
|
+
/**
|
|
14
|
+
* Hook of persistent methods
|
|
15
|
+
*/
|
|
16
|
+
function useMethods(fn) {
|
|
17
|
+
var current = (0, react_1.useRef)({
|
|
18
|
+
fn: fn,
|
|
19
|
+
curr: undefined,
|
|
20
|
+
}).current;
|
|
21
|
+
current.fn = fn;
|
|
22
|
+
if (!current.curr) {
|
|
23
|
+
var curr_1 = Object.create(null);
|
|
24
|
+
Object.keys(fn).forEach(function (key) {
|
|
25
|
+
curr_1[key] = function () {
|
|
26
|
+
var _a;
|
|
27
|
+
var args = [];
|
|
28
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
29
|
+
args[_i] = arguments[_i];
|
|
30
|
+
}
|
|
31
|
+
return (_a = current.fn[key]).call.apply(_a, __spreadArray([current.fn], args, false));
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
current.curr = curr_1;
|
|
35
|
+
}
|
|
36
|
+
return current.curr;
|
|
37
|
+
}
|
|
38
|
+
exports.default = useMethods;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var react_1 = require("react");
|
|
4
|
+
var useMountedRef = function () {
|
|
5
|
+
var mountedRef = (0, react_1.useRef)(false);
|
|
6
|
+
(0, react_1.useEffect)(function () {
|
|
7
|
+
mountedRef.current = true;
|
|
8
|
+
return function () {
|
|
9
|
+
mountedRef.current = false;
|
|
10
|
+
};
|
|
11
|
+
}, []);
|
|
12
|
+
return mountedRef;
|
|
13
|
+
};
|
|
14
|
+
exports.default = useMountedRef;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 物理滚动到具体位置
|
|
3
|
+
*/
|
|
4
|
+
export default function useScrollPosition<C extends (spatial: number) => boolean>(callbackX: C, callbackY: C, callbackS: C): (x: number, y: number, lastX: number, lastY: number, width: number, height: number, scale: number, safeScale: number, lastScale: number, rotate: number, touchedTime: number) => void;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var edgeHandle_1 = require("../utils/edgeHandle");
|
|
7
|
+
var getPositionOnMoveOrScale_1 = __importDefault(require("../utils/getPositionOnMoveOrScale"));
|
|
8
|
+
var getRotateSize_1 = __importDefault(require("../utils/getRotateSize"));
|
|
9
|
+
var variables_1 = require("../variables");
|
|
10
|
+
var useMethods_1 = __importDefault(require("./useMethods"));
|
|
11
|
+
// 触边运动反馈
|
|
12
|
+
var rebound = function (start, bound, callback) {
|
|
13
|
+
return easeOutMove(start, bound, callback, variables_1.defaultSpeed / 4, function (t) { return t; }, function () { return easeOutMove(bound, start, callback); });
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* 物理滚动到具体位置
|
|
17
|
+
*/
|
|
18
|
+
function useScrollPosition(callbackX, callbackY, callbackS) {
|
|
19
|
+
var callback = (0, useMethods_1.default)({
|
|
20
|
+
X: function (spatial) { return callbackX(spatial); },
|
|
21
|
+
Y: function (spatial) { return callbackY(spatial); },
|
|
22
|
+
S: function (spatial) { return callbackS(spatial); },
|
|
23
|
+
});
|
|
24
|
+
return function (x, y, lastX, lastY, width, height, scale, safeScale, lastScale, rotate, touchedTime) {
|
|
25
|
+
var _a = (0, getRotateSize_1.default)(rotate, width, height), currentWidth = _a[0], currentHeight = _a[1];
|
|
26
|
+
// 开始状态下边缘触发状态
|
|
27
|
+
var _b = (0, edgeHandle_1.computePositionEdge)(x, safeScale, currentWidth, window.innerWidth), beginEdgeX = _b[0], beginX = _b[1];
|
|
28
|
+
var _c = (0, edgeHandle_1.computePositionEdge)(y, safeScale, currentHeight, window.innerHeight), beginEdgeY = _c[0], beginY = _c[1];
|
|
29
|
+
var moveTime = Date.now() - touchedTime;
|
|
30
|
+
// 时间过长、超出安全范围的情况下不执行滚动逻辑,恢复安全范围
|
|
31
|
+
if (moveTime >= variables_1.maxTouchTime || safeScale !== scale || Math.abs(lastScale - scale) > 1) {
|
|
32
|
+
// 计算中心缩放点
|
|
33
|
+
var _d = (0, getPositionOnMoveOrScale_1.default)(x, y, width, height, scale, safeScale), nextX = _d.x, nextY = _d.y;
|
|
34
|
+
var targetX = beginEdgeX ? beginX : nextX !== x ? nextX : null;
|
|
35
|
+
var targetY = beginEdgeY ? beginY : nextY !== y ? nextY : null;
|
|
36
|
+
if (targetX !== null) {
|
|
37
|
+
easeOutMove(x, targetX, callback.X);
|
|
38
|
+
}
|
|
39
|
+
if (targetY !== null) {
|
|
40
|
+
easeOutMove(y, targetY, callback.Y);
|
|
41
|
+
}
|
|
42
|
+
if (safeScale !== scale) {
|
|
43
|
+
easeOutMove(scale, safeScale, callback.S);
|
|
44
|
+
}
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
// 初始速度
|
|
48
|
+
var speedX = (x - lastX) / moveTime;
|
|
49
|
+
var speedY = (y - lastY) / moveTime;
|
|
50
|
+
var speedT = Math.sqrt(Math.pow(speedX, 2) + Math.pow(speedY, 2));
|
|
51
|
+
// 是否接触到边缘
|
|
52
|
+
var edgeX = false;
|
|
53
|
+
var edgeY = false;
|
|
54
|
+
scrollMove(speedT, function (spatial) {
|
|
55
|
+
var nextX = x + spatial * (speedX / speedT);
|
|
56
|
+
var nextY = y + spatial * (speedY / speedT);
|
|
57
|
+
var _a = (0, edgeHandle_1.computePositionEdge)(nextX, scale, currentWidth, window.innerWidth), isEdgeX = _a[0], currentX = _a[1];
|
|
58
|
+
var _b = (0, edgeHandle_1.computePositionEdge)(nextY, scale, currentHeight, window.innerHeight), isEdgeY = _b[0], currentY = _b[1];
|
|
59
|
+
if (isEdgeX && !edgeX) {
|
|
60
|
+
edgeX = true;
|
|
61
|
+
if (beginEdgeX) {
|
|
62
|
+
easeOutMove(nextX, currentX, callback.X);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
rebound(currentX, nextX + (nextX - currentX), callback.X);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (isEdgeY && !edgeY) {
|
|
69
|
+
edgeY = true;
|
|
70
|
+
if (beginEdgeY) {
|
|
71
|
+
easeOutMove(nextY, currentY, callback.Y);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
rebound(currentY, nextY + (nextY - currentY), callback.Y);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// 同时接触边缘的情况下停止滚动
|
|
78
|
+
if (edgeX && edgeY) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
var resultX = edgeX || callback.X(currentX);
|
|
82
|
+
var resultY = edgeY || callback.Y(currentY);
|
|
83
|
+
return resultX && resultY;
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
exports.default = useScrollPosition;
|
|
88
|
+
// 加速度
|
|
89
|
+
var acceleration = -0.001;
|
|
90
|
+
// 阻力
|
|
91
|
+
var resistance = 0.0002;
|
|
92
|
+
/**
|
|
93
|
+
* 通过速度滚动到停止
|
|
94
|
+
*/
|
|
95
|
+
function scrollMove(initialSpeed, callback) {
|
|
96
|
+
var v = initialSpeed;
|
|
97
|
+
var s = 0;
|
|
98
|
+
var lastTime = undefined;
|
|
99
|
+
var frameId = 0;
|
|
100
|
+
var calcMove = function (now) {
|
|
101
|
+
if (!lastTime) {
|
|
102
|
+
lastTime = now;
|
|
103
|
+
}
|
|
104
|
+
var dt = now - lastTime;
|
|
105
|
+
var direction = Math.sign(initialSpeed);
|
|
106
|
+
var a = direction * acceleration;
|
|
107
|
+
var f = Math.sign(-v) * Math.pow(v, 2) * resistance;
|
|
108
|
+
var ds = v * dt + ((a + f) * Math.pow(dt, 2)) / 2;
|
|
109
|
+
v = v + (a + f) * dt;
|
|
110
|
+
s = s + ds;
|
|
111
|
+
// move to s
|
|
112
|
+
lastTime = now;
|
|
113
|
+
if (direction * v <= 0) {
|
|
114
|
+
caf();
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (callback(s)) {
|
|
118
|
+
raf();
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
caf();
|
|
122
|
+
};
|
|
123
|
+
raf();
|
|
124
|
+
function raf() {
|
|
125
|
+
frameId = requestAnimationFrame(calcMove);
|
|
126
|
+
}
|
|
127
|
+
function caf() {
|
|
128
|
+
cancelAnimationFrame(frameId);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* 缓动函数
|
|
133
|
+
*/
|
|
134
|
+
var easeOutQuart = function (x) { return 1 - Math.pow((1 - x), 4); };
|
|
135
|
+
/**
|
|
136
|
+
* 缓动回调
|
|
137
|
+
*/
|
|
138
|
+
function easeOutMove(start, end, callback, speed, easing, complete) {
|
|
139
|
+
if (speed === void 0) { speed = variables_1.defaultSpeed; }
|
|
140
|
+
if (easing === void 0) { easing = easeOutQuart; }
|
|
141
|
+
var distance = end - start;
|
|
142
|
+
if (distance === 0) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
var startTime = Date.now();
|
|
146
|
+
var frameId = 0;
|
|
147
|
+
var calcMove = function () {
|
|
148
|
+
var time = Math.min(1, (Date.now() - startTime) / speed);
|
|
149
|
+
var result = callback(start + easing(time) * distance);
|
|
150
|
+
if (result && time < 1) {
|
|
151
|
+
raf();
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
cancelAnimationFrame(frameId);
|
|
155
|
+
if (time >= 1 && complete) {
|
|
156
|
+
complete();
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
raf();
|
|
160
|
+
function raf() {
|
|
161
|
+
frameId = requestAnimationFrame(calcMove);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
var react_1 = require("react");
|
|
15
|
+
function useSetState(initialState) {
|
|
16
|
+
return (0, react_1.useReducer)(function (state, action) { return (__assign(__assign({}, state), (typeof action === 'function' ? action(state) : action))); }, initialState);
|
|
17
|
+
}
|
|
18
|
+
exports.default = useSetState;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
var react_1 = require("react");
|
|
43
|
+
var useDebounceCallback_1 = __importDefault(require("./useDebounceCallback"));
|
|
44
|
+
var useIsomorphicLayoutEffect_1 = __importDefault(require("./useIsomorphicLayoutEffect"));
|
|
45
|
+
var useSetState_1 = __importDefault(require("./useSetState"));
|
|
46
|
+
/**
|
|
47
|
+
* 目标缩放延迟处理
|
|
48
|
+
*/
|
|
49
|
+
function useTargetScale(realWidth, realHeight, realScale, speed, updateEasing) {
|
|
50
|
+
var _this = this;
|
|
51
|
+
var execRef = (0, react_1.useRef)(false);
|
|
52
|
+
var _a = (0, useSetState_1.default)({ lead: true, scale: realScale }), _b = _a[0], lead = _b.lead, scale = _b.scale, updateState = _a[1];
|
|
53
|
+
var moveScale = (0, useDebounceCallback_1.default)(function (current) { return __awaiter(_this, void 0, void 0, function () {
|
|
54
|
+
return __generator(this, function (_a) {
|
|
55
|
+
updateEasing(true);
|
|
56
|
+
updateState({ lead: false, scale: current });
|
|
57
|
+
return [2 /*return*/];
|
|
58
|
+
});
|
|
59
|
+
}); }, { wait: speed });
|
|
60
|
+
(0, useIsomorphicLayoutEffect_1.default)(function () {
|
|
61
|
+
if (!execRef.current) {
|
|
62
|
+
execRef.current = true;
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
updateEasing(false);
|
|
66
|
+
updateState({ lead: true });
|
|
67
|
+
moveScale(realScale);
|
|
68
|
+
}, [realScale]);
|
|
69
|
+
// 运动开始
|
|
70
|
+
if (lead) {
|
|
71
|
+
return [realWidth * scale, realHeight * scale, realScale / scale];
|
|
72
|
+
}
|
|
73
|
+
// 运动结束
|
|
74
|
+
return [realWidth * realScale, realHeight * realScale, 1];
|
|
75
|
+
}
|
|
76
|
+
exports.default = useTargetScale;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PhotoSlider = exports.PhotoView = exports.PhotoProvider = void 0;
|
|
7
|
+
var PhotoProvider_1 = __importDefault(require("./PhotoProvider"));
|
|
8
|
+
exports.PhotoProvider = PhotoProvider_1.default;
|
|
9
|
+
var PhotoSlider_1 = __importDefault(require("./PhotoSlider"));
|
|
10
|
+
exports.PhotoSlider = PhotoSlider_1.default;
|
|
11
|
+
var PhotoView_1 = __importDefault(require("./PhotoView"));
|
|
12
|
+
exports.PhotoView = PhotoView_1.default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { DataType } from './types';
|
|
3
|
+
export declare type UpdateItemType = (dataType: DataType) => void;
|
|
4
|
+
export interface PhotoContextType {
|
|
5
|
+
show: (key: number) => void;
|
|
6
|
+
update: UpdateItemType;
|
|
7
|
+
remove: (key: number) => void;
|
|
8
|
+
nextId: () => number;
|
|
9
|
+
}
|
|
10
|
+
declare const _default: import("react").Context<PhotoContextType>;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* 资源数据类型
|
|
4
|
+
*/
|
|
5
|
+
export interface DataType {
|
|
6
|
+
/**
|
|
7
|
+
* 唯一标识
|
|
8
|
+
*/
|
|
9
|
+
key: number | string;
|
|
10
|
+
/**
|
|
11
|
+
* 资源地址
|
|
12
|
+
*/
|
|
13
|
+
src?: string;
|
|
14
|
+
/**
|
|
15
|
+
* 自定义渲染,优先级比 src 低
|
|
16
|
+
*/
|
|
17
|
+
render?: (props: PhotoRenderParams) => React.ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* 自定义覆盖节点
|
|
20
|
+
*/
|
|
21
|
+
overlay?: React.ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* 指定渲染节点宽度
|
|
24
|
+
*/
|
|
25
|
+
width?: number;
|
|
26
|
+
/**
|
|
27
|
+
* 指定渲染节点高度
|
|
28
|
+
*/
|
|
29
|
+
height?: number;
|
|
30
|
+
/**
|
|
31
|
+
* 触发 ref
|
|
32
|
+
*/
|
|
33
|
+
originRef?: React.MutableRefObject<HTMLElement | null>;
|
|
34
|
+
}
|
|
35
|
+
export interface PhotoProviderBase {
|
|
36
|
+
/**
|
|
37
|
+
* 是否循环预览,达到该数量则启用
|
|
38
|
+
* @defaultValue 3
|
|
39
|
+
*/
|
|
40
|
+
loop?: boolean | number;
|
|
41
|
+
/**
|
|
42
|
+
* 动画速度
|
|
43
|
+
* @defaultValue 400
|
|
44
|
+
*/
|
|
45
|
+
speed?: (type: ActiveAnimationType) => number;
|
|
46
|
+
/**
|
|
47
|
+
* 动画函数
|
|
48
|
+
* @defaultValue 'cubic-bezier(0.25, 0.8, 0.25, 1)'
|
|
49
|
+
*/
|
|
50
|
+
easing?: (type: ActiveAnimationType) => string;
|
|
51
|
+
/**
|
|
52
|
+
* 图片点击是否可关闭
|
|
53
|
+
*/
|
|
54
|
+
photoClosable?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* 背景点击是否可关闭
|
|
57
|
+
* @defaultValue true
|
|
58
|
+
*/
|
|
59
|
+
maskClosable?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* 默认背景透明度
|
|
62
|
+
* 设置 null 背景不响应下拉变化
|
|
63
|
+
* @defaultValue 1
|
|
64
|
+
*/
|
|
65
|
+
maskOpacity?: number | null;
|
|
66
|
+
/**
|
|
67
|
+
* 下拉是否可关闭
|
|
68
|
+
* @defaultValue true
|
|
69
|
+
*/
|
|
70
|
+
pullClosable?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* 导航条 visible
|
|
73
|
+
* @defaultValue true
|
|
74
|
+
*/
|
|
75
|
+
bannerVisible?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* 自定义渲染覆盖物
|
|
78
|
+
*/
|
|
79
|
+
overlayRender?: (overlayProps: OverlayRenderProps) => React.ReactNode;
|
|
80
|
+
/**
|
|
81
|
+
* 自定义渲染工具栏
|
|
82
|
+
*/
|
|
83
|
+
toolbarRender?: (overlayProps: OverlayRenderProps) => React.ReactNode;
|
|
84
|
+
className?: string;
|
|
85
|
+
maskClassName?: string;
|
|
86
|
+
photoWrapClassName?: string;
|
|
87
|
+
photoClassName?: string;
|
|
88
|
+
/**
|
|
89
|
+
* 自定义 loading
|
|
90
|
+
*/
|
|
91
|
+
loadingElement?: JSX.Element;
|
|
92
|
+
/**
|
|
93
|
+
* 自定义加载失败渲染
|
|
94
|
+
*/
|
|
95
|
+
brokenElement?: JSX.Element | ((photoProps: BrokenElementParams) => JSX.Element);
|
|
96
|
+
/**
|
|
97
|
+
* @defaultValue document.body
|
|
98
|
+
*/
|
|
99
|
+
portalContainer?: HTMLElement;
|
|
100
|
+
}
|
|
101
|
+
export declare type PhotoRenderParams = {
|
|
102
|
+
/**
|
|
103
|
+
* 自定义渲染 DOM 属性
|
|
104
|
+
*/
|
|
105
|
+
attrs: Partial<React.HTMLAttributes<HTMLElement>>;
|
|
106
|
+
scale: number;
|
|
107
|
+
rotate: number;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* brokenElement 函数参数
|
|
111
|
+
*/
|
|
112
|
+
export interface BrokenElementParams {
|
|
113
|
+
src: string;
|
|
114
|
+
}
|
|
115
|
+
export interface OverlayRenderProps {
|
|
116
|
+
/**
|
|
117
|
+
* 图片列表
|
|
118
|
+
*/
|
|
119
|
+
images: DataType[];
|
|
120
|
+
/**
|
|
121
|
+
* 当前索引
|
|
122
|
+
*/
|
|
123
|
+
index: number;
|
|
124
|
+
/**
|
|
125
|
+
* 索引改变回调
|
|
126
|
+
*/
|
|
127
|
+
onIndexChange: (index: number) => void;
|
|
128
|
+
/**
|
|
129
|
+
* 是否可见
|
|
130
|
+
*/
|
|
131
|
+
visible: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* 关闭事件回调
|
|
134
|
+
*/
|
|
135
|
+
onClose: (evt?: React.MouseEvent | React.TouchEvent) => void;
|
|
136
|
+
/**
|
|
137
|
+
* 覆盖物是否可见
|
|
138
|
+
*/
|
|
139
|
+
overlayVisible: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* 自定义覆盖节点
|
|
142
|
+
*/
|
|
143
|
+
overlay?: React.ReactNode;
|
|
144
|
+
/**
|
|
145
|
+
* 当前旋转角度
|
|
146
|
+
*/
|
|
147
|
+
rotate: number;
|
|
148
|
+
/**
|
|
149
|
+
* 旋转事件回调
|
|
150
|
+
*/
|
|
151
|
+
onRotate: (rotate: number) => void;
|
|
152
|
+
/**
|
|
153
|
+
* 当前缩放
|
|
154
|
+
*/
|
|
155
|
+
scale: number;
|
|
156
|
+
/**
|
|
157
|
+
* 缩放事件回调
|
|
158
|
+
*/
|
|
159
|
+
onScale: (scale: number) => void;
|
|
160
|
+
}
|
|
161
|
+
export interface ExposedProperties {
|
|
162
|
+
scale?: number;
|
|
163
|
+
rotate?: number;
|
|
164
|
+
onScale?: (scale: number) => void;
|
|
165
|
+
onRotate?: (rotate: number) => void;
|
|
166
|
+
}
|
|
167
|
+
export declare type ReachMoveFunction = (reachPosition: ReachType, clientX: number, clientY: number, scale?: number) => void;
|
|
168
|
+
export declare type ReachFunction = (clientX: number, clientY: number) => void;
|
|
169
|
+
export declare type PhotoTapFunction = (clientX: number, clientY: number) => void;
|
|
170
|
+
/**
|
|
171
|
+
* 边缘超出状态
|
|
172
|
+
*/
|
|
173
|
+
export declare type CloseEdgeType = 1 | 2 | 3 | undefined;
|
|
174
|
+
/**
|
|
175
|
+
* 边缘触发状态
|
|
176
|
+
*/
|
|
177
|
+
export declare type ReachType = 'x' | 'y' | undefined;
|
|
178
|
+
/**
|
|
179
|
+
* 初始响应状态
|
|
180
|
+
*/
|
|
181
|
+
export declare type TouchStartType = 0 | 1 | 2 | 3;
|
|
182
|
+
export declare type OriginRectType = {
|
|
183
|
+
T: number;
|
|
184
|
+
L: number;
|
|
185
|
+
W: number;
|
|
186
|
+
H: number;
|
|
187
|
+
FIT: 'contain' | 'cover' | 'fill' | undefined;
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
* 动画状态
|
|
191
|
+
*/
|
|
192
|
+
export declare type EasingMode = 0 | 1 | 2 | 3 | 4 | 5;
|
|
193
|
+
/**
|
|
194
|
+
* 进行中的动画
|
|
195
|
+
*/
|
|
196
|
+
export declare type ActiveAnimationType = 0 | 1 | 2 | 3;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CloseEdgeType } from '../types';
|
|
2
|
+
import type { ReachType, TouchStartType } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* 获取接触边缘类型
|
|
5
|
+
*/
|
|
6
|
+
export declare const getReachType: (initialTouchState: TouchStartType, horizontalCloseEdge: CloseEdgeType, verticalCloseEdge: CloseEdgeType, reachPosition: ReachType) => ReachType;
|
|
7
|
+
/**
|
|
8
|
+
* 计算接触边缘位置
|
|
9
|
+
* @param position - x/y
|
|
10
|
+
* @param scale
|
|
11
|
+
* @param size - width/height
|
|
12
|
+
* @param innerSize - innerWidth/innerHeight
|
|
13
|
+
* @return [CloseEdgeType, position]
|
|
14
|
+
*/
|
|
15
|
+
export declare const computePositionEdge: (position: number, scale: number, size: number, innerSize: number) => readonly [CloseEdgeType, number];
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.computePositionEdge = exports.getReachType = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* 获取接触边缘类型
|
|
6
|
+
*/
|
|
7
|
+
var getReachType = function (initialTouchState, horizontalCloseEdge, verticalCloseEdge, reachPosition) {
|
|
8
|
+
if ((horizontalCloseEdge && initialTouchState === 1) || reachPosition === 'x') {
|
|
9
|
+
return 'x';
|
|
10
|
+
}
|
|
11
|
+
else if ((verticalCloseEdge && initialTouchState > 1) || reachPosition === 'y') {
|
|
12
|
+
return 'y';
|
|
13
|
+
}
|
|
14
|
+
return undefined;
|
|
15
|
+
};
|
|
16
|
+
exports.getReachType = getReachType;
|
|
17
|
+
/**
|
|
18
|
+
* 计算接触边缘位置
|
|
19
|
+
* @param position - x/y
|
|
20
|
+
* @param scale
|
|
21
|
+
* @param size - width/height
|
|
22
|
+
* @param innerSize - innerWidth/innerHeight
|
|
23
|
+
* @return [CloseEdgeType, position]
|
|
24
|
+
*/
|
|
25
|
+
var computePositionEdge = function (position, scale, size, innerSize) {
|
|
26
|
+
var currentWidth = size * scale;
|
|
27
|
+
// 图片超出的宽度
|
|
28
|
+
var outOffset = (currentWidth - innerSize) / 2;
|
|
29
|
+
var closedEdge = undefined;
|
|
30
|
+
var current = position;
|
|
31
|
+
if (currentWidth <= innerSize) {
|
|
32
|
+
closedEdge = 1;
|
|
33
|
+
current = 0;
|
|
34
|
+
}
|
|
35
|
+
else if (position > 0 && outOffset - position <= 0) {
|
|
36
|
+
closedEdge = 2;
|
|
37
|
+
current = outOffset;
|
|
38
|
+
}
|
|
39
|
+
else if (position < 0 && outOffset + position <= 0) {
|
|
40
|
+
closedEdge = 3;
|
|
41
|
+
current = -outOffset;
|
|
42
|
+
}
|
|
43
|
+
return [closedEdge, current];
|
|
44
|
+
};
|
|
45
|
+
exports.computePositionEdge = computePositionEdge;
|