emacroh5lib 1.0.87 → 1.0.88

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.
@@ -36,6 +36,10 @@ Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE
36
36
  version 0.6.9
37
37
  */
38
38
 
39
+ /*! sheetjs (C) 2013-present SheetJS -- http://sheetjs.com */
40
+
41
+ /*! xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
42
+
39
43
  /**
40
44
  * vue-class-component v7.2.3
41
45
  * (c) 2015-present Evan You
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emacroh5lib",
3
- "version": "1.0.87",
3
+ "version": "1.0.88",
4
4
  "description": "EMacro前端组件库",
5
5
  "main": "dist/emacroh5lib.min.js",
6
6
  "scripts": {
@@ -8,13 +8,12 @@
8
8
  * interval 轮播时间间隔,单位毫秒,默认为2000
9
9
  * loopSeries boolean类型,默认为false。
10
10
  * true表示循环所有series的tooltip,false则显示指定seriesIndex的tooltip
11
- * seriesIndex 默认为0,指定某个系列(option中的series索引)循环显示tooltip,
12
- * 当loopSeries为true时,从seriesIndex系列开始执行.
11
+ * seriesIndex 默认为0,指定某个系列(option中的series索引)循环显示tooltip, 当loopSeries为true时,从seriesIndex系列开始执行.
13
12
  * }
14
13
  * @returns {{clearLoop: clearLoop}}
15
14
  */
16
15
  const loopShowTooltip = function (chart, chartOption, options) {
17
- var defaultOptions = {
16
+ let defaultOptions = {
18
17
  interval: 3000,
19
18
  loopSeries: true,
20
19
  seriesIndex: 0,
@@ -28,13 +27,13 @@ const loopShowTooltip = function (chart, chartOption, options) {
28
27
  chartOption = chart.getOption();
29
28
  }
30
29
 
31
- var dataIndex = 0; // 数据索引,初始化为-1,是为了判断是否是第一次执行
32
- var seriesIndex = 0; // 系列索引
33
- var timeTicket = 0;
34
- var seriesLen = chartOption.series.length; // 系列个数
35
- var dataLen = 0; // 某个系列数据个数
36
- var chartType; // 系列类型
37
- var first = true;
30
+ let dataIndex = 0; // 数据索引,初始化为-1,是为了判断是否是第一次执行
31
+ let seriesIndex = 0; // 系列索引
32
+ let timeTicket = 0;
33
+ let seriesLen = chartOption.series.length; // 系列个数
34
+ let dataLen = 0; // 某个系列数据个数
35
+ let chartType; // 系列类型
36
+ let first = true;
38
37
 
39
38
  // 不循环series时seriesIndex指定显示tooltip的系列,不指定默认为0,指定多个则默认为第一个
40
39
  // 循环series时seriesIndex指定循环的series,不指定则从0开始循环所有series,指定单个则相当于不循环,指定多个
@@ -68,11 +67,11 @@ const loopShowTooltip = function (chart, chartOption, options) {
68
67
  chart.setOption(chartOption);
69
68
  }
70
69
 
71
- var series = chartOption.series;
70
+ let series = chartOption.series;
72
71
  chartType = series[seriesIndex].type; // 系列类型
73
72
  dataLen = series[seriesIndex].data.length; // 某个系列的数据个数
74
73
 
75
- var tipParams = { seriesIndex: seriesIndex };
74
+ let tipParams = { seriesIndex: seriesIndex };
76
75
  switch (chartType) {
77
76
  case 'map':
78
77
  case 'pie':
@@ -146,7 +145,7 @@ const loopShowTooltip = function (chart, chartOption, options) {
146
145
  }
147
146
  }
148
147
 
149
- var zRender = chart.getZr();
148
+ const zRender = chart.getZr();
150
149
 
151
150
  function zRenderMouseMove(param) {
152
151
  if (param.event) {
@@ -1,7 +1,7 @@
1
1
 
2
- import XLSX from "xlsx";
2
+ import * as XLSX from "xlsx";
3
3
  // import XLSX from "./dist/xlsx.js";
4
-
4
+
5
5
 
6
6
  // const XLSX = require("./dist/xlsx.js")
7
7
  import BMF from 'browser-md5-file';
@@ -12,12 +12,12 @@ import { saveAs } from 'file-saver';
12
12
 
13
13
  export namespace EMacro {
14
14
 
15
- export const version = "1.72"
15
+ export const version = "1.73"
16
16
 
17
17
  export class File {
18
18
 
19
19
  public static getFileMD5(file) {
20
- return new Promise((res, rej) => {
20
+ return new Promise((resolve, reject) => {
21
21
 
22
22
  const fileReader = new FileReader()
23
23
  fileReader.readAsBinaryString(file);
@@ -25,9 +25,9 @@ export namespace EMacro {
25
25
  const bmf = new BMF();
26
26
  bmf.md5(file, (err, md5) => {
27
27
  if (err !== null) {
28
- rej(err)
28
+ resolve(err)
29
29
  } else {
30
- res(md5)
30
+ reject(md5)
31
31
  }
32
32
  }, progress => {
33
33
  console.log('getFileMD5 progress number:', progress);
@@ -61,7 +61,11 @@ export namespace EMacro {
61
61
  } else {
62
62
  fileChunks.push(file)
63
63
  }
64
- return { "fileChunks": fileChunks, "sliceSize": chunkSize, "chunksLength": fileChunks.length }
64
+ return {
65
+ fileChunks: fileChunks,
66
+ sliceSize: chunkSize,
67
+ chunksLength: fileChunks.length
68
+ }
65
69
  }
66
70
 
67
71
  // 文件上传
@@ -90,19 +94,19 @@ export namespace EMacro {
90
94
  let chunk = fileChunks[Number(index)]
91
95
  const base64 = await File.getBase64(chunk) as string
92
96
  let chunkFile = {
93
- 'chunkIndex': Number(index), // 分片位置
94
- 'chunksLength': chunksLength, // 分片长度
95
- 'sliceSize': sliceSize, // 分片大小
96
- 'chunkSize': chunk.size, // 当前分片实际大小
97
- 'fileSize': file.size, // 文件总大小
98
- 'fileName': file.name, // 文件名
99
- 'lastModifiedDate': file.lastModifiedDate, // 最后修改时间
100
- 'md5': md5,
101
- 'index': i,
102
- 'dataType': 'base64', // 数据的类型
103
- 'directoryName': directoryName, // 数据的类型
104
- 'total': files.length, // 总共文件数
105
- 'data': base64.split(';base64,')[1], // 文件数据
97
+ chunkIndex: Number(index), // 分片位置
98
+ chunksLength: chunksLength, // 分片长度
99
+ sliceSize: sliceSize, // 分片大小
100
+ chunkSize: chunk.size, // 当前分片实际大小
101
+ fileSize: file.size, // 文件总大小
102
+ fileName: file.name, // 文件名
103
+ lastModifiedDate: file.lastModifiedDate, // 最后修改时间
104
+ md5: md5,
105
+ index: i,
106
+ dataType: 'base64', // 数据的类型
107
+ directoryName: directoryName, // 数据的类型
108
+ total: files.length, // 总共文件数
109
+ data: base64.split(';base64,')[1], // 文件数据
106
110
  }
107
111
  await chunkFileHandle(chunkFile)
108
112
  }
@@ -112,7 +116,7 @@ export namespace EMacro {
112
116
  }
113
117
 
114
118
  public static selectFile(options: any = { multiple: true, accept: "*/*" }, isDirectory = false): Promise<FileList | null> {
115
- return new Promise((res: (value: FileList) => void, rej) => {
119
+ return new Promise((resolve: (value: FileList) => void, reject) => {
116
120
  const el = document.createElement("input");
117
121
  el.type = "file";
118
122
  el.accept = options.accept;
@@ -120,13 +124,13 @@ export namespace EMacro {
120
124
  el.multiple = options.multiple;
121
125
  el.addEventListener("change", (_) => {
122
126
  try {
123
- if (el.files === null) {
124
- rej(null);
127
+ if (!el.files) {
128
+ reject(new Error("无法读取文件"));
125
129
  } else {
126
- res(el.files);
130
+ resolve(el.files);
127
131
  }
128
132
  } catch (error) {
129
- rej(error)
133
+ reject(error)
130
134
  }
131
135
  });
132
136
  el.click();
@@ -160,16 +164,16 @@ export namespace EMacro {
160
164
  }
161
165
 
162
166
  public static downloadExcel(workbook, name) {
163
-
167
+
164
168
  /* bookType can be 'xlsx' or 'xlsm' or 'xlsb' */
165
- const wopts:any = { bookType: 'xls', bookSST: false, type: 'binary', cellStyles: true };
169
+ const wopts: any = { bookType: 'xls', bookSST: false, type: 'binary', cellStyles: true };
166
170
 
167
- var wbout = XLSX.write(workbook, wopts);
171
+ const wbout = XLSX.write(workbook, wopts);
168
172
 
169
173
  function s2ab(s) {
170
- var buf = new ArrayBuffer(s.length);
171
- var view = new Uint8Array(buf);
172
- for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
174
+ const buf = new ArrayBuffer(s.length);
175
+ const view = new Uint8Array(buf);
176
+ for (let i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
173
177
  return buf;
174
178
  }
175
179
 
@@ -237,7 +241,7 @@ export namespace EMacro {
237
241
  }
238
242
 
239
243
  // 读取video中某一帧转为图片base64
240
- export const getVideoBase64 = async (url: string, timestamp: number = -1, bufftime: number = 2000) => {
244
+ export const getVideoBase64 = async (url: string, timestamp = -1, bufftime = 2000) => {
241
245
 
242
246
  const scale = await getVideoScale(url) as any;
243
247
  const width = scale[0] + ''
@@ -305,7 +309,7 @@ export namespace EMacro {
305
309
  }
306
310
  }
307
311
 
308
-
312
+
309
313
 
310
314
  }
311
315
 
@@ -214,6 +214,7 @@ class TaskScheduler {
214
214
  task.state = STATE.Error
215
215
  task.onError && task.onError()
216
216
  task.clearTimer()
217
+ task.stop()
217
218
  console.error("task scheduling exception", task);
218
219
  })
219
220
  }
@@ -13,6 +13,7 @@
13
13
  top: 0;
14
14
  left: 0;
15
15
  background-color: red;
16
+
16
17
  }
17
18
 
18
19
  .list {