@blocklet/pages-kit 0.4.130 → 0.4.131
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/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/cjs/utils/data-source.js +0 -3
- package/lib/cjs/utils/route.js +120 -0
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/utils/data-source.js +0 -3
- package/lib/esm/utils/route.js +116 -0
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/lib/types/types/state.d.ts +15 -2
- package/lib/types/utils/route.d.ts +26 -0
- package/package.json +1 -1
|
@@ -15,10 +15,11 @@ export interface RouteDataSource {
|
|
|
15
15
|
generateOnRender?: boolean;
|
|
16
16
|
dataSourceIds?: string[];
|
|
17
17
|
pathDataMappings?: {
|
|
18
|
-
[
|
|
18
|
+
[actualId: string]: {
|
|
19
19
|
localesGeneratedAt?: Record<string, string>;
|
|
20
20
|
pageRule?: string;
|
|
21
21
|
sectionsRules?: Record<string, string>;
|
|
22
|
+
dataSourceIds?: string[];
|
|
22
23
|
dataCache?: Record<string, any>;
|
|
23
24
|
};
|
|
24
25
|
};
|
|
@@ -27,7 +28,18 @@ export type RouteParam = {
|
|
|
27
28
|
id: string;
|
|
28
29
|
name: string;
|
|
29
30
|
index: number;
|
|
30
|
-
|
|
31
|
+
};
|
|
32
|
+
export type SubRouteMetaData = {
|
|
33
|
+
updatedAt?: string;
|
|
34
|
+
publishedAt?: string;
|
|
35
|
+
isPublic?: boolean;
|
|
36
|
+
};
|
|
37
|
+
export type RouteParamOption = {
|
|
38
|
+
id: string;
|
|
39
|
+
name: string;
|
|
40
|
+
paramId: string;
|
|
41
|
+
paramsOptions?: RouteParamOption[];
|
|
42
|
+
routeMetaData?: SubRouteMetaData;
|
|
31
43
|
};
|
|
32
44
|
export type PageRoute = {
|
|
33
45
|
id: string;
|
|
@@ -36,6 +48,7 @@ export type PageRoute = {
|
|
|
36
48
|
publishedAt: string;
|
|
37
49
|
path: string;
|
|
38
50
|
params?: RouteParam[];
|
|
51
|
+
paramsOptions?: RouteParamOption[];
|
|
39
52
|
handler: string;
|
|
40
53
|
isPublic: boolean;
|
|
41
54
|
enabledGenerate?: boolean;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { RouteParam, RouteParamOption, SubRouteMetaData, PageRoute } from '../types';
|
|
2
|
+
export interface RoutePathInfo {
|
|
3
|
+
path: string;
|
|
4
|
+
paramValues: string[];
|
|
5
|
+
originalRouteId: string;
|
|
6
|
+
paramOptionIds: string[];
|
|
7
|
+
routeMetaData?: SubRouteMetaData;
|
|
8
|
+
}
|
|
9
|
+
export declare function generateParamCombinations({ basePath, params, routeId, paramsOptions, currentIndex, currentParams, currentOptionIds, // 添加参数跟踪所有使用的选项ID
|
|
10
|
+
result, }: {
|
|
11
|
+
basePath: string;
|
|
12
|
+
params: RouteParam[];
|
|
13
|
+
routeId: string;
|
|
14
|
+
paramsOptions?: RouteParamOption[];
|
|
15
|
+
currentIndex?: number;
|
|
16
|
+
currentParams?: string[];
|
|
17
|
+
currentOptionIds?: string[];
|
|
18
|
+
result?: RoutePathInfo[];
|
|
19
|
+
}): RoutePathInfo[];
|
|
20
|
+
/**
|
|
21
|
+
* 根据参数选项ID列表获取对应的路由元数据
|
|
22
|
+
* @param paramOptionIds - 参数选项ID数组
|
|
23
|
+
* @param route - 路由对象
|
|
24
|
+
* @returns 对应的路由元数据或undefined
|
|
25
|
+
*/
|
|
26
|
+
export declare function getRouteMetaDataByOptionIds(paramOptionIds: string[], route: PageRoute): SubRouteMetaData | undefined;
|