@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
|
@@ -4,31 +4,19 @@ exports.Body = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const ConfigProvider_1 = require("../../ConfigProvider");
|
|
7
|
-
const ContentState_1 = require("../../ContentState");
|
|
8
|
-
const classNames_1 = require("../../utils/classNames");
|
|
9
|
-
const constants_1 = require("../constants");
|
|
10
7
|
const Row_1 = require("../Row");
|
|
11
8
|
const RowContext_1 = require("../Row/RowContext");
|
|
12
9
|
const styles_1 = require("./styles");
|
|
13
|
-
const useLogic_1 = require("./useLogic");
|
|
14
10
|
const INITIAL_LEVEL = 0;
|
|
15
11
|
const Body = (props) => {
|
|
16
|
-
const {
|
|
17
|
-
const { isNoData, contentStateProps } = (0, useLogic_1.useLogic)(props);
|
|
12
|
+
const { components } = (0, react_1.useContext)(ConfigProvider_1.ConfigContext);
|
|
18
13
|
const disableMinHeight = components?.dataGrid?.defaultProps?.disableMinHeight;
|
|
19
|
-
const { rows, selectedRows = [],
|
|
14
|
+
const { rows, selectedRows = [], minDisplayRows, keyId, noDataPlaceholder, className, ...rowProps } = props;
|
|
20
15
|
const renderedRows = rows.map(({ children, options, ...row }) => {
|
|
21
16
|
const rowId = row[keyId];
|
|
22
17
|
const isSelected = Boolean(selectedRows?.find((selectedRow) => selectedRow[keyId] === rowId));
|
|
23
18
|
return ((0, jsx_runtime_1.jsx)(RowContext_1.RowContextProvider, { children: (0, jsx_runtime_1.jsx)(Row_1.Row, { row: row, selectedRows: selectedRows, options: options, keyId: keyId, level: INITIAL_LEVEL, nestedChildren: children, isSelected: isSelected, ...rowProps }, rowId) }, rowId));
|
|
24
19
|
});
|
|
25
|
-
return ((0, jsx_runtime_1.jsx)(styles_1.Wrapper, { className:
|
|
26
|
-
[constants_1.dataGridClassnames.bodyEmpty]: isNoData,
|
|
27
|
-
}), "$minDisplayRows": minDisplayRows, "$disableMinHeight": disableMinHeight, children: (0, jsx_runtime_1.jsx)(ContentState_1.ContentState, { ...contentStateProps, errorState: {
|
|
28
|
-
imgAlt: 'Что-то пошло не так',
|
|
29
|
-
errorList: [errorMsg || ''],
|
|
30
|
-
imgSrc: imagesMap.defaultErrorImgSrc,
|
|
31
|
-
onRetry,
|
|
32
|
-
}, isSmoothLoading: false, children: rows.length ? renderedRows : noDataPlaceholder }) }));
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)(styles_1.Wrapper, { className: className, "$minDisplayRows": minDisplayRows, "$disableMinHeight": disableMinHeight, children: rows.length ? renderedRows : noDataPlaceholder }));
|
|
33
21
|
};
|
|
34
22
|
exports.Body = Body;
|
|
@@ -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
|
+
};
|
|
@@ -4,7 +4,7 @@ exports.DataGrid = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const ConfigProvider_1 = require("../ConfigProvider");
|
|
7
|
-
const
|
|
7
|
+
const ContentState_1 = require("../ContentState");
|
|
8
8
|
const getInertProps_1 = require("../utils/getInertProps");
|
|
9
9
|
const Body_1 = require("./Body");
|
|
10
10
|
const constants_1 = require("./constants");
|
|
@@ -13,12 +13,13 @@ const enums_1 = require("./enums");
|
|
|
13
13
|
const Head_1 = require("./Head");
|
|
14
14
|
const Loader_1 = require("./Loader");
|
|
15
15
|
const NoData_1 = require("./NoData");
|
|
16
|
+
const PinnedSections_1 = require("./PinnedSections");
|
|
16
17
|
const styles_1 = require("./styles");
|
|
17
18
|
const useLogic_1 = require("./useLogic");
|
|
18
19
|
const DataGrid = (props) => {
|
|
19
|
-
const { isDataGridDisabled, treeRenderConfig, headProps, bodyProps, loaderProps, renderRows, isAllowHorizontalScroll, isHideHead, } = (0, useLogic_1.useLogic)(props);
|
|
20
|
+
const { isDataGridDisabled, treeRenderConfig, headColumns, headProps, bodyProps, gridColumns, loaderProps, renderRows, isAllowHorizontalScroll, isHideHead, hasPinnedColumns, pinnedSectionsClassname, dataGridClassname, contentStateProps, rowHoverProps, containerRef, sections, isNoData, bodyClassName, } = (0, useLogic_1.useLogic)(props);
|
|
20
21
|
const { emptySymbol } = (0, react_1.useContext)(ConfigProvider_1.ConfigContext);
|
|
21
|
-
const { columns, selectedRows = [],
|
|
22
|
+
const { columns, selectedRows = [], maxHeight, minDisplayRows = constants_1.MIN_DISPLAY_ROWS_BY_DEFAULT, variant = enums_1.Variant.Tree, footer, noDataPlaceholder, isLoading, subrows, keyId, activeRowId, emptyCellValue = emptySymbol, onRowClick, noDataOptions, headPreAddon, } = props;
|
|
22
23
|
const { moreButtonColumnPosition = 1, isVisibleCollapseButton = true } = subrows || {};
|
|
23
24
|
const { isInitialExpanded = false, expandedLevel = constants_1.EXPANDED_LEVEL_BY_DEFAULT, initialVisibleChildrenCount = constants_1.INITIAL_OPENED_NESTED_CHILDREN_COUNT_BY_DEFAULT, } = treeRenderConfig || {};
|
|
24
25
|
const TableContainer = isDataGridDisabled
|
|
@@ -30,6 +31,30 @@ const DataGrid = (props) => {
|
|
|
30
31
|
}
|
|
31
32
|
return null;
|
|
32
33
|
}, [noDataPlaceholder, noDataOptions, isLoading]);
|
|
33
|
-
|
|
34
|
+
const commonBodyProps = {
|
|
35
|
+
...bodyProps,
|
|
36
|
+
activeRowId,
|
|
37
|
+
keyId,
|
|
38
|
+
selectedRows,
|
|
39
|
+
minDisplayRows,
|
|
40
|
+
rows: renderRows,
|
|
41
|
+
variant,
|
|
42
|
+
emptyCellValue,
|
|
43
|
+
isInitialExpanded,
|
|
44
|
+
expandedLevel,
|
|
45
|
+
initialVisibleChildrenCount,
|
|
46
|
+
moreButtonColumnPosition,
|
|
47
|
+
isVisibleCollapseButton,
|
|
48
|
+
noDataPlaceholder: renderedPlaceholder(),
|
|
49
|
+
onRowClick,
|
|
50
|
+
...rowHoverProps,
|
|
51
|
+
};
|
|
52
|
+
const renderTableContent = () => {
|
|
53
|
+
if (!hasPinnedColumns) {
|
|
54
|
+
return ((0, jsx_runtime_1.jsxs)(TableContainer, { "$isAllowHorizontalScroll": isAllowHorizontalScroll, ...(0, getInertProps_1.getInertProps)(isDataGridDisabled), children: [headPreAddon, !isHideHead && ((0, jsx_runtime_1.jsx)(Head_1.Head, { ...headProps, columns: headColumns, gridColumns: gridColumns })), (0, jsx_runtime_1.jsx)(ContentState_1.ContentState, { ...contentStateProps, children: (0, jsx_runtime_1.jsx)(Body_1.Body, { ...commonBodyProps, columns: columns, gridColumns: gridColumns, className: bodyClassName }) })] }));
|
|
55
|
+
}
|
|
56
|
+
return ((0, jsx_runtime_1.jsx)(ContentState_1.ContentState, { ...contentStateProps, children: (0, jsx_runtime_1.jsx)(PinnedSections_1.PinnedSections, { sections: sections, className: pinnedSectionsClassname, isDisabled: isDataGridDisabled, headProps: headProps, gridColumns: gridColumns, bodyProps: commonBodyProps, isNoData: isNoData }) }));
|
|
57
|
+
};
|
|
58
|
+
return ((0, jsx_runtime_1.jsx)(DataGridContext_1.DataGridContextProvider, { isLoading: isLoading, children: (0, jsx_runtime_1.jsxs)(styles_1.Container, { ref: containerRef, "$maxHeight": maxHeight, "$isAllowHorizontalScroll": isAllowHorizontalScroll, className: dataGridClassname, children: [renderTableContent(), (0, jsx_runtime_1.jsx)(Loader_1.Loader, { ...loaderProps }), footer && footer] }) }));
|
|
34
59
|
};
|
|
35
60
|
exports.DataGrid = DataGrid;
|
|
@@ -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;
|
|
@@ -10,10 +10,11 @@ const styles_1 = require("./styles");
|
|
|
10
10
|
const useLogic_1 = require("./useLogic");
|
|
11
11
|
const Head = (props) => {
|
|
12
12
|
const { checkboxProps, handleSort } = (0, useLogic_1.useLogic)(props);
|
|
13
|
-
const { columns, gridColumns, isSelectable, sorting, onSelectAllRows, isHideSelectAll, } = props;
|
|
13
|
+
const { columns, gridColumns, isSelectable, sorting, onSelectAllRows, isHideSelectAll, sectionOffset, } = props;
|
|
14
14
|
const renderColumns = (0, react_1.useMemo)(() => {
|
|
15
15
|
return columns.map(({ field, label, sortable, align, columnHint }, index) => {
|
|
16
|
-
const
|
|
16
|
+
const globalIndex = (sectionOffset ?? 0) + index;
|
|
17
|
+
const isFirstCell = globalIndex === 0;
|
|
17
18
|
const startAdornmentRender = () => {
|
|
18
19
|
const showCheckbox = isFirstCell && isSelectable && !isHideSelectAll;
|
|
19
20
|
if (!showCheckbox && !columnHint) {
|
|
@@ -4,6 +4,6 @@ exports.Loader = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const styles_1 = require("./styles");
|
|
6
6
|
const Loader = ({ isLoading = false, isDisabled = false, isVisibleDivider = true, }) => {
|
|
7
|
-
return ((0, jsx_runtime_1.jsxs)(
|
|
7
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(isLoading || isDisabled) && (0, jsx_runtime_1.jsx)(styles_1.Backdrop, {}), (0, jsx_runtime_1.jsxs)(styles_1.LoaderWrapper, { children: [isLoading && (0, jsx_runtime_1.jsx)(styles_1.StyledLinearProgress, {}), !isLoading && isVisibleDivider && (0, jsx_runtime_1.jsx)(styles_1.StyledDivider, {})] })] }));
|
|
8
8
|
};
|
|
9
9
|
exports.Loader = Loader;
|
|
@@ -41,11 +41,13 @@ exports.StyledDivider = (0, styled_1.styled)(Divider_1.Divider) `
|
|
|
41
41
|
border-width: 1px;
|
|
42
42
|
`;
|
|
43
43
|
exports.LoaderWrapper = styled_1.styled.div `
|
|
44
|
-
|
|
44
|
+
position: sticky;
|
|
45
|
+
z-index: ${({ theme }) => theme.zIndex.fab};
|
|
46
|
+
left: 0;
|
|
45
47
|
`;
|
|
46
48
|
exports.StyledLinearProgress = (0, styled_1.styled)(LinearProgress_1.default) `
|
|
47
49
|
height: 2px;
|
|
48
|
-
|
|
50
|
+
|
|
49
51
|
.${LinearProgress_1.linearProgressClasses.barColorPrimary} {
|
|
50
52
|
background-color: ${({ theme }) => theme.palette.primary[800]};
|
|
51
53
|
}
|
|
@@ -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,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PinnedSections = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const getInertProps_1 = require("../../utils/getInertProps");
|
|
6
|
+
const Section_1 = require("./Section");
|
|
7
|
+
const styles_1 = require("./styles");
|
|
8
|
+
const useLogic_1 = require("./useLogic");
|
|
9
|
+
const PinnedSections = ({ gridColumns, className, isDisabled, headProps, bodyProps, sections, isNoData, }) => {
|
|
10
|
+
const { pinnedContainerStyles, sectionOffsets } = (0, useLogic_1.useLogic)({ sections });
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)(styles_1.PinnedColumnsContainer, { "$gridColumns": gridColumns, className: className, ...(0, getInertProps_1.getInertProps)(isDisabled), style: pinnedContainerStyles, children: sections.map(({ columns, position }) => {
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)(Section_1.Section, { columns: columns, position: position, sectionOffset: sectionOffsets[position], bodyProps: bodyProps, headProps: headProps, isNoData: isNoData }, position));
|
|
13
|
+
}) }));
|
|
14
|
+
};
|
|
15
|
+
exports.PinnedSections = PinnedSections;
|
|
@@ -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,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Section = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const Body_1 = require("../../Body");
|
|
6
|
+
const constants_1 = require("../../constants");
|
|
7
|
+
const Head_1 = require("../../Head");
|
|
8
|
+
const styles_1 = require("./styles");
|
|
9
|
+
const useLogic_1 = require("./useLogic");
|
|
10
|
+
const Section = ({ columns, position, isNoData, headProps, bodyProps, sectionOffset, }) => {
|
|
11
|
+
const { classnames, gridColumns, shouldNotRenderSection } = (0, useLogic_1.useLogic)({
|
|
12
|
+
position,
|
|
13
|
+
isNoData,
|
|
14
|
+
columns,
|
|
15
|
+
});
|
|
16
|
+
if (shouldNotRenderSection) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return ((0, jsx_runtime_1.jsxs)(styles_1.DataGridSection, { className: classnames, children: [!isNoData && ((0, jsx_runtime_1.jsx)(Head_1.Head, { ...headProps, columns: columns, gridColumns: gridColumns, sectionOffset: sectionOffset })), (0, jsx_runtime_1.jsx)(Body_1.Body, { ...bodyProps, columns: columns, gridColumns: gridColumns, sectionOffset: sectionOffset, className: constants_1.dataGridClassnames.body })] }));
|
|
20
|
+
};
|
|
21
|
+
exports.Section = Section;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Section';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Section"), exports);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const DataGridSection: import("@emotion/styled/dist/declarations/src/types").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,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataGridSection = void 0;
|
|
4
|
+
const styled_1 = require("../../../styled");
|
|
5
|
+
const constants_1 = require("../../constants");
|
|
6
|
+
exports.DataGridSection = styled_1.styled.div `
|
|
7
|
+
display: flex;
|
|
8
|
+
grid-column: calc(var(--left-columns-count) + 1) / calc(var(--right-columns-count) * -1 - 1);
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
|
|
11
|
+
min-width: 0;
|
|
12
|
+
|
|
13
|
+
background-color: ${({ theme }) => theme.palette.background.default};
|
|
14
|
+
|
|
15
|
+
& .${constants_1.dataGridClassnames.header} {
|
|
16
|
+
position: sticky;
|
|
17
|
+
z-index: ${({ theme }) => theme.zIndex.fab - 1};
|
|
18
|
+
top: 0;
|
|
19
|
+
|
|
20
|
+
background-color: ${({ theme }) => theme.palette.background.default};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&.${constants_1.dataGridClassnames.pinnedSectionNoData} {
|
|
24
|
+
grid-column: 1 / -1;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&.${constants_1.dataGridClassnames.leftPinnedSection} {
|
|
28
|
+
position: sticky;
|
|
29
|
+
z-index: ${({ theme }) => theme.zIndex.fab};
|
|
30
|
+
left: 0;
|
|
31
|
+
|
|
32
|
+
container-name: data-grid-left-pinned-section;
|
|
33
|
+
container-type: scroll-state;
|
|
34
|
+
grid-column: 1 / calc(var(--left-columns-count) + 1);
|
|
35
|
+
|
|
36
|
+
&::after {
|
|
37
|
+
content: '';
|
|
38
|
+
|
|
39
|
+
position: absolute;
|
|
40
|
+
z-index: ${({ theme }) => theme.zIndex.fab};
|
|
41
|
+
top: 0;
|
|
42
|
+
right: 0;
|
|
43
|
+
|
|
44
|
+
height: 100%;
|
|
45
|
+
|
|
46
|
+
border-right: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
& .${constants_1.dataGridClassnames.header} {
|
|
50
|
+
left: 0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
/* Причина игнора: прогрессивное улучшение */
|
|
55
|
+
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
56
|
+
@container data-grid-left-pinned-section scroll-state(stuck: left) {
|
|
57
|
+
&::after {
|
|
58
|
+
/* Ширина видимой части тени */
|
|
59
|
+
width: 4px;
|
|
60
|
+
|
|
61
|
+
box-shadow: 3px 0 4px 0 #63636326;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&.${constants_1.dataGridClassnames.rightPinnedSection} {
|
|
67
|
+
position: sticky;
|
|
68
|
+
z-index: ${({ theme }) => theme.zIndex.fab};
|
|
69
|
+
right: 0;
|
|
70
|
+
|
|
71
|
+
container-name: data-grid-right-pinned-section;
|
|
72
|
+
container-type: scroll-state;
|
|
73
|
+
grid-column: calc(var(--right-columns-count) * -1 - 1) / -1;
|
|
74
|
+
|
|
75
|
+
&::after {
|
|
76
|
+
content: '';
|
|
77
|
+
|
|
78
|
+
position: absolute;
|
|
79
|
+
z-index: ${({ theme }) => theme.zIndex.fab};
|
|
80
|
+
top: 0;
|
|
81
|
+
left: 0;
|
|
82
|
+
|
|
83
|
+
height: 100%;
|
|
84
|
+
|
|
85
|
+
border-left: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
& .${constants_1.dataGridClassnames.header} {
|
|
89
|
+
right: 0;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* Причина игнора: прогрессивное улучшение */
|
|
93
|
+
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
94
|
+
@container data-grid-right-pinned-section scroll-state(stuck: right) {
|
|
95
|
+
&::after {
|
|
96
|
+
/* Ширина видимой части тени */
|
|
97
|
+
width: 4px;
|
|
98
|
+
|
|
99
|
+
box-shadow: -3px 0 4px 0 #63636326;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
`;
|
|
@@ -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 * from './useLogic';
|
|
@@ -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,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useLogic = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const classNames_1 = require("../../../../utils/classNames");
|
|
6
|
+
const constants_1 = require("../../../constants");
|
|
7
|
+
const utils_1 = require("../../../utils");
|
|
8
|
+
const useLogic = ({ position, isNoData, columns, }) => {
|
|
9
|
+
const classnames = (0, react_1.useMemo)(() => (0, classNames_1.classNames)({
|
|
10
|
+
[constants_1.dataGridClassnames.leftPinnedSection]: position === 'left',
|
|
11
|
+
[constants_1.dataGridClassnames.rightPinnedSection]: position === 'right',
|
|
12
|
+
[constants_1.dataGridClassnames.pinnedSectionNoData]: isNoData && position === 'center',
|
|
13
|
+
}), []);
|
|
14
|
+
const shouldNotRenderSection = (isNoData && position !== 'center') || !columns || columns.length === 0;
|
|
15
|
+
const gridColumns = shouldNotRenderSection
|
|
16
|
+
? ''
|
|
17
|
+
: (0, utils_1.getGridTemplateColumns)(columns);
|
|
18
|
+
return { classnames, gridColumns, shouldNotRenderSection };
|
|
19
|
+
};
|
|
20
|
+
exports.useLogic = useLogic;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './PinnedSections';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./PinnedSections"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const PinnedColumnsContainer: import("@emotion/styled/dist/declarations/src/types").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,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PinnedColumnsContainer = void 0;
|
|
4
|
+
const styled_1 = require("../../styled");
|
|
5
|
+
const constants_1 = require("../constants");
|
|
6
|
+
exports.PinnedColumnsContainer = styled_1.styled.div `
|
|
7
|
+
overflow: auto;
|
|
8
|
+
display: grid;
|
|
9
|
+
grid-template-columns: ${({ $gridColumns }) => $gridColumns};
|
|
10
|
+
|
|
11
|
+
width: 100%;
|
|
12
|
+
height: 100%;
|
|
13
|
+
|
|
14
|
+
&.${constants_1.dataGridClassnames.disabled} {
|
|
15
|
+
pointer-events: none;
|
|
16
|
+
|
|
17
|
+
background: ${({ theme }) => theme.palette.background.element};
|
|
18
|
+
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
19
|
+
mix-blend-mode: luminosity;
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useLogic';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./useLogic"), exports);
|