mig-schema-table 3.0.2 → 3.0.3
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.
|
@@ -27,7 +27,6 @@ const Th = ({ columnFilters, config, isSortable, name, schema, setColumnFilters,
|
|
|
27
27
|
if (name === SELECT_ALL_COLUMN_NAME) {
|
|
28
28
|
return (_jsx("div", Object.assign({}, thDivProps, { children: _jsx("div", Object.assign({ style: {
|
|
29
29
|
width: "100%",
|
|
30
|
-
paddingTop: 12,
|
|
31
30
|
textAlign: "center",
|
|
32
31
|
}, title: `${numberOfSelectedRows || 0} selected` }, { children: _jsx("input", { type: "checkbox", checked: isAllChecked, onChange: onSelectAllIndexesHandler }) })) })));
|
|
33
32
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { oas31 } from "openapi3-ts";
|
|
3
|
-
import { IColumnConfig } from "../types";
|
|
3
|
+
import { IColumnConfig, IRenderData } from "../types";
|
|
4
4
|
export interface ISchemaTableComponentProps<T> {
|
|
5
5
|
Heading?: any;
|
|
6
6
|
checkedIndexes?: number[];
|
|
@@ -11,13 +11,13 @@ export interface ISchemaTableComponentProps<T> {
|
|
|
11
11
|
data: T[];
|
|
12
12
|
defaultSortAsc?: boolean;
|
|
13
13
|
defaultSortColumn?: keyof T;
|
|
14
|
-
getRowClassName?: (rowData: T,
|
|
14
|
+
getRowClassName?: (rowData: T, filteredSortedRows: IRenderData[]) => string;
|
|
15
15
|
getRowSelected?: (rowData: T) => boolean;
|
|
16
16
|
maxHeight?: number;
|
|
17
17
|
isSearchable?: boolean;
|
|
18
18
|
isSortable?: boolean;
|
|
19
|
-
onCheckedIndexesChange?: (
|
|
20
|
-
onRowClick?: (rowData: T,
|
|
19
|
+
onCheckedIndexesChange?: (rowIndex: number[]) => void;
|
|
20
|
+
onRowClick?: (rowData: T, rowIndex: number, event: React.MouseEvent) => void;
|
|
21
21
|
rowHeight?: number;
|
|
22
22
|
schema: oas31.SchemaObject;
|
|
23
23
|
searchPlaceholder?: string;
|
|
@@ -254,11 +254,11 @@ export default function SchemaTable({ Heading = VariableSizeList, checkedIndexes
|
|
|
254
254
|
className: `schema-table__td schema-table__td--${rowIndex % 2 ? "odd" : "even"}${row && getRowSelected && getRowSelected(data[row._index])
|
|
255
255
|
? " schema-table__td--selected"
|
|
256
256
|
: ""} ${row && getRowClassName
|
|
257
|
-
? getRowClassName(data[row._index],
|
|
257
|
+
? getRowClassName(data[row._index], sortedRenderData)
|
|
258
258
|
: ""}`,
|
|
259
259
|
};
|
|
260
260
|
if (propConfig === null || propConfig === void 0 ? void 0 : propConfig.renderCell) {
|
|
261
|
-
return (_jsx("div", Object.assign({}, tdDivProps, { children: propConfig.renderCell(data[row._index],
|
|
261
|
+
return (_jsx("div", Object.assign({}, tdDivProps, { children: propConfig.renderCell(data[row._index], rowIndex) })));
|
|
262
262
|
}
|
|
263
263
|
if (propName === SELECT_ALL_COLUMN_NAME) {
|
|
264
264
|
const onChecked = () => {
|
package/dist/inc/schema.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function getEmptyObject<T>(schema: SchemaObject): T;
|
|
1
|
+
import { oas31 } from "openapi3-ts";
|
|
2
|
+
export declare function getEmptyObject<T>(schema: oas31.SchemaObject): T;
|
package/dist/index.css
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
overflow-x: hidden !important;
|
|
6
6
|
border-collapse: collapse;
|
|
7
7
|
width: 100%;
|
|
8
|
-
cursor: pointer;
|
|
9
8
|
}
|
|
10
9
|
.schema-table__th-row {
|
|
11
10
|
overflow: hidden !important;
|
|
@@ -13,16 +12,14 @@
|
|
|
13
12
|
.schema-table__th {
|
|
14
13
|
overflow: hidden;
|
|
15
14
|
background-color: #eee;
|
|
15
|
+
padding-left: 8px;
|
|
16
|
+
align-items: center;
|
|
16
17
|
}
|
|
17
18
|
.schema-table__th,
|
|
18
19
|
.schema-table__th button {
|
|
19
20
|
font-weight: bold;
|
|
20
|
-
margin-top: 10px;
|
|
21
21
|
display: flex;
|
|
22
22
|
}
|
|
23
|
-
.schema-table__th--unsortable {
|
|
24
|
-
padding-left: 8px;
|
|
25
|
-
}
|
|
26
23
|
.schema-table__td {
|
|
27
24
|
overflow: hidden;
|
|
28
25
|
white-space: nowrap;
|
package/dist/types.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ export interface IColumnConfig<T> {
|
|
|
5
5
|
hidden?: boolean;
|
|
6
6
|
hoverTitle?: string;
|
|
7
7
|
isFilterable?: boolean;
|
|
8
|
-
renderCell?: (rowData: T,
|
|
9
|
-
renderData?: (rowData: T,
|
|
8
|
+
renderCell?: (rowData: T, index: number) => React.ReactElement | null;
|
|
9
|
+
renderData?: (rowData: T, index: number) => string;
|
|
10
10
|
sort?: (a: T, b: T, sortAsc: boolean) => number;
|
|
11
11
|
sortByValue?: boolean;
|
|
12
12
|
sortable?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mig-schema-table",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/"
|
|
@@ -8,17 +8,25 @@
|
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"private": false,
|
|
10
10
|
"dependencies": {
|
|
11
|
+
"@testing-library/jest-dom": "^5.16.5",
|
|
12
|
+
"@testing-library/react": "^13.4.0",
|
|
13
|
+
"@testing-library/user-event": "^13.5.0",
|
|
11
14
|
"@types/jest": "^27.5.2",
|
|
12
15
|
"@types/node": "^16.18.31",
|
|
13
16
|
"@types/react": "^18.2.6",
|
|
14
17
|
"@types/react-dom": "^18.2.4",
|
|
18
|
+
"copyfiles": "^2.4.1",
|
|
15
19
|
"date-fns": "^2.30.0",
|
|
16
20
|
"lodash": "^4.17.21",
|
|
21
|
+
"openapi-typescript": "^6.2.4",
|
|
17
22
|
"openapi3-ts": "^4.1.2",
|
|
23
|
+
"prettier": "^2.8.8",
|
|
18
24
|
"react": "^18.2.0",
|
|
19
25
|
"react-dom": "^18.2.0",
|
|
20
26
|
"react-scripts": "5.0.1",
|
|
21
|
-
"react-window": "^1.8.9"
|
|
27
|
+
"react-window": "^1.8.9",
|
|
28
|
+
"typescript": "^4.9.5",
|
|
29
|
+
"web-vitals": "^2.1.4"
|
|
22
30
|
},
|
|
23
31
|
"scripts": {
|
|
24
32
|
"start": "react-scripts start",
|
|
@@ -47,9 +55,8 @@
|
|
|
47
55
|
"@types/lodash": "^4.14.194",
|
|
48
56
|
"@types/react-window": "^1.8.5",
|
|
49
57
|
"axios": "^1.4.0",
|
|
50
|
-
"prettier": "^2.8.8",
|
|
51
58
|
"react-router-dom": "^6.11.2",
|
|
52
59
|
"sass": "^1.62.1",
|
|
53
|
-
"
|
|
60
|
+
"scss": "^0.2.4"
|
|
54
61
|
}
|
|
55
62
|
}
|