react-data-matrix 0.3.7 → 0.4.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.
@@ -1,16 +0,0 @@
1
- export const getCustomStyles = (hasStyle) => !hasStyle ? {} : hasStyle;
2
- export const getContainerStyles = (hasStyle, styles) =>
3
- // if custom styles are passed remove default styles by returning a spread empty object
4
- !hasStyle
5
- ? Object.assign({}, getCustomStyles(hasStyle)) : Object.assign({ top: `${50}%`, left: `${50}%`, height: `${100}%`, textAlign: "center", position: "absolute", transform: `translate(${-50}%, ${-50}%)` }, styles);
6
- export const getTableBoarder = (hasStyle) => !hasStyle ? {} : { border: `${1}px solid black` };
7
- export const getTableStyles = (hasStyle, styles) => !hasStyle
8
- ? Object.assign({}, getCustomStyles(hasStyle)) : Object.assign({ width: `${70}rem` }, styles);
9
- export const getHeaderPrimaryTitleStyles = (hasStyle, styles) => !hasStyle
10
- ? Object.assign({}, getCustomStyles(hasStyle)) : Object.assign({ borderWidth: `${0}`, padding: `${1}rem ${0} ${1}rem ${0}` }, styles);
11
- export const getHeaderRowStyles = (hasStyle, styles) => !hasStyle
12
- ? Object.assign({}, getCustomStyles(hasStyle)) : Object.assign({ borderColor: "black", borderStyle: "solid", padding: `${10}rem ${0} ${0} ${0}`, borderWidth: `${0} ${0} ${0} ${10}px` }, styles);
13
- export const getHeaderTitleStyles = (hasStyle, styles) => !hasStyle
14
- ? Object.assign({}, getCustomStyles(hasStyle)) : Object.assign({ padding: `${0} ${0.5}rem ${0} ${0.5}rem`, backgroundColor: "light-grey", border: `${1}px solid black` }, styles);
15
- export const getHeaderSubTitleStyles = (hasStyle, styles) => !hasStyle
16
- ? Object.assign({}, getCustomStyles(hasStyle)) : Object.assign({ fontSize: `${0.9}em`, fontWeight: "normal" }, styles);
package/dist/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export { default as ReactMatrix } from "./components/ReactMatrix";
package/dist/index.js DELETED
@@ -1 +0,0 @@
1
- export { default as ReactMatrix } from "./components/ReactMatrix";
@@ -1 +0,0 @@
1
- export {};
@@ -1,342 +0,0 @@
1
- export const data = {
2
- id: 1,
3
- matrix_size: 5,
4
- matrix_name: "React Matrix",
5
- primary_header_title: "Consequence",
6
- primary_row_header_title: "Likelihood",
7
- matrix_description: "Risk Matrix Template",
8
- matrix_details: [
9
- {
10
- id: 1,
11
- likelihood: "E",
12
- consequence: 1,
13
- position: 5,
14
- matrix_type: "Risk",
15
- header_title: "Minor",
16
- header_sub_title: "Header sub-title/description.",
17
- row_header_title: "Rare",
18
- row_header_sub_title: "Row Header sub-title/description.",
19
- },
20
- {
21
- id: 2,
22
- position: 5,
23
- matrix_type: "Risk",
24
- likelihood: "D",
25
- consequence: 2,
26
- header_title: "Moderate",
27
- header_sub_title: "Header sub-title/description.",
28
- row_header_title: "Unlikely",
29
- row_header_sub_title: "Row Header sub-title/description.",
30
- },
31
- {
32
- id: 3,
33
- position: 5,
34
- matrix_type: "Risk",
35
- likelihood: "C",
36
- consequence: 3,
37
- header_title: "Significant",
38
- header_sub_title: "Header sub-title/description.",
39
- row_header_title: "Possible",
40
- row_header_sub_title: "Row Header sub-title/description.",
41
- },
42
- {
43
- id: 4,
44
- position: 5,
45
- matrix_type: "Risk",
46
- likelihood: "B",
47
- consequence: 4,
48
- header_title: "Critical",
49
- header_sub_title: "Header sub-title/description.",
50
- row_header_title: "Likely",
51
- row_header_sub_title: "Row Header sub-title/description.",
52
- },
53
- {
54
- id: 5,
55
- position: 5,
56
- matrix_type: "Risk",
57
- likelihood: "A",
58
- consequence: 5,
59
- header_title: "Catastrophic",
60
- header_sub_title: "Header sub-title/description.",
61
- row_header_title: "Almost Certain",
62
- row_header_sub_title: "Row Header sub-title/description.",
63
- },
64
- ],
65
- matrix_values: [
66
- {
67
- id: 26,
68
- matrix_id: 1,
69
- description: "low",
70
- score_value: 1,
71
- colour: "green",
72
- position: 1,
73
- likelihood_descriptor: "E",
74
- consequence_descriptor: 1,
75
- response: "Business as usual",
76
- },
77
- {
78
- id: 27,
79
- matrix_id: 1,
80
- description: "low",
81
- score_value: 2,
82
- colour: "green",
83
- position: 6,
84
- likelihood_descriptor: "D",
85
- consequence_descriptor: 1,
86
- response: "Business as usual",
87
- },
88
- {
89
- id: 28,
90
- matrix_id: 1,
91
- description: "low",
92
- score_value: 3,
93
- colour: "green",
94
- position: 2,
95
- likelihood_descriptor: "E",
96
- consequence_descriptor: 2,
97
- response: "Business as usual",
98
- },
99
- {
100
- id: 29,
101
- matrix_id: 1,
102
- description: "low",
103
- score_value: 4,
104
- colour: "green",
105
- position: 11,
106
- likelihood_descriptor: "C",
107
- consequence_descriptor: 1,
108
- response: "Business as usual",
109
- },
110
- {
111
- id: 30,
112
- matrix_id: 1,
113
- description: "low",
114
- score_value: 5,
115
- colour: "green",
116
- position: 7,
117
- likelihood_descriptor: "D",
118
- consequence_descriptor: 2,
119
- response: "Business as usual",
120
- },
121
- {
122
- id: 31,
123
- matrix_id: 1,
124
- description: "low",
125
- score_value: 6,
126
- colour: "green",
127
- position: 3,
128
- likelihood_descriptor: "E",
129
- consequence_descriptor: 3,
130
- response: "Business as usual",
131
- },
132
- {
133
- id: 32,
134
- matrix_id: 1,
135
- description: "medium",
136
- score_value: 7,
137
- colour: "yellow",
138
- position: 16,
139
- likelihood_descriptor: "B",
140
- consequence_descriptor: 1,
141
- response: "Requires routine to periodic monitoring",
142
- },
143
- {
144
- id: 33,
145
- matrix_id: 1,
146
- description: "medium",
147
- score_value: 8,
148
- colour: "yellow",
149
- position: 12,
150
- likelihood_descriptor: "C",
151
- consequence_descriptor: 2,
152
- response: "Requires routine to periodic monitoring",
153
- },
154
- {
155
- id: 34,
156
- matrix_id: 1,
157
- description: "medium",
158
- score_value: 9,
159
- colour: "yellow",
160
- position: 8,
161
- likelihood_descriptor: "D",
162
- consequence_descriptor: 3,
163
- response: "Requires routine to periodic monitoring",
164
- },
165
- {
166
- id: 35,
167
- matrix_id: 1,
168
- description: "medium",
169
- score_value: 10,
170
- colour: "yellow",
171
- position: 4,
172
- likelihood_descriptor: "E",
173
- consequence_descriptor: 4,
174
- response: "Requires routine to periodic monitoring",
175
- },
176
- {
177
- id: 36,
178
- matrix_id: 1,
179
- description: "medium",
180
- score_value: 11,
181
- colour: "yellow",
182
- position: 21,
183
- likelihood_descriptor: "A",
184
- consequence_descriptor: 1,
185
- response: "Requires routine to periodic monitoring",
186
- },
187
- {
188
- id: 37,
189
- matrix_id: 1,
190
- description: "high",
191
- score_value: 12,
192
- colour: "orange",
193
- position: 17,
194
- likelihood_descriptor: "B",
195
- consequence_descriptor: 2,
196
- response: "Risk requires targeted management plan",
197
- },
198
- {
199
- id: 38,
200
- matrix_id: 1,
201
- description: "high",
202
- score_value: 13,
203
- colour: "orange",
204
- position: 13,
205
- likelihood_descriptor: "C",
206
- consequence_descriptor: 3,
207
- response: "Risk requires targeted management plan",
208
- },
209
- {
210
- id: 39,
211
- matrix_id: 1,
212
- description: "high",
213
- score_value: 14,
214
- colour: "orange",
215
- position: 9,
216
- likelihood_descriptor: "D",
217
- consequence_descriptor: 4,
218
- response: "Risk requires targeted management plan",
219
- },
220
- {
221
- id: 40,
222
- matrix_id: 1,
223
- description: "high",
224
- score_value: 15,
225
- colour: "orange",
226
- position: 5,
227
- likelihood_descriptor: "E",
228
- consequence_descriptor: 5,
229
- response: "Risk requires targeted management plan",
230
- },
231
- {
232
- id: 41,
233
- matrix_id: 1,
234
- description: "high",
235
- score_value: 16,
236
- colour: "orange",
237
- position: 22,
238
- likelihood_descriptor: "A",
239
- consequence_descriptor: 2,
240
- response: "Risk requires targeted management plan",
241
- },
242
- {
243
- id: 42,
244
- matrix_id: 1,
245
- description: "high",
246
- score_value: 17,
247
- colour: "orange",
248
- position: 18,
249
- likelihood_descriptor: "B",
250
- consequence_descriptor: 3,
251
- response: "Risk requires targeted management plan",
252
- },
253
- {
254
- id: 43,
255
- matrix_id: 1,
256
- description: "high",
257
- score_value: 18,
258
- colour: "orange",
259
- position: 14,
260
- likelihood_descriptor: "C",
261
- consequence_descriptor: 4,
262
- response: "Risk requires targeted management plan",
263
- },
264
- {
265
- id: 44,
266
- matrix_id: 1,
267
- description: "high",
268
- score_value: 19,
269
- colour: "orange",
270
- position: 10,
271
- likelihood_descriptor: "D",
272
- consequence_descriptor: 5,
273
- response: "Risk requires targeted management plan",
274
- },
275
- {
276
- id: 45,
277
- matrix_id: 1,
278
- description: "extreme",
279
- score_value: 20,
280
- colour: "red",
281
- position: 23,
282
- likelihood_descriptor: "A",
283
- consequence_descriptor: 3,
284
- response: "Activity should not commence",
285
- },
286
- {
287
- id: 46,
288
- matrix_id: 1,
289
- description: "extreme",
290
- score_value: 21,
291
- colour: "red",
292
- position: 19,
293
- likelihood_descriptor: "B",
294
- consequence_descriptor: 4,
295
- response: "Activity should not commence",
296
- },
297
- {
298
- id: 47,
299
- matrix_id: 1,
300
- description: "extreme",
301
- score_value: 22,
302
- colour: "red",
303
- position: 15,
304
- likelihood_descriptor: "C",
305
- consequence_descriptor: 5,
306
- response: "Activity should not commence",
307
- },
308
- {
309
- id: 48,
310
- matrix_id: 1,
311
- description: "extreme",
312
- score_value: 23,
313
- colour: "red",
314
- position: 24,
315
- likelihood_descriptor: "A",
316
- consequence_descriptor: 4,
317
- response: "Activity should not commence",
318
- },
319
- {
320
- id: 49,
321
- matrix_id: 1,
322
- description: "extreme",
323
- score_value: 24,
324
- colour: "red",
325
- position: 20,
326
- likelihood_descriptor: "B",
327
- consequence_descriptor: 5,
328
- response: "Activity should not commence",
329
- },
330
- {
331
- id: 50,
332
- matrix_id: 1,
333
- description: "extreme",
334
- score_value: 25,
335
- colour: "red",
336
- position: 25,
337
- likelihood_descriptor: "A",
338
- consequence_descriptor: 5,
339
- response: "Activity should not commence",
340
- },
341
- ],
342
- };
@@ -1,4 +0,0 @@
1
- export declare const groupObjectsByProp: <T extends Record<string, any>>(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: any[]) => void>(...fns: T[]) => (...args: Parameters<T>) => void;
@@ -1,18 +0,0 @@
1
- export const groupObjectsByProp = (array, prop) => {
2
- const map = new Map(Array.from(array, (obj) => [obj[prop], []]));
3
- array.forEach((obj) => {
4
- const key = obj[prop];
5
- if (key !== undefined) {
6
- const group = map.get(key);
7
- if (group) {
8
- group.push(obj);
9
- }
10
- }
11
- });
12
- return Array.from(map.values());
13
- };
14
- // capitalises first character of each word
15
- export const capitaliseFirstCharacter = (stringValue) => stringValue.replace(/\b([a-z\s])/g, (string) => string.toUpperCase());
16
- // capitalizes entire word
17
- export const capitaliseString = (stringValue) => stringValue.toUpperCase();
18
- export const callAll = (...fns) => (...args) => fns.forEach((fn) => fn && fn(...args));
File without changes