@pronto-tools-and-more/components 15.18.0 → 15.20.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/main.js CHANGED
@@ -330,7 +330,7 @@ var createPropertiesProxy = ({ original, contentKey }) => {
330
330
  // src/parts/ArticleList/ArticleList.tsx
331
331
  var getContentKey = (element) => {
332
332
  if (element.dataSource.contextKey) {
333
- return `'${element.dataSource.contextKey}'`;
333
+ return `'content'`;
334
334
  }
335
335
  if (element.dataSource.type === "collection-content") {
336
336
  return "'collection-content'";
@@ -812,27 +812,7 @@ var DigitalMagazineList = ({
812
812
  return /* @__PURE__ */ React.createElement("div", { className: "DigitalMagazineList" }, /* @__PURE__ */ React.createElement(JsonComponent, { json }));
813
813
  };
814
814
 
815
- // src/parts/DossierList/DossierList.tsx
816
- var unrender8 = (element, renderElement) => {
817
- const { render, language, ...rest } = element;
818
- const isCollection = element.dataSource.type === "collection-content";
819
- const contentKey = isCollection ? "'collection-content'" : "'content'";
820
- const node = render({
821
- name: `$functions.id($context, ${contentKey}, 'name')`,
822
- description: `$functions.id($context, ${contentKey}, 'description')`,
823
- imageSrc: `$functions.id($context, ${contentKey}, 'thumbnails', 'default')`,
824
- slug: `$functions.id($context, ${contentKey}, 'properties', 'slug')`,
825
- totalCount: "n/a",
826
- // TODO use real total count once supported
827
- contentsCount: `$functions.id($context, ${contentKey}, 'contentsCount')`,
828
- language
829
- });
830
- const final = renderElement(node);
831
- return {
832
- ...rest,
833
- content: final
834
- };
835
- };
815
+ // src/parts/GetDossiersDataSource/GetDossiersDataSource.ts
836
816
  var getAndFilter = ({ id }) => {
837
817
  const and = [
838
818
  {
@@ -848,8 +828,23 @@ var getAndFilter = ({ id }) => {
848
828
  };
849
829
  var getDossierDataSource = ({
850
830
  collectionName,
851
- id
831
+ id,
832
+ contextId,
833
+ limit,
834
+ offset
852
835
  }) => {
836
+ if (contextId) {
837
+ if (!contextId.startsWith("$context.") && !contextId.startsWith("$functions.")) {
838
+ throw new Error(`context id must start with $context or $functions.`);
839
+ }
840
+ const dataSource = {
841
+ type: "context",
842
+ data: contextId,
843
+ limit: `${limit}`,
844
+ offset: `${offset}`
845
+ };
846
+ return dataSource;
847
+ }
853
848
  if (collectionName) {
854
849
  return {
855
850
  type: "collection-content",
@@ -872,14 +867,41 @@ var getDossierDataSource = ({
872
867
  batchSize: 12
873
868
  };
874
869
  };
870
+
871
+ // src/parts/DossierList/DossierList.tsx
872
+ var getContentKey3 = (element) => {
873
+ const isCollection = element.dataSource.type === "collection-content";
874
+ const contentKey = isCollection ? "'collection-content'" : "'content'";
875
+ return contentKey;
876
+ };
877
+ var unrender8 = (element, renderElement) => {
878
+ const { render, language, ...rest } = element;
879
+ const contentKey = getContentKey3(element);
880
+ const node = render({
881
+ name: `$functions.id($context, ${contentKey}, 'name')`,
882
+ description: `$functions.id($context, ${contentKey}, 'description')`,
883
+ imageSrc: `$functions.id($context, ${contentKey}, 'thumbnails', 'default')`,
884
+ slug: `$functions.id($context, ${contentKey}, 'properties', 'slug')`,
885
+ totalCount: "n/a",
886
+ // TODO use real total count once supported
887
+ contentsCount: `$functions.id($context, ${contentKey}, 'contentsCount')`,
888
+ language
889
+ });
890
+ const final = renderElement(node);
891
+ return {
892
+ ...rest,
893
+ content: final
894
+ };
895
+ };
875
896
  var DossierList = ({
876
897
  render,
877
898
  collectionName,
878
899
  language,
879
900
  id,
880
- noContentFound
901
+ noContentFound,
902
+ contextId
881
903
  }) => {
882
- const dataSource = getDossierDataSource({ collectionName, id });
904
+ const dataSource = getDossierDataSource({ collectionName, id, contextId });
883
905
  const json = {
884
906
  render,
885
907
  unrender: unrender8,
@@ -1,8 +1,9 @@
1
1
  import { DossierListItemRenderer } from "../DossierListItemRenderer/DossierListItemRenderer.ts";
2
- export declare const DossierList: ({ render, collectionName, language, id, noContentFound, }: {
2
+ export declare const DossierList: ({ render, collectionName, language, id, noContentFound, contextId, }: {
3
3
  render: DossierListItemRenderer;
4
4
  collectionName?: string;
5
5
  language?: string;
6
6
  id?: string;
7
7
  noContentFound?: string;
8
+ contextId?: string;
8
9
  }) => import("react").JSX.Element;
@@ -0,0 +1,34 @@
1
+ export declare const getDossierDataSource: ({ collectionName, id, contextId, limit, offset, }: {
2
+ collectionName?: string;
3
+ id?: string;
4
+ contextId?: string;
5
+ limit?: any;
6
+ offset?: any;
7
+ }) => {
8
+ type: string;
9
+ data: string;
10
+ limit: string;
11
+ offset: string;
12
+ } | {
13
+ type: string;
14
+ limit: string;
15
+ offset: string;
16
+ collectionFilter: {
17
+ name: {
18
+ value: string;
19
+ };
20
+ };
21
+ filter?: undefined;
22
+ sort?: undefined;
23
+ batchSize?: undefined;
24
+ } | {
25
+ filter: {
26
+ AND: any[];
27
+ };
28
+ sort: never[];
29
+ type: string;
30
+ batchSize: number;
31
+ limit?: undefined;
32
+ offset?: undefined;
33
+ collectionFilter?: undefined;
34
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pronto-tools-and-more/components",
3
- "version": "15.18.0",
3
+ "version": "15.20.0",
4
4
  "description": "",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",