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/esm/index.js CHANGED
@@ -2745,7 +2745,19 @@ const reducer = (state, action) => {
2745
2745
  return Object.assign(Object.assign({}, state), { contextFilterState: action.contextFilterState });
2746
2746
  }
2747
2747
  case ActionType.UpdateTagFilterState: {
2748
- return Object.assign(Object.assign({}, state), { tagFilterState: action.tagFilterState });
2748
+ const { tagFilterState } = action;
2749
+ // Select all if every tag is deselected
2750
+ const numTagsSelected = (Object.values(tagFilterState)
2751
+ .filter((isSelected) => {
2752
+ return isSelected;
2753
+ })
2754
+ .length);
2755
+ if (numTagsSelected === 0) {
2756
+ Object.keys(tagFilterState).forEach((tag) => {
2757
+ tagFilterState[tag] = true;
2758
+ });
2759
+ }
2760
+ return Object.assign(Object.assign({}, state), { tagFilterState });
2749
2761
  }
2750
2762
  case ActionType.UpdateActionErrorFilterState: {
2751
2763
  return Object.assign(Object.assign({}, state), { actionErrorFilterState: action.actionErrorFilterState });
@@ -2802,8 +2814,12 @@ const LogReviewer = (props) => {
2802
2814
  const subcontextValue = contextValue[subcontext];
2803
2815
  initContextFilterState[contextValue._][subcontextValue] = true;
2804
2816
  });
2817
+ // Add uncategorized subcontext
2818
+ initContextFilterState[contextValue._][LogBuiltInMetadata.Context.Uncategorized] = true;
2805
2819
  }
2806
2820
  });
2821
+ // Add uncategorized context
2822
+ initContextFilterState[LogBuiltInMetadata.Context.Uncategorized] = true;
2807
2823
  // Create initial tag filter state
2808
2824
  const initTagFilterState = {};
2809
2825
  Object.values((_b = LogMetadata.Tag) !== null && _b !== void 0 ? _b : {}).forEach((tagValue) => {
@@ -3020,14 +3036,22 @@ const LogReviewer = (props) => {
3020
3036
  if (expandedFilterDrawer) {
3021
3037
  if (expandedFilterDrawer === FilterDrawer.Date) {
3022
3038
  filterDrawer = (React.createElement(TabBox, { title: "Date" },
3023
- React.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) => {
3039
+ React.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) => {
3024
3040
  dateFilterState.startDate = { month, day, year };
3025
3041
  handleDateRangeUpdated(dateFilterState);
3026
3042
  } }),
3027
3043
  ' ',
3028
3044
  "to",
3029
3045
  ' ',
3030
- React.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) => {
3046
+ React.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) => {
3047
+ if (year < dateFilterState.startDate.year
3048
+ || (year === dateFilterState.startDate.year
3049
+ && month < dateFilterState.startDate.month)
3050
+ || (year === dateFilterState.startDate.year
3051
+ && month === dateFilterState.startDate.month
3052
+ && day < dateFilterState.startDate.day)) {
3053
+ return alert$1('Invalid Start Date', 'The start date cannot be before the end date.');
3054
+ }
3031
3055
  dateFilterState.endDate = { month, day, year };
3032
3056
  handleDateRangeUpdated(dateFilterState);
3033
3057
  } })));
@@ -3063,7 +3087,9 @@ const LogReviewer = (props) => {
3063
3087
  }));
3064
3088
  const item = {
3065
3089
  id: context,
3066
- name: context,
3090
+ name: ((context === LogBuiltInMetadata.Context.Uncategorized)
3091
+ ? 'Uncategorized'
3092
+ : context),
3067
3093
  isGroup: true,
3068
3094
  children,
3069
3095
  };
@@ -3346,8 +3372,9 @@ const LogReviewer = (props) => {
3346
3372
  Object.keys(logMap).forEach((year) => {
3347
3373
  Object.keys(logMap[year]).forEach((month) => {
3348
3374
  logMap[year][month].forEach((log) => {
3349
- /* ----------- Date Filter ---------- */
3350
3375
  var _a;
3376
+ /* ----------- Date Filter ---------- */
3377
+ console.log('Log:', log);
3351
3378
  // Before start date
3352
3379
  if (
3353
3380
  // Previous year
@@ -3359,6 +3386,7 @@ const LogReviewer = (props) => {
3359
3386
  || ((log.year === dateFilterState.startDate.year)
3360
3387
  && (log.month === dateFilterState.startDate.month)
3361
3388
  && (log.day < dateFilterState.startDate.day))) {
3389
+ console.log('RULED OUT: START');
3362
3390
  return;
3363
3391
  }
3364
3392
  // After end date
@@ -3372,6 +3400,7 @@ const LogReviewer = (props) => {
3372
3400
  || ((log.year === dateFilterState.endDate.year)
3373
3401
  && (log.month === dateFilterState.endDate.month)
3374
3402
  && (log.day > dateFilterState.endDate.day))) {
3403
+ console.log('RULED OUT: END');
3375
3404
  return;
3376
3405
  }
3377
3406
  /* --------- Context Filter --------- */
@@ -3384,29 +3413,30 @@ const LogReviewer = (props) => {
3384
3413
  .every((isSelected) => {
3385
3414
  return !isSelected;
3386
3415
  }))) {
3416
+ console.log('RULED OUT: CONTEXT');
3387
3417
  return;
3388
3418
  }
3389
3419
  // Subcontext doesn't match
3390
3420
  if (
3391
- // Log has a subcontext
3392
- log.subcontext
3421
+ // Log context is not "uncategorized" (no point in further filters)
3422
+ log.context !== LogBuiltInMetadata.Context.Uncategorized
3423
+ // Log has a subcontext
3424
+ && log.subcontext
3393
3425
  // Context has subcontexts
3394
3426
  && (contextFilterState[log.context]
3395
3427
  && contextFilterState[log.context] !== false
3396
3428
  && contextFilterState[log.context] !== true)
3397
3429
  // Subcontext is not selected
3398
3430
  && !contextFilterState[log.context][log.subcontext]) {
3431
+ console.log('RULED OUT: SUBCONTEXT');
3399
3432
  return;
3400
3433
  }
3401
3434
  /* -------------- Tags -------------- */
3402
3435
  // No tags match
3403
- if (
3404
- // Log has at least one tag
3405
- log.tags.length > 0
3406
- // No tags match
3407
- && (log.tags.every((tag) => {
3408
- return !tagFilterState[tag];
3409
- }))) {
3436
+ if (log.tags.every((tag) => {
3437
+ return !tagFilterState[tag];
3438
+ })) {
3439
+ console.log('RULED OUT: TAGS');
3410
3440
  return;
3411
3441
  }
3412
3442
  /* ------- Actions and Errors ------- */
@@ -3416,6 +3446,7 @@ const LogReviewer = (props) => {
3416
3446
  actionErrorFilterState.type !== undefined
3417
3447
  // Log type doesn't match
3418
3448
  && actionErrorFilterState.type !== log.type) {
3449
+ console.log('RULED OUT: TYPE');
3419
3450
  return;
3420
3451
  }
3421
3452
  // Filter errors
@@ -3428,6 +3459,7 @@ const LogReviewer = (props) => {
3428
3459
  && actionErrorFilterState.errorMessage.trim().length > 0
3429
3460
  // Message doesn't match
3430
3461
  && log.errorMessage.toLowerCase().includes(actionErrorFilterState.errorMessage.trim().toLowerCase())) {
3462
+ console.log('RULED OUT: ERROR MESSAGE');
3431
3463
  return;
3432
3464
  }
3433
3465
  // Code doesn't match
@@ -3438,6 +3470,7 @@ const LogReviewer = (props) => {
3438
3470
  && actionErrorFilterState.errorCode.trim().length > 0
3439
3471
  // Code doesn't match
3440
3472
  && log.errorCode.toUpperCase().includes(actionErrorFilterState.errorCode.trim().toUpperCase())) {
3473
+ console.log('RULED OUT: ERROR CODE');
3441
3474
  return;
3442
3475
  }
3443
3476
  }
@@ -3449,6 +3482,7 @@ const LogReviewer = (props) => {
3449
3482
  log.target
3450
3483
  // Target isn't selected
3451
3484
  && !actionErrorFilterState.target[log.target]) {
3485
+ console.log('RULED OUT: TARGET');
3452
3486
  return;
3453
3487
  }
3454
3488
  // Action
@@ -3457,6 +3491,7 @@ const LogReviewer = (props) => {
3457
3491
  log.action
3458
3492
  // Action isn't selected
3459
3493
  && !actionErrorFilterState.action[log.action]) {
3494
+ console.log('RULED OUT: ACTION');
3460
3495
  return;
3461
3496
  }
3462
3497
  }
@@ -3467,6 +3502,7 @@ const LogReviewer = (props) => {
3467
3502
  log.userFirstName
3468
3503
  // First name query doesn't match
3469
3504
  && !log.userFirstName.toLowerCase().includes(advancedFilterState.userFirstName.toLowerCase().trim())) {
3505
+ console.log('RULED OUT: FIRST');
3470
3506
  return;
3471
3507
  }
3472
3508
  // Last name doesn't match
@@ -3475,6 +3511,7 @@ const LogReviewer = (props) => {
3475
3511
  log.userLastName
3476
3512
  // Last name query doesn't match
3477
3513
  && !log.userLastName.toLowerCase().includes(advancedFilterState.userLastName.toLowerCase().trim())) {
3514
+ console.log('RULED OUT: LAST');
3478
3515
  return;
3479
3516
  }
3480
3517
  // Email doesn't match
@@ -3483,6 +3520,7 @@ const LogReviewer = (props) => {
3483
3520
  log.userEmail
3484
3521
  // Email query doesn't match
3485
3522
  && !log.userEmail.toLowerCase().includes(advancedFilterState.userEmail.toLowerCase().trim())) {
3523
+ console.log('RULED OUT: EMAIL');
3486
3524
  return;
3487
3525
  }
3488
3526
  // User id doesn't match
@@ -3491,6 +3529,7 @@ const LogReviewer = (props) => {
3491
3529
  log.userId
3492
3530
  // User id doesn't match
3493
3531
  && !String(log.userId).includes(advancedFilterState.userId.trim())) {
3532
+ console.log('RULED OUT: USER ID');
3494
3533
  return;
3495
3534
  }
3496
3535
  // Learner not allowed
@@ -3499,6 +3538,7 @@ const LogReviewer = (props) => {
3499
3538
  log.isLearner
3500
3539
  // Learners aren't included
3501
3540
  && !advancedFilterState.includeLearners) {
3541
+ console.log('RULED OUT: LEARNER');
3502
3542
  return;
3503
3543
  }
3504
3544
  // TTM not allowed
@@ -3507,6 +3547,7 @@ const LogReviewer = (props) => {
3507
3547
  log.isTTM
3508
3548
  // TTMs aren't included
3509
3549
  && !advancedFilterState.includeTTMs) {
3550
+ console.log('RULED OUT: TTM');
3510
3551
  return;
3511
3552
  }
3512
3553
  // Admin not allowed
@@ -3515,6 +3556,7 @@ const LogReviewer = (props) => {
3515
3556
  log.isAdmin
3516
3557
  // Admins aren't included
3517
3558
  && !advancedFilterState.includeAdmins) {
3559
+ console.log('RULED OUT: ADMIN');
3518
3560
  return;
3519
3561
  }
3520
3562
  // Course Id doesn't match
@@ -3523,6 +3565,7 @@ const LogReviewer = (props) => {
3523
3565
  log.courseId
3524
3566
  // Course Id doesn't match
3525
3567
  && !String(log.courseId).includes(advancedFilterState.courseId.trim())) {
3568
+ console.log('RULED OUT: COURSE ID');
3526
3569
  return;
3527
3570
  }
3528
3571
  // Course name doesn't match
@@ -3531,6 +3574,7 @@ const LogReviewer = (props) => {
3531
3574
  log.courseName
3532
3575
  // Course name doesn't match
3533
3576
  && !String(log.courseName).includes(advancedFilterState.courseName.trim())) {
3577
+ console.log('RULED OUT: COURSE NAME');
3534
3578
  return;
3535
3579
  }
3536
3580
  // Mobile filter doesn't match
@@ -3541,6 +3585,7 @@ const LogReviewer = (props) => {
3541
3585
  && log.device
3542
3586
  // Mobile filter doesn't match
3543
3587
  && (advancedFilterState.isMobile === log.device.isMobile)) {
3588
+ console.log('RULED OUT: MOBILE');
3544
3589
  return;
3545
3590
  }
3546
3591
  // Log source doesn't match
@@ -3551,6 +3596,7 @@ const LogReviewer = (props) => {
3551
3596
  && log.source
3552
3597
  // Source filter doesn't match
3553
3598
  && (advancedFilterState.source !== log.source)) {
3599
+ console.log('RULED OUT: SOURCE');
3554
3600
  return;
3555
3601
  }
3556
3602
  // Route path doesn't match (Only for server source)
@@ -3561,6 +3607,7 @@ const LogReviewer = (props) => {
3561
3607
  && (advancedFilterState.routePath.trim().length)
3562
3608
  // Route path doesn't match
3563
3609
  && !(log.routePath.includes(advancedFilterState.routePath.trim()))) {
3610
+ console.log('RULED OUT: PATH');
3564
3611
  return;
3565
3612
  }
3566
3613
  // Route template doesn't match (Only for server source)
@@ -3571,6 +3618,7 @@ const LogReviewer = (props) => {
3571
3618
  && (advancedFilterState.routeTemplate.trim().length)
3572
3619
  // Route template doesn't match
3573
3620
  && !(log.routeTemplate.includes(advancedFilterState.routeTemplate.trim()))) {
3621
+ console.log('RULED OUT: TEMPLATE');
3574
3622
  return;
3575
3623
  }
3576
3624
  /* -------------- Done -------------- */