@snack-uikit/table 0.31.1 → 0.32.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 (71) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +2 -0
  3. package/dist/cjs/components/Table/Table.d.ts +1 -1
  4. package/dist/cjs/components/Table/Table.js +101 -101
  5. package/dist/cjs/components/Table/styles.module.css +4 -3
  6. package/dist/cjs/components/types.d.ts +1 -0
  7. package/dist/cjs/helperComponents/Cells/BodyCell/BodyCell.d.ts +2 -1
  8. package/dist/cjs/helperComponents/Cells/BodyCell/BodyCell.js +4 -2
  9. package/dist/cjs/helperComponents/Cells/BodyCell/styles.module.css +8 -2
  10. package/dist/cjs/helperComponents/Cells/CopyCell/CopyCell.js +1 -1
  11. package/dist/cjs/helperComponents/Cells/HeaderCell/HeaderCell.d.ts +2 -1
  12. package/dist/cjs/helperComponents/Cells/HeaderCell/HeaderCell.js +4 -2
  13. package/dist/cjs/helperComponents/Cells/HeaderCell/styles.module.css +10 -1
  14. package/dist/cjs/helperComponents/Cells/StatusCell/styles.module.css +3 -3
  15. package/dist/cjs/helperComponents/Cells/TreeCell/TreeCell.d.ts +1 -1
  16. package/dist/cjs/helperComponents/Cells/TreeCell/TreeCell.js +28 -30
  17. package/dist/cjs/helperComponents/Cells/TreeCell/TreeLine/styles.module.css +2 -2
  18. package/dist/cjs/helperComponents/Cells/TreeCell/styles.module.css +16 -34
  19. package/dist/cjs/helperComponents/Rows/BodyRow.d.ts +3 -2
  20. package/dist/cjs/helperComponents/Rows/BodyRow.js +9 -4
  21. package/dist/cjs/helperComponents/Rows/HeaderRow.d.ts +2 -1
  22. package/dist/cjs/helperComponents/Rows/HeaderRow.js +11 -4
  23. package/dist/cjs/helperComponents/Rows/Row.d.ts +3 -3
  24. package/dist/cjs/helperComponents/Rows/Row.js +4 -2
  25. package/dist/cjs/helperComponents/Rows/styles.module.css +14 -6
  26. package/dist/cjs/helperComponents/TableEmptyState/styles.module.css +1 -1
  27. package/dist/esm/components/Table/Table.d.ts +1 -1
  28. package/dist/esm/components/Table/Table.js +15 -17
  29. package/dist/esm/components/Table/styles.module.css +4 -3
  30. package/dist/esm/components/types.d.ts +1 -0
  31. package/dist/esm/helperComponents/Cells/BodyCell/BodyCell.d.ts +2 -1
  32. package/dist/esm/helperComponents/Cells/BodyCell/BodyCell.js +2 -2
  33. package/dist/esm/helperComponents/Cells/BodyCell/styles.module.css +8 -2
  34. package/dist/esm/helperComponents/Cells/CopyCell/CopyCell.js +1 -1
  35. package/dist/esm/helperComponents/Cells/HeaderCell/HeaderCell.d.ts +2 -1
  36. package/dist/esm/helperComponents/Cells/HeaderCell/HeaderCell.js +2 -2
  37. package/dist/esm/helperComponents/Cells/HeaderCell/styles.module.css +10 -1
  38. package/dist/esm/helperComponents/Cells/StatusCell/styles.module.css +3 -3
  39. package/dist/esm/helperComponents/Cells/TreeCell/TreeCell.d.ts +1 -1
  40. package/dist/esm/helperComponents/Cells/TreeCell/TreeCell.js +26 -28
  41. package/dist/esm/helperComponents/Cells/TreeCell/TreeLine/TreeLine.js +2 -2
  42. package/dist/esm/helperComponents/Cells/TreeCell/TreeLine/styles.module.css +2 -2
  43. package/dist/esm/helperComponents/Cells/TreeCell/styles.module.css +16 -34
  44. package/dist/esm/helperComponents/Rows/BodyRow.d.ts +3 -2
  45. package/dist/esm/helperComponents/Rows/BodyRow.js +2 -2
  46. package/dist/esm/helperComponents/Rows/HeaderRow.d.ts +2 -1
  47. package/dist/esm/helperComponents/Rows/HeaderRow.js +2 -2
  48. package/dist/esm/helperComponents/Rows/Row.d.ts +3 -3
  49. package/dist/esm/helperComponents/Rows/Row.js +2 -2
  50. package/dist/esm/helperComponents/Rows/styles.module.css +14 -6
  51. package/dist/esm/helperComponents/TableEmptyState/styles.module.css +1 -1
  52. package/package.json +2 -2
  53. package/src/components/Table/Table.tsx +110 -117
  54. package/src/components/Table/styles.module.scss +4 -8
  55. package/src/components/types.ts +3 -0
  56. package/src/helperComponents/Cells/BodyCell/BodyCell.tsx +3 -1
  57. package/src/helperComponents/Cells/BodyCell/styles.module.scss +6 -1
  58. package/src/helperComponents/Cells/CopyCell/CopyCell.tsx +1 -1
  59. package/src/helperComponents/Cells/CopyCell/styles.module.scss +1 -1
  60. package/src/helperComponents/Cells/HeaderCell/HeaderCell.tsx +8 -2
  61. package/src/helperComponents/Cells/HeaderCell/styles.module.scss +9 -0
  62. package/src/helperComponents/Cells/StatusCell/styles.module.scss +9 -7
  63. package/src/helperComponents/Cells/TreeCell/TreeCell.tsx +51 -42
  64. package/src/helperComponents/Cells/TreeCell/TreeLine/TreeLine.tsx +2 -2
  65. package/src/helperComponents/Cells/TreeCell/TreeLine/styles.module.scss +8 -8
  66. package/src/helperComponents/Cells/TreeCell/styles.module.scss +36 -55
  67. package/src/helperComponents/Rows/BodyRow.tsx +7 -6
  68. package/src/helperComponents/Rows/HeaderRow.tsx +15 -6
  69. package/src/helperComponents/Rows/Row.tsx +10 -3
  70. package/src/helperComponents/Rows/styles.module.scss +30 -19
  71. package/src/helperComponents/TableEmptyState/styles.module.scss +1 -1
@@ -1,21 +1,29 @@
1
+ .treeCellContainer{
2
+ position:relative;
3
+ overflow:hidden;
4
+ height:100%;
5
+ font-family:var(--sans-body-m-font-family, SB Sans Interface);
6
+ font-weight:var(--sans-body-m-font-weight, Regular);
7
+ line-height:var(--sans-body-m-line-height, 20px);
8
+ font-size:var(--sans-body-m-font-size, 14px);
9
+ letter-spacing:var(--sans-body-m-letter-spacing, 0.1px);
10
+ paragraph-spacing:var(--sans-body-m-paragraph-spacing, 7.7px);
11
+ }
12
+
1
13
  .treeCell{
2
14
  display:flex;
3
15
  align-items:center;
4
16
  justify-content:start;
5
17
  width:-moz-fit-content;
6
18
  width:fit-content;
7
- height:var(--size-markdown-table-cell-height, 40px);
19
+ height:100%;
8
20
  }
9
21
 
10
22
  .cellUserToggleIcon{
11
- cursor:pointer;
12
23
  display:flex;
13
24
  align-items:center;
14
25
  box-sizing:border-box;
15
26
  }
16
- .cellUserToggleIcon svg{
17
- color:var(--sys-neutral-text-support, #6d707f);
18
- }
19
27
 
20
28
  .treeNodeContent{
21
29
  gap:var(--space-tree-item-content-layout-gap, 4px);
@@ -29,7 +37,8 @@
29
37
  display:flex;
30
38
  align-items:center;
31
39
  box-sizing:border-box;
32
- height:var(--size-markdown-table-cell-height, 40px);
40
+ height:100%;
41
+ color:var(--sys-neutral-text-support, #6d707f);
33
42
  }
34
43
  .treeNodeContent:focus-visible{
35
44
  outline-width:var(--border-state-focus-s-border-width, 2px);
@@ -41,42 +50,15 @@
41
50
  .treeNodeContent[data-multiselect]{
42
51
  cursor:default;
43
52
  }
44
- .treeNodeContent[aria-disabled=true]{
53
+ .treeNodeContent[data-disabled]{
45
54
  cursor:not-allowed;
46
- }
47
- .treeNodeContent[aria-disabled=true]::before{
48
- display:none;
49
- }
50
- .treeNodeContent[aria-disabled=true] .treeNodeTitle, .treeNodeContent[aria-disabled=true] .treeNodeIcon{
51
55
  color:var(--sys-neutral-text-disabled, #aaaebd);
52
56
  }
53
- .treeNodeContent[aria-selected=true]:not([data-multiselect]){
54
- opacity:var(--opacity-a008, 0.08);
55
- background-color:var(--sys-primary-accent-default, #794ed3);
56
- }
57
- .treeNodeContent[aria-selected=true]:not([data-multiselect]):hover{
58
- opacity:var(--opacity-a016, 0.16);
59
- }
60
57
 
61
58
  .userContent{
62
- cursor:pointer;
63
59
  display:flex;
64
60
  align-items:center;
65
61
  }
66
- .userContent svg{
67
- color:var(--sys-neutral-text-support, #6d707f);
68
- }
69
-
70
- .treeCellContainer{
71
- position:relative;
72
- overflow:hidden;
73
- font-family:var(--sans-body-m-font-family, SB Sans Interface);
74
- font-weight:var(--sans-body-m-font-weight, Regular);
75
- line-height:var(--sans-body-m-line-height, 20px);
76
- font-size:var(--sans-body-m-font-size, 14px);
77
- letter-spacing:var(--sans-body-m-letter-spacing, 0.1px);
78
- paragraph-spacing:var(--sans-body-m-paragraph-spacing, 7.7px);
79
- }
80
62
 
81
63
  .line{
82
64
  margin-left:calc(var(--dimension-4m, 32px) + var(--dimension-025m, 2px));
@@ -1,5 +1,6 @@
1
1
  import { Row as TableRow } from '@tanstack/react-table';
2
2
  import { MouseEvent } from 'react';
3
+ import { RowProps } from './Row';
3
4
  export type RowInfo<TData> = {
4
5
  id: string;
5
6
  data: TData;
@@ -7,8 +8,8 @@ export type RowInfo<TData> = {
7
8
  toggleSelected(value?: boolean): void;
8
9
  };
9
10
  export type RowClickHandler<TData> = (e: MouseEvent<HTMLDivElement>, row: RowInfo<TData>) => void;
10
- export type BodyRowProps<TData> = {
11
+ export type BodyRowProps<TData> = Pick<RowProps, 'rowAutoHeight'> & {
11
12
  row: TableRow<TData>;
12
13
  onRowClick?: RowClickHandler<TData>;
13
14
  };
14
- export declare function BodyRow<TData>({ row, onRowClick }: BodyRowProps<TData>): import("react/jsx-runtime").JSX.Element;
15
+ export declare function BodyRow<TData>({ row, onRowClick, rowAutoHeight }: BodyRowProps<TData>): import("react/jsx-runtime").JSX.Element;
@@ -21,7 +21,8 @@ const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
21
21
  function BodyRow(_ref) {
22
22
  let {
23
23
  row,
24
- onRowClick
24
+ onRowClick,
25
+ rowAutoHeight
25
26
  } = _ref;
26
27
  const {
27
28
  pinnedLeft,
@@ -53,17 +54,21 @@ function BodyRow(_ref) {
53
54
  "data-test-id": constants_1.TEST_IDS.bodyRow,
54
55
  "data-row-id": row.id,
55
56
  className: styles_module_scss_1.default.bodyRow,
57
+ rowAutoHeight: rowAutoHeight,
56
58
  children: [pinnedLeft && (0, jsx_runtime_1.jsx)(PinnedCells_1.PinnedCells, {
57
59
  position: constants_1.COLUMN_PIN_POSITION.Left,
58
60
  children: pinnedLeft.map(cell => (0, jsx_runtime_1.jsx)(Cells_1.BodyCell, {
59
- cell: cell
61
+ cell: cell,
62
+ rowAutoHeight: rowAutoHeight
60
63
  }, cell.id))
61
64
  }), unpinned.map(cell => (0, jsx_runtime_1.jsx)(Cells_1.BodyCell, {
62
- cell: cell
65
+ cell: cell,
66
+ rowAutoHeight: rowAutoHeight
63
67
  }, cell.id)), pinnedRight && (0, jsx_runtime_1.jsx)(PinnedCells_1.PinnedCells, {
64
68
  position: constants_1.COLUMN_PIN_POSITION.Right,
65
69
  children: pinnedRight.map(cell => (0, jsx_runtime_1.jsx)(Cells_1.BodyCell, {
66
- cell: cell
70
+ cell: cell,
71
+ rowAutoHeight: rowAutoHeight
67
72
  }, cell.id))
68
73
  })]
69
74
  })
@@ -1 +1,2 @@
1
- export declare function HeaderRow(): import("react/jsx-runtime").JSX.Element;
1
+ import { RowProps } from './Row';
2
+ export declare function HeaderRow({ rowAutoHeight }: Pick<RowProps, 'rowAutoHeight'>): import("react/jsx-runtime").JSX.Element;
@@ -16,7 +16,10 @@ const hooks_1 = require("../hooks");
16
16
  const PinnedCells_1 = require("./PinnedCells");
17
17
  const Row_1 = require("./Row");
18
18
  const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
19
- function HeaderRow() {
19
+ function HeaderRow(_ref) {
20
+ let {
21
+ rowAutoHeight
22
+ } = _ref;
20
23
  const {
21
24
  leftPinned,
22
25
  unpinned,
@@ -25,18 +28,22 @@ function HeaderRow() {
25
28
  return (0, jsx_runtime_1.jsxs)(Row_1.Row, {
26
29
  className: styles_module_scss_1.default.tableHeader,
27
30
  "data-test-id": constants_1.TEST_IDS.headerRow,
31
+ rowAutoHeight: rowAutoHeight,
28
32
  children: [leftPinned && (0, jsx_runtime_1.jsx)(PinnedCells_1.PinnedCells, {
29
33
  position: constants_1.COLUMN_PIN_POSITION.Left,
30
34
  children: leftPinned.map(headerGroup => headerGroup.headers.map(header => header.isPlaceholder ? null : (0, jsx_runtime_1.jsx)(Cells_1.HeaderCell, {
31
- header: header
35
+ header: header,
36
+ rowAutoHeight: rowAutoHeight
32
37
  }, header.id)))
33
38
  }), unpinned.map(headerGroup => headerGroup.headers.map(header => (0, jsx_runtime_1.jsx)(Cells_1.HeaderCell, {
34
- header: header
39
+ header: header,
40
+ rowAutoHeight: rowAutoHeight
35
41
  }, header.id))), rightPinned && (0, jsx_runtime_1.jsx)(PinnedCells_1.PinnedCells, {
36
42
  position: constants_1.COLUMN_PIN_POSITION.Right,
37
43
  children: rightPinned.map(headerGroup => headerGroup.headers.map(header => header.isPlaceholder ? null : (0, jsx_runtime_1.jsx)(Cells_1.HeaderCell, {
38
44
  header: header,
39
- pinPosition: constants_1.COLUMN_PIN_POSITION.Right
45
+ pinPosition: constants_1.COLUMN_PIN_POSITION.Right,
46
+ rowAutoHeight: rowAutoHeight
40
47
  }, header.id)))
41
48
  })]
42
49
  });
@@ -1,9 +1,9 @@
1
1
  import { MouseEvent, ReactNode } from 'react';
2
2
  import { DataAttributes } from '../types';
3
- type RowProps = {
3
+ export type RowProps = {
4
4
  children: ReactNode;
5
5
  onClick?(e: MouseEvent<HTMLDivElement>): void;
6
6
  className?: string;
7
+ rowAutoHeight?: boolean;
7
8
  } & DataAttributes;
8
- export declare function Row({ onClick, children, className, ...attributes }: RowProps): import("react/jsx-runtime").JSX.Element;
9
- export {};
9
+ export declare function Row({ onClick, children, className, rowAutoHeight, ...attributes }: RowProps): import("react/jsx-runtime").JSX.Element;
@@ -24,14 +24,16 @@ function Row(_a) {
24
24
  var {
25
25
  onClick,
26
26
  children,
27
- className
27
+ className,
28
+ rowAutoHeight
28
29
  } = _a,
29
- attributes = __rest(_a, ["onClick", "children", "className"]);
30
+ attributes = __rest(_a, ["onClick", "children", "className", "rowAutoHeight"]);
30
31
  return (
31
32
  // eslint-disable-next-line jsx-a11y/interactive-supports-focus
32
33
  (0, jsx_runtime_1.jsx)("div", Object.assign({
33
34
  onClick: onClick,
34
35
  className: (0, classnames_1.default)(styles_module_scss_1.default.tableRow, className),
36
+ "data-auto-height": rowAutoHeight || undefined,
35
37
  role: 'row'
36
38
  }, attributes, {
37
39
  children: children
@@ -1,14 +1,19 @@
1
1
  .tableRow{
2
2
  --snack-ui-table-row-background:var(--sys-neutral-background1-level, #fdfdfd);
3
- height:var(--size-table-line-height, 40px);
4
3
  border-top:var(--border-width-table, 1px);
5
4
  border-bottom:var(--border-width-table, 1px);
5
+ min-height:var(--size-table-line-height, 40px);
6
6
  position:relative;
7
7
  display:flex;
8
8
  box-sizing:border-box;
9
- border-color:transparent;
10
9
  background-color:var(--snack-ui-table-row-background);
10
+ border-color:transparent;
11
11
  border-style:solid none;
12
+ height:var(--size-table-line-height, 40px);
13
+ }
14
+ .tableRow[data-auto-height]{
15
+ height:auto;
16
+ min-height:var(--size-table-line-height, 40px);
12
17
  }
13
18
 
14
19
  .rowPinnedCells{
@@ -49,16 +54,13 @@
49
54
  .bodyRow ~ .bodyRow:before{
50
55
  content:"";
51
56
  position:absolute;
57
+ z-index:2;
52
58
  top:calc(-1 * var(--border-width-table, 1px));
53
59
  left:0;
54
- z-index:2;
55
60
  width:100%;
56
61
  height:var(--border-width-table-line, 0.5px);
57
62
  background-color:var(--sys-neutral-decor-disabled, #e6e8ef);
58
63
  }
59
- .bodyRow:hover::before, .bodyRow:hover + .bodyRow::before{
60
- height:0;
61
- }
62
64
  .bodyRow[data-disabled]{
63
65
  cursor:not-allowed;
64
66
  background-color:var(--sys-neutral-background, #eeeff3);
@@ -84,6 +86,9 @@
84
86
  .bodyRow[data-clickable]{
85
87
  cursor:pointer;
86
88
  }
89
+ .bodyRow:not([data-disabled]):hover::before{
90
+ height:0;
91
+ }
87
92
  .bodyRow:not([data-disabled]):not([data-selected]):hover, .bodyRow:not([data-disabled]):not([data-selected])[data-actions-opened]{
88
93
  background-color:color-mix(in srgb, var(--sys-neutral-accent-default, #787b8a), var(--snack-ui-table-row-background) calc((1 - var(--opacity-a008, 0.08)) * 100%));
89
94
  border-color:var(--sys-neutral-decor-hovered, #cfd2dc);
@@ -92,6 +97,9 @@
92
97
  background-color:color-mix(in srgb, var(--sys-neutral-accent-default, #787b8a), var(--snack-ui-table-row-background) calc((1 - var(--opacity-a008, 0.08)) * 100%));
93
98
  border-color:inherit;
94
99
  }
100
+ .bodyRow:not([data-disabled]):hover + .bodyRow::before{
101
+ height:0;
102
+ }
95
103
 
96
104
  .tableHeader{
97
105
  position:sticky;
@@ -4,6 +4,6 @@
4
4
  align-items:center;
5
5
  justify-content:center;
6
6
  box-sizing:border-box;
7
- height:calc(var(--page-size, 10) * var(--size-table-line-height, 40px) + var(--size-table-line-height, 40px));
7
+ height:var(--size-table-information-min-height, 304px);
8
8
  padding:var(--dimension-3m, 24px);
9
9
  }
@@ -1,7 +1,7 @@
1
1
  import { FiltersState } from '@snack-uikit/chips';
2
2
  import { TableProps } from '../types';
3
3
  /** Компонент таблицы */
4
- export declare function Table<TData extends object, TFilters extends FiltersState = Record<string, unknown>>({ data, rowPinning, columnDefinitions, keepPinnedRows, copyPinnedRows, enableSelectPinned, rowSelection: rowSelectionProp, search, sorting: sortingProp, columnFilters, pagination: paginationProp, className, onRowClick, onRefresh, pageSize, pageCount, loading, infiniteLoading, outline, moreActions, exportSettings, dataFiltered, dataError, noDataState, noResultsState, errorDataState, suppressToolbar, suppressSearch, toolbarAfter, suppressPagination, manualSorting, manualPagination: manualPaginationProp, manualFiltering, autoResetPageIndex, scrollRef, scrollContainerRef, getRowId, enableFuzzySearch, savedState, expanding, bulkActions: bulkActionsProp, ...rest }: TableProps<TData, TFilters>): import("react/jsx-runtime").JSX.Element;
4
+ export declare function Table<TData extends object, TFilters extends FiltersState = Record<string, unknown>>({ data, rowPinning, columnDefinitions, keepPinnedRows, copyPinnedRows, enableSelectPinned, rowSelection: rowSelectionProp, search, sorting: sortingProp, columnFilters, pagination: paginationProp, className, onRowClick, onRefresh, pageSize, pageCount, loading, infiniteLoading, outline, moreActions, exportSettings, dataFiltered, dataError, noDataState, noResultsState, errorDataState, suppressToolbar, suppressSearch, toolbarAfter, suppressPagination, manualSorting, manualPagination: manualPaginationProp, manualFiltering, autoResetPageIndex, scrollRef, scrollContainerRef, getRowId, enableFuzzySearch, savedState, expanding, bulkActions: bulkActionsProp, rowAutoHeight, ...rest }: TableProps<TData, TFilters>): import("react/jsx-runtime").JSX.Element;
5
5
  export declare namespace Table {
6
6
  var getStatusColumnDef: typeof import("../../helperComponents").getStatusColumnDef;
7
7
  var statusAppearances: Record<string, string>;
@@ -32,7 +32,7 @@ import { getColumnStyleVars, getCurrentlyConfiguredHeaderWidth, getInitColumnSiz
32
32
  export function Table(_a) {
33
33
  var { data, rowPinning = {
34
34
  top: [],
35
- }, columnDefinitions, keepPinnedRows = false, copyPinnedRows = false, enableSelectPinned = false, rowSelection: rowSelectionProp, search, sorting: sortingProp, columnFilters, pagination: paginationProp, className, onRowClick, onRefresh, pageSize = DEFAULT_PAGE_SIZE, pageCount, loading = false, infiniteLoading = false, outline = false, moreActions, exportSettings, dataFiltered, dataError, noDataState, noResultsState, errorDataState, suppressToolbar = false, suppressSearch = false, toolbarAfter, suppressPagination = false, manualSorting = false, manualPagination: manualPaginationProp = false, manualFiltering = false, autoResetPageIndex = false, scrollRef, scrollContainerRef, getRowId, enableFuzzySearch, savedState, expanding, bulkActions: bulkActionsProp } = _a, rest = __rest(_a, ["data", "rowPinning", "columnDefinitions", "keepPinnedRows", "copyPinnedRows", "enableSelectPinned", "rowSelection", "search", "sorting", "columnFilters", "pagination", "className", "onRowClick", "onRefresh", "pageSize", "pageCount", "loading", "infiniteLoading", "outline", "moreActions", "exportSettings", "dataFiltered", "dataError", "noDataState", "noResultsState", "errorDataState", "suppressToolbar", "suppressSearch", "toolbarAfter", "suppressPagination", "manualSorting", "manualPagination", "manualFiltering", "autoResetPageIndex", "scrollRef", "scrollContainerRef", "getRowId", "enableFuzzySearch", "savedState", "expanding", "bulkActions"]);
35
+ }, columnDefinitions, keepPinnedRows = false, copyPinnedRows = false, enableSelectPinned = false, rowSelection: rowSelectionProp, search, sorting: sortingProp, columnFilters, pagination: paginationProp, className, onRowClick, onRefresh, pageSize = DEFAULT_PAGE_SIZE, pageCount, loading = false, infiniteLoading = false, outline = false, moreActions, exportSettings, dataFiltered, dataError, noDataState, noResultsState, errorDataState, suppressToolbar = false, suppressSearch = false, toolbarAfter, suppressPagination = false, manualSorting = false, manualPagination: manualPaginationProp = false, manualFiltering = false, autoResetPageIndex = false, scrollRef, scrollContainerRef, getRowId, enableFuzzySearch, savedState, expanding, bulkActions: bulkActionsProp, rowAutoHeight } = _a, rest = __rest(_a, ["data", "rowPinning", "columnDefinitions", "keepPinnedRows", "copyPinnedRows", "enableSelectPinned", "rowSelection", "search", "sorting", "columnFilters", "pagination", "className", "onRowClick", "onRefresh", "pageSize", "pageCount", "loading", "infiniteLoading", "outline", "moreActions", "exportSettings", "dataFiltered", "dataError", "noDataState", "noResultsState", "errorDataState", "suppressToolbar", "suppressSearch", "toolbarAfter", "suppressPagination", "manualSorting", "manualPagination", "manualFiltering", "autoResetPageIndex", "scrollRef", "scrollContainerRef", "getRowId", "enableFuzzySearch", "savedState", "expanding", "bulkActions", "rowAutoHeight"]);
36
36
  const { state: globalFilter, onStateChange: onGlobalFilterChange } = useStateControl(search, '');
37
37
  const { state: rowSelection, onStateChange: onRowSelectionChange } = useStateControl(rowSelectionProp, {});
38
38
  const defaultPaginationState = useMemo(() => ({
@@ -90,7 +90,12 @@ export function Table(_a) {
90
90
  enableSorting: false,
91
91
  enableResizing: false,
92
92
  minSize: 40,
93
- cell: (cell) => _jsx(TruncateString, { text: String(cell.getValue()), maxLines: 1 }),
93
+ cell: (cell) => {
94
+ if (rowAutoHeight) {
95
+ return cell.getValue();
96
+ }
97
+ return _jsx(TruncateString, { text: String(cell.getValue()), maxLines: 1 });
98
+ },
94
99
  },
95
100
  manualSorting,
96
101
  manualPagination,
@@ -221,17 +226,12 @@ export function Table(_a) {
221
226
  const tableFilteredRowsIds = tableFilteredRows.map(row => row.id);
222
227
  const topRows = table.getTopRows();
223
228
  const loadingTableRows = loadingTable.getRowModel().rows;
224
- const tablePagination = table.getState().pagination;
225
229
  const filteredTopRows = table.getState().globalFilter
226
230
  ? topRows.filter(tr => tableFilteredRowsIds.includes(tr.id))
227
231
  : topRows;
228
232
  const centerRows = copyPinnedRows ? tableRows : tableCenterRows;
229
233
  const { t } = useLocale('Table');
230
234
  const emptyStates = useEmptyState({ noDataState, noResultsState, errorDataState });
231
- const cssPageSize = useMemo(() => {
232
- const tempPageSize = (!suppressPagination ? tablePagination === null || tablePagination === void 0 ? void 0 : tablePagination.pageSize : pageSize) + filteredTopRows.length;
233
- return !tableRows.length ? Math.min(Math.max(tempPageSize, 5), DEFAULT_PAGE_SIZE) : tempPageSize;
234
- }, [filteredTopRows.length, pageSize, suppressPagination, tablePagination === null || tablePagination === void 0 ? void 0 : tablePagination.pageSize, tableRows.length]);
235
235
  usePageReset({
236
236
  manualPagination,
237
237
  maximumAvailablePage: pageCount || tableFilteredRows.length / pagination.pageSize,
@@ -241,16 +241,14 @@ export function Table(_a) {
241
241
  });
242
242
  const { updateCellMap } = useCellAutoResizeController(table);
243
243
  const showToolbar = !suppressToolbar;
244
- return (_jsx(CellAutoResizeContext.Provider, { value: { updateCellMap }, children: _jsxs("div", Object.assign({ style: {
245
- '--page-size': cssPageSize,
246
- }, className: cn(styles.wrapper, className) }, extractSupportProps(rest), { children: [showToolbar && (_jsx("div", { className: styles.header, children: _jsx(Toolbar, { search: suppressSearch
247
- ? undefined
248
- : {
249
- value: globalFilter,
250
- onChange: onGlobalFilterChange,
251
- loading: search === null || search === void 0 ? void 0 : search.loading,
252
- placeholder: (search === null || search === void 0 ? void 0 : search.placeholder) || t('searchPlaceholder'),
253
- }, className: styles.toolbar, onRefresh: onRefresh ? handleOnRefresh : undefined, bulkActions: bulkActions, selectionMode: (rowSelectionProp === null || rowSelectionProp === void 0 ? void 0 : rowSelectionProp.multiRow) ? 'multiple' : 'single', checked: table.getIsAllPageRowsSelected(), indeterminate: table.getIsSomePageRowsSelected(), onCheck: enableSelection ? handleOnToolbarCheck : undefined, outline: outline, after: toolbarAfter || exportSettings ? (_jsxs(_Fragment, { children: [toolbarAfter, exportSettings && (_jsx(ExportButton, { settings: exportSettings, columnDefinitions: columnDefinitions, data: data, topRows: filteredTopRows, centerRows: centerRows }))] })) : undefined, moreActions: moreActions, filterRow: columnFilters, "data-test-id": TEST_IDS.toolbar }) })), _jsx("div", { className: styles.scrollWrapper, "data-outline": outline || undefined, children: _jsxs(Scroll, { size: 's', className: styles.table, ref: scrollContainerRef, children: [_jsx("div", { className: styles.tableContent, style: columnSizes.vars, children: _jsx(TableContext.Provider, { value: { table }, children: (!infiniteLoading || !data.length) && loading ? (_jsxs(SkeletonContextProvider, { loading: true, children: [_jsx(HeaderRow, {}), loadingTableRows.map(row => (_jsx(BodyRow, { row: row }, row.id)))] })) : (_jsxs(_Fragment, { children: [centerRows.length || filteredTopRows.length ? _jsx(HeaderRow, {}) : null, filteredTopRows.length ? (_jsx("div", { className: styles.topRowWrapper, children: filteredTopRows.map(row => (_jsx(BodyRow, { row: row, onRowClick: onRowClick }, row.id))) })) : null, centerRows.map(row => (_jsx(BodyRow, { row: row, onRowClick: onRowClick }, row.id))), data.length > 0 && infiniteLoading && loading && (_jsx(SkeletonContextProvider, { loading: true, children: loadingTableRows.slice(0, 3).map(row => (_jsx(BodyRow, { row: row }, row.id))) })), _jsx(TableEmptyState, { emptyStates: emptyStates, dataError: dataError, dataFiltered: dataFiltered || Boolean(table.getState().globalFilter), tableRowsLength: tableRows.length + filteredTopRows.length })] })) }) }), _jsx("div", { className: styles.scrollStub, ref: scrollRef })] }) }), !infiniteLoading && !suppressPagination && (_jsx(TablePagination, { table: table, options: paginationProp === null || paginationProp === void 0 ? void 0 : paginationProp.options, optionsLabel: paginationProp === null || paginationProp === void 0 ? void 0 : paginationProp.optionsLabel, pageCount: pageCount, optionsRender: paginationProp === null || paginationProp === void 0 ? void 0 : paginationProp.optionsRender }))] })) }));
244
+ return (_jsxs("div", Object.assign({ className: cn(styles.wrapper, className) }, extractSupportProps(rest), { children: [showToolbar && (_jsx("div", { className: styles.header, children: _jsx(Toolbar, { search: suppressSearch
245
+ ? undefined
246
+ : {
247
+ value: globalFilter,
248
+ onChange: onGlobalFilterChange,
249
+ loading: search === null || search === void 0 ? void 0 : search.loading,
250
+ placeholder: (search === null || search === void 0 ? void 0 : search.placeholder) || t('searchPlaceholder'),
251
+ }, className: styles.toolbar, onRefresh: onRefresh ? handleOnRefresh : undefined, bulkActions: bulkActions, selectionMode: (rowSelectionProp === null || rowSelectionProp === void 0 ? void 0 : rowSelectionProp.multiRow) ? 'multiple' : 'single', checked: table.getIsAllPageRowsSelected(), indeterminate: table.getIsSomePageRowsSelected(), onCheck: enableSelection ? handleOnToolbarCheck : undefined, outline: outline, after: toolbarAfter || exportSettings ? (_jsxs(_Fragment, { children: [toolbarAfter, exportSettings && (_jsx(ExportButton, { settings: exportSettings, columnDefinitions: columnDefinitions, data: data, topRows: filteredTopRows, centerRows: centerRows }))] })) : undefined, moreActions: moreActions, filterRow: columnFilters, "data-test-id": TEST_IDS.toolbar }) })), _jsxs(Scroll, { size: 's', className: styles.table, ref: scrollContainerRef, "data-outline": outline || undefined, children: [_jsx("div", { className: styles.tableContent, style: columnSizes.vars, children: _jsx(CellAutoResizeContext.Provider, { value: { updateCellMap }, children: _jsx(TableContext.Provider, { value: { table }, children: (!infiniteLoading || !data.length) && loading ? (_jsxs(SkeletonContextProvider, { loading: true, children: [_jsx(HeaderRow, { rowAutoHeight: rowAutoHeight }), loadingTableRows.map(row => (_jsx(BodyRow, { row: row, rowAutoHeight: rowAutoHeight }, row.id)))] })) : (_jsxs(_Fragment, { children: [centerRows.length || filteredTopRows.length ? _jsx(HeaderRow, {}) : null, filteredTopRows.length ? (_jsx("div", { className: styles.topRowWrapper, children: filteredTopRows.map(row => (_jsx(BodyRow, { row: row, onRowClick: onRowClick, rowAutoHeight: rowAutoHeight }, row.id))) })) : null, centerRows.map(row => (_jsx(BodyRow, { row: row, onRowClick: onRowClick, rowAutoHeight: rowAutoHeight }, row.id))), data.length > 0 && infiniteLoading && loading && !dataError && (_jsx(SkeletonContextProvider, { loading: true, children: loadingTableRows.slice(0, 3).map(row => (_jsx(BodyRow, { row: row }, row.id))) })), _jsx(TableEmptyState, { emptyStates: emptyStates, dataError: dataError, dataFiltered: dataFiltered || Boolean(table.getState().globalFilter), tableRowsLength: tableRows.length + filteredTopRows.length })] })) }) }) }), _jsx("div", { className: styles.scrollStub, ref: scrollRef })] }), !infiniteLoading && !suppressPagination && (_jsx(TablePagination, { table: table, options: paginationProp === null || paginationProp === void 0 ? void 0 : paginationProp.options, optionsLabel: paginationProp === null || paginationProp === void 0 ? void 0 : paginationProp.optionsLabel, pageCount: pageCount, optionsRender: paginationProp === null || paginationProp === void 0 ? void 0 : paginationProp.optionsRender }))] })));
254
252
  }
255
253
  Table.getStatusColumnDef = getStatusColumnDef;
256
254
  Table.statusAppearances = STATUS_APPEARANCE;
@@ -8,13 +8,11 @@
8
8
  box-sizing:border-box;
9
9
  width:100%;
10
10
  height:auto;
11
- max-height:calc(var(--page-size, 10) * var(--size-table-line-height, 40px) + var(--size-table-line-height, 40px) + var(--border-width-table, 1px) * 2);
12
11
  background-color:var(--sys-neutral-background1-level, #fdfdfd);
13
12
  border-color:var(--sys-neutral-background1-level, #fdfdfd);
14
13
  border-style:solid;
15
14
  }
16
-
17
- .scrollWrapper[data-outline] .table{
15
+ .table[data-outline]{
18
16
  border-color:var(--sys-neutral-decor-default, #dde0ea);
19
17
  }
20
18
 
@@ -47,7 +45,10 @@
47
45
  }
48
46
 
49
47
  .wrapper{
48
+ display:grid;
49
+ grid-template-rows:max-content minmax(auto, 100%) max-content;
50
50
  max-width:100%;
51
+ max-height:100%;
51
52
  }
52
53
 
53
54
  .scrollStub{
@@ -66,6 +66,7 @@ type BaseTableProps<TData extends object, TFilters extends FiltersState = Record
66
66
  };
67
67
  /** Включить нечеткий поиск */
68
68
  enableFuzzySearch?: boolean;
69
+ rowAutoHeight?: boolean;
69
70
  /** Максимальное кол-во строк на страницу @default 10 */
70
71
  pageSize?: number;
71
72
  /** Колбэк клика по строке */
@@ -2,6 +2,7 @@ import { Cell as TableCell } from '@tanstack/react-table';
2
2
  import { CellProps } from '../Cell';
3
3
  type BodyCellProps<TData> = Omit<CellProps, 'style' | 'children'> & {
4
4
  cell: TableCell<TData, unknown>;
5
+ rowAutoHeight?: boolean;
5
6
  };
6
- export declare function BodyCell<TData>({ cell, className, ...props }: BodyCellProps<TData>): import("react/jsx-runtime").JSX.Element;
7
+ export declare function BodyCell<TData>({ cell, className, rowAutoHeight, ...props }: BodyCellProps<TData>): import("react/jsx-runtime").JSX.Element;
7
8
  export {};
@@ -17,8 +17,8 @@ import { useCellSizes } from '../../hooks';
17
17
  import { Cell } from '../Cell';
18
18
  import styles from './styles.module.css';
19
19
  export function BodyCell(_a) {
20
- var { cell, className } = _a, props = __rest(_a, ["cell", "className"]);
20
+ var { cell, className, rowAutoHeight } = _a, props = __rest(_a, ["cell", "className", "rowAutoHeight"]);
21
21
  const columnDef = cell.column.columnDef;
22
22
  const style = useCellSizes(cell);
23
- return (_jsx(Cell, Object.assign({}, props, { style: style, className: cn(styles.tableBodyCell, className, columnDef.cellClassName), "data-align": columnDef.align, "data-no-padding": columnDef.noBodyCellPadding || undefined, "data-column-id": cell.column.id, "data-test-id": TEST_IDS.bodyCell, children: flexRender(columnDef.cell, cell.getContext()) })));
23
+ return (_jsx(Cell, Object.assign({}, props, { style: style, className: cn(styles.tableBodyCell, className, columnDef.cellClassName), "data-row-auto-height": rowAutoHeight || undefined, "data-align": columnDef.align, "data-no-padding": columnDef.noBodyCellPadding || undefined, "data-column-id": cell.column.id, "data-test-id": TEST_IDS.bodyCell, children: flexRender(columnDef.cell, cell.getContext()) })));
24
24
  }
@@ -1,7 +1,9 @@
1
1
  .tableBodyCell{
2
2
  gap:var(--space-table-cell-gap, 4px);
3
- padding-left:var(--space-table-cell-padding, 8px);
4
- padding-right:var(--space-table-cell-padding, 8px);
3
+ padding-left:var(--space-table-cell-padding-horizontal, 8px);
4
+ padding-right:var(--space-table-cell-padding-horizontal, 8px);
5
+ padding-top:var(--space-table-cell-padding-vertical, 8px);
6
+ padding-bottom:var(--space-table-cell-padding-vertical, 8px);
5
7
  color:var(--sys-neutral-text-main, #41424e);
6
8
  }
7
9
  .tableBodyCell[data-align=right]{
@@ -9,4 +11,8 @@
9
11
  }
10
12
  .tableBodyCell[data-no-padding]{
11
13
  padding:0;
14
+ }
15
+ .tableBodyCell:not([data-row-auto-height]){
16
+ padding-top:0;
17
+ padding-bottom:0;
12
18
  }
@@ -21,5 +21,5 @@ export function CopyCell({ value }) {
21
21
  closeChecked();
22
22
  clearTimeout(timerId.current);
23
23
  }, []);
24
- return (_jsxs("div", { className: styles.copyCell, onClick: handleClick, role: 'presentation', children: [_jsx(TruncateString, { text: String(value), maxLines: 1 }), _jsx(ButtonFunction, { "data-test-id": 'button-copy-value', type: 'button', icon: isChecked ? _jsx(CheckSVG, {}) : _jsx(CopySVG, {}), size: 's', className: styles.copyButton })] }));
24
+ return (_jsxs("div", { className: styles.copyCell, onClick: handleClick, role: 'presentation', children: [_jsx(TruncateString, { text: String(value), maxLines: 1 }), _jsx(ButtonFunction, { "data-test-id": 'button-copy-value', type: 'button', icon: isChecked ? _jsx(CheckSVG, {}) : _jsx(CopySVG, {}), size: 'xs', className: styles.copyButton })] }));
25
25
  }
@@ -4,6 +4,7 @@ import { CellProps } from '../Cell';
4
4
  type HeaderCellProps<TData> = Omit<CellProps, 'align' | 'children' | 'onClick' | 'style'> & {
5
5
  header: Header<TData, unknown>;
6
6
  pinPosition?: ColumnPinPosition;
7
+ rowAutoHeight?: boolean;
7
8
  };
8
- export declare function HeaderCell<TData>({ header, pinPosition, className }: HeaderCellProps<TData>): import("react/jsx-runtime").JSX.Element;
9
+ export declare function HeaderCell<TData>({ header, pinPosition, className, rowAutoHeight }: HeaderCellProps<TData>): import("react/jsx-runtime").JSX.Element;
9
10
  export {};
@@ -9,7 +9,7 @@ import { Cell } from '../Cell';
9
9
  import { getSortingIcon } from './helpers';
10
10
  import { ResizeHandle } from './ResizeHandle';
11
11
  import styles from './styles.module.css';
12
- export function HeaderCell({ header, pinPosition, className }) {
12
+ export function HeaderCell({ header, pinPosition, className, rowAutoHeight }) {
13
13
  const cellRef = useRef(null);
14
14
  const isSortable = header.column.getCanSort();
15
15
  const isResizable = header.column.getCanResize();
@@ -26,5 +26,5 @@ export function HeaderCell({ header, pinPosition, className }) {
26
26
  return;
27
27
  return (_a = header.column.getToggleSortingHandler()) === null || _a === void 0 ? void 0 : _a(e);
28
28
  };
29
- return (_jsxs(Cell, { style: style, onClick: sortingHandler, "data-sortable": isSortable || undefined, "data-no-padding": columnDef.noHeaderCellPadding || undefined, "data-no-offset": columnDef.noHeaderCellBorderOffset || undefined, "data-test-id": TEST_IDS.headerCell, "data-align": columnDef.headerAlign || undefined, "data-header-id": header.id, "data-resizing": isResizing || undefined, "data-pin-position": pinPosition || undefined, role: 'columnheader', className: cn(styles.tableHeaderCell, className, columnDef.headerClassName), ref: cellRef, children: [_jsxs("div", { className: styles.tableHeaderCellMain, children: [columnDef.header && (_jsx("div", { className: styles.tableHeaderCellName, children: _jsx(TruncateString, { text: flexRender(columnDef.header, header.getContext()) }) })), Boolean(sortIcon) && (_jsx("div", { className: styles.tableHeaderIcon, "data-sort-direction": sortDirection, "data-test-id": TEST_IDS.headerSortIndicator, children: sortIcon }))] }), Boolean(isResizable) && _jsx(ResizeHandle, { header: header, cellRef: cellRef })] }));
29
+ return (_jsxs(Cell, { style: style, onClick: sortingHandler, "data-sortable": isSortable || undefined, "data-no-padding": columnDef.noHeaderCellPadding || undefined, "data-no-offset": columnDef.noHeaderCellBorderOffset || undefined, "data-test-id": TEST_IDS.headerCell, "data-align": columnDef.headerAlign || undefined, "data-header-id": header.id, "data-resizing": isResizing || undefined, "data-pin-position": pinPosition || undefined, "data-row-auto-height": rowAutoHeight || undefined, role: 'columnheader', className: cn(styles.tableHeaderCell, className, columnDef.headerClassName), ref: cellRef, children: [_jsxs("div", { className: styles.tableHeaderCellMain, children: [columnDef.header && (_jsx("div", { className: styles.tableHeaderCellName, children: rowAutoHeight ? (flexRender(columnDef.header, header.getContext())) : (_jsx(TruncateString, { text: flexRender(columnDef.header, header.getContext()) })) })), Boolean(sortIcon) && (_jsx("div", { className: styles.tableHeaderIcon, "data-sort-direction": sortDirection, "data-test-id": TEST_IDS.headerSortIndicator, children: sortIcon }))] }), Boolean(isResizable) && _jsx(ResizeHandle, { header: header, cellRef: cellRef })] }));
30
30
  }
@@ -103,6 +103,13 @@
103
103
  .tableHeaderCell[data-pin-position=right]:last-child .tableHeaderResizeIndicator{
104
104
  right:calc(var(--dimension-1m, 8px) / 2);
105
105
  }
106
+ .tableHeaderCell[data-row-auto-height]{
107
+ align-items:flex-end;
108
+ }
109
+ .tableHeaderCell:not([data-row-auto-height]){
110
+ padding-top:0;
111
+ padding-bottom:0;
112
+ }
106
113
 
107
114
  .tableHeaderCellMain{
108
115
  overflow:auto;
@@ -113,7 +120,9 @@
113
120
  }
114
121
 
115
122
  .tableHeaderCellName{
116
- height:var(--size-table-head-name-layout, 24px);
123
+ min-height:var(--size-table-head-name-layout, 24px);
124
+ padding-top:var(--dimension-025m, 2px);
125
+ padding-bottom:var(--dimension-025m, 2px);
117
126
  display:inline-flex;
118
127
  align-items:center;
119
128
  box-sizing:border-box;
@@ -5,7 +5,7 @@
5
5
  box-sizing:border-box;
6
6
  width:100%;
7
7
  height:100%;
8
- padding-right:var(--space-table-cell-padding, 8px);
8
+ padding-right:var(--space-table-cell-padding-horizontal, 8px);
9
9
  }
10
10
  .statusCell[data-no-label]{
11
11
  padding-right:0;
@@ -18,7 +18,6 @@
18
18
  }
19
19
 
20
20
  .statusCellIndicator{
21
- height:var(--size-table-cell-status-indicator-vertical, 40px);
22
21
  border-width:var(--size-table-cell-status-indicator-horizontal, 16px);
23
22
  position:relative;
24
23
  display:flex;
@@ -27,10 +26,10 @@
27
26
  justify-content:center;
28
27
  box-sizing:border-box;
29
28
  width:var(--size-table-cell-status-indicator-horizontal, 16px);
29
+ height:calc(100% + var(--border-width-table, 1px) * 2);
30
30
  background-color:inherit;
31
31
  }
32
32
  .statusCellIndicator::after{
33
- height:var(--size-table-cell-status-indicator-vertical, 40px);
34
33
  border-width:var(--size-table-cell-status-indicator-horizontal, 16px);
35
34
  content:"";
36
35
  position:absolute;
@@ -39,6 +38,7 @@
39
38
  left:0;
40
39
  box-sizing:border-box;
41
40
  width:100%;
41
+ height:100%;
42
42
  }
43
43
  .statusCellIndicator[data-appearance=primary]::after{
44
44
  background-color:var(--sys-primary-accent-default, #794ed3);
@@ -18,7 +18,7 @@ type TreeColumnDef = BaseTreeColumnDef & {
18
18
  };
19
19
  type TreeColumnDefWithDescription<TData> = BaseTreeColumnDef & {
20
20
  /** Заголовок колонки */
21
- renderDescription?: (cellValue: string, row: TData) => string;
21
+ renderDescription?(cellValue: string, row: TData): string;
22
22
  /** Рендер функция заголовка колонки */
23
23
  header?: ColumnDefinition<TData>['header'];
24
24
  };