dce-reactkit 3.2.2-beta.32 → 3.2.2-beta.34

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/dist/esm/index.js CHANGED
@@ -2234,7 +2234,23 @@ const genCSV = (data, columns) => {
2234
2234
  data.forEach((datum) => {
2235
2235
  csv += (columns
2236
2236
  .map((column) => {
2237
- return escapeCellText(datum[column.param]);
2237
+ let contents;
2238
+ const cell = datum[column.param];
2239
+ if (typeof cell === 'string'
2240
+ || typeof cell === 'number') {
2241
+ contents = String(cell);
2242
+ }
2243
+ else if (typeof cell === 'undefined'
2244
+ || cell === null) {
2245
+ contents = '';
2246
+ }
2247
+ else if (typeof cell === 'object') {
2248
+ contents = JSON.stringify(cell);
2249
+ }
2250
+ else {
2251
+ contents = '';
2252
+ }
2253
+ return escapeCellText(contents);
2238
2254
  })
2239
2255
  .join(','));
2240
2256
  });
@@ -2267,7 +2283,8 @@ const CSVDownloadButton = (props) => {
2267
2283
  ? `Click to download ${filename}`
2268
2284
  : ariaLabel), style: style, onClick: onClick },
2269
2285
  !children && (React.createElement(React.Fragment, null,
2270
- React.createElement(FontAwesomeIcon, { icon: faCloudDownloadAlt, className: "mr-2" }),
2286
+ React.createElement(FontAwesomeIcon, { icon: faCloudDownloadAlt }),
2287
+ ' ',
2271
2288
  "Download CSV")),
2272
2289
  children));
2273
2290
  };
@@ -2355,10 +2372,18 @@ const IntelliTable = (props) => {
2355
2372
  const [state, dispatch] = useReducer(reducer$1, initialState);
2356
2373
  // Destructure common state
2357
2374
  const { sortColumnParam, sortType, columnVisibilityMap, columnVisibilityCustomizationModalVisible, } = state;
2375
+ /*------------------------------------------------------------------------*/
2376
+ /* Render */
2377
+ /*------------------------------------------------------------------------*/
2378
+ /*----------------------------------------*/
2379
+ /* Modal */
2380
+ /*----------------------------------------*/
2381
+ // Modal that may be defined
2382
+ let modal;
2358
2383
  /* ------- Col Vis Customization Modal ------ */
2359
2384
  if (columnVisibilityCustomizationModalVisible) {
2360
2385
  // Create modal
2361
- (React.createElement(Modal, { type: ModalType$1.Okay, title: "Choose columns to show:", onClose: () => {
2386
+ modal = (React.createElement(Modal, { type: ModalType$1.Okay, title: "Choose columns to show:", onClose: () => {
2362
2387
  dispatch({
2363
2388
  type: ActionType$1.ToggleColVisCusModalVisibility,
2364
2389
  });
@@ -2383,6 +2408,7 @@ const IntelliTable = (props) => {
2383
2408
  // Custom info based on current sort type
2384
2409
  let sortButtonAriaLabel;
2385
2410
  let sortIcon = faSort;
2411
+ let sortingByThisColumn = false;
2386
2412
  if (!sortColumnParam) {
2387
2413
  // Not being sorted yet
2388
2414
  sortButtonAriaLabel = `sort ascending by ${column.title}`;
@@ -2390,6 +2416,7 @@ const IntelliTable = (props) => {
2390
2416
  }
2391
2417
  else if (column.param === sortColumnParam) {
2392
2418
  // Already sorted by this column
2419
+ sortingByThisColumn = true;
2393
2420
  if (sortType === SortType.Ascending) {
2394
2421
  // Sorted ascending
2395
2422
  sortButtonAriaLabel = `sort descending by ${column.title}`;
@@ -2407,11 +2434,14 @@ const IntelliTable = (props) => {
2407
2434
  sortIcon = faSort;
2408
2435
  }
2409
2436
  // Create the cell UI
2410
- return (React.createElement("th", { key: column.param, scope: "col", id: `IntelliTable-${id}-header-${column.param}` },
2437
+ return (React.createElement("th", { key: column.param, scope: "col", id: `IntelliTable-${id}-header-${column.param}`, className: "text-start", style: {
2438
+ borderRight: '0.05rem solid #555',
2439
+ borderLeft: '0.05rem solid #555',
2440
+ } },
2411
2441
  React.createElement("div", { className: "d-flex align-items-center justify-content-center flex-row h-100" },
2412
2442
  React.createElement("span", { className: "text-nowrap" }, column.title),
2413
2443
  React.createElement("div", null,
2414
- React.createElement("button", { type: "button", className: "btn btn-light btn-sm ms-1", "aria-label": sortButtonAriaLabel, onClick: () => {
2444
+ React.createElement("button", { type: "button", id: `IntelliTable-${id}-sort-by-${column.param}-button`, className: `btn btn-${sortingByThisColumn ? 'light' : 'secondary'} btn-sm ms-1 ps-1 pe-1 pt-0 pb-0`, "aria-label": sortButtonAriaLabel, onClick: () => {
2415
2445
  dispatch({
2416
2446
  type: ActionType$1.ToggleSortColumn,
2417
2447
  param: column.param,
@@ -2452,10 +2482,10 @@ const IntelliTable = (props) => {
2452
2482
  // > String
2453
2483
  if (paramType === ParamType$1.String) {
2454
2484
  if (aVal < bVal) {
2455
- return (descending ? -1 : 1);
2485
+ return (descending ? 1 : -1);
2456
2486
  }
2457
2487
  if (aVal > bVal) {
2458
- return (descending ? 1 : -1);
2488
+ return (descending ? -1 : 1);
2459
2489
  }
2460
2490
  return 0;
2461
2491
  }
@@ -2519,7 +2549,9 @@ const IntelliTable = (props) => {
2519
2549
  }
2520
2550
  else if (column.type === ParamType$1.String) {
2521
2551
  fullValue = String(value).trim();
2522
- const noValue = (String(fullValue).trim().length === 0);
2552
+ const noValue = (value === undefined
2553
+ || value === null
2554
+ || String(fullValue).trim().length === 0);
2523
2555
  visibleValue = (noValue
2524
2556
  ? (React.createElement(FontAwesomeIcon, { icon: faMinus }))
2525
2557
  : fullValue);
@@ -2535,7 +2567,10 @@ const IntelliTable = (props) => {
2535
2567
  : fullValue);
2536
2568
  }
2537
2569
  // Create UI
2538
- return (React.createElement("td", { key: `${datum.id}-${column.param}`, title: title }, visibleValue));
2570
+ return (React.createElement("td", { key: `${datum.id}-${column.param}`, title: title, style: {
2571
+ borderRight: '0.05rem solid #555',
2572
+ borderLeft: '0.05rem solid #555',
2573
+ } }, visibleValue));
2539
2574
  }));
2540
2575
  // Add cells to a row
2541
2576
  return (React.createElement("tr", { key: datum.id }, cells));
@@ -2555,7 +2590,8 @@ const IntelliTable = (props) => {
2555
2590
  const csv = genCSV(data, columns);
2556
2591
  // Build main UI
2557
2592
  return (React.createElement("div", { className: `IntelliTable-container-${id}` },
2558
- React.createElement("div", { className: "d-flex align-items-center justify-content-center" },
2593
+ modal,
2594
+ React.createElement("div", { className: "d-flex align-items-center justify-content-start" },
2559
2595
  React.createElement("h3", { className: "m-0" }, title),
2560
2596
  React.createElement("div", { className: "flex-grow-1 text-end" },
2561
2597
  React.createElement(CSVDownloadButton, { "aria-label": `download data as csv for ${title}`, id: `IntelliTable-${id}-download-as-csv`, filename: `${title}.csv`, csv: csv }),
@@ -2571,7 +2607,7 @@ const IntelliTable = (props) => {
2571
2607
  numHiddenCols,
2572
2608
  ' ',
2573
2609
  "hidden)"))))),
2574
- React.createElement("div", { className: `IntelliTable-table-${id}`, style: {
2610
+ React.createElement("div", { className: `IntelliTable-table-${id} mt-2`, style: {
2575
2611
  overflowX: 'auto',
2576
2612
  } }, table)));
2577
2613
  };
@@ -2788,7 +2824,7 @@ const LogReviewer = (props) => {
2788
2824
  /*------------------------------------------------------------------------*/
2789
2825
  /* Setup */
2790
2826
  /*------------------------------------------------------------------------*/
2791
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
2827
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
2792
2828
  /* -------------- Props ------------- */
2793
2829
  // Destructure props
2794
2830
  const { LogMetadata, onClose, } = props;
@@ -2858,8 +2894,8 @@ const LogReviewer = (props) => {
2858
2894
  });
2859
2895
  // Create initial tag filter state
2860
2896
  const initTagFilterState = {};
2861
- Object.values((_e = LogMetadata.Tag) !== null && _e !== void 0 ? _e : {}).forEach((tagValue) => {
2862
- initTagFilterState[tagValue] = false;
2897
+ Object.keys((_e = LogMetadata.Tag) !== null && _e !== void 0 ? _e : {}).forEach((tag) => {
2898
+ initTagFilterState[tag] = false;
2863
2899
  });
2864
2900
  // Create advanced filter state
2865
2901
  const initAdvancedFilterState = {
@@ -3158,7 +3194,7 @@ const LogReviewer = (props) => {
3158
3194
  }
3159
3195
  else if (expandedFilterDrawer === FilterDrawer.Tag) {
3160
3196
  // Create filter UI
3161
- filterDrawer = (React.createElement(TabBox, { title: "Tags" }, Object.keys(tagFilterState)
3197
+ filterDrawer = (React.createElement(TabBox, { title: "Tags" }, Object.keys((_h = LogMetadata.Tag) !== null && _h !== void 0 ? _h : {})
3162
3198
  .map((tag, i) => {
3163
3199
  const description = genHumanReadableName(tag);
3164
3200
  return (React.createElement(CheckboxButton, { id: `LogReviewer-tag-${tag}-checkbox`, text: description, ariaLabel: `require that logs be tagged with "${description}" or any other selected tag`, noMarginOnRight: i === Object.keys(tagFilterState).length - 1, checked: tagFilterState[tag], onChanged: (checked) => {
@@ -3205,8 +3241,8 @@ const LogReviewer = (props) => {
3205
3241
  } }));
3206
3242
  })),
3207
3243
  React.createElement(ButtonInputGroup, { label: "Target" },
3208
- (Object.keys((_h = LogMetadata.Target) !== null && _h !== void 0 ? _h : {}).length === 0) && (React.createElement("div", null, "This app does not have any targets yet.")),
3209
- Object.keys((_j = LogMetadata.Target) !== null && _j !== void 0 ? _j : {})
3244
+ (Object.keys((_j = LogMetadata.Target) !== null && _j !== void 0 ? _j : {}).length === 0) && (React.createElement("div", null, "This app does not have any targets yet.")),
3245
+ Object.keys((_k = LogMetadata.Target) !== null && _k !== void 0 ? _k : {})
3210
3246
  .map((target, i) => {
3211
3247
  var _a;
3212
3248
  const description = genHumanReadableName(target);
@@ -3707,18 +3743,18 @@ const LogReviewer = (props) => {
3707
3743
  type: ParamType$1.Int,
3708
3744
  },
3709
3745
  {
3710
- title: 'Student',
3746
+ title: 'Student?',
3711
3747
  param: 'isLearner',
3712
3748
  type: ParamType$1.Boolean,
3713
3749
  },
3714
3750
  {
3715
- title: 'Teaching Staff',
3751
+ title: 'Teaching Staff?',
3716
3752
  param: 'isTTM',
3717
3753
  type: ParamType$1.Boolean,
3718
3754
  startsHidden: true,
3719
3755
  },
3720
3756
  {
3721
- title: 'Admin',
3757
+ title: 'Admin?',
3722
3758
  param: 'isAdmin',
3723
3759
  type: ParamType$1.Boolean,
3724
3760
  startsHidden: true,
@@ -3753,7 +3789,7 @@ const LogReviewer = (props) => {
3753
3789
  startsHidden: true,
3754
3790
  },
3755
3791
  {
3756
- title: 'Mobile',
3792
+ title: 'Mobile?',
3757
3793
  param: 'device.isMobile',
3758
3794
  type: ParamType$1.Boolean,
3759
3795
  startsHidden: true,
@@ -4883,7 +4919,7 @@ const genRouteHandler = (opts) => {
4883
4919
  isAdmin: !!launchInfo.isAdmin,
4884
4920
  isTTM: !!launchInfo.isTTM,
4885
4921
  courseId: launchInfo.courseId,
4886
- courseName: launchInfo.courseName,
4922
+ courseName: launchInfo.contextLabel,
4887
4923
  browser,
4888
4924
  device,
4889
4925
  year,