dce-reactkit 3.2.2-beta.14 → 3.2.2-beta.16

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
@@ -1365,12 +1365,25 @@ const SimpleDateChooser = (props) => {
1365
1365
  // Figure out which days are allowed
1366
1366
  const days = [];
1367
1367
  const numDaysInMonth = (new Date(year, month, 0)).getDate();
1368
- const firstDay = (month === today.month
1369
- ? today.day // Current month: start at current date
1370
- : 1 // Future month: start at beginning of month
1371
- );
1372
- for (let day = firstDay; day <= numDaysInMonth; day++) {
1373
- days.push(day);
1368
+ if (chooseFromPast) {
1369
+ // Past selection
1370
+ const numDaysToAdd = ((month === today.month)
1371
+ ? today.day // Current month, only add up to today
1372
+ : numDaysInMonth // Past month, add all days
1373
+ );
1374
+ for (let day = 1; day <= numDaysToAdd; day++) {
1375
+ days.push(day);
1376
+ }
1377
+ }
1378
+ else {
1379
+ // Future selection: add all remaining days of the month
1380
+ const firstDay = (month === today.month
1381
+ ? today.day // Current month: start at current date
1382
+ : 1 // Future month: start at beginning of month
1383
+ );
1384
+ for (let day = firstDay; day <= numDaysInMonth; day++) {
1385
+ days.push(day);
1386
+ }
1374
1387
  }
1375
1388
  choices.push({
1376
1389
  choiceName: `${monthName} ${year}`,
@@ -2740,7 +2753,19 @@ const reducer = (state, action) => {
2740
2753
  return Object.assign(Object.assign({}, state), { contextFilterState: action.contextFilterState });
2741
2754
  }
2742
2755
  case ActionType.UpdateTagFilterState: {
2743
- 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 });
2744
2769
  }
2745
2770
  case ActionType.UpdateActionErrorFilterState: {
2746
2771
  return Object.assign(Object.assign({}, state), { actionErrorFilterState: action.actionErrorFilterState });
@@ -3015,14 +3040,22 @@ const LogReviewer = (props) => {
3015
3040
  if (expandedFilterDrawer) {
3016
3041
  if (expandedFilterDrawer === FilterDrawer.Date) {
3017
3042
  filterDrawer = (React__default["default"].createElement(TabBox, { title: "Date" },
3018
- 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) => {
3043
+ 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) => {
3019
3044
  dateFilterState.startDate = { month, day, year };
3020
3045
  handleDateRangeUpdated(dateFilterState);
3021
3046
  } }),
3022
3047
  ' ',
3023
3048
  "to",
3024
3049
  ' ',
3025
- 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) => {
3050
+ 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) => {
3051
+ if (year < dateFilterState.startDate.year
3052
+ || (year === dateFilterState.startDate.year
3053
+ && month < dateFilterState.startDate.month)
3054
+ || (year === dateFilterState.startDate.year
3055
+ && month === dateFilterState.startDate.month
3056
+ && day < dateFilterState.startDate.day)) {
3057
+ return alert$1('Invalid Start Date', 'The start date cannot be before the end date.');
3058
+ }
3026
3059
  dateFilterState.endDate = { month, day, year };
3027
3060
  handleDateRangeUpdated(dateFilterState);
3028
3061
  } })));
@@ -3341,8 +3374,9 @@ const LogReviewer = (props) => {
3341
3374
  Object.keys(logMap).forEach((year) => {
3342
3375
  Object.keys(logMap[year]).forEach((month) => {
3343
3376
  logMap[year][month].forEach((log) => {
3344
- /* ----------- Date Filter ---------- */
3345
3377
  var _a;
3378
+ /* ----------- Date Filter ---------- */
3379
+ console.log('Log:', log);
3346
3380
  // Before start date
3347
3381
  if (
3348
3382
  // Previous year
@@ -3354,6 +3388,7 @@ const LogReviewer = (props) => {
3354
3388
  || ((log.year === dateFilterState.startDate.year)
3355
3389
  && (log.month === dateFilterState.startDate.month)
3356
3390
  && (log.day < dateFilterState.startDate.day))) {
3391
+ console.log('RULED OUT: START');
3357
3392
  return;
3358
3393
  }
3359
3394
  // After end date
@@ -3367,6 +3402,7 @@ const LogReviewer = (props) => {
3367
3402
  || ((log.year === dateFilterState.endDate.year)
3368
3403
  && (log.month === dateFilterState.endDate.month)
3369
3404
  && (log.day > dateFilterState.endDate.day))) {
3405
+ console.log('RULED OUT: END');
3370
3406
  return;
3371
3407
  }
3372
3408
  /* --------- Context Filter --------- */
@@ -3379,6 +3415,7 @@ const LogReviewer = (props) => {
3379
3415
  .every((isSelected) => {
3380
3416
  return !isSelected;
3381
3417
  }))) {
3418
+ console.log('RULED OUT: CONTEXT');
3382
3419
  return;
3383
3420
  }
3384
3421
  // Subcontext doesn't match
@@ -3391,17 +3428,15 @@ const LogReviewer = (props) => {
3391
3428
  && contextFilterState[log.context] !== true)
3392
3429
  // Subcontext is not selected
3393
3430
  && !contextFilterState[log.context][log.subcontext]) {
3431
+ console.log('RULED OUT: SUBCONTEXT');
3394
3432
  return;
3395
3433
  }
3396
3434
  /* -------------- Tags -------------- */
3397
3435
  // No tags match
3398
- if (
3399
- // Log has at least one tag
3400
- log.tags.length > 0
3401
- // No tags match
3402
- && (log.tags.every((tag) => {
3403
- return !tagFilterState[tag];
3404
- }))) {
3436
+ if (log.tags.every((tag) => {
3437
+ return !tagFilterState[tag];
3438
+ })) {
3439
+ console.log('RULED OUT: TAGS');
3405
3440
  return;
3406
3441
  }
3407
3442
  /* ------- Actions and Errors ------- */
@@ -3411,6 +3446,7 @@ const LogReviewer = (props) => {
3411
3446
  actionErrorFilterState.type !== undefined
3412
3447
  // Log type doesn't match
3413
3448
  && actionErrorFilterState.type !== log.type) {
3449
+ console.log('RULED OUT: TYPE');
3414
3450
  return;
3415
3451
  }
3416
3452
  // Filter errors
@@ -3423,6 +3459,7 @@ const LogReviewer = (props) => {
3423
3459
  && actionErrorFilterState.errorMessage.trim().length > 0
3424
3460
  // Message doesn't match
3425
3461
  && log.errorMessage.toLowerCase().includes(actionErrorFilterState.errorMessage.trim().toLowerCase())) {
3462
+ console.log('RULED OUT: ERROR MESSAGE');
3426
3463
  return;
3427
3464
  }
3428
3465
  // Code doesn't match
@@ -3433,6 +3470,7 @@ const LogReviewer = (props) => {
3433
3470
  && actionErrorFilterState.errorCode.trim().length > 0
3434
3471
  // Code doesn't match
3435
3472
  && log.errorCode.toUpperCase().includes(actionErrorFilterState.errorCode.trim().toUpperCase())) {
3473
+ console.log('RULED OUT: ERROR CODE');
3436
3474
  return;
3437
3475
  }
3438
3476
  }
@@ -3444,6 +3482,7 @@ const LogReviewer = (props) => {
3444
3482
  log.target
3445
3483
  // Target isn't selected
3446
3484
  && !actionErrorFilterState.target[log.target]) {
3485
+ console.log('RULED OUT: TARGET');
3447
3486
  return;
3448
3487
  }
3449
3488
  // Action
@@ -3452,6 +3491,7 @@ const LogReviewer = (props) => {
3452
3491
  log.action
3453
3492
  // Action isn't selected
3454
3493
  && !actionErrorFilterState.action[log.action]) {
3494
+ console.log('RULED OUT: ACTION');
3455
3495
  return;
3456
3496
  }
3457
3497
  }
@@ -3462,6 +3502,7 @@ const LogReviewer = (props) => {
3462
3502
  log.userFirstName
3463
3503
  // First name query doesn't match
3464
3504
  && !log.userFirstName.toLowerCase().includes(advancedFilterState.userFirstName.toLowerCase().trim())) {
3505
+ console.log('RULED OUT: FIRST');
3465
3506
  return;
3466
3507
  }
3467
3508
  // Last name doesn't match
@@ -3470,6 +3511,7 @@ const LogReviewer = (props) => {
3470
3511
  log.userLastName
3471
3512
  // Last name query doesn't match
3472
3513
  && !log.userLastName.toLowerCase().includes(advancedFilterState.userLastName.toLowerCase().trim())) {
3514
+ console.log('RULED OUT: LAST');
3473
3515
  return;
3474
3516
  }
3475
3517
  // Email doesn't match
@@ -3478,6 +3520,7 @@ const LogReviewer = (props) => {
3478
3520
  log.userEmail
3479
3521
  // Email query doesn't match
3480
3522
  && !log.userEmail.toLowerCase().includes(advancedFilterState.userEmail.toLowerCase().trim())) {
3523
+ console.log('RULED OUT: EMAIL');
3481
3524
  return;
3482
3525
  }
3483
3526
  // User id doesn't match
@@ -3486,6 +3529,7 @@ const LogReviewer = (props) => {
3486
3529
  log.userId
3487
3530
  // User id doesn't match
3488
3531
  && !String(log.userId).includes(advancedFilterState.userId.trim())) {
3532
+ console.log('RULED OUT: USER ID');
3489
3533
  return;
3490
3534
  }
3491
3535
  // Learner not allowed
@@ -3494,6 +3538,7 @@ const LogReviewer = (props) => {
3494
3538
  log.isLearner
3495
3539
  // Learners aren't included
3496
3540
  && !advancedFilterState.includeLearners) {
3541
+ console.log('RULED OUT: LEARNER');
3497
3542
  return;
3498
3543
  }
3499
3544
  // TTM not allowed
@@ -3502,6 +3547,7 @@ const LogReviewer = (props) => {
3502
3547
  log.isTTM
3503
3548
  // TTMs aren't included
3504
3549
  && !advancedFilterState.includeTTMs) {
3550
+ console.log('RULED OUT: TTM');
3505
3551
  return;
3506
3552
  }
3507
3553
  // Admin not allowed
@@ -3510,6 +3556,7 @@ const LogReviewer = (props) => {
3510
3556
  log.isAdmin
3511
3557
  // Admins aren't included
3512
3558
  && !advancedFilterState.includeAdmins) {
3559
+ console.log('RULED OUT: ADMIN');
3513
3560
  return;
3514
3561
  }
3515
3562
  // Course Id doesn't match
@@ -3518,6 +3565,7 @@ const LogReviewer = (props) => {
3518
3565
  log.courseId
3519
3566
  // Course Id doesn't match
3520
3567
  && !String(log.courseId).includes(advancedFilterState.courseId.trim())) {
3568
+ console.log('RULED OUT: COURSE ID');
3521
3569
  return;
3522
3570
  }
3523
3571
  // Course name doesn't match
@@ -3526,6 +3574,7 @@ const LogReviewer = (props) => {
3526
3574
  log.courseName
3527
3575
  // Course name doesn't match
3528
3576
  && !String(log.courseName).includes(advancedFilterState.courseName.trim())) {
3577
+ console.log('RULED OUT: COURSE NAME');
3529
3578
  return;
3530
3579
  }
3531
3580
  // Mobile filter doesn't match
@@ -3536,6 +3585,7 @@ const LogReviewer = (props) => {
3536
3585
  && log.device
3537
3586
  // Mobile filter doesn't match
3538
3587
  && (advancedFilterState.isMobile === log.device.isMobile)) {
3588
+ console.log('RULED OUT: MOBILE');
3539
3589
  return;
3540
3590
  }
3541
3591
  // Log source doesn't match
@@ -3546,6 +3596,7 @@ const LogReviewer = (props) => {
3546
3596
  && log.source
3547
3597
  // Source filter doesn't match
3548
3598
  && (advancedFilterState.source !== log.source)) {
3599
+ console.log('RULED OUT: SOURCE');
3549
3600
  return;
3550
3601
  }
3551
3602
  // Route path doesn't match (Only for server source)
@@ -3556,6 +3607,7 @@ const LogReviewer = (props) => {
3556
3607
  && (advancedFilterState.routePath.trim().length)
3557
3608
  // Route path doesn't match
3558
3609
  && !(log.routePath.includes(advancedFilterState.routePath.trim()))) {
3610
+ console.log('RULED OUT: PATH');
3559
3611
  return;
3560
3612
  }
3561
3613
  // Route template doesn't match (Only for server source)
@@ -3566,6 +3618,7 @@ const LogReviewer = (props) => {
3566
3618
  && (advancedFilterState.routeTemplate.trim().length)
3567
3619
  // Route template doesn't match
3568
3620
  && !(log.routeTemplate.includes(advancedFilterState.routeTemplate.trim()))) {
3621
+ console.log('RULED OUT: TEMPLATE');
3569
3622
  return;
3570
3623
  }
3571
3624
  /* -------------- Done -------------- */