@shijiu/jsview-vue 0.9.631 → 0.9.684

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 (55) 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/bin/jsview-engine-js-browser.min.js +1 -0
  4. package/dom/target_core_revision.js +4 -4
  5. package/package.json +1 -1
  6. package/samples/Basic/components/text/TextOverflow.vue +8 -3
  7. package/samples/DemoHomepage/router.js +5 -0
  8. package/samples/Marquee/App.vue +176 -40
  9. package/samples/Marquee/longText.js +14 -0
  10. package/samples/MetroWidgetDemos/Advanced/App.vue +5 -6
  11. package/samples/MetroWidgetDemos/Advanced/ButtonItem.vue +1 -1
  12. package/samples/MetroWidgetDemos/Advanced/Buttons.vue +5 -5
  13. package/samples/MetroWidgetDemos/Advanced/Mixed.vue +4 -4
  14. package/samples/MetroWidgetDemos/Advanced/widgets/Item.vue +83 -0
  15. package/samples/MetroWidgetDemos/Advanced/widgets/WidgetItem.vue +89 -0
  16. package/samples/MetroWidgetDemos/Advanced/{Widgets.vue → widgets/Widgets.vue} +56 -11
  17. package/samples/MetroWidgetDemos/Advanced/widgets/focus1.png +0 -0
  18. package/samples/MetroWidgetDemos/Item.vue +20 -2
  19. package/samples/MetroWidgetDemos/Simple/AbsoluteTemplate.vue +2 -2
  20. package/samples/MetroWidgetDemos/Simple/App.vue +2 -2
  21. package/samples/MetroWidgetDemos/Simple/RelativeTemplate.vue +4 -4
  22. package/samples/MetroWidgetDemos/data.js +2 -1
  23. package/samples/ScaleDownNeon/App.vue +107 -0
  24. package/samples/TextBox/App.vue +7 -81
  25. package/samples/TextBox/RenderCenter.vue +40 -16
  26. package/samples/TextBox/RenderLeft.vue +48 -19
  27. package/samples/TextBox/RenderOneLine.vue +30 -49
  28. package/samples/TextBox/RenderRight.vue +40 -16
  29. package/samples/TextShadowDemo/App.vue +11 -17
  30. package/samples/TextureSize/App.vue +3 -3
  31. package/utils/JsViewEngineWidget/MetroWidget/Const.js +11 -0
  32. package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +188 -80
  33. package/utils/JsViewEngineWidget/TemplateParser.js +89 -32
  34. package/utils/JsViewEngineWidget/WidgetCommon.js +3 -4
  35. package/utils/JsViewEngineWidget/index.js +3 -2
  36. package/utils/JsViewPlugin/JsvPlayer/JsvMedia.js +61 -12
  37. package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +8 -1
  38. package/utils/JsViewPlugin/JsvPlayer/index.js +14 -0
  39. package/utils/JsViewPlugin/JsvPlayer/version.js +4 -4
  40. package/utils/JsViewVueWidget/JsvMarquee.vue +178 -205
  41. package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +35 -27
  42. package/utils/JsViewVueWidget/JsvNinePatch.vue +1 -2
  43. package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +18 -2
  44. package/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue +22 -2
  45. package/utils/JsViewVueWidget/JsvTextBox.vue +35 -72
  46. package/utils/JsViewVueWidget/JsvTouchContainer.vue +3 -4
  47. package/utils/JsViewVueWidget/utils/index.js +8 -0
  48. package/utils/JsViewVueWidget/utils/text.js +19 -0
  49. package/utils/JsViewEngineWidget/MetroPage.js +0 -2128
  50. package/utils/JsViewEngineWidget/SimpleWidget/ContentView.vue +0 -51
  51. package/utils/JsViewEngineWidget/SimpleWidget/Dispatcher.js +0 -19
  52. package/utils/JsViewEngineWidget/SimpleWidget/DivWrapper.vue +0 -53
  53. package/utils/JsViewEngineWidget/SimpleWidget/ItemView.vue +0 -142
  54. package/utils/JsViewEngineWidget/SimpleWidget/RootView.vue +0 -140
  55. package/utils/JsViewEngineWidget/SimpleWidget/SimpleWidget.vue +0 -1629
@@ -7,42 +7,51 @@
7
7
  * 例如`${window.JsView?.getJsContextId()}_${you_name}`
8
8
  -->
9
9
 
10
- <script>
10
+ <script>
11
11
  import { Forge, ForgeExtension } from "../../dom/jsv-forge-define";
12
12
 
13
13
  export default {
14
14
  props: {
15
15
  style: {
16
16
  type: Object,
17
- default: () => { return {} }
17
+ default: () => {
18
+ return {};
19
+ },
18
20
  },
19
21
  getId: Function,
20
22
  setId: String,
23
+ seeThrough: {
24
+ type: Boolean,
25
+ default: true,
26
+ },
21
27
  },
22
28
  setup() {
23
29
  return {
24
30
  isBrowserDebug: window.jsvIsBrowserDebug,
25
31
  jsvMainView: undefined,
26
32
  innerViewId: undefined,
27
- }
33
+ };
28
34
  },
29
35
  beforeMount() {
30
- if(this.isBrowserDebug) {
36
+ if (this.isBrowserDebug) {
31
37
  return;
32
38
  }
33
39
 
34
40
  // 初始化View
35
41
 
36
42
  // 创建JsView图层穿透的texture,抠洞处理
37
- const seeThroughTexture = ForgeExtension.TextureManager.GetColorTexture(
38
- "rgba(0,0,0,0)"
39
- );
40
- const textureSetting = new Forge.TextureSetting(
41
- seeThroughTexture,
42
- null,
43
- null,
44
- false
45
- );
43
+ // 默认为扣洞,有的场景不需要扣洞
44
+ let textureSetting = null;
45
+ if (this.seeThrough) {
46
+ const seeThroughTexture =
47
+ ForgeExtension.TextureManager.GetColorTexture("rgba(0,0,0,0)");
48
+ textureSetting = new Forge.TextureSetting(
49
+ seeThroughTexture,
50
+ null,
51
+ null,
52
+ false
53
+ );
54
+ }
46
55
 
47
56
  // 通过内置函数构造定制的NativeSharedView
48
57
  this.jsvMainView = new Forge.NativeSharedView(textureSetting);
@@ -51,7 +60,7 @@ export default {
51
60
  );
52
61
 
53
62
  // 更新宽高
54
- if(typeof this.jsvMainView!="undefined" && this.jsvMainView){
63
+ if (typeof this.jsvMainView != "undefined" && this.jsvMainView) {
55
64
  if (this.setId) {
56
65
  // 使用设置进来的track id,而非自动生成
57
66
  this.jsvMainView.SetTrackId(this.setId);
@@ -61,7 +70,7 @@ export default {
61
70
  }
62
71
  },
63
72
  beforeUnmount() {
64
- if(this.isBrowserDebug) {
73
+ if (this.isBrowserDebug) {
65
74
  return;
66
75
  }
67
76
 
@@ -75,21 +84,20 @@ export default {
75
84
  };
76
85
  </script>
77
86
 
78
- <template>
79
- <div v-if="!isBrowserDebug"
87
+ <template>
88
+ <div
89
+ v-if="!isBrowserDebug"
80
90
  :style="{
81
- left: style.left,
91
+ left: style.left,
82
92
  top: style.top,
83
93
  width: style.width,
84
- height: style.height
85
- }"
94
+ height: style.height,
95
+ }"
86
96
  :jsv_innerview="innerViewId"
87
97
  >
88
- <slot/>
89
- </div> <div v-else
90
- :style="{...style}"
91
- >
92
- <slot/>
98
+ <slot />
93
99
  </div>
94
- </template>
95
-
100
+ <div v-else :style="{ ...style }">
101
+ <slot />
102
+ </div>
103
+ </template>
@@ -44,7 +44,6 @@ export default {
44
44
  if (!this.waitForInit) {
45
45
  return true;
46
46
  }
47
-
48
47
  return this.style && this.style.width !== 0 && this.style.height !== 0;
49
48
  },
50
49
  getTransition() {
@@ -79,7 +78,7 @@ export default {
79
78
 
80
79
  <template>
81
80
  <div
82
- v-if="isReady"
81
+ v-if="isReady()"
83
82
  :style="{
84
83
  ...style,
85
84
  transition: getTransition(),
@@ -34,6 +34,7 @@ import { Forge } from "../../../dom/jsv-forge-define";
34
34
  import JsvActorMove, {
35
35
  JsvActorMoveControl,
36
36
  } from "jsview/utils/JsViewVueWidget/JsvActorMove";
37
+ import JsvVisibleSensor from "jsview/utils/JsViewVueWidget/JsvVisibleSensor";
37
38
  import Indicator from "./Indicator.vue";
38
39
  import { ref } from "vue";
39
40
 
@@ -50,7 +51,7 @@ function modToRange(value, mod, start = 0) {
50
51
  }
51
52
 
52
53
  export default {
53
- components: { Indicator, JsvActorMove },
54
+ components: { Indicator, JsvActorMove, JsvVisibleSensor },
54
55
  props: {
55
56
  showIndicator: {
56
57
  type: Boolean,
@@ -127,7 +128,7 @@ export default {
127
128
  reverseSwipe: {
128
129
  type: Boolean,
129
130
  default: false,
130
- }
131
+ },
131
132
  },
132
133
  computed: {
133
134
  indicatorLayout() {
@@ -407,6 +408,13 @@ export default {
407
408
  this.offset += direction;
408
409
  this._startAnimation(direction > 0 ? 1 : -1);
409
410
  },
411
+ onBeVisible(old_h, new_h, old_v, new_v) {
412
+ if ((old_h && !new_h) || (old_v && !new_h)) {
413
+ this.stopAutoplay();
414
+ } else if ((!old_h && new_h) || (!old_v && new_h)) {
415
+ this.startAutoplay();
416
+ }
417
+ },
410
418
  },
411
419
  mounted() {
412
420
  if (!this.focused) {
@@ -420,6 +428,14 @@ export default {
420
428
  </script>
421
429
 
422
430
  <template>
431
+ <jsv-visible-sensor
432
+ :horizonShown="0.2"
433
+ :verticalShown="0.2"
434
+ :width="layoutInfo.width"
435
+ :height="layoutInfo.height"
436
+ :enable="true"
437
+ :callback="onBeVisible"
438
+ ></jsv-visible-sensor>
423
439
  <jsv-focus-block
424
440
  :name="name"
425
441
  :onAction="{
@@ -29,6 +29,7 @@
29
29
  <script>
30
30
  import Indicator from "./Indicator.vue";
31
31
  import { ref } from "vue";
32
+ import JsvVisibleSensor from "jsview/utils/JsViewVueWidget/JsvVisibleSensor";
32
33
 
33
34
  const VIEW_NUM = 4;
34
35
 
@@ -45,7 +46,7 @@ function modToRange(value, mod, start = 0) {
45
46
  window.modToRange = modToRange;
46
47
 
47
48
  export default {
48
- components: { Indicator },
49
+ components: { Indicator, JsvVisibleSensor },
49
50
  props: {
50
51
  showIndicator: {
51
52
  type: Boolean,
@@ -124,7 +125,7 @@ export default {
124
125
  reverseSwipe: {
125
126
  type: Boolean,
126
127
  default: false,
127
- }
128
+ },
128
129
  },
129
130
  computed: {
130
131
  indicatorLayout() {
@@ -320,6 +321,10 @@ export default {
320
321
  }, this.autoplayInterval);
321
322
  }
322
323
  },
324
+ _stopAutoPlay() {
325
+ clearInterval(this.intervalHandler);
326
+ this.intervalHandler = -1;
327
+ },
323
328
  _onFocus() {
324
329
  this.focused = true;
325
330
  clearInterval(this.intervalHandler);
@@ -330,6 +335,13 @@ export default {
330
335
  this._enableAutoplay();
331
336
  this.onBlur?.();
332
337
  },
338
+ onBeVisible(old_h, new_h, old_v, new_v) {
339
+ if ((old_h && !new_h) || (old_v && !new_h)) {
340
+ this._stopAutoPlay();
341
+ } else if ((!old_h && new_h) || (!old_v && new_h)) {
342
+ this._enableAutoplay();
343
+ }
344
+ },
333
345
  },
334
346
  created() {
335
347
  this._enableAutoplay();
@@ -338,6 +350,14 @@ export default {
338
350
  </script>
339
351
 
340
352
  <template>
353
+ <jsv-visible-sensor
354
+ :horizonShown="0.2"
355
+ :verticalShown="0.2"
356
+ :width="layoutInfo.widgetWidth"
357
+ :height="layoutInfo.widgetHeight"
358
+ :enable="true"
359
+ :callback="onBeVisible"
360
+ ></jsv-visible-sensor>
341
361
  <jsv-focus-block
342
362
  :name="name"
343
363
  :onAction="{
@@ -6,94 +6,54 @@
6
6
  * JsvTextBox:Vue高阶组件,文字的垂直对齐方式显示控件
7
7
  * props说明:
8
8
  * verticalAlign {string} 垂直对齐方式 (必需) top、middle、bottom
9
- * stylesList {array} 布局样式(必需),数组中可包含样式对象或者JsvStyleClass,或者JsvTextStyleClass对象,
10
- * 样式对象内容为{left:0, top:0, width:xxx, height:xxx},
11
- * 布局样式为数组中所有样式的合并。
12
- * styleToken {string} 类似于react html元素的key,当style变化时,由使用者改变此Token通知hoc进行style重新识别。
13
- * Token不变的场景,props变化不会引起render,以提高渲染性能
9
+ * style {object} 样式(必需)
14
10
  * enableLatex {bool} 是否启用Latex文字描画模式
15
11
  -->
16
12
 
17
- <script>
18
- import {
19
- JsvTextStyleClass,
20
- combinedStyles,
21
- } from "jsview/utils/JsViewVueTools/JsvStyleClass.js";
13
+ <script setup>
14
+ import { ref, computed } from "vue";
22
15
 
23
- let sAreaAlignStyleMap = new Map();
24
- export default {
25
- props: {
26
- styleToken: String,
27
- stylesList: Object,
28
- verticalAlign: {
29
- type: String,
30
- default: "middle",
31
- },
32
- lineAlign: {
33
- type: String,
34
- default: "middle",
35
- },
36
- enableLatex: Boolean,
16
+ const props = defineProps({
17
+ style: Object,
18
+ verticalAlign: {
19
+ type: String,
20
+ default: "middle",
37
21
  },
38
- data() {
39
- return {
40
- styleCombined: null,
41
- styleClasses: null,
42
- tokenProcesses: null,
43
- };
22
+ lineAlign: {
23
+ type: String,
24
+ default: "middle",
44
25
  },
45
- beforeMount() {
46
- if (this.styleToken !== this.tokenProcesses) {
47
- // Token变化时,重新解析style array
48
- const style_set = combinedStyles(
49
- this.stylesList,
50
- !window.JsvDisableReactWrapper // 无ReactWrapper时,全解析style属性
51
- );
26
+ enableLatex: Boolean,
27
+ className: String,
28
+ });
52
29
 
53
- this.styleCombined = style_set.combinedStyle;
54
- // console.log("styleCombined = ", this.styleCombined);
55
- if (!window.JsvDisableReactWrapper) {
56
- this.styleClasses = style_set.combinedClass;
57
- let key = this.verticalAlign + "_" + this.lineAlign;
58
- if (!sAreaAlignStyleMap.has(key)) {
59
- const text_class = new JsvTextStyleClass({});
60
- text_class.setVerticalAlign(this.verticalAlign);
61
- text_class.setLineAlign(this.lineAlign);
62
- sAreaAlignStyleMap.set(key, text_class);
63
- }
64
- const va_set_class = sAreaAlignStyleMap.get(key);
65
- if (this.styleClasses.length === 0) {
66
- this.styleClasses += va_set_class.getName();
67
- } else {
68
- this.styleClasses = this.styleClasses + " " + va_set_class.getName();
69
- }
70
- }
71
- this.tokenProcesses = this.styleToken;
72
- }
73
- },
74
- methods: {
75
- isJsvDisableReactWrapper() {
76
- if (window.JsvDisableReactWrapper) {
77
- return true;
78
- }
79
- return false;
80
- },
81
- },
82
- };
30
+ const innerStyle = computed(() => {
31
+ let result = { ...props.style };
32
+ if (!result.verticalAlign) {
33
+ result.verticalAlign = props.verticalAlign;
34
+ }
35
+ if (!result.lineAlign) {
36
+ result.lineAlign = props.lineAlign;
37
+ }
38
+ return result;
39
+ });
40
+ const disable = window.JsvDisableReactWrapper;
83
41
  </script>
84
42
 
85
43
  <template>
86
44
  <div>
87
- <div v-if="isJsvDisableReactWrapper()" :style="styleCombined">
45
+ <div v-if="disable" :style="style">
88
46
  <div :style="{ position: 'static', display: 'table' }">
89
47
  <div
48
+ :className="className"
90
49
  :style="{
91
50
  position: 'static',
92
51
  display: 'table-cell',
93
- width: styleCombined.width,
94
- height: styleCombined.height,
52
+ width: style.width,
53
+ height: style.height,
95
54
  verticalAlign: verticalAlign,
96
55
  }"
56
+ jsv-inherit-class="2"
97
57
  >
98
58
  <slot></slot>
99
59
  </div>
@@ -101,9 +61,12 @@ export default {
101
61
  </div>
102
62
  <div
103
63
  v-else
104
- :className="styleClasses"
105
- :style="{ ...styleCombined }"
64
+ :className="className"
65
+ :style="style"
106
66
  :jsv_text_latex_enable="enableLatex ? 'true' : ''"
67
+ :jsv_text_vertical_align="verticalAlign"
68
+ :jsv_text_line_align="lineAlign"
69
+ jsv-inherit-class="1"
107
70
  >
108
71
  <slot></slot>
109
72
  </div>
@@ -2,7 +2,7 @@
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2022-04-10 20:46:53
4
4
  * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2022-04-10 23:07:54
5
+ * @LastEditTime: 2022-11-07 14:43:44
6
6
  * @Description: file content
7
7
  -->
8
8
  <script>
@@ -68,7 +68,6 @@ export default {
68
68
  mounted() {
69
69
  if (this.$refs.touchContainer && this.$refs.touchContainer.jsvMaskView) {
70
70
  const view = this.$refs.touchContainer.jsvMaskView;
71
- const view_lp = view.GetLayoutParams();
72
71
  const page_width = this.flingPageWidth;
73
72
  const page_edge = this.flingPageEdge;
74
73
  const direction = this.direction;
@@ -80,13 +79,13 @@ export default {
80
79
  x: 0,
81
80
  y: 0,
82
81
  width: page_width,
83
- height: view_lp.Height,
82
+ height: this.$refs.touchContainer.style.height,
84
83
  };
85
84
  } else {
86
85
  drag_limit_area = {
87
86
  x: 0,
88
87
  y: 0,
89
- width: view_lp.Width,
88
+ width: this.$refs.touchContainer.style.width,
90
89
  height: page_width,
91
90
  };
92
91
  }
@@ -0,0 +1,8 @@
1
+ /*
2
+ * @Author: ChenChanghua
3
+ * @Date: 2022-11-09 15:18:52
4
+ * @LastEditors: ChenChanghua
5
+ * @LastEditTime: 2022-11-09 15:18:52
6
+ * @Description: file content
7
+ */
8
+ export * from "./text"
@@ -0,0 +1,19 @@
1
+ /*
2
+ * @Author: ChenChanghua
3
+ * @Date: 2022-11-09 15:18:43
4
+ * @LastEditors: ChenChanghua
5
+ * @LastEditTime: 2022-11-10 15:02:54
6
+ * @Description: file content
7
+ */
8
+ const getTextWidth = (text, style) => {
9
+ const textParams = {
10
+ str: text ? text : "",
11
+ font: style.fontFamily ? style.fontFamily : Forge.TextUtils._sDefaultFont,
12
+ size: style.fontSize ? style.fontSize : Forge.TextUtils._sDefaultFontSize,
13
+ italic: style.fontStyle === "italic" ? "italic" : "",
14
+ bold: style.fontWeight === "bold" ? "bold" : "",
15
+ };
16
+ return window.PlatformUtils.GetTextWidth(textParams);
17
+ };
18
+
19
+ export { getTextWidth };