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