@alfalab/core-components-table 1.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/CHANGELOG.md +11 -0
- package/dist/component.d.ts +24 -0
- package/dist/component.js +39 -0
- package/dist/components/index.d.ts +9 -0
- package/dist/components/index.js +38 -0
- package/dist/components/pagination/Component.d.ts +22 -0
- package/dist/components/pagination/Component.js +52 -0
- package/dist/components/pagination/index.css +49 -0
- package/dist/components/pagination/index.d.ts +1 -0
- package/dist/components/pagination/index.js +17 -0
- package/dist/components/pagination/select-field/index.css +20 -0
- package/dist/components/pagination/select-field/index.d.ts +3 -0
- package/dist/components/pagination/select-field/index.js +26 -0
- package/dist/components/table/Component.d.ts +56 -0
- package/dist/components/table/Component.js +42 -0
- package/dist/components/table/index.css +39 -0
- package/dist/components/table/index.d.ts +1 -0
- package/dist/components/table/index.js +16 -0
- package/dist/components/table/utils.d.ts +5 -0
- package/dist/components/table/utils.js +27 -0
- package/dist/components/table-context/index.d.ts +18 -0
- package/dist/components/table-context/index.js +19 -0
- package/dist/components/tbody/Component.d.ts +15 -0
- package/dist/components/tbody/Component.js +22 -0
- package/dist/components/tbody/index.css +13 -0
- package/dist/components/tbody/index.d.ts +1 -0
- package/dist/components/tbody/index.js +12 -0
- package/dist/components/tcell/Component.d.ts +18 -0
- package/dist/components/tcell/Component.js +28 -0
- package/dist/components/tcell/index.css +42 -0
- package/dist/components/tcell/index.d.ts +1 -0
- package/dist/components/tcell/index.js +13 -0
- package/dist/components/texpandable-row/Component.d.ts +11 -0
- package/dist/components/texpandable-row/Component.js +38 -0
- package/dist/components/texpandable-row/index.css +24 -0
- package/dist/components/texpandable-row/index.d.ts +1 -0
- package/dist/components/texpandable-row/index.js +13 -0
- package/dist/components/thead/Component.d.ts +19 -0
- package/dist/components/thead/Component.js +23 -0
- package/dist/components/thead/index.css +38 -0
- package/dist/components/thead/index.d.ts +1 -0
- package/dist/components/thead/index.js +12 -0
- package/dist/components/thead-cell/Component.d.ts +27 -0
- package/dist/components/thead-cell/Component.js +22 -0
- package/dist/components/thead-cell/index.css +44 -0
- package/dist/components/thead-cell/index.d.ts +1 -0
- package/dist/components/thead-cell/index.js +12 -0
- package/dist/components/trow/Component.d.ts +28 -0
- package/dist/components/trow/Component.js +27 -0
- package/dist/components/trow/index.css +43 -0
- package/dist/components/trow/index.d.ts +1 -0
- package/dist/components/trow/index.js +12 -0
- package/dist/components/tsortable-head-cell/Component.d.ts +9 -0
- package/dist/components/tsortable-head-cell/Component.js +40 -0
- package/dist/components/tsortable-head-cell/index.css +46 -0
- package/dist/components/tsortable-head-cell/index.d.ts +1 -0
- package/dist/components/tsortable-head-cell/index.js +16 -0
- package/dist/components/tsortable-head-cell/sort-icon-asc.d.ts +5 -0
- package/dist/components/tsortable-head-cell/sort-icon-asc.js +15 -0
- package/dist/components/tsortable-head-cell/sort-icon-desc.d.ts +5 -0
- package/dist/components/tsortable-head-cell/sort-icon-desc.js +15 -0
- package/dist/components/tsortable-head-cell/sort-icon-unset.d.ts +5 -0
- package/dist/components/tsortable-head-cell/sort-icon-unset.js +15 -0
- package/dist/cssm/component.d.ts +24 -0
- package/dist/cssm/component.js +49 -0
- package/dist/cssm/components/index.d.ts +9 -0
- package/dist/cssm/components/index.js +48 -0
- package/dist/cssm/components/pagination/Component.d.ts +22 -0
- package/dist/cssm/components/pagination/Component.js +52 -0
- package/dist/cssm/components/pagination/index.d.ts +1 -0
- package/dist/cssm/components/pagination/index.js +19 -0
- package/dist/cssm/components/pagination/index.module.css +48 -0
- package/dist/cssm/components/pagination/select-field/index.d.ts +3 -0
- package/dist/cssm/components/pagination/select-field/index.js +25 -0
- package/dist/cssm/components/pagination/select-field/index.module.css +19 -0
- package/dist/cssm/components/table/Component.d.ts +56 -0
- package/dist/cssm/components/table/Component.js +42 -0
- package/dist/cssm/components/table/index.d.ts +1 -0
- package/dist/cssm/components/table/index.js +18 -0
- package/dist/cssm/components/table/index.module.css +38 -0
- package/dist/cssm/components/table/utils.d.ts +5 -0
- package/dist/cssm/components/table/utils.js +28 -0
- package/dist/cssm/components/table-context/index.d.ts +18 -0
- package/dist/cssm/components/table-context/index.js +19 -0
- package/dist/cssm/components/tbody/Component.d.ts +15 -0
- package/dist/cssm/components/tbody/Component.js +21 -0
- package/dist/cssm/components/tbody/index.d.ts +1 -0
- package/dist/cssm/components/tbody/index.js +13 -0
- package/dist/cssm/components/tbody/index.module.css +12 -0
- package/dist/cssm/components/tcell/Component.d.ts +18 -0
- package/dist/cssm/components/tcell/Component.js +27 -0
- package/dist/cssm/components/tcell/index.d.ts +1 -0
- package/dist/cssm/components/tcell/index.js +14 -0
- package/dist/cssm/components/tcell/index.module.css +41 -0
- package/dist/cssm/components/texpandable-row/Component.d.ts +11 -0
- package/dist/cssm/components/texpandable-row/Component.js +38 -0
- package/dist/cssm/components/texpandable-row/index.d.ts +1 -0
- package/dist/cssm/components/texpandable-row/index.js +15 -0
- package/dist/cssm/components/texpandable-row/index.module.css +23 -0
- package/dist/cssm/components/thead/Component.d.ts +19 -0
- package/dist/cssm/components/thead/Component.js +22 -0
- package/dist/cssm/components/thead/index.d.ts +1 -0
- package/dist/cssm/components/thead/index.js +13 -0
- package/dist/cssm/components/thead/index.module.css +37 -0
- package/dist/cssm/components/thead-cell/Component.d.ts +27 -0
- package/dist/cssm/components/thead-cell/Component.js +21 -0
- package/dist/cssm/components/thead-cell/index.d.ts +1 -0
- package/dist/cssm/components/thead-cell/index.js +13 -0
- package/dist/cssm/components/thead-cell/index.module.css +43 -0
- package/dist/cssm/components/trow/Component.d.ts +28 -0
- package/dist/cssm/components/trow/Component.js +26 -0
- package/dist/cssm/components/trow/index.d.ts +1 -0
- package/dist/cssm/components/trow/index.js +13 -0
- package/dist/cssm/components/trow/index.module.css +42 -0
- package/dist/cssm/components/tsortable-head-cell/Component.d.ts +9 -0
- package/dist/cssm/components/tsortable-head-cell/Component.js +40 -0
- package/dist/cssm/components/tsortable-head-cell/index.d.ts +1 -0
- package/dist/cssm/components/tsortable-head-cell/index.js +18 -0
- package/dist/cssm/components/tsortable-head-cell/index.module.css +45 -0
- package/dist/cssm/components/tsortable-head-cell/sort-icon-asc.d.ts +5 -0
- package/dist/cssm/components/tsortable-head-cell/sort-icon-asc.js +15 -0
- package/dist/cssm/components/tsortable-head-cell/sort-icon-desc.d.ts +5 -0
- package/dist/cssm/components/tsortable-head-cell/sort-icon-desc.js +15 -0
- package/dist/cssm/components/tsortable-head-cell/sort-icon-unset.d.ts +5 -0
- package/dist/cssm/components/tsortable-head-cell/sort-icon-unset.js +15 -0
- package/dist/cssm/index.d.ts +1 -0
- package/dist/cssm/index.js +41 -0
- package/dist/cssm/tslib.es6-ce870b46.d.ts +32 -0
- package/dist/cssm/tslib.es6-ce870b46.js +42 -0
- package/dist/cssm/typings.d.ts +2 -0
- package/dist/cssm/typings.js +2 -0
- package/dist/cssm/utils.d.ts +4 -0
- package/dist/cssm/utils.js +16 -0
- package/dist/esm/component.d.ts +24 -0
- package/dist/esm/component.js +35 -0
- package/dist/esm/components/index.d.ts +9 -0
- package/dist/esm/components/index.js +22 -0
- package/dist/esm/components/pagination/Component.d.ts +22 -0
- package/dist/esm/components/pagination/Component.js +43 -0
- package/dist/esm/components/pagination/index.css +49 -0
- package/dist/esm/components/pagination/index.d.ts +1 -0
- package/dist/esm/components/pagination/index.js +9 -0
- package/dist/esm/components/pagination/select-field/index.css +20 -0
- package/dist/esm/components/pagination/select-field/index.d.ts +3 -0
- package/dist/esm/components/pagination/select-field/index.js +17 -0
- package/dist/esm/components/table/Component.d.ts +56 -0
- package/dist/esm/components/table/Component.js +33 -0
- package/dist/esm/components/table/index.css +39 -0
- package/dist/esm/components/table/index.d.ts +1 -0
- package/dist/esm/components/table/index.js +8 -0
- package/dist/esm/components/table/utils.d.ts +5 -0
- package/dist/esm/components/table/utils.js +19 -0
- package/dist/esm/components/table-context/index.d.ts +18 -0
- package/dist/esm/components/table-context/index.js +10 -0
- package/dist/esm/components/tbody/Component.d.ts +15 -0
- package/dist/esm/components/tbody/Component.js +13 -0
- package/dist/esm/components/tbody/index.css +13 -0
- package/dist/esm/components/tbody/index.d.ts +1 -0
- package/dist/esm/components/tbody/index.js +4 -0
- package/dist/esm/components/tcell/Component.d.ts +18 -0
- package/dist/esm/components/tcell/Component.js +19 -0
- package/dist/esm/components/tcell/index.css +42 -0
- package/dist/esm/components/tcell/index.d.ts +1 -0
- package/dist/esm/components/tcell/index.js +5 -0
- package/dist/esm/components/texpandable-row/Component.d.ts +11 -0
- package/dist/esm/components/texpandable-row/Component.js +29 -0
- package/dist/esm/components/texpandable-row/index.css +24 -0
- package/dist/esm/components/texpandable-row/index.d.ts +1 -0
- package/dist/esm/components/texpandable-row/index.js +5 -0
- package/dist/esm/components/thead/Component.d.ts +19 -0
- package/dist/esm/components/thead/Component.js +14 -0
- package/dist/esm/components/thead/index.css +38 -0
- package/dist/esm/components/thead/index.d.ts +1 -0
- package/dist/esm/components/thead/index.js +4 -0
- package/dist/esm/components/thead-cell/Component.d.ts +27 -0
- package/dist/esm/components/thead-cell/Component.js +13 -0
- package/dist/esm/components/thead-cell/index.css +44 -0
- package/dist/esm/components/thead-cell/index.d.ts +1 -0
- package/dist/esm/components/thead-cell/index.js +4 -0
- package/dist/esm/components/trow/Component.d.ts +28 -0
- package/dist/esm/components/trow/Component.js +18 -0
- package/dist/esm/components/trow/index.css +43 -0
- package/dist/esm/components/trow/index.d.ts +1 -0
- package/dist/esm/components/trow/index.js +4 -0
- package/dist/esm/components/tsortable-head-cell/Component.d.ts +9 -0
- package/dist/esm/components/tsortable-head-cell/Component.js +31 -0
- package/dist/esm/components/tsortable-head-cell/index.css +46 -0
- package/dist/esm/components/tsortable-head-cell/index.d.ts +1 -0
- package/dist/esm/components/tsortable-head-cell/index.js +8 -0
- package/dist/esm/components/tsortable-head-cell/sort-icon-asc.d.ts +5 -0
- package/dist/esm/components/tsortable-head-cell/sort-icon-asc.js +7 -0
- package/dist/esm/components/tsortable-head-cell/sort-icon-desc.d.ts +5 -0
- package/dist/esm/components/tsortable-head-cell/sort-icon-desc.js +7 -0
- package/dist/esm/components/tsortable-head-cell/sort-icon-unset.d.ts +5 -0
- package/dist/esm/components/tsortable-head-cell/sort-icon-unset.js +7 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +23 -0
- package/dist/esm/tslib.es6-f3c5f2e2.d.ts +32 -0
- package/dist/esm/tslib.es6-f3c5f2e2.js +40 -0
- package/dist/esm/typings.d.ts +2 -0
- package/dist/esm/typings.js +1 -0
- package/dist/esm/utils.d.ts +4 -0
- package/dist/esm/utils.js +8 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +31 -0
- package/dist/modern/component.d.ts +24 -0
- package/dist/modern/component.js +34 -0
- package/dist/modern/components/index.d.ts +9 -0
- package/dist/modern/components/index.js +21 -0
- package/dist/modern/components/pagination/Component.d.ts +22 -0
- package/dist/modern/components/pagination/Component.js +38 -0
- package/dist/modern/components/pagination/index.css +49 -0
- package/dist/modern/components/pagination/index.d.ts +1 -0
- package/dist/modern/components/pagination/index.js +8 -0
- package/dist/modern/components/pagination/select-field/index.css +20 -0
- package/dist/modern/components/pagination/select-field/index.d.ts +3 -0
- package/dist/modern/components/pagination/select-field/index.js +14 -0
- package/dist/modern/components/table/Component.d.ts +56 -0
- package/dist/modern/components/table/Component.js +28 -0
- package/dist/modern/components/table/index.css +39 -0
- package/dist/modern/components/table/index.d.ts +1 -0
- package/dist/modern/components/table/index.js +7 -0
- package/dist/modern/components/table/utils.d.ts +5 -0
- package/dist/modern/components/table/utils.js +18 -0
- package/dist/modern/components/table-context/index.d.ts +18 -0
- package/dist/modern/components/table-context/index.js +10 -0
- package/dist/modern/components/tbody/Component.d.ts +15 -0
- package/dist/modern/components/tbody/Component.js +11 -0
- package/dist/modern/components/tbody/index.css +13 -0
- package/dist/modern/components/tbody/index.d.ts +1 -0
- package/dist/modern/components/tbody/index.js +3 -0
- package/dist/modern/components/tcell/Component.d.ts +18 -0
- package/dist/modern/components/tcell/Component.js +17 -0
- package/dist/modern/components/tcell/index.css +42 -0
- package/dist/modern/components/tcell/index.d.ts +1 -0
- package/dist/modern/components/tcell/index.js +4 -0
- package/dist/modern/components/texpandable-row/Component.d.ts +11 -0
- package/dist/modern/components/texpandable-row/Component.js +26 -0
- package/dist/modern/components/texpandable-row/index.css +24 -0
- package/dist/modern/components/texpandable-row/index.d.ts +1 -0
- package/dist/modern/components/texpandable-row/index.js +4 -0
- package/dist/modern/components/thead/Component.d.ts +19 -0
- package/dist/modern/components/thead/Component.js +12 -0
- package/dist/modern/components/thead/index.css +38 -0
- package/dist/modern/components/thead/index.d.ts +1 -0
- package/dist/modern/components/thead/index.js +3 -0
- package/dist/modern/components/thead-cell/Component.d.ts +27 -0
- package/dist/modern/components/thead-cell/Component.js +9 -0
- package/dist/modern/components/thead-cell/index.css +44 -0
- package/dist/modern/components/thead-cell/index.d.ts +1 -0
- package/dist/modern/components/thead-cell/index.js +3 -0
- package/dist/modern/components/trow/Component.d.ts +28 -0
- package/dist/modern/components/trow/Component.js +13 -0
- package/dist/modern/components/trow/index.css +43 -0
- package/dist/modern/components/trow/index.d.ts +1 -0
- package/dist/modern/components/trow/index.js +3 -0
- package/dist/modern/components/tsortable-head-cell/Component.d.ts +9 -0
- package/dist/modern/components/tsortable-head-cell/Component.js +28 -0
- package/dist/modern/components/tsortable-head-cell/index.css +46 -0
- package/dist/modern/components/tsortable-head-cell/index.d.ts +1 -0
- package/dist/modern/components/tsortable-head-cell/index.js +7 -0
- package/dist/modern/components/tsortable-head-cell/sort-icon-asc.d.ts +5 -0
- package/dist/modern/components/tsortable-head-cell/sort-icon-asc.js +6 -0
- package/dist/modern/components/tsortable-head-cell/sort-icon-desc.d.ts +5 -0
- package/dist/modern/components/tsortable-head-cell/sort-icon-desc.js +6 -0
- package/dist/modern/components/tsortable-head-cell/sort-icon-unset.d.ts +5 -0
- package/dist/modern/components/tsortable-head-cell/sort-icon-unset.js +6 -0
- package/dist/modern/index.d.ts +1 -0
- package/dist/modern/index.js +22 -0
- package/dist/modern/typings.d.ts +2 -0
- package/dist/modern/typings.js +1 -0
- package/dist/modern/utils.d.ts +4 -0
- package/dist/modern/utils.js +8 -0
- package/dist/send-stats.js +82 -0
- package/dist/tslib.es6-2f687e1c.d.ts +32 -0
- package/dist/tslib.es6-2f687e1c.js +42 -0
- package/dist/typings.d.ts +2 -0
- package/dist/typings.js +2 -0
- package/dist/utils.d.ts +4 -0
- package/dist/utils.js +16 -0
- package/package.json +26 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React, { forwardRef, useRef, useMemo } from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import '../thead/Component.js';
|
|
4
|
+
import '../../utils.js';
|
|
5
|
+
import { findAllHeadCellsProps } from './utils.js';
|
|
6
|
+
import { TableContext } from '../table-context/index.js';
|
|
7
|
+
|
|
8
|
+
var styles = {"component":"table__component_1h56f","wrapper":"table__wrapper_1h56f","hasPagination":"table__hasPagination_1h56f","table":"table__table_1h56f"};
|
|
9
|
+
require('./index.css')
|
|
10
|
+
|
|
11
|
+
const Table = forwardRef(({ className, children, compactView = false, wrapper = true, pagination, dataTestId, ...restProps }, ref) => {
|
|
12
|
+
const wrapperRef = useRef(null);
|
|
13
|
+
const columnsConfiguration = useMemo(() => findAllHeadCellsProps(children).map((columnProps, index) => ({
|
|
14
|
+
width: columnProps.width,
|
|
15
|
+
textAlign: columnProps.textAlign,
|
|
16
|
+
hidden: columnProps.hidden,
|
|
17
|
+
index,
|
|
18
|
+
})), [children]);
|
|
19
|
+
return (React.createElement(TableContext.Provider, { value: { columnsConfiguration, compactView, wrapperRef } },
|
|
20
|
+
React.createElement("div", { ref: wrapperRef, className: cn(styles.component, className, {
|
|
21
|
+
[styles.wrapper]: wrapper,
|
|
22
|
+
[styles.hasPagination]: !!pagination,
|
|
23
|
+
}), "data-test-id": dataTestId },
|
|
24
|
+
React.createElement("table", Object.assign({ ref: ref, className: styles.table }, restProps), children),
|
|
25
|
+
pagination)));
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export { Table };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* hash: oj997 */
|
|
2
|
+
:root {
|
|
3
|
+
--color-light-bg-primary: #fff;
|
|
4
|
+
}
|
|
5
|
+
:root {
|
|
6
|
+
|
|
7
|
+
/* Hard */
|
|
8
|
+
--shadow-xs-hard: 0 0 4px rgba(11, 31, 53, 0.02), 0 2px 4px rgba(11, 31, 53, 0.04),
|
|
9
|
+
0 2px 4px rgba(11, 31, 53, 0.16);
|
|
10
|
+
|
|
11
|
+
/* Up */
|
|
12
|
+
|
|
13
|
+
/* Hard up */
|
|
14
|
+
}
|
|
15
|
+
:root {
|
|
16
|
+
--gap-m: 16px;
|
|
17
|
+
}
|
|
18
|
+
:root {
|
|
19
|
+
--border-radius-m: 8px;
|
|
20
|
+
}
|
|
21
|
+
.table__component_1h56f {
|
|
22
|
+
box-sizing: border-box;
|
|
23
|
+
}
|
|
24
|
+
.table__wrapper_1h56f {
|
|
25
|
+
padding: 0 var(--gap-m) var(--gap-m);
|
|
26
|
+
background: var(--color-light-bg-primary);
|
|
27
|
+
box-shadow: var(--shadow-xs-hard);
|
|
28
|
+
border-radius: var(--border-radius-m);
|
|
29
|
+
}
|
|
30
|
+
.table__hasPagination_1h56f {
|
|
31
|
+
padding-bottom: 0;
|
|
32
|
+
}
|
|
33
|
+
.table__table_1h56f {
|
|
34
|
+
width: 100%;
|
|
35
|
+
border-collapse: collapse;
|
|
36
|
+
box-sizing: border-box
|
|
37
|
+
|
|
38
|
+
/* TODO: Хак для выравнивания чекбокса */
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Component";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import 'classnames';
|
|
3
|
+
import { THead } from '../thead/Component.js';
|
|
4
|
+
import { isChildInstanceOf } from '../../utils.js';
|
|
5
|
+
|
|
6
|
+
function findAllHeadCellsProps(children) {
|
|
7
|
+
const result = [];
|
|
8
|
+
React.Children.forEach(children, child => {
|
|
9
|
+
if (isChildInstanceOf(child, THead)) {
|
|
10
|
+
React.Children.forEach(child.props.children, headChild => {
|
|
11
|
+
result.push(headChild.props);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
return result;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { findAllHeadCellsProps };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { RefObject } from "react";
|
|
4
|
+
import { TextAlignProperty } from "../../typings";
|
|
5
|
+
type ColumnConfiguration = {
|
|
6
|
+
width?: string | number;
|
|
7
|
+
textAlign?: TextAlignProperty;
|
|
8
|
+
hidden?: boolean;
|
|
9
|
+
index: number;
|
|
10
|
+
};
|
|
11
|
+
type TableContextType = {
|
|
12
|
+
columnsConfiguration: ColumnConfiguration[];
|
|
13
|
+
compactView: boolean;
|
|
14
|
+
wrapperRef: RefObject<HTMLDivElement>;
|
|
15
|
+
};
|
|
16
|
+
declare const DEFAULT_TABLE_CONTEXT: TableContextType;
|
|
17
|
+
declare const TableContext: React.Context<TableContextType>;
|
|
18
|
+
export { ColumnConfiguration, TableContextType, DEFAULT_TABLE_CONTEXT, TableContext };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
const DEFAULT_TABLE_CONTEXT = {
|
|
4
|
+
columnsConfiguration: [],
|
|
5
|
+
compactView: false,
|
|
6
|
+
wrapperRef: { current: null },
|
|
7
|
+
};
|
|
8
|
+
const TableContext = React.createContext(DEFAULT_TABLE_CONTEXT);
|
|
9
|
+
|
|
10
|
+
export { DEFAULT_TABLE_CONTEXT, TableContext };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { HTMLAttributes } from "react";
|
|
4
|
+
type TBodyProps = HTMLAttributes<HTMLTableSectionElement> & {
|
|
5
|
+
/**
|
|
6
|
+
* Дополнительный класс
|
|
7
|
+
*/
|
|
8
|
+
className?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Идентификатор для систем автоматизированного тестирования
|
|
11
|
+
*/
|
|
12
|
+
dataTestId?: string;
|
|
13
|
+
};
|
|
14
|
+
declare const TBody: React.FC<TBodyProps>;
|
|
15
|
+
export { TBodyProps, TBody };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
|
|
4
|
+
var styles = {"component":"table__component_13syc"};
|
|
5
|
+
require('./index.css')
|
|
6
|
+
|
|
7
|
+
const TBody = ({ className, children, dataTestId, ...restProps }) => {
|
|
8
|
+
return (React.createElement("tbody", Object.assign({ className: cn(styles.component, className), "data-test-id": dataTestId }, restProps), children));
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export { TBody };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Component";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TdHTMLAttributes } from 'react';
|
|
3
|
+
type TCellProps = TdHTMLAttributes<HTMLTableCellElement> & {
|
|
4
|
+
/**
|
|
5
|
+
* Дополнительный класс
|
|
6
|
+
*/
|
|
7
|
+
className?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Идентификатор для систем автоматизированного тестирования
|
|
10
|
+
*/
|
|
11
|
+
dataTestId?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Устанавливается автоматически и позволяет использовать конфиг для соответствующего индекса
|
|
14
|
+
*/
|
|
15
|
+
index?: number;
|
|
16
|
+
};
|
|
17
|
+
declare const TCell: ({ className, style, dataTestId, children, index, ...restProps }: TCellProps) => JSX.Element;
|
|
18
|
+
export { TCellProps, TCell };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import { TableContext } from '../table-context/index.js';
|
|
4
|
+
|
|
5
|
+
var styles = {"component":"table__component_1vxc4","hidden":"table__hidden_1vxc4","compact":"table__compact_1vxc4"};
|
|
6
|
+
require('./index.css')
|
|
7
|
+
|
|
8
|
+
const TCell = ({ className, style, dataTestId, children, index, ...restProps }) => {
|
|
9
|
+
const { columnsConfiguration, compactView } = useContext(TableContext);
|
|
10
|
+
const column = index === undefined ? null : columnsConfiguration[index];
|
|
11
|
+
const width = column?.width;
|
|
12
|
+
const textAlign = column?.textAlign;
|
|
13
|
+
const hidden = column?.hidden || false;
|
|
14
|
+
return (React.createElement("td", Object.assign({ className: cn(styles.component, className, hidden && styles.hidden, compactView && styles.compact), style: { ...style, width, textAlign }, "data-test-id": dataTestId }, restProps), children));
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { TCell };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/* hash: lk1eo */
|
|
2
|
+
:root {
|
|
3
|
+
--color-light-border-primary: #dbdee1;
|
|
4
|
+
--color-light-text-primary: #0b1f35;
|
|
5
|
+
}
|
|
6
|
+
:root {
|
|
7
|
+
|
|
8
|
+
/* Hard */
|
|
9
|
+
|
|
10
|
+
/* Up */
|
|
11
|
+
|
|
12
|
+
/* Hard up */
|
|
13
|
+
}
|
|
14
|
+
:root {
|
|
15
|
+
--gap-xs: 8px;
|
|
16
|
+
--gap-m: 16px;
|
|
17
|
+
--gap-xl: 24px;
|
|
18
|
+
}
|
|
19
|
+
.table__component_1vxc4 {
|
|
20
|
+
font-size: 14px;
|
|
21
|
+
line-height: 20px;
|
|
22
|
+
font-weight: 400;
|
|
23
|
+
|
|
24
|
+
color: var(--color-light-text-primary);
|
|
25
|
+
padding: var(--gap-xl) var(--gap-m);
|
|
26
|
+
height: 72px;
|
|
27
|
+
border-top: 1px solid var(--color-light-border-primary);
|
|
28
|
+
vertical-align: top;
|
|
29
|
+
box-sizing: border-box;
|
|
30
|
+
}
|
|
31
|
+
.table__hidden_1vxc4 {
|
|
32
|
+
display: none;
|
|
33
|
+
}
|
|
34
|
+
.table__compact_1vxc4 {
|
|
35
|
+
padding-top: var(--gap-xs);
|
|
36
|
+
padding-bottom: var(--gap-xs);
|
|
37
|
+
|
|
38
|
+
max-width: 0;
|
|
39
|
+
overflow: hidden;
|
|
40
|
+
text-overflow: ellipsis;
|
|
41
|
+
white-space: nowrap;
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Component";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { TRowProps } from "../trow/index";
|
|
4
|
+
type TExpandableRowProps = TRowProps & {
|
|
5
|
+
defaultExpanded?: boolean;
|
|
6
|
+
expanded?: boolean;
|
|
7
|
+
onToggle?: (expanded: boolean) => void;
|
|
8
|
+
renderContent: (expanded: boolean) => ReactNode;
|
|
9
|
+
};
|
|
10
|
+
declare const TExpandableRow: ({ className, selected, expanded, defaultExpanded, onToggle, renderContent, ...restProps }: TExpandableRowProps) => JSX.Element;
|
|
11
|
+
export { TExpandableRowProps, TExpandableRow };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import { TRow } from '../trow/Component.js';
|
|
4
|
+
|
|
5
|
+
var styles = {"row":"table__row_1ftvx","selected":"table__selected_1ftvx","expanded":"table__expanded_1ftvx","expandable":"table__expandable_1ftvx"};
|
|
6
|
+
require('./index.css')
|
|
7
|
+
|
|
8
|
+
const TExpandableRow = ({ className, selected, expanded, defaultExpanded = false, onToggle = () => null, renderContent = () => null, ...restProps }) => {
|
|
9
|
+
const [expandedState, setExpandedState] = useState(defaultExpanded);
|
|
10
|
+
const uncontrolled = expanded === undefined;
|
|
11
|
+
const isExpanded = (uncontrolled ? expandedState : expanded);
|
|
12
|
+
const handleToggle = () => {
|
|
13
|
+
if (uncontrolled) {
|
|
14
|
+
setExpandedState(!isExpanded);
|
|
15
|
+
}
|
|
16
|
+
onToggle(isExpanded);
|
|
17
|
+
};
|
|
18
|
+
return (React.createElement(React.Fragment, null,
|
|
19
|
+
React.createElement(TRow, Object.assign({ className: cn(styles.row, className, {
|
|
20
|
+
[styles.selected]: selected,
|
|
21
|
+
[styles.expanded]: isExpanded,
|
|
22
|
+
}), selected: selected, onClick: handleToggle }, restProps)),
|
|
23
|
+
React.createElement("tr", { className: cn(styles.expandable, { [styles.expanded]: isExpanded }) }, renderContent(isExpanded))));
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export { TExpandableRow };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/* hash: 1bs8a */
|
|
2
|
+
:root {
|
|
3
|
+
|
|
4
|
+
/* Hard */
|
|
5
|
+
|
|
6
|
+
/* Up */
|
|
7
|
+
|
|
8
|
+
/* Hard up */
|
|
9
|
+
}
|
|
10
|
+
.table__row_1ftvx {
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
}
|
|
13
|
+
.table__selected_1ftvx.table__expanded_1ftvx {
|
|
14
|
+
background-color: inherit;
|
|
15
|
+
}
|
|
16
|
+
.table__expanded_1ftvx:hover {
|
|
17
|
+
background-color: inherit;
|
|
18
|
+
}
|
|
19
|
+
.table__expandable_1ftvx td {
|
|
20
|
+
margin: 0;
|
|
21
|
+
padding-top: 0;
|
|
22
|
+
padding-bottom: 0;
|
|
23
|
+
border: none;
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Component";
|
|
@@ -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,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
|
|
4
|
+
var styles = {"component":"table__component_rup1j","row":"table__row_rup1j"};
|
|
5
|
+
require('./index.css')
|
|
6
|
+
|
|
7
|
+
const THead = ({ className, rowClassName, children, dataTestId, ...restProps }) => {
|
|
8
|
+
return (React.createElement("thead", Object.assign({ className: cn(styles.component, className), "data-test-id": dataTestId }, restProps),
|
|
9
|
+
React.createElement("tr", { className: cn(styles.row, rowClassName) }, children)));
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { THead };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/* hash: 1nqvt */
|
|
2
|
+
:root {
|
|
3
|
+
--color-light-graphic-neutral: #dbdee1;
|
|
4
|
+
}
|
|
5
|
+
:root {
|
|
6
|
+
|
|
7
|
+
/* Hard */
|
|
8
|
+
|
|
9
|
+
/* Up */
|
|
10
|
+
|
|
11
|
+
/* Hard up */
|
|
12
|
+
}
|
|
13
|
+
.table__component_rup1j {
|
|
14
|
+
position: relative;
|
|
15
|
+
width: 100%;
|
|
16
|
+
box-sizing: border-box
|
|
17
|
+
}
|
|
18
|
+
.table__component_rup1j th:not(:last-child):not(:empty):after {
|
|
19
|
+
transition: opacity 0.2s;
|
|
20
|
+
position: absolute;
|
|
21
|
+
content: '';
|
|
22
|
+
display: block;
|
|
23
|
+
|
|
24
|
+
width: 1px;
|
|
25
|
+
right: 0;
|
|
26
|
+
top: 12px;
|
|
27
|
+
bottom: 8px;
|
|
28
|
+
background-color: var(--color-light-graphic-neutral);
|
|
29
|
+
}
|
|
30
|
+
.table__component_rup1j th:after {
|
|
31
|
+
opacity: 0;
|
|
32
|
+
}
|
|
33
|
+
.table__component_rup1j:hover th:after {
|
|
34
|
+
opacity: 1;
|
|
35
|
+
}
|
|
36
|
+
.table__row_rup1j {
|
|
37
|
+
height: 72px;
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Component";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ThHTMLAttributes } from 'react';
|
|
3
|
+
import { TextAlignProperty } from "../../typings";
|
|
4
|
+
type THeadCellProps = ThHTMLAttributes<HTMLHeadingElement> & {
|
|
5
|
+
/**
|
|
6
|
+
* Дополнительный класс
|
|
7
|
+
*/
|
|
8
|
+
className?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Ширина колонки
|
|
11
|
+
*/
|
|
12
|
+
width?: string | number;
|
|
13
|
+
/**
|
|
14
|
+
* Скрытие колонки
|
|
15
|
+
*/
|
|
16
|
+
hidden?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Выравнивание текста в колонке
|
|
19
|
+
*/
|
|
20
|
+
textAlign?: TextAlignProperty;
|
|
21
|
+
/**
|
|
22
|
+
* Идентификатор для систем автоматизированного тестирования
|
|
23
|
+
*/
|
|
24
|
+
dataTestId?: string;
|
|
25
|
+
};
|
|
26
|
+
declare const THeadCell: ({ children, className, dataTestId, style, width, textAlign, hidden, ...restProps }: THeadCellProps) => JSX.Element;
|
|
27
|
+
export { THeadCellProps, THeadCell };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
|
|
4
|
+
var styles = {"component":"table__component_1m0ff","sortable":"table__sortable_1m0ff","sorted":"table__sorted_1m0ff","hidden":"table__hidden_1m0ff"};
|
|
5
|
+
require('./index.css')
|
|
6
|
+
|
|
7
|
+
const THeadCell = ({ children, className, dataTestId, style, width, textAlign, hidden, ...restProps }) => (React.createElement("th", Object.assign({ className: cn(styles.component, className, hidden && styles.hidden), style: { ...style, width, textAlign }, "data-test-id": dataTestId }, restProps), children));
|
|
8
|
+
|
|
9
|
+
export { THeadCell };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/* hash: b8dhi */
|
|
2
|
+
:root {
|
|
3
|
+
--color-light-bg-primary: #fff;
|
|
4
|
+
--color-light-border-primary: #dbdee1;
|
|
5
|
+
--color-light-text-primary: #0b1f35;
|
|
6
|
+
}
|
|
7
|
+
:root {
|
|
8
|
+
|
|
9
|
+
/* Hard */
|
|
10
|
+
|
|
11
|
+
/* Up */
|
|
12
|
+
|
|
13
|
+
/* Hard up */
|
|
14
|
+
}
|
|
15
|
+
:root {
|
|
16
|
+
--gap-s: 12px;
|
|
17
|
+
--gap-2xl: 32px;
|
|
18
|
+
}
|
|
19
|
+
.table__component_1m0ff {
|
|
20
|
+
font-size: 12px;
|
|
21
|
+
line-height: 16px;
|
|
22
|
+
font-weight: 500;
|
|
23
|
+
letter-spacing: 1.25px;
|
|
24
|
+
text-transform: uppercase;
|
|
25
|
+
|
|
26
|
+
line-height: 20px;
|
|
27
|
+
position: relative;
|
|
28
|
+
text-align: left;
|
|
29
|
+
color: var(--color-light-text-primary);
|
|
30
|
+
padding: var(--gap-2xl) var(--gap-s) 0;
|
|
31
|
+
border-bottom: 1px solid var(--color-light-border-primary);
|
|
32
|
+
background: var(--color-light-bg-primary);
|
|
33
|
+
vertical-align: top;
|
|
34
|
+
box-sizing: border-box;
|
|
35
|
+
}
|
|
36
|
+
.table__sortable_1m0ff {
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
}
|
|
39
|
+
.table__sorted_1m0ff {
|
|
40
|
+
color: var(--color-light-text-primary);
|
|
41
|
+
}
|
|
42
|
+
.table__hidden_1m0ff {
|
|
43
|
+
display: none;
|
|
44
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Component";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { HTMLAttributes } from "react";
|
|
4
|
+
import { TCell, TCellProps } from "../tcell/index";
|
|
5
|
+
type TRowProps = HTMLAttributes<HTMLTableRowElement> & {
|
|
6
|
+
/**
|
|
7
|
+
* Компоненты ячеек
|
|
8
|
+
*/
|
|
9
|
+
children: Array<React.ReactElement<TCellProps, typeof TCell>>;
|
|
10
|
+
/**
|
|
11
|
+
* Дополнительный класс
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Стиль выбранной строки
|
|
16
|
+
*/
|
|
17
|
+
selected?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Убирает нижнюю границу
|
|
20
|
+
*/
|
|
21
|
+
withoutBorder?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Идентификатор для систем автоматизированного тестирования
|
|
24
|
+
*/
|
|
25
|
+
dataTestId?: string;
|
|
26
|
+
};
|
|
27
|
+
declare const TRow: ({ children, className, selected, withoutBorder, dataTestId, ...restProps }: TRowProps) => JSX.Element;
|
|
28
|
+
export { TRowProps, TRow };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
|
|
4
|
+
var styles = {"component":"table__component_gfjww","withoutBorder":"table__withoutBorder_gfjww","clickable":"table__clickable_gfjww","selected":"table__selected_gfjww"};
|
|
5
|
+
require('./index.css')
|
|
6
|
+
|
|
7
|
+
const TRow = ({ children, className, selected, withoutBorder, dataTestId, ...restProps }) => (React.createElement("tr", Object.assign({ className: cn(styles.component, className, {
|
|
8
|
+
[styles.clickable]: typeof restProps.onClick !== 'undefined',
|
|
9
|
+
[styles.selected]: selected,
|
|
10
|
+
[styles.withoutBorder]: withoutBorder,
|
|
11
|
+
}), "data-test-id": dataTestId }, restProps), React.Children.map(children, (child, index) => React.cloneElement(child, { index }))));
|
|
12
|
+
|
|
13
|
+
export { TRow };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/* hash: 11wnh */
|
|
2
|
+
:root {
|
|
3
|
+
--color-static-graphic-solitude: #e8f2fe;
|
|
4
|
+
}
|
|
5
|
+
:root {
|
|
6
|
+
--color-light-bg-primary: #fff;
|
|
7
|
+
--color-light-bg-secondary: #f3f4f5;
|
|
8
|
+
}
|
|
9
|
+
:root {
|
|
10
|
+
|
|
11
|
+
/* Hard */
|
|
12
|
+
|
|
13
|
+
/* Up */
|
|
14
|
+
|
|
15
|
+
/* Hard up */
|
|
16
|
+
}
|
|
17
|
+
.table__component_gfjww {
|
|
18
|
+
padding-top: 1px;
|
|
19
|
+
width: 100%;
|
|
20
|
+
transition: background-color 0.2s;
|
|
21
|
+
box-sizing: border-box;
|
|
22
|
+
background: var(--color-light-bg-primary)
|
|
23
|
+
}
|
|
24
|
+
.table__component_gfjww:first-child td {
|
|
25
|
+
border-top: 0;
|
|
26
|
+
}
|
|
27
|
+
.table__withoutBorder_gfjww {
|
|
28
|
+
td {
|
|
29
|
+
border: none;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
.table__clickable_gfjww {
|
|
33
|
+
cursor: pointer
|
|
34
|
+
}
|
|
35
|
+
.table__clickable_gfjww:hover {
|
|
36
|
+
background-color: var(--color-light-bg-secondary);
|
|
37
|
+
}
|
|
38
|
+
.table__selected_gfjww {
|
|
39
|
+
background-color: #f2f8ff /* нет цвета в палитре */
|
|
40
|
+
}
|
|
41
|
+
.table__selected_gfjww:hover {
|
|
42
|
+
background-color: var(--color-static-graphic-solitude);
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Component";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { THeadCellProps } from "../thead-cell/index";
|
|
3
|
+
type TSortableHeadCellProps = THeadCellProps & {
|
|
4
|
+
isSortedDesc?: boolean;
|
|
5
|
+
defaultIsSortedDesc?: boolean;
|
|
6
|
+
onSort?: () => void;
|
|
7
|
+
};
|
|
8
|
+
declare const TSortableHeadCell: ({ children, className, defaultIsSortedDesc, isSortedDesc, textAlign, onSort, ...restProps }: TSortableHeadCellProps) => JSX.Element;
|
|
9
|
+
export { TSortableHeadCellProps, TSortableHeadCell };
|