@shijiu/jsview-vue 0.9.502 → 0.9.590
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/target_core_revision.js +4 -3
- package/index.js +10 -0
- package/package.json +8 -1
- package/patches/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js +16 -5
- package/samples/AnimPicture/App.vue +89 -106
- package/samples/Basic/App.vue +65 -68
- package/samples/Basic/components/ContentBlock.vue +31 -36
- package/samples/Basic/components/anim/AnimGroup.vue +61 -75
- package/samples/Basic/components/anim/AnimKeyframeBasic.vue +54 -43
- package/samples/Basic/components/anim/AnimKeyframeComposite.vue +25 -31
- package/samples/Basic/components/anim/AnimTransition.vue +142 -105
- package/samples/Basic/components/div/DivBackground.vue +38 -16
- package/samples/Basic/components/div/DivClip.vue +143 -78
- package/samples/Basic/components/div/DivCssScoped.vue +10 -10
- package/samples/Basic/components/div/DivCssVar.vue +40 -42
- package/samples/Basic/components/div/DivGroup1.vue +45 -39
- package/samples/Basic/components/div/DivGroup2.vue +56 -45
- package/samples/Basic/components/div/DivLayout.vue +34 -5
- package/samples/Basic/components/div/DivRadius.vue +51 -42
- package/samples/Basic/components/div/DivTransform.vue +21 -16
- package/samples/Basic/components/panel/Panel1.vue +46 -44
- package/samples/Basic/components/panel/Panel2.vue +22 -26
- package/samples/Basic/components/panel/TitleBar.vue +12 -12
- package/samples/Basic/components/text/TextAlign.vue +54 -44
- package/samples/Basic/components/text/TextEmoji.vue +16 -20
- package/samples/Basic/components/text/TextFontStyle.vue +77 -53
- package/samples/Basic/components/text/TextGroup1.vue +46 -38
- package/samples/Basic/components/text/TextGroup2.vue +25 -28
- package/samples/Basic/components/text/TextOverflow.vue +76 -57
- package/samples/BasicFocusControl/App.vue +22 -43
- package/samples/BasicFocusControl/components/BaseBlock.vue +42 -43
- package/samples/BasicFocusControl/components/MainArea.vue +55 -70
- package/samples/BasicFocusControl/components/MainAreaLeftBlock.vue +11 -15
- package/samples/BasicFocusControl/components/MainAreaRightBlock.vue +21 -24
- package/samples/BasicFocusControl/components/SideBar.vue +32 -47
- package/samples/BasicFocusControl/components/SideBarBlock.vue +20 -23
- package/samples/ColorSpace/App.vue +15 -24
- package/samples/DemoHomepage/App.vue +7 -11
- package/samples/DemoHomepage/components/BodyFrame.vue +19 -9
- package/samples/DemoHomepage/components/TabFrame.vue +7 -8
- package/samples/DemoHomepage/router.js +32 -33
- package/samples/DemoHomepage/views/Homepage.vue +24 -8
- package/samples/FilterDemo/AnimatePic.vue +58 -0
- package/samples/FilterDemo/App.vue +99 -61
- package/samples/FilterDemo/VideoLayer.vue +62 -0
- package/samples/FlipCard/App.vue +32 -41
- package/samples/FlipCard/FlipCard.vue +48 -54
- package/samples/GridDemo/App.vue +109 -77
- package/samples/GridDemo/ButtonBlock.vue +50 -49
- package/samples/GridDemo/FocusItem.vue +19 -38
- package/samples/GridDemo/Item.vue +46 -54
- package/samples/HashHistory/App.vue +63 -79
- package/samples/HashHistory/components/HorizontalButtonList.vue +72 -95
- package/samples/HashHistory/components/Item.vue +42 -56
- package/samples/HashHistory/router.js +23 -12
- package/samples/HashHistory/views/MainPage.vue +35 -46
- package/samples/HashHistory/views/SubPage.vue +34 -47
- package/samples/Input/App.vue +2 -3
- package/samples/Input/FullKeyboard.vue +2 -6
- package/samples/Input/InputPanel.vue +2 -3
- package/samples/Input/KeyboardItem.vue +1 -1
- package/samples/LongImage/App.vue +11 -27
- package/samples/LongImage/Button.vue +50 -145
- package/samples/LongImage/ButtonItem.vue +44 -0
- package/samples/LongImage/LongImageScroll.vue +71 -106
- package/samples/LongImage/Scroll.vue +7 -9
- package/samples/LongText/App.vue +13 -28
- package/samples/LongText/Button.vue +43 -145
- package/samples/LongText/ButtonItem.vue +44 -0
- package/samples/LongText/LongTextScroll.vue +68 -101
- package/samples/LongText/Scroll.vue +7 -9
- package/samples/Marquee/App.vue +34 -37
- package/samples/MaskClip/App.vue +17 -30
- package/samples/MetroWidgetDemos/Advanced/App.vue +211 -0
- package/samples/MetroWidgetDemos/Advanced/ButtonItem.vue +90 -0
- package/samples/MetroWidgetDemos/Item.vue +67 -0
- package/samples/{SimpleWidgetDemo → MetroWidgetDemos/PerformanceTest}/App.vue +80 -104
- package/samples/{SimpleWidgetDemo → MetroWidgetDemos/PerformanceTest}/Item.vue +7 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/bg.jpg +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/coupon_content.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/coupon_left.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/coupon_mid.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/coupon_right.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/focus_border.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/holder_logo.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/jrbm.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/line_left.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/line_mid.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/line_right.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/loading.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/logo.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/mcjx.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/tao.png +0 -0
- package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/tmall.png +0 -0
- package/samples/{SimpleWidgetDemo → MetroWidgetDemos/PerformanceTest}/border.png +0 -0
- package/samples/{SimpleWidgetDemo → MetroWidgetDemos/PerformanceTest}/components/ContentItem.vue +60 -86
- package/samples/{SimpleWidgetDemo → MetroWidgetDemos/PerformanceTest}/components/MyTab.vue +0 -0
- package/samples/MetroWidgetDemos/PerformanceTest/data.js +45 -0
- package/samples/MetroWidgetDemos/PingPong/App.vue +135 -0
- package/samples/MetroWidgetDemos/PingPong/AppPage.vue +58 -0
- package/samples/MetroWidgetDemos/PingPong/AppTab.vue +69 -0
- package/samples/MetroWidgetDemos/PingPong/Item.vue +92 -0
- package/samples/MetroWidgetDemos/PingPong/ViewSwiper.vue +214 -0
- package/samples/MetroWidgetDemos/Simple/App.vue +194 -0
- package/samples/MetroWidgetDemos/WidgetItem.vue +89 -0
- package/samples/MetroWidgetDemos/data.js +204 -0
- package/samples/NinePatchDemo/App.vue +114 -115
- package/samples/NinePatchDemo/Item.vue +7 -8
- package/samples/Preload/App.vue +61 -63
- package/samples/Preload/Item.vue +21 -29
- package/samples/QrcodeDemo/App.vue +24 -29
- package/samples/SoundPool/App.vue +77 -106
- package/samples/SprayView/App.vue +10 -8
- package/samples/SpriteImage/App.vue +1 -2
- package/samples/TextBox/App.vue +86 -101
- package/samples/TextBox/RenderCenter.vue +1 -1
- package/samples/TextBox/RenderLeft.vue +1 -1
- package/samples/TextBox/RenderOneLine.vue +1 -1
- package/samples/TextBox/RenderRight.vue +1 -1
- package/samples/TextShadowDemo/App.vue +1 -2
- package/samples/TextureAnimation/App.vue +16 -13
- package/samples/TextureSize/App.vue +15 -25
- package/samples/ThrowMoveDemo/AccelerateDemo.vue +2 -4
- package/samples/ThrowMoveDemo/LRParabolicDemo.vue +2 -3
- package/samples/ThrowMoveDemo/TargetDemo.vue +3 -4
- package/samples/ThrowMoveDemo/UDParabolicDemo.vue +2 -3
- package/samples/TouchSample/App.vue +2 -3
- package/samples/TouchSample/Item.vue +15 -13
- package/samples/TouchSample/MetroWidgetHorizontal.vue +2 -2
- package/samples/TouchSample/MetroWidgetVertical.vue +1 -1
- package/samples/TouchSample/TouchContainerHorizontal.vue +4 -3
- package/samples/TouchSample/TouchContainerVertical.vue +3 -2
- package/samples/TransitPage/App.vue +20 -32
- package/samples/VideoDemo/App.vue +65 -81
- package/samples/VideoDemo/components/Button.vue +41 -52
- package/samples/VideoDemo/components/Controllor.vue +171 -169
- package/samples/VideoDemo/components/VideoFrame.vue +87 -99
- package/samples/VisibleSensorDemo/App.vue +167 -0
- package/scripts/jsview-jsmap-serve.js +42 -0
- package/scripts/jsview-post-install.js +1 -1
- package/tsconfig.json +3 -0
- package/utils/JsViewEngineWidget/JsvFocusBlock.vue +204 -193
- package/utils/JsViewEngineWidget/JsvFocusManager.js +30 -17
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +1555 -1656
- package/utils/JsViewEngineWidget/MetroWidget/PageUpdater.js +136 -0
- package/utils/JsViewEngineWidget/MetroWidget/ToolFunctions.js +18 -0
- package/utils/JsViewEngineWidget/TemplateParser.js +111 -1
- package/utils/JsViewEngineWidget/WidgetCommon.js +8 -2
- package/utils/JsViewEngineWidget/index.js +4 -4
- package/utils/JsViewPlugin/JsvPlayer/GetVersion.js +1 -1
- package/utils/JsViewPlugin/JsvPlayer/JsvMedia.js +264 -54
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +5 -1
- package/utils/JsViewPlugin/JsvPlayer/version.js +5 -5
- package/utils/JsViewVueTools/JsvRefTaker.js +35 -0
- package/utils/JsViewVueTools/index.js +19 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserQrcode.vue +8 -4
- package/utils/JsViewVueWidget/JsvFilterView.vue +59 -51
- package/utils/JsViewVueWidget/JsvGrid.vue +139 -41
- package/utils/JsViewVueWidget/JsvMaskClipDiv.vue +3 -1
- package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +8 -17
- package/utils/JsViewVueWidget/JsvNinePatch.vue +1 -1
- package/utils/JsViewVueWidget/JsvPosterDiv.vue +37 -7
- package/utils/JsViewVueWidget/JsvPosterImage.vue +34 -13
- package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +2 -12
- package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +1 -1
- package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +13 -10
- package/utils/JsViewVueWidget/JsvSpriteAnim/index.js +2 -3
- package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +25 -21
- package/utils/JsViewVueWidget/JsvTransparentDiv.vue +7 -8
- package/utils/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue +141 -0
- package/utils/JsViewVueWidget/JsvVisibleSensor/index.js +9 -0
- package/utils/JsViewVueWidget/index.js +42 -0
- package/samples/AdvanceMetroWidget/App.vue +0 -123
- package/samples/AdvanceMetroWidget/Frame.vue +0 -102
- package/samples/AdvanceMetroWidget/Item.vue +0 -63
- package/samples/AdvanceMetroWidget/data.js +0 -137
- package/samples/ClassNameDemo/App.vue +0 -119
- package/samples/ClassNameDemo/components/ContentItem.vue +0 -253
- package/samples/ClassNameDemo/components/LoadingView.vue +0 -43
- package/samples/ClassNameDemo/components/TitleView.vue +0 -24
- package/samples/ClassNameDemo/data.js +0 -24
- package/samples/FlowMultiWidget/App.vue +0 -91
- package/samples/FlowMultiWidget/assets/nine_patch_focus.png +0 -0
- package/samples/FlowMultiWidget/components/Block.vue +0 -107
- package/samples/FlowMultiWidget/components/FlowPage.vue +0 -60
- package/samples/FlowMultiWidget/components/Item.vue +0 -103
- package/samples/FlowMultiWidget/components/MenuItem.vue +0 -72
- package/samples/FlowMultiWidget/components/MyMenu.vue +0 -90
- package/samples/FlowMultiWidget/data.js +0 -446
- package/samples/HashHistory/views/BasePage.vue +0 -19
- package/samples/HashHistory/views/SubPageFirst.vue +0 -10
- package/samples/HashHistory/views/SubPageSecond.vue +0 -10
- package/samples/SimpleWidgetDemo/assets/bg.jpg +0 -0
- package/samples/SimpleWidgetDemo/assets/coupon_content.png +0 -0
- package/samples/SimpleWidgetDemo/assets/coupon_left.png +0 -0
- package/samples/SimpleWidgetDemo/assets/coupon_mid.png +0 -0
- package/samples/SimpleWidgetDemo/assets/coupon_right.png +0 -0
- package/samples/SimpleWidgetDemo/assets/focus_border.png +0 -0
- package/samples/SimpleWidgetDemo/assets/holder_logo.png +0 -0
- package/samples/SimpleWidgetDemo/assets/jrbm.png +0 -0
- package/samples/SimpleWidgetDemo/assets/line_left.png +0 -0
- package/samples/SimpleWidgetDemo/assets/line_mid.png +0 -0
- package/samples/SimpleWidgetDemo/assets/line_right.png +0 -0
- package/samples/SimpleWidgetDemo/assets/loading.png +0 -0
- package/samples/SimpleWidgetDemo/assets/logo.png +0 -0
- package/samples/SimpleWidgetDemo/assets/mcjx.png +0 -0
- package/samples/SimpleWidgetDemo/assets/tao.png +0 -0
- package/samples/SimpleWidgetDemo/assets/tmall.png +0 -0
- package/samples/SimpleWidgetDemo/data.js +0 -124
- package/utils/JsViewEngineWidget/MetroWidget/ContentView.vue +0 -63
- package/utils/JsViewEngineWidget/MetroWidget/DivWrapper.vue +0 -51
- package/utils/JsViewEngineWidget/MetroWidget/ItemView.vue +0 -213
- package/utils/JsViewEngineWidget/MetroWidget/RootView.vue +0 -154
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2022-07-11 13:31:36
|
|
4
|
+
* @LastEditors: ChenChanghua
|
|
5
|
+
* @LastEditTime: 2022-07-11 18:02:13
|
|
6
|
+
* @Description: file content
|
|
7
|
+
-->
|
|
8
|
+
<script setup>
|
|
9
|
+
import { MetroWidget, VERTICAL, EdgeDirection } from "jsview";
|
|
10
|
+
import { useRouter } from "vue-router";
|
|
11
|
+
import { ref } from "vue";
|
|
12
|
+
import { useFocusHub } from "jsview";
|
|
13
|
+
import { advanceButton, advanceMetroWidget, advanceMix } from "../data";
|
|
14
|
+
import ButtonItem from "./ButtonItem.vue";
|
|
15
|
+
import WidgetItem from "../WidgetItem.vue";
|
|
16
|
+
import Item from "../Item.vue";
|
|
17
|
+
|
|
18
|
+
const router = useRouter();
|
|
19
|
+
const foucsHub = useFocusHub();
|
|
20
|
+
|
|
21
|
+
const onFocus = () => {
|
|
22
|
+
foucsHub.setFocus("mwButton");
|
|
23
|
+
};
|
|
24
|
+
const onKeyDown = (ev) => {
|
|
25
|
+
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
26
|
+
router.go(-1);
|
|
27
|
+
}
|
|
28
|
+
return true;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
//item为Buttonitem的一些回调
|
|
32
|
+
const provideData = () => {
|
|
33
|
+
return advanceButton;
|
|
34
|
+
};
|
|
35
|
+
const measures = (item) => {
|
|
36
|
+
return {
|
|
37
|
+
width: item.width,
|
|
38
|
+
height: item.height,
|
|
39
|
+
marginRight: item.marginRight,
|
|
40
|
+
marginBottom: item.marginBottom,
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
const onEdge = (edgeInfo) => {
|
|
44
|
+
if (edgeInfo.direction == EdgeDirection.right) {
|
|
45
|
+
foucsHub.setFocus("mwWidget");
|
|
46
|
+
} else if (edgeInfo.direction == EdgeDirection.bottom) {
|
|
47
|
+
foucsHub.setFocus("mwMix");
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
//item为Widgetitem的一些回调
|
|
52
|
+
const provideData2 = () => {
|
|
53
|
+
return advanceMetroWidget;
|
|
54
|
+
};
|
|
55
|
+
const measures2 = (item) => {
|
|
56
|
+
return {
|
|
57
|
+
width: item.width,
|
|
58
|
+
height: item.height,
|
|
59
|
+
marginRight: item.marginRight,
|
|
60
|
+
marginBottom: item.marginBottom,
|
|
61
|
+
doSlide: false,
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
const onEdge2 = (edgeInfo) => {
|
|
65
|
+
if (edgeInfo.direction == EdgeDirection.left) {
|
|
66
|
+
foucsHub.setFocus("mwButton");
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
//item混排的回调
|
|
71
|
+
const provideData3 = () => {
|
|
72
|
+
return advanceMix;
|
|
73
|
+
};
|
|
74
|
+
const measures3 = (item) => {
|
|
75
|
+
return {
|
|
76
|
+
width: item.width,
|
|
77
|
+
height: item.height,
|
|
78
|
+
marginRight: item.marginRight,
|
|
79
|
+
marginBottom: item.marginBottom,
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
const onEdge3 = (edgeInfo) => {
|
|
83
|
+
if (edgeInfo.direction == EdgeDirection.right) {
|
|
84
|
+
foucsHub.setFocus("mwWidget");
|
|
85
|
+
} else if (edgeInfo.direction == EdgeDirection.top) {
|
|
86
|
+
foucsHub.setFocus("mwButton");
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
</script>
|
|
90
|
+
|
|
91
|
+
<template>
|
|
92
|
+
<jsv-focus-block
|
|
93
|
+
autoFocus
|
|
94
|
+
:onAction="{
|
|
95
|
+
onKeyDown,
|
|
96
|
+
onFocus,
|
|
97
|
+
}"
|
|
98
|
+
:style="{
|
|
99
|
+
width: 1920,
|
|
100
|
+
height: 1080,
|
|
101
|
+
backgroundColor: '#007788',
|
|
102
|
+
}"
|
|
103
|
+
>
|
|
104
|
+
<div
|
|
105
|
+
:style="{
|
|
106
|
+
left: 50,
|
|
107
|
+
top: 50,
|
|
108
|
+
width: 300,
|
|
109
|
+
height: 400,
|
|
110
|
+
fontSize: 30,
|
|
111
|
+
color: '#FFFFFF',
|
|
112
|
+
}"
|
|
113
|
+
>
|
|
114
|
+
{{ `item可以是可获得焦点的控件` }}
|
|
115
|
+
</div>
|
|
116
|
+
<metro-widget
|
|
117
|
+
name="mwButton"
|
|
118
|
+
:top="150"
|
|
119
|
+
:left="50"
|
|
120
|
+
:provideData="provideData"
|
|
121
|
+
:width="220"
|
|
122
|
+
:height="400"
|
|
123
|
+
:direction="VERTICAL"
|
|
124
|
+
:measures="measures"
|
|
125
|
+
:onEdge="onEdge"
|
|
126
|
+
>
|
|
127
|
+
<template #renderItem="{ data, query, onAction, onItemEdge }">
|
|
128
|
+
<button-item
|
|
129
|
+
:data="data"
|
|
130
|
+
:query="query"
|
|
131
|
+
:onAction="onAction"
|
|
132
|
+
:onItemEdge="onItemEdge"
|
|
133
|
+
/>
|
|
134
|
+
</template>
|
|
135
|
+
</metro-widget>
|
|
136
|
+
|
|
137
|
+
<div
|
|
138
|
+
:style="{
|
|
139
|
+
left: 50,
|
|
140
|
+
top: 350,
|
|
141
|
+
width: 300,
|
|
142
|
+
height: 400,
|
|
143
|
+
fontSize: 30,
|
|
144
|
+
color: '#FFFFFF',
|
|
145
|
+
}"
|
|
146
|
+
>
|
|
147
|
+
{{ `item可以普通描画控件和可获焦控件混排` }}
|
|
148
|
+
</div>
|
|
149
|
+
<metro-widget
|
|
150
|
+
name="mwMix"
|
|
151
|
+
:top="450"
|
|
152
|
+
:left="50"
|
|
153
|
+
:provideData="provideData3"
|
|
154
|
+
:width="260"
|
|
155
|
+
:height="440"
|
|
156
|
+
:padding="{
|
|
157
|
+
top: 20,
|
|
158
|
+
left: 20,
|
|
159
|
+
}"
|
|
160
|
+
:direction="VERTICAL"
|
|
161
|
+
:measures="measures3"
|
|
162
|
+
:onEdge="onEdge3"
|
|
163
|
+
>
|
|
164
|
+
<template #renderItem="{ data, query, onAction, onItemEdge }">
|
|
165
|
+
<button-item
|
|
166
|
+
v-if="data.type == 'button'"
|
|
167
|
+
:data="data"
|
|
168
|
+
:query="query"
|
|
169
|
+
:onAction="onAction"
|
|
170
|
+
:onItemEdge="onItemEdge"
|
|
171
|
+
/>
|
|
172
|
+
<item v-else :data="data" :query="query" :onAction="onAction" />
|
|
173
|
+
</template>
|
|
174
|
+
</metro-widget>
|
|
175
|
+
|
|
176
|
+
<div
|
|
177
|
+
:style="{
|
|
178
|
+
left: 500,
|
|
179
|
+
top: 50,
|
|
180
|
+
width: 500,
|
|
181
|
+
height: 400,
|
|
182
|
+
fontSize: 30,
|
|
183
|
+
color: '#FFFFFF',
|
|
184
|
+
}"
|
|
185
|
+
>
|
|
186
|
+
{{ `进一步, MetroWidget的item\n可以是包含MetroWidget的组件` }}
|
|
187
|
+
</div>
|
|
188
|
+
<metro-widget
|
|
189
|
+
name="mwWidget"
|
|
190
|
+
:top="150"
|
|
191
|
+
:left="400"
|
|
192
|
+
:provideData="provideData2"
|
|
193
|
+
:width="600"
|
|
194
|
+
:height="600"
|
|
195
|
+
:direction="VERTICAL"
|
|
196
|
+
:measures="measures2"
|
|
197
|
+
:onEdge="onEdge2"
|
|
198
|
+
>
|
|
199
|
+
<!-- data为每个item的数据, query提供获取MetroWidget内部状态的一些接口, onAction提供item注册自身回调的接口, onItemEdge则是item内部焦点处理到达边缘后, 需要通知MetroWidget时的回调 -->
|
|
200
|
+
<!-- measure2中会返回doSlide: false, 既MetroWidget自身不处理滚动, 滚动由子的sendFocusRectEvent控制 -->
|
|
201
|
+
<template #renderItem="{ data, query, onAction, onItemEdge }">
|
|
202
|
+
<widget-item
|
|
203
|
+
:data="data"
|
|
204
|
+
:query="query"
|
|
205
|
+
:onAction="onAction"
|
|
206
|
+
:onItemEdge="onItemEdge"
|
|
207
|
+
/>
|
|
208
|
+
</template>
|
|
209
|
+
</metro-widget>
|
|
210
|
+
</jsv-focus-block>
|
|
211
|
+
</template>
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2022-07-11 13:26:24
|
|
4
|
+
* @LastEditors: ChenChanghua
|
|
5
|
+
* @LastEditTime: 2022-07-11 17:00:47
|
|
6
|
+
* @Description: file content
|
|
7
|
+
-->
|
|
8
|
+
<script setup>
|
|
9
|
+
import { ref } 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 = ref(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>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2022-05-10 15:21:24
|
|
4
|
+
* @LastEditors: ChenChanghua
|
|
5
|
+
* @LastEditTime: 2022-07-11 17:00:58
|
|
6
|
+
* @Description: file content
|
|
7
|
+
-->
|
|
8
|
+
<script setup>
|
|
9
|
+
import { ref } from "vue";
|
|
10
|
+
|
|
11
|
+
const props = defineProps({
|
|
12
|
+
data: Object,
|
|
13
|
+
query: Object,
|
|
14
|
+
onAction: Object,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const focused = ref(false);
|
|
18
|
+
|
|
19
|
+
// 自身的焦点状态自己记录, 通过回调来改变
|
|
20
|
+
const onFocus = () => {
|
|
21
|
+
focused.value = true;
|
|
22
|
+
};
|
|
23
|
+
const onBlur = () => {
|
|
24
|
+
focused.value = false;
|
|
25
|
+
};
|
|
26
|
+
const onClick = () => {
|
|
27
|
+
console.log("item onclick ", props.data);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// 一般在create的时候进行回调的注册, 使用 option api的可以在created时进行注册
|
|
31
|
+
props.onAction.register("onFocus", onFocus);
|
|
32
|
+
props.onAction.register("onBlur", onBlur);
|
|
33
|
+
props.onAction.register("onClick", onClick);
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<template>
|
|
37
|
+
<div
|
|
38
|
+
:style="{
|
|
39
|
+
width: data.width,
|
|
40
|
+
height: data.height,
|
|
41
|
+
transform: focused ? 'scale3d(1.2, 1.2, 1.2)' : '',
|
|
42
|
+
transition: 'transform 0.2s linear',
|
|
43
|
+
}"
|
|
44
|
+
>
|
|
45
|
+
<div
|
|
46
|
+
v-if="focused"
|
|
47
|
+
:style="{
|
|
48
|
+
left: -2,
|
|
49
|
+
top: -2,
|
|
50
|
+
width: data.width + 4,
|
|
51
|
+
height: data.height + 4,
|
|
52
|
+
backgroundColor: '#FF0000',
|
|
53
|
+
}"
|
|
54
|
+
></div>
|
|
55
|
+
<div
|
|
56
|
+
:style="{
|
|
57
|
+
width: data.width,
|
|
58
|
+
height: data.height,
|
|
59
|
+
fontSize: '30px',
|
|
60
|
+
color: '#FFFFFF',
|
|
61
|
+
backgroundColor: data.color,
|
|
62
|
+
}"
|
|
63
|
+
>
|
|
64
|
+
{{ data.content }}
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
</template>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
* 【界面概述】
|
|
3
|
-
* 展示
|
|
3
|
+
* 展示MetroWidget控件的用法
|
|
4
4
|
*
|
|
5
5
|
* 【控件介绍】
|
|
6
|
-
*
|
|
6
|
+
* MetroWidget:
|
|
7
7
|
* top {int} 控件的y,默认为0
|
|
8
8
|
* left {int} 控件的x, 默认为0
|
|
9
9
|
* width {int} (必选)控件的宽
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* slideEasing {string} 页面滑动动画easing
|
|
20
20
|
|
|
21
21
|
* data {array} (必选)数据列表
|
|
22
|
-
* dispatcher {SWidgetDispatcher} 用于设置
|
|
22
|
+
* dispatcher {SWidgetDispatcher} 用于设置MetroWidget控件内部的状态,默认为null
|
|
23
23
|
* measures {function} (必选)返回item的模板信息的回调,
|
|
24
24
|
* @params item {object} data中的数据
|
|
25
25
|
* @return 模板信息,
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
@params id {int} item的id
|
|
50
50
|
@return {object} item的位置 {xPos, yPos, width, height}
|
|
51
51
|
}
|
|
52
|
-
* onEdge: 若单元格内另有可接管按键的控件(如
|
|
53
|
-
* onAction: 单元格内控件需要通过onAction.register方法向
|
|
52
|
+
* onEdge: 若单元格内另有可接管按键的控件(如MetroWidget),该控件到达边缘需要通知MetroWidget时的回调
|
|
53
|
+
* onAction: 单元格内控件需要通过onAction.register方法向MetroWidget注册onFocus, onBlur, onClick
|
|
54
54
|
*
|
|
55
55
|
* Q: 如何进行布局,定制每个格的尺寸?
|
|
56
56
|
* A: 首先选定一个布局的方式,一列列地横向布局(HROIZONTAL)还是一行行地纵向(VERTICAL)布局,设置给属性direction
|
|
@@ -71,102 +71,88 @@
|
|
|
71
71
|
* A: 当焦点移动到控件边缘时,会调用onEdge回调。在回调中通过参数传递的值来决定焦点转移的行为
|
|
72
72
|
-->
|
|
73
73
|
|
|
74
|
-
<script>
|
|
75
|
-
import { Options, Vue } from "vue-class-component";
|
|
74
|
+
<script setup>
|
|
76
75
|
import { data1, data2, data3 } from "./data";
|
|
77
|
-
import {
|
|
78
|
-
VERTICAL,
|
|
79
|
-
SimpleWidget,
|
|
80
|
-
EdgeDirection,
|
|
81
|
-
} from "jsview/utils/JsViewEngineWidget";
|
|
82
|
-
import JsvNinePatch from "jsview/utils/JsViewVueWidget/JsvNinePatch";
|
|
83
76
|
import borderImgPath from "./border.png";
|
|
84
77
|
import Item from "./components/ContentItem.vue";
|
|
85
78
|
import MyTab from "./components/MyTab.vue";
|
|
79
|
+
import { ref, onMounted, onBeforeUnmount } from "vue";
|
|
80
|
+
import { useRouter } from "vue-router";
|
|
81
|
+
import {
|
|
82
|
+
VERTICAL,
|
|
83
|
+
MetroWidget,
|
|
84
|
+
EdgeDirection,
|
|
85
|
+
jJsvRuntimeBridge,
|
|
86
|
+
useFocusHub,
|
|
87
|
+
} from "jsview";
|
|
86
88
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
MyTab,
|
|
93
|
-
},
|
|
94
|
-
})
|
|
95
|
-
class App extends Vue {
|
|
96
|
-
constructor(props) {
|
|
97
|
-
super(props);
|
|
98
|
-
this.focusNode = null;
|
|
99
|
-
this.direction = VERTICAL;
|
|
100
|
-
this.contentData = data1;
|
|
101
|
-
this.myId = 0;
|
|
102
|
-
this.focusImgPath = borderImgPath;
|
|
103
|
-
this.focusStyle = {};
|
|
104
|
-
console.log("image path " + this.focusImgPath);
|
|
105
|
-
this.requestDataTime = 0;
|
|
106
|
-
}
|
|
89
|
+
const router = useRouter();
|
|
90
|
+
const focusHub = useFocusHub();
|
|
91
|
+
let contentData = data1;
|
|
92
|
+
let requestDataTime = 0;
|
|
93
|
+
const mwRef = ref(null);
|
|
107
94
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
return false;
|
|
95
|
+
const onKeyDown = (ev) => {
|
|
96
|
+
// 8:Backspace, 27:Escape, 10000:盒子返回键
|
|
97
|
+
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
98
|
+
router.go(-1); // 有router时,是从DemoHomepage进入,回退
|
|
99
|
+
return true;
|
|
115
100
|
}
|
|
101
|
+
return false;
|
|
102
|
+
};
|
|
116
103
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
104
|
+
const provideData = () => {
|
|
105
|
+
return contentData;
|
|
106
|
+
};
|
|
107
|
+
const measures = () => {
|
|
108
|
+
return {
|
|
109
|
+
width: 227,
|
|
110
|
+
height: 351,
|
|
111
|
+
focusable: true,
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
const onFocus = () => {
|
|
115
|
+
focusHub.setFocus("mw");
|
|
116
|
+
};
|
|
117
|
+
const onWidgetEdge = (edge) => {
|
|
118
|
+
if (edge.direction === EdgeDirection.top) {
|
|
119
|
+
focusHub.setFocus("tab");
|
|
123
120
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
121
|
+
};
|
|
122
|
+
const onTabEdge = () => {
|
|
123
|
+
focusHub.setFocus("mw");
|
|
124
|
+
};
|
|
125
|
+
const onItemFocus = (id) => {
|
|
126
|
+
if (requestDataTime != 0) {
|
|
127
|
+
clearTimeout(requestDataTime);
|
|
128
|
+
requestDataTime = 0;
|
|
127
129
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
130
|
+
requestDataTime = setTimeout(() => {
|
|
131
|
+
switch (id) {
|
|
132
|
+
case 0:
|
|
133
|
+
contentData = data1;
|
|
134
|
+
break;
|
|
135
|
+
case 1:
|
|
136
|
+
contentData = data2;
|
|
137
|
+
break;
|
|
138
|
+
case 2:
|
|
139
|
+
contentData = data3;
|
|
140
|
+
break;
|
|
131
141
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
onItemFocus(id) {
|
|
137
|
-
if (this.requestDataTime != 0) {
|
|
138
|
-
clearTimeout(this.requestDataTime);
|
|
139
|
-
this.requestDataTime = 0;
|
|
140
|
-
}
|
|
141
|
-
this.requestDataTime = setTimeout(()=>{
|
|
142
|
-
switch(id) {
|
|
143
|
-
case 0:
|
|
144
|
-
this.contentData = data1;
|
|
145
|
-
break;
|
|
146
|
-
case 1:
|
|
147
|
-
this.contentData = data2;
|
|
148
|
-
break;
|
|
149
|
-
case 2:
|
|
150
|
-
this.contentData = data3;
|
|
151
|
-
break;
|
|
152
|
-
}
|
|
153
|
-
this.myId = id;
|
|
154
|
-
}, 0);
|
|
155
|
-
}
|
|
142
|
+
mwRef.value?.refreshData(true);
|
|
143
|
+
}, 0);
|
|
144
|
+
};
|
|
156
145
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
mounted() {
|
|
165
|
-
window.jJsvRuntimeBridge?.notifyPageLoaded();
|
|
146
|
+
onBeforeUnmount(() => {
|
|
147
|
+
if (requestDataTime != 0) {
|
|
148
|
+
clearTimeout(requestDataTime);
|
|
149
|
+
requestDataTime = 0;
|
|
166
150
|
}
|
|
167
|
-
}
|
|
151
|
+
});
|
|
168
152
|
|
|
169
|
-
|
|
153
|
+
onMounted(() => {
|
|
154
|
+
jJsvRuntimeBridge.notifyPageLoaded();
|
|
155
|
+
});
|
|
170
156
|
</script>
|
|
171
157
|
|
|
172
158
|
<template>
|
|
@@ -182,15 +168,15 @@ export default App;
|
|
|
182
168
|
</div>
|
|
183
169
|
|
|
184
170
|
<div class="widgetPos">
|
|
185
|
-
<
|
|
186
|
-
name="
|
|
187
|
-
|
|
188
|
-
:
|
|
171
|
+
<metro-widget
|
|
172
|
+
name="mw"
|
|
173
|
+
ref="mwRef"
|
|
174
|
+
:provideData="provideData"
|
|
189
175
|
:width="1253"
|
|
190
176
|
:height="600"
|
|
191
177
|
:padding="{ left: 26, top: 36, right: 26, bottom: 36 }"
|
|
192
|
-
:direction="
|
|
193
|
-
:measures="
|
|
178
|
+
:direction="VERTICAL"
|
|
179
|
+
:measures="measures"
|
|
194
180
|
:onEdge="onWidgetEdge"
|
|
195
181
|
>
|
|
196
182
|
<template #renderItem="{ data, query, onEdge, onAction }">
|
|
@@ -201,17 +187,7 @@ export default App;
|
|
|
201
187
|
:onAction="onAction"
|
|
202
188
|
/>
|
|
203
189
|
</template>
|
|
204
|
-
</
|
|
205
|
-
<div class="focusPos">
|
|
206
|
-
<JsvNinePatch
|
|
207
|
-
:style="focusStyle"
|
|
208
|
-
:imageUrl="focusImgPath"
|
|
209
|
-
:imageWidth="81"
|
|
210
|
-
:contentWidth="25"
|
|
211
|
-
:borderOutset="14"
|
|
212
|
-
:animTime="0.2"
|
|
213
|
-
/>
|
|
214
|
-
</div>
|
|
190
|
+
</metro-widget>
|
|
215
191
|
</div>
|
|
216
192
|
</div>
|
|
217
193
|
</jsv-focus-block>
|
|
File without changes
|
package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/coupon_content.png
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|