@shijiu/jsview-vue 0.9.283-alpha.0 → 0.9.291-alpha.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.
@@ -3,10 +3,10 @@
3
3
  */
4
4
 
5
5
  const TargetRevision = {
6
- "CoreRevision": 810895,
7
- "JseRevision": "1.0.772",
6
+ "CoreRevision": 810953,
7
+ "JseRevision": "1.0.774",
8
8
  "JseUrl":
9
- "http://cdn.release.qcast.cn/forge_js/master/JsViewES6_react_r772.jsv.91a55796.js"
9
+ "http://cdn.release.qcast.cn/forge_js/master/JsViewES6_react_r774.jsv.dfae49bd.js"
10
10
  };
11
11
 
12
12
  // 不要用export default,update-env脚本不能解析
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shijiu/jsview-vue",
3
- "version": "0.9.283-alpha.0",
3
+ "version": "0.9.291-alpha.0",
4
4
  "bin": {
5
5
  "jsview-post-build": "./scripts/jsview-post-build.js",
6
6
  "jsview-post-install": "./scripts/jsview-post-install.js",
@@ -210,7 +210,9 @@ function compileAndSaveImportedNode(styleFilePath, styleNodes) {
210
210
  let styleContent = "";
211
211
 
212
212
  styleNodes.forEach(node => {
213
- if(!!node.selector) {
213
+ if(node.name === "keyframes") {
214
+ styleContent += compileKeyframesNode(node);
215
+ } else if(!!node.selector) {
214
216
  styleContent += compileSelectorNode(node);
215
217
  styleSelectors.add(node.selector);
216
218
  } else {
@@ -237,13 +239,39 @@ function compileAndSaveImportedNode(styleFilePath, styleNodes) {
237
239
  };
238
240
  }
239
241
 
242
+ function getStringOffset(source, line, column) {
243
+ check(!isNaN(line), source, "JsView Error: Failed to get string offset, line is NaN.");
244
+ check(!isNaN(column), source, "JsView Error: Failed to get string offset, column is NaN.");
245
+
246
+ line -= 1;
247
+ column -= 1;
248
+
249
+ var offset = 0;
250
+ for (var idx = 0; idx < line; idx++) {
251
+ offset = source.indexOf('\n', offset + 1);
252
+ check(offset >= 0, source, "JsView Error: Failed to get string offset, line=" + line + ", column=" + column);
253
+ }
254
+ offset += column;
255
+
256
+ return offset;
257
+ }
258
+
240
259
  function compileKeyframesNode(node) {
241
260
  const name = node.name;
242
261
  check(name, node.source.input.css, "JsView Error: name is not found!");
243
262
 
244
263
  check(name === "keyframes", node.source.input.css, "JsView Error: @keyframes name is not found!");
245
264
 
246
- const content = node.source.input.css.slice(node.source.start.offset, node.source.end.offset + 1);
265
+ let startOffset = node.source.start.offset;
266
+ let endOffset = node.source.end.offset;
267
+ if (typeof (startOffset) == 'undefined') {
268
+ startOffset = getStringOffset(node.source.input.css, node.source.start.line, node.source.start.column);
269
+ }
270
+ if (typeof (endOffset) == 'undefined') {
271
+ endOffset = getStringOffset(node.source.input.css, node.source.end.line, node.source.end.column);
272
+ }
273
+ const content = node.source.input.css.slice(startOffset, endOffset + 1);
274
+ // console.log('jsview-css-to-js.compileKeyframesNode() \n', startOffset, endOffset, content);
247
275
 
248
276
  let styleContent = "'" + node.params + "':'";
249
277
  styleContent += content.replace(/\n/g, " ");
@@ -48,12 +48,14 @@ export default {
48
48
  );
49
49
 
50
50
  // 更新宽高
51
- this.jsvMainView.ResetLayoutParams({
52
- width: this.style.width,
53
- height: this.style.height,
54
- });
51
+ if(typeof this.jsvMainView!="undefined" && this.jsvMainView){
52
+ this.jsvMainView.ResetLayoutParams({
53
+ width: this.style.width,
54
+ height: this.style.height,
55
+ });
55
56
 
56
- this.getId?.(this.jsvMainView?.GetTrackId());
57
+ this.getId?.(this.jsvMainView?.GetTrackId());
58
+ }
57
59
  },
58
60
  beforeUnmount() {
59
61
  if(this.isBrowserDebug) {
@@ -69,10 +71,12 @@ export default {
69
71
  },
70
72
  updated() {
71
73
  // 更新宽高
72
- this.jsvMainView.ResetLayoutParams({
73
- width: this.style.width,
74
- height: this.style.height,
75
- });
74
+ if(typeof this.jsvMainView!="undefined" && this.jsvMainView){
75
+ this.jsvMainView.ResetLayoutParams({
76
+ width: this.style.width,
77
+ height: this.style.height,
78
+ });
79
+ }
76
80
  }
77
81
  };
78
82
  </script>
@@ -84,7 +88,7 @@ export default {
84
88
  >
85
89
  <slot/>
86
90
  </div> <div v-else
87
- :style="{...style, backgroundColor: '#000000'}"
91
+ :style="{...style}"
88
92
  >
89
93
  <slot/>
90
94
  </div>
@@ -0,0 +1,19 @@
1
+ <!--
2
+ * @Author: ChenChanghua
3
+ * @Date: 2021-12-27 10:02:13
4
+ * @LastEditors: ChenChanghua
5
+ * @LastEditTime: 2021-12-31 11:03:18
6
+ * @Description: file content
7
+ -->
8
+ <script>
9
+ export default {
10
+ //不让根元素继承style,以导致多画一个图片。同时注意slot和div的位置
11
+ inheritAttrs: false,
12
+ };
13
+ </script>
14
+ <template>
15
+ <div>
16
+ <slot></slot>
17
+ <div jsv_enable_fade="true" jsv_poster_on_top="true" v-bind="$attrs" />
18
+ </div>
19
+ </template>
@@ -0,0 +1,31 @@
1
+ <!--
2
+ * @Author: ChenChanghua
3
+ * @Date: 2021-12-27 10:02:20
4
+ * @LastEditors: ChenChanghua
5
+ * @LastEditTime: 2021-12-27 10:07:25
6
+ * @Description: file content
7
+ -->
8
+ <script>
9
+ export default {
10
+ props: {
11
+ colorSpace: {
12
+ type: String,
13
+ default: "RGBA_8888",
14
+ },
15
+ },
16
+ inheritAttrs: false,
17
+ };
18
+ </script>
19
+
20
+ <template>
21
+ <div>
22
+ <slot></slot>
23
+ <img
24
+ jsv_enable_fade="true"
25
+ jsv_poster_on_top="true"
26
+ jsv_img_scaledown_tex="true"
27
+ :jsv_img_color_space="{ colorSpace }"
28
+ v-bind="$attrs"
29
+ />
30
+ </div>
31
+ </template>
@@ -263,7 +263,6 @@ export default {
263
263
  if (!state) return;
264
264
  }
265
265
  if (this.$props.onDownloadDone) {
266
- console.log("zhang $props downloadStateList =",this.downloadStateList)
267
266
  this.$props.onDownloadDone(this.downloadStateList);
268
267
  }
269
268
  },
@@ -286,12 +285,13 @@ export default {
286
285
  "Error:format mismatch, data should comes from function buildDownloadInfo()"
287
286
  );
288
287
  }
288
+ console.log(`OnDownload get${index} url=${item.url}`)
289
289
  const base_url = item.url;
290
290
  let image_url = base_url;
291
291
  if (base_url && base_url.indexOf("http") < 0) {
292
292
  // 包含http和https两种请求
293
- if (window.JsView.React.UrlRef) {
294
- image_url = new window.JsView.React.UrlRef(base_url).href;
293
+ if (window.JsView.Dom.UrlRef) {
294
+ image_url = new window.JsView.Dom.UrlRef(base_url).href;
295
295
  }
296
296
  }
297
297
  const texture =
@@ -303,7 +303,7 @@ export default {
303
303
  return;
304
304
  }
305
305
  const callback_token = texture.RegisterLoadImageCallback(null, (texture_info) => {
306
- console.log("zhang texture_info =",texture_info);
306
+ console.log(`OnDownload done index${index}`)
307
307
  this.downloadStateList[index] = texture_info.extra.absolutePath;
308
308
  this._checkDownload();
309
309
  });
@@ -2,7 +2,7 @@
2
2
  * @Author: ChenChanghua
3
3
  * @Date: 2021-11-23 09:42:26
4
4
  * @LastEditors: ChenChanghua
5
- * @LastEditTime: 2021-12-02 15:47:26
5
+ * @LastEditTime: 2022-01-04 16:42:36
6
6
  * @Description: file content
7
7
  -->
8
8
  <script>
@@ -233,7 +233,7 @@ export default {
233
233
  this.timeoutHandler = -1;
234
234
  },
235
235
  startAutoplay() {
236
- if (this.autoplayInterval > 0) {
236
+ if (this.autoplayInterval > 0 && this.totalFrame > 1) {
237
237
  if (this.timeoutHandler > 0) {
238
238
  clearTimeout(this.timeoutHandler);
239
239
  }
@@ -360,6 +360,7 @@ export default {
360
360
  }
361
361
  },
362
362
  _trigger(direction) {
363
+ if (this.totalFrame <= 1) return;
363
364
  this.preOffset = this.offset;
364
365
  this.offset += direction;
365
366
  this._startAnimation();
@@ -385,7 +386,16 @@ export default {
385
386
  onKeyDown: _onKeyDown,
386
387
  }"
387
388
  >
389
+ <div v-if="totalFrame == 1">
390
+ <slot
391
+ name="itemView"
392
+ :currentIndex="0"
393
+ :dataIndex="0"
394
+ :focused="focused"
395
+ ></slot>
396
+ </div>
388
397
  <div
398
+ v-else
389
399
  :style="{
390
400
  width: layoutInfo.width,
391
401
  height: layoutInfo.height,
@@ -16,7 +16,6 @@ import { Options, Vue } from "vue-class-component";
16
16
  props: {
17
17
  onRef: { type: Function, default: () => {} },
18
18
  useTexture: { type: Boolean, default: false },
19
- autoplay: { type: String, default: undefined },
20
19
  },
21
20
  })
22
21
  class JsvVideo extends Vue {