@cdc/core 4.24.9-1 → 4.24.10
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/assets/icon-combo-chart.svg +1 -0
- package/assets/icon-epi-chart.svg +27 -0
- package/components/BlurStrokeText.tsx +44 -0
- package/components/DataTable/DataTable.tsx +51 -35
- package/components/DataTable/DataTableStandAlone.tsx +37 -6
- package/components/DataTable/components/ChartHeader.tsx +31 -26
- package/components/DataTable/components/MapHeader.tsx +19 -10
- package/components/DataTable/components/SortIcon/index.tsx +25 -0
- package/components/DataTable/components/SortIcon/sort-icon.css +21 -0
- package/{styles/_data-table.scss → components/DataTable/data-table.css} +268 -298
- package/components/DataTable/helpers/customSort.ts +11 -15
- package/components/DataTable/helpers/getDataSeriesColumns.ts +5 -1
- package/components/DataTable/helpers/getNewSortBy.ts +35 -0
- package/components/DataTable/helpers/tests/customSort.test.ts +52 -0
- package/components/DataTable/helpers/tests/getNewSortBy.test.ts +26 -0
- package/components/EditorPanel/DataTableEditor.tsx +132 -26
- package/components/EditorPanel/Inputs.tsx +42 -4
- package/components/EditorPanel/VizFilterEditor/NestedDropdownEditor.tsx +25 -7
- package/components/EditorPanel/VizFilterEditor/VizFilterEditor.tsx +1 -1
- package/components/{Filters.tsx → Filters/Filters.tsx} +48 -39
- package/components/Filters/helpers/applyQueuedActive.ts +12 -0
- package/components/Filters/helpers/getNestedOptions.ts +29 -0
- package/components/Filters/helpers/handleSorting.ts +18 -0
- package/components/Filters/helpers/tests/applyQueuedActive.test.ts +49 -0
- package/components/Filters/helpers/tests/getNestedOptions.test.ts +93 -0
- package/components/Filters/helpers/tests/handleSorting.test.ts +68 -0
- package/components/Filters/index.ts +5 -0
- package/components/Layout/components/Sidebar/components/sidebar.styles.scss +1 -3
- package/components/Legend/Legend.Gradient.tsx +2 -9
- package/components/Loader/Loader.tsx +33 -0
- package/components/Loader/index.ts +1 -0
- package/components/Loader/loader.styles.css +13 -0
- package/components/NestedDropdown/NestedDropdown.tsx +90 -48
- package/components/NestedDropdown/nestedDropdownHelpers.ts +34 -0
- package/components/NestedDropdown/nesteddropdown.styles.css +7 -0
- package/components/NestedDropdown/tests/nestedDropdownHelpers.test.ts +58 -0
- package/components/Table/components/GroupRow.tsx +1 -1
- package/components/_stories/BlurStrokeTest.stories.tsx +27 -0
- package/components/_stories/NestedDropdown.stories.tsx +22 -46
- package/components/_stories/_mocks/nested-dropdown.json +30 -0
- package/components/_stories/styles.scss +0 -1
- package/components/ui/{Tooltip.jsx → Tooltip.tsx} +38 -14
- package/data/colorPalettes.js +107 -10
- package/dist/cove-main.css +6114 -0
- package/dist/cove-main.css.map +1 -0
- package/helpers/addValuesToFilters.ts +8 -3
- package/helpers/cove/number.js +46 -25
- package/helpers/coveUpdateWorker.ts +6 -7
- package/helpers/pivotData.ts +52 -11
- package/helpers/tests/gatherQueryParams.test.ts +13 -1
- package/helpers/tests/pivotData.test.ts +50 -0
- package/helpers/ver/4.24.10.ts +47 -0
- package/helpers/ver/4.24.9.ts +0 -3
- package/helpers/ver/tests/4.24.10.test.ts +45 -0
- package/helpers/viewports.ts +9 -0
- package/package.json +7 -3
- package/styles/_button-section.scss +4 -0
- package/styles/_global-variables.scss +19 -1
- package/styles/_global.scss +1 -8
- package/styles/_reset.scss +2 -15
- package/styles/base.scss +0 -1
- package/styles/cove-main.scss +6 -0
- package/styles/filters.scss +6 -4
- package/styles/v2/components/ui/tooltip.scss +42 -40
- package/styles/v2/layout/_component.scss +0 -6
- package/styles/v2/layout/index.scss +0 -1
- package/types/Axis.ts +2 -0
- package/types/General.ts +1 -0
- package/types/Table.ts +2 -1
- package/types/Visualization.ts +13 -1
- package/types/VizFilter.ts +2 -1
- package/components/DataTable/components/Icons.tsx +0 -10
- package/components/_stories/EditorPanel.stories.tsx +0 -54
- package/components/_stories/Layout.Debug.stories.tsx +0 -91
|
@@ -1,298 +1,268 @@
|
|
|
1
|
-
.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
border-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
user-select: none;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
border-right: 1px solid
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
background-
|
|
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
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
&:hover {
|
|
246
|
-
background:
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
button[disabled] {
|
|
272
|
-
background: $mediumGray;
|
|
273
|
-
opacity: 0.3;
|
|
274
|
-
cursor: default;
|
|
275
|
-
&:hover {
|
|
276
|
-
background: $mediumGray;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
.btn-download {
|
|
283
|
-
color: #fff;
|
|
284
|
-
float: right;
|
|
285
|
-
text-decoration: none;
|
|
286
|
-
transition: 0.3s all;
|
|
287
|
-
margin: 1em 0;
|
|
288
|
-
&:hover {
|
|
289
|
-
transition: 0.3s all;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
.cove,
|
|
293
|
-
.cdc-open-viz-module {
|
|
294
|
-
.download-links a:not(:last-child) {
|
|
295
|
-
margin-right: 10px;
|
|
296
|
-
display: inline-block;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
1
|
+
.table {
|
|
2
|
+
width: unset;
|
|
3
|
+
min-width: 100%;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.collapsed + .table-container {
|
|
7
|
+
border-bottom: none;
|
|
8
|
+
}
|
|
9
|
+
.table-container {
|
|
10
|
+
overflow-x: auto;
|
|
11
|
+
border-right: 1px solid var(--lightGray);
|
|
12
|
+
border-left: 1px solid var(--lightGray);
|
|
13
|
+
border-bottom: 1px solid var(--lightGray);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.cdc-open-viz-module div.data-table-heading {
|
|
17
|
+
position: relative;
|
|
18
|
+
background: rgba(0, 0, 0, 0.05);
|
|
19
|
+
padding: 0.5em 0.7em;
|
|
20
|
+
border: var(--lightGray) 1px solid;
|
|
21
|
+
|
|
22
|
+
svg {
|
|
23
|
+
position: absolute;
|
|
24
|
+
height: 100%;
|
|
25
|
+
width: 15px;
|
|
26
|
+
top: 0;
|
|
27
|
+
right: 1em;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&:focus {
|
|
31
|
+
z-index: 2;
|
|
32
|
+
position: relative;
|
|
33
|
+
}
|
|
34
|
+
@media (max-width: var(--breakpoint-sm)) {
|
|
35
|
+
font-size: var(--font-small) + 0.2em;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
table.horizontal {
|
|
40
|
+
th,
|
|
41
|
+
td {
|
|
42
|
+
min-width: 200px;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
table.data-table {
|
|
47
|
+
margin-bottom: 0;
|
|
48
|
+
background: #fff;
|
|
49
|
+
position: relative;
|
|
50
|
+
border: none;
|
|
51
|
+
border-collapse: collapse;
|
|
52
|
+
appearance: none;
|
|
53
|
+
table-layout: fixed;
|
|
54
|
+
* {
|
|
55
|
+
box-sizing: border-box;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
thead {
|
|
59
|
+
user-select: none;
|
|
60
|
+
-moz-user-select: none;
|
|
61
|
+
user-select: none;
|
|
62
|
+
|
|
63
|
+
button {
|
|
64
|
+
background: none;
|
|
65
|
+
font-size: initial;
|
|
66
|
+
color: #fff;
|
|
67
|
+
border: 0;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
tr {
|
|
71
|
+
background: none;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
thead {
|
|
75
|
+
color: #fff;
|
|
76
|
+
.resizer {
|
|
77
|
+
cursor: e-resize;
|
|
78
|
+
width: 10px;
|
|
79
|
+
position: absolute;
|
|
80
|
+
top: 0;
|
|
81
|
+
bottom: 0;
|
|
82
|
+
right: 0;
|
|
83
|
+
touch-action: none;
|
|
84
|
+
}
|
|
85
|
+
tr {
|
|
86
|
+
text-align: left;
|
|
87
|
+
}
|
|
88
|
+
th,
|
|
89
|
+
td {
|
|
90
|
+
padding: 0.5em 1.3em 0.5em 0.7em;
|
|
91
|
+
line-height: normal;
|
|
92
|
+
position: relative;
|
|
93
|
+
text-align: left;
|
|
94
|
+
border-right: 1px solid var(--lightGray) !important;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
th {
|
|
98
|
+
background-color: var(--primary);
|
|
99
|
+
background-repeat: no-repeat;
|
|
100
|
+
background-position: right 0.5em center;
|
|
101
|
+
background-size: 10px 5px;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
th:last-child,
|
|
105
|
+
td:last-child {
|
|
106
|
+
border-right: 0;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
tr {
|
|
111
|
+
&.row-group {
|
|
112
|
+
background-color: var(--tertiary) !important;
|
|
113
|
+
font-weight: bold;
|
|
114
|
+
}
|
|
115
|
+
border-bottom: solid 1px #e5e5e5;
|
|
116
|
+
min-width: 100%; /* Needed to fill content up*/
|
|
117
|
+
&:last-child {
|
|
118
|
+
border-bottom: 0;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
th,
|
|
123
|
+
td {
|
|
124
|
+
padding: 0.3em 0.7em;
|
|
125
|
+
border-right: 1px solid rgba(0, 0, 0, 0.1);
|
|
126
|
+
white-space: nowrap;
|
|
127
|
+
&:last-child {
|
|
128
|
+
border-right: 0 !important;
|
|
129
|
+
}
|
|
130
|
+
font-size: var(--font-size);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
td {
|
|
134
|
+
position: relative;
|
|
135
|
+
svg {
|
|
136
|
+
margin-left: 1rem;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
td a {
|
|
141
|
+
padding: 0.3em 0.7em;
|
|
142
|
+
position: absolute;
|
|
143
|
+
top: 0;
|
|
144
|
+
bottom: 0;
|
|
145
|
+
right: 0;
|
|
146
|
+
left: 0;
|
|
147
|
+
display: block;
|
|
148
|
+
color: inherit;
|
|
149
|
+
text-decoration: none;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
td span.table-link {
|
|
153
|
+
text-decoration: underline;
|
|
154
|
+
cursor: pointer;
|
|
155
|
+
color: #075290;
|
|
156
|
+
svg {
|
|
157
|
+
max-width: 13px;
|
|
158
|
+
vertical-align: baseline;
|
|
159
|
+
margin-left: 5px;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.boxplot-td {
|
|
164
|
+
table-layout: fixed;
|
|
165
|
+
width: 200;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.no-data {
|
|
170
|
+
position: relative;
|
|
171
|
+
.no-data-message {
|
|
172
|
+
background: rgba(255, 255, 255, 0.5);
|
|
173
|
+
top: 0;
|
|
174
|
+
left: 0;
|
|
175
|
+
right: 0;
|
|
176
|
+
bottom: 0;
|
|
177
|
+
position: absolute;
|
|
178
|
+
text-align: center;
|
|
179
|
+
display: flex;
|
|
180
|
+
align-items: center;
|
|
181
|
+
justify-content: center;
|
|
182
|
+
z-index: 7;
|
|
183
|
+
:is(h3) {
|
|
184
|
+
font-size: 1.3rem;
|
|
185
|
+
font-weight: 600;
|
|
186
|
+
margin-bottom: 0.3rem;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
tr:hover {
|
|
190
|
+
background: #fff;
|
|
191
|
+
}
|
|
192
|
+
th,
|
|
193
|
+
td {
|
|
194
|
+
width: 50%;
|
|
195
|
+
&::before {
|
|
196
|
+
content: '\00a0';
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.data-table-pagination {
|
|
202
|
+
margin: 1rem 0;
|
|
203
|
+
display: flex;
|
|
204
|
+
align-items: center;
|
|
205
|
+
ul {
|
|
206
|
+
list-style: none;
|
|
207
|
+
margin: 0 1rem 0 0;
|
|
208
|
+
display: flex;
|
|
209
|
+
li + li {
|
|
210
|
+
margin-left: 0.3rem;
|
|
211
|
+
}
|
|
212
|
+
button {
|
|
213
|
+
background: var(--mediumGray);
|
|
214
|
+
padding: 0.6rem 0.8rem;
|
|
215
|
+
&:hover {
|
|
216
|
+
background: lighten(var(--mediumGray), 5%);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
button.btn-next {
|
|
220
|
+
&::before {
|
|
221
|
+
content: ' ';
|
|
222
|
+
background-image: url(../assets/icon-caret-filled-up.svg);
|
|
223
|
+
background-size: 10px 5px;
|
|
224
|
+
width: 10px;
|
|
225
|
+
height: 5px;
|
|
226
|
+
display: block;
|
|
227
|
+
transform: rotate(90deg);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
button.btn-prev {
|
|
231
|
+
&::before {
|
|
232
|
+
content: ' ';
|
|
233
|
+
background-image: url(../assets/icon-caret-filled-up.svg);
|
|
234
|
+
background-size: 10px 5px;
|
|
235
|
+
width: 10px;
|
|
236
|
+
height: 5px;
|
|
237
|
+
display: block;
|
|
238
|
+
transform: rotate(-90deg);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
button[disabled] {
|
|
242
|
+
background: var(--mediumGray);
|
|
243
|
+
opacity: 0.3;
|
|
244
|
+
cursor: default;
|
|
245
|
+
&:hover {
|
|
246
|
+
background: var(--mediumGray);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.btn-download {
|
|
253
|
+
color: #fff;
|
|
254
|
+
float: right;
|
|
255
|
+
text-decoration: none;
|
|
256
|
+
transition: 0.3s all;
|
|
257
|
+
margin: 1em 0;
|
|
258
|
+
&:hover {
|
|
259
|
+
transition: 0.3s all;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
.cove,
|
|
263
|
+
.cdc-open-viz-module {
|
|
264
|
+
.download-links a:not(:last-child) {
|
|
265
|
+
margin-right: 10px;
|
|
266
|
+
display: inline-block;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
@@ -14,7 +14,7 @@ export const customSort = (a, b, sortBy, config) => {
|
|
|
14
14
|
const numberB = parseInt(b.match(/\d+$/)[0], 10)
|
|
15
15
|
|
|
16
16
|
// Compare the numeric parts
|
|
17
|
-
return
|
|
17
|
+
return sortBy.asc ? Number(numberA) - Number(numberB) : Number(numberB) - Number(numberA)
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -26,39 +26,35 @@ export const customSort = (a, b, sortBy, config) => {
|
|
|
26
26
|
const trimmedB = String(valueB).trim()
|
|
27
27
|
|
|
28
28
|
if (config.xAxis?.dataKey === sortBy.column && config.xAxis.type === 'date') {
|
|
29
|
-
|
|
29
|
+
const dateA = parseDate(config.xAxis.dateParseFormat, trimmedA)?.getTime()
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if (dateB && dateB.getTime) dateB = dateB.getTime()
|
|
36
|
-
|
|
37
|
-
return !sortBy.asc ? dateA - dateB : dateB - dateA
|
|
31
|
+
const dateB = parseDate(config.xAxis.dateParseFormat, trimmedB)?.getTime()
|
|
32
|
+
console.log(dateA, dateB)
|
|
33
|
+
return sortBy.asc ? dateA - dateB : dateB - dateA
|
|
38
34
|
}
|
|
39
35
|
// Check if values are numbers
|
|
40
36
|
const isNumA = !isNaN(Number(valueA)) && valueA !== undefined && valueA !== null && trimmedA !== ''
|
|
41
37
|
const isNumB = !isNaN(Number(valueB)) && valueB !== undefined && valueB !== null && trimmedB !== ''
|
|
42
38
|
|
|
43
39
|
// Handle empty strings or spaces
|
|
44
|
-
if (trimmedA === '' && trimmedB !== '') return
|
|
45
|
-
if (trimmedA !== '' && trimmedB === '') return
|
|
40
|
+
if (trimmedA === '' && trimmedB !== '') return sortBy.asc ? -1 : 1
|
|
41
|
+
if (trimmedA !== '' && trimmedB === '') return sortBy.asc ? 1 : -1
|
|
46
42
|
|
|
47
43
|
// Both are numbers: Compare numerically
|
|
48
44
|
if (isNumA && isNumB) {
|
|
49
|
-
return
|
|
45
|
+
return sortBy.asc ? Number(valueA) - Number(valueB) : Number(valueB) - Number(valueA)
|
|
50
46
|
}
|
|
51
47
|
|
|
52
48
|
// Only A is a number
|
|
53
49
|
if (isNumA) {
|
|
54
|
-
return
|
|
50
|
+
return sortBy.asc ? -1 : 1
|
|
55
51
|
}
|
|
56
52
|
|
|
57
53
|
// Only B is a number
|
|
58
54
|
if (isNumB) {
|
|
59
|
-
return
|
|
55
|
+
return sortBy.asc ? 1 : -1
|
|
60
56
|
}
|
|
61
57
|
|
|
62
58
|
// Neither are numbers: Compare as strings
|
|
63
|
-
return
|
|
59
|
+
return sortBy.asc ? trimmedA.localeCompare(trimmedB) : trimmedB.localeCompare(trimmedA)
|
|
64
60
|
}
|
|
@@ -56,6 +56,10 @@ export const getDataSeriesColumns = (config: TableConfig, isVertical: boolean, r
|
|
|
56
56
|
}
|
|
57
57
|
})
|
|
58
58
|
|
|
59
|
-
tmpSeriesColumns.sort((a, b) =>
|
|
59
|
+
tmpSeriesColumns.sort((a, b) => {
|
|
60
|
+
if (a === 'pivotColumn') return -1
|
|
61
|
+
if (b === 'pivotColumn') return 1
|
|
62
|
+
return columnOrderingHash[a] - columnOrderingHash[b]
|
|
63
|
+
})
|
|
60
64
|
return tmpSeriesColumns
|
|
61
65
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
type SortBy = {
|
|
2
|
+
asc: boolean
|
|
3
|
+
column?: string
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export const getNewSortBy = (
|
|
7
|
+
sortBy: SortBy,
|
|
8
|
+
column: string,
|
|
9
|
+
index: number
|
|
10
|
+
): { column: string; asc: boolean; colIndex: number } => {
|
|
11
|
+
let asc
|
|
12
|
+
let sortByCol = column
|
|
13
|
+
const ascending = sortBy.asc === true
|
|
14
|
+
const descending = sortBy.asc === false
|
|
15
|
+
const isInactive = sortBy.asc === undefined
|
|
16
|
+
const noColumnSelected = sortBy.column === undefined
|
|
17
|
+
if (noColumnSelected || sortBy.column !== column) {
|
|
18
|
+
// this is the first time a column is clicked
|
|
19
|
+
asc = true
|
|
20
|
+
} else {
|
|
21
|
+
// clicking the same column
|
|
22
|
+
if (descending) {
|
|
23
|
+
// reset
|
|
24
|
+
sortByCol = undefined
|
|
25
|
+
asc = undefined
|
|
26
|
+
}
|
|
27
|
+
if (isInactive) {
|
|
28
|
+
asc = true
|
|
29
|
+
}
|
|
30
|
+
if (ascending) {
|
|
31
|
+
asc = false
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return { column: sortByCol, asc, colIndex: index }
|
|
35
|
+
}
|