@paroicms/internal-anywhere-lib 1.23.0 → 1.24.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/parts.helper.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { nbVal } from "@paroi/data-formatters-lib";
|
|
2
2
|
export function sortParts(listType, parts) {
|
|
3
|
-
if (listType.
|
|
3
|
+
if (listType.sorting === "manual") {
|
|
4
4
|
parts.sort((a, b) => {
|
|
5
5
|
if (a.orderNum === b.orderNum)
|
|
6
6
|
return 0;
|
|
@@ -11,7 +11,7 @@ export function sortParts(listType, parts) {
|
|
|
11
11
|
return a.orderNum - b.orderNum;
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
|
-
else if (includesOrderBy(listType.
|
|
14
|
+
else if (includesOrderBy(listType.sorting, ["publishDate", "desc"])) {
|
|
15
15
|
parts.sort((a, b) => {
|
|
16
16
|
if (a.publishDate && b.publishDate) {
|
|
17
17
|
if (a.publishDate === b.publishDate) {
|
|
@@ -24,7 +24,7 @@ export function sortParts(listType, parts) {
|
|
|
24
24
|
return 0;
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
else if (includesOrderBy(listType.
|
|
27
|
+
else if (includesOrderBy(listType.sorting, ["publishDate", "asc"])) {
|
|
28
28
|
parts.sort((a, b) => {
|
|
29
29
|
if (a.publishDate && b.publishDate) {
|
|
30
30
|
if (a.publishDate === b.publishDate) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { ScDocumentType, ScFTextFieldType, ScFieldType, ScNodeType, ScPartType, ScRegularDocumentType,
|
|
1
|
+
import type { ScDocumentType, ScFTextFieldType, ScFieldType, ScNodeType, ScPartType, ScRegularDocumentType, ScRoutingDocumentType, ScSiteSchema } from "@paroicms/public-anywhere-lib";
|
|
2
2
|
export declare function getNodeTypeByName(siteSchema: ScSiteSchema, typeName: string): ScNodeType;
|
|
3
3
|
export declare function getDocumentTypeByName(siteSchema: ScSiteSchema, typeName: string): ScDocumentType;
|
|
4
|
+
export declare function getRoutingDocumentTypeByName(siteSchema: ScSiteSchema, typeName: string): ScRoutingDocumentType;
|
|
5
|
+
export declare function getRegularDocumentTypeByName(siteSchema: ScSiteSchema, typeName: string): ScRegularDocumentType;
|
|
4
6
|
export declare function getPartTypeByName(siteSchema: ScSiteSchema, typeName: string): ScPartType;
|
|
5
|
-
export declare function getRoutingPointDocumentTypes(siteSchema: ScSiteSchema): ScRoutingPointDocumentType[];
|
|
6
|
-
export declare function regularChildDocumentTypesOf(siteSchema: ScSiteSchema, parentTypeName: string): ScRegularDocumentType[];
|
|
7
7
|
export declare function getNodeTypeByKebabName(siteSchema: ScSiteSchema, kebabName: string, kind: "document"): ScDocumentType | undefined;
|
|
8
8
|
export declare function getNodeTypeByKebabName(siteSchema: ScSiteSchema, kebabName: string, kind: "part"): ScPartType | undefined;
|
|
9
9
|
export declare function getMediaLimitPerDocument(siteSchema: ScSiteSchema, documentType: ScDocumentType): number | undefined;
|
|
@@ -11,6 +11,20 @@ export function getDocumentTypeByName(siteSchema, typeName) {
|
|
|
11
11
|
}
|
|
12
12
|
return nodeType;
|
|
13
13
|
}
|
|
14
|
+
export function getRoutingDocumentTypeByName(siteSchema, typeName) {
|
|
15
|
+
const nodeType = siteSchema.nodeTypes[typeName];
|
|
16
|
+
if (!nodeType || nodeType.kind !== "document" || nodeType.documentKind !== "routing") {
|
|
17
|
+
throw new Error(`Unknown routing document type '${typeName}'`);
|
|
18
|
+
}
|
|
19
|
+
return nodeType;
|
|
20
|
+
}
|
|
21
|
+
export function getRegularDocumentTypeByName(siteSchema, typeName) {
|
|
22
|
+
const nodeType = siteSchema.nodeTypes[typeName];
|
|
23
|
+
if (!nodeType || nodeType.kind !== "document" || nodeType.documentKind !== "regular") {
|
|
24
|
+
throw new Error(`Unknown regular document type '${typeName}'`);
|
|
25
|
+
}
|
|
26
|
+
return nodeType;
|
|
27
|
+
}
|
|
14
28
|
export function getPartTypeByName(siteSchema, typeName) {
|
|
15
29
|
const nodeType = siteSchema.nodeTypes[typeName];
|
|
16
30
|
if (!nodeType || nodeType.kind !== "part") {
|
|
@@ -18,14 +32,6 @@ export function getPartTypeByName(siteSchema, typeName) {
|
|
|
18
32
|
}
|
|
19
33
|
return nodeType;
|
|
20
34
|
}
|
|
21
|
-
export function getRoutingPointDocumentTypes(siteSchema) {
|
|
22
|
-
return Object.values(siteSchema.nodeTypes).filter((item) => item.kind === "document" && item.documentKind === "routingPoint");
|
|
23
|
-
}
|
|
24
|
-
export function regularChildDocumentTypesOf(siteSchema, parentTypeName) {
|
|
25
|
-
return (getDocumentTypeByName(siteSchema, parentTypeName)
|
|
26
|
-
.children?.map((typeName) => getDocumentTypeByName(siteSchema, typeName))
|
|
27
|
-
.filter((nodeType) => nodeType.documentKind === "regular") ?? []);
|
|
28
|
-
}
|
|
29
35
|
export function getNodeTypeByKebabName(siteSchema, kebabName, kind) {
|
|
30
36
|
return Object.values(siteSchema.nodeTypes).find((item) => item.kind === kind && item.kebabName === kebabName);
|
|
31
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"site-schema-helpers.js","sourceRoot":"","sources":["../src/site-schema-helpers.ts"],"names":[],"mappings":"AAWA,MAAM,UAAU,iBAAiB,CAAC,UAAwB,EAAE,QAAgB;IAC1E,MAAM,QAAQ,GAAG,UAAU,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAChD,IAAI,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,sBAAsB,QAAQ,GAAG,CAAC,CAAC;IAClE,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,UAAwB,EAAE,QAAgB;IAC9E,MAAM,QAAQ,GAAG,UAAU,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAChD,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;QAC9C,M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,QAAQ,CAAC,WAAW,CAAC;IACxC,IAAI,UAAU,EAAE,CAAC;QACf,MAAM,GAAG,GAAG,UAAU,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,iBAAiB,CAAC;QACnE,IAAI,GAAG,KAAK,SAAS;YAAE,OAAO,GAAG,CAAC;IACpC,CAAC;IACD,OAAO,UAAU,CAAC,aAAa,CAAC,OAAO,CAAC,iBAAiB,CAAC;AAC5D,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,SAAsB;IACrD,OAAO,SAAS,CAAC,QAAQ,KAAK,YAAY,IAAI,SAAS,CAAC,QAAQ,KAAK,MAAM,CAAC;AAC9E,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,YAA4B;IAC9D,OAAO,YAAY,CAAC,YAAY,KAAK,SAAS,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC;AAC7E,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paroicms/internal-anywhere-lib",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.24.0",
|
|
4
4
|
"description": "Front lib for Paroi CMS.",
|
|
5
5
|
"author": "Paroi Team",
|
|
6
6
|
"keywords": [
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@paroi/data-formatters-lib": "~0.4.0",
|
|
27
|
-
"@paroicms/public-anywhere-lib": "0.
|
|
27
|
+
"@paroicms/public-anywhere-lib": "0.18.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"rimraf": "~6.0.1",
|