@univerjs-pro/exchange-client 1.0.0-alpha.7 → 1.0.0-beta.0

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 (100) hide show
  1. package/lib/cjs/facade.js +1 -1
  2. package/lib/cjs/index.js +1 -1
  3. package/lib/cjs/locale/ar-SA.js +1 -1
  4. package/lib/cjs/locale/ca-ES.js +1 -1
  5. package/lib/cjs/locale/de-DE.js +1 -1
  6. package/lib/cjs/locale/en-US.js +1 -1
  7. package/lib/cjs/locale/es-ES.js +1 -1
  8. package/lib/cjs/locale/fa-IR.js +1 -1
  9. package/lib/cjs/locale/fr-FR.js +1 -1
  10. package/lib/cjs/locale/id-ID.js +1 -1
  11. package/lib/cjs/locale/it-IT.js +1 -1
  12. package/lib/cjs/locale/ja-JP.js +1 -1
  13. package/lib/cjs/locale/ko-KR.js +1 -1
  14. package/lib/cjs/locale/pl-PL.js +1 -1
  15. package/lib/cjs/locale/pt-BR.js +1 -1
  16. package/lib/cjs/locale/ru-RU.js +1 -1
  17. package/lib/cjs/locale/sk-SK.js +1 -1
  18. package/lib/cjs/locale/vi-VN.js +1 -1
  19. package/lib/cjs/locale/zh-CN.js +1 -1
  20. package/lib/cjs/locale/zh-HK.js +1 -1
  21. package/lib/cjs/locale/zh-TW.js +1 -1
  22. package/lib/es/facade.js +1 -1
  23. package/lib/es/index.js +1 -1
  24. package/lib/es/locale/ar-SA.js +1 -1
  25. package/lib/es/locale/ca-ES.js +1 -1
  26. package/lib/es/locale/de-DE.js +1 -1
  27. package/lib/es/locale/en-US.js +1 -1
  28. package/lib/es/locale/es-ES.js +1 -1
  29. package/lib/es/locale/fa-IR.js +1 -1
  30. package/lib/es/locale/fr-FR.js +1 -1
  31. package/lib/es/locale/id-ID.js +1 -1
  32. package/lib/es/locale/it-IT.js +1 -1
  33. package/lib/es/locale/ja-JP.js +1 -1
  34. package/lib/es/locale/ko-KR.js +1 -1
  35. package/lib/es/locale/pl-PL.js +1 -1
  36. package/lib/es/locale/pt-BR.js +1 -1
  37. package/lib/es/locale/ru-RU.js +1 -1
  38. package/lib/es/locale/sk-SK.js +1 -1
  39. package/lib/es/locale/vi-VN.js +1 -1
  40. package/lib/es/locale/zh-CN.js +1 -1
  41. package/lib/es/locale/zh-HK.js +1 -1
  42. package/lib/es/locale/zh-TW.js +1 -1
  43. package/lib/facade.js +1 -1
  44. package/lib/index.css +42 -4
  45. package/lib/index.js +1 -1
  46. package/lib/locale/ar-SA.js +1 -1
  47. package/lib/locale/ca-ES.js +1 -1
  48. package/lib/locale/de-DE.js +1 -1
  49. package/lib/locale/en-US.js +1 -1
  50. package/lib/locale/es-ES.js +1 -1
  51. package/lib/locale/fa-IR.js +1 -1
  52. package/lib/locale/fr-FR.js +1 -1
  53. package/lib/locale/id-ID.js +1 -1
  54. package/lib/locale/it-IT.js +1 -1
  55. package/lib/locale/ja-JP.js +1 -1
  56. package/lib/locale/ko-KR.js +1 -1
  57. package/lib/locale/pl-PL.js +1 -1
  58. package/lib/locale/pt-BR.js +1 -1
  59. package/lib/locale/ru-RU.js +1 -1
  60. package/lib/locale/sk-SK.js +1 -1
  61. package/lib/locale/vi-VN.js +1 -1
  62. package/lib/locale/zh-CN.js +1 -1
  63. package/lib/locale/zh-HK.js +1 -1
  64. package/lib/locale/zh-TW.js +1 -1
  65. package/lib/types/config/config.d.ts +0 -23
  66. package/lib/types/controllers/components.controller.d.ts +3 -3
  67. package/lib/types/facade/f-univer.d.ts +5 -279
  68. package/lib/types/index.d.ts +6 -4
  69. package/lib/types/locale/en-US.d.ts +1 -0
  70. package/lib/types/services/exchange.service.d.ts +12 -89
  71. package/lib/types/services/operate.service.d.ts +20 -110
  72. package/lib/types/services/request.service.d.ts +78 -10
  73. package/lib/types/services/utils/collaboration.d.ts +2 -0
  74. package/lib/types/services/utils/content-type.d.ts +6 -2
  75. package/lib/types/services/utils/snapshot.d.ts +12 -45
  76. package/lib/types/services/utils/tool.d.ts +1 -7
  77. package/lib/types/views/export-format-dialog/ExportFormatDialog.d.ts +14 -0
  78. package/lib/umd/facade.js +1 -1
  79. package/lib/umd/index.js +1 -1
  80. package/lib/umd/locale/ar-SA.js +1 -1
  81. package/lib/umd/locale/ca-ES.js +1 -1
  82. package/lib/umd/locale/de-DE.js +1 -1
  83. package/lib/umd/locale/en-US.js +1 -1
  84. package/lib/umd/locale/es-ES.js +1 -1
  85. package/lib/umd/locale/fa-IR.js +1 -1
  86. package/lib/umd/locale/fr-FR.js +1 -1
  87. package/lib/umd/locale/id-ID.js +1 -1
  88. package/lib/umd/locale/it-IT.js +1 -1
  89. package/lib/umd/locale/ja-JP.js +1 -1
  90. package/lib/umd/locale/ko-KR.js +1 -1
  91. package/lib/umd/locale/pl-PL.js +1 -1
  92. package/lib/umd/locale/pt-BR.js +1 -1
  93. package/lib/umd/locale/ru-RU.js +1 -1
  94. package/lib/umd/locale/sk-SK.js +1 -1
  95. package/lib/umd/locale/vi-VN.js +1 -1
  96. package/lib/umd/locale/zh-CN.js +1 -1
  97. package/lib/umd/locale/zh-HK.js +1 -1
  98. package/lib/umd/locale/zh-TW.js +1 -1
  99. package/package.json +11 -11
  100. package/lib/types/views/UploadNotificationContainer.d.ts +0 -1
@@ -1,84 +1,19 @@
1
- import type { IDisposable } from '@univerjs/core';
1
+ import type { IDisposable, UniverInstanceType } from '@univerjs/core';
2
2
  import type { Observable } from 'rxjs';
3
3
  import type { ExchangeService } from './exchange.service';
4
4
  import type { UploadNotificationService } from './upload-notification.service';
5
- import { Disposable, ILogService, IResourceLoaderService, IUniverInstanceService, LocaleService, UniverInstanceType } from '@univerjs/core';
5
+ import { Disposable, ILogService, IUniverInstanceService, LocaleService } from '@univerjs/core';
6
6
  import { IMessageService } from '@univerjs/ui';
7
+ type UnitImporter = (file: File) => Promise<string | undefined>;
7
8
  export interface IExchangeOperateService {
8
9
  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?: UniverInstanceType): Promise<void>;
44
- /**
45
- * Export docx file by snapshot
46
- * @returns
47
- */
48
- exportDOCXBySnapshot(): Promise<void>;
49
- /**
50
- * Upload pptx file to server, get unitId and open unit
51
- */
52
- importPPTXToUnitId(): Promise<string | undefined>;
53
- /**
54
- * Upload pptx file to server, get snapshot and refresh current slide
55
- */
56
- importPPTXToSnapshot(): Promise<void>;
57
- /**
58
- * Export pptx file by unitId
59
- * @returns A promise that resolves after the export flow finishes.
60
- */
61
- exportPPTXByUnitId(unitId?: string, unitName?: string, unitType?: UniverInstanceType): Promise<void>;
62
- /**
63
- * Export pptx file by snapshot
64
- * @returns A promise that resolves after the export flow finishes.
65
- */
66
- exportPPTXBySnapshot(): Promise<void>;
67
- /**
68
- * Upload file, supports multiple types
69
- * @param file
70
- */
71
- uploadFileToUnitId(types: UniverInstanceType[]): Promise<{
72
- unitId: string;
73
- type: UniverInstanceType;
74
- } | undefined>;
75
- /**
76
- * Upload file using the currently focused unit type.
77
- */
78
- importFileToUnitIdByCurrentType(): Promise<string | undefined>;
10
+ importFileToUnitId(type: UniverInstanceType, importer: UnitImporter): Promise<string | undefined>;
11
+ retryImportFileToUnitId(): Promise<string | undefined>;
12
+ importFileAsSnapshot<T>(type: UniverInstanceType, importer: (file: File) => Promise<T | undefined>): Promise<T | undefined>;
13
+ importFileToSnapshot<T>(type: UniverInstanceType, importer: (file: File) => Promise<T | undefined>): Promise<void>;
14
+ exportFile(exporter: () => Promise<File | undefined>, unitName: string | undefined, fileExt: string): Promise<void>;
79
15
  /**
80
16
  * Customize the imported Unit URL format according to the needs of your own scene
81
- * @param getLink
82
17
  */
83
18
  registerLink(getLink: (unitId: string, univerType: UniverInstanceType) => string): void;
84
19
  /**
@@ -100,49 +35,26 @@ export declare class ExchangeOperateService extends Disposable implements IExcha
100
35
  private readonly _exchangeService;
101
36
  private readonly _uploadNotificationService;
102
37
  protected readonly _logService: ILogService;
103
- private readonly _resourceLoaderService;
104
38
  private readonly _progress$;
105
39
  readonly progress$: Observable<IUploadProgress>;
106
40
  private _totalUploadTaskCount;
107
41
  private _doneUploadTaskCount;
108
- constructor(_univerInstanceService: IUniverInstanceService, _messageService: IMessageService, _localeService: LocaleService, _exchangeService: ExchangeService, _uploadNotificationService: UploadNotificationService, _logService: ILogService, _resourceLoaderService: IResourceLoaderService);
42
+ private _isSelectingUnitImportFile;
43
+ private _lastUnitImportContext;
44
+ constructor(_univerInstanceService: IUniverInstanceService, _messageService: IMessageService, _localeService: LocaleService, _exchangeService: ExchangeService, _uploadNotificationService: UploadNotificationService, _logService: ILogService);
109
45
  interrupt(): void;
110
- uploadFileToUnitId(types: UniverInstanceType[]): Promise<{
111
- unitId: string;
112
- type: UniverInstanceType;
113
- } | undefined>;
114
- importFileToUnitIdByCurrentType(): Promise<string | undefined>;
115
- importDOCXToUnitId(): Promise<string | undefined>;
116
- importDOCXToSnapshot(): Promise<void>;
117
- exportDOCXByUnitId(unitId?: string, unitName?: string, unitType?: UniverInstanceType): Promise<void>;
118
- exportDOCXBySnapshot(): Promise<void>;
119
- importPPTXToUnitId(): Promise<string | undefined>;
120
- importPPTXToSnapshot(): Promise<void>;
121
- exportPPTXByUnitId(unitId?: string, unitName?: string, unitType?: UniverInstanceType): Promise<void>;
122
- exportPPTXBySnapshot(): Promise<void>;
123
- importXLSXToUnitId(): Promise<string | undefined>;
124
- importXLSXToSnapshot(): Promise<void>;
125
- exportXLSXByUnitId(unitId?: string, unitName?: string, unitType?: UniverInstanceType): Promise<void>;
126
- exportXLSXBySnapshot(): Promise<void>;
46
+ importFileToUnitId(type: UniverInstanceType, importer: UnitImporter): Promise<string | undefined>;
47
+ retryImportFileToUnitId(): Promise<string | undefined>;
48
+ importFileToSnapshot<T>(type: UniverInstanceType, importer: (file: File) => Promise<T | undefined>): Promise<void>;
49
+ importFileAsSnapshot<T>(type: UniverInstanceType, importer: (file: File) => Promise<T | undefined>): Promise<T | undefined>;
50
+ exportFile(exporter: () => Promise<File | undefined>, unitName: string | undefined, fileExt: string): Promise<void>;
127
51
  registerLink(getLink: (unitId: string, univerType: UniverInstanceType) => string): void;
128
52
  private _importFileToUnitId;
129
- private _getUnitID;
130
- private _getUnitIDDoc;
131
- private _getUnitIDSlide;
132
- private _getUnitName;
133
- private _getUnitNameByType;
134
- private _getUnitJson;
135
- private _getUnitDocJson;
136
- private _getUnitSlideJson;
53
+ private _refreshUnit;
137
54
  /**
138
55
  * Get unit link /?unit={unitId}&type=2
139
- * @param unitId
140
- * @param type
141
- * @returns
142
56
  */
143
57
  private _getLinkByUnitId;
144
- private _refresh;
145
- private _refreshSlide;
146
58
  private _showNetworkError;
147
59
  private _showDownloadMessage;
148
60
  private _showUploadMessage;
@@ -152,12 +64,10 @@ export declare class ExchangeOperateService extends Disposable implements IExcha
152
64
  private _completeProgress;
153
65
  private _clearProgress;
154
66
  /**
155
- * Although we have specified the supported file types in advance, users can still switch to select all types of files.
156
- In order to prevent such unsupported files from being transmitted to the server, they need to be intercepted in advance.
157
- * @param fileList
158
- * @param type
159
- * @returns
67
+ * Although we have specified the supported file types in advance, users can still switch to select all types of files.
68
+ * In order to prevent such unsupported files from being transmitted to the server, they need to be intercepted in advance.
160
69
  */
161
70
  private _fileTypeError;
162
71
  private _uploadTaskNotDone;
163
72
  }
73
+ export {};
@@ -15,14 +15,84 @@ export declare enum ImportOutputType {
15
15
  JSON = 2,
16
16
  UNRECOGNIZED = -1
17
17
  }
18
+ export declare enum ExchangeFormat {
19
+ XLSX = "xlsx",
20
+ CSV = "csv",
21
+ TSV = "tsv",
22
+ DOCX = "docx",
23
+ PPTX = "pptx",
24
+ PDF = "pdf"
25
+ }
26
+ export declare enum ExchangeBaseImportMode {
27
+ /**
28
+ * Select the source automatically. Imports visible worksheets when no native Excel table exists;
29
+ * otherwise imports native Excel tables and any visible worksheets that do not contain one.
30
+ */
31
+ AUTO = "auto",
32
+ /** Import only native Excel tables. */
33
+ TABLES = "tables",
34
+ /** Import each visible worksheet as a Base table. */
35
+ SHEETS = "sheets",
36
+ /** Import native Excel tables plus visible worksheets that do not contain a native Excel table. */
37
+ HYBRID = "hybrid"
38
+ }
39
+ export declare enum ExchangeBaseFormulaPolicy {
40
+ /**
41
+ * Try to convert formulas. Import falls back to cached values when conversion fails;
42
+ * export fails when a formula cannot be converted.
43
+ */
44
+ CONVERT_THEN_VALUES = "convert-then-values",
45
+ /** Do not convert formulas; use their cached result values. */
46
+ VALUES = "values",
47
+ /** Do not convert formulas; preserve the source formulas as plain text. */
48
+ TEXT = "text",
49
+ /** Require every formula to be converted successfully, otherwise fail the operation. */
50
+ FAIL = "fail"
51
+ }
52
+ export declare enum ExchangeBaseExportMode {
53
+ /** Export each non-empty Base table as a native Excel table. Empty tables remain ordinary ranges. */
54
+ TABLES = "tables",
55
+ /** Export Base tables as ordinary worksheet ranges without native Excel table metadata. */
56
+ RANGES = "ranges"
57
+ }
58
+ export interface IExchangeSheetImportOption {
59
+ minSheetColumnCount?: number;
60
+ minSheetRowCount?: number;
61
+ }
62
+ export interface IExchangeSheetExportOption {
63
+ useImageUrl?: boolean;
64
+ csv?: {
65
+ sheetId?: string;
66
+ };
67
+ }
68
+ export interface IExchangeBaseImportOption {
69
+ xlsx?: {
70
+ baseMode?: ExchangeBaseImportMode;
71
+ baseFormulaPolicy?: ExchangeBaseFormulaPolicy;
72
+ };
73
+ }
74
+ export interface IExchangeBaseExportOption {
75
+ csv?: {
76
+ tableId?: string;
77
+ };
78
+ xlsx?: {
79
+ baseExportMode?: ExchangeBaseExportMode;
80
+ baseFormulaPolicy?: ExchangeBaseFormulaPolicy;
81
+ };
82
+ }
83
+ export interface IExchangeImportOptions {
84
+ sheet?: IExchangeSheetImportOption;
85
+ base?: IExchangeBaseImportOption;
86
+ }
87
+ export interface IExchangeExportOptions {
88
+ sheet?: IExchangeSheetExportOption;
89
+ base?: IExchangeBaseExportOption;
90
+ }
18
91
  export interface IImportRequest {
19
92
  fileID: string;
20
93
  type: UniverInstanceType;
21
94
  outputType: ImportOutputType;
22
- /** not supported yet */
23
- fileUrl: string;
24
- minSheetColumnCount: number;
25
- minSheetRowCount: number;
95
+ options?: IExchangeImportOptions;
26
96
  }
27
97
  export interface IImportResponse {
28
98
  taskID: string;
@@ -30,14 +100,12 @@ export interface IImportResponse {
30
100
  }
31
101
  export interface IExportRequest {
32
102
  /** If unitID is specified, the input is the unit in the database */
33
- unitID: string;
103
+ unitID?: string;
34
104
  /** If jsonID is specified, the input is the json file which represents a univer unit */
35
- jsonID: string;
105
+ jsonID?: string;
36
106
  type: UniverInstanceType;
37
- /** If useImageUrl is set to true, cell images will not be converted to links on export */
38
- useImageUrl?: boolean;
39
- /** If ignoreTableExport is set to true, tables will be ignored on export */
40
- ignoreTableExport?: boolean;
107
+ format: ExchangeFormat;
108
+ options?: IExchangeExportOptions;
41
109
  }
42
110
  export interface IExportResponse {
43
111
  error: IError | undefined;
@@ -0,0 +1,2 @@
1
+ import type { IAccessor, UniverInstanceType } from '@univerjs/core';
2
+ export declare function isCurrentUnitLoadedFromServer(accessor: IAccessor, type: UniverInstanceType): boolean;
@@ -1,11 +1,15 @@
1
1
  import { UniverInstanceType } from '@univerjs/core';
2
2
  export declare const DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
3
+ export declare const DOC = "application/msword";
4
+ export declare const XLS = "application/vnd.ms-excel";
3
5
  export declare const XLSX = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
4
- export declare const XLSM = "application/vnd.ms-excel.sheet.macroEnabled.12";
5
- export declare const XLTX = "application/vnd.openxmlformats-officedocument.spreadsheetml.template";
6
+ export declare const CSV = "text/csv";
7
+ export declare const TSV = "text/tab-separated-values";
8
+ export declare const PPT = "application/vnd.ms-powerpoint";
6
9
  export declare const PPTX = "application/vnd.openxmlformats-officedocument.presentationml.presentation";
7
10
  export declare const PDF = "application/pdf";
8
11
  export declare const UNIT_CONTENT_TYPE: Record<UniverInstanceType, string[]>;
9
12
  export declare const CONTENT_TYPE_EXTNAME: {
10
13
  [key: string]: string;
11
14
  };
15
+ export declare const UNIT_FILE_EXTENSIONS: Record<UniverInstanceType, string[]>;
@@ -1,7 +1,6 @@
1
1
  import type { ILogContext, ISnapshotServerService } from '@univerjs-pro/collaboration';
2
- import type { IDocumentData, IWorkbookData, Nullable } from '@univerjs/core';
3
- import type { ICopyFileMetaResponse, IDocumentMeta, IFetchMissingChangesetsResponse, IGetDeserializedSheetBlockResponse, IGetLatestCsReqIdBySidResponse, IGetResourcesResponse, IGetSheetBlockRequest, IGetSheetBlockResponse, IGetUnitOnRevResponse, ISaveChangesetResponse, ISaveSheetBlockRequest, ISaveSheetBlockResponse, ISaveSnapshotResponse, ISheetBlock, ISlideMeta, ISnapshot, IWorkbookMeta, IWorksheetMeta } from '@univerjs/protocol';
4
- import { transformSnapshotToSlideData } from '@univerjs-pro/collaboration';
2
+ import type { Nullable } from '@univerjs/core';
3
+ import type { IBoardMeta, ICopyFileMetaResponse, IDocumentMeta, IFetchMissingChangesetsResponse, IGetDeserializedSheetBlockResponse, IGetLatestCsReqIdBySidResponse, IGetResourcesResponse, IGetSheetBlockRequest, IGetSheetBlockResponse, IGetUnitOnRevResponse, IPdfMeta, ISaveChangesetResponse, ISaveSheetBlockRequest, ISaveSheetBlockResponse, ISaveSnapshotResponse, ISheetBlock, ISlideMeta, ISnapshot, IWorkbookMeta, IWorksheetMeta } from '@univerjs/protocol';
5
4
  export interface IWorksheetMetaJson extends Omit<IWorksheetMeta, 'originalMeta'> {
6
5
  originalMeta: string;
7
6
  }
@@ -14,15 +13,21 @@ export interface IWorkbookMetaJson extends Omit<IWorkbookMeta, 'originalMeta' |
14
13
  export interface IDocumentMetaJson extends Omit<IDocumentMeta, 'originalMeta'> {
15
14
  originalMeta: string;
16
15
  }
17
- export type IExchangeSlideDocumentData = ReturnType<typeof transformSnapshotToSlideData>;
18
16
  export interface ISlideMetaJson extends Omit<ISlideMeta, 'originalMeta'> {
19
17
  originalMeta: string;
20
18
  }
21
- export interface ISnapshotJson extends Omit<ISnapshot, 'workbook' | 'doc' | 'slide' | 'board'> {
19
+ export interface IBoardMetaJson extends Omit<IBoardMeta, 'originalMeta'> {
20
+ originalMeta: string;
21
+ }
22
+ export interface IPdfMetaJson extends Omit<IPdfMeta, 'originalMeta'> {
23
+ originalMeta: string;
24
+ }
25
+ export interface ISnapshotJson extends Omit<ISnapshot, 'workbook' | 'doc' | 'slide' | 'board' | 'pdf'> {
22
26
  workbook: Partial<IWorkbookMetaJson>;
23
27
  doc: Partial<IDocumentMetaJson>;
24
28
  slide?: Partial<ISlideMetaJson>;
25
- board?: undefined;
29
+ board?: Partial<IBoardMetaJson>;
30
+ pdf?: Partial<IPdfMetaJson>;
26
31
  }
27
32
  export interface ISheetBlockData extends Omit<ISheetBlock, 'data'> {
28
33
  data: string;
@@ -45,50 +50,12 @@ export interface ISnapshotBlockJsonResponse {
45
50
  * @param snapshot
46
51
  */
47
52
  export declare function transformWorkbookSnapshotMetaToString(snapshot: ISnapshot): Nullable<ISnapshotJson>;
48
- /**
49
- * Convert the Uint8Array in the snapshot to a string for easy transmission to the backend
50
- * @param snapshot
51
- */
52
- export declare function transformDocumentSnapshotMetaToString(snapshot: ISnapshot): Nullable<ISnapshotJson>;
53
- /**
54
- * Convert the Uint8Array in the slide snapshot to a string for easy transmission to the backend.
55
- */
56
- export declare function transformSlideSnapshotMetaToString(snapshot: ISnapshot): Nullable<ISnapshotJson>;
57
53
  /**
58
54
  * Convert the Uint8Array in the sheet block to a string for easy transmission to the backend
59
55
  * @param sheetBlocks
60
- * @returns
56
+ * @returns Encoded sheet blocks keyed by block id.
61
57
  */
62
58
  export declare function transformSheetBlockMetaToString(sheetBlocks: ISheetBlock[]): ISheetBlockJson;
63
- /**
64
- * Convert the workbook data to snapshot data.
65
- *
66
- * @deprecated Use `univerAPI.transformWorkbookDataToSnapshotJsonAsync(...)` instead. Planned for removal in v1.1.0.
67
- */
68
- export declare function transformWorkbookDataToSnapshotJson(workbookData: IWorkbookData): Promise<ISnapshotBlockJson>;
69
- /**
70
- * Convert the document data to snapshot data
71
- */
72
- export declare function transformDocumentDataToSnapshotJson(documentData: IDocumentData): Promise<ISnapshotBlockJson>;
73
- /**
74
- * Convert the slide data to snapshot data.
75
- * @returns Snapshot JSON payload with slide meta encoded as a string.
76
- */
77
- export declare function transformSlideDataToSnapshotJson(slideData: IExchangeSlideDocumentData): Promise<ISnapshotBlockJson>;
78
- /**
79
- * Convert the Snapshot data to workbook data.
80
- *
81
- * @deprecated Use `univerAPI.transformSnapshotJsonToWorkbookDataAsync(...)` instead. Planned for removal in v1.1.0.
82
- */
83
- export declare function transformSnapshotJsonToWorkbookData(json: ISnapshotBlockJsonResponse): Promise<IWorkbookData>;
84
- /**
85
- * Convert the Snapshot data to workbook data
86
- */
87
- export declare function transformSnapshotJsonToDocumentData(json: ISnapshotBlockJsonResponse): IDocumentData;
88
- /**
89
- * Convert the Snapshot data to slide data.
90
- */
91
- export declare function transformSnapshotJsonToSlideData(json: ISnapshotBlockJsonResponse): IExchangeSlideDocumentData;
92
59
  /**
93
60
  * 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.
94
61
  */
@@ -1,19 +1,13 @@
1
1
  import type { HTTPService } from '@univerjs/network';
2
2
  import { UniverInstanceType } from '@univerjs/core';
3
3
  export declare function downloadFileByURL(url: string, filename: string, fileExt: string): void;
4
- /**
5
- * Triggers a download of a given File object.
6
- *
7
- * @deprecated Use `univerAPI.downloadFile(...)` instead. Planned for removal in v1.1.0.
8
- * @param {File} file - The File object to be downloaded.
9
- */
10
- export declare function downloadFile(file: File | Blob, filename: string, fileExt: string): void;
11
4
  /**
12
5
  * Get the UniverInstanceType of a file based on its content type and extension.
13
6
  * @param file
14
7
  * @returns
15
8
  */
16
9
  export declare function getUniverInstanceTypeByFile(file: File): UniverInstanceType.UNIVER_UNKNOWN;
10
+ export declare function isSupportedFileType(file: File, univerType: UniverInstanceType): boolean;
17
11
  export declare function getUploadFile(types: UniverInstanceType[], multiple?: boolean): Promise<FileList | null>;
18
12
  export declare function getFileByURL(url: string, httpService: HTTPService): Promise<File | undefined>;
19
13
  export declare function getFileNameFromURL(url: string): string | undefined;
@@ -0,0 +1,14 @@
1
+ import { ExchangeFormat } from '../../services/request.service';
2
+ export declare const EXPORT_FORMAT_DIALOG = "exchange-client.export-format-dialog";
3
+ export interface IExchangeTargetItem {
4
+ label: string;
5
+ value: string;
6
+ }
7
+ export interface IExportFormatDialogProps {
8
+ formats: ExchangeFormat[];
9
+ items: IExchangeTargetItem[];
10
+ selectedId: string;
11
+ onCancel: () => void;
12
+ onConfirm: (format: ExchangeFormat, selectedId: string) => void | Promise<void>;
13
+ }
14
+ export declare function ExportFormatDialog({ formats, items, selectedId: initialSelectedId, onCancel, onConfirm, }: IExportFormatDialogProps): import("react").JSX.Element;
package/lib/umd/facade.js CHANGED
@@ -1 +1 @@
1
- function _0x4e0b(){var _0x439de9=['UNIVER_SLIDE','transformWorkbookDataToSnapshotJson','UniverProExchangeClient','object','UNIVER_DOC','exportPPTXByUnitId','9wGYOgC','exportPPTXBySnapshotAsync','@univerjs-pro/exchange-client','_injector','importDOCXToUnitIdAsync','exportXLSXBySnapshotAsync','UNIVER_SHEET','357818qsTxrk','7649802UuZbNH','importXLSXToUnitIdAsync','@univerjs/core/facade','importPPTXToSnapshotAsync','transformWorkbookDataToSnapshotJsonAsync','10986910lTjTWC','exportPPTXByUnitIdAsync','FUniver','exportDOCXByUnitId','exportXLSXBySnapshot','importFileToUnitId','3632jYuMhh','amd','514507mauswI','11039iSKTOP','importXLSXToSnapshotAsync','@univerjs/core','UniverCoreFacade','transformSnapshotJsonToWorkbookDataAsync','1012436ygyRTa','extend','importPPTXToUnitIdAsync','5RzNUos','importPPTXToSnapshot','importXLSXToSnapshot','transformSnapshotJsonToWorkbookData','exportDOCXBySnapshotAsync','15xNxlGD','5037770wZUVCm','function','get','IExchangeService','importDOCXToSnapshotAsync','exportXLSXByUnitIdAsync','downloadFile','exportPPTXBySnapshot','UniverInstanceType','UniverCore'];_0x4e0b=function(){return _0x439de9;};return _0x4e0b();}function _0x302b(_0xa96895,_0x28dd79){_0xa96895=_0xa96895-0x92;var _0x4e0bda=_0x4e0b();var _0x302b61=_0x4e0bda[_0xa96895];return _0x302b61;}(function(_0x21e997,_0x5a3be0){var _0x35a865=_0x302b,_0x23efcf=_0x21e997();while(!![]){try{var _0x202ecc=parseInt(_0x35a865(0xbb))/0x1+parseInt(_0x35a865(0xad))/0x2*(parseInt(_0x35a865(0x95))/0x3)+-parseInt(_0x35a865(0xc1))/0x4*(parseInt(_0x35a865(0xc4))/0x5)+-parseInt(_0x35a865(0xae))/0x6+-parseInt(_0x35a865(0xbc))/0x7*(parseInt(_0x35a865(0xb9))/0x8)+parseInt(_0x35a865(0xa6))/0x9*(parseInt(_0x35a865(0x96))/0xa)+parseInt(_0x35a865(0xb3))/0xb;if(_0x202ecc===_0x5a3be0)break;else _0x23efcf['push'](_0x23efcf['shift']());}catch(_0x16f391){_0x23efcf['push'](_0x23efcf['shift']());}}}(_0x4e0b,0xa2fd5),function(_0x4049eb,_0x4f6b3f){var _0x5e2395=_0x302b;typeof exports==_0x5e2395(0xa3)&&typeof module<'u'?_0x4f6b3f(require('@univerjs-pro/exchange-client'),require('@univerjs/core'),require('@univerjs/core/facade')):typeof define==_0x5e2395(0x97)&&define[_0x5e2395(0xba)]?define([_0x5e2395(0xa8),_0x5e2395(0xbe),_0x5e2395(0xb0)],_0x4f6b3f):(_0x4049eb=typeof globalThis<'u'?globalThis:_0x4049eb||self,_0x4f6b3f(_0x4049eb[_0x5e2395(0xa2)],_0x4049eb[_0x5e2395(0x9f)],_0x4049eb[_0x5e2395(0xbf)]));}(this,function(_0x101bd5,_0x21909f,_0x10e97b){var _0x1ec0f9=_0x302b,_0x5feb39=class extends _0x10e97b['FUniver']{[_0x1ec0f9(0x9c)](_0x5e19a6,_0xb9dea1,_0x13cdf6){var _0x405e80=_0x1ec0f9;this[_0x405e80(0xa9)][_0x405e80(0x98)](_0x101bd5[_0x405e80(0x99)])['downloadFile'](_0x5e19a6,_0xb9dea1,_0x13cdf6);}async[_0x1ec0f9(0xc0)](_0x324c51){var _0x2ce06f=_0x1ec0f9;return this[_0x2ce06f(0xa9)][_0x2ce06f(0x98)](_0x101bd5['IExchangeService'])[_0x2ce06f(0x93)](_0x324c51);}async[_0x1ec0f9(0xb2)](_0x576f8d){var _0x39dfe5=_0x1ec0f9;return this['_injector'][_0x39dfe5(0x98)](_0x101bd5[_0x39dfe5(0x99)])[_0x39dfe5(0xa1)](_0x576f8d);}async[_0x1ec0f9(0xaf)](_0x3cf6ab){var _0x445834=_0x1ec0f9;return this['_injector'][_0x445834(0x98)](_0x101bd5[_0x445834(0x99)])[_0x445834(0xb8)](_0x3cf6ab,_0x21909f[_0x445834(0x9e)][_0x445834(0xac)]);}async[_0x1ec0f9(0xbd)](_0x263641){var _0x346bdb=_0x1ec0f9;return this[_0x346bdb(0xa9)][_0x346bdb(0x98)](_0x101bd5['IExchangeService'])[_0x346bdb(0x92)](_0x263641);}async[_0x1ec0f9(0x9b)](_0x16a437){var _0x5aa8c9=_0x1ec0f9;return this['_injector']['get'](_0x101bd5[_0x5aa8c9(0x99)])['exportXLSXByUnitId'](_0x16a437);}async[_0x1ec0f9(0xab)](_0x200037){var _0xb48fdc=_0x1ec0f9;return this[_0xb48fdc(0xa9)][_0xb48fdc(0x98)](_0x101bd5[_0xb48fdc(0x99)])[_0xb48fdc(0xb7)](_0x200037);}async[_0x1ec0f9(0xaa)](_0x423b7c){var _0xffa3b4=_0x1ec0f9;return this[_0xffa3b4(0xa9)][_0xffa3b4(0x98)](_0x101bd5[_0xffa3b4(0x99)])['importFileToUnitId'](_0x423b7c,_0x21909f[_0xffa3b4(0x9e)][_0xffa3b4(0xa4)]);}async[_0x1ec0f9(0x9a)](_0x55bc0d){var _0x3a9ef9=_0x1ec0f9;return this[_0x3a9ef9(0xa9)][_0x3a9ef9(0x98)](_0x101bd5[_0x3a9ef9(0x99)])['importDOCXToSnapshot'](_0x55bc0d);}async[_0x1ec0f9(0x94)](_0x25224e){var _0x2b191b=_0x1ec0f9;return this[_0x2b191b(0xa9)][_0x2b191b(0x98)](_0x101bd5[_0x2b191b(0x99)])['exportDOCXBySnapshot'](_0x25224e);}async['exportDOCXByUnitIdAsync'](_0x319140){var _0x17aca7=_0x1ec0f9;return this[_0x17aca7(0xa9)][_0x17aca7(0x98)](_0x101bd5[_0x17aca7(0x99)])[_0x17aca7(0xb6)](_0x319140);}async[_0x1ec0f9(0xc3)](_0x4a7dad){var _0x104d48=_0x1ec0f9;return this['_injector'][_0x104d48(0x98)](_0x101bd5['IExchangeService'])[_0x104d48(0xb8)](_0x4a7dad,_0x21909f[_0x104d48(0x9e)][_0x104d48(0xa0)]);}async[_0x1ec0f9(0xb1)](_0x210dd1){var _0x5b90a7=_0x1ec0f9;return this[_0x5b90a7(0xa9)][_0x5b90a7(0x98)](_0x101bd5[_0x5b90a7(0x99)])[_0x5b90a7(0xc5)](_0x210dd1);}async[_0x1ec0f9(0xb4)](_0x34ac32){var _0x39156d=_0x1ec0f9;return this[_0x39156d(0xa9)][_0x39156d(0x98)](_0x101bd5[_0x39156d(0x99)])[_0x39156d(0xa5)](_0x34ac32);}async[_0x1ec0f9(0xa7)](_0x31ead0){var _0x28255f=_0x1ec0f9;return this[_0x28255f(0xa9)]['get'](_0x101bd5[_0x28255f(0x99)])[_0x28255f(0x9d)](_0x31ead0);}};_0x10e97b[_0x1ec0f9(0xb5)][_0x1ec0f9(0xc2)](_0x5feb39);}));
1
+ function _0xa35d(_0x3a5908,_0x2cd682){_0x3a5908=_0x3a5908-0x148;var _0x42dd26=_0x42dd();var _0xa35d1f=_0x42dd26[_0x3a5908];return _0xa35d1f;}(function(_0x99db09,_0x875413){var _0x128661=_0xa35d,_0x201c8a=_0x99db09();while(!![]){try{var _0xdb54a8=-parseInt(_0x128661(0x156))/0x1*(parseInt(_0x128661(0x150))/0x2)+-parseInt(_0x128661(0x151))/0x3+parseInt(_0x128661(0x157))/0x4+parseInt(_0x128661(0x14e))/0x5*(parseInt(_0x128661(0x14d))/0x6)+-parseInt(_0x128661(0x14a))/0x7+-parseInt(_0x128661(0x153))/0x8*(parseInt(_0x128661(0x158))/0x9)+parseInt(_0x128661(0x14b))/0xa;if(_0xdb54a8===_0x875413)break;else _0x201c8a['push'](_0x201c8a['shift']());}catch(_0x2c8d48){_0x201c8a['push'](_0x201c8a['shift']());}}}(_0x42dd,0x3aa5b),function(_0x21e37e,_0x39b389){var _0x442bb6=_0xa35d;typeof exports==_0x442bb6(0x14f)&&typeof module<'u'?_0x39b389(require('@univerjs-pro/exchange-client'),require('@univerjs/core/facade')):typeof define=='function'&&define['amd']?define(['@univerjs-pro/exchange-client','@univerjs/core/facade'],_0x39b389):(_0x21e37e=typeof globalThis<'u'?globalThis:_0x21e37e||self,_0x39b389(_0x21e37e['UniverProExchangeClient'],_0x21e37e[_0x442bb6(0x155)]));}(this,function(_0x9e699e,_0x598d11){var _0x3d0e92=_0xa35d,_0x375357=class extends _0x598d11[_0x3d0e92(0x14c)]{['downloadFile'](_0x45f75a,_0x1eea23,_0x232f7a){var _0x2df643=_0x3d0e92;this[_0x2df643(0x154)]['get'](_0x9e699e[_0x2df643(0x152)])[_0x2df643(0x149)](_0x45f75a,_0x1eea23,_0x232f7a);}};_0x598d11[_0x3d0e92(0x14c)][_0x3d0e92(0x148)](_0x375357);}));function _0x42dd(){var _0x1fb7e1=['1747QJiAcZ','107500FsXTNQ','603CgsFOc','extend','downloadFile','2029503sDKcKQ','9223010LdjjWS','FUniver','54nARoFY','161145KVAwXd','object','26nFydUM','867807LQdnga','IExchangeService','47416yhJjYE','_injector','UniverCoreFacade'];_0x42dd=function(){return _0x1fb7e1;};return _0x42dd();}