@minto-ai/tools 1.0.662 → 1.0.663
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.
- package/README.md +337 -1
- package/dist/file/index.d.ts +2 -1
- package/dist/file/single-download-file-base64.d.ts +8 -0
- package/dist/index.js +27 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -327,6 +327,50 @@ console.log(chunkString('abcdefghijklmnopqrstuvwxyz', 3)) // ['abc', 'def', 'gh
|
|
|
327
327
|
console.log(chunkString('abcdefghijklmnopqrstuvwxyz', 5)) // ['abcde', 'fghij', 'klmno', 'pqrst', 'uvwxy', 'z']
|
|
328
328
|
```
|
|
329
329
|
|
|
330
|
+
### `objectToQueryString`
|
|
331
|
+
|
|
332
|
+
> `function objectToQueryString(obj: Record<string, any>): string`
|
|
333
|
+
|
|
334
|
+
将对象转换为 URL 查询字符串,自动进行键值的 URL 编码并以 `key=value` 使用 `&` 连接。
|
|
335
|
+
|
|
336
|
+
#### 参数
|
|
337
|
+
|
|
338
|
+
- `obj (Record<string, any>)`: 需要转换的对象。
|
|
339
|
+
|
|
340
|
+
#### 返回
|
|
341
|
+
|
|
342
|
+
`(string)`: 转换后的查询字符串。
|
|
343
|
+
|
|
344
|
+
#### 例子
|
|
345
|
+
|
|
346
|
+
```typescript
|
|
347
|
+
import { objectToQueryString } from '@minto-ai/tools'
|
|
348
|
+
|
|
349
|
+
objectToQueryString({ a: 1, b: 'x y' }) // 'a=1&b=x%20y'
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
### `queryStringToObject`
|
|
353
|
+
|
|
354
|
+
> `function queryStringToObject(queryString: string): Record<string, any>`
|
|
355
|
+
|
|
356
|
+
将 URL 查询字符串转换为对象,自动对键值进行 URL 解码。
|
|
357
|
+
|
|
358
|
+
#### 参数
|
|
359
|
+
|
|
360
|
+
- `queryString (string)`: 需要解析的查询字符串,例如 `a=1&b=x%20y`。
|
|
361
|
+
|
|
362
|
+
#### 返回
|
|
363
|
+
|
|
364
|
+
`(Record<string, any>)`: 解析后的对象。
|
|
365
|
+
|
|
366
|
+
#### 例子
|
|
367
|
+
|
|
368
|
+
```typescript
|
|
369
|
+
import { queryStringToObject } from '@minto-ai/tools'
|
|
370
|
+
|
|
371
|
+
queryStringToObject('a=1&b=x%20y') // { a: '1', b: 'x y' }
|
|
372
|
+
```
|
|
373
|
+
|
|
330
374
|
## 函数
|
|
331
375
|
|
|
332
376
|
### `throttle`
|
|
@@ -615,6 +659,29 @@ console.log(divide(1.234, 0.567)) // 2.1763668430335097
|
|
|
615
659
|
console.log(divide(100.001, 0.001)) // 100001
|
|
616
660
|
```
|
|
617
661
|
|
|
662
|
+
### `calcAspectRatio`
|
|
663
|
+
|
|
664
|
+
> `function calcAspectRatio(size: [number, number]): [number, number]`
|
|
665
|
+
|
|
666
|
+
计算宽高的最简整数比例,常用于等比缩放或显示比例展示。
|
|
667
|
+
|
|
668
|
+
#### 参数
|
|
669
|
+
|
|
670
|
+
- `size ([number, number])`: 数组形式的宽高值。
|
|
671
|
+
|
|
672
|
+
#### 返回
|
|
673
|
+
|
|
674
|
+
`([number, number])`: 最简整数比例,例如 `[16, 9]`。
|
|
675
|
+
|
|
676
|
+
#### 例子
|
|
677
|
+
|
|
678
|
+
```typescript
|
|
679
|
+
import { calcAspectRatio } from '@minto-ai/tools'
|
|
680
|
+
|
|
681
|
+
calcAspectRatio([1920, 1080]) // [16, 9]
|
|
682
|
+
calcAspectRatio([1280, 800]) // [16, 10]
|
|
683
|
+
```
|
|
684
|
+
|
|
618
685
|
## 浏览器
|
|
619
686
|
|
|
620
687
|
### `copyText`
|
|
@@ -656,6 +723,7 @@ copyText('Hello, World!').then(
|
|
|
656
723
|
|
|
657
724
|
```typescript
|
|
658
725
|
import { isIos } from '@minto-ai/tools'
|
|
726
|
+
|
|
659
727
|
console.log(isIos()) // 输出 true 或 false
|
|
660
728
|
```
|
|
661
729
|
|
|
@@ -673,6 +741,7 @@ console.log(isIos()) // 输出 true 或 false
|
|
|
673
741
|
|
|
674
742
|
```typescript
|
|
675
743
|
import { isAndroid } from '@minto-ai/tools'
|
|
744
|
+
|
|
676
745
|
console.log(isAndroid()) // 输出 true 或 false
|
|
677
746
|
```
|
|
678
747
|
|
|
@@ -690,6 +759,7 @@ console.log(isAndroid()) // 输出 true 或 false
|
|
|
690
759
|
|
|
691
760
|
```typescript
|
|
692
761
|
import { isMobile } from '@minto-ai/tools'
|
|
762
|
+
|
|
693
763
|
console.log(isMobile()) // 输出 true 或 false
|
|
694
764
|
```
|
|
695
765
|
|
|
@@ -707,10 +777,35 @@ console.log(isMobile()) // 输出 true 或 false
|
|
|
707
777
|
|
|
708
778
|
```typescript
|
|
709
779
|
import { isPc } from '@minto-ai/tools'
|
|
780
|
+
|
|
710
781
|
console.log(isPc()) // 输出 true 或 false
|
|
711
782
|
```
|
|
712
783
|
|
|
713
|
-
|
|
784
|
+
### `createAudioPermission`
|
|
785
|
+
|
|
786
|
+
> `function createAudioPermission(): AudioPermission`
|
|
787
|
+
|
|
788
|
+
跨平台音频权限管理器,统一请求音频播放权限与麦克风权限,处理 PC/iOS/Android 在自动播放与权限授权上的差异。
|
|
789
|
+
|
|
790
|
+
#### 返回
|
|
791
|
+
|
|
792
|
+
`(AudioPermission)`: 返回单例的权限管理器,包含 `requestPlaybackPermission()` 与 `requestMicrophonePermission()` 两个方法。
|
|
793
|
+
|
|
794
|
+
#### 例子
|
|
795
|
+
|
|
796
|
+
```typescript
|
|
797
|
+
import { createAudioPermission } from '@minto-ai/tools'
|
|
798
|
+
|
|
799
|
+
const audioPermission = createAudioPermission()
|
|
800
|
+
|
|
801
|
+
// 请求音频播放权限(需在用户交互后调用)
|
|
802
|
+
await audioPermission.requestPlaybackPermission()
|
|
803
|
+
|
|
804
|
+
// 请求麦克风权限
|
|
805
|
+
await audioPermission.requestMicrophonePermission()
|
|
806
|
+
```
|
|
807
|
+
|
|
808
|
+
## 工具
|
|
714
809
|
|
|
715
810
|
### `getUuid`
|
|
716
811
|
|
|
@@ -731,6 +826,29 @@ const uuid = getUuid()
|
|
|
731
826
|
console.log(uuid) // 输出类似于 "1gann4cq9b6r"
|
|
732
827
|
```
|
|
733
828
|
|
|
829
|
+
### `timeDelay`
|
|
830
|
+
|
|
831
|
+
> `function timeDelay(delay: number): Promise<void>`
|
|
832
|
+
|
|
833
|
+
创建一个延迟执行的 Promise,常用于等待动画或节流场景中的异步等待。
|
|
834
|
+
|
|
835
|
+
#### 参数
|
|
836
|
+
|
|
837
|
+
- `delay (number)`: 延迟时间,单位毫秒,必须为非负数。
|
|
838
|
+
|
|
839
|
+
#### 返回
|
|
840
|
+
|
|
841
|
+
`(Promise<void>)`: 在指定时间后解析的 Promise。
|
|
842
|
+
|
|
843
|
+
#### 例子
|
|
844
|
+
|
|
845
|
+
```typescript
|
|
846
|
+
import { timeDelay } from '@minto-ai/tools'
|
|
847
|
+
|
|
848
|
+
await timeDelay(300)
|
|
849
|
+
// 继续后续逻辑
|
|
850
|
+
```
|
|
851
|
+
|
|
734
852
|
## 文件
|
|
735
853
|
|
|
736
854
|
### 枚举
|
|
@@ -806,6 +924,24 @@ console.log(uuid) // 输出类似于 "1gann4cq9b6r"
|
|
|
806
924
|
| `XLS` | `xls` | Excel 工作簿 |
|
|
807
925
|
| `XLSX` | `xlsx` | Excel 工作簿 (XML 格式) |
|
|
808
926
|
|
|
927
|
+
#### `MusicFileSuffixEnum`
|
|
928
|
+
|
|
929
|
+
常见音乐文件后缀的枚举类型。
|
|
930
|
+
|
|
931
|
+
| 枚举键名 | 后缀值 | 说明 |
|
|
932
|
+
| -------- | ------ | ------------ |
|
|
933
|
+
| `MP3` | `mp3` | MP3 音频文件 |
|
|
934
|
+
| `WAV` | `wav` | WAV 音频文件 |
|
|
935
|
+
|
|
936
|
+
#### `CompressFileSuffixEnum`
|
|
937
|
+
|
|
938
|
+
常见压缩文件后缀的枚举类型。
|
|
939
|
+
|
|
940
|
+
| 枚举键名 | 后缀值 | 说明 |
|
|
941
|
+
| -------- | ------ | ------------ |
|
|
942
|
+
| `ZIP` | `zip` | ZIP 压缩文件 |
|
|
943
|
+
| `RAR` | `rar` | RAR 压缩文件 |
|
|
944
|
+
|
|
809
945
|
### 类型
|
|
810
946
|
|
|
811
947
|
#### `FileSuffix`
|
|
@@ -1019,6 +1155,52 @@ console.log(isDocumentFilePath('/path/to/document.docx')) // true
|
|
|
1019
1155
|
console.log(isDocumentFilePath('/path/to/document.doc')) // true
|
|
1020
1156
|
```
|
|
1021
1157
|
|
|
1158
|
+
### `isMusicFilePath`
|
|
1159
|
+
|
|
1160
|
+
> `function isMusicFilePath(filePath: string): boolean`
|
|
1161
|
+
|
|
1162
|
+
判断是否是有效的音乐文件路径。匹配 `MusicFileSuffixEnum` 中的后缀。
|
|
1163
|
+
|
|
1164
|
+
#### 参数
|
|
1165
|
+
|
|
1166
|
+
- `filePath (string)`: 文件路径,例如 `/path/to/audio.mp3`。
|
|
1167
|
+
|
|
1168
|
+
#### 返回
|
|
1169
|
+
|
|
1170
|
+
`(boolean)`: 如果匹配音乐后缀返回 `true`,否则返回 `false`。
|
|
1171
|
+
|
|
1172
|
+
#### 例子
|
|
1173
|
+
|
|
1174
|
+
```typescript
|
|
1175
|
+
import { isMusicFilePath } from '@minto-ai/tools'
|
|
1176
|
+
|
|
1177
|
+
isMusicFilePath('/path/to/audio.mp3') // true
|
|
1178
|
+
isMusicFilePath('/path/to/audio.wav') // true
|
|
1179
|
+
```
|
|
1180
|
+
|
|
1181
|
+
### `isCompressFilePath`
|
|
1182
|
+
|
|
1183
|
+
> `function isCompressFilePath(filePath: string): boolean`
|
|
1184
|
+
|
|
1185
|
+
判断是否是有效的压缩文件路径。匹配 `CompressFileSuffixEnum` 中的后缀。
|
|
1186
|
+
|
|
1187
|
+
#### 参数
|
|
1188
|
+
|
|
1189
|
+
- `filePath (string)`: 文件路径,例如 `/path/to/archive.zip`。
|
|
1190
|
+
|
|
1191
|
+
#### 返回
|
|
1192
|
+
|
|
1193
|
+
`(boolean)`: 如果匹配压缩后缀返回 `true`,否则返回 `false`。
|
|
1194
|
+
|
|
1195
|
+
#### 例子
|
|
1196
|
+
|
|
1197
|
+
```typescript
|
|
1198
|
+
import { isCompressFilePath } from '@minto-ai/tools'
|
|
1199
|
+
|
|
1200
|
+
isCompressFilePath('/path/to/archive.zip') // true
|
|
1201
|
+
isCompressFilePath('/path/to/archive.rar') // true
|
|
1202
|
+
```
|
|
1203
|
+
|
|
1022
1204
|
### `getFileSuffixIcon`
|
|
1023
1205
|
|
|
1024
1206
|
> `function getFileSuffixIcon(fileSuffix: FileSuffix): string`
|
|
@@ -1066,6 +1248,78 @@ console.log(getFileIcon('/path/to/file.pdf')) // 返回 pdfIcon 的路径
|
|
|
1066
1248
|
console.log(getFileIcon('/path/to/file.txt')) // 返回 txtIcon 的路径
|
|
1067
1249
|
```
|
|
1068
1250
|
|
|
1251
|
+
### `getFilePathNotQuery`
|
|
1252
|
+
|
|
1253
|
+
> `function getFilePathNotQuery(filePath: string): string`
|
|
1254
|
+
|
|
1255
|
+
获取不包含查询参数的纯文件路径。
|
|
1256
|
+
|
|
1257
|
+
#### 参数
|
|
1258
|
+
|
|
1259
|
+
- `filePath (string)`: 包含查询参数的文件路径。
|
|
1260
|
+
|
|
1261
|
+
#### 返回
|
|
1262
|
+
|
|
1263
|
+
`(string)`: 纯文件路径。
|
|
1264
|
+
|
|
1265
|
+
#### 例子
|
|
1266
|
+
|
|
1267
|
+
```typescript
|
|
1268
|
+
import { getFilePathNotQuery } from '@minto-ai/tools'
|
|
1269
|
+
|
|
1270
|
+
getFilePathNotQuery('https://a.com/file.pdf?x=1') // 'https://a.com/file.pdf'
|
|
1271
|
+
```
|
|
1272
|
+
|
|
1273
|
+
### `getFileQuery`
|
|
1274
|
+
|
|
1275
|
+
> `function getFileQuery(filePath: string): Record<string, any>`
|
|
1276
|
+
|
|
1277
|
+
从文件路径中解析查询参数并转换为对象。
|
|
1278
|
+
|
|
1279
|
+
#### 参数
|
|
1280
|
+
|
|
1281
|
+
- `filePath (string)`: 包含查询参数的文件路径。
|
|
1282
|
+
|
|
1283
|
+
#### 返回
|
|
1284
|
+
|
|
1285
|
+
`(Record<string, any>)`: 查询参数对象。
|
|
1286
|
+
|
|
1287
|
+
#### 例子
|
|
1288
|
+
|
|
1289
|
+
```typescript
|
|
1290
|
+
import { getFileQuery } from '@minto-ai/tools'
|
|
1291
|
+
|
|
1292
|
+
getFileQuery('https://a.com/file.pdf?x=1&y=2') // { x: '1', y: '2' }
|
|
1293
|
+
```
|
|
1294
|
+
|
|
1295
|
+
### `updateFilePathQuery`
|
|
1296
|
+
|
|
1297
|
+
> `function updateFilePathQuery(filePath: string, objectQuery: Record<string, string>, isAppend?: boolean): string`
|
|
1298
|
+
|
|
1299
|
+
更新文件路径中的查询参数;支持在原有参数上追加或覆盖。
|
|
1300
|
+
|
|
1301
|
+
#### 参数
|
|
1302
|
+
|
|
1303
|
+
- `filePath (string)`: 原始文件路径。
|
|
1304
|
+
- `objectQuery (Record<string, string>)`: 需写入的查询参数对象。
|
|
1305
|
+
- `[isAppend=true] (boolean)`: 是否在原有参数基础上追加,`false` 则覆盖。
|
|
1306
|
+
|
|
1307
|
+
#### 返回
|
|
1308
|
+
|
|
1309
|
+
`(string)`: 更新后的完整文件路径。
|
|
1310
|
+
|
|
1311
|
+
#### 例子
|
|
1312
|
+
|
|
1313
|
+
```typescript
|
|
1314
|
+
import { updateFilePathQuery } from '@minto-ai/tools'
|
|
1315
|
+
|
|
1316
|
+
updateFilePathQuery('https://a.com/file.pdf?x=1', { y: '2' })
|
|
1317
|
+
// 'https://a.com/file.pdf?x=1&y=2'
|
|
1318
|
+
|
|
1319
|
+
updateFilePathQuery('https://a.com/file.pdf?x=1', { y: '2' }, false)
|
|
1320
|
+
// 'https://a.com/file.pdf?y=2'
|
|
1321
|
+
```
|
|
1322
|
+
|
|
1069
1323
|
### `singleDownloadFile`
|
|
1070
1324
|
|
|
1071
1325
|
> `function singleDownloadFile(filePath: string, fileName?: string): Promise<void>`
|
|
@@ -1122,6 +1376,88 @@ const fileList = [
|
|
|
1122
1376
|
batchDownloadFile(fileList, 'my-files.zip')
|
|
1123
1377
|
```
|
|
1124
1378
|
|
|
1379
|
+
## 校验
|
|
1380
|
+
|
|
1381
|
+
### `isValidUrl`
|
|
1382
|
+
|
|
1383
|
+
> `function isValidUrl(url: string): boolean`
|
|
1384
|
+
|
|
1385
|
+
校验是否为合法的 HTTP/HTTPS 网页地址,支持域名、IP、端口、路径、查询、哈希等组合。
|
|
1386
|
+
|
|
1387
|
+
#### 参数
|
|
1388
|
+
|
|
1389
|
+
- `url (string)`: 需要校验的地址字符串。
|
|
1390
|
+
|
|
1391
|
+
#### 返回
|
|
1392
|
+
|
|
1393
|
+
`(boolean)`: 合法返回 `true`,否则返回 `false`。
|
|
1394
|
+
|
|
1395
|
+
#### 例子
|
|
1396
|
+
|
|
1397
|
+
```typescript
|
|
1398
|
+
import { isValidUrl } from '@minto-ai/tools'
|
|
1399
|
+
|
|
1400
|
+
isValidUrl('https://example.com?a=1#hash') // true
|
|
1401
|
+
isValidUrl('ftp://example.com') // false
|
|
1402
|
+
```
|
|
1403
|
+
|
|
1404
|
+
## 主题
|
|
1405
|
+
|
|
1406
|
+
### `useTheme`
|
|
1407
|
+
|
|
1408
|
+
> `function useTheme(): { theme: Ref<Theme>; isDark: ComputedRef<boolean>; isLight: ComputedRef<boolean>; setTheme: (theme?: Theme) => void; getTheme: () => Theme; setLight: () => void; setDark: () => void; toggleTheme: () => void }`
|
|
1409
|
+
|
|
1410
|
+
Vue 主题切换 Hook,支持亮色/暗黑模式切换与状态读取,并自动将主题类名应用到 `html` 根元素。
|
|
1411
|
+
|
|
1412
|
+
#### 返回
|
|
1413
|
+
|
|
1414
|
+
`({ theme, isDark, isLight, setTheme, getTheme, setLight, setDark, toggleTheme })`: 主题状态与操作方法。
|
|
1415
|
+
|
|
1416
|
+
#### 例子
|
|
1417
|
+
|
|
1418
|
+
```typescript
|
|
1419
|
+
import { useTheme } from '@minto-ai/tools'
|
|
1420
|
+
|
|
1421
|
+
const { theme, isDark, setDark, toggleTheme } = useTheme()
|
|
1422
|
+
|
|
1423
|
+
setDark()
|
|
1424
|
+
toggleTheme()
|
|
1425
|
+
```
|
|
1426
|
+
|
|
1427
|
+
## 国际化
|
|
1428
|
+
|
|
1429
|
+
### `locale`
|
|
1430
|
+
|
|
1431
|
+
> `function locale(locale: 'zh-cn' | 'zh-tw' | 'en' | 'ms' | 'ar' | 'th' | 'vi'): void`
|
|
1432
|
+
|
|
1433
|
+
设置当前语言,内置中文简体/繁体、英文、马来语、阿拉伯语、泰语、越南语,并自动在包初始化时注册多语言文案。
|
|
1434
|
+
|
|
1435
|
+
#### 参数
|
|
1436
|
+
|
|
1437
|
+
- `locale`: 语言代码。
|
|
1438
|
+
|
|
1439
|
+
#### 例子
|
|
1440
|
+
|
|
1441
|
+
```typescript
|
|
1442
|
+
import tools from '@minto-ai/tools'
|
|
1443
|
+
|
|
1444
|
+
tools.locale('zh-cn')
|
|
1445
|
+
```
|
|
1446
|
+
|
|
1447
|
+
### `getLocale`
|
|
1448
|
+
|
|
1449
|
+
> `function getLocale(): 'zh-cn' | 'zh-tw' | 'en' | 'ms' | 'ar' | 'th' | 'vi'`
|
|
1450
|
+
|
|
1451
|
+
获取当前语言代码。
|
|
1452
|
+
|
|
1453
|
+
#### 例子
|
|
1454
|
+
|
|
1455
|
+
```typescript
|
|
1456
|
+
import tools from '@minto-ai/tools'
|
|
1457
|
+
|
|
1458
|
+
tools.getLocale() // 'zh-cn'
|
|
1459
|
+
```
|
|
1460
|
+
|
|
1125
1461
|
## webSocket
|
|
1126
1462
|
|
|
1127
1463
|
### `isWebSocketSupported`
|
package/dist/file/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ import { default as isMusicFilePath } from './is-music-file-path';
|
|
|
16
16
|
import { default as isPptFilePath } from './is-ppt-file-path';
|
|
17
17
|
import { default as isVideoFilePath } from './is-video-file-path';
|
|
18
18
|
import { default as singleDownloadFile } from './single-download-file';
|
|
19
|
+
import { default as singleDownloadFileBase64 } from './single-download-file-base64';
|
|
19
20
|
import { default as updateFilePathQuery } from './update-file-path-query';
|
|
20
21
|
export type { CompressFileSuffix, DocumentFileSuffix, FileSuffix, ImageFileSuffix, MusicFileSuffix, PptFileSuffix, VideoFileSuffix, };
|
|
21
|
-
export { batchDownloadFile, CompressFileSuffixEnum, DocumentFileSuffixEnum, FileSuffixEnum, getFileIcon, getFileName, getFilePathNotQuery, getFileQuery, getFileSuffix, getFileSuffixIcon, getFileTitle, ImageFileSuffixEnum, isCompressFilePath, isDocumentFilePath, isFilePath, isImageFilePath, isMusicFilePath, isPptFilePath, isVideoFilePath, MusicFileSuffixEnum, PptFileSuffixEnum, singleDownloadFile, updateFilePathQuery, VideoFileSuffixEnum, };
|
|
22
|
+
export { batchDownloadFile, CompressFileSuffixEnum, DocumentFileSuffixEnum, FileSuffixEnum, getFileIcon, getFileName, getFilePathNotQuery, getFileQuery, getFileSuffix, getFileSuffixIcon, getFileTitle, ImageFileSuffixEnum, isCompressFilePath, isDocumentFilePath, isFilePath, isImageFilePath, isMusicFilePath, isPptFilePath, isVideoFilePath, MusicFileSuffixEnum, PptFileSuffixEnum, singleDownloadFile, singleDownloadFileBase64, updateFilePathQuery, VideoFileSuffixEnum, };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 下载 base64 图片或文件
|
|
3
|
+
* @param base64Data - base64 data URL (如: data:image/png;base64,...)
|
|
4
|
+
* @param fileName - 保存的文件名和扩展名
|
|
5
|
+
* @returns Promise<void>
|
|
6
|
+
*/
|
|
7
|
+
declare function downloadBase64File(base64Data: string, fileName: string): Promise<void>;
|
|
8
|
+
export default downloadBase64File;
|
package/dist/index.js
CHANGED
|
@@ -12094,7 +12094,7 @@ if (!USE_NATIVE_URL$1 && isCallable(Headers)) {
|
|
|
12094
12094
|
dontCallGetSet: true,
|
|
12095
12095
|
forced: true
|
|
12096
12096
|
}, {
|
|
12097
|
-
fetch: function
|
|
12097
|
+
fetch: function fetch2(input) {
|
|
12098
12098
|
return nativeFetch(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {});
|
|
12099
12099
|
}
|
|
12100
12100
|
});
|
|
@@ -14154,6 +14154,31 @@ function _singleDownloadFile() {
|
|
|
14154
14154
|
}));
|
|
14155
14155
|
return _singleDownloadFile.apply(this, arguments);
|
|
14156
14156
|
}
|
|
14157
|
+
function downloadBase64File(_x, _x2) {
|
|
14158
|
+
return _downloadBase64File.apply(this, arguments);
|
|
14159
|
+
}
|
|
14160
|
+
function _downloadBase64File() {
|
|
14161
|
+
_downloadBase64File = _asyncToGenerator(/* @__PURE__ */ _regenerator().m(function _callee(base64Data, fileName) {
|
|
14162
|
+
var response, blob;
|
|
14163
|
+
return _regenerator().w(function(_context) {
|
|
14164
|
+
while (1) switch (_context.n) {
|
|
14165
|
+
case 0:
|
|
14166
|
+
_context.n = 1;
|
|
14167
|
+
return fetch(base64Data);
|
|
14168
|
+
case 1:
|
|
14169
|
+
response = _context.v;
|
|
14170
|
+
_context.n = 2;
|
|
14171
|
+
return response.blob();
|
|
14172
|
+
case 2:
|
|
14173
|
+
blob = _context.v;
|
|
14174
|
+
FileSaver.saveAs(blob, fileName);
|
|
14175
|
+
case 3:
|
|
14176
|
+
return _context.a(2);
|
|
14177
|
+
}
|
|
14178
|
+
}, _callee);
|
|
14179
|
+
}));
|
|
14180
|
+
return _downloadBase64File.apply(this, arguments);
|
|
14181
|
+
}
|
|
14157
14182
|
function debounce(callback, delay) {
|
|
14158
14183
|
var timerId = null;
|
|
14159
14184
|
function debouncedFunction() {
|
|
@@ -16728,6 +16753,7 @@ export {
|
|
|
16728
16753
|
pickObject,
|
|
16729
16754
|
queryStringToObject,
|
|
16730
16755
|
singleDownloadFile,
|
|
16756
|
+
downloadBase64File as singleDownloadFileBase64,
|
|
16731
16757
|
subtract,
|
|
16732
16758
|
throttle,
|
|
16733
16759
|
timeDelay,
|