emacroh5lib 1.0.87 → 1.0.89

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.89",
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';
@@ -10,303 +10,316 @@ import createTaskQueue from 'sync-task-queue'
10
10
 
11
11
  import { saveAs } from 'file-saver';
12
12
 
13
- export namespace EMacro {
14
-
15
- export const version = "1.72"
13
+ const version = "1.73"
16
14
 
17
- export class File {
15
+ class File {
18
16
 
19
- public static getFileMD5(file) {
20
- return new Promise((res, rej) => {
17
+ public static getFileMD5(file) {
18
+ return new Promise((resolve, reject) => {
21
19
 
22
- const fileReader = new FileReader()
23
- fileReader.readAsBinaryString(file);
24
- fileReader.onload = e => {
25
- const bmf = new BMF();
26
- bmf.md5(file, (err, md5) => {
27
- if (err !== null) {
28
- rej(err)
29
- } else {
30
- res(md5)
31
- }
32
- }, progress => {
33
- console.log('getFileMD5 progress number:', progress);
34
- });
35
- }
20
+ const fileReader = new FileReader()
21
+ fileReader.readAsBinaryString(file);
22
+ fileReader.onload = e => {
23
+ const bmf = new BMF();
24
+ bmf.md5(file, (err, md5) => {
25
+ if (err !== null) {
26
+ resolve(err)
27
+ } else {
28
+ reject(md5)
29
+ }
30
+ }, progress => {
31
+ console.log('getFileMD5 progress number:', progress);
32
+ });
33
+ }
36
34
 
37
- })
38
- }
35
+ })
36
+ }
39
37
 
40
- private static getBase64(blob) {
41
- return new Promise((resolve, reject) => {
42
- const reader = new FileReader();
43
- reader.readAsDataURL(blob);
44
- reader.onload = () => resolve(reader.result);
45
- reader.onerror = error => reject(error);
46
- });
47
- }
38
+ private static getBase64(blob) {
39
+ return new Promise((resolve, reject) => {
40
+ const reader = new FileReader();
41
+ reader.readAsDataURL(blob);
42
+ reader.onload = () => resolve(reader.result);
43
+ reader.onerror = error => reject(error);
44
+ });
45
+ }
48
46
 
49
- public static getFileChunks(file: any, chunkSize: number = 1024 * 1024 * 1): any {
50
-
51
- let { size } = file
52
- let totalChunks = Math.ceil(size / chunkSize)
53
- let fileChunks = new Array<any>()
54
- if (size > chunkSize) {
55
- for (let i = 0; i < totalChunks; i++) {
56
- let start = i * chunkSize
57
- let end = (i + 1) * chunkSize
58
- let chunk = file.slice(start, end)
59
- fileChunks.push(chunk)
60
- }
61
- } else {
62
- fileChunks.push(file)
47
+ public static getFileChunks(file: any, chunkSize: number = 1024 * 1024 * 1): any {
48
+
49
+ let { size } = file
50
+ let totalChunks = Math.ceil(size / chunkSize)
51
+ let fileChunks = new Array<any>()
52
+ if (size > chunkSize) {
53
+ for (let i = 0; i < totalChunks; i++) {
54
+ let start = i * chunkSize
55
+ let end = (i + 1) * chunkSize
56
+ let chunk = file.slice(start, end)
57
+ fileChunks.push(chunk)
63
58
  }
64
- return { "fileChunks": fileChunks, "sliceSize": chunkSize, "chunksLength": fileChunks.length }
59
+ } else {
60
+ fileChunks.push(file)
65
61
  }
62
+ return {
63
+ fileChunks: fileChunks,
64
+ sliceSize: chunkSize,
65
+ chunksLength: fileChunks.length
66
+ }
67
+ }
66
68
 
67
- // 文件上传
68
- public static async uploadFiles(files, chunkFileHandle, fileComplete = (file) => { }, completeHandle = (files) => { }, chunkSize: number = 1024 * 1024 * 1) {
69
+ // 文件上传
70
+ public static async uploadFiles(files, chunkFileHandle, fileComplete = (file) => { }, completeHandle = (files) => { }, chunkSize: number = 1024 * 1024 * 1) {
69
71
 
70
- if (files[0].fileName == "" || files[0].fileSize == "" || files[0].fileSize == 0) {
71
- throw new Error("文件异常")
72
- }
72
+ if (files[0].fileName == "" || files[0].fileSize == "" || files[0].fileSize == 0) {
73
+ throw new Error("文件异常")
74
+ }
73
75
 
74
- for (let i = 0; i < files.length; i++) {
75
- const file = files[i];
76
- const md5 = await File.getFileMD5(file)
76
+ for (let i = 0; i < files.length; i++) {
77
+ const file = files[i];
78
+ const md5 = await File.getFileMD5(file)
77
79
 
78
- let { fileChunks, sliceSize, chunksLength } = File.getFileChunks(file, chunkSize)
80
+ let { fileChunks, sliceSize, chunksLength } = File.getFileChunks(file, chunkSize)
79
81
 
80
- let directoryName = "";
81
- if (files[i].webkitRelativePath != null && files[i].webkitRelativePath.trim() != "") {
82
- let n = files[i].webkitRelativePath.lastIndexOf("\\")
83
- if (n == -1)
84
- n = files[i].webkitRelativePath.lastIndexOf("/")
85
- if (n != -1)
86
- directoryName = files[i].webkitRelativePath.substring(0, n)
87
- }
82
+ let directoryName = "";
83
+ if (files[i].webkitRelativePath != null && files[i].webkitRelativePath.trim() != "") {
84
+ let n = files[i].webkitRelativePath.lastIndexOf("\\")
85
+ if (n == -1)
86
+ n = files[i].webkitRelativePath.lastIndexOf("/")
87
+ if (n != -1)
88
+ directoryName = files[i].webkitRelativePath.substring(0, n)
89
+ }
88
90
 
89
- for (let index in fileChunks) {
90
- let chunk = fileChunks[Number(index)]
91
- const base64 = await File.getBase64(chunk) as string
92
- 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], // 文件数据
106
- }
107
- await chunkFileHandle(chunkFile)
91
+ for (let index in fileChunks) {
92
+ let chunk = fileChunks[Number(index)]
93
+ const base64 = await File.getBase64(chunk) as string
94
+ let chunkFile = {
95
+ chunkIndex: Number(index), // 分片位置
96
+ chunksLength: chunksLength, // 分片长度
97
+ sliceSize: sliceSize, // 分片大小
98
+ chunkSize: chunk.size, // 当前分片实际大小
99
+ fileSize: file.size, // 文件总大小
100
+ fileName: file.name, // 文件名
101
+ lastModifiedDate: file.lastModifiedDate, // 最后修改时间
102
+ md5: md5,
103
+ index: i,
104
+ dataType: 'base64', // 数据的类型
105
+ directoryName: directoryName, // 数据的类型
106
+ total: files.length, // 总共文件数
107
+ data: base64.split(';base64,')[1], // 文件数据
108
108
  }
109
- fileComplete(file);
109
+ await chunkFileHandle(chunkFile)
110
110
  }
111
- completeHandle(files)
111
+ fileComplete(file);
112
112
  }
113
+ completeHandle(files)
114
+ }
113
115
 
114
- public static selectFile(options: any = { multiple: true, accept: "*/*" }, isDirectory = false): Promise<FileList | null> {
115
- return new Promise((res: (value: FileList) => void, rej) => {
116
- const el = document.createElement("input");
117
- el.type = "file";
118
- el.accept = options.accept;
119
- el.webkitdirectory = isDirectory;
120
- el.multiple = options.multiple;
121
- el.addEventListener("change", (_) => {
122
- try {
123
- if (el.files === null) {
124
- rej(null);
125
- } else {
126
- res(el.files);
127
- }
128
- } catch (error) {
129
- rej(error)
116
+ public static selectFile(options: any = { multiple: true, accept: "*/*" }, isDirectory = false): Promise<FileList | null> {
117
+ return new Promise((resolve: (value: FileList) => void, reject) => {
118
+ const el = document.createElement("input");
119
+ el.type = "file";
120
+ el.accept = options.accept;
121
+ el.webkitdirectory = isDirectory;
122
+ el.multiple = options.multiple;
123
+ el.addEventListener("change", (_) => {
124
+ try {
125
+ if (!el.files) {
126
+ reject(new Error("无法读取文件"));
127
+ } else {
128
+ resolve(el.files);
130
129
  }
131
- });
132
- el.click();
130
+ } catch (error) {
131
+ reject(error)
132
+ }
133
133
  });
134
- }
134
+ el.click();
135
+ });
136
+ }
135
137
 
136
- public static readLocalExcel(onloadend: (file, workbook) => void, options: any = { multiple: true, accept: "*/*" }) {
138
+ public static readLocalExcel(onloadend: (file, workbook) => void, options: any = { multiple: true, accept: "*/*" }) {
137
139
 
138
- this.selectFile(options).then((files: FileList | null) => {
139
- if (files === null) {
140
- return
141
- }
142
- for (let i = 0; i < files.length; i++) {
143
- const file = files[i];
144
- let reader = new FileReader();
145
- reader.readAsArrayBuffer(file);
146
- reader.onloadend = async function (e: any) {
147
- let workbook = XLSX.read(e.target.result, { type: "binary" });
148
- onloadend(file, workbook);
149
- }
140
+ this.selectFile(options).then((files: FileList | null) => {
141
+ if (files === null) {
142
+ return
143
+ }
144
+ for (let i = 0; i < files.length; i++) {
145
+ const file = files[i];
146
+ let reader = new FileReader();
147
+ reader.readAsArrayBuffer(file);
148
+ reader.onloadend = async function (e: any) {
149
+ let workbook = XLSX.read(e.target.result, { type: "binary" });
150
+ onloadend(file, workbook);
150
151
  }
151
- }).catch(e => {
152
- throw e;
153
- })
154
- }
155
-
156
- // type: 'base64' | 'binary' | 'buffer' | 'file' | 'array' | 'string'
157
- public static toExcel(data, type) {
158
- let workbook = XLSX.read(data, { type: type });
159
- return workbook;
160
- }
152
+ }
153
+ }).catch(e => {
154
+ throw e;
155
+ })
156
+ }
161
157
 
162
- public static downloadExcel(workbook, name) {
163
-
164
- /* bookType can be 'xlsx' or 'xlsm' or 'xlsb' */
165
- const wopts:any = { bookType: 'xls', bookSST: false, type: 'binary', cellStyles: true };
158
+ // type: 'base64' | 'binary' | 'buffer' | 'file' | 'array' | 'string'
159
+ public static toExcel(data, type) {
160
+ let workbook = XLSX.read(data, { type: type });
161
+ return workbook;
162
+ }
166
163
 
167
- var wbout = XLSX.write(workbook, wopts);
164
+ public static downloadExcel(workbook, name) {
168
165
 
169
- 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;
173
- return buf;
174
- }
166
+ /* bookType can be 'xlsx' or 'xlsm' or 'xlsb' */
167
+ const wopts: any = { bookType: 'xls', bookSST: false, type: 'binary', cellStyles: true };
175
168
 
176
- /* the saveAs call downloads a file on the local machine */
177
- saveAs(new Blob([s2ab(wbout)], { type: 'application/octet-stream' }), name)
169
+ const wbout = XLSX.write(workbook, wopts);
178
170
 
171
+ function s2ab(s) {
172
+ const buf = new ArrayBuffer(s.length);
173
+ const view = new Uint8Array(buf);
174
+ for (let i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
175
+ return buf;
179
176
  }
180
177
 
178
+ /* the saveAs call downloads a file on the local machine */
179
+ saveAs(new Blob([s2ab(wbout)], { type: 'application/octet-stream' }), name)
180
+
181
181
  }
182
182
 
183
- export const fullScreen = (docElm: any = null) => {
184
- if (docElm === null) {
185
- docElm = document.documentElement
186
- }
187
- if (docElm.requestFullscreen) {
188
- docElm.requestFullscreen();
189
- } else if (docElm.mozRequestFullScreen) {
190
- docElm.mozRequestFullScreen();
191
- } else if (docElm.msRequestFullscreen) {
192
- docElm.msRequestFullscreen();
193
- } else if (docElm.oRequestFullscreen) {
194
- docElm.oRequestFullscreen();
195
- } else if (docElm.webkitRequestFullScreen) {
196
- docElm.webkitRequestFullScreen();
197
- }
183
+ }
184
+
185
+
186
+ const fullScreen = (docElm: any = null) => {
187
+ if (docElm === null) {
188
+ docElm = document.documentElement
198
189
  }
190
+ if (docElm.requestFullscreen) {
191
+ docElm.requestFullscreen();
192
+ } else if (docElm.mozRequestFullScreen) {
193
+ docElm.mozRequestFullScreen();
194
+ } else if (docElm.msRequestFullscreen) {
195
+ docElm.msRequestFullscreen();
196
+ } else if (docElm.oRequestFullscreen) {
197
+ docElm.oRequestFullscreen();
198
+ } else if (docElm.webkitRequestFullScreen) {
199
+ docElm.webkitRequestFullScreen();
200
+ }
201
+ }
199
202
 
200
- // 获取最大公约数
201
- function getGcd(a, b) {
202
- let n1, n2;
203
- if (a > b) {
204
- n1 = a;
205
- n2 = b;
206
- } else {
207
- n1 = b;
208
- n2 = a;
209
- }
203
+ // 获取最大公约数
204
+ function getGcd(a, b) {
205
+ let n1, n2;
206
+ if (a > b) {
207
+ n1 = a;
208
+ n2 = b;
209
+ } else {
210
+ n1 = b;
211
+ n2 = a;
212
+ }
210
213
 
211
- let remainder = n1 % n2;
212
- if (remainder === 0) {
213
- return n2;
214
- } else {
215
- return getGcd(n2, remainder)
216
- }
214
+ let remainder = n1 % n2;
215
+ if (remainder === 0) {
216
+ return n2;
217
+ } else {
218
+ return getGcd(n2, remainder)
217
219
  }
220
+ }
218
221
 
219
- export const getVideoScale = async (url: string) => {
220
- const video = document.createElement('video');
221
- video.setAttribute("width", "10");
222
- video.setAttribute("height", "10");
223
- video.setAttribute("style", "position: absolute;opacity: 0;z-index: -5;top: 0;");
224
- video.setAttribute("src", url);
222
+ const getVideoScale = async (url: string) => {
223
+ const video = document.createElement('video');
224
+ video.setAttribute("width", "10");
225
+ video.setAttribute("height", "10");
226
+ video.setAttribute("style", "position: absolute;opacity: 0;z-index: -5;top: 0;");
227
+ video.setAttribute("src", url);
225
228
 
226
- document.body.appendChild(video);
229
+ document.body.appendChild(video);
227
230
 
228
- const p = new Promise(function (resolve, reject) {
229
- video.addEventListener('canplay', function (e: any) {
230
- const gcd = getGcd(e.target.videoWidth, e.target.videoHeight);
231
- resolve([e.target.videoWidth / gcd, e.target.videoHeight / gcd])
232
- })
231
+ const p = new Promise(function (resolve, reject) {
232
+ video.addEventListener('canplay', function (e: any) {
233
+ const gcd = getGcd(e.target.videoWidth, e.target.videoHeight);
234
+ resolve([e.target.videoWidth / gcd, e.target.videoHeight / gcd])
233
235
  })
234
- const res = await p;
235
- document.body.removeChild(video);
236
- return res
237
- }
236
+ })
237
+ const res = await p;
238
+ document.body.removeChild(video);
239
+ return res
240
+ }
241
+
242
+ // 读取video中某一帧转为图片base64
243
+ const getVideoBase64 = async (url: string, timestamp = -1, bufftime = 2000) => {
244
+
245
+ const scale = await getVideoScale(url) as any;
246
+ const width = scale[0] + ''
247
+ const height = scale[1] + ''
248
+ const base64 = await new Promise(function (resolve) {
249
+ let dataURL = ''
250
+ let video = document.createElement('video')
251
+ video.setAttribute('crossOrigin', 'anonymous') //处理跨域
252
+ video.setAttribute('src', url)
253
+ video.setAttribute('width', width)
254
+ video.setAttribute('height', height)
255
+ video.setAttribute('autoplay', 'autoplay')
256
+ document.body.appendChild(video)
257
+ video.addEventListener('loadeddata', function () {
258
+
259
+ video.pause()
260
+
261
+ if (timestamp === -1) {
262
+ timestamp = Math.random() * video.duration
263
+ }
264
+ video.currentTime = timestamp
265
+
266
+ /*
267
+ 使用定时器为了视频跳转到某一帧的时候视频进行缓冲,等视频加载完成之后进行截图
268
+ 如果截图是黑屏说明视频未加载完成就开始截屏了
269
+ */
270
+ setTimeout(() => {
271
+ let canvas = document.createElement('canvas');
272
+ // const width = canvas.width; //canvas的尺寸和图片一样
273
+ // const height = canvas.height;
274
+ canvas.width = video.width
275
+ canvas.height = video.height
276
+ canvas.getContext('2d')!.drawImage(video, 0, 0, video.width, video.height) //绘制canvas
277
+ dataURL = canvas.toDataURL('image/jpeg') //转换为base64
278
+ document.body.removeChild(video)
279
+ resolve(dataURL)
280
+ }, bufftime);
238
281
 
239
- // 读取video中某一帧转为图片base64
240
- export const getVideoBase64 = async (url: string, timestamp: number = -1, bufftime: number = 2000) => {
241
-
242
- const scale = await getVideoScale(url) as any;
243
- const width = scale[0] + ''
244
- const height = scale[1] + ''
245
- const base64 = await new Promise(function (resolve) {
246
- let dataURL = ''
247
- let video = document.createElement('video')
248
- video.setAttribute('crossOrigin', 'anonymous') //处理跨域
249
- video.setAttribute('src', url)
250
- video.setAttribute('width', width)
251
- video.setAttribute('height', height)
252
- video.setAttribute('autoplay', 'autoplay')
253
- document.body.appendChild(video)
254
- video.addEventListener('loadeddata', function () {
255
-
256
- video.pause()
257
-
258
- if (timestamp === -1) {
259
- timestamp = Math.random() * video.duration
260
- }
261
- video.currentTime = timestamp
262
-
263
- /*
264
- 使用定时器为了视频跳转到某一帧的时候视频进行缓冲,等视频加载完成之后进行截图
265
- 如果截图是黑屏说明视频未加载完成就开始截屏了
266
- */
267
- setTimeout(() => {
268
- let canvas = document.createElement('canvas');
269
- // const width = canvas.width; //canvas的尺寸和图片一样
270
- // const height = canvas.height;
271
- canvas.width = video.width
272
- canvas.height = video.height
273
- canvas.getContext('2d')!.drawImage(video, 0, 0, video.width, video.height) //绘制canvas
274
- dataURL = canvas.toDataURL('image/jpeg') //转换为base64
275
- document.body.removeChild(video)
276
- resolve(dataURL)
277
- }, bufftime);
278
-
279
- })
280
282
  })
283
+ })
281
284
 
282
- return base64;
283
- }
285
+ return base64;
286
+ }
284
287
 
285
- export function getType(values) {
286
- return Object
287
- .prototype
288
- .toString
289
- .call(values)
290
- .replace(/\[(\S+) (\S+)\]/, '$2')
291
- }
288
+ function getType(values) {
289
+ return Object
290
+ .prototype
291
+ .toString
292
+ .call(values)
293
+ .replace(/\[(\S+) (\S+)\]/, '$2')
294
+ }
292
295
 
293
- export const extensionToLowerCase = (fileName: string) => {
294
- const n = fileName.lastIndexOf(".");
295
- const extension = fileName.substring(n).toLowerCase();
296
- return fileName.substring(0, n) + extension;
297
- }
296
+ const extensionToLowerCase = (fileName: string) => {
297
+ const n = fileName.lastIndexOf(".");
298
+ const extension = fileName.substring(n).toLowerCase();
299
+ return fileName.substring(0, n) + extension;
300
+ }
298
301
 
299
- export const isURL = (strUrl) => {
300
- const regular = /^\b(((https?|ftp):\/\/)?[-a-z0-9]+(\.[-a-z0-9]+)*\.(?:com|edu|gov|int|mil|net|org|biz|info|name|museum|asia|coop|aero|[a-z][a-z]|((25[0-5])|(2[0-4]\d)|(1\d\d)|([1-9]\d)|\d))\b(\/[-a-z0-9_:\@&?=+,.!\/~%\$]*)?)$/i;
301
- if (regular.test(strUrl.trim())) {
302
- return true;
303
- } else {
304
- return false;
305
- }
302
+ const isURL = (strUrl) => {
303
+ const regular = /^\b(((https?|ftp):\/\/)?[-a-z0-9]+(\.[-a-z0-9]+)*\.(?:com|edu|gov|int|mil|net|org|biz|info|name|museum|asia|coop|aero|[a-z][a-z]|((25[0-5])|(2[0-4]\d)|(1\d\d)|([1-9]\d)|\d))\b(\/[-a-z0-9_:\\@&?=+,.!\\/~%\\$]*)?)$/i;
304
+ if (regular.test(strUrl.trim())) {
305
+ return true;
306
+ } else {
307
+ return false;
306
308
  }
309
+ }
310
+
307
311
 
308
-
312
+ export const EMacro = {
309
313
 
314
+ version,
315
+ File,
316
+ fullScreen,
317
+ getGcd,
318
+ getVideoScale,
319
+ getVideoBase64,
320
+ getType,
321
+ extensionToLowerCase,
322
+ isURL
310
323
  }
311
324
 
312
325