@shijiu/jsview-vue 0.9.684 → 0.9.783
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/dom/bin/jsview-browser-debug-dom.min.js +1 -1
- package/dom/bin/jsview-dom.min.js +1 -1
- package/dom/bin/jsview-engine-js-browser.min.js +1 -1
- package/dom/bin/jsview-forge-define.min.js +1 -1
- package/dom/jsv-engine-js-browser.js +6 -0
- package/dom/target_core_revision.js +4 -4
- package/loader/loader.js +4 -0
- package/package.json +1 -1
- package/patches/node_modules/@vue/cli-service/lib/config/base.js +1 -1
- package/samples/AnimPicture/App.vue +5 -5
- package/samples/Basic/components/div/DivLayout.vue +1 -1
- package/samples/Basic/components/img/ImageGroup.vue +2 -2
- package/samples/Basic/components/img/ImgLayout.vue +79 -15
- package/samples/Basic/components/text/TextDirection.vue +104 -0
- package/samples/Basic/components/text/TextEmoji.vue +1 -1
- package/samples/Basic/components/text/TextGroup1.vue +1 -1
- package/samples/Basic/components/text/TextGroup2.vue +11 -1
- package/samples/BasicFocusControl/components/BaseBlock.vue +2 -2
- package/samples/Collision/App.vue +11 -11
- package/samples/DemoHomepage/App.vue +67 -8
- package/samples/DemoHomepage/components/TabFrame.vue +7 -0
- package/samples/DemoHomepage/router.js +27 -26
- package/samples/DemoHomepage/views/Homepage.vue +89 -98
- package/samples/FilterDemo/App.vue +1 -1
- package/samples/FlipCard/App.vue +2 -2
- package/samples/FlipCard/FlipCard.vue +3 -3
- package/samples/FocusBlockDemos/AutoFocus/App.vue +51 -0
- package/samples/FocusBlockDemos/AutoFocus/BaseBlock.vue +82 -0
- package/samples/FocusBlockDemos/AutoFocus/DialogBlock.vue +89 -0
- package/samples/FocusBlockDemos/AutoFocus/DialogContorls.js +42 -0
- package/samples/FocusBlockDemos/AutoFocus/FocusNamesDefine.js +9 -0
- package/samples/FocusBlockDemos/AutoFocus/PlaneBlock.vue +71 -0
- package/samples/FocusBlockDemos/ProgressiveFocusControl/App.vue +78 -0
- package/samples/FocusBlockDemos/ProgressiveFocusControl/BaseBlock.vue +77 -0
- package/samples/FocusBlockDemos/ProgressiveFocusControl/DownPlaneBlock.vue +83 -0
- package/samples/FocusBlockDemos/ProgressiveFocusControl/FocusNamesDefine.js +12 -0
- package/samples/FocusBlockDemos/ProgressiveFocusControl/UpPlaneBlock.vue +83 -0
- package/samples/GridDemo/App.vue +3 -3
- package/samples/GridDemo/ButtonBlock.vue +2 -2
- package/samples/GridDemo/FocusItem.vue +2 -2
- package/samples/GridDemo/Item.vue +1 -1
- package/samples/HashHistory/App.vue +10 -3
- package/samples/HashHistory/components/Item.vue +1 -1
- package/samples/ImpactStop/App.vue +15 -11
- package/samples/Input/InputPanel.vue +1 -1
- package/samples/LongImage/Button.vue +1 -1
- package/samples/LongImage/ButtonItem.vue +1 -1
- package/samples/LongImage/LongImageScroll.vue +2 -2
- package/samples/LongText/App.vue +1 -1
- package/samples/LongText/Button.vue +1 -1
- package/samples/LongText/ButtonItem.vue +1 -1
- package/samples/LongText/LongTextScroll.vue +3 -3
- package/samples/Marquee/App.vue +34 -3
- package/samples/Marquee/longText.js +2 -2
- package/samples/MetroWidgetDemos/PerformanceTest/App.vue +4 -4
- package/samples/MetroWidgetDemos/PerformanceTest/components/ContentItem.vue +1 -1
- package/samples/MetroWidgetDemos/PerformanceTest/components/MyTab.vue +3 -3
- package/samples/MetroWidgetDemos/PingPong/App.vue +22 -11
- package/samples/MetroWidgetDemos/PingPong/AppPage.vue +5 -5
- package/samples/MetroWidgetDemos/{Item.vue → PingPong/Item.vue} +3 -21
- package/samples/MetroWidgetDemos/PingPong/TabItem.vue +1 -1
- package/samples/MetroWidgetDemos/PingPong/ViewSwiper.vue +5 -5
- package/samples/MetroWidgetDemos/{WidgetItem.vue → PingPong/WidgetItem.vue} +8 -4
- package/samples/MetroWidgetDemos/basic/App.vue +162 -0
- package/samples/MetroWidgetDemos/basic/Item.vue +43 -0
- package/samples/MetroWidgetDemos/direction/App.vue +158 -0
- package/samples/MetroWidgetDemos/direction/Item.vue +45 -0
- package/samples/MetroWidgetDemos/focusableItemBasic/App.vue +67 -0
- package/samples/MetroWidgetDemos/{Advanced → focusableItemBasic}/ButtonItem.vue +17 -21
- package/samples/MetroWidgetDemos/focusableItemMetroWidget/App.vue +74 -0
- package/samples/MetroWidgetDemos/{Advanced/widgets → focusableItemMetroWidget}/Item.vue +13 -32
- package/samples/MetroWidgetDemos/{Advanced/widgets → focusableItemMetroWidget}/WidgetItem.vue +12 -12
- package/samples/MetroWidgetDemos/focusableItemMix/App.vue +88 -0
- package/samples/MetroWidgetDemos/focusableItemMix/ButtonItem.vue +86 -0
- package/samples/MetroWidgetDemos/focusableItemMix/Item.vue +43 -0
- package/samples/MetroWidgetDemos/index.js +6 -0
- package/samples/MetroWidgetDemos/layoutType/App.vue +180 -0
- package/samples/MetroWidgetDemos/layoutType/Item.vue +45 -0
- package/samples/MetroWidgetDemos/padding/App.vue +222 -0
- package/samples/MetroWidgetDemos/padding/Item.vue +64 -0
- package/samples/MetroWidgetDemos/routeList.js +64 -0
- package/samples/MetroWidgetDemos/slideSetting/App.vue +225 -0
- package/samples/MetroWidgetDemos/slideSetting/Item.vue +45 -0
- package/samples/NinePatchDemo/App.vue +78 -122
- package/samples/NinePatchDemo/Item.vue +29 -27
- package/samples/Preload/App.vue +1 -1
- package/samples/Preload/Item.vue +1 -1
- package/samples/QrcodeDemo/App.vue +1 -1
- package/samples/SoundPool/App.vue +3 -3
- package/samples/SpriteImage/App.vue +5 -0
- package/samples/Swiper/App.vue +148 -0
- package/samples/TextBox/App.vue +2 -1
- package/samples/TextureAnimation/App2.vue +1 -1
- package/samples/ThrowMoveDemo/LRParabolicDemo.vue +33 -47
- package/samples/TouchSample/MetroWidgetHorizontal.vue +1 -1
- package/samples/TouchSample/MetroWidgetVertical.vue +1 -1
- package/samples/TransitPage/App.vue +1 -1
- package/samples/VideoDemo/App.vue +8 -8
- package/samples/VideoDemo/components/Button.vue +1 -1
- package/samples/VideoDemo/components/Controllor.vue +1 -1
- package/samples/VisibleSensorDemo/App.vue +3 -3
- package/scripts/jsview-run-android.js +5 -4
- package/utils/JsViewEngineWidget/JsvFocusBlock.vue +4 -4
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +79 -50
- package/utils/JsViewEngineWidget/TemplateParser.js +144 -147
- package/utils/JsViewEngineWidget/WidgetCommon.js +12 -3
- package/utils/JsViewPlugin/BrowserPluginLoader.js +4 -2
- package/utils/JsViewPlugin/JsvAudio/AudioProxy.js +302 -0
- package/utils/JsViewPlugin/JsvAudio/CheckType.js +68 -0
- package/utils/JsViewPlugin/JsvAudio/Events.js +17 -0
- package/utils/JsViewPlugin/JsvAudio/JsvAudio.vue +176 -0
- package/utils/JsViewPlugin/JsvAudio/JsvAudioBridgeProxy.js +40 -0
- package/utils/JsViewPlugin/JsvAudio/JsvAudioBrowser.vue +46 -0
- package/utils/JsViewPlugin/JsvAudio/PluginLoader.js +140 -0
- package/utils/JsViewPlugin/JsvAudio/index.js +26 -0
- package/utils/JsViewPlugin/JsvAudio/version.js +24 -0
- package/utils/JsViewPlugin/JsvPlayer/index.js +1 -1
- package/utils/JsViewPlugin/JsvPlayer/version.js +5 -5
- package/utils/JsViewVueTools/JsvHashHistory.js +34 -8
- package/utils/JsViewVueTools/JsvImpactTracer.js +2 -2
- package/utils/JsViewVueTools/JsvRuntimeBridge.js +46 -8
- package/utils/JsViewVueTools/JsvStyleClass.js +9 -0
- package/utils/{JsViewVueWidget/utils/text.js → JsViewVueTools/JsvTextTools.js} +24 -4
- package/utils/JsViewVueTools/TypeCheckAndSet.js +3 -3
- package/utils/JsViewVueTools/index.js +2 -1
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserTextureAnim.vue +5 -7
- package/utils/JsViewVueWidget/JsvActorMove/JsvActorMove.vue +20 -22
- package/utils/JsViewVueWidget/JsvApic/JsvApic.vue +4 -4
- package/utils/JsViewVueWidget/JsvGrid.vue +1 -9
- package/utils/JsViewVueWidget/JsvInput/Cursor.vue +1 -1
- package/utils/JsViewVueWidget/JsvMarquee.vue +91 -20
- package/utils/JsViewVueWidget/JsvMaskClipDiv.vue +1 -1
- package/utils/JsViewVueWidget/JsvNinePatch.vue +63 -53
- package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +10 -5
- package/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue +2 -2
- package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +116 -80
- package/utils/JsViewVueWidget/JsvSwiper/index.js +3 -2
- package/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue +1 -1
- package/utils/JsViewVueWidget/JsvTextBox.vue +11 -31
- package/utils/JsViewVueWidget/JsvTouchContainer.vue +2 -2
- package/utils/JsViewVueWidget/JsvTransparentDiv.vue +1 -1
- package/utils/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue +5 -5
- package/utils/JsViewVueWidget/index.js +8 -8
- package/samples/MetroWidgetDemos/Advanced/App.vue +0 -46
- package/samples/MetroWidgetDemos/Advanced/Buttons.vue +0 -70
- package/samples/MetroWidgetDemos/Advanced/Mixed.vue +0 -77
- package/samples/MetroWidgetDemos/Advanced/widgets/Widgets.vue +0 -116
- package/samples/MetroWidgetDemos/Advanced/widgets/focus1.png +0 -0
- 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/data.js +0 -205
- package/utils/JsViewVueWidget/JsvSwiper/Indicator.vue +0 -35
- package/utils/JsViewVueWidget/utils/index.js +0 -8
|
@@ -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,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, 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,75 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
* @Author: ChenChanghua
|
|
3
|
-
* @Date: 2022-07-11 13:31:36
|
|
4
|
-
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime: 2022-07-18 10:03:44
|
|
6
|
-
* @Description: file content
|
|
7
|
-
-->
|
|
8
|
-
<script setup>
|
|
9
|
-
import { MetroWidget, WholePageSlide, HORIZONTAL, EdgeDirection } from "jsview";
|
|
10
|
-
import { useFocusHub } from "jsview";
|
|
11
|
-
import { simpleDataAbs } from "../data";
|
|
12
|
-
import Item from "../Item.vue";
|
|
13
|
-
const focusHub = useFocusHub();
|
|
14
|
-
|
|
15
|
-
const wholePageSlide = new WholePageSlide();
|
|
16
|
-
|
|
17
|
-
const provideDataAbs = () => {
|
|
18
|
-
return simpleDataAbs;
|
|
19
|
-
};
|
|
20
|
-
const measuresAbs = (item) => {
|
|
21
|
-
return {
|
|
22
|
-
width: item.width,
|
|
23
|
-
height: item.height,
|
|
24
|
-
marginRight: item.marginRight,
|
|
25
|
-
marginBottom: item.marginBottom,
|
|
26
|
-
left: item.left,
|
|
27
|
-
top: item.top,
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
const onEdgeAbs = (edgeInfo) => {
|
|
31
|
-
if (edgeInfo.direction == EdgeDirection.left) {
|
|
32
|
-
focusHub.setFocus("mw");
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
</script>
|
|
36
|
-
|
|
37
|
-
<template>
|
|
38
|
-
<div
|
|
39
|
-
:style="{
|
|
40
|
-
left: 700,
|
|
41
|
-
top: 50,
|
|
42
|
-
width: 700,
|
|
43
|
-
height: 50,
|
|
44
|
-
color: '#FFFFFF',
|
|
45
|
-
fontSize: 30,
|
|
46
|
-
}"
|
|
47
|
-
>
|
|
48
|
-
绝对坐标布局
|
|
49
|
-
</div>
|
|
50
|
-
<!-- 绝对坐标布局, 将layoutType设为absolute, measures返回的对象需要有left,top信息 -->
|
|
51
|
-
<metro-widget
|
|
52
|
-
name="mwAbs"
|
|
53
|
-
:top="150"
|
|
54
|
-
:left="700"
|
|
55
|
-
:provideData="provideDataAbs"
|
|
56
|
-
:width="500"
|
|
57
|
-
:height="400"
|
|
58
|
-
:padding="{
|
|
59
|
-
left: 50,
|
|
60
|
-
top: 50,
|
|
61
|
-
right: 50,
|
|
62
|
-
bottom: 50,
|
|
63
|
-
}"
|
|
64
|
-
:direction="HORIZONTAL"
|
|
65
|
-
:measures="measuresAbs"
|
|
66
|
-
:slideSetting="wholePageSlide"
|
|
67
|
-
:onEdge="onEdgeAbs"
|
|
68
|
-
layoutType="absolute"
|
|
69
|
-
>
|
|
70
|
-
<!-- data为每个item的数据, query提供获取MetroWidget内部状态的一些接口, onAction提供item注册自身回调的接口 -->
|
|
71
|
-
<template #renderItem="{ data, query, onAction }">
|
|
72
|
-
<item :data="data" :query="query" :onAction="onAction" />
|
|
73
|
-
</template>
|
|
74
|
-
</metro-widget>
|
|
75
|
-
</template>
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
* @Author: ChenChanghua
|
|
3
|
-
* @Date: 2022-07-11 13:31:36
|
|
4
|
-
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime: 2022-07-18 10:06:28
|
|
6
|
-
* @Description: file content
|
|
7
|
-
-->
|
|
8
|
-
<script setup>
|
|
9
|
-
import { MetroWidget, WholePageSlide, HORIZONTAL, EdgeDirection } from "jsview";
|
|
10
|
-
import { useRouter } from "vue-router";
|
|
11
|
-
import { useFocusHub } from "jsview";
|
|
12
|
-
import AbsoluteTemplate from "./AbsoluteTemplate.vue";
|
|
13
|
-
import RelativeTemplate from "./RelativeTemplate.vue";
|
|
14
|
-
|
|
15
|
-
const router = useRouter();
|
|
16
|
-
const focusHub = useFocusHub();
|
|
17
|
-
|
|
18
|
-
const onFocus = () => {
|
|
19
|
-
focusHub.setFocus("button");
|
|
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
|
-
<absolute-template></absolute-template>
|
|
43
|
-
<relative-template></relative-template>
|
|
44
|
-
</jsv-focus-block>
|
|
45
|
-
</template>
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
* @Author: ChenChanghua
|
|
3
|
-
* @Date: 2022-07-11 13:31:36
|
|
4
|
-
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime: 2022-07-18 10:07:01
|
|
6
|
-
* @Description: file content
|
|
7
|
-
-->
|
|
8
|
-
<script setup>
|
|
9
|
-
import { MetroWidget, WholePageSlide, HORIZONTAL, EdgeDirection } from "jsview";
|
|
10
|
-
import { ref } from "vue";
|
|
11
|
-
import { useFocusHub } from "jsview";
|
|
12
|
-
import { simpleData } from "../data";
|
|
13
|
-
import Item from "../Item.vue";
|
|
14
|
-
|
|
15
|
-
const focusHub = useFocusHub();
|
|
16
|
-
const mwRef = ref(null);
|
|
17
|
-
|
|
18
|
-
const wholePageSlide = new WholePageSlide();
|
|
19
|
-
let innerData = simpleData.concat();
|
|
20
|
-
let dataPool = [];
|
|
21
|
-
|
|
22
|
-
const provideData = () => {
|
|
23
|
-
return innerData;
|
|
24
|
-
};
|
|
25
|
-
const measures = (item) => {
|
|
26
|
-
return {
|
|
27
|
-
width: item.width,
|
|
28
|
-
height: item.height,
|
|
29
|
-
marginRight: item.marginRight,
|
|
30
|
-
marginBottom: item.marginBottom,
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
const onEdge = (edgeInfo) => {
|
|
34
|
-
// MetroWidget焦点到达边缘后的回调
|
|
35
|
-
if (edgeInfo.direction == EdgeDirection.top) {
|
|
36
|
-
buttonFocus.value = true;
|
|
37
|
-
focusHub.setFocus("button");
|
|
38
|
-
} else if (edgeInfo.direction == EdgeDirection.right) {
|
|
39
|
-
focusHub.setFocus("mwAbs");
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const buttonFocus = ref(true);
|
|
44
|
-
const buttonOnKeyDown = (ev) => {
|
|
45
|
-
switch (ev.keyCode) {
|
|
46
|
-
case 40:
|
|
47
|
-
buttonFocus.value = false;
|
|
48
|
-
focusHub.setFocus("mw");
|
|
49
|
-
return true;
|
|
50
|
-
case 13:
|
|
51
|
-
if (innerData.length == simpleData.length) {
|
|
52
|
-
innerData = [];
|
|
53
|
-
dataPool = simpleData.concat();
|
|
54
|
-
} else {
|
|
55
|
-
innerData.push(dataPool.shift());
|
|
56
|
-
}
|
|
57
|
-
mwRef.value?.refreshData(true);
|
|
58
|
-
return true;
|
|
59
|
-
}
|
|
60
|
-
return false;
|
|
61
|
-
};
|
|
62
|
-
</script>
|
|
63
|
-
|
|
64
|
-
<template>
|
|
65
|
-
<jsv-focus-block
|
|
66
|
-
name="button"
|
|
67
|
-
:onAction="{
|
|
68
|
-
onKeyDown: buttonOnKeyDown,
|
|
69
|
-
}"
|
|
70
|
-
>
|
|
71
|
-
<div
|
|
72
|
-
:style="{
|
|
73
|
-
left: 100,
|
|
74
|
-
top: 50,
|
|
75
|
-
width: 500,
|
|
76
|
-
height: 100,
|
|
77
|
-
color: '#FFFFFF',
|
|
78
|
-
fontSize: 30,
|
|
79
|
-
backgroundColor: buttonFocus ? '#AA0000' : '#444444',
|
|
80
|
-
}"
|
|
81
|
-
>
|
|
82
|
-
{{ `自适应布局\n获焦时按确认查看时item排布的方式` }}
|
|
83
|
-
</div>
|
|
84
|
-
</jsv-focus-block>
|
|
85
|
-
|
|
86
|
-
<!-- item的排布区域为600*300, 但由于获焦时需要放大, 因此需要往外扩展padding, 合起来宽高为700*400 -->
|
|
87
|
-
<metro-widget
|
|
88
|
-
name="mw"
|
|
89
|
-
ref="mwRef"
|
|
90
|
-
:top="150"
|
|
91
|
-
:left="50"
|
|
92
|
-
:provideData="provideData"
|
|
93
|
-
:width="500"
|
|
94
|
-
:height="400"
|
|
95
|
-
:padding="{
|
|
96
|
-
left: 50,
|
|
97
|
-
top: 50,
|
|
98
|
-
right: 50,
|
|
99
|
-
bottom: 50,
|
|
100
|
-
}"
|
|
101
|
-
:direction="HORIZONTAL"
|
|
102
|
-
:measures="measures"
|
|
103
|
-
:slideSetting="wholePageSlide"
|
|
104
|
-
:onEdge="onEdge"
|
|
105
|
-
>
|
|
106
|
-
<!-- data为每个item的数据, query提供获取MetroWidget内部状态的一些接口, onAction提供item注册自身回调的接口 -->
|
|
107
|
-
<template #renderItem="{ data, query, onAction }">
|
|
108
|
-
<item :data="data" :query="query" :onAction="onAction" />
|
|
109
|
-
</template>
|
|
110
|
-
</metro-widget>
|
|
111
|
-
</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,35 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
* @Author: ChenChanghua
|
|
3
|
-
* @Date: 2021-11-23 09:44:44
|
|
4
|
-
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime: 2021-11-23 17:11:08
|
|
6
|
-
* @Description: file content
|
|
7
|
-
-->
|
|
8
|
-
<script>
|
|
9
|
-
export default {
|
|
10
|
-
props: {
|
|
11
|
-
number: Number,
|
|
12
|
-
vertical: Boolean,
|
|
13
|
-
itemSize: Number,
|
|
14
|
-
current: Number,
|
|
15
|
-
},
|
|
16
|
-
computed: {
|
|
17
|
-
indexList() {
|
|
18
|
-
return new Array(this.number).fill(0).map((_, index) => {
|
|
19
|
-
return index;
|
|
20
|
-
});
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
</script>
|
|
25
|
-
|
|
26
|
-
<template>
|
|
27
|
-
<div
|
|
28
|
-
v-for="index in indexList"
|
|
29
|
-
:key="index"
|
|
30
|
-
:style="vertical ? { top: itemSize * index } : { left: itemSize * index }"
|
|
31
|
-
>
|
|
32
|
-
<slot v-if="index == current" name="current"></slot>
|
|
33
|
-
<slot v-else name="normal"></slot>
|
|
34
|
-
</div>
|
|
35
|
-
</template>
|