@isoftdata/utility-dashboard-backend 2.0.0 → 2.0.2

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/chart-helper.js CHANGED
@@ -243,13 +243,13 @@ module.exports = {
243
243
  // right align currency values
244
244
  if (formatting?.[field]?.type === 'NumberFormat' && formatting?.[field].format.prefix === '$') {
245
245
  return {
246
- property: `${field}.value`,
246
+ property: `${field}[value]`,
247
247
  name: field,
248
248
  class: 'text-right border-top-0',
249
249
  }
250
250
  }
251
251
  return {
252
- property: `${field}.value`,
252
+ property: `${field}[value]`,
253
253
  name: field,
254
254
  class: 'border-top-0',
255
255
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isoftdata/utility-dashboard-backend",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "A utility for formatting chart and report data to be usable by the frontend dashboard component.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -17,6 +17,7 @@
17
17
  "klona": "^1.1.2",
18
18
  "mathjs": "^11.5.0",
19
19
  "mysql": "^2.18.1",
20
+ "snakecase-keys": "^5.4.4",
20
21
  "snakeize": "^0.1.0",
21
22
  "to-snake-case": "^1.0.0"
22
23
  }
@@ -1,12 +1,12 @@
1
1
 
2
2
  const mathjs = require('mathjs')
3
- const snakeize = require('snakeize')
3
+ const snakecaseKeys = require('snakecase-keys')
4
4
 
5
5
  function handleMathJsCellStyleTemplate(row, columnToStyle, templates) {
6
6
  let outColumn = { value: row[columnToStyle] }
7
7
  if (columnToStyle in templates) {
8
8
  // MathJS mutates the object you pass it, and we need to ensure keys are single "word" strings, so snakeize a copy of the row
9
- const scope = snakeize({ ...row })
9
+ const scope = snakecaseKeys({ ...row }, { deep: true })
10
10
  for (const key in templates[columnToStyle]) {
11
11
  try {
12
12
  outColumn[key] = mathjs.evaluate(templates[columnToStyle][key], scope)