@alfalab/core-components-table 2.8.5 → 2.9.1

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 (92) hide show
  1. package/component.d.ts +8 -1
  2. package/components/pagination/Component.js +1 -1
  3. package/components/pagination/index.css +13 -10
  4. package/components/pagination/select-field/index.css +7 -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 +11 -8
  8. package/components/tbody/Component.js +1 -1
  9. package/components/tbody/index.css +5 -2
  10. package/components/tcell/Component.js +1 -1
  11. package/components/tcell/index.css +9 -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 +9 -6
  15. package/components/thead/Component.js +1 -1
  16. package/components/thead/index.css +10 -7
  17. package/components/thead-cell/Component.js +1 -1
  18. package/components/thead-cell/index.css +13 -10
  19. package/components/trow/Component.d.ts +22 -1
  20. package/components/trow/Component.js +5 -4
  21. package/components/trow/index.css +11 -8
  22. package/components/tsortable-head-cell/Component.js +1 -1
  23. package/components/tsortable-head-cell/index.css +12 -9
  24. package/cssm/component.d.ts +8 -1
  25. package/cssm/components/pagination/index.module.css +4 -1
  26. package/cssm/components/pagination/select-field/index.module.css +3 -0
  27. package/cssm/components/table/index.module.css +4 -1
  28. package/cssm/components/tbody/index.module.css +3 -0
  29. package/cssm/components/tcell/index.module.css +3 -0
  30. package/cssm/components/texpandable-row/Component.d.ts +3 -1
  31. package/cssm/components/texpandable-row/Component.js +2 -2
  32. package/cssm/components/texpandable-row/index.module.css +4 -1
  33. package/cssm/components/thead/index.module.css +4 -1
  34. package/cssm/components/thead-cell/index.module.css +4 -1
  35. package/cssm/components/trow/Component.d.ts +22 -1
  36. package/cssm/components/trow/Component.js +4 -3
  37. package/cssm/components/trow/index.module.css +3 -0
  38. package/cssm/components/tsortable-head-cell/index.module.css +4 -1
  39. package/esm/component.d.ts +8 -1
  40. package/esm/components/pagination/Component.js +1 -1
  41. package/esm/components/pagination/index.css +13 -10
  42. package/esm/components/pagination/select-field/index.css +7 -4
  43. package/esm/components/pagination/select-field/index.js +1 -1
  44. package/esm/components/table/Component.js +1 -1
  45. package/esm/components/table/index.css +11 -8
  46. package/esm/components/tbody/Component.js +1 -1
  47. package/esm/components/tbody/index.css +5 -2
  48. package/esm/components/tcell/Component.js +1 -1
  49. package/esm/components/tcell/index.css +9 -6
  50. package/esm/components/texpandable-row/Component.d.ts +3 -1
  51. package/esm/components/texpandable-row/Component.js +3 -3
  52. package/esm/components/texpandable-row/index.css +9 -6
  53. package/esm/components/thead/Component.js +1 -1
  54. package/esm/components/thead/index.css +10 -7
  55. package/esm/components/thead-cell/Component.js +1 -1
  56. package/esm/components/thead-cell/index.css +13 -10
  57. package/esm/components/trow/Component.d.ts +22 -1
  58. package/esm/components/trow/Component.js +6 -5
  59. package/esm/components/trow/index.css +11 -8
  60. package/esm/components/tsortable-head-cell/Component.js +1 -1
  61. package/esm/components/tsortable-head-cell/index.css +12 -9
  62. package/modern/component.d.ts +8 -1
  63. package/modern/components/pagination/Component.js +1 -1
  64. package/modern/components/pagination/index.css +13 -10
  65. package/modern/components/pagination/select-field/index.css +7 -4
  66. package/modern/components/pagination/select-field/index.js +1 -1
  67. package/modern/components/table/Component.js +1 -1
  68. package/modern/components/table/index.css +11 -8
  69. package/modern/components/tbody/Component.js +1 -1
  70. package/modern/components/tbody/index.css +5 -2
  71. package/modern/components/tcell/Component.js +1 -1
  72. package/modern/components/tcell/index.css +9 -6
  73. package/modern/components/texpandable-row/Component.d.ts +3 -1
  74. package/modern/components/texpandable-row/Component.js +3 -3
  75. package/modern/components/texpandable-row/index.css +9 -6
  76. package/modern/components/thead/Component.js +1 -1
  77. package/modern/components/thead/index.css +10 -7
  78. package/modern/components/thead-cell/Component.js +1 -1
  79. package/modern/components/thead-cell/index.css +13 -10
  80. package/modern/components/trow/Component.d.ts +22 -1
  81. package/modern/components/trow/Component.js +5 -4
  82. package/modern/components/trow/index.css +11 -8
  83. package/modern/components/tsortable-head-cell/Component.js +1 -1
  84. package/modern/components/tsortable-head-cell/index.css +12 -9
  85. package/moderncssm/component.d.ts +8 -1
  86. package/moderncssm/components/texpandable-row/Component.d.ts +3 -1
  87. package/moderncssm/components/texpandable-row/Component.js +2 -2
  88. package/moderncssm/components/trow/Component.d.ts +22 -1
  89. package/moderncssm/components/trow/Component.js +4 -3
  90. package/package.json +3 -3
  91. package/src/components/texpandable-row/Component.tsx +5 -1
  92. package/src/components/trow/Component.tsx +18 -20
@@ -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';