@shijiu/jsview-vue 0.9.502 → 0.9.631
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 +63 -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 +78 -59
- 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/Collision/App.vue +452 -0
- package/samples/ColorSpace/App.vue +15 -24
- package/samples/DemoHomepage/App.vue +7 -11
- package/samples/DemoHomepage/components/BodyFrame.vue +21 -9
- package/samples/DemoHomepage/components/TabFrame.vue +7 -8
- package/samples/DemoHomepage/router.js +52 -33
- package/samples/DemoHomepage/views/Homepage.vue +18 -9
- 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/ImpactStop/App.vue +435 -0
- package/samples/Input/App.vue +8 -18
- package/samples/Input/FullKeyboard.vue +2 -6
- package/samples/Input/InputPanel.vue +18 -12
- 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 +47 -0
- package/samples/MetroWidgetDemos/Advanced/ButtonItem.vue +90 -0
- package/samples/MetroWidgetDemos/Advanced/Buttons.vue +70 -0
- package/samples/MetroWidgetDemos/Advanced/Mixed.vue +77 -0
- package/samples/MetroWidgetDemos/Advanced/Widgets.vue +71 -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 +73 -0
- package/samples/MetroWidgetDemos/PingPong/AppTab.vue +62 -0
- package/samples/MetroWidgetDemos/PingPong/TabItem.vue +84 -0
- package/samples/MetroWidgetDemos/PingPong/ViewSwiper.vue +214 -0
- package/samples/MetroWidgetDemos/Simple/AbsoluteTemplate.vue +75 -0
- package/samples/MetroWidgetDemos/Simple/App.vue +45 -0
- package/samples/MetroWidgetDemos/Simple/RelativeTemplate.vue +111 -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 +67 -64
- 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/TextureAnimation/App2.vue +111 -0
- 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/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 +234 -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 +1561 -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 +301 -58
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +22 -3
- package/utils/JsViewPlugin/JsvPlayer/index.js +8 -1
- package/utils/JsViewPlugin/JsvPlayer/version.js +5 -5
- package/utils/JsViewVueTools/JsvImpactTracer.js +113 -0
- package/utils/JsViewVueTools/JsvRefTaker.js +35 -0
- package/utils/JsViewVueTools/index.js +20 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserPreload.vue +11 -1
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserQrcode.vue +8 -4
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserTextureAnim.vue +203 -14
- package/utils/JsViewVueWidget/JsvActorMove/JsvActorMove.vue +2 -2
- package/utils/JsViewVueWidget/JsvApic/JsvApic.vue +2 -2
- package/utils/JsViewVueWidget/JsvFilterView.vue +59 -51
- package/utils/JsViewVueWidget/JsvGrid.vue +139 -41
- package/utils/JsViewVueWidget/JsvInput/Cursor.vue +4 -2
- package/utils/JsViewVueWidget/JsvInput/JsvInput.vue +13 -12
- 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 +39 -53
- package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +1 -1
- package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +13 -10
- package/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue +282 -285
- package/utils/JsViewVueWidget/JsvSpriteAnim/index.js +2 -3
- package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +6 -1
- package/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue +6 -1
- package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +142 -61
- package/utils/JsViewVueWidget/JsvTextureAnim/index.js +9 -5
- package/utils/JsViewVueWidget/JsvTransparentDiv.vue +7 -8
- package/utils/JsViewVueWidget/JsvVideo.vue +9 -12
- 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,214 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2022-07-12 10:30:33
|
|
4
|
+
* @LastEditors: ChenChanghua
|
|
5
|
+
* @LastEditTime: 2022-09-01 17:05:07
|
|
6
|
+
* @Description: file content
|
|
7
|
+
-->
|
|
8
|
+
<script>
|
|
9
|
+
import AppPage from "./AppPage.vue";
|
|
10
|
+
import { getKeyFramesGroup } from "jsview";
|
|
11
|
+
import { reactive, ref } from "vue";
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
components: {
|
|
15
|
+
AppPage,
|
|
16
|
+
},
|
|
17
|
+
props: {
|
|
18
|
+
name: {
|
|
19
|
+
type: String,
|
|
20
|
+
},
|
|
21
|
+
curIndex: {
|
|
22
|
+
type: Object,
|
|
23
|
+
},
|
|
24
|
+
pageData: {
|
|
25
|
+
type: Array,
|
|
26
|
+
},
|
|
27
|
+
onEdge: {
|
|
28
|
+
type: Function,
|
|
29
|
+
},
|
|
30
|
+
layout: {
|
|
31
|
+
type: Object,
|
|
32
|
+
},
|
|
33
|
+
duration: {
|
|
34
|
+
type: Number,
|
|
35
|
+
default: 0.3,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
inject: ["globalInfo"],
|
|
39
|
+
provide() {
|
|
40
|
+
return {
|
|
41
|
+
animState: this.animState,
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
setup() {
|
|
45
|
+
let styleShell = getKeyFramesGroup();
|
|
46
|
+
let animState = reactive({
|
|
47
|
+
value: 0, //0: 不在动画, 在动画中
|
|
48
|
+
});
|
|
49
|
+
return {
|
|
50
|
+
refName0: "page0",
|
|
51
|
+
refName1: "page1",
|
|
52
|
+
styleShell,
|
|
53
|
+
animState,
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
data() {
|
|
57
|
+
return {
|
|
58
|
+
curPage: 0,
|
|
59
|
+
page0Show: true,
|
|
60
|
+
page1Show: false,
|
|
61
|
+
page0Data: this.pageData[0],
|
|
62
|
+
page1Data: null,
|
|
63
|
+
page0Left: 0,
|
|
64
|
+
page1Left: 1280,
|
|
65
|
+
page0Anim: {
|
|
66
|
+
anim: "",
|
|
67
|
+
onend: null,
|
|
68
|
+
},
|
|
69
|
+
page1Anim: {
|
|
70
|
+
anim: "",
|
|
71
|
+
onend: null,
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
methods: {
|
|
76
|
+
$_appSwiper_onFocus() {
|
|
77
|
+
let curPageData = this.curPage === 0 ? this.page0Data : this.page1Data;
|
|
78
|
+
this.$refs.focusNode?.findBlockByName(curPageData.name).requestFocus();
|
|
79
|
+
},
|
|
80
|
+
$_appSwiper_tabIdWatcher(newValue, oldValue) {
|
|
81
|
+
console.log("AppSwiper curIndex changed ", newValue, oldValue);
|
|
82
|
+
if (newValue != oldValue) {
|
|
83
|
+
let direction = newValue > oldValue ? "left" : "right";
|
|
84
|
+
if (this.curPage == 0) {
|
|
85
|
+
this.curPage = 1;
|
|
86
|
+
this.page1Data = this.pageData[newValue];
|
|
87
|
+
this.page1Show = true;
|
|
88
|
+
this.animState.value = 1;
|
|
89
|
+
this.page0Anim = {
|
|
90
|
+
anim: `app-swiper-${direction}-slide-out ${this.duration}s`,
|
|
91
|
+
onend: () => {
|
|
92
|
+
this.page0Show = false;
|
|
93
|
+
this.page0Data = null;
|
|
94
|
+
this.animState.value = 0;
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
this.page1Anim = {
|
|
98
|
+
anim: `app-swiper-${direction}-slide-in ${this.duration}s`,
|
|
99
|
+
onend: null,
|
|
100
|
+
};
|
|
101
|
+
} else {
|
|
102
|
+
this.curPage = 0;
|
|
103
|
+
this.page0Data = this.pageData[newValue];
|
|
104
|
+
this.page0Show = true;
|
|
105
|
+
this.animState.value = 1;
|
|
106
|
+
this.page0Anim = {
|
|
107
|
+
anim: `app-swiper-${direction}-slide-in ${this.duration}s`,
|
|
108
|
+
onend: null,
|
|
109
|
+
};
|
|
110
|
+
this.page1Anim = {
|
|
111
|
+
anim: `app-swiper-${direction}-slide-out ${this.duration}s`,
|
|
112
|
+
onend: () => {
|
|
113
|
+
this.page1Show = false;
|
|
114
|
+
this.page1Data = null;
|
|
115
|
+
this.animState.value = 0;
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
$_appSwiper_initAnimation() {
|
|
122
|
+
let leftSlideOutDefine = `@keyframes app-swiper-left-slide-out {
|
|
123
|
+
from {
|
|
124
|
+
transform: translate3d(0px, 0px, 0px);
|
|
125
|
+
}
|
|
126
|
+
to {
|
|
127
|
+
transform: translate3d(${-this.layout.width}px, 0px, 0px);
|
|
128
|
+
}
|
|
129
|
+
}`;
|
|
130
|
+
let leftSlideInDefine = `@keyframes app-swiper-left-slide-in {
|
|
131
|
+
from {
|
|
132
|
+
transform: translate3d(${this.layout.width}px, 0px, 0px);
|
|
133
|
+
}
|
|
134
|
+
to {
|
|
135
|
+
transform: translate3d(0px, 0px, 0px);
|
|
136
|
+
}
|
|
137
|
+
}`;
|
|
138
|
+
let rightSlideOutDefine = `@keyframes app-swiper-right-slide-out {
|
|
139
|
+
from {
|
|
140
|
+
transform: translate3d(0px, 0px, 0px);
|
|
141
|
+
}
|
|
142
|
+
to {
|
|
143
|
+
transform: translate3d(${this.layout.width}px, 0px, 0px);
|
|
144
|
+
}
|
|
145
|
+
}`;
|
|
146
|
+
let rightSlideInDefine = `@keyframes app-swiper-right-slide-in {
|
|
147
|
+
from {
|
|
148
|
+
transform: translate3d(${-this.layout.width}px, 0px, 0px);
|
|
149
|
+
}
|
|
150
|
+
to {
|
|
151
|
+
transform: translate3d(0px, 0px, 0px);
|
|
152
|
+
}
|
|
153
|
+
}`;
|
|
154
|
+
this.styleShell.insertRule(leftSlideOutDefine);
|
|
155
|
+
this.styleShell.insertRule(leftSlideInDefine);
|
|
156
|
+
this.styleShell.insertRule(rightSlideOutDefine);
|
|
157
|
+
this.styleShell.insertRule(rightSlideInDefine);
|
|
158
|
+
},
|
|
159
|
+
$_appSwiper_releaseAnimation() {
|
|
160
|
+
this.styleShell.removeRule("app-swiper-left-slide-out");
|
|
161
|
+
this.styleShell.removeRule("app-swiper-left-slide-in");
|
|
162
|
+
this.styleShell.removeRule("app-swiper-right-slide-out");
|
|
163
|
+
this.styleShell.removeRule("app-swiper-right-slide-in");
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
created() {
|
|
167
|
+
console.log("AppSwiper created", this.globalInfo);
|
|
168
|
+
this.$watch(() => this.globalInfo.tabId, this.$_appSwiper_tabIdWatcher);
|
|
169
|
+
this.$_appSwiper_initAnimation();
|
|
170
|
+
},
|
|
171
|
+
beforeUnmount() {
|
|
172
|
+
this.$_appSwiper_releaseAnimation();
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
</script>
|
|
176
|
+
|
|
177
|
+
<template>
|
|
178
|
+
<jsv-focus-block
|
|
179
|
+
:name="name"
|
|
180
|
+
ref="focusNode"
|
|
181
|
+
:onAction="{
|
|
182
|
+
onFocus: $_appSwiper_onFocus,
|
|
183
|
+
}"
|
|
184
|
+
>
|
|
185
|
+
<div
|
|
186
|
+
:style="{
|
|
187
|
+
animation: page0Anim.anim,
|
|
188
|
+
animationFillMode: 'forwards',
|
|
189
|
+
}"
|
|
190
|
+
:onAnimationEnd="page0Anim.onend"
|
|
191
|
+
>
|
|
192
|
+
<app-page
|
|
193
|
+
v-if="page0Show"
|
|
194
|
+
:data="page0Data"
|
|
195
|
+
:name="page0Data.name"
|
|
196
|
+
:onEdge="onEdge"
|
|
197
|
+
></app-page>
|
|
198
|
+
</div>
|
|
199
|
+
<div
|
|
200
|
+
:style="{
|
|
201
|
+
animation: page1Anim.anim,
|
|
202
|
+
animationFillMode: 'forwards',
|
|
203
|
+
}"
|
|
204
|
+
:onAnimationEnd="page1Anim.onend"
|
|
205
|
+
>
|
|
206
|
+
<app-page
|
|
207
|
+
v-if="page1Show"
|
|
208
|
+
:data="page1Data"
|
|
209
|
+
:name="page1Data.name"
|
|
210
|
+
:onEdge="onEdge"
|
|
211
|
+
></app-page>
|
|
212
|
+
</div>
|
|
213
|
+
</jsv-focus-block>
|
|
214
|
+
</template>
|
|
@@ -0,0 +1,75 @@
|
|
|
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 foucsHub = 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
|
+
foucsHub.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>
|
|
@@ -0,0 +1,45 @@
|
|
|
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 foucsHub = useFocusHub();
|
|
17
|
+
|
|
18
|
+
const onFocus = () => {
|
|
19
|
+
foucsHub.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>
|
|
@@ -0,0 +1,111 @@
|
|
|
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 foucsHub = 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
|
+
foucsHub.setFocus("button");
|
|
38
|
+
} else if (edgeInfo.direction == EdgeDirection.right) {
|
|
39
|
+
foucsHub.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
|
+
foucsHub.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>
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
|
|
2
|
+
<script setup>
|
|
3
|
+
import { HORIZONTAL, MetroWidget, useFocusHub } from "jsview";
|
|
4
|
+
import { ref } 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 = ref(null);
|
|
15
|
+
|
|
16
|
+
const measures = (item) => {
|
|
17
|
+
return item;
|
|
18
|
+
};
|
|
19
|
+
const randomColor = () => {
|
|
20
|
+
let randomColor = Math.round(Math.random() * 2 ** 24).toString(16);
|
|
21
|
+
return (
|
|
22
|
+
"#" + new Array(6 - randomColor.length).fill("0").join("") + randomColor
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
const provideData = () => {
|
|
26
|
+
const data = [];
|
|
27
|
+
for (let i = 0; i < 10; i++) {
|
|
28
|
+
data.push({
|
|
29
|
+
width: 90,
|
|
30
|
+
height: 90,
|
|
31
|
+
marginRight: 10,
|
|
32
|
+
marginBottom: 10,
|
|
33
|
+
content: i,
|
|
34
|
+
color: randomColor(),
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return data;
|
|
38
|
+
};
|
|
39
|
+
const onFocus = (rect) => {
|
|
40
|
+
//获得焦点时需要做就近移动的处理, 因此需要通过setEnterFocusRect设置寻找最近焦点的区域
|
|
41
|
+
mwRef.value?.setEnterFocusRect(rect);
|
|
42
|
+
focusHub.setFocus(props.data.name);
|
|
43
|
+
};
|
|
44
|
+
const onBlur = () => {
|
|
45
|
+
//onBlur时需要返还焦点给父MetroWidget
|
|
46
|
+
mwRef.value?.getFocusBlockRef().returnFocusToParent();
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
props.onAction.register("onFocus", onFocus);
|
|
50
|
+
props.onAction.register("onBlur", onBlur);
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<template>
|
|
54
|
+
<div
|
|
55
|
+
:style="{
|
|
56
|
+
width: 900,
|
|
57
|
+
height: 50,
|
|
58
|
+
fontSize: 30,
|
|
59
|
+
color: '#FFFFFF',
|
|
60
|
+
}"
|
|
61
|
+
>
|
|
62
|
+
{{ data.name }}
|
|
63
|
+
</div>
|
|
64
|
+
<!-- sendFocusRectEvent可以让MetroWidget的item在获焦时发送事件, 通知父的MetroWidget进行滚动 -->
|
|
65
|
+
<!-- onItemEdge直接作为onEdge回调, 既子MetroWidget到达边缘时触发父的onItemEdge -->
|
|
66
|
+
<metro-widget
|
|
67
|
+
ref="mwRef"
|
|
68
|
+
:top="50"
|
|
69
|
+
:name="data.name"
|
|
70
|
+
:provideData="provideData"
|
|
71
|
+
:width="data.width"
|
|
72
|
+
:height="data.height"
|
|
73
|
+
:direction="HORIZONTAL"
|
|
74
|
+
:padding="{
|
|
75
|
+
left: 10,
|
|
76
|
+
right: 10,
|
|
77
|
+
top: 10,
|
|
78
|
+
bottom: 10,
|
|
79
|
+
}"
|
|
80
|
+
:measures="measures"
|
|
81
|
+
:slideSetting="seamlessSlide"
|
|
82
|
+
:onEdge="onItemEdge"
|
|
83
|
+
:sendFocusRectEvent="true"
|
|
84
|
+
>
|
|
85
|
+
<template #renderItem="{ data, query, onAction }">
|
|
86
|
+
<item :data="data" :query="query" :onAction="onAction" />
|
|
87
|
+
</template>
|
|
88
|
+
</metro-widget>
|
|
89
|
+
</template>
|