@astral/ui 4.45.0 → 4.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/components/ComplianceStatus/ComplianceStatus.d.ts +1 -43
  2. package/components/ComplianceStatus/ComplianceStatus.js +17 -2
  3. package/components/ComplianceStatus/constants.d.ts +14 -0
  4. package/components/ComplianceStatus/constants.js +18 -0
  5. package/components/ComplianceStatus/index.d.ts +2 -1
  6. package/components/ComplianceStatus/index.js +1 -1
  7. package/components/ComplianceStatus/public.d.ts +2 -1
  8. package/components/ComplianceStatus/public.js +1 -1
  9. package/components/ComplianceStatus/styles.d.ts +0 -5
  10. package/components/ComplianceStatus/styles.js +21 -3
  11. package/components/ComplianceStatus/types.d.ts +42 -0
  12. package/components/ComplianceStatus/types.js +1 -0
  13. package/components/DataGrid/Body/Body.d.ts +1 -98
  14. package/components/DataGrid/Body/Body.js +3 -15
  15. package/components/DataGrid/Body/index.d.ts +1 -0
  16. package/components/DataGrid/Body/index.js +1 -0
  17. package/components/DataGrid/Body/types.d.ts +110 -0
  18. package/components/DataGrid/Body/types.js +1 -0
  19. package/components/DataGrid/DataGrid.js +30 -5
  20. package/components/DataGrid/Head/Head.d.ts +4 -0
  21. package/components/DataGrid/Head/Head.js +3 -2
  22. package/components/DataGrid/Loader/Loader.js +2 -2
  23. package/components/DataGrid/Loader/styles.js +4 -2
  24. package/components/DataGrid/PinnedSections/PinnedSections.d.ts +35 -0
  25. package/components/DataGrid/PinnedSections/PinnedSections.js +11 -0
  26. package/components/DataGrid/PinnedSections/Section/Section.d.ts +3 -0
  27. package/components/DataGrid/PinnedSections/Section/Section.js +17 -0
  28. package/components/DataGrid/PinnedSections/Section/index.d.ts +1 -0
  29. package/components/DataGrid/PinnedSections/Section/index.js +1 -0
  30. package/components/DataGrid/PinnedSections/Section/styles.d.ts +5 -0
  31. package/components/DataGrid/PinnedSections/Section/styles.js +100 -0
  32. package/components/DataGrid/PinnedSections/Section/types.d.ts +26 -0
  33. package/components/DataGrid/PinnedSections/Section/types.js +1 -0
  34. package/components/DataGrid/PinnedSections/Section/useLogic/useLogic.d.ts +9 -0
  35. package/components/DataGrid/PinnedSections/Section/useLogic/useLogic.js +16 -0
  36. package/components/DataGrid/PinnedSections/index.d.ts +1 -0
  37. package/components/DataGrid/PinnedSections/index.js +1 -0
  38. package/components/DataGrid/PinnedSections/styles.d.ts +7 -0
  39. package/components/DataGrid/PinnedSections/styles.js +18 -0
  40. package/components/DataGrid/PinnedSections/types.d.ts +5 -0
  41. package/components/DataGrid/PinnedSections/types.js +1 -0
  42. package/components/DataGrid/PinnedSections/useLogic/index.js +1 -0
  43. package/components/DataGrid/PinnedSections/useLogic/useLogic.d.ts +9 -0
  44. package/components/DataGrid/PinnedSections/useLogic/useLogic.js +19 -0
  45. package/components/DataGrid/Row/NestedChildren/NestedChildren.js +2 -2
  46. package/components/DataGrid/Row/Row.d.ts +1 -94
  47. package/components/DataGrid/Row/Row.js +23 -8
  48. package/components/DataGrid/Row/constants.d.ts +3 -1
  49. package/components/DataGrid/Row/constants.js +3 -1
  50. package/components/DataGrid/Row/styles.js +9 -8
  51. package/components/DataGrid/Row/types.d.ts +118 -0
  52. package/components/DataGrid/Row/types.js +1 -0
  53. package/components/DataGrid/Row/useLogic/useLogic.d.ts +3 -2
  54. package/components/DataGrid/Row/useLogic/useLogic.js +14 -2
  55. package/components/DataGrid/constants.d.ts +7 -0
  56. package/components/DataGrid/constants.js +7 -0
  57. package/components/DataGrid/hooks/index.d.ts +1 -0
  58. package/components/DataGrid/hooks/index.js +1 -0
  59. package/components/DataGrid/hooks/useRowHover/index.d.ts +1 -0
  60. package/components/DataGrid/hooks/useRowHover/index.js +1 -0
  61. package/components/DataGrid/hooks/useRowHover/useRowHover.d.ts +15 -0
  62. package/components/DataGrid/hooks/useRowHover/useRowHover.js +93 -0
  63. package/components/DataGrid/styles.js +17 -0
  64. package/components/DataGrid/types.d.ts +4 -0
  65. package/components/DataGrid/useLogic/hooks/index.d.ts +2 -0
  66. package/components/DataGrid/useLogic/hooks/index.js +2 -0
  67. package/components/DataGrid/useLogic/hooks/useClassnames/index.d.ts +1 -0
  68. package/components/DataGrid/useLogic/hooks/useClassnames/index.js +1 -0
  69. package/components/DataGrid/useLogic/hooks/useClassnames/useClassnames.d.ts +12 -0
  70. package/components/DataGrid/useLogic/hooks/useClassnames/useClassnames.js +14 -0
  71. package/components/DataGrid/useLogic/hooks/usePinnedColumns/index.d.ts +1 -0
  72. package/components/DataGrid/useLogic/hooks/usePinnedColumns/index.js +1 -0
  73. package/components/DataGrid/useLogic/hooks/usePinnedColumns/usePinnedColumns.d.ts +18 -0
  74. package/components/DataGrid/useLogic/hooks/usePinnedColumns/usePinnedColumns.js +43 -0
  75. package/components/DataGrid/useLogic/useLogic.d.ts +30 -4
  76. package/components/DataGrid/useLogic/useLogic.js +55 -16
  77. package/components/DataGrid/useLogic/utils/getColumnSections/getColumnSections.d.ts +17 -0
  78. package/components/DataGrid/useLogic/utils/getColumnSections/getColumnSections.js +45 -0
  79. package/components/DataGrid/useLogic/utils/getColumnSections/index.d.ts +1 -0
  80. package/components/DataGrid/useLogic/utils/getColumnSections/index.js +1 -0
  81. package/components/DataGrid/useLogic/utils/index.d.ts +2 -1
  82. package/components/DataGrid/useLogic/utils/index.js +2 -1
  83. package/components/DataGrid/useLogic/utils/syncRowsHeight/index.d.ts +1 -0
  84. package/components/DataGrid/useLogic/utils/syncRowsHeight/index.js +1 -0
  85. package/components/DataGrid/useLogic/utils/syncRowsHeight/syncRowsHeight.d.ts +5 -0
  86. package/components/DataGrid/useLogic/utils/syncRowsHeight/syncRowsHeight.js +21 -0
  87. package/components/DataGrid/utils/index.d.ts +1 -0
  88. package/components/DataGrid/utils/index.js +1 -0
  89. package/components/DataGridInfinite/useLogic/useLogic.js +1 -1
  90. package/node/components/ComplianceStatus/ComplianceStatus.d.ts +1 -43
  91. package/node/components/ComplianceStatus/ComplianceStatus.js +17 -2
  92. package/node/components/ComplianceStatus/constants.d.ts +14 -0
  93. package/node/components/ComplianceStatus/constants.js +21 -0
  94. package/node/components/ComplianceStatus/index.d.ts +2 -1
  95. package/node/components/ComplianceStatus/public.d.ts +2 -1
  96. package/node/components/ComplianceStatus/styles.d.ts +0 -5
  97. package/node/components/ComplianceStatus/styles.js +21 -3
  98. package/node/components/ComplianceStatus/types.d.ts +42 -0
  99. package/node/components/ComplianceStatus/types.js +2 -0
  100. package/node/components/DataGrid/Body/Body.d.ts +1 -98
  101. package/node/components/DataGrid/Body/Body.js +3 -15
  102. package/node/components/DataGrid/Body/index.d.ts +1 -0
  103. package/node/components/DataGrid/Body/index.js +1 -0
  104. package/node/components/DataGrid/Body/types.d.ts +110 -0
  105. package/node/components/DataGrid/Body/types.js +2 -0
  106. package/node/components/DataGrid/DataGrid.js +29 -4
  107. package/node/components/DataGrid/Head/Head.d.ts +4 -0
  108. package/node/components/DataGrid/Head/Head.js +3 -2
  109. package/node/components/DataGrid/Loader/Loader.js +1 -1
  110. package/node/components/DataGrid/Loader/styles.js +4 -2
  111. package/node/components/DataGrid/PinnedSections/PinnedSections.d.ts +35 -0
  112. package/node/components/DataGrid/PinnedSections/PinnedSections.js +15 -0
  113. package/node/components/DataGrid/PinnedSections/Section/Section.d.ts +3 -0
  114. package/node/components/DataGrid/PinnedSections/Section/Section.js +21 -0
  115. package/node/components/DataGrid/PinnedSections/Section/index.d.ts +1 -0
  116. package/node/components/DataGrid/PinnedSections/Section/index.js +17 -0
  117. package/node/components/DataGrid/PinnedSections/Section/styles.d.ts +5 -0
  118. package/node/components/DataGrid/PinnedSections/Section/styles.js +103 -0
  119. package/node/components/DataGrid/PinnedSections/Section/types.d.ts +26 -0
  120. package/node/components/DataGrid/PinnedSections/Section/types.js +2 -0
  121. package/node/components/DataGrid/PinnedSections/Section/useLogic/index.d.ts +1 -0
  122. package/node/components/DataGrid/PinnedSections/Section/useLogic/useLogic.d.ts +9 -0
  123. package/node/components/DataGrid/PinnedSections/Section/useLogic/useLogic.js +20 -0
  124. package/node/components/DataGrid/PinnedSections/index.d.ts +1 -0
  125. package/node/components/DataGrid/PinnedSections/index.js +17 -0
  126. package/node/components/DataGrid/PinnedSections/styles.d.ts +7 -0
  127. package/node/components/DataGrid/PinnedSections/styles.js +21 -0
  128. package/node/components/DataGrid/PinnedSections/types.d.ts +5 -0
  129. package/node/components/DataGrid/PinnedSections/types.js +2 -0
  130. package/node/components/DataGrid/PinnedSections/useLogic/index.d.ts +1 -0
  131. package/node/components/DataGrid/PinnedSections/useLogic/index.js +17 -0
  132. package/node/components/DataGrid/PinnedSections/useLogic/useLogic.d.ts +9 -0
  133. package/node/components/DataGrid/PinnedSections/useLogic/useLogic.js +23 -0
  134. package/node/components/DataGrid/Row/NestedChildren/NestedChildren.js +1 -1
  135. package/node/components/DataGrid/Row/Row.d.ts +1 -94
  136. package/node/components/DataGrid/Row/Row.js +23 -8
  137. package/node/components/DataGrid/Row/constants.d.ts +3 -1
  138. package/node/components/DataGrid/Row/constants.js +4 -2
  139. package/node/components/DataGrid/Row/styles.js +8 -7
  140. package/node/components/DataGrid/Row/types.d.ts +118 -0
  141. package/node/components/DataGrid/Row/types.js +2 -0
  142. package/node/components/DataGrid/Row/useLogic/useLogic.d.ts +3 -2
  143. package/node/components/DataGrid/Row/useLogic/useLogic.js +13 -1
  144. package/node/components/DataGrid/constants.d.ts +7 -0
  145. package/node/components/DataGrid/constants.js +7 -0
  146. package/node/components/DataGrid/hooks/index.d.ts +1 -0
  147. package/node/components/DataGrid/hooks/index.js +17 -0
  148. package/node/components/DataGrid/hooks/useRowHover/index.d.ts +1 -0
  149. package/node/components/DataGrid/hooks/useRowHover/index.js +17 -0
  150. package/node/components/DataGrid/hooks/useRowHover/useRowHover.d.ts +15 -0
  151. package/node/components/DataGrid/hooks/useRowHover/useRowHover.js +97 -0
  152. package/node/components/DataGrid/styles.js +17 -0
  153. package/node/components/DataGrid/types.d.ts +4 -0
  154. package/node/components/DataGrid/useLogic/hooks/index.d.ts +2 -0
  155. package/node/components/DataGrid/useLogic/hooks/index.js +18 -0
  156. package/node/components/DataGrid/useLogic/hooks/useClassnames/index.d.ts +1 -0
  157. package/node/components/DataGrid/useLogic/hooks/useClassnames/index.js +17 -0
  158. package/node/components/DataGrid/useLogic/hooks/useClassnames/useClassnames.d.ts +12 -0
  159. package/node/components/DataGrid/useLogic/hooks/useClassnames/useClassnames.js +18 -0
  160. package/node/components/DataGrid/useLogic/hooks/usePinnedColumns/index.d.ts +1 -0
  161. package/node/components/DataGrid/useLogic/hooks/usePinnedColumns/index.js +17 -0
  162. package/node/components/DataGrid/useLogic/hooks/usePinnedColumns/usePinnedColumns.d.ts +18 -0
  163. package/node/components/DataGrid/useLogic/hooks/usePinnedColumns/usePinnedColumns.js +47 -0
  164. package/node/components/DataGrid/useLogic/useLogic.d.ts +30 -4
  165. package/node/components/DataGrid/useLogic/useLogic.js +53 -14
  166. package/node/components/DataGrid/useLogic/utils/getColumnSections/getColumnSections.d.ts +17 -0
  167. package/node/components/DataGrid/useLogic/utils/getColumnSections/getColumnSections.js +50 -0
  168. package/node/components/DataGrid/useLogic/utils/getColumnSections/index.d.ts +1 -0
  169. package/node/components/DataGrid/useLogic/utils/getColumnSections/index.js +17 -0
  170. package/node/components/DataGrid/useLogic/utils/index.d.ts +2 -1
  171. package/node/components/DataGrid/useLogic/utils/index.js +5 -3
  172. package/node/components/DataGrid/useLogic/utils/syncRowsHeight/index.d.ts +1 -0
  173. package/node/components/DataGrid/useLogic/utils/syncRowsHeight/index.js +17 -0
  174. package/node/components/DataGrid/useLogic/utils/syncRowsHeight/syncRowsHeight.d.ts +5 -0
  175. package/node/components/DataGrid/useLogic/utils/syncRowsHeight/syncRowsHeight.js +25 -0
  176. package/node/components/DataGrid/utils/index.d.ts +1 -0
  177. package/node/components/DataGrid/utils/index.js +3 -1
  178. package/node/components/DataGridInfinite/useLogic/useLogic.js +1 -1
  179. package/package.json +2 -1
  180. package/components/DataGrid/Body/useLogic/useLogic.d.ts +0 -12
  181. package/components/DataGrid/Body/useLogic/useLogic.js +0 -11
  182. package/node/components/DataGrid/Body/useLogic/useLogic.d.ts +0 -12
  183. package/node/components/DataGrid/Body/useLogic/useLogic.js +0 -15
  184. /package/components/DataGrid/{Body → PinnedSections/Section}/useLogic/index.d.ts +0 -0
  185. /package/components/DataGrid/{Body → PinnedSections/Section}/useLogic/index.js +0 -0
  186. /package/{node/components/DataGrid/Body → components/DataGrid/PinnedSections}/useLogic/index.d.ts +0 -0
  187. /package/components/DataGrid/{useLogic/utils → utils}/getGridTemplateColumns/getGridTemplateColumns.d.ts +0 -0
  188. /package/components/DataGrid/{useLogic/utils → utils}/getGridTemplateColumns/getGridTemplateColumns.js +0 -0
  189. /package/components/DataGrid/{useLogic/utils → utils}/getGridTemplateColumns/index.d.ts +0 -0
  190. /package/components/DataGrid/{useLogic/utils → utils}/getGridTemplateColumns/index.js +0 -0
  191. /package/node/components/DataGrid/{Body → PinnedSections/Section}/useLogic/index.js +0 -0
  192. /package/node/components/DataGrid/{useLogic/utils → utils}/getGridTemplateColumns/getGridTemplateColumns.d.ts +0 -0
  193. /package/node/components/DataGrid/{useLogic/utils → utils}/getGridTemplateColumns/getGridTemplateColumns.js +0 -0
  194. /package/node/components/DataGrid/{useLogic/utils → utils}/getGridTemplateColumns/index.d.ts +0 -0
  195. /package/node/components/DataGrid/{useLogic/utils → utils}/getGridTemplateColumns/index.js +0 -0
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { getInertProps } from '../../utils/getInertProps';
3
+ import { Section } from './Section';
4
+ import { PinnedColumnsContainer } from './styles';
5
+ import { useLogic } from './useLogic';
6
+ export const PinnedSections = ({ gridColumns, className, isDisabled, headProps, bodyProps, sections, isNoData, }) => {
7
+ const { pinnedContainerStyles, sectionOffsets } = useLogic({ sections });
8
+ return (_jsx(PinnedColumnsContainer, { "$gridColumns": gridColumns, className: className, ...getInertProps(isDisabled), style: pinnedContainerStyles, children: sections.map(({ columns, position }) => {
9
+ return (_jsx(Section, { columns: columns, position: position, sectionOffset: sectionOffsets[position], bodyProps: bodyProps, headProps: headProps, isNoData: isNoData }, position));
10
+ }) }));
11
+ };
@@ -0,0 +1,3 @@
1
+ import type { DataGridRow } from '../../types';
2
+ import type { SectionProps } from './types';
3
+ export declare const Section: <TData extends Record<string, unknown> = DataGridRow, TSortField extends keyof TData = keyof TData>({ columns, position, isNoData, headProps, bodyProps, sectionOffset, }: SectionProps<TData, TSortField>) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Body } from '../../Body';
3
+ import { dataGridClassnames } from '../../constants';
4
+ import { Head } from '../../Head';
5
+ import { DataGridSection } from './styles';
6
+ import { useLogic } from './useLogic';
7
+ export const Section = ({ columns, position, isNoData, headProps, bodyProps, sectionOffset, }) => {
8
+ const { classnames, gridColumns, shouldNotRenderSection } = useLogic({
9
+ position,
10
+ isNoData,
11
+ columns,
12
+ });
13
+ if (shouldNotRenderSection) {
14
+ return null;
15
+ }
16
+ return (_jsxs(DataGridSection, { className: classnames, children: [!isNoData && (_jsx(Head, { ...headProps, columns: columns, gridColumns: gridColumns, sectionOffset: sectionOffset })), _jsx(Body, { ...bodyProps, columns: columns, gridColumns: gridColumns, sectionOffset: sectionOffset, className: dataGridClassnames.body })] }));
17
+ };
@@ -0,0 +1 @@
1
+ export * from './Section';
@@ -0,0 +1 @@
1
+ export * from './Section';
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export declare const DataGridSection: import("../../../styled").StyledComponent<{
3
+ theme?: import("@emotion/react").Theme | undefined;
4
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
5
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -0,0 +1,100 @@
1
+ import { styled } from '../../../styled';
2
+ import { dataGridClassnames } from '../../constants';
3
+ export const DataGridSection = styled.div `
4
+ display: flex;
5
+ grid-column: calc(var(--left-columns-count) + 1) / calc(var(--right-columns-count) * -1 - 1);
6
+ flex-direction: column;
7
+
8
+ min-width: 0;
9
+
10
+ background-color: ${({ theme }) => theme.palette.background.default};
11
+
12
+ & .${dataGridClassnames.header} {
13
+ position: sticky;
14
+ z-index: ${({ theme }) => theme.zIndex.fab - 1};
15
+ top: 0;
16
+
17
+ background-color: ${({ theme }) => theme.palette.background.default};
18
+ }
19
+
20
+ &.${dataGridClassnames.pinnedSectionNoData} {
21
+ grid-column: 1 / -1;
22
+ }
23
+
24
+ &.${dataGridClassnames.leftPinnedSection} {
25
+ position: sticky;
26
+ z-index: ${({ theme }) => theme.zIndex.fab};
27
+ left: 0;
28
+
29
+ container-name: data-grid-left-pinned-section;
30
+ container-type: scroll-state;
31
+ grid-column: 1 / calc(var(--left-columns-count) + 1);
32
+
33
+ &::after {
34
+ content: '';
35
+
36
+ position: absolute;
37
+ z-index: ${({ theme }) => theme.zIndex.fab};
38
+ top: 0;
39
+ right: 0;
40
+
41
+ height: 100%;
42
+
43
+ border-right: 1px solid ${({ theme }) => theme.palette.grey[300]};
44
+ }
45
+
46
+ & .${dataGridClassnames.header} {
47
+ left: 0;
48
+ }
49
+
50
+
51
+ /* Причина игнора: прогрессивное улучшение */
52
+ /* stylelint-disable-next-line plugin/no-unsupported-browser-features */
53
+ @container data-grid-left-pinned-section scroll-state(stuck: left) {
54
+ &::after {
55
+ /* Ширина видимой части тени */
56
+ width: 4px;
57
+
58
+ box-shadow: 3px 0 4px 0 #63636326;
59
+ }
60
+ }
61
+ }
62
+
63
+ &.${dataGridClassnames.rightPinnedSection} {
64
+ position: sticky;
65
+ z-index: ${({ theme }) => theme.zIndex.fab};
66
+ right: 0;
67
+
68
+ container-name: data-grid-right-pinned-section;
69
+ container-type: scroll-state;
70
+ grid-column: calc(var(--right-columns-count) * -1 - 1) / -1;
71
+
72
+ &::after {
73
+ content: '';
74
+
75
+ position: absolute;
76
+ z-index: ${({ theme }) => theme.zIndex.fab};
77
+ top: 0;
78
+ left: 0;
79
+
80
+ height: 100%;
81
+
82
+ border-left: 1px solid ${({ theme }) => theme.palette.grey[300]};
83
+ }
84
+
85
+ & .${dataGridClassnames.header} {
86
+ right: 0;
87
+ }
88
+
89
+ /* Причина игнора: прогрессивное улучшение */
90
+ /* stylelint-disable-next-line plugin/no-unsupported-browser-features */
91
+ @container data-grid-right-pinned-section scroll-state(stuck: right) {
92
+ &::after {
93
+ /* Ширина видимой части тени */
94
+ width: 4px;
95
+
96
+ box-shadow: -3px 0 4px 0 #63636326;
97
+ }
98
+ }
99
+ }
100
+ `;
@@ -0,0 +1,26 @@
1
+ import { type BodyProps } from '../../Body';
2
+ import { type HeadProps } from '../../Head';
3
+ import { type CellValue, type DataGridColumns, type DataGridRow } from '../../types';
4
+ export type SectionProps<TData extends Record<string, CellValue> = DataGridRow, TSortField extends keyof TData = keyof TData> = {
5
+ /**
6
+ * Параметры предназначены для конфигурации таблицы
7
+ */
8
+ bodyProps: Omit<BodyProps<TData>, 'gridColumns' | 'columns'>;
9
+ /**
10
+ * Параметры предназначены для конфигурации шапки таблицы
11
+ */
12
+ headProps: Omit<HeadProps<TData, TSortField>, 'columns' | 'gridColumns'>;
13
+ /**
14
+ * Флаг для отображения placeholder при отсутствии данных
15
+ */
16
+ isNoData?: boolean;
17
+ /**
18
+ * Конфигурация колонок для секции
19
+ */
20
+ columns: DataGridColumns<TData>[];
21
+ /**
22
+ * Позиция секции
23
+ */
24
+ position: 'left' | 'center' | 'right';
25
+ sectionOffset: number;
26
+ };
@@ -0,0 +1,9 @@
1
+ import type { CellValue, DataGridRow } from '../../..//types';
2
+ import { type SectionProps } from '../types';
3
+ type UseLogicParams<TData extends Record<string, CellValue> = DataGridRow> = Pick<SectionProps<TData>, 'isNoData' | 'position' | 'columns'>;
4
+ export declare const useLogic: <TData extends Record<string, unknown> = DataGridRow>({ position, isNoData, columns, }: UseLogicParams<TData>) => {
5
+ classnames: string;
6
+ gridColumns: string;
7
+ shouldNotRenderSection: boolean;
8
+ };
9
+ export {};
@@ -0,0 +1,16 @@
1
+ import { useMemo } from 'react';
2
+ import { classNames } from '../../../../utils/classNames';
3
+ import { dataGridClassnames } from '../../../constants';
4
+ import { getGridTemplateColumns } from '../../../utils';
5
+ export const useLogic = ({ position, isNoData, columns, }) => {
6
+ const classnames = useMemo(() => classNames({
7
+ [dataGridClassnames.leftPinnedSection]: position === 'left',
8
+ [dataGridClassnames.rightPinnedSection]: position === 'right',
9
+ [dataGridClassnames.pinnedSectionNoData]: isNoData && position === 'center',
10
+ }), []);
11
+ const shouldNotRenderSection = (isNoData && position !== 'center') || !columns || columns.length === 0;
12
+ const gridColumns = shouldNotRenderSection
13
+ ? ''
14
+ : getGridTemplateColumns(columns);
15
+ return { classnames, gridColumns, shouldNotRenderSection };
16
+ };
@@ -0,0 +1 @@
1
+ export * from './PinnedSections';
@@ -0,0 +1 @@
1
+ export * from './PinnedSections';
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ export declare const PinnedColumnsContainer: import("../../styled").StyledComponent<{
3
+ theme?: import("@emotion/react").Theme | undefined;
4
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
5
+ } & {
6
+ $gridColumns: string;
7
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -0,0 +1,18 @@
1
+ import { styled } from '../../styled';
2
+ import { dataGridClassnames } from '../constants';
3
+ export const PinnedColumnsContainer = styled.div `
4
+ overflow: auto;
5
+ display: grid;
6
+ grid-template-columns: ${({ $gridColumns }) => $gridColumns};
7
+
8
+ width: 100%;
9
+ height: 100%;
10
+
11
+ &.${dataGridClassnames.disabled} {
12
+ pointer-events: none;
13
+
14
+ background: ${({ theme }) => theme.palette.background.element};
15
+ /* stylelint-disable-next-line plugin/no-unsupported-browser-features */
16
+ mix-blend-mode: luminosity;
17
+ }
18
+ `;
@@ -0,0 +1,5 @@
1
+ import type { CellValue, DataGridColumns, DataGridRow } from '../types';
2
+ export type PinnedSection<TData extends Record<string, CellValue> = DataGridRow> = {
3
+ columns: DataGridColumns<TData>[];
4
+ position: 'left' | 'center' | 'right';
5
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export * from './useLogic';
@@ -0,0 +1,9 @@
1
+ import { type CSSProperties } from 'react';
2
+ import { type CellValue, type DataGridRow } from '../../types';
3
+ import { type PinnedSectionsProps } from '../PinnedSections';
4
+ type UseLogicParams<TData extends Record<string, CellValue> = DataGridRow> = Pick<PinnedSectionsProps<TData>, 'sections'>;
5
+ export declare const useLogic: <TData extends Record<string, unknown> = DataGridRow>({ sections, }: UseLogicParams<TData>) => {
6
+ pinnedContainerStyles: CSSProperties;
7
+ sectionOffsets: Record<string, number>;
8
+ };
9
+ export {};
@@ -0,0 +1,19 @@
1
+ import { useMemo } from 'react';
2
+ export const useLogic = ({ sections, }) => {
3
+ const pinnedContainerStyles = {
4
+ '--left-columns-count': sections.find((section) => section.position === 'left')?.columns
5
+ ?.length ?? 0,
6
+ '--right-columns-count': sections.find((section) => section.position === 'right')?.columns
7
+ ?.length ?? 0,
8
+ };
9
+ const sectionOffsets = useMemo(() => {
10
+ const offsets = {};
11
+ let currentOffset = 0;
12
+ sections.forEach((section) => {
13
+ offsets[section.position] = currentOffset;
14
+ currentOffset += section.columns?.length ?? 0;
15
+ });
16
+ return offsets;
17
+ }, [sections]);
18
+ return { pinnedContainerStyles, sectionOffsets };
19
+ };
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { memo } from 'react';
3
3
  import { Collapse } from '../../../Collapse';
4
- import { dataGridClassnames } from '../constants';
4
+ import { dataGridRowClassnames } from '../constants';
5
5
  import { MoreButton, MoreButtonRow, NestedRows } from './styles';
6
6
  import { useLogic } from './useLogic';
7
7
  export const NestedChildren = memo((props) => {
@@ -27,7 +27,7 @@ export const NestedChildren = memo((props) => {
27
27
  options,
28
28
  nestedChildren: children,
29
29
  level: nextLevel,
30
- className: dataGridClassnames.hidden,
30
+ className: dataGridRowClassnames.hidden,
31
31
  });
32
32
  }) }) }), isShowMoreButton && (_jsx(MoreButtonRow, { "$level": nextLevel, "$isShowConnector": isShowConnector, "$gridColumns": gridColumns, children: _jsx(MoreButton, { "$moreButtonColumnPosition": moreButtonColumnPosition, variant: "link", onClick: handleToggleShowAllChildren, children: isShowAllChildren ? 'Скрыть' : 'Показать все' }) }))] }))] }) }));
33
33
  });
@@ -1,95 +1,2 @@
1
- import { type ChangeEvent, type ReactNode } from 'react';
2
- import { type Variant } from '../enums';
3
- import type { CellValue, DataGridColumns, DataGridRowOptions } from '../types';
4
- export type RowProps<TData extends Record<string, CellValue>> = {
5
- /**
6
- * Название класса, применяется к корневому компоненту
7
- */
8
- className?: string;
9
- /**
10
- * Поле, которое будет использоваться в качестве ключа
11
- */
12
- keyId: keyof TData;
13
- /**
14
- * Данные строки для отображения
15
- */
16
- row: TData;
17
- /**
18
- * Конфигурация колонок для таблицы
19
- */
20
- columns: DataGridColumns<TData>[];
21
- /**
22
- * Вариант отображения вложенных элементов
23
- */
24
- variant: `${Variant}`;
25
- /**
26
- * Конфигурация ширины колонок
27
- */
28
- gridColumns: string;
29
- /**
30
- * Уровень вложенности в дереве
31
- */
32
- level: number;
33
- /**
34
- * Вложенные элементы
35
- */
36
- nestedChildren: Array<TData & {
37
- options?: DataGridRowOptions<TData>;
38
- }>;
39
- /**
40
- * Идентификатор активного элемента массива rows. Выделяет активную строку в таблице
41
- */
42
- activeRowId?: string;
43
- /**
44
- * Если true, то дерево будет раскрыто по умолчанию
45
- */
46
- isInitialExpanded: boolean;
47
- /**
48
- * Уровень раскрытия дерева по умолчанию, при isInitialExpanded=true
49
- */
50
- expandedLevel: number;
51
- /**
52
- * Количество отображаемых по умолчанию дочерних элементов
53
- */
54
- initialVisibleChildrenCount: number;
55
- /**
56
- * Номер колонки, в которой будет расположена кнопка "Показать все"
57
- * Работает только для `variant="subrows"`
58
- */
59
- moreButtonColumnPosition: number;
60
- /**
61
- * Если false, кнопка разворачивания элементов не показывается
62
- * Работает только для `variant="subrows"`
63
- */
64
- isVisibleCollapseButton: boolean;
65
- /**
66
- * Если true, то будет отображаться чекбокс для выбора элемента
67
- */
68
- isSelectable?: boolean;
69
- /**
70
- * Флаг выбора текущей строки
71
- */
72
- isSelected?: boolean;
73
- /**
74
- * Массив выбранных строк
75
- */
76
- selectedRows?: TData[];
77
- /**
78
- * Заглушка для пустых ячеек (если отсутствует field и filter и renderCell)
79
- * @default '-'
80
- */
81
- emptyCellValue?: ReactNode;
82
- /**
83
- * Дополнительные настройки строки
84
- */
85
- options?: DataGridRowOptions<TData>;
86
- /**
87
- * Обработчик выбора строки
88
- */
89
- onSelectRow: (row: TData) => (event: ChangeEvent<HTMLInputElement>) => void;
90
- /**
91
- * Обработчик клика строки таблицы
92
- */
93
- onRowClick?: (row: TData) => void;
94
- };
1
+ import type { RowProps } from './types';
95
2
  export declare const Row: <TData extends Record<string, unknown>>(props: RowProps<TData>) => import("react/jsx-runtime").JSX.Element;
@@ -10,8 +10,8 @@ import { CellStyled, CheckboxCell, ChevronIcon, CollapseButton, CollapseCell, Co
10
10
  import { useLogic } from './useLogic';
11
11
  import { checkIsDisabled } from './utils';
12
12
  const RowComponent = (props) => {
13
- const { isOpen, isShowConnector, childrenColumns, rowId, handleToggle, checkboxProps, rowProps, tooltipProps, nestedChildrenProps, disabled, isRenderCollapseButton, } = useLogic(props);
14
- const { className, row, options, variant, isSelectable, gridColumns, isInitialExpanded, expandedLevel, level, nestedChildren, initialVisibleChildrenCount, moreButtonColumnPosition, isVisibleCollapseButton, columns, emptyCellValue, selectedRows, activeRowId, keyId, onSelectRow, onRowClick,
13
+ const { isOpen, isShowConnector, childrenColumns, rowId, handleToggle, checkboxProps, rowProps, tooltipProps, nestedChildrenProps, disabled, isRenderCollapseButton, rowRef, } = useLogic(props);
14
+ 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,
15
15
  // В этот rest-оператор попадают специфичные пропсы (атрибуты) virtuoso
16
16
  // Необходимы для DataGridInfinite
17
17
  ...selfProps } = props;
@@ -23,17 +23,26 @@ const RowComponent = (props) => {
23
23
  return (_jsxs(_Fragment, { children: [isRenderCollapseButton && (_jsx(CollapseCell, { children: _jsx(CollapseButton, { variant: "text", onClick: handleToggle, children: _jsx(ChevronIcon, { "$isActive": isOpen }) }) })), isSelectable && !isNotSelectable && (_jsx(CheckboxCell, { ...getInertProps(disabled), onClick: (event) => event.stopPropagation(), children: _jsx(Checkbox, { ...checkboxProps }) }))] }));
24
24
  };
25
25
  const renderCells = useCallback(() => {
26
+ const lastCellGlobalIndex = (totalColumnsCount ?? columns.length) - 1;
26
27
  const availableCellsByIndex = !isDisabledLastCell
27
- ? [columns.length - 1]
28
+ ? [lastCellGlobalIndex]
28
29
  : undefined;
29
30
  return columns?.map((cell, index) => {
30
31
  const cellId = `${rowId}-${index}`;
31
- const isDisabledCell = checkIsDisabled(disabled, availableCellsByIndex, index);
32
- const isFirstCell = !index;
32
+ const globalIndex = (sectionOffset ?? 0) + index;
33
+ const isDisabledCell = checkIsDisabled(disabled, availableCellsByIndex, globalIndex);
34
+ const isFirstCell = globalIndex === 0;
33
35
  return (_jsx(CellStyled, { "$level": isFirstCell ? level : 0, row: row, cell: cell, emptyCellValue: emptyCellValue, startAdornment: isFirstCell && renderStartAdornment(), isDisabled: isDisabledCell, isHidePersonalData: cell.isHidePersonalData }, cellId));
34
36
  });
35
- }, [isOpen, columns, disabled, checkboxProps.checked]);
36
- const renderRow = useCallback(({ key, ...nestedRowProps }) => (_jsx(Row, { keyId: keyId, ...nestedRowProps, variant: variant, isSelectable: isSelectable, selectedRows: selectedRows, gridColumns: gridColumns, isInitialExpanded: isInitialExpanded, expandedLevel: expandedLevel, initialVisibleChildrenCount: initialVisibleChildrenCount, moreButtonColumnPosition: moreButtonColumnPosition, isVisibleCollapseButton: isVisibleCollapseButton, activeRowId: activeRowId, columns: childrenColumns, onSelectRow: onSelectRow, onRowClick: onRowClick }, key)), [
37
+ }, [
38
+ isOpen,
39
+ columns,
40
+ disabled,
41
+ checkboxProps.checked,
42
+ totalColumnsCount,
43
+ sectionOffset,
44
+ ]);
45
+ const renderRow = useCallback(({ key, ...nestedRowProps }) => (_jsx(Row, { keyId: keyId, ...nestedRowProps, variant: variant, isSelectable: isSelectable, selectedRows: selectedRows, gridColumns: gridColumns, isInitialExpanded: isInitialExpanded, expandedLevel: expandedLevel, initialVisibleChildrenCount: initialVisibleChildrenCount, moreButtonColumnPosition: moreButtonColumnPosition, isVisibleCollapseButton: isVisibleCollapseButton, activeRowId: activeRowId, columns: childrenColumns, onSelectRow: onSelectRow, onRowClick: onRowClick, totalColumnsCount: totalColumnsCount, registerRowElement: registerRowElement, unregisterRowElement: unregisterRowElement, onRowEnter: onRowEnter, onRowLeave: onRowLeave, sectionOffset: sectionOffset }, key)), [
37
46
  keyId,
38
47
  variant,
39
48
  isSelectable,
@@ -43,12 +52,18 @@ const RowComponent = (props) => {
43
52
  expandedLevel,
44
53
  initialVisibleChildrenCount,
45
54
  moreButtonColumnPosition,
55
+ sectionOffset,
56
+ totalColumnsCount,
46
57
  activeRowId,
47
58
  childrenColumns,
48
59
  onSelectRow,
49
60
  onRowClick,
61
+ registerRowElement,
62
+ unregisterRowElement,
63
+ onRowEnter,
64
+ onRowLeave,
50
65
  ]);
51
- return (_jsxs(Wrapper, { "$level": level, "$isShowConnector": isShowConnector, className: className, ...selfProps, children: [_jsx(Tooltip, { followCursor: true, arrow: false, ...tooltipProps, children: _jsx(ContentWrapper, { "$level": level, "$isShowConnector": isShowConnector, "$gridColumns": gridColumns, [DISABLE_ROW_ATTR]: disabled, ...rowProps, children: renderCells() }) }), _jsx(NestedChildren, { ...nestedChildrenProps, data: nestedChildren, keyId: keyId, level: level, variant: variant, gridColumns: gridColumns, initialVisibleChildrenCount: initialVisibleChildrenCount, moreButtonColumnPosition: moreButtonColumnPosition,
66
+ return (_jsxs(Wrapper, { "$level": level, "$isShowConnector": isShowConnector, className: className, ...selfProps, children: [_jsx(Tooltip, { followCursor: true, arrow: false, ...tooltipProps, children: _jsx(ContentWrapper, { "$level": level, "data-row-id": rowId, ref: rowRef, onPointerEnter: () => onRowEnter?.(rowId), onPointerLeave: (event) => onRowLeave?.(rowId, event.nativeEvent), "$isShowConnector": isShowConnector, "$gridColumns": gridColumns, [DISABLE_ROW_ATTR]: disabled, ...rowProps, children: renderCells() }) }), _jsx(NestedChildren, { ...nestedChildrenProps, data: nestedChildren, keyId: keyId, level: level, variant: variant, gridColumns: gridColumns, initialVisibleChildrenCount: initialVisibleChildrenCount, moreButtonColumnPosition: moreButtonColumnPosition,
52
67
  // biome-ignore lint/suspicious/noTsIgnore: <>
53
68
  // @ts-ignore
54
69
  renderRow: renderRow })] }));
@@ -1,4 +1,6 @@
1
1
  export declare const DISABLE_ROW_ATTR = "data-row-disable";
2
- export declare const dataGridClassnames: {
2
+ export declare const dataGridRowClassnames: {
3
3
  hidden: string;
4
+ hover: string;
5
+ hasPinnedColumns: string;
4
6
  };
@@ -1,5 +1,7 @@
1
1
  import { createUIKitClassname } from '../../utils/createUIKitClassname';
2
2
  export const DISABLE_ROW_ATTR = 'data-row-disable';
3
- export const dataGridClassnames = {
3
+ export const dataGridRowClassnames = {
4
4
  hidden: createUIKitClassname('data-grid__row_hidden'),
5
+ hover: createUIKitClassname('data-grid__row_hover'),
6
+ hasPinnedColumns: createUIKitClassname('data-grid__row_has-pinned-columns'),
5
7
  };
@@ -3,12 +3,12 @@ import { IconButton } from '../../IconButton';
3
3
  import { styled } from '../../styled';
4
4
  import { Cell } from '../Cell';
5
5
  import { ROOT_ACTION_CELL_WIDTH, TREE_LINE_WIDTH } from '../constants';
6
- import { dataGridClassnames } from './constants';
6
+ import { dataGridRowClassnames } from './constants';
7
7
  export const Wrapper = styled.li `
8
8
  position: relative;
9
9
 
10
10
  &:not(:last-of-type)::before,
11
- &.${dataGridClassnames.hidden}::before {
11
+ &.${dataGridRowClassnames.hidden}::before {
12
12
  content: '';
13
13
 
14
14
  position: absolute;
@@ -32,12 +32,6 @@ export const ContentWrapper = styled.div `
32
32
 
33
33
  background-color: ${({ theme, $isSelected }) => $isSelected ? theme.palette.primary[100] : 'transparent'};
34
34
 
35
- transition: ${({ theme }) => {
36
- return theme.transitions.create(['background-color'], {
37
- duration: theme.transitions.duration.short,
38
- });
39
- }};
40
-
41
35
  &::before {
42
36
  content: '';
43
37
 
@@ -58,6 +52,13 @@ export const ContentWrapper = styled.div `
58
52
  &:hover {
59
53
  cursor: ${({ $isHovered }) => ($isHovered ? 'pointer' : 'default')};
60
54
 
55
+ background-color: ${({ theme }) => theme.palette.background.elementHover};
56
+ }
57
+
58
+
59
+ &.${dataGridRowClassnames.hover} {
60
+ cursor: ${({ $isHovered }) => ($isHovered ? 'pointer' : 'default')};
61
+
61
62
  background-color: ${({ theme, $isSelected }) => $isSelected
62
63
  ? theme.palette.primary[100]
63
64
  : theme.palette.background.elementHover};
@@ -0,0 +1,118 @@
1
+ import { type ChangeEvent, type ReactNode } from 'react';
2
+ import { type Variant } from '../enums';
3
+ import { type CellValue, type DataGridColumns, type DataGridRowOptions } from '../types';
4
+ export type RowProps<TData extends Record<string, CellValue>> = {
5
+ /**
6
+ * Название класса, применяется к корневому компоненту
7
+ */
8
+ className?: string;
9
+ /**
10
+ * Поле, которое будет использоваться в качестве ключа
11
+ */
12
+ keyId: keyof TData;
13
+ /**
14
+ * Данные строки для отображения
15
+ */
16
+ row: TData;
17
+ /**
18
+ * Конфигурация колонок для таблицы
19
+ */
20
+ columns: DataGridColumns<TData>[];
21
+ /**
22
+ * Вариант отображения вложенных элементов
23
+ */
24
+ variant: `${Variant}`;
25
+ /**
26
+ * Конфигурация ширины колонок
27
+ */
28
+ gridColumns: string;
29
+ /**
30
+ * Уровень вложенности в дереве
31
+ */
32
+ level: number;
33
+ /**
34
+ * Вложенные элементы
35
+ */
36
+ nestedChildren: Array<TData & {
37
+ options?: DataGridRowOptions<TData>;
38
+ }>;
39
+ /**
40
+ * Идентификатор активного элемента массива rows. Выделяет активную строку в таблице
41
+ */
42
+ activeRowId?: string;
43
+ /**
44
+ * Если true, то дерево будет раскрыто по умолчанию
45
+ */
46
+ isInitialExpanded: boolean;
47
+ /**
48
+ * Уровень раскрытия дерева по умолчанию, при isInitialExpanded=true
49
+ */
50
+ expandedLevel: number;
51
+ /**
52
+ * Количество отображаемых по умолчанию дочерних элементов
53
+ */
54
+ initialVisibleChildrenCount: number;
55
+ /**
56
+ * Номер колонки, в которой будет расположена кнопка "Показать все"
57
+ * Работает только для `variant="subrows"`
58
+ */
59
+ moreButtonColumnPosition: number;
60
+ /**
61
+ * Если false, кнопка разворачивания элементов не показывается
62
+ * Работает только для `variant="subrows"`
63
+ */
64
+ isVisibleCollapseButton: boolean;
65
+ /**
66
+ * Если true, то будет отображаться чекбокс для выбора элемента
67
+ */
68
+ isSelectable?: boolean;
69
+ /**
70
+ * Флаг выбора текущей строки
71
+ */
72
+ isSelected?: boolean;
73
+ /**
74
+ * Массив выбранных строк
75
+ */
76
+ selectedRows?: TData[];
77
+ /**
78
+ * Заглушка для пустых ячеек (если отсутствует field и filter и renderCell)
79
+ * @default '-'
80
+ */
81
+ emptyCellValue?: ReactNode;
82
+ /**
83
+ * Дополнительные настройки строки
84
+ */
85
+ options?: DataGridRowOptions<TData>;
86
+ /**
87
+ * Обработчик выбора строки
88
+ */
89
+ onSelectRow: (row: TData) => (event: ChangeEvent<HTMLInputElement>) => void;
90
+ /**
91
+ * Обработчик клика строки таблицы
92
+ */
93
+ onRowClick?: (row: TData) => void;
94
+ /**
95
+ * Смещение секции
96
+ */
97
+ sectionOffset?: number;
98
+ /**
99
+ * Общее количество колонок (для правильного определения последней ячейки)
100
+ */
101
+ totalColumnsCount?: number;
102
+ /**
103
+ * Регистрация элемента строки
104
+ */
105
+ registerRowElement?: (rowId: string, el: HTMLElement) => void;
106
+ /**
107
+ * Отмена регистрации элемента строки
108
+ */
109
+ unregisterRowElement?: (rowId: string, el: HTMLElement) => void;
110
+ /**
111
+ * Обработчик наведения на строку
112
+ */
113
+ onRowEnter?: (rowId: string) => void;
114
+ /**
115
+ * Обработчик выхода из строки
116
+ */
117
+ onRowLeave?: (rowId: string, event: PointerEvent) => void;
118
+ };
@@ -0,0 +1 @@
1
+ export {};