@pronto-tools-and-more/components 10.31.0 → 10.33.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/main.js +77 -38
- package/dist/parts/ArticleList/ArticleList.d.ts +3 -2
- package/dist/parts/ArticleListItemRenderer/ArticleListItemRenderer.d.ts +1 -1
- package/dist/parts/Collection/Collection.d.ts +3 -0
- package/dist/parts/GetArticleListDataSource/GetArticleListDataSource.d.ts +31 -0
- package/package.json +1 -1
package/dist/main.js
CHANGED
@@ -120,17 +120,79 @@ var createFilterFromProperties = ({
|
|
120
120
|
return outerFilter;
|
121
121
|
};
|
122
122
|
|
123
|
+
// src/parts/GetArticleListDataSource/GetArticleListDataSource.ts
|
124
|
+
var getArticleListDataSource = ({
|
125
|
+
properties,
|
126
|
+
authorId,
|
127
|
+
categoryId,
|
128
|
+
bundleId,
|
129
|
+
collectionName,
|
130
|
+
limit,
|
131
|
+
offset
|
132
|
+
}) => {
|
133
|
+
if (collectionName) {
|
134
|
+
return {
|
135
|
+
type: "collection-content",
|
136
|
+
limit: `${limit}`,
|
137
|
+
offset: `${offset}`,
|
138
|
+
collectionFilter: {
|
139
|
+
name: {
|
140
|
+
value: collectionName
|
141
|
+
}
|
142
|
+
}
|
143
|
+
};
|
144
|
+
}
|
145
|
+
const additionalFilter = createFilterFromProperties({
|
146
|
+
properties,
|
147
|
+
authorId,
|
148
|
+
categoryId,
|
149
|
+
bundleId
|
150
|
+
});
|
151
|
+
const filter = {
|
152
|
+
AND: [
|
153
|
+
{
|
154
|
+
postType: {
|
155
|
+
value: "post"
|
156
|
+
}
|
157
|
+
},
|
158
|
+
{
|
159
|
+
contentType: {
|
160
|
+
value: "POST"
|
161
|
+
}
|
162
|
+
},
|
163
|
+
...additionalFilter
|
164
|
+
]
|
165
|
+
};
|
166
|
+
const dataSource = {
|
167
|
+
type: "content",
|
168
|
+
filter,
|
169
|
+
limit: `${limit}`,
|
170
|
+
offset: `${offset}`,
|
171
|
+
sort: [
|
172
|
+
{
|
173
|
+
publicationDate: {
|
174
|
+
direction: "DESC"
|
175
|
+
}
|
176
|
+
}
|
177
|
+
],
|
178
|
+
contextKey: "content"
|
179
|
+
};
|
180
|
+
return dataSource;
|
181
|
+
};
|
182
|
+
|
123
183
|
// src/parts/ArticleList/ArticleList.tsx
|
124
184
|
var unrender2 = (element, renderElement) => {
|
125
185
|
const { render, ...rest } = element;
|
186
|
+
const isCollection = element.dataSource.type === "collection-content";
|
187
|
+
const contentKey = isCollection ? "'collection-content'" : "'content'";
|
126
188
|
const node = render({
|
127
|
-
name: `$functions.id($context,
|
128
|
-
description: `$functions.id($context,
|
129
|
-
imageSrc: `$functions.id($context,
|
130
|
-
slug: `$functions.id($context,
|
131
|
-
metadataVideoPodcast: `$functions.id($context,
|
132
|
-
readTime: `$functions.getReadTime($context
|
133
|
-
publicationDate: `$functions.id($context,
|
189
|
+
name: `$functions.id($context, ${contentKey}, 'name')`,
|
190
|
+
description: `$functions.id($context, ${contentKey}, 'description')`,
|
191
|
+
imageSrc: `$functions.id($context, ${contentKey}, 'thumbnails', 'default')`,
|
192
|
+
slug: `$functions.id($context, ${contentKey}, 'properties', 'slug')`,
|
193
|
+
metadataVideoPodcast: `$functions.id($context, ${contentKey}, 'properties', 'metadataVideoPodcast')`,
|
194
|
+
readTime: `$functions.getReadTime($functions.id($context, ${contentKey}))`,
|
195
|
+
publicationDate: `$functions.id($context, ${contentKey}, 'publicationDate')`
|
134
196
|
});
|
135
197
|
const final = renderElement(node);
|
136
198
|
return {
|
@@ -145,45 +207,22 @@ var ArticleList = ({
|
|
145
207
|
categoryId,
|
146
208
|
bundleId,
|
147
209
|
limit,
|
148
|
-
offset
|
210
|
+
offset,
|
211
|
+
collectionName
|
149
212
|
}) => {
|
150
|
-
const
|
213
|
+
const dataSource = getArticleListDataSource({
|
151
214
|
properties,
|
152
215
|
authorId,
|
153
216
|
categoryId,
|
154
|
-
bundleId
|
217
|
+
bundleId,
|
218
|
+
limit,
|
219
|
+
offset,
|
220
|
+
collectionName
|
155
221
|
});
|
156
222
|
const json = {
|
157
223
|
render,
|
158
224
|
unrender: unrender2,
|
159
|
-
dataSource
|
160
|
-
type: "content",
|
161
|
-
filter: {
|
162
|
-
AND: [
|
163
|
-
{
|
164
|
-
postType: {
|
165
|
-
value: "post"
|
166
|
-
}
|
167
|
-
},
|
168
|
-
{
|
169
|
-
contentType: {
|
170
|
-
value: "POST"
|
171
|
-
}
|
172
|
-
},
|
173
|
-
...additionalFilter
|
174
|
-
]
|
175
|
-
},
|
176
|
-
limit: `${limit}`,
|
177
|
-
offset: `${offset}`,
|
178
|
-
sort: [
|
179
|
-
{
|
180
|
-
publicationDate: {
|
181
|
-
direction: "DESC"
|
182
|
-
}
|
183
|
-
}
|
184
|
-
],
|
185
|
-
contextKey: "content"
|
186
|
-
},
|
225
|
+
dataSource,
|
187
226
|
type: "list",
|
188
227
|
tapEntry: {
|
189
228
|
value: {
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { ArticleListItemRenderer } from "../ArticleListItemRenderer/ArticleListItemRenderer.ts";
|
2
|
-
export declare const ArticleList: ({ properties, render, authorId, categoryId, bundleId, limit, offset, }: {
|
1
|
+
import type { ArticleListItemRenderer } from "../ArticleListItemRenderer/ArticleListItemRenderer.ts";
|
2
|
+
export declare const ArticleList: ({ properties, render, authorId, categoryId, bundleId, limit, offset, collectionName, }: {
|
3
3
|
properties?: any;
|
4
4
|
authorId?: string;
|
5
5
|
categoryId?: string;
|
@@ -7,4 +7,5 @@ export declare const ArticleList: ({ properties, render, authorId, categoryId, b
|
|
7
7
|
render: ArticleListItemRenderer;
|
8
8
|
limit?: number;
|
9
9
|
offset?: number;
|
10
|
+
collectionName?: string;
|
10
11
|
}) => import("react").JSX.Element;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type React from "react";
|
2
2
|
import type { IArticleListItem } from "../IArticleListItem/IArticleListItem.ts";
|
3
3
|
export interface ArticleListItemRenderer {
|
4
|
-
(
|
4
|
+
(item: IArticleListItem): React.ReactNode;
|
5
5
|
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
export declare const getArticleListDataSource: ({ properties, authorId, categoryId, bundleId, collectionName, limit, offset, }: {
|
2
|
+
properties: any;
|
3
|
+
authorId: any;
|
4
|
+
categoryId: any;
|
5
|
+
bundleId: any;
|
6
|
+
collectionName: any;
|
7
|
+
limit: any;
|
8
|
+
offset: any;
|
9
|
+
}) => {
|
10
|
+
type: string;
|
11
|
+
filter: {
|
12
|
+
AND: any[];
|
13
|
+
};
|
14
|
+
limit: string;
|
15
|
+
offset: string;
|
16
|
+
sort: {
|
17
|
+
publicationDate: {
|
18
|
+
direction: string;
|
19
|
+
};
|
20
|
+
}[];
|
21
|
+
contextKey: string;
|
22
|
+
} | {
|
23
|
+
type: string;
|
24
|
+
limit: string;
|
25
|
+
offset: string;
|
26
|
+
collectionFilter: {
|
27
|
+
name: {
|
28
|
+
value: any;
|
29
|
+
};
|
30
|
+
};
|
31
|
+
};
|