@shijiu/jsview-vue 2.3.0 → 2.3.728-alpha.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 (451) hide show
  1. package/bin/browser/BrowserAudio.vue.mjs +4 -1
  2. package/bin/browser/BrowserJsvLatex.vue.mjs +9 -90
  3. package/bin/jsview-vue.mjs +13913 -8048
  4. package/bin/types/utils/JsViewEngineWidget/JsvFocus/JsvFocusHub.d.ts +39 -3
  5. package/bin/types/utils/JsViewEngineWidget/MetroWidget/Const.d.ts +4 -1
  6. package/bin/types/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue.d.ts +225 -0
  7. package/bin/types/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue.d.ts +225 -0
  8. package/bin/types/utils/JsViewEngineWidget/MetroWidget/MetroWidgetDebugger.d.ts +5 -0
  9. package/bin/types/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.d.ts +25 -2
  10. package/bin/types/utils/JsViewEngineWidget/MetroWidget/PageUpdater.d.ts +7 -1
  11. package/bin/types/utils/JsViewEngineWidget/MetroWidget/RenderItem.d.ts +28 -4
  12. package/bin/types/utils/JsViewEngineWidget/MetroWidget/TaskManager.d.ts +2 -1
  13. package/bin/types/utils/JsViewEngineWidget/MetroWidget/Utils.d.ts +2 -0
  14. package/bin/types/utils/JsViewEngineWidget/MetroWidget/WidgetRectInfo.d.ts +1 -1
  15. package/bin/types/utils/JsViewEngineWidget/SpatialNavigator/SpatialNavProvider.vue.d.ts +70 -0
  16. package/bin/types/utils/JsViewEngineWidget/SpatialNavigator/SpatialNavigationAlgorithm.d.ts +24 -0
  17. package/bin/types/utils/JsViewEngineWidget/SpatialNavigator/SpatialNavigationNode.d.ts +19 -0
  18. package/bin/types/utils/JsViewEngineWidget/SpatialNavigator/SpatialNavigator.d.ts +42 -0
  19. package/bin/types/utils/JsViewEngineWidget/TemplateParser/CommonMetroTemplate.d.ts +5 -4
  20. package/bin/types/utils/JsViewEngineWidget/TemplateParser/ListMetroTemplate.d.ts +2 -1
  21. package/bin/types/utils/JsViewEngineWidget/TemplateParser/MetroTemplate.d.ts +12 -4
  22. package/bin/types/utils/JsViewEngineWidget/TemplateParser/TemplateItemAdder.d.ts +9 -7
  23. package/bin/types/utils/JsViewEngineWidget/WidgetCommon.d.ts +27 -14
  24. package/bin/types/utils/JsViewEngineWidget/index.d.ts +3 -1
  25. package/bin/types/utils/JsViewPlugin/JsvLatex/BrowserDomBuilder.d.ts +0 -1
  26. package/bin/types/utils/JsViewPlugin/JsvLatex/GetVersion.d.ts +14 -0
  27. package/bin/types/utils/JsViewPlugin/JsvLatex/JsvLatex.vue.d.ts +3 -0
  28. package/bin/types/utils/JsViewPlugin/JsvLatex/JsvLatexBridgeProxy.d.ts +1 -0
  29. package/bin/types/utils/JsViewPlugin/JsvLatex/JsvLatexProxy.vue.d.ts +4 -1
  30. package/bin/types/utils/JsViewPlugin/JsvLatex/version.d.mts +29 -2
  31. package/bin/types/utils/JsViewPlugin/JsvPlayer/JsvMedia.d.ts +107 -4
  32. package/bin/types/utils/JsViewPlugin/JsvPlayer/JsvMediaBrowserInterface.d.ts +62 -0
  33. package/bin/types/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue.d.ts +94 -18
  34. package/bin/types/utils/JsViewPlugin/JsvPlayer/JsvPlayerBrowser-wasm.vue.d.ts +611 -0
  35. package/bin/types/utils/JsViewPlugin/JsvPlayer/{BrowserJsvPlayer.vue.d.ts → JsvPlayerBrowser.vue.d.ts} +24 -23
  36. package/bin/types/utils/JsViewPlugin/JsvPlayer/index-0.9.d.ts +77 -20
  37. package/bin/types/utils/JsViewPlugin/JsvPlayer/index.d.ts +77 -20
  38. package/bin/types/utils/JsViewVueTools/BlobApi.d.ts +38 -0
  39. package/bin/types/utils/JsViewVueTools/FeatureActive.d.ts +1 -0
  40. package/bin/types/utils/JsViewVueTools/ForgeHandles.d.ts +1 -0
  41. package/bin/types/utils/JsViewVueTools/JsvInteractionMode.d.ts +6 -0
  42. package/bin/types/utils/JsViewVueTools/JsvRuntimeBridge.d.ts +44 -1
  43. package/bin/types/utils/JsViewVueTools/JsvTextTools.d.ts +1 -0
  44. package/bin/types/utils/JsViewVueTools/JsvTextureStore/BitPalette/BitPalette.d.ts +43 -0
  45. package/bin/types/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/CommandList.d.ts +1 -0
  46. package/bin/types/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/DrawHelper.d.ts +54 -0
  47. package/bin/types/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/Path.d.ts +13 -0
  48. package/bin/types/utils/JsViewVueTools/JsvTextureStore/CapturedTexture/CapturedTexture.d.ts +5 -3
  49. package/bin/types/utils/JsViewVueTools/JsvTextureStore/JsvTextureStore.d.ts +88 -25
  50. package/bin/types/utils/JsViewVueTools/JsvTextureStore/Store.d.ts +2 -0
  51. package/bin/types/utils/JsViewVueTools/JsvTextureStore/Texture.d.ts +4 -0
  52. package/bin/types/utils/JsViewVueTools/JsvTextureStore/TextureBuilder.d.ts +49 -0
  53. package/bin/types/utils/JsViewVueTools/JsvTextureStore/index.d.ts +2 -0
  54. package/bin/types/utils/JsViewVueTools/index.d.ts +3 -1
  55. package/bin/types/utils/JsViewVueWidget/JsvApic/JsvApic2/JsvApic2.vue.d.ts +12 -22
  56. package/bin/types/utils/JsViewVueWidget/JsvApic/JsvApic2/index.d.ts +12 -22
  57. package/bin/types/utils/JsViewVueWidget/JsvDashPath.vue.d.ts +11 -0
  58. package/bin/types/utils/JsViewVueWidget/JsvDomRenderer/JsViewHtmlToVNodesOptions.d.ts +101 -0
  59. package/bin/types/utils/JsViewVueWidget/JsvDomRenderer/JsvDomRenderer.d.ts +61 -0
  60. package/bin/types/utils/JsViewVueWidget/JsvDomRenderer/htmlToVNodes.d.ts +58 -0
  61. package/bin/types/utils/JsViewVueWidget/JsvDomRenderer/index.d.ts +1 -0
  62. package/bin/types/utils/JsViewVueWidget/JsvFragShaderView/JsvFragShaderView.vue.d.ts +3 -1
  63. package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/ActorControl.d.ts +151 -18
  64. package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/CallbackManager.d.ts +2 -1
  65. package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/CmdTypes.d.ts +16 -0
  66. package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/ForgeTypeDefine.d.ts +2 -1
  67. package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/NexusNode.d.ts +3 -1
  68. package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/SetAction.d.ts +55 -12
  69. package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/SetCondition.d.ts +178 -35
  70. package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.d.ts +119 -17
  71. package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/index.d.ts +9 -3
  72. package/bin/types/utils/JsViewVueWidget/JsvInput/EditViewOperator.d.ts +4 -1
  73. package/bin/types/utils/JsViewVueWidget/JsvInput/JsvInput.vue.d.ts +22 -1
  74. package/bin/types/utils/JsViewVueWidget/JsvLine/JsvLine.vue.d.ts +1 -1
  75. package/bin/types/utils/JsViewVueWidget/JsvPieChart.vue.d.ts +2 -0
  76. package/bin/types/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue.d.ts +5 -2
  77. package/bin/types/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue.d.ts +1 -1
  78. package/bin/types/utils/JsViewVueWidget/JsvScrollBox/JsvScrollBox.vue.d.ts +39 -1
  79. package/bin/types/utils/JsViewVueWidget/JsvSector.vue.d.ts +1 -0
  80. package/bin/types/utils/JsViewVueWidget/JsvSmoothSlideContainer.vue.d.ts +72 -0
  81. package/bin/types/utils/JsViewVueWidget/JsvSoundPool.d.ts +26 -0
  82. package/bin/types/utils/JsViewVueWidget/JsvSwiper/JsvSmoothSwiper.vue.d.ts +112 -0
  83. package/bin/types/utils/JsViewVueWidget/JsvSwiper/JsvSwiper2.vue.d.ts +142 -0
  84. package/bin/types/utils/JsViewVueWidget/JsvSwiper/index.d.ts +3 -1
  85. package/bin/types/utils/JsViewVueWidget/JsvTextBox.vue.d.ts +15 -3
  86. package/bin/types/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue.d.ts +22 -96
  87. package/bin/types/utils/JsViewVueWidget/JsvTouchModeSwitcher.vue.d.ts +6 -0
  88. package/bin/types/utils/JsViewVueWidget/{JsvPosterDiv.vue.d.ts → TypesDiv/JsvPosterDiv.vue.d.ts} +9 -0
  89. package/bin/types/utils/JsViewVueWidget/{JsvPosterImage.vue.d.ts → TypesDiv/JsvPosterImage.vue.d.ts} +15 -3
  90. package/bin/types/utils/JsViewVueWidget/TypesDiv/JsvSmartDiv.vue.d.ts +72 -0
  91. package/bin/types/utils/JsViewVueWidget/TypesDiv/JsvSmartImage.vue.d.ts +90 -0
  92. package/bin/types/utils/JsViewVueWidget/index.d.ts +8 -4
  93. package/dist/types/utils/JsViewEngineWidget/CheckType.d.ts +7 -0
  94. package/dist/types/utils/JsViewEngineWidget/JsvFocus/JsvFocusBlock.vue.d.ts +106 -0
  95. package/dist/types/utils/JsViewEngineWidget/JsvFocus/JsvFocusHub.d.ts +128 -0
  96. package/dist/types/utils/JsViewEngineWidget/JsvFocus/JsvFocusManager.d.ts +25 -0
  97. package/dist/types/utils/JsViewEngineWidget/MetroWidget/Const.d.ts +23 -0
  98. package/dist/types/utils/JsViewEngineWidget/MetroWidget/DebugFrame.vue.d.ts +12 -0
  99. package/dist/types/utils/JsViewEngineWidget/MetroWidget/DebugTools.d.ts +9 -0
  100. package/dist/types/utils/JsViewEngineWidget/MetroWidget/Dispatcher.d.ts +16 -0
  101. package/dist/types/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue.d.ts +412 -0
  102. package/dist/types/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue.d.ts +751 -0
  103. package/dist/types/utils/JsViewEngineWidget/MetroWidget/MetroWidgetDebugger.d.ts +9 -0
  104. package/dist/types/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.d.ts +82 -0
  105. package/dist/types/utils/JsViewEngineWidget/MetroWidget/PageUpdater.d.ts +31 -0
  106. package/dist/types/utils/JsViewEngineWidget/MetroWidget/RenderItem.d.ts +80 -0
  107. package/dist/types/utils/JsViewEngineWidget/MetroWidget/Slide.d.ts +25 -0
  108. package/dist/types/utils/JsViewEngineWidget/MetroWidget/SlotComponent.vue.d.ts +52 -0
  109. package/dist/types/utils/JsViewEngineWidget/MetroWidget/TaskManager.d.ts +69 -0
  110. package/dist/types/utils/JsViewEngineWidget/MetroWidget/TokenGenerator.d.ts +4 -0
  111. package/dist/types/utils/JsViewEngineWidget/MetroWidget/Utils.d.ts +6 -0
  112. package/dist/types/utils/JsViewEngineWidget/MetroWidget/VisibleInfo.d.ts +20 -0
  113. package/dist/types/utils/JsViewEngineWidget/MetroWidget/WidgetRectInfo.d.ts +21 -0
  114. package/dist/types/utils/JsViewEngineWidget/RangeModel.d.ts +166 -0
  115. package/dist/types/utils/JsViewEngineWidget/RectUtils.d.ts +61 -0
  116. package/dist/types/utils/JsViewEngineWidget/SpatialNavigator/SpatialNavProvider.vue.d.ts +74 -0
  117. package/dist/types/utils/JsViewEngineWidget/SpatialNavigator/SpatialNavigationAlgorithm.d.ts +28 -0
  118. package/dist/types/utils/JsViewEngineWidget/SpatialNavigator/SpatialNavigationNode.d.ts +23 -0
  119. package/dist/types/utils/JsViewEngineWidget/SpatialNavigator/SpatialNavigator.d.ts +46 -0
  120. package/dist/types/utils/JsViewEngineWidget/TemplateParser/CommonMetroTemplate.d.ts +42 -0
  121. package/dist/types/utils/JsViewEngineWidget/TemplateParser/Fence.d.ts +62 -0
  122. package/dist/types/utils/JsViewEngineWidget/TemplateParser/ListMetroTemplate.d.ts +21 -0
  123. package/dist/types/utils/JsViewEngineWidget/TemplateParser/MetroTemplate.d.ts +103 -0
  124. package/dist/types/utils/JsViewEngineWidget/TemplateParser/TemplateItemAdder.d.ts +28 -0
  125. package/dist/types/utils/JsViewEngineWidget/TemplateParser/index.d.ts +8 -0
  126. package/dist/types/utils/JsViewEngineWidget/WidgetCommon.d.ts +160 -0
  127. package/dist/types/utils/JsViewEngineWidget/index.d.ts +21 -0
  128. package/dist/types/utils/JsViewPlugin/JsvAccount/JsvAccount.d.ts +46 -0
  129. package/dist/types/utils/JsViewPlugin/JsvAudio/AudioProxy.d.ts +6 -0
  130. package/dist/types/utils/JsViewPlugin/JsvAudio/BrowserAudio/BrowserAudio.vue.d.ts +22 -0
  131. package/dist/types/utils/JsViewPlugin/JsvAudio/BrowserAudio/JsvSystemAudio.vue.d.ts +212 -0
  132. package/dist/types/utils/JsViewPlugin/JsvAudio/CheckType.d.ts +6 -0
  133. package/dist/types/utils/JsViewPlugin/JsvAudio/Events.d.ts +17 -0
  134. package/dist/types/utils/JsViewPlugin/JsvAudio/JsvAudio.vue.d.ts +22 -0
  135. package/dist/types/utils/JsViewPlugin/JsvAudio/JsvAudioBridgeProxy.d.ts +12 -0
  136. package/dist/types/utils/JsViewPlugin/JsvAudio/JsvAudioProxy.vue.d.ts +6 -0
  137. package/dist/types/utils/JsViewPlugin/JsvAudio/PluginLoader.d.ts +5 -0
  138. package/dist/types/utils/JsViewPlugin/JsvAudio/ScreenLockManager.d.ts +9 -0
  139. package/dist/types/utils/JsViewPlugin/JsvAudio/index.d.ts +7 -0
  140. package/dist/types/utils/JsViewPlugin/JsvAudio/version.d.mts +14 -0
  141. package/{bin/types/utils/JsViewPlugin/JsvLatex → dist/types/utils/JsViewPlugin/JsvAudio}/version.d.ts +5 -0
  142. package/dist/types/utils/JsViewPlugin/JsvLatex/BrowserDomBuilder.d.ts +0 -0
  143. package/dist/types/utils/JsViewPlugin/JsvLatex/BrowserJsvLatex.vue.d.ts +17 -0
  144. package/dist/types/utils/JsViewPlugin/JsvLatex/Color.d.ts +5 -0
  145. package/dist/types/utils/JsViewPlugin/JsvLatex/GetVersion.d.ts +18 -0
  146. package/dist/types/utils/JsViewPlugin/JsvLatex/JsvLatex.vue.d.ts +46 -0
  147. package/dist/types/utils/JsViewPlugin/JsvLatex/JsvLatexBridgeProxy.d.ts +8 -0
  148. package/dist/types/utils/JsViewPlugin/JsvLatex/JsvLatexProxy.vue.d.ts +9 -0
  149. package/dist/types/utils/JsViewPlugin/JsvLatex/PluginLoader.d.ts +5 -0
  150. package/dist/types/utils/JsViewPlugin/JsvLatex/index.d.ts +8 -0
  151. package/dist/types/utils/JsViewPlugin/JsvLatex/version.d.mts +40 -0
  152. package/dist/types/utils/JsViewPlugin/JsvPlayer/AckEventDefine.d.ts +10 -0
  153. package/dist/types/utils/JsViewPlugin/JsvPlayer/GetVersion.d.ts +13 -0
  154. package/dist/types/utils/JsViewPlugin/JsvPlayer/JsvMedia.d.ts +523 -0
  155. package/dist/types/utils/JsViewPlugin/JsvPlayer/JsvMediaBrowserInterface.d.ts +119 -0
  156. package/dist/types/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue.d.ts +664 -0
  157. package/dist/types/utils/JsViewPlugin/JsvPlayer/JsvPlayerBrowser-0.9.vue.d.ts +45 -0
  158. package/dist/types/utils/JsViewPlugin/JsvPlayer/JsvPlayerBrowser-wasm.vue.d.ts +611 -0
  159. package/dist/types/utils/JsViewPlugin/JsvPlayer/JsvPlayerBrowser.vue.d.ts +597 -0
  160. package/dist/types/utils/JsViewPlugin/JsvPlayer/index-0.9.d.ts +415 -0
  161. package/dist/types/utils/JsViewPlugin/JsvPlayer/index.d.ts +415 -0
  162. package/dist/types/utils/JsViewPlugin/JsvPlayer/version.d.mts +14 -0
  163. package/dist/types/utils/JsViewPlugin/index.d.ts +7 -0
  164. package/dist/types/utils/JsViewVueTools/BlobApi.d.ts +42 -0
  165. package/dist/types/utils/JsViewVueTools/ConstSymbol.d.ts +6 -0
  166. package/dist/types/utils/JsViewVueTools/DebugContentShellJBridge.d.ts +10 -0
  167. package/dist/types/utils/JsViewVueTools/DebugTool.d.ts +12 -0
  168. package/dist/types/utils/JsViewVueTools/DefaultKeyMap.d.ts +14 -0
  169. package/dist/types/utils/JsViewVueTools/FeatureActive.d.ts +15 -0
  170. package/dist/types/utils/JsViewVueTools/ForgeConstDefine.d.ts +15 -0
  171. package/dist/types/utils/JsViewVueTools/ForgeHandles.d.ts +11 -0
  172. package/dist/types/utils/JsViewVueTools/JsvDynamicCssStyle.d.ts +33 -0
  173. package/dist/types/utils/JsViewVueTools/JsvDynamicKeyFrames.d.ts +40 -0
  174. package/dist/types/utils/JsViewVueTools/JsvFederationTools.d.ts +20 -0
  175. package/dist/types/utils/JsViewVueTools/JsvHashHistory.d.ts +20 -0
  176. package/dist/types/utils/JsViewVueTools/JsvImpactTracer.d.ts +44 -0
  177. package/dist/types/utils/JsViewVueTools/JsvInteractionMode.d.ts +10 -0
  178. package/dist/types/utils/JsViewVueTools/JsvPerformance.d.ts +9 -0
  179. package/dist/types/utils/JsViewVueTools/JsvPreDownloader.d.ts +55 -0
  180. package/dist/types/utils/JsViewVueTools/JsvRefTaker.d.ts +52 -0
  181. package/dist/types/utils/JsViewVueTools/JsvRuntimeBridge.d.ts +378 -0
  182. package/dist/types/utils/JsViewVueTools/JsvStyleClass.d.ts +35 -0
  183. package/dist/types/utils/JsViewVueTools/JsvStyleSheetsDeclarer.d.ts +35 -0
  184. package/dist/types/utils/JsViewVueTools/JsvTextTools.d.ts +66 -0
  185. package/dist/types/utils/JsViewVueTools/JsvTextureDefines.d.ts +10 -0
  186. package/dist/types/utils/JsViewVueTools/JsvTextureLoadTool.d.ts +67 -0
  187. package/dist/types/utils/JsViewVueTools/JsvTextureStore/BitPalette/BitPalette.d.ts +47 -0
  188. package/dist/types/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/CanvasTexture.d.ts +99 -0
  189. package/dist/types/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/CommandList.d.ts +20 -0
  190. package/dist/types/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/DrawHelper.d.ts +58 -0
  191. package/dist/types/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/Path.d.ts +113 -0
  192. package/dist/types/utils/JsViewVueTools/JsvTextureStore/CapturedTexture/CapturedTexture.d.ts +17 -0
  193. package/dist/types/utils/JsViewVueTools/JsvTextureStore/JsvTextureStore.d.ts +170 -0
  194. package/dist/types/utils/JsViewVueTools/JsvTextureStore/Store.d.ts +16 -0
  195. package/dist/types/utils/JsViewVueTools/JsvTextureStore/Texture.d.ts +31 -0
  196. package/dist/types/utils/JsViewVueTools/JsvTextureStore/TextureBuilder.d.ts +53 -0
  197. package/dist/types/utils/JsViewVueTools/JsvTextureStore/index.d.ts +6 -0
  198. package/dist/types/utils/JsViewVueTools/NinePatchHelper.d.ts +25 -0
  199. package/dist/types/utils/JsViewVueTools/TextureManagerTools.d.ts +11 -0
  200. package/dist/types/utils/JsViewVueTools/TypeCheckAndSet.d.ts +7 -0
  201. package/dist/types/utils/JsViewVueTools/index.d.ts +29 -0
  202. package/dist/types/utils/JsViewVueWidget/Jsv3dDiv.vue.d.ts +124 -0
  203. package/dist/types/utils/JsViewVueWidget/Jsv3dStage.vue.d.ts +148 -0
  204. package/dist/types/utils/JsViewVueWidget/JsvActorMove/ActorControlBase.d.ts +35 -0
  205. package/dist/types/utils/JsViewVueWidget/JsvActorMove/JsvActorMove.vue.d.ts +102 -0
  206. package/dist/types/utils/JsViewVueWidget/JsvActorMove/JsvActorMoveControl.d.ts +37 -0
  207. package/dist/types/utils/JsViewVueWidget/JsvActorMove/index.d.ts +8 -0
  208. package/dist/types/utils/JsViewVueWidget/JsvApic/JsvApic/BrowserApic.vue.d.ts +15 -0
  209. package/dist/types/utils/JsViewVueWidget/JsvApic/JsvApic/JsvApic.vue.d.ts +77 -0
  210. package/dist/types/utils/JsViewVueWidget/JsvApic/JsvApic/index.d.ts +54 -0
  211. package/dist/types/utils/JsViewVueWidget/JsvApic/JsvApic2/BrowserApic2.vue.d.ts +13 -0
  212. package/dist/types/utils/JsViewVueWidget/JsvApic/JsvApic2/JsvApic2.vue.d.ts +44 -0
  213. package/dist/types/utils/JsViewVueWidget/JsvApic/JsvApic2/index.d.ts +17 -0
  214. package/dist/types/utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/ApicDataBase.d.ts +13 -0
  215. package/dist/types/utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/BrowserApicLib.d.ts +3 -0
  216. package/dist/types/utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/GifData.d.ts +5 -0
  217. package/dist/types/utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/NormalLoopTool.d.ts +7 -0
  218. package/dist/types/utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/PartLoopTool.d.ts +12 -0
  219. package/dist/types/utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/SingleLoopTool.d.ts +5 -0
  220. package/dist/types/utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/Viewer.d.ts +20 -0
  221. package/dist/types/utils/JsViewVueWidget/JsvApic/JsvBrowserApicLib/WebpData.d.ts +5 -0
  222. package/dist/types/utils/JsViewVueWidget/JsvApic/JsvCommonLoopToolBase.d.ts +26 -0
  223. package/dist/types/utils/JsViewVueWidget/JsvClipDiv/JsvClipDiv.vue.d.ts +74 -0
  224. package/dist/types/utils/JsViewVueWidget/JsvClipDiv/index.d.ts +5 -0
  225. package/dist/types/utils/JsViewVueWidget/JsvConnectLine/ArcLineManager.d.ts +5 -0
  226. package/dist/types/utils/JsViewVueWidget/JsvConnectLine/JsvConnectLine.vue.d.ts +34 -0
  227. package/dist/types/utils/JsViewVueWidget/JsvConnectLine/index.d.ts +6 -0
  228. package/dist/types/utils/JsViewVueWidget/JsvDashPath.vue.d.ts +33 -0
  229. package/dist/types/utils/JsViewVueWidget/JsvDomRenderer/JsViewHtmlToVNodesOptions.d.ts +105 -0
  230. package/dist/types/utils/JsViewVueWidget/JsvDomRenderer/JsvDomRenderer.d.ts +65 -0
  231. package/dist/types/utils/JsViewVueWidget/JsvDomRenderer/htmlToVNodes.d.ts +62 -0
  232. package/dist/types/utils/JsViewVueWidget/JsvDomRenderer/index.d.ts +5 -0
  233. package/dist/types/utils/JsViewVueWidget/JsvDragBox/JsvDragBox.vue.d.ts +109 -0
  234. package/dist/types/utils/JsViewVueWidget/JsvDriftScope/JsvDriftScope.vue.d.ts +108 -0
  235. package/dist/types/utils/JsViewVueWidget/JsvDriftScope/index.d.ts +5 -0
  236. package/dist/types/utils/JsViewVueWidget/JsvEnableRenderBreak.vue.d.ts +61 -0
  237. package/dist/types/utils/JsViewVueWidget/JsvFilterView.vue.d.ts +91 -0
  238. package/dist/types/utils/JsViewVueWidget/JsvFlexCell/JsvFlexDiv.vue.d.ts +106 -0
  239. package/dist/types/utils/JsViewVueWidget/JsvFlexCell/JsvFullScrAdjust.vue.d.ts +100 -0
  240. package/dist/types/utils/JsViewVueWidget/JsvFlexCell/JsvScreenFlex.vue.d.ts +108 -0
  241. package/dist/types/utils/JsViewVueWidget/JsvFlexCell/index.d.ts +7 -0
  242. package/dist/types/utils/JsViewVueWidget/JsvFragShaderView/JsvFragShaderView.vue.d.ts +63 -0
  243. package/dist/types/utils/JsViewVueWidget/JsvFragShaderView/index.d.ts +5 -0
  244. package/dist/types/utils/JsViewVueWidget/JsvFreeMoveActor/ActionRefObject.d.ts +4 -0
  245. package/dist/types/utils/JsViewVueWidget/JsvFreeMoveActor/ActorControl.d.ts +228 -0
  246. package/dist/types/utils/JsViewVueWidget/JsvFreeMoveActor/ActorState.d.ts +6 -0
  247. package/dist/types/utils/JsViewVueWidget/JsvFreeMoveActor/CallbackManager.d.ts +16 -0
  248. package/dist/types/utils/JsViewVueWidget/JsvFreeMoveActor/CmdTypes.d.ts +16 -0
  249. package/dist/types/utils/JsViewVueWidget/JsvFreeMoveActor/ForgeTypeDefine.d.ts +20 -0
  250. package/dist/types/utils/JsViewVueWidget/JsvFreeMoveActor/JsvEnvBlocker.vue.d.ts +106 -0
  251. package/dist/types/utils/JsViewVueWidget/JsvFreeMoveActor/JsvFreeMoveActor.vue.d.ts +107 -0
  252. package/dist/types/utils/JsViewVueWidget/JsvFreeMoveActor/KeepFlags.d.ts +11 -0
  253. package/dist/types/utils/JsViewVueWidget/JsvFreeMoveActor/NexusNode.d.ts +12 -0
  254. package/dist/types/utils/JsViewVueWidget/JsvFreeMoveActor/SetAction.d.ts +118 -0
  255. package/dist/types/utils/JsViewVueWidget/JsvFreeMoveActor/SetCondition.d.ts +244 -0
  256. package/dist/types/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.d.ts +169 -0
  257. package/dist/types/utils/JsViewVueWidget/JsvFreeMoveActor/SyncLinkManager.d.ts +22 -0
  258. package/dist/types/utils/JsViewVueWidget/JsvFreeMoveActor/index.d.ts +24 -0
  259. package/dist/types/utils/JsViewVueWidget/JsvGrid.vue.d.ts +241 -0
  260. package/dist/types/utils/JsViewVueWidget/JsvHole.d.ts +19 -0
  261. package/dist/types/utils/JsViewVueWidget/JsvInput/Cursor.vue.d.ts +16 -0
  262. package/dist/types/utils/JsViewVueWidget/JsvInput/EditViewOperator.d.ts +52 -0
  263. package/dist/types/utils/JsViewVueWidget/JsvInput/EditVisibleArea.d.ts +30 -0
  264. package/dist/types/utils/JsViewVueWidget/JsvInput/JsvInput.vue.d.ts +98 -0
  265. package/dist/types/utils/JsViewVueWidget/JsvInput/SharedDefine.d.ts +17 -0
  266. package/dist/types/utils/JsViewVueWidget/JsvInput/SystemTextTools.d.ts +20 -0
  267. package/dist/types/utils/JsViewVueWidget/JsvInput/index.d.ts +8 -0
  268. package/dist/types/utils/JsViewVueWidget/JsvLine/JsvLine.vue.d.ts +32 -0
  269. package/dist/types/utils/JsViewVueWidget/JsvLine/LineManager.d.ts +5 -0
  270. package/dist/types/utils/JsViewVueWidget/JsvLine/index.d.ts +6 -0
  271. package/dist/types/utils/JsViewVueWidget/JsvMarquee.vue.d.ts +33 -0
  272. package/dist/types/utils/JsViewVueWidget/JsvMaskClipDiv.vue.d.ts +101 -0
  273. package/dist/types/utils/JsViewVueWidget/JsvMindMap/CommonType.d.ts +1 -0
  274. package/dist/types/utils/JsViewVueWidget/JsvMindMap/Constant.d.ts +13 -0
  275. package/dist/types/utils/JsViewVueWidget/JsvMindMap/DataTree.d.ts +75 -0
  276. package/dist/types/utils/JsViewVueWidget/JsvMindMap/Geometry.d.ts +72 -0
  277. package/dist/types/utils/JsViewVueWidget/JsvMindMap/JsvMindMap.vue.d.ts +235 -0
  278. package/dist/types/utils/JsViewVueWidget/JsvMindMap/index.d.ts +5 -0
  279. package/dist/types/utils/JsViewVueWidget/JsvMindMap/rtree.d.ts +44 -0
  280. package/dist/types/utils/JsViewVueWidget/JsvNativeSharedDiv.vue.d.ts +93 -0
  281. package/dist/types/utils/JsViewVueWidget/JsvNinePatch.vue.d.ts +55 -0
  282. package/dist/types/utils/JsViewVueWidget/JsvPieChart.vue.d.ts +30 -0
  283. package/dist/types/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue.d.ts +68 -0
  284. package/dist/types/utils/JsViewVueWidget/JsvPreload/index.d.ts +6 -0
  285. package/dist/types/utils/JsViewVueWidget/JsvProgressBar.vue.d.ts +31 -0
  286. package/dist/types/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue.d.ts +85 -0
  287. package/dist/types/utils/JsViewVueWidget/JsvRadarChart.vue.d.ts +37 -0
  288. package/dist/types/utils/JsViewVueWidget/JsvRipple/Constant.d.ts +8 -0
  289. package/dist/types/utils/JsViewVueWidget/JsvRipple/JsvRipple.vue.d.ts +129 -0
  290. package/dist/types/utils/JsViewVueWidget/JsvRipple/index.d.ts +7 -0
  291. package/dist/types/utils/JsViewVueWidget/JsvScaleTextBox.vue.d.ts +28 -0
  292. package/dist/types/utils/JsViewVueWidget/JsvScrollBox/JsvScrollBox.vue.d.ts +278 -0
  293. package/dist/types/utils/JsViewVueWidget/JsvScrollBox/JsvScrollFollow.vue.d.ts +157 -0
  294. package/dist/types/utils/JsViewVueWidget/JsvScrollBox/ScrollInnerSymbol.d.ts +8 -0
  295. package/dist/types/utils/JsViewVueWidget/JsvScrollBox/ScrollSymbol.d.ts +16 -0
  296. package/dist/types/utils/JsViewVueWidget/JsvScrollBox/index.d.ts +7 -0
  297. package/dist/types/utils/JsViewVueWidget/JsvSector.vue.d.ts +30 -0
  298. package/dist/types/utils/JsViewVueWidget/JsvSmoothSlideContainer.vue.d.ts +76 -0
  299. package/dist/types/utils/JsViewVueWidget/JsvSoundPool.d.ts +114 -0
  300. package/dist/types/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue.d.ts +58 -0
  301. package/dist/types/utils/JsViewVueWidget/JsvSpriteAnim/FrameBuidler.d.ts +18 -0
  302. package/dist/types/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue.d.ts +70 -0
  303. package/dist/types/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteLoader.vue.d.ts +85 -0
  304. package/dist/types/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteTools.d.ts +15 -0
  305. package/dist/types/utils/JsViewVueWidget/JsvSpriteAnim/SpriteController.d.ts +21 -0
  306. package/dist/types/utils/JsViewVueWidget/JsvSpriteAnim/index.d.ts +9 -0
  307. package/dist/types/utils/JsViewVueWidget/JsvSpriteAnim/sAnimationToken.d.ts +6 -0
  308. package/dist/types/utils/JsViewVueWidget/JsvSwiper/Indicator.vue.d.ts +16 -0
  309. package/dist/types/utils/JsViewVueWidget/JsvSwiper/JsvSmoothSwiper.vue.d.ts +141 -0
  310. package/dist/types/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue.d.ts +248 -0
  311. package/dist/types/utils/JsViewVueWidget/JsvSwiper/JsvSwiper2.vue.d.ts +181 -0
  312. package/dist/types/utils/JsViewVueWidget/JsvSwiper/index.d.ts +8 -0
  313. package/dist/types/utils/JsViewVueWidget/JsvSwiper3D/Indicator.vue.d.ts +16 -0
  314. package/dist/types/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue.d.ts +121 -0
  315. package/dist/types/utils/JsViewVueWidget/JsvSwiper3D/index.d.ts +6 -0
  316. package/dist/types/utils/JsViewVueWidget/JsvTextBox.vue.d.ts +121 -0
  317. package/dist/types/utils/JsViewVueWidget/JsvTextureAnim/CommonType.d.ts +6 -0
  318. package/dist/types/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue.d.ts +38 -0
  319. package/dist/types/utils/JsViewVueWidget/JsvTextureAnim/index.d.ts +8 -0
  320. package/dist/types/utils/JsViewVueWidget/JsvTouchModeSwitcher.vue.d.ts +109 -0
  321. package/dist/types/utils/JsViewVueWidget/JsvVideo.vue.d.ts +23 -0
  322. package/dist/types/utils/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue.d.ts +109 -0
  323. package/dist/types/utils/JsViewVueWidget/JsvVisibleSensor/index.d.ts +88 -0
  324. package/dist/types/utils/JsViewVueWidget/TypesDiv/JsvPosterDiv.vue.d.ts +94 -0
  325. package/dist/types/utils/JsViewVueWidget/TypesDiv/JsvPosterImage.vue.d.ts +115 -0
  326. package/dist/types/utils/JsViewVueWidget/TypesDiv/JsvSmartDiv.vue.d.ts +94 -0
  327. package/dist/types/utils/JsViewVueWidget/TypesDiv/JsvSmartImage.vue.d.ts +115 -0
  328. package/dist/types/utils/JsViewVueWidget/index.d.ts +53 -0
  329. package/dist/types/utils/index.d.ts +8 -0
  330. package/dist/utils/browser/BrowserAudio.vue.mjs +258 -0
  331. package/dist/utils/browser/BrowserJsvLatex.vue.mjs +64 -0
  332. package/dist/utils/export-sfc.mjs +12 -0
  333. package/dist/utils/index.mjs +29000 -0
  334. package/dist/utils/jsview-vue-common.mjs +39 -0
  335. package/package.json +1 -1
  336. package/utils/JsViewEngineWidget/JsvFocus/JsvFocusBlock.vue +32 -16
  337. package/utils/JsViewEngineWidget/JsvFocus/JsvFocusHub.ts +51 -3
  338. package/utils/JsViewEngineWidget/MetroWidget/Const.ts +5 -0
  339. package/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue +193 -89
  340. package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +347 -145
  341. package/utils/JsViewEngineWidget/MetroWidget/MetroWidgetDebugger.ts +15 -0
  342. package/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.js +1603 -588
  343. package/utils/JsViewEngineWidget/MetroWidget/PageUpdater.ts +41 -23
  344. package/utils/JsViewEngineWidget/MetroWidget/RenderItem.ts +146 -38
  345. package/utils/JsViewEngineWidget/MetroWidget/TaskManager.ts +39 -26
  346. package/utils/JsViewEngineWidget/MetroWidget/Utils.ts +6 -0
  347. package/utils/JsViewEngineWidget/MetroWidget/WidgetRectInfo.ts +2 -1
  348. package/utils/JsViewEngineWidget/RectUtils.js +1 -1
  349. package/utils/JsViewEngineWidget/SpatialNavigator/SpatialNavProvider.vue +62 -0
  350. package/utils/JsViewEngineWidget/SpatialNavigator/SpatialNavigationAlgorithm.ts +260 -0
  351. package/utils/JsViewEngineWidget/SpatialNavigator/SpatialNavigationNode.ts +32 -0
  352. package/utils/JsViewEngineWidget/SpatialNavigator/SpatialNavigator.ts +236 -0
  353. package/utils/JsViewEngineWidget/TemplateParser/CommonMetroTemplate.ts +434 -264
  354. package/utils/JsViewEngineWidget/TemplateParser/ListMetroTemplate.ts +101 -27
  355. package/utils/JsViewEngineWidget/TemplateParser/MetroTemplate.ts +54 -5
  356. package/utils/JsViewEngineWidget/TemplateParser/TemplateItemAdder.ts +109 -41
  357. package/utils/JsViewEngineWidget/WidgetCommon.ts +29 -7
  358. package/utils/JsViewEngineWidget/index.ts +7 -2
  359. package/utils/JsViewPlugin/JsvAudio/BrowserAudio/BrowserAudio.vue +4 -0
  360. package/utils/JsViewPlugin/JsvAudio/BrowserAudio/JsvSystemAudio.vue +13 -13
  361. package/utils/JsViewPlugin/JsvLatex/BrowserDomBuilder.js +46 -46
  362. package/utils/JsViewPlugin/JsvLatex/BrowserJsvLatex.vue +54 -41
  363. package/utils/JsViewPlugin/JsvLatex/Color.ts +104 -39
  364. package/utils/JsViewPlugin/JsvLatex/GetVersion.js +65 -0
  365. package/utils/JsViewPlugin/JsvLatex/JsvLatex.vue +71 -17
  366. package/utils/JsViewPlugin/JsvLatex/JsvLatexBridgeProxy.js +10 -0
  367. package/utils/JsViewPlugin/JsvLatex/JsvLatexProxy.vue +14 -2
  368. package/utils/JsViewPlugin/JsvLatex/PluginLoader.js +63 -31
  369. package/utils/JsViewPlugin/JsvLatex/version.mjs +26 -13
  370. package/utils/JsViewPlugin/JsvPlayer/GetVersion.js +2 -1
  371. package/utils/JsViewPlugin/JsvPlayer/JsvMedia.js +402 -23
  372. package/utils/JsViewPlugin/JsvPlayer/JsvMediaBrowserInterface.js +100 -0
  373. package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +363 -468
  374. package/utils/JsViewPlugin/JsvPlayer/{BrowserJsvPlayer.vue → JsvPlayerBrowser-wasm.vue} +61 -11
  375. package/utils/JsViewPlugin/JsvPlayer/JsvPlayerBrowser.vue +511 -0
  376. package/utils/JsViewPlugin/JsvPlayer/index-0.9.js +52 -10
  377. package/utils/JsViewPlugin/JsvPlayer/index.js +58 -9
  378. package/utils/JsViewPlugin/JsvPlayer/package.json +8 -0
  379. package/utils/JsViewVueTools/BlobApi.ts +55 -0
  380. package/utils/JsViewVueTools/FeatureActive.ts +5 -1
  381. package/utils/JsViewVueTools/ForgeHandles.ts +8 -2
  382. package/utils/JsViewVueTools/JsvInteractionMode.js +16 -0
  383. package/utils/JsViewVueTools/JsvPreDownloader.ts +2 -2
  384. package/utils/JsViewVueTools/JsvRuntimeBridge.js +125 -8
  385. package/utils/JsViewVueTools/JsvTextTools.ts +12 -2
  386. package/utils/JsViewVueTools/JsvTextureStore/BitPalette/BitPalette.ts +180 -0
  387. package/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/CommandList.ts +1 -0
  388. package/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/DrawHelper.ts +304 -0
  389. package/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/Path.ts +38 -0
  390. package/utils/JsViewVueTools/JsvTextureStore/CapturedTexture/CapturedTexture.ts +30 -12
  391. package/utils/JsViewVueTools/JsvTextureStore/JsvTextureStore.ts +157 -51
  392. package/utils/JsViewVueTools/JsvTextureStore/Store.ts +33 -21
  393. package/utils/JsViewVueTools/JsvTextureStore/Texture.ts +56 -41
  394. package/utils/JsViewVueTools/JsvTextureStore/TextureBuilder.ts +92 -0
  395. package/utils/JsViewVueTools/JsvTextureStore/index.js +2 -0
  396. package/utils/JsViewVueTools/index.js +3 -1
  397. package/utils/JsViewVueWidget/JsvApic/JsvApic2/JsvApic2.vue +111 -86
  398. package/utils/JsViewVueWidget/JsvDashPath.vue +150 -0
  399. package/utils/JsViewVueWidget/JsvDomRenderer/JsViewHtmlToVNodesOptions.ts +212 -0
  400. package/utils/JsViewVueWidget/JsvDomRenderer/JsvDomRenderer.ts +146 -0
  401. package/utils/JsViewVueWidget/JsvDomRenderer/htmlToVNodes.ts +748 -0
  402. package/utils/JsViewVueWidget/JsvDomRenderer/index.ts +1 -0
  403. package/utils/JsViewVueWidget/JsvDragBox/JsvDragBox.vue +10 -1
  404. package/utils/JsViewVueWidget/JsvEnableRenderBreak.vue +6 -0
  405. package/utils/JsViewVueWidget/JsvFlexCell/JsvFlexDiv.vue +11 -5
  406. package/utils/JsViewVueWidget/JsvFlexCell/JsvFullScrAdjust.vue +3 -1
  407. package/utils/JsViewVueWidget/JsvFlexCell/JsvScreenFlex.vue +3 -1
  408. package/utils/JsViewVueWidget/JsvFragShaderView/JsvFragShaderView.vue +24 -8
  409. package/utils/JsViewVueWidget/JsvFreeMoveActor/ActorControl.ts +269 -26
  410. package/utils/JsViewVueWidget/JsvFreeMoveActor/CallbackManager.ts +2 -1
  411. package/utils/JsViewVueWidget/JsvFreeMoveActor/CmdTypes.ts +24 -0
  412. package/utils/JsViewVueWidget/JsvFreeMoveActor/ForgeTypeDefine.ts +3 -0
  413. package/utils/JsViewVueWidget/JsvFreeMoveActor/{FreeMoveActor.vue → JsvFreeMoveActor.vue} +5 -1
  414. package/utils/JsViewVueWidget/JsvFreeMoveActor/NexusNode.ts +10 -2
  415. package/utils/JsViewVueWidget/JsvFreeMoveActor/SetAction.ts +223 -100
  416. package/utils/JsViewVueWidget/JsvFreeMoveActor/SetCondition.ts +245 -64
  417. package/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.ts +95 -29
  418. package/utils/JsViewVueWidget/JsvFreeMoveActor/index.js +27 -5
  419. package/utils/JsViewVueWidget/JsvInput/EditViewOperator.ts +11 -2
  420. package/utils/JsViewVueWidget/JsvInput/JsvInput.vue +30 -2
  421. package/utils/JsViewVueWidget/JsvLine/JsvLine.vue +24 -7
  422. package/utils/JsViewVueWidget/JsvMarquee.vue +1 -1
  423. package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +12 -10
  424. package/utils/JsViewVueWidget/JsvNinePatch.vue +22 -12
  425. package/utils/JsViewVueWidget/JsvPieChart.vue +93 -70
  426. package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +34 -31
  427. package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +2 -1
  428. package/utils/JsViewVueWidget/JsvScrollBox/JsvScrollBox.vue +56 -25
  429. package/utils/JsViewVueWidget/JsvScrollBox/JsvScrollFollow.vue +11 -11
  430. package/utils/JsViewVueWidget/JsvSector.vue +66 -28
  431. package/utils/JsViewVueWidget/JsvSmoothSlideContainer.vue +108 -0
  432. package/utils/JsViewVueWidget/JsvSoundPool.js +75 -12
  433. package/utils/JsViewVueWidget/JsvSwiper/JsvSmoothSwiper.vue +543 -0
  434. package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +3 -3
  435. package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper2.vue +644 -0
  436. package/utils/JsViewVueWidget/JsvSwiper/index.js +3 -1
  437. package/utils/JsViewVueWidget/JsvTextBox.vue +30 -1
  438. package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +315 -299
  439. package/utils/JsViewVueWidget/JsvTouchModeSwitcher.vue +56 -14
  440. package/utils/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue +8 -6
  441. package/utils/JsViewVueWidget/TypesDiv/JsvPosterDiv.vue +54 -0
  442. package/utils/JsViewVueWidget/TypesDiv/JsvPosterImage.vue +88 -0
  443. package/utils/JsViewVueWidget/TypesDiv/JsvSmartDiv.vue +177 -0
  444. package/utils/JsViewVueWidget/TypesDiv/JsvSmartImage.vue +267 -0
  445. package/utils/JsViewVueWidget/index.js +9 -3
  446. package/utils/JsViewPlugin/JsvLatex/version.js +0 -24
  447. package/utils/JsViewVueWidget/JsvPosterDiv.vue +0 -56
  448. package/utils/JsViewVueWidget/JsvPosterImage.vue +0 -105
  449. /package/bin/types/utils/JsViewPlugin/JsvPlayer/{BrowserJsvPlayer-0.9.vue.d.ts → JsvPlayerBrowser-0.9.vue.d.ts} +0 -0
  450. /package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/{FreeMoveActor.vue.d.ts → JsvFreeMoveActor.vue.d.ts} +0 -0
  451. /package/utils/JsViewPlugin/JsvPlayer/{BrowserJsvPlayer-0.9.vue → JsvPlayerBrowser-0.9.vue} +0 -0
@@ -7,6 +7,11 @@ import {
7
7
  toRaw,
8
8
  nextTick,
9
9
  computed,
10
+ inject,
11
+ watch,
12
+ onActivated,
13
+ onDeactivated,
14
+ provide,
10
15
  } from "vue";
11
16
  import { Forge } from "@shijiu/jsview/dom/jsv-forge-define";
12
17
  import {
@@ -16,7 +21,7 @@ import {
16
21
  } from "../TemplateParser/index";
17
22
  import { PageUpdater } from "./PageUpdater";
18
23
  import { SingleRangeModel } from "../RangeModel";
19
- import { METRO_WIDGET_CONST } from "./Const";
24
+ import { METRO_WIDGET_CONST, ONEDGE_TYPE } from "./Const";
20
25
  import {
21
26
  EdgeDirection,
22
27
  VERTICAL,
@@ -27,23 +32,40 @@ import { RenderItem } from "./RenderItem";
27
32
  import { VisibleInfo } from "./VisibleInfo";
28
33
  import { WidgetRectInfo } from "./WidgetRectInfo";
29
34
  import ActorControl from "../../JsViewVueWidget/JsvFreeMoveActor/ActorControl.ts";
30
- import { TaskType, TaskManager, AnimationManager, SlideTaskType } from "./TaskManager.ts";
35
+ import {
36
+ TaskType,
37
+ TaskManager,
38
+ AnimationManager,
39
+ SlideTaskType,
40
+ } from "./TaskManager.ts";
31
41
  import { getDirectionByRect, RectCache } from "./Slide.ts";
32
- import { FeatureNames, JsvUseFeature } from "../../JsViewVueTools/FeatureActive.ts";
42
+ import {
43
+ FeatureNames,
44
+ JsvUseFeature,
45
+ } from "../../JsViewVueTools/FeatureActive.ts";
33
46
  import { randomColor } from "./DebugTools.ts";
47
+ import {
48
+ KEY_MODE,
49
+ TOUCH_MODE,
50
+ JsvInteractionMode,
51
+ hasJsvTouchModeSwitcher,
52
+ } from "../../JsViewVueTools/JsvInteractionMode";
53
+ import { getId } from "./Utils";
54
+ import { MW_CONTEXT_NAME } from "./Utils";
55
+ import { SPATIAL_NAV_PROVIDER_NAME } from "../SpatialNavigator/SpatialNavigator";
56
+ import { getDebugSetting } from "./MetroWidgetDebugger";
34
57
 
35
58
  const TAG = "MetroWidget";
36
59
  const LONGPRESS_TIMEOUT = 600;
37
60
  const DATA_ID_KEY = "jsvKey";
38
61
 
39
- let metroWidgetTokenGen = 1;
40
-
41
62
  const _getMetroTemplate = function (
42
63
  widgetRectInfo,
43
64
  direction,
44
65
  support_history_path,
45
66
  layout_type,
46
- mode
67
+ type,
68
+ errorLogger
47
69
  ) {
48
70
  let page_size;
49
71
  let line_max;
@@ -55,14 +77,15 @@ const _getMetroTemplate = function (
55
77
  page_size = widgetRectInfo.contentWidth;
56
78
  }
57
79
  let metroWidget;
58
- switch (mode) {
80
+ switch (type) {
59
81
  case "list":
60
82
  metroWidget = new ListMetroTemplate(
61
83
  direction,
62
84
  line_max,
63
85
  page_size,
64
86
  layout_type,
65
- support_history_path
87
+ support_history_path,
88
+ errorLogger
66
89
  );
67
90
  break;
68
91
  default:
@@ -71,15 +94,72 @@ const _getMetroTemplate = function (
71
94
  line_max,
72
95
  page_size,
73
96
  layout_type,
74
- support_history_path
97
+ support_history_path,
98
+ errorLogger
75
99
  );
76
100
  break;
77
101
  }
102
+ if (getDebugSetting().enableOverlapCheck) {
103
+ metroWidget.enableDebug(true);
104
+ }
78
105
  return metroWidget;
79
106
  };
80
107
 
81
- const TOUCH_MODE = 1; //触控模式
82
- const FOCUS_MODE = 2; //按键模式
108
+ const TouchState = {
109
+ IDLE: 0,
110
+ TAP: 1,
111
+ DRAG: 2,
112
+ FLING: 3,
113
+ };
114
+
115
+ class TouchStateMgr {
116
+ constructor(name) {
117
+ this._name = name;
118
+ this._touchState = TouchState.IDLE;
119
+ this._touchCount = 0;
120
+ }
121
+ touchStart(touchCount) {
122
+ this._touchState = TouchState.TAP;
123
+ this._touchCount = touchCount;
124
+ }
125
+ touchEnd(touchCount) {
126
+ if (touchCount == this._touchCount) {
127
+ this._touchState = TouchState.IDLE;
128
+ }
129
+ }
130
+ flingStart(touchCount) {
131
+ if (touchCount == this._touchCount) {
132
+ this._touchState = TouchState.FLING;
133
+ }
134
+ }
135
+ flingEnd(touchCount) {
136
+ if (touchCount == this._touchCount) {
137
+ this._touchState = TouchState.IDLE;
138
+ }
139
+ }
140
+ dragStart(touchCount) {
141
+ if (touchCount == this._touchCount) {
142
+ this._touchState = TouchState.DRAG;
143
+ }
144
+ }
145
+ dragEnd(touchCount) {
146
+ if (touchCount == this._touchCount) {
147
+ this._touchState = TouchState.IDLE;
148
+ }
149
+ }
150
+ duringFling() {
151
+ return this._touchState == TouchState.FLING;
152
+ }
153
+ duringTouch() {
154
+ return this._touchState != TouchState.IDLE;
155
+ }
156
+ getTouchState() {
157
+ return this._touchState;
158
+ }
159
+ getTouchCount() {
160
+ return this._touchCount;
161
+ }
162
+ }
83
163
 
84
164
  export const setup = (
85
165
  props,
@@ -93,36 +173,56 @@ export const setup = (
93
173
  pageUpdateToken,
94
174
  touchDiv,
95
175
  touchDivSize,
96
- templateMode) => {
97
-
176
+ rootDiv,
177
+ templateMode
178
+ ) => {
179
+ const errorLogger = (...args) => {
180
+ console.error(...args, `name=${props.name}`);
181
+ };
98
182
  if (props.itemConfig) {
99
- console.error(TAG, "prop: itemCofig will be deprecated soon.")
183
+ errorLogger(TAG, "prop: itemCofig will be deprecated soon.");
184
+ }
185
+
186
+ function debugLog(...args) {
187
+ console.debug(
188
+ `%cccht name:${props.name} %c`,
189
+ "background-color: #e6ffe6",
190
+ "",
191
+ ...args
192
+ );
100
193
  }
101
194
 
102
- let widgetRectInfo = new WidgetRectInfo(props.width, props.height, props.padding);
195
+ const metroWidgetId = getId();
196
+ const spatialNavigator = inject(SPATIAL_NAV_PROVIDER_NAME, undefined);
197
+ const parentMetroWidget = inject(MW_CONTEXT_NAME, undefined);
198
+
199
+ let widgetRectInfo = new WidgetRectInfo(
200
+ props.width,
201
+ props.height,
202
+ props.padding,
203
+ errorLogger
204
+ );
103
205
  let metroTemplate = _getMetroTemplate(
104
206
  widgetRectInfo,
105
207
  props.direction,
106
208
  props.supportHistoryPath,
107
209
  props.layoutType,
108
- templateMode
210
+ templateMode,
211
+ errorLogger
109
212
  );
110
213
 
111
- const TouchState = {
112
- IDLE: 0,
113
- TAP: 1,
114
- DRAG: 2,
115
- FLING: 3,
116
- };
214
+ let innerEnableRenderBreak = props.enableItemRenderBreak;
215
+ const touchEnable = computed(() => {
216
+ return props.touchFlag > 0 && hasJsvTouchModeSwitcher();
217
+ });
117
218
 
118
219
  let innerKeepTraceRange = 0;
119
220
  if (typeof props.keepTraceRange == "number" && props.keepTraceRange > 0) {
120
221
  innerKeepTraceRange = props.keepTraceRange;
121
222
  } else {
122
- if (props.touchFlag > 0) {
223
+ if (touchEnable.value) {
123
224
  // 激活引擎功能的支持
124
- JsvUseFeature('MetroWidget', FeatureNames.TouchReceiver);
125
-
225
+ JsvUseFeature("MetroWidget", FeatureNames.TouchReceiver);
126
226
  //触控默认3屏
127
227
  innerKeepTraceRange = 3;
128
228
  } else {
@@ -131,64 +231,49 @@ export const setup = (
131
231
  }
132
232
  }
133
233
 
134
- const modeForExport = ref(FOCUS_MODE);
135
- const mode = {
136
- _mode: FOCUS_MODE,
137
- _touchState: TouchState.IDLE,
138
- _touchCount: 0, // 触控流流程ID,解决fling等事件晚于新的touchDown时引起的混乱问题
139
-
140
- _duringTouch: false,
141
- _duringFling: false,
142
- touchStart(touchCount) {
143
- this._mode = TOUCH_MODE;
144
- modeForExport.value = TOUCH_MODE;
145
- this._touchState = TouchState.TAP;
146
- this._touchCount = touchCount;
147
- },
148
- touchEnd(touchCount) {
149
- if (touchCount == this._touchCount) {
150
- this._touchState = TouchState.IDLE;
151
- }
152
- },
153
- flingStart(touchCount) {
154
- if (touchCount == this._touchCount) {
155
- this._touchState = TouchState.FLING;
234
+ const onInteractionModeChange = (newMode, oldMode) => {
235
+ if (newMode === KEY_MODE) {
236
+ if (touchStateMgr.duringFling()) {
237
+ return;
156
238
  }
157
- },
158
- flingEnd(touchCount) {
159
- if (touchCount == this._touchCount) {
160
- this._touchState = TouchState.IDLE;
239
+ if (focusWhenInTouch) {
240
+ isFocus.value = true;
161
241
  }
162
- },
163
- dragStart(touchCount) {
164
- if (touchCount == this._touchCount) {
165
- this._touchState = TouchState.DRAG;
242
+ const focusItem = _getVisibleFocusableItem();
243
+ if (focusItem) {
244
+ const preFocusItem = getItemById(focusId);
245
+ _changeFocusId(focusItem.id, false);
246
+ if (preFocusItem && preFocusItem.id !== focusItem.id) {
247
+ onItemBlur(preFocusItem);
248
+ }
249
+ onItemFocus(focusItem);
166
250
  }
167
- },
168
- dragEnd(touchCount) {
169
- },
170
- keyDown() {
171
- this._mode = FOCUS_MODE;
172
- modeForExport.value = FOCUS_MODE;
173
- this._touchState = TouchState.IDLE;
174
- },
175
- duringFling() {
176
- return this._touchState == TouchState.FLING;
177
- },
178
- duringTouch() {
179
- return this._touchState != TouchState.IDLE;
180
- },
181
- getMode() {
182
- return this._mode;
183
- },
184
- getTouchState() {
185
- return this._touchState;
186
- },
187
- getTouchCount() {
188
- return this._touchCount;
251
+ } else if (newMode === TOUCH_MODE) {
252
+ //进入触控模式, 触发onBlur (onBlur中会有各种副作用, 先不触发)
253
+ // onItemBlur(getItemById(focusId));
254
+ } else {
255
+ console.error("unknown interaction mode", newMode);
189
256
  }
190
- }
257
+ };
258
+ let unwatchInteractionMode = watch(
259
+ JsvInteractionMode,
260
+ onInteractionModeChange
261
+ );
191
262
 
263
+ onActivated(() => {
264
+ if (unwatchInteractionMode) {
265
+ unwatchInteractionMode();
266
+ }
267
+ unwatchInteractionMode = watch(JsvInteractionMode, onInteractionModeChange);
268
+ });
269
+
270
+ onDeactivated(() => {
271
+ unwatchInteractionMode?.();
272
+ unwatchInteractionMode = null;
273
+ isFocus.value = false;
274
+ });
275
+
276
+ const touchStateMgr = new TouchStateMgr(props.name);
192
277
  let innerData = [];
193
278
  let dataList = [];
194
279
  let dataKeyList = [];
@@ -198,7 +283,8 @@ export const setup = (
198
283
  let focusId = 0;
199
284
  let preFocusId = -1;
200
285
  let preEdgeRect = null;
201
- let isFocus = false;
286
+ let isFocus = ref(false);
287
+ let focusWhenInTouch = false;
202
288
  let vertical = props.direction == VERTICAL;
203
289
  let templateItemAdder = null;
204
290
  let permanentItemList = [];
@@ -209,41 +295,74 @@ export const setup = (
209
295
  let onKeyDownLock = false;
210
296
  let visibleInfo = new VisibleInfo();
211
297
  let firstOnItemFocusCalled = false;
212
- let innerSlideSetting = props.slideSetting
298
+ let innerSlideSetting = props.slideSetting;
213
299
  const currentFocusIndex = ref(0);
214
300
 
215
301
  // 当sliderDiv变化时,渲染端在响应此变化前的gap记录,用于准确计算getVisibleStart
216
302
  let freeMoveSlideGapTop = 0;
217
303
  let freeMoveSlideGapLeft = 0;
218
304
 
305
+ //使用fbo加速
306
+ let rootNativeViewId = -1;
307
+ if (props.renderAcc) {
308
+ const metroWidgetBox = new Forge.MetroWidgetBoxView();
309
+ metroWidgetBox.SetEnable(true);
310
+ rootNativeViewId = Forge.sViewStore.add(
311
+ new Forge.ViewInfo(metroWidgetBox, null)
312
+ );
313
+ }
314
+
219
315
  const DEFAULT_ANIMATION_DURATION = 200;
220
316
 
221
317
  //rect {left: number, top: number, width: number, height: number }
222
- const rectVisibleState = (rect) => {
318
+ const rectVisibleState = (rect, rectStart, rectEnd) => {
223
319
  if (!rect) {
224
320
  return 0;
225
321
  }
322
+ if (typeof rectStart == "undefined") {
323
+ rectStart = visibleInfo.startWithPadding;
324
+ }
325
+ if (typeof rectEnd == "undefined") {
326
+ rectEnd = visibleInfo.endWithPadding;
327
+ }
226
328
  let pos_key = vertical ? "top" : "left";
227
329
  let size_key = vertical ? "height" : "width";
228
- if (rect[pos_key] + rect[size_key] - 1 < visibleInfo.start || rect[pos_key] > visibleInfo.end) {
330
+ if (
331
+ rect[pos_key] + rect[size_key] - 1 < rectStart ||
332
+ rect[pos_key] > rectEnd
333
+ ) {
229
334
  return 0; // 完全不可见
230
- } else if (rect[pos_key] < visibleInfo.start || rect[pos_key] + rect[size_key] - 1 > visibleInfo.end) {
335
+ } else if (
336
+ rect[pos_key] < rectStart ||
337
+ rect[pos_key] + rect[size_key] - 1 > rectEnd
338
+ ) {
231
339
  return 1; // 部分可见
232
340
  } else {
233
341
  return 2; // 完全可见
234
342
  }
235
- }
343
+ };
344
+
345
+ //判断是否是大于widget尺寸的item
346
+ const isLargeItem = (itemRect) => {
347
+ if (vertical) {
348
+ return itemRect.height > widgetRectInfo.contentHeight;
349
+ } else {
350
+ return itemRect.width > widgetRectInfo.contentWidth;
351
+ }
352
+ };
236
353
 
237
354
  //tools
238
355
  const lastOfArray = (array) => {
239
356
  if (array instanceof Array && array.length > 0) {
240
- return array[array.length - 1]
357
+ return array[array.length - 1];
241
358
  }
242
359
  return null;
243
- }
360
+ };
244
361
 
245
362
  const onAddTask = (allTask) => {
246
- if (!innerData || innerData.length <= 0) { return; }
363
+ if (!innerData || innerData.length <= 0) {
364
+ return;
365
+ }
247
366
  let resizeTaskMap = {};
248
367
  //统一处理itemResize和slide动画
249
368
  let minIndex = Infinity;
@@ -264,26 +383,32 @@ export const setup = (
264
383
  doAnim: false,
265
384
  duration: 200,
266
385
  easing: "",
267
- }
386
+ };
268
387
  let resizeList = allTask.resize.concat();
269
388
  if (resizeList.length > 0) {
270
389
  //resize
271
- resizeList.forEach(task => {
390
+ resizeList.forEach((task) => {
272
391
  resizeTaskMap[task.params.index] = task;
273
392
  const { index, animInfo } = task.params;
274
393
  if (animInfo) {
275
394
  resizeAnimInfo.doAnim = true;
276
- resizeAnimInfo.duration = animInfo.duration ?? resizeAnimInfo.duration;
277
- resizeAnimInfo.easing = animInfo.duration ?? "";
395
+ resizeAnimInfo.duration =
396
+ animInfo.duration ?? resizeAnimInfo.duration;
397
+ resizeAnimInfo.easing = animInfo.easing ?? "";
278
398
  }
279
399
  minIndex = Math.min(minIndex, index);
280
400
 
281
401
  metroTemplate.updateItemSize(task.params.index, {
282
402
  width: task.params.width,
283
403
  height: task.params.height,
284
- })
404
+ });
285
405
  });
286
406
 
407
+ if (props.fullDisplayMode) {
408
+ const totalSize = metroTemplate.getBoundingBoxSize();
409
+ visibleInfo.range = totalSize[size_key];
410
+ }
411
+
287
412
  //更新touch的size
288
413
  updateTouchDivSize();
289
414
 
@@ -292,12 +417,16 @@ export const setup = (
292
417
  const task = resizeTaskMap[id2Index(focusId)];
293
418
  const animInfo = task.params.animInfo;
294
419
  if (typeof animInfo?.anchor == "number") {
295
- const preRect = getItemById(focusId)?.templateInfo?.layoutCache.getPreRect();
420
+ const preRect =
421
+ getItemById(focusId)?.templateInfo?.layoutCache.getPreRect();
296
422
  if (preRect) {
423
+ //anchorPosition记录之前anchor的布局位置,而不是视口位置
297
424
  anchorInfo = {
298
- anchorPosition: preRect[pos_key] + preRect[size_key] * animInfo.anchor - 1 - visibleInfo.start,
425
+ anchorPosition:
426
+ preRect[pos_key] +
427
+ preRect[size_key] * animInfo.anchor - 1,
299
428
  anchor: animInfo.anchor,
300
- }
429
+ };
301
430
  }
302
431
  }
303
432
  }
@@ -310,6 +439,7 @@ export const setup = (
310
439
 
311
440
  /* 两种改变方式: 直接指定Position; 通过targetRect计算 */
312
441
  let targetRect = null;
442
+ let cachePreWhenCal = true;
313
443
  let direction = undefined;
314
444
 
315
445
  let validSlideTask = false;
@@ -322,48 +452,72 @@ export const setup = (
322
452
  slideDoAnim = slideTask.params.doAnim;
323
453
  forceSlide = slideTask.params.force;
324
454
  switch (slideTask.subType) {
325
- case SlideTaskType.SLIDE_BY_DIV: {
326
- const div = slideTask.params.div;
327
- const item_layout = div.jsvGetRelativePosition(toRaw(locateDiv.value));
328
- let fakeItem = {
329
- templateInfo: {
330
- left: item_layout.left,
331
- top: item_layout.top,
332
- width: item_layout.width,
333
- height: item_layout.height,
334
- centerYPos: Math.floor(item_layout.top + item_layout.height / 2),
335
- centerXPos: Math.floor(item_layout.left + item_layout.width / 2),
336
- index: id2Index(focusId),
337
- },
338
- };
339
- templateItemAdder.tryAddItemByPosition(vertical ? fakeItem.templateInfo.top : fakeItem.templateInfo.left);
340
- targetRect = fakeItem.templateInfo;
341
- } break;
342
- case SlideTaskType.SLIDE_BY_POS: {
343
- const position = slideTask.params.position;
344
- templateItemAdder.tryAddItemByPosition(position);
345
- targetVisibleStart = position;
346
- } break;
347
- case SlideTaskType.SLIDE_BY_ITEM: {
348
- const index = slideTask.params.index;
349
- templateItemAdder.tryAddItemByIndex(index);
350
- const targetItem = getItemByIndex(index);
351
- if (targetItem) {
455
+ case SlideTaskType.SLIDE_BY_DIV:
456
+ {
457
+ const div = slideTask.params.div;
458
+ const item_layout = div.jsvGetRelativePosition(
459
+ toRaw(locateDiv.value)
460
+ );
461
+ let fakeItem = {
462
+ templateInfo: {
463
+ left: item_layout.left,
464
+ top: item_layout.top,
465
+ width: item_layout.width,
466
+ height: item_layout.height,
467
+ centerYPos: Math.floor(
468
+ item_layout.top + item_layout.height / 2
469
+ ),
470
+ centerXPos: Math.floor(
471
+ item_layout.left + item_layout.width / 2
472
+ ),
473
+ index: id2Index(focusId),
474
+ },
475
+ };
476
+ templateItemAdder.tryAddItemByPosition(
477
+ vertical ? fakeItem.templateInfo.top : fakeItem.templateInfo.left
478
+ );
479
+ targetRect = fakeItem.templateInfo;
480
+ }
481
+ break;
482
+ case SlideTaskType.SLIDE_BY_POS:
483
+ {
484
+ const position = slideTask.params.position;
485
+ templateItemAdder.tryAddItemByPosition(position);
486
+ targetVisibleStart = position;
487
+ }
488
+ break;
489
+ case SlideTaskType.SLIDE_BY_ITEM:
490
+ {
491
+ const index = slideTask.params.index;
492
+ templateItemAdder.tryAddItemByIndex(index);
493
+ const targetItem = getItemByIndex(index);
494
+ if (targetItem.itemConfig.itemSlide != METRO_WIDGET_CONST.ITEM_SLIDE.ACT_ITEM_FOCUS) {
495
+ cachePreWhenCal = false;
496
+ }
497
+ if (targetItem) {
498
+ if (typeof slideTask.params.direction != "undefined") {
499
+ direction = slideTask.params.direction;
500
+ }
501
+ targetRect = targetItem.templateInfo;
502
+ } else {
503
+ //无效的滚动
504
+ validSlideTask = false;
505
+ }
506
+ }
507
+ break;
508
+ case SlideTaskType.SLIDE_BY_RECT:
509
+ {
352
510
  if (typeof slideTask.params.direction != "undefined") {
353
511
  direction = slideTask.params.direction;
354
512
  }
355
- targetRect = targetItem.templateInfo;
356
- } else {
357
- //无效的滚动
358
- validSlideTask = false;
359
- }
360
- } break;
361
- case SlideTaskType.SLIDE_BY_RECT: {
362
- if (typeof slideTask.params.direction != "undefined") {
363
- direction = slideTask.params.direction;
513
+ targetRect = slideTask.params.rect;
364
514
  }
365
- targetRect = slideTask.params.rect;
366
- } break;
515
+ break;
516
+ case SlideTaskType.SLIDE_BY_POS_NORMALIZE:
517
+ const position = slideTask.params.position;
518
+ templateItemAdder.tryAddItemByPosition(position);
519
+ targetVisibleStart = normalizeVisibleStart(position, visibleInfo);
520
+ break;
367
521
  default:
368
522
  break;
369
523
  }
@@ -375,26 +529,48 @@ export const setup = (
375
529
  if (anchorInfo) {
376
530
  //保持anchor
377
531
  const focusItem = getItemById(focusId);
378
- let start = focusItem.templateInfo[pos_key] + focusItem.templateInfo[size_key] * anchorInfo.anchor - 1 - anchorInfo.anchorPosition;
532
+ //新旧item anchor之间的差值
533
+ let delta = focusItem.templateInfo[pos_key] +
534
+ focusItem.templateInfo[size_key] * anchorInfo.anchor -
535
+ 1 -
536
+ anchorInfo.anchorPosition;
537
+
538
+ //delta是新旧item anchor之间的差值,需要转换为视口位置
539
+ let start = visibleInfo.start + delta;
379
540
  let totalSize = metroTemplate.getBoundingBoxSize();
380
- start = Math.min(Math.max(0, start), totalSize[size_key] - visibleInfo.range)
541
+ start = Math.min(
542
+ Math.max(0, start),
543
+ totalSize[size_key] - visibleInfo.range
544
+ );
381
545
  //resize的情况下, 需要保证第一个和最后一个尺寸变化后, 能完整展示
382
- if (focusItem.index == 0) {
383
- if (start > focusItem.templateInfo[pos_key]) {
384
- start = 0;
385
- }
386
- } else if (focusItem.templateInfo.index == metroTemplate.getTailItemIndex()) {
387
- if (start + visibleInfo.range > focusItem.templateInfo[pos_key]) {
388
- start = Math.max(focusItem.templateInfo[size_key] + focusItem.templateInfo[pos_key] - visibleInfo.range, 0);
546
+ if (JsvInteractionMode.value != TOUCH_MODE) {
547
+ if (focusItem.index == 0) {
548
+ if (start > focusItem.templateInfo[pos_key]) {
549
+ start = 0;
550
+ }
551
+ } else if (
552
+ focusItem.templateInfo.index == metroTemplate.getTailItemIndex()
553
+ ) {
554
+ if (start + visibleInfo.range > focusItem.templateInfo[pos_key]) {
555
+ start = Math.max(
556
+ focusItem.templateInfo[size_key] +
557
+ focusItem.templateInfo[pos_key] -
558
+ visibleInfo.range,
559
+ 0
560
+ );
561
+ }
389
562
  }
390
563
  }
391
- targetVisibleStart = normalizeVisibleStart(start, focusItem.templateInfo, focusItem.templateInfo.index, visibleInfo);
564
+ targetVisibleStart = normalizeVisibleStart(start, visibleInfo);
565
+ slideDoAnim = resizeAnimInfo.doAnim;
392
566
  } else {
393
- targetRect = getItemById(focusId).templateInfo;
567
+ //260410fix: 触控的时候不需要做把item移动到可见位置的逻辑
568
+ if (JsvInteractionMode.value != TOUCH_MODE) {
569
+ targetRect = getItemById(focusId)?.templateInfo;
570
+ slideDoAnim = resizeAnimInfo.doAnim;
571
+ }
394
572
  }
395
- slideDoAnim = resizeAnimInfo.doAnim;
396
573
  }
397
-
398
574
  if (targetRect) {
399
575
  const v = visibleInfo.copy();
400
576
  let preInfo = null;
@@ -403,11 +579,21 @@ export const setup = (
403
579
  preInfo = mRectCache.getPreRect();
404
580
  if (preInfo) {
405
581
  let totalSize = metroTemplate.getBoundingBoxSize();
406
- v.start = Math.min(Math.max(0, targetRect[pos_key] - preInfo[pos_key] + v.start), Math.max(0, totalSize[size_key] - v.range));
407
- preInfo[pos_key] += (v.start - visibleInfo.start);
582
+ v.start = Math.min(
583
+ v.start,
584
+ Math.max(0, totalSize[size_key] - v.range)
585
+ );
586
+ preInfo[pos_key] += v.start - visibleInfo.start;
408
587
  }
409
588
  }
410
- targetVisibleStart = _calculateVisibleStart(targetRect, direction, targetRect, v, preInfo);
589
+ targetVisibleStart = _calculateVisibleStart(
590
+ targetRect,
591
+ direction,
592
+ targetRect,
593
+ v,
594
+ preInfo,
595
+ cachePreWhenCal
596
+ );
411
597
  } else {
412
598
  //resize通过anchor直接设置了visibleStart
413
599
  if (resizeList.length > 0) {
@@ -419,7 +605,7 @@ export const setup = (
419
605
  width: tRect.width,
420
606
  height: tRect.height,
421
607
  frameCount: Forge.sFrameCount.count,
422
- })
608
+ });
423
609
  }
424
610
  }
425
611
  }
@@ -432,25 +618,30 @@ export const setup = (
432
618
  visibleInfo.start = targetVisibleStart;
433
619
  return () => {
434
620
  visibleInfo.start = preVisibleStart;
435
- }
621
+ };
436
622
  });
437
623
  }
438
624
 
439
625
  //updatePage
440
- let updateHandler
626
+ let updateHandler;
627
+ let updatePageRange = {
628
+ start: visibleInfo.startWithPadding - innerKeepTraceRange * pageRange,
629
+ end: visibleInfo.endWithPadding + innerKeepTraceRange * pageRange,
630
+ };
441
631
  taskManager.run(() => {
442
632
  updateHandler = pageUpdater.update(
443
633
  metroTemplate,
444
- visibleInfo.startWithPadding - innerKeepTraceRange * pageRange,
445
- visibleInfo.endWithPadding + innerKeepTraceRange * pageRange,
634
+ updatePageRange.start,
635
+ updatePageRange.end,
446
636
  focusId,
447
637
  mergeTmp,
448
- permanentItemList
638
+ permanentItemList,
639
+ props.fullDisplayMode
449
640
  );
450
641
  return () => {
451
642
  updateHandler.recover();
452
- }
453
- })
643
+ };
644
+ });
454
645
 
455
646
  // resize item 动画
456
647
  if (resizeList.length > 0) {
@@ -462,7 +653,8 @@ export const setup = (
462
653
  const renderItem = getItemByIndex(index);
463
654
  const { left, top } = renderItem.templateInfo;
464
655
  if (index >= minIndex) {
465
- const layoutCache = renderItem.templateInfo.layoutCache.getPreRect();
656
+ const layoutCache =
657
+ renderItem.templateInfo.layoutCache.getPreRect();
466
658
  if (layoutCache) {
467
659
  const doItemSlide = (div) => {
468
660
  taskManager.run(() => {
@@ -470,17 +662,20 @@ export const setup = (
470
662
  div,
471
663
  [layoutCache.left - left, layoutCache.top - top],
472
664
  [0, 0],
473
- resizeTaskMap[index] ?
474
- resizeTaskMap[index].params.animInfo
475
- : { duration: resizeAnimInfo.duration }
476
- )
665
+ resizeTaskMap[index]
666
+ ? resizeTaskMap[index].params.animInfo
667
+ : {
668
+ duration: resizeAnimInfo.duration,
669
+ easing: resizeAnimInfo.easing,
670
+ }
671
+ );
477
672
  return () => {
478
- cancel()
479
- }
673
+ cancel();
674
+ };
480
675
  });
481
- }
676
+ };
482
677
 
483
- if (renderItem.mounted.value) {
678
+ if (toRaw(renderItem.mounted).value) {
484
679
  doItemSlide(renderItem.rootDiv);
485
680
  } else {
486
681
  taskManager.run(() => {
@@ -501,14 +696,27 @@ export const setup = (
501
696
  let animInfo = undefined;
502
697
  if (slideDoAnim) {
503
698
  animInfo = {
504
- easing: null,//resizeAnimInfo.doAnim ? resizeAnimInfo.easing : '' /* innerSlideSetting.Easing */,
505
- duration: resizeAnimInfo.doAnim ? resizeAnimInfo.duration : innerSlideSetting.Duration,
699
+ easing: resizeAnimInfo.doAnim
700
+ ? resizeAnimInfo.easing
701
+ : innerSlideSetting.Easing /* innerSlideSetting.Easing */,
702
+ duration: resizeAnimInfo.doAnim
703
+ ? resizeAnimInfo.duration
704
+ : innerSlideSetting.Duration,
506
705
  speed: innerSlideSetting.Speed,
507
706
  onStart: null,
508
707
  onEnd: null,
509
- }
708
+ };
709
+ }
710
+ executeSlide(visibleInfo.start, animInfo, updateHandler);
711
+ } else {
712
+ //不滚动的时候检查是否已经更新可视的item
713
+ const applyedRange = pageUpdater.getApplyedRange();
714
+ if (
715
+ applyedRange.start != updatePageRange.start ||
716
+ applyedRange.end != updatePageRange.end
717
+ ) {
718
+ updateHandler.apply();
510
719
  }
511
- executeSlide(visibleInfo.start, animInfo, updateHandler)
512
720
  }
513
721
 
514
722
  //回调
@@ -519,8 +727,8 @@ export const setup = (
519
727
  }, 0);
520
728
  return () => {
521
729
  clearTimeout(handler);
522
- }
523
- })
730
+ };
731
+ });
524
732
  }
525
733
  if ((needSlide || allTask.focus.length > 0) && props.onFocusRectChange) {
526
734
  taskManager.run(() => {
@@ -529,10 +737,20 @@ export const setup = (
529
737
  }, 0);
530
738
  return () => {
531
739
  clearTimeout(handler);
532
- }
533
- })
740
+ };
741
+ });
534
742
  }
535
- }
743
+ if (resizeList.length > 0 && props.onSizeChange) {
744
+ taskManager.run(() => {
745
+ const handler = setTimeout(() => {
746
+ _onSizeChange();
747
+ }, 0);
748
+ return () => {
749
+ clearTimeout(handler);
750
+ };
751
+ });
752
+ }
753
+ };
536
754
  const taskManager = new TaskManager(onAddTask);
537
755
  const animationManager = new AnimationManager();
538
756
 
@@ -545,12 +763,14 @@ export const setup = (
545
763
  return () => {
546
764
  slideDivLeft.value = preLeft;
547
765
  slideDivTop.value = preTop;
548
- }
766
+ };
549
767
  });
550
768
  if (animObj) {
551
769
  updateHandler.applyTmp();
552
770
  taskManager.run(() => {
553
- const from = vertical ? [0, preTop - slideDivTop.value] : [preLeft - slideDivLeft.value, 0];
771
+ const from = vertical
772
+ ? [0, preTop - slideDivTop.value]
773
+ : [preLeft - slideDivLeft.value, 0];
554
774
  const cancel = animationManager.startSlideAnim(
555
775
  slideDiv.value,
556
776
  from,
@@ -558,45 +778,49 @@ export const setup = (
558
778
  {
559
779
  ...animObj,
560
780
  onEnd: () => {
561
- updateHandler.apply()
562
- }
781
+ updateHandler.apply();
782
+ },
563
783
  }
564
784
  );
565
785
  return () => {
566
- cancel()
567
- }
786
+ cancel();
787
+ };
568
788
  });
569
789
  } else {
570
790
  updateHandler.apply();
571
791
  }
792
+ _syncOnScroll();
572
793
  taskManager.run(() => {
573
794
  const handler = setTimeout(() => {
574
795
  _onScroll();
575
796
  }, 0);
576
797
  return () => {
577
798
  clearTimeout(handler);
578
- }
579
- })
580
- }
799
+ };
800
+ });
801
+ };
581
802
 
582
803
  const updateItemSize = (index, newSize, animInfo) => {
583
804
  const item = getItemByIndex(index);
584
- if (item && (item.templateInfo.width !== newSize.width || item.templateInfo.height !== newSize.height)) {
585
- taskManager.addTask(TaskType.RESIZE_ITEM,
586
- {
587
- index,
588
- width: newSize.width,
589
- height: newSize.height,
590
- animInfo,
591
- preRect: {
592
- left: item.templateInfo.left,
593
- top: item.templateInfo.top,
594
- width: item.templateInfo.width,
595
- height: item.templateInfo.height,
596
- },
597
- });
805
+ if (
806
+ item &&
807
+ (item.templateInfo.width !== newSize.width ||
808
+ item.templateInfo.height !== newSize.height)
809
+ ) {
810
+ taskManager.addTask(TaskType.RESIZE_ITEM, {
811
+ index,
812
+ width: newSize.width,
813
+ height: newSize.height,
814
+ animInfo,
815
+ preRect: {
816
+ left: item.templateInfo.left,
817
+ top: item.templateInfo.top,
818
+ width: item.templateInfo.width,
819
+ height: item.templateInfo.height,
820
+ },
821
+ });
598
822
  }
599
- }
823
+ };
600
824
 
601
825
  let callFocusAfterUpdate = false;
602
826
 
@@ -613,6 +837,18 @@ export const setup = (
613
837
  };
614
838
  };
615
839
 
840
+ const _getPostionRelativeToRoot = (index) => {
841
+ let templateInfo = getItemByIndex(index).templateInfo;
842
+ let x_offset = vertical ? 0 : -visibleInfo.start;
843
+ let y_offset = vertical ? -visibleInfo.start : 0;
844
+ return {
845
+ left: templateInfo.left + x_offset + widgetRectInfo.padding.left,
846
+ top: templateInfo.top + y_offset + widgetRectInfo.padding.top,
847
+ width: templateInfo.width,
848
+ height: templateInfo.height,
849
+ };
850
+ };
851
+
616
852
  const _getPosition = (index) => {
617
853
  let templateInfo = getItemByIndex(index).templateInfo;
618
854
  let x_offset = vertical ? 0 : -visibleInfo.start;
@@ -682,39 +918,60 @@ export const setup = (
682
918
  };
683
919
 
684
920
  const onItemClick = (item) => {
685
- if (!item) { return };
686
- if (isFocus) {
921
+ if (!item) {
922
+ return;
923
+ }
924
+ if (isFocus.value) {
687
925
  item.onClick();
688
926
  }
689
927
  };
690
928
 
691
929
  const onItemBlur = (blurItem) => {
692
930
  if (!blurItem) return;
693
- setItemZIndex(blurItem, 0, false);
694
- if (isFocus) {
931
+ if (isFocus.value) {
695
932
  blurItem.onBlur();
696
933
  }
697
934
  };
698
935
 
699
- let gazeIndex = -1
936
+ const onItemIgnore = (item) => {
937
+ if (!item) return;
938
+ setItemZIndex(item, 0, false);
939
+ item.onIgnore();
940
+ }
941
+
942
+ let gazeIndex = -1;
943
+ let preGazeIndex = -1;
944
+ let callGazeAfterUpdate = false;
945
+ const onItemGaze = (item, rect) => {
946
+ if (!item || item.index == gazeIndex) { return; }
947
+ setItemZIndex(item, innerData.length, true);
948
+ preGazeIndex = gazeIndex;
949
+ gazeIndex = item.index;
950
+ if (toRaw(item.mounted).value) {
951
+ item.onGaze(rect);
952
+ } else {
953
+ callGazeAfterUpdate = true;
954
+ }
955
+ }
956
+
957
+ let topZItemIndex = -1;
700
958
  const onItemFocus = (focusItem, rect) => {
701
959
  //触控模式不触发item的onFocus
702
- if (!focusItem) return;
960
+ if (!focusItem) return false;
961
+ if (topZItemIndex != focusItem.index) {
962
+ setItemZIndex(getItemByIndex(topZItemIndex), 0, false);
963
+ }
703
964
  setItemZIndex(focusItem, innerData.length, true);
704
- if (isFocus) {
965
+ topZItemIndex = focusItem.index;
966
+ if (JsvInteractionMode.value == KEY_MODE && isFocus.value) {
705
967
  _itemOnFocusSideEffect(focusItem, rect);
968
+ if (spatialNavigator) {
969
+ spatialNavigator.setFocus(focusItem.getSpatialNavNode());
970
+ }
706
971
  }
707
972
 
708
- if (focusItem.mounted.value) {
709
- if (gazeIndex != focusItem.templateInfo.index) {
710
- let preGazeItem = getItemByIndex(gazeIndex);
711
- if (preGazeItem) {
712
- preGazeItem.onIgnore();
713
- }
714
- gazeIndex = focusItem.templateInfo.index
715
- focusItem.onGaze(rect);
716
- }
717
- if (isFocus) {
973
+ if (toRaw(focusItem.mounted).value) {
974
+ if (JsvInteractionMode.value == KEY_MODE && isFocus.value) {
718
975
  focusItem.onFocus(rect);
719
976
  }
720
977
  return true;
@@ -725,14 +982,35 @@ export const setup = (
725
982
  };
726
983
 
727
984
  const onItemLongPress = (item) => {
728
- if (!item) { return; }
729
- if (isFocus) {
985
+ if (!item) {
986
+ return;
987
+ }
988
+ if (isFocus.value) {
730
989
  item.onLongPress();
731
990
  }
732
- }
991
+ };
992
+
993
+ //tap的时候触发ongaze
994
+ const onItemTap = (gazeItem) => {
995
+ if (gazeIndex != gazeItem.templateInfo.index) {
996
+ let preGazeItem = getItemByIndex(gazeIndex);
997
+ if (preGazeItem) {
998
+ onItemIgnore(preGazeItem);
999
+ }
1000
+ gazeIndex = gazeItem.templateInfo.index;
1001
+ gazeItem.onGaze(null);
1002
+ }
1003
+ };
733
1004
 
734
- const setFocusByUid = (uid, needSlide = true, doAnim = false, extraSetting) => {
735
- if (!uid || innerData.length <= 0) { return; }
1005
+ const setFocusByUid = (
1006
+ uid,
1007
+ needSlide = true,
1008
+ doAnim = false,
1009
+ extraSetting
1010
+ ) => {
1011
+ if (!uid || innerData.length <= 0) {
1012
+ return;
1013
+ }
736
1014
  //添加item
737
1015
  templateItemAdder.tryAddItemByUid(uid);
738
1016
  const item = metroTemplate.getItemByUid(uid);
@@ -742,12 +1020,13 @@ export const setup = (
742
1020
  }
743
1021
 
744
1022
  setFocusId(item.id, needSlide, doAnim, extraSetting);
745
- }
1023
+ };
746
1024
 
747
1025
  const setFocusId = (id, needSlide = true, doAnim = false, extraSetting) => {
748
1026
  if (id == focusId || innerData.length <= 0) {
749
1027
  return;
750
1028
  }
1029
+ mRectCache.clean();
751
1030
  //有外部触发的滚动时, 取消load
752
1031
  tryCancelDelayLoad();
753
1032
  templateItemAdder.tryAddItemById(id);
@@ -756,7 +1035,9 @@ export const setup = (
756
1035
  const nextTemplateInfo = next_focus_item.templateInfo;
757
1036
  _changeFocusId(nextTemplateInfo.id);
758
1037
  const preFocusItem = getItemById(preFocusId);
1038
+ onItemIgnore(preFocusItem)
759
1039
  onItemBlur(preFocusItem);
1040
+ onItemGaze(next_focus_item, preEdgeRect);
760
1041
  onItemFocus(next_focus_item, preEdgeRect);
761
1042
  if (needSlide) {
762
1043
  slideToItem(id2Index(id), doAnim);
@@ -768,19 +1049,20 @@ export const setup = (
768
1049
  }
769
1050
  }
770
1051
 
771
- const curTemplateInfo = getItemById(focusId).templateInfo;
772
-
773
- let x_off_set = curTemplateInfo.left - nextTemplateInfo.left;
774
- let y_off_set = curTemplateInfo.top - nextTemplateInfo.top;
775
- preEdgeRect = {
776
- direction: null,
777
- rect: {
778
- x: x_off_set,
779
- y: y_off_set,
780
- width: curTemplateInfo.width,
781
- height: curTemplateInfo.height,
782
- },
783
- };
1052
+ const curTemplateInfo = getItemById(focusId)?.templateInfo;
1053
+ if (curTemplateInfo) {
1054
+ let x_off_set = curTemplateInfo.left - nextTemplateInfo.left;
1055
+ let y_off_set = curTemplateInfo.top - nextTemplateInfo.top;
1056
+ preEdgeRect = {
1057
+ direction: null,
1058
+ rect: {
1059
+ x: x_off_set,
1060
+ y: y_off_set,
1061
+ width: curTemplateInfo.width,
1062
+ height: curTemplateInfo.height,
1063
+ },
1064
+ };
1065
+ }
784
1066
  unlock?.();
785
1067
  }
786
1068
  };
@@ -840,20 +1122,35 @@ export const setup = (
840
1122
  const setZIndex = (index, normalZIndex, focusZIndex) => {
841
1123
  const targetItem = getItemByIndex(index);
842
1124
  if (targetItem) {
843
- const n = normalZIndex, f = focusZIndex ?? normalZIndex;
1125
+ const n = normalZIndex,
1126
+ f = focusZIndex ?? normalZIndex;
844
1127
 
845
1128
  targetItem.itemConfig.focusZIndex = f;
846
1129
  targetItem.itemConfig.normalZIndex = n;
847
- const focused = isFocus && focusId == index2Id(index);
1130
+ const focused = isFocus.value && focusId == index2Id(index);
848
1131
  setItemZIndex(targetItem, focused ? f : n, focused);
849
1132
  }
850
- }
1133
+ };
851
1134
 
852
- const slideToInner = (position, doAnim, updateParam = { mergeTmp: false }) => {
853
- if (slideLock || position == (vertical ? slideDivTop.value : slideDivLeft.value)) {
854
- return
855
- };
856
- taskManager.addTask(TaskType.SLIDE, { position, doAnim, updateParam }, SlideTaskType.SLIDE_BY_POS);
1135
+ const slideToInner = (
1136
+ position,
1137
+ doAnim,
1138
+ updateParam = { mergeTmp: false }
1139
+ ) => {
1140
+ if (props.fullDisplayMode) {
1141
+ return;
1142
+ }
1143
+ if (
1144
+ slideLock ||
1145
+ position == (vertical ? slideDivTop.value : slideDivLeft.value)
1146
+ ) {
1147
+ return;
1148
+ }
1149
+ taskManager.addTask(
1150
+ TaskType.SLIDE,
1151
+ { position, doAnim, updateParam },
1152
+ SlideTaskType.SLIDE_BY_POS
1153
+ );
857
1154
  };
858
1155
 
859
1156
  const slideTo = (position, doAnim) => {
@@ -862,7 +1159,16 @@ export const setup = (
862
1159
  }
863
1160
  };
864
1161
 
865
- const slideToItemInner = (index, doAnim, direction = undefined, preItem = undefined, force = false) => {
1162
+ const slideToItemInner = (
1163
+ index,
1164
+ doAnim,
1165
+ direction = undefined,
1166
+ preItem = undefined,
1167
+ force = false
1168
+ ) => {
1169
+ if (props.fullDisplayMode) {
1170
+ return;
1171
+ }
866
1172
  taskManager.addTask(
867
1173
  TaskType.SLIDE,
868
1174
  {
@@ -872,16 +1178,20 @@ export const setup = (
872
1178
  preItem,
873
1179
  force,
874
1180
  },
875
- SlideTaskType.SLIDE_BY_ITEM);
1181
+ SlideTaskType.SLIDE_BY_ITEM
1182
+ );
876
1183
  };
877
1184
  const slideToItem = (index, doAnim) => {
878
- slideToItemInner(index, doAnim)
879
- }
1185
+ slideToItemInner(index, doAnim);
1186
+ };
880
1187
 
881
1188
  const slideToDiv = (div, doAnim) => {
882
1189
  slideToDivInner(div, doAnim);
883
- }
1190
+ };
884
1191
  const slideToDivInner = (div, doAnim, direction = undefined) => {
1192
+ if (props.fullDisplayMode) {
1193
+ return;
1194
+ }
885
1195
  if (div) {
886
1196
  taskManager.addTask(
887
1197
  TaskType.SLIDE,
@@ -890,37 +1200,61 @@ export const setup = (
890
1200
  doAnim,
891
1201
  direction,
892
1202
  },
893
- SlideTaskType.SLIDE_BY_DIV);
1203
+ SlideTaskType.SLIDE_BY_DIV
1204
+ );
894
1205
  }
895
- }
1206
+ };
896
1207
  const slideToRectInner = (rect, doAnim, direction, force) => {
897
- if (rect && typeof rect.left == "number" && typeof rect.top == "number" && typeof rect.width == "number" && typeof rect.height == "number") {
1208
+ if (props.fullDisplayMode) {
1209
+ return;
1210
+ }
1211
+ if (
1212
+ rect &&
1213
+ typeof rect.left == "number" &&
1214
+ typeof rect.top == "number" &&
1215
+ typeof rect.width == "number" &&
1216
+ typeof rect.height == "number"
1217
+ ) {
898
1218
  taskManager.addTask(
899
1219
  TaskType.SLIDE,
900
1220
  {
901
1221
  rect,
902
1222
  doAnim,
903
1223
  direction,
904
- force
1224
+ force,
905
1225
  },
906
1226
  SlideTaskType.SLIDE_BY_RECT
907
1227
  );
908
1228
  }
909
- }
1229
+ };
1230
+
1231
+ const slideToNormalize = (position, doAnim) => {
1232
+ if (props.fullDisplayMode) {
1233
+ return;
1234
+ }
1235
+ taskManager.addTask(
1236
+ TaskType.SLIDE,
1237
+ { position, doAnim },
1238
+ SlideTaskType.SLIDE_BY_POS_NORMALIZE
1239
+ );
1240
+ };
1241
+
910
1242
  const slideToRect = (rect, doAnim, direction = undefined) => {
911
1243
  slideToRectInner(rect, doAnim, direction, false);
912
- }
1244
+ };
913
1245
 
914
1246
  function ifLayoutChange(type, oldMeasureItem, newMeasureItem) {
915
- let changed = newMeasureItem.width !== oldMeasureItem.width
916
- || newMeasureItem.height !== oldMeasureItem.height
917
- || newMeasureItem.focusable !== oldMeasureItem.focusable
918
- || newMeasureItem.marginRight !== oldMeasureItem.marginRight
919
- || newMeasureItem.marginBottom !== oldMeasureItem.marginBottom;
1247
+ let changed =
1248
+ newMeasureItem.width !== oldMeasureItem.width ||
1249
+ newMeasureItem.height !== oldMeasureItem.height ||
1250
+ newMeasureItem.focusable !== oldMeasureItem.focusable ||
1251
+ newMeasureItem.marginRight !== oldMeasureItem.marginRight ||
1252
+ newMeasureItem.marginBottom !== oldMeasureItem.marginBottom;
920
1253
  if (type !== "relative") {
921
- changed = changed
922
- || newMeasureItem.left !== oldMeasureItem.left
923
- || newMeasureItem.top !== oldMeasureItem.top
1254
+ changed =
1255
+ changed ||
1256
+ newMeasureItem.left !== oldMeasureItem.left ||
1257
+ newMeasureItem.top !== oldMeasureItem.top;
924
1258
  }
925
1259
  return changed;
926
1260
  }
@@ -933,78 +1267,86 @@ export const setup = (
933
1267
  const refreshData = (forceUpdate, slideToFocus = "auto") => {
934
1268
  //由于data不支持reactive, 因此数据的更新只通过provideData
935
1269
  if (!props.provideData) {
936
- console.error("refreshData: provideData is null.");
1270
+ errorLogger("refreshData: provideData is null.");
937
1271
  return;
938
1272
  }
939
1273
  try {
940
1274
  let newData = toRaw(safeProvideData()).concat();
941
1275
  if (newData instanceof Array) {
942
1276
  let maxSameIndex = -1;
943
- let layoutChange = false;
1277
+ let layoutChange = 0; //0: 不需要更新布局, 1: 需要更新布局, 2: 仅删除数据
944
1278
  let onlyDataChangeList = [];
945
- let targetFocusId = focusId
946
- if (focusId >= newData.length) {
947
- targetFocusId = newData.length - 1
948
- }
949
-
950
- if (!forceUpdate) {
951
- for (let i = 0; i < dataList.length; ++i) {
952
- let oldItem = dataList[i];
953
- let newItem = newData[i];
954
- if (newItem) {
955
- if (((typeof newItem[DATA_ID_KEY] == "undefined" || typeof dataKeyList[i] == "undefined") && newItem === oldItem)
956
- || (typeof newItem[DATA_ID_KEY] !== "undefined" && typeof dataKeyList[i] !== "undefined" && newItem[DATA_ID_KEY] === dataKeyList[i])) {
957
- //相同的item
958
- maxSameIndex = Math.max(maxSameIndex, i);
959
- } else {
960
- const newMeasureItem = props.measures(newItem);
961
- const oldMeasureItem = props.measures(oldItem);
962
- layoutChange = ifLayoutChange(props.layoutType, oldMeasureItem, newMeasureItem);
963
- if (layoutChange) {
964
- break;
1279
+ let preGazeId = index2Id(gazeIndex);
1280
+ let targetFocusId = focusId;
1281
+ let targetGazeIndex = gazeIndex;
1282
+ let curFocusItemChanged = true;
1283
+ if (newData.length == 0) {
1284
+ layoutChange = 1;
1285
+ cleanFocusStatus();
1286
+ } else {
1287
+ if (!forceUpdate) {
1288
+ const curFocusIndex = id2Index(focusId);
1289
+ for (let i = 0; i < dataList.length; ++i) {
1290
+ let oldItem = dataList[i];
1291
+ let newItem = newData[i];
1292
+ if (newItem) {
1293
+ if (
1294
+ ((typeof newItem[DATA_ID_KEY] == "undefined" ||
1295
+ typeof dataKeyList[i] == "undefined") &&
1296
+ newItem === oldItem) ||
1297
+ (typeof newItem[DATA_ID_KEY] !== "undefined" &&
1298
+ typeof dataKeyList[i] !== "undefined" &&
1299
+ newItem[DATA_ID_KEY] === dataKeyList[i])
1300
+ ) {
1301
+ //相同的item
1302
+ maxSameIndex = Math.max(maxSameIndex, i);
1303
+ if (curFocusIndex == i) {
1304
+ curFocusItemChanged = false;
1305
+ }
965
1306
  } else {
966
- if (i < innerData.length) {
967
- onlyDataChangeList.push({
968
- templateInfo: innerData[i].templateInfo,
969
- measureObj: newMeasureItem,
970
- data: newItem,
971
- index: i,
972
- });
1307
+ const newMeasureItem = props.measures(newItem);
1308
+ const oldMeasureItem = props.measures(oldItem);
1309
+ const changed = ifLayoutChange(
1310
+ props.layoutType,
1311
+ oldMeasureItem,
1312
+ newMeasureItem
1313
+ );
1314
+ if (changed) {
1315
+ layoutChange = 1;
1316
+ break;
1317
+ } else {
1318
+ if (i < innerData.length) {
1319
+ onlyDataChangeList.push({
1320
+ templateInfo: innerData[i].templateInfo,
1321
+ measureObj: newMeasureItem,
1322
+ data: newItem,
1323
+ index: i,
1324
+ });
1325
+ }
973
1326
  }
974
1327
  }
975
- }
976
- } else {
977
- if (i >= newData.length) {
978
- //item减少需要布局改变
979
- layoutChange = true;
980
- break;
981
1328
  } else {
982
- //数据中存在undefined item
983
- throw new Error("undefined item in data list.", i, newData);
1329
+ if (i >= newData.length) {
1330
+ //item减少需要布局改变
1331
+ layoutChange = 2;
1332
+ break;
1333
+ } else {
1334
+ //数据中存在undefined item
1335
+ errorLogger("undefined item in data list.");
1336
+ throw new Error("undefined item in data list.", i, newData);
1337
+ }
984
1338
  }
985
1339
  }
986
1340
  }
987
1341
  }
988
1342
 
989
- //记录刷新前焦点的可视状态, 若焦点可视, 则刷新后也需要保证焦点的可视
990
- let needSlide = false;
991
- if (slideToFocus == "enable") {
992
- needSlide = true;
993
- } else if (slideToFocus == "disable") {
994
- needSlide = false;
995
- } else {
996
- let targetRect = mRectCache.getCurRect() ?? mRectCache.getPreRect();
997
- if (targetRect) {
998
- needSlide = rectVisibleState(targetRect) !== 0;
999
- } else {
1000
- needSlide = rectVisibleState(getItemById(focusId)?.templateInfo) !== 0;
1001
- }
1002
- }
1003
-
1343
+ //判断是否需要重新onGaze
1344
+ let needReOnGaze = false;
1345
+ //更新template
1346
+ const oldDataCount = dataList.length;
1004
1347
  dataList = newData;
1005
- dataKeyList = dataList.map(i => i[DATA_ID_KEY]);
1006
-
1007
- if (forceUpdate || layoutChange) {
1348
+ dataKeyList = dataList.map((i) => i[DATA_ID_KEY]);
1349
+ if (forceUpdate || layoutChange == 1) {
1008
1350
  //需要更新布局
1009
1351
  pageUpdateToken.value++;
1010
1352
  //数据更改
@@ -1014,7 +1356,8 @@ export const setup = (
1014
1356
  props.direction,
1015
1357
  props.supportHistoryPath,
1016
1358
  props.layoutType,
1017
- templateMode
1359
+ templateMode,
1360
+ errorLogger
1018
1361
  );
1019
1362
  innerData = [];
1020
1363
  templateItemAdder = new TemplateItemAdder(
@@ -1024,73 +1367,179 @@ export const setup = (
1024
1367
  pageRange,
1025
1368
  _onTemplateItemAdd,
1026
1369
  props.name,
1027
- _onTemplateAddDone
1370
+ getOnTemplateAddDone(true),
1371
+ errorLogger
1028
1372
  );
1029
- if (props.onScroll) {
1030
- templateItemAdder.tryAddItemByIndex(dataList.length - 1);
1373
+ if (props.onScroll || touchEnable.value || props.fullDisplayMode) {
1374
+ templateItemAdder.tryAddItemByIndex(dataList.length - 1, getOnTemplateAddDone(false));
1031
1375
  } else {
1032
- templateItemAdder.tryAddItemById(targetFocusId);
1376
+ //加到旧数据的个数,保险一点
1377
+ templateItemAdder.tryAddItemByIndex(Math.min(dataList.length, oldDataCount), getOnTemplateAddDone(false));
1033
1378
  }
1379
+ needReOnGaze = true;
1380
+ } else if (layoutChange == 2) {
1381
+ //仅删除
1382
+ templateItemAdder.removeItemTo(dataList.length);
1383
+ innerData.splice(dataList.length);
1034
1384
  } else {
1385
+ templateItemAdder.updateData(newData);
1035
1386
  if (maxSameIndex < newData.length - 1) {
1036
1387
  //追加数据
1037
- templateItemAdder.updateData(newData);
1038
- if (props.onScroll) {
1039
- templateItemAdder.tryAddItemByIndex(dataList.length - 1);
1388
+ if (props.onScroll || touchEnable.value || props.fullDisplayMode) {
1389
+ templateItemAdder.tryAddItemByIndex(dataList.length - 1, getOnTemplateAddDone(false));
1040
1390
  } else {
1041
- templateItemAdder.tryAddItemById(targetFocusId);
1391
+ templateItemAdder.tryAddItemByIndex(Math.min(dataList.length, oldDataCount), getOnTemplateAddDone(false));
1042
1392
  }
1043
1393
  }
1394
+ }
1395
+ //更新focudId 和 gazeIndex
1396
+ let lastFocusableItemId = metroTemplate.idsMap.length - 1;
1044
1397
 
1045
- //仅用户数据变更
1046
- if (onlyDataChangeList.length > 0) {
1047
- for (let i of onlyDataChangeList) {
1048
- if (i.index < innerData.length) {
1049
- innerData[i.index].updateCustomData(i.data, _getItemConfigFromMeasursObj(i.measureObj));
1050
- innerData[i.index].enableTap = i.measureObj.enableTap ?? false;
1051
- } else {
1052
- //之后的数据未布局, 尚未添加到innerData中
1053
- break;
1398
+ if (lastFocusableItemId < 0) {
1399
+ targetFocusId = -1;
1400
+ targetGazeIndex = -1;
1401
+ } else {
1402
+ targetFocusId = Math.max(0, Math.min(lastFocusableItemId, focusId));
1403
+ targetGazeIndex = id2Index(Math.max(0, Math.min(lastFocusableItemId, preGazeId)));
1404
+ }
1405
+
1406
+ //仅用户数据变更
1407
+ if (onlyDataChangeList.length > 0) {
1408
+ for (let i of onlyDataChangeList) {
1409
+ if (i.index < innerData.length) {
1410
+ if (i.index == gazeIndex) {
1411
+ needReOnGaze = true;
1054
1412
  }
1413
+ innerData[i.index].updateCustomData(
1414
+ i.data,
1415
+ _getItemConfigFromMeasursObj(i.measureObj)
1416
+ );
1417
+ innerData[i.index].enableTap = i.measureObj.enableTap ?? false;
1418
+ } else {
1419
+ //之后的数据未布局, 尚未添加到innerData中
1420
+ break;
1055
1421
  }
1056
1422
  }
1057
1423
  }
1058
1424
 
1059
- if (targetFocusId != focusId) {
1060
- //重置所有的滚动信息
1061
- _changeFocusId(targetFocusId, false);
1062
- visibleInfo = visibleInfo.copy();
1063
- visibleInfo.start = 0;
1064
- visibleInfo._startMax = 0;
1065
- slideDivLeft.value = 0;
1066
- slideDivTop.value = 0;
1067
- }
1425
+ //数据更新,清理缓存的范围信息,避免旧的范围与新的有冲突
1426
+ pageUpdater.cleanCache();
1427
+ //更新可视
1068
1428
  const updater = pageUpdater.update(
1069
1429
  metroTemplate,
1070
1430
  visibleInfo.startWithPadding - innerKeepTraceRange * pageRange,
1071
1431
  visibleInfo.endWithPadding + innerKeepTraceRange * pageRange,
1072
- focusId,
1432
+ index2Id(targetGazeIndex),
1073
1433
  false,
1074
- permanentItemList
1434
+ permanentItemList,
1435
+ props.fullDisplayMode
1075
1436
  );
1076
1437
  updater.apply();
1438
+ if (!renderData.value.some((i) => i.templateInfo.index == gazeIndex)) {
1439
+ needReOnGaze = false;
1440
+ }
1441
+
1442
+ let preVisibleStart = visibleInfo.start;
1443
+
1444
+ if (targetGazeIndex != gazeIndex || layoutChange == 2) {
1445
+ //仅在删除数据的时候更新, 其他情况都保留之前的滚动信息
1446
+ //由于template add done 回调里会更新box, 需要在template重新创建前, 重置所有的滚动信息
1447
+ visibleInfo = visibleInfo.copy();
1448
+ visibleInfo.start = 0;
1449
+ visibleInfo._startMax = 0;
1450
+ slideDivLeft.value = 0;
1451
+ slideDivTop.value = 0;
1452
+ }
1453
+
1454
+ let needSlide = false;
1455
+ let targetRect = mRectCache.getCurRect() ?? mRectCache.getPreRect();
1456
+ if (targetGazeIndex != gazeIndex) {
1457
+ needSlide = true;
1458
+ } else if (slideToFocus == "enable") {
1459
+ needSlide = true;
1460
+ } else if (slideToFocus == "disable") {
1461
+ needSlide = false;
1462
+ } else if (layoutChange == 2) {
1463
+ needSlide = true;
1464
+ } else {
1465
+ //保持原有焦点的位置
1466
+ if (JsvInteractionMode.value == KEY_MODE) {
1467
+ if (targetRect) {
1468
+ needSlide = rectVisibleState(targetRect) !== 2;
1469
+ } else {
1470
+ needSlide =
1471
+ rectVisibleState(getItemByIndex(targetGazeIndex)?.templateInfo) !==
1472
+ 2;
1473
+ }
1474
+ } else {
1475
+ //touch模式下,不需要滑动
1476
+ }
1477
+ }
1478
+ if (targetFocusId != focusId) {
1479
+ //重置所有的滚动信息
1480
+ _changeFocusId(targetFocusId, false);
1481
+ }
1482
+
1483
+ const gazeItem = getItemByIndex(targetGazeIndex);
1077
1484
  const focusItem = getItemById(focusId);
1078
- onItemFocus(focusItem, null);
1079
- if (needSlide) {
1080
- if (targetRect) {
1081
- slideToRectInner(targetRect, false, 0, true);
1082
- } else if (focusItem.itemConfig.itemSlide == METRO_WIDGET_CONST.ITEM_SLIDE.ACT_ITEM_FOCUS) {
1485
+ if (gazeItem) {
1486
+ //数据刷新时, 重置preEdgeRect, 否则再嵌套模式下, 会使用上一次的preEdgeRect, 导致子又findNearestByRect
1487
+ preEdgeRect = null;
1488
+ if (needSlide) {
1489
+ if (layoutChange == 2) {
1490
+ slideToNormalize(preVisibleStart, false);
1491
+ } else if (targetRect) {
1492
+ slideToRectInner(targetRect, false, 0, true);
1493
+ } else if (
1494
+ focusItem && focusItem.itemConfig.itemSlide ==
1495
+ METRO_WIDGET_CONST.ITEM_SLIDE.ACT_ITEM_FOCUS
1496
+ ) {
1083
1497
  //只有这个item是控制滚动的才slide, 其他如嵌套时不需要slide
1084
- slideToItemInner(id2Index(focusId), false, 0, 0, true);
1498
+ slideToItemInner(targetGazeIndex, false, 0, 0, true);
1085
1499
  }
1500
+ }
1501
+ } else {
1502
+ slideToInner(0, false);
1503
+ preEdgeRect = null;
1504
+ mRectCache.clean();
1505
+ }
1506
+
1507
+ //与交互模式相关的处理
1508
+ if (JsvInteractionMode.value == TOUCH_MODE) {
1509
+ //TODO touch模式的refresh还是有问题,
1510
+ // 1. 点击删除item, 会触发onDragStart, 这里onDragStart正好更新了visibleInfo.start导致可以运行, 但这里还是要正确更新visibleInfo.start
1511
+ // let divPos = vertical ? slideDivTop.value + freeMoveSlideGapTop : slideDivLeft.value + freeMoveSlideGapLeft;
1512
+ // visibleInfo.start = getVisibleStart(data);
1513
+
1514
+ updateTouchBoxCondition();
1515
+ if (gazeIndex != targetGazeIndex) {
1516
+ gazeIndex = targetGazeIndex;
1517
+ }
1518
+ if (needReOnGaze) {
1519
+ getItemByIndex(gazeIndex)?.onGaze(null);
1520
+ }
1521
+ } else {
1522
+ if (gazeItem) {
1523
+ onItemGaze(gazeItem, null);
1524
+ }
1525
+ if (focusItem) {
1526
+ onItemFocus(focusItem, null);
1527
+ }
1086
1528
  }
1087
-
1088
- //template和slideDivStyle均确定后再次重设box condition
1089
- updateTouchBoxCondition();
1090
1529
  }
1091
1530
  } catch (e) {
1092
- console.log(TAG, "refresh error", e)
1531
+ console.log(TAG, "refresh error", e);
1532
+ }
1533
+
1534
+ //refresh完成后, 重置renderBreak
1535
+ if (props.enableItemRenderBreak !== innerEnableRenderBreak) {
1536
+ nextTick(() => {
1537
+ innerEnableRenderBreak = props.enableItemRenderBreak;
1538
+ window.JsView?.setRenderBreakEnable?.(true);
1539
+ vRenderBreakChanged = false;
1540
+ });
1093
1541
  }
1542
+ _onSizeChange();
1094
1543
  };
1095
1544
 
1096
1545
  const getVisibleItems = () => {
@@ -1107,41 +1556,59 @@ export const setup = (
1107
1556
  };
1108
1557
 
1109
1558
  const moveFocus = (direction) => {
1110
- if (innerData.length <= 0) { return; }
1559
+ if (innerData.length <= 0) {
1560
+ return;
1561
+ }
1111
1562
  //有外部触发的滚动时, 取消load
1112
1563
  tryCancelDelayLoad();
1113
- if (direction == "left" || direction == 37 || direction == EdgeDirection.left) {
1564
+ if (
1565
+ direction == "left" ||
1566
+ direction == 37 ||
1567
+ direction == EdgeDirection.left
1568
+ ) {
1114
1569
  _moveToNext(-1, 0);
1115
- } else if (direction == "right" || direction == 39 || direction == EdgeDirection.right) {
1570
+ } else if (
1571
+ direction == "right" ||
1572
+ direction == 39 ||
1573
+ direction == EdgeDirection.right
1574
+ ) {
1116
1575
  _moveToNext(1, 0);
1117
- } else if (direction == "top" || direction == 38 || direction == EdgeDirection.top) {
1576
+ } else if (
1577
+ direction == "top" ||
1578
+ direction == 38 ||
1579
+ direction == EdgeDirection.top
1580
+ ) {
1118
1581
  _moveToNext(0, -1);
1119
- } else if (direction == "bottom" || direction == 40 || direction == EdgeDirection.bottom) {
1582
+ } else if (
1583
+ direction == "bottom" ||
1584
+ direction == 40 ||
1585
+ direction == EdgeDirection.bottom
1586
+ ) {
1120
1587
  _moveToNext(0, 1);
1121
1588
  } else {
1122
- console.error(TAG, "moveFocus direction is invalid.", direction);
1589
+ errorLogger(TAG, "moveFocus direction is invalid.", direction);
1123
1590
  }
1124
1591
  };
1125
1592
 
1126
1593
  const getCustomerDataSize = () => {
1127
1594
  return dataList.length;
1128
- }
1595
+ };
1129
1596
 
1130
1597
  const getCurrentFocusIndex = () => {
1131
1598
  return id2Index(focusId);
1132
- }
1599
+ };
1133
1600
 
1134
1601
  const getTemplatePosition = (index) => {
1135
1602
  return _getTemplatePosition(index);
1136
- }
1603
+ };
1137
1604
 
1138
1605
  const lockSlide = () => {
1139
1606
  slideLock = true;
1140
- }
1607
+ };
1141
1608
 
1142
1609
  const unlockSlide = () => {
1143
1610
  slideLock = false;
1144
- }
1611
+ };
1145
1612
 
1146
1613
  const setSlideSetting = (setting) => {
1147
1614
  if (!setting) {
@@ -1149,14 +1616,112 @@ export const setup = (
1149
1616
  } else {
1150
1617
  innerSlideSetting = setting;
1151
1618
  }
1152
- }
1619
+ };
1153
1620
 
1154
1621
  const tryCancelDelayLoad = () => {
1155
1622
  if (delayLoadHandler > 0) {
1156
1623
  clearTimeout(delayLoadHandler);
1157
1624
  delayLoadHandler = -1;
1158
1625
  }
1159
- }
1626
+ };
1627
+
1628
+ let vRenderBreakChanged = false;
1629
+ const tmpDisableRenderBreak = () => {
1630
+ if (props.enableItemRenderBreak) {
1631
+ innerEnableRenderBreak = false;
1632
+ window.JsView?.setRenderBreakEnable?.(false);
1633
+ vRenderBreakChanged = true;
1634
+ }
1635
+ };
1636
+
1637
+ const getCurrentVisibleRange = () => {
1638
+ return {
1639
+ leftTop: {
1640
+ x: props.direction == VERTICAL ? 0 : visibleInfo.startWithPadding,
1641
+ y: props.direction == VERTICAL ? visibleInfo.startWithPadding : 0,
1642
+ },
1643
+ rightBottom: {
1644
+ x:
1645
+ props.direction == VERTICAL
1646
+ ? props.width
1647
+ : visibleInfo.endWithPadding,
1648
+ y:
1649
+ props.direction == VERTICAL
1650
+ ? visibleInfo.endWithPadding
1651
+ : props.height,
1652
+ },
1653
+ };
1654
+ };
1655
+
1656
+ //获取指定区间内可视item的树(MetroWidget嵌套时)
1657
+ const getItemVisibleState = (leftTop, rightBottom) => {
1658
+ //传过来的区域已经是真实区域了,不需要再减去padding
1659
+ const rangeStart =
1660
+ props.direction == VERTICAL
1661
+ ? leftTop.y
1662
+ : leftTop.x;
1663
+ const rangeEnd =
1664
+ props.direction == VERTICAL
1665
+ ? rightBottom.y
1666
+ : rightBottom.x;
1667
+ const [startIndex, endIndex] = metroTemplate.getVisibleItemList(
1668
+ rangeStart,
1669
+ rangeEnd,
1670
+ gazeIndex
1671
+ );
1672
+ const result = [];
1673
+ for (let index = startIndex; index <= endIndex; index++) {
1674
+ const item = getItemByIndex(index);
1675
+ if (item) {
1676
+ const s = rectVisibleState(item.templateInfo, rangeStart, rangeEnd);
1677
+ if (s == 0) {
1678
+ //getVisibleItemList返回的区间内可能还有不可见的item
1679
+ continue;
1680
+ }
1681
+ //rangeStart和rangeEnd转化为相对与item的相对位置
1682
+ const itemLeftTop = {
1683
+ x: item.templateInfo.left + widgetRectInfo.padding.left,
1684
+ y: item.templateInfo.top + widgetRectInfo.padding.top,
1685
+ };
1686
+ const newLeftTop = {
1687
+ x: leftTop.x - itemLeftTop.x,
1688
+ y: leftTop.y - itemLeftTop.y,
1689
+ };
1690
+ const newRightBottom = {
1691
+ x: rightBottom.x - itemLeftTop.x,
1692
+ y: rightBottom.y - itemLeftTop.y,
1693
+ };
1694
+ const itemVisibleState = item.onGetItemVisibleState(
1695
+ newLeftTop,
1696
+ newRightBottom
1697
+ );
1698
+ let info = {
1699
+ name: props.name,
1700
+ index: index,
1701
+ visibleState: s == 1 ? "partial" : "full",
1702
+ children: itemVisibleState ? itemVisibleState : [],
1703
+ widgetHandler: exportObject,
1704
+ focusable: item.templateInfo.focusable ?? true,
1705
+ };
1706
+ if (index == gazeIndex) {
1707
+ result.unshift(info);
1708
+ } else {
1709
+ result.push(info);
1710
+ }
1711
+ }
1712
+ }
1713
+ return result;
1714
+ };
1715
+
1716
+ const cleanFocusStatus = () => {
1717
+ preFocusId = -1;
1718
+ focusId = -1;
1719
+ gazeIndex = -1;
1720
+ };
1721
+
1722
+ const getParentWidgetHandler = () => {
1723
+ return parentMetroWidget?.at(-1)?.handler
1724
+ };
1160
1725
 
1161
1726
  const exportObject = {
1162
1727
  lockSlide,
@@ -1182,6 +1747,12 @@ export const setup = (
1182
1747
  cancelDelayLoad: tryCancelDelayLoad,
1183
1748
  setSensorSensitivity,
1184
1749
  getItemLayoutInfo: _getTemplatePosition,
1750
+ tmpDisableRenderBreak,
1751
+ getItemVisibleState,
1752
+ getCurrentVisibleRange,
1753
+ cleanFocusStatus,
1754
+ getParentWidgetHandler,
1755
+ getName: () => props.name,
1185
1756
  };
1186
1757
 
1187
1758
  const _calculateNearestItemByRect = (visibleSet, enter_rect_info) => {
@@ -1232,16 +1803,14 @@ export const setup = (
1232
1803
  let full_show =
1233
1804
  itemTemplateInfo[key_pos] >= visibleInfo.start &&
1234
1805
  itemTemplateInfo[key_pos] + itemTemplateInfo[key_width] - 1 <=
1235
- visibleInfo.end;
1806
+ visibleInfo.end;
1236
1807
  if (full_show) {
1237
- let x_pos =
1238
- vertical
1239
- ? itemTemplateInfo.left
1240
- : itemTemplateInfo.left - visibleInfo.start;
1241
- let y_pos =
1242
- vertical
1243
- ? itemTemplateInfo.top - visibleInfo.start
1244
- : itemTemplateInfo.top;
1808
+ let x_pos = vertical
1809
+ ? itemTemplateInfo.left
1810
+ : itemTemplateInfo.left - visibleInfo.start;
1811
+ let y_pos = vertical
1812
+ ? itemTemplateInfo.top - visibleInfo.start
1813
+ : itemTemplateInfo.top;
1245
1814
  var target_x_range = new SingleRangeModel(
1246
1815
  x_pos,
1247
1816
  x_pos + itemTemplateInfo.width - 1
@@ -1380,22 +1949,25 @@ export const setup = (
1380
1949
  };
1381
1950
 
1382
1951
  const onDispatchKeyDown = (ev) => {
1383
- if (mode.getMode() == TOUCH_MODE && !mode.duringTouch()) {
1384
- if (ev.keyCode == 37 || ev.keyCode == 38 || ev.keyCode == 39 || ev.keyCode == 40) {
1385
- //只有在上下左右键切换为focus_mode
1386
- mode.keyDown();
1387
- //touch切换为focus的首次按键只显示焦点
1388
- const focusItem = _getVisibleFocusableItem();
1389
- const preFocusItem = getItemById(focusId);
1390
- _changeFocusId(focusItem.id, false);
1391
- if (preFocusItem.id !== focusItem.id) {
1392
- onItemBlur(preFocusItem);
1393
- }
1394
- onItemFocus(focusItem);
1952
+ if (
1953
+ ev.keyCode == 37 ||
1954
+ ev.keyCode == 38 ||
1955
+ ev.keyCode == 39 ||
1956
+ ev.keyCode == 40
1957
+ ) {
1958
+ //fling过程中不处理按键
1959
+ if (touchStateMgr.duringFling()) {
1960
+ window.JsView?.changeInteractionMode?.("touch", "key");
1961
+ }
1962
+
1963
+ if (JsvInteractionMode.value == TOUCH_MODE) {
1964
+ JsvInteractionMode.value = KEY_MODE;
1965
+ touchStateMgr.touchEnd(touchStateMgr.getTouchCount());
1966
+ return true;
1395
1967
  }
1396
1968
  }
1397
1969
  return false;
1398
- }
1970
+ };
1399
1971
 
1400
1972
  const _moveByKey = (keyCode) => {
1401
1973
  switch (keyCode) {
@@ -1414,13 +1986,14 @@ export const setup = (
1414
1986
  default:
1415
1987
  return false;
1416
1988
  }
1417
- }
1989
+ };
1418
1990
 
1419
1991
  let clickDownReceived = false;
1420
1992
  let longPressTriggered = false;
1421
1993
 
1422
1994
  const focusBlockOnKeyUp = (ev) => {
1423
- if (!props.enableLongPress) {
1995
+ const curFocusItem = getItemById(focusId);
1996
+ if (!curFocusItem || !curFocusItem.itemConfig.enableLongPress) {
1424
1997
  return false;
1425
1998
  }
1426
1999
  //支持长按时 onClick 由 keyup 处理
@@ -1429,14 +2002,14 @@ export const setup = (
1429
2002
  if (!longPressTriggered) {
1430
2003
  if (ev.keyCode == 13 && clickDownReceived) {
1431
2004
  clickDownReceived = false;
1432
- onItemClick(getItemById(focusId));
2005
+ onItemClick(curFocusItem);
1433
2006
  return true;
1434
2007
  }
1435
2008
  } else {
1436
2009
  longPressTriggered = false;
1437
2010
  }
1438
2011
  return false;
1439
- }
2012
+ };
1440
2013
 
1441
2014
  let preStartKeyDownTime = -1;
1442
2015
  const focusBlockOnKeyDown = (ev) => {
@@ -1448,25 +2021,28 @@ export const setup = (
1448
2021
  preStartKeyDownTime = ev.timeStamp;
1449
2022
  }
1450
2023
  tryCancelDelayLoad();
1451
- if (mode.getMode() == TOUCH_MODE) {
1452
- if (mode.duringTouch()) {
1453
- //touch过程中的按键不处理
1454
- return true;
1455
- }
2024
+ if (JsvInteractionMode.value == TOUCH_MODE && touchStateMgr.duringTouch()) {
2025
+ //touch过程中的按键不处理
2026
+ return true;
1456
2027
  }
1457
2028
 
1458
2029
  if (_moveByKey(ev.keyCode)) {
1459
2030
  return true;
1460
2031
  }
1461
2032
  if (ev.keyCode == 13) {
2033
+ const curFocusItem = getItemById(focusId);
1462
2034
  clickDownReceived = true;
1463
- if (props.enableLongPress) {
1464
- if (ev.repeat && ev.timeStamp - preStartKeyDownTime > LONGPRESS_TIMEOUT && !longPressTriggered) {
2035
+ if (curFocusItem?.itemConfig.enableLongPress) {
2036
+ if (
2037
+ ev.repeat &&
2038
+ ev.timeStamp - preStartKeyDownTime > LONGPRESS_TIMEOUT &&
2039
+ !longPressTriggered
2040
+ ) {
1465
2041
  longPressTriggered = true;
1466
- onItemLongPress(getItemById(focusId));
2042
+ onItemLongPress(curFocusItem);
1467
2043
  }
1468
2044
  } else if (!ev.repeat) {
1469
- onItemClick(getItemById(focusId));
2045
+ onItemClick(curFocusItem);
1470
2046
  }
1471
2047
  return true;
1472
2048
  } else {
@@ -1482,7 +2058,8 @@ export const setup = (
1482
2058
  if (lastTemplateInfo) {
1483
2059
  if (vertical) {
1484
2060
  touchDivSize.width = props.width;
1485
- touchDivSize.height = lastTemplateInfo.top + lastTemplateInfo.height - 1;
2061
+ touchDivSize.height =
2062
+ lastTemplateInfo.top + lastTemplateInfo.height - 1;
1486
2063
  } else {
1487
2064
  touchDivSize.width = lastTemplateInfo.left + lastTemplateInfo.width - 1;
1488
2065
  touchDivSize.height = props.height;
@@ -1490,15 +2067,23 @@ export const setup = (
1490
2067
  }
1491
2068
  }
1492
2069
 
1493
- const _onTemplateAddDone = () => {
1494
- //update slideDiv size
1495
- let preTouchW = touchDivSize.width;
1496
- let preTouchH = touchDivSize.height;
1497
- updateTouchDivSize();
1498
- if (preTouchW !== touchDivSize.width || preTouchH !== touchDivSize.height) {
1499
- updateTouchBoxCondition();
2070
+ const getOnTemplateAddDone = (needUpdateBox) => {
2071
+ return () => {
2072
+ //update slideDiv size
2073
+ let preTouchW = touchDivSize.width;
2074
+ let preTouchH = touchDivSize.height;
2075
+ updateTouchDivSize();
2076
+ if (needUpdateBox) {
2077
+ if (preTouchW !== touchDivSize.width || preTouchH !== touchDivSize.height) {
2078
+ updateTouchBoxCondition();
2079
+ }
2080
+ }
2081
+ if (props.fullDisplayMode) {
2082
+ let size_key = vertical ? "height" : "width";
2083
+ visibleInfo.range = metroTemplate.getBoundingBoxSize()[size_key];
2084
+ }
1500
2085
  }
1501
- }
2086
+ };
1502
2087
 
1503
2088
  const _getItemConfigFromMeasursObj = (measuresObj) => {
1504
2089
  let focusZIndex = -1,
@@ -1523,8 +2108,40 @@ export const setup = (
1523
2108
  focusZIndex,
1524
2109
  normalZIndex,
1525
2110
  permanent: measuresObj.permanent ?? false,
1526
- itemSlide: measuresObj.itemSlide ?? METRO_WIDGET_CONST.ITEM_SLIDE.ACT_ITEM_FOCUS,
2111
+ itemSlide:
2112
+ measuresObj.itemSlide ?? METRO_WIDGET_CONST.ITEM_SLIDE.ACT_ITEM_FOCUS,
1527
2113
  showSkeleton: measuresObj.showSkeleton ?? true,
2114
+ enableLongPress: measuresObj.enableLongPress ?? props.enableLongPress,
2115
+ bindSpatialNav: measuresObj.bindSpatialNav ?? false,
2116
+ };
2117
+ };
2118
+
2119
+ const rootPositionCache = {
2120
+ cacheToken: -1,
2121
+ cacheTargetDiv: undefined,
2122
+ cacheRect: undefined,
2123
+ }
2124
+ const getItemPositionWithCache = (token, target, itemIndex) => {
2125
+ if (!target || !rootDiv.value) {
2126
+ return undefined;
2127
+ }
2128
+ let rootRect;
2129
+ if (rootPositionCache.cacheToken === token
2130
+ && rootPositionCache.cacheTargetDiv === target
2131
+ && rootPositionCache.cacheRect) {
2132
+ rootRect = rootPositionCache.cacheRect;
2133
+ } else {
2134
+ rootRect = rootDiv.value.jsvGetRelativePosition(target);
2135
+ rootPositionCache.cacheToken = token;
2136
+ rootPositionCache.cacheTargetDiv = target;
2137
+ rootPositionCache.cacheRect = rootRect;
2138
+ }
2139
+ const itemRect = _getPostionRelativeToRoot(itemIndex);
2140
+ return {
2141
+ left: rootRect.left + itemRect.left,
2142
+ top: rootRect.top + itemRect.top,
2143
+ width: itemRect.width,
2144
+ height: itemRect.height,
1528
2145
  };
1529
2146
  }
1530
2147
 
@@ -1545,6 +2162,12 @@ export const setup = (
1545
2162
  renderStyle,
1546
2163
  itemConfig,
1547
2164
  () => {
2165
+ if (callGazeAfterUpdate && item.index == gazeIndex) {
2166
+ nextTick(() => {
2167
+ item.onGaze(preEdgeRect);
2168
+ });
2169
+ callGazeAfterUpdate = false;
2170
+ }
1548
2171
  if (callFocusAfterUpdate && item.id === focusId) {
1549
2172
  nextTick(() => {
1550
2173
  onItemFocus(item, preEdgeRect);
@@ -1562,9 +2185,55 @@ export const setup = (
1562
2185
  slideTo: slideTo,
1563
2186
  updateItemSize,
1564
2187
  widgetHandler: exportObject,
1565
- }
2188
+ },
2189
+ {
2190
+ onTap: onItemTap,
2191
+ getMwChain: () => {
2192
+ return metroWidgetChain;
2193
+ },
2194
+ name: props.name,
2195
+ getItemPositionWithCache,
2196
+ },
2197
+ props.renderAcc,
2198
+ innerEnableRenderBreak
1566
2199
  );
1567
2200
  item.enableTap = measuresObj.enableTap ?? false;
2201
+ // 占位图布局
2202
+ if (props.enableItemRenderBreak) {
2203
+ let l, t, w, h, logoW, logoH;
2204
+ l =
2205
+ typeof measuresObj.placeHolderLayout?.left == "number"
2206
+ ? measuresObj.placeHolderLayout.left
2207
+ : 0;
2208
+ t =
2209
+ typeof measuresObj.placeHolderLayout?.top == "number"
2210
+ ? measuresObj.placeHolderLayout.top
2211
+ : 0;
2212
+ w =
2213
+ typeof measuresObj.placeHolderLayout?.width == "number"
2214
+ ? measuresObj.placeHolderLayout.width
2215
+ : item.renderStyle.width - (props.placeHolderSetting.gap ?? 0);
2216
+ h =
2217
+ typeof measuresObj.placeHolderLayout?.height == "number"
2218
+ ? measuresObj.placeHolderLayout.height
2219
+ : item.renderStyle.height - (props.placeHolderSetting.gap ?? 0);
2220
+ logoW =
2221
+ typeof measuresObj.placeHolderLayout?.logoWidth == "number"
2222
+ ? measuresObj.placeHolderLayout.logoWidth
2223
+ : props.placeHolderSetting.logoWidth ?? 0;
2224
+ logoH =
2225
+ typeof measuresObj.placeHolderLayout?.logoHeight == "number"
2226
+ ? measuresObj.placeHolderLayout.logoHeight
2227
+ : props.placeHolderSetting.logoHeight ?? 0;
2228
+ item.placeHolderLayout = {
2229
+ left: l,
2230
+ top: t,
2231
+ width: w,
2232
+ height: h,
2233
+ logoWidth: logoW,
2234
+ logoHeight: logoH,
2235
+ };
2236
+ }
1568
2237
 
1569
2238
  innerData.push(item);
1570
2239
  if (item.itemConfig.permanent) {
@@ -1596,7 +2265,10 @@ export const setup = (
1596
2265
  return false;
1597
2266
  }
1598
2267
  const focusItem = getItemById(focusId);
1599
- if (focusItem.itemConfig.itemSlide !== METRO_WIDGET_CONST.ITEM_SLIDE.ACT_FOCUS_RECT_EVENT) {
2268
+ if (
2269
+ focusItem.itemConfig.itemSlide !==
2270
+ METRO_WIDGET_CONST.ITEM_SLIDE.ACT_FOCUS_RECT_EVENT
2271
+ ) {
1600
2272
  return;
1601
2273
  }
1602
2274
  let item_div = ev.element;
@@ -1614,7 +2286,9 @@ export const setup = (
1614
2286
  direction = 1;
1615
2287
  }
1616
2288
  }
1617
- const item_layout = item_div.jsvGetRelativePosition(toRaw(locateDiv.value));
2289
+ const item_layout = item_div.jsvGetRelativePosition(
2290
+ toRaw(locateDiv.value)
2291
+ );
1618
2292
 
1619
2293
  let fakeItem = {
1620
2294
  templateInfo: {
@@ -1628,16 +2302,20 @@ export const setup = (
1628
2302
  },
1629
2303
  };
1630
2304
 
1631
- let cur_slide = _calculateVisibleStart(fakeItem.templateInfo, direction, fakeItem.templateInfo, visibleInfo);
2305
+ let cur_slide = _calculateVisibleStart(
2306
+ fakeItem.templateInfo,
2307
+ direction,
2308
+ fakeItem.templateInfo,
2309
+ visibleInfo,
2310
+ null,
2311
+ true,
2312
+ );
1632
2313
  if (cur_slide != visibleInfo.start) {
1633
- slideToInner(
1634
- cur_slide,
1635
- true,
1636
- {
1637
- //250207 change: 为true时, 会导致不可见的item反复加载,释放, 所以改为false
1638
- //但之前设为true应该是为了保证滚动时的楼层不提前消失, 此后若再遇到这类问题再考虑
1639
- mergeTmp: false
1640
- });
2314
+ slideToInner(cur_slide, true, {
2315
+ //250207 change: 为true时, 会导致不可见的item反复加载,释放, 所以改为false
2316
+ //但之前设为true应该是为了保证滚动时的楼层不提前消失, 此后若再遇到这类问题再考虑
2317
+ mergeTmp: false,
2318
+ });
1641
2319
  return true;
1642
2320
  }
1643
2321
  }
@@ -1646,10 +2324,14 @@ export const setup = (
1646
2324
 
1647
2325
  const _changeFocusId = (id, cache_pre = true) => {
1648
2326
  preFocusId = cache_pre ? focusId : -1;
1649
- focusId = id >= 0 && id < metroTemplate.size ? id : 0;
1650
- currentFocusIndex.value = id2Index(id);
2327
+ if (metroTemplate.size == 0) {
2328
+ focusId = -1;
2329
+ } else {
2330
+ focusId = id >= 0 && id < metroTemplate.size ? id : 0;
2331
+ }
2332
+ currentFocusIndex.value = id2Index(focusId);
1651
2333
  taskManager.addTask(TaskType.ON_FOCUS_CHANGE);
1652
- }
2334
+ };
1653
2335
 
1654
2336
  const _bubbleCustomEvent = (event) => {
1655
2337
  if (props.sendFocusRectEvent && event) {
@@ -1658,6 +2340,26 @@ export const setup = (
1658
2340
  }
1659
2341
  };
1660
2342
 
2343
+ const _innerOnEdge = (rect) => {
2344
+ if (props.onEdge) {
2345
+ if (typeof props.onEdge === "string") {
2346
+ if (props.onEdge === ONEDGE_TYPE.SPATIAL_NAV) {
2347
+ if (spatialNavigator) {
2348
+ spatialNavigator.moveTo(rect.direction);
2349
+ } else {
2350
+ console.warn("MetroWidget: onEdge is spatialNav, but spatialNavigator is not set", props.name);
2351
+ }
2352
+ } else {
2353
+ console.warn("MetroWidget: onEdge string is not valid", props.name, props.onEdge);
2354
+ }
2355
+ } else if (typeof props.onEdge === "function") {
2356
+ props.onEdge(rect);
2357
+ } else {
2358
+ console.warn("MetroWidget: onEdge is not a function nor a string", props.name);
2359
+ }
2360
+ }
2361
+ }
2362
+
1661
2363
  const _moveToNext = (
1662
2364
  horizontal_direction,
1663
2365
  vertical_direction,
@@ -1678,7 +2380,7 @@ export const setup = (
1678
2380
  console.warn(TAG, "moveToNext error");
1679
2381
  }
1680
2382
  if (direction) {
1681
- props.onEdge?.({
2383
+ _innerOnEdge({
1682
2384
  direction: direction,
1683
2385
  rect: {
1684
2386
  x: 0,
@@ -1703,8 +2405,10 @@ export const setup = (
1703
2405
  templateItemAdder.tryAddItem(next_focus_item.templateInfo, 1);
1704
2406
 
1705
2407
  // itemFocus 和 itemBlur放在计算visibleStart之前, 以便用户更改template后在计算滚动
1706
- let x_off_set = preFocusItem.templateInfo.left - next_focus_item.templateInfo.left;
1707
- let y_off_set = preFocusItem.templateInfo.top - next_focus_item.templateInfo.top;
2408
+ let x_off_set =
2409
+ preFocusItem.templateInfo.left - next_focus_item.templateInfo.left;
2410
+ let y_off_set =
2411
+ preFocusItem.templateInfo.top - next_focus_item.templateInfo.top;
1708
2412
  if (item_edge_rect && item_edge_rect.rect) {
1709
2413
  item_edge_rect.rect.x += x_off_set;
1710
2414
  item_edge_rect.rect.y += y_off_set;
@@ -1730,15 +2434,21 @@ export const setup = (
1730
2434
  },
1731
2435
  };
1732
2436
  }
2437
+ onItemIgnore(preFocusItem)
1733
2438
  onItemBlur(preFocusItem);
2439
+ onItemGaze(next_focus_item, preEdgeRect);
1734
2440
  onItemFocus(next_focus_item, preEdgeRect);
1735
2441
 
1736
- if (next_focus_item.itemConfig.itemSlide == METRO_WIDGET_CONST.ITEM_SLIDE.ACT_ITEM_FOCUS) {
2442
+ if (
2443
+ next_focus_item.itemConfig.itemSlide ==
2444
+ METRO_WIDGET_CONST.ITEM_SLIDE.ACT_ITEM_FOCUS
2445
+ ) {
1737
2446
  slideToItemInner(
1738
2447
  next_focus_item.index,
1739
2448
  true,
1740
2449
  vertical ? vertical_direction : horizontal_direction,
1741
- preFocusItem);
2450
+ preFocusItem
2451
+ );
1742
2452
  } else {
1743
2453
  const updater = pageUpdater.update(
1744
2454
  metroTemplate,
@@ -1746,7 +2456,8 @@ export const setup = (
1746
2456
  visibleInfo.endWithPadding + innerKeepTraceRange * pageRange,
1747
2457
  next_focus_item.id,
1748
2458
  false,
1749
- permanentItemList
2459
+ permanentItemList,
2460
+ props.fullDisplayMode
1750
2461
  );
1751
2462
  //不做滚动时,保证获焦的item创建. 为了避免提前隐藏, 使用applyTmp
1752
2463
  updater.applyTmp();
@@ -1769,7 +2480,7 @@ export const setup = (
1769
2480
  edge = EdgeDirection.top;
1770
2481
  }
1771
2482
  const curTemplateInfo = getItemById(focusId)?.templateInfo;
1772
- let rect
2483
+ let rect;
1773
2484
  if (curTemplateInfo) {
1774
2485
  rect = {
1775
2486
  x: curTemplateInfo.left - x_off_set,
@@ -1786,10 +2497,10 @@ export const setup = (
1786
2497
  };
1787
2498
  }
1788
2499
 
1789
- props.onEdge?.({
2500
+ _innerOnEdge({
1790
2501
  direction: edge,
1791
2502
  rect: rect,
1792
- childEdgeInfo: item_edge_rect
2503
+ childEdgeInfo: item_edge_rect,
1793
2504
  });
1794
2505
  innerData[id2Index(focusId)]?.onWidgetEdge({
1795
2506
  direction: edge,
@@ -1797,7 +2508,7 @@ export const setup = (
1797
2508
  }
1798
2509
  };
1799
2510
 
1800
- const normalizeVisibleStart = (origin, targetRect, index, _visibleInfo) => {
2511
+ const normalizeVisibleStart = (origin, _visibleInfo) => {
1801
2512
  let pos_key = vertical ? "top" : "left";
1802
2513
  let size_key = vertical ? "height" : "width";
1803
2514
  let visibleStart = origin;
@@ -1813,25 +2524,35 @@ export const setup = (
1813
2524
  }
1814
2525
  }
1815
2526
  if ((innerSlideSetting.BoundaryProtect & SlideSetting.END_PROTECT) > 0) {
1816
- let lastTemplateInfo = getItemByIndex(metroTemplate.getTailItemIndex()).templateInfo;
2527
+ let lastTemplateInfo = getItemByIndex(
2528
+ metroTemplate.getTailItemIndex()
2529
+ ).templateInfo;
1817
2530
  const lastEnd = lastTemplateInfo[pos_key] + lastTemplateInfo[size_key];
1818
2531
  const lastVisibleStart = Math.max(lastEnd - vInfo.range, 0);
1819
2532
  //边界必须大于等于0, 同时若最后一个缩进时, 边界采用最后一个item的位置
1820
2533
  if (vInfo.end <= lastEnd) {
1821
2534
  let boundary = lastVisibleStart;
1822
- visibleStart = visibleStart > boundary ? lastVisibleStart : visibleStart;
2535
+ visibleStart =
2536
+ visibleStart > boundary ? lastVisibleStart : visibleStart;
1823
2537
  } else {
1824
2538
  // 以最后一个item的位置作为动态的保护边界
1825
2539
  visibleStart = visibleStart > vInfo.start ? vInfo.start : visibleStart;
1826
2540
  }
1827
2541
  }
1828
2542
  return visibleStart;
1829
- }
2543
+ };
1830
2544
 
1831
2545
  const mRectCache = new RectCache();
1832
- const _calculateVisibleStart = (targetRect, _direction, templateInfo, vInfo, preInfo = null) => {
2546
+ const _calculateVisibleStart = (
2547
+ targetRect,
2548
+ _direction,
2549
+ templateInfo,
2550
+ vInfo,
2551
+ preInfo = null,
2552
+ cachePreRect = true
2553
+ ) => {
1833
2554
  if (!targetRect) {
1834
- console.error("MetroWidget: _calculateVisibleStart target item is null");
2555
+ errorLogger("MetroWidget: _calculateVisibleStart target item is null");
1835
2556
  return 0;
1836
2557
  }
1837
2558
  const curRect = {
@@ -1840,8 +2561,12 @@ export const setup = (
1840
2561
  width: targetRect.width,
1841
2562
  height: targetRect.height,
1842
2563
  frameCount: Forge.sFrameCount.count,
2564
+ };
2565
+ if (cachePreRect) {
2566
+ mRectCache.cache(curRect);
2567
+ } else {
2568
+ mRectCache.clean();
1843
2569
  }
1844
- mRectCache.cache(curRect);
1845
2570
  let preRect = mRectCache.getPreRect();
1846
2571
  if (preInfo) {
1847
2572
  preRect = preInfo;
@@ -1874,16 +2599,21 @@ export const setup = (
1874
2599
  }
1875
2600
 
1876
2601
  if (needCalculate) {
2602
+ let target = targetRect[pos_key] + targetRect[size_key] / 2;
2603
+ if (innerSlideSetting.Align == "start") {
2604
+ target = targetRect[pos_key];
2605
+ } else if (innerSlideSetting.Align == "end") {
2606
+ target = targetRect[pos_key] + targetRect[size_key];
2607
+ }
1877
2608
  new_visible_start = Math.ceil(
1878
- targetRect[pos_key] + targetRect[size_key] / 2 -
1879
- vInfo.range * innerSlideSetting.FixPercent
2609
+ target - vInfo.range * innerSlideSetting.FixPercent
1880
2610
  );
1881
2611
  }
1882
2612
  break;
1883
2613
  case SlideSetting.Type.WHOLE_PAGE:
1884
2614
  if (!templateInfo || typeof templateInfo.pageHeadIndex == "undefined") {
1885
2615
  //TODO 子控制滚动时whole page滚动
1886
- console.error(
2616
+ errorLogger(
1887
2617
  "child controlled whole page slide type is not supported."
1888
2618
  );
1889
2619
  } else {
@@ -1914,14 +2644,19 @@ export const setup = (
1914
2644
 
1915
2645
  if (preRect) {
1916
2646
  const rect0Start = vInfo.start;
1917
- const rect0End = vInfo.start + vInfo.range * innerSlideSetting.StartPercent;
1918
- const rect0Range = rect0End - rect0Start + 1
1919
- const rect1Start = vInfo.start + vInfo.range * innerSlideSetting.EndPercent;
2647
+ const rect0End =
2648
+ vInfo.start + vInfo.range * innerSlideSetting.StartPercent;
2649
+ const rect0Range = rect0End - rect0Start + 1;
2650
+ const rect1Start =
2651
+ vInfo.start + vInfo.range * innerSlideSetting.EndPercent;
1920
2652
  const rect1End = vInfo.start + vInfo.range - 1;
1921
2653
  const rect1Range = rect1End - rect1Start + 1;
1922
2654
 
1923
2655
  let target0 = Math.min(preRect[pos_key], rect0End);
1924
- let target1 = Math.max(preRect[pos_key] + preRect[size_key] - 1, rect1Start);
2656
+ let target1 = Math.max(
2657
+ preRect[pos_key] + preRect[size_key] - 1,
2658
+ rect1Start
2659
+ );
1925
2660
 
1926
2661
  let rect0Result = undefined;
1927
2662
  let rect1Result = undefined;
@@ -1934,7 +2669,7 @@ export const setup = (
1934
2669
  } else {
1935
2670
  if (direction <= 0) {
1936
2671
  //inRect0, 只处理往左/往上
1937
- rect0Result = vInfo.start + (itemStart - target0)
2672
+ rect0Result = vInfo.start + (itemStart - target0);
1938
2673
  }
1939
2674
  }
1940
2675
  }
@@ -1952,7 +2687,10 @@ export const setup = (
1952
2687
  }
1953
2688
  }
1954
2689
 
1955
- if (typeof rect0Result !== "undefined" && typeof rect1Result !== "undefined") {
2690
+ if (
2691
+ typeof rect0Result !== "undefined" &&
2692
+ typeof rect1Result !== "undefined"
2693
+ ) {
1956
2694
  //重叠区域
1957
2695
  new_visible_start = rect0Result;
1958
2696
  } else if (typeof rect0Result !== "undefined") {
@@ -1967,24 +2705,29 @@ export const setup = (
1967
2705
  const tailSafeArea = innerSlideSetting.TailSafeArea * vInfo.range;
1968
2706
  if (itemMainSize > vInfo.range - headSafeArea - tailSafeArea) {
1969
2707
  // 大item
1970
- new_visible_start = Math.round(itemStart - (vInfo.range - itemMainSize) / 2)
2708
+ new_visible_start = Math.round(
2709
+ itemStart - (vInfo.range - itemMainSize) / 2
2710
+ );
1971
2711
  } else {
1972
2712
  if (itemStart < new_visible_start + headSafeArea) {
1973
2713
  new_visible_start = itemStart - headSafeArea;
1974
- } else if (itemEnd > new_visible_start + vInfo.range - 1 - tailSafeArea) {
2714
+ } else if (
2715
+ itemEnd >
2716
+ new_visible_start + vInfo.range - 1 - tailSafeArea
2717
+ ) {
1975
2718
  new_visible_start = itemEnd - vInfo.range + tailSafeArea;
1976
2719
  }
1977
2720
  }
1978
2721
  }
1979
2722
  break;
1980
2723
  default:
1981
- console.error(
2724
+ errorLogger(
1982
2725
  "MetroWidget: undefined slide type",
1983
2726
  innerSlideSetting.Type
1984
2727
  );
1985
2728
  }
1986
2729
 
1987
- new_visible_start = normalizeVisibleStart(new_visible_start, targetRect, templateInfo?.index, vInfo);
2730
+ new_visible_start = normalizeVisibleStart(new_visible_start, vInfo);
1988
2731
  return Math.round(new_visible_start);
1989
2732
  };
1990
2733
 
@@ -2015,52 +2758,93 @@ export const setup = (
2015
2758
  };
2016
2759
 
2017
2760
  const focusBlockOnFocus = (params) => {
2018
- isFocus = true;
2019
- if (innerData.length === 0) {
2020
- console.log(`MetroWidget: ${props.name} get focus while data is empty.`);
2761
+ if (JsvInteractionMode.value == TOUCH_MODE) {
2762
+ focusWhenInTouch = true;
2021
2763
  return;
2022
2764
  }
2765
+ isFocus.value = true;
2023
2766
 
2024
- let focus_id =
2025
- typeof enterFocusId !== "undefined" &&
2767
+ if (innerData.length !== 0) {
2768
+ let focus_id = focusId;
2769
+ focus_id =
2770
+ typeof enterFocusId !== "undefined" &&
2026
2771
  enterFocusId >= 0 &&
2027
2772
  enterFocusId < metroTemplate.size
2028
- ? enterFocusId
2029
- : focusId;
2030
- focus_id = _ifValidEnterRect(enterFocusRect)
2031
- ? _calculateNearestItemByRect(pageUpdater.getRange(), enterFocusRect)
2032
- : focus_id;
2033
- preEdgeRect = enterFocusRect;
2034
- _changeFocusId(focus_id, false);
2035
- enterFocusId = -1;
2036
- enterFocusRect = null;
2037
- firstOnItemFocusCalled = onItemFocus(getItemById(focusId), preEdgeRect);;
2773
+ ? enterFocusId
2774
+ : focus_id;
2775
+ focus_id = _ifValidEnterRect(enterFocusRect)
2776
+ ? _calculateNearestItemByRect(pageUpdater.getRange(), enterFocusRect)
2777
+ : focus_id;
2778
+ preEdgeRect = enterFocusRect;
2779
+ _changeFocusId(focus_id, false);
2780
+ enterFocusId = -1;
2781
+ enterFocusRect = null;
2782
+ firstOnItemFocusCalled = onItemFocus(getItemById(focusId), preEdgeRect);
2783
+ } else {
2784
+ console.log(`MetroWidget: ${props.name} get focus while data is empty.`);
2785
+ }
2038
2786
  props.onFocus?.();
2039
2787
  };
2040
2788
 
2041
2789
  const focusBlockOnBlur = () => {
2790
+ focusWhenInTouch = false;
2042
2791
  enterFocusId = -1;
2043
2792
  enterFocusRect = null;
2044
2793
  preEdgeRect = null;
2045
2794
  preFocusId = focusId;
2046
2795
  onItemBlur(getItemById(preFocusId));
2047
2796
  props.onBlur?.();
2048
- isFocus = false;
2049
- mRectCache.clean()
2797
+ isFocus.value = false;
2798
+ mRectCache.clean();
2050
2799
  };
2051
2800
 
2052
2801
  const _updatePage = (rangeSet) => {
2053
2802
  let cur = id2Index(focusId);
2054
2803
  if (cur >= 0) {
2055
- rangeSet.add(cur)
2804
+ rangeSet.add(cur);
2056
2805
  }
2057
2806
  const tmpArray = Array.from(rangeSet);
2058
2807
  let newArray = tmpArray.map((item) => {
2059
2808
  return getItemByIndex(item);
2060
2809
  });
2061
- const newItemList = newArray.filter((i) => { return !renderData.value?.includes(i) });
2810
+ //新进的item
2811
+ newArray
2812
+ .filter((i) => {
2813
+ return !renderData.value?.includes(i);
2814
+ })
2815
+ .forEach((i) => {
2816
+ i.onInRenderRange();
2817
+ i.renderBreak = innerEnableRenderBreak;
2818
+ });
2819
+ //退出的item
2820
+ renderData.value
2821
+ .filter((i) => {
2822
+ return !newArray.includes(i);
2823
+ })
2824
+ .forEach((i) => {
2825
+ i.onOutOfRenderRange();
2826
+ if (spatialNavigator) {
2827
+ spatialNavigator.unregisterNode(i.getSpatialNavNode());
2828
+ }
2829
+ });
2830
+
2831
+ //注册spatial navigator
2832
+ if (spatialNavigator) {
2833
+ for (let item of newArray) {
2834
+ const visibleState = rectVisibleState(item.templateInfo);
2835
+ const n = item.getSpatialNavNode();
2836
+ if (visibleState == 2 || visibleState == 1) {
2837
+ if (n) {
2838
+ spatialNavigator.registerNode(n);
2839
+ }
2840
+ } else {
2841
+ spatialNavigator.unregisterNode(n);
2842
+ }
2843
+ }
2844
+ }
2845
+
2062
2846
  renderData.value = newArray;
2063
- if (props.enableItemRenderBreak) {
2847
+ if (innerEnableRenderBreak) {
2064
2848
  itemRender.value = false;
2065
2849
  const f = () => {
2066
2850
  // 关闭强制TriggerManualBlock,改为vue内部通过dom的任务数来确定是否执行打断
@@ -2074,18 +2858,67 @@ export const setup = (
2074
2858
  };
2075
2859
 
2076
2860
  const _getVisibleFocusableItem = () => {
2077
- const focusItem = getItemById(focusId);
2078
- if (rectVisibleState(focusItem.templateInfo) == 2) {
2079
- return focusItem;
2080
- } else {
2081
- //遍历renderList, 找到第一个可见的 focusable item
2082
- for (let item of renderData.value) {
2083
- if (item.templateInfo.focusable && rectVisibleState(item.templateInfo) == 2) {
2084
- return item;
2085
- }
2861
+ let item = getItemByIndex(gazeIndex);
2862
+ if (item) {
2863
+ let itemVisibility = rectVisibleState(item.templateInfo);
2864
+ let isLarge = isLargeItem(item.templateInfo);
2865
+ if (itemVisibility == 2) {
2866
+ return item;
2086
2867
  }
2087
2868
  }
2088
- }
2869
+
2870
+ item = getItemById(focusId);
2871
+ if (item) {
2872
+ let itemVisibility = rectVisibleState(item.templateInfo);
2873
+ let isLarge = isLargeItem(item.templateInfo);
2874
+ if (itemVisibility == 2) {
2875
+ return item;
2876
+ }
2877
+ }
2878
+
2879
+ //遍历renderList, 找到第一个可见的 focusable item
2880
+ let resultItem = null;
2881
+ for (let item of renderData.value) {
2882
+ let itemVisibility = rectVisibleState(item.templateInfo);
2883
+ let isLarge = isLargeItem(item.templateInfo);
2884
+ if (
2885
+ item.templateInfo.focusable &&
2886
+ (itemVisibility == 2 || (itemVisibility == 1 && isLarge))
2887
+ ) {
2888
+ resultItem = item;
2889
+ break;
2890
+ }
2891
+ }
2892
+ if (resultItem == null) {
2893
+ //找到占空间最大的部分可视item;
2894
+ }
2895
+ return null;
2896
+ };
2897
+
2898
+ let preSize = 0;
2899
+ const _onSizeChange = () => {
2900
+ if (props.fullDisplayMode) {
2901
+ nextTick(() => {
2902
+ let size = 0;
2903
+ if (innerData.length > 0) {
2904
+ const lastTemplateInfo =
2905
+ innerData[innerData.length - 1]?.templateInfo;
2906
+ if (vertical) {
2907
+ size = lastTemplateInfo.top + lastTemplateInfo.height - 1;
2908
+ } else {
2909
+ size = lastTemplateInfo.left + lastTemplateInfo.width - 1;
2910
+ }
2911
+ }
2912
+ if (size != preSize) {
2913
+ preSize = size;
2914
+ props.onSizeChange?.({
2915
+ width: vertical ? props.width : size,
2916
+ height: vertical ? size : props.height,
2917
+ });
2918
+ }
2919
+ });
2920
+ }
2921
+ };
2089
2922
 
2090
2923
  const _onScroll = () => {
2091
2924
  if (props.onScroll) {
@@ -2103,6 +2936,22 @@ export const setup = (
2103
2936
  props.onScroll(visibleInfo.start, visibleInfo.range, totalWidth);
2104
2937
  }
2105
2938
  };
2939
+ const _syncOnScroll = () => {
2940
+ if (props.syncOnScroll) {
2941
+ const lastTemplateInfo = getItemByIndex(
2942
+ metroTemplate.getTailItemIndex()
2943
+ )?.templateInfo;
2944
+ let totalWidth = 0;
2945
+ if (lastTemplateInfo) {
2946
+ if (vertical) {
2947
+ totalWidth = lastTemplateInfo.top + lastTemplateInfo.height - 1;
2948
+ } else {
2949
+ totalWidth = lastTemplateInfo.left + lastTemplateInfo.width - 1;
2950
+ }
2951
+ }
2952
+ props.syncOnScroll(visibleInfo.start, visibleInfo.range, totalWidth);
2953
+ }
2954
+ }
2106
2955
 
2107
2956
  //touch setting
2108
2957
  let actorController = null;
@@ -2117,13 +2966,15 @@ export const setup = (
2117
2966
  let onMoveSensitivity = -1;
2118
2967
 
2119
2968
  const getVisibleStart = (moveInfo) => {
2120
- divPos = vertical ? slideDivTop.value + freeMoveSlideGapTop : slideDivLeft.value + freeMoveSlideGapLeft;
2969
+ divPos = vertical
2970
+ ? slideDivTop.value + freeMoveSlideGapTop
2971
+ : slideDivLeft.value + freeMoveSlideGapLeft;
2121
2972
  if (vertical) {
2122
2973
  return -(divPos + Math.round(moveInfo.yPos));
2123
2974
  } else {
2124
2975
  return -(divPos + Math.round(moveInfo.xPos));
2125
2976
  }
2126
- }
2977
+ };
2127
2978
 
2128
2979
  function onSensor(pos) {
2129
2980
  const lastTemplateInfo = getItemByIndex(
@@ -2138,7 +2989,9 @@ export const setup = (
2138
2989
  }
2139
2990
  }
2140
2991
  props.onScroll?.(
2141
- vertical ? -(pos.yPos + slideDivTop.value + freeMoveSlideGapTop) : -(pos.xPos + slideDivLeft.value + freeMoveSlideGapLeft),
2992
+ vertical
2993
+ ? -(pos.yPos + slideDivTop.value + freeMoveSlideGapTop)
2994
+ : -(pos.xPos + slideDivLeft.value + freeMoveSlideGapLeft),
2142
2995
  visibleInfo.range,
2143
2996
  totalWidth
2144
2997
  );
@@ -2156,7 +3009,9 @@ export const setup = (
2156
3009
  }
2157
3010
 
2158
3011
  function setSensorSensitivity(sensitivity = DEFAULT_SENSITIVITY) {
2159
- if (!actorController) { return }
3012
+ if (!actorController) {
3013
+ return;
3014
+ }
2160
3015
  if (sensitivity <= 0) {
2161
3016
  actorController.run((cmds) => [
2162
3017
  cmds.state().removeConditionByGroup(ScensorCondigionGroup),
@@ -2165,11 +3020,10 @@ export const setup = (
2165
3020
  }
2166
3021
 
2167
3022
  if (sensitivity != onMoveSensitivity) {
2168
- setOnMovement(sensitivity)
3023
+ setOnMovement(sensitivity);
2169
3024
  }
2170
3025
  }
2171
3026
 
2172
-
2173
3027
  const getTouchCount = (nexusCustomData) => {
2174
3028
  let touchCount = -1;
2175
3029
  if (nexusCustomData) {
@@ -2180,7 +3034,7 @@ export const setup = (
2180
3034
  }
2181
3035
  }
2182
3036
  return touchCount;
2183
- }
3037
+ };
2184
3038
 
2185
3039
  const mergeTouchSlideToSlideDiv = (touchCount) => {
2186
3040
  let originSlideDivTop = slideDivTop.value;
@@ -2192,40 +3046,50 @@ export const setup = (
2192
3046
  }
2193
3047
  let newSlideGapTop = originSlideDivTop - slideDivTop.value;
2194
3048
  let newSlideGapLeft = originSlideDivLeft - slideDivLeft.value;
2195
- freeMoveSlideGapTop += newSlideGapTop; // 累计slider变化的gap,等待同步完毕时消除gap
3049
+ freeMoveSlideGapTop += newSlideGapTop; // 累计slider变化的gap,等待同步完毕时消除gap
2196
3050
  freeMoveSlideGapLeft += newSlideGapLeft;
2197
3051
 
2198
3052
  const walls = getTouchWall();
2199
3053
  actorController.run((cmds) => [
2200
3054
  cmds.state().removeConditionByGroup(wallConditionGroup),
2201
- cmds.condition(wallConditionGroup, true)
3055
+ cmds
3056
+ .condition(wallConditionGroup, true)
2202
3057
  .boxPosition(walls.left, walls.top, walls.right, walls.bottom)
2203
3058
  .then([cmds.state().setHitWallOverflow()]), //TODO 通过prop设置哪个方向overflow
2204
3059
  cmds.state().setStartOffsetPos(newSlideGapLeft, newSlideGapTop), // 将div的位置调整回馈给FreeMove计量系统
2205
- cmds.condition().onNextTick(0).then([
2206
- SliderEditFuncReOrderWrap(() => {
2207
- freeMoveSlideGapTop -= newSlideGapTop;
2208
- freeMoveSlideGapLeft -= newSlideGapLeft;
2209
- }, true) // Slide调整回调要放在其他事件之前,调整slide的gap值
2210
- ])
3060
+ cmds
3061
+ .condition()
3062
+ .onNextTick(0)
3063
+ .then([
3064
+ SliderEditFuncReOrderWrap(() => {
3065
+ freeMoveSlideGapTop -= newSlideGapTop;
3066
+ freeMoveSlideGapLeft -= newSlideGapLeft;
3067
+ }, true), // Slide调整回调要放在其他事件之前,调整slide的gap值
3068
+ ]),
2211
3069
  ]);
2212
- }
3070
+ };
2213
3071
  function onTouchActionDone(touchCount) {
2214
3072
  //一次触控动作结束
2215
3073
  mergeTouchSlideToSlideDiv(touchCount);
2216
3074
  //由于movement的监听是有帧数间隔的, 所以结束时需要再调用一次onScroll
2217
3075
  _onScroll();
3076
+ _syncOnScroll();
2218
3077
  }
2219
3078
 
2220
3079
  const onTouchDown = (data, customData, nexusCustomData) => {
3080
+ const curPos = vertical ? slideDivTop.value : slideDivLeft.value;
3081
+ let needMerge = -visibleInfo.start != curPos;
3082
+ if (needMerge) {
3083
+ mergeTouchSlideToSlideDiv(touchRecorder.touchCount);
3084
+ }
3085
+
2221
3086
  touchRecorder.reset();
2222
3087
  let touchCount = getTouchCount(nexusCustomData);
2223
3088
  touchRecorder.setTouchCount(touchCount);
2224
3089
  updateTouchBoxCondition();
2225
3090
 
2226
- mode.touchStart(touchCount);
2227
- // console.log("touchtest", `${props.name} animId:${debugAnimId} viewId:${debugViewId}`,
2228
- // "onTouchDown", data, customData, nexusCustomData)
3091
+ JsvInteractionMode.value = TOUCH_MODE;
3092
+ touchStateMgr.touchStart(touchCount);
2229
3093
 
2230
3094
  // 运动方向锁定机制
2231
3095
  // 当MetroWidget在某一方向拖动后,讲另一方向的移动进行锁定
@@ -2236,23 +3100,30 @@ export const setup = (
2236
3100
  right: vertical ? undefined : lockThreshhold,
2237
3101
  top: vertical ? lockThreshhold : undefined,
2238
3102
  bottom: vertical ? lockThreshhold : undefined,
2239
- }
3103
+ };
2240
3104
 
2241
3105
  let passDownTouchInfo = nexusCustomData;
2242
3106
  actorController.run((cmds) => [
2243
3107
  cmds
2244
3108
  .condition(TouchDownConditionGroup, false)
2245
- .offsetPosition(offsetThreshold.left, offsetThreshold.top, offsetThreshold.right, offsetThreshold.bottom)
3109
+ .offsetPosition(
3110
+ offsetThreshold.left,
3111
+ offsetThreshold.top,
3112
+ offsetThreshold.right,
3113
+ offsetThreshold.bottom
3114
+ )
2246
3115
  .then([
2247
- cmds.state().touchLockSwitch(true, vertical ? 1 : 2, unlockThreshold)]),
3116
+ cmds.state().touchLockSwitch(true, vertical ? 1 : 2, unlockThreshold),
3117
+ ]),
2248
3118
  cmds
2249
3119
  .condition(TouchDownConditionGroup, false)
2250
3120
  .startMove(true, true)
2251
- .then([SliderEditFuncReOrderWrap((d) => { onDragStart(d, null, passDownTouchInfo) })]),
2252
- ])
2253
-
2254
- //blur item
2255
- // onItemBlur(getItemById(focusId));
3121
+ .then([
3122
+ SliderEditFuncReOrderWrap((d) => {
3123
+ onDragStart(d, null, passDownTouchInfo);
3124
+ }),
3125
+ ]),
3126
+ ]);
2256
3127
 
2257
3128
  templateItemAdder.tryAddItemByPosition(visibleInfo.end + visibleInfo.range);
2258
3129
 
@@ -2262,103 +3133,127 @@ export const setup = (
2262
3133
  visibleInfo.endWithPadding + innerKeepTraceRange * pageRange,
2263
3134
  0,
2264
3135
  false,
2265
- permanentItemList
3136
+ permanentItemList,
3137
+ props.fullDisplayMode
2266
3138
  );
2267
3139
  updater.apply();
2268
3140
 
2269
3141
  //创建锚点
2270
3142
  const anchorArea = 2 * Forge.sRenderBridge.GetScreenInfo().designedWidth;
2271
3143
  let anchorPosList = [];
2272
- let anchorSpacing = visibleInfo.range * 2 / 3;
3144
+ let anchorSpacing = (visibleInfo.range * 2) / 3;
2273
3145
  let anchorPos = anchorSpacing;
2274
3146
  while (anchorPos < anchorArea) {
2275
3147
  anchorPosList.push(-visibleInfo.start + anchorPos);
2276
- anchorPosList.push(-visibleInfo.start - visibleInfo.range - anchorPos + 1);
3148
+ anchorPosList.push(
3149
+ -visibleInfo.start - visibleInfo.range - anchorPos + 1
3150
+ );
2277
3151
  anchorPos += anchorSpacing;
2278
3152
  }
2279
3153
  actorController.run((cmds) => {
2280
- const reachConditionList = anchorPosList.map(pos => {
3154
+ const reachConditionList = anchorPosList.map((pos) => {
2281
3155
  return cmds
2282
3156
  .condition(reachAnchorGroup)
2283
3157
  .reachPosition(pos, undefined)
2284
- .then([SliderEditFuncReOrderWrap((data) => { updateRenderItems(true, true) })])
2285
- })
3158
+ .then([
3159
+ SliderEditFuncReOrderWrap((data) => {
3160
+ updateRenderItems(true, true);
3161
+ }),
3162
+ ]);
3163
+ });
2286
3164
  reachConditionList.unshift(
2287
- cmds.state().removeConditionByGroup(reachAnchorGroup),
2288
- )
2289
- return reachConditionList
3165
+ cmds.state().removeConditionByGroup(reachAnchorGroup)
3166
+ );
3167
+ return reachConditionList;
2290
3168
  });
2291
- }
3169
+
3170
+ props.onTouchFocus?.();
3171
+ };
2292
3172
 
2293
3173
  const onTouchRelease = (touchCount) => {
2294
- if (mode.getTouchState() == TouchState.TAP) {
3174
+ if (touchStateMgr.getTouchState() == TouchState.TAP) {
2295
3175
  //只点击, 没有移动或者fling
2296
3176
  updateRenderItems(false, false);
2297
- mode.touchEnd(touchCount);
3177
+ touchStateMgr.touchEnd(touchCount);
2298
3178
  } else {
2299
- if (touchRecorder.moved && !mode.duringFling()) {
3179
+ if (touchRecorder.moved && !touchStateMgr.duringFling()) {
2300
3180
  onTouchActionDone(touchRecorder.touchCount);
2301
3181
  updateRenderItems(false, false);
2302
- mode.touchEnd(touchCount)
3182
+ touchStateMgr.touchEnd(touchCount);
2303
3183
  }
2304
3184
  }
2305
3185
  actorController.run((cmds) => [
2306
3186
  cmds.state().removeConditionByGroup(TouchDownConditionGroup),
2307
- cmds.state().touchLockSwitch(false, vertical ? 1 : 2)
2308
- ])
2309
- }
3187
+ cmds.state().touchLockSwitch(false, vertical ? 1 : 2),
3188
+ ]);
3189
+ };
2310
3190
 
2311
- const exportOnTouchRelease = props.touchFlag > 0 ? onTouchRelease : undefined;
3191
+ const exportOnTouchRelease = touchEnable.value ? onTouchRelease : undefined;
2312
3192
 
2313
3193
  const onDragStart = (data, customData, nexusCustomData) => {
2314
3194
  let touchCount = getTouchCount(nexusCustomData);
2315
3195
  touchRecorder.move();
2316
- if (!(mode.getTouchCount() == touchCount && mode.duringFling())) {
3196
+ if (
3197
+ !(
3198
+ touchStateMgr.getTouchCount() == touchCount &&
3199
+ touchStateMgr.duringFling()
3200
+ )
3201
+ ) {
2317
3202
  //dragStart event may be triggered after fling event because of sending it when startMove condition is satisfied
2318
- mode.dragStart(touchCount)
3203
+ touchStateMgr.dragStart(touchCount);
2319
3204
  }
2320
3205
  visibleInfo.start = getVisibleStart(data);
2321
- }
3206
+ };
2322
3207
 
2323
3208
  const onDragEnd = (data, customData, nexusCustomData) => {
2324
3209
  let touchCount = getTouchCount(nexusCustomData);
2325
- mode.dragEnd(touchCount);
3210
+ touchStateMgr.dragEnd(touchCount);
2326
3211
  visibleInfo.start = getVisibleStart(data);
2327
3212
  actorController.run((cmds) => [
2328
3213
  cmds.state().removeConditionByGroup(reachAnchorGroup),
2329
3214
  ]);
2330
- }
3215
+ };
2331
3216
 
2332
3217
  const onFlingStart = (data, customData, nexusCustomData) => {
2333
3218
  let touchCount = getTouchCount(nexusCustomData);
2334
3219
  touchRecorder.move();
2335
- mode.flingStart(touchCount);
3220
+ touchStateMgr.flingStart(touchCount);
2336
3221
  visibleInfo.start = getVisibleStart(data);
2337
3222
  updateRenderItems(true, true);
2338
- }
3223
+ };
2339
3224
 
2340
3225
  const onFlingProgress = (data, customData, nexusCustomData) => {
2341
3226
  let touchCount = getTouchCount(nexusCustomData);
2342
3227
  visibleInfo.start = getVisibleStart(data);
2343
3228
  updateRenderItems(true, true);
2344
- }
3229
+ };
2345
3230
 
2346
3231
  const onFlingEnd = (data, customData, nexusCustomData) => {
2347
3232
  visibleInfo.start = getVisibleStart(data);
2348
3233
  //记录拖拽的距离
2349
- if (mode.duringFling()) {
3234
+ if (touchStateMgr.duringFling()) {
2350
3235
  let touchCount = getTouchCount(nexusCustomData);
2351
3236
  onTouchActionDone(touchCount);
2352
3237
  updateRenderItems(false, false);
2353
- mode.flingEnd(touchCount);
2354
- mode.touchEnd(touchCount);
3238
+ touchStateMgr.flingEnd(touchCount);
3239
+ touchStateMgr.touchEnd(touchCount);
2355
3240
  }
2356
- }
3241
+ };
2357
3242
 
2358
3243
  const onFlingDrop = (data, customData, nexusCustomData) => {
2359
3244
  let touchCount = getTouchCount(nexusCustomData);
2360
3245
  visibleInfo.start = getVisibleStart(data);
2361
- }
3246
+ };
3247
+
3248
+ const onFlingCancel = (data, customData, nexusCustomData) => {
3249
+ visibleInfo.start = getVisibleStart(data);
3250
+ if (touchStateMgr.duringFling()) {
3251
+ let touchCount = getTouchCount(nexusCustomData);
3252
+ onTouchActionDone(touchCount);
3253
+ updateRenderItems(false, false);
3254
+ touchStateMgr.flingEnd(touchCount);
3255
+ }
3256
+ };
2362
3257
 
2363
3258
  const getTouchWall = () => {
2364
3259
  const boxSize = metroTemplate.getBoundingBoxSize();
@@ -2367,15 +3262,26 @@ export const setup = (
2367
3262
  top: 0,
2368
3263
  right: 0,
2369
3264
  bottom: 0,
3265
+ };
3266
+ if (props.fullDisplayMode) {
3267
+ return wall;
2370
3268
  }
2371
3269
  if (vertical) {
2372
- wall.top = -boxSize.height + props.height - slideDivTop.value - (widgetRectInfo.padding.top + widgetRectInfo.padding.bottom);
3270
+ wall.top =
3271
+ -boxSize.height +
3272
+ props.height -
3273
+ slideDivTop.value -
3274
+ (widgetRectInfo.padding.top + widgetRectInfo.padding.bottom);
2373
3275
  wall.bottom = -slideDivTop.value;
2374
3276
  if (wall.top > wall.bottom) {
2375
3277
  wall.top = wall.bottom;
2376
3278
  }
2377
3279
  } else {
2378
- wall.left = -boxSize.width + props.width - slideDivLeft.value - (widgetRectInfo.padding.left + widgetRectInfo.padding.right);
3280
+ wall.left =
3281
+ -boxSize.width +
3282
+ props.width -
3283
+ slideDivLeft.value -
3284
+ (widgetRectInfo.padding.left + widgetRectInfo.padding.right);
2379
3285
  wall.right = -slideDivLeft.value;
2380
3286
  if (wall.left > wall.right) {
2381
3287
  wall.left = wall.right;
@@ -2383,25 +3289,28 @@ export const setup = (
2383
3289
  }
2384
3290
 
2385
3291
  return wall;
2386
- }
3292
+ };
2387
3293
 
2388
3294
  const updateRenderItems = (applyTmp, expand) => {
2389
- templateItemAdder.tryAddItemByPosition(visibleInfo.start + visibleInfo.range);
3295
+ templateItemAdder.tryAddItemByPosition(
3296
+ visibleInfo.start + visibleInfo.range
3297
+ );
2390
3298
  const updater = pageUpdater.update(
2391
3299
  metroTemplate,
2392
3300
  visibleInfo.startWithPadding - innerKeepTraceRange * pageRange,
2393
3301
  visibleInfo.endWithPadding + innerKeepTraceRange * pageRange,
2394
3302
  0,
2395
3303
  true,
2396
- permanentItemList
3304
+ permanentItemList,
3305
+ props.fullDisplayMode
2397
3306
  );
2398
3307
  applyTmp ? updater.applyTmp() : updater.apply();
2399
- }
3308
+ };
2400
3309
 
2401
3310
  const updateTouchBoxCondition = () => {
3311
+ if (JsvInteractionMode.value != TOUCH_MODE) return;
2402
3312
  if (actorController != null) {
2403
3313
  const walls = getTouchWall();
2404
-
2405
3314
  //更新wall设置
2406
3315
  actorController.run((cmds) => [
2407
3316
  cmds.state().removeConditionByGroup(wallConditionGroup),
@@ -2411,7 +3320,7 @@ export const setup = (
2411
3320
  .then([cmds.state().setHitWallOverflow()]), //TODO 通过prop设置哪个方向overflow
2412
3321
  ]);
2413
3322
  }
2414
- }
3323
+ };
2415
3324
 
2416
3325
  const touchRecorder = {
2417
3326
  moved: false,
@@ -2425,33 +3334,28 @@ export const setup = (
2425
3334
  },
2426
3335
  setTouchCount: function (count) {
2427
3336
  this.touchCount = count;
2428
- }
3337
+ },
2429
3338
  };
2430
3339
 
2431
- const metroWidgetToken = metroWidgetTokenGen++;
2432
-
2433
3340
  let orderTouchSlideCallbacks;
2434
3341
  const SliderEditFuncReOrderWrap = (callback, addHeader = false) => {
2435
3342
  return (...args) => {
2436
- let pkg = { cb: callback, a: args }
3343
+ let pkg = { cb: callback, a: args };
2437
3344
  if (addHeader) {
2438
3345
  orderTouchSlideCallbacks.splice(0, 0, pkg);
2439
3346
  } else {
2440
3347
  orderTouchSlideCallbacks.push(pkg);
2441
3348
  }
2442
- }
2443
- }
3349
+ };
3350
+ };
2444
3351
 
2445
- //TODO debug
2446
- // let debugAnimId = -1;
2447
- // let debugViewId = -1
2448
- let touchInited = false;
2449
- const initTouch = () => {
2450
- touchInited = true;
3352
+ let freeMoveInited = false
3353
+ function initFreeMove() {
3354
+ if (freeMoveInited) { return; }
3355
+ freeMoveInited = true;
2451
3356
  actorController = new ActorControl();
2452
3357
  const divView = touchDiv.value.jsvGetProxyView();
2453
3358
  actorController.bindForgeView(divView, true);
2454
-
2455
3359
  // 对触控回调进行顺序管理
2456
3360
  orderTouchSlideCallbacks = new Array();
2457
3361
  actorController.addCondCycleListener(
@@ -2468,7 +3372,17 @@ export const setup = (
2468
3372
  // 执行结束后进行清理
2469
3373
  orderTouchSlideCallbacks.length = 0;
2470
3374
  }
2471
- )
3375
+ );
3376
+ }
3377
+
3378
+ //TODO debug
3379
+ // let debugAnimId = -1;
3380
+ // let debugViewId = -1
3381
+ let touchInited = false;
3382
+ const initTouch = () => {
3383
+ if (touchInited) { return; }
3384
+ touchInited = true;
3385
+ initFreeMove();
2472
3386
 
2473
3387
  // debugAnimId = actorController.debugGetAnimId();
2474
3388
  // debugViewId = divView.ViewId;
@@ -2504,6 +3418,10 @@ export const setup = (
2504
3418
  .condition(undefined, true)
2505
3419
  .onFlingDrop()
2506
3420
  .then([SliderEditFuncReOrderWrap(onFlingDrop)]),
3421
+ cmds
3422
+ .condition(undefined, true)
3423
+ .onFlingCancel()
3424
+ .then([SliderEditFuncReOrderWrap(onFlingCancel)]),
2507
3425
  cmds
2508
3426
  .condition(undefined, true)
2509
3427
  .onTouchRelease()
@@ -2517,19 +3435,56 @@ export const setup = (
2517
3435
  if (props.onScroll) {
2518
3436
  setOnMovement(DEFAULT_SENSITIVITY);
2519
3437
  }
3438
+ };
3439
+
3440
+ const onMouseWheelScrollProgress = (data) => {
3441
+ visibleInfo.start = getVisibleStart(data);
3442
+ updateRenderItems(true, true);
3443
+ mergeTouchSlideToSlideDiv();
3444
+ };
3445
+
3446
+ const DEFAULT_MOUSE_CONFIG = {
3447
+ wheelRate: 10,
2520
3448
  }
3449
+ let mouseInited = false;
3450
+ const initMouse = () => {
3451
+ if (mouseInited) { return; }
3452
+ mouseInited = true;
3453
+ initFreeMove();
3454
+ const divView = touchDiv.value.jsvGetProxyView();
3455
+ if (!actorController) {
3456
+ actorController = new ActorControl();
3457
+ actorController.bindForgeView(divView, true);
3458
+ }
3459
+ // 1: hover, 2: scroll, 目前只打开scroll
3460
+ divView.HoverEnables(2);
3461
+ divView.SetMouseWheelRate(props.mouseConfig?.wheelRate ?? DEFAULT_MOUSE_CONFIG.wheelRate);
3462
+ actorController.run((cmds) => [
3463
+ cmds
3464
+ .condition(undefined, true)
3465
+ .onMouseWheelScrollProgress()
3466
+ .then([SliderEditFuncReOrderWrap(onMouseWheelScrollProgress)]),
3467
+ ]);
3468
+ };
2521
3469
 
2522
- function cleanTouch() {
3470
+ function cleanFreeMoveConditions() {
2523
3471
  actorController.run((cmds) => [
2524
3472
  cmds.state().clearAllConditions(),
2525
- cmds.state().touchLockSwitch(false, vertical ? 1 : 2)
2526
- ])
3473
+ cmds.state().touchLockSwitch(false, vertical ? 1 : 2),
3474
+ ]);
2527
3475
  }
2528
3476
 
2529
3477
  //init
2530
3478
 
2531
3479
  function safeProvideData() {
2532
- return props.provideData() ?? [];
3480
+ const d = props.provideData();
3481
+ if (d instanceof Array) {
3482
+ return d;
3483
+ }
3484
+ console.warn(
3485
+ `MetroWidget provideData must return an array. name:${props.name} provideData:${d}`
3486
+ );
3487
+ return [];
2533
3488
  }
2534
3489
  pageUpdater = new PageUpdater(_updatePage, props.name);
2535
3490
  visibleInfo.range = vertical
@@ -2544,7 +3499,7 @@ export const setup = (
2544
3499
  } else if (props.data) {
2545
3500
  dataList = toRaw(props.data ?? [])?.concat();
2546
3501
  }
2547
- dataKeyList = dataList.map(i => i[DATA_ID_KEY]);
3502
+ dataKeyList = dataList.map((i) => i[DATA_ID_KEY]);
2548
3503
 
2549
3504
  templateItemAdder = new TemplateItemAdder(
2550
3505
  metroTemplate,
@@ -2553,9 +3508,10 @@ export const setup = (
2553
3508
  pageRange,
2554
3509
  _onTemplateItemAdd,
2555
3510
  props.name,
2556
- _onTemplateAddDone
3511
+ getOnTemplateAddDone(true),
3512
+ errorLogger
2557
3513
  );
2558
- if (props.onScroll) {
3514
+ if (props.onScroll || props.fullDisplayMode) {
2559
3515
  templateItemAdder.tryAddItemByIndex(dataList.length - 1);
2560
3516
  } else {
2561
3517
  templateItemAdder.tryAddItem(null, 2);
@@ -2569,8 +3525,18 @@ export const setup = (
2569
3525
  const item = getItemById(props.initFocusId);
2570
3526
  if (item) {
2571
3527
  init_focus_id = props.initFocusId;
2572
- if (item.itemConfig.itemSlide == METRO_WIDGET_CONST.ITEM_SLIDE.ACT_ITEM_FOCUS) {
2573
- initVisibleStart = _calculateVisibleStart(item.templateInfo, 0, item.templateInfo, visibleInfo);
3528
+ if (
3529
+ item.itemConfig.itemSlide ==
3530
+ METRO_WIDGET_CONST.ITEM_SLIDE.ACT_ITEM_FOCUS
3531
+ ) {
3532
+ initVisibleStart = _calculateVisibleStart(
3533
+ item.templateInfo,
3534
+ 0,
3535
+ item.templateInfo,
3536
+ visibleInfo,
3537
+ null,
3538
+ false
3539
+ );
2574
3540
  }
2575
3541
  }
2576
3542
  }
@@ -2585,12 +3551,13 @@ export const setup = (
2585
3551
  initVisibleInfo.endWithPadding,
2586
3552
  0,
2587
3553
  false,
2588
- permanentItemList
3554
+ permanentItemList,
3555
+ props.fullDisplayMode
2589
3556
  );
2590
3557
  initUpdater.apply();
2591
3558
  //触控时, 延时加载剩余屏
2592
3559
  let delayLoadHandler = -1;
2593
- if (props.touchFlag > 0) {
3560
+ if (touchEnable.value) {
2594
3561
  delayLoadHandler = setTimeout(() => {
2595
3562
  const updateHandler = pageUpdater.update(
2596
3563
  metroTemplate,
@@ -2598,7 +3565,8 @@ export const setup = (
2598
3565
  initVisibleInfo.endWithPadding + innerKeepTraceRange * pageRange,
2599
3566
  focusId,
2600
3567
  false,
2601
- permanentItemList
3568
+ permanentItemList,
3569
+ props.fullDisplayMode
2602
3570
  );
2603
3571
  updateHandler.apply();
2604
3572
  }, 200);
@@ -2613,28 +3581,74 @@ export const setup = (
2613
3581
  if (!firstOnItemFocusCalled) {
2614
3582
  firstOnItemFocusCalled = onItemFocus(getItemById(focusId), preEdgeRect);
2615
3583
  }
3584
+ //第一次ongaze
3585
+ onItemGaze(getItemById(focusId), preEdgeRect);
2616
3586
 
2617
3587
  if (props.enableItemRenderBreak) {
2618
3588
  nextTick(() => {
2619
3589
  itemRender.value = true;
2620
3590
  });
2621
3591
  }
2622
- if (props.touchFlag === 1) {
3592
+ if (touchEnable.value) {
2623
3593
  initTouch();
2624
3594
  }
3595
+ if (props.mouseFlag > 0) {
3596
+ initMouse();
3597
+ }
3598
+ _onSizeChange();
2625
3599
  });
2626
3600
 
2627
- onUpdated(() => { });
3601
+ onUpdated(() => {});
2628
3602
 
2629
3603
  onBeforeUnmount(() => {
3604
+ if (vRenderBreakChanged) {
3605
+ window.JsView?.setRenderBreakEnable?.(true);
3606
+ }
2630
3607
  taskManager.cancelAllTask();
2631
3608
  tryCancelDelayLoad();
2632
3609
  mounted = false;
2633
- if (touchInited) {
2634
- cleanTouch();
3610
+ if (touchInited || mouseInited) {
3611
+ cleanFreeMoveConditions();
3612
+ }
3613
+ if (rootNativeViewId != -1) {
3614
+ Forge.sViewStore.remove(rootNativeViewId);
3615
+ }
3616
+ if (spatialNavigator) {
3617
+ renderData.value.forEach((item) => {
3618
+ spatialNavigator.unregisterNode(item.getSpatialNavNode());
3619
+ });
2635
3620
  }
2636
3621
  });
2637
3622
 
3623
+ //spatial navigator相关
3624
+ //作为子MetroWidget时的index
3625
+ let selfChildIndex = undefined;
3626
+ function getSelfChildIndex () {
3627
+ if (!parentMetroWidget) { return undefined; }
3628
+ if (!rootDiv.value) {
3629
+ console.warn("getSelfChildIndex before mounted.")
3630
+ return undefined;
3631
+ }
3632
+ if (selfChildIndex !== undefined) { return selfChildIndex; }
3633
+ let n = rootDiv.value;
3634
+ while(n) {
3635
+ if (n.getAttribute("__metrowidget-index") !== undefined) {
3636
+ selfChildIndex = parseInt(n.getAttribute("__metrowidget-index"));
3637
+ break;
3638
+ }
3639
+ n = n.parentNode;
3640
+ }
3641
+ return selfChildIndex;
3642
+ };
3643
+ const provideObj = {
3644
+ id: metroWidgetId,
3645
+ divRef: rootDiv,
3646
+ handler: exportObject,
3647
+ getSelfChildIndex,
3648
+ }
3649
+ const metroWidgetChain = parentMetroWidget ? [...parentMetroWidget, provideObj] : [provideObj];
3650
+ provide(MW_CONTEXT_NAME, metroWidgetChain);
3651
+
2638
3652
  return {
2639
3653
  widgetRectInfo,
2640
3654
  focusBlockOnFocus,
@@ -2648,7 +3662,8 @@ export const setup = (
2648
3662
  onTouchDown,
2649
3663
  onTouchRelease: exportOnTouchRelease,
2650
3664
  currentFocusIndex,
2651
- modeForExport,
2652
- onDispatchKeyDown
2653
- }
2654
- }
3665
+ onDispatchKeyDown,
3666
+ isFocus,
3667
+ rootNativeViewId,
3668
+ };
3669
+ };