@univerjs-pro/exchange-client 0.5.0-nightly.202411120616 → 0.5.0-nightly.202411131606

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.
Files changed (54) hide show
  1. package/lib/cjs/facade.js +1 -1
  2. package/lib/cjs/index.js +2 -2
  3. package/lib/cjs/locale/en-US.js +1 -1
  4. package/lib/cjs/locale/fa-IR.js +1 -1
  5. package/lib/cjs/locale/ru-RU.js +1 -1
  6. package/lib/cjs/locale/vi-VN.js +1 -1
  7. package/lib/cjs/locale/zh-CN.js +1 -1
  8. package/lib/cjs/locale/zh-TW.js +1 -1
  9. package/lib/es/facade.js +1 -1
  10. package/lib/es/index.js +2 -2
  11. package/lib/es/locale/en-US.js +1 -1
  12. package/lib/es/locale/fa-IR.js +1 -1
  13. package/lib/es/locale/ru-RU.js +1 -1
  14. package/lib/es/locale/vi-VN.js +1 -1
  15. package/lib/es/locale/zh-CN.js +1 -1
  16. package/lib/es/locale/zh-TW.js +1 -1
  17. package/lib/types/controllers/config.schema.d.ts +16 -0
  18. package/lib/types/controllers/exchange.controller.d.ts +8 -0
  19. package/lib/types/facade/f-univer.d.ts +36 -0
  20. package/lib/types/facade/index.d.ts +1 -0
  21. package/lib/types/index.d.ts +10 -483
  22. package/lib/types/locale/en-US.d.ts +3 -0
  23. package/lib/types/locale/fa-IR.d.ts +3 -0
  24. package/lib/types/locale/ru-RU.d.ts +3 -0
  25. package/lib/types/locale/vi-VN.d.ts +3 -0
  26. package/lib/types/locale/zh-CN.d.ts +21 -0
  27. package/lib/types/locale/zh-TW.d.ts +3 -0
  28. package/lib/types/plugin.d.ts +11 -0
  29. package/lib/types/services/__tests__/snapshot.spec.d.ts +1 -0
  30. package/lib/types/services/exchange.service.d.ts +87 -0
  31. package/lib/types/services/operate.service.d.ts +121 -0
  32. package/lib/types/services/request.service.d.ts +107 -0
  33. package/lib/types/services/upload-notification.service.d.ts +52 -0
  34. package/lib/types/services/utils/snapshot.d.ts +76 -0
  35. package/lib/types/services/utils/tool.d.ts +19 -0
  36. package/lib/types/views/UploadNotificationContainer.d.ts +2 -0
  37. package/lib/types/views/link-list/LinkList.d.ts +6 -0
  38. package/lib/types/views/upload-again/UploadAgain.d.ts +2 -0
  39. package/lib/types/views/upload-button/UploadButton.d.ts +7 -0
  40. package/lib/types/views/upload-error/UploadError.d.ts +2 -0
  41. package/lib/types/views/upload-notification/UploadNotification.d.ts +2 -0
  42. package/lib/types/views/upload-success/UploadSuccess.d.ts +5 -0
  43. package/lib/types/views/uploading/Uploading.d.ts +2 -0
  44. package/lib/types/views/uploading/upload-cancel/UploadCancel.d.ts +2 -0
  45. package/lib/types/views/uploading/upload-progress/UploadProgress.d.ts +5 -0
  46. package/lib/umd/facade.js +1 -1
  47. package/lib/umd/index.js +2 -2
  48. package/lib/umd/locale/en-US.js +1 -1
  49. package/lib/umd/locale/fa-IR.js +1 -1
  50. package/lib/umd/locale/ru-RU.js +1 -1
  51. package/lib/umd/locale/vi-VN.js +1 -1
  52. package/lib/umd/locale/zh-CN.js +1 -1
  53. package/lib/umd/locale/zh-TW.js +1 -1
  54. package/package.json +6 -6
@@ -0,0 +1,3 @@
1
+ import { default as zhCN } from './zh-CN';
2
+ declare const locale: typeof zhCN;
3
+ export default locale;
@@ -0,0 +1,3 @@
1
+ import { default as zhCN } from './zh-CN';
2
+ declare const locale: typeof zhCN;
3
+ export default locale;
@@ -0,0 +1,3 @@
1
+ import { default as zhCN } from './zh-CN';
2
+ declare const locale: typeof zhCN;
3
+ export default locale;
@@ -0,0 +1,3 @@
1
+ import { default as zhCN } from './zh-CN';
2
+ declare const locale: typeof zhCN;
3
+ export default locale;
@@ -0,0 +1,21 @@
1
+ declare const locales: {
2
+ exchange: {
3
+ file: string;
4
+ upload: string;
5
+ download: string;
6
+ uploading: string;
7
+ uploadSuccess: string;
8
+ uploadSuccessTip: string;
9
+ downloading: string;
10
+ downloadSuccess: string;
11
+ unknownMistake: string;
12
+ networkError: string;
13
+ tooLarge: string;
14
+ internalError: string;
15
+ interrupt: string;
16
+ wait: string;
17
+ cancel: string;
18
+ uploadAgain: string;
19
+ };
20
+ };
21
+ export default locales;
@@ -0,0 +1,3 @@
1
+ import { default as zhCN } from './zh-CN';
2
+ declare const locale: typeof zhCN;
3
+ export default locale;
@@ -0,0 +1,11 @@
1
+ import { IUniverExchangeClientConfig } from './controllers/config.schema';
2
+ import { IConfigService, Injector, Plugin } from '@univerjs/core';
3
+ export declare class UniverExchangeClientPlugin extends Plugin {
4
+ private readonly _config;
5
+ readonly _injector: Injector;
6
+ private readonly _configService;
7
+ static pluginName: string;
8
+ constructor(_config: IUniverExchangeClientConfig | undefined, _injector: Injector, _configService: IConfigService);
9
+ onStarting(): void;
10
+ onReady(): void;
11
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,87 @@
1
+ import { IDisposable, IDocumentData, IWorkbookData, Disposable, IConfigService } from '@univerjs/core';
2
+ import { IError, UniverType } from '@univerjs/protocol';
3
+ import { RequestService } from './request.service';
4
+ import { Observable } from 'rxjs';
5
+ export declare enum RequestState {
6
+ UPLOAD = 0,
7
+ IMPORT = 1,
8
+ EXPORT = 2,
9
+ GET_TASK = 3,
10
+ SIGN_URL = 4,
11
+ GET_JSON = 5,
12
+ GET_FILE = 6
13
+ }
14
+ export interface IRequestState {
15
+ error: IError | undefined;
16
+ state: RequestState;
17
+ }
18
+ export interface IExchangeService {
19
+ requestState$: Observable<IRequestState>;
20
+ /**
21
+ * Import XLSX file to workbook data
22
+ * @param file
23
+ */
24
+ importXLSXToSnapshot(file: File | string): Promise<IWorkbookData | undefined>;
25
+ /**
26
+ * Export XLSX file by unit id
27
+ * @param unitId
28
+ */
29
+ exportXLSXByUnitId(unitId: string): Promise<File | undefined>;
30
+ /**
31
+ * Export XLSX file by workbook data
32
+ * @param data
33
+ * @returns
34
+ */
35
+ exportXLSXBySnapshot(snapshot: IWorkbookData): Promise<File | undefined>;
36
+ /**
37
+ * Import DOCX file to document data
38
+ * @param file
39
+ */
40
+ importDOCXToSnapshot(file: File | string): Promise<IDocumentData | undefined>;
41
+ /**
42
+ * Export DOCX file by unit id
43
+ * @param unitId
44
+ */
45
+ exportDOCXByUnitId(unitId: string): Promise<File | undefined>;
46
+ /**
47
+ * Export DOCX file by document data
48
+ * @param data
49
+ * @returns
50
+ */
51
+ exportDOCXBySnapshot(snapshot: IDocumentData): Promise<File | undefined>;
52
+ /**
53
+ * Import file to unit id
54
+ * @param file
55
+ * @param univerType
56
+ */
57
+ importFileToUnitId(file: File | string, univerType: UniverType): Promise<string | undefined>;
58
+ }
59
+ export declare const IExchangeService: import('@wendellhu/redi').IdentifierDecorator<IExchangeService>;
60
+ export declare class ExchangeService extends Disposable implements IExchangeService, IDisposable {
61
+ private readonly _configService;
62
+ private readonly _requestService;
63
+ private readonly _requestState$;
64
+ readonly requestState$: Observable<IRequestState>;
65
+ constructor(_configService: IConfigService, _requestService: RequestService);
66
+ dispose(): void;
67
+ importDOCXToSnapshot(file: File | string): Promise<IDocumentData | undefined>;
68
+ exportDOCXByUnitId(unitId: string): Promise<File | undefined>;
69
+ exportDOCXBySnapshot(snapshot: IDocumentData): Promise<File | undefined>;
70
+ importXLSXToSnapshot(file: File | string): Promise<IWorkbookData | undefined>;
71
+ exportXLSXByUnitId(unitId: string): Promise<File | undefined>;
72
+ exportXLSXBySnapshot(data: IWorkbookData): Promise<File | undefined>;
73
+ importFileToUnitId(file: File | string, univerType: UniverType): Promise<string | undefined>;
74
+ private _importToSnapshot;
75
+ /**
76
+ * Export file by snapshot
77
+ * @param snapshot
78
+ * @param univerType
79
+ * @returns
80
+ */
81
+ private _exportBySnapshot;
82
+ private _export;
83
+ private _upload;
84
+ private _import;
85
+ private _signUrl;
86
+ private _getDownloadEndpointURL;
87
+ }
@@ -0,0 +1,121 @@
1
+ import { IDisposable, Disposable, ILogService, IUniverInstanceService, LocaleService, UniverInstanceType } from '@univerjs/core';
2
+ import { Observable } from 'rxjs';
3
+ import { ExchangeService } from './exchange.service';
4
+ import { UploadNotificationService } from './upload-notification.service';
5
+ import { UniverType } from '@univerjs/protocol';
6
+ import { IMessageService } from '@univerjs/ui';
7
+ export interface IExchangeOperateService {
8
+ interrupt(): void;
9
+ /**
10
+ * Upload file to server, get unitId and open unit
11
+ * @param file
12
+ */
13
+ importXLSXToUnitId(): Promise<string | undefined>;
14
+ /**
15
+ * Upload xlsx file to server, get snapshot and refresh current sheet
16
+ * @param file
17
+ */
18
+ importXLSXToSnapshot(): Promise<void>;
19
+ /**
20
+ * Export xlsx file by unitId
21
+ * @returns
22
+ */
23
+ exportXLSXByUnitId(unitId?: string, unitName?: string, unitType?: UniverInstanceType): Promise<void>;
24
+ /**
25
+ * Export xlsx file by snapshot
26
+ * @returns
27
+ */
28
+ exportXLSXBySnapshot(): Promise<void>;
29
+ /**
30
+ * Upload file to server, get unitId and open unit
31
+ * @param file
32
+ */
33
+ importDOCXToUnitId(): Promise<string | undefined>;
34
+ /**
35
+ * Upload docx file to server, get snapshot and refresh current doc
36
+ * @param file
37
+ */
38
+ importDOCXToSnapshot(): Promise<void>;
39
+ /**
40
+ * Export docx file by unitId
41
+ * @returns
42
+ */
43
+ exportDOCXByUnitId(unitId?: string, unitName?: string, unitType?: UniverType): Promise<void>;
44
+ /**
45
+ * Export docx file by snapshot
46
+ * @returns
47
+ */
48
+ exportDOCXBySnapshot(): Promise<void>;
49
+ /**
50
+ * Upload file, supports multiple types
51
+ * @param file
52
+ */
53
+ uploadFileToUnitId(types: UniverType[]): Promise<{
54
+ unitId: string;
55
+ type: UniverType;
56
+ } | undefined>;
57
+ /**
58
+ * Customize the imported Unit URL format according to the needs of your own scene
59
+ * @param getLink
60
+ */
61
+ registerLink(getLink: (unitId: string, univerType: UniverInstanceType) => string): void;
62
+ /**
63
+ * Observable of upload progress
64
+ */
65
+ progress$: Observable<IUploadProgress>;
66
+ }
67
+ export interface IUploadProgress {
68
+ /** Task that already completed. */
69
+ done: number;
70
+ /** The total number of tasks need to execute. */
71
+ count: number;
72
+ }
73
+ export declare const IExchangeOperateService: import('@wendellhu/redi').IdentifierDecorator<IExchangeOperateService>;
74
+ export declare class ExchangeOperateService extends Disposable implements IExchangeOperateService, IDisposable {
75
+ private _univerInstanceService;
76
+ private readonly _messageService;
77
+ private readonly _localeService;
78
+ private readonly _exchangeService;
79
+ private readonly _uploadNotificationService;
80
+ protected readonly _logService: ILogService;
81
+ private _interrupted;
82
+ private readonly _progress$;
83
+ readonly progress$: Observable<IUploadProgress>;
84
+ private _totalUploadTaskCount;
85
+ private _doneUploadTaskCount;
86
+ constructor(_univerInstanceService: IUniverInstanceService, _messageService: IMessageService, _localeService: LocaleService, _exchangeService: ExchangeService, _uploadNotificationService: UploadNotificationService, _logService: ILogService);
87
+ interrupt(): void;
88
+ uploadFileToUnitId(types: UniverType[]): Promise<{
89
+ unitId: string;
90
+ type: UniverType;
91
+ } | undefined>;
92
+ importDOCXToUnitId(): Promise<string | undefined>;
93
+ importDOCXToSnapshot(): Promise<void>;
94
+ exportDOCXByUnitId(unitId?: string, unitName?: string, unitType?: UniverInstanceType): Promise<void>;
95
+ exportDOCXBySnapshot(): Promise<void>;
96
+ importXLSXToUnitId(): Promise<string | undefined>;
97
+ importXLSXToSnapshot(): Promise<void>;
98
+ exportXLSXByUnitId(unitId?: string, unitName?: string): Promise<void>;
99
+ exportXLSXBySnapshot(): Promise<void>;
100
+ registerLink(getLink: (unitId: string, univerType: UniverInstanceType) => string): void;
101
+ private _importFileToUnitId;
102
+ private _getUnitID;
103
+ private _getUnitName;
104
+ private _getUnitJson;
105
+ /**
106
+ * Get unit link /?unit={unitId}&type=2
107
+ * @param unitId
108
+ * @param type
109
+ * @returns
110
+ */
111
+ private _getLinkByUnitId;
112
+ private _refresh;
113
+ private _showNetworkError;
114
+ private _showDownloadMessage;
115
+ private _showUploadMessage;
116
+ private _emitProgress;
117
+ private _addTotalCount;
118
+ private _addDoneTask;
119
+ private _completeProgress;
120
+ private _clearProgress;
121
+ }
@@ -0,0 +1,107 @@
1
+ import { IDisposable, IConfigService } from '@univerjs/core';
2
+ import { IError, UniverType } from '@univerjs/protocol';
3
+ import { ISheetBlockJson, ISnapshotJson } from './utils/snapshot';
4
+ import { HTTPService } from '@univerjs/network';
5
+ /** @deprecated Will be removed in the 0.2.19 release */
6
+ export declare const EXCHANGE_UPLOAD_FILE_SERVER_URL_KEY = "EXCHANGE_UPLOAD_FILE_SERVER_URL_KEY";
7
+ /** @deprecated Will be removed in the 0.2.19 release */
8
+ export declare const EXCHANGE_IMPORT_SERVER_URL_KEY = "EXCHANGE_IMPORT_SERVER_URL_KEY";
9
+ /** @deprecated Will be removed in the 0.2.19 release */
10
+ export declare const EXCHANGE_EXPORT_SERVER_URL_KEY = "EXCHANGE_EXPORT_SERVER_URL_KEY";
11
+ /** @deprecated Will be removed in the 0.2.19 release */
12
+ export declare const EXCHANGE_GET_TASK_SERVER_URL_KEY = "EXCHANGE_GET_TASK_SERVER_URL_KEY";
13
+ /** @deprecated Will be removed in the 0.2.19 release */
14
+ export declare const EXCHANGE_SIGN_URL_SERVER_URL_KEY = "EXCHANGE_SIGN_URL_SERVER_URL_KEY";
15
+ export interface IFileUploadResponse {
16
+ FileId: string;
17
+ error: IError;
18
+ }
19
+ export declare enum ImportOutputType {
20
+ UNDEFINED = 0,
21
+ /** UNIT - Import to univer unit, unit is store in the database */
22
+ UNIT = 1,
23
+ /** JSON - Import and convert to a json file which represents a univer unit, not store in the database */
24
+ JSON = 2,
25
+ UNRECOGNIZED = -1
26
+ }
27
+ export interface IImportRequest {
28
+ fileID: string;
29
+ type: UniverType;
30
+ outputType: ImportOutputType;
31
+ /** not supported yet */
32
+ fileUrl: string;
33
+ }
34
+ export interface IImportResponse {
35
+ taskID: string;
36
+ error: IError;
37
+ }
38
+ export interface IExportRequest {
39
+ /** if unitID is specified, the input is the unit in the database */
40
+ unitID: string;
41
+ /** if jsonID is specified, the input is the json file which represents a univer unit */
42
+ jsonID: string;
43
+ type: UniverType;
44
+ }
45
+ export interface IExportResponse {
46
+ error: IError | undefined;
47
+ taskID: string;
48
+ }
49
+ export interface IGetTaskResponse {
50
+ error: IError | undefined;
51
+ taskID: string;
52
+ status: string;
53
+ import?: IImportTaskResult | undefined;
54
+ export?: IExportTaskResult | undefined;
55
+ }
56
+ export interface IImportTaskResult {
57
+ outputType: ImportOutputType;
58
+ unitID: string;
59
+ jsonID: string;
60
+ }
61
+ export interface IExportTaskResult {
62
+ fileID: string;
63
+ fileUrl: string;
64
+ }
65
+ export interface ISignUrlResponse {
66
+ error: IError | undefined;
67
+ url: string;
68
+ }
69
+ export interface IBindingResponse {
70
+ error: IError;
71
+ }
72
+ export interface ISnapshotJsonResponse {
73
+ snapshot: Partial<ISnapshotJson>;
74
+ sheetBlocks: ISheetBlockJson;
75
+ }
76
+ export interface IRequestService {
77
+ upload(file: File | string): Promise<IFileUploadResponse | undefined>;
78
+ import(importRequest: IImportRequest): Promise<IImportResponse | undefined>;
79
+ export(exportRequest: IExportRequest): Promise<IExportResponse | undefined>;
80
+ getTask(taskID: string): Promise<IGetTaskResponse | undefined>;
81
+ signUrl(fileID: string): Promise<ISignUrlResponse | undefined>;
82
+ }
83
+ export declare const IRequestService: import('@wendellhu/redi').IdentifierDecorator<IRequestService>;
84
+ /**
85
+ * TODO@Dushusir maybe move to ExchangeClientPlugin plugin for reuse
86
+ */
87
+ export declare class RequestService implements IRequestService, IDisposable {
88
+ private readonly _configService;
89
+ private readonly _httpService;
90
+ constructor(_configService: IConfigService, _httpService: HTTPService);
91
+ dispose(): void;
92
+ /**
93
+ * upload file to server
94
+ * @param file
95
+ */
96
+ upload(file: File | string, size?: number, flate?: boolean): Promise<IFileUploadResponse | undefined>;
97
+ import(importRequest: IImportRequest): Promise<IImportResponse | undefined>;
98
+ export(exportRequest: IExportRequest): Promise<IExportResponse | undefined>;
99
+ getTask(taskID: string): Promise<IGetTaskResponse | undefined>;
100
+ signUrl(fileID: string): Promise<ISignUrlResponse | undefined>;
101
+ private _getUploadFileURL;
102
+ private _getImportURL;
103
+ private _getExportURL;
104
+ private _getTaskURL;
105
+ private _getSignURL;
106
+ private _getMaxPollingTime;
107
+ }
@@ -0,0 +1,52 @@
1
+ import { Disposable, IDisposable } from '@univerjs/core';
2
+ import { Observable } from 'rxjs';
3
+ import { UniverType } from '@univerjs/protocol';
4
+ export declare enum UploadNotificationState {
5
+ UPLOADING = 0,
6
+ SUCCESS = 1,
7
+ ERROR = 2
8
+ }
9
+ export interface ILinkList {
10
+ link: string;
11
+ name: string;
12
+ type: UniverType;
13
+ }
14
+ export interface IUploadNotificationService {
15
+ visible$: Observable<boolean>;
16
+ state$: Observable<UploadNotificationState>;
17
+ list$: Observable<ILinkList[]>;
18
+ /**
19
+ * Show upload notification
20
+ */
21
+ show(): void;
22
+ /**
23
+ * Hide upload notification
24
+ */
25
+ hide(): void;
26
+ /**
27
+ * Update upload notification state
28
+ * @param state
29
+ */
30
+ updateState(state: UploadNotificationState): void;
31
+ /**
32
+ * Push link to upload notification
33
+ * @param link
34
+ */
35
+ pushLink(link: ILinkList): void;
36
+ }
37
+ export declare const IUploadNotificationService: import('@wendellhu/redi').IdentifierDecorator<IUploadNotificationService>;
38
+ export declare class UploadNotificationService extends Disposable implements IUploadNotificationService, IDisposable {
39
+ private readonly _visible$;
40
+ private readonly _state$;
41
+ private readonly _list$;
42
+ readonly visible$: Observable<boolean>;
43
+ readonly state$: Observable<UploadNotificationState>;
44
+ readonly list$: Observable<ILinkList[]>;
45
+ private _list;
46
+ constructor();
47
+ dispose(): void;
48
+ show(): void;
49
+ hide(): void;
50
+ updateState(state: UploadNotificationState): void;
51
+ pushLink(link: ILinkList): void;
52
+ }
@@ -0,0 +1,76 @@
1
+ import { IWorkbookData, Nullable } from '@univerjs/core';
2
+ import { ICopyFileMetaRequest, ICopyFileMetaResponse, IDocumentMeta, IFetchMissingChangesetsRequest, IFetchMissingChangesetsResponse, IGetDeserializedSheetBlockResponse, IGetLatestCsReqIdBySidRequest, IGetLatestCsReqIdBySidResponse, IGetResourcesRequest, IGetResourcesResponse, IGetSheetBlockRequest, IGetSheetBlockResponse, IGetUnitOnRevRequest, IGetUnitOnRevResponse, ISaveChangesetRequest, ISaveChangesetResponse, ISaveSheetBlockRequest, ISaveSheetBlockResponse, ISaveSnapshotRequest, ISaveSnapshotResponse, ISheetBlock, ISnapshot, IWorkbookMeta, IWorksheetMeta } from '@univerjs/protocol';
3
+ import { ILogContext, ISnapshotServerService } from '@univerjs-pro/collaboration';
4
+ export interface IWorksheetMetaJson extends Omit<IWorksheetMeta, 'originalMeta'> {
5
+ originalMeta: string;
6
+ }
7
+ export interface IWorkbookMetaJson extends Omit<IWorkbookMeta, 'originalMeta' | 'sheets'> {
8
+ originalMeta: string;
9
+ sheets: {
10
+ [key: string]: Partial<IWorksheetMetaJson>;
11
+ };
12
+ }
13
+ export interface IDocumentMetaJson extends Omit<IDocumentMeta, 'originalMeta'> {
14
+ originalMeta: string;
15
+ }
16
+ export interface ISnapshotJson extends Omit<ISnapshot, 'workbook' | 'doc'> {
17
+ workbook: Partial<IWorkbookMetaJson>;
18
+ doc: Partial<IDocumentMetaJson>;
19
+ }
20
+ export interface ISheetBlockData extends Omit<ISheetBlock, 'data'> {
21
+ data: string;
22
+ }
23
+ export interface ISheetBlockJson {
24
+ [key: string]: Partial<ISheetBlockData>;
25
+ }
26
+ export interface ISnapshotBlockJson {
27
+ snapshot: ISnapshotJson;
28
+ sheetBlocks: ISheetBlockJson;
29
+ }
30
+ export interface ISnapshotBlockJsonResponse {
31
+ snapshot: ISnapshot;
32
+ sheetBlocks: {
33
+ [key: string]: ISheetBlock;
34
+ };
35
+ }
36
+ /**
37
+ * Convert the Uint8Array in the snapshot to a string for easy transmission to the backend
38
+ * @param snapshot
39
+ * @returns
40
+ */
41
+ export declare function transformSnapshotMetaToString(snapshot: ISnapshot): Nullable<ISnapshotJson>;
42
+ /**
43
+ * Convert the Uint8Array in the sheet block to a string for easy transmission to the backend
44
+ * @param sheetBlocks
45
+ * @returns
46
+ */
47
+ export declare function transformSheetBlockMetaToString(sheetBlocks: ISheetBlock[]): ISheetBlockJson;
48
+ /**
49
+ * Convert the workbook data to snapshot data
50
+ * @param workbookData
51
+ * @returns
52
+ */
53
+ export declare function transformWorkbookDataToSnapshotJson(workbookData: IWorkbookData): Promise<ISnapshotBlockJson>;
54
+ /**
55
+ * The server needs to fully implement all interfaces, but when used by the client, use saveSheetBlock to cache the sheet block locally, and use getSheetBlock to obtain the sheet block.
56
+ */
57
+ export declare class ClientSnapshotServerService implements ISnapshotServerService {
58
+ private _sheetBlockCache;
59
+ /** Load snapshot from a database. */
60
+ getUnitOnRev(context: ILogContext, params: IGetUnitOnRevRequest): Promise<IGetUnitOnRevResponse>;
61
+ /** Load sheet block from a database. */
62
+ getSheetBlock(context: ILogContext, params: IGetSheetBlockRequest): Promise<IGetSheetBlockResponse>;
63
+ /** Load deserialized sheet block from a database. */
64
+ getDeserializedSheetBlock(context: ILogContext, params: IGetSheetBlockRequest): Promise<IGetDeserializedSheetBlockResponse>;
65
+ /** Fetch missing changeset */
66
+ fetchMissingChangesets(context: ILogContext, params: IFetchMissingChangesetsRequest): Promise<IFetchMissingChangesetsResponse>;
67
+ getResourcesRequest(context: ILogContext, params: IGetResourcesRequest): Promise<IGetResourcesResponse>;
68
+ /** Save snapshot to a database. */
69
+ saveSnapshot(context: ILogContext, params: ISaveSnapshotRequest): Promise<ISaveSnapshotResponse>;
70
+ /** Save sheet block to a database. */
71
+ saveSheetBlock(context: ILogContext, params: ISaveSheetBlockRequest): Promise<ISaveSheetBlockResponse>;
72
+ /** Save changeset to a database. */
73
+ saveChangeset(context: ILogContext, params: ISaveChangesetRequest): Promise<ISaveChangesetResponse>;
74
+ copyFileMeta(context: ILogContext, params: ICopyFileMetaRequest): Promise<ICopyFileMetaResponse>;
75
+ getLatestCsReqIdBySid(context: ILogContext, params: IGetLatestCsReqIdBySidRequest): Promise<IGetLatestCsReqIdBySidResponse>;
76
+ }
@@ -0,0 +1,19 @@
1
+ import { UniverType } from '@univerjs/protocol';
2
+ export declare function downloadFileByURL(url: string, filename: string, fileExt: string): void;
3
+ /**
4
+ * Triggers a download of a given File object.
5
+ *
6
+ * @param {File} file - The File object to be downloaded.
7
+ */
8
+ export declare function downloadFile(file: File | Blob, filename: string, fileExt: string): void;
9
+ export declare function getUniverTypeByFile(file: File): UniverType.UNIVER_UNKNOWN | UniverType.UNIVER_DOC | UniverType.UNIVER_SHEET | UniverType.UNIVER_SLIDE;
10
+ export declare function getUploadFile(types: UniverType[], multiple?: boolean): Promise<FileList | null>;
11
+ export declare function getFileByURL(url: string): Promise<File | undefined>;
12
+ export declare function getFileNameFromURL(url: string): string | undefined;
13
+ export declare function getTextFromURL(url: string): Promise<string | undefined>;
14
+ export declare function blobToString(blob: Blob): Promise<string>;
15
+ export declare function bufferToFile(buffer: Uint8Array): File;
16
+ export declare function replaceType(path: string, type: string): string;
17
+ export declare function replaceUnitId(path: string, type: string): string;
18
+ export declare function replaceTaskID(path: string, taskID: string): string;
19
+ export declare function replaceFileID(path: string, fileID: string): string;
@@ -0,0 +1,2 @@
1
+ import { default as React } from 'react';
2
+ export declare function UploadNotificationContainer(): React.JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+ import { ILinkList } from '../../services/upload-notification.service';
3
+ export interface ILinkListProps {
4
+ list: ILinkList[];
5
+ }
6
+ export declare function LinkList(props: ILinkListProps): React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { default as React } from 'react';
2
+ export declare function UploadAgain(): React.JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+ export interface IUploadButton {
3
+ children?: React.ReactNode;
4
+ className?: string;
5
+ onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
6
+ }
7
+ export declare function UploadButton(props: IUploadButton): React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { default as React } from 'react';
2
+ export declare function UploadError(): React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { default as React } from 'react';
2
+ export declare function UploadNotification(): false | React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { default as React } from 'react';
2
+ export interface IUploadSuccessProps {
3
+ count: number;
4
+ }
5
+ export declare function UploadSuccess(props: IUploadSuccessProps): React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { default as React } from 'react';
2
+ export declare function Uploading(): React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { default as React } from 'react';
2
+ export declare function UploadCancel(): React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { default as React } from 'react';
2
+ export interface IUploadProgressProps {
3
+ barColor: string;
4
+ }
5
+ export declare function UploadProgress(props: IUploadProgressProps): React.JSX.Element;
package/lib/umd/facade.js CHANGED
@@ -1 +1 @@
1
- function _0x3c37(){const _0x4fc59a=['exportXLSXBySnapshot','10vojCsI','importDOCXToSnapshot','@univerjs/core','@univerjs-pro/exchange-client','9087183vwZvOe','UNRECOGNIZED','86384RNkVXM','6336630DgmEvr','UNIVER_DOC','importXLSXToUnitId','importDOCXToUnitId','get','10164ZgZBED','UniverCore','importFileToUnitId','object','UNIVER_UNKNOWN','UNIVER_SHEET','1448906zDemMc','importXLSXToSnapshot','138708pioEvH','92uUzPFX','The\x20exchange\x20service\x20is\x20not\x20available','exportXLSXByUnitId','FUniver','UNIVER_PROJECT','function','1912dskDLB','_injector','IExchangeService','UNIVER_SLIDE','4473255FRChjL'];_0x3c37=function(){return _0x4fc59a;};return _0x3c37();}function _0x988b(_0x38dd87,_0x1f7506){const _0x3c372c=_0x3c37();return _0x988b=function(_0x988bbe,_0x335c1d){_0x988bbe=_0x988bbe-0x126;let _0x221772=_0x3c372c[_0x988bbe];return _0x221772;},_0x988b(_0x38dd87,_0x1f7506);}(function(_0x38675b,_0x37d9f3){const _0xe97d3d=_0x988b,_0x267c8f=_0x38675b();while(!![]){try{const _0x5d515d=-parseInt(_0xe97d3d(0x143))/0x1+parseInt(_0xe97d3d(0x137))/0x2+parseInt(_0xe97d3d(0x145))/0x3*(-parseInt(_0xe97d3d(0x146))/0x4)+parseInt(_0xe97d3d(0x12f))/0x5+parseInt(_0xe97d3d(0x138))/0x6+-parseInt(_0xe97d3d(0x13d))/0x7*(-parseInt(_0xe97d3d(0x12b))/0x8)+-parseInt(_0xe97d3d(0x135))/0x9*(-parseInt(_0xe97d3d(0x131))/0xa);if(_0x5d515d===_0x37d9f3)break;else _0x267c8f['push'](_0x267c8f['shift']());}catch(_0x298f07){_0x267c8f['push'](_0x267c8f['shift']());}}}(_0x3c37,0xccab9),function(_0x4926f6,_0x1e194d){const _0x29f91c=_0x988b;typeof exports==_0x29f91c(0x140)&&typeof module<'u'?_0x1e194d(require(_0x29f91c(0x133)),require('@univerjs-pro/exchange-client')):typeof define==_0x29f91c(0x12a)&&define['amd']?define([_0x29f91c(0x133),_0x29f91c(0x134)],_0x1e194d):(_0x4926f6=typeof globalThis<'u'?globalThis:_0x4926f6||self,_0x1e194d(_0x4926f6[_0x29f91c(0x13e)],_0x4926f6['UniverExchangeClient']));}(this,function(_0x501bd4,_0x24b02d){'use strict';const _0x1b6789=_0x988b;var _0x35066e=(_0x20d9a8=>(_0x20d9a8[_0x20d9a8[_0x1b6789(0x141)]=0x0]=_0x1b6789(0x141),_0x20d9a8[_0x20d9a8[_0x1b6789(0x139)]=0x1]=_0x1b6789(0x139),_0x20d9a8[_0x20d9a8[_0x1b6789(0x142)]=0x2]=_0x1b6789(0x142),_0x20d9a8[_0x20d9a8[_0x1b6789(0x12e)]=0x3]='UNIVER_SLIDE',_0x20d9a8[_0x20d9a8[_0x1b6789(0x129)]=0x4]='UNIVER_PROJECT',_0x20d9a8[_0x20d9a8[_0x1b6789(0x136)]=-0x1]=_0x1b6789(0x136),_0x20d9a8))(_0x35066e||{});class _0x403e66 extends _0x501bd4[_0x1b6789(0x128)]{async[_0x1b6789(0x13a)](_0x579f96){const _0x1562b8=_0x1b6789,_0x4cce3f=this[_0x1562b8(0x12c)][_0x1562b8(0x13c)](_0x24b02d[_0x1562b8(0x12d)]);if(!_0x4cce3f)throw new Error(_0x1562b8(0x126));return _0x4cce3f[_0x1562b8(0x13f)](_0x579f96,_0x35066e[_0x1562b8(0x142)]);}async['importXLSXToSnapshot'](_0x524ec3){const _0x58e145=_0x1b6789,_0x3f34d4=this[_0x58e145(0x12c)][_0x58e145(0x13c)](_0x24b02d[_0x58e145(0x12d)]);if(!_0x3f34d4)throw new Error('The\x20exchange\x20service\x20is\x20not\x20available');return _0x3f34d4[_0x58e145(0x144)](_0x524ec3);}async[_0x1b6789(0x127)](_0x1adf2a){const _0xe67feb=_0x1b6789,_0x577ecf=this[_0xe67feb(0x12c)][_0xe67feb(0x13c)](_0x24b02d[_0xe67feb(0x12d)]);if(!_0x577ecf)throw new Error(_0xe67feb(0x126));return _0x577ecf[_0xe67feb(0x127)](_0x1adf2a);}async[_0x1b6789(0x130)](_0x14daf6){const _0x24bcd9=_0x1b6789,_0x1be2ab=this['_injector'][_0x24bcd9(0x13c)](_0x24b02d[_0x24bcd9(0x12d)]);if(!_0x1be2ab)throw new Error(_0x24bcd9(0x126));return _0x1be2ab['exportXLSXBySnapshot'](_0x14daf6);}async[_0x1b6789(0x13b)](_0x20c8a4){const _0x3dc73d=_0x1b6789,_0x4e28ae=this['_injector'][_0x3dc73d(0x13c)](_0x24b02d[_0x3dc73d(0x12d)]);if(!_0x4e28ae)throw new Error(_0x3dc73d(0x126));return _0x4e28ae[_0x3dc73d(0x13f)](_0x20c8a4,_0x35066e['UNIVER_DOC']);}async[_0x1b6789(0x132)](_0x2c2fb1){const _0x54cb2d=_0x1b6789,_0x57c4b5=this[_0x54cb2d(0x12c)]['get'](_0x24b02d[_0x54cb2d(0x12d)]);if(!_0x57c4b5)throw new Error('The\x20exchange\x20service\x20is\x20not\x20available');return _0x57c4b5[_0x54cb2d(0x132)](_0x2c2fb1);}}_0x501bd4[_0x1b6789(0x128)]['extend'](_0x403e66);}));
1
+ (function(_0x4b97fc,_0x34f6cc){const _0x41f9ae=_0x4697,_0x2cb687=_0x4b97fc();while(!![]){try{const _0xa54b7c=-parseInt(_0x41f9ae(0x11a))/0x1+-parseInt(_0x41f9ae(0x10d))/0x2*(parseInt(_0x41f9ae(0x118))/0x3)+parseInt(_0x41f9ae(0x10e))/0x4+parseInt(_0x41f9ae(0x11e))/0x5+parseInt(_0x41f9ae(0x10c))/0x6+-parseInt(_0x41f9ae(0x113))/0x7+parseInt(_0x41f9ae(0x111))/0x8*(parseInt(_0x41f9ae(0x112))/0x9);if(_0xa54b7c===_0x34f6cc)break;else _0x2cb687['push'](_0x2cb687['shift']());}catch(_0x36c867){_0x2cb687['push'](_0x2cb687['shift']());}}}(_0x34b1,0xb6c7d),function(_0x541a3d,_0xca84df){const _0x42ddd0=_0x4697;typeof exports==_0x42ddd0(0x109)&&typeof module<'u'?_0xca84df(require('@univerjs/core'),require('@univerjs-pro/exchange-client')):typeof define==_0x42ddd0(0x104)&&define[_0x42ddd0(0x10a)]?define(['@univerjs/core',_0x42ddd0(0x120)],_0xca84df):(_0x541a3d=typeof globalThis<'u'?globalThis:_0x541a3d||self,_0xca84df(_0x541a3d[_0x42ddd0(0x11b)],_0x541a3d[_0x42ddd0(0x11f)]));}(this,function(_0x14ae5b,_0x70a952){'use strict';const _0x53f75a=_0x4697;var _0x4c121a=(_0x59cac8=>(_0x59cac8[_0x59cac8[_0x53f75a(0x121)]=0x0]='UNIVER_UNKNOWN',_0x59cac8[_0x59cac8['UNIVER_DOC']=0x1]=_0x53f75a(0x116),_0x59cac8[_0x59cac8[_0x53f75a(0x115)]=0x2]='UNIVER_SHEET',_0x59cac8[_0x59cac8[_0x53f75a(0x11c)]=0x3]='UNIVER_SLIDE',_0x59cac8[_0x59cac8[_0x53f75a(0x108)]=0x4]=_0x53f75a(0x108),_0x59cac8[_0x59cac8[_0x53f75a(0x106)]=-0x1]=_0x53f75a(0x106),_0x59cac8))(_0x4c121a||{});class _0x3b47cc extends _0x14ae5b[_0x53f75a(0x11d)]{async[_0x53f75a(0x107)](_0x5de91f){const _0x1223f3=_0x53f75a,_0x16601c=this[_0x1223f3(0x122)]['get'](_0x70a952[_0x1223f3(0x114)]);if(!_0x16601c)throw new Error(_0x1223f3(0x10b));return _0x16601c[_0x1223f3(0x117)](_0x5de91f,_0x4c121a[_0x1223f3(0x115)]);}async[_0x53f75a(0x110)](_0x25b95b){const _0x437ef1=_0x53f75a,_0x2d836a=this[_0x437ef1(0x122)]['get'](_0x70a952[_0x437ef1(0x114)]);if(!_0x2d836a)throw new Error(_0x437ef1(0x10b));return _0x2d836a[_0x437ef1(0x110)](_0x25b95b);}async['exportXLSXByUnitId'](_0x501c24){const _0x475cfc=_0x53f75a,_0x198c76=this[_0x475cfc(0x122)][_0x475cfc(0x123)](_0x70a952[_0x475cfc(0x114)]);if(!_0x198c76)throw new Error(_0x475cfc(0x10b));return _0x198c76['exportXLSXByUnitId'](_0x501c24);}async['exportXLSXBySnapshot'](_0x5c4632){const _0x398d4f=_0x53f75a,_0x2fb4f0=this[_0x398d4f(0x122)]['get'](_0x70a952[_0x398d4f(0x114)]);if(!_0x2fb4f0)throw new Error(_0x398d4f(0x10b));return _0x2fb4f0[_0x398d4f(0x105)](_0x5c4632);}async[_0x53f75a(0x119)](_0x1d28f9){const _0x38acd5=_0x53f75a,_0x1cb694=this[_0x38acd5(0x122)][_0x38acd5(0x123)](_0x70a952[_0x38acd5(0x114)]);if(!_0x1cb694)throw new Error(_0x38acd5(0x10b));return _0x1cb694['importFileToUnitId'](_0x1d28f9,_0x4c121a['UNIVER_DOC']);}async['importDOCXToSnapshot'](_0x28402f){const _0x356c10=_0x53f75a,_0x303f27=this[_0x356c10(0x122)][_0x356c10(0x123)](_0x70a952[_0x356c10(0x114)]);if(!_0x303f27)throw new Error(_0x356c10(0x10b));return _0x303f27[_0x356c10(0x10f)](_0x28402f);}}_0x14ae5b[_0x53f75a(0x11d)]['extend'](_0x3b47cc);}));function _0x4697(_0x3ab956,_0xdf4a21){const _0x34b1c9=_0x34b1();return _0x4697=function(_0x469724,_0x196247){_0x469724=_0x469724-0x104;let _0x35f5da=_0x34b1c9[_0x469724];return _0x35f5da;},_0x4697(_0x3ab956,_0xdf4a21);}function _0x34b1(){const _0xa74d65=['939835NunpmQ','UniverCore','UNIVER_SLIDE','FUniver','2271330IylHvQ','UniverExchangeClient','@univerjs-pro/exchange-client','UNIVER_UNKNOWN','_injector','get','function','exportXLSXBySnapshot','UNRECOGNIZED','importXLSXToUnitId','UNIVER_PROJECT','object','amd','The\x20exchange\x20service\x20is\x20not\x20available','2335716sDAVcC','4aAVjfV','1319776LmGyax','importDOCXToSnapshot','importXLSXToSnapshot','1377528AuBwzy','171rDnVqf','9897111FatPfM','IExchangeService','UNIVER_SHEET','UNIVER_DOC','importFileToUnitId','2014122kkDdrW','importDOCXToUnitId'];_0x34b1=function(){return _0xa74d65;};return _0x34b1();}