@shijiu/jsview-vue 0.9.426 → 0.9.490

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 (56) 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/samples/ColorSpace/App.vue +4 -4
  10. package/samples/DemoHomepage/router.js +16 -1
  11. package/samples/FilterDemo/App.vue +121 -0
  12. package/samples/GridDemo/App.vue +183 -0
  13. package/samples/GridDemo/ButtonBlock.vue +111 -0
  14. package/samples/GridDemo/FocusItem.vue +56 -0
  15. package/samples/GridDemo/Item.vue +101 -0
  16. package/samples/NinePatchDemo/App.vue +146 -0
  17. package/samples/NinePatchDemo/Item.vue +70 -0
  18. package/samples/TouchSample/App.vue +137 -0
  19. package/samples/TouchSample/Item.vue +101 -0
  20. package/samples/TouchSample/MetroWidgetHorizontal.vue +144 -0
  21. package/samples/TouchSample/MetroWidgetVertical.vue +144 -0
  22. package/samples/TouchSample/TouchContainerHorizontal.vue +159 -0
  23. package/samples/TouchSample/TouchContainerVertical.vue +159 -0
  24. package/samples/TouchSample/data.js +81 -0
  25. package/samples/{ColorSpace → assets}/bmpDemo.bmp +0 -0
  26. package/samples/{ColorSpace → assets}/jpegDemo.jpeg +0 -0
  27. package/samples/{ColorSpace → assets}/pngDemo.png +0 -0
  28. package/samples/{ColorSpace → assets}/pngNoAlphaDemo.png +0 -0
  29. package/samples/assets/webpDemo.webp +0 -0
  30. package/scripts/jsview-jsmap-serve.js +63 -0
  31. package/scripts/jsview-post-build.js +45 -3
  32. package/scripts/jsview-post-install.js +22 -0
  33. package/utils/JsViewEngineWidget/JsvFocusBlock.vue +7 -5
  34. package/utils/JsViewEngineWidget/JsvFocusManager.js +5 -0
  35. package/utils/JsViewEngineWidget/MetroWidget/ItemView.vue +7 -14
  36. package/utils/JsViewEngineWidget/MetroWidget/MetroWidget.vue +212 -89
  37. package/utils/JsViewEngineWidget/MetroWidget/RootView.vue +4 -3
  38. package/utils/JsViewEngineWidget/TemplateParser.js +8 -6
  39. package/utils/JsViewPlugin/JsvPlayer/GetVersion.js +20 -0
  40. package/utils/JsViewPlugin/JsvPlayer/JsvMedia.js +202 -84
  41. package/utils/JsViewPlugin/JsvPlayer/JsvPlayer.vue +43 -14
  42. package/utils/JsViewPlugin/JsvPlayer/index.js +4 -0
  43. package/utils/JsViewPlugin/JsvPlayer/version.js +19 -0
  44. package/utils/JsViewVueTools/DebugTool.js +24 -0
  45. package/utils/JsViewVueTools/NinePatchHelper.js +44 -0
  46. package/utils/JsViewVueTools/TypeCheckAndSet.js +27 -0
  47. package/utils/JsViewVueWidget/JsvApic/JsvApic.vue +2 -2
  48. package/utils/JsViewVueWidget/JsvFilterView.vue +73 -0
  49. package/utils/JsViewVueWidget/JsvGrid.vue +573 -0
  50. package/utils/JsViewVueWidget/JsvInput/JsvInput.vue +7 -0
  51. package/utils/JsViewVueWidget/JsvNinePatch.vue +2 -2
  52. package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +1 -1
  53. package/utils/JsViewVueWidget/JsvTextureAnim/CommonType.js +8 -0
  54. package/utils/JsViewVueWidget/JsvTextureAnim/JsvTextureAnim.vue +171 -38
  55. package/utils/JsViewVueWidget/JsvTextureAnim/index.js +3 -2
  56. package/utils/JsViewVueWidget/JsvTouchContainer.vue +184 -0
@@ -7,6 +7,10 @@
7
7
  -->
8
8
  <script>
9
9
  import { Forge, ForgeExtension } from "../../../dom/jsv-forge-define";
10
+ import { numberCheckSet, urlCheckSet } from "../../JsViewVueTools/TypeCheckAndSet";
11
+ import { toNinePatchForgeViewSet } from "../../JsViewVueTools/NinePatchHelper"
12
+ import { DECORATE_BORDER_RADIUS, DECORATE_NINEPATCH_ALPHA_MIX } from "./CommonType"
13
+
10
14
  /*
11
15
  * JsvTextureAnim:对view的内容进行动画的控件
12
16
  * props说明:
@@ -16,6 +20,30 @@ import { Forge, ForgeExtension } from "../../../dom/jsv-forge-define";
16
20
  * width {number} view的宽
17
21
  * height {number} view的高
18
22
  * borderRadius {string} view的圆角设置
23
+ * decorate {Object} view的渲染修饰
24
+ * BorderRadius view圆角
25
+ * {
26
+ * type {string}: // (必填)装饰类型,固定值"BroderRaidus"
27
+ * topLeft {number}: // (选填)左上角圆弧半径 默认 0
28
+ * topRight {number}: // 右上角圆弧半径 默认 0
29
+ * bottomLeft {number}: // 左下角圆弧半径 默认 0
30
+ * bottomRight {number}: // 右下角圆弧半径 默认 0
31
+ * }
32
+ *
33
+ * NinePatchAlphaMix NinePatch图片的alpha叠加
34
+ * {
35
+ * type {string}: // 装饰类型,固定值"NinePatchAlphaMix"
36
+ * url {string}: // (必填)Alpha mix叠加的图片
37
+ * imageWidth {int} // (必填)原图信息: 原图的宽度(由于正方形,宽高相同)
38
+ * centerWidth {int} // (必填)原图信息: .9图的中心区域宽度(repeat区域)
39
+ * imageDspWidth {int} // (选填)原图缩放后的显示宽度,计算方法:
40
+ * 四角为90度圆弧时: imageDspWidth = 显示图形的圆弧半径 / 原图中圆弧的半径 * 原图宽度
41
+ * 原图中圆弧半径 = (原图宽度 - borderOutset * 2) / 2
42
+ * 四角为其他形状时,原图.9图的四角区域,缩放到要和显示图形重合后的宽度。
43
+ * borderOutset {int} // (必填)原图信息: 图片边缘到中心内容区域边缘的距离, 快速计算: (原图宽度 - 原图中放内容宽度) / 2
44
+ * animTime {int} // (必填)缩放动画的时长(单位毫秒)
45
+ * }
46
+ *
19
47
  * animation {string} texture的动画, 为keyframe的格式
20
48
  * duration {number} 动画时长, 毫秒
21
49
  * onAnimationEnd {function} 动画结束回调
@@ -39,6 +67,7 @@ export default {
39
67
  width: Number,
40
68
  height: Number,
41
69
  borderRadius: String,
70
+ decorate: Object,
42
71
  animation: String,
43
72
  duration: Number,
44
73
  transform: String,
@@ -64,57 +93,142 @@ export default {
64
93
  setup() {
65
94
  return {
66
95
  forgeAnimation: null,
96
+ innerViewId: -1,
97
+ viewStoreRef: null,
67
98
  };
68
99
  },
69
100
  methods: {
101
+ _createForgeView(view_texture, decorate_setting) {
102
+ if (decorate_setting) {
103
+ return this._createLayoutViewWithDecorate(view_texture, decorate_setting);
104
+ } else {
105
+ // 无特异修饰类型的view
106
+ let texture_set = new Forge.ExternalTextureSetting(view_texture);
107
+ return new Forge.LayoutView(texture_set);
108
+ }
109
+ },
110
+
70
111
  _readRadius(setting) {
71
112
  if (setting) {
72
113
  const pattern = /\d+/g;
73
114
  let match = setting.match(pattern);
74
115
  if (match.length > 0) {
75
- const topLeft = match[0];
76
- const topRight = match.length > 1 ? match[1] : topLeft;
77
- const bottomRight = match.length > 2 ? match[2] : topLeft;
78
- const bottomLeft = match.length > 3 ? match[3] : topRight;
79
- return new Forge.ViewRoundCornerMask(
80
- topLeft,
81
- topRight,
82
- bottomLeft,
83
- bottomRight
84
- );
116
+ let top_left = match[0];
117
+ let top_right = match.length > 1 ? match[1] : top_left;
118
+ return {
119
+ type: DECORATE_BORDER_RADIUS,
120
+ topLeft: top_left,
121
+ topRight: top_right,
122
+ bottomRight: match.length > 2 ? match[2] : top_left,
123
+ bottomLeft: match.length > 3 ? match[3] : top_right
124
+ }
85
125
  }
86
126
  }
87
127
  return null;
88
128
  },
129
+
130
+ _createLayoutViewWithDecorate(view_texture, decorate_setting) {
131
+ if (decorate_setting && typeof decorate_setting == 'object') {
132
+ switch(decorate_setting.type) {
133
+ case DECORATE_NINEPATCH_ALPHA_MIX: {
134
+ // NinePatch alpha mix view
135
+ return this._createNinePatchAlphaMixView(view_texture, decorate_setting);
136
+ };
137
+ case DECORATE_BORDER_RADIUS: {
138
+ // 圆角view
139
+ return this._createBorderRadius(view_texture, decorate_setting);
140
+ };
141
+ default:
142
+ console.error("Unknown set=", decorate_setting);
143
+ return null;
144
+ }
145
+ }
146
+ },
147
+
148
+ _createNinePatchAlphaMixView(view_texture, decorate_setting) {
149
+ const textureManager = ForgeExtension.TextureManager;
150
+
151
+ // NinePatch alpha mix view
152
+ let texture_set = new Forge.ExternalTextureSetting(view_texture);
153
+
154
+ let nine_patch_view = new Forge.NinePatchView(texture_set);
155
+
156
+ // alpha mix
157
+ if (decorate_setting.url) {
158
+ let converted_url = urlCheckSet(decorate_setting.url);
159
+ let view_texture = textureManager.GetImage2(converted_url);
160
+
161
+ nine_patch_view.EnableAlphaMix(view_texture, true);
162
+ } else {
163
+ console.error("ninepatch url not set");
164
+ return null;
165
+ }
166
+
167
+ // calculate padding and repeat
168
+ let view_set = toNinePatchForgeViewSet(
169
+ numberCheckSet(decorate_setting.imageWidth),
170
+ numberCheckSet(decorate_setting.centerWidth),
171
+ decorate_setting.imageDspWidth,
172
+ numberCheckSet(decorate_setting.borderOutset));
173
+ nine_patch_view.SetPadding(view_set.padding, view_set.padding); // 方图横纵一致
174
+ nine_patch_view.SetRepeat(view_set.repeat, view_set.repeat); // 方图横纵一致
175
+ nine_patch_view.SetImageDspSize(view_set.imageDspSize, view_set.imageDspSize); // 方图横纵一致
176
+
177
+ return nine_patch_view;
178
+ },
179
+
180
+ _createBorderRadius(view_texture, decorate_setting) {
181
+ // 圆角view
182
+ let texture_mask = new Forge.ViewRoundCornerMask(
183
+ numberCheckSet(decorate_setting.topLeft),
184
+ numberCheckSet(decorate_setting.topRight),
185
+ numberCheckSet(decorate_setting.bottomLeft),
186
+ numberCheckSet(decorate_setting.bottomRight));
187
+ let texture_set = new Forge.ExternalTextureSetting(view_texture, texture_mask);
188
+ return new Forge.LayoutView(texture_set);
189
+ },
190
+
89
191
  _onAnimationEnd() {
90
192
  this.onAnimationEnd?.();
91
193
  },
194
+
92
195
  start() {
93
196
  if (this.forgeAnimation && this.innerView) {
94
197
  this.innerView.StartTextureAnimation(this.forgeAnimation);
95
198
  }
96
199
  },
200
+
201
+ getTransition() {
202
+ let transition = "";
203
+ let decorate = this.$props.decorate;
204
+
205
+ if (decorate && decorate.type == DECORATE_NINEPATCH_ALPHA_MIX && decorate.animTime > 0) {
206
+ // Ninepatch模式可以设置长宽的过渡动画
207
+ transition = `left ${this.animTime}s, top ${this.animTime}s, width ${this.animTime}s, height ${this.animTime}s`;
208
+ }
209
+
210
+ return transition;
211
+ }
97
212
  },
213
+
98
214
  created() {
99
215
  if (window.JsView) {
100
216
  const textureManager = ForgeExtension.TextureManager;
101
217
 
102
- let image_url = this.src;
103
- if (this.src && this.src.indexOf("http") === 0) {
104
- image_url = this.src;
105
- } else if (window.JsView.React.UrlRef) {
106
- image_url = new window.JsView.React.UrlRef(this.src).href;
218
+ // 1.获得主view的展示内容图片 texture
219
+ let image_url = urlCheckSet(this.src);
220
+ let view_texture = textureManager.GetImage2(image_url, false, null, "RGB_8888", null);
221
+
222
+ // 1.1 兼容border转为decorate
223
+ let decorate = this.$props.decorate;
224
+ if (this.$props.borderRadius) {
225
+ decorate = this._readRadius(this.$props.borderRadius);
107
226
  }
108
- let imageTexture = new Forge.ExternalTextureSetting(
109
- textureManager.GetImage2(image_url, false, null, "RGB_8888", null),
110
- this._readRadius(this.borderRadius)
111
- );
112
227
 
113
- this.innerView = new Forge.LayoutView(imageTexture);
114
- const view_store = ForgeExtension.RootActivity
115
- ? ForgeExtension.RootActivity.ViewStore
116
- : Forge.sViewStore;
228
+ // 2.创建view
229
+ this.innerView = this._createForgeView(view_texture, decorate);
117
230
 
231
+ // 3.设置texture基本形变
118
232
  if (this.transform) {
119
233
  this.innerView.ResetTextureCssTransform(
120
234
  this.transform,
@@ -122,14 +236,7 @@ export default {
122
236
  );
123
237
  }
124
238
 
125
- this.innerViewId = view_store.add(
126
- new Forge.ViewInfo(this.innerView, {
127
- x: 0,
128
- y: 0,
129
- width: this.width,
130
- height: this.height,
131
- })
132
- );
239
+ // 4.设置texture的动画形变
133
240
  this.forgeAnimation = new Forge.CssKeyframeAnimation(
134
241
  "@keyframes test" + this.animation,
135
242
  this.duration,
@@ -139,12 +246,32 @@ export default {
139
246
  );
140
247
  this.forgeAnimation.EnableDelay(this.delay).SetRepeat(this.repeat);
141
248
  this.forgeAnimation.SetAnimationListener(
142
- new Forge.AnimationListener(
143
- null,
144
- this._onAnimationEnd,
145
- null
146
- )
147
- );
249
+ new Forge.AnimationListener(
250
+ null,
251
+ this._onAnimationEnd,
252
+ null
253
+ )
254
+ );
255
+
256
+ // 5. inner view标准处理
257
+ this.viewStoreRef = ForgeExtension.RootActivity
258
+ ? ForgeExtension.RootActivity.ViewStore
259
+ : Forge.sViewStore;
260
+
261
+ this.innerViewId = this.viewStoreRef.add(
262
+ new Forge.ViewInfo(this.innerView, {
263
+ x: 0,
264
+ y: 0,
265
+ width: this.width,
266
+ height: this.height,
267
+ })
268
+ );
269
+ }
270
+ },
271
+ beforeUnmount() {
272
+ if (this.innerViewId !== -1) {
273
+ this.viewStoreRef.remove(this.innerViewId);
274
+ this.innerViewId = -1;
148
275
  }
149
276
  },
150
277
  mounted() {
@@ -156,5 +283,11 @@ export default {
156
283
  </script>
157
284
 
158
285
  <template>
159
- <div :jsv_innerview="innerViewId"></div>
286
+ <div
287
+ :style="{
288
+ transition: getTransition(),
289
+ }"
290
+ :jsv_innerview="innerViewId">
291
+
292
+ </div>
160
293
  </template>
@@ -12,5 +12,6 @@ let _JsvTextureAnim = JsvTextureAnim;
12
12
  if (window.JsvWidgetWrapperGroup && window.JsvWidgetWrapperGroup.BrowserTextureAnim) {
13
13
  _JsvTextureAnim = window.JsvWidgetWrapperGroup.BrowserTextureAnim;
14
14
  }
15
- let component = _JsvTextureAnim.default;
16
- export default component;
15
+
16
+ export * from "./CommonType"
17
+ export default _JsvTextureAnim.default
@@ -0,0 +1,184 @@
1
+ <!--
2
+ * @Author: ChenChanghua
3
+ * @Date: 2022-04-10 20:46:53
4
+ * @LastEditors: ChenChanghua
5
+ * @LastEditTime: 2022-04-10 23:07:54
6
+ * @Description: file content
7
+ -->
8
+ <script>
9
+ import { Forge } from "../../dom/jsv-forge-define";
10
+
11
+ const DIRECTION_HORIZONTAL = Forge.DragSetting.DIRECTION_HORIZONTAL;
12
+ const DIRECTION_VERTICAL = Forge.DragSetting.DIRECTION_VERTICAL;
13
+ const DIRECTION_DISABLE = Forge.DragSetting.DIRECTION_DISABLE;
14
+ const DIRECTION_AUTO = Forge.DragSetting.DIRECTION_AUTO;
15
+ export {
16
+ DIRECTION_HORIZONTAL,
17
+ DIRECTION_VERTICAL,
18
+ DIRECTION_DISABLE,
19
+ DIRECTION_AUTO,
20
+ };
21
+
22
+ export default {
23
+ props: {
24
+ style: {
25
+ type: Object,
26
+ default() {
27
+ return {
28
+ left: 0,
29
+ top: 0,
30
+ width: 1920,
31
+ height: 600,
32
+ };
33
+ },
34
+ },
35
+ direction: DIRECTION_DISABLE,
36
+ dragLimitArea: {
37
+ type: Object,
38
+ default() {
39
+ return { x: 0, y: 0, width: 0, height: 0 };
40
+ },
41
+ },
42
+ flingPageWidth: { type: Number, default: -1 }, // 滑动页的宽度,即开启整平滑动模式
43
+ flingPageEdge: { type: Number, default: 1 / 5 }, // 触发整屏滑动页的边界,默认为1/5
44
+ triggerMovedDistance: { type: Number, default: 20 }, // 触发onmoved的最小距离
45
+ onClick: { type: Function },
46
+ onDragStart: { type: Function },
47
+ onMoved: { type: Function },
48
+ onDragEnd: { type: Function },
49
+ onFling: { type: Function },
50
+ onRelease: { type: Function },
51
+ },
52
+ data() {
53
+ return {
54
+ innerLeft: 0,
55
+ innerTop: 0,
56
+ };
57
+ },
58
+ setup() {},
59
+ methods: {
60
+ _innerStyle() {
61
+ const { left, top, ...others } = this.style;
62
+ others.left = this.innerLeft;
63
+ others.top = this.innerTop;
64
+ return others;
65
+ },
66
+ },
67
+ created() {},
68
+ mounted() {
69
+ if (this.$refs.touchContainer && this.$refs.touchContainer.jsvMaskView) {
70
+ const view = this.$refs.touchContainer.jsvMaskView;
71
+ const view_lp = view.GetLayoutParams();
72
+ const page_width = this.flingPageWidth;
73
+ const page_edge = this.flingPageEdge;
74
+ const direction = this.direction;
75
+ // 整屏滑动(启动tab模式,即flingPageWidth设置相应参数),dragLimitArea为固定值
76
+ let drag_limit_area = this.dragLimitArea;
77
+ if (page_width !== -1) {
78
+ if (direction === Forge.DragSetting.DIRECTION_HORIZONTAL) {
79
+ drag_limit_area = {
80
+ x: 0,
81
+ y: 0,
82
+ width: page_width,
83
+ height: view_lp.Height,
84
+ };
85
+ } else {
86
+ drag_limit_area = {
87
+ x: 0,
88
+ y: 0,
89
+ width: view_lp.Width,
90
+ height: page_width,
91
+ };
92
+ }
93
+ }
94
+
95
+ const drag_setting = new Forge.DragSetting(
96
+ direction,
97
+ this.triggerMovedDistance,
98
+ false,
99
+ new Forge.RectArea(
100
+ drag_limit_area.x,
101
+ drag_limit_area.y,
102
+ drag_limit_area.width,
103
+ drag_limit_area.height
104
+ ),
105
+ page_width,
106
+ page_edge
107
+ );
108
+ let callback = {};
109
+ if (direction === Forge.DragSetting.DIRECTION_DISABLE) {
110
+ callback.OnTap = (msg) => {
111
+ console.log("Container OnTap:", msg);
112
+ if (this.onClick) {
113
+ return this.onClick(msg);
114
+ }
115
+ return false;
116
+ };
117
+ } else {
118
+ callback = {
119
+ OnTap: (msg) => {
120
+ console.log("Container OnTap:", msg);
121
+ if (this.onClick) {
122
+ return this.onClick(msg);
123
+ }
124
+ return false;
125
+ },
126
+ OnDragStart: (msg) => {
127
+ console.log("Container OnDragStart:", msg);
128
+ if (this.onDragStart) {
129
+ return this.onDragStart(msg);
130
+ }
131
+ return false;
132
+ },
133
+ OnMoved: (msg) => {
134
+ console.log("Container OnMoved:", msg);
135
+ if (this.onMoved) {
136
+ return this.onMoved(msg);
137
+ }
138
+ return false;
139
+ },
140
+ OnDragEnd: (msg) => {
141
+ console.log("Container OnDragEnd:", msg);
142
+ if (this.onDragEnd) {
143
+ return this.onDragEnd(msg);
144
+ }
145
+ return false;
146
+ },
147
+ OnFling: (msg) => {
148
+ console.log("Container OnFling:", msg);
149
+ if (this.onFling) {
150
+ return this.onFling(msg);
151
+ }
152
+ return false;
153
+ },
154
+ OnRelease: (msg) => {
155
+ console.log("Container OnRelease:", msg);
156
+ if (this.onRelease) {
157
+ return this.onRelease(msg);
158
+ }
159
+ return false;
160
+ },
161
+ };
162
+ }
163
+ view.EnableDrag(drag_setting, callback, "translateMat(dx,dy,0)");
164
+ }
165
+ },
166
+ };
167
+ </script>
168
+
169
+ <template>
170
+ <div
171
+ key="containerPos"
172
+ :style="{
173
+ left: style.left,
174
+ top: style.top,
175
+ width: dragLimitArea.width ? dragLimitArea.width : style.width,
176
+ height: dragLimitArea.height ? dragLimitArea.height : style.height,
177
+ overflow: 'hidden',
178
+ }"
179
+ >
180
+ <div key="container" ref="touchContainer" :style="_innerStyle()">
181
+ <slot></slot>
182
+ </div>
183
+ </div>
184
+ </template>