@astral/ui 4.44.0 → 4.46.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/DataGrid/Body/Body.d.ts +1 -98
- package/components/DataGrid/Body/Body.js +3 -15
- package/components/DataGrid/Body/index.d.ts +1 -0
- package/components/DataGrid/Body/index.js +1 -0
- package/components/DataGrid/Body/types.d.ts +110 -0
- package/components/DataGrid/Body/types.js +1 -0
- package/components/DataGrid/DataGrid.js +30 -5
- package/components/DataGrid/Head/Head.d.ts +4 -0
- package/components/DataGrid/Head/Head.js +3 -2
- package/components/DataGrid/Loader/Loader.js +2 -2
- package/components/DataGrid/Loader/styles.js +4 -2
- package/components/DataGrid/PinnedSections/PinnedSections.d.ts +35 -0
- package/components/DataGrid/PinnedSections/PinnedSections.js +11 -0
- package/components/DataGrid/PinnedSections/Section/Section.d.ts +3 -0
- package/components/DataGrid/PinnedSections/Section/Section.js +17 -0
- package/components/DataGrid/PinnedSections/Section/index.d.ts +1 -0
- package/components/DataGrid/PinnedSections/Section/index.js +1 -0
- package/components/DataGrid/PinnedSections/Section/styles.d.ts +5 -0
- package/components/DataGrid/PinnedSections/Section/styles.js +100 -0
- package/components/DataGrid/PinnedSections/Section/types.d.ts +26 -0
- package/components/DataGrid/PinnedSections/Section/types.js +1 -0
- package/components/DataGrid/PinnedSections/Section/useLogic/useLogic.d.ts +9 -0
- package/components/DataGrid/PinnedSections/Section/useLogic/useLogic.js +16 -0
- package/components/DataGrid/PinnedSections/index.d.ts +1 -0
- package/components/DataGrid/PinnedSections/index.js +1 -0
- package/components/DataGrid/PinnedSections/styles.d.ts +7 -0
- package/components/DataGrid/PinnedSections/styles.js +18 -0
- package/components/DataGrid/PinnedSections/types.d.ts +5 -0
- package/components/DataGrid/PinnedSections/types.js +1 -0
- package/components/DataGrid/PinnedSections/useLogic/index.js +1 -0
- package/components/DataGrid/PinnedSections/useLogic/useLogic.d.ts +9 -0
- package/components/DataGrid/PinnedSections/useLogic/useLogic.js +19 -0
- package/components/DataGrid/Row/NestedChildren/NestedChildren.js +2 -2
- package/components/DataGrid/Row/Row.d.ts +1 -94
- package/components/DataGrid/Row/Row.js +23 -8
- package/components/DataGrid/Row/constants.d.ts +3 -1
- package/components/DataGrid/Row/constants.js +3 -1
- package/components/DataGrid/Row/styles.js +9 -8
- package/components/DataGrid/Row/types.d.ts +118 -0
- package/components/DataGrid/Row/types.js +1 -0
- package/components/DataGrid/Row/useLogic/useLogic.d.ts +3 -2
- package/components/DataGrid/Row/useLogic/useLogic.js +14 -2
- package/components/DataGrid/constants.d.ts +7 -0
- package/components/DataGrid/constants.js +7 -0
- package/components/DataGrid/hooks/index.d.ts +1 -0
- package/components/DataGrid/hooks/index.js +1 -0
- package/components/DataGrid/hooks/useRowHover/index.d.ts +1 -0
- package/components/DataGrid/hooks/useRowHover/index.js +1 -0
- package/components/DataGrid/hooks/useRowHover/useRowHover.d.ts +15 -0
- package/components/DataGrid/hooks/useRowHover/useRowHover.js +93 -0
- package/components/DataGrid/styles.js +17 -0
- package/components/DataGrid/types.d.ts +4 -0
- package/components/DataGrid/useLogic/hooks/index.d.ts +2 -0
- package/components/DataGrid/useLogic/hooks/index.js +2 -0
- package/components/DataGrid/useLogic/hooks/useClassnames/index.d.ts +1 -0
- package/components/DataGrid/useLogic/hooks/useClassnames/index.js +1 -0
- package/components/DataGrid/useLogic/hooks/useClassnames/useClassnames.d.ts +12 -0
- package/components/DataGrid/useLogic/hooks/useClassnames/useClassnames.js +14 -0
- package/components/DataGrid/useLogic/hooks/usePinnedColumns/index.d.ts +1 -0
- package/components/DataGrid/useLogic/hooks/usePinnedColumns/index.js +1 -0
- package/components/DataGrid/useLogic/hooks/usePinnedColumns/usePinnedColumns.d.ts +18 -0
- package/components/DataGrid/useLogic/hooks/usePinnedColumns/usePinnedColumns.js +43 -0
- package/components/DataGrid/useLogic/useLogic.d.ts +30 -4
- package/components/DataGrid/useLogic/useLogic.js +55 -16
- package/components/DataGrid/useLogic/utils/getColumnSections/getColumnSections.d.ts +17 -0
- package/components/DataGrid/useLogic/utils/getColumnSections/getColumnSections.js +45 -0
- package/components/DataGrid/useLogic/utils/getColumnSections/index.d.ts +1 -0
- package/components/DataGrid/useLogic/utils/getColumnSections/index.js +1 -0
- package/components/DataGrid/useLogic/utils/index.d.ts +2 -1
- package/components/DataGrid/useLogic/utils/index.js +2 -1
- package/components/DataGrid/useLogic/utils/syncRowsHeight/index.d.ts +1 -0
- package/components/DataGrid/useLogic/utils/syncRowsHeight/index.js +1 -0
- package/components/DataGrid/useLogic/utils/syncRowsHeight/syncRowsHeight.d.ts +5 -0
- package/components/DataGrid/useLogic/utils/syncRowsHeight/syncRowsHeight.js +21 -0
- package/components/DataGrid/utils/index.d.ts +1 -0
- package/components/DataGrid/utils/index.js +1 -0
- package/components/DataGridInfinite/useLogic/useLogic.js +1 -1
- package/components/PageContent/constants.d.ts +1 -0
- package/components/PageContent/constants.js +1 -0
- package/components/PageContent/styles.js +13 -0
- package/components/PdfViewer/List/styles.js +4 -0
- package/components/PdfViewer/PdfDocument/styles.js +5 -0
- package/components/PdfViewer/PdfPage/styles.js +10 -0
- package/components/PdfViewer/styles.js +4 -0
- package/components/PdfViewer/useLogic/useLogic.js +15 -1
- package/node/components/DataGrid/Body/Body.d.ts +1 -98
- package/node/components/DataGrid/Body/Body.js +3 -15
- package/node/components/DataGrid/Body/index.d.ts +1 -0
- package/node/components/DataGrid/Body/index.js +1 -0
- package/node/components/DataGrid/Body/types.d.ts +110 -0
- package/node/components/DataGrid/Body/types.js +2 -0
- package/node/components/DataGrid/DataGrid.js +29 -4
- package/node/components/DataGrid/Head/Head.d.ts +4 -0
- package/node/components/DataGrid/Head/Head.js +3 -2
- package/node/components/DataGrid/Loader/Loader.js +1 -1
- package/node/components/DataGrid/Loader/styles.js +4 -2
- package/node/components/DataGrid/PinnedSections/PinnedSections.d.ts +35 -0
- package/node/components/DataGrid/PinnedSections/PinnedSections.js +15 -0
- package/node/components/DataGrid/PinnedSections/Section/Section.d.ts +3 -0
- package/node/components/DataGrid/PinnedSections/Section/Section.js +21 -0
- package/node/components/DataGrid/PinnedSections/Section/index.d.ts +1 -0
- package/node/components/DataGrid/PinnedSections/Section/index.js +17 -0
- package/node/components/DataGrid/PinnedSections/Section/styles.d.ts +5 -0
- package/node/components/DataGrid/PinnedSections/Section/styles.js +103 -0
- package/node/components/DataGrid/PinnedSections/Section/types.d.ts +26 -0
- package/node/components/DataGrid/PinnedSections/Section/types.js +2 -0
- package/node/components/DataGrid/PinnedSections/Section/useLogic/index.d.ts +1 -0
- package/node/components/DataGrid/PinnedSections/Section/useLogic/useLogic.d.ts +9 -0
- package/node/components/DataGrid/PinnedSections/Section/useLogic/useLogic.js +20 -0
- package/node/components/DataGrid/PinnedSections/index.d.ts +1 -0
- package/node/components/DataGrid/PinnedSections/index.js +17 -0
- package/node/components/DataGrid/PinnedSections/styles.d.ts +7 -0
- package/node/components/DataGrid/PinnedSections/styles.js +21 -0
- package/node/components/DataGrid/PinnedSections/types.d.ts +5 -0
- package/node/components/DataGrid/PinnedSections/types.js +2 -0
- package/node/components/DataGrid/PinnedSections/useLogic/index.d.ts +1 -0
- package/node/components/DataGrid/PinnedSections/useLogic/index.js +17 -0
- package/node/components/DataGrid/PinnedSections/useLogic/useLogic.d.ts +9 -0
- package/node/components/DataGrid/PinnedSections/useLogic/useLogic.js +23 -0
- package/node/components/DataGrid/Row/NestedChildren/NestedChildren.js +1 -1
- package/node/components/DataGrid/Row/Row.d.ts +1 -94
- package/node/components/DataGrid/Row/Row.js +23 -8
- package/node/components/DataGrid/Row/constants.d.ts +3 -1
- package/node/components/DataGrid/Row/constants.js +4 -2
- package/node/components/DataGrid/Row/styles.js +8 -7
- package/node/components/DataGrid/Row/types.d.ts +118 -0
- package/node/components/DataGrid/Row/types.js +2 -0
- package/node/components/DataGrid/Row/useLogic/useLogic.d.ts +3 -2
- package/node/components/DataGrid/Row/useLogic/useLogic.js +13 -1
- package/node/components/DataGrid/constants.d.ts +7 -0
- package/node/components/DataGrid/constants.js +7 -0
- package/node/components/DataGrid/hooks/index.d.ts +1 -0
- package/node/components/DataGrid/hooks/index.js +17 -0
- package/node/components/DataGrid/hooks/useRowHover/index.d.ts +1 -0
- package/node/components/DataGrid/hooks/useRowHover/index.js +17 -0
- package/node/components/DataGrid/hooks/useRowHover/useRowHover.d.ts +15 -0
- package/node/components/DataGrid/hooks/useRowHover/useRowHover.js +97 -0
- package/node/components/DataGrid/styles.js +17 -0
- package/node/components/DataGrid/types.d.ts +4 -0
- package/node/components/DataGrid/useLogic/hooks/index.d.ts +2 -0
- package/node/components/DataGrid/useLogic/hooks/index.js +18 -0
- package/node/components/DataGrid/useLogic/hooks/useClassnames/index.d.ts +1 -0
- package/node/components/DataGrid/useLogic/hooks/useClassnames/index.js +17 -0
- package/node/components/DataGrid/useLogic/hooks/useClassnames/useClassnames.d.ts +12 -0
- package/node/components/DataGrid/useLogic/hooks/useClassnames/useClassnames.js +18 -0
- package/node/components/DataGrid/useLogic/hooks/usePinnedColumns/index.d.ts +1 -0
- package/node/components/DataGrid/useLogic/hooks/usePinnedColumns/index.js +17 -0
- package/node/components/DataGrid/useLogic/hooks/usePinnedColumns/usePinnedColumns.d.ts +18 -0
- package/node/components/DataGrid/useLogic/hooks/usePinnedColumns/usePinnedColumns.js +47 -0
- package/node/components/DataGrid/useLogic/useLogic.d.ts +30 -4
- package/node/components/DataGrid/useLogic/useLogic.js +53 -14
- package/node/components/DataGrid/useLogic/utils/getColumnSections/getColumnSections.d.ts +17 -0
- package/node/components/DataGrid/useLogic/utils/getColumnSections/getColumnSections.js +50 -0
- package/node/components/DataGrid/useLogic/utils/getColumnSections/index.d.ts +1 -0
- package/node/components/DataGrid/useLogic/utils/getColumnSections/index.js +17 -0
- package/node/components/DataGrid/useLogic/utils/index.d.ts +2 -1
- package/node/components/DataGrid/useLogic/utils/index.js +5 -3
- package/node/components/DataGrid/useLogic/utils/syncRowsHeight/index.d.ts +1 -0
- package/node/components/DataGrid/useLogic/utils/syncRowsHeight/index.js +17 -0
- package/node/components/DataGrid/useLogic/utils/syncRowsHeight/syncRowsHeight.d.ts +5 -0
- package/node/components/DataGrid/useLogic/utils/syncRowsHeight/syncRowsHeight.js +25 -0
- package/node/components/DataGrid/utils/index.d.ts +1 -0
- package/node/components/DataGrid/utils/index.js +3 -1
- package/node/components/DataGridInfinite/useLogic/useLogic.js +1 -1
- package/node/components/PageContent/constants.d.ts +1 -0
- package/node/components/PageContent/constants.js +1 -0
- package/node/components/PageContent/styles.js +13 -0
- package/node/components/PdfViewer/List/styles.js +4 -0
- package/node/components/PdfViewer/PdfDocument/styles.js +5 -0
- package/node/components/PdfViewer/PdfPage/styles.js +10 -0
- package/node/components/PdfViewer/styles.js +4 -0
- package/node/components/PdfViewer/useLogic/useLogic.js +15 -1
- package/package.json +1 -1
- package/components/DataGrid/Body/useLogic/useLogic.d.ts +0 -12
- package/components/DataGrid/Body/useLogic/useLogic.js +0 -11
- package/node/components/DataGrid/Body/useLogic/useLogic.d.ts +0 -12
- package/node/components/DataGrid/Body/useLogic/useLogic.js +0 -15
- /package/components/DataGrid/{Body → PinnedSections/Section}/useLogic/index.d.ts +0 -0
- /package/components/DataGrid/{Body → PinnedSections/Section}/useLogic/index.js +0 -0
- /package/{node/components/DataGrid/Body → components/DataGrid/PinnedSections}/useLogic/index.d.ts +0 -0
- /package/components/DataGrid/{useLogic/utils → utils}/getGridTemplateColumns/getGridTemplateColumns.d.ts +0 -0
- /package/components/DataGrid/{useLogic/utils → utils}/getGridTemplateColumns/getGridTemplateColumns.js +0 -0
- /package/components/DataGrid/{useLogic/utils → utils}/getGridTemplateColumns/index.d.ts +0 -0
- /package/components/DataGrid/{useLogic/utils → utils}/getGridTemplateColumns/index.js +0 -0
- /package/node/components/DataGrid/{Body → PinnedSections/Section}/useLogic/index.js +0 -0
- /package/node/components/DataGrid/{useLogic/utils → utils}/getGridTemplateColumns/getGridTemplateColumns.d.ts +0 -0
- /package/node/components/DataGrid/{useLogic/utils → utils}/getGridTemplateColumns/getGridTemplateColumns.js +0 -0
- /package/node/components/DataGrid/{useLogic/utils → utils}/getGridTemplateColumns/index.d.ts +0 -0
- /package/node/components/DataGrid/{useLogic/utils → utils}/getGridTemplateColumns/index.js +0 -0
|
@@ -1,99 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { Variant } from '../enums';
|
|
3
|
-
import type { CellValue, DataGridColumns, DataGridRowOptions } from '../types';
|
|
4
|
-
export type BodyProps<TData extends Record<string, CellValue>> = {
|
|
5
|
-
/**
|
|
6
|
-
* Конфигурация колонок для таблицы
|
|
7
|
-
*/
|
|
8
|
-
columns: DataGridColumns<TData>[];
|
|
9
|
-
/**
|
|
10
|
-
* Поле, которое будет использоваться в качестве ключа
|
|
11
|
-
*/
|
|
12
|
-
keyId: keyof TData;
|
|
13
|
-
/**
|
|
14
|
-
* Конфигурация ширины колонок
|
|
15
|
-
*/
|
|
16
|
-
gridColumns: string;
|
|
17
|
-
/**
|
|
18
|
-
* Если true, показывается анимация загрузки
|
|
19
|
-
*/
|
|
20
|
-
isLoading?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Флаг состояния ошибки
|
|
23
|
-
*/
|
|
24
|
-
isError?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Текст ошибки
|
|
27
|
-
*/
|
|
28
|
-
errorMsg?: string;
|
|
29
|
-
/**
|
|
30
|
-
* Идентификатор активного элемента массива rows. Выделяет активную строку в таблице
|
|
31
|
-
*/
|
|
32
|
-
activeRowId?: string;
|
|
33
|
-
/**
|
|
34
|
-
* Если true, то дерево будет раскрыто по умолчанию
|
|
35
|
-
* @default 'false'
|
|
36
|
-
*/
|
|
37
|
-
isInitialExpanded: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Уровень раскрытия дерева по умолчанию, при isInitialExpanded=true
|
|
40
|
-
*/
|
|
41
|
-
expandedLevel: number;
|
|
42
|
-
/**
|
|
43
|
-
* Количество отображаемых по умолчанию дочерних элементов
|
|
44
|
-
*/
|
|
45
|
-
initialVisibleChildrenCount: number;
|
|
46
|
-
/**
|
|
47
|
-
* Номер колонки, в которой будет расположена кнопка "Показать все"
|
|
48
|
-
* Работает только для `variant="subrows"`
|
|
49
|
-
*/
|
|
50
|
-
moreButtonColumnPosition: number;
|
|
51
|
-
/**
|
|
52
|
-
* Если false, кнопка разворачивания элементов не показывается
|
|
53
|
-
* Работает только для `variant="subrows"`
|
|
54
|
-
*/
|
|
55
|
-
isVisibleCollapseButton: boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Если true, то будет отображаться чекбокс для выбора элемента
|
|
58
|
-
*/
|
|
59
|
-
isSelectable?: boolean;
|
|
60
|
-
/**
|
|
61
|
-
* Массив выбранных строк
|
|
62
|
-
*/
|
|
63
|
-
selectedRows?: TData[];
|
|
64
|
-
/**
|
|
65
|
-
* Массив данных для отображения
|
|
66
|
-
*/
|
|
67
|
-
rows: Array<TData & {
|
|
68
|
-
options?: DataGridRowOptions<TData>;
|
|
69
|
-
}>;
|
|
70
|
-
/**
|
|
71
|
-
* Вариант отображения вложенных элементов
|
|
72
|
-
*/
|
|
73
|
-
variant: `${Variant}`;
|
|
74
|
-
/**
|
|
75
|
-
* Используется для отображения переданного кол-ва строк при отсутствии данных
|
|
76
|
-
*/
|
|
77
|
-
minDisplayRows: number;
|
|
78
|
-
/**
|
|
79
|
-
* Заглушка для пустых ячеек (если отсутствует field и filter и renderCell)
|
|
80
|
-
*/
|
|
81
|
-
emptyCellValue?: ReactNode;
|
|
82
|
-
/**
|
|
83
|
-
* Используется для отображения placeholder при отсутствии данных в таблице
|
|
84
|
-
*/
|
|
85
|
-
noDataPlaceholder?: ReactNode;
|
|
86
|
-
/**
|
|
87
|
-
* Обработчик выбора строки
|
|
88
|
-
*/
|
|
89
|
-
onSelectRow: (row: TData) => (event: ChangeEvent<HTMLInputElement>) => void;
|
|
90
|
-
/**
|
|
91
|
-
* Функция обработки нажатия на кнопку "Повторить запрос"
|
|
92
|
-
*/
|
|
93
|
-
onRetry: () => void;
|
|
94
|
-
/**
|
|
95
|
-
* Обработчик клика строки таблицы
|
|
96
|
-
*/
|
|
97
|
-
onRowClick?: (row: TData) => void;
|
|
98
|
-
};
|
|
1
|
+
import type { BodyProps } from './types';
|
|
99
2
|
export declare const Body: <TData extends Record<string, unknown>>(props: BodyProps<TData>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,30 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useContext } from 'react';
|
|
3
3
|
import { ConfigContext } from '../../ConfigProvider';
|
|
4
|
-
import { ContentState } from '../../ContentState';
|
|
5
|
-
import { classNames } from '../../utils/classNames';
|
|
6
|
-
import { dataGridClassnames } from '../constants';
|
|
7
4
|
import { Row } from '../Row';
|
|
8
5
|
import { RowContextProvider } from '../Row/RowContext';
|
|
9
6
|
import { Wrapper } from './styles';
|
|
10
|
-
import { useLogic } from './useLogic';
|
|
11
7
|
const INITIAL_LEVEL = 0;
|
|
12
8
|
export const Body = (props) => {
|
|
13
|
-
const {
|
|
14
|
-
const { isNoData, contentStateProps } = useLogic(props);
|
|
9
|
+
const { components } = useContext(ConfigContext);
|
|
15
10
|
const disableMinHeight = components?.dataGrid?.defaultProps?.disableMinHeight;
|
|
16
|
-
const { rows, selectedRows = [],
|
|
11
|
+
const { rows, selectedRows = [], minDisplayRows, keyId, noDataPlaceholder, className, ...rowProps } = props;
|
|
17
12
|
const renderedRows = rows.map(({ children, options, ...row }) => {
|
|
18
13
|
const rowId = row[keyId];
|
|
19
14
|
const isSelected = Boolean(selectedRows?.find((selectedRow) => selectedRow[keyId] === rowId));
|
|
20
15
|
return (_jsx(RowContextProvider, { children: _jsx(Row, { row: row, selectedRows: selectedRows, options: options, keyId: keyId, level: INITIAL_LEVEL, nestedChildren: children, isSelected: isSelected, ...rowProps }, rowId) }, rowId));
|
|
21
16
|
});
|
|
22
|
-
return (_jsx(Wrapper, { className:
|
|
23
|
-
[dataGridClassnames.bodyEmpty]: isNoData,
|
|
24
|
-
}), "$minDisplayRows": minDisplayRows, "$disableMinHeight": disableMinHeight, children: _jsx(ContentState, { ...contentStateProps, errorState: {
|
|
25
|
-
imgAlt: 'Что-то пошло не так',
|
|
26
|
-
errorList: [errorMsg || ''],
|
|
27
|
-
imgSrc: imagesMap.defaultErrorImgSrc,
|
|
28
|
-
onRetry,
|
|
29
|
-
}, isSmoothLoading: false, children: rows.length ? renderedRows : noDataPlaceholder }) }));
|
|
17
|
+
return (_jsx(Wrapper, { className: className, "$minDisplayRows": minDisplayRows, "$disableMinHeight": disableMinHeight, children: rows.length ? renderedRows : noDataPlaceholder }));
|
|
30
18
|
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { type ChangeEvent, type ReactNode } from 'react';
|
|
2
|
+
import { type Variant } from '../enums';
|
|
3
|
+
import { type CellValue, type DataGridColumns, type DataGridRowOptions } from '../types';
|
|
4
|
+
export type BodyProps<TData extends Record<string, CellValue>> = {
|
|
5
|
+
/**
|
|
6
|
+
* Конфигурация колонок для таблицы
|
|
7
|
+
*/
|
|
8
|
+
columns: DataGridColumns<TData>[];
|
|
9
|
+
/**
|
|
10
|
+
* Поле, которое будет использоваться в качестве ключа
|
|
11
|
+
*/
|
|
12
|
+
keyId: keyof TData;
|
|
13
|
+
/**
|
|
14
|
+
* Конфигурация ширины колонок
|
|
15
|
+
*/
|
|
16
|
+
gridColumns: string;
|
|
17
|
+
/**
|
|
18
|
+
* Идентификатор активного элемента массива rows. Выделяет активную строку в таблице
|
|
19
|
+
*/
|
|
20
|
+
activeRowId?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Если true, то дерево будет раскрыто по умолчанию
|
|
23
|
+
* @default 'false'
|
|
24
|
+
*/
|
|
25
|
+
isInitialExpanded: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Уровень раскрытия дерева по умолчанию, при isInitialExpanded=true
|
|
28
|
+
*/
|
|
29
|
+
expandedLevel: number;
|
|
30
|
+
/**
|
|
31
|
+
* Количество отображаемых по умолчанию дочерних элементов
|
|
32
|
+
*/
|
|
33
|
+
initialVisibleChildrenCount: number;
|
|
34
|
+
/**
|
|
35
|
+
* Номер колонки, в которой будет расположена кнопка "Показать все"
|
|
36
|
+
* Работает только для `variant="subrows"`
|
|
37
|
+
*/
|
|
38
|
+
moreButtonColumnPosition: number;
|
|
39
|
+
/**
|
|
40
|
+
* Если false, кнопка разворачивания элементов не показывается
|
|
41
|
+
* Работает только для `variant="subrows"`
|
|
42
|
+
*/
|
|
43
|
+
isVisibleCollapseButton: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Если true, то будет отображаться чекбокс для выбора элемента
|
|
46
|
+
*/
|
|
47
|
+
isSelectable?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Массив выбранных строк
|
|
50
|
+
*/
|
|
51
|
+
selectedRows?: TData[];
|
|
52
|
+
/**
|
|
53
|
+
* Массив данных для отображения
|
|
54
|
+
*/
|
|
55
|
+
rows: Array<TData & {
|
|
56
|
+
options?: DataGridRowOptions<TData>;
|
|
57
|
+
}>;
|
|
58
|
+
/**
|
|
59
|
+
* Вариант отображения вложенных элементов
|
|
60
|
+
*/
|
|
61
|
+
variant: `${Variant}`;
|
|
62
|
+
/**
|
|
63
|
+
* Используется для отображения переданного кол-ва строк при отсутствии данных
|
|
64
|
+
*/
|
|
65
|
+
minDisplayRows: number;
|
|
66
|
+
/**
|
|
67
|
+
* Заглушка для пустых ячеек (если отсутствует field и filter и renderCell)
|
|
68
|
+
*/
|
|
69
|
+
emptyCellValue?: ReactNode;
|
|
70
|
+
/**
|
|
71
|
+
* Используется для отображения placeholder при отсутствии данных в таблице
|
|
72
|
+
*/
|
|
73
|
+
noDataPlaceholder?: ReactNode;
|
|
74
|
+
/**
|
|
75
|
+
* Обработчик выбора строки
|
|
76
|
+
*/
|
|
77
|
+
onSelectRow: (row: TData) => (event: ChangeEvent<HTMLInputElement>) => void;
|
|
78
|
+
/**
|
|
79
|
+
* Обработчик клика строки таблицы
|
|
80
|
+
*/
|
|
81
|
+
onRowClick?: (row: TData) => void;
|
|
82
|
+
/**
|
|
83
|
+
* Смещение секции
|
|
84
|
+
*/
|
|
85
|
+
sectionOffset?: number;
|
|
86
|
+
/**
|
|
87
|
+
* Общее количество колонок (для правильного определения последней ячейки)
|
|
88
|
+
*/
|
|
89
|
+
totalColumnsCount?: number;
|
|
90
|
+
/**
|
|
91
|
+
* Регистрация элемента строки
|
|
92
|
+
*/
|
|
93
|
+
registerRowElement: (rowId: string, el: HTMLElement) => void;
|
|
94
|
+
/**
|
|
95
|
+
* Отмена регистрации элемента строки
|
|
96
|
+
*/
|
|
97
|
+
unregisterRowElement: (rowId: string, el: HTMLElement) => void;
|
|
98
|
+
/**
|
|
99
|
+
* Обработчик наведения на строку
|
|
100
|
+
*/
|
|
101
|
+
onRowEnter: (rowId: string) => void;
|
|
102
|
+
/**
|
|
103
|
+
* Обработчик выхода из строки
|
|
104
|
+
*/
|
|
105
|
+
onRowLeave: (rowId: string, e: PointerEvent) => void;
|
|
106
|
+
/**
|
|
107
|
+
* Класс применяемый для корневого элемента
|
|
108
|
+
*/
|
|
109
|
+
className?: string;
|
|
110
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useContext } from 'react';
|
|
3
3
|
import { ConfigContext } from '../ConfigProvider';
|
|
4
|
-
import {
|
|
4
|
+
import { ContentState } from '../ContentState';
|
|
5
5
|
import { getInertProps } from '../utils/getInertProps';
|
|
6
6
|
import { Body } from './Body';
|
|
7
|
-
import {
|
|
7
|
+
import { EXPANDED_LEVEL_BY_DEFAULT, INITIAL_OPENED_NESTED_CHILDREN_COUNT_BY_DEFAULT, MIN_DISPLAY_ROWS_BY_DEFAULT, } from './constants';
|
|
8
8
|
import { DataGridContextProvider } from './DataGridContext';
|
|
9
9
|
import { Variant } from './enums';
|
|
10
10
|
import { Head } from './Head';
|
|
11
11
|
import { Loader } from './Loader';
|
|
12
12
|
import { NoData } from './NoData';
|
|
13
|
+
import { PinnedSections } from './PinnedSections';
|
|
13
14
|
import { Container, DataGridWrapper, DisabledDataGridWrapper } from './styles';
|
|
14
15
|
import { useLogic } from './useLogic';
|
|
15
16
|
export const DataGrid = (props) => {
|
|
16
|
-
const { isDataGridDisabled, treeRenderConfig, headProps, bodyProps, loaderProps, renderRows, isAllowHorizontalScroll, isHideHead, } = useLogic(props);
|
|
17
|
+
const { isDataGridDisabled, treeRenderConfig, headColumns, headProps, bodyProps, gridColumns, loaderProps, renderRows, isAllowHorizontalScroll, isHideHead, hasPinnedColumns, pinnedSectionsClassname, dataGridClassname, contentStateProps, rowHoverProps, containerRef, sections, isNoData, bodyClassName, } = useLogic(props);
|
|
17
18
|
const { emptySymbol } = useContext(ConfigContext);
|
|
18
|
-
const { columns, selectedRows = [],
|
|
19
|
+
const { columns, selectedRows = [], maxHeight, minDisplayRows = MIN_DISPLAY_ROWS_BY_DEFAULT, variant = Variant.Tree, footer, noDataPlaceholder, isLoading, subrows, keyId, activeRowId, emptyCellValue = emptySymbol, onRowClick, noDataOptions, headPreAddon, } = props;
|
|
19
20
|
const { moreButtonColumnPosition = 1, isVisibleCollapseButton = true } = subrows || {};
|
|
20
21
|
const { isInitialExpanded = false, expandedLevel = EXPANDED_LEVEL_BY_DEFAULT, initialVisibleChildrenCount = INITIAL_OPENED_NESTED_CHILDREN_COUNT_BY_DEFAULT, } = treeRenderConfig || {};
|
|
21
22
|
const TableContainer = isDataGridDisabled
|
|
@@ -27,5 +28,29 @@ export const DataGrid = (props) => {
|
|
|
27
28
|
}
|
|
28
29
|
return null;
|
|
29
30
|
}, [noDataPlaceholder, noDataOptions, isLoading]);
|
|
30
|
-
|
|
31
|
+
const commonBodyProps = {
|
|
32
|
+
...bodyProps,
|
|
33
|
+
activeRowId,
|
|
34
|
+
keyId,
|
|
35
|
+
selectedRows,
|
|
36
|
+
minDisplayRows,
|
|
37
|
+
rows: renderRows,
|
|
38
|
+
variant,
|
|
39
|
+
emptyCellValue,
|
|
40
|
+
isInitialExpanded,
|
|
41
|
+
expandedLevel,
|
|
42
|
+
initialVisibleChildrenCount,
|
|
43
|
+
moreButtonColumnPosition,
|
|
44
|
+
isVisibleCollapseButton,
|
|
45
|
+
noDataPlaceholder: renderedPlaceholder(),
|
|
46
|
+
onRowClick,
|
|
47
|
+
...rowHoverProps,
|
|
48
|
+
};
|
|
49
|
+
const renderTableContent = () => {
|
|
50
|
+
if (!hasPinnedColumns) {
|
|
51
|
+
return (_jsxs(TableContainer, { "$isAllowHorizontalScroll": isAllowHorizontalScroll, ...getInertProps(isDataGridDisabled), children: [headPreAddon, !isHideHead && (_jsx(Head, { ...headProps, columns: headColumns, gridColumns: gridColumns })), _jsx(ContentState, { ...contentStateProps, children: _jsx(Body, { ...commonBodyProps, columns: columns, gridColumns: gridColumns, className: bodyClassName }) })] }));
|
|
52
|
+
}
|
|
53
|
+
return (_jsx(ContentState, { ...contentStateProps, children: _jsx(PinnedSections, { sections: sections, className: pinnedSectionsClassname, isDisabled: isDataGridDisabled, headProps: headProps, gridColumns: gridColumns, bodyProps: commonBodyProps, isNoData: isNoData }) }));
|
|
54
|
+
};
|
|
55
|
+
return (_jsx(DataGridContextProvider, { isLoading: isLoading, children: _jsxs(Container, { ref: containerRef, "$maxHeight": maxHeight, "$isAllowHorizontalScroll": isAllowHorizontalScroll, className: dataGridClassname, children: [renderTableContent(), _jsx(Loader, { ...loaderProps }), footer && footer] }) }));
|
|
31
56
|
};
|
|
@@ -37,5 +37,9 @@ export type HeadProps<TData extends Record<string, CellValue> = DataGridRow, TSo
|
|
|
37
37
|
* Используется для скрытия чекбокса "Выбрать все"
|
|
38
38
|
*/
|
|
39
39
|
isHideSelectAll?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Смещение секции
|
|
42
|
+
*/
|
|
43
|
+
sectionOffset?: number;
|
|
40
44
|
};
|
|
41
45
|
export declare const Head: <TData extends Record<string, unknown>, TSortField extends keyof TData>(props: HeadProps<TData, TSortField>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,10 +7,11 @@ import { CheckboxCell, Wrapper } from './styles';
|
|
|
7
7
|
import { useLogic } from './useLogic';
|
|
8
8
|
export const Head = (props) => {
|
|
9
9
|
const { checkboxProps, handleSort } = useLogic(props);
|
|
10
|
-
const { columns, gridColumns, isSelectable, sorting, onSelectAllRows, isHideSelectAll, } = props;
|
|
10
|
+
const { columns, gridColumns, isSelectable, sorting, onSelectAllRows, isHideSelectAll, sectionOffset, } = props;
|
|
11
11
|
const renderColumns = useMemo(() => {
|
|
12
12
|
return columns.map(({ field, label, sortable, align, columnHint }, index) => {
|
|
13
|
-
const
|
|
13
|
+
const globalIndex = (sectionOffset ?? 0) + index;
|
|
14
|
+
const isFirstCell = globalIndex === 0;
|
|
14
15
|
const startAdornmentRender = () => {
|
|
15
16
|
const showCheckbox = isFirstCell && isSelectable && !isHideSelectAll;
|
|
16
17
|
if (!showCheckbox && !columnHint) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Backdrop, LoaderWrapper, StyledDivider, StyledLinearProgress, } from './styles';
|
|
3
3
|
export const Loader = ({ isLoading = false, isDisabled = false, isVisibleDivider = true, }) => {
|
|
4
|
-
return (_jsxs(
|
|
4
|
+
return (_jsxs(_Fragment, { children: [(isLoading || isDisabled) && _jsx(Backdrop, {}), _jsxs(LoaderWrapper, { children: [isLoading && _jsx(StyledLinearProgress, {}), !isLoading && isVisibleDivider && _jsx(StyledDivider, {})] })] }));
|
|
5
5
|
};
|
|
@@ -15,11 +15,13 @@ export const StyledDivider = styled(Divider) `
|
|
|
15
15
|
border-width: 1px;
|
|
16
16
|
`;
|
|
17
17
|
export const LoaderWrapper = styled.div `
|
|
18
|
-
|
|
18
|
+
position: sticky;
|
|
19
|
+
z-index: ${({ theme }) => theme.zIndex.fab};
|
|
20
|
+
left: 0;
|
|
19
21
|
`;
|
|
20
22
|
export const StyledLinearProgress = styled(LinearProgress) `
|
|
21
23
|
height: 2px;
|
|
22
|
-
|
|
24
|
+
|
|
23
25
|
.${linearProgressClasses.barColorPrimary} {
|
|
24
26
|
background-color: ${({ theme }) => theme.palette.primary[800]};
|
|
25
27
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type BodyProps } from '../Body';
|
|
2
|
+
import { type HeadProps } from '../Head';
|
|
3
|
+
import { type CellValue, type DataGridRow } from '../types';
|
|
4
|
+
import type { PinnedSection } from './types';
|
|
5
|
+
export type PinnedSectionsProps<TData extends Record<string, CellValue> = DataGridRow, TSortField extends keyof TData = keyof TData> = {
|
|
6
|
+
/**
|
|
7
|
+
* Конфигурация закрепленных секций
|
|
8
|
+
*/
|
|
9
|
+
sections: PinnedSection<TData>[];
|
|
10
|
+
/**
|
|
11
|
+
* Конфигурация ширины колонок
|
|
12
|
+
*/
|
|
13
|
+
gridColumns: string;
|
|
14
|
+
/**
|
|
15
|
+
* Класс применяемый для корневого элемента
|
|
16
|
+
*/
|
|
17
|
+
className?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Если true, таблица будет заблокирована для взаимодействия
|
|
20
|
+
*/
|
|
21
|
+
isDisabled?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Параметры предназначены для конфигурации таблицы
|
|
24
|
+
*/
|
|
25
|
+
bodyProps: Omit<BodyProps<TData>, 'gridColumns' | 'columns'>;
|
|
26
|
+
/**
|
|
27
|
+
* Параметры предназначены для конфигурации шапки таблицы
|
|
28
|
+
*/
|
|
29
|
+
headProps: Omit<HeadProps<TData, TSortField>, 'columns' | 'gridColumns'>;
|
|
30
|
+
/**
|
|
31
|
+
* Флаг для отображения placeholder при отсутствии данных
|
|
32
|
+
*/
|
|
33
|
+
isNoData?: boolean;
|
|
34
|
+
};
|
|
35
|
+
export declare const PinnedSections: <TData extends Record<string, unknown> = DataGridRow, TSortField extends keyof TData = keyof TData>({ gridColumns, className, isDisabled, headProps, bodyProps, sections, isNoData, }: PinnedSectionsProps<TData, TSortField>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getInertProps } from '../../utils/getInertProps';
|
|
3
|
+
import { Section } from './Section';
|
|
4
|
+
import { PinnedColumnsContainer } from './styles';
|
|
5
|
+
import { useLogic } from './useLogic';
|
|
6
|
+
export const PinnedSections = ({ gridColumns, className, isDisabled, headProps, bodyProps, sections, isNoData, }) => {
|
|
7
|
+
const { pinnedContainerStyles, sectionOffsets } = useLogic({ sections });
|
|
8
|
+
return (_jsx(PinnedColumnsContainer, { "$gridColumns": gridColumns, className: className, ...getInertProps(isDisabled), style: pinnedContainerStyles, children: sections.map(({ columns, position }) => {
|
|
9
|
+
return (_jsx(Section, { columns: columns, position: position, sectionOffset: sectionOffsets[position], bodyProps: bodyProps, headProps: headProps, isNoData: isNoData }, position));
|
|
10
|
+
}) }));
|
|
11
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { DataGridRow } from '../../types';
|
|
2
|
+
import type { SectionProps } from './types';
|
|
3
|
+
export declare const Section: <TData extends Record<string, unknown> = DataGridRow, TSortField extends keyof TData = keyof TData>({ columns, position, isNoData, headProps, bodyProps, sectionOffset, }: SectionProps<TData, TSortField>) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Body } from '../../Body';
|
|
3
|
+
import { dataGridClassnames } from '../../constants';
|
|
4
|
+
import { Head } from '../../Head';
|
|
5
|
+
import { DataGridSection } from './styles';
|
|
6
|
+
import { useLogic } from './useLogic';
|
|
7
|
+
export const Section = ({ columns, position, isNoData, headProps, bodyProps, sectionOffset, }) => {
|
|
8
|
+
const { classnames, gridColumns, shouldNotRenderSection } = useLogic({
|
|
9
|
+
position,
|
|
10
|
+
isNoData,
|
|
11
|
+
columns,
|
|
12
|
+
});
|
|
13
|
+
if (shouldNotRenderSection) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
return (_jsxs(DataGridSection, { className: classnames, children: [!isNoData && (_jsx(Head, { ...headProps, columns: columns, gridColumns: gridColumns, sectionOffset: sectionOffset })), _jsx(Body, { ...bodyProps, columns: columns, gridColumns: gridColumns, sectionOffset: sectionOffset, className: dataGridClassnames.body })] }));
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Section';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Section';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const DataGridSection: import("../../../styled").StyledComponent<{
|
|
3
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
5
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { styled } from '../../../styled';
|
|
2
|
+
import { dataGridClassnames } from '../../constants';
|
|
3
|
+
export const DataGridSection = styled.div `
|
|
4
|
+
display: flex;
|
|
5
|
+
grid-column: calc(var(--left-columns-count) + 1) / calc(var(--right-columns-count) * -1 - 1);
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
|
|
8
|
+
min-width: 0;
|
|
9
|
+
|
|
10
|
+
background-color: ${({ theme }) => theme.palette.background.default};
|
|
11
|
+
|
|
12
|
+
& .${dataGridClassnames.header} {
|
|
13
|
+
position: sticky;
|
|
14
|
+
z-index: ${({ theme }) => theme.zIndex.fab - 1};
|
|
15
|
+
top: 0;
|
|
16
|
+
|
|
17
|
+
background-color: ${({ theme }) => theme.palette.background.default};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&.${dataGridClassnames.pinnedSectionNoData} {
|
|
21
|
+
grid-column: 1 / -1;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&.${dataGridClassnames.leftPinnedSection} {
|
|
25
|
+
position: sticky;
|
|
26
|
+
z-index: ${({ theme }) => theme.zIndex.fab};
|
|
27
|
+
left: 0;
|
|
28
|
+
|
|
29
|
+
container-name: data-grid-left-pinned-section;
|
|
30
|
+
container-type: scroll-state;
|
|
31
|
+
grid-column: 1 / calc(var(--left-columns-count) + 1);
|
|
32
|
+
|
|
33
|
+
&::after {
|
|
34
|
+
content: '';
|
|
35
|
+
|
|
36
|
+
position: absolute;
|
|
37
|
+
z-index: ${({ theme }) => theme.zIndex.fab};
|
|
38
|
+
top: 0;
|
|
39
|
+
right: 0;
|
|
40
|
+
|
|
41
|
+
height: 100%;
|
|
42
|
+
|
|
43
|
+
border-right: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
& .${dataGridClassnames.header} {
|
|
47
|
+
left: 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
/* Причина игнора: прогрессивное улучшение */
|
|
52
|
+
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
53
|
+
@container data-grid-left-pinned-section scroll-state(stuck: left) {
|
|
54
|
+
&::after {
|
|
55
|
+
/* Ширина видимой части тени */
|
|
56
|
+
width: 4px;
|
|
57
|
+
|
|
58
|
+
box-shadow: 3px 0 4px 0 #63636326;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&.${dataGridClassnames.rightPinnedSection} {
|
|
64
|
+
position: sticky;
|
|
65
|
+
z-index: ${({ theme }) => theme.zIndex.fab};
|
|
66
|
+
right: 0;
|
|
67
|
+
|
|
68
|
+
container-name: data-grid-right-pinned-section;
|
|
69
|
+
container-type: scroll-state;
|
|
70
|
+
grid-column: calc(var(--right-columns-count) * -1 - 1) / -1;
|
|
71
|
+
|
|
72
|
+
&::after {
|
|
73
|
+
content: '';
|
|
74
|
+
|
|
75
|
+
position: absolute;
|
|
76
|
+
z-index: ${({ theme }) => theme.zIndex.fab};
|
|
77
|
+
top: 0;
|
|
78
|
+
left: 0;
|
|
79
|
+
|
|
80
|
+
height: 100%;
|
|
81
|
+
|
|
82
|
+
border-left: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
& .${dataGridClassnames.header} {
|
|
86
|
+
right: 0;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* Причина игнора: прогрессивное улучшение */
|
|
90
|
+
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
91
|
+
@container data-grid-right-pinned-section scroll-state(stuck: right) {
|
|
92
|
+
&::after {
|
|
93
|
+
/* Ширина видимой части тени */
|
|
94
|
+
width: 4px;
|
|
95
|
+
|
|
96
|
+
box-shadow: -3px 0 4px 0 #63636326;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
`;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type BodyProps } from '../../Body';
|
|
2
|
+
import { type HeadProps } from '../../Head';
|
|
3
|
+
import { type CellValue, type DataGridColumns, type DataGridRow } from '../../types';
|
|
4
|
+
export type SectionProps<TData extends Record<string, CellValue> = DataGridRow, TSortField extends keyof TData = keyof TData> = {
|
|
5
|
+
/**
|
|
6
|
+
* Параметры предназначены для конфигурации таблицы
|
|
7
|
+
*/
|
|
8
|
+
bodyProps: Omit<BodyProps<TData>, 'gridColumns' | 'columns'>;
|
|
9
|
+
/**
|
|
10
|
+
* Параметры предназначены для конфигурации шапки таблицы
|
|
11
|
+
*/
|
|
12
|
+
headProps: Omit<HeadProps<TData, TSortField>, 'columns' | 'gridColumns'>;
|
|
13
|
+
/**
|
|
14
|
+
* Флаг для отображения placeholder при отсутствии данных
|
|
15
|
+
*/
|
|
16
|
+
isNoData?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Конфигурация колонок для секции
|
|
19
|
+
*/
|
|
20
|
+
columns: DataGridColumns<TData>[];
|
|
21
|
+
/**
|
|
22
|
+
* Позиция секции
|
|
23
|
+
*/
|
|
24
|
+
position: 'left' | 'center' | 'right';
|
|
25
|
+
sectionOffset: number;
|
|
26
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CellValue, DataGridRow } from '../../..//types';
|
|
2
|
+
import { type SectionProps } from '../types';
|
|
3
|
+
type UseLogicParams<TData extends Record<string, CellValue> = DataGridRow> = Pick<SectionProps<TData>, 'isNoData' | 'position' | 'columns'>;
|
|
4
|
+
export declare const useLogic: <TData extends Record<string, unknown> = DataGridRow>({ position, isNoData, columns, }: UseLogicParams<TData>) => {
|
|
5
|
+
classnames: string;
|
|
6
|
+
gridColumns: string;
|
|
7
|
+
shouldNotRenderSection: boolean;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { classNames } from '../../../../utils/classNames';
|
|
3
|
+
import { dataGridClassnames } from '../../../constants';
|
|
4
|
+
import { getGridTemplateColumns } from '../../../utils';
|
|
5
|
+
export const useLogic = ({ position, isNoData, columns, }) => {
|
|
6
|
+
const classnames = useMemo(() => classNames({
|
|
7
|
+
[dataGridClassnames.leftPinnedSection]: position === 'left',
|
|
8
|
+
[dataGridClassnames.rightPinnedSection]: position === 'right',
|
|
9
|
+
[dataGridClassnames.pinnedSectionNoData]: isNoData && position === 'center',
|
|
10
|
+
}), []);
|
|
11
|
+
const shouldNotRenderSection = (isNoData && position !== 'center') || !columns || columns.length === 0;
|
|
12
|
+
const gridColumns = shouldNotRenderSection
|
|
13
|
+
? ''
|
|
14
|
+
: getGridTemplateColumns(columns);
|
|
15
|
+
return { classnames, gridColumns, shouldNotRenderSection };
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './PinnedSections';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './PinnedSections';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const PinnedColumnsContainer: import("../../styled").StyledComponent<{
|
|
3
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
5
|
+
} & {
|
|
6
|
+
$gridColumns: string;
|
|
7
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { styled } from '../../styled';
|
|
2
|
+
import { dataGridClassnames } from '../constants';
|
|
3
|
+
export const PinnedColumnsContainer = styled.div `
|
|
4
|
+
overflow: auto;
|
|
5
|
+
display: grid;
|
|
6
|
+
grid-template-columns: ${({ $gridColumns }) => $gridColumns};
|
|
7
|
+
|
|
8
|
+
width: 100%;
|
|
9
|
+
height: 100%;
|
|
10
|
+
|
|
11
|
+
&.${dataGridClassnames.disabled} {
|
|
12
|
+
pointer-events: none;
|
|
13
|
+
|
|
14
|
+
background: ${({ theme }) => theme.palette.background.element};
|
|
15
|
+
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
16
|
+
mix-blend-mode: luminosity;
|
|
17
|
+
}
|
|
18
|
+
`;
|