@shijiu/jsview-vue 0.9.426 → 0.9.502

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 (63) 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/jsv-browser-debug-dom.js_1 +8 -0
  4. package/dom/jsv-dom.js_1 +6 -0
  5. package/dom/jsv-forge-define.js_1 +6 -0
  6. package/dom/target_core_revision.js +3 -3
  7. package/package.json +1 -1
  8. package/patches/node_modules/@vue/cli-service/lib/config/assets.js +1 -1
  9. package/patches/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js +4 -1
  10. package/samples/ColorSpace/App.vue +4 -4
  11. package/samples/DemoHomepage/router.js +17 -2
  12. package/samples/FilterDemo/App.vue +121 -0
  13. package/samples/GridDemo/App.vue +183 -0
  14. package/samples/GridDemo/ButtonBlock.vue +111 -0
  15. package/samples/GridDemo/FocusItem.vue +56 -0
  16. package/samples/GridDemo/Item.vue +101 -0
  17. package/samples/NinePatchDemo/App.vue +146 -0
  18. package/samples/NinePatchDemo/Item.vue +70 -0
  19. package/samples/NinePatchDemo/assets/border.png +0 -0
  20. package/samples/TouchSample/App.vue +137 -0
  21. package/samples/TouchSample/Item.vue +101 -0
  22. package/samples/TouchSample/MetroWidgetHorizontal.vue +144 -0
  23. package/samples/TouchSample/MetroWidgetVertical.vue +144 -0
  24. package/samples/TouchSample/TouchContainerHorizontal.vue +159 -0
  25. package/samples/TouchSample/TouchContainerVertical.vue +159 -0
  26. package/samples/TouchSample/data.js +81 -0
  27. package/samples/{ColorSpace → assets}/bmpDemo.bmp +0 -0
  28. package/samples/{ColorSpace → assets}/jpegDemo.jpeg +0 -0
  29. package/samples/{ColorSpace → assets}/pngDemo.png +0 -0
  30. package/samples/{ColorSpace → assets}/pngNoAlphaDemo.png +0 -0
  31. package/samples/assets/webpDemo.webp +0 -0
  32. package/scripts/jsview-jsmap-serve.js +63 -0
  33. package/scripts/jsview-post-build.js +50 -3
  34. package/scripts/jsview-post-install.js +22 -0
  35. package/utils/JsViewEngineWidget/JsvFocusBlock.vue +7 -5
  36. package/utils/JsViewEngineWidget/JsvFocusManager.js +5 -0
  37. package/utils/JsViewEngineWidget/MetroWidget/ItemView.vue +7 -14
  38. package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +214 -89
  39. package/utils/JsViewEngineWidget/MetroWidget/RootView.vue +4 -3
  40. package/utils/JsViewEngineWidget/SimpleWidget/SimpleWidget.vue +2 -0
  41. package/utils/JsViewEngineWidget/TemplateParser.js +8 -6
  42. package/utils/JsViewPlugin/JsvPlayer/GetVersion.js +20 -0
  43. package/utils/JsViewPlugin/JsvPlayer/JsvMedia.js +220 -85
  44. package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +43 -14
  45. package/utils/JsViewPlugin/JsvPlayer/JsvPlayerBrowser.vue +25 -12
  46. package/utils/JsViewPlugin/JsvPlayer/index.js +4 -0
  47. package/utils/JsViewPlugin/JsvPlayer/version.js +19 -0
  48. package/utils/JsViewVueTools/DebugTool.js +24 -0
  49. package/utils/JsViewVueTools/NinePatchHelper.js +44 -0
  50. package/utils/JsViewVueTools/TypeCheckAndSet.js +27 -0
  51. package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserQrcode.vue +19 -8
  52. package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/BrowserApic.vue +1 -1
  53. package/utils/JsViewVueWidget/JsvApic/JsvApic.vue +2 -2
  54. package/utils/JsViewVueWidget/JsvFilterView.vue +73 -0
  55. package/utils/JsViewVueWidget/JsvGrid.vue +573 -0
  56. package/utils/JsViewVueWidget/JsvInput/JsvInput.vue +7 -0
  57. package/utils/JsViewVueWidget/JsvNinePatch.vue +2 -2
  58. package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +12 -3
  59. package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +1 -1
  60. package/utils/JsViewVueWidget/JsvTextureAnim/CommonType.js +8 -0
  61. package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +171 -38
  62. package/utils/JsViewVueWidget/JsvTextureAnim/index.js +3 -2
  63. package/utils/JsViewVueWidget/JsvTouchContainer.vue +184 -0
@@ -2,16 +2,16 @@
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2021-09-22 16:08:58
4
4
  * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2022-03-25 18:08:58
5
+ * @LastEditTime: 2022-05-17 13:01:47
6
6
  * @Description: file content
7
7
  -->
8
8
 
9
9
  <!--
10
10
  * 【界面概述】
11
- * 展示SimpleWidget控件的用法
11
+ * 展示MetroWidget控件的用法
12
12
  *
13
13
  * 【控件介绍】
14
- * SimpleWidget:
14
+ * MetroWidget:
15
15
  * props:
16
16
  * top {int} 控件的y,默认为0
17
17
  * left {int} 控件的x, 默认为0
@@ -76,6 +76,8 @@
76
76
  * flingPageWidth {}
77
77
  * flingPageEdge {}
78
78
  * methods:
79
+ getFocusBlockRef 获取此MetroWidget的 jsv-focus-block句柄,可以使用requestFocus完成获焦
80
+
79
81
  slideTo
80
82
  @description 滚动到指定位置
81
83
  @params {int} position 滚动目标位置
@@ -89,7 +91,7 @@
89
91
  @params {int} id 落焦时的焦点id
90
92
  setEnterFocusRect
91
93
  @description 设置落焦时的焦点查找去区域
92
- @params {Object} rectInfo 焦点移入时的区域,SimpleWidget 将会根据此区域寻找最近的item
94
+ @params {Object} rectInfo 焦点移入时的区域,MetroWidget 将会根据此区域寻找最近的item
93
95
  {
94
96
  direction: {EdgeDirection}
95
97
  rect: {
@@ -114,7 +116,7 @@
114
116
  {
115
117
  id: {int} item的id,
116
118
  position: {Function} (index : int) => {left: 0, top: 0, width: 0, height: 0}
117
- 获取 item 相对 SimpleWidget 左上角坐标
119
+ 获取 item 相对 MetroWidget 左上角坐标
118
120
  templatePosition: {Function} (index : int) => {left: 0, top: 0, width: 0, height: 0}
119
121
  获取 item 的布局坐标, 一般用于自定义滚动
120
122
  absolutePosition: {Function} (index : int) => {left: 0, top: 0, width: 0, height: 0}
@@ -152,6 +154,8 @@
152
154
  requestFocus函数需要传递一个false参数
153
155
  -->
154
156
  <script>
157
+ /* eslint-disable no-unused-vars */
158
+
155
159
  import { ref, reactive } from "vue";
156
160
  import RootView from "./RootView.vue";
157
161
  import Forge from "../ForgeDefine";
@@ -331,30 +335,50 @@ class PageUpdater {
331
335
  this._updateFunc = update_func;
332
336
  }
333
337
 
334
- update(template, visible_start, visible_end, anchor_id, merge_tmp) {
338
+ update(
339
+ template,
340
+ visible_start,
341
+ visible_end,
342
+ anchor_id,
343
+ merge_tmp,
344
+ permanent_list
345
+ ) {
346
+ if (!template || template.GetLength() === 0) return;
335
347
  let visible_range = template.GetVisibleItemList(
336
348
  visible_start,
337
349
  visible_end,
338
350
  anchor_id
339
351
  );
352
+ if (!visible_range) {
353
+ return;
354
+ }
355
+ let pre_tmp = this.tmpRangeList;
356
+ let pre_list = this.rangeList;
340
357
  let range = new ItemRange(
341
358
  visible_range.visibleStart,
342
359
  visible_range.visibleEnd
343
360
  );
344
-
345
- if (this.rangeList.length > 0) {
346
- let pre_tmp = this.tmpRangeList;
347
- if (range.ifOverlap(this.rangeList[0])) {
348
- this.tmpRangeList = [range.merge(this.rangeList[0])];
349
- } else {
350
- this.tmpRangeList = [range, this.rangeList[0]];
351
- }
361
+ this.rangeList = [range];
362
+ if (permanent_list) {
363
+ let permanent_show_list = permanent_list.filter((item) => {
364
+ let result = false;
365
+ if (item.alreadyShow || item.index <= range.end) {
366
+ item.alreadyShow = true;
367
+ result = true;
368
+ }
369
+ return result;
370
+ });
371
+ let permanent_range_list = permanent_show_list.map((item) => {
372
+ return new ItemRange(item.index, item.index);
373
+ });
374
+ this.rangeList = mergeRangeList([range], permanent_range_list);
375
+ }
376
+ if (pre_list.length > 0) {
377
+ this.tmpRangeList = mergeRangeList(this.rangeList, pre_list);
352
378
  if (merge_tmp) {
353
379
  this.tmpRangeList = mergeRangeList(this.tmpRangeList, pre_tmp);
354
380
  }
355
381
  }
356
-
357
- this.rangeList = [range];
358
382
  }
359
383
 
360
384
  debugPrint() {
@@ -454,7 +478,7 @@ const directionFreeKeyMap = {
454
478
  };
455
479
 
456
480
  const defaultSlideSetting = new SeamlessSlide(0.2, 0.8);
457
- const SimpleWidget = {
481
+ const MetroWidget = {
458
482
  components: { RootView },
459
483
  props: {
460
484
  padding: {
@@ -610,8 +634,8 @@ const SimpleWidget = {
610
634
  visibleRange: 0,
611
635
  visibleRangeWithPadding: 0,
612
636
 
613
- touchContainerW: 0,
614
- touchContainerH: 0,
637
+ touchContainerW: ref(0),
638
+ touchContainerH: ref(0),
615
639
  touchListener: null,
616
640
  innerPadding: null,
617
641
  slidePile: null,
@@ -620,6 +644,11 @@ const SimpleWidget = {
620
644
  preAnchorItemIndex: -1,
621
645
  templateItemAdder: null,
622
646
  itemRender: ref(false),
647
+ permanentItemList: [],
648
+ preUpdateVisibleStart: 0,
649
+
650
+ updateTimerHandler: -1,
651
+ mounted: false,
623
652
  };
624
653
  },
625
654
  methods: {
@@ -775,6 +804,10 @@ const SimpleWidget = {
775
804
  }
776
805
  },
777
806
 
807
+ getFocusBlockRef() {
808
+ return this.$refs.focusNode;
809
+ },
810
+
778
811
  setEnterFocusId(id) {
779
812
  this.templateItemAdder.tryAddItemById(id);
780
813
  this.enterFocusId = id;
@@ -807,7 +840,9 @@ const SimpleWidget = {
807
840
  this.templateParser,
808
841
  this.visibleStart,
809
842
  this.visibleStart + this.visibleRangeWithPadding - 1,
810
- this.focusId
843
+ this.focusId,
844
+ false,
845
+ this.permanentItemList
811
846
  );
812
847
  if (doAnim) {
813
848
  this.pageUpdater.applyTmp();
@@ -836,7 +871,11 @@ const SimpleWidget = {
836
871
  console.error("refreshData: provideData is null.");
837
872
  return;
838
873
  }
874
+ let _force_update = force_update;
839
875
  let template_list = this.templateParser.GetTemplate().List;
876
+ if (!template_list || template_list.length === 0) {
877
+ _force_update = true;
878
+ }
840
879
  let new_list = this.provideData();
841
880
  if (this.focusId >= new_list.length) {
842
881
  this.focusId = 0;
@@ -847,7 +886,7 @@ const SimpleWidget = {
847
886
  }
848
887
  }
849
888
  let new_index = 0;
850
- if (!force_update) {
889
+ if (!_force_update) {
851
890
  for (new_index = 0; new_index < new_list.length; ++new_index) {
852
891
  let already_add = false;
853
892
  for (let j = 0; j < template_list.length; ++j) {
@@ -862,7 +901,7 @@ const SimpleWidget = {
862
901
  }
863
902
  }
864
903
  let need_update_content = false;
865
- if (new_index === template_list.length) {
904
+ if (!_force_update && new_index === template_list.length) {
866
905
  //原始数据都在
867
906
  if (new_index !== new_list.length) {
868
907
  //增加数据
@@ -873,8 +912,9 @@ const SimpleWidget = {
873
912
  }
874
913
  } else {
875
914
  //数据更改
915
+ this.permanentItemList = [];
876
916
  need_update_content = true;
877
- let template_parser = _getTemplateParser(
917
+ this.templateParser = _getTemplateParser(
878
918
  this.width,
879
919
  this.height,
880
920
  this.direction,
@@ -885,14 +925,13 @@ const SimpleWidget = {
885
925
  this.innerData = [];
886
926
  this.dataList = new_list;
887
927
  this.templateItemAdder = new TemplateItemAdder(
888
- template_parser,
928
+ this.templateParser,
889
929
  new_list,
890
930
  this.measures,
891
931
  this.visibleRangeWithPadding,
892
932
  this._onTemplateAdd
893
933
  );
894
934
  this.templateItemAdder.tryAddItemById(this.focusId);
895
- this.templateParser = template_parser;
896
935
  }
897
936
  if (need_update_content) {
898
937
  let template_list = this.templateParser.GetTemplate().List;
@@ -922,7 +961,9 @@ const SimpleWidget = {
922
961
  this.templateParser,
923
962
  this.visibleStart,
924
963
  this.visibleStart + this.visibleRangeWithPadding - 1,
925
- this.focusId
964
+ this.focusId,
965
+ false,
966
+ this.permanentItemList
926
967
  );
927
968
  this.dataUpdateToken++;
928
969
  this.pageUpdater.apply();
@@ -1132,6 +1173,27 @@ const SimpleWidget = {
1132
1173
  },
1133
1174
 
1134
1175
  onKeyDown(ev) {
1176
+ if (this.innerData.length == 0) {
1177
+ const edgeDirectionMap = {
1178
+ 37: EdgeDirection.left,
1179
+ 38: EdgeDirection.top,
1180
+ 39: EdgeDirection.right,
1181
+ 40: EdgeDirection.bottom,
1182
+ };
1183
+ if (typeof edgeDirectionMap[ev.keyCode] !== "undefined") {
1184
+ this.onEdge?.({
1185
+ direction: edgeDirectionMap[ev.keyCode],
1186
+ rect: {
1187
+ x: 0,
1188
+ y: 0,
1189
+ width: 0,
1190
+ height: 0,
1191
+ },
1192
+ });
1193
+ return true;
1194
+ }
1195
+ return false;
1196
+ }
1135
1197
  let horizontal_direction = 0;
1136
1198
  let vertical_direction = 0;
1137
1199
  switch (ev.keyCode) {
@@ -1182,6 +1244,18 @@ const SimpleWidget = {
1182
1244
  itemHandler: {},
1183
1245
  itemConfig: this.itemConfig?.(item.data),
1184
1246
  });
1247
+ if (item.permanent) {
1248
+ this.permanentItemList.push({
1249
+ index: this.innerData.length - 1,
1250
+ alreadyShow: false,
1251
+ });
1252
+ }
1253
+ const lastItem = this.templateParser.GetItem(-1);
1254
+ if (this.direction == VERTICAL) {
1255
+ this.touchContainerH = lastItem.yPos + lastItem.height - 1;
1256
+ } else {
1257
+ this.touchContainerW = lastItem.xPos + lastItem.width - 1;
1258
+ }
1185
1259
  },
1186
1260
 
1187
1261
  _onCustomerEvent(ev) {
@@ -1223,7 +1297,8 @@ const SimpleWidget = {
1223
1297
  this.visibleStart,
1224
1298
  this.visibleStart + this.visibleRangeWithPadding - 1,
1225
1299
  this.focusId,
1226
- true
1300
+ true,
1301
+ this.permanentItemList
1227
1302
  );
1228
1303
  this.pageUpdater.applyTmp();
1229
1304
  this._slideTo(this.visibleStart, {
@@ -1288,7 +1363,9 @@ const SimpleWidget = {
1288
1363
  this.templateParser,
1289
1364
  cur_visible_start,
1290
1365
  cur_visible_start + this.visibleRangeWithPadding - 1,
1291
- next_item_id
1366
+ next_item_id,
1367
+ false,
1368
+ this.permanentItemList
1292
1369
  );
1293
1370
  this.pageUpdater.applyTmp();
1294
1371
  }
@@ -1401,7 +1478,7 @@ const SimpleWidget = {
1401
1478
  _calculateVisibleStart(target_item, direction) {
1402
1479
  if (!target_item) {
1403
1480
  console.error(
1404
- "SimpleWidget: _calculateVisibleStart target item is null"
1481
+ "MetroWidget: _calculateVisibleStart target item is null"
1405
1482
  );
1406
1483
  return 0;
1407
1484
  }
@@ -1465,7 +1542,7 @@ const SimpleWidget = {
1465
1542
  break;
1466
1543
  default:
1467
1544
  console.error(
1468
- "SimpleWidget: undefined slide type",
1545
+ "MetroWidget: undefined slide type",
1469
1546
  this.slideSetting.Type
1470
1547
  );
1471
1548
  }
@@ -1525,10 +1602,20 @@ const SimpleWidget = {
1525
1602
  },
1526
1603
 
1527
1604
  _setZIndex(index, z_index) {
1528
- this.innerData[index].controller.zIndex = z_index;
1605
+ if (this.innerData[index]) {
1606
+ this.innerData[index].controller.zIndex = z_index;
1607
+ }
1529
1608
  },
1530
1609
 
1531
1610
  _onFocus() {
1611
+ this.isFocus = true;
1612
+ this.preFocusId = -1;
1613
+ if (this.innerData.length === 0) {
1614
+ console.warn(
1615
+ `MetroWidget: ${this.name} get focus while data is empty.`
1616
+ );
1617
+ return;
1618
+ }
1532
1619
  let focus_id =
1533
1620
  typeof this.enterFocusId !== "undefined" &&
1534
1621
  this.enterFocusId >= 0 &&
@@ -1542,9 +1629,7 @@ const SimpleWidget = {
1542
1629
  )
1543
1630
  : focus_id;
1544
1631
  this.preEdgeRect = this.enterFocusRect;
1545
- this.isFocus = true;
1546
1632
  this.focusId = focus_id;
1547
- this.preFocusId = -1;
1548
1633
  this.enterFocusId = -1;
1549
1634
  this.enterFocusRect = null;
1550
1635
  this._updateFocusItem();
@@ -1566,9 +1651,11 @@ const SimpleWidget = {
1566
1651
  this.isFocus = false;
1567
1652
  this.enterFocusId = -1;
1568
1653
  this.enterFocusRect = null;
1569
-
1570
- this.preFocusId = this.focusId;
1571
1654
  this.preEdgeRect = null;
1655
+ if (this.innerData.length === 0) {
1656
+ return;
1657
+ }
1658
+ this.preFocusId = this.focusId;
1572
1659
  this._updateBlurItem();
1573
1660
  this.innerData[
1574
1661
  this.templateParser.FocusIdToIndex(this.preFocusId)
@@ -1635,28 +1722,22 @@ const SimpleWidget = {
1635
1722
  this.rootElement = ele;
1636
1723
  },
1637
1724
 
1638
- _tryReoprtVisibleEvent(msg) {
1639
- if (msg) {
1640
- return;
1641
- }
1642
- // if (typeof msg.viewY != "undefined" && typeof msg.viewX != "undefined") {
1643
- // if (this.direction === VERTICAL) {
1644
- // this.visibleStart = -msg.viewY;
1645
- // } else {
1646
- // this.visibleStart = -msg.viewX;
1647
- // }
1648
- // if (this.visibleStart < 0) {
1649
- // this.visibleStart = 0;
1650
- // }
1651
- // }
1652
- // let cur_visible_start =
1653
- // this.visibleStart - this.visibleRangeWithPadding * 2;
1654
- // let cur_visible_end =
1655
- // this.visibleStart + this.visibleRangeWithPadding * 3 - 1;
1656
- // let baseItemId = this.visibleRangeSearchBaseItem
1657
- // ? this.visibleRangeSearchBaseItem
1658
- // : 0;
1659
- // this._updateVisibleList(baseItemId, cur_visible_start, cur_visible_end);
1725
+ _onDragUpdateItem(visible_start, visible_end) {
1726
+ this.templateItemAdder.tryAddItemByPosition(visible_end);
1727
+ let baseItemId = this.visibleRangeSearchBaseItem
1728
+ ? this.visibleRangeSearchBaseItem
1729
+ : 0;
1730
+ this.pageUpdater.update(
1731
+ this.templateParser,
1732
+ visible_start,
1733
+ visible_end,
1734
+ baseItemId,
1735
+ false,
1736
+ this.permanentItemList
1737
+ );
1738
+ this.pageUpdater.apply();
1739
+
1740
+ Forge.sRenderBridge.InstantPerformSwap();
1660
1741
  },
1661
1742
 
1662
1743
  _getTouchListener() {
@@ -1665,37 +1746,72 @@ const SimpleWidget = {
1665
1746
  }
1666
1747
  let callback = {
1667
1748
  OnDragStart: (msg) => {
1668
- // console.log("SimpleWidget Container OnDragStart:", msg);
1669
1749
  //删除焦点
1670
- Promise.resolve().then(() => {
1671
- this._tryReoprtVisibleEvent(msg);
1672
- Forge.sRenderBridge.InstantPerformSwap();
1673
- });
1750
+ if (this.mounted) {
1751
+ Promise.resolve().then(() => {
1752
+ let cur_visible_start =
1753
+ this.visibleStart - this.visibleRangeWithPadding * 2;
1754
+ let cur_visible_end =
1755
+ this.visibleStart + this.visibleRangeWithPadding * 3 - 1;
1756
+ this.preUpdateVisibleStart = cur_visible_start;
1757
+ this._onDragUpdateItem(cur_visible_start, cur_visible_end);
1758
+ });
1759
+ }
1674
1760
  return true;
1675
1761
  },
1676
1762
  OnMoved: (msg) => {
1677
- Promise.resolve().then(() => {
1678
- this._tryReoprtVisibleEvent(msg);
1679
- Forge.sRenderBridge.InstantPerformSwap();
1680
- });
1763
+ if (this.mounted) {
1764
+ Promise.resolve().then(() => {
1765
+ if (
1766
+ typeof msg.viewY != "undefined" &&
1767
+ typeof msg.viewX != "undefined"
1768
+ ) {
1769
+ if (this.direction === VERTICAL) {
1770
+ this.visibleStart = -msg.viewY;
1771
+ } else {
1772
+ this.visibleStart = -msg.viewX;
1773
+ }
1774
+ if (this.visibleStart < 0) {
1775
+ this.visibleStart = 0;
1776
+ }
1777
+ }
1778
+ if (
1779
+ Math.abs(this.visibleStart - this.preUpdateVisibleStart) <=
1780
+ this.visibleRangeWithPadding
1781
+ ) {
1782
+ let cur_visible_start =
1783
+ this.visibleStart - this.visibleRangeWithPadding * 2;
1784
+ let cur_visible_end =
1785
+ this.visibleStart + this.visibleRangeWithPadding * 3 - 1;
1786
+ this.preUpdateVisibleStart = cur_visible_start;
1787
+ this._onDragUpdateItem(cur_visible_start, cur_visible_end);
1788
+ }
1789
+ });
1790
+ }
1791
+
1681
1792
  return true;
1682
1793
  },
1683
1794
  OnDragEnd: (msg) => {
1684
- // console.log("SimpleWidget Container OnDragEnd:", msg);
1685
- this._tryReoprtVisibleEvent(msg);
1795
+ this.$refs.rootView?.updatePosition(msg["viewX"], msg["viewY"], null);
1796
+ this.preUpdateVisibleStart = this.visibleStart;
1797
+ this._onDragUpdateItem(
1798
+ this.visibleStart,
1799
+ this.visibleStart + this.visibleRangeWithPadding - 1
1800
+ );
1686
1801
  this._updateFocusByDragInfo(msg["viewX"], msg["viewY"]);
1687
- this._onSlideEnd();
1688
1802
  return true;
1689
1803
  },
1690
1804
  OnFling: (msg) => {
1691
- // console.log("SimpleWidget Container OnFling:", msg);
1692
- this._tryReoprtVisibleEvent(msg);
1805
+ this.$refs.rootView?.updatePosition(msg["viewX"], msg["viewY"], null);
1806
+ this.preUpdateVisibleStart = this.visibleStart;
1807
+ this._onDragUpdateItem(
1808
+ this.visibleStart,
1809
+ this.visibleStart + this.visibleRangeWithPadding - 1
1810
+ );
1693
1811
  this._updateFocusByDragInfo(msg["viewX"], msg["viewY"]);
1694
- this._onSlideEnd();
1695
1812
  return true;
1696
1813
  },
1697
- OnRelease: () => {
1698
- // console.log("SimpleWidget Container OnRelease:", msg);
1814
+ OnRelease: (msg) => {
1699
1815
  return true;
1700
1816
  },
1701
1817
  };
@@ -1717,7 +1833,8 @@ const SimpleWidget = {
1717
1833
  this.$refs.rootView?.updateData(list);
1718
1834
  this.refreshToken++;
1719
1835
  this.itemRender = false;
1720
- setTimeout(() => {
1836
+ clearTimeout(this.updateTimerHandler);
1837
+ this.updateTimerHandler = setTimeout(() => {
1721
1838
  this.itemRender = true;
1722
1839
  }, 0);
1723
1840
  },
@@ -1744,7 +1861,8 @@ const SimpleWidget = {
1744
1861
  } else if (this.data) {
1745
1862
  this.dataList = this.data;
1746
1863
  }
1747
- let template_parser = _getTemplateParser(
1864
+
1865
+ this.templateParser = _getTemplateParser(
1748
1866
  this.width,
1749
1867
  this.height,
1750
1868
  this.direction,
@@ -1753,25 +1871,26 @@ const SimpleWidget = {
1753
1871
  this.layoutType
1754
1872
  );
1755
1873
  this.templateItemAdder = new TemplateItemAdder(
1756
- template_parser,
1874
+ this.templateParser,
1757
1875
  this.dataList,
1758
1876
  this.measures,
1759
1877
  this.visibleRangeWithPadding,
1760
1878
  this._onTemplateAdd
1761
1879
  );
1762
1880
  this.templateItemAdder.tryAddItem(null, 2);
1763
- this.templateParser = template_parser;
1764
1881
  let template_list = this.templateParser.GetTemplate().List;
1765
1882
  let last_item = template_list[template_list.length - 1];
1766
- this.touchListener = this._getTouchListener();
1767
- this.touchContainerW =
1768
- this.direction === VERTICAL
1769
- ? this.width
1770
- : last_item.xPos + last_item.width;
1771
- this.touchContainerH =
1772
- this.direction === VERTICAL
1773
- ? last_item.yPos + last_item.height
1774
- : this.height;
1883
+ if (last_item) {
1884
+ this.touchListener = this._getTouchListener();
1885
+ this.touchContainerW =
1886
+ this.direction === VERTICAL
1887
+ ? this.width
1888
+ : last_item.xPos + last_item.width;
1889
+ this.touchContainerH =
1890
+ this.direction === VERTICAL
1891
+ ? last_item.yPos + last_item.height
1892
+ : this.height;
1893
+ }
1775
1894
  this.slidePile = new Forge.RectArea(
1776
1895
  0,
1777
1896
  0,
@@ -1782,6 +1901,7 @@ const SimpleWidget = {
1782
1901
  let cur_visible_start = 0;
1783
1902
 
1784
1903
  if (this.initFocusId) {
1904
+ this.templateItemAdder.tryAddItemById(this.initFocusId);
1785
1905
  const item = this.templateParser.GetItemById(this.initFocusId);
1786
1906
  if (item) {
1787
1907
  init_focus_id = this.initFocusId;
@@ -1799,18 +1919,23 @@ const SimpleWidget = {
1799
1919
  this.templateParser,
1800
1920
  this.visibleStart,
1801
1921
  this.visibleStart + this.visibleRangeWithPadding - 1,
1802
- 0
1922
+ 0,
1923
+ false,
1924
+ this.permanentItemList
1803
1925
  );
1804
1926
  this.pageUpdater.apply();
1927
+ this.mounted = true;
1805
1928
  },
1806
1929
  beforeUnmount() {
1930
+ this.mounted = false;
1807
1931
  if (this.dispatcher) {
1808
1932
  this.dispatcher.unregisterComponent();
1809
1933
  }
1934
+ clearTimeout(this.updateTimerHandler);
1810
1935
  },
1811
1936
  };
1812
1937
 
1813
- export default SimpleWidget;
1938
+ export default MetroWidget;
1814
1939
  </script>
1815
1940
 
1816
1941
  <template>
@@ -2,7 +2,7 @@
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2021-09-22 14:03:32
4
4
  * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2022-03-25 14:29:31
5
+ * @LastEditTime: 2022-04-12 09:14:22
6
6
  * @Description: file content
7
7
  -->
8
8
  <script>
@@ -117,7 +117,8 @@ export default {
117
117
  },
118
118
  mounted() {
119
119
  //TODO 触控的处理有待添加
120
- // this.$_rootView_initTouch_();
120
+ this.$_rootView_initTouch_();
121
+ //window.touchDiv = this.$refs.element
121
122
  },
122
123
  };
123
124
  </script>
@@ -150,4 +151,4 @@ export default {
150
151
  </div>
151
152
  </div>
152
153
  </div>
153
- </template>
154
+ </template>
@@ -65,6 +65,8 @@
65
65
  * flingPageWidth {}
66
66
  * flingPageEdge {}
67
67
  * methods:
68
+ getFocusBlockRef 获取此SimpleWidget的 jsv-focus-block句柄,可以使用requestFocus完成获焦
69
+
68
70
  slideTo
69
71
  @description 滚动到指定位置
70
72
  @params {int} position 滚动目标位置
@@ -102,6 +102,10 @@ function getTemplateItem(measure_obj, data_info) {
102
102
  typeof measure_obj.doSlide !== "undefined" ? measure_obj.doSlide : true,
103
103
  pageNumber: -1,
104
104
  pageHeadIndex: -1,
105
+ permanent:
106
+ typeof measure_obj.permanent !== "undefined"
107
+ ? measure_obj.permanent
108
+ : false,
105
109
  };
106
110
  }
107
111
 
@@ -235,11 +239,9 @@ class Fence {
235
239
  }
236
240
  }
237
241
 
238
- if (gap_idx === -1)
239
- console.log(
240
- `Error in mark gap used, not found suitable gap of offset=${this.AheadOffset}`
241
- );
242
- // Forge.ThrowError("Error in mark gap used, not found suitable gap of offset=" + this.AheadOffset);
242
+ if (gap_idx === -1) {
243
+ return; // 区域完全重复,无法找到新区域
244
+ }
243
245
 
244
246
  this._SplitGap(gap_idx, start_pos, width);
245
247
 
@@ -848,7 +850,7 @@ class TemplateParser {
848
850
  let gap_info = null;
849
851
  while (fence_stack.length > 0) {
850
852
  const checking_fence = fence_stack[fence_stack.length - 1];
851
- gap_info = checking_fence.HasGapFor(item_key_width);
853
+ gap_info = checking_fence.HasGapFor(item_key_width + item_key_margin);
852
854
  if (gap_info !== null) {
853
855
  top_fence = checking_fence;
854
856
  break;
@@ -0,0 +1,20 @@
1
+ import PluginInfo from './version'
2
+
3
+ function reconfigPluginInfo() {
4
+ if(typeof window.jJsvRuntimeBridge!=='undefined' && window.jJsvRuntimeBridge && typeof window.jJsvRuntimeBridge.getPluginBaseUrl !== "undefined"){
5
+ let plugin_base_url = window.jJsvRuntimeBridge.getPluginBaseUrl();
6
+ if(plugin_base_url){
7
+ PluginInfo.downloadUrl = (plugin_base_url[plugin_base_url.length-1]==="/"?plugin_base_url:(plugin_base_url+"/"))+PluginInfo.packageName+"/JsvPlayer-"+PluginInfo.versionCodeMax+".zip?md5="+PluginInfo.md5;
8
+ }
9
+ }
10
+ }
11
+
12
+ reconfigPluginInfo();
13
+
14
+ function getPluginInfo(){
15
+ return PluginInfo;
16
+ }
17
+
18
+ export {
19
+ getPluginInfo
20
+ }