dce-reactkit 3.2.2-beta.44 → 3.2.2-beta.46

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
@@ -2345,6 +2345,10 @@ var ActionType$1;
2345
2345
  ActionType["UpdateColumnVisibility"] = "update-column-visibility";
2346
2346
  // Toggle the column visibility customization modal
2347
2347
  ActionType["ToggleColVisCusModalVisibility"] = "toggle-col-vis-cus-modal-visibility";
2348
+ // Show all columns
2349
+ ActionType["ShowAllColumns"] = "show-all-columns";
2350
+ // Hide all columns
2351
+ ActionType["HideAllColumns"] = "hide-all-columns";
2348
2352
  })(ActionType$1 || (ActionType$1 = {}));
2349
2353
  /**
2350
2354
  * Reducer that executes actions
@@ -2374,6 +2378,20 @@ const reducer$1 = (state, action) => {
2374
2378
  case ActionType$1.ToggleColVisCusModalVisibility: {
2375
2379
  return Object.assign(Object.assign({}, state), { columnVisibilityCustomizationModalVisible: !state.columnVisibilityCustomizationModalVisible });
2376
2380
  }
2381
+ case ActionType$1.ShowAllColumns: {
2382
+ const { columnVisibilityMap } = state;
2383
+ Object.keys(columnVisibilityMap).forEach((param) => {
2384
+ columnVisibilityMap[param] = true;
2385
+ });
2386
+ return Object.assign(Object.assign({}, state), { columnVisibilityMap });
2387
+ }
2388
+ case ActionType$1.HideAllColumns: {
2389
+ const { columnVisibilityMap } = state;
2390
+ Object.keys(columnVisibilityMap).forEach((param) => {
2391
+ columnVisibilityMap[param] = false;
2392
+ });
2393
+ return Object.assign(Object.assign({}, state), { columnVisibilityMap });
2394
+ }
2377
2395
  default: {
2378
2396
  return state;
2379
2397
  }
@@ -2429,18 +2447,37 @@ const IntelliTable = (props) => {
2429
2447
  if (columnVisibilityCustomizationModalVisible) {
2430
2448
  // Create modal
2431
2449
  modal = (React__default["default"].createElement(Modal, { type: ModalType$1.Okay, title: "Choose columns to show:", onClose: () => {
2450
+ const noColumnsSelected = (Object.values(columnVisibilityMap)
2451
+ .every((isSelected) => {
2452
+ return !isSelected;
2453
+ }));
2454
+ if (noColumnsSelected) {
2455
+ return alert$1('Choose at least one column', 'To continue, you have to choose at least one column to show');
2456
+ }
2432
2457
  dispatch({
2433
2458
  type: ActionType$1.ToggleColVisCusModalVisibility,
2434
2459
  });
2435
- }, okayVariant: Variant$1.Light }, columns.map((column) => {
2436
- return (React__default["default"].createElement(CheckboxButton, { key: column.param, id: `IntelliTable-${id}-toggle-visibility-${column.param}`, className: "mb-2", text: column.title, onChanged: (checked) => {
2460
+ }, okayVariant: Variant$1.Light },
2461
+ columns.map((column) => {
2462
+ return (React__default["default"].createElement(CheckboxButton, { key: column.param, id: `IntelliTable-${id}-toggle-visibility-${column.param}`, className: "mb-2", text: column.title, onChanged: (checked) => {
2463
+ dispatch({
2464
+ type: ActionType$1.UpdateColumnVisibility,
2465
+ param: column.param,
2466
+ visible: checked,
2467
+ });
2468
+ }, checked: columnVisibilityMap[column.param], ariaLabel: `show "${column.title}" column in the ${title} table`, checkedVariant: Variant$1.Light, uncheckedVariant: Variant$1.Secondary }));
2469
+ }),
2470
+ React__default["default"].createElement("div", { className: "mt-3" }, "Or you can:"),
2471
+ React__default["default"].createElement("button", { type: "button", id: `IntelliTable-${id}-select-all-columns`, className: "btn btn-secondary me-2", "aria-label": `show all columns in the ${title} table`, onClick: () => {
2472
+ dispatch({
2473
+ type: ActionType$1.ShowAllColumns,
2474
+ });
2475
+ } }, "Select All"),
2476
+ React__default["default"].createElement("button", { type: "button", id: `IntelliTable-${id}-select-none-columns`, className: "btn btn-secondary", "aria-label": `hide all columns in the ${title} table`, onClick: () => {
2437
2477
  dispatch({
2438
- type: ActionType$1.UpdateColumnVisibility,
2439
- param: column.param,
2440
- visible: checked,
2478
+ type: ActionType$1.HideAllColumns,
2441
2479
  });
2442
- }, checked: columnVisibilityMap[column.param], ariaLabel: `show "${column.title}" column`, checkedVariant: Variant$1.Light, uncheckedVariant: Variant$1.Secondary }));
2443
- })));
2480
+ } }, "Deselect All")));
2444
2481
  }
2445
2482
  /*----------------------------------------*/
2446
2483
  /* Main UI */
@@ -2666,7 +2703,9 @@ const IntelliTable = (props) => {
2666
2703
  })
2667
2704
  .length);
2668
2705
  // Build CSV
2669
- const csv = genCSV(data, columns);
2706
+ const csv = genCSV(data, columns.filter((column) => {
2707
+ return columnVisibilityMap[column.param];
2708
+ }));
2670
2709
  // Build main UI
2671
2710
  return (React__default["default"].createElement("div", { className: `IntelliTable-container-${id}` },
2672
2711
  modal,
@@ -2792,6 +2831,195 @@ const style = `
2792
2831
  }
2793
2832
  `;
2794
2833
  /*------------------------------------------------------------------------*/
2834
+ /* Constants */
2835
+ /*------------------------------------------------------------------------*/
2836
+ const columns = [
2837
+ {
2838
+ title: 'First Name',
2839
+ param: 'userFirstName',
2840
+ type: ParamType$1.String,
2841
+ },
2842
+ {
2843
+ title: 'Last Name',
2844
+ param: 'userLastName',
2845
+ type: ParamType$1.String,
2846
+ },
2847
+ {
2848
+ title: 'Email',
2849
+ param: 'userEmail',
2850
+ type: ParamType$1.String,
2851
+ },
2852
+ {
2853
+ title: 'Canvas Id',
2854
+ param: 'userId',
2855
+ type: ParamType$1.Int,
2856
+ },
2857
+ {
2858
+ title: 'Student?',
2859
+ param: 'isLearner',
2860
+ type: ParamType$1.Boolean,
2861
+ },
2862
+ {
2863
+ title: 'Teaching Staff?',
2864
+ param: 'isTTM',
2865
+ type: ParamType$1.Boolean,
2866
+ startsHidden: true,
2867
+ },
2868
+ {
2869
+ title: 'Admin?',
2870
+ param: 'isAdmin',
2871
+ type: ParamType$1.Boolean,
2872
+ startsHidden: true,
2873
+ },
2874
+ {
2875
+ title: 'Course Canvas Id',
2876
+ param: 'courseId',
2877
+ type: ParamType$1.Int,
2878
+ startsHidden: true,
2879
+ },
2880
+ {
2881
+ title: 'Course Name',
2882
+ param: 'courseName',
2883
+ type: ParamType$1.String,
2884
+ },
2885
+ {
2886
+ title: 'Browser Name',
2887
+ param: 'browser.name',
2888
+ type: ParamType$1.String,
2889
+ startsHidden: true,
2890
+ },
2891
+ {
2892
+ title: 'Browser Version',
2893
+ param: 'browser.version',
2894
+ type: ParamType$1.String,
2895
+ startsHidden: true,
2896
+ },
2897
+ {
2898
+ title: 'OS',
2899
+ param: 'device.os',
2900
+ type: ParamType$1.String,
2901
+ startsHidden: true,
2902
+ },
2903
+ {
2904
+ title: 'Mobile?',
2905
+ param: 'device.isMobile',
2906
+ type: ParamType$1.Boolean,
2907
+ startsHidden: true,
2908
+ },
2909
+ {
2910
+ title: 'Year',
2911
+ param: 'year',
2912
+ type: ParamType$1.Int,
2913
+ },
2914
+ {
2915
+ title: 'Month',
2916
+ param: 'month',
2917
+ type: ParamType$1.Int,
2918
+ },
2919
+ {
2920
+ title: 'Day',
2921
+ param: 'day',
2922
+ type: ParamType$1.Int,
2923
+ },
2924
+ {
2925
+ title: 'Hour',
2926
+ param: 'hour',
2927
+ type: ParamType$1.Int,
2928
+ },
2929
+ {
2930
+ title: 'Minute',
2931
+ param: 'minute',
2932
+ type: ParamType$1.Int,
2933
+ startsHidden: true,
2934
+ },
2935
+ {
2936
+ title: 'Timestamp',
2937
+ param: 'timestamp',
2938
+ type: ParamType$1.Int,
2939
+ startsHidden: true,
2940
+ },
2941
+ {
2942
+ title: 'Context',
2943
+ param: 'context',
2944
+ type: ParamType$1.String,
2945
+ },
2946
+ {
2947
+ title: 'Subcontext',
2948
+ param: 'subcontext',
2949
+ type: ParamType$1.String,
2950
+ },
2951
+ {
2952
+ title: 'Tags',
2953
+ param: 'tags',
2954
+ type: ParamType$1.JSON,
2955
+ startsHidden: true,
2956
+ },
2957
+ {
2958
+ title: 'Log Level',
2959
+ param: 'level',
2960
+ type: ParamType$1.String,
2961
+ startsHidden: true,
2962
+ },
2963
+ {
2964
+ title: 'Metadata',
2965
+ param: 'metadata',
2966
+ type: ParamType$1.JSON,
2967
+ startsHidden: true,
2968
+ },
2969
+ {
2970
+ title: 'Source',
2971
+ param: 'source',
2972
+ type: ParamType$1.String,
2973
+ },
2974
+ {
2975
+ title: 'Server Route Path',
2976
+ param: 'routePath',
2977
+ type: ParamType$1.String,
2978
+ startsHidden: true,
2979
+ },
2980
+ {
2981
+ title: 'Server Route Template',
2982
+ param: 'routeTemplate',
2983
+ type: ParamType$1.String,
2984
+ startsHidden: true,
2985
+ },
2986
+ {
2987
+ title: 'Type',
2988
+ param: 'type',
2989
+ type: ParamType$1.String,
2990
+ },
2991
+ {
2992
+ title: 'Error Message',
2993
+ param: 'errorMessage',
2994
+ type: ParamType$1.String,
2995
+ startsHidden: true,
2996
+ },
2997
+ {
2998
+ title: 'Error Code',
2999
+ param: 'errorCode',
3000
+ type: ParamType$1.String,
3001
+ startsHidden: true,
3002
+ },
3003
+ {
3004
+ title: 'Error Stack',
3005
+ param: 'errorStack',
3006
+ type: ParamType$1.String,
3007
+ startsHidden: true,
3008
+ },
3009
+ {
3010
+ title: 'Action Target',
3011
+ param: 'target',
3012
+ type: ParamType$1.String,
3013
+ startsHidden: true,
3014
+ },
3015
+ {
3016
+ title: 'Action Type',
3017
+ param: 'action',
3018
+ type: ParamType$1.String,
3019
+ startsHidden: true,
3020
+ },
3021
+ ];
3022
+ /*------------------------------------------------------------------------*/
2795
3023
  /* Static Functions */
2796
3024
  /*------------------------------------------------------------------------*/
2797
3025
  /**
@@ -3789,193 +4017,6 @@ const LogReviewer = (props) => {
3789
4017
  /*----------------------------------------*/
3790
4018
  /* Data */
3791
4019
  /*----------------------------------------*/
3792
- // Create data table
3793
- const columns = [
3794
- {
3795
- title: 'First Name',
3796
- param: 'userFirstName',
3797
- type: ParamType$1.String,
3798
- },
3799
- {
3800
- title: 'Last Name',
3801
- param: 'userLastName',
3802
- type: ParamType$1.String,
3803
- },
3804
- {
3805
- title: 'Email',
3806
- param: 'userEmail',
3807
- type: ParamType$1.String,
3808
- },
3809
- {
3810
- title: 'Canvas Id',
3811
- param: 'userId',
3812
- type: ParamType$1.Int,
3813
- },
3814
- {
3815
- title: 'Student?',
3816
- param: 'isLearner',
3817
- type: ParamType$1.Boolean,
3818
- },
3819
- {
3820
- title: 'Teaching Staff?',
3821
- param: 'isTTM',
3822
- type: ParamType$1.Boolean,
3823
- startsHidden: true,
3824
- },
3825
- {
3826
- title: 'Admin?',
3827
- param: 'isAdmin',
3828
- type: ParamType$1.Boolean,
3829
- startsHidden: true,
3830
- },
3831
- {
3832
- title: 'Course Canvas Id',
3833
- param: 'courseId',
3834
- type: ParamType$1.Int,
3835
- startsHidden: true,
3836
- },
3837
- {
3838
- title: 'Course Name',
3839
- param: 'courseName',
3840
- type: ParamType$1.String,
3841
- },
3842
- {
3843
- title: 'Browser Name',
3844
- param: 'browser.name',
3845
- type: ParamType$1.String,
3846
- startsHidden: true,
3847
- },
3848
- {
3849
- title: 'Browser Version',
3850
- param: 'browser.version',
3851
- type: ParamType$1.String,
3852
- startsHidden: true,
3853
- },
3854
- {
3855
- title: 'OS',
3856
- param: 'device.os',
3857
- type: ParamType$1.String,
3858
- startsHidden: true,
3859
- },
3860
- {
3861
- title: 'Mobile?',
3862
- param: 'device.isMobile',
3863
- type: ParamType$1.Boolean,
3864
- startsHidden: true,
3865
- },
3866
- {
3867
- title: 'Year',
3868
- param: 'year',
3869
- type: ParamType$1.Int,
3870
- },
3871
- {
3872
- title: 'Month',
3873
- param: 'month',
3874
- type: ParamType$1.Int,
3875
- },
3876
- {
3877
- title: 'Day',
3878
- param: 'day',
3879
- type: ParamType$1.Int,
3880
- },
3881
- {
3882
- title: 'Hour',
3883
- param: 'hour',
3884
- type: ParamType$1.Int,
3885
- },
3886
- {
3887
- title: 'Minute',
3888
- param: 'minute',
3889
- type: ParamType$1.Int,
3890
- startsHidden: true,
3891
- },
3892
- {
3893
- title: 'Timestamp',
3894
- param: 'timestamp',
3895
- type: ParamType$1.Int,
3896
- startsHidden: true,
3897
- },
3898
- {
3899
- title: 'Context',
3900
- param: 'context',
3901
- type: ParamType$1.String,
3902
- },
3903
- {
3904
- title: 'Subcontext',
3905
- param: 'subcontext',
3906
- type: ParamType$1.String,
3907
- },
3908
- {
3909
- title: 'Tags',
3910
- param: 'tags',
3911
- type: ParamType$1.JSON,
3912
- startsHidden: true,
3913
- },
3914
- {
3915
- title: 'Log Level',
3916
- param: 'level',
3917
- type: ParamType$1.String,
3918
- startsHidden: true,
3919
- },
3920
- {
3921
- title: 'Metadata',
3922
- param: 'metadata',
3923
- type: ParamType$1.JSON,
3924
- startsHidden: true,
3925
- },
3926
- {
3927
- title: 'Source',
3928
- param: 'source',
3929
- type: ParamType$1.String,
3930
- },
3931
- {
3932
- title: 'Server Route Path',
3933
- param: 'routePath',
3934
- type: ParamType$1.String,
3935
- startsHidden: true,
3936
- },
3937
- {
3938
- title: 'Server Route Template',
3939
- param: 'routeTemplate',
3940
- type: ParamType$1.String,
3941
- startsHidden: true,
3942
- },
3943
- {
3944
- title: 'Type',
3945
- param: 'type',
3946
- type: ParamType$1.String,
3947
- },
3948
- {
3949
- title: 'Error Message',
3950
- param: 'errorMessage',
3951
- type: ParamType$1.String,
3952
- startsHidden: true,
3953
- },
3954
- {
3955
- title: 'Error Code',
3956
- param: 'errorCode',
3957
- type: ParamType$1.String,
3958
- startsHidden: true,
3959
- },
3960
- {
3961
- title: 'Error Stack',
3962
- param: 'errorStack',
3963
- type: ParamType$1.String,
3964
- startsHidden: true,
3965
- },
3966
- {
3967
- title: 'Action Target',
3968
- param: 'target',
3969
- type: ParamType$1.String,
3970
- startsHidden: true,
3971
- },
3972
- {
3973
- title: 'Action Type',
3974
- param: 'action',
3975
- type: ParamType$1.String,
3976
- startsHidden: true,
3977
- },
3978
- ];
3979
4020
  // Nothing to show notice
3980
4021
  const noLogsNotice = (logs.length === 0
3981
4022
  ? (React__default["default"].createElement("div", { className: "alert alert-warning text-center mt-2" },