@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
@@ -1,44 +1,2 @@
1
- import { type ReactNode } from 'react';
2
- type ItemStatus = 'success' | 'reject' | 'default' | 'loading';
3
- type BackgroundColor = 'grey' | 'primary';
4
- type Variant = 'plain' | 'contained';
5
- export type ComplianceStatusItem = {
6
- /**
7
- * Текст для отображения в элементе списка
8
- */
9
- text: ReactNode;
10
- /**
11
- * Статус элемента
12
- */
13
- status: ItemStatus;
14
- };
15
- export type ComplianceStatusProps = {
16
- /**
17
- * Основной заголовок элемента
18
- */
19
- title?: string | null;
20
- /**
21
- * Пропс для добавления контента между заголовком и списком
22
- */
23
- subtitle?: ReactNode;
24
- /**
25
- * Пропс для добавления контента после списка
26
- */
27
- children?: ReactNode;
28
- /**
29
- * Элементы списка
30
- */
31
- itemsList: ComplianceStatusItem[];
32
- /**
33
- * Фоновый цвет
34
- * @default grey
35
- */
36
- backgroundColor?: BackgroundColor;
37
- /**
38
- * Вариант отображения блока статусов
39
- * @default contained
40
- */
41
- variant?: Variant;
42
- };
1
+ import type { ComplianceStatusProps } from './types';
43
2
  export declare const ComplianceStatus: ({ title, itemsList, children, subtitle, backgroundColor, variant, }: ComplianceStatusProps) => import("react/jsx-runtime").JSX.Element;
44
- export {};
@@ -1,6 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cva } from 'class-variance-authority';
2
3
  import { OverflowTypography } from '../OverflowTypography';
3
4
  import { Typography } from '../Typography';
5
+ import { complianceStatusClassnames, complianceStatusColorClassnames, complianceStatusVariantClassnames, } from './constants';
4
6
  import { EmptyIcon, Inner, Item, RejectIcon, StyledLoader, SuccessIcon, Wrapper, } from './styles';
5
7
  const ICON_BY_STATUS = {
6
8
  default: _jsx(EmptyIcon, {}),
@@ -8,8 +10,21 @@ const ICON_BY_STATUS = {
8
10
  reject: _jsx(RejectIcon, {}),
9
11
  loading: _jsx(StyledLoader, {}),
10
12
  };
13
+ const complianceStatus = cva(complianceStatusClassnames.root, {
14
+ variants: {
15
+ backgroundColor: {
16
+ grey: complianceStatusColorClassnames.grey,
17
+ primary: complianceStatusColorClassnames.primary,
18
+ },
19
+ variant: {
20
+ contained: complianceStatusVariantClassnames.contained,
21
+ outlined: complianceStatusVariantClassnames.outlined,
22
+ plain: complianceStatusVariantClassnames.plain,
23
+ },
24
+ },
25
+ });
11
26
  export const ComplianceStatus = ({ title, itemsList, children, subtitle, backgroundColor = 'grey', variant = 'contained', }) => {
12
- return (_jsxs(Wrapper, { "$background": backgroundColor, "$variant": variant, children: [title && (_jsx(OverflowTypography, { variant: "h6", component: "h4", children: title })), subtitle, _jsx(Inner, { children: itemsList.map(({ text, status }, index) => (
27
+ return (_jsxs(Wrapper, { className: complianceStatus({ backgroundColor, variant }), children: [title && (_jsx(OverflowTypography, { className: complianceStatusClassnames.title, variant: "h6", component: "h4", children: title })), subtitle, _jsx(Inner, { className: complianceStatusClassnames.list, children: itemsList.map(({ text, status }, index) => (
13
28
  // biome-ignore lint/suspicious/noArrayIndexKey: Элементы статичны
14
- _jsxs(Item, { children: [ICON_BY_STATUS[status], _jsx(Typography, { children: text })] }, index))) }), children] }));
29
+ _jsxs(Item, { className: complianceStatusClassnames.item, children: [ICON_BY_STATUS[status], _jsx(Typography, { children: text })] }, index))) }), children] }));
15
30
  };
@@ -0,0 +1,14 @@
1
+ import type { BackgroundColor, Variant } from './types';
2
+ export declare const complianceStatusColorClassnames: Record<BackgroundColor, string>;
3
+ export declare const complianceStatusVariantClassnames: Record<Variant, string>;
4
+ export declare const complianceStatusClassnames: {
5
+ contained: string;
6
+ outlined: string;
7
+ plain: string;
8
+ primary: string;
9
+ grey: string;
10
+ root: string;
11
+ title: string;
12
+ list: string;
13
+ item: string;
14
+ };
@@ -0,0 +1,18 @@
1
+ import { createUIKitClassname } from '../utils/createUIKitClassname';
2
+ export const complianceStatusColorClassnames = {
3
+ grey: createUIKitClassname('compliance-status_color-grey'),
4
+ primary: createUIKitClassname('compliance-status_color-primary'),
5
+ };
6
+ export const complianceStatusVariantClassnames = {
7
+ plain: createUIKitClassname('compliance-status_variant-plain'),
8
+ contained: createUIKitClassname('compliance-status_variant-contained'),
9
+ outlined: createUIKitClassname('compliance-status_variant-outlined'),
10
+ };
11
+ export const complianceStatusClassnames = {
12
+ root: createUIKitClassname('compliance-status'),
13
+ title: createUIKitClassname('compliance-status__title'),
14
+ list: createUIKitClassname('compliance-status__list'),
15
+ item: createUIKitClassname('compliance-status__item'),
16
+ ...complianceStatusColorClassnames,
17
+ ...complianceStatusVariantClassnames,
18
+ };
@@ -1 +1,2 @@
1
- export { ComplianceStatus, type ComplianceStatusItem, type ComplianceStatusProps, } from './ComplianceStatus';
1
+ export { ComplianceStatus } from './ComplianceStatus';
2
+ export type { ComplianceStatusItem, ComplianceStatusProps } from './types';
@@ -1 +1 @@
1
- export { ComplianceStatus, } from './ComplianceStatus';
1
+ export { ComplianceStatus } from './ComplianceStatus';
@@ -1 +1,2 @@
1
- export { ComplianceStatus, type ComplianceStatusItem, type ComplianceStatusProps, } from './ComplianceStatus';
1
+ export { ComplianceStatus } from './ComplianceStatus';
2
+ export type { ComplianceStatusItem, ComplianceStatusProps } from './types';
@@ -1 +1 @@
1
- export { ComplianceStatus, } from './ComplianceStatus';
1
+ export { ComplianceStatus } from './ComplianceStatus';
@@ -1,11 +1,7 @@
1
1
  /// <reference types="react" />
2
- type Variant = 'plain' | 'contained';
3
2
  export declare const Wrapper: import("../styled").StyledComponent<{
4
3
  theme?: import("@emotion/react").Theme | undefined;
5
4
  as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
6
- } & {
7
- $background: 'grey' | 'primary';
8
- $variant: Variant;
9
5
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, {}>;
10
6
  export declare const Inner: import("../styled").StyledComponent<{
11
7
  theme?: import("@emotion/react").Theme | undefined;
@@ -51,4 +47,3 @@ export declare const SuccessIcon: import("../styled").StyledComponent<{
51
47
  export declare const StyledLoader: import("../styled").StyledComponent<import("../Loader").LoaderProps & {
52
48
  theme?: import("@emotion/react").Theme | undefined;
53
49
  }, {}, {}>;
54
- export {};
@@ -4,6 +4,7 @@ import { SuccessFillSm } from '../../icons/SuccessFillSm';
4
4
  import { Loader } from '../Loader';
5
5
  import { keyframes, styled } from '../styled';
6
6
  import { listContainer } from '../styled/mixins';
7
+ import { complianceStatusClassnames } from './constants';
7
8
  const iconAppearAnimation = keyframes `
8
9
  from {
9
10
  transform: scale(0);
@@ -14,14 +15,31 @@ const iconAppearAnimation = keyframes `
14
15
  opacity: 1;
15
16
  }
16
17
  `;
17
- export const Wrapper = styled('article') `
18
+ export const Wrapper = styled.article `
18
19
  display: grid;
19
20
  grid-gap: ${({ theme }) => theme.spacing(2)};
20
21
 
21
- padding: ${({ theme, $variant }) => $variant === 'contained' ? theme.spacing(3) : 0};
22
+ background-color: inherit;
22
23
 
23
- background-color: ${({ theme, $background, $variant }) => $variant === 'contained' ? theme.palette[$background][100] : 'inherit'};
24
24
  border-radius: ${({ theme }) => theme.shape.medium};
25
+
26
+ &.${complianceStatusClassnames.contained} {
27
+ padding: ${({ theme }) => theme.spacing(3)};
28
+
29
+ &.${complianceStatusClassnames.primary} {
30
+ background-color: ${({ theme }) => theme.palette.primary[100]};
31
+ }
32
+
33
+ &.${complianceStatusClassnames.grey} {
34
+ background-color: ${({ theme }) => theme.palette.grey[100]};
35
+ }
36
+ }
37
+
38
+ &.${complianceStatusClassnames.outlined} {
39
+ padding: ${({ theme }) => theme.spacing(3)};
40
+
41
+ border: 1px solid ${({ theme }) => theme.palette.grey[300]};
42
+ }
25
43
  `;
26
44
  export const Inner = styled('ul') `
27
45
  display: grid;
@@ -0,0 +1,42 @@
1
+ import type { ReactNode } from 'react';
2
+ export type ItemStatus = 'success' | 'reject' | 'default' | 'loading';
3
+ export type BackgroundColor = 'grey' | 'primary';
4
+ export type Variant = 'plain' | 'contained' | 'outlined';
5
+ export type ComplianceStatusItem = {
6
+ /**
7
+ * Текст для отображения в элементе списка
8
+ */
9
+ text: ReactNode;
10
+ /**
11
+ * Статус элемента
12
+ */
13
+ status: ItemStatus;
14
+ };
15
+ export type ComplianceStatusProps = {
16
+ /**
17
+ * Основной заголовок элемента
18
+ */
19
+ title?: string | null;
20
+ /**
21
+ * Пропс для добавления контента между заголовком и списком
22
+ */
23
+ subtitle?: ReactNode;
24
+ /**
25
+ * Пропс для добавления контента после списка
26
+ */
27
+ children?: ReactNode;
28
+ /**
29
+ * Элементы списка
30
+ */
31
+ itemsList: ComplianceStatusItem[];
32
+ /**
33
+ * Фоновый цвет
34
+ * @default grey
35
+ */
36
+ backgroundColor?: BackgroundColor;
37
+ /**
38
+ * Вариант отображения блока статусов
39
+ * @default contained
40
+ */
41
+ variant?: Variant;
42
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,99 +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 BodyProps<TData extends Record<string, CellValue>> = {
5
- /**
6
- * Конфигурация колонок для таблицы
7
- */
8
- columns: DataGridColumns<TData>[];
9
- /**
10
- * Поле, которое будет использоваться в качестве ключа
11
- */
12
- keyId: keyof TData;
13
- /**
14
- * Конфигурация ширины колонок
15
- */
16
- gridColumns: string;
17
- /**
18
- * Если true, показывается анимация загрузки
19
- */
20
- isLoading?: boolean;
21
- /**
22
- * Флаг состояния ошибки
23
- */
24
- isError?: boolean;
25
- /**
26
- * Текст ошибки
27
- */
28
- errorMsg?: string;
29
- /**
30
- * Идентификатор активного элемента массива rows. Выделяет активную строку в таблице
31
- */
32
- activeRowId?: string;
33
- /**
34
- * Если true, то дерево будет раскрыто по умолчанию
35
- * @default 'false'
36
- */
37
- isInitialExpanded: boolean;
38
- /**
39
- * Уровень раскрытия дерева по умолчанию, при isInitialExpanded=true
40
- */
41
- expandedLevel: number;
42
- /**
43
- * Количество отображаемых по умолчанию дочерних элементов
44
- */
45
- initialVisibleChildrenCount: number;
46
- /**
47
- * Номер колонки, в которой будет расположена кнопка "Показать все"
48
- * Работает только для `variant="subrows"`
49
- */
50
- moreButtonColumnPosition: number;
51
- /**
52
- * Если false, кнопка разворачивания элементов не показывается
53
- * Работает только для `variant="subrows"`
54
- */
55
- isVisibleCollapseButton: boolean;
56
- /**
57
- * Если true, то будет отображаться чекбокс для выбора элемента
58
- */
59
- isSelectable?: boolean;
60
- /**
61
- * Массив выбранных строк
62
- */
63
- selectedRows?: TData[];
64
- /**
65
- * Массив данных для отображения
66
- */
67
- rows: Array<TData & {
68
- options?: DataGridRowOptions<TData>;
69
- }>;
70
- /**
71
- * Вариант отображения вложенных элементов
72
- */
73
- variant: `${Variant}`;
74
- /**
75
- * Используется для отображения переданного кол-ва строк при отсутствии данных
76
- */
77
- minDisplayRows: number;
78
- /**
79
- * Заглушка для пустых ячеек (если отсутствует field и filter и renderCell)
80
- */
81
- emptyCellValue?: ReactNode;
82
- /**
83
- * Используется для отображения placeholder при отсутствии данных в таблице
84
- */
85
- noDataPlaceholder?: ReactNode;
86
- /**
87
- * Обработчик выбора строки
88
- */
89
- onSelectRow: (row: TData) => (event: ChangeEvent<HTMLInputElement>) => void;
90
- /**
91
- * Функция обработки нажатия на кнопку "Повторить запрос"
92
- */
93
- onRetry: () => void;
94
- /**
95
- * Обработчик клика строки таблицы
96
- */
97
- onRowClick?: (row: TData) => void;
98
- };
1
+ import type { BodyProps } from './types';
99
2
  export declare const Body: <TData extends Record<string, unknown>>(props: BodyProps<TData>) => import("react/jsx-runtime").JSX.Element;
@@ -1,30 +1,18 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useContext } from 'react';
3
3
  import { ConfigContext } from '../../ConfigProvider';
4
- import { ContentState } from '../../ContentState';
5
- import { classNames } from '../../utils/classNames';
6
- import { dataGridClassnames } from '../constants';
7
4
  import { Row } from '../Row';
8
5
  import { RowContextProvider } from '../Row/RowContext';
9
6
  import { Wrapper } from './styles';
10
- import { useLogic } from './useLogic';
11
7
  const INITIAL_LEVEL = 0;
12
8
  export const Body = (props) => {
13
- const { imagesMap, components } = useContext(ConfigContext);
14
- const { isNoData, contentStateProps } = useLogic(props);
9
+ const { components } = useContext(ConfigContext);
15
10
  const disableMinHeight = components?.dataGrid?.defaultProps?.disableMinHeight;
16
- const { rows, selectedRows = [], isLoading, isError, errorMsg, minDisplayRows, keyId, noDataPlaceholder, onRetry, ...rowProps } = props;
11
+ const { rows, selectedRows = [], minDisplayRows, keyId, noDataPlaceholder, className, ...rowProps } = props;
17
12
  const renderedRows = rows.map(({ children, options, ...row }) => {
18
13
  const rowId = row[keyId];
19
14
  const isSelected = Boolean(selectedRows?.find((selectedRow) => selectedRow[keyId] === rowId));
20
15
  return (_jsx(RowContextProvider, { children: _jsx(Row, { row: row, selectedRows: selectedRows, options: options, keyId: keyId, level: INITIAL_LEVEL, nestedChildren: children, isSelected: isSelected, ...rowProps }, rowId) }, rowId));
21
16
  });
22
- return (_jsx(Wrapper, { className: classNames(dataGridClassnames.body, {
23
- [dataGridClassnames.bodyEmpty]: isNoData,
24
- }), "$minDisplayRows": minDisplayRows, "$disableMinHeight": disableMinHeight, children: _jsx(ContentState, { ...contentStateProps, errorState: {
25
- imgAlt: 'Что-то пошло не так',
26
- errorList: [errorMsg || ''],
27
- imgSrc: imagesMap.defaultErrorImgSrc,
28
- onRetry,
29
- }, isSmoothLoading: false, children: rows.length ? renderedRows : noDataPlaceholder }) }));
17
+ return (_jsx(Wrapper, { className: className, "$minDisplayRows": minDisplayRows, "$disableMinHeight": disableMinHeight, children: rows.length ? renderedRows : noDataPlaceholder }));
30
18
  };
@@ -1 +1,2 @@
1
1
  export * from './Body';
2
+ export * from './types';
@@ -1 +1,2 @@
1
1
  export * from './Body';
2
+ export * from './types';
@@ -0,0 +1,110 @@
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 BodyProps<TData extends Record<string, CellValue>> = {
5
+ /**
6
+ * Конфигурация колонок для таблицы
7
+ */
8
+ columns: DataGridColumns<TData>[];
9
+ /**
10
+ * Поле, которое будет использоваться в качестве ключа
11
+ */
12
+ keyId: keyof TData;
13
+ /**
14
+ * Конфигурация ширины колонок
15
+ */
16
+ gridColumns: string;
17
+ /**
18
+ * Идентификатор активного элемента массива rows. Выделяет активную строку в таблице
19
+ */
20
+ activeRowId?: string;
21
+ /**
22
+ * Если true, то дерево будет раскрыто по умолчанию
23
+ * @default 'false'
24
+ */
25
+ isInitialExpanded: boolean;
26
+ /**
27
+ * Уровень раскрытия дерева по умолчанию, при isInitialExpanded=true
28
+ */
29
+ expandedLevel: number;
30
+ /**
31
+ * Количество отображаемых по умолчанию дочерних элементов
32
+ */
33
+ initialVisibleChildrenCount: number;
34
+ /**
35
+ * Номер колонки, в которой будет расположена кнопка "Показать все"
36
+ * Работает только для `variant="subrows"`
37
+ */
38
+ moreButtonColumnPosition: number;
39
+ /**
40
+ * Если false, кнопка разворачивания элементов не показывается
41
+ * Работает только для `variant="subrows"`
42
+ */
43
+ isVisibleCollapseButton: boolean;
44
+ /**
45
+ * Если true, то будет отображаться чекбокс для выбора элемента
46
+ */
47
+ isSelectable?: boolean;
48
+ /**
49
+ * Массив выбранных строк
50
+ */
51
+ selectedRows?: TData[];
52
+ /**
53
+ * Массив данных для отображения
54
+ */
55
+ rows: Array<TData & {
56
+ options?: DataGridRowOptions<TData>;
57
+ }>;
58
+ /**
59
+ * Вариант отображения вложенных элементов
60
+ */
61
+ variant: `${Variant}`;
62
+ /**
63
+ * Используется для отображения переданного кол-ва строк при отсутствии данных
64
+ */
65
+ minDisplayRows: number;
66
+ /**
67
+ * Заглушка для пустых ячеек (если отсутствует field и filter и renderCell)
68
+ */
69
+ emptyCellValue?: ReactNode;
70
+ /**
71
+ * Используется для отображения placeholder при отсутствии данных в таблице
72
+ */
73
+ noDataPlaceholder?: ReactNode;
74
+ /**
75
+ * Обработчик выбора строки
76
+ */
77
+ onSelectRow: (row: TData) => (event: ChangeEvent<HTMLInputElement>) => void;
78
+ /**
79
+ * Обработчик клика строки таблицы
80
+ */
81
+ onRowClick?: (row: TData) => void;
82
+ /**
83
+ * Смещение секции
84
+ */
85
+ sectionOffset?: number;
86
+ /**
87
+ * Общее количество колонок (для правильного определения последней ячейки)
88
+ */
89
+ totalColumnsCount?: number;
90
+ /**
91
+ * Регистрация элемента строки
92
+ */
93
+ registerRowElement: (rowId: string, el: HTMLElement) => void;
94
+ /**
95
+ * Отмена регистрации элемента строки
96
+ */
97
+ unregisterRowElement: (rowId: string, el: HTMLElement) => void;
98
+ /**
99
+ * Обработчик наведения на строку
100
+ */
101
+ onRowEnter: (rowId: string) => void;
102
+ /**
103
+ * Обработчик выхода из строки
104
+ */
105
+ onRowLeave: (rowId: string, e: PointerEvent) => void;
106
+ /**
107
+ * Класс применяемый для корневого элемента
108
+ */
109
+ className?: string;
110
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,21 +1,22 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, useContext } from 'react';
3
3
  import { ConfigContext } from '../ConfigProvider';
4
- import { classNames } from '../utils/classNames';
4
+ import { ContentState } from '../ContentState';
5
5
  import { getInertProps } from '../utils/getInertProps';
6
6
  import { Body } from './Body';
7
- import { dataGridClassnames, EXPANDED_LEVEL_BY_DEFAULT, INITIAL_OPENED_NESTED_CHILDREN_COUNT_BY_DEFAULT, MIN_DISPLAY_ROWS_BY_DEFAULT, } from './constants';
7
+ import { EXPANDED_LEVEL_BY_DEFAULT, INITIAL_OPENED_NESTED_CHILDREN_COUNT_BY_DEFAULT, MIN_DISPLAY_ROWS_BY_DEFAULT, } from './constants';
8
8
  import { DataGridContextProvider } from './DataGridContext';
9
9
  import { Variant } from './enums';
10
10
  import { Head } from './Head';
11
11
  import { Loader } from './Loader';
12
12
  import { NoData } from './NoData';
13
+ import { PinnedSections } from './PinnedSections';
13
14
  import { Container, DataGridWrapper, DisabledDataGridWrapper } from './styles';
14
15
  import { useLogic } from './useLogic';
15
16
  export const DataGrid = (props) => {
16
- const { isDataGridDisabled, treeRenderConfig, headProps, bodyProps, loaderProps, renderRows, isAllowHorizontalScroll, isHideHead, } = useLogic(props);
17
+ const { isDataGridDisabled, treeRenderConfig, headColumns, headProps, bodyProps, gridColumns, loaderProps, renderRows, isAllowHorizontalScroll, isHideHead, hasPinnedColumns, pinnedSectionsClassname, dataGridClassname, contentStateProps, rowHoverProps, containerRef, sections, isNoData, bodyClassName, } = useLogic(props);
17
18
  const { emptySymbol } = useContext(ConfigContext);
18
- const { columns, selectedRows = [], sorting, maxHeight, minDisplayRows = MIN_DISPLAY_ROWS_BY_DEFAULT, errorMsg, variant = Variant.Tree, footer, noDataPlaceholder, isLoading, isError, subrows, keyId, activeRowId, emptyCellValue = emptySymbol, className, onRowClick, onSort, noDataOptions, onRetry, headPreAddon, } = props;
19
+ const { columns, selectedRows = [], maxHeight, minDisplayRows = MIN_DISPLAY_ROWS_BY_DEFAULT, variant = Variant.Tree, footer, noDataPlaceholder, isLoading, subrows, keyId, activeRowId, emptyCellValue = emptySymbol, onRowClick, noDataOptions, headPreAddon, } = props;
19
20
  const { moreButtonColumnPosition = 1, isVisibleCollapseButton = true } = subrows || {};
20
21
  const { isInitialExpanded = false, expandedLevel = EXPANDED_LEVEL_BY_DEFAULT, initialVisibleChildrenCount = INITIAL_OPENED_NESTED_CHILDREN_COUNT_BY_DEFAULT, } = treeRenderConfig || {};
21
22
  const TableContainer = isDataGridDisabled
@@ -27,5 +28,29 @@ export const DataGrid = (props) => {
27
28
  }
28
29
  return null;
29
30
  }, [noDataPlaceholder, noDataOptions, isLoading]);
30
- return (_jsx(DataGridContextProvider, { isLoading: isLoading, children: _jsxs(Container, { "$maxHeight": maxHeight, "$isAllowHorizontalScroll": isAllowHorizontalScroll, className: classNames(dataGridClassnames.root, className), children: [_jsxs(TableContainer, { "$isAllowHorizontalScroll": isAllowHorizontalScroll, ...getInertProps(isDataGridDisabled), children: [headPreAddon, !isHideHead && (_jsx(Head, { ...headProps, sorting: sorting, onSort: onSort })), _jsx(Body, { ...bodyProps, activeRowId: activeRowId, keyId: keyId, selectedRows: selectedRows, minDisplayRows: minDisplayRows, rows: renderRows, columns: columns, variant: variant, emptyCellValue: emptyCellValue, isInitialExpanded: isInitialExpanded, expandedLevel: expandedLevel, initialVisibleChildrenCount: initialVisibleChildrenCount, moreButtonColumnPosition: moreButtonColumnPosition, isVisibleCollapseButton: isVisibleCollapseButton, isLoading: isLoading, isError: isError, errorMsg: errorMsg, noDataPlaceholder: renderedPlaceholder(), onRowClick: onRowClick, onRetry: onRetry })] }), _jsx(Loader, { ...loaderProps }), footer && footer] }) }));
31
+ const commonBodyProps = {
32
+ ...bodyProps,
33
+ activeRowId,
34
+ keyId,
35
+ selectedRows,
36
+ minDisplayRows,
37
+ rows: renderRows,
38
+ variant,
39
+ emptyCellValue,
40
+ isInitialExpanded,
41
+ expandedLevel,
42
+ initialVisibleChildrenCount,
43
+ moreButtonColumnPosition,
44
+ isVisibleCollapseButton,
45
+ noDataPlaceholder: renderedPlaceholder(),
46
+ onRowClick,
47
+ ...rowHoverProps,
48
+ };
49
+ const renderTableContent = () => {
50
+ if (!hasPinnedColumns) {
51
+ return (_jsxs(TableContainer, { "$isAllowHorizontalScroll": isAllowHorizontalScroll, ...getInertProps(isDataGridDisabled), children: [headPreAddon, !isHideHead && (_jsx(Head, { ...headProps, columns: headColumns, gridColumns: gridColumns })), _jsx(ContentState, { ...contentStateProps, children: _jsx(Body, { ...commonBodyProps, columns: columns, gridColumns: gridColumns, className: bodyClassName }) })] }));
52
+ }
53
+ return (_jsx(ContentState, { ...contentStateProps, children: _jsx(PinnedSections, { sections: sections, className: pinnedSectionsClassname, isDisabled: isDataGridDisabled, headProps: headProps, gridColumns: gridColumns, bodyProps: commonBodyProps, isNoData: isNoData }) }));
54
+ };
55
+ return (_jsx(DataGridContextProvider, { isLoading: isLoading, children: _jsxs(Container, { ref: containerRef, "$maxHeight": maxHeight, "$isAllowHorizontalScroll": isAllowHorizontalScroll, className: dataGridClassname, children: [renderTableContent(), _jsx(Loader, { ...loaderProps }), footer && footer] }) }));
31
56
  };
@@ -37,5 +37,9 @@ export type HeadProps<TData extends Record<string, CellValue> = DataGridRow, TSo
37
37
  * Используется для скрытия чекбокса "Выбрать все"
38
38
  */
39
39
  isHideSelectAll?: boolean;
40
+ /**
41
+ * Смещение секции
42
+ */
43
+ sectionOffset?: number;
40
44
  };
41
45
  export declare const Head: <TData extends Record<string, unknown>, TSortField extends keyof TData>(props: HeadProps<TData, TSortField>) => import("react/jsx-runtime").JSX.Element;
@@ -7,10 +7,11 @@ import { CheckboxCell, Wrapper } from './styles';
7
7
  import { useLogic } from './useLogic';
8
8
  export const Head = (props) => {
9
9
  const { checkboxProps, handleSort } = useLogic(props);
10
- const { columns, gridColumns, isSelectable, sorting, onSelectAllRows, isHideSelectAll, } = props;
10
+ const { columns, gridColumns, isSelectable, sorting, onSelectAllRows, isHideSelectAll, sectionOffset, } = props;
11
11
  const renderColumns = useMemo(() => {
12
12
  return columns.map(({ field, label, sortable, align, columnHint }, index) => {
13
- const isFirstCell = !index;
13
+ const globalIndex = (sectionOffset ?? 0) + index;
14
+ const isFirstCell = globalIndex === 0;
14
15
  const startAdornmentRender = () => {
15
16
  const showCheckbox = isFirstCell && isSelectable && !isHideSelectAll;
16
17
  if (!showCheckbox && !columnHint) {
@@ -1,5 +1,5 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { Backdrop, LoaderWrapper, StyledDivider, StyledLinearProgress, } from './styles';
3
3
  export const Loader = ({ isLoading = false, isDisabled = false, isVisibleDivider = true, }) => {
4
- return (_jsxs(LoaderWrapper, { children: [(isLoading || isDisabled) && _jsx(Backdrop, {}), isLoading && _jsx(StyledLinearProgress, {}), !isLoading && isVisibleDivider && _jsx(StyledDivider, {})] }));
4
+ return (_jsxs(_Fragment, { children: [(isLoading || isDisabled) && _jsx(Backdrop, {}), _jsxs(LoaderWrapper, { children: [isLoading && _jsx(StyledLinearProgress, {}), !isLoading && isVisibleDivider && _jsx(StyledDivider, {})] })] }));
5
5
  };
@@ -15,11 +15,13 @@ export const StyledDivider = styled(Divider) `
15
15
  border-width: 1px;
16
16
  `;
17
17
  export const LoaderWrapper = styled.div `
18
- height: 2px;
18
+ position: sticky;
19
+ z-index: ${({ theme }) => theme.zIndex.fab};
20
+ left: 0;
19
21
  `;
20
22
  export const StyledLinearProgress = styled(LinearProgress) `
21
23
  height: 2px;
22
-
24
+
23
25
  .${linearProgressClasses.barColorPrimary} {
24
26
  background-color: ${({ theme }) => theme.palette.primary[800]};
25
27
  }
@@ -0,0 +1,35 @@
1
+ import { type BodyProps } from '../Body';
2
+ import { type HeadProps } from '../Head';
3
+ import { type CellValue, type DataGridRow } from '../types';
4
+ import type { PinnedSection } from './types';
5
+ export type PinnedSectionsProps<TData extends Record<string, CellValue> = DataGridRow, TSortField extends keyof TData = keyof TData> = {
6
+ /**
7
+ * Конфигурация закрепленных секций
8
+ */
9
+ sections: PinnedSection<TData>[];
10
+ /**
11
+ * Конфигурация ширины колонок
12
+ */
13
+ gridColumns: string;
14
+ /**
15
+ * Класс применяемый для корневого элемента
16
+ */
17
+ className?: string;
18
+ /**
19
+ * Если true, таблица будет заблокирована для взаимодействия
20
+ */
21
+ isDisabled?: boolean;
22
+ /**
23
+ * Параметры предназначены для конфигурации таблицы
24
+ */
25
+ bodyProps: Omit<BodyProps<TData>, 'gridColumns' | 'columns'>;
26
+ /**
27
+ * Параметры предназначены для конфигурации шапки таблицы
28
+ */
29
+ headProps: Omit<HeadProps<TData, TSortField>, 'columns' | 'gridColumns'>;
30
+ /**
31
+ * Флаг для отображения placeholder при отсутствии данных
32
+ */
33
+ isNoData?: boolean;
34
+ };
35
+ export declare const PinnedSections: <TData extends Record<string, unknown> = DataGridRow, TSortField extends keyof TData = keyof TData>({ gridColumns, className, isDisabled, headProps, bodyProps, sections, isNoData, }: PinnedSectionsProps<TData, TSortField>) => import("react/jsx-runtime").JSX.Element;