@shijiu/jsview-vue 0.9.766 → 0.9.783
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/package.json +1 -1
- package/samples/DemoHomepage/App.vue +30 -6
- package/samples/DemoHomepage/components/TabFrame.vue +7 -0
- package/samples/DemoHomepage/router.js +16 -18
- package/samples/DemoHomepage/views/Homepage.vue +5 -1
- package/samples/FocusBlockDemos/AutoFocus/App.vue +51 -0
- package/samples/FocusBlockDemos/AutoFocus/BaseBlock.vue +82 -0
- package/samples/FocusBlockDemos/AutoFocus/DialogBlock.vue +89 -0
- package/samples/FocusBlockDemos/AutoFocus/DialogContorls.js +42 -0
- package/samples/FocusBlockDemos/AutoFocus/FocusNamesDefine.js +9 -0
- package/samples/FocusBlockDemos/AutoFocus/PlaneBlock.vue +71 -0
- package/samples/FocusBlockDemos/ProgressiveFocusControl/App.vue +78 -0
- package/samples/FocusBlockDemos/ProgressiveFocusControl/BaseBlock.vue +77 -0
- package/samples/FocusBlockDemos/ProgressiveFocusControl/DownPlaneBlock.vue +83 -0
- package/samples/FocusBlockDemos/ProgressiveFocusControl/FocusNamesDefine.js +12 -0
- package/samples/FocusBlockDemos/ProgressiveFocusControl/UpPlaneBlock.vue +83 -0
- package/samples/Marquee/App.vue +34 -3
- package/samples/MetroWidgetDemos/PingPong/App.vue +22 -11
- package/samples/MetroWidgetDemos/PingPong/AppPage.vue +3 -3
- package/samples/MetroWidgetDemos/{Item.vue → PingPong/Item.vue} +1 -3
- package/samples/MetroWidgetDemos/PingPong/ViewSwiper.vue +3 -3
- package/samples/MetroWidgetDemos/{WidgetItem.vue → PingPong/WidgetItem.vue} +6 -1
- package/samples/MetroWidgetDemos/basic/App.vue +162 -0
- package/samples/MetroWidgetDemos/basic/Item.vue +43 -0
- package/samples/MetroWidgetDemos/direction/App.vue +158 -0
- package/samples/MetroWidgetDemos/direction/Item.vue +45 -0
- package/samples/MetroWidgetDemos/focusableItemBasic/App.vue +67 -0
- package/samples/MetroWidgetDemos/{Advanced → focusableItemBasic}/ButtonItem.vue +16 -20
- package/samples/MetroWidgetDemos/focusableItemMetroWidget/App.vue +74 -0
- package/samples/MetroWidgetDemos/{Advanced/widgets → focusableItemMetroWidget}/Item.vue +12 -30
- package/samples/MetroWidgetDemos/{Advanced/widgets → focusableItemMetroWidget}/WidgetItem.vue +10 -9
- package/samples/MetroWidgetDemos/focusableItemMix/App.vue +88 -0
- package/samples/MetroWidgetDemos/focusableItemMix/ButtonItem.vue +86 -0
- package/samples/MetroWidgetDemos/focusableItemMix/Item.vue +43 -0
- package/samples/MetroWidgetDemos/index.js +6 -0
- package/samples/MetroWidgetDemos/layoutType/App.vue +180 -0
- package/samples/MetroWidgetDemos/layoutType/Item.vue +45 -0
- package/samples/MetroWidgetDemos/padding/App.vue +222 -0
- package/samples/MetroWidgetDemos/padding/Item.vue +64 -0
- package/samples/MetroWidgetDemos/routeList.js +64 -0
- package/samples/MetroWidgetDemos/slideSetting/App.vue +225 -0
- package/samples/MetroWidgetDemos/slideSetting/Item.vue +45 -0
- package/samples/NinePatchDemo/App.vue +78 -122
- package/samples/NinePatchDemo/Item.vue +28 -26
- package/samples/Swiper/App.vue +148 -0
- package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +15 -12
- package/utils/JsViewEngineWidget/TemplateParser.js +6 -1
- package/utils/JsViewPlugin/JsvPlayer/version.js +4 -4
- package/utils/JsViewVueTools/JsvTextTools.js +24 -3
- package/utils/JsViewVueWidget/JsvMarquee.vue +81 -20
- package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +115 -79
- package/utils/JsViewVueWidget/JsvSwiper/index.js +3 -2
- package/samples/MetroWidgetDemos/Advanced/App.vue +0 -46
- package/samples/MetroWidgetDemos/Advanced/Buttons.vue +0 -70
- package/samples/MetroWidgetDemos/Advanced/Mixed.vue +0 -77
- package/samples/MetroWidgetDemos/Advanced/widgets/Widgets.vue +0 -116
- package/samples/MetroWidgetDemos/Advanced/widgets/focus1.png +0 -0
- package/samples/MetroWidgetDemos/Simple/AbsoluteTemplate.vue +0 -75
- package/samples/MetroWidgetDemos/Simple/App.vue +0 -45
- package/samples/MetroWidgetDemos/Simple/RelativeTemplate.vue +0 -111
- package/samples/MetroWidgetDemos/data.js +0 -205
- package/utils/JsViewVueWidget/JsvSwiper/Indicator.vue +0 -35
|
@@ -5,19 +5,16 @@
|
|
|
5
5
|
* text {String} 文字内容
|
|
6
6
|
* style {Object} 样式
|
|
7
7
|
* slideSpeed {int} 滚动速度 px/s, 默认60
|
|
8
|
+
* slideDirection{String} 滚动方向 ste(start to end)/ets(end to start)/ltr/rtl
|
|
8
9
|
* forceSlide {boolean} 短文字是否滚动,默认false
|
|
10
|
+
* 说明
|
|
11
|
+
* JsvMarquee会识别阿拉伯字符自动设置direction
|
|
9
12
|
-->
|
|
10
13
|
|
|
11
14
|
<script setup>
|
|
12
15
|
import { Forge } from "../../dom/jsv-forge-define";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
shallowRef,
|
|
16
|
-
computed,
|
|
17
|
-
toRaw,
|
|
18
|
-
onMounted,
|
|
19
|
-
onBeforeUnmount,
|
|
20
|
-
} from "vue";
|
|
16
|
+
import { TextTools } from "../JsViewVueTools/JsvTextTools";
|
|
17
|
+
import { shallowRef, computed, toRaw, onMounted, onBeforeUnmount } from "vue";
|
|
21
18
|
|
|
22
19
|
const defaultFontStyle = () => {
|
|
23
20
|
return {
|
|
@@ -55,6 +52,14 @@ const props = defineProps({
|
|
|
55
52
|
type: Number,
|
|
56
53
|
default: 60,
|
|
57
54
|
},
|
|
55
|
+
slideDirection: {
|
|
56
|
+
type: String,
|
|
57
|
+
validator(value) {
|
|
58
|
+
// The value must match one of these strings
|
|
59
|
+
return ["ste", "ets", "ltr", "rtl"].includes(value);
|
|
60
|
+
},
|
|
61
|
+
default: "ste",
|
|
62
|
+
},
|
|
58
63
|
forceSlide: {
|
|
59
64
|
type: Boolean,
|
|
60
65
|
default: false,
|
|
@@ -65,6 +70,15 @@ const textDiv = shallowRef(null);
|
|
|
65
70
|
let animState = 0;
|
|
66
71
|
let animIdleHandler = -1;
|
|
67
72
|
let asyncStartHandler = -1;
|
|
73
|
+
|
|
74
|
+
const _direction = computed(() => {
|
|
75
|
+
if (props.style?.direction == "rtl" || props.style.direction == "ltr") {
|
|
76
|
+
return props.style.direction;
|
|
77
|
+
} else {
|
|
78
|
+
return TextTools.isRtl(props.text) ? "rtl" : "ltr";
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
|
|
68
82
|
const fontStyle = computed(() => {
|
|
69
83
|
let { left, top, width, height, ...rest } = props.style;
|
|
70
84
|
let r = defaultFontStyle();
|
|
@@ -73,12 +87,14 @@ const fontStyle = computed(() => {
|
|
|
73
87
|
//滚送时必需start对齐
|
|
74
88
|
r.textAlign = "start";
|
|
75
89
|
}
|
|
90
|
+
r.direction = _direction.value;
|
|
76
91
|
return r;
|
|
77
92
|
});
|
|
93
|
+
|
|
78
94
|
//rtl文字需要先获得文字宽度
|
|
79
95
|
let textWidth =
|
|
80
96
|
fontStyle.value.direction == "rtl"
|
|
81
|
-
? getTextWidth(props.text, fontStyle.value)
|
|
97
|
+
? TextTools.getTextWidth(props.text, fontStyle.value)
|
|
82
98
|
: 0;
|
|
83
99
|
const slideDivLeft = computed(() =>
|
|
84
100
|
fontStyle.value.direction == "rtl" && props.style.width < textWidth
|
|
@@ -86,16 +102,61 @@ const slideDivLeft = computed(() =>
|
|
|
86
102
|
: 0
|
|
87
103
|
);
|
|
88
104
|
|
|
105
|
+
const getAnimInfo = (state) => {
|
|
106
|
+
const info = {
|
|
107
|
+
start: 0,
|
|
108
|
+
end: 0,
|
|
109
|
+
};
|
|
110
|
+
const isRtl = _direction.value == "rtl";
|
|
111
|
+
if (state == 0) {
|
|
112
|
+
//滚出
|
|
113
|
+
if (isRtl) {
|
|
114
|
+
if (props.slideDirection == "rtl" || props.slideDirection == "ste") {
|
|
115
|
+
info.end = textWidth;
|
|
116
|
+
} else {
|
|
117
|
+
//反向滚动
|
|
118
|
+
info.end = -props.style.width;
|
|
119
|
+
}
|
|
120
|
+
} else {
|
|
121
|
+
if (props.slideDirection == "ltr" || props.slideDirection == "ste") {
|
|
122
|
+
info.end = -textWidth;
|
|
123
|
+
} else {
|
|
124
|
+
//反向滚动
|
|
125
|
+
info.end = props.style.width;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
} else {
|
|
129
|
+
//滚入
|
|
130
|
+
if (isRtl) {
|
|
131
|
+
if (props.slideDirection == "rtl" || props.slideDirection == "ste") {
|
|
132
|
+
info.start = -props.style.width;
|
|
133
|
+
} else {
|
|
134
|
+
//反向滚动
|
|
135
|
+
info.start = textWidth;
|
|
136
|
+
}
|
|
137
|
+
} else {
|
|
138
|
+
if (props.slideDirection == "ltr" || props.slideDirection == "ste") {
|
|
139
|
+
info.start = props.style.width;
|
|
140
|
+
} else {
|
|
141
|
+
//反向滚动
|
|
142
|
+
info.start = -textWidth;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return info;
|
|
147
|
+
};
|
|
148
|
+
|
|
89
149
|
const slideStep = () => {
|
|
150
|
+
let animInfo = getAnimInfo(animState);
|
|
90
151
|
if (animState == 0) {
|
|
91
152
|
// 文字从原始位置,移动出屏幕(每次完整移动,停顿1秒)
|
|
92
|
-
let start = 0,
|
|
93
|
-
|
|
153
|
+
// let start = 0,
|
|
154
|
+
// end = fontStyle.value.direction == "rtl" ? textWidth : -textWidth;
|
|
94
155
|
animIdleHandler = setTimeout(() => {
|
|
95
156
|
animIdleHandler = -1;
|
|
96
157
|
const anim = new Forge.TranslateFrameAnimation(
|
|
97
|
-
start,
|
|
98
|
-
end,
|
|
158
|
+
animInfo.start,
|
|
159
|
+
animInfo.end,
|
|
99
160
|
props.slideSpeed,
|
|
100
161
|
true,
|
|
101
162
|
0,
|
|
@@ -119,14 +180,14 @@ const slideStep = () => {
|
|
|
119
180
|
}, 1000);
|
|
120
181
|
} else {
|
|
121
182
|
// 文字从屏幕外部,移动回屏幕中的文字原始位置
|
|
122
|
-
let start =
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
183
|
+
// let start =
|
|
184
|
+
// fontStyle.value.direction == "rtl"
|
|
185
|
+
// ? -props.style.width
|
|
186
|
+
// : props.style.width,
|
|
187
|
+
// end = 0;
|
|
127
188
|
const anim = new Forge.TranslateFrameAnimation(
|
|
128
|
-
start,
|
|
129
|
-
end,
|
|
189
|
+
animInfo.start,
|
|
190
|
+
animInfo.end,
|
|
130
191
|
props.slideSpeed,
|
|
131
192
|
true,
|
|
132
193
|
props.style.width,
|
|
@@ -10,9 +10,10 @@
|
|
|
10
10
|
* indicatorAlign {String} 指示面板的 align, 值为 start / middle / end,默认为middle
|
|
11
11
|
* totalFrame {int} (必需)item 的个数
|
|
12
12
|
* firstFrame {int} 初始 item 的 index,默认为0
|
|
13
|
-
* layoutInfo {Object} (必需)
|
|
14
|
-
* onClick
|
|
13
|
+
* layoutInfo {Object} (必需)组件的大小及位置 {top: 0, left: 0, width: 0, height: 0}
|
|
14
|
+
* onClick {Function} 点击事件 function () {}
|
|
15
15
|
* onChange {Function} 滚动事件 function (index) {}
|
|
16
|
+
* onEdge {Function} 到达边缘事件 ({direction: EdgeDirection}) => Void
|
|
16
17
|
* autoplayInterval {int} 自动滚动的时间(毫秒),等于0时不自动滚动, 默认为5000
|
|
17
18
|
* animation {Object} 滚动动画设置 {duration: 0, easing: "linear"}
|
|
18
19
|
* vertical {boolean} 组件是否为纵向的,默认为 false
|
|
@@ -22,6 +23,7 @@
|
|
|
22
23
|
* swipeType {String} 切换方式,目前只支持 translate,之后可能会添加 opacity 等方式
|
|
23
24
|
* smoothTranslate {boolean} 平滑模式动画开关
|
|
24
25
|
* reverseSwipe {boolean} 反转滚动方向,默认值为false. 默认滚动方向是正向, 既向index增大的方向, 反转后为反向, 既向index减小的方向
|
|
26
|
+
* disableLoopWhenFocus {boolean} 获焦时按键是否循环滚动
|
|
25
27
|
* public methods:
|
|
26
28
|
* slideTo
|
|
27
29
|
* @description 滚动到指定id
|
|
@@ -35,7 +37,7 @@ import JsvActorMove, {
|
|
|
35
37
|
JsvActorMoveControl,
|
|
36
38
|
} from "jsview/utils/JsViewVueWidget/JsvActorMove";
|
|
37
39
|
import JsvVisibleSensor from "jsview/utils/JsViewVueWidget/JsvVisibleSensor";
|
|
38
|
-
import
|
|
40
|
+
import { EdgeDirection } from "../../JsViewEngineWidget/WidgetCommon";
|
|
39
41
|
import { ref, shallowRef } from "vue";
|
|
40
42
|
|
|
41
43
|
const VIEW_NUM = 3;
|
|
@@ -50,8 +52,24 @@ function modToRange(value, mod, start = 0) {
|
|
|
50
52
|
return m;
|
|
51
53
|
}
|
|
52
54
|
|
|
55
|
+
const keyCode2EdgeDirection = (keyCode) => {
|
|
56
|
+
switch (keyCode) {
|
|
57
|
+
case 37:
|
|
58
|
+
return EdgeDirection.left;
|
|
59
|
+
case 38:
|
|
60
|
+
return EdgeDirection.top;
|
|
61
|
+
case 39:
|
|
62
|
+
return EdgeDirection.right;
|
|
63
|
+
case 40:
|
|
64
|
+
return EdgeDirection.bottom;
|
|
65
|
+
default:
|
|
66
|
+
console.error("not direction key", keyCode);
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
53
71
|
export default {
|
|
54
|
-
components: {
|
|
72
|
+
components: { JsvActorMove, JsvVisibleSensor },
|
|
55
73
|
props: {
|
|
56
74
|
showIndicator: {
|
|
57
75
|
type: Boolean,
|
|
@@ -71,6 +89,10 @@ export default {
|
|
|
71
89
|
},
|
|
72
90
|
indicatorAlign: {
|
|
73
91
|
type: String,
|
|
92
|
+
validator(value) {
|
|
93
|
+
// The value must match one of these strings
|
|
94
|
+
return ["start", "middle", "end"].includes(value);
|
|
95
|
+
},
|
|
74
96
|
default: "middle",
|
|
75
97
|
},
|
|
76
98
|
totalFrame: {
|
|
@@ -91,6 +113,9 @@ export default {
|
|
|
91
113
|
onChange: {
|
|
92
114
|
type: Function,
|
|
93
115
|
},
|
|
116
|
+
onEdge: {
|
|
117
|
+
type: Function,
|
|
118
|
+
},
|
|
94
119
|
autoplayInterval: {
|
|
95
120
|
type: Number,
|
|
96
121
|
default: 5000,
|
|
@@ -129,8 +154,17 @@ export default {
|
|
|
129
154
|
type: Boolean,
|
|
130
155
|
default: false,
|
|
131
156
|
},
|
|
157
|
+
disableLoopWhenFocus: {
|
|
158
|
+
type: Boolean,
|
|
159
|
+
default: false,
|
|
160
|
+
},
|
|
132
161
|
},
|
|
133
162
|
computed: {
|
|
163
|
+
indexList() {
|
|
164
|
+
return new Array(this.totalFrame).fill(0).map((_, index) => {
|
|
165
|
+
return index;
|
|
166
|
+
});
|
|
167
|
+
},
|
|
134
168
|
indicatorLayout() {
|
|
135
169
|
let indicatorSize =
|
|
136
170
|
this.totalFrame * (this.dotSize + this.dotGap) - this.dotGap;
|
|
@@ -286,47 +320,64 @@ export default {
|
|
|
286
320
|
}
|
|
287
321
|
},
|
|
288
322
|
_onKeyDown(ev) {
|
|
323
|
+
let direction = 0;
|
|
289
324
|
switch (ev.keyCode) {
|
|
290
325
|
case 37:
|
|
291
326
|
if (!this.vertical) {
|
|
292
|
-
|
|
293
|
-
return true;
|
|
327
|
+
direction = -1;
|
|
294
328
|
}
|
|
295
329
|
break;
|
|
296
330
|
case 38:
|
|
297
331
|
if (this.vertical) {
|
|
298
|
-
|
|
299
|
-
return true;
|
|
332
|
+
direction = -1;
|
|
300
333
|
}
|
|
301
334
|
break;
|
|
302
335
|
case 39:
|
|
303
336
|
if (!this.vertical) {
|
|
304
|
-
|
|
305
|
-
return true;
|
|
337
|
+
direction = 1;
|
|
306
338
|
}
|
|
307
339
|
break;
|
|
308
340
|
case 40:
|
|
309
341
|
if (this.vertical) {
|
|
310
|
-
|
|
311
|
-
return true;
|
|
342
|
+
direction = 1;
|
|
312
343
|
}
|
|
313
344
|
break;
|
|
314
345
|
case 13:
|
|
315
|
-
this.onClick?.();
|
|
346
|
+
this.onClick?.(this.currentDataIndex);
|
|
316
347
|
return true;
|
|
317
348
|
default:
|
|
318
|
-
|
|
349
|
+
return false;
|
|
319
350
|
}
|
|
320
351
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
352
|
+
//处理方向键
|
|
353
|
+
if (direction !== 0) {
|
|
354
|
+
if (!this.disableLoopWhenFocus) {
|
|
355
|
+
this._trigger(direction);
|
|
356
|
+
return true;
|
|
357
|
+
} else {
|
|
358
|
+
if (
|
|
359
|
+
this.currentDataIndex + direction >= 0 &&
|
|
360
|
+
this.currentDataIndex + direction < this.totalFrame
|
|
361
|
+
) {
|
|
362
|
+
this._trigger(direction);
|
|
363
|
+
return true;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
//未处理方向键
|
|
369
|
+
this.onEdge?.({
|
|
370
|
+
direction: keyCode2EdgeDirection(ev.keyCode),
|
|
371
|
+
rect: {
|
|
372
|
+
x: this.layoutInfo.left,
|
|
373
|
+
y: this.layoutInfo.top,
|
|
374
|
+
width: this.layoutInfo.width,
|
|
375
|
+
height: this.layoutInfo.height,
|
|
376
|
+
},
|
|
377
|
+
});
|
|
378
|
+
return true;
|
|
329
379
|
},
|
|
380
|
+
_onAnimationEnd() {},
|
|
330
381
|
_onFocus() {
|
|
331
382
|
this.focused = true;
|
|
332
383
|
this.stopAutoplay();
|
|
@@ -370,12 +421,14 @@ export default {
|
|
|
370
421
|
curViewAnimation.SetAnimationListener(
|
|
371
422
|
new Forge.AnimationListener(null, this._onAnimationEnd, null)
|
|
372
423
|
);
|
|
373
|
-
this.$refs["element" + this.currentViewIndex]
|
|
374
|
-
|
|
375
|
-
|
|
424
|
+
this.$refs["element" + this.currentViewIndex]
|
|
425
|
+
?.jsvGetProxyView(true)
|
|
426
|
+
.StartAnimation(curViewAnimation);
|
|
376
427
|
this.$refs[
|
|
377
428
|
"element" + modToRange(this.currentViewIndex - direction, VIEW_NUM)
|
|
378
|
-
]
|
|
429
|
+
]
|
|
430
|
+
?.jsvGetProxyView(true)
|
|
431
|
+
.StartAnimation(preViewAnimation);
|
|
379
432
|
},
|
|
380
433
|
_startSmoothTranslateAnimation() {
|
|
381
434
|
let curController = this.controllerList[this.currentViewIndex];
|
|
@@ -412,7 +465,9 @@ export default {
|
|
|
412
465
|
if ((old_h && !new_h) || (old_v && !new_h)) {
|
|
413
466
|
this.stopAutoplay();
|
|
414
467
|
} else if ((!old_h && new_h) || (!old_v && new_h)) {
|
|
415
|
-
this.
|
|
468
|
+
if (!this.focused) {
|
|
469
|
+
this.startAutoplay();
|
|
470
|
+
}
|
|
416
471
|
}
|
|
417
472
|
},
|
|
418
473
|
},
|
|
@@ -438,6 +493,12 @@ export default {
|
|
|
438
493
|
></jsv-visible-sensor>
|
|
439
494
|
<jsv-focus-block
|
|
440
495
|
:name="name"
|
|
496
|
+
:style="{
|
|
497
|
+
left: layoutInfo.left,
|
|
498
|
+
top: layoutInfo.top,
|
|
499
|
+
width: layoutInfo.width,
|
|
500
|
+
height: layoutInfo.height,
|
|
501
|
+
}"
|
|
441
502
|
:onAction="{
|
|
442
503
|
onFocus: _onFocus,
|
|
443
504
|
onBlur: _onBlur,
|
|
@@ -481,17 +542,6 @@ export default {
|
|
|
481
542
|
:focused="focused"
|
|
482
543
|
></slot>
|
|
483
544
|
</div>
|
|
484
|
-
|
|
485
|
-
<!-- <div
|
|
486
|
-
:style="{
|
|
487
|
-
width: 50,
|
|
488
|
-
height: 50,
|
|
489
|
-
top: 200,
|
|
490
|
-
fontSize: '30px',
|
|
491
|
-
}"
|
|
492
|
-
>
|
|
493
|
-
{{ index }}
|
|
494
|
-
</div> -->
|
|
495
545
|
</jsv-actor-move>
|
|
496
546
|
</div>
|
|
497
547
|
<div v-else>
|
|
@@ -510,53 +560,39 @@ export default {
|
|
|
510
560
|
:focused="focused"
|
|
511
561
|
></slot>
|
|
512
562
|
</div>
|
|
513
|
-
|
|
514
|
-
<!-- <div
|
|
515
|
-
:style="{
|
|
516
|
-
width: 50,
|
|
517
|
-
height: 50,
|
|
518
|
-
top: 200,
|
|
519
|
-
fontSize: '30px',
|
|
520
|
-
}"
|
|
521
|
-
>
|
|
522
|
-
{{ index + " " + item.dataIndex }}
|
|
523
|
-
</div> -->
|
|
524
563
|
</div>
|
|
525
564
|
</div>
|
|
526
565
|
</div>
|
|
527
566
|
|
|
528
567
|
<div v-if="showIndicator" :style="indicatorLayout">
|
|
529
|
-
<
|
|
530
|
-
|
|
531
|
-
:
|
|
532
|
-
:
|
|
533
|
-
|
|
568
|
+
<div
|
|
569
|
+
v-for="index in indexList"
|
|
570
|
+
:key="index"
|
|
571
|
+
:style="
|
|
572
|
+
vertical
|
|
573
|
+
? { top: indicatorDotSize * index }
|
|
574
|
+
: { left: indicatorDotSize * index }
|
|
575
|
+
"
|
|
534
576
|
>
|
|
535
|
-
<
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
borderRadius: '5px',
|
|
555
|
-
}"
|
|
556
|
-
></div>
|
|
557
|
-
</slot>
|
|
558
|
-
</template>
|
|
559
|
-
</indicator>
|
|
577
|
+
<slot
|
|
578
|
+
name="indicatorDot"
|
|
579
|
+
:dataIndex="index"
|
|
580
|
+
:currentIndex="currentDataIndex"
|
|
581
|
+
:focused="focused"
|
|
582
|
+
>
|
|
583
|
+
<div
|
|
584
|
+
:style="{
|
|
585
|
+
width: dotSize,
|
|
586
|
+
height: dotSize,
|
|
587
|
+
backgroundColor:
|
|
588
|
+
index == currentDataIndex
|
|
589
|
+
? 'rgba(50, 50, 50, 1.0)'
|
|
590
|
+
: 'rgba(100, 100, 100, 0.7)',
|
|
591
|
+
borderRadius: Math.round(dotSize / 2) + 'px',
|
|
592
|
+
}"
|
|
593
|
+
></div>
|
|
594
|
+
</slot>
|
|
595
|
+
</div>
|
|
560
596
|
</div>
|
|
561
597
|
</div>
|
|
562
598
|
</jsv-focus-block>
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
* @Author: ChenChanghua
|
|
3
|
-
* @Date: 2022-07-11 13:31:36
|
|
4
|
-
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime: 2022-11-02 14:51:40
|
|
6
|
-
* @Description: file content
|
|
7
|
-
-->
|
|
8
|
-
<script setup>
|
|
9
|
-
import { MetroWidget, VERTICAL, EdgeDirection, useFocusHub } from "jsview";
|
|
10
|
-
import { useRouter } from "vue-router";
|
|
11
|
-
import Buttons from "./Buttons.vue";
|
|
12
|
-
import Mixed from "./Mixed.vue";
|
|
13
|
-
import Widgets from "./widgets/Widgets.vue";
|
|
14
|
-
|
|
15
|
-
const router = useRouter();
|
|
16
|
-
const focusHub = useFocusHub();
|
|
17
|
-
|
|
18
|
-
const onFocus = () => {
|
|
19
|
-
focusHub.setFocus("mwButton");
|
|
20
|
-
};
|
|
21
|
-
const onKeyDown = (ev) => {
|
|
22
|
-
if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
|
|
23
|
-
router.go(-1);
|
|
24
|
-
}
|
|
25
|
-
return true;
|
|
26
|
-
};
|
|
27
|
-
</script>
|
|
28
|
-
|
|
29
|
-
<template>
|
|
30
|
-
<jsv-focus-block
|
|
31
|
-
autoFocus
|
|
32
|
-
:onAction="{
|
|
33
|
-
onKeyDown,
|
|
34
|
-
onFocus,
|
|
35
|
-
}"
|
|
36
|
-
:style="{
|
|
37
|
-
width: 1920,
|
|
38
|
-
height: 1080,
|
|
39
|
-
backgroundColor: '#007788',
|
|
40
|
-
}"
|
|
41
|
-
>
|
|
42
|
-
<buttons></buttons>
|
|
43
|
-
<mixed></mixed>
|
|
44
|
-
<widgets></widgets>
|
|
45
|
-
</jsv-focus-block>
|
|
46
|
-
</template>
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
* @Author: ChenChanghua
|
|
3
|
-
* @Date: 2022-07-11 13:31:36
|
|
4
|
-
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime: 2022-07-18 09:49:59
|
|
6
|
-
* @Description: file content
|
|
7
|
-
-->
|
|
8
|
-
<script setup>
|
|
9
|
-
import { MetroWidget, VERTICAL, EdgeDirection } from "jsview";
|
|
10
|
-
import { useFocusHub } from "jsview";
|
|
11
|
-
import { advanceButton } from "../data";
|
|
12
|
-
import ButtonItem from "./ButtonItem.vue";
|
|
13
|
-
|
|
14
|
-
const focusHub = useFocusHub();
|
|
15
|
-
|
|
16
|
-
//item为Buttonitem的一些回调
|
|
17
|
-
const provideData = () => {
|
|
18
|
-
return advanceButton;
|
|
19
|
-
};
|
|
20
|
-
const measures = (item) => {
|
|
21
|
-
return {
|
|
22
|
-
width: item.width,
|
|
23
|
-
height: item.height,
|
|
24
|
-
marginRight: item.marginRight,
|
|
25
|
-
marginBottom: item.marginBottom,
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
const onEdge = (edgeInfo) => {
|
|
29
|
-
if (edgeInfo.direction == EdgeDirection.right) {
|
|
30
|
-
focusHub.setFocus("mwWidget");
|
|
31
|
-
} else if (edgeInfo.direction == EdgeDirection.bottom) {
|
|
32
|
-
focusHub.setFocus("mwMix");
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
</script>
|
|
36
|
-
|
|
37
|
-
<template>
|
|
38
|
-
<div
|
|
39
|
-
:style="{
|
|
40
|
-
left: 50,
|
|
41
|
-
top: 20,
|
|
42
|
-
width: 300,
|
|
43
|
-
height: 400,
|
|
44
|
-
fontSize: 30,
|
|
45
|
-
color: '#FFFFFF',
|
|
46
|
-
}"
|
|
47
|
-
>
|
|
48
|
-
{{ `item可以是可获得焦点的控件` }}
|
|
49
|
-
</div>
|
|
50
|
-
<metro-widget
|
|
51
|
-
name="mwButton"
|
|
52
|
-
:top="120"
|
|
53
|
-
:left="50"
|
|
54
|
-
:provideData="provideData"
|
|
55
|
-
:width="220"
|
|
56
|
-
:height="400"
|
|
57
|
-
:direction="VERTICAL"
|
|
58
|
-
:measures="measures"
|
|
59
|
-
:onEdge="onEdge"
|
|
60
|
-
>
|
|
61
|
-
<template #renderItem="{ data, query, onAction, onItemEdge }">
|
|
62
|
-
<button-item
|
|
63
|
-
:data="data"
|
|
64
|
-
:query="query"
|
|
65
|
-
:onAction="onAction"
|
|
66
|
-
:onItemEdge="onItemEdge"
|
|
67
|
-
/>
|
|
68
|
-
</template>
|
|
69
|
-
</metro-widget>
|
|
70
|
-
</template>
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
* @Author: ChenChanghua
|
|
3
|
-
* @Date: 2022-07-11 13:31:36
|
|
4
|
-
* @LastEditors: ChenChanghua
|
|
5
|
-
* @LastEditTime: 2022-11-02 15:37:40
|
|
6
|
-
* @Description: file content
|
|
7
|
-
-->
|
|
8
|
-
<script setup>
|
|
9
|
-
import { MetroWidget, VERTICAL, EdgeDirection } from "jsview";
|
|
10
|
-
import { useFocusHub } from "jsview";
|
|
11
|
-
import { advanceMix } from "../data";
|
|
12
|
-
import ButtonItem from "./ButtonItem.vue";
|
|
13
|
-
import Item from "../Item.vue";
|
|
14
|
-
|
|
15
|
-
const focusHub = useFocusHub();
|
|
16
|
-
|
|
17
|
-
//item混排的回调
|
|
18
|
-
const provideData = () => {
|
|
19
|
-
return advanceMix;
|
|
20
|
-
};
|
|
21
|
-
const measures = (item) => {
|
|
22
|
-
return {
|
|
23
|
-
width: item.width,
|
|
24
|
-
height: item.height,
|
|
25
|
-
marginRight: item.marginRight,
|
|
26
|
-
marginBottom: item.marginBottom,
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
const onEdge = (edgeInfo) => {
|
|
30
|
-
if (edgeInfo.direction == EdgeDirection.right) {
|
|
31
|
-
focusHub.setFocus("mwWidget");
|
|
32
|
-
} else if (edgeInfo.direction == EdgeDirection.top) {
|
|
33
|
-
focusHub.setFocus("mwButton");
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
</script>
|
|
37
|
-
|
|
38
|
-
<template>
|
|
39
|
-
<div
|
|
40
|
-
:style="{
|
|
41
|
-
left: 50,
|
|
42
|
-
top: 350,
|
|
43
|
-
width: 300,
|
|
44
|
-
height: 400,
|
|
45
|
-
fontSize: 30,
|
|
46
|
-
color: '#FFFFFF',
|
|
47
|
-
}"
|
|
48
|
-
>
|
|
49
|
-
{{ `item可以普通描画控件和可获焦控件混排` }}
|
|
50
|
-
</div>
|
|
51
|
-
<metro-widget
|
|
52
|
-
name="mwMix"
|
|
53
|
-
:top="450"
|
|
54
|
-
:left="50"
|
|
55
|
-
:provideData="provideData"
|
|
56
|
-
:width="260"
|
|
57
|
-
:height="440"
|
|
58
|
-
:padding="{
|
|
59
|
-
top: 20,
|
|
60
|
-
left: 20,
|
|
61
|
-
}"
|
|
62
|
-
:direction="VERTICAL"
|
|
63
|
-
:measures="measures"
|
|
64
|
-
:onEdge="onEdge"
|
|
65
|
-
>
|
|
66
|
-
<template #renderItem="{ data, query, onAction, onItemEdge }">
|
|
67
|
-
<button-item
|
|
68
|
-
v-if="data.type == 'button'"
|
|
69
|
-
:data="data"
|
|
70
|
-
:query="query"
|
|
71
|
-
:onAction="onAction"
|
|
72
|
-
:onItemEdge="onItemEdge"
|
|
73
|
-
/>
|
|
74
|
-
<item v-else :data="data" :query="query" :onAction="onAction" />
|
|
75
|
-
</template>
|
|
76
|
-
</metro-widget>
|
|
77
|
-
</template>
|