@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
|
@@ -2,14 +2,17 @@
|
|
|
2
2
|
* @Author: ChenChanghua
|
|
3
3
|
* @Date: 2022-01-25 10:33:07
|
|
4
4
|
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime: 2022-
|
|
5
|
+
* @LastEditTime: 2022-09-02 13:44:41
|
|
6
6
|
* @Description: file content
|
|
7
7
|
-->
|
|
8
8
|
<script>
|
|
9
9
|
import FullKeyboard from "./FullKeyboard.vue";
|
|
10
|
-
import JsvInput from "jsview
|
|
11
|
-
import { EdgeDirection } from "jsview/utils/JsViewEngineWidget";
|
|
10
|
+
import { EdgeDirection, JsvInput, useFocusHub } from "jsview";
|
|
12
11
|
import { ref } from "vue";
|
|
12
|
+
|
|
13
|
+
const blurColor = "#AAAAAA";
|
|
14
|
+
const focusColor = "#FFFF00";
|
|
15
|
+
|
|
13
16
|
export default {
|
|
14
17
|
components: {
|
|
15
18
|
FullKeyboard,
|
|
@@ -25,17 +28,20 @@ export default {
|
|
|
25
28
|
setup() {
|
|
26
29
|
return {
|
|
27
30
|
showCursor: ref(false),
|
|
31
|
+
focusHub: useFocusHub(),
|
|
32
|
+
cursorColor: ref(blurColor),
|
|
28
33
|
};
|
|
29
34
|
},
|
|
30
35
|
methods: {
|
|
31
36
|
_onFocus() {
|
|
32
37
|
this.showCursor = true;
|
|
33
|
-
this
|
|
34
|
-
|
|
35
|
-
.requestFocus();
|
|
38
|
+
this.cursorColor = blurColor;
|
|
39
|
+
this.focusHub.setFocus(`${this.name}/keyboard`);
|
|
36
40
|
},
|
|
37
41
|
_onBlur() {
|
|
42
|
+
console.log("testtest onblur");
|
|
38
43
|
this.showCursor = false;
|
|
44
|
+
this.cursorColor = blurColor;
|
|
39
45
|
},
|
|
40
46
|
_keyboardOnClick(item) {
|
|
41
47
|
const char = item.content;
|
|
@@ -49,9 +55,8 @@ export default {
|
|
|
49
55
|
},
|
|
50
56
|
_keyboardOnEdge(edgeInfo) {
|
|
51
57
|
if (edgeInfo.direction === EdgeDirection.top) {
|
|
52
|
-
this
|
|
53
|
-
|
|
54
|
-
.requestFocus();
|
|
58
|
+
this.focusHub.setFocus(`${this.name}/etext`);
|
|
59
|
+
this.cursorColor = focusColor;
|
|
55
60
|
} else {
|
|
56
61
|
this.onEdge?.(edgeInfo);
|
|
57
62
|
}
|
|
@@ -64,9 +69,8 @@ export default {
|
|
|
64
69
|
},
|
|
65
70
|
_inputOnEdge(edgeInfo) {
|
|
66
71
|
if (edgeInfo.direction === EdgeDirection.bottom) {
|
|
67
|
-
this
|
|
68
|
-
|
|
69
|
-
.requestFocus();
|
|
72
|
+
this.focusHub.setFocus(`${this.name}/keyboard`);
|
|
73
|
+
this.cursorColor = blurColor;
|
|
70
74
|
} else {
|
|
71
75
|
this.onEdge?.(edgeInfo);
|
|
72
76
|
}
|
|
@@ -82,6 +86,7 @@ export default {
|
|
|
82
86
|
ref="focusNode"
|
|
83
87
|
:onAction="{
|
|
84
88
|
onFocus: _onFocus,
|
|
89
|
+
onBlur: _onBlur,
|
|
85
90
|
}"
|
|
86
91
|
>
|
|
87
92
|
<div
|
|
@@ -112,6 +117,7 @@ export default {
|
|
|
112
117
|
:cursorWidth="2"
|
|
113
118
|
:onTextChange="_onTextChange"
|
|
114
119
|
:onTextOverflow="_onTextOverflow"
|
|
120
|
+
:cursorColor="cursorColor"
|
|
115
121
|
/>
|
|
116
122
|
|
|
117
123
|
<div :style="{ top: 100 }">
|
|
@@ -16,36 +16,20 @@
|
|
|
16
16
|
*
|
|
17
17
|
-->
|
|
18
18
|
|
|
19
|
-
<script
|
|
20
|
-
import { Options, Vue } from "vue-class-component";
|
|
19
|
+
<script setup>
|
|
21
20
|
import LongImageScroll from "./LongImageScroll.vue";
|
|
22
21
|
import Button from "./Button.vue";
|
|
23
|
-
import
|
|
22
|
+
import longImageSource from "./assets/1280x7200.jpg";
|
|
23
|
+
import { useRouter } from "vue-router";
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
keyCode: Number;
|
|
27
|
-
}
|
|
25
|
+
const router = useRouter();
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
Button,
|
|
33
|
-
},
|
|
34
|
-
})
|
|
35
|
-
class App extends Vue {
|
|
36
|
-
constructor(props: any) {
|
|
37
|
-
super(props);
|
|
27
|
+
const onKeyDown = (ev) => {
|
|
28
|
+
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
29
|
+
router.go(-1); // 有router时,是从DemoHomepage进入,回退
|
|
38
30
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
onKeyDown(ev: KeyEvent): Boolean {
|
|
42
|
-
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
43
|
-
this.$router?.go(-1); // 有router时,是从DemoHomepage进入,回退
|
|
44
|
-
}
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
export default App;
|
|
31
|
+
return true;
|
|
32
|
+
};
|
|
49
33
|
</script>
|
|
50
34
|
|
|
51
35
|
|
|
@@ -74,7 +58,7 @@ export default App;
|
|
|
74
58
|
<div :style="{ left: 100, top: 100 }">
|
|
75
59
|
<LongImageScroll
|
|
76
60
|
:style="{ width: 1000, height: 500, backgroundColor: '#EEEEEE' }"
|
|
77
|
-
:imageSrc="
|
|
61
|
+
:imageSrc="longImageSource"
|
|
78
62
|
:scrollBlockStyle="{
|
|
79
63
|
width: 10,
|
|
80
64
|
height: 30,
|
|
@@ -89,7 +73,7 @@ export default App;
|
|
|
89
73
|
:step="60"
|
|
90
74
|
/>
|
|
91
75
|
<div :style="{ left: 400, top: 550 }">
|
|
92
|
-
<Button
|
|
76
|
+
<Button></Button>
|
|
93
77
|
</div>
|
|
94
78
|
</div>
|
|
95
79
|
</jsv-focus-block>
|
|
@@ -1,153 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2022-07-08 15:18:02
|
|
4
|
+
* @LastEditors: ChenChanghua
|
|
5
|
+
* @LastEditTime: 2022-07-08 17:47:25
|
|
6
|
+
* @Description: file content
|
|
7
|
+
-->
|
|
8
|
+
<script setup>
|
|
9
|
+
import { ref } from "vue";
|
|
10
|
+
import { HORIZONTAL, MetroWidget, EdgeDirection, useFocusHub } from "jsview";
|
|
11
|
+
import ButtonItem from "./ButtonItem.vue";
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
const focusHub = useFocusHub();
|
|
14
|
+
const data = [
|
|
15
|
+
{
|
|
16
|
+
width: 100,
|
|
17
|
+
height: 50,
|
|
18
|
+
marginRight: 100,
|
|
19
|
+
content: "同意",
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
width: 100,
|
|
23
|
+
height: 50,
|
|
24
|
+
content: "取消",
|
|
25
|
+
},
|
|
26
|
+
];
|
|
16
27
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
private getLeftActionCallback() {
|
|
22
|
-
const onAction = {
|
|
23
|
-
// onKeyDown: this.onKeyDown,
|
|
24
|
-
onKeyDown: (ev: any) => {
|
|
25
|
-
let keyUsed = true;
|
|
26
|
-
switch (ev.keyCode) {
|
|
27
|
-
case 37:
|
|
28
|
-
this.focusName = "btn_left";
|
|
29
|
-
break;
|
|
30
|
-
case 38:
|
|
31
|
-
this.focusName = "LongImageScroll";
|
|
32
|
-
break;
|
|
33
|
-
case 39:
|
|
34
|
-
this.focusName = "btn_right";
|
|
35
|
-
break;
|
|
36
|
-
default:
|
|
37
|
-
keyUsed = false;
|
|
38
|
-
}
|
|
39
|
-
if (keyUsed) {
|
|
40
|
-
console.log("Button requestFocusName = ", this.focusName);
|
|
41
|
-
this.leftRef.findBlockByName(this.focusName).requestFocus();
|
|
42
|
-
}
|
|
43
|
-
return keyUsed;
|
|
44
|
-
},
|
|
45
|
-
onFocus: () => {
|
|
46
|
-
console.log("btn_left getFocus");
|
|
47
|
-
this.focusId = 1;
|
|
48
|
-
},
|
|
49
|
-
onBlur: () => {
|
|
50
|
-
console.log("btn_left loseFocus");
|
|
51
|
-
this.focusId = 0;
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
return onAction;
|
|
55
|
-
}
|
|
28
|
+
const measures = (item) => {
|
|
29
|
+
return item;
|
|
30
|
+
};
|
|
56
31
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
onKeyDown: (ev: any) => {
|
|
61
|
-
let keyUsed = true;
|
|
62
|
-
switch (ev.keyCode) {
|
|
63
|
-
case 37:
|
|
64
|
-
this.focusName = "btn_left";
|
|
65
|
-
break;
|
|
66
|
-
case 38:
|
|
67
|
-
this.focusName = "LongImageScroll";
|
|
68
|
-
break;
|
|
69
|
-
case 39:
|
|
70
|
-
this.focusName = "btn_right";
|
|
71
|
-
break;
|
|
72
|
-
default:
|
|
73
|
-
keyUsed = false;
|
|
74
|
-
}
|
|
75
|
-
if (keyUsed) {
|
|
76
|
-
this.leftRef.findBlockByName(this.focusName).requestFocus();
|
|
77
|
-
}
|
|
78
|
-
return keyUsed;
|
|
79
|
-
},
|
|
80
|
-
onFocus: () => {
|
|
81
|
-
console.log("btn_left getFocus");
|
|
82
|
-
this.focusId = 2;
|
|
83
|
-
},
|
|
84
|
-
onBlur: () => {
|
|
85
|
-
console.log("btn_left loseFocus");
|
|
86
|
-
this.focusId = 0;
|
|
87
|
-
},
|
|
88
|
-
};
|
|
89
|
-
return onAction;
|
|
32
|
+
const onEdge = (edgeInfo) => {
|
|
33
|
+
if (edgeInfo.direction == EdgeDirection.top) {
|
|
34
|
+
focusHub.setFocus("longImageScroll");
|
|
90
35
|
}
|
|
91
|
-
}
|
|
36
|
+
};
|
|
92
37
|
</script>
|
|
93
38
|
|
|
94
39
|
<template>
|
|
95
|
-
<
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
height: 50,
|
|
114
|
-
left: -20,
|
|
115
|
-
fontSize: '30px',
|
|
116
|
-
textAlign: 'center',
|
|
117
|
-
lineHeight: '50px',
|
|
118
|
-
backgroundColor: '#EEEEEE',
|
|
119
|
-
}"
|
|
120
|
-
>
|
|
121
|
-
按钮1
|
|
122
|
-
</div>
|
|
123
|
-
</jsv-focus-block>
|
|
124
|
-
<jsv-focus-block
|
|
125
|
-
:ref="onRightRef"
|
|
126
|
-
namespace="btn_right"
|
|
127
|
-
:onAction="getRightActionCallback()"
|
|
128
|
-
>
|
|
129
|
-
<div
|
|
130
|
-
:style="{
|
|
131
|
-
width: 130,
|
|
132
|
-
height: 60,
|
|
133
|
-
left: 125,
|
|
134
|
-
top: -5,
|
|
135
|
-
backgroundColor: this.focusId === 2 ? '#DD0000' : '#FFFFFF',
|
|
136
|
-
}"
|
|
137
|
-
></div>
|
|
138
|
-
<div
|
|
139
|
-
:style="{
|
|
140
|
-
width: 120,
|
|
141
|
-
height: 50,
|
|
142
|
-
left: 130,
|
|
143
|
-
fontSize: '30px',
|
|
144
|
-
textAlign: 'center',
|
|
145
|
-
lineHeight: '50px',
|
|
146
|
-
backgroundColor: '#EEEEEE',
|
|
147
|
-
}"
|
|
148
|
-
>
|
|
149
|
-
按钮2
|
|
150
|
-
</div>
|
|
151
|
-
</jsv-focus-block>
|
|
152
|
-
</div>
|
|
40
|
+
<metro-widget
|
|
41
|
+
name="button"
|
|
42
|
+
:width="500"
|
|
43
|
+
:height="50"
|
|
44
|
+
:data="data"
|
|
45
|
+
:direction="HORIZONTAL"
|
|
46
|
+
:measures="measures"
|
|
47
|
+
:onEdge="onEdge"
|
|
48
|
+
>
|
|
49
|
+
<template #renderItem="{ data, query, onEdge, onAction }">
|
|
50
|
+
<button-item
|
|
51
|
+
:data="data"
|
|
52
|
+
:query="query"
|
|
53
|
+
:onEdge="onEdge"
|
|
54
|
+
:onAction="onAction"
|
|
55
|
+
/>
|
|
56
|
+
</template>
|
|
57
|
+
</metro-widget>
|
|
153
58
|
</template>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: ChenChanghua
|
|
3
|
+
* @Date: 2022-07-08 15:05:00
|
|
4
|
+
* @LastEditors: ChenChanghua
|
|
5
|
+
* @LastEditTime: 2022-07-08 17:46:39
|
|
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
|
+
onEdge: Function,
|
|
15
|
+
onAction: Object,
|
|
16
|
+
});
|
|
17
|
+
const focused = ref(false);
|
|
18
|
+
const onFocus = () => {
|
|
19
|
+
focused.value = true;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const onBlur = () => {
|
|
23
|
+
focused.value = false;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const onClick = () => {};
|
|
27
|
+
|
|
28
|
+
props.onAction.register("onFocus", onFocus);
|
|
29
|
+
props.onAction.register("onBlur", onBlur);
|
|
30
|
+
props.onAction.register("onClick", onClick);
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<template>
|
|
34
|
+
<div
|
|
35
|
+
:style="{
|
|
36
|
+
width: props.data.width,
|
|
37
|
+
height: props.data.height,
|
|
38
|
+
fontSize: 30,
|
|
39
|
+
backgroundColor: focused ? '#DD8800' : '#BBBBAA',
|
|
40
|
+
}"
|
|
41
|
+
>
|
|
42
|
+
{{ data.content }}
|
|
43
|
+
</div>
|
|
44
|
+
</template>
|
|
@@ -1,125 +1,90 @@
|
|
|
1
|
-
<script
|
|
1
|
+
<script setup>
|
|
2
2
|
import Scroll from "./Scroll.vue";
|
|
3
|
-
import {
|
|
3
|
+
import { ref, onMounted } from "vue";
|
|
4
|
+
import { useFocusHub } from "jsview";
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
scrollStyle: Object,
|
|
13
|
-
scrollBlockStyle: Object,
|
|
14
|
-
imageSrc: String,
|
|
15
|
-
},
|
|
16
|
-
})
|
|
17
|
-
export default class LongImageScroll extends Vue {
|
|
18
|
-
constructor(props: any) {
|
|
19
|
-
super(props);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
onMainRef(ref: any) {
|
|
23
|
-
this.rootRef = ref;
|
|
24
|
-
}
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
step: Number,
|
|
8
|
+
style: Object,
|
|
9
|
+
scrollStyle: Object,
|
|
10
|
+
scrollBlockStyle: Object,
|
|
11
|
+
imageSrc: String,
|
|
12
|
+
});
|
|
25
13
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
case 40:
|
|
49
|
-
if (
|
|
50
|
-
this.textY !==
|
|
51
|
-
this.style.height - this.element.clientHeight
|
|
52
|
-
) {
|
|
53
|
-
text_y =
|
|
54
|
-
this.textY - this.step <=
|
|
55
|
-
this.style.height - this.element.clientHeight
|
|
56
|
-
? this.style.height - this.element.clientHeight
|
|
57
|
-
: this.textY - this.step;
|
|
58
|
-
(this.textY = text_y),
|
|
59
|
-
(this.scrollY =
|
|
60
|
-
(-text_y /
|
|
61
|
-
(this.element.clientHeight - this.style.height)) *
|
|
62
|
-
(this.scrollStyle.height - this.scrollBlockStyle.height));
|
|
63
|
-
} else {
|
|
64
|
-
this.rootRef.findBlockByName("btn_left").requestFocus();
|
|
65
|
-
}
|
|
66
|
-
break;
|
|
14
|
+
const focusHub = useFocusHub();
|
|
15
|
+
const element = ref(null);
|
|
16
|
+
const scrollY = ref(0);
|
|
17
|
+
const textY = ref(0);
|
|
18
|
+
const onAction = {
|
|
19
|
+
onKeyDown: (ev) => {
|
|
20
|
+
const valid =
|
|
21
|
+
element.value &&
|
|
22
|
+
element.value.clientHeight &&
|
|
23
|
+
element.value.clientHeight > props.style.height;
|
|
24
|
+
// let keyUsed = true;
|
|
25
|
+
if (valid) {
|
|
26
|
+
let text_y;
|
|
27
|
+
switch (ev.keyCode) {
|
|
28
|
+
case 38:
|
|
29
|
+
if (textY.value !== 0) {
|
|
30
|
+
text_y =
|
|
31
|
+
textY.value + props.step >= 0 ? 0 : textY.value + props.step;
|
|
32
|
+
(textY.value = text_y),
|
|
33
|
+
(scrollY.value =
|
|
34
|
+
(-text_y / (element.value.clientHeight - props.style.height)) *
|
|
35
|
+
(props.scrollStyle.height - props.scrollBlockStyle.height));
|
|
67
36
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
37
|
+
break;
|
|
38
|
+
case 40:
|
|
39
|
+
if (textY.value !== props.style.height - element.value.clientHeight) {
|
|
40
|
+
text_y =
|
|
41
|
+
textY.value - props.step <=
|
|
42
|
+
props.style.height - element.value.clientHeight
|
|
43
|
+
? props.style.height - element.value.clientHeight
|
|
44
|
+
: textY.value - props.step;
|
|
45
|
+
(textY.value = text_y),
|
|
46
|
+
(scrollY.value =
|
|
47
|
+
(-text_y / (element.value.clientHeight - props.style.height)) *
|
|
48
|
+
(props.scrollStyle.height - props.scrollBlockStyle.height));
|
|
49
|
+
} else {
|
|
50
|
+
focusHub.setFocus("button");
|
|
51
|
+
}
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
onFocus: () => {
|
|
57
|
+
console.log("LongImageScroll getFocus");
|
|
58
|
+
},
|
|
59
|
+
onBlur: () => {
|
|
60
|
+
console.log("LongImageScroll loseFocus");
|
|
61
|
+
},
|
|
62
|
+
};
|
|
84
63
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
private step: any = 0;
|
|
90
|
-
private style: any = null;
|
|
91
|
-
private scrollStyle: any = null;
|
|
92
|
-
private scrollBlockStyle: any = null;
|
|
93
|
-
private imageSrc: any = null;
|
|
64
|
+
const onLoad = () => {
|
|
65
|
+
// 图片加载完成的回调
|
|
66
|
+
console.log("Image loaded!");
|
|
67
|
+
};
|
|
94
68
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
69
|
+
onMounted(() => {
|
|
70
|
+
focusHub.setFocus("longImageScroll");
|
|
71
|
+
});
|
|
99
72
|
</script>
|
|
100
73
|
|
|
101
74
|
|
|
102
75
|
<template>
|
|
103
|
-
<jsv-focus-block
|
|
104
|
-
:ref="onMainRef"
|
|
105
|
-
namespace="LongImageScroll"
|
|
106
|
-
:onAction="getActionCallback()"
|
|
107
|
-
>
|
|
76
|
+
<jsv-focus-block name="longImageScroll" :onAction="onAction">
|
|
108
77
|
<div :style="{ overflow: 'hidden', ...style }">
|
|
109
78
|
<img
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
(ele) => {
|
|
113
|
-
this.element = ele;
|
|
114
|
-
}
|
|
115
|
-
"
|
|
79
|
+
alt=""
|
|
80
|
+
ref="element"
|
|
116
81
|
:src="imageSrc"
|
|
117
|
-
:style="{ top:
|
|
118
|
-
:onLoad="
|
|
82
|
+
:style="{ top: textY, width: style.width }"
|
|
83
|
+
:onLoad="onLoad"
|
|
119
84
|
/>
|
|
120
85
|
</div>
|
|
121
86
|
<Scroll
|
|
122
|
-
:top="
|
|
87
|
+
:top="scrollY"
|
|
123
88
|
:scrollStyle="scrollStyle"
|
|
124
89
|
:scrollBlockStyle="scrollBlockStyle"
|
|
125
90
|
/>
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
},
|
|
8
|
-
};
|
|
1
|
+
<script setup>
|
|
2
|
+
defineProps({
|
|
3
|
+
scrollStyle: Object,
|
|
4
|
+
top: Number,
|
|
5
|
+
scrollBlockStyle: Object,
|
|
6
|
+
});
|
|
9
7
|
</script>
|
|
10
8
|
<template>
|
|
11
9
|
<div :style="{ ...scrollStyle }">
|
|
12
10
|
<div :style="{ top: top }">
|
|
13
|
-
<div :style="{ ...scrollBlockStyle }"
|
|
11
|
+
<div :style="{ ...scrollBlockStyle }"></div>
|
|
14
12
|
</div>
|
|
15
13
|
</div>
|
|
16
14
|
</template>
|
package/samples/LongText/App.vue
CHANGED
|
@@ -23,40 +23,25 @@
|
|
|
23
23
|
* 所以务必在盒子上实际测试缩进效果。
|
|
24
24
|
-->
|
|
25
25
|
|
|
26
|
-
<script
|
|
27
|
-
import { Options, Vue } from "vue-class-component";
|
|
26
|
+
<script setup>
|
|
28
27
|
import LongTextScroll from "./LongTextScroll.vue";
|
|
29
28
|
import Button from "./Button.vue";
|
|
30
|
-
import { jJsvRuntimeBridge } from "jsview
|
|
29
|
+
import { jJsvRuntimeBridge } from "jsview";
|
|
30
|
+
import { onMounted, ref } from "vue";
|
|
31
|
+
import { useRouter } from "vue-router";
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
keyCode: Number;
|
|
34
|
-
}
|
|
33
|
+
const router = useRouter();
|
|
35
34
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
Button,
|
|
40
|
-
},
|
|
41
|
-
})
|
|
42
|
-
class App extends Vue {
|
|
43
|
-
constructor(props: any) {
|
|
44
|
-
super(props);
|
|
35
|
+
const onKeyDown = (ev) => {
|
|
36
|
+
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
37
|
+
router.go(-1); // 有router时,是从DemoHomepage进入,回退
|
|
45
38
|
}
|
|
39
|
+
return true;
|
|
40
|
+
};
|
|
46
41
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
return true;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
mounted() {
|
|
55
|
-
// 调试接口,对接JSCenter平台去掉启动图的处理
|
|
56
|
-
jJsvRuntimeBridge.notifyPageLoaded();
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
export default App;
|
|
42
|
+
onMounted(() => {
|
|
43
|
+
jJsvRuntimeBridge.notifyPageLoaded();
|
|
44
|
+
});
|
|
60
45
|
</script>
|
|
61
46
|
|
|
62
47
|
<template>
|