dce-reactkit 3.2.2-beta.35 → 3.2.2-beta.36

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dce-reactkit",
3
- "version": "3.2.2-beta.35",
3
+ "version": "3.2.2-beta.36",
4
4
  "description": "Shared components for Harvard DCE apps",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -69,7 +69,7 @@ const ButtonInputGroup: React.FC<Props> = (props) => {
69
69
 
70
70
  {/* Contents */}
71
71
  <span
72
- className="input-group-text flex-grow-1 rounded-right"
72
+ className="input-group-text flex-grow-1 rounded-right d-flex flex-wrap"
73
73
  style={{
74
74
  backgroundColor: 'white',
75
75
  borderTopLeftRadius: 0,
@@ -87,7 +87,7 @@ enum ActionType {
87
87
  // Toggle sort column param
88
88
  ToggleSortColumn = 'toggle-sort-column',
89
89
  // Toggle the visibility of a column
90
- ToggleColumnVisibility = 'toggle-column-visibility',
90
+ UpdateColumnVisibility = 'update-column-visibility',
91
91
  // Toggle the column visibility customization modal
92
92
  ToggleColVisCusModalVisibility = 'toggle-col-vis-cus-modal-visibility',
93
93
  }
@@ -102,9 +102,11 @@ type Action = (
102
102
  }
103
103
  | {
104
104
  // Action type
105
- type: ActionType.ToggleColumnVisibility,
106
- // Param for the column to toggle
105
+ type: ActionType.UpdateColumnVisibility,
106
+ // Param for the column to update
107
107
  param: string,
108
+ // If true, make the column visible
109
+ visible: boolean,
108
110
  }
109
111
  | {
110
112
  // Action type
@@ -145,9 +147,9 @@ const reducer = (state: State, action: Action): State => {
145
147
  sortType: SortType.Ascending,
146
148
  };
147
149
  }
148
- case ActionType.ToggleColumnVisibility: {
150
+ case ActionType.UpdateColumnVisibility: {
149
151
  const { columnVisibilityMap } = state;
150
- columnVisibilityMap[action.param] = !columnVisibilityMap[action.param];
152
+ columnVisibilityMap[action.param] = action.visible;
151
153
  return {
152
154
  ...state,
153
155
  columnVisibilityMap,
@@ -245,10 +247,11 @@ const IntelliTable: React.FC<Props> = (props) => {
245
247
  id={`IntelliTable-${id}-toggle-visibility-${column.param}`}
246
248
  className="mb-2"
247
249
  text={column.title}
248
- onChanged={() => {
250
+ onChanged={(checked) => {
249
251
  dispatch({
250
- type: ActionType.ToggleColumnVisibility,
252
+ type: ActionType.UpdateColumnVisibility,
251
253
  param: column.param,
254
+ visible: checked,
252
255
  });
253
256
  }}
254
257
  checked={columnVisibilityMap[column.param]}
@@ -360,6 +363,12 @@ const IntelliTable: React.FC<Props> = (props) => {
360
363
  const aVal = a[sortColumnParam];
361
364
  const bVal = b[sortColumnParam];
362
365
 
366
+ // Tiebreaker sort by timestamp, most recent first (used if tied)
367
+ const tiebreaker = (
368
+ (b.timestamp ?? 0)
369
+ - (a.timestamp ?? 0)
370
+ );
371
+
363
372
  // Auto-sort undefined and null to end of list
364
373
  if (
365
374
  (aVal === undefined || aVal === null)
@@ -371,7 +380,7 @@ const IntelliTable: React.FC<Props> = (props) => {
371
380
  && (bVal === undefined || bVal === null)
372
381
  ) {
373
382
  // Both undefined
374
- return 0;
383
+ return tiebreaker;
375
384
  }
376
385
  if (aVal === undefined || aVal === null) {
377
386
  // First was undefined
@@ -390,7 +399,7 @@ const IntelliTable: React.FC<Props> = (props) => {
390
399
  if (!aVal && bVal) {
391
400
  return (descending ? 1 : -1);
392
401
  }
393
- return 0;
402
+ return tiebreaker;
394
403
  }
395
404
  // > Number
396
405
  if (
@@ -411,7 +420,7 @@ const IntelliTable: React.FC<Props> = (props) => {
411
420
  if (aVal > bVal) {
412
421
  return (descending ? -1 : 1);
413
422
  }
414
- return 0;
423
+ return tiebreaker;
415
424
  }
416
425
  // > JSON
417
426
  if (paramType === ParamType.JSON) {
@@ -433,7 +442,7 @@ const IntelliTable: React.FC<Props> = (props) => {
433
442
  }
434
443
 
435
444
  // No sort
436
- return 0;
445
+ return tiebreaker;
437
446
  });
438
447
  }
439
448
 
@@ -727,7 +727,6 @@ const LogReviewer: React.FC<Props> = (props) => {
727
727
 
728
728
  // Check which year/month combos we need to load
729
729
  const toLoad = listMonthsToLoad(newDateFilterState);
730
- console.log('Filter update:', newDateFilterState, toLoad, logMap);
731
730
 
732
731
  // If nothing to load, finished
733
732
  if (toLoad.length === 0) {
@@ -1067,6 +1066,10 @@ const LogReviewer: React.FC<Props> = (props) => {
1067
1066
  checked={tagFilterState[tag]}
1068
1067
  onChanged={(checked) => {
1069
1068
  tagFilterState[tag] = checked;
1069
+ dispatch({
1070
+ type: ActionType.UpdateTagFilterState,
1071
+ tagFilterState,
1072
+ });
1070
1073
  }}
1071
1074
  />
1072
1075
  );
@@ -1143,6 +1146,7 @@ const LogReviewer: React.FC<Props> = (props) => {
1143
1146
  text={description}
1144
1147
  ariaLabel={`include logs with action type "${description}" in results`}
1145
1148
  noMarginOnRight={i === Object.keys(LogAction).length - 1}
1149
+ checked={actionErrorFilterState.action[action]}
1146
1150
  onChanged={(checked) => {
1147
1151
  actionErrorFilterState.action[action] = checked;
1148
1152
  dispatch({
@@ -1173,6 +1177,7 @@ const LogReviewer: React.FC<Props> = (props) => {
1173
1177
  id={`LogReviewer-target-${target}-checkbox`}
1174
1178
  text={description}
1175
1179
  ariaLabel={`include logs with target "${description}" in results`}
1180
+ checked={actionErrorFilterState.target[target]}
1176
1181
  onChanged={(checked) => {
1177
1182
  actionErrorFilterState.target[target] = checked;
1178
1183
  dispatch({