import type { CSSProperties, ReactNode } from 'react'; import React from 'react'; import './index.less'; import { type OfficeFileViewerLocale } from './locale'; import type { OfficeFileViewerReviewOptions } from './services/annotations/types'; import { type OfficeFileViewerError as OfficeFileViewerErrorType } from './services/errors/OfficeFileViewerError'; import type { OfficeFileViewerFontOptions } from './services/fonts/types'; import type { OfficeFileViewerUri } from './services/input/normalizeOfficeFileUri'; import type { OfficeParseOptions, OfficePreviewReadyInfo, ParseProgress } from './services/parsing'; import type { OfficeFileViewerPresentationMediaOptions } from './services/presentation/mediaTypes'; import type { OfficeFileViewerPresentationTransitions } from './services/presentation/transitionTypes'; import { type ParsedOfficeFile } from './services/preview'; import type { OfficeFileViewerWarning } from './services/previewWarnings'; import type { OfficeFileViewerSearchOptions } from './services/search/types'; import { type OfficeHyperlinkActivateEvent } from './shared/hyperlink'; import { type OfficeFileViewerImagePreviewConfig } from './shared/image-preview'; import type { OfficeViewerThemeOptions } from './shared/theme'; import type { OfficeViewerWatermark } from './shared/watermark'; import { type OfficeViewerHandle } from './shell/controller/OfficeViewerHandle'; import { type OfficeFileViewerToolbarOptions } from './shell/Toolbar'; import type { OfficeFileViewerViewState, OfficeFileViewerViewStateChange } from './shell/viewState'; export type { OfficeFileViewerReviewOptions } from './services/annotations/types'; export type { OfficeFileViewerFontOptions, OfficeFileViewerFontSource, } from './services/fonts/types'; export type { OfficeFileViewerUri, OfficeFileViewerUriLoader, } from './services/input/normalizeOfficeFileUri'; export type { OfficeFileViewerPresentationMediaOptions } from './services/presentation/mediaTypes'; export type { OfficeFileViewerPresentationTransitions } from './services/presentation/transitionTypes'; export type { OfficeFileViewerSearchOptions } from './services/search/types'; export type { OfficeViewerThemeOptions } from './shared/theme'; export type { OfficeViewerWatermark, OfficeViewerWatermarkOptions, } from './shared/watermark'; export type { OfficeFileViewerToolbarOptions } from './shell/Toolbar'; /** Office文件预览器组件属性。 */ export type OfficeFileViewerProps = { /** 预览器使用的界面语言,默认使用简体中文。 */ locale?: OfficeFileViewerLocale; /** 待预览文件的来源,可为本地文件、URL 或异步加载函数。 */ uri?: OfficeFileViewerUri; /** 无法从文件来源推断名称时使用的默认文件名。 */ defaultFileName?: string; /** @deprecated 请改用 defaultViewState.zoom。 */ defaultZoom?: number; /** 非受控模式下各视图字段的统一初始值。 */ defaultViewState?: Partial; /** 由宿主按字段控制的视图状态。 */ viewState?: Partial; /** 用户请求改变视图状态时触发。 */ onViewStateChange?: (state: OfficeFileViewerViewState, change: OfficeFileViewerViewStateChange) => void; /** @deprecated 请改用 defaultViewState.speakerNotesVisible。 */ defaultShowSpeakerNotes?: boolean; /** @deprecated 请改用 viewState.speakerNotesVisible。 */ showSpeakerNotes?: boolean; /** @deprecated 请改用 onViewStateChange。 */ onSpeakerNotesVisibilityChange?: (visible: boolean) => void; /** 附加到预览器根元素的自定义类名。 */ className?: string; /** 预览区域高度,支持任意 CSS 高度值;未提供时使用父容器高度。 */ height?: CSSProperties['height']; /** 控制内置工具栏及各操作区域;传 false 时完全隐藏。 */ toolbar?: false | OfficeFileViewerToolbarOptions; /** 追加到全部内置操作之后的宿主工具栏内容。 */ toolbarExtra?: ReactNode; /** 用户通过内置入口选择本地文件时触发。 */ onFileSelect?: (file: File) => void; /** 传递给预览器根元素的内联样式。 */ style?: CSSProperties; /** 配置工具栏、侧栏与工作区主题,不改变源文档正文样式。 */ theme?: OfficeViewerThemeOptions; /** 配置文档内容视口水印;传 false 或不传时不显示。 */ watermark?: OfficeViewerWatermark; /** 完整文件解析成功后触发一次;渐进解析结果不会触发该回调。 */ onFileParsed?: (parsed: ParsedOfficeFile, file: File) => void; /** 首屏预览就绪后触发一次,完整模型和按需数据源都会触发。 */ onPreviewReady?: (info: OfficePreviewReadyInfo, file: File) => void; /** 文件加载或解析失败时触发的回调。 */ onError?: (error: OfficeFileViewerErrorType, file?: File) => void; /** 解析降级、格式兼容或运行时诊断警告产生时触发。 */ onWarning?: (warning: OfficeFileViewerWarning, file: File) => void; /** 传递给底层解析会话的运行配置。 */ parseOptions?: OfficeParseOptions; /** 控制内容图片的双击预览、下载和自定义右键菜单,默认全部开启。 */ imagePreview?: OfficeFileViewerImagePreviewConfig; /** 是否启用源文档声明的超链接,默认开启。 */ hyperlink?: boolean; /** 控制文档全文查找;默认启用,传 false 时移除入口和运行时。 */ search?: false | OfficeFileViewerSearchOptions; /** 控制批注、修订与注释审阅;默认启用,传 false 时移除运行时。 */ review?: false | OfficeFileViewerReviewOptions; /** 控制演示文稿内嵌媒体、外部媒体和下载操作。 */ presentationMedia?: false | OfficeFileViewerPresentationMediaOptions; /** 是否按源文稿播放支持的页级切换,默认关闭。 */ transitions?: OfficeFileViewerPresentationTransitions; /** 配置源字体别名、回退字体、宿主字体资源和缺失字体诊断。 */ fontOptions?: OfficeFileViewerFontOptions; /** 链接被有效激活时触发,可阻止组件执行默认导航。 */ onHyperlinkActivate?: (event: OfficeHyperlinkActivateEvent) => void; /** 解析阶段或完成度变化时触发的进度回调。 */ onParseProgress?: (progress: ParseProgress) => void; /** 可替换的加载、空状态、错误和状态栏内容。 */ slots?: OfficeViewerSlots; }; /** OfficeFileViewer 可由宿主替换的有限状态内容。 */ export type OfficeViewerSlots = { loading?: ReactNode; empty?: ReactNode; error?: ReactNode; statusBar?: ReactNode; }; export declare const OfficeFileViewer: React.MemoExoticComponent>>;