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 +139 -9
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/index.d.ts +1 -1
- package/dist/esm/index.js +139 -9
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/index.d.ts +1 -1
- package/dist/index.d.ts +1 -2
- package/package.json +1 -1
- package/src/components/AppWrapper.tsx +6 -6
- package/src/components/Modal/ModalForWrapper.tsx +4 -4
- package/src/index.ts +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import AppWrapper, { alert, confirm, showFatalError, addFatalErrorHandler, leaveToURL } from './components/AppWrapper';
|
|
2
2
|
import LoadingSpinner from './components/LoadingSpinner';
|
|
3
3
|
import ErrorBox from './components/ErrorBox';
|
|
4
|
-
import Modal from './components/Modal
|
|
4
|
+
import Modal from './components/Modal';
|
|
5
5
|
import TabBox from './components/TabBox';
|
|
6
6
|
import RadioButton from './components/RadioButton';
|
|
7
7
|
import CheckboxButton from './components/CheckboxButton';
|
package/dist/esm/index.js
CHANGED
|
@@ -452,7 +452,7 @@ const style$a = `
|
|
|
452
452
|
/*------------------------------------------------------------------------*/
|
|
453
453
|
/* ------------------------------ Component ----------------------------- */
|
|
454
454
|
/*------------------------------------------------------------------------*/
|
|
455
|
-
const Modal = (props) => {
|
|
455
|
+
const Modal$1 = (props) => {
|
|
456
456
|
/*------------------------------------------------------------------------*/
|
|
457
457
|
/* -------------------------------- Setup ------------------------------- */
|
|
458
458
|
/*------------------------------------------------------------------------*/
|
|
@@ -548,8 +548,8 @@ const Modal = (props) => {
|
|
|
548
548
|
// Render the modal
|
|
549
549
|
return (React__default.createElement("div", { className: "modal show", tabIndex: -1, style: {
|
|
550
550
|
zIndex: (onTopOfOtherModals
|
|
551
|
-
?
|
|
552
|
-
:
|
|
551
|
+
? 2000000001
|
|
552
|
+
: 2000000000),
|
|
553
553
|
display: 'block',
|
|
554
554
|
margin: 'auto',
|
|
555
555
|
left: 0,
|
|
@@ -557,7 +557,7 @@ const Modal = (props) => {
|
|
|
557
557
|
} },
|
|
558
558
|
React__default.createElement("style", null, style$a),
|
|
559
559
|
React__default.createElement("div", { className: `ModalForWrapper-backdrop ${backdropAnimationClass}`, style: {
|
|
560
|
-
zIndex:
|
|
560
|
+
zIndex: 2000000003,
|
|
561
561
|
}, onClick: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
562
562
|
// Skip if exit via backdrop not allowed
|
|
563
563
|
if (dontAllowBackdropExit || !onClose) {
|
|
@@ -574,7 +574,7 @@ const Modal = (props) => {
|
|
|
574
574
|
handleClose(ModalButtonType$1.Cancel);
|
|
575
575
|
}) }),
|
|
576
576
|
React__default.createElement("div", { className: `modal-dialog modal-${size} ${animationClass} modal-dialog-scrollable modal-dialog-centered`, style: {
|
|
577
|
-
zIndex:
|
|
577
|
+
zIndex: 2000000002,
|
|
578
578
|
} },
|
|
579
579
|
React__default.createElement("div", { className: "modal-content", style: {
|
|
580
580
|
borderColor: (isDarkModeOn()
|
|
@@ -1052,6 +1052,70 @@ const showSessionExpiredMessage = () => __awaiter(void 0, void 0, void 0, functi
|
|
|
1052
1052
|
showFatalError('Your session has expired. Please start over.', 'Session Expired');
|
|
1053
1053
|
}
|
|
1054
1054
|
});
|
|
1055
|
+
// Stored copies of setters
|
|
1056
|
+
let setModals;
|
|
1057
|
+
// Stored copies of modals
|
|
1058
|
+
let modals = [];
|
|
1059
|
+
/**
|
|
1060
|
+
* Add a modal to the screen
|
|
1061
|
+
* @author Gabe Abrams
|
|
1062
|
+
* @param id the uniqueId of the modal
|
|
1063
|
+
* @param props the props for the modal
|
|
1064
|
+
*/
|
|
1065
|
+
const addModal = (id, props) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1066
|
+
// Wait for helper to exist
|
|
1067
|
+
yield waitForHelper(() => {
|
|
1068
|
+
return !!setModals;
|
|
1069
|
+
});
|
|
1070
|
+
// Add modal
|
|
1071
|
+
modals.push({
|
|
1072
|
+
id,
|
|
1073
|
+
props,
|
|
1074
|
+
});
|
|
1075
|
+
// Update modals
|
|
1076
|
+
setModals(modals);
|
|
1077
|
+
});
|
|
1078
|
+
/**
|
|
1079
|
+
* Update a modal on the screen by id (if it exists) with new props
|
|
1080
|
+
* @author Gabe Abrams
|
|
1081
|
+
* @param id the uniqueId of the modal
|
|
1082
|
+
* @param props the new props for the modal
|
|
1083
|
+
*/
|
|
1084
|
+
const updateModal = (id, props) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1085
|
+
// Wait for helper to exist
|
|
1086
|
+
yield waitForHelper(() => {
|
|
1087
|
+
return !!setModals;
|
|
1088
|
+
});
|
|
1089
|
+
// Update modal
|
|
1090
|
+
modals = modals.map((modal) => {
|
|
1091
|
+
if (modal.id === id) {
|
|
1092
|
+
return {
|
|
1093
|
+
id,
|
|
1094
|
+
props,
|
|
1095
|
+
};
|
|
1096
|
+
}
|
|
1097
|
+
return modal;
|
|
1098
|
+
});
|
|
1099
|
+
// Update modals
|
|
1100
|
+
setModals(modals);
|
|
1101
|
+
});
|
|
1102
|
+
/**
|
|
1103
|
+
* Remove a modal from the screen by id (if it exists)
|
|
1104
|
+
* @author Gabe Abrams
|
|
1105
|
+
* @param id the uniqueId of the modal
|
|
1106
|
+
*/
|
|
1107
|
+
const removeModal = (id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1108
|
+
// Wait for helper to exist
|
|
1109
|
+
yield waitForHelper(() => {
|
|
1110
|
+
return !!setModals;
|
|
1111
|
+
});
|
|
1112
|
+
// Remove modal
|
|
1113
|
+
modals = modals.filter((modal) => {
|
|
1114
|
+
return modal.id !== id;
|
|
1115
|
+
});
|
|
1116
|
+
// Update modals
|
|
1117
|
+
setModals(modals);
|
|
1118
|
+
});
|
|
1055
1119
|
/*------------------------------------------------------------------------*/
|
|
1056
1120
|
/* -------------------------------- Style ------------------------------- */
|
|
1057
1121
|
/*------------------------------------------------------------------------*/
|
|
@@ -1107,6 +1171,7 @@ const AppWrapper = (props) => {
|
|
|
1107
1171
|
setSessionHasExpired = setSessionHasExpiredInner;
|
|
1108
1172
|
// Modals
|
|
1109
1173
|
const [modalsFromState, setModalsInner,] = useState([]);
|
|
1174
|
+
setModals = setModalsInner;
|
|
1110
1175
|
/*------------------------------------------------------------------------*/
|
|
1111
1176
|
/* ------------------------------- Render ------------------------------- */
|
|
1112
1177
|
/*------------------------------------------------------------------------*/
|
|
@@ -1117,7 +1182,7 @@ const AppWrapper = (props) => {
|
|
|
1117
1182
|
let modal;
|
|
1118
1183
|
/* -------------- Alert ------------- */
|
|
1119
1184
|
if (alertInfo) {
|
|
1120
|
-
modal = (React__default.createElement(Modal, { key: `alert-${alertInfo.title}-${alertInfo.text}`, title: alertInfo.title, type: ModalType$1.Okay, onClose: () => {
|
|
1185
|
+
modal = (React__default.createElement(Modal$1, { key: `alert-${alertInfo.title}-${alertInfo.text}`, title: alertInfo.title, type: ModalType$1.Okay, onClose: () => {
|
|
1121
1186
|
// Alert closed
|
|
1122
1187
|
setAlertInfo(undefined);
|
|
1123
1188
|
if (onAlertClosed) {
|
|
@@ -1127,7 +1192,7 @@ const AppWrapper = (props) => {
|
|
|
1127
1192
|
}
|
|
1128
1193
|
/* ------------- Confirm ------------ */
|
|
1129
1194
|
if (confirmInfo) {
|
|
1130
|
-
modal = (React__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) => {
|
|
1195
|
+
modal = (React__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) => {
|
|
1131
1196
|
setConfirmInfo(undefined);
|
|
1132
1197
|
if (onConfirmClosed) {
|
|
1133
1198
|
onConfirmClosed(buttonType === ModalButtonType$1.Okay);
|
|
@@ -1140,7 +1205,7 @@ const AppWrapper = (props) => {
|
|
|
1140
1205
|
// Add custom modals
|
|
1141
1206
|
modalsFromState.forEach((modalTuple) => {
|
|
1142
1207
|
var _a;
|
|
1143
|
-
customModals.push(React__default.createElement(Modal, Object.assign({ key: String((_a = modalTuple.props.key) !== null && _a !== void 0 ? _a : modalTuple.id) }, modalTuple.props)));
|
|
1208
|
+
customModals.push(React__default.createElement(Modal$1, Object.assign({ key: String((_a = modalTuple.props.key) !== null && _a !== void 0 ? _a : modalTuple.id) }, modalTuple.props)));
|
|
1144
1209
|
});
|
|
1145
1210
|
/*----------------------------------------*/
|
|
1146
1211
|
/* ---------------- Views --------------- */
|
|
@@ -1330,6 +1395,71 @@ const LoadingSpinner = () => {
|
|
|
1330
1395
|
React__default.createElement(FontAwesomeIcon, { icon: faCircle, className: "LoadingSpinner-blip-4" })));
|
|
1331
1396
|
};
|
|
1332
1397
|
|
|
1398
|
+
/**
|
|
1399
|
+
* General use modal component
|
|
1400
|
+
* @author Gabe Abrams
|
|
1401
|
+
*/
|
|
1402
|
+
/*------------------------------------------------------------------------*/
|
|
1403
|
+
/* --------------------------- Static Helpers --------------------------- */
|
|
1404
|
+
/*------------------------------------------------------------------------*/
|
|
1405
|
+
// Next unique id
|
|
1406
|
+
let nextUniqueId = 0;
|
|
1407
|
+
/**
|
|
1408
|
+
* Get a new unique id for this modal
|
|
1409
|
+
* @author Gabe Abrams
|
|
1410
|
+
* @returns new unique id
|
|
1411
|
+
*/
|
|
1412
|
+
const getNextUniqueId = () => {
|
|
1413
|
+
// eslint-disable-next-line no-plusplus
|
|
1414
|
+
return nextUniqueId++;
|
|
1415
|
+
};
|
|
1416
|
+
/*------------------------------------------------------------------------*/
|
|
1417
|
+
/* ------------------------------ Component ----------------------------- */
|
|
1418
|
+
/*------------------------------------------------------------------------*/
|
|
1419
|
+
const Modal = (props) => {
|
|
1420
|
+
/*------------------------------------------------------------------------*/
|
|
1421
|
+
/* -------------------------------- Setup ------------------------------- */
|
|
1422
|
+
/*------------------------------------------------------------------------*/
|
|
1423
|
+
/* -------------- Refs -------------- */
|
|
1424
|
+
// Initialize refs
|
|
1425
|
+
const id = useRef(getNextUniqueId());
|
|
1426
|
+
/*------------------------------------------------------------------------*/
|
|
1427
|
+
/* ------------------------- Lifecycle Functions ------------------------ */
|
|
1428
|
+
/*------------------------------------------------------------------------*/
|
|
1429
|
+
/**
|
|
1430
|
+
* Mount: add to app wrapper
|
|
1431
|
+
* @author Gabe Abrams
|
|
1432
|
+
*/
|
|
1433
|
+
useEffect(() => {
|
|
1434
|
+
addModal(id.current, props);
|
|
1435
|
+
}, []);
|
|
1436
|
+
/**
|
|
1437
|
+
* Update: update modal props in app wrapper when props change
|
|
1438
|
+
* @author Gabe Abrams
|
|
1439
|
+
*/
|
|
1440
|
+
useEffect(() => {
|
|
1441
|
+
// Update modal props
|
|
1442
|
+
updateModal(id.current, props);
|
|
1443
|
+
}, [props]);
|
|
1444
|
+
/**
|
|
1445
|
+
* Unmount: remove from app wrapper when unmounting
|
|
1446
|
+
* @author Gabe Abrams
|
|
1447
|
+
*/
|
|
1448
|
+
useEffect(() => {
|
|
1449
|
+
return () => {
|
|
1450
|
+
// Remove modal
|
|
1451
|
+
removeModal(id.current);
|
|
1452
|
+
};
|
|
1453
|
+
}, []);
|
|
1454
|
+
/*------------------------------------------------------------------------*/
|
|
1455
|
+
/* ------------------------------- Render ------------------------------- */
|
|
1456
|
+
/*------------------------------------------------------------------------*/
|
|
1457
|
+
/*----------------------------------------*/
|
|
1458
|
+
/* --------------- Main UI -------------- */
|
|
1459
|
+
/*----------------------------------------*/
|
|
1460
|
+
return (React__default.createElement("div", { className: "Modal-shell d-none" }));
|
|
1461
|
+
};
|
|
1462
|
+
|
|
1333
1463
|
/**
|
|
1334
1464
|
* A box with a tab on the top that holds buttons and other content
|
|
1335
1465
|
* @author Gabe Abrams
|
|
@@ -2770,7 +2900,7 @@ const IntelliTable = (props) => {
|
|
|
2770
2900
|
/* ------- Col Vis Customization Modal ------ */
|
|
2771
2901
|
if (columnVisibilityCustomizationModalVisible) {
|
|
2772
2902
|
// Create modal
|
|
2773
|
-
modal = (React__default.createElement(Modal, { type: ModalType$1.Okay, title: "Choose columns to show:", onClose: () => {
|
|
2903
|
+
modal = (React__default.createElement(Modal$1, { type: ModalType$1.Okay, title: "Choose columns to show:", onClose: () => {
|
|
2774
2904
|
const noColumnsSelected = (Object.values(columnVisibilityMap)
|
|
2775
2905
|
.every((isSelected) => {
|
|
2776
2906
|
return !isSelected;
|