react-data-matrix 0.3.7 → 0.4.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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # React Matrix   [![npm version](https://badge.fury.io/js/react-data-matrix.svg)](https://badge.fury.io/js/react-data-matrix)
1
+ # React Matrix
2
2
 
3
- [React Matrix Demo](https://bronz3beard.github.io/react-matrix)
3
+ [React Matrix Demo](https://bronz3beard.github.io/react-matrix/)
4
4
 
5
5
  React Matrix table shows relationships between two or more variables in a data set in grid format.
6
6
 
@@ -12,8 +12,8 @@ The most common usage for a table like React Matrix, is to display the **likelih
12
12
 
13
13
  # Usage
14
14
 
15
- ```ts
16
- import { ReactMatrix } from "react-data-matrix";
15
+ ```tsx
16
+ import ReactMatrix from "react-data-matrix";
17
17
 
18
18
  const App: FC = () => {
19
19
  ...
@@ -65,60 +65,50 @@ const App: FC = () => {
65
65
  or an example of how to construct/deconstruct your data objects from your api.
66
66
 
67
67
  ```ts
68
- const data = {
69
- id: 1,
70
- matrix_size: 5,
71
- matrix_name: "React Matrix",
72
- matrix_description: "Risk Matrix Template",
73
- matrix_details: [
74
- {
75
- id: 1,
76
- likelihood: "LIKELIHOOD VALUE",
77
- consequence: CONSEQUENCE VALUE,
78
- header_title: "Title",
79
- header_sub_title: "Sub-title/description.",
80
- row_header_title: "Row Title",
81
- row_header_sub_title: "Row Sub-title/description.",
82
- }, {
83
- id: 2,
84
- ...
85
- } {
86
- id: 3,
87
- ...
88
- } {
89
- id: 4,
90
- ...
91
- } {
92
- id: 5,
93
- ...
94
- }
95
- ],
96
- matrix_values: [
97
- {
98
- id: 1,
99
- position: 1,
100
- matrix_id: 1,
101
- score_value: 1,
102
- colour: "green",
103
- description: "low",
104
- consequence_descriptor: 1,
105
- likelihood_descriptor: "E",
106
- response: "Business as usual",
107
- }, {
108
- id: 2,
109
- ...
110
- },
111
- ...,
112
- ...,
113
- , {
114
- id: 25,
115
- ...
116
- },
117
- ]
118
- }
68
+ import { MatrixData } from "../types";
69
+
70
+ export const data: MatrixData = {
71
+ id: 1,
72
+ matrix_size: 5,
73
+ matrix_name: "React Matrix",
74
+ primary_header_title: "Consequence",
75
+ primary_row_header_title: "Likelihood",
76
+ matrix_description: "Risk Matrix Template",
77
+
78
+ matrix_details: [
79
+ {
80
+ id: 1,
81
+ likelihood: "E",
82
+ consequence: 1,
83
+ position: 5,
84
+ matrix_type: "Risk",
85
+ header_title: "Minor",
86
+ header_sub_title: "Header sub-title/description.",
87
+ row_header_title: "Rare",
88
+ row_header_sub_title: "Row Header sub-title/description.",
89
+ },
90
+ ...
91
+ ],
92
+
93
+ matrix_values: [
94
+ {
95
+ id: 26,
96
+ matrix_id: 1,
97
+ description: "low",
98
+ score_value: 1,
99
+ colour: "green",
100
+ position: 1,
101
+ likelihood_descriptor: "E",
102
+ consequence_descriptor: 1,
103
+ response: "Business as usual",
104
+ },
105
+ ...
106
+ ],
107
+ };
108
+
119
109
  ```
120
110
 
121
- # Types
111
+ # PropTypes
122
112
 
123
113
  ```ts
124
114
  export interface MatrixDetail {
@@ -159,8 +149,8 @@ export interface MatrixData {
159
149
  export interface ReactMatrixProps {
160
150
  data: MatrixData;
161
151
  hasTableBorder?: boolean;
162
- hasInlineStyles?: boolean;
163
- hasContainerStyles?: boolean;
152
+ hasInlineStyles?: boolean | undefined;
153
+ hasContainerStyles?: boolean | undefined;
164
154
  reverseMatrixValues?: boolean;
165
155
  matrixSizeSelected?: number;
166
156
  rowPrimaryUpper?: boolean;
@@ -184,6 +174,34 @@ export interface ReactMatrixProps {
184
174
  customTableDataDynamicIdValue?: string;
185
175
  }
186
176
 
177
+ export interface MatrixHeaderProps {
178
+ data: MatrixData;
179
+ hasInlineStyles?: boolean | undefined;
180
+ headerPrimaryUpper?: boolean;
181
+ thRowStyles?: React.CSSProperties;
182
+ thTitleStyles?: React.CSSProperties;
183
+ thSubTitleStyles?: React.CSSProperties;
184
+ thPrimaryTitleStyles?: React.CSSProperties;
185
+ customHeaderRowIdValue?: string;
186
+ customDynamicHeaderTitleIdValue?: string;
187
+ customDynamicSubHeaderTitleIdValue?: string;
188
+ }
189
+
190
+ export interface MatrixRowsProps {
191
+ data: MatrixData;
192
+ rowPrimaryUpper?: boolean;
193
+ hasInlineStyles?: boolean | undefined;
194
+ reverseMatrixValues?: boolean;
195
+ trRowStyles?: React.CSSProperties;
196
+ trTitleStyles?: React.CSSProperties;
197
+ trSubTitleStyles?: React.CSSProperties;
198
+ trPrimaryTitleStyles?: React.CSSProperties;
199
+ tdStyles?: React.CSSProperties;
200
+ customRowDynamicIdValue?: string;
201
+ customRowHeaderDynamicIdValue?: string;
202
+ customTableDataDynamicIdValue?: string;
203
+ }
204
+
187
205
  export interface TableDataProps {
188
206
  data: {
189
207
  id: number;
@@ -204,8 +222,6 @@ export interface TableDataProps {
204
222
 
205
223
  ```ts
206
224
  defaultProps = {
207
- matrixName: "",
208
- matrixDescription: "",
209
225
  hasTableBorder: true,
210
226
  rowPrimaryUpper: true,
211
227
  hasInlineStyles: true,
@@ -345,6 +361,4 @@ if you make `hasInlineStyles = false`, then add these values with your own style
345
361
 
346
362
  ---
347
363
 
348
- # Create React App
349
-
350
- - This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
364
+ # React + TypeScript + Vite
@@ -1,4 +1,4 @@
1
- import { FC } from "react";
2
- import { MatrixHeaderProps } from "../types";
1
+ import { FC } from 'react';
2
+ import { MatrixHeaderProps } from '../types';
3
3
  declare const MatrixHeaders: FC<MatrixHeaderProps>;
4
4
  export default MatrixHeaders;
@@ -1,4 +1,4 @@
1
- import { FC } from "react";
2
- import { MatrixRowsProps } from "../types";
1
+ import { FC } from 'react';
2
+ import { MatrixRowsProps } from '../types';
3
3
  declare const MatrixRows: FC<MatrixRowsProps>;
4
4
  export default MatrixRows;
@@ -1,4 +1,4 @@
1
- import { FC } from "react";
2
- import { TableDataProps } from "../types";
1
+ import { FC } from 'react';
2
+ import { TableDataProps } from '../types';
3
3
  declare const TableData: FC<TableDataProps>;
4
4
  export default TableData;
@@ -1,4 +1,4 @@
1
- import { FC } from "react";
2
- import { ReactMatrixProps } from "../types";
1
+ import { FC } from 'react';
2
+ import { ReactMatrixProps } from './types';
3
3
  declare const ReactMatrix: FC<ReactMatrixProps>;
4
4
  export default ReactMatrix;
@@ -33,8 +33,6 @@ export interface MatrixData {
33
33
  }
34
34
  export interface ReactMatrixProps {
35
35
  data: MatrixData;
36
- matrixName: string;
37
- matrixDescription: string;
38
36
  hasTableBorder?: boolean;
39
37
  hasInlineStyles?: boolean | undefined;
40
38
  hasContainerStyles?: boolean | undefined;
@@ -1,2 +1,2 @@
1
- import { MatrixData } from "../types";
1
+ import { MatrixData } from '../types';
2
2
  export declare const data: MatrixData;
@@ -0,0 +1,4 @@
1
+ export declare const groupObjectsByProp: <T>(array: T[], prop: keyof T) => T[][];
2
+ export declare const capitaliseFirstCharacter: (stringValue: string) => string;
3
+ export declare const capitaliseString: (stringValue: string) => string;
4
+ export declare const callAll: <T extends (...args: never[]) => void>(...fns: T[]) => (...args: Parameters<T>) => void;
@@ -0,0 +1,7 @@
1
+ {
2
+ "lib/index.tsx": {
3
+ "file": "react-data-matrix.umd.js",
4
+ "isEntry": true,
5
+ "src": "lib/index.tsx"
6
+ }
7
+ }