@astral/ui 4.35.1 → 4.36.1
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/TreeAsyncAutocomplete/OptionsModal/styles.js +1 -1
- package/components/TreeAutocomplete/OptionsModal/OptionsModal.js +1 -1
- package/components/TreeAutocomplete/OptionsModal/styles.d.ts +4 -0
- package/components/TreeAutocomplete/OptionsModal/styles.js +10 -3
- package/components/TreeAutocomplete/OptionsModal/useLogic/useLogic.d.ts +5 -3
- package/components/TreeAutocomplete/OptionsModal/useLogic/useLogic.js +2 -1
- package/components/TreeLikeAsyncAutocomplete/OptionsModal/styles.js +1 -1
- package/components/TreeLikeAutocomplete/OptionsModal/OptionsModal.js +1 -1
- package/components/TreeLikeAutocomplete/OptionsModal/styles.d.ts +4 -0
- package/components/TreeLikeAutocomplete/OptionsModal/styles.js +10 -3
- package/components/TreeLikeAutocomplete/OptionsModal/useLogic/useLogic.d.ts +5 -3
- package/components/TreeLikeAutocomplete/OptionsModal/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/TreeAsyncAutocomplete/OptionsModal/styles.js +1 -1
- package/node/components/TreeAutocomplete/OptionsModal/OptionsModal.js +1 -1
- package/node/components/TreeAutocomplete/OptionsModal/styles.d.ts +4 -0
- package/node/components/TreeAutocomplete/OptionsModal/styles.js +10 -3
- package/node/components/TreeAutocomplete/OptionsModal/useLogic/useLogic.d.ts +5 -3
- package/node/components/TreeAutocomplete/OptionsModal/useLogic/useLogic.js +2 -1
- package/node/components/TreeLikeAsyncAutocomplete/OptionsModal/styles.js +1 -1
- package/node/components/TreeLikeAutocomplete/OptionsModal/OptionsModal.js +1 -1
- package/node/components/TreeLikeAutocomplete/OptionsModal/styles.d.ts +4 -0
- package/node/components/TreeLikeAutocomplete/OptionsModal/styles.js +10 -3
- package/node/components/TreeLikeAutocomplete/OptionsModal/useLogic/useLogic.d.ts +5 -3
- package/node/components/TreeLikeAutocomplete/OptionsModal/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
|
};
|
|
@@ -13,7 +13,7 @@ export const StyledDialogContent = styled(DialogContent, {
|
|
|
13
13
|
gap: ${({ theme }) => theme.spacing(4)};
|
|
14
14
|
|
|
15
15
|
width: ${({ $size }) => DIALOG_SIZES[$size].minWidth};
|
|
16
|
-
height: ${({ $size }) =>
|
|
16
|
+
height: ${({ $size }) => DIALOG_SIZES[$size].minWidth};
|
|
17
17
|
|
|
18
18
|
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
19
19
|
width: auto;
|
|
@@ -25,5 +25,5 @@ export const OptionsModal = (props) => {
|
|
|
25
25
|
}
|
|
26
26
|
return _jsx(TreeList, { ...treeProps, ...treeListProps });
|
|
27
27
|
};
|
|
28
|
-
return (_jsxs(Dialog, { ...externalDialogProps, disableRestoreFocus: true, open: isOpen, ...modalProps, children: [_jsxs(StyledDialogContent, { children: [_jsx(SearchField, { fullWidth: true, ...searchFieldProps }), _jsx(Paper, { variant: "outlined", children: _jsx(TreeListWrapper, { children: renderComponent() }) })] }), _jsxs(DialogActions, { children: [_jsx(Button, { variant: "text", ...cancelButtonProps, children: "\u041E\u0442\u043C\u0435\u043D\u0430" }), _jsx(Button, { ...confirmButtonProps, children: "\u0412\u044B\u0431\u0440\u0430\u0442\u044C" })] })] }));
|
|
28
|
+
return (_jsxs(Dialog, { ...externalDialogProps, disableRestoreFocus: true, open: isOpen, ...modalProps, children: [_jsxs(StyledDialogContent, { "$size": modalProps.size, children: [_jsx(SearchField, { fullWidth: true, ...searchFieldProps }), _jsx(Paper, { variant: "outlined", children: _jsx(TreeListWrapper, { children: renderComponent() }) })] }), _jsxs(DialogActions, { children: [_jsx(Button, { variant: "text", ...cancelButtonProps, children: "\u041E\u0442\u043C\u0435\u043D\u0430" }), _jsx(Button, { ...confirmButtonProps, children: "\u0412\u044B\u0431\u0440\u0430\u0442\u044C" })] })] }));
|
|
29
29
|
};
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
2
3
|
export declare const StyledDialogContent: import("../../styled").StyledComponent<import("../../DialogContent").DialogContentProps & {
|
|
3
4
|
theme?: import("@emotion/react").Theme | undefined;
|
|
5
|
+
} & {
|
|
6
|
+
$size: Size;
|
|
4
7
|
}, {}, {}>;
|
|
5
8
|
export declare const TreeListWrapper: import("../../styled").StyledComponent<{
|
|
6
9
|
theme?: import("@emotion/react").Theme | undefined;
|
|
7
10
|
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
8
11
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
12
|
+
export {};
|
|
@@ -1,13 +1,20 @@
|
|
|
1
|
+
import { DIALOG_SIZES } from '../../Dialog';
|
|
1
2
|
import { DialogContent } from '../../DialogContent';
|
|
2
3
|
import { styled } from '../../styled';
|
|
3
|
-
export const StyledDialogContent = styled(DialogContent
|
|
4
|
+
export const StyledDialogContent = styled(DialogContent, {
|
|
5
|
+
shouldForwardProp: (prop) => !['$size'].includes(prop),
|
|
6
|
+
}) `
|
|
4
7
|
display: grid;
|
|
5
8
|
grid-template-columns: 100%;
|
|
6
9
|
grid-template-rows: max-content 1fr;
|
|
7
10
|
gap: ${({ theme }) => theme.spacing(4)};
|
|
8
11
|
|
|
9
|
-
width:
|
|
10
|
-
height:
|
|
12
|
+
width: ${({ $size }) => DIALOG_SIZES[$size].minWidth};
|
|
13
|
+
height: ${({ $size }) => DIALOG_SIZES[$size].minWidth};
|
|
14
|
+
|
|
15
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
16
|
+
width: auto;
|
|
17
|
+
}
|
|
11
18
|
`;
|
|
12
19
|
export const TreeListWrapper = styled.div `
|
|
13
20
|
overflow: auto;
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { type ButtonProps } from '../../../Button';
|
|
2
|
-
import { type DialogProps } from '../../../Dialog';
|
|
2
|
+
import { type DialogProps, type DialogSize } from '../../../Dialog';
|
|
3
3
|
import { type SearchFieldProps } from '../../../SearchField';
|
|
4
4
|
import { type TreeListProps } from '../../../Tree';
|
|
5
5
|
import { type OptionsModalProps } from '../types';
|
|
6
6
|
type UseLogicResult = {
|
|
7
7
|
isNoResult: boolean;
|
|
8
8
|
searchFieldProps: SearchFieldProps;
|
|
9
|
-
modalProps: Partial<DialogProps
|
|
9
|
+
modalProps: Partial<DialogProps> & {
|
|
10
|
+
size: DialogSize;
|
|
11
|
+
};
|
|
10
12
|
treeListProps: TreeListProps;
|
|
11
13
|
cancelButtonProps: ButtonProps;
|
|
12
14
|
confirmButtonProps: ButtonProps;
|
|
13
15
|
};
|
|
14
|
-
export declare const useLogic: ({ isOpen, isLoading, isLoadingError, initialValue, options, filterOptions, onChange, onClose, }: OptionsModalProps) => UseLogicResult;
|
|
16
|
+
export declare const useLogic: ({ isOpen, isLoading, isLoadingError, initialValue, options, filterOptions, onChange, onClose, size, }: OptionsModalProps) => UseLogicResult;
|
|
15
17
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect, useMemo, useState, } from 'react';
|
|
2
2
|
import { deepMap } from '../../../utils/array';
|
|
3
3
|
import { findInTree } from './utils';
|
|
4
|
-
export const useLogic = ({ isOpen, isLoading, isLoadingError, initialValue, options, filterOptions, onChange, onClose, }) => {
|
|
4
|
+
export const useLogic = ({ isOpen, isLoading, isLoadingError, initialValue, options, filterOptions, onChange, onClose, size = 'md', }) => {
|
|
5
5
|
const [value, setValue] = useState(initialValue);
|
|
6
6
|
const [searchValue, setSearchValue] = useState();
|
|
7
7
|
useEffect(() => {
|
|
@@ -47,6 +47,7 @@ export const useLogic = ({ isOpen, isLoading, isLoadingError, initialValue, opti
|
|
|
47
47
|
isNoResult,
|
|
48
48
|
modalProps: {
|
|
49
49
|
onClose: handleClose,
|
|
50
|
+
size,
|
|
50
51
|
},
|
|
51
52
|
searchFieldProps: {
|
|
52
53
|
value: searchValue,
|
|
@@ -13,7 +13,7 @@ export const StyledDialogContent = styled(DialogContent, {
|
|
|
13
13
|
gap: ${({ theme }) => theme.spacing(4)};
|
|
14
14
|
|
|
15
15
|
width: ${({ $size }) => DIALOG_SIZES[$size].minWidth};
|
|
16
|
-
height: ${({ $size }) =>
|
|
16
|
+
height: ${({ $size }) => DIALOG_SIZES[$size].minWidth};
|
|
17
17
|
|
|
18
18
|
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
19
19
|
width: auto;
|
|
@@ -25,5 +25,5 @@ export const OptionsModal = (props) => {
|
|
|
25
25
|
}
|
|
26
26
|
return (_jsx(TreeLikeList, { isConfirmChildrenSelection: isConfirmChildrenSelection, ...treeProps, ...treeLikeListProps }));
|
|
27
27
|
};
|
|
28
|
-
return (_jsxs(Dialog, { ...externalDialogProps, disableRestoreFocus: true, open: isOpen, ...modalProps, children: [_jsxs(StyledDialogContent, { children: [_jsx(SearchField, { fullWidth: true, ...searchFieldProps }), _jsx(Paper, { variant: "outlined", children: _jsx(TreeListWrapper, { children: renderComponent() }) })] }), _jsxs(DialogActions, { children: [_jsx(Button, { variant: "text", ...cancelButtonProps, children: "\u041E\u0442\u043C\u0435\u043D\u0430" }), _jsx(Button, { ...confirmButtonProps, children: "\u0412\u044B\u0431\u0440\u0430\u0442\u044C" })] })] }));
|
|
28
|
+
return (_jsxs(Dialog, { ...externalDialogProps, disableRestoreFocus: true, open: isOpen, ...modalProps, children: [_jsxs(StyledDialogContent, { "$size": modalProps.size, children: [_jsx(SearchField, { fullWidth: true, ...searchFieldProps }), _jsx(Paper, { variant: "outlined", children: _jsx(TreeListWrapper, { children: renderComponent() }) })] }), _jsxs(DialogActions, { children: [_jsx(Button, { variant: "text", ...cancelButtonProps, children: "\u041E\u0442\u043C\u0435\u043D\u0430" }), _jsx(Button, { ...confirmButtonProps, children: "\u0412\u044B\u0431\u0440\u0430\u0442\u044C" })] })] }));
|
|
29
29
|
};
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
2
3
|
export declare const StyledDialogContent: import("../../styled").StyledComponent<import("../../DialogContent").DialogContentProps & {
|
|
3
4
|
theme?: import("@emotion/react").Theme | undefined;
|
|
5
|
+
} & {
|
|
6
|
+
$size: Size;
|
|
4
7
|
}, {}, {}>;
|
|
5
8
|
export declare const TreeListWrapper: import("../../styled").StyledComponent<{
|
|
6
9
|
theme?: import("@emotion/react").Theme | undefined;
|
|
7
10
|
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
8
11
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
12
|
+
export {};
|
|
@@ -1,13 +1,20 @@
|
|
|
1
|
+
import { DIALOG_SIZES } from '../../Dialog';
|
|
1
2
|
import { DialogContent } from '../../DialogContent';
|
|
2
3
|
import { styled } from '../../styled';
|
|
3
|
-
export const StyledDialogContent = styled(DialogContent
|
|
4
|
+
export const StyledDialogContent = styled(DialogContent, {
|
|
5
|
+
shouldForwardProp: (prop) => !['$size'].includes(prop),
|
|
6
|
+
}) `
|
|
4
7
|
display: grid;
|
|
5
8
|
grid-template-columns: 100%;
|
|
6
9
|
grid-template-rows: max-content 1fr;
|
|
7
10
|
gap: ${({ theme }) => theme.spacing(4)};
|
|
8
11
|
|
|
9
|
-
width:
|
|
10
|
-
height:
|
|
12
|
+
width: ${({ $size }) => DIALOG_SIZES[$size].minWidth};
|
|
13
|
+
height: ${({ $size }) => DIALOG_SIZES[$size].minWidth};
|
|
14
|
+
|
|
15
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
16
|
+
width: auto;
|
|
17
|
+
}
|
|
11
18
|
`;
|
|
12
19
|
export const TreeListWrapper = styled.div `
|
|
13
20
|
overflow: auto;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ButtonProps } from '../../../Button';
|
|
2
|
-
import { type DialogProps } from '../../../Dialog';
|
|
2
|
+
import { type DialogProps, type DialogSize } from '../../../Dialog';
|
|
3
3
|
import { type SearchFieldProps } from '../../../SearchField';
|
|
4
4
|
import { type TreeLikeListProps } from '../../../TreeLikeList';
|
|
5
5
|
import { type OptionsModalProps } from '../types';
|
|
@@ -7,10 +7,12 @@ type UseLogicParams = OptionsModalProps;
|
|
|
7
7
|
type UseLogicResult = {
|
|
8
8
|
isNoResult: boolean;
|
|
9
9
|
searchFieldProps: SearchFieldProps;
|
|
10
|
-
modalProps: Partial<DialogProps
|
|
10
|
+
modalProps: Partial<DialogProps> & {
|
|
11
|
+
size: DialogSize;
|
|
12
|
+
};
|
|
11
13
|
treeLikeListProps: TreeLikeListProps;
|
|
12
14
|
cancelButtonProps: ButtonProps;
|
|
13
15
|
confirmButtonProps: ButtonProps;
|
|
14
16
|
};
|
|
15
|
-
export declare const useLogic: ({ isOpen, isLoading, isLoadingError, initialValue, options, filterOptions, onChange, onClose, }: UseLogicParams) => UseLogicResult;
|
|
17
|
+
export declare const useLogic: ({ isOpen, isLoading, isLoadingError, initialValue, options, filterOptions, onChange, onClose, size, }: UseLogicParams) => UseLogicResult;
|
|
16
18
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect, useMemo, useState, } from 'react';
|
|
2
2
|
import { deepMap } from '../../../utils/array';
|
|
3
3
|
import { findInTree } from './utils';
|
|
4
|
-
export const useLogic = ({ isOpen, isLoading, isLoadingError, initialValue, options, filterOptions, onChange, onClose, }) => {
|
|
4
|
+
export const useLogic = ({ isOpen, isLoading, isLoadingError, initialValue, options, filterOptions, onChange, onClose, size = 'md', }) => {
|
|
5
5
|
const [value, setValue] = useState(initialValue);
|
|
6
6
|
const [searchValue, setSearchValue] = useState();
|
|
7
7
|
useEffect(() => {
|
|
@@ -47,6 +47,7 @@ export const useLogic = ({ isOpen, isLoading, isLoadingError, initialValue, opti
|
|
|
47
47
|
isNoResult,
|
|
48
48
|
modalProps: {
|
|
49
49
|
onClose: handleClose,
|
|
50
|
+
size,
|
|
50
51
|
},
|
|
51
52
|
searchFieldProps: {
|
|
52
53
|
value: searchValue,
|
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;
|
|
@@ -16,7 +16,7 @@ exports.StyledDialogContent = (0, styled_1.styled)(DialogContent_1.DialogContent
|
|
|
16
16
|
gap: ${({ theme }) => theme.spacing(4)};
|
|
17
17
|
|
|
18
18
|
width: ${({ $size }) => Dialog_1.DIALOG_SIZES[$size].minWidth};
|
|
19
|
-
height: ${({ $size }) =>
|
|
19
|
+
height: ${({ $size }) => Dialog_1.DIALOG_SIZES[$size].minWidth};
|
|
20
20
|
|
|
21
21
|
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
22
22
|
width: auto;
|
|
@@ -28,6 +28,6 @@ const OptionsModal = (props) => {
|
|
|
28
28
|
}
|
|
29
29
|
return (0, jsx_runtime_1.jsx)(Tree_1.TreeList, { ...treeProps, ...treeListProps });
|
|
30
30
|
};
|
|
31
|
-
return ((0, jsx_runtime_1.jsxs)(Dialog_1.Dialog, { ...externalDialogProps, disableRestoreFocus: true, open: isOpen, ...modalProps, children: [(0, jsx_runtime_1.jsxs)(styles_1.StyledDialogContent, { children: [(0, jsx_runtime_1.jsx)(SearchField_1.SearchField, { fullWidth: true, ...searchFieldProps }), (0, jsx_runtime_1.jsx)(Paper_1.Paper, { variant: "outlined", children: (0, jsx_runtime_1.jsx)(styles_1.TreeListWrapper, { children: renderComponent() }) })] }), (0, jsx_runtime_1.jsxs)(DialogActions_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(Button_1.Button, { variant: "text", ...cancelButtonProps, children: "\u041E\u0442\u043C\u0435\u043D\u0430" }), (0, jsx_runtime_1.jsx)(Button_1.Button, { ...confirmButtonProps, children: "\u0412\u044B\u0431\u0440\u0430\u0442\u044C" })] })] }));
|
|
31
|
+
return ((0, jsx_runtime_1.jsxs)(Dialog_1.Dialog, { ...externalDialogProps, disableRestoreFocus: true, open: isOpen, ...modalProps, children: [(0, jsx_runtime_1.jsxs)(styles_1.StyledDialogContent, { "$size": modalProps.size, children: [(0, jsx_runtime_1.jsx)(SearchField_1.SearchField, { fullWidth: true, ...searchFieldProps }), (0, jsx_runtime_1.jsx)(Paper_1.Paper, { variant: "outlined", children: (0, jsx_runtime_1.jsx)(styles_1.TreeListWrapper, { children: renderComponent() }) })] }), (0, jsx_runtime_1.jsxs)(DialogActions_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(Button_1.Button, { variant: "text", ...cancelButtonProps, children: "\u041E\u0442\u043C\u0435\u043D\u0430" }), (0, jsx_runtime_1.jsx)(Button_1.Button, { ...confirmButtonProps, children: "\u0412\u044B\u0431\u0440\u0430\u0442\u044C" })] })] }));
|
|
32
32
|
};
|
|
33
33
|
exports.OptionsModal = OptionsModal;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
2
3
|
export declare const StyledDialogContent: import("@emotion/styled/dist/declarations/src/types").StyledComponent<import("../../DialogContent").DialogContentProps & {
|
|
3
4
|
theme?: import("@emotion/react").Theme | undefined;
|
|
5
|
+
} & {
|
|
6
|
+
$size: Size;
|
|
4
7
|
}, {}, {}>;
|
|
5
8
|
export declare const TreeListWrapper: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
|
|
6
9
|
theme?: import("@emotion/react").Theme | undefined;
|
|
7
10
|
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
8
11
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
12
|
+
export {};
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TreeListWrapper = exports.StyledDialogContent = void 0;
|
|
4
|
+
const Dialog_1 = require("../../Dialog");
|
|
4
5
|
const DialogContent_1 = require("../../DialogContent");
|
|
5
6
|
const styled_1 = require("../../styled");
|
|
6
|
-
exports.StyledDialogContent = (0, styled_1.styled)(DialogContent_1.DialogContent
|
|
7
|
+
exports.StyledDialogContent = (0, styled_1.styled)(DialogContent_1.DialogContent, {
|
|
8
|
+
shouldForwardProp: (prop) => !['$size'].includes(prop),
|
|
9
|
+
}) `
|
|
7
10
|
display: grid;
|
|
8
11
|
grid-template-columns: 100%;
|
|
9
12
|
grid-template-rows: max-content 1fr;
|
|
10
13
|
gap: ${({ theme }) => theme.spacing(4)};
|
|
11
14
|
|
|
12
|
-
width:
|
|
13
|
-
height:
|
|
15
|
+
width: ${({ $size }) => Dialog_1.DIALOG_SIZES[$size].minWidth};
|
|
16
|
+
height: ${({ $size }) => Dialog_1.DIALOG_SIZES[$size].minWidth};
|
|
17
|
+
|
|
18
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
19
|
+
width: auto;
|
|
20
|
+
}
|
|
14
21
|
`;
|
|
15
22
|
exports.TreeListWrapper = styled_1.styled.div `
|
|
16
23
|
overflow: auto;
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { type ButtonProps } from '../../../Button';
|
|
2
|
-
import { type DialogProps } from '../../../Dialog';
|
|
2
|
+
import { type DialogProps, type DialogSize } from '../../../Dialog';
|
|
3
3
|
import { type SearchFieldProps } from '../../../SearchField';
|
|
4
4
|
import { type TreeListProps } from '../../../Tree';
|
|
5
5
|
import { type OptionsModalProps } from '../types';
|
|
6
6
|
type UseLogicResult = {
|
|
7
7
|
isNoResult: boolean;
|
|
8
8
|
searchFieldProps: SearchFieldProps;
|
|
9
|
-
modalProps: Partial<DialogProps
|
|
9
|
+
modalProps: Partial<DialogProps> & {
|
|
10
|
+
size: DialogSize;
|
|
11
|
+
};
|
|
10
12
|
treeListProps: TreeListProps;
|
|
11
13
|
cancelButtonProps: ButtonProps;
|
|
12
14
|
confirmButtonProps: ButtonProps;
|
|
13
15
|
};
|
|
14
|
-
export declare const useLogic: ({ isOpen, isLoading, isLoadingError, initialValue, options, filterOptions, onChange, onClose, }: OptionsModalProps) => UseLogicResult;
|
|
16
|
+
export declare const useLogic: ({ isOpen, isLoading, isLoadingError, initialValue, options, filterOptions, onChange, onClose, size, }: OptionsModalProps) => UseLogicResult;
|
|
15
17
|
export {};
|
|
@@ -4,7 +4,7 @@ exports.useLogic = void 0;
|
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const array_1 = require("../../../utils/array");
|
|
6
6
|
const utils_1 = require("./utils");
|
|
7
|
-
const useLogic = ({ isOpen, isLoading, isLoadingError, initialValue, options, filterOptions, onChange, onClose, }) => {
|
|
7
|
+
const useLogic = ({ isOpen, isLoading, isLoadingError, initialValue, options, filterOptions, onChange, onClose, size = 'md', }) => {
|
|
8
8
|
const [value, setValue] = (0, react_1.useState)(initialValue);
|
|
9
9
|
const [searchValue, setSearchValue] = (0, react_1.useState)();
|
|
10
10
|
(0, react_1.useEffect)(() => {
|
|
@@ -50,6 +50,7 @@ const useLogic = ({ isOpen, isLoading, isLoadingError, initialValue, options, fi
|
|
|
50
50
|
isNoResult,
|
|
51
51
|
modalProps: {
|
|
52
52
|
onClose: handleClose,
|
|
53
|
+
size,
|
|
53
54
|
},
|
|
54
55
|
searchFieldProps: {
|
|
55
56
|
value: searchValue,
|
|
@@ -16,7 +16,7 @@ exports.StyledDialogContent = (0, styled_1.styled)(DialogContent_1.DialogContent
|
|
|
16
16
|
gap: ${({ theme }) => theme.spacing(4)};
|
|
17
17
|
|
|
18
18
|
width: ${({ $size }) => Dialog_1.DIALOG_SIZES[$size].minWidth};
|
|
19
|
-
height: ${({ $size }) =>
|
|
19
|
+
height: ${({ $size }) => Dialog_1.DIALOG_SIZES[$size].minWidth};
|
|
20
20
|
|
|
21
21
|
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
22
22
|
width: auto;
|
|
@@ -28,6 +28,6 @@ const OptionsModal = (props) => {
|
|
|
28
28
|
}
|
|
29
29
|
return ((0, jsx_runtime_1.jsx)(TreeLikeList_1.TreeLikeList, { isConfirmChildrenSelection: isConfirmChildrenSelection, ...treeProps, ...treeLikeListProps }));
|
|
30
30
|
};
|
|
31
|
-
return ((0, jsx_runtime_1.jsxs)(Dialog_1.Dialog, { ...externalDialogProps, disableRestoreFocus: true, open: isOpen, ...modalProps, children: [(0, jsx_runtime_1.jsxs)(styles_1.StyledDialogContent, { children: [(0, jsx_runtime_1.jsx)(SearchField_1.SearchField, { fullWidth: true, ...searchFieldProps }), (0, jsx_runtime_1.jsx)(Paper_1.Paper, { variant: "outlined", children: (0, jsx_runtime_1.jsx)(styles_1.TreeListWrapper, { children: renderComponent() }) })] }), (0, jsx_runtime_1.jsxs)(DialogActions_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(Button_1.Button, { variant: "text", ...cancelButtonProps, children: "\u041E\u0442\u043C\u0435\u043D\u0430" }), (0, jsx_runtime_1.jsx)(Button_1.Button, { ...confirmButtonProps, children: "\u0412\u044B\u0431\u0440\u0430\u0442\u044C" })] })] }));
|
|
31
|
+
return ((0, jsx_runtime_1.jsxs)(Dialog_1.Dialog, { ...externalDialogProps, disableRestoreFocus: true, open: isOpen, ...modalProps, children: [(0, jsx_runtime_1.jsxs)(styles_1.StyledDialogContent, { "$size": modalProps.size, children: [(0, jsx_runtime_1.jsx)(SearchField_1.SearchField, { fullWidth: true, ...searchFieldProps }), (0, jsx_runtime_1.jsx)(Paper_1.Paper, { variant: "outlined", children: (0, jsx_runtime_1.jsx)(styles_1.TreeListWrapper, { children: renderComponent() }) })] }), (0, jsx_runtime_1.jsxs)(DialogActions_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(Button_1.Button, { variant: "text", ...cancelButtonProps, children: "\u041E\u0442\u043C\u0435\u043D\u0430" }), (0, jsx_runtime_1.jsx)(Button_1.Button, { ...confirmButtonProps, children: "\u0412\u044B\u0431\u0440\u0430\u0442\u044C" })] })] }));
|
|
32
32
|
};
|
|
33
33
|
exports.OptionsModal = OptionsModal;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
2
3
|
export declare const StyledDialogContent: import("@emotion/styled/dist/declarations/src/types").StyledComponent<import("../../DialogContent").DialogContentProps & {
|
|
3
4
|
theme?: import("@emotion/react").Theme | undefined;
|
|
5
|
+
} & {
|
|
6
|
+
$size: Size;
|
|
4
7
|
}, {}, {}>;
|
|
5
8
|
export declare const TreeListWrapper: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
|
|
6
9
|
theme?: import("@emotion/react").Theme | undefined;
|
|
7
10
|
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
8
11
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
12
|
+
export {};
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TreeListWrapper = exports.StyledDialogContent = void 0;
|
|
4
|
+
const Dialog_1 = require("../../Dialog");
|
|
4
5
|
const DialogContent_1 = require("../../DialogContent");
|
|
5
6
|
const styled_1 = require("../../styled");
|
|
6
|
-
exports.StyledDialogContent = (0, styled_1.styled)(DialogContent_1.DialogContent
|
|
7
|
+
exports.StyledDialogContent = (0, styled_1.styled)(DialogContent_1.DialogContent, {
|
|
8
|
+
shouldForwardProp: (prop) => !['$size'].includes(prop),
|
|
9
|
+
}) `
|
|
7
10
|
display: grid;
|
|
8
11
|
grid-template-columns: 100%;
|
|
9
12
|
grid-template-rows: max-content 1fr;
|
|
10
13
|
gap: ${({ theme }) => theme.spacing(4)};
|
|
11
14
|
|
|
12
|
-
width:
|
|
13
|
-
height:
|
|
15
|
+
width: ${({ $size }) => Dialog_1.DIALOG_SIZES[$size].minWidth};
|
|
16
|
+
height: ${({ $size }) => Dialog_1.DIALOG_SIZES[$size].minWidth};
|
|
17
|
+
|
|
18
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
19
|
+
width: auto;
|
|
20
|
+
}
|
|
14
21
|
`;
|
|
15
22
|
exports.TreeListWrapper = styled_1.styled.div `
|
|
16
23
|
overflow: auto;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ButtonProps } from '../../../Button';
|
|
2
|
-
import { type DialogProps } from '../../../Dialog';
|
|
2
|
+
import { type DialogProps, type DialogSize } from '../../../Dialog';
|
|
3
3
|
import { type SearchFieldProps } from '../../../SearchField';
|
|
4
4
|
import { type TreeLikeListProps } from '../../../TreeLikeList';
|
|
5
5
|
import { type OptionsModalProps } from '../types';
|
|
@@ -7,10 +7,12 @@ type UseLogicParams = OptionsModalProps;
|
|
|
7
7
|
type UseLogicResult = {
|
|
8
8
|
isNoResult: boolean;
|
|
9
9
|
searchFieldProps: SearchFieldProps;
|
|
10
|
-
modalProps: Partial<DialogProps
|
|
10
|
+
modalProps: Partial<DialogProps> & {
|
|
11
|
+
size: DialogSize;
|
|
12
|
+
};
|
|
11
13
|
treeLikeListProps: TreeLikeListProps;
|
|
12
14
|
cancelButtonProps: ButtonProps;
|
|
13
15
|
confirmButtonProps: ButtonProps;
|
|
14
16
|
};
|
|
15
|
-
export declare const useLogic: ({ isOpen, isLoading, isLoadingError, initialValue, options, filterOptions, onChange, onClose, }: UseLogicParams) => UseLogicResult;
|
|
17
|
+
export declare const useLogic: ({ isOpen, isLoading, isLoadingError, initialValue, options, filterOptions, onChange, onClose, size, }: UseLogicParams) => UseLogicResult;
|
|
16
18
|
export {};
|
|
@@ -4,7 +4,7 @@ exports.useLogic = void 0;
|
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const array_1 = require("../../../utils/array");
|
|
6
6
|
const utils_1 = require("./utils");
|
|
7
|
-
const useLogic = ({ isOpen, isLoading, isLoadingError, initialValue, options, filterOptions, onChange, onClose, }) => {
|
|
7
|
+
const useLogic = ({ isOpen, isLoading, isLoadingError, initialValue, options, filterOptions, onChange, onClose, size = 'md', }) => {
|
|
8
8
|
const [value, setValue] = (0, react_1.useState)(initialValue);
|
|
9
9
|
const [searchValue, setSearchValue] = (0, react_1.useState)();
|
|
10
10
|
(0, react_1.useEffect)(() => {
|
|
@@ -50,6 +50,7 @@ const useLogic = ({ isOpen, isLoading, isLoadingError, initialValue, options, fi
|
|
|
50
50
|
isNoResult,
|
|
51
51
|
modalProps: {
|
|
52
52
|
onClose: handleClose,
|
|
53
|
+
size,
|
|
53
54
|
},
|
|
54
55
|
searchFieldProps: {
|
|
55
56
|
value: searchValue,
|
|
@@ -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: {
|