dce-reactkit 4.0.0-beta.3 → 4.0.1
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/.vscode/settings.json +3 -1
- package/dist/cjs/index.js +392 -167
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/ItemPicker/index.d.ts +1 -0
- package/dist/cjs/types/components/Modal/ModalProps.d.ts +2 -0
- package/dist/cjs/types/components/SimpleDateChooser.d.ts +3 -1
- package/dist/cjs/types/components/SimpleTimeChooser.d.ts +20 -0
- package/dist/cjs/types/components/TabBox.d.ts +1 -0
- package/dist/cjs/types/helpers/getWordCount.d.ts +10 -0
- package/dist/cjs/types/index.d.ts +3 -1
- package/dist/cjs/types/types/ReactKitErrorCode.d.ts +3 -1
- package/dist/esm/index.js +392 -169
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/ItemPicker/index.d.ts +1 -0
- package/dist/esm/types/components/Modal/ModalProps.d.ts +2 -0
- package/dist/esm/types/components/SimpleDateChooser.d.ts +3 -1
- package/dist/esm/types/components/SimpleTimeChooser.d.ts +20 -0
- package/dist/esm/types/components/TabBox.d.ts +1 -0
- package/dist/esm/types/helpers/getWordCount.d.ts +10 -0
- package/dist/esm/types/index.d.ts +3 -1
- package/dist/esm/types/types/ReactKitErrorCode.d.ts +3 -1
- package/dist/index.d.ts +55 -17
- package/package.json +2 -3
- package/rollup.config.js +0 -2
- package/src/components/IntelliTable.tsx +1 -1
- package/src/components/ItemPicker/NestableItemList.tsx +1 -0
- package/src/components/ItemPicker/index.tsx +96 -0
- package/src/components/LogReviewer.tsx +2 -2
- package/src/components/Modal/ModalProps.ts +4 -0
- package/src/components/Modal/index.tsx +59 -20
- package/src/components/SimpleDateChooser.tsx +62 -26
- package/src/components/SimpleTimeChooser.tsx +196 -0
- package/src/components/TabBox.tsx +27 -9
- package/src/helpers/getWordCount.ts +26 -0
- package/src/index.ts +4 -0
- package/src/types/LogSource.ts +1 -1
- package/src/types/ReactKitErrorCode.tsx +3 -1
- package/genEncodedSecret.ts +0 -84
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default, { useState, useRef, useEffect, useReducer, forwardRef, useContext, useLayoutEffect, createContext, useMemo, useCallback, Component, Fragment } from 'react';
|
|
3
|
-
import { faExclamationTriangle,
|
|
3
|
+
import { faExclamationTriangle, faCircle, faHourglassEnd, faDotCircle, faCheckSquare, faHourglass, faClipboard, faChevronDown, faChevronRight, faCloudDownloadAlt, faMinus, faCheckCircle, faXmarkCircle, faSort, faSortDown, faSortUp, faCalendar, faTag, faHammer, faList, faTimes, faSave, faTrash, faCog, faPlus } from '@fortawesome/free-solid-svg-icons';
|
|
4
4
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
5
5
|
import { faCircle as faCircle$1, faSquareMinus, faSquare } from '@fortawesome/free-regular-svg-icons';
|
|
6
6
|
|
|
@@ -29,7 +29,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
// Highest error code =
|
|
32
|
+
// Highest error code = DRK36
|
|
33
33
|
/**
|
|
34
34
|
* List of error codes built into the react kit
|
|
35
35
|
* @author Gabe Abrams
|
|
@@ -40,6 +40,8 @@ var ReactKitErrorCode;
|
|
|
40
40
|
ReactKitErrorCode["NoCode"] = "DRK2";
|
|
41
41
|
ReactKitErrorCode["SessionExpired"] = "DRK3";
|
|
42
42
|
ReactKitErrorCode["NoCACCLSendRequestFunction"] = "DRK7";
|
|
43
|
+
ReactKitErrorCode["SimpleDateChooserInvalidDateRange"] = "DRK35";
|
|
44
|
+
ReactKitErrorCode["SimpleDateChooserInvalidNumMonths"] = "DRK36";
|
|
43
45
|
})(ReactKitErrorCode || (ReactKitErrorCode = {}));
|
|
44
46
|
var ReactKitErrorCode$1 = ReactKitErrorCode;
|
|
45
47
|
|
|
@@ -871,6 +873,98 @@ function requireReactDom_development () {
|
|
|
871
873
|
|
|
872
874
|
var ReactDOM = /*@__PURE__*/getDefaultExportFromCjs(reactDom.exports);
|
|
873
875
|
|
|
876
|
+
/**
|
|
877
|
+
* Loading spinner/indicator
|
|
878
|
+
* @author Gabe Abrams
|
|
879
|
+
*/
|
|
880
|
+
/*------------------------------------------------------------------------*/
|
|
881
|
+
/* -------------------------------- Style ------------------------------- */
|
|
882
|
+
/*------------------------------------------------------------------------*/
|
|
883
|
+
const style$a = `
|
|
884
|
+
/* Container fades in */
|
|
885
|
+
.LoadingSpinner-container {
|
|
886
|
+
animation-name: LoadingSpinner-container-fade-in;
|
|
887
|
+
animation-duration: 0.3s;
|
|
888
|
+
animation-delay: 0.4s;
|
|
889
|
+
animation-fill-mode: both;
|
|
890
|
+
animation-timing-function: ease-out;
|
|
891
|
+
}
|
|
892
|
+
@keyframes LoadingSpinner-container-fade-in {
|
|
893
|
+
0% {
|
|
894
|
+
opacity: 0;
|
|
895
|
+
}
|
|
896
|
+
100% {
|
|
897
|
+
opacity: 1;
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
/* Blips */
|
|
902
|
+
.LoadingSpinner-blip-1,
|
|
903
|
+
.LoadingSpinner-blip-2,
|
|
904
|
+
.LoadingSpinner-blip-3,
|
|
905
|
+
.LoadingSpinner-blip-4 {
|
|
906
|
+
font-size: 1.8rem;
|
|
907
|
+
opacity: 0.6;
|
|
908
|
+
margin-top: 1rem;
|
|
909
|
+
margin-bottom: 1rem;
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
/* First Blip */
|
|
913
|
+
.LoadingSpinner-blip-1 {
|
|
914
|
+
animation: LoadingSpinner-pop-animation 2s infinite;
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
/* Second Blip */
|
|
918
|
+
.LoadingSpinner-blip-2 {
|
|
919
|
+
animation: LoadingSpinner-pop-animation 2s infinite;
|
|
920
|
+
-webkit-animation-delay: 0.1s;
|
|
921
|
+
animation-delay: 0.1s;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
/* Third Blip */
|
|
925
|
+
.LoadingSpinner-blip-3 {
|
|
926
|
+
animation: LoadingSpinner-pop-animation 2s infinite;
|
|
927
|
+
animation-delay: 0.2s;
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
/* Fourth Blip */
|
|
931
|
+
.LoadingSpinner-blip-4 {
|
|
932
|
+
animation: LoadingSpinner-pop-animation 2s infinite;
|
|
933
|
+
animation-delay: 0.3s;
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
/* Pop Animation for Each Blip */
|
|
937
|
+
@keyframes LoadingSpinner-pop-animation {
|
|
938
|
+
0% {
|
|
939
|
+
transform: scale(1.0);
|
|
940
|
+
}
|
|
941
|
+
10% {
|
|
942
|
+
transform: scale(1.5);
|
|
943
|
+
}
|
|
944
|
+
30% {
|
|
945
|
+
transform: scale(1.0);
|
|
946
|
+
}
|
|
947
|
+
100% {
|
|
948
|
+
transform: scale(1.0);
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
`;
|
|
952
|
+
/*------------------------------------------------------------------------*/
|
|
953
|
+
/* ------------------------------ Component ----------------------------- */
|
|
954
|
+
/*------------------------------------------------------------------------*/
|
|
955
|
+
const LoadingSpinner = () => {
|
|
956
|
+
/*------------------------------------------------------------------------*/
|
|
957
|
+
/* ------------------------------- Render ------------------------------- */
|
|
958
|
+
/*------------------------------------------------------------------------*/
|
|
959
|
+
// Add all four blips to a container
|
|
960
|
+
return (React__default.createElement("div", { className: "text-center LoadingSpinner LoadingSpinner-container" },
|
|
961
|
+
React__default.createElement("style", null, style$a),
|
|
962
|
+
React__default.createElement(FontAwesomeIcon, { icon: faCircle, className: "LoadingSpinner-blip-1 me-1" }),
|
|
963
|
+
React__default.createElement(FontAwesomeIcon, { icon: faCircle, className: "LoadingSpinner-blip-2 me-1" }),
|
|
964
|
+
React__default.createElement(FontAwesomeIcon, { icon: faCircle, className: "LoadingSpinner-blip-3 me-1" }),
|
|
965
|
+
React__default.createElement(FontAwesomeIcon, { icon: faCircle, className: "LoadingSpinner-blip-4" })));
|
|
966
|
+
};
|
|
967
|
+
|
|
874
968
|
/**
|
|
875
969
|
* Wait for a certain number of ms
|
|
876
970
|
* @author Gabe Abrams
|
|
@@ -1014,6 +1108,7 @@ const BASE_Z_INDEX = 1000000000;
|
|
|
1014
1108
|
const BASE_Z_INDEX_ON_TOP = 2000000000;
|
|
1015
1109
|
// Constants
|
|
1016
1110
|
const MS_TO_ANIMATE = 200; // Animation duration
|
|
1111
|
+
const MS_TO_WAIT_BEFORE_SHOWING_LOADING_INDICATOR = 1000;
|
|
1017
1112
|
// Modal type to list of buttons
|
|
1018
1113
|
const modalTypeToModalButtonTypes = {
|
|
1019
1114
|
[ModalType$1.Okay]: [
|
|
@@ -1127,7 +1222,7 @@ const getNextUniqueId = () => {
|
|
|
1127
1222
|
/*------------------------------------------------------------------------*/
|
|
1128
1223
|
/* -------------------------------- Style ------------------------------- */
|
|
1129
1224
|
/*------------------------------------------------------------------------*/
|
|
1130
|
-
const style$
|
|
1225
|
+
const style$9 = `
|
|
1131
1226
|
.Modal-backdrop {
|
|
1132
1227
|
position: fixed;
|
|
1133
1228
|
top: 0;
|
|
@@ -1199,13 +1294,14 @@ const Modal = (props) => {
|
|
|
1199
1294
|
/*------------------------------------------------------------------------*/
|
|
1200
1295
|
var _a;
|
|
1201
1296
|
/* -------------- Props ------------- */
|
|
1202
|
-
const { type = ModalType$1.NoButtons, size = ModalSize$1.Large, title, largeTitle, children, onClose, dontAllowBackdropExit, dontShowXButton, onTopOfOtherModals, } = props;
|
|
1297
|
+
const { type = ModalType$1.NoButtons, size = ModalSize$1.Large, title, largeTitle, children, onClose, dontAllowBackdropExit, dontShowXButton, onTopOfOtherModals, isLoading, isLoadingCancelable, } = props;
|
|
1203
1298
|
// Determine if no header either
|
|
1204
1299
|
const noHeader = (!title && type === ModalType$1.NoButtons);
|
|
1205
1300
|
/* -------------- State ------------- */
|
|
1206
1301
|
// True if animation is in use
|
|
1207
1302
|
const [animatingIn, setAnimatingIn] = useState(true);
|
|
1208
1303
|
const [animatingPop, setAnimatingPop] = useState(false);
|
|
1304
|
+
const [showModal, setShowModal] = useState(false);
|
|
1209
1305
|
/* -------------- Refs -------------- */
|
|
1210
1306
|
// Keep track of whether modal is still mounted
|
|
1211
1307
|
const mounted = useRef(false);
|
|
@@ -1232,6 +1328,16 @@ const Modal = (props) => {
|
|
|
1232
1328
|
if (mounted.current) {
|
|
1233
1329
|
setAnimatingIn(false);
|
|
1234
1330
|
}
|
|
1331
|
+
if (isLoading) {
|
|
1332
|
+
// wait before showing modal
|
|
1333
|
+
yield waitMs(MS_TO_WAIT_BEFORE_SHOWING_LOADING_INDICATOR);
|
|
1334
|
+
if (mounted.current) {
|
|
1335
|
+
setShowModal(true);
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
else {
|
|
1339
|
+
setShowModal(true);
|
|
1340
|
+
}
|
|
1235
1341
|
}))();
|
|
1236
1342
|
return () => {
|
|
1237
1343
|
mounted.current = false;
|
|
@@ -1298,6 +1404,15 @@ const Modal = (props) => {
|
|
|
1298
1404
|
else if (animatingPop) {
|
|
1299
1405
|
animationClass = 'Modal-animating-pop';
|
|
1300
1406
|
}
|
|
1407
|
+
// default to show close button when not loading and not show close button when loading
|
|
1408
|
+
// unless downShowXButton or isLoadingCancelable
|
|
1409
|
+
const showCloseButton = (
|
|
1410
|
+
// The modal must have an onClose function
|
|
1411
|
+
onClose
|
|
1412
|
+
// ...and the close button is allowed to be visible
|
|
1413
|
+
&& !dontShowXButton
|
|
1414
|
+
// ...and should not be shown if the modal is loading and not cancelable
|
|
1415
|
+
&& !(isLoading && !isLoadingCancelable));
|
|
1301
1416
|
// Render the modal
|
|
1302
1417
|
const contentToRender = (React__default.createElement("div", { className: "modal show", tabIndex: -1, style: {
|
|
1303
1418
|
zIndex: baseZIndex,
|
|
@@ -1306,7 +1421,7 @@ const Modal = (props) => {
|
|
|
1306
1421
|
left: 0,
|
|
1307
1422
|
right: 0,
|
|
1308
1423
|
} },
|
|
1309
|
-
React__default.createElement("style", null, style$
|
|
1424
|
+
React__default.createElement("style", null, style$9),
|
|
1310
1425
|
React__default.createElement("div", { className: `Modal-backdrop ${backdropAnimationClass}`, style: {
|
|
1311
1426
|
zIndex: baseZIndex + 1,
|
|
1312
1427
|
}, onClick: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -1324,7 +1439,7 @@ const Modal = (props) => {
|
|
|
1324
1439
|
// Handle close
|
|
1325
1440
|
handleClose(ModalButtonType$1.Cancel);
|
|
1326
1441
|
}) }),
|
|
1327
|
-
React__default.createElement("div", { className: `modal-dialog modal-${size} ${animationClass} modal-dialog-scrollable modal-dialog-centered`, style: {
|
|
1442
|
+
showModal && (React__default.createElement("div", { className: `modal-dialog modal-${size} ${animationClass} modal-dialog-scrollable modal-dialog-centered`, style: {
|
|
1328
1443
|
zIndex: baseZIndex + 2,
|
|
1329
1444
|
// Override sizes for even larger for XL
|
|
1330
1445
|
width: (size === ModalSize$1.ExtraLarge
|
|
@@ -1356,7 +1471,7 @@ const Modal = (props) => {
|
|
|
1356
1471
|
? '1.6rem'
|
|
1357
1472
|
: undefined),
|
|
1358
1473
|
} }, title),
|
|
1359
|
-
|
|
1474
|
+
showCloseButton && (React__default.createElement("button", { type: "button", className: "Modal-x-button btn-close", "aria-label": "Close", style: {
|
|
1360
1475
|
backgroundColor: (isDarkModeOn()
|
|
1361
1476
|
? 'white'
|
|
1362
1477
|
: undefined),
|
|
@@ -1364,14 +1479,18 @@ const Modal = (props) => {
|
|
|
1364
1479
|
// Handle close
|
|
1365
1480
|
handleClose(ModalButtonType$1.Cancel);
|
|
1366
1481
|
} })))),
|
|
1367
|
-
|
|
1482
|
+
React__default.createElement("div", { className: "modal-body", style: {
|
|
1368
1483
|
color: (isDarkModeOn()
|
|
1369
1484
|
? 'white'
|
|
1370
1485
|
: undefined),
|
|
1371
1486
|
backgroundColor: (isDarkModeOn()
|
|
1372
1487
|
? '#444'
|
|
1373
1488
|
: undefined),
|
|
1374
|
-
} },
|
|
1489
|
+
} }, isLoading
|
|
1490
|
+
? (React__default.createElement(React__default.Fragment, null,
|
|
1491
|
+
React__default.createElement(LoadingSpinner, null),
|
|
1492
|
+
React__default.createElement("span", { className: "sr-only" }, "Content loading")))
|
|
1493
|
+
: children),
|
|
1375
1494
|
footer && (React__default.createElement("div", { className: "modal-footer pt-1 pb-1", style: {
|
|
1376
1495
|
color: (isDarkModeOn()
|
|
1377
1496
|
? 'white'
|
|
@@ -1382,7 +1501,7 @@ const Modal = (props) => {
|
|
|
1382
1501
|
borderTop: (isDarkModeOn()
|
|
1383
1502
|
? '0.1rem solid gray'
|
|
1384
1503
|
: undefined),
|
|
1385
|
-
} }, footer))))));
|
|
1504
|
+
} }, footer)))))));
|
|
1386
1505
|
// Determine which portal to use
|
|
1387
1506
|
const portalNumber = id.current % NUM_MODAL_PORTALS;
|
|
1388
1507
|
// Render in a portal
|
|
@@ -1953,7 +2072,7 @@ const showSessionExpiredMessage = () => __awaiter(void 0, void 0, void 0, functi
|
|
|
1953
2072
|
/*------------------------------------------------------------------------*/
|
|
1954
2073
|
/* -------------------------------- Style ------------------------------- */
|
|
1955
2074
|
/*------------------------------------------------------------------------*/
|
|
1956
|
-
const style$
|
|
2075
|
+
const style$8 = `
|
|
1957
2076
|
.AppWrapper-leave-to-url-notice {
|
|
1958
2077
|
opacity: 0;
|
|
1959
2078
|
|
|
@@ -2167,105 +2286,13 @@ const AppWrapper = (props) => {
|
|
|
2167
2286
|
/* --------------- Main UI -------------- */
|
|
2168
2287
|
/*----------------------------------------*/
|
|
2169
2288
|
return (React__default.createElement(React__default.Fragment, null,
|
|
2170
|
-
React__default.createElement("style", null, style$
|
|
2289
|
+
React__default.createElement("style", null, style$8),
|
|
2171
2290
|
React__default.createElement("style", null, tooltipStyle),
|
|
2172
2291
|
modal,
|
|
2173
2292
|
customModalPortals,
|
|
2174
2293
|
body));
|
|
2175
2294
|
};
|
|
2176
2295
|
|
|
2177
|
-
/**
|
|
2178
|
-
* Loading spinner/indicator
|
|
2179
|
-
* @author Gabe Abrams
|
|
2180
|
-
*/
|
|
2181
|
-
/*------------------------------------------------------------------------*/
|
|
2182
|
-
/* -------------------------------- Style ------------------------------- */
|
|
2183
|
-
/*------------------------------------------------------------------------*/
|
|
2184
|
-
const style$8 = `
|
|
2185
|
-
/* Container fades in */
|
|
2186
|
-
.LoadingSpinner-container {
|
|
2187
|
-
animation-name: LoadingSpinner-container-fade-in;
|
|
2188
|
-
animation-duration: 0.3s;
|
|
2189
|
-
animation-delay: 0.4s;
|
|
2190
|
-
animation-fill-mode: both;
|
|
2191
|
-
animation-timing-function: ease-out;
|
|
2192
|
-
}
|
|
2193
|
-
@keyframes LoadingSpinner-container-fade-in {
|
|
2194
|
-
0% {
|
|
2195
|
-
opacity: 0;
|
|
2196
|
-
}
|
|
2197
|
-
100% {
|
|
2198
|
-
opacity: 1;
|
|
2199
|
-
}
|
|
2200
|
-
}
|
|
2201
|
-
|
|
2202
|
-
/* Blips */
|
|
2203
|
-
.LoadingSpinner-blip-1,
|
|
2204
|
-
.LoadingSpinner-blip-2,
|
|
2205
|
-
.LoadingSpinner-blip-3,
|
|
2206
|
-
.LoadingSpinner-blip-4 {
|
|
2207
|
-
font-size: 1.8rem;
|
|
2208
|
-
opacity: 0.6;
|
|
2209
|
-
margin-top: 1rem;
|
|
2210
|
-
margin-bottom: 1rem;
|
|
2211
|
-
}
|
|
2212
|
-
|
|
2213
|
-
/* First Blip */
|
|
2214
|
-
.LoadingSpinner-blip-1 {
|
|
2215
|
-
animation: LoadingSpinner-pop-animation 2s infinite;
|
|
2216
|
-
}
|
|
2217
|
-
|
|
2218
|
-
/* Second Blip */
|
|
2219
|
-
.LoadingSpinner-blip-2 {
|
|
2220
|
-
animation: LoadingSpinner-pop-animation 2s infinite;
|
|
2221
|
-
-webkit-animation-delay: 0.1s;
|
|
2222
|
-
animation-delay: 0.1s;
|
|
2223
|
-
}
|
|
2224
|
-
|
|
2225
|
-
/* Third Blip */
|
|
2226
|
-
.LoadingSpinner-blip-3 {
|
|
2227
|
-
animation: LoadingSpinner-pop-animation 2s infinite;
|
|
2228
|
-
animation-delay: 0.2s;
|
|
2229
|
-
}
|
|
2230
|
-
|
|
2231
|
-
/* Fourth Blip */
|
|
2232
|
-
.LoadingSpinner-blip-4 {
|
|
2233
|
-
animation: LoadingSpinner-pop-animation 2s infinite;
|
|
2234
|
-
animation-delay: 0.3s;
|
|
2235
|
-
}
|
|
2236
|
-
|
|
2237
|
-
/* Pop Animation for Each Blip */
|
|
2238
|
-
@keyframes LoadingSpinner-pop-animation {
|
|
2239
|
-
0% {
|
|
2240
|
-
transform: scale(1.0);
|
|
2241
|
-
}
|
|
2242
|
-
10% {
|
|
2243
|
-
transform: scale(1.5);
|
|
2244
|
-
}
|
|
2245
|
-
30% {
|
|
2246
|
-
transform: scale(1.0);
|
|
2247
|
-
}
|
|
2248
|
-
100% {
|
|
2249
|
-
transform: scale(1.0);
|
|
2250
|
-
}
|
|
2251
|
-
}
|
|
2252
|
-
`;
|
|
2253
|
-
/*------------------------------------------------------------------------*/
|
|
2254
|
-
/* ------------------------------ Component ----------------------------- */
|
|
2255
|
-
/*------------------------------------------------------------------------*/
|
|
2256
|
-
const LoadingSpinner = () => {
|
|
2257
|
-
/*------------------------------------------------------------------------*/
|
|
2258
|
-
/* ------------------------------- Render ------------------------------- */
|
|
2259
|
-
/*------------------------------------------------------------------------*/
|
|
2260
|
-
// Add all four blips to a container
|
|
2261
|
-
return (React__default.createElement("div", { className: "text-center LoadingSpinner LoadingSpinner-container" },
|
|
2262
|
-
React__default.createElement("style", null, style$8),
|
|
2263
|
-
React__default.createElement(FontAwesomeIcon, { icon: faCircle, className: "LoadingSpinner-blip-1 me-1" }),
|
|
2264
|
-
React__default.createElement(FontAwesomeIcon, { icon: faCircle, className: "LoadingSpinner-blip-2 me-1" }),
|
|
2265
|
-
React__default.createElement(FontAwesomeIcon, { icon: faCircle, className: "LoadingSpinner-blip-3 me-1" }),
|
|
2266
|
-
React__default.createElement(FontAwesomeIcon, { icon: faCircle, className: "LoadingSpinner-blip-4" })));
|
|
2267
|
-
};
|
|
2268
|
-
|
|
2269
2296
|
/**
|
|
2270
2297
|
* A box with a tab on the top that holds buttons and other content
|
|
2271
2298
|
* @author Gabe Abrams
|
|
@@ -2297,7 +2324,9 @@ const style$7 = `
|
|
|
2297
2324
|
|
|
2298
2325
|
/* Container for Title */
|
|
2299
2326
|
.TabBox-title-container {
|
|
2300
|
-
|
|
2327
|
+
display: flex;
|
|
2328
|
+
justify-content: space-between;
|
|
2329
|
+
align-items: center;
|
|
2301
2330
|
position: relative;
|
|
2302
2331
|
left: 0;
|
|
2303
2332
|
text-align: left;
|
|
@@ -2330,6 +2359,19 @@ const style$7 = `
|
|
|
2330
2359
|
background: #fdfdfd;
|
|
2331
2360
|
}
|
|
2332
2361
|
|
|
2362
|
+
.TabBox-title-right-container {
|
|
2363
|
+
display: flex;
|
|
2364
|
+
flex-direction: row;
|
|
2365
|
+
align-items: bottom;
|
|
2366
|
+
height: 2.4rem;
|
|
2367
|
+
overflow: visible;
|
|
2368
|
+
}
|
|
2369
|
+
|
|
2370
|
+
.TabBox-title-right-contents {
|
|
2371
|
+
margin-right: 0.5rem;
|
|
2372
|
+
margin-bottom: 0.2rem;
|
|
2373
|
+
}
|
|
2374
|
+
|
|
2333
2375
|
/* Make the TabBox's Children Appear Above Title if Overlap Occurs */
|
|
2334
2376
|
.TabBox-children {
|
|
2335
2377
|
position: relative;
|
|
@@ -2343,19 +2385,16 @@ const TabBox = (props) => {
|
|
|
2343
2385
|
/*------------------------------------------------------------------------*/
|
|
2344
2386
|
/* -------------------------------- Setup ------------------------------- */
|
|
2345
2387
|
/*------------------------------------------------------------------------*/
|
|
2346
|
-
|
|
2347
|
-
const { title, children, noBottomPadding, noBottomMargin, } = props;
|
|
2388
|
+
const { title, children, topRightChildren, noBottomPadding, noBottomMargin, } = props;
|
|
2348
2389
|
/*------------------------------------------------------------------------*/
|
|
2349
2390
|
/* ------------------------------- Render ------------------------------- */
|
|
2350
2391
|
/*------------------------------------------------------------------------*/
|
|
2351
|
-
/*----------------------------------------*/
|
|
2352
|
-
/* --------------- Main UI -------------- */
|
|
2353
|
-
/*----------------------------------------*/
|
|
2354
|
-
// Full UI
|
|
2355
2392
|
return (React__default.createElement("div", { className: `TabBox-container ${noBottomMargin ? '' : 'mb-2'}` },
|
|
2356
2393
|
React__default.createElement("style", null, style$7),
|
|
2357
2394
|
React__default.createElement("div", { className: "TabBox-title-container" },
|
|
2358
|
-
React__default.createElement("div", { className: "TabBox-title" }, title)
|
|
2395
|
+
React__default.createElement("div", { className: "TabBox-title" }, title),
|
|
2396
|
+
topRightChildren && (React__default.createElement("div", { className: "TabBox-title-right-container" },
|
|
2397
|
+
React__default.createElement("div", { className: "TabBox-title-right-contents" }, topRightChildren)))),
|
|
2359
2398
|
React__default.createElement("div", { className: `TabBox-box ps-2 pt-2 pe-2 ${noBottomPadding ? '' : 'pb-2'}` },
|
|
2360
2399
|
React__default.createElement("div", { className: "TabBox-children" }, children))));
|
|
2361
2400
|
};
|
|
@@ -2484,6 +2523,19 @@ const ButtonInputGroup = (props) => {
|
|
|
2484
2523
|
: children))));
|
|
2485
2524
|
};
|
|
2486
2525
|
|
|
2526
|
+
// Constants
|
|
2527
|
+
const ORDINALS = ['th', 'st', 'nd', 'rd'];
|
|
2528
|
+
/**
|
|
2529
|
+
* Get a number's ordinal
|
|
2530
|
+
* @author Gabe Abrams
|
|
2531
|
+
* @param num the number being analyzed
|
|
2532
|
+
* @returns ordinal
|
|
2533
|
+
*/
|
|
2534
|
+
const getOrdinal = (num) => {
|
|
2535
|
+
var _a, _b;
|
|
2536
|
+
return ((_b = (_a = ORDINALS[(num - 20) % 10]) !== null && _a !== void 0 ? _a : ORDINALS[num]) !== null && _b !== void 0 ? _b : ORDINALS[0]);
|
|
2537
|
+
};
|
|
2538
|
+
|
|
2487
2539
|
const monthNames = [
|
|
2488
2540
|
{ short: 'Jan', full: 'January' },
|
|
2489
2541
|
{ short: 'Feb', full: 'February' },
|
|
@@ -2512,19 +2564,6 @@ const getMonthName = (month) => {
|
|
|
2512
2564
|
return ((_a = monthNames[month - 1]) !== null && _a !== void 0 ? _a : monthNames[0]);
|
|
2513
2565
|
};
|
|
2514
2566
|
|
|
2515
|
-
// Constants
|
|
2516
|
-
const ORDINALS = ['th', 'st', 'nd', 'rd'];
|
|
2517
|
-
/**
|
|
2518
|
-
* Get a number's ordinal
|
|
2519
|
-
* @author Gabe Abrams
|
|
2520
|
-
* @param num the number being analyzed
|
|
2521
|
-
* @returns ordinal
|
|
2522
|
-
*/
|
|
2523
|
-
const getOrdinal = (num) => {
|
|
2524
|
-
var _a, _b;
|
|
2525
|
-
return ((_b = (_a = ORDINALS[(num - 20) % 10]) !== null && _a !== void 0 ? _a : ORDINALS[num]) !== null && _b !== void 0 ? _b : ORDINALS[0]);
|
|
2526
|
-
};
|
|
2527
|
-
|
|
2528
2567
|
/**
|
|
2529
2568
|
* Get current time info in US Boston Eastern Time, independent of machine
|
|
2530
2569
|
* timezone
|
|
@@ -2588,6 +2627,7 @@ const getTimeInfoInET = (dateOrTimestamp) => {
|
|
|
2588
2627
|
/**
|
|
2589
2628
|
* A very simple, lightweight date chooser
|
|
2590
2629
|
* @author Gabe Abrams
|
|
2630
|
+
* @author Gardenia Liu
|
|
2591
2631
|
*/
|
|
2592
2632
|
/*------------------------------------------------------------------------*/
|
|
2593
2633
|
/* ------------------------------ Component ----------------------------- */
|
|
@@ -2597,7 +2637,7 @@ const SimpleDateChooser = (props) => {
|
|
|
2597
2637
|
/* -------------------------------- Setup ------------------------------- */
|
|
2598
2638
|
/*------------------------------------------------------------------------*/
|
|
2599
2639
|
/* -------------- Props ------------- */
|
|
2600
|
-
const { ariaLabel, name, onChange,
|
|
2640
|
+
const { ariaLabel, name, onChange, numMonthsToShow = 6, dontAllowFuture, dontAllowPast, } = props;
|
|
2601
2641
|
/*------------------------------------------------------------------------*/
|
|
2602
2642
|
/* ------------------------------- Render ------------------------------- */
|
|
2603
2643
|
/*------------------------------------------------------------------------*/
|
|
@@ -2609,14 +2649,28 @@ const SimpleDateChooser = (props) => {
|
|
|
2609
2649
|
const choices = [];
|
|
2610
2650
|
let startYear = today.year;
|
|
2611
2651
|
let startMonth = today.month;
|
|
2612
|
-
|
|
2652
|
+
// Don't allow past or future dates
|
|
2653
|
+
if (dontAllowPast && dontAllowFuture) {
|
|
2654
|
+
throw new ErrorWithCode('No past or future dates allowed', ReactKitErrorCode$1.SimpleDateChooserInvalidDateRange);
|
|
2655
|
+
}
|
|
2656
|
+
// Require numMonthsToShow to be positive
|
|
2657
|
+
if (numMonthsToShow <= 0) {
|
|
2658
|
+
throw new ErrorWithCode('numMonthsToShow must be positive', ReactKitErrorCode$1.SimpleDateChooserInvalidNumMonths);
|
|
2659
|
+
}
|
|
2660
|
+
// Recalculate startMonth and startYear when allowing past dates
|
|
2661
|
+
if (!dontAllowPast) {
|
|
2613
2662
|
startMonth -= Math.max(0, numMonthsToShow - 1);
|
|
2614
2663
|
while (startMonth <= 0) {
|
|
2615
2664
|
startMonth += 12;
|
|
2616
2665
|
startYear -= 1;
|
|
2617
2666
|
}
|
|
2618
2667
|
}
|
|
2619
|
-
|
|
2668
|
+
// Calculate total number of months to show
|
|
2669
|
+
let totalMonthsToShow = numMonthsToShow;
|
|
2670
|
+
if (!dontAllowPast && !dontAllowFuture) {
|
|
2671
|
+
totalMonthsToShow = totalMonthsToShow * 2 - 1;
|
|
2672
|
+
}
|
|
2673
|
+
for (let i = 0; i < totalMonthsToShow; i++) {
|
|
2620
2674
|
// Get month and year info
|
|
2621
2675
|
const unmoddedMonth = (startMonth + i);
|
|
2622
2676
|
let month = unmoddedMonth;
|
|
@@ -2635,23 +2689,25 @@ const SimpleDateChooser = (props) => {
|
|
|
2635
2689
|
// Figure out which days are allowed
|
|
2636
2690
|
const days = [];
|
|
2637
2691
|
const numDaysInMonth = (new Date(year, month, 0)).getDate();
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
days.push(day);
|
|
2692
|
+
// Current month
|
|
2693
|
+
if (month === today.month && year === today.year) {
|
|
2694
|
+
// Past selection: add all previous days of the month
|
|
2695
|
+
if (!dontAllowPast) {
|
|
2696
|
+
for (let day = 1; day < today.day; day++) {
|
|
2697
|
+
days.push(day);
|
|
2698
|
+
}
|
|
2646
2699
|
}
|
|
2647
|
-
|
|
2648
|
-
else {
|
|
2700
|
+
days.push(today.day); // Add current day
|
|
2649
2701
|
// Future selection: add all remaining days of the month
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2702
|
+
if (!dontAllowFuture) {
|
|
2703
|
+
for (let day = today.day + 1; day <= numDaysInMonth; day++) {
|
|
2704
|
+
days.push(day);
|
|
2705
|
+
}
|
|
2706
|
+
}
|
|
2707
|
+
}
|
|
2708
|
+
else { // Past or future month
|
|
2709
|
+
// Include all days in the month
|
|
2710
|
+
for (let day = 1; day <= numDaysInMonth; day++) {
|
|
2655
2711
|
days.push(day);
|
|
2656
2712
|
}
|
|
2657
2713
|
}
|
|
@@ -2671,8 +2727,8 @@ const SimpleDateChooser = (props) => {
|
|
|
2671
2727
|
monthOptions.push(React__default.createElement("option", { key: `${choice.year}-${choice.month}`, value: `${choice.month}-${choice.year}`, "aria-label": `choose ${choice.choiceName}`, onSelect: () => {
|
|
2672
2728
|
onChange(choice.month, choice.days[0], choice.year);
|
|
2673
2729
|
} }, choice.choiceName));
|
|
2730
|
+
// This is the currently selected month
|
|
2674
2731
|
if (month === choice.month) {
|
|
2675
|
-
// This is the currently selected month
|
|
2676
2732
|
// Create day options
|
|
2677
2733
|
choice.days.forEach((dayChoice) => {
|
|
2678
2734
|
const ordinal = getOrdinal(dayChoice);
|
|
@@ -2694,6 +2750,125 @@ const SimpleDateChooser = (props) => {
|
|
|
2694
2750
|
} }, dayOptions)));
|
|
2695
2751
|
};
|
|
2696
2752
|
|
|
2753
|
+
/**
|
|
2754
|
+
* Pad a number with zeros on the left (e.g. 5 becomes 05 with 2 digit padding)
|
|
2755
|
+
* @author Gabe Abrams
|
|
2756
|
+
* @param num the number to pad
|
|
2757
|
+
* @param numDigits the minimum number of digits before the decimal
|
|
2758
|
+
* @returns padded number
|
|
2759
|
+
*/
|
|
2760
|
+
const padZerosLeft = (num, numDigits) => {
|
|
2761
|
+
// Convert to string
|
|
2762
|
+
let out = String(num);
|
|
2763
|
+
// Add zeros
|
|
2764
|
+
while (out.split('.')[0].length < numDigits) {
|
|
2765
|
+
out = `0${out}`;
|
|
2766
|
+
}
|
|
2767
|
+
// Return
|
|
2768
|
+
return out;
|
|
2769
|
+
};
|
|
2770
|
+
|
|
2771
|
+
/**
|
|
2772
|
+
* A very simple, lightweight time chooser
|
|
2773
|
+
* @author Gardenia Liu
|
|
2774
|
+
*/
|
|
2775
|
+
/*------------------------------------------------------------------------*/
|
|
2776
|
+
/* ------------------------------ Constants ----------------------------- */
|
|
2777
|
+
/*------------------------------------------------------------------------*/
|
|
2778
|
+
// Allowed intervals between options
|
|
2779
|
+
const ALLOWED_INTERVALS = [15, 30, 60]; // min
|
|
2780
|
+
// Default interval to use if an unsupported interval is passed in
|
|
2781
|
+
const DEFAULT_INTERVAL = ALLOWED_INTERVALS[0]; // min
|
|
2782
|
+
/*------------------------------------------------------------------------*/
|
|
2783
|
+
/* ------------------------------ Component ----------------------------- */
|
|
2784
|
+
/*------------------------------------------------------------------------*/
|
|
2785
|
+
const SimpleTimeChooser = (props) => {
|
|
2786
|
+
/*------------------------------------------------------------------------*/
|
|
2787
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
2788
|
+
/*------------------------------------------------------------------------*/
|
|
2789
|
+
/* -------------- Props ------------- */
|
|
2790
|
+
const { ariaLabel, name, hour, minute, onChange, } = props;
|
|
2791
|
+
let { intervalMin = DEFAULT_INTERVAL, } = props;
|
|
2792
|
+
// Use default interval if not supported
|
|
2793
|
+
if (!ALLOWED_INTERVALS.includes(intervalMin)) {
|
|
2794
|
+
intervalMin = DEFAULT_INTERVAL;
|
|
2795
|
+
}
|
|
2796
|
+
/*------------------------------------------------------------------------*/
|
|
2797
|
+
/* ------------------------- Component Functions ------------------------ */
|
|
2798
|
+
/*------------------------------------------------------------------------*/
|
|
2799
|
+
/**
|
|
2800
|
+
* Convert number of minutes since midnight into 24hour and minute format
|
|
2801
|
+
* @author Gabe Abrams
|
|
2802
|
+
* @param minSinceMidnight total minutes since midnight
|
|
2803
|
+
* @returns hours (24) and minutes
|
|
2804
|
+
*/
|
|
2805
|
+
const convertMinSinceMidnightToHoursAndMin = (minSinceMidnight) => {
|
|
2806
|
+
return {
|
|
2807
|
+
hours: Math.floor(minSinceMidnight / 60),
|
|
2808
|
+
minutes: minSinceMidnight % 60,
|
|
2809
|
+
};
|
|
2810
|
+
};
|
|
2811
|
+
/**
|
|
2812
|
+
* Convert time in minutes into HH:MM format
|
|
2813
|
+
* @author Gardenia Liu
|
|
2814
|
+
* @param totalMinutes total minutes since midnight
|
|
2815
|
+
* @returns formatted time string
|
|
2816
|
+
*/
|
|
2817
|
+
const formatTime = (totalMinutes) => {
|
|
2818
|
+
// Handle special cases
|
|
2819
|
+
if (totalMinutes === 0) {
|
|
2820
|
+
return '12:00 Midnight';
|
|
2821
|
+
}
|
|
2822
|
+
if (totalMinutes === 12 * 60) {
|
|
2823
|
+
return '12:00 Noon';
|
|
2824
|
+
}
|
|
2825
|
+
// All normal cases:
|
|
2826
|
+
const timeInfo = convertMinSinceMidnightToHoursAndMin(totalMinutes);
|
|
2827
|
+
let { hours } = timeInfo;
|
|
2828
|
+
const { minutes } = timeInfo;
|
|
2829
|
+
// Process 24hr -> 12hr
|
|
2830
|
+
const isAM = (hours < 12);
|
|
2831
|
+
if (hours === 0) {
|
|
2832
|
+
hours = 12;
|
|
2833
|
+
}
|
|
2834
|
+
else if (hours > 12) {
|
|
2835
|
+
hours %= 12;
|
|
2836
|
+
}
|
|
2837
|
+
// Pad with zeros
|
|
2838
|
+
const paddedMinutes = padZerosLeft(minutes, 2);
|
|
2839
|
+
// Assemble time string
|
|
2840
|
+
return `${hours}:${paddedMinutes} ${isAM ? 'AM' : 'PM'}`;
|
|
2841
|
+
};
|
|
2842
|
+
/*------------------------------------------------------------------------*/
|
|
2843
|
+
/* ------------------------------- Render ------------------------------- */
|
|
2844
|
+
/*------------------------------------------------------------------------*/
|
|
2845
|
+
/*----------------------------------------*/
|
|
2846
|
+
/* --------------- Main UI -------------- */
|
|
2847
|
+
/*----------------------------------------*/
|
|
2848
|
+
// Generate list of time options
|
|
2849
|
+
const times = [];
|
|
2850
|
+
for (let time = 0; time < 24 * 60; time += intervalMin) {
|
|
2851
|
+
times.push(formatTime(time));
|
|
2852
|
+
}
|
|
2853
|
+
// Currently selected time in minutes since midnight
|
|
2854
|
+
const selectedTimeMin = hour * 60 + minute;
|
|
2855
|
+
// Create choice options
|
|
2856
|
+
const timeOptions = times.map((timeString, timeIndex) => {
|
|
2857
|
+
const numMinutesForChoice = timeIndex * intervalMin;
|
|
2858
|
+
// Render the option
|
|
2859
|
+
return (React__default.createElement("option", { key: numMinutesForChoice, value: numMinutesForChoice, "aria-label": `choose ${timeString}` }, timeString));
|
|
2860
|
+
});
|
|
2861
|
+
return (React__default.createElement("div", { className: "SimpleTimeChooser-container", "aria-label": `time chooser with selected time: ${formatTime(selectedTimeMin)}` },
|
|
2862
|
+
React__default.createElement("select", { "aria-label": `time for ${ariaLabel}`, className: "custom-select d-inline-block", style: { width: 'auto' }, id: `SimpleTimeChooser-${name}-time`, value: selectedTimeMin, onChange: (e) => {
|
|
2863
|
+
// Parse selector value (string)
|
|
2864
|
+
const newTime = Number.parseInt(e.target.value, 10);
|
|
2865
|
+
// Convert minutes since midnight to hour and minute
|
|
2866
|
+
const timeInfo = convertMinSinceMidnightToHoursAndMin(newTime);
|
|
2867
|
+
// Notify parent
|
|
2868
|
+
onChange(timeInfo.hours, timeInfo.minutes);
|
|
2869
|
+
} }, timeOptions)));
|
|
2870
|
+
};
|
|
2871
|
+
|
|
2697
2872
|
/**
|
|
2698
2873
|
* Drawer container
|
|
2699
2874
|
* @author Gabe Abrams
|
|
@@ -3342,7 +3517,7 @@ const NestableItemList = (props) => {
|
|
|
3342
3517
|
React__default.createElement(FontAwesomeIcon, { icon: childExpanded[item.id] ? faChevronDown : faChevronRight })))),
|
|
3343
3518
|
React__default.createElement(CheckboxButton, { className: `NestableItemList-CheckboxButton-${item.id}`, text: item.name, checked: item.isGroup ? allChecked(item.children) : item.checked, dashed: item.isGroup ? !noneChecked(item.children) : false, onChanged: (checked) => {
|
|
3344
3519
|
onChanged(changeChecked(item.id, checked, items));
|
|
3345
|
-
}, ariaLabel: `Select ${item.name}`, checkedVariant: Variant$1.Light }),
|
|
3520
|
+
}, ariaLabel: `Select ${item.name}`, checkedVariant: Variant$1.Light, uncheckedVariant: Variant$1.Light }),
|
|
3346
3521
|
(item.isGroup && childExpanded[item.id]) && (React__default.createElement("div", { className: "NestableItemList-children-container", style: {
|
|
3347
3522
|
paddingLeft: '2.2rem',
|
|
3348
3523
|
} },
|
|
@@ -3365,17 +3540,62 @@ const ItemPicker = (props) => {
|
|
|
3365
3540
|
/*------------------------------------------------------------------------*/
|
|
3366
3541
|
/* -------------- Props ------------- */
|
|
3367
3542
|
// Destructure all props
|
|
3368
|
-
const { title, items, onChanged, noBottomMargin, } = props;
|
|
3543
|
+
const { title, items, onChanged, noBottomMargin, hideSelectAllOrNoneButtons, } = props;
|
|
3369
3544
|
/*------------------------------------------------------------------------*/
|
|
3370
3545
|
/* ------------------------- Component Functions ------------------------ */
|
|
3371
3546
|
/*------------------------------------------------------------------------*/
|
|
3547
|
+
/**
|
|
3548
|
+
* Updates the checked state of an item (including all children)
|
|
3549
|
+
* @author Yuen Ler Chow
|
|
3550
|
+
* @param item the item to update
|
|
3551
|
+
* @param checked the new checked state
|
|
3552
|
+
* @returns the updated item
|
|
3553
|
+
*/
|
|
3554
|
+
const updateItemChecked = (item, checked) => {
|
|
3555
|
+
if (item.isGroup) {
|
|
3556
|
+
return Object.assign(Object.assign({}, item), { children: item.children.map((child) => {
|
|
3557
|
+
return updateItemChecked(child, checked);
|
|
3558
|
+
}) });
|
|
3559
|
+
}
|
|
3560
|
+
return Object.assign(Object.assign({}, item), { checked });
|
|
3561
|
+
};
|
|
3562
|
+
/**
|
|
3563
|
+
* Selects all items in the list
|
|
3564
|
+
* @author Yuen Ler Chow
|
|
3565
|
+
*/
|
|
3566
|
+
const handleSelectAll = () => {
|
|
3567
|
+
const updatedItems = items.map((item) => {
|
|
3568
|
+
return updateItemChecked(item, true);
|
|
3569
|
+
});
|
|
3570
|
+
onChanged(updatedItems);
|
|
3571
|
+
};
|
|
3572
|
+
/**
|
|
3573
|
+
* Deselects all items in the list
|
|
3574
|
+
* @author Yuen Ler Chow
|
|
3575
|
+
*/
|
|
3576
|
+
const handleDeselectAll = () => {
|
|
3577
|
+
const updatedItems = items.map((item) => {
|
|
3578
|
+
return updateItemChecked(item, false);
|
|
3579
|
+
});
|
|
3580
|
+
onChanged(updatedItems);
|
|
3581
|
+
};
|
|
3372
3582
|
/*------------------------------------------------------------------------*/
|
|
3373
3583
|
/* ------------------------------- Render ------------------------------- */
|
|
3374
3584
|
/*------------------------------------------------------------------------*/
|
|
3375
3585
|
/*----------------------------------------*/
|
|
3376
3586
|
/* --------------- Main UI -------------- */
|
|
3377
3587
|
/*----------------------------------------*/
|
|
3378
|
-
|
|
3588
|
+
// Select all/none
|
|
3589
|
+
const selectAllOrNone = (!hideSelectAllOrNoneButtons
|
|
3590
|
+
? (React__default.createElement("div", { className: "d-flex h-100 align-items-end flex-row" },
|
|
3591
|
+
React__default.createElement("div", { className: "d-flex justify-content-end" },
|
|
3592
|
+
React__default.createElement("div", { className: "me-2", style: { fontSize: '1.2rem' } }, "Select"),
|
|
3593
|
+
React__default.createElement("div", { className: "btn-group", role: "group" },
|
|
3594
|
+
React__default.createElement("button", { type: "button", style: { borderRight: '0.1rem solid white' }, "aria-label": "Select all contexts", className: "btn btn-secondary py-0", onClick: handleSelectAll }, "All"),
|
|
3595
|
+
React__default.createElement("button", { type: "button", "aria-label": "Deselect all contexts", className: "btn btn-secondary py-0", onClick: handleDeselectAll }, "None")))))
|
|
3596
|
+
: undefined);
|
|
3597
|
+
// Main UI
|
|
3598
|
+
return (React__default.createElement(TabBox, { title: title, noBottomMargin: noBottomMargin, topRightChildren: selectAllOrNone },
|
|
3379
3599
|
React__default.createElement("div", { style: { overflowX: 'auto' } },
|
|
3380
3600
|
React__default.createElement(NestableItemList, { items: items, onChanged: onChanged }))));
|
|
3381
3601
|
};
|
|
@@ -3747,7 +3967,7 @@ const IntelliTable = (props) => {
|
|
|
3747
3967
|
param: column.param,
|
|
3748
3968
|
visible: checked,
|
|
3749
3969
|
});
|
|
3750
|
-
}, checked: columnVisibilityMap[column.param], ariaLabel: `show "${column.title}" column in the ${title} table`, checkedVariant: Variant$1.Light, uncheckedVariant: Variant$1.
|
|
3970
|
+
}, checked: columnVisibilityMap[column.param], ariaLabel: `show "${column.title}" column in the ${title} table`, checkedVariant: Variant$1.Light, uncheckedVariant: Variant$1.Light }));
|
|
3751
3971
|
}),
|
|
3752
3972
|
React__default.createElement("div", { className: "mt-3" }, "Or you can:"),
|
|
3753
3973
|
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: () => {
|
|
@@ -4743,14 +4963,14 @@ const LogReviewer = (props) => {
|
|
|
4743
4963
|
if (expandedFilterDrawer) {
|
|
4744
4964
|
if (expandedFilterDrawer === FilterDrawer.Date) {
|
|
4745
4965
|
filterDrawer = (React__default.createElement(TabBox, { title: "Date" },
|
|
4746
|
-
React__default.createElement(SimpleDateChooser, { ariaLabel: "filter start date", name: "filter-start-date", year: dateFilterState.startDate.year, month: dateFilterState.startDate.month, day: dateFilterState.startDate.day,
|
|
4966
|
+
React__default.createElement(SimpleDateChooser, { ariaLabel: "filter start date", name: "filter-start-date", year: dateFilterState.startDate.year, month: dateFilterState.startDate.month, day: dateFilterState.startDate.day, dontAllowFuture: true, numMonthsToShow: 36, onChange: (month, day, year) => {
|
|
4747
4967
|
dateFilterState.startDate = { month, day, year };
|
|
4748
4968
|
handleDateRangeUpdated(dateFilterState);
|
|
4749
4969
|
} }),
|
|
4750
4970
|
' ',
|
|
4751
4971
|
"to",
|
|
4752
4972
|
' ',
|
|
4753
|
-
React__default.createElement(SimpleDateChooser, { ariaLabel: "filter end date", name: "filter-end-date", year: dateFilterState.endDate.year, month: dateFilterState.endDate.month, day: dateFilterState.endDate.day,
|
|
4973
|
+
React__default.createElement(SimpleDateChooser, { ariaLabel: "filter end date", name: "filter-end-date", year: dateFilterState.endDate.year, month: dateFilterState.endDate.month, day: dateFilterState.endDate.day, dontAllowFuture: true, numMonthsToShow: 12, onChange: (month, day, year) => {
|
|
4754
4974
|
if (year < dateFilterState.startDate.year
|
|
4755
4975
|
|| (year === dateFilterState.startDate.year
|
|
4756
4976
|
&& month < dateFilterState.startDate.month)
|
|
@@ -15230,24 +15450,6 @@ const padDecimalZeros = (num, numDigits) => {
|
|
|
15230
15450
|
return out;
|
|
15231
15451
|
};
|
|
15232
15452
|
|
|
15233
|
-
/**
|
|
15234
|
-
* Pad a number with zeros on the left (e.g. 5 becomes 05 with 2 digit padding)
|
|
15235
|
-
* @author Gabe Abrams
|
|
15236
|
-
* @param num the number to pad
|
|
15237
|
-
* @param numDigits the minimum number of digits before the decimal
|
|
15238
|
-
* @returns padded number
|
|
15239
|
-
*/
|
|
15240
|
-
const padZerosLeft = (num, numDigits) => {
|
|
15241
|
-
// Convert to string
|
|
15242
|
-
let out = String(num);
|
|
15243
|
-
// Add zeros
|
|
15244
|
-
while (out.split('.')[0].length < numDigits) {
|
|
15245
|
-
out = `0${out}`;
|
|
15246
|
-
}
|
|
15247
|
-
// Return
|
|
15248
|
-
return out;
|
|
15249
|
-
};
|
|
15250
|
-
|
|
15251
15453
|
/**
|
|
15252
15454
|
* Stub a server endpoint response
|
|
15253
15455
|
* @author Gabe Abrams
|
|
@@ -16081,6 +16283,27 @@ const shuffleArray = (arr) => {
|
|
|
16081
16283
|
return newArr;
|
|
16082
16284
|
};
|
|
16083
16285
|
|
|
16286
|
+
const punctuationRegex = /[!@#$%^&*(),.?\/;:'"\-\[\]]/g;
|
|
16287
|
+
/**
|
|
16288
|
+
* Get number of words in string
|
|
16289
|
+
* @author Gardenia Liu
|
|
16290
|
+
* @author Allison Zhang
|
|
16291
|
+
* @author Gabe Abrams
|
|
16292
|
+
* @param text the string to check
|
|
16293
|
+
* @returns number of words in the string
|
|
16294
|
+
*/
|
|
16295
|
+
const getWordCount = (text) => {
|
|
16296
|
+
const trimmedTextWithoutPunctuation = (text
|
|
16297
|
+
// Remove leading and trailing whitespace
|
|
16298
|
+
.trim()
|
|
16299
|
+
// Remove punctuation
|
|
16300
|
+
.replace(punctuationRegex, ''));
|
|
16301
|
+
if (trimmedTextWithoutPunctuation.length === 0) {
|
|
16302
|
+
return 0;
|
|
16303
|
+
}
|
|
16304
|
+
return trimmedTextWithoutPunctuation.split(/\s+/g).length;
|
|
16305
|
+
};
|
|
16306
|
+
|
|
16084
16307
|
/**
|
|
16085
16308
|
* Days of the week
|
|
16086
16309
|
* @author Gabe Abrams
|
|
@@ -16097,5 +16320,5 @@ var DayOfWeek;
|
|
|
16097
16320
|
})(DayOfWeek || (DayOfWeek = {}));
|
|
16098
16321
|
var DayOfWeek$1 = DayOfWeek;
|
|
16099
16322
|
|
|
16100
|
-
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, LOG_REVIEW_ROUTE_PATH_PREFIX, LOG_REVIEW_STATUS_ROUTE, LOG_ROUTE_PATH, LoadingSpinner, LogAction$1 as LogAction, LogBuiltInMetadata, LogLevel$1 as LogLevel, 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, addFatalErrorHandler, alert, avg, canReviewLogs, capitalize, ceilToNumDecimals, combineClassNames, compareArraysByProp, confirm, everyAsync, extractProp, filterAsync, floorToNumDecimals, forEachAsync, forceNumIntoBounds, genCSV, genCommaList, getHumanReadableDate, getLocalTimeInfo, getMonthName, getOrdinal, getPartOfDay, getTimeInfoInET, idify, initClient, isMobileOrTablet, leaveToURL, logClientEvent, makeLinksClickable, mapAsync, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, prefixWithAOrAn, prompt, roundToNumDecimals, setClientEventMetadataPopulator, showFatalError, shuffleArray, someAsync, startMinWait, stringsToHumanReadableList, stubServerEndpoint, sum, useForceRender, validateEmail, validatePhoneNumber, validateString, visitServerEndpoint, waitMs };
|
|
16323
|
+
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, LOG_REVIEW_ROUTE_PATH_PREFIX, LOG_REVIEW_STATUS_ROUTE, LOG_ROUTE_PATH, LoadingSpinner, LogAction$1 as LogAction, LogBuiltInMetadata, LogLevel$1 as LogLevel, 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, SimpleTimeChooser, TabBox, ToggleSwitch, Tooltip, Variant$1 as Variant, abbreviate, addFatalErrorHandler, alert, avg, canReviewLogs, capitalize, ceilToNumDecimals, combineClassNames, compareArraysByProp, confirm, everyAsync, extractProp, filterAsync, floorToNumDecimals, forEachAsync, forceNumIntoBounds, genCSV, genCommaList, getHumanReadableDate, getLocalTimeInfo, getMonthName, getOrdinal, getPartOfDay, getTimeInfoInET, getWordCount, idify, initClient, isMobileOrTablet, leaveToURL, logClientEvent, makeLinksClickable, mapAsync, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, prefixWithAOrAn, prompt, roundToNumDecimals, setClientEventMetadataPopulator, showFatalError, shuffleArray, someAsync, startMinWait, stringsToHumanReadableList, stubServerEndpoint, sum, useForceRender, validateEmail, validatePhoneNumber, validateString, visitServerEndpoint, waitMs };
|
|
16101
16324
|
//# sourceMappingURL=index.js.map
|