@shijiu/jsview-vue 0.9.502 → 0.9.590

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 (215) hide show
  1. package/dom/bin/jsview-browser-debug-dom.min.js +1 -1
  2. package/dom/bin/jsview-dom.min.js +1 -1
  3. package/dom/target_core_revision.js +4 -3
  4. package/index.js +10 -0
  5. package/package.json +8 -1
  6. package/patches/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js +16 -5
  7. package/samples/AnimPicture/App.vue +89 -106
  8. package/samples/Basic/App.vue +65 -68
  9. package/samples/Basic/components/ContentBlock.vue +31 -36
  10. package/samples/Basic/components/anim/AnimGroup.vue +61 -75
  11. package/samples/Basic/components/anim/AnimKeyframeBasic.vue +54 -43
  12. package/samples/Basic/components/anim/AnimKeyframeComposite.vue +25 -31
  13. package/samples/Basic/components/anim/AnimTransition.vue +142 -105
  14. package/samples/Basic/components/div/DivBackground.vue +38 -16
  15. package/samples/Basic/components/div/DivClip.vue +143 -78
  16. package/samples/Basic/components/div/DivCssScoped.vue +10 -10
  17. package/samples/Basic/components/div/DivCssVar.vue +40 -42
  18. package/samples/Basic/components/div/DivGroup1.vue +45 -39
  19. package/samples/Basic/components/div/DivGroup2.vue +56 -45
  20. package/samples/Basic/components/div/DivLayout.vue +34 -5
  21. package/samples/Basic/components/div/DivRadius.vue +51 -42
  22. package/samples/Basic/components/div/DivTransform.vue +21 -16
  23. package/samples/Basic/components/panel/Panel1.vue +46 -44
  24. package/samples/Basic/components/panel/Panel2.vue +22 -26
  25. package/samples/Basic/components/panel/TitleBar.vue +12 -12
  26. package/samples/Basic/components/text/TextAlign.vue +54 -44
  27. package/samples/Basic/components/text/TextEmoji.vue +16 -20
  28. package/samples/Basic/components/text/TextFontStyle.vue +77 -53
  29. package/samples/Basic/components/text/TextGroup1.vue +46 -38
  30. package/samples/Basic/components/text/TextGroup2.vue +25 -28
  31. package/samples/Basic/components/text/TextOverflow.vue +76 -57
  32. package/samples/BasicFocusControl/App.vue +22 -43
  33. package/samples/BasicFocusControl/components/BaseBlock.vue +42 -43
  34. package/samples/BasicFocusControl/components/MainArea.vue +55 -70
  35. package/samples/BasicFocusControl/components/MainAreaLeftBlock.vue +11 -15
  36. package/samples/BasicFocusControl/components/MainAreaRightBlock.vue +21 -24
  37. package/samples/BasicFocusControl/components/SideBar.vue +32 -47
  38. package/samples/BasicFocusControl/components/SideBarBlock.vue +20 -23
  39. package/samples/ColorSpace/App.vue +15 -24
  40. package/samples/DemoHomepage/App.vue +7 -11
  41. package/samples/DemoHomepage/components/BodyFrame.vue +19 -9
  42. package/samples/DemoHomepage/components/TabFrame.vue +7 -8
  43. package/samples/DemoHomepage/router.js +32 -33
  44. package/samples/DemoHomepage/views/Homepage.vue +24 -8
  45. package/samples/FilterDemo/AnimatePic.vue +58 -0
  46. package/samples/FilterDemo/App.vue +99 -61
  47. package/samples/FilterDemo/VideoLayer.vue +62 -0
  48. package/samples/FlipCard/App.vue +32 -41
  49. package/samples/FlipCard/FlipCard.vue +48 -54
  50. package/samples/GridDemo/App.vue +109 -77
  51. package/samples/GridDemo/ButtonBlock.vue +50 -49
  52. package/samples/GridDemo/FocusItem.vue +19 -38
  53. package/samples/GridDemo/Item.vue +46 -54
  54. package/samples/HashHistory/App.vue +63 -79
  55. package/samples/HashHistory/components/HorizontalButtonList.vue +72 -95
  56. package/samples/HashHistory/components/Item.vue +42 -56
  57. package/samples/HashHistory/router.js +23 -12
  58. package/samples/HashHistory/views/MainPage.vue +35 -46
  59. package/samples/HashHistory/views/SubPage.vue +34 -47
  60. package/samples/Input/App.vue +2 -3
  61. package/samples/Input/FullKeyboard.vue +2 -6
  62. package/samples/Input/InputPanel.vue +2 -3
  63. package/samples/Input/KeyboardItem.vue +1 -1
  64. package/samples/LongImage/App.vue +11 -27
  65. package/samples/LongImage/Button.vue +50 -145
  66. package/samples/LongImage/ButtonItem.vue +44 -0
  67. package/samples/LongImage/LongImageScroll.vue +71 -106
  68. package/samples/LongImage/Scroll.vue +7 -9
  69. package/samples/LongText/App.vue +13 -28
  70. package/samples/LongText/Button.vue +43 -145
  71. package/samples/LongText/ButtonItem.vue +44 -0
  72. package/samples/LongText/LongTextScroll.vue +68 -101
  73. package/samples/LongText/Scroll.vue +7 -9
  74. package/samples/Marquee/App.vue +34 -37
  75. package/samples/MaskClip/App.vue +17 -30
  76. package/samples/MetroWidgetDemos/Advanced/App.vue +211 -0
  77. package/samples/MetroWidgetDemos/Advanced/ButtonItem.vue +90 -0
  78. package/samples/MetroWidgetDemos/Item.vue +67 -0
  79. package/samples/{SimpleWidgetDemo → MetroWidgetDemos/PerformanceTest}/App.vue +80 -104
  80. package/samples/{SimpleWidgetDemo → MetroWidgetDemos/PerformanceTest}/Item.vue +7 -0
  81. package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/bg.jpg +0 -0
  82. package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/coupon_content.png +0 -0
  83. package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/coupon_left.png +0 -0
  84. package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/coupon_mid.png +0 -0
  85. package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/coupon_right.png +0 -0
  86. package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/focus_border.png +0 -0
  87. package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/holder_logo.png +0 -0
  88. package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/jrbm.png +0 -0
  89. package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/line_left.png +0 -0
  90. package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/line_mid.png +0 -0
  91. package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/line_right.png +0 -0
  92. package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/loading.png +0 -0
  93. package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/logo.png +0 -0
  94. package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/mcjx.png +0 -0
  95. package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/tao.png +0 -0
  96. package/samples/{ClassNameDemo → MetroWidgetDemos/PerformanceTest}/assets/tmall.png +0 -0
  97. package/samples/{SimpleWidgetDemo → MetroWidgetDemos/PerformanceTest}/border.png +0 -0
  98. package/samples/{SimpleWidgetDemo → MetroWidgetDemos/PerformanceTest}/components/ContentItem.vue +60 -86
  99. package/samples/{SimpleWidgetDemo → MetroWidgetDemos/PerformanceTest}/components/MyTab.vue +0 -0
  100. package/samples/MetroWidgetDemos/PerformanceTest/data.js +45 -0
  101. package/samples/MetroWidgetDemos/PingPong/App.vue +135 -0
  102. package/samples/MetroWidgetDemos/PingPong/AppPage.vue +58 -0
  103. package/samples/MetroWidgetDemos/PingPong/AppTab.vue +69 -0
  104. package/samples/MetroWidgetDemos/PingPong/Item.vue +92 -0
  105. package/samples/MetroWidgetDemos/PingPong/ViewSwiper.vue +214 -0
  106. package/samples/MetroWidgetDemos/Simple/App.vue +194 -0
  107. package/samples/MetroWidgetDemos/WidgetItem.vue +89 -0
  108. package/samples/MetroWidgetDemos/data.js +204 -0
  109. package/samples/NinePatchDemo/App.vue +114 -115
  110. package/samples/NinePatchDemo/Item.vue +7 -8
  111. package/samples/Preload/App.vue +61 -63
  112. package/samples/Preload/Item.vue +21 -29
  113. package/samples/QrcodeDemo/App.vue +24 -29
  114. package/samples/SoundPool/App.vue +77 -106
  115. package/samples/SprayView/App.vue +10 -8
  116. package/samples/SpriteImage/App.vue +1 -2
  117. package/samples/TextBox/App.vue +86 -101
  118. package/samples/TextBox/RenderCenter.vue +1 -1
  119. package/samples/TextBox/RenderLeft.vue +1 -1
  120. package/samples/TextBox/RenderOneLine.vue +1 -1
  121. package/samples/TextBox/RenderRight.vue +1 -1
  122. package/samples/TextShadowDemo/App.vue +1 -2
  123. package/samples/TextureAnimation/App.vue +16 -13
  124. package/samples/TextureSize/App.vue +15 -25
  125. package/samples/ThrowMoveDemo/AccelerateDemo.vue +2 -4
  126. package/samples/ThrowMoveDemo/LRParabolicDemo.vue +2 -3
  127. package/samples/ThrowMoveDemo/TargetDemo.vue +3 -4
  128. package/samples/ThrowMoveDemo/UDParabolicDemo.vue +2 -3
  129. package/samples/TouchSample/App.vue +2 -3
  130. package/samples/TouchSample/Item.vue +15 -13
  131. package/samples/TouchSample/MetroWidgetHorizontal.vue +2 -2
  132. package/samples/TouchSample/MetroWidgetVertical.vue +1 -1
  133. package/samples/TouchSample/TouchContainerHorizontal.vue +4 -3
  134. package/samples/TouchSample/TouchContainerVertical.vue +3 -2
  135. package/samples/TransitPage/App.vue +20 -32
  136. package/samples/VideoDemo/App.vue +65 -81
  137. package/samples/VideoDemo/components/Button.vue +41 -52
  138. package/samples/VideoDemo/components/Controllor.vue +171 -169
  139. package/samples/VideoDemo/components/VideoFrame.vue +87 -99
  140. package/samples/VisibleSensorDemo/App.vue +167 -0
  141. package/scripts/jsview-jsmap-serve.js +42 -0
  142. package/scripts/jsview-post-install.js +1 -1
  143. package/tsconfig.json +3 -0
  144. package/utils/JsViewEngineWidget/JsvFocusBlock.vue +204 -193
  145. package/utils/JsViewEngineWidget/JsvFocusManager.js +30 -17
  146. package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +1555 -1656
  147. package/utils/JsViewEngineWidget/MetroWidget/PageUpdater.js +136 -0
  148. package/utils/JsViewEngineWidget/MetroWidget/ToolFunctions.js +18 -0
  149. package/utils/JsViewEngineWidget/TemplateParser.js +111 -1
  150. package/utils/JsViewEngineWidget/WidgetCommon.js +8 -2
  151. package/utils/JsViewEngineWidget/index.js +4 -4
  152. package/utils/JsViewPlugin/JsvPlayer/GetVersion.js +1 -1
  153. package/utils/JsViewPlugin/JsvPlayer/JsvMedia.js +264 -54
  154. package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +5 -1
  155. package/utils/JsViewPlugin/JsvPlayer/version.js +5 -5
  156. package/utils/JsViewVueTools/JsvRefTaker.js +35 -0
  157. package/utils/JsViewVueTools/index.js +19 -0
  158. package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserQrcode.vue +8 -4
  159. package/utils/JsViewVueWidget/JsvFilterView.vue +59 -51
  160. package/utils/JsViewVueWidget/JsvGrid.vue +139 -41
  161. package/utils/JsViewVueWidget/JsvMaskClipDiv.vue +3 -1
  162. package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +8 -17
  163. package/utils/JsViewVueWidget/JsvNinePatch.vue +1 -1
  164. package/utils/JsViewVueWidget/JsvPosterDiv.vue +37 -7
  165. package/utils/JsViewVueWidget/JsvPosterImage.vue +34 -13
  166. package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +2 -12
  167. package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +1 -1
  168. package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +13 -10
  169. package/utils/JsViewVueWidget/JsvSpriteAnim/index.js +2 -3
  170. package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +25 -21
  171. package/utils/JsViewVueWidget/JsvTransparentDiv.vue +7 -8
  172. package/utils/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue +141 -0
  173. package/utils/JsViewVueWidget/JsvVisibleSensor/index.js +9 -0
  174. package/utils/JsViewVueWidget/index.js +42 -0
  175. package/samples/AdvanceMetroWidget/App.vue +0 -123
  176. package/samples/AdvanceMetroWidget/Frame.vue +0 -102
  177. package/samples/AdvanceMetroWidget/Item.vue +0 -63
  178. package/samples/AdvanceMetroWidget/data.js +0 -137
  179. package/samples/ClassNameDemo/App.vue +0 -119
  180. package/samples/ClassNameDemo/components/ContentItem.vue +0 -253
  181. package/samples/ClassNameDemo/components/LoadingView.vue +0 -43
  182. package/samples/ClassNameDemo/components/TitleView.vue +0 -24
  183. package/samples/ClassNameDemo/data.js +0 -24
  184. package/samples/FlowMultiWidget/App.vue +0 -91
  185. package/samples/FlowMultiWidget/assets/nine_patch_focus.png +0 -0
  186. package/samples/FlowMultiWidget/components/Block.vue +0 -107
  187. package/samples/FlowMultiWidget/components/FlowPage.vue +0 -60
  188. package/samples/FlowMultiWidget/components/Item.vue +0 -103
  189. package/samples/FlowMultiWidget/components/MenuItem.vue +0 -72
  190. package/samples/FlowMultiWidget/components/MyMenu.vue +0 -90
  191. package/samples/FlowMultiWidget/data.js +0 -446
  192. package/samples/HashHistory/views/BasePage.vue +0 -19
  193. package/samples/HashHistory/views/SubPageFirst.vue +0 -10
  194. package/samples/HashHistory/views/SubPageSecond.vue +0 -10
  195. package/samples/SimpleWidgetDemo/assets/bg.jpg +0 -0
  196. package/samples/SimpleWidgetDemo/assets/coupon_content.png +0 -0
  197. package/samples/SimpleWidgetDemo/assets/coupon_left.png +0 -0
  198. package/samples/SimpleWidgetDemo/assets/coupon_mid.png +0 -0
  199. package/samples/SimpleWidgetDemo/assets/coupon_right.png +0 -0
  200. package/samples/SimpleWidgetDemo/assets/focus_border.png +0 -0
  201. package/samples/SimpleWidgetDemo/assets/holder_logo.png +0 -0
  202. package/samples/SimpleWidgetDemo/assets/jrbm.png +0 -0
  203. package/samples/SimpleWidgetDemo/assets/line_left.png +0 -0
  204. package/samples/SimpleWidgetDemo/assets/line_mid.png +0 -0
  205. package/samples/SimpleWidgetDemo/assets/line_right.png +0 -0
  206. package/samples/SimpleWidgetDemo/assets/loading.png +0 -0
  207. package/samples/SimpleWidgetDemo/assets/logo.png +0 -0
  208. package/samples/SimpleWidgetDemo/assets/mcjx.png +0 -0
  209. package/samples/SimpleWidgetDemo/assets/tao.png +0 -0
  210. package/samples/SimpleWidgetDemo/assets/tmall.png +0 -0
  211. package/samples/SimpleWidgetDemo/data.js +0 -124
  212. package/utils/JsViewEngineWidget/MetroWidget/ContentView.vue +0 -63
  213. package/utils/JsViewEngineWidget/MetroWidget/DivWrapper.vue +0 -51
  214. package/utils/JsViewEngineWidget/MetroWidget/ItemView.vue +0 -213
  215. package/utils/JsViewEngineWidget/MetroWidget/RootView.vue +0 -154
@@ -0,0 +1,167 @@
1
+ <script setup>
2
+ import { reactive, onMounted, ref } from "vue";
3
+ import { useRouter } from "vue-router";
4
+ import { jJsvRuntimeBridge, JsvVisibleSensor } from "jsview";
5
+
6
+ const BOX_WIDTH = 150;
7
+ const BOX_HEIGHT = 150;
8
+ const BOX_COLOR = "#00FFFF";
9
+
10
+ const router = useRouter();
11
+
12
+ let shown = reactive({
13
+ vertical: 0.25,
14
+ horizon: 1.0,
15
+ });
16
+
17
+ let left_change = reactive({ left: 0 });
18
+ let top_change = reactive({ top: 0 });
19
+
20
+ const containerRef = ref(null);
21
+ let case_config = ref(null);
22
+ let status_text = reactive({
23
+ oldH: "false",
24
+ newH: "false",
25
+ oldV: "false",
26
+ newV: "false",
27
+ });
28
+
29
+ case_config.value = getTestCase(0);
30
+
31
+ onMounted(() => {
32
+ jJsvRuntimeBridge.notifyPageLoaded();
33
+ });
34
+
35
+ // 内部接口
36
+ const onBeVisible = (old_h, new_h, old_v, new_v) => {
37
+ status_text.oldH = old_h ? "true" : "false";
38
+ status_text.newH = new_h ? "true" : "false";
39
+ status_text.oldV = old_v ? "true" : "false";
40
+ status_text.newV = new_v ? "true" : "false";
41
+ };
42
+
43
+ const onKeyDown = (ev) => {
44
+ // 8:Backspace, 27:Escape, 10000:盒子返回键
45
+ if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
46
+ router?.go(-1); // 有router时,回退
47
+ return true;
48
+ }
49
+ return false;
50
+ };
51
+
52
+ function getTestCase(test_index) {
53
+ let test_config = {
54
+ animation: null,
55
+ text: null,
56
+ horizon: 1.0,
57
+ vertical: 1.0,
58
+ };
59
+
60
+ switch (test_index) {
61
+ case 0: {
62
+ // 上到下
63
+ test_config.animation = "visibleSensor_upDown 5s infinite linear";
64
+ test_config.text = "从上到下";
65
+ test_config.horizon = 1.0;
66
+ test_config.vertical = 0.25;
67
+ break;
68
+ }
69
+ case 1: {
70
+ // 左到右
71
+ test_config.animation = "visibleSensor_leftRight 5s infinite linear";
72
+ test_config.text = "从左到右";
73
+ test_config.horizon = 0.25;
74
+ test_config.vertical = 1.0;
75
+ break;
76
+ }
77
+ }
78
+
79
+ return test_config;
80
+ }
81
+ </script>
82
+
83
+ <template>
84
+ <jsv-focus-block autoFocus :onKeyDown="onKeyDown">
85
+ <div :style="{ width: 1280, height: 720, backgroundColor: '#00F000' }">
86
+ <div
87
+ :style="{
88
+ left: 10,
89
+ top: 10,
90
+ height: 100,
91
+ width: 900,
92
+ fontColor: '#000000',
93
+ fontSize: 15,
94
+ lineHeight: 20,
95
+ }"
96
+ >
97
+ {{
98
+ `new horizon: ${status_text.newH}
99
+ new vertical: ${status_text.newV}
100
+ -------
101
+ old horizon: ${status_text.oldH}
102
+ old vertical: ${status_text.oldV}`
103
+ }}
104
+ </div>
105
+ <div
106
+ ref="containerRef"
107
+ :style="{
108
+ left: 240,
109
+ top: 110,
110
+ width: 800,
111
+ height: 500,
112
+ backgroundColor: '#00F0F0',
113
+ }"
114
+ >
115
+ <div
116
+ :style="{
117
+ left: 0,
118
+ top: 0,
119
+ animation: case_config.animation,
120
+ }"
121
+ >
122
+ <JsvVisibleSensor
123
+ :horizonShown="case_config.horizon"
124
+ :verticalShown="case_config.vertical"
125
+ :width="BOX_WIDTH"
126
+ :height="BOX_HEIGHT"
127
+ :enable="true"
128
+ :container="containerRef"
129
+ :callback="onBeVisible"
130
+ >
131
+ <div
132
+ :style="{
133
+ width: BOX_WIDTH,
134
+ height: BOX_HEIGHT,
135
+ backgroundColor: BOX_COLOR,
136
+ fontSize: 20,
137
+ lineHeight: 30,
138
+ }"
139
+ >
140
+ {{ case_config.text }}
141
+ </div>
142
+ </JsvVisibleSensor>
143
+ </div>
144
+ </div>
145
+ </div>
146
+ </jsv-focus-block>
147
+ </template>
148
+
149
+ <style scoped>
150
+ @keyframes visibleSensor_upDown {
151
+ from {
152
+ transform: translate3d(300px, -200px, 0);
153
+ }
154
+ to {
155
+ transform: translate3d(300px, 600px, 0);
156
+ }
157
+ }
158
+
159
+ @keyframes visibleSensor_leftRight {
160
+ from {
161
+ transform: translate3d(-160px, 200px, 0);
162
+ }
163
+ to {
164
+ transform: translate3d(1400px, 200px, 0);
165
+ }
166
+ }
167
+ </style>
@@ -6,10 +6,37 @@ const os = require('os');
6
6
 
7
7
  let baseDir = __dirname;
8
8
 
9
+ let script_name = __filename.substr(__dirname.length + 1)
10
+
11
+ let redirect_url;
12
+ if (process.argv.length >= 2) {
13
+ let args_start = 0;
14
+ for (let i = 0; i < process.argv.length; i++) {
15
+ if (process.argv[i].endsWith(script_name)) {
16
+ args_start = i + 1;
17
+ break;
18
+ }
19
+ }
20
+ const args = process.argv.slice(args_start)
21
+ redirect_url = args[0]
22
+ if (!redirect_url.endsWith('/')) {
23
+ redirect_url = redirect_url + '/';
24
+ }
25
+ }
26
+
9
27
  function requestListener(req, res) {
10
28
  console.log("[request] " + req.url);
11
29
 
12
30
  if (req.url.endsWith("\.map")) { // return map source file content
31
+ if (redirect_url) {
32
+ // redirect with 302 HTTP code in response
33
+ let redirect_target = redirect_url
34
+ + convertMapBaseUrl(req.url)
35
+ console.log(`redirect ${req.url} -> ${redirect_target}`)
36
+ res.writeHead(302, { "Location": redirect_target });
37
+ return res.end();
38
+ }
39
+
13
40
  try {
14
41
  const fileContent = fs.readFileSync(baseDir + '/' + req.url);
15
42
 
@@ -26,6 +53,18 @@ function requestListener(req, res) {
26
53
  res.end();
27
54
  };
28
55
 
56
+ function convertMapBaseUrl(origin_url) {
57
+ if (origin_url.startsWith('/map/')) {
58
+ /* 去掉子目录/map/ */
59
+ return origin_url.substr(5);
60
+ } else if (origin_url.startsWith('/')) {
61
+ /* 去掉'/' */
62
+ return origin_url.substring(1, origin_url.length);
63
+ } else {
64
+ return origin_url;
65
+ }
66
+ }
67
+
29
68
  function getIPAddress() {
30
69
  let ret = [];
31
70
 
@@ -52,6 +91,9 @@ function main() {
52
91
  server.listen(port, '0.0.0.0', () => {
53
92
  console.log('');
54
93
  console.log('JavaScript source map running at:');
94
+ if (redirect_url) {
95
+ console.log('with redirect url=' + redirect_url)
96
+ }
55
97
  console.log(' - Local: localhost:' + port);
56
98
  getIPAddress().forEach(ip => {
57
99
  console.log(' - Network: ' + ip + ':' + port);
@@ -53,7 +53,7 @@ async function printRevision(options) {
53
53
 
54
54
  console.log('**************************************************');
55
55
  console.log('* Update revision to:');
56
- console.log('* CORE: ' + jsviewTargetVersion.CoreRevision);
56
+ console.log('* CORE: ' + jsviewTargetVersion.CoreRevisionAndBranch);
57
57
  console.log('* ENGINE JS URL: ' + jsviewTargetVersion.JseUrl);
58
58
  console.log('* PLUGIN LIST: ');
59
59
 
package/tsconfig.json CHANGED
@@ -22,6 +22,9 @@
22
22
  ],
23
23
  "jsview/*": [
24
24
  "./*"
25
+ ],
26
+ "jsview": [
27
+ "./index.js"
25
28
  ]
26
29
  },
27
30
  "lib": [
@@ -1,215 +1,226 @@
1
1
  <!--
2
- * onKeyUp: 按键抬起回调
2
+ * props:
3
+ * onKeyUp: 按键抬起回调
3
4
  * @params keyEvent
4
5
  * @return 是否消耗 true: 已消耗,不再冒泡; false: 继续冒泡
5
- * onKeyDown: 按键落下回调
6
+ * onKeyDown: 按键落下回调
6
7
  * @params keyEvent
7
8
  * @return 是否消耗 true: 已消耗,不再冒泡; false: 继续冒泡
8
- * onFocus: 获得焦点回调
9
- * onBlur: 失去焦点回调
10
- * onDispatchKeyDown: 分发按键落下事件回调
9
+ * onFocus: 获得焦点回调
10
+ * onBlur: 失去焦点回调
11
+ * onDispatchKeyDown: 分发按键落下事件回调
11
12
  * @params keyEvent
12
13
  * @return 是否消耗 true: 已消耗,不再分发; false: 继续分发
13
- * onDispatchKeyUp: 分发按键抬起事件回调
14
+ * onDispatchKeyUp: 分发按键抬起事件回调
14
15
  * @params keyEvent
15
16
  * @return 是否消耗 true: 已消耗,不再分发; false: 继续分发
16
- * name: 用于设置焦点的id
17
- * namespace: 焦点id的命名空间
18
- * autoFocus: 当Mount后自动获得焦点, 设置为"exact",将把其子节点的焦点给抢过来
17
+ * name: 用于设置焦点的id
18
+ * namespace: 焦点id的命名空间
19
+ * autoFocus: 当Mount后自动获得焦点, 设置为"exact",将把其子节点的焦点给抢过来
20
+ * methods:
21
+ * findBlockByName
22
+ @description 寻找焦点树上的节点
23
+ @params {string} name 节点的id名
24
+ * requestFocus
25
+ @description 赋予焦点
26
+ @params {boolean} passToChild 焦点由子往父时是否保持子的焦点
27
+ * returnFocusToParent
28
+ @description 把焦点给自己的父节点
19
29
  -->
20
30
 
21
- <script>
22
- /* eslint-disable no-extra-boolean-cast */
23
- /* eslint-disable no-prototype-builtins */
24
-
25
- export default {
26
- props: {
27
- name: String,
28
- namespace: String,
29
- autoFocus: String,
30
- onAction: Object,
31
- onDispatchKeyUp: Function,
32
- onDispatchKeyDown: Function,
33
- onKeyUp: Function,
34
- onKeyDown: Function,
35
- onFocus: Function,
36
- onBlur: Function,
37
- onCustomerEvent: Function,
38
- },
39
-
40
- setup(props) {
41
- // 有效性检查
42
- if (props.namespace && props.name) {
43
- throw new Error(
44
- "JsvFocusBlock Error: Either name or namespace can be set."
45
- );
46
- }
47
- if (props.namespace === "") {
48
- throw new Error("JsvFocusBlock Error: Invalid namespace of empty value.");
49
- }
50
- if (props.namespace && props.namespace.indexOf(".") >= 0) {
51
- throw new Error(
52
- 'JsvFocusBlock Error: Invalid namespace of "' +
53
- props.namespace +
54
- '". namespace must not contains "."'
55
- );
31
+ <script setup>
32
+ /* eslint-disable */
33
+ import { onMounted, onBeforeUnmount, ref, toRaw } from "vue";
34
+ const props = defineProps({
35
+ name: String,
36
+ namespace: String,
37
+ autoFocus: String,
38
+ onAction: Object,
39
+ onDispatchKeyUp: Function,
40
+ onDispatchKeyDown: Function,
41
+ onKeyUp: Function,
42
+ onKeyDown: Function,
43
+ onFocus: Function,
44
+ onBlur: Function,
45
+ onCustomerEvent: Function,
46
+ });
47
+ if (props.namespace && props.name) {
48
+ throw new Error("JsvFocusBlock Error: Either name or namespace can be set.");
49
+ }
50
+ if (props.namespace === "") {
51
+ throw new Error("JsvFocusBlock Error: Invalid namespace of empty value.");
52
+ }
53
+ if (props.namespace && props.namespace.indexOf(".") >= 0) {
54
+ throw new Error(
55
+ 'JsvFocusBlock Error: Invalid namespace of "' +
56
+ props.namespace +
57
+ '". namespace must not contains "."'
58
+ );
59
+ }
60
+ if (props.name && props.name.indexOf(".") >= 0) {
61
+ throw new Error(
62
+ 'JsvFocusBlock Error: Invalid name of "' +
63
+ props.name +
64
+ '". name must not contains "."'
65
+ );
66
+ }
67
+ let actionCallback = {};
68
+ let fDivRef = ref(null);
69
+
70
+ //methods
71
+ const getName = () => {
72
+ return toRaw(fDivRef.value)?.FocusNodeRef.getName();
73
+ };
74
+
75
+ const getNamespace = () => {
76
+ let focusNode = toRaw(fDivRef.value)?.FocusNodeRef;
77
+ if (focusNode?.AsHub) {
78
+ // hub的getHub返回的是自己
79
+ focusNode = toRaw(fDivRef.value)?.FocusNodeRef.GetParentPage();
80
+ }
81
+ const namespace = focusNode.getName();
82
+ return namespace !== ".__AppRoot__" ? namespace : "";
83
+ };
84
+
85
+ const findBlockByName = (name) => {
86
+ const focusNode = toRaw(fDivRef.value)?.FocusNodeRef.getNodeByName(name);
87
+ return focusNode?.jsvVueComponent;
88
+ };
89
+
90
+ const requestFocus = (passToChild) => {
91
+ toRaw(fDivRef.value)?.FocusNodeRef.requestFocus(passToChild);
92
+ };
93
+
94
+ const returnFocusToParent = () => {
95
+ toRaw(fDivRef.value)?.FocusNodeRef.ReturnFocusToParent();
96
+ };
97
+
98
+ const bubbleCustomerEvent = (ev) => {
99
+ toRaw(fDivRef.value)?.FocusNodeRef.bubbleCustomerEvent(ev);
100
+ };
101
+
102
+ const debugPrintFocusChain = () => {
103
+ toRaw(fDivRef.value)?.FocusNodeRef.printFocusNodeList();
104
+ };
105
+
106
+ const debugPrintLastFocus = () => {
107
+ toRaw(fDivRef.value)?.FocusNodeRef.printGlobalLastFocus();
108
+ };
109
+
110
+ const exportObject = {
111
+ getName,
112
+ getNamespace,
113
+ findBlockByName,
114
+ requestFocus,
115
+ returnFocusToParent,
116
+ bubbleCustomerEvent,
117
+ debugPrintFocusChain,
118
+ debugPrintLastFocus,
119
+ };
120
+ const _mountToFocusSystem = () => {
121
+ const focusNode = toRaw(fDivRef.value)?.FocusNodeRef;
122
+
123
+ // 保存self,find用, 通过exportObject代表自己的instance
124
+ focusNode.jsvVueComponent = exportObject;
125
+
126
+ // 注册回调函数
127
+ actionCallback.onDispatchKeyDown =
128
+ props.onDispatchKeyDown || props.onAction?.onDispatchKeyDown;
129
+ if (actionCallback.onDispatchKeyDown) {
130
+ focusNode.setDispatchKeyDown(_onDispatchKeyDown);
131
+ }
132
+ actionCallback.onDispatchKeyUp =
133
+ props.onDispatchKeyUp || props.onAction?.onDispatchKeyUp;
134
+ if (actionCallback.onDispatchKeyUp) {
135
+ focusNode.setDispatchKeyUp(_onDispatchKeyUp);
136
+ }
137
+ actionCallback.onKeyDown = props.onKeyDown || props.onAction?.onKeyDown;
138
+ if (actionCallback.onKeyDown) {
139
+ focusNode.setOnKeyDown(_onKeyDown);
140
+ }
141
+ actionCallback.onKeyUp = props.onKeyUp || props.onAction?.onKeyUp;
142
+ if (actionCallback.onKeyUp) {
143
+ focusNode.setOnKeyUp(_onKeyUp);
144
+ }
145
+ actionCallback.onFocus = props.onFocus || props.onAction?.onFocus;
146
+ if (actionCallback.onFocus) {
147
+ focusNode.setOnFocus(_onFocus);
148
+ }
149
+ actionCallback.onBlur = props.onBlur || props.onAction?.onBlur;
150
+ if (actionCallback.onBlur) {
151
+ focusNode.setOnBlur(_onBlur);
152
+ }
153
+
154
+ actionCallback.onCustomerEvent =
155
+ props.onCustomerEvent || props.onAction?.onCustomerEvent;
156
+ if (actionCallback.onCustomerEvent) {
157
+ focusNode.setOnCustomerEvent(_onCustomerEvent);
158
+ }
159
+ // 建立父子关系链
160
+ let self = toRaw(fDivRef.value);
161
+ let parent = self.parentElement;
162
+ while (parent) {
163
+ if (self.FocusNodeRef.GetParentPage()) {
164
+ break;
56
165
  }
57
- if (props.name && props.name.indexOf(".") >= 0) {
58
- throw new Error(
59
- 'JsvFocusBlock Error: Invalid name of "' +
60
- props.name +
61
- '". name must not contains "."'
62
- );
166
+
167
+ if (parent.tagName !== "FDIV") {
168
+ parent = parent.parentElement;
169
+ continue;
63
170
  }
64
171
 
65
- return {
66
- actionCallback: {},
67
- };
68
- },
69
- mounted() {
70
- this.$_mountToFocusSystem();
172
+ self.FocusNodeRef.setParent(parent.FocusNodeRef);
173
+ break;
174
+ }
175
+ };
71
176
 
72
- if (!!this.$props.autoFocus || this.$props.autoFocus === "") {
73
- this.requestFocus(this.$props.autoFocus !== "exact");
74
- }
75
- },
76
- beforeUnmount() {
77
- const focusNode = this.$el.FocusNodeRef;
78
- focusNode.onUnMount();
79
- focusNode.jsvVueComponent = undefined;
80
- },
81
-
82
- methods: {
83
- getName() {
84
- return this.$el.FocusNodeRef.getName();
85
- },
86
-
87
- getNamespace() {
88
- let focusNode = this.$el.FocusNodeRef;
89
- if (focusNode?.AsHub) {
90
- // hub的getHub返回的是自己
91
- focusNode = this.$el.FocusNodeRef.GetParentPage();
92
- }
93
- const namespace = focusNode.getName();
94
- return namespace !== ".__AppRoot__" ? namespace : "";
95
- },
96
-
97
- findBlockByName(name) {
98
- const focusNode = this.$el.FocusNodeRef.getNodeByName(name);
99
- return focusNode?.jsvVueComponent;
100
- },
101
-
102
- requestFocus(passToChild) {
103
- this.$el.FocusNodeRef.requestFocus(passToChild);
104
- },
105
-
106
- bubbleCustomerEvent(ev) {
107
- this.$el.FocusNodeRef.bubbleCustomerEvent(ev);
108
- },
109
-
110
- debugPrintFocusChain() {
111
- this.$el.FocusNodeRef.printFocusNodeList();
112
- },
113
-
114
- debugPrintLastFocus() {
115
- this.$el.FocusNodeRef.printGlobalLastFocus();
116
- },
117
-
118
- $_mountToFocusSystem() {
119
- const focusNode = this.$el.FocusNodeRef;
120
-
121
- // 保存self,find用
122
- focusNode.jsvVueComponent = this;
123
-
124
- // 注册回调函数
125
- this.actionCallback.onDispatchKeyDown =
126
- this.$props.onDispatchKeyDown ||
127
- this.$props.onAction?.onDispatchKeyDown;
128
- if (this.actionCallback.onDispatchKeyDown) {
129
- focusNode.setDispatchKeyDown(this.$_onDispatchKeyDown);
130
- }
131
- this.actionCallback.onDispatchKeyUp =
132
- this.$props.onDispatchKeyUp || this.$props.onAction?.onDispatchKeyUp;
133
- if (this.actionCallback.onDispatchKeyUp) {
134
- focusNode.setDispatchKeyUp(this.$_onDispatchKeyUp);
135
- }
136
- this.actionCallback.onKeyDown =
137
- this.$props.onKeyDown || this.$props.onAction?.onKeyDown;
138
- if (this.actionCallback.onKeyDown) {
139
- focusNode.setOnKeyDown(this.$_onKeyDown);
140
- }
141
- this.actionCallback.onKeyUp =
142
- this.$props.onKeyUp || this.$props.onAction?.onKeyUp;
143
- if (this.actionCallback.onKeyUp) {
144
- focusNode.setOnKeyUp(this.$_onKeyUp);
145
- }
146
- this.actionCallback.onFocus =
147
- this.$props.onFocus || this.$props.onAction?.onFocus;
148
- if (this.actionCallback.onFocus) {
149
- focusNode.setOnFocus(this.$_onFocus);
150
- }
151
- this.actionCallback.onBlur =
152
- this.$props.onBlur || this.$props.onAction?.onBlur;
153
- if (this.actionCallback.onBlur) {
154
- focusNode.setOnBlur(this.$_onBlur);
155
- }
156
-
157
- this.actionCallback.onCustomerEvent =
158
- this.$props.onCustomerEvent || this.$props.onAction?.onCustomerEvent;
159
- if (this.actionCallback.onCustomerEvent) {
160
- focusNode.setOnCustomerEvent(this.$_onCustomerEvent);
161
- }
162
- // 建立父子关系链
163
- let self = this.$el;
164
- let parent = self.parentElement;
165
- while (parent) {
166
- if (self.FocusNodeRef.GetParentPage()) {
167
- break;
168
- }
169
-
170
- if (parent.tagName !== "FDIV") {
171
- parent = parent.parentElement;
172
- continue;
173
- }
174
-
175
- self.FocusNodeRef.setParent(parent.FocusNodeRef);
176
-
177
- self = parent;
178
- parent = self.parentElement;
179
- }
180
- },
181
-
182
- $_onDispatchKeyDown(ev) {
183
- ev.ownerNode = this;
184
- return this.actionCallback?.onDispatchKeyDown(ev) || false;
185
- },
186
- $_onDispatchKeyUp(ev) {
187
- ev.ownerNode = this;
188
- return this.actionCallback?.onDispatchKeyUp(ev) || false;
189
- },
190
- $_onKeyDown(ev) {
191
- ev.ownerNode = this;
192
- return this.actionCallback?.onKeyDown(ev) || false;
193
- },
194
- $_onKeyUp(ev) {
195
- ev.ownerNode = this;
196
- return this.actionCallback?.onKeyUp(ev) || false;
197
- },
198
- $_onFocus() {
199
- this.actionCallback?.onFocus(this) || false;
200
- },
201
- $_onBlur() {
202
- this.actionCallback?.onBlur(this) || false;
203
- },
204
- $_onCustomerEvent(ev) {
205
- return this.actionCallback?.onCustomerEvent(ev) || false;
206
- },
207
- },
177
+ const _onDispatchKeyDown = (ev) => {
178
+ ev.ownerNode = exportObject;
179
+ return actionCallback?.onDispatchKeyDown(ev) || false;
180
+ };
181
+ const _onDispatchKeyUp = (ev) => {
182
+ ev.ownerNode = exportObject;
183
+ return actionCallback?.onDispatchKeyUp(ev) || false;
184
+ };
185
+ const _onKeyDown = (ev) => {
186
+ ev.ownerNode = exportObject;
187
+ return actionCallback?.onKeyDown(ev) || false;
188
+ };
189
+ const _onKeyUp = (ev) => {
190
+ ev.ownerNode = exportObject;
191
+ return actionCallback?.onKeyUp(ev) || false;
208
192
  };
193
+ const _onFocus = () => {
194
+ actionCallback?.onFocus(exportObject);
195
+ };
196
+ const _onBlur = () => {
197
+ actionCallback?.onBlur(exportObject);
198
+ };
199
+ const _onCustomerEvent = (ev) => {
200
+ return actionCallback?.onCustomerEvent(ev) || false;
201
+ };
202
+
203
+ onMounted(() => {
204
+ _mountToFocusSystem();
205
+
206
+ if (!!props.autoFocus || props.autoFocus === "") {
207
+ requestFocus(props.autoFocus !== "exact");
208
+ }
209
+ });
210
+
211
+ onBeforeUnmount(() => {
212
+ const focusNode = toRaw(fDivRef.value)?.FocusNodeRef;
213
+ focusNode?.onUnMount();
214
+ if (focusNode?.jsvVueComponent) {
215
+ focusNode.jsvVueComponent = undefined;
216
+ }
217
+ });
218
+
219
+ defineExpose(exportObject);
209
220
  </script>
210
221
 
211
222
  <template>
212
- <fdiv :fname="$props.name" :new-namespace="$props.namespace">
223
+ <fdiv ref="fDivRef" :fname="name" :new-namespace="namespace">
213
224
  <slot></slot>
214
225
  </fdiv>
215
226
  </template>