@pronto-tools-and-more/components 15.19.0 → 15.21.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
@@ -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,45 @@ var getDossierDataSource = ({
872
867
  batchSize: 12
873
868
  };
874
869
  };
870
+
871
+ // src/parts/DossierList/DossierList.tsx
872
+ var getContentKey3 = (element) => {
873
+ if (element.dataSource.contextKey) {
874
+ return `'context'`;
875
+ }
876
+ if (element.dataSource.type === "collection-content") {
877
+ return "'collection-content'";
878
+ }
879
+ return "'content'";
880
+ };
881
+ var unrender8 = (element, renderElement) => {
882
+ const { render, language, ...rest } = element;
883
+ const contentKey = getContentKey3(element);
884
+ const node = render({
885
+ name: `$functions.id($context, ${contentKey}, 'name')`,
886
+ description: `$functions.id($context, ${contentKey}, 'description')`,
887
+ imageSrc: `$functions.id($context, ${contentKey}, 'thumbnails', 'default')`,
888
+ slug: `$functions.id($context, ${contentKey}, 'properties', 'slug')`,
889
+ totalCount: "n/a",
890
+ // TODO use real total count once supported
891
+ contentsCount: `$functions.id($context, ${contentKey}, 'contentsCount')`,
892
+ language
893
+ });
894
+ const final = renderElement(node);
895
+ return {
896
+ ...rest,
897
+ content: final
898
+ };
899
+ };
875
900
  var DossierList = ({
876
901
  render,
877
902
  collectionName,
878
903
  language,
879
904
  id,
880
- noContentFound
905
+ noContentFound,
906
+ contextId
881
907
  }) => {
882
- const dataSource = getDossierDataSource({ collectionName, id });
908
+ const dataSource = getDossierDataSource({ collectionName, id, contextId });
883
909
  const json = {
884
910
  render,
885
911
  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.19.0",
3
+ "version": "15.21.0",
4
4
  "description": "",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",