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/esm/index.js CHANGED
@@ -1357,12 +1357,25 @@ const SimpleDateChooser = (props) => {
1357
1357
  // Figure out which days are allowed
1358
1358
  const days = [];
1359
1359
  const numDaysInMonth = (new Date(year, month, 0)).getDate();
1360
- const firstDay = (month === today.month
1361
- ? today.day // Current month: start at current date
1362
- : 1 // Future month: start at beginning of month
1363
- );
1364
- for (let day = firstDay; day <= numDaysInMonth; day++) {
1365
- days.push(day);
1360
+ if (chooseFromPast) {
1361
+ // Past selection
1362
+ const numDaysToAdd = ((month === today.month)
1363
+ ? today.day // Current month, only add up to today
1364
+ : numDaysInMonth // Past month, add all days
1365
+ );
1366
+ for (let day = 1; day <= numDaysToAdd; day++) {
1367
+ days.push(day);
1368
+ }
1369
+ }
1370
+ else {
1371
+ // Future selection: add all remaining days of the month
1372
+ const firstDay = (month === today.month
1373
+ ? today.day // Current month: start at current date
1374
+ : 1 // Future month: start at beginning of month
1375
+ );
1376
+ for (let day = firstDay; day <= numDaysInMonth; day++) {
1377
+ days.push(day);
1378
+ }
1366
1379
  }
1367
1380
  choices.push({
1368
1381
  choiceName: `${monthName} ${year}`,
@@ -2732,7 +2745,19 @@ const reducer = (state, action) => {
2732
2745
  return Object.assign(Object.assign({}, state), { contextFilterState: action.contextFilterState });
2733
2746
  }
2734
2747
  case ActionType.UpdateTagFilterState: {
2735
- 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 });
2736
2761
  }
2737
2762
  case ActionType.UpdateActionErrorFilterState: {
2738
2763
  return Object.assign(Object.assign({}, state), { actionErrorFilterState: action.actionErrorFilterState });
@@ -3007,14 +3032,22 @@ const LogReviewer = (props) => {
3007
3032
  if (expandedFilterDrawer) {
3008
3033
  if (expandedFilterDrawer === FilterDrawer.Date) {
3009
3034
  filterDrawer = (React.createElement(TabBox, { title: "Date" },
3010
- 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) => {
3035
+ 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) => {
3011
3036
  dateFilterState.startDate = { month, day, year };
3012
3037
  handleDateRangeUpdated(dateFilterState);
3013
3038
  } }),
3014
3039
  ' ',
3015
3040
  "to",
3016
3041
  ' ',
3017
- 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) => {
3042
+ 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) => {
3043
+ if (year < dateFilterState.startDate.year
3044
+ || (year === dateFilterState.startDate.year
3045
+ && month < dateFilterState.startDate.month)
3046
+ || (year === dateFilterState.startDate.year
3047
+ && month === dateFilterState.startDate.month
3048
+ && day < dateFilterState.startDate.day)) {
3049
+ return alert$1('Invalid Start Date', 'The start date cannot be before the end date.');
3050
+ }
3018
3051
  dateFilterState.endDate = { month, day, year };
3019
3052
  handleDateRangeUpdated(dateFilterState);
3020
3053
  } })));
@@ -3333,8 +3366,9 @@ const LogReviewer = (props) => {
3333
3366
  Object.keys(logMap).forEach((year) => {
3334
3367
  Object.keys(logMap[year]).forEach((month) => {
3335
3368
  logMap[year][month].forEach((log) => {
3336
- /* ----------- Date Filter ---------- */
3337
3369
  var _a;
3370
+ /* ----------- Date Filter ---------- */
3371
+ console.log('Log:', log);
3338
3372
  // Before start date
3339
3373
  if (
3340
3374
  // Previous year
@@ -3346,6 +3380,7 @@ const LogReviewer = (props) => {
3346
3380
  || ((log.year === dateFilterState.startDate.year)
3347
3381
  && (log.month === dateFilterState.startDate.month)
3348
3382
  && (log.day < dateFilterState.startDate.day))) {
3383
+ console.log('RULED OUT: START');
3349
3384
  return;
3350
3385
  }
3351
3386
  // After end date
@@ -3359,6 +3394,7 @@ const LogReviewer = (props) => {
3359
3394
  || ((log.year === dateFilterState.endDate.year)
3360
3395
  && (log.month === dateFilterState.endDate.month)
3361
3396
  && (log.day > dateFilterState.endDate.day))) {
3397
+ console.log('RULED OUT: END');
3362
3398
  return;
3363
3399
  }
3364
3400
  /* --------- Context Filter --------- */
@@ -3371,6 +3407,7 @@ const LogReviewer = (props) => {
3371
3407
  .every((isSelected) => {
3372
3408
  return !isSelected;
3373
3409
  }))) {
3410
+ console.log('RULED OUT: CONTEXT');
3374
3411
  return;
3375
3412
  }
3376
3413
  // Subcontext doesn't match
@@ -3383,17 +3420,15 @@ const LogReviewer = (props) => {
3383
3420
  && contextFilterState[log.context] !== true)
3384
3421
  // Subcontext is not selected
3385
3422
  && !contextFilterState[log.context][log.subcontext]) {
3423
+ console.log('RULED OUT: SUBCONTEXT');
3386
3424
  return;
3387
3425
  }
3388
3426
  /* -------------- Tags -------------- */
3389
3427
  // No tags match
3390
- if (
3391
- // Log has at least one tag
3392
- log.tags.length > 0
3393
- // No tags match
3394
- && (log.tags.every((tag) => {
3395
- return !tagFilterState[tag];
3396
- }))) {
3428
+ if (log.tags.every((tag) => {
3429
+ return !tagFilterState[tag];
3430
+ })) {
3431
+ console.log('RULED OUT: TAGS');
3397
3432
  return;
3398
3433
  }
3399
3434
  /* ------- Actions and Errors ------- */
@@ -3403,6 +3438,7 @@ const LogReviewer = (props) => {
3403
3438
  actionErrorFilterState.type !== undefined
3404
3439
  // Log type doesn't match
3405
3440
  && actionErrorFilterState.type !== log.type) {
3441
+ console.log('RULED OUT: TYPE');
3406
3442
  return;
3407
3443
  }
3408
3444
  // Filter errors
@@ -3415,6 +3451,7 @@ const LogReviewer = (props) => {
3415
3451
  && actionErrorFilterState.errorMessage.trim().length > 0
3416
3452
  // Message doesn't match
3417
3453
  && log.errorMessage.toLowerCase().includes(actionErrorFilterState.errorMessage.trim().toLowerCase())) {
3454
+ console.log('RULED OUT: ERROR MESSAGE');
3418
3455
  return;
3419
3456
  }
3420
3457
  // Code doesn't match
@@ -3425,6 +3462,7 @@ const LogReviewer = (props) => {
3425
3462
  && actionErrorFilterState.errorCode.trim().length > 0
3426
3463
  // Code doesn't match
3427
3464
  && log.errorCode.toUpperCase().includes(actionErrorFilterState.errorCode.trim().toUpperCase())) {
3465
+ console.log('RULED OUT: ERROR CODE');
3428
3466
  return;
3429
3467
  }
3430
3468
  }
@@ -3436,6 +3474,7 @@ const LogReviewer = (props) => {
3436
3474
  log.target
3437
3475
  // Target isn't selected
3438
3476
  && !actionErrorFilterState.target[log.target]) {
3477
+ console.log('RULED OUT: TARGET');
3439
3478
  return;
3440
3479
  }
3441
3480
  // Action
@@ -3444,6 +3483,7 @@ const LogReviewer = (props) => {
3444
3483
  log.action
3445
3484
  // Action isn't selected
3446
3485
  && !actionErrorFilterState.action[log.action]) {
3486
+ console.log('RULED OUT: ACTION');
3447
3487
  return;
3448
3488
  }
3449
3489
  }
@@ -3454,6 +3494,7 @@ const LogReviewer = (props) => {
3454
3494
  log.userFirstName
3455
3495
  // First name query doesn't match
3456
3496
  && !log.userFirstName.toLowerCase().includes(advancedFilterState.userFirstName.toLowerCase().trim())) {
3497
+ console.log('RULED OUT: FIRST');
3457
3498
  return;
3458
3499
  }
3459
3500
  // Last name doesn't match
@@ -3462,6 +3503,7 @@ const LogReviewer = (props) => {
3462
3503
  log.userLastName
3463
3504
  // Last name query doesn't match
3464
3505
  && !log.userLastName.toLowerCase().includes(advancedFilterState.userLastName.toLowerCase().trim())) {
3506
+ console.log('RULED OUT: LAST');
3465
3507
  return;
3466
3508
  }
3467
3509
  // Email doesn't match
@@ -3470,6 +3512,7 @@ const LogReviewer = (props) => {
3470
3512
  log.userEmail
3471
3513
  // Email query doesn't match
3472
3514
  && !log.userEmail.toLowerCase().includes(advancedFilterState.userEmail.toLowerCase().trim())) {
3515
+ console.log('RULED OUT: EMAIL');
3473
3516
  return;
3474
3517
  }
3475
3518
  // User id doesn't match
@@ -3478,6 +3521,7 @@ const LogReviewer = (props) => {
3478
3521
  log.userId
3479
3522
  // User id doesn't match
3480
3523
  && !String(log.userId).includes(advancedFilterState.userId.trim())) {
3524
+ console.log('RULED OUT: USER ID');
3481
3525
  return;
3482
3526
  }
3483
3527
  // Learner not allowed
@@ -3486,6 +3530,7 @@ const LogReviewer = (props) => {
3486
3530
  log.isLearner
3487
3531
  // Learners aren't included
3488
3532
  && !advancedFilterState.includeLearners) {
3533
+ console.log('RULED OUT: LEARNER');
3489
3534
  return;
3490
3535
  }
3491
3536
  // TTM not allowed
@@ -3494,6 +3539,7 @@ const LogReviewer = (props) => {
3494
3539
  log.isTTM
3495
3540
  // TTMs aren't included
3496
3541
  && !advancedFilterState.includeTTMs) {
3542
+ console.log('RULED OUT: TTM');
3497
3543
  return;
3498
3544
  }
3499
3545
  // Admin not allowed
@@ -3502,6 +3548,7 @@ const LogReviewer = (props) => {
3502
3548
  log.isAdmin
3503
3549
  // Admins aren't included
3504
3550
  && !advancedFilterState.includeAdmins) {
3551
+ console.log('RULED OUT: ADMIN');
3505
3552
  return;
3506
3553
  }
3507
3554
  // Course Id doesn't match
@@ -3510,6 +3557,7 @@ const LogReviewer = (props) => {
3510
3557
  log.courseId
3511
3558
  // Course Id doesn't match
3512
3559
  && !String(log.courseId).includes(advancedFilterState.courseId.trim())) {
3560
+ console.log('RULED OUT: COURSE ID');
3513
3561
  return;
3514
3562
  }
3515
3563
  // Course name doesn't match
@@ -3518,6 +3566,7 @@ const LogReviewer = (props) => {
3518
3566
  log.courseName
3519
3567
  // Course name doesn't match
3520
3568
  && !String(log.courseName).includes(advancedFilterState.courseName.trim())) {
3569
+ console.log('RULED OUT: COURSE NAME');
3521
3570
  return;
3522
3571
  }
3523
3572
  // Mobile filter doesn't match
@@ -3528,6 +3577,7 @@ const LogReviewer = (props) => {
3528
3577
  && log.device
3529
3578
  // Mobile filter doesn't match
3530
3579
  && (advancedFilterState.isMobile === log.device.isMobile)) {
3580
+ console.log('RULED OUT: MOBILE');
3531
3581
  return;
3532
3582
  }
3533
3583
  // Log source doesn't match
@@ -3538,6 +3588,7 @@ const LogReviewer = (props) => {
3538
3588
  && log.source
3539
3589
  // Source filter doesn't match
3540
3590
  && (advancedFilterState.source !== log.source)) {
3591
+ console.log('RULED OUT: SOURCE');
3541
3592
  return;
3542
3593
  }
3543
3594
  // Route path doesn't match (Only for server source)
@@ -3548,6 +3599,7 @@ const LogReviewer = (props) => {
3548
3599
  && (advancedFilterState.routePath.trim().length)
3549
3600
  // Route path doesn't match
3550
3601
  && !(log.routePath.includes(advancedFilterState.routePath.trim()))) {
3602
+ console.log('RULED OUT: PATH');
3551
3603
  return;
3552
3604
  }
3553
3605
  // Route template doesn't match (Only for server source)
@@ -3558,6 +3610,7 @@ const LogReviewer = (props) => {
3558
3610
  && (advancedFilterState.routeTemplate.trim().length)
3559
3611
  // Route template doesn't match
3560
3612
  && !(log.routeTemplate.includes(advancedFilterState.routeTemplate.trim()))) {
3613
+ console.log('RULED OUT: TEMPLATE');
3561
3614
  return;
3562
3615
  }
3563
3616
  /* -------------- Done -------------- */