@common-stack/client-react 1.0.1-alpha.0 → 1.0.1-alpha.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.
Files changed (144) hide show
  1. package/lib/connector/base-connector.js +3 -10
  2. package/lib/connector/base-connector.js.map +1 -1
  3. package/lib/connector/connector.d.ts +0 -1
  4. package/lib/connector/connector.js +3 -8
  5. package/lib/connector/connector.js.map +1 -1
  6. package/lib/connector/connector.native.d.ts +0 -1
  7. package/lib/connector/connector.native.js +3 -9
  8. package/lib/connector/connector.native.js.map +1 -1
  9. package/lib/index.js +1 -11
  10. package/lib/index.js.map +1 -1
  11. package/lib/index.native.js +1 -11
  12. package/lib/index.native.js.map +1 -1
  13. package/lib/interfaces/menu.js +2 -3
  14. package/lib/interfaces/menu.js.map +1 -1
  15. package/lib/inversify/InversifyContext.js +4 -6
  16. package/lib/inversify/InversifyContext.js.map +1 -1
  17. package/lib/plugin-area/base-plugin-area.js +4 -10
  18. package/lib/plugin-area/base-plugin-area.js.map +1 -1
  19. package/lib/plugin-area/index.js +2 -6
  20. package/lib/plugin-area/index.js.map +1 -1
  21. package/lib/plugin-area/index.native.js +2 -7
  22. package/lib/plugin-area/index.native.js.map +1 -1
  23. package/lib/plugin-area/plugin-api.js +6 -9
  24. package/lib/plugin-area/plugin-api.js.map +1 -1
  25. package/lib/plugin-area/plugin-context.js +2 -18
  26. package/lib/plugin-area/plugin-context.js.map +1 -1
  27. package/lib/route/get-routes.js +3 -6
  28. package/lib/route/get-routes.js.map +1 -1
  29. package/lib/route/old/get-menus.js +2 -4
  30. package/lib/route/old/get-menus.js.map +1 -1
  31. package/lib/route/old/render.js +2 -5
  32. package/lib/route/old/render.js.map +1 -1
  33. package/lib/route/react-navigation/get-navigation-utils.js +3 -7
  34. package/lib/route/react-navigation/get-navigation-utils.js.map +1 -1
  35. package/lib/route/react-navigation/react-navigation-render.js +6 -10
  36. package/lib/route/react-navigation/react-navigation-render.js.map +1 -1
  37. package/lib/route/react-navigation/root-navigation.js +3 -5
  38. package/lib/route/react-navigation/root-navigation.js.map +1 -1
  39. package/lib/route/react-navigation/types.js +1 -2
  40. package/lib/route/react-navigation/types.js.map +1 -1
  41. package/lib/route/render-routes.js +2 -60
  42. package/lib/route/render-routes.js.map +1 -1
  43. package/lib/route/render-routes.native.js +2 -60
  44. package/lib/route/render-routes.native.js.map +1 -1
  45. package/lib/route/root-navigation.js +3 -5
  46. package/lib/route/root-navigation.js.map +1 -1
  47. package/lib/route-based-plugin-area/plugin-api.js +6 -9
  48. package/lib/route-based-plugin-area/plugin-api.js.map +1 -1
  49. package/lib/route-based-plugin-area/plugin-context.js +2 -18
  50. package/lib/route-based-plugin-area/plugin-context.js.map +1 -1
  51. package/lib/route-based-plugin-area/route-based-plugin-area.js +4 -10
  52. package/lib/route-based-plugin-area/route-based-plugin-area.js.map +1 -1
  53. package/lib/router-factory/index.js +3 -7
  54. package/lib/router-factory/index.js.map +1 -1
  55. package/lib/router-factory/index.native.js +3 -7
  56. package/lib/router-factory/index.native.js.map +1 -1
  57. package/lib/utils/before-ssr.js +2 -4
  58. package/lib/utils/before-ssr.js.map +1 -1
  59. package/lib/utils/combine.js +1 -3
  60. package/lib/utils/combine.js.map +1 -1
  61. package/lib/utils/hydrate.js +2 -4
  62. package/lib/utils/hydrate.js.map +1 -1
  63. package/lib/utils/sort-keys.js +2 -4
  64. package/lib/utils/sort-keys.js.map +1 -1
  65. package/lib/utils/utils.js +2 -3
  66. package/lib/utils/utils.js.map +1 -1
  67. package/package.json +6 -5
  68. package/lib/__tests__/fill-register-test.js +0 -45
  69. package/lib/__tests__/fill-register-test.js.map +0 -1
  70. package/lib/__tests__/helpers/sample-menu.js +0 -75
  71. package/lib/__tests__/helpers/sample-menu.js.map +0 -1
  72. package/lib/__tests__/integrated-routes.test.js +0 -59
  73. package/lib/__tests__/integrated-routes.test.js.map +0 -1
  74. package/lib/__tests__/router-render.test.js +0 -50
  75. package/lib/__tests__/router-render.test.js.map +0 -1
  76. package/lib/connector/connector.test.js +0 -11
  77. package/lib/connector/connector.test.js.map +0 -1
  78. package/lib/connector/index.js +0 -2
  79. package/lib/connector/index.js.map +0 -1
  80. package/lib/interfaces/extended-feature.js +0 -2
  81. package/lib/interfaces/extended-feature.js.map +0 -1
  82. package/lib/interfaces/feature.js +0 -2
  83. package/lib/interfaces/feature.js.map +0 -1
  84. package/lib/interfaces/index.js +0 -6
  85. package/lib/interfaces/index.js.map +0 -1
  86. package/lib/interfaces/new-router.js +0 -2
  87. package/lib/interfaces/new-router.js.map +0 -1
  88. package/lib/interfaces/router.js +0 -2
  89. package/lib/interfaces/router.js.map +0 -1
  90. package/lib/inversify/index.js +0 -2
  91. package/lib/inversify/index.js.map +0 -1
  92. package/lib/plugin-area/__tests__/higher-order-component-util.test.js +0 -39
  93. package/lib/plugin-area/__tests__/higher-order-component-util.test.js.map +0 -1
  94. package/lib/plugin-area/__tests__/plugin-api.test.js +0 -52
  95. package/lib/plugin-area/__tests__/plugin-api.test.js.map +0 -1
  96. package/lib/plugin-area/higher-order-component-util.js +0 -19
  97. package/lib/plugin-area/higher-order-component-util.js.map +0 -1
  98. package/lib/route/__tests__/admin-new-routes.test.js +0 -145
  99. package/lib/route/__tests__/admin-new-routes.test.js.map +0 -1
  100. package/lib/route/__tests__/config-routes.test.d.ts +0 -0
  101. package/lib/route/__tests__/config-routes.test.js +0 -326
  102. package/lib/route/__tests__/config-routes.test.js.map +0 -1
  103. package/lib/route/__tests__/getFlatMenus.test.js +0 -94
  104. package/lib/route/__tests__/getFlatMenus.test.js.map +0 -1
  105. package/lib/route/__tests__/render-routes-config.test.js +0 -57
  106. package/lib/route/__tests__/render-routes-config.test.js.map +0 -1
  107. package/lib/route/__tests__/route-type.test.js +0 -8
  108. package/lib/route/__tests__/route-type.test.js.map +0 -1
  109. package/lib/route/get-routes.test.js +0 -184
  110. package/lib/route/get-routes.test.js.map +0 -1
  111. package/lib/route/index.js +0 -3
  112. package/lib/route/index.js.map +0 -1
  113. package/lib/route/index.native.js +0 -2
  114. package/lib/route/index.native.js.map +0 -1
  115. package/lib/route/old/__tests__/config-sidebar-menu.test.js +0 -200
  116. package/lib/route/old/__tests__/config-sidebar-menu.test.js.map +0 -1
  117. package/lib/route/old/get-routes-notused.js +0 -63
  118. package/lib/route/old/get-routes-notused.js.map +0 -1
  119. package/lib/route/react-navigation/get-navigation-utils.test.js +0 -180
  120. package/lib/route/react-navigation/get-navigation-utils.test.js.map +0 -1
  121. package/lib/route/react-navigation/index.js +0 -3
  122. package/lib/route/react-navigation/index.js.map +0 -1
  123. package/lib/route/react-navigation/react-native.sample.test.js +0 -13
  124. package/lib/route/react-navigation/react-native.sample.test.js.map +0 -1
  125. package/lib/route/react-navigation/react-native.sample1.test.js +0 -30
  126. package/lib/route/react-navigation/react-native.sample1.test.js.map +0 -1
  127. package/lib/route/react-navigation/react-navigation-render.test.js +0 -139
  128. package/lib/route/react-navigation/react-navigation-render.test.js.map +0 -1
  129. package/lib/route/react-navigation/routes.js +0 -2
  130. package/lib/route/react-navigation/routes.js.map +0 -1
  131. package/lib/route/render-routes.test.js +0 -248
  132. package/lib/route/render-routes.test.js.map +0 -1
  133. package/lib/route-based-plugin-area/__tests__/higher-order-component-util.test.js +0 -39
  134. package/lib/route-based-plugin-area/__tests__/higher-order-component-util.test.js.map +0 -1
  135. package/lib/route-based-plugin-area/__tests__/plugin-api.test.js +0 -52
  136. package/lib/route-based-plugin-area/__tests__/plugin-api.test.js.map +0 -1
  137. package/lib/route-based-plugin-area/higher-order-component-util.js +0 -19
  138. package/lib/route-based-plugin-area/higher-order-component-util.js.map +0 -1
  139. package/lib/route-based-plugin-area/index.js +0 -3
  140. package/lib/route-based-plugin-area/index.js.map +0 -1
  141. package/lib/utils/index.js +0 -6
  142. package/lib/utils/index.js.map +0 -1
  143. package/lib/utils/sort-keys.test.js +0 -31
  144. package/lib/utils/sort-keys.test.js.map +0 -1
@@ -1,326 +0,0 @@
1
- // OUTDATED TEST NEED TO UPDATE
2
- // import * as React from 'react';
3
- // import * as renderer from 'react-test-renderer';
4
- // import * as Loadable from 'react-loadable';
5
- // import { Route } from 'react-router-dom';
6
- // import { getRoutes } from '../get-routes';
7
- // import { Feature } from '../../connector';
8
- // import { FeatureWithRouterFactory } from '../../router-factory';
9
- // import 'jest';
10
- // function waitFor(delay) {
11
- // return new Promise(resolve => {
12
- // setTimeout(resolve, delay);
13
- // });
14
- // }
15
- // function createLoader(delay, loader, error?: any) {
16
- // return () => {
17
- // return waitFor(delay).then(() => {
18
- // if (loader) {
19
- // return loader();
20
- // } else {
21
- // throw error;
22
- // }
23
- // });
24
- // };
25
- // }
26
- // function MyLoadingComponent(props) {
27
- // return <div>MyLoadingComponent {JSON.stringify(props)}</div>;
28
- // }
29
- // function MyComponent(props) {
30
- // return <div>MyComponent {JSON.stringify(props)}</div>;
31
- // }
32
- // afterEach(async () => {
33
- // try {
34
- // await Loadable.preloadAll();
35
- // } catch (err) {
36
- // }
37
- // });
38
- // // Test case borrowed from
39
- // // https://github.com/jamiebuilds/react-loadable/blob/master/__tests__/test.js
40
- // test('loading success', async () => {
41
- // let LoadableMyComponent = Loadable({
42
- // loader: createLoader(400, () => MyComponent),
43
- // loading: MyLoadingComponent,
44
- // });
45
- // let component1 = renderer.create(<LoadableMyComponent prop="foo" />);
46
- // expect(component1.toJSON()).toMatchSnapshot(); // initial
47
- // await waitFor(200);
48
- // expect(component1.toJSON()).toMatchSnapshot(); // loading
49
- // await waitFor(200);
50
- // expect(component1.toJSON()).toMatchSnapshot(); // loaded
51
- // let component2 = renderer.create(<LoadableMyComponent prop="bar" />);
52
- // expect(component2.toJSON()).toMatchSnapshot(); // reload
53
- // });
54
- // const routerConfig = (namespace = '') => ({
55
- // [namespace + '/a']: {
56
- // component: MyComponent,
57
- // },
58
- // ['/a/1']: {
59
- // component: MyComponent,
60
- // },
61
- // ['/a/:b/1']: {
62
- // component: MyComponent,
63
- // },
64
- // [namespace + '/a/1']: {
65
- // component: MyComponent,
66
- // },
67
- // [namespace + '/a/:c/1']: {
68
- // component: MyComponent,
69
- // },
70
- // [namespace + '/a/2']: {
71
- // component: MyComponent,
72
- // },
73
- // [namespace + '/a/2/1']: {
74
- // component: MyComponent,
75
- // },
76
- // [namespace + '/ab/2/1']: {
77
- // component: MyComponent,
78
- // },
79
- // [namespace + '/b/1']: {
80
- // component: MyComponent,
81
- // },
82
- // [namespace + '/b/login/register']: {
83
- // component: MyComponent,
84
- // },
85
- // });
86
- // describe('getRoutes utility with basic routes', () => {
87
- // test('with /a', async () => {
88
- // const result = {
89
- // // component: any,
90
- // routes: [{
91
- // path: '/a', exact: true, routes:
92
- // [{ path: '/a/1', exact: true },
93
- // { path: '/a/:b/1', exact: true },
94
- // { path: '/a/2', exact: false, routes: [{ 'exact': true, 'path': '/a/2/1' }] },
95
- // { path: '/ab/2/1', exact: true }],
96
- // }],
97
- // };
98
- // const routes = getRoutes('/', routerConfig());
99
- // expect(routes).toMatchSnapshot();
100
- // });
101
- // test('with /', async () => {
102
- // const result =
103
- // [{
104
- // path: '/a', exact: false, routes:
105
- // [
106
- // { path: '/a/1', exact: true },
107
- // { path: '/a/:b/1', exact: true },
108
- // { path: '/a/:c/1', exact: true },
109
- // {
110
- // path: '/a/2', exact: false, routes:
111
- // [
112
- // { path: '/a/2/1', exact: true },
113
- // ],
114
- // },
115
- // ],
116
- // },
117
- // { path: '/ab/2/1', exact: true },
118
- // { path: '/b/1', exact: true },
119
- // { path: '/b/login/register', exact: true }];
120
- // const routes = getRoutes('/', routerConfig());
121
- // expect(routes).toMatchSnapshot();
122
- // expect(JSON.parse(JSON.stringify(routes))).toMatchObject(result);
123
- // });
124
- // test('with `@`in root throws error', async () => {
125
- // try {
126
- // getRoutes('@namespace.', routerConfig('@namespace'));
127
- // } catch (e) {
128
- // expect(e.message).toEqual('Invalid path!');
129
- // }
130
- // });
131
- // xdescribe('getRoutes utility with realistic routes', () => {
132
- // test('with realistic routes', () => {
133
- // const genRoutes = {
134
- // ['/path']: { component: MyComponent, exact: true },
135
- // ['/path/a']: { component: MyComponent },
136
- // ['/path/a/b']: { component: MyComponent },
137
- // ['/path/child']: { component: MyComponent, exact: true },
138
- // ['/path/child1']: { component: MyComponent, exact: true },
139
- // };
140
- // const routes = getRoutes('/', genRoutes);
141
- // const result = [
142
- // {
143
- // // should render
144
- // component: MyComponent,
145
- // path: '/path',
146
- // exact: true,
147
- // routes: [
148
- // {
149
- // // should skip
150
- // component: MyComponent,
151
- // path: '/path/a',
152
- // exact: false,
153
- // routes: [
154
- // {
155
- // // should skip
156
- // component: MyComponent,
157
- // path: '/path/a/b',
158
- // exact: true,
159
- // },
160
- // ],
161
- // },
162
- // {
163
- // // should skip
164
- // component: MyComponent,
165
- // path: '/path/child',
166
- // exact: true,
167
- // },
168
- // {
169
- // // should render
170
- // path: '/path/child1',
171
- // component: MyComponent,
172
- // },
173
- // ],
174
- // },
175
- // ];
176
- // expect(routes).toMatchObject(result);
177
- // expect(routes).toMatchSnapshot();
178
- // });
179
- // it('another realistic test', () => {
180
- // const genRoutes = [
181
- // {
182
- // ['/ghost']: { component: MyComponent },
183
- // ['/pepper']: { component: MyComponent, exact: false },
184
- // ['/pepper/:type']: { component: MyComponent, exact: false },
185
- // ['/pepper/:type/scoville']: { component: MyComponent, exact: false },
186
- // },
187
- // ];
188
- // const result = [
189
- // {
190
- // path: '/ghost',
191
- // component: MyComponent,
192
- // },
193
- // {
194
- // path: '/pepper',
195
- // component: MyComponent,
196
- // exact: false,
197
- // routes: [
198
- // {
199
- // path: '/pepper/:type',
200
- // component: MyComponent,
201
- // exact: false,
202
- // routes: [
203
- // {
204
- // path: '/pepper/:type/scoville',
205
- // component: MyComponent,
206
- // exact: false,
207
- // },
208
- // ],
209
- // },
210
- // ],
211
- // },
212
- // ];
213
- // const connector = new Feature({ routeConfig: genRoutes });
214
- // const connectorRoutes = connector.getConfiguredRoutes();
215
- // expect(connectorRoutes).toMatchObject(result);
216
- // });
217
- // });
218
- // it('with root', () => {
219
- // const genRoutes = [
220
- // {
221
- // ['/']: { component: MyComponent, exact: false },
222
- // ['/ghost']: { component: MyComponent },
223
- // ['/pepper']: { component: MyComponent, exact: false },
224
- // ['/pepper/:type']: { component: MyComponent, exact: false },
225
- // ['/pepper/:type/scoville']: { component: MyComponent, exact: false },
226
- // },
227
- // ];
228
- // const connector = new Feature({ routeConfig: genRoutes });
229
- // const connectorRoutes = connector.getConfiguredRoutes();
230
- // expect(connectorRoutes).toMatchSnapshot();
231
- // });
232
- // });
233
- // xdescribe('connector configuredRoutes', () => {
234
- // test('with no arguments passed', async () => {
235
- // const connector = new Feature({ routeConfig: routerConfig() });
236
- // const result = [{
237
- // exact: false, path: '/a',
238
- // routes: [
239
- // { exact: true, path: '/a/1' },
240
- // { path: '/a/:b/1', exact: true },
241
- // { path: '/a/:c/1', exact: true },
242
- // {
243
- // exact: false, path: '/a/2',
244
- // routes: [
245
- // { exact: true, path: '/a/2/1' },
246
- // ],
247
- // }],
248
- // },
249
- // { exact: true, path: '/ab/2/1' },
250
- // { exact: true, path: '/b/1' },
251
- // { exact: true, path: '/b/login/register' }];
252
- // const routes = connector.getConfiguredRoutes();
253
- // expect(routes).toMatchSnapshot();
254
- // expect(JSON.parse(JSON.stringify(routes))).toMatchObject(result);
255
- // });
256
- // test('with @namespace in routes', async () => {
257
- // const connector = new Feature({ routeConfig: routerConfig('@namespace') });
258
- // const result = [
259
- // { exact: true, path: '/a/1' },
260
- // { path: '/a/:b/1', exact: true },
261
- // ];
262
- // expect(JSON.parse(JSON.stringify(connector.getConfiguredRoutes()))).toMatchObject(result);
263
- // });
264
- // });
265
- // xdescribe('connector getRoutes', () => {
266
- // const staticRoutes = {
267
- // route: [
268
- // <Route key={'static1'} exact={true} path="/static1" component={MyComponent} />,
269
- // <Route key={'static2'} exact={true} path="/static2" component={MyComponent} />,
270
- // ],
271
- // };
272
- // const staticRoutes2 = {
273
- // route: [
274
- // <Route key={'static3'} exact={true} path="/static3" component={MyComponent} />,
275
- // <Route key={'static4'} exact={true} path="/static4" component={MyComponent} />,
276
- // ],
277
- // };
278
- // test('with only static routes', async () => {
279
- // const connector = new Feature(staticRoutes, FeatureWithRouterFactory);
280
- // expect(connector.routerFactory()).toMatchSnapshot();
281
- // });
282
- // test('with static routes and configurable routes', async () => {
283
- // const connector = new Feature({ routeConfig: routerConfig() }, new Feature(staticRoutes));
284
- // expect(connector.getRoutes()).toMatchSnapshot();
285
- // });
286
- // test('with only configurable routes', async () => {
287
- // const connector = new Feature({ routeConfig: routerConfig() });
288
- // expect(connector.getRoutes()).toMatchSnapshot();
289
- // });
290
- // test('with multiple Features', async () => {
291
- // const connector = new Feature(
292
- // { routeConfig: routerConfig() },
293
- // new Feature(staticRoutes),
294
- // new Feature(staticRoutes2),
295
- // { routeConfig: routerConfig('/ac') },
296
- // );
297
- // const routes = connector.getRoutes();
298
- // expect(routes).toMatchSnapshot();
299
- // });
300
- // });
301
- // xdescribe('filter routes with realizting routes', () => {
302
- // const genRoutes = {
303
- // ['/']: { component: MyComponent, exact: true },
304
- // ['/l']: { component: MyComponent },
305
- // ['/rl']: { component: MyComponent },
306
- // ['/:or/a/b']: { component: MyComponent },
307
- // ['/:or/child']: { component: MyComponent, exact: true },
308
- // ['/:or/child1']: { component: MyComponent, exact: true },
309
- // };
310
- // const result =
311
- // [
312
- // { path: '/', exact: true },
313
- // { path: '/l' },
314
- // { path: '/rl' },
315
- // { path: '/:or/ab/2/1', exact: true },
316
- // { path: '/:or/b/1', exact: true },
317
- // { path: '/:or/b/login/register', exact: true }];
318
- // const connector = new Feature({ routeConfig: genRoutes });
319
- // const regexExpNotStartWithColon = /^\/(?!(:)).*/;
320
- // const connectorRoutes = connector.getConfiguredRoutes('/');
321
- // // TODO now need to filter routes which don't start with `/:or`. Something
322
- // // similar to regex, we need to a netgaive `connector.getConfiguredRoutes('^/:or');`
323
- // console.log('---ConnectorRoutes', connectorRoutes);
324
- // // connectorRoutes.
325
- // });
326
- //# sourceMappingURL=config-routes.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config-routes.test.js","sourceRoot":"","sources":["../../../src/route/__tests__/config-routes.test.tsx"],"names":[],"mappings":"AAAA,+BAA+B;AAE/B,kCAAkC;AAClC,mDAAmD;AACnD,8CAA8C;AAC9C,4CAA4C;AAC5C,6CAA6C;AAC7C,6CAA6C;AAC7C,mEAAmE;AACnE,iBAAiB;AAGjB,4BAA4B;AAC5B,oCAAoC;AACpC,kCAAkC;AAClC,QAAQ;AACR,IAAI;AAEJ,sDAAsD;AACtD,mBAAmB;AACnB,yCAAyC;AACzC,sBAAsB;AACtB,2BAA2B;AAC3B,iBAAiB;AACjB,uBAAuB;AACvB,UAAU;AACV,UAAU;AACV,OAAO;AACP,IAAI;AAEJ,uCAAuC;AACvC,kEAAkE;AAClE,IAAI;AAEJ,gCAAgC;AAChC,2DAA2D;AAC3D,IAAI;AAGJ,0BAA0B;AAC1B,UAAU;AACV,mCAAmC;AACnC,oBAAoB;AACpB,MAAM;AACN,MAAM;AAEN,6BAA6B;AAC7B,iFAAiF;AACjF,wCAAwC;AACxC,yCAAyC;AACzC,oDAAoD;AACpD,mCAAmC;AACnC,QAAQ;AAER,0EAA0E;AAE1E,8DAA8D;AAC9D,wBAAwB;AACxB,8DAA8D;AAC9D,wBAAwB;AACxB,6DAA6D;AAE7D,0EAA0E;AAE1E,6DAA6D;AAC7D,MAAM;AAEN,8CAA8C;AAC9C,0BAA0B;AAC1B,8BAA8B;AAC9B,OAAO;AACP,gBAAgB;AAChB,8BAA8B;AAC9B,OAAO;AACP,mBAAmB;AACnB,8BAA8B;AAC9B,OAAO;AACP,4BAA4B;AAC5B,8BAA8B;AAC9B,OAAO;AACP,+BAA+B;AAC/B,8BAA8B;AAC9B,OAAO;AACP,4BAA4B;AAC5B,8BAA8B;AAC9B,OAAO;AACP,8BAA8B;AAC9B,8BAA8B;AAC9B,OAAO;AACP,+BAA+B;AAC/B,8BAA8B;AAC9B,OAAO;AACP,4BAA4B;AAC5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;AAER,oDAAoD;AAEpD,kFAAkF;AAClF,uBAAuB;AACvB,uCAAuC;AACvC,0CAA0C;AAC1C,SAAS;AAET,iGAAiG;AACjG,QAAQ;AACR,MAAM;AAGN,2CAA2C;AAC3C,2BAA2B;AAC3B,eAAe;AACf,wFAAwF;AACxF,wFAAwF;AACxF,SAAS;AACT,OAAO;AACP,4BAA4B;AAC5B,eAAe;AACf,wFAAwF;AACxF,wFAAwF;AACxF,SAAS;AACT,OAAO;AAEP,kDAAkD;AAClD,6EAA6E;AAE7E,2DAA2D;AAC3D,QAAQ;AAER,qEAAqE;AACrE,iGAAiG;AAEjG,uDAAuD;AACvD,QAAQ;AAGR,wDAAwD;AACxD,sEAAsE;AAEtE,uDAAuD;AACvD,QAAQ;AAER,iDAAiD;AACjD,qCAAqC;AACrC,yCAAyC;AACzC,mCAAmC;AACnC,oCAAoC;AACpC,8CAA8C;AAC9C,SAAS;AAET,4CAA4C;AAC5C,wCAAwC;AACxC,QAAQ;AAKR,MAAM;AAEN,4DAA4D;AAE5D,wBAAwB;AACxB,sDAAsD;AACtD,0CAA0C;AAC1C,2CAA2C;AAC3C,gDAAgD;AAChD,+DAA+D;AAC/D,gEAAgE;AAChE,OAAO;AACP,mBAAmB;AACnB,QAAQ;AACR,oCAAoC;AACpC,wBAAwB;AACxB,yBAAyB;AACzB,8CAA8C;AAC9C,2CAA2C;AAC3C,yDAAyD;AAEzD,mEAAmE;AACnE,0DAA0D;AAC1D,oEAAoE;AAEpE,mFAAmF;AACnF,6FAA6F;AAC7F,4DAA4D;AAC5D,4BAA4B;AAC5B,MAAM"}
@@ -1,94 +0,0 @@
1
- import { getFlatMenus, transformRoute } from '@umijs/route-utils';
2
- const routes = [
3
- {
4
- path: '/welcome',
5
- name: 'welcome',
6
- exact: true,
7
- unaccessible: false,
8
- },
9
- {
10
- path: '/admin',
11
- name: 'admin',
12
- access: 'canAdmin',
13
- routes: [
14
- {
15
- path: '/admin/sub-page',
16
- name: 'sub-page',
17
- exact: true,
18
- unaccessible: false,
19
- },
20
- ],
21
- },
22
- {
23
- name: 'list.table.result',
24
- path: '/list/:id',
25
- exact: true,
26
- unaccessible: false,
27
- },
28
- {
29
- name: 'list.table-list',
30
- path: '/list',
31
- exact: true,
32
- unaccessible: false,
33
- },
34
- { path: '/', redirect: '/welcome', exact: true, unaccessible: false },
35
- ];
36
- const { menuData } = transformRoute(routes, true, ({ id }) => {
37
- if (id === 'menu.list.table-list')
38
- return 'query table';
39
- if (id === 'menu.list.table.result')
40
- return 'Data details';
41
- if (id === 'menu.admin')
42
- return 'Admin page';
43
- if (id === 'menu.admin.sub-page')
44
- return 'Secondary management page';
45
- if (id === 'menu.welcome')
46
- return 'welcome';
47
- return id;
48
- });
49
- console.log('---Menu Data', menuData);
50
- describe('getFlatMenus', () => {
51
- it('normal', () => {
52
- const flatMenus = getFlatMenus(menuData);
53
- console.log('--flatMenus', flatMenus);
54
- expect(Object.keys(flatMenus).length).toEqual(5);
55
- expect(flatMenus['/list'].name).toEqual('Inquiry Form');
56
- expect(flatMenus).toMatchSnapshot();
57
- });
58
- it('no has ket', () => {
59
- const noHasKeyData = [
60
- {
61
- path: '/welcome',
62
- name: '欢迎',
63
- exact: true,
64
- unaccessible: false,
65
- locale: 'menu.welcome',
66
- key: '/welcome',
67
- routes: null,
68
- pro_layout_parentKeys: [],
69
- children: undefined,
70
- },
71
- {
72
- path: '/welcome',
73
- name: '欢迎',
74
- key: '/admin/welcome',
75
- exact: true,
76
- unaccessible: false,
77
- locale: 'menu.welcome',
78
- routes: null,
79
- children: undefined,
80
- },
81
- {
82
- path: '/admin',
83
- name: '管理页',
84
- access: 'canAdmin',
85
- routes: null,
86
- locale: 'menu.admin',
87
- pro_layout_parentKeys: [],
88
- },
89
- ];
90
- const flatMenus = getFlatMenus(noHasKeyData);
91
- expect(Object.keys(flatMenus).length).toEqual(2);
92
- });
93
- });
94
- //# sourceMappingURL=getFlatMenus.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get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AE,EAAE;aAC1B;SACF,CAAC;QACF,MAAM,SAAS,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC;QAC7C,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,57 +0,0 @@
1
- import { ConsoleLogger } from '@cdm-logger/server';
2
- import { getRoutes } from '../get-routes';
3
- export const logger = ConsoleLogger.create('test', { level: 'trace' });
4
- function MyComponent(props) {
5
- return {};
6
- }
7
- test('loading success', async () => {
8
- const routerConfig = (namespace = '') => ({
9
- [namespace + '/a']: {
10
- component: () => MyComponent,
11
- },
12
- ['/a']: {
13
- component: () => MyComponent,
14
- },
15
- ['/a/1']: {
16
- component: () => MyComponent,
17
- },
18
- ['/a/1/2']: {
19
- component: () => MyComponent,
20
- },
21
- ['/b']: {
22
- component: () => MyComponent,
23
- },
24
- ['/a/b']: {
25
- component: () => MyComponent,
26
- },
27
- ['/a/b/1']: {
28
- component: () => MyComponent,
29
- },
30
- ['/a/b/1/2']: {
31
- component: () => MyComponent,
32
- },
33
- ['/a/b/1/2/3']: {
34
- component: () => MyComponent,
35
- },
36
- [namespace + '/a/1']: {
37
- component: () => MyComponent,
38
- },
39
- [namespace + '/a/2']: {
40
- component: () => MyComponent,
41
- },
42
- [namespace + '/a/2/1']: {
43
- component: () => MyComponent,
44
- },
45
- [namespace + '/ab/2/1']: {
46
- component: () => MyComponent,
47
- },
48
- [namespace + '/b/1']: {
49
- component: () => MyComponent,
50
- },
51
- [namespace + '/b/c/e']: {
52
- component: () => MyComponent,
53
- },
54
- });
55
- console.log(getRoutes('/', routerConfig('@test'), null));
56
- });
57
- //# sourceMappingURL=render-routes-config.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"render-routes-config.test.js","sourceRoot":"","sources":["../../../src/route/__tests__/render-routes-config.test.ts"],"names":[],"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GAAG,MAAM,CAAC,EAAE;YAClB,SAAS,EAAE,GAAG,EAAE,CAAC,WAAW;SAC/B;QACD,CAAC,SAAS,GAAG,QAAQ,CAAC,EAAE;YACpB,SAAS,EAAE,GAAG,EAAE,CAAC,WAAW;SAC/B;QACD,CAAC,SAAS,GAAG,SAAS,CAAC,EAAE;YACrB,SAAS,EAAE,GAAG,EAAE,CAAC,WAAW;SAC/B;QACD,CAAC,SAAS,GAAG,MAAM,CAAC,EAAE;YAClB,SAAS,EAAE,GAAG,EAAE,CAAC,WAAW;SAC/B;QACD,CAAC,SAAS,GAAG,QAAQ,CAAC,EAAE;YACpB,SAAS,EAAE,GAAG,EAAE,CAAC,WAAW;SAC/B;KACJ,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,YAAY,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;AAC7D,CAAC,CAAC,CAAC"}
@@ -1,8 +0,0 @@
1
- const route = {
2
- ['/test']: {
3
- disabled: false,
4
- authority: ['test']
5
- }
6
- };
7
- export {};
8
- //# sourceMappingURL=route-type.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"route-type.test.js","sourceRoot":"","sources":["../../../src/route/__tests__/route-type.test.ts"],"names":[],"mappings":"AAMA,MAAM,KAAK,GAA6B;IACvC,CAAC,OAAO,CAAC,EAAE;QACR,QAAQ,EAAE,KAAK;QACf,SAAS,EAAE,CAAC,MAAM,CAAC;KAErB;CACD,CAAA"}