@bcgov-sso/common-react-components 2.0.0 → 2.1.1

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.
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { Row, ColumnDef } from '@tanstack/react-table';
2
3
  export declare const TABLE_BACKGROUND_COLOR = "#ededed";
3
4
  export declare const TABLE_ROW_ACTIVE_COLOR = "#4950FA";
4
5
  export declare const TABLE_ROW_HOVER_COLOR = "#fdb913";
@@ -17,16 +18,32 @@ export interface TableFilter {
17
18
  onChange?: Function;
18
19
  options: Option[];
19
20
  label?: string;
21
+ defaultValue?: Option | Option[];
20
22
  }
21
23
  export interface Column {
22
24
  header: string;
23
25
  accessorKey: string;
26
+ enableSorting?: boolean;
27
+ enableFiltering?: boolean;
28
+ meta?: {
29
+ filterLabel?: string;
30
+ filterOptions?: Option[];
31
+ multiSelect?: boolean;
32
+ filterPlaceholder?: string;
33
+ defaultValue?: Option | Option[];
34
+ };
35
+ cell?: (props: {
36
+ value: any;
37
+ row: Row<unknown>;
38
+ }) => React.ReactNode;
39
+ footer?: React.ReactNode;
24
40
  }
25
- export interface TableProps {
41
+ export interface TableProps<T extends object> {
26
42
  variant?: string;
27
43
  readOnly?: boolean;
28
- columns: Column[];
29
- data: unknown[];
44
+ columns: ColumnDef<T, any>[];
45
+ hiddenColumns?: string[];
46
+ data: T[];
30
47
  onRowSelect?: Function;
31
48
  defaultPageSize?: number;
32
49
  enableGlobalSearch?: boolean;
@@ -36,5 +53,5 @@ export interface TableProps {
36
53
  pageSizeOptions?: number[];
37
54
  noDataFoundText?: string;
38
55
  }
39
- declare const Table: ({ variant, columns, data, readOnly, onRowSelect, defaultPageSize, enableGlobalSearch, globalSearchPlaceholder, globalSearchStyle, enablePagination, pageSizeOptions, noDataFoundText, }: TableProps) => React.JSX.Element;
56
+ declare const Table: <T extends object>({ variant, columns, hiddenColumns, data, readOnly, onRowSelect, defaultPageSize, enableGlobalSearch, globalSearchPlaceholder, globalSearchStyle, enablePagination, pageSizeOptions, noDataFoundText, }: TableProps<T>) => React.JSX.Element;
40
57
  export default Table;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bcgov-sso/common-react-components",
3
- "version": "2.0.0",
3
+ "version": "2.1.1",
4
4
  "description": "common react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -10,6 +10,9 @@
10
10
  "types": "dist/index.d.ts",
11
11
  "author": "SSO Team",
12
12
  "license": "Apache-2.0",
13
+ "repository": {
14
+ "url": "https://github.com/bcgov/sso-react-components"
15
+ },
13
16
  "bugs": {
14
17
  "url": "https://github.com/bcgov/sso-react-components/issues"
15
18
  },