@astral/ui 4.35.1 → 4.36.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.
- package/components/PdfViewer/List/List.js +2 -1
- package/components/PdfViewer/PdfDocument/PdfDocument.js +2 -1
- package/components/PdfViewer/PdfDocument/styles.js +13 -0
- package/components/PdfViewer/PdfDocument/types.d.ts +1 -0
- package/components/PdfViewer/PdfViewer.js +2 -2
- package/components/PdfViewer/constants.d.ts +2 -0
- package/components/PdfViewer/constants.js +2 -0
- package/components/PdfViewer/types.d.ts +4 -0
- package/components/PdfViewer/useLogic/useLogic.d.ts +2 -1
- package/components/PdfViewer/useLogic/useLogic.js +2 -1
- package/components/fileUploading/PreviewFileUploaderFile/FilePreview/Preview/useLogic/useLogic.d.ts +1 -0
- package/components/fileUploading/PreviewFileUploaderFile/FilePreview/Preview/useLogic/useLogic.js +1 -0
- package/node/components/PdfViewer/List/List.js +2 -1
- package/node/components/PdfViewer/PdfDocument/PdfDocument.js +2 -1
- package/node/components/PdfViewer/PdfDocument/styles.js +13 -0
- package/node/components/PdfViewer/PdfDocument/types.d.ts +1 -0
- package/node/components/PdfViewer/PdfViewer.js +2 -2
- package/node/components/PdfViewer/constants.d.ts +2 -0
- package/node/components/PdfViewer/constants.js +2 -0
- package/node/components/PdfViewer/types.d.ts +4 -0
- package/node/components/PdfViewer/useLogic/useLogic.d.ts +2 -1
- package/node/components/PdfViewer/useLogic/useLogic.js +2 -1
- package/node/components/fileUploading/PreviewFileUploaderFile/FilePreview/Preview/useLogic/useLogic.d.ts +1 -0
- package/node/components/fileUploading/PreviewFileUploaderFile/FilePreview/Preview/useLogic/useLogic.js +1 -0
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
|
+
import { pdfViewerClassnames } from '../constants';
|
|
3
4
|
import { Wrapper } from './styles';
|
|
4
5
|
export const List = ({ paginationRef, children, initialIndex }) => {
|
|
5
6
|
useEffect(() => {
|
|
@@ -11,5 +12,5 @@ export const List = ({ paginationRef, children, initialIndex }) => {
|
|
|
11
12
|
element.scrollIntoView({ behavior: 'auto', block: 'start' });
|
|
12
13
|
}
|
|
13
14
|
}, []);
|
|
14
|
-
return _jsx(Wrapper, { ref: paginationRef, children: children });
|
|
15
|
+
return (_jsx(Wrapper, { ref: paginationRef, className: pdfViewerClassnames.list, children: children }));
|
|
15
16
|
};
|
|
@@ -5,8 +5,9 @@ import { StyledDocument } from './styles';
|
|
|
5
5
|
import { useLogic } from './useLogic';
|
|
6
6
|
export const PDFDocument = (props) => {
|
|
7
7
|
const { documentRef, onAnimationEnd, isLoading } = useLogic(props);
|
|
8
|
-
const { enabledZoom, ...restProps } = props;
|
|
8
|
+
const { enabledZoom, isCentered, ...restProps } = props;
|
|
9
9
|
return (_jsx(StyledDocument, { ...restProps, "$isLoading": isLoading, className: classNames(pdfViewerClassnames.document, {
|
|
10
10
|
[pdfViewerClassnames.zoom]: enabledZoom,
|
|
11
|
+
[pdfViewerClassnames.centered]: isCentered,
|
|
11
12
|
}), inputRef: documentRef, onAnimationEnd: onAnimationEnd }));
|
|
12
13
|
};
|
|
@@ -9,6 +9,19 @@ export const StyledDocument = styled(Document, {
|
|
|
9
9
|
/* Сделано что бы скролл не перекрывал тень контейнера для страниц */
|
|
10
10
|
margin: ${({ theme, $isLoading }) => $isLoading ? '0' : theme.microSpacing(1, 1, 2, 2)};
|
|
11
11
|
|
|
12
|
+
&.${pdfViewerClassnames.centered} {
|
|
13
|
+
height: 100%;
|
|
14
|
+
|
|
15
|
+
.${pdfViewerClassnames.list} {
|
|
16
|
+
height: 100%;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.${pdfViewerClassnames.page} {
|
|
20
|
+
margin-top: auto;
|
|
21
|
+
margin-bottom: auto;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
12
25
|
.react-pdf__message--loading {
|
|
13
26
|
height: 100%;
|
|
14
27
|
}
|
|
@@ -17,8 +17,8 @@ pdfjs.GlobalWorkerOptions.workerSrc = PDFJS_WORKER_URL;
|
|
|
17
17
|
* Компонент для просмотра PDF файлов
|
|
18
18
|
*/
|
|
19
19
|
export const PdfViewer = (props) => {
|
|
20
|
-
const { documentProps, pageProps, pageCount, pageHeightList, isError, errorState, paginationRef, isLoading, initialIndex, isRenderList, isViewerLite, scale, zoomOut, zoomIn, isDisabledZoomOutButton, isDisabledZoomInButton, scrollContainerRef, loadingPlaceholderTitle, enabledZoom, } = useLogic(props);
|
|
21
|
-
return (_jsx(ContentState, { isError: isError, errorState: errorState, children: _jsxs(Wrapper, { "$isViewerLite": isViewerLite, "$enabledZoom": enabledZoom, children: [_jsx(PDFViewerContainer, { "$isViewerLite": isViewerLite, "$enabledZoom": enabledZoom, children: _jsx(ScrollContainer, { ref: scrollContainerRef, "$isViewerLite": isViewerLite, "$enabledZoom": enabledZoom, children: _jsx(PDFDocument, { ...documentProps, isLoading: isLoading, loading: _jsx(LoadingPlaceholder, { title: loadingPlaceholderTitle }), isViewerLite: isViewerLite, enabledZoom: enabledZoom, children: isRenderList && (_jsx(List, { paginationRef: paginationRef, initialIndex: initialIndex, children: pageHeightList?.map((height, index) => (_createElement(PDFPage, { ...pageProps,
|
|
20
|
+
const { documentProps, pageProps, pageCount, pageHeightList, isError, errorState, paginationRef, isLoading, initialIndex, isRenderList, isViewerLite, scale, zoomOut, zoomIn, isDisabledZoomOutButton, isDisabledZoomInButton, scrollContainerRef, loadingPlaceholderTitle, enabledZoom, isCentered, } = useLogic(props);
|
|
21
|
+
return (_jsx(ContentState, { isError: isError, errorState: errorState, children: _jsxs(Wrapper, { "$isViewerLite": isViewerLite, "$enabledZoom": enabledZoom, children: [_jsx(PDFViewerContainer, { "$isViewerLite": isViewerLite, "$enabledZoom": enabledZoom, children: _jsx(ScrollContainer, { ref: scrollContainerRef, "$isViewerLite": isViewerLite, "$enabledZoom": enabledZoom, children: _jsx(PDFDocument, { ...documentProps, isLoading: isLoading, isCentered: isCentered, loading: _jsx(LoadingPlaceholder, { title: loadingPlaceholderTitle }), isViewerLite: isViewerLite, enabledZoom: enabledZoom, children: isRenderList && (_jsx(List, { paginationRef: paginationRef, initialIndex: initialIndex, children: pageHeightList?.map((height, index) => (_createElement(PDFPage, { ...pageProps,
|
|
22
22
|
// biome-ignore lint/suspicious/noArrayIndexKey: Страницы статичны
|
|
23
23
|
key: index, height: height * scale, pageNumber: index + 1, pageCount: pageCount, isViewerLite: isViewerLite, scale: scale, enabledZoom: enabledZoom }))) }, pageHeightList?.[0])) }) }) }), _jsx(ControlBar, { zoomOut: zoomOut, zoomIn: zoomIn, pageNumber: Number(initialIndex) + 1, buttonProps: {
|
|
24
24
|
isDisabledZoomIn: isDisabledZoomInButton,
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export declare const pdfViewerClassnames: {
|
|
2
|
+
list: string;
|
|
2
3
|
document: string;
|
|
3
4
|
page: string;
|
|
4
5
|
animation: string;
|
|
5
6
|
zoom: string;
|
|
7
|
+
centered: string;
|
|
6
8
|
};
|
|
7
9
|
export declare const PDFJS_WORKER_URL = "https://frontend-static.astral.ru/libs/pdfjs-dist/4.8.69/pdf.worker.min.mjs";
|
|
8
10
|
export declare const TEXT_LAYER_CSS_URL = "https://frontend-static.astral.ru/libs/react-pdf/9.2.1/text-layer.min.css";
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { createUIKitClassname } from '../utils/createUIKitClassname';
|
|
2
2
|
export const pdfViewerClassnames = {
|
|
3
|
+
list: createUIKitClassname('pdf-viewer__list'),
|
|
3
4
|
document: createUIKitClassname('pdf-viewer__document'),
|
|
4
5
|
page: createUIKitClassname('pdf-viewer__page'),
|
|
5
6
|
animation: createUIKitClassname('pdf-viewer_animation'),
|
|
6
7
|
zoom: createUIKitClassname('pdf-viewer__zoom_enabled'),
|
|
8
|
+
centered: createUIKitClassname('pdf-viewer_centered'),
|
|
7
9
|
};
|
|
8
10
|
// Worker и CSS загружаются из сервиса статики https://git.astralnalog.ru/frontend.shared/static-files
|
|
9
11
|
export const PDFJS_WORKER_URL = 'https://frontend-static.astral.ru/libs/pdfjs-dist/4.8.69/pdf.worker.min.mjs';
|
|
@@ -59,6 +59,10 @@ export type PdfViewerProps = {
|
|
|
59
59
|
* Отображение страниц в полную высоту
|
|
60
60
|
*/
|
|
61
61
|
isFullHeight?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Центрирование содержимого контейнера
|
|
64
|
+
*/
|
|
65
|
+
isCentered?: boolean;
|
|
62
66
|
/**
|
|
63
67
|
* Диапазон индексов страниц, которые необходимо отобразить
|
|
64
68
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type PdfViewerOnLoadSuccessProps, type PdfViewerProps } from '../types';
|
|
3
|
-
export declare const useLogic: ({ file, scrollRef, paginationRef, isFullHeight, renderPageRange, isHidePersonalData, isViewerLite, enabledZoom, options, ...props }: PdfViewerProps) => {
|
|
3
|
+
export declare const useLogic: ({ file, scrollRef, paginationRef, isFullHeight, isCentered, renderPageRange, isHidePersonalData, isViewerLite, enabledZoom, options, ...props }: PdfViewerProps) => {
|
|
4
4
|
documentProps: {
|
|
5
5
|
file: string | Blob | null | undefined;
|
|
6
6
|
options: {
|
|
@@ -42,4 +42,5 @@ export declare const useLogic: ({ file, scrollRef, paginationRef, isFullHeight,
|
|
|
42
42
|
shouldAnimateZoom: boolean;
|
|
43
43
|
loadingPlaceholderTitle: string | undefined;
|
|
44
44
|
enabledZoom: boolean;
|
|
45
|
+
isCentered: boolean | undefined;
|
|
45
46
|
};
|
|
@@ -2,7 +2,7 @@ import { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
|
2
2
|
import { ConfigContext } from '../../ConfigProvider';
|
|
3
3
|
import { useZoom } from '../hooks/useZoom';
|
|
4
4
|
import { getPageHeightList } from '../utils';
|
|
5
|
-
export const useLogic = ({ file, scrollRef, paginationRef, isFullHeight, renderPageRange, isHidePersonalData, isViewerLite, enabledZoom = true, options, ...props }) => {
|
|
5
|
+
export const useLogic = ({ file, scrollRef, paginationRef, isFullHeight, isCentered, renderPageRange, isHidePersonalData, isViewerLite, enabledZoom = true, options, ...props }) => {
|
|
6
6
|
const [containerWidth, setContainerWidth] = useState(1);
|
|
7
7
|
const scrollContainerRef = useRef(null);
|
|
8
8
|
const { zoomOut, scale, zoomIn, shouldAnimateZoom } = useZoom({
|
|
@@ -100,5 +100,6 @@ export const useLogic = ({ file, scrollRef, paginationRef, isFullHeight, renderP
|
|
|
100
100
|
shouldAnimateZoom,
|
|
101
101
|
loadingPlaceholderTitle,
|
|
102
102
|
enabledZoom,
|
|
103
|
+
isCentered,
|
|
103
104
|
};
|
|
104
105
|
};
|
package/components/fileUploading/PreviewFileUploaderFile/FilePreview/Preview/useLogic/useLogic.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare const useLogic: ({ file, fileUrl, isHidePersonalData, }: UseLogic
|
|
|
13
13
|
pdfViewerProps: {
|
|
14
14
|
isViewerLite: boolean;
|
|
15
15
|
isFullHeight: boolean;
|
|
16
|
+
isCentered: boolean;
|
|
16
17
|
file: string | File | null | undefined;
|
|
17
18
|
scrollRef: import("react").RefObject<null>;
|
|
18
19
|
renderPageRange: {
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.List = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
+
const constants_1 = require("../constants");
|
|
6
7
|
const styles_1 = require("./styles");
|
|
7
8
|
const List = ({ paginationRef, children, initialIndex }) => {
|
|
8
9
|
(0, react_1.useEffect)(() => {
|
|
@@ -14,6 +15,6 @@ const List = ({ paginationRef, children, initialIndex }) => {
|
|
|
14
15
|
element.scrollIntoView({ behavior: 'auto', block: 'start' });
|
|
15
16
|
}
|
|
16
17
|
}, []);
|
|
17
|
-
return (0, jsx_runtime_1.jsx)(styles_1.Wrapper, { ref: paginationRef, children: children });
|
|
18
|
+
return ((0, jsx_runtime_1.jsx)(styles_1.Wrapper, { ref: paginationRef, className: constants_1.pdfViewerClassnames.list, children: children }));
|
|
18
19
|
};
|
|
19
20
|
exports.List = List;
|
|
@@ -8,9 +8,10 @@ const styles_1 = require("./styles");
|
|
|
8
8
|
const useLogic_1 = require("./useLogic");
|
|
9
9
|
const PDFDocument = (props) => {
|
|
10
10
|
const { documentRef, onAnimationEnd, isLoading } = (0, useLogic_1.useLogic)(props);
|
|
11
|
-
const { enabledZoom, ...restProps } = props;
|
|
11
|
+
const { enabledZoom, isCentered, ...restProps } = props;
|
|
12
12
|
return ((0, jsx_runtime_1.jsx)(styles_1.StyledDocument, { ...restProps, "$isLoading": isLoading, className: (0, classNames_1.classNames)(constants_1.pdfViewerClassnames.document, {
|
|
13
13
|
[constants_1.pdfViewerClassnames.zoom]: enabledZoom,
|
|
14
|
+
[constants_1.pdfViewerClassnames.centered]: isCentered,
|
|
14
15
|
}), inputRef: documentRef, onAnimationEnd: onAnimationEnd }));
|
|
15
16
|
};
|
|
16
17
|
exports.PDFDocument = PDFDocument;
|
|
@@ -12,6 +12,19 @@ exports.StyledDocument = (0, styled_1.styled)(react_pdf_1.Document, {
|
|
|
12
12
|
/* Сделано что бы скролл не перекрывал тень контейнера для страниц */
|
|
13
13
|
margin: ${({ theme, $isLoading }) => $isLoading ? '0' : theme.microSpacing(1, 1, 2, 2)};
|
|
14
14
|
|
|
15
|
+
&.${constants_1.pdfViewerClassnames.centered} {
|
|
16
|
+
height: 100%;
|
|
17
|
+
|
|
18
|
+
.${constants_1.pdfViewerClassnames.list} {
|
|
19
|
+
height: 100%;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.${constants_1.pdfViewerClassnames.page} {
|
|
23
|
+
margin-top: auto;
|
|
24
|
+
margin-bottom: auto;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
15
28
|
.react-pdf__message--loading {
|
|
16
29
|
height: 100%;
|
|
17
30
|
}
|
|
@@ -20,8 +20,8 @@ react_pdf_1.pdfjs.GlobalWorkerOptions.workerSrc = constants_1.PDFJS_WORKER_URL;
|
|
|
20
20
|
* Компонент для просмотра PDF файлов
|
|
21
21
|
*/
|
|
22
22
|
const PdfViewer = (props) => {
|
|
23
|
-
const { documentProps, pageProps, pageCount, pageHeightList, isError, errorState, paginationRef, isLoading, initialIndex, isRenderList, isViewerLite, scale, zoomOut, zoomIn, isDisabledZoomOutButton, isDisabledZoomInButton, scrollContainerRef, loadingPlaceholderTitle, enabledZoom, } = (0, useLogic_1.useLogic)(props);
|
|
24
|
-
return ((0, jsx_runtime_1.jsx)(ContentState_1.ContentState, { isError: isError, errorState: errorState, children: (0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { "$isViewerLite": isViewerLite, "$enabledZoom": enabledZoom, children: [(0, jsx_runtime_1.jsx)(styles_1.PDFViewerContainer, { "$isViewerLite": isViewerLite, "$enabledZoom": enabledZoom, children: (0, jsx_runtime_1.jsx)(styles_1.ScrollContainer, { ref: scrollContainerRef, "$isViewerLite": isViewerLite, "$enabledZoom": enabledZoom, children: (0, jsx_runtime_1.jsx)(PdfDocument_1.PDFDocument, { ...documentProps, isLoading: isLoading, loading: (0, jsx_runtime_1.jsx)(LoadingPlaceholder_1.LoadingPlaceholder, { title: loadingPlaceholderTitle }), isViewerLite: isViewerLite, enabledZoom: enabledZoom, children: isRenderList && ((0, jsx_runtime_1.jsx)(List_1.List, { paginationRef: paginationRef, initialIndex: initialIndex, children: pageHeightList?.map((height, index) => ((0, react_1.createElement)(PdfPage_1.PDFPage, { ...pageProps,
|
|
23
|
+
const { documentProps, pageProps, pageCount, pageHeightList, isError, errorState, paginationRef, isLoading, initialIndex, isRenderList, isViewerLite, scale, zoomOut, zoomIn, isDisabledZoomOutButton, isDisabledZoomInButton, scrollContainerRef, loadingPlaceholderTitle, enabledZoom, isCentered, } = (0, useLogic_1.useLogic)(props);
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)(ContentState_1.ContentState, { isError: isError, errorState: errorState, children: (0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { "$isViewerLite": isViewerLite, "$enabledZoom": enabledZoom, children: [(0, jsx_runtime_1.jsx)(styles_1.PDFViewerContainer, { "$isViewerLite": isViewerLite, "$enabledZoom": enabledZoom, children: (0, jsx_runtime_1.jsx)(styles_1.ScrollContainer, { ref: scrollContainerRef, "$isViewerLite": isViewerLite, "$enabledZoom": enabledZoom, children: (0, jsx_runtime_1.jsx)(PdfDocument_1.PDFDocument, { ...documentProps, isLoading: isLoading, isCentered: isCentered, loading: (0, jsx_runtime_1.jsx)(LoadingPlaceholder_1.LoadingPlaceholder, { title: loadingPlaceholderTitle }), isViewerLite: isViewerLite, enabledZoom: enabledZoom, children: isRenderList && ((0, jsx_runtime_1.jsx)(List_1.List, { paginationRef: paginationRef, initialIndex: initialIndex, children: pageHeightList?.map((height, index) => ((0, react_1.createElement)(PdfPage_1.PDFPage, { ...pageProps,
|
|
25
25
|
// biome-ignore lint/suspicious/noArrayIndexKey: Страницы статичны
|
|
26
26
|
key: index, height: height * scale, pageNumber: index + 1, pageCount: pageCount, isViewerLite: isViewerLite, scale: scale, enabledZoom: enabledZoom }))) }, pageHeightList?.[0])) }) }) }), (0, jsx_runtime_1.jsx)(ControlBar_1.ControlBar, { zoomOut: zoomOut, zoomIn: zoomIn, pageNumber: Number(initialIndex) + 1, buttonProps: {
|
|
27
27
|
isDisabledZoomIn: isDisabledZoomInButton,
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export declare const pdfViewerClassnames: {
|
|
2
|
+
list: string;
|
|
2
3
|
document: string;
|
|
3
4
|
page: string;
|
|
4
5
|
animation: string;
|
|
5
6
|
zoom: string;
|
|
7
|
+
centered: string;
|
|
6
8
|
};
|
|
7
9
|
export declare const PDFJS_WORKER_URL = "https://frontend-static.astral.ru/libs/pdfjs-dist/4.8.69/pdf.worker.min.mjs";
|
|
8
10
|
export declare const TEXT_LAYER_CSS_URL = "https://frontend-static.astral.ru/libs/react-pdf/9.2.1/text-layer.min.css";
|
|
@@ -3,10 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TRACKPAD_DELTA_Y_THRESHOLD = exports.ZOOM_INTENSITY_TRACKPAD = exports.ZOOM_INTENSITY_MOUSE = exports.ZOOM_STEP_OUT = exports.ZOOM_STEP_IN = exports.ZOOM_MAX = exports.ZOOM_MIN = exports.RESERVED_TOP_SPACE = exports.RESERVED_CONTROL_BAR_SPACE = exports.PDF_VIEWER_ANIMATION = exports.ANNOTATION_LAYER_CSS_URL = exports.TEXT_LAYER_CSS_URL = exports.PDFJS_WORKER_URL = exports.pdfViewerClassnames = void 0;
|
|
4
4
|
const createUIKitClassname_1 = require("../utils/createUIKitClassname");
|
|
5
5
|
exports.pdfViewerClassnames = {
|
|
6
|
+
list: (0, createUIKitClassname_1.createUIKitClassname)('pdf-viewer__list'),
|
|
6
7
|
document: (0, createUIKitClassname_1.createUIKitClassname)('pdf-viewer__document'),
|
|
7
8
|
page: (0, createUIKitClassname_1.createUIKitClassname)('pdf-viewer__page'),
|
|
8
9
|
animation: (0, createUIKitClassname_1.createUIKitClassname)('pdf-viewer_animation'),
|
|
9
10
|
zoom: (0, createUIKitClassname_1.createUIKitClassname)('pdf-viewer__zoom_enabled'),
|
|
11
|
+
centered: (0, createUIKitClassname_1.createUIKitClassname)('pdf-viewer_centered'),
|
|
10
12
|
};
|
|
11
13
|
// Worker и CSS загружаются из сервиса статики https://git.astralnalog.ru/frontend.shared/static-files
|
|
12
14
|
exports.PDFJS_WORKER_URL = 'https://frontend-static.astral.ru/libs/pdfjs-dist/4.8.69/pdf.worker.min.mjs';
|
|
@@ -59,6 +59,10 @@ export type PdfViewerProps = {
|
|
|
59
59
|
* Отображение страниц в полную высоту
|
|
60
60
|
*/
|
|
61
61
|
isFullHeight?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Центрирование содержимого контейнера
|
|
64
|
+
*/
|
|
65
|
+
isCentered?: boolean;
|
|
62
66
|
/**
|
|
63
67
|
* Диапазон индексов страниц, которые необходимо отобразить
|
|
64
68
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type PdfViewerOnLoadSuccessProps, type PdfViewerProps } from '../types';
|
|
3
|
-
export declare const useLogic: ({ file, scrollRef, paginationRef, isFullHeight, renderPageRange, isHidePersonalData, isViewerLite, enabledZoom, options, ...props }: PdfViewerProps) => {
|
|
3
|
+
export declare const useLogic: ({ file, scrollRef, paginationRef, isFullHeight, isCentered, renderPageRange, isHidePersonalData, isViewerLite, enabledZoom, options, ...props }: PdfViewerProps) => {
|
|
4
4
|
documentProps: {
|
|
5
5
|
file: string | Blob | null | undefined;
|
|
6
6
|
options: {
|
|
@@ -42,4 +42,5 @@ export declare const useLogic: ({ file, scrollRef, paginationRef, isFullHeight,
|
|
|
42
42
|
shouldAnimateZoom: boolean;
|
|
43
43
|
loadingPlaceholderTitle: string | undefined;
|
|
44
44
|
enabledZoom: boolean;
|
|
45
|
+
isCentered: boolean | undefined;
|
|
45
46
|
};
|
|
@@ -5,7 +5,7 @@ const react_1 = require("react");
|
|
|
5
5
|
const ConfigProvider_1 = require("../../ConfigProvider");
|
|
6
6
|
const useZoom_1 = require("../hooks/useZoom");
|
|
7
7
|
const utils_1 = require("../utils");
|
|
8
|
-
const useLogic = ({ file, scrollRef, paginationRef, isFullHeight, renderPageRange, isHidePersonalData, isViewerLite, enabledZoom = true, options, ...props }) => {
|
|
8
|
+
const useLogic = ({ file, scrollRef, paginationRef, isFullHeight, isCentered, renderPageRange, isHidePersonalData, isViewerLite, enabledZoom = true, options, ...props }) => {
|
|
9
9
|
const [containerWidth, setContainerWidth] = (0, react_1.useState)(1);
|
|
10
10
|
const scrollContainerRef = (0, react_1.useRef)(null);
|
|
11
11
|
const { zoomOut, scale, zoomIn, shouldAnimateZoom } = (0, useZoom_1.useZoom)({
|
|
@@ -103,6 +103,7 @@ const useLogic = ({ file, scrollRef, paginationRef, isFullHeight, renderPageRang
|
|
|
103
103
|
shouldAnimateZoom,
|
|
104
104
|
loadingPlaceholderTitle,
|
|
105
105
|
enabledZoom,
|
|
106
|
+
isCentered,
|
|
106
107
|
};
|
|
107
108
|
};
|
|
108
109
|
exports.useLogic = useLogic;
|
|
@@ -13,6 +13,7 @@ export declare const useLogic: ({ file, fileUrl, isHidePersonalData, }: UseLogic
|
|
|
13
13
|
pdfViewerProps: {
|
|
14
14
|
isViewerLite: boolean;
|
|
15
15
|
isFullHeight: boolean;
|
|
16
|
+
isCentered: boolean;
|
|
16
17
|
file: string | File | null | undefined;
|
|
17
18
|
scrollRef: import("react").RefObject<null>;
|
|
18
19
|
renderPageRange: {
|