@carbonorm/carbonreact 3.4.7 → 3.4.8
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/README.md +225 -8
- package/dist/CarbonReact.d.ts +8 -3
- package/dist/index.cjs.js +15 -10
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +16 -11
- package/dist/index.esm.js.map +1 -1
- package/package.json +6 -5
- package/src/CarbonReact.tsx +27 -11
- package/src/components/Popup/Popup.tsx +1 -8
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import react, { useRef, useState, useEffect, Component, lazy } from 'react';
|
|
2
2
|
import { toastOptions, clearCache, timeout, axiosInstance, isVerbose, checkAllRequestsComplete } from '@carbonorm/carbonnode';
|
|
3
|
-
import { useNavigate
|
|
3
|
+
import { useNavigate } from 'react-router-dom';
|
|
4
4
|
import { toast, ToastContainer } from 'react-toastify';
|
|
5
5
|
import OutsideClickHandler from 'react-outside-click-handler';
|
|
6
6
|
import classNames from 'classnames';
|
|
@@ -3896,12 +3896,8 @@ function getStyles(overrides = {}) {
|
|
|
3896
3896
|
|
|
3897
3897
|
// @link https://stackoverflow.com/questions/58399637/include-modal-functionality-in-react-higher-order-component
|
|
3898
3898
|
function Popup({ open = true, handleClose, children, maxWidth, }) {
|
|
3899
|
-
if (false === open) {
|
|
3900
|
-
// @link https://legacy.reactjs.org/docs/conditional-rendering.html#preventing-component-from-rendering
|
|
3901
|
-
return jsxRuntime_1(jsxRuntime_3, {});
|
|
3902
|
-
}
|
|
3903
3899
|
const dig = getStyles();
|
|
3904
|
-
return jsxRuntime_1("div", { className: classNames(dig.modal, dig.fade, dig.show, dig.dBlock), style: { backgroundColor: "rgba(0,0,0,0.8)" }, id: "exampleModalCenter", tabIndex: -1, "aria-labelledby": "exampleModalCenterTitle", "aria-modal": "true", role: "dialog", children: jsxRuntime_1("div", { style: { maxWidth: maxWidth }, className: classNames(dig.modalDialog, dig.modalDialogCentered), children: jsxRuntime_1(OutsideClickHandler, { onOutsideClick: () => handleClose(), children: jsxRuntime_1("div", { className: classNames(dig.modalContent, dig.bgTransparent, dig.modalDialogScrollable), children: children }) }) }) });
|
|
3900
|
+
return jsxRuntime_1("div", { className: classNames(dig.modal, dig.fade, { [dig.show]: open }, dig.dBlock), style: { backgroundColor: "rgba(0,0,0,0.8)" }, id: "exampleModalCenter", tabIndex: -1, "aria-labelledby": "exampleModalCenterTitle", "aria-modal": "true", role: "dialog", children: jsxRuntime_1("div", { style: { maxWidth: maxWidth }, className: classNames(dig.modalDialog, dig.modalDialogCentered), children: jsxRuntime_1(OutsideClickHandler, { onOutsideClick: () => handleClose(), children: jsxRuntime_1("div", { className: classNames(dig.modalContent, dig.bgTransparent, dig.modalDialogScrollable), children: children }) }) }) });
|
|
3905
3901
|
}
|
|
3906
3902
|
|
|
3907
3903
|
const isProduction = window.location.host.split(".")[0] === "www";
|
|
@@ -4189,16 +4185,19 @@ function isJsonString(str) {
|
|
|
4189
4185
|
}
|
|
4190
4186
|
const CarbonReact = class extends Component {
|
|
4191
4187
|
static instance;
|
|
4188
|
+
static persistentState = undefined;
|
|
4192
4189
|
static lastLocation = window.location.pathname;
|
|
4193
|
-
static websocketUrl = (window.location.protocol === 'https:' ? 'wss://' : 'ws://') + window.location.host + ':8888/ws';
|
|
4194
|
-
static websocketTimeoutSeconds = 250;
|
|
4195
|
-
static websocketHeartbeatSeconds = 250;
|
|
4196
4190
|
// @link https://github.com/welldone-software/why-did-you-render
|
|
4197
4191
|
// noinspection JSUnusedGlobalSymbols
|
|
4198
4192
|
static whyDidYouRender = true;
|
|
4199
4193
|
constructor(props) {
|
|
4200
4194
|
super(props);
|
|
4201
|
-
this.
|
|
4195
|
+
if (CarbonReact.persistentState !== undefined && this.props.shouldStatePersist !== false) {
|
|
4196
|
+
this.state = CarbonReact.persistentState;
|
|
4197
|
+
}
|
|
4198
|
+
else {
|
|
4199
|
+
this.state = initialCarbonReactState;
|
|
4200
|
+
}
|
|
4202
4201
|
// This should only ever be done here, when the full state is being trashed.
|
|
4203
4202
|
clearCache({
|
|
4204
4203
|
ignoreWarning: true
|
|
@@ -4214,6 +4213,12 @@ const CarbonReact = class extends Component {
|
|
|
4214
4213
|
return CarbonReact.instance.state;
|
|
4215
4214
|
}
|
|
4216
4215
|
shouldComponentUpdate(nextProps, nextState, _nextContext) {
|
|
4216
|
+
if (this.props.shouldStatePersist === false) {
|
|
4217
|
+
CarbonReact.persistentState = undefined;
|
|
4218
|
+
}
|
|
4219
|
+
else {
|
|
4220
|
+
CarbonReact.persistentState = nextState;
|
|
4221
|
+
}
|
|
4217
4222
|
changed(this.constructor.name + ' (DigApi)', 'props', this.props, nextProps);
|
|
4218
4223
|
changed(this.constructor.name + ' (DigApi)', 'state', this.state, nextState);
|
|
4219
4224
|
return true;
|
|
@@ -4236,7 +4241,7 @@ const CarbonReact = class extends Component {
|
|
|
4236
4241
|
if (this.state.backendThrowable.length > 0) {
|
|
4237
4242
|
return jsxRuntime_2(jsxRuntime_3, { children: [nest, jsxRuntime_1(BackendThrowable, {})] });
|
|
4238
4243
|
}
|
|
4239
|
-
return jsxRuntime_2(
|
|
4244
|
+
return jsxRuntime_2(jsxRuntime_3, { children: [jsxRuntime_1(GlobalHistory, {}), jsxRuntime_1(CarbonWebSocket, {}), this.props.children, jsxRuntime_1(ToastContainer, {})] });
|
|
4240
4245
|
}
|
|
4241
4246
|
};
|
|
4242
4247
|
|