@shijiu/jsview-vue 1.9.727 → 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,46 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
* @Author: ChenChanghua
|
|
3
|
-
* @Date: 2022-07-11 13:31:36
|
|
4
|
-
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime: 2022-11-02 14:51:40
|
|
6
|
-
* @Description: file content
|
|
7
|
-
-->
|
|
8
|
-
<script setup>
|
|
9
|
-
import { MetroWidget, VERTICAL, EdgeDirection, useFocusHub } from "jsview";
|
|
10
|
-
import { useRouter } from "vue-router";
|
|
11
|
-
import Buttons from "./Buttons.vue";
|
|
12
|
-
import Mixed from "./Mixed.vue";
|
|
13
|
-
import Widgets from "./widgets/Widgets.vue";
|
|
14
|
-
|
|
15
|
-
const router = useRouter();
|
|
16
|
-
const focusHub = useFocusHub();
|
|
17
|
-
|
|
18
|
-
const onFocus = () => {
|
|
19
|
-
focusHub.setFocus("mwButton");
|
|
20
|
-
};
|
|
21
|
-
const onKeyDown = (ev) => {
|
|
22
|
-
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
23
|
-
router.go(-1);
|
|
24
|
-
}
|
|
25
|
-
return true;
|
|
26
|
-
};
|
|
27
|
-
</script>
|
|
28
|
-
|
|
29
|
-
<template>
|
|
30
|
-
<jsv-focus-block
|
|
31
|
-
autoFocus
|
|
32
|
-
:onAction="{
|
|
33
|
-
onKeyDown,
|
|
34
|
-
onFocus,
|
|
35
|
-
}"
|
|
36
|
-
:style="{
|
|
37
|
-
width: 1920,
|
|
38
|
-
height: 1080,
|
|
39
|
-
backgroundColor: '#007788',
|
|
40
|
-
}"
|
|
41
|
-
>
|
|
42
|
-
<buttons></buttons>
|
|
43
|
-
<mixed></mixed>
|
|
44
|
-
<widgets></widgets>
|
|
45
|
-
</jsv-focus-block>
|
|
46
|
-
</template>
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
* @Author: ChenChanghua
|
|
3
|
-
* @Date: 2022-07-11 13:26:24
|
|
4
|
-
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime: 2022-11-02 15:37:33
|
|
6
|
-
* @Description: file content
|
|
7
|
-
-->
|
|
8
|
-
<script setup>
|
|
9
|
-
import { ref, shallowRef } from "vue";
|
|
10
|
-
import { useFocusHub } from "jsview";
|
|
11
|
-
|
|
12
|
-
const props = defineProps({
|
|
13
|
-
data: Object,
|
|
14
|
-
query: String,
|
|
15
|
-
onAction: Object,
|
|
16
|
-
onItemEdge: Function,
|
|
17
|
-
});
|
|
18
|
-
const focusHub = useFocusHub();
|
|
19
|
-
|
|
20
|
-
let focusIndex = ref(0);
|
|
21
|
-
let focused = ref(false);
|
|
22
|
-
let focusBlock = shallowRef(null);
|
|
23
|
-
|
|
24
|
-
const onFocus = () => {
|
|
25
|
-
//onFocus时, 获得焦点, 以处理自己内部的焦点逻辑
|
|
26
|
-
focusHub.setFocus(props.data.name);
|
|
27
|
-
focused.value = true;
|
|
28
|
-
};
|
|
29
|
-
const onBlur = () => {
|
|
30
|
-
focused.value = false;
|
|
31
|
-
focusIndex.value = 0;
|
|
32
|
-
//onBlur的时候, 需要将焦点返还给父
|
|
33
|
-
focusBlock.value?.returnFocusToParent();
|
|
34
|
-
};
|
|
35
|
-
const onKeyDown = (ev) => {
|
|
36
|
-
if (ev.keyCode == 37 && focusIndex.value == 1) {
|
|
37
|
-
focusIndex.value = 0;
|
|
38
|
-
return true;
|
|
39
|
-
} else if (ev.keyCode == 39 && focusIndex.value == 0) {
|
|
40
|
-
focusIndex.value = 1;
|
|
41
|
-
return true;
|
|
42
|
-
} else if (ev.keyCode == 13) {
|
|
43
|
-
console.log("button click", props.data);
|
|
44
|
-
return true;
|
|
45
|
-
}
|
|
46
|
-
return false;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
props.onAction.register("onFocus", onFocus);
|
|
50
|
-
props.onAction.register("onBlur", onBlur);
|
|
51
|
-
</script>
|
|
52
|
-
|
|
53
|
-
<template>
|
|
54
|
-
<jsv-focus-block
|
|
55
|
-
ref="focusBlock"
|
|
56
|
-
:name="data.name"
|
|
57
|
-
:onAction="{
|
|
58
|
-
onKeyDown: onKeyDown,
|
|
59
|
-
}"
|
|
60
|
-
>
|
|
61
|
-
<div
|
|
62
|
-
:style="{
|
|
63
|
-
width: 50,
|
|
64
|
-
height: 50,
|
|
65
|
-
fontSize: 20,
|
|
66
|
-
color: '#FFFFFF',
|
|
67
|
-
backgroundColor: '#00AA00',
|
|
68
|
-
}"
|
|
69
|
-
></div>
|
|
70
|
-
|
|
71
|
-
<div
|
|
72
|
-
:style="{
|
|
73
|
-
left: 50,
|
|
74
|
-
width: 50,
|
|
75
|
-
height: 50,
|
|
76
|
-
backgroundColor: '#0000AA',
|
|
77
|
-
}"
|
|
78
|
-
></div>
|
|
79
|
-
|
|
80
|
-
<div
|
|
81
|
-
:style="{
|
|
82
|
-
visibility: this.focused ? 'visible' : 'hidden',
|
|
83
|
-
left: 50 * focusIndex,
|
|
84
|
-
width: 10,
|
|
85
|
-
height: 10,
|
|
86
|
-
backgroundColor: '#FF0000',
|
|
87
|
-
}"
|
|
88
|
-
></div>
|
|
89
|
-
</jsv-focus-block>
|
|
90
|
-
</template>
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
* @Author: ChenChanghua
|
|
3
|
-
* @Date: 2022-07-11 13:31:36
|
|
4
|
-
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime: 2022-07-18 09:49:59
|
|
6
|
-
* @Description: file content
|
|
7
|
-
-->
|
|
8
|
-
<script setup>
|
|
9
|
-
import { MetroWidget, VERTICAL, EdgeDirection } from "jsview";
|
|
10
|
-
import { useFocusHub } from "jsview";
|
|
11
|
-
import { advanceButton } from "../data";
|
|
12
|
-
import ButtonItem from "./ButtonItem.vue";
|
|
13
|
-
|
|
14
|
-
const focusHub = useFocusHub();
|
|
15
|
-
|
|
16
|
-
//item为Buttonitem的一些回调
|
|
17
|
-
const provideData = () => {
|
|
18
|
-
return advanceButton;
|
|
19
|
-
};
|
|
20
|
-
const measures = (item) => {
|
|
21
|
-
return {
|
|
22
|
-
width: item.width,
|
|
23
|
-
height: item.height,
|
|
24
|
-
marginRight: item.marginRight,
|
|
25
|
-
marginBottom: item.marginBottom,
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
const onEdge = (edgeInfo) => {
|
|
29
|
-
if (edgeInfo.direction == EdgeDirection.right) {
|
|
30
|
-
focusHub.setFocus("mwWidget");
|
|
31
|
-
} else if (edgeInfo.direction == EdgeDirection.bottom) {
|
|
32
|
-
focusHub.setFocus("mwMix");
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
</script>
|
|
36
|
-
|
|
37
|
-
<template>
|
|
38
|
-
<div
|
|
39
|
-
:style="{
|
|
40
|
-
left: 50,
|
|
41
|
-
top: 20,
|
|
42
|
-
width: 300,
|
|
43
|
-
height: 400,
|
|
44
|
-
fontSize: 30,
|
|
45
|
-
color: '#FFFFFF',
|
|
46
|
-
}"
|
|
47
|
-
>
|
|
48
|
-
{{ `item可以是可获得焦点的控件` }}
|
|
49
|
-
</div>
|
|
50
|
-
<metro-widget
|
|
51
|
-
name="mwButton"
|
|
52
|
-
:top="120"
|
|
53
|
-
:left="50"
|
|
54
|
-
:provideData="provideData"
|
|
55
|
-
:width="220"
|
|
56
|
-
:height="400"
|
|
57
|
-
:direction="VERTICAL"
|
|
58
|
-
:measures="measures"
|
|
59
|
-
:onEdge="onEdge"
|
|
60
|
-
>
|
|
61
|
-
<template #renderItem="{ data, query, onAction, onItemEdge }">
|
|
62
|
-
<button-item
|
|
63
|
-
:data="data"
|
|
64
|
-
:query="query"
|
|
65
|
-
:onAction="onAction"
|
|
66
|
-
:onItemEdge="onItemEdge"
|
|
67
|
-
/>
|
|
68
|
-
</template>
|
|
69
|
-
</metro-widget>
|
|
70
|
-
</template>
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
* @Author: ChenChanghua
|
|
3
|
-
* @Date: 2022-07-11 13:31:36
|
|
4
|
-
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime: 2022-11-02 15:37:40
|
|
6
|
-
* @Description: file content
|
|
7
|
-
-->
|
|
8
|
-
<script setup>
|
|
9
|
-
import { MetroWidget, VERTICAL, EdgeDirection } from "jsview";
|
|
10
|
-
import { useFocusHub } from "jsview";
|
|
11
|
-
import { advanceMix } from "../data";
|
|
12
|
-
import ButtonItem from "./ButtonItem.vue";
|
|
13
|
-
import Item from "../Item.vue";
|
|
14
|
-
|
|
15
|
-
const focusHub = useFocusHub();
|
|
16
|
-
|
|
17
|
-
//item混排的回调
|
|
18
|
-
const provideData = () => {
|
|
19
|
-
return advanceMix;
|
|
20
|
-
};
|
|
21
|
-
const measures = (item) => {
|
|
22
|
-
return {
|
|
23
|
-
width: item.width,
|
|
24
|
-
height: item.height,
|
|
25
|
-
marginRight: item.marginRight,
|
|
26
|
-
marginBottom: item.marginBottom,
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
const onEdge = (edgeInfo) => {
|
|
30
|
-
if (edgeInfo.direction == EdgeDirection.right) {
|
|
31
|
-
focusHub.setFocus("mwWidget");
|
|
32
|
-
} else if (edgeInfo.direction == EdgeDirection.top) {
|
|
33
|
-
focusHub.setFocus("mwButton");
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
</script>
|
|
37
|
-
|
|
38
|
-
<template>
|
|
39
|
-
<div
|
|
40
|
-
:style="{
|
|
41
|
-
left: 50,
|
|
42
|
-
top: 350,
|
|
43
|
-
width: 300,
|
|
44
|
-
height: 400,
|
|
45
|
-
fontSize: 30,
|
|
46
|
-
color: '#FFFFFF',
|
|
47
|
-
}"
|
|
48
|
-
>
|
|
49
|
-
{{ `item可以普通描画控件和可获焦控件混排` }}
|
|
50
|
-
</div>
|
|
51
|
-
<metro-widget
|
|
52
|
-
name="mwMix"
|
|
53
|
-
:top="450"
|
|
54
|
-
:left="50"
|
|
55
|
-
:provideData="provideData"
|
|
56
|
-
:width="260"
|
|
57
|
-
:height="440"
|
|
58
|
-
:padding="{
|
|
59
|
-
top: 20,
|
|
60
|
-
left: 20,
|
|
61
|
-
}"
|
|
62
|
-
:direction="VERTICAL"
|
|
63
|
-
:measures="measures"
|
|
64
|
-
:onEdge="onEdge"
|
|
65
|
-
>
|
|
66
|
-
<template #renderItem="{ data, query, onAction, onItemEdge }">
|
|
67
|
-
<button-item
|
|
68
|
-
v-if="data.type == 'button'"
|
|
69
|
-
:data="data"
|
|
70
|
-
:query="query"
|
|
71
|
-
:onAction="onAction"
|
|
72
|
-
:onItemEdge="onItemEdge"
|
|
73
|
-
/>
|
|
74
|
-
<item v-else :data="data" :query="query" :onAction="onAction" />
|
|
75
|
-
</template>
|
|
76
|
-
</metro-widget>
|
|
77
|
-
</template>
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
* @Author: ChenChanghua
|
|
3
|
-
* @Date: 2022-11-01 15:30:14
|
|
4
|
-
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime: 2022-11-02 15:39:17
|
|
6
|
-
* @Description: file content
|
|
7
|
-
-->
|
|
8
|
-
<!--
|
|
9
|
-
* @Author: ChenChanghua
|
|
10
|
-
* @Date: 2022-05-10 15:21:24
|
|
11
|
-
* @LastEditors: ChenChanghua
|
|
12
|
-
* @LastEditTime: 2022-11-01 15:24:26
|
|
13
|
-
* @Description: file content
|
|
14
|
-
-->
|
|
15
|
-
<script setup>
|
|
16
|
-
import { ref, shallowRef, inject } from "vue";
|
|
17
|
-
|
|
18
|
-
const props = defineProps({
|
|
19
|
-
data: Object,
|
|
20
|
-
query: Object,
|
|
21
|
-
onAction: Object,
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const divRef = shallowRef(null);
|
|
25
|
-
const focused = ref(false);
|
|
26
|
-
|
|
27
|
-
const focusSize = inject("focusSize");
|
|
28
|
-
|
|
29
|
-
// 自身的焦点状态自己记录, 通过回调来改变
|
|
30
|
-
const onFocus = () => {
|
|
31
|
-
focused.value = true;
|
|
32
|
-
if (focusSize) {
|
|
33
|
-
divRef.value?.getBoundingClientRect().then(
|
|
34
|
-
(data) => {
|
|
35
|
-
focusSize.width = data.width;
|
|
36
|
-
focusSize.height = data.height;
|
|
37
|
-
focusSize.left = data.left;
|
|
38
|
-
focusSize.top = data.top;
|
|
39
|
-
},
|
|
40
|
-
(error) => {
|
|
41
|
-
console.log("get absolute position failed", error);
|
|
42
|
-
}
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
const onBlur = () => {
|
|
47
|
-
focused.value = false;
|
|
48
|
-
};
|
|
49
|
-
const onClick = () => {
|
|
50
|
-
console.log("item onclick ", props.data);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
// 一般在create的时候进行回调的注册, 使用 option api的可以在created时进行注册
|
|
54
|
-
props.onAction.register("onFocus", onFocus);
|
|
55
|
-
props.onAction.register("onBlur", onBlur);
|
|
56
|
-
props.onAction.register("onClick", onClick);
|
|
57
|
-
</script>
|
|
58
|
-
|
|
59
|
-
<template>
|
|
60
|
-
<div
|
|
61
|
-
:style="{
|
|
62
|
-
width: data.width,
|
|
63
|
-
height: data.height,
|
|
64
|
-
transform: focused ? 'scale3d(1.2, 1.2, 1.2)' : '',
|
|
65
|
-
transition: 'transform 0.2s linear',
|
|
66
|
-
}"
|
|
67
|
-
>
|
|
68
|
-
<div
|
|
69
|
-
ref="divRef"
|
|
70
|
-
:style="{
|
|
71
|
-
width: data.width,
|
|
72
|
-
height: data.height,
|
|
73
|
-
fontSize: '30px',
|
|
74
|
-
color: '#FFFFFF',
|
|
75
|
-
backgroundColor: data.color,
|
|
76
|
-
borderRadius: '10px',
|
|
77
|
-
animation: animation,
|
|
78
|
-
}"
|
|
79
|
-
>
|
|
80
|
-
{{ data.content }}
|
|
81
|
-
</div>
|
|
82
|
-
</div>
|
|
83
|
-
</template>
|
|
@@ -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: (i + props.data.index) % 2 == 0 ? 90 : 180,
|
|
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: 30,
|
|
76
|
-
right: 30,
|
|
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,116 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
* @Author: ChenChanghua
|
|
3
|
-
* @Date: 2022-07-11 13:31:36
|
|
4
|
-
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime: 2022-11-02 15:35:12
|
|
6
|
-
* @Description: file content
|
|
7
|
-
-->
|
|
8
|
-
<script setup>
|
|
9
|
-
import {
|
|
10
|
-
MetroWidget,
|
|
11
|
-
VERTICAL,
|
|
12
|
-
EdgeDirection,
|
|
13
|
-
JsvNinePatch,
|
|
14
|
-
useFocusHub,
|
|
15
|
-
} from "jsview";
|
|
16
|
-
import { advanceMetroWidget } from "../../data";
|
|
17
|
-
import WidgetItem from "../widgets/WidgetItem.vue";
|
|
18
|
-
import focusImg from "./focus1.png";
|
|
19
|
-
import { ref, shallowRef, reactive, provide } from "vue";
|
|
20
|
-
|
|
21
|
-
const focusHub = useFocusHub();
|
|
22
|
-
const showFocus = ref(false);
|
|
23
|
-
|
|
24
|
-
const provideData = () => {
|
|
25
|
-
return advanceMetroWidget;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const onFocus = () => {
|
|
29
|
-
console.log("testtest", " widget onfocus");
|
|
30
|
-
showFocus.value = true;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const onBlur = () => {
|
|
34
|
-
showFocus.value = false;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const focusSize = reactive({
|
|
38
|
-
width: 0,
|
|
39
|
-
height: 0,
|
|
40
|
-
left: 0,
|
|
41
|
-
top: 0,
|
|
42
|
-
});
|
|
43
|
-
provide("focusSize", focusSize);
|
|
44
|
-
|
|
45
|
-
// measures中会返回doSlide: false, 既MetroWidget自身不处理滚动, 滚动由子的sendFocusRectEvent控制
|
|
46
|
-
const measures = (item) => {
|
|
47
|
-
return {
|
|
48
|
-
width: item.width,
|
|
49
|
-
height: item.height,
|
|
50
|
-
marginRight: item.marginRight,
|
|
51
|
-
marginBottom: item.marginBottom,
|
|
52
|
-
doSlide: false,
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
const onEdge = (edgeInfo) => {
|
|
56
|
-
if (edgeInfo.direction == EdgeDirection.left) {
|
|
57
|
-
focusHub.setFocus("mwButton");
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
</script>
|
|
61
|
-
|
|
62
|
-
<template>
|
|
63
|
-
<div
|
|
64
|
-
:style="{
|
|
65
|
-
left: 500,
|
|
66
|
-
top: 20,
|
|
67
|
-
width: 500,
|
|
68
|
-
height: 400,
|
|
69
|
-
fontSize: 30,
|
|
70
|
-
color: '#FFFFFF',
|
|
71
|
-
}"
|
|
72
|
-
>
|
|
73
|
-
{{ `进一步, MetroWidget的item\n可以是包含MetroWidget的组件` }}
|
|
74
|
-
</div>
|
|
75
|
-
<!-- 为了保证边缘的item缩放后依旧完整显示, 需要设置padding, 注意width/height是包含padding的 -->
|
|
76
|
-
<metro-widget
|
|
77
|
-
name="mwWidget"
|
|
78
|
-
:top="100"
|
|
79
|
-
:left="400"
|
|
80
|
-
:provideData="provideData"
|
|
81
|
-
:width="660"
|
|
82
|
-
:height="600"
|
|
83
|
-
:padding="{ left: 30, right: 30 }"
|
|
84
|
-
:direction="VERTICAL"
|
|
85
|
-
:measures="measures"
|
|
86
|
-
:onEdge="onEdge"
|
|
87
|
-
:onFocus="onFocus"
|
|
88
|
-
:onBlur="onBlur"
|
|
89
|
-
>
|
|
90
|
-
<!-- data为每个item的数据, query提供获取MetroWidget内部状态的一些接口, onAction提供item注册自身回调的接口, onItemEdge则是item内部焦点处理到达边缘后, 需要通知MetroWidget时的回调 -->
|
|
91
|
-
<template #renderItem="{ data, query, onAction, onItemEdge }">
|
|
92
|
-
<widget-item
|
|
93
|
-
:data="data"
|
|
94
|
-
:query="query"
|
|
95
|
-
:onAction="onAction"
|
|
96
|
-
:onItemEdge="onItemEdge"
|
|
97
|
-
/>
|
|
98
|
-
</template>
|
|
99
|
-
</metro-widget>
|
|
100
|
-
<jsv-nine-patch
|
|
101
|
-
v-show="showFocus"
|
|
102
|
-
:style="{
|
|
103
|
-
width: focusSize.width,
|
|
104
|
-
height: focusSize.height,
|
|
105
|
-
top: focusSize.top,
|
|
106
|
-
left: focusSize.left,
|
|
107
|
-
}"
|
|
108
|
-
:imageUrl="focusImg"
|
|
109
|
-
:imageWidth="55"
|
|
110
|
-
:centerWidth="1"
|
|
111
|
-
:borderOutset="13"
|
|
112
|
-
:imageDspWidth="55"
|
|
113
|
-
:animTime="0.2"
|
|
114
|
-
:waitForInit="true"
|
|
115
|
-
></jsv-nine-patch>
|
|
116
|
-
</template>
|
|
Binary file
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
* @Author: ChenChanghua
|
|
3
|
-
* @Date: 2022-05-10 15:21:24
|
|
4
|
-
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime: 2022-11-01 15:24:26
|
|
6
|
-
* @Description: file content
|
|
7
|
-
-->
|
|
8
|
-
<script setup>
|
|
9
|
-
import { ref, shallowRef, inject } from "vue";
|
|
10
|
-
|
|
11
|
-
const props = defineProps({
|
|
12
|
-
data: Object,
|
|
13
|
-
query: Object,
|
|
14
|
-
onAction: Object,
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
const divRef = shallowRef(null);
|
|
18
|
-
const focused = ref(false);
|
|
19
|
-
|
|
20
|
-
const focusSize = inject("focusSize");
|
|
21
|
-
|
|
22
|
-
// 自身的焦点状态自己记录, 通过回调来改变
|
|
23
|
-
const onFocus = () => {
|
|
24
|
-
focused.value = true;
|
|
25
|
-
if (focusSize) {
|
|
26
|
-
divRef.value?.getBoundingClientRect().then(
|
|
27
|
-
(data) => {
|
|
28
|
-
console.log("testtest focus size", data)
|
|
29
|
-
focusSize.width = data.width;
|
|
30
|
-
focusSize.height = data.height;
|
|
31
|
-
focusSize.left = data.left;
|
|
32
|
-
focusSize.top = data.top;
|
|
33
|
-
},
|
|
34
|
-
(error) => {
|
|
35
|
-
console.log("testtest abs failed", error);
|
|
36
|
-
}
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
const onBlur = () => {
|
|
41
|
-
focused.value = false;
|
|
42
|
-
};
|
|
43
|
-
const onClick = () => {
|
|
44
|
-
console.log("item onclick ", props.data);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
// 一般在create的时候进行回调的注册, 使用 option api的可以在created时进行注册
|
|
48
|
-
props.onAction.register("onFocus", onFocus);
|
|
49
|
-
props.onAction.register("onBlur", onBlur);
|
|
50
|
-
props.onAction.register("onClick", onClick);
|
|
51
|
-
</script>
|
|
52
|
-
|
|
53
|
-
<template>
|
|
54
|
-
<div
|
|
55
|
-
:style="{
|
|
56
|
-
width: data.width,
|
|
57
|
-
height: data.height,
|
|
58
|
-
transform: focused ? 'scale3d(1.2, 1.2, 1.2)' : '',
|
|
59
|
-
transition: 'transform 0.2s linear',
|
|
60
|
-
}"
|
|
61
|
-
>
|
|
62
|
-
<div
|
|
63
|
-
v-if="focused"
|
|
64
|
-
:style="{
|
|
65
|
-
left: -2,
|
|
66
|
-
top: -2,
|
|
67
|
-
width: data.width + 4,
|
|
68
|
-
height: data.height + 4,
|
|
69
|
-
backgroundColor: '#FF0000',
|
|
70
|
-
}"
|
|
71
|
-
></div>
|
|
72
|
-
<div
|
|
73
|
-
ref="divRef"
|
|
74
|
-
:style="{
|
|
75
|
-
width: data.width,
|
|
76
|
-
height: data.height,
|
|
77
|
-
fontSize: '30px',
|
|
78
|
-
color: '#FFFFFF',
|
|
79
|
-
backgroundColor: data.color,
|
|
80
|
-
}"
|
|
81
|
-
>
|
|
82
|
-
{{ data.content }}
|
|
83
|
-
</div>
|
|
84
|
-
</div>
|
|
85
|
-
</template>
|