@carbonorm/carbonreact 4.0.16 → 4.0.18
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/CarbonReact.d.ts +7 -0
- package/dist/index.cjs.js +21 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +23 -4
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/CarbonReact.tsx +36 -14
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import react, { useRef, useState, useEffect, Component, createContext, lazy } from 'react';
|
|
2
|
-
import { useNavigate } from 'react-router-dom';
|
|
2
|
+
import { useNavigate, HashRouter, MemoryRouter, BrowserRouter } from 'react-router-dom';
|
|
3
3
|
import { toast, ToastContainer } from 'react-toastify';
|
|
4
4
|
import OutsideClickHandler from 'react-outside-click-handler';
|
|
5
5
|
import { toastOptions, timeout, axiosInstance, isVerbose, checkAllRequestsComplete } from '@carbonorm/carbonnode';
|
|
@@ -4369,6 +4369,12 @@ function isJsonString(str) {
|
|
|
4369
4369
|
}
|
|
4370
4370
|
return true;
|
|
4371
4371
|
}
|
|
4372
|
+
var eRouterType;
|
|
4373
|
+
(function (eRouterType) {
|
|
4374
|
+
eRouterType[eRouterType["BrowserRouter"] = 0] = "BrowserRouter";
|
|
4375
|
+
eRouterType[eRouterType["HashRouter"] = 1] = "HashRouter";
|
|
4376
|
+
eRouterType[eRouterType["MemoryRouter"] = 2] = "MemoryRouter";
|
|
4377
|
+
})(eRouterType || (eRouterType = {}));
|
|
4372
4378
|
class CarbonReact extends Component {
|
|
4373
4379
|
static allInstances = new Map();
|
|
4374
4380
|
context = createContext(this.state);
|
|
@@ -4443,6 +4449,18 @@ class CarbonReact extends Component {
|
|
|
4443
4449
|
}
|
|
4444
4450
|
}
|
|
4445
4451
|
}
|
|
4452
|
+
reactRouterContext(children) {
|
|
4453
|
+
switch (this.props.routerType) {
|
|
4454
|
+
case eRouterType.BrowserRouter:
|
|
4455
|
+
return jsxRuntime_1(BrowserRouter, { children: children });
|
|
4456
|
+
case eRouterType.MemoryRouter:
|
|
4457
|
+
return jsxRuntime_1(MemoryRouter, { initialEntries: ['/'], children: children });
|
|
4458
|
+
case eRouterType.HashRouter:
|
|
4459
|
+
return jsxRuntime_1(HashRouter, { children: children });
|
|
4460
|
+
default:
|
|
4461
|
+
throw new Error('Invalid routerType');
|
|
4462
|
+
}
|
|
4463
|
+
}
|
|
4446
4464
|
render() {
|
|
4447
4465
|
console.log('CarbonORM TSX RENDER');
|
|
4448
4466
|
const colorHex = '#' + Math.random().toString(16).slice(-6);
|
|
@@ -4451,9 +4469,10 @@ class CarbonReact extends Component {
|
|
|
4451
4469
|
if (this.state.backendThrowable.length > 0) {
|
|
4452
4470
|
return jsxRuntime_2(jsxRuntime_3, { children: [nest, jsxRuntime_1(BackendThrowable, { instance: this })] });
|
|
4453
4471
|
}
|
|
4472
|
+
this.context = createContext(this.state);
|
|
4454
4473
|
const Context = this.context.Provider;
|
|
4455
|
-
return jsxRuntime_2(jsxRuntime_3, { children: [jsxRuntime_1(GlobalHistory, {}), this.props.websocket &&
|
|
4456
|
-
jsxRuntime_1(CarbonWebSocket, { ...(false !== this.props.websocket ? this.props.websocket : {}), instance: this }), jsxRuntime_1(Context, { value: this.state, children: this.props.children }), jsxRuntime_1(ToastContainer, {})] });
|
|
4474
|
+
return this.reactRouterContext(jsxRuntime_2(jsxRuntime_3, { children: [jsxRuntime_1(GlobalHistory, {}), this.props.websocket &&
|
|
4475
|
+
jsxRuntime_1(CarbonWebSocket, { ...(false !== this.props.websocket ? this.props.websocket : {}), instance: this }), jsxRuntime_1(Context, { value: this.state, children: this.props.children }), jsxRuntime_1(ToastContainer, {})] }));
|
|
4457
4476
|
}
|
|
4458
4477
|
}
|
|
4459
4478
|
|
|
@@ -4749,5 +4768,5 @@ function useWindowDimensions() {
|
|
|
4749
4768
|
return windowDimensions;
|
|
4750
4769
|
}
|
|
4751
4770
|
|
|
4752
|
-
export { AccessDenied, Alert, BackendThrowable, C6, COLUMNS, CarbonReact, CarbonWebSocket, ErrorHttpCode, GlobalHistory, Loading, Nest, PageNotFound, Popup, TABLES, addAlert, addValidSQL$1 as addValidSQL, carbons, changed, comments, deleteRestfulObjectArrays, documentation, eUpdateInsertMethod, feature_group_references, features, getRootStyleValue, getStatefulObjectWithWhere, getStyles, globalNavigate, group_references, groups, hexToRgb, history_logs, initialCarbonReactState, initialRequiredCarbonORMState, initialRestfulObjectsState, initiateWebsocket, isEdgeBrowser, isJsonString, isProduction, location_references, locations, parseMultipleJson, photos, range, reports, ScrollIntoViewDirective as scrollIntoView, setCookies, setUrl, setupTests, toDataURL, updateRestfulObjectArrays, uploadImage, uploadImageChange, useEffectOnce, user_followers, user_groups, user_messages, user_sessions, user_tasks, users, ValidSQL as validSQL, watchInputElementChangeEvent, useWindowDimensions as windowDimensions, wp_commentmeta, wp_comments, wp_links, wp_options, wp_postmeta, wp_posts, wp_term_relationships, wp_term_taxonomy, wp_termmeta, wp_terms, wp_usermeta, wp_users };
|
|
4771
|
+
export { AccessDenied, Alert, BackendThrowable, C6, COLUMNS, CarbonReact, CarbonWebSocket, ErrorHttpCode, GlobalHistory, Loading, Nest, PageNotFound, Popup, TABLES, addAlert, addValidSQL$1 as addValidSQL, carbons, changed, comments, deleteRestfulObjectArrays, documentation, eRouterType, eUpdateInsertMethod, feature_group_references, features, getRootStyleValue, getStatefulObjectWithWhere, getStyles, globalNavigate, group_references, groups, hexToRgb, history_logs, initialCarbonReactState, initialRequiredCarbonORMState, initialRestfulObjectsState, initiateWebsocket, isEdgeBrowser, isJsonString, isProduction, location_references, locations, parseMultipleJson, photos, range, reports, ScrollIntoViewDirective as scrollIntoView, setCookies, setUrl, setupTests, toDataURL, updateRestfulObjectArrays, uploadImage, uploadImageChange, useEffectOnce, user_followers, user_groups, user_messages, user_sessions, user_tasks, users, ValidSQL as validSQL, watchInputElementChangeEvent, useWindowDimensions as windowDimensions, wp_commentmeta, wp_comments, wp_links, wp_options, wp_postmeta, wp_posts, wp_term_relationships, wp_term_taxonomy, wp_termmeta, wp_terms, wp_usermeta, wp_users };
|
|
4753
4772
|
//# sourceMappingURL=index.esm.js.map
|