@shijiu/jsview-vue 0.9.766 → 0.9.804

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.
Files changed (88) hide show
  1. package/dom/bin/jsview-browser-debug-dom.min.js +1 -1
  2. package/dom/bin/jsview-dom.min.js +1 -1
  3. package/dom/bin/jsview-engine-js-browser.min.js +1 -1
  4. package/dom/target_core_revision.js +4 -4
  5. package/package.json +1 -1
  6. package/samples/Basic/components/anim/AnimTransition.vue +4 -4
  7. package/samples/DemoHomepage/App.vue +30 -6
  8. package/samples/DemoHomepage/components/TabFrame.vue +7 -0
  9. package/samples/DemoHomepage/router.js +21 -18
  10. package/samples/DemoHomepage/views/Homepage.vue +5 -1
  11. package/samples/FilterDemo/VideoLayer.vue +2 -2
  12. package/samples/FocusBlockDemos/AutoFocus/App.vue +56 -0
  13. package/samples/FocusBlockDemos/AutoFocus/BaseBlock.vue +82 -0
  14. package/samples/FocusBlockDemos/AutoFocus/DialogBlock.vue +89 -0
  15. package/samples/FocusBlockDemos/AutoFocus/DialogContorls.js +47 -0
  16. package/samples/FocusBlockDemos/AutoFocus/FocusNamesDefine.js +9 -0
  17. package/samples/FocusBlockDemos/AutoFocus/PlaneBlock.vue +71 -0
  18. package/samples/FocusBlockDemos/ProgressiveFocusControl/App.vue +84 -0
  19. package/samples/FocusBlockDemos/ProgressiveFocusControl/BaseBlock.vue +77 -0
  20. package/samples/FocusBlockDemos/ProgressiveFocusControl/DownPlaneBlock.vue +83 -0
  21. package/samples/FocusBlockDemos/ProgressiveFocusControl/FocusNamesDefine.js +12 -0
  22. package/samples/FocusBlockDemos/ProgressiveFocusControl/UpPlaneBlock.vue +83 -0
  23. package/samples/GiftRain/App.vue +248 -0
  24. package/samples/GiftRain/audio/boom.mp3 +0 -0
  25. package/samples/GiftRain/audio/get.mp3 +0 -0
  26. package/samples/GiftRain/common/Sound.js +48 -0
  27. package/samples/GiftRain/components/RedPacket.vue +161 -0
  28. package/samples/GiftRain/components/Score.vue +55 -0
  29. package/samples/GiftRain/components/SpriteTranslate.vue +72 -0
  30. package/samples/GridDemo/Item.vue +1 -0
  31. package/samples/ImpactStop/App.vue +2 -2
  32. package/samples/Marquee/App.vue +34 -3
  33. package/samples/MetroWidgetDemos/PingPong/App.vue +22 -11
  34. package/samples/MetroWidgetDemos/PingPong/AppPage.vue +3 -3
  35. package/samples/MetroWidgetDemos/{Item.vue → PingPong/Item.vue} +1 -3
  36. package/samples/MetroWidgetDemos/PingPong/ViewSwiper.vue +3 -3
  37. package/samples/MetroWidgetDemos/{WidgetItem.vue → PingPong/WidgetItem.vue} +6 -1
  38. package/samples/MetroWidgetDemos/basic/App.vue +162 -0
  39. package/samples/MetroWidgetDemos/basic/Item.vue +43 -0
  40. package/samples/MetroWidgetDemos/direction/App.vue +158 -0
  41. package/samples/MetroWidgetDemos/direction/Item.vue +45 -0
  42. package/samples/MetroWidgetDemos/focusableItemBasic/App.vue +67 -0
  43. package/samples/MetroWidgetDemos/{Advanced → focusableItemBasic}/ButtonItem.vue +16 -20
  44. package/samples/MetroWidgetDemos/focusableItemMetroWidget/App.vue +74 -0
  45. package/samples/MetroWidgetDemos/{Advanced/widgets → focusableItemMetroWidget}/Item.vue +12 -30
  46. package/samples/MetroWidgetDemos/{Advanced/widgets → focusableItemMetroWidget}/WidgetItem.vue +10 -9
  47. package/samples/MetroWidgetDemos/focusableItemMix/App.vue +88 -0
  48. package/samples/MetroWidgetDemos/focusableItemMix/ButtonItem.vue +86 -0
  49. package/samples/MetroWidgetDemos/focusableItemMix/Item.vue +43 -0
  50. package/samples/MetroWidgetDemos/index.js +6 -0
  51. package/samples/MetroWidgetDemos/layoutType/App.vue +180 -0
  52. package/samples/MetroWidgetDemos/layoutType/Item.vue +45 -0
  53. package/samples/MetroWidgetDemos/padding/App.vue +222 -0
  54. package/samples/MetroWidgetDemos/padding/Item.vue +64 -0
  55. package/samples/MetroWidgetDemos/routeList.js +64 -0
  56. package/samples/MetroWidgetDemos/slideSetting/App.vue +225 -0
  57. package/samples/MetroWidgetDemos/slideSetting/Item.vue +45 -0
  58. package/samples/NinePatchDemo/App.vue +78 -122
  59. package/samples/NinePatchDemo/Item.vue +28 -26
  60. package/samples/Swiper/App.vue +148 -0
  61. package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +15 -12
  62. package/utils/JsViewEngineWidget/TemplateParser.js +6 -1
  63. package/utils/JsViewPlugin/JsvAudio/AudioProxy.js +17 -1
  64. package/utils/JsViewPlugin/JsvAudio/JsvAudio.vue +15 -38
  65. package/utils/JsViewPlugin/JsvAudio/version.js +10 -10
  66. package/utils/JsViewPlugin/JsvPlayer/version.js +5 -5
  67. package/utils/JsViewVueTools/JsvTextTools.js +26 -3
  68. package/utils/JsViewVueWidget/JsvActorMove/JsvActorMove.vue +1 -1
  69. package/utils/JsViewVueWidget/JsvFilterView.vue +1 -1
  70. package/utils/JsViewVueWidget/JsvMarquee.vue +81 -20
  71. package/utils/JsViewVueWidget/JsvNinePatch.vue +1 -1
  72. package/utils/JsViewVueWidget/JsvPosterDiv.vue +1 -1
  73. package/utils/JsViewVueWidget/JsvPosterImage.vue +1 -1
  74. package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +43 -9
  75. package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +115 -79
  76. package/utils/JsViewVueWidget/JsvSwiper/index.js +3 -2
  77. package/utils/JsViewVueWidget/JsvTextBox.vue +1 -1
  78. package/utils/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue +1 -1
  79. package/samples/MetroWidgetDemos/Advanced/App.vue +0 -46
  80. package/samples/MetroWidgetDemos/Advanced/Buttons.vue +0 -70
  81. package/samples/MetroWidgetDemos/Advanced/Mixed.vue +0 -77
  82. package/samples/MetroWidgetDemos/Advanced/widgets/Widgets.vue +0 -116
  83. package/samples/MetroWidgetDemos/Advanced/widgets/focus1.png +0 -0
  84. package/samples/MetroWidgetDemos/Simple/AbsoluteTemplate.vue +0 -75
  85. package/samples/MetroWidgetDemos/Simple/App.vue +0 -45
  86. package/samples/MetroWidgetDemos/Simple/RelativeTemplate.vue +0 -111
  87. package/samples/MetroWidgetDemos/data.js +0 -205
  88. package/utils/JsViewVueWidget/JsvSwiper/Indicator.vue +0 -35
@@ -57,7 +57,7 @@ let buildForgeView = (pointRes, sprayStyle, sizeRef, ignoreClip) => {
57
57
  texture_manager.GetImage2(image_url, false, null, "RGB_8888", null)
58
58
  );
59
59
  }
60
- const spray_view = new Forge.SprayView(texture_setting, ignoreClip);
60
+ const spray_view = new Forge.SprayView(texture_setting);
61
61
  const add_num_per_frame = sprayStyle.addNumSpeed
62
62
  ? sprayStyle.addNumSpeed
63
63
  : 0.001;
@@ -67,6 +67,24 @@ let buildForgeView = (pointRes, sprayStyle, sizeRef, ignoreClip) => {
67
67
  typeof sprayStyle.accelerateY !== "undefined"
68
68
  ? sprayStyle.accelerateY
69
69
  : -100;
70
+ let angularVelocityMin = 0,
71
+ angularVelocityMax = 0;
72
+ if (
73
+ typeof sprayStyle.angularVelocityMin === "number" &&
74
+ typeof sprayStyle.angularVelocityMax === "number"
75
+ ) {
76
+ angularVelocityMin = sprayStyle.angularVelocityMin;
77
+ angularVelocityMax = sprayStyle.angularVelocityMax;
78
+ }
79
+ let alphaMin = 1,
80
+ alphaMax = 1;
81
+ if (
82
+ typeof sprayStyle.alphaMin === "number" &&
83
+ typeof sprayStyle.alphaMax === "number"
84
+ ) {
85
+ alphaMin = sprayStyle.alphaMin;
86
+ alphaMax = sprayStyle.alphaMax;
87
+ }
70
88
  spray_view.SetSprayInfo(
71
89
  sprayStyle.type,
72
90
  sprayStyle.particleNum,
@@ -83,7 +101,12 @@ let buildForgeView = (pointRes, sprayStyle, sizeRef, ignoreClip) => {
83
101
  accelerate_x,
84
102
  accelerate_y,
85
103
  sprayStyle.enableFade,
86
- sprayStyle.enableShrink
104
+ sprayStyle.enableShrink,
105
+ ignoreClip,
106
+ angularVelocityMin,
107
+ angularVelocityMax,
108
+ alphaMin,
109
+ alphaMax
87
110
  );
88
111
  const view_width =
89
112
  sprayStyle.deltaWidth === 0 ? 1 : 2 * sprayStyle.deltaWidth;
@@ -109,13 +132,13 @@ export default {
109
132
  ignoreClip: {
110
133
  type: Boolean,
111
134
  default: false,
112
- }
135
+ },
113
136
  },
114
137
  data() {
115
138
  return {
116
139
  size: {
117
140
  width: 0,
118
- height: 0
141
+ height: 0,
119
142
  },
120
143
  viewId: -1,
121
144
  };
@@ -129,11 +152,21 @@ export default {
129
152
  },
130
153
  },
131
154
  created() {
132
- this.viewId = buildForgeView(this.pointRes, this.sprayStyle, this.size, this.ignoreClip);
155
+ this.viewId = buildForgeView(
156
+ this.pointRes,
157
+ this.sprayStyle,
158
+ this.size,
159
+ this.ignoreClip
160
+ );
133
161
  },
134
162
  updated() {
135
163
  this.unloadView();
136
- this.viewId = buildForgeView(this.pointRes, this.sprayStyle, this.size, this.ignoreClip);
164
+ this.viewId = buildForgeView(
165
+ this.pointRes,
166
+ this.sprayStyle,
167
+ this.size,
168
+ this.ignoreClip
169
+ );
137
170
  },
138
171
  beforeUnmount() {
139
172
  this.unloadView();
@@ -142,7 +175,8 @@ export default {
142
175
  </script>
143
176
 
144
177
  <template>
145
- <div
146
- :style="{width: size.width, height: size.height}"
147
- :jsv_innerview="viewId"></div>
178
+ <div
179
+ :style="{ width: size.width, height: size.height }"
180
+ :jsv_innerview="viewId"
181
+ ></div>
148
182
  </template>
@@ -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} (必需)组件的大小 {width: 0, height: 0}
14
- * onClick {Function} 点击事件 function () {}
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 Indicator from "./Indicator.vue";
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: { Indicator, JsvActorMove, JsvVisibleSensor },
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
- this._trigger(-1);
293
- return true;
327
+ direction = -1;
294
328
  }
295
329
  break;
296
330
  case 38:
297
331
  if (this.vertical) {
298
- this._trigger(-1);
299
- return true;
332
+ direction = -1;
300
333
  }
301
334
  break;
302
335
  case 39:
303
336
  if (!this.vertical) {
304
- this._trigger(1);
305
- return true;
337
+ direction = 1;
306
338
  }
307
339
  break;
308
340
  case 40:
309
341
  if (this.vertical) {
310
- this._trigger(1);
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
- break;
349
+ return false;
319
350
  }
320
351
 
321
- return false;
322
- },
323
- _onAnimationEnd() {
324
- // if (this.autoplay && this.autoplayInterval > 0 && !this.focused) {
325
- // this.timeoutHandler = setTimeout(() => {
326
- // this._trigger(1);
327
- // }, this.autoplayInterval);
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]?.jsvGetProxyView(true).StartAnimation(
374
- curViewAnimation
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
- ]?.jsvGetProxyView(true).StartAnimation(preViewAnimation);
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.startAutoplay();
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
- <indicator
530
- :number="totalFrame"
531
- :current="currentDataIndex"
532
- :itemSize="indicatorDotSize"
533
- :vertical="vertical"
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
- <template #current>
536
- <slot name="indicatorCur">
537
- <div
538
- :style="{
539
- width: 10,
540
- height: 10,
541
- backgroundColor: 'rgba(50, 50, 50, 1.0)',
542
- borderRadius: '5px',
543
- }"
544
- ></div>
545
- </slot>
546
- </template>
547
- <template #normal>
548
- <slot name="indicatorNor">
549
- <div
550
- :style="{
551
- width: 10,
552
- height: 10,
553
- backgroundColor: 'rgba(100, 100, 100, 0.7)',
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>
@@ -6,5 +6,6 @@
6
6
  * @Description: file content
7
7
  */
8
8
  import JsvSwiper from "./JsvSwiper.vue";
9
-
10
- export default JsvSwiper;
9
+ export {
10
+ JsvSwiper as default,
11
+ }
@@ -12,7 +12,7 @@
12
12
  -->
13
13
 
14
14
  <script setup>
15
- import { ref, shallowRef, computed } from "vue";
15
+ import { ref, shallowRef, computed, defineProps } from "vue";
16
16
 
17
17
  const props = defineProps({
18
18
  style: Object,
@@ -29,7 +29,7 @@
29
29
  </template>
30
30
 
31
31
  <script setup>
32
- import { reactive, ref, shallowRef, toRaw, watchEffect, onMounted, defineExpose } from 'vue'
32
+ import { reactive, ref, shallowRef, toRaw, watchEffect, onMounted, defineProps, defineExpose } from 'vue'
33
33
  import { Forge } from "jsview/dom/jsv-forge-define";
34
34
 
35
35
  const props = defineProps({
@@ -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>