@alfalab/core-components-table 2.5.10 → 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.
- package/components/pagination/Component.js +1 -1
- package/components/pagination/index.css +18 -13
- package/components/pagination/select-field/index.css +4 -4
- package/components/pagination/select-field/index.js +1 -1
- package/components/table/Component.js +1 -1
- package/components/table/index.css +9 -8
- package/components/tbody/Component.js +1 -1
- package/components/tbody/index.css +2 -2
- package/components/tcell/Component.js +1 -1
- package/components/tcell/index.css +15 -11
- package/components/texpandable-row/Component.js +1 -1
- package/components/texpandable-row/index.css +5 -5
- package/components/thead/Component.js +1 -1
- package/components/thead/index.css +9 -8
- package/components/thead-cell/Component.js +1 -1
- package/components/thead-cell/index.css +16 -12
- package/components/trow/Component.js +1 -1
- package/components/trow/index.css +8 -8
- package/components/tsortable-head-cell/Component.js +2 -2
- package/components/tsortable-head-cell/index.css +11 -10
- package/cssm/components/pagination/index.module.css +9 -4
- package/cssm/components/table/index.module.css +2 -1
- package/cssm/components/tcell/index.module.css +9 -5
- package/cssm/components/thead/index.module.css +3 -2
- package/cssm/components/thead-cell/index.module.css +7 -3
- package/cssm/components/tsortable-head-cell/Component.js +1 -1
- package/cssm/components/tsortable-head-cell/index.module.css +3 -2
- package/esm/components/pagination/Component.js +1 -1
- package/esm/components/pagination/index.css +18 -13
- package/esm/components/pagination/select-field/index.css +4 -4
- package/esm/components/pagination/select-field/index.js +1 -1
- package/esm/components/table/Component.js +1 -1
- package/esm/components/table/index.css +9 -8
- package/esm/components/tbody/Component.js +1 -1
- package/esm/components/tbody/index.css +2 -2
- package/esm/components/tcell/Component.js +1 -1
- package/esm/components/tcell/index.css +15 -11
- package/esm/components/texpandable-row/Component.js +1 -1
- package/esm/components/texpandable-row/index.css +5 -5
- package/esm/components/thead/Component.js +1 -1
- package/esm/components/thead/index.css +9 -8
- package/esm/components/thead-cell/Component.js +1 -1
- package/esm/components/thead-cell/index.css +16 -12
- package/esm/components/trow/Component.js +1 -1
- package/esm/components/trow/index.css +8 -8
- package/esm/components/tsortable-head-cell/Component.js +2 -2
- package/esm/components/tsortable-head-cell/index.css +11 -10
- package/modern/components/pagination/Component.js +1 -1
- package/modern/components/pagination/index.css +18 -13
- package/modern/components/pagination/select-field/index.css +4 -4
- package/modern/components/pagination/select-field/index.js +1 -1
- package/modern/components/table/Component.js +1 -1
- package/modern/components/table/index.css +9 -8
- package/modern/components/tbody/Component.js +1 -1
- package/modern/components/tbody/index.css +2 -2
- package/modern/components/tcell/Component.js +1 -1
- package/modern/components/tcell/index.css +15 -11
- package/modern/components/texpandable-row/Component.js +1 -1
- package/modern/components/texpandable-row/index.css +5 -5
- package/modern/components/thead/Component.js +1 -1
- package/modern/components/thead/index.css +9 -8
- package/modern/components/thead-cell/Component.js +1 -1
- package/modern/components/thead-cell/index.css +16 -12
- package/modern/components/trow/Component.js +1 -1
- package/modern/components/trow/index.css +8 -8
- package/modern/components/tsortable-head-cell/Component.js +2 -2
- package/modern/components/tsortable-head-cell/index.css +11 -10
- package/moderncssm/component.d.ts +21 -0
- package/moderncssm/component.js +22 -0
- package/moderncssm/components/index.d.ts +9 -0
- package/moderncssm/components/index.js +9 -0
- package/moderncssm/components/pagination/Component.d.ts +26 -0
- package/moderncssm/components/pagination/Component.js +33 -0
- package/moderncssm/components/pagination/index.d.ts +1 -0
- package/moderncssm/components/pagination/index.js +1 -0
- package/moderncssm/components/pagination/index.module.css +44 -0
- package/moderncssm/components/pagination/select-field/index.d.ts +3 -0
- package/moderncssm/components/pagination/select-field/index.js +12 -0
- package/moderncssm/components/pagination/select-field/index.module.css +11 -0
- package/moderncssm/components/table/Component.d.ts +72 -0
- package/moderncssm/components/table/Component.js +32 -0
- package/moderncssm/components/table/index.d.ts +1 -0
- package/moderncssm/components/table/index.js +1 -0
- package/moderncssm/components/table/index.module.css +33 -0
- package/moderncssm/components/table/utils.d.ts +5 -0
- package/moderncssm/components/table/utils.js +17 -0
- package/moderncssm/components/table-context/index.d.ts +20 -0
- package/moderncssm/components/table-context/index.js +12 -0
- package/moderncssm/components/tbody/Component.d.ts +15 -0
- package/moderncssm/components/tbody/Component.js +7 -0
- package/moderncssm/components/tbody/index.d.ts +1 -0
- package/moderncssm/components/tbody/index.js +1 -0
- package/moderncssm/components/tbody/index.module.css +6 -0
- package/moderncssm/components/tcell/Component.d.ts +19 -0
- package/moderncssm/components/tcell/Component.js +17 -0
- package/moderncssm/components/tcell/index.d.ts +1 -0
- package/moderncssm/components/tcell/index.js +1 -0
- package/moderncssm/components/tcell/index.module.css +37 -0
- package/moderncssm/components/texpandable-row/Component.d.ts +12 -0
- package/moderncssm/components/texpandable-row/Component.js +24 -0
- package/moderncssm/components/texpandable-row/index.d.ts +1 -0
- package/moderncssm/components/texpandable-row/index.js +1 -0
- package/moderncssm/components/texpandable-row/index.module.css +21 -0
- package/moderncssm/components/thead/Component.d.ts +19 -0
- package/moderncssm/components/thead/Component.js +8 -0
- package/moderncssm/components/thead/index.d.ts +1 -0
- package/moderncssm/components/thead/index.js +1 -0
- package/moderncssm/components/thead/index.module.css +32 -0
- package/moderncssm/components/thead-cell/Component.d.ts +28 -0
- package/moderncssm/components/thead-cell/Component.js +15 -0
- package/moderncssm/components/thead-cell/index.d.ts +1 -0
- package/moderncssm/components/thead-cell/index.js +1 -0
- package/moderncssm/components/thead-cell/index.module.css +51 -0
- package/moderncssm/components/trow/Component.d.ts +29 -0
- package/moderncssm/components/trow/Component.js +11 -0
- package/moderncssm/components/trow/index.d.ts +1 -0
- package/moderncssm/components/trow/index.js +1 -0
- package/moderncssm/components/trow/index.module.css +33 -0
- package/moderncssm/components/tsortable-head-cell/Component.d.ts +10 -0
- package/moderncssm/components/tsortable-head-cell/Component.js +26 -0
- package/moderncssm/components/tsortable-head-cell/index.d.ts +1 -0
- package/moderncssm/components/tsortable-head-cell/index.js +1 -0
- package/moderncssm/components/tsortable-head-cell/index.module.css +41 -0
- package/moderncssm/components/tsortable-head-cell/sort-icon-asc.d.ts +5 -0
- package/moderncssm/components/tsortable-head-cell/sort-icon-asc.js +6 -0
- package/moderncssm/components/tsortable-head-cell/sort-icon-desc.d.ts +5 -0
- package/moderncssm/components/tsortable-head-cell/sort-icon-desc.js +6 -0
- package/moderncssm/components/tsortable-head-cell/sort-icon-unset.d.ts +5 -0
- package/moderncssm/components/tsortable-head-cell/sort-icon-unset.js +6 -0
- package/moderncssm/index.d.ts +1 -0
- package/moderncssm/index.js +1 -0
- package/moderncssm/typings.d.ts +2 -0
- package/moderncssm/typings.js +1 -0
- package/moderncssm/utils.d.ts +4 -0
- package/moderncssm/utils.js +8 -0
- package/package.json +6 -6
- package/src/components/pagination/index.module.css +5 -5
- package/src/components/pagination/select-field/index.module.css +1 -1
- package/src/components/table/index.module.css +2 -2
- package/src/components/tbody/index.module.css +1 -1
- package/src/components/tcell/index.module.css +6 -6
- package/src/components/texpandable-row/index.module.css +1 -1
- package/src/components/thead/index.module.css +3 -3
- package/src/components/thead-cell/index.module.css +4 -4
- package/src/components/trow/index.module.css +1 -1
- package/src/components/tsortable-head-cell/Component.tsx +1 -1
- package/src/components/tsortable-head-cell/index.module.css +3 -3
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* */
|
|
2
|
+
|
|
3
|
+
.row {
|
|
4
|
+
cursor: pointer;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.selected.expanded {
|
|
8
|
+
background-color: inherit;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.expanded:hover {
|
|
12
|
+
background-color: inherit;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.expandable td {
|
|
16
|
+
margin: 0;
|
|
17
|
+
padding-top: 0;
|
|
18
|
+
padding-bottom: 0;
|
|
19
|
+
border: none;
|
|
20
|
+
height: auto;
|
|
21
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { HTMLAttributes } from "react";
|
|
4
|
+
type THeadProps = HTMLAttributes<HTMLTableSectionElement> & {
|
|
5
|
+
/**
|
|
6
|
+
* Дополнительный класс
|
|
7
|
+
*/
|
|
8
|
+
className?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Дополнительный класс для tr
|
|
11
|
+
*/
|
|
12
|
+
rowClassName?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Идентификатор для систем автоматизированного тестирования
|
|
15
|
+
*/
|
|
16
|
+
dataTestId?: string;
|
|
17
|
+
};
|
|
18
|
+
declare const THead: React.FC<THeadProps>;
|
|
19
|
+
export { THeadProps, THead };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import styles from './index.module.css';
|
|
4
|
+
|
|
5
|
+
const THead = ({ className, rowClassName, children, dataTestId, ...restProps }) => (React.createElement("thead", { className: cn(styles.component, className), "data-test-id": dataTestId, ...restProps },
|
|
6
|
+
React.createElement("tr", { className: cn(styles.row, rowClassName) }, children)));
|
|
7
|
+
|
|
8
|
+
export { THead };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Component";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { THead } from './Component.js';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/* */
|
|
2
|
+
|
|
3
|
+
.component {
|
|
4
|
+
position: relative;
|
|
5
|
+
width: 100%;
|
|
6
|
+
box-sizing: border-box
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.component th:not(:last-child):not(:empty):after {
|
|
10
|
+
transition: opacity 0.2s;
|
|
11
|
+
position: absolute;
|
|
12
|
+
content: '';
|
|
13
|
+
display: block;
|
|
14
|
+
|
|
15
|
+
width: 1px;
|
|
16
|
+
right: 0;
|
|
17
|
+
top: var(--gap-8);
|
|
18
|
+
bottom: var(--gap-8);
|
|
19
|
+
background-color: var(--color-light-neutral-400);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.component th:after {
|
|
23
|
+
opacity: 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.component:hover th:after {
|
|
27
|
+
opacity: 1;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.row {
|
|
31
|
+
height: 72px;
|
|
32
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { ThHTMLAttributes } from "react";
|
|
4
|
+
import { TextAlignProperty } from "../../typings";
|
|
5
|
+
type THeadCellProps = ThHTMLAttributes<HTMLHeadingElement> & {
|
|
6
|
+
/**
|
|
7
|
+
* Дополнительный класс
|
|
8
|
+
*/
|
|
9
|
+
className?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Ширина колонки
|
|
12
|
+
*/
|
|
13
|
+
width?: string | number;
|
|
14
|
+
/**
|
|
15
|
+
* Скрытие колонки
|
|
16
|
+
*/
|
|
17
|
+
hidden?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Выравнивание текста в колонке
|
|
20
|
+
*/
|
|
21
|
+
textAlign?: TextAlignProperty;
|
|
22
|
+
/**
|
|
23
|
+
* Идентификатор для систем автоматизированного тестирования
|
|
24
|
+
*/
|
|
25
|
+
dataTestId?: string;
|
|
26
|
+
};
|
|
27
|
+
declare const THeadCell: ({ children, className, dataTestId, style, width, textAlign, hidden, ...restProps }: THeadCellProps) => React.JSX.Element | null;
|
|
28
|
+
export { THeadCellProps, THeadCell };
|
|
@@ -0,0 +1,15 @@
|
|
|
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 THeadCell = ({ children, className, dataTestId, style, width, textAlign, hidden, ...restProps }) => {
|
|
7
|
+
const { compactHorizontal, stickyHeader } = useContext(TableContext);
|
|
8
|
+
if (hidden)
|
|
9
|
+
return null;
|
|
10
|
+
return (React.createElement("th", { className: cn(styles.component, className, compactHorizontal && styles.compactHorizontal, {
|
|
11
|
+
[styles.stickyHeader]: stickyHeader,
|
|
12
|
+
}), style: { ...style, width, textAlign }, "data-test-id": dataTestId, ...restProps }, children));
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { THeadCell };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Component";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { THeadCell } from './Component.js';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/* */
|
|
2
|
+
|
|
3
|
+
.component {
|
|
4
|
+
font-size: 12px;
|
|
5
|
+
line-height: 16px;
|
|
6
|
+
font-weight: 500;
|
|
7
|
+
letter-spacing: 1.25px;
|
|
8
|
+
text-transform: uppercase;
|
|
9
|
+
|
|
10
|
+
line-height: 20px;
|
|
11
|
+
text-align: left;
|
|
12
|
+
color: var(--color-light-text-primary);
|
|
13
|
+
padding: var(--gap-32) var(--gap-12) var(--gap-4);
|
|
14
|
+
border-bottom: 1px solid var(--color-light-neutral-400);
|
|
15
|
+
background: var(--color-light-base-bg-primary);
|
|
16
|
+
vertical-align: top;
|
|
17
|
+
box-sizing: border-box
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.component:first-child {
|
|
21
|
+
padding-left: var(--gap-16);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.component:last-child {
|
|
25
|
+
padding-right: var(--gap-16);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.component:not(.stickyHeader) {
|
|
29
|
+
position: relative;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.sortable {
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.sorted {
|
|
37
|
+
color: var(--color-light-text-primary);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.stickyHeader {
|
|
41
|
+
top: 0;
|
|
42
|
+
position: sticky;
|
|
43
|
+
box-shadow: inset 0 -1px 0 0 rgba(11, 31, 53, 0.16);
|
|
44
|
+
border: none;
|
|
45
|
+
z-index: 1;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.compactHorizontal {
|
|
49
|
+
padding-left: 6px;
|
|
50
|
+
padding-right: 6px;
|
|
51
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { HTMLAttributes } from "react";
|
|
4
|
+
import { TCell, TCellProps } from "../tcell/index";
|
|
5
|
+
type TCellElement = React.ReactElement<TCellProps, typeof TCell>;
|
|
6
|
+
type TRowProps = HTMLAttributes<HTMLTableRowElement> & {
|
|
7
|
+
/**
|
|
8
|
+
* Компоненты ячеек
|
|
9
|
+
*/
|
|
10
|
+
children: TCellElement | TCellElement[];
|
|
11
|
+
/**
|
|
12
|
+
* Дополнительный класс
|
|
13
|
+
*/
|
|
14
|
+
className?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Стиль выбранной строки
|
|
17
|
+
*/
|
|
18
|
+
selected?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Убирает нижнюю границу
|
|
21
|
+
*/
|
|
22
|
+
withoutBorder?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Идентификатор для систем автоматизированного тестирования
|
|
25
|
+
*/
|
|
26
|
+
dataTestId?: string;
|
|
27
|
+
};
|
|
28
|
+
declare const TRow: ({ children, className, selected, withoutBorder, dataTestId, ...restProps }: TRowProps) => React.JSX.Element;
|
|
29
|
+
export { TRowProps, TRow };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import styles from './index.module.css';
|
|
4
|
+
|
|
5
|
+
const TRow = ({ children, className, selected, withoutBorder, dataTestId, ...restProps }) => (React.createElement("tr", { className: cn(styles.component, className, {
|
|
6
|
+
[styles.clickable]: typeof restProps.onClick !== 'undefined',
|
|
7
|
+
[styles.selected]: selected,
|
|
8
|
+
[styles.withoutBorder]: withoutBorder,
|
|
9
|
+
}), "data-test-id": dataTestId, ...restProps }, React.Children.map(children, (child, index) => React.cloneElement(child, { index }))));
|
|
10
|
+
|
|
11
|
+
export { TRow };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Component";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TRow } from './Component.js';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* */
|
|
2
|
+
|
|
3
|
+
.component {
|
|
4
|
+
padding-top: 1px;
|
|
5
|
+
width: 100%;
|
|
6
|
+
transition: background-color 0.2s;
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
background: var(--color-light-base-bg-primary)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.component:first-child td {
|
|
12
|
+
border-top: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.withoutBorder td {
|
|
16
|
+
border: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.clickable {
|
|
20
|
+
cursor: pointer
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.clickable:hover {
|
|
24
|
+
background-color: var(--color-light-base-bg-secondary);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.selected {
|
|
28
|
+
background-color: #f2f8ff /* нет цвета в палитре */
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.selected:hover {
|
|
32
|
+
background-color: var(--color-static-graphic-solitude);
|
|
33
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { THeadCellProps } from "../thead-cell/index";
|
|
4
|
+
type TSortableHeadCellProps = THeadCellProps & {
|
|
5
|
+
isSortedDesc?: boolean;
|
|
6
|
+
defaultIsSortedDesc?: boolean;
|
|
7
|
+
onSort?: () => void;
|
|
8
|
+
};
|
|
9
|
+
declare const TSortableHeadCell: ({ children, className, defaultIsSortedDesc, isSortedDesc, textAlign, onSort, ...restProps }: TSortableHeadCellProps) => React.JSX.Element;
|
|
10
|
+
export { TSortableHeadCellProps, TSortableHeadCell };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import { THeadCell } from '../thead-cell/Component.js';
|
|
4
|
+
import { SortIconAsc } from './sort-icon-asc.js';
|
|
5
|
+
import { SortIconDesc } from './sort-icon-desc.js';
|
|
6
|
+
import { SortIconUnset } from './sort-icon-unset.js';
|
|
7
|
+
import styles from './index.module.css';
|
|
8
|
+
|
|
9
|
+
const TSortableHeadCell = ({ children, className, defaultIsSortedDesc, isSortedDesc, textAlign, onSort, ...restProps }) => {
|
|
10
|
+
const SortIcon = useMemo(() => {
|
|
11
|
+
let value = isSortedDesc;
|
|
12
|
+
if (value === undefined)
|
|
13
|
+
value = defaultIsSortedDesc;
|
|
14
|
+
if (typeof value === 'boolean')
|
|
15
|
+
return value ? SortIconDesc : SortIconAsc;
|
|
16
|
+
return SortIconUnset;
|
|
17
|
+
}, [defaultIsSortedDesc, isSortedDesc]);
|
|
18
|
+
return (React.createElement(THeadCell, { className: className, textAlign: textAlign, ...restProps },
|
|
19
|
+
React.createElement("div", { className: cn(styles.content, { [styles.reverse]: textAlign === 'right' }) },
|
|
20
|
+
children,
|
|
21
|
+
React.createElement(SortIcon, { onClick: onSort, className: cn(styles.icon, {
|
|
22
|
+
[styles.sorted]: isSortedDesc !== undefined,
|
|
23
|
+
}) }))));
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export { TSortableHeadCell };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Component";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TSortableHeadCell } from './Component.js';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/* */
|
|
2
|
+
|
|
3
|
+
.content {
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: flex-start;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.icon {
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
margin-left: var(--gap-8);
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* иконка сортировки должна быть выровнена по верхнему краю,
|
|
14
|
+
* т.к. текст может быть в две строки
|
|
15
|
+
*/
|
|
16
|
+
margin-top: 1px;
|
|
17
|
+
color: var(--color-light-neutral-700);
|
|
18
|
+
transition: color 0.2s ease;
|
|
19
|
+
flex-shrink: 0
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.icon:hover {
|
|
23
|
+
color: var(--color-light-neutral-translucent-1300);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.reverse {
|
|
27
|
+
flex-direction: row-reverse
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.reverse .icon {
|
|
31
|
+
margin-left: 0;
|
|
32
|
+
margin-right: var(--gap-8);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.sorted {
|
|
36
|
+
color: var(--color-light-status-info)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.sorted:hover {
|
|
40
|
+
color: var(--color-light-status-info);
|
|
41
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
const SortIconAsc = (props) => (React.createElement("svg", { width: '18', height: '18', viewBox: '0 0 18 18', fill: 'currentColor', xmlns: 'http://www.w3.org/2000/svg', focusable: 'false', role: 'img', ...props },
|
|
4
|
+
React.createElement("path", { d: 'M3.00004 10C3.00004 10 11.4477 10 12 10C12 9.33333 12.0001 8.16667 12.0001 7.5H3.0001C3.00006 8 3.0001 9.5 3.00004 10ZM3.0001 3.5C3.00003 4.16667 3 5.33333 3 6H9C9 5.33333 9 4.16667 9 3.5C9 3.5 3.55238 3.5 3.0001 3.5ZM3.00009 14C3.21041 14 15 14 15 14C15 13.5 15 12 15 11.5C15 11.5 3.55238 11.5 3.00009 11.5C3 12 3 13.5 3.00009 14Z' })));
|
|
5
|
+
|
|
6
|
+
export { SortIconAsc };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
const SortIconDesc = (props) => (React.createElement("svg", { width: '18', height: '18', viewBox: '0 0 18 18', fill: 'currentColor', xmlns: 'http://www.w3.org/2000/svg', focusable: 'false', role: 'img', ...props },
|
|
4
|
+
React.createElement("path", { d: 'M3.00004 10C3.00004 10 11.4477 10 12 10C12 9.33333 12.0001 8.16667 12.0001 7.5H3.0001C3.00006 8 3.0001 9.5 3.00004 10ZM3.0001 3.5C3.00003 4.16667 3 5.33333 3 6H15C15 5.33333 15 4.16667 15 3.5C15 3.5 3.55238 3.5 3.0001 3.5ZM3.00009 14C3.21041 14 9 14 9 14C9 13.5 9 12 9 11.5C9 11.5 3.55238 11.5 3.00009 11.5C3 12 3 13.5 3.00009 14Z' })));
|
|
5
|
+
|
|
6
|
+
export { SortIconDesc };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
const SortIconUnset = (props) => (React.createElement("svg", { width: '18', height: '18', viewBox: '0 0 18 18', fill: 'currentColor', xmlns: 'http://www.w3.org/2000/svg', focusable: 'false', role: 'img', ...props },
|
|
4
|
+
React.createElement("path", { d: 'M3 10C3 10 10.4477 10 11 10C11 9.33333 11.0001 8.16667 11.0001 7.5H3.00006C3.00002 8 3.00006 9.5 3 10ZM3.0001 3.5C3.00003 4.16667 3 5.33333 3 6H15C15 5.33333 15 4.16667 15 3.5C15 3.5 3.55238 3.5 3.0001 3.5ZM3 14C3.21032 14 14 14 14 14C14 13.5 14 12 14 11.5C14 11.5 3.55228 11.5 3 11.5C2.99991 12 2.99991 13.5 3 14Z' })));
|
|
5
|
+
|
|
6
|
+
export { SortIconUnset };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./component";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Table } from './component.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
function isChildInstanceOf(child, Component) {
|
|
4
|
+
// мы не можем полагаться на child.type === Component, см. https://github.com/gaearon/react-hot-loader/issues/304
|
|
5
|
+
return child.type === React.createElement(Component).type;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export { isChildInstanceOf };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfalab/core-components-table",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
"react-dom": "^16.9.0 || ^17.0.1 || ^18.0.0"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@alfalab/core-components-button": "^11.
|
|
19
|
-
"@alfalab/core-components-pagination": "^2.
|
|
20
|
-
"@alfalab/core-components-select": "^17.
|
|
18
|
+
"@alfalab/core-components-button": "^11.6.0",
|
|
19
|
+
"@alfalab/core-components-pagination": "^2.4.0",
|
|
20
|
+
"@alfalab/core-components-select": "^17.11.0",
|
|
21
21
|
"classnames": "^2.3.1",
|
|
22
22
|
"tslib": "^2.4.0"
|
|
23
23
|
},
|
|
24
|
-
"themesVersion": "13.0
|
|
25
|
-
"varsVersion": "9.
|
|
24
|
+
"themesVersion": "13.1.0",
|
|
25
|
+
"varsVersion": "9.12.0"
|
|
26
26
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@import '@alfalab/core-components-
|
|
1
|
+
@import '@alfalab/core-components-vars/src/index.css';
|
|
2
2
|
|
|
3
3
|
.component {
|
|
4
4
|
position: sticky;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
justify-content: space-between;
|
|
8
8
|
align-items: flex-start;
|
|
9
9
|
width: 100%;
|
|
10
|
-
padding: var(--gap-
|
|
10
|
+
padding: var(--gap-24) var(--gap-16) var(--gap-32);
|
|
11
11
|
border-top: 1px solid var(--color-light-neutral-400);
|
|
12
12
|
box-sizing: border-box;
|
|
13
13
|
}
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
|
|
19
19
|
.tag.tag {
|
|
20
20
|
flex-shrink: 0;
|
|
21
|
-
margin-right: var(--gap-
|
|
22
|
-
padding: 0 var(--gap-
|
|
21
|
+
margin-right: var(--gap-8);
|
|
22
|
+
padding: 0 var(--gap-8);
|
|
23
23
|
min-width: 32px;
|
|
24
24
|
|
|
25
25
|
&:last-child {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
.menu {
|
|
39
|
-
margin: var(--gap-
|
|
39
|
+
margin: var(--gap-4) 0;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
.option {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
@import '@alfalab/core-components-
|
|
1
|
+
@import '@alfalab/core-components-vars/src/index.css';
|
|
2
2
|
|
|
3
3
|
.component {
|
|
4
4
|
box-sizing: border-box;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
.wrapper {
|
|
8
|
-
padding: 0 var(--gap-
|
|
8
|
+
padding: 0 var(--gap-16) var(--gap-16);
|
|
9
9
|
background: var(--color-light-base-bg-primary);
|
|
10
10
|
box-shadow: var(--shadow-xs-hard);
|
|
11
11
|
border-radius: var(--border-radius-m);
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
@import '@alfalab/core-components-
|
|
1
|
+
@import '@alfalab/core-components-vars/src/index.css';
|
|
2
2
|
|
|
3
3
|
.component {
|
|
4
4
|
@mixin paragraph_primary_small;
|
|
5
5
|
|
|
6
6
|
color: var(--color-light-text-primary);
|
|
7
|
-
padding: var(--gap-
|
|
7
|
+
padding: var(--gap-24) var(--gap-12);
|
|
8
8
|
height: 72px;
|
|
9
9
|
border-top: 1px solid var(--color-light-neutral-400);
|
|
10
10
|
vertical-align: top;
|
|
11
11
|
box-sizing: border-box;
|
|
12
12
|
|
|
13
13
|
&:first-child {
|
|
14
|
-
padding-left: var(--gap-
|
|
14
|
+
padding-left: var(--gap-16);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
&:last-child {
|
|
18
|
-
padding-right: var(--gap-
|
|
18
|
+
padding-right: var(--gap-16);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
.compact {
|
|
28
|
-
padding-top: var(--gap-
|
|
29
|
-
padding-bottom: var(--gap-
|
|
28
|
+
padding-top: var(--gap-8);
|
|
29
|
+
padding-bottom: var(--gap-8);
|
|
30
30
|
|
|
31
31
|
max-width: 0;
|
|
32
32
|
overflow: hidden;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@import '@alfalab/core-components-
|
|
1
|
+
@import '@alfalab/core-components-vars/src/index.css';
|
|
2
2
|
|
|
3
3
|
.component {
|
|
4
4
|
position: relative;
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
|
|
14
14
|
width: 1px;
|
|
15
15
|
right: 0;
|
|
16
|
-
top: var(--gap-
|
|
17
|
-
bottom: var(--gap-
|
|
16
|
+
top: var(--gap-8);
|
|
17
|
+
bottom: var(--gap-8);
|
|
18
18
|
background-color: var(--color-light-neutral-400);
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@import '@alfalab/core-components-
|
|
1
|
+
@import '@alfalab/core-components-vars/src/index.css';
|
|
2
2
|
|
|
3
3
|
.component {
|
|
4
4
|
@mixin paragraph_caps;
|
|
@@ -6,18 +6,18 @@
|
|
|
6
6
|
line-height: 20px;
|
|
7
7
|
text-align: left;
|
|
8
8
|
color: var(--color-light-text-primary);
|
|
9
|
-
padding: var(--gap-
|
|
9
|
+
padding: var(--gap-32) var(--gap-12) var(--gap-4);
|
|
10
10
|
border-bottom: 1px solid var(--color-light-neutral-400);
|
|
11
11
|
background: var(--color-light-base-bg-primary);
|
|
12
12
|
vertical-align: top;
|
|
13
13
|
box-sizing: border-box;
|
|
14
14
|
|
|
15
15
|
&:first-child {
|
|
16
|
-
padding-left: var(--gap-
|
|
16
|
+
padding-left: var(--gap-16);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
&:last-child {
|
|
20
|
-
padding-right: var(--gap-
|
|
20
|
+
padding-right: var(--gap-16);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
&:not(.stickyHeader) {
|
|
@@ -35,7 +35,7 @@ export const TSortableHeadCell = ({
|
|
|
35
35
|
}, [defaultIsSortedDesc, isSortedDesc]);
|
|
36
36
|
|
|
37
37
|
return (
|
|
38
|
-
<THeadCell className={className} {...restProps}>
|
|
38
|
+
<THeadCell className={className} textAlign={textAlign} {...restProps}>
|
|
39
39
|
<div className={cn(styles.content, { [styles.reverse]: textAlign === 'right' })}>
|
|
40
40
|
{children}
|
|
41
41
|
<SortIcon
|