@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
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { styled } from '../styled';
|
|
2
|
+
import { dataGridCellClassnames } from './Cell/constants';
|
|
2
3
|
import { dataGridClassnames } from './constants';
|
|
4
|
+
import { headCellClassnames } from './HeadCell';
|
|
5
|
+
import { dataGridRowClassnames } from './Row/constants';
|
|
3
6
|
export const Container = styled.div `
|
|
4
7
|
--max-height: initial;
|
|
5
8
|
|
|
@@ -21,10 +24,33 @@ export const Container = styled.div `
|
|
|
21
24
|
}
|
|
22
25
|
}
|
|
23
26
|
|
|
24
|
-
&.${dataGridClassnames.
|
|
27
|
+
&.${dataGridClassnames.hasPinnedSections} {
|
|
25
28
|
overflow: hidden;
|
|
26
29
|
}
|
|
27
30
|
|
|
31
|
+
&.${dataGridClassnames.hasGroupedColumns} {
|
|
32
|
+
& .${dataGridClassnames.header} {
|
|
33
|
+
grid-template-rows: repeat(2, auto);
|
|
34
|
+
|
|
35
|
+
& .${headCellClassnames.groupParent} {
|
|
36
|
+
grid-column: var(--grid-column-start) / var(--grid-column-end);
|
|
37
|
+
grid-row: 1;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
& .${headCellClassnames.groupChild} {
|
|
42
|
+
grid-row: 2;
|
|
43
|
+
justify-content: center;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
& .${headCellClassnames.singleColumn} {
|
|
47
|
+
grid-row: 1 / -1;
|
|
48
|
+
|
|
49
|
+
height: 80px;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
28
54
|
@supports not (container-type: scroll-state) {
|
|
29
55
|
&.${dataGridClassnames.overflowed} {
|
|
30
56
|
& .${dataGridClassnames.rightPinnedSection} {
|
|
@@ -37,6 +63,52 @@ export const Container = styled.div `
|
|
|
37
63
|
}
|
|
38
64
|
}
|
|
39
65
|
|
|
66
|
+
&.${dataGridClassnames.gridViewFull} {
|
|
67
|
+
& .${dataGridClassnames.header} {
|
|
68
|
+
background-color: ${({ theme }) => theme.palette.grey[100]};
|
|
69
|
+
border-top-left-radius: ${({ theme }) => theme.shape.medium};
|
|
70
|
+
border-top-right-radius: ${({ theme }) => theme.shape.medium};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
& .${dataGridCellClassnames.root},
|
|
74
|
+
& .${headCellClassnames.root} {
|
|
75
|
+
border-top: 1px solid ${({ theme }) => theme.palette.components.border.default};
|
|
76
|
+
border-left: 1px solid ${({ theme }) => theme.palette.components.border.default};
|
|
77
|
+
|
|
78
|
+
&:first-of-type,
|
|
79
|
+
&:first-of-type + .${headCellClassnames.groupChild} {
|
|
80
|
+
border-left: none;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
& .${headCellClassnames.singleColumn},
|
|
85
|
+
& .${headCellClassnames.groupParent} {
|
|
86
|
+
border-top: none;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
& .${dataGridRowClassnames.root}:last-of-type .${dataGridCellClassnames.root} {
|
|
90
|
+
border-bottom: 1px solid ${({ theme }) => theme.palette.components.border.default};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
&:not(.${dataGridClassnames.hasPinnedSections}) .${dataGridClassnames.body},
|
|
94
|
+
& .${dataGridClassnames.pinnedSections} {
|
|
95
|
+
container-name: data-grid-scroll-container;
|
|
96
|
+
container-type: scroll-state;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* Прогрессивное улучшение. Убираем нижнюю границу последней строки когда scrollbar находится в нижней точке. Для того что бы избежать двойного разделителя снизу */
|
|
100
|
+
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
101
|
+
@container data-grid-scroll-container scroll-state((scrollable: y) and (not (scrollable: bottom))) {
|
|
102
|
+
& .${dataGridRowClassnames.root}:last-of-type .${dataGridCellClassnames.root} {
|
|
103
|
+
border-bottom: none;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
& .${dataGridRowClassnames.root}:first-of-type .${dataGridCellClassnames.root} {
|
|
108
|
+
border-top: none;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
40
112
|
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
41
113
|
overflow: initial;
|
|
42
114
|
|
|
@@ -44,7 +116,7 @@ export const Container = styled.div `
|
|
|
44
116
|
justify-content: flex-start;
|
|
45
117
|
}
|
|
46
118
|
|
|
47
|
-
&.${dataGridClassnames.
|
|
119
|
+
&.${dataGridClassnames.hasPinnedSections} {
|
|
48
120
|
overflow: initial;
|
|
49
121
|
}
|
|
50
122
|
|
|
@@ -55,6 +127,16 @@ export const Container = styled.div `
|
|
|
55
127
|
overflow: initial;
|
|
56
128
|
}
|
|
57
129
|
}
|
|
130
|
+
|
|
131
|
+
&.${dataGridClassnames.gridViewFull} {
|
|
132
|
+
& .${dataGridCellClassnames.root}, & .${headCellClassnames.root} {
|
|
133
|
+
border: none;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
& .${dataGridRowClassnames.root}:last-of-type .${dataGridCellClassnames.root} {
|
|
137
|
+
border-bottom: none;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
58
140
|
}
|
|
59
141
|
`;
|
|
60
142
|
export const DataGridWrapper = styled.div `
|
|
@@ -175,6 +175,11 @@ export type DataGridProps<TData extends Record<string, CellValue> = DataGridRow,
|
|
|
175
175
|
* Убирает шапку таблицы, когда нет данных
|
|
176
176
|
*/
|
|
177
177
|
isHideHeaderIfNoData?: boolean;
|
|
178
|
+
/**
|
|
179
|
+
* Режим отображения разделителей в таблице
|
|
180
|
+
* @default standard
|
|
181
|
+
*/
|
|
182
|
+
gridViewMode?: 'full' | 'standard';
|
|
178
183
|
};
|
|
179
184
|
export type DataGridSort<TSortField> = {
|
|
180
185
|
/**
|
|
@@ -188,7 +193,37 @@ export type DataGridSort<TSortField> = {
|
|
|
188
193
|
*/
|
|
189
194
|
sort: SortState;
|
|
190
195
|
};
|
|
191
|
-
export type
|
|
196
|
+
export type DataGridGroupColumn<TData extends Record<string, CellValue>> = {
|
|
197
|
+
/**
|
|
198
|
+
* Группа дочерних колонок
|
|
199
|
+
*/
|
|
200
|
+
children: DataGridSingleColumn<TData>[];
|
|
201
|
+
/**
|
|
202
|
+
* Принимает компонент DataGridColumnHintIcon - подсказка в шапке колонки
|
|
203
|
+
*/
|
|
204
|
+
columnHint?: ReactNode;
|
|
205
|
+
/**
|
|
206
|
+
* Название колонки таблицы
|
|
207
|
+
*/
|
|
208
|
+
label: string;
|
|
209
|
+
/**
|
|
210
|
+
* Закрепление группы дочерних колонок в таблице
|
|
211
|
+
*/
|
|
212
|
+
pinned?: 'left' | 'right';
|
|
213
|
+
/**
|
|
214
|
+
* Скрывает группу колонок на мобильных устройствах
|
|
215
|
+
*/
|
|
216
|
+
isHideOnMobile?: boolean;
|
|
217
|
+
/**
|
|
218
|
+
* Скрывает название группы колонок на мобильных устройствах
|
|
219
|
+
*/
|
|
220
|
+
hideTitleOnMobile?: boolean;
|
|
221
|
+
/**
|
|
222
|
+
* Скрывает персональные данные в группе колонок
|
|
223
|
+
*/
|
|
224
|
+
isHidePersonalData?: boolean;
|
|
225
|
+
};
|
|
226
|
+
export type DataGridSingleColumn<TData extends Record<string, CellValue>> = {
|
|
192
227
|
/**
|
|
193
228
|
* @example {field: 'test'}
|
|
194
229
|
* Значение ключа поля данных для колонки
|
|
@@ -247,7 +282,9 @@ export type DataGridColumns<TData extends Record<string, CellValue>> = {
|
|
|
247
282
|
* Скрывает заголовок колонки на мобильных устройствах
|
|
248
283
|
*/
|
|
249
284
|
hideTitleOnMobile?: boolean;
|
|
285
|
+
children?: never;
|
|
250
286
|
};
|
|
287
|
+
export type DataGridColumns<TData extends Record<string, CellValue>> = DataGridSingleColumn<TData> | DataGridGroupColumn<TData>;
|
|
251
288
|
export type DataGridRowOptionColumns<TData extends Record<string, CellValue>> = {
|
|
252
289
|
/**
|
|
253
290
|
* Значение ключа поля данных для колонки
|
package/components/DataGrid/useLogic/hooks/useDataGridMobileLogic/useDataGridMobileLogic.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type RefObject } from 'react';
|
|
2
|
-
import { type CellValue, type
|
|
2
|
+
import { type CellValue, type DataGridRow, type DataGridSingleColumn } from '../../../types';
|
|
3
3
|
type UseDataGridMobileLogicParams<TData extends Record<string, CellValue> = DataGridRow> = {
|
|
4
4
|
containerRef?: RefObject<HTMLDivElement | null>;
|
|
5
5
|
isLoading?: boolean;
|
|
6
|
-
columns?:
|
|
6
|
+
columns?: DataGridSingleColumn<TData>[];
|
|
7
7
|
rows?: TData[];
|
|
8
8
|
isNoScrollToTop?: boolean;
|
|
9
9
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ChangeEvent } from 'react';
|
|
2
2
|
import type { CellValue, DataGridProps, DataGridRow } from '../types';
|
|
3
3
|
type UseLogicParams<TData extends Record<string, CellValue> = DataGridRow, TSortField extends keyof TData = keyof TData> = DataGridProps<TData, TSortField>;
|
|
4
|
-
export declare const useLogic: <TData extends Record<string, unknown> = DataGridRow, TSortField extends keyof TData = keyof TData>({ keyId, columns, rows, variant, tree, subrows, selectedRows, isLoading, isDisabled, onSelectRow, isError, onRetry, errorMsg, isHideSelectAll, isHideHeaderIfNoData, sorting, className, onSort, maxHeight, }: UseLogicParams<TData, TSortField>) => {
|
|
4
|
+
export declare const useLogic: <TData extends Record<string, unknown> = DataGridRow, TSortField extends keyof TData = keyof TData>({ keyId, columns, rows, variant, tree, subrows, selectedRows, isLoading, isDisabled, onSelectRow, isError, onRetry, errorMsg, isHideSelectAll, isHideHeaderIfNoData, sorting, className, onSort, maxHeight, gridViewMode: gridViewModeProp, }: UseLogicParams<TData, TSortField>) => {
|
|
5
5
|
dataGridClassName: string | undefined;
|
|
6
6
|
containerCssVars: import("react").CSSProperties;
|
|
7
7
|
isDataGridDisabled: boolean | undefined;
|
|
@@ -37,12 +37,14 @@ export declare const useLogic: <TData extends Record<string, unknown> = DataGrid
|
|
|
37
37
|
containerRef: import("react").RefObject<HTMLDivElement | null>;
|
|
38
38
|
gridColumns: string;
|
|
39
39
|
isNoData: boolean;
|
|
40
|
+
gridViewMode: "standard" | "full";
|
|
40
41
|
headColumns: import("../types").DataGridColumns<TData>[];
|
|
41
42
|
isLoading: boolean | undefined;
|
|
42
43
|
mobileSkeletonProps: {
|
|
43
44
|
cellsCount: number;
|
|
44
45
|
rowsCount: number;
|
|
45
46
|
};
|
|
47
|
+
hasGroupedColumns: boolean;
|
|
46
48
|
headProps: {
|
|
47
49
|
rowsCount: number;
|
|
48
50
|
uncheckedRowsCount: number;
|
|
@@ -5,10 +5,10 @@ import { prop } from '../../utils/prop';
|
|
|
5
5
|
import { uniqueBy } from '../../utils/uniqueBy';
|
|
6
6
|
import { dataGridClassnames } from '../constants';
|
|
7
7
|
import { Variant } from '../enums';
|
|
8
|
-
import { getDataGridCssVars, getGridTemplateColumns } from '../utils';
|
|
8
|
+
import { getDataGridCssVars, getFlattenColumns, getGridTemplateColumns, isGroupColumns, } from '../utils';
|
|
9
9
|
import { useDataGridMobileLogic, usePinnedColumns } from './hooks';
|
|
10
10
|
import { getIsAllowHorizontalScroll } from './utils';
|
|
11
|
-
export const useLogic = ({ keyId, columns, rows = [], variant, tree, subrows, selectedRows = [], isLoading, isDisabled, onSelectRow, isError, onRetry, errorMsg, isHideSelectAll, isHideHeaderIfNoData = false, sorting, className, onSort, maxHeight, }) => {
|
|
11
|
+
export const useLogic = ({ keyId, columns, rows = [], variant, tree, subrows, selectedRows = [], isLoading, isDisabled, onSelectRow, isError, onRetry, errorMsg, isHideSelectAll, isHideHeaderIfNoData = false, sorting, className, onSort, maxHeight, gridViewMode: gridViewModeProp = 'standard', }) => {
|
|
12
12
|
const isFirstRender = useFirstMountState();
|
|
13
13
|
const isSelectable = Boolean(onSelectRow);
|
|
14
14
|
const isDataGridDisabled = isLoading || isDisabled;
|
|
@@ -39,7 +39,7 @@ export const useLogic = ({ keyId, columns, rows = [], variant, tree, subrows, se
|
|
|
39
39
|
const { isMobile, mobileSkeletonProps } = useDataGridMobileLogic({
|
|
40
40
|
containerRef,
|
|
41
41
|
isLoading,
|
|
42
|
-
columns: processedColumns(),
|
|
42
|
+
columns: getFlattenColumns(processedColumns()),
|
|
43
43
|
rows,
|
|
44
44
|
isNoScrollToTop: isLoading && isNoData,
|
|
45
45
|
});
|
|
@@ -47,8 +47,8 @@ export const useLogic = ({ keyId, columns, rows = [], variant, tree, subrows, se
|
|
|
47
47
|
? { ...subrows, isInitialExpanded: true }
|
|
48
48
|
: tree;
|
|
49
49
|
const availableRows = rows.filter((row) => !(row.options?.isDisabled || row.options?.isNotSelectable));
|
|
50
|
-
const gridColumns = getGridTemplateColumns(columns);
|
|
51
|
-
const isAllowHorizontalScroll = getIsAllowHorizontalScroll(columns);
|
|
50
|
+
const gridColumns = useMemo(() => getGridTemplateColumns(getFlattenColumns(columns)), [columns]);
|
|
51
|
+
const isAllowHorizontalScroll = getIsAllowHorizontalScroll(getFlattenColumns(columns));
|
|
52
52
|
const uncheckedRowsCount = useMemo(() => {
|
|
53
53
|
return availableRows.filter((row) => !selectedRows.find((selectedRow) => selectedRow[keyId] === row[keyId])).length;
|
|
54
54
|
}, [availableRows, selectedRows, keyId]);
|
|
@@ -72,7 +72,9 @@ export const useLogic = ({ keyId, columns, rows = [], variant, tree, subrows, se
|
|
|
72
72
|
}
|
|
73
73
|
onSelectRow(selectedRowsRef.current.filter((selectedRow) => selectedRow[keyId] !== row[keyId]));
|
|
74
74
|
};
|
|
75
|
-
const
|
|
75
|
+
const hasGroupedColumns = columns.some(isGroupColumns);
|
|
76
|
+
const gridViewMode = hasGroupedColumns ? 'full' : gridViewModeProp;
|
|
77
|
+
const isHideHead = (isHideHeaderIfNoData && isNoData) || (hasGroupedColumns && isNoData);
|
|
76
78
|
const contentStateProps = useMemo(() => {
|
|
77
79
|
return {
|
|
78
80
|
isLoading: (isLoading && isNoData) || (isMobile && isLoading),
|
|
@@ -104,9 +106,11 @@ export const useLogic = ({ keyId, columns, rows = [], variant, tree, subrows, se
|
|
|
104
106
|
containerRef,
|
|
105
107
|
gridColumns,
|
|
106
108
|
isNoData,
|
|
109
|
+
gridViewMode,
|
|
107
110
|
headColumns: processedColumns(),
|
|
108
111
|
isLoading,
|
|
109
112
|
mobileSkeletonProps,
|
|
113
|
+
hasGroupedColumns,
|
|
110
114
|
headProps: {
|
|
111
115
|
rowsCount: availableRows.length,
|
|
112
116
|
uncheckedRowsCount,
|
|
@@ -5,7 +5,7 @@ import type { DataGridColumns, DataGridRow } from '../../../types';
|
|
|
5
5
|
* Выбрасывает ошибку, если колонки с pinned="right" не идут непрерывным блоком в конце
|
|
6
6
|
* или колонки с pinned="left" не идут непрерывным блоком в начале.
|
|
7
7
|
*/
|
|
8
|
-
export declare const validatePinnedColumns:
|
|
8
|
+
export declare const validatePinnedColumns: <TData extends Record<string, unknown> = DataGridRow>(columns: DataGridColumns<TData>[]) => void;
|
|
9
9
|
/**
|
|
10
10
|
* Группирует колонки DataGrid по закреплённым позициям (pinned):
|
|
11
11
|
* - left (закреплены слева)
|
|
@@ -1,22 +1,30 @@
|
|
|
1
|
+
import { ErrorService } from '../../../../services/ErrorService';
|
|
2
|
+
import { isGroupColumns } from '../../../utils';
|
|
1
3
|
/**
|
|
2
4
|
* Валидирует корректность комбинаций закрепления колонок.
|
|
3
5
|
* Выбрасывает ошибку, если колонки с pinned="right" не идут непрерывным блоком в конце
|
|
4
6
|
* или колонки с pinned="left" не идут непрерывным блоком в начале.
|
|
5
7
|
*/
|
|
6
|
-
export const validatePinnedColumns = (
|
|
8
|
+
export const validatePinnedColumns = (columns) => {
|
|
9
|
+
const errorService = ErrorService.getInstance();
|
|
10
|
+
const positions = columns.map((c) => c.pinned ?? 'center');
|
|
7
11
|
const firstRight = positions.indexOf('right');
|
|
8
12
|
if (firstRight !== -1 &&
|
|
9
13
|
positions.slice(firstRight).some((p) => p !== 'right')) {
|
|
10
|
-
|
|
11
|
-
console.error('DataGrid: Колонки с pinned="right" должны идти непрерывным блоком в конце');
|
|
14
|
+
errorService.logError('DataGrid', 'Колонки с pinned="right" должны идти непрерывным блоком в конце');
|
|
12
15
|
}
|
|
13
16
|
// left: должны быть в начале
|
|
14
17
|
const lastLeft = positions.lastIndexOf('left');
|
|
15
18
|
if (lastLeft !== -1 &&
|
|
16
19
|
positions.slice(0, lastLeft + 1).some((p) => p !== 'left')) {
|
|
17
|
-
|
|
18
|
-
console.error('DataGrid: Колонки с pinned="left" должны идти непрерывным блоком в начале');
|
|
20
|
+
errorService.logError('DataGrid', 'Колонки с pinned="left" должны идти непрерывным блоком в начале');
|
|
19
21
|
}
|
|
22
|
+
columns.forEach((column) => {
|
|
23
|
+
if (isGroupColumns(column) &&
|
|
24
|
+
column.children.some((child) => child.pinned)) {
|
|
25
|
+
errorService.logError('DataGrid', 'pinned должен быть указан у родительской колонки, а не у дочерних элементов');
|
|
26
|
+
}
|
|
27
|
+
});
|
|
20
28
|
};
|
|
21
29
|
/**
|
|
22
30
|
* Группирует колонки DataGrid по закреплённым позициям (pinned):
|
|
@@ -25,6 +33,7 @@ export const validatePinnedColumns = (positions) => {
|
|
|
25
33
|
* - right (закреплены справа)
|
|
26
34
|
*/
|
|
27
35
|
export const getColumnSections = (columns) => {
|
|
36
|
+
validatePinnedColumns(columns);
|
|
28
37
|
const groups = columns.reduce((acc, col) => {
|
|
29
38
|
const position = col.pinned ?? 'center';
|
|
30
39
|
if (!acc[position]) {
|
|
@@ -33,13 +42,11 @@ export const getColumnSections = (columns) => {
|
|
|
33
42
|
acc[position].push(col);
|
|
34
43
|
return acc;
|
|
35
44
|
}, {});
|
|
36
|
-
const positions = columns.map((c) => c.pinned ?? 'center');
|
|
37
|
-
validatePinnedColumns(positions);
|
|
38
45
|
return {
|
|
39
46
|
sections: [
|
|
40
|
-
{ position: 'left', columns: groups.left },
|
|
41
|
-
{ position: 'center', columns: groups.center },
|
|
42
|
-
{ position: 'right', columns: groups.right },
|
|
47
|
+
{ position: 'left', columns: groups.left || [] },
|
|
48
|
+
{ position: 'center', columns: groups.center || [] },
|
|
49
|
+
{ position: 'right', columns: groups.right || [] },
|
|
43
50
|
],
|
|
44
51
|
};
|
|
45
52
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { isGroupColumns } from '../isGroupColumns';
|
|
2
|
+
export const getFlattenColumns = (columns, pinned) => {
|
|
3
|
+
return columns.flatMap((column) => {
|
|
4
|
+
const currentPinned = column.pinned ?? pinned;
|
|
5
|
+
if (isGroupColumns(column)) {
|
|
6
|
+
return getFlattenColumns(column.children, currentPinned);
|
|
7
|
+
}
|
|
8
|
+
return {
|
|
9
|
+
...column,
|
|
10
|
+
pinned: currentPinned,
|
|
11
|
+
};
|
|
12
|
+
});
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getFlattenColumns } from './getFlattenColumns';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getFlattenColumns } from './getFlattenColumns';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { alignToJustifyContent } from './alignToJustifyContent';
|
|
2
1
|
export { getDataGridCssVars } from './getDataGridCssVars';
|
|
3
2
|
export { getGridTemplateColumns } from './getGridTemplateColumns';
|
|
3
|
+
export { isGroupColumns } from './isGroupColumns';
|
|
4
|
+
export { getFlattenColumns } from './getFlattenColumns';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { alignToJustifyContent } from './alignToJustifyContent';
|
|
2
1
|
export { getDataGridCssVars } from './getDataGridCssVars';
|
|
3
2
|
export { getGridTemplateColumns } from './getGridTemplateColumns';
|
|
3
|
+
export { isGroupColumns } from './isGroupColumns';
|
|
4
|
+
export { getFlattenColumns } from './getFlattenColumns';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './isGroupColumns';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './isGroupColumns';
|
|
@@ -13,6 +13,7 @@ import { Container } from '../DataGrid/styles';
|
|
|
13
13
|
import { Loader } from '../Loader';
|
|
14
14
|
import { ScrollToTopButton } from '../ScrollToTopButton';
|
|
15
15
|
import { classNames } from '../utils/classNames';
|
|
16
|
+
import { cva } from '../utils/cva';
|
|
16
17
|
import { getInertProps } from '../utils/getInertProps';
|
|
17
18
|
import { OVERSCAN_COUNT } from './constants';
|
|
18
19
|
import { EndData } from './EndData';
|
|
@@ -22,14 +23,25 @@ import { NoData } from './NoData';
|
|
|
22
23
|
import { Backdrop, DataGridWrapper, DisabledDataGridWrapper, FooterRow, } from './styles';
|
|
23
24
|
import { useLogic } from './useLogic';
|
|
24
25
|
const INITIAL_LEVEL = 0;
|
|
26
|
+
const dataGridInfiniteCva = cva(dataGridClassnames.root, {
|
|
27
|
+
variants: {
|
|
28
|
+
hasGroupedColumns: {
|
|
29
|
+
true: dataGridClassnames.hasGroupedColumns,
|
|
30
|
+
},
|
|
31
|
+
gridViewMode: {
|
|
32
|
+
full: dataGridClassnames.gridViewFull,
|
|
33
|
+
standard: dataGridClassnames.gridViewStandard,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
});
|
|
25
37
|
export const DataGridInfinite = (props) => {
|
|
26
38
|
const { imagesMap, emptySymbol } = useContext(ConfigContext);
|
|
27
|
-
const { isNoData, isDataGridDisabled, isStickyButtonActive, treeRenderConfig, virtuosoProps, headProps, rowProps, scrollToTopButtonProps, isEndReached, isHideHead, containerCssVars, isMobile, mobileSkeletonProps, } = useLogic(props);
|
|
39
|
+
const { isNoData, isDataGridDisabled, isStickyButtonActive, treeRenderConfig, virtuosoProps, headProps, rowProps, scrollToTopButtonProps, isEndReached, isHideHead, containerCssVars, isMobile, mobileSkeletonProps, flattenColumns, hasGroupedColumns, gridViewMode, } = useLogic(props);
|
|
28
40
|
const { columns, rows = [], selectedRows = [], sorting, isLoading, isDisabled, keyId, emptyCellValue = emptySymbol, variant = Variant.Tree, subrows, className, isError, endOfScrollMsg, errorMsg, noDataPlaceholder, onRowClick, onSort, onRetry, headPreAddon, } = props;
|
|
29
41
|
const { moreButtonColumnPosition = 1, isVisibleCollapseButton = true } = subrows || {};
|
|
30
42
|
const { isInitialExpanded = false, expandedLevel = EXPANDED_LEVEL_BY_DEFAULT, initialVisibleChildrenCount = INITIAL_OPENED_NESTED_CHILDREN_COUNT_BY_DEFAULT, } = treeRenderConfig || {};
|
|
31
43
|
const TableContainer = isDisabled ? DisabledDataGridWrapper : DataGridWrapper;
|
|
32
|
-
return (_jsx(DataGridContextProvider, { children: _jsxs(Container, { style: containerCssVars, className: classNames(
|
|
44
|
+
return (_jsx(DataGridContextProvider, { children: _jsxs(Container, { style: containerCssVars, className: classNames(dataGridInfiniteCva({ hasGroupedColumns, gridViewMode }), className), children: [headPreAddon, _jsxs(TableContainer, { ...getInertProps(isDataGridDisabled), children: [!isHideHead && (_jsx(Head, { ...headProps, onSort: onSort, sorting: sorting, columns: columns })), _jsx(ContentState, { isLoading: isLoading && !isNoData, loadingTitle: "\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0434\u0430\u043D\u043D\u044B\u0445", isError: isError && !isNoData, loadingContent: isMobile && _jsx(MobileSkeleton, { ...mobileSkeletonProps }), errorState: {
|
|
33
45
|
imgAlt: 'Что-то пошло не так',
|
|
34
46
|
errorList: [errorMsg || ''],
|
|
35
47
|
imgSrc: imagesMap.defaultErrorImgSrc,
|
|
@@ -40,7 +52,7 @@ export const DataGridInfinite = (props) => {
|
|
|
40
52
|
List,
|
|
41
53
|
Item: ({ children, item, ...itemProps }) => {
|
|
42
54
|
const { children: nestedChildren, options, ...row } = item;
|
|
43
|
-
return (_jsx(RowContextProvider, { children: _jsx(Row, { ...rowProps, ...itemProps, row: row, columns:
|
|
55
|
+
return (_jsx(RowContextProvider, { children: _jsx(Row, { ...rowProps, ...itemProps, row: row, columns: flattenColumns, selectedRows: selectedRows, options: options, keyId: keyId, variant: variant, level: INITIAL_LEVEL, nestedChildren: nestedChildren, isInitialExpanded: isInitialExpanded, expandedLevel: expandedLevel, initialVisibleChildrenCount: initialVisibleChildrenCount, moreButtonColumnPosition: moreButtonColumnPosition, isVisibleCollapseButton: isVisibleCollapseButton, emptyCellValue: emptyCellValue, onRowClick: onRowClick }) }));
|
|
44
56
|
},
|
|
45
57
|
EmptyPlaceholder: () => _jsx(_Fragment, { children: noDataPlaceholder || _jsx(NoData, {}) }),
|
|
46
58
|
Footer: () => {
|
|
@@ -4,12 +4,13 @@ import { type DataGridRow } from '../../DataGrid';
|
|
|
4
4
|
import { type CellValue } from '../../DataGrid/types';
|
|
5
5
|
import { type DataGridInfiniteProps } from '../types';
|
|
6
6
|
type UseLogicParams<TData extends Record<string, CellValue> = DataGridRow, TSortField extends keyof TData = keyof TData> = DataGridInfiniteProps<TData, TSortField>;
|
|
7
|
-
export declare const useLogic: <TData extends Record<string, unknown> = DataGridRow, TSortField extends keyof TData = keyof TData>({ keyId, columns, rows, variant, tree, subrows, selectedRows, maxHeight, isLoading, isDisabled, isEndReached, onEndReached, onSelectRow, isHideSelectAll, isHideHeaderIfNoData, }: UseLogicParams<TData, TSortField>) => {
|
|
7
|
+
export declare const useLogic: <TData extends Record<string, unknown> = DataGridRow, TSortField extends keyof TData = keyof TData>({ keyId, columns, rows, variant, tree, subrows, selectedRows, maxHeight, isLoading, isDisabled, isEndReached, onEndReached, onSelectRow, isHideSelectAll, isHideHeaderIfNoData, gridViewMode: gridViewModeProp, }: UseLogicParams<TData, TSortField>) => {
|
|
8
8
|
containerCssVars: import("react").CSSProperties;
|
|
9
9
|
mobileSkeletonProps: {
|
|
10
10
|
cellsCount: number;
|
|
11
11
|
rowsCount: number;
|
|
12
12
|
};
|
|
13
|
+
flattenColumns: import("../../DataGrid").DataGridSingleColumn<TData>[];
|
|
13
14
|
isNoData: boolean;
|
|
14
15
|
isMobile: boolean;
|
|
15
16
|
isDataGridDisabled: boolean | undefined;
|
|
@@ -21,6 +22,8 @@ export declare const useLogic: <TData extends Record<string, unknown> = DataGrid
|
|
|
21
22
|
} | undefined;
|
|
22
23
|
isEndReached: boolean | undefined;
|
|
23
24
|
isHideHead: boolean;
|
|
25
|
+
hasGroupedColumns: boolean;
|
|
26
|
+
gridViewMode: "standard" | "full";
|
|
24
27
|
virtuosoProps: {
|
|
25
28
|
id: string;
|
|
26
29
|
ref: import("react").RefObject<VirtuosoHandle | null>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { useCallback, useMemo, useRef, useState, } from 'react';
|
|
2
2
|
import { Variant } from '../../DataGrid/enums';
|
|
3
3
|
import { useDataGridMobileLogic } from '../../DataGrid/useLogic/hooks';
|
|
4
|
-
import { getDataGridCssVars, getGridTemplateColumns, } from '../../DataGrid/utils';
|
|
4
|
+
import { getDataGridCssVars, getFlattenColumns, getGridTemplateColumns, isGroupColumns, } from '../../DataGrid/utils';
|
|
5
5
|
import { useToggle } from '../../useToggle';
|
|
6
6
|
import { useViewportType } from '../../useViewportType';
|
|
7
7
|
import { prop } from '../../utils/prop';
|
|
8
8
|
import { uniqueBy } from '../../utils/uniqueBy';
|
|
9
9
|
import { VIRTUOSO_CONTAINER_ID, VIRTUOSO_LIST_ID } from '../constants';
|
|
10
|
-
export const useLogic = ({ keyId, columns, rows, variant, tree, subrows, selectedRows = [], maxHeight, isLoading, isDisabled, isEndReached, onEndReached, onSelectRow, isHideSelectAll, isHideHeaderIfNoData = false, }) => {
|
|
10
|
+
export const useLogic = ({ keyId, columns, rows, variant, tree, subrows, selectedRows = [], maxHeight, isLoading, isDisabled, isEndReached, onEndReached, onSelectRow, isHideSelectAll, isHideHeaderIfNoData = false, gridViewMode: gridViewModeProp = 'standard', }) => {
|
|
11
11
|
const virtuoso = useRef(null);
|
|
12
12
|
const { isMobile } = useViewportType();
|
|
13
13
|
const [hasVerticalScroll, setHasVerticalScroll] = useState(false);
|
|
@@ -19,7 +19,10 @@ export const useLogic = ({ keyId, columns, rows, variant, tree, subrows, selecte
|
|
|
19
19
|
? { ...subrows, isInitialExpanded: true }
|
|
20
20
|
: tree;
|
|
21
21
|
const availableRows = rows.filter((row) => !(row.options?.isDisabled || row.options?.isNotSelectable));
|
|
22
|
-
const
|
|
22
|
+
const flattenColumns = useMemo(() => getFlattenColumns(columns), [columns]);
|
|
23
|
+
const hasGroupedColumns = columns.some(isGroupColumns);
|
|
24
|
+
const gridViewMode = hasGroupedColumns ? 'full' : gridViewModeProp;
|
|
25
|
+
const gridColumns = getGridTemplateColumns(flattenColumns);
|
|
23
26
|
const handleEndReach = useCallback(() => {
|
|
24
27
|
if (!isEndReached && onEndReached) {
|
|
25
28
|
onEndReached();
|
|
@@ -63,12 +66,13 @@ export const useLogic = ({ keyId, columns, rows, variant, tree, subrows, selecte
|
|
|
63
66
|
};
|
|
64
67
|
const isHideHead = isHideHeaderIfNoData && rows.length === 0;
|
|
65
68
|
const { mobileSkeletonProps } = useDataGridMobileLogic({
|
|
66
|
-
columns,
|
|
69
|
+
columns: flattenColumns,
|
|
67
70
|
});
|
|
68
71
|
const containerCssVars = getDataGridCssVars(maxHeight);
|
|
69
72
|
return {
|
|
70
73
|
containerCssVars,
|
|
71
74
|
mobileSkeletonProps,
|
|
75
|
+
flattenColumns,
|
|
72
76
|
isNoData,
|
|
73
77
|
isMobile,
|
|
74
78
|
isDataGridDisabled,
|
|
@@ -76,6 +80,8 @@ export const useLogic = ({ keyId, columns, rows, variant, tree, subrows, selecte
|
|
|
76
80
|
treeRenderConfig,
|
|
77
81
|
isEndReached: isEndReached && hasVerticalScroll,
|
|
78
82
|
isHideHead,
|
|
83
|
+
hasGroupedColumns,
|
|
84
|
+
gridViewMode,
|
|
79
85
|
virtuosoProps: {
|
|
80
86
|
id: VIRTUOSO_CONTAINER_ID,
|
|
81
87
|
ref: virtuoso,
|
|
@@ -1,24 +1,2 @@
|
|
|
1
|
-
import type { DialogProps
|
|
2
|
-
|
|
3
|
-
import type { WithoutEmotionSpecific } from '../types/WithoutEmotionSpecific';
|
|
4
|
-
export type DialogSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
5
|
-
export type DialogProps = WithoutEmotionSpecific<Omit<MuiDialogProps, 'title' | 'maxWidth'>> & {
|
|
6
|
-
/**
|
|
7
|
-
* Заголовок
|
|
8
|
-
*/
|
|
9
|
-
title?: ReactElement | ReactElement[] | string;
|
|
10
|
-
/**
|
|
11
|
-
* Отключить кликабельность фонового компонента
|
|
12
|
-
*/
|
|
13
|
-
disableBackdropClick?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Размер Dialog
|
|
16
|
-
* @default md
|
|
17
|
-
*/
|
|
18
|
-
size?: DialogSize;
|
|
19
|
-
/**
|
|
20
|
-
* Дополнительный контент хедера
|
|
21
|
-
*/
|
|
22
|
-
headerContent?: ReactNode;
|
|
23
|
-
};
|
|
24
|
-
export declare const Dialog: ({ children, title, disableBackdropClick, onClose, size, headerContent, ...props }: DialogProps) => import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import type { DialogProps } from './types';
|
|
2
|
+
export declare const Dialog: ({ children, title, disableBackdropClick, onClose, size, headerContent, className, classes, ...props }: DialogProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { BottomDrawer } from '../BottomDrawer';
|
|
3
3
|
import { DialogTitle } from '../DialogTitle';
|
|
4
|
-
import {
|
|
4
|
+
import { classNames } from '../utils/classNames';
|
|
5
|
+
import { cva } from '../utils/cva';
|
|
6
|
+
import { dialogClassnames } from './constants';
|
|
5
7
|
import { StyledDialog } from './styles';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
import { useLogic } from './useLogic';
|
|
9
|
+
const dialogCva = cva(dialogClassnames.root, {
|
|
10
|
+
variants: {
|
|
11
|
+
withoutTitle: {
|
|
12
|
+
true: dialogClassnames.withoutTitle,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
export const Dialog = ({ children, title, disableBackdropClick, onClose, size = 'md', headerContent, className, classes, ...props }) => {
|
|
17
|
+
const { handleClose, isMobile, dialogClasses } = useLogic({
|
|
18
|
+
onClose,
|
|
19
|
+
disableBackdropClick,
|
|
20
|
+
classes,
|
|
21
|
+
});
|
|
15
22
|
if (isMobile) {
|
|
16
23
|
return (_jsx(BottomDrawer, { onClose: handleClose, title: title, headerContent: headerContent, ...props, children: children }));
|
|
17
24
|
}
|
|
18
|
-
return (_jsxs(StyledDialog, { "$size": size, onClose: handleClose, ...props, children: [title && (_jsx(DialogTitle, { onClose: onClose, headerContent: headerContent, children: title })), children] }));
|
|
25
|
+
return (_jsxs(StyledDialog, { "$size": size, onClose: handleClose, className: classNames(dialogCva({ withoutTitle: !title }), className), classes: dialogClasses, ...props, children: [title && (_jsx(DialogTitle, { onClose: onClose, headerContent: headerContent, children: title })), children] }));
|
|
19
26
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createUIKitClassname } from '../utils/createUIKitClassname';
|
|
1
2
|
export const DIALOG_SIZES = {
|
|
2
3
|
xs: { minWidth: '300px', maxWidth: '399px' },
|
|
3
4
|
sm: { minWidth: '400px', maxWidth: '499px' },
|
|
@@ -5,3 +6,8 @@ export const DIALOG_SIZES = {
|
|
|
5
6
|
lg: { minWidth: '600px', maxWidth: '699px' },
|
|
6
7
|
xl: { minWidth: '700px', maxWidth: '980px' },
|
|
7
8
|
};
|
|
9
|
+
export const dialogClassnames = {
|
|
10
|
+
root: createUIKitClassname('dialog'),
|
|
11
|
+
withoutTitle: createUIKitClassname('dialog_without-title'),
|
|
12
|
+
paper: createUIKitClassname('dialog__paper'),
|
|
13
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './Dialog';
|
|
2
|
-
export { DIALOG_SIZES } from './constants';
|
|
2
|
+
export { DIALOG_SIZES, dialogClassnames } from './constants';
|