@cdc/dashboard 4.24.2 → 4.24.3
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/cdcdashboard.js +98192 -85200
- package/examples/sankey.json +5218 -0
- package/index.html +3 -2
- package/package.json +11 -10
- package/src/CdcDashboard.tsx +124 -124
- package/src/CdcDashboardComponent.tsx +173 -186
- package/src/DashboardContext.tsx +4 -1
- package/src/_stories/Dashboard.stories.tsx +27 -5
- package/src/_stories/_mock/pivot-filter.json +163 -0
- package/src/_stories/_mock/standalone-table.json +122 -0
- package/src/_stories/_mock/toggle-example.json +4035 -0
- package/src/components/EditorWrapper/EditorWrapper.tsx +52 -0
- package/src/components/EditorWrapper/editor-wrapper.style.css +13 -0
- package/src/components/Filters.tsx +88 -0
- package/src/components/Header/FilterModal.tsx +480 -0
- package/src/components/Header/Header.tsx +25 -465
- package/src/components/Row.tsx +28 -17
- package/src/components/Toggle/Toggle.tsx +37 -0
- package/src/components/Toggle/index.tsx +1 -0
- package/src/components/Toggle/toggle-style.css +34 -0
- package/src/components/VisualizationsPanel.tsx +13 -3
- package/src/components/Widget.tsx +14 -30
- package/src/helpers/filterData.ts +72 -49
- package/src/helpers/generateValuesForFilter.ts +2 -12
- package/src/helpers/getApiFilterKey.ts +5 -0
- package/src/helpers/getUpdateConfig.ts +24 -22
- package/src/helpers/iconHash.tsx +34 -0
- package/src/helpers/tests/filterData.test.ts +149 -0
- package/src/images/icon-toggle.svg +1 -0
- package/src/scss/grid.scss +1 -1
- package/src/scss/main.scss +6 -0
- package/src/store/dashboard.actions.ts +19 -2
- package/src/store/dashboard.reducer.ts +9 -1
- package/src/types/ConfigRow.ts +2 -0
- package/src/types/DataSet.ts +7 -7
- package/src/types/InitialState.ts +2 -1
- package/src/types/SharedFilter.ts +5 -2
- package/src/types/Tab.ts +1 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { DashboardConfig as Config } from '../types/DashboardConfig'
|
|
2
2
|
import { type Action } from '@cdc/core/types/Action'
|
|
3
|
+
import { Tab } from '../types/Tab'
|
|
3
4
|
|
|
4
5
|
type SET_CONFIG = Action<'SET_CONFIG', Config>
|
|
5
6
|
type UPDATE_CONFIG = Action<'UPDATE_CONFIG', [Config, Object?]>
|
|
@@ -7,7 +8,7 @@ type SET_DATA = Action<'SET_DATA', Object>
|
|
|
7
8
|
type SET_LOADING = Action<'SET_LOADING', boolean>
|
|
8
9
|
type SET_PREVIEW = Action<'SET_PREVIEW', boolean>
|
|
9
10
|
type SET_FILTERED_DATA = Action<'SET_FILTERED_DATA', Object>
|
|
10
|
-
type SET_TAB_SELECTED = Action<'SET_TAB_SELECTED',
|
|
11
|
+
type SET_TAB_SELECTED = Action<'SET_TAB_SELECTED', Tab>
|
|
11
12
|
type RENAME_DASHBOARD_TAB = Action<'RENAME_DASHBOARD_TAB', { current: string; new: string }>
|
|
12
13
|
type INITIALIZE_MULTIDASHBOARDS = Action<'INITIALIZE_MULTIDASHBOARDS', undefined>
|
|
13
14
|
type REMOVE_MULTIDASHBOARD_AT_INDEX = Action<'REMOVE_MULTIDASHBOARD_AT_INDEX', number>
|
|
@@ -15,6 +16,22 @@ type REORDER_MULTIDASHBOARDS = Action<'REORDER_MULTIDASHBOARDS', { currentIndex:
|
|
|
15
16
|
type ADD_NEW_DASHBOARD = Action<'ADD_NEW_DASHBOARD', undefined>
|
|
16
17
|
type SAVE_CURRENT_CHANGES = Action<'SAVE_CURRENT_CHANGES', undefined>
|
|
17
18
|
type SWITCH_CONFIG = Action<'SWITCH_CONFIG', number>
|
|
19
|
+
type TOGGLE_ROW = Action<'TOGGLE_ROW', { rowIndex: number; colIndex: number }>
|
|
18
20
|
|
|
19
|
-
type DashboardActions =
|
|
21
|
+
type DashboardActions =
|
|
22
|
+
| ADD_NEW_DASHBOARD
|
|
23
|
+
| SET_CONFIG
|
|
24
|
+
| UPDATE_CONFIG
|
|
25
|
+
| REMOVE_MULTIDASHBOARD_AT_INDEX
|
|
26
|
+
| RENAME_DASHBOARD_TAB
|
|
27
|
+
| REORDER_MULTIDASHBOARDS
|
|
28
|
+
| SAVE_CURRENT_CHANGES
|
|
29
|
+
| SET_DATA
|
|
30
|
+
| SET_LOADING
|
|
31
|
+
| SET_PREVIEW
|
|
32
|
+
| SET_FILTERED_DATA
|
|
33
|
+
| SET_TAB_SELECTED
|
|
34
|
+
| SWITCH_CONFIG
|
|
35
|
+
| INITIALIZE_MULTIDASHBOARDS
|
|
36
|
+
| TOGGLE_ROW
|
|
20
37
|
export default DashboardActions
|
|
@@ -3,6 +3,7 @@ import { getUpdateConfig } from '../helpers/getUpdateConfig'
|
|
|
3
3
|
import { MultiDashboardConfig } from '../types/MultiDashboard'
|
|
4
4
|
import DashboardActions from './dashboard.actions'
|
|
5
5
|
import { devToolsWrapper } from '@cdc/core/helpers/withDevTools'
|
|
6
|
+
import { Tab } from '../types/Tab'
|
|
6
7
|
|
|
7
8
|
const createBlankDashboard = () => ({
|
|
8
9
|
dashboard: {
|
|
@@ -24,7 +25,7 @@ export type DashboardState = {
|
|
|
24
25
|
filteredData: Object
|
|
25
26
|
loading: boolean
|
|
26
27
|
preview: boolean
|
|
27
|
-
tabSelected:
|
|
28
|
+
tabSelected: Tab
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
const reducer = (state: DashboardState, action: DashboardActions): DashboardState => {
|
|
@@ -103,6 +104,13 @@ const reducer = (state: DashboardState, action: DashboardActions): DashboardStat
|
|
|
103
104
|
const newConfigFields = state.config.multiDashboards[slot]
|
|
104
105
|
return { ...state, config: { ...state.config, ...newConfigFields, activeDashboard: slot } }
|
|
105
106
|
}
|
|
107
|
+
case 'TOGGLE_ROW': {
|
|
108
|
+
const { rowIndex, colIndex } = action.payload
|
|
109
|
+
const newRows = state.config.rows.map((row, index) => {
|
|
110
|
+
return index === rowIndex ? row.map((col, i) => ({ ...col, hide: i !== colIndex })) : row
|
|
111
|
+
})
|
|
112
|
+
return { ...state, config: { ...state.config, rows: newRows } }
|
|
113
|
+
}
|
|
106
114
|
default:
|
|
107
115
|
return state
|
|
108
116
|
}
|
package/src/types/ConfigRow.ts
CHANGED
package/src/types/DataSet.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export type DataSet = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
2
|
+
data: Object[]
|
|
3
|
+
dataDescription: {}
|
|
4
|
+
dataUrl: string
|
|
5
|
+
runtimeDataUrl: string
|
|
6
|
+
dataFileSourceType: string
|
|
7
|
+
formattedData: Object[]
|
|
8
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DashboardConfig } from './DashboardConfig'
|
|
2
|
+
import { Tab } from './Tab'
|
|
2
3
|
|
|
3
4
|
export type InitialState = {
|
|
4
5
|
config: DashboardConfig
|
|
@@ -6,5 +7,5 @@ export type InitialState = {
|
|
|
6
7
|
loading: boolean
|
|
7
8
|
filteredData: Object
|
|
8
9
|
preview: boolean
|
|
9
|
-
tabSelected:
|
|
10
|
+
tabSelected: Tab
|
|
10
11
|
}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { APIFilter } from './APIFilter'
|
|
2
2
|
export type SharedFilter = {
|
|
3
3
|
type?: 'urlfilter' | 'datafilter' | ''
|
|
4
|
-
fileName
|
|
4
|
+
fileName?: string
|
|
5
5
|
filterBy?: 'Query String' | 'File Name'
|
|
6
6
|
queryParameter?: string
|
|
7
|
-
|
|
7
|
+
setByQueryParameter?: string
|
|
8
|
+
active?: string | string[]
|
|
8
9
|
queuedActive?: string
|
|
9
10
|
usedBy?: string[]
|
|
10
11
|
parents?: string[]
|
|
12
|
+
pivot?: string
|
|
11
13
|
setBy?: string
|
|
14
|
+
selectLimit?: number
|
|
12
15
|
columnName?: string
|
|
13
16
|
resetLabel?: string
|
|
14
17
|
showDropdown?: boolean
|
package/src/types/Tab.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Tab = 'Dashboard Description' | 'Dashboard Filters' | 'Data Table Settings' | 'Dashboard Preview'
|