@univerjs-pro/sheets-exchange-client 0.2.5 → 0.2.7
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/lib/cjs/index.js +1 -2
- package/lib/es/index.js +1 -2
- package/lib/types/commands/operations/exchange.operation.d.ts +0 -2
- package/lib/types/controllers/exchange.controller.d.ts +3 -9
- package/lib/types/controllers/menu.d.ts +0 -2
- package/lib/types/index.d.ts +1 -9
- package/lib/types/plugin.d.ts +2 -3
- package/lib/umd/index.js +1 -2
- package/package.json +18 -26
- package/lib/index.css +0 -1
- package/lib/locale/en-US.json +0 -24
- package/lib/locale/ru-RU.json +0 -24
- package/lib/locale/vi-VN.json +0 -24
- package/lib/locale/zh-CN.json +0 -24
- package/lib/locale/zh-TW.json +0 -24
- package/lib/types/locale/en-US.d.ts +0 -4
- package/lib/types/locale/ru-RU.d.ts +0 -4
- package/lib/types/locale/vi-VN.d.ts +0 -4
- package/lib/types/locale/zh-CN.d.ts +0 -25
- package/lib/types/locale/zh-TW.d.ts +0 -4
- package/lib/types/services/exchange.service.d.ts +0 -70
- package/lib/types/services/operate.service.d.ts +0 -65
- package/lib/types/services/request.service.d.ts +0 -99
- package/lib/types/services/upload-notification.service.d.ts +0 -53
- package/lib/types/services/upload-progress.service.d.ts +0 -5
- package/lib/types/services/utils/file-dropper.d.ts +0 -11
- package/lib/types/services/utils/modal.d.ts +0 -7
- package/lib/types/services/utils/snapshot.d.ts +0 -62
- package/lib/types/services/utils/tool.d.ts +0 -17
- package/lib/types/views/UploadNotificationContainer.d.ts +0 -3
- package/lib/types/views/link-list/LinkList.d.ts +0 -7
- package/lib/types/views/upload-again/UploadAgain.d.ts +0 -3
- package/lib/types/views/upload-button/UploadButton.d.ts +0 -8
- package/lib/types/views/upload-error/UploadError.d.ts +0 -3
- package/lib/types/views/upload-notification/UploadNotification.d.ts +0 -3
- package/lib/types/views/upload-success/UploadSuccess.d.ts +0 -6
- package/lib/types/views/uploading/Uploading.d.ts +0 -3
- package/lib/types/views/uploading/upload-cancel/UploadCancel.d.ts +0 -3
- package/lib/types/views/uploading/upload-progress/UploadProgress.d.ts +0 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs-pro/sheets-exchange-client",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -28,8 +28,7 @@
|
|
|
28
28
|
"require": "./lib/cjs/*",
|
|
29
29
|
"types": "./lib/types/index.d.ts"
|
|
30
30
|
},
|
|
31
|
-
"./lib/*": "./lib/*"
|
|
32
|
-
"./locale/*": "./lib/locale/*.json"
|
|
31
|
+
"./lib/*": "./lib/*"
|
|
33
32
|
},
|
|
34
33
|
"main": "./lib/cjs/index.js",
|
|
35
34
|
"module": "./lib/es/index.js",
|
|
@@ -44,31 +43,25 @@
|
|
|
44
43
|
"lib"
|
|
45
44
|
],
|
|
46
45
|
"peerDependencies": {
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"@univerjs/
|
|
50
|
-
"@univerjs/
|
|
51
|
-
"@univerjs/
|
|
52
|
-
"@univerjs/sheets": "0.2.5",
|
|
53
|
-
"@univerjs/sheets-ui": "0.2.5",
|
|
54
|
-
"@univerjs/ui": "0.2.5"
|
|
46
|
+
"@univerjs-pro/exchange-client": "0.2.7",
|
|
47
|
+
"@univerjs/sheets": "0.2.7",
|
|
48
|
+
"@univerjs/ui": "0.2.7",
|
|
49
|
+
"@univerjs/sheets-ui": "0.2.7",
|
|
50
|
+
"@univerjs/core": "0.2.7"
|
|
55
51
|
},
|
|
56
52
|
"dependencies": {
|
|
57
|
-
"@univerjs/icons": "^0.1.
|
|
58
|
-
"@univerjs/protocol": "0.1.
|
|
59
|
-
"@univerjs/sheets": "0.2.
|
|
60
|
-
"@univerjs/sheets
|
|
53
|
+
"@univerjs/icons": "^0.1.72",
|
|
54
|
+
"@univerjs/protocol": "0.1.39-alpha.1",
|
|
55
|
+
"@univerjs/sheets-ui": "0.2.7",
|
|
56
|
+
"@univerjs/sheets": "0.2.7"
|
|
61
57
|
},
|
|
62
58
|
"devDependencies": {
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"vitest": "^2.0.3",
|
|
70
|
-
"@univerjs/core": "0.2.5",
|
|
71
|
-
"@univerjs/shared": "0.2.5"
|
|
59
|
+
"typescript": "^5.5.4",
|
|
60
|
+
"vite": "^5.4.0",
|
|
61
|
+
"vitest": "^2.0.5",
|
|
62
|
+
"@univerjs/core": "0.2.7",
|
|
63
|
+
"@univerjs-pro/exchange-client": "0.2.7",
|
|
64
|
+
"@univerjs/shared": "0.2.7"
|
|
72
65
|
},
|
|
73
66
|
"univerSpace": {
|
|
74
67
|
".": {
|
|
@@ -81,8 +74,7 @@
|
|
|
81
74
|
"require": "./lib/cjs/*",
|
|
82
75
|
"types": "./lib/types/index.d.ts"
|
|
83
76
|
},
|
|
84
|
-
"./lib/*": "./lib/*"
|
|
85
|
-
"./locale/*": "./lib/locale/*.json"
|
|
77
|
+
"./lib/*": "./lib/*"
|
|
86
78
|
},
|
|
87
79
|
"scripts": {
|
|
88
80
|
"test": "vitest run",
|
package/lib/index.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.univer-exchange-uploading{display:flex;flex-direction:column;align-items:flex-start;margin-top:var(--margin-lg)}.univer-exchange-uploading-tip{color:var(--color-black);font-size:var(--font-size-sm);padding:0 var(--padding-lg) 0 var(--padding-sm)}.univer-exchange-uploading-progress{padding:0 var(--padding-lg) 0 var(--padding-sm)}.univer-exchange-upload-progress{width:324px;height:6px;margin:var(--margin-base) 0 var(--margin-sm) 0;background-color:rgb(var(--border-color));border-radius:var(--border-radius-lg)}.univer-exchange-upload-progress-inner{height:6px;border-radius:var(--border-radius-lg);transition:width .5s}.univer-exchange-upload-button{cursor:pointer;user-select:none;height:28px;border-width:0;border-radius:6px;padding:0 var(--padding-sm);font-size:var(--font-size-xs);transition:all .15s;color:rgb(var(--hyacinth-500));background-color:transparent;border-color:transparent}.univer-exchange-upload-button:hover{background-color:rgb(var(--hyacinth-50))}.univer-exchange-link-list{max-height:280px;overflow-y:auto;overflow-x:hidden;scrollbar-color:rgba(var(--scrollbar-color),.7) transparent;scrollbar-gutter:auto;scrollbar-width:thin;margin-top:var(--margin-lg)}.univer-exchange-link-list-inner{display:flex;list-style:none;padding:0;margin:0;gap:8px;flex-direction:column}.univer-exchange-link-list-inner-item-link{display:flex;justify-content:space-between;text-decoration-line:none;color:var(--color-black);padding:var(--padding-xs) var(--padding-sm);background-color:transparent;border:none;border-radius:var(--border-radius-base);outline:none;transition:background-color .2s}.univer-exchange-link-list-inner-item-link:hover{background-color:rgb(var(--border-color))}.univer-exchange-link-list-inner-item-link-content{display:flex;align-items:center;width:calc(100% - 48px)}.univer-exchange-link-list-inner-item-link-icon{height:20px;font-size:20px;display:flex}.univer-exchange-link-list-inner-item-link-name{margin-left:var(--margin-xxs);color:var(--color-black);font-size:var(--font-size-sm);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.univer-exchange-link-list-inner-item-link-direct{display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;font-size:var(--font-size-lg);color:rgb(var(--text-color-secondary));background-color:transparent;border:none;border-radius:var(--border-radius-base);outline:none;transition:background-color .2s}.univer-exchange-link-list-inner-item-link-direct:hover{background-color:rgb(var(--bg-color-hover))}.univer-exchange-upload-error{display:flex;flex-direction:column;align-items:flex-start;margin-top:var(--margin-lg)}.univer-exchange-upload-error-tip{color:var(--color-black);font-size:var(--font-size-sm);padding:0 var(--padding-lg) 0 var(--padding-sm);margin-bottom:var(--margin-sm)}.univer-exchange-upload-success{display:flex;padding:0 var(--padding-xs) 0 var(--padding-sm);align-items:center;justify-content:space-between;margin-top:var(--margin-sm)}.univer-exchange-upload-success-tip{color:rgb(var(--text-color-secondary));font-size:var(--font-size-xs)}.univer-exchange-upload-notification{position:fixed;z-index:1000;bottom:48px;right:12px;width:372px;display:flex;flex-direction:column;justify-content:flex-start;padding:var(--padding-xl) var(--padding-base) var(--padding-lg) var(--padding-base);background-color:#fff;border-radius:6px;box-shadow:var(--box-shadow-base);box-sizing:border-box}.univer-exchange-upload-notification-header{display:flex;align-items:center;justify-content:space-between;padding:0 var(--padding-sm) 0 6px}.univer-exchange-upload-notification-header-title{display:flex}.univer-exchange-upload-notification-header-icon{height:24px;font-size:24px}.univer-exchange-upload-notification-header-icon-success{color:rgb(var(--success-color))}.univer-exchange-upload-notification-header-icon-uploading{color:rgb(var(--info-color))}.univer-exchange-upload-notification-header-icon-error{color:rgb(var(--error-color))}.univer-exchange-upload-notification-header-text{margin-left:6px;line-height:24px;color:var(--color-black);font-size:17px;font-weight:600}.univer-exchange-upload-notification-header-close{cursor:pointer;display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;font-size:var(--font-size-lg);color:rgb(var(--text-color-secondary));background-color:transparent;border:none;border-radius:var(--border-radius-base);outline:none;transition:background-color .2s}.univer-exchange-upload-notification-header-close:hover{background-color:rgb(var(--bg-color-hover))}
|
package/lib/locale/en-US.json
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"exchange": {
|
|
3
|
-
"file": "File",
|
|
4
|
-
"upload": "Open(File)",
|
|
5
|
-
"download": "Save As",
|
|
6
|
-
"uploadJson": "Upload[No Collaboration]",
|
|
7
|
-
"downloadJson": "Download[No Collaboration]",
|
|
8
|
-
"load": "Load remote xlsx file",
|
|
9
|
-
"uploadFile": "Upload xlsx file",
|
|
10
|
-
"uploading": "Uploading",
|
|
11
|
-
"uploadSuccess": "File uploaded successfully",
|
|
12
|
-
"uploadSuccessTip": "{0} file(s) uploaded successfully",
|
|
13
|
-
"downloading": "Downloading",
|
|
14
|
-
"downloadSuccess": "Download success",
|
|
15
|
-
"unknownMistake": "Unknown mistake",
|
|
16
|
-
"networkError": "Network error",
|
|
17
|
-
"tooLarge": "Data is too large",
|
|
18
|
-
"internalError": "Internal unknown error",
|
|
19
|
-
"interrupt": "The network connection was interrupted and the file upload failed.",
|
|
20
|
-
"wait": "Please wait...",
|
|
21
|
-
"cancel": "Cancel",
|
|
22
|
-
"uploadAgain": "Upload again"
|
|
23
|
-
}
|
|
24
|
-
}
|
package/lib/locale/ru-RU.json
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"exchange": {
|
|
3
|
-
"file": "Файл",
|
|
4
|
-
"upload": "Открыть(Файл)",
|
|
5
|
-
"download": "Сохранить как",
|
|
6
|
-
"uploadJson": "Загрузить[Без совместной работы]",
|
|
7
|
-
"downloadJson": "Скачать[Без совместной работы]",
|
|
8
|
-
"load": "Загрузить удаленный файл xlsx",
|
|
9
|
-
"uploadFile": "Загрузить файл xlsx",
|
|
10
|
-
"uploading": "Загрузка",
|
|
11
|
-
"uploadSuccess": "Файл успешно загружен",
|
|
12
|
-
"uploadSuccessTip": "{0} файл(ов) успешно загружен(о)",
|
|
13
|
-
"downloading": "Скачивание",
|
|
14
|
-
"downloadSuccess": "Скачивание успешно",
|
|
15
|
-
"unknownMistake": "Неизвестная ошибка",
|
|
16
|
-
"networkError": "Сетевая ошибка",
|
|
17
|
-
"tooLarge": "Данные слишком большие",
|
|
18
|
-
"internalError": "Внутренняя неизвестная ошибка",
|
|
19
|
-
"interrupt": "Сетевое соединение было прервано, и загрузка файла не удалась.",
|
|
20
|
-
"wait": "Пожалуйста, подождите...",
|
|
21
|
-
"cancel": "Отмена",
|
|
22
|
-
"uploadAgain": "Загрузить снова"
|
|
23
|
-
}
|
|
24
|
-
}
|
package/lib/locale/vi-VN.json
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"exchange": {
|
|
3
|
-
"file": "File",
|
|
4
|
-
"upload": "Open(File)",
|
|
5
|
-
"download": "Save As",
|
|
6
|
-
"uploadJson": "Upload[No Collaboration]",
|
|
7
|
-
"downloadJson": "Download[No Collaboration]",
|
|
8
|
-
"load": "Load remote xlsx file",
|
|
9
|
-
"uploadFile": "Upload xlsx file",
|
|
10
|
-
"uploading": "Uploading",
|
|
11
|
-
"uploadSuccess": "File uploaded successfully",
|
|
12
|
-
"uploadSuccessTip": "{0} file(s) uploaded successfully",
|
|
13
|
-
"downloading": "Downloading",
|
|
14
|
-
"downloadSuccess": "Download success",
|
|
15
|
-
"unknownMistake": "Unknown mistake",
|
|
16
|
-
"networkError": "Network error",
|
|
17
|
-
"tooLarge": "Data is too large",
|
|
18
|
-
"internalError": "Internal unknown error",
|
|
19
|
-
"interrupt": "The network connection was interrupted and the file upload failed.",
|
|
20
|
-
"wait": "Please wait...",
|
|
21
|
-
"cancel": "Cancel",
|
|
22
|
-
"uploadAgain": "Upload again"
|
|
23
|
-
}
|
|
24
|
-
}
|
package/lib/locale/zh-CN.json
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"exchange": {
|
|
3
|
-
"file": "文件",
|
|
4
|
-
"upload": "打开(文件)",
|
|
5
|
-
"download": "另存为",
|
|
6
|
-
"uploadJson": "上传[非协同]",
|
|
7
|
-
"downloadJson": "下载[非协同]",
|
|
8
|
-
"load": "加载远程 XLSX 文件",
|
|
9
|
-
"uploadFile": "上传 xlsx 文件",
|
|
10
|
-
"uploading": "上传中",
|
|
11
|
-
"uploadSuccess": "文件上传成功",
|
|
12
|
-
"uploadSuccessTip": "{0}个文件上传成功",
|
|
13
|
-
"downloading": "下载中",
|
|
14
|
-
"downloadSuccess": "下载成功",
|
|
15
|
-
"unknownMistake": "未知错误",
|
|
16
|
-
"networkError": "网络异常",
|
|
17
|
-
"tooLarge": "数据流过大",
|
|
18
|
-
"internalError": "内部未知错误",
|
|
19
|
-
"interrupt": "网络连接中断,文件上传失败。",
|
|
20
|
-
"wait": "请稍等...",
|
|
21
|
-
"cancel": "取消",
|
|
22
|
-
"uploadAgain": "再次上传"
|
|
23
|
-
}
|
|
24
|
-
}
|
package/lib/locale/zh-TW.json
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"exchange": {
|
|
3
|
-
"file": "File",
|
|
4
|
-
"upload": "Open(File)",
|
|
5
|
-
"download": "Save As",
|
|
6
|
-
"uploadJson": "Upload[No Collaboration]",
|
|
7
|
-
"downloadJson": "Download[No Collaboration]",
|
|
8
|
-
"load": "Load remote xlsx file",
|
|
9
|
-
"uploadFile": "Upload xlsx file",
|
|
10
|
-
"uploading": "Uploading",
|
|
11
|
-
"uploadSuccess": "File uploaded successfully",
|
|
12
|
-
"uploadSuccessTip": "{0} file(s) uploaded successfully",
|
|
13
|
-
"downloading": "Downloading",
|
|
14
|
-
"downloadSuccess": "Download success",
|
|
15
|
-
"unknownMistake": "Unknown mistake",
|
|
16
|
-
"networkError": "Network error",
|
|
17
|
-
"tooLarge": "Data is too large",
|
|
18
|
-
"internalError": "Internal unknown error",
|
|
19
|
-
"interrupt": "The network connection was interrupted and the file upload failed.",
|
|
20
|
-
"wait": "Please wait...",
|
|
21
|
-
"cancel": "Cancel",
|
|
22
|
-
"uploadAgain": "Upload again"
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
declare const locales: {
|
|
2
|
-
exchange: {
|
|
3
|
-
file: string;
|
|
4
|
-
upload: string;
|
|
5
|
-
download: string;
|
|
6
|
-
uploadJson: string;
|
|
7
|
-
downloadJson: string;
|
|
8
|
-
load: string;
|
|
9
|
-
uploadFile: string;
|
|
10
|
-
uploading: string;
|
|
11
|
-
uploadSuccess: string;
|
|
12
|
-
uploadSuccessTip: string;
|
|
13
|
-
downloading: string;
|
|
14
|
-
downloadSuccess: string;
|
|
15
|
-
unknownMistake: string;
|
|
16
|
-
networkError: string;
|
|
17
|
-
tooLarge: string;
|
|
18
|
-
internalError: string;
|
|
19
|
-
interrupt: string;
|
|
20
|
-
wait: string;
|
|
21
|
-
cancel: string;
|
|
22
|
-
uploadAgain: string;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
export default locales;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { IDisposable, IWorkbookData, Disposable } from '@univerjs/core';
|
|
2
|
-
import { IError } from '@univerjs/protocol';
|
|
3
|
-
import { Observable } from 'rxjs';
|
|
4
|
-
import { RequestService } from './request.service';
|
|
5
|
-
|
|
6
|
-
export declare enum RequestState {
|
|
7
|
-
UPLOAD = 0,
|
|
8
|
-
IMPORT = 1,
|
|
9
|
-
EXPORT = 2,
|
|
10
|
-
GET_TASK = 3,
|
|
11
|
-
SIGN_URL = 4,
|
|
12
|
-
GET_JSON = 5,
|
|
13
|
-
GET_FILE = 6
|
|
14
|
-
}
|
|
15
|
-
export interface IRequestState {
|
|
16
|
-
error: IError | undefined;
|
|
17
|
-
state: RequestState;
|
|
18
|
-
}
|
|
19
|
-
export interface IExchangeService {
|
|
20
|
-
requestState$: Observable<IRequestState>;
|
|
21
|
-
/**
|
|
22
|
-
* Import XLSX file to unit id
|
|
23
|
-
* @param file
|
|
24
|
-
*/
|
|
25
|
-
importXLSXToUnitId(file: File | string): Promise<string | undefined>;
|
|
26
|
-
/**
|
|
27
|
-
* Import XLSX file to workbook data
|
|
28
|
-
* @param file
|
|
29
|
-
*/
|
|
30
|
-
importXLSXToSnapshot(file: File | string): Promise<IWorkbookData | undefined>;
|
|
31
|
-
/**
|
|
32
|
-
* Export XLSX file by unit id
|
|
33
|
-
* @param unitId
|
|
34
|
-
*/
|
|
35
|
-
exportXLSXByUnitId(unitId: string): Promise<File | undefined>;
|
|
36
|
-
/**
|
|
37
|
-
* Export XLSX file by workbook data
|
|
38
|
-
* @param data
|
|
39
|
-
* @returns
|
|
40
|
-
*/
|
|
41
|
-
exportXLSXBySnapshot(snapshot: IWorkbookData): Promise<File | undefined>;
|
|
42
|
-
}
|
|
43
|
-
export declare const IExchangeService: import('@univerjs/core').IdentifierDecorator<IExchangeService>;
|
|
44
|
-
/**
|
|
45
|
-
* TODO@Dushusir maybe move to ExchangeClientPlugin plugin for reuse
|
|
46
|
-
*/
|
|
47
|
-
export declare class ExchangeService extends Disposable implements IExchangeService, IDisposable {
|
|
48
|
-
private readonly _requestService;
|
|
49
|
-
private readonly _requestState$;
|
|
50
|
-
readonly requestState$: Observable<IRequestState>;
|
|
51
|
-
constructor(_requestService: RequestService);
|
|
52
|
-
dispose(): void;
|
|
53
|
-
importXLSXToUnitId(file: File | string): Promise<string | undefined>;
|
|
54
|
-
importXLSXToSnapshot(file: File | string): Promise<IWorkbookData | undefined>;
|
|
55
|
-
exportXLSXByUnitId(unitId: string): Promise<File | undefined>;
|
|
56
|
-
exportXLSXBySnapshot(data: IWorkbookData): Promise<File | undefined>;
|
|
57
|
-
private _importToUnitId;
|
|
58
|
-
private _importToSnapshot;
|
|
59
|
-
/**
|
|
60
|
-
* Export file by snapshot
|
|
61
|
-
* @param snapshot
|
|
62
|
-
* @param univerType
|
|
63
|
-
* @returns
|
|
64
|
-
*/
|
|
65
|
-
private _exportBySnapshot;
|
|
66
|
-
private _export;
|
|
67
|
-
private _upload;
|
|
68
|
-
private _import;
|
|
69
|
-
private _signUrl;
|
|
70
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { IDisposable, Disposable, ILogService, IUniverInstanceService, LocaleService, UniverInstanceType } from '@univerjs/core';
|
|
2
|
-
import { IProgressService, IMessageService } from '@univerjs/ui';
|
|
3
|
-
import { ExchangeService } from './exchange.service';
|
|
4
|
-
import { UploadNotificationService } from './upload-notification.service';
|
|
5
|
-
|
|
6
|
-
export interface ISheetsExchangeOperateService {
|
|
7
|
-
interrupt(): void;
|
|
8
|
-
/**
|
|
9
|
-
* Upload file to server, get unitId and open unit
|
|
10
|
-
* @param file
|
|
11
|
-
*/
|
|
12
|
-
importXLSXToUnitId(): Promise<void>;
|
|
13
|
-
/**
|
|
14
|
-
* Upload xlsx file to server, get snapshot and refresh current sheet
|
|
15
|
-
* @param file
|
|
16
|
-
*/
|
|
17
|
-
importXLSXToSnapshot(): Promise<void>;
|
|
18
|
-
/**
|
|
19
|
-
* Export xlsx file by unitId
|
|
20
|
-
* @returns
|
|
21
|
-
*/
|
|
22
|
-
exportXLSXByUnitId(unitId?: string, unitName?: string, unitType?: UniverInstanceType): Promise<void>;
|
|
23
|
-
/**
|
|
24
|
-
* Export xlsx file by snapshot
|
|
25
|
-
* @returns
|
|
26
|
-
*/
|
|
27
|
-
exportXLSXBySnapshot(): Promise<void>;
|
|
28
|
-
/**
|
|
29
|
-
* Customize the imported Unit URL format according to the needs of your own scene
|
|
30
|
-
* @param getLink
|
|
31
|
-
*/
|
|
32
|
-
registerLink(getLink: (unitId: string, univerType: UniverInstanceType) => string): void;
|
|
33
|
-
}
|
|
34
|
-
export declare const ISheetsExchangeOperateService: import('@univerjs/core').IdentifierDecorator<ISheetsExchangeOperateService>;
|
|
35
|
-
export declare class SheetsExchangeOperateService extends Disposable implements ISheetsExchangeOperateService, IDisposable {
|
|
36
|
-
private _univerInstanceService;
|
|
37
|
-
private readonly _messageService;
|
|
38
|
-
private readonly _localeService;
|
|
39
|
-
private readonly _exchangeService;
|
|
40
|
-
private readonly _uploadNotificationService;
|
|
41
|
-
private readonly _uploadProgressService;
|
|
42
|
-
protected readonly _logService: ILogService;
|
|
43
|
-
private _interrupted;
|
|
44
|
-
constructor(_univerInstanceService: IUniverInstanceService, _messageService: IMessageService, _localeService: LocaleService, _exchangeService: ExchangeService, _uploadNotificationService: UploadNotificationService, _uploadProgressService: IProgressService, _logService: ILogService);
|
|
45
|
-
interrupt(): void;
|
|
46
|
-
importXLSXToUnitId(): Promise<void>;
|
|
47
|
-
importXLSXToSnapshot(): Promise<void>;
|
|
48
|
-
exportXLSXByUnitId(unitId?: string, unitName?: string): Promise<void>;
|
|
49
|
-
exportXLSXBySnapshot(): Promise<void>;
|
|
50
|
-
registerLink(getLink: (unitId: string, univerType: UniverInstanceType) => string): void;
|
|
51
|
-
private _getUnitID;
|
|
52
|
-
private _getUnitName;
|
|
53
|
-
private _getUnitJson;
|
|
54
|
-
/**
|
|
55
|
-
* Get unit link /?unit={unitId}&type=2
|
|
56
|
-
* @param unitId
|
|
57
|
-
* @param type
|
|
58
|
-
* @returns
|
|
59
|
-
*/
|
|
60
|
-
private _getLinkByUnitId;
|
|
61
|
-
private _refresh;
|
|
62
|
-
private _showNetworkError;
|
|
63
|
-
private _showDownloadMessage;
|
|
64
|
-
private _showUploadMessage;
|
|
65
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { IConfigService, IDisposable } from '@univerjs/core';
|
|
2
|
-
import { HTTPService } from '@univerjs/network';
|
|
3
|
-
import { IError, UniverType } from '@univerjs/protocol';
|
|
4
|
-
import { ISheetBlockJson, ISnapshotJson } from './utils/snapshot';
|
|
5
|
-
|
|
6
|
-
export declare const EXCHANGE_UPLOAD_FILE_SERVER_URL_KEY = "EXCHANGE_UPLOAD_FILE_SERVER_URL_KEY";
|
|
7
|
-
export declare const EXCHANGE_IMPORT_SERVER_URL_KEY = "EXCHANGE_IMPORT_SERVER_URL_KEY";
|
|
8
|
-
export declare const EXCHANGE_EXPORT_SERVER_URL_KEY = "EXCHANGE_EXPORT_SERVER_URL_KEY";
|
|
9
|
-
export declare const EXCHANGE_GET_TASK_SERVER_URL_KEY = "EXCHANGE_GET_TASK_SERVER_URL_KEY";
|
|
10
|
-
export declare const EXCHANGE_SIGN_URL_SERVER_URL_KEY = "EXCHANGE_SIGN_URL_SERVER_URL_KEY";
|
|
11
|
-
export interface IFileUploadResponse {
|
|
12
|
-
FileId: string;
|
|
13
|
-
error: IError;
|
|
14
|
-
}
|
|
15
|
-
export declare enum ImportOutputType {
|
|
16
|
-
UNDEFINED = 0,
|
|
17
|
-
/** UNIT - Import to univer unit, unit is store in the database */
|
|
18
|
-
UNIT = 1,
|
|
19
|
-
/** JSON - Import and convert to a json file which represents a univer unit, not store in the database */
|
|
20
|
-
JSON = 2,
|
|
21
|
-
UNRECOGNIZED = -1
|
|
22
|
-
}
|
|
23
|
-
export interface IImportRequest {
|
|
24
|
-
fileID: string;
|
|
25
|
-
type: UniverType;
|
|
26
|
-
outputType: ImportOutputType;
|
|
27
|
-
/** not supported yet */
|
|
28
|
-
fileUrl: string;
|
|
29
|
-
}
|
|
30
|
-
export interface IImportResponse {
|
|
31
|
-
taskID: string;
|
|
32
|
-
error: IError;
|
|
33
|
-
}
|
|
34
|
-
export interface IExportRequest {
|
|
35
|
-
/** if unitID is specified, the input is the unit in the database */
|
|
36
|
-
unitID: string;
|
|
37
|
-
/** if jsonID is specified, the input is the json file which represents a univer unit */
|
|
38
|
-
jsonID: string;
|
|
39
|
-
type: UniverType;
|
|
40
|
-
}
|
|
41
|
-
export interface IExportResponse {
|
|
42
|
-
error: IError | undefined;
|
|
43
|
-
taskID: string;
|
|
44
|
-
}
|
|
45
|
-
export interface IGetTaskResponse {
|
|
46
|
-
error: IError | undefined;
|
|
47
|
-
taskID: string;
|
|
48
|
-
status: string;
|
|
49
|
-
import?: IImportTaskResult | undefined;
|
|
50
|
-
export?: IExportTaskResult | undefined;
|
|
51
|
-
}
|
|
52
|
-
export interface IImportTaskResult {
|
|
53
|
-
outputType: ImportOutputType;
|
|
54
|
-
unitID: string;
|
|
55
|
-
jsonID: string;
|
|
56
|
-
}
|
|
57
|
-
export interface IExportTaskResult {
|
|
58
|
-
fileID: string;
|
|
59
|
-
fileUrl: string;
|
|
60
|
-
}
|
|
61
|
-
export interface ISignUrlResponse {
|
|
62
|
-
error: IError | undefined;
|
|
63
|
-
url: string;
|
|
64
|
-
}
|
|
65
|
-
export interface ISnapshotJsonResponse {
|
|
66
|
-
snapshot: Partial<ISnapshotJson>;
|
|
67
|
-
sheetBlocks: ISheetBlockJson;
|
|
68
|
-
}
|
|
69
|
-
export interface IRequestService {
|
|
70
|
-
upload(file: File | string): Promise<IFileUploadResponse | undefined>;
|
|
71
|
-
import(importRequest: IImportRequest): Promise<IImportResponse | undefined>;
|
|
72
|
-
export(exportRequest: IExportRequest): Promise<IExportResponse | undefined>;
|
|
73
|
-
getTask(taskID: string): Promise<IGetTaskResponse | undefined>;
|
|
74
|
-
signUrl(fileID: string): Promise<ISignUrlResponse | undefined>;
|
|
75
|
-
}
|
|
76
|
-
export declare const IRequestService: import('@univerjs/core').IdentifierDecorator<IRequestService>;
|
|
77
|
-
/**
|
|
78
|
-
* TODO@Dushusir maybe move to ExchangeClientPlugin plugin for reuse
|
|
79
|
-
*/
|
|
80
|
-
export declare class RequestService implements IRequestService, IDisposable {
|
|
81
|
-
private readonly _configService;
|
|
82
|
-
private readonly _httpService;
|
|
83
|
-
constructor(_configService: IConfigService, _httpService: HTTPService);
|
|
84
|
-
dispose(): void;
|
|
85
|
-
/**
|
|
86
|
-
* upload file to server
|
|
87
|
-
* @param file
|
|
88
|
-
*/
|
|
89
|
-
upload(file: File | string, size?: number, flate?: boolean): Promise<IFileUploadResponse | undefined>;
|
|
90
|
-
import(importRequest: IImportRequest): Promise<IImportResponse | undefined>;
|
|
91
|
-
export(exportRequest: IExportRequest): Promise<IExportResponse | undefined>;
|
|
92
|
-
getTask(taskID: string): Promise<IGetTaskResponse | undefined>;
|
|
93
|
-
signUrl(fileID: string): Promise<ISignUrlResponse | undefined>;
|
|
94
|
-
private _getUploadFileURL;
|
|
95
|
-
private _getImportURL;
|
|
96
|
-
private _getExportURL;
|
|
97
|
-
private _getTaskURL;
|
|
98
|
-
private _getSignURL;
|
|
99
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { Disposable, IDisposable } from '@univerjs/core';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { UniverType } from '@univerjs/protocol';
|
|
4
|
-
|
|
5
|
-
export declare enum UploadNotificationState {
|
|
6
|
-
UPLOADING = 0,
|
|
7
|
-
SUCCESS = 1,
|
|
8
|
-
ERROR = 2
|
|
9
|
-
}
|
|
10
|
-
export interface ILinkList {
|
|
11
|
-
link: string;
|
|
12
|
-
name: string;
|
|
13
|
-
type: UniverType;
|
|
14
|
-
}
|
|
15
|
-
export interface IUploadNotificationService {
|
|
16
|
-
visible$: Observable<boolean>;
|
|
17
|
-
state$: Observable<UploadNotificationState>;
|
|
18
|
-
list$: Observable<ILinkList[]>;
|
|
19
|
-
/**
|
|
20
|
-
* Show upload notification
|
|
21
|
-
*/
|
|
22
|
-
show(): void;
|
|
23
|
-
/**
|
|
24
|
-
* Hide upload notification
|
|
25
|
-
*/
|
|
26
|
-
hide(): void;
|
|
27
|
-
/**
|
|
28
|
-
* Update upload notification state
|
|
29
|
-
* @param state
|
|
30
|
-
*/
|
|
31
|
-
updateState(state: UploadNotificationState): void;
|
|
32
|
-
/**
|
|
33
|
-
* Push link to upload notification
|
|
34
|
-
* @param link
|
|
35
|
-
*/
|
|
36
|
-
pushLink(link: ILinkList): void;
|
|
37
|
-
}
|
|
38
|
-
export declare const IUploadNotificationService: import('@univerjs/core').IdentifierDecorator<IUploadNotificationService>;
|
|
39
|
-
export declare class UploadNotificationService extends Disposable implements IUploadNotificationService, IDisposable {
|
|
40
|
-
private readonly _visible$;
|
|
41
|
-
private readonly _state$;
|
|
42
|
-
private readonly _list$;
|
|
43
|
-
readonly visible$: Observable<boolean>;
|
|
44
|
-
readonly state$: Observable<UploadNotificationState>;
|
|
45
|
-
readonly list$: Observable<ILinkList[]>;
|
|
46
|
-
private _list;
|
|
47
|
-
constructor();
|
|
48
|
-
dispose(): void;
|
|
49
|
-
show(): void;
|
|
50
|
-
hide(): void;
|
|
51
|
-
updateState(state: UploadNotificationState): void;
|
|
52
|
-
pushLink(link: ILinkList): void;
|
|
53
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare class FileDropper {
|
|
2
|
-
private _element;
|
|
3
|
-
private _content;
|
|
4
|
-
private callback;
|
|
5
|
-
private maskElement;
|
|
6
|
-
constructor(_element: HTMLElement, _content: string, callback: (file: File) => void);
|
|
7
|
-
private init;
|
|
8
|
-
private createMask;
|
|
9
|
-
private showMask;
|
|
10
|
-
private hideMask;
|
|
11
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { IWorkbookData, Nullable } from '@univerjs/core';
|
|
2
|
-
import { ISheetBlock, ISnapshot, IWorkbookMeta, IWorksheetMeta } from '@univerjs/protocol';
|
|
3
|
-
|
|
4
|
-
export interface WorksheetMetaJson extends Omit<IWorksheetMeta, 'originalMeta'> {
|
|
5
|
-
originalMeta: string;
|
|
6
|
-
}
|
|
7
|
-
export interface WorkbookMetaJson extends Omit<IWorkbookMeta, 'originalMeta' | 'sheets'> {
|
|
8
|
-
originalMeta: string;
|
|
9
|
-
sheets: {
|
|
10
|
-
[key: string]: Partial<WorksheetMetaJson>;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
export interface ISnapshotJson extends Omit<ISnapshot, 'workbook'> {
|
|
14
|
-
workbook: Partial<WorkbookMetaJson>;
|
|
15
|
-
}
|
|
16
|
-
export interface ISheetBlockData extends Omit<ISheetBlock, 'data'> {
|
|
17
|
-
data: string;
|
|
18
|
-
}
|
|
19
|
-
export interface ISheetBlockJson {
|
|
20
|
-
[key: string]: Partial<ISheetBlockData>;
|
|
21
|
-
}
|
|
22
|
-
export interface ISnapshotBlockJson {
|
|
23
|
-
snapshot: ISnapshotJson;
|
|
24
|
-
sheetBlocks: ISheetBlockJson;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* The originalMeta value in the JSON data transmitted from the backend is in string format and needs to be converted to Uint8Array first to fully comply with the ISnapshot format.
|
|
28
|
-
* @param snapshot
|
|
29
|
-
* @returns
|
|
30
|
-
*/
|
|
31
|
-
export declare function transformSnapshotMetaToBuffer(snapshot: ISnapshotJson): Nullable<ISnapshot>;
|
|
32
|
-
/**
|
|
33
|
-
* The data in the sheet block is in string format and needs to be converted to Uint8Array first to fully comply with the ISheetBlock format.
|
|
34
|
-
* @param sheetBlocks
|
|
35
|
-
* @returns
|
|
36
|
-
*/
|
|
37
|
-
export declare function transformSheetBlockMetaToBuffer(sheetBlocks: ISheetBlockJson): ISheetBlock[];
|
|
38
|
-
/**
|
|
39
|
-
* Convert snapshot data to workbook data
|
|
40
|
-
* @param snapshot
|
|
41
|
-
* @param sheetBlocks
|
|
42
|
-
* @returns
|
|
43
|
-
*/
|
|
44
|
-
export declare function transformSnapshotJsonToWorkbookData(snapshotBlock: ISnapshotBlockJson): Nullable<IWorkbookData>;
|
|
45
|
-
/**
|
|
46
|
-
* Convert the Uint8Array in the snapshot to a string for easy transmission to the backend
|
|
47
|
-
* @param snapshot
|
|
48
|
-
* @returns
|
|
49
|
-
*/
|
|
50
|
-
export declare function transformSnapshotMetaToString(snapshot: ISnapshot): Nullable<ISnapshotJson>;
|
|
51
|
-
/**
|
|
52
|
-
* Convert the Uint8Array in the sheet block to a string for easy transmission to the backend
|
|
53
|
-
* @param sheetBlocks
|
|
54
|
-
* @returns
|
|
55
|
-
*/
|
|
56
|
-
export declare function transformSheetBlockMetaToString(sheetBlocks: ISheetBlock[]): ISheetBlockJson;
|
|
57
|
-
/**
|
|
58
|
-
* Convert the workbook data to snapshot data
|
|
59
|
-
* @param workbookData
|
|
60
|
-
* @returns
|
|
61
|
-
*/
|
|
62
|
-
export declare function transformWorkbookDataToSnapshotJson(workbookData: IWorkbookData): Promise<ISnapshotBlockJson>;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export declare function downloadFileByURL(url: string, filename: string, fileExt: string): void;
|
|
2
|
-
/**
|
|
3
|
-
* Triggers a download of a given File object.
|
|
4
|
-
*
|
|
5
|
-
* @param {File} file - The File object to be downloaded.
|
|
6
|
-
*/
|
|
7
|
-
export declare function downloadFile(file: File | Blob, filename: string, fileExt: string): void;
|
|
8
|
-
export declare function getUploadXLSXFile(): Promise<File | null>;
|
|
9
|
-
export declare function getUploadFile(type: string): Promise<File | null>;
|
|
10
|
-
export declare function getFileByURL(url: string): Promise<File | undefined>;
|
|
11
|
-
export declare function getFileNameFromURL(url: string): string | undefined;
|
|
12
|
-
export declare function getTextFromURL(url: string): Promise<string | undefined>;
|
|
13
|
-
export declare function blobToString(blob: Blob): Promise<string>;
|
|
14
|
-
export declare function bufferToFile(buffer: Uint8Array): File;
|
|
15
|
-
export declare function replaceType(path: string, type: string): string;
|
|
16
|
-
export declare function replaceTaskID(path: string, taskID: string): string;
|
|
17
|
-
export declare function replaceFileID(path: string, fileID: string): string;
|