@shijiu/jsview-vue 1.9.731 → 1.9.747
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/index.d.ts +4 -1
- package/index.js +4 -1
- package/package.json +5 -16
- package/samples/AnimPicture/App.vue +0 -207
- package/samples/AnimPicture/assets/animated_webp.webp +0 -0
- package/samples/AnimPicture/assets/ball_3.webp +0 -0
- package/samples/AnimPicture/assets/girl_run.gif +0 -0
- package/samples/AnimPicture/assets/quan.webp +0 -0
- package/samples/Basic/App.vue +0 -134
- package/samples/Basic/assets/border.png +0 -0
- package/samples/Basic/assets/border2.png +0 -0
- package/samples/Basic/assets/icon.png +0 -0
- package/samples/Basic/assets/test.jpg +0 -0
- package/samples/Basic/components/ContentBlock.vue +0 -38
- package/samples/Basic/components/FontStyle.css +0 -16
- package/samples/Basic/components/anim/AnimGroup.vue +0 -66
- package/samples/Basic/components/anim/AnimKeyframeBasic.vue +0 -119
- package/samples/Basic/components/anim/AnimKeyframeComposite.vue +0 -52
- package/samples/Basic/components/anim/AnimTransition.vue +0 -157
- package/samples/Basic/components/div/DivBackground.vue +0 -44
- package/samples/Basic/components/div/DivClip.vue +0 -159
- package/samples/Basic/components/div/DivCssScoped.vue +0 -20
- package/samples/Basic/components/div/DivCssVar.vue +0 -53
- package/samples/Basic/components/div/DivGroup1.vue +0 -47
- package/samples/Basic/components/div/DivGroup2.vue +0 -65
- package/samples/Basic/components/div/DivLayout.vue +0 -70
- package/samples/Basic/components/div/DivRadius.vue +0 -65
- package/samples/Basic/components/div/DivTransform.vue +0 -32
- package/samples/Basic/components/img/ImageGroup.vue +0 -31
- package/samples/Basic/components/img/ImgLayout.vue +0 -41
- package/samples/Basic/components/panel/Panel1.vue +0 -55
- package/samples/Basic/components/panel/Panel2.vue +0 -31
- package/samples/Basic/components/panel/TitleBar.vue +0 -29
- package/samples/Basic/components/text/TextAlign.vue +0 -66
- package/samples/Basic/components/text/TextEmoji.vue +0 -26
- package/samples/Basic/components/text/TextFontStyle.vue +0 -89
- package/samples/Basic/components/text/TextGroup1.vue +0 -49
- package/samples/Basic/components/text/TextGroup2.vue +0 -28
- package/samples/Basic/components/text/TextOverflow.vue +0 -110
- package/samples/BasicFocusControl/App.vue +0 -104
- package/samples/BasicFocusControl/components/BaseBlock.vue +0 -50
- package/samples/BasicFocusControl/components/MainArea.vue +0 -83
- package/samples/BasicFocusControl/components/MainAreaLeftBlock.vue +0 -17
- package/samples/BasicFocusControl/components/MainAreaRightBlock.vue +0 -27
- package/samples/BasicFocusControl/components/SideBar.vue +0 -58
- package/samples/BasicFocusControl/components/SideBarBlock.vue +0 -27
- package/samples/Collision/App.vue +0 -452
- package/samples/ColorSpace/App.vue +0 -126
- package/samples/DemoHomepage/App.vue +0 -27
- package/samples/DemoHomepage/components/BodyFrame.vue +0 -95
- package/samples/DemoHomepage/components/Dialog.vue +0 -94
- package/samples/DemoHomepage/components/Item.vue +0 -77
- package/samples/DemoHomepage/components/TabFrame.vue +0 -85
- package/samples/DemoHomepage/router.js +0 -196
- package/samples/DemoHomepage/views/Homepage.vue +0 -195
- package/samples/FilterDemo/AnimatePic.vue +0 -58
- package/samples/FilterDemo/App.vue +0 -159
- package/samples/FilterDemo/VideoLayer.vue +0 -62
- package/samples/FlipCard/App.vue +0 -71
- package/samples/FlipCard/FlipCard.vue +0 -118
- package/samples/FlipCard/assets/blue_egg.png +0 -0
- package/samples/FlipCard/assets/red_egg.png +0 -0
- package/samples/FlipCard/data.js +0 -13
- package/samples/GridDemo/App.vue +0 -215
- package/samples/GridDemo/ButtonBlock.vue +0 -112
- package/samples/GridDemo/FocusItem.vue +0 -37
- package/samples/GridDemo/Item.vue +0 -93
- package/samples/HashHistory/App.vue +0 -115
- package/samples/HashHistory/components/HorizontalButtonList.vue +0 -91
- package/samples/HashHistory/components/Item.vue +0 -60
- package/samples/HashHistory/router.js +0 -41
- package/samples/HashHistory/views/MainPage.vue +0 -57
- package/samples/HashHistory/views/SubPage.vue +0 -66
- package/samples/ImpactStop/App.vue +0 -435
- package/samples/Input/App.vue +0 -164
- package/samples/Input/FullKeyboard.vue +0 -87
- package/samples/Input/InputPanel.vue +0 -131
- package/samples/Input/KeyboardItem.vue +0 -58
- package/samples/LongImage/App.vue +0 -80
- package/samples/LongImage/Button.vue +0 -58
- package/samples/LongImage/ButtonItem.vue +0 -44
- package/samples/LongImage/LongImageScroll.vue +0 -92
- package/samples/LongImage/Scroll.vue +0 -14
- package/samples/LongImage/assets/1280x7200.jpg +0 -0
- package/samples/LongText/App.vue +0 -96
- package/samples/LongText/Button.vue +0 -51
- package/samples/LongText/ButtonItem.vue +0 -44
- package/samples/LongText/LongTextScroll.vue +0 -192
- package/samples/LongText/Scroll.vue +0 -14
- package/samples/Marquee/App.vue +0 -247
- package/samples/Marquee/longText.js +0 -14
- package/samples/MaskClip/App.vue +0 -122
- package/samples/MaskClip/images/mask-025/config.json +0 -29
- package/samples/MaskClip/images/mask-025/res/1.png +0 -0
- package/samples/MaskClip/images/mask-025/res/2.png +0 -0
- package/samples/MaskClip/images/mask-025/res/3.png +0 -0
- package/samples/MaskClip/images/mask-025/res/4.png +0 -0
- package/samples/MaskClip/images/mask-025/res/icon.png +0 -0
- package/samples/MaskClip/images/mask-025/res/stroke.png +0 -0
- package/samples/MaskClip/images/php.jpg +0 -0
- package/samples/MetroWidgetDemos/Advanced/App.vue +0 -46
- package/samples/MetroWidgetDemos/Advanced/ButtonItem.vue +0 -90
- package/samples/MetroWidgetDemos/Advanced/Buttons.vue +0 -70
- package/samples/MetroWidgetDemos/Advanced/Mixed.vue +0 -77
- package/samples/MetroWidgetDemos/Advanced/widgets/Item.vue +0 -83
- package/samples/MetroWidgetDemos/Advanced/widgets/WidgetItem.vue +0 -89
- package/samples/MetroWidgetDemos/Advanced/widgets/Widgets.vue +0 -116
- package/samples/MetroWidgetDemos/Advanced/widgets/focus1.png +0 -0
- package/samples/MetroWidgetDemos/Item.vue +0 -85
- package/samples/MetroWidgetDemos/PerformanceTest/App.vue +0 -210
- package/samples/MetroWidgetDemos/PerformanceTest/Item.vue +0 -90
- package/samples/MetroWidgetDemos/PerformanceTest/assets/bg.jpg +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/assets/coupon_content.png +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/assets/coupon_left.png +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/assets/coupon_mid.png +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/assets/coupon_right.png +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/assets/focus_border.png +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/assets/holder_logo.png +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/assets/jrbm.png +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/assets/line_left.png +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/assets/line_mid.png +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/assets/line_right.png +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/assets/loading.png +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/assets/logo.png +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/assets/mcjx.png +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/assets/tao.png +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/assets/tmall.png +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/border.png +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/components/ContentItem.vue +0 -386
- package/samples/MetroWidgetDemos/PerformanceTest/components/MyTab.vue +0 -129
- package/samples/MetroWidgetDemos/PerformanceTest/data.js +0 -45
- package/samples/MetroWidgetDemos/PingPong/App.vue +0 -135
- package/samples/MetroWidgetDemos/PingPong/AppPage.vue +0 -73
- package/samples/MetroWidgetDemos/PingPong/AppTab.vue +0 -62
- package/samples/MetroWidgetDemos/PingPong/TabItem.vue +0 -84
- package/samples/MetroWidgetDemos/PingPong/ViewSwiper.vue +0 -214
- package/samples/MetroWidgetDemos/Simple/AbsoluteTemplate.vue +0 -75
- package/samples/MetroWidgetDemos/Simple/App.vue +0 -45
- package/samples/MetroWidgetDemos/Simple/RelativeTemplate.vue +0 -111
- package/samples/MetroWidgetDemos/WidgetItem.vue +0 -89
- package/samples/MetroWidgetDemos/data.js +0 -205
- package/samples/NinePatchDemo/App.vue +0 -145
- package/samples/NinePatchDemo/Item.vue +0 -69
- package/samples/NinePatchDemo/assets/border.png +0 -0
- package/samples/Preload/App.vue +0 -135
- package/samples/Preload/Item.vue +0 -32
- package/samples/Preload/data.js +0 -23
- package/samples/Preload/images/awesomeface.png +0 -0
- package/samples/Preload/images/cat.jpg +0 -0
- package/samples/Preload/images/rank.png +0 -0
- package/samples/Preload/images/rank_focus.png +0 -0
- package/samples/Preload/images/rule.png +0 -0
- package/samples/Preload/images/rule_focus.png +0 -0
- package/samples/Preload/images/start.png +0 -0
- package/samples/Preload/images/start_focus.png +0 -0
- package/samples/QrcodeDemo/App.vue +0 -68
- package/samples/ScaleDownNeon/App.vue +0 -107
- package/samples/SoundPool/App.vue +0 -134
- package/samples/SoundPool/bgmusic.mp3 +0 -0
- package/samples/SoundPool/coin.mp3 +0 -0
- package/samples/SoundPool/jump.mp3 +0 -0
- package/samples/SoundPool/lose.mp3 +0 -0
- package/samples/SoundPool/run.mp3 +0 -0
- package/samples/SprayView/App.vue +0 -272
- package/samples/SprayView/assets/snow.png +0 -0
- package/samples/SpriteImage/App.vue +0 -173
- package/samples/SpriteImage/images/cat_run.png +0 -0
- package/samples/SpriteImage/images/egg_break.json +0 -116
- package/samples/SpriteImage/images/egg_break.png +0 -0
- package/samples/SpriteImage/images/sprite.png +0 -0
- package/samples/TextBox/App.vue +0 -91
- package/samples/TextBox/RenderCenter.vue +0 -133
- package/samples/TextBox/RenderLeft.vue +0 -138
- package/samples/TextBox/RenderOneLine.vue +0 -101
- package/samples/TextBox/RenderRight.vue +0 -131
- package/samples/TextShadowDemo/App.vue +0 -91
- package/samples/TextureAnimation/App.vue +0 -336
- package/samples/TextureAnimation/App2.vue +0 -111
- package/samples/TextureAnimation/assets/blackWhiteGrid.png +0 -0
- package/samples/TextureAnimation/assets/light.png +0 -0
- package/samples/TextureAnimation/assets/light2.png +0 -0
- package/samples/TextureAnimation/assets/mask.png +0 -0
- package/samples/TextureAnimation/assets/php.jpg +0 -0
- package/samples/TextureAnimation/assets/php2.png +0 -0
- package/samples/TextureAnimation/assets/swipLight.png +0 -0
- package/samples/TextureSize/App.vue +0 -132
- package/samples/TextureSize/bmpDemo.bmp +0 -0
- package/samples/TextureSize/jpegDemo.jpeg +0 -0
- package/samples/TextureSize/jpgDemo.jpg +0 -0
- package/samples/TextureSize/pngDemo.png +0 -0
- package/samples/TextureSize/pngNoAlphaDemo.png +0 -0
- package/samples/ThrowMoveDemo/AccelerateDemo.vue +0 -116
- package/samples/ThrowMoveDemo/App.vue +0 -114
- package/samples/ThrowMoveDemo/LRParabolicDemo.vue +0 -115
- package/samples/ThrowMoveDemo/TargetDemo.vue +0 -116
- package/samples/ThrowMoveDemo/UDParabolicDemo.vue +0 -121
- package/samples/TouchSample/App.vue +0 -136
- package/samples/TouchSample/Item.vue +0 -103
- package/samples/TouchSample/MetroWidgetHorizontal.vue +0 -144
- package/samples/TouchSample/MetroWidgetVertical.vue +0 -144
- package/samples/TouchSample/TouchContainerHorizontal.vue +0 -160
- package/samples/TouchSample/TouchContainerVertical.vue +0 -160
- package/samples/TouchSample/data.js +0 -81
- package/samples/TransitPage/App.vue +0 -29
- package/samples/VideoDemo/App.vue +0 -121
- package/samples/VideoDemo/components/Button.vue +0 -58
- package/samples/VideoDemo/components/Controllor.vue +0 -197
- package/samples/VideoDemo/components/VideoFrame.vue +0 -140
- package/samples/VisibleSensorDemo/App.vue +0 -234
- package/samples/assets/bmpDemo.bmp +0 -0
- package/samples/assets/jpegDemo.jpeg +0 -0
- package/samples/assets/pngDemo.png +0 -0
- package/samples/assets/pngNoAlphaDemo.png +0 -0
- package/samples/assets/webpDemo.webp +0 -0
- package/tsconfig.json +0 -47
- package/utils/index.d.ts +0 -3
- package/utils/index.js +0 -10
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
<script setup>
|
|
3
|
-
import { HORIZONTAL, MetroWidget, useFocusHub } from "jsview";
|
|
4
|
-
import { ref, shallowRef } from "vue";
|
|
5
|
-
import Item from "./Item.vue";
|
|
6
|
-
|
|
7
|
-
const props = defineProps({
|
|
8
|
-
data: Object,
|
|
9
|
-
query: Object,
|
|
10
|
-
onItemEdge: Function,
|
|
11
|
-
onAction: Object,
|
|
12
|
-
});
|
|
13
|
-
const focusHub = useFocusHub();
|
|
14
|
-
const mwRef = shallowRef(null);
|
|
15
|
-
|
|
16
|
-
const measures = (item) => {
|
|
17
|
-
return item;
|
|
18
|
-
};
|
|
19
|
-
const randomColor = () => {
|
|
20
|
-
let randomColor = Math.round(Math.random() * 2 ** 24).toString(16);
|
|
21
|
-
return (
|
|
22
|
-
"#" + new Array(6 - randomColor.length).fill("0").join("") + randomColor
|
|
23
|
-
);
|
|
24
|
-
};
|
|
25
|
-
const provideData = () => {
|
|
26
|
-
const data = [];
|
|
27
|
-
for (let i = 0; i < 10; i++) {
|
|
28
|
-
data.push({
|
|
29
|
-
width: 90,
|
|
30
|
-
height: 90,
|
|
31
|
-
marginRight: 10,
|
|
32
|
-
marginBottom: 10,
|
|
33
|
-
content: i,
|
|
34
|
-
color: randomColor(),
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
return data;
|
|
38
|
-
};
|
|
39
|
-
const onFocus = (rect) => {
|
|
40
|
-
//获得焦点时需要做就近移动的处理, 因此需要通过setEnterFocusRect设置寻找最近焦点的区域
|
|
41
|
-
mwRef.value?.setEnterFocusRect(rect);
|
|
42
|
-
focusHub.setFocus(props.data.name);
|
|
43
|
-
};
|
|
44
|
-
const onBlur = () => {
|
|
45
|
-
//onBlur时需要返还焦点给父MetroWidget
|
|
46
|
-
mwRef.value?.getFocusBlockRef().returnFocusToParent();
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
props.onAction.register("onFocus", onFocus);
|
|
50
|
-
props.onAction.register("onBlur", onBlur);
|
|
51
|
-
</script>
|
|
52
|
-
|
|
53
|
-
<template>
|
|
54
|
-
<div
|
|
55
|
-
:style="{
|
|
56
|
-
width: 900,
|
|
57
|
-
height: 50,
|
|
58
|
-
fontSize: 30,
|
|
59
|
-
color: '#FFFFFF',
|
|
60
|
-
}"
|
|
61
|
-
>
|
|
62
|
-
{{ data.name }}
|
|
63
|
-
</div>
|
|
64
|
-
<!-- sendFocusRectEvent可以让MetroWidget的item在获焦时发送事件, 通知父的MetroWidget进行滚动 -->
|
|
65
|
-
<!-- onItemEdge直接作为onEdge回调, 既子MetroWidget到达边缘时触发父的onItemEdge -->
|
|
66
|
-
<metro-widget
|
|
67
|
-
ref="mwRef"
|
|
68
|
-
:top="50"
|
|
69
|
-
:name="data.name"
|
|
70
|
-
:provideData="provideData"
|
|
71
|
-
:width="data.width"
|
|
72
|
-
:height="data.height"
|
|
73
|
-
:direction="HORIZONTAL"
|
|
74
|
-
:padding="{
|
|
75
|
-
left: 10,
|
|
76
|
-
right: 10,
|
|
77
|
-
top: 10,
|
|
78
|
-
bottom: 10,
|
|
79
|
-
}"
|
|
80
|
-
:measures="measures"
|
|
81
|
-
:slideSetting="seamlessSlide"
|
|
82
|
-
:onEdge="onItemEdge"
|
|
83
|
-
:sendFocusRectEvent="true"
|
|
84
|
-
>
|
|
85
|
-
<template #renderItem="{ data, query, onAction }">
|
|
86
|
-
<item :data="data" :query="query" :onAction="onAction" />
|
|
87
|
-
</template>
|
|
88
|
-
</metro-widget>
|
|
89
|
-
</template>
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Author: ChenChanghua
|
|
3
|
-
* @Date: 2022-07-11 14:00:33
|
|
4
|
-
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime: 2022-11-02 15:23:08
|
|
6
|
-
* @Description: file content
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
const randomColor = () => {
|
|
10
|
-
let randomColor = Math.round(Math.random() * 2 ** 24).toString(16);
|
|
11
|
-
return (
|
|
12
|
-
"#" + new Array(6 - randomColor.length).fill("0").join("") + randomColor
|
|
13
|
-
);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const simpleData = [
|
|
17
|
-
{
|
|
18
|
-
width: 90,
|
|
19
|
-
height: 90,
|
|
20
|
-
marginRight: 10,
|
|
21
|
-
marginBottom: 10,
|
|
22
|
-
color: randomColor(),
|
|
23
|
-
content: "0",
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
width: 90,
|
|
27
|
-
height: 90,
|
|
28
|
-
marginRight: 10,
|
|
29
|
-
marginBottom: 10,
|
|
30
|
-
color: randomColor(),
|
|
31
|
-
content: "1",
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
width: 90,
|
|
35
|
-
height: 90,
|
|
36
|
-
marginRight: 10,
|
|
37
|
-
marginBottom: 10,
|
|
38
|
-
color: randomColor(),
|
|
39
|
-
content: "2",
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
width: 190,
|
|
43
|
-
height: 190,
|
|
44
|
-
marginRight: 10,
|
|
45
|
-
marginBottom: 10,
|
|
46
|
-
color: randomColor(),
|
|
47
|
-
content: "3",
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
width: 90,
|
|
51
|
-
height: 90,
|
|
52
|
-
marginRight: 10,
|
|
53
|
-
marginBottom: 10,
|
|
54
|
-
color: randomColor(),
|
|
55
|
-
content: "4",
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
width: 90,
|
|
59
|
-
height: 90,
|
|
60
|
-
marginRight: 10,
|
|
61
|
-
marginBottom: 10,
|
|
62
|
-
color: randomColor(),
|
|
63
|
-
content: "5",
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
width: 90,
|
|
67
|
-
height: 190,
|
|
68
|
-
marginRight: 10,
|
|
69
|
-
marginBottom: 10,
|
|
70
|
-
color: randomColor(),
|
|
71
|
-
content: "6",
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
width: 90,
|
|
75
|
-
height: 90,
|
|
76
|
-
marginRight: 10,
|
|
77
|
-
marginBottom: 10,
|
|
78
|
-
color: randomColor(),
|
|
79
|
-
content: "7",
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
width: 90,
|
|
83
|
-
height: 190,
|
|
84
|
-
marginRight: 10,
|
|
85
|
-
marginBottom: 10,
|
|
86
|
-
color: randomColor(),
|
|
87
|
-
content: "8",
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
width: 90,
|
|
91
|
-
height: 90,
|
|
92
|
-
marginRight: 10,
|
|
93
|
-
marginBottom: 10,
|
|
94
|
-
color: randomColor(),
|
|
95
|
-
content: "9",
|
|
96
|
-
},
|
|
97
|
-
];
|
|
98
|
-
|
|
99
|
-
const simpleDataAbs = [
|
|
100
|
-
{
|
|
101
|
-
left: 0,
|
|
102
|
-
top: 0,
|
|
103
|
-
width: 90,
|
|
104
|
-
height: 90,
|
|
105
|
-
marginRight: 10,
|
|
106
|
-
marginBottom: 10,
|
|
107
|
-
color: randomColor(),
|
|
108
|
-
content: "0",
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
left: 0,
|
|
112
|
-
top: 200,
|
|
113
|
-
width: 90,
|
|
114
|
-
height: 90,
|
|
115
|
-
marginRight: 10,
|
|
116
|
-
marginBottom: 10,
|
|
117
|
-
color: randomColor(),
|
|
118
|
-
content: "1",
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
left: 200,
|
|
122
|
-
top: 0,
|
|
123
|
-
width: 90,
|
|
124
|
-
height: 90,
|
|
125
|
-
marginRight: 10,
|
|
126
|
-
marginBottom: 10,
|
|
127
|
-
color: randomColor(),
|
|
128
|
-
content: "2",
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
left: 200,
|
|
132
|
-
top: 200,
|
|
133
|
-
width: 90,
|
|
134
|
-
height: 90,
|
|
135
|
-
marginRight: 10,
|
|
136
|
-
marginBottom: 10,
|
|
137
|
-
color: randomColor(),
|
|
138
|
-
content: "3",
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
left: 400,
|
|
142
|
-
top: 0,
|
|
143
|
-
width: 90,
|
|
144
|
-
height: 90,
|
|
145
|
-
marginRight: 10,
|
|
146
|
-
marginBottom: 10,
|
|
147
|
-
color: randomColor(),
|
|
148
|
-
content: "4",
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
left: 400,
|
|
152
|
-
top: 200,
|
|
153
|
-
width: 90,
|
|
154
|
-
height: 90,
|
|
155
|
-
marginRight: 10,
|
|
156
|
-
marginBottom: 10,
|
|
157
|
-
color: randomColor(),
|
|
158
|
-
content: "5",
|
|
159
|
-
},
|
|
160
|
-
];
|
|
161
|
-
|
|
162
|
-
const advanceButton = [];
|
|
163
|
-
for (let i = 0; i < 6; i++) {
|
|
164
|
-
advanceButton.push({
|
|
165
|
-
width: 100,
|
|
166
|
-
height: 50,
|
|
167
|
-
name: "button_" + i,
|
|
168
|
-
marginRight: 10,
|
|
169
|
-
marginBottom: 10,
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
const advanceMetroWidget = [];
|
|
174
|
-
for (let i = 0; i < 10; i++) {
|
|
175
|
-
advanceMetroWidget.push({
|
|
176
|
-
width: 500,
|
|
177
|
-
height: 170,
|
|
178
|
-
name: "widget_" + i,
|
|
179
|
-
marginBottom: 10,
|
|
180
|
-
index: i,
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
const advanceMix = [];
|
|
185
|
-
for (let i = 0; i < 6; i++) {
|
|
186
|
-
advanceMix.push({
|
|
187
|
-
width: 100,
|
|
188
|
-
height: 50,
|
|
189
|
-
name: "mix_button_" + i,
|
|
190
|
-
marginRight: 10,
|
|
191
|
-
marginBottom: 10,
|
|
192
|
-
type: i % 3 == 0 ? "button" : "item",
|
|
193
|
-
color: randomColor(),
|
|
194
|
-
content: i,
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
export {
|
|
199
|
-
randomColor,
|
|
200
|
-
simpleData,
|
|
201
|
-
simpleDataAbs,
|
|
202
|
-
advanceButton,
|
|
203
|
-
advanceMetroWidget,
|
|
204
|
-
advanceMix,
|
|
205
|
-
};
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import {
|
|
3
|
-
jJsvRuntimeBridge,
|
|
4
|
-
MetroWidget,
|
|
5
|
-
HORIZONTAL,
|
|
6
|
-
JsvNinePatch,
|
|
7
|
-
} from "jsview";
|
|
8
|
-
import Item from "./Item.vue";
|
|
9
|
-
import borderImageUrl from "./assets/border.png";
|
|
10
|
-
import { ref, shallowRef, onMounted } from "vue";
|
|
11
|
-
import { useRouter, useRoute } from "vue-router";
|
|
12
|
-
|
|
13
|
-
const router = useRouter();
|
|
14
|
-
|
|
15
|
-
const data = [
|
|
16
|
-
{
|
|
17
|
-
blocks: {
|
|
18
|
-
w: 160,
|
|
19
|
-
h: 160,
|
|
20
|
-
},
|
|
21
|
-
color: "#FF9900",
|
|
22
|
-
content: 0,
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
blocks: {
|
|
26
|
-
w: 300,
|
|
27
|
-
h: 300,
|
|
28
|
-
},
|
|
29
|
-
color: "#0099FF",
|
|
30
|
-
content: 1,
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
blocks: {
|
|
34
|
-
w: 160,
|
|
35
|
-
h: 160,
|
|
36
|
-
},
|
|
37
|
-
color: "#FF9900",
|
|
38
|
-
content: 2,
|
|
39
|
-
},
|
|
40
|
-
];
|
|
41
|
-
|
|
42
|
-
const framePosition = ref({
|
|
43
|
-
x: 0,
|
|
44
|
-
y: 0,
|
|
45
|
-
width: 50,
|
|
46
|
-
height: 50,
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
const _onFramePositionChanged = (new_x, new_y, new_width, new_height) => {
|
|
50
|
-
console.log(
|
|
51
|
-
`new x=${new_x} y=${new_y} width=${new_width} height=${new_height}`
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
framePosition.value = {
|
|
55
|
-
x: new_x,
|
|
56
|
-
y: new_y,
|
|
57
|
-
width: new_width,
|
|
58
|
-
height: new_height,
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
const _measures = (item) => {
|
|
63
|
-
return {
|
|
64
|
-
width: item.blocks.w,
|
|
65
|
-
height: item.blocks.h,
|
|
66
|
-
marginRight: 10,
|
|
67
|
-
marginTop: 10,
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
const _onKeyDown = (ev) => {
|
|
72
|
-
// 8:Backspace, 27:Escape, 10000:盒子返回键
|
|
73
|
-
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
74
|
-
router?.go(-1); // 有router时,是从DemoHomepage进入,回退
|
|
75
|
-
return true;
|
|
76
|
-
}
|
|
77
|
-
return false;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
const myFocusWidget = shallowRef(null);
|
|
81
|
-
|
|
82
|
-
onMounted(() => {
|
|
83
|
-
myFocusWidget.value.getFocusBlockRef().requestFocus();
|
|
84
|
-
jJsvRuntimeBridge.notifyPageLoaded();
|
|
85
|
-
});
|
|
86
|
-
</script>
|
|
87
|
-
|
|
88
|
-
<template>
|
|
89
|
-
<div :style="{ width: 1280, height: 720, backgroundColor: '#FFFFFF' }">
|
|
90
|
-
<jsv-focus-block ref="focusNode" :onKeyDown="_onKeyDown">
|
|
91
|
-
<div
|
|
92
|
-
:style="{
|
|
93
|
-
textAlign: 'center',
|
|
94
|
-
fontSize: 30,
|
|
95
|
-
lineHeight: 50,
|
|
96
|
-
color: '#ffffff',
|
|
97
|
-
left: 140,
|
|
98
|
-
top: 20,
|
|
99
|
-
width: 1000,
|
|
100
|
-
height: 50,
|
|
101
|
-
backgroundColor: 'rgba(27,38,151,0.8)',
|
|
102
|
-
}"
|
|
103
|
-
>
|
|
104
|
-
NinePatch展示,框的四个角的方形中心和项目的四个顶点严格对齐
|
|
105
|
-
</div>
|
|
106
|
-
<metro-widget
|
|
107
|
-
ref="myFocusWidget"
|
|
108
|
-
:top="100"
|
|
109
|
-
:left="250"
|
|
110
|
-
:width="1000"
|
|
111
|
-
:height="400"
|
|
112
|
-
:direction="HORIZONTAL"
|
|
113
|
-
:data="data"
|
|
114
|
-
:measures="_measures"
|
|
115
|
-
:padding="{ left: 50, right: 50, top: 50, height: 50 }"
|
|
116
|
-
>
|
|
117
|
-
<template #renderItem="{ data, query, onEdge, onAction }">
|
|
118
|
-
<item
|
|
119
|
-
:data="data"
|
|
120
|
-
:query="query"
|
|
121
|
-
:onEdge="onEdge"
|
|
122
|
-
:onAction="onAction"
|
|
123
|
-
:frameChanged="_onFramePositionChanged"
|
|
124
|
-
/>
|
|
125
|
-
</template>
|
|
126
|
-
</metro-widget>
|
|
127
|
-
<div :style="{ top: 150, left: 300 }">
|
|
128
|
-
<jsv-nine-patch
|
|
129
|
-
:style="{
|
|
130
|
-
width: framePosition.width,
|
|
131
|
-
height: framePosition.height,
|
|
132
|
-
top: framePosition.y,
|
|
133
|
-
left: framePosition.x,
|
|
134
|
-
}"
|
|
135
|
-
:imageUrl="borderImageUrl"
|
|
136
|
-
:imageWidth="81"
|
|
137
|
-
:centerWidth="25"
|
|
138
|
-
:borderOutset="14"
|
|
139
|
-
:imageDspWidth="81"
|
|
140
|
-
:animTime="0.2"
|
|
141
|
-
></jsv-nine-patch>
|
|
142
|
-
</div>
|
|
143
|
-
</jsv-focus-block>
|
|
144
|
-
</div>
|
|
145
|
-
</template>
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { ref, shallowRef, computed } from "vue";
|
|
3
|
-
|
|
4
|
-
const props = defineProps({
|
|
5
|
-
data: Object,
|
|
6
|
-
query: Object,
|
|
7
|
-
onEdge: Function,
|
|
8
|
-
onAction: Object,
|
|
9
|
-
frameChanged: Function,
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
let focused = ref(false);
|
|
13
|
-
|
|
14
|
-
let styleValue = computed(() => {
|
|
15
|
-
return {
|
|
16
|
-
width: props.data.blocks.w,
|
|
17
|
-
height: props.data.blocks.h,
|
|
18
|
-
color: "#FFFFFF",
|
|
19
|
-
backgroundColor: props.data.color,
|
|
20
|
-
};
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
const onFocus = () => {
|
|
24
|
-
focused.value = true;
|
|
25
|
-
if (props.frameChanged) {
|
|
26
|
-
let pos = props.query.position(props.query.id);
|
|
27
|
-
|
|
28
|
-
// 焦点时套在放大的item外缘,所以要计算按照中心放大后的焦点框x,y,width,height
|
|
29
|
-
const new_x = pos.left + (pos.width - pos.width * 1.05) / 2;
|
|
30
|
-
const new_y = pos.top + (pos.height - pos.height * 1.05) / 2;
|
|
31
|
-
const new_width = pos.width * 1.05;
|
|
32
|
-
const new_height = pos.height * 1.05;
|
|
33
|
-
|
|
34
|
-
props.frameChanged(new_x, new_y, new_width, new_height);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const onBlur = () => {
|
|
39
|
-
focused.value = false;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const onClicked = () => {
|
|
43
|
-
onsole.log(`item ${props.query.id} clicked`);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
props.onAction.register("onFocus", onFocus);
|
|
47
|
-
props.onAction.register("onBlur", onBlur);
|
|
48
|
-
props.onAction.register("onClick", onClicked);
|
|
49
|
-
</script>
|
|
50
|
-
|
|
51
|
-
<template>
|
|
52
|
-
<div :class="focused ? 'focus' : 'blur'" :style="styleValue">
|
|
53
|
-
{{ "" + props.data.content }}
|
|
54
|
-
</div>
|
|
55
|
-
</template>
|
|
56
|
-
|
|
57
|
-
<style scoped>
|
|
58
|
-
.focus {
|
|
59
|
-
transform: scale3d(1.05, 1.05, 1);
|
|
60
|
-
transition: transform 0.25s linear;
|
|
61
|
-
font-size: 30px;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.blur {
|
|
65
|
-
transform: scale3d(1, 1, 1);
|
|
66
|
-
transition: transform 0.25s linear;
|
|
67
|
-
font-size: 30px;
|
|
68
|
-
}
|
|
69
|
-
</style>
|
|
Binary file
|
package/samples/Preload/App.vue
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import {
|
|
3
|
-
HORIZONTAL,
|
|
4
|
-
MetroWidget,
|
|
5
|
-
JsvPreload,
|
|
6
|
-
buildPreloadInfo,
|
|
7
|
-
buildDownloadInfo,
|
|
8
|
-
useFocusHub,
|
|
9
|
-
} from "jsview";
|
|
10
|
-
import awesome from "./images/awesomeface.png";
|
|
11
|
-
import cat from "./images/cat.jpg";
|
|
12
|
-
import { data } from "./data.js";
|
|
13
|
-
import Item from "./Item.vue";
|
|
14
|
-
import { ref, shallowRef } from "vue";
|
|
15
|
-
import { useRouter } from "vue-router";
|
|
16
|
-
|
|
17
|
-
const name = "/preload";
|
|
18
|
-
const focusHub = useFocusHub();
|
|
19
|
-
const text = ref("");
|
|
20
|
-
let preloadInfo = [];
|
|
21
|
-
let downloadInfo = [];
|
|
22
|
-
const router = useRouter();
|
|
23
|
-
|
|
24
|
-
const _onPreloading = (percent) => {
|
|
25
|
-
console.log("preloading ", percent);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const _onPreloadDone = (imageInfo) => {
|
|
29
|
-
console.log("PRELOAD DONE!", imageInfo);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const _onDownloadDone = (urls, extra) => {
|
|
33
|
-
console.log("DOWNLOAD DONE!", urls, extra);
|
|
34
|
-
text.value = `图片下载完成\n${awesome}\n${cat}`;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const _measures = () => {
|
|
38
|
-
return {
|
|
39
|
-
width: 180,
|
|
40
|
-
height: 90,
|
|
41
|
-
focusable: true,
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const _onKeyDown = (ev) => {
|
|
46
|
-
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
47
|
-
router?.go(-1); // 有router时,是从DemoHomepage进入,回退
|
|
48
|
-
}
|
|
49
|
-
return true;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const _onFocus = () => {
|
|
53
|
-
focusHub.setFocus(name);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
for (const item of data) {
|
|
57
|
-
preloadInfo.push(buildPreloadInfo(item.url));
|
|
58
|
-
preloadInfo.push(buildPreloadInfo(item.focusUrl));
|
|
59
|
-
}
|
|
60
|
-
preloadInfo.push(null); // 测试item为null的加载
|
|
61
|
-
downloadInfo = [
|
|
62
|
-
buildDownloadInfo(awesome, null, true),
|
|
63
|
-
buildDownloadInfo(cat, null, true),
|
|
64
|
-
buildDownloadInfo(null), // 测试URL为null的加载
|
|
65
|
-
];
|
|
66
|
-
</script>
|
|
67
|
-
|
|
68
|
-
<template>
|
|
69
|
-
<jsv-focus-block
|
|
70
|
-
autoFocus
|
|
71
|
-
:style="{
|
|
72
|
-
width: 1920,
|
|
73
|
-
height: 1080,
|
|
74
|
-
backgroundColor: '#FFFFFF',
|
|
75
|
-
}"
|
|
76
|
-
:onAction="{
|
|
77
|
-
onKeyDown: _onKeyDown,
|
|
78
|
-
onFocus: _onFocus,
|
|
79
|
-
}"
|
|
80
|
-
>
|
|
81
|
-
<div
|
|
82
|
-
:style="{
|
|
83
|
-
textAlign: 'center',
|
|
84
|
-
fontSize: '30px',
|
|
85
|
-
lineHeight: '50px',
|
|
86
|
-
color: '#ffffff',
|
|
87
|
-
left: 100,
|
|
88
|
-
top: 20,
|
|
89
|
-
width: 1280 - 200,
|
|
90
|
-
height: 50,
|
|
91
|
-
backgroundColor: 'rgba(27,38,151,0.8)',
|
|
92
|
-
}"
|
|
93
|
-
>
|
|
94
|
-
预加载后,图片(按钮焦点切换)切换不闪屏
|
|
95
|
-
</div>
|
|
96
|
-
<div :style="{ top: 200, left: 300 }">
|
|
97
|
-
<metro-widget
|
|
98
|
-
:name="name"
|
|
99
|
-
:width="540"
|
|
100
|
-
:height="90"
|
|
101
|
-
:direction="HORIZONTAL"
|
|
102
|
-
:data="data"
|
|
103
|
-
:measures="_measures"
|
|
104
|
-
>
|
|
105
|
-
<template #renderItem="{ data, query, onEdge, onAction }">
|
|
106
|
-
<item
|
|
107
|
-
:data="data"
|
|
108
|
-
:query="query"
|
|
109
|
-
:onEdge="onEdge"
|
|
110
|
-
:onAction="onAction"
|
|
111
|
-
/>
|
|
112
|
-
</template>
|
|
113
|
-
</metro-widget>
|
|
114
|
-
</div>
|
|
115
|
-
<div
|
|
116
|
-
:style="{
|
|
117
|
-
left: 100,
|
|
118
|
-
top: 350,
|
|
119
|
-
width: 800,
|
|
120
|
-
height: 800,
|
|
121
|
-
fontSize: '30px',
|
|
122
|
-
color: '#000000',
|
|
123
|
-
}"
|
|
124
|
-
>
|
|
125
|
-
{{ text }}
|
|
126
|
-
</div>
|
|
127
|
-
<jsv-preload
|
|
128
|
-
:preloadList="preloadInfo"
|
|
129
|
-
:downloadList="downloadInfo"
|
|
130
|
-
:onPreloadDone="_onPreloadDone"
|
|
131
|
-
:onDownloadDone="_onDownloadDone"
|
|
132
|
-
:onPreloading="_onPreloading"
|
|
133
|
-
/>
|
|
134
|
-
</jsv-focus-block>
|
|
135
|
-
</template>
|
package/samples/Preload/Item.vue
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { ref, shallowRef } from "vue";
|
|
3
|
-
const props = defineProps({
|
|
4
|
-
data: Object,
|
|
5
|
-
query: Object,
|
|
6
|
-
onEdge: Function,
|
|
7
|
-
onAction: Object,
|
|
8
|
-
});
|
|
9
|
-
const focus = ref(false);
|
|
10
|
-
|
|
11
|
-
const onFocus = () => {
|
|
12
|
-
focus.value = true;
|
|
13
|
-
};
|
|
14
|
-
const onBlur = () => {
|
|
15
|
-
focus.value = false;
|
|
16
|
-
};
|
|
17
|
-
props.onAction.register("onFocus", onFocus);
|
|
18
|
-
props.onAction.register("onBlur", onBlur);
|
|
19
|
-
props.onAction.register("onClick", () => {
|
|
20
|
-
console.log("cchtest item on click ", data);
|
|
21
|
-
});
|
|
22
|
-
</script>
|
|
23
|
-
|
|
24
|
-
<template>
|
|
25
|
-
<div
|
|
26
|
-
:style="{
|
|
27
|
-
width: 166,
|
|
28
|
-
height: 90,
|
|
29
|
-
backgroundImage: focus ? data.focusUrl : data.url,
|
|
30
|
-
}"
|
|
31
|
-
></div>
|
|
32
|
-
</template>
|
package/samples/Preload/data.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import rank from "./images/rank.png";
|
|
2
|
-
import rankF from "./images/rank_focus.png";
|
|
3
|
-
import rule from "./images/rule.png";
|
|
4
|
-
import ruleF from "./images/rule_focus.png";
|
|
5
|
-
import start from "./images/start.png";
|
|
6
|
-
import startF from "./images/start_focus.png";
|
|
7
|
-
|
|
8
|
-
const data = [
|
|
9
|
-
{
|
|
10
|
-
url: rank,
|
|
11
|
-
focusUrl: rankF,
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
url: start,
|
|
15
|
-
focusUrl: startF
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
url: rule,
|
|
19
|
-
focusUrl: ruleF,
|
|
20
|
-
},
|
|
21
|
-
];
|
|
22
|
-
|
|
23
|
-
export { data };
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|