@alfalab/core-components-table 2.8.4 → 2.9.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 (82) hide show
  1. package/component.d.ts +8 -1
  2. package/components/pagination/Component.js +1 -1
  3. package/components/pagination/index.css +9 -9
  4. package/components/pagination/select-field/index.css +4 -4
  5. package/components/pagination/select-field/index.js +1 -1
  6. package/components/table/Component.js +1 -1
  7. package/components/table/index.css +7 -7
  8. package/components/tbody/Component.js +1 -1
  9. package/components/tbody/index.css +2 -2
  10. package/components/tcell/Component.js +1 -1
  11. package/components/tcell/index.css +6 -6
  12. package/components/texpandable-row/Component.d.ts +3 -1
  13. package/components/texpandable-row/Component.js +3 -3
  14. package/components/texpandable-row/index.css +5 -5
  15. package/components/thead/Component.js +1 -1
  16. package/components/thead/index.css +6 -6
  17. package/components/thead-cell/Component.js +1 -1
  18. package/components/thead-cell/index.css +9 -9
  19. package/components/trow/Component.d.ts +22 -1
  20. package/components/trow/Component.js +5 -4
  21. package/components/trow/index.css +8 -8
  22. package/components/tsortable-head-cell/Component.js +1 -1
  23. package/components/tsortable-head-cell/index.css +8 -8
  24. package/cssm/component.d.ts +8 -1
  25. package/cssm/components/texpandable-row/Component.d.ts +3 -1
  26. package/cssm/components/texpandable-row/Component.js +2 -2
  27. package/cssm/components/trow/Component.d.ts +22 -1
  28. package/cssm/components/trow/Component.js +4 -3
  29. package/esm/component.d.ts +8 -1
  30. package/esm/components/pagination/Component.js +1 -1
  31. package/esm/components/pagination/index.css +9 -9
  32. package/esm/components/pagination/select-field/index.css +4 -4
  33. package/esm/components/pagination/select-field/index.js +1 -1
  34. package/esm/components/table/Component.js +1 -1
  35. package/esm/components/table/index.css +7 -7
  36. package/esm/components/tbody/Component.js +1 -1
  37. package/esm/components/tbody/index.css +2 -2
  38. package/esm/components/tcell/Component.js +1 -1
  39. package/esm/components/tcell/index.css +6 -6
  40. package/esm/components/texpandable-row/Component.d.ts +3 -1
  41. package/esm/components/texpandable-row/Component.js +3 -3
  42. package/esm/components/texpandable-row/index.css +5 -5
  43. package/esm/components/thead/Component.js +1 -1
  44. package/esm/components/thead/index.css +6 -6
  45. package/esm/components/thead-cell/Component.js +1 -1
  46. package/esm/components/thead-cell/index.css +9 -9
  47. package/esm/components/trow/Component.d.ts +22 -1
  48. package/esm/components/trow/Component.js +6 -5
  49. package/esm/components/trow/index.css +8 -8
  50. package/esm/components/tsortable-head-cell/Component.js +1 -1
  51. package/esm/components/tsortable-head-cell/index.css +8 -8
  52. package/modern/component.d.ts +8 -1
  53. package/modern/components/pagination/Component.js +1 -1
  54. package/modern/components/pagination/index.css +9 -9
  55. package/modern/components/pagination/select-field/index.css +4 -4
  56. package/modern/components/pagination/select-field/index.js +1 -1
  57. package/modern/components/table/Component.js +1 -1
  58. package/modern/components/table/index.css +7 -7
  59. package/modern/components/tbody/Component.js +1 -1
  60. package/modern/components/tbody/index.css +2 -2
  61. package/modern/components/tcell/Component.js +1 -1
  62. package/modern/components/tcell/index.css +6 -6
  63. package/modern/components/texpandable-row/Component.d.ts +3 -1
  64. package/modern/components/texpandable-row/Component.js +3 -3
  65. package/modern/components/texpandable-row/index.css +5 -5
  66. package/modern/components/thead/Component.js +1 -1
  67. package/modern/components/thead/index.css +6 -6
  68. package/modern/components/thead-cell/Component.js +1 -1
  69. package/modern/components/thead-cell/index.css +9 -9
  70. package/modern/components/trow/Component.d.ts +22 -1
  71. package/modern/components/trow/Component.js +5 -4
  72. package/modern/components/trow/index.css +8 -8
  73. package/modern/components/tsortable-head-cell/Component.js +1 -1
  74. package/modern/components/tsortable-head-cell/index.css +8 -8
  75. package/moderncssm/component.d.ts +8 -1
  76. package/moderncssm/components/texpandable-row/Component.d.ts +3 -1
  77. package/moderncssm/components/texpandable-row/Component.js +2 -2
  78. package/moderncssm/components/trow/Component.d.ts +22 -1
  79. package/moderncssm/components/trow/Component.js +4 -3
  80. package/package.json +2 -2
  81. package/src/components/texpandable-row/Component.tsx +5 -1
  82. package/src/components/trow/Component.tsx +18 -20
@@ -1,4 +1,4 @@
1
- /* hash: 131v0 */
1
+ /* hash: ty0ai */
2
2
  :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
3
3
  } /* deprecated */ :root {
4
4
  --color-light-neutral-700: #898991;
@@ -24,10 +24,10 @@
24
24
  --gap-8: var(--gap-xs);
25
25
  } :root {
26
26
  } :root {
27
- } /* сбрасывает синюю подсветку при нажатии */ .table__content_1b09f {
27
+ } /* сбрасывает синюю подсветку при нажатии */ .table__content_absvz {
28
28
  display: flex;
29
29
  align-items: flex-start;
30
- } .table__icon_1b09f {
30
+ } .table__icon_absvz {
31
31
  cursor: pointer;
32
32
  margin-left: var(--gap-8);
33
33
 
@@ -39,15 +39,15 @@
39
39
  color: var(--color-light-neutral-700);
40
40
  transition: color 0.2s ease;
41
41
  flex-shrink: 0
42
- } .table__icon_1b09f:hover {
42
+ } .table__icon_absvz:hover {
43
43
  color: var(--color-light-neutral-translucent-1300);
44
- } .table__reverse_1b09f {
44
+ } .table__reverse_absvz {
45
45
  flex-direction: row-reverse
46
- } .table__reverse_1b09f .table__icon_1b09f {
46
+ } .table__reverse_absvz .table__icon_absvz {
47
47
  margin-left: var(--gap-0);
48
48
  margin-right: var(--gap-8);
49
- } .table__sorted_1b09f {
49
+ } .table__sorted_absvz {
50
50
  color: var(--color-light-status-info)
51
- } .table__sorted_1b09f:hover {
51
+ } .table__sorted_absvz:hover {
52
52
  color: var(--color-light-status-info);
53
53
  }
@@ -14,7 +14,13 @@ declare const Table: import("react").ForwardRefExoticComponent<import("react").T
14
14
  THeadCell: ({ children, className, dataTestId, style, width, textAlign, hidden, ...restProps }: import("./components/index").THeadCellProps) => import("react").JSX.Element | null;
15
15
  TSortableHeadCell: ({ children, className, defaultIsSortedDesc, isSortedDesc, textAlign, onSort, ...restProps }: import("./components/index").TSortableHeadCellProps) => import("react").JSX.Element;
16
16
  TCell: ({ className, style, dataTestId, children, index, ...restProps }: import("./components/index").TCellProps) => import("react").JSX.Element | null;
17
- TRow: ({ children, className, selected, withoutBorder, dataTestId, ...restProps }: import("./components/index").TRowProps) => import("react").JSX.Element;
17
+ TRow: import("react").ForwardRefExoticComponent<import("react").HTMLAttributes<HTMLTableRowElement> & {
18
+ children: import("react").ReactElement<import("./components/index").TCellProps, ({ className, style, dataTestId, children, index, ...restProps }: import("./components/index").TCellProps) => import("react").JSX.Element | null> | import("react").ReactElement<import("./components/index").TCellProps, ({ className, style, dataTestId, children, index, ...restProps }: import("./components/index").TCellProps) => import("react").JSX.Element | null>[];
19
+ className?: string | undefined;
20
+ selected?: boolean | undefined;
21
+ withoutBorder?: boolean | undefined;
22
+ dataTestId?: string | undefined;
23
+ } & import("react").RefAttributes<HTMLTableRowElement>>;
18
24
  TExpandableRow: import("react").ForwardRefExoticComponent<import("react").HTMLAttributes<HTMLTableRowElement> & {
19
25
  children: import("react").ReactElement<import("./components/index").TCellProps, ({ className, style, dataTestId, children, index, ...restProps }: import("./components/index").TCellProps) => import("react").JSX.Element | null> | import("react").ReactElement<import("./components/index").TCellProps, ({ className, style, dataTestId, children, index, ...restProps }: import("./components/index").TCellProps) => import("react").JSX.Element | null>[];
20
26
  className?: string | undefined;
@@ -26,6 +32,7 @@ declare const Table: import("react").ForwardRefExoticComponent<import("react").T
26
32
  expanded?: boolean | undefined;
27
33
  onToggle?: ((expanded: boolean) => void) | undefined;
28
34
  renderContent: (expanded: boolean) => import("react").ReactNode;
35
+ rowRef?: import("react").Ref<HTMLTableRowElement> | undefined;
29
36
  } & import("react").RefAttributes<HTMLTableRowElement>>;
30
37
  Pagination: import("react").FC<import("./components/index").PaginationProps>;
31
38
  };
@@ -1,12 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import React from 'react';
3
- import { ReactNode } from "react";
3
+ import { ReactNode, Ref } from "react";
4
4
  import { TRowProps } from "../trow/index";
5
5
  type TExpandableRowProps = TRowProps & {
6
6
  defaultExpanded?: boolean;
7
7
  expanded?: boolean;
8
8
  onToggle?: (expanded: boolean) => void;
9
9
  renderContent: (expanded: boolean) => ReactNode;
10
+ rowRef?: Ref<HTMLTableRowElement>;
10
11
  };
11
12
  declare const TExpandableRow: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableRowElement> & {
12
13
  children: React.ReactElement<import("../index").TCellProps, ({ className, style, dataTestId, children, index, ...restProps }: import("../index").TCellProps) => React.JSX.Element | null> | React.ReactElement<import("../index").TCellProps, ({ className, style, dataTestId, children, index, ...restProps }: import("../index").TCellProps) => React.JSX.Element | null>[];
@@ -19,5 +20,6 @@ declare const TExpandableRow: React.ForwardRefExoticComponent<React.HTMLAttribut
19
20
  expanded?: boolean | undefined;
20
21
  onToggle?: ((expanded: boolean) => void) | undefined;
21
22
  renderContent: (expanded: boolean) => ReactNode;
23
+ rowRef?: React.Ref<HTMLTableRowElement> | undefined;
22
24
  } & React.RefAttributes<HTMLTableRowElement>>;
23
25
  export { TExpandableRowProps, TExpandableRow };
@@ -3,7 +3,7 @@ import cn from 'classnames';
3
3
  import { TRow } from '../trow/Component.js';
4
4
  import styles from './index.module.css';
5
5
 
6
- const TExpandableRow = forwardRef(({ className, selected, expanded, defaultExpanded = false, onToggle = () => null, renderContent = () => null, ...restProps }, ref) => {
6
+ const TExpandableRow = forwardRef(({ className, selected, expanded, defaultExpanded = false, onToggle = () => null, renderContent = () => null, rowRef, ...restProps }, ref) => {
7
7
  const [expandedState, setExpandedState] = useState(defaultExpanded);
8
8
  const uncontrolled = expanded === undefined;
9
9
  const isExpanded = (uncontrolled ? expandedState : expanded);
@@ -17,7 +17,7 @@ const TExpandableRow = forwardRef(({ className, selected, expanded, defaultExpan
17
17
  React.createElement(TRow, { className: cn(styles.row, className, {
18
18
  [styles.selected]: selected,
19
19
  [styles.expanded]: isExpanded,
20
- }), selected: selected, onClick: handleToggle, ...restProps }),
20
+ }), selected: selected, onClick: handleToggle, ref: rowRef, ...restProps }),
21
21
  React.createElement("tr", { ref: ref, className: cn(styles.expandable, { [styles.expanded]: isExpanded }) }, renderContent(isExpanded))));
22
22
  });
23
23
  TExpandableRow.displayName = 'TExpandableRow';
@@ -25,5 +25,26 @@ type TRowProps = HTMLAttributes<HTMLTableRowElement> & {
25
25
  */
26
26
  dataTestId?: string;
27
27
  };
28
- declare const TRow: ({ children, className, selected, withoutBorder, dataTestId, ...restProps }: TRowProps) => React.JSX.Element;
28
+ declare const TRow: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableRowElement> & {
29
+ /**
30
+ * Компоненты ячеек
31
+ */
32
+ children: TCellElement | TCellElement[];
33
+ /**
34
+ * Дополнительный класс
35
+ */
36
+ className?: string | undefined;
37
+ /**
38
+ * Стиль выбранной строки
39
+ */
40
+ selected?: boolean | undefined;
41
+ /**
42
+ * Убирает нижнюю границу
43
+ */
44
+ withoutBorder?: boolean | undefined;
45
+ /**
46
+ * Идентификатор для систем автоматизированного тестирования
47
+ */
48
+ dataTestId?: string | undefined;
49
+ } & React.RefAttributes<HTMLTableRowElement>>;
29
50
  export { TRowProps, TRow };
@@ -1,11 +1,12 @@
1
- import React from 'react';
1
+ import React, { forwardRef } from 'react';
2
2
  import cn from 'classnames';
3
3
  import styles from './index.module.css';
4
4
 
5
- const TRow = ({ children, className, selected, withoutBorder, dataTestId, ...restProps }) => (React.createElement("tr", { className: cn(styles.component, className, {
5
+ const TRow = forwardRef(({ children, className, selected, withoutBorder, dataTestId, ...restProps }, ref) => (React.createElement("tr", { className: cn(styles.component, className, {
6
6
  [styles.clickable]: typeof restProps.onClick !== 'undefined',
7
7
  [styles.selected]: selected,
8
8
  [styles.withoutBorder]: withoutBorder,
9
- }), "data-test-id": dataTestId, ...restProps }, React.Children.map(children, (child, index) => React.cloneElement(child, { index }))));
9
+ }), "data-test-id": dataTestId, ref: ref, ...restProps }, React.Children.map(children, (child, index) => React.cloneElement(child, { index })))));
10
+ TRow.displayName = 'TRow';
10
11
 
11
12
  export { TRow };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfalab/core-components-table",
3
- "version": "2.8.4",
3
+ "version": "2.9.0",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -18,7 +18,7 @@
18
18
  "dependencies": {
19
19
  "@alfalab/core-components-button": "^11.11.3",
20
20
  "@alfalab/core-components-pagination": "^2.4.8",
21
- "@alfalab/core-components-select": "^17.19.0",
21
+ "@alfalab/core-components-select": "^17.20.1",
22
22
  "classnames": "^2.5.1",
23
23
  "tslib": "^2.4.0"
24
24
  },
@@ -1,4 +1,4 @@
1
- import React, { forwardRef, ReactNode, useState } from 'react';
1
+ import React, { forwardRef, ReactNode, Ref, useState } from 'react';
2
2
  import cn from 'classnames';
3
3
 
4
4
  import { TRow, TRowProps } from '../trow';
@@ -13,6 +13,8 @@ export type TExpandableRowProps = TRowProps & {
13
13
  onToggle?: (expanded: boolean) => void;
14
14
 
15
15
  renderContent: (expanded: boolean) => ReactNode;
16
+
17
+ rowRef?: Ref<HTMLTableRowElement>;
16
18
  };
17
19
 
18
20
  export const TExpandableRow = forwardRef<HTMLTableRowElement, TExpandableRowProps>(
@@ -24,6 +26,7 @@ export const TExpandableRow = forwardRef<HTMLTableRowElement, TExpandableRowProp
24
26
  defaultExpanded = false,
25
27
  onToggle = () => null,
26
28
  renderContent = () => null,
29
+ rowRef,
27
30
  ...restProps
28
31
  }: TExpandableRowProps,
29
32
  ref,
@@ -51,6 +54,7 @@ export const TExpandableRow = forwardRef<HTMLTableRowElement, TExpandableRowProp
51
54
  })}
52
55
  selected={selected}
53
56
  onClick={handleToggle}
57
+ ref={rowRef}
54
58
  {...restProps}
55
59
  />
56
60
 
@@ -1,4 +1,4 @@
1
- import React, { HTMLAttributes } from 'react';
1
+ import React, { forwardRef, HTMLAttributes } from 'react';
2
2
  import cn from 'classnames';
3
3
 
4
4
  import { TCell, TCellProps } from '../tcell';
@@ -34,23 +34,21 @@ export type TRowProps = HTMLAttributes<HTMLTableRowElement> & {
34
34
  dataTestId?: string;
35
35
  };
36
36
 
37
- export const TRow = ({
38
- children,
39
- className,
40
- selected,
41
- withoutBorder,
42
- dataTestId,
43
- ...restProps
44
- }: TRowProps) => (
45
- <tr
46
- className={cn(styles.component, className, {
47
- [styles.clickable]: typeof restProps.onClick !== 'undefined',
48
- [styles.selected]: selected,
49
- [styles.withoutBorder]: withoutBorder,
50
- })}
51
- data-test-id={dataTestId}
52
- {...restProps}
53
- >
54
- {React.Children.map(children, (child, index) => React.cloneElement(child, { index }))}
55
- </tr>
37
+ export const TRow = forwardRef<HTMLTableRowElement, TRowProps>(
38
+ ({ children, className, selected, withoutBorder, dataTestId, ...restProps }, ref) => (
39
+ <tr
40
+ className={cn(styles.component, className, {
41
+ [styles.clickable]: typeof restProps.onClick !== 'undefined',
42
+ [styles.selected]: selected,
43
+ [styles.withoutBorder]: withoutBorder,
44
+ })}
45
+ data-test-id={dataTestId}
46
+ ref={ref}
47
+ {...restProps}
48
+ >
49
+ {React.Children.map(children, (child, index) => React.cloneElement(child, { index }))}
50
+ </tr>
51
+ ),
56
52
  );
53
+
54
+ TRow.displayName = 'TRow';