diff --git a/packages/pdf-viewer/CHANGELOG.md b/packages/pdf-viewer/CHANGELOG.md index 8a1255f1..e2a84f28 100644 --- a/packages/pdf-viewer/CHANGELOG.md +++ b/packages/pdf-viewer/CHANGELOG.md @@ -1,5 +1,11 @@ # @orca-fe/pdf-viewer +## 1.21.6 + +### Patch Changes + +- 354a8a2: 新增插件实例ID,解决状态冲突问题等 + ## 1.21.5 ### Patch Changes diff --git a/packages/pdf-viewer/docs/index.md b/packages/pdf-viewer/docs/index.md index 1dcc1b62..08deef55 100644 --- a/packages/pdf-viewer/docs/index.md +++ b/packages/pdf-viewer/docs/index.md @@ -160,6 +160,9 @@ export default () => { | onDataChange | 绘图数据变化时的回调函数 | `(data: ShapeDataType[][], action: 'add' / 'change' / 'delete', pageIndex: number, index: number) => void` | - | | | disabledButton | 是否禁用按钮 | `boolean` | `false` | | | autoCheck | 是否自动选中 | `boolean` | `true` | | +| popupVisible | 是否展示绘图下拉弹出窗 | `boolean` | `true` | | +| drawingVisible | 是否展示绘图按钮 | `boolean` | `true` | | +| drawingPluginId | 插件实例ID (解决插件组合使用,状态冲突问题) | `string` | `PDFPainterPlugin` | | | onChangeStart | 开始绘图时的回调函数 | `(pageIndex: number, index: number) => void` | - | | | defaultChecked | 默认选中的区域 | `[number, number]` | - | | | checked | 选中的区域 | `[number, number]` | - | | diff --git a/packages/pdf-viewer/package.json b/packages/pdf-viewer/package.json index 396f41da..d0926b93 100644 --- a/packages/pdf-viewer/package.json +++ b/packages/pdf-viewer/package.json @@ -1,6 +1,6 @@ { "name": "@orca-fe/pdf-viewer", - "version": "1.21.5", + "version": "1.21.6", "description": "PDF Viewer", "keywords": [ "react", diff --git a/packages/pdf-viewer/src/plugins/PDFPainterPlugin/PDFPainterPlugin.tsx b/packages/pdf-viewer/src/plugins/PDFPainterPlugin/PDFPainterPlugin.tsx index 43d55f71..276c1c81 100644 --- a/packages/pdf-viewer/src/plugins/PDFPainterPlugin/PDFPainterPlugin.tsx +++ b/packages/pdf-viewer/src/plugins/PDFPainterPlugin/PDFPainterPlugin.tsx @@ -36,7 +36,7 @@ export type PDFPainterPluginHandle = { const eArr = []; -const ef = () => {}; +const ef = () => { }; /** * PDFPainterPlugin 绘图插件属性 @@ -70,6 +70,15 @@ export interface PDFPainterPluginProps { /** 开始绘图时的回调函数 */ onChangeStart?: (pageIndex: number, index: number) => void; + /** 是否展示绘图下拉弹出窗 */ + popupVisible?: boolean; + + /** 是否展示绘图按钮 */ + drawingVisible?: boolean; + + /** 插件实例ID */ + drawingPluginId?: string; + buttonName?: string; } @@ -84,7 +93,7 @@ const drawingNamePDFPainterPlugin = 'PDFPainterPlugin'; */ const PDFPainterPlugin = React.forwardRef((props, pRef) => { const [l] = useLocale(zhCN); - const { disabledButton, autoCheck = true, onChangeStart = ef, buttonName = l.paint } = props; + const { disabledButton, autoCheck = true, onChangeStart = ef, buttonName = l.paint, popupVisible = true, drawingVisible = true, drawingPluginId = drawingNamePDFPainterPlugin } = props; const styles = useStyle(); const { internalState, setInternalState } = useContext(PDFViewerContext); @@ -118,11 +127,11 @@ const PDFPainterPlugin = React.forwardRef { - setInternalState({ - drawingPluginName: b ? drawingNamePDFPainterPlugin : '', + setInternalState({ // 这里设置的时候,已经是全局的了 + drawingPluginName: b ? drawingPluginId : '', }); }); @@ -222,10 +231,10 @@ const PDFPainterPlugin = React.forwardRef {!disabledButton && ( -
+