dce-reactkit 3.8.5 → 3.8.7
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 +282 -135
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/helpers/visitEndpointOnAnotherServer/index.d.ts +22 -0
- package/dist/cjs/types/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.d.ts +33 -0
- package/dist/cjs/types/index.d.ts +3 -1
- package/dist/cjs/types/types/ReactKitErrorCode.d.ts +4 -1
- package/dist/esm/index.js +281 -136
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/helpers/visitEndpointOnAnotherServer/index.d.ts +22 -0
- package/dist/esm/types/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.d.ts +33 -0
- package/dist/esm/types/index.d.ts +3 -1
- package/dist/esm/types/types/ReactKitErrorCode.d.ts +4 -1
- package/dist/index.d.ts +83 -44
- package/package.json +2 -1
- package/src/helpers/visitEndpointOnAnotherServer/index.ts +90 -0
- package/src/helpers/visitEndpointOnAnotherServer/sendServerToServerRequest.ts +164 -0
- package/src/index.ts +4 -0
- package/src/types/ReactKitErrorCode.tsx +6 -1
package/dist/cjs/index.js
CHANGED
|
@@ -57,7 +57,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
// Highest error code =
|
|
60
|
+
// Highest error code = DRK16
|
|
61
61
|
/**
|
|
62
62
|
* List of error codes built into the react kit
|
|
63
63
|
* @author Gabe Abrams
|
|
@@ -77,6 +77,10 @@ var ReactKitErrorCode;
|
|
|
77
77
|
ReactKitErrorCode["NotAllowedToReviewLogs"] = "DRK11";
|
|
78
78
|
ReactKitErrorCode["ThemeCheckedBeforeReactKitReady"] = "DRK12";
|
|
79
79
|
ReactKitErrorCode["SessionExpiredMessageGottenBeforeReactKitReady"] = "DRK13";
|
|
80
|
+
// Server-to-server requests
|
|
81
|
+
ReactKitErrorCode["NotConnected"] = "DRK14";
|
|
82
|
+
ReactKitErrorCode["SelfSigned"] = "DRK15";
|
|
83
|
+
ReactKitErrorCode["ResponseParseError"] = "DRK16";
|
|
80
84
|
})(ReactKitErrorCode || (ReactKitErrorCode = {}));
|
|
81
85
|
var ReactKitErrorCode$1 = ReactKitErrorCode;
|
|
82
86
|
|
|
@@ -2237,27 +2241,27 @@ const PopPendingMark = (props) => {
|
|
|
2237
2241
|
*/
|
|
2238
2242
|
/* ------------- Actions ------------ */
|
|
2239
2243
|
// Types of actions
|
|
2240
|
-
var ActionType$
|
|
2244
|
+
var ActionType$9;
|
|
2241
2245
|
(function (ActionType) {
|
|
2242
2246
|
// Indicate that the text was recently copied
|
|
2243
2247
|
ActionType["IndicateRecentlyCopied"] = "indicate-recently-copied";
|
|
2244
2248
|
// Clear the status
|
|
2245
2249
|
ActionType["ClearRecentlyCopiedStatus"] = "clear-recently-copied-status";
|
|
2246
|
-
})(ActionType$
|
|
2250
|
+
})(ActionType$9 || (ActionType$9 = {}));
|
|
2247
2251
|
/**
|
|
2248
2252
|
* Reducer that executes actions
|
|
2249
2253
|
* @author Gabe Abrams
|
|
2250
2254
|
* @param state current state
|
|
2251
2255
|
* @param action action to execute
|
|
2252
2256
|
*/
|
|
2253
|
-
const reducer$
|
|
2257
|
+
const reducer$a = (state, action) => {
|
|
2254
2258
|
switch (action.type) {
|
|
2255
|
-
case ActionType$
|
|
2259
|
+
case ActionType$9.IndicateRecentlyCopied: {
|
|
2256
2260
|
return {
|
|
2257
2261
|
recentlyCopied: true,
|
|
2258
2262
|
};
|
|
2259
2263
|
}
|
|
2260
|
-
case ActionType$
|
|
2264
|
+
case ActionType$9.ClearRecentlyCopiedStatus: {
|
|
2261
2265
|
return {
|
|
2262
2266
|
recentlyCopied: false,
|
|
2263
2267
|
};
|
|
@@ -2283,7 +2287,7 @@ const CopiableBox = (props) => {
|
|
|
2283
2287
|
recentlyCopied: false,
|
|
2284
2288
|
};
|
|
2285
2289
|
// Initialize state
|
|
2286
|
-
const [state, dispatch] = React.useReducer(reducer$
|
|
2290
|
+
const [state, dispatch] = React.useReducer(reducer$a, initialState);
|
|
2287
2291
|
// Destructure common state
|
|
2288
2292
|
const { recentlyCopied, } = state;
|
|
2289
2293
|
/*------------------------------------------------------------------------*/
|
|
@@ -2303,13 +2307,13 @@ const CopiableBox = (props) => {
|
|
|
2303
2307
|
}
|
|
2304
2308
|
// Show copied notice
|
|
2305
2309
|
dispatch({
|
|
2306
|
-
type: ActionType$
|
|
2310
|
+
type: ActionType$9.IndicateRecentlyCopied,
|
|
2307
2311
|
});
|
|
2308
2312
|
// Wait a moment
|
|
2309
2313
|
yield waitMs(4000);
|
|
2310
2314
|
// Hide copied notice
|
|
2311
2315
|
dispatch({
|
|
2312
|
-
type: ActionType$
|
|
2316
|
+
type: ActionType$9.ClearRecentlyCopiedStatus,
|
|
2313
2317
|
});
|
|
2314
2318
|
});
|
|
2315
2319
|
/*------------------------------------------------------------------------*/
|
|
@@ -2365,20 +2369,20 @@ const CopiableBox = (props) => {
|
|
|
2365
2369
|
*/
|
|
2366
2370
|
/* ------------- Actions ------------ */
|
|
2367
2371
|
// Types of actions
|
|
2368
|
-
var ActionType$
|
|
2372
|
+
var ActionType$8;
|
|
2369
2373
|
(function (ActionType) {
|
|
2370
2374
|
// Toggle whether a child are being shown
|
|
2371
2375
|
ActionType["ToggleChild"] = "toggle-child";
|
|
2372
|
-
})(ActionType$
|
|
2376
|
+
})(ActionType$8 || (ActionType$8 = {}));
|
|
2373
2377
|
/**
|
|
2374
2378
|
* Reducer that executes actions
|
|
2375
2379
|
* @author Gabe Abrams
|
|
2376
2380
|
* @param state current state
|
|
2377
2381
|
* @param action action to execute
|
|
2378
2382
|
*/
|
|
2379
|
-
const reducer$
|
|
2383
|
+
const reducer$9 = (state, action) => {
|
|
2380
2384
|
switch (action.type) {
|
|
2381
|
-
case ActionType$
|
|
2385
|
+
case ActionType$8.ToggleChild: {
|
|
2382
2386
|
return Object.assign(Object.assign({}, state), { childExpanded: Object.assign(Object.assign({}, state.childExpanded), { [String(action.id)]: !state.childExpanded[String(action.id)] }) });
|
|
2383
2387
|
}
|
|
2384
2388
|
default: {
|
|
@@ -2407,7 +2411,7 @@ const NestableItemList = (props) => {
|
|
|
2407
2411
|
childExpanded: initChildExpanded,
|
|
2408
2412
|
};
|
|
2409
2413
|
// Initialize state
|
|
2410
|
-
const [state, dispatch] = React.useReducer(reducer$
|
|
2414
|
+
const [state, dispatch] = React.useReducer(reducer$9, initialState);
|
|
2411
2415
|
// Destructure common state
|
|
2412
2416
|
const { childExpanded, } = state;
|
|
2413
2417
|
/*------------------------------------------------------------------------*/
|
|
@@ -2497,7 +2501,7 @@ const NestableItemList = (props) => {
|
|
|
2497
2501
|
backgroundColor: 'transparent',
|
|
2498
2502
|
}, type: "button", onClick: () => {
|
|
2499
2503
|
dispatch({
|
|
2500
|
-
type: ActionType$
|
|
2504
|
+
type: ActionType$8.ToggleChild,
|
|
2501
2505
|
id: item.id,
|
|
2502
2506
|
});
|
|
2503
2507
|
}, "aria-label": `${childExpanded[item.id] ? 'Hide' : 'Show'} items in ${item.name}` },
|
|
@@ -2781,7 +2785,7 @@ var SortType;
|
|
|
2781
2785
|
})(SortType || (SortType = {}));
|
|
2782
2786
|
/* ------------- Actions ------------ */
|
|
2783
2787
|
// Types of actions
|
|
2784
|
-
var ActionType$
|
|
2788
|
+
var ActionType$7;
|
|
2785
2789
|
(function (ActionType) {
|
|
2786
2790
|
// Toggle sort column param
|
|
2787
2791
|
ActionType["ToggleSortColumn"] = "toggle-sort-column";
|
|
@@ -2793,16 +2797,16 @@ var ActionType$6;
|
|
|
2793
2797
|
ActionType["ShowAllColumns"] = "show-all-columns";
|
|
2794
2798
|
// Hide all columns
|
|
2795
2799
|
ActionType["HideAllColumns"] = "hide-all-columns";
|
|
2796
|
-
})(ActionType$
|
|
2800
|
+
})(ActionType$7 || (ActionType$7 = {}));
|
|
2797
2801
|
/**
|
|
2798
2802
|
* Reducer that executes actions
|
|
2799
2803
|
* @author Gabe Abrams
|
|
2800
2804
|
* @param state current state
|
|
2801
2805
|
* @param action action to execute
|
|
2802
2806
|
*/
|
|
2803
|
-
const reducer$
|
|
2807
|
+
const reducer$8 = (state, action) => {
|
|
2804
2808
|
switch (action.type) {
|
|
2805
|
-
case ActionType$
|
|
2809
|
+
case ActionType$7.ToggleSortColumn: {
|
|
2806
2810
|
if (action.param !== state.sortColumnParam) {
|
|
2807
2811
|
// Different column param
|
|
2808
2812
|
return Object.assign(Object.assign({}, state), { sortColumnParam: action.param, sortType: SortType.Ascending });
|
|
@@ -2814,22 +2818,22 @@ const reducer$7 = (state, action) => {
|
|
|
2814
2818
|
// Stop sorting by column
|
|
2815
2819
|
return Object.assign(Object.assign({}, state), { sortColumnParam: undefined, sortType: SortType.Ascending });
|
|
2816
2820
|
}
|
|
2817
|
-
case ActionType$
|
|
2821
|
+
case ActionType$7.UpdateColumnVisibility: {
|
|
2818
2822
|
const { columnVisibilityMap } = state;
|
|
2819
2823
|
columnVisibilityMap[action.param] = action.visible;
|
|
2820
2824
|
return Object.assign(Object.assign({}, state), { columnVisibilityMap });
|
|
2821
2825
|
}
|
|
2822
|
-
case ActionType$
|
|
2826
|
+
case ActionType$7.ToggleColVisCusModalVisibility: {
|
|
2823
2827
|
return Object.assign(Object.assign({}, state), { columnVisibilityCustomizationModalVisible: !state.columnVisibilityCustomizationModalVisible });
|
|
2824
2828
|
}
|
|
2825
|
-
case ActionType$
|
|
2829
|
+
case ActionType$7.ShowAllColumns: {
|
|
2826
2830
|
const { columnVisibilityMap } = state;
|
|
2827
2831
|
Object.keys(columnVisibilityMap).forEach((param) => {
|
|
2828
2832
|
columnVisibilityMap[param] = true;
|
|
2829
2833
|
});
|
|
2830
2834
|
return Object.assign(Object.assign({}, state), { columnVisibilityMap });
|
|
2831
2835
|
}
|
|
2832
|
-
case ActionType$
|
|
2836
|
+
case ActionType$7.HideAllColumns: {
|
|
2833
2837
|
const { columnVisibilityMap } = state;
|
|
2834
2838
|
Object.keys(columnVisibilityMap).forEach((param) => {
|
|
2835
2839
|
columnVisibilityMap[param] = false;
|
|
@@ -2876,7 +2880,7 @@ const IntelliTable = (props) => {
|
|
|
2876
2880
|
columnVisibilityCustomizationModalVisible: false,
|
|
2877
2881
|
};
|
|
2878
2882
|
// Initialize state
|
|
2879
|
-
const [state, dispatch] = React.useReducer(reducer$
|
|
2883
|
+
const [state, dispatch] = React.useReducer(reducer$8, initialState);
|
|
2880
2884
|
// Destructure common state
|
|
2881
2885
|
const { sortColumnParam, sortType, columnVisibilityMap, columnVisibilityCustomizationModalVisible, } = state;
|
|
2882
2886
|
/*------------------------------------------------------------------------*/
|
|
@@ -2899,13 +2903,13 @@ const IntelliTable = (props) => {
|
|
|
2899
2903
|
return alert('Choose at least one column', 'To continue, you have to choose at least one column to show');
|
|
2900
2904
|
}
|
|
2901
2905
|
dispatch({
|
|
2902
|
-
type: ActionType$
|
|
2906
|
+
type: ActionType$7.ToggleColVisCusModalVisibility,
|
|
2903
2907
|
});
|
|
2904
2908
|
}, okayVariant: Variant$1.Light },
|
|
2905
2909
|
columns.map((column) => {
|
|
2906
2910
|
return (React__default["default"].createElement(CheckboxButton, { key: column.param, id: `IntelliTable-${id}-toggle-visibility-${column.param}`, className: "mb-2", text: column.title, onChanged: (checked) => {
|
|
2907
2911
|
dispatch({
|
|
2908
|
-
type: ActionType$
|
|
2912
|
+
type: ActionType$7.UpdateColumnVisibility,
|
|
2909
2913
|
param: column.param,
|
|
2910
2914
|
visible: checked,
|
|
2911
2915
|
});
|
|
@@ -2914,12 +2918,12 @@ const IntelliTable = (props) => {
|
|
|
2914
2918
|
React__default["default"].createElement("div", { className: "mt-3" }, "Or you can:"),
|
|
2915
2919
|
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: () => {
|
|
2916
2920
|
dispatch({
|
|
2917
|
-
type: ActionType$
|
|
2921
|
+
type: ActionType$7.ShowAllColumns,
|
|
2918
2922
|
});
|
|
2919
2923
|
} }, "Select All"),
|
|
2920
2924
|
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: () => {
|
|
2921
2925
|
dispatch({
|
|
2922
|
-
type: ActionType$
|
|
2926
|
+
type: ActionType$7.HideAllColumns,
|
|
2923
2927
|
});
|
|
2924
2928
|
} }, "Deselect All")));
|
|
2925
2929
|
}
|
|
@@ -2970,7 +2974,7 @@ const IntelliTable = (props) => {
|
|
|
2970
2974
|
React__default["default"].createElement("div", null,
|
|
2971
2975
|
React__default["default"].createElement("button", { type: "button", id: `IntelliTable-${id}-sort-by-${column.param}-button`, className: `btn btn-${sortingByThisColumn ? 'light' : 'secondary'} btn-sm ms-1 ps-1 pe-1 pt-0 pb-0`, "aria-label": sortButtonAriaLabel, onClick: () => {
|
|
2972
2976
|
dispatch({
|
|
2973
|
-
type: ActionType$
|
|
2977
|
+
type: ActionType$7.ToggleSortColumn,
|
|
2974
2978
|
param: column.param,
|
|
2975
2979
|
});
|
|
2976
2980
|
} },
|
|
@@ -3159,7 +3163,7 @@ const IntelliTable = (props) => {
|
|
|
3159
3163
|
React__default["default"].createElement(CSVDownloadButton, { "aria-label": `download data as csv for ${title}`, id: `IntelliTable-${id}-download-as-csv`, filename: filename, csv: csv }),
|
|
3160
3164
|
React__default["default"].createElement("button", { type: "button", className: "btn btn-secondary ms-2", "aria-label": `show panel for customizing which columns show in table ${title}`, id: `IntelliTable-${id}-show-column-customization-modal`, onClick: () => {
|
|
3161
3165
|
dispatch({
|
|
3162
|
-
type: ActionType$
|
|
3166
|
+
type: ActionType$7.ToggleColVisCusModalVisibility,
|
|
3163
3167
|
});
|
|
3164
3168
|
} },
|
|
3165
3169
|
"Show/Hide Cols",
|
|
@@ -3525,7 +3529,7 @@ const genHumanReadableName = (machineReadableName) => {
|
|
|
3525
3529
|
};
|
|
3526
3530
|
/* ------------- Actions ------------ */
|
|
3527
3531
|
// Types of actions
|
|
3528
|
-
var ActionType$
|
|
3532
|
+
var ActionType$6;
|
|
3529
3533
|
(function (ActionType) {
|
|
3530
3534
|
// Show the loading bar
|
|
3531
3535
|
ActionType["StartLoading"] = "start-loading";
|
|
@@ -3547,45 +3551,45 @@ var ActionType$5;
|
|
|
3547
3551
|
ActionType["UpdateActionErrorFilterState"] = "update-action-error-filter-state";
|
|
3548
3552
|
// Update the advanced filter state
|
|
3549
3553
|
ActionType["UpdateAdvancedFilterState"] = "update-advanced-filter-state";
|
|
3550
|
-
})(ActionType$
|
|
3554
|
+
})(ActionType$6 || (ActionType$6 = {}));
|
|
3551
3555
|
/**
|
|
3552
3556
|
* Reducer that executes actions
|
|
3553
3557
|
* @author Gabe Abrams
|
|
3554
3558
|
* @param state current state
|
|
3555
3559
|
* @param action action to execute
|
|
3556
3560
|
*/
|
|
3557
|
-
const reducer$
|
|
3561
|
+
const reducer$7 = (state, action) => {
|
|
3558
3562
|
switch (action.type) {
|
|
3559
|
-
case ActionType$
|
|
3563
|
+
case ActionType$6.StartLoading: {
|
|
3560
3564
|
return Object.assign(Object.assign({}, state), { loading: true });
|
|
3561
3565
|
}
|
|
3562
|
-
case ActionType$
|
|
3566
|
+
case ActionType$6.FinishLoading: {
|
|
3563
3567
|
return Object.assign(Object.assign({}, state), { loading: false, logMap: action.logMap });
|
|
3564
3568
|
}
|
|
3565
|
-
case ActionType$
|
|
3569
|
+
case ActionType$6.ToggleFilterDrawer: {
|
|
3566
3570
|
return Object.assign(Object.assign({}, state), { expandedFilterDrawer: (state.expandedFilterDrawer === action.filterDrawer
|
|
3567
3571
|
? undefined // hide
|
|
3568
3572
|
: action.filterDrawer) });
|
|
3569
3573
|
}
|
|
3570
|
-
case ActionType$
|
|
3574
|
+
case ActionType$6.HideFilterDrawer: {
|
|
3571
3575
|
return Object.assign(Object.assign({}, state), { expandedFilterDrawer: undefined });
|
|
3572
3576
|
}
|
|
3573
|
-
case ActionType$
|
|
3577
|
+
case ActionType$6.ResetFilters: {
|
|
3574
3578
|
return Object.assign(Object.assign({}, state), { dateFilterState: action.initDateFilterState, contextFilterState: action.initContextFilterState, tagFilterState: action.initTagFilterState, actionErrorFilterState: action.initActionErrorFilterState, advancedFilterState: action.initAdvancedFilterState });
|
|
3575
3579
|
}
|
|
3576
|
-
case ActionType$
|
|
3580
|
+
case ActionType$6.UpdateDateFilterState: {
|
|
3577
3581
|
return Object.assign(Object.assign({}, state), { dateFilterState: action.dateFilterState });
|
|
3578
3582
|
}
|
|
3579
|
-
case ActionType$
|
|
3583
|
+
case ActionType$6.UpdateContextFilterState: {
|
|
3580
3584
|
return Object.assign(Object.assign({}, state), { contextFilterState: action.contextFilterState });
|
|
3581
3585
|
}
|
|
3582
|
-
case ActionType$
|
|
3586
|
+
case ActionType$6.UpdateTagFilterState: {
|
|
3583
3587
|
return Object.assign(Object.assign({}, state), { tagFilterState: action.tagFilterState });
|
|
3584
3588
|
}
|
|
3585
|
-
case ActionType$
|
|
3589
|
+
case ActionType$6.UpdateActionErrorFilterState: {
|
|
3586
3590
|
return Object.assign(Object.assign({}, state), { actionErrorFilterState: action.actionErrorFilterState });
|
|
3587
3591
|
}
|
|
3588
|
-
case ActionType$
|
|
3592
|
+
case ActionType$6.UpdateAdvancedFilterState: {
|
|
3589
3593
|
return Object.assign(Object.assign({}, state), { advancedFilterState: action.advancedFilterState });
|
|
3590
3594
|
}
|
|
3591
3595
|
default: {
|
|
@@ -3714,7 +3718,7 @@ const LogReviewer = (props) => {
|
|
|
3714
3718
|
advancedFilterState: initAdvancedFilterState,
|
|
3715
3719
|
};
|
|
3716
3720
|
// Initialize state
|
|
3717
|
-
const [state, dispatch] = React.useReducer(reducer$
|
|
3721
|
+
const [state, dispatch] = React.useReducer(reducer$7, initialState);
|
|
3718
3722
|
// Destructure common state
|
|
3719
3723
|
const { loading, logMap, expandedFilterDrawer, dateFilterState, contextFilterState, tagFilterState, actionErrorFilterState, advancedFilterState, } = state;
|
|
3720
3724
|
/*------------------------------------------------------------------------*/
|
|
@@ -3764,7 +3768,7 @@ const LogReviewer = (props) => {
|
|
|
3764
3768
|
const handleDateRangeUpdated = (newDateFilterState) => __awaiter(void 0, void 0, void 0, function* () {
|
|
3765
3769
|
// Update state
|
|
3766
3770
|
dispatch({
|
|
3767
|
-
type: ActionType$
|
|
3771
|
+
type: ActionType$6.UpdateDateFilterState,
|
|
3768
3772
|
dateFilterState: newDateFilterState,
|
|
3769
3773
|
});
|
|
3770
3774
|
// Check which year/month combos we need to load
|
|
@@ -3775,7 +3779,7 @@ const LogReviewer = (props) => {
|
|
|
3775
3779
|
}
|
|
3776
3780
|
// Start loading
|
|
3777
3781
|
dispatch({
|
|
3778
|
-
type: ActionType$
|
|
3782
|
+
type: ActionType$6.StartLoading,
|
|
3779
3783
|
});
|
|
3780
3784
|
// Load required months
|
|
3781
3785
|
try {
|
|
@@ -3799,7 +3803,7 @@ const LogReviewer = (props) => {
|
|
|
3799
3803
|
}
|
|
3800
3804
|
// Finish loading
|
|
3801
3805
|
dispatch({
|
|
3802
|
-
type: ActionType$
|
|
3806
|
+
type: ActionType$6.FinishLoading,
|
|
3803
3807
|
logMap,
|
|
3804
3808
|
});
|
|
3805
3809
|
});
|
|
@@ -3838,7 +3842,7 @@ const LogReviewer = (props) => {
|
|
|
3838
3842
|
React__default["default"].createElement("div", { className: "LogReviewer-filter-toggle-buttons alert alert-secondary p-2 m-0" },
|
|
3839
3843
|
React__default["default"].createElement("button", { type: "button", id: "LogReviewer-toggle-date-filter-drawer", className: `btn btn-${FilterDrawer.Date === expandedFilterDrawer ? 'warning' : 'light'} me-2`, "aria-label": "toggle date filter drawer", onClick: () => {
|
|
3840
3844
|
dispatch({
|
|
3841
|
-
type: ActionType$
|
|
3845
|
+
type: ActionType$6.ToggleFilterDrawer,
|
|
3842
3846
|
filterDrawer: FilterDrawer.Date,
|
|
3843
3847
|
});
|
|
3844
3848
|
} },
|
|
@@ -3846,7 +3850,7 @@ const LogReviewer = (props) => {
|
|
|
3846
3850
|
"Date"),
|
|
3847
3851
|
React__default["default"].createElement("button", { type: "button", id: "LogReviewer-toggle-context-filter-drawer", className: `btn btn-${FilterDrawer.Context === expandedFilterDrawer ? 'warning' : 'light'} me-2`, "aria-label": "toggle context filter drawer", onClick: () => {
|
|
3848
3852
|
dispatch({
|
|
3849
|
-
type: ActionType$
|
|
3853
|
+
type: ActionType$6.ToggleFilterDrawer,
|
|
3850
3854
|
filterDrawer: FilterDrawer.Context,
|
|
3851
3855
|
});
|
|
3852
3856
|
} },
|
|
@@ -3854,7 +3858,7 @@ const LogReviewer = (props) => {
|
|
|
3854
3858
|
"Context"),
|
|
3855
3859
|
(LogMetadata.Tag && Object.keys(LogMetadata.Tag).length > 0) && (React__default["default"].createElement("button", { type: "button", id: "LogReviewer-toggle-tag-filter-drawer", className: `btn btn-${FilterDrawer.Tag === expandedFilterDrawer ? 'warning' : 'light'} me-2`, "aria-label": "toggle tag filter drawer", onClick: () => {
|
|
3856
3860
|
dispatch({
|
|
3857
|
-
type: ActionType$
|
|
3861
|
+
type: ActionType$6.ToggleFilterDrawer,
|
|
3858
3862
|
filterDrawer: FilterDrawer.Tag,
|
|
3859
3863
|
});
|
|
3860
3864
|
} },
|
|
@@ -3862,7 +3866,7 @@ const LogReviewer = (props) => {
|
|
|
3862
3866
|
"Tag")),
|
|
3863
3867
|
React__default["default"].createElement("button", { type: "button", id: "LogReviewer-toggle-action-filter-drawer", className: `btn btn-${FilterDrawer.Action === expandedFilterDrawer ? 'warning' : 'light'} me-2`, "aria-label": "toggle action and error filter drawer", onClick: () => {
|
|
3864
3868
|
dispatch({
|
|
3865
|
-
type: ActionType$
|
|
3869
|
+
type: ActionType$6.ToggleFilterDrawer,
|
|
3866
3870
|
filterDrawer: FilterDrawer.Action,
|
|
3867
3871
|
});
|
|
3868
3872
|
} },
|
|
@@ -3870,7 +3874,7 @@ const LogReviewer = (props) => {
|
|
|
3870
3874
|
"Action"),
|
|
3871
3875
|
React__default["default"].createElement("button", { type: "button", id: "LogReviewer-toggle-advanced-filter-drawer", className: `btn btn-${FilterDrawer.Advanced === expandedFilterDrawer ? 'warning' : 'light'} me-2`, "aria-label": "toggle advanced filter drawer", onClick: () => {
|
|
3872
3876
|
dispatch({
|
|
3873
|
-
type: ActionType$
|
|
3877
|
+
type: ActionType$6.ToggleFilterDrawer,
|
|
3874
3878
|
filterDrawer: FilterDrawer.Advanced,
|
|
3875
3879
|
});
|
|
3876
3880
|
} },
|
|
@@ -3878,7 +3882,7 @@ const LogReviewer = (props) => {
|
|
|
3878
3882
|
"Advanced"),
|
|
3879
3883
|
React__default["default"].createElement("button", { type: "button", id: "LogReviewer-reset-filters-button", className: "btn btn-light", "aria-label": "reset filters", onClick: () => {
|
|
3880
3884
|
dispatch({
|
|
3881
|
-
type: ActionType$
|
|
3885
|
+
type: ActionType$6.ResetFilters,
|
|
3882
3886
|
initActionErrorFilterState,
|
|
3883
3887
|
initAdvancedFilterState,
|
|
3884
3888
|
initContextFilterState,
|
|
@@ -4000,7 +4004,7 @@ const LogReviewer = (props) => {
|
|
|
4000
4004
|
}
|
|
4001
4005
|
});
|
|
4002
4006
|
dispatch({
|
|
4003
|
-
type: ActionType$
|
|
4007
|
+
type: ActionType$6.UpdateContextFilterState,
|
|
4004
4008
|
contextFilterState,
|
|
4005
4009
|
});
|
|
4006
4010
|
} }));
|
|
@@ -4015,7 +4019,7 @@ const LogReviewer = (props) => {
|
|
|
4015
4019
|
return (React__default["default"].createElement(CheckboxButton, { key: tag, id: `LogReviewer-tag-${tag}-checkbox`, text: description, ariaLabel: `require that logs be tagged with "${description}" or any other selected tag`, checked: tagFilterState[tag], onChanged: (checked) => {
|
|
4016
4020
|
tagFilterState[tag] = checked;
|
|
4017
4021
|
dispatch({
|
|
4018
|
-
type: ActionType$
|
|
4022
|
+
type: ActionType$6.UpdateTagFilterState,
|
|
4019
4023
|
tagFilterState,
|
|
4020
4024
|
});
|
|
4021
4025
|
} }));
|
|
@@ -4028,21 +4032,21 @@ const LogReviewer = (props) => {
|
|
|
4028
4032
|
React__default["default"].createElement(RadioButton, { id: "LogReviewer-type-all", text: "All Logs", onSelected: () => {
|
|
4029
4033
|
actionErrorFilterState.type = undefined;
|
|
4030
4034
|
dispatch({
|
|
4031
|
-
type: ActionType$
|
|
4035
|
+
type: ActionType$6.UpdateActionErrorFilterState,
|
|
4032
4036
|
actionErrorFilterState,
|
|
4033
4037
|
});
|
|
4034
4038
|
}, ariaLabel: "show logs of all types", selected: actionErrorFilterState.type === undefined }),
|
|
4035
4039
|
React__default["default"].createElement(RadioButton, { id: "LogReviewer-type-action-only", text: "Action Logs Only", onSelected: () => {
|
|
4036
4040
|
actionErrorFilterState.type = LogType$1.Action;
|
|
4037
4041
|
dispatch({
|
|
4038
|
-
type: ActionType$
|
|
4042
|
+
type: ActionType$6.UpdateActionErrorFilterState,
|
|
4039
4043
|
actionErrorFilterState,
|
|
4040
4044
|
});
|
|
4041
4045
|
}, ariaLabel: "only show action logs", selected: actionErrorFilterState.type === LogType$1.Action }),
|
|
4042
4046
|
React__default["default"].createElement(RadioButton, { id: "LogReviewer-type-error-only", text: "Action Error Only", onSelected: () => {
|
|
4043
4047
|
actionErrorFilterState.type = LogType$1.Error;
|
|
4044
4048
|
dispatch({
|
|
4045
|
-
type: ActionType$
|
|
4049
|
+
type: ActionType$6.UpdateActionErrorFilterState,
|
|
4046
4050
|
actionErrorFilterState,
|
|
4047
4051
|
});
|
|
4048
4052
|
}, ariaLabel: "only show error logs", selected: actionErrorFilterState.type === LogType$1.Error, noMarginOnRight: true })),
|
|
@@ -4054,7 +4058,7 @@ const LogReviewer = (props) => {
|
|
|
4054
4058
|
return (React__default["default"].createElement(CheckboxButton, { key: action, id: `LogReviewer-action-${action}-checkbox`, text: description, ariaLabel: `include logs with action type "${description}" in results`, noMarginOnRight: true, checked: actionErrorFilterState.action[action], onChanged: (checked) => {
|
|
4055
4059
|
actionErrorFilterState.action[action] = checked;
|
|
4056
4060
|
dispatch({
|
|
4057
|
-
type: ActionType$
|
|
4061
|
+
type: ActionType$6.UpdateActionErrorFilterState,
|
|
4058
4062
|
actionErrorFilterState,
|
|
4059
4063
|
});
|
|
4060
4064
|
} }));
|
|
@@ -4065,7 +4069,7 @@ const LogReviewer = (props) => {
|
|
|
4065
4069
|
return (React__default["default"].createElement(CheckboxButton, { key: target, id: `LogReviewer-target-${target}-checkbox`, text: description, ariaLabel: `include logs with target "${description}" in results`, checked: actionErrorFilterState.target[target], noMarginOnRight: true, onChanged: (checked) => {
|
|
4066
4070
|
actionErrorFilterState.target[target] = checked;
|
|
4067
4071
|
dispatch({
|
|
4068
|
-
type: ActionType$
|
|
4072
|
+
type: ActionType$6.UpdateActionErrorFilterState,
|
|
4069
4073
|
actionErrorFilterState,
|
|
4070
4074
|
});
|
|
4071
4075
|
} }));
|
|
@@ -4077,7 +4081,7 @@ const LogReviewer = (props) => {
|
|
|
4077
4081
|
React__default["default"].createElement("input", { type: "text", className: "form-control", "aria-label": "query for error message", value: actionErrorFilterState.errorMessage, placeholder: "e.g. undefined is not a function", onChange: (e) => {
|
|
4078
4082
|
actionErrorFilterState.errorMessage = e.target.value;
|
|
4079
4083
|
dispatch({
|
|
4080
|
-
type: ActionType$
|
|
4084
|
+
type: ActionType$6.UpdateActionErrorFilterState,
|
|
4081
4085
|
actionErrorFilterState,
|
|
4082
4086
|
});
|
|
4083
4087
|
} })),
|
|
@@ -4088,7 +4092,7 @@ const LogReviewer = (props) => {
|
|
|
4088
4092
|
.trim()
|
|
4089
4093
|
.toUpperCase());
|
|
4090
4094
|
dispatch({
|
|
4091
|
-
type: ActionType$
|
|
4095
|
+
type: ActionType$6.UpdateActionErrorFilterState,
|
|
4092
4096
|
actionErrorFilterState,
|
|
4093
4097
|
});
|
|
4094
4098
|
} }))))));
|
|
@@ -4102,7 +4106,7 @@ const LogReviewer = (props) => {
|
|
|
4102
4106
|
React__default["default"].createElement("input", { type: "text", className: "form-control", "aria-label": "query for user first name", value: advancedFilterState.userFirstName, placeholder: "e.g. Divardo", onChange: (e) => {
|
|
4103
4107
|
advancedFilterState.userFirstName = e.target.value;
|
|
4104
4108
|
dispatch({
|
|
4105
|
-
type: ActionType$
|
|
4109
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4106
4110
|
advancedFilterState,
|
|
4107
4111
|
});
|
|
4108
4112
|
} })),
|
|
@@ -4111,7 +4115,7 @@ const LogReviewer = (props) => {
|
|
|
4111
4115
|
React__default["default"].createElement("input", { type: "text", className: "form-control", "aria-label": "query for user last name", value: advancedFilterState.userLastName, placeholder: "e.g. Calicci", onChange: (e) => {
|
|
4112
4116
|
advancedFilterState.userLastName = e.target.value;
|
|
4113
4117
|
dispatch({
|
|
4114
|
-
type: ActionType$
|
|
4118
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4115
4119
|
advancedFilterState,
|
|
4116
4120
|
});
|
|
4117
4121
|
} })),
|
|
@@ -4121,7 +4125,7 @@ const LogReviewer = (props) => {
|
|
|
4121
4125
|
advancedFilterState.userEmail = ((e.target.value)
|
|
4122
4126
|
.trim());
|
|
4123
4127
|
dispatch({
|
|
4124
|
-
type: ActionType$
|
|
4128
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4125
4129
|
advancedFilterState,
|
|
4126
4130
|
});
|
|
4127
4131
|
} })),
|
|
@@ -4135,7 +4139,7 @@ const LogReviewer = (props) => {
|
|
|
4135
4139
|
.trim());
|
|
4136
4140
|
}
|
|
4137
4141
|
dispatch({
|
|
4138
|
-
type: ActionType$
|
|
4142
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4139
4143
|
advancedFilterState,
|
|
4140
4144
|
});
|
|
4141
4145
|
} })),
|
|
@@ -4143,21 +4147,21 @@ const LogReviewer = (props) => {
|
|
|
4143
4147
|
React__default["default"].createElement(CheckboxButton, { text: "Students", onChanged: (checked) => {
|
|
4144
4148
|
advancedFilterState.includeLearners = checked;
|
|
4145
4149
|
dispatch({
|
|
4146
|
-
type: ActionType$
|
|
4150
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4147
4151
|
advancedFilterState,
|
|
4148
4152
|
});
|
|
4149
4153
|
}, checked: advancedFilterState.includeLearners, ariaLabel: "show logs from students" }),
|
|
4150
4154
|
React__default["default"].createElement(CheckboxButton, { text: "Teaching Team Members", onChanged: (checked) => {
|
|
4151
4155
|
advancedFilterState.includeTTMs = checked;
|
|
4152
4156
|
dispatch({
|
|
4153
|
-
type: ActionType$
|
|
4157
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4154
4158
|
advancedFilterState,
|
|
4155
4159
|
});
|
|
4156
4160
|
}, checked: advancedFilterState.includeTTMs, ariaLabel: "show logs from teaching team members" }),
|
|
4157
4161
|
React__default["default"].createElement(CheckboxButton, { text: "Admins", onChanged: (checked) => {
|
|
4158
4162
|
advancedFilterState.includeAdmins = checked;
|
|
4159
4163
|
dispatch({
|
|
4160
|
-
type: ActionType$
|
|
4164
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4161
4165
|
advancedFilterState,
|
|
4162
4166
|
});
|
|
4163
4167
|
}, checked: advancedFilterState.includeAdmins, ariaLabel: "show logs from admins" }))),
|
|
@@ -4167,7 +4171,7 @@ const LogReviewer = (props) => {
|
|
|
4167
4171
|
React__default["default"].createElement("input", { type: "text", className: "form-control", "aria-label": "query for course name", value: advancedFilterState.courseName, placeholder: "e.g. GLC 200", onChange: (e) => {
|
|
4168
4172
|
advancedFilterState.courseName = e.target.value;
|
|
4169
4173
|
dispatch({
|
|
4170
|
-
type: ActionType$
|
|
4174
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4171
4175
|
advancedFilterState,
|
|
4172
4176
|
});
|
|
4173
4177
|
} })),
|
|
@@ -4181,7 +4185,7 @@ const LogReviewer = (props) => {
|
|
|
4181
4185
|
.trim());
|
|
4182
4186
|
}
|
|
4183
4187
|
dispatch({
|
|
4184
|
-
type: ActionType$
|
|
4188
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4185
4189
|
advancedFilterState,
|
|
4186
4190
|
});
|
|
4187
4191
|
} }))),
|
|
@@ -4190,21 +4194,21 @@ const LogReviewer = (props) => {
|
|
|
4190
4194
|
React__default["default"].createElement(RadioButton, { text: "All Devices", ariaLabel: "show logs from all devices", selected: advancedFilterState.isMobile === undefined, onSelected: () => {
|
|
4191
4195
|
advancedFilterState.isMobile = undefined;
|
|
4192
4196
|
dispatch({
|
|
4193
|
-
type: ActionType$
|
|
4197
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4194
4198
|
advancedFilterState,
|
|
4195
4199
|
});
|
|
4196
4200
|
} }),
|
|
4197
4201
|
React__default["default"].createElement(RadioButton, { text: "Mobile Only", ariaLabel: "show logs from mobile devices", selected: advancedFilterState.isMobile === true, onSelected: () => {
|
|
4198
4202
|
advancedFilterState.isMobile = true;
|
|
4199
4203
|
dispatch({
|
|
4200
|
-
type: ActionType$
|
|
4204
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4201
4205
|
advancedFilterState,
|
|
4202
4206
|
});
|
|
4203
4207
|
} }),
|
|
4204
4208
|
React__default["default"].createElement(RadioButton, { text: "Desktop Only", ariaLabel: "show logs from desktop devices", selected: advancedFilterState.isMobile === false, onSelected: () => {
|
|
4205
4209
|
advancedFilterState.isMobile = false;
|
|
4206
4210
|
dispatch({
|
|
4207
|
-
type: ActionType$
|
|
4211
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4208
4212
|
advancedFilterState,
|
|
4209
4213
|
});
|
|
4210
4214
|
}, noMarginOnRight: true }))),
|
|
@@ -4213,21 +4217,21 @@ const LogReviewer = (props) => {
|
|
|
4213
4217
|
React__default["default"].createElement(RadioButton, { text: "Both", ariaLabel: "show logs from all sources", selected: advancedFilterState.source === undefined, onSelected: () => {
|
|
4214
4218
|
advancedFilterState.source = undefined;
|
|
4215
4219
|
dispatch({
|
|
4216
|
-
type: ActionType$
|
|
4220
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4217
4221
|
advancedFilterState,
|
|
4218
4222
|
});
|
|
4219
4223
|
} }),
|
|
4220
4224
|
React__default["default"].createElement(RadioButton, { text: "Client Only", ariaLabel: "show logs from client source", selected: advancedFilterState.source === LogSource$1.Client, onSelected: () => {
|
|
4221
4225
|
advancedFilterState.source = LogSource$1.Client;
|
|
4222
4226
|
dispatch({
|
|
4223
|
-
type: ActionType$
|
|
4227
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4224
4228
|
advancedFilterState,
|
|
4225
4229
|
});
|
|
4226
4230
|
} }),
|
|
4227
4231
|
React__default["default"].createElement(RadioButton, { text: "Server Only", ariaLabel: "show logs from server source", selected: advancedFilterState.source === LogSource$1.Server, onSelected: () => {
|
|
4228
4232
|
advancedFilterState.source = LogSource$1.Server;
|
|
4229
4233
|
dispatch({
|
|
4230
|
-
type: ActionType$
|
|
4234
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4231
4235
|
advancedFilterState,
|
|
4232
4236
|
});
|
|
4233
4237
|
}, noMarginOnRight: true })),
|
|
@@ -4238,7 +4242,7 @@ const LogReviewer = (props) => {
|
|
|
4238
4242
|
advancedFilterState.courseName = ((e.target.value)
|
|
4239
4243
|
.trim());
|
|
4240
4244
|
dispatch({
|
|
4241
|
-
type: ActionType$
|
|
4245
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4242
4246
|
advancedFilterState,
|
|
4243
4247
|
});
|
|
4244
4248
|
} })),
|
|
@@ -4248,7 +4252,7 @@ const LogReviewer = (props) => {
|
|
|
4248
4252
|
advancedFilterState.courseName = ((e.target.value)
|
|
4249
4253
|
.trim());
|
|
4250
4254
|
dispatch({
|
|
4251
|
-
type: ActionType$
|
|
4255
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4252
4256
|
advancedFilterState,
|
|
4253
4257
|
});
|
|
4254
4258
|
} })))))));
|
|
@@ -12068,11 +12072,11 @@ var CreatableSelect$1 = CreatableSelect;
|
|
|
12068
12072
|
*/
|
|
12069
12073
|
/* ------------- Actions ------------ */
|
|
12070
12074
|
// Types of actions
|
|
12071
|
-
var ActionType$
|
|
12075
|
+
var ActionType$5;
|
|
12072
12076
|
(function (ActionType) {
|
|
12073
12077
|
// Update the input value
|
|
12074
12078
|
ActionType["SetInputValue"] = "SetInputValue";
|
|
12075
|
-
})(ActionType$
|
|
12079
|
+
})(ActionType$5 || (ActionType$5 = {}));
|
|
12076
12080
|
/**
|
|
12077
12081
|
* Reducer that executes actions
|
|
12078
12082
|
* @author Yuen Ler Chow
|
|
@@ -12080,9 +12084,9 @@ var ActionType$4;
|
|
|
12080
12084
|
* @param action action to execute
|
|
12081
12085
|
* @returns updated state
|
|
12082
12086
|
*/
|
|
12083
|
-
const reducer$
|
|
12087
|
+
const reducer$6 = (state, action) => {
|
|
12084
12088
|
switch (action.type) {
|
|
12085
|
-
case ActionType$
|
|
12089
|
+
case ActionType$5.SetInputValue: {
|
|
12086
12090
|
return Object.assign(Object.assign({}, state), { inputValue: action.value });
|
|
12087
12091
|
}
|
|
12088
12092
|
default: {
|
|
@@ -12102,7 +12106,7 @@ const CreatableMultiselect = (props) => {
|
|
|
12102
12106
|
inputValue: '',
|
|
12103
12107
|
};
|
|
12104
12108
|
// Initialize state
|
|
12105
|
-
const [state, dispatch] = React.useReducer(reducer$
|
|
12109
|
+
const [state, dispatch] = React.useReducer(reducer$6, initialState);
|
|
12106
12110
|
// Destructure common state
|
|
12107
12111
|
const { inputValue } = state;
|
|
12108
12112
|
/*------------------------------------------------------------------------*/
|
|
@@ -12179,7 +12183,7 @@ const CreatableMultiselect = (props) => {
|
|
|
12179
12183
|
}
|
|
12180
12184
|
// Reset text field to empty because the values have been added
|
|
12181
12185
|
dispatch({
|
|
12182
|
-
type: ActionType$
|
|
12186
|
+
type: ActionType$5.SetInputValue,
|
|
12183
12187
|
value: '',
|
|
12184
12188
|
});
|
|
12185
12189
|
};
|
|
@@ -12218,7 +12222,7 @@ const CreatableMultiselect = (props) => {
|
|
|
12218
12222
|
else {
|
|
12219
12223
|
// simply update the input value to the new input value
|
|
12220
12224
|
dispatch({
|
|
12221
|
-
type: ActionType$
|
|
12225
|
+
type: ActionType$5.SetInputValue,
|
|
12222
12226
|
value: newValue,
|
|
12223
12227
|
});
|
|
12224
12228
|
}
|
|
@@ -12270,13 +12274,13 @@ const style$1 = `
|
|
|
12270
12274
|
`;
|
|
12271
12275
|
/* ------------- Actions ------------ */
|
|
12272
12276
|
// Types of actions
|
|
12273
|
-
var ActionType$
|
|
12277
|
+
var ActionType$4;
|
|
12274
12278
|
(function (ActionType) {
|
|
12275
12279
|
// Update the DBEntry
|
|
12276
12280
|
ActionType["UpdateDBEntry"] = "UpdateDBEntry";
|
|
12277
12281
|
// Start the save spinner
|
|
12278
12282
|
ActionType["StartSave"] = "StartSave";
|
|
12279
|
-
})(ActionType$
|
|
12283
|
+
})(ActionType$4 || (ActionType$4 = {}));
|
|
12280
12284
|
/**
|
|
12281
12285
|
* Reducer that executes actions
|
|
12282
12286
|
* @author Yuen Ler Chow
|
|
@@ -12284,12 +12288,12 @@ var ActionType$3;
|
|
|
12284
12288
|
* @param action action to execute
|
|
12285
12289
|
* @returns updated state
|
|
12286
12290
|
*/
|
|
12287
|
-
const reducer$
|
|
12291
|
+
const reducer$5 = (state, action) => {
|
|
12288
12292
|
switch (action.type) {
|
|
12289
|
-
case ActionType$
|
|
12293
|
+
case ActionType$4.UpdateDBEntry: {
|
|
12290
12294
|
return Object.assign(Object.assign({}, state), { entry: action.dbEntry });
|
|
12291
12295
|
}
|
|
12292
|
-
case ActionType$
|
|
12296
|
+
case ActionType$4.StartSave: {
|
|
12293
12297
|
return Object.assign(Object.assign({}, state), { saving: true });
|
|
12294
12298
|
}
|
|
12295
12299
|
default: {
|
|
@@ -12314,7 +12318,7 @@ const AddOrEditDBEntry = (props) => {
|
|
|
12314
12318
|
saving: false,
|
|
12315
12319
|
};
|
|
12316
12320
|
// Initialize state
|
|
12317
|
-
const [state, dispatch] = React.useReducer(reducer$
|
|
12321
|
+
const [state, dispatch] = React.useReducer(reducer$5, initialState);
|
|
12318
12322
|
// Destructure common state
|
|
12319
12323
|
const { entry, saving, } = state;
|
|
12320
12324
|
/*------------------------------------------------------------------------*/
|
|
@@ -12326,7 +12330,7 @@ const AddOrEditDBEntry = (props) => {
|
|
|
12326
12330
|
*/
|
|
12327
12331
|
const save = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
12328
12332
|
// Start the save loading indicator
|
|
12329
|
-
dispatch({ type: ActionType$
|
|
12333
|
+
dispatch({ type: ActionType$4.StartSave });
|
|
12330
12334
|
// add all default values to the entry
|
|
12331
12335
|
entryFields.forEach((field) => {
|
|
12332
12336
|
if (field.defaultValue && !entry[field.objectKey]) {
|
|
@@ -12509,7 +12513,7 @@ const AddOrEditDBEntry = (props) => {
|
|
|
12509
12513
|
return (React__default["default"].createElement(RadioButton, { key: choice.value, text: choice.title, selected: entry[field.objectKey] === choice.value, onSelected: () => {
|
|
12510
12514
|
entry[field.objectKey] = choice.value;
|
|
12511
12515
|
dispatch({
|
|
12512
|
-
type: ActionType$
|
|
12516
|
+
type: ActionType$4.UpdateDBEntry,
|
|
12513
12517
|
dbEntry: entry,
|
|
12514
12518
|
});
|
|
12515
12519
|
}, ariaLabel: choice.title }));
|
|
@@ -12521,7 +12525,7 @@ const AddOrEditDBEntry = (props) => {
|
|
|
12521
12525
|
React__default["default"].createElement("input", { disabled: disabled, type: "text", className: "form-control", placeholder: field.placeholder, "aria-describedby": "AddOrEditDBEntry-form-name-label", value: entry[field.objectKey] || '', onChange: (e) => {
|
|
12522
12526
|
entry[field.objectKey] = (e.target.value);
|
|
12523
12527
|
dispatch({
|
|
12524
|
-
type: ActionType$
|
|
12528
|
+
type: ActionType$4.UpdateDBEntry,
|
|
12525
12529
|
dbEntry: entry,
|
|
12526
12530
|
});
|
|
12527
12531
|
} }))));
|
|
@@ -12534,7 +12538,7 @@ const AddOrEditDBEntry = (props) => {
|
|
|
12534
12538
|
entry[field.objectKey] = (e.target.value
|
|
12535
12539
|
.replace(/[^0-9]/g, ''));
|
|
12536
12540
|
dispatch({
|
|
12537
|
-
type: ActionType$
|
|
12541
|
+
type: ActionType$4.UpdateDBEntry,
|
|
12538
12542
|
dbEntry: entry,
|
|
12539
12543
|
});
|
|
12540
12544
|
} }))));
|
|
@@ -12564,7 +12568,7 @@ const AddOrEditDBEntry = (props) => {
|
|
|
12564
12568
|
}
|
|
12565
12569
|
// Save
|
|
12566
12570
|
dispatch({
|
|
12567
|
-
type: ActionType$
|
|
12571
|
+
type: ActionType$4.UpdateDBEntry,
|
|
12568
12572
|
dbEntry: entry,
|
|
12569
12573
|
});
|
|
12570
12574
|
}, ariaLabel: choice.title }));
|
|
@@ -12579,7 +12583,7 @@ const AddOrEditDBEntry = (props) => {
|
|
|
12579
12583
|
// Update entry and save
|
|
12580
12584
|
entry[field.objectKey] = values;
|
|
12581
12585
|
dispatch({
|
|
12582
|
-
type: ActionType$
|
|
12586
|
+
type: ActionType$4.UpdateDBEntry,
|
|
12583
12587
|
dbEntry: entry,
|
|
12584
12588
|
});
|
|
12585
12589
|
} })))));
|
|
@@ -12592,7 +12596,7 @@ const AddOrEditDBEntry = (props) => {
|
|
|
12592
12596
|
React__default["default"].createElement(CreatableMultiselect, { disabled: disabled, type: DBEntryFieldType$1.NumberArray, values: entry[field.objectKey] || [], onChange: (values) => {
|
|
12593
12597
|
entry[field.objectKey] = values;
|
|
12594
12598
|
dispatch({
|
|
12595
|
-
type: ActionType$
|
|
12599
|
+
type: ActionType$4.UpdateDBEntry,
|
|
12596
12600
|
dbEntry: entry,
|
|
12597
12601
|
});
|
|
12598
12602
|
} })))));
|
|
@@ -12666,7 +12670,7 @@ const generateEndpointPath = (collectionName, adminsOnly) => {
|
|
|
12666
12670
|
*/
|
|
12667
12671
|
/* ------------- Actions ------------ */
|
|
12668
12672
|
// Types of actions
|
|
12669
|
-
var ActionType$
|
|
12673
|
+
var ActionType$3;
|
|
12670
12674
|
(function (ActionType) {
|
|
12671
12675
|
// Show adder
|
|
12672
12676
|
ActionType["ShowAdder"] = "ShowAdder";
|
|
@@ -12680,7 +12684,7 @@ var ActionType$2;
|
|
|
12680
12684
|
ActionType["StartDelete"] = "StartDelete";
|
|
12681
12685
|
// Finish deletion process
|
|
12682
12686
|
ActionType["FinishDelete"] = "FinishDelete";
|
|
12683
|
-
})(ActionType$
|
|
12687
|
+
})(ActionType$3 || (ActionType$3 = {}));
|
|
12684
12688
|
/**
|
|
12685
12689
|
* Reducer that executes actions
|
|
12686
12690
|
* @author Yuen Ler Chow
|
|
@@ -12688,18 +12692,18 @@ var ActionType$2;
|
|
|
12688
12692
|
* @param action action to execute
|
|
12689
12693
|
* @returns updated state
|
|
12690
12694
|
*/
|
|
12691
|
-
const reducer$
|
|
12695
|
+
const reducer$4 = (state, action) => {
|
|
12692
12696
|
switch (action.type) {
|
|
12693
|
-
case ActionType$
|
|
12697
|
+
case ActionType$3.FinishLoading: {
|
|
12694
12698
|
return Object.assign(Object.assign({}, state), { loading: false, dbEntries: action.dbEntries });
|
|
12695
12699
|
}
|
|
12696
|
-
case ActionType$
|
|
12700
|
+
case ActionType$3.ShowAdder: {
|
|
12697
12701
|
return Object.assign(Object.assign({}, state), { adding: true, dbEntryToEdit: undefined });
|
|
12698
12702
|
}
|
|
12699
|
-
case ActionType$
|
|
12703
|
+
case ActionType$3.ShowEditor: {
|
|
12700
12704
|
return Object.assign(Object.assign({}, state), { adding: false, dbEntryToEdit: action.dbEntry });
|
|
12701
12705
|
}
|
|
12702
|
-
case ActionType$
|
|
12706
|
+
case ActionType$3.FinishAdd: {
|
|
12703
12707
|
// Handle cancel
|
|
12704
12708
|
const finishedEntry = action.dbEntry;
|
|
12705
12709
|
if (!finishedEntry) {
|
|
@@ -12723,10 +12727,10 @@ const reducer$3 = (state, action) => {
|
|
|
12723
12727
|
// Update the state
|
|
12724
12728
|
return Object.assign(Object.assign({}, state), { adding: false, dbEntryToEdit: undefined, dbEntries: updatedDbEntries });
|
|
12725
12729
|
}
|
|
12726
|
-
case ActionType$
|
|
12730
|
+
case ActionType$3.StartDelete: {
|
|
12727
12731
|
return Object.assign(Object.assign({}, state), { loading: true });
|
|
12728
12732
|
}
|
|
12729
|
-
case ActionType$
|
|
12733
|
+
case ActionType$3.FinishDelete: {
|
|
12730
12734
|
return Object.assign(Object.assign({}, state), { loading: false,
|
|
12731
12735
|
// Remove the deleted entry from the list
|
|
12732
12736
|
dbEntries: state.dbEntries.filter((entry) => {
|
|
@@ -12752,7 +12756,7 @@ const DBEntryManagerPanel = (props) => {
|
|
|
12752
12756
|
loading: true,
|
|
12753
12757
|
};
|
|
12754
12758
|
// Initialize state
|
|
12755
|
-
const [state, dispatch] = React.useReducer(reducer$
|
|
12759
|
+
const [state, dispatch] = React.useReducer(reducer$4, initialState);
|
|
12756
12760
|
// Destructure common state
|
|
12757
12761
|
const { adding, dbEntryToEdit, dbEntries, loading, } = state;
|
|
12758
12762
|
/*------------------------------------------------------------------------*/
|
|
@@ -12778,7 +12782,7 @@ const DBEntryManagerPanel = (props) => {
|
|
|
12778
12782
|
try {
|
|
12779
12783
|
// Start loader
|
|
12780
12784
|
dispatch({
|
|
12781
|
-
type: ActionType$
|
|
12785
|
+
type: ActionType$3.StartDelete,
|
|
12782
12786
|
});
|
|
12783
12787
|
// Perform deletion
|
|
12784
12788
|
yield visitServerEndpoint({
|
|
@@ -12787,7 +12791,7 @@ const DBEntryManagerPanel = (props) => {
|
|
|
12787
12791
|
});
|
|
12788
12792
|
// Finish loader
|
|
12789
12793
|
dispatch({
|
|
12790
|
-
type: ActionType$
|
|
12794
|
+
type: ActionType$3.FinishDelete,
|
|
12791
12795
|
dbEntry: entry,
|
|
12792
12796
|
idPropName,
|
|
12793
12797
|
});
|
|
@@ -12816,7 +12820,7 @@ const DBEntryManagerPanel = (props) => {
|
|
|
12816
12820
|
});
|
|
12817
12821
|
// Save loaded data
|
|
12818
12822
|
dispatch({
|
|
12819
|
-
type: ActionType$
|
|
12823
|
+
type: ActionType$3.FinishLoading,
|
|
12820
12824
|
dbEntries: data,
|
|
12821
12825
|
});
|
|
12822
12826
|
}
|
|
@@ -12859,7 +12863,7 @@ const DBEntryManagerPanel = (props) => {
|
|
|
12859
12863
|
React__default["default"].createElement("span", { className: "d-none d-md-inline ms-1" }, "Remove")),
|
|
12860
12864
|
!disableEdit && (React__default["default"].createElement("button", { type: "button", id: `DBEntryManagerPanel-edit-with-id-${entry[idPropName]}`, className: "btn btn-primary", "aria-label": `edit db entry: ${entry[titlePropName]}`, onClick: () => {
|
|
12861
12865
|
dispatch({
|
|
12862
|
-
type: ActionType$
|
|
12866
|
+
type: ActionType$3.ShowEditor,
|
|
12863
12867
|
dbEntry: entry,
|
|
12864
12868
|
});
|
|
12865
12869
|
} },
|
|
@@ -12869,7 +12873,7 @@ const DBEntryManagerPanel = (props) => {
|
|
|
12869
12873
|
React__default["default"].createElement("div", { className: "d-grid" },
|
|
12870
12874
|
React__default["default"].createElement("button", { type: "button", id: "DBEntryManagerPanel-add-entry", className: "btn btn-lg btn-primary", "aria-label": `add a new ${itemName} entry to the list of entries`, onClick: () => {
|
|
12871
12875
|
dispatch({
|
|
12872
|
-
type: ActionType$
|
|
12876
|
+
type: ActionType$3.ShowAdder,
|
|
12873
12877
|
});
|
|
12874
12878
|
} },
|
|
12875
12879
|
React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: freeSolidSvgIcons.faPlus, className: "me-2" }),
|
|
@@ -12881,7 +12885,7 @@ const DBEntryManagerPanel = (props) => {
|
|
|
12881
12885
|
if (!loading && (adding || dbEntryToEdit)) {
|
|
12882
12886
|
body = (React__default["default"].createElement(AddOrEditDBEntry, { saveEndpointPath: endpoint, validateEntry: validateEntry, modifyEntry: modifyEntry, entryFields: entryFields, dbEntryToEdit: dbEntryToEdit, idPropName: idPropName, entries: dbEntries, itemName: itemName, onFinished: (entry) => {
|
|
12883
12887
|
dispatch({
|
|
12884
|
-
type: ActionType$
|
|
12888
|
+
type: ActionType$3.FinishAdd,
|
|
12885
12889
|
dbEntry: entry,
|
|
12886
12890
|
idPropName,
|
|
12887
12891
|
});
|
|
@@ -13078,25 +13082,25 @@ const getItemIds = (items) => {
|
|
|
13078
13082
|
};
|
|
13079
13083
|
/* ------------- Actions ------------ */
|
|
13080
13084
|
// Types of actions
|
|
13081
|
-
var ActionType$
|
|
13085
|
+
var ActionType$2;
|
|
13082
13086
|
(function (ActionType) {
|
|
13083
13087
|
// Hide the "jump to bottom" button
|
|
13084
13088
|
ActionType["HideJumpToBottomButton"] = "HideJumpToBottomButton";
|
|
13085
13089
|
// Show the "jump to bottom" button
|
|
13086
13090
|
ActionType["ShowJumpToBottomButton"] = "ShowJumpToBottomButton";
|
|
13087
|
-
})(ActionType$
|
|
13091
|
+
})(ActionType$2 || (ActionType$2 = {}));
|
|
13088
13092
|
/**
|
|
13089
13093
|
* Reducer that executes actions
|
|
13090
13094
|
* @author Gabe Abrams
|
|
13091
13095
|
* @param state current state
|
|
13092
13096
|
* @param action action to execute
|
|
13093
13097
|
*/
|
|
13094
|
-
const reducer$
|
|
13098
|
+
const reducer$3 = (state, action) => {
|
|
13095
13099
|
switch (action.type) {
|
|
13096
|
-
case ActionType$
|
|
13100
|
+
case ActionType$2.HideJumpToBottomButton: {
|
|
13097
13101
|
return Object.assign(Object.assign({}, state), { jumpToBottomButtonVisible: false });
|
|
13098
13102
|
}
|
|
13099
|
-
case ActionType$
|
|
13103
|
+
case ActionType$2.ShowJumpToBottomButton: {
|
|
13100
13104
|
return Object.assign(Object.assign({}, state), { jumpToBottomButtonVisible: true });
|
|
13101
13105
|
}
|
|
13102
13106
|
default: {
|
|
@@ -13120,7 +13124,7 @@ const AutoscrollToBottomContainer = (props) => {
|
|
|
13120
13124
|
jumpToBottomButtonVisible: false,
|
|
13121
13125
|
};
|
|
13122
13126
|
// Initialize state
|
|
13123
|
-
const [state, dispatch] = React.useReducer(reducer$
|
|
13127
|
+
const [state, dispatch] = React.useReducer(reducer$3, initialState);
|
|
13124
13128
|
// Destructure common state
|
|
13125
13129
|
const { jumpToBottomButtonVisible, } = state;
|
|
13126
13130
|
/* -------------- Refs -------------- */
|
|
@@ -13166,7 +13170,7 @@ const AutoscrollToBottomContainer = (props) => {
|
|
|
13166
13170
|
}
|
|
13167
13171
|
// Update state
|
|
13168
13172
|
dispatch({
|
|
13169
|
-
type: ActionType$
|
|
13173
|
+
type: ActionType$2.HideJumpToBottomButton,
|
|
13170
13174
|
});
|
|
13171
13175
|
// Scroll to bottom
|
|
13172
13176
|
container.current.scrollTop = (container.current.scrollHeight
|
|
@@ -13190,7 +13194,7 @@ const AutoscrollToBottomContainer = (props) => {
|
|
|
13190
13194
|
if (isScrolledToBottom()) {
|
|
13191
13195
|
// Hide button
|
|
13192
13196
|
dispatch({
|
|
13193
|
-
type: ActionType$
|
|
13197
|
+
type: ActionType$2.HideJumpToBottomButton,
|
|
13194
13198
|
});
|
|
13195
13199
|
}
|
|
13196
13200
|
};
|
|
@@ -13232,7 +13236,7 @@ const AutoscrollToBottomContainer = (props) => {
|
|
|
13232
13236
|
else {
|
|
13233
13237
|
// Not scrolled to bottom. Show "jump to bottom" button.
|
|
13234
13238
|
dispatch({
|
|
13235
|
-
type: ActionType$
|
|
13239
|
+
type: ActionType$2.ShowJumpToBottomButton,
|
|
13236
13240
|
});
|
|
13237
13241
|
}
|
|
13238
13242
|
}, [items]);
|
|
@@ -13302,25 +13306,25 @@ const combineClassNames = (classNames) => {
|
|
|
13302
13306
|
*/
|
|
13303
13307
|
/* ------------- Actions ------------ */
|
|
13304
13308
|
// Types of actions
|
|
13305
|
-
var ActionType;
|
|
13309
|
+
var ActionType$1;
|
|
13306
13310
|
(function (ActionType) {
|
|
13307
13311
|
// Start hovering on an option
|
|
13308
13312
|
ActionType["StartHover"] = "StartHover";
|
|
13309
13313
|
// Stop hovering on an option
|
|
13310
13314
|
ActionType["StopHover"] = "StopHover";
|
|
13311
|
-
})(ActionType || (ActionType = {}));
|
|
13315
|
+
})(ActionType$1 || (ActionType$1 = {}));
|
|
13312
13316
|
/**
|
|
13313
13317
|
* Reducer that executes actions
|
|
13314
13318
|
* @author Gabe Abrams
|
|
13315
13319
|
* @param state current state
|
|
13316
13320
|
* @param action action to execute
|
|
13317
13321
|
*/
|
|
13318
|
-
const reducer$
|
|
13322
|
+
const reducer$2 = (state, action) => {
|
|
13319
13323
|
switch (action.type) {
|
|
13320
|
-
case ActionType.StartHover: {
|
|
13324
|
+
case ActionType$1.StartHover: {
|
|
13321
13325
|
return Object.assign(Object.assign({}, state), { hoveredOptionId: action.hoveredOptionId });
|
|
13322
13326
|
}
|
|
13323
|
-
case ActionType.StopHover: {
|
|
13327
|
+
case ActionType$1.StopHover: {
|
|
13324
13328
|
return Object.assign(Object.assign({}, state), { hoveredOptionId: undefined });
|
|
13325
13329
|
}
|
|
13326
13330
|
default: {
|
|
@@ -13344,7 +13348,7 @@ const MultiSwitch = (props) => {
|
|
|
13344
13348
|
hoveredOptionId: undefined,
|
|
13345
13349
|
};
|
|
13346
13350
|
// Initialize state
|
|
13347
|
-
const [state, dispatch] = React.useReducer(reducer$
|
|
13351
|
+
const [state, dispatch] = React.useReducer(reducer$2, initialState);
|
|
13348
13352
|
// Destructure common state
|
|
13349
13353
|
const { hoveredOptionId, } = state;
|
|
13350
13354
|
/*------------------------------------------------------------------------*/
|
|
@@ -13476,27 +13480,27 @@ const MultiSwitch = (props) => {
|
|
|
13476
13480
|
: `click to select option "${option.label}"`), onClick: () => {
|
|
13477
13481
|
// Remove hover
|
|
13478
13482
|
dispatch({
|
|
13479
|
-
type: ActionType.StopHover,
|
|
13483
|
+
type: ActionType$1.StopHover,
|
|
13480
13484
|
});
|
|
13481
13485
|
// Notify parent
|
|
13482
13486
|
onChange(option.id);
|
|
13483
13487
|
}, onMouseEnter: () => {
|
|
13484
13488
|
dispatch({
|
|
13485
|
-
type: ActionType.StartHover,
|
|
13489
|
+
type: ActionType$1.StartHover,
|
|
13486
13490
|
hoveredOptionId: option.id,
|
|
13487
13491
|
});
|
|
13488
13492
|
}, onMouseLeave: () => {
|
|
13489
13493
|
dispatch({
|
|
13490
|
-
type: ActionType.StopHover,
|
|
13494
|
+
type: ActionType$1.StopHover,
|
|
13491
13495
|
});
|
|
13492
13496
|
}, onFocus: () => {
|
|
13493
13497
|
dispatch({
|
|
13494
|
-
type: ActionType.StartHover,
|
|
13498
|
+
type: ActionType$1.StartHover,
|
|
13495
13499
|
hoveredOptionId: option.id,
|
|
13496
13500
|
});
|
|
13497
13501
|
}, onBlur: () => {
|
|
13498
13502
|
dispatch({
|
|
13499
|
-
type: ActionType.StopHover,
|
|
13503
|
+
type: ActionType$1.StopHover,
|
|
13500
13504
|
});
|
|
13501
13505
|
}, style: {
|
|
13502
13506
|
pointerEvents: ((option.id === selectedOptionId)
|
|
@@ -13515,6 +13519,147 @@ const MultiSwitch = (props) => {
|
|
|
13515
13519
|
React__default["default"].createElement("div", { className: "MultiSwitch-highlight-container" }, highlight)));
|
|
13516
13520
|
};
|
|
13517
13521
|
|
|
13522
|
+
// Types of dropdown items
|
|
13523
|
+
var DropdownItemType;
|
|
13524
|
+
(function (DropdownItemType) {
|
|
13525
|
+
// Dropdown header
|
|
13526
|
+
DropdownItemType["Header"] = "Header";
|
|
13527
|
+
// Dropdown divider
|
|
13528
|
+
DropdownItemType["Divider"] = "Divider";
|
|
13529
|
+
// Dropdown item
|
|
13530
|
+
DropdownItemType["Item"] = "Item";
|
|
13531
|
+
})(DropdownItemType || (DropdownItemType = {}));
|
|
13532
|
+
var DropdownItemType$1 = DropdownItemType;
|
|
13533
|
+
|
|
13534
|
+
/**
|
|
13535
|
+
* A simple dropdown menu
|
|
13536
|
+
* @author Alessandra De Lucas
|
|
13537
|
+
* @author Yuen Ler Chow
|
|
13538
|
+
* @author Gabe Abrams
|
|
13539
|
+
*/
|
|
13540
|
+
/* ------------- Actions ------------ */
|
|
13541
|
+
// Types of actions
|
|
13542
|
+
var ActionType;
|
|
13543
|
+
(function (ActionType) {
|
|
13544
|
+
// Toggle opening the dropdown menu
|
|
13545
|
+
ActionType["ToggleDropdown"] = "ToggleDropdown";
|
|
13546
|
+
// Close the dropdown menu
|
|
13547
|
+
ActionType["CloseDropdown"] = "CloseDropdown";
|
|
13548
|
+
})(ActionType || (ActionType = {}));
|
|
13549
|
+
/**
|
|
13550
|
+
* Reducer that executes actions
|
|
13551
|
+
* @author Alessandra De Lucas
|
|
13552
|
+
* @author Yuen Ler Chow
|
|
13553
|
+
* @param state current state
|
|
13554
|
+
* @param action action to execute
|
|
13555
|
+
*/
|
|
13556
|
+
const reducer$1 = (state, action) => {
|
|
13557
|
+
switch (action.type) {
|
|
13558
|
+
case ActionType.ToggleDropdown: {
|
|
13559
|
+
return Object.assign(Object.assign({}, state), { isDropdownOpen: !state.isDropdownOpen });
|
|
13560
|
+
}
|
|
13561
|
+
case ActionType.CloseDropdown: {
|
|
13562
|
+
return Object.assign(Object.assign({}, state), { isDropdownOpen: false });
|
|
13563
|
+
}
|
|
13564
|
+
default: {
|
|
13565
|
+
return state;
|
|
13566
|
+
}
|
|
13567
|
+
}
|
|
13568
|
+
};
|
|
13569
|
+
/*------------------------------------------------------------------------*/
|
|
13570
|
+
/* ------------------------------ Component ----------------------------- */
|
|
13571
|
+
/*------------------------------------------------------------------------*/
|
|
13572
|
+
const Dropdown = (props) => {
|
|
13573
|
+
/*------------------------------------------------------------------------*/
|
|
13574
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
13575
|
+
/*------------------------------------------------------------------------*/
|
|
13576
|
+
/* -------------- Props ------------- */
|
|
13577
|
+
// Destructure all props
|
|
13578
|
+
const { dropdownButton, items, } = props;
|
|
13579
|
+
/* -------------- State ------------- */
|
|
13580
|
+
// Initial state
|
|
13581
|
+
const initialState = {
|
|
13582
|
+
isDropdownOpen: false,
|
|
13583
|
+
};
|
|
13584
|
+
// Initialize state
|
|
13585
|
+
const [state, dispatch] = React.useReducer(reducer$1, initialState);
|
|
13586
|
+
// Destructure common state
|
|
13587
|
+
const { isDropdownOpen, } = state;
|
|
13588
|
+
/* -------------- Refs -------------- */
|
|
13589
|
+
// Initialize refs
|
|
13590
|
+
const dropdownRef = React.useRef(null);
|
|
13591
|
+
/*------------------------------------------------------------------------*/
|
|
13592
|
+
/* ------------------------- Component Functions ------------------------ */
|
|
13593
|
+
/*------------------------------------------------------------------------*/
|
|
13594
|
+
/**
|
|
13595
|
+
* Handle clicking outside of the dropdown menu to close it
|
|
13596
|
+
* @author Yuen Ler Chow
|
|
13597
|
+
* @param event the mouse event
|
|
13598
|
+
*/
|
|
13599
|
+
const handleClickOutside = (event) => {
|
|
13600
|
+
if (
|
|
13601
|
+
// Dropdown has been rendered
|
|
13602
|
+
dropdownRef.current
|
|
13603
|
+
// Click occurred outside the dropdown
|
|
13604
|
+
&& !dropdownRef.current.contains(event.target)) {
|
|
13605
|
+
dispatch({ type: ActionType.CloseDropdown });
|
|
13606
|
+
}
|
|
13607
|
+
};
|
|
13608
|
+
/*------------------------------------------------------------------------*/
|
|
13609
|
+
/* ------------------------- Lifecycle Functions ------------------------ */
|
|
13610
|
+
/*------------------------------------------------------------------------*/
|
|
13611
|
+
/**
|
|
13612
|
+
* Mount
|
|
13613
|
+
* @author Yuen Ler Chow
|
|
13614
|
+
*/
|
|
13615
|
+
React.useEffect(() => {
|
|
13616
|
+
// Add event listener to close dropdown when clicking outside
|
|
13617
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
13618
|
+
// Cleanup
|
|
13619
|
+
return () => {
|
|
13620
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
13621
|
+
};
|
|
13622
|
+
}, []);
|
|
13623
|
+
/*----------------------------------------*/
|
|
13624
|
+
/* --------------- Main UI -------------- */
|
|
13625
|
+
/*----------------------------------------*/
|
|
13626
|
+
return (React__default["default"].createElement("div", { className: "dropdown", ref: dropdownRef, "data-bs-theme": isDarkModeOn() ? 'dark' : undefined },
|
|
13627
|
+
React__default["default"].createElement("button", { className: combineClassNames([
|
|
13628
|
+
'btn dropdown-toggle border',
|
|
13629
|
+
isDropdownOpen && 'show',
|
|
13630
|
+
`btn-${dropdownButton.variant}`,
|
|
13631
|
+
dropdownButton.variant === Variant$1.Light && 'text-dark',
|
|
13632
|
+
]), type: "button", id: dropdownButton.id, "aria-expanded": isDropdownOpen, "aria-label": dropdownButton.ariaLabel, onClick: () => {
|
|
13633
|
+
dispatch({
|
|
13634
|
+
type: ActionType.ToggleDropdown,
|
|
13635
|
+
});
|
|
13636
|
+
} }, dropdownButton.content),
|
|
13637
|
+
React__default["default"].createElement("ul", { className: combineClassNames([
|
|
13638
|
+
'dropdown-menu',
|
|
13639
|
+
isDarkModeOn() && 'dropdown-menu-dark',
|
|
13640
|
+
isDropdownOpen && 'show',
|
|
13641
|
+
]) }, Object.values(items).map((item) => {
|
|
13642
|
+
if (item.type === DropdownItemType$1.Header) {
|
|
13643
|
+
return (
|
|
13644
|
+
// TODO: Implement header
|
|
13645
|
+
React__default["default"].createElement("span", null));
|
|
13646
|
+
}
|
|
13647
|
+
if (item.type === DropdownItemType$1.Divider) {
|
|
13648
|
+
return (
|
|
13649
|
+
// TODO: Implement divider
|
|
13650
|
+
React__default["default"].createElement("span", null));
|
|
13651
|
+
}
|
|
13652
|
+
return (React__default["default"].createElement("li", { key: item.id },
|
|
13653
|
+
React__default["default"].createElement("button", { type: "button", "aria-label": item.ariaLabel, className: "dropdown-item", onClick: (e) => {
|
|
13654
|
+
e.preventDefault();
|
|
13655
|
+
dispatch({
|
|
13656
|
+
type: ActionType.CloseDropdown,
|
|
13657
|
+
});
|
|
13658
|
+
item.onClick();
|
|
13659
|
+
} }, item.content)));
|
|
13660
|
+
}))));
|
|
13661
|
+
};
|
|
13662
|
+
|
|
13518
13663
|
/**
|
|
13519
13664
|
* One minute in ms
|
|
13520
13665
|
* @author Gabe Abrams
|
|
@@ -15851,6 +15996,8 @@ exports.DBEntryFieldType = DBEntryFieldType$1;
|
|
|
15851
15996
|
exports.DBEntryManagerPanel = DBEntryManagerPanel;
|
|
15852
15997
|
exports.DayOfWeek = DayOfWeek$1;
|
|
15853
15998
|
exports.Drawer = Drawer;
|
|
15999
|
+
exports.Dropdown = Dropdown;
|
|
16000
|
+
exports.DropdownItemType = DropdownItemType$1;
|
|
15854
16001
|
exports.DynamicWord = DynamicWord;
|
|
15855
16002
|
exports.ErrorBox = ErrorBox;
|
|
15856
16003
|
exports.ErrorWithCode = ErrorWithCode;
|