@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
|
@@ -20,6 +20,10 @@ exports.DataGridSection = styled_1.styled.div `
|
|
|
20
20
|
background-color: ${({ theme }) => theme.palette.background.default};
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
& .${constants_1.dataGridClassnames.body} {
|
|
24
|
+
scrollbar-gutter: unset;
|
|
25
|
+
}
|
|
26
|
+
|
|
23
27
|
&.${constants_1.dataGridClassnames.pinnedSectionNoData} {
|
|
24
28
|
grid-column: 1 / -1;
|
|
25
29
|
}
|
|
@@ -14,7 +14,7 @@ const useLogic = ({ position, isNoData, columns, }) => {
|
|
|
14
14
|
const shouldNotRenderSection = (isNoData && position !== 'center') || !columns || columns.length === 0;
|
|
15
15
|
const gridColumns = shouldNotRenderSection
|
|
16
16
|
? ''
|
|
17
|
-
: (0, utils_1.getGridTemplateColumns)(columns);
|
|
17
|
+
: (0, utils_1.getGridTemplateColumns)((0, utils_1.getFlattenColumns)(columns));
|
|
18
18
|
return { classnames, gridColumns, shouldNotRenderSection };
|
|
19
19
|
};
|
|
20
20
|
exports.useLogic = useLogic;
|
|
@@ -11,11 +11,15 @@ exports.PinnedColumnsContainer = styled_1.styled.div `
|
|
|
11
11
|
width: 100%;
|
|
12
12
|
height: 100%;
|
|
13
13
|
|
|
14
|
+
& .${constants_1.dataGridClassnames.header} {
|
|
15
|
+
padding-right: unset;
|
|
16
|
+
}
|
|
17
|
+
|
|
14
18
|
&.${constants_1.dataGridClassnames.disabled} {
|
|
15
|
-
|
|
19
|
+
pointer-events: none;
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
background: ${({ theme }) => theme.palette.background.element};
|
|
22
|
+
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
23
|
+
mix-blend-mode: luminosity;
|
|
20
24
|
}
|
|
21
25
|
`;
|
|
@@ -2,19 +2,24 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useLogic = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
+
const utils_1 = require("../../utils");
|
|
5
6
|
const useLogic = ({ sections, }) => {
|
|
7
|
+
const leftColumns = sections.find((section) => section.position === 'left')?.columns;
|
|
8
|
+
const rightColumns = sections.find((section) => section.position === 'right')?.columns;
|
|
6
9
|
const pinnedContainerStyles = {
|
|
7
|
-
'--left-columns-count':
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
'--left-columns-count': leftColumns
|
|
11
|
+
? (0, utils_1.getFlattenColumns)(leftColumns).length
|
|
12
|
+
: 0,
|
|
13
|
+
'--right-columns-count': rightColumns
|
|
14
|
+
? (0, utils_1.getFlattenColumns)(rightColumns).length
|
|
15
|
+
: 0,
|
|
11
16
|
};
|
|
12
17
|
const sectionOffsets = (0, react_1.useMemo)(() => {
|
|
13
18
|
const offsets = {};
|
|
14
19
|
let currentOffset = 0;
|
|
15
20
|
sections.forEach((section) => {
|
|
16
21
|
offsets[section.position] = currentOffset;
|
|
17
|
-
currentOffset += section.columns
|
|
22
|
+
currentOffset += (0, utils_1.getFlattenColumns)(section.columns).length;
|
|
18
23
|
});
|
|
19
24
|
return offsets;
|
|
20
25
|
}, [sections]);
|
|
@@ -10,11 +10,13 @@ const checkIsDeepEqual_1 = require("../../utils/checkIsDeepEqual");
|
|
|
10
10
|
const classNames_1 = require("../../utils/classNames");
|
|
11
11
|
const cva_1 = require("../../utils/cva");
|
|
12
12
|
const getInertProps_1 = require("../../utils/getInertProps");
|
|
13
|
+
const Cell_1 = require("../Cell");
|
|
14
|
+
const utils_1 = require("../utils");
|
|
13
15
|
const constants_1 = require("./constants");
|
|
14
16
|
const NestedChildren_1 = require("./NestedChildren");
|
|
15
17
|
const styles_1 = require("./styles");
|
|
16
18
|
const useLogic_1 = require("./useLogic");
|
|
17
|
-
const
|
|
19
|
+
const utils_2 = require("./utils");
|
|
18
20
|
const rootCva = (0, cva_1.cva)(constants_1.dataGridRowClassnames.root, {
|
|
19
21
|
variants: {
|
|
20
22
|
isShowConnector: {
|
|
@@ -29,6 +31,13 @@ const rowContentCva = (0, cva_1.cva)(constants_1.dataGridRowContentClassnames.ro
|
|
|
29
31
|
},
|
|
30
32
|
},
|
|
31
33
|
});
|
|
34
|
+
const groupedColumnLabelCva = (0, cva_1.cva)(constants_1.dataGridGroupedColumnLabelClassnames.root, {
|
|
35
|
+
variants: {
|
|
36
|
+
hidden: {
|
|
37
|
+
true: constants_1.dataGridGroupedColumnLabelClassnames.hidden,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
});
|
|
32
41
|
const RowComponent = (props) => {
|
|
33
42
|
const { isOpen, isShowConnector, childrenColumns, rowId, handleToggle, checkboxProps, rowProps, isHovered, tooltipProps, nestedChildrenProps, disabled, isRenderCollapseButton, rowRef, rowStyles, drawerProps, disabledReasonText, } = (0, useLogic_1.useLogic)(props);
|
|
34
43
|
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,
|
|
@@ -50,8 +59,18 @@ const RowComponent = (props) => {
|
|
|
50
59
|
return columns?.map((cell, index) => {
|
|
51
60
|
const cellId = `${rowId}-${index}`;
|
|
52
61
|
const globalIndex = (sectionOffset ?? 0) + index;
|
|
53
|
-
const isDisabledCell = (0,
|
|
62
|
+
const isDisabledCell = (0, utils_2.checkIsDisabled)(disabled, availableCellsByIndex, globalIndex);
|
|
54
63
|
const isFirstCell = globalIndex === 0;
|
|
64
|
+
if ((0, utils_1.isGroupColumns)(cell)) {
|
|
65
|
+
const { label, children, hideTitleOnMobile, isHideOnMobile } = cell;
|
|
66
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(styles_1.GroupedColumnLabel, { variant: "caption", color: "grey", colorIntensity: "700", className: groupedColumnLabelCva({
|
|
67
|
+
hidden: hideTitleOnMobile || isHideOnMobile,
|
|
68
|
+
}), children: label }), children.map((child, childIndex) => {
|
|
69
|
+
const childCellId = `${cellId}-${childIndex}`;
|
|
70
|
+
const shouldRenderStartAdornment = isFirstCell && childIndex === 0;
|
|
71
|
+
return ((0, jsx_runtime_1.jsx)(styles_1.CellStyled, { row: row, cell: child, isHideOnMobile: isHideOnMobile, emptyCellValue: emptyCellValue, isDisabled: isDisabledCell, startAdornment: shouldRenderStartAdornment && renderStartAdornment(), isHidePersonalData: child.isHidePersonalData, className: Cell_1.dataGridCellClassnames.grouped }, childCellId));
|
|
72
|
+
})] }, cellId));
|
|
73
|
+
}
|
|
55
74
|
return ((0, jsx_runtime_1.jsx)(styles_1.CellStyled, { row: row, cell: cell, emptyCellValue: emptyCellValue, startAdornment: isFirstCell && renderStartAdornment(), isDisabled: isDisabledCell, isHidePersonalData: cell.isHidePersonalData }, cellId));
|
|
56
75
|
});
|
|
57
76
|
}, [
|
|
@@ -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
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dataGridRowContentClassnames = exports.dataGridRowClassnames = exports.MOBILE_DRAWER_TITLE = exports.DISABLE_ROW_ATTR = void 0;
|
|
3
|
+
exports.dataGridGroupedColumnLabelClassnames = exports.dataGridRowCellClassnames = exports.dataGridRowContentClassnames = exports.dataGridRowClassnames = exports.MOBILE_DRAWER_TITLE = exports.DISABLE_ROW_ATTR = void 0;
|
|
4
4
|
const createUIKitClassname_1 = require("../../utils/createUIKitClassname");
|
|
5
5
|
exports.DISABLE_ROW_ATTR = 'data-row-disable';
|
|
6
6
|
exports.MOBILE_DRAWER_TITLE = 'Причина ';
|
|
@@ -16,3 +16,11 @@ exports.dataGridRowContentClassnames = {
|
|
|
16
16
|
root: (0, createUIKitClassname_1.createUIKitClassname)('data-grid__row-content'),
|
|
17
17
|
hovered: (0, createUIKitClassname_1.createUIKitClassname)('data-grid__row-content_hovered'),
|
|
18
18
|
};
|
|
19
|
+
exports.dataGridRowCellClassnames = {
|
|
20
|
+
single: (0, createUIKitClassname_1.createUIKitClassname)('data-grid__row-cell_single'),
|
|
21
|
+
grouped: (0, createUIKitClassname_1.createUIKitClassname)('data-grid__row-cell_grouped'),
|
|
22
|
+
};
|
|
23
|
+
exports.dataGridGroupedColumnLabelClassnames = {
|
|
24
|
+
root: (0, createUIKitClassname_1.createUIKitClassname)('data-grid-grouped-column-label'),
|
|
25
|
+
hidden: (0, createUIKitClassname_1.createUIKitClassname)('data-grid-grouped-column-label_hidden'),
|
|
26
|
+
};
|
|
@@ -43,3 +43,13 @@ export declare const BottomDrawerContent: import("@emotion/styled/dist/declarati
|
|
|
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("@emotion/styled/dist/declarations/src/types").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
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BottomDrawerContent = exports.ChevronIcon = exports.CollapseButton = exports.CollapseCell = exports.CheckboxCell = exports.CellStyled = exports.ContentWrapper = exports.Wrapper = void 0;
|
|
3
|
+
exports.GroupedColumnLabel = exports.BottomDrawerContent = exports.ChevronIcon = exports.CollapseButton = exports.CollapseCell = exports.CheckboxCell = exports.CellStyled = exports.ContentWrapper = exports.Wrapper = void 0;
|
|
4
4
|
const ChevronROutlineMd_1 = require("../../../icons/ChevronROutlineMd");
|
|
5
5
|
const IconButton_1 = require("../../IconButton");
|
|
6
6
|
const styled_1 = require("../../styled");
|
|
7
|
+
const Typography_1 = require("../../Typography");
|
|
7
8
|
const Cell_1 = require("../Cell");
|
|
8
9
|
const constants_1 = require("../constants");
|
|
9
10
|
const constants_2 = require("./constants");
|
|
@@ -105,7 +106,6 @@ exports.ContentWrapper = styled_1.styled.div `
|
|
|
105
106
|
|
|
106
107
|
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
107
108
|
grid-template-columns: 1fr;
|
|
108
|
-
gap: ${({ theme }) => theme.spacing(3)};
|
|
109
109
|
}
|
|
110
110
|
`;
|
|
111
111
|
exports.CellStyled = (0, styled_1.styled)(Cell_1.Cell) `
|
|
@@ -157,3 +157,16 @@ exports.BottomDrawerContent = styled_1.styled.div `
|
|
|
157
157
|
padding: ${({ theme }) => theme.spacing(5, 4)};
|
|
158
158
|
}
|
|
159
159
|
`;
|
|
160
|
+
exports.GroupedColumnLabel = (0, styled_1.styled)(Typography_1.Typography) `
|
|
161
|
+
display: none;
|
|
162
|
+
|
|
163
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
164
|
+
display: block;
|
|
165
|
+
|
|
166
|
+
margin-top: ${({ theme }) => theme.spacing(3)};
|
|
167
|
+
|
|
168
|
+
&.${constants_2.dataGridGroupedColumnLabelClassnames.hidden} {
|
|
169
|
+
display: none;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
`;
|
|
@@ -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
|
};
|
|
@@ -17,11 +17,14 @@ exports.dataGridClassnames = {
|
|
|
17
17
|
bodyEmpty: (0, createUIKitClassname_1.createUIKitClassname)('data-grid__body_empty'),
|
|
18
18
|
disabled: (0, createUIKitClassname_1.createUIKitClassname)('data-grid_disabled'),
|
|
19
19
|
pinnedSectionNoData: (0, createUIKitClassname_1.createUIKitClassname)('data-grid__pinned-section_no-data'),
|
|
20
|
-
|
|
20
|
+
hasPinnedSections: (0, createUIKitClassname_1.createUIKitClassname)('data-grid_has-pinned-sections'),
|
|
21
21
|
pinnedSections: (0, createUIKitClassname_1.createUIKitClassname)('data-grid__pinned-sections'),
|
|
22
22
|
leftPinnedSection: (0, createUIKitClassname_1.createUIKitClassname)('data-grid__left-pinned-section'),
|
|
23
23
|
rightPinnedSection: (0, createUIKitClassname_1.createUIKitClassname)('data-grid__right-pinned-section'),
|
|
24
24
|
overflowed: (0, createUIKitClassname_1.createUIKitClassname)('data-grid_overflowed'),
|
|
25
25
|
wrapper: (0, createUIKitClassname_1.createUIKitClassname)('data-grid__wrapper'),
|
|
26
26
|
isAllowHorizontalScroll: (0, createUIKitClassname_1.createUIKitClassname)('data-grid_is-allow-horizontal-scroll'),
|
|
27
|
+
hasGroupedColumns: (0, createUIKitClassname_1.createUIKitClassname)('data-grid_has-grouped-columns'),
|
|
28
|
+
gridViewFull: (0, createUIKitClassname_1.createUIKitClassname)('data-grid_grid-view-full'),
|
|
29
|
+
gridViewStandard: (0, createUIKitClassname_1.createUIKitClassname)('data-grid_grid-view-standard'),
|
|
27
30
|
};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.makeDataListWithTree = exports.makeDataList = exports.makeColumns = exports.makeRandomDate = void 0;
|
|
4
4
|
const faker_1 = require("@ui/dev/faker");
|
|
5
|
+
const utils_1 = require("./utils");
|
|
5
6
|
const RECIPIENTS = [
|
|
6
7
|
'ИП Иванов О.В.',
|
|
7
8
|
'ООО "Новая организация"',
|
|
@@ -16,22 +17,25 @@ const makeRandomDate = () => {
|
|
|
16
17
|
};
|
|
17
18
|
exports.makeRandomDate = makeRandomDate;
|
|
18
19
|
const makeColumns = (columnsTemplate, mergedColumns = []) => {
|
|
19
|
-
const mergedColumnsMap = mergedColumns.reduce((acc,
|
|
20
|
-
if (field) {
|
|
20
|
+
const mergedColumnsMap = mergedColumns.reduce((acc, column) => {
|
|
21
|
+
if (!(0, utils_1.isGroupColumns)(column) && column.field) {
|
|
22
|
+
const { field, ...columnsOptions } = column;
|
|
21
23
|
return {
|
|
22
|
-
// biome-ignore lint/performance/noAccumulatingSpread: <>
|
|
23
24
|
...acc,
|
|
24
25
|
[field]: columnsOptions,
|
|
25
26
|
};
|
|
26
27
|
}
|
|
27
28
|
return acc;
|
|
28
29
|
}, {});
|
|
29
|
-
return columnsTemplate.map((column) =>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
return columnsTemplate.map((column) => {
|
|
31
|
+
if ((0, utils_1.isGroupColumns)(column) || !column.field) {
|
|
32
|
+
return column;
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
...column,
|
|
36
|
+
...(mergedColumnsMap[column.field] || {}),
|
|
37
|
+
};
|
|
38
|
+
});
|
|
35
39
|
};
|
|
36
40
|
exports.makeColumns = makeColumns;
|
|
37
41
|
const makeDataList = (dataObjTemplate, options) => {
|
|
@@ -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';
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DisabledDataGridWrapper = exports.DataGridWrapper = exports.Container = void 0;
|
|
4
4
|
const styled_1 = require("../styled");
|
|
5
|
-
const constants_1 = require("./constants");
|
|
5
|
+
const constants_1 = require("./Cell/constants");
|
|
6
|
+
const constants_2 = require("./constants");
|
|
7
|
+
const HeadCell_1 = require("./HeadCell");
|
|
8
|
+
const constants_3 = require("./Row/constants");
|
|
6
9
|
exports.Container = styled_1.styled.div `
|
|
7
10
|
--max-height: initial;
|
|
8
11
|
|
|
@@ -16,48 +19,127 @@ exports.Container = styled_1.styled.div `
|
|
|
16
19
|
height: 100%;
|
|
17
20
|
max-height: var(--max-height);
|
|
18
21
|
|
|
19
|
-
&.${
|
|
22
|
+
&.${constants_2.dataGridClassnames.isAllowHorizontalScroll} {
|
|
20
23
|
overflow: auto hidden;
|
|
21
24
|
|
|
22
|
-
& .${
|
|
25
|
+
& .${constants_2.dataGridClassnames.wrapper} {
|
|
23
26
|
overflow: auto hidden;
|
|
24
27
|
}
|
|
25
28
|
}
|
|
26
29
|
|
|
27
|
-
&.${
|
|
30
|
+
&.${constants_2.dataGridClassnames.hasPinnedSections} {
|
|
28
31
|
overflow: hidden;
|
|
29
32
|
}
|
|
30
33
|
|
|
34
|
+
&.${constants_2.dataGridClassnames.hasGroupedColumns} {
|
|
35
|
+
& .${constants_2.dataGridClassnames.header} {
|
|
36
|
+
grid-template-rows: repeat(2, auto);
|
|
37
|
+
|
|
38
|
+
& .${HeadCell_1.headCellClassnames.groupParent} {
|
|
39
|
+
grid-column: var(--grid-column-start) / var(--grid-column-end);
|
|
40
|
+
grid-row: 1;
|
|
41
|
+
justify-content: center;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
& .${HeadCell_1.headCellClassnames.groupChild} {
|
|
45
|
+
grid-row: 2;
|
|
46
|
+
justify-content: center;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
& .${HeadCell_1.headCellClassnames.singleColumn} {
|
|
50
|
+
grid-row: 1 / -1;
|
|
51
|
+
|
|
52
|
+
height: 80px;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
31
57
|
@supports not (container-type: scroll-state) {
|
|
32
|
-
&.${
|
|
33
|
-
& .${
|
|
58
|
+
&.${constants_2.dataGridClassnames.overflowed} {
|
|
59
|
+
& .${constants_2.dataGridClassnames.rightPinnedSection} {
|
|
34
60
|
box-shadow: -3px 0 4px 0 #63636326;
|
|
35
61
|
}
|
|
36
62
|
|
|
37
|
-
& .${
|
|
63
|
+
& .${constants_2.dataGridClassnames.leftPinnedSection} {
|
|
38
64
|
box-shadow: 3px 0 4px 0 #63636326;
|
|
39
65
|
}
|
|
40
66
|
}
|
|
41
67
|
}
|
|
42
68
|
|
|
69
|
+
&.${constants_2.dataGridClassnames.gridViewFull} {
|
|
70
|
+
& .${constants_2.dataGridClassnames.header} {
|
|
71
|
+
background-color: ${({ theme }) => theme.palette.grey[100]};
|
|
72
|
+
border-top-left-radius: ${({ theme }) => theme.shape.medium};
|
|
73
|
+
border-top-right-radius: ${({ theme }) => theme.shape.medium};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
& .${constants_1.dataGridCellClassnames.root},
|
|
77
|
+
& .${HeadCell_1.headCellClassnames.root} {
|
|
78
|
+
border-top: 1px solid ${({ theme }) => theme.palette.components.border.default};
|
|
79
|
+
border-left: 1px solid ${({ theme }) => theme.palette.components.border.default};
|
|
80
|
+
|
|
81
|
+
&:first-of-type,
|
|
82
|
+
&:first-of-type + .${HeadCell_1.headCellClassnames.groupChild} {
|
|
83
|
+
border-left: none;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
& .${HeadCell_1.headCellClassnames.singleColumn},
|
|
88
|
+
& .${HeadCell_1.headCellClassnames.groupParent} {
|
|
89
|
+
border-top: none;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
& .${constants_3.dataGridRowClassnames.root}:last-of-type .${constants_1.dataGridCellClassnames.root} {
|
|
93
|
+
border-bottom: 1px solid ${({ theme }) => theme.palette.components.border.default};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&:not(.${constants_2.dataGridClassnames.hasPinnedSections}) .${constants_2.dataGridClassnames.body},
|
|
97
|
+
& .${constants_2.dataGridClassnames.pinnedSections} {
|
|
98
|
+
container-name: data-grid-scroll-container;
|
|
99
|
+
container-type: scroll-state;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* Прогрессивное улучшение. Убираем нижнюю границу последней строки когда scrollbar находится в нижней точке. Для того что бы избежать двойного разделителя снизу */
|
|
103
|
+
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
104
|
+
@container data-grid-scroll-container scroll-state((scrollable: y) and (not (scrollable: bottom))) {
|
|
105
|
+
& .${constants_3.dataGridRowClassnames.root}:last-of-type .${constants_1.dataGridCellClassnames.root} {
|
|
106
|
+
border-bottom: none;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
& .${constants_3.dataGridRowClassnames.root}:first-of-type .${constants_1.dataGridCellClassnames.root} {
|
|
111
|
+
border-top: none;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
43
115
|
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
44
116
|
overflow: initial;
|
|
45
117
|
|
|
46
|
-
& .${
|
|
118
|
+
& .${constants_2.dataGridClassnames.loadingPlaceholder} {
|
|
47
119
|
justify-content: flex-start;
|
|
48
120
|
}
|
|
49
121
|
|
|
50
|
-
&.${
|
|
122
|
+
&.${constants_2.dataGridClassnames.hasPinnedSections} {
|
|
51
123
|
overflow: initial;
|
|
52
124
|
}
|
|
53
125
|
|
|
54
|
-
&.${
|
|
126
|
+
&.${constants_2.dataGridClassnames.isAllowHorizontalScroll} {
|
|
55
127
|
overflow: initial;
|
|
56
128
|
|
|
57
|
-
& .${
|
|
129
|
+
& .${constants_2.dataGridClassnames.wrapper} {
|
|
58
130
|
overflow: initial;
|
|
59
131
|
}
|
|
60
132
|
}
|
|
133
|
+
|
|
134
|
+
&.${constants_2.dataGridClassnames.gridViewFull} {
|
|
135
|
+
& .${constants_1.dataGridCellClassnames.root}, & .${HeadCell_1.headCellClassnames.root} {
|
|
136
|
+
border: none;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
& .${constants_3.dataGridRowClassnames.root}:last-of-type .${constants_1.dataGridCellClassnames.root} {
|
|
140
|
+
border-bottom: none;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
61
143
|
}
|
|
62
144
|
`;
|
|
63
145
|
exports.DataGridWrapper = styled_1.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/node/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;
|
|
@@ -11,7 +11,7 @@ const enums_1 = require("../enums");
|
|
|
11
11
|
const utils_1 = require("../utils");
|
|
12
12
|
const hooks_1 = require("./hooks");
|
|
13
13
|
const utils_2 = require("./utils");
|
|
14
|
-
const useLogic = ({ keyId, columns, rows = [], variant, tree, subrows, selectedRows = [], isLoading, isDisabled, onSelectRow, isError, onRetry, errorMsg, isHideSelectAll, isHideHeaderIfNoData = false, sorting, className, onSort, maxHeight, }) => {
|
|
14
|
+
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', }) => {
|
|
15
15
|
const isFirstRender = (0, useFirstMountState_1.useFirstMountState)();
|
|
16
16
|
const isSelectable = Boolean(onSelectRow);
|
|
17
17
|
const isDataGridDisabled = isLoading || isDisabled;
|
|
@@ -42,7 +42,7 @@ const useLogic = ({ keyId, columns, rows = [], variant, tree, subrows, selectedR
|
|
|
42
42
|
const { isMobile, mobileSkeletonProps } = (0, hooks_1.useDataGridMobileLogic)({
|
|
43
43
|
containerRef,
|
|
44
44
|
isLoading,
|
|
45
|
-
columns: processedColumns(),
|
|
45
|
+
columns: (0, utils_1.getFlattenColumns)(processedColumns()),
|
|
46
46
|
rows,
|
|
47
47
|
isNoScrollToTop: isLoading && isNoData,
|
|
48
48
|
});
|
|
@@ -50,8 +50,8 @@ const useLogic = ({ keyId, columns, rows = [], variant, tree, subrows, selectedR
|
|
|
50
50
|
? { ...subrows, isInitialExpanded: true }
|
|
51
51
|
: tree;
|
|
52
52
|
const availableRows = rows.filter((row) => !(row.options?.isDisabled || row.options?.isNotSelectable));
|
|
53
|
-
const gridColumns = (0, utils_1.getGridTemplateColumns)(columns);
|
|
54
|
-
const isAllowHorizontalScroll = (0, utils_2.getIsAllowHorizontalScroll)(columns);
|
|
53
|
+
const gridColumns = (0, react_1.useMemo)(() => (0, utils_1.getGridTemplateColumns)((0, utils_1.getFlattenColumns)(columns)), [columns]);
|
|
54
|
+
const isAllowHorizontalScroll = (0, utils_2.getIsAllowHorizontalScroll)((0, utils_1.getFlattenColumns)(columns));
|
|
55
55
|
const uncheckedRowsCount = (0, react_1.useMemo)(() => {
|
|
56
56
|
return availableRows.filter((row) => !selectedRows.find((selectedRow) => selectedRow[keyId] === row[keyId])).length;
|
|
57
57
|
}, [availableRows, selectedRows, keyId]);
|
|
@@ -75,7 +75,9 @@ const useLogic = ({ keyId, columns, rows = [], variant, tree, subrows, selectedR
|
|
|
75
75
|
}
|
|
76
76
|
onSelectRow(selectedRowsRef.current.filter((selectedRow) => selectedRow[keyId] !== row[keyId]));
|
|
77
77
|
};
|
|
78
|
-
const
|
|
78
|
+
const hasGroupedColumns = columns.some(utils_1.isGroupColumns);
|
|
79
|
+
const gridViewMode = hasGroupedColumns ? 'full' : gridViewModeProp;
|
|
80
|
+
const isHideHead = (isHideHeaderIfNoData && isNoData) || (hasGroupedColumns && isNoData);
|
|
79
81
|
const contentStateProps = (0, react_1.useMemo)(() => {
|
|
80
82
|
return {
|
|
81
83
|
isLoading: (isLoading && isNoData) || (isMobile && isLoading),
|
|
@@ -107,9 +109,11 @@ const useLogic = ({ keyId, columns, rows = [], variant, tree, subrows, selectedR
|
|
|
107
109
|
containerRef,
|
|
108
110
|
gridColumns,
|
|
109
111
|
isNoData,
|
|
112
|
+
gridViewMode,
|
|
110
113
|
headColumns: processedColumns(),
|
|
111
114
|
isLoading,
|
|
112
115
|
mobileSkeletonProps,
|
|
116
|
+
hasGroupedColumns,
|
|
113
117
|
headProps: {
|
|
114
118
|
rowsCount: availableRows.length,
|
|
115
119
|
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 (закреплены слева)
|