@enonic/nextjs-adapter 3.0.5 → 3.0.6
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/guillotine/buildComponentTree.js +1 -1
- package/guillotine/buildComponentTree.js.map +1 -1
- package/guillotine/getParentRegion.js +2 -2
- package/guillotine/getParentRegion.js.map +1 -1
- package/guillotine/prefixFragmentCmpPath.d.ts +1 -0
- package/guillotine/{prefixLayoutPath.js → prefixFragmentCmpPath.js} +3 -3
- package/guillotine/prefixFragmentCmpPath.js.map +1 -0
- package/guillotine/restrictComponentsToPath.js +4 -1
- package/guillotine/restrictComponentsToPath.js.map +1 -1
- package/package.json +4 -4
- package/src/guillotine/buildComponentTree.ts +3 -9
- package/src/guillotine/getParentRegion.ts +4 -9
- package/src/guillotine/{prefixLayoutPath.ts → prefixFragmentCmpPath.ts} +3 -6
- package/src/guillotine/restrictComponentsToPath.ts +5 -2
- package/guillotine/prefixLayoutPath.d.ts +0 -1
- package/guillotine/prefixLayoutPath.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FRAGMENT_CONTENTTYPE_NAME, XP_COMPONENT_TYPE
|
|
1
|
+
import { FRAGMENT_CONTENTTYPE_NAME, XP_COMPONENT_TYPE } from '../common/constants';
|
|
2
2
|
import { parseComponentPath } from './parseComponentPath';
|
|
3
3
|
import { getParentRegion } from './getParentRegion';
|
|
4
4
|
export function buildComponentTree(comps, rootComp, contentType) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildComponentTree.js","sourceRoot":"","sources":["../src/guillotine/buildComponentTree.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"buildComponentTree.js","sourceRoot":"","sources":["../src/guillotine/buildComponentTree.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,yBAAyB,EAAE,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAGlD,MAAM,UAAU,kBAAkB,CAC9B,KAAsB,EACtB,QAAuB,EACvB,WAAoB;IAEpB,MAAM,QAAQ,GAAe,EAAE,CAAC;IAChC,MAAM,cAAc,GAAG,WAAW,KAAK,yBAAyB,CAAC;IAEjE,IAAI,cAAc,EAAE,CAAC;QACjB,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC;IAChC,CAAC;IAED,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;;QACxB,MAAM,OAAO,GAAG,kBAAkB,CAAC,WAAW,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;QAE1D,IAAI,GAAG,CAAC,IAAI,KAAK,GAAG,EAAE,CAAC;YACnB,IAAI,GAAG,CAAC,IAAI,KAAK,iBAAiB,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,KAAK,iBAAiB,CAAC,IAAI,EAAE,CAAC;gBAClF,iCAAiC;gBACjC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;gBACxC,QAAQ,CAAC,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC;gBACjC,OAAO;YACX,CAAC;iBAAM,IAAI,GAAG,CAAC,IAAI,KAAK,iBAAiB,CAAC,MAAM,IAAI,QAAQ,CAAC,IAAI,KAAK,iBAAiB,CAAC,QAAQ,EAAE,CAAC;gBAC/F,uEAAuE;gBACvE,qEAAqE;gBACrE,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU,GAAG,CAAC,GAAG,CAAC,CAAC;gBAC9C,GAAG,CAAC,OAAO,GAAG,QAAQ,CAAC;YAC3B,CAAC;QACL,CAAC;QAED,IAAI,GAAG,CAAC,IAAI,KAAK,iBAAiB,CAAC,QAAQ,EAAE,CAAC;YAC1C,uCAAuC;YACvC,GAAG,GAAG,kBAAkB,CAAC,MAAA,MAAA,GAAG,CAAC,QAAQ,0CAAE,QAAQ,0CAAE,UAAU,EAAE,GAAG,EAAE,WAAW,CAAC,CAAC;QACnF,CAAC;QAED,MAAM,MAAM,GAAG,eAAe,CAAC,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QAE5E,IAAI,MAAM,EAAE,CAAC;YACT,oEAAoE;YACpE,MAAM,QAAQ,GAAG,MAAA,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,0CAAE,KAAK,CAAC;YACpD,IAAI,QAAQ,IAAI,CAAC,EAAE,CAAC;gBAChB,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;YAC/C,CAAC;iBAAM,CAAC;gBACJ,MAAM,KAAK,CAAC,mBAAmB,GAAG,CAAC,IAAI,wBAAwB,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,2BAA2B,CAAC,CAAC;YAChI,CAAC;QACL,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AACpB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { XP_COMPONENT_TYPE } from '../common/constants';
|
|
2
|
-
import {
|
|
2
|
+
import { prefixFragmentCmpPath } from './prefixFragmentCmpPath';
|
|
3
3
|
export function getParentRegion(source, contentType, cmpPath, components = [], createMissing) {
|
|
4
4
|
let currentTree = source;
|
|
5
5
|
let currentRegion;
|
|
@@ -24,7 +24,7 @@ export function getParentRegion(source, contentType, cmpPath, components = [], c
|
|
|
24
24
|
if (i < cmpPath.length - 1) {
|
|
25
25
|
// look for layouts inside if this is not the last path fragment
|
|
26
26
|
const layout = components.find((cmp) => {
|
|
27
|
-
return cmp.type === XP_COMPONENT_TYPE.LAYOUT &&
|
|
27
|
+
return cmp.type === XP_COMPONENT_TYPE.LAYOUT && prefixFragmentCmpPath(contentType, cmp.path) === parentPath;
|
|
28
28
|
});
|
|
29
29
|
if (!layout) {
|
|
30
30
|
throw `Layout [${parentPath}] not found among components, but needed for component [${JSON.stringify(cmpPath, null, 2)}]`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getParentRegion.js","sourceRoot":"","sources":["../src/guillotine/getParentRegion.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getParentRegion.js","sourceRoot":"","sources":["../src/guillotine/getParentRegion.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AAG9D,MAAM,UAAU,eAAe,CAC3B,MAAkB,EAClB,WAAmB,EACnB,OAAuB,EACvB,aAA8B,EAAE,EAChC,aAAyB;IAEzB,IAAI,WAAW,GAAe,MAAM,CAAC;IACrC,IAAI,aAAqC,CAAC;IAC1C,IAAI,UAAU,GAAG,EAAE,CAAC;IAEpB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,YAAY,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QAChC,MAAM,UAAU,GAAG,YAAY,CAAC,MAAM,CAAC;QACvC,UAAU,IAAI,IAAI,YAAY,CAAC,MAAM,IAAI,YAAY,CAAC,KAAK,EAAE,CAAC;QAC9D,aAAa,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC;QAExC,IAAI,CAAC,aAAa,EAAE,CAAC;YACjB,IAAI,aAAa,EAAE,CAAC;gBAChB,aAAa,GAAG;oBACZ,IAAI,EAAE,UAAU;oBAChB,UAAU,EAAE,EAAE;iBACjB,CAAC;gBACF,WAAW,CAAC,UAAU,CAAC,GAAG,aAAa,CAAC;YAC5C,CAAC;iBAAM,CAAC;gBACJ,MAAM,WAAW,UAAU,iBAAiB,CAAC;YACjD,CAAC;QACL,CAAC;QAED,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACzB,gEAAgE;YAEhE,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,GAAkB,EAAE,EAAE;gBAClD,OAAO,GAAG,CAAC,IAAI,KAAK,iBAAiB,CAAC,MAAM,IAAI,qBAAqB,CAAC,WAAW,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK,UAAU,CAAC;YAChH,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,MAAM,EAAE,CAAC;gBACV,MAAM,WAAW,UAAU,2DAA2D,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC;YAC9H,CAAC;YACD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;gBAClB,MAAM,CAAC,OAAO,GAAG,EAAE,CAAC;YACxB,CAAC;YACD,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC;QACjC,CAAC;IACL,CAAC,CAAC,MAAM;IAER,OAAO,aAAa,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function prefixFragmentCmpPath(contentType: string, path: string): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FRAGMENT_CONTENTTYPE_NAME, FRAGMENT_DEFAULT_REGION_NAME
|
|
2
|
-
export function
|
|
1
|
+
import { FRAGMENT_CONTENTTYPE_NAME, FRAGMENT_DEFAULT_REGION_NAME } from '../common/constants';
|
|
2
|
+
export function prefixFragmentCmpPath(contentType, path) {
|
|
3
3
|
if (contentType !== FRAGMENT_CONTENTTYPE_NAME) {
|
|
4
4
|
return path;
|
|
5
5
|
}
|
|
@@ -10,4 +10,4 @@ export function prefixLayoutPath(contentType, path) {
|
|
|
10
10
|
return `/${FRAGMENT_DEFAULT_REGION_NAME}/0${path === '/' ? '' : path}`;
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
//# sourceMappingURL=
|
|
13
|
+
//# sourceMappingURL=prefixFragmentCmpPath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefixFragmentCmpPath.js","sourceRoot":"","sources":["../src/guillotine/prefixFragmentCmpPath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,yBAAyB,EAAE,4BAA4B,EAAC,MAAM,qBAAqB,CAAC;AAG5F,MAAM,UAAU,qBAAqB,CAAC,WAAmB,EAAE,IAAY;IACnE,IAAI,WAAW,KAAK,yBAAyB,EAAE,CAAC;QAC5C,OAAO,IAAI,CAAC;IAChB,CAAC;SAAM,CAAC;QACJ,4EAA4E;QAC5E,0EAA0E;QAC1E,8DAA8D;QAC9D,OAAO,IAAI,4BAA4B,KAAK,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC3E,CAAC;AACL,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { XP_COMPONENT_TYPE } from '../common/constants';
|
|
2
2
|
import { parseComponentPath } from './parseComponentPath';
|
|
3
|
+
import { prefixFragmentCmpPath } from './prefixFragmentCmpPath';
|
|
3
4
|
export function restrictComponentsToPath(contentType, components, componentPath) {
|
|
4
5
|
if (!componentPath || !(components === null || components === void 0 ? void 0 : components.length)) {
|
|
5
6
|
return components || [];
|
|
@@ -17,7 +18,9 @@ export function restrictComponentsToPath(contentType, components, componentPath)
|
|
|
17
18
|
const cmpPath = parseComponentPath(contentType, component.path);
|
|
18
19
|
for (let i = cmpPath.length - 2; i >= 0; i--) {
|
|
19
20
|
const parentPath = cmpPath[i];
|
|
20
|
-
const parentCmp = components.find(cmp =>
|
|
21
|
+
const parentCmp = components.find(cmp => {
|
|
22
|
+
return prefixFragmentCmpPath(contentType, cmp.path) === `/${parentPath.region}/${parentPath.index}`;
|
|
23
|
+
});
|
|
21
24
|
if (parentCmp) {
|
|
22
25
|
result.unshift(parentCmp);
|
|
23
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restrictComponentsToPath.js","sourceRoot":"","sources":["../src/guillotine/restrictComponentsToPath.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"restrictComponentsToPath.js","sourceRoot":"","sources":["../src/guillotine/restrictComponentsToPath.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AAG9D,MAAM,UAAU,wBAAwB,CACpC,WAAmB,EACnB,UAA4B,EAC5B,aAAsB;IAEtB,IAAI,CAAC,aAAa,IAAI,CAAC,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAAM,CAAA,EAAE,CAAC;QACxC,OAAO,UAAU,IAAI,EAAE,CAAC;IAC5B,CAAC;IAED,8CAA8C;IAC9C,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QACpC,OAAO,GAAG,CAAC,IAAI,KAAK,aAAa,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,SAAS,EAAE,CAAC;QACb,OAAO,EAAE,CAAC;IACd,CAAC;IAED,IAAI,MAAM,GAAoB,CAAC,SAAS,CAAC,CAAC;IAC1C,IAAI,SAAS,CAAC,IAAI,KAAK,iBAAiB,CAAC,MAAM,EAAE,CAAC;QAC9C,+CAA+C;QAC/C,MAAM,OAAO,GAAG,kBAAkB,CAAC,WAAW,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;QAChE,KAAK,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC3C,MAAM,UAAU,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YAC9B,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;gBACpC,OAAO,qBAAqB,CAAC,WAAW,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK,IAAI,UAAU,CAAC,MAAM,IAAI,UAAU,CAAC,KAAK,EAAE,CAAC;YACxG,CAAC,CAAC,CAAC;YACH,IAAI,SAAS,EAAE,CAAC;gBACZ,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YAC9B,CAAC;QACL,CAAC;IACL,CAAC;SAAM,CAAC;QACJ,0CAA0C;QAC1C,MAAM,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;QAC/G,IAAI,SAAS,CAAC,MAAM,EAAE,CAAC;YACnB,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACtC,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enonic/nextjs-adapter",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.6",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "Pavel Milkevich <pmi@enonic.com>",
|
|
@@ -60,12 +60,12 @@
|
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@edge-runtime/jest-environment": "^3.0.1",
|
|
63
|
-
"@enonic-types/core": "^7.14.
|
|
63
|
+
"@enonic-types/core": "^7.14.4",
|
|
64
64
|
"@enonic/eslint-config": "^1.2.1",
|
|
65
65
|
"@testing-library/jest-dom": "^6.4.8",
|
|
66
66
|
"@testing-library/react": "^16.0.0",
|
|
67
67
|
"@types/negotiator": "^0.6.3",
|
|
68
|
-
"@types/node": "^22.1
|
|
68
|
+
"@types/node": "^22.4.1",
|
|
69
69
|
"@types/react": "^18.3.3",
|
|
70
70
|
"@types/react-dom": "^18.3.0",
|
|
71
71
|
"@typescript-eslint/eslint-plugin": "^7.17.0",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"eslint-plugin-react": "^7.35.0",
|
|
78
78
|
"jest": "^29.7.0",
|
|
79
79
|
"jest-environment-jsdom": "^29.7.0",
|
|
80
|
-
"madge": "^
|
|
80
|
+
"madge": "^8.0.0",
|
|
81
81
|
"mkdirp": "^3.0.1",
|
|
82
82
|
"ts-jest": "^29.2.4",
|
|
83
83
|
"ts-node": "^10.9.2",
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
PageComponent,
|
|
3
|
-
RegionTree,
|
|
4
|
-
} from '../types';
|
|
1
|
+
import type {PageComponent, RegionTree} from '../types';
|
|
5
2
|
|
|
6
3
|
|
|
7
|
-
import {
|
|
8
|
-
FRAGMENT_CONTENTTYPE_NAME,
|
|
9
|
-
XP_COMPONENT_TYPE,
|
|
10
|
-
} from '../common/constants';
|
|
4
|
+
import {FRAGMENT_CONTENTTYPE_NAME, XP_COMPONENT_TYPE} from '../common/constants';
|
|
11
5
|
import {parseComponentPath} from './parseComponentPath';
|
|
12
6
|
import {getParentRegion} from './getParentRegion';
|
|
13
7
|
|
|
@@ -60,4 +54,4 @@ export function buildComponentTree(
|
|
|
60
54
|
});
|
|
61
55
|
|
|
62
56
|
return rootComp;
|
|
63
|
-
}
|
|
57
|
+
}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
PageComponent,
|
|
3
|
-
PageRegion,
|
|
4
|
-
PathFragment,
|
|
5
|
-
RegionTree,
|
|
6
|
-
} from '../types';
|
|
1
|
+
import type {PageComponent, PageRegion, PathFragment, RegionTree} from '../types';
|
|
7
2
|
|
|
8
3
|
|
|
9
4
|
import {XP_COMPONENT_TYPE} from '../common/constants';
|
|
10
|
-
import {
|
|
5
|
+
import {prefixFragmentCmpPath} from './prefixFragmentCmpPath';
|
|
11
6
|
|
|
12
7
|
|
|
13
8
|
export function getParentRegion(
|
|
@@ -43,7 +38,7 @@ export function getParentRegion(
|
|
|
43
38
|
// look for layouts inside if this is not the last path fragment
|
|
44
39
|
|
|
45
40
|
const layout = components.find((cmp: PageComponent) => {
|
|
46
|
-
return cmp.type === XP_COMPONENT_TYPE.LAYOUT &&
|
|
41
|
+
return cmp.type === XP_COMPONENT_TYPE.LAYOUT && prefixFragmentCmpPath(contentType, cmp.path) === parentPath;
|
|
47
42
|
});
|
|
48
43
|
if (!layout) {
|
|
49
44
|
throw `Layout [${parentPath}] not found among components, but needed for component [${JSON.stringify(cmpPath, null, 2)}]`;
|
|
@@ -56,4 +51,4 @@ export function getParentRegion(
|
|
|
56
51
|
} // for
|
|
57
52
|
|
|
58
53
|
return currentRegion;
|
|
59
|
-
}
|
|
54
|
+
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
FRAGMENT_CONTENTTYPE_NAME,
|
|
3
|
-
FRAGMENT_DEFAULT_REGION_NAME,
|
|
4
|
-
} from '../common/constants';
|
|
1
|
+
import {FRAGMENT_CONTENTTYPE_NAME, FRAGMENT_DEFAULT_REGION_NAME} from '../common/constants';
|
|
5
2
|
|
|
6
3
|
|
|
7
|
-
export function
|
|
4
|
+
export function prefixFragmentCmpPath(contentType: string, path: string): string {
|
|
8
5
|
if (contentType !== FRAGMENT_CONTENTTYPE_NAME) {
|
|
9
6
|
return path;
|
|
10
7
|
} else {
|
|
@@ -13,4 +10,4 @@ export function prefixLayoutPath(contentType: string, path: string): string {
|
|
|
13
10
|
// path /left/1 becomes /FRAGMENT_DEFAULT_REGION_NAME/0/left/1
|
|
14
11
|
return `/${FRAGMENT_DEFAULT_REGION_NAME}/0${path === '/' ? '' : path}`;
|
|
15
12
|
}
|
|
16
|
-
}
|
|
13
|
+
}
|
|
@@ -3,6 +3,7 @@ import type {PageComponent} from '../types';
|
|
|
3
3
|
|
|
4
4
|
import {XP_COMPONENT_TYPE} from '../common/constants';
|
|
5
5
|
import {parseComponentPath} from './parseComponentPath';
|
|
6
|
+
import {prefixFragmentCmpPath} from './prefixFragmentCmpPath';
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
export function restrictComponentsToPath(
|
|
@@ -29,7 +30,9 @@ export function restrictComponentsToPath(
|
|
|
29
30
|
const cmpPath = parseComponentPath(contentType, component.path);
|
|
30
31
|
for (let i = cmpPath.length - 2; i >= 0; i--) {
|
|
31
32
|
const parentPath = cmpPath[i];
|
|
32
|
-
const parentCmp = components.find(cmp =>
|
|
33
|
+
const parentCmp = components.find(cmp => {
|
|
34
|
+
return prefixFragmentCmpPath(contentType, cmp.path) === `/${parentPath.region}/${parentPath.index}`;
|
|
35
|
+
});
|
|
33
36
|
if (parentCmp) {
|
|
34
37
|
result.unshift(parentCmp);
|
|
35
38
|
}
|
|
@@ -42,4 +45,4 @@ export function restrictComponentsToPath(
|
|
|
42
45
|
}
|
|
43
46
|
}
|
|
44
47
|
return result;
|
|
45
|
-
}
|
|
48
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function prefixLayoutPath(contentType: string, path: string): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prefixLayoutPath.js","sourceRoot":"","sources":["../src/guillotine/prefixLayoutPath.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,yBAAyB,EACzB,4BAA4B,GAC/B,MAAM,qBAAqB,CAAC;AAG7B,MAAM,UAAU,gBAAgB,CAAC,WAAmB,EAAE,IAAY;IAC9D,IAAI,WAAW,KAAK,yBAAyB,EAAE,CAAC;QAC5C,OAAO,IAAI,CAAC;IAChB,CAAC;SAAM,CAAC;QACJ,4EAA4E;QAC5E,0EAA0E;QAC1E,8DAA8D;QAC9D,OAAO,IAAI,4BAA4B,KAAK,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC3E,CAAC;AACL,CAAC"}
|