mig-schema-table 3.0.2 → 3.0.4

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, dataIndex: number) => string;
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?: (dataIndex: number[]) => void;
20
- onRowClick?: (rowData: T, dataIndex: number, event: React.MouseEvent) => void;
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], 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], row._index, rowIndex) })));
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 = () => {
@@ -1,2 +1,2 @@
1
- import { SchemaObject } from "openapi3-ts/oas31";
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, dataIndex: number, rowIndex: number) => React.ReactElement | null;
9
- renderData?: (rowData: T, dataIndex: number) => string;
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.2",
3
+ "version": "3.0.4",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/"