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/cjs/index.js CHANGED
@@ -2242,7 +2242,23 @@ const genCSV = (data, columns) => {
2242
2242
  data.forEach((datum) => {
2243
2243
  csv += (columns
2244
2244
  .map((column) => {
2245
- return escapeCellText(datum[column.param]);
2245
+ let contents;
2246
+ const cell = datum[column.param];
2247
+ if (typeof cell === 'string'
2248
+ || typeof cell === 'number') {
2249
+ contents = String(cell);
2250
+ }
2251
+ else if (typeof cell === 'undefined'
2252
+ || cell === null) {
2253
+ contents = '';
2254
+ }
2255
+ else if (typeof cell === 'object') {
2256
+ contents = JSON.stringify(cell);
2257
+ }
2258
+ else {
2259
+ contents = '';
2260
+ }
2261
+ return escapeCellText(contents);
2246
2262
  })
2247
2263
  .join(','));
2248
2264
  });
@@ -2275,7 +2291,8 @@ const CSVDownloadButton = (props) => {
2275
2291
  ? `Click to download ${filename}`
2276
2292
  : ariaLabel), style: style, onClick: onClick },
2277
2293
  !children && (React__default["default"].createElement(React__default["default"].Fragment, null,
2278
- React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: freeSolidSvgIcons.faCloudDownloadAlt, className: "mr-2" }),
2294
+ React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: freeSolidSvgIcons.faCloudDownloadAlt }),
2295
+ ' ',
2279
2296
  "Download CSV")),
2280
2297
  children));
2281
2298
  };
@@ -2363,10 +2380,18 @@ const IntelliTable = (props) => {
2363
2380
  const [state, dispatch] = React.useReducer(reducer$1, initialState);
2364
2381
  // Destructure common state
2365
2382
  const { sortColumnParam, sortType, columnVisibilityMap, columnVisibilityCustomizationModalVisible, } = state;
2383
+ /*------------------------------------------------------------------------*/
2384
+ /* Render */
2385
+ /*------------------------------------------------------------------------*/
2386
+ /*----------------------------------------*/
2387
+ /* Modal */
2388
+ /*----------------------------------------*/
2389
+ // Modal that may be defined
2390
+ let modal;
2366
2391
  /* ------- Col Vis Customization Modal ------ */
2367
2392
  if (columnVisibilityCustomizationModalVisible) {
2368
2393
  // Create modal
2369
- (React__default["default"].createElement(Modal, { type: ModalType$1.Okay, title: "Choose columns to show:", onClose: () => {
2394
+ modal = (React__default["default"].createElement(Modal, { type: ModalType$1.Okay, title: "Choose columns to show:", onClose: () => {
2370
2395
  dispatch({
2371
2396
  type: ActionType$1.ToggleColVisCusModalVisibility,
2372
2397
  });
@@ -2391,6 +2416,7 @@ const IntelliTable = (props) => {
2391
2416
  // Custom info based on current sort type
2392
2417
  let sortButtonAriaLabel;
2393
2418
  let sortIcon = freeSolidSvgIcons.faSort;
2419
+ let sortingByThisColumn = false;
2394
2420
  if (!sortColumnParam) {
2395
2421
  // Not being sorted yet
2396
2422
  sortButtonAriaLabel = `sort ascending by ${column.title}`;
@@ -2398,6 +2424,7 @@ const IntelliTable = (props) => {
2398
2424
  }
2399
2425
  else if (column.param === sortColumnParam) {
2400
2426
  // Already sorted by this column
2427
+ sortingByThisColumn = true;
2401
2428
  if (sortType === SortType.Ascending) {
2402
2429
  // Sorted ascending
2403
2430
  sortButtonAriaLabel = `sort descending by ${column.title}`;
@@ -2415,11 +2442,14 @@ const IntelliTable = (props) => {
2415
2442
  sortIcon = freeSolidSvgIcons.faSort;
2416
2443
  }
2417
2444
  // Create the cell UI
2418
- return (React__default["default"].createElement("th", { key: column.param, scope: "col", id: `IntelliTable-${id}-header-${column.param}` },
2445
+ return (React__default["default"].createElement("th", { key: column.param, scope: "col", id: `IntelliTable-${id}-header-${column.param}`, className: "text-start", style: {
2446
+ borderRight: '0.05rem solid #555',
2447
+ borderLeft: '0.05rem solid #555',
2448
+ } },
2419
2449
  React__default["default"].createElement("div", { className: "d-flex align-items-center justify-content-center flex-row h-100" },
2420
2450
  React__default["default"].createElement("span", { className: "text-nowrap" }, column.title),
2421
2451
  React__default["default"].createElement("div", null,
2422
- React__default["default"].createElement("button", { type: "button", className: "btn btn-light btn-sm ms-1", "aria-label": sortButtonAriaLabel, onClick: () => {
2452
+ React__default["default"].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: () => {
2423
2453
  dispatch({
2424
2454
  type: ActionType$1.ToggleSortColumn,
2425
2455
  param: column.param,
@@ -2460,10 +2490,10 @@ const IntelliTable = (props) => {
2460
2490
  // > String
2461
2491
  if (paramType === ParamType$1.String) {
2462
2492
  if (aVal < bVal) {
2463
- return (descending ? -1 : 1);
2493
+ return (descending ? 1 : -1);
2464
2494
  }
2465
2495
  if (aVal > bVal) {
2466
- return (descending ? 1 : -1);
2496
+ return (descending ? -1 : 1);
2467
2497
  }
2468
2498
  return 0;
2469
2499
  }
@@ -2527,7 +2557,9 @@ const IntelliTable = (props) => {
2527
2557
  }
2528
2558
  else if (column.type === ParamType$1.String) {
2529
2559
  fullValue = String(value).trim();
2530
- const noValue = (String(fullValue).trim().length === 0);
2560
+ const noValue = (value === undefined
2561
+ || value === null
2562
+ || String(fullValue).trim().length === 0);
2531
2563
  visibleValue = (noValue
2532
2564
  ? (React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: freeSolidSvgIcons.faMinus }))
2533
2565
  : fullValue);
@@ -2543,7 +2575,10 @@ const IntelliTable = (props) => {
2543
2575
  : fullValue);
2544
2576
  }
2545
2577
  // Create UI
2546
- return (React__default["default"].createElement("td", { key: `${datum.id}-${column.param}`, title: title }, visibleValue));
2578
+ return (React__default["default"].createElement("td", { key: `${datum.id}-${column.param}`, title: title, style: {
2579
+ borderRight: '0.05rem solid #555',
2580
+ borderLeft: '0.05rem solid #555',
2581
+ } }, visibleValue));
2547
2582
  }));
2548
2583
  // Add cells to a row
2549
2584
  return (React__default["default"].createElement("tr", { key: datum.id }, cells));
@@ -2563,7 +2598,8 @@ const IntelliTable = (props) => {
2563
2598
  const csv = genCSV(data, columns);
2564
2599
  // Build main UI
2565
2600
  return (React__default["default"].createElement("div", { className: `IntelliTable-container-${id}` },
2566
- React__default["default"].createElement("div", { className: "d-flex align-items-center justify-content-center" },
2601
+ modal,
2602
+ React__default["default"].createElement("div", { className: "d-flex align-items-center justify-content-start" },
2567
2603
  React__default["default"].createElement("h3", { className: "m-0" }, title),
2568
2604
  React__default["default"].createElement("div", { className: "flex-grow-1 text-end" },
2569
2605
  React__default["default"].createElement(CSVDownloadButton, { "aria-label": `download data as csv for ${title}`, id: `IntelliTable-${id}-download-as-csv`, filename: `${title}.csv`, csv: csv }),
@@ -2579,7 +2615,7 @@ const IntelliTable = (props) => {
2579
2615
  numHiddenCols,
2580
2616
  ' ',
2581
2617
  "hidden)"))))),
2582
- React__default["default"].createElement("div", { className: `IntelliTable-table-${id}`, style: {
2618
+ React__default["default"].createElement("div", { className: `IntelliTable-table-${id} mt-2`, style: {
2583
2619
  overflowX: 'auto',
2584
2620
  } }, table)));
2585
2621
  };
@@ -2796,7 +2832,7 @@ const LogReviewer = (props) => {
2796
2832
  /*------------------------------------------------------------------------*/
2797
2833
  /* Setup */
2798
2834
  /*------------------------------------------------------------------------*/
2799
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
2835
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
2800
2836
  /* -------------- Props ------------- */
2801
2837
  // Destructure props
2802
2838
  const { LogMetadata, onClose, } = props;
@@ -2866,8 +2902,8 @@ const LogReviewer = (props) => {
2866
2902
  });
2867
2903
  // Create initial tag filter state
2868
2904
  const initTagFilterState = {};
2869
- Object.values((_e = LogMetadata.Tag) !== null && _e !== void 0 ? _e : {}).forEach((tagValue) => {
2870
- initTagFilterState[tagValue] = false;
2905
+ Object.keys((_e = LogMetadata.Tag) !== null && _e !== void 0 ? _e : {}).forEach((tag) => {
2906
+ initTagFilterState[tag] = false;
2871
2907
  });
2872
2908
  // Create advanced filter state
2873
2909
  const initAdvancedFilterState = {
@@ -3166,7 +3202,7 @@ const LogReviewer = (props) => {
3166
3202
  }
3167
3203
  else if (expandedFilterDrawer === FilterDrawer.Tag) {
3168
3204
  // Create filter UI
3169
- filterDrawer = (React__default["default"].createElement(TabBox, { title: "Tags" }, Object.keys(tagFilterState)
3205
+ filterDrawer = (React__default["default"].createElement(TabBox, { title: "Tags" }, Object.keys((_h = LogMetadata.Tag) !== null && _h !== void 0 ? _h : {})
3170
3206
  .map((tag, i) => {
3171
3207
  const description = genHumanReadableName(tag);
3172
3208
  return (React__default["default"].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) => {
@@ -3213,8 +3249,8 @@ const LogReviewer = (props) => {
3213
3249
  } }));
3214
3250
  })),
3215
3251
  React__default["default"].createElement(ButtonInputGroup, { label: "Target" },
3216
- (Object.keys((_h = LogMetadata.Target) !== null && _h !== void 0 ? _h : {}).length === 0) && (React__default["default"].createElement("div", null, "This app does not have any targets yet.")),
3217
- Object.keys((_j = LogMetadata.Target) !== null && _j !== void 0 ? _j : {})
3252
+ (Object.keys((_j = LogMetadata.Target) !== null && _j !== void 0 ? _j : {}).length === 0) && (React__default["default"].createElement("div", null, "This app does not have any targets yet.")),
3253
+ Object.keys((_k = LogMetadata.Target) !== null && _k !== void 0 ? _k : {})
3218
3254
  .map((target, i) => {
3219
3255
  var _a;
3220
3256
  const description = genHumanReadableName(target);
@@ -3715,18 +3751,18 @@ const LogReviewer = (props) => {
3715
3751
  type: ParamType$1.Int,
3716
3752
  },
3717
3753
  {
3718
- title: 'Student',
3754
+ title: 'Student?',
3719
3755
  param: 'isLearner',
3720
3756
  type: ParamType$1.Boolean,
3721
3757
  },
3722
3758
  {
3723
- title: 'Teaching Staff',
3759
+ title: 'Teaching Staff?',
3724
3760
  param: 'isTTM',
3725
3761
  type: ParamType$1.Boolean,
3726
3762
  startsHidden: true,
3727
3763
  },
3728
3764
  {
3729
- title: 'Admin',
3765
+ title: 'Admin?',
3730
3766
  param: 'isAdmin',
3731
3767
  type: ParamType$1.Boolean,
3732
3768
  startsHidden: true,
@@ -3761,7 +3797,7 @@ const LogReviewer = (props) => {
3761
3797
  startsHidden: true,
3762
3798
  },
3763
3799
  {
3764
- title: 'Mobile',
3800
+ title: 'Mobile?',
3765
3801
  param: 'device.isMobile',
3766
3802
  type: ParamType$1.Boolean,
3767
3803
  startsHidden: true,
@@ -4891,7 +4927,7 @@ const genRouteHandler = (opts) => {
4891
4927
  isAdmin: !!launchInfo.isAdmin,
4892
4928
  isTTM: !!launchInfo.isTTM,
4893
4929
  courseId: launchInfo.courseId,
4894
- courseName: launchInfo.courseName,
4930
+ courseName: launchInfo.contextLabel,
4895
4931
  browser,
4896
4932
  device,
4897
4933
  year,