@nine-lab/nine-mu 0.1.377 โ 0.1.379
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/nine-mu.js +20 -10
- package/dist/nine-mu.js.map +1 -1
- package/dist/nine-mu.umd.js +1 -1
- package/dist/nine-mu.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/hook/NineHook.js +23 -8
package/package.json
CHANGED
|
@@ -23,12 +23,24 @@ const ScreenProvider = ({ children }) => {
|
|
|
23
23
|
);
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
// ๐ก ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๋ด์ฅ ๋ํดํธ ํฐ๋ฏธ๋ ์คํ์ผ 404 ์ปดํฌ๋ํธ
|
|
27
|
+
const Default404 = () => {
|
|
28
|
+
return React.createElement(
|
|
29
|
+
'div',
|
|
30
|
+
{ style: { padding: '25px', background: '#121314', color: '#666', fontFamily: 'Consolas, Monaco, monospace', fontSize: '14px', minHeight: '100%', flexGrow: 1 } },
|
|
31
|
+
'[SYSTEM] 404 - COMMAND OR COMPONENT NOT FOUND'
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const createDynamicRoutes = (menuData, projectViews, Custom404) => {
|
|
27
36
|
// ๊ธฐ๋ณธ 404 ๋ฐ ํ ์ค์
|
|
28
37
|
const lazyLoad = (viewPath) => {
|
|
29
38
|
const importer = projectViews[viewPath];
|
|
30
|
-
|
|
31
|
-
//
|
|
39
|
+
|
|
40
|
+
// ๐ฏ [404 ํด๊ฒฐ ํฌ์ธํธ] ์ฌ์ฉ์๊ฐ ๋ฑ๋กํ 404๊ฐ ์์ผ๋ฉด ๊ทธ๊ฑธ ์ฐ๊ณ , ์์ผ๋ฉด ๊ธฐ๋ณธ ๋ด์ฅ 404๋ฅผ ๋์๋๋ค.
|
|
41
|
+
if (!importer) {
|
|
42
|
+
return Custom404 ? Custom404 : Default404;
|
|
43
|
+
}
|
|
32
44
|
return lazy(() => importer());
|
|
33
45
|
};
|
|
34
46
|
|
|
@@ -65,7 +77,8 @@ const createDynamicRoutes = (menuData, projectViews) => {
|
|
|
65
77
|
});
|
|
66
78
|
}
|
|
67
79
|
|
|
68
|
-
//
|
|
80
|
+
// ๐ฏ [404 ํด๊ฒฐ ํฌ์ธํธ] ์ ์๋์ง ์์ ๋ชจ๋ ์ฃผ์(*)๋ ๋ผ์ฐํฐ ๋ ๋ฒจ์์ 404 ๋งคํ ์ปดํฌ๋ํธ๋ก ๋ฆฌ๋ค์ด๋ ํธ
|
|
81
|
+
dynamicRoutes.push({ path: "*", Component: Custom404 ? Custom404 : Default404 });
|
|
69
82
|
return dynamicRoutes;
|
|
70
83
|
};
|
|
71
84
|
|
|
@@ -189,9 +202,12 @@ class NineExceptionHook extends React.Component {
|
|
|
189
202
|
}
|
|
190
203
|
}
|
|
191
204
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
205
|
+
// ==========================================
|
|
206
|
+
// ๐ฏ 3. ํต์ฌ: ์ธ๋ถ ์ฃผ์
ํ 404 ๋ผ์ฐํ
๊ธฐ๋ฅ ํ์ฌ
|
|
207
|
+
// ==========================================
|
|
208
|
+
export function NineHook({ menuData, views, error404, onCatch, fallback, styles, containerStyle }) {
|
|
209
|
+
// ๋ด๋ถ์์ ์๋์ผ๋ก ๋ผ์ฐํธ ๋ฐฐ์ด ์์ฑ (error404 ์ปดํฌ๋ํธ ์ ๋ฌ)
|
|
210
|
+
const dynamicRoutes = createDynamicRoutes(menuData, views, error404);
|
|
195
211
|
|
|
196
212
|
return React.createElement(
|
|
197
213
|
ScreenProvider,
|
|
@@ -199,7 +215,6 @@ export function NineHook({ menuData, views, onCatch, fallback, styles, container
|
|
|
199
215
|
React.createElement(
|
|
200
216
|
NineExceptionHook,
|
|
201
217
|
{ onCatch, fallback, styles, containerStyle },
|
|
202
|
-
// ๐ก Suspense ๋ก๋ฉ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ ์ฑ
์์ง๊ณ ํฐ๋ฏธ๋ ๊ฐ์ฑ์ผ๋ก ์ฒ๋ฆฌ
|
|
203
218
|
React.createElement(
|
|
204
219
|
Suspense,
|
|
205
220
|
{ fallback: React.createElement('div', { style: { padding: '25px', color: '#666', fontFamily: 'monospace' } }, '>> Loading component matrix...') },
|