@shijiu/jsview-vue-samples 2.2.426-test.0 → 2.3.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/BakeViewDemo/AnimatePic.vue +1 -1
- package/Basic/components/text/TextDirection.vue +7 -1
- package/BasicFocusControl/components/BaseBlock.vue +65 -18
- package/BreakRender/assets/imageList.json +235 -235
- package/ColorSpace/App.vue +2 -2
- package/CoupletsTest/App.vue +1 -1
- package/CoupletsTest/widget/Banger/Banger.vue +3 -3
- package/CoupletsTest/widget/Banger/MaroonLoader.vue +5 -5
- package/CoupletsTest/widget/Couplets/Couplets.vue +4 -4
- package/CoupletsTest/widget/Fireworks/Fireworks.vue +13 -13
- package/CustomShader/App.vue +4 -4
- package/CustomShader/gaussianBlur.glsl +1 -1
- package/DashPath/App.vue +79 -0
- package/DashPath/AppForOperator.vue +35 -0
- package/DashPath/DashPath.vue +118 -0
- package/DemoForOperator/AnimPic/AnimPic.vue +47 -0
- package/DemoForOperator/AnimPic/App.vue +28 -0
- package/DemoForOperator/Banger/App.vue +26 -0
- package/DemoForOperator/Banger/Banger/Banger.vue +252 -0
- package/DemoForOperator/Banger/Banger/Maroon.vue +123 -0
- package/DemoForOperator/Banger/Banger/MaroonLoader.vue +78 -0
- package/DemoForOperator/Banger/Banger/SpriteDeal.js +30 -0
- package/DemoForOperator/Bounce/App.vue +43 -0
- package/DemoForOperator/Bounce/Bounce.vue +49 -0
- package/DemoForOperator/Bounce/FreeMoveBuilder.js +139 -0
- package/DemoForOperator/ChunLian/App.vue +47 -0
- package/DemoForOperator/ChunLian/Couplets.vue +248 -0
- package/DemoForOperator/EpisodeList/App.vue +80 -0
- package/DemoForOperator/EpisodeList/EpisodeList/Controller.vue +113 -0
- package/DemoForOperator/EpisodeList/EpisodeList/EpisodeList.vue +176 -0
- package/DemoForOperator/EpisodeList/GroupItem.vue +65 -0
- package/DemoForOperator/EpisodeList/ListItem.vue +48 -0
- package/DemoForOperator/Firework1/App.vue +25 -0
- package/DemoForOperator/Firework1/Fireworks.vue +358 -0
- package/DemoForOperator/Firework1/SpriteDeal.js +30 -0
- package/DemoForOperator/FlipPage/App.vue +75 -0
- package/DemoForOperator/FlipPage/FlipPage/FlipPage.vue +150 -0
- package/DemoForOperator/FlipPage/FlipPage/flipIn.glsl +41 -0
- package/DemoForOperator/FlipPage/FlipPage/flipOut.glsl +41 -0
- package/DemoForOperator/Focus/Alpha/AlphaFocusBox.vue +70 -0
- package/DemoForOperator/Focus/Alpha/AlphaPage.vue +40 -0
- package/DemoForOperator/Focus/Alpha/Item.vue +64 -0
- package/DemoForOperator/Focus/App.vue +124 -0
- package/DemoForOperator/Focus/CommonPageSetting.js +30 -0
- package/DemoForOperator/Focus/Item.vue +46 -0
- package/DemoForOperator/Focus/Light/Item.vue +67 -0
- package/DemoForOperator/Focus/Light/LightFocusBox.vue +46 -0
- package/DemoForOperator/Focus/Light/LightPage.vue +43 -0
- package/DemoForOperator/Focus/Light/utils/FrameCanvasStore.ts +68 -0
- package/DemoForOperator/Focus/Light/utils/RotateFrame.vue +146 -0
- package/DemoForOperator/Focus/Light/utils/circleHaloMask.png +0 -0
- package/DemoForOperator/Focus/Normal/Item.vue +64 -0
- package/DemoForOperator/Focus/Normal/NormalFocusBox.vue +53 -0
- package/DemoForOperator/Focus/Normal/NormalPage.vue +41 -0
- package/DemoForOperator/Focus/SwipeLight/Item.vue +73 -0
- package/DemoForOperator/Focus/SwipeLight/SwipeLightBox.vue +62 -0
- package/DemoForOperator/Focus/SwipeLight/SwipeLightPage.vue +44 -0
- package/DemoForOperator/FullscreenIn/App.vue +105 -0
- package/DemoForOperator/FullscreenIn/FullscreenPoster.vue +41 -0
- package/DemoForOperator/FullscreenIn/Item.vue +50 -0
- package/DemoForOperator/Genie/App.vue +78 -0
- package/DemoForOperator/Genie/geniePakcer/Genie.vue +699 -0
- package/DemoForOperator/Genie/geniePakcer/genieBottom.glsl +49 -0
- package/DemoForOperator/Genie/geniePakcer/genieLeft.glsl +50 -0
- package/DemoForOperator/Genie/geniePakcer/genieRight.glsl +57 -0
- package/DemoForOperator/Genie/geniePakcer/genieTop.glsl +50 -0
- package/DemoForOperator/GrayFilter/App.vue +51 -0
- package/DemoForOperator/GrayFilter/GrayFilter.vue +38 -0
- package/DemoForOperator/Jigsaw/App.vue +45 -0
- package/DemoForOperator/Jigsaw/JigsawFull.vue +100 -0
- package/DemoForOperator/Jigsaw/JigsawSingle.vue +86 -0
- package/DemoForOperator/Particle/App.vue +69 -0
- package/DemoForOperator/Particle/Drop/DropParticle.vue +176 -0
- package/DemoForOperator/Particle/Explode/ExplodeParticle.vue +99 -0
- package/DemoForOperator/PosterAnim/App.vue +125 -0
- package/DemoForOperator/PosterAnim/Bounce/BouncePage.vue +54 -0
- package/DemoForOperator/PosterAnim/Bounce/Item.vue +85 -0
- package/DemoForOperator/PosterAnim/Breath/BreathPage.vue +47 -0
- package/DemoForOperator/PosterAnim/Breath/Item.vue +58 -0
- package/DemoForOperator/PosterAnim/CommonPageSetting.js +30 -0
- package/DemoForOperator/PosterAnim/Item.vue +46 -0
- package/DemoForOperator/PosterAnim/PosterAnim.js +58 -0
- package/DemoForOperator/PosterAnim/Scale/Item.vue +72 -0
- package/DemoForOperator/PosterAnim/Scale/ScalePage.vue +48 -0
- package/DemoForOperator/PosterAnim/Shake/Item.vue +85 -0
- package/DemoForOperator/PosterAnim/Shake/ShakePage.vue +53 -0
- package/DemoForOperator/PosterOverflow/App.vue +116 -0
- package/DemoForOperator/PosterOverflow/Item.vue +67 -0
- package/DemoForOperator/PosterOverflow/PosterOverflow.vue +23 -0
- package/DemoForOperator/Ripple/App.vue +54 -0
- package/DemoForOperator/Ripple/Ripple.vue +50 -0
- package/DemoForOperator/ScalePoster/App.vue +4 -0
- package/DemoForOperator/ScalePoster/ScalePoster.vue +0 -0
- package/DemoForOperator/Sprite/App.vue +33 -0
- package/DemoForOperator/Sprite/Sprite.vue +90 -0
- package/DemoForOperator/Stretch/App.vue +103 -0
- package/DemoForOperator/Stretch/Stretch/Item.vue +192 -0
- package/DemoForOperator/Stretch/Stretch/Stretch.vue +168 -0
- package/DemoForOperator/TabContent/App.vue +89 -0
- package/DemoForOperator/TabContent/ContentPage.vue +66 -0
- package/DemoForOperator/TabContent/Item.vue +85 -0
- package/DemoForOperator/TabContent/PageItem.vue +40 -0
- package/DemoForOperator/TabContent/TabContent/CreepFocus.vue +160 -0
- package/DemoForOperator/TabContent/TabContent/Item.vue +63 -0
- package/DemoForOperator/TabContent/TabContent/TabContent.vue +146 -0
- package/DemoForOperator/TabContent/TabContent/TabItem.vue +368 -0
- package/DemoForOperator/TabContent/TabContent/TabWidget.vue +243 -0
- package/DemoForOperator/TabContent/TabContent/Util.js +3 -0
- package/DemoForOperator/TabContent/TabContent/ViewSwiper.vue +110 -0
- package/DemoForOperator/TabContent/testData.js +241 -0
- package/DemoForOperator/Vortex/App.vue +78 -0
- package/DemoForOperator/Vortex/Vortex/Vortex.vue +154 -0
- package/DemoForOperator/Vortex/Vortex/vortexIn.glsl +38 -0
- package/DemoForOperator/Vortex/Vortex/vortexOut.glsl +38 -0
- package/DemoForOperator/index.js +6 -0
- package/DemoForOperator/routeList.js +142 -0
- package/DemoHomepage/App.vue +50 -30
- package/DemoHomepage/components/Dialog.vue +1 -0
- package/DemoHomepage/components/TabFrame.vue +7 -0
- package/DemoHomepage/router.js +104 -81
- package/DemoHomepage/views/Homepage.vue +7 -2
- package/DivMetroPerformance/data.js +3 -3
- package/DriftScopeTest/App.vue +1 -1
- package/FilterDemo/AnimatePic.vue +1 -1
- package/FilterDemo/VideoLayer.vue +2 -2
- package/FullScreenFlex/TestFrame2.vue +1 -1
- package/GiftRain/App.vue +12 -12
- package/JsvPreDownloader/App.vue +4 -4
- package/MediaDemo/components/frames/AudioFrame.vue +1 -1
- package/MediaDemo/components/frames/VideoFrame.vue +1 -1
- package/MetroWidgetDemos/MassiveItems/ContentItem.vue +1 -1
- package/MetroWidgetDemos/MassiveItems/data.js +1 -1
- package/MetroWidgetDemos/PerformanceTest/data.js +3 -3
- package/MetroWidgetDemos/RefreshDemo/assets/imageList.json +235 -235
- package/MetroWidgetDemos/SkeletonDiagram/assets/imageList.json +235 -235
- package/MetroWidgetDemos/focusableItemMetroWidget/WidgetItem.vue +3 -1
- package/MetroWidgetDemos/routeList.js +17 -17
- package/Poster3d/App.vue +69 -0
- package/Poster3d/Poster3d.vue +92 -0
- package/PosterPacker/App.vue +3 -3
- package/PosterPacker/tools/vortexPacker/Vortex.vue +1 -1
- package/QrcodeDemo/App.vue +1 -1
- package/Ripple/App.vue +1 -1
- package/ScaleDownNeon/App.vue +4 -4
- package/SceneTransition/App.vue +2 -2
- package/SceneTransition/maskConfig/config2.js +12 -12
- package/SceneTransition/maskConfig/config3.js +14 -14
- package/SprayView/App.vue +96 -51
- package/SpringFestival/App.vue +73 -0
- package/SpringFestival/SpringFestivalScene/ChunLian.vue +211 -0
- package/SpringFestival/SpringFestivalScene/FreeMoveBuilder.js +139 -0
- package/SpringFestival/SpringFestivalScene/LanternAnim.js +60 -0
- package/SpringFestival/SpringFestivalScene/Rain.vue +137 -0
- package/SpringFestival/SpringFestivalScene/Scene.vue +218 -0
- package/SpringFestival/SpringFestivalScene/imageConfig.js +87 -0
- package/SpringFestival/SpringFestivalScene/index.js +1 -0
- package/Swiper/App.vue +28 -29
- package/Swiper/Item.vue +19 -0
- package/SwiperTest/App.vue +9 -9
- package/TestNativeSharedView/AckEventDefine.ts +82 -0
- package/TestNativeSharedView/App.vue +4 -6
- package/TestNativeSharedView/JsvDemoTester.js +131 -0
- package/TextureAnimation/App.vue +16 -6
- package/TextureAnimation/App3.vue +100 -0
- package/TextureAnimation/utils/FrameCanvasStore.ts +68 -0
- package/TextureAnimation/utils/RotateFrame.vue +146 -0
- package/TextureAnimation/utils/circleHaloMask.png +0 -0
- package/TombSweepingDayTest/Raining/RainScene.vue +4 -4
- package/ViewOpacity/App.vue +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:style="{
|
|
4
|
+
width: 1280,
|
|
5
|
+
height: 720,
|
|
6
|
+
backgroundColor: '#007788',
|
|
7
|
+
}"
|
|
8
|
+
></div>
|
|
9
|
+
|
|
10
|
+
<couplets
|
|
11
|
+
:sourceMap="sourceMap"
|
|
12
|
+
:leftPosition="leftPosition"
|
|
13
|
+
:rightPosition="rightPosition"
|
|
14
|
+
:size="size"
|
|
15
|
+
:duration="2"
|
|
16
|
+
></couplets>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script setup>
|
|
20
|
+
import Couplets from "./Couplets.vue";
|
|
21
|
+
const leftImage = "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/DemoForOperator/ChunLian/App/couplet_left.png";
|
|
22
|
+
const rightImage = "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/DemoForOperator/ChunLian/App/couplet_right.png";
|
|
23
|
+
const scrollSprite = "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/DemoForOperator/ChunLian/App/scroll.png";
|
|
24
|
+
const scrollStatic = "https://cdn.release.qcast.cn/JsViewFrameworkTester/JsViewVueSampleResources/DemoForOperator/ChunLian/App/scroll_static.png";
|
|
25
|
+
|
|
26
|
+
const sourceMap = {
|
|
27
|
+
leftContent: leftImage,
|
|
28
|
+
rightContent: rightImage,
|
|
29
|
+
scrollSprite: scrollSprite,
|
|
30
|
+
scrollStatic: scrollStatic,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const size = {
|
|
34
|
+
width: 180,
|
|
35
|
+
height: 600,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const leftPosition = {
|
|
39
|
+
left: 100,
|
|
40
|
+
top: 30,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const rightPosition = {
|
|
44
|
+
left: 1000,
|
|
45
|
+
top: 30,
|
|
46
|
+
};
|
|
47
|
+
</script>
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* 【模块 export 内容】
|
|
3
|
+
* JsvCouplets:春联组件
|
|
4
|
+
* props说明:
|
|
5
|
+
* width {Number} 春联宽度
|
|
6
|
+
* duration {Number} 春联滚动时间
|
|
7
|
+
* left {Number} 春联Left位置
|
|
8
|
+
* top {Number} 春联Top位置
|
|
9
|
+
*
|
|
10
|
+
-->
|
|
11
|
+
<template>
|
|
12
|
+
<JsvPreload
|
|
13
|
+
:preloadList="preload_info"
|
|
14
|
+
:onPreloadDone="loadDone"
|
|
15
|
+
></JsvPreload>
|
|
16
|
+
<div v-for="layout in layouts">
|
|
17
|
+
<div
|
|
18
|
+
v-show="myShow"
|
|
19
|
+
:style="{
|
|
20
|
+
width: 180,
|
|
21
|
+
height: size.height,
|
|
22
|
+
top: layout.top,
|
|
23
|
+
left: layout.left,
|
|
24
|
+
transform: `scale3d(${size.width / 180},${size.width / 180},1)`,
|
|
25
|
+
transformOrigin: 'left top',
|
|
26
|
+
}"
|
|
27
|
+
>
|
|
28
|
+
<div
|
|
29
|
+
:style="{
|
|
30
|
+
top: 0,
|
|
31
|
+
left: 0,
|
|
32
|
+
width: 180,
|
|
33
|
+
height: size.height,
|
|
34
|
+
overflow: 'hidden',
|
|
35
|
+
animation: aniName1,
|
|
36
|
+
}"
|
|
37
|
+
>
|
|
38
|
+
<div
|
|
39
|
+
:style="{
|
|
40
|
+
top: 0,
|
|
41
|
+
left: 0,
|
|
42
|
+
width: 180,
|
|
43
|
+
height: size.height,
|
|
44
|
+
backgroundImage: layout.isLeft
|
|
45
|
+
? sourceMap.leftContent
|
|
46
|
+
: sourceMap.rightContent,
|
|
47
|
+
animation: aniName2,
|
|
48
|
+
}"
|
|
49
|
+
></div>
|
|
50
|
+
</div>
|
|
51
|
+
<!-- 滚轴动画 -->
|
|
52
|
+
<JsvSpriteLoader
|
|
53
|
+
:imageUrl="sourceMap.scrollSprite"
|
|
54
|
+
:configUrl="scrollJson"
|
|
55
|
+
:onConfigReady="preloadCallback"
|
|
56
|
+
:noNeedResource="false"
|
|
57
|
+
>
|
|
58
|
+
<div
|
|
59
|
+
:style="{
|
|
60
|
+
left: -30,
|
|
61
|
+
top: size.height,
|
|
62
|
+
transform: `scale3d(${(180 + 60) / view_size.w},1,1)`,
|
|
63
|
+
}"
|
|
64
|
+
>
|
|
65
|
+
<div
|
|
66
|
+
:style="{
|
|
67
|
+
width: view_size.w,
|
|
68
|
+
height: view_size.h,
|
|
69
|
+
animation: aniName1,
|
|
70
|
+
}"
|
|
71
|
+
>
|
|
72
|
+
<JsvSpriteAnim
|
|
73
|
+
:spriteInfo="sprite_info.info"
|
|
74
|
+
:loop="4"
|
|
75
|
+
:duration="props.duration / 4"
|
|
76
|
+
:imageUrl="sourceMap.scrollSprite"
|
|
77
|
+
ref="myRef"
|
|
78
|
+
>
|
|
79
|
+
</JsvSpriteAnim>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
</JsvSpriteLoader>
|
|
83
|
+
<!-- 滚轴图片 -->
|
|
84
|
+
<div
|
|
85
|
+
:style="{
|
|
86
|
+
top: -30,
|
|
87
|
+
left: -30,
|
|
88
|
+
width: 180 + 60,
|
|
89
|
+
height: 30,
|
|
90
|
+
backgroundImage: sourceMap.scrollStatic,
|
|
91
|
+
}"
|
|
92
|
+
></div>
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
</template>
|
|
96
|
+
|
|
97
|
+
<script setup>
|
|
98
|
+
import {
|
|
99
|
+
JsvSpriteAnim,
|
|
100
|
+
getKeyFramesGroup,
|
|
101
|
+
JsvSpriteLoader,
|
|
102
|
+
JsvPreload,
|
|
103
|
+
buildPreloadInfo,
|
|
104
|
+
} from "jsview";
|
|
105
|
+
import { shallowRef, onBeforeUnmount, watch } from "vue";
|
|
106
|
+
const props = defineProps({
|
|
107
|
+
sourceMap: {
|
|
108
|
+
type: Object,
|
|
109
|
+
require: true,
|
|
110
|
+
validator: function (value) {
|
|
111
|
+
return (
|
|
112
|
+
"leftContent" in value &&
|
|
113
|
+
"rightContent" in value &&
|
|
114
|
+
"scrollSprite" in value &&
|
|
115
|
+
"scrollStatic" in value
|
|
116
|
+
);
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
size: {
|
|
120
|
+
type: Object,
|
|
121
|
+
required: true,
|
|
122
|
+
validator: function (value) {
|
|
123
|
+
return "width" in value && "height" in value;
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
leftPosition: {
|
|
127
|
+
type: Object,
|
|
128
|
+
require: true,
|
|
129
|
+
validator: function (value) {
|
|
130
|
+
return "left" in value && "top" in value;
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
rightPosition: {
|
|
134
|
+
type: Object,
|
|
135
|
+
require: true,
|
|
136
|
+
validator: function (value) {
|
|
137
|
+
return "left" in value && "top" in value;
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
duration: { type: Number, require: true },
|
|
141
|
+
});
|
|
142
|
+
const layouts = [{ ...props.leftPosition, isLeft: true }, props.rightPosition];
|
|
143
|
+
let myShow = shallowRef(false);
|
|
144
|
+
const scrollJson = props.sourceMap.scrollSprite.split("?")[0] + ".json";
|
|
145
|
+
|
|
146
|
+
//预加载
|
|
147
|
+
const preload_info = [
|
|
148
|
+
buildPreloadInfo(props.sourceMap.leftContent),
|
|
149
|
+
buildPreloadInfo(props.sourceMap.rightContent),
|
|
150
|
+
buildPreloadInfo(props.sourceMap.scrollSprite),
|
|
151
|
+
buildPreloadInfo(props.sourceMap.scrollStatic),
|
|
152
|
+
];
|
|
153
|
+
|
|
154
|
+
let readyNum = shallowRef(0);
|
|
155
|
+
const loadDone = (a) => {
|
|
156
|
+
readyNum.value++;
|
|
157
|
+
};
|
|
158
|
+
let sprite_info = shallowRef(null);
|
|
159
|
+
const view_size = shallowRef(null);
|
|
160
|
+
|
|
161
|
+
const _formatInfo = (action_json) => {
|
|
162
|
+
const info = {
|
|
163
|
+
frames: [],
|
|
164
|
+
meta: {
|
|
165
|
+
size: action_json.meta.size,
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
let frames_ref = info.frames;
|
|
169
|
+
let max_width = 0;
|
|
170
|
+
let max_height = 0;
|
|
171
|
+
|
|
172
|
+
for (let i = 0; i < action_json.frames.length; i++) {
|
|
173
|
+
const target = action_json.frames[i].spriteSourceSize;
|
|
174
|
+
frames_ref.push({
|
|
175
|
+
target,
|
|
176
|
+
source: action_json.frames[i].frame,
|
|
177
|
+
});
|
|
178
|
+
const sprite_with = target.x + target.w;
|
|
179
|
+
const sprite_height = target.y + target.h;
|
|
180
|
+
if (sprite_with > max_width) {
|
|
181
|
+
max_width = sprite_with;
|
|
182
|
+
}
|
|
183
|
+
if (sprite_height > max_height) {
|
|
184
|
+
max_height = sprite_height;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return { info, maxW: max_width, maxH: max_height };
|
|
188
|
+
};
|
|
189
|
+
const preloadCallback = (config_json, resolve_set) => {
|
|
190
|
+
sprite_info.value = _formatInfo(config_json);
|
|
191
|
+
view_size.value = {
|
|
192
|
+
w: sprite_info.value.maxW,
|
|
193
|
+
h: sprite_info.value.maxH,
|
|
194
|
+
};
|
|
195
|
+
resolve_set(); // 通知loader数组设置完成
|
|
196
|
+
readyNum.value++;
|
|
197
|
+
};
|
|
198
|
+
//动画名字
|
|
199
|
+
let aniName1 = shallowRef(null);
|
|
200
|
+
let aniName2 = shallowRef(null);
|
|
201
|
+
|
|
202
|
+
//插入动画
|
|
203
|
+
const idRandom = Math.floor(Math.random() * 1000000);
|
|
204
|
+
let name1 = "anim1-" + idRandom;
|
|
205
|
+
let name2 = "anim2-" + idRandom;
|
|
206
|
+
let styleShell = getKeyFramesGroup();
|
|
207
|
+
let anim1 = `@keyframes ${name1} {
|
|
208
|
+
from {
|
|
209
|
+
transform: translate3d(0,${-props.size.height}, 0);
|
|
210
|
+
}
|
|
211
|
+
to {
|
|
212
|
+
transform: translate3d(0, 0, 0);
|
|
213
|
+
}
|
|
214
|
+
}`;
|
|
215
|
+
styleShell.insertRule(anim1);
|
|
216
|
+
let anim2 = `@keyframes ${name2} {
|
|
217
|
+
from {
|
|
218
|
+
transform: translate3d(0,${props.size.height}, 0);
|
|
219
|
+
}
|
|
220
|
+
to {
|
|
221
|
+
transform: translate3d(0, 0, 0);
|
|
222
|
+
}
|
|
223
|
+
}`;
|
|
224
|
+
styleShell.insertRule(anim2);
|
|
225
|
+
|
|
226
|
+
let timer = { id: -1 };
|
|
227
|
+
//ref
|
|
228
|
+
let myRef = shallowRef(null);
|
|
229
|
+
watch(readyNum, (n, o) => {
|
|
230
|
+
if (o != 2 && n == 2) {
|
|
231
|
+
timer.id = setTimeout(() => {
|
|
232
|
+
myShow.value = true;
|
|
233
|
+
myRef.value?.forEach((i) => i.start());
|
|
234
|
+
aniName1.value = `${name1} ${props.duration}s linear`;
|
|
235
|
+
aniName2.value = `${name2} ${props.duration}s linear`;
|
|
236
|
+
}, 0);
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
onBeforeUnmount(() => {
|
|
241
|
+
styleShell.removeRule(name1);
|
|
242
|
+
styleShell.removeRule(name2);
|
|
243
|
+
clearTimeout(timer.id);
|
|
244
|
+
timer.id = -1;
|
|
245
|
+
});
|
|
246
|
+
</script>
|
|
247
|
+
|
|
248
|
+
<style scoped></style>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:style="{
|
|
4
|
+
width: 1280,
|
|
5
|
+
height: 720,
|
|
6
|
+
backgroundColor: '#007788',
|
|
7
|
+
}"
|
|
8
|
+
></div>
|
|
9
|
+
<EpisodeList
|
|
10
|
+
:name="name"
|
|
11
|
+
:listLayout="listLayout"
|
|
12
|
+
:groupLayout="groupLayout"
|
|
13
|
+
:numPerPage="numPerPage"
|
|
14
|
+
:listMeasures="listMeasures"
|
|
15
|
+
:groupMeasures="groupMeasures"
|
|
16
|
+
:totalNumber="totalNumber"
|
|
17
|
+
:listPadding="listPadding"
|
|
18
|
+
>
|
|
19
|
+
<template #listItem="{ data, onAction, query }">
|
|
20
|
+
<list-item :data="data" :onAction="onAction" :query="query" />
|
|
21
|
+
</template>
|
|
22
|
+
<template #groupItem="{ data, onAction, query }">
|
|
23
|
+
<group-item :data="data" :onAction="onAction" :query="query" />
|
|
24
|
+
</template>
|
|
25
|
+
</EpisodeList>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script setup>
|
|
29
|
+
import EpisodeList from "./EpisodeList/EpisodeList.vue";
|
|
30
|
+
import ListItem from "./ListItem.vue";
|
|
31
|
+
import GroupItem from "./GroupItem.vue";
|
|
32
|
+
import { onMounted } from "vue";
|
|
33
|
+
import { useFocusHub } from "jsview";
|
|
34
|
+
|
|
35
|
+
const focusHub = useFocusHub();
|
|
36
|
+
const name = "episodeList";
|
|
37
|
+
const listLayout = {
|
|
38
|
+
left: 80,
|
|
39
|
+
top: 100,
|
|
40
|
+
width: 940,
|
|
41
|
+
height: 120,
|
|
42
|
+
};
|
|
43
|
+
const groupLayout = {
|
|
44
|
+
left: 100,
|
|
45
|
+
top: 220,
|
|
46
|
+
width: 900,
|
|
47
|
+
height: 50,
|
|
48
|
+
};
|
|
49
|
+
const numPerPage = 10;
|
|
50
|
+
function listMeasures(index) {
|
|
51
|
+
return {
|
|
52
|
+
width: 80,
|
|
53
|
+
height: 80,
|
|
54
|
+
marginRight: 10,
|
|
55
|
+
data: {
|
|
56
|
+
content: index,
|
|
57
|
+
width: 80,
|
|
58
|
+
height: 80,
|
|
59
|
+
backgroundColor: "#ffffffaa",
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function groupMeasures(index) {
|
|
64
|
+
return {
|
|
65
|
+
width: 150,
|
|
66
|
+
height: 50,
|
|
67
|
+
marginRight: 10,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
const totalNumber = 400;
|
|
71
|
+
const listPadding = {
|
|
72
|
+
left: 20,
|
|
73
|
+
right: 20,
|
|
74
|
+
top: 20,
|
|
75
|
+
bottom: 20,
|
|
76
|
+
};
|
|
77
|
+
onMounted(() => {
|
|
78
|
+
focusHub.setFocus(name);
|
|
79
|
+
});
|
|
80
|
+
</script>
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2023-03-08 14:52:08
|
|
4
|
+
* @Description: file content
|
|
5
|
+
-->
|
|
6
|
+
<script setup>
|
|
7
|
+
import { MetroWidget, HORIZONTAL, useFocusHub, EdgeDirection } from "jsview";
|
|
8
|
+
import { ref } from "vue";
|
|
9
|
+
|
|
10
|
+
const widget = ref();
|
|
11
|
+
const props = defineProps({
|
|
12
|
+
name: String,
|
|
13
|
+
number: Number,
|
|
14
|
+
widgetHandler: Object,
|
|
15
|
+
numPerPage: Number,
|
|
16
|
+
measures: Function,
|
|
17
|
+
listName: String,
|
|
18
|
+
layout: Object,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const focusHub = useFocusHub();
|
|
22
|
+
|
|
23
|
+
let data = [];
|
|
24
|
+
const provideData = () => {
|
|
25
|
+
data = [];
|
|
26
|
+
const c = Math.ceil(props.number / props.numPerPage);
|
|
27
|
+
for (let i = 0; i < c; ++i) {
|
|
28
|
+
const m = props.measures(i);
|
|
29
|
+
data.push({
|
|
30
|
+
width: m.width,
|
|
31
|
+
height: m.height,
|
|
32
|
+
marginRight: m.marginRight,
|
|
33
|
+
from: i * props.numPerPage,
|
|
34
|
+
to: Math.min((i + 1) * props.numPerPage - 1, props.number - 1),
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return data;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const measures = (data) => {
|
|
41
|
+
return {
|
|
42
|
+
width: data.width,
|
|
43
|
+
height: data.height,
|
|
44
|
+
marginRight: data.marginRight,
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// callbacks
|
|
49
|
+
const onEdge = (edgeInfo) => {
|
|
50
|
+
if (edgeInfo.direction == EdgeDirection.top) {
|
|
51
|
+
focusHub.setFocus(props.listName);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const onBlur = () => {
|
|
56
|
+
if (!firstLock) {
|
|
57
|
+
props.widgetHandler.widget.value?.setFocusId(targetFocus, false, false);
|
|
58
|
+
}
|
|
59
|
+
firstLock = false;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
let targetFocus = 0;
|
|
63
|
+
|
|
64
|
+
let firstLock = false;
|
|
65
|
+
const setFocusId = (index) => {
|
|
66
|
+
targetFocus = index;
|
|
67
|
+
firstLock = true;
|
|
68
|
+
widget.value.setFocusId(index, true, true);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
function onFocusItemChange(id) {
|
|
72
|
+
if (firstLock) {
|
|
73
|
+
firstLock = false;
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
let itemData = data[id];
|
|
78
|
+
|
|
79
|
+
if (itemData) {
|
|
80
|
+
props.widgetHandler.widget.value?.setFocusId(itemData.from, false);
|
|
81
|
+
const itemPos = props.widgetHandler.widget.value?.getTemplatePosition(
|
|
82
|
+
itemData.from
|
|
83
|
+
);
|
|
84
|
+
props.widgetHandler.widget.value?.slideTo(itemPos.left);
|
|
85
|
+
targetFocus = itemData.from;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
defineExpose({
|
|
90
|
+
setFocusId,
|
|
91
|
+
});
|
|
92
|
+
</script>
|
|
93
|
+
|
|
94
|
+
<template>
|
|
95
|
+
<metro-widget
|
|
96
|
+
ref="widget"
|
|
97
|
+
:name="name"
|
|
98
|
+
:left="layout.left"
|
|
99
|
+
:top="layout.top"
|
|
100
|
+
:width="layout.width"
|
|
101
|
+
:height="layout.height"
|
|
102
|
+
:provideData="provideData"
|
|
103
|
+
:direction="HORIZONTAL"
|
|
104
|
+
:measures="measures"
|
|
105
|
+
:onEdge="onEdge"
|
|
106
|
+
:onBlur="onBlur"
|
|
107
|
+
:onFocusChange="onFocusItemChange"
|
|
108
|
+
>
|
|
109
|
+
<template #renderItem="{ data, onAction, query }">
|
|
110
|
+
<slot name="item" :onAction="onAction" :query="query" :data="data"></slot>
|
|
111
|
+
</template>
|
|
112
|
+
</metro-widget>
|
|
113
|
+
</template>
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2023-03-08 14:52:08
|
|
4
|
+
* @Description: file content
|
|
5
|
+
-->
|
|
6
|
+
<script>
|
|
7
|
+
let TOKEN = 0;
|
|
8
|
+
</script>
|
|
9
|
+
<script setup>
|
|
10
|
+
import {
|
|
11
|
+
MetroWidget,
|
|
12
|
+
HORIZONTAL,
|
|
13
|
+
useFocusHub,
|
|
14
|
+
SeamlessSlide,
|
|
15
|
+
EdgeDirection,
|
|
16
|
+
SlideSetting,
|
|
17
|
+
} from "jsview";
|
|
18
|
+
import Controller from "./Controller.vue";
|
|
19
|
+
import { onMounted, ref } from "vue";
|
|
20
|
+
|
|
21
|
+
const props = defineProps({
|
|
22
|
+
name: {
|
|
23
|
+
type: String,
|
|
24
|
+
},
|
|
25
|
+
listLayout: {
|
|
26
|
+
type: Object,
|
|
27
|
+
required: true,
|
|
28
|
+
},
|
|
29
|
+
groupLayout: {
|
|
30
|
+
type: Object,
|
|
31
|
+
required: true,
|
|
32
|
+
},
|
|
33
|
+
numPerPage: {
|
|
34
|
+
type: Number,
|
|
35
|
+
default: 10,
|
|
36
|
+
},
|
|
37
|
+
/* (index: Number) => {width: Number, height: Number, marginRight?: Number, data: Object} */
|
|
38
|
+
listMeasures: {
|
|
39
|
+
type: Function,
|
|
40
|
+
},
|
|
41
|
+
groupMeasures: {
|
|
42
|
+
type: Function,
|
|
43
|
+
},
|
|
44
|
+
totalNumber: {
|
|
45
|
+
type: Number,
|
|
46
|
+
},
|
|
47
|
+
listPadding: {
|
|
48
|
+
type: Object,
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const controller = ref(null);
|
|
53
|
+
const widget = ref(null);
|
|
54
|
+
const handler = {
|
|
55
|
+
widget,
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const slideObj = {
|
|
59
|
+
headRange: 0.5,
|
|
60
|
+
tailRange: 0.5,
|
|
61
|
+
};
|
|
62
|
+
const defaultSlide = new SeamlessSlide(slideObj);
|
|
63
|
+
|
|
64
|
+
const slide1 = new SeamlessSlide({
|
|
65
|
+
...slideObj,
|
|
66
|
+
boundaryProtect: SlideSetting.START_PROTECT,
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const focusHub = useFocusHub();
|
|
70
|
+
|
|
71
|
+
let t = TOKEN++;
|
|
72
|
+
const listName = props.name + "_list_" + t;
|
|
73
|
+
const controllerName = props.name + "_controller_" + t;
|
|
74
|
+
let curFocusName = listName;
|
|
75
|
+
|
|
76
|
+
const provideData = () => {
|
|
77
|
+
const data = [];
|
|
78
|
+
for (let i = 0; i < props.totalNumber; i++) {
|
|
79
|
+
const item = props.listMeasures(i);
|
|
80
|
+
data.push({
|
|
81
|
+
index: i,
|
|
82
|
+
data: item.data,
|
|
83
|
+
width: item.width,
|
|
84
|
+
height: item.height,
|
|
85
|
+
marginRight: item.marginRight,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
return data;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const measures = (data) => {
|
|
92
|
+
return {
|
|
93
|
+
width: data.width,
|
|
94
|
+
height: data.height,
|
|
95
|
+
marginRight: data.marginRight,
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
function onItemFocus(index) {
|
|
100
|
+
const ctrlItemIndex = Math.floor(index / props.numPerPage);
|
|
101
|
+
controller.value?.setFocusId(ctrlItemIndex);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const onEdge = (edgeInfo) => {
|
|
105
|
+
if (edgeInfo.direction == EdgeDirection.bottom) {
|
|
106
|
+
focusHub.setFocus(controllerName);
|
|
107
|
+
curFocusName = controllerName;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const onBlur = () => {
|
|
112
|
+
widget.value?.setSlideSetting(slide1);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const onFocus = () => {
|
|
116
|
+
widget.value?.setSlideSetting(null);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
onMounted(() => {});
|
|
120
|
+
|
|
121
|
+
function componentOnFocus() {
|
|
122
|
+
focusHub.setFocus(curFocusName);
|
|
123
|
+
}
|
|
124
|
+
</script>
|
|
125
|
+
|
|
126
|
+
<template>
|
|
127
|
+
<jsv-focus-block
|
|
128
|
+
:name="name"
|
|
129
|
+
:onAction="{
|
|
130
|
+
onFocus: componentOnFocus,
|
|
131
|
+
}"
|
|
132
|
+
>
|
|
133
|
+
<metro-widget
|
|
134
|
+
ref="widget"
|
|
135
|
+
:name="listName"
|
|
136
|
+
:left="listLayout.left"
|
|
137
|
+
:top="listLayout.top"
|
|
138
|
+
:width="listLayout.width"
|
|
139
|
+
:height="listLayout.height"
|
|
140
|
+
:provideData="provideData"
|
|
141
|
+
:direction="HORIZONTAL"
|
|
142
|
+
:measures="measures"
|
|
143
|
+
:onEdge="onEdge"
|
|
144
|
+
:onBlur="onBlur"
|
|
145
|
+
:onFocus="onFocus"
|
|
146
|
+
:initFocusId="0"
|
|
147
|
+
:slideSetting="defaultSlide"
|
|
148
|
+
:onFocusChange="onItemFocus"
|
|
149
|
+
:padding="listPadding"
|
|
150
|
+
>
|
|
151
|
+
<template #renderItem="{ data, onAction, query }">
|
|
152
|
+
<slot
|
|
153
|
+
name="listItem"
|
|
154
|
+
:data="data.data"
|
|
155
|
+
:onAction="onAction"
|
|
156
|
+
:query="query"
|
|
157
|
+
></slot>
|
|
158
|
+
</template>
|
|
159
|
+
</metro-widget>
|
|
160
|
+
|
|
161
|
+
<controller
|
|
162
|
+
ref="controller"
|
|
163
|
+
:name="controllerName"
|
|
164
|
+
:number="totalNumber"
|
|
165
|
+
:widgetHandler="handler"
|
|
166
|
+
:numPerPage="numPerPage"
|
|
167
|
+
:measures="groupMeasures"
|
|
168
|
+
:listName="listName"
|
|
169
|
+
:layout="groupLayout"
|
|
170
|
+
>
|
|
171
|
+
<template #item="slotProps">
|
|
172
|
+
<slot name="groupItem" v-bind="slotProps"></slot>
|
|
173
|
+
</template>
|
|
174
|
+
</controller>
|
|
175
|
+
</jsv-focus-block>
|
|
176
|
+
</template>
|