dce-reactkit 3.7.10-beta.0 → 3.7.10-beta.2

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 CHANGED
@@ -478,7 +478,7 @@ const style$a = `
478
478
  /*------------------------------------------------------------------------*/
479
479
  /* ------------------------------ Component ----------------------------- */
480
480
  /*------------------------------------------------------------------------*/
481
- const Modal = (props) => {
481
+ const Modal$1 = (props) => {
482
482
  /*------------------------------------------------------------------------*/
483
483
  /* -------------------------------- Setup ------------------------------- */
484
484
  /*------------------------------------------------------------------------*/
@@ -574,8 +574,8 @@ const Modal = (props) => {
574
574
  // Render the modal
575
575
  return (React__default["default"].createElement("div", { className: "modal show", tabIndex: -1, style: {
576
576
  zIndex: (onTopOfOtherModals
577
- ? 5000000001
578
- : 5000000000),
577
+ ? 2000000001
578
+ : 2000000000),
579
579
  display: 'block',
580
580
  margin: 'auto',
581
581
  left: 0,
@@ -583,7 +583,7 @@ const Modal = (props) => {
583
583
  } },
584
584
  React__default["default"].createElement("style", null, style$a),
585
585
  React__default["default"].createElement("div", { className: `ModalForWrapper-backdrop ${backdropAnimationClass}`, style: {
586
- zIndex: 5000000003,
586
+ zIndex: 2000000003,
587
587
  }, onClick: () => __awaiter(void 0, void 0, void 0, function* () {
588
588
  // Skip if exit via backdrop not allowed
589
589
  if (dontAllowBackdropExit || !onClose) {
@@ -600,7 +600,7 @@ const Modal = (props) => {
600
600
  handleClose(ModalButtonType$1.Cancel);
601
601
  }) }),
602
602
  React__default["default"].createElement("div", { className: `modal-dialog modal-${size} ${animationClass} modal-dialog-scrollable modal-dialog-centered`, style: {
603
- zIndex: 5000000002,
603
+ zIndex: 2000000002,
604
604
  } },
605
605
  React__default["default"].createElement("div", { className: "modal-content", style: {
606
606
  borderColor: (isDarkModeOn()
@@ -1078,6 +1078,70 @@ const showSessionExpiredMessage = () => __awaiter(void 0, void 0, void 0, functi
1078
1078
  showFatalError('Your session has expired. Please start over.', 'Session Expired');
1079
1079
  }
1080
1080
  });
1081
+ // Stored copies of setters
1082
+ let setModals;
1083
+ // Stored copies of modals
1084
+ let modals = [];
1085
+ /**
1086
+ * Add a modal to the screen
1087
+ * @author Gabe Abrams
1088
+ * @param id the uniqueId of the modal
1089
+ * @param props the props for the modal
1090
+ */
1091
+ const addModal = (id, props) => __awaiter(void 0, void 0, void 0, function* () {
1092
+ // Wait for helper to exist
1093
+ yield waitForHelper(() => {
1094
+ return !!setModals;
1095
+ });
1096
+ // Add modal
1097
+ modals.push({
1098
+ id,
1099
+ props,
1100
+ });
1101
+ // Update modals
1102
+ setModals(modals);
1103
+ });
1104
+ /**
1105
+ * Update a modal on the screen by id (if it exists) with new props
1106
+ * @author Gabe Abrams
1107
+ * @param id the uniqueId of the modal
1108
+ * @param props the new props for the modal
1109
+ */
1110
+ const updateModal = (id, props) => __awaiter(void 0, void 0, void 0, function* () {
1111
+ // Wait for helper to exist
1112
+ yield waitForHelper(() => {
1113
+ return !!setModals;
1114
+ });
1115
+ // Update modal
1116
+ modals = modals.map((modal) => {
1117
+ if (modal.id === id) {
1118
+ return {
1119
+ id,
1120
+ props,
1121
+ };
1122
+ }
1123
+ return modal;
1124
+ });
1125
+ // Update modals
1126
+ setModals(modals);
1127
+ });
1128
+ /**
1129
+ * Remove a modal from the screen by id (if it exists)
1130
+ * @author Gabe Abrams
1131
+ * @param id the uniqueId of the modal
1132
+ */
1133
+ const removeModal = (id) => __awaiter(void 0, void 0, void 0, function* () {
1134
+ // Wait for helper to exist
1135
+ yield waitForHelper(() => {
1136
+ return !!setModals;
1137
+ });
1138
+ // Remove modal
1139
+ modals = modals.filter((modal) => {
1140
+ return modal.id !== id;
1141
+ });
1142
+ // Update modals
1143
+ setModals(modals);
1144
+ });
1081
1145
  /*------------------------------------------------------------------------*/
1082
1146
  /* -------------------------------- Style ------------------------------- */
1083
1147
  /*------------------------------------------------------------------------*/
@@ -1133,6 +1197,7 @@ const AppWrapper = (props) => {
1133
1197
  setSessionHasExpired = setSessionHasExpiredInner;
1134
1198
  // Modals
1135
1199
  const [modalsFromState, setModalsInner,] = React.useState([]);
1200
+ setModals = setModalsInner;
1136
1201
  /*------------------------------------------------------------------------*/
1137
1202
  /* ------------------------------- Render ------------------------------- */
1138
1203
  /*------------------------------------------------------------------------*/
@@ -1143,7 +1208,7 @@ const AppWrapper = (props) => {
1143
1208
  let modal;
1144
1209
  /* -------------- Alert ------------- */
1145
1210
  if (alertInfo) {
1146
- modal = (React__default["default"].createElement(Modal, { key: `alert-${alertInfo.title}-${alertInfo.text}`, title: alertInfo.title, type: ModalType$1.Okay, onClose: () => {
1211
+ modal = (React__default["default"].createElement(Modal$1, { key: `alert-${alertInfo.title}-${alertInfo.text}`, title: alertInfo.title, type: ModalType$1.Okay, onClose: () => {
1147
1212
  // Alert closed
1148
1213
  setAlertInfo(undefined);
1149
1214
  if (onAlertClosed) {
@@ -1153,7 +1218,7 @@ const AppWrapper = (props) => {
1153
1218
  }
1154
1219
  /* ------------- Confirm ------------ */
1155
1220
  if (confirmInfo) {
1156
- modal = (React__default["default"].createElement(Modal, { key: `confirm-${confirmInfo.title}-${confirmInfo.text}`, title: confirmInfo.title, type: ModalType$1.OkayCancel, okayLabel: confirmInfo.opts.confirmButtonText, okayVariant: confirmInfo.opts.confirmButtonVariant, cancelLabel: confirmInfo.opts.cancelButtonText, cancelVariant: confirmInfo.opts.cancelButtonVariant, onClose: (buttonType) => {
1221
+ modal = (React__default["default"].createElement(Modal$1, { key: `confirm-${confirmInfo.title}-${confirmInfo.text}`, title: confirmInfo.title, type: ModalType$1.OkayCancel, okayLabel: confirmInfo.opts.confirmButtonText, okayVariant: confirmInfo.opts.confirmButtonVariant, cancelLabel: confirmInfo.opts.cancelButtonText, cancelVariant: confirmInfo.opts.cancelButtonVariant, onClose: (buttonType) => {
1157
1222
  setConfirmInfo(undefined);
1158
1223
  if (onConfirmClosed) {
1159
1224
  onConfirmClosed(buttonType === ModalButtonType$1.Okay);
@@ -1166,7 +1231,7 @@ const AppWrapper = (props) => {
1166
1231
  // Add custom modals
1167
1232
  modalsFromState.forEach((modalTuple) => {
1168
1233
  var _a;
1169
- customModals.push(React__default["default"].createElement(Modal, Object.assign({ key: String((_a = modalTuple.props.key) !== null && _a !== void 0 ? _a : modalTuple.id) }, modalTuple.props)));
1234
+ customModals.push(React__default["default"].createElement(Modal$1, Object.assign({ key: String((_a = modalTuple.props.key) !== null && _a !== void 0 ? _a : modalTuple.id) }, modalTuple.props)));
1170
1235
  });
1171
1236
  /*----------------------------------------*/
1172
1237
  /* ---------------- Views --------------- */
@@ -1356,6 +1421,71 @@ const LoadingSpinner = () => {
1356
1421
  React__default["default"].createElement(reactFontawesome.FontAwesomeIcon, { icon: freeSolidSvgIcons.faCircle, className: "LoadingSpinner-blip-4" })));
1357
1422
  };
1358
1423
 
1424
+ /**
1425
+ * General use modal component
1426
+ * @author Gabe Abrams
1427
+ */
1428
+ /*------------------------------------------------------------------------*/
1429
+ /* --------------------------- Static Helpers --------------------------- */
1430
+ /*------------------------------------------------------------------------*/
1431
+ // Next unique id
1432
+ let nextUniqueId = 0;
1433
+ /**
1434
+ * Get a new unique id for this modal
1435
+ * @author Gabe Abrams
1436
+ * @returns new unique id
1437
+ */
1438
+ const getNextUniqueId = () => {
1439
+ // eslint-disable-next-line no-plusplus
1440
+ return nextUniqueId++;
1441
+ };
1442
+ /*------------------------------------------------------------------------*/
1443
+ /* ------------------------------ Component ----------------------------- */
1444
+ /*------------------------------------------------------------------------*/
1445
+ const Modal = (props) => {
1446
+ /*------------------------------------------------------------------------*/
1447
+ /* -------------------------------- Setup ------------------------------- */
1448
+ /*------------------------------------------------------------------------*/
1449
+ /* -------------- Refs -------------- */
1450
+ // Initialize refs
1451
+ const id = React.useRef(getNextUniqueId());
1452
+ /*------------------------------------------------------------------------*/
1453
+ /* ------------------------- Lifecycle Functions ------------------------ */
1454
+ /*------------------------------------------------------------------------*/
1455
+ /**
1456
+ * Mount: add to app wrapper
1457
+ * @author Gabe Abrams
1458
+ */
1459
+ React.useEffect(() => {
1460
+ addModal(id.current, props);
1461
+ }, []);
1462
+ /**
1463
+ * Update: update modal props in app wrapper when props change
1464
+ * @author Gabe Abrams
1465
+ */
1466
+ React.useEffect(() => {
1467
+ // Update modal props
1468
+ updateModal(id.current, props);
1469
+ }, [props]);
1470
+ /**
1471
+ * Unmount: remove from app wrapper when unmounting
1472
+ * @author Gabe Abrams
1473
+ */
1474
+ React.useEffect(() => {
1475
+ return () => {
1476
+ // Remove modal
1477
+ removeModal(id.current);
1478
+ };
1479
+ }, []);
1480
+ /*------------------------------------------------------------------------*/
1481
+ /* ------------------------------- Render ------------------------------- */
1482
+ /*------------------------------------------------------------------------*/
1483
+ /*----------------------------------------*/
1484
+ /* --------------- Main UI -------------- */
1485
+ /*----------------------------------------*/
1486
+ return (React__default["default"].createElement("div", { className: "Modal-shell d-none" }));
1487
+ };
1488
+
1359
1489
  /**
1360
1490
  * A box with a tab on the top that holds buttons and other content
1361
1491
  * @author Gabe Abrams
@@ -2796,7 +2926,7 @@ const IntelliTable = (props) => {
2796
2926
  /* ------- Col Vis Customization Modal ------ */
2797
2927
  if (columnVisibilityCustomizationModalVisible) {
2798
2928
  // Create modal
2799
- modal = (React__default["default"].createElement(Modal, { type: ModalType$1.Okay, title: "Choose columns to show:", onClose: () => {
2929
+ modal = (React__default["default"].createElement(Modal$1, { type: ModalType$1.Okay, title: "Choose columns to show:", onClose: () => {
2800
2930
  const noColumnsSelected = (Object.values(columnVisibilityMap)
2801
2931
  .every((isSelected) => {
2802
2932
  return !isSelected;