@shijiu/jsview-vue 1.9.650 → 1.9.720
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/package.json +7 -18
- package/samples/AnimPicture/App.vue +5 -5
- package/samples/Basic/components/div/DivLayout.vue +1 -1
- package/samples/Basic/components/text/TextOverflow.vue +10 -5
- package/samples/BasicFocusControl/components/BaseBlock.vue +2 -2
- package/samples/Collision/App.vue +452 -0
- package/samples/DemoHomepage/components/BodyFrame.vue +2 -0
- package/samples/DemoHomepage/router.js +21 -1
- package/samples/DemoHomepage/views/Homepage.vue +3 -7
- package/samples/FilterDemo/App.vue +1 -1
- package/samples/FlipCard/App.vue +2 -2
- package/samples/FlipCard/FlipCard.vue +2 -2
- package/samples/GridDemo/App.vue +3 -3
- package/samples/GridDemo/ButtonBlock.vue +2 -2
- package/samples/GridDemo/FocusItem.vue +2 -2
- package/samples/GridDemo/Item.vue +1 -1
- package/samples/HashHistory/App.vue +10 -3
- package/samples/HashHistory/components/Item.vue +1 -1
- package/samples/ImpactStop/App.vue +435 -0
- package/samples/Input/App.vue +8 -17
- package/samples/Input/InputPanel.vue +19 -12
- package/samples/LongImage/Button.vue +1 -1
- package/samples/LongImage/ButtonItem.vue +1 -1
- package/samples/LongImage/LongImageScroll.vue +2 -2
- package/samples/LongText/App.vue +1 -1
- package/samples/LongText/Button.vue +1 -1
- package/samples/LongText/ButtonItem.vue +1 -1
- package/samples/LongText/LongTextScroll.vue +3 -3
- package/samples/Marquee/App.vue +176 -40
- package/samples/Marquee/longText.js +14 -0
- package/samples/MetroWidgetDemos/Advanced/App.vue +5 -6
- package/samples/MetroWidgetDemos/Advanced/ButtonItem.vue +3 -3
- package/samples/MetroWidgetDemos/Advanced/Buttons.vue +5 -5
- package/samples/MetroWidgetDemos/Advanced/Mixed.vue +4 -4
- package/samples/MetroWidgetDemos/Advanced/widgets/Item.vue +83 -0
- package/samples/MetroWidgetDemos/Advanced/widgets/WidgetItem.vue +89 -0
- package/samples/MetroWidgetDemos/Advanced/{Widgets.vue → widgets/Widgets.vue} +56 -11
- package/samples/MetroWidgetDemos/Advanced/widgets/focus1.png +0 -0
- package/samples/MetroWidgetDemos/Item.vue +20 -2
- package/samples/MetroWidgetDemos/PerformanceTest/App.vue +4 -4
- package/samples/MetroWidgetDemos/PerformanceTest/components/ContentItem.vue +1 -1
- package/samples/MetroWidgetDemos/PerformanceTest/components/MyTab.vue +1 -1
- package/samples/MetroWidgetDemos/PingPong/App.vue +3 -3
- package/samples/MetroWidgetDemos/PingPong/AppPage.vue +17 -2
- package/samples/MetroWidgetDemos/PingPong/AppTab.vue +3 -10
- package/samples/MetroWidgetDemos/PingPong/{Item.vue → TabItem.vue} +3 -11
- package/samples/MetroWidgetDemos/PingPong/ViewSwiper.vue +2 -2
- package/samples/MetroWidgetDemos/Simple/AbsoluteTemplate.vue +2 -2
- package/samples/MetroWidgetDemos/Simple/App.vue +2 -2
- package/samples/MetroWidgetDemos/Simple/RelativeTemplate.vue +6 -6
- package/samples/MetroWidgetDemos/WidgetItem.vue +2 -2
- package/samples/MetroWidgetDemos/data.js +2 -1
- package/samples/NinePatchDemo/App.vue +2 -2
- package/samples/NinePatchDemo/Item.vue +1 -1
- package/samples/Preload/App.vue +17 -12
- package/samples/Preload/Item.vue +1 -1
- package/samples/QrcodeDemo/App.vue +1 -1
- package/samples/ScaleDownNeon/App.vue +107 -0
- package/samples/SoundPool/App.vue +1 -1
- package/samples/TextBox/App.vue +9 -82
- package/samples/TextBox/RenderCenter.vue +40 -16
- package/samples/TextBox/RenderLeft.vue +48 -19
- package/samples/TextBox/RenderOneLine.vue +30 -49
- package/samples/TextBox/RenderRight.vue +40 -16
- package/samples/TextShadowDemo/App.vue +11 -17
- package/samples/TextureAnimation/App2.vue +43 -15
- package/samples/TextureAnimation/assets/light.png +0 -0
- package/samples/TextureAnimation/assets/light2.png +0 -0
- package/samples/TextureSize/App.vue +3 -3
- package/samples/TouchSample/MetroWidgetHorizontal.vue +1 -1
- package/samples/TouchSample/MetroWidgetVertical.vue +1 -1
- package/samples/TransitPage/App.vue +1 -1
- package/samples/VideoDemo/App.vue +8 -8
- package/samples/VideoDemo/components/Button.vue +1 -1
- package/samples/VisibleSensorDemo/App.vue +94 -27
- package/tsconfig.json +6 -6
- package/utils/JsViewEngineWidget/JsvFocusBlock.vue +55 -59
- package/utils/JsViewEngineWidget/JsvFocusManager.js +1 -1
- package/utils/JsViewEngineWidget/MetroWidget/Const.js +11 -0
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +226 -107
- package/utils/JsViewEngineWidget/TemplateParser.js +227 -178
- package/utils/JsViewEngineWidget/WidgetCommon.js +13 -5
- package/utils/JsViewEngineWidget/index.js +3 -2
- package/utils/JsViewPlugin/BrowserPluginLoader.js +1 -1
- package/utils/JsViewPlugin/JsvPlayer/JsvMedia.js +95 -12
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +23 -2
- package/utils/JsViewPlugin/JsvPlayer/JsvPlayerBrowser.vue +1 -1
- package/utils/JsViewPlugin/JsvPlayer/index.js +22 -1
- package/utils/JsViewPlugin/JsvPlayer/version.js +4 -4
- package/utils/JsViewVueTools/JsvImpactTracer.js +113 -0
- package/utils/JsViewVueTools/JsvStyleClass.js +1 -1
- package/utils/JsViewVueTools/index.js +2 -1
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserPreload.vue +11 -1
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserSpray.vue +1 -1
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserTextureAnim.vue +7 -9
- package/utils/JsViewVueWidget/JsvActorMove/ActorControlBase.js +1 -1
- package/utils/JsViewVueWidget/JsvActorMove/JsvActorMove.vue +3 -3
- package/utils/JsViewVueWidget/JsvActorMove/JsvActorMoveControl.js +1 -1
- package/utils/JsViewVueWidget/JsvApic/JsvApic.vue +5 -5
- package/utils/JsViewVueWidget/JsvFilterView.vue +1 -1
- package/utils/JsViewVueWidget/JsvGrid.vue +3 -11
- package/utils/JsViewVueWidget/JsvInput/Cursor.vue +5 -3
- package/utils/JsViewVueWidget/JsvInput/JsvInput.vue +15 -14
- package/utils/JsViewVueWidget/JsvMarquee.vue +180 -207
- package/utils/JsViewVueWidget/JsvMaskClipDiv.vue +2 -2
- package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +35 -27
- package/utils/JsViewVueWidget/JsvNinePatch.vue +1 -2
- package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +38 -42
- package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +1 -1
- package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +1 -1
- package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +24 -8
- package/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue +23 -3
- package/utils/JsViewVueWidget/JsvTextBox.vue +20 -86
- package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +2 -9
- package/utils/JsViewVueWidget/JsvTouchContainer.vue +6 -7
- package/utils/JsViewVueWidget/JsvTransparentDiv.vue +1 -1
- package/utils/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue +6 -6
- package/utils/JsViewVueWidget/index.js +8 -8
- package/utils/JsViewVueWidget/utils/index.js +8 -0
- package/utils/JsViewVueWidget/utils/text.js +19 -0
- package/dom/bin/jsview-browser-debug-dom.min.js +0 -1
- package/dom/bin/jsview-dom.min.js +0 -1
- package/dom/bin/jsview-forge-define.min.js +0 -1
- package/dom/browser-root-style.css +0 -21
- package/dom/jsv-browser-debug-dom.js +0 -8
- package/dom/jsv-dom.js +0 -6
- package/dom/jsv-forge-define.js +0 -6
- package/dom/target_core_revision.mjs +0 -15
- package/loader/header_script_loader.js +0 -134
- package/loader/jsview-main.js +0 -42
- package/loader/jsview.config.default.js +0 -37
- package/loader/jsview.default.config.js +0 -37
- package/loader/loader.js +0 -179
- package/loader/loader_webkit.js +0 -40
- package/patches/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +0 -17609
- package/patches/node_modules/@vue/compiler-sfc/dist/jsview-css-to-js.js +0 -335
- package/patches/node_modules/@vue/compiler-sfc/dist/jsview-style-format.js +0 -446
- package/patches/node_modules/@vue/compiler-sfc/dist/jsview-style-types.js +0 -91
- package/patches/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js +0 -8038
- package/patches/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js +0 -1700
- package/patches/node_modules/postcss-js/objectifier.js +0 -90
- package/patches/node_modules/vite/dist/node/chunks/dep-0fc8e132.js +0 -63147
- package/patches/node_modules/vite/dist/node/jsview.vite.config.js +0 -53
- package/patches/node_modules/vue-router/dist/vue-router.mjs +0 -3595
- package/scripts/common.js +0 -58
- package/scripts/jsview-install-local-packages.js +0 -73
- package/scripts/jsview-jsmap-serve.js +0 -105
- package/scripts/jsview-post-build.js +0 -183
- package/scripts/jsview-post-install.js +0 -102
- package/scripts/jsview-run-android.js +0 -67
- package/utils/JsViewEngineWidget/MetroPage.js +0 -2128
- package/utils/JsViewEngineWidget/SimpleWidget/ContentView.vue +0 -51
- package/utils/JsViewEngineWidget/SimpleWidget/Dispatcher.js +0 -19
- package/utils/JsViewEngineWidget/SimpleWidget/DivWrapper.vue +0 -53
- package/utils/JsViewEngineWidget/SimpleWidget/ItemView.vue +0 -142
- package/utils/JsViewEngineWidget/SimpleWidget/RootView.vue +0 -140
- package/utils/JsViewEngineWidget/SimpleWidget/SimpleWidget.vue +0 -1629
|
@@ -13,7 +13,7 @@ export class JsvFocusManager {
|
|
|
13
13
|
constructor() {}
|
|
14
14
|
|
|
15
15
|
install(app, ...options) {
|
|
16
|
-
|
|
16
|
+
console.log("JsvFocusManager install");
|
|
17
17
|
if (typeof options[0] !== "string") {
|
|
18
18
|
throw new Error(
|
|
19
19
|
"JsvFocusManager Error: 2nd argument is required. Such as: app.use(FocusManager, '#app')"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Author: ChenChanghua
|
|
3
3
|
* @Date: 2021-09-22 16:08:58
|
|
4
4
|
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime: 2022-
|
|
5
|
+
* @LastEditTime: 2022-11-24 10:28:17
|
|
6
6
|
* @Description: file content
|
|
7
7
|
-->
|
|
8
8
|
|
|
@@ -23,7 +23,13 @@
|
|
|
23
23
|
* name {string} 用于设置焦点的名称
|
|
24
24
|
* padding {object} 控件内边距, 默认为{left: 0, right: 0, top: 0, bottom: 0}
|
|
25
25
|
* direction {enum} (必选)控件方向 HORIZONTAL/VERTICAL
|
|
26
|
-
*
|
|
26
|
+
* focusMoveType {int} 焦点移动的模式, 可通过 | 运算进行组合
|
|
27
|
+
NO_ADJUST: 无特殊处理
|
|
28
|
+
COLUMN_LOOP: 到达列首/尾后跳转到上/下一列, 只在水平滚动时生效
|
|
29
|
+
ROW_LOOP: 到达行首/尾后跳转到上/下一行, 只在竖直滚动时生效
|
|
30
|
+
COLUMN_FIND_NEAR: 一列中没有下一个元素时是否跳转到相邻列
|
|
31
|
+
ROW_FIND_NEAR: 一行中没有下一个元素时是否跳转到相邻行
|
|
32
|
+
|
|
27
33
|
* initFocusId {int} 初始焦点,默认为0
|
|
28
34
|
* slideSetting {SlideSetting} 页面滑动的设置, 目前SlideSetting有三个子类, 具体见 WidgetCommon 中的说明
|
|
29
35
|
WholePageSlide
|
|
@@ -52,15 +58,16 @@
|
|
|
52
58
|
* @params item {object} data中的数据
|
|
53
59
|
* @return 模板信息,
|
|
54
60
|
{
|
|
55
|
-
left: 绝对布局时的left,
|
|
56
|
-
top: 绝对布局时的top,
|
|
57
|
-
width: item的宽,
|
|
58
|
-
height: item的高,
|
|
59
|
-
focusable: item是否可以获得焦点,
|
|
60
|
-
marginBottom: item的下方margin,
|
|
61
|
-
marginRight: item的右方margin,
|
|
62
|
-
findNextAnchor: 自定义上下左右四条边寻找临近item的基准位置,值为0-1 {left: 0.5, right: 0.5, top: 0.5, bottom: 0.5}
|
|
63
|
-
doSlide: item获得焦点时是否滚动, 一般用于嵌套的情景,
|
|
61
|
+
left {int}: 绝对布局时的left,
|
|
62
|
+
top {int}: 绝对布局时的top,
|
|
63
|
+
width {int}: item的宽,
|
|
64
|
+
height {int}: item的高,
|
|
65
|
+
focusable {boolean}: item是否可以获得焦点,
|
|
66
|
+
marginBottom {int}: item的下方margin,
|
|
67
|
+
marginRight {int}: item的右方margin,
|
|
68
|
+
findNextAnchor {object}: 自定义上下左右四条边寻找临近item的基准位置,值为0-1 {left: 0.5, right: 0.5, top: 0.5, bottom: 0.5}
|
|
69
|
+
doSlide {boolean}: item获得焦点时是否滚动, 一般用于嵌套的情景, 由内部组件控制滚动,
|
|
70
|
+
zIndex {int | object}: item的zIndex, 为object时可以分别设置{focus: 0, normal: 0}, 为number时则同时设置获焦和不获焦的zIndex
|
|
64
71
|
}
|
|
65
72
|
*
|
|
66
73
|
* onFocus {function} 控件获取焦点的回调
|
|
@@ -110,9 +117,25 @@
|
|
|
110
117
|
@params {int} id 焦点id
|
|
111
118
|
@params {boolean} needSlide 是否需要滚动
|
|
112
119
|
@params {boolean} doAnim 滚动时是否做动画
|
|
120
|
+
@params {object} extraSetting 额外的参数设置
|
|
121
|
+
{
|
|
122
|
+
lockChildSlideEvent: {boolean} 设置焦点时忽略子发过来的滚动事件
|
|
123
|
+
}
|
|
113
124
|
refreshData
|
|
114
125
|
@description 刷新数据, 只有存在provideData时才会生效
|
|
115
126
|
@params {boolean} forceUpdate 是否强制刷新
|
|
127
|
+
getVisibleItems
|
|
128
|
+
@description 获取可视item的列表信息
|
|
129
|
+
@return {start: 开始的index, end: 结束的index, dataList: 可视item的数据列表}
|
|
130
|
+
lock
|
|
131
|
+
@description 设置内部的锁
|
|
132
|
+
@params {int} type 锁的类型, 通过|来实现多个类型的复合
|
|
133
|
+
SLIDE: 滚动动画锁
|
|
134
|
+
CHILD_SLIDE_EVENT: 子组件发送的滚动事件锁
|
|
135
|
+
@return {function} 解锁的函数
|
|
136
|
+
unlock
|
|
137
|
+
@description 解锁
|
|
138
|
+
@params {int} type 参考lock的type参数
|
|
116
139
|
* 【技巧说明】
|
|
117
140
|
* Q: 插槽props如何使用?
|
|
118
141
|
* A: data: 当前item的数据
|
|
@@ -123,8 +146,6 @@
|
|
|
123
146
|
获取 item 相对 MetroWidget 左上角坐标
|
|
124
147
|
templatePosition: {Function} (index : int) => {left: 0, top: 0, width: 0, height: 0}
|
|
125
148
|
获取 item 的布局坐标, 一般用于自定义滚动
|
|
126
|
-
absolutePosition: {Function} (index : int) => {left: 0, top: 0, width: 0, height: 0}
|
|
127
|
-
获取 item 的绝对坐标, 一般用于控制焦点
|
|
128
149
|
getCurrentFocusId: {Function} () => {id: 0, index: 0}
|
|
129
150
|
获取当前焦点信息,id 为在可获得焦点元素列表中的索引,index 为在所有元素列表中的索引
|
|
130
151
|
slideTo: {Function} (targetPosition : int, doAnim : Boolean) => void
|
|
@@ -175,6 +196,7 @@ import { TemplateParser, TemplateItemAdder } from "../TemplateParser";
|
|
|
175
196
|
import { PageUpdater } from "./PageUpdater";
|
|
176
197
|
import { SingleRangeModel } from "../RangeModel";
|
|
177
198
|
import Dispatcher from "./Dispatcher";
|
|
199
|
+
import { METRO_WIDGET } from "./Const";
|
|
178
200
|
import {
|
|
179
201
|
EdgeDirection,
|
|
180
202
|
VERTICAL,
|
|
@@ -381,6 +403,10 @@ const props = defineProps({
|
|
|
381
403
|
onScroll: {
|
|
382
404
|
type: Function,
|
|
383
405
|
},
|
|
406
|
+
focusMoveType: {
|
|
407
|
+
type: Number,
|
|
408
|
+
default: 0,
|
|
409
|
+
},
|
|
384
410
|
});
|
|
385
411
|
|
|
386
412
|
let dataUpdateToken = ref(0);
|
|
@@ -407,8 +433,12 @@ let itemRender = ref(!props.enableItemRenderBreak);
|
|
|
407
433
|
let permanentItemList = [];
|
|
408
434
|
let preUpdateVisibleStart = 0;
|
|
409
435
|
let mounted = false;
|
|
410
|
-
let focusNode =
|
|
436
|
+
let focusNode = shallowRef(null);
|
|
411
437
|
let pageRange = vertical ? props.height : props.width;
|
|
438
|
+
|
|
439
|
+
let slideLock = false;
|
|
440
|
+
let childSlideEventLock = false;
|
|
441
|
+
|
|
412
442
|
let visibleInfo = {
|
|
413
443
|
_start: 0,
|
|
414
444
|
range: 0,
|
|
@@ -444,8 +474,8 @@ let visibleInfo = {
|
|
|
444
474
|
},
|
|
445
475
|
};
|
|
446
476
|
|
|
447
|
-
let locateDiv =
|
|
448
|
-
let slideDiv =
|
|
477
|
+
let locateDiv = shallowRef(null);
|
|
478
|
+
let slideDiv = shallowRef(null);
|
|
449
479
|
let renderData = shallowRef([]);
|
|
450
480
|
let slideDivLeft = ref(0);
|
|
451
481
|
let slideDivTop = ref(0);
|
|
@@ -463,7 +493,7 @@ const _onFocusChange = (id) => {
|
|
|
463
493
|
const _getCurrentId = () => {
|
|
464
494
|
return {
|
|
465
495
|
id: focusId,
|
|
466
|
-
index: templateParser.
|
|
496
|
+
index: templateParser.IdToIndex(focusId),
|
|
467
497
|
};
|
|
468
498
|
};
|
|
469
499
|
|
|
@@ -489,10 +519,6 @@ const _getTemplatePosition = (index) => {
|
|
|
489
519
|
};
|
|
490
520
|
};
|
|
491
521
|
|
|
492
|
-
const _getAbsolutePosition = (index, targetEle) => {
|
|
493
|
-
return getPositionRelativeToView(innerData[index].itemDivRef, targetEle);
|
|
494
|
-
};
|
|
495
|
-
|
|
496
522
|
const _dispatchEvent = (event) => {
|
|
497
523
|
switch (event.type) {
|
|
498
524
|
case Dispatcher.Type.setEnterFocusId:
|
|
@@ -539,12 +565,21 @@ const onItemFocus = (index, rect) => {
|
|
|
539
565
|
}
|
|
540
566
|
};
|
|
541
567
|
|
|
542
|
-
const setFocusId = (id, needSlide = true, doAnim = false) => {
|
|
568
|
+
const setFocusId = (id, needSlide = true, doAnim = false, extraSetting) => {
|
|
569
|
+
if (id == focusId) {
|
|
570
|
+
return;
|
|
571
|
+
}
|
|
543
572
|
templateItemAdder.tryAddItemById(id);
|
|
544
573
|
let next_focus_item = templateParser.GetItemById(id);
|
|
545
574
|
if (next_focus_item) {
|
|
546
575
|
if (needSlide) {
|
|
547
|
-
slideToItem(templateParser.
|
|
576
|
+
slideToItem(templateParser.IdToIndex(id), doAnim);
|
|
577
|
+
}
|
|
578
|
+
let unlock = null;
|
|
579
|
+
if (extraSetting) {
|
|
580
|
+
if (extraSetting.lockChildSlideEvent) {
|
|
581
|
+
unlock = lock(METRO_WIDGET.CHILD_SLIDE_EVENT);
|
|
582
|
+
}
|
|
548
583
|
}
|
|
549
584
|
|
|
550
585
|
const cur_focus_item = templateParser.GetItemById(focusId);
|
|
@@ -564,8 +599,39 @@ const setFocusId = (id, needSlide = true, doAnim = false) => {
|
|
|
564
599
|
};
|
|
565
600
|
_updateBlurItem();
|
|
566
601
|
_updateFocusItem();
|
|
567
|
-
onItemBlur(templateParser.
|
|
568
|
-
onItemFocus(templateParser.
|
|
602
|
+
onItemBlur(templateParser.IdToIndex(preFocusId));
|
|
603
|
+
onItemFocus(templateParser.IdToIndex(focusId), preEdgeRect);
|
|
604
|
+
unlock?.();
|
|
605
|
+
}
|
|
606
|
+
};
|
|
607
|
+
|
|
608
|
+
const lock = (type) => {
|
|
609
|
+
const unlocker = [];
|
|
610
|
+
if (type & METRO_WIDGET.SLIDE) {
|
|
611
|
+
slideLock = true;
|
|
612
|
+
unlocker.push(() => {
|
|
613
|
+
slideLock = false;
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
if (type & METRO_WIDGET.CHILD_SLIDE_EVENT) {
|
|
617
|
+
childSlideEventLock = true;
|
|
618
|
+
unlocker.push(() => {
|
|
619
|
+
childSlideEventLock = false;
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
return () => {
|
|
623
|
+
unlocker.map((item) => {
|
|
624
|
+
item();
|
|
625
|
+
});
|
|
626
|
+
};
|
|
627
|
+
};
|
|
628
|
+
|
|
629
|
+
const unlock = (type) => {
|
|
630
|
+
if (type & METRO_WIDGET.SLIDE) {
|
|
631
|
+
slideLock = true;
|
|
632
|
+
}
|
|
633
|
+
if (type & METRO_WIDGET.CHILD_SLIDE_EVENT) {
|
|
634
|
+
childSlideEventLock = true;
|
|
569
635
|
}
|
|
570
636
|
};
|
|
571
637
|
|
|
@@ -693,7 +759,8 @@ const refreshData = (force_update) => {
|
|
|
693
759
|
dataList,
|
|
694
760
|
props.measures,
|
|
695
761
|
pageRange,
|
|
696
|
-
_onTemplateAdd
|
|
762
|
+
_onTemplateAdd,
|
|
763
|
+
props.name
|
|
697
764
|
);
|
|
698
765
|
}
|
|
699
766
|
if (need_update_content) {
|
|
@@ -740,7 +807,7 @@ const refreshData = (force_update) => {
|
|
|
740
807
|
dataUpdateToken.value++;
|
|
741
808
|
pageUpdater.apply();
|
|
742
809
|
_updateFocusItem();
|
|
743
|
-
onItemFocus(templateParser.
|
|
810
|
+
onItemFocus(templateParser.IdToIndex(focusId), null);
|
|
744
811
|
if (needSlide) {
|
|
745
812
|
_slideTo(visibleInfo.start, null);
|
|
746
813
|
} else if (need_update_content) {
|
|
@@ -748,7 +815,24 @@ const refreshData = (force_update) => {
|
|
|
748
815
|
}
|
|
749
816
|
};
|
|
750
817
|
|
|
818
|
+
const getVisibleItems = () => {
|
|
819
|
+
const info = templateParser.GetVisibleItemList(
|
|
820
|
+
visibleInfo.startWithPadding,
|
|
821
|
+
visibleInfo.endWithPadding,
|
|
822
|
+
focusId,
|
|
823
|
+
false,
|
|
824
|
+
null
|
|
825
|
+
);
|
|
826
|
+
return {
|
|
827
|
+
start: info.visibleStart,
|
|
828
|
+
end: info.visibleEnd,
|
|
829
|
+
dataList: dataList.slice(info.visibleStart, info.visibleEnd + 1),
|
|
830
|
+
};
|
|
831
|
+
};
|
|
832
|
+
|
|
751
833
|
const exportObject = {
|
|
834
|
+
lock,
|
|
835
|
+
unlock,
|
|
752
836
|
slideTo,
|
|
753
837
|
setFocusId,
|
|
754
838
|
getFocusBlockRef,
|
|
@@ -757,7 +841,7 @@ const exportObject = {
|
|
|
757
841
|
slideToItem,
|
|
758
842
|
refreshData,
|
|
759
843
|
_dispatchEvent,
|
|
760
|
-
|
|
844
|
+
getVisibleItems,
|
|
761
845
|
};
|
|
762
846
|
|
|
763
847
|
const _calculateNearestItemByRect = (visible_range, enter_rect_info) => {
|
|
@@ -979,7 +1063,7 @@ const onKeyDown = (ev) => {
|
|
|
979
1063
|
_moveToNext(horizontal_direction, vertical_direction);
|
|
980
1064
|
break;
|
|
981
1065
|
case 13:
|
|
982
|
-
onItemClick(templateParser.
|
|
1066
|
+
onItemClick(templateParser.IdToIndex(focusId));
|
|
983
1067
|
break;
|
|
984
1068
|
default:
|
|
985
1069
|
//只接受上下左右确定键
|
|
@@ -1001,7 +1085,7 @@ const _onTemplateAdd = (item) => {
|
|
|
1001
1085
|
data: item,
|
|
1002
1086
|
index: innerData.length,
|
|
1003
1087
|
controller: reactive({
|
|
1004
|
-
zIndex: 0,
|
|
1088
|
+
zIndex: item.normalZIndex >= 0 ? item.normalZIndex : 0,
|
|
1005
1089
|
}),
|
|
1006
1090
|
mounted: false,
|
|
1007
1091
|
itemDivRef: null,
|
|
@@ -1019,7 +1103,7 @@ const _onTemplateAdd = (item) => {
|
|
|
1019
1103
|
this.slotMounted.value = true;
|
|
1020
1104
|
if (callFocusAfterUpdate && this.data.id === focusId) {
|
|
1021
1105
|
nextTick(() => {
|
|
1022
|
-
onItemFocus(templateParser.
|
|
1106
|
+
onItemFocus(templateParser.IdToIndex(focusId), preEdgeRect);
|
|
1023
1107
|
});
|
|
1024
1108
|
callFocusAfterUpdate = false;
|
|
1025
1109
|
}
|
|
@@ -1059,7 +1143,6 @@ const _onTemplateAdd = (item) => {
|
|
|
1059
1143
|
index: item.index,
|
|
1060
1144
|
position: _getPosition,
|
|
1061
1145
|
templatePosition: _getTemplatePosition,
|
|
1062
|
-
absolutePosition: _getAbsolutePosition,
|
|
1063
1146
|
getCurrentFocusId: _getCurrentId,
|
|
1064
1147
|
slideTo: slideTo,
|
|
1065
1148
|
},
|
|
@@ -1094,6 +1177,9 @@ const _itemOnFocusSideEffect = (item, edgeRect) => {
|
|
|
1094
1177
|
|
|
1095
1178
|
const _onCustomerEvent = (ev) => {
|
|
1096
1179
|
if (ev.type === "focusRect") {
|
|
1180
|
+
if (childSlideEventLock) {
|
|
1181
|
+
return true;
|
|
1182
|
+
}
|
|
1097
1183
|
if (ev.ownerNode == exportObject) {
|
|
1098
1184
|
return false;
|
|
1099
1185
|
}
|
|
@@ -1122,7 +1208,7 @@ const _onCustomerEvent = (ev) => {
|
|
|
1122
1208
|
yPos: item_layout.top,
|
|
1123
1209
|
width: item_layout.width,
|
|
1124
1210
|
height: item_layout.height,
|
|
1125
|
-
index: templateParser.
|
|
1211
|
+
index: templateParser.IdToIndex(focusId),
|
|
1126
1212
|
};
|
|
1127
1213
|
|
|
1128
1214
|
let cur_slide = _calculateVisibleStart(obj, direction);
|
|
@@ -1168,15 +1254,14 @@ const _moveToNext = (
|
|
|
1168
1254
|
item_edge_rect
|
|
1169
1255
|
) => {
|
|
1170
1256
|
let cur_focus_item = templateParser.GetItemById(focusId);
|
|
1171
|
-
let
|
|
1257
|
+
let next_focus_item = templateParser.GetNextItem(
|
|
1172
1258
|
focusId,
|
|
1173
1259
|
vertical_direction,
|
|
1174
1260
|
horizontal_direction,
|
|
1175
|
-
props.
|
|
1261
|
+
props.focusMoveType
|
|
1176
1262
|
);
|
|
1177
|
-
if (
|
|
1263
|
+
if (next_focus_item !== null) {
|
|
1178
1264
|
preFocusId = focusId;
|
|
1179
|
-
let next_focus_item = templateParser.GetItemById(next_item_id);
|
|
1180
1265
|
templateItemAdder.tryAddItem(next_focus_item, 1);
|
|
1181
1266
|
focusId = next_focus_item.id;
|
|
1182
1267
|
|
|
@@ -1185,8 +1270,7 @@ const _moveToNext = (
|
|
|
1185
1270
|
|
|
1186
1271
|
let cur_visible_start = _calculateVisibleStart(next_focus_item, direction);
|
|
1187
1272
|
if (
|
|
1188
|
-
!innerData[templateParser.
|
|
1189
|
-
?.takeOverSlide &&
|
|
1273
|
+
!innerData[templateParser.IdToIndex(focusId)].itemConfig?.takeOverSlide &&
|
|
1190
1274
|
visibleInfo.start !== cur_visible_start
|
|
1191
1275
|
) {
|
|
1192
1276
|
if (next_focus_item.doSlide) {
|
|
@@ -1198,21 +1282,31 @@ const _moveToNext = (
|
|
|
1198
1282
|
onend: _onSlideEnd,
|
|
1199
1283
|
};
|
|
1200
1284
|
_slideTo(visibleInfo.start, animObj);
|
|
1285
|
+
pageUpdater.update(
|
|
1286
|
+
templateParser,
|
|
1287
|
+
visibleInfo.startWithPadding - props.keepTraceRange * pageRange,
|
|
1288
|
+
Math.min(
|
|
1289
|
+
visibleInfo.startMax +
|
|
1290
|
+
visibleInfo.range +
|
|
1291
|
+
visibleInfo.padding.end -
|
|
1292
|
+
1,
|
|
1293
|
+
visibleInfo.endWithPadding + props.keepTraceRange * pageRange
|
|
1294
|
+
),
|
|
1295
|
+
next_focus_item.id,
|
|
1296
|
+
false,
|
|
1297
|
+
permanentItemList
|
|
1298
|
+
);
|
|
1299
|
+
} else {
|
|
1300
|
+
//不做滚动时,保证获焦的item创建
|
|
1301
|
+
pageUpdater.update(
|
|
1302
|
+
templateParser,
|
|
1303
|
+
cur_visible_start,
|
|
1304
|
+
cur_visible_start + visibleInfo.range + visibleInfo.padding.end - 1,
|
|
1305
|
+
next_focus_item.id,
|
|
1306
|
+
false,
|
|
1307
|
+
permanentItemList
|
|
1308
|
+
);
|
|
1201
1309
|
}
|
|
1202
|
-
pageUpdater.update(
|
|
1203
|
-
templateParser,
|
|
1204
|
-
visibleInfo.startWithPadding - props.keepTraceRange * pageRange,
|
|
1205
|
-
Math.min(
|
|
1206
|
-
visibleInfo.startMax +
|
|
1207
|
-
visibleInfo.range +
|
|
1208
|
-
visibleInfo.padding.end -
|
|
1209
|
-
1,
|
|
1210
|
-
visibleInfo.endWithPadding + props.keepTraceRange * pageRange
|
|
1211
|
-
),
|
|
1212
|
-
next_item_id,
|
|
1213
|
-
false,
|
|
1214
|
-
permanentItemList
|
|
1215
|
-
);
|
|
1216
1310
|
pageUpdater.applyTmp();
|
|
1217
1311
|
}
|
|
1218
1312
|
|
|
@@ -1247,8 +1341,8 @@ const _moveToNext = (
|
|
|
1247
1341
|
preEdgeRect = rect;
|
|
1248
1342
|
_updateBlurItem();
|
|
1249
1343
|
_updateFocusItem();
|
|
1250
|
-
onItemBlur(templateParser.
|
|
1251
|
-
onItemFocus(templateParser.
|
|
1344
|
+
onItemBlur(templateParser.IdToIndex(preFocusId));
|
|
1345
|
+
onItemFocus(templateParser.IdToIndex(focusId), preEdgeRect);
|
|
1252
1346
|
} else {
|
|
1253
1347
|
let x_off_set = props.direction === VERTICAL ? 0 : visibleInfo.start;
|
|
1254
1348
|
let y_off_set = props.direction === VERTICAL ? visibleInfo.start : 0;
|
|
@@ -1272,7 +1366,7 @@ const _moveToNext = (
|
|
|
1272
1366
|
height: cur_focus_item.height,
|
|
1273
1367
|
};
|
|
1274
1368
|
props.onEdge?.({ direction: edge, rect: rect });
|
|
1275
|
-
innerData[templateParser.
|
|
1369
|
+
innerData[templateParser.IdToIndex(focusId)].callbacks.onWidgetEdge?.({
|
|
1276
1370
|
direction: edge,
|
|
1277
1371
|
});
|
|
1278
1372
|
}
|
|
@@ -1303,40 +1397,50 @@ const _calculateVisibleStart = (target_item, direction) => {
|
|
|
1303
1397
|
];
|
|
1304
1398
|
break;
|
|
1305
1399
|
case SlideSetting.Type.SEAMLESS:
|
|
1306
|
-
if (
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
target_item[size_key] -
|
|
1314
|
-
visibleInfo.range * props.slideSetting.EndPercent;
|
|
1315
|
-
}
|
|
1316
|
-
} else if (direction < 0) {
|
|
1317
|
-
if (
|
|
1318
|
-
target_item[pos_key] <
|
|
1319
|
-
visibleInfo.start +
|
|
1320
|
-
visibleInfo.range * props.slideSetting.StartPercent
|
|
1321
|
-
) {
|
|
1322
|
-
new_visible_start =
|
|
1323
|
-
target_item[pos_key] -
|
|
1324
|
-
visibleInfo.range * props.slideSetting.StartPercent;
|
|
1325
|
-
}
|
|
1400
|
+
if (
|
|
1401
|
+
target_item[size_key] >=
|
|
1402
|
+
visibleInfo.range *
|
|
1403
|
+
(props.slideSetting.EndPercent - props.slideSetting.StartPercent)
|
|
1404
|
+
) {
|
|
1405
|
+
//尺寸较大的item
|
|
1406
|
+
new_visible_start = target_item[center_key] - visibleInfo.range * 0.5;
|
|
1326
1407
|
} else {
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1408
|
+
if (direction > 0) {
|
|
1409
|
+
if (
|
|
1410
|
+
target_item[pos_key] + target_item[size_key] >
|
|
1411
|
+
visibleInfo.start +
|
|
1412
|
+
visibleInfo.range * props.slideSetting.EndPercent
|
|
1413
|
+
) {
|
|
1414
|
+
new_visible_start =
|
|
1415
|
+
target_item[pos_key] +
|
|
1416
|
+
target_item[size_key] -
|
|
1417
|
+
visibleInfo.range * props.slideSetting.EndPercent;
|
|
1418
|
+
}
|
|
1419
|
+
} else if (direction < 0) {
|
|
1420
|
+
if (
|
|
1421
|
+
target_item[pos_key] <
|
|
1422
|
+
visibleInfo.start +
|
|
1423
|
+
visibleInfo.range * props.slideSetting.StartPercent
|
|
1424
|
+
) {
|
|
1425
|
+
new_visible_start =
|
|
1426
|
+
target_item[pos_key] -
|
|
1427
|
+
visibleInfo.range * props.slideSetting.StartPercent;
|
|
1428
|
+
}
|
|
1429
|
+
} else {
|
|
1430
|
+
//不是沿widget方向的移动
|
|
1431
|
+
if (target_item[pos_key] < visibleInfo.start) {
|
|
1432
|
+
new_visible_start =
|
|
1433
|
+
target_item[pos_key] -
|
|
1434
|
+
visibleInfo.range * props.slideSetting.StartPercent;
|
|
1435
|
+
} else if (
|
|
1436
|
+
target_item[pos_key] + target_item[size_key] >
|
|
1437
|
+
visibleInfo.end
|
|
1438
|
+
) {
|
|
1439
|
+
new_visible_start =
|
|
1440
|
+
target_item[pos_key] +
|
|
1441
|
+
target_item[size_key] -
|
|
1442
|
+
visibleInfo.range * props.slideSetting.EndPercent;
|
|
1443
|
+
}
|
|
1340
1444
|
}
|
|
1341
1445
|
}
|
|
1342
1446
|
break;
|
|
@@ -1403,9 +1507,16 @@ const _ifValidEnterRect = (rect_info) => {
|
|
|
1403
1507
|
return rect_info && rect_info.direction && rect_info.rect;
|
|
1404
1508
|
};
|
|
1405
1509
|
|
|
1406
|
-
const _setZIndex = (index, z_index) => {
|
|
1510
|
+
const _setZIndex = (index, z_index, is_focus) => {
|
|
1407
1511
|
if (innerData[index]) {
|
|
1408
|
-
innerData[index].
|
|
1512
|
+
let data = innerData[index].data,
|
|
1513
|
+
i = z_index;
|
|
1514
|
+
if (is_focus && data.focusZIndex >= 0) {
|
|
1515
|
+
i = data.focusZIndex;
|
|
1516
|
+
} else if (data.normalZIndex >= 0) {
|
|
1517
|
+
i = data.normalZIndex;
|
|
1518
|
+
}
|
|
1519
|
+
innerData[index].controller.zIndex = i;
|
|
1409
1520
|
}
|
|
1410
1521
|
};
|
|
1411
1522
|
|
|
@@ -1430,7 +1541,7 @@ const _onFocus = (params) => {
|
|
|
1430
1541
|
enterFocusId = -1;
|
|
1431
1542
|
enterFocusRect = null;
|
|
1432
1543
|
_updateFocusItem();
|
|
1433
|
-
onItemFocus(templateParser.
|
|
1544
|
+
onItemFocus(templateParser.IdToIndex(focusId), preEdgeRect);
|
|
1434
1545
|
props.onFocus?.();
|
|
1435
1546
|
};
|
|
1436
1547
|
|
|
@@ -1444,7 +1555,7 @@ const _onBlur = () => {
|
|
|
1444
1555
|
}
|
|
1445
1556
|
preFocusId = focusId;
|
|
1446
1557
|
_updateBlurItem();
|
|
1447
|
-
innerData[templateParser.
|
|
1558
|
+
innerData[templateParser.IdToIndex(preFocusId)].callbacks.onBlur();
|
|
1448
1559
|
|
|
1449
1560
|
props.onBlur?.();
|
|
1450
1561
|
};
|
|
@@ -1457,11 +1568,11 @@ const _onSlideEnd = (event) => {
|
|
|
1457
1568
|
};
|
|
1458
1569
|
|
|
1459
1570
|
const _updateFocusItem = () => {
|
|
1460
|
-
_setZIndex(templateParser.
|
|
1571
|
+
_setZIndex(templateParser.IdToIndex(focusId), innerData.length, true);
|
|
1461
1572
|
};
|
|
1462
1573
|
|
|
1463
1574
|
const _updateBlurItem = () => {
|
|
1464
|
-
_setZIndex(templateParser.
|
|
1575
|
+
_setZIndex(templateParser.IdToIndex(preFocusId), 0, false);
|
|
1465
1576
|
};
|
|
1466
1577
|
|
|
1467
1578
|
const _updateFocusByDragInfo = (viewX, viewY) => {
|
|
@@ -1607,21 +1718,23 @@ const _onScroll = () => {
|
|
|
1607
1718
|
|
|
1608
1719
|
//之前rootview相关的代码
|
|
1609
1720
|
const _updatePosition = (x, y, anim_info) => {
|
|
1721
|
+
if (slideLock) return;
|
|
1610
1722
|
if (toRaw(slideDiv.value)) {
|
|
1611
|
-
let
|
|
1723
|
+
let pre_left = toRaw(slideDiv.value).style.left,
|
|
1724
|
+
pre_top = toRaw(slideDiv.value).style.top;
|
|
1612
1725
|
//jsvMaskView的位置更新时会被设置位0,因此不能通过ResetLayoutParams设置位置
|
|
1613
1726
|
slideDivLeft.value = x;
|
|
1614
1727
|
slideDivTop.value = y;
|
|
1615
1728
|
if (anim_info) {
|
|
1616
|
-
let delta_x = Math.abs(
|
|
1617
|
-
let delta_y = Math.abs(
|
|
1729
|
+
let delta_x = Math.abs(pre_left - x);
|
|
1730
|
+
let delta_y = Math.abs(pre_top - y);
|
|
1618
1731
|
let duration = Math.round(
|
|
1619
1732
|
delta_x === 0 ? delta_y / anim_info.speed : delta_x / anim_info.speed
|
|
1620
1733
|
);
|
|
1621
1734
|
let slide_animation = new Forge.TranslateAnimation(
|
|
1622
|
-
|
|
1735
|
+
pre_left - x,
|
|
1623
1736
|
0,
|
|
1624
|
-
|
|
1737
|
+
pre_top - y,
|
|
1625
1738
|
0,
|
|
1626
1739
|
duration,
|
|
1627
1740
|
anim_info.easing
|
|
@@ -1629,7 +1742,9 @@ const _updatePosition = (x, y, anim_info) => {
|
|
|
1629
1742
|
slide_animation.SetAnimationListener(
|
|
1630
1743
|
new Forge.AnimationListener(anim_info.onstart, anim_info.onend, null)
|
|
1631
1744
|
);
|
|
1632
|
-
toRaw(slideDiv.value)
|
|
1745
|
+
toRaw(slideDiv.value)
|
|
1746
|
+
.jsvGetProxyView(true)
|
|
1747
|
+
.StartAnimation(slide_animation);
|
|
1633
1748
|
}
|
|
1634
1749
|
_onScroll();
|
|
1635
1750
|
}
|
|
@@ -1637,7 +1752,7 @@ const _updatePosition = (x, y, anim_info) => {
|
|
|
1637
1752
|
|
|
1638
1753
|
const _initRootTouch = () => {
|
|
1639
1754
|
if (props.enableTouch && toRaw(slideDiv.value)) {
|
|
1640
|
-
let view = toRaw(slideDiv.value).
|
|
1755
|
+
let view = toRaw(slideDiv.value).jsvGetProxyView(true);
|
|
1641
1756
|
var drag_setting = new Forge.DragSetting(
|
|
1642
1757
|
dragDirection,
|
|
1643
1758
|
20,
|
|
@@ -1654,7 +1769,7 @@ const _initItemViewTouch = (itemDivRef, index) => {
|
|
|
1654
1769
|
if (props.enableTouch) {
|
|
1655
1770
|
if (itemDivRef) {
|
|
1656
1771
|
// 为view添加触控处理
|
|
1657
|
-
let view = itemDivRef.
|
|
1772
|
+
let view = itemDivRef.jsvGetProxyView(true);
|
|
1658
1773
|
let dragSetting = new Forge.DragSetting(
|
|
1659
1774
|
Forge.DragSetting.DIRECTION_DISABLE,
|
|
1660
1775
|
20,
|
|
@@ -1703,12 +1818,14 @@ templateParser = _getTemplateParser(
|
|
|
1703
1818
|
props.supportHistoryPath,
|
|
1704
1819
|
props.layoutType
|
|
1705
1820
|
);
|
|
1821
|
+
|
|
1706
1822
|
templateItemAdder = new TemplateItemAdder(
|
|
1707
1823
|
templateParser,
|
|
1708
1824
|
dataList,
|
|
1709
1825
|
props.measures,
|
|
1710
1826
|
pageRange,
|
|
1711
|
-
_onTemplateAdd
|
|
1827
|
+
_onTemplateAdd,
|
|
1828
|
+
props.name
|
|
1712
1829
|
);
|
|
1713
1830
|
if (props.onScroll) {
|
|
1714
1831
|
templateItemAdder.tryAddItemByIndex(dataList.length - 1);
|
|
@@ -1740,12 +1857,14 @@ slidePile = new Forge.RectArea(
|
|
|
1740
1857
|
let init_focus_id = 0;
|
|
1741
1858
|
let cur_visible_start = 0;
|
|
1742
1859
|
|
|
1743
|
-
if (props.initFocusId) {
|
|
1860
|
+
if (typeof props.initFocusId == "number") {
|
|
1744
1861
|
templateItemAdder.tryAddItemById(props.initFocusId);
|
|
1745
1862
|
const item = templateParser.GetItemById(props.initFocusId);
|
|
1746
1863
|
if (item) {
|
|
1747
1864
|
init_focus_id = props.initFocusId;
|
|
1748
|
-
|
|
1865
|
+
if (item.doSlide) {
|
|
1866
|
+
cur_visible_start = _calculateVisibleStart(item, 1);
|
|
1867
|
+
}
|
|
1749
1868
|
}
|
|
1750
1869
|
}
|
|
1751
1870
|
focusId = init_focus_id;
|
|
@@ -1776,7 +1895,7 @@ onMounted(() => {
|
|
|
1776
1895
|
_slideTo(visibleInfo.start, null);
|
|
1777
1896
|
}
|
|
1778
1897
|
|
|
1779
|
-
onItemFocus(templateParser.
|
|
1898
|
+
onItemFocus(templateParser.IdToIndex(focusId), preEdgeRect);
|
|
1780
1899
|
|
|
1781
1900
|
if (props.enableItemRenderBreak) {
|
|
1782
1901
|
nextTick(() => {
|