@alfalab/core-components-table 2.0.1 → 2.1.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/component.d.ts +3 -2
- package/component.js +1 -1
- package/components/index.js +1 -1
- package/components/pagination/Component.js +2 -2
- package/components/pagination/index.css +8 -8
- package/components/pagination/index.js +1 -1
- package/components/pagination/select-field/index.css +4 -4
- package/components/pagination/select-field/index.js +2 -2
- package/components/table/Component.d.ts +8 -0
- package/components/table/Component.js +9 -4
- package/components/table/index.css +6 -6
- package/components/table/index.js +1 -1
- package/components/table/utils.js +1 -1
- package/components/table-context/index.d.ts +1 -0
- package/components/table-context/index.js +1 -0
- package/components/tbody/Component.js +2 -2
- package/components/tbody/index.css +2 -2
- package/components/tbody/index.js +1 -1
- package/components/tcell/Component.d.ts +1 -1
- package/components/tcell/Component.js +6 -4
- package/components/tcell/index.css +15 -7
- package/components/tcell/index.js +1 -1
- package/components/texpandable-row/Component.js +2 -2
- package/components/texpandable-row/index.css +5 -5
- package/components/texpandable-row/index.js +1 -1
- package/components/thead/Component.js +2 -2
- package/components/thead/index.css +11 -8
- package/components/thead/index.js +1 -1
- package/components/thead-cell/Component.d.ts +1 -1
- package/components/thead-cell/Component.js +7 -3
- package/components/thead-cell/index.css +16 -8
- package/components/thead-cell/index.js +2 -1
- package/components/trow/Component.js +2 -2
- package/components/trow/index.css +8 -8
- package/components/trow/index.js +1 -1
- package/components/tsortable-head-cell/Component.js +3 -2
- package/components/tsortable-head-cell/index.css +9 -9
- package/components/tsortable-head-cell/index.js +2 -1
- package/components/tsortable-head-cell/sort-icon-asc.js +1 -1
- package/components/tsortable-head-cell/sort-icon-desc.js +1 -1
- package/components/tsortable-head-cell/sort-icon-unset.js +1 -1
- package/cssm/component.d.ts +3 -2
- package/cssm/components/table/Component.d.ts +8 -0
- package/cssm/components/table/Component.js +7 -2
- package/cssm/components/table-context/index.d.ts +1 -0
- package/cssm/components/table-context/index.js +1 -0
- package/cssm/components/tcell/Component.d.ts +1 -1
- package/cssm/components/tcell/Component.js +4 -2
- package/cssm/components/tcell/index.module.css +12 -4
- package/cssm/components/thead/index.module.css +5 -2
- package/cssm/components/thead-cell/Component.d.ts +1 -1
- package/cssm/components/thead-cell/Component.js +5 -1
- package/cssm/components/thead-cell/index.js +1 -0
- package/cssm/components/thead-cell/index.module.css +12 -4
- package/cssm/components/tsortable-head-cell/Component.js +1 -0
- package/cssm/components/tsortable-head-cell/index.js +1 -0
- package/esm/component.d.ts +3 -2
- package/esm/component.js +1 -1
- package/esm/components/index.js +1 -1
- package/esm/components/pagination/Component.js +2 -2
- package/esm/components/pagination/index.css +8 -8
- package/esm/components/pagination/index.js +1 -1
- package/esm/components/pagination/select-field/index.css +4 -4
- package/esm/components/pagination/select-field/index.js +2 -2
- package/esm/components/table/Component.d.ts +8 -0
- package/esm/components/table/Component.js +9 -4
- package/esm/components/table/index.css +6 -6
- package/esm/components/table/index.js +1 -1
- package/esm/components/table/utils.js +1 -1
- package/esm/components/table-context/index.d.ts +1 -0
- package/esm/components/table-context/index.js +1 -0
- package/esm/components/tbody/Component.js +2 -2
- package/esm/components/tbody/index.css +2 -2
- package/esm/components/tbody/index.js +1 -1
- package/esm/components/tcell/Component.d.ts +1 -1
- package/esm/components/tcell/Component.js +6 -4
- package/esm/components/tcell/index.css +15 -7
- package/esm/components/tcell/index.js +1 -1
- package/esm/components/texpandable-row/Component.js +2 -2
- package/esm/components/texpandable-row/index.css +5 -5
- package/esm/components/texpandable-row/index.js +1 -1
- package/esm/components/thead/Component.js +2 -2
- package/esm/components/thead/index.css +11 -8
- package/esm/components/thead/index.js +1 -1
- package/esm/components/thead-cell/Component.d.ts +1 -1
- package/esm/components/thead-cell/Component.js +8 -4
- package/esm/components/thead-cell/index.css +16 -8
- package/esm/components/thead-cell/index.js +2 -1
- package/esm/components/trow/Component.js +2 -2
- package/esm/components/trow/index.css +8 -8
- package/esm/components/trow/index.js +1 -1
- package/esm/components/tsortable-head-cell/Component.js +3 -2
- package/esm/components/tsortable-head-cell/index.css +9 -9
- package/esm/components/tsortable-head-cell/index.js +2 -1
- package/esm/components/tsortable-head-cell/sort-icon-asc.js +1 -1
- package/esm/components/tsortable-head-cell/sort-icon-desc.js +1 -1
- package/esm/components/tsortable-head-cell/sort-icon-unset.js +1 -1
- package/esm/index.js +1 -1
- package/esm/{tslib.es6-0ae67909.d.ts → tslib.es6-dea1ac34.d.ts} +0 -0
- package/esm/{tslib.es6-0ae67909.js → tslib.es6-dea1ac34.js} +0 -0
- package/index.js +1 -1
- package/modern/component.d.ts +3 -2
- package/modern/components/pagination/Component.js +1 -1
- package/modern/components/pagination/index.css +8 -8
- 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.d.ts +8 -0
- package/modern/components/table/Component.js +8 -3
- package/modern/components/table/index.css +6 -6
- package/modern/components/table-context/index.d.ts +1 -0
- package/modern/components/table-context/index.js +1 -0
- package/modern/components/tbody/Component.js +1 -1
- package/modern/components/tbody/index.css +2 -2
- package/modern/components/tcell/Component.d.ts +1 -1
- package/modern/components/tcell/Component.js +5 -3
- package/modern/components/tcell/index.css +15 -7
- 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 +11 -8
- package/modern/components/thead-cell/Component.d.ts +1 -1
- package/modern/components/thead-cell/Component.js +9 -3
- package/modern/components/thead-cell/index.css +16 -8
- package/modern/components/thead-cell/index.js +1 -0
- 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 -1
- package/modern/components/tsortable-head-cell/index.css +9 -9
- package/modern/components/tsortable-head-cell/index.js +1 -0
- package/package.json +2 -2
- /package/{tslib.es6-586ed3f2.d.ts → tslib.es6-c1240170.d.ts} +0 -0
- /package/{tslib.es6-586ed3f2.js → tslib.es6-c1240170.js} +0 -0
package/index.js
CHANGED
package/modern/component.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
declare const Table: import("react").ForwardRefExoticComponent<import("react").TableHTMLAttributes<HTMLTableElement> & {
|
|
3
3
|
compactView?: boolean | undefined;
|
|
4
|
+
compactHorizontal?: boolean | undefined;
|
|
4
5
|
className?: string | undefined;
|
|
5
6
|
children: import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>[];
|
|
6
7
|
wrapper?: boolean | undefined;
|
|
@@ -9,9 +10,9 @@ declare const Table: import("react").ForwardRefExoticComponent<import("react").T
|
|
|
9
10
|
} & import("react").RefAttributes<HTMLTableElement>> & {
|
|
10
11
|
TBody: import("react").FC<import("./components/index").TBodyProps>;
|
|
11
12
|
THead: import("react").FC<import("./components/index").THeadProps>;
|
|
12
|
-
THeadCell: ({ children, className, dataTestId, style, width, textAlign, hidden, ...restProps }: import("./components/index").THeadCellProps) => JSX.Element;
|
|
13
|
+
THeadCell: ({ children, className, dataTestId, style, width, textAlign, hidden, ...restProps }: import("./components/index").THeadCellProps) => JSX.Element | null;
|
|
13
14
|
TSortableHeadCell: ({ children, className, defaultIsSortedDesc, isSortedDesc, textAlign, onSort, ...restProps }: import("./components/index").TSortableHeadCellProps) => JSX.Element;
|
|
14
|
-
TCell: ({ className, style, dataTestId, children, index, ...restProps }: import("./components/index").TCellProps) => JSX.Element;
|
|
15
|
+
TCell: ({ className, style, dataTestId, children, index, ...restProps }: import("./components/index").TCellProps) => JSX.Element | null;
|
|
15
16
|
TRow: ({ children, className, selected, withoutBorder, dataTestId, ...restProps }: import("./components/index").TRowProps) => JSX.Element;
|
|
16
17
|
TExpandableRow: ({ className, selected, expanded, defaultExpanded, onToggle, renderContent, ...restProps }: import("./components/index").TExpandableRowProps) => JSX.Element;
|
|
17
18
|
Pagination: import("react").FC<import("packages/pagination/src").PaginationProps & {
|
|
@@ -6,7 +6,7 @@ import { Pagination as Pagination$1 } from '@alfalab/core-components-pagination/
|
|
|
6
6
|
import '@alfalab/core-components-button/modern';
|
|
7
7
|
import { CustomSelectField } from './select-field/index.js';
|
|
8
8
|
|
|
9
|
-
var styles = {"component":"
|
|
9
|
+
var styles = {"component":"table__component_1a9tl","pagesWrapper":"table__pagesWrapper_1a9tl","tag":"table__tag_1a9tl","tagActive":"table__tagActive_1a9tl","menu":"table__menu_1a9tl","option":"table__option_1a9tl"};
|
|
10
10
|
require('./index.css')
|
|
11
11
|
|
|
12
12
|
const Pagination = ({ perPage = 25, possiblePerPage = [25, 50, 100], onPerPageChange = () => null, pagesCount, onPageChange = () => null, className, dataTestId, ...restPaginationProps }) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 4k94v */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-border-primary: #dbdee1;
|
|
4
4
|
}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
--gap-xl: 24px;
|
|
18
18
|
--gap-2xl: 32px;
|
|
19
19
|
}
|
|
20
|
-
.
|
|
20
|
+
.table__component_1a9tl {
|
|
21
21
|
display: flex;
|
|
22
22
|
justify-content: space-between;
|
|
23
23
|
align-items: flex-start;
|
|
@@ -26,24 +26,24 @@
|
|
|
26
26
|
border-top: 1px solid var(--color-light-border-primary);
|
|
27
27
|
box-sizing: border-box;
|
|
28
28
|
}
|
|
29
|
-
.
|
|
29
|
+
.table__pagesWrapper_1a9tl {
|
|
30
30
|
display: flex;
|
|
31
31
|
}
|
|
32
|
-
.
|
|
32
|
+
.table__tag_1a9tl.table__tag_1a9tl {
|
|
33
33
|
flex-shrink: 0;
|
|
34
34
|
margin-right: var(--gap-xs);
|
|
35
35
|
padding: 0 var(--gap-xs);
|
|
36
36
|
min-width: 32px
|
|
37
37
|
}
|
|
38
|
-
.
|
|
38
|
+
.table__tag_1a9tl.table__tag_1a9tl:last-child {
|
|
39
39
|
margin-right: 0;
|
|
40
40
|
}
|
|
41
|
-
.
|
|
41
|
+
.table__tag_1a9tl.table__tag_1a9tl.table__tagActive_1a9tl {
|
|
42
42
|
cursor: default;
|
|
43
43
|
}
|
|
44
|
-
.
|
|
44
|
+
.table__menu_1a9tl {
|
|
45
45
|
margin: var(--gap-2xs) 0;
|
|
46
46
|
}
|
|
47
|
-
.
|
|
47
|
+
.table__option_1a9tl {
|
|
48
48
|
min-width: 208px;
|
|
49
49
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: isq2c */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-specialbg-component-shade-7: rgba(10, 29, 49, 0.1351);
|
|
4
4
|
}
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
|
|
11
11
|
/* Hard up */
|
|
12
12
|
}
|
|
13
|
-
.
|
|
13
|
+
.table__field_1p8qs svg {
|
|
14
14
|
width: 18px;
|
|
15
15
|
height: 18px;
|
|
16
16
|
}
|
|
17
|
-
.
|
|
18
|
-
.
|
|
17
|
+
.table__open_1p8qs,
|
|
18
|
+
.table__open_1p8qs:hover {
|
|
19
19
|
background-color: var(--color-light-specialbg-component-shade-7);
|
|
20
20
|
}
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
import { Button } from '@alfalab/core-components-button/modern';
|
|
4
4
|
|
|
5
|
-
var styles = {"field":"
|
|
5
|
+
var styles = {"field":"table__field_1p8qs","open":"table__open_1p8qs"};
|
|
6
6
|
require('./index.css')
|
|
7
7
|
|
|
8
8
|
const CustomSelectField = ({ selected, innerProps, Arrow, open }) => {
|
|
@@ -6,6 +6,10 @@ type TableProps = TableHTMLAttributes<HTMLTableElement> & {
|
|
|
6
6
|
* Компактный вид
|
|
7
7
|
*/
|
|
8
8
|
compactView?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Уменьшение горизонтальных паддингов
|
|
11
|
+
*/
|
|
12
|
+
compactHorizontal?: boolean;
|
|
9
13
|
/**
|
|
10
14
|
* Дополнительный класс
|
|
11
15
|
*/
|
|
@@ -32,6 +36,10 @@ declare const Table: React.ForwardRefExoticComponent<React.TableHTMLAttributes<H
|
|
|
32
36
|
* Компактный вид
|
|
33
37
|
*/
|
|
34
38
|
compactView?: boolean | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Уменьшение горизонтальных паддингов
|
|
41
|
+
*/
|
|
42
|
+
compactHorizontal?: boolean | undefined;
|
|
35
43
|
/**
|
|
36
44
|
* Дополнительный класс
|
|
37
45
|
*/
|
|
@@ -5,10 +5,10 @@ import '../../utils.js';
|
|
|
5
5
|
import { findAllHeadCellsProps } from './utils.js';
|
|
6
6
|
import { TableContext } from '../table-context/index.js';
|
|
7
7
|
|
|
8
|
-
var styles = {"component":"
|
|
8
|
+
var styles = {"component":"table__component_l3byt","wrapper":"table__wrapper_l3byt","hasPagination":"table__hasPagination_l3byt","table":"table__table_l3byt"};
|
|
9
9
|
require('./index.css')
|
|
10
10
|
|
|
11
|
-
const Table = forwardRef(({ className, children, compactView = false, wrapper = true, pagination, dataTestId, ...restProps }, ref) => {
|
|
11
|
+
const Table = forwardRef(({ className, children, compactView = false, compactHorizontal = false, wrapper = true, pagination, dataTestId, ...restProps }, ref) => {
|
|
12
12
|
const wrapperRef = useRef(null);
|
|
13
13
|
const columnsConfiguration = useMemo(() => findAllHeadCellsProps(children).map((columnProps, index) => ({
|
|
14
14
|
width: columnProps.width,
|
|
@@ -16,7 +16,12 @@ const Table = forwardRef(({ className, children, compactView = false, wrapper =
|
|
|
16
16
|
hidden: columnProps.hidden,
|
|
17
17
|
index,
|
|
18
18
|
})), [children]);
|
|
19
|
-
return (React.createElement(TableContext.Provider, { value: {
|
|
19
|
+
return (React.createElement(TableContext.Provider, { value: {
|
|
20
|
+
columnsConfiguration,
|
|
21
|
+
compactView,
|
|
22
|
+
compactHorizontal,
|
|
23
|
+
wrapperRef,
|
|
24
|
+
} },
|
|
20
25
|
React.createElement("div", { ref: wrapperRef, className: cn(styles.component, className, {
|
|
21
26
|
[styles.wrapper]: wrapper,
|
|
22
27
|
[styles.hasPagination]: !!pagination,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 90lbl */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-bg-primary: #fff;
|
|
4
4
|
}
|
|
@@ -18,26 +18,26 @@
|
|
|
18
18
|
:root {
|
|
19
19
|
--border-radius-m: 8px;
|
|
20
20
|
}
|
|
21
|
-
.
|
|
21
|
+
.table__component_l3byt {
|
|
22
22
|
box-sizing: border-box;
|
|
23
23
|
}
|
|
24
|
-
.
|
|
24
|
+
.table__wrapper_l3byt {
|
|
25
25
|
padding: 0 var(--gap-m) var(--gap-m);
|
|
26
26
|
background: var(--color-light-bg-primary);
|
|
27
27
|
box-shadow: var(--shadow-xs-hard);
|
|
28
28
|
border-radius: var(--border-radius-m);
|
|
29
29
|
overflow: auto;
|
|
30
30
|
}
|
|
31
|
-
.
|
|
31
|
+
.table__hasPagination_l3byt {
|
|
32
32
|
padding-bottom: 0;
|
|
33
33
|
}
|
|
34
|
-
.
|
|
34
|
+
.table__table_l3byt {
|
|
35
35
|
width: 100%;
|
|
36
36
|
border-collapse: collapse;
|
|
37
37
|
box-sizing: border-box
|
|
38
38
|
|
|
39
39
|
/* TODO: Хак для выравнивания чекбокса */
|
|
40
40
|
}
|
|
41
|
-
.
|
|
41
|
+
.table__table_l3byt td:first-child label > *[class^='box'], .table__table_l3byt th:first-child label > *[class^='box'] {
|
|
42
42
|
margin-top: 0;
|
|
43
43
|
}
|
|
@@ -11,6 +11,7 @@ type ColumnConfiguration = {
|
|
|
11
11
|
type TableContextType = {
|
|
12
12
|
columnsConfiguration: ColumnConfiguration[];
|
|
13
13
|
compactView: boolean;
|
|
14
|
+
compactHorizontal: boolean;
|
|
14
15
|
wrapperRef: RefObject<HTMLDivElement>;
|
|
15
16
|
};
|
|
16
17
|
declare const DEFAULT_TABLE_CONTEXT: TableContextType;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
|
|
4
|
-
var styles = {"component":"
|
|
4
|
+
var styles = {"component":"table__component_f6c8l"};
|
|
5
5
|
require('./index.css')
|
|
6
6
|
|
|
7
7
|
const TBody = ({ className, children, dataTestId, ...restProps }) => {
|
|
@@ -14,5 +14,5 @@ type TCellProps = TdHTMLAttributes<HTMLTableCellElement> & {
|
|
|
14
14
|
*/
|
|
15
15
|
index?: number;
|
|
16
16
|
};
|
|
17
|
-
declare const TCell: ({ className, style, dataTestId, children, index, ...restProps }: TCellProps) => JSX.Element;
|
|
17
|
+
declare const TCell: ({ className, style, dataTestId, children, index, ...restProps }: TCellProps) => JSX.Element | null;
|
|
18
18
|
export { TCellProps, TCell };
|
|
@@ -2,16 +2,18 @@ import React, { useContext } from 'react';
|
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
import { TableContext } from '../table-context/index.js';
|
|
4
4
|
|
|
5
|
-
var styles = {"component":"
|
|
5
|
+
var styles = {"component":"table__component_ym8vu","compactHorizontal":"table__compactHorizontal_ym8vu","compact":"table__compact_ym8vu"};
|
|
6
6
|
require('./index.css')
|
|
7
7
|
|
|
8
8
|
const TCell = ({ className, style, dataTestId, children, index, ...restProps }) => {
|
|
9
|
-
const { columnsConfiguration, compactView } = useContext(TableContext);
|
|
9
|
+
const { columnsConfiguration, compactView, compactHorizontal } = useContext(TableContext);
|
|
10
10
|
const column = index === undefined ? null : columnsConfiguration[index];
|
|
11
11
|
const width = column?.width;
|
|
12
12
|
const textAlign = column?.textAlign;
|
|
13
13
|
const hidden = column?.hidden || false;
|
|
14
|
-
|
|
14
|
+
if (hidden)
|
|
15
|
+
return null;
|
|
16
|
+
return (React.createElement("td", Object.assign({ className: cn(styles.component, className, compactView && styles.compact, compactHorizontal && styles.compactHorizontal), style: { ...style, width, textAlign }, "data-test-id": dataTestId }, restProps), children));
|
|
15
17
|
};
|
|
16
18
|
|
|
17
19
|
export { TCell };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 61dh2 */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-border-primary: #dbdee1;
|
|
4
4
|
--color-light-text-primary: #0b1f35;
|
|
@@ -13,25 +13,33 @@
|
|
|
13
13
|
}
|
|
14
14
|
:root {
|
|
15
15
|
--gap-xs: 8px;
|
|
16
|
+
--gap-s: 12px;
|
|
16
17
|
--gap-m: 16px;
|
|
17
18
|
--gap-xl: 24px;
|
|
18
19
|
}
|
|
19
|
-
.
|
|
20
|
+
.table__component_ym8vu {
|
|
20
21
|
font-size: 14px;
|
|
21
22
|
line-height: 20px;
|
|
22
23
|
font-weight: 400;
|
|
23
24
|
|
|
24
25
|
color: var(--color-light-text-primary);
|
|
25
|
-
padding: var(--gap-xl) var(--gap-
|
|
26
|
+
padding: var(--gap-xl) var(--gap-s);
|
|
26
27
|
height: 72px;
|
|
27
28
|
border-top: 1px solid var(--color-light-border-primary);
|
|
28
29
|
vertical-align: top;
|
|
29
|
-
box-sizing: border-box
|
|
30
|
+
box-sizing: border-box
|
|
30
31
|
}
|
|
31
|
-
.
|
|
32
|
-
|
|
32
|
+
.table__component_ym8vu:first-child {
|
|
33
|
+
padding-left: var(--gap-m);
|
|
34
|
+
}
|
|
35
|
+
.table__component_ym8vu:last-child {
|
|
36
|
+
padding-right: var(--gap-m);
|
|
37
|
+
}
|
|
38
|
+
.table__compactHorizontal_ym8vu {
|
|
39
|
+
padding-left: 6px;
|
|
40
|
+
padding-right: 6px;
|
|
33
41
|
}
|
|
34
|
-
.
|
|
42
|
+
.table__compact_ym8vu {
|
|
35
43
|
padding-top: var(--gap-xs);
|
|
36
44
|
padding-bottom: var(--gap-xs);
|
|
37
45
|
|
|
@@ -2,7 +2,7 @@ import React, { useState } from 'react';
|
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
import { TRow } from '../trow/Component.js';
|
|
4
4
|
|
|
5
|
-
var styles = {"row":"
|
|
5
|
+
var styles = {"row":"table__row_4j42w","selected":"table__selected_4j42w","expanded":"table__expanded_4j42w","expandable":"table__expandable_4j42w"};
|
|
6
6
|
require('./index.css')
|
|
7
7
|
|
|
8
8
|
const TExpandableRow = ({ className, selected, expanded, defaultExpanded = false, onToggle = () => null, renderContent = () => null, ...restProps }) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1xwa7 */
|
|
2
2
|
:root {
|
|
3
3
|
|
|
4
4
|
/* Hard */
|
|
@@ -7,16 +7,16 @@
|
|
|
7
7
|
|
|
8
8
|
/* Hard up */
|
|
9
9
|
}
|
|
10
|
-
.
|
|
10
|
+
.table__row_4j42w {
|
|
11
11
|
cursor: pointer;
|
|
12
12
|
}
|
|
13
|
-
.
|
|
13
|
+
.table__selected_4j42w.table__expanded_4j42w {
|
|
14
14
|
background-color: inherit;
|
|
15
15
|
}
|
|
16
|
-
.
|
|
16
|
+
.table__expanded_4j42w:hover {
|
|
17
17
|
background-color: inherit;
|
|
18
18
|
}
|
|
19
|
-
.
|
|
19
|
+
.table__expandable_4j42w td {
|
|
20
20
|
margin: 0;
|
|
21
21
|
padding-top: 0;
|
|
22
22
|
padding-bottom: 0;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
|
|
4
|
-
var styles = {"component":"
|
|
4
|
+
var styles = {"component":"table__component_9m0bu","row":"table__row_9m0bu"};
|
|
5
5
|
require('./index.css')
|
|
6
6
|
|
|
7
7
|
const THead = ({ className, rowClassName, children, dataTestId, ...restProps }) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 11mtw */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-graphic-quaternary: #dbdee1;
|
|
4
4
|
}
|
|
@@ -10,12 +10,15 @@
|
|
|
10
10
|
|
|
11
11
|
/* Hard up */
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
:root {
|
|
14
|
+
--gap-xs: 8px;
|
|
15
|
+
}
|
|
16
|
+
.table__component_9m0bu {
|
|
14
17
|
position: relative;
|
|
15
18
|
width: 100%;
|
|
16
19
|
box-sizing: border-box
|
|
17
20
|
}
|
|
18
|
-
.
|
|
21
|
+
.table__component_9m0bu th:not(:last-child):not(:empty):after {
|
|
19
22
|
transition: opacity 0.2s;
|
|
20
23
|
position: absolute;
|
|
21
24
|
content: '';
|
|
@@ -23,16 +26,16 @@
|
|
|
23
26
|
|
|
24
27
|
width: 1px;
|
|
25
28
|
right: 0;
|
|
26
|
-
top:
|
|
27
|
-
bottom:
|
|
29
|
+
top: var(--gap-xs);
|
|
30
|
+
bottom: var(--gap-xs);
|
|
28
31
|
background-color: var(--color-light-graphic-quaternary);
|
|
29
32
|
}
|
|
30
|
-
.
|
|
33
|
+
.table__component_9m0bu th:after {
|
|
31
34
|
opacity: 0;
|
|
32
35
|
}
|
|
33
|
-
.
|
|
36
|
+
.table__component_9m0bu:hover th:after {
|
|
34
37
|
opacity: 1;
|
|
35
38
|
}
|
|
36
|
-
.
|
|
39
|
+
.table__row_9m0bu {
|
|
37
40
|
height: 72px;
|
|
38
41
|
}
|
|
@@ -23,5 +23,5 @@ type THeadCellProps = ThHTMLAttributes<HTMLHeadingElement> & {
|
|
|
23
23
|
*/
|
|
24
24
|
dataTestId?: string;
|
|
25
25
|
};
|
|
26
|
-
declare const THeadCell: ({ children, className, dataTestId, style, width, textAlign, hidden, ...restProps }: THeadCellProps) => JSX.Element;
|
|
26
|
+
declare const THeadCell: ({ children, className, dataTestId, style, width, textAlign, hidden, ...restProps }: THeadCellProps) => JSX.Element | null;
|
|
27
27
|
export { THeadCellProps, THeadCell };
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
|
+
import { TableContext } from '../table-context/index.js';
|
|
3
4
|
|
|
4
|
-
var styles = {"component":"
|
|
5
|
+
var styles = {"component":"table__component_1shkg","sortable":"table__sortable_1shkg","sorted":"table__sorted_1shkg","compactHorizontal":"table__compactHorizontal_1shkg"};
|
|
5
6
|
require('./index.css')
|
|
6
7
|
|
|
7
|
-
const THeadCell = ({ children, className, dataTestId, style, width, textAlign, hidden, ...restProps }) =>
|
|
8
|
+
const THeadCell = ({ children, className, dataTestId, style, width, textAlign, hidden, ...restProps }) => {
|
|
9
|
+
const { compactHorizontal } = useContext(TableContext);
|
|
10
|
+
if (hidden)
|
|
11
|
+
return null;
|
|
12
|
+
return (React.createElement("th", Object.assign({ className: cn(styles.component, className, compactHorizontal && styles.compactHorizontal), style: { ...style, width, textAlign }, "data-test-id": dataTestId }, restProps), children));
|
|
13
|
+
};
|
|
8
14
|
|
|
9
15
|
export { THeadCell };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: dfz4y */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-bg-primary: #fff;
|
|
4
4
|
--color-light-border-primary: #dbdee1;
|
|
@@ -14,10 +14,11 @@
|
|
|
14
14
|
}
|
|
15
15
|
:root {
|
|
16
16
|
--gap-2xs: 4px;
|
|
17
|
+
--gap-s: 12px;
|
|
17
18
|
--gap-m: 16px;
|
|
18
19
|
--gap-2xl: 32px;
|
|
19
20
|
}
|
|
20
|
-
.
|
|
21
|
+
.table__component_1shkg {
|
|
21
22
|
font-size: 12px;
|
|
22
23
|
line-height: 16px;
|
|
23
24
|
font-weight: 500;
|
|
@@ -28,18 +29,25 @@
|
|
|
28
29
|
position: relative;
|
|
29
30
|
text-align: left;
|
|
30
31
|
color: var(--color-light-text-primary);
|
|
31
|
-
padding: var(--gap-2xl) var(--gap-
|
|
32
|
+
padding: var(--gap-2xl) var(--gap-s) var(--gap-2xs);
|
|
32
33
|
border-bottom: 1px solid var(--color-light-border-primary);
|
|
33
34
|
background: var(--color-light-bg-primary);
|
|
34
35
|
vertical-align: top;
|
|
35
|
-
box-sizing: border-box
|
|
36
|
+
box-sizing: border-box
|
|
36
37
|
}
|
|
37
|
-
.
|
|
38
|
+
.table__component_1shkg:first-child {
|
|
39
|
+
padding-left: var(--gap-m);
|
|
40
|
+
}
|
|
41
|
+
.table__component_1shkg:last-child {
|
|
42
|
+
padding-right: var(--gap-m);
|
|
43
|
+
}
|
|
44
|
+
.table__sortable_1shkg {
|
|
38
45
|
cursor: pointer;
|
|
39
46
|
}
|
|
40
|
-
.
|
|
47
|
+
.table__sorted_1shkg {
|
|
41
48
|
color: var(--color-light-text-primary);
|
|
42
49
|
}
|
|
43
|
-
.
|
|
44
|
-
|
|
50
|
+
.table__compactHorizontal_1shkg {
|
|
51
|
+
padding-left: 6px;
|
|
52
|
+
padding-right: 6px;
|
|
45
53
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
|
|
4
|
-
var styles = {"component":"
|
|
4
|
+
var styles = {"component":"table__component_14sgq","withoutBorder":"table__withoutBorder_14sgq","clickable":"table__clickable_14sgq","selected":"table__selected_14sgq"};
|
|
5
5
|
require('./index.css')
|
|
6
6
|
|
|
7
7
|
const TRow = ({ children, className, selected, withoutBorder, dataTestId, ...restProps }) => (React.createElement("tr", Object.assign({ className: cn(styles.component, className, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: mdzjf */
|
|
2
2
|
:root {
|
|
3
3
|
--color-static-graphic-solitude: #e8f2fe;
|
|
4
4
|
}
|
|
@@ -14,30 +14,30 @@
|
|
|
14
14
|
|
|
15
15
|
/* Hard up */
|
|
16
16
|
}
|
|
17
|
-
.
|
|
17
|
+
.table__component_14sgq {
|
|
18
18
|
padding-top: 1px;
|
|
19
19
|
width: 100%;
|
|
20
20
|
transition: background-color 0.2s;
|
|
21
21
|
box-sizing: border-box;
|
|
22
22
|
background: var(--color-light-bg-primary)
|
|
23
23
|
}
|
|
24
|
-
.
|
|
24
|
+
.table__component_14sgq:first-child td {
|
|
25
25
|
border-top: 0;
|
|
26
26
|
}
|
|
27
|
-
.
|
|
27
|
+
.table__withoutBorder_14sgq {
|
|
28
28
|
td {
|
|
29
29
|
border: none;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
.
|
|
32
|
+
.table__clickable_14sgq {
|
|
33
33
|
cursor: pointer
|
|
34
34
|
}
|
|
35
|
-
.
|
|
35
|
+
.table__clickable_14sgq:hover {
|
|
36
36
|
background-color: var(--color-light-bg-secondary);
|
|
37
37
|
}
|
|
38
|
-
.
|
|
38
|
+
.table__selected_14sgq {
|
|
39
39
|
background-color: #f2f8ff /* нет цвета в палитре */
|
|
40
40
|
}
|
|
41
|
-
.
|
|
41
|
+
.table__selected_14sgq:hover {
|
|
42
42
|
background-color: var(--color-static-graphic-solitude);
|
|
43
43
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
|
+
import '../table-context/index.js';
|
|
3
4
|
import { THeadCell } from '../thead-cell/Component.js';
|
|
4
5
|
import { SortIconAsc } from './sort-icon-asc.js';
|
|
5
6
|
import { SortIconDesc } from './sort-icon-desc.js';
|
|
6
7
|
import { SortIconUnset } from './sort-icon-unset.js';
|
|
7
8
|
|
|
8
|
-
var styles = {"component":"
|
|
9
|
+
var styles = {"component":"table__component_1m0on","content":"table__content_1m0on","icon":"table__icon_1m0on","reverse":"table__reverse_1m0on","sorted":"table__sorted_1m0on"};
|
|
9
10
|
require('./index.css')
|
|
10
11
|
|
|
11
12
|
const TSortableHeadCell = ({ children, className, defaultIsSortedDesc, isSortedDesc, textAlign, onSort, ...restProps }) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1dsz1 */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-graphic-link: #007aff;
|
|
4
4
|
--color-light-graphic-primary: #0b1f35;
|
|
@@ -15,14 +15,14 @@
|
|
|
15
15
|
:root {
|
|
16
16
|
--gap-xs: 8px;
|
|
17
17
|
}
|
|
18
|
-
.
|
|
18
|
+
.table__component_1m0on {
|
|
19
19
|
position: relative;
|
|
20
20
|
}
|
|
21
|
-
.
|
|
21
|
+
.table__content_1m0on {
|
|
22
22
|
display: flex;
|
|
23
23
|
align-items: flex-start;
|
|
24
24
|
}
|
|
25
|
-
.
|
|
25
|
+
.table__icon_1m0on {
|
|
26
26
|
cursor: pointer;
|
|
27
27
|
margin-left: var(--gap-xs);
|
|
28
28
|
|
|
@@ -35,19 +35,19 @@
|
|
|
35
35
|
transition: color 0.2s ease;
|
|
36
36
|
flex-shrink: 0
|
|
37
37
|
}
|
|
38
|
-
.
|
|
38
|
+
.table__icon_1m0on:hover {
|
|
39
39
|
color: var(--color-light-graphic-primary);
|
|
40
40
|
}
|
|
41
|
-
.
|
|
41
|
+
.table__reverse_1m0on {
|
|
42
42
|
flex-direction: row-reverse
|
|
43
43
|
}
|
|
44
|
-
.
|
|
44
|
+
.table__reverse_1m0on .table__icon_1m0on {
|
|
45
45
|
margin-left: 0;
|
|
46
46
|
margin-right: var(--gap-xs);
|
|
47
47
|
}
|
|
48
|
-
.
|
|
48
|
+
.table__sorted_1m0on {
|
|
49
49
|
color: var(--color-light-graphic-link)
|
|
50
50
|
}
|
|
51
|
-
.
|
|
51
|
+
.table__sorted_1m0on:hover {
|
|
52
52
|
color: var(--color-light-graphic-link);
|
|
53
53
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfalab/core-components-table",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@alfalab/core-components-button": "^6.0.1",
|
|
19
19
|
"@alfalab/core-components-pagination": "^2.0.1",
|
|
20
|
-
"@alfalab/core-components-select": "^12.
|
|
20
|
+
"@alfalab/core-components-select": "^12.1.1",
|
|
21
21
|
"classnames": "^2.3.1"
|
|
22
22
|
}
|
|
23
23
|
}
|