@shijiu/jsview-vue-samples 2.3.0 → 2.3.728-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/ABImageAlt/App.vue +114 -0
- package/ABImageAlt/Item.vue +133 -0
- package/{MetroWidgetDemos/SkeletonDiagram/assets/imageList.json → ABImageAlt/assets/imageList.js} +9 -1
- package/ABImageAlt/data.js +17 -0
- package/AI_Check_Rules.txt +5 -0
- package/AnimPicture/App.vue +20 -10
- package/ApicSwitch/App.vue +90 -0
- package/ApicSwitch/TabItem.vue +65 -0
- package/ApicSwitch/WebpShow.vue +24 -0
- package/ApicSwitch/data.js +50 -0
- package/Basic/AI_skills_update.md +1 -0
- package/Basic/components/div/ColorFormatTest.vue +93 -0
- package/Basic/components/div/DivRadius.vue +97 -15
- package/Basic/components/div/DivTag3Group.vue +30 -0
- package/Basic/components/img/ImageType.vue +65 -0
- package/Basic/components/panel/Panel2.vue +13 -1
- package/Basic/components/text/TextAlign.vue +7 -1
- package/BlobLoadTest/App.vue +201 -0
- package/BreakLinesApi/App.vue +82 -0
- package/CanvasDrawChart/App.vue +11 -0
- package/CanvasDrawChart/Graph1.vue +104 -0
- package/CanvasDrawChart/Graph2.vue +115 -0
- package/DashPath/App.vue +17 -16
- package/DashPath/AppForOperator.vue +2 -4
- package/DemoForOperator/AnimPic/AnimPic.vue +24 -2
- package/DemoForOperator/Banger/Banger/Banger.vue +73 -9
- package/DemoForOperator/Blur/Blur.vue +146 -0
- package/DemoForOperator/Blur/BlurInOut/BlurInOut.vue +184 -0
- package/DemoForOperator/Blur/BlurInOut/StaticBgSlide.vue +162 -0
- package/DemoForOperator/Blur/BlurPopup/BlurPopup.vue +249 -0
- package/DemoForOperator/BookFlip/App.vue +115 -0
- package/DemoForOperator/BookFlip/BookPage.vue +82 -0
- package/DemoForOperator/Bounce/Bounce.vue +33 -1
- package/DemoForOperator/Bounce/FreeMoveBuilder.js +1 -1
- package/DemoForOperator/ChunLian/Couplets.vue +44 -1
- package/DemoForOperator/ClickSpriteAnim/App.vue +130 -0
- package/DemoForOperator/ClickSpriteAnim/Item.vue +74 -0
- package/DemoForOperator/DominantColor/App.vue +187 -0
- package/DemoForOperator/EpisodeList/EpisodeList/Controller.vue +0 -3
- package/DemoForOperator/EpisodeList/EpisodeList/EpisodeList.vue +76 -2
- package/DemoForOperator/Firework1/App.vue +13 -2
- package/DemoForOperator/Firework1/Fireworks.vue +68 -11
- package/DemoForOperator/FlipPage/FlipPage/FlipPage.vue +30 -1
- package/DemoForOperator/Focus/Alpha/AlphaFocusBox.vue +27 -2
- package/DemoForOperator/Focus/Alpha/Item.vue +1 -0
- package/DemoForOperator/Focus/Light/Item.vue +1 -0
- package/DemoForOperator/Focus/Light/LightFocusBox.vue +42 -1
- package/DemoForOperator/Focus/Normal/Item.vue +1 -0
- package/DemoForOperator/Focus/Normal/NormalFocusBox.vue +12 -0
- package/DemoForOperator/FrameShadow/App.vue +193 -0
- package/DemoForOperator/FrameShadow/FrameShadow.vue +61 -0
- package/DemoForOperator/FullscreenIn/App.vue +1 -1
- package/DemoForOperator/FullscreenIn/FullscreenPoster.vue +18 -3
- package/DemoForOperator/Genie/App.vue +20 -6
- package/DemoForOperator/Genie/App2.vue +61 -0
- package/DemoForOperator/Genie/geniePakcer/GenieImage.vue +298 -0
- package/DemoForOperator/Genie/geniePakcer/GenieSlot.vue +292 -0
- package/DemoForOperator/Genie/geniePakcer/GenieTools.ts +463 -0
- package/DemoForOperator/GrayFilter/GrayFilter.vue +21 -0
- package/DemoForOperator/Jigsaw/JigsawFull.vue +58 -11
- package/DemoForOperator/Jigsaw/JigsawSingle.vue +47 -9
- package/DemoForOperator/LongChatBox/App.vue +36 -0
- package/DemoForOperator/LongChatBox/Bubble.vue +116 -0
- package/DemoForOperator/LongChatBox/LongChat.vue +204 -0
- package/DemoForOperator/LongChatBox/testData.js +14 -0
- package/DemoForOperator/Particle/Drop/DropParticle.vue +33 -1
- package/DemoForOperator/Particle/Explode/ExplodeParticle.vue +23 -2
- package/DemoForOperator/PosterAnim/PosterAnim.js +21 -0
- package/DemoForOperator/PosterOverflow/PosterOverflow.vue +16 -0
- package/DemoForOperator/Resize/App.vue +157 -0
- package/DemoForOperator/Resize/Resize/Item.vue +234 -0
- package/DemoForOperator/Resize/Resize/Resize.vue +96 -0
- package/DemoForOperator/Ripple/Ripple.vue +16 -1
- package/DemoForOperator/ScreenShootScale/App.vue +96 -0
- package/DemoForOperator/ScreenShootScale/Back.vue +86 -0
- package/DemoForOperator/ScreenShootScale/Front.vue +133 -0
- package/DemoForOperator/ScreenShootScale/Item.vue +62 -0
- package/DemoForOperator/ScreenShootScale/ScreenShootScale.vue +109 -0
- package/DemoForOperator/SmoothSwiper/App.vue +50 -0
- package/DemoForOperator/Sound/Bounce/App.vue +56 -0
- package/DemoForOperator/Sound/Bounce/Bounce.vue +87 -0
- package/DemoForOperator/Sound/Bounce/FreeMoveBuilder.js +146 -0
- package/DemoForOperator/Sound/Bounce/bgmusic.mp3 +0 -0
- package/DemoForOperator/Sound/Bounce/coin.mp3 +0 -0
- package/DemoForOperator/Sound/FocusMove/App.vue +134 -0
- package/DemoForOperator/Sound/FocusMove/Item.vue +43 -0
- package/DemoForOperator/Sound/FocusMove/move.mp3 +0 -0
- package/DemoForOperator/Sound/Rain/App.vue +11 -0
- package/DemoForOperator/Sound/Rain/Raining/Rain.vue +69 -0
- package/DemoForOperator/Sound/Rain/Raining/RainScene.vue +118 -0
- package/DemoForOperator/Sound/Sound/Sound.vue +24 -0
- package/DemoForOperator/Sound/Sound/index.js +4 -0
- package/DemoForOperator/Sound/Sound/useSound.js +112 -0
- package/DemoForOperator/Sprite/Sprite.vue +62 -5
- package/DemoForOperator/Stretch/Stretch/Stretch.vue +52 -2
- package/DemoForOperator/Swiper/App.vue +101 -0
- package/DemoForOperator/Swiper/Item.vue +56 -0
- package/DemoForOperator/Swiper/ParallaxSlide.vue +164 -0
- package/DemoForOperator/TabContent/TabContent/TabContent.vue +39 -1
- package/DemoForOperator/TabContentVertical/App.vue +104 -0
- package/DemoForOperator/TabContentVertical/ContentPage.vue +67 -0
- package/DemoForOperator/TabContentVertical/Item.vue +94 -0
- package/DemoForOperator/TabContentVertical/PageItem.vue +40 -0
- package/DemoForOperator/TabContentVertical/TabContent/CreepFocus.vue +160 -0
- package/DemoForOperator/TabContentVertical/TabContent/Item.vue +63 -0
- package/DemoForOperator/TabContentVertical/TabContent/TabContent.vue +184 -0
- package/DemoForOperator/TabContentVertical/TabContent/TabItem.vue +368 -0
- package/DemoForOperator/TabContentVertical/TabContent/TabWidget.vue +259 -0
- package/DemoForOperator/TabContentVertical/TabContent/Util.js +3 -0
- package/DemoForOperator/TabContentVertical/TabContent/ViewSwiper.vue +110 -0
- package/DemoForOperator/TabContentVertical/assets/children_science.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/documentary.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/free.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/game.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/home_selected.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/movie_ticket.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/my_account.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/opera.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/sports.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/tv_drama.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/variety_show.png +0 -0
- package/DemoForOperator/TabContentVertical/assets/vip.png +0 -0
- package/DemoForOperator/TabContentVertical/testData.js +76 -0
- package/DemoForOperator/Vortex/Vortex/Vortex.vue +26 -0
- package/DemoForOperator/routeList.js +125 -2
- package/DemoHomepage/App.vue +74 -1
- package/DemoHomepage/components/BodyFrame.vue +5 -0
- package/DemoHomepage/components/Item.vue +11 -0
- package/DemoHomepage/components/TabFrame.vue +1 -1
- package/DemoHomepage/router.js +798 -140
- package/DemoHomepage/views/Homepage.vue +60 -2
- package/DemoHomepage/watchTest.vue +50 -0
- package/DomRenderer/App.vue +133 -0
- package/FilterDemo/AnimatePic.vue +63 -17
- package/FilterDemo/App.vue +3 -3
- package/FlexCellDemo/AI_skills_update.md +4 -0
- package/FlexCellDemo/TestFrame1.vue +12 -2
- package/FlexCellDemo/TestFrame2.vue +10 -1
- package/FlexCellDemo/TestFrame3.vue +114 -59
- package/FpsLimit/App.vue +102 -0
- package/FreeMove/App.vue +24 -279
- package/FreeMove/TestScene1.vue +260 -0
- package/FreeMove/TestScene3.vue +431 -0
- package/FreeMoveChildAttract/App.vue +18 -8
- package/FreeMoveLink/App.vue +51 -22
- package/GiftRain/components/SpriteTranslate.vue +68 -48
- package/HashHistory/App.vue +2 -2
- package/HashHistory/router.js +1 -1
- package/Hover/App.vue +144 -0
- package/HttpRequestSSE/SSEReader.js +200 -0
- package/ImpactStop/App.vue +2 -2
- package/Input/FullKeyboard.vue +3 -3
- package/Input/InputPanel.vue +63 -3
- package/JsvLine/App.vue +53 -38
- package/LatexDemo/App.vue +3 -1
- package/LatexFormula/App.vue +196 -0
- package/LongImage/App.vue +1 -1
- package/LongImage/LongImageScroll.vue +111 -46
- package/LongImage/Scroll.vue +28 -9
- package/LongText/LongTextScroll.vue +14 -1
- package/Markdown/App.vue +36 -0
- package/Markdown/Bubble.vue +109 -0
- package/Markdown/LongChat.vue +216 -0
- package/Markdown/data.js +633 -0
- package/MetroWidgetDemos/AI_skills_update.md +2 -0
- package/MetroWidgetDemos/EpgFlowListType/App.vue +206 -0
- package/MetroWidgetDemos/EpgFlowListType/components/ContentCard.vue +105 -0
- package/MetroWidgetDemos/EpgFlowListType/components/FloorSection.vue +131 -0
- package/MetroWidgetDemos/EpgFlowListType/components/LeftTabItem.vue +41 -0
- package/MetroWidgetDemos/EpgFlowListType/data.js +78 -0
- package/MetroWidgetDemos/ListExpand/ChildItem.vue +130 -0
- package/MetroWidgetDemos/ListExpand/ExpandItem.vue +375 -0
- package/MetroWidgetDemos/ListExpand/ExpandItem1.vue +403 -0
- package/MetroWidgetDemos/ListExpand/assets/arrow-down.png +0 -0
- package/MetroWidgetDemos/ListExpand/assets/up-arrow.png +0 -0
- package/MetroWidgetDemos/ListExpand/components/WidgetListHandler.vue +150 -0
- package/MetroWidgetDemos/ListExpand/index.vue +88 -0
- package/MetroWidgetDemos/ListExpand/list.js +2421 -0
- package/MetroWidgetDemos/RefreshDemo/App.vue +14 -1
- package/MetroWidgetDemos/RenderAccelerate/App.vue +142 -0
- package/MetroWidgetDemos/RenderAccelerate/AppPage.vue +78 -0
- package/MetroWidgetDemos/RenderAccelerate/AppTab.vue +62 -0
- package/MetroWidgetDemos/RenderAccelerate/ContentItem.vue +409 -0
- package/MetroWidgetDemos/{TripleWidget → RenderAccelerate}/Item.vue +6 -3
- package/MetroWidgetDemos/RenderAccelerate/TabItem.vue +100 -0
- package/MetroWidgetDemos/RenderAccelerate/ViewSwiper.vue +215 -0
- package/MetroWidgetDemos/RenderAccelerate/WidgetItem.vue +107 -0
- package/MetroWidgetDemos/SkeletonDiagram/App.vue +35 -8
- package/MetroWidgetDemos/SkeletonDiagram/Item.vue +11 -2
- package/MetroWidgetDemos/SkeletonDiagram/assets/imageList.js +245 -0
- package/MetroWidgetDemos/SkeletonDiagram/data.js +3 -3
- package/MetroWidgetDemos/SpatialNav/App.vue +177 -0
- package/MetroWidgetDemos/SpatialNav/Buttons.vue +83 -0
- package/MetroWidgetDemos/SpatialNav/CustomFocus.vue +57 -0
- package/MetroWidgetDemos/SpatialNav/Item.vue +71 -0
- package/MetroWidgetDemos/SpatialNav/SimpleFloor.vue +86 -0
- package/MetroWidgetDemos/SpatialNav/StepMw.vue +113 -0
- package/MetroWidgetDemos/SpatialNav/TabContent/TabContent.vue +185 -0
- package/MetroWidgetDemos/SpatialNav/TripleSection/TripleSection.vue +69 -0
- package/MetroWidgetDemos/SpatialNav/TripleSection/WidgetItem.vue +100 -0
- package/MetroWidgetDemos/SpatialNav/TvSection/List.vue +75 -0
- package/MetroWidgetDemos/SpatialNav/TvSection/TvSection.vue +91 -0
- package/MetroWidgetDemos/basic2/App.vue +407 -0
- package/MetroWidgetDemos/basic2/Item.vue +68 -0
- package/MetroWidgetDemos/direction/App.vue +22 -0
- package/MetroWidgetDemos/gazeFocusDiff/App.vue +126 -0
- package/MetroWidgetDemos/gazeFocusDiff/Item.vue +87 -0
- package/MetroWidgetDemos/minimalUsage/App.vue +66 -0
- package/MetroWidgetDemos/minimalUsage/Item.vue +54 -0
- package/MetroWidgetDemos/ninePatchFocusPage/App.vue +23 -7
- package/MetroWidgetDemos/ninePatchFocusPage/Item.vue +7 -5
- package/MetroWidgetDemos/ninePatchFocusPage/focusConstants.js +2 -0
- package/MetroWidgetDemos/routeList.js +229 -8
- package/MetroWidgetDemos/slideSetting/App.vue +288 -99
- package/MetroWidgetDemos/zIndex/App.vue +117 -0
- package/MetroWidgetDemos/zIndex/Item.vue +61 -0
- package/NinePatchTester/App.vue +24 -31
- package/PosterPacker/App.vue +2 -2
- package/PreDecode/App.vue +140 -0
- package/ReactiveTest/App.vue +115 -0
- package/ReactiveTest/Item.vue +92 -0
- package/ReactiveTest/assets/imageList.js +245 -0
- package/ReactiveTest/component/TestSmartDiv.vue +50 -0
- package/ReactiveTest/component/TestSmartDivSrcList.vue +74 -0
- package/ReactiveTest/component/TestSmartImage.vue +46 -0
- package/ReactiveTest/component/TestSmartImageSrcList.vue +90 -0
- package/ReactiveTest/component/TestSmartImageStyle.vue +41 -0
- package/ReactiveTest/data.js +49 -0
- package/ScreenToBlob/App.vue +250 -0
- package/ScrollBoxTest/App.vue +52 -28
- package/ScrollBoxTest/ClipBar.vue +64 -2
- package/ScrollBoxTest/NinePatchBar.vue +64 -2
- package/ScrollBoxTest/SizeDivBar.vue +64 -2
- package/SecTorTest/App.vue +9 -3
- package/SpringFestival/SpringFestivalScene/FreeMoveBuilder.js +3 -3
- package/SyncDecode/App.vue +137 -0
- package/TextSizeLimit/App.vue +211 -0
- package/TextureAnimation/App3.vue +11 -1
- package/TouchWidget/App.vue +90 -5
- package/TouchWidget/WidgetItem.vue +1 -0
- package/TransitPage/App.vue +2 -0
- package/ViewOpacity/App.vue +19 -0
- package/assets/logo.png +0 -0
- package/package.json +1 -1
- package/DashPath/DashPath.vue +0 -118
- package/DemoForOperator/Genie/geniePakcer/Genie.vue +0 -699
- package/DemoForOperator/ScalePoster/App.vue +0 -4
- package/DemoForOperator/ScalePoster/ScalePoster.vue +0 -0
- package/DivMetroPerformance/App.vue +0 -157
- package/DivMetroPerformance/Item.vue +0 -58
- package/DivMetroPerformance/assets/bg.jpg +0 -0
- package/DivMetroPerformance/assets/coupon_content.png +0 -0
- package/DivMetroPerformance/assets/coupon_left.png +0 -0
- package/DivMetroPerformance/assets/coupon_mid.png +0 -0
- package/DivMetroPerformance/assets/coupon_right.png +0 -0
- package/DivMetroPerformance/assets/focus_border.png +0 -0
- package/DivMetroPerformance/assets/holder_logo.png +0 -0
- package/DivMetroPerformance/assets/jrbm.png +0 -0
- package/DivMetroPerformance/assets/line_left.png +0 -0
- package/DivMetroPerformance/assets/line_mid.png +0 -0
- package/DivMetroPerformance/assets/line_right.png +0 -0
- package/DivMetroPerformance/assets/loading.png +0 -0
- package/DivMetroPerformance/assets/logo.png +0 -0
- package/DivMetroPerformance/assets/mcjx.png +0 -0
- package/DivMetroPerformance/assets/tao.png +0 -0
- package/DivMetroPerformance/assets/tmall.png +0 -0
- package/DivMetroPerformance/border.png +0 -0
- package/DivMetroPerformance/components/ContentItem.vue +0 -384
- package/DivMetroPerformance/components/MyTab.vue +0 -129
- package/DivMetroPerformance/data.js +0 -124
- package/DivMetroPerformance/utils/GridItem.vue +0 -28
- package/DivMetroPerformance/utils/GridPlate.vue +0 -85
- package/MediaDemo/App.vue +0 -127
- package/MediaDemo/assets/audio-poster.png +0 -0
- package/MediaDemo/components/Button.vue +0 -69
- package/MediaDemo/components/Controllor.vue +0 -286
- package/MediaDemo/components/StatusBar.vue +0 -100
- package/MediaDemo/components/frames/AudioFrame.vue +0 -39
- package/MediaDemo/components/frames/AudioPoster.vue +0 -48
- package/MediaDemo/components/frames/MediaFrame.vue +0 -153
- package/MediaDemo/components/frames/VideoFrame.vue +0 -39
- package/MetroWidgetDemos/TripleWidget/App.vue +0 -81
- package/MetroWidgetDemos/TripleWidget/SWidgetItem.vue +0 -93
- package/MetroWidgetDemos/TripleWidget/WidgetItem.vue +0 -111
- package/Parkour/App.vue +0 -13
- package/Parkour/Common/Context.js +0 -21
- package/Parkour/Common/MatchmanInfo.js +0 -62
- package/Parkour/Common/Random.js +0 -61
- package/Parkour/Common/Sound.js +0 -50
- package/Parkour/appConfig/HOW_TO_CONFIG.md +0 -20
- package/Parkour/appConfig/app.config.mjs +0 -5
- package/Parkour/appConfig/app_sign_private_key_sample.crt +0 -28
- package/Parkour/appConfig/app_sign_public_key_sample.pem +0 -9
- package/Parkour/appConfig/jsview.config.mjs +0 -39
- package/Parkour/assets/Bgimages/bg1.png +0 -0
- package/Parkour/assets/Bgimages/bg2.png +0 -0
- package/Parkour/assets/Bgimages/bg3.png +0 -0
- package/Parkour/assets/Bgimages/bg4.png +0 -0
- package/Parkour/assets/Bgimages/bg5.png +0 -0
- package/Parkour/assets/audio/jump.mp3 +0 -0
- package/Parkour/assets/audio/lose.mp3 +0 -0
- package/Parkour/assets/role_skin1/fail.json +0 -44
- package/Parkour/assets/role_skin1/fail.png +0 -0
- package/Parkour/assets/role_skin1/jump_down.json +0 -20
- package/Parkour/assets/role_skin1/jump_down.png +0 -0
- package/Parkour/assets/role_skin1/jump_up.json +0 -44
- package/Parkour/assets/role_skin1/jump_up.png +0 -0
- package/Parkour/assets/role_skin1/roll.json +0 -44
- package/Parkour/assets/role_skin1/roll.png +0 -0
- package/Parkour/assets/role_skin1/run.json +0 -52
- package/Parkour/assets/role_skin1/run.png +0 -0
- package/Parkour/components/Backdrop.vue +0 -61
- package/Parkour/components/GameSence.vue +0 -602
- package/Parkour/components/Matchman.vue +0 -85
- package/TextureAnimation/utils/FrameCanvasStore.ts +0 -68
- package/TextureAnimation/utils/RotateFrame.vue +0 -146
- package/TextureAnimation/utils/circleHaloMask.png +0 -0
- package/ThrowMoveDemo/AccelerateDemo.vue +0 -85
- package/ThrowMoveDemo/App.vue +0 -104
- package/ThrowMoveDemo/LRParabolicDemo.vue +0 -101
- package/ThrowMoveDemo/TargetDemo.vue +0 -87
- package/ThrowMoveDemo/UDParabolicDemo.vue +0 -92
- /package/{AnimPicture/assets → assets}/animated_webp.webp +0 -0
- /package/{AnimPicture/assets → assets}/ball_3.webp +0 -0
- /package/{AnimPicture/assets → assets}/girl_run.gif +0 -0
- /package/{AnimPicture/assets → assets}/quan.webp +0 -0
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
<!-- 通用item -->
|
|
2
|
+
<script setup>
|
|
3
|
+
import {
|
|
4
|
+
JsvMarquee,
|
|
5
|
+
getKeyFramesGroup,
|
|
6
|
+
useFocusHub,
|
|
7
|
+
EdgeDirection,
|
|
8
|
+
} from "jsview";
|
|
9
|
+
import { shallowRef, ref, onMounted, nextTick, inject, computed, onBeforeUnmount } from "vue";
|
|
10
|
+
import WidgetListHandler from "./components/WidgetListHandler.vue";
|
|
11
|
+
import ChildItem from "./ChildItem.vue";
|
|
12
|
+
const props = defineProps({
|
|
13
|
+
data: Object,
|
|
14
|
+
name: String,
|
|
15
|
+
onAction: Object,
|
|
16
|
+
query: Object,
|
|
17
|
+
onClick: Function,
|
|
18
|
+
onFocus: Function,
|
|
19
|
+
onBlur: Function,
|
|
20
|
+
onItemEdge: Function,
|
|
21
|
+
foldEvent: Function,
|
|
22
|
+
onExpandHeight: Function,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const focused = shallowRef(false);
|
|
26
|
+
const gazed = shallowRef(false);
|
|
27
|
+
const parentWidget = inject("parentWidget", {});
|
|
28
|
+
const divRef = shallowRef(null);
|
|
29
|
+
|
|
30
|
+
// item样式
|
|
31
|
+
const itemStyle = {
|
|
32
|
+
...props.data.itemStyle,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// 图片样式
|
|
36
|
+
const imgStyle = {
|
|
37
|
+
...props.data.imgStyle,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// 图标样式
|
|
41
|
+
const iconStyle = {
|
|
42
|
+
...props.data.iconStyle,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// 文本样式
|
|
46
|
+
const textStyle = {
|
|
47
|
+
...props.data.textStyle,
|
|
48
|
+
width: props.data.textStyle.padding
|
|
49
|
+
? props.data.textStyle.width -
|
|
50
|
+
(props.data.textStyle.padding.left || 0) -
|
|
51
|
+
(props.data.textStyle.padding.right || 0)
|
|
52
|
+
: props.data.textStyle.width,
|
|
53
|
+
height: props.data.textStyle.padding
|
|
54
|
+
? props.data.textStyle.height -
|
|
55
|
+
(props.data.textStyle.padding.top || 0) -
|
|
56
|
+
(props.data.textStyle.padding.bottom || 0)
|
|
57
|
+
: props.data.textStyle.height,
|
|
58
|
+
left:
|
|
59
|
+
(props.data.textStyle.left || 0) +
|
|
60
|
+
(props.data.textStyle.padding?.left || 0),
|
|
61
|
+
top:
|
|
62
|
+
(props.data.textStyle.top || 0) + (props.data.textStyle.padding?.top || 0),
|
|
63
|
+
whiteSpace: "nowrap",
|
|
64
|
+
textOverflow: "ellipsis",
|
|
65
|
+
overflow: "hidden",
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// 焦点样式
|
|
69
|
+
const focusStyle = {
|
|
70
|
+
...itemStyle,
|
|
71
|
+
...props.data.focusStyle,
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// 焦点图片样式
|
|
75
|
+
const focusImgStyle = {
|
|
76
|
+
...imgStyle,
|
|
77
|
+
...props.data.focusImgStyle,
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// 焦点图标样式
|
|
81
|
+
const focusIconStyle = {
|
|
82
|
+
...iconStyle,
|
|
83
|
+
...props.data.focusIconStyle,
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// 焦点文本样式
|
|
87
|
+
const focusTextStyle = {
|
|
88
|
+
...textStyle,
|
|
89
|
+
...props.data.focusTextStyle,
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// 失焦样式
|
|
93
|
+
const blurStyle = {
|
|
94
|
+
...itemStyle,
|
|
95
|
+
...props.data.blurStyle,
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
// 失焦图片样式
|
|
99
|
+
const blurImgStyle = {
|
|
100
|
+
...imgStyle,
|
|
101
|
+
...props.data.blurImgStyle,
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
// 失焦图标样式
|
|
105
|
+
const blurIconStyle = {
|
|
106
|
+
...iconStyle,
|
|
107
|
+
...props.data.blurIconStyle,
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
// 失焦文本样式
|
|
111
|
+
const blurTextStyle = {
|
|
112
|
+
...textStyle,
|
|
113
|
+
...props.data.blurTextStyle,
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* 关键代码
|
|
118
|
+
* 焦点快速往复移动时, 复用一个子widget会导致slideToDiv焦点位置的偏移, 因此每次缩放时都创建新的widget
|
|
119
|
+
*/
|
|
120
|
+
const duration = 200;
|
|
121
|
+
const focusHub = useFocusHub();
|
|
122
|
+
let folded = ref(true);
|
|
123
|
+
const styleShell = getKeyFramesGroup();
|
|
124
|
+
const itemBoxHeight = props.data.itemStyle.height;
|
|
125
|
+
const expandChildrenHeight = computed(() => {
|
|
126
|
+
const totalHeight = props.data.expandChildren.length * itemBoxHeight;
|
|
127
|
+
return totalHeight;
|
|
128
|
+
});
|
|
129
|
+
const widgetRef = shallowRef(null);
|
|
130
|
+
const widgetTop = ref(0);
|
|
131
|
+
let animToken = 1;
|
|
132
|
+
const clipAnimStr = ref("");
|
|
133
|
+
const slideAnimStr = ref("");
|
|
134
|
+
const animationCache = {};
|
|
135
|
+
|
|
136
|
+
const getClipAnimation = (from, to, anchor) => {
|
|
137
|
+
animToken++;
|
|
138
|
+
const name = "foldableItemClipAnim" + animToken;
|
|
139
|
+
if (animationCache.hasOwnProperty(name)) {
|
|
140
|
+
styleShell.removeRule(name);
|
|
141
|
+
delete animationCache[name];
|
|
142
|
+
}
|
|
143
|
+
const clipAnimStr = `@keyframes ${name} { from { height: ${from}; } to { height: ${to}; } }`;
|
|
144
|
+
animationCache[name] = clipAnimStr;
|
|
145
|
+
styleShell.insertRule(clipAnimStr);
|
|
146
|
+
|
|
147
|
+
//平移动画
|
|
148
|
+
const anchorPosition = Math.round((to - from) * anchor);
|
|
149
|
+
const slideName = "foldableItemSlideAnim" + animToken;
|
|
150
|
+
if (animationCache.hasOwnProperty(slideName)) {
|
|
151
|
+
styleShell.removeRule(slideName);
|
|
152
|
+
delete animationCache[slideName];
|
|
153
|
+
}
|
|
154
|
+
const slideAnimStr = `@keyframes ${slideName} { from { transform: translate3d(0,${-anchorPosition},0); } to { transform: translate3d(0,0,0); } }`;
|
|
155
|
+
animationCache[slideName] = slideAnimStr;
|
|
156
|
+
styleShell.insertRule(slideAnimStr);
|
|
157
|
+
|
|
158
|
+
return {
|
|
159
|
+
clip: `${name} ${duration / 1000}s`,
|
|
160
|
+
slide: `${slideName} ${duration / 1000}s`,
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const getAnchor = (index) => {
|
|
165
|
+
let anchor = 0;
|
|
166
|
+
const l = props.data.expandChildren;
|
|
167
|
+
if (index <= 0) {
|
|
168
|
+
anchor = 0;
|
|
169
|
+
} else if (index > l.length - 1) {
|
|
170
|
+
anchor = 1;
|
|
171
|
+
} else {
|
|
172
|
+
let focusMiddle = 0;
|
|
173
|
+
for (let i = 0; i <= index - 1; ++i) {
|
|
174
|
+
focusMiddle += l[i].height;
|
|
175
|
+
}
|
|
176
|
+
focusMiddle += l[index].height / 2;
|
|
177
|
+
const maxHeight = expandChildrenHeight.value + itemBoxHeight;
|
|
178
|
+
const scaleRate = maxHeight / itemBoxHeight;
|
|
179
|
+
const targetPercent = focusMiddle / maxHeight; // 居中目标位置的百分比
|
|
180
|
+
/**
|
|
181
|
+
* anchor计算说明
|
|
182
|
+
* 考虑[0,1]的线段, 以a(0 <= a <= 1)为锚点, 放大n倍(n > 1)
|
|
183
|
+
* 坐标的映射关系为 x -> n(x - a) + a
|
|
184
|
+
* 此处我们想要的是目标焦点的中线对齐0.5, 即targetPercent放大后的位置是0.5
|
|
185
|
+
* 所以方程为 scaleRate * (targetPercent - anchor) + anchor = 0.5
|
|
186
|
+
*/
|
|
187
|
+
anchor = (scaleRate * targetPercent - 0.5) / (scaleRate - 1);
|
|
188
|
+
}
|
|
189
|
+
return anchor;
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
const foldSubTab = () => {
|
|
193
|
+
if (!folded.value) {
|
|
194
|
+
updateWidgetHeight(itemBoxHeight, function () {
|
|
195
|
+
folded.value = true;
|
|
196
|
+
});
|
|
197
|
+
focusHub.returnFocusToParent();
|
|
198
|
+
}
|
|
199
|
+
props.foldEvent();
|
|
200
|
+
props.onExpandHeight?.(0);
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
const expand = (type) => {
|
|
204
|
+
if (folded.value && props.data.expandChildren.length > 0) {
|
|
205
|
+
widgetTop.value = itemBoxHeight;
|
|
206
|
+
/**
|
|
207
|
+
* 动画未结束时, widgetTop不为0, 此时又获焦那一帧同时设置的widgetTop值未同步到div, slideToDiv获取的就不是展开后item的正确位置
|
|
208
|
+
*/
|
|
209
|
+
folded.value = false;
|
|
210
|
+
if (!type) {
|
|
211
|
+
nextTick(() => {
|
|
212
|
+
widgetRef.value.setFocusId(0);
|
|
213
|
+
focusHub.setFocus(props.name + "_" + props.query.index);
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
props.onExpandHeight?.(expandChildrenHeight.value);
|
|
217
|
+
|
|
218
|
+
nextTick(() => {
|
|
219
|
+
updateWidgetHeight(expandChildrenHeight.value + itemBoxHeight);
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
props.foldEvent();
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
//在回调中更改自身状态
|
|
226
|
+
const onFocus = () => {
|
|
227
|
+
focused.value = true;
|
|
228
|
+
if (parentWidget.value && divRef.value) {
|
|
229
|
+
parentWidget.value.slideToDiv(divRef.value, true);
|
|
230
|
+
}
|
|
231
|
+
if (!folded.value) {
|
|
232
|
+
focusHub.setFocus(props.name + "_" + props.query.index);
|
|
233
|
+
} else {
|
|
234
|
+
if (props.onFocus) {
|
|
235
|
+
props.onFocus(props.data, props.query);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
const onBlur = () => {
|
|
241
|
+
focused.value = false;
|
|
242
|
+
if (props.onBlur) {
|
|
243
|
+
props.onBlur(props.data, props.query);
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
const onClick = () => {
|
|
248
|
+
if (folded.value) {
|
|
249
|
+
expand();
|
|
250
|
+
} else {
|
|
251
|
+
// foldSubTab()
|
|
252
|
+
}
|
|
253
|
+
if (props.onClick) {
|
|
254
|
+
props.onClick(props.data, props.query);
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
// 无论widget是否获焦 item获焦
|
|
259
|
+
const onGaze = () => {
|
|
260
|
+
gazed.value = true;
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
// 无论widget是否获焦 item失焦
|
|
264
|
+
const onIgnore = () => {
|
|
265
|
+
gazed.value = false;
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
// 子列表获焦
|
|
269
|
+
const onChildFocus = (data, query) => {
|
|
270
|
+
if (props.onFocus) {
|
|
271
|
+
props.onFocus(data, query);
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
// 子列表按键
|
|
276
|
+
const childKeyDown = (e) => {
|
|
277
|
+
if (e.keyCode === 10000 || e.keyCode === 8 || e.keyCode === 27) {
|
|
278
|
+
foldSubTab();
|
|
279
|
+
return true;
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
const onChildEdge = (edgeInfo) => {
|
|
284
|
+
if (edgeInfo.direction === EdgeDirection.top) {
|
|
285
|
+
foldSubTab();
|
|
286
|
+
} else if (edgeInfo.direction === EdgeDirection.bottom) {
|
|
287
|
+
foldSubTab();
|
|
288
|
+
props.onItemEdge(edgeInfo);
|
|
289
|
+
} else {
|
|
290
|
+
props.onItemEdge(edgeInfo);
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
let preHeight = itemBoxHeight;
|
|
295
|
+
const updateWidgetHeight = (h, callback) => {
|
|
296
|
+
const anchor = getAnchor(0);
|
|
297
|
+
//创建动画
|
|
298
|
+
const anim = getClipAnimation(preHeight, h, anchor);
|
|
299
|
+
preHeight = h;
|
|
300
|
+
clipAnimStr.value = anim.clip;
|
|
301
|
+
slideAnimStr.value = anim.slide;
|
|
302
|
+
props.query.updateItemSize(
|
|
303
|
+
props.query.index,
|
|
304
|
+
{
|
|
305
|
+
width: props.data.itemStyle.width,
|
|
306
|
+
height: h,
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
anchor,
|
|
310
|
+
duration: duration,
|
|
311
|
+
onEnd: () => {
|
|
312
|
+
callback && callback();
|
|
313
|
+
console.log("unfold anim end.");
|
|
314
|
+
},
|
|
315
|
+
}
|
|
316
|
+
);
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
// 注册回调
|
|
320
|
+
props.onAction.register("onFocus", onFocus);
|
|
321
|
+
props.onAction.register("onBlur", onBlur);
|
|
322
|
+
props.onAction.register("onClick", onClick);
|
|
323
|
+
props.onAction.register("onGaze", onGaze);
|
|
324
|
+
props.onAction.register("onIgnore", onIgnore);
|
|
325
|
+
|
|
326
|
+
</script>
|
|
327
|
+
|
|
328
|
+
<template>
|
|
329
|
+
<div
|
|
330
|
+
ref="divRef"
|
|
331
|
+
v-if="folded"
|
|
332
|
+
:style="focused ? focusStyle : gazed ? blurStyle : itemStyle"
|
|
333
|
+
>
|
|
334
|
+
<div
|
|
335
|
+
v-if="imgStyle"
|
|
336
|
+
:style="focused ? focusImgStyle : gazed ? blurImgStyle : imgStyle"
|
|
337
|
+
></div>
|
|
338
|
+
<div v-if="iconStyle" :style="iconStyle"></div>
|
|
339
|
+
<!-- 正常显示文字 -->
|
|
340
|
+
<div v-if="data.data.textVisible">
|
|
341
|
+
<jsv-marquee
|
|
342
|
+
v-if="focused"
|
|
343
|
+
:style="focusTextStyle"
|
|
344
|
+
:text="data.data.name"
|
|
345
|
+
></jsv-marquee>
|
|
346
|
+
<div v-else :style="gazed ? blurTextStyle : textStyle">
|
|
347
|
+
{{ data.data?.name }}
|
|
348
|
+
</div>
|
|
349
|
+
</div>
|
|
350
|
+
</div>
|
|
351
|
+
<div
|
|
352
|
+
v-else
|
|
353
|
+
:style="{
|
|
354
|
+
width: data.itemStyle.width,
|
|
355
|
+
height: expandChildrenHeight + itemBoxHeight,
|
|
356
|
+
overflow: 'hidden',
|
|
357
|
+
animation: clipAnimStr,
|
|
358
|
+
}"
|
|
359
|
+
>
|
|
360
|
+
<div :style="blurStyle">
|
|
361
|
+
<div v-if="imgStyle" :style="blurImgStyle"></div>
|
|
362
|
+
<div v-if="iconStyle" :style="blurIconStyle"></div>
|
|
363
|
+
<div v-if="data.data.textVisible">
|
|
364
|
+
<div :style="blurTextStyle">{{ data.data?.name }}</div>
|
|
365
|
+
</div>
|
|
366
|
+
</div>
|
|
367
|
+
<jsv-focus-block
|
|
368
|
+
:style="{
|
|
369
|
+
top: itemBoxHeight,
|
|
370
|
+
width: data.itemStyle.width,
|
|
371
|
+
height: expandChildrenHeight,
|
|
372
|
+
backgroundColor: 'rgba(0, 0, 0, .2)',
|
|
373
|
+
borderRadius: 20,
|
|
374
|
+
}"
|
|
375
|
+
:onKeyDown="childKeyDown"
|
|
376
|
+
>
|
|
377
|
+
<WidgetListHandler
|
|
378
|
+
ref="widgetRef"
|
|
379
|
+
:layout="{
|
|
380
|
+
left: 0,
|
|
381
|
+
top: 0,
|
|
382
|
+
width: data.itemStyle.width,
|
|
383
|
+
height: expandChildrenHeight,
|
|
384
|
+
}"
|
|
385
|
+
:name="props.name + '_' + props.query.index"
|
|
386
|
+
:data="data.expandChildren"
|
|
387
|
+
:onWidgetFocus="onChildFocus"
|
|
388
|
+
:onEdge="onChildEdge"
|
|
389
|
+
:fullDisplayMode="true"
|
|
390
|
+
>
|
|
391
|
+
<template #item="slotProps">
|
|
392
|
+
<ChildItem
|
|
393
|
+
v-bind="slotProps"
|
|
394
|
+
:name="props.name + '_' + props.query.index"
|
|
395
|
+
:foldEvent="props.foldEvent"
|
|
396
|
+
/>
|
|
397
|
+
</template>
|
|
398
|
+
</WidgetListHandler>
|
|
399
|
+
</jsv-focus-block>
|
|
400
|
+
</div>
|
|
401
|
+
</template>
|
|
402
|
+
|
|
403
|
+
<style scoped></style>
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
<!-- 通用Widget处理器 -->
|
|
2
|
+
<template>
|
|
3
|
+
<list-widget
|
|
4
|
+
ref="metroWidgetRef"
|
|
5
|
+
:name="name"
|
|
6
|
+
:left="layout.left"
|
|
7
|
+
:top="layout.top"
|
|
8
|
+
:width="layout.width"
|
|
9
|
+
:height="layout.height"
|
|
10
|
+
:padding="layout.padding"
|
|
11
|
+
:provideData="provideData"
|
|
12
|
+
:direction="direction === 'V' ? VERTICAL : HORIZONTAL"
|
|
13
|
+
:measures="measures"
|
|
14
|
+
:fullDisplayMode="fullDisplayMode"
|
|
15
|
+
:onSizeChange="onSizeChange"
|
|
16
|
+
>
|
|
17
|
+
<template #renderItem="{ data, onAction, query, onItemEdge }">
|
|
18
|
+
<slot
|
|
19
|
+
name="item"
|
|
20
|
+
:data="data"
|
|
21
|
+
:onAction="onAction"
|
|
22
|
+
:query="query"
|
|
23
|
+
:onClick="onClick"
|
|
24
|
+
:onFocus="onFocus"
|
|
25
|
+
:onBlur="onBlur"
|
|
26
|
+
:onItemEdge="onItemEdge"
|
|
27
|
+
></slot>
|
|
28
|
+
</template>
|
|
29
|
+
</list-widget>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<script setup>
|
|
33
|
+
import {
|
|
34
|
+
ListWidget,
|
|
35
|
+
VERTICAL, // 定义MetroWidget方向的Symbol
|
|
36
|
+
HORIZONTAL,
|
|
37
|
+
} from 'jsview'
|
|
38
|
+
|
|
39
|
+
import { ref, onMounted, watch } from 'vue'
|
|
40
|
+
const props = defineProps({
|
|
41
|
+
name: String,
|
|
42
|
+
data: Array,
|
|
43
|
+
direction: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: 'V',
|
|
46
|
+
},
|
|
47
|
+
layout: {
|
|
48
|
+
type: Object,
|
|
49
|
+
default: () => {
|
|
50
|
+
return {
|
|
51
|
+
left: 0,
|
|
52
|
+
top: 0,
|
|
53
|
+
width: 0,
|
|
54
|
+
height: 0,
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
onWidgetFocus: Function,
|
|
59
|
+
onWidgetClick: Function,
|
|
60
|
+
onWidgetBlur: Function,
|
|
61
|
+
fullDisplayMode: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
default: false,
|
|
64
|
+
},
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
const onSizeChange = (size) => {
|
|
68
|
+
console.log('myt onSizeChange', props.name, size)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const metroWidgetRef = ref(null)
|
|
72
|
+
|
|
73
|
+
//提供数据的回调
|
|
74
|
+
const provideData = () => {
|
|
75
|
+
return props.data
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// 提供item布局信息的回调
|
|
79
|
+
const measures = (data) => {
|
|
80
|
+
return {
|
|
81
|
+
left: data.left,
|
|
82
|
+
top: data.top,
|
|
83
|
+
width: data.width,
|
|
84
|
+
height: data.height,
|
|
85
|
+
marginRight: data.marginRight,
|
|
86
|
+
marginBottom: data.marginBottom,
|
|
87
|
+
focusable: !data.focusdisable
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const onFocus = (data, query) => {
|
|
92
|
+
if (props.onWidgetFocus) {
|
|
93
|
+
props.onWidgetFocus(data, query)
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const onClick = (data, query) => {
|
|
98
|
+
// 记录离开页面时的焦点
|
|
99
|
+
if (props.onWidgetClick) {
|
|
100
|
+
props.onWidgetClick(data, query)
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const onBlur = (data, query) => {
|
|
105
|
+
if (props.onWidgetBlur) {
|
|
106
|
+
props.onWidgetBlur(data, query)
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
onMounted(() => {
|
|
112
|
+
watch(
|
|
113
|
+
() => props.data,
|
|
114
|
+
(arr) => {
|
|
115
|
+
metroWidgetRef.value?.refreshData()
|
|
116
|
+
},
|
|
117
|
+
{ deep: true, immediate: true }
|
|
118
|
+
)
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
const setFocusId = (id) => {
|
|
122
|
+
metroWidgetRef.value.setFocusId(id, true, true)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const setEnterFocusId = (id) => {
|
|
126
|
+
metroWidgetRef.value.setEnterFocusId(id)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const slideToDiv = (div, anim) => {
|
|
130
|
+
metroWidgetRef.value.slideToDiv(div, anim)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const getItemLayoutInfo = (index) => {
|
|
134
|
+
return metroWidgetRef.value?.getItemLayoutInfo(index)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const getCurrentFocusIndex = () => {
|
|
138
|
+
return metroWidgetRef.value?.getCurrentFocusIndex()
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
defineExpose({
|
|
142
|
+
setFocusId,
|
|
143
|
+
setEnterFocusId,
|
|
144
|
+
slideToDiv,
|
|
145
|
+
getItemLayoutInfo,
|
|
146
|
+
getCurrentFocusIndex,
|
|
147
|
+
})
|
|
148
|
+
</script>
|
|
149
|
+
|
|
150
|
+
<style scoped></style>
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
ref="knowledgeGraphRef"
|
|
4
|
+
:style="{
|
|
5
|
+
width: 1280,
|
|
6
|
+
height: 720,
|
|
7
|
+
backgroundColor: '#007788',
|
|
8
|
+
}"
|
|
9
|
+
>
|
|
10
|
+
<WidgetListHandler
|
|
11
|
+
name="chapterList"
|
|
12
|
+
ref="chapterListRef"
|
|
13
|
+
:layout="{
|
|
14
|
+
left: 20,
|
|
15
|
+
top: 20,
|
|
16
|
+
width: 300,
|
|
17
|
+
height: 566,
|
|
18
|
+
}"
|
|
19
|
+
:data="chapterListData"
|
|
20
|
+
:onScroll="chapterListScroll"
|
|
21
|
+
:onWidgetFocus="chapterListFocus"
|
|
22
|
+
:onEdge="chapterListEdge"
|
|
23
|
+
:fullDisplayMode="false"
|
|
24
|
+
>
|
|
25
|
+
<template #item="slotProps">
|
|
26
|
+
<ExpandItem
|
|
27
|
+
v-if="isLargeScreen"
|
|
28
|
+
v-bind="slotProps"
|
|
29
|
+
:foldEvent="updateScroll"
|
|
30
|
+
/>
|
|
31
|
+
<ExpandItem2 v-else v-bind="slotProps" :foldEvent="updateScroll" />
|
|
32
|
+
</template>
|
|
33
|
+
</WidgetListHandler>
|
|
34
|
+
<!-- 滚动条 -->
|
|
35
|
+
<div
|
|
36
|
+
:style="{
|
|
37
|
+
width: 6,
|
|
38
|
+
height: scrollHeight,
|
|
39
|
+
left: 332,
|
|
40
|
+
top: scrollTop + 18,
|
|
41
|
+
borderRadius: 4,
|
|
42
|
+
backgroundColor: '#6B7DF5',
|
|
43
|
+
}"
|
|
44
|
+
></div>
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<script setup>
|
|
49
|
+
import { useFocusHub } from "jsview";
|
|
50
|
+
import { ref, onMounted, nextTick, provide } from "vue";
|
|
51
|
+
import WidgetListHandler from "./components/WidgetListHandler.vue";
|
|
52
|
+
import ExpandItem from "./ExpandItem.vue";
|
|
53
|
+
import ExpandItem2 from "./ExpandItem1.vue";
|
|
54
|
+
import { data } from "./list";
|
|
55
|
+
const chapterListData = ref(data);
|
|
56
|
+
const scrollHeight = ref(0);
|
|
57
|
+
const scrollTop = ref(0);
|
|
58
|
+
const chapterListRef = ref(null);
|
|
59
|
+
const isLargeScreen = true;
|
|
60
|
+
const focusHub = useFocusHub();
|
|
61
|
+
|
|
62
|
+
// 章节列表滚动
|
|
63
|
+
const chapterListScroll = (top, range, size) => {
|
|
64
|
+
console.log("range的值", range, size);
|
|
65
|
+
if (size > range) {
|
|
66
|
+
scrollHeight.value = (range * range) / size;
|
|
67
|
+
} else {
|
|
68
|
+
scrollHeight.value = 0;
|
|
69
|
+
}
|
|
70
|
+
scrollTop.value = (range * top) / size;
|
|
71
|
+
};
|
|
72
|
+
const chapterListFocus = (data, query) => {
|
|
73
|
+
console.log(1);
|
|
74
|
+
};
|
|
75
|
+
const chapterListEdge = (direction) => {
|
|
76
|
+
console.log("chapterListEdge", direction);
|
|
77
|
+
};
|
|
78
|
+
const updateScroll = (top, range, size) => {
|
|
79
|
+
// chapterListScroll(top, range, size)
|
|
80
|
+
};
|
|
81
|
+
onMounted(() => {
|
|
82
|
+
console.log("chapterListRef", chapterListRef.value);
|
|
83
|
+
nextTick(() => {
|
|
84
|
+
focusHub.setFocus("chapterList");
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
provide("parentWidget", chapterListRef);
|
|
88
|
+
</script>
|