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

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.33",
3
+ "version": "3.2.2-beta.35",
4
4
  "description": "Shared components for Harvard DCE apps",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -84,8 +84,8 @@ const CSVDownloadButton: React.FC<Props> = (props) => {
84
84
  <>
85
85
  <FontAwesomeIcon
86
86
  icon={faCloudDownloadAlt}
87
- className="mr-2"
88
87
  />
88
+ {' '}
89
89
  Download CSV
90
90
  </>
91
91
  )}
@@ -30,6 +30,7 @@ import Modal from './Modal';
30
30
  import ModalType from '../types/ModalType';
31
31
  import CheckboxButton from './CheckboxButton';
32
32
  import CSVDownloadButton from './CSVDownloadButton';
33
+ import Variant from '../types/Variant';
33
34
 
34
35
  /*------------------------------------------------------------------------*/
35
36
  /* Types */
@@ -234,6 +235,7 @@ const IntelliTable: React.FC<Props> = (props) => {
234
235
  type: ActionType.ToggleColVisCusModalVisibility,
235
236
  });
236
237
  }}
238
+ okayVariant={Variant.Light}
237
239
  >
238
240
  {
239
241
  columns.map((column) => {
@@ -241,6 +243,7 @@ const IntelliTable: React.FC<Props> = (props) => {
241
243
  <CheckboxButton
242
244
  key={column.param}
243
245
  id={`IntelliTable-${id}-toggle-visibility-${column.param}`}
246
+ className="mb-2"
244
247
  text={column.title}
245
248
  onChanged={() => {
246
249
  dispatch({
@@ -250,6 +253,8 @@ const IntelliTable: React.FC<Props> = (props) => {
250
253
  }}
251
254
  checked={columnVisibilityMap[column.param]}
252
255
  ariaLabel={`show "${column.title}" column`}
256
+ checkedVariant={Variant.Light}
257
+ uncheckedVariant={Variant.Secondary}
253
258
  />
254
259
  );
255
260
  })
@@ -302,8 +307,12 @@ const IntelliTable: React.FC<Props> = (props) => {
302
307
  scope="col"
303
308
  id={`IntelliTable-${id}-header-${column.param}`}
304
309
  className="text-start"
310
+ style={{
311
+ borderRight: '0.05rem solid #555',
312
+ borderLeft: '0.05rem solid #555',
313
+ }}
305
314
  >
306
- <div className="d-flex align-items-center justify-content-center flex-row h-100">
315
+ <div className="d-flex align-items-center justify-content-start flex-row h-100">
307
316
  {/* Title */}
308
317
  <span className="text-nowrap">
309
318
  {column.title}
@@ -351,6 +360,27 @@ const IntelliTable: React.FC<Props> = (props) => {
351
360
  const aVal = a[sortColumnParam];
352
361
  const bVal = b[sortColumnParam];
353
362
 
363
+ // Auto-sort undefined and null to end of list
364
+ if (
365
+ (aVal === undefined || aVal === null)
366
+ || (bVal === undefined || bVal === null)
367
+ ) {
368
+ // At least one was undefined
369
+ if (
370
+ (aVal === undefined || aVal === null)
371
+ && (bVal === undefined || bVal === null)
372
+ ) {
373
+ // Both undefined
374
+ return 0;
375
+ }
376
+ if (aVal === undefined || aVal === null) {
377
+ // First was undefined
378
+ return 1;
379
+ }
380
+ // Second was undefined
381
+ return -1;
382
+ }
383
+
354
384
  // Sort differently based on the data type
355
385
  // > Boolean
356
386
  if (paramType === ParamType.Boolean) {
@@ -376,10 +406,10 @@ const IntelliTable: React.FC<Props> = (props) => {
376
406
  // > String
377
407
  if (paramType === ParamType.String) {
378
408
  if (aVal < bVal) {
379
- return (descending ? -1 : 1);
409
+ return (descending ? 1 : -1);
380
410
  }
381
411
  if (aVal > bVal) {
382
- return (descending ? 1 : -1);
412
+ return (descending ? -1 : 1);
383
413
  }
384
414
  return 0;
385
415
  }
@@ -473,7 +503,11 @@ const IntelliTable: React.FC<Props> = (props) => {
473
503
  title = String(fullValue);
474
504
  } else if (column.type === ParamType.String) {
475
505
  fullValue = String(value).trim();
476
- const noValue = (String(fullValue).trim().length === 0);
506
+ const noValue = (
507
+ value === undefined
508
+ || value === null
509
+ || String(fullValue).trim().length === 0
510
+ );
477
511
  visibleValue = (
478
512
  noValue
479
513
  ? (
@@ -507,6 +541,10 @@ const IntelliTable: React.FC<Props> = (props) => {
507
541
  <td
508
542
  key={`${datum.id}-${column.param}`}
509
543
  title={title}
544
+ style={{
545
+ borderRight: '0.05rem solid #555',
546
+ borderLeft: '0.05rem solid #555',
547
+ }}
510
548
  >
511
549
  {visibleValue}
512
550
  </td>
@@ -553,8 +591,10 @@ const IntelliTable: React.FC<Props> = (props) => {
553
591
  // Build main UI
554
592
  return (
555
593
  <div className={`IntelliTable-container-${id}`}>
594
+ {/* Modal */}
595
+ {modal}
556
596
  {/* Header */}
557
- <div className="d-flex align-items-center justify-content-center">
597
+ <div className="d-flex align-items-center justify-content-start">
558
598
  {/* Title */}
559
599
  <h3 className="m-0">
560
600
  {title}
@@ -595,7 +635,7 @@ const IntelliTable: React.FC<Props> = (props) => {
595
635
  </div>
596
636
  {/* Table */}
597
637
  <div
598
- className={`IntelliTable-table-${id}`}
638
+ className={`IntelliTable-table-${id} mt-2`}
599
639
  style={{
600
640
  overflowX: 'auto',
601
641
  }}
@@ -592,8 +592,8 @@ const LogReviewer: React.FC<Props> = (props) => {
592
592
 
593
593
  // Create initial tag filter state
594
594
  const initTagFilterState: TagFilterState = {};
595
- Object.values(LogMetadata.Tag ?? {}).forEach((tagValue) => {
596
- initTagFilterState[tagValue] = false;
595
+ Object.keys(LogMetadata.Tag ?? {}).forEach((tag) => {
596
+ initTagFilterState[tag] = false;
597
597
  });
598
598
 
599
599
  // Create advanced filter state
@@ -1055,7 +1055,7 @@ const LogReviewer: React.FC<Props> = (props) => {
1055
1055
  filterDrawer = (
1056
1056
  <TabBox title="Tags">
1057
1057
  {
1058
- Object.keys(tagFilterState)
1058
+ Object.keys(LogMetadata.Tag ?? {})
1059
1059
  .map((tag, i) => {
1060
1060
  const description = genHumanReadableName(tag);
1061
1061
  return (
@@ -1966,13 +1966,13 @@ const LogReviewer: React.FC<Props> = (props) => {
1966
1966
  type: ParamType.Boolean,
1967
1967
  },
1968
1968
  {
1969
- title: 'Teaching Staff',
1969
+ title: 'Teaching Staff?',
1970
1970
  param: 'isTTM',
1971
1971
  type: ParamType.Boolean,
1972
1972
  startsHidden: true,
1973
1973
  },
1974
1974
  {
1975
- title: 'Admin',
1975
+ title: 'Admin?',
1976
1976
  param: 'isAdmin',
1977
1977
  type: ParamType.Boolean,
1978
1978
  startsHidden: true,
@@ -2007,7 +2007,7 @@ const LogReviewer: React.FC<Props> = (props) => {
2007
2007
  startsHidden: true,
2008
2008
  },
2009
2009
  {
2010
- title: 'Mobile',
2010
+ title: 'Mobile?',
2011
2011
  param: 'device.isMobile',
2012
2012
  type: ParamType.Boolean,
2013
2013
  startsHidden: true,