dce-reactkit 3.2.2-beta.15 → 3.2.2-beta.17

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
@@ -2753,7 +2753,19 @@ const reducer = (state, action) => {
2753
2753
  return Object.assign(Object.assign({}, state), { contextFilterState: action.contextFilterState });
2754
2754
  }
2755
2755
  case ActionType.UpdateTagFilterState: {
2756
- return Object.assign(Object.assign({}, state), { tagFilterState: action.tagFilterState });
2756
+ const { tagFilterState } = action;
2757
+ // Select all if every tag is deselected
2758
+ const numTagsSelected = (Object.values(tagFilterState)
2759
+ .filter((isSelected) => {
2760
+ return isSelected;
2761
+ })
2762
+ .length);
2763
+ if (numTagsSelected === 0) {
2764
+ Object.keys(tagFilterState).forEach((tag) => {
2765
+ tagFilterState[tag] = true;
2766
+ });
2767
+ }
2768
+ return Object.assign(Object.assign({}, state), { tagFilterState });
2757
2769
  }
2758
2770
  case ActionType.UpdateActionErrorFilterState: {
2759
2771
  return Object.assign(Object.assign({}, state), { actionErrorFilterState: action.actionErrorFilterState });
@@ -2810,8 +2822,12 @@ const LogReviewer = (props) => {
2810
2822
  const subcontextValue = contextValue[subcontext];
2811
2823
  initContextFilterState[contextValue._][subcontextValue] = true;
2812
2824
  });
2825
+ // Add uncategorized subcontext
2826
+ initContextFilterState[contextValue._][LogBuiltInMetadata.Context.Uncategorized] = true;
2813
2827
  }
2814
2828
  });
2829
+ // Add uncategorized context
2830
+ initContextFilterState[LogBuiltInMetadata.Context.Uncategorized] = true;
2815
2831
  // Create initial tag filter state
2816
2832
  const initTagFilterState = {};
2817
2833
  Object.values((_b = LogMetadata.Tag) !== null && _b !== void 0 ? _b : {}).forEach((tagValue) => {
@@ -3028,14 +3044,22 @@ const LogReviewer = (props) => {
3028
3044
  if (expandedFilterDrawer) {
3029
3045
  if (expandedFilterDrawer === FilterDrawer.Date) {
3030
3046
  filterDrawer = (React__default["default"].createElement(TabBox, { title: "Date" },
3031
- React__default["default"].createElement(SimpleDateChooser, { ariaLabel: "filter start date", name: "filter-start-date", year: dateFilterState.startDate.year, month: dateFilterState.startDate.month, day: dateFilterState.startDate.day, chooseFromPast: true, onChange: (month, day, year) => {
3047
+ React__default["default"].createElement(SimpleDateChooser, { ariaLabel: "filter start date", name: "filter-start-date", year: dateFilterState.startDate.year, month: dateFilterState.startDate.month, day: dateFilterState.startDate.day, chooseFromPast: true, numMonthsToShow: 12, onChange: (month, day, year) => {
3032
3048
  dateFilterState.startDate = { month, day, year };
3033
3049
  handleDateRangeUpdated(dateFilterState);
3034
3050
  } }),
3035
3051
  ' ',
3036
3052
  "to",
3037
3053
  ' ',
3038
- React__default["default"].createElement(SimpleDateChooser, { ariaLabel: "filter end date", name: "filter-end-date", year: dateFilterState.endDate.year, month: dateFilterState.endDate.month, day: dateFilterState.endDate.day, chooseFromPast: true, onChange: (month, day, year) => {
3054
+ React__default["default"].createElement(SimpleDateChooser, { ariaLabel: "filter end date", name: "filter-end-date", year: dateFilterState.endDate.year, month: dateFilterState.endDate.month, day: dateFilterState.endDate.day, chooseFromPast: true, numMonthsToShow: 12, onChange: (month, day, year) => {
3055
+ if (year < dateFilterState.startDate.year
3056
+ || (year === dateFilterState.startDate.year
3057
+ && month < dateFilterState.startDate.month)
3058
+ || (year === dateFilterState.startDate.year
3059
+ && month === dateFilterState.startDate.month
3060
+ && day < dateFilterState.startDate.day)) {
3061
+ return alert$1('Invalid Start Date', 'The start date cannot be before the end date.');
3062
+ }
3039
3063
  dateFilterState.endDate = { month, day, year };
3040
3064
  handleDateRangeUpdated(dateFilterState);
3041
3065
  } })));
@@ -3071,7 +3095,9 @@ const LogReviewer = (props) => {
3071
3095
  }));
3072
3096
  const item = {
3073
3097
  id: context,
3074
- name: context,
3098
+ name: ((context === LogBuiltInMetadata.Context.Uncategorized)
3099
+ ? 'Uncategorized'
3100
+ : context),
3075
3101
  isGroup: true,
3076
3102
  children,
3077
3103
  };
@@ -3354,8 +3380,9 @@ const LogReviewer = (props) => {
3354
3380
  Object.keys(logMap).forEach((year) => {
3355
3381
  Object.keys(logMap[year]).forEach((month) => {
3356
3382
  logMap[year][month].forEach((log) => {
3357
- /* ----------- Date Filter ---------- */
3358
3383
  var _a;
3384
+ /* ----------- Date Filter ---------- */
3385
+ console.log('Log:', log);
3359
3386
  // Before start date
3360
3387
  if (
3361
3388
  // Previous year
@@ -3367,6 +3394,7 @@ const LogReviewer = (props) => {
3367
3394
  || ((log.year === dateFilterState.startDate.year)
3368
3395
  && (log.month === dateFilterState.startDate.month)
3369
3396
  && (log.day < dateFilterState.startDate.day))) {
3397
+ console.log('RULED OUT: START');
3370
3398
  return;
3371
3399
  }
3372
3400
  // After end date
@@ -3380,6 +3408,7 @@ const LogReviewer = (props) => {
3380
3408
  || ((log.year === dateFilterState.endDate.year)
3381
3409
  && (log.month === dateFilterState.endDate.month)
3382
3410
  && (log.day > dateFilterState.endDate.day))) {
3411
+ console.log('RULED OUT: END');
3383
3412
  return;
3384
3413
  }
3385
3414
  /* --------- Context Filter --------- */
@@ -3392,29 +3421,30 @@ const LogReviewer = (props) => {
3392
3421
  .every((isSelected) => {
3393
3422
  return !isSelected;
3394
3423
  }))) {
3424
+ console.log('RULED OUT: CONTEXT');
3395
3425
  return;
3396
3426
  }
3397
3427
  // Subcontext doesn't match
3398
3428
  if (
3399
- // Log has a subcontext
3400
- log.subcontext
3429
+ // Log context is not "uncategorized" (no point in further filters)
3430
+ log.context !== LogBuiltInMetadata.Context.Uncategorized
3431
+ // Log has a subcontext
3432
+ && log.subcontext
3401
3433
  // Context has subcontexts
3402
3434
  && (contextFilterState[log.context]
3403
3435
  && contextFilterState[log.context] !== false
3404
3436
  && contextFilterState[log.context] !== true)
3405
3437
  // Subcontext is not selected
3406
3438
  && !contextFilterState[log.context][log.subcontext]) {
3439
+ console.log('RULED OUT: SUBCONTEXT');
3407
3440
  return;
3408
3441
  }
3409
3442
  /* -------------- Tags -------------- */
3410
3443
  // No tags match
3411
- if (
3412
- // Log has at least one tag
3413
- log.tags.length > 0
3414
- // No tags match
3415
- && (log.tags.every((tag) => {
3416
- return !tagFilterState[tag];
3417
- }))) {
3444
+ if (log.tags.every((tag) => {
3445
+ return !tagFilterState[tag];
3446
+ })) {
3447
+ console.log('RULED OUT: TAGS');
3418
3448
  return;
3419
3449
  }
3420
3450
  /* ------- Actions and Errors ------- */
@@ -3424,6 +3454,7 @@ const LogReviewer = (props) => {
3424
3454
  actionErrorFilterState.type !== undefined
3425
3455
  // Log type doesn't match
3426
3456
  && actionErrorFilterState.type !== log.type) {
3457
+ console.log('RULED OUT: TYPE');
3427
3458
  return;
3428
3459
  }
3429
3460
  // Filter errors
@@ -3436,6 +3467,7 @@ const LogReviewer = (props) => {
3436
3467
  && actionErrorFilterState.errorMessage.trim().length > 0
3437
3468
  // Message doesn't match
3438
3469
  && log.errorMessage.toLowerCase().includes(actionErrorFilterState.errorMessage.trim().toLowerCase())) {
3470
+ console.log('RULED OUT: ERROR MESSAGE');
3439
3471
  return;
3440
3472
  }
3441
3473
  // Code doesn't match
@@ -3446,6 +3478,7 @@ const LogReviewer = (props) => {
3446
3478
  && actionErrorFilterState.errorCode.trim().length > 0
3447
3479
  // Code doesn't match
3448
3480
  && log.errorCode.toUpperCase().includes(actionErrorFilterState.errorCode.trim().toUpperCase())) {
3481
+ console.log('RULED OUT: ERROR CODE');
3449
3482
  return;
3450
3483
  }
3451
3484
  }
@@ -3457,6 +3490,7 @@ const LogReviewer = (props) => {
3457
3490
  log.target
3458
3491
  // Target isn't selected
3459
3492
  && !actionErrorFilterState.target[log.target]) {
3493
+ console.log('RULED OUT: TARGET');
3460
3494
  return;
3461
3495
  }
3462
3496
  // Action
@@ -3465,6 +3499,7 @@ const LogReviewer = (props) => {
3465
3499
  log.action
3466
3500
  // Action isn't selected
3467
3501
  && !actionErrorFilterState.action[log.action]) {
3502
+ console.log('RULED OUT: ACTION');
3468
3503
  return;
3469
3504
  }
3470
3505
  }
@@ -3475,6 +3510,7 @@ const LogReviewer = (props) => {
3475
3510
  log.userFirstName
3476
3511
  // First name query doesn't match
3477
3512
  && !log.userFirstName.toLowerCase().includes(advancedFilterState.userFirstName.toLowerCase().trim())) {
3513
+ console.log('RULED OUT: FIRST');
3478
3514
  return;
3479
3515
  }
3480
3516
  // Last name doesn't match
@@ -3483,6 +3519,7 @@ const LogReviewer = (props) => {
3483
3519
  log.userLastName
3484
3520
  // Last name query doesn't match
3485
3521
  && !log.userLastName.toLowerCase().includes(advancedFilterState.userLastName.toLowerCase().trim())) {
3522
+ console.log('RULED OUT: LAST');
3486
3523
  return;
3487
3524
  }
3488
3525
  // Email doesn't match
@@ -3491,6 +3528,7 @@ const LogReviewer = (props) => {
3491
3528
  log.userEmail
3492
3529
  // Email query doesn't match
3493
3530
  && !log.userEmail.toLowerCase().includes(advancedFilterState.userEmail.toLowerCase().trim())) {
3531
+ console.log('RULED OUT: EMAIL');
3494
3532
  return;
3495
3533
  }
3496
3534
  // User id doesn't match
@@ -3499,6 +3537,7 @@ const LogReviewer = (props) => {
3499
3537
  log.userId
3500
3538
  // User id doesn't match
3501
3539
  && !String(log.userId).includes(advancedFilterState.userId.trim())) {
3540
+ console.log('RULED OUT: USER ID');
3502
3541
  return;
3503
3542
  }
3504
3543
  // Learner not allowed
@@ -3507,6 +3546,7 @@ const LogReviewer = (props) => {
3507
3546
  log.isLearner
3508
3547
  // Learners aren't included
3509
3548
  && !advancedFilterState.includeLearners) {
3549
+ console.log('RULED OUT: LEARNER');
3510
3550
  return;
3511
3551
  }
3512
3552
  // TTM not allowed
@@ -3515,6 +3555,7 @@ const LogReviewer = (props) => {
3515
3555
  log.isTTM
3516
3556
  // TTMs aren't included
3517
3557
  && !advancedFilterState.includeTTMs) {
3558
+ console.log('RULED OUT: TTM');
3518
3559
  return;
3519
3560
  }
3520
3561
  // Admin not allowed
@@ -3523,6 +3564,7 @@ const LogReviewer = (props) => {
3523
3564
  log.isAdmin
3524
3565
  // Admins aren't included
3525
3566
  && !advancedFilterState.includeAdmins) {
3567
+ console.log('RULED OUT: ADMIN');
3526
3568
  return;
3527
3569
  }
3528
3570
  // Course Id doesn't match
@@ -3531,6 +3573,7 @@ const LogReviewer = (props) => {
3531
3573
  log.courseId
3532
3574
  // Course Id doesn't match
3533
3575
  && !String(log.courseId).includes(advancedFilterState.courseId.trim())) {
3576
+ console.log('RULED OUT: COURSE ID');
3534
3577
  return;
3535
3578
  }
3536
3579
  // Course name doesn't match
@@ -3539,6 +3582,7 @@ const LogReviewer = (props) => {
3539
3582
  log.courseName
3540
3583
  // Course name doesn't match
3541
3584
  && !String(log.courseName).includes(advancedFilterState.courseName.trim())) {
3585
+ console.log('RULED OUT: COURSE NAME');
3542
3586
  return;
3543
3587
  }
3544
3588
  // Mobile filter doesn't match
@@ -3549,6 +3593,7 @@ const LogReviewer = (props) => {
3549
3593
  && log.device
3550
3594
  // Mobile filter doesn't match
3551
3595
  && (advancedFilterState.isMobile === log.device.isMobile)) {
3596
+ console.log('RULED OUT: MOBILE');
3552
3597
  return;
3553
3598
  }
3554
3599
  // Log source doesn't match
@@ -3559,6 +3604,7 @@ const LogReviewer = (props) => {
3559
3604
  && log.source
3560
3605
  // Source filter doesn't match
3561
3606
  && (advancedFilterState.source !== log.source)) {
3607
+ console.log('RULED OUT: SOURCE');
3562
3608
  return;
3563
3609
  }
3564
3610
  // Route path doesn't match (Only for server source)
@@ -3569,6 +3615,7 @@ const LogReviewer = (props) => {
3569
3615
  && (advancedFilterState.routePath.trim().length)
3570
3616
  // Route path doesn't match
3571
3617
  && !(log.routePath.includes(advancedFilterState.routePath.trim()))) {
3618
+ console.log('RULED OUT: PATH');
3572
3619
  return;
3573
3620
  }
3574
3621
  // Route template doesn't match (Only for server source)
@@ -3579,6 +3626,7 @@ const LogReviewer = (props) => {
3579
3626
  && (advancedFilterState.routeTemplate.trim().length)
3580
3627
  // Route template doesn't match
3581
3628
  && !(log.routeTemplate.includes(advancedFilterState.routeTemplate.trim()))) {
3629
+ console.log('RULED OUT: TEMPLATE');
3582
3630
  return;
3583
3631
  }
3584
3632
  /* -------------- Done -------------- */