@gravity-ui/react-data-table 1.0.3 → 1.2.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
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.2.0](https://github.com/gravity-ui/react-data-table/compare/v1.1.0...v1.2.0) (2023-09-05)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* migrate to @bem-react/classname ([#32](https://github.com/gravity-ui/react-data-table/issues/32)) ([af0987e](https://github.com/gravity-ui/react-data-table/commit/af0987e65e68766747a7956ff8521014c6037648))
|
|
9
|
+
|
|
10
|
+
## [1.1.0](https://github.com/gravity-ui/react-data-table/compare/v1.0.3...v1.1.0) (2023-05-05)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* add event in cell click handler ([#26](https://github.com/gravity-ui/react-data-table/issues/26)) ([11e7a00](https://github.com/gravity-ui/react-data-table/commit/11e7a0067d980f6e3a215468d86df9b6a691428f))
|
|
16
|
+
|
|
3
17
|
## [1.0.3](https://github.com/gravity-ui/react-data-table/compare/v1.0.2...v1.0.3) (2023-02-02)
|
|
4
18
|
|
|
5
19
|
|
|
@@ -354,7 +354,7 @@ declare class DataTableView<T> extends React.Component<DataTableProps<T>, DataTa
|
|
|
354
354
|
index: number;
|
|
355
355
|
footer?: boolean;
|
|
356
356
|
headerData?: boolean;
|
|
357
|
-
}) => () => void) | (() => undefined);
|
|
357
|
+
}) => (event: React.MouseEvent<HTMLTableCellElement>) => void) | (() => undefined);
|
|
358
358
|
customStyle: ((props: import("./types").CustomStyleParams<T>) => React.CSSProperties) | (() => undefined);
|
|
359
359
|
group: boolean | undefined;
|
|
360
360
|
autogroup: boolean;
|
|
@@ -380,7 +380,7 @@ declare class DataTableView<T> extends React.Component<DataTableProps<T>, DataTa
|
|
|
380
380
|
index: number;
|
|
381
381
|
footer?: boolean | undefined;
|
|
382
382
|
headerData?: boolean | undefined;
|
|
383
|
-
}, column: Column<T>) => void) | undefined;
|
|
383
|
+
}, column: Column<T>, event: React.MouseEvent<HTMLTableCellElement, MouseEvent>) => void) | undefined;
|
|
384
384
|
defaultOrder: OrderType;
|
|
385
385
|
sortAccessor?: string | ((row: T) => any) | undefined;
|
|
386
386
|
sortAscending?: import("./types").Comparator<T> | undefined;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
-
import cn from 'bem-cn-lite';
|
|
3
2
|
import PropTypes from 'prop-types';
|
|
4
3
|
import * as React from 'react';
|
|
5
4
|
import ReactList from 'react-list';
|
|
@@ -7,7 +6,7 @@ import './DataTable.scss';
|
|
|
7
6
|
import { ASCENDING, CENTER, DESCENDING, FIXED, INDEX_COLUMN, LEFT, MOVING, RIGHT } from './constants';
|
|
8
7
|
import { positionStickySupported } from './featureSupport';
|
|
9
8
|
import { HeightObserver } from './height-observer';
|
|
10
|
-
import { externalToInternalSortOrder, getSortOrder, getSortedData, internalToExternalSortOrder, } from './util';
|
|
9
|
+
import { cn, externalToInternalSortOrder, getSortOrder, getSortedData, internalToExternalSortOrder, } from './util';
|
|
11
10
|
const b = cn('data-table');
|
|
12
11
|
const ICON_ASC = (React.createElement("svg", { className: b('icon'), viewBox: "0 0 10 6", width: "10", height: "6" },
|
|
13
12
|
React.createElement("path", { fill: "currentColor", d: "M0 5h10l-5 -5z" })));
|
|
@@ -573,7 +572,7 @@ class DataTableView extends React.Component {
|
|
|
573
572
|
: ({ value }) => value;
|
|
574
573
|
const customStyle = typeof column.customStyle === 'function' ? column.customStyle : () => undefined;
|
|
575
574
|
const _getOnClick = typeof onClick === 'function'
|
|
576
|
-
? (data) => () => onClick(data, column)
|
|
575
|
+
? (data) => (event) => onClick(data, column, event)
|
|
577
576
|
: () => undefined;
|
|
578
577
|
return Object.assign(Object.assign({ index: columnIndex - indexAdjustment, columnIndex, dataColumn: true, defaultOrder }, column), { sortable: sortable && isSortEnabled, _className,
|
|
579
578
|
_getValue,
|
package/build/esm/lib/types.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ export interface Column<T> {
|
|
|
49
49
|
index: number;
|
|
50
50
|
footer?: boolean;
|
|
51
51
|
headerData?: boolean;
|
|
52
|
-
}, column: Column<T>) => void;
|
|
52
|
+
}, column: Column<T>, event: React.MouseEvent<HTMLTableCellElement>) => void;
|
|
53
53
|
sortable?: boolean;
|
|
54
54
|
defaultOrder?: OrderType;
|
|
55
55
|
sortAccessor?: string | ((row: T) => any);
|
package/build/esm/lib/util.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ColumnExtended, NameToOrderTypeMap, SortOrderWithSortColumns } from './DataTable';
|
|
2
2
|
import { OrderType, Settings, SortOrder, SortedDataItem } from './types';
|
|
3
|
+
export declare const cn: import("@bem-react/classname").ClassNameInitilizer;
|
|
3
4
|
export declare type SlimColumn = {
|
|
4
5
|
name: string;
|
|
5
6
|
defaultOrder?: OrderType;
|
package/build/esm/lib/util.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
+
import { withNaming } from '@bem-react/classname';
|
|
2
3
|
import { ASCENDING, DESCENDING } from './constants';
|
|
4
|
+
export const cn = withNaming({ e: '__', m: '_' });
|
|
3
5
|
export function getSortOrder({ name: columnName, defaultOrder: columnDefaultOrder }, { sortOrder = {}, sortColumns = [] }, multiColumnSort = false, { defaultOrder: settingsDefaultOrder, disableSortReset, } = {}) {
|
|
4
6
|
const defaultOrder = columnDefaultOrder || settingsDefaultOrder;
|
|
5
7
|
const emptyResult = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/react-data-table",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "DataTable component",
|
|
5
5
|
"main": "build/esm/lib/index.js",
|
|
6
6
|
"types": "build/esm/lib/index.d.ts",
|
|
@@ -37,12 +37,13 @@
|
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"react": ">=16.14.0",
|
|
39
39
|
"prop-types": ">=15.8.0",
|
|
40
|
-
"bem-
|
|
40
|
+
"@bem-react/classname": ">=1.6.0"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
+
"@bem-react/classname": "^1.6.0",
|
|
46
47
|
"@commitlint/cli": "15.0.0",
|
|
47
48
|
"@commitlint/config-conventional": "15.0.0",
|
|
48
49
|
"@gravity-ui/eslint-config": "^2.0.0",
|
|
@@ -59,7 +60,6 @@
|
|
|
59
60
|
"@types/react-dom": "16.9.14",
|
|
60
61
|
"@types/react-list": "0.8.7",
|
|
61
62
|
"@typescript-eslint/eslint-plugin": "^5.50.0",
|
|
62
|
-
"bem-cn-lite": "4.0.0",
|
|
63
63
|
"copyfiles": "2.4.1",
|
|
64
64
|
"css-loader": "5.2.7",
|
|
65
65
|
"eslint": "8.6.0",
|