@cdc/core 4.25.5-1 → 4.25.6-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.
Files changed (41) hide show
  1. package/LICENSE +201 -0
  2. package/components/Alert/components/Alert.tsx +1 -1
  3. package/components/DataTable/DataTable.tsx +0 -3
  4. package/components/DataTable/DataTableStandAlone.tsx +15 -9
  5. package/components/DataTable/components/ChartHeader.tsx +6 -4
  6. package/components/DataTable/components/DataTableEditorPanel.tsx +25 -3
  7. package/components/DataTable/helpers/chartCellMatrix.tsx +13 -10
  8. package/components/DataTable/helpers/getChartCellValue.ts +42 -26
  9. package/components/DataTable/helpers/mapCellMatrix.tsx +9 -1
  10. package/components/EditorPanel/FootnotesEditor.tsx +76 -22
  11. package/components/EditorPanel/VizFilterEditor/NestedDropdownEditor.tsx +1 -1
  12. package/components/EditorPanel/VizFilterEditor/VizFilterEditor.tsx +48 -34
  13. package/components/Filters/Filters.tsx +27 -69
  14. package/components/Filters/components/Dropdown.tsx +1 -1
  15. package/components/Footnotes/Footnotes.tsx +1 -1
  16. package/components/Footnotes/FootnotesStandAlone.tsx +8 -33
  17. package/components/Layout/components/Visualization/index.tsx +2 -1
  18. package/components/Legend/Legend.Gradient.tsx +3 -2
  19. package/components/MultiSelect/MultiSelect.tsx +3 -6
  20. package/components/NestedDropdown/NestedDropdown.tsx +19 -19
  21. package/helpers/cove/number.ts +5 -3
  22. package/helpers/coveUpdateWorker.ts +4 -0
  23. package/helpers/formatConfigBeforeSave.ts +19 -32
  24. package/helpers/updateFieldFactory.ts +1 -0
  25. package/helpers/ver/4.25.4.ts +77 -0
  26. package/helpers/ver/4.25.6.ts +36 -0
  27. package/helpers/ver/4.25.7.ts +26 -0
  28. package/helpers/ver/tests/4.25.4.test.ts +66 -1
  29. package/helpers/ver/tests/4.25.6.test.ts +84 -0
  30. package/package.json +7 -5
  31. package/styles/_global.scss +0 -4
  32. package/styles/filters.scss +0 -4
  33. package/types/Axis.ts +2 -0
  34. package/types/DataSet.ts +14 -0
  35. package/types/Footnotes.ts +5 -2
  36. package/types/Table.ts +1 -0
  37. package/types/Visualization.ts +3 -12
  38. package/types/VizFilter.ts +3 -0
  39. package/components/Filters/helpers/getNewRuntime.ts +0 -35
  40. package/components/Filters/helpers/tests/getNewRuntime.test.ts +0 -82
  41. /package/helpers/{fetchRemoteData.js → fetchRemoteData.ts} +0 -0
@@ -1,35 +0,0 @@
1
- import _ from 'lodash'
2
-
3
- export const getNewRuntime = (visualizationConfig, newFilteredData) => {
4
- const runtime = _.cloneDeep(visualizationConfig.runtime) || {}
5
- runtime.series = []
6
- runtime.seriesLabels = {}
7
- runtime.seriesLabelsAll = []
8
- const { filters, columns, dynamicSeriesType, dynamicSeriesLineType, xAxis } = visualizationConfig
9
- if (newFilteredData?.length) {
10
- const columnNames = Object.keys(newFilteredData[0])
11
- columnNames.forEach(colName => {
12
- const isNotXAxis = xAxis.dataKey !== colName
13
- const isNotFiltered = !filters || !filters?.find(filter => filter.columnName === colName)
14
- const noColConfiguration = !columns || Object.keys(columns).indexOf(colName) === -1
15
- if (isNotXAxis && isNotFiltered && noColConfiguration) {
16
- runtime.series.push({
17
- dataKey: colName,
18
- type: dynamicSeriesType,
19
- lineType: dynamicSeriesLineType,
20
- tooltip: true
21
- })
22
- }
23
- })
24
- }
25
-
26
- runtime.seriesKeys = runtime.series
27
- ? runtime.series.map(series => {
28
- runtime.seriesLabels[series.dataKey] = series.name || series.label || series.dataKey
29
- runtime.seriesLabelsAll.push(series.name || series.dataKey)
30
- return series.dataKey
31
- })
32
- : []
33
-
34
- return runtime
35
- }
@@ -1,82 +0,0 @@
1
- import { describe, it, expect } from 'vitest'
2
- import { getNewRuntime } from '../getNewRuntime'
3
-
4
- describe('getNewRuntime', () => {
5
- it('should return a runtime object with default values when no data is provided', () => {
6
- const visualizationConfig = { runtime: {} }
7
- const newFilteredData = null
8
-
9
- const result = getNewRuntime(visualizationConfig, newFilteredData)
10
-
11
- expect(result.series).toEqual([])
12
- expect(result.seriesLabels).toEqual({})
13
- expect(result.seriesLabelsAll).toEqual([])
14
- expect(result.seriesKeys).toEqual([])
15
- })
16
-
17
- it('should populate runtime.series with valid series from newFilteredData', () => {
18
- const visualizationConfig = {
19
- runtime: {},
20
- filters: [],
21
- columns: {},
22
- dynamicSeriesType: 'bar',
23
- dynamicSeriesLineType: 'solid',
24
- xAxis: { dataKey: 'x' }
25
- }
26
- const newFilteredData = [
27
- { x: 1, y: 10, z: 20 },
28
- { x: 2, y: 15, z: 25 }
29
- ]
30
-
31
- const result = getNewRuntime(visualizationConfig, newFilteredData)
32
-
33
- expect(result.series).toEqual([
34
- { dataKey: 'y', type: 'bar', lineType: 'solid', tooltip: true },
35
- { dataKey: 'z', type: 'bar', lineType: 'solid', tooltip: true }
36
- ])
37
- expect(result.seriesKeys).toEqual(['y', 'z'])
38
- expect(result.seriesLabels).toEqual({ y: 'y', z: 'z' })
39
- expect(result.seriesLabelsAll).toEqual(['y', 'z'])
40
- })
41
-
42
- it('should exclude series keys that match filters or columns', () => {
43
- const visualizationConfig = {
44
- runtime: {},
45
- filters: [{ columnName: 'y' }],
46
- columns: { z: {} },
47
- dynamicSeriesType: 'bar',
48
- dynamicSeriesLineType: 'solid',
49
- xAxis: { dataKey: 'x' }
50
- }
51
- const newFilteredData = [
52
- { x: 1, y: 10, z: 20, w: 30 },
53
- { x: 2, y: 15, z: 25, w: 35 }
54
- ]
55
-
56
- const result = getNewRuntime(visualizationConfig, newFilteredData)
57
-
58
- expect(result.series).toEqual([{ dataKey: 'w', type: 'bar', lineType: 'solid', tooltip: true }])
59
- expect(result.seriesKeys).toEqual(['w'])
60
- expect(result.seriesLabels).toEqual({ w: 'w' })
61
- expect(result.seriesLabelsAll).toEqual(['w'])
62
- })
63
-
64
- it('should handle empty newFilteredData gracefully', () => {
65
- const visualizationConfig = {
66
- runtime: {},
67
- filters: [],
68
- columns: {},
69
- dynamicSeriesType: 'bar',
70
- dynamicSeriesLineType: 'solid',
71
- xAxis: { dataKey: 'x' }
72
- }
73
- const newFilteredData = []
74
-
75
- const result = getNewRuntime(visualizationConfig, newFilteredData)
76
-
77
- expect(result.series).toEqual([])
78
- expect(result.seriesKeys).toEqual([])
79
- expect(result.seriesLabels).toEqual({})
80
- expect(result.seriesLabelsAll).toEqual([])
81
- })
82
- })