@astral/ui 4.45.0 → 4.47.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/ComplianceStatus/ComplianceStatus.d.ts +1 -43
- package/components/ComplianceStatus/ComplianceStatus.js +17 -2
- package/components/ComplianceStatus/constants.d.ts +14 -0
- package/components/ComplianceStatus/constants.js +18 -0
- package/components/ComplianceStatus/index.d.ts +2 -1
- package/components/ComplianceStatus/index.js +1 -1
- package/components/ComplianceStatus/public.d.ts +2 -1
- package/components/ComplianceStatus/public.js +1 -1
- package/components/ComplianceStatus/styles.d.ts +0 -5
- package/components/ComplianceStatus/styles.js +21 -3
- package/components/ComplianceStatus/types.d.ts +42 -0
- package/components/ComplianceStatus/types.js +1 -0
- 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/node/components/ComplianceStatus/ComplianceStatus.d.ts +1 -43
- package/node/components/ComplianceStatus/ComplianceStatus.js +17 -2
- package/node/components/ComplianceStatus/constants.d.ts +14 -0
- package/node/components/ComplianceStatus/constants.js +21 -0
- package/node/components/ComplianceStatus/index.d.ts +2 -1
- package/node/components/ComplianceStatus/public.d.ts +2 -1
- package/node/components/ComplianceStatus/styles.d.ts +0 -5
- package/node/components/ComplianceStatus/styles.js +21 -3
- package/node/components/ComplianceStatus/types.d.ts +42 -0
- package/node/components/ComplianceStatus/types.js +2 -0
- 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/package.json +2 -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
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Синхронизирует высоту строк DataGrid на основе высоты их содержимого.
|
|
3
|
+
* Каждая строка устанавливает высоту равной максимальной высоте всех своих ячеек.
|
|
4
|
+
*/
|
|
5
|
+
export const syncRowsHeight = (rowsMap) => {
|
|
6
|
+
rowsMap.forEach((elements) => {
|
|
7
|
+
let maxHeight = 0;
|
|
8
|
+
elements.forEach((el) => {
|
|
9
|
+
el.style.height = '';
|
|
10
|
+
});
|
|
11
|
+
elements.forEach((el) => {
|
|
12
|
+
const height = el.offsetHeight;
|
|
13
|
+
if (height > maxHeight) {
|
|
14
|
+
maxHeight = height;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
elements.forEach((el) => {
|
|
18
|
+
el.style.height = `${maxHeight}px`;
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useMemo, useRef, useState, } from 'react';
|
|
2
2
|
import { Variant } from '../../DataGrid/enums';
|
|
3
|
-
import { getGridTemplateColumns } from '../../DataGrid/
|
|
3
|
+
import { getGridTemplateColumns } from '../../DataGrid/utils';
|
|
4
4
|
import { useToggle } from '../../useToggle';
|
|
5
5
|
import { prop } from '../../utils/prop';
|
|
6
6
|
import { uniqueBy } from '../../utils/uniqueBy';
|
|
@@ -1,44 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type ItemStatus = 'success' | 'reject' | 'default' | 'loading';
|
|
3
|
-
type BackgroundColor = 'grey' | 'primary';
|
|
4
|
-
type Variant = 'plain' | 'contained';
|
|
5
|
-
export type ComplianceStatusItem = {
|
|
6
|
-
/**
|
|
7
|
-
* Текст для отображения в элементе списка
|
|
8
|
-
*/
|
|
9
|
-
text: ReactNode;
|
|
10
|
-
/**
|
|
11
|
-
* Статус элемента
|
|
12
|
-
*/
|
|
13
|
-
status: ItemStatus;
|
|
14
|
-
};
|
|
15
|
-
export type ComplianceStatusProps = {
|
|
16
|
-
/**
|
|
17
|
-
* Основной заголовок элемента
|
|
18
|
-
*/
|
|
19
|
-
title?: string | null;
|
|
20
|
-
/**
|
|
21
|
-
* Пропс для добавления контента между заголовком и списком
|
|
22
|
-
*/
|
|
23
|
-
subtitle?: ReactNode;
|
|
24
|
-
/**
|
|
25
|
-
* Пропс для добавления контента после списка
|
|
26
|
-
*/
|
|
27
|
-
children?: ReactNode;
|
|
28
|
-
/**
|
|
29
|
-
* Элементы списка
|
|
30
|
-
*/
|
|
31
|
-
itemsList: ComplianceStatusItem[];
|
|
32
|
-
/**
|
|
33
|
-
* Фоновый цвет
|
|
34
|
-
* @default grey
|
|
35
|
-
*/
|
|
36
|
-
backgroundColor?: BackgroundColor;
|
|
37
|
-
/**
|
|
38
|
-
* Вариант отображения блока статусов
|
|
39
|
-
* @default contained
|
|
40
|
-
*/
|
|
41
|
-
variant?: Variant;
|
|
42
|
-
};
|
|
1
|
+
import type { ComplianceStatusProps } from './types';
|
|
43
2
|
export declare const ComplianceStatus: ({ title, itemsList, children, subtitle, backgroundColor, variant, }: ComplianceStatusProps) => import("react/jsx-runtime").JSX.Element;
|
|
44
|
-
export {};
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ComplianceStatus = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const class_variance_authority_1 = require("class-variance-authority");
|
|
5
6
|
const OverflowTypography_1 = require("../OverflowTypography");
|
|
6
7
|
const Typography_1 = require("../Typography");
|
|
8
|
+
const constants_1 = require("./constants");
|
|
7
9
|
const styles_1 = require("./styles");
|
|
8
10
|
const ICON_BY_STATUS = {
|
|
9
11
|
default: (0, jsx_runtime_1.jsx)(styles_1.EmptyIcon, {}),
|
|
@@ -11,9 +13,22 @@ const ICON_BY_STATUS = {
|
|
|
11
13
|
reject: (0, jsx_runtime_1.jsx)(styles_1.RejectIcon, {}),
|
|
12
14
|
loading: (0, jsx_runtime_1.jsx)(styles_1.StyledLoader, {}),
|
|
13
15
|
};
|
|
16
|
+
const complianceStatus = (0, class_variance_authority_1.cva)(constants_1.complianceStatusClassnames.root, {
|
|
17
|
+
variants: {
|
|
18
|
+
backgroundColor: {
|
|
19
|
+
grey: constants_1.complianceStatusColorClassnames.grey,
|
|
20
|
+
primary: constants_1.complianceStatusColorClassnames.primary,
|
|
21
|
+
},
|
|
22
|
+
variant: {
|
|
23
|
+
contained: constants_1.complianceStatusVariantClassnames.contained,
|
|
24
|
+
outlined: constants_1.complianceStatusVariantClassnames.outlined,
|
|
25
|
+
plain: constants_1.complianceStatusVariantClassnames.plain,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
});
|
|
14
29
|
const ComplianceStatus = ({ title, itemsList, children, subtitle, backgroundColor = 'grey', variant = 'contained', }) => {
|
|
15
|
-
return ((0, jsx_runtime_1.jsxs)(styles_1.Wrapper, {
|
|
30
|
+
return ((0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { className: complianceStatus({ backgroundColor, variant }), children: [title && ((0, jsx_runtime_1.jsx)(OverflowTypography_1.OverflowTypography, { className: constants_1.complianceStatusClassnames.title, variant: "h6", component: "h4", children: title })), subtitle, (0, jsx_runtime_1.jsx)(styles_1.Inner, { className: constants_1.complianceStatusClassnames.list, children: itemsList.map(({ text, status }, index) => (
|
|
16
31
|
// biome-ignore lint/suspicious/noArrayIndexKey: Элементы статичны
|
|
17
|
-
(0, jsx_runtime_1.jsxs)(styles_1.Item, { children: [ICON_BY_STATUS[status], (0, jsx_runtime_1.jsx)(Typography_1.Typography, { children: text })] }, index))) }), children] }));
|
|
32
|
+
(0, jsx_runtime_1.jsxs)(styles_1.Item, { className: constants_1.complianceStatusClassnames.item, children: [ICON_BY_STATUS[status], (0, jsx_runtime_1.jsx)(Typography_1.Typography, { children: text })] }, index))) }), children] }));
|
|
18
33
|
};
|
|
19
34
|
exports.ComplianceStatus = ComplianceStatus;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BackgroundColor, Variant } from './types';
|
|
2
|
+
export declare const complianceStatusColorClassnames: Record<BackgroundColor, string>;
|
|
3
|
+
export declare const complianceStatusVariantClassnames: Record<Variant, string>;
|
|
4
|
+
export declare const complianceStatusClassnames: {
|
|
5
|
+
contained: string;
|
|
6
|
+
outlined: string;
|
|
7
|
+
plain: string;
|
|
8
|
+
primary: string;
|
|
9
|
+
grey: string;
|
|
10
|
+
root: string;
|
|
11
|
+
title: string;
|
|
12
|
+
list: string;
|
|
13
|
+
item: string;
|
|
14
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.complianceStatusClassnames = exports.complianceStatusVariantClassnames = exports.complianceStatusColorClassnames = void 0;
|
|
4
|
+
const createUIKitClassname_1 = require("../utils/createUIKitClassname");
|
|
5
|
+
exports.complianceStatusColorClassnames = {
|
|
6
|
+
grey: (0, createUIKitClassname_1.createUIKitClassname)('compliance-status_color-grey'),
|
|
7
|
+
primary: (0, createUIKitClassname_1.createUIKitClassname)('compliance-status_color-primary'),
|
|
8
|
+
};
|
|
9
|
+
exports.complianceStatusVariantClassnames = {
|
|
10
|
+
plain: (0, createUIKitClassname_1.createUIKitClassname)('compliance-status_variant-plain'),
|
|
11
|
+
contained: (0, createUIKitClassname_1.createUIKitClassname)('compliance-status_variant-contained'),
|
|
12
|
+
outlined: (0, createUIKitClassname_1.createUIKitClassname)('compliance-status_variant-outlined'),
|
|
13
|
+
};
|
|
14
|
+
exports.complianceStatusClassnames = {
|
|
15
|
+
root: (0, createUIKitClassname_1.createUIKitClassname)('compliance-status'),
|
|
16
|
+
title: (0, createUIKitClassname_1.createUIKitClassname)('compliance-status__title'),
|
|
17
|
+
list: (0, createUIKitClassname_1.createUIKitClassname)('compliance-status__list'),
|
|
18
|
+
item: (0, createUIKitClassname_1.createUIKitClassname)('compliance-status__item'),
|
|
19
|
+
...exports.complianceStatusColorClassnames,
|
|
20
|
+
...exports.complianceStatusVariantClassnames,
|
|
21
|
+
};
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { ComplianceStatus
|
|
1
|
+
export { ComplianceStatus } from './ComplianceStatus';
|
|
2
|
+
export type { ComplianceStatusItem, ComplianceStatusProps } from './types';
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { ComplianceStatus
|
|
1
|
+
export { ComplianceStatus } from './ComplianceStatus';
|
|
2
|
+
export type { ComplianceStatusItem, ComplianceStatusProps } from './types';
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
type Variant = 'plain' | 'contained';
|
|
3
2
|
export declare const Wrapper: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
|
|
4
3
|
theme?: import("@emotion/react").Theme | undefined;
|
|
5
4
|
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
6
|
-
} & {
|
|
7
|
-
$background: 'grey' | 'primary';
|
|
8
|
-
$variant: Variant;
|
|
9
5
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, {}>;
|
|
10
6
|
export declare const Inner: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
|
|
11
7
|
theme?: import("@emotion/react").Theme | undefined;
|
|
@@ -51,4 +47,3 @@ export declare const SuccessIcon: import("@emotion/styled/dist/declarations/src/
|
|
|
51
47
|
export declare const StyledLoader: import("@emotion/styled/dist/declarations/src/types").StyledComponent<import("../Loader").LoaderProps & {
|
|
52
48
|
theme?: import("@emotion/react").Theme | undefined;
|
|
53
49
|
}, {}, {}>;
|
|
54
|
-
export {};
|
|
@@ -7,6 +7,7 @@ const SuccessFillSm_1 = require("../../icons/SuccessFillSm");
|
|
|
7
7
|
const Loader_1 = require("../Loader");
|
|
8
8
|
const styled_1 = require("../styled");
|
|
9
9
|
const mixins_1 = require("../styled/mixins");
|
|
10
|
+
const constants_1 = require("./constants");
|
|
10
11
|
const iconAppearAnimation = (0, styled_1.keyframes) `
|
|
11
12
|
from {
|
|
12
13
|
transform: scale(0);
|
|
@@ -17,14 +18,31 @@ const iconAppearAnimation = (0, styled_1.keyframes) `
|
|
|
17
18
|
opacity: 1;
|
|
18
19
|
}
|
|
19
20
|
`;
|
|
20
|
-
exports.Wrapper =
|
|
21
|
+
exports.Wrapper = styled_1.styled.article `
|
|
21
22
|
display: grid;
|
|
22
23
|
grid-gap: ${({ theme }) => theme.spacing(2)};
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
background-color: inherit;
|
|
25
26
|
|
|
26
|
-
background-color: ${({ theme, $background, $variant }) => $variant === 'contained' ? theme.palette[$background][100] : 'inherit'};
|
|
27
27
|
border-radius: ${({ theme }) => theme.shape.medium};
|
|
28
|
+
|
|
29
|
+
&.${constants_1.complianceStatusClassnames.contained} {
|
|
30
|
+
padding: ${({ theme }) => theme.spacing(3)};
|
|
31
|
+
|
|
32
|
+
&.${constants_1.complianceStatusClassnames.primary} {
|
|
33
|
+
background-color: ${({ theme }) => theme.palette.primary[100]};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&.${constants_1.complianceStatusClassnames.grey} {
|
|
37
|
+
background-color: ${({ theme }) => theme.palette.grey[100]};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&.${constants_1.complianceStatusClassnames.outlined} {
|
|
42
|
+
padding: ${({ theme }) => theme.spacing(3)};
|
|
43
|
+
|
|
44
|
+
border: 1px solid ${({ theme }) => theme.palette.grey[300]};
|
|
45
|
+
}
|
|
28
46
|
`;
|
|
29
47
|
exports.Inner = (0, styled_1.styled)('ul') `
|
|
30
48
|
display: grid;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export type ItemStatus = 'success' | 'reject' | 'default' | 'loading';
|
|
3
|
+
export type BackgroundColor = 'grey' | 'primary';
|
|
4
|
+
export type Variant = 'plain' | 'contained' | 'outlined';
|
|
5
|
+
export type ComplianceStatusItem = {
|
|
6
|
+
/**
|
|
7
|
+
* Текст для отображения в элементе списка
|
|
8
|
+
*/
|
|
9
|
+
text: ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Статус элемента
|
|
12
|
+
*/
|
|
13
|
+
status: ItemStatus;
|
|
14
|
+
};
|
|
15
|
+
export type ComplianceStatusProps = {
|
|
16
|
+
/**
|
|
17
|
+
* Основной заголовок элемента
|
|
18
|
+
*/
|
|
19
|
+
title?: string | null;
|
|
20
|
+
/**
|
|
21
|
+
* Пропс для добавления контента между заголовком и списком
|
|
22
|
+
*/
|
|
23
|
+
subtitle?: ReactNode;
|
|
24
|
+
/**
|
|
25
|
+
* Пропс для добавления контента после списка
|
|
26
|
+
*/
|
|
27
|
+
children?: ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* Элементы списка
|
|
30
|
+
*/
|
|
31
|
+
itemsList: ComplianceStatusItem[];
|
|
32
|
+
/**
|
|
33
|
+
* Фоновый цвет
|
|
34
|
+
* @default grey
|
|
35
|
+
*/
|
|
36
|
+
backgroundColor?: BackgroundColor;
|
|
37
|
+
/**
|
|
38
|
+
* Вариант отображения блока статусов
|
|
39
|
+
* @default contained
|
|
40
|
+
*/
|
|
41
|
+
variant?: Variant;
|
|
42
|
+
};
|
|
@@ -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;
|
|
@@ -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;
|