react-data-matrix 0.1.9 → 0.2.0

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.
Files changed (2) hide show
  1. package/README.md +186 -166
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -1,17 +1,18 @@
1
1
  # React Matrix   [![npm version](https://badge.fury.io/js/react-data-matrix.svg)](https://badge.fury.io/js/react-data-matrix)
2
2
 
3
- [React Matrix Demo](https://react-matrix.herokuapp.com/)
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
 
7
- The most common usage for a table like React Matrix, is to display the __likelihood__ and __consequence__ "scores" of __risks/hazards__, this can be for anything from Corporate, Work Health Safety and Environment risks, and more.
7
+ The most common usage for a table like React Matrix, is to display the **likelihood** and **consequence** "scores" of **risks/hazards**, this can be for anything from Corporate, Work Health Safety and Environment risks, and more.
8
8
 
9
9
  # PR's
10
+
10
11
  - Have a look at the [PR template doc](https://github.com/bronz3beard/react-matrix/blob/main/docs) for best approach to getting your pr merged.
11
12
 
12
13
  # Usage
13
14
 
14
- ```js
15
+ ```js
15
16
  import { ReactMatrix } from "react-data-matrix";
16
17
 
17
18
  const App = () => {
@@ -24,7 +25,8 @@ const App = () => {
24
25
  ```
25
26
 
26
27
  # Expected Data Structure
27
- - See [```./src/lib/utils/data.js```](https://github.com/bronz3beard/react-matrix/blob/main/src/lib/utils/data.js) for an example of the data, this can be used for testing if needed,
28
+
29
+ - See [`./src/lib/utils/data.js`](https://github.com/bronz3beard/react-matrix/blob/main/src/lib/utils/data.js) for an example of the data, this can be used for testing if needed,
28
30
  or an example of how to construct/deconstruct your data objects from your api.
29
31
 
30
32
  ```js
@@ -84,191 +86,209 @@ const App = () => {
84
86
  # PropTypes
85
87
 
86
88
  ```js
87
- propTypes = {
88
- data: PropTypes.shape({
89
- id: PropTypes.number,
90
- matrix_name: PropTypes.string,
91
- matrix_description: PropTypes.string,
92
- matrix_size: PropTypes.number.isRequired,
93
- matrix_details: PropTypes.arrayOf(
94
- PropTypes.shape({
95
- id: PropTypes.number,
96
- likelihood: PropTypes.string,
97
- consequence: PropTypes.number,
98
- header_title: PropTypes.string,
99
- header_sub_title: PropTypes.string,
100
- row_header_title: PropTypes.string,
101
- row_header_sub_title: PropTypes.string,
102
- })
103
- ).isRequired,
104
-
105
- matrix_values: PropTypes.arrayOf(
106
- PropTypes.shape({
107
- id: PropTypes.number.isRequired,
108
- colour: PropTypes.string,
109
- position: PropTypes.number.isRequired,
110
- matrix_id: PropTypes.number,
111
- score_value: PropTypes.number,
112
- description: PropTypes.string,
113
- response: PropTypes.string,
114
- likelihood_descriptor: PropTypes.string.isRequired,
115
- consequence_descriptor: PropTypes.number,
116
- })
117
- ).isRequired,
118
- }).isRequired,
119
-
120
- hasTableBorder: PropTypes.bool,
121
- hasInlineStyles: PropTypes.bool,
122
- hasContainerStyles: PropTypes.bool,
123
- reverseMatrixValues: PropTypes.bool,
124
- matrixSizeSelected: PropTypes.number,
125
-
126
- rowPrimaryUpper: PropTypes.bool,
127
- headerPrimaryUpper: PropTypes.bool,
128
-
129
- thRowStyles: PropTypes.shape({}),
130
- thTitleStyles: PropTypes.shape({}),
131
- thSubTitleStyles: PropTypes.shape({}),
132
- thPrimaryTitleStyles: PropTypes.shape({}),
133
-
134
- trRowStyles: PropTypes.shape({}),
135
- trTitleStyles: PropTypes.shape({}),
136
- trSubTitleStyles: PropTypes.shape({}),
137
- trPrimaryTitleStyles: PropTypes.shape({}),
138
-
139
- tdStyles: PropTypes.shape({}),
140
-
141
- customHeaderRowIdValue: PropTypes.string,
142
- customDynamicHeaderTitleIdValue: PropTypes.string,
143
- customDynamicSubHeaderTitleIdValue: PropTypes.string,
144
-
145
- customRowDynamicIdValue: PropTypes.string,
146
- customRowHeaderDynamicIdValue: PropTypes.string,
147
-
148
- customTableDataDynamicIdValue: PropTypes.string,
149
- };
150
-
151
- defaultProps = {
152
- hasTableBorder: true,
153
- rowPrimaryUpper: true,
154
- hasInlineStyles: true,
155
- matrixSizeSelected: 5,
156
- headerPrimaryUpper: true,
157
- hasContainerStyles: true,
158
- reverseMatrixValues: true,
159
-
160
- thRowStyles: {},
161
- thTitleStyles: {},
162
- thSubTitleStyles: {},
163
- thPrimaryTitleStyles: {},
164
-
165
- trRowStyles: {},
166
- trTitleStyles: {},
167
- trSubTitleStyles: {},
168
- trPrimaryTitleStyles: {},
169
-
170
- tdStyles: {},
171
-
172
- matrixName: "",
173
- matrixDescription: "",
174
- customHeaderRowIdValue: "",
175
- customRowDynamicIdValue: "",
176
- customTableDataDynamicIdValue: "",
177
- customRowHeaderDynamicIdValue: "",
178
- customDynamicHeaderTitleIdValue: "",
179
- customDynamicSubHeaderTitleIdValue: "",
180
- };
89
+ propTypes = {
90
+ data: PropTypes.shape({
91
+ id: PropTypes.number,
92
+ matrix_name: PropTypes.string,
93
+ matrix_description: PropTypes.string,
94
+ matrix_size: PropTypes.number.isRequired,
95
+ matrix_details: PropTypes.arrayOf(
96
+ PropTypes.shape({
97
+ id: PropTypes.number,
98
+ likelihood: PropTypes.string,
99
+ consequence: PropTypes.number,
100
+ header_title: PropTypes.string,
101
+ header_sub_title: PropTypes.string,
102
+ row_header_title: PropTypes.string,
103
+ row_header_sub_title: PropTypes.string,
104
+ })
105
+ ).isRequired,
106
+
107
+ matrix_values: PropTypes.arrayOf(
108
+ PropTypes.shape({
109
+ id: PropTypes.number.isRequired,
110
+ colour: PropTypes.string,
111
+ position: PropTypes.number.isRequired,
112
+ matrix_id: PropTypes.number,
113
+ score_value: PropTypes.number,
114
+ description: PropTypes.string,
115
+ response: PropTypes.string,
116
+ likelihood_descriptor: PropTypes.string.isRequired,
117
+ consequence_descriptor: PropTypes.number,
118
+ })
119
+ ).isRequired,
120
+ }).isRequired,
121
+
122
+ hasTableBorder: PropTypes.bool,
123
+ hasInlineStyles: PropTypes.bool,
124
+ hasContainerStyles: PropTypes.bool,
125
+ reverseMatrixValues: PropTypes.bool,
126
+ matrixSizeSelected: PropTypes.number,
127
+
128
+ rowPrimaryUpper: PropTypes.bool,
129
+ headerPrimaryUpper: PropTypes.bool,
130
+
131
+ thRowStyles: PropTypes.shape({}),
132
+ thTitleStyles: PropTypes.shape({}),
133
+ thSubTitleStyles: PropTypes.shape({}),
134
+ thPrimaryTitleStyles: PropTypes.shape({}),
135
+
136
+ trRowStyles: PropTypes.shape({}),
137
+ trTitleStyles: PropTypes.shape({}),
138
+ trSubTitleStyles: PropTypes.shape({}),
139
+ trPrimaryTitleStyles: PropTypes.shape({}),
140
+
141
+ tdStyles: PropTypes.shape({}),
142
+
143
+ customHeaderRowIdValue: PropTypes.string,
144
+ customDynamicHeaderTitleIdValue: PropTypes.string,
145
+ customDynamicSubHeaderTitleIdValue: PropTypes.string,
146
+
147
+ customRowDynamicIdValue: PropTypes.string,
148
+ customRowHeaderDynamicIdValue: PropTypes.string,
149
+
150
+ customTableDataDynamicIdValue: PropTypes.string,
151
+ };
152
+
153
+ defaultProps = {
154
+ hasTableBorder: true,
155
+ rowPrimaryUpper: true,
156
+ hasInlineStyles: true,
157
+ matrixSizeSelected: 5,
158
+ headerPrimaryUpper: true,
159
+ hasContainerStyles: true,
160
+ reverseMatrixValues: true,
161
+
162
+ thRowStyles: {},
163
+ thTitleStyles: {},
164
+ thSubTitleStyles: {},
165
+ thPrimaryTitleStyles: {},
166
+
167
+ trRowStyles: {},
168
+ trTitleStyles: {},
169
+ trSubTitleStyles: {},
170
+ trPrimaryTitleStyles: {},
171
+
172
+ tdStyles: {},
173
+
174
+ matrixName: "",
175
+ matrixDescription: "",
176
+ customHeaderRowIdValue: "",
177
+ customRowDynamicIdValue: "",
178
+ customTableDataDynamicIdValue: "",
179
+ customRowHeaderDynamicIdValue: "",
180
+ customDynamicHeaderTitleIdValue: "",
181
+ customDynamicSubHeaderTitleIdValue: "",
182
+ };
181
183
  ```
182
184
 
183
185
  # Available Properties
184
186
 
185
- - __hasInlineStyles__
186
- * Default is true.
187
- * If false all inline styles are removed.
188
-
189
- ----
190
- - __hasTableBorder__
191
- * Default is true.
192
- * If false the most outer border is removed.
193
-
194
- ----
195
- - __hasContainerStyles__
196
- * Default is true.
197
- * This will center the matrix in the middle of the page.
198
-
199
- ----
200
- - __reverseMatrixValues__
201
- * Default is true.
202
- * When true the lowest value will be in the bottom left and the highest value will be in the top right, with all sequential values in-between.
203
- * When false the values will be reversed, lowest value top left highest value bottom right.
204
-
205
- ----
206
- - __rowPrimaryUpper__
207
- * Default is true.
208
- * If false string formatting will be removed.
209
-
210
- ----
211
- - __headerPrimaryUpper__
212
- * Default is true.
213
- * If false string formatting will be removed.
214
-
215
- ----
216
- - __customHeaderRowIdValue__
217
- * Default is empty string.
218
- * can be used to target element through id prop.
219
-
220
- ----
221
- - __customDynamicHeaderTitleIdValue__
222
- * Default is empty string.
223
- * can be used to target element through id prop.
224
-
225
- ----
226
- - __customDynamicSubHeaderTitleIdValue__
227
- * Default is empty string.
228
- * can be used to target element through id prop.
229
-
230
- ----
231
- - __customRowDynamicIdValue__
232
- * Default is empty string.
233
- * can be used to target element through id prop.
234
-
235
- ----
236
- - __customRowHeaderDynamicIdValue__
237
- * Default is empty string.
238
- * can be used to target element through id prop.
239
-
240
- ----
241
- - __customTableDataDynamicIdValue__
242
- * Default is empty string.
243
- * can be used to target element through id prop.
244
-
245
- ----
187
+ - **hasInlineStyles**
188
+ - Default is true.
189
+ - If false all inline styles are removed.
190
+
191
+ ---
192
+
193
+ - **hasTableBorder**
194
+ - Default is true.
195
+ - If false the most outer border is removed.
196
+
197
+ ---
198
+
199
+ - **hasContainerStyles**
200
+ - Default is true.
201
+ - This will center the matrix in the middle of the page.
202
+
203
+ ---
204
+
205
+ - **reverseMatrixValues**
206
+ - Default is true.
207
+ - When true the lowest value will be in the bottom left and the highest value will be in the top right, with all sequential values in-between.
208
+ - When false the values will be reversed, lowest value top left highest value bottom right.
209
+
210
+ ---
211
+
212
+ - **rowPrimaryUpper**
213
+ - Default is true.
214
+ - If false string formatting will be removed.
215
+
216
+ ---
217
+
218
+ - **headerPrimaryUpper**
219
+ - Default is true.
220
+ - If false string formatting will be removed.
221
+
222
+ ---
223
+
224
+ - **customHeaderRowIdValue**
225
+ - Default is empty string.
226
+ - can be used to target element through id prop.
227
+
228
+ ---
229
+
230
+ - **customDynamicHeaderTitleIdValue**
231
+ - Default is empty string.
232
+ - can be used to target element through id prop.
233
+
234
+ ---
235
+
236
+ - **customDynamicSubHeaderTitleIdValue**
237
+ - Default is empty string.
238
+ - can be used to target element through id prop.
239
+
240
+ ---
241
+
242
+ - **customRowDynamicIdValue**
243
+ - Default is empty string.
244
+ - can be used to target element through id prop.
245
+
246
+ ---
247
+
248
+ - **customRowHeaderDynamicIdValue**
249
+ - Default is empty string.
250
+ - can be used to target element through id prop.
251
+
252
+ ---
253
+
254
+ - **customTableDataDynamicIdValue**
255
+ - Default is empty string.
256
+ - can be used to target element through id prop.
257
+
258
+ ---
246
259
 
247
260
  # Styling Properties
248
261
 
249
262
  ### Inline
250
- __These styles can be added to the current styles or,
251
- if you make ```hasInlineStyles = false```, then add these values with your own styles, you can have full control over styling inline.__
252
263
 
253
- __ReactMatrix__
264
+ **These styles can be added to the current styles or,
265
+ if you make `hasInlineStyles = false`, then add these values with your own styles, you can have full control over styling inline.**
266
+
267
+ **ReactMatrix**
268
+
254
269
  - tableContainerStyles={{}}
255
270
  - tableStyles={{}}
256
271
 
257
- __MatrixHeaders__
272
+ **MatrixHeaders**
273
+
258
274
  - thRowStyles={{}}
259
275
  - thTitleStyles={{}}
260
276
  - thSubTitleStyles={{}}
261
277
  - thPrimaryTitleStyles={{}}
262
278
 
263
- __MatrixRows__
279
+ **MatrixRows**
280
+
264
281
  - trRowStyles={{}},
265
282
  - trTitleStyles={{}},
266
283
  - trSubTitleStyles={{}},
267
284
  - trPrimaryTitleStyles={{}},
268
285
 
269
- __TableData__
286
+ **TableData**
287
+
270
288
  - tdStyles={{}},
271
289
 
272
- ----
290
+ ---
291
+
273
292
  # Create React App
293
+
274
294
  - This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-data-matrix",
3
- "version": "0.1.9",
3
+ "version": "0.2.0",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "homepage": "https://bronz3beard.github.io/react-matrix",
@@ -31,10 +31,10 @@
31
31
  "scripts": {
32
32
  "start": "react-scripts start",
33
33
  "build": "rm -rf dist && NODE_ENV=production babel src/lib --out-dir dist --copy-files",
34
- "build-og": "react-scripts build",
34
+ "build:og": "react-scripts build",
35
35
  "test": "react-scripts test",
36
36
  "eject": "react-scripts eject",
37
- "predeploy": "npm run build",
37
+ "predeploy": "npm run build:og",
38
38
  "deploy": "gh-pages -d build"
39
39
  },
40
40
  "eslintConfig": {