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 +77 -63
- package/dist/{components → lib/components}/MatrixHeaders.d.ts +2 -2
- package/dist/{components → lib/components}/MatrixRows.d.ts +2 -2
- package/dist/{components → lib/components}/TableData.d.ts +2 -2
- package/dist/{components/ReactMatrix.d.ts → lib/index.d.ts} +2 -2
- package/dist/{types → lib/types}/index.d.ts +0 -2
- package/dist/{utils → lib/utils}/data.d.ts +1 -1
- package/dist/lib/utils/functions.d.ts +4 -0
- package/dist/manifest.json +7 -0
- package/dist/react-data-matrix.es.js +913 -0
- package/dist/react-data-matrix.umd.js +28 -0
- package/package.json +39 -35
- package/dist/components/MatrixHeaders.jsx +0 -38
- package/dist/components/MatrixRows.jsx +0 -48
- package/dist/components/ReactMatrix.jsx +0 -42
- package/dist/components/TableData.jsx +0 -19
- package/dist/helpers/getStyles.js +0 -16
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/types/index.js +0 -1
- package/dist/utils/data.js +0 -342
- package/dist/utils/functions.d.ts +0 -4
- package/dist/utils/functions.js +0 -18
- /package/dist/{helpers → lib/helpers}/getStyles.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# React 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
|
-
```
|
|
16
|
-
import
|
|
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
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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
|
-
#
|
|
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
|
-
#
|
|
349
|
-
|
|
350
|
-
- This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
|
364
|
+
# React + TypeScript + Vite
|
|
@@ -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
|
|
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;
|