@common-stack/client-react 0.5.1-alpha.4 → 0.6.1-alpha.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/lib/__tests__/fill-register-test.js +14 -14
- package/lib/__tests__/fill-register-test.js.map +1 -1
- package/lib/__tests__/integrated-routes.test.js +6 -7
- package/lib/__tests__/integrated-routes.test.js.map +1 -1
- package/lib/__tests__/router-render.test.js +2 -2
- package/lib/__tests__/router-render.test.js.map +1 -1
- package/lib/connector/base-react-client-feature.d.ts +31 -0
- package/lib/connector/{base-connector.js → base-react-client-feature.js} +23 -79
- package/lib/connector/base-react-client-feature.js.map +1 -0
- package/lib/connector/monaco-connector.d.ts +19 -0
- package/lib/connector/monaco-connector.js +76 -0
- package/lib/connector/monaco-connector.js.map +1 -0
- package/lib/connector/react-client-feature.d.ts +7 -0
- package/lib/connector/react-client-feature.js +15 -0
- package/lib/connector/react-client-feature.js.map +1 -0
- package/lib/connector/react-client-feature.native.d.ts +7 -0
- package/lib/connector/react-client-feature.native.js +18 -0
- package/lib/connector/react-client-feature.native.js.map +1 -0
- package/lib/connector/{connector.test.d.ts → react-client-feature.test.d.ts} +0 -0
- package/lib/connector/react-client-feature.test.js +10 -0
- package/lib/connector/react-client-feature.test.js.map +1 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/index.native.d.ts +1 -1
- package/lib/index.native.js +1 -1
- package/lib/index.native.js.map +1 -1
- package/lib/interfaces/extended-feature.d.ts +0 -50
- package/lib/interfaces/extended-feature.js +56 -2
- package/lib/interfaces/extended-feature.js.map +1 -1
- package/lib/interfaces/index.d.ts +0 -1
- package/lib/interfaces/index.js +1 -1
- package/lib/interfaces/index.js.map +1 -1
- package/lib/interfaces/monaco-feature.d.ts +46 -0
- package/lib/interfaces/monaco-feature.js +3 -0
- package/lib/interfaces/monaco-feature.js.map +1 -0
- package/lib/interfaces/react-client-feature.d.ts +77 -0
- package/lib/interfaces/react-client-feature.js +3 -0
- package/lib/interfaces/react-client-feature.js.map +1 -0
- package/lib/inversify/InversifyContext.d.ts +3 -3
- package/lib/inversify/InversifyContext.js.map +1 -1
- package/lib/plugin-area/__tests__/higher-order-component-util.test.js +1 -1
- package/lib/plugin-area/__tests__/higher-order-component-util.test.js.map +1 -1
- package/lib/route/__tests__/getFlatMenus.test.js +1 -1
- package/lib/route/__tests__/getFlatMenus.test.js.map +1 -1
- package/lib/route/old/__tests__/config-sidebar-menu.test.d.ts +0 -1
- package/lib/route/old/__tests__/config-sidebar-menu.test.js +198 -197
- package/lib/route/old/__tests__/config-sidebar-menu.test.js.map +1 -1
- package/lib/route/react-navigation/get-navigation-utils.test.js +6 -6
- package/lib/route/react-navigation/get-navigation-utils.test.js.map +1 -1
- package/lib/route/react-navigation/react-navigation-render.test.d.ts +1 -1
- package/lib/route/react-navigation/react-navigation-render.test.js +42 -9
- package/lib/route/react-navigation/react-navigation-render.test.js.map +1 -1
- package/lib/route-based-plugin-area/__tests__/higher-order-component-util.test.js +1 -1
- package/lib/route-based-plugin-area/__tests__/higher-order-component-util.test.js.map +1 -1
- package/lib/router-factory/index.d.ts +1 -1
- package/lib/router-factory/index.js +4 -4
- package/lib/router-factory/index.js.map +1 -1
- package/lib/router-factory/index.native.d.ts +1 -1
- package/lib/router-factory/index.native.js +4 -4
- package/lib/router-factory/index.native.js.map +1 -1
- package/package.json +4 -4
- package/lib/connector/base-connector.d.ts +0 -53
- package/lib/connector/base-connector.js.map +0 -1
- package/lib/connector/connector.d.ts +0 -9
- package/lib/connector/connector.js +0 -18
- package/lib/connector/connector.js.map +0 -1
- package/lib/connector/connector.native.d.ts +0 -9
- package/lib/connector/connector.native.js +0 -22
- package/lib/connector/connector.native.js.map +0 -1
- package/lib/connector/connector.test.js +0 -36
- package/lib/connector/connector.test.js.map +0 -1
- package/lib/connector/index.d.ts +0 -1
- package/lib/connector/index.js +0 -18
- package/lib/connector/index.js.map +0 -1
|
@@ -25,46 +25,46 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
const React = __importStar(require("react"));
|
|
27
27
|
require("jest");
|
|
28
|
-
const
|
|
28
|
+
const react_client_feature_1 = require("../connector/react-client-feature");
|
|
29
29
|
describe('Test the registration and retrieval of React Slot Fill Components', () => {
|
|
30
|
-
const featureA = new
|
|
31
|
-
|
|
30
|
+
const featureA = new react_client_feature_1.ReactClientFeature({
|
|
31
|
+
componentFillPluginIn: [
|
|
32
32
|
{
|
|
33
33
|
name: 'test-1',
|
|
34
|
-
render: () =>
|
|
34
|
+
render: () => React.createElement("p", null, "Test 1"),
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
37
|
name: 'test-2',
|
|
38
|
-
render: () =>
|
|
38
|
+
render: () => React.createElement("p", null, "Test 2"),
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
41
|
name: 'test-3',
|
|
42
|
-
render: () =>
|
|
42
|
+
render: () => React.createElement("p", null, "Test 3"),
|
|
43
43
|
},
|
|
44
44
|
],
|
|
45
45
|
});
|
|
46
|
-
const featureB = new
|
|
47
|
-
|
|
46
|
+
const featureB = new react_client_feature_1.ReactClientFeature({
|
|
47
|
+
componentFillPluginIn: [
|
|
48
48
|
{
|
|
49
49
|
name: 'test-4',
|
|
50
|
-
render: () =>
|
|
50
|
+
render: () => React.createElement("p", null, "Test 4"),
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
53
|
name: 'test-5',
|
|
54
|
-
render: () =>
|
|
54
|
+
render: () => React.createElement("p", null, "Test 5"),
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
57
|
name: 'test-6',
|
|
58
|
-
render: () =>
|
|
58
|
+
render: () => React.createElement("p", null, "Test 6"),
|
|
59
59
|
},
|
|
60
60
|
],
|
|
61
61
|
});
|
|
62
62
|
test('Should merge all Fills', () => {
|
|
63
|
-
const finalFeature = new
|
|
63
|
+
const finalFeature = new react_client_feature_1.ReactClientFeature(featureA, featureB);
|
|
64
64
|
const mergedFills = finalFeature.getComponentFillPlugins();
|
|
65
65
|
expect(mergedFills.length).toEqual(6);
|
|
66
|
-
mergedFills.forEach(i => expect(typeof i).toEqual('object'));
|
|
67
|
-
mergedFills.forEach(i => expect(typeof i.render).toEqual('function'));
|
|
66
|
+
mergedFills.forEach((i) => expect(typeof i).toEqual('object'));
|
|
67
|
+
mergedFills.forEach((i) => expect(typeof i.render).toEqual('function'));
|
|
68
68
|
});
|
|
69
69
|
});
|
|
70
70
|
//# sourceMappingURL=fill-register-test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fill-register-test.js","sourceRoot":"","sources":["../../src/__tests__/fill-register-test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA+B;AAC/B,gBAAc;AACd,
|
|
1
|
+
{"version":3,"file":"fill-register-test.js","sourceRoot":"","sources":["../../src/__tests__/fill-register-test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA+B;AAC/B,gBAAc;AACd,4EAAkF;AAElF,QAAQ,CAAC,mEAAmE,EAAE,GAAG,EAAE;IAC/E,MAAM,QAAQ,GAAG,IAAI,yCAAO,CAAC;QACzB,qBAAqB,EAAE;YACnB;gBACI,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,GAAG,EAAE,CAAC,wCAAa;aAC9B;YACD;gBACI,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,GAAG,EAAE,CAAC,wCAAa;aAC9B;YACD;gBACI,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,GAAG,EAAE,CAAC,wCAAa;aAC9B;SACJ;KACJ,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,IAAI,yCAAO,CAAC;QACzB,qBAAqB,EAAE;YACnB;gBACI,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,GAAG,EAAE,CAAC,wCAAa;aAC9B;YACD;gBACI,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,GAAG,EAAE,CAAC,wCAAa;aAC9B;YACD;gBACI,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,GAAG,EAAE,CAAC,wCAAa;aAC9B;SACJ;KACJ,CAAC,CAAC;IAEH,IAAI,CAAC,wBAAwB,EAAE,GAAG,EAAE;QAChC,MAAM,YAAY,GAAG,IAAI,yCAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACrD,MAAM,WAAW,GAAG,YAAY,CAAC,uBAAuB,EAAE,CAAC;QAC3D,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACtC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC/D,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -30,7 +30,7 @@ const React = __importStar(require("react"));
|
|
|
30
30
|
const ReactDOMServer = __importStar(require("react-dom/server"));
|
|
31
31
|
const StaticRouter_1 = __importDefault(require("react-router/StaticRouter"));
|
|
32
32
|
const react_router_config_1 = require("react-router-config");
|
|
33
|
-
const
|
|
33
|
+
const react_client_feature_1 = require("../connector/react-client-feature");
|
|
34
34
|
const server_1 = require("@cdm-logger/server");
|
|
35
35
|
const logger = server_1.ConsoleLogger.create('test', { level: 'trace' });
|
|
36
36
|
require("jest");
|
|
@@ -55,12 +55,12 @@ describe('integration', () => {
|
|
|
55
55
|
path: '/pepper',
|
|
56
56
|
component: Comp,
|
|
57
57
|
exact: false,
|
|
58
|
-
|
|
58
|
+
children: [
|
|
59
59
|
{
|
|
60
60
|
path: '/pepper/:type',
|
|
61
61
|
component: Comp,
|
|
62
62
|
exact: false,
|
|
63
|
-
|
|
63
|
+
children: [
|
|
64
64
|
{
|
|
65
65
|
path: '/pepper/:type/scoville',
|
|
66
66
|
component: Comp,
|
|
@@ -71,17 +71,16 @@ describe('integration', () => {
|
|
|
71
71
|
],
|
|
72
72
|
},
|
|
73
73
|
];
|
|
74
|
-
const connector = new
|
|
74
|
+
const connector = new react_client_feature_1.ReactClientFeature({ routeConfigIn: genRoutes });
|
|
75
75
|
const connectorRoutes = connector.getConfiguredRoutes();
|
|
76
76
|
expect(connectorRoutes).toMatchObject(result);
|
|
77
77
|
const pathname = '/pepper/jalepeno';
|
|
78
78
|
const branch = (0, react_router_config_1.matchRoutes)(connectorRoutes, pathname);
|
|
79
79
|
ReactDOMServer.renderToString(React.createElement(StaticRouter_1.default, { location: pathname, context: {} }, (0, react_router_config_1.renderRoutes)(connectorRoutes)));
|
|
80
80
|
expect(branch).toMatchSnapshot();
|
|
81
|
-
expect(branch.length).toEqual(
|
|
82
|
-
expect(rendered.length).toEqual(
|
|
81
|
+
expect(branch.length).toEqual(1);
|
|
82
|
+
expect(rendered.length).toEqual(1);
|
|
83
83
|
expect(branch[0].match).toEqual(rendered[0]);
|
|
84
|
-
expect(branch[1].match).toEqual(rendered[1]);
|
|
85
84
|
});
|
|
86
85
|
});
|
|
87
86
|
//# sourceMappingURL=integrated-routes.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integrated-routes.test.js","sourceRoot":"","sources":["../../src/__tests__/integrated-routes.test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA+B;AAC/B,iEAAmD;AACnD,6EAAqD;AACrD,6DAAgE;AAChE,
|
|
1
|
+
{"version":3,"file":"integrated-routes.test.js","sourceRoot":"","sources":["../../src/__tests__/integrated-routes.test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;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CAC9B,SAAS,EAAE,IAAI;gCACf,KAAK,EAAE,KAAK;6BACf;yBACJ;qBACJ;iBACJ;aACJ;SACJ,CAAC;QACF,MAAM,SAAS,GAAG,IAAI,yCAAO,CAAC,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC,CAAC;QAC5D,MAAM,eAAe,GAAG,SAAS,CAAC,mBAAmB,EAAE,CAAC;QACxD,MAAM,CAAC,eAAe,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAC9C,MAAM,QAAQ,GAAG,kBAAkB,CAAC;QACpC,MAAM,MAAM,GAAG,IAAA,iCAAW,EAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;QACtD,cAAc,CAAC,cAAc,CACzB,oBAAC,sBAAY,IAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,IACxC,IAAA,kCAAY,EAAC,eAAe,CAAC,CACnB,CAClB,CAAC;QAEF,MAAM,CAAC,MAAM,CAAC,CAAC,eAAe,EAAE,CAAC;QACjC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACjC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACnC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;AAEP,CAAC,CAAC,CAAC"}
|
|
@@ -42,7 +42,7 @@ const React = __importStar(require("react"));
|
|
|
42
42
|
const ReactDOMServer = __importStar(require("react-dom/server"));
|
|
43
43
|
const react_router_1 = __importDefault(require("react-router"));
|
|
44
44
|
const react_router_config_1 = require("react-router-config");
|
|
45
|
-
const
|
|
45
|
+
const react_client_feature_1 = require("../connector/react-client-feature");
|
|
46
46
|
const server_1 = require("@cdm-logger/server");
|
|
47
47
|
require("jest");
|
|
48
48
|
exports.logger = server_1.ConsoleLogger.create('test', { level: 'trace' });
|
|
@@ -70,7 +70,7 @@ describe('renderRoutes', () => {
|
|
|
70
70
|
},
|
|
71
71
|
];
|
|
72
72
|
const routes = [routeToMatch];
|
|
73
|
-
const connector = new
|
|
73
|
+
const connector = new react_client_feature_1.ReactClientFeature({ routeConfigIn: genRoutes });
|
|
74
74
|
ReactDOMServer.renderToString(React.createElement(StaticRouter, { location: "/path", context: {} }, (0, react_router_config_1.renderRoutes)(routes)));
|
|
75
75
|
expect(renderedRoutes.length).toEqual(1);
|
|
76
76
|
expect(renderedRoutes[0]).toEqual(routeToMatch);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router-render.test.js","sourceRoot":"","sources":["../../src/__tests__/router-render.test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA+B;AAC/B,iEAAmD;AACnD,gEAAkC;AAClC,6DAAgE;AAChE,
|
|
1
|
+
{"version":3,"file":"router-render.test.js","sourceRoot":"","sources":["../../src/__tests__/router-render.test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA+B;AAC/B,iEAAmD;AACnD,gEAAkC;AAClC,6DAAgE;AAChE,4EAAkF;AAClF,+CAA2E;AAE3E,gBAAc;AAED,QAAA,MAAM,GAAsB,sBAAa,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;AAC1F,MAAM,EAAE,YAAY,EAAE,GAAG,sBAAM,CAAC;AAEhC,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,IAAI,cAAc,CAAC;IACnB,IAAI,kBAAkB,CAAC;IACvB,MAAM,IAAI,GAAG,CAAC,EAA2C,EAAE,EAAE;YAA/C,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,OAAiB,EAAZ,UAAU,cAAzC,kBAA2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as React from 'react';
|
|
2
|
+
import { ApolloClientFeature } from '@common-stack/client-core';
|
|
3
|
+
import { IPlugin, IReactClientFeature, IReactClientFeatureShape, RootComponentFactory } from '../interfaces/react-client-feature';
|
|
4
|
+
import { IMenuData, IRouteData } from '../interfaces';
|
|
5
|
+
export declare abstract class BaseReactClientFeature extends ApolloClientFeature implements IReactClientFeature {
|
|
6
|
+
readonly sidebarSegmentsIn?: any[];
|
|
7
|
+
readonly routerFactoryIn?: any[];
|
|
8
|
+
readonly routeConfigIn?: IRouteData[];
|
|
9
|
+
readonly stylesIn?: string[];
|
|
10
|
+
readonly scriptsIn?: string[];
|
|
11
|
+
readonly rootComponentFactoryIn?: RootComponentFactory[];
|
|
12
|
+
readonly dataRootComponentIn?: React.ComponentType<{}>[];
|
|
13
|
+
readonly navItemIn?: React.ReactElement<any, string | React.JSXElementConstructor<any>>[];
|
|
14
|
+
readonly navItemRightIn?: React.ReactElement<any, string | React.JSXElementConstructor<any>>[];
|
|
15
|
+
protected abstract renderRoutes: any;
|
|
16
|
+
protected abstract getSortedRoutes: any;
|
|
17
|
+
constructor(...modules: IReactClientFeatureShape[]);
|
|
18
|
+
getRoutes(searchPath: string, searchName?: string): any;
|
|
19
|
+
getMenus(sortByPriority: boolean): any;
|
|
20
|
+
getConfiguredRoutes(searchPath?: string): any;
|
|
21
|
+
getComponentFillPlugins(): import("../plugin-area").WorbenchExtension[];
|
|
22
|
+
menuConfigIn?: IMenuData[];
|
|
23
|
+
componentFillPluginIn?: IPlugin[];
|
|
24
|
+
authWrapperIn?: (ele: React.ReactElement<any, string | React.JSXElementConstructor<any>>, props: Record<string, any>) => void;
|
|
25
|
+
getDataRoot(root: React.ReactElement<any, string | React.JSXElementConstructor<any>>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
26
|
+
getWrappedRoot(root: React.ReactElement<any, string | React.JSXElementConstructor<any>>, req?: Request): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
27
|
+
private registerComponentFillPlugins;
|
|
28
|
+
private getConfiguredMenus;
|
|
29
|
+
private sortMenusByPriority;
|
|
30
|
+
private sortMenus;
|
|
31
|
+
}
|
|
@@ -23,19 +23,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
26
|
+
exports.BaseReactClientFeature = void 0;
|
|
27
27
|
const React = __importStar(require("react"));
|
|
28
|
+
const fractal_objects_1 = require("fractal-objects");
|
|
28
29
|
const client_core_1 = require("@common-stack/client-core");
|
|
29
|
-
const get_menus_1 = require("../route/old/get-menus");
|
|
30
30
|
const lodash_1 = require("lodash");
|
|
31
31
|
const plugin_area_1 = require("../plugin-area");
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
constructor(feature,
|
|
36
|
-
// tslint:disable:trailing-comma
|
|
37
|
-
...features) {
|
|
38
|
-
super(feature, ...features);
|
|
32
|
+
class BaseReactClientFeature extends client_core_1.ApolloClientFeature {
|
|
33
|
+
constructor(...modules) {
|
|
34
|
+
super(...modules);
|
|
39
35
|
this.sortMenusByPriority = (menus) => {
|
|
40
36
|
return (0, lodash_1.sortBy)(menus, (obj) => parseInt(obj.priority, 10));
|
|
41
37
|
};
|
|
@@ -50,88 +46,36 @@ class BaseFeature extends client_core_1.AbstractFeature {
|
|
|
50
46
|
return menus;
|
|
51
47
|
}
|
|
52
48
|
};
|
|
53
|
-
|
|
54
|
-
// Navigation
|
|
55
|
-
this.routerFactory = combine(arguments, (arg) => arg.routerFactory)
|
|
56
|
-
.slice(-1)
|
|
57
|
-
.pop();
|
|
58
|
-
this.route = combine(arguments, (arg) => arg.route);
|
|
59
|
-
this.routeConfig = combine(arguments, (arg) => arg.routeConfig);
|
|
60
|
-
this.menuConfig = combine(arguments, (arg) => arg.menuConfig);
|
|
61
|
-
this.componentFillPlugins = this.registerComponentFillPlugins(combine(arguments, (arg) => arg.componentFillPlugins));
|
|
62
|
-
this.authWrapper = getFirst(arguments, (arg) => arg.authWrapper);
|
|
49
|
+
(0, fractal_objects_1.foldTo)(this, modules);
|
|
63
50
|
}
|
|
64
|
-
|
|
65
|
-
* Get the routes
|
|
66
|
-
* @deprecated
|
|
67
|
-
*/
|
|
68
|
-
getRoutes(searchPath) {
|
|
51
|
+
getRoutes(searchPath, searchName) {
|
|
69
52
|
const configuredRoutes = this.getConfiguredRoutes(searchPath);
|
|
70
|
-
|
|
71
|
-
return this.renderRoutes(configuredRoutes, solidRoutes);
|
|
53
|
+
return this.renderRoutes(configuredRoutes, searchName);
|
|
72
54
|
}
|
|
73
|
-
|
|
74
|
-
* Get the routes2
|
|
75
|
-
* @param searchPath
|
|
76
|
-
*/
|
|
77
|
-
getRoutes2(searchPath = '/', searchName) {
|
|
78
|
-
const configuredRoutes = this.getConfiguredRoutes2(searchPath);
|
|
79
|
-
return this.renderRoutes2(configuredRoutes, searchName);
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Get menus
|
|
83
|
-
* @deprecated
|
|
84
|
-
*/
|
|
85
|
-
getMenus(sortByPriority = true) {
|
|
55
|
+
getMenus(sortByPriority) {
|
|
86
56
|
const menus = this.getConfiguredMenus();
|
|
87
57
|
return this.sortMenus(sortByPriority, menus);
|
|
88
58
|
}
|
|
89
|
-
/**
|
|
90
|
-
* get configured routes.
|
|
91
|
-
*/
|
|
92
59
|
getConfiguredRoutes(searchPath = '/') {
|
|
93
|
-
return this.getSortedRoutes(searchPath, Object.assign({}, ...this.
|
|
94
|
-
}
|
|
95
|
-
getConfiguredRoutes2(searchPath = '/') {
|
|
96
|
-
return this.getSortedRoutes2(searchPath, Object.assign({}, ...this.routeConfig), this.authWrapper);
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* get configured menus.
|
|
100
|
-
* Note: It overwrites the any duplicate key with latest loaded key.
|
|
101
|
-
* TODO: Find a way to warn when there are duplicate keys.
|
|
102
|
-
*/
|
|
103
|
-
getConfiguredMenus(searchPath = '/') {
|
|
104
|
-
const routes = Object.assign({}, ...this.menuConfig);
|
|
105
|
-
return (0, get_menus_1.getMenus)(searchPath, Object.assign({}, routes));
|
|
106
|
-
}
|
|
107
|
-
get navItems() {
|
|
108
|
-
return this.navItem.map((component, idx) => React.cloneElement(component, {
|
|
109
|
-
key: component.key ? component.key : idx + this.navItem.length,
|
|
110
|
-
}));
|
|
60
|
+
return this.getSortedRoutes(searchPath, Object.assign({}, ...this.routeConfigIn), this.authWrapperIn);
|
|
111
61
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}));
|
|
116
|
-
}
|
|
117
|
-
getWrappedRoot(root, req) {
|
|
118
|
-
let nestedRoot = root;
|
|
119
|
-
for (const componentFactory of this.rootComponentFactory) {
|
|
120
|
-
nestedRoot = React.cloneElement(componentFactory(req), {}, nestedRoot);
|
|
121
|
-
}
|
|
122
|
-
return nestedRoot;
|
|
62
|
+
getComponentFillPlugins() {
|
|
63
|
+
this.registerComponentFillPlugins(this.componentFillPluginIn);
|
|
64
|
+
return (0, plugin_area_1.getPlugins)();
|
|
123
65
|
}
|
|
124
66
|
getDataRoot(root) {
|
|
125
67
|
let nestedRoot = root;
|
|
126
|
-
for (const component of this.
|
|
68
|
+
for (const component of this.dataRootComponentIn) {
|
|
127
69
|
nestedRoot = React.createElement(component, {}, nestedRoot);
|
|
128
70
|
}
|
|
129
71
|
return nestedRoot;
|
|
130
72
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
73
|
+
getWrappedRoot(root, req) {
|
|
74
|
+
let nestedRoot = root;
|
|
75
|
+
for (const componentFactory of this.rootComponentFactoryIn) {
|
|
76
|
+
nestedRoot = React.cloneElement(componentFactory(req), {}, nestedRoot);
|
|
134
77
|
}
|
|
78
|
+
return nestedRoot;
|
|
135
79
|
}
|
|
136
80
|
registerComponentFillPlugins(plugins) {
|
|
137
81
|
plugins.forEach((i) => {
|
|
@@ -143,9 +87,9 @@ class BaseFeature extends client_core_1.AbstractFeature {
|
|
|
143
87
|
});
|
|
144
88
|
return plugins;
|
|
145
89
|
}
|
|
146
|
-
|
|
147
|
-
|
|
90
|
+
getConfiguredMenus(searchPath = '/') {
|
|
91
|
+
new Error('Need to be figured');
|
|
148
92
|
}
|
|
149
93
|
}
|
|
150
|
-
exports.
|
|
151
|
-
//# sourceMappingURL=base-
|
|
94
|
+
exports.BaseReactClientFeature = BaseReactClientFeature;
|
|
95
|
+
//# sourceMappingURL=base-react-client-feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-react-client-feature.js","sourceRoot":"","sources":["../../src/connector/base-react-client-feature.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA+B;AAC/B,qDAAyC;AACzC,2DAAgE;AAChE,mCAAgC;AAGhC,gDAAuE;AAEvE,MAAsB,sBAAuB,SAAQ,iCAAmB;IAepE,YAAY,GAAG,OAAmC;QAC9C,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC;QAmDd,wBAAmB,GAAG,CAAC,KAAK,EAAE,EAAE;YACpC,OAAO,IAAA,eAAM,EAAC,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;QAC9D,CAAC,CAAA;QAEO,cAAS,GAAG,CAAC,cAAc,EAAE,KAAK,EAAE,EAAE;YAC1C,IAAI,cAAc,EAAE;gBAChB,MAAM,QAAQ,GAAG,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;gBACjD,OAAO,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;oBACvB,uCACO,IAAI,KACP,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,CAAC,QAAQ,CAAC,IAC1E;gBACN,CAAC,CAAC,CAAC;aACN;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B,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,UAAU,CAAC,CAAC;SAC1E;QACD,OAAO,UAAU,CAAC;IACtB,CAAC;IAEO,4BAA4B,CAAC,OAAO;QACxC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YAClB,MAAM,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;YACnB,MAAM,OAAO,GAAG,CAAC,CAAC,IAAA,uBAAS,EAAC,IAAI,CAAC,CAAC;YAClC,IAAI,CAAC,OAAO,EAAE;gBACV,IAAA,4BAAc,EAAC,IAAI,EAAE,CAAC,CAAC,CAAC;aAC3B;QACL,CAAC,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IACnB,CAAC;IAEO,kBAAkB,CAAC,UAAU,GAAG,GAAG;QACvC,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAA;IACnC,CAAC;CAoBJ;AArFD,wDAqFC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ApolloClientFeature } from '@common-stack/client-core';
|
|
2
|
+
import { IMonacoClientFeature, IMonacoClientFeatureShape } from '../interfaces/monaco-feature';
|
|
3
|
+
declare class MonacoClientFeature extends ApolloClientFeature implements IMonacoClientFeature {
|
|
4
|
+
readonly languagesFuncs?: any;
|
|
5
|
+
readonly leftMainPanelItems?: any;
|
|
6
|
+
readonly middleMainPanelItems?: any;
|
|
7
|
+
readonly middleMainPanelItemsProps?: any;
|
|
8
|
+
readonly leftFooterItems?: any;
|
|
9
|
+
readonly rightFooterItems?: any;
|
|
10
|
+
readonly middleLowerPanelItems?: any;
|
|
11
|
+
constructor(...modules: IMonacoClientFeatureShape[]);
|
|
12
|
+
get leftMainPanel(): any;
|
|
13
|
+
get middleMainPanel(): any;
|
|
14
|
+
get leftFooter(): any;
|
|
15
|
+
get rightFooter(): any;
|
|
16
|
+
get middleLowerPanel(): any;
|
|
17
|
+
registerLanguages(monaco: any): void;
|
|
18
|
+
}
|
|
19
|
+
export { MonacoClientFeature };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.MonacoClientFeature = void 0;
|
|
27
|
+
const React = __importStar(require("react"));
|
|
28
|
+
const client_core_1 = require("@common-stack/client-core");
|
|
29
|
+
const fractal_objects_1 = require("fractal-objects");
|
|
30
|
+
const lodash_1 = require("lodash");
|
|
31
|
+
class MonacoClientFeature extends client_core_1.ApolloClientFeature {
|
|
32
|
+
constructor(...modules) {
|
|
33
|
+
super(...modules);
|
|
34
|
+
(0, fractal_objects_1.foldTo)(this, modules);
|
|
35
|
+
}
|
|
36
|
+
get leftMainPanel() {
|
|
37
|
+
return (0, lodash_1.merge)({}, ...(this.leftMainPanelItems || []));
|
|
38
|
+
}
|
|
39
|
+
get middleMainPanel() {
|
|
40
|
+
const panelObj = (0, lodash_1.merge)({}, ...(this.middleMainPanelItems || []));
|
|
41
|
+
const withProps = {};
|
|
42
|
+
Object.keys(panelObj).forEach(key => {
|
|
43
|
+
const props = this.middleMainPanelItemsProps.filter(el => !!el[key]);
|
|
44
|
+
let mergedProps = [];
|
|
45
|
+
props.forEach(el => {
|
|
46
|
+
const insideEl = el[key];
|
|
47
|
+
Object.keys(insideEl).forEach(item => {
|
|
48
|
+
if (mergedProps[item]) {
|
|
49
|
+
mergedProps[item] = [...mergedProps[item], ...insideEl[item]];
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
mergedProps = Object.assign(Object.assign({}, mergedProps), { [item]: insideEl[item] });
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
return withProps[key] = React.cloneElement(panelObj[key], mergedProps);
|
|
57
|
+
});
|
|
58
|
+
return withProps;
|
|
59
|
+
}
|
|
60
|
+
get leftFooter() {
|
|
61
|
+
return this.leftFooterItems;
|
|
62
|
+
}
|
|
63
|
+
get rightFooter() {
|
|
64
|
+
return this.rightFooterItems;
|
|
65
|
+
}
|
|
66
|
+
get middleLowerPanel() {
|
|
67
|
+
return (0, lodash_1.merge)({}, ...(this.middleLowerPanelItems || []));
|
|
68
|
+
}
|
|
69
|
+
registerLanguages(monaco) {
|
|
70
|
+
for (const func of this.languagesFuncs) {
|
|
71
|
+
func(monaco);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.MonacoClientFeature = MonacoClientFeature;
|
|
76
|
+
//# sourceMappingURL=monaco-connector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monaco-connector.js","sourceRoot":"","sources":["../../src/connector/monaco-connector.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;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,CAAC,GAAE,CAAC;qBAC5D;gBACL,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;YACH,OAAO,SAAS,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,YAAY,CACtC,QAAQ,CAAC,GAAG,CAAC,EACb,WAAW,CACd,CAAC;QACN,CAAC,CAAC,CAAC;QACH,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,IAAI,UAAU;QACV,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAED,IAAI,WAAW;QACX,OAAO,IAAI,CAAC,gBAAgB,CAAC;IACjC,CAAC;IAED,IAAI,gBAAgB;QAChB,OAAO,IAAA,cAAK,EAAC,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAC,CAAC;IAC5D,CAAC;IAEM,iBAAiB,CAAC,MAAM;QAC3B,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,cAAc,EAAE;YACpC,IAAI,CAAC,MAAM,CAAC,CAAC;SAChB;IACL,CAAC;CACJ;AAEQ,kDAAmB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BaseReactClientFeature } from './base-react-client-feature';
|
|
3
|
+
import { IReactClientFeature } from '../interfaces/react-client-feature';
|
|
4
|
+
export declare class ReactClientFeature extends BaseReactClientFeature implements IReactClientFeature {
|
|
5
|
+
protected renderRoutes: (args: any) => JSX.Element;
|
|
6
|
+
protected getSortedRoutes: (path: string, routeData: import("..").IRouteData, authWrapper?: (ele: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>, props: Record<string, any>) => void) => any;
|
|
7
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReactClientFeature = void 0;
|
|
4
|
+
const render_routes_1 = require("../route/render-routes");
|
|
5
|
+
const get_routes_1 = require("../route/get-routes");
|
|
6
|
+
const base_react_client_feature_1 = require("./base-react-client-feature");
|
|
7
|
+
class ReactClientFeature extends base_react_client_feature_1.BaseReactClientFeature {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.renderRoutes = (args) => (0, render_routes_1.renderRoutes2)({ routes: args });
|
|
11
|
+
this.getSortedRoutes = get_routes_1.getSortedRoutes;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.ReactClientFeature = ReactClientFeature;
|
|
15
|
+
//# sourceMappingURL=react-client-feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-client-feature.js","sourceRoot":"","sources":["../../src/connector/react-client-feature.tsx"],"names":[],"mappings":";;;AAAA,0DAAuD;AACvD,oDAAsD;AACtD,2EAAqE;AAGrE,MAAa,kBAAmB,SAAQ,kDAAsB;IAA9D;;QACc,iBAAY,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,6BAAa,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QACzD,oBAAe,GAAG,4BAAe,CAAC;IAChD,CAAC;CAAA;AAHD,gDAGC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BaseReactClientFeature } from './base-react-client-feature';
|
|
3
|
+
import { IReactClientFeature } from '../interfaces/react-client-feature';
|
|
4
|
+
export declare class ReactClientFeature extends BaseReactClientFeature implements IReactClientFeature {
|
|
5
|
+
protected renderRoutes: (arg1: any, arg2: any) => JSX.Element;
|
|
6
|
+
protected getSortedRoutes: (path: string, routeData: import("..").IRouteData, authWrapper?: (component: import("react").FC<{}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => any;
|
|
7
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ReactClientFeature = void 0;
|
|
7
|
+
const base_react_client_feature_1 = require("./base-react-client-feature");
|
|
8
|
+
const get_navigation_utils_1 = require("../route/react-navigation/get-navigation-utils");
|
|
9
|
+
const react_navigation_render_1 = __importDefault(require("../route/react-navigation/react-navigation-render"));
|
|
10
|
+
class ReactClientFeature extends base_react_client_feature_1.BaseReactClientFeature {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.renderRoutes = (arg1, arg2) => (0, react_navigation_render_1.default)(arg1[0], arg2);
|
|
14
|
+
this.getSortedRoutes = get_navigation_utils_1.getSortedNavigations;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.ReactClientFeature = ReactClientFeature;
|
|
18
|
+
//# sourceMappingURL=react-client-feature.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-client-feature.native.js","sourceRoot":"","sources":["../../src/connector/react-client-feature.native.tsx"],"names":[],"mappings":";;;;;;AAAA,2EAAqE;AACrE,yFAAsF;AACtF,gHAAiF;AAGjF,MAAa,kBAAmB,SAAQ,kDAAsB;IAA9D;;QACc,iBAAY,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAA,iCAAgB,EAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;QAC/D,oBAAe,GAAG,2CAAoB,CAAC;IACrD,CAAC;CAAA;AAHD,gDAGC"}
|
|
File without changes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
require("jest");
|
|
4
|
+
describe('Test Feature', () => {
|
|
5
|
+
it('test Connector with router', () => {
|
|
6
|
+
// const feature = new ReactClientFeature({ routeConfigIn: <Route exact={true} path="/" component={() => <div>test</div>} /> });
|
|
7
|
+
// console.log(feature);
|
|
8
|
+
});
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=react-client-feature.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-client-feature.test.js","sourceRoot":"","sources":["../../src/connector/react-client-feature.test.tsx"],"names":[],"mappings":";;AAIA,gBAAc;AAEd,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAE1B,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;QAClC,gIAAgI;QAChI,wBAAwB;IAC5B,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { ClientTypes } from '@common-stack/client-core';
|
|
2
|
-
export * from './connector';
|
|
2
|
+
export * from './connector/react-client-feature';
|
|
3
|
+
export * from './connector/monaco-connector';
|
|
3
4
|
export * from './router-factory';
|
|
4
5
|
export * from './route';
|
|
5
6
|
export * from './route/root-navigation';
|
package/lib/index.js
CHANGED
|
@@ -17,7 +17,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
exports.ClientTypes = void 0;
|
|
18
18
|
var client_core_1 = require("@common-stack/client-core");
|
|
19
19
|
Object.defineProperty(exports, "ClientTypes", { enumerable: true, get: function () { return client_core_1.ClientTypes; } });
|
|
20
|
-
__exportStar(require("./connector"), exports);
|
|
20
|
+
__exportStar(require("./connector/react-client-feature"), exports);
|
|
21
|
+
__exportStar(require("./connector/monaco-connector"), exports);
|
|
21
22
|
__exportStar(require("./router-factory"), exports);
|
|
22
23
|
__exportStar(require("./route"), exports);
|
|
23
24
|
__exportStar(require("./route/root-navigation"), exports);
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yDAAwD;AAA/C,0GAAA,WAAW,OAAA;AACpB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yDAAwD;AAA/C,0GAAA,WAAW,OAAA;AACpB,mEAAiD;AACjD,+DAA6C;AAC7C,mDAAiC;AACjC,0CAAwB;AACxB,0DAAwC;AACxC,0CAAwB;AACxB,+CAA6B;AAC7B,gDAA8B;AAC9B,4DAA0C;AAC1C,8CAA4B"}
|
package/lib/index.native.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { ClientTypes } from '@common-stack/client-core';
|
|
2
|
-
export * from './connector/
|
|
2
|
+
export * from './connector/react-client-feature.native';
|
|
3
3
|
export * from './router-factory/index.native';
|
|
4
4
|
export * from './route/index.native';
|
|
5
5
|
export * from './route/react-navigation/root-navigation';
|
package/lib/index.native.js
CHANGED
|
@@ -17,7 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
exports.ClientTypes = void 0;
|
|
18
18
|
var client_core_1 = require("@common-stack/client-core");
|
|
19
19
|
Object.defineProperty(exports, "ClientTypes", { enumerable: true, get: function () { return client_core_1.ClientTypes; } });
|
|
20
|
-
__exportStar(require("./connector/
|
|
20
|
+
__exportStar(require("./connector/react-client-feature.native"), exports);
|
|
21
21
|
__exportStar(require("./router-factory/index.native"), exports);
|
|
22
22
|
__exportStar(require("./route/index.native"), exports);
|
|
23
23
|
__exportStar(require("./route/react-navigation/root-navigation"), exports);
|
package/lib/index.native.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.js","sourceRoot":"","sources":["../src/index.native.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yDAAwD;AAA/C,0GAAA,WAAW,OAAA;AACpB
|
|
1
|
+
{"version":3,"file":"index.native.js","sourceRoot":"","sources":["../src/index.native.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yDAAwD;AAA/C,0GAAA,WAAW,OAAA;AACpB,0EAAwD;AACxD,gEAA8C;AAC9C,uDAAqC;AACrC,2EAAyD;AACzD,0CAAwB;AACxB,+CAA6B;AAC7B,6DAA2C;AAC3C,4DAA0C;AAC1C,8CAA4B"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { IFeature } from '@common-stack/client-core';
|
|
3
|
-
import { IMappedData, IRouteData } from './router';
|
|
4
|
-
import { IMenuData } from './menu';
|
|
5
|
-
import { ComponentElement } from 'react';
|
|
6
|
-
export interface IPlugin {
|
|
7
|
-
name: string;
|
|
8
|
-
icon?: string | ComponentElement<any, any> | Function;
|
|
9
|
-
render: React.FC<any>;
|
|
10
|
-
}
|
|
11
|
-
export declare type IReactFeature = IFeature & IReactModuleShape & {
|
|
12
|
-
readonly getRouter: any;
|
|
13
|
-
/**
|
|
14
|
-
* @returns client-side React route components list
|
|
15
|
-
*/
|
|
16
|
-
readonly getRoutes: any;
|
|
17
|
-
readonly getConfiguredRoutes: any;
|
|
18
|
-
readonly getMenus: any;
|
|
19
|
-
readonly getConfiguredMenus: any;
|
|
20
|
-
readonly routeConfig: IRouteData;
|
|
21
|
-
readonly menuConfig: IMappedData;
|
|
22
|
-
componentFillPlugins: IPlugin[];
|
|
23
|
-
/**
|
|
24
|
-
* React component of all fill of each plugin.
|
|
25
|
-
*/
|
|
26
|
-
getComponentFillPlugins(): IPlugin[];
|
|
27
|
-
/**
|
|
28
|
-
* Authentication Wrapper for secured routes
|
|
29
|
-
*/
|
|
30
|
-
readonly authWrapper?: (ele: React.ReactElement, props: Record<string, any>) => void;
|
|
31
|
-
};
|
|
32
|
-
export declare type IReactModuleShape = {
|
|
33
|
-
/**
|
|
34
|
-
* @param route Route list
|
|
35
|
-
*/
|
|
36
|
-
readonly route?: any;
|
|
37
|
-
/**
|
|
38
|
-
* @param routeConfig Custom route data to create React Routers
|
|
39
|
-
*/
|
|
40
|
-
readonly routeConfig?: IRouteData | IRouteData[];
|
|
41
|
-
/**
|
|
42
|
-
* @param menuConfig Menu data to create side menu
|
|
43
|
-
*/
|
|
44
|
-
readonly menuConfig?: IMenuData | IMenuData[];
|
|
45
|
-
readonly componentFillPlugins?: IPlugin[];
|
|
46
|
-
/**
|
|
47
|
-
* Authentication Wrapper for secured routes
|
|
48
|
-
*/
|
|
49
|
-
readonly authWrapper?: (ele: React.ReactElement, props: Record<string, any>) => void;
|
|
50
|
-
};
|