@alfalab/core-components-table 2.5.11 → 2.6.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 (139) hide show
  1. package/components/pagination/Component.js +1 -1
  2. package/components/pagination/index.css +9 -9
  3. package/components/pagination/select-field/index.css +4 -4
  4. package/components/pagination/select-field/index.js +1 -1
  5. package/components/table/Component.js +1 -1
  6. package/components/table/index.css +7 -7
  7. package/components/tbody/Component.js +1 -1
  8. package/components/tbody/index.css +2 -2
  9. package/components/tcell/Component.js +1 -1
  10. package/components/tcell/index.css +6 -6
  11. package/components/texpandable-row/Component.js +1 -1
  12. package/components/texpandable-row/index.css +5 -5
  13. package/components/thead/Component.js +1 -1
  14. package/components/thead/index.css +6 -6
  15. package/components/thead-cell/Component.js +1 -1
  16. package/components/thead-cell/index.css +9 -9
  17. package/components/trow/Component.js +1 -1
  18. package/components/trow/index.css +8 -8
  19. package/components/tsortable-head-cell/Component.js +1 -1
  20. package/components/tsortable-head-cell/index.css +8 -8
  21. package/esm/components/pagination/Component.js +1 -1
  22. package/esm/components/pagination/index.css +9 -9
  23. package/esm/components/pagination/select-field/index.css +4 -4
  24. package/esm/components/pagination/select-field/index.js +1 -1
  25. package/esm/components/table/Component.js +1 -1
  26. package/esm/components/table/index.css +7 -7
  27. package/esm/components/tbody/Component.js +1 -1
  28. package/esm/components/tbody/index.css +2 -2
  29. package/esm/components/tcell/Component.js +1 -1
  30. package/esm/components/tcell/index.css +6 -6
  31. package/esm/components/texpandable-row/Component.js +1 -1
  32. package/esm/components/texpandable-row/index.css +5 -5
  33. package/esm/components/thead/Component.js +1 -1
  34. package/esm/components/thead/index.css +6 -6
  35. package/esm/components/thead-cell/Component.js +1 -1
  36. package/esm/components/thead-cell/index.css +9 -9
  37. package/esm/components/trow/Component.js +1 -1
  38. package/esm/components/trow/index.css +8 -8
  39. package/esm/components/tsortable-head-cell/Component.js +1 -1
  40. package/esm/components/tsortable-head-cell/index.css +8 -8
  41. package/modern/components/pagination/Component.js +1 -1
  42. package/modern/components/pagination/index.css +9 -9
  43. package/modern/components/pagination/select-field/index.css +4 -4
  44. package/modern/components/pagination/select-field/index.js +1 -1
  45. package/modern/components/table/Component.js +1 -1
  46. package/modern/components/table/index.css +7 -7
  47. package/modern/components/tbody/Component.js +1 -1
  48. package/modern/components/tbody/index.css +2 -2
  49. package/modern/components/tcell/Component.js +1 -1
  50. package/modern/components/tcell/index.css +6 -6
  51. package/modern/components/texpandable-row/Component.js +1 -1
  52. package/modern/components/texpandable-row/index.css +5 -5
  53. package/modern/components/thead/Component.js +1 -1
  54. package/modern/components/thead/index.css +6 -6
  55. package/modern/components/thead-cell/Component.js +1 -1
  56. package/modern/components/thead-cell/index.css +9 -9
  57. package/modern/components/trow/Component.js +1 -1
  58. package/modern/components/trow/index.css +8 -8
  59. package/modern/components/tsortable-head-cell/Component.js +1 -1
  60. package/modern/components/tsortable-head-cell/index.css +8 -8
  61. package/moderncssm/component.d.ts +21 -0
  62. package/moderncssm/component.js +22 -0
  63. package/moderncssm/components/index.d.ts +9 -0
  64. package/moderncssm/components/index.js +9 -0
  65. package/moderncssm/components/pagination/Component.d.ts +26 -0
  66. package/moderncssm/components/pagination/Component.js +33 -0
  67. package/moderncssm/components/pagination/index.d.ts +1 -0
  68. package/moderncssm/components/pagination/index.js +1 -0
  69. package/moderncssm/components/pagination/index.module.css +44 -0
  70. package/moderncssm/components/pagination/select-field/index.d.ts +3 -0
  71. package/moderncssm/components/pagination/select-field/index.js +12 -0
  72. package/moderncssm/components/pagination/select-field/index.module.css +11 -0
  73. package/moderncssm/components/table/Component.d.ts +72 -0
  74. package/moderncssm/components/table/Component.js +32 -0
  75. package/moderncssm/components/table/index.d.ts +1 -0
  76. package/moderncssm/components/table/index.js +1 -0
  77. package/moderncssm/components/table/index.module.css +33 -0
  78. package/moderncssm/components/table/utils.d.ts +5 -0
  79. package/moderncssm/components/table/utils.js +17 -0
  80. package/moderncssm/components/table-context/index.d.ts +20 -0
  81. package/moderncssm/components/table-context/index.js +12 -0
  82. package/moderncssm/components/tbody/Component.d.ts +15 -0
  83. package/moderncssm/components/tbody/Component.js +7 -0
  84. package/moderncssm/components/tbody/index.d.ts +1 -0
  85. package/moderncssm/components/tbody/index.js +1 -0
  86. package/moderncssm/components/tbody/index.module.css +6 -0
  87. package/moderncssm/components/tcell/Component.d.ts +19 -0
  88. package/moderncssm/components/tcell/Component.js +17 -0
  89. package/moderncssm/components/tcell/index.d.ts +1 -0
  90. package/moderncssm/components/tcell/index.js +1 -0
  91. package/moderncssm/components/tcell/index.module.css +37 -0
  92. package/moderncssm/components/texpandable-row/Component.d.ts +12 -0
  93. package/moderncssm/components/texpandable-row/Component.js +24 -0
  94. package/moderncssm/components/texpandable-row/index.d.ts +1 -0
  95. package/moderncssm/components/texpandable-row/index.js +1 -0
  96. package/moderncssm/components/texpandable-row/index.module.css +21 -0
  97. package/moderncssm/components/thead/Component.d.ts +19 -0
  98. package/moderncssm/components/thead/Component.js +8 -0
  99. package/moderncssm/components/thead/index.d.ts +1 -0
  100. package/moderncssm/components/thead/index.js +1 -0
  101. package/moderncssm/components/thead/index.module.css +32 -0
  102. package/moderncssm/components/thead-cell/Component.d.ts +28 -0
  103. package/moderncssm/components/thead-cell/Component.js +15 -0
  104. package/moderncssm/components/thead-cell/index.d.ts +1 -0
  105. package/moderncssm/components/thead-cell/index.js +1 -0
  106. package/moderncssm/components/thead-cell/index.module.css +51 -0
  107. package/moderncssm/components/trow/Component.d.ts +29 -0
  108. package/moderncssm/components/trow/Component.js +11 -0
  109. package/moderncssm/components/trow/index.d.ts +1 -0
  110. package/moderncssm/components/trow/index.js +1 -0
  111. package/moderncssm/components/trow/index.module.css +33 -0
  112. package/moderncssm/components/tsortable-head-cell/Component.d.ts +10 -0
  113. package/moderncssm/components/tsortable-head-cell/Component.js +26 -0
  114. package/moderncssm/components/tsortable-head-cell/index.d.ts +1 -0
  115. package/moderncssm/components/tsortable-head-cell/index.js +1 -0
  116. package/moderncssm/components/tsortable-head-cell/index.module.css +41 -0
  117. package/moderncssm/components/tsortable-head-cell/sort-icon-asc.d.ts +5 -0
  118. package/moderncssm/components/tsortable-head-cell/sort-icon-asc.js +6 -0
  119. package/moderncssm/components/tsortable-head-cell/sort-icon-desc.d.ts +5 -0
  120. package/moderncssm/components/tsortable-head-cell/sort-icon-desc.js +6 -0
  121. package/moderncssm/components/tsortable-head-cell/sort-icon-unset.d.ts +5 -0
  122. package/moderncssm/components/tsortable-head-cell/sort-icon-unset.js +6 -0
  123. package/moderncssm/index.d.ts +1 -0
  124. package/moderncssm/index.js +1 -0
  125. package/moderncssm/typings.d.ts +2 -0
  126. package/moderncssm/typings.js +1 -0
  127. package/moderncssm/utils.d.ts +4 -0
  128. package/moderncssm/utils.js +8 -0
  129. package/package.json +6 -6
  130. package/src/components/pagination/index.module.css +1 -1
  131. package/src/components/pagination/select-field/index.module.css +1 -1
  132. package/src/components/table/index.module.css +1 -1
  133. package/src/components/tbody/index.module.css +1 -1
  134. package/src/components/tcell/index.module.css +1 -1
  135. package/src/components/texpandable-row/index.module.css +1 -1
  136. package/src/components/thead/index.module.css +1 -1
  137. package/src/components/thead-cell/index.module.css +1 -1
  138. package/src/components/trow/index.module.css +1 -1
  139. package/src/components/tsortable-head-cell/index.module.css +1 -1
@@ -1,4 +1,4 @@
1
- /* hash: pembq */
1
+ /* hash: 1wydy */
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-base-bg-primary: #fff;
@@ -29,7 +29,7 @@
29
29
  --gap-32: var(--gap-2xl);
30
30
  } :root {
31
31
  } :root {
32
- } .table__component_1bmu1 {
32
+ } .table__component_j0unk {
33
33
  font-size: 12px;
34
34
  line-height: 16px;
35
35
  font-weight: 500;
@@ -44,23 +44,23 @@
44
44
  background: var(--color-light-base-bg-primary);
45
45
  vertical-align: top;
46
46
  box-sizing: border-box
47
- } .table__component_1bmu1:first-child {
47
+ } .table__component_j0unk:first-child {
48
48
  padding-left: var(--gap-16);
49
- } .table__component_1bmu1:last-child {
49
+ } .table__component_j0unk:last-child {
50
50
  padding-right: var(--gap-16);
51
- } .table__component_1bmu1:not(.table__stickyHeader_1bmu1) {
51
+ } .table__component_j0unk:not(.table__stickyHeader_j0unk) {
52
52
  position: relative;
53
- } .table__sortable_1bmu1 {
53
+ } .table__sortable_j0unk {
54
54
  cursor: pointer;
55
- } .table__sorted_1bmu1 {
55
+ } .table__sorted_j0unk {
56
56
  color: var(--color-light-text-primary);
57
- } .table__stickyHeader_1bmu1 {
57
+ } .table__stickyHeader_j0unk {
58
58
  top: 0;
59
59
  position: sticky;
60
60
  box-shadow: inset 0 -1px 0 0 rgba(11, 31, 53, 0.16);
61
61
  border: none;
62
62
  z-index: 1;
63
- } .table__compactHorizontal_1bmu1 {
63
+ } .table__compactHorizontal_j0unk {
64
64
  padding-left: 6px;
65
65
  padding-right: 6px;
66
66
  }
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import cn from 'classnames';
3
3
 
4
- const styles = {"component":"table__component_79umr","withoutBorder":"table__withoutBorder_79umr","clickable":"table__clickable_79umr","selected":"table__selected_79umr"};
4
+ const styles = {"component":"table__component_n08ka","withoutBorder":"table__withoutBorder_n08ka","clickable":"table__clickable_n08ka","selected":"table__selected_n08ka"};
5
5
  require('./index.css')
6
6
 
7
7
  const TRow = ({ children, className, selected, withoutBorder, dataTestId, ...restProps }) => (React.createElement("tr", { className: cn(styles.component, className, {
@@ -1,4 +1,4 @@
1
- /* hash: vdf2l */
1
+ /* hash: 1w9fh */
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-base-bg-primary: #fff;
@@ -21,22 +21,22 @@
21
21
  /* новые значения, используйте их */
22
22
  } :root {
23
23
  } :root {
24
- } .table__component_79umr {
24
+ } .table__component_n08ka {
25
25
  padding-top: 1px;
26
26
  width: 100%;
27
27
  transition: background-color 0.2s;
28
28
  box-sizing: border-box;
29
29
  background: var(--color-light-base-bg-primary)
30
- } .table__component_79umr:first-child td {
30
+ } .table__component_n08ka:first-child td {
31
31
  border-top: 0;
32
- } .table__withoutBorder_79umr td {
32
+ } .table__withoutBorder_n08ka td {
33
33
  border: none;
34
- } .table__clickable_79umr {
34
+ } .table__clickable_n08ka {
35
35
  cursor: pointer
36
- } .table__clickable_79umr:hover {
36
+ } .table__clickable_n08ka:hover {
37
37
  background-color: var(--color-light-base-bg-secondary);
38
- } .table__selected_79umr {
38
+ } .table__selected_n08ka {
39
39
  background-color: #f2f8ff /* нет цвета в палитре */
40
- } .table__selected_79umr:hover {
40
+ } .table__selected_n08ka:hover {
41
41
  background-color: var(--color-static-graphic-solitude);
42
42
  }
@@ -5,7 +5,7 @@ import { SortIconAsc } from './sort-icon-asc.js';
5
5
  import { SortIconDesc } from './sort-icon-desc.js';
6
6
  import { SortIconUnset } from './sort-icon-unset.js';
7
7
 
8
- const styles = {"content":"table__content_n3qm7","icon":"table__icon_n3qm7","reverse":"table__reverse_n3qm7","sorted":"table__sorted_n3qm7"};
8
+ const styles = {"content":"table__content_1wxe9","icon":"table__icon_1wxe9","reverse":"table__reverse_1wxe9","sorted":"table__sorted_1wxe9"};
9
9
  require('./index.css')
10
10
 
11
11
  const TSortableHeadCell = ({ children, className, defaultIsSortedDesc, isSortedDesc, textAlign, onSort, ...restProps }) => {
@@ -1,4 +1,4 @@
1
- /* hash: uize6 */
1
+ /* hash: c0pmz */
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;
@@ -23,10 +23,10 @@
23
23
  --gap-8: var(--gap-xs);
24
24
  } :root {
25
25
  } :root {
26
- } .table__content_n3qm7 {
26
+ } .table__content_1wxe9 {
27
27
  display: flex;
28
28
  align-items: flex-start;
29
- } .table__icon_n3qm7 {
29
+ } .table__icon_1wxe9 {
30
30
  cursor: pointer;
31
31
  margin-left: var(--gap-8);
32
32
 
@@ -38,15 +38,15 @@
38
38
  color: var(--color-light-neutral-700);
39
39
  transition: color 0.2s ease;
40
40
  flex-shrink: 0
41
- } .table__icon_n3qm7:hover {
41
+ } .table__icon_1wxe9:hover {
42
42
  color: var(--color-light-neutral-translucent-1300);
43
- } .table__reverse_n3qm7 {
43
+ } .table__reverse_1wxe9 {
44
44
  flex-direction: row-reverse
45
- } .table__reverse_n3qm7 .table__icon_n3qm7 {
45
+ } .table__reverse_1wxe9 .table__icon_1wxe9 {
46
46
  margin-left: 0;
47
47
  margin-right: var(--gap-8);
48
- } .table__sorted_n3qm7 {
48
+ } .table__sorted_1wxe9 {
49
49
  color: var(--color-light-status-info)
50
- } .table__sorted_n3qm7:hover {
50
+ } .table__sorted_1wxe9:hover {
51
51
  color: var(--color-light-status-info);
52
52
  }
@@ -0,0 +1,21 @@
1
+ /// <reference types="react" />
2
+ declare const Table: import("react").ForwardRefExoticComponent<import("react").TableHTMLAttributes<HTMLTableElement> & {
3
+ compactView?: boolean | undefined;
4
+ compactHorizontal?: boolean | undefined;
5
+ className?: string | undefined;
6
+ children: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>[];
7
+ wrapper?: boolean | undefined;
8
+ pagination?: import("react").ReactNode;
9
+ dataTestId?: string | undefined;
10
+ stickyHeader?: boolean | undefined;
11
+ } & import("react").RefAttributes<HTMLTableElement>> & {
12
+ TBody: import("react").FC<import("./components/index").TBodyProps>;
13
+ THead: import("react").FC<import("./components/index").THeadProps>;
14
+ THeadCell: ({ children, className, dataTestId, style, width, textAlign, hidden, ...restProps }: import("./components/index").THeadCellProps) => import("react").JSX.Element | null;
15
+ TSortableHeadCell: ({ children, className, defaultIsSortedDesc, isSortedDesc, textAlign, onSort, ...restProps }: import("./components/index").TSortableHeadCellProps) => import("react").JSX.Element;
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;
18
+ TExpandableRow: ({ className, selected, expanded, defaultExpanded, onToggle, renderContent, ...restProps }: import("./components/index").TExpandableRowProps) => import("react").JSX.Element;
19
+ Pagination: import("react").FC<import("./components/index").PaginationProps>;
20
+ };
21
+ export { Table };
@@ -0,0 +1,22 @@
1
+ import { Table as Table$1 } from './components/table/Component.js';
2
+ import { Pagination } from './components/pagination/Component.js';
3
+ import { THead } from './components/thead/Component.js';
4
+ import { THeadCell } from './components/thead-cell/Component.js';
5
+ import { TSortableHeadCell } from './components/tsortable-head-cell/Component.js';
6
+ import { TBody } from './components/tbody/Component.js';
7
+ import { TCell } from './components/tcell/Component.js';
8
+ import { TRow } from './components/trow/Component.js';
9
+ import { TExpandableRow } from './components/texpandable-row/Component.js';
10
+
11
+ const Table = Object.assign(Table$1, {
12
+ TBody,
13
+ THead,
14
+ THeadCell,
15
+ TSortableHeadCell,
16
+ TCell,
17
+ TRow,
18
+ TExpandableRow,
19
+ Pagination,
20
+ });
21
+
22
+ export { Table };
@@ -0,0 +1,9 @@
1
+ export * from "./table/index";
2
+ export * from "./pagination/index";
3
+ export * from "./thead/index";
4
+ export * from "./thead-cell/index";
5
+ export * from "./tsortable-head-cell/index";
6
+ export * from "./tbody/index";
7
+ export * from "./tcell/index";
8
+ export * from "./trow/index";
9
+ export * from "./texpandable-row/index";
@@ -0,0 +1,9 @@
1
+ export { Table } from './table/Component.js';
2
+ export { Pagination } from './pagination/Component.js';
3
+ export { THead } from './thead/Component.js';
4
+ export { THeadCell } from './thead-cell/Component.js';
5
+ export { TSortableHeadCell } from './tsortable-head-cell/Component.js';
6
+ export { TBody } from './tbody/Component.js';
7
+ export { TCell } from './tcell/Component.js';
8
+ export { TRow } from './trow/Component.js';
9
+ export { TExpandableRow } from './texpandable-row/Component.js';
@@ -0,0 +1,26 @@
1
+ import { FC } from 'react';
2
+ import { PaginationProps as CorePaginationProps } from "@alfalab/core-components-pagination";
3
+ type PaginationProps = CorePaginationProps & {
4
+ /**
5
+ * Количество строк на страницу
6
+ */
7
+ perPage?: number;
8
+ /**
9
+ * Возможные варианты разбивки
10
+ */
11
+ possiblePerPage?: number[];
12
+ /**
13
+ * Обработчик переключения perPage
14
+ */
15
+ onPerPageChange?: (perPage: number) => void;
16
+ /**
17
+ * Скрывает переключатель количества строк на страницу
18
+ */
19
+ hidePerPageSelect?: boolean;
20
+ /**
21
+ * Идентификатор для систем автоматизированного тестирования
22
+ */
23
+ dataTestId?: string;
24
+ };
25
+ declare const Pagination: FC<PaginationProps>;
26
+ export { PaginationProps, Pagination };
@@ -0,0 +1,33 @@
1
+ import React, { useContext, useMemo, useCallback } from 'react';
2
+ import cn from 'classnames';
3
+ import { Pagination as Pagination$1 } from '@alfalab/core-components-pagination/moderncssm';
4
+ import { SelectDesktop } from '@alfalab/core-components-select/moderncssm/desktop';
5
+ import { TableContext } from '../table-context/index.js';
6
+ import { CustomSelectField } from './select-field/index.js';
7
+ import styles from './index.module.css';
8
+
9
+ const Pagination = ({ perPage = 25, possiblePerPage = [25, 50, 100], onPerPageChange = () => null, hidePerPageSelect = false, pagesCount, onPageChange = () => null, className, dataTestId, ...restPaginationProps }) => {
10
+ const { wrapperRef } = useContext(TableContext);
11
+ const options = useMemo(() => Array.from(new Set(possiblePerPage.concat(perPage)))
12
+ .sort((a, b) => a - b)
13
+ .map((value) => ({
14
+ key: value.toString(),
15
+ content: `Показывать по ${value}`,
16
+ })), [perPage, possiblePerPage]);
17
+ const handlePerPageChange = useCallback(({ selected }) => {
18
+ onPerPageChange(Number(selected?.key));
19
+ }, [onPerPageChange]);
20
+ const handlePageChange = useCallback((pageIndex) => {
21
+ onPageChange(pageIndex);
22
+ setTimeout(() => {
23
+ if (wrapperRef.current) {
24
+ wrapperRef.current.scrollIntoView();
25
+ }
26
+ }, 0);
27
+ }, [onPageChange, wrapperRef]);
28
+ return (React.createElement("div", { className: cn(styles.component, className), "data-test-id": dataTestId },
29
+ hidePerPageSelect === false && (React.createElement(SelectDesktop, { options: options, selected: perPage.toString(), onChange: handlePerPageChange, preventFlip: false, size: 's', className: styles.select, optionsListClassName: styles.menu, optionClassName: styles.option, Field: CustomSelectField })),
30
+ pagesCount > 1 && (React.createElement(Pagination$1, { pagesCount: pagesCount, onPageChange: handlePageChange, className: styles.pagination, ...restPaginationProps }))));
31
+ };
32
+
33
+ export { Pagination };
@@ -0,0 +1 @@
1
+ export * from "./Component";
@@ -0,0 +1 @@
1
+ export { Pagination } from './Component.js';
@@ -0,0 +1,44 @@
1
+ /* */
2
+
3
+ .component {
4
+ position: sticky;
5
+ left: 0;
6
+ display: flex;
7
+ justify-content: space-between;
8
+ align-items: flex-start;
9
+ width: 100%;
10
+ padding: var(--gap-24) var(--gap-16) var(--gap-32);
11
+ border-top: 1px solid var(--color-light-neutral-400);
12
+ box-sizing: border-box;
13
+ }
14
+
15
+ .pagesWrapper {
16
+ display: flex;
17
+ }
18
+
19
+ .tag.tag {
20
+ flex-shrink: 0;
21
+ margin-right: var(--gap-8);
22
+ padding: 0 var(--gap-8);
23
+ min-width: 32px
24
+ }
25
+
26
+ .tag.tag:last-child {
27
+ margin-right: 0;
28
+ }
29
+
30
+ .tag.tag.tagActive {
31
+ cursor: default;
32
+ }
33
+
34
+ .pagination {
35
+ margin-left: auto;
36
+ }
37
+
38
+ .menu {
39
+ margin: var(--gap-4) 0;
40
+ }
41
+
42
+ .option {
43
+ min-width: 208px;
44
+ }
@@ -0,0 +1,3 @@
1
+ import { SelectProps } from "@alfalab/core-components-select";
2
+ declare const CustomSelectField: SelectProps['Field'];
3
+ export { CustomSelectField };
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import cn from 'classnames';
3
+ import { Button } from '@alfalab/core-components-button/moderncssm';
4
+ import styles from './index.module.css';
5
+
6
+ const CustomSelectField = ({ selected, innerProps, Arrow, open }) => {
7
+ const { ref, ...restInnerProps } = innerProps;
8
+ return (React.createElement("div", { ref: ref },
9
+ React.createElement(Button, { ...restInnerProps, size: 'xxs', view: 'transparent', className: cn(styles.field, { [styles.open]: open }), rightAddons: Arrow }, selected?.content)));
10
+ };
11
+
12
+ export { CustomSelectField };
@@ -0,0 +1,11 @@
1
+ /* */
2
+
3
+ .field svg {
4
+ width: 18px;
5
+ height: 18px;
6
+ }
7
+
8
+ .open,
9
+ .open:hover {
10
+ background-color: var(--color-light-neutral-translucent-200-hover);
11
+ }
@@ -0,0 +1,72 @@
1
+ /// <reference types="react" />
2
+ import React from 'react';
3
+ import { ReactNode, TableHTMLAttributes } from "react";
4
+ type TableProps = TableHTMLAttributes<HTMLTableElement> & {
5
+ /**
6
+ * Компактный вид
7
+ */
8
+ compactView?: boolean;
9
+ /**
10
+ * Уменьшение горизонтальных паддингов
11
+ */
12
+ compactHorizontal?: boolean;
13
+ /**
14
+ * Дополнительный класс
15
+ */
16
+ className?: string;
17
+ /**
18
+ * Дочерние компоненты
19
+ */
20
+ children: React.ReactElement | React.ReactElement[];
21
+ /**
22
+ * Оборачивает таблицу в стилизованный контейнер
23
+ */
24
+ wrapper?: boolean;
25
+ /**
26
+ * Слот для пагинации
27
+ */
28
+ pagination?: ReactNode;
29
+ /**
30
+ * Идентификатор для систем автоматизированного тестирования
31
+ */
32
+ dataTestId?: string;
33
+ /**
34
+ * Если true то заголовок будет фиксироваться при скроле
35
+ */
36
+ stickyHeader?: boolean;
37
+ };
38
+ declare const Table: React.ForwardRefExoticComponent<React.TableHTMLAttributes<HTMLTableElement> & {
39
+ /**
40
+ * Компактный вид
41
+ */
42
+ compactView?: boolean | undefined;
43
+ /**
44
+ * Уменьшение горизонтальных паддингов
45
+ */
46
+ compactHorizontal?: boolean | undefined;
47
+ /**
48
+ * Дополнительный класс
49
+ */
50
+ className?: string | undefined;
51
+ /**
52
+ * Дочерние компоненты
53
+ */
54
+ children: React.ReactElement | React.ReactElement[];
55
+ /**
56
+ * Оборачивает таблицу в стилизованный контейнер
57
+ */
58
+ wrapper?: boolean | undefined;
59
+ /**
60
+ * Слот для пагинации
61
+ */
62
+ pagination?: ReactNode;
63
+ /**
64
+ * Идентификатор для систем автоматизированного тестирования
65
+ */
66
+ dataTestId?: string | undefined;
67
+ /**
68
+ * Если true то заголовок будет фиксироваться при скроле
69
+ */
70
+ stickyHeader?: boolean | undefined;
71
+ } & React.RefAttributes<HTMLTableElement>>;
72
+ export { TableProps, Table };
@@ -0,0 +1,32 @@
1
+ import React, { forwardRef, useRef, useMemo } from 'react';
2
+ import cn from 'classnames';
3
+ import { TableContext } from '../table-context/index.js';
4
+ import { findAllHeadCellsProps } from './utils.js';
5
+ import styles from './index.module.css';
6
+
7
+ const Table = forwardRef(({ className, children, compactView = false, compactHorizontal = false, wrapper = true, pagination, dataTestId, stickyHeader = false, ...restProps }, ref) => {
8
+ const wrapperRef = useRef(null);
9
+ const columnsConfiguration = useMemo(() => findAllHeadCellsProps(children).map((columnProps, index) => ({
10
+ width: columnProps.width,
11
+ textAlign: columnProps.textAlign,
12
+ hidden: columnProps.hidden,
13
+ index,
14
+ })), [children]);
15
+ /* eslint-disable react/jsx-no-constructed-context-values */
16
+ return (React.createElement(TableContext.Provider, { value: {
17
+ stickyHeader,
18
+ columnsConfiguration,
19
+ compactView,
20
+ compactHorizontal,
21
+ wrapperRef,
22
+ } },
23
+ React.createElement("div", { ref: wrapperRef, className: cn(styles.component, className, {
24
+ [styles.wrapper]: wrapper,
25
+ [styles.hasPagination]: !!pagination,
26
+ [styles.stickyHeader]: stickyHeader,
27
+ }), "data-test-id": dataTestId },
28
+ React.createElement("table", { ref: ref, className: styles.table, ...restProps }, children),
29
+ pagination)));
30
+ });
31
+
32
+ export { Table };
@@ -0,0 +1 @@
1
+ export * from "./Component";
@@ -0,0 +1 @@
1
+ export { Table } from './Component.js';
@@ -0,0 +1,33 @@
1
+ /* */
2
+
3
+ .component {
4
+ box-sizing: border-box;
5
+ }
6
+
7
+ .wrapper {
8
+ padding: 0 var(--gap-16) var(--gap-16);
9
+ background: var(--color-light-base-bg-primary);
10
+ box-shadow: var(--shadow-xs-hard);
11
+ border-radius: var(--border-radius-m);
12
+ overflow: auto;
13
+ }
14
+
15
+ .stickyHeader {
16
+ max-height: 100%;
17
+ }
18
+
19
+ .hasPagination {
20
+ padding-bottom: 0;
21
+ }
22
+
23
+ .table {
24
+ width: 100%;
25
+ border-collapse: collapse;
26
+ box-sizing: border-box
27
+
28
+ /* TODO: Хак для выравнивания чекбокса */
29
+ }
30
+
31
+ .table td:first-child label > *[class^='box'], .table th:first-child label > *[class^='box'] {
32
+ margin-top: 0;
33
+ }
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import React from 'react';
3
+ import { THeadCellProps } from "../thead-cell/index";
4
+ declare function findAllHeadCellsProps(children: React.ReactElement | React.ReactElement[]): THeadCellProps[];
5
+ export { findAllHeadCellsProps };
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { isChildInstanceOf } from '../../utils.js';
3
+ import { THead } from '../thead/Component.js';
4
+
5
+ function findAllHeadCellsProps(children) {
6
+ const result = [];
7
+ React.Children.forEach(children, (child) => {
8
+ if (isChildInstanceOf(child, THead)) {
9
+ React.Children.forEach(child.props.children, (headChild) => {
10
+ result.push(headChild.props);
11
+ });
12
+ }
13
+ });
14
+ return result;
15
+ }
16
+
17
+ export { findAllHeadCellsProps };
@@ -0,0 +1,20 @@
1
+ /// <reference types="react" />
2
+ import React from 'react';
3
+ import { RefObject } from "react";
4
+ import { TextAlignProperty } from "../../typings";
5
+ type ColumnConfiguration = {
6
+ width?: string | number;
7
+ textAlign?: TextAlignProperty;
8
+ hidden?: boolean;
9
+ index: number;
10
+ };
11
+ type TableContextType = {
12
+ columnsConfiguration: ColumnConfiguration[];
13
+ stickyHeader: boolean;
14
+ compactView: boolean;
15
+ compactHorizontal: boolean;
16
+ wrapperRef: RefObject<HTMLDivElement>;
17
+ };
18
+ declare const DEFAULT_TABLE_CONTEXT: TableContextType;
19
+ declare const TableContext: React.Context<TableContextType>;
20
+ export { ColumnConfiguration, TableContextType, DEFAULT_TABLE_CONTEXT, TableContext };
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+
3
+ const DEFAULT_TABLE_CONTEXT = {
4
+ columnsConfiguration: [],
5
+ compactView: false,
6
+ stickyHeader: false,
7
+ compactHorizontal: false,
8
+ wrapperRef: { current: null },
9
+ };
10
+ const TableContext = React.createContext(DEFAULT_TABLE_CONTEXT);
11
+
12
+ export { DEFAULT_TABLE_CONTEXT, TableContext };
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ import React from 'react';
3
+ import { HTMLAttributes } from "react";
4
+ type TBodyProps = HTMLAttributes<HTMLTableSectionElement> & {
5
+ /**
6
+ * Дополнительный класс
7
+ */
8
+ className?: string;
9
+ /**
10
+ * Идентификатор для систем автоматизированного тестирования
11
+ */
12
+ dataTestId?: string;
13
+ };
14
+ declare const TBody: React.FC<TBodyProps>;
15
+ export { TBodyProps, TBody };
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import cn from 'classnames';
3
+ import styles from './index.module.css';
4
+
5
+ const TBody = ({ className, children, dataTestId, ...restProps }) => (React.createElement("tbody", { className: cn(styles.component, className), "data-test-id": dataTestId, ...restProps }, children));
6
+
7
+ export { TBody };
@@ -0,0 +1 @@
1
+ export * from "./Component";
@@ -0,0 +1 @@
1
+ export { TBody } from './Component.js';
@@ -0,0 +1,6 @@
1
+ /* */
2
+
3
+ .component {
4
+ width: 100%;
5
+ box-sizing: border-box;
6
+ }
@@ -0,0 +1,19 @@
1
+ /// <reference types="react" />
2
+ import React from 'react';
3
+ import { TdHTMLAttributes } from "react";
4
+ type TCellProps = TdHTMLAttributes<HTMLTableCellElement> & {
5
+ /**
6
+ * Дополнительный класс
7
+ */
8
+ className?: string;
9
+ /**
10
+ * Идентификатор для систем автоматизированного тестирования
11
+ */
12
+ dataTestId?: string;
13
+ /**
14
+ * Устанавливается автоматически и позволяет использовать конфиг для соответствующего индекса
15
+ */
16
+ index?: number;
17
+ };
18
+ declare const TCell: ({ className, style, dataTestId, children, index, ...restProps }: TCellProps) => React.JSX.Element | null;
19
+ export { TCellProps, TCell };
@@ -0,0 +1,17 @@
1
+ import React, { useContext } from 'react';
2
+ import cn from 'classnames';
3
+ import { TableContext } from '../table-context/index.js';
4
+ import styles from './index.module.css';
5
+
6
+ const TCell = ({ className, style, dataTestId, children, index, ...restProps }) => {
7
+ const { columnsConfiguration, compactView, compactHorizontal } = useContext(TableContext);
8
+ const column = index === undefined ? null : columnsConfiguration[index];
9
+ const width = column?.width;
10
+ const textAlign = column?.textAlign;
11
+ const hidden = column?.hidden || false;
12
+ if (hidden)
13
+ return null;
14
+ return (React.createElement("td", { className: cn(styles.component, className, compactView && styles.compact, compactHorizontal && styles.compactHorizontal), style: { ...style, width, textAlign }, "data-test-id": dataTestId, ...restProps }, children));
15
+ };
16
+
17
+ export { TCell };