@shijiu/jsview-vue 0.9.490 → 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 +20 -6
- 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 +33 -34
- 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/NinePatchDemo/assets/border.png +0 -0
- 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-build.js +6 -1
- 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 +1557 -1656
- package/utils/JsViewEngineWidget/MetroWidget/PageUpdater.js +136 -0
- package/utils/JsViewEngineWidget/MetroWidget/ToolFunctions.js +18 -0
- package/utils/JsViewEngineWidget/SimpleWidget/SimpleWidget.vue +2 -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 +284 -57
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +5 -1
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayerBrowser.vue +25 -12
- 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 +25 -10
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/BrowserApic.vue +1 -1
- package/utils/JsViewVueWidget/JsvFilterView.vue +59 -51
- package/utils/JsViewVueWidget/JsvGrid.vue +140 -42
- 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 +13 -4
- 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
|
@@ -2,58 +2,55 @@
|
|
|
2
2
|
* @Author: ChenChanghua
|
|
3
3
|
* @Date: 2022-05-10 15:21:24
|
|
4
4
|
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime: 2022-
|
|
5
|
+
* @LastEditTime: 2022-07-08 11:51:26
|
|
6
6
|
* @Description: file content
|
|
7
7
|
-->
|
|
8
|
-
|
|
9
|
-
* @Author: ChenChanghua
|
|
10
|
-
* @Date: 2022-05-07 10:22:33
|
|
11
|
-
* @LastEditors: ChenChanghua
|
|
12
|
-
* @LastEditTime: 2022-05-09 09:19:43
|
|
13
|
-
* @Description: file content
|
|
14
|
-
-->
|
|
15
|
-
<script>
|
|
8
|
+
<script setup>
|
|
16
9
|
import { ref } from "vue";
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
getFocusBlock() {
|
|
50
|
-
return this.$refs.focusBlock;
|
|
51
|
-
},
|
|
52
|
-
_MapColor(color_num) {
|
|
53
|
-
return ((color_num < 10 || color_num >= 100) ? '0' + color_num % 10 : '' + color_num % 100);
|
|
54
|
-
}
|
|
55
|
-
},
|
|
10
|
+
const props = defineProps({
|
|
11
|
+
userData: Object,
|
|
12
|
+
name: String,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
let focusIndex = ref(0);
|
|
16
|
+
let focused = ref(false);
|
|
17
|
+
let divNumber = new Array(25);
|
|
18
|
+
let focusBlock = ref(null);
|
|
19
|
+
|
|
20
|
+
const _onFocus = () => {
|
|
21
|
+
console.log("button onfocus", props.userData);
|
|
22
|
+
focused.value = true;
|
|
23
|
+
};
|
|
24
|
+
const _onBlur = () => {
|
|
25
|
+
focused.value = false;
|
|
26
|
+
focusIndex.value = 0;
|
|
27
|
+
};
|
|
28
|
+
const _onKeyDown = (ev) => {
|
|
29
|
+
console.log("button onkeydown");
|
|
30
|
+
if (ev.keyCode == 37 && focusIndex.value == 1) {
|
|
31
|
+
focusIndex.value = 0;
|
|
32
|
+
return true;
|
|
33
|
+
} else if (ev.keyCode == 39 && focusIndex.value == 0) {
|
|
34
|
+
focusIndex.value = 1;
|
|
35
|
+
return true;
|
|
36
|
+
} else if (ev.keyCode == 13) {
|
|
37
|
+
console.log("button click", props.userData);
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
return false;
|
|
56
41
|
};
|
|
42
|
+
const getFocusBlock = () => {
|
|
43
|
+
return focusBlock.value;
|
|
44
|
+
};
|
|
45
|
+
const _MapColor = (color_num) => {
|
|
46
|
+
return color_num < 10 || color_num >= 100
|
|
47
|
+
? "0" + (color_num % 10)
|
|
48
|
+
: "" + (color_num % 100);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
defineExpose({
|
|
52
|
+
getFocusBlock,
|
|
53
|
+
});
|
|
57
54
|
</script>
|
|
58
55
|
|
|
59
56
|
<template>
|
|
@@ -94,7 +91,11 @@ export default {
|
|
|
94
91
|
left: 2 * index + 50,
|
|
95
92
|
width: 2,
|
|
96
93
|
height: 50,
|
|
97
|
-
backgroundColor:
|
|
94
|
+
backgroundColor:
|
|
95
|
+
'#' +
|
|
96
|
+
_MapColor(userData.baseColor) +
|
|
97
|
+
_MapColor(index) +
|
|
98
|
+
_MapColor(index),
|
|
98
99
|
}"
|
|
99
100
|
></div>
|
|
100
101
|
|
|
@@ -2,49 +2,30 @@
|
|
|
2
2
|
* @Author: ChenChanghua
|
|
3
3
|
* @Date: 2022-05-10 15:21:24
|
|
4
4
|
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime: 2022-
|
|
5
|
+
* @LastEditTime: 2022-07-08 11:50:58
|
|
6
6
|
* @Description: file content
|
|
7
7
|
-->
|
|
8
|
-
|
|
9
|
-
* @Author: ChenChanghua
|
|
10
|
-
* @Date: 2022-05-07 10:22:33
|
|
11
|
-
* @LastEditors: ChenChanghua
|
|
12
|
-
* @LastEditTime: 2022-05-09 09:19:43
|
|
13
|
-
* @Description: file content
|
|
14
|
-
-->
|
|
15
|
-
<script>
|
|
8
|
+
<script setup>
|
|
16
9
|
import ButtonBlock from "./ButtonBlock.vue";
|
|
17
10
|
import { ref } from "vue";
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
.requestFocus();
|
|
33
|
-
},
|
|
34
|
-
onBlur() {
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
created() {
|
|
39
|
-
if (this.onAction) {
|
|
40
|
-
this.onAction.register("onFocus", this.onFocus);
|
|
41
|
-
this.onAction.register("onBlur", this.onBlur);
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
mounted() {
|
|
45
|
-
// console.log("item mounted", this.userData, this.widgetData);
|
|
46
|
-
},
|
|
11
|
+
|
|
12
|
+
const props = defineProps({
|
|
13
|
+
userData: Object,
|
|
14
|
+
widgetData: Object,
|
|
15
|
+
onAction: Object,
|
|
16
|
+
});
|
|
17
|
+
const focused = ref(false);
|
|
18
|
+
const divNumber = new Array(50);
|
|
19
|
+
const button = ref(null);
|
|
20
|
+
const onFocus = () => {
|
|
21
|
+
button.value
|
|
22
|
+
.getFocusBlock()
|
|
23
|
+
.findBlockByName(props.widgetData.gridIndex + "_item")
|
|
24
|
+
.requestFocus();
|
|
47
25
|
};
|
|
26
|
+
const onBlur = () => {};
|
|
27
|
+
props.onAction.register("onFocus", onFocus);
|
|
28
|
+
props.onAction.register("onBlur", onBlur);
|
|
48
29
|
</script>
|
|
49
30
|
|
|
50
31
|
<template>
|
|
@@ -2,62 +2,54 @@
|
|
|
2
2
|
* @Author: ChenChanghua
|
|
3
3
|
* @Date: 2022-05-10 15:21:24
|
|
4
4
|
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime: 2022-
|
|
5
|
+
* @LastEditTime: 2022-07-08 11:48:32
|
|
6
6
|
* @Description: file content
|
|
7
7
|
-->
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
let randomColor = Math.round(Math.random() * 2 ** 24).toString(16);
|
|
22
|
-
return (
|
|
23
|
-
"#" + new Array(6 - randomColor.length).fill("0").join("") + randomColor
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
return {
|
|
27
|
-
focused: ref(false),
|
|
28
|
-
randomColor,
|
|
29
|
-
divNumber: new Array(50),
|
|
30
|
-
blurAction: false,
|
|
31
|
-
};
|
|
32
|
-
},
|
|
33
|
-
methods: {
|
|
34
|
-
onFocus() {
|
|
35
|
-
console.log("item onfocus", this.userData);
|
|
36
|
-
this.focused = true;
|
|
37
|
-
this.blurAction = false;
|
|
38
|
-
},
|
|
39
|
-
onBlur() {
|
|
40
|
-
console.log("item onblur", this.userData, this.widgetData.getCurrentFocusId(), this.widgetData.dataIndex);
|
|
41
|
-
this.focused = false;
|
|
42
|
-
if (this.widgetData.getCurrentFocusId() == this.widgetData.dataIndex) {
|
|
43
|
-
this.blurAction = true;
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
onClick() {
|
|
47
|
-
console.log("item onclick ", this.userData);
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
created() {
|
|
51
|
-
if (this.onAction) {
|
|
52
|
-
this.onAction.register("onFocus", this.onFocus);
|
|
53
|
-
this.onAction.register("onBlur", this.onBlur);
|
|
54
|
-
this.onAction.register("onClick", this.onClick);
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
mounted() {
|
|
58
|
-
// console.log("item mounted", this.userData, this.widgetData);
|
|
59
|
-
},
|
|
8
|
+
<script setup>
|
|
9
|
+
import { ref, onUpdated, onMounted } from "vue";
|
|
10
|
+
|
|
11
|
+
const props = defineProps({
|
|
12
|
+
userData: Object,
|
|
13
|
+
widgetData: Object,
|
|
14
|
+
onAction: Object,
|
|
15
|
+
});
|
|
16
|
+
const randomColor = () => {
|
|
17
|
+
let randomColor = Math.round(Math.random() * 2 ** 24).toString(16);
|
|
18
|
+
return (
|
|
19
|
+
"#" + new Array(6 - randomColor.length).fill("0").join("") + randomColor
|
|
20
|
+
);
|
|
60
21
|
};
|
|
22
|
+
const focused = ref(false);
|
|
23
|
+
const divNumber = new Array(50);
|
|
24
|
+
const blurAction = false;
|
|
25
|
+
|
|
26
|
+
const onFocus = () => {
|
|
27
|
+
console.log("item onfocus", props.userData);
|
|
28
|
+
focused.value = true;
|
|
29
|
+
};
|
|
30
|
+
const onBlur = () => {
|
|
31
|
+
console.log(
|
|
32
|
+
"item onblur",
|
|
33
|
+
props.userData,
|
|
34
|
+
props.widgetData.getCurrentFocusId(),
|
|
35
|
+
props.widgetData.dataIndex
|
|
36
|
+
);
|
|
37
|
+
focused.value = false;
|
|
38
|
+
};
|
|
39
|
+
const onClick = () => {
|
|
40
|
+
console.log("item onclick ", props.userData);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
props.onAction.register("onFocus", onFocus);
|
|
44
|
+
props.onAction.register("onBlur", onBlur);
|
|
45
|
+
props.onAction.register("onClick", onClick);
|
|
46
|
+
|
|
47
|
+
onUpdated(() => {
|
|
48
|
+
console.log("item updated", props.userData, props.widgetData);
|
|
49
|
+
});
|
|
50
|
+
onMounted(() => {
|
|
51
|
+
console.log("item mounted", props.userData, props.widgetData);
|
|
52
|
+
});
|
|
61
53
|
</script>
|
|
62
54
|
|
|
63
55
|
<template>
|
|
@@ -91,7 +83,7 @@ export default {
|
|
|
91
83
|
></div>
|
|
92
84
|
<div
|
|
93
85
|
:style="{
|
|
94
|
-
visibility:
|
|
86
|
+
visibility: !focused && widgetData.selected ? 'visible' : 'hidden',
|
|
95
87
|
left: 50,
|
|
96
88
|
width: 20,
|
|
97
89
|
height: 20,
|
|
@@ -1,92 +1,76 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
for(const route of routeList) {
|
|
26
|
-
if(route.path === "/") { // 不需要添加home
|
|
27
|
-
redirectPath = route.redirect;
|
|
28
|
-
continue;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const subRoute = {...route, path: route.path.substring(1)} // 去掉字符'/'
|
|
32
|
-
currentRouter.addRoute(currentRoute.name as string, subRoute)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
currentRouter.replace(props.routePath + redirectPath) // 自动跳转到redirectPath
|
|
36
|
-
} else { // 作为全局router使用
|
|
37
|
-
currentRouter = App.Router;
|
|
1
|
+
<script setup>
|
|
2
|
+
import { jJsvRuntimeBridge } from "jsview";
|
|
3
|
+
import { router, routeList } from "./router.js";
|
|
4
|
+
import { useRouter, useRoute } from "vue-router";
|
|
5
|
+
import { onMounted, ref } from "vue";
|
|
6
|
+
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
routePath: String,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const displayUrl = ref("");
|
|
12
|
+
let topRef = ref(null);
|
|
13
|
+
let routePage = ref(null);
|
|
14
|
+
let currentRouter;
|
|
15
|
+
if (props.routePath) {
|
|
16
|
+
const currentRoute = useRoute();
|
|
17
|
+
currentRouter = useRouter();
|
|
18
|
+
|
|
19
|
+
let redirectPath; // 自动跳转路径
|
|
20
|
+
for (const route of routeList) {
|
|
21
|
+
if (route.path === "/") {
|
|
22
|
+
// 不需要添加home
|
|
23
|
+
redirectPath = route.redirect;
|
|
24
|
+
continue;
|
|
38
25
|
}
|
|
39
26
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
// Override
|
|
44
|
-
mounted() {
|
|
45
|
-
// 调试接口,对接JSCenter平台去掉启动图的处理
|
|
46
|
-
jJsvRuntimeBridge.notifyPageLoaded();
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
private onRequestFocus(branchName: string) {
|
|
50
|
-
this.topRef.findBlockByname(branchName)?.requestFocus();
|
|
27
|
+
const subRoute = { ...route, path: route.path.substring(1) }; // 去掉字符'/'
|
|
28
|
+
currentRouter.addRoute(currentRoute.name, subRoute);
|
|
51
29
|
}
|
|
52
30
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
})
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
private onKeyDown(event: any) {
|
|
60
|
-
return this.routePage?.onKeyDown(event);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
private topRef!: any;
|
|
64
|
-
private displayUrl: string = "";
|
|
65
|
-
private routePage: any = null;
|
|
66
|
-
|
|
67
|
-
static Router: Router = router;
|
|
31
|
+
currentRouter.replace(props.routePath + redirectPath); // 自动跳转到redirectPath
|
|
32
|
+
} else {
|
|
33
|
+
currentRouter = router;
|
|
68
34
|
}
|
|
69
|
-
|
|
70
|
-
|
|
35
|
+
currentRouter.afterEach(() => {
|
|
36
|
+
displayUrl.value = window.location.href;
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const onRequestFocus = (branchName) => {
|
|
40
|
+
topRef.value.findBlockByname(branchName)?.requestFocus();
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const watchRouterChanged = (route) => {
|
|
44
|
+
route.afterEach(() => {
|
|
45
|
+
displayUrl.value = window.location.href;
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const onKeyDown = (event) => {
|
|
50
|
+
return routePage.value.onKeyDown(event);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
onMounted(() => {
|
|
54
|
+
jJsvRuntimeBridge.notifyPageLoaded();
|
|
55
|
+
});
|
|
71
56
|
</script>
|
|
72
57
|
|
|
73
58
|
<template>
|
|
74
|
-
<div class="root">
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
</div>
|
|
78
|
-
<div class="split" />
|
|
59
|
+
<div class="root">
|
|
60
|
+
<div class="address">当前URL: {{ displayUrl }}</div>
|
|
61
|
+
<div class="split"></div>
|
|
79
62
|
<jsv-focus-block ref="topRef">
|
|
80
63
|
<!-- 这种router-view的写法可以获取到component的ref,vue标准写法 -->
|
|
81
64
|
<router-view v-slot="{ Component }">
|
|
82
|
-
<component
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
65
|
+
<component
|
|
66
|
+
:is="Component"
|
|
67
|
+
ref="routePage"
|
|
68
|
+
class="router"
|
|
69
|
+
@requestFocus="onRequestFocus"
|
|
86
70
|
/>
|
|
87
71
|
</router-view>
|
|
88
72
|
</jsv-focus-block>
|
|
89
|
-
</div>
|
|
73
|
+
</div>
|
|
90
74
|
</template>
|
|
91
75
|
|
|
92
76
|
<style scoped>
|
|
@@ -95,7 +79,7 @@ export default App;
|
|
|
95
79
|
top: 0;
|
|
96
80
|
width: 1280;
|
|
97
81
|
height: 1080;
|
|
98
|
-
background-color: rgb(222,211,140)
|
|
82
|
+
background-color: rgb(222, 211, 140);
|
|
99
83
|
}
|
|
100
84
|
|
|
101
85
|
.address {
|
|
@@ -111,12 +95,12 @@ export default App;
|
|
|
111
95
|
top: 150;
|
|
112
96
|
width: 1200;
|
|
113
97
|
height: 3;
|
|
114
|
-
background-color: #
|
|
98
|
+
background-color: #00f000;
|
|
115
99
|
}
|
|
116
100
|
|
|
117
101
|
.router {
|
|
118
|
-
left:0;
|
|
119
|
-
top:150;
|
|
102
|
+
left: 0;
|
|
103
|
+
top: 150;
|
|
120
104
|
width: 1920;
|
|
121
105
|
height: 930;
|
|
122
106
|
overflow: hidden;
|
|
@@ -1,114 +1,91 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import { JsvFocusEvent } from "jsview/utils/JsViewEngineWidget";
|
|
3
|
-
import { Options, Vue } from "vue-class-component";
|
|
1
|
+
<script setup>
|
|
4
2
|
import Item from "./Item.vue";
|
|
5
3
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
style: Object,
|
|
6
|
+
buttonConfig: Object,
|
|
7
|
+
onButtonClick: Function,
|
|
8
|
+
onBack: Function,
|
|
9
|
+
});
|
|
10
|
+
const maxWidth = 1280;
|
|
11
|
+
const listPadding = 10;
|
|
12
|
+
const buttonWidth = 400;
|
|
13
|
+
const buttonHeight = 80;
|
|
14
|
+
const buttonGap = 50;
|
|
15
|
+
let focusedItemIndex = 0;
|
|
16
|
+
|
|
17
|
+
let listLeft = 0;
|
|
18
|
+
const listWidth = (buttonWidth + buttonGap) * props.buttonConfig.length;
|
|
19
|
+
|
|
20
|
+
// 根据maxWidth,计算buttons的左边位置
|
|
21
|
+
const widthCenter = listWidth - buttonGap; // 减去最后一个元素的gap
|
|
22
|
+
if (widthCenter < maxWidth) {
|
|
23
|
+
listLeft = Math.floor((maxWidth - widthCenter) / 2);
|
|
24
|
+
}
|
|
22
25
|
|
|
23
|
-
|
|
26
|
+
const listSize = {
|
|
27
|
+
left: listLeft,
|
|
28
|
+
width: listWidth,
|
|
29
|
+
height: buttonHeight,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const onKeyDown = (ev) => {
|
|
33
|
+
if (ev.keyCode === 13) {
|
|
34
|
+
// Enter
|
|
35
|
+
props.onButtonClick?.(focusedItemIndex);
|
|
36
|
+
return true;
|
|
37
|
+
} else if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
38
|
+
// 8:Backspace, 27:Escape, 10000:盒子返回键
|
|
39
|
+
props.onBack?.();
|
|
40
|
+
return true;
|
|
24
41
|
}
|
|
25
42
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
width: listWidth,
|
|
39
|
-
height: this.buttonHeight,
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
return listSize;
|
|
43
|
+
let changeFocusTo = -1;
|
|
44
|
+
switch (ev.keyCode) {
|
|
45
|
+
case 37: // Left
|
|
46
|
+
changeFocusTo =
|
|
47
|
+
(focusedItemIndex - 1 + props.buttonConfig.length) %
|
|
48
|
+
props.buttonConfig.length;
|
|
49
|
+
break;
|
|
50
|
+
case 39: // Right
|
|
51
|
+
changeFocusTo = (focusedItemIndex + 1) % props.buttonConfig.length;
|
|
52
|
+
break;
|
|
53
|
+
default:
|
|
54
|
+
break;
|
|
43
55
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return true;
|
|
49
|
-
} else if(ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) { // 8:Backspace, 27:Escape, 10000:盒子返回键
|
|
50
|
-
this.onBack?.();
|
|
51
|
-
return true;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
let changeFocusTo = -1;
|
|
55
|
-
switch (ev.keyCode) {
|
|
56
|
-
case 37: // Left
|
|
57
|
-
changeFocusTo = (this.focusedItemIndex - 1 + this.buttonConfig.length) % this.buttonConfig.length;
|
|
58
|
-
break;
|
|
59
|
-
case 39: // Right
|
|
60
|
-
changeFocusTo = (this.focusedItemIndex + 1) % this.buttonConfig.length;
|
|
61
|
-
break;
|
|
62
|
-
default:
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
if (changeFocusTo >= 0) {
|
|
66
|
-
ev.ownerNode.findBlockByName(changeFocusTo.toString()).requestFocus();
|
|
67
|
-
this.focusedItemIndex = changeFocusTo;
|
|
68
|
-
return true;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return false;
|
|
56
|
+
if (changeFocusTo >= 0) {
|
|
57
|
+
ev.ownerNode.findBlockByName(changeFocusTo.toString()).requestFocus();
|
|
58
|
+
focusedItemIndex = changeFocusTo;
|
|
59
|
+
return true;
|
|
72
60
|
}
|
|
73
61
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
private focusedItemIndex = 0;
|
|
77
|
-
|
|
78
|
-
private readonly buttonConfig!: any;
|
|
79
|
-
private readonly onButtonClick?: Function;
|
|
80
|
-
private readonly onBack?: Function;
|
|
81
|
-
|
|
82
|
-
private readonly maxWidth: number = 1280;
|
|
83
|
-
private readonly listPadding: number = 10;
|
|
84
|
-
private readonly buttonWidth: number = 400;
|
|
85
|
-
private readonly buttonHeight: number = 80;
|
|
86
|
-
private readonly buttonGap: number = 50;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export default HorizontalButtonList;
|
|
62
|
+
return false;
|
|
63
|
+
};
|
|
90
64
|
</script>
|
|
91
65
|
|
|
92
66
|
<template>
|
|
93
|
-
<div :style="style">
|
|
94
|
-
|
|
67
|
+
<div :style="style">
|
|
68
|
+
<jsv-focus-block
|
|
95
69
|
:style="{
|
|
96
70
|
left: listSize.left,
|
|
97
71
|
width: listSize.width + listPadding * 2,
|
|
98
72
|
height: listSize.height + listPadding * 2,
|
|
99
73
|
}"
|
|
100
74
|
:onKeyDown="onKeyDown"
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
75
|
+
>
|
|
76
|
+
<Item
|
|
77
|
+
v-for="(item, index) in buttonConfig"
|
|
78
|
+
:key="index"
|
|
79
|
+
:style="{
|
|
80
|
+
left: (buttonWidth + 10) * index,
|
|
81
|
+
width: buttonWidth,
|
|
82
|
+
height: buttonHeight,
|
|
83
|
+
}"
|
|
104
84
|
:name="index.toString()"
|
|
105
85
|
:autoFocus="index === 0"
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
</div>
|
|
111
|
-
</template>
|
|
112
|
-
|
|
113
|
-
<style>
|
|
114
|
-
</style>
|
|
86
|
+
>
|
|
87
|
+
{{ item.name }}
|
|
88
|
+
</Item>
|
|
89
|
+
</jsv-focus-block>
|
|
90
|
+
</div>
|
|
91
|
+
</template>
|