@shijiu/jsview-vue-samples 2.3.151-test.0 → 3.0.0-test.0

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 (228) hide show
  1. package/ABImageAlt/App.vue +114 -0
  2. package/ABImageAlt/Item.vue +133 -0
  3. package/{MetroWidgetDemos/SkeletonDiagram/assets/imageList.json → ABImageAlt/assets/imageList.js} +9 -1
  4. package/ABImageAlt/data.js +17 -0
  5. package/AI_Check_Rules.txt +5 -0
  6. package/AnimPicture/App.vue +20 -10
  7. package/ApicSwitch/App.vue +90 -0
  8. package/ApicSwitch/TabItem.vue +65 -0
  9. package/ApicSwitch/WebpShow.vue +24 -0
  10. package/ApicSwitch/data.js +50 -0
  11. package/Basic/AI_skills_update.md +1 -0
  12. package/Basic/components/div/ColorFormatTest.vue +93 -0
  13. package/Basic/components/div/DivRadius.vue +97 -15
  14. package/Basic/components/div/DivTag3Group.vue +30 -0
  15. package/Basic/components/img/ImageType.vue +65 -0
  16. package/Basic/components/panel/Panel2.vue +13 -1
  17. package/Basic/components/text/TextAlign.vue +7 -1
  18. package/BlobLoadTest/App.vue +201 -0
  19. package/BreakLinesApi/App.vue +82 -0
  20. package/CanvasDrawChart/App.vue +11 -0
  21. package/CanvasDrawChart/Graph1.vue +104 -0
  22. package/CanvasDrawChart/Graph2.vue +115 -0
  23. package/CssPreprocessor/Scss/PanelData.js +1 -1
  24. package/CssPreprocessor/Scss/components/scss-group4/ScssMaps.vue +4 -3
  25. package/CssPreprocessor/Scss/components/scss-group5/ScssImporting.vue +2 -2
  26. package/DemoForOperator/Bounce/FreeMoveBuilder.js +1 -1
  27. package/DemoForOperator/Firework1/App.vue +12 -1
  28. package/DemoForOperator/Firework1/Fireworks.vue +18 -0
  29. package/DemoForOperator/FlipPage/FlipPage/FlipPage.vue +1 -0
  30. package/DemoForOperator/Focus/Alpha/Item.vue +1 -0
  31. package/DemoForOperator/Focus/Light/Item.vue +1 -0
  32. package/DemoForOperator/Focus/Normal/Item.vue +1 -0
  33. package/DemoForOperator/FrameShadow/FrameShadow.vue +1 -1
  34. package/DemoForOperator/Genie/App.vue +20 -6
  35. package/DemoForOperator/Genie/App2.vue +61 -0
  36. package/DemoForOperator/Genie/geniePakcer/GenieImage.vue +298 -0
  37. package/DemoForOperator/Genie/geniePakcer/GenieSlot.vue +292 -0
  38. package/DemoForOperator/Genie/geniePakcer/GenieTools.ts +463 -0
  39. package/DemoForOperator/Jigsaw/JigsawFull.vue +12 -7
  40. package/DemoForOperator/Jigsaw/JigsawSingle.vue +13 -7
  41. package/DemoForOperator/LongChatBox/App.vue +13 -13
  42. package/DemoForOperator/LongChatBox/Bubble.vue +78 -66
  43. package/DemoForOperator/LongChatBox/LongChat.vue +68 -36
  44. package/DemoForOperator/LongChatBox/testData.js +7 -44
  45. package/DemoForOperator/Sound/Bounce/FreeMoveBuilder.js +1 -1
  46. package/DemoForOperator/routeList.js +8 -2
  47. package/DemoHomepage/App.vue +74 -1
  48. package/DemoHomepage/components/BodyFrame.vue +1 -0
  49. package/DemoHomepage/components/TabFrame.vue +1 -1
  50. package/DemoHomepage/router.js +723 -160
  51. package/DemoHomepage/views/Homepage.vue +60 -2
  52. package/DemoHomepage/watchTest.vue +50 -0
  53. package/FilterDemo/AnimatePic.vue +63 -17
  54. package/FilterDemo/App.vue +3 -3
  55. package/FlexCellDemo/AI_skills_update.md +4 -0
  56. package/FlexCellDemo/TestFrame1.vue +12 -2
  57. package/FlexCellDemo/TestFrame2.vue +10 -1
  58. package/FlexCellDemo/TestFrame3.vue +114 -59
  59. package/FpsLimit/App.vue +102 -0
  60. package/FreeMoveChildAttract/App.vue +18 -8
  61. package/FreeMoveLink/App.vue +49 -20
  62. package/Hover/App.vue +144 -0
  63. package/HttpRequestSSE/SSEReader.js +200 -0
  64. package/ImpactStop/App.vue +2 -2
  65. package/Input/FullKeyboard.vue +3 -3
  66. package/Input/InputPanel.vue +63 -3
  67. package/JsvLine/App.vue +53 -38
  68. package/LatexDemo/App.vue +3 -1
  69. package/LatexFormula/App.vue +196 -0
  70. package/LongImage/App.vue +1 -1
  71. package/LongImage/LongImageScroll.vue +100 -47
  72. package/LongImage/Scroll.vue +28 -9
  73. package/LongText/LongTextScroll.vue +1 -0
  74. package/Markdown/App.vue +36 -0
  75. package/Markdown/Bubble.vue +109 -0
  76. package/Markdown/LongChat.vue +206 -0
  77. package/Markdown/Markdown/Markdown.vue +156 -0
  78. package/Markdown/Markdown/index.ts +1 -0
  79. package/Markdown/Markdown/marked/LICENSE.md +45 -0
  80. package/Markdown/Markdown/marked/index.ts +2 -0
  81. package/Markdown/Markdown/marked/marked.d.ts +756 -0
  82. package/Markdown/Markdown/marked/marked.js +71 -0
  83. package/Markdown/Markdown/parser.ts +1365 -0
  84. package/Markdown/data.js +581 -0
  85. package/MetroWidgetDemos/AI_skills_update.md +2 -0
  86. package/MetroWidgetDemos/ListExpand/ChildItem.vue +130 -0
  87. package/MetroWidgetDemos/ListExpand/ExpandItem.vue +375 -0
  88. package/MetroWidgetDemos/ListExpand/ExpandItem1.vue +403 -0
  89. package/MetroWidgetDemos/ListExpand/assets/arrow-down.png +0 -0
  90. package/MetroWidgetDemos/ListExpand/assets/up-arrow.png +0 -0
  91. package/MetroWidgetDemos/ListExpand/components/WidgetListHandler.vue +150 -0
  92. package/MetroWidgetDemos/ListExpand/index.vue +88 -0
  93. package/MetroWidgetDemos/ListExpand/list.js +2421 -0
  94. package/MetroWidgetDemos/RefreshDemo/App.vue +14 -1
  95. package/MetroWidgetDemos/RenderAccelerate/App.vue +142 -0
  96. package/MetroWidgetDemos/RenderAccelerate/AppPage.vue +78 -0
  97. package/MetroWidgetDemos/RenderAccelerate/AppTab.vue +62 -0
  98. package/MetroWidgetDemos/RenderAccelerate/ContentItem.vue +409 -0
  99. package/MetroWidgetDemos/RenderAccelerate/Item.vue +67 -0
  100. package/MetroWidgetDemos/RenderAccelerate/TabItem.vue +100 -0
  101. package/MetroWidgetDemos/RenderAccelerate/ViewSwiper.vue +215 -0
  102. package/MetroWidgetDemos/RenderAccelerate/WidgetItem.vue +107 -0
  103. package/MetroWidgetDemos/SkeletonDiagram/App.vue +35 -8
  104. package/MetroWidgetDemos/SkeletonDiagram/Item.vue +11 -2
  105. package/MetroWidgetDemos/SkeletonDiagram/assets/imageList.js +245 -0
  106. package/MetroWidgetDemos/SkeletonDiagram/data.js +3 -3
  107. package/MetroWidgetDemos/SpatialNav/App.vue +177 -0
  108. package/MetroWidgetDemos/SpatialNav/Buttons.vue +83 -0
  109. package/MetroWidgetDemos/SpatialNav/CustomFocus.vue +57 -0
  110. package/MetroWidgetDemos/{TripleWidget → SpatialNav}/Item.vue +1 -8
  111. package/MetroWidgetDemos/{TripleWidget/WidgetItem.vue → SpatialNav/SimpleFloor.vue} +14 -45
  112. package/MetroWidgetDemos/SpatialNav/StepMw.vue +113 -0
  113. package/MetroWidgetDemos/SpatialNav/TabContent/TabContent.vue +185 -0
  114. package/MetroWidgetDemos/SpatialNav/TripleSection/TripleSection.vue +69 -0
  115. package/MetroWidgetDemos/SpatialNav/TripleSection/WidgetItem.vue +100 -0
  116. package/MetroWidgetDemos/SpatialNav/TvSection/List.vue +75 -0
  117. package/MetroWidgetDemos/SpatialNav/TvSection/TvSection.vue +91 -0
  118. package/MetroWidgetDemos/basic2/App.vue +407 -0
  119. package/MetroWidgetDemos/basic2/Item.vue +68 -0
  120. package/MetroWidgetDemos/direction/App.vue +22 -0
  121. package/MetroWidgetDemos/gazeFocusDiff/App.vue +126 -0
  122. package/MetroWidgetDemos/gazeFocusDiff/Item.vue +87 -0
  123. package/MetroWidgetDemos/minimalUsage/App.vue +66 -0
  124. package/MetroWidgetDemos/minimalUsage/Item.vue +54 -0
  125. package/MetroWidgetDemos/ninePatchFocusPage/App.vue +22 -7
  126. package/MetroWidgetDemos/ninePatchFocusPage/Item.vue +7 -5
  127. package/MetroWidgetDemos/ninePatchFocusPage/focusConstants.js +2 -0
  128. package/MetroWidgetDemos/routeList.js +203 -12
  129. package/MetroWidgetDemos/slideSetting/App.vue +288 -99
  130. package/MetroWidgetDemos/zIndex/App.vue +117 -0
  131. package/MetroWidgetDemos/zIndex/Item.vue +61 -0
  132. package/NinePatchTester/App.vue +24 -31
  133. package/PreDecode/App.vue +140 -0
  134. package/ReactiveTest/App.vue +115 -0
  135. package/ReactiveTest/Item.vue +92 -0
  136. package/ReactiveTest/assets/imageList.js +245 -0
  137. package/ReactiveTest/component/TestSmartDiv.vue +50 -0
  138. package/ReactiveTest/component/TestSmartDivSrcList.vue +74 -0
  139. package/ReactiveTest/component/TestSmartImage.vue +46 -0
  140. package/ReactiveTest/component/TestSmartImageSrcList.vue +90 -0
  141. package/ReactiveTest/component/TestSmartImageStyle.vue +41 -0
  142. package/ReactiveTest/data.js +49 -0
  143. package/ScreenToBlob/App.vue +250 -0
  144. package/SecTorTest/App.vue +9 -3
  145. package/SpringFestival/SpringFestivalScene/FreeMoveBuilder.js +3 -3
  146. package/SyncDecode/App.vue +137 -0
  147. package/TextSizeLimit/App.vue +211 -0
  148. package/TransitPage/App.vue +2 -0
  149. package/assets/logo.png +0 -0
  150. package/package.json +5 -5
  151. package/DemoForOperator/Genie/geniePakcer/Genie.vue +0 -741
  152. package/DemoForOperator/LongChatBox/TextManager.ts +0 -147
  153. package/DemoForOperator/LongChatBox/VirtualList.vue +0 -298
  154. package/DemoForOperator/LongChatBox/utile.js +0 -331
  155. package/DivMetroPerformance/App.vue +0 -157
  156. package/DivMetroPerformance/Item.vue +0 -58
  157. package/DivMetroPerformance/assets/bg.jpg +0 -0
  158. package/DivMetroPerformance/assets/coupon_content.png +0 -0
  159. package/DivMetroPerformance/assets/coupon_left.png +0 -0
  160. package/DivMetroPerformance/assets/coupon_mid.png +0 -0
  161. package/DivMetroPerformance/assets/coupon_right.png +0 -0
  162. package/DivMetroPerformance/assets/focus_border.png +0 -0
  163. package/DivMetroPerformance/assets/holder_logo.png +0 -0
  164. package/DivMetroPerformance/assets/jrbm.png +0 -0
  165. package/DivMetroPerformance/assets/line_left.png +0 -0
  166. package/DivMetroPerformance/assets/line_mid.png +0 -0
  167. package/DivMetroPerformance/assets/line_right.png +0 -0
  168. package/DivMetroPerformance/assets/loading.png +0 -0
  169. package/DivMetroPerformance/assets/logo.png +0 -0
  170. package/DivMetroPerformance/assets/mcjx.png +0 -0
  171. package/DivMetroPerformance/assets/tao.png +0 -0
  172. package/DivMetroPerformance/assets/tmall.png +0 -0
  173. package/DivMetroPerformance/border.png +0 -0
  174. package/DivMetroPerformance/components/ContentItem.vue +0 -384
  175. package/DivMetroPerformance/components/MyTab.vue +0 -129
  176. package/DivMetroPerformance/data.js +0 -124
  177. package/DivMetroPerformance/utils/GridItem.vue +0 -28
  178. package/DivMetroPerformance/utils/GridPlate.vue +0 -85
  179. package/MediaDemo/App.vue +0 -127
  180. package/MediaDemo/assets/audio-poster.png +0 -0
  181. package/MediaDemo/components/Button.vue +0 -69
  182. package/MediaDemo/components/Controllor.vue +0 -286
  183. package/MediaDemo/components/StatusBar.vue +0 -100
  184. package/MediaDemo/components/frames/AudioFrame.vue +0 -39
  185. package/MediaDemo/components/frames/AudioPoster.vue +0 -48
  186. package/MediaDemo/components/frames/MediaFrame.vue +0 -153
  187. package/MediaDemo/components/frames/VideoFrame.vue +0 -39
  188. package/MetroWidgetDemos/TripleWidget/App.vue +0 -87
  189. package/MetroWidgetDemos/TripleWidget/SWidgetItem.vue +0 -99
  190. package/Parkour/App.vue +0 -13
  191. package/Parkour/Common/Context.js +0 -21
  192. package/Parkour/Common/MatchmanInfo.js +0 -62
  193. package/Parkour/Common/Random.js +0 -61
  194. package/Parkour/Common/Sound.js +0 -50
  195. package/Parkour/appConfig/HOW_TO_CONFIG.md +0 -20
  196. package/Parkour/appConfig/app.config.mjs +0 -5
  197. package/Parkour/appConfig/app_sign_private_key_sample.crt +0 -28
  198. package/Parkour/appConfig/app_sign_public_key_sample.pem +0 -9
  199. package/Parkour/appConfig/jsview.config.mjs +0 -39
  200. package/Parkour/assets/Bgimages/bg1.png +0 -0
  201. package/Parkour/assets/Bgimages/bg2.png +0 -0
  202. package/Parkour/assets/Bgimages/bg3.png +0 -0
  203. package/Parkour/assets/Bgimages/bg4.png +0 -0
  204. package/Parkour/assets/Bgimages/bg5.png +0 -0
  205. package/Parkour/assets/audio/jump.mp3 +0 -0
  206. package/Parkour/assets/audio/lose.mp3 +0 -0
  207. package/Parkour/assets/role_skin1/fail.json +0 -44
  208. package/Parkour/assets/role_skin1/fail.png +0 -0
  209. package/Parkour/assets/role_skin1/jump_down.json +0 -20
  210. package/Parkour/assets/role_skin1/jump_down.png +0 -0
  211. package/Parkour/assets/role_skin1/jump_up.json +0 -44
  212. package/Parkour/assets/role_skin1/jump_up.png +0 -0
  213. package/Parkour/assets/role_skin1/roll.json +0 -44
  214. package/Parkour/assets/role_skin1/roll.png +0 -0
  215. package/Parkour/assets/role_skin1/run.json +0 -52
  216. package/Parkour/assets/role_skin1/run.png +0 -0
  217. package/Parkour/components/Backdrop.vue +0 -61
  218. package/Parkour/components/GameSence.vue +0 -602
  219. package/Parkour/components/Matchman.vue +0 -85
  220. package/ThrowMoveDemo/AccelerateDemo.vue +0 -85
  221. package/ThrowMoveDemo/App.vue +0 -104
  222. package/ThrowMoveDemo/LRParabolicDemo.vue +0 -101
  223. package/ThrowMoveDemo/TargetDemo.vue +0 -87
  224. package/ThrowMoveDemo/UDParabolicDemo.vue +0 -92
  225. /package/{AnimPicture/assets → assets}/animated_webp.webp +0 -0
  226. /package/{AnimPicture/assets → assets}/ball_3.webp +0 -0
  227. /package/{AnimPicture/assets → assets}/girl_run.gif +0 -0
  228. /package/{AnimPicture/assets → assets}/quan.webp +0 -0
@@ -0,0 +1,91 @@
1
+ <script setup>
2
+ import {
3
+ MetroWidget,
4
+ VERTICAL,
5
+ HORIZONTAL,
6
+ useFocusHub,
7
+ METRO_WIDGET_CONST,
8
+ ONEDGE_TYPE
9
+ } from "jsview";
10
+ import { onMounted, ref, shallowRef } from "vue";
11
+ import List from "./List.vue";
12
+ import Item from "../Item.vue";
13
+
14
+ const props = defineProps({
15
+ data: Object,
16
+ onAction: Object,
17
+ queryInfo: Object,
18
+ });
19
+
20
+ const focusHub = useFocusHub();
21
+
22
+ const provideData = () => {
23
+ const data = [
24
+ {
25
+ width: 180,
26
+ height: 500,
27
+ name: "leftList",
28
+ type: "leftList",
29
+ },
30
+ {
31
+ width: 500,
32
+ height: 500,
33
+ marginRight: 10,
34
+ content: "video",
35
+ color: "#009900",
36
+ type: "video",
37
+ },
38
+ {
39
+ width: 180,
40
+ height: 500,
41
+ name: "rightList",
42
+ type: "rightList",
43
+ },
44
+ ];
45
+ return data;
46
+ };
47
+
48
+ const measures = (item) => {
49
+ return {
50
+ width: item.width,
51
+ height: item.height,
52
+ marginRight: item.marginRight,
53
+ marginBottom: item.marginBottom,
54
+ itemSlide: METRO_WIDGET_CONST.ITEM_SLIDE.ACT_FOCUS_RECT_EVENT,
55
+ bindSpatialNav: item.type === "video" ? true : false,
56
+ };
57
+ };
58
+
59
+ onMounted(() => {});
60
+
61
+ const onFocus = (rect) => {
62
+ focusHub.setFocus(props.data.name);
63
+ };
64
+ props.onAction.register("onFocus", onFocus);
65
+ </script>
66
+
67
+ <template>
68
+ <metro-widget
69
+ :name="data.name"
70
+ :top="0"
71
+ :left="0"
72
+ :width="900"
73
+ :height="520"
74
+ :provideData="provideData"
75
+ :padding="{ left: 10, right: 10, top: 20, }"
76
+ :direction="HORIZONTAL"
77
+ :measures="measures"
78
+ :onEdge="ONEDGE_TYPE.SPATIAL_NAV"
79
+ :sendFocusRectEvent="true"
80
+ >
81
+ <template #renderItem="{ data, onAction, query }">
82
+ <list
83
+ v-if="data.type === 'leftList' || data.type === 'rightList'"
84
+ :data="data"
85
+ :onAction="onAction"
86
+ :queryInfo="query"
87
+ />
88
+ <item v-else :data="data" :onAction="onAction" :queryInfo="query" />
89
+ </template>
90
+ </metro-widget>
91
+ </template>
@@ -0,0 +1,407 @@
1
+ <script setup>
2
+ import { MetroWidget, VERTICAL, useFocusHub } from "jsview";
3
+ import { onMounted } from "vue";
4
+ import Item from "./Item.vue";
5
+
6
+ const focusHub = useFocusHub();
7
+
8
+ const widgetLayout = {
9
+ left: 60,
10
+ top: 120,
11
+ width: 990,
12
+ height: 572,
13
+ };
14
+
15
+ // EPG 网格参数(方块跨行/跨列 = width/height 由数据决定)
16
+ const grid = {
17
+ colW: 190,
18
+ gapX: 10,
19
+ rowH: 50,
20
+ gapY: 8,
21
+ };
22
+
23
+ const dayCount = 5; // 列数(Mon~Fri)
24
+ const timeRowCount = 10; // 行数(用于覆盖所有块的 rowSpan)
25
+
26
+ const dayNames = ["Mon", "Tue", "Wed", "Thu", "Fri"];
27
+
28
+ const timeAxis = ["10:00", "10:30", "11:00", "11:30", "12:00"];
29
+
30
+ const mkBlock = ({
31
+ col,
32
+ row,
33
+ colSpan = 1,
34
+ rowSpan = 1,
35
+ title,
36
+ timeText,
37
+ color,
38
+ }) => {
39
+ // relative layout 下,MetroWidget 会根据 width/height + marginRight/marginBottom
40
+ // 自动计算 left/top,所以 measures 不再依赖 left/top。
41
+ // 这里仍保留 left/top 仅用于稳定排序(让自动布局插入顺序更贴近我们预期的 EPG 网格)。
42
+ const left = col * (grid.colW + grid.gapX);
43
+ const top = row * (grid.rowH + grid.gapY);
44
+
45
+ const width = colSpan * grid.colW + (colSpan - 1) * grid.gapX;
46
+ const height = rowSpan * grid.rowH + (rowSpan - 1) * grid.gapY;
47
+
48
+ // 末尾不预留“尾巴间隙”,避免 relative 的 Fence 计算把右/下边界挤出容器。
49
+ const marginRight = col + colSpan < dayCount ? grid.gapX : 0;
50
+ const marginBottom = row + rowSpan < timeRowCount ? grid.gapY : 0;
51
+
52
+ return {
53
+ left,
54
+ top,
55
+ width,
56
+ height,
57
+ marginRight,
58
+ marginBottom,
59
+ title,
60
+ timeText,
61
+ color,
62
+ col,
63
+ row,
64
+ };
65
+ };
66
+
67
+ // 通过“多尺寸块”在绝对坐标中拼成 EPG 豆腐块布局
68
+ const provideData = () => {
69
+ // 尽量按“从上到下、从左到右”的顺序插入,让 relative 的 Fence 算法把块落在我们预期的位置附近
70
+ const blocks = [
71
+ // row 0
72
+ mkBlock({
73
+ // index=0
74
+ // 推导坐标: left=0, top=0
75
+ col: 0,
76
+ row: 0,
77
+ rowSpan: 2,
78
+ title: "Show A",
79
+ timeText: "10:00",
80
+ color: "#ff4d6d",
81
+ }),
82
+ mkBlock({
83
+ // index=1
84
+ // 推导坐标: left=200, top=0
85
+ col: 1,
86
+ row: 0,
87
+ rowSpan: 3,
88
+ title: "Series F",
89
+ timeText: "10:00",
90
+ color: "#ff8fab",
91
+ }),
92
+ mkBlock({
93
+ // index=2
94
+ // 推导坐标: left=400, top=0
95
+ col: 2,
96
+ row: 0,
97
+ colSpan: 2,
98
+ rowSpan: 3,
99
+ title: "Block J",
100
+ timeText: "10:00",
101
+ color: "#b565f2",
102
+ }),
103
+ mkBlock({
104
+ // index=3
105
+ // 推导坐标: left=800, top=0
106
+ col: 4,
107
+ row: 0,
108
+ rowSpan: 2,
109
+ title: "Morning R",
110
+ timeText: "10:00",
111
+ color: "#118ab2",
112
+ }),
113
+
114
+ // row 2
115
+ mkBlock({
116
+ // index=4
117
+ // 推导坐标: left=0, top=116
118
+ col: 0,
119
+ row: 2,
120
+ rowSpan: 2,
121
+ title: "News B",
122
+ timeText: "11:00",
123
+ color: "#4dabf7",
124
+ }),
125
+ mkBlock({
126
+ // index=5
127
+ // 推导坐标: left=800, top=116
128
+ col: 4,
129
+ row: 2,
130
+ rowSpan: 4,
131
+ title: "Variety S",
132
+ timeText: "11:00",
133
+ color: "#ffd166",
134
+ }),
135
+
136
+ // row 3
137
+ mkBlock({
138
+ // index=6
139
+ // 推导坐标: left=200, top=174
140
+ col: 1,
141
+ row: 3,
142
+ rowSpan: 2,
143
+ title: "Doc G",
144
+ timeText: "11:30",
145
+ color: "#90be6d",
146
+ }),
147
+ mkBlock({
148
+ // index=7
149
+ // 推导坐标: left=400, top=174
150
+ col: 2,
151
+ row: 3,
152
+ rowSpan: 2,
153
+ title: "Drama K",
154
+ timeText: "11:30",
155
+ color: "#ffbe0b",
156
+ }),
157
+ mkBlock({
158
+ // index=8
159
+ // 推导坐标: left=600, top=174
160
+ col: 3,
161
+ row: 3,
162
+ rowSpan: 1,
163
+ title: "Show L",
164
+ timeText: "11:30",
165
+ color: "#00bbf9",
166
+ }),
167
+
168
+ // row 4
169
+ mkBlock({
170
+ // index=9
171
+ // 推导坐标: left=0, top=232
172
+ col: 0,
173
+ row: 4,
174
+ rowSpan: 1,
175
+ title: "Movie C",
176
+ timeText: "12:00",
177
+ color: "#845ec2",
178
+ }),
179
+ mkBlock({
180
+ // index=10
181
+ // 推导坐标: left=600, top=232
182
+ col: 3,
183
+ row: 4,
184
+ rowSpan: 2,
185
+ title: "News M",
186
+ timeText: "12:00",
187
+ color: "#fb5607",
188
+ }),
189
+
190
+ // row 5
191
+ mkBlock({
192
+ // index=11
193
+ // 推导坐标: left=0, top=290
194
+ col: 0,
195
+ row: 5,
196
+ colSpan: 2,
197
+ rowSpan: 2,
198
+ title: "Special D",
199
+ timeText: "12:30",
200
+ color: "#2ec4b6",
201
+ }),
202
+ mkBlock({
203
+ // index=12
204
+ // 推导坐标: left=400, top=290
205
+ col: 2,
206
+ row: 5,
207
+ rowSpan: 2,
208
+ title: "Movie N",
209
+ timeText: "12:30",
210
+ color: "#3a86ff",
211
+ }),
212
+
213
+ // row 6
214
+ mkBlock({
215
+ // index=14
216
+ // 推导坐标: left=800, top=348
217
+ col: 4,
218
+ row: 6,
219
+ rowSpan: 2,
220
+ title: "Quiz T",
221
+ timeText: "13:00",
222
+ color: "#073b4c",
223
+ }),
224
+ mkBlock({
225
+ // index=13
226
+ // 推导坐标: left=600, top=348
227
+ col: 3,
228
+ row: 6,
229
+ rowSpan: 3,
230
+ title: "Special O",
231
+ timeText: "13:30",
232
+ color: "#8338ec",
233
+ }),
234
+
235
+ // row 7
236
+ mkBlock({
237
+ // index=15
238
+ // 推导坐标: left=0, top=406
239
+ col: 0,
240
+ row: 7,
241
+ rowSpan: 3,
242
+ title: "Sports E",
243
+ timeText: "14:00",
244
+ color: "#f9c74f",
245
+ }),
246
+ mkBlock({
247
+ // index=17
248
+ // 推导坐标: left=400, top=406
249
+ col: 2,
250
+ row: 7,
251
+ rowSpan: 3,
252
+ title: "Sports P",
253
+ timeText: "14:00",
254
+ color: "#06d6a0",
255
+ }),
256
+ mkBlock({
257
+ // index=16
258
+ // 推导坐标: left=200, top=406
259
+ col: 1,
260
+ row: 7,
261
+ rowSpan: 2,
262
+ title: "Talk H",
263
+ timeText: "14:00",
264
+ color: "#43aa8b",
265
+ }),
266
+
267
+ // row 8
268
+ mkBlock({
269
+ // index=18
270
+ // 推导坐标: left=800, top=464
271
+ col: 4,
272
+ row: 8,
273
+ rowSpan: 2,
274
+ title: "Night U",
275
+ timeText: "14:00",
276
+ color: "#9b5de5",
277
+ }),
278
+
279
+ // row 9
280
+ mkBlock({
281
+ // index=19
282
+ // 推导坐标: left=200, top=522
283
+ col: 1,
284
+ row: 9,
285
+ rowSpan: 1,
286
+ title: "Late I",
287
+ timeText: "15:00",
288
+ color: "#577590",
289
+ }),
290
+ mkBlock({
291
+ // index=20
292
+ // 推导坐标: left=600, top=522
293
+ col: 3,
294
+ row: 9,
295
+ rowSpan: 1,
296
+ title: "Late Q",
297
+ timeText: "15:00",
298
+ color: "#ef476f",
299
+ }),
300
+ ];
301
+
302
+ return blocks
303
+ .slice()
304
+ .sort((a, b) => a.top - b.top || a.left - b.left)
305
+ .map((b, idx) => {
306
+ return {
307
+ ...b,
308
+ index: idx,
309
+ };
310
+ });
311
+ };
312
+
313
+ const measures = (data) => {
314
+ return {
315
+ width: data.width,
316
+ height: data.height,
317
+ marginRight: data.marginRight,
318
+ marginBottom: data.marginBottom,
319
+ focusable: true,
320
+ enableTap: true,
321
+ };
322
+ };
323
+
324
+ // 单一 MetroWidget:不需要多区域 onEdge 跳转
325
+ const onEdge = () => false;
326
+
327
+ onMounted(() => {
328
+ focusHub.setFocus("epgMw");
329
+ });
330
+ </script>
331
+
332
+ <template>
333
+ <div
334
+ :style="{
335
+ width: 1280,
336
+ height: 720,
337
+ backgroundColor: '#002233',
338
+ }"
339
+ />
340
+
341
+ <div
342
+ :style="{
343
+ left: widgetLayout.left,
344
+ top: widgetLayout.top - 75,
345
+ width: widgetLayout.width,
346
+ height: 40,
347
+ fontSize: 26,
348
+ lineHeight: 40,
349
+ color: '#FFFFFF',
350
+ }"
351
+ >
352
+ EPG tofu blocks (arbitrary block sizes)
353
+ </div>
354
+
355
+ <!-- day headers (non-focus) -->
356
+ <div
357
+ v-for="(d, idx) in dayNames"
358
+ :key="d"
359
+ :style="{
360
+ left: widgetLayout.left + idx * (grid.colW + grid.gapX),
361
+ top: widgetLayout.top - 35,
362
+ width: grid.colW,
363
+ height: 26,
364
+ fontSize: 18,
365
+ lineHeight: 26,
366
+ color: '#E6F6FF',
367
+ backgroundColor: 'rgba(255,255,255,0.08)',
368
+ }"
369
+ >
370
+ {{ d }}
371
+ </div>
372
+
373
+ <!-- time labels (非焦点展示) -->
374
+ <div
375
+ v-for="(t, idx) in timeAxis"
376
+ :key="t"
377
+ :style="{
378
+ left: 10,
379
+ top: widgetLayout.top + idx * (grid.rowH * 2 + grid.gapY * 2),
380
+ width: 90,
381
+ height: 26,
382
+ fontSize: 18,
383
+ lineHeight: 26,
384
+ color: 'rgba(255,255,255,0.9)',
385
+ }"
386
+ >
387
+ {{ t }}
388
+ </div>
389
+
390
+ <metro-widget
391
+ name="epgMw"
392
+ :left="widgetLayout.left"
393
+ :top="widgetLayout.top"
394
+ :width="widgetLayout.width"
395
+ :height="widgetLayout.height"
396
+ :provideData="provideData"
397
+ :direction="VERTICAL"
398
+ :measures="measures"
399
+ layoutType="relative"
400
+ :onEdge="onEdge"
401
+ >
402
+ <template #renderItem="{ data, onAction }">
403
+ <Item :data="data" :onAction="onAction" />
404
+ </template>
405
+ </metro-widget>
406
+ </template>
407
+
@@ -0,0 +1,68 @@
1
+ <!--
2
+ * @Author: JsView Bot
3
+ * @Date: 2026-03-25
4
+ * @Description: file content
5
+ -->
6
+ <script setup>
7
+ import { computed, ref } from "vue";
8
+
9
+ const props = defineProps({
10
+ data: Object,
11
+ onAction: Object,
12
+ });
13
+
14
+ const focused = ref(false);
15
+
16
+ const onFocus = () => {
17
+ focused.value = true;
18
+ };
19
+
20
+ const onBlur = () => {
21
+ focused.value = false;
22
+ };
23
+
24
+ const onClick = () => {
25
+ // 演示用
26
+ console.log("epg item onclick", props.data);
27
+ };
28
+
29
+ props.onAction.register("onFocus", onFocus);
30
+ props.onAction.register("onBlur", onBlur);
31
+ props.onAction.register("onClick", onClick);
32
+
33
+ const outerStyle = computed(() => ({
34
+ width: props.data.width,
35
+ height: props.data.height,
36
+ backgroundColor: props.data.color,
37
+ color: focused.value ? "#FFE66D" : "#FFFFFF",
38
+ fontSize: 22,
39
+ overflow: "hidden",
40
+ }));
41
+
42
+ const timeStyle = computed(() => ({
43
+ width: props.data.width,
44
+ height: 24,
45
+ lineHeight: 24,
46
+ fontSize: 16,
47
+ color: focused.value ? "#001b2a" : "rgba(255,255,255,0.95)",
48
+ }));
49
+
50
+ const titleStyle = computed(() => ({
51
+ top: 24,
52
+ width: props.data.width,
53
+ height: 24,
54
+ lineHeight: 24,
55
+ fontSize: 20,
56
+ color: focused.value ? "#001b2a" : "#FFFFFF",
57
+ }));
58
+ </script>
59
+
60
+ <template>
61
+ <div :style="outerStyle">
62
+ <div :style="timeStyle">{{ data.timeText }}</div>
63
+ <div :style="titleStyle">
64
+ {{ data.title }} IDX {{ data.index }}
65
+ </div>
66
+ </div>
67
+ </template>
68
+
@@ -35,6 +35,28 @@ for (let i = 0; i < 30; i++) {
35
35
  });
36
36
  }
37
37
 
38
+ // HORIZONTAL(容器: 300x200, item: 90x90, marginRight:10, marginBottom:10)
39
+ // 依据 MetroWidgetSetup -> CommonMetroTemplate(relative) 推测:
40
+ // - lineMax = contentHeight = 200, 单列可放 2 个(步长 100)
41
+ // - 排列顺序: 从上到下,再从左到右
42
+ // - 位置公式: col = Math.floor(i / 2), row = i % 2, left = col * 100, top = row * 100
43
+ // 0:(0,0) 1:(0,100) 2:(100,0) 3:(100,100) 4:(200,0) 5:(200,100)
44
+ // 6:(300,0) 7:(300,100) 8:(400,0) 9:(400,100) 10:(500,0) 11:(500,100)
45
+ // 12:(600,0) 13:(600,100) 14:(700,0) 15:(700,100) 16:(800,0) 17:(800,100)
46
+ // 18:(900,0) 19:(900,100) 20:(1000,0) 21:(1000,100) 22:(1100,0) 23:(1100,100)
47
+ // 24:(1200,0) 25:(1200,100) 26:(1300,0) 27:(1300,100) 28:(1400,0) 29:(1400,100)
48
+ //
49
+ // VERTICAL(容器: 200x300, item: 90x90, marginRight:10, marginBottom:10)
50
+ // 依据 MetroWidgetSetup -> CommonMetroTemplate(relative) 推测:
51
+ // - lineMax = contentWidth = 200, 单行可放 2 个(步长 100)
52
+ // - 排列顺序: 从左到右,再从上到下
53
+ // - 位置公式: row = Math.floor(i / 2), col = i % 2, left = col * 100, top = row * 100
54
+ // 0:(0,0) 1:(100,0) 2:(0,100) 3:(100,100) 4:(0,200) 5:(100,200)
55
+ // 6:(0,300) 7:(100,300) 8:(0,400) 9:(100,400) 10:(0,500) 11:(100,500)
56
+ // 12:(0,600) 13:(100,600) 14:(0,700) 15:(100,700) 16:(0,800) 17:(100,800)
57
+ // 18:(0,900) 19:(100,900) 20:(0,1000) 21:(100,1000) 22:(0,1100) 23:(100,1100)
58
+ // 24:(0,1200) 25:(100,1200) 26:(0,1300) 27:(100,1300) 28:(0,1400) 29:(100,1400)
59
+
38
60
  const horizontalWidget = {
39
61
  provideData: () => {
40
62
  return data;
@@ -0,0 +1,126 @@
1
+ <!--
2
+ * @file
3
+ *
4
+ * 【界面概述】
5
+ * 对比 MetroWidget item 的 onGaze/onIgnore vs onFocus/onBlur:
6
+ * - onFocus/onBlur:仅在该 item 处于“focus-tree 焦点”时触发(且一般要求 widget 自身处于获焦状态)
7
+ * - onGaze/onIgnore:即便 widget 未获焦,item 的凝视状态仍会触发
8
+ *
9
+ * 【交互提示】
10
+ * - 用方向键移动 focus:观察“FOCUS”高亮变化
11
+ * - 用鼠标/凝视交互跨过 item:观察“GAZE”高亮变化
12
+ -->
13
+ <script setup>
14
+ import { MetroWidget, VERTICAL, useFocusHub } from "jsview";
15
+ import { onMounted, ref } from "vue";
16
+ import Item from "./Item.vue";
17
+
18
+ const focusHub = useFocusHub();
19
+
20
+ const listData = [
21
+ { id: 0, title: "Item 0", width: 420, height: 80, marginBottom: 16 },
22
+ { id: 1, title: "Item 1", width: 420, height: 80, marginBottom: 16 },
23
+ { id: 2, title: "Item 2", width: 420, height: 80, marginBottom: 16 },
24
+ { id: 3, title: "Item 3", width: 420, height: 80, marginBottom: 16 },
25
+ { id: 4, title: "Item 4", width: 420, height: 80, marginBottom: 16 },
26
+ ];
27
+
28
+ const measures = (item) => ({
29
+ width: item.width,
30
+ height: item.height,
31
+ marginBottom: item.marginBottom,
32
+ });
33
+
34
+ const mirrorWidgetRef = ref(null);
35
+
36
+ const onDriverFocusChange = (id) => {
37
+ // 关键点 1:左侧 driver widget 作为 focusBlock owner,切换焦点时触发 onFocusChange(id)
38
+ // 关键点 2:把右侧 mirror widget 的同 index item“对齐到同一个焦点 id”
39
+ // - setFocusId(id, needSlide, doAnim)
40
+ // - 此处传 false,false 目的是:不做滚动/动画干扰,仅用于“切换 item 内部状态”观察回调差异
41
+ //
42
+ // 关键点 3(验证目标):
43
+ // - 右侧 mirror widget 本身不作为 focusBlock owner(我们没有给它 setFocus)
44
+ // - 因此:右侧 item 的 onGaze/onIgnore 仍会跟随凝视/关注变化
45
+ // - 但右侧 item 的 onFocus/onBlur 应当不会触发(onFocus/onBlur 依赖 widget 获焦状态)
46
+ mirrorWidgetRef.value?.setFocusId(id, false, false);
47
+ };
48
+
49
+ onMounted(() => {
50
+ // 关键点 0:初始焦点只落在左侧 driver widget
51
+ // - 这样才能确保右侧 mirror widget 不处于“widget 获焦状态”
52
+ // - 进而只出现 onGaze/onIgnore(不出现 onFocus/onBlur)
53
+ focusHub.setFocus("gazeFocusDriverWidget");
54
+ });
55
+ </script>
56
+
57
+ <template>
58
+ <div
59
+ :style="{
60
+ width: 1280,
61
+ height: 720,
62
+ backgroundColor: '#0C1B30',
63
+ position: 'relative',
64
+ }"
65
+ >
66
+ <div
67
+ :style="{
68
+ left: 80,
69
+ top: 30,
70
+ width: 460,
71
+ color: '#FFFFFF',
72
+ fontSize: 16,
73
+ whiteSpace: 'nowrap',
74
+ textOverflow: 'ellipsis',
75
+ }"
76
+ >
77
+ {{ "Left: focusBlock (FOCUS+GAZE callbacks)" }}
78
+ </div>
79
+ <div
80
+ :style="{
81
+ left: 560,
82
+ top: 30,
83
+ width: 460,
84
+ color: '#FFFFFF',
85
+ fontSize: 16,
86
+ whiteSpace: 'nowrap',
87
+ textOverflow: 'ellipsis',
88
+ }"
89
+ >
90
+ {{ "Right: setFocusId mirror (GAZE only expected)" }}
91
+ </div>
92
+
93
+ <metro-widget
94
+ name="gazeFocusDriverWidget"
95
+ :left="80"
96
+ :top="90"
97
+ :width="460"
98
+ :height="620"
99
+ :direction="VERTICAL"
100
+ :data="listData"
101
+ :measures="measures"
102
+ :onFocusChange="onDriverFocusChange"
103
+ >
104
+ <template #renderItem="{ data, onAction }">
105
+ <item :data="data" :onAction="onAction" widget-tag="L" />
106
+ </template>
107
+ </metro-widget>
108
+
109
+ <metro-widget
110
+ ref="mirrorWidgetRef"
111
+ name="gazeFocusMirrorWidget"
112
+ :left="560"
113
+ :top="90"
114
+ :width="460"
115
+ :height="620"
116
+ :direction="VERTICAL"
117
+ :data="listData"
118
+ :measures="measures"
119
+ >
120
+ <template #renderItem="{ data, onAction }">
121
+ <item :data="data" :onAction="onAction" widget-tag="R" />
122
+ </template>
123
+ </metro-widget>
124
+ </div>
125
+ </template>
126
+