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/esm/index.js
CHANGED
|
@@ -30,7 +30,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
// Highest error code =
|
|
33
|
+
// Highest error code = DRK16
|
|
34
34
|
/**
|
|
35
35
|
* List of error codes built into the react kit
|
|
36
36
|
* @author Gabe Abrams
|
|
@@ -50,6 +50,10 @@ var ReactKitErrorCode;
|
|
|
50
50
|
ReactKitErrorCode["NotAllowedToReviewLogs"] = "DRK11";
|
|
51
51
|
ReactKitErrorCode["ThemeCheckedBeforeReactKitReady"] = "DRK12";
|
|
52
52
|
ReactKitErrorCode["SessionExpiredMessageGottenBeforeReactKitReady"] = "DRK13";
|
|
53
|
+
// Server-to-server requests
|
|
54
|
+
ReactKitErrorCode["NotConnected"] = "DRK14";
|
|
55
|
+
ReactKitErrorCode["SelfSigned"] = "DRK15";
|
|
56
|
+
ReactKitErrorCode["ResponseParseError"] = "DRK16";
|
|
53
57
|
})(ReactKitErrorCode || (ReactKitErrorCode = {}));
|
|
54
58
|
var ReactKitErrorCode$1 = ReactKitErrorCode;
|
|
55
59
|
|
|
@@ -2210,27 +2214,27 @@ const PopPendingMark = (props) => {
|
|
|
2210
2214
|
*/
|
|
2211
2215
|
/* ------------- Actions ------------ */
|
|
2212
2216
|
// Types of actions
|
|
2213
|
-
var ActionType$
|
|
2217
|
+
var ActionType$9;
|
|
2214
2218
|
(function (ActionType) {
|
|
2215
2219
|
// Indicate that the text was recently copied
|
|
2216
2220
|
ActionType["IndicateRecentlyCopied"] = "indicate-recently-copied";
|
|
2217
2221
|
// Clear the status
|
|
2218
2222
|
ActionType["ClearRecentlyCopiedStatus"] = "clear-recently-copied-status";
|
|
2219
|
-
})(ActionType$
|
|
2223
|
+
})(ActionType$9 || (ActionType$9 = {}));
|
|
2220
2224
|
/**
|
|
2221
2225
|
* Reducer that executes actions
|
|
2222
2226
|
* @author Gabe Abrams
|
|
2223
2227
|
* @param state current state
|
|
2224
2228
|
* @param action action to execute
|
|
2225
2229
|
*/
|
|
2226
|
-
const reducer$
|
|
2230
|
+
const reducer$a = (state, action) => {
|
|
2227
2231
|
switch (action.type) {
|
|
2228
|
-
case ActionType$
|
|
2232
|
+
case ActionType$9.IndicateRecentlyCopied: {
|
|
2229
2233
|
return {
|
|
2230
2234
|
recentlyCopied: true,
|
|
2231
2235
|
};
|
|
2232
2236
|
}
|
|
2233
|
-
case ActionType$
|
|
2237
|
+
case ActionType$9.ClearRecentlyCopiedStatus: {
|
|
2234
2238
|
return {
|
|
2235
2239
|
recentlyCopied: false,
|
|
2236
2240
|
};
|
|
@@ -2256,7 +2260,7 @@ const CopiableBox = (props) => {
|
|
|
2256
2260
|
recentlyCopied: false,
|
|
2257
2261
|
};
|
|
2258
2262
|
// Initialize state
|
|
2259
|
-
const [state, dispatch] = useReducer(reducer$
|
|
2263
|
+
const [state, dispatch] = useReducer(reducer$a, initialState);
|
|
2260
2264
|
// Destructure common state
|
|
2261
2265
|
const { recentlyCopied, } = state;
|
|
2262
2266
|
/*------------------------------------------------------------------------*/
|
|
@@ -2276,13 +2280,13 @@ const CopiableBox = (props) => {
|
|
|
2276
2280
|
}
|
|
2277
2281
|
// Show copied notice
|
|
2278
2282
|
dispatch({
|
|
2279
|
-
type: ActionType$
|
|
2283
|
+
type: ActionType$9.IndicateRecentlyCopied,
|
|
2280
2284
|
});
|
|
2281
2285
|
// Wait a moment
|
|
2282
2286
|
yield waitMs(4000);
|
|
2283
2287
|
// Hide copied notice
|
|
2284
2288
|
dispatch({
|
|
2285
|
-
type: ActionType$
|
|
2289
|
+
type: ActionType$9.ClearRecentlyCopiedStatus,
|
|
2286
2290
|
});
|
|
2287
2291
|
});
|
|
2288
2292
|
/*------------------------------------------------------------------------*/
|
|
@@ -2338,20 +2342,20 @@ const CopiableBox = (props) => {
|
|
|
2338
2342
|
*/
|
|
2339
2343
|
/* ------------- Actions ------------ */
|
|
2340
2344
|
// Types of actions
|
|
2341
|
-
var ActionType$
|
|
2345
|
+
var ActionType$8;
|
|
2342
2346
|
(function (ActionType) {
|
|
2343
2347
|
// Toggle whether a child are being shown
|
|
2344
2348
|
ActionType["ToggleChild"] = "toggle-child";
|
|
2345
|
-
})(ActionType$
|
|
2349
|
+
})(ActionType$8 || (ActionType$8 = {}));
|
|
2346
2350
|
/**
|
|
2347
2351
|
* Reducer that executes actions
|
|
2348
2352
|
* @author Gabe Abrams
|
|
2349
2353
|
* @param state current state
|
|
2350
2354
|
* @param action action to execute
|
|
2351
2355
|
*/
|
|
2352
|
-
const reducer$
|
|
2356
|
+
const reducer$9 = (state, action) => {
|
|
2353
2357
|
switch (action.type) {
|
|
2354
|
-
case ActionType$
|
|
2358
|
+
case ActionType$8.ToggleChild: {
|
|
2355
2359
|
return Object.assign(Object.assign({}, state), { childExpanded: Object.assign(Object.assign({}, state.childExpanded), { [String(action.id)]: !state.childExpanded[String(action.id)] }) });
|
|
2356
2360
|
}
|
|
2357
2361
|
default: {
|
|
@@ -2380,7 +2384,7 @@ const NestableItemList = (props) => {
|
|
|
2380
2384
|
childExpanded: initChildExpanded,
|
|
2381
2385
|
};
|
|
2382
2386
|
// Initialize state
|
|
2383
|
-
const [state, dispatch] = useReducer(reducer$
|
|
2387
|
+
const [state, dispatch] = useReducer(reducer$9, initialState);
|
|
2384
2388
|
// Destructure common state
|
|
2385
2389
|
const { childExpanded, } = state;
|
|
2386
2390
|
/*------------------------------------------------------------------------*/
|
|
@@ -2470,7 +2474,7 @@ const NestableItemList = (props) => {
|
|
|
2470
2474
|
backgroundColor: 'transparent',
|
|
2471
2475
|
}, type: "button", onClick: () => {
|
|
2472
2476
|
dispatch({
|
|
2473
|
-
type: ActionType$
|
|
2477
|
+
type: ActionType$8.ToggleChild,
|
|
2474
2478
|
id: item.id,
|
|
2475
2479
|
});
|
|
2476
2480
|
}, "aria-label": `${childExpanded[item.id] ? 'Hide' : 'Show'} items in ${item.name}` },
|
|
@@ -2754,7 +2758,7 @@ var SortType;
|
|
|
2754
2758
|
})(SortType || (SortType = {}));
|
|
2755
2759
|
/* ------------- Actions ------------ */
|
|
2756
2760
|
// Types of actions
|
|
2757
|
-
var ActionType$
|
|
2761
|
+
var ActionType$7;
|
|
2758
2762
|
(function (ActionType) {
|
|
2759
2763
|
// Toggle sort column param
|
|
2760
2764
|
ActionType["ToggleSortColumn"] = "toggle-sort-column";
|
|
@@ -2766,16 +2770,16 @@ var ActionType$6;
|
|
|
2766
2770
|
ActionType["ShowAllColumns"] = "show-all-columns";
|
|
2767
2771
|
// Hide all columns
|
|
2768
2772
|
ActionType["HideAllColumns"] = "hide-all-columns";
|
|
2769
|
-
})(ActionType$
|
|
2773
|
+
})(ActionType$7 || (ActionType$7 = {}));
|
|
2770
2774
|
/**
|
|
2771
2775
|
* Reducer that executes actions
|
|
2772
2776
|
* @author Gabe Abrams
|
|
2773
2777
|
* @param state current state
|
|
2774
2778
|
* @param action action to execute
|
|
2775
2779
|
*/
|
|
2776
|
-
const reducer$
|
|
2780
|
+
const reducer$8 = (state, action) => {
|
|
2777
2781
|
switch (action.type) {
|
|
2778
|
-
case ActionType$
|
|
2782
|
+
case ActionType$7.ToggleSortColumn: {
|
|
2779
2783
|
if (action.param !== state.sortColumnParam) {
|
|
2780
2784
|
// Different column param
|
|
2781
2785
|
return Object.assign(Object.assign({}, state), { sortColumnParam: action.param, sortType: SortType.Ascending });
|
|
@@ -2787,22 +2791,22 @@ const reducer$7 = (state, action) => {
|
|
|
2787
2791
|
// Stop sorting by column
|
|
2788
2792
|
return Object.assign(Object.assign({}, state), { sortColumnParam: undefined, sortType: SortType.Ascending });
|
|
2789
2793
|
}
|
|
2790
|
-
case ActionType$
|
|
2794
|
+
case ActionType$7.UpdateColumnVisibility: {
|
|
2791
2795
|
const { columnVisibilityMap } = state;
|
|
2792
2796
|
columnVisibilityMap[action.param] = action.visible;
|
|
2793
2797
|
return Object.assign(Object.assign({}, state), { columnVisibilityMap });
|
|
2794
2798
|
}
|
|
2795
|
-
case ActionType$
|
|
2799
|
+
case ActionType$7.ToggleColVisCusModalVisibility: {
|
|
2796
2800
|
return Object.assign(Object.assign({}, state), { columnVisibilityCustomizationModalVisible: !state.columnVisibilityCustomizationModalVisible });
|
|
2797
2801
|
}
|
|
2798
|
-
case ActionType$
|
|
2802
|
+
case ActionType$7.ShowAllColumns: {
|
|
2799
2803
|
const { columnVisibilityMap } = state;
|
|
2800
2804
|
Object.keys(columnVisibilityMap).forEach((param) => {
|
|
2801
2805
|
columnVisibilityMap[param] = true;
|
|
2802
2806
|
});
|
|
2803
2807
|
return Object.assign(Object.assign({}, state), { columnVisibilityMap });
|
|
2804
2808
|
}
|
|
2805
|
-
case ActionType$
|
|
2809
|
+
case ActionType$7.HideAllColumns: {
|
|
2806
2810
|
const { columnVisibilityMap } = state;
|
|
2807
2811
|
Object.keys(columnVisibilityMap).forEach((param) => {
|
|
2808
2812
|
columnVisibilityMap[param] = false;
|
|
@@ -2849,7 +2853,7 @@ const IntelliTable = (props) => {
|
|
|
2849
2853
|
columnVisibilityCustomizationModalVisible: false,
|
|
2850
2854
|
};
|
|
2851
2855
|
// Initialize state
|
|
2852
|
-
const [state, dispatch] = useReducer(reducer$
|
|
2856
|
+
const [state, dispatch] = useReducer(reducer$8, initialState);
|
|
2853
2857
|
// Destructure common state
|
|
2854
2858
|
const { sortColumnParam, sortType, columnVisibilityMap, columnVisibilityCustomizationModalVisible, } = state;
|
|
2855
2859
|
/*------------------------------------------------------------------------*/
|
|
@@ -2872,13 +2876,13 @@ const IntelliTable = (props) => {
|
|
|
2872
2876
|
return alert('Choose at least one column', 'To continue, you have to choose at least one column to show');
|
|
2873
2877
|
}
|
|
2874
2878
|
dispatch({
|
|
2875
|
-
type: ActionType$
|
|
2879
|
+
type: ActionType$7.ToggleColVisCusModalVisibility,
|
|
2876
2880
|
});
|
|
2877
2881
|
}, okayVariant: Variant$1.Light },
|
|
2878
2882
|
columns.map((column) => {
|
|
2879
2883
|
return (React__default.createElement(CheckboxButton, { key: column.param, id: `IntelliTable-${id}-toggle-visibility-${column.param}`, className: "mb-2", text: column.title, onChanged: (checked) => {
|
|
2880
2884
|
dispatch({
|
|
2881
|
-
type: ActionType$
|
|
2885
|
+
type: ActionType$7.UpdateColumnVisibility,
|
|
2882
2886
|
param: column.param,
|
|
2883
2887
|
visible: checked,
|
|
2884
2888
|
});
|
|
@@ -2887,12 +2891,12 @@ const IntelliTable = (props) => {
|
|
|
2887
2891
|
React__default.createElement("div", { className: "mt-3" }, "Or you can:"),
|
|
2888
2892
|
React__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: () => {
|
|
2889
2893
|
dispatch({
|
|
2890
|
-
type: ActionType$
|
|
2894
|
+
type: ActionType$7.ShowAllColumns,
|
|
2891
2895
|
});
|
|
2892
2896
|
} }, "Select All"),
|
|
2893
2897
|
React__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: () => {
|
|
2894
2898
|
dispatch({
|
|
2895
|
-
type: ActionType$
|
|
2899
|
+
type: ActionType$7.HideAllColumns,
|
|
2896
2900
|
});
|
|
2897
2901
|
} }, "Deselect All")));
|
|
2898
2902
|
}
|
|
@@ -2943,7 +2947,7 @@ const IntelliTable = (props) => {
|
|
|
2943
2947
|
React__default.createElement("div", null,
|
|
2944
2948
|
React__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: () => {
|
|
2945
2949
|
dispatch({
|
|
2946
|
-
type: ActionType$
|
|
2950
|
+
type: ActionType$7.ToggleSortColumn,
|
|
2947
2951
|
param: column.param,
|
|
2948
2952
|
});
|
|
2949
2953
|
} },
|
|
@@ -3132,7 +3136,7 @@ const IntelliTable = (props) => {
|
|
|
3132
3136
|
React__default.createElement(CSVDownloadButton, { "aria-label": `download data as csv for ${title}`, id: `IntelliTable-${id}-download-as-csv`, filename: filename, csv: csv }),
|
|
3133
3137
|
React__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: () => {
|
|
3134
3138
|
dispatch({
|
|
3135
|
-
type: ActionType$
|
|
3139
|
+
type: ActionType$7.ToggleColVisCusModalVisibility,
|
|
3136
3140
|
});
|
|
3137
3141
|
} },
|
|
3138
3142
|
"Show/Hide Cols",
|
|
@@ -3498,7 +3502,7 @@ const genHumanReadableName = (machineReadableName) => {
|
|
|
3498
3502
|
};
|
|
3499
3503
|
/* ------------- Actions ------------ */
|
|
3500
3504
|
// Types of actions
|
|
3501
|
-
var ActionType$
|
|
3505
|
+
var ActionType$6;
|
|
3502
3506
|
(function (ActionType) {
|
|
3503
3507
|
// Show the loading bar
|
|
3504
3508
|
ActionType["StartLoading"] = "start-loading";
|
|
@@ -3520,45 +3524,45 @@ var ActionType$5;
|
|
|
3520
3524
|
ActionType["UpdateActionErrorFilterState"] = "update-action-error-filter-state";
|
|
3521
3525
|
// Update the advanced filter state
|
|
3522
3526
|
ActionType["UpdateAdvancedFilterState"] = "update-advanced-filter-state";
|
|
3523
|
-
})(ActionType$
|
|
3527
|
+
})(ActionType$6 || (ActionType$6 = {}));
|
|
3524
3528
|
/**
|
|
3525
3529
|
* Reducer that executes actions
|
|
3526
3530
|
* @author Gabe Abrams
|
|
3527
3531
|
* @param state current state
|
|
3528
3532
|
* @param action action to execute
|
|
3529
3533
|
*/
|
|
3530
|
-
const reducer$
|
|
3534
|
+
const reducer$7 = (state, action) => {
|
|
3531
3535
|
switch (action.type) {
|
|
3532
|
-
case ActionType$
|
|
3536
|
+
case ActionType$6.StartLoading: {
|
|
3533
3537
|
return Object.assign(Object.assign({}, state), { loading: true });
|
|
3534
3538
|
}
|
|
3535
|
-
case ActionType$
|
|
3539
|
+
case ActionType$6.FinishLoading: {
|
|
3536
3540
|
return Object.assign(Object.assign({}, state), { loading: false, logMap: action.logMap });
|
|
3537
3541
|
}
|
|
3538
|
-
case ActionType$
|
|
3542
|
+
case ActionType$6.ToggleFilterDrawer: {
|
|
3539
3543
|
return Object.assign(Object.assign({}, state), { expandedFilterDrawer: (state.expandedFilterDrawer === action.filterDrawer
|
|
3540
3544
|
? undefined // hide
|
|
3541
3545
|
: action.filterDrawer) });
|
|
3542
3546
|
}
|
|
3543
|
-
case ActionType$
|
|
3547
|
+
case ActionType$6.HideFilterDrawer: {
|
|
3544
3548
|
return Object.assign(Object.assign({}, state), { expandedFilterDrawer: undefined });
|
|
3545
3549
|
}
|
|
3546
|
-
case ActionType$
|
|
3550
|
+
case ActionType$6.ResetFilters: {
|
|
3547
3551
|
return Object.assign(Object.assign({}, state), { dateFilterState: action.initDateFilterState, contextFilterState: action.initContextFilterState, tagFilterState: action.initTagFilterState, actionErrorFilterState: action.initActionErrorFilterState, advancedFilterState: action.initAdvancedFilterState });
|
|
3548
3552
|
}
|
|
3549
|
-
case ActionType$
|
|
3553
|
+
case ActionType$6.UpdateDateFilterState: {
|
|
3550
3554
|
return Object.assign(Object.assign({}, state), { dateFilterState: action.dateFilterState });
|
|
3551
3555
|
}
|
|
3552
|
-
case ActionType$
|
|
3556
|
+
case ActionType$6.UpdateContextFilterState: {
|
|
3553
3557
|
return Object.assign(Object.assign({}, state), { contextFilterState: action.contextFilterState });
|
|
3554
3558
|
}
|
|
3555
|
-
case ActionType$
|
|
3559
|
+
case ActionType$6.UpdateTagFilterState: {
|
|
3556
3560
|
return Object.assign(Object.assign({}, state), { tagFilterState: action.tagFilterState });
|
|
3557
3561
|
}
|
|
3558
|
-
case ActionType$
|
|
3562
|
+
case ActionType$6.UpdateActionErrorFilterState: {
|
|
3559
3563
|
return Object.assign(Object.assign({}, state), { actionErrorFilterState: action.actionErrorFilterState });
|
|
3560
3564
|
}
|
|
3561
|
-
case ActionType$
|
|
3565
|
+
case ActionType$6.UpdateAdvancedFilterState: {
|
|
3562
3566
|
return Object.assign(Object.assign({}, state), { advancedFilterState: action.advancedFilterState });
|
|
3563
3567
|
}
|
|
3564
3568
|
default: {
|
|
@@ -3687,7 +3691,7 @@ const LogReviewer = (props) => {
|
|
|
3687
3691
|
advancedFilterState: initAdvancedFilterState,
|
|
3688
3692
|
};
|
|
3689
3693
|
// Initialize state
|
|
3690
|
-
const [state, dispatch] = useReducer(reducer$
|
|
3694
|
+
const [state, dispatch] = useReducer(reducer$7, initialState);
|
|
3691
3695
|
// Destructure common state
|
|
3692
3696
|
const { loading, logMap, expandedFilterDrawer, dateFilterState, contextFilterState, tagFilterState, actionErrorFilterState, advancedFilterState, } = state;
|
|
3693
3697
|
/*------------------------------------------------------------------------*/
|
|
@@ -3737,7 +3741,7 @@ const LogReviewer = (props) => {
|
|
|
3737
3741
|
const handleDateRangeUpdated = (newDateFilterState) => __awaiter(void 0, void 0, void 0, function* () {
|
|
3738
3742
|
// Update state
|
|
3739
3743
|
dispatch({
|
|
3740
|
-
type: ActionType$
|
|
3744
|
+
type: ActionType$6.UpdateDateFilterState,
|
|
3741
3745
|
dateFilterState: newDateFilterState,
|
|
3742
3746
|
});
|
|
3743
3747
|
// Check which year/month combos we need to load
|
|
@@ -3748,7 +3752,7 @@ const LogReviewer = (props) => {
|
|
|
3748
3752
|
}
|
|
3749
3753
|
// Start loading
|
|
3750
3754
|
dispatch({
|
|
3751
|
-
type: ActionType$
|
|
3755
|
+
type: ActionType$6.StartLoading,
|
|
3752
3756
|
});
|
|
3753
3757
|
// Load required months
|
|
3754
3758
|
try {
|
|
@@ -3772,7 +3776,7 @@ const LogReviewer = (props) => {
|
|
|
3772
3776
|
}
|
|
3773
3777
|
// Finish loading
|
|
3774
3778
|
dispatch({
|
|
3775
|
-
type: ActionType$
|
|
3779
|
+
type: ActionType$6.FinishLoading,
|
|
3776
3780
|
logMap,
|
|
3777
3781
|
});
|
|
3778
3782
|
});
|
|
@@ -3811,7 +3815,7 @@ const LogReviewer = (props) => {
|
|
|
3811
3815
|
React__default.createElement("div", { className: "LogReviewer-filter-toggle-buttons alert alert-secondary p-2 m-0" },
|
|
3812
3816
|
React__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: () => {
|
|
3813
3817
|
dispatch({
|
|
3814
|
-
type: ActionType$
|
|
3818
|
+
type: ActionType$6.ToggleFilterDrawer,
|
|
3815
3819
|
filterDrawer: FilterDrawer.Date,
|
|
3816
3820
|
});
|
|
3817
3821
|
} },
|
|
@@ -3819,7 +3823,7 @@ const LogReviewer = (props) => {
|
|
|
3819
3823
|
"Date"),
|
|
3820
3824
|
React__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: () => {
|
|
3821
3825
|
dispatch({
|
|
3822
|
-
type: ActionType$
|
|
3826
|
+
type: ActionType$6.ToggleFilterDrawer,
|
|
3823
3827
|
filterDrawer: FilterDrawer.Context,
|
|
3824
3828
|
});
|
|
3825
3829
|
} },
|
|
@@ -3827,7 +3831,7 @@ const LogReviewer = (props) => {
|
|
|
3827
3831
|
"Context"),
|
|
3828
3832
|
(LogMetadata.Tag && Object.keys(LogMetadata.Tag).length > 0) && (React__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: () => {
|
|
3829
3833
|
dispatch({
|
|
3830
|
-
type: ActionType$
|
|
3834
|
+
type: ActionType$6.ToggleFilterDrawer,
|
|
3831
3835
|
filterDrawer: FilterDrawer.Tag,
|
|
3832
3836
|
});
|
|
3833
3837
|
} },
|
|
@@ -3835,7 +3839,7 @@ const LogReviewer = (props) => {
|
|
|
3835
3839
|
"Tag")),
|
|
3836
3840
|
React__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: () => {
|
|
3837
3841
|
dispatch({
|
|
3838
|
-
type: ActionType$
|
|
3842
|
+
type: ActionType$6.ToggleFilterDrawer,
|
|
3839
3843
|
filterDrawer: FilterDrawer.Action,
|
|
3840
3844
|
});
|
|
3841
3845
|
} },
|
|
@@ -3843,7 +3847,7 @@ const LogReviewer = (props) => {
|
|
|
3843
3847
|
"Action"),
|
|
3844
3848
|
React__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: () => {
|
|
3845
3849
|
dispatch({
|
|
3846
|
-
type: ActionType$
|
|
3850
|
+
type: ActionType$6.ToggleFilterDrawer,
|
|
3847
3851
|
filterDrawer: FilterDrawer.Advanced,
|
|
3848
3852
|
});
|
|
3849
3853
|
} },
|
|
@@ -3851,7 +3855,7 @@ const LogReviewer = (props) => {
|
|
|
3851
3855
|
"Advanced"),
|
|
3852
3856
|
React__default.createElement("button", { type: "button", id: "LogReviewer-reset-filters-button", className: "btn btn-light", "aria-label": "reset filters", onClick: () => {
|
|
3853
3857
|
dispatch({
|
|
3854
|
-
type: ActionType$
|
|
3858
|
+
type: ActionType$6.ResetFilters,
|
|
3855
3859
|
initActionErrorFilterState,
|
|
3856
3860
|
initAdvancedFilterState,
|
|
3857
3861
|
initContextFilterState,
|
|
@@ -3973,7 +3977,7 @@ const LogReviewer = (props) => {
|
|
|
3973
3977
|
}
|
|
3974
3978
|
});
|
|
3975
3979
|
dispatch({
|
|
3976
|
-
type: ActionType$
|
|
3980
|
+
type: ActionType$6.UpdateContextFilterState,
|
|
3977
3981
|
contextFilterState,
|
|
3978
3982
|
});
|
|
3979
3983
|
} }));
|
|
@@ -3988,7 +3992,7 @@ const LogReviewer = (props) => {
|
|
|
3988
3992
|
return (React__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) => {
|
|
3989
3993
|
tagFilterState[tag] = checked;
|
|
3990
3994
|
dispatch({
|
|
3991
|
-
type: ActionType$
|
|
3995
|
+
type: ActionType$6.UpdateTagFilterState,
|
|
3992
3996
|
tagFilterState,
|
|
3993
3997
|
});
|
|
3994
3998
|
} }));
|
|
@@ -4001,21 +4005,21 @@ const LogReviewer = (props) => {
|
|
|
4001
4005
|
React__default.createElement(RadioButton, { id: "LogReviewer-type-all", text: "All Logs", onSelected: () => {
|
|
4002
4006
|
actionErrorFilterState.type = undefined;
|
|
4003
4007
|
dispatch({
|
|
4004
|
-
type: ActionType$
|
|
4008
|
+
type: ActionType$6.UpdateActionErrorFilterState,
|
|
4005
4009
|
actionErrorFilterState,
|
|
4006
4010
|
});
|
|
4007
4011
|
}, ariaLabel: "show logs of all types", selected: actionErrorFilterState.type === undefined }),
|
|
4008
4012
|
React__default.createElement(RadioButton, { id: "LogReviewer-type-action-only", text: "Action Logs Only", onSelected: () => {
|
|
4009
4013
|
actionErrorFilterState.type = LogType$1.Action;
|
|
4010
4014
|
dispatch({
|
|
4011
|
-
type: ActionType$
|
|
4015
|
+
type: ActionType$6.UpdateActionErrorFilterState,
|
|
4012
4016
|
actionErrorFilterState,
|
|
4013
4017
|
});
|
|
4014
4018
|
}, ariaLabel: "only show action logs", selected: actionErrorFilterState.type === LogType$1.Action }),
|
|
4015
4019
|
React__default.createElement(RadioButton, { id: "LogReviewer-type-error-only", text: "Action Error Only", onSelected: () => {
|
|
4016
4020
|
actionErrorFilterState.type = LogType$1.Error;
|
|
4017
4021
|
dispatch({
|
|
4018
|
-
type: ActionType$
|
|
4022
|
+
type: ActionType$6.UpdateActionErrorFilterState,
|
|
4019
4023
|
actionErrorFilterState,
|
|
4020
4024
|
});
|
|
4021
4025
|
}, ariaLabel: "only show error logs", selected: actionErrorFilterState.type === LogType$1.Error, noMarginOnRight: true })),
|
|
@@ -4027,7 +4031,7 @@ const LogReviewer = (props) => {
|
|
|
4027
4031
|
return (React__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) => {
|
|
4028
4032
|
actionErrorFilterState.action[action] = checked;
|
|
4029
4033
|
dispatch({
|
|
4030
|
-
type: ActionType$
|
|
4034
|
+
type: ActionType$6.UpdateActionErrorFilterState,
|
|
4031
4035
|
actionErrorFilterState,
|
|
4032
4036
|
});
|
|
4033
4037
|
} }));
|
|
@@ -4038,7 +4042,7 @@ const LogReviewer = (props) => {
|
|
|
4038
4042
|
return (React__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) => {
|
|
4039
4043
|
actionErrorFilterState.target[target] = checked;
|
|
4040
4044
|
dispatch({
|
|
4041
|
-
type: ActionType$
|
|
4045
|
+
type: ActionType$6.UpdateActionErrorFilterState,
|
|
4042
4046
|
actionErrorFilterState,
|
|
4043
4047
|
});
|
|
4044
4048
|
} }));
|
|
@@ -4050,7 +4054,7 @@ const LogReviewer = (props) => {
|
|
|
4050
4054
|
React__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) => {
|
|
4051
4055
|
actionErrorFilterState.errorMessage = e.target.value;
|
|
4052
4056
|
dispatch({
|
|
4053
|
-
type: ActionType$
|
|
4057
|
+
type: ActionType$6.UpdateActionErrorFilterState,
|
|
4054
4058
|
actionErrorFilterState,
|
|
4055
4059
|
});
|
|
4056
4060
|
} })),
|
|
@@ -4061,7 +4065,7 @@ const LogReviewer = (props) => {
|
|
|
4061
4065
|
.trim()
|
|
4062
4066
|
.toUpperCase());
|
|
4063
4067
|
dispatch({
|
|
4064
|
-
type: ActionType$
|
|
4068
|
+
type: ActionType$6.UpdateActionErrorFilterState,
|
|
4065
4069
|
actionErrorFilterState,
|
|
4066
4070
|
});
|
|
4067
4071
|
} }))))));
|
|
@@ -4075,7 +4079,7 @@ const LogReviewer = (props) => {
|
|
|
4075
4079
|
React__default.createElement("input", { type: "text", className: "form-control", "aria-label": "query for user first name", value: advancedFilterState.userFirstName, placeholder: "e.g. Divardo", onChange: (e) => {
|
|
4076
4080
|
advancedFilterState.userFirstName = e.target.value;
|
|
4077
4081
|
dispatch({
|
|
4078
|
-
type: ActionType$
|
|
4082
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4079
4083
|
advancedFilterState,
|
|
4080
4084
|
});
|
|
4081
4085
|
} })),
|
|
@@ -4084,7 +4088,7 @@ const LogReviewer = (props) => {
|
|
|
4084
4088
|
React__default.createElement("input", { type: "text", className: "form-control", "aria-label": "query for user last name", value: advancedFilterState.userLastName, placeholder: "e.g. Calicci", onChange: (e) => {
|
|
4085
4089
|
advancedFilterState.userLastName = e.target.value;
|
|
4086
4090
|
dispatch({
|
|
4087
|
-
type: ActionType$
|
|
4091
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4088
4092
|
advancedFilterState,
|
|
4089
4093
|
});
|
|
4090
4094
|
} })),
|
|
@@ -4094,7 +4098,7 @@ const LogReviewer = (props) => {
|
|
|
4094
4098
|
advancedFilterState.userEmail = ((e.target.value)
|
|
4095
4099
|
.trim());
|
|
4096
4100
|
dispatch({
|
|
4097
|
-
type: ActionType$
|
|
4101
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4098
4102
|
advancedFilterState,
|
|
4099
4103
|
});
|
|
4100
4104
|
} })),
|
|
@@ -4108,7 +4112,7 @@ const LogReviewer = (props) => {
|
|
|
4108
4112
|
.trim());
|
|
4109
4113
|
}
|
|
4110
4114
|
dispatch({
|
|
4111
|
-
type: ActionType$
|
|
4115
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4112
4116
|
advancedFilterState,
|
|
4113
4117
|
});
|
|
4114
4118
|
} })),
|
|
@@ -4116,21 +4120,21 @@ const LogReviewer = (props) => {
|
|
|
4116
4120
|
React__default.createElement(CheckboxButton, { text: "Students", onChanged: (checked) => {
|
|
4117
4121
|
advancedFilterState.includeLearners = checked;
|
|
4118
4122
|
dispatch({
|
|
4119
|
-
type: ActionType$
|
|
4123
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4120
4124
|
advancedFilterState,
|
|
4121
4125
|
});
|
|
4122
4126
|
}, checked: advancedFilterState.includeLearners, ariaLabel: "show logs from students" }),
|
|
4123
4127
|
React__default.createElement(CheckboxButton, { text: "Teaching Team Members", onChanged: (checked) => {
|
|
4124
4128
|
advancedFilterState.includeTTMs = checked;
|
|
4125
4129
|
dispatch({
|
|
4126
|
-
type: ActionType$
|
|
4130
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4127
4131
|
advancedFilterState,
|
|
4128
4132
|
});
|
|
4129
4133
|
}, checked: advancedFilterState.includeTTMs, ariaLabel: "show logs from teaching team members" }),
|
|
4130
4134
|
React__default.createElement(CheckboxButton, { text: "Admins", onChanged: (checked) => {
|
|
4131
4135
|
advancedFilterState.includeAdmins = checked;
|
|
4132
4136
|
dispatch({
|
|
4133
|
-
type: ActionType$
|
|
4137
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4134
4138
|
advancedFilterState,
|
|
4135
4139
|
});
|
|
4136
4140
|
}, checked: advancedFilterState.includeAdmins, ariaLabel: "show logs from admins" }))),
|
|
@@ -4140,7 +4144,7 @@ const LogReviewer = (props) => {
|
|
|
4140
4144
|
React__default.createElement("input", { type: "text", className: "form-control", "aria-label": "query for course name", value: advancedFilterState.courseName, placeholder: "e.g. GLC 200", onChange: (e) => {
|
|
4141
4145
|
advancedFilterState.courseName = e.target.value;
|
|
4142
4146
|
dispatch({
|
|
4143
|
-
type: ActionType$
|
|
4147
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4144
4148
|
advancedFilterState,
|
|
4145
4149
|
});
|
|
4146
4150
|
} })),
|
|
@@ -4154,7 +4158,7 @@ const LogReviewer = (props) => {
|
|
|
4154
4158
|
.trim());
|
|
4155
4159
|
}
|
|
4156
4160
|
dispatch({
|
|
4157
|
-
type: ActionType$
|
|
4161
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4158
4162
|
advancedFilterState,
|
|
4159
4163
|
});
|
|
4160
4164
|
} }))),
|
|
@@ -4163,21 +4167,21 @@ const LogReviewer = (props) => {
|
|
|
4163
4167
|
React__default.createElement(RadioButton, { text: "All Devices", ariaLabel: "show logs from all devices", selected: advancedFilterState.isMobile === undefined, onSelected: () => {
|
|
4164
4168
|
advancedFilterState.isMobile = undefined;
|
|
4165
4169
|
dispatch({
|
|
4166
|
-
type: ActionType$
|
|
4170
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4167
4171
|
advancedFilterState,
|
|
4168
4172
|
});
|
|
4169
4173
|
} }),
|
|
4170
4174
|
React__default.createElement(RadioButton, { text: "Mobile Only", ariaLabel: "show logs from mobile devices", selected: advancedFilterState.isMobile === true, onSelected: () => {
|
|
4171
4175
|
advancedFilterState.isMobile = true;
|
|
4172
4176
|
dispatch({
|
|
4173
|
-
type: ActionType$
|
|
4177
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4174
4178
|
advancedFilterState,
|
|
4175
4179
|
});
|
|
4176
4180
|
} }),
|
|
4177
4181
|
React__default.createElement(RadioButton, { text: "Desktop Only", ariaLabel: "show logs from desktop devices", selected: advancedFilterState.isMobile === false, onSelected: () => {
|
|
4178
4182
|
advancedFilterState.isMobile = false;
|
|
4179
4183
|
dispatch({
|
|
4180
|
-
type: ActionType$
|
|
4184
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4181
4185
|
advancedFilterState,
|
|
4182
4186
|
});
|
|
4183
4187
|
}, noMarginOnRight: true }))),
|
|
@@ -4186,21 +4190,21 @@ const LogReviewer = (props) => {
|
|
|
4186
4190
|
React__default.createElement(RadioButton, { text: "Both", ariaLabel: "show logs from all sources", selected: advancedFilterState.source === undefined, onSelected: () => {
|
|
4187
4191
|
advancedFilterState.source = undefined;
|
|
4188
4192
|
dispatch({
|
|
4189
|
-
type: ActionType$
|
|
4193
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4190
4194
|
advancedFilterState,
|
|
4191
4195
|
});
|
|
4192
4196
|
} }),
|
|
4193
4197
|
React__default.createElement(RadioButton, { text: "Client Only", ariaLabel: "show logs from client source", selected: advancedFilterState.source === LogSource$1.Client, onSelected: () => {
|
|
4194
4198
|
advancedFilterState.source = LogSource$1.Client;
|
|
4195
4199
|
dispatch({
|
|
4196
|
-
type: ActionType$
|
|
4200
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4197
4201
|
advancedFilterState,
|
|
4198
4202
|
});
|
|
4199
4203
|
} }),
|
|
4200
4204
|
React__default.createElement(RadioButton, { text: "Server Only", ariaLabel: "show logs from server source", selected: advancedFilterState.source === LogSource$1.Server, onSelected: () => {
|
|
4201
4205
|
advancedFilterState.source = LogSource$1.Server;
|
|
4202
4206
|
dispatch({
|
|
4203
|
-
type: ActionType$
|
|
4207
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4204
4208
|
advancedFilterState,
|
|
4205
4209
|
});
|
|
4206
4210
|
}, noMarginOnRight: true })),
|
|
@@ -4211,7 +4215,7 @@ const LogReviewer = (props) => {
|
|
|
4211
4215
|
advancedFilterState.courseName = ((e.target.value)
|
|
4212
4216
|
.trim());
|
|
4213
4217
|
dispatch({
|
|
4214
|
-
type: ActionType$
|
|
4218
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4215
4219
|
advancedFilterState,
|
|
4216
4220
|
});
|
|
4217
4221
|
} })),
|
|
@@ -4221,7 +4225,7 @@ const LogReviewer = (props) => {
|
|
|
4221
4225
|
advancedFilterState.courseName = ((e.target.value)
|
|
4222
4226
|
.trim());
|
|
4223
4227
|
dispatch({
|
|
4224
|
-
type: ActionType$
|
|
4228
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4225
4229
|
advancedFilterState,
|
|
4226
4230
|
});
|
|
4227
4231
|
} })))))));
|
|
@@ -12041,11 +12045,11 @@ var CreatableSelect$1 = CreatableSelect;
|
|
|
12041
12045
|
*/
|
|
12042
12046
|
/* ------------- Actions ------------ */
|
|
12043
12047
|
// Types of actions
|
|
12044
|
-
var ActionType$
|
|
12048
|
+
var ActionType$5;
|
|
12045
12049
|
(function (ActionType) {
|
|
12046
12050
|
// Update the input value
|
|
12047
12051
|
ActionType["SetInputValue"] = "SetInputValue";
|
|
12048
|
-
})(ActionType$
|
|
12052
|
+
})(ActionType$5 || (ActionType$5 = {}));
|
|
12049
12053
|
/**
|
|
12050
12054
|
* Reducer that executes actions
|
|
12051
12055
|
* @author Yuen Ler Chow
|
|
@@ -12053,9 +12057,9 @@ var ActionType$4;
|
|
|
12053
12057
|
* @param action action to execute
|
|
12054
12058
|
* @returns updated state
|
|
12055
12059
|
*/
|
|
12056
|
-
const reducer$
|
|
12060
|
+
const reducer$6 = (state, action) => {
|
|
12057
12061
|
switch (action.type) {
|
|
12058
|
-
case ActionType$
|
|
12062
|
+
case ActionType$5.SetInputValue: {
|
|
12059
12063
|
return Object.assign(Object.assign({}, state), { inputValue: action.value });
|
|
12060
12064
|
}
|
|
12061
12065
|
default: {
|
|
@@ -12075,7 +12079,7 @@ const CreatableMultiselect = (props) => {
|
|
|
12075
12079
|
inputValue: '',
|
|
12076
12080
|
};
|
|
12077
12081
|
// Initialize state
|
|
12078
|
-
const [state, dispatch] = useReducer(reducer$
|
|
12082
|
+
const [state, dispatch] = useReducer(reducer$6, initialState);
|
|
12079
12083
|
// Destructure common state
|
|
12080
12084
|
const { inputValue } = state;
|
|
12081
12085
|
/*------------------------------------------------------------------------*/
|
|
@@ -12152,7 +12156,7 @@ const CreatableMultiselect = (props) => {
|
|
|
12152
12156
|
}
|
|
12153
12157
|
// Reset text field to empty because the values have been added
|
|
12154
12158
|
dispatch({
|
|
12155
|
-
type: ActionType$
|
|
12159
|
+
type: ActionType$5.SetInputValue,
|
|
12156
12160
|
value: '',
|
|
12157
12161
|
});
|
|
12158
12162
|
};
|
|
@@ -12191,7 +12195,7 @@ const CreatableMultiselect = (props) => {
|
|
|
12191
12195
|
else {
|
|
12192
12196
|
// simply update the input value to the new input value
|
|
12193
12197
|
dispatch({
|
|
12194
|
-
type: ActionType$
|
|
12198
|
+
type: ActionType$5.SetInputValue,
|
|
12195
12199
|
value: newValue,
|
|
12196
12200
|
});
|
|
12197
12201
|
}
|
|
@@ -12243,13 +12247,13 @@ const style$1 = `
|
|
|
12243
12247
|
`;
|
|
12244
12248
|
/* ------------- Actions ------------ */
|
|
12245
12249
|
// Types of actions
|
|
12246
|
-
var ActionType$
|
|
12250
|
+
var ActionType$4;
|
|
12247
12251
|
(function (ActionType) {
|
|
12248
12252
|
// Update the DBEntry
|
|
12249
12253
|
ActionType["UpdateDBEntry"] = "UpdateDBEntry";
|
|
12250
12254
|
// Start the save spinner
|
|
12251
12255
|
ActionType["StartSave"] = "StartSave";
|
|
12252
|
-
})(ActionType$
|
|
12256
|
+
})(ActionType$4 || (ActionType$4 = {}));
|
|
12253
12257
|
/**
|
|
12254
12258
|
* Reducer that executes actions
|
|
12255
12259
|
* @author Yuen Ler Chow
|
|
@@ -12257,12 +12261,12 @@ var ActionType$3;
|
|
|
12257
12261
|
* @param action action to execute
|
|
12258
12262
|
* @returns updated state
|
|
12259
12263
|
*/
|
|
12260
|
-
const reducer$
|
|
12264
|
+
const reducer$5 = (state, action) => {
|
|
12261
12265
|
switch (action.type) {
|
|
12262
|
-
case ActionType$
|
|
12266
|
+
case ActionType$4.UpdateDBEntry: {
|
|
12263
12267
|
return Object.assign(Object.assign({}, state), { entry: action.dbEntry });
|
|
12264
12268
|
}
|
|
12265
|
-
case ActionType$
|
|
12269
|
+
case ActionType$4.StartSave: {
|
|
12266
12270
|
return Object.assign(Object.assign({}, state), { saving: true });
|
|
12267
12271
|
}
|
|
12268
12272
|
default: {
|
|
@@ -12287,7 +12291,7 @@ const AddOrEditDBEntry = (props) => {
|
|
|
12287
12291
|
saving: false,
|
|
12288
12292
|
};
|
|
12289
12293
|
// Initialize state
|
|
12290
|
-
const [state, dispatch] = useReducer(reducer$
|
|
12294
|
+
const [state, dispatch] = useReducer(reducer$5, initialState);
|
|
12291
12295
|
// Destructure common state
|
|
12292
12296
|
const { entry, saving, } = state;
|
|
12293
12297
|
/*------------------------------------------------------------------------*/
|
|
@@ -12299,7 +12303,7 @@ const AddOrEditDBEntry = (props) => {
|
|
|
12299
12303
|
*/
|
|
12300
12304
|
const save = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
12301
12305
|
// Start the save loading indicator
|
|
12302
|
-
dispatch({ type: ActionType$
|
|
12306
|
+
dispatch({ type: ActionType$4.StartSave });
|
|
12303
12307
|
// add all default values to the entry
|
|
12304
12308
|
entryFields.forEach((field) => {
|
|
12305
12309
|
if (field.defaultValue && !entry[field.objectKey]) {
|
|
@@ -12482,7 +12486,7 @@ const AddOrEditDBEntry = (props) => {
|
|
|
12482
12486
|
return (React__default.createElement(RadioButton, { key: choice.value, text: choice.title, selected: entry[field.objectKey] === choice.value, onSelected: () => {
|
|
12483
12487
|
entry[field.objectKey] = choice.value;
|
|
12484
12488
|
dispatch({
|
|
12485
|
-
type: ActionType$
|
|
12489
|
+
type: ActionType$4.UpdateDBEntry,
|
|
12486
12490
|
dbEntry: entry,
|
|
12487
12491
|
});
|
|
12488
12492
|
}, ariaLabel: choice.title }));
|
|
@@ -12494,7 +12498,7 @@ const AddOrEditDBEntry = (props) => {
|
|
|
12494
12498
|
React__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) => {
|
|
12495
12499
|
entry[field.objectKey] = (e.target.value);
|
|
12496
12500
|
dispatch({
|
|
12497
|
-
type: ActionType$
|
|
12501
|
+
type: ActionType$4.UpdateDBEntry,
|
|
12498
12502
|
dbEntry: entry,
|
|
12499
12503
|
});
|
|
12500
12504
|
} }))));
|
|
@@ -12507,7 +12511,7 @@ const AddOrEditDBEntry = (props) => {
|
|
|
12507
12511
|
entry[field.objectKey] = (e.target.value
|
|
12508
12512
|
.replace(/[^0-9]/g, ''));
|
|
12509
12513
|
dispatch({
|
|
12510
|
-
type: ActionType$
|
|
12514
|
+
type: ActionType$4.UpdateDBEntry,
|
|
12511
12515
|
dbEntry: entry,
|
|
12512
12516
|
});
|
|
12513
12517
|
} }))));
|
|
@@ -12537,7 +12541,7 @@ const AddOrEditDBEntry = (props) => {
|
|
|
12537
12541
|
}
|
|
12538
12542
|
// Save
|
|
12539
12543
|
dispatch({
|
|
12540
|
-
type: ActionType$
|
|
12544
|
+
type: ActionType$4.UpdateDBEntry,
|
|
12541
12545
|
dbEntry: entry,
|
|
12542
12546
|
});
|
|
12543
12547
|
}, ariaLabel: choice.title }));
|
|
@@ -12552,7 +12556,7 @@ const AddOrEditDBEntry = (props) => {
|
|
|
12552
12556
|
// Update entry and save
|
|
12553
12557
|
entry[field.objectKey] = values;
|
|
12554
12558
|
dispatch({
|
|
12555
|
-
type: ActionType$
|
|
12559
|
+
type: ActionType$4.UpdateDBEntry,
|
|
12556
12560
|
dbEntry: entry,
|
|
12557
12561
|
});
|
|
12558
12562
|
} })))));
|
|
@@ -12565,7 +12569,7 @@ const AddOrEditDBEntry = (props) => {
|
|
|
12565
12569
|
React__default.createElement(CreatableMultiselect, { disabled: disabled, type: DBEntryFieldType$1.NumberArray, values: entry[field.objectKey] || [], onChange: (values) => {
|
|
12566
12570
|
entry[field.objectKey] = values;
|
|
12567
12571
|
dispatch({
|
|
12568
|
-
type: ActionType$
|
|
12572
|
+
type: ActionType$4.UpdateDBEntry,
|
|
12569
12573
|
dbEntry: entry,
|
|
12570
12574
|
});
|
|
12571
12575
|
} })))));
|
|
@@ -12639,7 +12643,7 @@ const generateEndpointPath = (collectionName, adminsOnly) => {
|
|
|
12639
12643
|
*/
|
|
12640
12644
|
/* ------------- Actions ------------ */
|
|
12641
12645
|
// Types of actions
|
|
12642
|
-
var ActionType$
|
|
12646
|
+
var ActionType$3;
|
|
12643
12647
|
(function (ActionType) {
|
|
12644
12648
|
// Show adder
|
|
12645
12649
|
ActionType["ShowAdder"] = "ShowAdder";
|
|
@@ -12653,7 +12657,7 @@ var ActionType$2;
|
|
|
12653
12657
|
ActionType["StartDelete"] = "StartDelete";
|
|
12654
12658
|
// Finish deletion process
|
|
12655
12659
|
ActionType["FinishDelete"] = "FinishDelete";
|
|
12656
|
-
})(ActionType$
|
|
12660
|
+
})(ActionType$3 || (ActionType$3 = {}));
|
|
12657
12661
|
/**
|
|
12658
12662
|
* Reducer that executes actions
|
|
12659
12663
|
* @author Yuen Ler Chow
|
|
@@ -12661,18 +12665,18 @@ var ActionType$2;
|
|
|
12661
12665
|
* @param action action to execute
|
|
12662
12666
|
* @returns updated state
|
|
12663
12667
|
*/
|
|
12664
|
-
const reducer$
|
|
12668
|
+
const reducer$4 = (state, action) => {
|
|
12665
12669
|
switch (action.type) {
|
|
12666
|
-
case ActionType$
|
|
12670
|
+
case ActionType$3.FinishLoading: {
|
|
12667
12671
|
return Object.assign(Object.assign({}, state), { loading: false, dbEntries: action.dbEntries });
|
|
12668
12672
|
}
|
|
12669
|
-
case ActionType$
|
|
12673
|
+
case ActionType$3.ShowAdder: {
|
|
12670
12674
|
return Object.assign(Object.assign({}, state), { adding: true, dbEntryToEdit: undefined });
|
|
12671
12675
|
}
|
|
12672
|
-
case ActionType$
|
|
12676
|
+
case ActionType$3.ShowEditor: {
|
|
12673
12677
|
return Object.assign(Object.assign({}, state), { adding: false, dbEntryToEdit: action.dbEntry });
|
|
12674
12678
|
}
|
|
12675
|
-
case ActionType$
|
|
12679
|
+
case ActionType$3.FinishAdd: {
|
|
12676
12680
|
// Handle cancel
|
|
12677
12681
|
const finishedEntry = action.dbEntry;
|
|
12678
12682
|
if (!finishedEntry) {
|
|
@@ -12696,10 +12700,10 @@ const reducer$3 = (state, action) => {
|
|
|
12696
12700
|
// Update the state
|
|
12697
12701
|
return Object.assign(Object.assign({}, state), { adding: false, dbEntryToEdit: undefined, dbEntries: updatedDbEntries });
|
|
12698
12702
|
}
|
|
12699
|
-
case ActionType$
|
|
12703
|
+
case ActionType$3.StartDelete: {
|
|
12700
12704
|
return Object.assign(Object.assign({}, state), { loading: true });
|
|
12701
12705
|
}
|
|
12702
|
-
case ActionType$
|
|
12706
|
+
case ActionType$3.FinishDelete: {
|
|
12703
12707
|
return Object.assign(Object.assign({}, state), { loading: false,
|
|
12704
12708
|
// Remove the deleted entry from the list
|
|
12705
12709
|
dbEntries: state.dbEntries.filter((entry) => {
|
|
@@ -12725,7 +12729,7 @@ const DBEntryManagerPanel = (props) => {
|
|
|
12725
12729
|
loading: true,
|
|
12726
12730
|
};
|
|
12727
12731
|
// Initialize state
|
|
12728
|
-
const [state, dispatch] = useReducer(reducer$
|
|
12732
|
+
const [state, dispatch] = useReducer(reducer$4, initialState);
|
|
12729
12733
|
// Destructure common state
|
|
12730
12734
|
const { adding, dbEntryToEdit, dbEntries, loading, } = state;
|
|
12731
12735
|
/*------------------------------------------------------------------------*/
|
|
@@ -12751,7 +12755,7 @@ const DBEntryManagerPanel = (props) => {
|
|
|
12751
12755
|
try {
|
|
12752
12756
|
// Start loader
|
|
12753
12757
|
dispatch({
|
|
12754
|
-
type: ActionType$
|
|
12758
|
+
type: ActionType$3.StartDelete,
|
|
12755
12759
|
});
|
|
12756
12760
|
// Perform deletion
|
|
12757
12761
|
yield visitServerEndpoint({
|
|
@@ -12760,7 +12764,7 @@ const DBEntryManagerPanel = (props) => {
|
|
|
12760
12764
|
});
|
|
12761
12765
|
// Finish loader
|
|
12762
12766
|
dispatch({
|
|
12763
|
-
type: ActionType$
|
|
12767
|
+
type: ActionType$3.FinishDelete,
|
|
12764
12768
|
dbEntry: entry,
|
|
12765
12769
|
idPropName,
|
|
12766
12770
|
});
|
|
@@ -12789,7 +12793,7 @@ const DBEntryManagerPanel = (props) => {
|
|
|
12789
12793
|
});
|
|
12790
12794
|
// Save loaded data
|
|
12791
12795
|
dispatch({
|
|
12792
|
-
type: ActionType$
|
|
12796
|
+
type: ActionType$3.FinishLoading,
|
|
12793
12797
|
dbEntries: data,
|
|
12794
12798
|
});
|
|
12795
12799
|
}
|
|
@@ -12832,7 +12836,7 @@ const DBEntryManagerPanel = (props) => {
|
|
|
12832
12836
|
React__default.createElement("span", { className: "d-none d-md-inline ms-1" }, "Remove")),
|
|
12833
12837
|
!disableEdit && (React__default.createElement("button", { type: "button", id: `DBEntryManagerPanel-edit-with-id-${entry[idPropName]}`, className: "btn btn-primary", "aria-label": `edit db entry: ${entry[titlePropName]}`, onClick: () => {
|
|
12834
12838
|
dispatch({
|
|
12835
|
-
type: ActionType$
|
|
12839
|
+
type: ActionType$3.ShowEditor,
|
|
12836
12840
|
dbEntry: entry,
|
|
12837
12841
|
});
|
|
12838
12842
|
} },
|
|
@@ -12842,7 +12846,7 @@ const DBEntryManagerPanel = (props) => {
|
|
|
12842
12846
|
React__default.createElement("div", { className: "d-grid" },
|
|
12843
12847
|
React__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: () => {
|
|
12844
12848
|
dispatch({
|
|
12845
|
-
type: ActionType$
|
|
12849
|
+
type: ActionType$3.ShowAdder,
|
|
12846
12850
|
});
|
|
12847
12851
|
} },
|
|
12848
12852
|
React__default.createElement(FontAwesomeIcon, { icon: faPlus, className: "me-2" }),
|
|
@@ -12854,7 +12858,7 @@ const DBEntryManagerPanel = (props) => {
|
|
|
12854
12858
|
if (!loading && (adding || dbEntryToEdit)) {
|
|
12855
12859
|
body = (React__default.createElement(AddOrEditDBEntry, { saveEndpointPath: endpoint, validateEntry: validateEntry, modifyEntry: modifyEntry, entryFields: entryFields, dbEntryToEdit: dbEntryToEdit, idPropName: idPropName, entries: dbEntries, itemName: itemName, onFinished: (entry) => {
|
|
12856
12860
|
dispatch({
|
|
12857
|
-
type: ActionType$
|
|
12861
|
+
type: ActionType$3.FinishAdd,
|
|
12858
12862
|
dbEntry: entry,
|
|
12859
12863
|
idPropName,
|
|
12860
12864
|
});
|
|
@@ -13051,25 +13055,25 @@ const getItemIds = (items) => {
|
|
|
13051
13055
|
};
|
|
13052
13056
|
/* ------------- Actions ------------ */
|
|
13053
13057
|
// Types of actions
|
|
13054
|
-
var ActionType$
|
|
13058
|
+
var ActionType$2;
|
|
13055
13059
|
(function (ActionType) {
|
|
13056
13060
|
// Hide the "jump to bottom" button
|
|
13057
13061
|
ActionType["HideJumpToBottomButton"] = "HideJumpToBottomButton";
|
|
13058
13062
|
// Show the "jump to bottom" button
|
|
13059
13063
|
ActionType["ShowJumpToBottomButton"] = "ShowJumpToBottomButton";
|
|
13060
|
-
})(ActionType$
|
|
13064
|
+
})(ActionType$2 || (ActionType$2 = {}));
|
|
13061
13065
|
/**
|
|
13062
13066
|
* Reducer that executes actions
|
|
13063
13067
|
* @author Gabe Abrams
|
|
13064
13068
|
* @param state current state
|
|
13065
13069
|
* @param action action to execute
|
|
13066
13070
|
*/
|
|
13067
|
-
const reducer$
|
|
13071
|
+
const reducer$3 = (state, action) => {
|
|
13068
13072
|
switch (action.type) {
|
|
13069
|
-
case ActionType$
|
|
13073
|
+
case ActionType$2.HideJumpToBottomButton: {
|
|
13070
13074
|
return Object.assign(Object.assign({}, state), { jumpToBottomButtonVisible: false });
|
|
13071
13075
|
}
|
|
13072
|
-
case ActionType$
|
|
13076
|
+
case ActionType$2.ShowJumpToBottomButton: {
|
|
13073
13077
|
return Object.assign(Object.assign({}, state), { jumpToBottomButtonVisible: true });
|
|
13074
13078
|
}
|
|
13075
13079
|
default: {
|
|
@@ -13093,7 +13097,7 @@ const AutoscrollToBottomContainer = (props) => {
|
|
|
13093
13097
|
jumpToBottomButtonVisible: false,
|
|
13094
13098
|
};
|
|
13095
13099
|
// Initialize state
|
|
13096
|
-
const [state, dispatch] = useReducer(reducer$
|
|
13100
|
+
const [state, dispatch] = useReducer(reducer$3, initialState);
|
|
13097
13101
|
// Destructure common state
|
|
13098
13102
|
const { jumpToBottomButtonVisible, } = state;
|
|
13099
13103
|
/* -------------- Refs -------------- */
|
|
@@ -13139,7 +13143,7 @@ const AutoscrollToBottomContainer = (props) => {
|
|
|
13139
13143
|
}
|
|
13140
13144
|
// Update state
|
|
13141
13145
|
dispatch({
|
|
13142
|
-
type: ActionType$
|
|
13146
|
+
type: ActionType$2.HideJumpToBottomButton,
|
|
13143
13147
|
});
|
|
13144
13148
|
// Scroll to bottom
|
|
13145
13149
|
container.current.scrollTop = (container.current.scrollHeight
|
|
@@ -13163,7 +13167,7 @@ const AutoscrollToBottomContainer = (props) => {
|
|
|
13163
13167
|
if (isScrolledToBottom()) {
|
|
13164
13168
|
// Hide button
|
|
13165
13169
|
dispatch({
|
|
13166
|
-
type: ActionType$
|
|
13170
|
+
type: ActionType$2.HideJumpToBottomButton,
|
|
13167
13171
|
});
|
|
13168
13172
|
}
|
|
13169
13173
|
};
|
|
@@ -13205,7 +13209,7 @@ const AutoscrollToBottomContainer = (props) => {
|
|
|
13205
13209
|
else {
|
|
13206
13210
|
// Not scrolled to bottom. Show "jump to bottom" button.
|
|
13207
13211
|
dispatch({
|
|
13208
|
-
type: ActionType$
|
|
13212
|
+
type: ActionType$2.ShowJumpToBottomButton,
|
|
13209
13213
|
});
|
|
13210
13214
|
}
|
|
13211
13215
|
}, [items]);
|
|
@@ -13275,25 +13279,25 @@ const combineClassNames = (classNames) => {
|
|
|
13275
13279
|
*/
|
|
13276
13280
|
/* ------------- Actions ------------ */
|
|
13277
13281
|
// Types of actions
|
|
13278
|
-
var ActionType;
|
|
13282
|
+
var ActionType$1;
|
|
13279
13283
|
(function (ActionType) {
|
|
13280
13284
|
// Start hovering on an option
|
|
13281
13285
|
ActionType["StartHover"] = "StartHover";
|
|
13282
13286
|
// Stop hovering on an option
|
|
13283
13287
|
ActionType["StopHover"] = "StopHover";
|
|
13284
|
-
})(ActionType || (ActionType = {}));
|
|
13288
|
+
})(ActionType$1 || (ActionType$1 = {}));
|
|
13285
13289
|
/**
|
|
13286
13290
|
* Reducer that executes actions
|
|
13287
13291
|
* @author Gabe Abrams
|
|
13288
13292
|
* @param state current state
|
|
13289
13293
|
* @param action action to execute
|
|
13290
13294
|
*/
|
|
13291
|
-
const reducer$
|
|
13295
|
+
const reducer$2 = (state, action) => {
|
|
13292
13296
|
switch (action.type) {
|
|
13293
|
-
case ActionType.StartHover: {
|
|
13297
|
+
case ActionType$1.StartHover: {
|
|
13294
13298
|
return Object.assign(Object.assign({}, state), { hoveredOptionId: action.hoveredOptionId });
|
|
13295
13299
|
}
|
|
13296
|
-
case ActionType.StopHover: {
|
|
13300
|
+
case ActionType$1.StopHover: {
|
|
13297
13301
|
return Object.assign(Object.assign({}, state), { hoveredOptionId: undefined });
|
|
13298
13302
|
}
|
|
13299
13303
|
default: {
|
|
@@ -13317,7 +13321,7 @@ const MultiSwitch = (props) => {
|
|
|
13317
13321
|
hoveredOptionId: undefined,
|
|
13318
13322
|
};
|
|
13319
13323
|
// Initialize state
|
|
13320
|
-
const [state, dispatch] = useReducer(reducer$
|
|
13324
|
+
const [state, dispatch] = useReducer(reducer$2, initialState);
|
|
13321
13325
|
// Destructure common state
|
|
13322
13326
|
const { hoveredOptionId, } = state;
|
|
13323
13327
|
/*------------------------------------------------------------------------*/
|
|
@@ -13449,27 +13453,27 @@ const MultiSwitch = (props) => {
|
|
|
13449
13453
|
: `click to select option "${option.label}"`), onClick: () => {
|
|
13450
13454
|
// Remove hover
|
|
13451
13455
|
dispatch({
|
|
13452
|
-
type: ActionType.StopHover,
|
|
13456
|
+
type: ActionType$1.StopHover,
|
|
13453
13457
|
});
|
|
13454
13458
|
// Notify parent
|
|
13455
13459
|
onChange(option.id);
|
|
13456
13460
|
}, onMouseEnter: () => {
|
|
13457
13461
|
dispatch({
|
|
13458
|
-
type: ActionType.StartHover,
|
|
13462
|
+
type: ActionType$1.StartHover,
|
|
13459
13463
|
hoveredOptionId: option.id,
|
|
13460
13464
|
});
|
|
13461
13465
|
}, onMouseLeave: () => {
|
|
13462
13466
|
dispatch({
|
|
13463
|
-
type: ActionType.StopHover,
|
|
13467
|
+
type: ActionType$1.StopHover,
|
|
13464
13468
|
});
|
|
13465
13469
|
}, onFocus: () => {
|
|
13466
13470
|
dispatch({
|
|
13467
|
-
type: ActionType.StartHover,
|
|
13471
|
+
type: ActionType$1.StartHover,
|
|
13468
13472
|
hoveredOptionId: option.id,
|
|
13469
13473
|
});
|
|
13470
13474
|
}, onBlur: () => {
|
|
13471
13475
|
dispatch({
|
|
13472
|
-
type: ActionType.StopHover,
|
|
13476
|
+
type: ActionType$1.StopHover,
|
|
13473
13477
|
});
|
|
13474
13478
|
}, style: {
|
|
13475
13479
|
pointerEvents: ((option.id === selectedOptionId)
|
|
@@ -13488,6 +13492,147 @@ const MultiSwitch = (props) => {
|
|
|
13488
13492
|
React__default.createElement("div", { className: "MultiSwitch-highlight-container" }, highlight)));
|
|
13489
13493
|
};
|
|
13490
13494
|
|
|
13495
|
+
// Types of dropdown items
|
|
13496
|
+
var DropdownItemType;
|
|
13497
|
+
(function (DropdownItemType) {
|
|
13498
|
+
// Dropdown header
|
|
13499
|
+
DropdownItemType["Header"] = "Header";
|
|
13500
|
+
// Dropdown divider
|
|
13501
|
+
DropdownItemType["Divider"] = "Divider";
|
|
13502
|
+
// Dropdown item
|
|
13503
|
+
DropdownItemType["Item"] = "Item";
|
|
13504
|
+
})(DropdownItemType || (DropdownItemType = {}));
|
|
13505
|
+
var DropdownItemType$1 = DropdownItemType;
|
|
13506
|
+
|
|
13507
|
+
/**
|
|
13508
|
+
* A simple dropdown menu
|
|
13509
|
+
* @author Alessandra De Lucas
|
|
13510
|
+
* @author Yuen Ler Chow
|
|
13511
|
+
* @author Gabe Abrams
|
|
13512
|
+
*/
|
|
13513
|
+
/* ------------- Actions ------------ */
|
|
13514
|
+
// Types of actions
|
|
13515
|
+
var ActionType;
|
|
13516
|
+
(function (ActionType) {
|
|
13517
|
+
// Toggle opening the dropdown menu
|
|
13518
|
+
ActionType["ToggleDropdown"] = "ToggleDropdown";
|
|
13519
|
+
// Close the dropdown menu
|
|
13520
|
+
ActionType["CloseDropdown"] = "CloseDropdown";
|
|
13521
|
+
})(ActionType || (ActionType = {}));
|
|
13522
|
+
/**
|
|
13523
|
+
* Reducer that executes actions
|
|
13524
|
+
* @author Alessandra De Lucas
|
|
13525
|
+
* @author Yuen Ler Chow
|
|
13526
|
+
* @param state current state
|
|
13527
|
+
* @param action action to execute
|
|
13528
|
+
*/
|
|
13529
|
+
const reducer$1 = (state, action) => {
|
|
13530
|
+
switch (action.type) {
|
|
13531
|
+
case ActionType.ToggleDropdown: {
|
|
13532
|
+
return Object.assign(Object.assign({}, state), { isDropdownOpen: !state.isDropdownOpen });
|
|
13533
|
+
}
|
|
13534
|
+
case ActionType.CloseDropdown: {
|
|
13535
|
+
return Object.assign(Object.assign({}, state), { isDropdownOpen: false });
|
|
13536
|
+
}
|
|
13537
|
+
default: {
|
|
13538
|
+
return state;
|
|
13539
|
+
}
|
|
13540
|
+
}
|
|
13541
|
+
};
|
|
13542
|
+
/*------------------------------------------------------------------------*/
|
|
13543
|
+
/* ------------------------------ Component ----------------------------- */
|
|
13544
|
+
/*------------------------------------------------------------------------*/
|
|
13545
|
+
const Dropdown = (props) => {
|
|
13546
|
+
/*------------------------------------------------------------------------*/
|
|
13547
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
13548
|
+
/*------------------------------------------------------------------------*/
|
|
13549
|
+
/* -------------- Props ------------- */
|
|
13550
|
+
// Destructure all props
|
|
13551
|
+
const { dropdownButton, items, } = props;
|
|
13552
|
+
/* -------------- State ------------- */
|
|
13553
|
+
// Initial state
|
|
13554
|
+
const initialState = {
|
|
13555
|
+
isDropdownOpen: false,
|
|
13556
|
+
};
|
|
13557
|
+
// Initialize state
|
|
13558
|
+
const [state, dispatch] = useReducer(reducer$1, initialState);
|
|
13559
|
+
// Destructure common state
|
|
13560
|
+
const { isDropdownOpen, } = state;
|
|
13561
|
+
/* -------------- Refs -------------- */
|
|
13562
|
+
// Initialize refs
|
|
13563
|
+
const dropdownRef = useRef(null);
|
|
13564
|
+
/*------------------------------------------------------------------------*/
|
|
13565
|
+
/* ------------------------- Component Functions ------------------------ */
|
|
13566
|
+
/*------------------------------------------------------------------------*/
|
|
13567
|
+
/**
|
|
13568
|
+
* Handle clicking outside of the dropdown menu to close it
|
|
13569
|
+
* @author Yuen Ler Chow
|
|
13570
|
+
* @param event the mouse event
|
|
13571
|
+
*/
|
|
13572
|
+
const handleClickOutside = (event) => {
|
|
13573
|
+
if (
|
|
13574
|
+
// Dropdown has been rendered
|
|
13575
|
+
dropdownRef.current
|
|
13576
|
+
// Click occurred outside the dropdown
|
|
13577
|
+
&& !dropdownRef.current.contains(event.target)) {
|
|
13578
|
+
dispatch({ type: ActionType.CloseDropdown });
|
|
13579
|
+
}
|
|
13580
|
+
};
|
|
13581
|
+
/*------------------------------------------------------------------------*/
|
|
13582
|
+
/* ------------------------- Lifecycle Functions ------------------------ */
|
|
13583
|
+
/*------------------------------------------------------------------------*/
|
|
13584
|
+
/**
|
|
13585
|
+
* Mount
|
|
13586
|
+
* @author Yuen Ler Chow
|
|
13587
|
+
*/
|
|
13588
|
+
useEffect(() => {
|
|
13589
|
+
// Add event listener to close dropdown when clicking outside
|
|
13590
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
13591
|
+
// Cleanup
|
|
13592
|
+
return () => {
|
|
13593
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
13594
|
+
};
|
|
13595
|
+
}, []);
|
|
13596
|
+
/*----------------------------------------*/
|
|
13597
|
+
/* --------------- Main UI -------------- */
|
|
13598
|
+
/*----------------------------------------*/
|
|
13599
|
+
return (React__default.createElement("div", { className: "dropdown", ref: dropdownRef, "data-bs-theme": isDarkModeOn() ? 'dark' : undefined },
|
|
13600
|
+
React__default.createElement("button", { className: combineClassNames([
|
|
13601
|
+
'btn dropdown-toggle border',
|
|
13602
|
+
isDropdownOpen && 'show',
|
|
13603
|
+
`btn-${dropdownButton.variant}`,
|
|
13604
|
+
dropdownButton.variant === Variant$1.Light && 'text-dark',
|
|
13605
|
+
]), type: "button", id: dropdownButton.id, "aria-expanded": isDropdownOpen, "aria-label": dropdownButton.ariaLabel, onClick: () => {
|
|
13606
|
+
dispatch({
|
|
13607
|
+
type: ActionType.ToggleDropdown,
|
|
13608
|
+
});
|
|
13609
|
+
} }, dropdownButton.content),
|
|
13610
|
+
React__default.createElement("ul", { className: combineClassNames([
|
|
13611
|
+
'dropdown-menu',
|
|
13612
|
+
isDarkModeOn() && 'dropdown-menu-dark',
|
|
13613
|
+
isDropdownOpen && 'show',
|
|
13614
|
+
]) }, Object.values(items).map((item) => {
|
|
13615
|
+
if (item.type === DropdownItemType$1.Header) {
|
|
13616
|
+
return (
|
|
13617
|
+
// TODO: Implement header
|
|
13618
|
+
React__default.createElement("span", null));
|
|
13619
|
+
}
|
|
13620
|
+
if (item.type === DropdownItemType$1.Divider) {
|
|
13621
|
+
return (
|
|
13622
|
+
// TODO: Implement divider
|
|
13623
|
+
React__default.createElement("span", null));
|
|
13624
|
+
}
|
|
13625
|
+
return (React__default.createElement("li", { key: item.id },
|
|
13626
|
+
React__default.createElement("button", { type: "button", "aria-label": item.ariaLabel, className: "dropdown-item", onClick: (e) => {
|
|
13627
|
+
e.preventDefault();
|
|
13628
|
+
dispatch({
|
|
13629
|
+
type: ActionType.CloseDropdown,
|
|
13630
|
+
});
|
|
13631
|
+
item.onClick();
|
|
13632
|
+
} }, item.content)));
|
|
13633
|
+
}))));
|
|
13634
|
+
};
|
|
13635
|
+
|
|
13491
13636
|
/**
|
|
13492
13637
|
* One minute in ms
|
|
13493
13638
|
* @author Gabe Abrams
|
|
@@ -15813,5 +15958,5 @@ var DayOfWeek;
|
|
|
15813
15958
|
})(DayOfWeek || (DayOfWeek = {}));
|
|
15814
15959
|
var DayOfWeek$1 = DayOfWeek;
|
|
15815
15960
|
|
|
15816
|
-
export { AppWrapper, AutoscrollToBottomContainer, ButtonInputGroup, CSVDownloadButton, CheckboxButton, CopiableBox, DAY_IN_MS, DBEntryFieldType$1 as DBEntryFieldType, DBEntryManagerPanel, DayOfWeek$1 as DayOfWeek, Drawer, DynamicWord, ErrorBox, ErrorWithCode, HOUR_IN_MS, IntelliTable, ItemPicker, LoadingSpinner, LogAction$1 as LogAction, LogBuiltInMetadata, LogReviewer, LogSource$1 as LogSource, LogType$1 as LogType, MINUTE_IN_MS, Modal, ModalButtonType$1 as ModalButtonType, ModalSize$1 as ModalSize, ModalType$1 as ModalType, MultiSwitch, ParamType$1 as ParamType, PopFailureMark, PopPendingMark, PopSuccessMark, RadioButton, ReactKitErrorCode$1 as ReactKitErrorCode, SimpleDateChooser, TabBox, ToggleSwitch, Tooltip, Variant$1 as Variant, abbreviate, addDBEditorEndpoints, addFatalErrorHandler, alert, avg, canReviewLogs, capitalize, ceilToNumDecimals, combineClassNames, compareArraysByProp, confirm, everyAsync, extractProp, filterAsync, floorToNumDecimals, forEachAsync, forceNumIntoBounds, genCSV, genCommaList, genRouteHandler, getHumanReadableDate, getLocalTimeInfo, getMonthName, getOrdinal, getPartOfDay, getTimeInfoInET, handleError, handleSuccess, idify, initClient, initLogCollection, initServer, isMobileOrTablet, leaveToURL, logClientEvent, makeLinksClickable, mapAsync, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, prefixWithAOrAn, roundToNumDecimals, setClientEventMetadataPopulator, showFatalError, shuffleArray, someAsync, startMinWait, stringsToHumanReadableList, stubServerEndpoint, sum, useForceRender, validateEmail, validatePhoneNumber, validateString, visitServerEndpoint, waitMs };
|
|
15961
|
+
export { AppWrapper, AutoscrollToBottomContainer, ButtonInputGroup, CSVDownloadButton, CheckboxButton, CopiableBox, DAY_IN_MS, DBEntryFieldType$1 as DBEntryFieldType, DBEntryManagerPanel, DayOfWeek$1 as DayOfWeek, Drawer, Dropdown, DropdownItemType$1 as DropdownItemType, DynamicWord, ErrorBox, ErrorWithCode, HOUR_IN_MS, IntelliTable, ItemPicker, LoadingSpinner, LogAction$1 as LogAction, LogBuiltInMetadata, LogReviewer, LogSource$1 as LogSource, LogType$1 as LogType, MINUTE_IN_MS, Modal, ModalButtonType$1 as ModalButtonType, ModalSize$1 as ModalSize, ModalType$1 as ModalType, MultiSwitch, ParamType$1 as ParamType, PopFailureMark, PopPendingMark, PopSuccessMark, RadioButton, ReactKitErrorCode$1 as ReactKitErrorCode, SimpleDateChooser, TabBox, ToggleSwitch, Tooltip, Variant$1 as Variant, abbreviate, addDBEditorEndpoints, addFatalErrorHandler, alert, avg, canReviewLogs, capitalize, ceilToNumDecimals, combineClassNames, compareArraysByProp, confirm, everyAsync, extractProp, filterAsync, floorToNumDecimals, forEachAsync, forceNumIntoBounds, genCSV, genCommaList, genRouteHandler, getHumanReadableDate, getLocalTimeInfo, getMonthName, getOrdinal, getPartOfDay, getTimeInfoInET, handleError, handleSuccess, idify, initClient, initLogCollection, initServer, isMobileOrTablet, leaveToURL, logClientEvent, makeLinksClickable, mapAsync, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, prefixWithAOrAn, roundToNumDecimals, setClientEventMetadataPopulator, showFatalError, shuffleArray, someAsync, startMinWait, stringsToHumanReadableList, stubServerEndpoint, sum, useForceRender, validateEmail, validatePhoneNumber, validateString, visitServerEndpoint, waitMs };
|
|
15817
15962
|
//# sourceMappingURL=index.js.map
|