@shijiu/jsview-vue 0.9.254 → 0.9.267
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/package.json +11 -11
- package/dom/browser-root-style.css +21 -21
- package/loader/jsview-main.js +41 -41
- package/loader/jsview.config.default.js +37 -37
- package/loader/jsview.default.config.js +37 -37
- package/package.json +1 -5
- package/samples/AdvanceMetroWidget/App.vue +122 -122
- package/samples/AdvanceMetroWidget/Frame.vue +100 -100
- package/samples/AdvanceMetroWidget/Item.vue +57 -57
- package/samples/AdvanceMetroWidget/data.js +136 -136
- package/samples/AnimPicture/App.vue +223 -223
- package/samples/Basic/App.vue +128 -128
- package/samples/Basic/components/TitleBar.vue +28 -28
- package/samples/Basic/components/anim/AnimGroup.vue +67 -67
- package/samples/Basic/components/anim/AnimKeyframeBasic.vue +101 -101
- package/samples/Basic/components/anim/AnimKeyframeComposite.vue +52 -52
- package/samples/Basic/components/anim/AnimTransition.vue +116 -116
- package/samples/Basic/components/div/DivBackground.vue +14 -14
- package/samples/Basic/components/div/DivClip.vue +80 -80
- package/samples/Basic/components/div/DivCssScoped.vue +26 -26
- package/samples/Basic/components/div/DivCssVar.vue +49 -49
- package/samples/Basic/components/div/DivGroup1.vue +32 -32
- package/samples/Basic/components/div/DivGroup2.vue +40 -40
- package/samples/Basic/components/div/DivLayout.vue +11 -11
- package/samples/Basic/components/div/DivRadius.vue +46 -46
- package/samples/Basic/components/text/TextAlign.vue +47 -47
- package/samples/Basic/components/text/TextFontStyle.vue +57 -57
- package/samples/Basic/components/text/TextGroup.vue +31 -31
- package/samples/Basic/components/text/TextOverflow.vue +77 -77
- package/samples/BasicFocusControl/App.vue +124 -124
- package/samples/BasicFocusControl/components/BaseBlock.vue +50 -50
- package/samples/BasicFocusControl/components/MainArea.vue +97 -97
- package/samples/BasicFocusControl/components/MainAreaLeftBlock.vue +20 -20
- package/samples/BasicFocusControl/components/MainAreaRightBlock.vue +29 -29
- package/samples/BasicFocusControl/components/SideBar.vue +72 -72
- package/samples/BasicFocusControl/components/SideBarBlock.vue +29 -29
- package/samples/ClassNameDemo/App.vue +119 -119
- package/samples/ClassNameDemo/components/ContentItem.vue +252 -252
- package/samples/ClassNameDemo/components/LoadingView.vue +43 -43
- package/samples/ClassNameDemo/components/TitleView.vue +24 -24
- package/samples/ClassNameDemo/data.js +24 -24
- package/samples/ColorSpace/App.vue +134 -134
- package/samples/DemoHomepage/App.vue +31 -31
- package/samples/DemoHomepage/components/BodyFrame.vue +81 -81
- package/samples/DemoHomepage/components/Dialog.vue +93 -93
- package/samples/DemoHomepage/components/Item.vue +76 -76
- package/samples/DemoHomepage/components/TabFrame.vue +86 -86
- package/samples/DemoHomepage/router.js +132 -132
- package/samples/DemoHomepage/views/Homepage.vue +186 -186
- package/samples/FlipCard/App.vue +80 -80
- package/samples/FlipCard/FlipCard.vue +123 -123
- package/samples/FlipCard/data.js +12 -12
- package/samples/FlowMultiWidget/App.vue +90 -90
- package/samples/FlowMultiWidget/components/Block.vue +106 -106
- package/samples/FlowMultiWidget/components/FlowPage.vue +59 -59
- package/samples/FlowMultiWidget/components/Item.vue +102 -102
- package/samples/FlowMultiWidget/components/MenuItem.vue +71 -71
- package/samples/FlowMultiWidget/components/MyMenu.vue +89 -89
- package/samples/FlowMultiWidget/data.js +446 -446
- package/samples/HashHistory/App.vue +124 -124
- package/samples/HashHistory/components/HorizontalButtonList.vue +113 -113
- package/samples/HashHistory/components/Item.vue +73 -73
- package/samples/HashHistory/router.js +29 -29
- package/samples/HashHistory/views/BasePage.vue +18 -18
- package/samples/HashHistory/views/MainPage.vue +67 -67
- package/samples/HashHistory/views/SubPage.vue +78 -78
- package/samples/HashHistory/views/SubPageFirst.vue +9 -9
- package/samples/HashHistory/views/SubPageSecond.vue +9 -9
- package/samples/LongImage/App.vue +96 -96
- package/samples/LongImage/Button.vue +153 -153
- package/samples/LongImage/LongImageScroll.vue +126 -126
- package/samples/LongImage/Scroll.vue +15 -15
- package/samples/LongText/App.vue +111 -111
- package/samples/LongText/Button.vue +153 -153
- package/samples/LongText/LongTextScroll.vue +224 -224
- package/samples/LongText/Scroll.vue +15 -15
- package/samples/Preload/App.vue +145 -145
- package/samples/Preload/data.js +22 -22
- package/samples/Preload/preloadItem.vue +21 -21
- package/samples/QrcodeDemo/App.vue +72 -72
- package/samples/SimpleWidgetDemo/App.vue +203 -203
- package/samples/SimpleWidgetDemo/Item.vue +82 -82
- package/samples/SimpleWidgetDemo/components/ContentItem.vue +411 -411
- package/samples/SimpleWidgetDemo/components/MyTab.vue +116 -116
- package/samples/SimpleWidgetDemo/data.js +110 -110
- package/samples/SprayView/App.vue +269 -269
- package/samples/SpriteImage/App.vue +174 -174
- package/samples/SpriteImage/images/egg_break.json +116 -116
- package/samples/TextBox/App.vue +178 -178
- package/samples/TextBox/RenderCenter.vue +108 -108
- package/samples/TextBox/RenderLeft.vue +108 -108
- package/samples/TextBox/RenderOneLine.vue +119 -119
- package/samples/TextBox/RenderRight.vue +106 -106
- package/samples/TextShadowDemo/App.vue +97 -97
- package/samples/TextureSize/App.vue +141 -141
- package/samples/ThrowMoveDemo/AccelerateDemo.vue +117 -117
- package/samples/ThrowMoveDemo/App.vue +113 -113
- package/samples/ThrowMoveDemo/LRParabolicDemo.vue +115 -115
- package/samples/ThrowMoveDemo/TargetDemo.vue +116 -116
- package/samples/ThrowMoveDemo/UDParabolicDemo.vue +121 -121
- package/samples/TransitPage/App.vue +40 -40
- package/samples/VideoDemo/App.vue +137 -137
- package/samples/VideoDemo/components/Button.vue +68 -68
- package/samples/VideoDemo/components/Controllor.vue +195 -195
- package/samples/VideoDemo/components/VideoFrame.vue +152 -152
- package/scripts/common.js +57 -115
- package/scripts/jsview-install-local-packages.js +73 -73
- package/scripts/jsview-post-build.js +127 -127
- package/scripts/jsview-post-install.js +78 -78
- package/scripts/jsview-run-android.js +64 -64
- package/utils/JsViewEngineWidget/bin/index.js +1 -1
- package/utils/JsViewEngineWidget/bin/package.json +11 -11
- package/utils/JsViewVueTools/JsvHashHistory.js +111 -111
- package/utils/JsViewVueTools/JsvRuntimeBridge.js +417 -417
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserPreload.vue +80 -80
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserQrcode.vue +147 -147
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserSpray.vue +54 -54
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/ApicDataBase.js +28 -28
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/BrowserApic.vue +123 -123
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/GifData.js +83 -83
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/LoopToolBase.js +25 -25
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/NormalLoopTool.js +61 -61
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/PartLoopTool.js +119 -119
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/Viewer.js +106 -106
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/WebpData.js +141 -141
- package/utils/JsViewVueWidget/BrowserDebugWidget/WidgetLoader.js +20 -20
- package/utils/JsViewVueWidget/JsvActorMove/ActorControlBase.js +204 -204
- package/utils/JsViewVueWidget/JsvActorMove/JsvActorMove.vue +63 -63
- package/utils/JsViewVueWidget/JsvActorMove/JsvActorMoveControl.js +426 -426
- package/utils/JsViewVueWidget/JsvActorMove/index.js +12 -12
- package/utils/JsViewVueWidget/JsvApic/JsvApic.vue +178 -178
- package/utils/JsViewVueWidget/JsvApic/index.js +17 -17
- package/utils/JsViewVueWidget/JsvMarquee.vue +196 -196
- package/utils/JsViewVueWidget/JsvNinePatch.vue +76 -76
- package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +350 -350
- package/utils/JsViewVueWidget/JsvPreload/index.js +21 -21
- package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +140 -140
- package/utils/JsViewVueWidget/JsvQrcode/index.js +18 -18
- package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +139 -139
- package/utils/JsViewVueWidget/JsvSpray/index.js +14 -14
- package/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue +447 -447
- package/utils/JsViewVueWidget/JsvSpriteAnim/SpriteController.js +56 -56
- package/utils/JsViewVueWidget/JsvSpriteAnim/index.js +6 -6
- package/utils/JsViewVueWidget/JsvSwiper/Indicator.vue +34 -34
- package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +494 -494
- package/utils/JsViewVueWidget/JsvSwiper/index.js +9 -9
- package/utils/JsViewVueWidget/JsvSwiper3D/Indicator.vue +34 -34
- package/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue +403 -403
- package/utils/JsViewVueWidget/JsvSwiper3D/index.js +9 -9
- package/utils/JsViewVueWidget/JsvTextBox.vue +110 -110
- package/utils/JsViewVueWidget/JsvVideo.vue +35 -35
- package/patches/node_modules/@babel/preset-env/lib/available-plugins.js +0 -219
- package/patches/node_modules/@vue/cli-plugin-typescript/index.js +0 -100
- package/patches/node_modules/@vue/cli-service/lib/commands/serve.js +0 -395
- package/patches/node_modules/@vue/cli-service/lib/config/app.js +0 -272
- package/patches/node_modules/@vue/cli-service/lib/config/assets.js +0 -70
- package/patches/node_modules/@vue/cli-service/lib/config/base.js +0 -212
- package/patches/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +0 -2566
- package/patches/node_modules/@vue/compiler-sfc/dist/jsview-css-to-js.js +0 -274
- package/patches/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js +0 -1596
- package/patches/node_modules/postcss-js/objectifier.js +0 -90
- package/patches/node_modules/vue-loader/dist/resolveScript.js +0 -70
- package/scripts/deploy-fast-pack.js +0 -17
- package/scripts/deploy-fast-publish.js +0 -44
- package/scripts/deploy-git-commit-empty.js +0 -21
- package/scripts/deploy-prepare.js +0 -56
- package/scripts/make-js.sh +0 -181
- package/vetur.config.js +0 -5
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div id='layout-root'>
|
|
3
|
-
<div class="content-font" :style="{ ...baseStyle,
|
|
4
|
-
whiteSpace: 'nowrap',
|
|
5
|
-
textOverflow: 'clip',
|
|
6
|
-
overflow: 'hidden'}">
|
|
7
|
-
1.长文字截断,后面的文字你可能看不到
|
|
8
|
-
</div>
|
|
9
|
-
|
|
10
|
-
<div class="content-font" :style="{ ...baseStyle,
|
|
11
|
-
top: blockSize.height+gap,
|
|
12
|
-
whiteSpace: 'nowrap',
|
|
13
|
-
textOverflow: 'ellipsis',
|
|
14
|
-
overflow: 'hidden'}">
|
|
15
|
-
2.长文字省略,后面的文字你可能看不到
|
|
16
|
-
</div>
|
|
17
|
-
|
|
18
|
-
<div class="content-font" :style="{ ...baseStyle,
|
|
19
|
-
top: (blockSize.height+gap)*2,
|
|
20
|
-
whiteSpace: 'pre-wrap',
|
|
21
|
-
textOverflow: 'clip',
|
|
22
|
-
overflow: 'hidden'}">
|
|
23
|
-
3.长文字折行+截断,后面的文字你可能看不到,与PC效果有区别,一二三四五六七八九十
|
|
24
|
-
</div>
|
|
25
|
-
|
|
26
|
-
<div class="content-font" :style="{ ...baseStyle,
|
|
27
|
-
top: (blockSize.height+gap)*3,
|
|
28
|
-
whiteSpace: 'pre-wrap',
|
|
29
|
-
textOverflow: 'ellipsis',
|
|
30
|
-
overflow: 'hidden'}">
|
|
31
|
-
4.长文字折行+省略,后面的文字你可能看不到,与PC效果有区别,一二三四五六七八九十
|
|
32
|
-
</div>
|
|
33
|
-
|
|
34
|
-
<div class="content-font" :style="{ ...baseStyle,
|
|
35
|
-
top: (blockSize.height+gap)*4, height: 65,
|
|
36
|
-
whiteSpace: 'pre-wrap',
|
|
37
|
-
textOverflow: 'ellipsis',
|
|
38
|
-
overflow: 'hidden'}">
|
|
39
|
-
5.{{multiLine}}
|
|
40
|
-
</div>
|
|
41
|
-
|
|
42
|
-
<div class="content-font" :style="{ ...baseStyle,
|
|
43
|
-
top: (blockSize.height+gap)*4+67, height: 65,
|
|
44
|
-
whiteSpace: 'pre-wrap',
|
|
45
|
-
textOverflow: 'clip',
|
|
46
|
-
overflow: 'hidden'}">
|
|
47
|
-
6.{{multiLine}}
|
|
48
|
-
</div>
|
|
49
|
-
|
|
50
|
-
</div>
|
|
51
|
-
</template>
|
|
52
|
-
|
|
53
|
-
<script setup>
|
|
54
|
-
/* eslint-disable no-unused-vars */
|
|
55
|
-
const gap = 2;
|
|
56
|
-
|
|
57
|
-
const blockSize = {
|
|
58
|
-
width: 180,
|
|
59
|
-
height: 35,
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
const baseStyle = {
|
|
63
|
-
width: blockSize.width, height: blockSize.height,
|
|
64
|
-
backgroundColor: 'rgba(255, 255, 0, 0.5)',
|
|
65
|
-
color: 'rgba(255, 0, 0, 1)',
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
// 多行的处理,在PC端依靠CSS属性 white-space: pre-line,在JsView平台不需要特别属性
|
|
69
|
-
const multiLine = "多行文字(末尾省略):"
|
|
70
|
-
+ "\n第一行:我末尾有个\"\\n\""
|
|
71
|
-
+ "\n第二行:一二三四五六七八九十,一二三四五六七八九十,一二三四五六七八九十"
|
|
72
|
-
+ "\n第三行:一二三四五六七八九十,一二三四五六七八九十,一二三四五六七八九十";
|
|
73
|
-
|
|
74
|
-
</script>
|
|
75
|
-
|
|
76
|
-
<style>
|
|
77
|
-
@import "../FontStyle.css";
|
|
1
|
+
<template>
|
|
2
|
+
<div id='layout-root'>
|
|
3
|
+
<div class="content-font" :style="{ ...baseStyle,
|
|
4
|
+
whiteSpace: 'nowrap',
|
|
5
|
+
textOverflow: 'clip',
|
|
6
|
+
overflow: 'hidden'}">
|
|
7
|
+
1.长文字截断,后面的文字你可能看不到
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
<div class="content-font" :style="{ ...baseStyle,
|
|
11
|
+
top: blockSize.height+gap,
|
|
12
|
+
whiteSpace: 'nowrap',
|
|
13
|
+
textOverflow: 'ellipsis',
|
|
14
|
+
overflow: 'hidden'}">
|
|
15
|
+
2.长文字省略,后面的文字你可能看不到
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<div class="content-font" :style="{ ...baseStyle,
|
|
19
|
+
top: (blockSize.height+gap)*2,
|
|
20
|
+
whiteSpace: 'pre-wrap',
|
|
21
|
+
textOverflow: 'clip',
|
|
22
|
+
overflow: 'hidden'}">
|
|
23
|
+
3.长文字折行+截断,后面的文字你可能看不到,与PC效果有区别,一二三四五六七八九十
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<div class="content-font" :style="{ ...baseStyle,
|
|
27
|
+
top: (blockSize.height+gap)*3,
|
|
28
|
+
whiteSpace: 'pre-wrap',
|
|
29
|
+
textOverflow: 'ellipsis',
|
|
30
|
+
overflow: 'hidden'}">
|
|
31
|
+
4.长文字折行+省略,后面的文字你可能看不到,与PC效果有区别,一二三四五六七八九十
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
<div class="content-font" :style="{ ...baseStyle,
|
|
35
|
+
top: (blockSize.height+gap)*4, height: 65,
|
|
36
|
+
whiteSpace: 'pre-wrap',
|
|
37
|
+
textOverflow: 'ellipsis',
|
|
38
|
+
overflow: 'hidden'}">
|
|
39
|
+
5.{{multiLine}}
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<div class="content-font" :style="{ ...baseStyle,
|
|
43
|
+
top: (blockSize.height+gap)*4+67, height: 65,
|
|
44
|
+
whiteSpace: 'pre-wrap',
|
|
45
|
+
textOverflow: 'clip',
|
|
46
|
+
overflow: 'hidden'}">
|
|
47
|
+
6.{{multiLine}}
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
</div>
|
|
51
|
+
</template>
|
|
52
|
+
|
|
53
|
+
<script setup>
|
|
54
|
+
/* eslint-disable no-unused-vars */
|
|
55
|
+
const gap = 2;
|
|
56
|
+
|
|
57
|
+
const blockSize = {
|
|
58
|
+
width: 180,
|
|
59
|
+
height: 35,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const baseStyle = {
|
|
63
|
+
width: blockSize.width, height: blockSize.height,
|
|
64
|
+
backgroundColor: 'rgba(255, 255, 0, 0.5)',
|
|
65
|
+
color: 'rgba(255, 0, 0, 1)',
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// 多行的处理,在PC端依靠CSS属性 white-space: pre-line,在JsView平台不需要特别属性
|
|
69
|
+
const multiLine = "多行文字(末尾省略):"
|
|
70
|
+
+ "\n第一行:我末尾有个\"\\n\""
|
|
71
|
+
+ "\n第二行:一二三四五六七八九十,一二三四五六七八九十,一二三四五六七八九十"
|
|
72
|
+
+ "\n第三行:一二三四五六七八九十,一二三四五六七八九十,一二三四五六七八九十";
|
|
73
|
+
|
|
74
|
+
</script>
|
|
75
|
+
|
|
76
|
+
<style>
|
|
77
|
+
@import "../FontStyle.css";
|
|
78
78
|
</style>
|
|
@@ -1,125 +1,125 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
* 【界面概述】
|
|
3
|
-
* 用于展示FDiv控件来进行按键响应区块划分的样例。
|
|
4
|
-
* 界面分为主界面(main)和副界面(sideBar),当主界面右边缘再按下右键时,焦点跳到SiderBar区域,
|
|
5
|
-
* 同理,焦点在SiderBar中,按下左键时,焦点调回main区域。
|
|
6
|
-
* 除此外,为区域内焦点移动。
|
|
7
|
-
*
|
|
8
|
-
* 【控件介绍】
|
|
9
|
-
* Fdiv:焦点控制节点,可由继承自FdivWrapper或者enableFocusable(基础类)生成衍生类两种方式获得
|
|
10
|
-
* 属性(props):
|
|
11
|
-
* style {Object} 同div的style设置
|
|
12
|
-
* branchName {string} 焦点名称,用于changeFocus()函数进行焦点切换的id
|
|
13
|
-
*
|
|
14
|
-
* FdivWrapper方式的类接口列表:
|
|
15
|
-
* onKeyDown(ev) ev的结构为{keyCode:按键值, repeat:是否是重复按键},响应按键按下事件,
|
|
16
|
-
* 返回值为true时,父节点的onKeyDown不会再被触发
|
|
17
|
-
* onKeyUp(ev) ev的结构同上,响应按键抬起事件
|
|
18
|
-
* onDispatchKeyDown(ev) ev的结构同上,响应按键按下事件,返回值为true时,子节点的onDispatchKeyDown不会被触发
|
|
19
|
-
* onDispatchKeyUp(ev) ev的结构同上,响应按键抬起事件
|
|
20
|
-
* onFocus() 当被changeFocus改变焦点后,该节点获焦时被调用
|
|
21
|
-
* onBlur() 当被changeFocus改变焦点后,该节点丢失焦点时被调用
|
|
22
|
-
* renderContent() 替代render()函数,返回控件描绘内容
|
|
23
|
-
* changeFocus(branchName, keepChildFocus) 主动进行焦点切换
|
|
24
|
-
*
|
|
25
|
-
* enableFocusable(基础类)生成衍生类时的节点列表:
|
|
26
|
-
* onKeyDown(ev) 同上
|
|
27
|
-
* onKeyUp(ev) 同上
|
|
28
|
-
* onDispatchKeyDown(ev) 同上
|
|
29
|
-
* onDispatchKeyUp(ev) 同上
|
|
30
|
-
* onFocus(ev) 同上
|
|
31
|
-
* onBlur(ev) 同上
|
|
32
|
-
* setControl(control_ref) 接受control对象,control对象含有changeFocus接口
|
|
33
|
-
* changeFocus(branchName) 同上
|
|
34
|
-
* 注意: render()函数没有被renderContent()函数替代
|
|
35
|
-
*
|
|
36
|
-
* 【技巧说明】
|
|
37
|
-
* Q: 如何进行按键响应?
|
|
38
|
-
* A: 重载函数onKeyDown/onKeyUp/onDispatchKeyDown/onDispatchKeyUp中任何一个关心的按键事件响应函数,
|
|
39
|
-
* 处理ev.keyCode判断按键值,通过返回值控制消息传递链是否中止
|
|
40
|
-
*
|
|
41
|
-
* Q: 如何进行焦点切换?
|
|
42
|
-
* A: 首先为子焦点设置branchName属性,当需要进行焦点切换的时候,调用FDiv类中的this.changeFocus()接口,
|
|
43
|
-
* 传入目标的branchName,即可进行焦点切换。在同一个FdivRouter节点的所有Fdiv,只要指定对方的branchName,就可以进行切换。
|
|
44
|
-
* 不限制切换目标是自己的子节点、兄弟节点或者是父几点。一般一个场景定义一个FdivRouter。
|
|
45
|
-
* 在enableFocusable的场景,通过重载setControl接口,获得control对象,通过该对象的 changeFocus()接口来进行焦点切换。
|
|
46
|
-
*
|
|
47
|
-
* Q: changeFocus的第二个参数keepChildFocus的作用是什么?
|
|
48
|
-
* A: 使用场景举例:
|
|
49
|
-
* 场景1:changeFocus的目标是一个当前获焦节点的父节点时,若keepChildFocus为true,则不会发生任何改变;
|
|
50
|
-
* 若keepChildFocus为false或者不设置,则该焦点会失焦,焦点退回到父节点中。
|
|
51
|
-
* 场景2:changeFocus的目标为一个曾经获得过焦但目前处于非焦状态的节点的父节点时,若keepChildFocus为true时,
|
|
52
|
-
* 焦点会沿着该父节点的最后获焦状态记录,寻找到最末尾的落焦节点进行获焦;若keepChildFocus为false或者不设置,
|
|
53
|
-
* 则只会对该父节点进行获焦,不会根据最后获焦状态寻找最末尾节点。
|
|
54
|
-
* (例如,进行场景回退时,返回上一个场景过程中,不需要该场景去记录最后的焦点位置,只要changeFocus设置
|
|
55
|
-
* 为该场景的根Fdiv,并且keepChildFocus设置为true,则Fdiv系统会自动将焦点落在此场景失焦时的最后获焦位置。)
|
|
56
|
-
*
|
|
57
|
-
-->
|
|
58
|
-
|
|
59
|
-
<script lang="ts">
|
|
60
|
-
import { Options, Vue } from "vue-class-component";
|
|
61
|
-
import MainArea from "./components/MainArea.vue"
|
|
62
|
-
import SideBar from "./components/SideBar.vue"
|
|
63
|
-
|
|
64
|
-
@Options({
|
|
65
|
-
components: {
|
|
66
|
-
MainArea,
|
|
67
|
-
SideBar
|
|
68
|
-
}
|
|
69
|
-
})
|
|
70
|
-
export default
|
|
71
|
-
class App extends Vue {
|
|
72
|
-
constructor(props: object) {
|
|
73
|
-
super(props);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
onDidRef(ref: any) {
|
|
77
|
-
// 如果使用这种全局切换焦点的方式,请换一个唯一的函数名,防止二次集成时出现函数覆盖。
|
|
78
|
-
(this.$root as any).changeFocusInDemoSpace = (relativeName: String) => {
|
|
79
|
-
console.log('Change focus to: ' + relativeName)
|
|
80
|
-
ref.findBlockByName(relativeName).requestFocus()
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
onKeyDown(ev: any) {
|
|
85
|
-
// 有router时,是从DemoHomepage进入,回退,和本demo功能无关
|
|
86
|
-
// 8:Backspace, 27:Escape, 10000:盒子返回键
|
|
87
|
-
if(ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
88
|
-
console.log("Basic has this.$router: ", !!(this as any).$router);
|
|
89
|
-
(this as any).$router?.go(-1);
|
|
90
|
-
return true
|
|
91
|
-
}
|
|
92
|
-
return false;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
</script>
|
|
96
|
-
|
|
97
|
-
<template>
|
|
98
|
-
<!-- 这里的jsv-focus-block只是为了获取到一个base focus节点,并不是必须的 -->
|
|
99
|
-
<jsv-focus-block :ref="onDidRef" :onKeyDown="onKeyDown">
|
|
100
|
-
<div class="title">可上下左右切换焦点</div>
|
|
101
|
-
<div class="body">
|
|
102
|
-
<MainArea :style="{left: 0}"/>
|
|
103
|
-
<SideBar :style="{left: 300}"/>
|
|
104
|
-
</div>
|
|
105
|
-
</jsv-focus-block>
|
|
106
|
-
</template>
|
|
107
|
-
|
|
108
|
-
<style scoped>
|
|
109
|
-
.title {
|
|
110
|
-
text-align: center;
|
|
111
|
-
font-size: 30px;
|
|
112
|
-
line-height: 50px;
|
|
113
|
-
color: #ffffff;
|
|
114
|
-
left: 100;
|
|
115
|
-
top: 50;
|
|
116
|
-
width: 400;
|
|
117
|
-
height: 50;
|
|
118
|
-
background-color: rgba(27,38,151,0.8);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.body {
|
|
122
|
-
left: 100;
|
|
123
|
-
top: 120;
|
|
124
|
-
}
|
|
1
|
+
<!--
|
|
2
|
+
* 【界面概述】
|
|
3
|
+
* 用于展示FDiv控件来进行按键响应区块划分的样例。
|
|
4
|
+
* 界面分为主界面(main)和副界面(sideBar),当主界面右边缘再按下右键时,焦点跳到SiderBar区域,
|
|
5
|
+
* 同理,焦点在SiderBar中,按下左键时,焦点调回main区域。
|
|
6
|
+
* 除此外,为区域内焦点移动。
|
|
7
|
+
*
|
|
8
|
+
* 【控件介绍】
|
|
9
|
+
* Fdiv:焦点控制节点,可由继承自FdivWrapper或者enableFocusable(基础类)生成衍生类两种方式获得
|
|
10
|
+
* 属性(props):
|
|
11
|
+
* style {Object} 同div的style设置
|
|
12
|
+
* branchName {string} 焦点名称,用于changeFocus()函数进行焦点切换的id
|
|
13
|
+
*
|
|
14
|
+
* FdivWrapper方式的类接口列表:
|
|
15
|
+
* onKeyDown(ev) ev的结构为{keyCode:按键值, repeat:是否是重复按键},响应按键按下事件,
|
|
16
|
+
* 返回值为true时,父节点的onKeyDown不会再被触发
|
|
17
|
+
* onKeyUp(ev) ev的结构同上,响应按键抬起事件
|
|
18
|
+
* onDispatchKeyDown(ev) ev的结构同上,响应按键按下事件,返回值为true时,子节点的onDispatchKeyDown不会被触发
|
|
19
|
+
* onDispatchKeyUp(ev) ev的结构同上,响应按键抬起事件
|
|
20
|
+
* onFocus() 当被changeFocus改变焦点后,该节点获焦时被调用
|
|
21
|
+
* onBlur() 当被changeFocus改变焦点后,该节点丢失焦点时被调用
|
|
22
|
+
* renderContent() 替代render()函数,返回控件描绘内容
|
|
23
|
+
* changeFocus(branchName, keepChildFocus) 主动进行焦点切换
|
|
24
|
+
*
|
|
25
|
+
* enableFocusable(基础类)生成衍生类时的节点列表:
|
|
26
|
+
* onKeyDown(ev) 同上
|
|
27
|
+
* onKeyUp(ev) 同上
|
|
28
|
+
* onDispatchKeyDown(ev) 同上
|
|
29
|
+
* onDispatchKeyUp(ev) 同上
|
|
30
|
+
* onFocus(ev) 同上
|
|
31
|
+
* onBlur(ev) 同上
|
|
32
|
+
* setControl(control_ref) 接受control对象,control对象含有changeFocus接口
|
|
33
|
+
* changeFocus(branchName) 同上
|
|
34
|
+
* 注意: render()函数没有被renderContent()函数替代
|
|
35
|
+
*
|
|
36
|
+
* 【技巧说明】
|
|
37
|
+
* Q: 如何进行按键响应?
|
|
38
|
+
* A: 重载函数onKeyDown/onKeyUp/onDispatchKeyDown/onDispatchKeyUp中任何一个关心的按键事件响应函数,
|
|
39
|
+
* 处理ev.keyCode判断按键值,通过返回值控制消息传递链是否中止
|
|
40
|
+
*
|
|
41
|
+
* Q: 如何进行焦点切换?
|
|
42
|
+
* A: 首先为子焦点设置branchName属性,当需要进行焦点切换的时候,调用FDiv类中的this.changeFocus()接口,
|
|
43
|
+
* 传入目标的branchName,即可进行焦点切换。在同一个FdivRouter节点的所有Fdiv,只要指定对方的branchName,就可以进行切换。
|
|
44
|
+
* 不限制切换目标是自己的子节点、兄弟节点或者是父几点。一般一个场景定义一个FdivRouter。
|
|
45
|
+
* 在enableFocusable的场景,通过重载setControl接口,获得control对象,通过该对象的 changeFocus()接口来进行焦点切换。
|
|
46
|
+
*
|
|
47
|
+
* Q: changeFocus的第二个参数keepChildFocus的作用是什么?
|
|
48
|
+
* A: 使用场景举例:
|
|
49
|
+
* 场景1:changeFocus的目标是一个当前获焦节点的父节点时,若keepChildFocus为true,则不会发生任何改变;
|
|
50
|
+
* 若keepChildFocus为false或者不设置,则该焦点会失焦,焦点退回到父节点中。
|
|
51
|
+
* 场景2:changeFocus的目标为一个曾经获得过焦但目前处于非焦状态的节点的父节点时,若keepChildFocus为true时,
|
|
52
|
+
* 焦点会沿着该父节点的最后获焦状态记录,寻找到最末尾的落焦节点进行获焦;若keepChildFocus为false或者不设置,
|
|
53
|
+
* 则只会对该父节点进行获焦,不会根据最后获焦状态寻找最末尾节点。
|
|
54
|
+
* (例如,进行场景回退时,返回上一个场景过程中,不需要该场景去记录最后的焦点位置,只要changeFocus设置
|
|
55
|
+
* 为该场景的根Fdiv,并且keepChildFocus设置为true,则Fdiv系统会自动将焦点落在此场景失焦时的最后获焦位置。)
|
|
56
|
+
*
|
|
57
|
+
-->
|
|
58
|
+
|
|
59
|
+
<script lang="ts">
|
|
60
|
+
import { Options, Vue } from "vue-class-component";
|
|
61
|
+
import MainArea from "./components/MainArea.vue"
|
|
62
|
+
import SideBar from "./components/SideBar.vue"
|
|
63
|
+
|
|
64
|
+
@Options({
|
|
65
|
+
components: {
|
|
66
|
+
MainArea,
|
|
67
|
+
SideBar
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
|
+
export default
|
|
71
|
+
class App extends Vue {
|
|
72
|
+
constructor(props: object) {
|
|
73
|
+
super(props);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
onDidRef(ref: any) {
|
|
77
|
+
// 如果使用这种全局切换焦点的方式,请换一个唯一的函数名,防止二次集成时出现函数覆盖。
|
|
78
|
+
(this.$root as any).changeFocusInDemoSpace = (relativeName: String) => {
|
|
79
|
+
console.log('Change focus to: ' + relativeName)
|
|
80
|
+
ref.findBlockByName(relativeName).requestFocus()
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
onKeyDown(ev: any) {
|
|
85
|
+
// 有router时,是从DemoHomepage进入,回退,和本demo功能无关
|
|
86
|
+
// 8:Backspace, 27:Escape, 10000:盒子返回键
|
|
87
|
+
if(ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
88
|
+
console.log("Basic has this.$router: ", !!(this as any).$router);
|
|
89
|
+
(this as any).$router?.go(-1);
|
|
90
|
+
return true
|
|
91
|
+
}
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
</script>
|
|
96
|
+
|
|
97
|
+
<template>
|
|
98
|
+
<!-- 这里的jsv-focus-block只是为了获取到一个base focus节点,并不是必须的 -->
|
|
99
|
+
<jsv-focus-block :ref="onDidRef" :onKeyDown="onKeyDown">
|
|
100
|
+
<div class="title">可上下左右切换焦点</div>
|
|
101
|
+
<div class="body">
|
|
102
|
+
<MainArea :style="{left: 0}"/>
|
|
103
|
+
<SideBar :style="{left: 300}"/>
|
|
104
|
+
</div>
|
|
105
|
+
</jsv-focus-block>
|
|
106
|
+
</template>
|
|
107
|
+
|
|
108
|
+
<style scoped>
|
|
109
|
+
.title {
|
|
110
|
+
text-align: center;
|
|
111
|
+
font-size: 30px;
|
|
112
|
+
line-height: 50px;
|
|
113
|
+
color: #ffffff;
|
|
114
|
+
left: 100;
|
|
115
|
+
top: 50;
|
|
116
|
+
width: 400;
|
|
117
|
+
height: 50;
|
|
118
|
+
background-color: rgba(27,38,151,0.8);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.body {
|
|
122
|
+
left: 100;
|
|
123
|
+
top: 120;
|
|
124
|
+
}
|
|
125
125
|
</style>
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Options, Vue } from "vue-class-component";
|
|
3
|
-
|
|
4
|
-
@Options({
|
|
5
|
-
props: {
|
|
6
|
-
name: String,
|
|
7
|
-
style: { type:Object, default: {}},
|
|
8
|
-
onKeyDown: Function
|
|
9
|
-
},
|
|
10
|
-
})
|
|
11
|
-
export default
|
|
12
|
-
class BaseBlock extends Vue {
|
|
13
|
-
constructor(props: object) {
|
|
14
|
-
super(props);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
mounted() {
|
|
18
|
-
this.fullName = this.blockRef.getName();
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
private getActionCallback() {
|
|
22
|
-
const onAction = {
|
|
23
|
-
onKeyDown: this.onKeyDown,
|
|
24
|
-
onFocus: () => {
|
|
25
|
-
this.hasFocused = true;
|
|
26
|
-
},
|
|
27
|
-
onBlur: () => {
|
|
28
|
-
this.hasFocused = false;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return onAction;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
private onKeyDown?: Function = undefined;
|
|
36
|
-
private hasFocused: Boolean = false;
|
|
37
|
-
private fullName: String = "";
|
|
38
|
-
private readonly blockRef: any = null;
|
|
39
|
-
}
|
|
40
|
-
</script>
|
|
41
|
-
|
|
42
|
-
<template>
|
|
43
|
-
<jsv-focus-block ref="blockRef" :name="name" :onAction="getActionCallback()">
|
|
44
|
-
<div :style="{...$props.style,
|
|
45
|
-
width: 100, height: 100,
|
|
46
|
-
backgroundColor: (hasFocused ? 'rgba(255,0,0,1)' : 'rgba(0,255,0,1)')}"
|
|
47
|
-
>
|
|
48
|
-
{{ fullName }}
|
|
49
|
-
</div>
|
|
50
|
-
</jsv-focus-block>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Options, Vue } from "vue-class-component";
|
|
3
|
+
|
|
4
|
+
@Options({
|
|
5
|
+
props: {
|
|
6
|
+
name: String,
|
|
7
|
+
style: { type:Object, default: {}},
|
|
8
|
+
onKeyDown: Function
|
|
9
|
+
},
|
|
10
|
+
})
|
|
11
|
+
export default
|
|
12
|
+
class BaseBlock extends Vue {
|
|
13
|
+
constructor(props: object) {
|
|
14
|
+
super(props);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
mounted() {
|
|
18
|
+
this.fullName = this.blockRef.getName();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
private getActionCallback() {
|
|
22
|
+
const onAction = {
|
|
23
|
+
onKeyDown: this.onKeyDown,
|
|
24
|
+
onFocus: () => {
|
|
25
|
+
this.hasFocused = true;
|
|
26
|
+
},
|
|
27
|
+
onBlur: () => {
|
|
28
|
+
this.hasFocused = false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return onAction;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
private onKeyDown?: Function = undefined;
|
|
36
|
+
private hasFocused: Boolean = false;
|
|
37
|
+
private fullName: String = "";
|
|
38
|
+
private readonly blockRef: any = null;
|
|
39
|
+
}
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<template>
|
|
43
|
+
<jsv-focus-block ref="blockRef" :name="name" :onAction="getActionCallback()">
|
|
44
|
+
<div :style="{...$props.style,
|
|
45
|
+
width: 100, height: 100,
|
|
46
|
+
backgroundColor: (hasFocused ? 'rgba(255,0,0,1)' : 'rgba(0,255,0,1)')}"
|
|
47
|
+
>
|
|
48
|
+
{{ fullName }}
|
|
49
|
+
</div>
|
|
50
|
+
</jsv-focus-block>
|
|
51
51
|
</template>
|