@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.
Files changed (241) hide show
  1. package/components/ConfirmDialog/ConfirmDialog.js +2 -2
  2. package/components/ConfirmDialog/types.d.ts +2 -2
  3. package/components/DataGrid/Body/styles.js +4 -0
  4. package/components/DataGrid/Cell/Cell.d.ts +6 -2
  5. package/components/DataGrid/Cell/Cell.js +18 -2
  6. package/components/DataGrid/Cell/constants.d.ts +6 -0
  7. package/components/DataGrid/Cell/constants.js +6 -0
  8. package/components/DataGrid/Cell/index.d.ts +1 -0
  9. package/components/DataGrid/Cell/index.js +1 -0
  10. package/components/DataGrid/Cell/styles.d.ts +1 -8
  11. package/components/DataGrid/Cell/styles.js +43 -8
  12. package/components/DataGrid/DataGrid.js +11 -2
  13. package/components/DataGrid/Head/Head.js +14 -30
  14. package/components/DataGrid/Head/HeadColumns/GroupColumns/GroupColumns.d.ts +14 -0
  15. package/components/DataGrid/Head/HeadColumns/GroupColumns/GroupColumns.js +4 -0
  16. package/components/DataGrid/Head/HeadColumns/GroupColumns/index.d.ts +1 -0
  17. package/components/DataGrid/Head/HeadColumns/GroupColumns/index.js +1 -0
  18. package/components/DataGrid/Head/HeadColumns/HeadCellStartAdornment/HeadCellStartAdornment.d.ts +9 -0
  19. package/components/DataGrid/Head/HeadColumns/HeadCellStartAdornment/HeadCellStartAdornment.js +9 -0
  20. package/components/DataGrid/Head/HeadColumns/HeadCellStartAdornment/index.d.ts +1 -0
  21. package/components/DataGrid/Head/HeadColumns/HeadCellStartAdornment/index.js +1 -0
  22. package/components/DataGrid/Head/HeadColumns/HeadCellStartAdornment/styles.d.ts +5 -0
  23. package/components/DataGrid/Head/HeadColumns/HeadCellStartAdornment/styles.js +9 -0
  24. package/components/DataGrid/Head/HeadColumns/HeadColumns.d.ts +41 -0
  25. package/components/DataGrid/Head/HeadColumns/HeadColumns.js +26 -0
  26. package/components/DataGrid/Head/HeadColumns/SingleColumn/SingleColumn.d.ts +13 -0
  27. package/components/DataGrid/Head/HeadColumns/SingleColumn/SingleColumn.js +3 -0
  28. package/components/DataGrid/Head/HeadColumns/SingleColumn/index.d.ts +1 -0
  29. package/components/DataGrid/Head/HeadColumns/SingleColumn/index.js +1 -0
  30. package/components/DataGrid/Head/HeadColumns/index.d.ts +1 -0
  31. package/components/DataGrid/Head/HeadColumns/index.js +1 -0
  32. package/components/DataGrid/Head/HeadColumns/styles.d.ts +5 -0
  33. package/components/DataGrid/Head/HeadColumns/styles.js +9 -0
  34. package/components/DataGrid/Head/HeadColumns/useLogic/useLogic.d.ts +12 -0
  35. package/components/DataGrid/Head/HeadColumns/useLogic/useLogic.js +46 -0
  36. package/components/DataGrid/Head/HeadColumns/useLogic/utils/getGridPositions/getGridPositions.d.ts +6 -0
  37. package/components/DataGrid/Head/HeadColumns/useLogic/utils/getGridPositions/getGridPositions.js +19 -0
  38. package/components/DataGrid/Head/HeadColumns/useLogic/utils/getGridPositions/index.d.ts +1 -0
  39. package/components/DataGrid/Head/HeadColumns/useLogic/utils/getGridPositions/index.js +1 -0
  40. package/components/DataGrid/Head/HeadColumns/useLogic/utils/index.d.ts +1 -0
  41. package/components/DataGrid/Head/HeadColumns/useLogic/utils/index.js +1 -0
  42. package/components/DataGrid/Head/HeadColumns/utils/getHeadCellProps.d.ts +18 -0
  43. package/components/DataGrid/Head/HeadColumns/utils/getHeadCellProps.js +17 -0
  44. package/components/DataGrid/Head/HeadColumns/utils/index.d.ts +1 -0
  45. package/components/DataGrid/Head/HeadColumns/utils/index.js +1 -0
  46. package/components/DataGrid/Head/styles.d.ts +0 -4
  47. package/components/DataGrid/Head/styles.js +2 -8
  48. package/components/DataGrid/HeadCell/HeadCell.d.ts +11 -0
  49. package/components/DataGrid/HeadCell/HeadCell.js +21 -3
  50. package/components/DataGrid/HeadCell/constants.d.ts +11 -0
  51. package/components/DataGrid/HeadCell/constants.js +12 -0
  52. package/components/DataGrid/HeadCell/index.d.ts +1 -0
  53. package/components/DataGrid/HeadCell/index.js +1 -0
  54. package/components/DataGrid/HeadCell/styles.d.ts +1 -8
  55. package/components/DataGrid/HeadCell/styles.js +24 -7
  56. package/components/DataGrid/HeadCell/useLogic/useLogic.d.ts +5 -5
  57. package/components/DataGrid/HeadCell/useLogic/useLogic.js +8 -5
  58. package/components/DataGrid/PinnedSections/Section/styles.js +4 -0
  59. package/components/DataGrid/PinnedSections/Section/useLogic/useLogic.js +2 -2
  60. package/components/DataGrid/PinnedSections/styles.js +8 -4
  61. package/components/DataGrid/PinnedSections/useLogic/useLogic.js +10 -5
  62. package/components/DataGrid/Row/Row.js +22 -3
  63. package/components/DataGrid/Row/constants.d.ts +8 -0
  64. package/components/DataGrid/Row/constants.js +8 -0
  65. package/components/DataGrid/Row/styles.d.ts +10 -0
  66. package/components/DataGrid/Row/styles.js +15 -2
  67. package/components/DataGrid/constants.d.ts +4 -1
  68. package/components/DataGrid/constants.js +4 -1
  69. package/components/DataGrid/faker.js +13 -9
  70. package/components/DataGrid/index.d.ts +1 -1
  71. package/components/DataGrid/styles.js +84 -2
  72. package/components/DataGrid/types.d.ts +38 -1
  73. package/components/DataGrid/useLogic/hooks/useDataGridMobileLogic/useDataGridMobileLogic.d.ts +2 -2
  74. package/components/DataGrid/useLogic/useLogic.d.ts +3 -1
  75. package/components/DataGrid/useLogic/useLogic.js +10 -6
  76. package/components/DataGrid/useLogic/utils/getColumnSections/getColumnSections.d.ts +1 -1
  77. package/components/DataGrid/useLogic/utils/getColumnSections/getColumnSections.js +17 -10
  78. package/components/DataGrid/utils/getFlattenColumns/getFlattenColumns.d.ts +2 -0
  79. package/components/DataGrid/utils/getFlattenColumns/getFlattenColumns.js +13 -0
  80. package/components/DataGrid/utils/getFlattenColumns/index.d.ts +1 -0
  81. package/components/DataGrid/utils/getFlattenColumns/index.js +1 -0
  82. package/components/DataGrid/utils/index.d.ts +2 -1
  83. package/components/DataGrid/utils/index.js +2 -1
  84. package/components/DataGrid/utils/isGroupColumns/index.d.ts +1 -0
  85. package/components/DataGrid/utils/isGroupColumns/index.js +1 -0
  86. package/components/DataGrid/utils/isGroupColumns/isGroupColumns.d.ts +2 -0
  87. package/components/DataGrid/utils/isGroupColumns/isGroupColumns.js +3 -0
  88. package/components/DataGridInfinite/DataGridInfinite.js +15 -3
  89. package/components/DataGridInfinite/useLogic/useLogic.d.ts +4 -1
  90. package/components/DataGridInfinite/useLogic/useLogic.js +10 -4
  91. package/components/Dialog/Dialog.d.ts +2 -24
  92. package/components/Dialog/Dialog.js +18 -11
  93. package/components/Dialog/constants.d.ts +5 -0
  94. package/components/Dialog/constants.js +6 -0
  95. package/components/Dialog/index.d.ts +2 -1
  96. package/components/Dialog/index.js +1 -1
  97. package/components/Dialog/public.d.ts +2 -1
  98. package/components/Dialog/public.js +1 -1
  99. package/components/Dialog/styles.js +11 -4
  100. package/components/Dialog/types.d.ts +23 -0
  101. package/components/Dialog/types.js +1 -0
  102. package/components/Dialog/useLogic/index.js +1 -0
  103. package/components/Dialog/useLogic/useLogic.d.ts +25 -0
  104. package/components/Dialog/useLogic/useLogic.js +19 -0
  105. package/components/PageLayoutContainer/PageLayoutContainer.js +2 -2
  106. package/components/PageLayoutContainer/styles.d.ts +1 -1
  107. package/components/PageLayoutContainer/styles.js +1 -1
  108. package/components/ResizingDataGrid/hooks/useComputedColumns/useComputedColumns.d.ts +1 -1
  109. package/components/ResizingDataGrid/hooks/useComputedColumns/utils/createComputedColumns/createComputedColumns.d.ts +2 -2
  110. package/components/ResizingDataGrid/types.d.ts +2 -2
  111. package/node/components/ConfirmDialog/ConfirmDialog.js +2 -2
  112. package/node/components/ConfirmDialog/types.d.ts +2 -2
  113. package/node/components/DataGrid/Body/styles.js +4 -0
  114. package/node/components/DataGrid/Cell/Cell.d.ts +6 -2
  115. package/node/components/DataGrid/Cell/Cell.js +18 -2
  116. package/node/components/DataGrid/Cell/constants.d.ts +6 -0
  117. package/node/components/DataGrid/Cell/constants.js +6 -0
  118. package/node/components/DataGrid/Cell/index.d.ts +1 -0
  119. package/node/components/DataGrid/Cell/index.js +3 -0
  120. package/node/components/DataGrid/Cell/styles.d.ts +1 -8
  121. package/node/components/DataGrid/Cell/styles.js +43 -8
  122. package/node/components/DataGrid/DataGrid.js +11 -2
  123. package/node/components/DataGrid/Head/Head.js +12 -28
  124. package/node/components/DataGrid/Head/HeadColumns/GroupColumns/GroupColumns.d.ts +14 -0
  125. package/node/components/DataGrid/Head/HeadColumns/GroupColumns/GroupColumns.js +8 -0
  126. package/node/components/DataGrid/Head/HeadColumns/GroupColumns/index.d.ts +1 -0
  127. package/node/components/DataGrid/{utils/alignToJustifyContent → Head/HeadColumns/GroupColumns}/index.js +1 -1
  128. package/node/components/DataGrid/Head/HeadColumns/HeadCellStartAdornment/HeadCellStartAdornment.d.ts +9 -0
  129. package/node/components/DataGrid/Head/HeadColumns/HeadCellStartAdornment/HeadCellStartAdornment.js +13 -0
  130. package/node/components/DataGrid/Head/HeadColumns/HeadCellStartAdornment/index.d.ts +1 -0
  131. package/node/components/DataGrid/Head/HeadColumns/HeadCellStartAdornment/index.js +17 -0
  132. package/node/components/DataGrid/Head/HeadColumns/HeadCellStartAdornment/styles.d.ts +5 -0
  133. package/node/components/DataGrid/Head/HeadColumns/HeadCellStartAdornment/styles.js +12 -0
  134. package/node/components/DataGrid/Head/HeadColumns/HeadColumns.d.ts +41 -0
  135. package/node/components/DataGrid/Head/HeadColumns/HeadColumns.js +30 -0
  136. package/node/components/DataGrid/Head/HeadColumns/SingleColumn/SingleColumn.d.ts +13 -0
  137. package/node/components/DataGrid/Head/HeadColumns/SingleColumn/SingleColumn.js +7 -0
  138. package/node/components/DataGrid/Head/HeadColumns/SingleColumn/index.d.ts +1 -0
  139. package/node/components/DataGrid/Head/HeadColumns/SingleColumn/index.js +17 -0
  140. package/node/components/DataGrid/Head/HeadColumns/index.d.ts +1 -0
  141. package/node/components/DataGrid/Head/HeadColumns/index.js +17 -0
  142. package/node/components/DataGrid/Head/HeadColumns/styles.d.ts +5 -0
  143. package/node/components/DataGrid/Head/HeadColumns/styles.js +12 -0
  144. package/node/components/DataGrid/Head/HeadColumns/useLogic/index.d.ts +1 -0
  145. package/node/components/DataGrid/Head/HeadColumns/useLogic/useLogic.d.ts +12 -0
  146. package/node/components/DataGrid/Head/{useLogic → HeadColumns/useLogic}/useLogic.js +25 -9
  147. package/node/components/DataGrid/Head/HeadColumns/useLogic/utils/getGridPositions/getGridPositions.d.ts +6 -0
  148. package/node/components/DataGrid/Head/HeadColumns/useLogic/utils/getGridPositions/getGridPositions.js +23 -0
  149. package/node/components/DataGrid/Head/HeadColumns/useLogic/utils/getGridPositions/index.d.ts +1 -0
  150. package/node/components/DataGrid/Head/HeadColumns/useLogic/utils/getGridPositions/index.js +17 -0
  151. package/node/components/DataGrid/Head/HeadColumns/useLogic/utils/index.d.ts +1 -0
  152. package/node/components/DataGrid/Head/HeadColumns/useLogic/utils/index.js +17 -0
  153. package/node/components/DataGrid/Head/HeadColumns/utils/getHeadCellProps.d.ts +18 -0
  154. package/node/components/DataGrid/Head/HeadColumns/utils/getHeadCellProps.js +21 -0
  155. package/node/components/DataGrid/Head/HeadColumns/utils/index.d.ts +1 -0
  156. package/node/components/DataGrid/Head/HeadColumns/utils/index.js +17 -0
  157. package/node/components/DataGrid/Head/styles.d.ts +0 -4
  158. package/node/components/DataGrid/Head/styles.js +3 -9
  159. package/node/components/DataGrid/HeadCell/HeadCell.d.ts +11 -0
  160. package/node/components/DataGrid/HeadCell/HeadCell.js +21 -3
  161. package/node/components/DataGrid/HeadCell/constants.d.ts +11 -0
  162. package/node/components/DataGrid/HeadCell/constants.js +15 -0
  163. package/node/components/DataGrid/HeadCell/index.d.ts +1 -0
  164. package/node/components/DataGrid/HeadCell/index.js +3 -0
  165. package/node/components/DataGrid/HeadCell/styles.d.ts +1 -8
  166. package/node/components/DataGrid/HeadCell/styles.js +24 -7
  167. package/node/components/DataGrid/HeadCell/useLogic/useLogic.d.ts +5 -5
  168. package/node/components/DataGrid/HeadCell/useLogic/useLogic.js +8 -5
  169. package/node/components/DataGrid/PinnedSections/Section/styles.js +4 -0
  170. package/node/components/DataGrid/PinnedSections/Section/useLogic/useLogic.js +1 -1
  171. package/node/components/DataGrid/PinnedSections/styles.js +8 -4
  172. package/node/components/DataGrid/PinnedSections/useLogic/useLogic.js +10 -5
  173. package/node/components/DataGrid/Row/Row.js +21 -2
  174. package/node/components/DataGrid/Row/constants.d.ts +8 -0
  175. package/node/components/DataGrid/Row/constants.js +9 -1
  176. package/node/components/DataGrid/Row/styles.d.ts +10 -0
  177. package/node/components/DataGrid/Row/styles.js +15 -2
  178. package/node/components/DataGrid/constants.d.ts +4 -1
  179. package/node/components/DataGrid/constants.js +4 -1
  180. package/node/components/DataGrid/faker.js +13 -9
  181. package/node/components/DataGrid/index.d.ts +1 -1
  182. package/node/components/DataGrid/styles.js +93 -11
  183. package/node/components/DataGrid/types.d.ts +38 -1
  184. package/node/components/DataGrid/useLogic/hooks/useDataGridMobileLogic/useDataGridMobileLogic.d.ts +2 -2
  185. package/node/components/DataGrid/useLogic/useLogic.d.ts +3 -1
  186. package/node/components/DataGrid/useLogic/useLogic.js +9 -5
  187. package/node/components/DataGrid/useLogic/utils/getColumnSections/getColumnSections.d.ts +1 -1
  188. package/node/components/DataGrid/useLogic/utils/getColumnSections/getColumnSections.js +17 -10
  189. package/node/components/DataGrid/utils/getFlattenColumns/getFlattenColumns.d.ts +2 -0
  190. package/node/components/DataGrid/utils/getFlattenColumns/getFlattenColumns.js +17 -0
  191. package/node/components/DataGrid/utils/getFlattenColumns/index.d.ts +1 -0
  192. package/node/components/DataGrid/utils/getFlattenColumns/index.js +5 -0
  193. package/node/components/DataGrid/utils/index.d.ts +2 -1
  194. package/node/components/DataGrid/utils/index.js +5 -3
  195. package/node/components/DataGrid/utils/isGroupColumns/index.d.ts +1 -0
  196. package/node/components/DataGrid/utils/isGroupColumns/index.js +17 -0
  197. package/node/components/DataGrid/utils/isGroupColumns/isGroupColumns.d.ts +2 -0
  198. package/node/components/DataGrid/utils/isGroupColumns/isGroupColumns.js +7 -0
  199. package/node/components/DataGridInfinite/DataGridInfinite.js +15 -3
  200. package/node/components/DataGridInfinite/useLogic/useLogic.d.ts +4 -1
  201. package/node/components/DataGridInfinite/useLogic/useLogic.js +9 -3
  202. package/node/components/Dialog/Dialog.d.ts +2 -24
  203. package/node/components/Dialog/Dialog.js +18 -11
  204. package/node/components/Dialog/constants.d.ts +5 -0
  205. package/node/components/Dialog/constants.js +7 -1
  206. package/node/components/Dialog/index.d.ts +2 -1
  207. package/node/components/Dialog/index.js +2 -1
  208. package/node/components/Dialog/public.d.ts +2 -1
  209. package/node/components/Dialog/public.js +2 -1
  210. package/node/components/Dialog/styles.js +12 -25
  211. package/node/components/Dialog/types.d.ts +23 -0
  212. package/node/components/Dialog/types.js +2 -0
  213. package/node/components/Dialog/useLogic/index.d.ts +1 -0
  214. package/node/components/Dialog/useLogic/index.js +17 -0
  215. package/node/components/Dialog/useLogic/useLogic.d.ts +25 -0
  216. package/node/components/Dialog/useLogic/useLogic.js +23 -0
  217. package/node/components/PageLayoutContainer/PageLayoutContainer.js +1 -1
  218. package/node/components/PageLayoutContainer/styles.d.ts +1 -1
  219. package/node/components/PageLayoutContainer/styles.js +2 -2
  220. package/node/components/ResizingDataGrid/hooks/useComputedColumns/useComputedColumns.d.ts +1 -1
  221. package/node/components/ResizingDataGrid/hooks/useComputedColumns/utils/createComputedColumns/createComputedColumns.d.ts +2 -2
  222. package/node/components/ResizingDataGrid/types.d.ts +2 -2
  223. package/package.json +1 -1
  224. package/components/DataGrid/Head/useLogic/useLogic.d.ts +0 -12
  225. package/components/DataGrid/Head/useLogic/useLogic.js +0 -30
  226. package/components/DataGrid/utils/alignToJustifyContent/alignToJustifyContent.d.ts +0 -5
  227. package/components/DataGrid/utils/alignToJustifyContent/alignToJustifyContent.js +0 -7
  228. package/components/DataGrid/utils/alignToJustifyContent/constants.d.ts +0 -6
  229. package/components/DataGrid/utils/alignToJustifyContent/constants.js +0 -6
  230. package/components/DataGrid/utils/alignToJustifyContent/index.d.ts +0 -1
  231. package/components/DataGrid/utils/alignToJustifyContent/index.js +0 -1
  232. package/node/components/DataGrid/Head/useLogic/useLogic.d.ts +0 -12
  233. package/node/components/DataGrid/utils/alignToJustifyContent/alignToJustifyContent.d.ts +0 -5
  234. package/node/components/DataGrid/utils/alignToJustifyContent/alignToJustifyContent.js +0 -11
  235. package/node/components/DataGrid/utils/alignToJustifyContent/constants.d.ts +0 -6
  236. package/node/components/DataGrid/utils/alignToJustifyContent/constants.js +0 -9
  237. package/node/components/DataGrid/utils/alignToJustifyContent/index.d.ts +0 -1
  238. /package/components/DataGrid/Head/{useLogic → HeadColumns/useLogic}/index.d.ts +0 -0
  239. /package/components/DataGrid/Head/{useLogic → HeadColumns/useLogic}/index.js +0 -0
  240. /package/{node/components/DataGrid/Head → components/Dialog}/useLogic/index.d.ts +0 -0
  241. /package/node/components/DataGrid/Head/{useLogic → HeadColumns/useLogic}/index.js +0 -0
@@ -1,2 +1,2 @@
1
- export { DIALOG_SIZES } from './constants';
1
+ export { DIALOG_SIZES, dialogClassnames } from './constants';
2
2
  export * from './Dialog';
@@ -1,19 +1,26 @@
1
1
  import { backdropClasses } from '@mui/material/Backdrop';
2
- import MuiDialog, { dialogClasses } from '@mui/material/Dialog';
2
+ import MuiDialog from '@mui/material/Dialog';
3
3
  import { dialogActionsClassnames } from '../DialogActions';
4
4
  import { dialogContentClassnames } from '../DialogContent';
5
5
  import { styled } from '../styled';
6
- import { DIALOG_SIZES } from './constants';
6
+ import { DIALOG_SIZES, dialogClassnames } from './constants';
7
7
  const getSize = (size) => {
8
8
  return DIALOG_SIZES[size] || DIALOG_SIZES.md;
9
9
  };
10
10
  export const StyledDialog = styled(MuiDialog, {
11
11
  shouldForwardProp: (prop) => !['$size'].includes(prop),
12
12
  }) `
13
- &.${dialogClasses.root} .${backdropClasses.root} {
13
+ &.${dialogClassnames.root} .${backdropClasses.root} {
14
14
  background-color: ${({ theme }) => theme.palette.background.modalShadow};
15
15
  }
16
- .${dialogClasses.paper} {
16
+
17
+ &.${dialogClassnames.withoutTitle} {
18
+ & .${dialogContentClassnames.root} {
19
+ padding-top: ${({ theme }) => theme.spacing(6)};
20
+ }
21
+ }
22
+
23
+ .${dialogClassnames.paper} {
17
24
  min-width: ${({ $size }) => getSize($size).minWidth};
18
25
  max-width: ${({ $size }) => getSize($size).maxWidth};
19
26
 
@@ -0,0 +1,23 @@
1
+ import type { DialogProps as MuiDialogProps } from '@mui/material/Dialog';
2
+ import { type ReactElement, type ReactNode } from 'react';
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
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export * from './useLogic';
@@ -0,0 +1,25 @@
1
+ import { type MouseEvent } from 'react';
2
+ import { type DialogProps } from '../types';
3
+ type UseLogicParams = Pick<DialogProps, 'onClose' | 'disableBackdropClick' | 'classes'>;
4
+ export declare const useLogic: ({ onClose, disableBackdropClick, classes, }: UseLogicParams) => {
5
+ handleClose: ((event: MouseEvent<HTMLButtonElement>, reason: 'backdropClick' | 'escapeKeyDown') => void) | undefined;
6
+ isMobile: boolean;
7
+ dialogClasses: {
8
+ root?: string | undefined;
9
+ scrollPaper?: string | undefined;
10
+ scrollBody?: string | undefined;
11
+ container?: string | undefined;
12
+ paperScrollPaper?: string | undefined;
13
+ paperScrollBody?: string | undefined;
14
+ paperWidthFalse?: string | undefined;
15
+ paperWidthXs?: string | undefined;
16
+ paperWidthSm?: string | undefined;
17
+ paperWidthMd?: string | undefined;
18
+ paperWidthLg?: string | undefined;
19
+ paperWidthXl?: string | undefined;
20
+ paperFullWidth?: string | undefined;
21
+ paperFullScreen?: string | undefined;
22
+ paper: string;
23
+ };
24
+ };
25
+ export {};
@@ -0,0 +1,19 @@
1
+ import { useViewportType } from '../../useViewportType';
2
+ import { classNames } from '../../utils/classNames';
3
+ import { dialogClassnames } from '../constants';
4
+ export const useLogic = ({ onClose, disableBackdropClick, classes, }) => {
5
+ const { isMobile } = useViewportType();
6
+ const handleClose = onClose &&
7
+ ((event, reason) => {
8
+ if (disableBackdropClick && reason === 'backdropClick') {
9
+ return;
10
+ }
11
+ onClose(event, reason);
12
+ });
13
+ const { paper, ...restClasses } = classes || {};
14
+ const dialogClasses = {
15
+ paper: classNames(dialogClassnames.paper, paper),
16
+ ...restClasses,
17
+ };
18
+ return { handleClose, isMobile, dialogClasses };
19
+ };
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from 'react';
3
3
  import { classNames } from '../utils/classNames';
4
4
  import { pageLayoutClassnames } from './constants';
5
- import { StylePaper, Wrapper } from './styles';
5
+ import { StyledPaper, Wrapper } from './styles';
6
6
  export const PageLayoutContainer = forwardRef(({ children, className }, forwardedRef) => {
7
- return (_jsx(StylePaper, { variant: "outlined", children: _jsx(Wrapper, { className: classNames(className, pageLayoutClassnames.root), ref: forwardedRef, children: children }) }));
7
+ return (_jsx(StyledPaper, { variant: "outlined", children: _jsx(Wrapper, { className: classNames(className, pageLayoutClassnames.root), ref: forwardedRef, children: children }) }));
8
8
  });
@@ -3,6 +3,6 @@ export declare const Wrapper: import("../styled").StyledComponent<{
3
3
  theme?: import("@emotion/react").Theme | undefined;
4
4
  as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
5
5
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
6
- export declare const StylePaper: import("../styled").StyledComponent<Omit<import("../Paper").PaperProps, "ref"> & import("react").RefAttributes<HTMLDivElement> & {
6
+ export declare const StyledPaper: import("../styled").StyledComponent<Omit<import("../Paper").PaperProps, "ref"> & import("react").RefAttributes<HTMLDivElement> & {
7
7
  theme?: import("@emotion/react").Theme | undefined;
8
8
  }, {}, {}>;
@@ -35,7 +35,7 @@ export const Wrapper = styled.div `
35
35
  border: unset;
36
36
  }
37
37
  `;
38
- export const StylePaper = styled(Paper) `
38
+ export const StyledPaper = styled(Paper) `
39
39
  height: 100%;
40
40
 
41
41
  ${({ theme }) => theme.breakpoints.down('sm')} {
@@ -7,6 +7,6 @@ import type { ResizingColumns } from '../../types';
7
7
  export declare const useComputedColumns: <TData extends DataGridRow = DataGridRow>(columns: ResizingColumns<TData>, storage?: Storage) => {
8
8
  columnsWidths: any[];
9
9
  setColumnsWidths: import("react").Dispatch<import("react").SetStateAction<any[]>>;
10
- computedColumns: import("../../../DataGrid").DataGridColumns<TData>[];
10
+ computedColumns: import("../../../DataGrid").DataGridSingleColumn<TData>[];
11
11
  actionsColumnWidth: string | undefined;
12
12
  };
@@ -1,7 +1,7 @@
1
- import { type DataGridColumns, type DataGridRow } from '../../../../../DataGrid';
1
+ import { type DataGridRow, type DataGridSingleColumn } from '../../../../../DataGrid';
2
2
  import { type ResizingColumns } from '../../../../types';
3
3
  type CreateComputedColumnsResult<TData extends DataGridRow = DataGridRow> = {
4
- computedColumns: DataGridColumns<TData>[];
4
+ computedColumns: DataGridSingleColumn<TData>[];
5
5
  actionsColumnWidth?: string;
6
6
  };
7
7
  /**
@@ -1,6 +1,6 @@
1
- import type { DataGridColumns, DataGridProps, DataGridRow } from '../DataGrid';
1
+ import type { DataGridProps, DataGridRow, DataGridSingleColumn } from '../DataGrid';
2
2
  import { type CellValue } from '../DataGrid/types';
3
- type OmittedColumn<TData extends Record<string, CellValue>> = Omit<DataGridColumns<TData>, 'field' | 'width' | 'minWidth'>;
3
+ type OmittedColumn<TData extends Record<string, CellValue>> = Omit<DataGridSingleColumn<TData>, 'field' | 'width' | 'minWidth'>;
4
4
  type CommonColumn<TData extends Record<string, CellValue>> = OmittedColumn<TData> & {
5
5
  /**
6
6
  * Значение ключа поля данных для колонки
@@ -11,9 +11,9 @@ const styles_1 = require("./styles");
11
11
  const useLogic_1 = require("./useLogic");
12
12
  const ConfirmDialog = (props) => {
13
13
  const { isShowCancelButton, cancelButtonProps } = (0, useLogic_1.useLogic)(props);
14
- const { open, title, description, actions, onClose, ...restProps } = props;
14
+ const { open, title, description, actions, onClose, size = 'sm', ...restProps } = props;
15
15
  const { text: confirmText, ...confirmButtonProps } = actions.confirm;
16
16
  const { text: cancelText, variant, onClick, ...restCancelProps } = actions.cancel || {};
17
- return ((0, jsx_runtime_1.jsxs)(Dialog_1.Dialog, { size: "sm", title: title, open: open, onClose: onClose, ...restProps, children: [description && ((0, jsx_runtime_1.jsx)(DialogContent_1.DialogContent, { children: typeof description === 'string' ? ((0, jsx_runtime_1.jsx)(DialogContentText_1.DialogContentText, { children: description })) : (description) })), (0, jsx_runtime_1.jsxs)(DialogActions_1.DialogActions, { children: [isShowCancelButton && ((0, jsx_runtime_1.jsx)(styles_1.CancelButton, { ...restCancelProps, ...cancelButtonProps, children: cancelText })), (0, jsx_runtime_1.jsx)(Button_1.Button, { ...confirmButtonProps, children: confirmText })] })] }));
17
+ return ((0, jsx_runtime_1.jsxs)(Dialog_1.Dialog, { size: size, title: title, open: open, onClose: onClose, ...restProps, children: [description && ((0, jsx_runtime_1.jsx)(DialogContent_1.DialogContent, { children: typeof description === 'string' ? ((0, jsx_runtime_1.jsx)(DialogContentText_1.DialogContentText, { children: description })) : (description) })), (0, jsx_runtime_1.jsxs)(DialogActions_1.DialogActions, { children: [isShowCancelButton && ((0, jsx_runtime_1.jsx)(styles_1.CancelButton, { ...restCancelProps, ...cancelButtonProps, children: cancelText })), (0, jsx_runtime_1.jsx)(Button_1.Button, { ...confirmButtonProps, children: confirmText })] })] }));
18
18
  };
19
19
  exports.ConfirmDialog = ConfirmDialog;
@@ -5,7 +5,7 @@ export type ConfirmDialogProps = {
5
5
  /**
6
6
  * Заголовок диалога
7
7
  */
8
- title: string;
8
+ title?: string;
9
9
  /**
10
10
  * Вспомогательный текст
11
11
  */
@@ -33,4 +33,4 @@ export type ConfirmDialogProps = {
33
33
  text: string;
34
34
  };
35
35
  };
36
- } & Pick<DialogProps, 'aria-labelledby' | 'aria-describedby' | 'disableBackdropClick' | 'disablePortal' | 'disableScrollLock' | 'hideBackdrop' | 'keepMounted' | 'open'>;
36
+ } & Pick<DialogProps, 'aria-labelledby' | 'aria-describedby' | 'disableBackdropClick' | 'disablePortal' | 'disableScrollLock' | 'hideBackdrop' | 'keepMounted' | 'open' | 'size'>;
@@ -7,6 +7,8 @@ const constants_2 = require("./constants");
7
7
  exports.Wrapper = styled_1.styled.ul `
8
8
  --min-display-rows: 0;
9
9
 
10
+ scrollbar-gutter: stable;
11
+
10
12
  overflow-y: auto;
11
13
 
12
14
  width: fit-content;
@@ -28,6 +30,8 @@ exports.Wrapper = styled_1.styled.ul `
28
30
  }
29
31
 
30
32
  ${({ theme }) => theme.breakpoints.down('sm')} {
33
+ scrollbar-gutter: unset;
34
+
31
35
  overflow: initial;
32
36
 
33
37
  width: 100%;
@@ -1,5 +1,5 @@
1
1
  import { type ReactNode } from 'react';
2
- import type { CellValue, DataGridColumns } from '../types';
2
+ import type { CellValue, DataGridSingleColumn } from '../types';
3
3
  export type CellProps<TData extends Record<string, CellValue>> = {
4
4
  /**
5
5
  * Название класса, применяется к корневому компоненту
@@ -9,7 +9,7 @@ export type CellProps<TData extends Record<string, CellValue>> = {
9
9
  * Данные строки для отображения
10
10
  */
11
11
  row: TData;
12
- cell: DataGridColumns<TData>;
12
+ cell: DataGridSingleColumn<TData>;
13
13
  /**
14
14
  * Дополнительное содержимое ячейки, которое будет распложено справа
15
15
  */
@@ -26,5 +26,9 @@ export type CellProps<TData extends Record<string, CellValue>> = {
26
26
  * Скрытие персональных данных от инструментов мониторинга
27
27
  */
28
28
  isHidePersonalData?: boolean;
29
+ /**
30
+ * Скрытие ячейки на мобильных устройствах
31
+ */
32
+ isHideOnMobile?: boolean;
29
33
  };
30
34
  export declare const Cell: <TData extends Record<string, unknown>>(props: CellProps<TData>) => import("react/jsx-runtime").JSX.Element;
@@ -15,6 +15,17 @@ const cellCva = (0, cva_1.cva)(constants_1.dataGridCellClassnames.root, {
15
15
  isHideOnMobile: {
16
16
  true: constants_1.dataGridCellClassnames.isHideOnMobile,
17
17
  },
18
+ isDisabled: {
19
+ true: constants_1.dataGridCellClassnames.disabled,
20
+ },
21
+ withStartAdornment: {
22
+ true: constants_1.dataGridCellClassnames.withStartAdornment,
23
+ },
24
+ align: {
25
+ left: constants_1.dataGridCellClassnames.alignLeft,
26
+ center: constants_1.dataGridCellClassnames.alignCenter,
27
+ right: constants_1.dataGridCellClassnames.alignRight,
28
+ },
18
29
  },
19
30
  });
20
31
  const cellContentCva = (0, cva_1.cva)(constants_1.dataGridCellClassnames.cellContent, {
@@ -33,12 +44,17 @@ const columnLabelCva = (0, cva_1.cva)(constants_1.dataGridCellClassnames.columnL
33
44
  });
34
45
  const Cell = (props) => {
35
46
  const { formattedValue, hasStartAdornment, isActionColumn, label, hideTitleOnMobile, } = (0, useLogic_1.useLogic)(props);
36
- const { className, startAdornment, row, cell, isDisabled, isHidePersonalData, } = props;
47
+ const { className, startAdornment, row, cell, isDisabled, isHidePersonalData, isHideOnMobile, } = props;
37
48
  const { renderCell, align = 'left' } = cell;
38
49
  const hidePersonalDataClassname = (0, personalDataSecurity_1.useHidePersonalData)({
39
50
  isEnabled: isHidePersonalData === true,
40
51
  });
41
- return ((0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { "$isDisabled": isDisabled, "$align": align, "$hasStartAdornment": hasStartAdornment, className: (0, classNames_1.classNames)(className, hidePersonalDataClassname, cellCva({ isHideOnMobile: cell.isHideOnMobile })), ...(0, getInertProps_1.getInertProps)(isDisabled), children: [startAdornment && startAdornment, (0, jsx_runtime_1.jsxs)(styles_1.CellContent, { className: cellContentCva({ isActionColumn }), children: [(0, jsx_runtime_1.jsx)(styles_1.ColumnLabel, { variant: "caption", color: "textSecondary", className: columnLabelCva({
52
+ return ((0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { className: (0, classNames_1.classNames)(className, hidePersonalDataClassname, cellCva({
53
+ isHideOnMobile: cell.isHideOnMobile || isHideOnMobile,
54
+ isDisabled,
55
+ withStartAdornment: hasStartAdornment,
56
+ align,
57
+ })), ...(0, getInertProps_1.getInertProps)(isDisabled), children: [startAdornment && startAdornment, (0, jsx_runtime_1.jsxs)(styles_1.CellContent, { className: cellContentCva({ isActionColumn }), children: [(0, jsx_runtime_1.jsx)(styles_1.ColumnLabel, { variant: "caption", color: "textSecondary", className: columnLabelCva({
42
58
  hidden: hideTitleOnMobile || isActionColumn,
43
59
  }), children: label }), renderCell?.(row), !renderCell && ((0, jsx_runtime_1.jsx)(OverflowTypography_1.OverflowTypography, { rowsCount: 2, tooltipProps: { className: hidePersonalDataClassname }, children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: formattedValue }) }))] })] }));
44
60
  };
@@ -5,4 +5,10 @@ export declare const dataGridCellClassnames: {
5
5
  columnLabelHidden: string;
6
6
  actionColumn: string;
7
7
  cellContent: string;
8
+ disabled: string;
9
+ withStartAdornment: string;
10
+ alignLeft: string;
11
+ alignCenter: string;
12
+ alignRight: string;
13
+ grouped: string;
8
14
  };
@@ -9,4 +9,10 @@ exports.dataGridCellClassnames = {
9
9
  columnLabelHidden: (0, createUIKitClassname_1.createUIKitClassname)('data-grid__cell-column-label_hidden'),
10
10
  actionColumn: (0, createUIKitClassname_1.createUIKitClassname)('data-grid__cell_action-column'),
11
11
  cellContent: (0, createUIKitClassname_1.createUIKitClassname)('data-grid__cell-content'),
12
+ disabled: (0, createUIKitClassname_1.createUIKitClassname)('data-grid__cell_disabled'),
13
+ withStartAdornment: (0, createUIKitClassname_1.createUIKitClassname)('data-grid__cell_with-start-adornment'),
14
+ alignLeft: (0, createUIKitClassname_1.createUIKitClassname)('data-grid__cell_align-left'),
15
+ alignCenter: (0, createUIKitClassname_1.createUIKitClassname)('data-grid__cell_align-center'),
16
+ alignRight: (0, createUIKitClassname_1.createUIKitClassname)('data-grid__cell_align-right'),
17
+ grouped: (0, createUIKitClassname_1.createUIKitClassname)('data-grid__cell_grouped'),
12
18
  };
@@ -1 +1,2 @@
1
1
  export * from './Cell';
2
+ export { dataGridCellClassnames } from './constants';
@@ -14,4 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.dataGridCellClassnames = void 0;
17
18
  __exportStar(require("./Cell"), exports);
19
+ var constants_1 = require("./constants");
20
+ Object.defineProperty(exports, "dataGridCellClassnames", { enumerable: true, get: function () { return constants_1.dataGridCellClassnames; } });
@@ -1,14 +1,8 @@
1
1
  /// <reference types="react" />
2
- import type { AlignVariant } from '../types';
3
- type HeadCellProps = {
4
- $align?: AlignVariant;
5
- $isDisabled?: boolean;
6
- $hasStartAdornment?: boolean;
7
- };
8
2
  export declare const Wrapper: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
9
3
  theme?: import("@emotion/react").Theme | undefined;
10
4
  as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
11
- } & HeadCellProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
5
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
12
6
  export declare const ColumnLabel: import("@emotion/styled/dist/declarations/src/types").StyledComponent<import("../../Typography/types").TypographyPropsBase & {
13
7
  color?: import("../../Typography").TypographyColor | undefined;
14
8
  variant?: import("../../Typography").TypographyVariant | undefined;
@@ -23,4 +17,3 @@ export declare const CellContent: import("@emotion/styled/dist/declarations/src/
23
17
  theme?: import("@emotion/react").Theme | undefined;
24
18
  as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
25
19
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
26
- export {};
@@ -5,36 +5,71 @@ const styled_1 = require("../../styled");
5
5
  const Typography_1 = require("../../Typography");
6
6
  const constants_1 = require("../constants");
7
7
  const constants_2 = require("../Row/constants");
8
- const utils_1 = require("../utils");
9
8
  const constants_3 = require("./constants");
10
- exports.Wrapper = (0, styled_1.styled)('div', {
11
- shouldForwardProp: (prop) => !['$align', '$isDisabled', '$hasStartAdornment'].includes(prop),
12
- }) `
9
+ exports.Wrapper = styled_1.styled.div `
13
10
  overflow: hidden;
14
11
  display: flex;
15
12
  align-items: center;
16
- justify-content: ${({ $align }) => (0, utils_1.alignToJustifyContent)($align)};
17
13
 
18
14
  min-height: ${constants_1.MIN_ROW_HEIGHT}px;
19
- padding: ${({ theme, $hasStartAdornment }) => $hasStartAdornment ? theme.spacing(1, 2, 1, 0) : theme.spacing(1, 2)};
15
+ padding: ${({ theme }) => theme.spacing(1, 2)};
20
16
 
21
- opacity: ${({ $isDisabled }) => ($isDisabled ? 0.5 : 1)};
17
+ &.${constants_3.dataGridCellClassnames.disabled} {
18
+ opacity: 0.5;
19
+ }
20
+
21
+ &.${constants_3.dataGridCellClassnames.withStartAdornment} {
22
+ padding: ${({ theme }) => theme.spacing(1, 2, 1, 0)};
23
+ }
24
+
25
+ &.${constants_3.dataGridCellClassnames.alignLeft} {
26
+ justify-content: flex-start;
27
+ }
28
+
29
+ &.${constants_3.dataGridCellClassnames.alignCenter} {
30
+ justify-content: center;
31
+ }
32
+
33
+ &.${constants_3.dataGridCellClassnames.alignRight} {
34
+ justify-content: flex-end;
35
+ }
22
36
 
23
37
  ${({ theme }) => theme.breakpoints.down('sm')} {
24
38
  justify-content: space-between;
25
39
 
26
40
  min-height: unset;
41
+ margin-top: ${({ theme }) => theme.spacing(3)};
27
42
  padding: 0;
28
43
 
29
44
  &.${constants_3.dataGridCellClassnames.isHideOnMobile} {
30
45
  display: none;
31
46
  }
32
47
 
33
-
34
48
  & .${constants_2.dataGridRowClassnames.checkbox} {
35
49
  align-self: flex-start;
36
50
  order: 1;
37
51
  }
52
+
53
+ &.${constants_3.dataGridCellClassnames.grouped} {
54
+ margin-top: ${({ theme }) => theme.spacing(1)};
55
+
56
+ & .${constants_3.dataGridCellClassnames.cellContent} {
57
+ flex-direction: row;
58
+ gap: ${({ theme }) => theme.spacing(2)};
59
+ align-items: baseline;
60
+
61
+ & .${constants_3.dataGridCellClassnames.columnLabel} {
62
+ /* Декоративный разделитель между названием колонки и значением */
63
+ &::after {
64
+ content: ':';
65
+ }
66
+ }
67
+ }
68
+ }
69
+
70
+ &:first-of-type {
71
+ margin-top: 0;
72
+ }
38
73
  }
39
74
  `;
40
75
  exports.ColumnLabel = (0, styled_1.styled)(Typography_1.Typography) `
@@ -29,11 +29,18 @@ const pinnedSectionsCva = (0, cva_1.cva)(constants_1.dataGridClassnames.pinnedSe
29
29
  const dataGridCva = (0, cva_1.cva)(constants_1.dataGridClassnames.root, {
30
30
  variants: {
31
31
  hasPinnedColumns: {
32
- true: constants_1.dataGridClassnames.dataGridHasPinnedSections,
32
+ true: constants_1.dataGridClassnames.hasPinnedSections,
33
33
  },
34
34
  isAllowHorizontalScroll: {
35
35
  true: constants_1.dataGridClassnames.isAllowHorizontalScroll,
36
36
  },
37
+ gridViewMode: {
38
+ full: constants_1.dataGridClassnames.gridViewFull,
39
+ standard: constants_1.dataGridClassnames.gridViewStandard,
40
+ },
41
+ hasGroupedColumns: {
42
+ true: constants_1.dataGridClassnames.hasGroupedColumns,
43
+ },
37
44
  },
38
45
  });
39
46
  const bodyCva = (0, cva_1.cva)(constants_1.dataGridClassnames.body, {
@@ -44,7 +51,7 @@ const bodyCva = (0, cva_1.cva)(constants_1.dataGridClassnames.body, {
44
51
  },
45
52
  });
46
53
  const DataGrid = (props) => {
47
- const { dataGridClassName, isDataGridDisabled, treeRenderConfig, headColumns, headProps, bodyProps, gridColumns, loaderProps, renderRows, isAllowHorizontalScroll, isHideHead, hasPinnedColumns, contentStateProps, rowHoverProps, containerRef, sections, isNoData, isMobile, mobileSkeletonProps, isLoading, containerCssVars, } = (0, useLogic_1.useLogic)(props);
54
+ const { dataGridClassName, isDataGridDisabled, treeRenderConfig, headColumns, headProps, bodyProps, gridColumns, loaderProps, renderRows, isAllowHorizontalScroll, isHideHead, hasPinnedColumns, contentStateProps, rowHoverProps, containerRef, sections, isNoData, isMobile, mobileSkeletonProps, isLoading, containerCssVars, hasGroupedColumns, gridViewMode, } = (0, useLogic_1.useLogic)(props);
48
55
  const { emptySymbol } = (0, react_1.useContext)(ConfigProvider_1.ConfigContext);
49
56
  const { columns, selectedRows = [], minDisplayRows = constants_1.MIN_DISPLAY_ROWS_BY_DEFAULT, variant = enums_1.Variant.Tree, footer, noDataPlaceholder, subrows, keyId, activeRowId, emptyCellValue = emptySymbol, onRowClick, noDataOptions, headPreAddon, } = props;
50
57
  const { moreButtonColumnPosition = 1, isVisibleCollapseButton = true } = subrows || {};
@@ -89,6 +96,8 @@ const DataGrid = (props) => {
89
96
  return ((0, jsx_runtime_1.jsx)(DataGridContext_1.DataGridContextProvider, { isLoading: isLoading, children: (0, jsx_runtime_1.jsxs)(styles_1.Container, { ref: containerRef, style: containerCssVars, className: (0, classNames_1.classNames)(dataGridClassName, dataGridCva({
90
97
  isAllowHorizontalScroll,
91
98
  hasPinnedColumns,
99
+ gridViewMode,
100
+ hasGroupedColumns,
92
101
  })), children: [renderTableContent(), (0, jsx_runtime_1.jsx)(Loader_1.Loader, { ...loaderProps }), footer && footer] }) }));
93
102
  };
94
103
  exports.DataGrid = DataGrid;
@@ -2,36 +2,20 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Head = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const Checkbox_1 = require("../../Checkbox");
5
+ const cva_1 = require("../../utils/cva");
7
6
  const constants_1 = require("../constants");
8
- const HeadCell_1 = require("../HeadCell");
7
+ const utils_1 = require("../utils");
8
+ const HeadColumns_1 = require("./HeadColumns/HeadColumns");
9
9
  const styles_1 = require("./styles");
10
- const useLogic_1 = require("./useLogic");
10
+ const headerCva = (0, cva_1.cva)(constants_1.dataGridClassnames.header, {
11
+ variants: {
12
+ isGroup: {
13
+ true: constants_1.dataGridClassnames.hasGroupedColumns,
14
+ },
15
+ },
16
+ });
11
17
  const Head = (props) => {
12
- const { checkboxProps, handleSort } = (0, useLogic_1.useLogic)(props);
13
- const { columns, gridColumns, isSelectable, sorting, onSelectAllRows, isHideSelectAll, sectionOffset, } = props;
14
- const renderColumns = (0, react_1.useMemo)(() => {
15
- return columns.map(({ field, label, sortable, align, columnHint }, index) => {
16
- const globalIndex = (sectionOffset ?? 0) + index;
17
- const isFirstCell = globalIndex === 0;
18
- const startAdornmentRender = () => {
19
- const showCheckbox = isFirstCell && isSelectable && !isHideSelectAll;
20
- if (!showCheckbox && !columnHint) {
21
- return null;
22
- }
23
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [showCheckbox && ((0, jsx_runtime_1.jsx)(styles_1.CheckboxCell, { children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { ...checkboxProps, onChange: onSelectAllRows }) })), columnHint] }));
24
- };
25
- return ((0, jsx_runtime_1.jsx)(HeadCell_1.HeadCell, { sorting: sorting, field: field, label: label, isSortable: sortable, align: align, startAdornment: startAdornmentRender(), onSort: handleSort }, label));
26
- });
27
- }, [
28
- columns,
29
- sorting,
30
- isSelectable,
31
- checkboxProps,
32
- onSelectAllRows,
33
- handleSort,
34
- ]);
35
- return ((0, jsx_runtime_1.jsx)(styles_1.Wrapper, { role: "heading", className: constants_1.dataGridClassnames.header, "$gridColumns": gridColumns, children: renderColumns }));
18
+ const { columns, gridColumns } = props;
19
+ return ((0, jsx_runtime_1.jsx)(styles_1.Wrapper, { role: "heading", className: headerCva({ isGroup: columns.some(utils_1.isGroupColumns) }), "$gridColumns": gridColumns, children: (0, jsx_runtime_1.jsx)(HeadColumns_1.HeadColumns, { ...props }) }));
36
20
  };
37
21
  exports.Head = Head;
@@ -0,0 +1,14 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type CellValue, type DataGridGroupColumn, type DataGridRow, type DataGridSort } from '../../../types';
3
+ type GroupColumnsProps<TData extends Record<string, CellValue> = DataGridRow, TSortField extends keyof TData = keyof TData> = {
4
+ column: DataGridGroupColumn<TData>;
5
+ sorting?: DataGridSort<TSortField>;
6
+ onSort: (field: TSortField) => void;
7
+ gridPosition?: {
8
+ start: number;
9
+ end: number;
10
+ };
11
+ startAdornment?: ReactNode;
12
+ };
13
+ export declare const GroupColumns: <TData extends Record<string, unknown>, TSortField extends keyof TData>({ column, sorting, onSort, gridPosition, startAdornment, }: GroupColumnsProps<TData, TSortField>) => import("react/jsx-runtime").JSX.Element;
14
+ export {};
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GroupColumns = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const HeadCell_1 = require("../../../HeadCell");
7
+ const GroupColumns = ({ column, sorting, onSort, gridPosition, startAdornment, }) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(HeadCell_1.HeadCell, { sorting: sorting, label: column.label, onSort: onSort, className: HeadCell_1.headCellClassnames.groupParent, gridPosition: gridPosition, startAdornment: startAdornment }), column.children.map((child) => ((0, jsx_runtime_1.jsx)(HeadCell_1.HeadCell, { ...child, onSort: onSort, className: HeadCell_1.headCellClassnames.groupChild, startAdornment: child.columnHint }, child.label)))] }, column.label));
8
+ exports.GroupColumns = GroupColumns;
@@ -0,0 +1 @@
1
+ export * from './GroupColumns';
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./alignToJustifyContent"), exports);
17
+ __exportStar(require("./GroupColumns"), exports);
@@ -0,0 +1,9 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type CheckboxProps } from '../../../../Checkbox';
3
+ type HeadCellStartAdornmentProps = {
4
+ showCheckbox: boolean;
5
+ columnHint?: ReactNode;
6
+ checkboxProps: CheckboxProps;
7
+ };
8
+ export declare const HeadCellStartAdornment: ({ showCheckbox, columnHint, checkboxProps, }: HeadCellStartAdornmentProps) => import("react/jsx-runtime").JSX.Element | null;
9
+ export {};
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HeadCellStartAdornment = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const Checkbox_1 = require("../../../../Checkbox");
6
+ const styles_1 = require("./styles");
7
+ const HeadCellStartAdornment = ({ showCheckbox, columnHint, checkboxProps, }) => {
8
+ if (!showCheckbox && !columnHint) {
9
+ return null;
10
+ }
11
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [showCheckbox && ((0, jsx_runtime_1.jsx)(styles_1.CheckboxCell, { children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { ...checkboxProps }) })), columnHint] }));
12
+ };
13
+ exports.HeadCellStartAdornment = HeadCellStartAdornment;
@@ -0,0 +1 @@
1
+ export * from './HeadCellStartAdornment';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./HeadCellStartAdornment"), exports);
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export declare const CheckboxCell: import("@emotion/styled/dist/declarations/src/types").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,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CheckboxCell = void 0;
4
+ const styled_1 = require("../../../../styled");
5
+ const constants_1 = require("../../../constants");
6
+ exports.CheckboxCell = styled_1.styled.div `
7
+ display: flex;
8
+ align-items: center;
9
+ justify-content: center;
10
+
11
+ width: ${constants_1.ROOT_ACTION_CELL_WIDTH}px;
12
+ `;