@shijiu/jsview-vue 2.2.426-test.0 → 2.3.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 (86) hide show
  1. package/bin/jsview-vue-common.mjs +1 -1
  2. package/bin/jsview-vue.mjs +7506 -6980
  3. package/bin/types/utils/JsViewEngineWidget/JsvFocus/JsvFocusManager.d.ts +11 -2
  4. package/bin/types/utils/JsViewEngineWidget/MetroWidget/DebugFrame.vue.d.ts +8 -0
  5. package/bin/types/utils/JsViewEngineWidget/MetroWidget/DebugTools.d.ts +5 -0
  6. package/bin/types/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue.d.ts +24 -6
  7. package/bin/types/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue.d.ts +24 -6
  8. package/bin/types/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.d.ts +9 -2
  9. package/bin/types/utils/JsViewEngineWidget/MetroWidget/RenderItem.d.ts +3 -0
  10. package/bin/types/utils/JsViewPlugin/JsvAudio/version.d.mts +1 -0
  11. package/bin/types/utils/JsViewPlugin/JsvAudio/version.d.ts +1 -0
  12. package/bin/types/utils/JsViewPlugin/JsvLatex/BrowserJsvLatex.vue.d.ts +1 -1
  13. package/bin/types/utils/JsViewPlugin/JsvLatex/JsvLatex.vue.d.ts +1 -1
  14. package/bin/types/utils/JsViewPlugin/JsvPlayer/AckEventDefine.d.ts +10 -0
  15. package/bin/types/utils/JsViewPlugin/JsvPlayer/BrowserJsvPlayer.vue.d.ts +1 -2
  16. package/bin/types/utils/JsViewPlugin/JsvPlayer/JsvMedia.d.ts +2 -2
  17. package/bin/types/utils/JsViewVueTools/JsvRuntimeBridge.d.ts +6 -0
  18. package/bin/types/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/Path.d.ts +21 -0
  19. package/bin/types/utils/JsViewVueTools/JsvTextureStore/JsvTextureStore.d.ts +1 -1
  20. package/bin/types/utils/JsViewVueTools/index.d.ts +0 -1
  21. package/bin/types/utils/JsViewVueWidget/Jsv3dDiv.vue.d.ts +120 -0
  22. package/bin/types/utils/JsViewVueWidget/Jsv3dStage.vue.d.ts +144 -0
  23. package/bin/types/utils/JsViewVueWidget/JsvApic/JsvApic/index.d.ts +50 -2
  24. package/bin/types/utils/JsViewVueWidget/JsvApic/JsvApic2/index.d.ts +23 -2
  25. package/bin/types/utils/JsViewVueWidget/JsvDriftScope/JsvDriftScope.vue.d.ts +4 -4
  26. package/bin/types/utils/JsViewVueWidget/JsvFilterView.vue.d.ts +3 -3
  27. package/bin/types/utils/JsViewVueWidget/JsvFlexCell/JsvFullScrAdjust.vue.d.ts +78 -0
  28. package/bin/types/utils/JsViewVueWidget/JsvFlexCell/index.d.ts +1 -0
  29. package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/FreeMoveActor.vue.d.ts +3 -3
  30. package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/JsvEnvBlocker.vue.d.ts +3 -3
  31. package/bin/types/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.d.ts +1 -0
  32. package/bin/types/utils/JsViewVueWidget/JsvInput/Cursor.vue.d.ts +1 -1
  33. package/bin/types/utils/JsViewVueWidget/JsvMindMap/JsvMindMap.vue.d.ts +3 -3
  34. package/bin/types/utils/JsViewVueWidget/JsvNinePatch.vue.d.ts +4 -4
  35. package/bin/types/utils/JsViewVueWidget/JsvPosterDiv.vue.d.ts +3 -0
  36. package/bin/types/utils/JsViewVueWidget/JsvPosterImage.vue.d.ts +3 -0
  37. package/bin/types/utils/JsViewVueWidget/JsvRipple/JsvRipple.vue.d.ts +3 -3
  38. package/bin/types/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue.d.ts +10 -37
  39. package/bin/types/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue.d.ts +1 -1
  40. package/bin/types/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue.d.ts +1 -1
  41. package/bin/types/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue.d.ts +3 -3
  42. package/bin/types/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue.d.ts +3 -2
  43. package/bin/types/utils/JsViewVueWidget/JsvVisibleSensor/JsvVisibleSensor.vue.d.ts +3 -3
  44. package/bin/types/utils/JsViewVueWidget/JsvVisibleSensor/index.d.ts +3 -3
  45. package/bin/types/utils/JsViewVueWidget/index.d.ts +2 -0
  46. package/package.json +1 -1
  47. package/utils/JsViewEngineWidget/CheckType.js +3 -3
  48. package/utils/JsViewEngineWidget/JsvFocus/JsvFocusBlock.vue +25 -6
  49. package/utils/JsViewEngineWidget/JsvFocus/JsvFocusManager.ts +22 -3
  50. package/utils/JsViewEngineWidget/MetroWidget/DebugFrame.vue +22 -0
  51. package/utils/JsViewEngineWidget/MetroWidget/DebugTools.ts +37 -0
  52. package/utils/JsViewEngineWidget/MetroWidget/ListWidget.vue +42 -7
  53. package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +62 -10
  54. package/utils/JsViewEngineWidget/MetroWidget/MetroWidgetSetup.js +205 -91
  55. package/utils/JsViewEngineWidget/MetroWidget/RenderItem.ts +30 -0
  56. package/utils/JsViewPlugin/JsvAudio/version.js +1 -1
  57. package/utils/JsViewPlugin/JsvAudio/version.mjs +1 -1
  58. package/utils/JsViewPlugin/JsvPlayer/AckEventDefine.ts +82 -0
  59. package/utils/JsViewPlugin/JsvPlayer/BrowserJsvPlayer.vue +49 -31
  60. package/utils/JsViewVueTools/JsvRuntimeBridge.js +12 -3
  61. package/utils/JsViewVueTools/JsvTextureStore/CanvasTexture/Path.ts +38 -2
  62. package/utils/JsViewVueTools/JsvTextureStore/JsvTextureStore.ts +1 -1
  63. package/utils/JsViewVueTools/index.js +0 -1
  64. package/utils/JsViewVueWidget/Jsv3dDiv.vue +85 -0
  65. package/utils/JsViewVueWidget/Jsv3dStage.vue +50 -0
  66. package/utils/JsViewVueWidget/JsvApic/JsvApic/index.js +1 -8
  67. package/utils/JsViewVueWidget/JsvApic/JsvApic2/index.js +1 -8
  68. package/utils/JsViewVueWidget/JsvFlexCell/JsvFlexDiv.vue +1 -1
  69. package/utils/JsViewVueWidget/JsvFlexCell/JsvFullScrAdjust.vue +151 -0
  70. package/utils/JsViewVueWidget/JsvFlexCell/JsvScreenFlex.vue +2 -2
  71. package/utils/JsViewVueWidget/JsvFlexCell/index.js +1 -0
  72. package/utils/JsViewVueWidget/JsvFreeMoveActor/SetState.ts +8 -0
  73. package/utils/JsViewVueWidget/JsvInput/EditViewOperator.ts +1 -1
  74. package/utils/JsViewVueWidget/JsvMaskClipDiv.vue +0 -9
  75. package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +57 -71
  76. package/utils/JsViewVueWidget/JsvPosterDiv.vue +15 -8
  77. package/utils/JsViewVueWidget/JsvPosterImage.vue +11 -1
  78. package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +1 -1
  79. package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +99 -61
  80. package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +48 -48
  81. package/utils/JsViewVueWidget/index.js +2 -0
  82. package/bin/browser/BrowserApic.vue.mjs +0 -114
  83. package/bin/browser/BrowserApic2.vue.mjs +0 -108
  84. package/bin/browser/BrowserApicLib.mjs +0 -431
  85. package/bin/types/utils/JsViewVueTools/JsvDemoTester.d.ts +0 -2
  86. package/utils/JsViewVueTools/JsvDemoTester.js +0 -81
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shijiu/jsview-vue",
3
- "version": "2.2.426-test.0",
3
+ "version": "2.3.0",
4
4
  "license": "MIT",
5
5
  "repository": "system/jsview-framework",
6
6
  "author": "mengxk",
@@ -44,10 +44,10 @@ function checkType(value, type) {
44
44
  let valid;
45
45
  const expectedType = getTypeName(t);
46
46
  if (isSimpleType(expectedType)) {
47
- const t = typeof v;
48
- valid = t === expectedType.toLowerCase();
47
+ const valueType = typeof v;
48
+ valid = valueType === expectedType.toLowerCase();
49
49
  // for primitive wrapper objects
50
- if (!valid && t === 'object') {
50
+ if (!valid && valueType === 'object') {
51
51
  valid = v instanceof t;
52
52
  }
53
53
  }
@@ -221,16 +221,29 @@ onUnmounted(() => {
221
221
  });
222
222
 
223
223
  onActivated(() => {
224
- //TODO 首次mounted后会调用onActivated, 考虑避免重复添加
225
- focusNodeRef = toRaw(fDivRef.value)?.FocusNodeRef;
226
- _mountToFocusSystem();
224
+ if (fDivRef.value == null) {
225
+ console.log("FocusBlock onActivated but not mounted name=" + props.name);
226
+ return;
227
+ }
227
228
 
228
- if (!!props.autoFocus || props.autoFocus === "") {
229
- requestFocus(props.autoFocus !== "exact");
229
+ if (focusNodeRef == null) {
230
+ focusNodeRef = toRaw(fDivRef.value)?.FocusNodeRef;
231
+ _mountToFocusSystem();
232
+
233
+ if (!!props.autoFocus || props.autoFocus === "") {
234
+ requestFocus(props.autoFocus !== "exact");
235
+ }
236
+ } else {
237
+ // 首次mounted后会调用onActivated, 考虑避免重复添加
230
238
  }
231
239
  });
232
240
 
233
241
  onDeactivated(() => {
242
+ if (fDivRef.value == null) {
243
+ console.log("FocusBlock onDeactivated but not mounted name=" + props.name);
244
+ return;
245
+ }
246
+
234
247
  focusNodeRef?.onUnMount(true);
235
248
  if (focusNodeRef?.jsvVueComponent) {
236
249
  focusNodeRef.jsvVueComponent = undefined;
@@ -242,7 +255,13 @@ defineExpose(exportObject);
242
255
  </script>
243
256
 
244
257
  <template>
245
- <fdiv ref="fDivRef" :fname="name" :new-namespace="namespace" :style="style" :data-jsv-focusable="focusable ?? !namespace">
258
+ <fdiv
259
+ ref="fDivRef"
260
+ :fname="name"
261
+ :new-namespace="namespace"
262
+ :style="style"
263
+ :data-jsv-focusable="focusable ?? !namespace"
264
+ >
246
265
  <slot></slot>
247
266
  </fdiv>
248
267
  </template>
@@ -25,8 +25,11 @@ export class JsvFocusManager {
25
25
  // #aliasMap = {}
26
26
  private $_appMount: any = undefined;
27
27
  private $_topFDiv: any = undefined;
28
+ private $_autoSearchFocus: boolean = false;
28
29
 
29
- constructor() { }
30
+ constructor(config: any) {
31
+ this.$_autoSearchFocus = config.autoSearchFocus;
32
+ }
30
33
 
31
34
  install(app: any, ...options: any) {
32
35
  console.log("JsvFocusManager install");
@@ -98,6 +101,7 @@ export class JsvFocusManager {
98
101
  $_hookMount(app: any, rootNodeId: any) {
99
102
  rootNodeId = rootNodeId.replace("#", "");
100
103
  this.$_topFDiv = (document as any).jsvInitFDivRoot(rootNodeId);
104
+ this.$_topFDiv.enableAutoSearchFocus(this.$_autoSearchFocus);
101
105
  this.$_appMount = app.mount.bind(app);
102
106
 
103
107
  return this.$_doAppMount.bind(this);
@@ -115,8 +119,23 @@ export class JsvFocusManager {
115
119
  }
116
120
  }
117
121
 
118
- function jsvCreateFocusManager() {
119
- return new JsvFocusManager();
122
+ /**
123
+ * 创建 JsView 焦点管理器
124
+ *
125
+ * @param {Object} config: 对象设置,子参数有{
126
+ * autoSearchFocus{boolean}: 是否开启自动寻焦,默认为false(兼容旧代码)
127
+ * }
128
+ * @return JsvFocusManager
129
+ */
130
+ function jsvCreateFocusManager(config: Object | null = null) {
131
+ let defualt_config = {
132
+ autoSearchFocus: false
133
+ };
134
+
135
+ return new JsvFocusManager({
136
+ ...defualt_config,
137
+ ...config
138
+ });
120
139
  }
121
140
 
122
141
  export { jsvCreateFocusManager, useFocusHub };
@@ -0,0 +1,22 @@
1
+ <script setup>
2
+ import JsvNinePatch from "../../JsViewVueWidget/JsvNinePatch.vue";
3
+
4
+ const props = defineProps({
5
+ width: Number,
6
+ height: Number,
7
+ sourceId: String,
8
+ })
9
+ </script>
10
+ <template>
11
+ <JsvNinePatch
12
+ :style="{
13
+ width: width,
14
+ height: height,
15
+ }"
16
+ :imageUrl="`jsvtexturestore://${sourceId}`"
17
+ :imageWidth="20"
18
+ :centerWidth="1"
19
+ :imageDspWidth="20"
20
+ :borderOutset="2"
21
+ />
22
+ </template>
@@ -0,0 +1,37 @@
1
+ import { JsvTextureStoreApi } from "../../JsViewVueTools"
2
+
3
+ export const randomColor = () => {
4
+ let randomColor = Math.round(Math.random() * 2 ** 24).toString(16);
5
+ return (
6
+ "#" + new Array(6 - randomColor.length).fill("0").join("") + randomColor + "99"
7
+ );
8
+ };
9
+
10
+ const RandomColorPool = [
11
+ "#FF0000",
12
+ "#00FF00",
13
+ "#0000FF",
14
+ "#FFFF00",
15
+ "#00FFFF",
16
+ "#FF00FF",
17
+ ]
18
+ export function createCanvasText(width: number) {
19
+
20
+ let canvasRef = JsvTextureStoreApi.canvasTexture(
21
+ width,
22
+ width
23
+ ); // 创建画布
24
+
25
+ let customPath = canvasRef.rectPath(0, 0, width, width);
26
+ if (customPath) {
27
+ customPath.stroke(5, RandomColorPool[Math.floor(Math.random() * RandomColorPool.length)]); // 以给定线宽绘制圆环
28
+ }
29
+ let sourceId = canvasRef.commit(); // texture和div的textureStore绑定
30
+ const releaseHandler = () => {
31
+ JsvTextureStoreApi.deleteTexture(sourceId); // 释放texture资源
32
+ }
33
+ return {
34
+ sourceId,
35
+ releaseHandler,
36
+ }
37
+ }
@@ -2,7 +2,7 @@
2
2
  * @file 只显示单列/行的MetroWidget
3
3
  -->
4
4
  <script setup>
5
- import { ref, shallowRef, computed, reactive, onMounted } from "vue";
5
+ import { ref, shallowRef, computed, reactive, onMounted, onBeforeUnmount } from "vue";
6
6
  import { setup } from "./MetroWidgetSetup";
7
7
  import {
8
8
  VERTICAL,
@@ -12,6 +12,8 @@ import {
12
12
  RENDER_ITEM_BREAK_KEY,
13
13
  } from "../WidgetCommon";
14
14
  import { ForgeConst } from "../../JsViewVueTools/ForgeConstDefine.ts";
15
+ import DebugFrame from "./DebugFrame.vue";
16
+ import { createCanvasText } from "./DebugTools.ts";
15
17
 
16
18
  const props = defineProps({
17
19
  padding: {
@@ -147,6 +149,14 @@ const props = defineProps({
147
149
  type: Number,
148
150
  default: 0,
149
151
  },
152
+ enableLongPress: {
153
+ type: Boolean,
154
+ default: false,
155
+ },
156
+ enableDebug: {
157
+ type: Boolean,
158
+ default: false,
159
+ },
150
160
  });
151
161
 
152
162
  const renderBreakKey = props.enableItemRenderBreak ? RENDER_ITEM_BREAK_KEY : "";
@@ -181,13 +191,14 @@ const {
181
191
  focusBlockOnFocus,
182
192
  focusBlockOnBlur,
183
193
  focusBlockOnKeyDown,
194
+ focusBlockOnKeyUp,
184
195
  focusBlockOnCustomEvent,
185
196
  _onFocusableItemEdge,
186
197
  exportObject,
187
198
  onTouchDown,
188
199
  onTouchRelease,
189
200
  currentFocusIndex,
190
- onDispatchKeyDown
201
+ onDispatchKeyDown,
191
202
  } = setup(
192
203
  props,
193
204
  itemRender,
@@ -203,6 +214,15 @@ const {
203
214
  "list"
204
215
  );
205
216
 
217
+ let debugFrameSourceId = "";
218
+ let debugFrameSourceReleaseHandler = null;
219
+ if (props.enableDebug) {
220
+ const sourceInfo = createCanvasText(20);
221
+ debugFrameSourceId = sourceInfo.sourceId;
222
+ debugFrameSourceReleaseHandler = sourceInfo.releaseHandler;
223
+ }
224
+
225
+
206
226
  onMounted(() => {
207
227
  if (onTouchRelease) {
208
228
  touchDiv.value.jsvSetTapListener(
@@ -216,6 +236,14 @@ onMounted(() => {
216
236
  }
217
237
  });
218
238
 
239
+ onBeforeUnmount(() => {
240
+ if (props.enableDebug) {
241
+ debugFrameSourceReleaseHandler?.();
242
+ debugFrameSourceReleaseHandler = null;
243
+ debugFrameSourceId = "";
244
+ }
245
+ });
246
+
219
247
  defineExpose(exportObject);
220
248
  </script>
221
249
 
@@ -262,8 +290,9 @@ defineExpose(exportObject);
262
290
  onFocus: focusBlockOnFocus,
263
291
  onBlur: focusBlockOnBlur,
264
292
  onKeyDown: focusBlockOnKeyDown,
293
+ onKeyUp: focusBlockOnKeyUp,
265
294
  onCustomEvent: focusBlockOnCustomEvent,
266
- onDispatchKeyDown
295
+ onDispatchKeyDown,
267
296
  }"
268
297
  >
269
298
  <div
@@ -286,6 +315,12 @@ defineExpose(exportObject);
286
315
  }"
287
316
  @click="item.onTap.value"
288
317
  >
318
+ <DebugFrame
319
+ v-if="enableDebug"
320
+ :width="item.templateInfo.width"
321
+ :height="item.templateInfo.height"
322
+ :sourceId="debugFrameSourceId"
323
+ ></DebugFrame>
289
324
  <div
290
325
  v-if="
291
326
  !enableItemRenderBreak || item.mounted.value || itemRender
@@ -305,10 +340,10 @@ defineExpose(exportObject);
305
340
  </div>
306
341
  <div
307
342
  v-if="
308
- enableItemRenderBreak
309
- && placeHolderSetting
310
- && !item.mounted.value
311
- && item.itemConfig.showSkeleton
343
+ enableItemRenderBreak &&
344
+ placeHolderSetting &&
345
+ !item.mounted.value &&
346
+ item.itemConfig.showSkeleton
312
347
  "
313
348
  :style="{
314
349
  width: item.renderStyle.width - normalizedPlaceHolder.gap,
@@ -23,7 +23,7 @@
23
23
  * name {string} 用于设置焦点的名称
24
24
  * padding {object} 控件内边距, 默认为{left: 0, right: 0, top: 0, bottom: 0}
25
25
  * direction {enum} (必选)控件方向 HORIZONTAL/VERTICAL
26
- * focusMoveType {int} 焦点移动的模式, 可通过 | 运算进行组合
26
+ * focusMoveType {int} 焦点移动的模式, 可通过 | 运算进行组合. 这些常量在FocusMoveType对象中, 需要import { FocusMoveType } from 'jsview'
27
27
  NO_ADJUST: 无特殊处理
28
28
  COLUMN_LOOP: 到达列首/尾后跳转到上/下一列, 只在水平滚动时生效
29
29
  ROW_LOOP: 到达行首/尾后跳转到上/下一行, 只在竖直滚动时生效
@@ -84,7 +84,7 @@
84
84
  uid {string}: item的uid, 可以通过uid来设置焦点
85
85
  permanent {boolean}: 出去与是否保留
86
86
  enableTap {boolean}: 是否接受触控tap
87
- showSkeleton {boolean}: 打断描画时, 是否显示骨架图
87
+ showSkeleton {boolean}: 打断描画时, 是否显示骨架图, 默认为true
88
88
  }
89
89
  *
90
90
  * onFocus {function} 控件获取焦点的回调
@@ -105,6 +105,8 @@
105
105
  * flingPageEdge {}
106
106
  * disableClip {boolean} 取消显示范围的clipView
107
107
  * touchFlag {int} 触控的开关, 0:关闭, 1:打开. 打开后支持drag, fling; item的tap则由measuresObject的enableTap控制
108
+ * enableLongPress {boolean} 支持长按, 长按模式下, onkeyup时触发onclick, 长按触发后, onclik不触发
109
+ * enableDebug {boolean} 显示debug用的item框
108
110
 
109
111
  * methods:
110
112
  getFocusBlockRef 获取此MetroWidget的 jsv-focus-block句柄,可以使用requestFocus完成获焦
@@ -215,7 +217,10 @@
215
217
  setSensorSensitivity
216
218
  @description 触控模式下, 设置运动回调敏感度, 每移动多少像素进行回调,适当放大(推荐10以上)可以极大减小对js回调过多引起的性能降低
217
219
  @params {number} sensitivity 敏感度, 等于0时关闭触控的移动监听
218
-
220
+ getItemLayoutInfo
221
+ @description 获取 item 的布局位置信息, index对应的item不存在时, 返回null
222
+ @params {number} index item 的 index
223
+ @return {object} {left: number, top: number, width: number, height: number} | null
219
224
  slots:
220
225
  renderItem: 该slot用于描画每个单元格
221
226
  background: 该slot描画在item后, 一般用于描画需要跟随MetroWidget滚动的内容
@@ -246,7 +251,13 @@
246
251
  }
247
252
  * onItemEdge: 若单元格内另有可接管按键的控件(如MetroWidget),该控件到达边缘需要通知MetroWidget时的回调
248
253
  * onAction: 单元格内控件需要通过onAction.register方法向MetroWidget注册 item 的回调,回调函数有
249
- onFocus onBlur, onClick, onWidgetEdge
254
+ onFocus: widget获焦状态下, item获焦的回调
255
+ onBlur: widget获焦状态下, item失焦的回调
256
+ onGaze: item获焦的回调, 无论widget是否为获焦状态
257
+ onIgnore: itemh失焦的回调, 无论widget是否为获焦状态
258
+ onClick: item点击的回调
259
+ onWidgetEdge: 到达边缘的回调
260
+ onLongPress: item长按的回调
250
261
  *
251
262
  * Q: 如何进行布局,定制每个格的尺寸?
252
263
  * A: 首先选定一个布局的方式,一列列地横向布局(HROIZONTAL)还是一行行地纵向(VERTICAL)布局,设置给属性direction
@@ -275,7 +286,14 @@
275
286
  -->
276
287
 
277
288
  <script setup>
278
- import { ref, shallowRef, computed, reactive, onMounted } from "vue";
289
+ import {
290
+ ref,
291
+ shallowRef,
292
+ computed,
293
+ reactive,
294
+ onMounted,
295
+ onBeforeUnmount,
296
+ } from "vue";
279
297
  import { setup } from "./MetroWidgetSetup";
280
298
  import SlotComponent from "./SlotComponent.vue";
281
299
  import {
@@ -286,6 +304,8 @@ import {
286
304
  RENDER_ITEM_BREAK_KEY,
287
305
  } from "../WidgetCommon";
288
306
  import { ForgeConst } from "../../JsViewVueTools/ForgeConstDefine.ts";
307
+ import DebugFrame from "./DebugFrame.vue";
308
+ import { createCanvasText } from "./DebugTools.ts";
289
309
 
290
310
  const props = defineProps({
291
311
  padding: {
@@ -421,6 +441,14 @@ const props = defineProps({
421
441
  type: Number,
422
442
  default: 0,
423
443
  },
444
+ enableLongPress: {
445
+ type: Boolean,
446
+ default: false,
447
+ },
448
+ enableDebug: {
449
+ type: Boolean,
450
+ default: false,
451
+ },
424
452
  });
425
453
 
426
454
  const renderBreakKey = props.enableItemRenderBreak ? RENDER_ITEM_BREAK_KEY : "";
@@ -455,6 +483,7 @@ const {
455
483
  focusBlockOnFocus,
456
484
  focusBlockOnBlur,
457
485
  focusBlockOnKeyDown,
486
+ focusBlockOnKeyUp,
458
487
  focusBlockOnCustomEvent,
459
488
  _onFocusableItemEdge,
460
489
  exportObject,
@@ -462,7 +491,7 @@ const {
462
491
  onTouchRelease,
463
492
  currentFocusIndex,
464
493
  modeForExport,
465
- onDispatchKeyDown
494
+ onDispatchKeyDown,
466
495
  } = setup(
467
496
  props,
468
497
  itemRender,
@@ -478,6 +507,14 @@ const {
478
507
  "common"
479
508
  );
480
509
 
510
+ let debugFrameSourceId = "";
511
+ let debugFrameSourceReleaseHandler = null;
512
+ if (props.enableDebug) {
513
+ const sourceInfo = createCanvasText(20);
514
+ debugFrameSourceId = sourceInfo.sourceId;
515
+ debugFrameSourceReleaseHandler = sourceInfo.releaseHandler;
516
+ }
517
+
481
518
  onMounted(() => {
482
519
  if (onTouchRelease) {
483
520
  touchDiv.value.jsvSetTapListener(
@@ -491,6 +528,14 @@ onMounted(() => {
491
528
  }
492
529
  });
493
530
 
531
+ onBeforeUnmount(() => {
532
+ if (props.enableDebug) {
533
+ debugFrameSourceReleaseHandler?.();
534
+ debugFrameSourceReleaseHandler = null;
535
+ debugFrameSourceId = "";
536
+ }
537
+ });
538
+
494
539
  defineExpose(exportObject);
495
540
  </script>
496
541
 
@@ -537,6 +582,7 @@ defineExpose(exportObject);
537
582
  onFocus: focusBlockOnFocus,
538
583
  onBlur: focusBlockOnBlur,
539
584
  onKeyDown: focusBlockOnKeyDown,
585
+ onKeyUp: focusBlockOnKeyUp,
540
586
  onCustomEvent: focusBlockOnCustomEvent,
541
587
  onDispatchKeyDown,
542
588
  }"
@@ -561,6 +607,12 @@ defineExpose(exportObject);
561
607
  }"
562
608
  @click="item.onTap.value"
563
609
  >
610
+ <DebugFrame
611
+ v-if="enableDebug"
612
+ :width="item.templateInfo.width"
613
+ :height="item.templateInfo.height"
614
+ :sourceId="debugFrameSourceId"
615
+ ></DebugFrame>
564
616
  <div
565
617
  v-if="
566
618
  !enableItemRenderBreak || item.mounted.value || itemRender
@@ -582,10 +634,10 @@ defineExpose(exportObject);
582
634
  </div>
583
635
  <div
584
636
  v-if="
585
- enableItemRenderBreak
586
- && placeHolderSetting
587
- && !item.mounted.value
588
- && item.itemConfig.showSkeleton
637
+ enableItemRenderBreak &&
638
+ placeHolderSetting &&
639
+ !item.mounted.value &&
640
+ item.itemConfig.showSkeleton
589
641
  "
590
642
  :style="{
591
643
  width: item.renderStyle.width - normalizedPlaceHolder.gap,