@cdc/core 4.23.11 → 4.24.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/components/DataTable/DataTable.tsx +39 -10
- package/components/DataTable/components/ChartHeader.tsx +17 -5
- package/components/DataTable/components/ExpandCollapse.tsx +1 -1
- package/components/DataTable/helpers/chartCellMatrix.tsx +16 -2
- package/components/DataTable/helpers/customColumns.ts +25 -0
- package/components/DataTable/helpers/customSort.ts +9 -0
- package/components/DataTable/helpers/getChartCellValue.ts +2 -1
- package/components/DataTable/helpers/getDataSeriesColumns.ts +2 -1
- package/components/DataTable/helpers/getSeriesName.ts +15 -20
- package/components/DataTable/helpers/mapCellMatrix.tsx +4 -0
- package/components/DataTable/types/TableConfig.ts +11 -40
- package/components/EditorPanel/DataTableEditor.tsx +133 -0
- package/components/EditorPanel/Inputs.tsx +150 -0
- package/components/Filters.jsx +17 -15
- package/components/MediaControls.jsx +1 -1
- package/components/MultiSelect/MultiSelect.tsx +95 -0
- package/components/MultiSelect/index.ts +1 -0
- package/components/MultiSelect/multiselect.styles.css +50 -0
- package/components/Table/Table.tsx +23 -3
- package/components/Table/components/Cell.tsx +3 -3
- package/components/Table/components/GroupRow.tsx +6 -2
- package/components/Table/components/Row.tsx +9 -2
- package/components/Table/types/RowType.ts +5 -0
- package/components/_stories/DataTable.stories.tsx +41 -0
- package/components/_stories/EditorPanel.stories.tsx +53 -0
- package/components/_stories/Inputs.stories.tsx +37 -0
- package/components/_stories/MultiSelect.stories.tsx +24 -0
- package/components/_stories/_mocks/row_type.json +42 -0
- package/components/inputs/{InputSelect.jsx → InputSelect.tsx} +15 -5
- package/components/managers/DataDesigner.tsx +8 -8
- package/components/ui/{Icon.jsx → Icon.tsx} +3 -3
- package/components/ui/_stories/Colors.stories.tsx +92 -0
- package/components/ui/_stories/Icon.stories.tsx +17 -10
- package/helpers/DataTransform.ts +30 -2
- package/helpers/fetchRemoteData.js +5 -5
- package/helpers/getFileExtension.ts +28 -5
- package/helpers/getViewport.ts +23 -0
- package/helpers/isSolr.js +13 -0
- package/helpers/withDevTools.ts +50 -0
- package/package.json +2 -2
- package/styles/_data-table.scss +2 -5
- package/styles/_global-variables.scss +75 -0
- package/styles/base.scss +89 -69
- package/types/Action.ts +1 -0
- package/types/Axis.ts +39 -2
- package/types/BoxPlot.ts +21 -0
- package/types/Column.ts +16 -0
- package/types/FilterBehavior.ts +1 -0
- package/types/General.ts +9 -0
- package/types/Runtime.ts +21 -1
- package/types/Series.ts +1 -1
- package/types/Table.ts +21 -0
- package/types/UpdateFieldFunc.ts +1 -0
- package/types/ViewPort.ts +2 -0
- package/types/Visualization.ts +15 -9
- package/types/WCMSProps.ts +11 -0
- package/helpers/getViewport.js +0 -21
package/styles/base.scss
CHANGED
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
// Imports
|
|
52
52
|
@import 'reset';
|
|
53
53
|
@import 'variables';
|
|
54
|
+
@import 'global-variables';
|
|
54
55
|
@import 'mixins';
|
|
55
56
|
@import 'filters';
|
|
56
57
|
|
|
@@ -58,6 +59,10 @@ body.post-type-cdc_visualization .visx-tooltip {
|
|
|
58
59
|
z-index: 1000000;
|
|
59
60
|
}
|
|
60
61
|
|
|
62
|
+
body.post-type-cdc_visualization .cdc-editor .configure .editor-panel {
|
|
63
|
+
top: 0 !important;
|
|
64
|
+
}
|
|
65
|
+
|
|
61
66
|
.cdc-open-viz-module {
|
|
62
67
|
position: relative;
|
|
63
68
|
color: $baseColor;
|
|
@@ -71,73 +76,88 @@ body.post-type-cdc_visualization .visx-tooltip {
|
|
|
71
76
|
@import 'button-section';
|
|
72
77
|
@import 'series-list';
|
|
73
78
|
@import 'typography';
|
|
74
|
-
}
|
|
75
79
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
'
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
'
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
'
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
'
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
'
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
'
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
'
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
'
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
'
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
80
|
+
.editor-panel.cove {
|
|
81
|
+
position: absolute;
|
|
82
|
+
height: 100vh;
|
|
83
|
+
top: 0;
|
|
84
|
+
.editor-toggle {
|
|
85
|
+
position: absolute !important;
|
|
86
|
+
top: 10px !important;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.editor-panel {
|
|
90
|
+
position: absolute !important;
|
|
91
|
+
top: 0 !important;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
$theme: (
|
|
96
|
+
'amber': (
|
|
97
|
+
'#fbab18',
|
|
98
|
+
'#ffd54f',
|
|
99
|
+
'#ffecb3',
|
|
100
|
+
'#fff7e1'
|
|
101
|
+
),
|
|
102
|
+
'blue': (
|
|
103
|
+
'#005eaa',
|
|
104
|
+
'#88c3ea',
|
|
105
|
+
'#c0e9ff',
|
|
106
|
+
'#edf9ff'
|
|
107
|
+
),
|
|
108
|
+
'brown': (
|
|
109
|
+
'#705043',
|
|
110
|
+
'#ad907b',
|
|
111
|
+
'#d7ccc8',
|
|
112
|
+
'#f2ebe8'
|
|
113
|
+
),
|
|
114
|
+
'cyan': (
|
|
115
|
+
'#006778',
|
|
116
|
+
'#65b0bd',
|
|
117
|
+
'#cce5e9',
|
|
118
|
+
'#ebf5f6'
|
|
119
|
+
),
|
|
120
|
+
'green': (
|
|
121
|
+
'#4b830d',
|
|
122
|
+
'#84bc49',
|
|
123
|
+
'#dcedc8',
|
|
124
|
+
'#f1f8e9'
|
|
125
|
+
),
|
|
126
|
+
'indigo': (
|
|
127
|
+
'#26418f',
|
|
128
|
+
'#92a6dd',
|
|
129
|
+
'#dee8ff',
|
|
130
|
+
'#f2f6ff'
|
|
131
|
+
),
|
|
132
|
+
'orange': (
|
|
133
|
+
'#bb4d00',
|
|
134
|
+
'#ffad42',
|
|
135
|
+
'#ffe97d',
|
|
136
|
+
'#fff4cf'
|
|
137
|
+
),
|
|
138
|
+
'pink': (
|
|
139
|
+
'#af4448',
|
|
140
|
+
'#e57373',
|
|
141
|
+
'#ffc2c2',
|
|
142
|
+
'#ffe7e7'
|
|
143
|
+
),
|
|
144
|
+
'purple': (
|
|
145
|
+
'#712177',
|
|
146
|
+
'#b890bb',
|
|
147
|
+
'#e3d3e4',
|
|
148
|
+
'#f7f2f7'
|
|
149
|
+
),
|
|
150
|
+
'slate': (
|
|
151
|
+
'#29434e',
|
|
152
|
+
'#7e9ba5',
|
|
153
|
+
'#b6c6d2',
|
|
154
|
+
'#e2e8ed'
|
|
155
|
+
),
|
|
156
|
+
'teal': (
|
|
157
|
+
'#00695c',
|
|
158
|
+
'#4ebaaa',
|
|
159
|
+
'#ceece7',
|
|
160
|
+
'#ebf7f5'
|
|
161
|
+
)
|
|
162
|
+
);
|
|
163
|
+
}
|
package/types/Action.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Action<T, P> = { type: T; payload?: P }
|
package/types/Axis.ts
CHANGED
|
@@ -1,6 +1,43 @@
|
|
|
1
|
+
export type Anchor = {
|
|
2
|
+
value: string
|
|
3
|
+
color: string
|
|
4
|
+
lineStyle: string
|
|
5
|
+
}
|
|
6
|
+
|
|
1
7
|
export type Axis = {
|
|
8
|
+
scalePadding: number
|
|
9
|
+
anchors?: Anchor[]
|
|
2
10
|
dataKey: string
|
|
3
|
-
type: string
|
|
4
|
-
dateParseFormat: string
|
|
5
11
|
dateDisplayFormat: string
|
|
12
|
+
dateParseFormat: string
|
|
13
|
+
displayNumbersOnBar?: boolean
|
|
14
|
+
enablePadding?: boolean
|
|
15
|
+
gridLines?: boolean
|
|
16
|
+
hideAxis?: boolean
|
|
17
|
+
hideLabel?: boolean
|
|
18
|
+
hideTicks?: boolean
|
|
19
|
+
label?: string
|
|
20
|
+
labelOffset?: number
|
|
21
|
+
labelPlacement?: string
|
|
22
|
+
max?: string
|
|
23
|
+
maxTickRotation?: number
|
|
24
|
+
min?: string
|
|
25
|
+
numTicks?: number
|
|
26
|
+
rightAxisSize?: number
|
|
27
|
+
rightHideAxis?: boolean
|
|
28
|
+
rightHideLabel?: boolean
|
|
29
|
+
rightHideTicks?: boolean
|
|
30
|
+
rightLabel?: string
|
|
31
|
+
rightLabelOffsetSize?: number
|
|
32
|
+
rightMax?: string
|
|
33
|
+
rightNumTicks?: number
|
|
34
|
+
sortDates?: boolean
|
|
35
|
+
sortKey?: string
|
|
36
|
+
showTargetLabel?: boolean
|
|
37
|
+
size?: number
|
|
38
|
+
target?: number
|
|
39
|
+
targetLabel?: string
|
|
40
|
+
tickRotation?: number
|
|
41
|
+
tickWidthMax?: number
|
|
42
|
+
type: string
|
|
6
43
|
}
|
package/types/BoxPlot.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type BoxPlot = {
|
|
2
|
+
tableData: Object[]
|
|
3
|
+
labels: {
|
|
4
|
+
mean: string
|
|
5
|
+
maximum: string
|
|
6
|
+
minimum: string
|
|
7
|
+
iqr: string
|
|
8
|
+
median: string
|
|
9
|
+
q1: string
|
|
10
|
+
q3: string
|
|
11
|
+
outliers: string
|
|
12
|
+
values: string
|
|
13
|
+
total: string
|
|
14
|
+
lowerBounds: string
|
|
15
|
+
upperBounds: string
|
|
16
|
+
}
|
|
17
|
+
plots: []
|
|
18
|
+
categories: string[]
|
|
19
|
+
firstQuartilePercentage: number
|
|
20
|
+
geoType: string
|
|
21
|
+
}
|
package/types/Column.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type Column = {
|
|
2
|
+
name?: string
|
|
3
|
+
label: string
|
|
4
|
+
prefix: string
|
|
5
|
+
suffix: string
|
|
6
|
+
roundToPlace: number
|
|
7
|
+
commas: boolean
|
|
8
|
+
dataTable: boolean
|
|
9
|
+
showInViz: boolean
|
|
10
|
+
startingPoint: string
|
|
11
|
+
series?: string
|
|
12
|
+
tooltips: boolean
|
|
13
|
+
forestPlot: boolean
|
|
14
|
+
forestPlotAlignRight: boolean
|
|
15
|
+
forestPlotStartingPoint: number
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type FilterBehavior = 'Apply Button' | 'Filter Change'
|
package/types/General.ts
ADDED
package/types/Runtime.ts
CHANGED
|
@@ -1,9 +1,29 @@
|
|
|
1
|
+
import { Axis } from './Axis'
|
|
2
|
+
|
|
3
|
+
export type ForecastingSeriesKey = {
|
|
4
|
+
stages: {
|
|
5
|
+
key: string
|
|
6
|
+
color: string
|
|
7
|
+
}[]
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type BarSeriesKey = {
|
|
11
|
+
key: string
|
|
12
|
+
color: string
|
|
13
|
+
}
|
|
14
|
+
|
|
1
15
|
export type Runtime = {
|
|
16
|
+
barSeriesKeys?: BarSeriesKey[]
|
|
17
|
+
forecastingSeriesKeys?: ForecastingSeriesKey[]
|
|
2
18
|
originalXAxis: {
|
|
3
19
|
dataKey: string
|
|
4
20
|
name: string
|
|
5
21
|
axis: string
|
|
6
22
|
}
|
|
7
|
-
|
|
23
|
+
xAxis: Axis
|
|
24
|
+
yAxis: Axis
|
|
25
|
+
seriesKeys: any[]
|
|
26
|
+
seriesLabels: Record<string, any>
|
|
27
|
+
seriesLabelsAll: string[]
|
|
8
28
|
editorErrorMessage: string
|
|
9
29
|
}
|
package/types/Series.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export type Series = { dataKey: string; name: string; axis: string }[]
|
|
1
|
+
export type Series = { dataKey: string; name: string; axis: string; type: string }[]
|
package/types/Table.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type Table = {
|
|
2
|
+
cellMinWidth?: number
|
|
3
|
+
label?: string
|
|
4
|
+
show?: boolean
|
|
5
|
+
showVertical?: boolean
|
|
6
|
+
indexLabel?: string
|
|
7
|
+
caption?: string
|
|
8
|
+
limitHeight?: boolean
|
|
9
|
+
height?: number
|
|
10
|
+
expanded?: boolean
|
|
11
|
+
showDataTableLink?: boolean
|
|
12
|
+
showDownloadUrl?: boolean
|
|
13
|
+
download?: boolean
|
|
14
|
+
customTableConfig?: boolean
|
|
15
|
+
excludeColumns?: string[]
|
|
16
|
+
showDownloadImgButton?: boolean
|
|
17
|
+
showDownloadPdfButton?: boolean
|
|
18
|
+
downloadImageButton?: boolean
|
|
19
|
+
downloadPdfButton?: boolean
|
|
20
|
+
dateDisplayFormat: string
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type UpdateFieldFunc<T> = (section: string | null, subsection: string | null, fieldName: string, value: T) => void
|
package/types/Visualization.ts
CHANGED
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
export type Visualization = {
|
|
2
|
-
|
|
3
|
-
dataKey: string
|
|
4
|
-
formattedData: any
|
|
5
|
-
dataDescription: Object
|
|
2
|
+
autoLoad: boolean
|
|
6
3
|
data: any
|
|
7
|
-
|
|
4
|
+
dataDescription: Object
|
|
5
|
+
dataFileName: string
|
|
6
|
+
dataFileSourceType: string
|
|
7
|
+
dataKey: string
|
|
8
|
+
datasets: Record<string, any>
|
|
8
9
|
editing: boolean
|
|
9
|
-
|
|
10
|
+
formattedData?: Object[]
|
|
11
|
+
general: any
|
|
12
|
+
hide: any[]
|
|
13
|
+
multiDashboards?: any[]
|
|
10
14
|
newViz: boolean
|
|
11
15
|
openModal: boolean
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
originalFormattedData: any
|
|
17
|
+
orientation: 'vertical' | 'horizontal'
|
|
14
18
|
table: {
|
|
15
19
|
showDataTableLink: boolean
|
|
16
20
|
}
|
|
17
|
-
general: any
|
|
18
21
|
title: string
|
|
22
|
+
type: 'dashboard' | 'chart' | 'map' | 'data-bite' | 'waffle-chart' | 'markup-include' | 'filtered-text' | 'filter-dropdowns'
|
|
19
23
|
uid: string
|
|
20
24
|
usesSharedFilter: any
|
|
25
|
+
visualizationType: string
|
|
26
|
+
visualizationSubType: string
|
|
21
27
|
}
|
package/helpers/getViewport.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export default function getViewport(size) {
|
|
2
|
-
let result = 'lg'
|
|
3
|
-
|
|
4
|
-
const viewports = {
|
|
5
|
-
lg: 1200,
|
|
6
|
-
md: 992,
|
|
7
|
-
sm: 768,
|
|
8
|
-
xs: 576,
|
|
9
|
-
xxs: 350
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
if (size > 1200) return result
|
|
13
|
-
|
|
14
|
-
for (let viewport in viewports) {
|
|
15
|
-
if (size <= viewports[viewport]) {
|
|
16
|
-
result = viewport
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return result
|
|
21
|
-
}
|