viewlogic 1.0.4 → 1.1.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/dist/viewlogic-router.js
CHANGED
|
@@ -1123,6 +1123,7 @@ var QueryManager = class {
|
|
|
1123
1123
|
};
|
|
1124
1124
|
this.router = router;
|
|
1125
1125
|
this.currentQueryParams = {};
|
|
1126
|
+
this.currentRouteParams = {};
|
|
1126
1127
|
this.log("info", "QueryManager initialized with config:", this.config);
|
|
1127
1128
|
}
|
|
1128
1129
|
/**
|
|
@@ -1326,8 +1327,9 @@ var QueryManager = class {
|
|
|
1326
1327
|
/**
|
|
1327
1328
|
* 특정 쿼리 파라미터 가져오기
|
|
1328
1329
|
*/
|
|
1329
|
-
getQueryParam(key) {
|
|
1330
|
-
|
|
1330
|
+
getQueryParam(key, defaultValue = void 0) {
|
|
1331
|
+
const value = this.currentQueryParams ? this.currentQueryParams[key] : void 0;
|
|
1332
|
+
return value !== void 0 ? value : defaultValue;
|
|
1331
1333
|
}
|
|
1332
1334
|
/**
|
|
1333
1335
|
* 쿼리 파라미터 설정
|
|
@@ -1391,6 +1393,42 @@ var QueryManager = class {
|
|
|
1391
1393
|
setCurrentQueryParams(params) {
|
|
1392
1394
|
this.currentQueryParams = params || {};
|
|
1393
1395
|
}
|
|
1396
|
+
/**
|
|
1397
|
+
* 현재 라우팅 파라미터 설정 (navigateTo에서 호출)
|
|
1398
|
+
*/
|
|
1399
|
+
setCurrentRouteParams(params) {
|
|
1400
|
+
this.currentRouteParams = params || {};
|
|
1401
|
+
this.log("debug", "Route params set:", this.currentRouteParams);
|
|
1402
|
+
}
|
|
1403
|
+
/**
|
|
1404
|
+
* 통합된 파라미터 반환 (라우팅 파라미터 + 쿼리 파라미터)
|
|
1405
|
+
*/
|
|
1406
|
+
getAllParams() {
|
|
1407
|
+
return {
|
|
1408
|
+
...this.currentRouteParams,
|
|
1409
|
+
...this.currentQueryParams
|
|
1410
|
+
};
|
|
1411
|
+
}
|
|
1412
|
+
/**
|
|
1413
|
+
* 통합된 파라미터에서 특정 키 값 반환
|
|
1414
|
+
*/
|
|
1415
|
+
getParam(key, defaultValue = void 0) {
|
|
1416
|
+
const value = this.currentQueryParams[key] !== void 0 ? this.currentQueryParams[key] : this.currentRouteParams[key];
|
|
1417
|
+
return value !== void 0 ? value : defaultValue;
|
|
1418
|
+
}
|
|
1419
|
+
/**
|
|
1420
|
+
* 라우팅 파라미터만 반환
|
|
1421
|
+
*/
|
|
1422
|
+
getRouteParams() {
|
|
1423
|
+
return { ...this.currentRouteParams };
|
|
1424
|
+
}
|
|
1425
|
+
/**
|
|
1426
|
+
* 라우팅 파라미터에서 특정 키 값 반환
|
|
1427
|
+
*/
|
|
1428
|
+
getRouteParam(key, defaultValue = void 0) {
|
|
1429
|
+
const value = this.currentRouteParams[key];
|
|
1430
|
+
return value !== void 0 ? value : defaultValue;
|
|
1431
|
+
}
|
|
1394
1432
|
/**
|
|
1395
1433
|
* URL 업데이트 (라우터의 updateURL 메소드 호출)
|
|
1396
1434
|
*/
|
|
@@ -1416,6 +1454,7 @@ var QueryManager = class {
|
|
|
1416
1454
|
*/
|
|
1417
1455
|
destroy() {
|
|
1418
1456
|
this.currentQueryParams = {};
|
|
1457
|
+
this.currentRouteParams = {};
|
|
1419
1458
|
this.router = null;
|
|
1420
1459
|
this.log("debug", "QueryManager destroyed");
|
|
1421
1460
|
}
|
|
@@ -1558,20 +1597,26 @@ ${template}`;
|
|
|
1558
1597
|
template = this.mergeLayoutWithTemplate(routeName, layout, template);
|
|
1559
1598
|
}
|
|
1560
1599
|
}
|
|
1600
|
+
let loadedComponents = {};
|
|
1601
|
+
if (this.config.useComponents && router.componentLoader) {
|
|
1602
|
+
try {
|
|
1603
|
+
loadedComponents = await router.componentLoader.loadAllComponents();
|
|
1604
|
+
this.log("debug", `Components loaded successfully for route: ${routeName}`);
|
|
1605
|
+
} catch (error) {
|
|
1606
|
+
this.log("warn", `Component loading failed for route '${routeName}', continuing without components:`, error.message);
|
|
1607
|
+
loadedComponents = {};
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1561
1610
|
const component = {
|
|
1562
1611
|
...script,
|
|
1563
1612
|
name: script.name || this.toPascalCase(routeName),
|
|
1564
1613
|
template,
|
|
1565
|
-
components:
|
|
1614
|
+
components: loadedComponents,
|
|
1566
1615
|
data() {
|
|
1567
1616
|
const originalData = script.data ? script.data() : {};
|
|
1568
1617
|
const commonData = {
|
|
1569
1618
|
...originalData,
|
|
1570
1619
|
currentRoute: routeName,
|
|
1571
|
-
pageTitle: script.pageTitle || router.routeLoader.generatePageTitle(routeName),
|
|
1572
|
-
showHeader: script.showHeader !== false,
|
|
1573
|
-
headerTitle: script.headerTitle || router.routeLoader.generatePageTitle(routeName),
|
|
1574
|
-
headerSubtitle: script.headerSubtitle,
|
|
1575
1620
|
$query: router.queryManager?.getQueryParams() || {},
|
|
1576
1621
|
$lang: router.i18nManager?.getCurrentLanguage() || router.config.i18nDefaultLanguage,
|
|
1577
1622
|
$dataLoading: false
|
|
@@ -1580,8 +1625,9 @@ ${template}`;
|
|
|
1580
1625
|
},
|
|
1581
1626
|
computed: {
|
|
1582
1627
|
...script.computed || {},
|
|
1628
|
+
// 하위 호환성을 위해 params는 유지하되 getAllParams 사용
|
|
1583
1629
|
params() {
|
|
1584
|
-
return router.queryManager?.
|
|
1630
|
+
return router.queryManager?.getAllParams() || {};
|
|
1585
1631
|
}
|
|
1586
1632
|
},
|
|
1587
1633
|
async mounted() {
|
|
@@ -1597,13 +1643,11 @@ ${template}`;
|
|
|
1597
1643
|
// 라우팅 관련
|
|
1598
1644
|
navigateTo: (route, params) => router.navigateTo(route, params),
|
|
1599
1645
|
getCurrentRoute: () => router.getCurrentRoute(),
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
removeQueryParams: (keys) => router.queryManager?.removeQueryParams(keys),
|
|
1646
|
+
// 통합된 파라미터 관리 (라우팅 + 쿼리 파라미터)
|
|
1647
|
+
getParams: () => router.queryManager?.getAllParams() || {},
|
|
1648
|
+
getParam: (key, defaultValue) => router.queryManager?.getParam(key, defaultValue),
|
|
1604
1649
|
// i18n 관련
|
|
1605
1650
|
$t: (key, params) => router.i18nManager?.t(key, params) || key,
|
|
1606
|
-
$i18n: () => router.i18nManager || null,
|
|
1607
1651
|
// 인증 관련
|
|
1608
1652
|
$isAuthenticated: () => router.authManager?.isUserAuthenticated() || false,
|
|
1609
1653
|
$logout: () => router.authManager ? router.navigateTo(router.authManager.handleLogout()) : null,
|
|
@@ -2245,13 +2289,19 @@ var ViewLogicRouter = class {
|
|
|
2245
2289
|
this.authManager = new AuthManager(this, this.config);
|
|
2246
2290
|
}
|
|
2247
2291
|
if (this.config.useComponents) {
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2292
|
+
try {
|
|
2293
|
+
this.componentLoader = new ComponentLoader(this, {
|
|
2294
|
+
...this.config,
|
|
2295
|
+
basePath: `${this.config.basePath}/components`,
|
|
2296
|
+
cache: true,
|
|
2297
|
+
componentNames: this.config.componentNames
|
|
2298
|
+
});
|
|
2299
|
+
await this.componentLoader.loadAllComponents();
|
|
2300
|
+
this.log("info", "ComponentLoader initialized successfully");
|
|
2301
|
+
} catch (componentError) {
|
|
2302
|
+
this.log("warn", "ComponentLoader initialization failed, continuing without components:", componentError.message);
|
|
2303
|
+
this.componentLoader = null;
|
|
2304
|
+
}
|
|
2255
2305
|
}
|
|
2256
2306
|
this.isReady = true;
|
|
2257
2307
|
this.init();
|
|
@@ -2336,8 +2386,11 @@ var ViewLogicRouter = class {
|
|
|
2336
2386
|
originalRoute: routeName,
|
|
2337
2387
|
loginRoute: this.config.loginRoute
|
|
2338
2388
|
});
|
|
2339
|
-
|
|
2340
|
-
|
|
2389
|
+
if (routeName !== this.config.loginRoute) {
|
|
2390
|
+
this.navigateTo(this.config.loginRoute, { redirect: routeName });
|
|
2391
|
+
} else {
|
|
2392
|
+
this.navigateTo(this.config.loginRoute);
|
|
2393
|
+
}
|
|
2341
2394
|
}
|
|
2342
2395
|
return;
|
|
2343
2396
|
}
|
|
@@ -2378,10 +2431,17 @@ var ViewLogicRouter = class {
|
|
|
2378
2431
|
newVueApp.config.globalProperties.$router = {
|
|
2379
2432
|
navigateTo: (route, params) => this.navigateTo(route, params),
|
|
2380
2433
|
getCurrentRoute: () => this.getCurrentRoute(),
|
|
2434
|
+
// 통합된 파라미터 관리 (라우팅 + 쿼리 파라미터)
|
|
2435
|
+
getParams: () => this.queryManager?.getAllParams() || {},
|
|
2436
|
+
getParam: (key, defaultValue) => this.queryManager?.getParam(key, defaultValue),
|
|
2437
|
+
// 쿼리 파라미터 전용 메서드 (하위 호환성)
|
|
2381
2438
|
getQueryParams: () => this.queryManager?.getQueryParams() || {},
|
|
2382
|
-
getQueryParam: (key) => this.queryManager?.getQueryParam(key),
|
|
2439
|
+
getQueryParam: (key, defaultValue) => this.queryManager?.getQueryParam(key, defaultValue),
|
|
2383
2440
|
setQueryParams: (params, replace) => this.queryManager?.setQueryParams(params, replace),
|
|
2384
2441
|
removeQueryParams: (keys) => this.queryManager?.removeQueryParams(keys),
|
|
2442
|
+
// 라우팅 파라미터 전용 메서드
|
|
2443
|
+
getRouteParams: () => this.queryManager?.getRouteParams() || {},
|
|
2444
|
+
getRouteParam: (key, defaultValue) => this.queryManager?.getRouteParam(key, defaultValue),
|
|
2385
2445
|
currentRoute: this.currentHash,
|
|
2386
2446
|
currentQuery: this.queryManager?.getQueryParams() || {}
|
|
2387
2447
|
};
|
|
@@ -2428,6 +2488,9 @@ var ViewLogicRouter = class {
|
|
|
2428
2488
|
if (routeName !== this.currentHash && this.queryManager) {
|
|
2429
2489
|
this.queryManager.clearQueryParams();
|
|
2430
2490
|
}
|
|
2491
|
+
if (this.queryManager) {
|
|
2492
|
+
this.queryManager.setCurrentRouteParams(params);
|
|
2493
|
+
}
|
|
2431
2494
|
this.updateURL(routeName, params);
|
|
2432
2495
|
}
|
|
2433
2496
|
getCurrentRoute() {
|