@cdc/core 4.25.1 → 4.25.3-6
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 +44 -13
- package/components/DataTable/components/ChartHeader.tsx +25 -6
- package/components/DataTable/components/MapHeader.tsx +5 -1
- package/components/DataTable/data-table.css +1 -1
- package/components/DataTable/helpers/chartCellMatrix.tsx +14 -5
- package/components/EditorPanel/Inputs.tsx +4 -0
- package/components/EditorPanel/VizFilterEditor/VizFilterEditor.tsx +1 -1
- package/components/Filters/Filters.tsx +55 -17
- package/components/Filters/helpers/filterWrapping.ts +43 -0
- package/components/Filters/helpers/handleSorting.ts +1 -0
- package/components/Filters/helpers/tests/handleSorting.test.ts +26 -0
- package/components/NestedDropdown/NestedDropdown.tsx +23 -6
- package/components/NestedDropdown/nesteddropdown.styles.css +10 -6
- package/components/Table/Table.tsx +11 -5
- package/components/Table/components/Row.tsx +14 -2
- package/dist/cove-main.css +183 -132
- package/dist/cove-main.css.map +1 -1
- package/helpers/DataTransform.ts +11 -9
- package/helpers/formatConfigBeforeSave.ts +1 -1
- package/helpers/isRightAlignedTableValue.js +14 -0
- package/helpers/queryStringUtils.ts +7 -0
- package/helpers/ver/4.24.7.ts +19 -1
- package/package.json +2 -2
- package/styles/filters.scss +60 -0
- package/styles/v2/themes/_color-definitions.scss +4 -4
- package/types/VizFilter.ts +1 -0
|
@@ -29,11 +29,14 @@
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
[class^='main-nested-dropdown-container-'] {
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
[class^='main-nested-dropdown-container-'],
|
|
33
37
|
.nested-dropdown-input-container {
|
|
34
38
|
border: 1px solid var(--cool-gray-10);
|
|
35
39
|
min-width: 200px;
|
|
36
|
-
cursor: pointer;
|
|
37
40
|
padding: 0.4rem 0.75rem;
|
|
38
41
|
font-size: 1em;
|
|
39
42
|
}
|
|
@@ -57,14 +60,15 @@
|
|
|
57
60
|
|
|
58
61
|
.nested-dropdown-input-container {
|
|
59
62
|
display: block;
|
|
60
|
-
width: 100
|
|
63
|
+
width: calc(100% + 7px);
|
|
61
64
|
border-radius: 0.25rem;
|
|
62
65
|
position: relative;
|
|
63
66
|
& > span.list-arrow {
|
|
64
67
|
position: absolute;
|
|
65
68
|
top: 9px;
|
|
66
|
-
right:
|
|
69
|
+
right: 9px;
|
|
67
70
|
float: right;
|
|
71
|
+
pointer-events: none;
|
|
68
72
|
}
|
|
69
73
|
|
|
70
74
|
&.disabled {
|
|
@@ -75,9 +79,9 @@
|
|
|
75
79
|
}
|
|
76
80
|
}
|
|
77
81
|
|
|
78
|
-
&
|
|
82
|
+
& [class^='main-nested-dropdown-container-'] {
|
|
79
83
|
max-height: 375px;
|
|
80
|
-
overflow-y:
|
|
84
|
+
overflow-y: auto;
|
|
81
85
|
position: absolute;
|
|
82
86
|
z-index: 3;
|
|
83
87
|
min-width: 200px;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ReactNode } from 'react'
|
|
2
2
|
import Row from './components/Row'
|
|
3
3
|
import GroupRow from './components/GroupRow'
|
|
4
|
-
import { CellMatrix
|
|
4
|
+
import { CellMatrix } from './types/CellMatrix'
|
|
5
5
|
import { RowType } from './types/RowType'
|
|
6
6
|
import { PreliminaryDataItem } from '@cdc/chart/src/types/ChartConfig'
|
|
7
7
|
import _ from 'lodash'
|
|
8
8
|
|
|
9
9
|
type TableProps = {
|
|
10
|
-
childrenMatrix: CellMatrix |
|
|
10
|
+
childrenMatrix: CellMatrix | Map<string, CellMatrix>
|
|
11
11
|
noData?: boolean
|
|
12
12
|
tableName: string
|
|
13
13
|
caption: string
|
|
@@ -24,6 +24,7 @@ type TableProps = {
|
|
|
24
24
|
hasRowType?: boolean // if it has row type then the first column is the row type which will explain how to render the row
|
|
25
25
|
viewport: 'lg' | 'md' | 'sm' | 'xs' | 'xxs'
|
|
26
26
|
preliminaryData?: PreliminaryDataItem[]
|
|
27
|
+
rightAlignedCols: object
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
type Position = 'sticky'
|
|
@@ -39,7 +40,8 @@ const Table = ({
|
|
|
39
40
|
wrapColumns,
|
|
40
41
|
hasRowType,
|
|
41
42
|
viewport,
|
|
42
|
-
preliminaryData
|
|
43
|
+
preliminaryData,
|
|
44
|
+
rightAlignedCols
|
|
43
45
|
}: TableProps) => {
|
|
44
46
|
const headStyle = stickyHeader ? { position: 'sticky' as Position, top: 0, zIndex: 2 } : {}
|
|
45
47
|
const isGroupedMatrix = !Array.isArray(childrenMatrix)
|
|
@@ -56,9 +58,9 @@ const Table = ({
|
|
|
56
58
|
<thead style={headStyle}>{headContent}</thead>
|
|
57
59
|
<tbody>
|
|
58
60
|
{isGroupedMatrix
|
|
59
|
-
?
|
|
61
|
+
? Array.from(childrenMatrix.keys()).flatMap(groupName => {
|
|
60
62
|
let colSpan = 0
|
|
61
|
-
const rows = childrenMatrix
|
|
63
|
+
const rows = childrenMatrix.get(groupName).map((row, i) => {
|
|
62
64
|
colSpan = row.length
|
|
63
65
|
const key = `${tableName}-${groupName}-row-${i}`
|
|
64
66
|
return (
|
|
@@ -70,6 +72,7 @@ const Table = ({
|
|
|
70
72
|
wrapColumns={wrapColumns}
|
|
71
73
|
cellMinWidth={tableOptions.cellMinWidth}
|
|
72
74
|
viewport={viewport}
|
|
75
|
+
rightAlignedCols={rightAlignedCols}
|
|
73
76
|
/>
|
|
74
77
|
)
|
|
75
78
|
})
|
|
@@ -90,6 +93,7 @@ const Table = ({
|
|
|
90
93
|
wrapColumns={wrapColumns}
|
|
91
94
|
cellMinWidth={tableOptions.cellMinWidth}
|
|
92
95
|
viewport={viewport}
|
|
96
|
+
rightAlignedCols={rightAlignedCols}
|
|
93
97
|
/>
|
|
94
98
|
)
|
|
95
99
|
} else {
|
|
@@ -107,6 +111,7 @@ const Table = ({
|
|
|
107
111
|
wrapColumns={wrapColumns}
|
|
108
112
|
cellMinWidth={tableOptions.cellMinWidth}
|
|
109
113
|
viewport={viewport}
|
|
114
|
+
rightAlignedCols={rightAlignedCols}
|
|
110
115
|
/>
|
|
111
116
|
)
|
|
112
117
|
case RowType.row_group_total:
|
|
@@ -121,6 +126,7 @@ const Table = ({
|
|
|
121
126
|
wrapColumns={wrapColumns}
|
|
122
127
|
cellMinWidth={tableOptions.cellMinWidth}
|
|
123
128
|
viewport={viewport}
|
|
129
|
+
rightAlignedCols={rightAlignedCols}
|
|
124
130
|
/>
|
|
125
131
|
)
|
|
126
132
|
}
|
|
@@ -11,10 +11,20 @@ type RowProps = {
|
|
|
11
11
|
viewport: 'lg' | 'md' | 'sm' | 'xs' | 'xxs'
|
|
12
12
|
style?: object
|
|
13
13
|
preliminaryData?: PreliminaryDataItem[]
|
|
14
|
+
rightAlignedCols: object
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
const Row: FC<RowProps> = props => {
|
|
17
|
-
const {
|
|
18
|
+
const {
|
|
19
|
+
childRow,
|
|
20
|
+
rowKey,
|
|
21
|
+
wrapColumns,
|
|
22
|
+
cellMinWidth = 0,
|
|
23
|
+
isTotal,
|
|
24
|
+
viewport,
|
|
25
|
+
preliminaryData,
|
|
26
|
+
rightAlignedCols
|
|
27
|
+
} = props
|
|
18
28
|
const whiteSpace = wrapColumns ? 'unset' : 'nowrap'
|
|
19
29
|
const minWidth = cellMinWidth + 'px'
|
|
20
30
|
|
|
@@ -27,11 +37,13 @@ const Row: FC<RowProps> = props => {
|
|
|
27
37
|
) && { color: '#777772' }) ||
|
|
28
38
|
{}
|
|
29
39
|
|
|
40
|
+
const textAlign = rightAlignedCols && rightAlignedCols[i] ? 'right' : ''
|
|
41
|
+
|
|
30
42
|
return (
|
|
31
43
|
<Cell
|
|
32
44
|
ariaLabel={style?.color ? 'suppressed data' : ''}
|
|
33
45
|
key={rowKey + '__' + i}
|
|
34
|
-
style={{ whiteSpace, minWidth, ...style }}
|
|
46
|
+
style={{ whiteSpace, minWidth, textAlign, ...style }}
|
|
35
47
|
isBold={isTotal}
|
|
36
48
|
>
|
|
37
49
|
{child}
|