@yudaocode/univer-pdfs-ui 1.6.215 → 1.6.216
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 +425 -191
- package/lib/cjs/index.js.map +1 -1
- package/lib/es/index.js +420 -191
- package/lib/es/index.js.map +1 -1
- package/lib/types/index.d.ts +65 -6
- package/package.json +3 -3
package/lib/types/index.d.ts
CHANGED
|
@@ -1,14 +1,31 @@
|
|
|
1
1
|
import * as _univerjs_core from '@univerjs/core';
|
|
2
2
|
import { Disposable, ICommandService, IOperation, Plugin, Injector, UniverInstanceType } from '@univerjs/core';
|
|
3
3
|
import { IMenuManagerService, IUIPartsService, ISidebarService, ComponentManager, IconManager } from '@univerjs/ui';
|
|
4
|
-
import { PdfElementType, IPdfjsAssetsConfig, IPdfExportOptions, PdfIoTarget, PdfInteractionMode, PdfDisplayUnit, IPdfImportOutcome, IPdfPageSize, IPdfImportOutcomeReport, IPdfIoCapabilities } from '@yudaocode/univer-pdfs';
|
|
4
|
+
import { PdfElementType, IPdfjsAssetsConfig, IPdfExportOptions, PdfIoTarget, PdfInteractionMode, PdfDisplayUnit, IPdfImportOutcome, IPdfPageSize, IPdfImportOutcomeReport, IPdfIoService, IPdfIoCapabilities } from '@yudaocode/univer-pdfs';
|
|
5
5
|
import { Observable } from 'rxjs';
|
|
6
6
|
export { default as PdfsUIEnUS } from './locale/en-US.js';
|
|
7
7
|
export { IPdfsUILocale, default as PdfsUIZhCN } from './locale/zh-CN.js';
|
|
8
8
|
import React from 'react';
|
|
9
9
|
|
|
10
|
-
type PdfModalTabMode = 'preview' | 'import' | 'json';
|
|
10
|
+
type PdfModalTabMode = 'preview' | 'import' | 'export' | 'json';
|
|
11
11
|
type PdfShapeKind = 'rect' | 'ellipse' | 'line' | 'highlight';
|
|
12
|
+
declare const ALL_PDF_IO_MODAL_TABS: readonly PdfModalTabMode[];
|
|
13
|
+
interface IPdfIoModalConfig {
|
|
14
|
+
/** Allowed tabs in the IO / Preview modal (defaults to `['preview', 'import', 'export', 'json']`) */
|
|
15
|
+
tabs?: PdfModalTabMode[];
|
|
16
|
+
/** Default tab selected when opening the modal without an explicit `tab` parameter */
|
|
17
|
+
defaultTab?: PdfModalTabMode | string;
|
|
18
|
+
/** Whether to display the `IO 管道: ...` badge in the modal header (default `true`) */
|
|
19
|
+
showPipelineBadge?: boolean;
|
|
20
|
+
}
|
|
21
|
+
interface IResolvedPdfIoModalConfig {
|
|
22
|
+
tabs: PdfModalTabMode[];
|
|
23
|
+
defaultTab: PdfModalTabMode;
|
|
24
|
+
showPipelineBadge: boolean;
|
|
25
|
+
hasExplicitTabs: boolean;
|
|
26
|
+
}
|
|
27
|
+
declare function resolvePdfIoModalConfig(raw?: IPdfIoModalConfig, base?: IResolvedPdfIoModalConfig): IResolvedPdfIoModalConfig;
|
|
28
|
+
declare function clampPdfModalTab(requested: string | undefined, config: IResolvedPdfIoModalConfig): PdfModalTabMode;
|
|
12
29
|
interface IReportWidgetsConfig {
|
|
13
30
|
qrcode?: boolean;
|
|
14
31
|
barcode?: boolean;
|
|
@@ -93,11 +110,15 @@ interface IPdfsUIFeatureService {
|
|
|
93
110
|
readonly features$: Observable<IResolvedPdfsUIFeatures>;
|
|
94
111
|
readonly modalTab$: Observable<PdfModalTabMode>;
|
|
95
112
|
readonly editorEnabled$: Observable<boolean>;
|
|
113
|
+
readonly ioModal$: Observable<IResolvedPdfIoModalConfig>;
|
|
96
114
|
getFeatures(): IResolvedPdfsUIFeatures;
|
|
97
115
|
setFeatures(features: IUniverPdfsUIFeatures): void;
|
|
98
116
|
patchFeatures(patch: Partial<IResolvedPdfsUIFeatures>): void;
|
|
99
117
|
getModalTab(): PdfModalTabMode;
|
|
100
118
|
setModalTab(tab: PdfModalTabMode): void;
|
|
119
|
+
getIoModalConfig(): IResolvedPdfIoModalConfig;
|
|
120
|
+
setIoModalConfig(config?: IPdfIoModalConfig): void;
|
|
121
|
+
applyModalOpenConfig(override?: IPdfIoModalConfig): IResolvedPdfIoModalConfig;
|
|
101
122
|
isEditorEnabled(): boolean;
|
|
102
123
|
setEditorEnabled(enabled: boolean): void;
|
|
103
124
|
}
|
|
@@ -106,16 +127,22 @@ declare class PdfsUIFeatureService extends Disposable implements IPdfsUIFeatureS
|
|
|
106
127
|
private readonly _features$;
|
|
107
128
|
private readonly _modalTab$;
|
|
108
129
|
private readonly _editorEnabled$;
|
|
130
|
+
private _baseIoModal;
|
|
131
|
+
private readonly _ioModal$;
|
|
109
132
|
readonly features$: Observable<IResolvedPdfsUIFeatures>;
|
|
110
133
|
readonly modalTab$: Observable<PdfModalTabMode>;
|
|
111
134
|
readonly editorEnabled$: Observable<boolean>;
|
|
112
|
-
|
|
135
|
+
readonly ioModal$: Observable<IResolvedPdfIoModalConfig>;
|
|
136
|
+
constructor(initial?: IUniverPdfsUIFeatures, editorEnabled?: boolean, ioModal?: IPdfIoModalConfig);
|
|
113
137
|
dispose(): void;
|
|
114
138
|
getFeatures(): IResolvedPdfsUIFeatures;
|
|
115
139
|
setFeatures(features: IUniverPdfsUIFeatures): void;
|
|
116
140
|
patchFeatures(patch: Partial<IResolvedPdfsUIFeatures>): void;
|
|
117
141
|
getModalTab(): PdfModalTabMode;
|
|
118
142
|
setModalTab(tab: PdfModalTabMode): void;
|
|
143
|
+
getIoModalConfig(): IResolvedPdfIoModalConfig;
|
|
144
|
+
setIoModalConfig(config?: IPdfIoModalConfig): void;
|
|
145
|
+
applyModalOpenConfig(override?: IPdfIoModalConfig): IResolvedPdfIoModalConfig;
|
|
119
146
|
isEditorEnabled(): boolean;
|
|
120
147
|
setEditorEnabled(enabled: boolean): void;
|
|
121
148
|
}
|
|
@@ -135,6 +162,10 @@ interface IUniverPdfsUIConfig {
|
|
|
135
162
|
* Optional enterprise report, print-overlay, and granular UI capability flags.
|
|
136
163
|
*/
|
|
137
164
|
features?: IUniverPdfsUIFeatures;
|
|
165
|
+
/**
|
|
166
|
+
* Optional compact IO / Preview modal configuration (`tabs`, `defaultTab`, `showPipelineBadge`).
|
|
167
|
+
*/
|
|
168
|
+
ioModal?: IPdfIoModalConfig;
|
|
138
169
|
}
|
|
139
170
|
declare class PdfsUIController extends Disposable {
|
|
140
171
|
private readonly _config;
|
|
@@ -157,17 +188,22 @@ declare const PDF_INSPECTOR_SIDEBAR_ID = "univer.pdfs.inspector.sidebar";
|
|
|
157
188
|
declare const PDF_INSPECTOR_COMPONENT_KEY = "univer.pdfs.inspector.component";
|
|
158
189
|
declare function openPdfInspectorSidebar(sidebarService: ISidebarService): void;
|
|
159
190
|
declare const TogglePdfInspectorOperation: IOperation;
|
|
160
|
-
|
|
191
|
+
interface IOpenPdfPreviewOperationParams {
|
|
161
192
|
tab?: PdfModalTabMode;
|
|
162
|
-
|
|
193
|
+
ioModal?: IPdfIoModalConfig;
|
|
194
|
+
}
|
|
195
|
+
declare const OpenPdfPreviewOperation: IOperation<IOpenPdfPreviewOperationParams>;
|
|
163
196
|
declare function readBrowserFileAsOverlayOutcome(file: File, options?: {
|
|
164
197
|
password?: string;
|
|
198
|
+
signal?: AbortSignal;
|
|
165
199
|
}): Promise<IPdfImportOutcome>;
|
|
166
200
|
interface IUploadBasePdfOperationParams {
|
|
167
201
|
file?: File;
|
|
168
202
|
password?: string;
|
|
169
203
|
target?: PdfIoTarget;
|
|
170
204
|
unitId?: string;
|
|
205
|
+
signal?: AbortSignal;
|
|
206
|
+
ioModal?: IPdfIoModalConfig;
|
|
171
207
|
}
|
|
172
208
|
declare const UploadBasePdfOperation: IOperation<IUploadBasePdfOperationParams, boolean | Promise<boolean>>;
|
|
173
209
|
declare const SavePdfToHostOperation: IOperation;
|
|
@@ -210,6 +246,7 @@ declare const UpdatePdfUIFeaturesOperation: IOperation<{
|
|
|
210
246
|
features?: IUniverPdfsUIFeatures;
|
|
211
247
|
patch?: Partial<IResolvedPdfsUIFeatures>;
|
|
212
248
|
editorEnabled?: boolean;
|
|
249
|
+
ioModal?: IPdfIoModalConfig;
|
|
213
250
|
}>;
|
|
214
251
|
|
|
215
252
|
declare const UNIVER_PDFS_UI_PLUGIN_NAME = "UNIVER_PDFS_UI_PLUGIN";
|
|
@@ -249,12 +286,34 @@ interface IPdfModalIoErrorState {
|
|
|
249
286
|
fallbackTarget: 'browser' | 'server';
|
|
250
287
|
}
|
|
251
288
|
declare function resolveInitialModalIoTarget(caps: IPdfIoCapabilities, tab?: PdfModalTabMode): 'browser' | 'server';
|
|
289
|
+
interface IStagedImportSeqRef {
|
|
290
|
+
current: number;
|
|
291
|
+
}
|
|
292
|
+
declare function executeGuardedStagedImport(params: {
|
|
293
|
+
file: File;
|
|
294
|
+
unitId: string;
|
|
295
|
+
target: 'browser' | 'server';
|
|
296
|
+
ioService: IPdfIoService;
|
|
297
|
+
importReqSeqRef: IStagedImportSeqRef;
|
|
298
|
+
importAbortRef?: {
|
|
299
|
+
current: AbortController | null;
|
|
300
|
+
};
|
|
301
|
+
onStart?: () => void;
|
|
302
|
+
onSuccess: (report: IPdfImportOutcomeReport) => void;
|
|
303
|
+
onError: (errState: IPdfModalIoErrorState) => void;
|
|
304
|
+
onSettled?: () => void;
|
|
305
|
+
}): Promise<IPdfImportOutcomeReport | null>;
|
|
306
|
+
declare function applyStagedPdfImportToUnit(commandService: ICommandService, unitId: string, staged: IPdfImportOutcomeReport): {
|
|
307
|
+
applied: boolean;
|
|
308
|
+
error?: IPdfModalIoErrorState;
|
|
309
|
+
};
|
|
252
310
|
interface IPdfUnifiedIoSectionProps {
|
|
253
311
|
ioTarget: 'browser' | 'server';
|
|
254
312
|
browserAvailable: boolean;
|
|
255
313
|
serverAvailable: boolean;
|
|
256
314
|
snapSizeKb: string;
|
|
257
315
|
editorEnabled: boolean;
|
|
316
|
+
showImportSection?: boolean;
|
|
258
317
|
importing: boolean;
|
|
259
318
|
rendering: boolean;
|
|
260
319
|
selectedFileName?: string;
|
|
@@ -271,4 +330,4 @@ interface IPdfUnifiedIoSectionProps {
|
|
|
271
330
|
declare const PdfUnifiedIoSection: React.FC<IPdfUnifiedIoSectionProps>;
|
|
272
331
|
declare const PdfPreviewModal: React.FC;
|
|
273
332
|
|
|
274
|
-
export { AdjustPdfZoomOperation, type IPdfModalIoErrorState, type IPdfUnifiedIoSectionProps, IPdfsUIFeatureService, type IPrintPdfOperationParams, type IReportWidgetsConfig, type IResolvedPdfsUIFeatures, type IUniverPdfsUIConfig, type IUniverPdfsUIEditorConfig, type IUniverPdfsUIFeatures, type IUploadBasePdfOperationParams, InsertPdfPresetElementOperation, OpenPdfPreviewOperation, PDF_INSPECTOR_COMPONENT_KEY, PDF_INSPECTOR_SIDEBAR_ID, PdfCanvasView, PdfInspectorPanel, PdfInspectorPanel as PdfInspectorSidebar, PdfLeftSidebar, type PdfModalTabMode, PdfPreviewModal, type PdfShapeKind, PdfStatusBar, PdfUnifiedIoSection, PdfsUIController, PdfsUIFeatureService, PrintPdfOperation, SavePdfToHostOperation, SelectActivePdfPageOperation, SetPdfInkColorOperation, SetPdfInteractionModeOperation, SwitchPdfDisplayUnitOperation, TogglePdfCalibrationGridOperation, TogglePdfGridOperation, TogglePdfInspectorOperation, TogglePdfMarginsOperation, TogglePdfRulerOperation, TogglePdfSnapOperation, UNIVER_PDFS_UI_PLUGIN_NAME, UniverPdfsUIPlugin, UpdatePdfUIFeaturesOperation, UploadBasePdfOperation, clearPdfDocumentCache, computePdfDocumentCacheKey, configurePdfjsAssets, getPdfjsAssetsConfig, inspectSourcePdfPages, isPdfElementTypeAllowed, isPdfShapeTypeAllowed, openPdfInspectorSidebar, readBrowserFileAsOverlayOutcome, renderSourcePdfPageToCanvas, resolveInitialModalIoTarget, resolvePdfsUIFeatures };
|
|
333
|
+
export { ALL_PDF_IO_MODAL_TABS, AdjustPdfZoomOperation, type IOpenPdfPreviewOperationParams, type IPdfIoModalConfig, type IPdfModalIoErrorState, type IPdfUnifiedIoSectionProps, IPdfsUIFeatureService, type IPrintPdfOperationParams, type IReportWidgetsConfig, type IResolvedPdfIoModalConfig, type IResolvedPdfsUIFeatures, type IStagedImportSeqRef, type IUniverPdfsUIConfig, type IUniverPdfsUIEditorConfig, type IUniverPdfsUIFeatures, type IUploadBasePdfOperationParams, InsertPdfPresetElementOperation, OpenPdfPreviewOperation, PDF_INSPECTOR_COMPONENT_KEY, PDF_INSPECTOR_SIDEBAR_ID, PdfCanvasView, PdfInspectorPanel, PdfInspectorPanel as PdfInspectorSidebar, PdfLeftSidebar, type PdfModalTabMode, PdfPreviewModal, type PdfShapeKind, PdfStatusBar, PdfUnifiedIoSection, PdfsUIController, PdfsUIFeatureService, PrintPdfOperation, SavePdfToHostOperation, SelectActivePdfPageOperation, SetPdfInkColorOperation, SetPdfInteractionModeOperation, SwitchPdfDisplayUnitOperation, TogglePdfCalibrationGridOperation, TogglePdfGridOperation, TogglePdfInspectorOperation, TogglePdfMarginsOperation, TogglePdfRulerOperation, TogglePdfSnapOperation, UNIVER_PDFS_UI_PLUGIN_NAME, UniverPdfsUIPlugin, UpdatePdfUIFeaturesOperation, UploadBasePdfOperation, applyStagedPdfImportToUnit, clampPdfModalTab, clearPdfDocumentCache, computePdfDocumentCacheKey, configurePdfjsAssets, executeGuardedStagedImport, getPdfjsAssetsConfig, inspectSourcePdfPages, isPdfElementTypeAllowed, isPdfShapeTypeAllowed, openPdfInspectorSidebar, readBrowserFileAsOverlayOutcome, renderSourcePdfPageToCanvas, resolveInitialModalIoTarget, resolvePdfIoModalConfig, resolvePdfsUIFeatures };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yudaocode/univer-pdfs-ui",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.216",
|
|
4
4
|
"description": "Univer PDFs UI plugin with native Univer Ribbon, Left Thumbnail Sidebar, Canvas Designer, and Inspector Sidebar",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/yudaocode/yudao-univer#readme",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"react": ">=18.0.0",
|
|
62
62
|
"react-dom": ">=18.0.0",
|
|
63
63
|
"rxjs": ">=7.0.0",
|
|
64
|
-
"@yudaocode/univer-pdfs": "^1.6.
|
|
64
|
+
"@yudaocode/univer-pdfs": "^1.6.216"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@univerjs/core": "1.6.2",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"react": "^18.3.1",
|
|
73
73
|
"react-dom": "^18.3.1",
|
|
74
74
|
"rxjs": "^7.8.1",
|
|
75
|
-
"@yudaocode/univer-pdfs": "1.6.
|
|
75
|
+
"@yudaocode/univer-pdfs": "1.6.216"
|
|
76
76
|
},
|
|
77
77
|
"scripts": {
|
|
78
78
|
"build": "tsup",
|