@semcore/data-table 16.3.0-prerelease.3 → 16.3.1-prerelease.5
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 +7 -0
- package/lib/cjs/components/Body/Body.js +200 -363
- package/lib/cjs/components/Body/Body.js.map +1 -1
- package/lib/cjs/components/Body/Body.types.js.map +1 -1
- package/lib/cjs/components/Body/Cell.js +53 -70
- package/lib/cjs/components/Body/Cell.js.map +1 -1
- package/lib/cjs/components/Body/Row.js +367 -114
- package/lib/cjs/components/Body/Row.js.map +1 -1
- package/lib/cjs/components/Body/Row.types.js.map +1 -1
- package/lib/cjs/components/Body/style.shadow.css +2 -7
- package/lib/cjs/components/DataTable/DataTable.js +99 -174
- package/lib/cjs/components/DataTable/DataTable.js.map +1 -1
- package/lib/cjs/components/DataTable/DataTable.types.js.map +1 -1
- package/lib/cjs/components/Head/Column.js +41 -41
- package/lib/cjs/components/Head/Column.js.map +1 -1
- package/lib/cjs/components/Head/Group.js +39 -71
- package/lib/cjs/components/Head/Group.js.map +1 -1
- package/lib/cjs/components/Head/Head.js +82 -45
- package/lib/cjs/components/Head/Head.js.map +1 -1
- package/lib/cjs/index.js +13 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/es6/components/Body/Body.js +201 -364
- package/lib/es6/components/Body/Body.js.map +1 -1
- package/lib/es6/components/Body/Body.types.js.map +1 -1
- package/lib/es6/components/Body/Cell.js +53 -70
- package/lib/es6/components/Body/Cell.js.map +1 -1
- package/lib/es6/components/Body/Row.js +367 -114
- package/lib/es6/components/Body/Row.js.map +1 -1
- package/lib/es6/components/Body/Row.types.js.map +1 -1
- package/lib/es6/components/Body/style.shadow.css +2 -7
- package/lib/es6/components/DataTable/DataTable.js +95 -170
- package/lib/es6/components/DataTable/DataTable.js.map +1 -1
- package/lib/es6/components/DataTable/DataTable.types.js.map +1 -1
- package/lib/es6/components/Head/Column.js +41 -41
- package/lib/es6/components/Head/Column.js.map +1 -1
- package/lib/es6/components/Head/Group.js +40 -72
- package/lib/es6/components/Head/Group.js.map +1 -1
- package/lib/es6/components/Head/Head.js +83 -46
- package/lib/es6/components/Head/Head.js.map +1 -1
- package/lib/es6/index.js +2 -1
- package/lib/es6/index.js.map +1 -1
- package/lib/esm/components/Body/Body.mjs +159 -312
- package/lib/esm/components/Body/Cell.mjs +54 -68
- package/lib/esm/components/Body/Row.mjs +316 -94
- package/lib/esm/components/Body/style.shadow.css +2 -7
- package/lib/esm/components/DataTable/DataTable.mjs +90 -163
- package/lib/esm/components/Head/Column.mjs +42 -42
- package/lib/esm/components/Head/Group.mjs +42 -65
- package/lib/esm/components/Head/Head.mjs +72 -44
- package/lib/esm/index.mjs +3 -0
- package/lib/types/components/Body/Body.d.ts +1 -2
- package/lib/types/components/Body/Body.types.d.ts +2 -1
- package/lib/types/components/Body/Row.d.ts +43 -3
- package/lib/types/components/Body/Row.types.d.ts +27 -15
- package/lib/types/components/DataTable/DataTable.d.ts +2 -2
- package/lib/types/index.d.ts +2 -1
- package/package.json +22 -22
|
@@ -61,7 +61,7 @@ export type BodyPropsInner<Data extends DataTableData, UniqKeyType> = DataTableB
|
|
|
61
61
|
uid: string;
|
|
62
62
|
rowProps?: (row: DTRow<UniqKeyType>, rowIndex: number) => Record<string, any> | undefined;
|
|
63
63
|
renderCell?: (props: CellRenderProps<Data[number], UniqKeyType>) => React.ReactNode | Record<string, any>;
|
|
64
|
-
onBackFromAccordion: (
|
|
64
|
+
onBackFromAccordion: (colName: string) => void;
|
|
65
65
|
stickyHeader?: boolean;
|
|
66
66
|
selectedRows?: UniqKeyType[];
|
|
67
67
|
onSelectRow?: (isSelect: boolean, selectedRowIndex: number, row: DTRow<UniqKeyType>, event?: React.SyntheticEvent<HTMLElement>) => void;
|
|
@@ -74,6 +74,7 @@ export type BodyPropsInner<Data extends DataTableData, UniqKeyType> = DataTableB
|
|
|
74
74
|
accordionMode?: DataTableProps<any, any, any>['accordionMode'];
|
|
75
75
|
shadowVertical?: '' | 'end' | 'start' | 'median';
|
|
76
76
|
renderCellOverlay?: () => React.ReactNode;
|
|
77
|
+
totalRows?: number;
|
|
77
78
|
variant?: DataTableProps<any, any, any>['variant'];
|
|
78
79
|
};
|
|
79
80
|
export type DataTableBodyType = (<Data extends DataTableData, UniqKeyType, Tag extends Intergalactic.Tag = 'div'>(props: Intergalactic.InternalTypings.ComponentProps<Tag, 'div', DataTableBodyProps<Data, UniqKeyType>>) => Intergalactic.InternalTypings.ComponentRenderingResults) & Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', DataTableBodyProps<any, any>>;
|
|
@@ -1,3 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { Component } from '@semcore/core';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import type { DataTableCellProps, DataTableCellType } from './Cell.types';
|
|
4
|
+
import { MergedColumnsCell, MergedRowsCell } from './MergedCells';
|
|
5
|
+
import type { DataTableRowProps, DataTableRowType, DTRow, RowPropsInner } from './Row.types';
|
|
6
|
+
import type { DataTableData, DTValue } from '../DataTable/DataTable.types';
|
|
7
|
+
type State = {
|
|
8
|
+
expandedForAnimation: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare class RowRoot<Data extends DataTableData, UniqKeyType> extends Component<DataTableRowProps<Data, UniqKeyType>, {}, State, [], RowPropsInner<Data, UniqKeyType>> {
|
|
11
|
+
static displayName: string;
|
|
12
|
+
static style: {
|
|
13
|
+
[key: string]: string;
|
|
14
|
+
};
|
|
15
|
+
static defaultProps: {
|
|
16
|
+
'aria-level': undefined;
|
|
17
|
+
};
|
|
18
|
+
private cellName;
|
|
19
|
+
private closeAccordionTimeout;
|
|
20
|
+
rowElementRef: React.RefObject<HTMLDivElement>;
|
|
21
|
+
state: State;
|
|
22
|
+
constructor(props: DataTableRowProps<Data, UniqKeyType>);
|
|
23
|
+
componentDidMount(): void;
|
|
24
|
+
componentWillUnmount(): void;
|
|
25
|
+
cellHasAccordion(cellValue?: DTValue | MergedColumnsCell | MergedRowsCell): cellValue is DTValue;
|
|
26
|
+
handleSelectRow: (value: boolean, event?: React.SyntheticEvent<HTMLElement>) => void;
|
|
27
|
+
handleClickCheckbox: (value: boolean) => (event?: React.SyntheticEvent<HTMLElement>) => void;
|
|
28
|
+
handleBackFromAccordion: (e: React.KeyboardEvent) => void;
|
|
29
|
+
handleExpandRow: (row: DTRow<UniqKeyType>, index: number) => void;
|
|
30
|
+
closeAccordion: (row: DTRow<UniqKeyType>, closeDuration: number) => void;
|
|
31
|
+
handleClickRow(row: DTRow<UniqKeyType>): (e: React.SyntheticEvent) => void;
|
|
32
|
+
handleClickCell: (e: React.SyntheticEvent<HTMLElement>, opt: {
|
|
33
|
+
row: DTRow<UniqKeyType>;
|
|
34
|
+
rowIndex: number;
|
|
35
|
+
}) => void;
|
|
36
|
+
getCellProps(props: DataTableCellProps<UniqKeyType>): Record<string, any>;
|
|
37
|
+
render(): React.ReactNode;
|
|
38
|
+
private isReactNode;
|
|
39
|
+
}
|
|
40
|
+
export declare const Row: DataTableRowType & {
|
|
41
|
+
Cell: DataTableCellType;
|
|
42
|
+
};
|
|
43
|
+
export {};
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import type { Intergalactic } from '@semcore/core';
|
|
2
|
-
import type
|
|
2
|
+
import type * as React from 'react';
|
|
3
|
+
import type { CellRenderProps } from './Body.types';
|
|
4
|
+
import type { CellPropsInner, DataTableCellProps } from './Cell.types';
|
|
3
5
|
import type { MergedColumnsCell, MergedRowsCell } from './MergedCells';
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
+
import type { RowRoot } from './Row';
|
|
7
|
+
import type { ACCORDION, GRID_ROW_INDEX, IS_EMPTY_DATA_ROW, ROW_GROUP, ROW_INDEX, UNIQ_ROW_KEY } from '../DataTable/DataTable';
|
|
8
|
+
import type { DTValue, DTUse, DataTableData, VirtualScroll, DataRowItem, DataTableProps } from '../DataTable/DataTable.types';
|
|
6
9
|
import type { DTColumn } from '../Head/Column.types';
|
|
7
10
|
export type DTRow<UniqKeyType> = {
|
|
8
11
|
[UNIQ_ROW_KEY]: UniqKeyType;
|
|
9
12
|
[IS_EMPTY_DATA_ROW]?: boolean;
|
|
13
|
+
[GRID_ROW_INDEX]: number;
|
|
10
14
|
[ROW_INDEX]: number;
|
|
11
15
|
[key: string]: DTValue | MergedRowsCell | MergedColumnsCell;
|
|
12
16
|
[ACCORDION]?: React.ReactNode | DataTableData | undefined;
|
|
13
17
|
[ROW_GROUP]?: Set<UniqKeyType>;
|
|
14
18
|
};
|
|
15
19
|
export type DTRows<UniqKeyType> = Array<DTRow<UniqKeyType> | DTRow<UniqKeyType>[]>;
|
|
16
|
-
export type DataTableRowProps<UniqKeyType> = {
|
|
20
|
+
export type DataTableRowProps<Data extends DataTableData, UniqKeyType> = {
|
|
17
21
|
row: DTRow<UniqKeyType>;
|
|
18
22
|
mergedRow?: boolean;
|
|
19
23
|
isAccordionRow?: DataTableCellProps<UniqKeyType>['isAccordionRow'];
|
|
20
24
|
animationExpand?: DataTableCellProps<UniqKeyType>['animationExpand'];
|
|
21
25
|
accordionRowIndex?: DataTableCellProps<UniqKeyType>['accordionRowIndex'];
|
|
22
26
|
isNonInteractive?: boolean;
|
|
27
|
+
componentRef?: (component: RowRoot<Data, UniqKeyType> | null) => void;
|
|
23
28
|
};
|
|
24
|
-
export type RowPropsInner<UniqKeyType> = JSX.IntrinsicElements['div'] & {
|
|
29
|
+
export type RowPropsInner<Data extends DataTableData, UniqKeyType> = JSX.IntrinsicElements['div'] & {
|
|
25
30
|
use: DTUse;
|
|
26
|
-
/**
|
|
27
|
-
* Expanded flag for rows with accordion
|
|
28
|
-
* @default false
|
|
29
|
-
*/
|
|
30
|
-
expanded?: boolean;
|
|
31
31
|
/**
|
|
32
32
|
* Flag to show is row in a merged list or not.
|
|
33
33
|
*/
|
|
@@ -35,22 +35,34 @@ export type RowPropsInner<UniqKeyType> = JSX.IntrinsicElements['div'] & {
|
|
|
35
35
|
columns: DTColumn[];
|
|
36
36
|
row: DTRow<UniqKeyType> | DTRow<UniqKeyType>[];
|
|
37
37
|
rows: DTRows<UniqKeyType>;
|
|
38
|
+
flatRows: DTRow<UniqKeyType>[];
|
|
38
39
|
rowIndex: number;
|
|
39
|
-
ariaRowIndex: number;
|
|
40
40
|
gridRowIndex: number;
|
|
41
|
-
expandedRows: Set<UniqKeyType>;
|
|
42
41
|
onExpandRow: (expandedRow: DTRow<UniqKeyType>) => void;
|
|
43
42
|
gridTemplateAreas: string[];
|
|
44
43
|
gridTemplateColumns: string[];
|
|
45
|
-
accordionDataGridArea: string;
|
|
46
44
|
selectedRows?: UniqKeyType[];
|
|
47
45
|
onSelectRow?: (isSelect: boolean, selectedRowIndex: number, row: DTRow<UniqKeyType>, event?: React.SyntheticEvent<HTMLElement>) => void;
|
|
48
46
|
inert?: '';
|
|
49
47
|
accordionDuration?: number | [number, number];
|
|
50
|
-
onBackFromAccordion: (
|
|
48
|
+
onBackFromAccordion: (colName: string) => void;
|
|
51
49
|
scrollAreaRef: React.RefObject<HTMLDivElement>;
|
|
52
50
|
uid: string;
|
|
53
51
|
sideIndents?: 'wide';
|
|
54
52
|
getFixedStyle: (cell: Pick<DTColumn, 'name' | 'fixed'>) => [side: 'left' | 'right', style: string | number] | [side: undefined, style: undefined];
|
|
53
|
+
renderCell?: (props: CellRenderProps<Data[number], UniqKeyType>) => React.ReactNode | Record<string, any>;
|
|
54
|
+
getI18nText: (key: string) => string;
|
|
55
|
+
virtualScroll?: VirtualScroll;
|
|
56
|
+
tableRef: React.RefObject<HTMLDivElement>;
|
|
57
|
+
onCellClick: CellPropsInner<Data, UniqKeyType>['onClick'];
|
|
58
|
+
rawData: DataRowItem[];
|
|
59
|
+
shadowVertical?: '' | 'end' | 'start' | 'median';
|
|
60
|
+
expandedRows: Set<UniqKeyType>;
|
|
61
|
+
accordionMode?: DataTableProps<any, any, any>['accordionMode'];
|
|
62
|
+
rowsHeightMap: Map<number, [number, number, HTMLElement]>;
|
|
63
|
+
setRowHeight: (index: number, row: DTRow<UniqKeyType>) => void;
|
|
64
|
+
componentsMap: Map<UniqKeyType, RowRoot<Data, UniqKeyType>>;
|
|
65
|
+
calculateAriaRowIndex: () => void;
|
|
66
|
+
variant?: DataTableProps<any, any, any>['variant'];
|
|
55
67
|
};
|
|
56
|
-
export type DataTableRowType = (<UniqKeyType, Tag extends Intergalactic.Tag = 'div'>(props: Intergalactic.InternalTypings.ComponentProps<Tag, 'div', DataTableRowProps<UniqKeyType>>) => Intergalactic.InternalTypings.ComponentRenderingResults) & Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', DataTableRowProps<any>>;
|
|
68
|
+
export type DataTableRowType = (<Data extends DataTableData, UniqKeyType, Tag extends Intergalactic.Tag = 'div'>(props: Intergalactic.InternalTypings.ComponentProps<Tag, 'div', DataTableRowProps<Data, UniqKeyType>>) => Intergalactic.InternalTypings.ComponentRenderingResults) & Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', DataTableRowProps<any, any>>;
|
|
@@ -7,8 +7,8 @@ export declare const UNIQ_ROW_KEY: unique symbol;
|
|
|
7
7
|
export declare const IS_EMPTY_DATA_ROW: unique symbol;
|
|
8
8
|
export declare const SELECT_ALL: unique symbol;
|
|
9
9
|
export declare const ROW_INDEX: unique symbol;
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
10
|
+
export declare const GRID_ROW_INDEX: unique symbol;
|
|
11
|
+
export declare const DataTable: DataTableType & {
|
|
12
12
|
Head: typeof Head;
|
|
13
13
|
Body: typeof Body;
|
|
14
14
|
};
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { Intergalactic } from '@semcore/core';
|
|
2
2
|
import type React from 'react';
|
|
3
|
+
import { MergedRowsCell, MergedColumnsCell } from './components/Body/MergedCells';
|
|
3
4
|
import { DataTable, ACCORDION, ROW_GROUP, UNIQ_ROW_KEY } from './components/DataTable/DataTable';
|
|
4
5
|
import type { DataTableSort, DataTableType, DataTableData, DataTableProps, DataTableChangeSort, ColumnGroupConfig, ColumnItemConfig } from './components/DataTable/DataTable.types';
|
|
5
6
|
declare const wrapDataTable: <PropsExtending extends {}>(wrapper: (props: Intergalactic.InternalTypings.UntypeRefAndTag<Intergalactic.InternalTypings.ComponentPropsNesting<DataTableType>> & PropsExtending) => React.ReactNode) => DataTableType;
|
|
6
|
-
export { DataTable, ACCORDION, ROW_GROUP,
|
|
7
|
+
export { MergedRowsCell, MergedColumnsCell, DataTable, ACCORDION, ROW_GROUP,
|
|
7
8
|
/**
|
|
8
9
|
* @deprecated use property `uniqueRowKey` in DataTableProps to set key of unique value in your data.
|
|
9
10
|
*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/data-table",
|
|
3
3
|
"description": "Semrush DataTable Component",
|
|
4
|
-
"version": "16.3.
|
|
4
|
+
"version": "16.3.1-prerelease.5",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -14,34 +14,34 @@
|
|
|
14
14
|
"types": "./lib/types/index.d.ts"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@semcore/icon": "16.7.1-prerelease.
|
|
18
|
-
"@semcore/button": "16.0.9-prerelease.
|
|
19
|
-
"@semcore/checkbox": "16.1.3-prerelease.
|
|
20
|
-
"@semcore/flex-box": "16.0.9-prerelease.
|
|
21
|
-
"@semcore/scroll-area": "16.0.9-prerelease.
|
|
22
|
-
"@semcore/spin": "16.0.9-prerelease.
|
|
23
|
-
"@semcore/tooltip": "16.0.9-prerelease.
|
|
24
|
-
"@semcore/widget-empty": "16.0.9-prerelease.
|
|
17
|
+
"@semcore/icon": "16.7.1-prerelease.5",
|
|
18
|
+
"@semcore/button": "16.0.9-prerelease.5",
|
|
19
|
+
"@semcore/checkbox": "16.1.3-prerelease.5",
|
|
20
|
+
"@semcore/flex-box": "16.0.9-prerelease.5",
|
|
21
|
+
"@semcore/scroll-area": "16.0.9-prerelease.5",
|
|
22
|
+
"@semcore/spin": "16.0.9-prerelease.5",
|
|
23
|
+
"@semcore/tooltip": "16.0.9-prerelease.5",
|
|
24
|
+
"@semcore/widget-empty": "16.0.9-prerelease.5"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/node": "18.16.15",
|
|
28
28
|
"csstype": "3.1.3",
|
|
29
29
|
"@semcore/testing-utils": "1.0.0",
|
|
30
|
-
"@semcore/base-trigger": "16.4.1-prerelease.
|
|
31
|
-
"@semcore/
|
|
32
|
-
"@semcore/
|
|
33
|
-
"@semcore/accordion": "16.6.1-prerelease.
|
|
34
|
-
"@semcore/
|
|
35
|
-
"@semcore/
|
|
36
|
-
"@semcore/
|
|
37
|
-
"@semcore/
|
|
38
|
-
"@semcore/
|
|
39
|
-
"@semcore/
|
|
40
|
-
"@semcore/tooltip": "16.0.9-prerelease.
|
|
41
|
-
"@semcore/base-components": "16.2.3-prerelease.
|
|
30
|
+
"@semcore/base-trigger": "16.4.1-prerelease.5",
|
|
31
|
+
"@semcore/dropdown-menu": "16.1.10-prerelease.5",
|
|
32
|
+
"@semcore/typography": "16.2.3-prerelease.5",
|
|
33
|
+
"@semcore/accordion": "16.6.1-prerelease.5",
|
|
34
|
+
"@semcore/divider": "16.0.9-prerelease.5",
|
|
35
|
+
"@semcore/portal": "16.0.9-prerelease.5",
|
|
36
|
+
"@semcore/progress-bar": "16.0.9-prerelease.5",
|
|
37
|
+
"@semcore/skeleton": "16.0.9-prerelease.5",
|
|
38
|
+
"@semcore/spin": "16.0.9-prerelease.5",
|
|
39
|
+
"@semcore/spin-container": "16.0.9-prerelease.5",
|
|
40
|
+
"@semcore/tooltip": "16.0.9-prerelease.5",
|
|
41
|
+
"@semcore/base-components": "16.2.3-prerelease.5"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@semcore/base-components": "^16.2.3-prerelease.
|
|
44
|
+
"@semcore/base-components": "^16.2.3-prerelease.5"
|
|
45
45
|
},
|
|
46
46
|
"repository": {
|
|
47
47
|
"type": "git",
|