@astral/ui 4.62.2 → 4.64.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/ConfirmDialog/ConfirmDialog.js +2 -2
- package/components/ConfirmDialog/types.d.ts +2 -2
- package/components/DataGrid/Body/styles.js +4 -0
- package/components/DataGrid/Cell/Cell.d.ts +6 -2
- package/components/DataGrid/Cell/Cell.js +18 -2
- package/components/DataGrid/Cell/constants.d.ts +6 -0
- package/components/DataGrid/Cell/constants.js +6 -0
- package/components/DataGrid/Cell/index.d.ts +1 -0
- package/components/DataGrid/Cell/index.js +1 -0
- package/components/DataGrid/Cell/styles.d.ts +1 -8
- package/components/DataGrid/Cell/styles.js +43 -8
- package/components/DataGrid/DataGrid.js +11 -2
- package/components/DataGrid/Head/Head.js +14 -30
- package/components/DataGrid/Head/HeadColumns/GroupColumns/GroupColumns.d.ts +14 -0
- package/components/DataGrid/Head/HeadColumns/GroupColumns/GroupColumns.js +4 -0
- package/components/DataGrid/Head/HeadColumns/GroupColumns/index.d.ts +1 -0
- package/components/DataGrid/Head/HeadColumns/GroupColumns/index.js +1 -0
- package/components/DataGrid/Head/HeadColumns/HeadCellStartAdornment/HeadCellStartAdornment.d.ts +9 -0
- package/components/DataGrid/Head/HeadColumns/HeadCellStartAdornment/HeadCellStartAdornment.js +9 -0
- package/components/DataGrid/Head/HeadColumns/HeadCellStartAdornment/index.d.ts +1 -0
- package/components/DataGrid/Head/HeadColumns/HeadCellStartAdornment/index.js +1 -0
- package/components/DataGrid/Head/HeadColumns/HeadCellStartAdornment/styles.d.ts +5 -0
- package/components/DataGrid/Head/HeadColumns/HeadCellStartAdornment/styles.js +9 -0
- package/components/DataGrid/Head/HeadColumns/HeadColumns.d.ts +41 -0
- package/components/DataGrid/Head/HeadColumns/HeadColumns.js +26 -0
- package/components/DataGrid/Head/HeadColumns/SingleColumn/SingleColumn.d.ts +13 -0
- package/components/DataGrid/Head/HeadColumns/SingleColumn/SingleColumn.js +3 -0
- package/components/DataGrid/Head/HeadColumns/SingleColumn/index.d.ts +1 -0
- package/components/DataGrid/Head/HeadColumns/SingleColumn/index.js +1 -0
- package/components/DataGrid/Head/HeadColumns/index.d.ts +1 -0
- package/components/DataGrid/Head/HeadColumns/index.js +1 -0
- package/components/DataGrid/Head/HeadColumns/styles.d.ts +5 -0
- package/components/DataGrid/Head/HeadColumns/styles.js +9 -0
- package/components/DataGrid/Head/HeadColumns/useLogic/useLogic.d.ts +12 -0
- package/components/DataGrid/Head/HeadColumns/useLogic/useLogic.js +46 -0
- package/components/DataGrid/Head/HeadColumns/useLogic/utils/getGridPositions/getGridPositions.d.ts +6 -0
- package/components/DataGrid/Head/HeadColumns/useLogic/utils/getGridPositions/getGridPositions.js +19 -0
- package/components/DataGrid/Head/HeadColumns/useLogic/utils/getGridPositions/index.d.ts +1 -0
- package/components/DataGrid/Head/HeadColumns/useLogic/utils/getGridPositions/index.js +1 -0
- package/components/DataGrid/Head/HeadColumns/useLogic/utils/index.d.ts +1 -0
- package/components/DataGrid/Head/HeadColumns/useLogic/utils/index.js +1 -0
- package/components/DataGrid/Head/HeadColumns/utils/getHeadCellProps.d.ts +18 -0
- package/components/DataGrid/Head/HeadColumns/utils/getHeadCellProps.js +17 -0
- package/components/DataGrid/Head/HeadColumns/utils/index.d.ts +1 -0
- package/components/DataGrid/Head/HeadColumns/utils/index.js +1 -0
- package/components/DataGrid/Head/styles.d.ts +0 -4
- package/components/DataGrid/Head/styles.js +2 -8
- package/components/DataGrid/HeadCell/HeadCell.d.ts +11 -0
- package/components/DataGrid/HeadCell/HeadCell.js +21 -3
- package/components/DataGrid/HeadCell/constants.d.ts +11 -0
- package/components/DataGrid/HeadCell/constants.js +12 -0
- package/components/DataGrid/HeadCell/index.d.ts +1 -0
- package/components/DataGrid/HeadCell/index.js +1 -0
- package/components/DataGrid/HeadCell/styles.d.ts +1 -8
- package/components/DataGrid/HeadCell/styles.js +24 -7
- package/components/DataGrid/HeadCell/useLogic/useLogic.d.ts +5 -5
- package/components/DataGrid/HeadCell/useLogic/useLogic.js +8 -5
- package/components/DataGrid/PinnedSections/Section/styles.js +4 -0
- package/components/DataGrid/PinnedSections/Section/useLogic/useLogic.js +2 -2
- package/components/DataGrid/PinnedSections/styles.js +8 -4
- package/components/DataGrid/PinnedSections/useLogic/useLogic.js +10 -5
- package/components/DataGrid/Row/Row.js +22 -3
- package/components/DataGrid/Row/constants.d.ts +8 -0
- package/components/DataGrid/Row/constants.js +8 -0
- package/components/DataGrid/Row/styles.d.ts +10 -0
- package/components/DataGrid/Row/styles.js +15 -2
- package/components/DataGrid/constants.d.ts +4 -1
- package/components/DataGrid/constants.js +4 -1
- package/components/DataGrid/faker.js +13 -9
- package/components/DataGrid/index.d.ts +1 -1
- package/components/DataGrid/styles.js +84 -2
- package/components/DataGrid/types.d.ts +38 -1
- package/components/DataGrid/useLogic/hooks/useDataGridMobileLogic/useDataGridMobileLogic.d.ts +2 -2
- package/components/DataGrid/useLogic/useLogic.d.ts +3 -1
- package/components/DataGrid/useLogic/useLogic.js +10 -6
- package/components/DataGrid/useLogic/utils/getColumnSections/getColumnSections.d.ts +1 -1
- package/components/DataGrid/useLogic/utils/getColumnSections/getColumnSections.js +17 -10
- package/components/DataGrid/utils/getFlattenColumns/getFlattenColumns.d.ts +2 -0
- package/components/DataGrid/utils/getFlattenColumns/getFlattenColumns.js +13 -0
- package/components/DataGrid/utils/getFlattenColumns/index.d.ts +1 -0
- package/components/DataGrid/utils/getFlattenColumns/index.js +1 -0
- package/components/DataGrid/utils/index.d.ts +2 -1
- package/components/DataGrid/utils/index.js +2 -1
- package/components/DataGrid/utils/isGroupColumns/index.d.ts +1 -0
- package/components/DataGrid/utils/isGroupColumns/index.js +1 -0
- package/components/DataGrid/utils/isGroupColumns/isGroupColumns.d.ts +2 -0
- package/components/DataGrid/utils/isGroupColumns/isGroupColumns.js +3 -0
- package/components/DataGridInfinite/DataGridInfinite.js +15 -3
- package/components/DataGridInfinite/useLogic/useLogic.d.ts +4 -1
- package/components/DataGridInfinite/useLogic/useLogic.js +10 -4
- package/components/Dialog/Dialog.d.ts +2 -24
- package/components/Dialog/Dialog.js +18 -11
- package/components/Dialog/constants.d.ts +5 -0
- package/components/Dialog/constants.js +6 -0
- package/components/Dialog/index.d.ts +2 -1
- package/components/Dialog/index.js +1 -1
- package/components/Dialog/public.d.ts +2 -1
- package/components/Dialog/public.js +1 -1
- package/components/Dialog/styles.js +11 -4
- package/components/Dialog/types.d.ts +23 -0
- package/components/Dialog/types.js +1 -0
- package/components/Dialog/useLogic/index.js +1 -0
- package/components/Dialog/useLogic/useLogic.d.ts +25 -0
- package/components/Dialog/useLogic/useLogic.js +19 -0
- package/components/PageLayoutContainer/PageLayoutContainer.js +2 -2
- package/components/PageLayoutContainer/styles.d.ts +1 -1
- package/components/PageLayoutContainer/styles.js +1 -1
- package/components/ResizingDataGrid/hooks/useComputedColumns/useComputedColumns.d.ts +1 -1
- package/components/ResizingDataGrid/hooks/useComputedColumns/utils/createComputedColumns/createComputedColumns.d.ts +2 -2
- package/components/ResizingDataGrid/types.d.ts +2 -2
- package/node/components/ConfirmDialog/ConfirmDialog.js +2 -2
- package/node/components/ConfirmDialog/types.d.ts +2 -2
- package/node/components/DataGrid/Body/styles.js +4 -0
- package/node/components/DataGrid/Cell/Cell.d.ts +6 -2
- package/node/components/DataGrid/Cell/Cell.js +18 -2
- package/node/components/DataGrid/Cell/constants.d.ts +6 -0
- package/node/components/DataGrid/Cell/constants.js +6 -0
- package/node/components/DataGrid/Cell/index.d.ts +1 -0
- package/node/components/DataGrid/Cell/index.js +3 -0
- package/node/components/DataGrid/Cell/styles.d.ts +1 -8
- package/node/components/DataGrid/Cell/styles.js +43 -8
- package/node/components/DataGrid/DataGrid.js +11 -2
- package/node/components/DataGrid/Head/Head.js +12 -28
- package/node/components/DataGrid/Head/HeadColumns/GroupColumns/GroupColumns.d.ts +14 -0
- package/node/components/DataGrid/Head/HeadColumns/GroupColumns/GroupColumns.js +8 -0
- package/node/components/DataGrid/Head/HeadColumns/GroupColumns/index.d.ts +1 -0
- package/node/components/DataGrid/{utils/alignToJustifyContent → Head/HeadColumns/GroupColumns}/index.js +1 -1
- package/node/components/DataGrid/Head/HeadColumns/HeadCellStartAdornment/HeadCellStartAdornment.d.ts +9 -0
- package/node/components/DataGrid/Head/HeadColumns/HeadCellStartAdornment/HeadCellStartAdornment.js +13 -0
- package/node/components/DataGrid/Head/HeadColumns/HeadCellStartAdornment/index.d.ts +1 -0
- package/node/components/DataGrid/Head/HeadColumns/HeadCellStartAdornment/index.js +17 -0
- package/node/components/DataGrid/Head/HeadColumns/HeadCellStartAdornment/styles.d.ts +5 -0
- package/node/components/DataGrid/Head/HeadColumns/HeadCellStartAdornment/styles.js +12 -0
- package/node/components/DataGrid/Head/HeadColumns/HeadColumns.d.ts +41 -0
- package/node/components/DataGrid/Head/HeadColumns/HeadColumns.js +30 -0
- package/node/components/DataGrid/Head/HeadColumns/SingleColumn/SingleColumn.d.ts +13 -0
- package/node/components/DataGrid/Head/HeadColumns/SingleColumn/SingleColumn.js +7 -0
- package/node/components/DataGrid/Head/HeadColumns/SingleColumn/index.d.ts +1 -0
- package/node/components/DataGrid/Head/HeadColumns/SingleColumn/index.js +17 -0
- package/node/components/DataGrid/Head/HeadColumns/index.d.ts +1 -0
- package/node/components/DataGrid/Head/HeadColumns/index.js +17 -0
- package/node/components/DataGrid/Head/HeadColumns/styles.d.ts +5 -0
- package/node/components/DataGrid/Head/HeadColumns/styles.js +12 -0
- package/node/components/DataGrid/Head/HeadColumns/useLogic/index.d.ts +1 -0
- package/node/components/DataGrid/Head/HeadColumns/useLogic/useLogic.d.ts +12 -0
- package/node/components/DataGrid/Head/{useLogic → HeadColumns/useLogic}/useLogic.js +25 -9
- package/node/components/DataGrid/Head/HeadColumns/useLogic/utils/getGridPositions/getGridPositions.d.ts +6 -0
- package/node/components/DataGrid/Head/HeadColumns/useLogic/utils/getGridPositions/getGridPositions.js +23 -0
- package/node/components/DataGrid/Head/HeadColumns/useLogic/utils/getGridPositions/index.d.ts +1 -0
- package/node/components/DataGrid/Head/HeadColumns/useLogic/utils/getGridPositions/index.js +17 -0
- package/node/components/DataGrid/Head/HeadColumns/useLogic/utils/index.d.ts +1 -0
- package/node/components/DataGrid/Head/HeadColumns/useLogic/utils/index.js +17 -0
- package/node/components/DataGrid/Head/HeadColumns/utils/getHeadCellProps.d.ts +18 -0
- package/node/components/DataGrid/Head/HeadColumns/utils/getHeadCellProps.js +21 -0
- package/node/components/DataGrid/Head/HeadColumns/utils/index.d.ts +1 -0
- package/node/components/DataGrid/Head/HeadColumns/utils/index.js +17 -0
- package/node/components/DataGrid/Head/styles.d.ts +0 -4
- package/node/components/DataGrid/Head/styles.js +3 -9
- package/node/components/DataGrid/HeadCell/HeadCell.d.ts +11 -0
- package/node/components/DataGrid/HeadCell/HeadCell.js +21 -3
- package/node/components/DataGrid/HeadCell/constants.d.ts +11 -0
- package/node/components/DataGrid/HeadCell/constants.js +15 -0
- package/node/components/DataGrid/HeadCell/index.d.ts +1 -0
- package/node/components/DataGrid/HeadCell/index.js +3 -0
- package/node/components/DataGrid/HeadCell/styles.d.ts +1 -8
- package/node/components/DataGrid/HeadCell/styles.js +24 -7
- package/node/components/DataGrid/HeadCell/useLogic/useLogic.d.ts +5 -5
- package/node/components/DataGrid/HeadCell/useLogic/useLogic.js +8 -5
- package/node/components/DataGrid/PinnedSections/Section/styles.js +4 -0
- package/node/components/DataGrid/PinnedSections/Section/useLogic/useLogic.js +1 -1
- package/node/components/DataGrid/PinnedSections/styles.js +8 -4
- package/node/components/DataGrid/PinnedSections/useLogic/useLogic.js +10 -5
- package/node/components/DataGrid/Row/Row.js +21 -2
- package/node/components/DataGrid/Row/constants.d.ts +8 -0
- package/node/components/DataGrid/Row/constants.js +9 -1
- package/node/components/DataGrid/Row/styles.d.ts +10 -0
- package/node/components/DataGrid/Row/styles.js +15 -2
- package/node/components/DataGrid/constants.d.ts +4 -1
- package/node/components/DataGrid/constants.js +4 -1
- package/node/components/DataGrid/faker.js +13 -9
- package/node/components/DataGrid/index.d.ts +1 -1
- package/node/components/DataGrid/styles.js +93 -11
- package/node/components/DataGrid/types.d.ts +38 -1
- package/node/components/DataGrid/useLogic/hooks/useDataGridMobileLogic/useDataGridMobileLogic.d.ts +2 -2
- package/node/components/DataGrid/useLogic/useLogic.d.ts +3 -1
- package/node/components/DataGrid/useLogic/useLogic.js +9 -5
- package/node/components/DataGrid/useLogic/utils/getColumnSections/getColumnSections.d.ts +1 -1
- package/node/components/DataGrid/useLogic/utils/getColumnSections/getColumnSections.js +17 -10
- package/node/components/DataGrid/utils/getFlattenColumns/getFlattenColumns.d.ts +2 -0
- package/node/components/DataGrid/utils/getFlattenColumns/getFlattenColumns.js +17 -0
- package/node/components/DataGrid/utils/getFlattenColumns/index.d.ts +1 -0
- package/node/components/DataGrid/utils/getFlattenColumns/index.js +5 -0
- package/node/components/DataGrid/utils/index.d.ts +2 -1
- package/node/components/DataGrid/utils/index.js +5 -3
- package/node/components/DataGrid/utils/isGroupColumns/index.d.ts +1 -0
- package/node/components/DataGrid/utils/isGroupColumns/index.js +17 -0
- package/node/components/DataGrid/utils/isGroupColumns/isGroupColumns.d.ts +2 -0
- package/node/components/DataGrid/utils/isGroupColumns/isGroupColumns.js +7 -0
- package/node/components/DataGridInfinite/DataGridInfinite.js +15 -3
- package/node/components/DataGridInfinite/useLogic/useLogic.d.ts +4 -1
- package/node/components/DataGridInfinite/useLogic/useLogic.js +9 -3
- package/node/components/Dialog/Dialog.d.ts +2 -24
- package/node/components/Dialog/Dialog.js +18 -11
- package/node/components/Dialog/constants.d.ts +5 -0
- package/node/components/Dialog/constants.js +7 -1
- package/node/components/Dialog/index.d.ts +2 -1
- package/node/components/Dialog/index.js +2 -1
- package/node/components/Dialog/public.d.ts +2 -1
- package/node/components/Dialog/public.js +2 -1
- package/node/components/Dialog/styles.js +12 -25
- package/node/components/Dialog/types.d.ts +23 -0
- package/node/components/Dialog/types.js +2 -0
- package/node/components/Dialog/useLogic/index.d.ts +1 -0
- package/node/components/Dialog/useLogic/index.js +17 -0
- package/node/components/Dialog/useLogic/useLogic.d.ts +25 -0
- package/node/components/Dialog/useLogic/useLogic.js +23 -0
- package/node/components/PageLayoutContainer/PageLayoutContainer.js +1 -1
- package/node/components/PageLayoutContainer/styles.d.ts +1 -1
- package/node/components/PageLayoutContainer/styles.js +2 -2
- package/node/components/ResizingDataGrid/hooks/useComputedColumns/useComputedColumns.d.ts +1 -1
- package/node/components/ResizingDataGrid/hooks/useComputedColumns/utils/createComputedColumns/createComputedColumns.d.ts +2 -2
- package/node/components/ResizingDataGrid/types.d.ts +2 -2
- package/package.json +1 -1
- package/components/DataGrid/Head/useLogic/useLogic.d.ts +0 -12
- package/components/DataGrid/Head/useLogic/useLogic.js +0 -30
- package/components/DataGrid/utils/alignToJustifyContent/alignToJustifyContent.d.ts +0 -5
- package/components/DataGrid/utils/alignToJustifyContent/alignToJustifyContent.js +0 -7
- package/components/DataGrid/utils/alignToJustifyContent/constants.d.ts +0 -6
- package/components/DataGrid/utils/alignToJustifyContent/constants.js +0 -6
- package/components/DataGrid/utils/alignToJustifyContent/index.d.ts +0 -1
- package/components/DataGrid/utils/alignToJustifyContent/index.js +0 -1
- package/node/components/DataGrid/Head/useLogic/useLogic.d.ts +0 -12
- package/node/components/DataGrid/utils/alignToJustifyContent/alignToJustifyContent.d.ts +0 -5
- package/node/components/DataGrid/utils/alignToJustifyContent/alignToJustifyContent.js +0 -11
- package/node/components/DataGrid/utils/alignToJustifyContent/constants.d.ts +0 -6
- package/node/components/DataGrid/utils/alignToJustifyContent/constants.js +0 -9
- package/node/components/DataGrid/utils/alignToJustifyContent/index.d.ts +0 -1
- /package/components/DataGrid/Head/{useLogic → HeadColumns/useLogic}/index.d.ts +0 -0
- /package/components/DataGrid/Head/{useLogic → HeadColumns/useLogic}/index.js +0 -0
- /package/{node/components/DataGrid/Head → components/Dialog}/useLogic/index.d.ts +0 -0
- /package/node/components/DataGrid/Head/{useLogic → HeadColumns/useLogic}/index.js +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type CellValue, type DataGridColumns } from '../../../types';
|
|
3
|
+
type Params<TData extends Record<string, CellValue>> = {
|
|
4
|
+
column: DataGridColumns<TData>;
|
|
5
|
+
index: number;
|
|
6
|
+
sectionOffset?: number;
|
|
7
|
+
isSelectable: boolean;
|
|
8
|
+
isHideSelectAll?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare const getHeadCellProps: <TData extends Record<string, unknown>>({ column, index, sectionOffset, isSelectable, isHideSelectAll, }: Params<TData>) => {
|
|
11
|
+
label: string | undefined;
|
|
12
|
+
align: import("../../../types").AlignVariant | undefined;
|
|
13
|
+
columnHint: import("react").ReactNode;
|
|
14
|
+
field: keyof TData | undefined;
|
|
15
|
+
sortable: boolean | undefined;
|
|
16
|
+
showCheckbox: boolean;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { isGroupColumns } from '../../../utils';
|
|
2
|
+
export const getHeadCellProps = ({ column, index, sectionOffset, isSelectable, isHideSelectAll, }) => {
|
|
3
|
+
const { label, align, columnHint } = column;
|
|
4
|
+
const field = isGroupColumns(column) ? undefined : column.field;
|
|
5
|
+
const sortable = isGroupColumns(column) ? undefined : column.sortable;
|
|
6
|
+
const globalIndex = (sectionOffset ?? 0) + index;
|
|
7
|
+
const isFirstCell = globalIndex === 0;
|
|
8
|
+
const showCheckbox = isFirstCell && isSelectable && !isHideSelectAll;
|
|
9
|
+
return {
|
|
10
|
+
label,
|
|
11
|
+
align,
|
|
12
|
+
columnHint,
|
|
13
|
+
field,
|
|
14
|
+
sortable,
|
|
15
|
+
showCheckbox,
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './getHeadCellProps';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './getHeadCellProps';
|
|
@@ -5,7 +5,3 @@ export declare const Wrapper: import("../../styled").StyledComponent<{
|
|
|
5
5
|
} & {
|
|
6
6
|
$gridColumns: string;
|
|
7
7
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, {}>;
|
|
8
|
-
export declare const CheckboxCell: import("../../styled").StyledComponent<{
|
|
9
|
-
theme?: import("@emotion/react").Theme | undefined;
|
|
10
|
-
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
11
|
-
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { SCROLLBAR_SIZE } from '../../constants/scrollbar';
|
|
1
2
|
import { styled } from '../../styled';
|
|
2
|
-
import { ROOT_ACTION_CELL_WIDTH } from '../constants';
|
|
3
3
|
export const Wrapper = styled('header', {
|
|
4
4
|
shouldForwardProp: (prop) => !['$gridColumns'].includes(prop),
|
|
5
5
|
}) `
|
|
@@ -8,6 +8,7 @@ export const Wrapper = styled('header', {
|
|
|
8
8
|
|
|
9
9
|
width: fit-content;
|
|
10
10
|
min-width: 100%;
|
|
11
|
+
padding-right: ${SCROLLBAR_SIZE};
|
|
11
12
|
|
|
12
13
|
border-bottom: 1px solid ${({ theme }) => theme.palette.components.border.default};
|
|
13
14
|
|
|
@@ -15,10 +16,3 @@ export const Wrapper = styled('header', {
|
|
|
15
16
|
display: none;
|
|
16
17
|
}
|
|
17
18
|
`;
|
|
18
|
-
export const CheckboxCell = styled.div `
|
|
19
|
-
display: flex;
|
|
20
|
-
align-items: center;
|
|
21
|
-
justify-content: center;
|
|
22
|
-
|
|
23
|
-
width: ${ROOT_ACTION_CELL_WIDTH}px;
|
|
24
|
-
`;
|
|
@@ -14,5 +14,16 @@ export type HeadCellProps<TData = DataGridRow, TSortField extends keyof TData =
|
|
|
14
14
|
* Дополнительное содержимое ячейки, которое будет распложено справа
|
|
15
15
|
*/
|
|
16
16
|
startAdornment?: ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Класс применяемый к корневому элементу
|
|
19
|
+
*/
|
|
20
|
+
className?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Позиция ячейки в сетке CSS Grid
|
|
23
|
+
*/
|
|
24
|
+
gridPosition?: {
|
|
25
|
+
start: number;
|
|
26
|
+
end: number;
|
|
27
|
+
};
|
|
17
28
|
};
|
|
18
29
|
export declare const HeadCell: <TData, TSortField extends keyof TData>(props: HeadCellProps<TData, TSortField>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,11 +4,29 @@ import { SortDownFillSm } from '../../../icons/SortDownFillSm';
|
|
|
4
4
|
import { SortFillSm } from '../../../icons/SortFillSm';
|
|
5
5
|
import { SortUpFillSm } from '../../../icons/SortUpFillSm';
|
|
6
6
|
import { OverflowTypography } from '../../OverflowTypography';
|
|
7
|
+
import { classNames } from '../../utils/classNames';
|
|
8
|
+
import { cva } from '../../utils/cva';
|
|
9
|
+
import { headCellClassnames } from './constants';
|
|
7
10
|
import { Wrapper } from './styles';
|
|
8
11
|
import { useLogic } from './useLogic';
|
|
12
|
+
const headCellCva = cva(headCellClassnames.root, {
|
|
13
|
+
variants: {
|
|
14
|
+
isSortable: {
|
|
15
|
+
true: headCellClassnames.sortable,
|
|
16
|
+
},
|
|
17
|
+
align: {
|
|
18
|
+
left: headCellClassnames.alignLeft,
|
|
19
|
+
center: headCellClassnames.alignCenter,
|
|
20
|
+
right: headCellClassnames.alignRight,
|
|
21
|
+
},
|
|
22
|
+
hasStartAdornment: {
|
|
23
|
+
true: headCellClassnames.hasStartAdornment,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
});
|
|
9
27
|
export const HeadCell = (props) => {
|
|
10
|
-
const {
|
|
11
|
-
const { startAdornment, field, isSortable, align, label, sorting } = props;
|
|
28
|
+
const { hasStartAdornment, handleSortClick, headCellCssVars } = useLogic(props);
|
|
29
|
+
const { startAdornment, field, isSortable, align, label, sorting, className, } = props;
|
|
12
30
|
const sortIcon = useMemo(() => {
|
|
13
31
|
if (!isSortable) {
|
|
14
32
|
return null;
|
|
@@ -25,5 +43,5 @@ export const HeadCell = (props) => {
|
|
|
25
43
|
return _jsx(SortFillSm, {});
|
|
26
44
|
}
|
|
27
45
|
}, [sorting, isSortable, field]);
|
|
28
|
-
return (_jsxs(Wrapper, {
|
|
46
|
+
return (_jsxs(Wrapper, { onClick: handleSortClick, className: classNames(className, headCellCva({ isSortable, align, hasStartAdornment })), style: headCellCssVars, children: [startAdornment && startAdornment, _jsx(OverflowTypography, { rowsCount: 2, variant: "pointer", component: "p", children: label }), sortIcon] }));
|
|
29
47
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createUIKitClassname } from '../../utils/createUIKitClassname';
|
|
2
|
+
export const headCellClassnames = {
|
|
3
|
+
root: createUIKitClassname('data-grid__head-cell'),
|
|
4
|
+
groupParent: createUIKitClassname('data-grid__head-cell_group-parent'),
|
|
5
|
+
groupChild: createUIKitClassname('data-grid__head-cell_group-child'),
|
|
6
|
+
singleColumn: createUIKitClassname('data-grid__head-cell_single-column'),
|
|
7
|
+
alignLeft: createUIKitClassname('data-grid__head-cell_align-left'),
|
|
8
|
+
alignCenter: createUIKitClassname('data-grid__head-cell_align-center'),
|
|
9
|
+
alignRight: createUIKitClassname('data-grid__head-cell_align-right'),
|
|
10
|
+
hasStartAdornment: createUIKitClassname('data-grid__head-cell_has-start-adornment'),
|
|
11
|
+
sortable: createUIKitClassname('data-grid__head-cell_sortable'),
|
|
12
|
+
};
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { AlignVariant } from '../types';
|
|
3
|
-
type HeadCellProps = {
|
|
4
|
-
$align?: AlignVariant;
|
|
5
|
-
$isSortable?: boolean;
|
|
6
|
-
$hasStartAdornment?: boolean;
|
|
7
|
-
};
|
|
8
2
|
export declare const Wrapper: import("../../styled").StyledComponent<{
|
|
9
3
|
theme?: import("@emotion/react").Theme | undefined;
|
|
10
4
|
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
11
|
-
}
|
|
12
|
-
export {};
|
|
5
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { hintIconClassnames } from '../../HintIcon';
|
|
2
2
|
import { styled } from '../../styled';
|
|
3
|
-
import {
|
|
4
|
-
export const Wrapper = styled
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import { headCellClassnames } from './constants';
|
|
4
|
+
export const Wrapper = styled.div `
|
|
5
|
+
--grid-column-start: 0;
|
|
6
|
+
--grid-column-end: 0;
|
|
7
|
+
|
|
8
|
+
cursor: initial;
|
|
8
9
|
user-select: none;
|
|
9
10
|
|
|
10
11
|
overflow: hidden;
|
|
11
12
|
display: flex;
|
|
12
13
|
align-items: center;
|
|
13
|
-
justify-content:
|
|
14
|
+
justify-content: flex-start;
|
|
14
15
|
|
|
15
16
|
height: 40px;
|
|
16
|
-
padding: ${({ theme
|
|
17
|
+
padding: ${({ theme }) => theme.spacing(1, 2)};
|
|
17
18
|
|
|
18
19
|
color: ${({ theme }) => theme.palette.grey[700]};
|
|
19
20
|
|
|
@@ -22,6 +23,22 @@ export const Wrapper = styled('div', {
|
|
|
22
23
|
height: 16px;
|
|
23
24
|
}
|
|
24
25
|
|
|
26
|
+
&.${headCellClassnames.sortable} {
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&.${headCellClassnames.hasStartAdornment} {
|
|
31
|
+
padding: ${({ theme }) => theme.spacing(1, 2, 1, 0)};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&.${headCellClassnames.alignCenter} {
|
|
35
|
+
justify-content: center;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&.${headCellClassnames.alignRight} {
|
|
39
|
+
justify-content: flex-end;
|
|
40
|
+
}
|
|
41
|
+
|
|
25
42
|
.${hintIconClassnames.iconWrapper} {
|
|
26
43
|
margin-right: ${({ theme }) => theme.spacing(1)};
|
|
27
44
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { type CSSProperties } from 'react';
|
|
1
2
|
import type { DataGridRow } from '../../types';
|
|
2
3
|
import { type HeadCellProps } from '../HeadCell';
|
|
3
4
|
type UseLogicParams<TData = DataGridRow, TSortField extends keyof TData = keyof TData> = HeadCellProps<TData, TSortField>;
|
|
4
|
-
export declare const useLogic: <TData, TSortField extends keyof TData>({ field, isSortable, startAdornment, onSort, }: UseLogicParams<TData, TSortField>) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
5
|
+
export declare const useLogic: <TData, TSortField extends keyof TData>({ gridPosition, field, isSortable, startAdornment, onSort, }: UseLogicParams<TData, TSortField>) => {
|
|
6
|
+
hasStartAdornment: boolean;
|
|
7
|
+
handleSortClick: () => void;
|
|
8
|
+
headCellCssVars: CSSProperties;
|
|
9
9
|
};
|
|
10
10
|
export {};
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
export const useLogic = ({ field, isSortable, startAdornment, onSort, }) => {
|
|
1
|
+
export const useLogic = ({ gridPosition, field, isSortable, startAdornment, onSort, }) => {
|
|
2
2
|
const hasStartAdornment = Boolean(startAdornment);
|
|
3
3
|
const handleSortClick = () => {
|
|
4
4
|
if (field && isSortable) {
|
|
5
5
|
onSort(field);
|
|
6
6
|
}
|
|
7
7
|
};
|
|
8
|
+
const headCellCssVars = {
|
|
9
|
+
'--grid-column-start': gridPosition?.start,
|
|
10
|
+
'--grid-column-end': gridPosition?.end,
|
|
11
|
+
};
|
|
8
12
|
return {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
+
hasStartAdornment,
|
|
14
|
+
handleSortClick,
|
|
15
|
+
headCellCssVars,
|
|
13
16
|
};
|
|
14
17
|
};
|
|
@@ -17,6 +17,10 @@ export const DataGridSection = styled.div `
|
|
|
17
17
|
background-color: ${({ theme }) => theme.palette.background.default};
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
& .${dataGridClassnames.body} {
|
|
21
|
+
scrollbar-gutter: unset;
|
|
22
|
+
}
|
|
23
|
+
|
|
20
24
|
&.${dataGridClassnames.pinnedSectionNoData} {
|
|
21
25
|
grid-column: 1 / -1;
|
|
22
26
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { classNames } from '../../../../utils/classNames';
|
|
3
3
|
import { dataGridClassnames } from '../../../constants';
|
|
4
|
-
import { getGridTemplateColumns } from '../../../utils';
|
|
4
|
+
import { getFlattenColumns, getGridTemplateColumns } from '../../../utils';
|
|
5
5
|
export const useLogic = ({ position, isNoData, columns, }) => {
|
|
6
6
|
const classnames = useMemo(() => classNames({
|
|
7
7
|
[dataGridClassnames.leftPinnedSection]: position === 'left',
|
|
@@ -11,6 +11,6 @@ export const useLogic = ({ position, isNoData, columns, }) => {
|
|
|
11
11
|
const shouldNotRenderSection = (isNoData && position !== 'center') || !columns || columns.length === 0;
|
|
12
12
|
const gridColumns = shouldNotRenderSection
|
|
13
13
|
? ''
|
|
14
|
-
: getGridTemplateColumns(columns);
|
|
14
|
+
: getGridTemplateColumns(getFlattenColumns(columns));
|
|
15
15
|
return { classnames, gridColumns, shouldNotRenderSection };
|
|
16
16
|
};
|
|
@@ -8,11 +8,15 @@ export const PinnedColumnsContainer = styled.div `
|
|
|
8
8
|
width: 100%;
|
|
9
9
|
height: 100%;
|
|
10
10
|
|
|
11
|
+
& .${dataGridClassnames.header} {
|
|
12
|
+
padding-right: unset;
|
|
13
|
+
}
|
|
14
|
+
|
|
11
15
|
&.${dataGridClassnames.disabled} {
|
|
12
|
-
|
|
16
|
+
pointer-events: none;
|
|
13
17
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
background: ${({ theme }) => theme.palette.background.element};
|
|
19
|
+
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
20
|
+
mix-blend-mode: luminosity;
|
|
17
21
|
}
|
|
18
22
|
`;
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
+
import { getFlattenColumns } from '../../utils';
|
|
2
3
|
export const useLogic = ({ sections, }) => {
|
|
4
|
+
const leftColumns = sections.find((section) => section.position === 'left')?.columns;
|
|
5
|
+
const rightColumns = sections.find((section) => section.position === 'right')?.columns;
|
|
3
6
|
const pinnedContainerStyles = {
|
|
4
|
-
'--left-columns-count':
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
'--left-columns-count': leftColumns
|
|
8
|
+
? getFlattenColumns(leftColumns).length
|
|
9
|
+
: 0,
|
|
10
|
+
'--right-columns-count': rightColumns
|
|
11
|
+
? getFlattenColumns(rightColumns).length
|
|
12
|
+
: 0,
|
|
8
13
|
};
|
|
9
14
|
const sectionOffsets = useMemo(() => {
|
|
10
15
|
const offsets = {};
|
|
11
16
|
let currentOffset = 0;
|
|
12
17
|
sections.forEach((section) => {
|
|
13
18
|
offsets[section.position] = currentOffset;
|
|
14
|
-
currentOffset += section.columns
|
|
19
|
+
currentOffset += getFlattenColumns(section.columns).length;
|
|
15
20
|
});
|
|
16
21
|
return offsets;
|
|
17
22
|
}, [sections]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { memo, useCallback } from 'react';
|
|
2
|
+
import { Fragment, memo, useCallback } from 'react';
|
|
3
3
|
import { BottomDrawer } from '../../BottomDrawer';
|
|
4
4
|
import { Checkbox } from '../../Checkbox';
|
|
5
5
|
import { Tooltip } from '../../Tooltip';
|
|
@@ -7,9 +7,11 @@ import { checkIsDeepEqual } from '../../utils/checkIsDeepEqual';
|
|
|
7
7
|
import { classNames } from '../../utils/classNames';
|
|
8
8
|
import { cva } from '../../utils/cva';
|
|
9
9
|
import { getInertProps } from '../../utils/getInertProps';
|
|
10
|
-
import {
|
|
10
|
+
import { dataGridCellClassnames } from '../Cell';
|
|
11
|
+
import { isGroupColumns } from '../utils';
|
|
12
|
+
import { DISABLE_ROW_ATTR, dataGridGroupedColumnLabelClassnames, dataGridRowClassnames, dataGridRowContentClassnames, } from './constants';
|
|
11
13
|
import { NestedChildren } from './NestedChildren';
|
|
12
|
-
import { BottomDrawerContent, CellStyled, CheckboxCell, ChevronIcon, CollapseButton, CollapseCell, ContentWrapper, Wrapper, } from './styles';
|
|
14
|
+
import { BottomDrawerContent, CellStyled, CheckboxCell, ChevronIcon, CollapseButton, CollapseCell, ContentWrapper, GroupedColumnLabel, Wrapper, } from './styles';
|
|
13
15
|
import { useLogic } from './useLogic';
|
|
14
16
|
import { checkIsDisabled } from './utils';
|
|
15
17
|
const rootCva = cva(dataGridRowClassnames.root, {
|
|
@@ -26,6 +28,13 @@ const rowContentCva = cva(dataGridRowContentClassnames.root, {
|
|
|
26
28
|
},
|
|
27
29
|
},
|
|
28
30
|
});
|
|
31
|
+
const groupedColumnLabelCva = cva(dataGridGroupedColumnLabelClassnames.root, {
|
|
32
|
+
variants: {
|
|
33
|
+
hidden: {
|
|
34
|
+
true: dataGridGroupedColumnLabelClassnames.hidden,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
});
|
|
29
38
|
const RowComponent = (props) => {
|
|
30
39
|
const { isOpen, isShowConnector, childrenColumns, rowId, handleToggle, checkboxProps, rowProps, isHovered, tooltipProps, nestedChildrenProps, disabled, isRenderCollapseButton, rowRef, rowStyles, drawerProps, disabledReasonText, } = useLogic(props);
|
|
31
40
|
const { className, row, options, variant, isSelectable, gridColumns, isInitialExpanded, expandedLevel, level, nestedChildren, initialVisibleChildrenCount, moreButtonColumnPosition, isVisibleCollapseButton, columns, emptyCellValue, selectedRows, activeRowId, keyId, onSelectRow, onRowClick, sectionOffset, totalColumnsCount, registerRowElement, unregisterRowElement, onRowEnter, onRowLeave, style,
|
|
@@ -49,6 +58,16 @@ const RowComponent = (props) => {
|
|
|
49
58
|
const globalIndex = (sectionOffset ?? 0) + index;
|
|
50
59
|
const isDisabledCell = checkIsDisabled(disabled, availableCellsByIndex, globalIndex);
|
|
51
60
|
const isFirstCell = globalIndex === 0;
|
|
61
|
+
if (isGroupColumns(cell)) {
|
|
62
|
+
const { label, children, hideTitleOnMobile, isHideOnMobile } = cell;
|
|
63
|
+
return (_jsxs(Fragment, { children: [_jsx(GroupedColumnLabel, { variant: "caption", color: "grey", colorIntensity: "700", className: groupedColumnLabelCva({
|
|
64
|
+
hidden: hideTitleOnMobile || isHideOnMobile,
|
|
65
|
+
}), children: label }), children.map((child, childIndex) => {
|
|
66
|
+
const childCellId = `${cellId}-${childIndex}`;
|
|
67
|
+
const shouldRenderStartAdornment = isFirstCell && childIndex === 0;
|
|
68
|
+
return (_jsx(CellStyled, { row: row, cell: child, isHideOnMobile: isHideOnMobile, emptyCellValue: emptyCellValue, isDisabled: isDisabledCell, startAdornment: shouldRenderStartAdornment && renderStartAdornment(), isHidePersonalData: child.isHidePersonalData, className: dataGridCellClassnames.grouped }, childCellId));
|
|
69
|
+
})] }, cellId));
|
|
70
|
+
}
|
|
52
71
|
return (_jsx(CellStyled, { row: row, cell: cell, emptyCellValue: emptyCellValue, startAdornment: isFirstCell && renderStartAdornment(), isDisabled: isDisabledCell, isHidePersonalData: cell.isHidePersonalData }, cellId));
|
|
53
72
|
});
|
|
54
73
|
}, [
|
|
@@ -12,3 +12,11 @@ export declare const dataGridRowContentClassnames: {
|
|
|
12
12
|
root: string;
|
|
13
13
|
hovered: string;
|
|
14
14
|
};
|
|
15
|
+
export declare const dataGridRowCellClassnames: {
|
|
16
|
+
single: string;
|
|
17
|
+
grouped: string;
|
|
18
|
+
};
|
|
19
|
+
export declare const dataGridGroupedColumnLabelClassnames: {
|
|
20
|
+
root: string;
|
|
21
|
+
hidden: string;
|
|
22
|
+
};
|
|
@@ -13,3 +13,11 @@ export const dataGridRowContentClassnames = {
|
|
|
13
13
|
root: createUIKitClassname('data-grid__row-content'),
|
|
14
14
|
hovered: createUIKitClassname('data-grid__row-content_hovered'),
|
|
15
15
|
};
|
|
16
|
+
export const dataGridRowCellClassnames = {
|
|
17
|
+
single: createUIKitClassname('data-grid__row-cell_single'),
|
|
18
|
+
grouped: createUIKitClassname('data-grid__row-cell_grouped'),
|
|
19
|
+
};
|
|
20
|
+
export const dataGridGroupedColumnLabelClassnames = {
|
|
21
|
+
root: createUIKitClassname('data-grid-grouped-column-label'),
|
|
22
|
+
hidden: createUIKitClassname('data-grid-grouped-column-label_hidden'),
|
|
23
|
+
};
|
|
@@ -43,3 +43,13 @@ export declare const BottomDrawerContent: import("../../styled").StyledComponent
|
|
|
43
43
|
theme?: import("@emotion/react").Theme | undefined;
|
|
44
44
|
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
45
45
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
46
|
+
export declare const GroupedColumnLabel: import("../../styled").StyledComponent<import("../../Typography/types").TypographyPropsBase & {
|
|
47
|
+
color?: import("../../Typography").TypographyColor | undefined;
|
|
48
|
+
variant?: import("../../Typography").TypographyVariant | undefined;
|
|
49
|
+
colorIntensity?: import("../../Typography").Intensity | undefined;
|
|
50
|
+
component?: import("../../Typography/types").ComponentProp | undefined;
|
|
51
|
+
isUpperCase?: boolean | undefined;
|
|
52
|
+
withoutCalt?: boolean | undefined;
|
|
53
|
+
} & import("react").HTMLAttributes<HTMLParagraphElement> & import("react").RefAttributes<HTMLSpanElement> & {
|
|
54
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
55
|
+
}, {}, {}>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ChevronROutlineMd } from '../../../icons/ChevronROutlineMd';
|
|
2
2
|
import { IconButton } from '../../IconButton';
|
|
3
3
|
import { styled } from '../../styled';
|
|
4
|
+
import { Typography } from '../../Typography';
|
|
4
5
|
import { Cell } from '../Cell';
|
|
5
6
|
import { ROOT_ACTION_CELL_WIDTH, TREE_LINE_WIDTH } from '../constants';
|
|
6
|
-
import { dataGridRowClassnames, dataGridRowContentClassnames, } from './constants';
|
|
7
|
+
import { dataGridGroupedColumnLabelClassnames, dataGridRowClassnames, dataGridRowContentClassnames, } from './constants';
|
|
7
8
|
export const Wrapper = styled.li `
|
|
8
9
|
--level: 0;
|
|
9
10
|
position: relative;
|
|
@@ -102,7 +103,6 @@ export const ContentWrapper = styled.div `
|
|
|
102
103
|
|
|
103
104
|
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
104
105
|
grid-template-columns: 1fr;
|
|
105
|
-
gap: ${({ theme }) => theme.spacing(3)};
|
|
106
106
|
}
|
|
107
107
|
`;
|
|
108
108
|
export const CellStyled = styled(Cell) `
|
|
@@ -154,3 +154,16 @@ export const BottomDrawerContent = styled.div `
|
|
|
154
154
|
padding: ${({ theme }) => theme.spacing(5, 4)};
|
|
155
155
|
}
|
|
156
156
|
`;
|
|
157
|
+
export const GroupedColumnLabel = styled(Typography) `
|
|
158
|
+
display: none;
|
|
159
|
+
|
|
160
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
161
|
+
display: block;
|
|
162
|
+
|
|
163
|
+
margin-top: ${({ theme }) => theme.spacing(3)};
|
|
164
|
+
|
|
165
|
+
&.${dataGridGroupedColumnLabelClassnames.hidden} {
|
|
166
|
+
display: none;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
`;
|
|
@@ -13,11 +13,14 @@ export declare const dataGridClassnames: {
|
|
|
13
13
|
bodyEmpty: string;
|
|
14
14
|
disabled: string;
|
|
15
15
|
pinnedSectionNoData: string;
|
|
16
|
-
|
|
16
|
+
hasPinnedSections: string;
|
|
17
17
|
pinnedSections: string;
|
|
18
18
|
leftPinnedSection: string;
|
|
19
19
|
rightPinnedSection: string;
|
|
20
20
|
overflowed: string;
|
|
21
21
|
wrapper: string;
|
|
22
22
|
isAllowHorizontalScroll: string;
|
|
23
|
+
hasGroupedColumns: string;
|
|
24
|
+
gridViewFull: string;
|
|
25
|
+
gridViewStandard: string;
|
|
23
26
|
};
|
|
@@ -14,11 +14,14 @@ export const dataGridClassnames = {
|
|
|
14
14
|
bodyEmpty: createUIKitClassname('data-grid__body_empty'),
|
|
15
15
|
disabled: createUIKitClassname('data-grid_disabled'),
|
|
16
16
|
pinnedSectionNoData: createUIKitClassname('data-grid__pinned-section_no-data'),
|
|
17
|
-
|
|
17
|
+
hasPinnedSections: createUIKitClassname('data-grid_has-pinned-sections'),
|
|
18
18
|
pinnedSections: createUIKitClassname('data-grid__pinned-sections'),
|
|
19
19
|
leftPinnedSection: createUIKitClassname('data-grid__left-pinned-section'),
|
|
20
20
|
rightPinnedSection: createUIKitClassname('data-grid__right-pinned-section'),
|
|
21
21
|
overflowed: createUIKitClassname('data-grid_overflowed'),
|
|
22
22
|
wrapper: createUIKitClassname('data-grid__wrapper'),
|
|
23
23
|
isAllowHorizontalScroll: createUIKitClassname('data-grid_is-allow-horizontal-scroll'),
|
|
24
|
+
hasGroupedColumns: createUIKitClassname('data-grid_has-grouped-columns'),
|
|
25
|
+
gridViewFull: createUIKitClassname('data-grid_grid-view-full'),
|
|
26
|
+
gridViewStandard: createUIKitClassname('data-grid_grid-view-standard'),
|
|
24
27
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { faker } from '@ui/dev/faker';
|
|
2
|
+
import { isGroupColumns } from './utils';
|
|
2
3
|
const RECIPIENTS = [
|
|
3
4
|
'ИП Иванов О.В.',
|
|
4
5
|
'ООО "Новая организация"',
|
|
@@ -12,22 +13,25 @@ export const makeRandomDate = () => {
|
|
|
12
13
|
return randomDate.toISOString();
|
|
13
14
|
};
|
|
14
15
|
export const makeColumns = (columnsTemplate, mergedColumns = []) => {
|
|
15
|
-
const mergedColumnsMap = mergedColumns.reduce((acc,
|
|
16
|
-
if (field) {
|
|
16
|
+
const mergedColumnsMap = mergedColumns.reduce((acc, column) => {
|
|
17
|
+
if (!isGroupColumns(column) && column.field) {
|
|
18
|
+
const { field, ...columnsOptions } = column;
|
|
17
19
|
return {
|
|
18
|
-
// biome-ignore lint/performance/noAccumulatingSpread: <>
|
|
19
20
|
...acc,
|
|
20
21
|
[field]: columnsOptions,
|
|
21
22
|
};
|
|
22
23
|
}
|
|
23
24
|
return acc;
|
|
24
25
|
}, {});
|
|
25
|
-
return columnsTemplate.map((column) =>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
return columnsTemplate.map((column) => {
|
|
27
|
+
if (isGroupColumns(column) || !column.field) {
|
|
28
|
+
return column;
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
...column,
|
|
32
|
+
...(mergedColumnsMap[column.field] || {}),
|
|
33
|
+
};
|
|
34
|
+
});
|
|
31
35
|
};
|
|
32
36
|
export const makeDataList = (dataObjTemplate, options) => {
|
|
33
37
|
const DATA_ARRAY_LENGTH = 50;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { DataGrid } from './DataGrid';
|
|
2
|
-
export type { DataGridProps, DataGridColumns, DataGridRow, DataGridRowOptions, DataGridSort, DataGridRowWithOptions, DataGridRowOptionColumns, } from './types';
|
|
2
|
+
export type { DataGridProps, DataGridColumns, DataGridSingleColumn, DataGridRow, DataGridRowOptions, DataGridSort, DataGridRowWithOptions, DataGridRowOptionColumns, } from './types';
|
|
3
3
|
export { dataGridClassnames } from './constants';
|
|
4
4
|
export { MobileSkeleton } from './MobileSkeleton';
|