@cdc/data-bite 4.23.3 → 4.23.5
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/dist/cdcdatabite.js +3336 -3295
- package/package.json +3 -3
- package/src/CdcDataBite.jsx +6 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cdc/data-bite",
|
|
3
|
-
"version": "4.23.
|
|
3
|
+
"version": "4.23.5",
|
|
4
4
|
"description": "React component for displaying a single piece of data in a card module",
|
|
5
5
|
"moduleName": "CdcDataBite",
|
|
6
6
|
"main": "dist/cdcdatabite",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"license": "Apache-2.0",
|
|
27
27
|
"homepage": "https://github.com/CDCgov/cdc-open-viz#readme",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@cdc/core": "^4.23.
|
|
29
|
+
"@cdc/core": "^4.23.5",
|
|
30
30
|
"chroma": "0.0.1",
|
|
31
31
|
"chroma-js": "^2.1.0",
|
|
32
32
|
"html-react-parser": "^3.0.8",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"react": "^18.2.0",
|
|
40
40
|
"react-dom": "^18.2.0"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "34add3436994ca3cf13e51f313add4d70377f53e"
|
|
43
43
|
}
|
package/src/CdcDataBite.jsx
CHANGED
|
@@ -101,13 +101,13 @@ const CdcDataBite = props => {
|
|
|
101
101
|
setLoading(false)
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
const calculateDataBite = (includePrefixSuffix= true) => {
|
|
104
|
+
const calculateDataBite = (includePrefixSuffix = true) => {
|
|
105
105
|
//If either the column or function aren't set, do not calculate
|
|
106
106
|
if (!dataColumn || !dataFunction) {
|
|
107
107
|
return ''
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
const applyPrecision =
|
|
110
|
+
const applyPrecision = value => {
|
|
111
111
|
// first validation
|
|
112
112
|
if (value === undefined || value === null) {
|
|
113
113
|
console.error('Enter correct value to "applyPrecision()" function ')
|
|
@@ -132,7 +132,7 @@ const CdcDataBite = props => {
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
// filter null and 0 out from count data
|
|
135
|
-
const getColumnCount =
|
|
135
|
+
const getColumnCount = arr => {
|
|
136
136
|
if (config.dataFormat.ignoreZeros) {
|
|
137
137
|
numericalData = numericalData.filter(item => item && item)
|
|
138
138
|
return numericalData.length
|
|
@@ -141,14 +141,13 @@ const CdcDataBite = props => {
|
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
const getColumnSum =
|
|
144
|
+
const getColumnSum = arr => {
|
|
145
145
|
// first validation
|
|
146
146
|
if (arr === undefined || arr === null) {
|
|
147
147
|
console.error('Enter valid value for getColumnSum function ')
|
|
148
148
|
return
|
|
149
149
|
}
|
|
150
150
|
// second validation
|
|
151
|
-
console.log('arr', arr)
|
|
152
151
|
if (arr.length === 0 || !Array.isArray(arr)) {
|
|
153
152
|
console.error('Arguments are not valid getColumnSum function ')
|
|
154
153
|
return
|
|
@@ -163,7 +162,7 @@ const CdcDataBite = props => {
|
|
|
163
162
|
return applyPrecision(sum)
|
|
164
163
|
}
|
|
165
164
|
|
|
166
|
-
const getColumnMean =
|
|
165
|
+
const getColumnMean = arr => {
|
|
167
166
|
// add default params to escape errors on runtime
|
|
168
167
|
// first validation
|
|
169
168
|
if (arr === undefined || arr === null || !Array.isArray(arr)) {
|
|
@@ -220,7 +219,7 @@ const CdcDataBite = props => {
|
|
|
220
219
|
return applyPrecision(value)
|
|
221
220
|
}
|
|
222
221
|
|
|
223
|
-
const applyLocaleString =
|
|
222
|
+
const applyLocaleString = value => {
|
|
224
223
|
if (value === undefined || value === null) return
|
|
225
224
|
if (Number.isNaN(value) || typeof value === 'number') {
|
|
226
225
|
value = String(value)
|