@carbonorm/carbonreact 3.5.3 → 3.6.0
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/compileValidSQL.cjs +1 -1
- package/compileValidSQL.tsx +1 -1
- package/dist/CarbonReact.d.ts +5 -5
- package/dist/components/WebSocket/CarbonWebSocket.d.ts +2 -2
- package/dist/index.cjs.css +20 -31
- package/dist/index.cjs.css.map +1 -1
- package/dist/index.cjs.js +30 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.css +20 -31
- package/dist/index.esm.css.map +1 -1
- package/dist/index.esm.js +31 -7
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/CarbonReact.tsx +20 -8
- package/src/components/WebSocket/CarbonWebSocket.tsx +7 -7
- package/src/hoc/changed.tsx +1 -0
- package/src/variables/bootstrap.module.css +20 -31
- package/src/variables/bootstrap.module.css.map +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import react, { useRef, useState, useEffect, Component, lazy } from 'react';
|
|
1
|
+
import react, { useRef, useState, useEffect, Component, createContext, lazy } from 'react';
|
|
2
2
|
import { toastOptions, clearCache, timeout, axiosInstance, isVerbose, checkAllRequestsComplete } from '@carbonorm/carbonnode';
|
|
3
3
|
import { useNavigate } from 'react-router-dom';
|
|
4
4
|
import { toast, ToastContainer } from 'react-toastify';
|
|
@@ -1221,6 +1221,7 @@ function validateFragmentProps(fragment) {
|
|
|
1221
1221
|
}
|
|
1222
1222
|
}
|
|
1223
1223
|
|
|
1224
|
+
var didWarnAboutKeySpread = {};
|
|
1224
1225
|
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
1225
1226
|
{
|
|
1226
1227
|
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
|
@@ -1291,6 +1292,24 @@ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
|
1291
1292
|
}
|
|
1292
1293
|
}
|
|
1293
1294
|
|
|
1295
|
+
{
|
|
1296
|
+
if (hasOwnProperty.call(props, 'key')) {
|
|
1297
|
+
var componentName = getComponentNameFromType(type);
|
|
1298
|
+
var keys = Object.keys(props).filter(function (k) {
|
|
1299
|
+
return k !== 'key';
|
|
1300
|
+
});
|
|
1301
|
+
var beforeExample = keys.length > 0 ? '{key: someKey, ' + keys.join(': ..., ') + ': ...}' : '{key: someKey}';
|
|
1302
|
+
|
|
1303
|
+
if (!didWarnAboutKeySpread[componentName + beforeExample]) {
|
|
1304
|
+
var afterExample = keys.length > 0 ? '{' + keys.join(': ..., ') + ': ...}' : '{}';
|
|
1305
|
+
|
|
1306
|
+
error('A props object containing a "key" prop is being spread into JSX:\n' + ' let props = %s;\n' + ' <%s {...props} />\n' + 'React keys must be passed directly to JSX without using spread:\n' + ' let props = %s;\n' + ' <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);
|
|
1307
|
+
|
|
1308
|
+
didWarnAboutKeySpread[componentName + beforeExample] = true;
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1294
1313
|
if (type === REACT_FRAGMENT_TYPE) {
|
|
1295
1314
|
validateFragmentProps(element);
|
|
1296
1315
|
} else {
|
|
@@ -4043,7 +4062,7 @@ const useEffectOnce = (effect) => {
|
|
|
4043
4062
|
* @function connect
|
|
4044
4063
|
* This function establishes a connection with the websocket and also ensures constant reconnection if connection closes
|
|
4045
4064
|
**/
|
|
4046
|
-
function initiateWebsocket({ TABLES = undefined, WsLiveUpdates = undefined, url = 'ws://
|
|
4065
|
+
function initiateWebsocket({ TABLES = undefined, WsLiveUpdates = undefined, url = 'ws' + (window.location.protocol === 'https:' ? 's' : '') + '://' + window.location.host + '/carbonorm/websocket', timeoutSeconds = 250, heartbeatSeconds = 60 } = {}) {
|
|
4047
4066
|
const { websocket } = CarbonReact.instance.state;
|
|
4048
4067
|
if (!("WebSocket" in window)) {
|
|
4049
4068
|
// todo - store that this has been shown in the state
|
|
@@ -4136,8 +4155,9 @@ function initiateWebsocket({ TABLES = undefined, WsLiveUpdates = undefined, url
|
|
|
4136
4155
|
...REQUEST
|
|
4137
4156
|
};
|
|
4138
4157
|
});
|
|
4139
|
-
|
|
4140
|
-
|
|
4158
|
+
updatedElements.forEach((row) => {
|
|
4159
|
+
WsLiveUpdates[TABLE_NAME_SHORT][METHOD]({}, row);
|
|
4160
|
+
});
|
|
4141
4161
|
}
|
|
4142
4162
|
});
|
|
4143
4163
|
};
|
|
@@ -4234,8 +4254,10 @@ function isJsonString(str) {
|
|
|
4234
4254
|
}
|
|
4235
4255
|
return true;
|
|
4236
4256
|
}
|
|
4257
|
+
// Create a context
|
|
4237
4258
|
const CarbonReact = class extends Component {
|
|
4238
4259
|
static instance;
|
|
4260
|
+
context = createContext(this.state);
|
|
4239
4261
|
static persistentState = undefined;
|
|
4240
4262
|
static lastLocation = window.location.pathname;
|
|
4241
4263
|
// @link https://github.com/welldone-software/why-did-you-render
|
|
@@ -4243,6 +4265,7 @@ const CarbonReact = class extends Component {
|
|
|
4243
4265
|
static whyDidYouRender = true;
|
|
4244
4266
|
constructor(props) {
|
|
4245
4267
|
super(props);
|
|
4268
|
+
console.log('CarbonORM TSX CONSTRUCTOR');
|
|
4246
4269
|
if (CarbonReact.persistentState !== undefined && this.props.shouldStatePersist !== false) {
|
|
4247
4270
|
this.state = CarbonReact.persistentState;
|
|
4248
4271
|
}
|
|
@@ -4270,8 +4293,8 @@ const CarbonReact = class extends Component {
|
|
|
4270
4293
|
else {
|
|
4271
4294
|
CarbonReact.persistentState = nextState;
|
|
4272
4295
|
}
|
|
4273
|
-
changed(this.constructor.name + ' (
|
|
4274
|
-
changed(this.constructor.name + ' (
|
|
4296
|
+
changed(this.constructor.name + ' (C6Api)', 'props', this.props, nextProps);
|
|
4297
|
+
changed(this.constructor.name + ' (C6Api)', 'state', this.state, nextState);
|
|
4275
4298
|
return true;
|
|
4276
4299
|
}
|
|
4277
4300
|
componentDidUpdate(_prevProps, _prevState, _snapshot) {
|
|
@@ -4292,7 +4315,8 @@ const CarbonReact = class extends Component {
|
|
|
4292
4315
|
if (this.state.backendThrowable.length > 0) {
|
|
4293
4316
|
return jsxRuntime_2(jsxRuntime_3, { children: [nest, jsxRuntime_1(BackendThrowable, {})] });
|
|
4294
4317
|
}
|
|
4295
|
-
|
|
4318
|
+
const Context = this.context.Provider;
|
|
4319
|
+
return jsxRuntime_2(jsxRuntime_3, { children: [jsxRuntime_1(GlobalHistory, {}), jsxRuntime_1(CarbonWebSocket, {}), jsxRuntime_1(Context, { value: this.state, children: this.props.children }), jsxRuntime_1(ToastContainer, {})] });
|
|
4296
4320
|
}
|
|
4297
4321
|
};
|
|
4298
4322
|
|