dce-reactkit 3.6.7 → 3.6.9
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 +348 -142
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/MultiSwitch.d.ts +24 -0
- package/dist/cjs/types/components/Tooltip.d.ts +1 -0
- package/dist/cjs/types/index.d.ts +2 -1
- package/dist/esm/index.js +348 -143
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/MultiSwitch.d.ts +24 -0
- package/dist/esm/types/components/Tooltip.d.ts +1 -0
- package/dist/esm/types/index.d.ts +2 -1
- package/dist/index.d.ts +67 -43
- package/package.json +1 -1
- package/src/components/MultiSwitch.tsx +347 -0
- package/src/components/Tooltip.tsx +4 -2
- package/src/index.ts +2 -0
package/dist/cjs/index.js
CHANGED
|
@@ -2064,27 +2064,27 @@ const PopPendingMark = (props) => {
|
|
|
2064
2064
|
*/
|
|
2065
2065
|
/* ------------- Actions ------------ */
|
|
2066
2066
|
// Types of actions
|
|
2067
|
-
var ActionType$
|
|
2067
|
+
var ActionType$9;
|
|
2068
2068
|
(function (ActionType) {
|
|
2069
2069
|
// Indicate that the text was recently copied
|
|
2070
2070
|
ActionType["IndicateRecentlyCopied"] = "indicate-recently-copied";
|
|
2071
2071
|
// Clear the status
|
|
2072
2072
|
ActionType["ClearRecentlyCopiedStatus"] = "clear-recently-copied-status";
|
|
2073
|
-
})(ActionType$
|
|
2073
|
+
})(ActionType$9 || (ActionType$9 = {}));
|
|
2074
2074
|
/**
|
|
2075
2075
|
* Reducer that executes actions
|
|
2076
2076
|
* @author Gabe Abrams
|
|
2077
2077
|
* @param state current state
|
|
2078
2078
|
* @param action action to execute
|
|
2079
2079
|
*/
|
|
2080
|
-
const reducer$
|
|
2080
|
+
const reducer$9 = (state, action) => {
|
|
2081
2081
|
switch (action.type) {
|
|
2082
|
-
case ActionType$
|
|
2082
|
+
case ActionType$9.IndicateRecentlyCopied: {
|
|
2083
2083
|
return {
|
|
2084
2084
|
recentlyCopied: true,
|
|
2085
2085
|
};
|
|
2086
2086
|
}
|
|
2087
|
-
case ActionType$
|
|
2087
|
+
case ActionType$9.ClearRecentlyCopiedStatus: {
|
|
2088
2088
|
return {
|
|
2089
2089
|
recentlyCopied: false,
|
|
2090
2090
|
};
|
|
@@ -2110,7 +2110,7 @@ const CopiableBox = (props) => {
|
|
|
2110
2110
|
recentlyCopied: false,
|
|
2111
2111
|
};
|
|
2112
2112
|
// Initialize state
|
|
2113
|
-
const [state, dispatch] = React.useReducer(reducer$
|
|
2113
|
+
const [state, dispatch] = React.useReducer(reducer$9, initialState);
|
|
2114
2114
|
// Destructure common state
|
|
2115
2115
|
const { recentlyCopied, } = state;
|
|
2116
2116
|
/*------------------------------------------------------------------------*/
|
|
@@ -2130,13 +2130,13 @@ const CopiableBox = (props) => {
|
|
|
2130
2130
|
}
|
|
2131
2131
|
// Show copied notice
|
|
2132
2132
|
dispatch({
|
|
2133
|
-
type: ActionType$
|
|
2133
|
+
type: ActionType$9.IndicateRecentlyCopied,
|
|
2134
2134
|
});
|
|
2135
2135
|
// Wait a moment
|
|
2136
2136
|
yield waitMs(4000);
|
|
2137
2137
|
// Hide copied notice
|
|
2138
2138
|
dispatch({
|
|
2139
|
-
type: ActionType$
|
|
2139
|
+
type: ActionType$9.ClearRecentlyCopiedStatus,
|
|
2140
2140
|
});
|
|
2141
2141
|
});
|
|
2142
2142
|
/*------------------------------------------------------------------------*/
|
|
@@ -2192,20 +2192,20 @@ const CopiableBox = (props) => {
|
|
|
2192
2192
|
*/
|
|
2193
2193
|
/* ------------- Actions ------------ */
|
|
2194
2194
|
// Types of actions
|
|
2195
|
-
var ActionType$
|
|
2195
|
+
var ActionType$8;
|
|
2196
2196
|
(function (ActionType) {
|
|
2197
2197
|
// Toggle whether a child are being shown
|
|
2198
2198
|
ActionType["ToggleChild"] = "toggle-child";
|
|
2199
|
-
})(ActionType$
|
|
2199
|
+
})(ActionType$8 || (ActionType$8 = {}));
|
|
2200
2200
|
/**
|
|
2201
2201
|
* Reducer that executes actions
|
|
2202
2202
|
* @author Gabe Abrams
|
|
2203
2203
|
* @param state current state
|
|
2204
2204
|
* @param action action to execute
|
|
2205
2205
|
*/
|
|
2206
|
-
const reducer$
|
|
2206
|
+
const reducer$8 = (state, action) => {
|
|
2207
2207
|
switch (action.type) {
|
|
2208
|
-
case ActionType$
|
|
2208
|
+
case ActionType$8.ToggleChild: {
|
|
2209
2209
|
return Object.assign(Object.assign({}, state), { childExpanded: Object.assign(Object.assign({}, state.childExpanded), { [String(action.id)]: !state.childExpanded[String(action.id)] }) });
|
|
2210
2210
|
}
|
|
2211
2211
|
default: {
|
|
@@ -2234,7 +2234,7 @@ const NestableItemList = (props) => {
|
|
|
2234
2234
|
childExpanded: initChildExpanded,
|
|
2235
2235
|
};
|
|
2236
2236
|
// Initialize state
|
|
2237
|
-
const [state, dispatch] = React.useReducer(reducer$
|
|
2237
|
+
const [state, dispatch] = React.useReducer(reducer$8, initialState);
|
|
2238
2238
|
// Destructure common state
|
|
2239
2239
|
const { childExpanded, } = state;
|
|
2240
2240
|
/*------------------------------------------------------------------------*/
|
|
@@ -2324,7 +2324,7 @@ const NestableItemList = (props) => {
|
|
|
2324
2324
|
backgroundColor: 'transparent',
|
|
2325
2325
|
}, type: "button", onClick: () => {
|
|
2326
2326
|
dispatch({
|
|
2327
|
-
type: ActionType$
|
|
2327
|
+
type: ActionType$8.ToggleChild,
|
|
2328
2328
|
id: item.id,
|
|
2329
2329
|
});
|
|
2330
2330
|
}, "aria-label": `${childExpanded[item.id] ? 'Hide' : 'Show'} items in ${item.name}` },
|
|
@@ -2600,7 +2600,7 @@ var SortType;
|
|
|
2600
2600
|
})(SortType || (SortType = {}));
|
|
2601
2601
|
/* ------------- Actions ------------ */
|
|
2602
2602
|
// Types of actions
|
|
2603
|
-
var ActionType$
|
|
2603
|
+
var ActionType$7;
|
|
2604
2604
|
(function (ActionType) {
|
|
2605
2605
|
// Toggle sort column param
|
|
2606
2606
|
ActionType["ToggleSortColumn"] = "toggle-sort-column";
|
|
@@ -2612,16 +2612,16 @@ var ActionType$6;
|
|
|
2612
2612
|
ActionType["ShowAllColumns"] = "show-all-columns";
|
|
2613
2613
|
// Hide all columns
|
|
2614
2614
|
ActionType["HideAllColumns"] = "hide-all-columns";
|
|
2615
|
-
})(ActionType$
|
|
2615
|
+
})(ActionType$7 || (ActionType$7 = {}));
|
|
2616
2616
|
/**
|
|
2617
2617
|
* Reducer that executes actions
|
|
2618
2618
|
* @author Gabe Abrams
|
|
2619
2619
|
* @param state current state
|
|
2620
2620
|
* @param action action to execute
|
|
2621
2621
|
*/
|
|
2622
|
-
const reducer$
|
|
2622
|
+
const reducer$7 = (state, action) => {
|
|
2623
2623
|
switch (action.type) {
|
|
2624
|
-
case ActionType$
|
|
2624
|
+
case ActionType$7.ToggleSortColumn: {
|
|
2625
2625
|
if (action.param !== state.sortColumnParam) {
|
|
2626
2626
|
// Different column param
|
|
2627
2627
|
return Object.assign(Object.assign({}, state), { sortColumnParam: action.param, sortType: SortType.Ascending });
|
|
@@ -2633,22 +2633,22 @@ const reducer$6 = (state, action) => {
|
|
|
2633
2633
|
// Stop sorting by column
|
|
2634
2634
|
return Object.assign(Object.assign({}, state), { sortColumnParam: undefined, sortType: SortType.Ascending });
|
|
2635
2635
|
}
|
|
2636
|
-
case ActionType$
|
|
2636
|
+
case ActionType$7.UpdateColumnVisibility: {
|
|
2637
2637
|
const { columnVisibilityMap } = state;
|
|
2638
2638
|
columnVisibilityMap[action.param] = action.visible;
|
|
2639
2639
|
return Object.assign(Object.assign({}, state), { columnVisibilityMap });
|
|
2640
2640
|
}
|
|
2641
|
-
case ActionType$
|
|
2641
|
+
case ActionType$7.ToggleColVisCusModalVisibility: {
|
|
2642
2642
|
return Object.assign(Object.assign({}, state), { columnVisibilityCustomizationModalVisible: !state.columnVisibilityCustomizationModalVisible });
|
|
2643
2643
|
}
|
|
2644
|
-
case ActionType$
|
|
2644
|
+
case ActionType$7.ShowAllColumns: {
|
|
2645
2645
|
const { columnVisibilityMap } = state;
|
|
2646
2646
|
Object.keys(columnVisibilityMap).forEach((param) => {
|
|
2647
2647
|
columnVisibilityMap[param] = true;
|
|
2648
2648
|
});
|
|
2649
2649
|
return Object.assign(Object.assign({}, state), { columnVisibilityMap });
|
|
2650
2650
|
}
|
|
2651
|
-
case ActionType$
|
|
2651
|
+
case ActionType$7.HideAllColumns: {
|
|
2652
2652
|
const { columnVisibilityMap } = state;
|
|
2653
2653
|
Object.keys(columnVisibilityMap).forEach((param) => {
|
|
2654
2654
|
columnVisibilityMap[param] = false;
|
|
@@ -2695,7 +2695,7 @@ const IntelliTable = (props) => {
|
|
|
2695
2695
|
columnVisibilityCustomizationModalVisible: false,
|
|
2696
2696
|
};
|
|
2697
2697
|
// Initialize state
|
|
2698
|
-
const [state, dispatch] = React.useReducer(reducer$
|
|
2698
|
+
const [state, dispatch] = React.useReducer(reducer$7, initialState);
|
|
2699
2699
|
// Destructure common state
|
|
2700
2700
|
const { sortColumnParam, sortType, columnVisibilityMap, columnVisibilityCustomizationModalVisible, } = state;
|
|
2701
2701
|
/*------------------------------------------------------------------------*/
|
|
@@ -2718,13 +2718,13 @@ const IntelliTable = (props) => {
|
|
|
2718
2718
|
return alert('Choose at least one column', 'To continue, you have to choose at least one column to show');
|
|
2719
2719
|
}
|
|
2720
2720
|
dispatch({
|
|
2721
|
-
type: ActionType$
|
|
2721
|
+
type: ActionType$7.ToggleColVisCusModalVisibility,
|
|
2722
2722
|
});
|
|
2723
2723
|
}, okayVariant: Variant$1.Light },
|
|
2724
2724
|
columns.map((column) => {
|
|
2725
2725
|
return (React__default["default"].createElement(CheckboxButton, { key: column.param, id: `IntelliTable-${id}-toggle-visibility-${column.param}`, className: "mb-2", text: column.title, onChanged: (checked) => {
|
|
2726
2726
|
dispatch({
|
|
2727
|
-
type: ActionType$
|
|
2727
|
+
type: ActionType$7.UpdateColumnVisibility,
|
|
2728
2728
|
param: column.param,
|
|
2729
2729
|
visible: checked,
|
|
2730
2730
|
});
|
|
@@ -2733,12 +2733,12 @@ const IntelliTable = (props) => {
|
|
|
2733
2733
|
React__default["default"].createElement("div", { className: "mt-3" }, "Or you can:"),
|
|
2734
2734
|
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: () => {
|
|
2735
2735
|
dispatch({
|
|
2736
|
-
type: ActionType$
|
|
2736
|
+
type: ActionType$7.ShowAllColumns,
|
|
2737
2737
|
});
|
|
2738
2738
|
} }, "Select All"),
|
|
2739
2739
|
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: () => {
|
|
2740
2740
|
dispatch({
|
|
2741
|
-
type: ActionType$
|
|
2741
|
+
type: ActionType$7.HideAllColumns,
|
|
2742
2742
|
});
|
|
2743
2743
|
} }, "Deselect All")));
|
|
2744
2744
|
}
|
|
@@ -2789,7 +2789,7 @@ const IntelliTable = (props) => {
|
|
|
2789
2789
|
React__default["default"].createElement("div", null,
|
|
2790
2790
|
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: () => {
|
|
2791
2791
|
dispatch({
|
|
2792
|
-
type: ActionType$
|
|
2792
|
+
type: ActionType$7.ToggleSortColumn,
|
|
2793
2793
|
param: column.param,
|
|
2794
2794
|
});
|
|
2795
2795
|
} },
|
|
@@ -2978,7 +2978,7 @@ const IntelliTable = (props) => {
|
|
|
2978
2978
|
React__default["default"].createElement(CSVDownloadButton, { "aria-label": `download data as csv for ${title}`, id: `IntelliTable-${id}-download-as-csv`, filename: filename, csv: csv }),
|
|
2979
2979
|
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: () => {
|
|
2980
2980
|
dispatch({
|
|
2981
|
-
type: ActionType$
|
|
2981
|
+
type: ActionType$7.ToggleColVisCusModalVisibility,
|
|
2982
2982
|
});
|
|
2983
2983
|
} },
|
|
2984
2984
|
"Show/Hide Cols",
|
|
@@ -3344,7 +3344,7 @@ const genHumanReadableName = (machineReadableName) => {
|
|
|
3344
3344
|
};
|
|
3345
3345
|
/* ------------- Actions ------------ */
|
|
3346
3346
|
// Types of actions
|
|
3347
|
-
var ActionType$
|
|
3347
|
+
var ActionType$6;
|
|
3348
3348
|
(function (ActionType) {
|
|
3349
3349
|
// Show the loading bar
|
|
3350
3350
|
ActionType["StartLoading"] = "start-loading";
|
|
@@ -3366,45 +3366,45 @@ var ActionType$5;
|
|
|
3366
3366
|
ActionType["UpdateActionErrorFilterState"] = "update-action-error-filter-state";
|
|
3367
3367
|
// Update the advanced filter state
|
|
3368
3368
|
ActionType["UpdateAdvancedFilterState"] = "update-advanced-filter-state";
|
|
3369
|
-
})(ActionType$
|
|
3369
|
+
})(ActionType$6 || (ActionType$6 = {}));
|
|
3370
3370
|
/**
|
|
3371
3371
|
* Reducer that executes actions
|
|
3372
3372
|
* @author Gabe Abrams
|
|
3373
3373
|
* @param state current state
|
|
3374
3374
|
* @param action action to execute
|
|
3375
3375
|
*/
|
|
3376
|
-
const reducer$
|
|
3376
|
+
const reducer$6 = (state, action) => {
|
|
3377
3377
|
switch (action.type) {
|
|
3378
|
-
case ActionType$
|
|
3378
|
+
case ActionType$6.StartLoading: {
|
|
3379
3379
|
return Object.assign(Object.assign({}, state), { loading: true });
|
|
3380
3380
|
}
|
|
3381
|
-
case ActionType$
|
|
3381
|
+
case ActionType$6.FinishLoading: {
|
|
3382
3382
|
return Object.assign(Object.assign({}, state), { loading: false, logMap: action.logMap });
|
|
3383
3383
|
}
|
|
3384
|
-
case ActionType$
|
|
3384
|
+
case ActionType$6.ToggleFilterDrawer: {
|
|
3385
3385
|
return Object.assign(Object.assign({}, state), { expandedFilterDrawer: (state.expandedFilterDrawer === action.filterDrawer
|
|
3386
3386
|
? undefined // hide
|
|
3387
3387
|
: action.filterDrawer) });
|
|
3388
3388
|
}
|
|
3389
|
-
case ActionType$
|
|
3389
|
+
case ActionType$6.HideFilterDrawer: {
|
|
3390
3390
|
return Object.assign(Object.assign({}, state), { expandedFilterDrawer: undefined });
|
|
3391
3391
|
}
|
|
3392
|
-
case ActionType$
|
|
3392
|
+
case ActionType$6.ResetFilters: {
|
|
3393
3393
|
return Object.assign(Object.assign({}, state), { dateFilterState: action.initDateFilterState, contextFilterState: action.initContextFilterState, tagFilterState: action.initTagFilterState, actionErrorFilterState: action.initActionErrorFilterState, advancedFilterState: action.initAdvancedFilterState });
|
|
3394
3394
|
}
|
|
3395
|
-
case ActionType$
|
|
3395
|
+
case ActionType$6.UpdateDateFilterState: {
|
|
3396
3396
|
return Object.assign(Object.assign({}, state), { dateFilterState: action.dateFilterState });
|
|
3397
3397
|
}
|
|
3398
|
-
case ActionType$
|
|
3398
|
+
case ActionType$6.UpdateContextFilterState: {
|
|
3399
3399
|
return Object.assign(Object.assign({}, state), { contextFilterState: action.contextFilterState });
|
|
3400
3400
|
}
|
|
3401
|
-
case ActionType$
|
|
3401
|
+
case ActionType$6.UpdateTagFilterState: {
|
|
3402
3402
|
return Object.assign(Object.assign({}, state), { tagFilterState: action.tagFilterState });
|
|
3403
3403
|
}
|
|
3404
|
-
case ActionType$
|
|
3404
|
+
case ActionType$6.UpdateActionErrorFilterState: {
|
|
3405
3405
|
return Object.assign(Object.assign({}, state), { actionErrorFilterState: action.actionErrorFilterState });
|
|
3406
3406
|
}
|
|
3407
|
-
case ActionType$
|
|
3407
|
+
case ActionType$6.UpdateAdvancedFilterState: {
|
|
3408
3408
|
return Object.assign(Object.assign({}, state), { advancedFilterState: action.advancedFilterState });
|
|
3409
3409
|
}
|
|
3410
3410
|
default: {
|
|
@@ -3533,7 +3533,7 @@ const LogReviewer = (props) => {
|
|
|
3533
3533
|
advancedFilterState: initAdvancedFilterState,
|
|
3534
3534
|
};
|
|
3535
3535
|
// Initialize state
|
|
3536
|
-
const [state, dispatch] = React.useReducer(reducer$
|
|
3536
|
+
const [state, dispatch] = React.useReducer(reducer$6, initialState);
|
|
3537
3537
|
// Destructure common state
|
|
3538
3538
|
const { loading, logMap, expandedFilterDrawer, dateFilterState, contextFilterState, tagFilterState, actionErrorFilterState, advancedFilterState, } = state;
|
|
3539
3539
|
/*------------------------------------------------------------------------*/
|
|
@@ -3583,7 +3583,7 @@ const LogReviewer = (props) => {
|
|
|
3583
3583
|
const handleDateRangeUpdated = (newDateFilterState) => __awaiter(void 0, void 0, void 0, function* () {
|
|
3584
3584
|
// Update state
|
|
3585
3585
|
dispatch({
|
|
3586
|
-
type: ActionType$
|
|
3586
|
+
type: ActionType$6.UpdateDateFilterState,
|
|
3587
3587
|
dateFilterState: newDateFilterState,
|
|
3588
3588
|
});
|
|
3589
3589
|
// Check which year/month combos we need to load
|
|
@@ -3594,7 +3594,7 @@ const LogReviewer = (props) => {
|
|
|
3594
3594
|
}
|
|
3595
3595
|
// Start loading
|
|
3596
3596
|
dispatch({
|
|
3597
|
-
type: ActionType$
|
|
3597
|
+
type: ActionType$6.StartLoading,
|
|
3598
3598
|
});
|
|
3599
3599
|
// Load required months
|
|
3600
3600
|
try {
|
|
@@ -3618,7 +3618,7 @@ const LogReviewer = (props) => {
|
|
|
3618
3618
|
}
|
|
3619
3619
|
// Finish loading
|
|
3620
3620
|
dispatch({
|
|
3621
|
-
type: ActionType$
|
|
3621
|
+
type: ActionType$6.FinishLoading,
|
|
3622
3622
|
logMap,
|
|
3623
3623
|
});
|
|
3624
3624
|
});
|
|
@@ -3657,7 +3657,7 @@ const LogReviewer = (props) => {
|
|
|
3657
3657
|
React__default["default"].createElement("div", { className: "LogReviewer-filter-toggle-buttons alert alert-secondary p-2 m-0" },
|
|
3658
3658
|
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: () => {
|
|
3659
3659
|
dispatch({
|
|
3660
|
-
type: ActionType$
|
|
3660
|
+
type: ActionType$6.ToggleFilterDrawer,
|
|
3661
3661
|
filterDrawer: FilterDrawer.Date,
|
|
3662
3662
|
});
|
|
3663
3663
|
} },
|
|
@@ -3665,7 +3665,7 @@ const LogReviewer = (props) => {
|
|
|
3665
3665
|
"Date"),
|
|
3666
3666
|
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: () => {
|
|
3667
3667
|
dispatch({
|
|
3668
|
-
type: ActionType$
|
|
3668
|
+
type: ActionType$6.ToggleFilterDrawer,
|
|
3669
3669
|
filterDrawer: FilterDrawer.Context,
|
|
3670
3670
|
});
|
|
3671
3671
|
} },
|
|
@@ -3673,7 +3673,7 @@ const LogReviewer = (props) => {
|
|
|
3673
3673
|
"Context"),
|
|
3674
3674
|
(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: () => {
|
|
3675
3675
|
dispatch({
|
|
3676
|
-
type: ActionType$
|
|
3676
|
+
type: ActionType$6.ToggleFilterDrawer,
|
|
3677
3677
|
filterDrawer: FilterDrawer.Tag,
|
|
3678
3678
|
});
|
|
3679
3679
|
} },
|
|
@@ -3681,7 +3681,7 @@ const LogReviewer = (props) => {
|
|
|
3681
3681
|
"Tag")),
|
|
3682
3682
|
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: () => {
|
|
3683
3683
|
dispatch({
|
|
3684
|
-
type: ActionType$
|
|
3684
|
+
type: ActionType$6.ToggleFilterDrawer,
|
|
3685
3685
|
filterDrawer: FilterDrawer.Action,
|
|
3686
3686
|
});
|
|
3687
3687
|
} },
|
|
@@ -3689,7 +3689,7 @@ const LogReviewer = (props) => {
|
|
|
3689
3689
|
"Action"),
|
|
3690
3690
|
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: () => {
|
|
3691
3691
|
dispatch({
|
|
3692
|
-
type: ActionType$
|
|
3692
|
+
type: ActionType$6.ToggleFilterDrawer,
|
|
3693
3693
|
filterDrawer: FilterDrawer.Advanced,
|
|
3694
3694
|
});
|
|
3695
3695
|
} },
|
|
@@ -3697,7 +3697,7 @@ const LogReviewer = (props) => {
|
|
|
3697
3697
|
"Advanced"),
|
|
3698
3698
|
React__default["default"].createElement("button", { type: "button", id: "LogReviewer-reset-filters-button", className: "btn btn-light", "aria-label": "reset filters", onClick: () => {
|
|
3699
3699
|
dispatch({
|
|
3700
|
-
type: ActionType$
|
|
3700
|
+
type: ActionType$6.ResetFilters,
|
|
3701
3701
|
initActionErrorFilterState,
|
|
3702
3702
|
initAdvancedFilterState,
|
|
3703
3703
|
initContextFilterState,
|
|
@@ -3819,7 +3819,7 @@ const LogReviewer = (props) => {
|
|
|
3819
3819
|
}
|
|
3820
3820
|
});
|
|
3821
3821
|
dispatch({
|
|
3822
|
-
type: ActionType$
|
|
3822
|
+
type: ActionType$6.UpdateContextFilterState,
|
|
3823
3823
|
contextFilterState,
|
|
3824
3824
|
});
|
|
3825
3825
|
} }));
|
|
@@ -3834,7 +3834,7 @@ const LogReviewer = (props) => {
|
|
|
3834
3834
|
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) => {
|
|
3835
3835
|
tagFilterState[tag] = checked;
|
|
3836
3836
|
dispatch({
|
|
3837
|
-
type: ActionType$
|
|
3837
|
+
type: ActionType$6.UpdateTagFilterState,
|
|
3838
3838
|
tagFilterState,
|
|
3839
3839
|
});
|
|
3840
3840
|
} }));
|
|
@@ -3847,21 +3847,21 @@ const LogReviewer = (props) => {
|
|
|
3847
3847
|
React__default["default"].createElement(RadioButton, { id: "LogReviewer-type-all", text: "All Logs", onSelected: () => {
|
|
3848
3848
|
actionErrorFilterState.type = undefined;
|
|
3849
3849
|
dispatch({
|
|
3850
|
-
type: ActionType$
|
|
3850
|
+
type: ActionType$6.UpdateActionErrorFilterState,
|
|
3851
3851
|
actionErrorFilterState,
|
|
3852
3852
|
});
|
|
3853
3853
|
}, ariaLabel: "show logs of all types", selected: actionErrorFilterState.type === undefined }),
|
|
3854
3854
|
React__default["default"].createElement(RadioButton, { id: "LogReviewer-type-action-only", text: "Action Logs Only", onSelected: () => {
|
|
3855
3855
|
actionErrorFilterState.type = LogType$1.Action;
|
|
3856
3856
|
dispatch({
|
|
3857
|
-
type: ActionType$
|
|
3857
|
+
type: ActionType$6.UpdateActionErrorFilterState,
|
|
3858
3858
|
actionErrorFilterState,
|
|
3859
3859
|
});
|
|
3860
3860
|
}, ariaLabel: "only show action logs", selected: actionErrorFilterState.type === LogType$1.Action }),
|
|
3861
3861
|
React__default["default"].createElement(RadioButton, { id: "LogReviewer-type-error-only", text: "Action Error Only", onSelected: () => {
|
|
3862
3862
|
actionErrorFilterState.type = LogType$1.Error;
|
|
3863
3863
|
dispatch({
|
|
3864
|
-
type: ActionType$
|
|
3864
|
+
type: ActionType$6.UpdateActionErrorFilterState,
|
|
3865
3865
|
actionErrorFilterState,
|
|
3866
3866
|
});
|
|
3867
3867
|
}, ariaLabel: "only show error logs", selected: actionErrorFilterState.type === LogType$1.Error, noMarginOnRight: true })),
|
|
@@ -3873,7 +3873,7 @@ const LogReviewer = (props) => {
|
|
|
3873
3873
|
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) => {
|
|
3874
3874
|
actionErrorFilterState.action[action] = checked;
|
|
3875
3875
|
dispatch({
|
|
3876
|
-
type: ActionType$
|
|
3876
|
+
type: ActionType$6.UpdateActionErrorFilterState,
|
|
3877
3877
|
actionErrorFilterState,
|
|
3878
3878
|
});
|
|
3879
3879
|
} }));
|
|
@@ -3884,7 +3884,7 @@ const LogReviewer = (props) => {
|
|
|
3884
3884
|
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) => {
|
|
3885
3885
|
actionErrorFilterState.target[target] = checked;
|
|
3886
3886
|
dispatch({
|
|
3887
|
-
type: ActionType$
|
|
3887
|
+
type: ActionType$6.UpdateActionErrorFilterState,
|
|
3888
3888
|
actionErrorFilterState,
|
|
3889
3889
|
});
|
|
3890
3890
|
} }));
|
|
@@ -3896,7 +3896,7 @@ const LogReviewer = (props) => {
|
|
|
3896
3896
|
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) => {
|
|
3897
3897
|
actionErrorFilterState.errorMessage = e.target.value;
|
|
3898
3898
|
dispatch({
|
|
3899
|
-
type: ActionType$
|
|
3899
|
+
type: ActionType$6.UpdateActionErrorFilterState,
|
|
3900
3900
|
actionErrorFilterState,
|
|
3901
3901
|
});
|
|
3902
3902
|
} })),
|
|
@@ -3907,7 +3907,7 @@ const LogReviewer = (props) => {
|
|
|
3907
3907
|
.trim()
|
|
3908
3908
|
.toUpperCase());
|
|
3909
3909
|
dispatch({
|
|
3910
|
-
type: ActionType$
|
|
3910
|
+
type: ActionType$6.UpdateActionErrorFilterState,
|
|
3911
3911
|
actionErrorFilterState,
|
|
3912
3912
|
});
|
|
3913
3913
|
} }))))));
|
|
@@ -3921,7 +3921,7 @@ const LogReviewer = (props) => {
|
|
|
3921
3921
|
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) => {
|
|
3922
3922
|
advancedFilterState.userFirstName = e.target.value;
|
|
3923
3923
|
dispatch({
|
|
3924
|
-
type: ActionType$
|
|
3924
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
3925
3925
|
advancedFilterState,
|
|
3926
3926
|
});
|
|
3927
3927
|
} })),
|
|
@@ -3930,7 +3930,7 @@ const LogReviewer = (props) => {
|
|
|
3930
3930
|
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) => {
|
|
3931
3931
|
advancedFilterState.userLastName = e.target.value;
|
|
3932
3932
|
dispatch({
|
|
3933
|
-
type: ActionType$
|
|
3933
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
3934
3934
|
advancedFilterState,
|
|
3935
3935
|
});
|
|
3936
3936
|
} })),
|
|
@@ -3940,7 +3940,7 @@ const LogReviewer = (props) => {
|
|
|
3940
3940
|
advancedFilterState.userEmail = ((e.target.value)
|
|
3941
3941
|
.trim());
|
|
3942
3942
|
dispatch({
|
|
3943
|
-
type: ActionType$
|
|
3943
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
3944
3944
|
advancedFilterState,
|
|
3945
3945
|
});
|
|
3946
3946
|
} })),
|
|
@@ -3954,7 +3954,7 @@ const LogReviewer = (props) => {
|
|
|
3954
3954
|
.trim());
|
|
3955
3955
|
}
|
|
3956
3956
|
dispatch({
|
|
3957
|
-
type: ActionType$
|
|
3957
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
3958
3958
|
advancedFilterState,
|
|
3959
3959
|
});
|
|
3960
3960
|
} })),
|
|
@@ -3962,21 +3962,21 @@ const LogReviewer = (props) => {
|
|
|
3962
3962
|
React__default["default"].createElement(CheckboxButton, { text: "Students", onChanged: (checked) => {
|
|
3963
3963
|
advancedFilterState.includeLearners = checked;
|
|
3964
3964
|
dispatch({
|
|
3965
|
-
type: ActionType$
|
|
3965
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
3966
3966
|
advancedFilterState,
|
|
3967
3967
|
});
|
|
3968
3968
|
}, checked: advancedFilterState.includeLearners, ariaLabel: "show logs from students" }),
|
|
3969
3969
|
React__default["default"].createElement(CheckboxButton, { text: "Teaching Team Members", onChanged: (checked) => {
|
|
3970
3970
|
advancedFilterState.includeTTMs = checked;
|
|
3971
3971
|
dispatch({
|
|
3972
|
-
type: ActionType$
|
|
3972
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
3973
3973
|
advancedFilterState,
|
|
3974
3974
|
});
|
|
3975
3975
|
}, checked: advancedFilterState.includeTTMs, ariaLabel: "show logs from teaching team members" }),
|
|
3976
3976
|
React__default["default"].createElement(CheckboxButton, { text: "Admins", onChanged: (checked) => {
|
|
3977
3977
|
advancedFilterState.includeAdmins = checked;
|
|
3978
3978
|
dispatch({
|
|
3979
|
-
type: ActionType$
|
|
3979
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
3980
3980
|
advancedFilterState,
|
|
3981
3981
|
});
|
|
3982
3982
|
}, checked: advancedFilterState.includeAdmins, ariaLabel: "show logs from admins" }))),
|
|
@@ -3986,7 +3986,7 @@ const LogReviewer = (props) => {
|
|
|
3986
3986
|
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) => {
|
|
3987
3987
|
advancedFilterState.courseName = e.target.value;
|
|
3988
3988
|
dispatch({
|
|
3989
|
-
type: ActionType$
|
|
3989
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
3990
3990
|
advancedFilterState,
|
|
3991
3991
|
});
|
|
3992
3992
|
} })),
|
|
@@ -4000,7 +4000,7 @@ const LogReviewer = (props) => {
|
|
|
4000
4000
|
.trim());
|
|
4001
4001
|
}
|
|
4002
4002
|
dispatch({
|
|
4003
|
-
type: ActionType$
|
|
4003
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4004
4004
|
advancedFilterState,
|
|
4005
4005
|
});
|
|
4006
4006
|
} }))),
|
|
@@ -4009,21 +4009,21 @@ const LogReviewer = (props) => {
|
|
|
4009
4009
|
React__default["default"].createElement(RadioButton, { text: "All Devices", ariaLabel: "show logs from all devices", selected: advancedFilterState.isMobile === undefined, onSelected: () => {
|
|
4010
4010
|
advancedFilterState.isMobile = undefined;
|
|
4011
4011
|
dispatch({
|
|
4012
|
-
type: ActionType$
|
|
4012
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4013
4013
|
advancedFilterState,
|
|
4014
4014
|
});
|
|
4015
4015
|
} }),
|
|
4016
4016
|
React__default["default"].createElement(RadioButton, { text: "Mobile Only", ariaLabel: "show logs from mobile devices", selected: advancedFilterState.isMobile === true, onSelected: () => {
|
|
4017
4017
|
advancedFilterState.isMobile = true;
|
|
4018
4018
|
dispatch({
|
|
4019
|
-
type: ActionType$
|
|
4019
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4020
4020
|
advancedFilterState,
|
|
4021
4021
|
});
|
|
4022
4022
|
} }),
|
|
4023
4023
|
React__default["default"].createElement(RadioButton, { text: "Desktop Only", ariaLabel: "show logs from desktop devices", selected: advancedFilterState.isMobile === false, onSelected: () => {
|
|
4024
4024
|
advancedFilterState.isMobile = false;
|
|
4025
4025
|
dispatch({
|
|
4026
|
-
type: ActionType$
|
|
4026
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4027
4027
|
advancedFilterState,
|
|
4028
4028
|
});
|
|
4029
4029
|
}, noMarginOnRight: true }))),
|
|
@@ -4032,21 +4032,21 @@ const LogReviewer = (props) => {
|
|
|
4032
4032
|
React__default["default"].createElement(RadioButton, { text: "Both", ariaLabel: "show logs from all sources", selected: advancedFilterState.source === undefined, onSelected: () => {
|
|
4033
4033
|
advancedFilterState.source = undefined;
|
|
4034
4034
|
dispatch({
|
|
4035
|
-
type: ActionType$
|
|
4035
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4036
4036
|
advancedFilterState,
|
|
4037
4037
|
});
|
|
4038
4038
|
} }),
|
|
4039
4039
|
React__default["default"].createElement(RadioButton, { text: "Client Only", ariaLabel: "show logs from client source", selected: advancedFilterState.source === LogSource$1.Client, onSelected: () => {
|
|
4040
4040
|
advancedFilterState.source = LogSource$1.Client;
|
|
4041
4041
|
dispatch({
|
|
4042
|
-
type: ActionType$
|
|
4042
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4043
4043
|
advancedFilterState,
|
|
4044
4044
|
});
|
|
4045
4045
|
} }),
|
|
4046
4046
|
React__default["default"].createElement(RadioButton, { text: "Server Only", ariaLabel: "show logs from server source", selected: advancedFilterState.source === LogSource$1.Server, onSelected: () => {
|
|
4047
4047
|
advancedFilterState.source = LogSource$1.Server;
|
|
4048
4048
|
dispatch({
|
|
4049
|
-
type: ActionType$
|
|
4049
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4050
4050
|
advancedFilterState,
|
|
4051
4051
|
});
|
|
4052
4052
|
}, noMarginOnRight: true })),
|
|
@@ -4057,7 +4057,7 @@ const LogReviewer = (props) => {
|
|
|
4057
4057
|
advancedFilterState.courseName = ((e.target.value)
|
|
4058
4058
|
.trim());
|
|
4059
4059
|
dispatch({
|
|
4060
|
-
type: ActionType$
|
|
4060
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4061
4061
|
advancedFilterState,
|
|
4062
4062
|
});
|
|
4063
4063
|
} })),
|
|
@@ -4067,7 +4067,7 @@ const LogReviewer = (props) => {
|
|
|
4067
4067
|
advancedFilterState.courseName = ((e.target.value)
|
|
4068
4068
|
.trim());
|
|
4069
4069
|
dispatch({
|
|
4070
|
-
type: ActionType$
|
|
4070
|
+
type: ActionType$6.UpdateAdvancedFilterState,
|
|
4071
4071
|
advancedFilterState,
|
|
4072
4072
|
});
|
|
4073
4073
|
} })))))));
|
|
@@ -39672,11 +39672,11 @@ var CreatableSelect$1 = CreatableSelect;
|
|
|
39672
39672
|
*/
|
|
39673
39673
|
/* ------------- Actions ------------ */
|
|
39674
39674
|
// Types of actions
|
|
39675
|
-
var ActionType$
|
|
39675
|
+
var ActionType$5;
|
|
39676
39676
|
(function (ActionType) {
|
|
39677
39677
|
// Update the input value
|
|
39678
39678
|
ActionType["SetInputValue"] = "SetInputValue";
|
|
39679
|
-
})(ActionType$
|
|
39679
|
+
})(ActionType$5 || (ActionType$5 = {}));
|
|
39680
39680
|
/**
|
|
39681
39681
|
* Reducer that executes actions
|
|
39682
39682
|
* @author Yuen Ler Chow
|
|
@@ -39684,9 +39684,9 @@ var ActionType$4;
|
|
|
39684
39684
|
* @param action action to execute
|
|
39685
39685
|
* @returns updated state
|
|
39686
39686
|
*/
|
|
39687
|
-
const reducer$
|
|
39687
|
+
const reducer$5 = (state, action) => {
|
|
39688
39688
|
switch (action.type) {
|
|
39689
|
-
case ActionType$
|
|
39689
|
+
case ActionType$5.SetInputValue: {
|
|
39690
39690
|
return Object.assign(Object.assign({}, state), { inputValue: action.value });
|
|
39691
39691
|
}
|
|
39692
39692
|
default: {
|
|
@@ -39706,7 +39706,7 @@ const CreatableMultiselect = (props) => {
|
|
|
39706
39706
|
inputValue: '',
|
|
39707
39707
|
};
|
|
39708
39708
|
// Initialize state
|
|
39709
|
-
const [state, dispatch] = React.useReducer(reducer$
|
|
39709
|
+
const [state, dispatch] = React.useReducer(reducer$5, initialState);
|
|
39710
39710
|
// Destructure common state
|
|
39711
39711
|
const { inputValue } = state;
|
|
39712
39712
|
/*------------------------------------------------------------------------*/
|
|
@@ -39783,7 +39783,7 @@ const CreatableMultiselect = (props) => {
|
|
|
39783
39783
|
}
|
|
39784
39784
|
// Reset text field to empty because the values have been added
|
|
39785
39785
|
dispatch({
|
|
39786
|
-
type: ActionType$
|
|
39786
|
+
type: ActionType$5.SetInputValue,
|
|
39787
39787
|
value: '',
|
|
39788
39788
|
});
|
|
39789
39789
|
};
|
|
@@ -39822,7 +39822,7 @@ const CreatableMultiselect = (props) => {
|
|
|
39822
39822
|
else {
|
|
39823
39823
|
// simply update the input value to the new input value
|
|
39824
39824
|
dispatch({
|
|
39825
|
-
type: ActionType$
|
|
39825
|
+
type: ActionType$5.SetInputValue,
|
|
39826
39826
|
value: newValue,
|
|
39827
39827
|
});
|
|
39828
39828
|
}
|
|
@@ -39874,13 +39874,13 @@ const style$2 = `
|
|
|
39874
39874
|
`;
|
|
39875
39875
|
/* ------------- Actions ------------ */
|
|
39876
39876
|
// Types of actions
|
|
39877
|
-
var ActionType$
|
|
39877
|
+
var ActionType$4;
|
|
39878
39878
|
(function (ActionType) {
|
|
39879
39879
|
// Update the DBEntry
|
|
39880
39880
|
ActionType["UpdateDBEntry"] = "UpdateDBEntry";
|
|
39881
39881
|
// Start the save spinner
|
|
39882
39882
|
ActionType["StartSave"] = "StartSave";
|
|
39883
|
-
})(ActionType$
|
|
39883
|
+
})(ActionType$4 || (ActionType$4 = {}));
|
|
39884
39884
|
/**
|
|
39885
39885
|
* Reducer that executes actions
|
|
39886
39886
|
* @author Yuen Ler Chow
|
|
@@ -39888,12 +39888,12 @@ var ActionType$3;
|
|
|
39888
39888
|
* @param action action to execute
|
|
39889
39889
|
* @returns updated state
|
|
39890
39890
|
*/
|
|
39891
|
-
const reducer$
|
|
39891
|
+
const reducer$4 = (state, action) => {
|
|
39892
39892
|
switch (action.type) {
|
|
39893
|
-
case ActionType$
|
|
39893
|
+
case ActionType$4.UpdateDBEntry: {
|
|
39894
39894
|
return Object.assign(Object.assign({}, state), { entry: action.dbEntry });
|
|
39895
39895
|
}
|
|
39896
|
-
case ActionType$
|
|
39896
|
+
case ActionType$4.StartSave: {
|
|
39897
39897
|
return Object.assign(Object.assign({}, state), { saving: true });
|
|
39898
39898
|
}
|
|
39899
39899
|
default: {
|
|
@@ -39918,7 +39918,7 @@ const AddOrEditDBEntry = (props) => {
|
|
|
39918
39918
|
saving: false,
|
|
39919
39919
|
};
|
|
39920
39920
|
// Initialize state
|
|
39921
|
-
const [state, dispatch] = React.useReducer(reducer$
|
|
39921
|
+
const [state, dispatch] = React.useReducer(reducer$4, initialState);
|
|
39922
39922
|
// Destructure common state
|
|
39923
39923
|
const { entry, saving, } = state;
|
|
39924
39924
|
/*------------------------------------------------------------------------*/
|
|
@@ -39930,7 +39930,7 @@ const AddOrEditDBEntry = (props) => {
|
|
|
39930
39930
|
*/
|
|
39931
39931
|
const save = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
39932
39932
|
// Start the save loading indicator
|
|
39933
|
-
dispatch({ type: ActionType$
|
|
39933
|
+
dispatch({ type: ActionType$4.StartSave });
|
|
39934
39934
|
// add all default values to the entry
|
|
39935
39935
|
entryFields.forEach((field) => {
|
|
39936
39936
|
if (field.defaultValue && !entry[field.objectKey]) {
|
|
@@ -40113,7 +40113,7 @@ const AddOrEditDBEntry = (props) => {
|
|
|
40113
40113
|
return (React__default["default"].createElement(RadioButton, { key: choice.value, text: choice.title, selected: entry[field.objectKey] === choice.value, onSelected: () => {
|
|
40114
40114
|
entry[field.objectKey] = choice.value;
|
|
40115
40115
|
dispatch({
|
|
40116
|
-
type: ActionType$
|
|
40116
|
+
type: ActionType$4.UpdateDBEntry,
|
|
40117
40117
|
dbEntry: entry,
|
|
40118
40118
|
});
|
|
40119
40119
|
}, ariaLabel: choice.title }));
|
|
@@ -40125,7 +40125,7 @@ const AddOrEditDBEntry = (props) => {
|
|
|
40125
40125
|
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) => {
|
|
40126
40126
|
entry[field.objectKey] = (e.target.value);
|
|
40127
40127
|
dispatch({
|
|
40128
|
-
type: ActionType$
|
|
40128
|
+
type: ActionType$4.UpdateDBEntry,
|
|
40129
40129
|
dbEntry: entry,
|
|
40130
40130
|
});
|
|
40131
40131
|
} }))));
|
|
@@ -40138,7 +40138,7 @@ const AddOrEditDBEntry = (props) => {
|
|
|
40138
40138
|
entry[field.objectKey] = (e.target.value
|
|
40139
40139
|
.replace(/[^0-9]/g, ''));
|
|
40140
40140
|
dispatch({
|
|
40141
|
-
type: ActionType$
|
|
40141
|
+
type: ActionType$4.UpdateDBEntry,
|
|
40142
40142
|
dbEntry: entry,
|
|
40143
40143
|
});
|
|
40144
40144
|
} }))));
|
|
@@ -40168,7 +40168,7 @@ const AddOrEditDBEntry = (props) => {
|
|
|
40168
40168
|
}
|
|
40169
40169
|
// Save
|
|
40170
40170
|
dispatch({
|
|
40171
|
-
type: ActionType$
|
|
40171
|
+
type: ActionType$4.UpdateDBEntry,
|
|
40172
40172
|
dbEntry: entry,
|
|
40173
40173
|
});
|
|
40174
40174
|
}, ariaLabel: choice.title }));
|
|
@@ -40183,7 +40183,7 @@ const AddOrEditDBEntry = (props) => {
|
|
|
40183
40183
|
// Update entry and save
|
|
40184
40184
|
entry[field.objectKey] = values;
|
|
40185
40185
|
dispatch({
|
|
40186
|
-
type: ActionType$
|
|
40186
|
+
type: ActionType$4.UpdateDBEntry,
|
|
40187
40187
|
dbEntry: entry,
|
|
40188
40188
|
});
|
|
40189
40189
|
} })))));
|
|
@@ -40196,7 +40196,7 @@ const AddOrEditDBEntry = (props) => {
|
|
|
40196
40196
|
React__default["default"].createElement(CreatableMultiselect, { disabled: disabled, type: DBEntryFieldType$1.NumberArray, values: entry[field.objectKey] || [], onChange: (values) => {
|
|
40197
40197
|
entry[field.objectKey] = values;
|
|
40198
40198
|
dispatch({
|
|
40199
|
-
type: ActionType$
|
|
40199
|
+
type: ActionType$4.UpdateDBEntry,
|
|
40200
40200
|
dbEntry: entry,
|
|
40201
40201
|
});
|
|
40202
40202
|
} })))));
|
|
@@ -40270,7 +40270,7 @@ const generateEndpointPath = (collectionName, adminsOnly) => {
|
|
|
40270
40270
|
*/
|
|
40271
40271
|
/* ------------- Actions ------------ */
|
|
40272
40272
|
// Types of actions
|
|
40273
|
-
var ActionType$
|
|
40273
|
+
var ActionType$3;
|
|
40274
40274
|
(function (ActionType) {
|
|
40275
40275
|
// Show adder
|
|
40276
40276
|
ActionType["ShowAdder"] = "ShowAdder";
|
|
@@ -40284,7 +40284,7 @@ var ActionType$2;
|
|
|
40284
40284
|
ActionType["StartDelete"] = "StartDelete";
|
|
40285
40285
|
// Finish deletion process
|
|
40286
40286
|
ActionType["FinishDelete"] = "FinishDelete";
|
|
40287
|
-
})(ActionType$
|
|
40287
|
+
})(ActionType$3 || (ActionType$3 = {}));
|
|
40288
40288
|
/**
|
|
40289
40289
|
* Reducer that executes actions
|
|
40290
40290
|
* @author Yuen Ler Chow
|
|
@@ -40292,18 +40292,18 @@ var ActionType$2;
|
|
|
40292
40292
|
* @param action action to execute
|
|
40293
40293
|
* @returns updated state
|
|
40294
40294
|
*/
|
|
40295
|
-
const reducer$
|
|
40295
|
+
const reducer$3 = (state, action) => {
|
|
40296
40296
|
switch (action.type) {
|
|
40297
|
-
case ActionType$
|
|
40297
|
+
case ActionType$3.FinishLoading: {
|
|
40298
40298
|
return Object.assign(Object.assign({}, state), { loading: false, dbEntries: action.dbEntries });
|
|
40299
40299
|
}
|
|
40300
|
-
case ActionType$
|
|
40300
|
+
case ActionType$3.ShowAdder: {
|
|
40301
40301
|
return Object.assign(Object.assign({}, state), { adding: true, dbEntryToEdit: undefined });
|
|
40302
40302
|
}
|
|
40303
|
-
case ActionType$
|
|
40303
|
+
case ActionType$3.ShowEditor: {
|
|
40304
40304
|
return Object.assign(Object.assign({}, state), { adding: false, dbEntryToEdit: action.dbEntry });
|
|
40305
40305
|
}
|
|
40306
|
-
case ActionType$
|
|
40306
|
+
case ActionType$3.FinishAdd: {
|
|
40307
40307
|
// Handle cancel
|
|
40308
40308
|
const finishedEntry = action.dbEntry;
|
|
40309
40309
|
if (!finishedEntry) {
|
|
@@ -40327,10 +40327,10 @@ const reducer$2 = (state, action) => {
|
|
|
40327
40327
|
// Update the state
|
|
40328
40328
|
return Object.assign(Object.assign({}, state), { adding: false, dbEntryToEdit: undefined, dbEntries: updatedDbEntries });
|
|
40329
40329
|
}
|
|
40330
|
-
case ActionType$
|
|
40330
|
+
case ActionType$3.StartDelete: {
|
|
40331
40331
|
return Object.assign(Object.assign({}, state), { loading: true });
|
|
40332
40332
|
}
|
|
40333
|
-
case ActionType$
|
|
40333
|
+
case ActionType$3.FinishDelete: {
|
|
40334
40334
|
return Object.assign(Object.assign({}, state), { loading: false,
|
|
40335
40335
|
// Remove the deleted entry from the list
|
|
40336
40336
|
dbEntries: state.dbEntries.filter((entry) => {
|
|
@@ -40356,7 +40356,7 @@ const DBEntryManagerPanel = (props) => {
|
|
|
40356
40356
|
loading: true,
|
|
40357
40357
|
};
|
|
40358
40358
|
// Initialize state
|
|
40359
|
-
const [state, dispatch] = React.useReducer(reducer$
|
|
40359
|
+
const [state, dispatch] = React.useReducer(reducer$3, initialState);
|
|
40360
40360
|
// Destructure common state
|
|
40361
40361
|
const { adding, dbEntryToEdit, dbEntries, loading, } = state;
|
|
40362
40362
|
/*------------------------------------------------------------------------*/
|
|
@@ -40382,7 +40382,7 @@ const DBEntryManagerPanel = (props) => {
|
|
|
40382
40382
|
try {
|
|
40383
40383
|
// Start loader
|
|
40384
40384
|
dispatch({
|
|
40385
|
-
type: ActionType$
|
|
40385
|
+
type: ActionType$3.StartDelete,
|
|
40386
40386
|
});
|
|
40387
40387
|
// Perform deletion
|
|
40388
40388
|
yield visitServerEndpoint({
|
|
@@ -40391,7 +40391,7 @@ const DBEntryManagerPanel = (props) => {
|
|
|
40391
40391
|
});
|
|
40392
40392
|
// Finish loader
|
|
40393
40393
|
dispatch({
|
|
40394
|
-
type: ActionType$
|
|
40394
|
+
type: ActionType$3.FinishDelete,
|
|
40395
40395
|
dbEntry: entry,
|
|
40396
40396
|
idPropName,
|
|
40397
40397
|
});
|
|
@@ -40420,7 +40420,7 @@ const DBEntryManagerPanel = (props) => {
|
|
|
40420
40420
|
});
|
|
40421
40421
|
// Save loaded data
|
|
40422
40422
|
dispatch({
|
|
40423
|
-
type: ActionType$
|
|
40423
|
+
type: ActionType$3.FinishLoading,
|
|
40424
40424
|
dbEntries: data,
|
|
40425
40425
|
});
|
|
40426
40426
|
}
|
|
@@ -40463,7 +40463,7 @@ const DBEntryManagerPanel = (props) => {
|
|
|
40463
40463
|
React__default["default"].createElement("span", { className: "d-none d-md-inline ms-1" }, "Remove")),
|
|
40464
40464
|
!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: () => {
|
|
40465
40465
|
dispatch({
|
|
40466
|
-
type: ActionType$
|
|
40466
|
+
type: ActionType$3.ShowEditor,
|
|
40467
40467
|
dbEntry: entry,
|
|
40468
40468
|
});
|
|
40469
40469
|
} },
|
|
@@ -40473,7 +40473,7 @@ const DBEntryManagerPanel = (props) => {
|
|
|
40473
40473
|
React__default["default"].createElement("div", { className: "d-grid" },
|
|
40474
40474
|
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: () => {
|
|
40475
40475
|
dispatch({
|
|
40476
|
-
type: ActionType$
|
|
40476
|
+
type: ActionType$3.ShowAdder,
|
|
40477
40477
|
});
|
|
40478
40478
|
} },
|
|
40479
40479
|
React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: freeSolidSvgIcons.faPlus, className: "me-2" }),
|
|
@@ -40485,7 +40485,7 @@ const DBEntryManagerPanel = (props) => {
|
|
|
40485
40485
|
if (!loading && (adding || dbEntryToEdit)) {
|
|
40486
40486
|
body = (React__default["default"].createElement(AddOrEditDBEntry, { saveEndpointPath: endpoint, validateEntry: validateEntry, modifyEntry: modifyEntry, entryFields: entryFields, dbEntryToEdit: dbEntryToEdit, idPropName: idPropName, entries: dbEntries, itemName: itemName, onFinished: (entry) => {
|
|
40487
40487
|
dispatch({
|
|
40488
|
-
type: ActionType$
|
|
40488
|
+
type: ActionType$3.FinishAdd,
|
|
40489
40489
|
dbEntry: entry,
|
|
40490
40490
|
idPropName,
|
|
40491
40491
|
});
|
|
@@ -40516,7 +40516,6 @@ const TOOLTIP_BORDER_RADIUS_REM = 0.3;
|
|
|
40516
40516
|
const style$1 = `
|
|
40517
40517
|
/* Container for contents and tooltip */
|
|
40518
40518
|
.Tooltip-outer-container {
|
|
40519
|
-
display: inline-block;
|
|
40520
40519
|
position: relative;
|
|
40521
40520
|
}
|
|
40522
40521
|
|
|
@@ -40683,7 +40682,7 @@ const style$1 = `
|
|
|
40683
40682
|
`;
|
|
40684
40683
|
/* ------------- Actions ------------ */
|
|
40685
40684
|
// Types of actions
|
|
40686
|
-
var ActionType$
|
|
40685
|
+
var ActionType$2;
|
|
40687
40686
|
(function (ActionType) {
|
|
40688
40687
|
// Make the tooltip visible
|
|
40689
40688
|
ActionType["Show"] = "Show";
|
|
@@ -40695,28 +40694,28 @@ var ActionType$1;
|
|
|
40695
40694
|
ActionType["SetSquareBottomLeft"] = "SetSquareBottomLeft";
|
|
40696
40695
|
// Set whether bottom right corner should be square
|
|
40697
40696
|
ActionType["SetSquareBottomRight"] = "SetSquareBottomRight";
|
|
40698
|
-
})(ActionType$
|
|
40697
|
+
})(ActionType$2 || (ActionType$2 = {}));
|
|
40699
40698
|
/**
|
|
40700
40699
|
* Reducer that executes actions
|
|
40701
40700
|
* @author Gabe Abrams
|
|
40702
40701
|
* @param state current state
|
|
40703
40702
|
* @param action action to execute
|
|
40704
40703
|
*/
|
|
40705
|
-
const reducer$
|
|
40704
|
+
const reducer$2 = (state, action) => {
|
|
40706
40705
|
switch (action.type) {
|
|
40707
|
-
case ActionType$
|
|
40706
|
+
case ActionType$2.Show: {
|
|
40708
40707
|
return Object.assign(Object.assign({}, state), { isVisible: true });
|
|
40709
40708
|
}
|
|
40710
|
-
case ActionType$
|
|
40709
|
+
case ActionType$2.Hide: {
|
|
40711
40710
|
return Object.assign(Object.assign({}, state), { isVisible: false, nudgePx: 0 });
|
|
40712
40711
|
}
|
|
40713
|
-
case ActionType$
|
|
40712
|
+
case ActionType$2.SetNudgePx: {
|
|
40714
40713
|
return Object.assign(Object.assign({}, state), { nudgePx: action.nudgePx });
|
|
40715
40714
|
}
|
|
40716
|
-
case ActionType$
|
|
40715
|
+
case ActionType$2.SetSquareBottomLeft: {
|
|
40717
40716
|
return Object.assign(Object.assign({}, state), { squareBottomLeft: action.squareBottomLeft });
|
|
40718
40717
|
}
|
|
40719
|
-
case ActionType$
|
|
40718
|
+
case ActionType$2.SetSquareBottomRight: {
|
|
40720
40719
|
return Object.assign(Object.assign({}, state), { squareBottomRight: action.squareBottomRight });
|
|
40721
40720
|
}
|
|
40722
40721
|
default: {
|
|
@@ -40733,7 +40732,7 @@ const Tooltip = (props) => {
|
|
|
40733
40732
|
/*------------------------------------------------------------------------*/
|
|
40734
40733
|
/* -------------- Props ------------- */
|
|
40735
40734
|
// Destructure all props
|
|
40736
|
-
const { icon, text, children, wide, thin, } = props;
|
|
40735
|
+
const { icon, text, children, wide, thin, containerIsDisplayBlock, } = props;
|
|
40737
40736
|
/* -------------- State ------------- */
|
|
40738
40737
|
// Initial state
|
|
40739
40738
|
const initialState = {
|
|
@@ -40741,7 +40740,7 @@ const Tooltip = (props) => {
|
|
|
40741
40740
|
nudgePx: 0,
|
|
40742
40741
|
};
|
|
40743
40742
|
// Initialize state
|
|
40744
|
-
const [state, dispatch] = React.useReducer(reducer$
|
|
40743
|
+
const [state, dispatch] = React.useReducer(reducer$2, initialState);
|
|
40745
40744
|
// Destructure common state
|
|
40746
40745
|
const { isVisible, nudgePx, squareBottomLeft, squareBottomRight, } = state;
|
|
40747
40746
|
/* -------------- Refs -------------- */
|
|
@@ -40780,7 +40779,7 @@ const Tooltip = (props) => {
|
|
|
40780
40779
|
}
|
|
40781
40780
|
// Update state
|
|
40782
40781
|
dispatch({
|
|
40783
|
-
type: ActionType$
|
|
40782
|
+
type: ActionType$2.SetNudgePx,
|
|
40784
40783
|
nudgePx: newNudgePx,
|
|
40785
40784
|
});
|
|
40786
40785
|
}
|
|
@@ -40794,12 +40793,12 @@ const Tooltip = (props) => {
|
|
|
40794
40793
|
const remInPixels = Number.parseInt(getComputedStyle(document.documentElement).fontSize, 10);
|
|
40795
40794
|
// Set bottom left corner rounding
|
|
40796
40795
|
dispatch({
|
|
40797
|
-
type: ActionType$
|
|
40796
|
+
type: ActionType$2.SetSquareBottomLeft,
|
|
40798
40797
|
squareBottomLeft: (arrowRect.left < (TOOLTIP_BORDER_RADIUS_REM * remInPixels)),
|
|
40799
40798
|
});
|
|
40800
40799
|
// Set bottom right corner rounding
|
|
40801
40800
|
dispatch({
|
|
40802
|
-
type: ActionType$
|
|
40801
|
+
type: ActionType$2.SetSquareBottomRight,
|
|
40803
40802
|
squareBottomRight: (arrowRect.right
|
|
40804
40803
|
> window.innerWidth - (TOOLTIP_BORDER_RADIUS_REM * remInPixels)),
|
|
40805
40804
|
});
|
|
@@ -40820,21 +40819,21 @@ const Tooltip = (props) => {
|
|
|
40820
40819
|
size = 'thin';
|
|
40821
40820
|
}
|
|
40822
40821
|
// Render
|
|
40823
|
-
return (React__default["default"].createElement("div", { className:
|
|
40822
|
+
return (React__default["default"].createElement("div", { className: `Tooltip-outer-container ${containerIsDisplayBlock ? 'd-block' : 'd-inline-block'}}`, "aria-label": text, onMouseEnter: () => {
|
|
40824
40823
|
dispatch({
|
|
40825
|
-
type: ActionType$
|
|
40824
|
+
type: ActionType$2.Show,
|
|
40826
40825
|
});
|
|
40827
40826
|
}, onMouseLeave: () => {
|
|
40828
40827
|
dispatch({
|
|
40829
|
-
type: ActionType$
|
|
40828
|
+
type: ActionType$2.Hide,
|
|
40830
40829
|
});
|
|
40831
40830
|
}, onFocus: () => {
|
|
40832
40831
|
dispatch({
|
|
40833
|
-
type: ActionType$
|
|
40832
|
+
type: ActionType$2.Show,
|
|
40834
40833
|
});
|
|
40835
40834
|
}, onBlur: () => {
|
|
40836
40835
|
dispatch({
|
|
40837
|
-
type: ActionType$
|
|
40836
|
+
type: ActionType$2.Hide,
|
|
40838
40837
|
});
|
|
40839
40838
|
} },
|
|
40840
40839
|
React__default["default"].createElement("style", null, style$1),
|
|
@@ -40987,25 +40986,25 @@ const getItemIds = (items) => {
|
|
|
40987
40986
|
};
|
|
40988
40987
|
/* ------------- Actions ------------ */
|
|
40989
40988
|
// Types of actions
|
|
40990
|
-
var ActionType;
|
|
40989
|
+
var ActionType$1;
|
|
40991
40990
|
(function (ActionType) {
|
|
40992
40991
|
// Hide the "jump to bottom" button
|
|
40993
40992
|
ActionType["HideJumpToBottomButton"] = "HideJumpToBottomButton";
|
|
40994
40993
|
// Show the "jump to bottom" button
|
|
40995
40994
|
ActionType["ShowJumpToBottomButton"] = "ShowJumpToBottomButton";
|
|
40996
|
-
})(ActionType || (ActionType = {}));
|
|
40995
|
+
})(ActionType$1 || (ActionType$1 = {}));
|
|
40997
40996
|
/**
|
|
40998
40997
|
* Reducer that executes actions
|
|
40999
40998
|
* @author Gabe Abrams
|
|
41000
40999
|
* @param state current state
|
|
41001
41000
|
* @param action action to execute
|
|
41002
41001
|
*/
|
|
41003
|
-
const reducer = (state, action) => {
|
|
41002
|
+
const reducer$1 = (state, action) => {
|
|
41004
41003
|
switch (action.type) {
|
|
41005
|
-
case ActionType.HideJumpToBottomButton: {
|
|
41004
|
+
case ActionType$1.HideJumpToBottomButton: {
|
|
41006
41005
|
return Object.assign(Object.assign({}, state), { jumpToBottomButtonVisible: false });
|
|
41007
41006
|
}
|
|
41008
|
-
case ActionType.ShowJumpToBottomButton: {
|
|
41007
|
+
case ActionType$1.ShowJumpToBottomButton: {
|
|
41009
41008
|
return Object.assign(Object.assign({}, state), { jumpToBottomButtonVisible: true });
|
|
41010
41009
|
}
|
|
41011
41010
|
default: {
|
|
@@ -41029,7 +41028,7 @@ const AutoscrollToBottomContainer = (props) => {
|
|
|
41029
41028
|
jumpToBottomButtonVisible: false,
|
|
41030
41029
|
};
|
|
41031
41030
|
// Initialize state
|
|
41032
|
-
const [state, dispatch] = React.useReducer(reducer, initialState);
|
|
41031
|
+
const [state, dispatch] = React.useReducer(reducer$1, initialState);
|
|
41033
41032
|
// Destructure common state
|
|
41034
41033
|
const { jumpToBottomButtonVisible, } = state;
|
|
41035
41034
|
/* -------------- Refs -------------- */
|
|
@@ -41075,7 +41074,7 @@ const AutoscrollToBottomContainer = (props) => {
|
|
|
41075
41074
|
}
|
|
41076
41075
|
// Update state
|
|
41077
41076
|
dispatch({
|
|
41078
|
-
type: ActionType.HideJumpToBottomButton,
|
|
41077
|
+
type: ActionType$1.HideJumpToBottomButton,
|
|
41079
41078
|
});
|
|
41080
41079
|
// Scroll to bottom
|
|
41081
41080
|
container.current.scrollTop = (container.current.scrollHeight
|
|
@@ -41099,7 +41098,7 @@ const AutoscrollToBottomContainer = (props) => {
|
|
|
41099
41098
|
if (isScrolledToBottom()) {
|
|
41100
41099
|
// Hide button
|
|
41101
41100
|
dispatch({
|
|
41102
|
-
type: ActionType.HideJumpToBottomButton,
|
|
41101
|
+
type: ActionType$1.HideJumpToBottomButton,
|
|
41103
41102
|
});
|
|
41104
41103
|
}
|
|
41105
41104
|
};
|
|
@@ -41141,7 +41140,7 @@ const AutoscrollToBottomContainer = (props) => {
|
|
|
41141
41140
|
else {
|
|
41142
41141
|
// Not scrolled to bottom. Show "jump to bottom" button.
|
|
41143
41142
|
dispatch({
|
|
41144
|
-
type: ActionType.ShowJumpToBottomButton,
|
|
41143
|
+
type: ActionType$1.ShowJumpToBottomButton,
|
|
41145
41144
|
});
|
|
41146
41145
|
}
|
|
41147
41146
|
}, [items]);
|
|
@@ -41174,6 +41173,212 @@ const AutoscrollToBottomContainer = (props) => {
|
|
|
41174
41173
|
messageAfterItems)));
|
|
41175
41174
|
};
|
|
41176
41175
|
|
|
41176
|
+
/**
|
|
41177
|
+
* A switch with multiple options for selection
|
|
41178
|
+
* @author Alessandra De Lucas
|
|
41179
|
+
* @author Gabe Abrams
|
|
41180
|
+
*/
|
|
41181
|
+
/* ------------- Actions ------------ */
|
|
41182
|
+
// Types of actions
|
|
41183
|
+
var ActionType;
|
|
41184
|
+
(function (ActionType) {
|
|
41185
|
+
// Start hovering on an option
|
|
41186
|
+
ActionType["StartHover"] = "StartHover";
|
|
41187
|
+
// Stop hovering on an option
|
|
41188
|
+
ActionType["StopHover"] = "StopHover";
|
|
41189
|
+
})(ActionType || (ActionType = {}));
|
|
41190
|
+
/**
|
|
41191
|
+
* Reducer that executes actions
|
|
41192
|
+
* @author Gabe Abrams
|
|
41193
|
+
* @param state current state
|
|
41194
|
+
* @param action action to execute
|
|
41195
|
+
*/
|
|
41196
|
+
const reducer = (state, action) => {
|
|
41197
|
+
switch (action.type) {
|
|
41198
|
+
case ActionType.StartHover: {
|
|
41199
|
+
return Object.assign(Object.assign({}, state), { hoveredOptionId: action.hoveredOptionId });
|
|
41200
|
+
}
|
|
41201
|
+
case ActionType.StopHover: {
|
|
41202
|
+
return Object.assign(Object.assign({}, state), { hoveredOptionId: undefined });
|
|
41203
|
+
}
|
|
41204
|
+
default: {
|
|
41205
|
+
return state;
|
|
41206
|
+
}
|
|
41207
|
+
}
|
|
41208
|
+
};
|
|
41209
|
+
/*------------------------------------------------------------------------*/
|
|
41210
|
+
/* ------------------------------ Component ----------------------------- */
|
|
41211
|
+
/*------------------------------------------------------------------------*/
|
|
41212
|
+
const MultiSwitch = (props) => {
|
|
41213
|
+
/*------------------------------------------------------------------------*/
|
|
41214
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
41215
|
+
/*------------------------------------------------------------------------*/
|
|
41216
|
+
/* -------------- Props ------------- */
|
|
41217
|
+
// Destructure all props
|
|
41218
|
+
const { options, selectedOptionId, onChange, heightRem = 3, } = props;
|
|
41219
|
+
/* -------------- State ------------- */
|
|
41220
|
+
// Initial state
|
|
41221
|
+
const initialState = {
|
|
41222
|
+
hoveredOptionId: undefined,
|
|
41223
|
+
};
|
|
41224
|
+
// Initialize state
|
|
41225
|
+
const [state, dispatch] = React.useReducer(reducer, initialState);
|
|
41226
|
+
// Destructure common state
|
|
41227
|
+
const { hoveredOptionId, } = state;
|
|
41228
|
+
/*------------------------------------------------------------------------*/
|
|
41229
|
+
/* -------------------------------- Style ------------------------------- */
|
|
41230
|
+
/*------------------------------------------------------------------------*/
|
|
41231
|
+
// Calculate the index of the selected option
|
|
41232
|
+
const selectedOptionIndex = options.findIndex((option) => {
|
|
41233
|
+
return (option.id === selectedOptionId);
|
|
41234
|
+
});
|
|
41235
|
+
// Constants
|
|
41236
|
+
const gutterRems = heightRem * 0.1;
|
|
41237
|
+
const itemWidthRems = heightRem * 1.3;
|
|
41238
|
+
const textFontSize = heightRem / 3.5;
|
|
41239
|
+
const iconFontSize = heightRem / 2;
|
|
41240
|
+
const borderWidthRems = 0.05;
|
|
41241
|
+
// Style
|
|
41242
|
+
const style = `
|
|
41243
|
+
.MultiSwitch-outer-box {
|
|
41244
|
+
display: inline-block !important;
|
|
41245
|
+
position: relative;
|
|
41246
|
+
border-radius: 0.5rem !important;
|
|
41247
|
+
border: ${borderWidthRems}rem solid #666 !important;
|
|
41248
|
+
padding: 0 !important;
|
|
41249
|
+
height: ${heightRem}rem !important;
|
|
41250
|
+
width: ${gutterRems + (2 * borderWidthRems) + options.length * (itemWidthRems + gutterRems)}rem !important;
|
|
41251
|
+
overflow: visible !important;
|
|
41252
|
+
text-wrap: none !important;
|
|
41253
|
+
z-index: 0;
|
|
41254
|
+
}
|
|
41255
|
+
|
|
41256
|
+
.MultiSwitch-options-container {
|
|
41257
|
+
position: relative;
|
|
41258
|
+
display: flex;
|
|
41259
|
+
flex-direction: row;
|
|
41260
|
+
align-items: center;
|
|
41261
|
+
justify-content: flex-start;
|
|
41262
|
+
z-index: 1;
|
|
41263
|
+
margin-top: ${gutterRems}rem;
|
|
41264
|
+
width: ${gutterRems + options.length * (itemWidthRems + gutterRems)}rem;
|
|
41265
|
+
overflow: visible !important;
|
|
41266
|
+
text-wrap: none !important;
|
|
41267
|
+
}
|
|
41268
|
+
|
|
41269
|
+
.MultiSwitch-icon {
|
|
41270
|
+
font-size: ${iconFontSize}rems !important;
|
|
41271
|
+
}
|
|
41272
|
+
|
|
41273
|
+
.MultiSwitch-option-button {
|
|
41274
|
+
position: relative !important;
|
|
41275
|
+
font-size: ${textFontSize}rem !important;
|
|
41276
|
+
z-index: 1 !important;
|
|
41277
|
+
display: inline-block !important;
|
|
41278
|
+
flex-grow: 0 !important;
|
|
41279
|
+
border: 0 !important;
|
|
41280
|
+
border-radius: 0.5rem !important;
|
|
41281
|
+
width: ${itemWidthRems}rem !important;
|
|
41282
|
+
height: ${heightRem - (2 * gutterRems)}rem !important;
|
|
41283
|
+
overflow: hidden;
|
|
41284
|
+
text-overflow: ellipsis;
|
|
41285
|
+
font-size: ${heightRem / 3}rem !important;
|
|
41286
|
+
line-height: 1 !important;
|
|
41287
|
+
margin-right: 0 !important;
|
|
41288
|
+
margin-top: 0 !important;
|
|
41289
|
+
margin-bottom: 0 !important;
|
|
41290
|
+
margin-left: ${gutterRems}rem !important;
|
|
41291
|
+
color: black !important;
|
|
41292
|
+
background-color: transparent !important;
|
|
41293
|
+
transition: background-color 0.3s ease-out !important;
|
|
41294
|
+
}
|
|
41295
|
+
|
|
41296
|
+
.MultiSwitch-option-button-hovered {
|
|
41297
|
+
background-color: #eee !important;
|
|
41298
|
+
}
|
|
41299
|
+
|
|
41300
|
+
.MultiSwitch-option-text {
|
|
41301
|
+
display: inline-block;
|
|
41302
|
+
font-size: ${textFontSize}rem !important;
|
|
41303
|
+
text-overflow: ellipsis;
|
|
41304
|
+
white-space: nowrap;
|
|
41305
|
+
width: 100%;
|
|
41306
|
+
text-align: center !important;
|
|
41307
|
+
}
|
|
41308
|
+
|
|
41309
|
+
.MultiSwitch-highlight-container {
|
|
41310
|
+
position: absolute;
|
|
41311
|
+
z-index: -1;
|
|
41312
|
+
left: 0;
|
|
41313
|
+
top: 0;
|
|
41314
|
+
display: inline-block;
|
|
41315
|
+
height: 0;
|
|
41316
|
+
width: 0;
|
|
41317
|
+
overflow: visible;
|
|
41318
|
+
}
|
|
41319
|
+
|
|
41320
|
+
.MultiSwitch-highlight {
|
|
41321
|
+
position: absolute;
|
|
41322
|
+
border-radius: 0.5rem !important;
|
|
41323
|
+
width: ${itemWidthRems}rem;
|
|
41324
|
+
height: ${heightRem - (2 * gutterRems)}rem;
|
|
41325
|
+
top: ${gutterRems}rem;
|
|
41326
|
+
left: ${gutterRems}rem;
|
|
41327
|
+
transform: translate(${selectedOptionIndex * (itemWidthRems + gutterRems) + borderWidthRems}rem, -${borderWidthRems * 0.5}rem);
|
|
41328
|
+
transition: transform 0.3s ease-in-out;
|
|
41329
|
+
}
|
|
41330
|
+
`;
|
|
41331
|
+
/*------------------------------------------------------------------------*/
|
|
41332
|
+
/* ------------------------------- Render ------------------------------- */
|
|
41333
|
+
/*------------------------------------------------------------------------*/
|
|
41334
|
+
/*----------------------------------------*/
|
|
41335
|
+
/* --------------- Main UI -------------- */
|
|
41336
|
+
/*----------------------------------------*/
|
|
41337
|
+
const optionElements = options.map((option) => {
|
|
41338
|
+
return (React__default["default"].createElement("button", { type: "button", className: `MultiSwitch-option-button${option.id === hoveredOptionId ? ' MultiSwitch-option-button-hovered' : ''}`, "aria-label": (option.id === selectedOptionId
|
|
41339
|
+
? `option "${option.label}", currently selected`
|
|
41340
|
+
: `click to select option "${option.label}"`), onClick: () => {
|
|
41341
|
+
// Remove hover
|
|
41342
|
+
dispatch({
|
|
41343
|
+
type: ActionType.StopHover,
|
|
41344
|
+
});
|
|
41345
|
+
// Notify parent
|
|
41346
|
+
onChange(option.id);
|
|
41347
|
+
}, onMouseEnter: () => {
|
|
41348
|
+
dispatch({
|
|
41349
|
+
type: ActionType.StartHover,
|
|
41350
|
+
hoveredOptionId: option.id,
|
|
41351
|
+
});
|
|
41352
|
+
}, onMouseLeave: () => {
|
|
41353
|
+
dispatch({
|
|
41354
|
+
type: ActionType.StopHover,
|
|
41355
|
+
});
|
|
41356
|
+
}, onFocus: () => {
|
|
41357
|
+
dispatch({
|
|
41358
|
+
type: ActionType.StartHover,
|
|
41359
|
+
hoveredOptionId: option.id,
|
|
41360
|
+
});
|
|
41361
|
+
}, onBlur: () => {
|
|
41362
|
+
dispatch({
|
|
41363
|
+
type: ActionType.StopHover,
|
|
41364
|
+
});
|
|
41365
|
+
}, style: {
|
|
41366
|
+
pointerEvents: ((option.id === selectedOptionId)
|
|
41367
|
+
? 'none'
|
|
41368
|
+
: undefined),
|
|
41369
|
+
}, disabled: option.id === selectedOptionId },
|
|
41370
|
+
React__default["default"].createElement("div", { className: "MultiSelect-icon" },
|
|
41371
|
+
React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: option.icon })),
|
|
41372
|
+
React__default["default"].createElement("div", { className: "MultiSwitch-option-text" }, option.label)));
|
|
41373
|
+
});
|
|
41374
|
+
// Highlight behind selected option
|
|
41375
|
+
const highlight = (React__default["default"].createElement("div", { className: "MultiSwitch-highlight bg-warning d-inline-block" }));
|
|
41376
|
+
return (React__default["default"].createElement("div", { className: "MultiSwitch-outer-box alert alert-dark" },
|
|
41377
|
+
React__default["default"].createElement("style", null, style),
|
|
41378
|
+
React__default["default"].createElement("div", { className: "MultiSwitch-options-container" }, optionElements),
|
|
41379
|
+
React__default["default"].createElement("div", { className: "MultiSwitch-highlight-container" }, highlight)));
|
|
41380
|
+
};
|
|
41381
|
+
|
|
41177
41382
|
/**
|
|
41178
41383
|
* One minute in ms
|
|
41179
41384
|
* @author Gabe Abrams
|
|
@@ -43143,6 +43348,7 @@ exports.Modal = Modal;
|
|
|
43143
43348
|
exports.ModalButtonType = ModalButtonType$1;
|
|
43144
43349
|
exports.ModalSize = ModalSize$1;
|
|
43145
43350
|
exports.ModalType = ModalType$1;
|
|
43351
|
+
exports.MultiSwitch = MultiSwitch;
|
|
43146
43352
|
exports.ParamType = ParamType$1;
|
|
43147
43353
|
exports.PopFailureMark = PopFailureMark;
|
|
43148
43354
|
exports.PopPendingMark = PopPendingMark;
|